From: support Date: Fri, 5 Aug 2022 14:55:20 +0000 (+0000) Subject: Built motion from commit f296b652.|2.6.15 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=4d378eba7823715e202489f5fb76c11949e4d526;p=motion2.git Built motion from commit f296b652.|2.6.15 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 93d4309..fa6b94f 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-08-05T14:31:26.768Z", + "time": "2022-08-05T14:47:37.431Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 6062e3b..d77469f 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-08-05T14:31:26.768Z", + "time": "2022-08-05T14:47:37.431Z", "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 306a599..7f16194 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 _0xc613=['integration','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','action','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc613,0x115));var _0x3c61=function(_0x40b22f,_0x446b2b){_0x40b22f=_0x40b22f-0x0;var _0x1d42e7=_0xc613[_0x40b22f];return _0x1d42e7;};'use strict';var Sequelize=require(_0x3c61('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5cb0b3){return this['getDataValue'](_0x3c61('0x1'));}},'action':{'type':Sequelize[_0x3c61('0x2')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x3c61('0x3'),'motionbar',_0x3c61('0x4'),'urlForward',_0x3c61('0x5'),'bot',_0x3c61('0x6')]],'msg':_0x3c61('0x7')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x3c61('0x8')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x3c61('0x9')},'data3':{'type':Sequelize[_0x3c61('0x2')](0x1000),'comment':_0x3c61('0xa')},'data4':{'type':Sequelize[_0x3c61('0x2')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x3c61('0x2')](0x1000),'comments':_0x3c61('0xb')},'data6':{'type':Sequelize[_0x3c61('0x2')],'comments':_0x3c61('0xc')},'data7':{'type':Sequelize['TEXT'],'comments':_0x3c61('0xd')}}; \ No newline at end of file +var _0xf143=['action','STRING','contactManager','motionbar','jscripty','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','VIRTUAL','getDataValue'];(function(_0x14f386,_0x201f09){var _0x3c46a1=function(_0x320d87){while(--_0x320d87){_0x14f386['push'](_0x14f386['shift']());}};_0x3c46a1(++_0x201f09);}(_0xf143,0x12a));var _0x3f14=function(_0x2be004,_0x7393c3){_0x2be004=_0x2be004-0x0;var _0x1722ea=_0xf143[_0x2be004];return _0x1722ea;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3f14('0x0')],'get':function(_0x5969b5){return this[_0x3f14('0x1')](_0x3f14('0x2'));}},'action':{'type':Sequelize[_0x3f14('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3f14('0x4'),'integration',_0x3f14('0x5'),_0x3f14('0x6'),'urlForward',_0x3f14('0x7'),_0x3f14('0x8'),'script']],'msg':_0x3f14('0x9')}},'comment':_0x3f14('0x9')},'data1':{'type':Sequelize[_0x3f14('0x3')](0x1000),'comment':_0x3f14('0xa')},'data2':{'type':Sequelize[_0x3f14('0x3')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3f14('0xb')},'data4':{'type':Sequelize[_0x3f14('0x3')](0x1000),'comments':_0x3f14('0xc')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x3f14('0x3')],'comments':_0x3f14('0xd')},'data7':{'type':Sequelize[_0x3f14('0xe')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 3c356a8..ec2006c 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 _0x6a18=['stack','name','send','Action','find','body','catch','params','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6a18,0xb8));var _0x86a1=function(_0x2a2dc5,_0x41d63c){_0x2a2dc5=_0x2a2dc5-0x0;var _0x3d8e98=_0x6a18[_0x2a2dc5];return _0x3d8e98;};'use strict';var emlformat=require(_0x86a1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x86a1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x86a1('0x2'));var moment=require(_0x86a1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x86a1('0x4'));var util=require(_0x86a1('0x5'));var path=require('path');var sox=require(_0x86a1('0x6'));var csv=require(_0x86a1('0x7'));var ejs=require(_0x86a1('0x8'));var fs=require('fs');var fs_extra=require(_0x86a1('0x9'));var _=require(_0x86a1('0xa'));var squel=require(_0x86a1('0xb'));var crypto=require('crypto');var jsforce=require(_0x86a1('0xc'));var deskjs=require(_0x86a1('0xd'));var toCsv=require(_0x86a1('0x7'));var querystring=require(_0x86a1('0xe'));var Papa=require(_0x86a1('0xf'));var Redis=require(_0x86a1('0x10'));var authService=require(_0x86a1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86a1('0x12'));var logger=require('../../config/logger')(_0x86a1('0x13'));var utils=require(_0x86a1('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x86a1('0x15'))['db'];function respondWithStatusCode(_0x2d4fb6,_0x158dc8){_0x158dc8=_0x158dc8||0xcc;return function(_0x5bc1eb){if(_0x5bc1eb){return _0x2d4fb6['sendStatus'](_0x158dc8);}return _0x2d4fb6[_0x86a1('0x16')](_0x158dc8)['end']();};}function respondWithResult(_0x2bd513,_0x144bb8){_0x144bb8=_0x144bb8||0xc8;return function(_0x1a7ecd){if(_0x1a7ecd){return _0x2bd513['status'](_0x144bb8)[_0x86a1('0x17')](_0x1a7ecd);}};}function respondWithFilteredResult(_0x28eb80,_0x37c1ea){return function(_0x442209){if(_0x442209){var _0x428454=typeof _0x37c1ea[_0x86a1('0x18')]===_0x86a1('0x19')&&typeof _0x37c1ea['limit']===_0x86a1('0x19');var _0x90bd7a=_0x442209[_0x86a1('0x1a')];var _0x3d2f63=_0x428454?0x0:_0x37c1ea[_0x86a1('0x18')];var _0x3c539b=_0x428454?_0x442209[_0x86a1('0x1a')]:_0x37c1ea[_0x86a1('0x18')]+_0x37c1ea['limit'];var _0x3e56e7;if(_0x3c539b>=_0x90bd7a){_0x3c539b=_0x90bd7a;_0x3e56e7=0xc8;}else{_0x3e56e7=0xce;}_0x28eb80[_0x86a1('0x16')](_0x3e56e7);return _0x28eb80[_0x86a1('0x1b')](_0x86a1('0x1c'),_0x3d2f63+'-'+_0x3c539b+'/'+_0x90bd7a)[_0x86a1('0x17')](_0x442209);}return null;};}function patchUpdates(_0x37bf23){return function(_0x5ca061){try{jsonpatch[_0x86a1('0x1d')](_0x5ca061,_0x37bf23,!![]);}catch(_0x3b0881){return BPromise[_0x86a1('0x1e')](_0x3b0881);}return _0x5ca061[_0x86a1('0x1f')]();};}function saveUpdates(_0x44690e,_0x597c94){return function(_0x222091){if(_0x222091){return _0x222091[_0x86a1('0x20')](_0x44690e)[_0x86a1('0x21')](function(_0x172dac){return _0x172dac;});}return null;};}function removeEntity(_0x4aa2e3,_0x225d86){return function(_0x3d5ffd){if(_0x3d5ffd){return _0x3d5ffd[_0x86a1('0x22')]()['then'](function(){_0x4aa2e3[_0x86a1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1439b6,_0x5f5bee){return function(_0x2ca7f4){if(!_0x2ca7f4){_0x1439b6['sendStatus'](0x194);}return _0x2ca7f4;};}function handleError(_0x195ea9,_0x796b3c){_0x796b3c=_0x796b3c||0x1f4;return function(_0x55ab6a){logger[_0x86a1('0x23')](_0x55ab6a[_0x86a1('0x24')]);if(_0x55ab6a[_0x86a1('0x25')]){delete _0x55ab6a[_0x86a1('0x25')];}_0x195ea9['status'](_0x796b3c)[_0x86a1('0x26')](_0x55ab6a);};}exports[_0x86a1('0x20')]=function(_0x5aa04c,_0x3d0519){if(_0x5aa04c['body']['id']){delete _0x5aa04c['body']['id'];}return db[_0x86a1('0x27')][_0x86a1('0x28')]({'where':{'id':_0x5aa04c['params']['id']}})['then'](handleEntityNotFound(_0x3d0519,null))[_0x86a1('0x21')](saveUpdates(_0x5aa04c[_0x86a1('0x29')],null))[_0x86a1('0x21')](respondWithResult(_0x3d0519,null))[_0x86a1('0x2a')](handleError(_0x3d0519,null));};exports['destroy']=function(_0x3af52,_0xe7e593){return db[_0x86a1('0x27')][_0x86a1('0x28')]({'where':{'id':_0x3af52[_0x86a1('0x2b')]['id']}})['then'](handleEntityNotFound(_0xe7e593,null))['then'](removeEntity(_0xe7e593,null))[_0x86a1('0x2a')](handleError(_0xe7e593,null));}; \ No newline at end of file +var _0x1531=['limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','body','Action','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count'];(function(_0x1b6783,_0x2857e6){var _0x587b50=function(_0x48b634){while(--_0x48b634){_0x1b6783['push'](_0x1b6783['shift']());}};_0x587b50(++_0x2857e6);}(_0x1531,0xfc));var _0x1153=function(_0x3441cc,_0x1f5e2c){_0x3441cc=_0x3441cc-0x0;var _0x3ce7a6=_0x1531[_0x3441cc];return _0x3ce7a6;};'use strict';var emlformat=require(_0x1153('0x0'));var rimraf=require(_0x1153('0x1'));var zipdir=require(_0x1153('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1153('0x3'));var moment=require(_0x1153('0x4'));var BPromise=require(_0x1153('0x5'));var Mustache=require('mustache');var util=require(_0x1153('0x6'));var path=require(_0x1153('0x7'));var sox=require(_0x1153('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1153('0x9'));var _=require(_0x1153('0xa'));var squel=require('squel');var crypto=require(_0x1153('0xb'));var jsforce=require(_0x1153('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1153('0xd'));var querystring=require(_0x1153('0xe'));var Papa=require(_0x1153('0xf'));var Redis=require('ioredis');var authService=require(_0x1153('0x10'));var qs=require(_0x1153('0x11'));var as=require(_0x1153('0x12'));var hardwareService=require(_0x1153('0x13'));var logger=require(_0x1153('0x14'))('api');var utils=require(_0x1153('0x15'));var config=require(_0x1153('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1153('0x17'))['db'];function respondWithStatusCode(_0x417b1e,_0x45cd66){_0x45cd66=_0x45cd66||0xcc;return function(_0x427911){if(_0x427911){return _0x417b1e[_0x1153('0x18')](_0x45cd66);}return _0x417b1e[_0x1153('0x19')](_0x45cd66)[_0x1153('0x1a')]();};}function respondWithResult(_0x434e72,_0x56b830){_0x56b830=_0x56b830||0xc8;return function(_0x2395d1){if(_0x2395d1){return _0x434e72[_0x1153('0x19')](_0x56b830)['json'](_0x2395d1);}};}function respondWithFilteredResult(_0x13a1d2,_0x2ddee0){return function(_0x12ef9c){if(_0x12ef9c){var _0x4d12da=typeof _0x2ddee0[_0x1153('0x1b')]===_0x1153('0x1c')&&typeof _0x2ddee0['limit']==='undefined';var _0x4b1cc7=_0x12ef9c[_0x1153('0x1d')];var _0x1ea8b0=_0x4d12da?0x0:_0x2ddee0[_0x1153('0x1b')];var _0x1e40d3=_0x4d12da?_0x12ef9c[_0x1153('0x1d')]:_0x2ddee0[_0x1153('0x1b')]+_0x2ddee0[_0x1153('0x1e')];var _0x41dd67;if(_0x1e40d3>=_0x4b1cc7){_0x1e40d3=_0x4b1cc7;_0x41dd67=0xc8;}else{_0x41dd67=0xce;}_0x13a1d2['status'](_0x41dd67);return _0x13a1d2[_0x1153('0x1f')](_0x1153('0x20'),_0x1ea8b0+'-'+_0x1e40d3+'/'+_0x4b1cc7)[_0x1153('0x21')](_0x12ef9c);}return null;};}function patchUpdates(_0x3b5cc7){return function(_0x8f8158){try{jsonpatch[_0x1153('0x22')](_0x8f8158,_0x3b5cc7,!![]);}catch(_0x4cccf7){return BPromise[_0x1153('0x23')](_0x4cccf7);}return _0x8f8158[_0x1153('0x24')]();};}function saveUpdates(_0x3447b5,_0x7e3c86){return function(_0x43b2fc){if(_0x43b2fc){return _0x43b2fc[_0x1153('0x25')](_0x3447b5)[_0x1153('0x26')](function(_0x166370){return _0x166370;});}return null;};}function removeEntity(_0x5d95c5,_0x42991f){return function(_0x507da0){if(_0x507da0){return _0x507da0[_0x1153('0x27')]()['then'](function(){_0x5d95c5['status'](0xcc)[_0x1153('0x1a')]();});}};}function handleEntityNotFound(_0x31b3f3,_0x13a030){return function(_0xc420f){if(!_0xc420f){_0x31b3f3['sendStatus'](0x194);}return _0xc420f;};}function handleError(_0x49cafc,_0x2eebfe){_0x2eebfe=_0x2eebfe||0x1f4;return function(_0x4705a8){logger['error'](_0x4705a8[_0x1153('0x28')]);if(_0x4705a8[_0x1153('0x29')]){delete _0x4705a8[_0x1153('0x29')];}_0x49cafc[_0x1153('0x19')](_0x2eebfe)[_0x1153('0x2a')](_0x4705a8);};}exports[_0x1153('0x25')]=function(_0x4ab194,_0x50401b){if(_0x4ab194[_0x1153('0x2b')]['id']){delete _0x4ab194[_0x1153('0x2b')]['id'];}return db[_0x1153('0x2c')][_0x1153('0x2d')]({'where':{'id':_0x4ab194['params']['id']}})[_0x1153('0x26')](handleEntityNotFound(_0x50401b,null))['then'](saveUpdates(_0x4ab194[_0x1153('0x2b')],null))[_0x1153('0x26')](respondWithResult(_0x50401b,null))[_0x1153('0x2e')](handleError(_0x50401b,null));};exports['destroy']=function(_0x2043bb,_0x36f555){return db[_0x1153('0x2c')]['find']({'where':{'id':_0x2043bb['params']['id']}})[_0x1153('0x26')](handleEntityNotFound(_0x36f555,null))[_0x1153('0x26')](removeEntity(_0x36f555,null))['catch'](handleError(_0x36f555,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 8d72fff..4183304 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 _0x1cd8=['Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x32f4df,_0x22d11a){var _0x5762fe=function(_0x58314a){while(--_0x58314a){_0x32f4df['push'](_0x32f4df['shift']());}};_0x5762fe(++_0x22d11a);}(_0x1cd8,0x198));var _0x81cd=function(_0x54bb83,_0x48f73f){_0x54bb83=_0x54bb83-0x0;var _0x33abd6=_0x1cd8[_0x54bb83];return _0x33abd6;};'use strict';var _=require(_0x81cd('0x0'));var util=require(_0x81cd('0x1'));var logger=require(_0x81cd('0x2'))(_0x81cd('0x3'));var moment=require(_0x81cd('0x4'));var BPromise=require(_0x81cd('0x5'));var rp=require(_0x81cd('0x6'));var fs=require('fs');var path=require(_0x81cd('0x7'));var rimraf=require(_0x81cd('0x8'));var config=require(_0x81cd('0x9'));var attributes=require('./action.attributes');module[_0x81cd('0xa')]=function(_0x410147,_0x4f1ddc){return _0x410147[_0x81cd('0xb')](_0x81cd('0xc'),attributes,{'tableName':_0x81cd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76da=['lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./action.attributes'];(function(_0x12a390,_0x3af63a){var _0x1f66cd=function(_0x359905){while(--_0x359905){_0x12a390['push'](_0x12a390['shift']());}};_0x1f66cd(++_0x3af63a);}(_0x76da,0x111));var _0xa76d=function(_0x42b6e8,_0x11872){_0x42b6e8=_0x42b6e8-0x0;var _0x2eb988=_0x76da[_0x42b6e8];return _0x2eb988;};'use strict';var _=require(_0xa76d('0x0'));var util=require('util');var logger=require(_0xa76d('0x1'))(_0xa76d('0x2'));var moment=require('moment');var BPromise=require(_0xa76d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa76d('0x4'));var config=require(_0xa76d('0x5'));var attributes=require(_0xa76d('0x6'));module['exports']=function(_0x45fe23,_0x5b0733){return _0x45fe23['define']('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index f33538a..9aa65d8 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xe74fe4,_0x413858){var _0x2bbbb0=function(_0xeab6f5){while(--_0xeab6f5){_0xe74fe4['push'](_0xe74fe4['shift']());}};_0x2bbbb0(++_0x413858);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0x5fc3[_0x5e8c32];return _0x595f7b;};'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')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\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']('Action,\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 +var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x43158c,_0x1bdae4){var _0x43f861=function(_0x28726d){while(--_0x28726d){_0x43158c['push'](_0x43158c['shift']());}};_0x43f861(++_0x1bdae4);}(_0xabce,0x103));var _0xeabc=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xabce[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 94fad69..29788ce 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 _0x25f5=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./action.controller','put','isAuthenticated'];(function(_0x1ce9ea,_0x32e6f4){var _0x2a95b9=function(_0x1a0496){while(--_0x1a0496){_0x1ce9ea['push'](_0x1ce9ea['shift']());}};_0x2a95b9(++_0x32e6f4);}(_0x25f5,0x9f));var _0x525f=function(_0x12742e,_0x43f6fa){_0x12742e=_0x12742e-0x0;var _0x173452=_0x25f5[_0x12742e];return _0x173452;};'use strict';var multer=require(_0x525f('0x0'));var util=require(_0x525f('0x1'));var path=require(_0x525f('0x2'));var timeout=require(_0x525f('0x3'));var express=require(_0x525f('0x4'));var router=express[_0x525f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x525f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x525f('0x7'));router[_0x525f('0x8')]('/:id',auth[_0x525f('0x9')](),controller['update']);router['delete'](_0x525f('0xa'),auth[_0x525f('0x9')](),controller[_0x525f('0xb')]);module[_0x525f('0xc')]=router; \ No newline at end of file +var _0x6ea5=['isAuthenticated','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','delete'];(function(_0x4230aa,_0x4dbfe7){var _0x120199=function(_0x189cb2){while(--_0x189cb2){_0x4230aa['push'](_0x4230aa['shift']());}};_0x120199(++_0x4dbfe7);}(_0x6ea5,0x1b5));var _0x56ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ea5[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x56ea('0x0'));var util=require('util');var path=require(_0x56ea('0x1'));var timeout=require(_0x56ea('0x2'));var express=require(_0x56ea('0x3'));var router=express[_0x56ea('0x4')]();var fs_extra=require(_0x56ea('0x5'));var auth=require(_0x56ea('0x6'));var interaction=require(_0x56ea('0x7'));var config=require(_0x56ea('0x8'));var controller=require(_0x56ea('0x9'));router[_0x56ea('0xa')](_0x56ea('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x56ea('0xc')](_0x56ea('0xb'),auth[_0x56ea('0xd')](),controller[_0x56ea('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 8e63fc4..346a12c 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 _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x3ea5d1,_0x5389a0){var _0x11d23b=function(_0x475b43){while(--_0x475b43){_0x3ea5d1['push'](_0x3ea5d1['shift']());}};_0x11d23b(++_0x5389a0);}(_0x98a8,0x12c));var _0x898a=function(_0x2cc5e8,_0x348744){_0x2cc5e8=_0x2cc5e8-0x0;var _0xd45523=_0x98a8[_0x2cc5e8];return _0xd45523;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x89100d,_0x59c43d){var _0x15974a=function(_0x2fb1ac){while(--_0x2fb1ac){_0x89100d['push'](_0x89100d['shift']());}};_0x15974a(++_0x59c43d);}(_0xf494,0x1c6));var _0x4f49=function(_0xaa0e2,_0x3aa20f){_0xaa0e2=_0xaa0e2-0x0;var _0x19a563=_0xf494[_0xaa0e2];return _0x19a563;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 161e45b..b3d8a4e 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 _0xb0cc=['HOUR(%s)','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','key','model','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','query','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','group','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','MIN(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','getFields','Please\x20insert\x20at\x20least\x20one\x20field','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','../../files/reports','savename','countTable','COUNT(*)','runReport'];(function(_0x1a156e,_0x4e3646){var _0x2a7230=function(_0x7a72a8){while(--_0x7a72a8){_0x1a156e['push'](_0x1a156e['shift']());}};_0x2a7230(++_0x4e3646);}(_0xb0cc,0xab));var _0xcb0c=function(_0x474314,_0x439f08){_0x474314=_0x474314-0x0;var _0x2c414f=_0xb0cc[_0x474314];return _0x2c414f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb0c('0x0'));var zipdir=require(_0xcb0c('0x1'));var jsonpatch=require(_0xcb0c('0x2'));var rp=require(_0xcb0c('0x3'));var moment=require(_0xcb0c('0x4'));var BPromise=require(_0xcb0c('0x5'));var Mustache=require(_0xcb0c('0x6'));var util=require(_0xcb0c('0x7'));var path=require('path');var sox=require(_0xcb0c('0x8'));var csv=require('to-csv');var ejs=require(_0xcb0c('0x9'));var fs=require('fs');var fs_extra=require(_0xcb0c('0xa'));var _=require(_0xcb0c('0xb'));var squel=require('squel');var crypto=require(_0xcb0c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcb0c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcb0c('0xe'));var Papa=require(_0xcb0c('0xf'));var Redis=require(_0xcb0c('0x10'));var authService=require(_0xcb0c('0x11'));var qs=require(_0xcb0c('0x12'));var as=require(_0xcb0c('0x13'));var hardwareService=require(_0xcb0c('0x14'));var logger=require('../../config/logger')(_0xcb0c('0x15'));var utils=require(_0xcb0c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0xcb0c('0x17'))[_0xcb0c('0x18')];function respondWithStatusCode(_0x230071,_0x5d3598){_0x5d3598=_0x5d3598||0xcc;return function(_0x2144da){if(_0x2144da){return _0x230071[_0xcb0c('0x19')](_0x5d3598);}return _0x230071[_0xcb0c('0x1a')](_0x5d3598)[_0xcb0c('0x1b')]();};}function respondWithResult(_0x557787,_0x3a6374){_0x3a6374=_0x3a6374||0xc8;return function(_0x58d85f){if(_0x58d85f){return _0x557787[_0xcb0c('0x1a')](_0x3a6374)['json'](_0x58d85f);}};}function respondWithFilteredResult(_0x121d93,_0xff1739){return function(_0x59c3b1){if(_0x59c3b1){var _0x1ed553=typeof _0xff1739[_0xcb0c('0x1c')]===_0xcb0c('0x1d')&&typeof _0xff1739[_0xcb0c('0x1e')]===_0xcb0c('0x1d');var _0x2770da=_0x59c3b1[_0xcb0c('0x1f')];var _0x5adc6d=_0x1ed553?0x0:_0xff1739[_0xcb0c('0x1c')];var _0x47d278=_0x1ed553?_0x59c3b1[_0xcb0c('0x1f')]:_0xff1739[_0xcb0c('0x1c')]+_0xff1739[_0xcb0c('0x1e')];var _0x53d3b7;if(_0x47d278>=_0x2770da){_0x47d278=_0x2770da;_0x53d3b7=0xc8;}else{_0x53d3b7=0xce;}_0x121d93[_0xcb0c('0x1a')](_0x53d3b7);return _0x121d93['set'](_0xcb0c('0x20'),_0x5adc6d+'-'+_0x47d278+'/'+_0x2770da)[_0xcb0c('0x21')](_0x59c3b1);}return null;};}function patchUpdates(_0x8c8029){return function(_0x37c8e9){try{jsonpatch['apply'](_0x37c8e9,_0x8c8029,!![]);}catch(_0x3c02a9){return BPromise[_0xcb0c('0x22')](_0x3c02a9);}return _0x37c8e9[_0xcb0c('0x23')]();};}function saveUpdates(_0x2b6afe,_0x233a93){return function(_0x3e1c1d){if(_0x3e1c1d){return _0x3e1c1d[_0xcb0c('0x24')](_0x2b6afe)[_0xcb0c('0x25')](function(_0x4b2c2a){return _0x4b2c2a;});}return null;};}function removeEntity(_0x761d58,_0x5e8034){return function(_0x534009){if(_0x534009){return _0x534009[_0xcb0c('0x26')]()[_0xcb0c('0x25')](function(){var _0x2ba0bc=_0x534009[_0xcb0c('0x27')]({'plain':!![]});var _0x4f89b9=_0xcb0c('0x28');return db[_0xcb0c('0x29')]['destroy']({'where':{'type':_0x4f89b9,'resourceId':_0x2ba0bc['id']}})[_0xcb0c('0x25')](function(){return _0x534009;});})[_0xcb0c('0x25')](function(){_0x761d58[_0xcb0c('0x1a')](0xcc)[_0xcb0c('0x1b')]();});}};}function handleEntityNotFound(_0x961f2b,_0x38cf81){return function(_0x59c60c){if(!_0x59c60c){_0x961f2b[_0xcb0c('0x19')](0x194);}return _0x59c60c;};}function handleError(_0x4d721f,_0x3586e8){_0x3586e8=_0x3586e8||0x1f4;return function(_0x247411){logger[_0xcb0c('0x2a')](_0x247411[_0xcb0c('0x2b')]);if(_0x247411[_0xcb0c('0x2c')]){delete _0x247411['name'];}_0x4d721f[_0xcb0c('0x1a')](_0x3586e8)[_0xcb0c('0x2d')](_0x247411);};}exports[_0xcb0c('0x2e')]=function(_0x55db6e,_0x190f2f){var _0x31fd86={},_0x37e26a={},_0x31c728={'count':0x0,'rows':[]};var _0x1023d9=_[_0xcb0c('0x2f')](db[_0xcb0c('0x30')]['rawAttributes'],function(_0x58af46){return{'name':_0x58af46[_0xcb0c('0x31')],'type':_0x58af46[_0xcb0c('0x32')][_0xcb0c('0x33')]};});_0x37e26a[_0xcb0c('0x34')]=_['map'](_0x1023d9,_0xcb0c('0x2c'));_0x37e26a['query']=_['keys'](_0x55db6e['query']);_0x37e26a[_0xcb0c('0x35')]=_[_0xcb0c('0x36')](_0x37e26a[_0xcb0c('0x34')],_0x37e26a['query']);_0x31fd86[_0xcb0c('0x37')]=_['intersection'](_0x37e26a[_0xcb0c('0x34')],qs[_0xcb0c('0x38')](_0x55db6e['query'][_0xcb0c('0x38')]));_0x31fd86[_0xcb0c('0x37')]=_0x31fd86[_0xcb0c('0x37')][_0xcb0c('0x39')]?_0x31fd86['attributes']:_0x37e26a[_0xcb0c('0x34')];if(!_0x55db6e['query'][_0xcb0c('0x3a')](_0xcb0c('0x3b'))){_0x31fd86[_0xcb0c('0x1e')]=qs[_0xcb0c('0x1e')](_0x55db6e[_0xcb0c('0x3c')][_0xcb0c('0x1e')]);_0x31fd86[_0xcb0c('0x1c')]=qs[_0xcb0c('0x1c')](_0x55db6e['query'][_0xcb0c('0x1c')]);}_0x31fd86[_0xcb0c('0x3d')]=qs[_0xcb0c('0x3e')](_0x55db6e[_0xcb0c('0x3c')][_0xcb0c('0x3e')]);_0x31fd86['where']=qs[_0xcb0c('0x35')](_[_0xcb0c('0x3f')](_0x55db6e[_0xcb0c('0x3c')],_0x37e26a[_0xcb0c('0x35')]),_0x1023d9);if(_0x55db6e[_0xcb0c('0x3c')][_0xcb0c('0x40')]){_0x31fd86[_0xcb0c('0x41')]=_[_0xcb0c('0x42')](_0x31fd86[_0xcb0c('0x41')],{'$or':_[_0xcb0c('0x2f')](_0x1023d9,function(_0x95543f){if(_0x95543f[_0xcb0c('0x32')]!==_0xcb0c('0x43')){var _0xf08b={};_0xf08b[_0x95543f['name']]={'$like':'%'+_0x55db6e['query'][_0xcb0c('0x40')]+'%'};return _0xf08b;}})});}_0x31fd86=_['merge']({},_0x31fd86,_0x55db6e[_0xcb0c('0x44')]);var _0xe44623={'where':_0x31fd86['where']};return db[_0xcb0c('0x30')]['count'](_0xe44623)[_0xcb0c('0x25')](function(_0x35a748){_0x31c728[_0xcb0c('0x1f')]=_0x35a748;if(_0x55db6e[_0xcb0c('0x3c')]['includeAll']){_0x31fd86[_0xcb0c('0x45')]=[{'all':!![]}];}return db[_0xcb0c('0x30')][_0xcb0c('0x46')](_0x31fd86);})[_0xcb0c('0x25')](function(_0x406e2c){_0x31c728[_0xcb0c('0x47')]=_0x406e2c;return _0x31c728;})[_0xcb0c('0x25')](respondWithFilteredResult(_0x190f2f,_0x31fd86))[_0xcb0c('0x48')](handleError(_0x190f2f,null));};exports[_0xcb0c('0x49')]=function(_0x126dd0,_0xc8abcd){var _0x1f4948={'raw':![],'where':{'id':_0x126dd0[_0xcb0c('0x4a')]['id']}},_0x4191d7={};_0x4191d7['model']=_[_0xcb0c('0x4b')](db[_0xcb0c('0x30')][_0xcb0c('0x4c')]);_0x4191d7[_0xcb0c('0x3c')]=_[_0xcb0c('0x4b')](_0x126dd0[_0xcb0c('0x3c')]);_0x4191d7[_0xcb0c('0x35')]=_['intersection'](_0x4191d7[_0xcb0c('0x34')],_0x4191d7[_0xcb0c('0x3c')]);_0x1f4948[_0xcb0c('0x37')]=_['intersection'](_0x4191d7[_0xcb0c('0x34')],qs[_0xcb0c('0x38')](_0x126dd0[_0xcb0c('0x3c')]['fields']));_0x1f4948['attributes']=_0x1f4948[_0xcb0c('0x37')][_0xcb0c('0x39')]?_0x1f4948[_0xcb0c('0x37')]:_0x4191d7['model'];if(_0x126dd0['query'][_0xcb0c('0x4d')]){_0x1f4948[_0xcb0c('0x45')]=[{'all':!![]}];}_0x1f4948=_[_0xcb0c('0x42')]({},_0x1f4948,_0x126dd0['options']);return db['AnalyticCustomReport'][_0xcb0c('0x4e')](_0x1f4948)[_0xcb0c('0x25')](handleEntityNotFound(_0xc8abcd,null))['then'](respondWithResult(_0xc8abcd,null))[_0xcb0c('0x48')](handleError(_0xc8abcd,null));};exports[_0xcb0c('0x4f')]=function(_0x2db9ce,_0x1ca086){return db['AnalyticCustomReport']['create'](_0x2db9ce[_0xcb0c('0x50')],{})[_0xcb0c('0x25')](function(_0x2b7f52){var _0x71e3b0=_0x2db9ce['user']['get']({'plain':!![]});if(!_0x71e3b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x71e3b0[_0xcb0c('0x51')]===_0xcb0c('0x52')){var _0x2f4cfb=_0x2b7f52['get']({'plain':!![]});var _0x6f7b12=_0xcb0c('0x53');return db[_0xcb0c('0x54')][_0xcb0c('0x4e')]({'where':{'name':_0x6f7b12,'userProfileId':_0x71e3b0[_0xcb0c('0x55')]},'raw':!![]})[_0xcb0c('0x25')](function(_0x435faf){if(_0x435faf&&_0x435faf[_0xcb0c('0x56')]===0x0){return db[_0xcb0c('0x29')][_0xcb0c('0x4f')]({'name':_0x2f4cfb[_0xcb0c('0x2c')],'resourceId':_0x2f4cfb['id'],'type':_0xcb0c('0x28'),'sectionId':_0x435faf['id']},{})[_0xcb0c('0x25')](function(){return _0x2b7f52;});}else{return _0x2b7f52;}})[_0xcb0c('0x48')](function(_0x309a2f){logger[_0xcb0c('0x2a')](_0xcb0c('0x57'),_0x309a2f);throw _0x309a2f;});}return _0x2b7f52;})['then'](respondWithResult(_0x1ca086,0xc9))[_0xcb0c('0x48')](handleError(_0x1ca086,null));};exports['update']=function(_0x9339de,_0x4ca6ea){if(_0x9339de[_0xcb0c('0x50')]['id']){delete _0x9339de[_0xcb0c('0x50')]['id'];}return db[_0xcb0c('0x30')][_0xcb0c('0x4e')]({'where':{'id':_0x9339de[_0xcb0c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ca6ea,null))[_0xcb0c('0x25')](saveUpdates(_0x9339de[_0xcb0c('0x50')],null))['then'](respondWithResult(_0x4ca6ea,null))[_0xcb0c('0x48')](handleError(_0x4ca6ea,null));};exports[_0xcb0c('0x26')]=function(_0x1b4a3e,_0x15e20c){return db[_0xcb0c('0x30')][_0xcb0c('0x4e')]({'where':{'id':_0x1b4a3e[_0xcb0c('0x4a')]['id']}})[_0xcb0c('0x25')](handleEntityNotFound(_0x15e20c,null))[_0xcb0c('0x25')](removeEntity(_0x15e20c,null))[_0xcb0c('0x48')](handleError(_0x15e20c,null));};exports[_0xcb0c('0x58')]=function(_0x408e9f,_0xa1acc){var _0x9aaa70=0xa;var _0x4f3ddb=[_0xcb0c('0x59'),_0xcb0c('0x5a'),_0xcb0c('0x5b'),_0xcb0c('0x5c')];var _0x564c20={'SUM':_0xcb0c('0x5d'),'COUNT':_0xcb0c('0x5e'),'COUNT DISTINCT':_0xcb0c('0x5f'),'MAX':_0xcb0c('0x60'),'MIN':'MIN(%s)','AVG':_0xcb0c('0x61'),'GROUP_CONCAT':_0xcb0c('0x62'),'GROUP_CONCAT ASC':_0xcb0c('0x63'),'GROUP_CONCAT DESC':_0xcb0c('0x64')};var _0x47423a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcb0c('0x65'),'HOUR':'HOUR(%s)','ROUND':_0xcb0c('0x66'),'UNIX_TIMESTAMP':_0xcb0c('0x67')};var _0x1d6f05=function(_0x2d1501){return!_[_0xcb0c('0x68')]([_0xcb0c('0x69'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xcb0c('0x6a')],_0x2d1501);};var _0x5e6038=function(_0x472e0d){if(!_0x472e0d||!_0x472e0d[_0xcb0c('0x6b')][_0xcb0c('0x39')]){return'';}for(var _0xad99b='(',_0x1c50f8=0x0;_0x1c50f8<_0x472e0d['rules'][_0xcb0c('0x39')];_0x1c50f8+=0x1){_0x1c50f8>0x0&&(_0xad99b+='\x20'+_0x472e0d[_0xcb0c('0x6c')]+'\x20');_0xad99b+=_0x472e0d['rules'][_0x1c50f8]['group']?_0x5e6038(_0x472e0d[_0xcb0c('0x6b')][_0x1c50f8]['group']):_0x472e0d[_0xcb0c('0x6b')][_0x1c50f8][_0xcb0c('0x6d')]+'\x20'+_0x472e0d[_0xcb0c('0x6b')][_0x1c50f8][_0xcb0c('0x6e')]+(_0x1d6f05(_0x472e0d[_0xcb0c('0x6b')][_0x1c50f8][_0xcb0c('0x6e')])?'\x20'+_0x472e0d['rules'][_0x1c50f8][_0xcb0c('0x6f')]:'');}return _0xad99b+')';};var _0x7c9254={'where':{'id':_0x408e9f[_0xcb0c('0x4a')]['id']}},_0x12251b,_0x1001af,_0x357735,_0x1df9b9,_0x2ae087;_0x7c9254=_[_0xcb0c('0x42')]({},_0x7c9254,_0x408e9f[_0xcb0c('0x44')]);return db[_0xcb0c('0x30')][_0xcb0c('0x4e')](_0x7c9254)[_0xcb0c('0x25')](function(_0x4ab191){if(_0x4ab191){_0x12251b=_0x4ab191;return _0x4ab191['getFields']();}return null;})[_0xcb0c('0x25')](function(_0x395832){if(_0x395832){if(!_0x395832[_0xcb0c('0x39')]){throw new db[(_0xcb0c('0x70'))][(_0xcb0c('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1001af=_0x395832;return db[_0xcb0c('0x72')]['findAll']({'raw':!![]});}return null;})[_0xcb0c('0x25')](function(_0x175923){if(_0x175923){_0x357735=_[_0xcb0c('0x73')](_0x175923,'id');var _0x50087b;var _0x48beda=squel[_0xcb0c('0x74')]();_0x48beda[_0xcb0c('0x75')](_0x12251b[_0xcb0c('0x76')]);for(var _0x1193f6=0x0;_0x1193f6<_0x1001af[_0xcb0c('0x39')];_0x1193f6+=0x1){_0x50087b=_0x1001af[_0x1193f6][_0xcb0c('0x77')]?_0x357735[_0x1001af[_0x1193f6][_0xcb0c('0x77')]][_0xcb0c('0x78')]:_0x1001af[_0x1193f6][_0xcb0c('0x6d')];_0x50087b=_0x1001af[_0x1193f6]['function']?_[_0xcb0c('0x79')](_0x564c20[_0x1001af[_0x1193f6][_0xcb0c('0x7a')]],'%s',_0x50087b):_0x50087b;_0x50087b=_0x1001af[_0x1193f6][_0xcb0c('0x7b')]?_[_0xcb0c('0x79')](_0x47423a[_0x1001af[_0x1193f6][_0xcb0c('0x7b')]],'%s',_0x50087b):_0x50087b;if(_0x1001af[_0x1193f6][_0xcb0c('0x7c')]){_0x48beda[_0xcb0c('0x7d')](_0x50087b);}_0x1001af[_0x1193f6][_0xcb0c('0x7e')]&&_0x48beda[_0xcb0c('0x3d')](_0x50087b,_0x1001af[_0x1193f6][_0xcb0c('0x7e')]===_0xcb0c('0x7f')?![]:!![]);_0x48beda[_0xcb0c('0x6d')](_0x50087b,_0x1001af[_0x1193f6][_0xcb0c('0x80')]||_0x50087b);}if(_0x12251b[_0xcb0c('0x81')]){_0x12251b[_0xcb0c('0x81')]=JSON[_0xcb0c('0x82')](_0x12251b['joins']);for(var _0x1a2974=0x0;_0x1a2974<_0x12251b['joins'][_0xcb0c('0x39')];_0x1a2974+=0x1){if(_0x12251b[_0xcb0c('0x81')][_0x1a2974]['type']&&_[_0xcb0c('0x68')](_0x4f3ddb,_0x12251b['joins'][_0x1a2974]['type'])&&_0x12251b[_0xcb0c('0x81')][_0x1a2974][_0xcb0c('0x83')]&&_0x12251b[_0xcb0c('0x81')][_0x1a2974][_0xcb0c('0x84')]&&_0x12251b['joins'][_0x1a2974]['foreignKey']){_0x48beda[_0x12251b[_0xcb0c('0x81')][_0x1a2974][_0xcb0c('0x32')]](_0x12251b[_0xcb0c('0x81')][_0x1a2974]['foreignTable'],null,util['format'](_0xcb0c('0x85'),_0x12251b[_0xcb0c('0x76')],_0x12251b['joins'][_0x1a2974][_0xcb0c('0x83')],_0x12251b['joins'][_0x1a2974]['foreignTable'],_0x12251b[_0xcb0c('0x81')][_0x1a2974][_0xcb0c('0x86')]));}}}if(_0x12251b['conditions']){_0x12251b[_0xcb0c('0x87')]=JSON[_0xcb0c('0x82')](_0x12251b['conditions']);_0x48beda[_0xcb0c('0x41')](_0x5e6038(_0x12251b[_0xcb0c('0x87')][_0xcb0c('0x7d')]));}_0x2ae087=_0x48beda[_0xcb0c('0x88')]();_0x48beda[_0xcb0c('0x1e')](_0x9aaa70);_0x48beda[_0xcb0c('0x1c')](0x0);logger[_0xcb0c('0x89')]('Limited\x20Query:',_0x48beda[_0xcb0c('0x8a')]());return dbH[_0xcb0c('0x8b')]['query'](_0x48beda[_0xcb0c('0x8a')](),{'type':dbH['sequelize'][_0xcb0c('0x8c')][_0xcb0c('0x8d')]});}})['then'](respondWithResult(_0xa1acc,null))[_0xcb0c('0x48')](handleError(_0xa1acc,null));};function runReport(_0x30ebc6,_0x1150d2,_0x256111){var _0x242fd2=_0x1150d2[_0xcb0c('0x2c')];var _0x2e062d=0xa;var _0x28a71e=[_0xcb0c('0x59'),'left_join',_0xcb0c('0x5b'),_0xcb0c('0x5c')];var _0x96cd99={'SUM':_0xcb0c('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcb0c('0x5f'),'MAX':_0xcb0c('0x60'),'MIN':_0xcb0c('0x8e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xcb0c('0x62'),'GROUP_CONCAT ASC':_0xcb0c('0x63'),'GROUP_CONCAT DESC':_0xcb0c('0x64')};var _0x5002e5={'SEC_TO_TIME':_0xcb0c('0x8f'),'DATE':_0xcb0c('0x65'),'HOUR':'HOUR(%s)','ROUND':_0xcb0c('0x66'),'UNIX_TIMESTAMP':_0xcb0c('0x67')};var _0x432605=function(_0x4cc44c){return!_[_0xcb0c('0x68')](['IS\x20NULL',_0xcb0c('0x90'),_0xcb0c('0x91'),'IS\x20NOT\x20EMPTY'],_0x4cc44c);};var _0x3dae1a=function(_0x383f3f){if(!_0x383f3f||!_0x383f3f[_0xcb0c('0x6b')][_0xcb0c('0x39')]){return'';}for(var _0x3bb46e='(',_0x2af40c=0x0;_0x2af40c<_0x383f3f['rules']['length'];_0x2af40c+=0x1){_0x2af40c>0x0&&(_0x3bb46e+='\x20'+_0x383f3f[_0xcb0c('0x6c')]+'\x20');_0x3bb46e+=_0x383f3f['rules'][_0x2af40c][_0xcb0c('0x7d')]?_0x3dae1a(_0x383f3f[_0xcb0c('0x6b')][_0x2af40c][_0xcb0c('0x7d')]):_0x383f3f['rules'][_0x2af40c][_0xcb0c('0x6d')]+'\x20'+_0x383f3f['rules'][_0x2af40c][_0xcb0c('0x6e')]+(_0x432605(_0x383f3f[_0xcb0c('0x6b')][_0x2af40c]['condition'])?'\x20'+_0x383f3f[_0xcb0c('0x6b')][_0x2af40c][_0xcb0c('0x6f')]:'');}return _0x3bb46e+')';};var _0x553859={'where':{'id':_0x30ebc6['id']}},_0x5a65f6,_0x3cd1a4,_0x5c3aeb,_0x1748d7,_0x219053;_0x553859=_['merge']({},_0x553859,_0x256111);return db[_0xcb0c('0x30')]['find'](_0x553859)[_0xcb0c('0x25')](function(_0x43a0f8){if(_0x43a0f8){_0x5a65f6=_0x43a0f8;return _0x43a0f8[_0xcb0c('0x92')]();}return null;})[_0xcb0c('0x25')](function(_0x291f79){if(_0x291f79){if(!_0x291f79['length']){throw new db['Sequelize'][(_0xcb0c('0x71'))](_0xcb0c('0x93'),0x193);}_0x3cd1a4=_0x291f79;return db['AnalyticMetric'][_0xcb0c('0x46')]({'raw':!![]});}return null;})[_0xcb0c('0x25')](function(_0x5eecb5){if(_0x5eecb5){_0x5c3aeb=_['keyBy'](_0x5eecb5,'id');var _0x207699;var _0x50c00c=squel[_0xcb0c('0x74')]();_0x50c00c[_0xcb0c('0x75')](_0x5a65f6[_0xcb0c('0x76')]);for(var _0x202bb1=0x0;_0x202bb1<_0x3cd1a4[_0xcb0c('0x39')];_0x202bb1+=0x1){_0x207699=_0x3cd1a4[_0x202bb1][_0xcb0c('0x77')]?_0x5c3aeb[_0x3cd1a4[_0x202bb1][_0xcb0c('0x77')]][_0xcb0c('0x78')]:_0x3cd1a4[_0x202bb1][_0xcb0c('0x6d')];_0x207699=_0x3cd1a4[_0x202bb1][_0xcb0c('0x7a')]?_['replace'](_0x96cd99[_0x3cd1a4[_0x202bb1]['function']],'%s',_0x207699):_0x207699;_0x207699=_0x3cd1a4[_0x202bb1]['format']?_['replace'](_0x5002e5[_0x3cd1a4[_0x202bb1][_0xcb0c('0x7b')]],'%s',_0x207699):_0x207699;if(_0x3cd1a4[_0x202bb1][_0xcb0c('0x7c')]){_0x50c00c[_0xcb0c('0x7d')](_0x207699);}_0x3cd1a4[_0x202bb1][_0xcb0c('0x7e')]&&_0x50c00c[_0xcb0c('0x3d')](_0x207699,_0x3cd1a4[_0x202bb1][_0xcb0c('0x7e')]===_0xcb0c('0x7f')?![]:!![]);_0x50c00c[_0xcb0c('0x6d')](_0x207699,_0x3cd1a4[_0x202bb1][_0xcb0c('0x80')]||_0x207699);}if(_0x5a65f6[_0xcb0c('0x81')]){_0x5a65f6['joins']=JSON[_0xcb0c('0x82')](_0x5a65f6['joins']);for(var _0x4426ed=0x0;_0x4426ed<_0x5a65f6[_0xcb0c('0x81')]['length'];_0x4426ed+=0x1){if(_0x5a65f6[_0xcb0c('0x81')][_0x4426ed][_0xcb0c('0x32')]&&_[_0xcb0c('0x68')](_0x28a71e,_0x5a65f6[_0xcb0c('0x81')][_0x4426ed][_0xcb0c('0x32')])&&_0x5a65f6[_0xcb0c('0x81')][_0x4426ed][_0xcb0c('0x83')]&&_0x5a65f6[_0xcb0c('0x81')][_0x4426ed]['foreignTable']&&_0x5a65f6[_0xcb0c('0x81')][_0x4426ed][_0xcb0c('0x86')]){_0x50c00c[_0x5a65f6[_0xcb0c('0x81')][_0x4426ed][_0xcb0c('0x32')]](_0x5a65f6[_0xcb0c('0x81')][_0x4426ed][_0xcb0c('0x84')],null,util[_0xcb0c('0x7b')]('%s.%s\x20=\x20%s.%s',_0x5a65f6[_0xcb0c('0x76')],_0x5a65f6[_0xcb0c('0x81')][_0x4426ed][_0xcb0c('0x83')],_0x5a65f6[_0xcb0c('0x81')][_0x4426ed][_0xcb0c('0x84')],_0x5a65f6[_0xcb0c('0x81')][_0x4426ed]['foreignKey']));}}}if(_0x5a65f6[_0xcb0c('0x87')]){_0x5a65f6[_0xcb0c('0x87')]=JSON[_0xcb0c('0x82')](_0x5a65f6[_0xcb0c('0x87')]);_0x50c00c[_0xcb0c('0x41')](_0x3dae1a(_0x5a65f6[_0xcb0c('0x87')]['group']));}_0x219053=_0x50c00c[_0xcb0c('0x88')]();_0x50c00c[_0xcb0c('0x1e')](_0x2e062d);_0x50c00c[_0xcb0c('0x1c')](0x0);return;}})[_0xcb0c('0x25')](function(){if(_0x1150d2[_0xcb0c('0x94')]===_0xcb0c('0x95')){return null;}var _0x347801=_[_0xcb0c('0x42')](_0x1150d2,{'name':_0x1150d2[_0xcb0c('0x96')]||_0x1150d2[_0xcb0c('0x2c')]||_0x5a65f6[_0xcb0c('0x2c')],'basename':_0x242fd2,'savename':util[_0xcb0c('0x7b')](_0xcb0c('0x97'),_0x1150d2[_0xcb0c('0x2c')]||_0x5a65f6[_0xcb0c('0x2c')],require(_0xcb0c('0x98'))[_0xcb0c('0x99')](0x4),_0x1150d2[_0xcb0c('0x94')]||_0xcb0c('0x9a')),'reportId':_0x5a65f6['id'],'reportType':_0xcb0c('0x9b')});return db[_0xcb0c('0x9c')][_0xcb0c('0x4f')](_0x347801,{'raw':!![]});})[_0xcb0c('0x25')](function(_0x5561d){if(_0x5a65f6['table']===_0xcb0c('0x9d')){_0x219053[_0xcb0c('0x41')](_0x5a65f6['table']+_0xcb0c('0x9e'),_0x1150d2['startDate'],_0x1150d2[_0xcb0c('0x9f')]);}else{_0x219053[_0xcb0c('0x41')](_0x5a65f6[_0xcb0c('0x76')]+_0xcb0c('0xa0'),_0x1150d2['startDate'],_0x1150d2[_0xcb0c('0x9f')]);}if(_0x5561d){logger[_0xcb0c('0xa1')]('Run\x20Query:',_0x219053[_0xcb0c('0x8a')]());require('child_process')['fork'](path[_0xcb0c('0x59')](__dirname,'../../components/export/',_0x5561d['output']),[_0x5561d['id'],_0x219053[_0xcb0c('0x8a')](),path[_0xcb0c('0x59')](__dirname,_0xcb0c('0xa2'),_0x5561d[_0xcb0c('0xa3')]),_0x242fd2]);return _0x5561d;}else{var _0x5d13de=squel['select']();_0x5d13de[_0xcb0c('0x75')]('('+_0x219053[_0xcb0c('0x8a')]()+')',_0xcb0c('0xa4'));_0x5d13de['field'](_0xcb0c('0xa5'),_0xcb0c('0x1f'));_0x219053[_0xcb0c('0x1e')](_0x1150d2[_0xcb0c('0x1e')]||_0x2e062d);_0x219053[_0xcb0c('0x1c')](_0x1150d2[_0xcb0c('0x1c')]||0x0);return dbH['sequelize'][_0xcb0c('0x3c')](_0x5d13de[_0xcb0c('0x8a')](),{'type':dbH[_0xcb0c('0x8b')][_0xcb0c('0x8c')]['SELECT']})[_0xcb0c('0x25')](function(_0x2b0e19){if(!_0x2b0e19[_0xcb0c('0x39')]){_0x1748d7=0x0;}else{_0x1748d7=_0x2b0e19[0x0][_0xcb0c('0x1f')]||0x0;}return dbH[_0xcb0c('0x8b')][_0xcb0c('0x3c')](_0x219053['toString'](),{'type':dbH['sequelize'][_0xcb0c('0x8c')][_0xcb0c('0x8d')]});})[_0xcb0c('0x25')](function(_0x158123){return{'rows':_0x158123||[],'count':_0x1748d7};});}});}exports['run']=function(_0x5ab8b0,_0x384d50){return runReport(_0x5ab8b0[_0xcb0c('0x4a')],_0x5ab8b0[_0xcb0c('0x3c')],_0x5ab8b0[_0xcb0c('0x44')])['then'](respondWithResult(_0x384d50,null))[_0xcb0c('0x48')](handleError(_0x384d50,null));};exports[_0xcb0c('0xa6')]=runReport;exports[_0xcb0c('0x3c')]=function(_0x192dc2,_0xeafa3e){var _0xa6f17b=0xa;var _0x4c8f23=[_0xcb0c('0x59'),_0xcb0c('0x5a'),_0xcb0c('0x5b'),'cross_join'];var _0x257319={'SUM':_0xcb0c('0x5d'),'COUNT':_0xcb0c('0x5e'),'COUNT DISTINCT':_0xcb0c('0x5f'),'MAX':_0xcb0c('0x60'),'MIN':'MIN(%s)','AVG':_0xcb0c('0x61'),'GROUP_CONCAT':_0xcb0c('0x62'),'GROUP_CONCAT ASC':_0xcb0c('0x63'),'GROUP_CONCAT DESC':_0xcb0c('0x64')};var _0x3f945e={'SEC_TO_TIME':_0xcb0c('0x8f'),'DATE':'DATE(%s)','HOUR':_0xcb0c('0xa7'),'ROUND':_0xcb0c('0x66'),'UNIX_TIMESTAMP':_0xcb0c('0x67')};var _0x2f2fba=function(_0x5f020e){return!_[_0xcb0c('0x68')]([_0xcb0c('0x69'),_0xcb0c('0x90'),_0xcb0c('0x91'),'IS\x20NOT\x20EMPTY'],_0x5f020e);};var _0x506206=function(_0x19ce57){if(!_0x19ce57||!_0x19ce57['rules']['length']){return'';}for(var _0x420b1b='(',_0x249b05=0x0;_0x249b05<_0x19ce57[_0xcb0c('0x6b')][_0xcb0c('0x39')];_0x249b05+=0x1){_0x249b05>0x0&&(_0x420b1b+='\x20'+_0x19ce57[_0xcb0c('0x6c')]+'\x20');_0x420b1b+=_0x19ce57[_0xcb0c('0x6b')][_0x249b05][_0xcb0c('0x7d')]?_0x506206(_0x19ce57[_0xcb0c('0x6b')][_0x249b05]['group']):_0x19ce57[_0xcb0c('0x6b')][_0x249b05][_0xcb0c('0x6d')]+'\x20'+_0x19ce57[_0xcb0c('0x6b')][_0x249b05][_0xcb0c('0x6e')]+(_0x2f2fba(_0x19ce57['rules'][_0x249b05]['condition'])?'\x20'+_0x19ce57[_0xcb0c('0x6b')][_0x249b05]['value']:'');}return _0x420b1b+')';};var _0x28be92={'where':{'id':_0x192dc2[_0xcb0c('0x4a')]['id']}},_0x133613,_0x2e6a57,_0x4173b7,_0x58fa95,_0x1c1844;_0x28be92=_[_0xcb0c('0x42')]({},_0x28be92,_0x192dc2[_0xcb0c('0x44')]);return db[_0xcb0c('0x30')][_0xcb0c('0x4e')](_0x28be92)[_0xcb0c('0x25')](function(_0x4c2461){if(_0x4c2461){_0x133613=_0x4c2461;return _0x4c2461['getFields']();}return null;})[_0xcb0c('0x25')](function(_0x423f33){if(_0x423f33){if(!_0x423f33[_0xcb0c('0x39')]){throw new db[(_0xcb0c('0x70'))][(_0xcb0c('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2e6a57=_0x423f33;return db[_0xcb0c('0x72')][_0xcb0c('0x46')]({'raw':!![]});}return null;})[_0xcb0c('0x25')](function(_0x2a4851){if(_0x2a4851){_0x4173b7=_[_0xcb0c('0x73')](_0x2a4851,'id');var _0xf1ab64;var _0x208183=squel[_0xcb0c('0x74')]();_0x208183[_0xcb0c('0x75')](_0x133613['table']);for(var _0x877d98=0x0;_0x877d98<_0x2e6a57[_0xcb0c('0x39')];_0x877d98+=0x1){_0xf1ab64=_0x2e6a57[_0x877d98][_0xcb0c('0x77')]?_0x4173b7[_0x2e6a57[_0x877d98][_0xcb0c('0x77')]][_0xcb0c('0x78')]:_0x2e6a57[_0x877d98][_0xcb0c('0x6d')];_0xf1ab64=_0x2e6a57[_0x877d98][_0xcb0c('0x7a')]?_[_0xcb0c('0x79')](_0x257319[_0x2e6a57[_0x877d98][_0xcb0c('0x7a')]],'%s',_0xf1ab64):_0xf1ab64;_0xf1ab64=_0x2e6a57[_0x877d98]['format']?_[_0xcb0c('0x79')](_0x3f945e[_0x2e6a57[_0x877d98][_0xcb0c('0x7b')]],'%s',_0xf1ab64):_0xf1ab64;if(_0x2e6a57[_0x877d98][_0xcb0c('0x7c')]){_0x208183['group'](_0xf1ab64);}_0x2e6a57[_0x877d98]['orderBy']&&_0x208183['order'](_0xf1ab64,_0x2e6a57[_0x877d98][_0xcb0c('0x7e')]==='DESC'?![]:!![]);_0x208183[_0xcb0c('0x6d')](_0xf1ab64,_0x2e6a57[_0x877d98]['alias']||_0xf1ab64);}if(_0x133613[_0xcb0c('0x81')]){_0x133613[_0xcb0c('0x81')]=JSON[_0xcb0c('0x82')](_0x133613[_0xcb0c('0x81')]);for(var _0x82ee9c=0x0;_0x82ee9c<_0x133613[_0xcb0c('0x81')][_0xcb0c('0x39')];_0x82ee9c+=0x1){if(_0x133613['joins'][_0x82ee9c][_0xcb0c('0x32')]&&_[_0xcb0c('0x68')](_0x4c8f23,_0x133613[_0xcb0c('0x81')][_0x82ee9c][_0xcb0c('0x32')])&&_0x133613['joins'][_0x82ee9c]['parentKey']&&_0x133613[_0xcb0c('0x81')][_0x82ee9c]['foreignTable']&&_0x133613[_0xcb0c('0x81')][_0x82ee9c][_0xcb0c('0x86')]){_0x208183[_0x133613['joins'][_0x82ee9c][_0xcb0c('0x32')]](_0x133613['joins'][_0x82ee9c][_0xcb0c('0x84')],null,util[_0xcb0c('0x7b')](_0xcb0c('0x85'),_0x133613[_0xcb0c('0x76')],_0x133613['joins'][_0x82ee9c][_0xcb0c('0x83')],_0x133613['joins'][_0x82ee9c]['foreignTable'],_0x133613['joins'][_0x82ee9c][_0xcb0c('0x86')]));}}}if(_0x133613[_0xcb0c('0x87')]){_0x133613[_0xcb0c('0x87')]=JSON[_0xcb0c('0x82')](_0x133613['conditions']);_0x208183['where'](_0x506206(_0x133613[_0xcb0c('0x87')]['group']));}_0x1c1844=_0x208183['clone']();_0x208183[_0xcb0c('0x1e')](_0xa6f17b);_0x208183[_0xcb0c('0x1c')](0x0);logger[_0xcb0c('0x89')](_0xcb0c('0xa8'),_0x208183[_0xcb0c('0x8a')]());return dbH['sequelize'][_0xcb0c('0x3c')](_0x208183[_0xcb0c('0x8a')](),{'type':dbH[_0xcb0c('0x8b')][_0xcb0c('0x8c')][_0xcb0c('0x8d')]});}})[_0xcb0c('0x25')](function(){return{'sql':_0x1c1844['toString']()};})['then'](respondWithResult(_0xeafa3e,null))[_0xcb0c('0x48')](handleError(_0xeafa3e,null));}; \ No newline at end of file +var _0xae3f=['../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','index','AnalyticCustomReport','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','params','rawAttributes','includeAll','catch','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','create','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','field','function','format','replace','orderBy','DESC','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','IS\x20NOT\x20NULL','Sequelize','groupBy','alias','parentKey','web','fullPath','%s-%s.%s','generate','output','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','IS\x20NULL','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x13b593,_0x85a736){var _0x1d2958=function(_0x371387){while(--_0x371387){_0x13b593['push'](_0x13b593['shift']());}};_0x1d2958(++_0x85a736);}(_0xae3f,0x136));var _0xfae3=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xae3f[_0x307d86];return _0x361745;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfae3('0x0'));var zipdir=require(_0xfae3('0x1'));var jsonpatch=require(_0xfae3('0x2'));var rp=require(_0xfae3('0x3'));var moment=require(_0xfae3('0x4'));var BPromise=require(_0xfae3('0x5'));var Mustache=require(_0xfae3('0x6'));var util=require(_0xfae3('0x7'));var path=require(_0xfae3('0x8'));var sox=require(_0xfae3('0x9'));var csv=require(_0xfae3('0xa'));var ejs=require(_0xfae3('0xb'));var fs=require('fs');var fs_extra=require(_0xfae3('0xc'));var _=require(_0xfae3('0xd'));var squel=require('squel');var crypto=require(_0xfae3('0xe'));var jsforce=require(_0xfae3('0xf'));var deskjs=require(_0xfae3('0x10'));var toCsv=require(_0xfae3('0xa'));var querystring=require(_0xfae3('0x11'));var Papa=require(_0xfae3('0x12'));var Redis=require('ioredis');var authService=require(_0xfae3('0x13'));var qs=require(_0xfae3('0x14'));var as=require(_0xfae3('0x15'));var hardwareService=require(_0xfae3('0x16'));var logger=require(_0xfae3('0x17'))(_0xfae3('0x18'));var utils=require(_0xfae3('0x19'));var config=require(_0xfae3('0x1a'));var licenseUtil=require(_0xfae3('0x1b'));var db=require(_0xfae3('0x1c'))['db'];var dbH=require(_0xfae3('0x1c'))[_0xfae3('0x1d')];function respondWithStatusCode(_0x9ffdf,_0x5d9d21){_0x5d9d21=_0x5d9d21||0xcc;return function(_0x5059bf){if(_0x5059bf){return _0x9ffdf[_0xfae3('0x1e')](_0x5d9d21);}return _0x9ffdf[_0xfae3('0x1f')](_0x5d9d21)[_0xfae3('0x20')]();};}function respondWithResult(_0x394dbd,_0x232e83){_0x232e83=_0x232e83||0xc8;return function(_0x50dcfb){if(_0x50dcfb){return _0x394dbd['status'](_0x232e83)[_0xfae3('0x21')](_0x50dcfb);}};}function respondWithFilteredResult(_0x308fda,_0x285866){return function(_0x50dd0a){if(_0x50dd0a){var _0xaf7bf5=typeof _0x285866[_0xfae3('0x22')]==='undefined'&&typeof _0x285866[_0xfae3('0x23')]===_0xfae3('0x24');var _0x49e223=_0x50dd0a['count'];var _0x51e519=_0xaf7bf5?0x0:_0x285866[_0xfae3('0x22')];var _0x50d0ef=_0xaf7bf5?_0x50dd0a[_0xfae3('0x25')]:_0x285866[_0xfae3('0x22')]+_0x285866['limit'];var _0x2114ca;if(_0x50d0ef>=_0x49e223){_0x50d0ef=_0x49e223;_0x2114ca=0xc8;}else{_0x2114ca=0xce;}_0x308fda[_0xfae3('0x1f')](_0x2114ca);return _0x308fda['set'](_0xfae3('0x26'),_0x51e519+'-'+_0x50d0ef+'/'+_0x49e223)[_0xfae3('0x21')](_0x50dd0a);}return null;};}function patchUpdates(_0x47d937){return function(_0x4b568c){try{jsonpatch[_0xfae3('0x27')](_0x4b568c,_0x47d937,!![]);}catch(_0x53dc40){return BPromise[_0xfae3('0x28')](_0x53dc40);}return _0x4b568c['save']();};}function saveUpdates(_0x1bb0b6,_0x41fe40){return function(_0x196833){if(_0x196833){return _0x196833[_0xfae3('0x29')](_0x1bb0b6)[_0xfae3('0x2a')](function(_0x15419a){return _0x15419a;});}return null;};}function removeEntity(_0x2fa4b8,_0x1f22c4){return function(_0x3eef44){if(_0x3eef44){return _0x3eef44['destroy']()[_0xfae3('0x2a')](function(){var _0x4f0f55=_0x3eef44[_0xfae3('0x2b')]({'plain':!![]});var _0x492926='CustomReports';return db[_0xfae3('0x2c')][_0xfae3('0x2d')]({'where':{'type':_0x492926,'resourceId':_0x4f0f55['id']}})['then'](function(){return _0x3eef44;});})[_0xfae3('0x2a')](function(){_0x2fa4b8['status'](0xcc)[_0xfae3('0x20')]();});}};}function handleEntityNotFound(_0x4c6d78,_0x392930){return function(_0x54a5e2){if(!_0x54a5e2){_0x4c6d78[_0xfae3('0x1e')](0x194);}return _0x54a5e2;};}function handleError(_0x29467f,_0x1d394f){_0x1d394f=_0x1d394f||0x1f4;return function(_0x281250){logger[_0xfae3('0x2e')](_0x281250[_0xfae3('0x2f')]);if(_0x281250['name']){delete _0x281250['name'];}_0x29467f[_0xfae3('0x1f')](_0x1d394f)['send'](_0x281250);};}exports[_0xfae3('0x30')]=function(_0x2207b1,_0x3a051c){var _0x3e179c={},_0x28d1ef={},_0x4a5b1b={'count':0x0,'rows':[]};var _0x15854b=_['map'](db[_0xfae3('0x31')]['rawAttributes'],function(_0x224637){return{'name':_0x224637[_0xfae3('0x32')],'type':_0x224637[_0xfae3('0x33')]['key']};});_0x28d1ef[_0xfae3('0x34')]=_[_0xfae3('0x35')](_0x15854b,_0xfae3('0x36'));_0x28d1ef[_0xfae3('0x37')]=_[_0xfae3('0x38')](_0x2207b1[_0xfae3('0x37')]);_0x28d1ef[_0xfae3('0x39')]=_[_0xfae3('0x3a')](_0x28d1ef[_0xfae3('0x34')],_0x28d1ef['query']);_0x3e179c[_0xfae3('0x3b')]=_[_0xfae3('0x3a')](_0x28d1ef[_0xfae3('0x34')],qs[_0xfae3('0x3c')](_0x2207b1[_0xfae3('0x37')]['fields']));_0x3e179c[_0xfae3('0x3b')]=_0x3e179c[_0xfae3('0x3b')][_0xfae3('0x3d')]?_0x3e179c[_0xfae3('0x3b')]:_0x28d1ef['model'];if(!_0x2207b1[_0xfae3('0x37')][_0xfae3('0x3e')]('nolimit')){_0x3e179c[_0xfae3('0x23')]=qs[_0xfae3('0x23')](_0x2207b1[_0xfae3('0x37')]['limit']);_0x3e179c[_0xfae3('0x22')]=qs[_0xfae3('0x22')](_0x2207b1['query']['offset']);}_0x3e179c[_0xfae3('0x3f')]=qs[_0xfae3('0x40')](_0x2207b1['query'][_0xfae3('0x40')]);_0x3e179c[_0xfae3('0x41')]=qs[_0xfae3('0x39')](_[_0xfae3('0x42')](_0x2207b1['query'],_0x28d1ef[_0xfae3('0x39')]),_0x15854b);if(_0x2207b1['query'][_0xfae3('0x43')]){_0x3e179c[_0xfae3('0x41')]=_[_0xfae3('0x44')](_0x3e179c[_0xfae3('0x41')],{'$or':_[_0xfae3('0x35')](_0x15854b,function(_0x35a5b4){if(_0x35a5b4['type']!==_0xfae3('0x45')){var _0x5ac248={};_0x5ac248[_0x35a5b4[_0xfae3('0x36')]]={'$like':'%'+_0x2207b1[_0xfae3('0x37')][_0xfae3('0x43')]+'%'};return _0x5ac248;}})});}_0x3e179c=_[_0xfae3('0x44')]({},_0x3e179c,_0x2207b1[_0xfae3('0x46')]);var _0x450a55={'where':_0x3e179c[_0xfae3('0x41')]};return db['AnalyticCustomReport'][_0xfae3('0x25')](_0x450a55)[_0xfae3('0x2a')](function(_0x2efc2d){_0x4a5b1b[_0xfae3('0x25')]=_0x2efc2d;if(_0x2207b1[_0xfae3('0x37')]['includeAll']){_0x3e179c[_0xfae3('0x47')]=[{'all':!![]}];}return db[_0xfae3('0x31')]['findAll'](_0x3e179c);})[_0xfae3('0x2a')](function(_0x5d6f20){_0x4a5b1b[_0xfae3('0x48')]=_0x5d6f20;return _0x4a5b1b;})[_0xfae3('0x2a')](respondWithFilteredResult(_0x3a051c,_0x3e179c))['catch'](handleError(_0x3a051c,null));};exports['show']=function(_0x1194b5,_0x3a36d7){var _0x1cb7d3={'raw':![],'where':{'id':_0x1194b5[_0xfae3('0x49')]['id']}},_0x155ff0={};_0x155ff0[_0xfae3('0x34')]=_[_0xfae3('0x38')](db[_0xfae3('0x31')][_0xfae3('0x4a')]);_0x155ff0[_0xfae3('0x37')]=_['keys'](_0x1194b5[_0xfae3('0x37')]);_0x155ff0['filters']=_[_0xfae3('0x3a')](_0x155ff0[_0xfae3('0x34')],_0x155ff0[_0xfae3('0x37')]);_0x1cb7d3[_0xfae3('0x3b')]=_['intersection'](_0x155ff0['model'],qs[_0xfae3('0x3c')](_0x1194b5[_0xfae3('0x37')][_0xfae3('0x3c')]));_0x1cb7d3['attributes']=_0x1cb7d3[_0xfae3('0x3b')][_0xfae3('0x3d')]?_0x1cb7d3['attributes']:_0x155ff0[_0xfae3('0x34')];if(_0x1194b5['query'][_0xfae3('0x4b')]){_0x1cb7d3[_0xfae3('0x47')]=[{'all':!![]}];}_0x1cb7d3=_[_0xfae3('0x44')]({},_0x1cb7d3,_0x1194b5[_0xfae3('0x46')]);return db[_0xfae3('0x31')]['find'](_0x1cb7d3)[_0xfae3('0x2a')](handleEntityNotFound(_0x3a36d7,null))['then'](respondWithResult(_0x3a36d7,null))[_0xfae3('0x4c')](handleError(_0x3a36d7,null));};exports['create']=function(_0x29f08a,_0x3709dc){return db[_0xfae3('0x31')]['create'](_0x29f08a['body'],{})['then'](function(_0x18c03d){var _0x42098e=_0x29f08a['user'][_0xfae3('0x2b')]({'plain':!![]});if(!_0x42098e)throw new Error(_0xfae3('0x4d'));if(_0x42098e['role']===_0xfae3('0x4e')){var _0x267e7d=_0x18c03d['get']({'plain':!![]});var _0x5e44a9=_0xfae3('0x4f');return db[_0xfae3('0x50')][_0xfae3('0x51')]({'where':{'name':_0x5e44a9,'userProfileId':_0x42098e[_0xfae3('0x52')]},'raw':!![]})[_0xfae3('0x2a')](function(_0x5832a6){if(_0x5832a6&&_0x5832a6[_0xfae3('0x53')]===0x0){return db[_0xfae3('0x2c')][_0xfae3('0x54')]({'name':_0x267e7d[_0xfae3('0x36')],'resourceId':_0x267e7d['id'],'type':_0xfae3('0x55'),'sectionId':_0x5832a6['id']},{})[_0xfae3('0x2a')](function(){return _0x18c03d;});}else{return _0x18c03d;}})[_0xfae3('0x4c')](function(_0x2abb10){logger[_0xfae3('0x2e')](_0xfae3('0x56'),_0x2abb10);throw _0x2abb10;});}return _0x18c03d;})['then'](respondWithResult(_0x3709dc,0xc9))[_0xfae3('0x4c')](handleError(_0x3709dc,null));};exports[_0xfae3('0x29')]=function(_0x38a1b6,_0x48d496){if(_0x38a1b6[_0xfae3('0x57')]['id']){delete _0x38a1b6[_0xfae3('0x57')]['id'];}return db[_0xfae3('0x31')][_0xfae3('0x51')]({'where':{'id':_0x38a1b6['params']['id']}})[_0xfae3('0x2a')](handleEntityNotFound(_0x48d496,null))[_0xfae3('0x2a')](saveUpdates(_0x38a1b6['body'],null))['then'](respondWithResult(_0x48d496,null))[_0xfae3('0x4c')](handleError(_0x48d496,null));};exports[_0xfae3('0x2d')]=function(_0x56abbf,_0x48e0de){return db['AnalyticCustomReport']['find']({'where':{'id':_0x56abbf[_0xfae3('0x49')]['id']}})[_0xfae3('0x2a')](handleEntityNotFound(_0x48e0de,null))[_0xfae3('0x2a')](removeEntity(_0x48e0de,null))[_0xfae3('0x4c')](handleError(_0x48e0de,null));};exports[_0xfae3('0x58')]=function(_0x4a8b4f,_0x3f4f60){var _0x4b6b91=0xa;var _0x423479=[_0xfae3('0x59'),_0xfae3('0x5a'),_0xfae3('0x5b'),_0xfae3('0x5c')];var _0x4f7c78={'SUM':_0xfae3('0x5d'),'COUNT':_0xfae3('0x5e'),'COUNT DISTINCT':_0xfae3('0x5f'),'MAX':_0xfae3('0x60'),'MIN':_0xfae3('0x61'),'AVG':_0xfae3('0x62'),'GROUP_CONCAT':_0xfae3('0x63'),'GROUP_CONCAT ASC':_0xfae3('0x64'),'GROUP_CONCAT DESC':_0xfae3('0x65')};var _0x131b35={'SEC_TO_TIME':_0xfae3('0x66'),'DATE':'DATE(%s)','HOUR':_0xfae3('0x67'),'ROUND':_0xfae3('0x68'),'UNIX_TIMESTAMP':_0xfae3('0x69')};var _0x879fe3=function(_0x702267){return!_[_0xfae3('0x6a')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xfae3('0x6b'),_0xfae3('0x6c')],_0x702267);};var _0x3dab79=function(_0x2c8751){if(!_0x2c8751||!_0x2c8751[_0xfae3('0x6d')]['length']){return'';}for(var _0x2f70d9='(',_0x14133c=0x0;_0x14133c<_0x2c8751[_0xfae3('0x6d')][_0xfae3('0x3d')];_0x14133c+=0x1){_0x14133c>0x0&&(_0x2f70d9+='\x20'+_0x2c8751[_0xfae3('0x6e')]+'\x20');_0x2f70d9+=_0x2c8751[_0xfae3('0x6d')][_0x14133c][_0xfae3('0x6f')]?_0x3dab79(_0x2c8751[_0xfae3('0x6d')][_0x14133c][_0xfae3('0x6f')]):_0x2c8751['rules'][_0x14133c]['field']+'\x20'+_0x2c8751['rules'][_0x14133c][_0xfae3('0x70')]+(_0x879fe3(_0x2c8751[_0xfae3('0x6d')][_0x14133c]['condition'])?'\x20'+_0x2c8751[_0xfae3('0x6d')][_0x14133c][_0xfae3('0x71')]:'');}return _0x2f70d9+')';};var _0x39f9fc={'where':{'id':_0x4a8b4f[_0xfae3('0x49')]['id']}},_0x55557f,_0x2f5640,_0x580d49,_0x4fb71e,_0x12255e;_0x39f9fc=_['merge']({},_0x39f9fc,_0x4a8b4f[_0xfae3('0x46')]);return db['AnalyticCustomReport'][_0xfae3('0x51')](_0x39f9fc)[_0xfae3('0x2a')](function(_0x1c5358){if(_0x1c5358){_0x55557f=_0x1c5358;return _0x1c5358[_0xfae3('0x72')]();}return null;})[_0xfae3('0x2a')](function(_0x441c37){if(_0x441c37){if(!_0x441c37[_0xfae3('0x3d')]){throw new db['Sequelize'][(_0xfae3('0x73'))](_0xfae3('0x74'),0x193);}_0x2f5640=_0x441c37;return db[_0xfae3('0x75')][_0xfae3('0x76')]({'raw':!![]});}return null;})[_0xfae3('0x2a')](function(_0x1e08d1){if(_0x1e08d1){_0x580d49=_[_0xfae3('0x77')](_0x1e08d1,'id');var _0x2abf4e;var _0x43c0f0=squel[_0xfae3('0x78')]();_0x43c0f0[_0xfae3('0x79')](_0x55557f[_0xfae3('0x7a')]);for(var _0xd6b5bd=0x0;_0xd6b5bd<_0x2f5640[_0xfae3('0x3d')];_0xd6b5bd+=0x1){_0x2abf4e=_0x2f5640[_0xd6b5bd][_0xfae3('0x7b')]?_0x580d49[_0x2f5640[_0xd6b5bd][_0xfae3('0x7b')]][_0xfae3('0x7c')]:_0x2f5640[_0xd6b5bd][_0xfae3('0x7d')];_0x2abf4e=_0x2f5640[_0xd6b5bd][_0xfae3('0x7e')]?_['replace'](_0x4f7c78[_0x2f5640[_0xd6b5bd][_0xfae3('0x7e')]],'%s',_0x2abf4e):_0x2abf4e;_0x2abf4e=_0x2f5640[_0xd6b5bd][_0xfae3('0x7f')]?_[_0xfae3('0x80')](_0x131b35[_0x2f5640[_0xd6b5bd][_0xfae3('0x7f')]],'%s',_0x2abf4e):_0x2abf4e;if(_0x2f5640[_0xd6b5bd]['groupBy']){_0x43c0f0[_0xfae3('0x6f')](_0x2abf4e);}_0x2f5640[_0xd6b5bd][_0xfae3('0x81')]&&_0x43c0f0[_0xfae3('0x3f')](_0x2abf4e,_0x2f5640[_0xd6b5bd][_0xfae3('0x81')]===_0xfae3('0x82')?![]:!![]);_0x43c0f0[_0xfae3('0x7d')](_0x2abf4e,_0x2f5640[_0xd6b5bd]['alias']||_0x2abf4e);}if(_0x55557f['joins']){_0x55557f[_0xfae3('0x83')]=JSON[_0xfae3('0x84')](_0x55557f[_0xfae3('0x83')]);for(var _0x5c56a6=0x0;_0x5c56a6<_0x55557f[_0xfae3('0x83')]['length'];_0x5c56a6+=0x1){if(_0x55557f[_0xfae3('0x83')][_0x5c56a6][_0xfae3('0x33')]&&_['includes'](_0x423479,_0x55557f['joins'][_0x5c56a6][_0xfae3('0x33')])&&_0x55557f['joins'][_0x5c56a6]['parentKey']&&_0x55557f[_0xfae3('0x83')][_0x5c56a6][_0xfae3('0x85')]&&_0x55557f[_0xfae3('0x83')][_0x5c56a6]['foreignKey']){_0x43c0f0[_0x55557f[_0xfae3('0x83')][_0x5c56a6][_0xfae3('0x33')]](_0x55557f[_0xfae3('0x83')][_0x5c56a6][_0xfae3('0x85')],null,util[_0xfae3('0x7f')](_0xfae3('0x86'),_0x55557f[_0xfae3('0x7a')],_0x55557f[_0xfae3('0x83')][_0x5c56a6]['parentKey'],_0x55557f[_0xfae3('0x83')][_0x5c56a6][_0xfae3('0x85')],_0x55557f[_0xfae3('0x83')][_0x5c56a6][_0xfae3('0x87')]));}}}if(_0x55557f[_0xfae3('0x88')]){_0x55557f[_0xfae3('0x88')]=JSON[_0xfae3('0x84')](_0x55557f[_0xfae3('0x88')]);_0x43c0f0['where'](_0x3dab79(_0x55557f[_0xfae3('0x88')]['group']));}_0x12255e=_0x43c0f0[_0xfae3('0x89')]();_0x43c0f0[_0xfae3('0x23')](_0x4b6b91);_0x43c0f0['offset'](0x0);logger[_0xfae3('0x8a')](_0xfae3('0x8b'),_0x43c0f0[_0xfae3('0x8c')]());return dbH[_0xfae3('0x8d')][_0xfae3('0x37')](_0x43c0f0[_0xfae3('0x8c')](),{'type':dbH['sequelize'][_0xfae3('0x8e')][_0xfae3('0x8f')]});}})['then'](respondWithResult(_0x3f4f60,null))[_0xfae3('0x4c')](handleError(_0x3f4f60,null));};function runReport(_0x1bd229,_0x42d73a,_0x3e446c){var _0x168e45=_0x42d73a['name'];var _0x435cf0=0xa;var _0x4689cf=[_0xfae3('0x59'),_0xfae3('0x5a'),_0xfae3('0x5b'),_0xfae3('0x5c')];var _0x3fa5cc={'SUM':'SUM(%s)','COUNT':_0xfae3('0x5e'),'COUNT DISTINCT':_0xfae3('0x5f'),'MAX':_0xfae3('0x60'),'MIN':_0xfae3('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xfae3('0x63'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3670d4={'SEC_TO_TIME':_0xfae3('0x66'),'DATE':'DATE(%s)','HOUR':_0xfae3('0x67'),'ROUND':_0xfae3('0x68'),'UNIX_TIMESTAMP':_0xfae3('0x69')};var _0x514aaa=function(_0x4da23b){return!_[_0xfae3('0x6a')](['IS\x20NULL',_0xfae3('0x90'),_0xfae3('0x6b'),_0xfae3('0x6c')],_0x4da23b);};var _0x50c1e5=function(_0x1e0ced){if(!_0x1e0ced||!_0x1e0ced[_0xfae3('0x6d')]['length']){return'';}for(var _0xfb77b9='(',_0x26f42b=0x0;_0x26f42b<_0x1e0ced[_0xfae3('0x6d')]['length'];_0x26f42b+=0x1){_0x26f42b>0x0&&(_0xfb77b9+='\x20'+_0x1e0ced[_0xfae3('0x6e')]+'\x20');_0xfb77b9+=_0x1e0ced[_0xfae3('0x6d')][_0x26f42b][_0xfae3('0x6f')]?_0x50c1e5(_0x1e0ced[_0xfae3('0x6d')][_0x26f42b][_0xfae3('0x6f')]):_0x1e0ced[_0xfae3('0x6d')][_0x26f42b][_0xfae3('0x7d')]+'\x20'+_0x1e0ced[_0xfae3('0x6d')][_0x26f42b][_0xfae3('0x70')]+(_0x514aaa(_0x1e0ced[_0xfae3('0x6d')][_0x26f42b][_0xfae3('0x70')])?'\x20'+_0x1e0ced[_0xfae3('0x6d')][_0x26f42b][_0xfae3('0x71')]:'');}return _0xfb77b9+')';};var _0x300b96={'where':{'id':_0x1bd229['id']}},_0x1accbd,_0x4a205c,_0x108e88,_0x44113c,_0x1d2688;_0x300b96=_[_0xfae3('0x44')]({},_0x300b96,_0x3e446c);return db['AnalyticCustomReport'][_0xfae3('0x51')](_0x300b96)[_0xfae3('0x2a')](function(_0x7f1bb2){if(_0x7f1bb2){_0x1accbd=_0x7f1bb2;return _0x7f1bb2[_0xfae3('0x72')]();}return null;})[_0xfae3('0x2a')](function(_0x8a611a){if(_0x8a611a){if(!_0x8a611a[_0xfae3('0x3d')]){throw new db[(_0xfae3('0x91'))]['ValidationErrorItem'](_0xfae3('0x74'),0x193);}_0x4a205c=_0x8a611a;return db[_0xfae3('0x75')][_0xfae3('0x76')]({'raw':!![]});}return null;})['then'](function(_0x179777){if(_0x179777){_0x108e88=_[_0xfae3('0x77')](_0x179777,'id');var _0x50a40d;var _0x274957=squel[_0xfae3('0x78')]();_0x274957[_0xfae3('0x79')](_0x1accbd['table']);for(var _0x3851cd=0x0;_0x3851cd<_0x4a205c['length'];_0x3851cd+=0x1){_0x50a40d=_0x4a205c[_0x3851cd][_0xfae3('0x7b')]?_0x108e88[_0x4a205c[_0x3851cd][_0xfae3('0x7b')]]['metric']:_0x4a205c[_0x3851cd][_0xfae3('0x7d')];_0x50a40d=_0x4a205c[_0x3851cd][_0xfae3('0x7e')]?_['replace'](_0x3fa5cc[_0x4a205c[_0x3851cd]['function']],'%s',_0x50a40d):_0x50a40d;_0x50a40d=_0x4a205c[_0x3851cd]['format']?_['replace'](_0x3670d4[_0x4a205c[_0x3851cd][_0xfae3('0x7f')]],'%s',_0x50a40d):_0x50a40d;if(_0x4a205c[_0x3851cd][_0xfae3('0x92')]){_0x274957[_0xfae3('0x6f')](_0x50a40d);}_0x4a205c[_0x3851cd][_0xfae3('0x81')]&&_0x274957[_0xfae3('0x3f')](_0x50a40d,_0x4a205c[_0x3851cd][_0xfae3('0x81')]===_0xfae3('0x82')?![]:!![]);_0x274957['field'](_0x50a40d,_0x4a205c[_0x3851cd][_0xfae3('0x93')]||_0x50a40d);}if(_0x1accbd[_0xfae3('0x83')]){_0x1accbd[_0xfae3('0x83')]=JSON['parse'](_0x1accbd[_0xfae3('0x83')]);for(var _0x33880b=0x0;_0x33880b<_0x1accbd[_0xfae3('0x83')][_0xfae3('0x3d')];_0x33880b+=0x1){if(_0x1accbd[_0xfae3('0x83')][_0x33880b]['type']&&_['includes'](_0x4689cf,_0x1accbd[_0xfae3('0x83')][_0x33880b][_0xfae3('0x33')])&&_0x1accbd[_0xfae3('0x83')][_0x33880b]['parentKey']&&_0x1accbd[_0xfae3('0x83')][_0x33880b][_0xfae3('0x85')]&&_0x1accbd['joins'][_0x33880b][_0xfae3('0x87')]){_0x274957[_0x1accbd['joins'][_0x33880b][_0xfae3('0x33')]](_0x1accbd[_0xfae3('0x83')][_0x33880b][_0xfae3('0x85')],null,util[_0xfae3('0x7f')](_0xfae3('0x86'),_0x1accbd[_0xfae3('0x7a')],_0x1accbd[_0xfae3('0x83')][_0x33880b][_0xfae3('0x94')],_0x1accbd['joins'][_0x33880b][_0xfae3('0x85')],_0x1accbd[_0xfae3('0x83')][_0x33880b][_0xfae3('0x87')]));}}}if(_0x1accbd['conditions']){_0x1accbd['conditions']=JSON[_0xfae3('0x84')](_0x1accbd['conditions']);_0x274957[_0xfae3('0x41')](_0x50c1e5(_0x1accbd[_0xfae3('0x88')][_0xfae3('0x6f')]));}_0x1d2688=_0x274957[_0xfae3('0x89')]();_0x274957[_0xfae3('0x23')](_0x435cf0);_0x274957[_0xfae3('0x22')](0x0);return;}})['then'](function(){if(_0x42d73a['output']===_0xfae3('0x95')){return null;}var _0x5126b0=_[_0xfae3('0x44')](_0x42d73a,{'name':_0x42d73a[_0xfae3('0x96')]||_0x42d73a[_0xfae3('0x36')]||_0x1accbd[_0xfae3('0x36')],'basename':_0x168e45,'savename':util[_0xfae3('0x7f')](_0xfae3('0x97'),_0x42d73a[_0xfae3('0x36')]||_0x1accbd[_0xfae3('0x36')],require('randomstring')[_0xfae3('0x98')](0x4),_0x42d73a[_0xfae3('0x99')]||_0xfae3('0x9a')),'reportId':_0x1accbd['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xfae3('0x54')](_0x5126b0,{'raw':!![]});})[_0xfae3('0x2a')](function(_0x1e8b8c){if(_0x1accbd[_0xfae3('0x7a')]===_0xfae3('0x9b')){_0x1d2688[_0xfae3('0x41')](_0x1accbd[_0xfae3('0x7a')]+_0xfae3('0x9c'),_0x42d73a[_0xfae3('0x9d')],_0x42d73a[_0xfae3('0x9e')]);}else{_0x1d2688['where'](_0x1accbd[_0xfae3('0x7a')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x42d73a[_0xfae3('0x9d')],_0x42d73a['endDate']);}if(_0x1e8b8c){logger[_0xfae3('0x9f')](_0xfae3('0xa0'),_0x1d2688[_0xfae3('0x8c')]());require(_0xfae3('0xa1'))[_0xfae3('0xa2')](path['join'](__dirname,_0xfae3('0xa3'),_0x1e8b8c[_0xfae3('0x99')]),[_0x1e8b8c['id'],_0x1d2688[_0xfae3('0x8c')](),path[_0xfae3('0x59')](__dirname,_0xfae3('0xa4'),_0x1e8b8c[_0xfae3('0xa5')]),_0x168e45]);return _0x1e8b8c;}else{var _0x408f09=squel['select']();_0x408f09[_0xfae3('0x79')]('('+_0x1d2688[_0xfae3('0x8c')]()+')',_0xfae3('0xa6'));_0x408f09[_0xfae3('0x7d')]('COUNT(*)',_0xfae3('0x25'));_0x1d2688[_0xfae3('0x23')](_0x42d73a[_0xfae3('0x23')]||_0x435cf0);_0x1d2688[_0xfae3('0x22')](_0x42d73a[_0xfae3('0x22')]||0x0);return dbH['sequelize'][_0xfae3('0x37')](_0x408f09['toString'](),{'type':dbH[_0xfae3('0x8d')][_0xfae3('0x8e')]['SELECT']})[_0xfae3('0x2a')](function(_0x22a5bc){if(!_0x22a5bc[_0xfae3('0x3d')]){_0x44113c=0x0;}else{_0x44113c=_0x22a5bc[0x0][_0xfae3('0x25')]||0x0;}return dbH[_0xfae3('0x8d')][_0xfae3('0x37')](_0x1d2688[_0xfae3('0x8c')](),{'type':dbH[_0xfae3('0x8d')]['QueryTypes'][_0xfae3('0x8f')]});})[_0xfae3('0x2a')](function(_0x3e9e62){return{'rows':_0x3e9e62||[],'count':_0x44113c};});}});}exports['run']=function(_0x21dbf4,_0x4ba361){return runReport(_0x21dbf4['params'],_0x21dbf4[_0xfae3('0x37')],_0x21dbf4[_0xfae3('0x46')])[_0xfae3('0x2a')](respondWithResult(_0x4ba361,null))['catch'](handleError(_0x4ba361,null));};exports['runReport']=runReport;exports[_0xfae3('0x37')]=function(_0x34196c,_0x5ad14e){var _0x56bff2=0xa;var _0x5a31d4=['join',_0xfae3('0x5a'),_0xfae3('0x5b'),'cross_join'];var _0x48bf45={'SUM':_0xfae3('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xfae3('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xfae3('0x63'),'GROUP_CONCAT ASC':_0xfae3('0x64'),'GROUP_CONCAT DESC':_0xfae3('0x65')};var _0x13b48f={'SEC_TO_TIME':_0xfae3('0x66'),'DATE':'DATE(%s)','HOUR':_0xfae3('0x67'),'ROUND':_0xfae3('0x68'),'UNIX_TIMESTAMP':_0xfae3('0x69')};var _0x2e6cc2=function(_0x4f9d1b){return!_['includes']([_0xfae3('0xa7'),_0xfae3('0x90'),'IS\x20EMPTY',_0xfae3('0x6c')],_0x4f9d1b);};var _0x360cc8=function(_0x1a436d){if(!_0x1a436d||!_0x1a436d[_0xfae3('0x6d')][_0xfae3('0x3d')]){return'';}for(var _0x1418c5='(',_0x4864f8=0x0;_0x4864f8<_0x1a436d[_0xfae3('0x6d')][_0xfae3('0x3d')];_0x4864f8+=0x1){_0x4864f8>0x0&&(_0x1418c5+='\x20'+_0x1a436d[_0xfae3('0x6e')]+'\x20');_0x1418c5+=_0x1a436d[_0xfae3('0x6d')][_0x4864f8][_0xfae3('0x6f')]?_0x360cc8(_0x1a436d[_0xfae3('0x6d')][_0x4864f8]['group']):_0x1a436d['rules'][_0x4864f8][_0xfae3('0x7d')]+'\x20'+_0x1a436d[_0xfae3('0x6d')][_0x4864f8]['condition']+(_0x2e6cc2(_0x1a436d['rules'][_0x4864f8][_0xfae3('0x70')])?'\x20'+_0x1a436d['rules'][_0x4864f8][_0xfae3('0x71')]:'');}return _0x1418c5+')';};var _0x14cb0a={'where':{'id':_0x34196c[_0xfae3('0x49')]['id']}},_0x1e9449,_0x2f608c,_0x5c5f56,_0xd38be6,_0x35d19c;_0x14cb0a=_[_0xfae3('0x44')]({},_0x14cb0a,_0x34196c['options']);return db['AnalyticCustomReport'][_0xfae3('0x51')](_0x14cb0a)[_0xfae3('0x2a')](function(_0x1ef244){if(_0x1ef244){_0x1e9449=_0x1ef244;return _0x1ef244['getFields']();}return null;})[_0xfae3('0x2a')](function(_0x46bf48){if(_0x46bf48){if(!_0x46bf48[_0xfae3('0x3d')]){throw new db['Sequelize'][(_0xfae3('0x73'))](_0xfae3('0x74'),0x193);}_0x2f608c=_0x46bf48;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xfae3('0x2a')](function(_0x5b1a08){if(_0x5b1a08){_0x5c5f56=_[_0xfae3('0x77')](_0x5b1a08,'id');var _0x1405b8;var _0x21db01=squel[_0xfae3('0x78')]();_0x21db01['from'](_0x1e9449[_0xfae3('0x7a')]);for(var _0x4289af=0x0;_0x4289af<_0x2f608c[_0xfae3('0x3d')];_0x4289af+=0x1){_0x1405b8=_0x2f608c[_0x4289af][_0xfae3('0x7b')]?_0x5c5f56[_0x2f608c[_0x4289af][_0xfae3('0x7b')]][_0xfae3('0x7c')]:_0x2f608c[_0x4289af][_0xfae3('0x7d')];_0x1405b8=_0x2f608c[_0x4289af]['function']?_[_0xfae3('0x80')](_0x48bf45[_0x2f608c[_0x4289af][_0xfae3('0x7e')]],'%s',_0x1405b8):_0x1405b8;_0x1405b8=_0x2f608c[_0x4289af][_0xfae3('0x7f')]?_['replace'](_0x13b48f[_0x2f608c[_0x4289af]['format']],'%s',_0x1405b8):_0x1405b8;if(_0x2f608c[_0x4289af][_0xfae3('0x92')]){_0x21db01['group'](_0x1405b8);}_0x2f608c[_0x4289af]['orderBy']&&_0x21db01['order'](_0x1405b8,_0x2f608c[_0x4289af][_0xfae3('0x81')]===_0xfae3('0x82')?![]:!![]);_0x21db01[_0xfae3('0x7d')](_0x1405b8,_0x2f608c[_0x4289af][_0xfae3('0x93')]||_0x1405b8);}if(_0x1e9449[_0xfae3('0x83')]){_0x1e9449['joins']=JSON[_0xfae3('0x84')](_0x1e9449[_0xfae3('0x83')]);for(var _0x49a374=0x0;_0x49a374<_0x1e9449[_0xfae3('0x83')][_0xfae3('0x3d')];_0x49a374+=0x1){if(_0x1e9449[_0xfae3('0x83')][_0x49a374]['type']&&_[_0xfae3('0x6a')](_0x5a31d4,_0x1e9449[_0xfae3('0x83')][_0x49a374]['type'])&&_0x1e9449[_0xfae3('0x83')][_0x49a374][_0xfae3('0x94')]&&_0x1e9449[_0xfae3('0x83')][_0x49a374][_0xfae3('0x85')]&&_0x1e9449[_0xfae3('0x83')][_0x49a374][_0xfae3('0x87')]){_0x21db01[_0x1e9449[_0xfae3('0x83')][_0x49a374][_0xfae3('0x33')]](_0x1e9449['joins'][_0x49a374][_0xfae3('0x85')],null,util[_0xfae3('0x7f')](_0xfae3('0x86'),_0x1e9449[_0xfae3('0x7a')],_0x1e9449[_0xfae3('0x83')][_0x49a374]['parentKey'],_0x1e9449['joins'][_0x49a374][_0xfae3('0x85')],_0x1e9449[_0xfae3('0x83')][_0x49a374][_0xfae3('0x87')]));}}}if(_0x1e9449['conditions']){_0x1e9449[_0xfae3('0x88')]=JSON['parse'](_0x1e9449[_0xfae3('0x88')]);_0x21db01[_0xfae3('0x41')](_0x360cc8(_0x1e9449['conditions'][_0xfae3('0x6f')]));}_0x35d19c=_0x21db01[_0xfae3('0x89')]();_0x21db01[_0xfae3('0x23')](_0x56bff2);_0x21db01[_0xfae3('0x22')](0x0);logger['debug'](_0xfae3('0x8b'),_0x21db01[_0xfae3('0x8c')]());return dbH['sequelize']['query'](_0x21db01[_0xfae3('0x8c')](),{'type':dbH[_0xfae3('0x8d')][_0xfae3('0x8e')]['SELECT']});}})['then'](function(){return{'sql':_0x35d19c[_0xfae3('0x8c')]()};})[_0xfae3('0x2a')](respondWithResult(_0x5ad14e,null))[_0xfae3('0x4c')](handleError(_0x5ad14e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 8f347df..eb54a7b 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 _0x0979=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x15443a,_0x3599b8){var _0x194e55=function(_0x355453){while(--_0x355453){_0x15443a['push'](_0x15443a['shift']());}};_0x194e55(++_0x3599b8);}(_0x0979,0xd8));var _0x9097=function(_0x402eff,_0x2525f2){_0x402eff=_0x402eff-0x0;var _0x2eb371=_0x0979[_0x402eff];return _0x2eb371;};'use strict';var _=require(_0x9097('0x0'));var util=require(_0x9097('0x1'));var logger=require(_0x9097('0x2'))(_0x9097('0x3'));var moment=require(_0x9097('0x4'));var BPromise=require(_0x9097('0x5'));var rp=require(_0x9097('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9097('0x7'));var config=require('../../config/environment');var attributes=require(_0x9097('0x8'));module['exports']=function(_0x376d9a,_0x1d4e17){return _0x376d9a[_0x9097('0x9')](_0x9097('0xa'),attributes,{'tableName':_0x9097('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb9c=['analytics_custom_reports','lodash','util','api','bluebird','request-promise','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x2e44cf,_0x16f684){var _0x361268=function(_0x2a59db){while(--_0x2a59db){_0x2e44cf['push'](_0x2e44cf['shift']());}};_0x361268(++_0x16f684);}(_0xfb9c,0x198));var _0xcfb9=function(_0x19a11f,_0x6d8be7){_0x19a11f=_0x19a11f-0x0;var _0x51485f=_0xfb9c[_0x19a11f];return _0x51485f;};'use strict';var _=require(_0xcfb9('0x0'));var util=require(_0xcfb9('0x1'));var logger=require('../../config/logger')(_0xcfb9('0x2'));var moment=require('moment');var BPromise=require(_0xcfb9('0x3'));var rp=require(_0xcfb9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcfb9('0x5'));var attributes=require(_0xcfb9('0x6'));module[_0xcfb9('0x7')]=function(_0x8a5064,_0x2012a3){return _0x8a5064[_0xcfb9('0x8')](_0xcfb9('0x9'),attributes,{'tableName':_0xcfb9('0xa'),'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 d10957f..81eb063 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 _0x0491=['then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','http','request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0491,0xf3));var _0x1049=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x0491[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x1049('0x0'));var util=require(_0x1049('0x1'));var moment=require(_0x1049('0x2'));var BPromise=require('bluebird');var rs=require(_0x1049('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1049('0x4'));var logger=require(_0x1049('0x5'))(_0x1049('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1049('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ee01a,_0x1640f7,_0x57c01d){return new BPromise(function(_0xf61e06,_0x3878b9){return client[_0x1049('0x8')](_0x3ee01a,_0x57c01d)[_0x1049('0x9')](function(_0x316e56){logger['info'](_0x1049('0xa'),_0x1640f7,_0x1049('0xb'));logger[_0x1049('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1640f7,_0x1049('0xb'),JSON[_0x1049('0xd')](_0x316e56));if(_0x316e56[_0x1049('0xe')]){if(_0x316e56[_0x1049('0xe')][_0x1049('0xf')]===0x1f4){logger['error'](_0x1049('0xa'),_0x1640f7,_0x316e56['error'][_0x1049('0x10')]);return _0x3878b9(_0x316e56['error'][_0x1049('0x10')]);}logger[_0x1049('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1640f7,_0x316e56[_0x1049('0xe')]['message']);return _0xf61e06(_0x316e56[_0x1049('0xe')][_0x1049('0x10')]);}else{logger[_0x1049('0x11')](_0x1049('0xa'),_0x1640f7,_0x1049('0xb'));_0xf61e06(_0x316e56['result']['message']);}})['catch'](function(_0x382ae5){logger[_0x1049('0xe')](_0x1049('0xa'),_0x1640f7,_0x382ae5);_0x3878b9(_0x382ae5);});});} \ No newline at end of file +var _0x93a8=['rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x455197,_0x5471c1){var _0x128d2c=function(_0x31c61){while(--_0x31c61){_0x455197['push'](_0x455197['shift']());}};_0x128d2c(++_0x5471c1);}(_0x93a8,0x19b));var _0x893a=function(_0x47448e,_0x144590){_0x47448e=_0x47448e-0x0;var _0x1131c8=_0x93a8[_0x47448e];return _0x1131c8;};'use strict';var _=require(_0x893a('0x0'));var util=require(_0x893a('0x1'));var moment=require(_0x893a('0x2'));var BPromise=require(_0x893a('0x3'));var rs=require(_0x893a('0x4'));var fs=require('fs');var Redis=require(_0x893a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x893a('0x6'));var logger=require('../../config/logger')(_0x893a('0x7'));var config=require(_0x893a('0x8'));var jayson=require(_0x893a('0x9'));var client=jayson['client'][_0x893a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28e8c0,_0x51c528,_0x53d003){return new BPromise(function(_0x487f8a,_0x5a1124){return client[_0x893a('0xb')](_0x28e8c0,_0x53d003)[_0x893a('0xc')](function(_0x72dc3c){logger[_0x893a('0xd')](_0x893a('0xe'),_0x51c528,_0x893a('0xf'));logger['debug'](_0x893a('0x10'),_0x51c528,'request\x20sent',JSON[_0x893a('0x11')](_0x72dc3c));if(_0x72dc3c[_0x893a('0x12')]){if(_0x72dc3c[_0x893a('0x12')]['code']===0x1f4){logger[_0x893a('0x12')](_0x893a('0xe'),_0x51c528,_0x72dc3c[_0x893a('0x12')][_0x893a('0x13')]);return _0x5a1124(_0x72dc3c[_0x893a('0x12')]['message']);}logger[_0x893a('0x12')](_0x893a('0xe'),_0x51c528,_0x72dc3c[_0x893a('0x12')][_0x893a('0x13')]);return _0x487f8a(_0x72dc3c[_0x893a('0x12')][_0x893a('0x13')]);}else{logger['info'](_0x893a('0xe'),_0x51c528,_0x893a('0xf'));_0x487f8a(_0x72dc3c[_0x893a('0x14')]['message']);}})[_0x893a('0x15')](function(_0xd61107){logger['error'](_0x893a('0xe'),_0x51c528,_0xd61107);_0x5a1124(_0xd61107);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 427ac07..cd96ae6 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 _0x5c2b=['put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','create'];(function(_0x466a1a,_0x37933b){var _0x577165=function(_0x4c97b9){while(--_0x4c97b9){_0x466a1a['push'](_0x466a1a['shift']());}};_0x577165(++_0x37933b);}(_0x5c2b,0x73));var _0xb5c2=function(_0x5c0489,_0x2916f9){_0x5c0489=_0x5c0489-0x0;var _0x2b4d00=_0x5c2b[_0x5c0489];return _0x2b4d00;};'use strict';var multer=require('multer');var util=require(_0xb5c2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb5c2('0x1'));var router=express[_0xb5c2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb5c2('0x3'));var interaction=require(_0xb5c2('0x4'));var config=require(_0xb5c2('0x5'));var controller=require('./analyticCustomReport.controller');router[_0xb5c2('0x6')]('/',auth[_0xb5c2('0x7')](),controller[_0xb5c2('0x8')]);router[_0xb5c2('0x6')](_0xb5c2('0x9'),auth[_0xb5c2('0x7')](),controller[_0xb5c2('0xa')]);router[_0xb5c2('0x6')](_0xb5c2('0xb'),auth[_0xb5c2('0x7')](),controller[_0xb5c2('0xc')]);router[_0xb5c2('0x6')]('/:id/run',auth[_0xb5c2('0x7')](),controller[_0xb5c2('0xd')]);router[_0xb5c2('0x6')](_0xb5c2('0xe'),auth[_0xb5c2('0x7')](),controller[_0xb5c2('0xf')]);router['post']('/',auth[_0xb5c2('0x7')](),controller[_0xb5c2('0x10')]);router[_0xb5c2('0x11')](_0xb5c2('0x9'),auth[_0xb5c2('0x7')](),controller[_0xb5c2('0x12')]);router[_0xb5c2('0x13')](_0xb5c2('0x9'),auth[_0xb5c2('0x7')](),controller[_0xb5c2('0x14')]);module[_0xb5c2('0x15')]=router; \ No newline at end of file +var _0x94b5=['delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','preview','/:id/query','query','create','put','/:id','update'];(function(_0x443dee,_0x397273){var _0x47d0f6=function(_0x485ee3){while(--_0x485ee3){_0x443dee['push'](_0x443dee['shift']());}};_0x47d0f6(++_0x397273);}(_0x94b5,0x14c));var _0x594b=function(_0x296ef5,_0x2e40f0){_0x296ef5=_0x296ef5-0x0;var _0x32bf68=_0x94b5[_0x296ef5];return _0x32bf68;};'use strict';var multer=require(_0x594b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x594b('0x1'));var express=require(_0x594b('0x2'));var router=express[_0x594b('0x3')]();var fs_extra=require(_0x594b('0x4'));var auth=require(_0x594b('0x5'));var interaction=require(_0x594b('0x6'));var config=require(_0x594b('0x7'));var controller=require(_0x594b('0x8'));router[_0x594b('0x9')]('/',auth[_0x594b('0xa')](),controller[_0x594b('0xb')]);router[_0x594b('0x9')]('/:id',auth[_0x594b('0xa')](),controller['show']);router[_0x594b('0x9')](_0x594b('0xc'),auth[_0x594b('0xa')](),controller[_0x594b('0xd')]);router['get']('/:id/run',auth[_0x594b('0xa')](),controller['run']);router[_0x594b('0x9')](_0x594b('0xe'),auth[_0x594b('0xa')](),controller[_0x594b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x594b('0x10')]);router[_0x594b('0x11')](_0x594b('0x12'),auth[_0x594b('0xa')](),controller[_0x594b('0x13')]);router[_0x594b('0x14')](_0x594b('0x12'),auth[_0x594b('0xa')](),controller['destroy']);module[_0x594b('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 598d40c..0a98faa 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 _0x71ab=['TEXT','exports','STRING'];(function(_0x12e2d2,_0x52b6c1){var _0x364317=function(_0x1779c1){while(--_0x1779c1){_0x12e2d2['push'](_0x12e2d2['shift']());}};_0x364317(++_0x52b6c1);}(_0x71ab,0x64));var _0xb71a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71ab[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file +var _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x2bfd90,_0x102539){var _0x33e709=function(_0x198f74){while(--_0x198f74){_0x2bfd90['push'](_0x2bfd90['shift']());}};_0x33e709(++_0x102539);}(_0xf494,0x1c6));var _0x4f49=function(_0xc6517c,_0x20c405){_0xc6517c=_0xc6517c-0x0;var _0x564644=_0xf494[_0xc6517c];return _0x564644;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 8fc9ee5..c13cff1 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 _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','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','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xabce[_0x5317b5];return _0x3b7ce2;};'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'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file +var _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0xedb737,_0xcc55f4){var _0x5a691d=function(_0x522a77){while(--_0x522a77){_0xedb737['push'](_0xedb737['shift']());}};_0x5a691d(++_0xcc55f4);}(_0x1967,0x173));var _0x7196=function(_0x150429,_0x2b2454){_0x150429=_0x150429-0x0;var _0x48b1f4=_0x1967[_0x150429];return _0x48b1f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a5d7aa5..490636a 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 _0x363b=['path','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','lodash','util','api','moment','bluebird','request-promise'];(function(_0x23acb3,_0x1dc2b6){var _0x4f4b20=function(_0x2ce493){while(--_0x2ce493){_0x23acb3['push'](_0x23acb3['shift']());}};_0x4f4b20(++_0x1dc2b6);}(_0x363b,0xf7));var _0xb363=function(_0x3e8112,_0x18ac48){_0x3e8112=_0x3e8112-0x0;var _0x48dde7=_0x363b[_0x3e8112];return _0x48dde7;};'use strict';var _=require(_0xb363('0x0'));var util=require(_0xb363('0x1'));var logger=require('../../config/logger')(_0xb363('0x2'));var moment=require(_0xb363('0x3'));var BPromise=require(_0xb363('0x4'));var rp=require(_0xb363('0x5'));var fs=require('fs');var path=require(_0xb363('0x6'));var rimraf=require('rimraf');var config=require(_0xb363('0x7'));var attributes=require(_0xb363('0x8'));module[_0xb363('0x9')]=function(_0x38f666,_0x46b2ca){return _0x38f666['define'](_0xb363('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf34=['../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x597b41,_0x7c3cc){var _0x625c53=function(_0x6939c0){while(--_0x6939c0){_0x597b41['push'](_0x597b41['shift']());}};_0x625c53(++_0x7c3cc);}(_0xcf34,0xad));var _0x4cf3=function(_0x392dc2,_0x47c3f3){_0x392dc2=_0x392dc2-0x0;var _0x14150f=_0xcf34[_0x392dc2];return _0x14150f;};'use strict';var _=require('lodash');var util=require(_0x4cf3('0x0'));var logger=require(_0x4cf3('0x1'))(_0x4cf3('0x2'));var moment=require(_0x4cf3('0x3'));var BPromise=require(_0x4cf3('0x4'));var rp=require(_0x4cf3('0x5'));var fs=require('fs');var path=require(_0x4cf3('0x6'));var rimraf=require('rimraf');var config=require(_0x4cf3('0x7'));var attributes=require(_0x4cf3('0x8'));module['exports']=function(_0x20ec54,_0xe8b4cf){return _0x20ec54[_0x4cf3('0x9')](_0x4cf3('0xa'),attributes,{'tableName':_0x4cf3('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 49adbda..dec7ea1 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 _0x184a=['request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x509bb2,_0x431e36){var _0xf70b8e=function(_0x1e212d){while(--_0x1e212d){_0x509bb2['push'](_0x509bb2['shift']());}};_0xf70b8e(++_0x431e36);}(_0x184a,0x1c3));var _0xa184=function(_0x35d536,_0x2ad226){_0x35d536=_0x35d536-0x0;var _0x459181=_0x184a[_0x35d536];return _0x459181;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa184('0x0'));var BPromise=require(_0xa184('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa184('0x2'));var db=require(_0xa184('0x3'))['db'];var utils=require(_0xa184('0x4'));var logger=require(_0xa184('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa184('0x6'));var client=jayson[_0xa184('0x7')][_0xa184('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b8135,_0x13157c,_0x584461){return new BPromise(function(_0x1a3613,_0x1d6191){return client[_0xa184('0x9')](_0x5b8135,_0x584461)[_0xa184('0xa')](function(_0x14ed3e){logger[_0xa184('0xb')](_0xa184('0xc'),_0x13157c,_0xa184('0xd'));logger[_0xa184('0xe')](_0xa184('0xf'),_0x13157c,_0xa184('0xd'),JSON['stringify'](_0x14ed3e));if(_0x14ed3e[_0xa184('0x10')]){if(_0x14ed3e[_0xa184('0x10')][_0xa184('0x11')]===0x1f4){logger[_0xa184('0x10')](_0xa184('0xc'),_0x13157c,_0x14ed3e[_0xa184('0x10')][_0xa184('0x12')]);return _0x1d6191(_0x14ed3e['error'][_0xa184('0x12')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x13157c,_0x14ed3e[_0xa184('0x10')][_0xa184('0x12')]);return _0x1a3613(_0x14ed3e['error']['message']);}else{logger[_0xa184('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x13157c,_0xa184('0xd'));_0x1a3613(_0x14ed3e[_0xa184('0x13')][_0xa184('0x12')]);}})['catch'](function(_0x442922){logger['error'](_0xa184('0xc'),_0x13157c,_0x442922);_0x1d6191(_0x442922);});});} \ No newline at end of file +var _0x18e9=['../../mysqldb','../../config/logger','../../config/environment','client','http','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring'];(function(_0x2e4b5a,_0x208a5b){var _0x3429c6=function(_0x1fe4b8){while(--_0x1fe4b8){_0x2e4b5a['push'](_0x2e4b5a['shift']());}};_0x3429c6(++_0x208a5b);}(_0x18e9,0x1f4));var _0x918e=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x18e9[_0x25662e];return _0x59b7bc;};'use strict';var _=require(_0x918e('0x0'));var util=require(_0x918e('0x1'));var moment=require('moment');var BPromise=require(_0x918e('0x2'));var rs=require(_0x918e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x918e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x918e('0x5'))('rpc');var config=require(_0x918e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x918e('0x7')][_0x918e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x458027,_0x590d45,_0x59ef00){return new BPromise(function(_0x42da24,_0x2923c0){return client['request'](_0x458027,_0x59ef00)[_0x918e('0x9')](function(_0x550c30){logger['info'](_0x918e('0xa'),_0x590d45,_0x918e('0xb'));logger[_0x918e('0xc')](_0x918e('0xd'),_0x590d45,_0x918e('0xb'),JSON[_0x918e('0xe')](_0x550c30));if(_0x550c30[_0x918e('0xf')]){if(_0x550c30[_0x918e('0xf')][_0x918e('0x10')]===0x1f4){logger[_0x918e('0xf')](_0x918e('0xa'),_0x590d45,_0x550c30[_0x918e('0xf')][_0x918e('0x11')]);return _0x2923c0(_0x550c30[_0x918e('0xf')]['message']);}logger[_0x918e('0xf')](_0x918e('0xa'),_0x590d45,_0x550c30[_0x918e('0xf')][_0x918e('0x11')]);return _0x42da24(_0x550c30[_0x918e('0xf')][_0x918e('0x11')]);}else{logger[_0x918e('0x12')](_0x918e('0xa'),_0x590d45,'request\x20sent');_0x42da24(_0x550c30[_0x918e('0x13')][_0x918e('0x11')]);}})[_0x918e('0x14')](function(_0xcfa883){logger[_0x918e('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x590d45,_0xcfa883);_0x2923c0(_0xcfa883);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index ae9448c..30f59f2 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 _0x9e0c=['/:id/query','query','post','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','show','/:id/preview','preview','/:id/run'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x9e0c,0x194));var _0xc9e0=function(_0x4f807b,_0x517fc5){_0x4f807b=_0x4f807b-0x0;var _0x2a485d=_0x9e0c[_0x4f807b];return _0x2a485d;};'use strict';var multer=require(_0xc9e0('0x0'));var util=require(_0xc9e0('0x1'));var path=require('path');var timeout=require(_0xc9e0('0x2'));var express=require(_0xc9e0('0x3'));var router=express[_0xc9e0('0x4')]();var fs_extra=require(_0xc9e0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc9e0('0x6'));var config=require('../../config/environment');var controller=require(_0xc9e0('0x7'));router[_0xc9e0('0x8')]('/',auth[_0xc9e0('0x9')](),controller['index']);router[_0xc9e0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc9e0('0xa')]);router['get'](_0xc9e0('0xb'),auth[_0xc9e0('0x9')](),controller[_0xc9e0('0xc')]);router['get'](_0xc9e0('0xd'),auth[_0xc9e0('0x9')](),controller['run']);router[_0xc9e0('0x8')](_0xc9e0('0xe'),auth['isAuthenticated'](),controller[_0xc9e0('0xf')]);router[_0xc9e0('0x10')]('/',auth[_0xc9e0('0x9')](),controller['create']);router['put'](_0xc9e0('0x11'),auth[_0xc9e0('0x9')](),controller[_0xc9e0('0x12')]);router[_0xc9e0('0x13')](_0xc9e0('0x11'),auth['isAuthenticated'](),controller[_0xc9e0('0x14')]);module[_0xc9e0('0x15')]=router; \ No newline at end of file +var _0xaaaf=['get','isAuthenticated','index','preview','run','/:id/query','query','put','/:id','update','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x36e996,_0x3cb19e){var _0x44b9e4=function(_0x480e57){while(--_0x480e57){_0x36e996['push'](_0x36e996['shift']());}};_0x44b9e4(++_0x3cb19e);}(_0xaaaf,0x108));var _0xfaaa=function(_0x49c700,_0x8a6e95){_0x49c700=_0x49c700-0x0;var _0x4a2533=_0xaaaf[_0x49c700];return _0x4a2533;};'use strict';var multer=require('multer');var util=require(_0xfaaa('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfaaa('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xfaaa('0x2'));var interaction=require(_0xfaaa('0x3'));var config=require(_0xfaaa('0x4'));var controller=require(_0xfaaa('0x5'));router[_0xfaaa('0x6')]('/',auth[_0xfaaa('0x7')](),controller[_0xfaaa('0x8')]);router[_0xfaaa('0x6')]('/:id',auth[_0xfaaa('0x7')](),controller['show']);router[_0xfaaa('0x6')]('/:id/preview',auth[_0xfaaa('0x7')](),controller[_0xfaaa('0x9')]);router['get']('/:id/run',auth[_0xfaaa('0x7')](),controller[_0xfaaa('0xa')]);router[_0xfaaa('0x6')](_0xfaaa('0xb'),auth[_0xfaaa('0x7')](),controller[_0xfaaa('0xc')]);router['post']('/',auth[_0xfaaa('0x7')](),controller['create']);router[_0xfaaa('0xd')](_0xfaaa('0xe'),auth[_0xfaaa('0x7')](),controller[_0xfaaa('0xf')]);router['delete'](_0xfaaa('0xe'),auth[_0xfaaa('0x7')](),controller[_0xfaaa('0x10')]);module[_0xfaaa('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 4b8504d..5ccfa9f 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 _0xb3c1=['manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','csv','pdf','xlsx','DATE'];(function(_0x3d6626,_0x447998){var _0x3f08b3=function(_0x1f5202){while(--_0x1f5202){_0x3d6626['push'](_0x3d6626['shift']());}};_0x3f08b3(++_0x447998);}(_0xb3c1,0x116));var _0x1b3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb3c1[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1b3c('0x0'));var moment=require(_0x1b3c('0x1'));module[_0x1b3c('0x2')]={'name':{'type':Sequelize[_0x1b3c('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x1b3c('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x1b3c('0x4'),_0x1b3c('0x5'),_0x1b3c('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x1b3c('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1b3c('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x1b3c('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x1b3c('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x1b3c('0x8')},'reportId':{'type':Sequelize[_0x1b3c('0x9')](0xb)[_0x1b3c('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x16bc=['Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0xee700d,_0x1388db){var _0x117b27=function(_0x401f16){while(--_0x401f16){_0xee700d['push'](_0xee700d['shift']());}};_0x117b27(++_0x1388db);}(_0x16bc,0xef));var _0xc16b=function(_0x4d65dc,_0x1bc42b){_0x4d65dc=_0x4d65dc-0x0;var _0x3c2057=_0x16bc[_0x4d65dc];return _0x3c2057;};'use strict';var Sequelize=require(_0xc16b('0x0'));var moment=require(_0xc16b('0x1'));module['exports']={'name':{'type':Sequelize[_0xc16b('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xc16b('0x3')](_0xc16b('0x4'),_0xc16b('0x5'),_0xc16b('0x6')),'allowNull':![],'defaultValue':_0xc16b('0x4')},'savename':{'type':Sequelize[_0xc16b('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xc16b('0x7')]},'status':{'type':Sequelize[_0xc16b('0x2')],'defaultValue':_0xc16b('0x8')},'type':{'type':Sequelize[_0xc16b('0x3')](_0xc16b('0x9'),_0xc16b('0xa')),'allowNull':![],'defaultValue':_0xc16b('0x9')},'reportId':{'type':Sequelize[_0xc16b('0xb')](0xb)[_0xc16b('0xc')]},'reportType':{'type':Sequelize[_0xc16b('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 92faedc..dc7a1d9 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 _0xa671=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','count','includeAll','include','findAll','params','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','exists','join','format','%s.%s','eml-format','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x2a4110,_0x31454b){var _0x27549c=function(_0x201cc4){while(--_0x201cc4){_0x2a4110['push'](_0x2a4110['shift']());}};_0x27549c(++_0x31454b);}(_0xa671,0xa4));var _0x1a67=function(_0x4a4ba0,_0x463721){_0x4a4ba0=_0x4a4ba0-0x0;var _0x45de2d=_0xa671[_0x4a4ba0];return _0x45de2d;};'use strict';var emlformat=require(_0x1a67('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1a67('0x1'));var moment=require(_0x1a67('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1a67('0x3'));var sox=require(_0x1a67('0x4'));var csv=require(_0x1a67('0x5'));var ejs=require(_0x1a67('0x6'));var fs=require('fs');var fs_extra=require(_0x1a67('0x7'));var _=require(_0x1a67('0x8'));var squel=require(_0x1a67('0x9'));var crypto=require('crypto');var jsforce=require(_0x1a67('0xa'));var deskjs=require(_0x1a67('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1a67('0xc'));var Papa=require('papaparse');var Redis=require(_0x1a67('0xd'));var authService=require(_0x1a67('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1a67('0xf'));var hardwareService=require(_0x1a67('0x10'));var logger=require(_0x1a67('0x11'))(_0x1a67('0x12'));var utils=require(_0x1a67('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a67('0x14'))['db'];function respondWithStatusCode(_0xa1dc75,_0x577f95){_0x577f95=_0x577f95||0xcc;return function(_0x1522da){if(_0x1522da){return _0xa1dc75[_0x1a67('0x15')](_0x577f95);}return _0xa1dc75[_0x1a67('0x16')](_0x577f95)[_0x1a67('0x17')]();};}function respondWithResult(_0x261eb1,_0x494e39){_0x494e39=_0x494e39||0xc8;return function(_0x20111a){if(_0x20111a){return _0x261eb1[_0x1a67('0x16')](_0x494e39)[_0x1a67('0x18')](_0x20111a);}};}function respondWithFilteredResult(_0x3be788,_0x3e0c9b){return function(_0x5d351b){if(_0x5d351b){var _0x3037e5=typeof _0x3e0c9b[_0x1a67('0x19')]===_0x1a67('0x1a')&&typeof _0x3e0c9b['limit']===_0x1a67('0x1a');var _0x38ab78=_0x5d351b['count'];var _0x13cdae=_0x3037e5?0x0:_0x3e0c9b[_0x1a67('0x19')];var _0x3e67e0=_0x3037e5?_0x5d351b['count']:_0x3e0c9b[_0x1a67('0x19')]+_0x3e0c9b[_0x1a67('0x1b')];var _0x30b544;if(_0x3e67e0>=_0x38ab78){_0x3e67e0=_0x38ab78;_0x30b544=0xc8;}else{_0x30b544=0xce;}_0x3be788[_0x1a67('0x16')](_0x30b544);return _0x3be788[_0x1a67('0x1c')](_0x1a67('0x1d'),_0x13cdae+'-'+_0x3e67e0+'/'+_0x38ab78)['json'](_0x5d351b);}return null;};}function patchUpdates(_0x4ea557){return function(_0x49466e){try{jsonpatch[_0x1a67('0x1e')](_0x49466e,_0x4ea557,!![]);}catch(_0x5a57a6){return BPromise['reject'](_0x5a57a6);}return _0x49466e['save']();};}function saveUpdates(_0x19849b,_0x1eb4a4){return function(_0xc674e1){if(_0xc674e1){return _0xc674e1[_0x1a67('0x1f')](_0x19849b)[_0x1a67('0x20')](function(_0x83fe96){return _0x83fe96;});}return null;};}function removeEntity(_0x53bdad,_0xa4de24){return function(_0x3797a9){if(_0x3797a9){return _0x3797a9[_0x1a67('0x21')]()[_0x1a67('0x20')](function(){var _0x2abb47=_0x3797a9[_0x1a67('0x22')]({'plain':!![]});var _0x2eefe2=_0x1a67('0x23');return db[_0x1a67('0x24')][_0x1a67('0x21')]({'where':{'type':_0x2eefe2,'resourceId':_0x2abb47['id']}})['then'](function(){return _0x3797a9;});})['then'](function(){_0x53bdad[_0x1a67('0x16')](0xcc)[_0x1a67('0x17')]();});}};}function handleEntityNotFound(_0x1ddce8,_0x37e542){return function(_0x19dd85){if(!_0x19dd85){_0x1ddce8[_0x1a67('0x15')](0x194);}return _0x19dd85;};}function handleError(_0x3e85f3,_0x473516){_0x473516=_0x473516||0x1f4;return function(_0xa9d15c){logger[_0x1a67('0x25')](_0xa9d15c[_0x1a67('0x26')]);if(_0xa9d15c[_0x1a67('0x27')]){delete _0xa9d15c[_0x1a67('0x27')];}_0x3e85f3[_0x1a67('0x16')](_0x473516)['send'](_0xa9d15c);};}exports[_0x1a67('0x28')]=function(_0x5840f0,_0xd21c19){var _0x4524f0={},_0x33c43b={},_0x530a80={'count':0x0,'rows':[]};var _0x130b7a=_[_0x1a67('0x29')](db[_0x1a67('0x2a')][_0x1a67('0x2b')],function(_0x2c4d47){return{'name':_0x2c4d47[_0x1a67('0x2c')],'type':_0x2c4d47[_0x1a67('0x2d')][_0x1a67('0x2e')]};});_0x33c43b[_0x1a67('0x2f')]=_[_0x1a67('0x29')](_0x130b7a,'name');_0x33c43b[_0x1a67('0x30')]=_[_0x1a67('0x31')](_0x5840f0[_0x1a67('0x30')]);_0x33c43b[_0x1a67('0x32')]=_[_0x1a67('0x33')](_0x33c43b[_0x1a67('0x2f')],_0x33c43b[_0x1a67('0x30')]);_0x4524f0[_0x1a67('0x34')]=_[_0x1a67('0x33')](_0x33c43b[_0x1a67('0x2f')],qs[_0x1a67('0x35')](_0x5840f0[_0x1a67('0x30')][_0x1a67('0x35')]));_0x4524f0[_0x1a67('0x34')]=_0x4524f0[_0x1a67('0x34')][_0x1a67('0x36')]?_0x4524f0[_0x1a67('0x34')]:_0x33c43b['model'];if(!_0x5840f0[_0x1a67('0x30')][_0x1a67('0x37')](_0x1a67('0x38'))){_0x4524f0[_0x1a67('0x1b')]=qs['limit'](_0x5840f0['query'][_0x1a67('0x1b')]);_0x4524f0[_0x1a67('0x19')]=qs['offset'](_0x5840f0['query'][_0x1a67('0x19')]);}_0x4524f0[_0x1a67('0x39')]=qs[_0x1a67('0x3a')](_0x5840f0['query']['sort']);_0x4524f0[_0x1a67('0x3b')]=qs[_0x1a67('0x32')](_[_0x1a67('0x3c')](_0x5840f0[_0x1a67('0x30')],_0x33c43b[_0x1a67('0x32')]),_0x130b7a);if(_0x5840f0[_0x1a67('0x30')]['filter']){_0x4524f0[_0x1a67('0x3b')]=_['merge'](_0x4524f0['where'],{'$or':_[_0x1a67('0x29')](_0x130b7a,function(_0x376b4d){if(_0x376b4d['type']!==_0x1a67('0x3d')){var _0x4ce617={};_0x4ce617[_0x376b4d[_0x1a67('0x27')]]={'$like':'%'+_0x5840f0['query']['filter']+'%'};return _0x4ce617;}})});}_0x4524f0=_['merge']({},_0x4524f0,_0x5840f0[_0x1a67('0x3e')]);var _0x48f884={'where':_0x4524f0['where']};return db[_0x1a67('0x2a')][_0x1a67('0x3f')](_0x48f884)[_0x1a67('0x20')](function(_0x1b0da9){_0x530a80['count']=_0x1b0da9;if(_0x5840f0[_0x1a67('0x30')][_0x1a67('0x40')]){_0x4524f0[_0x1a67('0x41')]=[{'all':!![]}];}return db[_0x1a67('0x2a')][_0x1a67('0x42')](_0x4524f0);})[_0x1a67('0x20')](function(_0x1e1b1f){_0x530a80['rows']=_0x1e1b1f;return _0x530a80;})[_0x1a67('0x20')](respondWithFilteredResult(_0xd21c19,_0x4524f0))['catch'](handleError(_0xd21c19,null));};exports['show']=function(_0x21464e,_0x5ca54f){var _0x1ead6c={'raw':!![],'where':{'id':_0x21464e[_0x1a67('0x43')]['id']}},_0x5a36c3={};_0x5a36c3[_0x1a67('0x2f')]=_['keys'](db[_0x1a67('0x2a')][_0x1a67('0x2b')]);_0x5a36c3[_0x1a67('0x30')]=_[_0x1a67('0x31')](_0x21464e[_0x1a67('0x30')]);_0x5a36c3[_0x1a67('0x32')]=_[_0x1a67('0x33')](_0x5a36c3[_0x1a67('0x2f')],_0x5a36c3['query']);_0x1ead6c[_0x1a67('0x34')]=_[_0x1a67('0x33')](_0x5a36c3[_0x1a67('0x2f')],qs[_0x1a67('0x35')](_0x21464e[_0x1a67('0x30')][_0x1a67('0x35')]));_0x1ead6c[_0x1a67('0x34')]=_0x1ead6c[_0x1a67('0x34')][_0x1a67('0x36')]?_0x1ead6c['attributes']:_0x5a36c3[_0x1a67('0x2f')];if(_0x21464e[_0x1a67('0x30')][_0x1a67('0x40')]){_0x1ead6c['include']=[{'all':!![]}];}_0x1ead6c=_['merge']({},_0x1ead6c,_0x21464e[_0x1a67('0x3e')]);return db[_0x1a67('0x2a')][_0x1a67('0x44')](_0x1ead6c)[_0x1a67('0x20')](handleEntityNotFound(_0x5ca54f,null))[_0x1a67('0x20')](respondWithResult(_0x5ca54f,null))[_0x1a67('0x45')](handleError(_0x5ca54f,null));};exports['create']=function(_0xf3632e,_0x39265e){return db['AnalyticExtractedReport'][_0x1a67('0x46')](_0xf3632e['body'],{})[_0x1a67('0x20')](function(_0xe45aa6){var _0x230a8f=_0xf3632e[_0x1a67('0x47')][_0x1a67('0x22')]({'plain':!![]});if(!_0x230a8f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x230a8f[_0x1a67('0x48')]==='user'){var _0x7ed474=_0xe45aa6[_0x1a67('0x22')]({'plain':!![]});var _0x1c9390='ExtractedReports';return db[_0x1a67('0x49')][_0x1a67('0x44')]({'where':{'name':_0x1c9390,'userProfileId':_0x230a8f[_0x1a67('0x4a')]},'raw':!![]})[_0x1a67('0x20')](function(_0xc8cc3f){if(_0xc8cc3f&&_0xc8cc3f[_0x1a67('0x4b')]===0x0){return db[_0x1a67('0x24')][_0x1a67('0x46')]({'name':_0x7ed474[_0x1a67('0x27')],'resourceId':_0x7ed474['id'],'type':_0xc8cc3f['name'],'sectionId':_0xc8cc3f['id']},{})['then'](function(){return _0xe45aa6;});}else{return _0xe45aa6;}})[_0x1a67('0x45')](function(_0x21f9a4){logger[_0x1a67('0x25')](_0x1a67('0x4c'),_0x21f9a4);throw _0x21f9a4;});}return _0xe45aa6;})[_0x1a67('0x20')](respondWithResult(_0x39265e,0xc9))[_0x1a67('0x45')](handleError(_0x39265e,null));};exports[_0x1a67('0x1f')]=function(_0x356321,_0xdbe607){if(_0x356321[_0x1a67('0x4d')]['id']){delete _0x356321[_0x1a67('0x4d')]['id'];}return db[_0x1a67('0x2a')][_0x1a67('0x44')]({'where':{'id':_0x356321[_0x1a67('0x43')]['id']}})[_0x1a67('0x20')](handleEntityNotFound(_0xdbe607,null))[_0x1a67('0x20')](saveUpdates(_0x356321['body'],null))[_0x1a67('0x20')](respondWithResult(_0xdbe607,null))[_0x1a67('0x45')](handleError(_0xdbe607,null));};exports['destroy']=function(_0x588533,_0x638194){return db[_0x1a67('0x2a')]['find']({'where':{'id':_0x588533[_0x1a67('0x43')]['id']}})[_0x1a67('0x20')](handleEntityNotFound(_0x638194,null))['then'](removeEntity(_0x638194,null))['catch'](handleError(_0x638194,null));};exports[_0x1a67('0x4e')]=function(_0x41f1b1,_0x2561de,_0x277975){return db['AnalyticExtractedReport'][_0x1a67('0x44')]({'where':{'id':_0x41f1b1[_0x1a67('0x43')]['id']},'attributes':[_0x1a67('0x27'),_0x1a67('0x4f'),_0x1a67('0x50'),_0x1a67('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x2561de,null))['then'](function(_0x32e0e5){if(_0x32e0e5){if(!fs[_0x1a67('0x52')](path['join'](config[_0x1a67('0x53')],_0x1a67('0x54'),_0x32e0e5[_0x1a67('0x50')]))){throw new db[(_0x1a67('0x55'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x41f1b1[_0x1a67('0x30')][_0x1a67('0x56')]){return _0x2561de[_0x1a67('0x15')](0xc8);}return _0x2561de[_0x1a67('0x4e')](path[_0x1a67('0x57')](config['root'],'server/files/reports',_0x32e0e5[_0x1a67('0x50')]),util[_0x1a67('0x58')](_0x1a67('0x59'),_0x32e0e5['basename']||_0x32e0e5[_0x1a67('0x27')],_0x32e0e5[_0x1a67('0x51')]['toLowerCase']()));}})[_0x1a67('0x45')](handleError(_0x2561de,null));}; \ No newline at end of file +var _0xef92=['findAll','rows','params','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','download','basename','output','existsSync','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','savename','toLowerCase','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','ExtractedReports','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x1003eb,_0xc3c682){var _0x3e9558=function(_0x3106f6){while(--_0x3106f6){_0x1003eb['push'](_0x1003eb['shift']());}};_0x3e9558(++_0xc3c682);}(_0xef92,0xd2));var _0x2ef9=function(_0x51e011,_0x5abb6e){_0x51e011=_0x51e011-0x0;var _0x5d9aa3=_0xef92[_0x51e011];return _0x5d9aa3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ef9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ef9('0x1'));var rp=require(_0x2ef9('0x2'));var moment=require(_0x2ef9('0x3'));var BPromise=require(_0x2ef9('0x4'));var Mustache=require(_0x2ef9('0x5'));var util=require(_0x2ef9('0x6'));var path=require('path');var sox=require(_0x2ef9('0x7'));var csv=require(_0x2ef9('0x8'));var ejs=require(_0x2ef9('0x9'));var fs=require('fs');var fs_extra=require(_0x2ef9('0xa'));var _=require(_0x2ef9('0xb'));var squel=require('squel');var crypto=require(_0x2ef9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2ef9('0xd'));var toCsv=require(_0x2ef9('0x8'));var querystring=require(_0x2ef9('0xe'));var Papa=require(_0x2ef9('0xf'));var Redis=require(_0x2ef9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2ef9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ef9('0x12'))('api');var utils=require(_0x2ef9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2ef9('0x14'));var db=require(_0x2ef9('0x15'))['db'];function respondWithStatusCode(_0x485345,_0x42a219){_0x42a219=_0x42a219||0xcc;return function(_0x4a92c9){if(_0x4a92c9){return _0x485345['sendStatus'](_0x42a219);}return _0x485345[_0x2ef9('0x16')](_0x42a219)[_0x2ef9('0x17')]();};}function respondWithResult(_0x5a1f13,_0x3749dc){_0x3749dc=_0x3749dc||0xc8;return function(_0x2e11bd){if(_0x2e11bd){return _0x5a1f13[_0x2ef9('0x16')](_0x3749dc)[_0x2ef9('0x18')](_0x2e11bd);}};}function respondWithFilteredResult(_0x209fe8,_0x36a993){return function(_0x178d5c){if(_0x178d5c){var _0x53b75d=typeof _0x36a993[_0x2ef9('0x19')]==='undefined'&&typeof _0x36a993[_0x2ef9('0x1a')]==='undefined';var _0x5dbad0=_0x178d5c[_0x2ef9('0x1b')];var _0x2e9753=_0x53b75d?0x0:_0x36a993[_0x2ef9('0x19')];var _0x46f65f=_0x53b75d?_0x178d5c[_0x2ef9('0x1b')]:_0x36a993[_0x2ef9('0x19')]+_0x36a993['limit'];var _0x3b490e;if(_0x46f65f>=_0x5dbad0){_0x46f65f=_0x5dbad0;_0x3b490e=0xc8;}else{_0x3b490e=0xce;}_0x209fe8[_0x2ef9('0x16')](_0x3b490e);return _0x209fe8[_0x2ef9('0x1c')](_0x2ef9('0x1d'),_0x2e9753+'-'+_0x46f65f+'/'+_0x5dbad0)[_0x2ef9('0x18')](_0x178d5c);}return null;};}function patchUpdates(_0x4b4e98){return function(_0x468681){try{jsonpatch[_0x2ef9('0x1e')](_0x468681,_0x4b4e98,!![]);}catch(_0x282616){return BPromise[_0x2ef9('0x1f')](_0x282616);}return _0x468681[_0x2ef9('0x20')]();};}function saveUpdates(_0x5dc294,_0x30273f){return function(_0x567be4){if(_0x567be4){return _0x567be4[_0x2ef9('0x21')](_0x5dc294)['then'](function(_0x2f3d59){return _0x2f3d59;});}return null;};}function removeEntity(_0x456723,_0xd14f89){return function(_0x1486d3){if(_0x1486d3){return _0x1486d3[_0x2ef9('0x22')]()[_0x2ef9('0x23')](function(){var _0xa1e93c=_0x1486d3['get']({'plain':!![]});var _0x20b3bc=_0x2ef9('0x24');return db['UserProfileResource'][_0x2ef9('0x22')]({'where':{'type':_0x20b3bc,'resourceId':_0xa1e93c['id']}})[_0x2ef9('0x23')](function(){return _0x1486d3;});})['then'](function(){_0x456723['status'](0xcc)[_0x2ef9('0x17')]();});}};}function handleEntityNotFound(_0x401e1b,_0x17381a){return function(_0x3fab4a){if(!_0x3fab4a){_0x401e1b['sendStatus'](0x194);}return _0x3fab4a;};}function handleError(_0x3e45e7,_0x219133){_0x219133=_0x219133||0x1f4;return function(_0x2f3f5f){logger['error'](_0x2f3f5f[_0x2ef9('0x25')]);if(_0x2f3f5f[_0x2ef9('0x26')]){delete _0x2f3f5f[_0x2ef9('0x26')];}_0x3e45e7['status'](_0x219133)[_0x2ef9('0x27')](_0x2f3f5f);};}exports['index']=function(_0x14a90f,_0x12f564){var _0x595c83={},_0x1cd045={},_0x1e5bdc={'count':0x0,'rows':[]};var _0x211231=_[_0x2ef9('0x28')](db[_0x2ef9('0x29')][_0x2ef9('0x2a')],function(_0x16a59b){return{'name':_0x16a59b[_0x2ef9('0x2b')],'type':_0x16a59b[_0x2ef9('0x2c')][_0x2ef9('0x2d')]};});_0x1cd045[_0x2ef9('0x2e')]=_[_0x2ef9('0x28')](_0x211231,_0x2ef9('0x26'));_0x1cd045[_0x2ef9('0x2f')]=_[_0x2ef9('0x30')](_0x14a90f[_0x2ef9('0x2f')]);_0x1cd045[_0x2ef9('0x31')]=_['intersection'](_0x1cd045[_0x2ef9('0x2e')],_0x1cd045[_0x2ef9('0x2f')]);_0x595c83[_0x2ef9('0x32')]=_[_0x2ef9('0x33')](_0x1cd045['model'],qs[_0x2ef9('0x34')](_0x14a90f[_0x2ef9('0x2f')][_0x2ef9('0x34')]));_0x595c83['attributes']=_0x595c83[_0x2ef9('0x32')]['length']?_0x595c83[_0x2ef9('0x32')]:_0x1cd045['model'];if(!_0x14a90f[_0x2ef9('0x2f')][_0x2ef9('0x35')]('nolimit')){_0x595c83['limit']=qs[_0x2ef9('0x1a')](_0x14a90f[_0x2ef9('0x2f')][_0x2ef9('0x1a')]);_0x595c83[_0x2ef9('0x19')]=qs[_0x2ef9('0x19')](_0x14a90f[_0x2ef9('0x2f')]['offset']);}_0x595c83[_0x2ef9('0x36')]=qs[_0x2ef9('0x37')](_0x14a90f['query'][_0x2ef9('0x37')]);_0x595c83['where']=qs[_0x2ef9('0x31')](_[_0x2ef9('0x38')](_0x14a90f[_0x2ef9('0x2f')],_0x1cd045[_0x2ef9('0x31')]),_0x211231);if(_0x14a90f[_0x2ef9('0x2f')][_0x2ef9('0x39')]){_0x595c83[_0x2ef9('0x3a')]=_[_0x2ef9('0x3b')](_0x595c83[_0x2ef9('0x3a')],{'$or':_[_0x2ef9('0x28')](_0x211231,function(_0x2edcc7){if(_0x2edcc7['type']!==_0x2ef9('0x3c')){var _0xf32893={};_0xf32893[_0x2edcc7[_0x2ef9('0x26')]]={'$like':'%'+_0x14a90f['query'][_0x2ef9('0x39')]+'%'};return _0xf32893;}})});}_0x595c83=_[_0x2ef9('0x3b')]({},_0x595c83,_0x14a90f[_0x2ef9('0x3d')]);var _0x5ab483={'where':_0x595c83['where']};return db[_0x2ef9('0x29')]['count'](_0x5ab483)['then'](function(_0x325670){_0x1e5bdc[_0x2ef9('0x1b')]=_0x325670;if(_0x14a90f[_0x2ef9('0x2f')][_0x2ef9('0x3e')]){_0x595c83['include']=[{'all':!![]}];}return db[_0x2ef9('0x29')][_0x2ef9('0x3f')](_0x595c83);})[_0x2ef9('0x23')](function(_0x3038cf){_0x1e5bdc[_0x2ef9('0x40')]=_0x3038cf;return _0x1e5bdc;})[_0x2ef9('0x23')](respondWithFilteredResult(_0x12f564,_0x595c83))['catch'](handleError(_0x12f564,null));};exports['show']=function(_0xd230fb,_0x3619b6){var _0xd0fab4={'raw':!![],'where':{'id':_0xd230fb[_0x2ef9('0x41')]['id']}},_0x2b27ed={};_0x2b27ed[_0x2ef9('0x2e')]=_['keys'](db[_0x2ef9('0x29')][_0x2ef9('0x2a')]);_0x2b27ed[_0x2ef9('0x2f')]=_[_0x2ef9('0x30')](_0xd230fb[_0x2ef9('0x2f')]);_0x2b27ed[_0x2ef9('0x31')]=_[_0x2ef9('0x33')](_0x2b27ed['model'],_0x2b27ed[_0x2ef9('0x2f')]);_0xd0fab4[_0x2ef9('0x32')]=_[_0x2ef9('0x33')](_0x2b27ed[_0x2ef9('0x2e')],qs['fields'](_0xd230fb[_0x2ef9('0x2f')][_0x2ef9('0x34')]));_0xd0fab4['attributes']=_0xd0fab4['attributes']['length']?_0xd0fab4[_0x2ef9('0x32')]:_0x2b27ed[_0x2ef9('0x2e')];if(_0xd230fb[_0x2ef9('0x2f')][_0x2ef9('0x3e')]){_0xd0fab4['include']=[{'all':!![]}];}_0xd0fab4=_['merge']({},_0xd0fab4,_0xd230fb[_0x2ef9('0x3d')]);return db[_0x2ef9('0x29')]['find'](_0xd0fab4)[_0x2ef9('0x23')](handleEntityNotFound(_0x3619b6,null))[_0x2ef9('0x23')](respondWithResult(_0x3619b6,null))[_0x2ef9('0x42')](handleError(_0x3619b6,null));};exports[_0x2ef9('0x43')]=function(_0x4b6e54,_0x1fe876){return db['AnalyticExtractedReport']['create'](_0x4b6e54[_0x2ef9('0x44')],{})[_0x2ef9('0x23')](function(_0x3be167){var _0x2bd6ee=_0x4b6e54[_0x2ef9('0x45')][_0x2ef9('0x46')]({'plain':!![]});if(!_0x2bd6ee)throw new Error(_0x2ef9('0x47'));if(_0x2bd6ee[_0x2ef9('0x48')]===_0x2ef9('0x45')){var _0x3a6abc=_0x3be167[_0x2ef9('0x46')]({'plain':!![]});var _0x1fbc3d=_0x2ef9('0x24');return db[_0x2ef9('0x49')][_0x2ef9('0x4a')]({'where':{'name':_0x1fbc3d,'userProfileId':_0x2bd6ee[_0x2ef9('0x4b')]},'raw':!![]})[_0x2ef9('0x23')](function(_0x33e6ff){if(_0x33e6ff&&_0x33e6ff[_0x2ef9('0x4c')]===0x0){return db[_0x2ef9('0x4d')][_0x2ef9('0x43')]({'name':_0x3a6abc[_0x2ef9('0x26')],'resourceId':_0x3a6abc['id'],'type':_0x33e6ff[_0x2ef9('0x26')],'sectionId':_0x33e6ff['id']},{})[_0x2ef9('0x23')](function(){return _0x3be167;});}else{return _0x3be167;}})[_0x2ef9('0x42')](function(_0x307a5a){logger[_0x2ef9('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x307a5a);throw _0x307a5a;});}return _0x3be167;})[_0x2ef9('0x23')](respondWithResult(_0x1fe876,0xc9))['catch'](handleError(_0x1fe876,null));};exports[_0x2ef9('0x21')]=function(_0x4ccf13,_0x1936df){if(_0x4ccf13[_0x2ef9('0x44')]['id']){delete _0x4ccf13[_0x2ef9('0x44')]['id'];}return db[_0x2ef9('0x29')]['find']({'where':{'id':_0x4ccf13[_0x2ef9('0x41')]['id']}})[_0x2ef9('0x23')](handleEntityNotFound(_0x1936df,null))['then'](saveUpdates(_0x4ccf13[_0x2ef9('0x44')],null))['then'](respondWithResult(_0x1936df,null))['catch'](handleError(_0x1936df,null));};exports[_0x2ef9('0x22')]=function(_0x147057,_0x1c4701){return db[_0x2ef9('0x29')]['find']({'where':{'id':_0x147057[_0x2ef9('0x41')]['id']}})[_0x2ef9('0x23')](handleEntityNotFound(_0x1c4701,null))['then'](removeEntity(_0x1c4701,null))[_0x2ef9('0x42')](handleError(_0x1c4701,null));};exports[_0x2ef9('0x4f')]=function(_0x45a0b0,_0x5eea7b,_0x53a0c9){return db[_0x2ef9('0x29')][_0x2ef9('0x4a')]({'where':{'id':_0x45a0b0['params']['id']},'attributes':[_0x2ef9('0x26'),_0x2ef9('0x50'),'savename',_0x2ef9('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x5eea7b,null))[_0x2ef9('0x23')](function(_0x5cda6a){if(_0x5cda6a){if(!fs[_0x2ef9('0x52')](path['join'](config[_0x2ef9('0x53')],'server/files/reports',_0x5cda6a['savename']))){throw new db[(_0x2ef9('0x54'))][(_0x2ef9('0x55'))](_0x2ef9('0x56'));}if(_0x45a0b0[_0x2ef9('0x2f')][_0x2ef9('0x57')]){return _0x5eea7b[_0x2ef9('0x58')](0xc8);}return _0x5eea7b[_0x2ef9('0x4f')](path['join'](config['root'],'server/files/reports',_0x5cda6a[_0x2ef9('0x59')]),util['format']('%s.%s',_0x5cda6a[_0x2ef9('0x50')]||_0x5cda6a[_0x2ef9('0x26')],_0x5cda6a[_0x2ef9('0x51')][_0x2ef9('0x5a')]()));}})[_0x2ef9('0x42')](handleError(_0x5eea7b,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 89fb1b5..5a70657 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 _0xac9c=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','../../config/logger','api','bluebird'];(function(_0x4fa92f,_0x7b9d35){var _0x41b510=function(_0x111922){while(--_0x111922){_0x4fa92f['push'](_0x4fa92f['shift']());}};_0x41b510(++_0x7b9d35);}(_0xac9c,0x15c));var _0xcac9=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xac9c[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0xcac9('0x0'));var util=require('util');var logger=require(_0xcac9('0x1'))(_0xcac9('0x2'));var moment=require('moment');var BPromise=require(_0xcac9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcac9('0x4'));var rimraf=require(_0xcac9('0x5'));var config=require(_0xcac9('0x6'));var attributes=require(_0xcac9('0x7'));module[_0xcac9('0x8')]=function(_0x121d51,_0x1d78ee){return _0x121d51[_0xcac9('0x9')](_0xcac9('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf9c=['../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xcf9c,0x14a));var _0xccf9=function(_0x356f8d,_0x1b3deb){_0x356f8d=_0x356f8d-0x0;var _0x1be58e=_0xcf9c[_0x356f8d];return _0x1be58e;};'use strict';var _=require(_0xccf9('0x0'));var util=require(_0xccf9('0x1'));var logger=require(_0xccf9('0x2'))(_0xccf9('0x3'));var moment=require(_0xccf9('0x4'));var BPromise=require(_0xccf9('0x5'));var rp=require(_0xccf9('0x6'));var fs=require('fs');var path=require(_0xccf9('0x7'));var rimraf=require('rimraf');var config=require(_0xccf9('0x8'));var attributes=require(_0xccf9('0x9'));module['exports']=function(_0x178f90,_0x38e6a8){return _0x178f90[_0xccf9('0xa')](_0xccf9('0xb'),attributes,{'tableName':_0xccf9('0xc'),'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 9530013..8188edf 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 _0x65d3=['debug','stringify','error','message','result','catch','lodash','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3f8ba2,_0x30a892){var _0x7ce28b=function(_0x28f45d){while(--_0x28f45d){_0x3f8ba2['push'](_0x3f8ba2['shift']());}};_0x7ce28b(++_0x30a892);}(_0x65d3,0x1f4));var _0x365d=function(_0x383602,_0x46fb90){_0x383602=_0x383602-0x0;var _0x5bfe65=_0x65d3[_0x383602];return _0x5bfe65;};'use strict';var _=require(_0x365d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x365d('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x365d('0x2'));var logger=require(_0x365d('0x3'))(_0x365d('0x4'));var config=require(_0x365d('0x5'));var jayson=require(_0x365d('0x6'));var client=jayson[_0x365d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe035,_0x215a68,_0x2ca1ec){return new BPromise(function(_0x4f4189,_0x2d0201){return client[_0x365d('0x8')](_0x4fe035,_0x2ca1ec)[_0x365d('0x9')](function(_0x20519f){logger[_0x365d('0xa')](_0x365d('0xb'),_0x215a68,_0x365d('0xc'));logger[_0x365d('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x215a68,'request\x20sent',JSON[_0x365d('0xe')](_0x20519f));if(_0x20519f[_0x365d('0xf')]){if(_0x20519f['error']['code']===0x1f4){logger[_0x365d('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x215a68,_0x20519f[_0x365d('0xf')][_0x365d('0x10')]);return _0x2d0201(_0x20519f['error'][_0x365d('0x10')]);}logger[_0x365d('0xf')](_0x365d('0xb'),_0x215a68,_0x20519f[_0x365d('0xf')][_0x365d('0x10')]);return _0x4f4189(_0x20519f['error']['message']);}else{logger[_0x365d('0xa')](_0x365d('0xb'),_0x215a68,_0x365d('0xc'));_0x4f4189(_0x20519f[_0x365d('0x11')][_0x365d('0x10')]);}})[_0x365d('0x12')](function(_0x387b73){logger[_0x365d('0xf')](_0x365d('0xb'),_0x215a68,_0x387b73);_0x2d0201(_0x387b73);});});} \ No newline at end of file +var _0xb697=['message','result','catch','lodash','util','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x254a7c,_0x56c40d){var _0x4a5a58=function(_0x2dc7ae){while(--_0x2dc7ae){_0x254a7c['push'](_0x254a7c['shift']());}};_0x4a5a58(++_0x56c40d);}(_0xb697,0xcb));var _0x7b69=function(_0xe0a503,_0x144de7){_0xe0a503=_0xe0a503-0x0;var _0x325432=_0xb697[_0xe0a503];return _0x325432;};'use strict';var _=require(_0x7b69('0x0'));var util=require(_0x7b69('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7b69('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7b69('0x3'))(_0x7b69('0x4'));var config=require(_0x7b69('0x5'));var jayson=require(_0x7b69('0x6'));var client=jayson[_0x7b69('0x7')][_0x7b69('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6364a5,_0x2c530b,_0xd7615b){return new BPromise(function(_0xb17e9f,_0x380e7e){return client[_0x7b69('0x9')](_0x6364a5,_0xd7615b)[_0x7b69('0xa')](function(_0x517f53){logger[_0x7b69('0xb')](_0x7b69('0xc'),_0x2c530b,_0x7b69('0xd'));logger[_0x7b69('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2c530b,'request\x20sent',JSON[_0x7b69('0xf')](_0x517f53));if(_0x517f53['error']){if(_0x517f53[_0x7b69('0x10')]['code']===0x1f4){logger[_0x7b69('0x10')](_0x7b69('0xc'),_0x2c530b,_0x517f53['error'][_0x7b69('0x11')]);return _0x380e7e(_0x517f53[_0x7b69('0x10')][_0x7b69('0x11')]);}logger[_0x7b69('0x10')](_0x7b69('0xc'),_0x2c530b,_0x517f53[_0x7b69('0x10')][_0x7b69('0x11')]);return _0xb17e9f(_0x517f53[_0x7b69('0x10')]['message']);}else{logger[_0x7b69('0xb')](_0x7b69('0xc'),_0x2c530b,_0x7b69('0xd'));_0xb17e9f(_0x517f53[_0x7b69('0x12')][_0x7b69('0x11')]);}})[_0x7b69('0x13')](function(_0x2f3885){logger['error'](_0x7b69('0xc'),_0x2c530b,_0x2f3885);_0x380e7e(_0x2f3885);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 78055ff..9a95572 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 _0x0277=['create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','get','/:id','show','/:id/download','download','post'];(function(_0x3a7ab8,_0x35dbf3){var _0x2734fa=function(_0x14b78e){while(--_0x14b78e){_0x3a7ab8['push'](_0x3a7ab8['shift']());}};_0x2734fa(++_0x35dbf3);}(_0x0277,0x10c));var _0x7027=function(_0x2b1047,_0x2e58fd){_0x2b1047=_0x2b1047-0x0;var _0x23bad3=_0x0277[_0x2b1047];return _0x23bad3;};'use strict';var multer=require(_0x7027('0x0'));var util=require(_0x7027('0x1'));var path=require(_0x7027('0x2'));var timeout=require(_0x7027('0x3'));var express=require(_0x7027('0x4'));var router=express[_0x7027('0x5')]();var fs_extra=require(_0x7027('0x6'));var auth=require(_0x7027('0x7'));var interaction=require(_0x7027('0x8'));var config=require(_0x7027('0x9'));var controller=require(_0x7027('0xa'));router['get']('/',auth[_0x7027('0xb')](),controller['index']);router[_0x7027('0xc')](_0x7027('0xd'),auth[_0x7027('0xb')](),controller[_0x7027('0xe')]);router[_0x7027('0xc')](_0x7027('0xf'),auth[_0x7027('0xb')](),controller[_0x7027('0x10')]);router[_0x7027('0x11')]('/',auth[_0x7027('0xb')](),controller[_0x7027('0x12')]);router[_0x7027('0x13')](_0x7027('0xd'),auth['isAuthenticated'](),controller[_0x7027('0x14')]);router[_0x7027('0x15')]('/:id',auth[_0x7027('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x739e=['/:id/download','download','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x739e,0x77));var _0xe739=function(_0x1b2758,_0x11d50b){_0x1b2758=_0x1b2758-0x0;var _0x10811c=_0x739e[_0x1b2758];return _0x10811c;};'use strict';var multer=require(_0xe739('0x0'));var util=require(_0xe739('0x1'));var path=require(_0xe739('0x2'));var timeout=require(_0xe739('0x3'));var express=require(_0xe739('0x4'));var router=express[_0xe739('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe739('0x6'));var interaction=require(_0xe739('0x7'));var config=require(_0xe739('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0xe739('0x9')]('/',auth['isAuthenticated'](),controller[_0xe739('0xa')]);router[_0xe739('0x9')]('/:id',auth[_0xe739('0xb')](),controller[_0xe739('0xc')]);router[_0xe739('0x9')](_0xe739('0xd'),auth[_0xe739('0xb')](),controller[_0xe739('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe739('0xf')]);router[_0xe739('0x10')](_0xe739('0x11'),auth[_0xe739('0xb')](),controller[_0xe739('0x12')]);router[_0xe739('0x13')]('/:id',auth[_0xe739('0xb')](),controller[_0xe739('0x14')]);module[_0xe739('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 673265d..58d0026 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 _0x78c5=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2a6f85,_0x9dce9a){var _0x4912e7=function(_0x4c839d){while(--_0x4c839d){_0x2a6f85['push'](_0x2a6f85['shift']());}};_0x4912e7(++_0x9dce9a);}(_0x78c5,0xf5));var _0x578c=function(_0x810a78,_0x1e3706){_0x810a78=_0x810a78-0x0;var _0x24a295=_0x78c5[_0x810a78];return _0x24a295;};'use strict';var Sequelize=require(_0x578c('0x0'));module[_0x578c('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x578c('0x2')]},'function':{'type':Sequelize[_0x578c('0x2')]},'format':{'type':Sequelize[_0x578c('0x2')]},'groupBy':{'type':Sequelize[_0x578c('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x578c('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6066=['BOOLEAN','TEXT','STRING'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0x6066,0x151));var _0x6606=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0x6066[_0x2fe689];return _0x35ea44;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0x6606('0x0')]},'alias':{'type':Sequelize[_0x6606('0x1')]},'function':{'type':Sequelize[_0x6606('0x1')]},'format':{'type':Sequelize[_0x6606('0x1')]},'groupBy':{'type':Sequelize[_0x6606('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6606('0x1')]},'custom':{'type':Sequelize[_0x6606('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 584381c..93a2506 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 _0xf286=['to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','destroy','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','then','rows','show','intersection','include','options','find','catch','create','body','bulkCreate','update','params','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox'];(function(_0x27f5f6,_0x5f2eca){var _0x264718=function(_0xe37f55){while(--_0xe37f55){_0x27f5f6['push'](_0x27f5f6['shift']());}};_0x264718(++_0x5f2eca);}(_0xf286,0xe8));var _0x6f28=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0xf286[_0x22868f];return _0x97bc75;};'use strict';var emlformat=require(_0x6f28('0x0'));var rimraf=require(_0x6f28('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f28('0x2'));var rp=require(_0x6f28('0x3'));var moment=require('moment');var BPromise=require(_0x6f28('0x4'));var Mustache=require(_0x6f28('0x5'));var util=require(_0x6f28('0x6'));var path=require('path');var sox=require(_0x6f28('0x7'));var csv=require(_0x6f28('0x8'));var ejs=require(_0x6f28('0x9'));var fs=require('fs');var fs_extra=require(_0x6f28('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6f28('0xb'));var deskjs=require(_0x6f28('0xc'));var toCsv=require(_0x6f28('0x8'));var querystring=require(_0x6f28('0xd'));var Papa=require(_0x6f28('0xe'));var Redis=require(_0x6f28('0xf'));var authService=require(_0x6f28('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6f28('0x11'));var hardwareService=require(_0x6f28('0x12'));var logger=require(_0x6f28('0x13'))('api');var utils=require(_0x6f28('0x14'));var config=require(_0x6f28('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f28('0x16'))['db'];function respondWithStatusCode(_0x5a93e3,_0x1251c3){_0x1251c3=_0x1251c3||0xcc;return function(_0xdc0802){if(_0xdc0802){return _0x5a93e3[_0x6f28('0x17')](_0x1251c3);}return _0x5a93e3[_0x6f28('0x18')](_0x1251c3)[_0x6f28('0x19')]();};}function respondWithResult(_0x4d06cd,_0x36d42a){_0x36d42a=_0x36d42a||0xc8;return function(_0x2f8522){if(_0x2f8522){return _0x4d06cd[_0x6f28('0x18')](_0x36d42a)[_0x6f28('0x1a')](_0x2f8522);}};}function respondWithFilteredResult(_0x1a3d77,_0xaf214b){return function(_0x2da3ae){if(_0x2da3ae){var _0x549e4c=typeof _0xaf214b[_0x6f28('0x1b')]==='undefined'&&typeof _0xaf214b[_0x6f28('0x1c')]===_0x6f28('0x1d');var _0x411c50=_0x2da3ae[_0x6f28('0x1e')];var _0x441c66=_0x549e4c?0x0:_0xaf214b[_0x6f28('0x1b')];var _0x2ffa61=_0x549e4c?_0x2da3ae['count']:_0xaf214b[_0x6f28('0x1b')]+_0xaf214b[_0x6f28('0x1c')];var _0x17c469;if(_0x2ffa61>=_0x411c50){_0x2ffa61=_0x411c50;_0x17c469=0xc8;}else{_0x17c469=0xce;}_0x1a3d77['status'](_0x17c469);return _0x1a3d77['set']('Content-Range',_0x441c66+'-'+_0x2ffa61+'/'+_0x411c50)['json'](_0x2da3ae);}return null;};}function patchUpdates(_0x24580a){return function(_0x1ed863){try{jsonpatch['apply'](_0x1ed863,_0x24580a,!![]);}catch(_0x3f519c){return BPromise[_0x6f28('0x1f')](_0x3f519c);}return _0x1ed863[_0x6f28('0x20')]();};}function saveUpdates(_0x3754a1,_0xdda7c0){return function(_0x295632){if(_0x295632){return _0x295632['update'](_0x3754a1)['then'](function(_0xe20e02){return _0xe20e02;});}return null;};}function removeEntity(_0x38bd24,_0x2bd216){return function(_0x1f0a76){if(_0x1f0a76){return _0x1f0a76[_0x6f28('0x21')]()['then'](function(){_0x38bd24[_0x6f28('0x18')](0xcc)[_0x6f28('0x19')]();});}};}function handleEntityNotFound(_0x5604dc,_0xbdfd34){return function(_0xe9f423){if(!_0xe9f423){_0x5604dc[_0x6f28('0x17')](0x194);}return _0xe9f423;};}function handleError(_0x461b8b,_0x53d512){_0x53d512=_0x53d512||0x1f4;return function(_0x353a0b){logger[_0x6f28('0x22')](_0x353a0b['stack']);if(_0x353a0b['name']){delete _0x353a0b[_0x6f28('0x23')];}_0x461b8b[_0x6f28('0x18')](_0x53d512)[_0x6f28('0x24')](_0x353a0b);};}exports[_0x6f28('0x25')]=function(_0x2bf488,_0x64ad79){var _0x279969={},_0x4d3111={},_0x1db946={'count':0x0,'rows':[]};var _0x35da57=_[_0x6f28('0x26')](db[_0x6f28('0x27')][_0x6f28('0x28')],function(_0x45402c){return{'name':_0x45402c[_0x6f28('0x29')],'type':_0x45402c[_0x6f28('0x2a')][_0x6f28('0x2b')]};});_0x4d3111[_0x6f28('0x2c')]=_[_0x6f28('0x26')](_0x35da57,_0x6f28('0x23'));_0x4d3111[_0x6f28('0x2d')]=_[_0x6f28('0x2e')](_0x2bf488[_0x6f28('0x2d')]);_0x4d3111[_0x6f28('0x2f')]=_['intersection'](_0x4d3111[_0x6f28('0x2c')],_0x4d3111[_0x6f28('0x2d')]);_0x279969[_0x6f28('0x30')]=_['intersection'](_0x4d3111[_0x6f28('0x2c')],qs[_0x6f28('0x31')](_0x2bf488[_0x6f28('0x2d')][_0x6f28('0x31')]));_0x279969[_0x6f28('0x30')]=_0x279969['attributes'][_0x6f28('0x32')]?_0x279969[_0x6f28('0x30')]:_0x4d3111[_0x6f28('0x2c')];if(!_0x2bf488['query']['hasOwnProperty'](_0x6f28('0x33'))){_0x279969[_0x6f28('0x1c')]=qs[_0x6f28('0x1c')](_0x2bf488[_0x6f28('0x2d')][_0x6f28('0x1c')]);_0x279969[_0x6f28('0x1b')]=qs[_0x6f28('0x1b')](_0x2bf488[_0x6f28('0x2d')][_0x6f28('0x1b')]);}_0x279969[_0x6f28('0x34')]=qs[_0x6f28('0x35')](_0x2bf488[_0x6f28('0x2d')][_0x6f28('0x35')]);_0x279969[_0x6f28('0x36')]=qs[_0x6f28('0x2f')](_['pick'](_0x2bf488['query'],_0x4d3111['filters']),_0x35da57);if(_0x2bf488['query'][_0x6f28('0x37')]){_0x279969[_0x6f28('0x36')]=_[_0x6f28('0x38')](_0x279969[_0x6f28('0x36')],{'$or':_[_0x6f28('0x26')](_0x35da57,function(_0x3070ae){if(_0x3070ae[_0x6f28('0x2a')]!==_0x6f28('0x39')){var _0x4775d7={};_0x4775d7[_0x3070ae[_0x6f28('0x23')]]={'$like':'%'+_0x2bf488[_0x6f28('0x2d')][_0x6f28('0x37')]+'%'};return _0x4775d7;}})});}_0x279969=_[_0x6f28('0x38')]({},_0x279969,_0x2bf488['options']);var _0x5a84f5={'where':_0x279969['where']};return db[_0x6f28('0x27')]['count'](_0x5a84f5)['then'](function(_0xad259d){_0x1db946[_0x6f28('0x1e')]=_0xad259d;if(_0x2bf488[_0x6f28('0x2d')][_0x6f28('0x3a')]){_0x279969['include']=[{'all':!![]}];}return db[_0x6f28('0x27')][_0x6f28('0x3b')](_0x279969);})[_0x6f28('0x3c')](function(_0x4fc547){_0x1db946[_0x6f28('0x3d')]=_0x4fc547;return _0x1db946;})[_0x6f28('0x3c')](respondWithFilteredResult(_0x64ad79,_0x279969))['catch'](handleError(_0x64ad79,null));};exports[_0x6f28('0x3e')]=function(_0x4aa381,_0x4b26fa){var _0x12e614={'raw':![],'where':{'id':_0x4aa381['params']['id']}},_0x1aba46={};_0x1aba46[_0x6f28('0x2c')]=_['keys'](db['AnalyticFieldReport']['rawAttributes']);_0x1aba46[_0x6f28('0x2d')]=_[_0x6f28('0x2e')](_0x4aa381[_0x6f28('0x2d')]);_0x1aba46[_0x6f28('0x2f')]=_[_0x6f28('0x3f')](_0x1aba46[_0x6f28('0x2c')],_0x1aba46['query']);_0x12e614['attributes']=_[_0x6f28('0x3f')](_0x1aba46[_0x6f28('0x2c')],qs[_0x6f28('0x31')](_0x4aa381[_0x6f28('0x2d')][_0x6f28('0x31')]));_0x12e614['attributes']=_0x12e614[_0x6f28('0x30')][_0x6f28('0x32')]?_0x12e614[_0x6f28('0x30')]:_0x1aba46[_0x6f28('0x2c')];if(_0x4aa381['query'][_0x6f28('0x3a')]){_0x12e614[_0x6f28('0x40')]=[{'all':!![]}];}_0x12e614=_[_0x6f28('0x38')]({},_0x12e614,_0x4aa381[_0x6f28('0x41')]);return db[_0x6f28('0x27')][_0x6f28('0x42')](_0x12e614)[_0x6f28('0x3c')](handleEntityNotFound(_0x4b26fa,null))['then'](respondWithResult(_0x4b26fa,null))[_0x6f28('0x43')](handleError(_0x4b26fa,null));};exports[_0x6f28('0x44')]=function(_0x49e54e,_0x3994c1){return db['AnalyticFieldReport'][_0x6f28('0x44')](_0x49e54e[_0x6f28('0x45')],{})[_0x6f28('0x3c')](respondWithResult(_0x3994c1,0xc9))['catch'](handleError(_0x3994c1,null));};exports[_0x6f28('0x46')]=function(_0x59276c,_0x3bffaf){return db[_0x6f28('0x27')][_0x6f28('0x46')](_0x59276c[_0x6f28('0x45')],{'raw':![],'individualHooks':!![]})[_0x6f28('0x3c')](respondWithResult(_0x3bffaf,0xc9))[_0x6f28('0x43')](handleError(_0x3bffaf,null));};exports[_0x6f28('0x47')]=function(_0x42087f,_0x589437){if(_0x42087f[_0x6f28('0x45')]['id']){delete _0x42087f['body']['id'];}return db['AnalyticFieldReport'][_0x6f28('0x42')]({'where':{'id':_0x42087f[_0x6f28('0x48')]['id']}})[_0x6f28('0x3c')](handleEntityNotFound(_0x589437,null))[_0x6f28('0x3c')](saveUpdates(_0x42087f[_0x6f28('0x45')],null))[_0x6f28('0x3c')](respondWithResult(_0x589437,null))[_0x6f28('0x43')](handleError(_0x589437,null));};exports['destroy']=function(_0x400f94,_0x336401){return db[_0x6f28('0x27')][_0x6f28('0x42')]({'where':{'id':_0x400f94[_0x6f28('0x48')]['id']}})[_0x6f28('0x3c')](handleEntityNotFound(_0x336401,null))[_0x6f28('0x3c')](removeEntity(_0x336401,null))[_0x6f28('0x43')](handleError(_0x336401,null));};exports['bulkDestroy']=function(_0x2c0fec,_0xd37015){return db[_0x6f28('0x27')][_0x6f28('0x21')]({'where':{'id':_0x2c0fec[_0x6f28('0x2d')][_0x6f28('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0x6f28('0x3c')](respondWithResult(_0xd37015,0xcc))[_0x6f28('0x43')](handleError(_0xd37015,null));};exports[_0x6f28('0x4a')]=function(_0x572f9e,_0x5c8d14,_0x2b1970){return db[_0x6f28('0x4b')][_0x6f28('0x4c')]({'where':{'id':_0x572f9e[_0x6f28('0x48')]['id']}})[_0x6f28('0x3c')](handleEntityNotFound(_0x5c8d14,null))[_0x6f28('0x3c')](function(_0x3f022f){if(_0x3f022f){return db[_0x6f28('0x4d')][_0x6f28('0x4e')](function(_0x41bbf9){return db[_0x6f28('0x27')][_0x6f28('0x21')]({'where':{'CustomReportId':_0x572f9e[_0x6f28('0x48')]['id']},'transaction':_0x41bbf9})[_0x6f28('0x3c')](function(_0x4be4ed){var _0x599e5e=_[_0x6f28('0x26')](_0x572f9e[_0x6f28('0x45')],function(_0xbf8f2d){delete _0xbf8f2d['id'];_0xbf8f2d[_0x6f28('0x4f')]=_0x572f9e[_0x6f28('0x48')]['id'];return _0xbf8f2d;});return db[_0x6f28('0x27')][_0x6f28('0x46')](_0x599e5e,{'transaction':_0x41bbf9});});})[_0x6f28('0x3c')](function(){return db['AnalyticFieldReport'][_0x6f28('0x3b')]({'where':{'CustomReportId':_0x572f9e[_0x6f28('0x48')]['id']}});});}})['then'](respondWithResult(_0x5c8d14,null))['catch'](handleError(_0x5c8d14,null));}; \ No newline at end of file +var _0x7de5=['include','findAll','rows','catch','show','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','findOne','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7de5,0xad));var _0x57de=function(_0xdc43a4,_0x36fdd0){_0xdc43a4=_0xdc43a4-0x0;var _0x4cc4d3=_0x7de5[_0xdc43a4];return _0x4cc4d3;};'use strict';var emlformat=require(_0x57de('0x0'));var rimraf=require(_0x57de('0x1'));var zipdir=require(_0x57de('0x2'));var jsonpatch=require(_0x57de('0x3'));var rp=require(_0x57de('0x4'));var moment=require(_0x57de('0x5'));var BPromise=require(_0x57de('0x6'));var Mustache=require('mustache');var util=require(_0x57de('0x7'));var path=require(_0x57de('0x8'));var sox=require(_0x57de('0x9'));var csv=require('to-csv');var ejs=require(_0x57de('0xa'));var fs=require('fs');var fs_extra=require(_0x57de('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x57de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x57de('0xd'));var querystring=require(_0x57de('0xe'));var Papa=require(_0x57de('0xf'));var Redis=require(_0x57de('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x57de('0x11'));var hardwareService=require(_0x57de('0x12'));var logger=require(_0x57de('0x13'))(_0x57de('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x57de('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x118ec2,_0x3741f0){_0x3741f0=_0x3741f0||0xcc;return function(_0x4dca24){if(_0x4dca24){return _0x118ec2[_0x57de('0x16')](_0x3741f0);}return _0x118ec2[_0x57de('0x17')](_0x3741f0)[_0x57de('0x18')]();};}function respondWithResult(_0x171d5c,_0x1f756b){_0x1f756b=_0x1f756b||0xc8;return function(_0x289105){if(_0x289105){return _0x171d5c['status'](_0x1f756b)[_0x57de('0x19')](_0x289105);}};}function respondWithFilteredResult(_0xc0e003,_0x4a69dc){return function(_0x5d5e5a){if(_0x5d5e5a){var _0x794388=typeof _0x4a69dc[_0x57de('0x1a')]===_0x57de('0x1b')&&typeof _0x4a69dc[_0x57de('0x1c')]==='undefined';var _0x2b6f4e=_0x5d5e5a[_0x57de('0x1d')];var _0x4d5917=_0x794388?0x0:_0x4a69dc['offset'];var _0x45f4cf=_0x794388?_0x5d5e5a['count']:_0x4a69dc['offset']+_0x4a69dc['limit'];var _0x2ca9c2;if(_0x45f4cf>=_0x2b6f4e){_0x45f4cf=_0x2b6f4e;_0x2ca9c2=0xc8;}else{_0x2ca9c2=0xce;}_0xc0e003['status'](_0x2ca9c2);return _0xc0e003[_0x57de('0x1e')](_0x57de('0x1f'),_0x4d5917+'-'+_0x45f4cf+'/'+_0x2b6f4e)[_0x57de('0x19')](_0x5d5e5a);}return null;};}function patchUpdates(_0xab7df8){return function(_0x2f786a){try{jsonpatch[_0x57de('0x20')](_0x2f786a,_0xab7df8,!![]);}catch(_0x1d693b){return BPromise['reject'](_0x1d693b);}return _0x2f786a[_0x57de('0x21')]();};}function saveUpdates(_0x2b1333,_0x1a0c30){return function(_0x398588){if(_0x398588){return _0x398588[_0x57de('0x22')](_0x2b1333)[_0x57de('0x23')](function(_0x465ffb){return _0x465ffb;});}return null;};}function removeEntity(_0x264b4d,_0x4fc251){return function(_0x237d2f){if(_0x237d2f){return _0x237d2f[_0x57de('0x24')]()[_0x57de('0x23')](function(){_0x264b4d[_0x57de('0x17')](0xcc)[_0x57de('0x18')]();});}};}function handleEntityNotFound(_0x494e83,_0x26eb4a){return function(_0x121b9e){if(!_0x121b9e){_0x494e83[_0x57de('0x16')](0x194);}return _0x121b9e;};}function handleError(_0x18063f,_0x576025){_0x576025=_0x576025||0x1f4;return function(_0x18abc4){logger[_0x57de('0x25')](_0x18abc4[_0x57de('0x26')]);if(_0x18abc4['name']){delete _0x18abc4[_0x57de('0x27')];}_0x18063f[_0x57de('0x17')](_0x576025)['send'](_0x18abc4);};}exports[_0x57de('0x28')]=function(_0x2e4ff3,_0x2bf870){var _0x3e83ac={},_0x385842={},_0x2489c1={'count':0x0,'rows':[]};var _0x559c7b=_[_0x57de('0x29')](db[_0x57de('0x2a')][_0x57de('0x2b')],function(_0x215e3d){return{'name':_0x215e3d[_0x57de('0x2c')],'type':_0x215e3d['type'][_0x57de('0x2d')]};});_0x385842[_0x57de('0x2e')]=_[_0x57de('0x29')](_0x559c7b,_0x57de('0x27'));_0x385842[_0x57de('0x2f')]=_[_0x57de('0x30')](_0x2e4ff3[_0x57de('0x2f')]);_0x385842['filters']=_[_0x57de('0x31')](_0x385842[_0x57de('0x2e')],_0x385842[_0x57de('0x2f')]);_0x3e83ac[_0x57de('0x32')]=_['intersection'](_0x385842[_0x57de('0x2e')],qs['fields'](_0x2e4ff3[_0x57de('0x2f')][_0x57de('0x33')]));_0x3e83ac[_0x57de('0x32')]=_0x3e83ac[_0x57de('0x32')][_0x57de('0x34')]?_0x3e83ac[_0x57de('0x32')]:_0x385842[_0x57de('0x2e')];if(!_0x2e4ff3[_0x57de('0x2f')][_0x57de('0x35')](_0x57de('0x36'))){_0x3e83ac[_0x57de('0x1c')]=qs[_0x57de('0x1c')](_0x2e4ff3[_0x57de('0x2f')][_0x57de('0x1c')]);_0x3e83ac[_0x57de('0x1a')]=qs[_0x57de('0x1a')](_0x2e4ff3[_0x57de('0x2f')][_0x57de('0x1a')]);}_0x3e83ac[_0x57de('0x37')]=qs[_0x57de('0x38')](_0x2e4ff3[_0x57de('0x2f')][_0x57de('0x38')]);_0x3e83ac[_0x57de('0x39')]=qs[_0x57de('0x3a')](_['pick'](_0x2e4ff3['query'],_0x385842[_0x57de('0x3a')]),_0x559c7b);if(_0x2e4ff3['query']['filter']){_0x3e83ac[_0x57de('0x39')]=_[_0x57de('0x3b')](_0x3e83ac['where'],{'$or':_[_0x57de('0x29')](_0x559c7b,function(_0x4cd370){if(_0x4cd370['type']!==_0x57de('0x3c')){var _0x4ee99e={};_0x4ee99e[_0x4cd370[_0x57de('0x27')]]={'$like':'%'+_0x2e4ff3['query'][_0x57de('0x3d')]+'%'};return _0x4ee99e;}})});}_0x3e83ac=_[_0x57de('0x3b')]({},_0x3e83ac,_0x2e4ff3[_0x57de('0x3e')]);var _0x4178b5={'where':_0x3e83ac[_0x57de('0x39')]};return db[_0x57de('0x2a')][_0x57de('0x1d')](_0x4178b5)['then'](function(_0x389436){_0x2489c1['count']=_0x389436;if(_0x2e4ff3[_0x57de('0x2f')][_0x57de('0x3f')]){_0x3e83ac[_0x57de('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x57de('0x41')](_0x3e83ac);})[_0x57de('0x23')](function(_0x3e9851){_0x2489c1[_0x57de('0x42')]=_0x3e9851;return _0x2489c1;})[_0x57de('0x23')](respondWithFilteredResult(_0x2bf870,_0x3e83ac))[_0x57de('0x43')](handleError(_0x2bf870,null));};exports[_0x57de('0x44')]=function(_0x406c47,_0x222f17){var _0x1292d0={'raw':![],'where':{'id':_0x406c47['params']['id']}},_0x1c3eb8={};_0x1c3eb8[_0x57de('0x2e')]=_[_0x57de('0x30')](db[_0x57de('0x2a')][_0x57de('0x2b')]);_0x1c3eb8[_0x57de('0x2f')]=_['keys'](_0x406c47[_0x57de('0x2f')]);_0x1c3eb8[_0x57de('0x3a')]=_[_0x57de('0x31')](_0x1c3eb8[_0x57de('0x2e')],_0x1c3eb8[_0x57de('0x2f')]);_0x1292d0[_0x57de('0x32')]=_[_0x57de('0x31')](_0x1c3eb8[_0x57de('0x2e')],qs[_0x57de('0x33')](_0x406c47['query'][_0x57de('0x33')]));_0x1292d0[_0x57de('0x32')]=_0x1292d0[_0x57de('0x32')][_0x57de('0x34')]?_0x1292d0['attributes']:_0x1c3eb8[_0x57de('0x2e')];if(_0x406c47['query']['includeAll']){_0x1292d0[_0x57de('0x40')]=[{'all':!![]}];}_0x1292d0=_[_0x57de('0x3b')]({},_0x1292d0,_0x406c47['options']);return db['AnalyticFieldReport'][_0x57de('0x45')](_0x1292d0)['then'](handleEntityNotFound(_0x222f17,null))['then'](respondWithResult(_0x222f17,null))[_0x57de('0x43')](handleError(_0x222f17,null));};exports[_0x57de('0x46')]=function(_0x10cab6,_0x367242){return db[_0x57de('0x2a')][_0x57de('0x46')](_0x10cab6[_0x57de('0x47')],{})[_0x57de('0x23')](respondWithResult(_0x367242,0xc9))[_0x57de('0x43')](handleError(_0x367242,null));};exports[_0x57de('0x48')]=function(_0x20bf5a,_0x2d5545){return db[_0x57de('0x2a')][_0x57de('0x48')](_0x20bf5a['body'],{'raw':![],'individualHooks':!![]})[_0x57de('0x23')](respondWithResult(_0x2d5545,0xc9))['catch'](handleError(_0x2d5545,null));};exports[_0x57de('0x22')]=function(_0x51c1d7,_0x2df50e){if(_0x51c1d7[_0x57de('0x47')]['id']){delete _0x51c1d7[_0x57de('0x47')]['id'];}return db[_0x57de('0x2a')][_0x57de('0x45')]({'where':{'id':_0x51c1d7[_0x57de('0x49')]['id']}})[_0x57de('0x23')](handleEntityNotFound(_0x2df50e,null))[_0x57de('0x23')](saveUpdates(_0x51c1d7[_0x57de('0x47')],null))['then'](respondWithResult(_0x2df50e,null))['catch'](handleError(_0x2df50e,null));};exports[_0x57de('0x24')]=function(_0x22c516,_0x1b1cab){return db['AnalyticFieldReport']['find']({'where':{'id':_0x22c516['params']['id']}})[_0x57de('0x23')](handleEntityNotFound(_0x1b1cab,null))['then'](removeEntity(_0x1b1cab,null))[_0x57de('0x43')](handleError(_0x1b1cab,null));};exports[_0x57de('0x4a')]=function(_0x27eb88,_0x1ef5ec){return db['AnalyticFieldReport'][_0x57de('0x24')]({'where':{'id':_0x27eb88[_0x57de('0x2f')][_0x57de('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1ef5ec,0xcc))[_0x57de('0x43')](handleError(_0x1ef5ec,null));};exports[_0x57de('0x4c')]=function(_0x2fda8d,_0x51f8ff,_0x48474f){return db['AnalyticCustomReport'][_0x57de('0x4d')]({'where':{'id':_0x2fda8d['params']['id']}})['then'](handleEntityNotFound(_0x51f8ff,null))[_0x57de('0x23')](function(_0x260505){if(_0x260505){return db['sequelize'][_0x57de('0x4e')](function(_0x29590a){return db[_0x57de('0x2a')][_0x57de('0x24')]({'where':{'CustomReportId':_0x2fda8d['params']['id']},'transaction':_0x29590a})[_0x57de('0x23')](function(_0x510da2){var _0x23e8f7=_['map'](_0x2fda8d[_0x57de('0x47')],function(_0x425477){delete _0x425477['id'];_0x425477['CustomReportId']=_0x2fda8d[_0x57de('0x49')]['id'];return _0x425477;});return db[_0x57de('0x2a')][_0x57de('0x48')](_0x23e8f7,{'transaction':_0x29590a});});})['then'](function(){return db['AnalyticFieldReport'][_0x57de('0x41')]({'where':{'CustomReportId':_0x2fda8d[_0x57de('0x49')]['id']}});});}})['then'](respondWithResult(_0x51f8ff,null))[_0x57de('0x43')](handleError(_0x51f8ff,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index fe8f798..23a846d 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 _0x6b56=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2d8d69,_0x8e47ff){var _0x39ae22=function(_0xd7935e){while(--_0xd7935e){_0x2d8d69['push'](_0x2d8d69['shift']());}};_0x39ae22(++_0x8e47ff);}(_0x6b56,0xb9));var _0x66b5=function(_0x319a37,_0x2890a9){_0x319a37=_0x319a37-0x0;var _0x54cffb=_0x6b56[_0x319a37];return _0x54cffb;};'use strict';var _=require('lodash');var util=require(_0x66b5('0x0'));var logger=require(_0x66b5('0x1'))(_0x66b5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x66b5('0x3'));var fs=require('fs');var path=require(_0x66b5('0x4'));var rimraf=require(_0x66b5('0x5'));var config=require(_0x66b5('0x6'));var attributes=require(_0x66b5('0x7'));module[_0x66b5('0x8')]=function(_0xbd7b3,_0x6d3a1d){return _0xbd7b3[_0x66b5('0x9')](_0x66b5('0xa'),attributes,{'tableName':_0x66b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6363=['analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2715c2,_0x172121){var _0x4bbedf=function(_0x2a6aea){while(--_0x2a6aea){_0x2715c2['push'](_0x2715c2['shift']());}};_0x4bbedf(++_0x172121);}(_0x6363,0x160));var _0x3636=function(_0xf8c256,_0x3fb31e){_0xf8c256=_0xf8c256-0x0;var _0xd881e0=_0x6363[_0xf8c256];return _0xd881e0;};'use strict';var _=require(_0x3636('0x0'));var util=require(_0x3636('0x1'));var logger=require(_0x3636('0x2'))(_0x3636('0x3'));var moment=require(_0x3636('0x4'));var BPromise=require(_0x3636('0x5'));var rp=require(_0x3636('0x6'));var fs=require('fs');var path=require(_0x3636('0x7'));var rimraf=require(_0x3636('0x8'));var config=require(_0x3636('0x9'));var attributes=require('./analyticFieldReport.attributes');module[_0x3636('0xa')]=function(_0x2b36cb,_0x51565a){return _0x2b36cb[_0x3636('0xb')]('AnalyticFieldReport',attributes,{'tableName':_0x3636('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 40ba3cd..26599fc 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 _0x6838=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x1f5094,_0x4848d5){var _0xc171c3=function(_0x555951){while(--_0x555951){_0x1f5094['push'](_0x1f5094['shift']());}};_0xc171c3(++_0x4848d5);}(_0x6838,0x16d));var _0x8683=function(_0x4d1ce8,_0x1a778e){_0x4d1ce8=_0x4d1ce8-0x0;var _0x129384=_0x6838[_0x4d1ce8];return _0x129384;};'use strict';var _=require(_0x8683('0x0'));var util=require('util');var moment=require(_0x8683('0x1'));var BPromise=require(_0x8683('0x2'));var rs=require(_0x8683('0x3'));var fs=require('fs');var Redis=require(_0x8683('0x4'));var db=require(_0x8683('0x5'))['db'];var utils=require(_0x8683('0x6'));var logger=require('../../config/logger')(_0x8683('0x7'));var config=require('../../config/environment');var jayson=require(_0x8683('0x8'));var client=jayson['client'][_0x8683('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38b184,_0x1c8daf,_0x1ef201){return new BPromise(function(_0x54187a,_0x399ad9){return client[_0x8683('0xa')](_0x38b184,_0x1ef201)[_0x8683('0xb')](function(_0x567be7){logger['info'](_0x8683('0xc'),_0x1c8daf,'request\x20sent');logger[_0x8683('0xd')](_0x8683('0xe'),_0x1c8daf,_0x8683('0xf'),JSON[_0x8683('0x10')](_0x567be7));if(_0x567be7[_0x8683('0x11')]){if(_0x567be7[_0x8683('0x11')]['code']===0x1f4){logger['error'](_0x8683('0xc'),_0x1c8daf,_0x567be7['error'][_0x8683('0x12')]);return _0x399ad9(_0x567be7[_0x8683('0x11')][_0x8683('0x12')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x1c8daf,_0x567be7[_0x8683('0x11')][_0x8683('0x12')]);return _0x54187a(_0x567be7[_0x8683('0x11')]['message']);}else{logger['info'](_0x8683('0xc'),_0x1c8daf,_0x8683('0xf'));_0x54187a(_0x567be7[_0x8683('0x13')]['message']);}})[_0x8683('0x14')](function(_0x16cc97){logger[_0x8683('0x11')](_0x8683('0xc'),_0x1c8daf,_0x16cc97);_0x399ad9(_0x16cc97);});});} \ No newline at end of file +var _0x1f98=['request','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3bd810,_0x2b21e4){var _0x1bbf13=function(_0x1a0bdc){while(--_0x1a0bdc){_0x3bd810['push'](_0x3bd810['shift']());}};_0x1bbf13(++_0x2b21e4);}(_0x1f98,0x66));var _0x81f9=function(_0x107dfb,_0x53c508){_0x107dfb=_0x107dfb-0x0;var _0x48dde9=_0x1f98[_0x107dfb];return _0x48dde9;};'use strict';var _=require(_0x81f9('0x0'));var util=require(_0x81f9('0x1'));var moment=require(_0x81f9('0x2'));var BPromise=require(_0x81f9('0x3'));var rs=require(_0x81f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81f9('0x5'))['db'];var utils=require(_0x81f9('0x6'));var logger=require(_0x81f9('0x7'))(_0x81f9('0x8'));var config=require(_0x81f9('0x9'));var jayson=require(_0x81f9('0xa'));var client=jayson[_0x81f9('0xb')][_0x81f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cfb5c,_0x3f89bf,_0x5bf856){return new BPromise(function(_0x141c3f,_0x558cf4){return client[_0x81f9('0xd')](_0x5cfb5c,_0x5bf856)[_0x81f9('0xe')](function(_0x58676e){logger[_0x81f9('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3f89bf,_0x81f9('0x10'));logger['debug'](_0x81f9('0x11'),_0x3f89bf,_0x81f9('0x10'),JSON[_0x81f9('0x12')](_0x58676e));if(_0x58676e[_0x81f9('0x13')]){if(_0x58676e[_0x81f9('0x13')]['code']===0x1f4){logger[_0x81f9('0x13')](_0x81f9('0x14'),_0x3f89bf,_0x58676e[_0x81f9('0x13')][_0x81f9('0x15')]);return _0x558cf4(_0x58676e[_0x81f9('0x13')][_0x81f9('0x15')]);}logger['error'](_0x81f9('0x14'),_0x3f89bf,_0x58676e['error']['message']);return _0x141c3f(_0x58676e[_0x81f9('0x13')][_0x81f9('0x15')]);}else{logger['info'](_0x81f9('0x14'),_0x3f89bf,_0x81f9('0x10'));_0x141c3f(_0x58676e['result'][_0x81f9('0x15')]);}})[_0x81f9('0x16')](function(_0x354148){logger['error'](_0x81f9('0x14'),_0x3f89bf,_0x354148);_0x558cf4(_0x354148);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 15c7df8..584c185 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(_0x5d9ec4,_0x4c9583){var _0x146b11=function(_0x3c94f4){while(--_0x3c94f4){_0x5d9ec4['push'](_0x5d9ec4['shift']());}};_0x146b11(++_0x4c9583);}(_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'));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(_0x16c601,_0xe9f35c){var _0x49388f=function(_0x3f67fc){while(--_0x3f67fc){_0x16c601['push'](_0x16c601['shift']());}};_0x49388f(++_0xe9f35c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 f542d2a..e0561b2 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 _0x1152=['TEXT','sequelize','exports','STRING','name'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0x1152,0x182));var _0x2115=function(_0x4772e0,_0x1072a2){_0x4772e0=_0x4772e0-0x0;var _0x8797f0=_0x1152[_0x4772e0];return _0x8797f0;};'use strict';var Sequelize=require(_0x2115('0x0'));module[_0x2115('0x1')]={'name':{'type':Sequelize[_0x2115('0x2')],'allowNull':![],'unique':_0x2115('0x3')},'table':{'type':Sequelize[_0x2115('0x2')]},'metric':{'type':Sequelize[_0x2115('0x4')]},'description':{'type':Sequelize[_0x2115('0x2')]}}; \ No newline at end of file +var _0xd84c=['STRING','name','TEXT','sequelize','exports'];(function(_0x3454ba,_0x5dd876){var _0x16bf4f=function(_0x42e90c){while(--_0x42e90c){_0x3454ba['push'](_0x3454ba['shift']());}};_0x16bf4f(++_0x5dd876);}(_0xd84c,0x102));var _0xcd84=function(_0x5eeec4,_0x33a6f5){_0x5eeec4=_0x5eeec4-0x0;var _0x531b80=_0xd84c[_0x5eeec4];return _0x531b80;};'use strict';var Sequelize=require(_0xcd84('0x0'));module[_0xcd84('0x1')]={'name':{'type':Sequelize[_0xcd84('0x2')],'allowNull':![],'unique':_0xcd84('0x3')},'table':{'type':Sequelize[_0xcd84('0x2')]},'metric':{'type':Sequelize[_0xcd84('0x4')]},'description':{'type':Sequelize[_0xcd84('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index ed7035c..9363c93 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 _0x4b84=['status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x5a4a1f,_0x3f90b6){var _0x43db26=function(_0x2824f5){while(--_0x2824f5){_0x5a4a1f['push'](_0x5a4a1f['shift']());}};_0x43db26(++_0x3f90b6);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0x4b84[_0x1a0ef3];return _0x2b86da;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){var _0x41a922=_0x51a34a[_0x44b8('0x22')]({'plain':!![]});var _0x25a0c1=_0x44b8('0x23');return db[_0x44b8('0x24')]['destroy']({'where':{'type':_0x25a0c1,'resourceId':_0x41a922['id']}})[_0x44b8('0x20')](function(){return _0x51a34a;});})['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x549a26,_0x17ac44){return function(_0x470f49){if(!_0x470f49){_0x549a26[_0x44b8('0x25')](0x194);}return _0x470f49;};}function handleError(_0x59c1bf,_0xb22107){_0xb22107=_0xb22107||0x1f4;return function(_0x242342){logger['error'](_0x242342[_0x44b8('0x26')]);if(_0x242342['name']){delete _0x242342[_0x44b8('0x27')];}_0x59c1bf['status'](_0xb22107)['send'](_0x242342);};}exports['index']=function(_0x387293,_0x29b18d){var _0x44ce5a={},_0x1bd1be={},_0x38cd17={'count':0x0,'rows':[]};var _0xc3f667=_[_0x44b8('0x28')](db[_0x44b8('0x29')][_0x44b8('0x2a')],function(_0x28f918){return{'name':_0x28f918[_0x44b8('0x2b')],'type':_0x28f918[_0x44b8('0x2c')][_0x44b8('0x2d')]};});_0x1bd1be['model']=_[_0x44b8('0x28')](_0xc3f667,'name');_0x1bd1be[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x387293[_0x44b8('0x2e')]);_0x1bd1be[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x1bd1be['model'],_0x1bd1be[_0x44b8('0x2e')]);_0x44ce5a[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1bd1be[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x387293['query'][_0x44b8('0x34')]));_0x44ce5a[_0x44b8('0x32')]=_0x44ce5a[_0x44b8('0x32')][_0x44b8('0x35')]?_0x44ce5a[_0x44b8('0x32')]:_0x1bd1be[_0x44b8('0x33')];if(!_0x387293[_0x44b8('0x2e')][_0x44b8('0x36')](_0x44b8('0x37'))){_0x44ce5a[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x17')]);_0x44ce5a[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x19')]);}_0x44ce5a[_0x44b8('0x38')]=qs[_0x44b8('0x39')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x39')]);_0x44ce5a[_0x44b8('0x3a')]=qs['filters'](_[_0x44b8('0x3b')](_0x387293[_0x44b8('0x2e')],_0x1bd1be['filters']),_0xc3f667);if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]){_0x44ce5a[_0x44b8('0x3a')]=_[_0x44b8('0x3d')](_0x44ce5a['where'],{'$or':_[_0x44b8('0x28')](_0xc3f667,function(_0x11e4e3){if(_0x11e4e3[_0x44b8('0x2c')]!==_0x44b8('0x3e')){var _0x9cb2a={};_0x9cb2a[_0x11e4e3[_0x44b8('0x27')]]={'$like':'%'+_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]+'%'};return _0x9cb2a;}})});}_0x44ce5a=_[_0x44b8('0x3d')]({},_0x44ce5a,_0x387293[_0x44b8('0x3f')]);var _0x1c9983={'where':_0x44ce5a[_0x44b8('0x3a')]};return db[_0x44b8('0x29')][_0x44b8('0x18')](_0x1c9983)[_0x44b8('0x20')](function(_0x29b43f){_0x38cd17['count']=_0x29b43f;if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x44ce5a[_0x44b8('0x41')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x44b8('0x42')](_0x44ce5a);})[_0x44b8('0x20')](function(_0x229cc9){_0x38cd17['rows']=_0x229cc9;return _0x38cd17;})[_0x44b8('0x20')](respondWithFilteredResult(_0x29b18d,_0x44ce5a))[_0x44b8('0x43')](handleError(_0x29b18d,null));};exports[_0x44b8('0x44')]=function(_0x334f86,_0xfd590a){var _0x499a3e={'raw':!![],'where':{'id':_0x334f86[_0x44b8('0x45')]['id']}},_0x5ae5f9={};_0x5ae5f9[_0x44b8('0x33')]=_[_0x44b8('0x2f')](db[_0x44b8('0x29')][_0x44b8('0x2a')]);_0x5ae5f9[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x334f86[_0x44b8('0x2e')]);_0x5ae5f9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],_0x5ae5f9[_0x44b8('0x2e')]);_0x499a3e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x334f86[_0x44b8('0x2e')][_0x44b8('0x34')]));_0x499a3e[_0x44b8('0x32')]=_0x499a3e['attributes']['length']?_0x499a3e[_0x44b8('0x32')]:_0x5ae5f9[_0x44b8('0x33')];if(_0x334f86[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x499a3e[_0x44b8('0x41')]=[{'all':!![]}];}_0x499a3e=_[_0x44b8('0x3d')]({},_0x499a3e,_0x334f86[_0x44b8('0x3f')]);return db['AnalyticMetric'][_0x44b8('0x46')](_0x499a3e)['then'](handleEntityNotFound(_0xfd590a,null))[_0x44b8('0x20')](respondWithResult(_0xfd590a,null))[_0x44b8('0x43')](handleError(_0xfd590a,null));};exports[_0x44b8('0x47')]=function(_0x9207bf,_0x103d57){return db[_0x44b8('0x29')]['create'](_0x9207bf[_0x44b8('0x48')],{})[_0x44b8('0x20')](function(_0x10602c){var _0x25d266=_0x9207bf['user'][_0x44b8('0x22')]({'plain':!![]});if(!_0x25d266)throw new Error(_0x44b8('0x49'));if(_0x25d266[_0x44b8('0x4a')]===_0x44b8('0x4b')){var _0x44ec23=_0x10602c[_0x44b8('0x22')]({'plain':!![]});var _0x500bad=_0x44b8('0x23');return db[_0x44b8('0x4c')][_0x44b8('0x46')]({'where':{'name':_0x500bad,'userProfileId':_0x25d266[_0x44b8('0x4d')]},'raw':!![]})[_0x44b8('0x20')](function(_0x57d0e2){if(_0x57d0e2&&_0x57d0e2['autoAssociation']===0x0){return db[_0x44b8('0x24')]['create']({'name':_0x44ec23[_0x44b8('0x27')],'resourceId':_0x44ec23['id'],'type':_0x57d0e2['name'],'sectionId':_0x57d0e2['id']},{})[_0x44b8('0x20')](function(){return _0x10602c;});}else{return _0x10602c;}})[_0x44b8('0x43')](function(_0x1a29f6){logger[_0x44b8('0x4e')](_0x44b8('0x4f'),_0x1a29f6);throw _0x1a29f6;});}return _0x10602c;})[_0x44b8('0x20')](respondWithResult(_0x103d57,0xc9))[_0x44b8('0x43')](handleError(_0x103d57,null));};exports['update']=function(_0x3ad278,_0x37b2c2){if(_0x3ad278[_0x44b8('0x48')]['id']){delete _0x3ad278['body']['id'];}return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x3ad278[_0x44b8('0x45')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x37b2c2,null))['then'](saveUpdates(_0x3ad278[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x37b2c2,null))['catch'](handleError(_0x37b2c2,null));};exports[_0x44b8('0x21')]=function(_0x19f22b,_0x35136e){return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x19f22b['params']['id']}})['then'](handleEntityNotFound(_0x35136e,null))[_0x44b8('0x20')](removeEntity(_0x35136e,null))[_0x44b8('0x43')](handleError(_0x35136e,null));}; \ No newline at end of file +var _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3dad75,_0x4fa797){_0x3dad75=_0x3dad75-0x0;var _0xc3c109=_0x9c5a[_0x3dad75];return _0xc3c109;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 415b565..210af76 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 _0x1c23=['analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./analyticMetric.attributes','exports','define'];(function(_0x5b39dd,_0x446202){var _0x1f0779=function(_0x569aab){while(--_0x569aab){_0x5b39dd['push'](_0x5b39dd['shift']());}};_0x1f0779(++_0x446202);}(_0x1c23,0x1d5));var _0x31c2=function(_0x45d1a8,_0x5d661f){_0x45d1a8=_0x45d1a8-0x0;var _0xfc869a=_0x1c23[_0x45d1a8];return _0xfc869a;};'use strict';var _=require(_0x31c2('0x0'));var util=require(_0x31c2('0x1'));var logger=require(_0x31c2('0x2'))(_0x31c2('0x3'));var moment=require(_0x31c2('0x4'));var BPromise=require(_0x31c2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31c2('0x6'));var rimraf=require(_0x31c2('0x7'));var config=require('../../config/environment');var attributes=require(_0x31c2('0x8'));module[_0x31c2('0x9')]=function(_0x12c3d3,_0x21dbdc){return _0x12c3d3[_0x31c2('0xa')]('AnalyticMetric',attributes,{'tableName':_0x31c2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1419=['../../config/logger','api','moment','path','rimraf','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x5bd565,_0x2ab208){var _0x285775=function(_0x56c93e){while(--_0x56c93e){_0x5bd565['push'](_0x5bd565['shift']());}};_0x285775(++_0x2ab208);}(_0x1419,0x127));var _0x9141=function(_0x31b798,_0x42684d){_0x31b798=_0x31b798-0x0;var _0x463008=_0x1419[_0x31b798];return _0x463008;};'use strict';var _=require(_0x9141('0x0'));var util=require(_0x9141('0x1'));var logger=require(_0x9141('0x2'))(_0x9141('0x3'));var moment=require(_0x9141('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9141('0x5'));var rimraf=require(_0x9141('0x6'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x9141('0x7')]=function(_0x182cc8,_0x31cfc2){return _0x182cc8[_0x9141('0x8')](_0x9141('0x9'),attributes,{'tableName':_0x9141('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 639fc83..2f03d33 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 _0xed45=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0xf61586,_0x56b0c4){var _0x2b6eb3=function(_0x47e12b){while(--_0x47e12b){_0xf61586['push'](_0xf61586['shift']());}};_0x2b6eb3(++_0x56b0c4);}(_0xed45,0x186));var _0x5ed4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xed45[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5ed4('0x0'));var util=require(_0x5ed4('0x1'));var moment=require(_0x5ed4('0x2'));var BPromise=require(_0x5ed4('0x3'));var rs=require(_0x5ed4('0x4'));var fs=require('fs');var Redis=require(_0x5ed4('0x5'));var db=require(_0x5ed4('0x6'))['db'];var utils=require(_0x5ed4('0x7'));var logger=require(_0x5ed4('0x8'))('rpc');var config=require(_0x5ed4('0x9'));var jayson=require(_0x5ed4('0xa'));var client=jayson[_0x5ed4('0xb')][_0x5ed4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d1fa8,_0x10fefc,_0x446fcc){return new BPromise(function(_0x2b718d,_0x5e6132){return client[_0x5ed4('0xd')](_0x2d1fa8,_0x446fcc)[_0x5ed4('0xe')](function(_0x5ea8b8){logger['info'](_0x5ed4('0xf'),_0x10fefc,_0x5ed4('0x10'));logger[_0x5ed4('0x11')](_0x5ed4('0x12'),_0x10fefc,_0x5ed4('0x10'),JSON[_0x5ed4('0x13')](_0x5ea8b8));if(_0x5ea8b8[_0x5ed4('0x14')]){if(_0x5ea8b8[_0x5ed4('0x14')][_0x5ed4('0x15')]===0x1f4){logger['error'](_0x5ed4('0xf'),_0x10fefc,_0x5ea8b8[_0x5ed4('0x14')][_0x5ed4('0x16')]);return _0x5e6132(_0x5ea8b8['error'][_0x5ed4('0x16')]);}logger[_0x5ed4('0x14')](_0x5ed4('0xf'),_0x10fefc,_0x5ea8b8[_0x5ed4('0x14')]['message']);return _0x2b718d(_0x5ea8b8['error'][_0x5ed4('0x16')]);}else{logger[_0x5ed4('0x17')](_0x5ed4('0xf'),_0x10fefc,'request\x20sent');_0x2b718d(_0x5ea8b8[_0x5ed4('0x18')]['message']);}})[_0x5ed4('0x19')](function(_0x21f65c){logger[_0x5ed4('0x14')](_0x5ed4('0xf'),_0x10fefc,_0x21f65c);_0x5e6132(_0x21f65c);});});} \ No newline at end of file +var _0x189a=['request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x28033b,_0x5eeded){var _0x406878=function(_0x594c28){while(--_0x594c28){_0x28033b['push'](_0x28033b['shift']());}};_0x406878(++_0x5eeded);}(_0x189a,0x17b));var _0xa189=function(_0x17c1f3,_0x10cd0a){_0x17c1f3=_0x17c1f3-0x0;var _0x1d6c8d=_0x189a[_0x17c1f3];return _0x1d6c8d;};'use strict';var _=require(_0xa189('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa189('0x1'));var rs=require(_0xa189('0x2'));var fs=require('fs');var Redis=require(_0xa189('0x3'));var db=require(_0xa189('0x4'))['db'];var utils=require(_0xa189('0x5'));var logger=require(_0xa189('0x6'))(_0xa189('0x7'));var config=require(_0xa189('0x8'));var jayson=require(_0xa189('0x9'));var client=jayson[_0xa189('0xa')][_0xa189('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29080f,_0x4c254c,_0x2d99ec){return new BPromise(function(_0x55657d,_0x518f8f){return client[_0xa189('0xc')](_0x29080f,_0x2d99ec)['then'](function(_0x5f3ed8){logger[_0xa189('0xd')](_0xa189('0xe'),_0x4c254c,_0xa189('0xf'));logger[_0xa189('0x10')](_0xa189('0x11'),_0x4c254c,_0xa189('0xf'),JSON[_0xa189('0x12')](_0x5f3ed8));if(_0x5f3ed8[_0xa189('0x13')]){if(_0x5f3ed8[_0xa189('0x13')][_0xa189('0x14')]===0x1f4){logger['error'](_0xa189('0xe'),_0x4c254c,_0x5f3ed8['error']['message']);return _0x518f8f(_0x5f3ed8['error'][_0xa189('0x15')]);}logger['error'](_0xa189('0xe'),_0x4c254c,_0x5f3ed8[_0xa189('0x13')]['message']);return _0x55657d(_0x5f3ed8[_0xa189('0x13')][_0xa189('0x15')]);}else{logger[_0xa189('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x4c254c,_0xa189('0xf'));_0x55657d(_0x5f3ed8[_0xa189('0x16')][_0xa189('0x15')]);}})['catch'](function(_0x396146){logger[_0xa189('0x13')](_0xa189('0xe'),_0x4c254c,_0x396146);_0x518f8f(_0x396146);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b7fa0d4..c82e2ab 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 _0x8ca9=['express','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x488ce4,_0x2b2839){var _0x4f60c2=function(_0x17211f){while(--_0x17211f){_0x488ce4['push'](_0x488ce4['shift']());}};_0x4f60c2(++_0x2b2839);}(_0x8ca9,0x9c));var _0x98ca=function(_0x47c18a,_0x221dd2){_0x47c18a=_0x47c18a-0x0;var _0x24cb66=_0x8ca9[_0x47c18a];return _0x24cb66;};'use strict';var multer=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var path=require(_0x98ca('0x2'));var timeout=require(_0x98ca('0x3'));var express=require(_0x98ca('0x4'));var router=express[_0x98ca('0x5')]();var fs_extra=require(_0x98ca('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x98ca('0x7'));var controller=require('./analyticMetric.controller');router[_0x98ca('0x8')]('/',auth['isAuthenticated'](),controller[_0x98ca('0x9')]);router[_0x98ca('0x8')](_0x98ca('0xa'),auth[_0x98ca('0xb')](),controller[_0x98ca('0xc')]);router[_0x98ca('0xd')]('/',auth[_0x98ca('0xb')](),controller[_0x98ca('0xe')]);router[_0x98ca('0xf')](_0x98ca('0xa'),auth[_0x98ca('0xb')](),controller[_0x98ca('0x10')]);router[_0x98ca('0x11')](_0x98ca('0xa'),auth[_0x98ca('0xb')](),controller[_0x98ca('0x12')]);module[_0x98ca('0x13')]=router; \ No newline at end of file +var _0x0cfe=['fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x49fe0f,_0xec12d7){_0x49fe0f=_0x49fe0f-0x0;var _0x406663=_0x0cfe[_0x49fe0f];return _0x406663;};'use strict';var multer=require(_0xe0cf('0x0'));var util=require('util');var path=require(_0xe0cf('0x1'));var timeout=require(_0xe0cf('0x2'));var express=require(_0xe0cf('0x3'));var router=express['Router']();var fs_extra=require(_0xe0cf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe0cf('0x5'));var config=require(_0xe0cf('0x6'));var controller=require(_0xe0cf('0x7'));router[_0xe0cf('0x8')]('/',auth['isAuthenticated'](),controller[_0xe0cf('0x9')]);router[_0xe0cf('0x8')](_0xe0cf('0xa'),auth['isAuthenticated'](),controller[_0xe0cf('0xb')]);router[_0xe0cf('0xc')]('/',auth['isAuthenticated'](),controller[_0xe0cf('0xd')]);router[_0xe0cf('0xe')](_0xe0cf('0xa'),auth[_0xe0cf('0xf')](),controller[_0xe0cf('0x10')]);router[_0xe0cf('0x11')]('/:id',auth[_0xe0cf('0xf')](),controller[_0xe0cf('0x12')]);module[_0xe0cf('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index eba89b1..27e3bff 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 _0x1306=['sequelize','exports','TEXT'];(function(_0x4d58b1,_0x2dd89f){var _0x46e955=function(_0x40becc){while(--_0x40becc){_0x4d58b1['push'](_0x4d58b1['shift']());}};_0x46e955(++_0x2dd89f);}(_0x1306,0x17a));var _0x6130=function(_0x1bd3b5,_0x323733){_0x1bd3b5=_0x1bd3b5-0x0;var _0x2b0885=_0x1306[_0x1bd3b5];return _0x2b0885;};'use strict';var Sequelize=require(_0x6130('0x0'));module[_0x6130('0x1')]={'tree':{'type':Sequelize[_0x6130('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9a53=['TEXT','sequelize','exports'];(function(_0x5683b0,_0x4233ea){var _0x2757e8=function(_0x1ef768){while(--_0x1ef768){_0x5683b0['push'](_0x5683b0['shift']());}};_0x2757e8(++_0x4233ea);}(_0x9a53,0xb5));var _0x39a5=function(_0x398331,_0x457080){_0x398331=_0x398331-0x0;var _0x4a9ec9=_0x9a53[_0x398331];return _0x4a9ec9;};'use strict';var Sequelize=require(_0x39a5('0x0'));module[_0x39a5('0x1')]={'tree':{'type':Sequelize[_0x39a5('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index e5c277a..eac5dfa 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 _0xd104=['save','update','destroy','error','stack','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject'];(function(_0x6ea7a6,_0x1b384a){var _0x46468a=function(_0xbde3cc){while(--_0xbde3cc){_0x6ea7a6['push'](_0x6ea7a6['shift']());}};_0x46468a(++_0x1b384a);}(_0xd104,0x1eb));var _0x4d10=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd104[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x4d10('0x0'));var rimraf=require(_0x4d10('0x1'));var zipdir=require(_0x4d10('0x2'));var jsonpatch=require(_0x4d10('0x3'));var rp=require(_0x4d10('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4d10('0x5'));var util=require('util');var path=require(_0x4d10('0x6'));var sox=require(_0x4d10('0x7'));var csv=require(_0x4d10('0x8'));var ejs=require(_0x4d10('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d10('0xa'));var squel=require(_0x4d10('0xb'));var crypto=require('crypto');var jsforce=require(_0x4d10('0xc'));var deskjs=require(_0x4d10('0xd'));var toCsv=require(_0x4d10('0x8'));var querystring=require(_0x4d10('0xe'));var Papa=require('papaparse');var Redis=require(_0x4d10('0xf'));var authService=require(_0x4d10('0x10'));var qs=require(_0x4d10('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d10('0x12'))(_0x4d10('0x13'));var utils=require('../../config/utils');var config=require(_0x4d10('0x14'));var licenseUtil=require(_0x4d10('0x15'));var db=require(_0x4d10('0x16'))['db'];function respondWithStatusCode(_0x1b4842,_0xf9a75d){_0xf9a75d=_0xf9a75d||0xcc;return function(_0x22845d){if(_0x22845d){return _0x1b4842[_0x4d10('0x17')](_0xf9a75d);}return _0x1b4842['status'](_0xf9a75d)[_0x4d10('0x18')]();};}function respondWithResult(_0x2497fb,_0x1ef7ef){_0x1ef7ef=_0x1ef7ef||0xc8;return function(_0x33c8bd){if(_0x33c8bd){return _0x2497fb[_0x4d10('0x19')](_0x1ef7ef)['json'](_0x33c8bd);}};}function respondWithFilteredResult(_0x1c3255,_0x4c7b8d){return function(_0x3b026e){if(_0x3b026e){var _0x11bc91=typeof _0x4c7b8d['offset']===_0x4d10('0x1a')&&typeof _0x4c7b8d[_0x4d10('0x1b')]===_0x4d10('0x1a');var _0x39d39d=_0x3b026e[_0x4d10('0x1c')];var _0x4e584d=_0x11bc91?0x0:_0x4c7b8d[_0x4d10('0x1d')];var _0x19a98e=_0x11bc91?_0x3b026e[_0x4d10('0x1c')]:_0x4c7b8d['offset']+_0x4c7b8d[_0x4d10('0x1b')];var _0x3a91c1;if(_0x19a98e>=_0x39d39d){_0x19a98e=_0x39d39d;_0x3a91c1=0xc8;}else{_0x3a91c1=0xce;}_0x1c3255[_0x4d10('0x19')](_0x3a91c1);return _0x1c3255[_0x4d10('0x1e')]('Content-Range',_0x4e584d+'-'+_0x19a98e+'/'+_0x39d39d)[_0x4d10('0x1f')](_0x3b026e);}return null;};}function patchUpdates(_0x399df3){return function(_0x50c6c7){try{jsonpatch[_0x4d10('0x20')](_0x50c6c7,_0x399df3,!![]);}catch(_0x18f2b3){return BPromise[_0x4d10('0x21')](_0x18f2b3);}return _0x50c6c7[_0x4d10('0x22')]();};}function saveUpdates(_0x6ed3a7,_0x770735){return function(_0x2261a6){if(_0x2261a6){return _0x2261a6[_0x4d10('0x23')](_0x6ed3a7)['then'](function(_0x5b26cc){return _0x5b26cc;});}return null;};}function removeEntity(_0x43a95b,_0x4db371){return function(_0xd6285c){if(_0xd6285c){return _0xd6285c[_0x4d10('0x24')]()['then'](function(){_0x43a95b[_0x4d10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x501e61,_0x197037){return function(_0x4af5b2){if(!_0x4af5b2){_0x501e61[_0x4d10('0x17')](0x194);}return _0x4af5b2;};}function handleError(_0x1fd962,_0xfd29d8){_0xfd29d8=_0xfd29d8||0x1f4;return function(_0x2b47c8){logger[_0x4d10('0x25')](_0x2b47c8[_0x4d10('0x26')]);if(_0x2b47c8['name']){delete _0x2b47c8['name'];}_0x1fd962['status'](_0xfd29d8)[_0x4d10('0x27')](_0x2b47c8);};}exports[_0x4d10('0x28')]=function(_0x2a45a6,_0x3ae65a){var _0x4b3533={},_0x5467cc={},_0x1f82d1={'count':0x0,'rows':[]};var _0x434efd=_[_0x4d10('0x29')](db[_0x4d10('0x2a')][_0x4d10('0x2b')],function(_0xd6ffee){return{'name':_0xd6ffee[_0x4d10('0x2c')],'type':_0xd6ffee[_0x4d10('0x2d')][_0x4d10('0x2e')]};});_0x5467cc[_0x4d10('0x2f')]=_[_0x4d10('0x29')](_0x434efd,_0x4d10('0x30'));_0x5467cc[_0x4d10('0x31')]=_[_0x4d10('0x32')](_0x2a45a6['query']);_0x5467cc[_0x4d10('0x33')]=_[_0x4d10('0x34')](_0x5467cc[_0x4d10('0x2f')],_0x5467cc[_0x4d10('0x31')]);_0x4b3533['attributes']=_[_0x4d10('0x34')](_0x5467cc[_0x4d10('0x2f')],qs['fields'](_0x2a45a6[_0x4d10('0x31')][_0x4d10('0x35')]));_0x4b3533[_0x4d10('0x36')]=_0x4b3533[_0x4d10('0x36')]['length']?_0x4b3533[_0x4d10('0x36')]:_0x5467cc['model'];if(!_0x2a45a6['query'][_0x4d10('0x37')](_0x4d10('0x38'))){_0x4b3533[_0x4d10('0x1b')]=qs[_0x4d10('0x1b')](_0x2a45a6['query'][_0x4d10('0x1b')]);_0x4b3533[_0x4d10('0x1d')]=qs[_0x4d10('0x1d')](_0x2a45a6[_0x4d10('0x31')][_0x4d10('0x1d')]);}_0x4b3533['order']=qs[_0x4d10('0x39')](_0x2a45a6[_0x4d10('0x31')][_0x4d10('0x39')]);_0x4b3533['where']=qs[_0x4d10('0x33')](_['pick'](_0x2a45a6['query'],_0x5467cc[_0x4d10('0x33')]),_0x434efd);if(_0x2a45a6[_0x4d10('0x31')][_0x4d10('0x3a')]){_0x4b3533[_0x4d10('0x3b')]=_[_0x4d10('0x3c')](_0x4b3533['where'],{'$or':_['map'](_0x434efd,function(_0x147cb7){if(_0x147cb7['type']!==_0x4d10('0x3d')){var _0x386755={};_0x386755[_0x147cb7[_0x4d10('0x30')]]={'$like':'%'+_0x2a45a6['query'][_0x4d10('0x3a')]+'%'};return _0x386755;}})});}_0x4b3533=_[_0x4d10('0x3c')]({},_0x4b3533,_0x2a45a6[_0x4d10('0x3e')]);var _0xdb5e14={'where':_0x4b3533[_0x4d10('0x3b')]};return db[_0x4d10('0x2a')][_0x4d10('0x1c')](_0xdb5e14)[_0x4d10('0x3f')](function(_0x3559ee){_0x1f82d1[_0x4d10('0x1c')]=_0x3559ee;if(_0x2a45a6[_0x4d10('0x31')][_0x4d10('0x40')]){_0x4b3533[_0x4d10('0x41')]=[{'all':!![]}];}return db[_0x4d10('0x2a')][_0x4d10('0x42')](_0x4b3533);})[_0x4d10('0x3f')](function(_0x5e9564){_0x1f82d1[_0x4d10('0x43')]=_0x5e9564;return _0x1f82d1;})[_0x4d10('0x3f')](respondWithFilteredResult(_0x3ae65a,_0x4b3533))[_0x4d10('0x44')](handleError(_0x3ae65a,null));};exports[_0x4d10('0x45')]=function(_0x295146,_0x4dcaf9){var _0x2721fc={'raw':!![],'where':{'id':_0x295146[_0x4d10('0x46')]['id']}},_0x2b8258={};_0x2b8258[_0x4d10('0x2f')]=_[_0x4d10('0x32')](db[_0x4d10('0x2a')][_0x4d10('0x2b')]);_0x2b8258[_0x4d10('0x31')]=_[_0x4d10('0x32')](_0x295146[_0x4d10('0x31')]);_0x2b8258[_0x4d10('0x33')]=_[_0x4d10('0x34')](_0x2b8258[_0x4d10('0x2f')],_0x2b8258[_0x4d10('0x31')]);_0x2721fc['attributes']=_['intersection'](_0x2b8258[_0x4d10('0x2f')],qs[_0x4d10('0x35')](_0x295146[_0x4d10('0x31')][_0x4d10('0x35')]));_0x2721fc[_0x4d10('0x36')]=_0x2721fc[_0x4d10('0x36')][_0x4d10('0x47')]?_0x2721fc[_0x4d10('0x36')]:_0x2b8258[_0x4d10('0x2f')];if(_0x295146[_0x4d10('0x31')]['includeAll']){_0x2721fc['include']=[{'all':!![]}];}_0x2721fc=_[_0x4d10('0x3c')]({},_0x2721fc,_0x295146[_0x4d10('0x3e')]);return db[_0x4d10('0x2a')]['find'](_0x2721fc)[_0x4d10('0x3f')](handleEntityNotFound(_0x4dcaf9,null))['then'](respondWithResult(_0x4dcaf9,null))['catch'](handleError(_0x4dcaf9,null));};exports[_0x4d10('0x48')]=function(_0x1d95d2,_0x95451d){return db['AnalyticTreeReport'][_0x4d10('0x48')](_0x1d95d2[_0x4d10('0x49')],{})[_0x4d10('0x3f')](respondWithResult(_0x95451d,0xc9))['catch'](handleError(_0x95451d,null));};exports[_0x4d10('0x23')]=function(_0x8e2a80,_0xa02060){if(_0x8e2a80[_0x4d10('0x49')]['id']){delete _0x8e2a80[_0x4d10('0x49')]['id'];}return db['AnalyticTreeReport'][_0x4d10('0x4a')]({'where':{'id':_0x8e2a80[_0x4d10('0x46')]['id']}})[_0x4d10('0x3f')](handleEntityNotFound(_0xa02060,null))[_0x4d10('0x3f')](saveUpdates(_0x8e2a80['body'],null))[_0x4d10('0x3f')](respondWithResult(_0xa02060,null))[_0x4d10('0x44')](handleError(_0xa02060,null));};exports[_0x4d10('0x24')]=function(_0x4f26a9,_0x5366da){return db[_0x4d10('0x2a')][_0x4d10('0x4a')]({'where':{'id':_0x4f26a9[_0x4d10('0x46')]['id']}})[_0x4d10('0x3f')](handleEntityNotFound(_0x5366da,null))[_0x4d10('0x3f')](removeEntity(_0x5366da,null))[_0x4d10('0x44')](handleError(_0x5366da,null));}; \ No newline at end of file +var _0x1056=['json','apply','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','type','options','AnalyticTreeReport','includeAll','findAll','rows','catch','params','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range'];(function(_0x4d1091,_0x2fbc86){var _0x1507cd=function(_0x1c886f){while(--_0x1c886f){_0x4d1091['push'](_0x4d1091['shift']());}};_0x1507cd(++_0x2fbc86);}(_0x1056,0x16b));var _0x6105=function(_0x4268fa,_0x1f085f){_0x4268fa=_0x4268fa-0x0;var _0x4ab24f=_0x1056[_0x4268fa];return _0x4ab24f;};'use strict';var emlformat=require(_0x6105('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6105('0x1'));var jsonpatch=require(_0x6105('0x2'));var rp=require(_0x6105('0x3'));var moment=require(_0x6105('0x4'));var BPromise=require(_0x6105('0x5'));var Mustache=require(_0x6105('0x6'));var util=require(_0x6105('0x7'));var path=require(_0x6105('0x8'));var sox=require('sox');var csv=require(_0x6105('0x9'));var ejs=require(_0x6105('0xa'));var fs=require('fs');var fs_extra=require(_0x6105('0xb'));var _=require(_0x6105('0xc'));var squel=require(_0x6105('0xd'));var crypto=require(_0x6105('0xe'));var jsforce=require(_0x6105('0xf'));var deskjs=require(_0x6105('0x10'));var toCsv=require(_0x6105('0x9'));var querystring=require(_0x6105('0x11'));var Papa=require(_0x6105('0x12'));var Redis=require(_0x6105('0x13'));var authService=require(_0x6105('0x14'));var qs=require(_0x6105('0x15'));var as=require(_0x6105('0x16'));var hardwareService=require(_0x6105('0x17'));var logger=require(_0x6105('0x18'))(_0x6105('0x19'));var utils=require(_0x6105('0x1a'));var config=require(_0x6105('0x1b'));var licenseUtil=require(_0x6105('0x1c'));var db=require(_0x6105('0x1d'))['db'];function respondWithStatusCode(_0x1e876b,_0x18b406){_0x18b406=_0x18b406||0xcc;return function(_0x30ad04){if(_0x30ad04){return _0x1e876b[_0x6105('0x1e')](_0x18b406);}return _0x1e876b[_0x6105('0x1f')](_0x18b406)['end']();};}function respondWithResult(_0x3464c5,_0x3b5a39){_0x3b5a39=_0x3b5a39||0xc8;return function(_0x496de1){if(_0x496de1){return _0x3464c5['status'](_0x3b5a39)['json'](_0x496de1);}};}function respondWithFilteredResult(_0x2c8c8b,_0x1fd82a){return function(_0x56d98a){if(_0x56d98a){var _0x31a82d=typeof _0x1fd82a[_0x6105('0x20')]===_0x6105('0x21')&&typeof _0x1fd82a['limit']==='undefined';var _0x1f3a8d=_0x56d98a['count'];var _0xf98c5c=_0x31a82d?0x0:_0x1fd82a[_0x6105('0x20')];var _0x1d9d1e=_0x31a82d?_0x56d98a[_0x6105('0x22')]:_0x1fd82a[_0x6105('0x20')]+_0x1fd82a['limit'];var _0x12a6fb;if(_0x1d9d1e>=_0x1f3a8d){_0x1d9d1e=_0x1f3a8d;_0x12a6fb=0xc8;}else{_0x12a6fb=0xce;}_0x2c8c8b['status'](_0x12a6fb);return _0x2c8c8b[_0x6105('0x23')](_0x6105('0x24'),_0xf98c5c+'-'+_0x1d9d1e+'/'+_0x1f3a8d)[_0x6105('0x25')](_0x56d98a);}return null;};}function patchUpdates(_0x328f2c){return function(_0x40a579){try{jsonpatch[_0x6105('0x26')](_0x40a579,_0x328f2c,!![]);}catch(_0x36bbcf){return BPromise['reject'](_0x36bbcf);}return _0x40a579[_0x6105('0x27')]();};}function saveUpdates(_0x133ab7,_0x546243){return function(_0xa68cc){if(_0xa68cc){return _0xa68cc[_0x6105('0x28')](_0x133ab7)[_0x6105('0x29')](function(_0xddf179){return _0xddf179;});}return null;};}function removeEntity(_0x2b2cec,_0x114a57){return function(_0x14985f){if(_0x14985f){return _0x14985f[_0x6105('0x2a')]()['then'](function(){_0x2b2cec[_0x6105('0x1f')](0xcc)[_0x6105('0x2b')]();});}};}function handleEntityNotFound(_0x581722,_0x3fd1b5){return function(_0x399379){if(!_0x399379){_0x581722[_0x6105('0x1e')](0x194);}return _0x399379;};}function handleError(_0x5cf714,_0x4719b5){_0x4719b5=_0x4719b5||0x1f4;return function(_0x9ebbf4){logger[_0x6105('0x2c')](_0x9ebbf4[_0x6105('0x2d')]);if(_0x9ebbf4[_0x6105('0x2e')]){delete _0x9ebbf4[_0x6105('0x2e')];}_0x5cf714[_0x6105('0x1f')](_0x4719b5)['send'](_0x9ebbf4);};}exports[_0x6105('0x2f')]=function(_0x285114,_0x330900){var _0x250d50={},_0x25db92={},_0x564889={'count':0x0,'rows':[]};var _0x36567d=_['map'](db['AnalyticTreeReport'][_0x6105('0x30')],function(_0x50f3b2){return{'name':_0x50f3b2[_0x6105('0x31')],'type':_0x50f3b2['type'][_0x6105('0x32')]};});_0x25db92['model']=_[_0x6105('0x33')](_0x36567d,_0x6105('0x2e'));_0x25db92[_0x6105('0x34')]=_[_0x6105('0x35')](_0x285114[_0x6105('0x34')]);_0x25db92['filters']=_[_0x6105('0x36')](_0x25db92[_0x6105('0x37')],_0x25db92['query']);_0x250d50[_0x6105('0x38')]=_[_0x6105('0x36')](_0x25db92[_0x6105('0x37')],qs[_0x6105('0x39')](_0x285114[_0x6105('0x34')][_0x6105('0x39')]));_0x250d50[_0x6105('0x38')]=_0x250d50[_0x6105('0x38')]['length']?_0x250d50['attributes']:_0x25db92[_0x6105('0x37')];if(!_0x285114[_0x6105('0x34')][_0x6105('0x3a')](_0x6105('0x3b'))){_0x250d50[_0x6105('0x3c')]=qs['limit'](_0x285114[_0x6105('0x34')][_0x6105('0x3c')]);_0x250d50[_0x6105('0x20')]=qs[_0x6105('0x20')](_0x285114[_0x6105('0x34')][_0x6105('0x20')]);}_0x250d50[_0x6105('0x3d')]=qs[_0x6105('0x3e')](_0x285114[_0x6105('0x34')][_0x6105('0x3e')]);_0x250d50[_0x6105('0x3f')]=qs['filters'](_[_0x6105('0x40')](_0x285114[_0x6105('0x34')],_0x25db92[_0x6105('0x41')]),_0x36567d);if(_0x285114[_0x6105('0x34')][_0x6105('0x42')]){_0x250d50[_0x6105('0x3f')]=_[_0x6105('0x43')](_0x250d50[_0x6105('0x3f')],{'$or':_[_0x6105('0x33')](_0x36567d,function(_0x48677d){if(_0x48677d[_0x6105('0x44')]!=='VIRTUAL'){var _0x12b9f1={};_0x12b9f1[_0x48677d[_0x6105('0x2e')]]={'$like':'%'+_0x285114[_0x6105('0x34')]['filter']+'%'};return _0x12b9f1;}})});}_0x250d50=_['merge']({},_0x250d50,_0x285114[_0x6105('0x45')]);var _0x34e907={'where':_0x250d50['where']};return db[_0x6105('0x46')]['count'](_0x34e907)[_0x6105('0x29')](function(_0x855648){_0x564889[_0x6105('0x22')]=_0x855648;if(_0x285114[_0x6105('0x34')][_0x6105('0x47')]){_0x250d50['include']=[{'all':!![]}];}return db[_0x6105('0x46')][_0x6105('0x48')](_0x250d50);})['then'](function(_0x2cf9ac){_0x564889[_0x6105('0x49')]=_0x2cf9ac;return _0x564889;})['then'](respondWithFilteredResult(_0x330900,_0x250d50))[_0x6105('0x4a')](handleError(_0x330900,null));};exports['show']=function(_0x57f485,_0x4ad9b4){var _0x19cc15={'raw':!![],'where':{'id':_0x57f485[_0x6105('0x4b')]['id']}},_0x4a360b={};_0x4a360b[_0x6105('0x37')]=_['keys'](db[_0x6105('0x46')]['rawAttributes']);_0x4a360b[_0x6105('0x34')]=_[_0x6105('0x35')](_0x57f485[_0x6105('0x34')]);_0x4a360b['filters']=_[_0x6105('0x36')](_0x4a360b[_0x6105('0x37')],_0x4a360b[_0x6105('0x34')]);_0x19cc15[_0x6105('0x38')]=_[_0x6105('0x36')](_0x4a360b['model'],qs[_0x6105('0x39')](_0x57f485['query'][_0x6105('0x39')]));_0x19cc15['attributes']=_0x19cc15[_0x6105('0x38')]['length']?_0x19cc15[_0x6105('0x38')]:_0x4a360b[_0x6105('0x37')];if(_0x57f485[_0x6105('0x34')][_0x6105('0x47')]){_0x19cc15[_0x6105('0x4c')]=[{'all':!![]}];}_0x19cc15=_[_0x6105('0x43')]({},_0x19cc15,_0x57f485[_0x6105('0x45')]);return db[_0x6105('0x46')][_0x6105('0x4d')](_0x19cc15)[_0x6105('0x29')](handleEntityNotFound(_0x4ad9b4,null))[_0x6105('0x29')](respondWithResult(_0x4ad9b4,null))['catch'](handleError(_0x4ad9b4,null));};exports[_0x6105('0x4e')]=function(_0x409563,_0x5462ac){return db[_0x6105('0x46')][_0x6105('0x4e')](_0x409563[_0x6105('0x4f')],{})[_0x6105('0x29')](respondWithResult(_0x5462ac,0xc9))[_0x6105('0x4a')](handleError(_0x5462ac,null));};exports[_0x6105('0x28')]=function(_0x335f77,_0x242ae8){if(_0x335f77['body']['id']){delete _0x335f77[_0x6105('0x4f')]['id'];}return db[_0x6105('0x46')][_0x6105('0x4d')]({'where':{'id':_0x335f77[_0x6105('0x4b')]['id']}})['then'](handleEntityNotFound(_0x242ae8,null))['then'](saveUpdates(_0x335f77[_0x6105('0x4f')],null))[_0x6105('0x29')](respondWithResult(_0x242ae8,null))['catch'](handleError(_0x242ae8,null));};exports[_0x6105('0x2a')]=function(_0x4bc153,_0x51bfa5){return db[_0x6105('0x46')][_0x6105('0x4d')]({'where':{'id':_0x4bc153[_0x6105('0x4b')]['id']}})[_0x6105('0x29')](handleEntityNotFound(_0x51bfa5,null))[_0x6105('0x29')](removeEntity(_0x51bfa5,null))[_0x6105('0x4a')](handleError(_0x51bfa5,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 04ee668..f208b1d 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 _0x3f71=['lodash','util','api','moment','request-promise','../../config/environment','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x2074b3,_0x54589c){var _0x3529e7=function(_0xfbe935){while(--_0xfbe935){_0x2074b3['push'](_0x2074b3['shift']());}};_0x3529e7(++_0x54589c);}(_0x3f71,0x90));var _0x13f7=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x3f71[_0x2f3794];return _0x1c9fbe;};'use strict';var _=require(_0x13f7('0x0'));var util=require(_0x13f7('0x1'));var logger=require('../../config/logger')(_0x13f7('0x2'));var moment=require(_0x13f7('0x3'));var BPromise=require('bluebird');var rp=require(_0x13f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x13f7('0x5'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x3be8ec,_0x5267f2){return _0x3be8ec[_0x13f7('0x6')](_0x13f7('0x7'),attributes,{'tableName':_0x13f7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ffc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','analytics_report_trees','lodash'];(function(_0x29bdac,_0x454ae8){var _0xbd61f7=function(_0x8d2b26){while(--_0x8d2b26){_0x29bdac['push'](_0x29bdac['shift']());}};_0xbd61f7(++_0x454ae8);}(_0x9ffc,0x128));var _0xc9ff=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0x9ffc[_0x38aeea];return _0x5e8d2c;};'use strict';var _=require(_0xc9ff('0x0'));var util=require(_0xc9ff('0x1'));var logger=require(_0xc9ff('0x2'))(_0xc9ff('0x3'));var moment=require(_0xc9ff('0x4'));var BPromise=require(_0xc9ff('0x5'));var rp=require(_0xc9ff('0x6'));var fs=require('fs');var path=require(_0xc9ff('0x7'));var rimraf=require(_0xc9ff('0x8'));var config=require(_0xc9ff('0x9'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0xf33ea5,_0x4fc10d){return _0xf33ea5['define']('AnalyticTreeReport',attributes,{'tableName':_0xc9ff('0xa'),'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 246bbd8..97944c6 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x1cb474,_0x224b1f){var _0x23da3a=function(_0x409414){while(--_0x409414){_0x1cb474['push'](_0x1cb474['shift']());}};_0x23da3a(++_0x224b1f);}(_0x1261,0x144));var _0x1126=function(_0x17e174,_0x4991f8){_0x17e174=_0x17e174-0x0;var _0x3f26f1=_0x1261[_0x17e174];return _0x3f26f1;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4c8eab,_0x498091){var _0x3ba7b1=function(_0x5393a0){while(--_0x5393a0){_0x4c8eab['push'](_0x4c8eab['shift']());}};_0x3ba7b1(++_0x498091);}(_0x5f2f,0x73));var _0xf5f2=function(_0x201818,_0x1b367e){_0x201818=_0x201818-0x0;var _0x4712b9=_0x5f2f[_0x201818];return _0x4712b9;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 5a9eaf3..0ec7929 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 _0x124e=['get','isAuthenticated','index','post','put','/:id','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller'];(function(_0x477376,_0x44a02b){var _0x4647a8=function(_0x58357e){while(--_0x58357e){_0x477376['push'](_0x477376['shift']());}};_0x4647a8(++_0x44a02b);}(_0x124e,0xc8));var _0xe124=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x124e[_0x4c6d6f];return _0x2d4478;};'use strict';var multer=require('multer');var util=require(_0xe124('0x0'));var path=require(_0xe124('0x1'));var timeout=require('connect-timeout');var express=require(_0xe124('0x2'));var router=express[_0xe124('0x3')]();var fs_extra=require(_0xe124('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe124('0x5'));var config=require(_0xe124('0x6'));var controller=require(_0xe124('0x7'));router[_0xe124('0x8')]('/',auth[_0xe124('0x9')](),controller[_0xe124('0xa')]);router[_0xe124('0x8')]('/:id',auth[_0xe124('0x9')](),controller['show']);router[_0xe124('0xb')]('/',auth[_0xe124('0x9')](),controller['create']);router[_0xe124('0xc')](_0xe124('0xd'),auth[_0xe124('0x9')](),controller['update']);router[_0xe124('0xe')](_0xe124('0xd'),auth[_0xe124('0x9')](),controller['destroy']);module[_0xe124('0xf')]=router; \ No newline at end of file +var _0xff49=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','update','delete','/:id','destroy','multer','util'];(function(_0x399bb7,_0x1c3d60){var _0x143661=function(_0x20426f){while(--_0x20426f){_0x399bb7['push'](_0x399bb7['shift']());}};_0x143661(++_0x1c3d60);}(_0xff49,0x166));var _0x9ff4=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0xff49[_0x23e6bb];return _0x1e3b4c;};'use strict';var multer=require(_0x9ff4('0x0'));var util=require(_0x9ff4('0x1'));var path=require(_0x9ff4('0x2'));var timeout=require(_0x9ff4('0x3'));var express=require(_0x9ff4('0x4'));var router=express[_0x9ff4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9ff4('0x6'));var config=require(_0x9ff4('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x9ff4('0x8')]('/',auth[_0x9ff4('0x9')](),controller[_0x9ff4('0xa')]);router[_0x9ff4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9ff4('0xb')]);router[_0x9ff4('0xc')]('/',auth['isAuthenticated'](),controller[_0x9ff4('0xd')]);router['put']('/:id',auth[_0x9ff4('0x9')](),controller[_0x9ff4('0xe')]);router[_0x9ff4('0xf')](_0x9ff4('0x10'),auth[_0x9ff4('0x9')](),controller[_0x9ff4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index a2aa8c0..a0b0517 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 _0x2621=['STRING','sequelize','exports'];(function(_0x5b3544,_0x4f679d){var _0x5d9a5a=function(_0x426cba){while(--_0x426cba){_0x5b3544['push'](_0x5b3544['shift']());}};_0x5d9a5a(++_0x4f679d);}(_0x2621,0x1d2));var _0x1262=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2621[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1262('0x0'));module[_0x1262('0x1')]={'name':{'type':Sequelize[_0x1262('0x2')]},'basename':{'type':Sequelize[_0x1262('0x2')]},'type':{'type':Sequelize[_0x1262('0x2')]}}; \ No newline at end of file +var _0xe57e=['sequelize','STRING'];(function(_0x439891,_0x23b4bf){var _0x3d4d4f=function(_0x3892a4){while(--_0x3892a4){_0x439891['push'](_0x439891['shift']());}};_0x3d4d4f(++_0x23b4bf);}(_0xe57e,0xf2));var _0xee57=function(_0x4249fe,_0x220376){_0x4249fe=_0x4249fe-0x0;var _0x1963f6=_0xe57e[_0x4249fe];return _0x1963f6;};'use strict';var Sequelize=require(_0xee57('0x0'));module['exports']={'name':{'type':Sequelize[_0xee57('0x1')]},'basename':{'type':Sequelize[_0xee57('0x1')]},'type':{'type':Sequelize[_0xee57('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index d1333ba..a23753a 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 _0x7c80=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','then','destroy','error','name','send','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','length','find','clone','omit','createdAt','updatedAt','body','create','originalname','basename','file','filename','mimetype','findOne','server/files/attachments/','join','offline-chat/','download','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra'];(function(_0x40bb0c,_0x1ebe98){var _0x58cb62=function(_0x3db876){while(--_0x3db876){_0x40bb0c['push'](_0x40bb0c['shift']());}};_0x58cb62(++_0x1ebe98);}(_0x7c80,0x14e));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x07c8('0x0'));var rimraf=require(_0x07c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x07c8('0x2'));var rp=require(_0x07c8('0x3'));var moment=require(_0x07c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x07c8('0x5'));var util=require('util');var path=require(_0x07c8('0x6'));var sox=require('sox');var csv=require(_0x07c8('0x7'));var ejs=require(_0x07c8('0x8'));var fs=require('fs');var fs_extra=require(_0x07c8('0x9'));var _=require('lodash');var squel=require(_0x07c8('0xa'));var crypto=require(_0x07c8('0xb'));var jsforce=require(_0x07c8('0xc'));var deskjs=require(_0x07c8('0xd'));var toCsv=require(_0x07c8('0x7'));var querystring=require(_0x07c8('0xe'));var Papa=require(_0x07c8('0xf'));var Redis=require(_0x07c8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x07c8('0x11'));var as=require(_0x07c8('0x12'));var hardwareService=require(_0x07c8('0x13'));var logger=require(_0x07c8('0x14'))(_0x07c8('0x15'));var utils=require('../../config/utils');var config=require(_0x07c8('0x16'));var licenseUtil=require(_0x07c8('0x17'));var db=require(_0x07c8('0x18'))['db'];function respondWithStatusCode(_0x4ce310,_0x442229){_0x442229=_0x442229||0xcc;return function(_0x80a74d){if(_0x80a74d){return _0x4ce310[_0x07c8('0x19')](_0x442229);}return _0x4ce310[_0x07c8('0x1a')](_0x442229)[_0x07c8('0x1b')]();};}function respondWithResult(_0x533550,_0x2e7541){_0x2e7541=_0x2e7541||0xc8;return function(_0xc0c5d3){if(_0xc0c5d3){return _0x533550[_0x07c8('0x1a')](_0x2e7541)[_0x07c8('0x1c')](_0xc0c5d3);}};}function respondWithFilteredResult(_0x19fcb2,_0x45f25b){return function(_0x159a86){if(_0x159a86){var _0x1c0653=typeof _0x45f25b[_0x07c8('0x1d')]===_0x07c8('0x1e')&&typeof _0x45f25b['limit']===_0x07c8('0x1e');var _0x1065cd=_0x159a86[_0x07c8('0x1f')];var _0x2f08f0=_0x1c0653?0x0:_0x45f25b[_0x07c8('0x1d')];var _0x13385d=_0x1c0653?_0x159a86['count']:_0x45f25b[_0x07c8('0x1d')]+_0x45f25b[_0x07c8('0x20')];var _0x3de4cb;if(_0x13385d>=_0x1065cd){_0x13385d=_0x1065cd;_0x3de4cb=0xc8;}else{_0x3de4cb=0xce;}_0x19fcb2[_0x07c8('0x1a')](_0x3de4cb);return _0x19fcb2[_0x07c8('0x21')](_0x07c8('0x22'),_0x2f08f0+'-'+_0x13385d+'/'+_0x1065cd)[_0x07c8('0x1c')](_0x159a86);}return null;};}function patchUpdates(_0x3d534a){return function(_0x400666){try{jsonpatch['apply'](_0x400666,_0x3d534a,!![]);}catch(_0x3af11c){return BPromise['reject'](_0x3af11c);}return _0x400666[_0x07c8('0x23')]();};}function saveUpdates(_0x351b03,_0x3400bb){return function(_0x30f957){if(_0x30f957){return _0x30f957['update'](_0x351b03)[_0x07c8('0x24')](function(_0x5637ef){return _0x5637ef;});}return null;};}function removeEntity(_0x5980d5,_0x3dd448){return function(_0xef80a2){if(_0xef80a2){return _0xef80a2[_0x07c8('0x25')]()['then'](function(){_0x5980d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x223801,_0x141619){return function(_0x1a9db0){if(!_0x1a9db0){_0x223801[_0x07c8('0x19')](0x194);}return _0x1a9db0;};}function handleError(_0x44a1bd,_0x3fa970){_0x3fa970=_0x3fa970||0x1f4;return function(_0x1bfc95){logger[_0x07c8('0x26')](_0x1bfc95['stack']);if(_0x1bfc95[_0x07c8('0x27')]){delete _0x1bfc95[_0x07c8('0x27')];}_0x44a1bd[_0x07c8('0x1a')](_0x3fa970)[_0x07c8('0x28')](_0x1bfc95);};}exports['index']=function(_0x3f50e8,_0x3ec698){var _0x5a47dc={},_0x4492e6={},_0xfa9299={'count':0x0,'rows':[]};var _0x5aeefc=_[_0x07c8('0x29')](db[_0x07c8('0x2a')][_0x07c8('0x2b')],function(_0x4ecd7c){return{'name':_0x4ecd7c[_0x07c8('0x2c')],'type':_0x4ecd7c[_0x07c8('0x2d')][_0x07c8('0x2e')]};});_0x4492e6[_0x07c8('0x2f')]=_[_0x07c8('0x29')](_0x5aeefc,'name');_0x4492e6[_0x07c8('0x30')]=_[_0x07c8('0x31')](_0x3f50e8['query']);_0x4492e6[_0x07c8('0x32')]=_[_0x07c8('0x33')](_0x4492e6[_0x07c8('0x2f')],_0x4492e6['query']);_0x5a47dc[_0x07c8('0x34')]=_['intersection'](_0x4492e6[_0x07c8('0x2f')],qs['fields'](_0x3f50e8['query'][_0x07c8('0x35')]));_0x5a47dc[_0x07c8('0x34')]=_0x5a47dc[_0x07c8('0x34')]['length']?_0x5a47dc['attributes']:_0x4492e6[_0x07c8('0x2f')];if(!_0x3f50e8[_0x07c8('0x30')][_0x07c8('0x36')](_0x07c8('0x37'))){_0x5a47dc[_0x07c8('0x20')]=qs[_0x07c8('0x20')](_0x3f50e8['query'][_0x07c8('0x20')]);_0x5a47dc['offset']=qs['offset'](_0x3f50e8[_0x07c8('0x30')][_0x07c8('0x1d')]);}_0x5a47dc[_0x07c8('0x38')]=qs['sort'](_0x3f50e8[_0x07c8('0x30')]['sort']);_0x5a47dc[_0x07c8('0x39')]=qs[_0x07c8('0x32')](_[_0x07c8('0x3a')](_0x3f50e8[_0x07c8('0x30')],_0x4492e6[_0x07c8('0x32')]),_0x5aeefc);if(_0x3f50e8[_0x07c8('0x30')][_0x07c8('0x3b')]){_0x5a47dc[_0x07c8('0x39')]=_[_0x07c8('0x3c')](_0x5a47dc[_0x07c8('0x39')],{'$or':_['map'](_0x5aeefc,function(_0x15c8f5){if(_0x15c8f5[_0x07c8('0x2d')]!=='VIRTUAL'){var _0x20ee95={};_0x20ee95[_0x15c8f5[_0x07c8('0x27')]]={'$like':'%'+_0x3f50e8[_0x07c8('0x30')][_0x07c8('0x3b')]+'%'};return _0x20ee95;}})});}_0x5a47dc=_[_0x07c8('0x3c')]({},_0x5a47dc,_0x3f50e8[_0x07c8('0x3d')]);var _0x186c25={'where':_0x5a47dc['where']};return db['Attachment'][_0x07c8('0x1f')](_0x186c25)[_0x07c8('0x24')](function(_0x13bf3c){_0xfa9299[_0x07c8('0x1f')]=_0x13bf3c;if(_0x3f50e8['query'][_0x07c8('0x3e')]){_0x5a47dc[_0x07c8('0x3f')]=[{'all':!![]}];}return db[_0x07c8('0x2a')][_0x07c8('0x40')](_0x5a47dc);})[_0x07c8('0x24')](function(_0x27c482){_0xfa9299['rows']=_0x27c482;return _0xfa9299;})['then'](respondWithFilteredResult(_0x3ec698,_0x5a47dc))[_0x07c8('0x41')](handleError(_0x3ec698,null));};exports[_0x07c8('0x42')]=function(_0x1acb34,_0xa8736f){var _0x1543ba={'raw':!![],'where':{'id':_0x1acb34[_0x07c8('0x43')]['id']}},_0x432ce2={};_0x432ce2[_0x07c8('0x2f')]=_[_0x07c8('0x31')](db['Attachment']['rawAttributes']);_0x432ce2[_0x07c8('0x30')]=_[_0x07c8('0x31')](_0x1acb34['query']);_0x432ce2['filters']=_[_0x07c8('0x33')](_0x432ce2['model'],_0x432ce2[_0x07c8('0x30')]);_0x1543ba[_0x07c8('0x34')]=_[_0x07c8('0x33')](_0x432ce2['model'],qs[_0x07c8('0x35')](_0x1acb34[_0x07c8('0x30')]['fields']));_0x1543ba[_0x07c8('0x34')]=_0x1543ba[_0x07c8('0x34')][_0x07c8('0x44')]?_0x1543ba[_0x07c8('0x34')]:_0x432ce2['model'];if(_0x1acb34['query'][_0x07c8('0x3e')]){_0x1543ba[_0x07c8('0x3f')]=[{'all':!![]}];}_0x1543ba=_[_0x07c8('0x3c')]({},_0x1543ba,_0x1acb34[_0x07c8('0x3d')]);return db[_0x07c8('0x2a')][_0x07c8('0x45')](_0x1543ba)[_0x07c8('0x24')](handleEntityNotFound(_0xa8736f,null))[_0x07c8('0x24')](respondWithResult(_0xa8736f,null))[_0x07c8('0x41')](handleError(_0xa8736f,null));};exports[_0x07c8('0x46')]=function(_0x1c27cf,_0x357165){var _0x5e9627={'where':{'id':_0x1c27cf['params']['id']}},_0x2dfff5={};_0x2dfff5[_0x07c8('0x2f')]=_[_0x07c8('0x31')](db[_0x07c8('0x2a')]['rawAttributes']);_0x5e9627[_0x07c8('0x34')]=_[_0x07c8('0x33')](_0x2dfff5['model'],qs[_0x07c8('0x35')](_0x1c27cf[_0x07c8('0x30')][_0x07c8('0x35')]));_0x5e9627[_0x07c8('0x34')]=_0x5e9627[_0x07c8('0x34')][_0x07c8('0x44')]?_0x5e9627[_0x07c8('0x34')]:_0x2dfff5[_0x07c8('0x2f')];if(_0x1c27cf[_0x07c8('0x30')]['includeAll']){_0x5e9627[_0x07c8('0x3f')]=[{'all':!![]}];}_0x5e9627=_['merge']({},_0x5e9627,_0x1c27cf[_0x07c8('0x3d')]);return db[_0x07c8('0x2a')][_0x07c8('0x45')](_0x5e9627)[_0x07c8('0x24')](handleEntityNotFound(_0x357165,null))[_0x07c8('0x24')](function(_0x2c0944){if(_0x2c0944){var _0x25cc71=_0x2c0944['get']({'plain':!![]});_0x25cc71=qs[_0x07c8('0x47')](_0x25cc71,['id',_0x07c8('0x48'),_0x07c8('0x49')]);_0x1c27cf[_0x07c8('0x4a')]=_[_0x07c8('0x47')](_0x1c27cf['body'],['id',_0x07c8('0x48'),_0x07c8('0x49')]);return db[_0x07c8('0x2a')][_0x07c8('0x4b')](_[_0x07c8('0x3c')](_0x25cc71,_0x1c27cf['body']),{'include':_0x1c27cf[_0x07c8('0x30')][_0x07c8('0x3e')]?[{'all':!![]}]:undefined});}})[_0x07c8('0x24')](respondWithResult(_0x357165,0xc9))['catch'](handleError(_0x357165,null));};exports['update']=function(_0x1e611a,_0x8b7c23){if(_0x1e611a[_0x07c8('0x4a')]['id']){delete _0x1e611a[_0x07c8('0x4a')]['id'];}return db['Attachment']['find']({'where':{'id':_0x1e611a[_0x07c8('0x43')]['id']}})['then'](handleEntityNotFound(_0x8b7c23,null))[_0x07c8('0x24')](saveUpdates(_0x1e611a['body'],null))[_0x07c8('0x24')](respondWithResult(_0x8b7c23,null))[_0x07c8('0x41')](handleError(_0x8b7c23,null));};exports['destroy']=function(_0x503cde,_0x144ca6){return db[_0x07c8('0x2a')][_0x07c8('0x45')]({'where':{'id':_0x503cde[_0x07c8('0x43')]['id']}})['then'](handleEntityNotFound(_0x144ca6,null))[_0x07c8('0x24')](removeEntity(_0x144ca6,null))[_0x07c8('0x41')](handleError(_0x144ca6,null));};exports[_0x07c8('0x4b')]=function(_0x1960a1,_0x6599ca,_0x460130){_0x1960a1[_0x07c8('0x4a')][_0x07c8('0x27')]=_0x1960a1['file'][_0x07c8('0x4c')];_0x1960a1[_0x07c8('0x4a')][_0x07c8('0x4d')]=_0x1960a1[_0x07c8('0x4e')][_0x07c8('0x4f')];_0x1960a1['body'][_0x07c8('0x2d')]=_0x1960a1[_0x07c8('0x4e')][_0x07c8('0x50')];return db[_0x07c8('0x2a')]['create'](_0x1960a1['body'])['then'](respondWithResult(_0x6599ca,0xc9))[_0x07c8('0x41')](handleError(_0x6599ca,null));};exports['download']=function(_0x2bedf0,_0x5645e5,_0x55e1f7){return db['Attachment'][_0x07c8('0x51')]({'where':{'id':_0x2bedf0['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5645e5,null))[_0x07c8('0x24')](function(_0x17036a){if(_0x17036a){var _0x37a0d2=_0x17036a['ChatOfflineMessageId']!==null;var _0x5f69c9=path['join'](config['root'],_0x07c8('0x52'));if(_0x37a0d2){_0x5f69c9=path[_0x07c8('0x53')](_0x5f69c9,_0x07c8('0x54'));}var _0x593cd0=path[_0x07c8('0x53')](_0x5f69c9,_0x17036a[_0x07c8('0x4d')]);return _0x5645e5[_0x07c8('0x55')](_0x593cd0);}})[_0x07c8('0x41')](handleError(_0x5645e5,null));}; \ No newline at end of file +var _0x8a56=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','find','options','get','omit','createdAt','body','updatedAt','create','originalname','file','filename','download','findOne','join','root','server/files/attachments/','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x8a56,0xa9));var _0x68a5=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x8a56[_0x2a276d];return _0x2914cd;};'use strict';var emlformat=require(_0x68a5('0x0'));var rimraf=require(_0x68a5('0x1'));var zipdir=require(_0x68a5('0x2'));var jsonpatch=require(_0x68a5('0x3'));var rp=require('request-promise');var moment=require(_0x68a5('0x4'));var BPromise=require(_0x68a5('0x5'));var Mustache=require(_0x68a5('0x6'));var util=require(_0x68a5('0x7'));var path=require(_0x68a5('0x8'));var sox=require(_0x68a5('0x9'));var csv=require('to-csv');var ejs=require(_0x68a5('0xa'));var fs=require('fs');var fs_extra=require(_0x68a5('0xb'));var _=require(_0x68a5('0xc'));var squel=require(_0x68a5('0xd'));var crypto=require(_0x68a5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x68a5('0xf'));var toCsv=require(_0x68a5('0x10'));var querystring=require(_0x68a5('0x11'));var Papa=require(_0x68a5('0x12'));var Redis=require(_0x68a5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x68a5('0x14'));var as=require(_0x68a5('0x15'));var hardwareService=require(_0x68a5('0x16'));var logger=require(_0x68a5('0x17'))('api');var utils=require(_0x68a5('0x18'));var config=require(_0x68a5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x68a5('0x1a'))['db'];function respondWithStatusCode(_0x482ddb,_0x1de6a2){_0x1de6a2=_0x1de6a2||0xcc;return function(_0xb8b20d){if(_0xb8b20d){return _0x482ddb[_0x68a5('0x1b')](_0x1de6a2);}return _0x482ddb[_0x68a5('0x1c')](_0x1de6a2)[_0x68a5('0x1d')]();};}function respondWithResult(_0x4b7993,_0x291f90){_0x291f90=_0x291f90||0xc8;return function(_0x29387d){if(_0x29387d){return _0x4b7993['status'](_0x291f90)[_0x68a5('0x1e')](_0x29387d);}};}function respondWithFilteredResult(_0x4a0d60,_0x38279a){return function(_0x2c795b){if(_0x2c795b){var _0x364c02=typeof _0x38279a[_0x68a5('0x1f')]==='undefined'&&typeof _0x38279a[_0x68a5('0x20')]===_0x68a5('0x21');var _0x150245=_0x2c795b[_0x68a5('0x22')];var _0x1cf20d=_0x364c02?0x0:_0x38279a[_0x68a5('0x1f')];var _0x2cfc82=_0x364c02?_0x2c795b[_0x68a5('0x22')]:_0x38279a[_0x68a5('0x1f')]+_0x38279a[_0x68a5('0x20')];var _0x220ff7;if(_0x2cfc82>=_0x150245){_0x2cfc82=_0x150245;_0x220ff7=0xc8;}else{_0x220ff7=0xce;}_0x4a0d60[_0x68a5('0x1c')](_0x220ff7);return _0x4a0d60[_0x68a5('0x23')](_0x68a5('0x24'),_0x1cf20d+'-'+_0x2cfc82+'/'+_0x150245)[_0x68a5('0x1e')](_0x2c795b);}return null;};}function patchUpdates(_0x47adc3){return function(_0xca5ad){try{jsonpatch[_0x68a5('0x25')](_0xca5ad,_0x47adc3,!![]);}catch(_0x2bf534){return BPromise[_0x68a5('0x26')](_0x2bf534);}return _0xca5ad[_0x68a5('0x27')]();};}function saveUpdates(_0xe8065a,_0x4cf8f7){return function(_0x310dfd){if(_0x310dfd){return _0x310dfd[_0x68a5('0x28')](_0xe8065a)['then'](function(_0x3df2ef){return _0x3df2ef;});}return null;};}function removeEntity(_0xee7858,_0x223a1b){return function(_0x4d71d0){if(_0x4d71d0){return _0x4d71d0[_0x68a5('0x29')]()[_0x68a5('0x2a')](function(){_0xee7858['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0c7f,_0x5fb8ee){return function(_0xffcb4){if(!_0xffcb4){_0x5a0c7f['sendStatus'](0x194);}return _0xffcb4;};}function handleError(_0x1fddae,_0x2049ea){_0x2049ea=_0x2049ea||0x1f4;return function(_0x3c094e){logger[_0x68a5('0x2b')](_0x3c094e['stack']);if(_0x3c094e[_0x68a5('0x2c')]){delete _0x3c094e[_0x68a5('0x2c')];}_0x1fddae[_0x68a5('0x1c')](_0x2049ea)[_0x68a5('0x2d')](_0x3c094e);};}exports[_0x68a5('0x2e')]=function(_0x5078ee,_0x2fc979){var _0x54bdb4={},_0x71f297={},_0xe29988={'count':0x0,'rows':[]};var _0x315a93=_[_0x68a5('0x2f')](db[_0x68a5('0x30')][_0x68a5('0x31')],function(_0x22fdd2){return{'name':_0x22fdd2[_0x68a5('0x32')],'type':_0x22fdd2[_0x68a5('0x33')][_0x68a5('0x34')]};});_0x71f297[_0x68a5('0x35')]=_['map'](_0x315a93,_0x68a5('0x2c'));_0x71f297[_0x68a5('0x36')]=_[_0x68a5('0x37')](_0x5078ee[_0x68a5('0x36')]);_0x71f297[_0x68a5('0x38')]=_['intersection'](_0x71f297['model'],_0x71f297['query']);_0x54bdb4[_0x68a5('0x39')]=_[_0x68a5('0x3a')](_0x71f297['model'],qs[_0x68a5('0x3b')](_0x5078ee[_0x68a5('0x36')]['fields']));_0x54bdb4[_0x68a5('0x39')]=_0x54bdb4[_0x68a5('0x39')][_0x68a5('0x3c')]?_0x54bdb4[_0x68a5('0x39')]:_0x71f297[_0x68a5('0x35')];if(!_0x5078ee['query'][_0x68a5('0x3d')](_0x68a5('0x3e'))){_0x54bdb4[_0x68a5('0x20')]=qs[_0x68a5('0x20')](_0x5078ee['query'][_0x68a5('0x20')]);_0x54bdb4[_0x68a5('0x1f')]=qs[_0x68a5('0x1f')](_0x5078ee['query']['offset']);}_0x54bdb4[_0x68a5('0x3f')]=qs[_0x68a5('0x40')](_0x5078ee[_0x68a5('0x36')][_0x68a5('0x40')]);_0x54bdb4[_0x68a5('0x41')]=qs[_0x68a5('0x38')](_[_0x68a5('0x42')](_0x5078ee[_0x68a5('0x36')],_0x71f297[_0x68a5('0x38')]),_0x315a93);if(_0x5078ee['query'][_0x68a5('0x43')]){_0x54bdb4['where']=_['merge'](_0x54bdb4[_0x68a5('0x41')],{'$or':_['map'](_0x315a93,function(_0xfb6c0d){if(_0xfb6c0d[_0x68a5('0x33')]!=='VIRTUAL'){var _0x345145={};_0x345145[_0xfb6c0d[_0x68a5('0x2c')]]={'$like':'%'+_0x5078ee[_0x68a5('0x36')][_0x68a5('0x43')]+'%'};return _0x345145;}})});}_0x54bdb4=_[_0x68a5('0x44')]({},_0x54bdb4,_0x5078ee['options']);var _0x5eee16={'where':_0x54bdb4[_0x68a5('0x41')]};return db[_0x68a5('0x30')][_0x68a5('0x22')](_0x5eee16)[_0x68a5('0x2a')](function(_0x12fb9f){_0xe29988['count']=_0x12fb9f;if(_0x5078ee[_0x68a5('0x36')][_0x68a5('0x45')]){_0x54bdb4[_0x68a5('0x46')]=[{'all':!![]}];}return db[_0x68a5('0x30')][_0x68a5('0x47')](_0x54bdb4);})['then'](function(_0x5a5b4c){_0xe29988[_0x68a5('0x48')]=_0x5a5b4c;return _0xe29988;})[_0x68a5('0x2a')](respondWithFilteredResult(_0x2fc979,_0x54bdb4))[_0x68a5('0x49')](handleError(_0x2fc979,null));};exports['show']=function(_0x1c0002,_0x3e6c73){var _0x16178f={'raw':!![],'where':{'id':_0x1c0002[_0x68a5('0x4a')]['id']}},_0x4266fe={};_0x4266fe[_0x68a5('0x35')]=_['keys'](db[_0x68a5('0x30')][_0x68a5('0x31')]);_0x4266fe[_0x68a5('0x36')]=_[_0x68a5('0x37')](_0x1c0002['query']);_0x4266fe[_0x68a5('0x38')]=_[_0x68a5('0x3a')](_0x4266fe[_0x68a5('0x35')],_0x4266fe[_0x68a5('0x36')]);_0x16178f[_0x68a5('0x39')]=_[_0x68a5('0x3a')](_0x4266fe[_0x68a5('0x35')],qs[_0x68a5('0x3b')](_0x1c0002[_0x68a5('0x36')][_0x68a5('0x3b')]));_0x16178f[_0x68a5('0x39')]=_0x16178f[_0x68a5('0x39')][_0x68a5('0x3c')]?_0x16178f['attributes']:_0x4266fe[_0x68a5('0x35')];if(_0x1c0002[_0x68a5('0x36')][_0x68a5('0x45')]){_0x16178f[_0x68a5('0x46')]=[{'all':!![]}];}_0x16178f=_[_0x68a5('0x44')]({},_0x16178f,_0x1c0002['options']);return db[_0x68a5('0x30')][_0x68a5('0x4b')](_0x16178f)[_0x68a5('0x2a')](handleEntityNotFound(_0x3e6c73,null))[_0x68a5('0x2a')](respondWithResult(_0x3e6c73,null))[_0x68a5('0x49')](handleError(_0x3e6c73,null));};exports['clone']=function(_0x4f18b4,_0x1ac394){var _0x44b2f5={'where':{'id':_0x4f18b4['params']['id']}},_0x1b6b58={};_0x1b6b58[_0x68a5('0x35')]=_[_0x68a5('0x37')](db[_0x68a5('0x30')][_0x68a5('0x31')]);_0x44b2f5[_0x68a5('0x39')]=_[_0x68a5('0x3a')](_0x1b6b58['model'],qs[_0x68a5('0x3b')](_0x4f18b4['query'][_0x68a5('0x3b')]));_0x44b2f5['attributes']=_0x44b2f5['attributes'][_0x68a5('0x3c')]?_0x44b2f5[_0x68a5('0x39')]:_0x1b6b58[_0x68a5('0x35')];if(_0x4f18b4[_0x68a5('0x36')]['includeAll']){_0x44b2f5['include']=[{'all':!![]}];}_0x44b2f5=_[_0x68a5('0x44')]({},_0x44b2f5,_0x4f18b4[_0x68a5('0x4c')]);return db['Attachment']['find'](_0x44b2f5)[_0x68a5('0x2a')](handleEntityNotFound(_0x1ac394,null))['then'](function(_0x16a555){if(_0x16a555){var _0x4ee585=_0x16a555[_0x68a5('0x4d')]({'plain':!![]});_0x4ee585=qs[_0x68a5('0x4e')](_0x4ee585,['id',_0x68a5('0x4f'),'updatedAt']);_0x4f18b4[_0x68a5('0x50')]=_[_0x68a5('0x4e')](_0x4f18b4[_0x68a5('0x50')],['id','createdAt',_0x68a5('0x51')]);return db[_0x68a5('0x30')][_0x68a5('0x52')](_[_0x68a5('0x44')](_0x4ee585,_0x4f18b4['body']),{'include':_0x4f18b4[_0x68a5('0x36')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x68a5('0x2a')](respondWithResult(_0x1ac394,0xc9))[_0x68a5('0x49')](handleError(_0x1ac394,null));};exports[_0x68a5('0x28')]=function(_0x275b3c,_0x2ed13f){if(_0x275b3c[_0x68a5('0x50')]['id']){delete _0x275b3c['body']['id'];}return db[_0x68a5('0x30')][_0x68a5('0x4b')]({'where':{'id':_0x275b3c[_0x68a5('0x4a')]['id']}})[_0x68a5('0x2a')](handleEntityNotFound(_0x2ed13f,null))['then'](saveUpdates(_0x275b3c[_0x68a5('0x50')],null))[_0x68a5('0x2a')](respondWithResult(_0x2ed13f,null))[_0x68a5('0x49')](handleError(_0x2ed13f,null));};exports[_0x68a5('0x29')]=function(_0xc4fb9d,_0x410eb6){return db['Attachment']['find']({'where':{'id':_0xc4fb9d[_0x68a5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x410eb6,null))[_0x68a5('0x2a')](removeEntity(_0x410eb6,null))[_0x68a5('0x49')](handleError(_0x410eb6,null));};exports[_0x68a5('0x52')]=function(_0x5211da,_0x17c1b1,_0x6ace5c){_0x5211da['body'][_0x68a5('0x2c')]=_0x5211da['file'][_0x68a5('0x53')];_0x5211da[_0x68a5('0x50')]['basename']=_0x5211da[_0x68a5('0x54')][_0x68a5('0x55')];_0x5211da['body'][_0x68a5('0x33')]=_0x5211da['file']['mimetype'];return db[_0x68a5('0x30')][_0x68a5('0x52')](_0x5211da['body'])[_0x68a5('0x2a')](respondWithResult(_0x17c1b1,0xc9))[_0x68a5('0x49')](handleError(_0x17c1b1,null));};exports[_0x68a5('0x56')]=function(_0x10466d,_0xe1ebf6,_0x42dfb4){return db[_0x68a5('0x30')][_0x68a5('0x57')]({'where':{'id':_0x10466d['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0xe1ebf6,null))[_0x68a5('0x2a')](function(_0x11d02c){if(_0x11d02c){var _0x5446db=_0x11d02c['ChatOfflineMessageId']!==null;var _0x3e143c=path[_0x68a5('0x58')](config[_0x68a5('0x59')],_0x68a5('0x5a'));if(_0x5446db){_0x3e143c=path[_0x68a5('0x58')](_0x3e143c,'offline-chat/');}var _0x23b3f8=path[_0x68a5('0x58')](_0x3e143c,_0x11d02c[_0x68a5('0x5b')]);return _0xe1ebf6[_0x68a5('0x56')](_0x23b3f8);}})[_0x68a5('0x49')](handleError(_0xe1ebf6,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 89dae28..651ba71 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 _0x3d09=['bluebird','request-promise','rimraf','./attachment.attributes','exports','define','Attachment','attachments','lodash','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3d09,0x116));var _0x93d0=function(_0x2c942b,_0x12ff28){_0x2c942b=_0x2c942b-0x0;var _0x1a5484=_0x3d09[_0x2c942b];return _0x1a5484;};'use strict';var _=require(_0x93d0('0x0'));var util=require(_0x93d0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x93d0('0x2'));var rp=require(_0x93d0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93d0('0x4'));var config=require('../../config/environment');var attributes=require(_0x93d0('0x5'));module[_0x93d0('0x6')]=function(_0x4af8fe,_0xf0ef4c){return _0x4af8fe[_0x93d0('0x7')](_0x93d0('0x8'),attributes,{'tableName':_0x93d0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bfb=['bluebird','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0x0bfb,0x1c2));var _0xb0bf=function(_0x19aa96,_0x344462){_0x19aa96=_0x19aa96-0x0;var _0x4ae3b5=_0x0bfb[_0x19aa96];return _0x4ae3b5;};'use strict';var _=require(_0xb0bf('0x0'));var util=require(_0xb0bf('0x1'));var logger=require(_0xb0bf('0x2'))(_0xb0bf('0x3'));var moment=require(_0xb0bf('0x4'));var BPromise=require(_0xb0bf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0bf('0x6'));var config=require(_0xb0bf('0x7'));var attributes=require(_0xb0bf('0x8'));module[_0xb0bf('0x9')]=function(_0x1f6d1c,_0x446bab){return _0x1f6d1c[_0xb0bf('0xa')](_0xb0bf('0xb'),attributes,{'tableName':_0xb0bf('0xc'),'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 a9911c7..3493ceb 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 _0x544a=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateAttachment','Attachment','create','options','raw','then','stringify','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x544a,0xbd));var _0xa544=function(_0x416283,_0x439386){_0x416283=_0x416283-0x0;var _0x49c256=_0x544a[_0x416283];return _0x49c256;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require(_0xa544('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa544('0x4'));var logger=require(_0xa544('0x5'))('rpc');var config=require(_0xa544('0x6'));var jayson=require(_0xa544('0x7'));var client=jayson[_0xa544('0x8')][_0xa544('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39caac,_0x543cd1,_0x407443){return new BPromise(function(_0x495819,_0x39bcd7){return client[_0xa544('0xa')](_0x39caac,_0x407443)['then'](function(_0x2e9a6a){logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,_0xa544('0xd'));logger['debug'](_0xa544('0xe'),_0x543cd1,_0xa544('0xd'),JSON['stringify'](_0x2e9a6a));if(_0x2e9a6a[_0xa544('0xf')]){if(_0x2e9a6a['error'][_0xa544('0x10')]===0x1f4){logger[_0xa544('0xf')]('Attachment,\x20%s,\x20%s',_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x39bcd7(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x495819(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}else{logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,'request\x20sent');_0x495819(_0x2e9a6a[_0xa544('0x12')][_0xa544('0x11')]);}})['catch'](function(_0x9093bd){logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x9093bd);_0x39bcd7(_0x9093bd);});});}exports[_0xa544('0x13')]=function(_0x2c5ae8){var _0x297298=this;return new Promise(function(_0x1f3fcc,_0x44ccd3){return db[_0xa544('0x14')][_0xa544('0x15')](_0x2c5ae8['body'],{'raw':_0x2c5ae8['options']?_0x2c5ae8[_0xa544('0x16')][_0xa544('0x17')]===undefined?!![]:![]:!![]})[_0xa544('0x18')](function(_0x57a154){logger[_0xa544('0xb')](_0xa544('0x13'),_0x2c5ae8);logger['debug'](_0xa544('0x13'),_0x2c5ae8,JSON[_0xa544('0x19')](_0x57a154));_0x1f3fcc(_0x57a154);})[_0xa544('0x1a')](function(_0xb7df3d){logger[_0xa544('0xf')]('CreateAttachment',_0xb7df3d['message'],_0x2c5ae8);_0x44ccd3(_0x297298[_0xa544('0xf')](0x1f4,_0xb7df3d['message']));});});}; \ No newline at end of file +var _0xfe57=['error','code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','create','body','options','info','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug'];(function(_0xb7988b,_0x16b8c3){var _0x497057=function(_0x286bca){while(--_0x286bca){_0xb7988b['push'](_0xb7988b['shift']());}};_0x497057(++_0x16b8c3);}(_0xfe57,0x195));var _0x7fe5=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xfe57[_0x44216d];return _0xeca523;};'use strict';var _=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7fe5('0x2'));var fs=require('fs');var Redis=require(_0x7fe5('0x3'));var db=require(_0x7fe5('0x4'))['db'];var utils=require(_0x7fe5('0x5'));var logger=require(_0x7fe5('0x6'))(_0x7fe5('0x7'));var config=require(_0x7fe5('0x8'));var jayson=require(_0x7fe5('0x9'));var client=jayson[_0x7fe5('0xa')][_0x7fe5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd6146b,_0x2632de,_0x36ff81){return new BPromise(function(_0x4ab081,_0x13b391){return client['request'](_0xd6146b,_0x36ff81)[_0x7fe5('0xc')](function(_0x2ae7f3){logger['info']('Attachment,\x20%s,\x20%s',_0x2632de,_0x7fe5('0xd'));logger[_0x7fe5('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x2632de,_0x7fe5('0xd'),JSON['stringify'](_0x2ae7f3));if(_0x2ae7f3['error']){if(_0x2ae7f3[_0x7fe5('0xf')][_0x7fe5('0x10')]===0x1f4){logger[_0x7fe5('0xf')](_0x7fe5('0x11'),_0x2632de,_0x2ae7f3['error'][_0x7fe5('0x12')]);return _0x13b391(_0x2ae7f3[_0x7fe5('0xf')]['message']);}logger[_0x7fe5('0xf')]('Attachment,\x20%s,\x20%s',_0x2632de,_0x2ae7f3[_0x7fe5('0xf')][_0x7fe5('0x12')]);return _0x4ab081(_0x2ae7f3['error'][_0x7fe5('0x12')]);}else{logger['info'](_0x7fe5('0x11'),_0x2632de,_0x7fe5('0xd'));_0x4ab081(_0x2ae7f3[_0x7fe5('0x13')][_0x7fe5('0x12')]);}})[_0x7fe5('0x14')](function(_0x104bc8){logger['error'](_0x7fe5('0x11'),_0x2632de,_0x104bc8);_0x13b391(_0x104bc8);});});}exports[_0x7fe5('0x15')]=function(_0x340d5e){var _0x1be963=this;return new Promise(function(_0x2533db,_0x9a3022){return db[_0x7fe5('0x16')][_0x7fe5('0x17')](_0x340d5e[_0x7fe5('0x18')],{'raw':_0x340d5e[_0x7fe5('0x19')]?_0x340d5e['options']['raw']===undefined?!![]:![]:!![]})[_0x7fe5('0xc')](function(_0x459c2d){logger[_0x7fe5('0x1a')](_0x7fe5('0x15'),_0x340d5e);logger[_0x7fe5('0xe')](_0x7fe5('0x15'),_0x340d5e,JSON[_0x7fe5('0x1b')](_0x459c2d));_0x2533db(_0x459c2d);})[_0x7fe5('0x14')](function(_0x1b271c){logger[_0x7fe5('0xf')](_0x7fe5('0x15'),_0x1b271c[_0x7fe5('0x12')],_0x340d5e);_0x9a3022(_0x1be963['error'](0x1f4,_0x1b271c[_0x7fe5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 188a92c..841edfc 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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0x0b0e[_0x3daa8c];return _0x2b1bd7;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x467f93,_0x17f986){_0x467f93=_0x467f93-0x0;var _0x5614d4=_0xdb28[_0x467f93];return _0x5614d4;};'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('./attachment.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['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 9533329..026a680 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9208=['url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','online','admin','blocked','blockedAt','add','clearBlockUser','getLicense','catch','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','User','passport','passport-local','moment','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','baseDN'];(function(_0x2fea0b,_0x1427b2){var _0x80f5ec=function(_0x3070c2){while(--_0x3070c2){_0x2fea0b['push'](_0x2fea0b['shift']());}};_0x80f5ec(++_0x1427b2);}(_0x9208,0x108));var _0x8920=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9208[_0x20a584];return _0x4b41a8;};'use strict';var passport=require(_0x8920('0x0'));var LocalStrategy=require(_0x8920('0x1'))['Strategy'];var moment=require(_0x8920('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0x8920('0x3'));var db=require(_0x8920('0x4'))['db'];var authService=require(_0x8920('0x5'));var utils=require(_0x8920('0x6'));var config=require('../../config/environment');var logger=require(_0x8920('0x7'))(_0x8920('0x8'));function isActiveDirectoryConfigured(_0x194026){var _0x54eb58=![];if(typeof _0x194026[_0x8920('0x9')]!==_0x8920('0xa')){_0x54eb58=_0x194026[_0x8920('0x9')][_0x8920('0xb')]&&_0x194026[_0x8920('0x9')][_0x8920('0xc')]&&_0x194026[_0x8920('0x9')][_0x8920('0xd')];}return _0x54eb58;}function adAuthenticate(_0x5055aa,_0x2de879,_0xf815e){return new BPromise(function(_0x2fb0cb,_0x5dc0e2){try{var _0x4a5d3f=new ActiveDirectory(_0x5055aa);_0x4a5d3f[_0x8920('0xe')](_0x2de879,_0xf815e,function(_0x32dce0,_0x4ed3d2){if(_0x32dce0){logger[_0x8920('0xf')](_0x8920('0x10'),_0x2de879,util['inspect'](_0x32dce0,{'showHidden':![],'depth':null}));_0x5dc0e2(_0x8920('0x11'));}else if(!_0x4ed3d2){logger['error'](_0x8920('0x12'),_0x2de879);_0x5dc0e2(_0x8920('0x11'));}else{_0x2fb0cb(_0x4ed3d2);}});}catch(_0x459d5b){_0x5dc0e2(_0x459d5b);}});}function ActiveDirectoryAuthenticate(_0x38c2ba,_0xbf51ed,_0x2a8816,_0x315434){var _0x131f9a,_0x2c7ab7;if(!isActiveDirectoryConfigured(config)){logger[_0x8920('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0xbf51ed);return _0x315434(null,![],{'message':_0x8920('0x11')});}return db[_0x8920('0x13')][_0x8920('0x14')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x8920('0x15')],'raw':!![]})[_0x8920('0x16')](function(_0x5cb40b){_0x131f9a=_0x5cb40b;if(!_0x131f9a[_0x8920('0x17')]){logger[_0x8920('0xf')](_0x8920('0x18'),_0xbf51ed);throw new Error(_0x8920('0x11'));}return _0x38c2ba[_0x8920('0x14')]({'attributes':['id',_0x8920('0x19'),_0x8920('0x1a'),_0x8920('0x1b'),_0x8920('0x1c'),_0x8920('0x1d'),'blocked','blockedAt',_0x8920('0x1e')],'where':{'name':_0xbf51ed,'role':{'$or':[_0x8920('0x1f'),'user','agent']},'adSsoEnabled':!![]}});})['then'](function(_0x11395e){if(!_0x11395e||_0x11395e&&_0x11395e[_0x8920('0x19')]!==_0xbf51ed){throw new Error(_0x8920('0x11'));}_0x2c7ab7=_0x11395e;var _0x307f52=_0x2c7ab7['name']+'@'+config[_0x8920('0x9')][_0x8920('0xd')];return adAuthenticate(config[_0x8920('0x9')],_0x307f52,_0x2a8816);})['then'](function(_0xfb4634){if(_0x2c7ab7[_0x8920('0x1d')]){throw new Error(_0x8920('0x11'));}if(_0x131f9a[_0x8920('0x15')]>0x0){if(_0x2c7ab7[_0x8920('0x20')]){if(moment(_0x2c7ab7[_0x8920('0x21')])[_0x8920('0x22')](_0x131f9a[_0x8920('0x15')],'minutes')>moment()){throw new Error(_0x8920('0x11'));}return utils[_0x8920('0x23')](_0x2c7ab7,0x0,![],null)['then'](function(){return utils['getLicense'](_0x2c7ab7);})[_0x8920('0x16')](function(){return _0x315434(null,_0x2c7ab7);});}else{return utils[_0x8920('0x24')](_0x2c7ab7)[_0x8920('0x16')](function(){return _0x315434(null,_0x2c7ab7);});}}else{return utils[_0x8920('0x24')](_0x2c7ab7)[_0x8920('0x16')](function(){return _0x315434(null,_0x2c7ab7);});}})[_0x8920('0x25')](function(_0x47407e){return _0x315434(null,![],_0x47407e);});}function handleError(_0x3e4e23,_0x2485d6,_0xc898b9){return _0x3e4e23[_0x8920('0x26')](_0x2485d6||0x1f4)['send']({'message':_0xc898b9?_0xc898b9[_0x8920('0x27')]||_0xc898b9:''});}exports[_0x8920('0x28')]=function(_0x4a294e,_0x53bf09,_0x5304b0){passport['authenticate'](_0x8920('0x29'),function(_0x5116fd,_0x3a5eea,_0x17b87e){var _0x409418=_0x5116fd||_0x17b87e;if(_0x409418){return handleError(_0x53bf09,0x191,_0x409418);}if(!_0x3a5eea){return handleError(_0x53bf09,0x194,{'message':_0x8920('0x2a')});}else{var _0x31506b={'payload':{'id':_0x3a5eea['id'],'role':_0x3a5eea[_0x8920('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0x8920('0x2b')](_0x31506b)[_0x8920('0x16')](function(_0x50ceca){_0x53bf09['json']({'id':_0x3a5eea['id'],'token':_0x50ceca,'statusCall':'','isAlreadyLogged':_0x3a5eea[_0x8920('0x1e')]});});}})(_0x4a294e,_0x53bf09,_0x5304b0);};passport[_0x8920('0x2c')](_0x8920('0x29'),new LocalStrategy({'usernameField':_0x8920('0x19'),'passwordField':_0x8920('0x1a')},function(_0x193aec,_0x4ec767,_0x1a7380){return ActiveDirectoryAuthenticate(db[_0x8920('0x2d')],_0x193aec,_0x4ec767,_0x1a7380);})); \ No newline at end of file +var _0x961e=['../../config/environment','../../config/logger','api','activedirectory','baseDN','url','domain','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Setting','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','role','blocked','blockedAt','admin','user','then','disabled','minutes','getLicense','catch','status','send','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','User','Strategy','moment','activedirectory2','bluebird','../../components/auth/service','../../config/utils'];(function(_0x53c901,_0x49a8fc){var _0x4d0abd=function(_0x1716a9){while(--_0x1716a9){_0x53c901['push'](_0x53c901['shift']());}};_0x4d0abd(++_0x49a8fc);}(_0x961e,0x1a8));var _0xe961=function(_0x5994a0,_0x5ea37c){_0x5994a0=_0x5994a0-0x0;var _0x310e32=_0x961e[_0x5994a0];return _0x310e32;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0xe961('0x0')];var moment=require(_0xe961('0x1'));var ActiveDirectory=require(_0xe961('0x2'));var BPromise=require(_0xe961('0x3'));var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0xe961('0x4'));var utils=require(_0xe961('0x5'));var config=require(_0xe961('0x6'));var logger=require(_0xe961('0x7'))(_0xe961('0x8'));function isActiveDirectoryConfigured(_0x53b6f5){var _0x32c931=![];if(typeof _0x53b6f5[_0xe961('0x9')]!=='undefined'){_0x32c931=_0x53b6f5[_0xe961('0x9')][_0xe961('0xa')]&&_0x53b6f5[_0xe961('0x9')][_0xe961('0xb')]&&_0x53b6f5['activedirectory'][_0xe961('0xc')];}return _0x32c931;}function adAuthenticate(_0x27f893,_0x545d9b,_0xb706ff){return new BPromise(function(_0xe78f10,_0x5d408f){try{var _0x37a210=new ActiveDirectory(_0x27f893);_0x37a210['authenticate'](_0x545d9b,_0xb706ff,function(_0x288e9a,_0x217074){if(_0x288e9a){logger['error'](_0xe961('0xd'),_0x545d9b,util['inspect'](_0x288e9a,{'showHidden':![],'depth':null}));_0x5d408f(_0xe961('0xe'));}else if(!_0x217074){logger[_0xe961('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x545d9b);_0x5d408f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xe78f10(_0x217074);}});}catch(_0x446bde){_0x5d408f(_0x446bde);}});}function ActiveDirectoryAuthenticate(_0x367570,_0x45ed82,_0x39572e,_0x5a0c07){var _0x4d00f5,_0x59e1d6;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x45ed82);return _0x5a0c07(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xe961('0x10')]['findOne']({'where':{'id':0x1},'attributes':[_0xe961('0x11'),_0xe961('0x12')],'raw':!![]})['then'](function(_0x55193a){_0x4d00f5=_0x55193a;if(!_0x4d00f5[_0xe961('0x11')]){logger[_0xe961('0xf')](_0xe961('0x13'),_0x45ed82);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x367570[_0xe961('0x14')]({'attributes':['id',_0xe961('0x15'),_0xe961('0x16'),'salt',_0xe961('0x17'),'disabled',_0xe961('0x18'),_0xe961('0x19'),'online'],'where':{'name':_0x45ed82,'role':{'$or':[_0xe961('0x1a'),_0xe961('0x1b'),'agent']},'adSsoEnabled':!![]}});})[_0xe961('0x1c')](function(_0x183e1b){if(!_0x183e1b||_0x183e1b&&_0x183e1b[_0xe961('0x15')]!==_0x45ed82){throw new Error(_0xe961('0xe'));}_0x59e1d6=_0x183e1b;var _0x11a177=_0x59e1d6[_0xe961('0x15')]+'@'+config[_0xe961('0x9')][_0xe961('0xc')];return adAuthenticate(config[_0xe961('0x9')],_0x11a177,_0x39572e);})[_0xe961('0x1c')](function(_0x1a321f){if(_0x59e1d6[_0xe961('0x1d')]){throw new Error(_0xe961('0xe'));}if(_0x4d00f5[_0xe961('0x12')]>0x0){if(_0x59e1d6['blocked']){if(moment(_0x59e1d6[_0xe961('0x19')])['add'](_0x4d00f5[_0xe961('0x12')],_0xe961('0x1e'))>moment()){throw new Error(_0xe961('0xe'));}return utils['clearBlockUser'](_0x59e1d6,0x0,![],null)[_0xe961('0x1c')](function(){return utils[_0xe961('0x1f')](_0x59e1d6);})[_0xe961('0x1c')](function(){return _0x5a0c07(null,_0x59e1d6);});}else{return utils[_0xe961('0x1f')](_0x59e1d6)[_0xe961('0x1c')](function(){return _0x5a0c07(null,_0x59e1d6);});}}else{return utils['getLicense'](_0x59e1d6)[_0xe961('0x1c')](function(){return _0x5a0c07(null,_0x59e1d6);});}})[_0xe961('0x20')](function(_0x4e290a){return _0x5a0c07(null,![],_0x4e290a);});}function handleError(_0x3566fe,_0x2a628b,_0x369bc0){return _0x3566fe[_0xe961('0x21')](_0x2a628b||0x1f4)[_0xe961('0x22')]({'message':_0x369bc0?_0x369bc0['message']||_0x369bc0:''});}exports[_0xe961('0x23')]=function(_0x361373,_0x5716f7,_0x191660){passport[_0xe961('0x24')]('ad-login',function(_0x33f720,_0x346e73,_0x494602){var _0x5c3c7b=_0x33f720||_0x494602;if(_0x5c3c7b){return handleError(_0x5716f7,0x191,_0x5c3c7b);}if(!_0x346e73){return handleError(_0x5716f7,0x194,{'message':_0xe961('0x25')});}else{var _0x15e691={'payload':{'id':_0x346e73['id'],'role':_0x346e73[_0xe961('0x17')]},'options':{'expiresIn':0x15180}};return authService[_0xe961('0x26')](_0x15e691)['then'](function(_0x4eb53d){_0x5716f7[_0xe961('0x27')]({'id':_0x346e73['id'],'token':_0x4eb53d,'statusCall':'','isAlreadyLogged':_0x346e73['online']});});}})(_0x361373,_0x5716f7,_0x191660);};passport[_0xe961('0x28')](_0xe961('0x29'),new LocalStrategy({'usernameField':'name','passwordField':_0xe961('0x16')},function(_0x4c7201,_0x2c8f38,_0x31f319){return ActiveDirectoryAuthenticate(db[_0xe961('0x2a')],_0x4c7201,_0x2c8f38,_0x31f319);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index f57e0f8..e73dac9 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d8e=['post','login','exports','Router'];(function(_0x135f3d,_0x1f427d){var _0x4418cf=function(_0x5a751a){while(--_0x5a751a){_0x135f3d['push'](_0x135f3d['shift']());}};_0x4418cf(++_0x1f427d);}(_0x3d8e,0x13b));var _0xe3d8=function(_0x264f48,_0x2c82d8){_0x264f48=_0x264f48-0x0;var _0xb99167=_0x3d8e[_0x264f48];return _0xb99167;};'use strict';var express=require('express');var router=express[_0xe3d8('0x0')]();var controller=require('./authActiveDirectory.controller');router[_0xe3d8('0x1')]('/',controller[_0xe3d8('0x2')]);module[_0xe3d8('0x3')]=router; \ No newline at end of file +var _0x52e2=['Router','login','exports'];(function(_0x416525,_0x347f23){var _0x346357=function(_0x16cbd9){while(--_0x16cbd9){_0x416525['push'](_0x416525['shift']());}};_0x346357(++_0x347f23);}(_0x52e2,0x165));var _0x252e=function(_0x5676df,_0x14d122){_0x5676df=_0x5676df-0x0;var _0x1fb878=_0x52e2[_0x5676df];return _0x1fb878;};'use strict';var express=require('express');var router=express[_0x252e('0x0')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0x252e('0x1')]);module[_0x252e('0x2')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 814b2e0..e5f02c0 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 _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x34bcf6,_0x2cc521){var _0x54adc9=function(_0x2a8f15){while(--_0x2a8f15){_0x34bcf6['push'](_0x34bcf6['shift']());}};_0x54adc9(++_0x2cc521);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7a54,0x106));var _0x47a5=function(_0x49fef8,_0x5e35e1){_0x49fef8=_0x49fef8-0x0;var _0x5a19c1=_0x7a54[_0x49fef8];return _0x5a19c1;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index e2da826..1120b2f 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 _0xce0d=['isMiddleware','login','setTokenCookie','exports','express','passport','./authGoogle.controller','../../components/auth/service','get','/callback','callback'];(function(_0x2fa661,_0x5a69e9){var _0x113676=function(_0x95597e){while(--_0x95597e){_0x2fa661['push'](_0x2fa661['shift']());}};_0x113676(++_0x5a69e9);}(_0xce0d,0x9e));var _0xdce0=function(_0x2dd6b1,_0x4485d7){_0x2dd6b1=_0x2dd6b1-0x0;var _0x494306=_0xce0d[_0x2dd6b1];return _0x494306;};'use strict';var express=require(_0xdce0('0x0'));var passport=require(_0xdce0('0x1'));var router=express['Router']();var controller=require(_0xdce0('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xdce0('0x3'));router[_0xdce0('0x4')]('/',controller['login']);router[_0xdce0('0x4')](_0xdce0('0x5'),controller[_0xdce0('0x6')],authService[_0xdce0('0x7')],userController[_0xdce0('0x8')],authService[_0xdce0('0x9')]);module[_0xdce0('0xa')]=router; \ No newline at end of file +var _0xf967=['../../components/auth/service','login','/callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x10b991,_0x3dce8d){var _0x55937d=function(_0x1e6315){while(--_0x1e6315){_0x10b991['push'](_0x10b991['shift']());}};_0x55937d(++_0x3dce8d);}(_0xf967,0x12f));var _0x7f96=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf967[_0x3b380d];return _0x54502b;};'use strict';var express=require(_0x7f96('0x0'));var passport=require(_0x7f96('0x1'));var router=express[_0x7f96('0x2')]();var controller=require(_0x7f96('0x3'));var userController=require(_0x7f96('0x4'));var authService=require(_0x7f96('0x5'));router['get']('/',controller[_0x7f96('0x6')]);router['get'](_0x7f96('0x7'),controller['callback'],authService[_0x7f96('0x8')],userController[_0x7f96('0x6')],authService[_0x7f96('0x9')]);module[_0x7f96('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 7176df8..272389b 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 _0x24c4=['previousPasswords','validatePasswordHistory','resetPasswordExpires','send','Password\x20reset!','use','local-login','util','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','blockDuration','minutes','getLicense','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','Email\x20parameter\x20is\x20missing','body','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','Reset\x20Email\x20sent!','catch','reset','enforcePasswordHistory','securePassword','validatePasswordPattern'];(function(_0x2d3be8,_0x29449c){var _0x11cd94=function(_0x4b38da){while(--_0x4b38da){_0x2d3be8['push'](_0x2d3be8['shift']());}};_0x11cd94(++_0x29449c);}(_0x24c4,0x1cf));var _0x424c=function(_0x190844,_0x556c10){_0x190844=_0x190844-0x0;var _0x10b2db=_0x24c4[_0x190844];return _0x10b2db;};'use strict';var util=require(_0x424c('0x0'));var passport=require('passport');var LocalStrategy=require(_0x424c('0x1'))['Strategy'];var jayson=require(_0x424c('0x2'));var _=require(_0x424c('0x3'));var rs=require(_0x424c('0x4'));var moment=require(_0x424c('0x5'));var db=require(_0x424c('0x6'))['db'];var authService=require(_0x424c('0x7'));var utils=require(_0x424c('0x8'));var client=jayson[_0x424c('0x9')][_0x424c('0xa')]({'port':0x232b});function localAuthenticate(_0x52a6fb,_0x40f5b9,_0x36f563,_0x428cf1){var _0xe84ed2,_0x4ab6a9;return db[_0x424c('0xb')][_0x424c('0xc')]({'where':{'id':0x1},'attributes':[_0x424c('0xd'),'blockDuration'],'raw':!![]})[_0x424c('0xe')](function(_0xb60a38){_0xe84ed2=_0xb60a38;return _0x52a6fb[_0x424c('0xc')]({'attributes':['id','name',_0x424c('0xf'),_0x424c('0x10'),_0x424c('0x11'),_0x424c('0x12'),_0x424c('0x13'),_0x424c('0x14'),_0x424c('0x15')],'where':{'name':_0x40f5b9,'role':{'$or':[_0x424c('0x16'),'user',_0x424c('0x17')]}}});})[_0x424c('0xe')](function(_0x2ecf7c){if(!_0x2ecf7c||_0x2ecf7c&&_0x2ecf7c[_0x424c('0x18')]!==_0x40f5b9){throw new Error(_0x424c('0x19'));}else{_0x4ab6a9=_0x2ecf7c;return _0x4ab6a9;}})['then'](function(){_0x4ab6a9[_0x424c('0x1a')](_0x36f563,function(_0x140c0d,_0x5c2f27){var _0x11b6bd=_0x4ab6a9[_0x424c('0x15')]+0x1;if(_0x140c0d){return _0x428cf1(_0x140c0d);}else if(!_0x5c2f27){if(_0x4ab6a9[_0x424c('0x12')]){return _0x428cf1(null,![],{'message':_0x424c('0x19')});}else if(_0xe84ed2[_0x424c('0xd')]>0x0){if(_0x4ab6a9[_0x424c('0x13')]){if(_0xe84ed2['blockDuration']>0x0){if(moment(_0x4ab6a9[_0x424c('0x14')])[_0x424c('0x1b')](_0xe84ed2['blockDuration'],'minutes')>moment()){return _0x428cf1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x4ab6a9,_0x11b6bd,![],null)[_0x424c('0xe')](function(){return _0x428cf1(null,![],{'message':_0x424c('0x19')});});}}else{return _0x428cf1(null,![],{'message':_0x424c('0x19')});}}else{if(_0x11b6bd>=_0xe84ed2['allowedLoginAttempts']){return utils[_0x424c('0x1c')](_0x4ab6a9,0x0,!![],moment())['then'](function(){return _0x428cf1(null,![],{'message':_0x424c('0x19')});});}else{return utils[_0x424c('0x1c')](_0x4ab6a9,_0x11b6bd,![],null)[_0x424c('0xe')](function(){return _0x428cf1(null,![],{'message':_0x424c('0x19')});});}}}else{return _0x428cf1(null,![],{'message':_0x424c('0x19')});}}else{if(_0x4ab6a9[_0x424c('0x12')]){return _0x428cf1(null,![],{'message':_0x424c('0x19')});}else if(_0xe84ed2[_0x424c('0xd')]>0x0){if(_0x4ab6a9['blocked']){if(_0xe84ed2[_0x424c('0x1d')]>0x0){if(moment(_0x4ab6a9[_0x424c('0x14')])[_0x424c('0x1b')](_0xe84ed2[_0x424c('0x1d')],_0x424c('0x1e'))>moment()){return _0x428cf1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x424c('0x1c')](_0x4ab6a9,0x0,![],null)[_0x424c('0xe')](function(){return utils[_0x424c('0x1f')](_0x4ab6a9);})[_0x424c('0xe')](function(){return _0x428cf1(null,_0x4ab6a9);});}}else{return _0x428cf1(null,![],{'message':_0x424c('0x19')});}}else{return utils[_0x424c('0x1c')](_0x4ab6a9,0x0,![],null)['then'](function(){return utils[_0x424c('0x1f')](_0x4ab6a9);})[_0x424c('0xe')](function(){return _0x428cf1(null,_0x4ab6a9);})['catch'](function(_0x34f0af){return _0x428cf1(null,![],_0x34f0af);});}}else{if(_0x4ab6a9[_0x424c('0x13')]){return _0x428cf1(null,![],{'message':_0x424c('0x19')});}else{return utils['getLicense'](_0x4ab6a9)[_0x424c('0xe')](function(){return _0x428cf1(null,_0x4ab6a9);});}}}});})['catch'](function(_0x1667d5){return _0x428cf1(null,![],_0x1667d5);});}function sendServiceMail(_0x56e6e2){return db[_0x424c('0x20')][_0x424c('0x21')]({'where':{'service':!![]},'attributes':['id',_0x424c('0x18'),_0x424c('0x22')],'include':[{'model':db['MailServerOut'],'as':_0x424c('0x23'),'include':[{'model':db[_0x424c('0x24')],'as':_0x424c('0x24')}]}]})[_0x424c('0xe')](function(_0x1f800e){if(!_0x1f800e){throw new Error(_0x424c('0x25'));}var _0x436d86=_0x1f800e[_0x424c('0x26')]();var _0x24bdfa={'account':_0x436d86,'message':_[_0x424c('0x27')]({'from':util['format'](_0x424c('0x28'),_0x1f800e[_0x424c('0x18')],_0x1f800e[_0x424c('0x22')]||_0x1f800e[_0x424c('0x23')]['user'])},_0x56e6e2)};return client[_0x424c('0x29')](_0x424c('0x2a'),_0x24bdfa);})['then'](function(_0xa97a4){if(_0xa97a4[_0x424c('0x2b')]){throw new Error(util[_0x424c('0x2c')](_0x424c('0x2d'),_0xa97a4[_0x424c('0x2b')][_0x424c('0x2e')]||JSON[_0x424c('0x2f')](_0xa97a4['error'])));}return!![];});}function handleError(_0x583b97,_0x2bfe73,_0x1493f0){return _0x583b97[_0x424c('0x30')](_0x2bfe73||0x1f4)['send']({'message':_0x1493f0?_0x1493f0['message']||_0x1493f0:''});}exports[_0x424c('0x31')]=function(_0x5d150a,_0x27ce26,_0x344931){passport[_0x424c('0x1a')]('local-login',function(_0xa60752,_0x5a2946,_0x2d3ade){var _0x4fd557=_0xa60752||_0x2d3ade;if(_0x4fd557){return handleError(_0x27ce26,0x191,_0x4fd557);}if(!_0x5a2946){return handleError(_0x27ce26,0x194,{'message':_0x424c('0x32')});}else{var _0x21adfa={'payload':{'id':_0x5a2946['id'],'role':_0x5a2946['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x21adfa)[_0x424c('0xe')](function(_0x429d20){_0x27ce26[_0x424c('0x33')]({'id':_0x5a2946['id'],'token':_0x429d20,'statusCall':'','isAlreadyLogged':_0x5a2946['online']});});}})(_0x5d150a,_0x27ce26,_0x344931);};exports['forgot']=function(_0x2de596,_0x3c8dad){if(!_0x2de596['body'][_0x424c('0x22')]){return handleError(_0x3c8dad,0x1f4,{'message':_0x424c('0x34')});}var _0x5d4957=rs['generate']();_0x2de596['body']['email']=_0x2de596[_0x424c('0x35')]['email'][_0x424c('0x36')]()['toLowerCase']();var _0x40470b;return db[_0x424c('0xb')][_0x424c('0xc')]({'where':{'id':0x1},'attributes':[_0x424c('0xd'),_0x424c('0x1d')],'raw':!![]})[_0x424c('0xe')](function(_0x54d683){_0x40470b=_0x54d683;return db['User'][_0x424c('0x21')]({'where':{'email':_0x2de596[_0x424c('0x35')]['email']}});})['then'](function(_0x323cf2){if(!_0x323cf2){throw new Error(_0x424c('0x37'));}if(_0x323cf2[_0x424c('0x12')]){throw new Error(_0x424c('0x38'));}if(_0x323cf2['blocked']){if(moment(_0x323cf2['blockedAt'])[_0x424c('0x1b')](_0x40470b[_0x424c('0x1d')],_0x424c('0x1e'))>moment()){throw new Error(_0x424c('0x39'));}else{_0x323cf2[_0x424c('0x13')]=![];_0x323cf2[_0x424c('0x14')]=null;}}_0x323cf2[_0x424c('0x3a')]=_0x5d4957;_0x323cf2['resetPasswordExpires']=Date[_0x424c('0x3b')]()+0x36ee80;return _0x323cf2[_0x424c('0x3c')]();})[_0x424c('0xe')](function(){return sendServiceMail({'to':_0x2de596[_0x424c('0x35')][_0x424c('0x22')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x424c('0x3d')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x2de596[_0x424c('0x3e')]['host']+'/reset/'+_0x5d4957+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x424c('0xe')](function(){_0x3c8dad['status'](0xc8)['send']({'message':_0x424c('0x3f')});})[_0x424c('0x40')](function(_0x1eff08){return handleError(_0x3c8dad,0x1f4,_0x1eff08);});};exports[_0x424c('0x41')]=function(_0x232d3e,_0x422407){return db['User'][_0x424c('0x21')]({'where':{'resetPasswordToken':_0x232d3e['params']['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x424c('0xe')](function(_0x211352){if(!_0x211352){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x424c('0xb')][_0x424c('0xc')]({'attributes':['id','securePassword',_0x424c('0x42'),'passwordHistoryLimit']})[_0x424c('0xe')](function(_0x5355b5){if(_0x5355b5[_0x424c('0x43')])authService[_0x424c('0x44')](_0x232d3e[_0x424c('0x35')][_0x424c('0xf')]);if(!_0x5355b5['enforcePasswordHistory']||!_0x211352[_0x424c('0x45')])return _0x211352;authService[_0x424c('0x46')](_0x232d3e['body'][_0x424c('0xf')],_0x211352['previousPasswords'],_0x5355b5['passwordHistoryLimit']);return _0x211352;})[_0x424c('0xe')](function(){_0x211352[_0x424c('0xf')]=_0x232d3e['body'][_0x424c('0xf')];_0x211352[_0x424c('0x3a')]=null;_0x211352[_0x424c('0x47')]=null;return _0x211352[_0x424c('0x3c')]();});})[_0x424c('0xe')](function(){_0x422407[_0x424c('0x30')](0xc8)[_0x424c('0x48')]({'message':_0x424c('0x49')});})[_0x424c('0x40')](function(_0x5abfb2){return handleError(_0x422407,0x1f4,_0x5abfb2);});};passport[_0x424c('0x4a')](_0x424c('0x4b'),new LocalStrategy({'usernameField':_0x424c('0x18'),'passwordField':_0x424c('0xf')},function(_0x39ca1c,_0x3227af,_0x285101){return localAuthenticate(db['User'],_0x39ca1c,_0x3227af,_0x285101);})); \ No newline at end of file +var _0x8d9e=['host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','message','login','signToken','json','online','forgot','generate','body','email','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','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'];(function(_0x45084f,_0x21ce0b){var _0x324c40=function(_0x5bd611){while(--_0x5bd611){_0x45084f['push'](_0x45084f['shift']());}};_0x324c40(++_0x21ce0b);}(_0x8d9e,0x150));var _0xe8d9=function(_0x562ed2,_0x5a261f){_0x562ed2=_0x562ed2-0x0;var _0x1a1f47=_0x8d9e[_0x562ed2];return _0x1a1f47;};'use strict';var util=require(_0xe8d9('0x0'));var passport=require(_0xe8d9('0x1'));var LocalStrategy=require(_0xe8d9('0x2'))['Strategy'];var jayson=require(_0xe8d9('0x3'));var _=require(_0xe8d9('0x4'));var rs=require(_0xe8d9('0x5'));var moment=require(_0xe8d9('0x6'));var db=require(_0xe8d9('0x7'))['db'];var authService=require(_0xe8d9('0x8'));var utils=require(_0xe8d9('0x9'));var client=jayson['client'][_0xe8d9('0xa')]({'port':0x232b});function localAuthenticate(_0x5175ac,_0x5576b9,_0x128c15,_0x18950a){var _0x17d39f,_0x57ee77;return db['Setting'][_0xe8d9('0xb')]({'where':{'id':0x1},'attributes':[_0xe8d9('0xc'),_0xe8d9('0xd')],'raw':!![]})[_0xe8d9('0xe')](function(_0x498418){_0x17d39f=_0x498418;return _0x5175ac[_0xe8d9('0xb')]({'attributes':['id',_0xe8d9('0xf'),_0xe8d9('0x10'),_0xe8d9('0x11'),_0xe8d9('0x12'),_0xe8d9('0x13'),_0xe8d9('0x14'),'blockedAt',_0xe8d9('0x15')],'where':{'name':_0x5576b9,'role':{'$or':[_0xe8d9('0x16'),'user',_0xe8d9('0x17')]}}});})[_0xe8d9('0xe')](function(_0x21a91e){if(!_0x21a91e||_0x21a91e&&_0x21a91e[_0xe8d9('0xf')]!==_0x5576b9){throw new Error(_0xe8d9('0x18'));}else{_0x57ee77=_0x21a91e;return _0x57ee77;}})[_0xe8d9('0xe')](function(){_0x57ee77[_0xe8d9('0x19')](_0x128c15,function(_0x1c5922,_0x25809b){var _0x12461e=_0x57ee77[_0xe8d9('0x15')]+0x1;if(_0x1c5922){return _0x18950a(_0x1c5922);}else if(!_0x25809b){if(_0x57ee77[_0xe8d9('0x13')]){return _0x18950a(null,![],{'message':_0xe8d9('0x18')});}else if(_0x17d39f[_0xe8d9('0xc')]>0x0){if(_0x57ee77[_0xe8d9('0x14')]){if(_0x17d39f[_0xe8d9('0xd')]>0x0){if(moment(_0x57ee77[_0xe8d9('0x1a')])[_0xe8d9('0x1b')](_0x17d39f['blockDuration'],_0xe8d9('0x1c'))>moment()){return _0x18950a(null,![],{'message':_0xe8d9('0x18')});}else{return utils[_0xe8d9('0x1d')](_0x57ee77,_0x12461e,![],null)[_0xe8d9('0xe')](function(){return _0x18950a(null,![],{'message':_0xe8d9('0x18')});});}}else{return _0x18950a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x12461e>=_0x17d39f['allowedLoginAttempts']){return utils[_0xe8d9('0x1d')](_0x57ee77,0x0,!![],moment())[_0xe8d9('0xe')](function(){return _0x18950a(null,![],{'message':_0xe8d9('0x18')});});}else{return utils[_0xe8d9('0x1d')](_0x57ee77,_0x12461e,![],null)[_0xe8d9('0xe')](function(){return _0x18950a(null,![],{'message':_0xe8d9('0x18')});});}}}else{return _0x18950a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x57ee77['disabled']){return _0x18950a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x17d39f[_0xe8d9('0xc')]>0x0){if(_0x57ee77['blocked']){if(_0x17d39f[_0xe8d9('0xd')]>0x0){if(moment(_0x57ee77['blockedAt'])['add'](_0x17d39f[_0xe8d9('0xd')],_0xe8d9('0x1c'))>moment()){return _0x18950a(null,![],{'message':_0xe8d9('0x18')});}else{return utils['clearBlockUser'](_0x57ee77,0x0,![],null)[_0xe8d9('0xe')](function(){return utils[_0xe8d9('0x1e')](_0x57ee77);})[_0xe8d9('0xe')](function(){return _0x18950a(null,_0x57ee77);});}}else{return _0x18950a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xe8d9('0x1d')](_0x57ee77,0x0,![],null)[_0xe8d9('0xe')](function(){return utils['getLicense'](_0x57ee77);})['then'](function(){return _0x18950a(null,_0x57ee77);})[_0xe8d9('0x1f')](function(_0x419a63){return _0x18950a(null,![],_0x419a63);});}}else{if(_0x57ee77['blocked']){return _0x18950a(null,![],{'message':_0xe8d9('0x18')});}else{return utils['getLicense'](_0x57ee77)[_0xe8d9('0xe')](function(){return _0x18950a(null,_0x57ee77);});}}}});})['catch'](function(_0x2c3d82){return _0x18950a(null,![],_0x2c3d82);});}function sendServiceMail(_0x113929){return db[_0xe8d9('0x20')][_0xe8d9('0x21')]({'where':{'service':!![]},'attributes':['id',_0xe8d9('0xf'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xe8d9('0x22'),'include':[{'model':db[_0xe8d9('0x23')],'as':'CloudProvider'}]}]})[_0xe8d9('0xe')](function(_0x549faa){if(!_0x549faa){throw new Error(_0xe8d9('0x24'));}var _0x35ac6f=_0x549faa[_0xe8d9('0x25')]();var _0x55ba1d={'account':_0x35ac6f,'message':_[_0xe8d9('0x26')]({'from':util[_0xe8d9('0x27')]('\x22%s\x22\x20<%s>',_0x549faa[_0xe8d9('0xf')],_0x549faa['email']||_0x549faa[_0xe8d9('0x22')]['user'])},_0x113929)};return client[_0xe8d9('0x28')](_0xe8d9('0x29'),_0x55ba1d);})[_0xe8d9('0xe')](function(_0x24d471){if(_0x24d471[_0xe8d9('0x2a')]){throw new Error(util[_0xe8d9('0x27')](_0xe8d9('0x2b'),_0x24d471[_0xe8d9('0x2a')]['message']||JSON[_0xe8d9('0x2c')](_0x24d471[_0xe8d9('0x2a')])));}return!![];});}function handleError(_0x3f96a4,_0x5ebe7b,_0xcc58f){return _0x3f96a4['status'](_0x5ebe7b||0x1f4)[_0xe8d9('0x2d')]({'message':_0xcc58f?_0xcc58f[_0xe8d9('0x2e')]||_0xcc58f:''});}exports[_0xe8d9('0x2f')]=function(_0x3f8cd6,_0x1dd25b,_0x1ac6cd){passport['authenticate']('local-login',function(_0x235505,_0x5b344e,_0x572a01){var _0x245662=_0x235505||_0x572a01;if(_0x245662){return handleError(_0x1dd25b,0x191,_0x245662);}if(!_0x5b344e){return handleError(_0x1dd25b,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x380561={'payload':{'id':_0x5b344e['id'],'role':_0x5b344e['role']},'options':{'expiresIn':0x15180}};return authService[_0xe8d9('0x30')](_0x380561)[_0xe8d9('0xe')](function(_0x218cfd){_0x1dd25b[_0xe8d9('0x31')]({'id':_0x5b344e['id'],'token':_0x218cfd,'statusCall':'','isAlreadyLogged':_0x5b344e[_0xe8d9('0x32')]});});}})(_0x3f8cd6,_0x1dd25b,_0x1ac6cd);};exports[_0xe8d9('0x33')]=function(_0x532527,_0x17b09a){if(!_0x532527['body']['email']){return handleError(_0x17b09a,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x14e28a=rs[_0xe8d9('0x34')]();_0x532527[_0xe8d9('0x35')][_0xe8d9('0x36')]=_0x532527['body'][_0xe8d9('0x36')]['trim']()[_0xe8d9('0x37')]();var _0x54627d;return db[_0xe8d9('0x38')][_0xe8d9('0xb')]({'where':{'id':0x1},'attributes':[_0xe8d9('0xc'),_0xe8d9('0xd')],'raw':!![]})[_0xe8d9('0xe')](function(_0xcbe4a7){_0x54627d=_0xcbe4a7;return db[_0xe8d9('0x39')]['find']({'where':{'email':_0x532527[_0xe8d9('0x35')][_0xe8d9('0x36')]}});})['then'](function(_0x4f56fb){if(!_0x4f56fb){throw new Error(_0xe8d9('0x3a'));}if(_0x4f56fb[_0xe8d9('0x13')]){throw new Error(_0xe8d9('0x3b'));}if(_0x4f56fb[_0xe8d9('0x14')]){if(moment(_0x4f56fb[_0xe8d9('0x1a')])[_0xe8d9('0x1b')](_0x54627d[_0xe8d9('0xd')],'minutes')>moment()){throw new Error(_0xe8d9('0x3c'));}else{_0x4f56fb[_0xe8d9('0x14')]=![];_0x4f56fb[_0xe8d9('0x1a')]=null;}}_0x4f56fb['resetPasswordToken']=_0x14e28a;_0x4f56fb[_0xe8d9('0x3d')]=Date[_0xe8d9('0x3e')]()+0x36ee80;return _0x4f56fb[_0xe8d9('0x3f')]();})[_0xe8d9('0xe')](function(){return sendServiceMail({'to':_0x532527[_0xe8d9('0x35')]['email'],'subject':_0xe8d9('0x40'),'text':_0xe8d9('0x41')+_0xe8d9('0x42')+_0xe8d9('0x43')+_0x532527[_0xe8d9('0x44')][_0xe8d9('0x45')]+'/reset/'+_0x14e28a+'\x0a\x0a'+_0xe8d9('0x46')});})[_0xe8d9('0xe')](function(){_0x17b09a[_0xe8d9('0x47')](0xc8)[_0xe8d9('0x2d')]({'message':_0xe8d9('0x48')});})[_0xe8d9('0x1f')](function(_0x39af45){return handleError(_0x17b09a,0x1f4,_0x39af45);});};exports['reset']=function(_0x16c9d9,_0x35e33c){return db['User']['find']({'where':{'resetPasswordToken':_0x16c9d9['params']['token'],'resetPasswordExpires':{'$gt':Date[_0xe8d9('0x3e')]()}}})[_0xe8d9('0xe')](function(_0x3d6cfc){if(!_0x3d6cfc){throw new Error(_0xe8d9('0x49'));}return db[_0xe8d9('0x38')][_0xe8d9('0xb')]({'attributes':['id','securePassword',_0xe8d9('0x4a'),_0xe8d9('0x4b')]})[_0xe8d9('0xe')](function(_0xf85d89){if(_0xf85d89[_0xe8d9('0x4c')])authService['validatePasswordPattern'](_0x16c9d9[_0xe8d9('0x35')]['password']);if(!_0xf85d89[_0xe8d9('0x4a')]||!_0x3d6cfc['previousPasswords'])return _0x3d6cfc;authService['validatePasswordHistory'](_0x16c9d9['body'][_0xe8d9('0x10')],_0x3d6cfc[_0xe8d9('0x4d')],_0xf85d89[_0xe8d9('0x4b')]);return _0x3d6cfc;})[_0xe8d9('0xe')](function(){_0x3d6cfc[_0xe8d9('0x10')]=_0x16c9d9['body']['password'];_0x3d6cfc[_0xe8d9('0x4e')]=null;_0x3d6cfc[_0xe8d9('0x3d')]=null;return _0x3d6cfc[_0xe8d9('0x3f')]();});})[_0xe8d9('0xe')](function(){_0x35e33c['status'](0xc8)[_0xe8d9('0x2d')]({'message':_0xe8d9('0x4f')});})[_0xe8d9('0x1f')](function(_0x92c068){return handleError(_0x35e33c,0x1f4,_0x92c068);});};passport[_0xe8d9('0x50')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0xe8d9('0x10')},function(_0x37f663,_0x1f2cae,_0x85bd6){return localAuthenticate(db['User'],_0x37f663,_0x1f2cae,_0x85bd6);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4dbcc43..133a827 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 _0x6d40=['reset','express','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x6d40,0x197));var _0x06d4=function(_0x1c8196,_0x2ddbed){_0x1c8196=_0x1c8196-0x0;var _0x296224=_0x6d40[_0x1c8196];return _0x296224;};'use strict';var express=require(_0x06d4('0x0'));var router=express['Router']();var controller=require(_0x06d4('0x1'));router[_0x06d4('0x2')]('/',controller[_0x06d4('0x3')]);router[_0x06d4('0x2')](_0x06d4('0x4'),controller[_0x06d4('0x5')]);router['post']('/reset/:token',controller[_0x06d4('0x6')]);module['exports']=router; \ No newline at end of file +var _0x389b=['/reset/:token','reset','exports','express','Router','login','post'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x389b,0x130));var _0xb389=function(_0xba6447,_0x458f89){_0xba6447=_0xba6447-0x0;var _0x11e3ba=_0x389b[_0xba6447];return _0x11e3ba;};'use strict';var express=require(_0xb389('0x0'));var router=express[_0xb389('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0xb389('0x2')]);router[_0xb389('0x3')]('/forgot',controller['forgot']);router['post'](_0xb389('0x4'),controller[_0xb389('0x5')]);module[_0xb389('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 0b5fd76..bc0f5f6 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 _0x52d8=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x2f9cf0,_0x1b5aa1){var _0x5f07cb=function(_0x2b35a3){while(--_0x2b35a3){_0x2f9cf0['push'](_0x2f9cf0['shift']());}};_0x5f07cb(++_0x1b5aa1);}(_0x52d8,0xbe));var _0x852d=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x52d8[_0x57014b];return _0x2b258a;};'use strict';var Sequelize=require('sequelize');module[_0x852d('0x0')]={'name':{'type':Sequelize[_0x852d('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x852d('0x1')]},'description':{'type':Sequelize[_0x852d('0x1')]},'status':{'type':Sequelize[_0x852d('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x852d('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x3988=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x3988,0x188));var _0x8398=function(_0x2f7e43,_0x2d97c0){_0x2f7e43=_0x2f7e43-0x0;var _0x2758b0=_0x3988[_0x2f7e43];return _0x2758b0;};'use strict';var Sequelize=require(_0x8398('0x0'));module[_0x8398('0x1')]={'name':{'type':Sequelize[_0x8398('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x8398('0x2')]},'description':{'type':Sequelize[_0x8398('0x2')]},'status':{'type':Sequelize[_0x8398('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8398('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 83f7abb..a3f32a1 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 _0xa917=['eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','Automation','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','params','length','includeAll','find','create','body','ids','omit','getConditions','findOne','addActions','Action','getActions'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xa917,0xac));var _0x7a91=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa917[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x7a91('0x0'));var rimraf=require(_0x7a91('0x1'));var zipdir=require(_0x7a91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7a91('0x3'));var BPromise=require(_0x7a91('0x4'));var Mustache=require(_0x7a91('0x5'));var util=require(_0x7a91('0x6'));var path=require(_0x7a91('0x7'));var sox=require(_0x7a91('0x8'));var csv=require('to-csv');var ejs=require(_0x7a91('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a91('0xa'));var squel=require(_0x7a91('0xb'));var crypto=require('crypto');var jsforce=require(_0x7a91('0xc'));var deskjs=require(_0x7a91('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7a91('0xe'));var Papa=require(_0x7a91('0xf'));var Redis=require('ioredis');var authService=require(_0x7a91('0x10'));var qs=require(_0x7a91('0x11'));var as=require(_0x7a91('0x12'));var hardwareService=require(_0x7a91('0x13'));var logger=require(_0x7a91('0x14'))(_0x7a91('0x15'));var utils=require('../../config/utils');var config=require(_0x7a91('0x16'));var licenseUtil=require(_0x7a91('0x17'));var db=require(_0x7a91('0x18'))['db'];function respondWithStatusCode(_0x25ae81,_0x2e72a7){_0x2e72a7=_0x2e72a7||0xcc;return function(_0x125c16){if(_0x125c16){return _0x25ae81['sendStatus'](_0x2e72a7);}return _0x25ae81[_0x7a91('0x19')](_0x2e72a7)[_0x7a91('0x1a')]();};}function respondWithResult(_0x497de7,_0x209c9d){_0x209c9d=_0x209c9d||0xc8;return function(_0x4a16a5){if(_0x4a16a5){return _0x497de7[_0x7a91('0x19')](_0x209c9d)['json'](_0x4a16a5);}};}function respondWithFilteredResult(_0x1334ae,_0x3306d4){return function(_0x146809){if(_0x146809){var _0x4612b3=typeof _0x3306d4['offset']===_0x7a91('0x1b')&&typeof _0x3306d4[_0x7a91('0x1c')]===_0x7a91('0x1b');var _0x31497c=_0x146809[_0x7a91('0x1d')];var _0x53b781=_0x4612b3?0x0:_0x3306d4[_0x7a91('0x1e')];var _0x5a8023=_0x4612b3?_0x146809['count']:_0x3306d4[_0x7a91('0x1e')]+_0x3306d4['limit'];var _0x343894;if(_0x5a8023>=_0x31497c){_0x5a8023=_0x31497c;_0x343894=0xc8;}else{_0x343894=0xce;}_0x1334ae[_0x7a91('0x19')](_0x343894);return _0x1334ae[_0x7a91('0x1f')](_0x7a91('0x20'),_0x53b781+'-'+_0x5a8023+'/'+_0x31497c)[_0x7a91('0x21')](_0x146809);}return null;};}function patchUpdates(_0x45136e){return function(_0x4b9cf5){try{jsonpatch[_0x7a91('0x22')](_0x4b9cf5,_0x45136e,!![]);}catch(_0x45c859){return BPromise[_0x7a91('0x23')](_0x45c859);}return _0x4b9cf5[_0x7a91('0x24')]();};}function saveUpdates(_0x34198f,_0x48c1cc){return function(_0x493906){if(_0x493906){return _0x493906[_0x7a91('0x25')](_0x34198f)['then'](function(_0xd1ffb3){return _0xd1ffb3;});}return null;};}function removeEntity(_0x48915f,_0x647bcb){return function(_0x470d8a){if(_0x470d8a){return _0x470d8a[_0x7a91('0x26')]()[_0x7a91('0x27')](function(){_0x48915f[_0x7a91('0x19')](0xcc)[_0x7a91('0x1a')]();});}};}function handleEntityNotFound(_0x149740,_0x13a842){return function(_0x502b8f){if(!_0x502b8f){_0x149740[_0x7a91('0x28')](0x194);}return _0x502b8f;};}function handleError(_0x3b7a40,_0x3013ad){_0x3013ad=_0x3013ad||0x1f4;return function(_0x356af8){logger[_0x7a91('0x29')](_0x356af8[_0x7a91('0x2a')]);if(_0x356af8[_0x7a91('0x2b')]){delete _0x356af8[_0x7a91('0x2b')];}_0x3b7a40['status'](_0x3013ad)[_0x7a91('0x2c')](_0x356af8);};}exports[_0x7a91('0x2d')]=function(_0x238bdc,_0x427c0e){var _0x4e72a7={},_0x5130d6={},_0x2e3edd={'count':0x0,'rows':[]};var _0x8aba2b=_['map'](db[_0x7a91('0x2e')][_0x7a91('0x2f')],function(_0x3016b8){return{'name':_0x3016b8[_0x7a91('0x30')],'type':_0x3016b8['type'][_0x7a91('0x31')]};});_0x5130d6[_0x7a91('0x32')]=_[_0x7a91('0x33')](_0x8aba2b,_0x7a91('0x2b'));_0x5130d6[_0x7a91('0x34')]=_[_0x7a91('0x35')](_0x238bdc[_0x7a91('0x34')]);_0x5130d6[_0x7a91('0x36')]=_[_0x7a91('0x37')](_0x5130d6[_0x7a91('0x32')],_0x5130d6['query']);_0x4e72a7[_0x7a91('0x38')]=_[_0x7a91('0x37')](_0x5130d6[_0x7a91('0x32')],qs[_0x7a91('0x39')](_0x238bdc[_0x7a91('0x34')][_0x7a91('0x39')]));_0x4e72a7[_0x7a91('0x38')]=_0x4e72a7[_0x7a91('0x38')]['length']?_0x4e72a7[_0x7a91('0x38')]:_0x5130d6[_0x7a91('0x32')];if(!_0x238bdc['query'][_0x7a91('0x3a')](_0x7a91('0x3b'))){_0x4e72a7['limit']=qs[_0x7a91('0x1c')](_0x238bdc[_0x7a91('0x34')][_0x7a91('0x1c')]);_0x4e72a7[_0x7a91('0x1e')]=qs[_0x7a91('0x1e')](_0x238bdc[_0x7a91('0x34')][_0x7a91('0x1e')]);}_0x4e72a7[_0x7a91('0x3c')]=qs['sort'](_0x238bdc[_0x7a91('0x34')][_0x7a91('0x3d')]);_0x4e72a7[_0x7a91('0x3e')]=qs[_0x7a91('0x36')](_[_0x7a91('0x3f')](_0x238bdc[_0x7a91('0x34')],_0x5130d6['filters']),_0x8aba2b);if(_0x238bdc[_0x7a91('0x34')]['filter']){_0x4e72a7[_0x7a91('0x3e')]=_[_0x7a91('0x40')](_0x4e72a7[_0x7a91('0x3e')],{'$or':_[_0x7a91('0x33')](_0x8aba2b,function(_0x21ae7b){if(_0x21ae7b[_0x7a91('0x41')]!==_0x7a91('0x42')){var _0x649d5a={};_0x649d5a[_0x21ae7b[_0x7a91('0x2b')]]={'$like':'%'+_0x238bdc['query'][_0x7a91('0x43')]+'%'};return _0x649d5a;}})});}_0x4e72a7=_['merge']({},_0x4e72a7,_0x238bdc[_0x7a91('0x44')]);var _0x4a7284={'where':_0x4e72a7['where']};return db[_0x7a91('0x2e')]['count'](_0x4a7284)[_0x7a91('0x27')](function(_0xdda9bb){_0x2e3edd[_0x7a91('0x1d')]=_0xdda9bb;if(_0x238bdc[_0x7a91('0x34')]['includeAll']){_0x4e72a7[_0x7a91('0x45')]=[{'all':!![]}];}return db[_0x7a91('0x2e')][_0x7a91('0x46')](_0x4e72a7);})[_0x7a91('0x27')](function(_0x2f5624){_0x2e3edd[_0x7a91('0x47')]=_0x2f5624;return _0x2e3edd;})[_0x7a91('0x27')](respondWithFilteredResult(_0x427c0e,_0x4e72a7))[_0x7a91('0x48')](handleError(_0x427c0e,null));};exports['show']=function(_0x354c59,_0x430e26){var _0x126279={'raw':![],'where':{'id':_0x354c59[_0x7a91('0x49')]['id']}},_0x1d7f09={};_0x1d7f09[_0x7a91('0x32')]=_['keys'](db[_0x7a91('0x2e')][_0x7a91('0x2f')]);_0x1d7f09[_0x7a91('0x34')]=_[_0x7a91('0x35')](_0x354c59['query']);_0x1d7f09[_0x7a91('0x36')]=_['intersection'](_0x1d7f09[_0x7a91('0x32')],_0x1d7f09[_0x7a91('0x34')]);_0x126279[_0x7a91('0x38')]=_[_0x7a91('0x37')](_0x1d7f09[_0x7a91('0x32')],qs[_0x7a91('0x39')](_0x354c59[_0x7a91('0x34')][_0x7a91('0x39')]));_0x126279[_0x7a91('0x38')]=_0x126279[_0x7a91('0x38')][_0x7a91('0x4a')]?_0x126279[_0x7a91('0x38')]:_0x1d7f09[_0x7a91('0x32')];if(_0x354c59[_0x7a91('0x34')][_0x7a91('0x4b')]){_0x126279[_0x7a91('0x45')]=[{'all':!![]}];}_0x126279=_['merge']({},_0x126279,_0x354c59['options']);return db[_0x7a91('0x2e')][_0x7a91('0x4c')](_0x126279)[_0x7a91('0x27')](handleEntityNotFound(_0x430e26,null))[_0x7a91('0x27')](respondWithResult(_0x430e26,null))[_0x7a91('0x48')](handleError(_0x430e26,null));};exports[_0x7a91('0x4d')]=function(_0x2d0e4f,_0x32dfae){return db[_0x7a91('0x2e')][_0x7a91('0x4d')](_0x2d0e4f['body'],{})['then'](respondWithResult(_0x32dfae,0xc9))['catch'](handleError(_0x32dfae,null));};exports['update']=function(_0x528e5b,_0x5b4422){if(_0x528e5b[_0x7a91('0x4e')]['id']){delete _0x528e5b[_0x7a91('0x4e')]['id'];}return db[_0x7a91('0x2e')][_0x7a91('0x4c')]({'where':{'id':_0x528e5b[_0x7a91('0x49')]['id']}})[_0x7a91('0x27')](handleEntityNotFound(_0x5b4422,null))[_0x7a91('0x27')](saveUpdates(_0x528e5b[_0x7a91('0x4e')],null))['then'](respondWithResult(_0x5b4422,null))[_0x7a91('0x48')](handleError(_0x5b4422,null));};exports[_0x7a91('0x26')]=function(_0x2f7c01,_0x3d5544){return db[_0x7a91('0x2e')][_0x7a91('0x4c')]({'where':{'id':_0x2f7c01[_0x7a91('0x49')]['id']}})[_0x7a91('0x27')](handleEntityNotFound(_0x3d5544,null))[_0x7a91('0x27')](removeEntity(_0x3d5544,null))[_0x7a91('0x48')](handleError(_0x3d5544,null));};exports['addConditions']=function(_0x3ce978,_0x447da5,_0x16f4da){return db['Condition'][_0x7a91('0x4c')]({'where':{'id':_0x3ce978[_0x7a91('0x49')]['id']}})[_0x7a91('0x27')](handleEntityNotFound(_0x447da5,null))[_0x7a91('0x27')](function(_0x17ac8e){if(_0x17ac8e){return _0x17ac8e['addConditions'](_0x3ce978['body'][_0x7a91('0x4f')],_[_0x7a91('0x50')](_0x3ce978[_0x7a91('0x4e')],['ids','id'])||{});}})[_0x7a91('0x27')](respondWithResult(_0x447da5,null))[_0x7a91('0x48')](handleError(_0x447da5,null));};exports[_0x7a91('0x51')]=function(_0x41c632,_0xacd711,_0x43ea4a){var _0x51469d={};var _0x33ba57={};var _0x7f8221;var _0x119648;return db[_0x7a91('0x2e')][_0x7a91('0x52')]({'where':{'id':_0x41c632[_0x7a91('0x49')]['id']}})[_0x7a91('0x27')](handleEntityNotFound(_0xacd711,null))['then'](function(_0x281d25){if(_0x281d25){_0x7f8221=_0x281d25;_0x33ba57['model']=_[_0x7a91('0x35')](db['Condition']['rawAttributes']);_0x33ba57[_0x7a91('0x34')]=_[_0x7a91('0x35')](_0x41c632[_0x7a91('0x34')]);_0x33ba57[_0x7a91('0x36')]=_[_0x7a91('0x37')](_0x33ba57[_0x7a91('0x32')],_0x33ba57['query']);_0x51469d[_0x7a91('0x38')]=_[_0x7a91('0x37')](_0x33ba57[_0x7a91('0x32')],qs['fields'](_0x41c632[_0x7a91('0x34')][_0x7a91('0x39')]));_0x51469d['attributes']=_0x51469d[_0x7a91('0x38')][_0x7a91('0x4a')]?_0x51469d['attributes']:_0x33ba57[_0x7a91('0x32')];_0x51469d[_0x7a91('0x3c')]=qs['sort'](_0x41c632[_0x7a91('0x34')][_0x7a91('0x3d')]);_0x51469d['where']=qs[_0x7a91('0x36')](_[_0x7a91('0x3f')](_0x41c632[_0x7a91('0x34')],_0x33ba57[_0x7a91('0x36')]));if(_0x41c632[_0x7a91('0x34')][_0x7a91('0x43')]){_0x51469d['where']=_[_0x7a91('0x40')](_0x51469d[_0x7a91('0x3e')],{'$or':_[_0x7a91('0x33')](_0x51469d[_0x7a91('0x38')],function(_0x1491b2){var _0x5c7fc3={};_0x5c7fc3[_0x1491b2]={'$like':'%'+_0x41c632[_0x7a91('0x34')][_0x7a91('0x43')]+'%'};return _0x5c7fc3;})});}_0x51469d=_[_0x7a91('0x40')]({},_0x51469d,_0x41c632[_0x7a91('0x44')]);return _0x7f8221[_0x7a91('0x51')](_0x51469d);}})[_0x7a91('0x27')](function(_0xdc5ce9){if(_0xdc5ce9){_0x119648=_0xdc5ce9[_0x7a91('0x4a')];if(!_0x41c632[_0x7a91('0x34')][_0x7a91('0x3a')]('nolimit')){_0x51469d[_0x7a91('0x1c')]=qs[_0x7a91('0x1c')](_0x41c632['query'][_0x7a91('0x1c')]);_0x51469d[_0x7a91('0x1e')]=qs['offset'](_0x41c632[_0x7a91('0x34')][_0x7a91('0x1e')]);}return _0x7f8221[_0x7a91('0x51')](_0x51469d);}})[_0x7a91('0x27')](function(_0x15fda5){if(_0x15fda5){return _0x15fda5?{'count':_0x119648,'rows':_0x15fda5}:null;}})[_0x7a91('0x27')](respondWithResult(_0xacd711,null))['catch'](handleError(_0xacd711,null));};exports[_0x7a91('0x53')]=function(_0x500298,_0x5d4ab8,_0x1ddf22){return db[_0x7a91('0x54')][_0x7a91('0x4c')]({'where':{'id':_0x500298['params']['id']}})['then'](handleEntityNotFound(_0x5d4ab8,null))[_0x7a91('0x27')](function(_0x45845c){if(_0x45845c){return _0x45845c[_0x7a91('0x53')](_0x500298[_0x7a91('0x4e')][_0x7a91('0x4f')],_[_0x7a91('0x50')](_0x500298['body'],['ids','id'])||{});}})[_0x7a91('0x27')](respondWithResult(_0x5d4ab8,null))[_0x7a91('0x48')](handleError(_0x5d4ab8,null));};exports['getActions']=function(_0x3bc705,_0x59d865,_0x5a4cc3){var _0x38fb2a={};var _0x34b43d={};var _0x284fbe;var _0x19058d;return db[_0x7a91('0x2e')][_0x7a91('0x52')]({'where':{'id':_0x3bc705[_0x7a91('0x49')]['id']}})[_0x7a91('0x27')](handleEntityNotFound(_0x59d865,null))[_0x7a91('0x27')](function(_0x5a12a3){if(_0x5a12a3){_0x284fbe=_0x5a12a3;_0x34b43d[_0x7a91('0x32')]=_[_0x7a91('0x35')](db[_0x7a91('0x54')][_0x7a91('0x2f')]);_0x34b43d[_0x7a91('0x34')]=_[_0x7a91('0x35')](_0x3bc705[_0x7a91('0x34')]);_0x34b43d[_0x7a91('0x36')]=_[_0x7a91('0x37')](_0x34b43d[_0x7a91('0x32')],_0x34b43d[_0x7a91('0x34')]);_0x38fb2a[_0x7a91('0x38')]=_['intersection'](_0x34b43d[_0x7a91('0x32')],qs[_0x7a91('0x39')](_0x3bc705['query'][_0x7a91('0x39')]));_0x38fb2a['attributes']=_0x38fb2a[_0x7a91('0x38')][_0x7a91('0x4a')]?_0x38fb2a[_0x7a91('0x38')]:_0x34b43d[_0x7a91('0x32')];_0x38fb2a[_0x7a91('0x3c')]=qs[_0x7a91('0x3d')](_0x3bc705[_0x7a91('0x34')][_0x7a91('0x3d')]);_0x38fb2a[_0x7a91('0x3e')]=qs[_0x7a91('0x36')](_[_0x7a91('0x3f')](_0x3bc705[_0x7a91('0x34')],_0x34b43d[_0x7a91('0x36')]));if(_0x3bc705[_0x7a91('0x34')][_0x7a91('0x43')]){_0x38fb2a[_0x7a91('0x3e')]=_[_0x7a91('0x40')](_0x38fb2a['where'],{'$or':_[_0x7a91('0x33')](_0x38fb2a[_0x7a91('0x38')],function(_0x2b6787){var _0x548d46={};_0x548d46[_0x2b6787]={'$like':'%'+_0x3bc705[_0x7a91('0x34')][_0x7a91('0x43')]+'%'};return _0x548d46;})});}_0x38fb2a=_['merge']({},_0x38fb2a,_0x3bc705['options']);return _0x284fbe['getActions'](_0x38fb2a);}})['then'](function(_0x4789de){if(_0x4789de){_0x19058d=_0x4789de[_0x7a91('0x4a')];if(!_0x3bc705['query'][_0x7a91('0x3a')](_0x7a91('0x3b'))){_0x38fb2a[_0x7a91('0x1c')]=qs[_0x7a91('0x1c')](_0x3bc705[_0x7a91('0x34')][_0x7a91('0x1c')]);_0x38fb2a[_0x7a91('0x1e')]=qs[_0x7a91('0x1e')](_0x3bc705[_0x7a91('0x34')][_0x7a91('0x1e')]);}return _0x284fbe[_0x7a91('0x55')](_0x38fb2a);}})[_0x7a91('0x27')](function(_0x2102da){if(_0x2102da){return _0x2102da?{'count':_0x19058d,'rows':_0x2102da}:null;}})[_0x7a91('0x27')](respondWithResult(_0x59d865,null))[_0x7a91('0x48')](handleError(_0x59d865,null));}; \ No newline at end of file +var _0xe8be=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','name','send','index','map','Automation','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','then','rows','catch','show','params','include','create','body','find','addConditions','Condition','ids','omit','getConditions','addActions','Action','getActions','findOne','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x2b511c,_0x318dcb){var _0x309268=function(_0x3a8e7d){while(--_0x3a8e7d){_0x2b511c['push'](_0x2b511c['shift']());}};_0x309268(++_0x318dcb);}(_0xe8be,0x19b));var _0xee8b=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0xe8be[_0x4cd690];return _0x4a74a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee8b('0x0'));var zipdir=require(_0xee8b('0x1'));var jsonpatch=require(_0xee8b('0x2'));var rp=require('request-promise');var moment=require(_0xee8b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xee8b('0x4'));var util=require('util');var path=require(_0xee8b('0x5'));var sox=require(_0xee8b('0x6'));var csv=require(_0xee8b('0x7'));var ejs=require(_0xee8b('0x8'));var fs=require('fs');var fs_extra=require(_0xee8b('0x9'));var _=require(_0xee8b('0xa'));var squel=require(_0xee8b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xee8b('0xc'));var toCsv=require(_0xee8b('0x7'));var querystring=require(_0xee8b('0xd'));var Papa=require(_0xee8b('0xe'));var Redis=require(_0xee8b('0xf'));var authService=require(_0xee8b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xee8b('0x11'));var hardwareService=require(_0xee8b('0x12'));var logger=require('../../config/logger')(_0xee8b('0x13'));var utils=require(_0xee8b('0x14'));var config=require(_0xee8b('0x15'));var licenseUtil=require(_0xee8b('0x16'));var db=require(_0xee8b('0x17'))['db'];function respondWithStatusCode(_0x41022f,_0x44836c){_0x44836c=_0x44836c||0xcc;return function(_0x55bff8){if(_0x55bff8){return _0x41022f[_0xee8b('0x18')](_0x44836c);}return _0x41022f['status'](_0x44836c)['end']();};}function respondWithResult(_0x53e72f,_0x592e19){_0x592e19=_0x592e19||0xc8;return function(_0x4e3e21){if(_0x4e3e21){return _0x53e72f[_0xee8b('0x19')](_0x592e19)['json'](_0x4e3e21);}};}function respondWithFilteredResult(_0x3530f5,_0x3cffc0){return function(_0x1106d3){if(_0x1106d3){var _0x5eb48a=typeof _0x3cffc0[_0xee8b('0x1a')]===_0xee8b('0x1b')&&typeof _0x3cffc0[_0xee8b('0x1c')]==='undefined';var _0x56192d=_0x1106d3[_0xee8b('0x1d')];var _0x44829d=_0x5eb48a?0x0:_0x3cffc0[_0xee8b('0x1a')];var _0x41714d=_0x5eb48a?_0x1106d3[_0xee8b('0x1d')]:_0x3cffc0[_0xee8b('0x1a')]+_0x3cffc0[_0xee8b('0x1c')];var _0x810edb;if(_0x41714d>=_0x56192d){_0x41714d=_0x56192d;_0x810edb=0xc8;}else{_0x810edb=0xce;}_0x3530f5[_0xee8b('0x19')](_0x810edb);return _0x3530f5[_0xee8b('0x1e')](_0xee8b('0x1f'),_0x44829d+'-'+_0x41714d+'/'+_0x56192d)[_0xee8b('0x20')](_0x1106d3);}return null;};}function patchUpdates(_0x457922){return function(_0x261be0){try{jsonpatch[_0xee8b('0x21')](_0x261be0,_0x457922,!![]);}catch(_0x1fa9a4){return BPromise['reject'](_0x1fa9a4);}return _0x261be0[_0xee8b('0x22')]();};}function saveUpdates(_0x92a999,_0x1726b1){return function(_0x32e3ea){if(_0x32e3ea){return _0x32e3ea[_0xee8b('0x23')](_0x92a999)['then'](function(_0x4b421f){return _0x4b421f;});}return null;};}function removeEntity(_0xf6eb4b,_0x217bb7){return function(_0xbfcf77){if(_0xbfcf77){return _0xbfcf77[_0xee8b('0x24')]()['then'](function(){_0xf6eb4b[_0xee8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3686d9,_0x183c07){return function(_0x5f5d03){if(!_0x5f5d03){_0x3686d9['sendStatus'](0x194);}return _0x5f5d03;};}function handleError(_0x5391db,_0x14734a){_0x14734a=_0x14734a||0x1f4;return function(_0x387b21){logger['error'](_0x387b21['stack']);if(_0x387b21[_0xee8b('0x25')]){delete _0x387b21[_0xee8b('0x25')];}_0x5391db[_0xee8b('0x19')](_0x14734a)[_0xee8b('0x26')](_0x387b21);};}exports[_0xee8b('0x27')]=function(_0x378926,_0x41484e){var _0x42f0d9={},_0x85dc78={},_0x2286b4={'count':0x0,'rows':[]};var _0x14ac32=_[_0xee8b('0x28')](db[_0xee8b('0x29')][_0xee8b('0x2a')],function(_0x3e19c2){return{'name':_0x3e19c2['fieldName'],'type':_0x3e19c2[_0xee8b('0x2b')][_0xee8b('0x2c')]};});_0x85dc78[_0xee8b('0x2d')]=_['map'](_0x14ac32,_0xee8b('0x25'));_0x85dc78[_0xee8b('0x2e')]=_[_0xee8b('0x2f')](_0x378926[_0xee8b('0x2e')]);_0x85dc78[_0xee8b('0x30')]=_[_0xee8b('0x31')](_0x85dc78[_0xee8b('0x2d')],_0x85dc78[_0xee8b('0x2e')]);_0x42f0d9[_0xee8b('0x32')]=_['intersection'](_0x85dc78[_0xee8b('0x2d')],qs['fields'](_0x378926[_0xee8b('0x2e')][_0xee8b('0x33')]));_0x42f0d9[_0xee8b('0x32')]=_0x42f0d9['attributes'][_0xee8b('0x34')]?_0x42f0d9[_0xee8b('0x32')]:_0x85dc78[_0xee8b('0x2d')];if(!_0x378926[_0xee8b('0x2e')][_0xee8b('0x35')](_0xee8b('0x36'))){_0x42f0d9[_0xee8b('0x1c')]=qs[_0xee8b('0x1c')](_0x378926[_0xee8b('0x2e')][_0xee8b('0x1c')]);_0x42f0d9['offset']=qs[_0xee8b('0x1a')](_0x378926[_0xee8b('0x2e')]['offset']);}_0x42f0d9[_0xee8b('0x37')]=qs[_0xee8b('0x38')](_0x378926[_0xee8b('0x2e')][_0xee8b('0x38')]);_0x42f0d9[_0xee8b('0x39')]=qs['filters'](_[_0xee8b('0x3a')](_0x378926[_0xee8b('0x2e')],_0x85dc78[_0xee8b('0x30')]),_0x14ac32);if(_0x378926[_0xee8b('0x2e')][_0xee8b('0x3b')]){_0x42f0d9['where']=_[_0xee8b('0x3c')](_0x42f0d9[_0xee8b('0x39')],{'$or':_[_0xee8b('0x28')](_0x14ac32,function(_0xe16e70){if(_0xe16e70[_0xee8b('0x2b')]!==_0xee8b('0x3d')){var _0x748e9d={};_0x748e9d[_0xe16e70[_0xee8b('0x25')]]={'$like':'%'+_0x378926[_0xee8b('0x2e')]['filter']+'%'};return _0x748e9d;}})});}_0x42f0d9=_[_0xee8b('0x3c')]({},_0x42f0d9,_0x378926[_0xee8b('0x3e')]);var _0x22c372={'where':_0x42f0d9[_0xee8b('0x39')]};return db[_0xee8b('0x29')][_0xee8b('0x1d')](_0x22c372)['then'](function(_0xcba757){_0x2286b4[_0xee8b('0x1d')]=_0xcba757;if(_0x378926[_0xee8b('0x2e')][_0xee8b('0x3f')]){_0x42f0d9['include']=[{'all':!![]}];}return db[_0xee8b('0x29')][_0xee8b('0x40')](_0x42f0d9);})[_0xee8b('0x41')](function(_0x282c7b){_0x2286b4[_0xee8b('0x42')]=_0x282c7b;return _0x2286b4;})[_0xee8b('0x41')](respondWithFilteredResult(_0x41484e,_0x42f0d9))[_0xee8b('0x43')](handleError(_0x41484e,null));};exports[_0xee8b('0x44')]=function(_0xf1ee8d,_0x40a966){var _0x185eae={'raw':![],'where':{'id':_0xf1ee8d[_0xee8b('0x45')]['id']}},_0x383a17={};_0x383a17[_0xee8b('0x2d')]=_[_0xee8b('0x2f')](db[_0xee8b('0x29')][_0xee8b('0x2a')]);_0x383a17[_0xee8b('0x2e')]=_[_0xee8b('0x2f')](_0xf1ee8d[_0xee8b('0x2e')]);_0x383a17['filters']=_[_0xee8b('0x31')](_0x383a17[_0xee8b('0x2d')],_0x383a17[_0xee8b('0x2e')]);_0x185eae[_0xee8b('0x32')]=_['intersection'](_0x383a17['model'],qs['fields'](_0xf1ee8d[_0xee8b('0x2e')][_0xee8b('0x33')]));_0x185eae[_0xee8b('0x32')]=_0x185eae[_0xee8b('0x32')][_0xee8b('0x34')]?_0x185eae[_0xee8b('0x32')]:_0x383a17[_0xee8b('0x2d')];if(_0xf1ee8d[_0xee8b('0x2e')][_0xee8b('0x3f')]){_0x185eae[_0xee8b('0x46')]=[{'all':!![]}];}_0x185eae=_['merge']({},_0x185eae,_0xf1ee8d['options']);return db[_0xee8b('0x29')]['find'](_0x185eae)[_0xee8b('0x41')](handleEntityNotFound(_0x40a966,null))[_0xee8b('0x41')](respondWithResult(_0x40a966,null))[_0xee8b('0x43')](handleError(_0x40a966,null));};exports[_0xee8b('0x47')]=function(_0x322cf1,_0x4bd5c8){return db['Automation'][_0xee8b('0x47')](_0x322cf1[_0xee8b('0x48')],{})[_0xee8b('0x41')](respondWithResult(_0x4bd5c8,0xc9))[_0xee8b('0x43')](handleError(_0x4bd5c8,null));};exports[_0xee8b('0x23')]=function(_0x28c8db,_0x29654d){if(_0x28c8db[_0xee8b('0x48')]['id']){delete _0x28c8db['body']['id'];}return db['Automation'][_0xee8b('0x49')]({'where':{'id':_0x28c8db[_0xee8b('0x45')]['id']}})[_0xee8b('0x41')](handleEntityNotFound(_0x29654d,null))[_0xee8b('0x41')](saveUpdates(_0x28c8db[_0xee8b('0x48')],null))[_0xee8b('0x41')](respondWithResult(_0x29654d,null))[_0xee8b('0x43')](handleError(_0x29654d,null));};exports[_0xee8b('0x24')]=function(_0x1b9385,_0x343060){return db[_0xee8b('0x29')][_0xee8b('0x49')]({'where':{'id':_0x1b9385['params']['id']}})[_0xee8b('0x41')](handleEntityNotFound(_0x343060,null))['then'](removeEntity(_0x343060,null))[_0xee8b('0x43')](handleError(_0x343060,null));};exports[_0xee8b('0x4a')]=function(_0x10e23e,_0x2b99a3,_0x282f44){return db[_0xee8b('0x4b')]['find']({'where':{'id':_0x10e23e['params']['id']}})[_0xee8b('0x41')](handleEntityNotFound(_0x2b99a3,null))['then'](function(_0xcb9531){if(_0xcb9531){return _0xcb9531[_0xee8b('0x4a')](_0x10e23e[_0xee8b('0x48')][_0xee8b('0x4c')],_[_0xee8b('0x4d')](_0x10e23e[_0xee8b('0x48')],[_0xee8b('0x4c'),'id'])||{});}})[_0xee8b('0x41')](respondWithResult(_0x2b99a3,null))[_0xee8b('0x43')](handleError(_0x2b99a3,null));};exports[_0xee8b('0x4e')]=function(_0x40a0b5,_0x14f78d,_0x122614){var _0x30b200={};var _0x4247a9={};var _0x25a318;var _0x33a769;return db[_0xee8b('0x29')]['findOne']({'where':{'id':_0x40a0b5[_0xee8b('0x45')]['id']}})['then'](handleEntityNotFound(_0x14f78d,null))[_0xee8b('0x41')](function(_0x388752){if(_0x388752){_0x25a318=_0x388752;_0x4247a9[_0xee8b('0x2d')]=_['keys'](db[_0xee8b('0x4b')][_0xee8b('0x2a')]);_0x4247a9[_0xee8b('0x2e')]=_['keys'](_0x40a0b5['query']);_0x4247a9[_0xee8b('0x30')]=_[_0xee8b('0x31')](_0x4247a9[_0xee8b('0x2d')],_0x4247a9['query']);_0x30b200[_0xee8b('0x32')]=_['intersection'](_0x4247a9['model'],qs[_0xee8b('0x33')](_0x40a0b5[_0xee8b('0x2e')][_0xee8b('0x33')]));_0x30b200[_0xee8b('0x32')]=_0x30b200[_0xee8b('0x32')][_0xee8b('0x34')]?_0x30b200[_0xee8b('0x32')]:_0x4247a9['model'];_0x30b200[_0xee8b('0x37')]=qs['sort'](_0x40a0b5['query']['sort']);_0x30b200[_0xee8b('0x39')]=qs['filters'](_['pick'](_0x40a0b5[_0xee8b('0x2e')],_0x4247a9[_0xee8b('0x30')]));if(_0x40a0b5['query']['filter']){_0x30b200[_0xee8b('0x39')]=_['merge'](_0x30b200[_0xee8b('0x39')],{'$or':_[_0xee8b('0x28')](_0x30b200[_0xee8b('0x32')],function(_0x57e18f){var _0x31bc1={};_0x31bc1[_0x57e18f]={'$like':'%'+_0x40a0b5['query'][_0xee8b('0x3b')]+'%'};return _0x31bc1;})});}_0x30b200=_[_0xee8b('0x3c')]({},_0x30b200,_0x40a0b5[_0xee8b('0x3e')]);return _0x25a318['getConditions'](_0x30b200);}})[_0xee8b('0x41')](function(_0x1ebe4c){if(_0x1ebe4c){_0x33a769=_0x1ebe4c[_0xee8b('0x34')];if(!_0x40a0b5[_0xee8b('0x2e')][_0xee8b('0x35')]('nolimit')){_0x30b200[_0xee8b('0x1c')]=qs[_0xee8b('0x1c')](_0x40a0b5[_0xee8b('0x2e')][_0xee8b('0x1c')]);_0x30b200[_0xee8b('0x1a')]=qs['offset'](_0x40a0b5[_0xee8b('0x2e')]['offset']);}return _0x25a318[_0xee8b('0x4e')](_0x30b200);}})[_0xee8b('0x41')](function(_0x3f26eb){if(_0x3f26eb){return _0x3f26eb?{'count':_0x33a769,'rows':_0x3f26eb}:null;}})[_0xee8b('0x41')](respondWithResult(_0x14f78d,null))[_0xee8b('0x43')](handleError(_0x14f78d,null));};exports[_0xee8b('0x4f')]=function(_0x37081d,_0xe9d712,_0x19ec56){return db[_0xee8b('0x50')]['find']({'where':{'id':_0x37081d[_0xee8b('0x45')]['id']}})[_0xee8b('0x41')](handleEntityNotFound(_0xe9d712,null))[_0xee8b('0x41')](function(_0x1189ea){if(_0x1189ea){return _0x1189ea[_0xee8b('0x4f')](_0x37081d[_0xee8b('0x48')]['ids'],_[_0xee8b('0x4d')](_0x37081d['body'],['ids','id'])||{});}})[_0xee8b('0x41')](respondWithResult(_0xe9d712,null))[_0xee8b('0x43')](handleError(_0xe9d712,null));};exports[_0xee8b('0x51')]=function(_0x462886,_0x56aadc,_0x5e83e9){var _0x38b418={};var _0x29fb50={};var _0x3d3b3e;var _0x5f362f;return db['Automation'][_0xee8b('0x52')]({'where':{'id':_0x462886[_0xee8b('0x45')]['id']}})['then'](handleEntityNotFound(_0x56aadc,null))['then'](function(_0x1572f0){if(_0x1572f0){_0x3d3b3e=_0x1572f0;_0x29fb50[_0xee8b('0x2d')]=_[_0xee8b('0x2f')](db[_0xee8b('0x50')][_0xee8b('0x2a')]);_0x29fb50[_0xee8b('0x2e')]=_['keys'](_0x462886[_0xee8b('0x2e')]);_0x29fb50[_0xee8b('0x30')]=_[_0xee8b('0x31')](_0x29fb50[_0xee8b('0x2d')],_0x29fb50[_0xee8b('0x2e')]);_0x38b418['attributes']=_['intersection'](_0x29fb50[_0xee8b('0x2d')],qs[_0xee8b('0x33')](_0x462886['query'][_0xee8b('0x33')]));_0x38b418[_0xee8b('0x32')]=_0x38b418[_0xee8b('0x32')][_0xee8b('0x34')]?_0x38b418[_0xee8b('0x32')]:_0x29fb50['model'];_0x38b418[_0xee8b('0x37')]=qs[_0xee8b('0x38')](_0x462886['query'][_0xee8b('0x38')]);_0x38b418[_0xee8b('0x39')]=qs[_0xee8b('0x30')](_[_0xee8b('0x3a')](_0x462886['query'],_0x29fb50['filters']));if(_0x462886[_0xee8b('0x2e')][_0xee8b('0x3b')]){_0x38b418[_0xee8b('0x39')]=_[_0xee8b('0x3c')](_0x38b418[_0xee8b('0x39')],{'$or':_[_0xee8b('0x28')](_0x38b418['attributes'],function(_0xe00493){var _0x1e9f30={};_0x1e9f30[_0xe00493]={'$like':'%'+_0x462886[_0xee8b('0x2e')][_0xee8b('0x3b')]+'%'};return _0x1e9f30;})});}_0x38b418=_['merge']({},_0x38b418,_0x462886['options']);return _0x3d3b3e[_0xee8b('0x51')](_0x38b418);}})[_0xee8b('0x41')](function(_0x4881b8){if(_0x4881b8){_0x5f362f=_0x4881b8[_0xee8b('0x34')];if(!_0x462886['query'][_0xee8b('0x35')](_0xee8b('0x36'))){_0x38b418[_0xee8b('0x1c')]=qs['limit'](_0x462886[_0xee8b('0x2e')][_0xee8b('0x1c')]);_0x38b418[_0xee8b('0x1a')]=qs[_0xee8b('0x1a')](_0x462886[_0xee8b('0x2e')]['offset']);}return _0x3d3b3e['getActions'](_0x38b418);}})[_0xee8b('0x41')](function(_0x21e677){if(_0x21e677){return _0x21e677?{'count':_0x5f362f,'rows':_0x21e677}:null;}})['then'](respondWithResult(_0x56aadc,null))['catch'](handleError(_0x56aadc,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index dfacca2..3886b3a 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 _0x2fd2=['util','moment','bluebird','path','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations'];(function(_0x5d07f3,_0x5654b2){var _0x51eae0=function(_0x2d3735){while(--_0x2d3735){_0x5d07f3['push'](_0x5d07f3['shift']());}};_0x51eae0(++_0x5654b2);}(_0x2fd2,0x96));var _0x22fd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2fd2[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x22fd('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x22fd('0x1'));var BPromise=require(_0x22fd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22fd('0x3'));var rimraf=require('rimraf');var config=require(_0x22fd('0x4'));var attributes=require(_0x22fd('0x5'));module[_0x22fd('0x6')]=function(_0x4d7a9e,_0x1eb773){return _0x4d7a9e[_0x22fd('0x7')](_0x22fd('0x8'),attributes,{'tableName':_0x22fd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc916=['Automation','tools_automations','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc916,0x16a));var _0x6c91=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0xc916[_0x3d34da];return _0xcf6af8;};'use strict';var _=require(_0x6c91('0x0'));var util=require(_0x6c91('0x1'));var logger=require(_0x6c91('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6c91('0x3'));var rp=require(_0x6c91('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c91('0x5'));var config=require(_0x6c91('0x6'));var attributes=require(_0x6c91('0x7'));module[_0x6c91('0x8')]=function(_0x341c0,_0xc07b40){return _0x341c0[_0x6c91('0x9')](_0x6c91('0xa'),attributes,{'tableName':_0x6c91('0xb'),'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 aab2a4c..878898c 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 _0x87bc=['http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','client'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0x87bc,0x189));var _0xc87b=function(_0x16f3bc,_0x46567a){_0x16f3bc=_0x16f3bc-0x0;var _0x3228d1=_0x87bc[_0x16f3bc];return _0x3228d1;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var moment=require('moment');var BPromise=require(_0xc87b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc87b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc87b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc87b('0x5')][_0xc87b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x402aac,_0x5d1813,_0x50b19b){return new BPromise(function(_0x4ed0c5,_0x1999f8){return client[_0xc87b('0x7')](_0x402aac,_0x50b19b)[_0xc87b('0x8')](function(_0x19b571){logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));logger[_0xc87b('0xc')](_0xc87b('0xd'),_0x5d1813,'request\x20sent',JSON['stringify'](_0x19b571));if(_0x19b571[_0xc87b('0xe')]){if(_0x19b571['error'][_0xc87b('0xf')]===0x1f4){logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571[_0xc87b('0xe')]['message']);return _0x1999f8(_0x19b571[_0xc87b('0xe')]['message']);}logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571['error'][_0xc87b('0x10')]);return _0x4ed0c5(_0x19b571[_0xc87b('0xe')]['message']);}else{logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));_0x4ed0c5(_0x19b571[_0xc87b('0x11')][_0xc87b('0x10')]);}})[_0xc87b('0x12')](function(_0x4009ef){logger[_0xc87b('0xe')]('Automation,\x20%s,\x20%s',_0x5d1813,_0x4009ef);_0x1999f8(_0x4009ef);});});} \ No newline at end of file +var _0x6b19=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','moment','bluebird'];(function(_0x42c698,_0x35f692){var _0x242000=function(_0x55444f){while(--_0x55444f){_0x42c698['push'](_0x42c698['shift']());}};_0x242000(++_0x35f692);}(_0x6b19,0xf4));var _0x96b1=function(_0x43349f,_0xf0d647){_0x43349f=_0x43349f-0x0;var _0x1e5618=_0x6b19[_0x43349f];return _0x1e5618;};'use strict';var _=require(_0x96b1('0x0'));var util=require('util');var moment=require(_0x96b1('0x1'));var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96b1('0x3'));var db=require(_0x96b1('0x4'))['db'];var utils=require(_0x96b1('0x5'));var logger=require(_0x96b1('0x6'))('rpc');var config=require(_0x96b1('0x7'));var jayson=require(_0x96b1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x288d77,_0x2347c5,_0x519fbe){return new BPromise(function(_0x280b00,_0x2300ad){return client['request'](_0x288d77,_0x519fbe)[_0x96b1('0x9')](function(_0x6323a6){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x2347c5,_0x96b1('0xc'));logger['debug'](_0x96b1('0xd'),_0x2347c5,'request\x20sent',JSON['stringify'](_0x6323a6));if(_0x6323a6['error']){if(_0x6323a6['error'][_0x96b1('0xe')]===0x1f4){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x2300ad(_0x6323a6['error'][_0x96b1('0x10')]);}logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x280b00(_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x2347c5,'request\x20sent');_0x280b00(_0x6323a6[_0x96b1('0x11')][_0x96b1('0x10')]);}})[_0x96b1('0x12')](function(_0x350b2c){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x350b2c);_0x2300ad(_0x350b2c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 55bdd4b..3463dae 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 _0xe28f=['post','addConditions','addActions','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions'];(function(_0x3d6593,_0x207831){var _0x436a32=function(_0x83a2ab){while(--_0x83a2ab){_0x3d6593['push'](_0x3d6593['shift']());}};_0x436a32(++_0x207831);}(_0xe28f,0x1e9));var _0xfe28=function(_0x447f1b,_0x2e5b12){_0x447f1b=_0x447f1b-0x0;var _0x1b0770=_0xe28f[_0x447f1b];return _0x1b0770;};'use strict';var multer=require(_0xfe28('0x0'));var util=require(_0xfe28('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfe28('0x2'));var router=express[_0xfe28('0x3')]();var fs_extra=require(_0xfe28('0x4'));var auth=require(_0xfe28('0x5'));var interaction=require(_0xfe28('0x6'));var config=require(_0xfe28('0x7'));var controller=require('./automation.controller');router[_0xfe28('0x8')]('/',auth[_0xfe28('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xfe28('0xa')]);router[_0xfe28('0x8')](_0xfe28('0xb'),auth[_0xfe28('0x9')](),controller[_0xfe28('0xc')]);router[_0xfe28('0x8')](_0xfe28('0xd'),auth['isAuthenticated'](),controller[_0xfe28('0xe')]);router[_0xfe28('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfe28('0xf')](_0xfe28('0xb'),auth[_0xfe28('0x9')](),controller[_0xfe28('0x10')]);router['post'](_0xfe28('0xd'),auth['isAuthenticated'](),controller[_0xfe28('0x11')]);router[_0xfe28('0x12')](_0xfe28('0x13'),auth[_0xfe28('0x9')](),controller[_0xfe28('0x14')]);router[_0xfe28('0x15')](_0xfe28('0x13'),auth[_0xfe28('0x9')](),controller[_0xfe28('0x16')]);module[_0xfe28('0x17')]=router; \ No newline at end of file +var _0x4c6d=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','isAuthenticated','create','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x5c1239,_0x47bceb){_0x5c1239=_0x5c1239-0x0;var _0x5235fd=_0x4c6d[_0x5c1239];return _0x5235fd;};'use strict';var multer=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var path=require(_0xd4c6('0x2'));var timeout=require(_0xd4c6('0x3'));var express=require(_0xd4c6('0x4'));var router=express['Router']();var fs_extra=require(_0xd4c6('0x5'));var auth=require(_0xd4c6('0x6'));var interaction=require(_0xd4c6('0x7'));var config=require('../../config/environment');var controller=require(_0xd4c6('0x8'));router[_0xd4c6('0x9')]('/',auth['isAuthenticated'](),controller[_0xd4c6('0xa')]);router[_0xd4c6('0x9')](_0xd4c6('0xb'),auth['isAuthenticated'](),controller[_0xd4c6('0xc')]);router[_0xd4c6('0x9')](_0xd4c6('0xd'),auth['isAuthenticated'](),controller[_0xd4c6('0xe')]);router[_0xd4c6('0x9')](_0xd4c6('0xf'),auth['isAuthenticated'](),controller[_0xd4c6('0x10')]);router[_0xd4c6('0x11')]('/',auth[_0xd4c6('0x12')](),controller[_0xd4c6('0x13')]);router[_0xd4c6('0x11')](_0xd4c6('0xd'),auth['isAuthenticated'](),controller['addConditions']);router[_0xd4c6('0x11')]('/:id/actions',auth[_0xd4c6('0x12')](),controller[_0xd4c6('0x14')]);router[_0xd4c6('0x15')](_0xd4c6('0xb'),auth[_0xd4c6('0x12')](),controller[_0xd4c6('0x16')]);router[_0xd4c6('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xd4c6('0x18')]);module[_0xd4c6('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index dab0822..41064c0 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 _0xd4e1=['ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name'];(function(_0x29a56b,_0x58dbb7){var _0x33717f=function(_0x3c648a){while(--_0x3c648a){_0x29a56b['push'](_0x29a56b['shift']());}};_0x33717f(++_0x58dbb7);}(_0xd4e1,0x140));var _0x1d4e=function(_0x4b6346,_0x504489){_0x4b6346=_0x4b6346-0x0;var _0x56c1d1=_0xd4e1[_0x4b6346];return _0x56c1d1;};'use strict';var Sequelize=require(_0x1d4e('0x0'));module[_0x1d4e('0x1')]={'name':{'type':Sequelize[_0x1d4e('0x2')],'unique':_0x1d4e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1d4e('0x4')](_0x1d4e('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x1d4e('0x2')]},'active':{'type':Sequelize[_0x1d4e('0x6')],'defaultValue':0x0,'comment':_0x1d4e('0x7')},'limitCalls':{'type':Sequelize[_0x1d4e('0x8')](0x4)[_0x1d4e('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x1d4e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1d4e('0x8')](0x3)[_0x1d4e('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1d4e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d4e('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1d4e('0x8')](0x5)[_0x1d4e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d4e('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x1d4e('0x8')](0x3)[_0x1d4e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x1d4e('0x8')](0x5)[_0x1d4e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1d4e('0x8')](0x3)[_0x1d4e('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1d4e('0x8')](0x5)[_0x1d4e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1d4e('0x8')](0x3)[_0x1d4e('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1d4e('0xc')},'dialTimezone':{'type':Sequelize[_0x1d4e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x1d4e('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0x1d4e('0x4')](_0x1d4e('0xe'),'never',_0x1d4e('0xf')),'defaultValue':_0x1d4e('0xe')},'dialAMDActive':{'type':Sequelize[_0x1d4e('0x6')],'defaultValue':0x0,'comment':_0x1d4e('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x1d4e('0x8')](0x9)[_0x1d4e('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1d4e('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x1d4e('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1d4e('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1d4e('0x8')](0x9)[_0x1d4e('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1d4e('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1d4e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1d4e('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x1d4e('0x8')](0x9)[_0x1d4e('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1d4e('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1d4e('0x8')](0x9)[_0x1d4e('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1d4e('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1d4e('0x8')](0x9)[_0x1d4e('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1d4e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1d4e('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1d4e('0x8')](0x9)[_0x1d4e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x1d4e('0x4')](_0x1d4e('0x18'),_0x1d4e('0x19')),'defaultValue':_0x1d4e('0x18')},'dialPrefix':{'type':Sequelize[_0x1d4e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1d4e('0x1a')},'dialCutDigit':{'type':Sequelize[_0x1d4e('0x8')](0x3)[_0x1d4e('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1d4e('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1d4e('0x8')](0x3)[_0x1d4e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d4e('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1d4e('0x8')](0x5)[_0x1d4e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1d4e('0x8')](0x3)[_0x1d4e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d4e('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x1d4e('0x8')](0x5)[_0x1d4e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d4e('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1d4e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d4e('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1d4e('0x8')](0x5)[_0x1d4e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x1d4e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d4e('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1d4e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d4e('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1d4e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d4e('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1d4e('0x8')](0x5)[_0x1d4e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d4e('0x23')}}; \ No newline at end of file +var _0x9727=['Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#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)','#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)','exports','STRING','name','ENUM','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9727,0xcd));var _0x7972=function(_0x34bc94,_0x74f0fd){_0x34bc94=_0x34bc94-0x0;var _0xee41e7=_0x9727[_0x34bc94];return _0xee41e7;};'use strict';var Sequelize=require('sequelize');module[_0x7972('0x0')]={'name':{'type':Sequelize[_0x7972('0x1')],'unique':_0x7972('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7972('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x7972('0x1')]},'active':{'type':Sequelize[_0x7972('0x4')],'defaultValue':0x0,'comment':_0x7972('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7972('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7972('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7972('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x7972('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7972('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7972('0x7')](0x3)[_0x7972('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7972('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7972('0x7')](0x5)[_0x7972('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7972('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x7972('0x7')](0x3)[_0x7972('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7972('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7972('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7972('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7972('0x9')],'defaultValue':0x3,'comment':_0x7972('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7972('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7972('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7972('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7972('0x10')},'dialTimezone':{'type':Sequelize[_0x7972('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7972('0x1')],'defaultValue':_0x7972('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x7972('0x3')]('always',_0x7972('0x12'),_0x7972('0x13')),'defaultValue':_0x7972('0x14')},'dialAMDActive':{'type':Sequelize[_0x7972('0x4')],'defaultValue':0x0,'comment':_0x7972('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x7972('0x7')](0x9)[_0x7972('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7972('0x16')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x7972('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7972('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7972('0x7')](0x9)[_0x7972('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7972('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7972('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7972('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x7972('0x7')](0x9)[_0x7972('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7972('0x7')](0x9)[_0x7972('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7972('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7972('0x7')](0x9)[_0x7972('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7972('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7972('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7972('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7972('0x7')](0x9)[_0x7972('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7972('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7972('0x3')]('DESC',_0x7972('0x1e')),'defaultValue':_0x7972('0x1f')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7972('0x7')](0x3)[_0x7972('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7972('0x20')},'dialCutDigit':{'type':Sequelize[_0x7972('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7972('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7972('0x7')](0x3)[_0x7972('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7972('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7972('0x7')](0x5)[_0x7972('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7972('0x23')},'dialDropMaxRetry':{'type':Sequelize[_0x7972('0x7')](0x3)[_0x7972('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x7972('0x7')](0x5)[_0x7972('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7972('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7972('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7972('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7972('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0x7972('0x7')](0x3)[_0x7972('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7972('0x26')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7972('0x7')](0x5)[_0x7972('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7972('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7972('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7972('0x28')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7972('0x7')](0x5)[_0x7972('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7972('0x29')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index d22162c..e613d0f 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 _0xa521=['order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','createdAt','updatedAt','body','omit','getHoppers','findOne','hasOwnProperty','nolimit','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','format','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','IvrCampaigns','UserProfileResource','stack','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length'];(function(_0x17f773,_0x3e3f55){var _0x16576d=function(_0x220150){while(--_0x220150){_0x17f773['push'](_0x17f773['shift']());}};_0x16576d(++_0x3e3f55);}(_0xa521,0xeb));var _0x1a52=function(_0x562d8a,_0x2b1ef7){_0x562d8a=_0x562d8a-0x0;var _0x3b8442=_0xa521[_0x562d8a];return _0x3b8442;};'use strict';var emlformat=require(_0x1a52('0x0'));var rimraf=require(_0x1a52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1a52('0x2'));var moment=require(_0x1a52('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1a52('0x4'));var util=require(_0x1a52('0x5'));var path=require(_0x1a52('0x6'));var sox=require(_0x1a52('0x7'));var csv=require(_0x1a52('0x8'));var ejs=require(_0x1a52('0x9'));var fs=require('fs');var fs_extra=require(_0x1a52('0xa'));var _=require(_0x1a52('0xb'));var squel=require(_0x1a52('0xc'));var crypto=require(_0x1a52('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a52('0xe'));var Redis=require('ioredis');var authService=require(_0x1a52('0xf'));var qs=require(_0x1a52('0x10'));var as=require(_0x1a52('0x11'));var hardwareService=require(_0x1a52('0x12'));var logger=require('../../config/logger')(_0x1a52('0x13'));var utils=require('../../config/utils');var config=require(_0x1a52('0x14'));var licenseUtil=require(_0x1a52('0x15'));var db=require(_0x1a52('0x16'))['db'];function respondWithStatusCode(_0xbc8a53,_0x51d510){_0x51d510=_0x51d510||0xcc;return function(_0x179372){if(_0x179372){return _0xbc8a53[_0x1a52('0x17')](_0x51d510);}return _0xbc8a53[_0x1a52('0x18')](_0x51d510)[_0x1a52('0x19')]();};}function respondWithResult(_0x20e56e,_0x4fb67f){_0x4fb67f=_0x4fb67f||0xc8;return function(_0x50c17a){if(_0x50c17a){return _0x20e56e['status'](_0x4fb67f)['json'](_0x50c17a);}};}function respondWithFilteredResult(_0x1f7fca,_0x438ac5){return function(_0x428a94){if(_0x428a94){var _0x280bb2=typeof _0x438ac5['offset']===_0x1a52('0x1a')&&typeof _0x438ac5[_0x1a52('0x1b')]===_0x1a52('0x1a');var _0x1ac9bc=_0x428a94[_0x1a52('0x1c')];var _0x3194aa=_0x280bb2?0x0:_0x438ac5[_0x1a52('0x1d')];var _0x1236e9=_0x280bb2?_0x428a94[_0x1a52('0x1c')]:_0x438ac5[_0x1a52('0x1d')]+_0x438ac5[_0x1a52('0x1b')];var _0x5cd356;if(_0x1236e9>=_0x1ac9bc){_0x1236e9=_0x1ac9bc;_0x5cd356=0xc8;}else{_0x5cd356=0xce;}_0x1f7fca['status'](_0x5cd356);return _0x1f7fca[_0x1a52('0x1e')](_0x1a52('0x1f'),_0x3194aa+'-'+_0x1236e9+'/'+_0x1ac9bc)[_0x1a52('0x20')](_0x428a94);}return null;};}function patchUpdates(_0x59db0a){return function(_0x5b771e){try{jsonpatch[_0x1a52('0x21')](_0x5b771e,_0x59db0a,!![]);}catch(_0x30ee55){return BPromise[_0x1a52('0x22')](_0x30ee55);}return _0x5b771e['save']();};}function saveUpdates(_0x5835f8,_0x224b8d){return function(_0x4e117f){if(_0x4e117f){return _0x4e117f[_0x1a52('0x23')](_0x5835f8)[_0x1a52('0x24')](function(_0x111d97){return _0x111d97;});}return null;};}function removeEntity(_0x20d574,_0xdffd26){return function(_0x250f43){if(_0x250f43){return _0x250f43[_0x1a52('0x25')]()['then'](function(){var _0x308866=_0x250f43['get']({'plain':!![]});var _0x27ce04=_0x1a52('0x26');return db[_0x1a52('0x27')][_0x1a52('0x25')]({'where':{'type':_0x27ce04,'resourceId':_0x308866['id']}})[_0x1a52('0x24')](function(){return _0x250f43;});})[_0x1a52('0x24')](function(){_0x20d574['status'](0xcc)[_0x1a52('0x19')]();});}};}function handleEntityNotFound(_0x1fd2b5,_0x46baf3){return function(_0xdf1ef5){if(!_0xdf1ef5){_0x1fd2b5['sendStatus'](0x194);}return _0xdf1ef5;};}function handleError(_0x374175,_0x35e8a5){_0x35e8a5=_0x35e8a5||0x1f4;return function(_0x2ea2ff){logger['error'](_0x2ea2ff[_0x1a52('0x28')]);if(_0x2ea2ff['name']){delete _0x2ea2ff['name'];}_0x374175['status'](_0x35e8a5)[_0x1a52('0x29')](_0x2ea2ff);};}exports[_0x1a52('0x2a')]=function(_0x5a927b,_0x49f116){var _0x26ee5b={},_0x4f5f9f={},_0x2a0a89={'count':0x0,'rows':[]};var _0x30d9d3=_[_0x1a52('0x2b')](db[_0x1a52('0x2c')][_0x1a52('0x2d')],function(_0x584ef5){return{'name':_0x584ef5[_0x1a52('0x2e')],'type':_0x584ef5[_0x1a52('0x2f')][_0x1a52('0x30')]};});_0x4f5f9f[_0x1a52('0x31')]=_['map'](_0x30d9d3,_0x1a52('0x32'));_0x4f5f9f[_0x1a52('0x33')]=_['keys'](_0x5a927b['query']);_0x4f5f9f[_0x1a52('0x34')]=_[_0x1a52('0x35')](_0x4f5f9f[_0x1a52('0x31')],_0x4f5f9f[_0x1a52('0x33')]);_0x26ee5b[_0x1a52('0x36')]=_[_0x1a52('0x35')](_0x4f5f9f[_0x1a52('0x31')],qs[_0x1a52('0x37')](_0x5a927b[_0x1a52('0x33')][_0x1a52('0x37')]));_0x26ee5b['attributes']=_0x26ee5b[_0x1a52('0x36')][_0x1a52('0x38')]?_0x26ee5b['attributes']:_0x4f5f9f[_0x1a52('0x31')];if(!_0x5a927b[_0x1a52('0x33')]['hasOwnProperty']('nolimit')){_0x26ee5b['limit']=qs[_0x1a52('0x1b')](_0x5a927b[_0x1a52('0x33')]['limit']);_0x26ee5b[_0x1a52('0x1d')]=qs[_0x1a52('0x1d')](_0x5a927b[_0x1a52('0x33')][_0x1a52('0x1d')]);}_0x26ee5b[_0x1a52('0x39')]=qs['sort'](_0x5a927b[_0x1a52('0x33')][_0x1a52('0x3a')]);_0x26ee5b['where']=qs[_0x1a52('0x34')](_[_0x1a52('0x3b')](_0x5a927b[_0x1a52('0x33')],_0x4f5f9f[_0x1a52('0x34')]),_0x30d9d3);if(_0x5a927b['query'][_0x1a52('0x3c')]){_0x26ee5b[_0x1a52('0x3d')]=_[_0x1a52('0x3e')](_0x26ee5b[_0x1a52('0x3d')],{'$or':_[_0x1a52('0x2b')](_0x30d9d3,function(_0x4b95c1){if(_0x4b95c1[_0x1a52('0x2f')]!==_0x1a52('0x3f')){var _0x26b331={};_0x26b331[_0x4b95c1[_0x1a52('0x32')]]={'$like':'%'+_0x5a927b['query'][_0x1a52('0x3c')]+'%'};return _0x26b331;}})});}_0x26ee5b=_[_0x1a52('0x3e')]({},_0x26ee5b,_0x5a927b[_0x1a52('0x40')]);var _0x2549c1={'where':_0x26ee5b['where']};return db[_0x1a52('0x2c')]['count'](_0x2549c1)['then'](function(_0xd4fd80){_0x2a0a89[_0x1a52('0x1c')]=_0xd4fd80;if(_0x5a927b['query']['includeAll']){_0x26ee5b[_0x1a52('0x41')]=[{'all':!![]}];}return db[_0x1a52('0x2c')]['findAll'](_0x26ee5b);})[_0x1a52('0x24')](function(_0x5a4acb){_0x2a0a89[_0x1a52('0x42')]=_0x5a4acb;return _0x2a0a89;})[_0x1a52('0x24')](respondWithFilteredResult(_0x49f116,_0x26ee5b))[_0x1a52('0x43')](handleError(_0x49f116,null));};exports[_0x1a52('0x44')]=function(_0x503915,_0x5e648c){var _0x2ca9fb={'raw':![],'where':{'id':_0x503915[_0x1a52('0x45')]['id']}},_0x38f714={};_0x38f714['model']=_['keys'](db[_0x1a52('0x2c')][_0x1a52('0x2d')]);_0x38f714[_0x1a52('0x33')]=_[_0x1a52('0x46')](_0x503915[_0x1a52('0x33')]);_0x38f714[_0x1a52('0x34')]=_[_0x1a52('0x35')](_0x38f714[_0x1a52('0x31')],_0x38f714[_0x1a52('0x33')]);_0x2ca9fb[_0x1a52('0x36')]=_[_0x1a52('0x35')](_0x38f714[_0x1a52('0x31')],qs[_0x1a52('0x37')](_0x503915['query'][_0x1a52('0x37')]));_0x2ca9fb[_0x1a52('0x36')]=_0x2ca9fb[_0x1a52('0x36')][_0x1a52('0x38')]?_0x2ca9fb['attributes']:_0x38f714['model'];if(_0x503915[_0x1a52('0x33')]['includeAll']){_0x2ca9fb[_0x1a52('0x41')]=[{'all':!![]}];}_0x2ca9fb=_[_0x1a52('0x3e')]({},_0x2ca9fb,_0x503915[_0x1a52('0x40')]);return db[_0x1a52('0x2c')][_0x1a52('0x47')](_0x2ca9fb)['then'](handleEntityNotFound(_0x5e648c,null))[_0x1a52('0x24')](respondWithResult(_0x5e648c,null))[_0x1a52('0x43')](handleError(_0x5e648c,null));};exports[_0x1a52('0x48')]=function(_0x509f39,_0x51c6ae){return db['Campaign'][_0x1a52('0x48')](_0x509f39['body'],{})['then'](function(_0x3d3c26){var _0x53e9ee=_0x509f39[_0x1a52('0x49')][_0x1a52('0x4a')]({'plain':!![]});if(!_0x53e9ee)throw new Error(_0x1a52('0x4b'));if(_0x53e9ee[_0x1a52('0x4c')]===_0x1a52('0x49')){var _0x14419c=_0x3d3c26[_0x1a52('0x4a')]({'plain':!![]});var _0x4ac7fd=_0x1a52('0x26');return db[_0x1a52('0x4d')][_0x1a52('0x47')]({'where':{'name':_0x4ac7fd,'userProfileId':_0x53e9ee[_0x1a52('0x4e')]},'raw':!![]})[_0x1a52('0x24')](function(_0x297257){if(_0x297257&&_0x297257[_0x1a52('0x4f')]===0x0){return db['UserProfileResource'][_0x1a52('0x48')]({'name':_0x14419c[_0x1a52('0x32')],'resourceId':_0x14419c['id'],'type':_0x297257[_0x1a52('0x32')],'sectionId':_0x297257['id']},{})[_0x1a52('0x24')](function(){return _0x3d3c26;});}else{return _0x3d3c26;}})['catch'](function(_0x10496d){logger[_0x1a52('0x50')](_0x1a52('0x51'),_0x10496d);throw _0x10496d;});}return _0x3d3c26;})[_0x1a52('0x24')](respondWithResult(_0x51c6ae,0xc9))[_0x1a52('0x43')](handleError(_0x51c6ae,null));};exports['clone']=function(_0x1f19ff,_0x377cc6){var _0x336525={'where':{'id':_0x1f19ff[_0x1a52('0x45')]['id']}},_0x32123a={};_0x32123a['model']=_[_0x1a52('0x46')](db[_0x1a52('0x2c')][_0x1a52('0x2d')]);_0x336525[_0x1a52('0x36')]=_[_0x1a52('0x35')](_0x32123a[_0x1a52('0x31')],qs[_0x1a52('0x37')](_0x1f19ff[_0x1a52('0x33')][_0x1a52('0x37')]));_0x336525[_0x1a52('0x36')]=_0x336525['attributes']['length']?_0x336525[_0x1a52('0x36')]:_0x32123a[_0x1a52('0x31')];if(_0x1f19ff[_0x1a52('0x33')][_0x1a52('0x52')]){_0x336525[_0x1a52('0x41')]=[{'all':!![]}];}_0x336525=_[_0x1a52('0x3e')]({},_0x336525,_0x1f19ff[_0x1a52('0x40')]);return db['Campaign'][_0x1a52('0x47')](_0x336525)[_0x1a52('0x24')](handleEntityNotFound(_0x377cc6,null))['then'](function(_0x162174){if(_0x162174){var _0x2e9604=_0x162174[_0x1a52('0x4a')]({'plain':!![]});_0x2e9604=qs['omit'](_0x2e9604,['id',_0x1a52('0x53'),_0x1a52('0x54')]);_0x1f19ff[_0x1a52('0x55')]=_[_0x1a52('0x56')](_0x1f19ff[_0x1a52('0x55')],['id',_0x1a52('0x53'),_0x1a52('0x54')]);return db['Campaign']['create'](_[_0x1a52('0x3e')](_0x2e9604,_0x1f19ff[_0x1a52('0x55')]),{'include':_0x1f19ff[_0x1a52('0x33')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4a622b){var _0x195e62=_0x1f19ff[_0x1a52('0x49')][_0x1a52('0x4a')]({'plain':!![]});if(!_0x195e62)throw new Error(_0x1a52('0x4b'));if(_0x195e62['role']===_0x1a52('0x49')){var _0x5e9da3=_0x4a622b[_0x1a52('0x4a')]({'plain':!![]});var _0x3cf5b2=_0x1a52('0x26');return db[_0x1a52('0x4d')][_0x1a52('0x47')]({'where':{'name':_0x3cf5b2,'userProfileId':_0x195e62[_0x1a52('0x4e')]},'raw':!![]})[_0x1a52('0x24')](function(_0x373e63){if(_0x373e63&&_0x373e63['autoAssociation']===0x0){return db[_0x1a52('0x27')]['create']({'name':_0x5e9da3[_0x1a52('0x32')],'resourceId':_0x5e9da3['id'],'type':_0x373e63[_0x1a52('0x32')],'sectionId':_0x373e63['id']},{})[_0x1a52('0x24')](function(){return _0x4a622b;});}else{return _0x4a622b;}})[_0x1a52('0x43')](function(_0xc188dc){logger[_0x1a52('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc188dc);throw _0xc188dc;});}return _0x4a622b;});}})[_0x1a52('0x24')](respondWithResult(_0x377cc6,0xc9))['catch'](handleError(_0x377cc6,null));};exports[_0x1a52('0x23')]=function(_0x4219cc,_0xb0adf0){if(_0x4219cc['body']['id']){delete _0x4219cc[_0x1a52('0x55')]['id'];}return db['Campaign']['find']({'where':{'id':_0x4219cc['params']['id']}})[_0x1a52('0x24')](handleEntityNotFound(_0xb0adf0,null))['then'](saveUpdates(_0x4219cc[_0x1a52('0x55')],null))['then'](respondWithResult(_0xb0adf0,null))[_0x1a52('0x43')](handleError(_0xb0adf0,null));};exports['destroy']=function(_0x914439,_0x2b272e){return db[_0x1a52('0x2c')][_0x1a52('0x47')]({'where':{'id':_0x914439[_0x1a52('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b272e,null))['then'](removeEntity(_0x2b272e,null))[_0x1a52('0x43')](handleError(_0x2b272e,null));};exports[_0x1a52('0x57')]=function(_0x416a2a,_0x1fcb47,_0x41ae58){var _0x62cedf={'raw':!![],'where':{}};var _0x246454={};var _0x39f9bb={'count':0x0,'rows':[]};return db[_0x1a52('0x2c')][_0x1a52('0x58')]({'where':{'id':_0x416a2a[_0x1a52('0x45')]['id']}})[_0x1a52('0x24')](handleEntityNotFound(_0x1fcb47,null))[_0x1a52('0x24')](function(_0x53e575){if(_0x53e575){_0x246454['model']=_[_0x1a52('0x46')](db['CmHopper'][_0x1a52('0x2d')]);_0x246454[_0x1a52('0x33')]=_[_0x1a52('0x46')](_0x416a2a[_0x1a52('0x33')]);_0x246454[_0x1a52('0x34')]=_[_0x1a52('0x35')](_0x246454[_0x1a52('0x31')],_0x246454[_0x1a52('0x33')]);_0x62cedf[_0x1a52('0x36')]=_['intersection'](_0x246454[_0x1a52('0x31')],qs[_0x1a52('0x37')](_0x416a2a[_0x1a52('0x33')][_0x1a52('0x37')]));_0x62cedf[_0x1a52('0x36')]=_0x62cedf[_0x1a52('0x36')][_0x1a52('0x38')]?_0x62cedf[_0x1a52('0x36')]:_0x246454[_0x1a52('0x31')];if(!_0x416a2a[_0x1a52('0x33')][_0x1a52('0x59')](_0x1a52('0x5a'))){_0x62cedf[_0x1a52('0x1b')]=qs[_0x1a52('0x1b')](_0x416a2a[_0x1a52('0x33')][_0x1a52('0x1b')]);_0x62cedf[_0x1a52('0x1d')]=qs[_0x1a52('0x1d')](_0x416a2a[_0x1a52('0x33')][_0x1a52('0x1d')]);}_0x62cedf['order']=qs[_0x1a52('0x3a')](_0x416a2a[_0x1a52('0x33')]['sort']);_0x62cedf[_0x1a52('0x3d')]=qs[_0x1a52('0x34')](_[_0x1a52('0x3b')](_0x416a2a[_0x1a52('0x33')],_0x246454[_0x1a52('0x34')]));_0x62cedf[_0x1a52('0x3d')][_0x1a52('0x5b')]=_0x53e575['id'];if(_0x416a2a['query'][_0x1a52('0x3c')]){_0x62cedf[_0x1a52('0x3d')]=_[_0x1a52('0x3e')](_0x62cedf[_0x1a52('0x3d')],{'$or':_[_0x1a52('0x2b')](_0x62cedf[_0x1a52('0x36')],function(_0x3b7c80){var _0x58b877={};_0x58b877[_0x3b7c80]={'$like':'%'+_0x416a2a[_0x1a52('0x33')][_0x1a52('0x3c')]+'%'};return _0x58b877;})});}_0x62cedf=_[_0x1a52('0x3e')]({},_0x62cedf,_0x416a2a['options']);return db[_0x1a52('0x5c')][_0x1a52('0x1c')]({'where':_0x62cedf[_0x1a52('0x3d')]})[_0x1a52('0x24')](function(_0x1cb11a){_0x39f9bb['count']=_0x1cb11a;if(_0x416a2a[_0x1a52('0x33')][_0x1a52('0x52')]){_0x62cedf[_0x1a52('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0x1a52('0x5d')](_0x62cedf);})[_0x1a52('0x24')](function(_0x23a3cd){_0x39f9bb[_0x1a52('0x42')]=_0x23a3cd;return _0x39f9bb;});}})[_0x1a52('0x24')](respondWithFilteredResult(_0x1fcb47,_0x62cedf))[_0x1a52('0x43')](handleError(_0x1fcb47,null));};exports[_0x1a52('0x5e')]=function(_0x460eeb,_0x36889d,_0x316640){var _0x2841d3={'raw':!![],'where':{}};var _0x48cfd0={};var _0x2f7ce8={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x460eeb[_0x1a52('0x45')]['id']}})['then'](handleEntityNotFound(_0x36889d,null))[_0x1a52('0x24')](function(_0x1ca716){if(_0x1ca716){_0x48cfd0[_0x1a52('0x31')]=_['keys'](db[_0x1a52('0x5f')][_0x1a52('0x2d')]);_0x48cfd0['query']=_['keys'](_0x460eeb[_0x1a52('0x33')]);_0x48cfd0[_0x1a52('0x34')]=_[_0x1a52('0x35')](_0x48cfd0[_0x1a52('0x31')],_0x48cfd0[_0x1a52('0x33')]);_0x2841d3[_0x1a52('0x36')]=_[_0x1a52('0x35')](_0x48cfd0[_0x1a52('0x31')],qs[_0x1a52('0x37')](_0x460eeb[_0x1a52('0x33')][_0x1a52('0x37')]));_0x2841d3[_0x1a52('0x36')]=_0x2841d3[_0x1a52('0x36')]['length']?_0x2841d3[_0x1a52('0x36')]:_0x48cfd0[_0x1a52('0x31')];if(!_0x460eeb['query'][_0x1a52('0x59')](_0x1a52('0x5a'))){_0x2841d3[_0x1a52('0x1b')]=qs[_0x1a52('0x1b')](_0x460eeb[_0x1a52('0x33')][_0x1a52('0x1b')]);_0x2841d3[_0x1a52('0x1d')]=qs[_0x1a52('0x1d')](_0x460eeb['query'][_0x1a52('0x1d')]);}_0x2841d3[_0x1a52('0x39')]=qs[_0x1a52('0x3a')](_0x460eeb[_0x1a52('0x33')][_0x1a52('0x3a')]);_0x2841d3[_0x1a52('0x3d')]=qs[_0x1a52('0x34')](_[_0x1a52('0x3b')](_0x460eeb[_0x1a52('0x33')],_0x48cfd0[_0x1a52('0x34')]));_0x2841d3[_0x1a52('0x3d')]['CampaignId']=_0x1ca716['id'];if(_0x460eeb[_0x1a52('0x33')][_0x1a52('0x3c')]){_0x2841d3[_0x1a52('0x3d')]=_[_0x1a52('0x3e')](_0x2841d3['where'],{'$or':_['map'](_0x2841d3[_0x1a52('0x36')],function(_0x73c215){var _0x3cf825={};_0x3cf825[_0x73c215]={'$like':'%'+_0x460eeb[_0x1a52('0x33')][_0x1a52('0x3c')]+'%'};return _0x3cf825;})});}_0x2841d3=_['merge']({},_0x2841d3,_0x460eeb['options']);return db[_0x1a52('0x5f')][_0x1a52('0x1c')]({'where':_0x2841d3[_0x1a52('0x3d')]})[_0x1a52('0x24')](function(_0x417e5e){_0x2f7ce8[_0x1a52('0x1c')]=_0x417e5e;if(_0x460eeb['query'][_0x1a52('0x52')]){_0x2841d3[_0x1a52('0x41')]=[{'all':!![]}];}return db[_0x1a52('0x5f')][_0x1a52('0x5d')](_0x2841d3);})[_0x1a52('0x24')](function(_0x3e0cfd){_0x2f7ce8[_0x1a52('0x42')]=_0x3e0cfd;return _0x2f7ce8;});}})[_0x1a52('0x24')](respondWithFilteredResult(_0x36889d,_0x2841d3))['catch'](handleError(_0x36889d,null));};exports['getHopperFinals']=function(_0x440ed1,_0x2ece2d,_0x49cf3f){var _0x3f1f55={'raw':!![],'where':{}};var _0x9252d9={};var _0x125706={'count':0x0,'rows':[]};return db[_0x1a52('0x2c')][_0x1a52('0x58')]({'where':{'id':_0x440ed1[_0x1a52('0x45')]['id']}})[_0x1a52('0x24')](handleEntityNotFound(_0x2ece2d,null))['then'](function(_0x49dd35){if(_0x49dd35){_0x9252d9[_0x1a52('0x31')]=_['keys'](db[_0x1a52('0x60')][_0x1a52('0x2d')]);_0x9252d9[_0x1a52('0x33')]=_['keys'](_0x440ed1[_0x1a52('0x33')]);_0x9252d9[_0x1a52('0x34')]=_[_0x1a52('0x35')](_0x9252d9['model'],_0x9252d9['query']);_0x3f1f55[_0x1a52('0x36')]=_[_0x1a52('0x35')](_0x9252d9[_0x1a52('0x31')],qs[_0x1a52('0x37')](_0x440ed1[_0x1a52('0x33')][_0x1a52('0x37')]));_0x3f1f55[_0x1a52('0x36')]=_0x3f1f55['attributes'][_0x1a52('0x38')]?_0x3f1f55[_0x1a52('0x36')]:_0x9252d9[_0x1a52('0x31')];if(!_0x440ed1[_0x1a52('0x33')]['hasOwnProperty'](_0x1a52('0x5a'))){_0x3f1f55[_0x1a52('0x1b')]=qs[_0x1a52('0x1b')](_0x440ed1[_0x1a52('0x33')][_0x1a52('0x1b')]);_0x3f1f55[_0x1a52('0x1d')]=qs[_0x1a52('0x1d')](_0x440ed1[_0x1a52('0x33')][_0x1a52('0x1d')]);}_0x3f1f55[_0x1a52('0x39')]=qs['sort'](_0x440ed1[_0x1a52('0x33')][_0x1a52('0x3a')]);_0x3f1f55['where']=qs['filters'](_[_0x1a52('0x3b')](_0x440ed1[_0x1a52('0x33')],_0x9252d9['filters']));_0x3f1f55[_0x1a52('0x3d')][_0x1a52('0x5b')]=_0x49dd35['id'];if(_0x440ed1['query']['filter']){_0x3f1f55[_0x1a52('0x3d')]=_['merge'](_0x3f1f55[_0x1a52('0x3d')],{'$or':_[_0x1a52('0x2b')](_0x3f1f55['attributes'],function(_0x5a897f){var _0x4a6b71={};_0x4a6b71[_0x5a897f]={'$like':'%'+_0x440ed1[_0x1a52('0x33')][_0x1a52('0x3c')]+'%'};return _0x4a6b71;})});}_0x3f1f55=_[_0x1a52('0x3e')]({},_0x3f1f55,_0x440ed1[_0x1a52('0x40')]);return db['CmHopperFinal'][_0x1a52('0x1c')]({'where':_0x3f1f55[_0x1a52('0x3d')]})[_0x1a52('0x24')](function(_0x1ad5d8){_0x125706[_0x1a52('0x1c')]=_0x1ad5d8;if(_0x440ed1['query'][_0x1a52('0x52')]){_0x3f1f55['include']=[{'all':!![]}];}return db[_0x1a52('0x60')][_0x1a52('0x5d')](_0x3f1f55);})[_0x1a52('0x24')](function(_0x7a6fed){_0x125706['rows']=_0x7a6fed;return _0x125706;});}})[_0x1a52('0x24')](respondWithFilteredResult(_0x2ece2d,_0x3f1f55))['catch'](handleError(_0x2ece2d,null));};exports[_0x1a52('0x61')]=function(_0x298d64,_0x1dbecb,_0x4261af){var _0x290aab={'raw':!![],'where':{}};var _0x5740d0={};var _0x108c56={'count':0x0,'rows':[]};return db[_0x1a52('0x2c')][_0x1a52('0x58')]({'where':{'id':_0x298d64[_0x1a52('0x45')]['id']}})['then'](handleEntityNotFound(_0x1dbecb,null))[_0x1a52('0x24')](function(_0x3f9ee4){if(_0x3f9ee4){_0x5740d0[_0x1a52('0x31')]=_['keys'](db[_0x1a52('0x62')][_0x1a52('0x2d')]);_0x5740d0[_0x1a52('0x33')]=_['keys'](_0x298d64[_0x1a52('0x33')]);_0x5740d0['filters']=_['intersection'](_0x5740d0[_0x1a52('0x31')],_0x5740d0['query']);_0x290aab[_0x1a52('0x36')]=_[_0x1a52('0x35')](_0x5740d0[_0x1a52('0x31')],qs[_0x1a52('0x37')](_0x298d64[_0x1a52('0x33')][_0x1a52('0x37')]));_0x290aab[_0x1a52('0x36')]=_0x290aab[_0x1a52('0x36')][_0x1a52('0x38')]?_0x290aab[_0x1a52('0x36')]:_0x5740d0[_0x1a52('0x31')];if(!_0x298d64[_0x1a52('0x33')]['hasOwnProperty'](_0x1a52('0x5a'))){_0x290aab['limit']=qs[_0x1a52('0x1b')](_0x298d64[_0x1a52('0x33')][_0x1a52('0x1b')]);_0x290aab['offset']=qs['offset'](_0x298d64[_0x1a52('0x33')][_0x1a52('0x1d')]);}_0x290aab[_0x1a52('0x39')]=qs[_0x1a52('0x3a')](_0x298d64[_0x1a52('0x33')]['sort']);_0x290aab[_0x1a52('0x3d')]=qs['filters'](_[_0x1a52('0x3b')](_0x298d64[_0x1a52('0x33')],_0x5740d0[_0x1a52('0x34')]));_0x290aab[_0x1a52('0x3d')][_0x1a52('0x5b')]=_0x3f9ee4['id'];if(_0x298d64['query'][_0x1a52('0x3c')]){_0x290aab[_0x1a52('0x3d')]=_[_0x1a52('0x3e')](_0x290aab[_0x1a52('0x3d')],{'$or':_[_0x1a52('0x2b')](_0x290aab[_0x1a52('0x36')],function(_0x418db3){var _0x484539={};_0x484539[_0x418db3]={'$like':'%'+_0x298d64[_0x1a52('0x33')][_0x1a52('0x3c')]+'%'};return _0x484539;})});}_0x290aab=_[_0x1a52('0x3e')]({},_0x290aab,_0x298d64[_0x1a52('0x40')]);return db[_0x1a52('0x62')]['count']({'where':_0x290aab['where']})['then'](function(_0x163eb1){_0x108c56[_0x1a52('0x1c')]=_0x163eb1;if(_0x298d64[_0x1a52('0x33')]['includeAll']){_0x290aab[_0x1a52('0x41')]=[{'all':!![]}];}return db[_0x1a52('0x62')][_0x1a52('0x5d')](_0x290aab);})[_0x1a52('0x24')](function(_0x532f3b){_0x108c56[_0x1a52('0x42')]=_0x532f3b;return _0x108c56;});}})['then'](respondWithFilteredResult(_0x1dbecb,_0x290aab))[_0x1a52('0x43')](handleError(_0x1dbecb,null));};exports[_0x1a52('0x63')]=function(_0x232600,_0x2f8183,_0x4569ec){var _0x3e4999={};var _0x3b8320={};var _0x2f8ca5;var _0x2f7711;return db[_0x1a52('0x2c')][_0x1a52('0x58')]({'where':{'id':_0x232600[_0x1a52('0x45')]['id']}})[_0x1a52('0x24')](handleEntityNotFound(_0x2f8183,null))['then'](function(_0x3ad0ce){if(_0x3ad0ce){_0x2f8ca5=_0x3ad0ce;_0x3b8320[_0x1a52('0x31')]=_[_0x1a52('0x46')](db[_0x1a52('0x64')][_0x1a52('0x2d')]);_0x3b8320[_0x1a52('0x33')]=_[_0x1a52('0x46')](_0x232600[_0x1a52('0x33')]);_0x3b8320[_0x1a52('0x34')]=_[_0x1a52('0x35')](_0x3b8320[_0x1a52('0x31')],_0x3b8320[_0x1a52('0x33')]);_0x3e4999[_0x1a52('0x36')]=_[_0x1a52('0x35')](_0x3b8320[_0x1a52('0x31')],qs[_0x1a52('0x37')](_0x232600[_0x1a52('0x33')][_0x1a52('0x37')]));_0x3e4999[_0x1a52('0x36')]=_0x3e4999[_0x1a52('0x36')][_0x1a52('0x38')]?_0x3e4999['attributes']:_0x3b8320[_0x1a52('0x31')];_0x3e4999['order']=qs[_0x1a52('0x3a')](_0x232600['query']['sort']);_0x3e4999['where']=qs['filters'](_['pick'](_0x232600['query'],_0x3b8320[_0x1a52('0x34')]));if(_0x232600[_0x1a52('0x33')][_0x1a52('0x3c')]){_0x3e4999[_0x1a52('0x3d')]=_[_0x1a52('0x3e')](_0x3e4999[_0x1a52('0x3d')],{'$or':_['map'](_0x3e4999[_0x1a52('0x36')],function(_0x1ec35e){var _0xc5c141={};_0xc5c141[_0x1ec35e]={'$like':'%'+_0x232600['query'][_0x1a52('0x3c')]+'%'};return _0xc5c141;})});}_0x3e4999=_[_0x1a52('0x3e')]({},_0x3e4999,_0x232600[_0x1a52('0x40')]);return _0x2f8ca5['getLists'](_0x3e4999);}})['then'](function(_0x4518ad){if(_0x4518ad){_0x2f7711=_0x4518ad[_0x1a52('0x38')];if(!_0x232600[_0x1a52('0x33')][_0x1a52('0x59')](_0x1a52('0x5a'))){_0x3e4999[_0x1a52('0x1b')]=qs[_0x1a52('0x1b')](_0x232600[_0x1a52('0x33')][_0x1a52('0x1b')]);_0x3e4999[_0x1a52('0x1d')]=qs[_0x1a52('0x1d')](_0x232600[_0x1a52('0x33')]['offset']);}return _0x2f8ca5[_0x1a52('0x63')](_0x3e4999);}})['then'](function(_0x87d3ad){if(_0x87d3ad){return _0x87d3ad?{'count':_0x2f7711,'rows':_0x87d3ad}:null;}})[_0x1a52('0x24')](respondWithResult(_0x2f8183,null))[_0x1a52('0x43')](handleError(_0x2f8183,null));};exports[_0x1a52('0x65')]=function(_0x26fe81,_0x2ff4a9,_0x329bb4){var _0x27fefd,_0x4312d0;var _0x37be1e=[];var _0x40ae6e=moment()['format'](_0x1a52('0x66'));return db[_0x1a52('0x2c')]['find']({'where':{'id':_0x26fe81[_0x1a52('0x45')]['id']}})[_0x1a52('0x24')](handleEntityNotFound(_0x2ff4a9,null))[_0x1a52('0x24')](function(_0x16c8e0){if(_0x16c8e0){_0x4312d0=_0x16c8e0;return _0x16c8e0[_0x1a52('0x65')](_0x26fe81['body'][_0x1a52('0x67')],_[_0x1a52('0x56')](_0x26fe81[_0x1a52('0x55')],[_0x1a52('0x67'),'id'])||{});}return null;})[_0x1a52('0x68')](function(_0x4ee44c){var _0x1a868e;var _0x554a98;_0x27fefd=_0x4ee44c||[];var _0x1d54c8=[];if(_0x4ee44c){for(var _0x1e0d32=0x0;_0x1e0d32<_0x4ee44c['length'];_0x1e0d32+=0x1){var _0x3e1bfe=_0x4ee44c[_0x1e0d32]['get']({'plain':!![]});_0x4312d0['dialCheckDuplicateType']=_0x26fe81[_0x1a52('0x55')][_0x1a52('0x69')]?_0x26fe81[_0x1a52('0x55')][_0x1a52('0x69')]:_0x4312d0[_0x1a52('0x69')];switch(_0x4312d0[_0x1a52('0x69')]){case'always':_0x1a868e=squel[_0x1a52('0x6a')]()[_0x1a52('0x6b')]('cm_hopper')[_0x1a52('0x6c')]([_0x1a52('0x6d'),_0x1a52('0x6e'),_0x1a52('0x6f'),_0x1a52('0x70'),_0x1a52('0x5b'),_0x1a52('0x53'),'updatedAt'],squel['select']()[_0x1a52('0x71')](_0x1a52('0x6d'),_0x1a52('0x6d'))[_0x1a52('0x71')](_0x1a52('0x72'),_0x1a52('0x6e'))[_0x1a52('0x71')]('id',_0x1a52('0x6f'))[_0x1a52('0x71')](_0x3e1bfe[_0x1a52('0x73')][_0x1a52('0x74')](),_0x1a52('0x70'))[_0x1a52('0x71')](_0x26fe81[_0x1a52('0x45')]['id'][_0x1a52('0x74')](),'CampaignId')[_0x1a52('0x71')]('\x27'+_0x40ae6e+'\x27',_0x1a52('0x53'))['field']('\x27'+_0x40ae6e+'\x27','updatedAt')[_0x1a52('0x75')](_0x1a52('0x76'))['where'](_0x1a52('0x77'))['where'](_0x1a52('0x78'),_0x3e1bfe[_0x1a52('0x73')][_0x1a52('0x74')]())[_0x1a52('0x3d')](_0x1a52('0x79'))[_0x1a52('0x3d')](_0x1a52('0x7a'),squel[_0x1a52('0x7b')]()[_0x1a52('0x71')]('COALESCE(calleridnum,\x27\x27)')[_0x1a52('0x75')](_0x1a52('0x7c'))[_0x1a52('0x3d')](_0x1a52('0x7d'),_0x26fe81[_0x1a52('0x45')]['id'][_0x1a52('0x74')]()))['where'](_0x1a52('0x7a'),squel[_0x1a52('0x7b')]()[_0x1a52('0x71')](_0x1a52('0x7e'))[_0x1a52('0x75')](_0x1a52('0x7f'))['where'](_0x1a52('0x7d'),_0x26fe81[_0x1a52('0x45')]['id'][_0x1a52('0x74')]())))['toString']();break;case _0x1a52('0x80'):_0x1a868e=squel['insert']()[_0x1a52('0x6b')](_0x1a52('0x7f'))['fromQuery']([_0x1a52('0x6d'),_0x1a52('0x6e'),'ContactId','ListId',_0x1a52('0x5b'),_0x1a52('0x53'),_0x1a52('0x54')],squel[_0x1a52('0x7b')]()['field'](_0x1a52('0x6d'),'phone')['field'](_0x1a52('0x72'),_0x1a52('0x6e'))[_0x1a52('0x71')]('id','ContactId')[_0x1a52('0x71')](_0x3e1bfe[_0x1a52('0x73')][_0x1a52('0x74')](),_0x1a52('0x70'))[_0x1a52('0x71')](_0x26fe81[_0x1a52('0x45')]['id'][_0x1a52('0x74')](),_0x1a52('0x5b'))[_0x1a52('0x71')]('\x27'+_0x40ae6e+'\x27',_0x1a52('0x53'))[_0x1a52('0x71')]('\x27'+_0x40ae6e+'\x27',_0x1a52('0x54'))[_0x1a52('0x75')](_0x1a52('0x76'))[_0x1a52('0x3d')](_0x1a52('0x77'))[_0x1a52('0x3d')](_0x1a52('0x78'),_0x3e1bfe[_0x1a52('0x73')][_0x1a52('0x74')]())[_0x1a52('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x1a52('0x3d')](_0x1a52('0x7a'),squel[_0x1a52('0x7b')]()[_0x1a52('0x71')]('COALESCE(phone,\x27\x27)')['from'](_0x1a52('0x7f'))[_0x1a52('0x3d')](_0x1a52('0x7d'),_0x26fe81[_0x1a52('0x45')]['id'][_0x1a52('0x74')]())))[_0x1a52('0x74')]();break;default:_0x1a868e=squel[_0x1a52('0x6a')]()[_0x1a52('0x6b')](_0x1a52('0x7f'))[_0x1a52('0x6c')]([_0x1a52('0x6d'),_0x1a52('0x6e'),'ContactId',_0x1a52('0x70'),'CampaignId',_0x1a52('0x53'),_0x1a52('0x54')],squel[_0x1a52('0x7b')]()[_0x1a52('0x71')](_0x1a52('0x6d'),'phone')[_0x1a52('0x71')](_0x1a52('0x72'),_0x1a52('0x6e'))['field']('id',_0x1a52('0x6f'))[_0x1a52('0x71')](_0x3e1bfe[_0x1a52('0x73')][_0x1a52('0x74')](),_0x1a52('0x70'))[_0x1a52('0x71')](_0x26fe81['params']['id']['toString'](),_0x1a52('0x5b'))['field']('\x27'+_0x40ae6e+'\x27',_0x1a52('0x53'))[_0x1a52('0x71')]('\x27'+_0x40ae6e+'\x27',_0x1a52('0x54'))[_0x1a52('0x75')](_0x1a52('0x76'))[_0x1a52('0x3d')]('deletedAt\x20IS\x20NULL')[_0x1a52('0x3d')](_0x1a52('0x78'),_0x3e1bfe['CmListId'][_0x1a52('0x74')]())[_0x1a52('0x3d')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x554a98=squel[_0x1a52('0x6a')]()[_0x1a52('0x6b')]('cm_hopper_additional_phones')[_0x1a52('0x6c')]([_0x1a52('0x81'),_0x1a52('0x6e'),_0x1a52('0x6d'),_0x1a52('0x82'),'createdAt','updatedAt'],squel[_0x1a52('0x7b')]()['field'](_0x1a52('0x83'),'id')[_0x1a52('0x71')](_0x1a52('0x72'),_0x1a52('0x6e'))['field'](_0x1a52('0x84'),_0x1a52('0x6d'))[_0x1a52('0x71')](_0x1a52('0x85'),_0x1a52('0x82'))['field']('\x27'+_0x40ae6e+'\x27',_0x1a52('0x53'))[_0x1a52('0x71')]('\x27'+_0x40ae6e+'\x27','updatedAt')[_0x1a52('0x75')]('cm_contact_has_items','ci')['join'](_0x1a52('0x7f'),'h',_0x1a52('0x86'))[_0x1a52('0x3d')]('h.ListId\x20=\x20?',_0x3e1bfe[_0x1a52('0x73')][_0x1a52('0x74')]())[_0x1a52('0x3d')](_0x1a52('0x87'),_0x26fe81['params']['id'][_0x1a52('0x74')]())[_0x1a52('0x3d')](_0x1a52('0x88'),_0x40ae6e))[_0x1a52('0x74')]();_0x1d54c8[_0x1a52('0x89')](db[_0x1a52('0x8a')][_0x1a52('0x33')](_0x1a868e));_0x37be1e[_0x1a52('0x89')](db[_0x1a52('0x8a')]['query'](_0x554a98));}return BPromise[_0x1a52('0x8b')](_0x1d54c8);}})[_0x1a52('0x24')](function(){return BPromise['all'](_0x37be1e);})[_0x1a52('0x24')](function(){return _0x27fefd;})[_0x1a52('0x24')](respondWithResult(_0x2ff4a9,null))[_0x1a52('0x43')](handleError(_0x2ff4a9,null));};exports['removeLists']=function(_0x16ec3a,_0x6cbb4c,_0x49d601){return db[_0x1a52('0x2c')][_0x1a52('0x47')]({'where':{'id':_0x16ec3a[_0x1a52('0x45')]['id']}})[_0x1a52('0x24')](handleEntityNotFound(_0x6cbb4c,null))[_0x1a52('0x24')](function(_0x55f82b){if(_0x55f82b){return _0x55f82b[_0x1a52('0x8c')](_0x16ec3a[_0x1a52('0x33')][_0x1a52('0x67')]);}})[_0x1a52('0x24')](function(_0x37fd4e){if(_0x37fd4e){return db[_0x1a52('0x5c')]['destroy']({'where':{'ListId':_0x16ec3a[_0x1a52('0x33')]['ids'],'CampaignId':_0x16ec3a['params']['id']}})[_0x1a52('0x24')](function(){return _0x37fd4e;});}})[_0x1a52('0x24')](respondWithStatusCode(_0x6cbb4c,null))[_0x1a52('0x43')](handleError(_0x6cbb4c,null));};exports['getBlackLists']=function(_0x570e2d,_0x15c2ac,_0x31e944){var _0x5bfcc3={};var _0x9ae5a1={};var _0x5b393c;var _0x1d48dc;return db[_0x1a52('0x2c')]['findOne']({'where':{'id':_0x570e2d[_0x1a52('0x45')]['id']}})[_0x1a52('0x24')](handleEntityNotFound(_0x15c2ac,null))[_0x1a52('0x24')](function(_0xa93d7d){if(_0xa93d7d){_0x5b393c=_0xa93d7d;_0x9ae5a1['model']=_[_0x1a52('0x46')](db[_0x1a52('0x64')][_0x1a52('0x2d')]);_0x9ae5a1[_0x1a52('0x33')]=_[_0x1a52('0x46')](_0x570e2d['query']);_0x9ae5a1['filters']=_['intersection'](_0x9ae5a1[_0x1a52('0x31')],_0x9ae5a1[_0x1a52('0x33')]);_0x5bfcc3[_0x1a52('0x36')]=_['intersection'](_0x9ae5a1[_0x1a52('0x31')],qs[_0x1a52('0x37')](_0x570e2d[_0x1a52('0x33')][_0x1a52('0x37')]));_0x5bfcc3['attributes']=_0x5bfcc3[_0x1a52('0x36')][_0x1a52('0x38')]?_0x5bfcc3['attributes']:_0x9ae5a1[_0x1a52('0x31')];_0x5bfcc3['order']=qs[_0x1a52('0x3a')](_0x570e2d[_0x1a52('0x33')]['sort']);_0x5bfcc3[_0x1a52('0x3d')]=qs[_0x1a52('0x34')](_[_0x1a52('0x3b')](_0x570e2d['query'],_0x9ae5a1[_0x1a52('0x34')]));if(_0x570e2d[_0x1a52('0x33')]['filter']){_0x5bfcc3['where']=_[_0x1a52('0x3e')](_0x5bfcc3[_0x1a52('0x3d')],{'$or':_[_0x1a52('0x2b')](_0x5bfcc3[_0x1a52('0x36')],function(_0x57808d){var _0x5e7b7b={};_0x5e7b7b[_0x57808d]={'$like':'%'+_0x570e2d['query']['filter']+'%'};return _0x5e7b7b;})});}_0x5bfcc3=_[_0x1a52('0x3e')]({},_0x5bfcc3,_0x570e2d['options']);return _0x5b393c[_0x1a52('0x8d')](_0x5bfcc3);}})[_0x1a52('0x24')](function(_0x4ca38a){if(_0x4ca38a){_0x1d48dc=_0x4ca38a[_0x1a52('0x38')];if(!_0x570e2d[_0x1a52('0x33')][_0x1a52('0x59')]('nolimit')){_0x5bfcc3[_0x1a52('0x1b')]=qs[_0x1a52('0x1b')](_0x570e2d['query'][_0x1a52('0x1b')]);_0x5bfcc3[_0x1a52('0x1d')]=qs[_0x1a52('0x1d')](_0x570e2d['query'][_0x1a52('0x1d')]);}return _0x5b393c[_0x1a52('0x8d')](_0x5bfcc3);}})[_0x1a52('0x24')](function(_0x2be223){if(_0x2be223){return _0x2be223?{'count':_0x1d48dc,'rows':_0x2be223}:null;}})['then'](respondWithResult(_0x15c2ac,null))[_0x1a52('0x43')](handleError(_0x15c2ac,null));};exports['addBlackLists']=function(_0x323c8b,_0x427021,_0x2ca128){var _0x35d89a,_0xa501d3;var _0x513868=[];var _0x28e59e=moment()[_0x1a52('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x1a52('0x2c')]['find']({'where':{'id':_0x323c8b[_0x1a52('0x45')]['id']}})[_0x1a52('0x24')](handleEntityNotFound(_0x427021,null))[_0x1a52('0x24')](function(_0x20577b){if(_0x20577b){_0xa501d3=_0x20577b;return _0x20577b[_0x1a52('0x8f')](_0x323c8b[_0x1a52('0x55')][_0x1a52('0x67')],_[_0x1a52('0x56')](_0x323c8b['body'],[_0x1a52('0x67'),'id'])||{});}return null;})[_0x1a52('0x68')](function(_0x570c09){var _0x1a45b4;var _0x3f11c6;_0x35d89a=_0x570c09||[];var _0x4917a5=[];if(_0x570c09){for(var _0x145639=0x0;_0x145639<_0x570c09[_0x1a52('0x38')];_0x145639+=0x1){var _0x4d7b9c=_0x570c09[_0x145639][_0x1a52('0x4a')]({'plain':!![]});_0x1a45b4=squel[_0x1a52('0x6a')]()['into'](_0x1a52('0x90'))['fromQuery']([_0x1a52('0x6d'),_0x1a52('0x6f'),_0x1a52('0x70'),_0x1a52('0x5b'),_0x1a52('0x53'),'updatedAt'],squel[_0x1a52('0x7b')]()[_0x1a52('0x71')](_0x1a52('0x6d'),_0x1a52('0x6d'))['field']('id',_0x1a52('0x6f'))[_0x1a52('0x71')](_0x4d7b9c[_0x1a52('0x73')][_0x1a52('0x74')](),_0x1a52('0x70'))[_0x1a52('0x71')](_0x323c8b[_0x1a52('0x45')]['id'][_0x1a52('0x74')](),_0x1a52('0x5b'))[_0x1a52('0x71')]('NOW()',_0x1a52('0x53'))['field'](_0x1a52('0x72'),_0x1a52('0x54'))['from'](_0x1a52('0x76'))['where'](_0x1a52('0x77'))[_0x1a52('0x3d')]('ListId\x20=\x20?',_0x4d7b9c[_0x1a52('0x73')][_0x1a52('0x74')]())['where'](_0x1a52('0x79')))[_0x1a52('0x74')]();_0x4917a5[_0x1a52('0x89')](db[_0x1a52('0x8a')][_0x1a52('0x33')](_0x1a45b4));}return BPromise[_0x1a52('0x8b')](_0x4917a5);}})[_0x1a52('0x24')](function(){return _0x35d89a;})[_0x1a52('0x24')](respondWithResult(_0x427021,null))[_0x1a52('0x43')](handleError(_0x427021,null));};exports['removeBlackLists']=function(_0x569305,_0xdef048,_0x325b2d){return db[_0x1a52('0x2c')][_0x1a52('0x47')]({'where':{'id':_0x569305[_0x1a52('0x45')]['id']}})[_0x1a52('0x24')](handleEntityNotFound(_0xdef048,null))[_0x1a52('0x24')](function(_0x1f1410){if(_0x1f1410){return _0x1f1410[_0x1a52('0x91')](_0x569305[_0x1a52('0x33')][_0x1a52('0x67')]);}})[_0x1a52('0x24')](function(_0x4da621){if(_0x4da621){return db[_0x1a52('0x62')][_0x1a52('0x25')]({'where':{'ListId':_0x569305[_0x1a52('0x33')]['ids'],'CampaignId':_0x569305[_0x1a52('0x45')]['id']}})[_0x1a52('0x24')](function(){return _0x4da621;});}})[_0x1a52('0x24')](respondWithStatusCode(_0xdef048,null))[_0x1a52('0x43')](handleError(_0xdef048,null));}; \ No newline at end of file +var _0x10a5=['rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','select','field','NOW()','ContactId','CmListId','toString','from','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','ListId','deletedAt\x20IS\x20NULL','cm_contacts','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','fields','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','CmHopper','CampaignId'];(function(_0x2d5e99,_0x56257b){var _0x3a3594=function(_0x5ca9b1){while(--_0x5ca9b1){_0x2d5e99['push'](_0x2d5e99['shift']());}};_0x3a3594(++_0x56257b);}(_0x10a5,0x163));var _0x510a=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x10a5[_0xbeb808];return _0x5d6909;};'use strict';var emlformat=require(_0x510a('0x0'));var rimraf=require(_0x510a('0x1'));var zipdir=require(_0x510a('0x2'));var jsonpatch=require(_0x510a('0x3'));var rp=require(_0x510a('0x4'));var moment=require(_0x510a('0x5'));var BPromise=require(_0x510a('0x6'));var Mustache=require(_0x510a('0x7'));var util=require(_0x510a('0x8'));var path=require(_0x510a('0x9'));var sox=require(_0x510a('0xa'));var csv=require(_0x510a('0xb'));var ejs=require(_0x510a('0xc'));var fs=require('fs');var fs_extra=require(_0x510a('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x510a('0xe'));var jsforce=require(_0x510a('0xf'));var deskjs=require(_0x510a('0x10'));var toCsv=require(_0x510a('0xb'));var querystring=require(_0x510a('0x11'));var Papa=require(_0x510a('0x12'));var Redis=require(_0x510a('0x13'));var authService=require(_0x510a('0x14'));var qs=require(_0x510a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x510a('0x16'));var logger=require(_0x510a('0x17'))('api');var utils=require(_0x510a('0x18'));var config=require(_0x510a('0x19'));var licenseUtil=require(_0x510a('0x1a'));var db=require(_0x510a('0x1b'))['db'];function respondWithStatusCode(_0x3d34db,_0x34a844){_0x34a844=_0x34a844||0xcc;return function(_0x25facc){if(_0x25facc){return _0x3d34db[_0x510a('0x1c')](_0x34a844);}return _0x3d34db['status'](_0x34a844)[_0x510a('0x1d')]();};}function respondWithResult(_0x35e9f1,_0x502a54){_0x502a54=_0x502a54||0xc8;return function(_0x494b03){if(_0x494b03){return _0x35e9f1['status'](_0x502a54)[_0x510a('0x1e')](_0x494b03);}};}function respondWithFilteredResult(_0x6acae2,_0x4398fb){return function(_0x117e1b){if(_0x117e1b){var _0x15fd06=typeof _0x4398fb[_0x510a('0x1f')]==='undefined'&&typeof _0x4398fb[_0x510a('0x20')]===_0x510a('0x21');var _0x4be66d=_0x117e1b[_0x510a('0x22')];var _0x36767a=_0x15fd06?0x0:_0x4398fb[_0x510a('0x1f')];var _0x4f9ded=_0x15fd06?_0x117e1b[_0x510a('0x22')]:_0x4398fb['offset']+_0x4398fb[_0x510a('0x20')];var _0x1d78c1;if(_0x4f9ded>=_0x4be66d){_0x4f9ded=_0x4be66d;_0x1d78c1=0xc8;}else{_0x1d78c1=0xce;}_0x6acae2[_0x510a('0x23')](_0x1d78c1);return _0x6acae2[_0x510a('0x24')](_0x510a('0x25'),_0x36767a+'-'+_0x4f9ded+'/'+_0x4be66d)['json'](_0x117e1b);}return null;};}function patchUpdates(_0x8238db){return function(_0x339f84){try{jsonpatch[_0x510a('0x26')](_0x339f84,_0x8238db,!![]);}catch(_0x278480){return BPromise[_0x510a('0x27')](_0x278480);}return _0x339f84[_0x510a('0x28')]();};}function saveUpdates(_0x5b24fb,_0x40ab4b){return function(_0x4ee01f){if(_0x4ee01f){return _0x4ee01f[_0x510a('0x29')](_0x5b24fb)[_0x510a('0x2a')](function(_0x1bd848){return _0x1bd848;});}return null;};}function removeEntity(_0x5d883a,_0x171cfb){return function(_0x215775){if(_0x215775){return _0x215775['destroy']()[_0x510a('0x2a')](function(){var _0x54cc9c=_0x215775[_0x510a('0x2b')]({'plain':!![]});var _0x26bcf1=_0x510a('0x2c');return db[_0x510a('0x2d')][_0x510a('0x2e')]({'where':{'type':_0x26bcf1,'resourceId':_0x54cc9c['id']}})[_0x510a('0x2a')](function(){return _0x215775;});})[_0x510a('0x2a')](function(){_0x5d883a[_0x510a('0x23')](0xcc)[_0x510a('0x1d')]();});}};}function handleEntityNotFound(_0x26b4f8,_0x24fc29){return function(_0xc5f5e4){if(!_0xc5f5e4){_0x26b4f8[_0x510a('0x1c')](0x194);}return _0xc5f5e4;};}function handleError(_0x181506,_0x3960f0){_0x3960f0=_0x3960f0||0x1f4;return function(_0x1b7e4b){logger[_0x510a('0x2f')](_0x1b7e4b[_0x510a('0x30')]);if(_0x1b7e4b[_0x510a('0x31')]){delete _0x1b7e4b[_0x510a('0x31')];}_0x181506[_0x510a('0x23')](_0x3960f0)['send'](_0x1b7e4b);};}exports[_0x510a('0x32')]=function(_0x2a4bd2,_0x48f9eb){var _0x13bee8={},_0x11c27c={},_0x48f79d={'count':0x0,'rows':[]};var _0x2709a0=_[_0x510a('0x33')](db[_0x510a('0x34')][_0x510a('0x35')],function(_0x2f49a8){return{'name':_0x2f49a8[_0x510a('0x36')],'type':_0x2f49a8[_0x510a('0x37')][_0x510a('0x38')]};});_0x11c27c[_0x510a('0x39')]=_[_0x510a('0x33')](_0x2709a0,_0x510a('0x31'));_0x11c27c[_0x510a('0x3a')]=_[_0x510a('0x3b')](_0x2a4bd2[_0x510a('0x3a')]);_0x11c27c[_0x510a('0x3c')]=_[_0x510a('0x3d')](_0x11c27c[_0x510a('0x39')],_0x11c27c[_0x510a('0x3a')]);_0x13bee8['attributes']=_[_0x510a('0x3d')](_0x11c27c[_0x510a('0x39')],qs['fields'](_0x2a4bd2['query']['fields']));_0x13bee8['attributes']=_0x13bee8[_0x510a('0x3e')][_0x510a('0x3f')]?_0x13bee8[_0x510a('0x3e')]:_0x11c27c[_0x510a('0x39')];if(!_0x2a4bd2['query'][_0x510a('0x40')](_0x510a('0x41'))){_0x13bee8[_0x510a('0x20')]=qs[_0x510a('0x20')](_0x2a4bd2['query'][_0x510a('0x20')]);_0x13bee8[_0x510a('0x1f')]=qs[_0x510a('0x1f')](_0x2a4bd2[_0x510a('0x3a')][_0x510a('0x1f')]);}_0x13bee8[_0x510a('0x42')]=qs[_0x510a('0x43')](_0x2a4bd2[_0x510a('0x3a')][_0x510a('0x43')]);_0x13bee8[_0x510a('0x44')]=qs[_0x510a('0x3c')](_[_0x510a('0x45')](_0x2a4bd2[_0x510a('0x3a')],_0x11c27c[_0x510a('0x3c')]),_0x2709a0);if(_0x2a4bd2[_0x510a('0x3a')][_0x510a('0x46')]){_0x13bee8[_0x510a('0x44')]=_['merge'](_0x13bee8['where'],{'$or':_[_0x510a('0x33')](_0x2709a0,function(_0x470685){if(_0x470685[_0x510a('0x37')]!==_0x510a('0x47')){var _0x3cda3b={};_0x3cda3b[_0x470685[_0x510a('0x31')]]={'$like':'%'+_0x2a4bd2[_0x510a('0x3a')]['filter']+'%'};return _0x3cda3b;}})});}_0x13bee8=_[_0x510a('0x48')]({},_0x13bee8,_0x2a4bd2[_0x510a('0x49')]);var _0x1f4dbc={'where':_0x13bee8[_0x510a('0x44')]};return db[_0x510a('0x34')]['count'](_0x1f4dbc)[_0x510a('0x2a')](function(_0x1ab9f7){_0x48f79d['count']=_0x1ab9f7;if(_0x2a4bd2[_0x510a('0x3a')][_0x510a('0x4a')]){_0x13bee8['include']=[{'all':!![]}];}return db[_0x510a('0x34')][_0x510a('0x4b')](_0x13bee8);})[_0x510a('0x2a')](function(_0x4baca0){_0x48f79d['rows']=_0x4baca0;return _0x48f79d;})['then'](respondWithFilteredResult(_0x48f9eb,_0x13bee8))[_0x510a('0x4c')](handleError(_0x48f9eb,null));};exports[_0x510a('0x4d')]=function(_0x79a8f5,_0x3e1c42){var _0x1c5b91={'raw':![],'where':{'id':_0x79a8f5[_0x510a('0x4e')]['id']}},_0x4d328e={};_0x4d328e[_0x510a('0x39')]=_['keys'](db[_0x510a('0x34')][_0x510a('0x35')]);_0x4d328e[_0x510a('0x3a')]=_[_0x510a('0x3b')](_0x79a8f5[_0x510a('0x3a')]);_0x4d328e[_0x510a('0x3c')]=_['intersection'](_0x4d328e[_0x510a('0x39')],_0x4d328e['query']);_0x1c5b91[_0x510a('0x3e')]=_[_0x510a('0x3d')](_0x4d328e[_0x510a('0x39')],qs[_0x510a('0x4f')](_0x79a8f5['query'][_0x510a('0x4f')]));_0x1c5b91['attributes']=_0x1c5b91[_0x510a('0x3e')][_0x510a('0x3f')]?_0x1c5b91['attributes']:_0x4d328e[_0x510a('0x39')];if(_0x79a8f5[_0x510a('0x3a')][_0x510a('0x4a')]){_0x1c5b91[_0x510a('0x50')]=[{'all':!![]}];}_0x1c5b91=_[_0x510a('0x48')]({},_0x1c5b91,_0x79a8f5['options']);return db[_0x510a('0x34')][_0x510a('0x51')](_0x1c5b91)[_0x510a('0x2a')](handleEntityNotFound(_0x3e1c42,null))[_0x510a('0x2a')](respondWithResult(_0x3e1c42,null))[_0x510a('0x4c')](handleError(_0x3e1c42,null));};exports[_0x510a('0x52')]=function(_0x2927e2,_0x423490){return db[_0x510a('0x34')]['create'](_0x2927e2[_0x510a('0x53')],{})[_0x510a('0x2a')](function(_0x5b00f5){var _0x3d8f7f=_0x2927e2['user']['get']({'plain':!![]});if(!_0x3d8f7f)throw new Error(_0x510a('0x54'));if(_0x3d8f7f['role']===_0x510a('0x55')){var _0x4ba36d=_0x5b00f5[_0x510a('0x2b')]({'plain':!![]});var _0x85100a=_0x510a('0x2c');return db['UserProfileSection'][_0x510a('0x51')]({'where':{'name':_0x85100a,'userProfileId':_0x3d8f7f[_0x510a('0x56')]},'raw':!![]})[_0x510a('0x2a')](function(_0x4c8053){if(_0x4c8053&&_0x4c8053['autoAssociation']===0x0){return db[_0x510a('0x2d')][_0x510a('0x52')]({'name':_0x4ba36d[_0x510a('0x31')],'resourceId':_0x4ba36d['id'],'type':_0x4c8053[_0x510a('0x31')],'sectionId':_0x4c8053['id']},{})[_0x510a('0x2a')](function(){return _0x5b00f5;});}else{return _0x5b00f5;}})['catch'](function(_0x4923db){logger['error'](_0x510a('0x57'),_0x4923db);throw _0x4923db;});}return _0x5b00f5;})[_0x510a('0x2a')](respondWithResult(_0x423490,0xc9))[_0x510a('0x4c')](handleError(_0x423490,null));};exports[_0x510a('0x58')]=function(_0x22d6ae,_0x5638d9){var _0x1cc34a={'where':{'id':_0x22d6ae[_0x510a('0x4e')]['id']}},_0x18cfd6={};_0x18cfd6[_0x510a('0x39')]=_[_0x510a('0x3b')](db[_0x510a('0x34')][_0x510a('0x35')]);_0x1cc34a[_0x510a('0x3e')]=_[_0x510a('0x3d')](_0x18cfd6[_0x510a('0x39')],qs[_0x510a('0x4f')](_0x22d6ae[_0x510a('0x3a')][_0x510a('0x4f')]));_0x1cc34a[_0x510a('0x3e')]=_0x1cc34a[_0x510a('0x3e')]['length']?_0x1cc34a[_0x510a('0x3e')]:_0x18cfd6['model'];if(_0x22d6ae[_0x510a('0x3a')][_0x510a('0x4a')]){_0x1cc34a[_0x510a('0x50')]=[{'all':!![]}];}_0x1cc34a=_[_0x510a('0x48')]({},_0x1cc34a,_0x22d6ae[_0x510a('0x49')]);return db[_0x510a('0x34')][_0x510a('0x51')](_0x1cc34a)['then'](handleEntityNotFound(_0x5638d9,null))[_0x510a('0x2a')](function(_0x256c59){if(_0x256c59){var _0x257426=_0x256c59[_0x510a('0x2b')]({'plain':!![]});_0x257426=qs[_0x510a('0x59')](_0x257426,['id',_0x510a('0x5a'),_0x510a('0x5b')]);_0x22d6ae[_0x510a('0x53')]=_['omit'](_0x22d6ae['body'],['id','createdAt',_0x510a('0x5b')]);return db['Campaign'][_0x510a('0x52')](_[_0x510a('0x48')](_0x257426,_0x22d6ae['body']),{'include':_0x22d6ae[_0x510a('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x510a('0x2a')](function(_0x28231e){var _0xab3623=_0x22d6ae[_0x510a('0x55')][_0x510a('0x2b')]({'plain':!![]});if(!_0xab3623)throw new Error(_0x510a('0x54'));if(_0xab3623['role']===_0x510a('0x55')){var _0x1f3b94=_0x28231e[_0x510a('0x2b')]({'plain':!![]});var _0x735e75=_0x510a('0x2c');return db['UserProfileSection'][_0x510a('0x51')]({'where':{'name':_0x735e75,'userProfileId':_0xab3623[_0x510a('0x56')]},'raw':!![]})[_0x510a('0x2a')](function(_0x4fbd15){if(_0x4fbd15&&_0x4fbd15['autoAssociation']===0x0){return db[_0x510a('0x2d')][_0x510a('0x52')]({'name':_0x1f3b94['name'],'resourceId':_0x1f3b94['id'],'type':_0x4fbd15[_0x510a('0x31')],'sectionId':_0x4fbd15['id']},{})[_0x510a('0x2a')](function(){return _0x28231e;});}else{return _0x28231e;}})['catch'](function(_0x51505c){logger[_0x510a('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51505c);throw _0x51505c;});}return _0x28231e;});}})[_0x510a('0x2a')](respondWithResult(_0x5638d9,0xc9))[_0x510a('0x4c')](handleError(_0x5638d9,null));};exports[_0x510a('0x29')]=function(_0x41de27,_0x4bb06d){if(_0x41de27[_0x510a('0x53')]['id']){delete _0x41de27[_0x510a('0x53')]['id'];}return db[_0x510a('0x34')][_0x510a('0x51')]({'where':{'id':_0x41de27[_0x510a('0x4e')]['id']}})[_0x510a('0x2a')](handleEntityNotFound(_0x4bb06d,null))['then'](saveUpdates(_0x41de27['body'],null))[_0x510a('0x2a')](respondWithResult(_0x4bb06d,null))['catch'](handleError(_0x4bb06d,null));};exports[_0x510a('0x2e')]=function(_0x46aac6,_0x7c402){return db[_0x510a('0x34')][_0x510a('0x51')]({'where':{'id':_0x46aac6[_0x510a('0x4e')]['id']}})[_0x510a('0x2a')](handleEntityNotFound(_0x7c402,null))['then'](removeEntity(_0x7c402,null))['catch'](handleError(_0x7c402,null));};exports[_0x510a('0x5c')]=function(_0x1aeb32,_0x409bf9,_0x32d4b1){var _0x2823e8={'raw':!![],'where':{}};var _0x1d1fa8={};var _0x36a5d5={'count':0x0,'rows':[]};return db[_0x510a('0x34')]['findOne']({'where':{'id':_0x1aeb32[_0x510a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x409bf9,null))['then'](function(_0x5db955){if(_0x5db955){_0x1d1fa8[_0x510a('0x39')]=_[_0x510a('0x3b')](db[_0x510a('0x5d')][_0x510a('0x35')]);_0x1d1fa8[_0x510a('0x3a')]=_[_0x510a('0x3b')](_0x1aeb32['query']);_0x1d1fa8['filters']=_[_0x510a('0x3d')](_0x1d1fa8[_0x510a('0x39')],_0x1d1fa8[_0x510a('0x3a')]);_0x2823e8[_0x510a('0x3e')]=_[_0x510a('0x3d')](_0x1d1fa8[_0x510a('0x39')],qs[_0x510a('0x4f')](_0x1aeb32['query']['fields']));_0x2823e8[_0x510a('0x3e')]=_0x2823e8[_0x510a('0x3e')]['length']?_0x2823e8[_0x510a('0x3e')]:_0x1d1fa8[_0x510a('0x39')];if(!_0x1aeb32['query'][_0x510a('0x40')]('nolimit')){_0x2823e8['limit']=qs['limit'](_0x1aeb32[_0x510a('0x3a')]['limit']);_0x2823e8['offset']=qs[_0x510a('0x1f')](_0x1aeb32[_0x510a('0x3a')][_0x510a('0x1f')]);}_0x2823e8['order']=qs[_0x510a('0x43')](_0x1aeb32[_0x510a('0x3a')][_0x510a('0x43')]);_0x2823e8[_0x510a('0x44')]=qs[_0x510a('0x3c')](_[_0x510a('0x45')](_0x1aeb32['query'],_0x1d1fa8[_0x510a('0x3c')]));_0x2823e8[_0x510a('0x44')][_0x510a('0x5e')]=_0x5db955['id'];if(_0x1aeb32[_0x510a('0x3a')][_0x510a('0x46')]){_0x2823e8[_0x510a('0x44')]=_[_0x510a('0x48')](_0x2823e8['where'],{'$or':_[_0x510a('0x33')](_0x2823e8['attributes'],function(_0x5d9747){var _0x208570={};_0x208570[_0x5d9747]={'$like':'%'+_0x1aeb32[_0x510a('0x3a')][_0x510a('0x46')]+'%'};return _0x208570;})});}_0x2823e8=_[_0x510a('0x48')]({},_0x2823e8,_0x1aeb32[_0x510a('0x49')]);return db[_0x510a('0x5d')][_0x510a('0x22')]({'where':_0x2823e8['where']})['then'](function(_0x4baa69){_0x36a5d5['count']=_0x4baa69;if(_0x1aeb32[_0x510a('0x3a')][_0x510a('0x4a')]){_0x2823e8[_0x510a('0x50')]=[{'all':!![]}];}return db[_0x510a('0x5d')][_0x510a('0x4b')](_0x2823e8);})[_0x510a('0x2a')](function(_0xc9c49){_0x36a5d5[_0x510a('0x5f')]=_0xc9c49;return _0x36a5d5;});}})['then'](respondWithFilteredResult(_0x409bf9,_0x2823e8))['catch'](handleError(_0x409bf9,null));};exports[_0x510a('0x60')]=function(_0x1eb86f,_0x4966cc,_0x1ce4e3){var _0x3c5d3b={'raw':!![],'where':{}};var _0x9d8a19={};var _0x43aa77={'count':0x0,'rows':[]};return db[_0x510a('0x34')][_0x510a('0x61')]({'where':{'id':_0x1eb86f['params']['id']}})[_0x510a('0x2a')](handleEntityNotFound(_0x4966cc,null))[_0x510a('0x2a')](function(_0x386cfe){if(_0x386cfe){_0x9d8a19[_0x510a('0x39')]=_[_0x510a('0x3b')](db['CmHopperHistory'][_0x510a('0x35')]);_0x9d8a19['query']=_[_0x510a('0x3b')](_0x1eb86f['query']);_0x9d8a19[_0x510a('0x3c')]=_[_0x510a('0x3d')](_0x9d8a19[_0x510a('0x39')],_0x9d8a19['query']);_0x3c5d3b[_0x510a('0x3e')]=_[_0x510a('0x3d')](_0x9d8a19[_0x510a('0x39')],qs[_0x510a('0x4f')](_0x1eb86f['query'][_0x510a('0x4f')]));_0x3c5d3b['attributes']=_0x3c5d3b[_0x510a('0x3e')][_0x510a('0x3f')]?_0x3c5d3b[_0x510a('0x3e')]:_0x9d8a19[_0x510a('0x39')];if(!_0x1eb86f[_0x510a('0x3a')][_0x510a('0x40')]('nolimit')){_0x3c5d3b['limit']=qs[_0x510a('0x20')](_0x1eb86f['query'][_0x510a('0x20')]);_0x3c5d3b[_0x510a('0x1f')]=qs['offset'](_0x1eb86f[_0x510a('0x3a')][_0x510a('0x1f')]);}_0x3c5d3b['order']=qs[_0x510a('0x43')](_0x1eb86f[_0x510a('0x3a')][_0x510a('0x43')]);_0x3c5d3b[_0x510a('0x44')]=qs[_0x510a('0x3c')](_['pick'](_0x1eb86f[_0x510a('0x3a')],_0x9d8a19['filters']));_0x3c5d3b[_0x510a('0x44')][_0x510a('0x5e')]=_0x386cfe['id'];if(_0x1eb86f['query'][_0x510a('0x46')]){_0x3c5d3b[_0x510a('0x44')]=_[_0x510a('0x48')](_0x3c5d3b[_0x510a('0x44')],{'$or':_[_0x510a('0x33')](_0x3c5d3b[_0x510a('0x3e')],function(_0x17b48c){var _0x5fe2f1={};_0x5fe2f1[_0x17b48c]={'$like':'%'+_0x1eb86f[_0x510a('0x3a')]['filter']+'%'};return _0x5fe2f1;})});}_0x3c5d3b=_['merge']({},_0x3c5d3b,_0x1eb86f['options']);return db[_0x510a('0x62')][_0x510a('0x22')]({'where':_0x3c5d3b[_0x510a('0x44')]})[_0x510a('0x2a')](function(_0x597007){_0x43aa77[_0x510a('0x22')]=_0x597007;if(_0x1eb86f[_0x510a('0x3a')][_0x510a('0x4a')]){_0x3c5d3b[_0x510a('0x50')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x510a('0x4b')](_0x3c5d3b);})['then'](function(_0x79d012){_0x43aa77[_0x510a('0x5f')]=_0x79d012;return _0x43aa77;});}})['then'](respondWithFilteredResult(_0x4966cc,_0x3c5d3b))[_0x510a('0x4c')](handleError(_0x4966cc,null));};exports[_0x510a('0x63')]=function(_0x361fa5,_0x56a9c0,_0x28dfd3){var _0xed6fd6={'raw':!![],'where':{}};var _0xabb5d4={};var _0x4646e3={'count':0x0,'rows':[]};return db[_0x510a('0x34')]['findOne']({'where':{'id':_0x361fa5[_0x510a('0x4e')]['id']}})[_0x510a('0x2a')](handleEntityNotFound(_0x56a9c0,null))[_0x510a('0x2a')](function(_0x990663){if(_0x990663){_0xabb5d4[_0x510a('0x39')]=_['keys'](db[_0x510a('0x64')][_0x510a('0x35')]);_0xabb5d4['query']=_[_0x510a('0x3b')](_0x361fa5[_0x510a('0x3a')]);_0xabb5d4[_0x510a('0x3c')]=_[_0x510a('0x3d')](_0xabb5d4[_0x510a('0x39')],_0xabb5d4[_0x510a('0x3a')]);_0xed6fd6[_0x510a('0x3e')]=_[_0x510a('0x3d')](_0xabb5d4['model'],qs[_0x510a('0x4f')](_0x361fa5[_0x510a('0x3a')][_0x510a('0x4f')]));_0xed6fd6['attributes']=_0xed6fd6[_0x510a('0x3e')][_0x510a('0x3f')]?_0xed6fd6[_0x510a('0x3e')]:_0xabb5d4[_0x510a('0x39')];if(!_0x361fa5[_0x510a('0x3a')][_0x510a('0x40')]('nolimit')){_0xed6fd6[_0x510a('0x20')]=qs['limit'](_0x361fa5[_0x510a('0x3a')][_0x510a('0x20')]);_0xed6fd6[_0x510a('0x1f')]=qs[_0x510a('0x1f')](_0x361fa5['query'][_0x510a('0x1f')]);}_0xed6fd6[_0x510a('0x42')]=qs[_0x510a('0x43')](_0x361fa5['query'][_0x510a('0x43')]);_0xed6fd6[_0x510a('0x44')]=qs[_0x510a('0x3c')](_[_0x510a('0x45')](_0x361fa5['query'],_0xabb5d4[_0x510a('0x3c')]));_0xed6fd6[_0x510a('0x44')]['CampaignId']=_0x990663['id'];if(_0x361fa5[_0x510a('0x3a')]['filter']){_0xed6fd6[_0x510a('0x44')]=_[_0x510a('0x48')](_0xed6fd6[_0x510a('0x44')],{'$or':_['map'](_0xed6fd6[_0x510a('0x3e')],function(_0x317e60){var _0x366ee0={};_0x366ee0[_0x317e60]={'$like':'%'+_0x361fa5[_0x510a('0x3a')][_0x510a('0x46')]+'%'};return _0x366ee0;})});}_0xed6fd6=_[_0x510a('0x48')]({},_0xed6fd6,_0x361fa5['options']);return db[_0x510a('0x64')][_0x510a('0x22')]({'where':_0xed6fd6[_0x510a('0x44')]})[_0x510a('0x2a')](function(_0x5f21e8){_0x4646e3[_0x510a('0x22')]=_0x5f21e8;if(_0x361fa5[_0x510a('0x3a')][_0x510a('0x4a')]){_0xed6fd6[_0x510a('0x50')]=[{'all':!![]}];}return db[_0x510a('0x64')][_0x510a('0x4b')](_0xed6fd6);})[_0x510a('0x2a')](function(_0x9d4f67){_0x4646e3[_0x510a('0x5f')]=_0x9d4f67;return _0x4646e3;});}})[_0x510a('0x2a')](respondWithFilteredResult(_0x56a9c0,_0xed6fd6))[_0x510a('0x4c')](handleError(_0x56a9c0,null));};exports[_0x510a('0x65')]=function(_0x1c9322,_0x59448d,_0x5448c4){var _0x13ab9d={'raw':!![],'where':{}};var _0x1179ea={};var _0x1f104a={'count':0x0,'rows':[]};return db[_0x510a('0x34')][_0x510a('0x61')]({'where':{'id':_0x1c9322[_0x510a('0x4e')]['id']}})[_0x510a('0x2a')](handleEntityNotFound(_0x59448d,null))[_0x510a('0x2a')](function(_0x2c0c05){if(_0x2c0c05){_0x1179ea['model']=_['keys'](db['CmHopperBlack'][_0x510a('0x35')]);_0x1179ea['query']=_[_0x510a('0x3b')](_0x1c9322[_0x510a('0x3a')]);_0x1179ea['filters']=_['intersection'](_0x1179ea[_0x510a('0x39')],_0x1179ea[_0x510a('0x3a')]);_0x13ab9d[_0x510a('0x3e')]=_[_0x510a('0x3d')](_0x1179ea[_0x510a('0x39')],qs[_0x510a('0x4f')](_0x1c9322[_0x510a('0x3a')][_0x510a('0x4f')]));_0x13ab9d['attributes']=_0x13ab9d[_0x510a('0x3e')][_0x510a('0x3f')]?_0x13ab9d[_0x510a('0x3e')]:_0x1179ea['model'];if(!_0x1c9322[_0x510a('0x3a')]['hasOwnProperty'](_0x510a('0x41'))){_0x13ab9d[_0x510a('0x20')]=qs[_0x510a('0x20')](_0x1c9322['query'][_0x510a('0x20')]);_0x13ab9d[_0x510a('0x1f')]=qs[_0x510a('0x1f')](_0x1c9322[_0x510a('0x3a')][_0x510a('0x1f')]);}_0x13ab9d[_0x510a('0x42')]=qs[_0x510a('0x43')](_0x1c9322['query']['sort']);_0x13ab9d[_0x510a('0x44')]=qs['filters'](_[_0x510a('0x45')](_0x1c9322['query'],_0x1179ea['filters']));_0x13ab9d[_0x510a('0x44')]['CampaignId']=_0x2c0c05['id'];if(_0x1c9322[_0x510a('0x3a')][_0x510a('0x46')]){_0x13ab9d[_0x510a('0x44')]=_['merge'](_0x13ab9d[_0x510a('0x44')],{'$or':_[_0x510a('0x33')](_0x13ab9d['attributes'],function(_0x55be46){var _0x3d4463={};_0x3d4463[_0x55be46]={'$like':'%'+_0x1c9322[_0x510a('0x3a')][_0x510a('0x46')]+'%'};return _0x3d4463;})});}_0x13ab9d=_[_0x510a('0x48')]({},_0x13ab9d,_0x1c9322[_0x510a('0x49')]);return db['CmHopperBlack']['count']({'where':_0x13ab9d[_0x510a('0x44')]})['then'](function(_0x23c39d){_0x1f104a['count']=_0x23c39d;if(_0x1c9322[_0x510a('0x3a')][_0x510a('0x4a')]){_0x13ab9d[_0x510a('0x50')]=[{'all':!![]}];}return db[_0x510a('0x66')][_0x510a('0x4b')](_0x13ab9d);})[_0x510a('0x2a')](function(_0x6d674a){_0x1f104a[_0x510a('0x5f')]=_0x6d674a;return _0x1f104a;});}})['then'](respondWithFilteredResult(_0x59448d,_0x13ab9d))[_0x510a('0x4c')](handleError(_0x59448d,null));};exports[_0x510a('0x67')]=function(_0x486bab,_0x41d2a6,_0x265acc){var _0x35035b={};var _0x6acdf7={};var _0x408154;var _0x33520b;return db[_0x510a('0x34')][_0x510a('0x61')]({'where':{'id':_0x486bab[_0x510a('0x4e')]['id']}})[_0x510a('0x2a')](handleEntityNotFound(_0x41d2a6,null))[_0x510a('0x2a')](function(_0x3f1da4){if(_0x3f1da4){_0x408154=_0x3f1da4;_0x6acdf7[_0x510a('0x39')]=_[_0x510a('0x3b')](db[_0x510a('0x68')][_0x510a('0x35')]);_0x6acdf7[_0x510a('0x3a')]=_[_0x510a('0x3b')](_0x486bab[_0x510a('0x3a')]);_0x6acdf7[_0x510a('0x3c')]=_[_0x510a('0x3d')](_0x6acdf7['model'],_0x6acdf7[_0x510a('0x3a')]);_0x35035b[_0x510a('0x3e')]=_[_0x510a('0x3d')](_0x6acdf7[_0x510a('0x39')],qs['fields'](_0x486bab[_0x510a('0x3a')][_0x510a('0x4f')]));_0x35035b['attributes']=_0x35035b[_0x510a('0x3e')][_0x510a('0x3f')]?_0x35035b[_0x510a('0x3e')]:_0x6acdf7['model'];_0x35035b[_0x510a('0x42')]=qs[_0x510a('0x43')](_0x486bab[_0x510a('0x3a')][_0x510a('0x43')]);_0x35035b['where']=qs['filters'](_[_0x510a('0x45')](_0x486bab[_0x510a('0x3a')],_0x6acdf7['filters']));if(_0x486bab['query'][_0x510a('0x46')]){_0x35035b[_0x510a('0x44')]=_['merge'](_0x35035b[_0x510a('0x44')],{'$or':_[_0x510a('0x33')](_0x35035b[_0x510a('0x3e')],function(_0x4334f3){var _0x1b01c3={};_0x1b01c3[_0x4334f3]={'$like':'%'+_0x486bab[_0x510a('0x3a')][_0x510a('0x46')]+'%'};return _0x1b01c3;})});}_0x35035b=_['merge']({},_0x35035b,_0x486bab[_0x510a('0x49')]);return _0x408154[_0x510a('0x67')](_0x35035b);}})[_0x510a('0x2a')](function(_0x148fb2){if(_0x148fb2){_0x33520b=_0x148fb2[_0x510a('0x3f')];if(!_0x486bab[_0x510a('0x3a')][_0x510a('0x40')](_0x510a('0x41'))){_0x35035b[_0x510a('0x20')]=qs['limit'](_0x486bab[_0x510a('0x3a')]['limit']);_0x35035b[_0x510a('0x1f')]=qs[_0x510a('0x1f')](_0x486bab[_0x510a('0x3a')][_0x510a('0x1f')]);}return _0x408154[_0x510a('0x67')](_0x35035b);}})[_0x510a('0x2a')](function(_0x3abe8d){if(_0x3abe8d){return _0x3abe8d?{'count':_0x33520b,'rows':_0x3abe8d}:null;}})['then'](respondWithResult(_0x41d2a6,null))[_0x510a('0x4c')](handleError(_0x41d2a6,null));};exports[_0x510a('0x69')]=function(_0x36fcf8,_0x5b1a20,_0x211447){var _0x5c057a,_0x2bd54a;var _0x129f0c=[];var _0x45fd38=moment()['format'](_0x510a('0x6a'));return db[_0x510a('0x34')][_0x510a('0x51')]({'where':{'id':_0x36fcf8['params']['id']}})['then'](handleEntityNotFound(_0x5b1a20,null))[_0x510a('0x2a')](function(_0x3f4959){if(_0x3f4959){_0x2bd54a=_0x3f4959;return _0x3f4959[_0x510a('0x69')](_0x36fcf8[_0x510a('0x53')][_0x510a('0x6b')],_[_0x510a('0x59')](_0x36fcf8[_0x510a('0x53')],[_0x510a('0x6b'),'id'])||{});}return null;})[_0x510a('0x6c')](function(_0x3ac2dd){var _0x89aa44;var _0x460a49;_0x5c057a=_0x3ac2dd||[];var _0x165672=[];if(_0x3ac2dd){for(var _0x5787b2=0x0;_0x5787b2<_0x3ac2dd[_0x510a('0x3f')];_0x5787b2+=0x1){var _0x53cf5e=_0x3ac2dd[_0x5787b2][_0x510a('0x2b')]({'plain':!![]});_0x2bd54a[_0x510a('0x6d')]=_0x36fcf8[_0x510a('0x53')][_0x510a('0x6d')]?_0x36fcf8[_0x510a('0x53')][_0x510a('0x6d')]:_0x2bd54a[_0x510a('0x6d')];switch(_0x2bd54a[_0x510a('0x6d')]){case _0x510a('0x6e'):_0x89aa44=squel[_0x510a('0x6f')]()[_0x510a('0x70')](_0x510a('0x71'))[_0x510a('0x72')]([_0x510a('0x73'),_0x510a('0x74'),'ContactId','ListId',_0x510a('0x5e'),_0x510a('0x5a'),'updatedAt'],squel[_0x510a('0x75')]()[_0x510a('0x76')](_0x510a('0x73'),_0x510a('0x73'))['field'](_0x510a('0x77'),'scheduledAt')[_0x510a('0x76')]('id',_0x510a('0x78'))['field'](_0x53cf5e[_0x510a('0x79')]['toString'](),'ListId')[_0x510a('0x76')](_0x36fcf8[_0x510a('0x4e')]['id'][_0x510a('0x7a')](),_0x510a('0x5e'))[_0x510a('0x76')]('\x27'+_0x45fd38+'\x27','createdAt')[_0x510a('0x76')]('\x27'+_0x45fd38+'\x27',_0x510a('0x5b'))[_0x510a('0x7b')]('cm_contacts')[_0x510a('0x44')]('deletedAt\x20IS\x20NULL')[_0x510a('0x44')]('ListId\x20=\x20?',_0x53cf5e['CmListId'][_0x510a('0x7a')]())['where'](_0x510a('0x7c'))[_0x510a('0x44')](_0x510a('0x7d'),squel[_0x510a('0x75')]()['field'](_0x510a('0x7e'))[_0x510a('0x7b')](_0x510a('0x7f'))[_0x510a('0x44')](_0x510a('0x80'),_0x36fcf8['params']['id']['toString']()))['where'](_0x510a('0x7d'),squel[_0x510a('0x75')]()[_0x510a('0x76')](_0x510a('0x81'))[_0x510a('0x7b')](_0x510a('0x71'))[_0x510a('0x44')](_0x510a('0x80'),_0x36fcf8[_0x510a('0x4e')]['id'][_0x510a('0x7a')]())))[_0x510a('0x7a')]();break;case'onlyIfOpen':_0x89aa44=squel[_0x510a('0x6f')]()['into']('cm_hopper')[_0x510a('0x72')]([_0x510a('0x73'),'scheduledAt',_0x510a('0x78'),_0x510a('0x82'),'CampaignId',_0x510a('0x5a'),'updatedAt'],squel[_0x510a('0x75')]()[_0x510a('0x76')](_0x510a('0x73'),_0x510a('0x73'))[_0x510a('0x76')](_0x510a('0x77'),_0x510a('0x74'))[_0x510a('0x76')]('id','ContactId')[_0x510a('0x76')](_0x53cf5e[_0x510a('0x79')][_0x510a('0x7a')](),_0x510a('0x82'))[_0x510a('0x76')](_0x36fcf8['params']['id'][_0x510a('0x7a')](),_0x510a('0x5e'))[_0x510a('0x76')]('\x27'+_0x45fd38+'\x27',_0x510a('0x5a'))[_0x510a('0x76')]('\x27'+_0x45fd38+'\x27','updatedAt')[_0x510a('0x7b')]('cm_contacts')[_0x510a('0x44')](_0x510a('0x83'))[_0x510a('0x44')]('ListId\x20=\x20?',_0x53cf5e['CmListId'][_0x510a('0x7a')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x510a('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x510a('0x75')]()[_0x510a('0x76')](_0x510a('0x81'))[_0x510a('0x7b')](_0x510a('0x71'))[_0x510a('0x44')](_0x510a('0x80'),_0x36fcf8['params']['id'][_0x510a('0x7a')]())))[_0x510a('0x7a')]();break;default:_0x89aa44=squel[_0x510a('0x6f')]()[_0x510a('0x70')]('cm_hopper')[_0x510a('0x72')](['phone',_0x510a('0x74'),_0x510a('0x78'),_0x510a('0x82'),_0x510a('0x5e'),'createdAt','updatedAt'],squel[_0x510a('0x75')]()[_0x510a('0x76')](_0x510a('0x73'),_0x510a('0x73'))[_0x510a('0x76')](_0x510a('0x77'),_0x510a('0x74'))[_0x510a('0x76')]('id',_0x510a('0x78'))[_0x510a('0x76')](_0x53cf5e[_0x510a('0x79')][_0x510a('0x7a')](),_0x510a('0x82'))[_0x510a('0x76')](_0x36fcf8[_0x510a('0x4e')]['id'][_0x510a('0x7a')](),_0x510a('0x5e'))['field']('\x27'+_0x45fd38+'\x27',_0x510a('0x5a'))['field']('\x27'+_0x45fd38+'\x27',_0x510a('0x5b'))['from'](_0x510a('0x84'))[_0x510a('0x44')]('deletedAt\x20IS\x20NULL')[_0x510a('0x44')](_0x510a('0x85'),_0x53cf5e[_0x510a('0x79')][_0x510a('0x7a')]())[_0x510a('0x44')](_0x510a('0x7c')))[_0x510a('0x7a')]();}_0x460a49=squel[_0x510a('0x6f')]()['into'](_0x510a('0x86'))[_0x510a('0x72')]([_0x510a('0x87'),'scheduledAt','phone',_0x510a('0x88'),_0x510a('0x5a'),'updatedAt'],squel[_0x510a('0x75')]()['field'](_0x510a('0x89'),'id')[_0x510a('0x76')](_0x510a('0x77'),_0x510a('0x74'))[_0x510a('0x76')](_0x510a('0x8a'),_0x510a('0x73'))['field'](_0x510a('0x8b'),_0x510a('0x88'))[_0x510a('0x76')]('\x27'+_0x45fd38+'\x27',_0x510a('0x5a'))[_0x510a('0x76')]('\x27'+_0x45fd38+'\x27',_0x510a('0x5b'))[_0x510a('0x7b')]('cm_contact_has_items','ci')['join'](_0x510a('0x71'),'h',_0x510a('0x8c'))[_0x510a('0x44')]('h.ListId\x20=\x20?',_0x53cf5e[_0x510a('0x79')][_0x510a('0x7a')]())['where'](_0x510a('0x8d'),_0x36fcf8[_0x510a('0x4e')]['id']['toString']())[_0x510a('0x44')]('h.createdAt\x20=\x20?',_0x45fd38))[_0x510a('0x7a')]();_0x165672[_0x510a('0x8e')](db['sequelize'][_0x510a('0x3a')](_0x89aa44));_0x129f0c[_0x510a('0x8e')](db[_0x510a('0x8f')]['query'](_0x460a49));}return BPromise[_0x510a('0x90')](_0x165672);}})['then'](function(){return BPromise[_0x510a('0x90')](_0x129f0c);})['then'](function(){return _0x5c057a;})[_0x510a('0x2a')](respondWithResult(_0x5b1a20,null))[_0x510a('0x4c')](handleError(_0x5b1a20,null));};exports[_0x510a('0x91')]=function(_0x52ca93,_0x249650,_0x10958f){return db[_0x510a('0x34')][_0x510a('0x51')]({'where':{'id':_0x52ca93[_0x510a('0x4e')]['id']}})[_0x510a('0x2a')](handleEntityNotFound(_0x249650,null))[_0x510a('0x2a')](function(_0xb7a5ce){if(_0xb7a5ce){return _0xb7a5ce[_0x510a('0x91')](_0x52ca93[_0x510a('0x3a')][_0x510a('0x6b')]);}})[_0x510a('0x2a')](function(_0x12f195){if(_0x12f195){return db['CmHopper'][_0x510a('0x2e')]({'where':{'ListId':_0x52ca93['query'][_0x510a('0x6b')],'CampaignId':_0x52ca93['params']['id']}})[_0x510a('0x2a')](function(){return _0x12f195;});}})[_0x510a('0x2a')](respondWithStatusCode(_0x249650,null))['catch'](handleError(_0x249650,null));};exports[_0x510a('0x92')]=function(_0x5a0420,_0x378931,_0x238d91){var _0x4d3372={};var _0x4a55b7={};var _0x3dacf2;var _0x5dc60f;return db['Campaign'][_0x510a('0x61')]({'where':{'id':_0x5a0420[_0x510a('0x4e')]['id']}})[_0x510a('0x2a')](handleEntityNotFound(_0x378931,null))[_0x510a('0x2a')](function(_0x3ae8c8){if(_0x3ae8c8){_0x3dacf2=_0x3ae8c8;_0x4a55b7[_0x510a('0x39')]=_[_0x510a('0x3b')](db[_0x510a('0x68')][_0x510a('0x35')]);_0x4a55b7[_0x510a('0x3a')]=_['keys'](_0x5a0420['query']);_0x4a55b7[_0x510a('0x3c')]=_[_0x510a('0x3d')](_0x4a55b7[_0x510a('0x39')],_0x4a55b7['query']);_0x4d3372['attributes']=_['intersection'](_0x4a55b7[_0x510a('0x39')],qs[_0x510a('0x4f')](_0x5a0420['query'][_0x510a('0x4f')]));_0x4d3372[_0x510a('0x3e')]=_0x4d3372[_0x510a('0x3e')]['length']?_0x4d3372[_0x510a('0x3e')]:_0x4a55b7[_0x510a('0x39')];_0x4d3372[_0x510a('0x42')]=qs['sort'](_0x5a0420[_0x510a('0x3a')][_0x510a('0x43')]);_0x4d3372[_0x510a('0x44')]=qs[_0x510a('0x3c')](_[_0x510a('0x45')](_0x5a0420[_0x510a('0x3a')],_0x4a55b7['filters']));if(_0x5a0420[_0x510a('0x3a')]['filter']){_0x4d3372[_0x510a('0x44')]=_[_0x510a('0x48')](_0x4d3372[_0x510a('0x44')],{'$or':_[_0x510a('0x33')](_0x4d3372[_0x510a('0x3e')],function(_0x587a97){var _0x4ac3e3={};_0x4ac3e3[_0x587a97]={'$like':'%'+_0x5a0420[_0x510a('0x3a')][_0x510a('0x46')]+'%'};return _0x4ac3e3;})});}_0x4d3372=_[_0x510a('0x48')]({},_0x4d3372,_0x5a0420[_0x510a('0x49')]);return _0x3dacf2[_0x510a('0x92')](_0x4d3372);}})[_0x510a('0x2a')](function(_0x45074c){if(_0x45074c){_0x5dc60f=_0x45074c[_0x510a('0x3f')];if(!_0x5a0420['query'][_0x510a('0x40')](_0x510a('0x41'))){_0x4d3372[_0x510a('0x20')]=qs[_0x510a('0x20')](_0x5a0420[_0x510a('0x3a')][_0x510a('0x20')]);_0x4d3372[_0x510a('0x1f')]=qs[_0x510a('0x1f')](_0x5a0420[_0x510a('0x3a')][_0x510a('0x1f')]);}return _0x3dacf2[_0x510a('0x92')](_0x4d3372);}})[_0x510a('0x2a')](function(_0x411714){if(_0x411714){return _0x411714?{'count':_0x5dc60f,'rows':_0x411714}:null;}})[_0x510a('0x2a')](respondWithResult(_0x378931,null))['catch'](handleError(_0x378931,null));};exports[_0x510a('0x93')]=function(_0x12e4f6,_0x321f19,_0x9896c4){var _0x2547c2,_0x551e6b;var _0x1e5c68=[];var _0x4a4f96=moment()[_0x510a('0x94')](_0x510a('0x6a'));return db[_0x510a('0x34')][_0x510a('0x51')]({'where':{'id':_0x12e4f6['params']['id']}})[_0x510a('0x2a')](handleEntityNotFound(_0x321f19,null))[_0x510a('0x2a')](function(_0x15ed0d){if(_0x15ed0d){_0x551e6b=_0x15ed0d;return _0x15ed0d[_0x510a('0x93')](_0x12e4f6[_0x510a('0x53')][_0x510a('0x6b')],_['omit'](_0x12e4f6['body'],[_0x510a('0x6b'),'id'])||{});}return null;})[_0x510a('0x6c')](function(_0x56736b){var _0x52d477;var _0x2eb607;_0x2547c2=_0x56736b||[];var _0xf46c8=[];if(_0x56736b){for(var _0x341e2e=0x0;_0x341e2e<_0x56736b[_0x510a('0x3f')];_0x341e2e+=0x1){var _0xdc4ac4=_0x56736b[_0x341e2e][_0x510a('0x2b')]({'plain':!![]});_0x52d477=squel['insert']()['into']('cm_hopper_black')['fromQuery']([_0x510a('0x73'),_0x510a('0x78'),_0x510a('0x82'),_0x510a('0x5e'),_0x510a('0x5a'),_0x510a('0x5b')],squel[_0x510a('0x75')]()[_0x510a('0x76')](_0x510a('0x73'),'phone')[_0x510a('0x76')]('id',_0x510a('0x78'))[_0x510a('0x76')](_0xdc4ac4[_0x510a('0x79')]['toString'](),_0x510a('0x82'))['field'](_0x12e4f6[_0x510a('0x4e')]['id'][_0x510a('0x7a')](),_0x510a('0x5e'))[_0x510a('0x76')](_0x510a('0x77'),_0x510a('0x5a'))[_0x510a('0x76')](_0x510a('0x77'),_0x510a('0x5b'))['from'](_0x510a('0x84'))['where'](_0x510a('0x83'))[_0x510a('0x44')](_0x510a('0x85'),_0xdc4ac4['CmListId'][_0x510a('0x7a')]())[_0x510a('0x44')](_0x510a('0x7c')))[_0x510a('0x7a')]();_0xf46c8[_0x510a('0x8e')](db[_0x510a('0x8f')][_0x510a('0x3a')](_0x52d477));}return BPromise['all'](_0xf46c8);}})[_0x510a('0x2a')](function(){return _0x2547c2;})[_0x510a('0x2a')](respondWithResult(_0x321f19,null))[_0x510a('0x4c')](handleError(_0x321f19,null));};exports[_0x510a('0x95')]=function(_0x4ccc8e,_0x32799d,_0x5830f5){return db[_0x510a('0x34')][_0x510a('0x51')]({'where':{'id':_0x4ccc8e[_0x510a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x32799d,null))[_0x510a('0x2a')](function(_0x123985){if(_0x123985){return _0x123985[_0x510a('0x95')](_0x4ccc8e[_0x510a('0x3a')][_0x510a('0x6b')]);}})['then'](function(_0x10c68d){if(_0x10c68d){return db[_0x510a('0x66')][_0x510a('0x2e')]({'where':{'ListId':_0x4ccc8e[_0x510a('0x3a')][_0x510a('0x6b')],'CampaignId':_0x4ccc8e[_0x510a('0x4e')]['id']}})[_0x510a('0x2a')](function(){return _0x10c68d;});}})['then'](respondWithStatusCode(_0x32799d,null))[_0x510a('0x4c')](handleError(_0x32799d,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f245e21..3cbefa7 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(_0xa9dd3e,_0x218069){var _0x4f03a1=function(_0x3427d7){while(--_0x3427d7){_0xa9dd3e['push'](_0xa9dd3e['shift']());}};_0x4f03a1(++_0x218069);}(_0x7a54,0x106));var _0x47a5=function(_0x5023e0,_0x51834){_0x5023e0=_0x5023e0-0x0;var _0x535ec1=_0x7a54[_0x5023e0];return _0x535ec1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xcc06cd,_0x3d2cff){var _0x25f721=function(_0x53f537){while(--_0x53f537){_0xcc06cd['push'](_0xcc06cd['shift']());}};_0x25f721(++_0x3d2cff);}(_0x7a54,0x106));var _0x47a5=function(_0x3efe0c,_0x286b07){_0x3efe0c=_0x3efe0c-0x0;var _0x367740=_0x7a54[_0x3efe0c];return _0x367740;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 6425334..dd7776f 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 _0xde50=['catch','GetCampaign','Campaign','findAll','options','where','limit','include','model','map','attributes','then','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','http','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result'];(function(_0x3f09a9,_0x2a1758){var _0x854a6d=function(_0x3eff89){while(--_0x3eff89){_0x3f09a9['push'](_0x3f09a9['shift']());}};_0x854a6d(++_0x2a1758);}(_0xde50,0x140));var _0x0de5=function(_0x134ff6,_0x1e6356){_0x134ff6=_0x134ff6-0x0;var _0x50c1bb=_0xde50[_0x134ff6];return _0x50c1bb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0de5('0x0'));var BPromise=require(_0x0de5('0x1'));var rs=require(_0x0de5('0x2'));var fs=require('fs');var Redis=require(_0x0de5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0de5('0x4'));var logger=require('../../config/logger')(_0x0de5('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0de5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2714e3,_0x2a5d94,_0x57410e){return new BPromise(function(_0xe3ac44,_0x4d5f0e){return client['request'](_0x2714e3,_0x57410e)['then'](function(_0x396293){logger[_0x0de5('0x7')](_0x0de5('0x8'),_0x2a5d94,'request\x20sent');logger[_0x0de5('0x9')](_0x0de5('0xa'),_0x2a5d94,'request\x20sent',JSON[_0x0de5('0xb')](_0x396293));if(_0x396293[_0x0de5('0xc')]){if(_0x396293[_0x0de5('0xc')]['code']===0x1f4){logger['error'](_0x0de5('0x8'),_0x2a5d94,_0x396293[_0x0de5('0xc')][_0x0de5('0xd')]);return _0x4d5f0e(_0x396293[_0x0de5('0xc')][_0x0de5('0xd')]);}logger['error'](_0x0de5('0x8'),_0x2a5d94,_0x396293['error']['message']);return _0xe3ac44(_0x396293[_0x0de5('0xc')][_0x0de5('0xd')]);}else{logger[_0x0de5('0x7')](_0x0de5('0x8'),_0x2a5d94,_0x0de5('0xe'));_0xe3ac44(_0x396293[_0x0de5('0xf')]['message']);}})[_0x0de5('0x10')](function(_0xeb58e1){logger[_0x0de5('0xc')](_0x0de5('0x8'),_0x2a5d94,_0xeb58e1);_0x4d5f0e(_0xeb58e1);});});}exports[_0x0de5('0x11')]=function(_0x2860e8){var _0x58ce66=this;return new Promise(function(_0x21e4b6,_0x48ba4e){return db[_0x0de5('0x12')][_0x0de5('0x13')]({'raw':_0x2860e8[_0x0de5('0x14')]?_0x2860e8[_0x0de5('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2860e8[_0x0de5('0x14')]?_0x2860e8['options'][_0x0de5('0x15')]||null:null,'attributes':_0x2860e8[_0x0de5('0x14')]?_0x2860e8[_0x0de5('0x14')]['attributes']||null:null,'limit':_0x2860e8[_0x0de5('0x14')]?_0x2860e8[_0x0de5('0x14')][_0x0de5('0x16')]||null:null,'include':_0x2860e8[_0x0de5('0x14')]?_0x2860e8['options'][_0x0de5('0x17')]?_['map'](_0x2860e8[_0x0de5('0x14')][_0x0de5('0x17')],function(_0x3bf543){return{'model':db[_0x3bf543[_0x0de5('0x18')]],'as':_0x3bf543['as'],'attributes':_0x3bf543['attributes'],'include':_0x3bf543['include']?_[_0x0de5('0x19')](_0x3bf543['include'],function(_0x378089){return{'model':db[_0x378089['model']],'as':_0x378089['as'],'attributes':_0x378089[_0x0de5('0x1a')],'include':_0x378089[_0x0de5('0x17')]?_[_0x0de5('0x19')](_0x378089[_0x0de5('0x17')],function(_0x3b8981){return{'model':db[_0x3b8981['model']],'as':_0x3b8981['as'],'attributes':_0x3b8981[_0x0de5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0de5('0x1b')](function(_0x3880e8){logger[_0x0de5('0x7')](_0x0de5('0x11'),_0x2860e8);logger[_0x0de5('0x9')]('GetCampaign',_0x2860e8,JSON[_0x0de5('0xb')](_0x3880e8));_0x21e4b6(_0x3880e8);})['catch'](function(_0x521026){logger[_0x0de5('0xc')]('GetCampaign',_0x521026['message'],_0x2860e8);_0x48ba4e(_0x58ce66[_0x0de5('0xc')](0x1f4,_0x521026[_0x0de5('0xd')]));});});}; \ No newline at end of file +var _0xe706=['request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCampaign','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s'];(function(_0xc68d77,_0x210295){var _0x4d247a=function(_0x4f906b){while(--_0x4f906b){_0xc68d77['push'](_0xc68d77['shift']());}};_0x4d247a(++_0x210295);}(_0xe706,0xa3));var _0x6e70=function(_0x584789,_0x1f4b10){_0x584789=_0x584789-0x0;var _0x57c028=_0xe706[_0x584789];return _0x57c028;};'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']('Campaign,\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']('Campaign,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['Campaign'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetCampaign',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 747eb14..31eec48 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 _0xc87e=['/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','addBlackLists','update','destroy','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','/:id/hopper_finals','getHopperFinals'];(function(_0x588258,_0x5b26a8){var _0x4efce8=function(_0x2eec95){while(--_0x2eec95){_0x588258['push'](_0x588258['shift']());}};_0x4efce8(++_0x5b26a8);}(_0xc87e,0x17b));var _0xec87=function(_0x14482c,_0x2672cf){_0x14482c=_0x14482c-0x0;var _0x88ccdc=_0xc87e[_0x14482c];return _0x88ccdc;};'use strict';var multer=require(_0xec87('0x0'));var util=require(_0xec87('0x1'));var path=require(_0xec87('0x2'));var timeout=require(_0xec87('0x3'));var express=require(_0xec87('0x4'));var router=express[_0xec87('0x5')]();var fs_extra=require(_0xec87('0x6'));var auth=require(_0xec87('0x7'));var interaction=require(_0xec87('0x8'));var config=require('../../config/environment');var controller=require(_0xec87('0x9'));router[_0xec87('0xa')]('/',auth[_0xec87('0xb')](),controller['index']);router['get'](_0xec87('0xc'),auth[_0xec87('0xb')](),controller[_0xec87('0xd')]);router[_0xec87('0xa')](_0xec87('0xe'),auth[_0xec87('0xb')](),controller['getHoppers']);router[_0xec87('0xa')]('/:id/hopper_histories',auth[_0xec87('0xb')](),controller['getHopperHistories']);router[_0xec87('0xa')](_0xec87('0xf'),auth[_0xec87('0xb')](),controller[_0xec87('0x10')]);router[_0xec87('0xa')](_0xec87('0x11'),auth[_0xec87('0xb')](),controller['getHopperBlacks']);router[_0xec87('0xa')](_0xec87('0x12'),auth['isAuthenticated'](),controller[_0xec87('0x13')]);router[_0xec87('0xa')](_0xec87('0x14'),auth[_0xec87('0xb')](),controller[_0xec87('0x15')]);router[_0xec87('0x16')]('/',auth[_0xec87('0xb')](),controller[_0xec87('0x17')]);router[_0xec87('0x16')]('/:id/clone',auth['isAuthenticated'](),controller[_0xec87('0x18')]);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0xec87('0x19')]);router['post'](_0xec87('0x14'),auth[_0xec87('0xb')](),controller[_0xec87('0x1a')]);router['put'](_0xec87('0xc'),auth['isAuthenticated'](),controller[_0xec87('0x1b')]);router['delete'](_0xec87('0xc'),auth['isAuthenticated'](),controller[_0xec87('0x1c')]);router[_0xec87('0x1d')](_0xec87('0x12'),auth[_0xec87('0xb')](),controller[_0xec87('0x1e')]);router[_0xec87('0x1d')]('/:id/blacklists',auth[_0xec87('0xb')](),controller[_0xec87('0x1f')]);module[_0xec87('0x20')]=router; \ No newline at end of file +var _0xf43c=['./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','/:id/blacklists','addBlackLists','put','update','destroy','delete','removeLists','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x6ba855,_0x4e6b79){var _0x4ebe40=function(_0x54cef7){while(--_0x54cef7){_0x6ba855['push'](_0x6ba855['shift']());}};_0x4ebe40(++_0x4e6b79);}(_0xf43c,0x160));var _0xcf43=function(_0x31287a,_0x2a1f35){_0x31287a=_0x31287a-0x0;var _0x5f4159=_0xf43c[_0x31287a];return _0x5f4159;};'use strict';var multer=require(_0xcf43('0x0'));var util=require(_0xcf43('0x1'));var path=require(_0xcf43('0x2'));var timeout=require(_0xcf43('0x3'));var express=require('express');var router=express[_0xcf43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcf43('0x5'));var interaction=require(_0xcf43('0x6'));var config=require(_0xcf43('0x7'));var controller=require(_0xcf43('0x8'));router[_0xcf43('0x9')]('/',auth[_0xcf43('0xa')](),controller[_0xcf43('0xb')]);router[_0xcf43('0x9')](_0xcf43('0xc'),auth[_0xcf43('0xa')](),controller[_0xcf43('0xd')]);router[_0xcf43('0x9')](_0xcf43('0xe'),auth['isAuthenticated'](),controller[_0xcf43('0xf')]);router['get'](_0xcf43('0x10'),auth['isAuthenticated'](),controller[_0xcf43('0x11')]);router[_0xcf43('0x9')](_0xcf43('0x12'),auth[_0xcf43('0xa')](),controller[_0xcf43('0x13')]);router[_0xcf43('0x9')]('/:id/hopper_black',auth[_0xcf43('0xa')](),controller[_0xcf43('0x14')]);router[_0xcf43('0x9')](_0xcf43('0x15'),auth['isAuthenticated'](),controller[_0xcf43('0x16')]);router[_0xcf43('0x9')]('/:id/blacklists',auth[_0xcf43('0xa')](),controller[_0xcf43('0x17')]);router[_0xcf43('0x18')]('/',auth[_0xcf43('0xa')](),controller[_0xcf43('0x19')]);router[_0xcf43('0x18')](_0xcf43('0x1a'),auth[_0xcf43('0xa')](),controller[_0xcf43('0x1b')]);router[_0xcf43('0x18')](_0xcf43('0x15'),auth[_0xcf43('0xa')](),controller['addLists']);router[_0xcf43('0x18')](_0xcf43('0x1c'),auth['isAuthenticated'](),controller[_0xcf43('0x1d')]);router[_0xcf43('0x1e')](_0xcf43('0xc'),auth[_0xcf43('0xa')](),controller[_0xcf43('0x1f')]);router['delete'](_0xcf43('0xc'),auth['isAuthenticated'](),controller[_0xcf43('0x20')]);router[_0xcf43('0x21')](_0xcf43('0x15'),auth['isAuthenticated'](),controller[_0xcf43('0x22')]);router[_0xcf43('0x21')]('/:id/blacklists',auth[_0xcf43('0xa')](),controller['removeBlackLists']);module[_0xcf43('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 926ae6b..06b8793 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 _0xb6a0=['exports','STRING','TEXT','getDataValue','key','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6a0,0x1af));var _0x0b6a=function(_0x5cc114,_0x32368e){_0x5cc114=_0x5cc114-0x0;var _0x57743a=_0xb6a0[_0x5cc114];return _0x57743a;};'use strict';var Sequelize=require(_0x0b6a('0x0'));module[_0x0b6a('0x1')]={'key':{'type':Sequelize[_0x0b6a('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x0b6a('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x0b6a('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0b6a('0x4')](_0x0b6a('0x5'));}}}; \ No newline at end of file +var _0x8546=['getDataValue','key','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x8546,0x1b4));var _0x6854=function(_0x3bdfe2,_0x22ff84){_0x3bdfe2=_0x3bdfe2-0x0;var _0x162343=_0x8546[_0x3bdfe2];return _0x162343;};'use strict';var Sequelize=require(_0x6854('0x0'));module[_0x6854('0x1')]={'key':{'type':Sequelize[_0x6854('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x6854('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x6854('0x2')]},'name':{'type':Sequelize[_0x6854('0x4')],'get':function(){return this[_0x6854('0x5')](_0x6854('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index b92ea80..a30c6a4 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 _0x8bdc=['moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','intersection','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x505096,_0x59cf51){var _0x5840bd=function(_0x16ebdf){while(--_0x16ebdf){_0x505096['push'](_0x505096['shift']());}};_0x5840bd(++_0x59cf51);}(_0x8bdc,0xac));var _0xc8bd=function(_0xe12b08,_0x417721){_0xe12b08=_0xe12b08-0x0;var _0x56ebab=_0x8bdc[_0xe12b08];return _0x56ebab;};'use strict';var emlformat=require(_0xc8bd('0x0'));var rimraf=require(_0xc8bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8bd('0x2'));var rp=require(_0xc8bd('0x3'));var moment=require(_0xc8bd('0x4'));var BPromise=require(_0xc8bd('0x5'));var Mustache=require('mustache');var util=require(_0xc8bd('0x6'));var path=require(_0xc8bd('0x7'));var sox=require(_0xc8bd('0x8'));var csv=require(_0xc8bd('0x9'));var ejs=require(_0xc8bd('0xa'));var fs=require('fs');var fs_extra=require(_0xc8bd('0xb'));var _=require(_0xc8bd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc8bd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc8bd('0xe'));var Redis=require(_0xc8bd('0xf'));var authService=require(_0xc8bd('0x10'));var qs=require(_0xc8bd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8bd('0x12'));var logger=require(_0xc8bd('0x13'))(_0xc8bd('0x14'));var utils=require('../../config/utils');var config=require(_0xc8bd('0x15'));var licenseUtil=require(_0xc8bd('0x16'));var db=require(_0xc8bd('0x17'))['db'];function respondWithStatusCode(_0x3a4180,_0x4de394){_0x4de394=_0x4de394||0xcc;return function(_0x56f2fc){if(_0x56f2fc){return _0x3a4180[_0xc8bd('0x18')](_0x4de394);}return _0x3a4180[_0xc8bd('0x19')](_0x4de394)['end']();};}function respondWithResult(_0x286cd4,_0x215860){_0x215860=_0x215860||0xc8;return function(_0x1dbad9){if(_0x1dbad9){return _0x286cd4[_0xc8bd('0x19')](_0x215860)[_0xc8bd('0x1a')](_0x1dbad9);}};}function respondWithFilteredResult(_0x2a3e94,_0x17aa6d){return function(_0x2394dc){if(_0x2394dc){var _0x5393ea=typeof _0x17aa6d[_0xc8bd('0x1b')]===_0xc8bd('0x1c')&&typeof _0x17aa6d[_0xc8bd('0x1d')]==='undefined';var _0x5e5d3e=_0x2394dc[_0xc8bd('0x1e')];var _0x4f9031=_0x5393ea?0x0:_0x17aa6d[_0xc8bd('0x1b')];var _0x30099f=_0x5393ea?_0x2394dc[_0xc8bd('0x1e')]:_0x17aa6d[_0xc8bd('0x1b')]+_0x17aa6d['limit'];var _0xfeeef;if(_0x30099f>=_0x5e5d3e){_0x30099f=_0x5e5d3e;_0xfeeef=0xc8;}else{_0xfeeef=0xce;}_0x2a3e94['status'](_0xfeeef);return _0x2a3e94[_0xc8bd('0x1f')](_0xc8bd('0x20'),_0x4f9031+'-'+_0x30099f+'/'+_0x5e5d3e)['json'](_0x2394dc);}return null;};}function patchUpdates(_0x37981c){return function(_0x55c90a){try{jsonpatch[_0xc8bd('0x21')](_0x55c90a,_0x37981c,!![]);}catch(_0x397b1f){return BPromise[_0xc8bd('0x22')](_0x397b1f);}return _0x55c90a[_0xc8bd('0x23')]();};}function saveUpdates(_0x4dc6cf,_0x82381e){return function(_0x57b114){if(_0x57b114){return _0x57b114[_0xc8bd('0x24')](_0x4dc6cf)[_0xc8bd('0x25')](function(_0x39d35b){return _0x39d35b;});}return null;};}function removeEntity(_0x431805,_0x47930b){return function(_0x57c51a){if(_0x57c51a){return _0x57c51a[_0xc8bd('0x26')]()[_0xc8bd('0x25')](function(){var _0x31b62d=_0x57c51a[_0xc8bd('0x27')]({'plain':!![]});var _0x1686a2='CannedAnswers';return db[_0xc8bd('0x28')][_0xc8bd('0x26')]({'where':{'type':_0x1686a2,'resourceId':_0x31b62d['id']}})[_0xc8bd('0x25')](function(){return _0x57c51a;});})['then'](function(){_0x431805[_0xc8bd('0x19')](0xcc)[_0xc8bd('0x29')]();});}};}function handleEntityNotFound(_0x111bb6,_0x55f060){return function(_0x1b4a63){if(!_0x1b4a63){_0x111bb6[_0xc8bd('0x18')](0x194);}return _0x1b4a63;};}function handleError(_0x402be2,_0x5b19ac){_0x5b19ac=_0x5b19ac||0x1f4;return function(_0x254da1){logger[_0xc8bd('0x2a')](_0x254da1[_0xc8bd('0x2b')]);if(_0x254da1[_0xc8bd('0x2c')]){delete _0x254da1[_0xc8bd('0x2c')];}_0x402be2[_0xc8bd('0x19')](_0x5b19ac)[_0xc8bd('0x2d')](_0x254da1);};}exports[_0xc8bd('0x2e')]=function(_0x2bdb1e,_0x2ef83b){var _0x3f70e7={},_0x5a0ada={},_0x362cc8={'count':0x0,'rows':[]};var _0x2740c4=_[_0xc8bd('0x2f')](db[_0xc8bd('0x30')][_0xc8bd('0x31')],function(_0x5ee796){return{'name':_0x5ee796['fieldName'],'type':_0x5ee796[_0xc8bd('0x32')][_0xc8bd('0x33')]};});_0x5a0ada[_0xc8bd('0x34')]=_[_0xc8bd('0x2f')](_0x2740c4,_0xc8bd('0x2c'));_0x5a0ada[_0xc8bd('0x35')]=_['keys'](_0x2bdb1e[_0xc8bd('0x35')]);_0x5a0ada[_0xc8bd('0x36')]=_['intersection'](_0x5a0ada[_0xc8bd('0x34')],_0x5a0ada[_0xc8bd('0x35')]);_0x3f70e7[_0xc8bd('0x37')]=_['intersection'](_0x5a0ada['model'],qs[_0xc8bd('0x38')](_0x2bdb1e[_0xc8bd('0x35')][_0xc8bd('0x38')]));_0x3f70e7['attributes']=_0x3f70e7[_0xc8bd('0x37')][_0xc8bd('0x39')]?_0x3f70e7[_0xc8bd('0x37')]:_0x5a0ada[_0xc8bd('0x34')];if(!_0x2bdb1e[_0xc8bd('0x35')][_0xc8bd('0x3a')]('nolimit')){_0x3f70e7[_0xc8bd('0x1d')]=qs[_0xc8bd('0x1d')](_0x2bdb1e[_0xc8bd('0x35')]['limit']);_0x3f70e7[_0xc8bd('0x1b')]=qs['offset'](_0x2bdb1e[_0xc8bd('0x35')][_0xc8bd('0x1b')]);}_0x3f70e7['order']=qs[_0xc8bd('0x3b')](_0x2bdb1e[_0xc8bd('0x35')][_0xc8bd('0x3b')]);_0x3f70e7[_0xc8bd('0x3c')]=qs[_0xc8bd('0x36')](_[_0xc8bd('0x3d')](_0x2bdb1e[_0xc8bd('0x35')],_0x5a0ada[_0xc8bd('0x36')]),_0x2740c4);if(_0x2bdb1e['query'][_0xc8bd('0x3e')]){_0x3f70e7[_0xc8bd('0x3c')]=_[_0xc8bd('0x3f')](_0x3f70e7[_0xc8bd('0x3c')],{'$or':[{'key':{'$like':'%'+_0x2bdb1e[_0xc8bd('0x35')]['filter']+'%'}},{'value':{'$like':'%'+_0x2bdb1e['query'][_0xc8bd('0x3e')]+'%'}}]});}_0x3f70e7=_['merge']({},_0x3f70e7,_0x2bdb1e[_0xc8bd('0x40')]);var _0x184be5={'where':_0x3f70e7[_0xc8bd('0x3c')]};return db[_0xc8bd('0x30')]['count'](_0x184be5)[_0xc8bd('0x25')](function(_0x3c26f){_0x362cc8[_0xc8bd('0x1e')]=_0x3c26f;if(_0x2bdb1e[_0xc8bd('0x35')][_0xc8bd('0x41')]){_0x3f70e7[_0xc8bd('0x42')]=[{'all':!![]}];}return db[_0xc8bd('0x30')][_0xc8bd('0x43')](_0x3f70e7);})[_0xc8bd('0x25')](function(_0x358af5){_0x362cc8[_0xc8bd('0x44')]=_0x358af5;return _0x362cc8;})['then'](respondWithFilteredResult(_0x2ef83b,_0x3f70e7))[_0xc8bd('0x45')](handleError(_0x2ef83b,null));};exports[_0xc8bd('0x46')]=function(_0xb14d77,_0x48e29c){var _0x492276={'raw':!![],'where':{'id':_0xb14d77['params']['id']}},_0x544042={};_0x544042['model']=_[_0xc8bd('0x47')](db['CannedAnswer'][_0xc8bd('0x31')]);_0x544042['query']=_[_0xc8bd('0x47')](_0xb14d77['query']);_0x544042['filters']=_['intersection'](_0x544042['model'],_0x544042[_0xc8bd('0x35')]);_0x492276[_0xc8bd('0x37')]=_[_0xc8bd('0x48')](_0x544042[_0xc8bd('0x34')],qs['fields'](_0xb14d77['query']['fields']));_0x492276[_0xc8bd('0x37')]=_0x492276[_0xc8bd('0x37')][_0xc8bd('0x39')]?_0x492276[_0xc8bd('0x37')]:_0x544042[_0xc8bd('0x34')];if(_0xb14d77[_0xc8bd('0x35')]['includeAll']){_0x492276[_0xc8bd('0x42')]=[{'all':!![]}];}_0x492276=_[_0xc8bd('0x3f')]({},_0x492276,_0xb14d77[_0xc8bd('0x40')]);return db[_0xc8bd('0x30')][_0xc8bd('0x49')](_0x492276)[_0xc8bd('0x25')](handleEntityNotFound(_0x48e29c,null))[_0xc8bd('0x25')](respondWithResult(_0x48e29c,null))[_0xc8bd('0x45')](handleError(_0x48e29c,null));};exports[_0xc8bd('0x24')]=function(_0x53b6aa,_0x5147f6){if(_0x53b6aa[_0xc8bd('0x4a')]['id']){delete _0x53b6aa[_0xc8bd('0x4a')]['id'];}return db[_0xc8bd('0x30')]['find']({'where':{'id':_0x53b6aa[_0xc8bd('0x4b')]['id']}})[_0xc8bd('0x25')](handleEntityNotFound(_0x5147f6,null))['then'](saveUpdates(_0x53b6aa[_0xc8bd('0x4a')],null))[_0xc8bd('0x25')](respondWithResult(_0x5147f6,null))[_0xc8bd('0x45')](handleError(_0x5147f6,null));};exports[_0xc8bd('0x26')]=function(_0x1efb3f,_0x18f55b){return db[_0xc8bd('0x30')]['find']({'where':{'id':_0x1efb3f[_0xc8bd('0x4b')]['id']}})[_0xc8bd('0x25')](handleEntityNotFound(_0x18f55b,null))[_0xc8bd('0x25')](removeEntity(_0x18f55b,null))[_0xc8bd('0x45')](handleError(_0x18f55b,null));};exports['create']=function(_0x50171d,_0x23106d){var _0x41bd01={'key':_0x50171d[_0xc8bd('0x4a')][_0xc8bd('0x33')]};if(_0x50171d[_0xc8bd('0x4a')][_0xc8bd('0x4c')]){_0x41bd01[_0xc8bd('0x4c')]=_0x50171d['body']['MailAccountId'];}else if(_0x50171d[_0xc8bd('0x4a')]['SmsAccountId']){_0x41bd01['SmsAccountId']=_0x50171d['body'][_0xc8bd('0x4d')];}else if(_0x50171d[_0xc8bd('0x4a')][_0xc8bd('0x4e')]){_0x41bd01['OpenchannelAccountId']=_0x50171d[_0xc8bd('0x4a')][_0xc8bd('0x4e')];}else if(_0x50171d[_0xc8bd('0x4a')][_0xc8bd('0x4f')]){_0x41bd01[_0xc8bd('0x4f')]=_0x50171d[_0xc8bd('0x4a')][_0xc8bd('0x4f')];}return db[_0xc8bd('0x30')]['find']({'where':_0x41bd01})[_0xc8bd('0x25')](function(_0x68c733){if(_0x68c733){throw new db[(_0xc8bd('0x50'))]['ValidationError'](_0xc8bd('0x51'));}return db['CannedAnswer'][_0xc8bd('0x52')](_0x50171d['body']);})['then'](function(_0x40c818){var _0x2e661b=_0x50171d[_0xc8bd('0x53')][_0xc8bd('0x27')]({'plain':!![]});if(!_0x2e661b)throw new Error(_0xc8bd('0x54'));if(_0x2e661b[_0xc8bd('0x55')]===_0xc8bd('0x53')){var _0x51032b=_0x40c818[_0xc8bd('0x27')]({'plain':!![]});return db['UserProfileSection'][_0xc8bd('0x49')]({'where':{'name':_0xc8bd('0x56'),'userProfileId':_0x2e661b['userProfileId']},'raw':!![]})['then'](function(_0xd8f111){if(_0xd8f111&&_0xd8f111[_0xc8bd('0x57')]===0x0){return db[_0xc8bd('0x28')][_0xc8bd('0x52')]({'name':_0x51032b[_0xc8bd('0x2c')],'resourceId':_0x51032b['id'],'type':_0xd8f111['name'],'sectionId':_0xd8f111['id']},{})[_0xc8bd('0x25')](function(){return _0x40c818;});}else{return _0x40c818;}})[_0xc8bd('0x45')](function(_0x23a8de){logger[_0xc8bd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23a8de);throw _0x23a8de;});}return _0x40c818;})['then'](respondWithResult(_0x23106d,0xc9))[_0xc8bd('0x45')](handleError(_0x23106d,null));}; \ No newline at end of file +var _0x6ef6=['api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','error','stack','name','send','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','find','body','MailAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','mustache','path','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'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ef6,0x18f));var _0x66ef=function(_0x2330c5,_0x5ddb84){_0x2330c5=_0x2330c5-0x0;var _0x48133d=_0x6ef6[_0x2330c5];return _0x48133d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66ef('0x0'));var zipdir=require(_0x66ef('0x1'));var jsonpatch=require(_0x66ef('0x2'));var rp=require('request-promise');var moment=require(_0x66ef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x66ef('0x4'));var util=require('util');var path=require(_0x66ef('0x5'));var sox=require('sox');var csv=require(_0x66ef('0x6'));var ejs=require(_0x66ef('0x7'));var fs=require('fs');var fs_extra=require(_0x66ef('0x8'));var _=require(_0x66ef('0x9'));var squel=require(_0x66ef('0xa'));var crypto=require(_0x66ef('0xb'));var jsforce=require(_0x66ef('0xc'));var deskjs=require(_0x66ef('0xd'));var toCsv=require(_0x66ef('0x6'));var querystring=require(_0x66ef('0xe'));var Papa=require(_0x66ef('0xf'));var Redis=require(_0x66ef('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x66ef('0x11'));var as=require(_0x66ef('0x12'));var hardwareService=require(_0x66ef('0x13'));var logger=require(_0x66ef('0x14'))(_0x66ef('0x15'));var utils=require('../../config/utils');var config=require(_0x66ef('0x16'));var licenseUtil=require(_0x66ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48cf54,_0x2e4ccd){_0x2e4ccd=_0x2e4ccd||0xcc;return function(_0x1c74d9){if(_0x1c74d9){return _0x48cf54[_0x66ef('0x18')](_0x2e4ccd);}return _0x48cf54[_0x66ef('0x19')](_0x2e4ccd)[_0x66ef('0x1a')]();};}function respondWithResult(_0x42d205,_0x32bcab){_0x32bcab=_0x32bcab||0xc8;return function(_0x1a8c2b){if(_0x1a8c2b){return _0x42d205[_0x66ef('0x19')](_0x32bcab)['json'](_0x1a8c2b);}};}function respondWithFilteredResult(_0x3eab1e,_0x299d92){return function(_0x57294b){if(_0x57294b){var _0x653232=typeof _0x299d92[_0x66ef('0x1b')]==='undefined'&&typeof _0x299d92[_0x66ef('0x1c')]===_0x66ef('0x1d');var _0x417437=_0x57294b['count'];var _0x3481b8=_0x653232?0x0:_0x299d92[_0x66ef('0x1b')];var _0x39f22f=_0x653232?_0x57294b[_0x66ef('0x1e')]:_0x299d92[_0x66ef('0x1b')]+_0x299d92[_0x66ef('0x1c')];var _0x594fe7;if(_0x39f22f>=_0x417437){_0x39f22f=_0x417437;_0x594fe7=0xc8;}else{_0x594fe7=0xce;}_0x3eab1e['status'](_0x594fe7);return _0x3eab1e[_0x66ef('0x1f')](_0x66ef('0x20'),_0x3481b8+'-'+_0x39f22f+'/'+_0x417437)[_0x66ef('0x21')](_0x57294b);}return null;};}function patchUpdates(_0x5998da){return function(_0x2247c8){try{jsonpatch[_0x66ef('0x22')](_0x2247c8,_0x5998da,!![]);}catch(_0x3a1255){return BPromise[_0x66ef('0x23')](_0x3a1255);}return _0x2247c8['save']();};}function saveUpdates(_0x51d290,_0x13cc0c){return function(_0x262a39){if(_0x262a39){return _0x262a39[_0x66ef('0x24')](_0x51d290)[_0x66ef('0x25')](function(_0x486662){return _0x486662;});}return null;};}function removeEntity(_0x493451,_0x4dac14){return function(_0x3b3cd6){if(_0x3b3cd6){return _0x3b3cd6['destroy']()['then'](function(){var _0x13b605=_0x3b3cd6[_0x66ef('0x26')]({'plain':!![]});var _0x4d49cc=_0x66ef('0x27');return db[_0x66ef('0x28')][_0x66ef('0x29')]({'where':{'type':_0x4d49cc,'resourceId':_0x13b605['id']}})['then'](function(){return _0x3b3cd6;});})[_0x66ef('0x25')](function(){_0x493451[_0x66ef('0x19')](0xcc)[_0x66ef('0x1a')]();});}};}function handleEntityNotFound(_0x173f82,_0x34d71f){return function(_0x54126b){if(!_0x54126b){_0x173f82[_0x66ef('0x18')](0x194);}return _0x54126b;};}function handleError(_0x28badb,_0x5c4651){_0x5c4651=_0x5c4651||0x1f4;return function(_0x20effa){logger[_0x66ef('0x2a')](_0x20effa[_0x66ef('0x2b')]);if(_0x20effa[_0x66ef('0x2c')]){delete _0x20effa[_0x66ef('0x2c')];}_0x28badb[_0x66ef('0x19')](_0x5c4651)[_0x66ef('0x2d')](_0x20effa);};}exports['index']=function(_0x36833d,_0x20bfbf){var _0x1e0a54={},_0x3109d2={},_0x9952d5={'count':0x0,'rows':[]};var _0x2ba55c=_['map'](db[_0x66ef('0x2e')][_0x66ef('0x2f')],function(_0x1e1c29){return{'name':_0x1e1c29[_0x66ef('0x30')],'type':_0x1e1c29[_0x66ef('0x31')][_0x66ef('0x32')]};});_0x3109d2[_0x66ef('0x33')]=_['map'](_0x2ba55c,_0x66ef('0x2c'));_0x3109d2[_0x66ef('0x34')]=_[_0x66ef('0x35')](_0x36833d[_0x66ef('0x34')]);_0x3109d2[_0x66ef('0x36')]=_[_0x66ef('0x37')](_0x3109d2['model'],_0x3109d2[_0x66ef('0x34')]);_0x1e0a54['attributes']=_[_0x66ef('0x37')](_0x3109d2['model'],qs['fields'](_0x36833d[_0x66ef('0x34')][_0x66ef('0x38')]));_0x1e0a54[_0x66ef('0x39')]=_0x1e0a54[_0x66ef('0x39')][_0x66ef('0x3a')]?_0x1e0a54[_0x66ef('0x39')]:_0x3109d2[_0x66ef('0x33')];if(!_0x36833d[_0x66ef('0x34')][_0x66ef('0x3b')]('nolimit')){_0x1e0a54[_0x66ef('0x1c')]=qs['limit'](_0x36833d[_0x66ef('0x34')]['limit']);_0x1e0a54[_0x66ef('0x1b')]=qs['offset'](_0x36833d['query'][_0x66ef('0x1b')]);}_0x1e0a54['order']=qs[_0x66ef('0x3c')](_0x36833d[_0x66ef('0x34')]['sort']);_0x1e0a54[_0x66ef('0x3d')]=qs[_0x66ef('0x36')](_[_0x66ef('0x3e')](_0x36833d[_0x66ef('0x34')],_0x3109d2[_0x66ef('0x36')]),_0x2ba55c);if(_0x36833d[_0x66ef('0x34')]['filter']){_0x1e0a54[_0x66ef('0x3d')]=_[_0x66ef('0x3f')](_0x1e0a54[_0x66ef('0x3d')],{'$or':[{'key':{'$like':'%'+_0x36833d['query']['filter']+'%'}},{'value':{'$like':'%'+_0x36833d[_0x66ef('0x34')][_0x66ef('0x40')]+'%'}}]});}_0x1e0a54=_[_0x66ef('0x3f')]({},_0x1e0a54,_0x36833d[_0x66ef('0x41')]);var _0x26bf0={'where':_0x1e0a54[_0x66ef('0x3d')]};return db[_0x66ef('0x2e')][_0x66ef('0x1e')](_0x26bf0)[_0x66ef('0x25')](function(_0x260c3a){_0x9952d5[_0x66ef('0x1e')]=_0x260c3a;if(_0x36833d[_0x66ef('0x34')][_0x66ef('0x42')]){_0x1e0a54[_0x66ef('0x43')]=[{'all':!![]}];}return db[_0x66ef('0x2e')]['findAll'](_0x1e0a54);})[_0x66ef('0x25')](function(_0xed23f0){_0x9952d5[_0x66ef('0x44')]=_0xed23f0;return _0x9952d5;})['then'](respondWithFilteredResult(_0x20bfbf,_0x1e0a54))[_0x66ef('0x45')](handleError(_0x20bfbf,null));};exports[_0x66ef('0x46')]=function(_0xb247a7,_0x20d7e8){var _0x49fee5={'raw':!![],'where':{'id':_0xb247a7[_0x66ef('0x47')]['id']}},_0x162715={};_0x162715[_0x66ef('0x33')]=_['keys'](db[_0x66ef('0x2e')][_0x66ef('0x2f')]);_0x162715[_0x66ef('0x34')]=_['keys'](_0xb247a7['query']);_0x162715[_0x66ef('0x36')]=_[_0x66ef('0x37')](_0x162715[_0x66ef('0x33')],_0x162715['query']);_0x49fee5[_0x66ef('0x39')]=_['intersection'](_0x162715[_0x66ef('0x33')],qs[_0x66ef('0x38')](_0xb247a7[_0x66ef('0x34')][_0x66ef('0x38')]));_0x49fee5[_0x66ef('0x39')]=_0x49fee5[_0x66ef('0x39')][_0x66ef('0x3a')]?_0x49fee5[_0x66ef('0x39')]:_0x162715[_0x66ef('0x33')];if(_0xb247a7[_0x66ef('0x34')][_0x66ef('0x42')]){_0x49fee5[_0x66ef('0x43')]=[{'all':!![]}];}_0x49fee5=_[_0x66ef('0x3f')]({},_0x49fee5,_0xb247a7[_0x66ef('0x41')]);return db['CannedAnswer'][_0x66ef('0x48')](_0x49fee5)[_0x66ef('0x25')](handleEntityNotFound(_0x20d7e8,null))[_0x66ef('0x25')](respondWithResult(_0x20d7e8,null))['catch'](handleError(_0x20d7e8,null));};exports[_0x66ef('0x24')]=function(_0x1e7b52,_0x28faf4){if(_0x1e7b52[_0x66ef('0x49')]['id']){delete _0x1e7b52[_0x66ef('0x49')]['id'];}return db[_0x66ef('0x2e')][_0x66ef('0x48')]({'where':{'id':_0x1e7b52[_0x66ef('0x47')]['id']}})[_0x66ef('0x25')](handleEntityNotFound(_0x28faf4,null))[_0x66ef('0x25')](saveUpdates(_0x1e7b52[_0x66ef('0x49')],null))['then'](respondWithResult(_0x28faf4,null))[_0x66ef('0x45')](handleError(_0x28faf4,null));};exports['destroy']=function(_0x138ba4,_0x751ab1){return db[_0x66ef('0x2e')][_0x66ef('0x48')]({'where':{'id':_0x138ba4['params']['id']}})[_0x66ef('0x25')](handleEntityNotFound(_0x751ab1,null))[_0x66ef('0x25')](removeEntity(_0x751ab1,null))[_0x66ef('0x45')](handleError(_0x751ab1,null));};exports['create']=function(_0x1bf760,_0x426483){var _0x215a07={'key':_0x1bf760[_0x66ef('0x49')]['key']};if(_0x1bf760[_0x66ef('0x49')][_0x66ef('0x4a')]){_0x215a07['MailAccountId']=_0x1bf760[_0x66ef('0x49')][_0x66ef('0x4a')];}else if(_0x1bf760[_0x66ef('0x49')]['SmsAccountId']){_0x215a07['SmsAccountId']=_0x1bf760['body']['SmsAccountId'];}else if(_0x1bf760[_0x66ef('0x49')][_0x66ef('0x4b')]){_0x215a07['OpenchannelAccountId']=_0x1bf760[_0x66ef('0x49')][_0x66ef('0x4b')];}else if(_0x1bf760[_0x66ef('0x49')][_0x66ef('0x4c')]){_0x215a07[_0x66ef('0x4c')]=_0x1bf760[_0x66ef('0x49')][_0x66ef('0x4c')];}return db[_0x66ef('0x2e')][_0x66ef('0x48')]({'where':_0x215a07})[_0x66ef('0x25')](function(_0x58089b){if(_0x58089b){throw new db['Sequelize']['ValidationError'](_0x66ef('0x4d'));}return db[_0x66ef('0x2e')][_0x66ef('0x4e')](_0x1bf760[_0x66ef('0x49')]);})[_0x66ef('0x25')](function(_0x1768c7){var _0x37b5f5=_0x1bf760[_0x66ef('0x4f')]['get']({'plain':!![]});if(!_0x37b5f5)throw new Error(_0x66ef('0x50'));if(_0x37b5f5['role']===_0x66ef('0x4f')){var _0x493dc0=_0x1768c7[_0x66ef('0x26')]({'plain':!![]});return db[_0x66ef('0x51')][_0x66ef('0x48')]({'where':{'name':_0x66ef('0x27'),'userProfileId':_0x37b5f5[_0x66ef('0x52')]},'raw':!![]})[_0x66ef('0x25')](function(_0x2a2c96){if(_0x2a2c96&&_0x2a2c96['autoAssociation']===0x0){return db[_0x66ef('0x28')]['create']({'name':_0x493dc0[_0x66ef('0x2c')],'resourceId':_0x493dc0['id'],'type':_0x2a2c96['name'],'sectionId':_0x2a2c96['id']},{})[_0x66ef('0x25')](function(){return _0x1768c7;});}else{return _0x1768c7;}})[_0x66ef('0x45')](function(_0x20caf9){logger[_0x66ef('0x2a')](_0x66ef('0x53'),_0x20caf9);throw _0x20caf9;});}return _0x1768c7;})[_0x66ef('0x25')](respondWithResult(_0x426483,0xc9))[_0x66ef('0x45')](handleError(_0x426483,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 9b9ac9f..9b66b71 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 _0xaf5c=['../../config/logger','api','bluebird','path','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x1e491e,_0x2f7656){var _0x30521d=function(_0x36bac5){while(--_0x36bac5){_0x1e491e['push'](_0x1e491e['shift']());}};_0x30521d(++_0x2f7656);}(_0xaf5c,0x197));var _0xcaf5=function(_0x1152bc,_0x16c394){_0x1152bc=_0x1152bc-0x0;var _0x4c6b0d=_0xaf5c[_0x1152bc];return _0x4c6b0d;};'use strict';var _=require('lodash');var util=require(_0xcaf5('0x0'));var logger=require(_0xcaf5('0x1'))(_0xcaf5('0x2'));var moment=require('moment');var BPromise=require(_0xcaf5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcaf5('0x4'));var rimraf=require('rimraf');var config=require(_0xcaf5('0x5'));var attributes=require('./cannedAnswer.attributes');module[_0xcaf5('0x6')]=function(_0x46720c,_0x1d1f3e){return _0x46720c[_0xcaf5('0x7')](_0xcaf5('0x8'),attributes,{'tableName':_0xcaf5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcaf5('0xa'),'collate':_0xcaf5('0xb')});}; \ No newline at end of file +var _0x242e=['path','./cannedAnswer.attributes','exports','define','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x163090,_0x45e5b5){var _0x29c788=function(_0x5c8945){while(--_0x5c8945){_0x163090['push'](_0x163090['shift']());}};_0x29c788(++_0x45e5b5);}(_0x242e,0x1e5));var _0xe242=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x242e[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xe242('0x0'));var util=require('util');var logger=require(_0xe242('0x1'))(_0xe242('0x2'));var moment=require('moment');var BPromise=require(_0xe242('0x3'));var rp=require(_0xe242('0x4'));var fs=require('fs');var path=require(_0xe242('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe242('0x6'));module[_0xe242('0x7')]=function(_0x1e8f99,_0x99f5e9){return _0x1e8f99[_0xe242('0x8')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe242('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 14653d8..3b59ce0 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(_0x34e279,_0x5ebf34){var _0x1bb664=function(_0x5d7661){while(--_0x5d7661){_0x34e279['push'](_0x34e279['shift']());}};_0x1bb664(++_0x5ebf34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x25f9ee,_0x5ec35c){var _0x5b7e9e=function(_0x1525e8){while(--_0x1525e8){_0x25f9ee['push'](_0x25f9ee['shift']());}};_0x5b7e9e(++_0x5ec35c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 00ca8e3..1248901 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 _0x6fda=['show','create','/:id','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index'];(function(_0x1782d2,_0x40ab01){var _0x40dfe3=function(_0x4bd33d){while(--_0x4bd33d){_0x1782d2['push'](_0x1782d2['shift']());}};_0x40dfe3(++_0x40ab01);}(_0x6fda,0x1a9));var _0xa6fd=function(_0x2358e7,_0x3fed78){_0x2358e7=_0x2358e7-0x0;var _0x50ff36=_0x6fda[_0x2358e7];return _0x50ff36;};'use strict';var multer=require('multer');var util=require(_0xa6fd('0x0'));var path=require('path');var timeout=require(_0xa6fd('0x1'));var express=require(_0xa6fd('0x2'));var router=express['Router']();var fs_extra=require(_0xa6fd('0x3'));var auth=require(_0xa6fd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa6fd('0x5'));var controller=require(_0xa6fd('0x6'));router[_0xa6fd('0x7')]('/',auth[_0xa6fd('0x8')](),controller[_0xa6fd('0x9')]);router[_0xa6fd('0x7')]('/:id',auth[_0xa6fd('0x8')](),controller[_0xa6fd('0xa')]);router['post']('/',auth[_0xa6fd('0x8')](),controller[_0xa6fd('0xb')]);router['put'](_0xa6fd('0xc'),auth[_0xa6fd('0x8')](),controller['update']);router['delete'](_0xa6fd('0xc'),auth[_0xa6fd('0x8')](),controller[_0xa6fd('0xd')]);module[_0xa6fd('0xe')]=router; \ No newline at end of file +var _0xed6f=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','post','create','update','delete'];(function(_0xb6afda,_0x55854e){var _0x8c25e3=function(_0x550be5){while(--_0x550be5){_0xb6afda['push'](_0xb6afda['shift']());}};_0x8c25e3(++_0x55854e);}(_0xed6f,0x1ab));var _0xfed6=function(_0x337438,_0x157dec){_0x337438=_0x337438-0x0;var _0xfcffc2=_0xed6f[_0x337438];return _0xfcffc2;};'use strict';var multer=require(_0xfed6('0x0'));var util=require(_0xfed6('0x1'));var path=require(_0xfed6('0x2'));var timeout=require('connect-timeout');var express=require(_0xfed6('0x3'));var router=express[_0xfed6('0x4')]();var fs_extra=require(_0xfed6('0x5'));var auth=require(_0xfed6('0x6'));var interaction=require(_0xfed6('0x7'));var config=require(_0xfed6('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xfed6('0x9')](),controller['index']);router['get'](_0xfed6('0xa'),auth[_0xfed6('0x9')](),controller['show']);router[_0xfed6('0xb')]('/',auth['isAuthenticated'](),controller[_0xfed6('0xc')]);router['put'](_0xfed6('0xa'),auth[_0xfed6('0x9')](),controller[_0xfed6('0xd')]);router[_0xfed6('0xe')](_0xfed6('0xa'),auth[_0xfed6('0x9')](),controller[_0xfed6('0xf')]);module[_0xfed6('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 fc97ced..be971c3 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 _0x2116=['1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x257f74,_0x5f8631){var _0x4addb4=function(_0x34834f){while(--_0x34834f){_0x257f74['push'](_0x257f74['shift']());}};_0x4addb4(++_0x5f8631);}(_0x2116,0x67));var _0x6211=function(_0x9979f9,_0x22dba0){_0x9979f9=_0x9979f9-0x0;var _0x53b7fe=_0x2116[_0x9979f9];return _0x53b7fe;};'use strict';var Sequelize=require('sequelize');module[_0x6211('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x6211('0x1')},'clid':{'type':Sequelize[_0x6211('0x2')]},'src':{'type':Sequelize[_0x6211('0x2')]},'dst':{'type':Sequelize[_0x6211('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6211('0x2')]},'dstchannel':{'type':Sequelize[_0x6211('0x2')]},'lastapp':{'type':Sequelize[_0x6211('0x2')]},'lastdata':{'type':Sequelize[_0x6211('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6211('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x6211('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6211('0x2')]},'userfield':{'type':Sequelize[_0x6211('0x2')]},'uniqueid':{'type':Sequelize[_0x6211('0x2')]},'linkedid':{'type':Sequelize[_0x6211('0x2')]},'sequence':{'type':Sequelize[_0x6211('0x2')]},'peeraccount':{'type':Sequelize[_0x6211('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x6211('0x2')]}}; \ No newline at end of file +var _0xbca8=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x45e6b6,_0x569cd1){var _0x3c7475=function(_0x139181){while(--_0x139181){_0x45e6b6['push'](_0x45e6b6['shift']());}};_0x3c7475(++_0x569cd1);}(_0xbca8,0xcc));var _0x8bca=function(_0x337527,_0x54e115){_0x337527=_0x337527-0x0;var _0x1638e3=_0xbca8[_0x337527];return _0x1638e3;};'use strict';var Sequelize=require(_0x8bca('0x0'));module[_0x8bca('0x1')]={'calldate':{'type':Sequelize[_0x8bca('0x2')],'allowNull':![],'defaultValue':_0x8bca('0x3')},'clid':{'type':Sequelize[_0x8bca('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8bca('0x4')]},'dcontext':{'type':Sequelize[_0x8bca('0x4')]},'channel':{'type':Sequelize[_0x8bca('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x8bca('0x4')]},'duration':{'type':Sequelize[_0x8bca('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8bca('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8bca('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8bca('0x4')]},'userfield':{'type':Sequelize[_0x8bca('0x4')]},'uniqueid':{'type':Sequelize[_0x8bca('0x4')]},'linkedid':{'type':Sequelize[_0x8bca('0x4')]},'sequence':{'type':Sequelize[_0x8bca('0x4')]},'peeraccount':{'type':Sequelize[_0x8bca('0x4')]},'type':{'type':Sequelize[_0x8bca('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 68315a0..e3890a4 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 _0xdb94=['keys','find','create','body','destroy','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','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/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','Cdr','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','sort','pick','where','VIRTUAL','filter','includeAll','include','findAll','rows','catch'];(function(_0x270fee,_0x2b8b15){var _0x184922=function(_0x5c7d31){while(--_0x5c7d31){_0x270fee['push'](_0x270fee['shift']());}};_0x184922(++_0x2b8b15);}(_0xdb94,0xe5));var _0x4db9=function(_0x1edec6,_0x19cc86){_0x1edec6=_0x1edec6-0x0;var _0x1a58bd=_0xdb94[_0x1edec6];return _0x1a58bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4db9('0x0'));var zipdir=require(_0x4db9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4db9('0x2'));var moment=require(_0x4db9('0x3'));var BPromise=require(_0x4db9('0x4'));var Mustache=require(_0x4db9('0x5'));var util=require(_0x4db9('0x6'));var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require(_0x4db9('0x8'));var fs=require('fs');var fs_extra=require(_0x4db9('0x9'));var _=require(_0x4db9('0xa'));var squel=require(_0x4db9('0xb'));var crypto=require(_0x4db9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4db9('0xd'));var toCsv=require(_0x4db9('0xe'));var querystring=require(_0x4db9('0xf'));var Papa=require(_0x4db9('0x10'));var Redis=require(_0x4db9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4db9('0x12'));var as=require(_0x4db9('0x13'));var hardwareService=require(_0x4db9('0x14'));var logger=require(_0x4db9('0x15'))(_0x4db9('0x16'));var utils=require(_0x4db9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4db9('0x18'));var db=require(_0x4db9('0x19'))['db'];function respondWithStatusCode(_0x59f01c,_0x549c92){_0x549c92=_0x549c92||0xcc;return function(_0x19f2d3){if(_0x19f2d3){return _0x59f01c[_0x4db9('0x1a')](_0x549c92);}return _0x59f01c[_0x4db9('0x1b')](_0x549c92)['end']();};}function respondWithResult(_0x1a93be,_0x3dde55){_0x3dde55=_0x3dde55||0xc8;return function(_0x2018d2){if(_0x2018d2){return _0x1a93be[_0x4db9('0x1b')](_0x3dde55)[_0x4db9('0x1c')](_0x2018d2);}};}function respondWithFilteredResult(_0x585230,_0x1b1062){return function(_0x1a5a9c){if(_0x1a5a9c){var _0x5d4d70=typeof _0x1b1062[_0x4db9('0x1d')]===_0x4db9('0x1e')&&typeof _0x1b1062[_0x4db9('0x1f')]==='undefined';var _0xedc513=_0x1a5a9c[_0x4db9('0x20')];var _0x4c5f4f=_0x5d4d70?0x0:_0x1b1062['offset'];var _0x493923=_0x5d4d70?_0x1a5a9c[_0x4db9('0x20')]:_0x1b1062[_0x4db9('0x1d')]+_0x1b1062['limit'];var _0x375515;if(_0x493923>=_0xedc513){_0x493923=_0xedc513;_0x375515=0xc8;}else{_0x375515=0xce;}_0x585230[_0x4db9('0x1b')](_0x375515);return _0x585230[_0x4db9('0x21')](_0x4db9('0x22'),_0x4c5f4f+'-'+_0x493923+'/'+_0xedc513)[_0x4db9('0x1c')](_0x1a5a9c);}return null;};}function patchUpdates(_0x28b7f6){return function(_0x34a6ed){try{jsonpatch[_0x4db9('0x23')](_0x34a6ed,_0x28b7f6,!![]);}catch(_0x3256f4){return BPromise[_0x4db9('0x24')](_0x3256f4);}return _0x34a6ed[_0x4db9('0x25')]();};}function saveUpdates(_0x102402,_0x4d56a1){return function(_0x42cc40){if(_0x42cc40){return _0x42cc40[_0x4db9('0x26')](_0x102402)['then'](function(_0x37c81f){return _0x37c81f;});}return null;};}function removeEntity(_0x3f4931,_0x4419af){return function(_0x402898){if(_0x402898){return _0x402898['destroy']()[_0x4db9('0x27')](function(){_0x3f4931['status'](0xcc)[_0x4db9('0x28')]();});}};}function handleEntityNotFound(_0x1c82b6,_0x135aa7){return function(_0x47e89c){if(!_0x47e89c){_0x1c82b6[_0x4db9('0x1a')](0x194);}return _0x47e89c;};}function handleError(_0x622db6,_0x47464d){_0x47464d=_0x47464d||0x1f4;return function(_0x5e7d29){logger['error'](_0x5e7d29[_0x4db9('0x29')]);if(_0x5e7d29['name']){delete _0x5e7d29[_0x4db9('0x2a')];}_0x622db6[_0x4db9('0x1b')](_0x47464d)[_0x4db9('0x2b')](_0x5e7d29);};}exports[_0x4db9('0x2c')]=function(_0x384df5,_0x3c3fcf){var _0x1d0dc2={},_0x373a7d={},_0x4c4a47={'count':0x0,'rows':[]};var _0x35f757=_['map'](db[_0x4db9('0x2d')][_0x4db9('0x2e')],function(_0x1e7840){return{'name':_0x1e7840[_0x4db9('0x2f')],'type':_0x1e7840[_0x4db9('0x30')]['key']};});_0x373a7d[_0x4db9('0x31')]=_[_0x4db9('0x32')](_0x35f757,_0x4db9('0x2a'));_0x373a7d[_0x4db9('0x33')]=_['keys'](_0x384df5['query']);_0x373a7d[_0x4db9('0x34')]=_[_0x4db9('0x35')](_0x373a7d['model'],_0x373a7d['query']);_0x1d0dc2[_0x4db9('0x36')]=_['intersection'](_0x373a7d['model'],qs[_0x4db9('0x37')](_0x384df5[_0x4db9('0x33')]['fields']));_0x1d0dc2[_0x4db9('0x36')]=_0x1d0dc2[_0x4db9('0x36')][_0x4db9('0x38')]?_0x1d0dc2[_0x4db9('0x36')]:_0x373a7d['model'];if(!_0x384df5[_0x4db9('0x33')]['hasOwnProperty']('nolimit')){_0x1d0dc2['limit']=qs[_0x4db9('0x1f')](_0x384df5[_0x4db9('0x33')]['limit']);_0x1d0dc2[_0x4db9('0x1d')]=qs[_0x4db9('0x1d')](_0x384df5['query']['offset']);}_0x1d0dc2['order']=qs[_0x4db9('0x39')](_0x384df5['query'][_0x4db9('0x39')]);_0x1d0dc2['where']=qs[_0x4db9('0x34')](_[_0x4db9('0x3a')](_0x384df5[_0x4db9('0x33')],_0x373a7d[_0x4db9('0x34')]),_0x35f757);if(_0x384df5[_0x4db9('0x33')]['filter']){_0x1d0dc2[_0x4db9('0x3b')]=_['merge'](_0x1d0dc2[_0x4db9('0x3b')],{'$or':_[_0x4db9('0x32')](_0x35f757,function(_0x15929e){if(_0x15929e[_0x4db9('0x30')]!==_0x4db9('0x3c')){var _0x4159d2={};_0x4159d2[_0x15929e['name']]={'$like':'%'+_0x384df5[_0x4db9('0x33')][_0x4db9('0x3d')]+'%'};return _0x4159d2;}})});}_0x1d0dc2=_['merge']({},_0x1d0dc2,_0x384df5['options']);var _0x404af3={'where':_0x1d0dc2[_0x4db9('0x3b')]};return db[_0x4db9('0x2d')][_0x4db9('0x20')](_0x404af3)[_0x4db9('0x27')](function(_0x36a648){_0x4c4a47[_0x4db9('0x20')]=_0x36a648;if(_0x384df5[_0x4db9('0x33')][_0x4db9('0x3e')]){_0x1d0dc2[_0x4db9('0x3f')]=[{'all':!![]}];}return db[_0x4db9('0x2d')][_0x4db9('0x40')](_0x1d0dc2);})['then'](function(_0x2716d6){_0x4c4a47[_0x4db9('0x41')]=_0x2716d6;return _0x4c4a47;})[_0x4db9('0x27')](respondWithFilteredResult(_0x3c3fcf,_0x1d0dc2))[_0x4db9('0x42')](handleError(_0x3c3fcf,null));};exports['show']=function(_0x57d32d,_0x248891){var _0x2b18a2={'raw':!![],'where':{'id':_0x57d32d['params']['id']}},_0x2fc233={};_0x2fc233[_0x4db9('0x31')]=_['keys'](db[_0x4db9('0x2d')][_0x4db9('0x2e')]);_0x2fc233[_0x4db9('0x33')]=_[_0x4db9('0x43')](_0x57d32d[_0x4db9('0x33')]);_0x2fc233['filters']=_[_0x4db9('0x35')](_0x2fc233[_0x4db9('0x31')],_0x2fc233[_0x4db9('0x33')]);_0x2b18a2[_0x4db9('0x36')]=_[_0x4db9('0x35')](_0x2fc233['model'],qs[_0x4db9('0x37')](_0x57d32d[_0x4db9('0x33')][_0x4db9('0x37')]));_0x2b18a2[_0x4db9('0x36')]=_0x2b18a2[_0x4db9('0x36')][_0x4db9('0x38')]?_0x2b18a2[_0x4db9('0x36')]:_0x2fc233[_0x4db9('0x31')];if(_0x57d32d[_0x4db9('0x33')]['includeAll']){_0x2b18a2[_0x4db9('0x3f')]=[{'all':!![]}];}_0x2b18a2=_['merge']({},_0x2b18a2,_0x57d32d['options']);return db[_0x4db9('0x2d')][_0x4db9('0x44')](_0x2b18a2)['then'](handleEntityNotFound(_0x248891,null))['then'](respondWithResult(_0x248891,null))[_0x4db9('0x42')](handleError(_0x248891,null));};exports[_0x4db9('0x45')]=function(_0x3fc788,_0x7f0aac){return db[_0x4db9('0x2d')][_0x4db9('0x45')](_0x3fc788[_0x4db9('0x46')],{})[_0x4db9('0x27')](respondWithResult(_0x7f0aac,0xc9))[_0x4db9('0x42')](handleError(_0x7f0aac,null));};exports[_0x4db9('0x26')]=function(_0x43312c,_0x5495de){if(_0x43312c[_0x4db9('0x46')]['id']){delete _0x43312c[_0x4db9('0x46')]['id'];}return db['Cdr'][_0x4db9('0x44')]({'where':{'id':_0x43312c['params']['id']}})[_0x4db9('0x27')](handleEntityNotFound(_0x5495de,null))[_0x4db9('0x27')](saveUpdates(_0x43312c[_0x4db9('0x46')],null))[_0x4db9('0x27')](respondWithResult(_0x5495de,null))[_0x4db9('0x42')](handleError(_0x5495de,null));};exports[_0x4db9('0x47')]=function(_0x3f1aac,_0x3b8d8c){return db[_0x4db9('0x2d')][_0x4db9('0x44')]({'where':{'id':_0x3f1aac[_0x4db9('0x48')]['id']}})[_0x4db9('0x27')](handleEntityNotFound(_0x3b8d8c,null))[_0x4db9('0x27')](removeEntity(_0x3b8d8c,null))['catch'](handleError(_0x3b8d8c,null));};exports['describe']=function(_0x5ececc,_0x161e2e){return db['Cdr'][_0x4db9('0x49')]()['then'](respondWithResult(_0x161e2e,null))[_0x4db9('0x42')](handleError(_0x161e2e,null));}; \ No newline at end of file +var _0xcb81=['save','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x5306ff,_0x2e80d7){var _0x536f01=function(_0x3185b5){while(--_0x3185b5){_0x5306ff['push'](_0x5306ff['shift']());}};_0x536f01(++_0x2e80d7);}(_0xcb81,0x154));var _0x1cb8=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xcb81[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require(_0x1cb8('0x0'));var rimraf=require(_0x1cb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1cb8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1cb8('0x3'));var util=require(_0x1cb8('0x4'));var path=require(_0x1cb8('0x5'));var sox=require(_0x1cb8('0x6'));var csv=require(_0x1cb8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb8('0x8'));var _=require(_0x1cb8('0x9'));var squel=require('squel');var crypto=require(_0x1cb8('0xa'));var jsforce=require(_0x1cb8('0xb'));var deskjs=require(_0x1cb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1cb8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1cb8('0xe'));var qs=require(_0x1cb8('0xf'));var as=require(_0x1cb8('0x10'));var hardwareService=require(_0x1cb8('0x11'));var logger=require(_0x1cb8('0x12'))(_0x1cb8('0x13'));var utils=require(_0x1cb8('0x14'));var config=require(_0x1cb8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1cb8('0x16'))['db'];function respondWithStatusCode(_0x1ffe94,_0x1938ee){_0x1938ee=_0x1938ee||0xcc;return function(_0x299eea){if(_0x299eea){return _0x1ffe94[_0x1cb8('0x17')](_0x1938ee);}return _0x1ffe94['status'](_0x1938ee)[_0x1cb8('0x18')]();};}function respondWithResult(_0x2c600,_0xcb6ad1){_0xcb6ad1=_0xcb6ad1||0xc8;return function(_0x14d84d){if(_0x14d84d){return _0x2c600[_0x1cb8('0x19')](_0xcb6ad1)[_0x1cb8('0x1a')](_0x14d84d);}};}function respondWithFilteredResult(_0x339ad0,_0x243930){return function(_0x5af4a3){if(_0x5af4a3){var _0x17a95d=typeof _0x243930['offset']===_0x1cb8('0x1b')&&typeof _0x243930[_0x1cb8('0x1c')]===_0x1cb8('0x1b');var _0x46abd0=_0x5af4a3[_0x1cb8('0x1d')];var _0x308088=_0x17a95d?0x0:_0x243930[_0x1cb8('0x1e')];var _0x9f0adb=_0x17a95d?_0x5af4a3[_0x1cb8('0x1d')]:_0x243930[_0x1cb8('0x1e')]+_0x243930[_0x1cb8('0x1c')];var _0x3cda27;if(_0x9f0adb>=_0x46abd0){_0x9f0adb=_0x46abd0;_0x3cda27=0xc8;}else{_0x3cda27=0xce;}_0x339ad0['status'](_0x3cda27);return _0x339ad0[_0x1cb8('0x1f')](_0x1cb8('0x20'),_0x308088+'-'+_0x9f0adb+'/'+_0x46abd0)[_0x1cb8('0x1a')](_0x5af4a3);}return null;};}function patchUpdates(_0x3d1682){return function(_0x4abf3a){try{jsonpatch[_0x1cb8('0x21')](_0x4abf3a,_0x3d1682,!![]);}catch(_0x4f9220){return BPromise[_0x1cb8('0x22')](_0x4f9220);}return _0x4abf3a[_0x1cb8('0x23')]();};}function saveUpdates(_0x40b914,_0x38ff3a){return function(_0x559916){if(_0x559916){return _0x559916['update'](_0x40b914)[_0x1cb8('0x24')](function(_0x4040be){return _0x4040be;});}return null;};}function removeEntity(_0x22dafe,_0x44a00d){return function(_0x2473b8){if(_0x2473b8){return _0x2473b8[_0x1cb8('0x25')]()[_0x1cb8('0x24')](function(){_0x22dafe['status'](0xcc)[_0x1cb8('0x18')]();});}};}function handleEntityNotFound(_0x4554d5,_0x35c890){return function(_0xeeb21d){if(!_0xeeb21d){_0x4554d5[_0x1cb8('0x17')](0x194);}return _0xeeb21d;};}function handleError(_0x41ab56,_0x4ca3be){_0x4ca3be=_0x4ca3be||0x1f4;return function(_0x1ec995){logger[_0x1cb8('0x26')](_0x1ec995[_0x1cb8('0x27')]);if(_0x1ec995[_0x1cb8('0x28')]){delete _0x1ec995[_0x1cb8('0x28')];}_0x41ab56['status'](_0x4ca3be)[_0x1cb8('0x29')](_0x1ec995);};}exports[_0x1cb8('0x2a')]=function(_0x3a8b53,_0x21c17a){var _0x4fda96={},_0x2a79e0={},_0x2ba8c8={'count':0x0,'rows':[]};var _0x3a6a67=_['map'](db[_0x1cb8('0x2b')][_0x1cb8('0x2c')],function(_0x17abe1){return{'name':_0x17abe1['fieldName'],'type':_0x17abe1[_0x1cb8('0x2d')][_0x1cb8('0x2e')]};});_0x2a79e0[_0x1cb8('0x2f')]=_[_0x1cb8('0x30')](_0x3a6a67,_0x1cb8('0x28'));_0x2a79e0['query']=_[_0x1cb8('0x31')](_0x3a8b53[_0x1cb8('0x32')]);_0x2a79e0[_0x1cb8('0x33')]=_[_0x1cb8('0x34')](_0x2a79e0[_0x1cb8('0x2f')],_0x2a79e0[_0x1cb8('0x32')]);_0x4fda96[_0x1cb8('0x35')]=_[_0x1cb8('0x34')](_0x2a79e0[_0x1cb8('0x2f')],qs['fields'](_0x3a8b53['query'][_0x1cb8('0x36')]));_0x4fda96[_0x1cb8('0x35')]=_0x4fda96[_0x1cb8('0x35')]['length']?_0x4fda96['attributes']:_0x2a79e0[_0x1cb8('0x2f')];if(!_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x37')](_0x1cb8('0x38'))){_0x4fda96[_0x1cb8('0x1c')]=qs[_0x1cb8('0x1c')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x1c')]);_0x4fda96['offset']=qs[_0x1cb8('0x1e')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x1e')]);}_0x4fda96[_0x1cb8('0x39')]=qs[_0x1cb8('0x3a')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x3a')]);_0x4fda96[_0x1cb8('0x3b')]=qs[_0x1cb8('0x33')](_['pick'](_0x3a8b53[_0x1cb8('0x32')],_0x2a79e0[_0x1cb8('0x33')]),_0x3a6a67);if(_0x3a8b53['query'][_0x1cb8('0x3c')]){_0x4fda96[_0x1cb8('0x3b')]=_[_0x1cb8('0x3d')](_0x4fda96[_0x1cb8('0x3b')],{'$or':_[_0x1cb8('0x30')](_0x3a6a67,function(_0x5dc4c0){if(_0x5dc4c0[_0x1cb8('0x2d')]!==_0x1cb8('0x3e')){var _0x2989c6={};_0x2989c6[_0x5dc4c0['name']]={'$like':'%'+_0x3a8b53['query']['filter']+'%'};return _0x2989c6;}})});}_0x4fda96=_[_0x1cb8('0x3d')]({},_0x4fda96,_0x3a8b53[_0x1cb8('0x3f')]);var _0x328f7e={'where':_0x4fda96[_0x1cb8('0x3b')]};return db['Cdr']['count'](_0x328f7e)[_0x1cb8('0x24')](function(_0x25f0a3){_0x2ba8c8[_0x1cb8('0x1d')]=_0x25f0a3;if(_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x40')]){_0x4fda96[_0x1cb8('0x41')]=[{'all':!![]}];}return db[_0x1cb8('0x2b')][_0x1cb8('0x42')](_0x4fda96);})['then'](function(_0x2044d1){_0x2ba8c8[_0x1cb8('0x43')]=_0x2044d1;return _0x2ba8c8;})[_0x1cb8('0x24')](respondWithFilteredResult(_0x21c17a,_0x4fda96))[_0x1cb8('0x44')](handleError(_0x21c17a,null));};exports['show']=function(_0x156298,_0x47c18a){var _0x2060a6={'raw':!![],'where':{'id':_0x156298['params']['id']}},_0x37230e={};_0x37230e[_0x1cb8('0x2f')]=_[_0x1cb8('0x31')](db[_0x1cb8('0x2b')]['rawAttributes']);_0x37230e['query']=_[_0x1cb8('0x31')](_0x156298['query']);_0x37230e[_0x1cb8('0x33')]=_[_0x1cb8('0x34')](_0x37230e[_0x1cb8('0x2f')],_0x37230e[_0x1cb8('0x32')]);_0x2060a6[_0x1cb8('0x35')]=_[_0x1cb8('0x34')](_0x37230e[_0x1cb8('0x2f')],qs['fields'](_0x156298[_0x1cb8('0x32')][_0x1cb8('0x36')]));_0x2060a6[_0x1cb8('0x35')]=_0x2060a6[_0x1cb8('0x35')]['length']?_0x2060a6[_0x1cb8('0x35')]:_0x37230e[_0x1cb8('0x2f')];if(_0x156298[_0x1cb8('0x32')][_0x1cb8('0x40')]){_0x2060a6[_0x1cb8('0x41')]=[{'all':!![]}];}_0x2060a6=_['merge']({},_0x2060a6,_0x156298[_0x1cb8('0x3f')]);return db[_0x1cb8('0x2b')][_0x1cb8('0x45')](_0x2060a6)[_0x1cb8('0x24')](handleEntityNotFound(_0x47c18a,null))[_0x1cb8('0x24')](respondWithResult(_0x47c18a,null))['catch'](handleError(_0x47c18a,null));};exports[_0x1cb8('0x46')]=function(_0x3a4ec4,_0x5598b1){return db[_0x1cb8('0x2b')][_0x1cb8('0x46')](_0x3a4ec4[_0x1cb8('0x47')],{})[_0x1cb8('0x24')](respondWithResult(_0x5598b1,0xc9))[_0x1cb8('0x44')](handleError(_0x5598b1,null));};exports[_0x1cb8('0x48')]=function(_0x3b063c,_0x219541){if(_0x3b063c[_0x1cb8('0x47')]['id']){delete _0x3b063c[_0x1cb8('0x47')]['id'];}return db[_0x1cb8('0x2b')][_0x1cb8('0x45')]({'where':{'id':_0x3b063c[_0x1cb8('0x49')]['id']}})[_0x1cb8('0x24')](handleEntityNotFound(_0x219541,null))['then'](saveUpdates(_0x3b063c[_0x1cb8('0x47')],null))[_0x1cb8('0x24')](respondWithResult(_0x219541,null))[_0x1cb8('0x44')](handleError(_0x219541,null));};exports[_0x1cb8('0x25')]=function(_0x21aba7,_0x15f0ba){return db[_0x1cb8('0x2b')]['find']({'where':{'id':_0x21aba7[_0x1cb8('0x49')]['id']}})[_0x1cb8('0x24')](handleEntityNotFound(_0x15f0ba,null))[_0x1cb8('0x24')](removeEntity(_0x15f0ba,null))['catch'](handleError(_0x15f0ba,null));};exports['describe']=function(_0x1c12aa,_0x42cc81){return db[_0x1cb8('0x2b')][_0x1cb8('0x4a')]()[_0x1cb8('0x24')](respondWithResult(_0x42cc81,null))['catch'](handleError(_0x42cc81,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index afcfb8a..1c66bd4 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x470a45,_0x15ea90){var _0x5dd896=function(_0x28ac6f){while(--_0x28ac6f){_0x470a45['push'](_0x470a45['shift']());}};_0x5dd896(++_0x15ea90);}(_0x7a54,0x106));var _0x47a5=function(_0x42e747,_0x1d16ba){_0x42e747=_0x42e747-0x0;var _0x4dba01=_0x7a54[_0x42e747];return _0x4dba01;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0xbd01e6,_0x334323){var _0x5bb6cf=function(_0x3cb53a){while(--_0x3cb53a){_0xbd01e6['push'](_0xbd01e6['shift']());}};_0x5bb6cf(++_0x334323);}(_0x7a54,0x106));var _0x47a5=function(_0x1109db,_0x4949f3){_0x1109db=_0x1109db-0x0;var _0x41c5d1=_0x7a54[_0x1109db];return _0x41c5d1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 89b9d80..df9cb38 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 _0xcb01=['client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xcac2c2,_0x8a1161){var _0x5b801b=function(_0x1be5a8){while(--_0x1be5a8){_0xcac2c2['push'](_0xcac2c2['shift']());}};_0x5b801b(++_0x8a1161);}(_0xcb01,0x10a));var _0x1cb0=function(_0x54b3b6,_0x3549ac){_0x54b3b6=_0x54b3b6-0x0;var _0xb12829=_0xcb01[_0x54b3b6];return _0xb12829;};'use strict';var _=require('lodash');var util=require(_0x1cb0('0x0'));var moment=require(_0x1cb0('0x1'));var BPromise=require(_0x1cb0('0x2'));var rs=require(_0x1cb0('0x3'));var fs=require('fs');var Redis=require(_0x1cb0('0x4'));var db=require(_0x1cb0('0x5'))['db'];var utils=require(_0x1cb0('0x6'));var logger=require(_0x1cb0('0x7'))(_0x1cb0('0x8'));var config=require('../../config/environment');var jayson=require(_0x1cb0('0x9'));var client=jayson[_0x1cb0('0xa')][_0x1cb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x280a1b,_0x52a2b3,_0x11b608){return new BPromise(function(_0x1b0fa8,_0x1165cc){return client[_0x1cb0('0xc')](_0x280a1b,_0x11b608)[_0x1cb0('0xd')](function(_0x2064f){logger[_0x1cb0('0xe')](_0x1cb0('0xf'),_0x52a2b3,_0x1cb0('0x10'));logger[_0x1cb0('0x11')](_0x1cb0('0x12'),_0x52a2b3,_0x1cb0('0x10'),JSON['stringify'](_0x2064f));if(_0x2064f[_0x1cb0('0x13')]){if(_0x2064f[_0x1cb0('0x13')][_0x1cb0('0x14')]===0x1f4){logger[_0x1cb0('0x13')](_0x1cb0('0xf'),_0x52a2b3,_0x2064f['error']['message']);return _0x1165cc(_0x2064f[_0x1cb0('0x13')][_0x1cb0('0x15')]);}logger[_0x1cb0('0x13')](_0x1cb0('0xf'),_0x52a2b3,_0x2064f['error'][_0x1cb0('0x15')]);return _0x1b0fa8(_0x2064f[_0x1cb0('0x13')]['message']);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x52a2b3,_0x1cb0('0x10'));_0x1b0fa8(_0x2064f[_0x1cb0('0x16')][_0x1cb0('0x15')]);}})['catch'](function(_0x2aa741){logger['error']('Cdr,\x20%s,\x20%s',_0x52a2b3,_0x2aa741);_0x1165cc(_0x2aa741);});});} \ No newline at end of file +var _0x0c29=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0c29,0x86));var _0x90c2=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x0c29[_0x421cf8];return _0x145c48;};'use strict';var _=require(_0x90c2('0x0'));var util=require(_0x90c2('0x1'));var moment=require(_0x90c2('0x2'));var BPromise=require(_0x90c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90c2('0x4'))['db'];var utils=require(_0x90c2('0x5'));var logger=require(_0x90c2('0x6'))(_0x90c2('0x7'));var config=require(_0x90c2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x90c2('0x9')][_0x90c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bcdd1,_0x4cd1c3,_0x3af68b){return new BPromise(function(_0x3ab97b,_0x4ac0f4){return client[_0x90c2('0xb')](_0x3bcdd1,_0x3af68b)[_0x90c2('0xc')](function(_0xc74db0){logger[_0x90c2('0xd')](_0x90c2('0xe'),_0x4cd1c3,_0x90c2('0xf'));logger[_0x90c2('0x10')](_0x90c2('0x11'),_0x4cd1c3,_0x90c2('0xf'),JSON[_0x90c2('0x12')](_0xc74db0));if(_0xc74db0['error']){if(_0xc74db0[_0x90c2('0x13')][_0x90c2('0x14')]===0x1f4){logger[_0x90c2('0x13')](_0x90c2('0xe'),_0x4cd1c3,_0xc74db0['error'][_0x90c2('0x15')]);return _0x4ac0f4(_0xc74db0[_0x90c2('0x13')]['message']);}logger[_0x90c2('0x13')](_0x90c2('0xe'),_0x4cd1c3,_0xc74db0[_0x90c2('0x13')][_0x90c2('0x15')]);return _0x3ab97b(_0xc74db0[_0x90c2('0x13')][_0x90c2('0x15')]);}else{logger[_0x90c2('0xd')](_0x90c2('0xe'),_0x4cd1c3,_0x90c2('0xf'));_0x3ab97b(_0xc74db0[_0x90c2('0x16')][_0x90c2('0x15')]);}})['catch'](function(_0x18e684){logger[_0x90c2('0x13')](_0x90c2('0xe'),_0x4cd1c3,_0x18e684);_0x4ac0f4(_0x18e684);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 23958d7..53e8b8b 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(_0x562ec2,_0x33932b){var _0xd3a205=function(_0x21aac4){while(--_0x21aac4){_0x562ec2['push'](_0x562ec2['shift']());}};_0xd3a205(++_0x33932b);}(_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'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x14bf66,_0x3e1066){var _0xaf4bf7=function(_0x3d9c3f){while(--_0x3d9c3f){_0x14bf66['push'](_0x14bf66['shift']());}};_0xaf4bf7(++_0x3e1066);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 6f1b47f..3cc939d 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 _0x53a9=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x1ed4cb,_0x1b010a){var _0x8e4fe8=function(_0x4229c4){while(--_0x4229c4){_0x1ed4cb['push'](_0x1ed4cb['shift']());}};_0x8e4fe8(++_0x1b010a);}(_0x53a9,0x154));var _0x953a=function(_0x44974f,_0xe2fa83){_0x44974f=_0x44974f-0x0;var _0x1b74ff=_0x53a9[_0x44974f];return _0x1b74ff;};'use strict';var Sequelize=require('sequelize');module[_0x953a('0x0')]={'priority':{'type':Sequelize[_0x953a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x953a('0x2')],'allowNull':![],'defaultValue':_0x953a('0x3')},'appdata':{'type':Sequelize[_0x953a('0x4')]()},'description':{'type':Sequelize[_0x953a('0x2')]},'interval':{'type':Sequelize[_0x953a('0x2')],'defaultValue':_0x953a('0x5')}}; \ No newline at end of file +var _0x6b53=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x306f7d,_0x142389){var _0x5a91b5=function(_0x340a91){while(--_0x340a91){_0x306f7d['push'](_0x306f7d['shift']());}};_0x5a91b5(++_0x142389);}(_0x6b53,0x79));var _0x36b5=function(_0x1a664e,_0x3e34d3){_0x1a664e=_0x1a664e-0x0;var _0xe91c3a=_0x6b53[_0x1a664e];return _0xe91c3a;};'use strict';var Sequelize=require('sequelize');module[_0x36b5('0x0')]={'priority':{'type':Sequelize[_0x36b5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x36b5('0x2')],'allowNull':![],'defaultValue':_0x36b5('0x3')},'appdata':{'type':Sequelize[_0x36b5('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x36b5('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c2d663f..eb6160e 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 _0xbd20=['path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','model','ChatApplication','rawAttributes','keys','intersection','query','fields','attributes','length','includeAll','merge','find','catch','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x353afc,_0x2ca65d){var _0x42c461=function(_0x461e3a){while(--_0x461e3a){_0x353afc['push'](_0x353afc['shift']());}};_0x42c461(++_0x2ca65d);}(_0xbd20,0x14a));var _0x0bd2=function(_0x38b0a1,_0x29da11){_0x38b0a1=_0x38b0a1-0x0;var _0x27d217=_0xbd20[_0x38b0a1];return _0x27d217;};'use strict';var emlformat=require(_0x0bd2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0bd2('0x1'));var rp=require(_0x0bd2('0x2'));var moment=require(_0x0bd2('0x3'));var BPromise=require(_0x0bd2('0x4'));var Mustache=require(_0x0bd2('0x5'));var util=require('util');var path=require(_0x0bd2('0x6'));var sox=require(_0x0bd2('0x7'));var csv=require(_0x0bd2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0bd2('0x9'));var _=require(_0x0bd2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0bd2('0xb'));var deskjs=require(_0x0bd2('0xc'));var toCsv=require(_0x0bd2('0x8'));var querystring=require(_0x0bd2('0xd'));var Papa=require(_0x0bd2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0bd2('0xf'));var as=require(_0x0bd2('0x10'));var hardwareService=require(_0x0bd2('0x11'));var logger=require(_0x0bd2('0x12'))(_0x0bd2('0x13'));var utils=require('../../config/utils');var config=require(_0x0bd2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0bd2('0x15'))['db'];function respondWithStatusCode(_0x20571b,_0x4c6b99){_0x4c6b99=_0x4c6b99||0xcc;return function(_0x5f0205){if(_0x5f0205){return _0x20571b[_0x0bd2('0x16')](_0x4c6b99);}return _0x20571b[_0x0bd2('0x17')](_0x4c6b99)[_0x0bd2('0x18')]();};}function respondWithResult(_0x2cf837,_0x2abcc8){_0x2abcc8=_0x2abcc8||0xc8;return function(_0x561b0f){if(_0x561b0f){return _0x2cf837['status'](_0x2abcc8)[_0x0bd2('0x19')](_0x561b0f);}};}function respondWithFilteredResult(_0x36d899,_0x5255ec){return function(_0x283f31){if(_0x283f31){var _0xd988bb=typeof _0x5255ec[_0x0bd2('0x1a')]===_0x0bd2('0x1b')&&typeof _0x5255ec[_0x0bd2('0x1c')]===_0x0bd2('0x1b');var _0x36001b=_0x283f31['count'];var _0x56902d=_0xd988bb?0x0:_0x5255ec[_0x0bd2('0x1a')];var _0x5d6cef=_0xd988bb?_0x283f31[_0x0bd2('0x1d')]:_0x5255ec['offset']+_0x5255ec[_0x0bd2('0x1c')];var _0x48e632;if(_0x5d6cef>=_0x36001b){_0x5d6cef=_0x36001b;_0x48e632=0xc8;}else{_0x48e632=0xce;}_0x36d899[_0x0bd2('0x17')](_0x48e632);return _0x36d899['set'](_0x0bd2('0x1e'),_0x56902d+'-'+_0x5d6cef+'/'+_0x36001b)[_0x0bd2('0x19')](_0x283f31);}return null;};}function patchUpdates(_0x3b3c87){return function(_0x4b1a3e){try{jsonpatch[_0x0bd2('0x1f')](_0x4b1a3e,_0x3b3c87,!![]);}catch(_0x21bb2c){return BPromise[_0x0bd2('0x20')](_0x21bb2c);}return _0x4b1a3e[_0x0bd2('0x21')]();};}function saveUpdates(_0xff78ae,_0x5cdac7){return function(_0x36b3c4){if(_0x36b3c4){return _0x36b3c4[_0x0bd2('0x22')](_0xff78ae)[_0x0bd2('0x23')](function(_0x6d2f5e){return _0x6d2f5e;});}return null;};}function removeEntity(_0x277ae9,_0x343a99){return function(_0xe47fb){if(_0xe47fb){return _0xe47fb[_0x0bd2('0x24')]()[_0x0bd2('0x23')](function(){_0x277ae9[_0x0bd2('0x17')](0xcc)[_0x0bd2('0x18')]();});}};}function handleEntityNotFound(_0x2028af,_0x3760a4){return function(_0x3a3eff){if(!_0x3a3eff){_0x2028af[_0x0bd2('0x16')](0x194);}return _0x3a3eff;};}function handleError(_0x1627e4,_0x3d63f2){_0x3d63f2=_0x3d63f2||0x1f4;return function(_0x5f0514){logger['error'](_0x5f0514[_0x0bd2('0x25')]);if(_0x5f0514[_0x0bd2('0x26')]){delete _0x5f0514[_0x0bd2('0x26')];}_0x1627e4[_0x0bd2('0x17')](_0x3d63f2)[_0x0bd2('0x27')](_0x5f0514);};}exports[_0x0bd2('0x28')]=function(_0x4d7ba1,_0x459bd6){var _0x507a1e={'raw':!![],'where':{'id':_0x4d7ba1['params']['id']}},_0x37e5a4={};_0x37e5a4[_0x0bd2('0x29')]=_['keys'](db[_0x0bd2('0x2a')][_0x0bd2('0x2b')]);_0x37e5a4['query']=_[_0x0bd2('0x2c')](_0x4d7ba1['query']);_0x37e5a4['filters']=_[_0x0bd2('0x2d')](_0x37e5a4[_0x0bd2('0x29')],_0x37e5a4[_0x0bd2('0x2e')]);_0x507a1e['attributes']=_[_0x0bd2('0x2d')](_0x37e5a4[_0x0bd2('0x29')],qs['fields'](_0x4d7ba1[_0x0bd2('0x2e')][_0x0bd2('0x2f')]));_0x507a1e[_0x0bd2('0x30')]=_0x507a1e['attributes'][_0x0bd2('0x31')]?_0x507a1e[_0x0bd2('0x30')]:_0x37e5a4[_0x0bd2('0x29')];if(_0x4d7ba1[_0x0bd2('0x2e')][_0x0bd2('0x32')]){_0x507a1e['include']=[{'all':!![]}];}_0x507a1e=_[_0x0bd2('0x33')]({},_0x507a1e,_0x4d7ba1['options']);return db[_0x0bd2('0x2a')][_0x0bd2('0x34')](_0x507a1e)[_0x0bd2('0x23')](handleEntityNotFound(_0x459bd6,null))[_0x0bd2('0x23')](respondWithResult(_0x459bd6,null))[_0x0bd2('0x35')](handleError(_0x459bd6,null));};exports[_0x0bd2('0x22')]=function(_0x55bf9d,_0x3e0e0e){if(_0x55bf9d[_0x0bd2('0x36')]['id']){delete _0x55bf9d[_0x0bd2('0x36')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x55bf9d[_0x0bd2('0x37')]['id']}})[_0x0bd2('0x23')](handleEntityNotFound(_0x3e0e0e,null))[_0x0bd2('0x23')](saveUpdates(_0x55bf9d[_0x0bd2('0x36')],null))['then'](respondWithResult(_0x3e0e0e,null))['catch'](handleError(_0x3e0e0e,null));};exports[_0x0bd2('0x24')]=function(_0x1c8d83,_0x499d9e){return db[_0x0bd2('0x2a')][_0x0bd2('0x34')]({'where':{'id':_0x1c8d83[_0x0bd2('0x37')]['id']}})[_0x0bd2('0x23')](handleEntityNotFound(_0x499d9e,null))[_0x0bd2('0x23')](removeEntity(_0x499d9e,null))[_0x0bd2('0x35')](handleError(_0x499d9e,null));}; \ No newline at end of file +var _0xc423=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','offset','count','limit','set','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','show','params','model','keys','query','filters','attributes','intersection','fields','includeAll','include','ChatApplication','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox'];(function(_0x36907d,_0x49af29){var _0x54de39=function(_0x2f5c99){while(--_0x2f5c99){_0x36907d['push'](_0x36907d['shift']());}};_0x54de39(++_0x49af29);}(_0xc423,0x159));var _0x3c42=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc423[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x3c42('0x0'));var rimraf=require(_0x3c42('0x1'));var zipdir=require(_0x3c42('0x2'));var jsonpatch=require(_0x3c42('0x3'));var rp=require(_0x3c42('0x4'));var moment=require('moment');var BPromise=require(_0x3c42('0x5'));var Mustache=require(_0x3c42('0x6'));var util=require(_0x3c42('0x7'));var path=require('path');var sox=require(_0x3c42('0x8'));var csv=require(_0x3c42('0x9'));var ejs=require(_0x3c42('0xa'));var fs=require('fs');var fs_extra=require(_0x3c42('0xb'));var _=require(_0x3c42('0xc'));var squel=require(_0x3c42('0xd'));var crypto=require(_0x3c42('0xe'));var jsforce=require(_0x3c42('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3c42('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c42('0x10'));var authService=require(_0x3c42('0x11'));var qs=require(_0x3c42('0x12'));var as=require(_0x3c42('0x13'));var hardwareService=require(_0x3c42('0x14'));var logger=require(_0x3c42('0x15'))(_0x3c42('0x16'));var utils=require(_0x3c42('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3c42('0x18'));var db=require(_0x3c42('0x19'))['db'];function respondWithStatusCode(_0xa2570b,_0x18d617){_0x18d617=_0x18d617||0xcc;return function(_0x1f802b){if(_0x1f802b){return _0xa2570b['sendStatus'](_0x18d617);}return _0xa2570b[_0x3c42('0x1a')](_0x18d617)['end']();};}function respondWithResult(_0x385f99,_0x25d565){_0x25d565=_0x25d565||0xc8;return function(_0x475d11){if(_0x475d11){return _0x385f99['status'](_0x25d565)[_0x3c42('0x1b')](_0x475d11);}};}function respondWithFilteredResult(_0x2500ee,_0x57857b){return function(_0x5880b7){if(_0x5880b7){var _0x34ef38=typeof _0x57857b['offset']===_0x3c42('0x1c')&&typeof _0x57857b['limit']===_0x3c42('0x1c');var _0x469af7=_0x5880b7['count'];var _0x88b878=_0x34ef38?0x0:_0x57857b[_0x3c42('0x1d')];var _0xf59593=_0x34ef38?_0x5880b7[_0x3c42('0x1e')]:_0x57857b[_0x3c42('0x1d')]+_0x57857b[_0x3c42('0x1f')];var _0x194f2e;if(_0xf59593>=_0x469af7){_0xf59593=_0x469af7;_0x194f2e=0xc8;}else{_0x194f2e=0xce;}_0x2500ee[_0x3c42('0x1a')](_0x194f2e);return _0x2500ee[_0x3c42('0x20')]('Content-Range',_0x88b878+'-'+_0xf59593+'/'+_0x469af7)[_0x3c42('0x1b')](_0x5880b7);}return null;};}function patchUpdates(_0x34c476){return function(_0x2375cf){try{jsonpatch[_0x3c42('0x21')](_0x2375cf,_0x34c476,!![]);}catch(_0x4953e3){return BPromise[_0x3c42('0x22')](_0x4953e3);}return _0x2375cf['save']();};}function saveUpdates(_0x4a1a5d,_0x204fee){return function(_0xb91b37){if(_0xb91b37){return _0xb91b37[_0x3c42('0x23')](_0x4a1a5d)[_0x3c42('0x24')](function(_0x2b7fdd){return _0x2b7fdd;});}return null;};}function removeEntity(_0x272bb2,_0x3b17d7){return function(_0x1902d8){if(_0x1902d8){return _0x1902d8[_0x3c42('0x25')]()[_0x3c42('0x24')](function(){_0x272bb2[_0x3c42('0x1a')](0xcc)[_0x3c42('0x26')]();});}};}function handleEntityNotFound(_0x2d1f81,_0x5cca72){return function(_0x1a5cdf){if(!_0x1a5cdf){_0x2d1f81[_0x3c42('0x27')](0x194);}return _0x1a5cdf;};}function handleError(_0x19b4d0,_0x5482d4){_0x5482d4=_0x5482d4||0x1f4;return function(_0x46d96c){logger[_0x3c42('0x28')](_0x46d96c[_0x3c42('0x29')]);if(_0x46d96c[_0x3c42('0x2a')]){delete _0x46d96c['name'];}_0x19b4d0[_0x3c42('0x1a')](_0x5482d4)[_0x3c42('0x2b')](_0x46d96c);};}exports[_0x3c42('0x2c')]=function(_0x3d96a1,_0x21fc9b){var _0xf53177={'raw':!![],'where':{'id':_0x3d96a1[_0x3c42('0x2d')]['id']}},_0x54ff0d={};_0x54ff0d[_0x3c42('0x2e')]=_[_0x3c42('0x2f')](db['ChatApplication']['rawAttributes']);_0x54ff0d[_0x3c42('0x30')]=_[_0x3c42('0x2f')](_0x3d96a1[_0x3c42('0x30')]);_0x54ff0d[_0x3c42('0x31')]=_['intersection'](_0x54ff0d[_0x3c42('0x2e')],_0x54ff0d['query']);_0xf53177[_0x3c42('0x32')]=_[_0x3c42('0x33')](_0x54ff0d[_0x3c42('0x2e')],qs[_0x3c42('0x34')](_0x3d96a1[_0x3c42('0x30')][_0x3c42('0x34')]));_0xf53177[_0x3c42('0x32')]=_0xf53177[_0x3c42('0x32')]['length']?_0xf53177[_0x3c42('0x32')]:_0x54ff0d[_0x3c42('0x2e')];if(_0x3d96a1[_0x3c42('0x30')][_0x3c42('0x35')]){_0xf53177[_0x3c42('0x36')]=[{'all':!![]}];}_0xf53177=_['merge']({},_0xf53177,_0x3d96a1['options']);return db[_0x3c42('0x37')][_0x3c42('0x38')](_0xf53177)[_0x3c42('0x24')](handleEntityNotFound(_0x21fc9b,null))[_0x3c42('0x24')](respondWithResult(_0x21fc9b,null))['catch'](handleError(_0x21fc9b,null));};exports[_0x3c42('0x23')]=function(_0x1d8e8b,_0x5edcfb){if(_0x1d8e8b[_0x3c42('0x39')]['id']){delete _0x1d8e8b['body']['id'];}return db['ChatApplication'][_0x3c42('0x38')]({'where':{'id':_0x1d8e8b['params']['id']}})[_0x3c42('0x24')](handleEntityNotFound(_0x5edcfb,null))[_0x3c42('0x24')](saveUpdates(_0x1d8e8b['body'],null))[_0x3c42('0x24')](respondWithResult(_0x5edcfb,null))[_0x3c42('0x3a')](handleError(_0x5edcfb,null));};exports[_0x3c42('0x25')]=function(_0x4f0c87,_0x367f7a){return db['ChatApplication']['find']({'where':{'id':_0x4f0c87[_0x3c42('0x2d')]['id']}})[_0x3c42('0x24')](handleEntityNotFound(_0x367f7a,null))[_0x3c42('0x24')](removeEntity(_0x367f7a,null))['catch'](handleError(_0x367f7a,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 9436063..ba69861 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 _0xe148=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','ChatApplication','chat_applications'];(function(_0x7b330b,_0x5e3e0e){var _0x45cdde=function(_0x2b3a32){while(--_0x2b3a32){_0x7b330b['push'](_0x7b330b['shift']());}};_0x45cdde(++_0x5e3e0e);}(_0xe148,0x9e));var _0x8e14=function(_0xac56ce,_0xb73e4){_0xac56ce=_0xac56ce-0x0;var _0x5105e1=_0xe148[_0xac56ce];return _0x5105e1;};'use strict';var _=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var logger=require('../../config/logger')(_0x8e14('0x2'));var moment=require(_0x8e14('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e14('0x4'));var fs=require('fs');var path=require(_0x8e14('0x5'));var rimraf=require(_0x8e14('0x6'));var config=require(_0x8e14('0x7'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x33307e,_0x1f5039){return _0x33307e['define'](_0x8e14('0x8'),attributes,{'tableName':_0x8e14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8e14('0xa'),'collate':_0x8e14('0xb')});}; \ No newline at end of file +var _0x2123=['bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x2e229f,_0x4d58cd){var _0x4ab853=function(_0x1e22d9){while(--_0x1e22d9){_0x2e229f['push'](_0x2e229f['shift']());}};_0x4ab853(++_0x4d58cd);}(_0x2123,0x190));var _0x3212=function(_0x585576,_0x35b2cc){_0x585576=_0x585576-0x0;var _0x90fe7d=_0x2123[_0x585576];return _0x90fe7d;};'use strict';var _=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var logger=require(_0x3212('0x2'))(_0x3212('0x3'));var moment=require(_0x3212('0x4'));var BPromise=require(_0x3212('0x5'));var rp=require(_0x3212('0x6'));var fs=require('fs');var path=require(_0x3212('0x7'));var rimraf=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var attributes=require(_0x3212('0xa'));module[_0x3212('0xb')]=function(_0x5d9d36,_0x3859e4){return _0x5d9d36[_0x3212('0xc')](_0x3212('0xd'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3212('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 9acf1c1..7e4ce45 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 _0xe5c2=['debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x2ed467,_0x425395){var _0x183939=function(_0x32abe0){while(--_0x32abe0){_0x2ed467['push'](_0x2ed467['shift']());}};_0x183939(++_0x425395);}(_0xe5c2,0x104));var _0x2e5c=function(_0x1eb094,_0x15fd4c){_0x1eb094=_0x1eb094-0x0;var _0x4bc38a=_0xe5c2[_0x1eb094];return _0x4bc38a;};'use strict';var _=require('lodash');var util=require(_0x2e5c('0x0'));var moment=require(_0x2e5c('0x1'));var BPromise=require(_0x2e5c('0x2'));var rs=require(_0x2e5c('0x3'));var fs=require('fs');var Redis=require(_0x2e5c('0x4'));var db=require(_0x2e5c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e5c('0x6'))('rpc');var config=require(_0x2e5c('0x7'));var jayson=require(_0x2e5c('0x8'));var client=jayson['client'][_0x2e5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20e531,_0x189699,_0x4d9212){return new BPromise(function(_0x4d73f1,_0x216508){return client['request'](_0x20e531,_0x4d9212)[_0x2e5c('0xa')](function(_0x8fa4a0){logger[_0x2e5c('0xb')]('ChatApplication,\x20%s,\x20%s',_0x189699,_0x2e5c('0xc'));logger[_0x2e5c('0xd')](_0x2e5c('0xe'),_0x189699,_0x2e5c('0xc'),JSON[_0x2e5c('0xf')](_0x8fa4a0));if(_0x8fa4a0[_0x2e5c('0x10')]){if(_0x8fa4a0[_0x2e5c('0x10')]['code']===0x1f4){logger[_0x2e5c('0x10')](_0x2e5c('0x11'),_0x189699,_0x8fa4a0[_0x2e5c('0x10')]['message']);return _0x216508(_0x8fa4a0['error'][_0x2e5c('0x12')]);}logger['error'](_0x2e5c('0x11'),_0x189699,_0x8fa4a0[_0x2e5c('0x10')][_0x2e5c('0x12')]);return _0x4d73f1(_0x8fa4a0['error']['message']);}else{logger[_0x2e5c('0xb')](_0x2e5c('0x11'),_0x189699,'request\x20sent');_0x4d73f1(_0x8fa4a0[_0x2e5c('0x13')][_0x2e5c('0x12')]);}})[_0x2e5c('0x14')](function(_0x1daedf){logger[_0x2e5c('0x10')](_0x2e5c('0x11'),_0x189699,_0x1daedf);_0x216508(_0x1daedf);});});} \ No newline at end of file +var _0x3dc2=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','result'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x3dc2,0xb1));var _0x23dc=function(_0x50f737,_0x2a90fa){_0x50f737=_0x50f737-0x0;var _0x141dd8=_0x3dc2[_0x50f737];return _0x141dd8;};'use strict';var _=require(_0x23dc('0x0'));var util=require(_0x23dc('0x1'));var moment=require(_0x23dc('0x2'));var BPromise=require(_0x23dc('0x3'));var rs=require(_0x23dc('0x4'));var fs=require('fs');var Redis=require(_0x23dc('0x5'));var db=require(_0x23dc('0x6'))['db'];var utils=require(_0x23dc('0x7'));var logger=require(_0x23dc('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x23dc('0x9'));var client=jayson['client'][_0x23dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17cd00,_0x42c6eb,_0x85f7a){return new BPromise(function(_0x17a49d,_0x25ef9b){return client[_0x23dc('0xb')](_0x17cd00,_0x85f7a)['then'](function(_0x424f4f){logger[_0x23dc('0xc')]('ChatApplication,\x20%s,\x20%s',_0x42c6eb,_0x23dc('0xd'));logger[_0x23dc('0xe')](_0x23dc('0xf'),_0x42c6eb,_0x23dc('0xd'),JSON['stringify'](_0x424f4f));if(_0x424f4f[_0x23dc('0x10')]){if(_0x424f4f[_0x23dc('0x10')][_0x23dc('0x11')]===0x1f4){logger[_0x23dc('0x10')](_0x23dc('0x12'),_0x42c6eb,_0x424f4f[_0x23dc('0x10')]['message']);return _0x25ef9b(_0x424f4f['error'][_0x23dc('0x13')]);}logger[_0x23dc('0x10')](_0x23dc('0x12'),_0x42c6eb,_0x424f4f['error'][_0x23dc('0x13')]);return _0x17a49d(_0x424f4f[_0x23dc('0x10')][_0x23dc('0x13')]);}else{logger[_0x23dc('0xc')](_0x23dc('0x12'),_0x42c6eb,'request\x20sent');_0x17a49d(_0x424f4f[_0x23dc('0x14')][_0x23dc('0x13')]);}})[_0x23dc('0x15')](function(_0x55b5bc){logger[_0x23dc('0x10')](_0x23dc('0x12'),_0x42c6eb,_0x55b5bc);_0x25ef9b(_0x55b5bc);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 87d5ce3..66ac5fa 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 _0x8693=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','update','delete','/:id','exports','multer','util','path','connect-timeout'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x8693,0x68));var _0x3869=function(_0x2bcc88,_0x5d788c){_0x2bcc88=_0x2bcc88-0x0;var _0x3a4136=_0x8693[_0x2bcc88];return _0x3a4136;};'use strict';var multer=require(_0x3869('0x0'));var util=require(_0x3869('0x1'));var path=require(_0x3869('0x2'));var timeout=require(_0x3869('0x3'));var express=require(_0x3869('0x4'));var router=express[_0x3869('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3869('0x6'));var interaction=require(_0x3869('0x7'));var config=require(_0x3869('0x8'));var controller=require(_0x3869('0x9'));router[_0x3869('0xa')]('/:id',auth[_0x3869('0xb')](),controller[_0x3869('0xc')]);router[_0x3869('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3869('0xe')]);router[_0x3869('0xf')](_0x3869('0x10'),auth[_0x3869('0xb')](),controller['destroy']);module[_0x3869('0x11')]=router; \ No newline at end of file +var _0xd192=['get','/:id','isAuthenticated','show','put','update','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2a31ed,_0x507130){var _0x58e43e=function(_0x604732){while(--_0x604732){_0x2a31ed['push'](_0x2a31ed['shift']());}};_0x58e43e(++_0x507130);}(_0xd192,0x120));var _0x2d19=function(_0x179c8d,_0x5bb0a3){_0x179c8d=_0x179c8d-0x0;var _0x4377e8=_0xd192[_0x179c8d];return _0x4377e8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2d19('0x0'));var router=express[_0x2d19('0x1')]();var fs_extra=require(_0x2d19('0x2'));var auth=require(_0x2d19('0x3'));var interaction=require(_0x2d19('0x4'));var config=require(_0x2d19('0x5'));var controller=require('./chatApplication.controller');router[_0x2d19('0x6')](_0x2d19('0x7'),auth[_0x2d19('0x8')](),controller[_0x2d19('0x9')]);router[_0x2d19('0xa')](_0x2d19('0x7'),auth[_0x2d19('0x8')](),controller[_0x2d19('0xb')]);router['delete'](_0x2d19('0x7'),auth['isAuthenticated'](),controller[_0x2d19('0xc')]);module[_0x2d19('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 496cc71..53ae2a3 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 _0x4d87=['exports','STRING'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x4d87,0xf0));var _0x74d8=function(_0x11eb28,_0x13100e){_0x11eb28=_0x11eb28-0x0;var _0x3ae8a7=_0x4d87[_0x11eb28];return _0x3ae8a7;};'use strict';var Sequelize=require('sequelize');module[_0x74d8('0x0')]={'name':{'type':Sequelize[_0x74d8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x74d8('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x151b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x54b9c5,_0x28c1bd){var _0x31c599=function(_0x100311){while(--_0x100311){_0x54b9c5['push'](_0x54b9c5['shift']());}};_0x31c599(++_0x28c1bd);}(_0x151b,0x152));var _0xb151=function(_0x37317b,_0x5d98a7){_0x37317b=_0x37317b-0x0;var _0x4507d3=_0x151b[_0x37317b];return _0x4507d3;};'use strict';var Sequelize=require(_0xb151('0x0'));module[_0xb151('0x1')]={'name':{'type':Sequelize[_0xb151('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb151('0x2')]},'write':{'type':Sequelize[_0xb151('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 5e8018e..aaf5b58 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 _0x228e=['getMembers','removeMembers','addMessage','ChatGroupId','getMessages','order','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','offset','limit','set','Content-Range','json','reject','update','end','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','count','then','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','body','getUnread','ChatInternalMessage','user','addMembers','ids','omit','findOne','User','pick'];(function(_0x211b6c,_0x5214b4){var _0x1a8546=function(_0x2474a5){while(--_0x2474a5){_0x211b6c['push'](_0x211b6c['shift']());}};_0x1a8546(++_0x5214b4);}(_0x228e,0x121));var _0xe228=function(_0x1772ec,_0x16052e){_0x1772ec=_0x1772ec-0x0;var _0x4387c4=_0x228e[_0x1772ec];return _0x4387c4;};'use strict';var emlformat=require(_0xe228('0x0'));var rimraf=require(_0xe228('0x1'));var zipdir=require(_0xe228('0x2'));var jsonpatch=require(_0xe228('0x3'));var rp=require(_0xe228('0x4'));var moment=require(_0xe228('0x5'));var BPromise=require(_0xe228('0x6'));var Mustache=require('mustache');var util=require(_0xe228('0x7'));var path=require('path');var sox=require(_0xe228('0x8'));var csv=require(_0xe228('0x9'));var ejs=require(_0xe228('0xa'));var fs=require('fs');var fs_extra=require(_0xe228('0xb'));var _=require(_0xe228('0xc'));var squel=require(_0xe228('0xd'));var crypto=require('crypto');var jsforce=require(_0xe228('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe228('0x9'));var querystring=require(_0xe228('0xf'));var Papa=require(_0xe228('0x10'));var Redis=require(_0xe228('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe228('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe228('0x13'))(_0xe228('0x14'));var utils=require(_0xe228('0x15'));var config=require(_0xe228('0x16'));var licenseUtil=require(_0xe228('0x17'));var db=require(_0xe228('0x18'))['db'];config[_0xe228('0x19')]=_[_0xe228('0x1a')](config[_0xe228('0x19')],{'host':_0xe228('0x1b'),'port':0x18eb});var socket=require(_0xe228('0x1c'))(new Redis(config[_0xe228('0x19')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x34c416,_0x35ba52){_0x35ba52=_0x35ba52||0xcc;return function(_0x1fb1e3){if(_0x1fb1e3){return _0x34c416['sendStatus'](_0x35ba52);}return _0x34c416[_0xe228('0x1d')](_0x35ba52)['end']();};}function respondWithResult(_0x344acd,_0x369307){_0x369307=_0x369307||0xc8;return function(_0x1b0602){if(_0x1b0602){return _0x344acd['status'](_0x369307)['json'](_0x1b0602);}};}function respondWithFilteredResult(_0x4cd429,_0x4c1ab1){return function(_0x3eeb2c){if(_0x3eeb2c){var _0x5d55a1=typeof _0x4c1ab1[_0xe228('0x1e')]==='undefined'&&typeof _0x4c1ab1[_0xe228('0x1f')]==='undefined';var _0x2b8601=_0x3eeb2c['count'];var _0x2d8ac7=_0x5d55a1?0x0:_0x4c1ab1[_0xe228('0x1e')];var _0x316317=_0x5d55a1?_0x3eeb2c['count']:_0x4c1ab1[_0xe228('0x1e')]+_0x4c1ab1[_0xe228('0x1f')];var _0x279510;if(_0x316317>=_0x2b8601){_0x316317=_0x2b8601;_0x279510=0xc8;}else{_0x279510=0xce;}_0x4cd429[_0xe228('0x1d')](_0x279510);return _0x4cd429[_0xe228('0x20')](_0xe228('0x21'),_0x2d8ac7+'-'+_0x316317+'/'+_0x2b8601)[_0xe228('0x22')](_0x3eeb2c);}return null;};}function patchUpdates(_0x5ebe85){return function(_0x3ec14d){try{jsonpatch['apply'](_0x3ec14d,_0x5ebe85,!![]);}catch(_0x48e220){return BPromise[_0xe228('0x23')](_0x48e220);}return _0x3ec14d['save']();};}function saveUpdates(_0x3bf34e,_0x59f2fc){return function(_0x4a43c7){if(_0x4a43c7){return _0x4a43c7[_0xe228('0x24')](_0x3bf34e)['then'](function(_0x3ec139){return _0x3ec139;});}return null;};}function removeEntity(_0x5d1e78,_0x1b0465){return function(_0x2ae51a){if(_0x2ae51a){return _0x2ae51a['destroy']()['then'](function(){_0x5d1e78[_0xe228('0x1d')](0xcc)[_0xe228('0x25')]();});}};}function handleEntityNotFound(_0x168f00,_0x4b1359){return function(_0x520328){if(!_0x520328){_0x168f00['sendStatus'](0x194);}return _0x520328;};}function handleError(_0x1f0f71,_0x5691ab){_0x5691ab=_0x5691ab||0x1f4;return function(_0x405e6f){logger['error'](_0x405e6f[_0xe228('0x26')]);if(_0x405e6f[_0xe228('0x27')]){delete _0x405e6f['name'];}_0x1f0f71['status'](_0x5691ab)[_0xe228('0x28')](_0x405e6f);};}exports[_0xe228('0x29')]=function(_0x5a08b9,_0x236c3a){var _0x5ae98b={},_0x2bad7c={},_0x2fa12e={'count':0x0,'rows':[]};var _0x4e7d34=_[_0xe228('0x2a')](db[_0xe228('0x2b')][_0xe228('0x2c')],function(_0x2249c8){return{'name':_0x2249c8['fieldName'],'type':_0x2249c8[_0xe228('0x2d')][_0xe228('0x2e')]};});_0x2bad7c['model']=_[_0xe228('0x2a')](_0x4e7d34,_0xe228('0x27'));_0x2bad7c[_0xe228('0x2f')]=_['keys'](_0x5a08b9[_0xe228('0x2f')]);_0x2bad7c['filters']=_[_0xe228('0x30')](_0x2bad7c['model'],_0x2bad7c[_0xe228('0x2f')]);_0x5ae98b[_0xe228('0x31')]=_[_0xe228('0x30')](_0x2bad7c[_0xe228('0x32')],qs[_0xe228('0x33')](_0x5a08b9[_0xe228('0x2f')][_0xe228('0x33')]));_0x5ae98b[_0xe228('0x31')]=_0x5ae98b[_0xe228('0x31')][_0xe228('0x34')]?_0x5ae98b[_0xe228('0x31')]:_0x2bad7c[_0xe228('0x32')];if(!_0x5a08b9[_0xe228('0x2f')][_0xe228('0x35')](_0xe228('0x36'))){_0x5ae98b[_0xe228('0x1f')]=qs[_0xe228('0x1f')](_0x5a08b9[_0xe228('0x2f')][_0xe228('0x1f')]);_0x5ae98b[_0xe228('0x1e')]=qs[_0xe228('0x1e')](_0x5a08b9['query'][_0xe228('0x1e')]);}_0x5ae98b['order']=qs[_0xe228('0x37')](_0x5a08b9[_0xe228('0x2f')][_0xe228('0x37')]);_0x5ae98b[_0xe228('0x38')]=qs[_0xe228('0x39')](_['pick'](_0x5a08b9[_0xe228('0x2f')],_0x2bad7c[_0xe228('0x39')]),_0x4e7d34);if(_0x5a08b9[_0xe228('0x2f')][_0xe228('0x3a')]){_0x5ae98b[_0xe228('0x38')]=_[_0xe228('0x3b')](_0x5ae98b[_0xe228('0x38')],{'$or':_['map'](_0x4e7d34,function(_0x3d14c9){if(_0x3d14c9[_0xe228('0x2d')]!=='VIRTUAL'){var _0x9e838c={};_0x9e838c[_0x3d14c9[_0xe228('0x27')]]={'$like':'%'+_0x5a08b9['query'][_0xe228('0x3a')]+'%'};return _0x9e838c;}})});}_0x5ae98b=_[_0xe228('0x3b')]({},_0x5ae98b,_0x5a08b9['options']);var _0x5dd4a0={'where':_0x5ae98b[_0xe228('0x38')]};return db[_0xe228('0x2b')][_0xe228('0x3c')](_0x5dd4a0)[_0xe228('0x3d')](function(_0x29e6ac){_0x2fa12e[_0xe228('0x3c')]=_0x29e6ac;if(_0x5a08b9[_0xe228('0x2f')][_0xe228('0x3e')]){_0x5ae98b['include']=[{'all':!![]}];}return db[_0xe228('0x2b')][_0xe228('0x3f')](_0x5ae98b);})['then'](function(_0x1791a7){_0x2fa12e[_0xe228('0x40')]=_0x1791a7;return _0x2fa12e;})[_0xe228('0x3d')](respondWithFilteredResult(_0x236c3a,_0x5ae98b))[_0xe228('0x41')](handleError(_0x236c3a,null));};exports[_0xe228('0x42')]=function(_0x529cc9,_0x599a5c){var _0x198199={'raw':!![],'where':{'id':_0x529cc9[_0xe228('0x43')]['id']}},_0x3e5cd0={};_0x3e5cd0['model']=_[_0xe228('0x44')](db[_0xe228('0x2b')][_0xe228('0x2c')]);_0x3e5cd0[_0xe228('0x2f')]=_[_0xe228('0x44')](_0x529cc9[_0xe228('0x2f')]);_0x3e5cd0[_0xe228('0x39')]=_[_0xe228('0x30')](_0x3e5cd0[_0xe228('0x32')],_0x3e5cd0[_0xe228('0x2f')]);_0x198199[_0xe228('0x31')]=_[_0xe228('0x30')](_0x3e5cd0[_0xe228('0x32')],qs[_0xe228('0x33')](_0x529cc9['query'][_0xe228('0x33')]));_0x198199[_0xe228('0x31')]=_0x198199[_0xe228('0x31')][_0xe228('0x34')]?_0x198199[_0xe228('0x31')]:_0x3e5cd0[_0xe228('0x32')];if(_0x529cc9[_0xe228('0x2f')][_0xe228('0x3e')]){_0x198199[_0xe228('0x45')]=[{'all':!![]}];}_0x198199=_[_0xe228('0x3b')]({},_0x198199,_0x529cc9[_0xe228('0x46')]);return db['ChatGroup'][_0xe228('0x47')](_0x198199)[_0xe228('0x3d')](handleEntityNotFound(_0x599a5c,null))[_0xe228('0x3d')](respondWithResult(_0x599a5c,null))[_0xe228('0x41')](handleError(_0x599a5c,null));};exports[_0xe228('0x48')]=function(_0x287d66,_0x3e059d){return db[_0xe228('0x2b')][_0xe228('0x48')](_0x287d66[_0xe228('0x49')],{})[_0xe228('0x3d')](respondWithResult(_0x3e059d,0xc9))[_0xe228('0x41')](handleError(_0x3e059d,null));};exports[_0xe228('0x24')]=function(_0x2098dd,_0x68fe86){if(_0x2098dd[_0xe228('0x49')]['id']){delete _0x2098dd['body']['id'];}return db[_0xe228('0x2b')][_0xe228('0x47')]({'where':{'id':_0x2098dd[_0xe228('0x43')]['id']}})[_0xe228('0x3d')](handleEntityNotFound(_0x68fe86,null))[_0xe228('0x3d')](saveUpdates(_0x2098dd['body'],null))[_0xe228('0x3d')](respondWithResult(_0x68fe86,null))[_0xe228('0x41')](handleError(_0x68fe86,null));};exports['destroy']=function(_0x75fa7e,_0x2d00e4){return db[_0xe228('0x2b')]['find']({'where':{'id':_0x75fa7e['params']['id']}})['then'](handleEntityNotFound(_0x2d00e4,null))['then'](removeEntity(_0x2d00e4,null))[_0xe228('0x41')](handleError(_0x2d00e4,null));};exports['describe']=function(_0x41c50c,_0x3f3c7e){return db['ChatGroup']['describe']()[_0xe228('0x3d')](respondWithResult(_0x3f3c7e,null))[_0xe228('0x41')](handleError(_0x3f3c7e,null));};exports[_0xe228('0x4a')]=function(_0x538e8f,_0x507081,_0x1957f5){return db[_0xe228('0x4b')][_0xe228('0x3c')]({'where':{'ChatGroupId':_0x538e8f[_0xe228('0x43')]['id'],'ToId':_0x538e8f[_0xe228('0x4c')]['id'],'read':![]}})[_0xe228('0x3d')](function(_0x32a3cf){return{'id':_['toInteger'](_0x538e8f[_0xe228('0x43')]['id']),'count':_0x32a3cf};})['then'](respondWithResult(_0x507081,null))['catch'](handleError(_0x507081,null));};exports[_0xe228('0x4d')]=function(_0x482360,_0x4a3c14,_0x298b00){return db[_0xe228('0x2b')][_0xe228('0x47')]({'where':{'id':_0x482360[_0xe228('0x43')]['id']}})[_0xe228('0x3d')](handleEntityNotFound(_0x4a3c14,null))[_0xe228('0x3d')](function(_0x2af37d){if(_0x2af37d){return _0x2af37d[_0xe228('0x4d')](_0x482360[_0xe228('0x49')][_0xe228('0x4e')],_[_0xe228('0x4f')](_0x482360[_0xe228('0x49')],['ids','id'])||{});}})[_0xe228('0x3d')](respondWithResult(_0x4a3c14,null))['catch'](handleError(_0x4a3c14,null));};exports['getMembers']=function(_0x44c506,_0x3003fb,_0x58827c){var _0x3db44c={};var _0x3f3d79={};var _0x153a11;var _0x37a10b;return db[_0xe228('0x2b')][_0xe228('0x50')]({'where':{'id':_0x44c506[_0xe228('0x43')]['id']}})[_0xe228('0x3d')](handleEntityNotFound(_0x3003fb,null))[_0xe228('0x3d')](function(_0x2be49c){if(_0x2be49c){_0x153a11=_0x2be49c;_0x3f3d79[_0xe228('0x32')]=_['keys'](db[_0xe228('0x51')]['rawAttributes']);_0x3f3d79[_0xe228('0x2f')]=_[_0xe228('0x44')](_0x44c506[_0xe228('0x2f')]);_0x3f3d79['filters']=_['intersection'](_0x3f3d79['model'],_0x3f3d79[_0xe228('0x2f')]);_0x3db44c[_0xe228('0x31')]=_[_0xe228('0x30')](_0x3f3d79[_0xe228('0x32')],qs[_0xe228('0x33')](_0x44c506[_0xe228('0x2f')][_0xe228('0x33')]));_0x3db44c[_0xe228('0x31')]=_0x3db44c[_0xe228('0x31')][_0xe228('0x34')]?_0x3db44c['attributes']:_0x3f3d79[_0xe228('0x32')];_0x3db44c['order']=qs[_0xe228('0x37')](_0x44c506['query'][_0xe228('0x37')]);_0x3db44c['where']=qs[_0xe228('0x39')](_[_0xe228('0x52')](_0x44c506[_0xe228('0x2f')],_0x3f3d79[_0xe228('0x39')]));if(_0x44c506[_0xe228('0x2f')][_0xe228('0x3a')]){_0x3db44c[_0xe228('0x38')]=_[_0xe228('0x3b')](_0x3db44c[_0xe228('0x38')],{'$or':_[_0xe228('0x2a')](_0x3db44c[_0xe228('0x31')],function(_0x4b4744){var _0x1c8db1={};_0x1c8db1[_0x4b4744]={'$like':'%'+_0x44c506['query'][_0xe228('0x3a')]+'%'};return _0x1c8db1;})});}_0x3db44c=_[_0xe228('0x3b')]({},_0x3db44c,_0x44c506[_0xe228('0x46')]);return _0x153a11[_0xe228('0x53')](_0x3db44c);}})['then'](function(_0x6a971b){if(_0x6a971b){_0x37a10b=_0x6a971b[_0xe228('0x34')];if(!_0x44c506[_0xe228('0x2f')][_0xe228('0x35')](_0xe228('0x36'))){_0x3db44c[_0xe228('0x1f')]=qs[_0xe228('0x1f')](_0x44c506['query'][_0xe228('0x1f')]);_0x3db44c[_0xe228('0x1e')]=qs[_0xe228('0x1e')](_0x44c506[_0xe228('0x2f')]['offset']);}return _0x153a11[_0xe228('0x53')](_0x3db44c);}})[_0xe228('0x3d')](function(_0x47cf9b){if(_0x47cf9b){return _0x47cf9b?{'count':_0x37a10b,'rows':_0x47cf9b}:null;}})[_0xe228('0x3d')](respondWithResult(_0x3003fb,null))[_0xe228('0x41')](handleError(_0x3003fb,null));};exports[_0xe228('0x54')]=function(_0x98eb1e,_0x303f8a,_0x1a86bd){return db['ChatGroup'][_0xe228('0x47')]({'where':{'id':_0x98eb1e[_0xe228('0x43')]['id']}})[_0xe228('0x3d')](handleEntityNotFound(_0x303f8a,null))['then'](function(_0x218ac5){if(_0x218ac5){return _0x218ac5[_0xe228('0x54')](_0x98eb1e['query'][_0xe228('0x4e')]);}})[_0xe228('0x3d')](respondWithStatusCode(_0x303f8a,null))[_0xe228('0x41')](handleError(_0x303f8a,null));};exports[_0xe228('0x55')]=function(_0x37f8c5,_0x138c24,_0x165097){if(_0x37f8c5[_0xe228('0x49')]['id']){delete _0x37f8c5[_0xe228('0x49')]['id'];}return db[_0xe228('0x2b')][_0xe228('0x47')]({'where':{'id':_0x37f8c5[_0xe228('0x43')]['id']}})['then'](handleEntityNotFound(_0x138c24,null))[_0xe228('0x3d')](function(_0xde597){if(_0xde597){_0x37f8c5[_0xe228('0x49')][_0xe228('0x56')]=_0xde597['id'];return db['ChatInternalMessage'][_0xe228('0x48')](_0x37f8c5[_0xe228('0x49')]);}})[_0xe228('0x3d')](respondWithResult(_0x138c24,null))[_0xe228('0x41')](handleError(_0x138c24,null));};exports[_0xe228('0x57')]=function(_0x49bb41,_0xdf2140,_0x228c56){var _0xfa715e={};var _0xd9d6c5={};var _0x395b53;var _0x84f6a8;return db['ChatGroup'][_0xe228('0x50')]({'where':{'id':_0x49bb41[_0xe228('0x43')]['id']}})[_0xe228('0x3d')](handleEntityNotFound(_0xdf2140,null))[_0xe228('0x3d')](function(_0x201c1f){if(_0x201c1f){_0x395b53=_0x201c1f;_0xd9d6c5[_0xe228('0x32')]=_[_0xe228('0x44')](db[_0xe228('0x4b')][_0xe228('0x2c')]);_0xd9d6c5['query']=_[_0xe228('0x44')](_0x49bb41['query']);_0xd9d6c5['filters']=_[_0xe228('0x30')](_0xd9d6c5['model'],_0xd9d6c5[_0xe228('0x2f')]);_0xfa715e['attributes']=_[_0xe228('0x30')](_0xd9d6c5['model'],qs[_0xe228('0x33')](_0x49bb41[_0xe228('0x2f')][_0xe228('0x33')]));_0xfa715e[_0xe228('0x31')]=_0xfa715e[_0xe228('0x31')][_0xe228('0x34')]?_0xfa715e[_0xe228('0x31')]:_0xd9d6c5['model'];_0xfa715e[_0xe228('0x58')]=qs['sort'](_0x49bb41['query']['sort']);_0xfa715e[_0xe228('0x38')]=qs[_0xe228('0x39')](_['pick'](_0x49bb41[_0xe228('0x2f')],_0xd9d6c5[_0xe228('0x39')]));if(_0x49bb41[_0xe228('0x2f')][_0xe228('0x3a')]){_0xfa715e[_0xe228('0x38')]=_[_0xe228('0x3b')](_0xfa715e['where'],{'$or':_[_0xe228('0x2a')](_0xfa715e[_0xe228('0x31')],function(_0x4e63ae){var _0x3ada76={};_0x3ada76[_0x4e63ae]={'$like':'%'+_0x49bb41[_0xe228('0x2f')][_0xe228('0x3a')]+'%'};return _0x3ada76;})});}if(_0x49bb41[_0xe228('0x2f')][_0xe228('0x59')]){var _0x1be664=_0x49bb41[_0xe228('0x2f')][_0xe228('0x59')][_0xe228('0x5a')](',');var _0x4bfb08={};_0x4bfb08[_0x1be664[0x0]]={'$gte':moment(_0x1be664[0x1])[_0xe228('0x5b')](_0xe228('0x5c'))};_0xfa715e[_0xe228('0x38')]=_[_0xe228('0x3b')](_0xfa715e[_0xe228('0x38')],_0x4bfb08);}_0xfa715e=_[_0xe228('0x3b')]({},_0xfa715e,_0x49bb41[_0xe228('0x46')]);return _0x395b53['getMessages'](_0xfa715e);}})['then'](function(_0x40f73e){if(_0x40f73e){_0x84f6a8=_0x40f73e[_0xe228('0x34')];if(!_0x49bb41['query'][_0xe228('0x35')]('nolimit')){_0xfa715e[_0xe228('0x1f')]=qs[_0xe228('0x1f')](_0x49bb41[_0xe228('0x2f')]['limit']);_0xfa715e[_0xe228('0x1e')]=qs[_0xe228('0x1e')](_0x49bb41[_0xe228('0x2f')][_0xe228('0x1e')]);}return _0x395b53['getMessages'](_0xfa715e);}})[_0xe228('0x3d')](function(_0x33335f){if(_0x33335f){return _0x33335f?{'count':_0x84f6a8,'rows':_0x33335f}:null;}})['then'](respondWithResult(_0xdf2140,null))['catch'](handleError(_0xdf2140,null));}; \ No newline at end of file +var _0x0fd2=['fieldName','type','key','query','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','order','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','eml-format','rimraf','fast-json-patch','moment','util','path','sox','fs-extra','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','name','send','map','ChatGroup','rawAttributes'];(function(_0x3ad33a,_0x123932){var _0x4799b6=function(_0x284163){while(--_0x284163){_0x3ad33a['push'](_0x3ad33a['shift']());}};_0x4799b6(++_0x123932);}(_0x0fd2,0x144));var _0x20fd=function(_0x3a5053,_0x548f4d){_0x3a5053=_0x3a5053-0x0;var _0x282050=_0x0fd2[_0x3a5053];return _0x282050;};'use strict';var emlformat=require(_0x20fd('0x0'));var rimraf=require(_0x20fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20fd('0x2'));var rp=require('request-promise');var moment=require(_0x20fd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x20fd('0x4'));var path=require(_0x20fd('0x5'));var sox=require(_0x20fd('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20fd('0x7'));var _=require('lodash');var squel=require(_0x20fd('0x8'));var crypto=require('crypto');var jsforce=require(_0x20fd('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x20fd('0xa'));var Papa=require(_0x20fd('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x20fd('0xc'));var as=require(_0x20fd('0xd'));var hardwareService=require(_0x20fd('0xe'));var logger=require(_0x20fd('0xf'))(_0x20fd('0x10'));var utils=require(_0x20fd('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x20fd('0x12')]=_[_0x20fd('0x13')](config['redis'],{'host':_0x20fd('0x14'),'port':0x18eb});var socket=require(_0x20fd('0x15'))(new Redis(config['redis']));require(_0x20fd('0x16'))[_0x20fd('0x17')](socket);function respondWithStatusCode(_0x72ef21,_0x467b64){_0x467b64=_0x467b64||0xcc;return function(_0x186644){if(_0x186644){return _0x72ef21[_0x20fd('0x18')](_0x467b64);}return _0x72ef21[_0x20fd('0x19')](_0x467b64)[_0x20fd('0x1a')]();};}function respondWithResult(_0x7d7049,_0x21b7ff){_0x21b7ff=_0x21b7ff||0xc8;return function(_0x1bd2cc){if(_0x1bd2cc){return _0x7d7049[_0x20fd('0x19')](_0x21b7ff)['json'](_0x1bd2cc);}};}function respondWithFilteredResult(_0xd69fe6,_0x5b7edc){return function(_0x25143f){if(_0x25143f){var _0x2306de=typeof _0x5b7edc[_0x20fd('0x1b')]===_0x20fd('0x1c')&&typeof _0x5b7edc[_0x20fd('0x1d')]===_0x20fd('0x1c');var _0x2c764f=_0x25143f[_0x20fd('0x1e')];var _0x50f2ee=_0x2306de?0x0:_0x5b7edc[_0x20fd('0x1b')];var _0x18bcec=_0x2306de?_0x25143f['count']:_0x5b7edc[_0x20fd('0x1b')]+_0x5b7edc[_0x20fd('0x1d')];var _0x42cf31;if(_0x18bcec>=_0x2c764f){_0x18bcec=_0x2c764f;_0x42cf31=0xc8;}else{_0x42cf31=0xce;}_0xd69fe6[_0x20fd('0x19')](_0x42cf31);return _0xd69fe6[_0x20fd('0x1f')](_0x20fd('0x20'),_0x50f2ee+'-'+_0x18bcec+'/'+_0x2c764f)[_0x20fd('0x21')](_0x25143f);}return null;};}function patchUpdates(_0x3fb989){return function(_0x2abb64){try{jsonpatch[_0x20fd('0x22')](_0x2abb64,_0x3fb989,!![]);}catch(_0x4cd0ca){return BPromise[_0x20fd('0x23')](_0x4cd0ca);}return _0x2abb64['save']();};}function saveUpdates(_0x14c7cc,_0x21cb46){return function(_0x32fe3b){if(_0x32fe3b){return _0x32fe3b[_0x20fd('0x24')](_0x14c7cc)[_0x20fd('0x25')](function(_0x5cdca9){return _0x5cdca9;});}return null;};}function removeEntity(_0x52170f,_0x44e26e){return function(_0x5e8081){if(_0x5e8081){return _0x5e8081[_0x20fd('0x26')]()[_0x20fd('0x25')](function(){_0x52170f[_0x20fd('0x19')](0xcc)[_0x20fd('0x1a')]();});}};}function handleEntityNotFound(_0x5f677d,_0x517d9d){return function(_0x156faa){if(!_0x156faa){_0x5f677d[_0x20fd('0x18')](0x194);}return _0x156faa;};}function handleError(_0xdca00b,_0x3283de){_0x3283de=_0x3283de||0x1f4;return function(_0x3de51b){logger['error'](_0x3de51b['stack']);if(_0x3de51b[_0x20fd('0x27')]){delete _0x3de51b[_0x20fd('0x27')];}_0xdca00b['status'](_0x3283de)[_0x20fd('0x28')](_0x3de51b);};}exports['index']=function(_0x3d8cbe,_0x430a95){var _0x1efe83={},_0x125561={},_0x55c3e2={'count':0x0,'rows':[]};var _0x594aa6=_[_0x20fd('0x29')](db[_0x20fd('0x2a')][_0x20fd('0x2b')],function(_0x5894e0){return{'name':_0x5894e0[_0x20fd('0x2c')],'type':_0x5894e0[_0x20fd('0x2d')][_0x20fd('0x2e')]};});_0x125561['model']=_[_0x20fd('0x29')](_0x594aa6,'name');_0x125561[_0x20fd('0x2f')]=_['keys'](_0x3d8cbe[_0x20fd('0x2f')]);_0x125561['filters']=_['intersection'](_0x125561['model'],_0x125561['query']);_0x1efe83['attributes']=_['intersection'](_0x125561[_0x20fd('0x30')],qs[_0x20fd('0x31')](_0x3d8cbe[_0x20fd('0x2f')]['fields']));_0x1efe83[_0x20fd('0x32')]=_0x1efe83[_0x20fd('0x32')][_0x20fd('0x33')]?_0x1efe83[_0x20fd('0x32')]:_0x125561[_0x20fd('0x30')];if(!_0x3d8cbe[_0x20fd('0x2f')][_0x20fd('0x34')](_0x20fd('0x35'))){_0x1efe83[_0x20fd('0x1d')]=qs[_0x20fd('0x1d')](_0x3d8cbe[_0x20fd('0x2f')]['limit']);_0x1efe83[_0x20fd('0x1b')]=qs[_0x20fd('0x1b')](_0x3d8cbe[_0x20fd('0x2f')]['offset']);}_0x1efe83['order']=qs[_0x20fd('0x36')](_0x3d8cbe[_0x20fd('0x2f')][_0x20fd('0x36')]);_0x1efe83[_0x20fd('0x37')]=qs[_0x20fd('0x38')](_[_0x20fd('0x39')](_0x3d8cbe[_0x20fd('0x2f')],_0x125561[_0x20fd('0x38')]),_0x594aa6);if(_0x3d8cbe[_0x20fd('0x2f')][_0x20fd('0x3a')]){_0x1efe83[_0x20fd('0x37')]=_[_0x20fd('0x3b')](_0x1efe83[_0x20fd('0x37')],{'$or':_[_0x20fd('0x29')](_0x594aa6,function(_0x131c03){if(_0x131c03[_0x20fd('0x2d')]!==_0x20fd('0x3c')){var _0x3464d0={};_0x3464d0[_0x131c03['name']]={'$like':'%'+_0x3d8cbe[_0x20fd('0x2f')][_0x20fd('0x3a')]+'%'};return _0x3464d0;}})});}_0x1efe83=_[_0x20fd('0x3b')]({},_0x1efe83,_0x3d8cbe['options']);var _0x10b6c4={'where':_0x1efe83[_0x20fd('0x37')]};return db[_0x20fd('0x2a')][_0x20fd('0x1e')](_0x10b6c4)[_0x20fd('0x25')](function(_0x393c89){_0x55c3e2[_0x20fd('0x1e')]=_0x393c89;if(_0x3d8cbe[_0x20fd('0x2f')][_0x20fd('0x3d')]){_0x1efe83[_0x20fd('0x3e')]=[{'all':!![]}];}return db[_0x20fd('0x2a')][_0x20fd('0x3f')](_0x1efe83);})[_0x20fd('0x25')](function(_0x3be0cf){_0x55c3e2[_0x20fd('0x40')]=_0x3be0cf;return _0x55c3e2;})[_0x20fd('0x25')](respondWithFilteredResult(_0x430a95,_0x1efe83))[_0x20fd('0x41')](handleError(_0x430a95,null));};exports[_0x20fd('0x42')]=function(_0x3aaed1,_0xc4b1c8){var _0x20a05e={'raw':!![],'where':{'id':_0x3aaed1[_0x20fd('0x43')]['id']}},_0x4f31a3={};_0x4f31a3[_0x20fd('0x30')]=_[_0x20fd('0x44')](db[_0x20fd('0x2a')][_0x20fd('0x2b')]);_0x4f31a3[_0x20fd('0x2f')]=_['keys'](_0x3aaed1[_0x20fd('0x2f')]);_0x4f31a3['filters']=_[_0x20fd('0x45')](_0x4f31a3['model'],_0x4f31a3[_0x20fd('0x2f')]);_0x20a05e[_0x20fd('0x32')]=_[_0x20fd('0x45')](_0x4f31a3[_0x20fd('0x30')],qs['fields'](_0x3aaed1[_0x20fd('0x2f')]['fields']));_0x20a05e[_0x20fd('0x32')]=_0x20a05e[_0x20fd('0x32')][_0x20fd('0x33')]?_0x20a05e[_0x20fd('0x32')]:_0x4f31a3[_0x20fd('0x30')];if(_0x3aaed1[_0x20fd('0x2f')][_0x20fd('0x3d')]){_0x20a05e[_0x20fd('0x3e')]=[{'all':!![]}];}_0x20a05e=_['merge']({},_0x20a05e,_0x3aaed1['options']);return db[_0x20fd('0x2a')][_0x20fd('0x46')](_0x20a05e)[_0x20fd('0x25')](handleEntityNotFound(_0xc4b1c8,null))[_0x20fd('0x25')](respondWithResult(_0xc4b1c8,null))['catch'](handleError(_0xc4b1c8,null));};exports['create']=function(_0x38bb4f,_0x46264b){return db['ChatGroup']['create'](_0x38bb4f['body'],{})[_0x20fd('0x25')](respondWithResult(_0x46264b,0xc9))['catch'](handleError(_0x46264b,null));};exports[_0x20fd('0x24')]=function(_0x500f4b,_0x50e917){if(_0x500f4b[_0x20fd('0x47')]['id']){delete _0x500f4b[_0x20fd('0x47')]['id'];}return db[_0x20fd('0x2a')]['find']({'where':{'id':_0x500f4b[_0x20fd('0x43')]['id']}})[_0x20fd('0x25')](handleEntityNotFound(_0x50e917,null))['then'](saveUpdates(_0x500f4b[_0x20fd('0x47')],null))[_0x20fd('0x25')](respondWithResult(_0x50e917,null))[_0x20fd('0x41')](handleError(_0x50e917,null));};exports[_0x20fd('0x26')]=function(_0x4d6521,_0x3b4b96){return db[_0x20fd('0x2a')]['find']({'where':{'id':_0x4d6521['params']['id']}})['then'](handleEntityNotFound(_0x3b4b96,null))[_0x20fd('0x25')](removeEntity(_0x3b4b96,null))[_0x20fd('0x41')](handleError(_0x3b4b96,null));};exports[_0x20fd('0x48')]=function(_0x108ad0,_0x51797a){return db[_0x20fd('0x2a')][_0x20fd('0x48')]()[_0x20fd('0x25')](respondWithResult(_0x51797a,null))[_0x20fd('0x41')](handleError(_0x51797a,null));};exports[_0x20fd('0x49')]=function(_0x49ef4d,_0x15000b,_0x343bba){return db[_0x20fd('0x4a')][_0x20fd('0x1e')]({'where':{'ChatGroupId':_0x49ef4d[_0x20fd('0x43')]['id'],'ToId':_0x49ef4d[_0x20fd('0x4b')]['id'],'read':![]}})[_0x20fd('0x25')](function(_0x2d5e46){return{'id':_[_0x20fd('0x4c')](_0x49ef4d[_0x20fd('0x43')]['id']),'count':_0x2d5e46};})[_0x20fd('0x25')](respondWithResult(_0x15000b,null))[_0x20fd('0x41')](handleError(_0x15000b,null));};exports['addMembers']=function(_0x5bcc5b,_0x16f93f,_0x226767){return db[_0x20fd('0x2a')]['find']({'where':{'id':_0x5bcc5b[_0x20fd('0x43')]['id']}})[_0x20fd('0x25')](handleEntityNotFound(_0x16f93f,null))[_0x20fd('0x25')](function(_0x2230b4){if(_0x2230b4){return _0x2230b4[_0x20fd('0x4d')](_0x5bcc5b[_0x20fd('0x47')]['ids'],_[_0x20fd('0x4e')](_0x5bcc5b[_0x20fd('0x47')],[_0x20fd('0x4f'),'id'])||{});}})[_0x20fd('0x25')](respondWithResult(_0x16f93f,null))[_0x20fd('0x41')](handleError(_0x16f93f,null));};exports[_0x20fd('0x50')]=function(_0x3b8c6e,_0x5ece60,_0x222e19){var _0x3b75a1={};var _0x24d8d2={};var _0x125c35;var _0x4430f7;return db[_0x20fd('0x2a')][_0x20fd('0x51')]({'where':{'id':_0x3b8c6e['params']['id']}})[_0x20fd('0x25')](handleEntityNotFound(_0x5ece60,null))[_0x20fd('0x25')](function(_0x37e211){if(_0x37e211){_0x125c35=_0x37e211;_0x24d8d2[_0x20fd('0x30')]=_[_0x20fd('0x44')](db[_0x20fd('0x52')][_0x20fd('0x2b')]);_0x24d8d2[_0x20fd('0x2f')]=_['keys'](_0x3b8c6e[_0x20fd('0x2f')]);_0x24d8d2[_0x20fd('0x38')]=_['intersection'](_0x24d8d2[_0x20fd('0x30')],_0x24d8d2[_0x20fd('0x2f')]);_0x3b75a1[_0x20fd('0x32')]=_['intersection'](_0x24d8d2[_0x20fd('0x30')],qs[_0x20fd('0x31')](_0x3b8c6e[_0x20fd('0x2f')][_0x20fd('0x31')]));_0x3b75a1[_0x20fd('0x32')]=_0x3b75a1[_0x20fd('0x32')][_0x20fd('0x33')]?_0x3b75a1[_0x20fd('0x32')]:_0x24d8d2[_0x20fd('0x30')];_0x3b75a1[_0x20fd('0x53')]=qs[_0x20fd('0x36')](_0x3b8c6e[_0x20fd('0x2f')]['sort']);_0x3b75a1[_0x20fd('0x37')]=qs[_0x20fd('0x38')](_[_0x20fd('0x39')](_0x3b8c6e[_0x20fd('0x2f')],_0x24d8d2[_0x20fd('0x38')]));if(_0x3b8c6e[_0x20fd('0x2f')]['filter']){_0x3b75a1[_0x20fd('0x37')]=_['merge'](_0x3b75a1[_0x20fd('0x37')],{'$or':_[_0x20fd('0x29')](_0x3b75a1[_0x20fd('0x32')],function(_0x37417d){var _0x58c556={};_0x58c556[_0x37417d]={'$like':'%'+_0x3b8c6e['query'][_0x20fd('0x3a')]+'%'};return _0x58c556;})});}_0x3b75a1=_['merge']({},_0x3b75a1,_0x3b8c6e['options']);return _0x125c35[_0x20fd('0x50')](_0x3b75a1);}})[_0x20fd('0x25')](function(_0x5498bb){if(_0x5498bb){_0x4430f7=_0x5498bb[_0x20fd('0x33')];if(!_0x3b8c6e[_0x20fd('0x2f')][_0x20fd('0x34')]('nolimit')){_0x3b75a1['limit']=qs[_0x20fd('0x1d')](_0x3b8c6e[_0x20fd('0x2f')][_0x20fd('0x1d')]);_0x3b75a1[_0x20fd('0x1b')]=qs[_0x20fd('0x1b')](_0x3b8c6e[_0x20fd('0x2f')]['offset']);}return _0x125c35[_0x20fd('0x50')](_0x3b75a1);}})[_0x20fd('0x25')](function(_0x4f8418){if(_0x4f8418){return _0x4f8418?{'count':_0x4430f7,'rows':_0x4f8418}:null;}})[_0x20fd('0x25')](respondWithResult(_0x5ece60,null))[_0x20fd('0x41')](handleError(_0x5ece60,null));};exports[_0x20fd('0x54')]=function(_0x33203c,_0x363a72,_0x2db3fe){return db[_0x20fd('0x2a')][_0x20fd('0x46')]({'where':{'id':_0x33203c['params']['id']}})['then'](handleEntityNotFound(_0x363a72,null))[_0x20fd('0x25')](function(_0x21da41){if(_0x21da41){return _0x21da41['removeMembers'](_0x33203c[_0x20fd('0x2f')][_0x20fd('0x4f')]);}})[_0x20fd('0x25')](respondWithStatusCode(_0x363a72,null))[_0x20fd('0x41')](handleError(_0x363a72,null));};exports['addMessage']=function(_0x1f1b0d,_0x295d99,_0x5ea843){if(_0x1f1b0d[_0x20fd('0x47')]['id']){delete _0x1f1b0d[_0x20fd('0x47')]['id'];}return db['ChatGroup'][_0x20fd('0x46')]({'where':{'id':_0x1f1b0d['params']['id']}})[_0x20fd('0x25')](handleEntityNotFound(_0x295d99,null))[_0x20fd('0x25')](function(_0x46a88a){if(_0x46a88a){_0x1f1b0d[_0x20fd('0x47')][_0x20fd('0x55')]=_0x46a88a['id'];return db[_0x20fd('0x4a')]['create'](_0x1f1b0d[_0x20fd('0x47')]);}})[_0x20fd('0x25')](respondWithResult(_0x295d99,null))['catch'](handleError(_0x295d99,null));};exports[_0x20fd('0x56')]=function(_0x3a620d,_0x1a74b5,_0x3845c5){var _0x3be654={};var _0x310bfa={};var _0x36bd4c;var _0x1336f1;return db['ChatGroup'][_0x20fd('0x51')]({'where':{'id':_0x3a620d[_0x20fd('0x43')]['id']}})[_0x20fd('0x25')](handleEntityNotFound(_0x1a74b5,null))[_0x20fd('0x25')](function(_0x25a358){if(_0x25a358){_0x36bd4c=_0x25a358;_0x310bfa[_0x20fd('0x30')]=_[_0x20fd('0x44')](db[_0x20fd('0x4a')][_0x20fd('0x2b')]);_0x310bfa[_0x20fd('0x2f')]=_[_0x20fd('0x44')](_0x3a620d[_0x20fd('0x2f')]);_0x310bfa[_0x20fd('0x38')]=_['intersection'](_0x310bfa[_0x20fd('0x30')],_0x310bfa[_0x20fd('0x2f')]);_0x3be654['attributes']=_[_0x20fd('0x45')](_0x310bfa[_0x20fd('0x30')],qs[_0x20fd('0x31')](_0x3a620d[_0x20fd('0x2f')][_0x20fd('0x31')]));_0x3be654[_0x20fd('0x32')]=_0x3be654['attributes'][_0x20fd('0x33')]?_0x3be654[_0x20fd('0x32')]:_0x310bfa[_0x20fd('0x30')];_0x3be654[_0x20fd('0x53')]=qs[_0x20fd('0x36')](_0x3a620d[_0x20fd('0x2f')]['sort']);_0x3be654['where']=qs[_0x20fd('0x38')](_[_0x20fd('0x39')](_0x3a620d[_0x20fd('0x2f')],_0x310bfa[_0x20fd('0x38')]));if(_0x3a620d[_0x20fd('0x2f')][_0x20fd('0x3a')]){_0x3be654['where']=_['merge'](_0x3be654[_0x20fd('0x37')],{'$or':_['map'](_0x3be654[_0x20fd('0x32')],function(_0x23f28d){var _0x8048af={};_0x8048af[_0x23f28d]={'$like':'%'+_0x3a620d[_0x20fd('0x2f')][_0x20fd('0x3a')]+'%'};return _0x8048af;})});}if(_0x3a620d['query']['$gte']){var _0x1468c3=_0x3a620d[_0x20fd('0x2f')][_0x20fd('0x57')][_0x20fd('0x58')](',');var _0x148ea0={};_0x148ea0[_0x1468c3[0x0]]={'$gte':moment(_0x1468c3[0x1])[_0x20fd('0x59')](_0x20fd('0x5a'))};_0x3be654[_0x20fd('0x37')]=_['merge'](_0x3be654['where'],_0x148ea0);}_0x3be654=_['merge']({},_0x3be654,_0x3a620d[_0x20fd('0x5b')]);return _0x36bd4c[_0x20fd('0x56')](_0x3be654);}})[_0x20fd('0x25')](function(_0xfd2f87){if(_0xfd2f87){_0x1336f1=_0xfd2f87[_0x20fd('0x33')];if(!_0x3a620d[_0x20fd('0x2f')][_0x20fd('0x34')](_0x20fd('0x35'))){_0x3be654['limit']=qs[_0x20fd('0x1d')](_0x3a620d[_0x20fd('0x2f')][_0x20fd('0x1d')]);_0x3be654[_0x20fd('0x1b')]=qs[_0x20fd('0x1b')](_0x3a620d[_0x20fd('0x2f')][_0x20fd('0x1b')]);}return _0x36bd4c[_0x20fd('0x56')](_0x3be654);}})['then'](function(_0x5f496d){if(_0x5f496d){return _0x5f496d?{'count':_0x1336f1,'rows':_0x5f496d}:null;}})['then'](respondWithResult(_0x1a74b5,null))[_0x20fd('0x41')](handleError(_0x1a74b5,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index cf5bbb2..77e5f50 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 _0x736c=['hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x54f3e8,_0x3ed493){var _0x267b37=function(_0x58247e){while(--_0x58247e){_0x54f3e8['push'](_0x54f3e8['shift']());}};_0x267b37(++_0x3ed493);}(_0x736c,0x190));var _0xc736=function(_0x11a7c9,_0x2de6e8){_0x11a7c9=_0x11a7c9-0x0;var _0x2bf3d8=_0x736c[_0x11a7c9];return _0x2bf3d8;};'use strict';var EventEmitter=require(_0xc736('0x0'));var ChatGroup=require(_0xc736('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc736('0x2')](0x0);var events={'afterCreate':_0xc736('0x3'),'afterUpdate':_0xc736('0x4'),'afterDestroy':_0xc736('0x5')};function emitEvent(_0x23f8c1){return function(_0x1a96b8,_0xb57164,_0x3f00f0){ChatGroupEvents['emit'](_0x23f8c1+':'+_0x1a96b8['id'],_0x1a96b8);ChatGroupEvents['emit'](_0x23f8c1,_0x1a96b8);_0x3f00f0(null);};}for(var e in events){if(events[_0xc736('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x13c8=['ChatGroup','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2303ff,_0x3c4b05){var _0x3983c8=function(_0x57085c){while(--_0x57085c){_0x2303ff['push'](_0x2303ff['shift']());}};_0x3983c8(++_0x3c4b05);}(_0x13c8,0xa0));var _0x813c=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0x13c8[_0x50e40b];return _0x2608b7;};'use strict';var EventEmitter=require(_0x813c('0x0'));var ChatGroup=require(_0x813c('0x1'))['db'][_0x813c('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x813c('0x3'),'afterDestroy':_0x813c('0x4')};function emitEvent(_0x193021){return function(_0x267c0b,_0x542451,_0x52f03f){ChatGroupEvents[_0x813c('0x5')](_0x193021+':'+_0x267c0b['id'],_0x267c0b);ChatGroupEvents[_0x813c('0x5')](_0x193021,_0x267c0b);_0x52f03f(null);};}for(var e in events){if(events[_0x813c('0x6')](e)){var event=events[e];ChatGroup[_0x813c('0x7')](e,emitEvent(event));}}module[_0x813c('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 849552d..15eaa36 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 _0xf3f4=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x4dfc30,_0x2f8ea3){var _0x4cabbe=function(_0xe9957c){while(--_0xe9957c){_0x4dfc30['push'](_0x4dfc30['shift']());}};_0x4cabbe(++_0x2f8ea3);}(_0xf3f4,0xed));var _0x4f3f=function(_0x24a782,_0x540835){_0x24a782=_0x24a782-0x0;var _0x5a1ac2=_0xf3f4[_0x24a782];return _0x5a1ac2;};'use strict';var _=require(_0x4f3f('0x0'));var util=require(_0x4f3f('0x1'));var logger=require(_0x4f3f('0x2'))(_0x4f3f('0x3'));var moment=require(_0x4f3f('0x4'));var BPromise=require(_0x4f3f('0x5'));var rp=require(_0x4f3f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f3f('0x7'));var config=require(_0x4f3f('0x8'));var attributes=require(_0x4f3f('0x9'));module[_0x4f3f('0xa')]=function(_0x339da9,_0x178cae){return _0x339da9[_0x4f3f('0xb')](_0x4f3f('0xc'),attributes,{'tableName':_0x4f3f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x429a=['api','moment','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','util','../../config/logger'];(function(_0x1b1355,_0x2db1ed){var _0x1f98e5=function(_0x46915c){while(--_0x46915c){_0x1b1355['push'](_0x1b1355['shift']());}};_0x1f98e5(++_0x2db1ed);}(_0x429a,0x11c));var _0xa429=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x429a[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require('lodash');var util=require(_0xa429('0x0'));var logger=require(_0xa429('0x1'))(_0xa429('0x2'));var moment=require(_0xa429('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa429('0x4'));var rimraf=require(_0xa429('0x5'));var config=require(_0xa429('0x6'));var attributes=require(_0xa429('0x7'));module['exports']=function(_0x349284,_0x5b0bca){return _0x349284[_0xa429('0x8')](_0xa429('0x9'),attributes,{'tableName':_0xa429('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 c1e0a56..97dfa53 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 _0x691a=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1a86a0,_0x642b14){var _0x3bb799=function(_0x4e331d){while(--_0x4e331d){_0x1a86a0['push'](_0x1a86a0['shift']());}};_0x3bb799(++_0x642b14);}(_0x691a,0x1df));var _0xa691=function(_0x32ae21,_0x1f6cc6){_0x32ae21=_0x32ae21-0x0;var _0x3ce1f7=_0x691a[_0x32ae21];return _0x3ce1f7;};'use strict';var _=require(_0xa691('0x0'));var util=require(_0xa691('0x1'));var moment=require(_0xa691('0x2'));var BPromise=require(_0xa691('0x3'));var rs=require(_0xa691('0x4'));var fs=require('fs');var Redis=require(_0xa691('0x5'));var db=require(_0xa691('0x6'))['db'];var utils=require(_0xa691('0x7'));var logger=require(_0xa691('0x8'))(_0xa691('0x9'));var config=require('../../config/environment');var jayson=require(_0xa691('0xa'));var client=jayson[_0xa691('0xb')]['http']({'port':0x232a});config[_0xa691('0xc')]=_['defaults'](config[_0xa691('0xc')],{'host':_0xa691('0xd'),'port':0x18eb});var socket=require(_0xa691('0xe'))(new Redis(config[_0xa691('0xc')]));require('./chatGroup.socket')[_0xa691('0xf')](socket);function respondWithRpcPromise(_0x3152dd,_0x843e99,_0x5058d2){return new BPromise(function(_0x457d80,_0x45556d){return client[_0xa691('0x10')](_0x3152dd,_0x5058d2)['then'](function(_0x17c404){logger['info'](_0xa691('0x11'),_0x843e99,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x843e99,_0xa691('0x12'),JSON[_0xa691('0x13')](_0x17c404));if(_0x17c404[_0xa691('0x14')]){if(_0x17c404[_0xa691('0x14')]['code']===0x1f4){logger[_0xa691('0x14')](_0xa691('0x11'),_0x843e99,_0x17c404[_0xa691('0x14')][_0xa691('0x15')]);return _0x45556d(_0x17c404['error'][_0xa691('0x15')]);}logger[_0xa691('0x14')]('ChatGroup,\x20%s,\x20%s',_0x843e99,_0x17c404[_0xa691('0x14')][_0xa691('0x15')]);return _0x457d80(_0x17c404[_0xa691('0x14')][_0xa691('0x15')]);}else{logger[_0xa691('0x16')](_0xa691('0x11'),_0x843e99,_0xa691('0x12'));_0x457d80(_0x17c404[_0xa691('0x17')][_0xa691('0x15')]);}})[_0xa691('0x18')](function(_0x1ab037){logger['error']('ChatGroup,\x20%s,\x20%s',_0x843e99,_0x1ab037);_0x45556d(_0x1ab037);});});} \ No newline at end of file +var _0x9c5b=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash'];(function(_0x2b5717,_0x4e06b9){var _0x5db8a3=function(_0x480509){while(--_0x480509){_0x2b5717['push'](_0x2b5717['shift']());}};_0x5db8a3(++_0x4e06b9);}(_0x9c5b,0x1cb));var _0xb9c5=function(_0x58a703,_0xef259b){_0x58a703=_0x58a703-0x0;var _0x597714=_0x9c5b[_0x58a703];return _0x597714;};'use strict';var _=require(_0xb9c5('0x0'));var util=require('util');var moment=require(_0xb9c5('0x1'));var BPromise=require('bluebird');var rs=require(_0xb9c5('0x2'));var fs=require('fs');var Redis=require(_0xb9c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9c5('0x4'));var logger=require(_0xb9c5('0x5'))(_0xb9c5('0x6'));var config=require(_0xb9c5('0x7'));var jayson=require(_0xb9c5('0x8'));var client=jayson['client'][_0xb9c5('0x9')]({'port':0x232a});config[_0xb9c5('0xa')]=_['defaults'](config[_0xb9c5('0xa')],{'host':_0xb9c5('0xb'),'port':0x18eb});var socket=require(_0xb9c5('0xc'))(new Redis(config['redis']));require(_0xb9c5('0xd'))['register'](socket);function respondWithRpcPromise(_0x543987,_0x25f973,_0x5107cf){return new BPromise(function(_0x4118df,_0x354f57){return client[_0xb9c5('0xe')](_0x543987,_0x5107cf)['then'](function(_0x380357){logger[_0xb9c5('0xf')](_0xb9c5('0x10'),_0x25f973,_0xb9c5('0x11'));logger[_0xb9c5('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x25f973,_0xb9c5('0x11'),JSON['stringify'](_0x380357));if(_0x380357[_0xb9c5('0x13')]){if(_0x380357[_0xb9c5('0x13')][_0xb9c5('0x14')]===0x1f4){logger[_0xb9c5('0x13')](_0xb9c5('0x10'),_0x25f973,_0x380357[_0xb9c5('0x13')]['message']);return _0x354f57(_0x380357[_0xb9c5('0x13')][_0xb9c5('0x15')]);}logger[_0xb9c5('0x13')](_0xb9c5('0x10'),_0x25f973,_0x380357[_0xb9c5('0x13')][_0xb9c5('0x15')]);return _0x4118df(_0x380357[_0xb9c5('0x13')]['message']);}else{logger[_0xb9c5('0xf')](_0xb9c5('0x10'),_0x25f973,_0xb9c5('0x11'));_0x4118df(_0x380357['result'][_0xb9c5('0x15')]);}})[_0xb9c5('0x16')](function(_0x3d8adf){logger[_0xb9c5('0x13')]('ChatGroup,\x20%s,\x20%s',_0x25f973,_0x3d8adf);_0x354f57(_0x3d8adf);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 4e966fe..8f7ef77 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 _0xfff2=['register','length','chatGroup:','save','remove','update','emit','removeListener'];(function(_0x16fef7,_0x2a39a8){var _0x415dea=function(_0x309a90){while(--_0x309a90){_0x16fef7['push'](_0x16fef7['shift']());}};_0x415dea(++_0x2a39a8);}(_0xfff2,0x9b));var _0x2fff=function(_0x268e8a,_0xab4b44){_0x268e8a=_0x268e8a-0x0;var _0x18e617=_0xfff2[_0x268e8a];return _0x18e617;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x2fff('0x0'),_0x2fff('0x1'),_0x2fff('0x2')];function createListener(_0x53d3da,_0x46b60b){return function(_0x3a6e08){_0x46b60b[_0x2fff('0x3')](_0x53d3da,_0x3a6e08);};}function removeListener(_0x327a2a,_0x485e43){return function(){ChatGroupEvents[_0x2fff('0x4')](_0x327a2a,_0x485e43);};}exports[_0x2fff('0x5')]=function(_0x237542){for(var _0x3bfa1f=0x0,_0x46f95e=events[_0x2fff('0x6')];_0x3bfa1f<_0x46f95e;_0x3bfa1f++){var _0x5264b6=events[_0x3bfa1f];var _0x354a3d=createListener(_0x2fff('0x7')+_0x5264b6,_0x237542);ChatGroupEvents['on'](_0x5264b6,_0x354a3d);}}; \ No newline at end of file +var _0x6dfb=['remove','emit','removeListener','register','length','./chatGroup.events','save'];(function(_0x4b9464,_0xc0b9cc){var _0x29dfdf=function(_0x705cce){while(--_0x705cce){_0x4b9464['push'](_0x4b9464['shift']());}};_0x29dfdf(++_0xc0b9cc);}(_0x6dfb,0xa6));var _0xb6df=function(_0x2ef1b8,_0x509ef3){_0x2ef1b8=_0x2ef1b8-0x0;var _0x59e2b6=_0x6dfb[_0x2ef1b8];return _0x59e2b6;};'use strict';var ChatGroupEvents=require(_0xb6df('0x0'));var events=[_0xb6df('0x1'),_0xb6df('0x2'),'update'];function createListener(_0x5eb4e1,_0x43e192){return function(_0x2e03af){_0x43e192[_0xb6df('0x3')](_0x5eb4e1,_0x2e03af);};}function removeListener(_0x1584c5,_0x14f45a){return function(){ChatGroupEvents[_0xb6df('0x4')](_0x1584c5,_0x14f45a);};}exports[_0xb6df('0x5')]=function(_0x2fd75a){for(var _0x64c134=0x0,_0x444d02=events[_0xb6df('0x6')];_0x64c134<_0x444d02;_0x64c134++){var _0x427221=events[_0x64c134];var _0x385ad8=createListener('chatGroup:'+_0x427221,_0x2fd75a);ChatGroupEvents['on'](_0x427221,_0x385ad8);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a6f4873..992ecea 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 _0x525f=['path','connect-timeout','express','Router','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/messages','post','create','/:id/members','addMembers','put','delete','removeMembers','exports','multer'];(function(_0x73fc3e,_0x29d104){var _0x37f65a=function(_0x24fc0d){while(--_0x24fc0d){_0x73fc3e['push'](_0x73fc3e['shift']());}};_0x37f65a(++_0x29d104);}(_0x525f,0x19d));var _0xf525=function(_0x2de03a,_0x2038f7){_0x2de03a=_0x2de03a-0x0;var _0x31f74d=_0x525f[_0x2de03a];return _0x31f74d;};'use strict';var multer=require(_0xf525('0x0'));var util=require('util');var path=require(_0xf525('0x1'));var timeout=require(_0xf525('0x2'));var express=require(_0xf525('0x3'));var router=express[_0xf525('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf525('0x5'));var config=require('../../config/environment');var controller=require(_0xf525('0x6'));router[_0xf525('0x7')]('/',auth[_0xf525('0x8')](),controller['index']);router[_0xf525('0x7')]('/describe',auth[_0xf525('0x8')](),controller[_0xf525('0x9')]);router[_0xf525('0x7')](_0xf525('0xa'),auth['isAuthenticated'](),controller[_0xf525('0xb')]);router[_0xf525('0x7')](_0xf525('0xc'),auth[_0xf525('0x8')](),controller[_0xf525('0xd')]);router[_0xf525('0x7')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xf525('0x7')](_0xf525('0xe'),auth[_0xf525('0x8')](),controller['getMessages']);router[_0xf525('0xf')]('/',auth['isAuthenticated'](),controller[_0xf525('0x10')]);router[_0xf525('0xf')](_0xf525('0x11'),auth[_0xf525('0x8')](),controller[_0xf525('0x12')]);router[_0xf525('0xf')](_0xf525('0xe'),auth[_0xf525('0x8')](),controller['addMessage']);router[_0xf525('0x13')](_0xf525('0xa'),auth[_0xf525('0x8')](),controller['update']);router[_0xf525('0x14')](_0xf525('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xf525('0x14')](_0xf525('0x11'),auth[_0xf525('0x8')](),controller[_0xf525('0x15')]);module[_0xf525('0x16')]=router; \ No newline at end of file +var _0x881f=['../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','addMembers','addMessage','put','update','delete','removeMembers','exports','multer','Router','fs-extra','../../components/auth/service'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0x881f,0x15a));var _0xf881=function(_0x3dec16,_0x1eb623){_0x3dec16=_0x3dec16-0x0;var _0xec31c3=_0x881f[_0x3dec16];return _0xec31c3;};'use strict';var multer=require(_0xf881('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf881('0x1')]();var fs_extra=require(_0xf881('0x2'));var auth=require(_0xf881('0x3'));var interaction=require(_0xf881('0x4'));var config=require(_0xf881('0x5'));var controller=require(_0xf881('0x6'));router[_0xf881('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf881('0x7')](_0xf881('0x8'),auth[_0xf881('0x9')](),controller['describe']);router[_0xf881('0x7')](_0xf881('0xa'),auth[_0xf881('0x9')](),controller[_0xf881('0xb')]);router[_0xf881('0x7')](_0xf881('0xc'),auth[_0xf881('0x9')](),controller[_0xf881('0xd')]);router['get'](_0xf881('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xf881('0x7')](_0xf881('0xf'),auth[_0xf881('0x9')](),controller[_0xf881('0x10')]);router[_0xf881('0x11')]('/',auth[_0xf881('0x9')](),controller['create']);router[_0xf881('0x11')](_0xf881('0xe'),auth[_0xf881('0x9')](),controller[_0xf881('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xf881('0x13')]);router[_0xf881('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf881('0x15')]);router[_0xf881('0x16')](_0xf881('0xa'),auth[_0xf881('0x9')](),controller['destroy']);router[_0xf881('0x16')]('/:id/members',auth[_0xf881('0x9')](),controller[_0xf881('0x17')]);module[_0xf881('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 566868b..f4bbd6c 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 _0xc2da=['long','out','sequelize','BOOLEAN','ENUM','thumb','star','TEXT','STRING','DATE'];(function(_0x5c9c9,_0x38e3fe){var _0x1381b9=function(_0x63adf7){while(--_0x63adf7){_0x5c9c9['push'](_0x5c9c9['shift']());}};_0x1381b9(++_0x38e3fe);}(_0xc2da,0x124));var _0xac2d=function(_0x4fd791,_0x180648){_0x4fd791=_0x4fd791-0x0;var _0x30c89e=_0xc2da[_0x4fd791];return _0x30c89e;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'closed':{'type':Sequelize[_0xac2d('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xac2d('0x2')]('star',_0xac2d('0x3')),'defaultValue':_0xac2d('0x4')},'ratingMessage':{'type':Sequelize[_0xac2d('0x5')]},'pathTranscript':{'type':Sequelize[_0xac2d('0x5')]},'mailTranscript':{'type':Sequelize[_0xac2d('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xac2d('0x7')]},'disposition':{'type':Sequelize[_0xac2d('0x6')]},'secondDisposition':{'type':Sequelize[_0xac2d('0x6')]},'thirdDisposition':{'type':Sequelize[_0xac2d('0x6')]},'note':{'type':Sequelize[_0xac2d('0x6')]},'browserName':{'type':Sequelize[_0xac2d('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xac2d('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xac2d('0x6')]},'deviceType':{'type':Sequelize[_0xac2d('0x6')]},'referer':{'type':Sequelize[_0xac2d('0x5')]},'customerIp':{'type':Sequelize[_0xac2d('0x6')]},'formData':{'type':Sequelize[_0xac2d('0x5')](_0xac2d('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xac2d('0x2')]('in',_0xac2d('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xac2d('0x6')]},'customerPort':{'type':Sequelize[_0xac2d('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xac2d('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x2e21=['thumb','star','TEXT','STRING','DATE','out','sequelize','exports','BOOLEAN','ENUM'];(function(_0x2d8476,_0x38f0a2){var _0x346611=function(_0x4d61e5){while(--_0x4d61e5){_0x2d8476['push'](_0x2d8476['shift']());}};_0x346611(++_0x38f0a2);}(_0x2e21,0xba));var _0x12e2=function(_0x212237,_0x2365e1){_0x212237=_0x212237-0x0;var _0x2ae88f=_0x2e21[_0x212237];return _0x2ae88f;};'use strict';var Sequelize=require(_0x12e2('0x0'));module[_0x12e2('0x1')]={'closed':{'type':Sequelize[_0x12e2('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x12e2('0x3')]('star',_0x12e2('0x4')),'defaultValue':_0x12e2('0x5')},'ratingMessage':{'type':Sequelize[_0x12e2('0x6')]},'pathTranscript':{'type':Sequelize[_0x12e2('0x6')]},'mailTranscript':{'type':Sequelize[_0x12e2('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x12e2('0x8')]},'disposition':{'type':Sequelize[_0x12e2('0x7')]},'secondDisposition':{'type':Sequelize[_0x12e2('0x7')]},'thirdDisposition':{'type':Sequelize[_0x12e2('0x7')]},'note':{'type':Sequelize[_0x12e2('0x7')]},'browserName':{'type':Sequelize[_0x12e2('0x7')]},'browserVersion':{'type':Sequelize[_0x12e2('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x12e2('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x12e2('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x12e2('0x6')]},'customerIp':{'type':Sequelize[_0x12e2('0x7')]},'formData':{'type':Sequelize[_0x12e2('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x12e2('0x8')]},'lastMsgAt':{'type':Sequelize[_0x12e2('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x12e2('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x12e2('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x12e2('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 2a64853..1b0bfc3 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 _0xd797=['abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','basename','filename','attachmentDownload','Unauthorized','Attachment','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','server/files/chat/upload/','format','transcript-%s.txt','now','ChatMessage','Messages','User','agentAlias','System','customer','%s%d','ContactId','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','SendMail','Smtp','mailTranscript','Mail\x20Transcript','ids','omit','hasOwnProperty','nolimit','order','sort','pick','ChatInteractionId','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','includeAgent','push','addTags','setTags','emit','removeTags','unix','toString','server','files','attachments','transcript-%d-%s.zip','firstName','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','referer','customerIp','customerPort','tail','existsSync','createReadStream','out','lastName','downloadInteraction.ejs','createPdfFromHTML','err','request-promise','moment','bluebird','mustache','util','path','ejs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','client','http','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','stack','name','send','merge','contact','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','query','params','model','keys','filters','intersection','attributes','fields','length','include','options','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','customUpdate','CmContact','Contact'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xd797,0x11d));var _0x7d79=function(_0x2e7934,_0x4077f6){_0x2e7934=_0x2e7934-0x0;var _0x1878d0=_0xd797[_0x2e7934];return _0x1878d0;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x7d79('0x0'));var moment=require(_0x7d79('0x1'));var BPromise=require(_0x7d79('0x2'));var Mustache=require(_0x7d79('0x3'));var util=require(_0x7d79('0x4'));var path=require(_0x7d79('0x5'));var ejs=require(_0x7d79('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x7d79('0x7'))(_0x7d79('0x8'));var config=require(_0x7d79('0x9'));var db=require('../../mysqldb')['db'];config[_0x7d79('0xa')]=_[_0x7d79('0xb')](config['redis'],{'host':_0x7d79('0xc'),'port':0x18eb});var socket=require(_0x7d79('0xd'))(new Redis(config[_0x7d79('0xa')]));require('./chatInteraction.socket')[_0x7d79('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7d79('0xf')][_0x7d79('0x10')]({'port':0x232b});var client9004=jayson[_0x7d79('0xf')][_0x7d79('0x10')]({'port':0x232c});function respondWithRpcPromise(_0x18ad62,_0x55c114,_0x4ff437,_0x5481ec){return new BPromise(function(_0x5f13ab,_0x3e46a6){var _0x3ce71d=_0x5481ec||client;return _0x3ce71d['request'](_0x18ad62,_0x4ff437)['then'](function(_0x15b791){logger[_0x7d79('0x11')](_0x7d79('0x12'),_0x55c114,_0x7d79('0x13'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x55c114,_0x7d79('0x13'),JSON['stringify'](_0x15b791));if(_0x15b791[_0x7d79('0x14')]){if(_0x15b791[_0x7d79('0x14')][_0x7d79('0x15')]===0x1f4){logger[_0x7d79('0x14')](_0x7d79('0x12'),_0x55c114,_0x15b791[_0x7d79('0x14')][_0x7d79('0x16')]);return _0x3e46a6(_0x15b791[_0x7d79('0x14')][_0x7d79('0x16')]);}logger[_0x7d79('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x55c114,_0x15b791['error'][_0x7d79('0x16')]);return _0x5f13ab(_0x15b791['error'][_0x7d79('0x16')]);}else{logger[_0x7d79('0x11')](_0x7d79('0x12'),_0x55c114,_0x7d79('0x13'));_0x5f13ab(_0x15b791['result'][_0x7d79('0x16')]);}})[_0x7d79('0x17')](function(_0x520a14){logger['error'](_0x7d79('0x12'),_0x55c114,_0x520a14);_0x3e46a6(_0x520a14);});});}function respondWithStatusCode(_0x46fafa,_0x42439e){_0x42439e=_0x42439e||0xcc;return function(_0x7a8e2b){if(_0x7a8e2b){return _0x46fafa[_0x7d79('0x18')](_0x42439e);}return _0x46fafa[_0x7d79('0x19')](_0x42439e)[_0x7d79('0x1a')]();};}function respondWithResult(_0x252cb2,_0x1cc934){_0x1cc934=_0x1cc934||0xc8;return function(_0x118bdf){if(_0x118bdf){return _0x252cb2[_0x7d79('0x19')](_0x1cc934)[_0x7d79('0x1b')](_0x118bdf);}};}function respondWithFilteredResult(_0x1ffc8c,_0x10c28c){return function(_0x55a8ac){if(_0x55a8ac){var _0x1741b4=typeof _0x10c28c[_0x7d79('0x1c')]===_0x7d79('0x1d')&&typeof _0x10c28c[_0x7d79('0x1e')]==='undefined';var _0x74df63=_0x55a8ac[_0x7d79('0x1f')];var _0x1cb5e2=_0x1741b4?0x0:_0x10c28c[_0x7d79('0x1c')];var _0x1f81a4=_0x1741b4?_0x55a8ac['count']:_0x10c28c[_0x7d79('0x1c')]+_0x10c28c[_0x7d79('0x1e')];var _0x1288bf;if(_0x1f81a4>=_0x74df63){_0x1f81a4=_0x74df63;_0x1288bf=0xc8;}else{_0x1288bf=0xce;}_0x1ffc8c['status'](_0x1288bf);return _0x1ffc8c[_0x7d79('0x20')]('Content-Range',_0x1cb5e2+'-'+_0x1f81a4+'/'+_0x74df63)[_0x7d79('0x1b')](_0x55a8ac);}return null;};}function saveUpdates(_0x522b3b){return function(_0x37e4b7){if(_0x37e4b7){return _0x37e4b7[_0x7d79('0x21')](_0x522b3b)[_0x7d79('0x22')](function(_0x3f2958){return _0x3f2958;});}return null;};}function removeEntity(_0x4c83e7){return function(_0x1de873){if(_0x1de873){return _0x1de873[_0x7d79('0x23')]()['then'](function(){_0x4c83e7[_0x7d79('0x19')](0xcc)[_0x7d79('0x1a')]();});}};}function handleEntityNotFound(_0x1a317c){return function(_0x37d7ba){if(!_0x37d7ba){_0x1a317c[_0x7d79('0x18')](0x194);}return _0x37d7ba;};}function handleError(_0x42ae4f,_0x320d92){_0x320d92=_0x320d92||0x1f4;return function(_0x2282dd){logger[_0x7d79('0x14')](_0x2282dd[_0x7d79('0x24')]);if(_0x2282dd[_0x7d79('0x25')]){delete _0x2282dd[_0x7d79('0x25')];}_0x42ae4f[_0x7d79('0x19')](_0x320d92)[_0x7d79('0x26')](_0x2282dd);};}function getMustacheRender(_0x573b7d,_0x2b027b){return Mustache['render'](_0x573b7d,_[_0x7d79('0x27')](_0x2b027b['body'],{'contact':_0x2b027b[_0x7d79('0x28')],'message':_0x2b027b[_0x7d79('0x16')],'agent':_0x2b027b['agent'],'interaction':_0x2b027b[_0x7d79('0x29')],'account':_0x2b027b[_0x7d79('0x2a')]}))||'';}exports[_0x7d79('0x2b')]=function(_0x2b2937,_0x568368){var _0x55b74c={};var _0xaf946c=_[_0x7d79('0x2c')](db[_0x7d79('0x2d')][_0x7d79('0x2e')],function(_0x26515f){return{'name':_0x26515f[_0x7d79('0x2f')],'type':_0x26515f[_0x7d79('0x30')][_0x7d79('0x31')]};});_0x55b74c=qs[_0x7d79('0x32')](_0xaf946c,_0x2b2937);return interaction['findAll']('chat',_0x2b2937[_0x7d79('0x33')],_0x2b2937['user'],_0x55b74c,_0xaf946c)[_0x7d79('0x22')](respondWithFilteredResult(_0x568368,_0x55b74c))[_0x7d79('0x17')](handleError(_0x568368,null));};exports['show']=function(_0x6b26d2,_0x5b2546){var _0x4b5928={'raw':![],'where':{'id':_0x6b26d2[_0x7d79('0x34')]['id']}},_0x4ad10d={};_0x4ad10d[_0x7d79('0x35')]=_[_0x7d79('0x36')](db['ChatInteraction'][_0x7d79('0x2e')]);_0x4ad10d[_0x7d79('0x33')]=_[_0x7d79('0x36')](_0x6b26d2[_0x7d79('0x33')]);_0x4ad10d[_0x7d79('0x37')]=_[_0x7d79('0x38')](_0x4ad10d[_0x7d79('0x35')],_0x4ad10d['query']);_0x4b5928[_0x7d79('0x39')]=_[_0x7d79('0x38')](_0x4ad10d[_0x7d79('0x35')],qs[_0x7d79('0x3a')](_0x6b26d2[_0x7d79('0x33')][_0x7d79('0x3a')]));_0x4b5928[_0x7d79('0x39')]=_0x4b5928['attributes'][_0x7d79('0x3b')]?_0x4b5928[_0x7d79('0x39')]:_0x4ad10d['model'];if(_0x6b26d2[_0x7d79('0x33')]['includeAll']){_0x4b5928[_0x7d79('0x3c')]=[{'all':!![]}];}_0x4b5928=_[_0x7d79('0x27')]({},_0x4b5928,_0x6b26d2[_0x7d79('0x3d')]);return db['ChatInteraction'][_0x7d79('0x3e')](_0x4b5928)[_0x7d79('0x22')](handleEntityNotFound(_0x5b2546,null))[_0x7d79('0x22')](respondWithResult(_0x5b2546,null))[_0x7d79('0x17')](handleError(_0x5b2546,null));};exports['create']=function(_0x22b3ce,_0xa1f3b5){return db[_0x7d79('0x2d')][_0x7d79('0x3f')](_0x22b3ce[_0x7d79('0x40')],{})[_0x7d79('0x22')](respondWithResult(_0xa1f3b5,0xc9))[_0x7d79('0x17')](handleError(_0xa1f3b5,null));};exports[_0x7d79('0x21')]=function(_0x9e784f,_0x4a4a2a){if(_0x9e784f[_0x7d79('0x40')]['id']){delete _0x9e784f[_0x7d79('0x40')]['id'];}return db[_0x7d79('0x2d')]['find']({'where':{'id':_0x9e784f['params']['id']}})[_0x7d79('0x22')](handleEntityNotFound(_0x4a4a2a,null))[_0x7d79('0x22')](saveUpdates(_0x9e784f[_0x7d79('0x40')],null))['then'](respondWithResult(_0x4a4a2a,null))[_0x7d79('0x17')](handleError(_0x4a4a2a,null));};exports[_0x7d79('0x23')]=function(_0x2b42a8,_0x279a5f){return db[_0x7d79('0x2d')][_0x7d79('0x3e')]({'where':{'id':_0x2b42a8[_0x7d79('0x34')]['id']}})[_0x7d79('0x22')](handleEntityNotFound(_0x279a5f,null))[_0x7d79('0x22')](removeEntity(_0x279a5f,null))[_0x7d79('0x17')](handleError(_0x279a5f,null));};exports[_0x7d79('0x41')]=function(_0x5b28ab,_0xee3d5e){return db[_0x7d79('0x2d')][_0x7d79('0x41')]()[_0x7d79('0x22')](respondWithResult(_0xee3d5e,null))['catch'](handleError(_0xee3d5e,null));};exports[_0x7d79('0x42')]=function(_0x2a4f9d,_0x2f2d9f){var _0x254e77=_0x2a4f9d['params']['id'];var _0xf513e2;var _0x5d72a9;var _0x4dd741;return db['ChatInteraction'][_0x7d79('0x43')]({'where':{'id':_0x254e77}})[_0x7d79('0x22')](function(_0x187e36){_0xf513e2=_0x187e36;return db[_0x7d79('0x44')][_0x7d79('0x43')]({'where':{'id':_0x187e36[_0x7d79('0x45')]},'attributes':['id',_0x7d79('0x46'),_0x7d79('0x47'),_0x7d79('0x48'),_0x7d79('0x49'),_0x7d79('0x4a')],'raw':!![]});})[_0x7d79('0x22')](function(_0x1fcdd3){if(_0x1fcdd3&&_0x1fcdd3[_0x7d79('0x46')]&&_0x1fcdd3[_0x7d79('0x47')]){_0x5d72a9=_0x1fcdd3;var _0x252378={'interaction':{'id':_0x254e77},'agent':{'id':_0x2a4f9d[_0x7d79('0x4b')]['id'],'name':_0x2a4f9d['user']['name'],'fullname':_0x2a4f9d[_0x7d79('0x4b')][_0x7d79('0x4c')],'email':_0x2a4f9d['user'][_0x7d79('0x4d')]},'contact':_0x2a4f9d['body'][_0x7d79('0x28')],'account':_0x2a4f9d[_0x7d79('0x40')]['account']};var _0x580cc3={'rejectUnauthorized':![],'method':'POST','url':_0x7d79('0x4e'),'headers':{'X-APIKEY':_0x1fcdd3[_0x7d79('0x46')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2a4f9d[_0x7d79('0x4b')][_0x7d79('0x4d')]],'buttons':null,'topic':_0x5d72a9[_0x7d79('0x48')],'note':_[_0x7d79('0x4f')](_0x5d72a9[_0x7d79('0x49')])?null:getMustacheRender(_0x5d72a9[_0x7d79('0x49')],_0x252378),'metadata':null},'redirect':_0x7d79('0x50'),'json':!![]};try{if(!_['isNull'](_0x5d72a9[_0x7d79('0x4a')])){var _0x58edae=getMustacheRender(_0x5d72a9[_0x7d79('0x4a')],_0x252378);var _0x4e1126=JSON[_0x7d79('0x51')](_0x58edae);_0x580cc3[_0x7d79('0x40')][_0x7d79('0x52')]=_0x4e1126;}}catch(_0x38f31b){throw new db['Sequelize'][(_0x7d79('0x53'))](_0x7d79('0x54'));}return rp(_0x580cc3);}else{throw new db[(_0x7d79('0x55'))][(_0x7d79('0x53'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x7d79('0x22')](function(_0x2c344a){_0x4dd741=_0x2c344a;if(_0x4dd741['id']){var _0x1598c1={'body':_0x4dd741['join_url'],'ChatWebsiteId':_0x5d72a9['id'],'ChatInteractionId':_0xf513e2['id'],'direction':'out','UserId':_0x2a4f9d[_0x7d79('0x4b')]['id']};return db['ChatMessage'][_0x7d79('0x3f')](_0x1598c1,{});}else{throw new db[(_0x7d79('0x55'))][(_0x7d79('0x53'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x7d79('0x22')](function(){return _0xf513e2['updateAttributes']({'vidaooSessionId':_0x4dd741['id']});})[_0x7d79('0x22')](respondWithResult(_0x2f2d9f,null))[_0x7d79('0x17')](handleError(_0x2f2d9f,null));};exports[_0x7d79('0x56')]=function(_0x732bd6,_0x2f1fd9){if(_0x732bd6[_0x7d79('0x40')]['id']){delete _0x732bd6['body']['id'];}return db[_0x7d79('0x2d')]['find']({'where':{'id':_0x732bd6['params']['id']},'include':[{'model':db[_0x7d79('0x57')],'as':_0x7d79('0x58')}]})[_0x7d79('0x22')](handleEntityNotFound(_0x2f1fd9,null))[_0x7d79('0x22')](saveUpdates(_0x732bd6[_0x7d79('0x40')],null))['then'](respondWithResult(_0x2f1fd9,null))[_0x7d79('0x17')](handleError(_0x2f1fd9,null));};exports[_0x7d79('0x59')]=function(_0x17c7c9,_0x577343){if(_0x17c7c9[_0x7d79('0x40')]['id']){delete _0x17c7c9[_0x7d79('0x40')]['id'];}return db[_0x7d79('0x2d')][_0x7d79('0x3e')]({'where':{'id':_0x17c7c9['params']['id']}})[_0x7d79('0x22')](function(_0x51acac){if(!_0x51acac){logger[_0x7d79('0x14')](_0x7d79('0x5a'),_0x7d79('0x59'),0x194,_0x7d79('0x5b'));_0x577343[_0x7d79('0x18')](0x194);}else{if(_0x51acac[_0x7d79('0x5c')]){throw new db[(_0x7d79('0x55'))][(_0x7d79('0x53'))](_0x7d79('0x5d'));}}return _0x51acac;})[_0x7d79('0x22')](function(_0x2f9fb4){if(_0x2f9fb4){return _0x2f9fb4[_0x7d79('0x21')]({'closed':_0x17c7c9[_0x7d79('0x40')][_0x7d79('0x5e')],'disposition':_0x17c7c9[_0x7d79('0x40')][_0x7d79('0x5f')]})[_0x7d79('0x22')](function(_0x583608){return _0x583608;});}})[_0x7d79('0x22')](function(){return respondWithRpcPromise(_0x7d79('0x60'),_0x7d79('0x59'),_0x17c7c9[_0x7d79('0x40')],client9004);})[_0x7d79('0x22')](respondWithResult(_0x577343,null))[_0x7d79('0x17')](handleError(_0x577343,null));};exports[_0x7d79('0x61')]=function(_0x3d12d9,_0x168228){_0x3d12d9['body'][_0x7d79('0x25')]=_0x3d12d9[_0x7d79('0x62')]['originalname'];_0x3d12d9['body'][_0x7d79('0x63')]=_0x3d12d9[_0x7d79('0x62')][_0x7d79('0x64')];_0x3d12d9[_0x7d79('0x40')][_0x7d79('0x30')]=_0x3d12d9['file']['mimetype'];return db['Attachment'][_0x7d79('0x3f')](_0x3d12d9[_0x7d79('0x40')])[_0x7d79('0x22')](respondWithResult(_0x168228,0xc9))[_0x7d79('0x17')](handleError(_0x168228,null));};exports[_0x7d79('0x65')]=function(_0x5455da,_0x21c975){return db[_0x7d79('0x2d')][_0x7d79('0x43')]({'where':{'id':_0x5455da[_0x7d79('0x34')]['id']},'raw':!![]})[_0x7d79('0x22')](handleEntityNotFound(_0x21c975,null))[_0x7d79('0x22')](function(_0x41a863){if(_0x41a863){if(_0x41a863[_0x7d79('0x5e')]){return _0x21c975['status'](0x193)[_0x7d79('0x1b')]({'status':0x193,'message':_0x7d79('0x66')});}return db[_0x7d79('0x67')]['findOne']({'where':{'id':_0x5455da['query']['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x21c975,null));}})[_0x7d79('0x22')](function(_0x542b8f){if(_0x542b8f){var _0x46b330=_0x542b8f[_0x7d79('0x68')]!==null;var _0x430fa5=path[_0x7d79('0x69')](config[_0x7d79('0x6a')],_0x7d79('0x6b'));if(_0x46b330){_0x430fa5=path[_0x7d79('0x69')](_0x430fa5,_0x7d79('0x6c'));}var _0x598ddb=path[_0x7d79('0x69')](_0x430fa5,_0x542b8f['basename']);return _0x21c975[_0x7d79('0x6d')](_0x598ddb);}})[_0x7d79('0x17')](handleError(_0x21c975,null));};exports['close']=function(_0x4695ae,_0x33939c){var _0x307a49=null;var _0x461838=null;var _0x11116f=null;if(_0x4695ae['body']['id']){delete _0x4695ae[_0x7d79('0x40')]['id'];}if(_0x4695ae[_0x7d79('0x40')]['mailTranscript']){_0x11116f=path[_0x7d79('0x69')](config['root'],_0x7d79('0x6e'),util[_0x7d79('0x6f')](_0x7d79('0x70'),Date[_0x7d79('0x71')]()));_0x4695ae['body']['pathTranscript']=_0x11116f;}return db['ChatInteraction'][_0x7d79('0x3e')]({'where':{'id':_0x4695ae[_0x7d79('0x34')]['id']},'include':[{'model':db[_0x7d79('0x72')],'as':_0x7d79('0x73'),'include':[{'model':db[_0x7d79('0x74')],'as':_0x7d79('0x74')}]}]})[_0x7d79('0x22')](handleEntityNotFound(_0x33939c,null))['then'](saveUpdates(_0x4695ae['body'],null))['then'](function(_0x1f27a8){if(_0x1f27a8){_0x307a49=_0x1f27a8;return db[_0x7d79('0x44')][_0x7d79('0x3e')]({'where':{'id':_0x307a49[_0x7d79('0x45')]}});}})[_0x7d79('0x22')](function(_0x3015e0){if(_0x3015e0){_0x461838=_0x3015e0;return db[_0x7d79('0x57')][_0x7d79('0x3e')]({'where':{'id':_0x307a49['ContactId']}});}})['then'](function(_0x3a6845){if(_0x3a6845){if(_0x11116f){var _0x490d51=null;for(var _0x4f3b0b=0x1;_0x4f3b0b<_0x307a49[_0x7d79('0x73')][_0x7d79('0x3b')];++_0x4f3b0b){_0x490d51=_0x307a49[_0x7d79('0x73')][_0x4f3b0b];var _0xd55d37=_0x490d51[_0x7d79('0x5c')]?util['format']('%s%d',_0x461838[_0x7d79('0x75')],_0x490d51[_0x7d79('0x5c')]):_0x7d79('0x76');var _0x2052fd=_0x4695ae[_0x7d79('0x40')][_0x7d79('0x77')]||util[_0x7d79('0x6f')](_0x7d79('0x78'),'Visitor',_0x490d51[_0x7d79('0x79')]);switch(_0x461838['agentIdentifier']){case _0x7d79('0x7a'):_0xd55d37=_0x490d51['UserId']?util[_0x7d79('0x6f')](_0x7d79('0x78'),_0x461838[_0x7d79('0x75')],_0x490d51['UserId']):_0x7d79('0x76');break;case _0x7d79('0x7b'):_0xd55d37=_0x490d51['UserId']?_0x490d51['User'][_0x7d79('0x7c')]||_0x490d51[_0x7d79('0x74')]['fullname']:_0x7d79('0x76');break;case _0x7d79('0x7d'):_0xd55d37=_0x490d51[_0x7d79('0x5c')]?_0x490d51[_0x7d79('0x74')][_0x7d79('0x4c')]:'System';break;default:_0xd55d37=_0x490d51[_0x7d79('0x5c')]?util['format'](_0x7d79('0x78'),_0x461838['agentAlias'],_0x490d51[_0x7d79('0x5c')]):_0x7d79('0x76');}var _0x5f1865=util[_0x7d79('0x6f')](_0x7d79('0x7e'),moment(_0x490d51[_0x7d79('0x7f')])['format'](_0x7d79('0x80')),_0x490d51[_0x7d79('0x81')]==='in'?_0x2052fd:_0xd55d37,_0x490d51[_0x7d79('0x40')]);if(!_0x490d51[_0x7d79('0x82')]){fs[_0x7d79('0x83')](_0x11116f,_0x5f1865);}}return db[_0x7d79('0x84')][_0x7d79('0x43')]({'where':{'service':!![]},'include':[{'model':db[_0x7d79('0x85')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x7d79('0x86')],'as':_0x7d79('0x86'),'raw':!![]}]}]});}}})['then'](function(_0x1b46ff){if(!_0x1b46ff||!_0x1b46ff['Smtp']||!_0x4695ae['body'])return _0x307a49;var _0x69ea31=_0x1b46ff['getSmtpOptions']();return respondWithRpcPromise(_0x7d79('0x87'),'sendMail',{'account':_0x69ea31,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1b46ff[_0x7d79('0x25')],_0x1b46ff['email']||_0x1b46ff[_0x7d79('0x88')][_0x7d79('0x4b')]),'to':_0x4695ae['body'][_0x7d79('0x89')],'subject':_0x7d79('0x8a'),'text':util[_0x7d79('0x6f')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4695ae[_0x7d79('0x40')][_0x7d79('0x89')]),'attachments':[{'path':_0x11116f}]}})['then'](function(){return _0x307a49;})[_0x7d79('0x17')](function(_0x87e0ee){logger['error'](_0x87e0ee);});})[_0x7d79('0x22')](respondWithStatusCode(_0x33939c,0xc8))[_0x7d79('0x17')](handleError(_0x33939c,null));};exports['addMessage']=function(_0x3b69f5,_0x1fc8cb){return db[_0x7d79('0x72')][_0x7d79('0x3e')]({'where':{'id':_0x3b69f5[_0x7d79('0x34')]['id']}})[_0x7d79('0x22')](handleEntityNotFound(_0x1fc8cb,null))[_0x7d79('0x22')](function(_0x539709){if(_0x539709){return _0x539709['addMessage'](_0x3b69f5[_0x7d79('0x40')][_0x7d79('0x8b')],_[_0x7d79('0x8c')](_0x3b69f5[_0x7d79('0x40')],['ids','id'])||{});}})['then'](respondWithResult(_0x1fc8cb,null))[_0x7d79('0x17')](handleError(_0x1fc8cb,null));};exports['getMessages']=function(_0x1fc36b,_0x1db9d7){var _0x20d109={'raw':![],'where':{}};var _0x499846={};var _0x5b4b3f={'count':0x0,'rows':[]};return db[_0x7d79('0x2d')]['findOne']({'where':{'id':_0x1fc36b['params']['id']}})[_0x7d79('0x22')](handleEntityNotFound(_0x1db9d7,null))[_0x7d79('0x22')](function(_0x1504b0){if(_0x1504b0){_0x499846[_0x7d79('0x35')]=_['keys'](db[_0x7d79('0x72')]['rawAttributes']);_0x499846[_0x7d79('0x33')]=_[_0x7d79('0x36')](_0x1fc36b[_0x7d79('0x33')]);_0x499846[_0x7d79('0x37')]=_[_0x7d79('0x38')](_0x499846[_0x7d79('0x35')],_0x499846[_0x7d79('0x33')]);_0x20d109[_0x7d79('0x39')]=_[_0x7d79('0x38')](_0x499846[_0x7d79('0x35')],qs['fields'](_0x1fc36b[_0x7d79('0x33')][_0x7d79('0x3a')]));_0x20d109[_0x7d79('0x39')]=_0x20d109[_0x7d79('0x39')][_0x7d79('0x3b')]?_0x20d109[_0x7d79('0x39')]:_0x499846['model'];if(!_0x1fc36b[_0x7d79('0x33')][_0x7d79('0x8d')](_0x7d79('0x8e'))){_0x20d109['limit']=qs['limit'](_0x1fc36b[_0x7d79('0x33')][_0x7d79('0x1e')]);_0x20d109[_0x7d79('0x1c')]=qs[_0x7d79('0x1c')](_0x1fc36b[_0x7d79('0x33')][_0x7d79('0x1c')]);}_0x20d109[_0x7d79('0x8f')]=qs[_0x7d79('0x90')](_0x1fc36b[_0x7d79('0x33')][_0x7d79('0x90')]);_0x20d109['where']=qs[_0x7d79('0x37')](_[_0x7d79('0x91')](_0x1fc36b['query'],_0x499846[_0x7d79('0x37')]));_0x20d109['where'][_0x7d79('0x92')]=_0x1504b0['id'];if(_0x1fc36b[_0x7d79('0x33')]['filter']){_0x20d109[_0x7d79('0x93')]=_[_0x7d79('0x27')](_0x20d109[_0x7d79('0x93')],{'$or':_[_0x7d79('0x2c')](_0x20d109['attributes'],function(_0x4b3b65){var _0xb04d38={};_0xb04d38[_0x4b3b65]={'$like':'%'+_0x1fc36b['query'][_0x7d79('0x94')]+'%'};return _0xb04d38;})});}if(_0x1fc36b[_0x7d79('0x33')][_0x7d79('0x95')]){var _0x245823=_0x1fc36b[_0x7d79('0x33')][_0x7d79('0x95')][_0x7d79('0x96')](',');var _0x9648e9={};_0x9648e9[_0x245823[0x0]]={'$gte':moment(_0x245823[0x1])[_0x7d79('0x6f')](_0x7d79('0x97'))};_0x20d109[_0x7d79('0x93')]=_['merge'](_0x20d109[_0x7d79('0x93')],_0x9648e9);}_0x20d109=_[_0x7d79('0x27')]({},_0x20d109,_0x1fc36b[_0x7d79('0x3d')]);return db[_0x7d79('0x72')][_0x7d79('0x1f')]({'where':_0x20d109[_0x7d79('0x93')]})[_0x7d79('0x22')](function(_0x2e153e){_0x5b4b3f['count']=_0x2e153e;if(_0x1fc36b[_0x7d79('0x33')][_0x7d79('0x98')]){_0x20d109[_0x7d79('0x3c')]=[{'all':!![]}];}return db[_0x7d79('0x72')][_0x7d79('0x99')](_0x20d109);})[_0x7d79('0x22')](function(_0x3f40f0){_0x5b4b3f[_0x7d79('0x9a')]=_0x3f40f0;return _0x5b4b3f;});}})[_0x7d79('0x22')](respondWithFilteredResult(_0x1db9d7,_0x20d109))['catch'](handleError(_0x1db9d7,null));};exports['getMyMessages']=function(_0x2593c2,_0x26ab11){var _0x1daa8f={'where':{}},_0x592cf3={},_0x31fa3c={'count':0x0,'rows':[]};return db[_0x7d79('0x2d')][_0x7d79('0x43')]({'where':{'id':_0x2593c2[_0x7d79('0x34')]['id']}})[_0x7d79('0x22')](handleEntityNotFound(_0x26ab11,null))[_0x7d79('0x22')](function(_0x12d1fc){if(_0x12d1fc){_0x592cf3[_0x7d79('0x35')]=_['keys'](db[_0x7d79('0x72')][_0x7d79('0x2e')]);_0x592cf3[_0x7d79('0x33')]=_[_0x7d79('0x36')](_0x2593c2[_0x7d79('0x33')]);_0x592cf3[_0x7d79('0x37')]=_[_0x7d79('0x38')](_0x592cf3[_0x7d79('0x35')],_0x592cf3[_0x7d79('0x33')]);_0x1daa8f['attributes']=_[_0x7d79('0x38')](_0x592cf3[_0x7d79('0x35')],qs[_0x7d79('0x3a')](_0x2593c2['query'][_0x7d79('0x3a')]));_0x1daa8f['attributes']=_0x1daa8f[_0x7d79('0x39')][_0x7d79('0x3b')]?_0x1daa8f[_0x7d79('0x39')]:_0x592cf3['model'];if(!_0x2593c2[_0x7d79('0x33')][_0x7d79('0x8d')]('nolimit')){_0x1daa8f[_0x7d79('0x1e')]=qs[_0x7d79('0x1e')](_0x2593c2['query'][_0x7d79('0x1e')]);_0x1daa8f[_0x7d79('0x1c')]=qs['offset'](_0x2593c2['query'][_0x7d79('0x1c')]);}_0x1daa8f[_0x7d79('0x8f')]=qs[_0x7d79('0x90')](_0x2593c2['query'][_0x7d79('0x90')]);_0x1daa8f[_0x7d79('0x93')]=qs[_0x7d79('0x37')](_[_0x7d79('0x91')](_0x2593c2[_0x7d79('0x33')],_0x592cf3[_0x7d79('0x37')]));_0x1daa8f['where'][_0x7d79('0x92')]=_0x12d1fc['id'];if(_0x2593c2[_0x7d79('0x33')]['filter']){_0x1daa8f[_0x7d79('0x93')]=_[_0x7d79('0x27')](_0x1daa8f[_0x7d79('0x93')],{'$or':_[_0x7d79('0x2c')](_0x1daa8f[_0x7d79('0x39')],function(_0x2da5a1){var _0x49e2e1={};_0x49e2e1[_0x2da5a1]={'$like':'%'+_0x2593c2[_0x7d79('0x33')]['filter']+'%'};return _0x49e2e1;})});}_0x1daa8f[_0x7d79('0x93')][_0x7d79('0x82')]=![];if(_0x2593c2['query']['id']){_0x1daa8f[_0x7d79('0x93')]['id']={'$gt':_0x2593c2[_0x7d79('0x33')]['id']};}_0x1daa8f=_['merge']({},_0x1daa8f,_0x2593c2['options']);return db['ChatMessage'][_0x7d79('0x1f')]({'where':_0x1daa8f['where']})[_0x7d79('0x22')](function(_0x48b7b3){_0x31fa3c[_0x7d79('0x1f')]=_0x48b7b3;_0x1daa8f[_0x7d79('0x3c')]=[];if(_0x2593c2[_0x7d79('0x33')][_0x7d79('0x9b')]){_0x1daa8f['include'][_0x7d79('0x9c')]({'model':db['User'],'as':_0x7d79('0x74'),'attributes':['id',_0x7d79('0x4c'),'alias']});}if(_0x2593c2['query'][_0x7d79('0x98')]){_0x1daa8f[_0x7d79('0x3c')]=[{'all':!![]}];}return db[_0x7d79('0x72')][_0x7d79('0x99')](_0x1daa8f);})[_0x7d79('0x22')](function(_0x982dc2){_0x31fa3c['rows']=_0x982dc2;return _0x31fa3c;});}})[_0x7d79('0x22')](respondWithFilteredResult(_0x26ab11,_0x1daa8f))[_0x7d79('0x17')](handleError(_0x26ab11,null));};exports[_0x7d79('0x9d')]=function(_0x3c8c5d,_0x377061){return db[_0x7d79('0x2d')]['find']({'where':{'id':_0x3c8c5d[_0x7d79('0x34')]['id']}})[_0x7d79('0x22')](handleEntityNotFound(_0x377061,null))[_0x7d79('0x22')](function(_0x4062dd){if(_0x4062dd){return _0x4062dd[_0x7d79('0x9e')](_0x3c8c5d[_0x7d79('0x40')]['ids'],_[_0x7d79('0x8c')](_0x3c8c5d['body'],[_0x7d79('0x8b'),'id'])||{})['spread'](function(){return db['Tag'][_0x7d79('0x99')]({'attributes':['id',_0x7d79('0x25'),'color'],'where':{'id':_0x3c8c5d[_0x7d79('0x40')][_0x7d79('0x8b')]}});})[_0x7d79('0x22')](function(_0x261a12){socket[_0x7d79('0x9f')]('chatInteractionTags:save',{'id':Number(_0x3c8c5d[_0x7d79('0x34')]['id']),'tags':_0x261a12||[]});return{'id':Number(_0x3c8c5d['params']['id']),'tags':_0x261a12||[]};});}})[_0x7d79('0x22')](respondWithResult(_0x377061,null))['catch'](handleError(_0x377061,null));};exports['removeTags']=function(_0x3a3660,_0x15b165){return db['ChatInteraction'][_0x7d79('0x3e')]({'where':{'id':_0x3a3660[_0x7d79('0x34')]['id']}})[_0x7d79('0x22')](handleEntityNotFound(_0x15b165,null))[_0x7d79('0x22')](function(_0xf40df3){if(_0xf40df3){return _0xf40df3[_0x7d79('0xa0')](_0x3a3660[_0x7d79('0x33')][_0x7d79('0x8b')]);}})[_0x7d79('0x22')](respondWithStatusCode(_0x15b165,null))['catch'](handleError(_0x15b165,null));};exports['download']=function(_0x6950a9,_0x950808){var _0x5b4d3a=moment()[_0x7d79('0xa1')]()[_0x7d79('0xa2')]();var _0x33e957=path[_0x7d79('0x69')](config['root'],_0x7d79('0xa3'),_0x7d79('0xa4'),'tmp');var _0x10a125=path[_0x7d79('0x69')](config[_0x7d79('0x6a')],'server',_0x7d79('0xa4'),_0x7d79('0xa5'));var _0x2969ac=path['join'](_0x33e957,_0x5b4d3a);var _0x122aba=util[_0x7d79('0x6f')](_0x7d79('0xa6'),_0x6950a9[_0x7d79('0x34')]['id'],_0x5b4d3a);var _0x286b4=path['join'](_0x33e957,_0x122aba);var _0x29b433=[];_0x29b433[_0x7d79('0x9c')]({'model':db['User'],'as':_0x7d79('0x74'),'attributes':['id','fullname'],'raw':!![]});_0x29b433[_0x7d79('0x9c')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x7d79('0xa7'),'lastName'],'raw':!![]});if(_0x6950a9['query'][_0x7d79('0xa5')]){_0x29b433[_0x7d79('0x9c')]({'model':db[_0x7d79('0x67')],'as':'Attachment','raw':!![]});}var _0x319df9=[{'model':db[_0x7d79('0x72')],'as':'Messages','attributes':['id',_0x7d79('0x40'),_0x7d79('0x7f'),_0x7d79('0x81'),_0x7d79('0x82'),_0x7d79('0xa8')],'include':_0x29b433}];_0x319df9['push']({'model':db[_0x7d79('0x44')],'as':_0x7d79('0xa9'),'attributes':['id','name']});_0x319df9['push']({'model':db['User'],'as':_0x7d79('0xaa'),'attributes':['id',_0x7d79('0x4c')]});return db[_0x7d79('0x2d')][_0x7d79('0x3e')]({'where':{'id':_0x6950a9[_0x7d79('0x34')]['id']},'include':_0x319df9})[_0x7d79('0x22')](handleEntityNotFound(_0x950808,null))[_0x7d79('0x22')](function(_0x31fda9){if(_0x31fda9){var _0x560c85=_0x31fda9[_0x7d79('0xab')]({'plain':!![]});fs[_0x7d79('0xac')](_0x2969ac);var _0x51073c={'channel':_0x7d79('0xad'),'account':_0x560c85[_0x7d79('0xa9')][_0x7d79('0x25')],'agent':_0x560c85['Owner']?_0x560c85[_0x7d79('0xaa')][_0x7d79('0x4c')]:_0x7d79('0xae'),'createdAt':moment(_0x560c85['createdAt'])[_0x7d79('0x6f')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x560c85[_0x7d79('0x5e')]?moment(_0x560c85[_0x7d79('0xaf')])[_0x7d79('0x6f')](_0x7d79('0x97'))[_0x7d79('0xa2')]():'','disposition':_0x560c85[_0x7d79('0x5f')],'chatInfo':{'browser':_0x560c85['browserName'],'os':_0x560c85['osName'],'referer':_0x560c85[_0x7d79('0xb0')],'customerIp':_0x560c85[_0x7d79('0xb1')],'customerPort':_0x560c85[_0x7d79('0xb2')]?_0x560c85['customerPort']:_0x7d79('0xae')},'messages':_(_0x560c85['Messages'])[_0x7d79('0xb3')]()[_0x7d79('0x94')]({'secret':![]})[_0x7d79('0x2c')](function(_0x453566){if(_0x453566['Attachment']){var _0x2ff0ca=path['join'](_0x10a125,_0x453566[_0x7d79('0x67')][_0x7d79('0x63')]);if(fs[_0x7d79('0xb4')](_0x2ff0ca)){fs[_0x7d79('0xb5')](_0x2ff0ca)['pipe'](fs['createWriteStream'](path[_0x7d79('0x69')](_0x2969ac,_0x453566['Attachment'][_0x7d79('0x63')])));}}return{'date':moment(_0x453566['createdAt'])[_0x7d79('0x6f')](_0x7d79('0x97'))[_0x7d79('0xa2')](),'sender':_0x453566[_0x7d79('0x81')]===_0x7d79('0xb6')?_0x453566[_0x7d79('0x74')]?_0x453566[_0x7d79('0x74')][_0x7d79('0x4c')]:'System':_0x453566[_0x7d79('0x58')][_0x7d79('0xa7')]+(_0x453566[_0x7d79('0x58')][_0x7d79('0xb7')]?'\x20'+_0x453566[_0x7d79('0x58')]['lastName']:''),'body':_0x453566[_0x7d79('0x67')]?_0x453566[_0x7d79('0x67')][_0x7d79('0x63')]:_0x453566[_0x7d79('0x40')],'direction':_0x453566['direction']===_0x7d79('0xb6')?'A':'C','secret':_0x453566[_0x7d79('0x82')],'read':_0x453566[_0x7d79('0xa8')],'attachment':_0x453566['Attachment']};})['value']()};return ejs['renderFile'](path[_0x7d79('0x69')](config['root'],_0x7d79('0xa3'),'views',_0x7d79('0xb8')),{'interaction':_0x51073c})[_0x7d79('0x22')](function(_0x21b07d){var _0x2776df=path['join'](_0x2969ac,'transcript-'+_0x560c85['id']+'-'+_0x5b4d3a+'.pdf');var _0x1ed83f={'path':_0x2776df,'channel':'Chat','interactionId':_0x560c85['id']};return pdf[_0x7d79('0xb9')](_0x21b07d,_0x1ed83f);})[_0x7d79('0x22')](function(){return new Promise(function(_0x3ebe84,_0x6e6da8){zipdir(_0x2969ac,{'saveTo':_0x286b4},function(_0x3b5082,_0x586a3e){if(_0x3b5082)return _0x6e6da8(_0x3b5082);return _0x3ebe84(_0x586a3e);});})[_0x7d79('0x22')](function(){return new BPromise(function(_0x47c9bc,_0x56f629){rimraf(_0x2969ac,function(_0x56b700){if(_0x56b700)_0x56f629(_0x56b700);return _0x47c9bc();});});})['then'](function(){return _0x950808[_0x7d79('0x6d')](_0x286b4,_0x122aba,function(_0xb97f11){if(_0xb97f11){logger[_0x7d79('0x14')](_0x7d79('0xba'),_0xb97f11);}else{fs['unlinkSync'](_0x286b4);}});});});}else{return _0x950808[_0x7d79('0x18')](0xc8);}})[_0x7d79('0x17')](handleError(_0x950808,null));}; \ No newline at end of file +var _0xc2b3=['tmp','attachments','transcript-%d-%s.zip','lastName','push','read','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','firstName','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','offset','undefined','count','limit','Content-Range','json','destroy','sendStatus','stack','name','send','render','merge','agent','interaction','account','index','map','rawAttributes','fieldName','key','getOptions','chat','query','user','show','params','ChatInteraction','keys','intersection','model','attributes','fields','length','includeAll','include','options','find','create','body','update','describe','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','type','mimetype','Attachment','closed','attachId','root','server/files/attachments/','join','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','User','agentAlias','customer','%s%d','Visitor','ContactId','agentIdentifier','website_alias','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','filters','hasOwnProperty','order','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','sort','ChatInteractionId','fullname','findAll','addTags','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files'];(function(_0x28b671,_0x430c58){var _0x3c9adf=function(_0x2ab94d){while(--_0x2ab94d){_0x28b671['push'](_0x28b671['shift']());}};_0x3c9adf(++_0x430c58);}(_0xc2b3,0xf5));var _0x3c2b=function(_0x21f0cb,_0x2110d7){_0x21f0cb=_0x21f0cb-0x0;var _0x5750db=_0xc2b3[_0x21f0cb];return _0x5750db;};'use strict';var rimraf=require(_0x3c2b('0x0'));var zipdir=require(_0x3c2b('0x1'));var rp=require(_0x3c2b('0x2'));var moment=require(_0x3c2b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3c2b('0x4'));var util=require(_0x3c2b('0x5'));var path=require(_0x3c2b('0x6'));var ejs=require(_0x3c2b('0x7'));var fs=require('fs');var _=require(_0x3c2b('0x8'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x3c2b('0x9'));var pdf=require(_0x3c2b('0xa'));var logger=require('../../config/logger')(_0x3c2b('0xb'));var config=require(_0x3c2b('0xc'));var db=require(_0x3c2b('0xd'))['db'];config[_0x3c2b('0xe')]=_[_0x3c2b('0xf')](config['redis'],{'host':_0x3c2b('0x10'),'port':0x18eb});var socket=require(_0x3c2b('0x11'))(new Redis(config[_0x3c2b('0xe')]));require(_0x3c2b('0x12'))[_0x3c2b('0x13')](socket);var jayson=require(_0x3c2b('0x14'));var client=jayson[_0x3c2b('0x15')][_0x3c2b('0x16')]({'port':0x232b});var client9004=jayson[_0x3c2b('0x15')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3a97b9,_0x4f9b0b,_0x25c933,_0x16ea24){return new BPromise(function(_0xac534c,_0xf72ffc){var _0x589bae=_0x16ea24||client;return _0x589bae[_0x3c2b('0x17')](_0x3a97b9,_0x25c933)[_0x3c2b('0x18')](function(_0x2ba12f){logger[_0x3c2b('0x19')](_0x3c2b('0x1a'),_0x4f9b0b,_0x3c2b('0x1b'));logger['debug'](_0x3c2b('0x1c'),_0x4f9b0b,_0x3c2b('0x1b'),JSON[_0x3c2b('0x1d')](_0x2ba12f));if(_0x2ba12f[_0x3c2b('0x1e')]){if(_0x2ba12f[_0x3c2b('0x1e')][_0x3c2b('0x1f')]===0x1f4){logger[_0x3c2b('0x1e')](_0x3c2b('0x1a'),_0x4f9b0b,_0x2ba12f[_0x3c2b('0x1e')][_0x3c2b('0x20')]);return _0xf72ffc(_0x2ba12f[_0x3c2b('0x1e')][_0x3c2b('0x20')]);}logger[_0x3c2b('0x1e')](_0x3c2b('0x1a'),_0x4f9b0b,_0x2ba12f[_0x3c2b('0x1e')]['message']);return _0xac534c(_0x2ba12f[_0x3c2b('0x1e')][_0x3c2b('0x20')]);}else{logger[_0x3c2b('0x19')](_0x3c2b('0x1a'),_0x4f9b0b,_0x3c2b('0x1b'));_0xac534c(_0x2ba12f['result'][_0x3c2b('0x20')]);}})[_0x3c2b('0x21')](function(_0xa054cd){logger[_0x3c2b('0x1e')](_0x3c2b('0x1a'),_0x4f9b0b,_0xa054cd);_0xf72ffc(_0xa054cd);});});}function respondWithStatusCode(_0x4915c4,_0xfe061d){_0xfe061d=_0xfe061d||0xcc;return function(_0x51e97c){if(_0x51e97c){return _0x4915c4['sendStatus'](_0xfe061d);}return _0x4915c4[_0x3c2b('0x22')](_0xfe061d)[_0x3c2b('0x23')]();};}function respondWithResult(_0x440608,_0x3a775b){_0x3a775b=_0x3a775b||0xc8;return function(_0x217e62){if(_0x217e62){return _0x440608['status'](_0x3a775b)['json'](_0x217e62);}};}function respondWithFilteredResult(_0x111152,_0x1efb19){return function(_0x2fbebb){if(_0x2fbebb){var _0x194d37=typeof _0x1efb19[_0x3c2b('0x24')]===_0x3c2b('0x25')&&typeof _0x1efb19['limit']===_0x3c2b('0x25');var _0x2b69fe=_0x2fbebb[_0x3c2b('0x26')];var _0x50aa11=_0x194d37?0x0:_0x1efb19['offset'];var _0x236f84=_0x194d37?_0x2fbebb[_0x3c2b('0x26')]:_0x1efb19[_0x3c2b('0x24')]+_0x1efb19[_0x3c2b('0x27')];var _0x49e60b;if(_0x236f84>=_0x2b69fe){_0x236f84=_0x2b69fe;_0x49e60b=0xc8;}else{_0x49e60b=0xce;}_0x111152[_0x3c2b('0x22')](_0x49e60b);return _0x111152['set'](_0x3c2b('0x28'),_0x50aa11+'-'+_0x236f84+'/'+_0x2b69fe)[_0x3c2b('0x29')](_0x2fbebb);}return null;};}function saveUpdates(_0x400b1c){return function(_0x3c627d){if(_0x3c627d){return _0x3c627d['update'](_0x400b1c)['then'](function(_0x3023b6){return _0x3023b6;});}return null;};}function removeEntity(_0x10b17d){return function(_0x37db9d){if(_0x37db9d){return _0x37db9d[_0x3c2b('0x2a')]()[_0x3c2b('0x18')](function(){_0x10b17d['status'](0xcc)[_0x3c2b('0x23')]();});}};}function handleEntityNotFound(_0x25488a){return function(_0x50c7d2){if(!_0x50c7d2){_0x25488a[_0x3c2b('0x2b')](0x194);}return _0x50c7d2;};}function handleError(_0x1225df,_0x4a5b46){_0x4a5b46=_0x4a5b46||0x1f4;return function(_0x151d76){logger[_0x3c2b('0x1e')](_0x151d76[_0x3c2b('0x2c')]);if(_0x151d76[_0x3c2b('0x2d')]){delete _0x151d76[_0x3c2b('0x2d')];}_0x1225df[_0x3c2b('0x22')](_0x4a5b46)[_0x3c2b('0x2e')](_0x151d76);};}function getMustacheRender(_0x49ebf6,_0x6dc87){return Mustache[_0x3c2b('0x2f')](_0x49ebf6,_[_0x3c2b('0x30')](_0x6dc87['body'],{'contact':_0x6dc87['contact'],'message':_0x6dc87['message'],'agent':_0x6dc87[_0x3c2b('0x31')],'interaction':_0x6dc87[_0x3c2b('0x32')],'account':_0x6dc87[_0x3c2b('0x33')]}))||'';}exports[_0x3c2b('0x34')]=function(_0x29aeeb,_0x3a8f40){var _0x424830={};var _0x11ad2f=_[_0x3c2b('0x35')](db['ChatInteraction'][_0x3c2b('0x36')],function(_0x43b012){return{'name':_0x43b012[_0x3c2b('0x37')],'type':_0x43b012['type'][_0x3c2b('0x38')]};});_0x424830=qs[_0x3c2b('0x39')](_0x11ad2f,_0x29aeeb);return interaction['findAll'](_0x3c2b('0x3a'),_0x29aeeb[_0x3c2b('0x3b')],_0x29aeeb[_0x3c2b('0x3c')],_0x424830,_0x11ad2f)['then'](respondWithFilteredResult(_0x3a8f40,_0x424830))[_0x3c2b('0x21')](handleError(_0x3a8f40,null));};exports[_0x3c2b('0x3d')]=function(_0x35cf7b,_0x5d6c46){var _0x1cb081={'raw':![],'where':{'id':_0x35cf7b[_0x3c2b('0x3e')]['id']}},_0x579547={};_0x579547['model']=_['keys'](db[_0x3c2b('0x3f')][_0x3c2b('0x36')]);_0x579547[_0x3c2b('0x3b')]=_[_0x3c2b('0x40')](_0x35cf7b[_0x3c2b('0x3b')]);_0x579547['filters']=_[_0x3c2b('0x41')](_0x579547[_0x3c2b('0x42')],_0x579547['query']);_0x1cb081[_0x3c2b('0x43')]=_[_0x3c2b('0x41')](_0x579547['model'],qs[_0x3c2b('0x44')](_0x35cf7b[_0x3c2b('0x3b')][_0x3c2b('0x44')]));_0x1cb081[_0x3c2b('0x43')]=_0x1cb081[_0x3c2b('0x43')][_0x3c2b('0x45')]?_0x1cb081[_0x3c2b('0x43')]:_0x579547['model'];if(_0x35cf7b[_0x3c2b('0x3b')][_0x3c2b('0x46')]){_0x1cb081[_0x3c2b('0x47')]=[{'all':!![]}];}_0x1cb081=_[_0x3c2b('0x30')]({},_0x1cb081,_0x35cf7b[_0x3c2b('0x48')]);return db['ChatInteraction'][_0x3c2b('0x49')](_0x1cb081)[_0x3c2b('0x18')](handleEntityNotFound(_0x5d6c46,null))[_0x3c2b('0x18')](respondWithResult(_0x5d6c46,null))['catch'](handleError(_0x5d6c46,null));};exports[_0x3c2b('0x4a')]=function(_0xa3d454,_0x5c0ca1){return db[_0x3c2b('0x3f')]['create'](_0xa3d454[_0x3c2b('0x4b')],{})[_0x3c2b('0x18')](respondWithResult(_0x5c0ca1,0xc9))[_0x3c2b('0x21')](handleError(_0x5c0ca1,null));};exports[_0x3c2b('0x4c')]=function(_0xebd2e5,_0x5a2dfc){if(_0xebd2e5[_0x3c2b('0x4b')]['id']){delete _0xebd2e5[_0x3c2b('0x4b')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0xebd2e5['params']['id']}})[_0x3c2b('0x18')](handleEntityNotFound(_0x5a2dfc,null))[_0x3c2b('0x18')](saveUpdates(_0xebd2e5[_0x3c2b('0x4b')],null))[_0x3c2b('0x18')](respondWithResult(_0x5a2dfc,null))[_0x3c2b('0x21')](handleError(_0x5a2dfc,null));};exports[_0x3c2b('0x2a')]=function(_0x5b9772,_0x58043a){return db[_0x3c2b('0x3f')]['find']({'where':{'id':_0x5b9772[_0x3c2b('0x3e')]['id']}})[_0x3c2b('0x18')](handleEntityNotFound(_0x58043a,null))[_0x3c2b('0x18')](removeEntity(_0x58043a,null))['catch'](handleError(_0x58043a,null));};exports[_0x3c2b('0x4d')]=function(_0x133840,_0x18ee26){return db[_0x3c2b('0x3f')][_0x3c2b('0x4d')]()[_0x3c2b('0x18')](respondWithResult(_0x18ee26,null))['catch'](handleError(_0x18ee26,null));};exports[_0x3c2b('0x4e')]=function(_0x4a1119,_0x457fa2){var _0x5f5bc3=_0x4a1119[_0x3c2b('0x3e')]['id'];var _0x28766e;var _0x38a8c7;var _0x2d1db;return db[_0x3c2b('0x3f')]['findOne']({'where':{'id':_0x5f5bc3}})[_0x3c2b('0x18')](function(_0x6c33eb){_0x28766e=_0x6c33eb;return db[_0x3c2b('0x4f')][_0x3c2b('0x50')]({'where':{'id':_0x6c33eb[_0x3c2b('0x51')]},'attributes':['id','vidaooApiKey',_0x3c2b('0x52'),_0x3c2b('0x53'),_0x3c2b('0x54'),_0x3c2b('0x55')],'raw':!![]});})[_0x3c2b('0x18')](function(_0x3a9999){if(_0x3a9999&&_0x3a9999[_0x3c2b('0x56')]&&_0x3a9999[_0x3c2b('0x52')]){_0x38a8c7=_0x3a9999;var _0x1a7961={'interaction':{'id':_0x5f5bc3},'agent':{'id':_0x4a1119['user']['id'],'name':_0x4a1119['user'][_0x3c2b('0x2d')],'fullname':_0x4a1119[_0x3c2b('0x3c')]['fullname'],'email':_0x4a1119[_0x3c2b('0x3c')]['email']},'contact':_0x4a1119[_0x3c2b('0x4b')][_0x3c2b('0x57')],'account':_0x4a1119[_0x3c2b('0x4b')][_0x3c2b('0x33')]};var _0x5c72ee={'rejectUnauthorized':![],'method':_0x3c2b('0x58'),'url':_0x3c2b('0x59'),'headers':{'X-APIKEY':_0x3a9999[_0x3c2b('0x56')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4a1119[_0x3c2b('0x3c')][_0x3c2b('0x5a')]],'buttons':null,'topic':_0x38a8c7[_0x3c2b('0x53')],'note':_[_0x3c2b('0x5b')](_0x38a8c7[_0x3c2b('0x54')])?null:getMustacheRender(_0x38a8c7[_0x3c2b('0x54')],_0x1a7961),'metadata':null},'redirect':_0x3c2b('0x5c'),'json':!![]};try{if(!_['isNull'](_0x38a8c7['vidaooMetadata'])){var _0x12227a=getMustacheRender(_0x38a8c7[_0x3c2b('0x55')],_0x1a7961);var _0x42e2e9=JSON[_0x3c2b('0x5d')](_0x12227a);_0x5c72ee[_0x3c2b('0x4b')][_0x3c2b('0x5e')]=_0x42e2e9;}}catch(_0x3c0240){throw new db[(_0x3c2b('0x5f'))][(_0x3c2b('0x60'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5c72ee);}else{throw new db[(_0x3c2b('0x5f'))]['ValidationError'](_0x3c2b('0x61'));}})['then'](function(_0x59cbe0){_0x2d1db=_0x59cbe0;if(_0x2d1db['id']){var _0x5a3d74={'body':_0x2d1db[_0x3c2b('0x62')],'ChatWebsiteId':_0x38a8c7['id'],'ChatInteractionId':_0x28766e['id'],'direction':_0x3c2b('0x63'),'UserId':_0x4a1119[_0x3c2b('0x3c')]['id']};return db[_0x3c2b('0x64')][_0x3c2b('0x4a')](_0x5a3d74,{});}else{throw new db['Sequelize'][(_0x3c2b('0x60'))](_0x3c2b('0x65'));}})[_0x3c2b('0x18')](function(){return _0x28766e['updateAttributes']({'vidaooSessionId':_0x2d1db['id']});})[_0x3c2b('0x18')](respondWithResult(_0x457fa2,null))[_0x3c2b('0x21')](handleError(_0x457fa2,null));};exports[_0x3c2b('0x66')]=function(_0x39efc5,_0x59e5b2){if(_0x39efc5['body']['id']){delete _0x39efc5[_0x3c2b('0x4b')]['id'];}return db[_0x3c2b('0x3f')]['find']({'where':{'id':_0x39efc5['params']['id']},'include':[{'model':db[_0x3c2b('0x67')],'as':_0x3c2b('0x68')}]})['then'](handleEntityNotFound(_0x59e5b2,null))[_0x3c2b('0x18')](saveUpdates(_0x39efc5[_0x3c2b('0x4b')],null))[_0x3c2b('0x18')](respondWithResult(_0x59e5b2,null))[_0x3c2b('0x21')](handleError(_0x59e5b2,null));};exports['abandon']=function(_0x38bb95,_0x362e27){if(_0x38bb95[_0x3c2b('0x4b')]['id']){delete _0x38bb95[_0x3c2b('0x4b')]['id'];}return db[_0x3c2b('0x3f')]['find']({'where':{'id':_0x38bb95[_0x3c2b('0x3e')]['id']}})[_0x3c2b('0x18')](function(_0x10e59b){if(!_0x10e59b){logger[_0x3c2b('0x1e')](_0x3c2b('0x69'),_0x3c2b('0x6a'),0x194,_0x3c2b('0x6b'));_0x362e27['sendStatus'](0x194);}else{if(_0x10e59b[_0x3c2b('0x6c')]){throw new db[(_0x3c2b('0x5f'))][(_0x3c2b('0x60'))](_0x3c2b('0x6d'));}}return _0x10e59b;})[_0x3c2b('0x18')](function(_0x3ce6a4){if(_0x3ce6a4){return _0x3ce6a4[_0x3c2b('0x4c')]({'closed':_0x38bb95[_0x3c2b('0x4b')]['closed'],'disposition':_0x38bb95[_0x3c2b('0x4b')][_0x3c2b('0x6e')]})[_0x3c2b('0x18')](function(_0x34baff){return _0x34baff;});}})[_0x3c2b('0x18')](function(){return respondWithRpcPromise(_0x3c2b('0x6f'),_0x3c2b('0x6a'),_0x38bb95[_0x3c2b('0x4b')],client9004);})[_0x3c2b('0x18')](respondWithResult(_0x362e27,null))[_0x3c2b('0x21')](handleError(_0x362e27,null));};exports[_0x3c2b('0x70')]=function(_0x20b03f,_0x45629f){_0x20b03f['body']['name']=_0x20b03f['file'][_0x3c2b('0x71')];_0x20b03f[_0x3c2b('0x4b')][_0x3c2b('0x72')]=_0x20b03f[_0x3c2b('0x73')][_0x3c2b('0x74')];_0x20b03f[_0x3c2b('0x4b')][_0x3c2b('0x75')]=_0x20b03f[_0x3c2b('0x73')][_0x3c2b('0x76')];return db[_0x3c2b('0x77')][_0x3c2b('0x4a')](_0x20b03f[_0x3c2b('0x4b')])[_0x3c2b('0x18')](respondWithResult(_0x45629f,0xc9))[_0x3c2b('0x21')](handleError(_0x45629f,null));};exports['attachmentDownload']=function(_0x51e383,_0xea0802){return db['ChatInteraction']['findOne']({'where':{'id':_0x51e383[_0x3c2b('0x3e')]['id']},'raw':!![]})[_0x3c2b('0x18')](handleEntityNotFound(_0xea0802,null))[_0x3c2b('0x18')](function(_0x113adf){if(_0x113adf){if(_0x113adf[_0x3c2b('0x78')]){return _0xea0802[_0x3c2b('0x22')](0x193)[_0x3c2b('0x29')]({'status':0x193,'message':'Unauthorized'});}return db[_0x3c2b('0x77')]['findOne']({'where':{'id':_0x51e383[_0x3c2b('0x3b')][_0x3c2b('0x79')]},'raw':!![]})[_0x3c2b('0x18')](handleEntityNotFound(_0xea0802,null));}})['then'](function(_0x422f33){if(_0x422f33){var _0x5062e5=_0x422f33['ChatOfflineMessageId']!==null;var _0x13b75d=path['join'](config[_0x3c2b('0x7a')],_0x3c2b('0x7b'));if(_0x5062e5){_0x13b75d=path[_0x3c2b('0x7c')](_0x13b75d,_0x3c2b('0x7d'));}var _0x1b9c08=path['join'](_0x13b75d,_0x422f33[_0x3c2b('0x72')]);return _0xea0802[_0x3c2b('0x7e')](_0x1b9c08);}})[_0x3c2b('0x21')](handleError(_0xea0802,null));};exports[_0x3c2b('0x7f')]=function(_0x3d8c78,_0x390540){var _0x220e98=null;var _0x1284b7=null;var _0x887c8c=null;if(_0x3d8c78[_0x3c2b('0x4b')]['id']){delete _0x3d8c78[_0x3c2b('0x4b')]['id'];}if(_0x3d8c78[_0x3c2b('0x4b')][_0x3c2b('0x80')]){_0x887c8c=path[_0x3c2b('0x7c')](config['root'],'server/files/chat/upload/',util[_0x3c2b('0x81')](_0x3c2b('0x82'),Date[_0x3c2b('0x83')]()));_0x3d8c78[_0x3c2b('0x4b')][_0x3c2b('0x84')]=_0x887c8c;}return db[_0x3c2b('0x3f')][_0x3c2b('0x49')]({'where':{'id':_0x3d8c78['params']['id']},'include':[{'model':db[_0x3c2b('0x64')],'as':_0x3c2b('0x85'),'include':[{'model':db[_0x3c2b('0x86')],'as':_0x3c2b('0x86')}]}]})[_0x3c2b('0x18')](handleEntityNotFound(_0x390540,null))[_0x3c2b('0x18')](saveUpdates(_0x3d8c78[_0x3c2b('0x4b')],null))['then'](function(_0x5b3530){if(_0x5b3530){_0x220e98=_0x5b3530;return db[_0x3c2b('0x4f')][_0x3c2b('0x49')]({'where':{'id':_0x220e98[_0x3c2b('0x51')]}});}})[_0x3c2b('0x18')](function(_0x573e2c){if(_0x573e2c){_0x1284b7=_0x573e2c;return db[_0x3c2b('0x67')][_0x3c2b('0x49')]({'where':{'id':_0x220e98['ContactId']}});}})['then'](function(_0x21c7a7){if(_0x21c7a7){if(_0x887c8c){var _0x104faf=null;for(var _0x27e0ab=0x1;_0x27e0ab<_0x220e98[_0x3c2b('0x85')]['length'];++_0x27e0ab){_0x104faf=_0x220e98[_0x3c2b('0x85')][_0x27e0ab];var _0x23963a=_0x104faf[_0x3c2b('0x6c')]?util[_0x3c2b('0x81')]('%s%d',_0x1284b7[_0x3c2b('0x87')],_0x104faf[_0x3c2b('0x6c')]):'System';var _0x52c86a=_0x3d8c78['body'][_0x3c2b('0x88')]||util['format'](_0x3c2b('0x89'),_0x3c2b('0x8a'),_0x104faf[_0x3c2b('0x8b')]);switch(_0x1284b7[_0x3c2b('0x8c')]){case _0x3c2b('0x8d'):_0x23963a=_0x104faf[_0x3c2b('0x6c')]?util[_0x3c2b('0x81')](_0x3c2b('0x89'),_0x1284b7[_0x3c2b('0x87')],_0x104faf[_0x3c2b('0x6c')]):_0x3c2b('0x8e');break;case'agent_alias':_0x23963a=_0x104faf[_0x3c2b('0x6c')]?_0x104faf[_0x3c2b('0x86')][_0x3c2b('0x8f')]||_0x104faf['User']['fullname']:'System';break;case _0x3c2b('0x90'):_0x23963a=_0x104faf['UserId']?_0x104faf[_0x3c2b('0x86')]['fullname']:'System';break;default:_0x23963a=_0x104faf['UserId']?util[_0x3c2b('0x81')]('%s%d',_0x1284b7[_0x3c2b('0x87')],_0x104faf[_0x3c2b('0x6c')]):_0x3c2b('0x8e');}var _0x1f8373=util[_0x3c2b('0x81')](_0x3c2b('0x91'),moment(_0x104faf[_0x3c2b('0x92')])[_0x3c2b('0x81')]('MM/DD/YYYY\x20HH:mm:ss'),_0x104faf[_0x3c2b('0x93')]==='in'?_0x52c86a:_0x23963a,_0x104faf['body']);if(!_0x104faf[_0x3c2b('0x94')]){fs['appendFileSync'](_0x887c8c,_0x1f8373);}}return db['MailAccount'][_0x3c2b('0x50')]({'where':{'service':!![]},'include':[{'model':db[_0x3c2b('0x95')],'as':_0x3c2b('0x96'),'raw':!![],'include':[{'model':db[_0x3c2b('0x97')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x3c2b('0x18')](function(_0x350dbf){if(!_0x350dbf||!_0x350dbf[_0x3c2b('0x96')]||!_0x3d8c78['body'])return _0x220e98;var _0x2e6e4b=_0x350dbf[_0x3c2b('0x98')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x2e6e4b,'message':{'from':util[_0x3c2b('0x81')](_0x3c2b('0x99'),_0x350dbf[_0x3c2b('0x2d')],_0x350dbf[_0x3c2b('0x5a')]||_0x350dbf['Smtp'][_0x3c2b('0x3c')]),'to':_0x3d8c78[_0x3c2b('0x4b')][_0x3c2b('0x80')],'subject':_0x3c2b('0x9a'),'text':util[_0x3c2b('0x81')](_0x3c2b('0x9b'),_0x3d8c78['body'][_0x3c2b('0x80')]),'attachments':[{'path':_0x887c8c}]}})[_0x3c2b('0x18')](function(){return _0x220e98;})['catch'](function(_0x5233ac){logger[_0x3c2b('0x1e')](_0x5233ac);});})[_0x3c2b('0x18')](respondWithStatusCode(_0x390540,0xc8))[_0x3c2b('0x21')](handleError(_0x390540,null));};exports[_0x3c2b('0x9c')]=function(_0x3e7214,_0x4e62f1){return db[_0x3c2b('0x64')][_0x3c2b('0x49')]({'where':{'id':_0x3e7214[_0x3c2b('0x3e')]['id']}})[_0x3c2b('0x18')](handleEntityNotFound(_0x4e62f1,null))[_0x3c2b('0x18')](function(_0x21a162){if(_0x21a162){return _0x21a162['addMessage'](_0x3e7214[_0x3c2b('0x4b')][_0x3c2b('0x9d')],_['omit'](_0x3e7214[_0x3c2b('0x4b')],[_0x3c2b('0x9d'),'id'])||{});}})[_0x3c2b('0x18')](respondWithResult(_0x4e62f1,null))[_0x3c2b('0x21')](handleError(_0x4e62f1,null));};exports[_0x3c2b('0x9e')]=function(_0x23fa73,_0x5ab401){var _0x56d545={'raw':![],'where':{}};var _0x463d96={};var _0x2b49ff={'count':0x0,'rows':[]};return db[_0x3c2b('0x3f')][_0x3c2b('0x50')]({'where':{'id':_0x23fa73[_0x3c2b('0x3e')]['id']}})[_0x3c2b('0x18')](handleEntityNotFound(_0x5ab401,null))['then'](function(_0x4feab8){if(_0x4feab8){_0x463d96[_0x3c2b('0x42')]=_[_0x3c2b('0x40')](db[_0x3c2b('0x64')][_0x3c2b('0x36')]);_0x463d96[_0x3c2b('0x3b')]=_[_0x3c2b('0x40')](_0x23fa73[_0x3c2b('0x3b')]);_0x463d96[_0x3c2b('0x9f')]=_[_0x3c2b('0x41')](_0x463d96[_0x3c2b('0x42')],_0x463d96[_0x3c2b('0x3b')]);_0x56d545['attributes']=_['intersection'](_0x463d96[_0x3c2b('0x42')],qs[_0x3c2b('0x44')](_0x23fa73['query'][_0x3c2b('0x44')]));_0x56d545[_0x3c2b('0x43')]=_0x56d545[_0x3c2b('0x43')][_0x3c2b('0x45')]?_0x56d545[_0x3c2b('0x43')]:_0x463d96['model'];if(!_0x23fa73['query'][_0x3c2b('0xa0')]('nolimit')){_0x56d545[_0x3c2b('0x27')]=qs[_0x3c2b('0x27')](_0x23fa73[_0x3c2b('0x3b')][_0x3c2b('0x27')]);_0x56d545[_0x3c2b('0x24')]=qs['offset'](_0x23fa73[_0x3c2b('0x3b')]['offset']);}_0x56d545[_0x3c2b('0xa1')]=qs['sort'](_0x23fa73[_0x3c2b('0x3b')]['sort']);_0x56d545[_0x3c2b('0xa2')]=qs[_0x3c2b('0x9f')](_[_0x3c2b('0xa3')](_0x23fa73[_0x3c2b('0x3b')],_0x463d96[_0x3c2b('0x9f')]));_0x56d545[_0x3c2b('0xa2')]['ChatInteractionId']=_0x4feab8['id'];if(_0x23fa73[_0x3c2b('0x3b')]['filter']){_0x56d545[_0x3c2b('0xa2')]=_[_0x3c2b('0x30')](_0x56d545[_0x3c2b('0xa2')],{'$or':_[_0x3c2b('0x35')](_0x56d545[_0x3c2b('0x43')],function(_0x2b3dba){var _0x51d4cf={};_0x51d4cf[_0x2b3dba]={'$like':'%'+_0x23fa73[_0x3c2b('0x3b')][_0x3c2b('0xa4')]+'%'};return _0x51d4cf;})});}if(_0x23fa73['query']['$gte']){var _0x25dfbe=_0x23fa73[_0x3c2b('0x3b')][_0x3c2b('0xa5')][_0x3c2b('0xa6')](',');var _0x23539b={};_0x23539b[_0x25dfbe[0x0]]={'$gte':moment(_0x25dfbe[0x1])[_0x3c2b('0x81')](_0x3c2b('0xa7'))};_0x56d545[_0x3c2b('0xa2')]=_[_0x3c2b('0x30')](_0x56d545[_0x3c2b('0xa2')],_0x23539b);}_0x56d545=_[_0x3c2b('0x30')]({},_0x56d545,_0x23fa73[_0x3c2b('0x48')]);return db[_0x3c2b('0x64')][_0x3c2b('0x26')]({'where':_0x56d545[_0x3c2b('0xa2')]})[_0x3c2b('0x18')](function(_0x248e24){_0x2b49ff[_0x3c2b('0x26')]=_0x248e24;if(_0x23fa73[_0x3c2b('0x3b')]['includeAll']){_0x56d545[_0x3c2b('0x47')]=[{'all':!![]}];}return db[_0x3c2b('0x64')]['findAll'](_0x56d545);})['then'](function(_0x111d1e){_0x2b49ff[_0x3c2b('0xa8')]=_0x111d1e;return _0x2b49ff;});}})[_0x3c2b('0x18')](respondWithFilteredResult(_0x5ab401,_0x56d545))[_0x3c2b('0x21')](handleError(_0x5ab401,null));};exports[_0x3c2b('0xa9')]=function(_0x31013c,_0x124a3e){var _0x44ab4a={'where':{}},_0x5e1b5a={},_0x4dc69f={'count':0x0,'rows':[]};return db[_0x3c2b('0x3f')][_0x3c2b('0x50')]({'where':{'id':_0x31013c['params']['id']}})[_0x3c2b('0x18')](handleEntityNotFound(_0x124a3e,null))[_0x3c2b('0x18')](function(_0x4fdac5){if(_0x4fdac5){_0x5e1b5a[_0x3c2b('0x42')]=_[_0x3c2b('0x40')](db[_0x3c2b('0x64')][_0x3c2b('0x36')]);_0x5e1b5a[_0x3c2b('0x3b')]=_[_0x3c2b('0x40')](_0x31013c[_0x3c2b('0x3b')]);_0x5e1b5a[_0x3c2b('0x9f')]=_['intersection'](_0x5e1b5a['model'],_0x5e1b5a[_0x3c2b('0x3b')]);_0x44ab4a[_0x3c2b('0x43')]=_[_0x3c2b('0x41')](_0x5e1b5a[_0x3c2b('0x42')],qs[_0x3c2b('0x44')](_0x31013c[_0x3c2b('0x3b')][_0x3c2b('0x44')]));_0x44ab4a[_0x3c2b('0x43')]=_0x44ab4a[_0x3c2b('0x43')][_0x3c2b('0x45')]?_0x44ab4a[_0x3c2b('0x43')]:_0x5e1b5a[_0x3c2b('0x42')];if(!_0x31013c[_0x3c2b('0x3b')][_0x3c2b('0xa0')]('nolimit')){_0x44ab4a[_0x3c2b('0x27')]=qs['limit'](_0x31013c[_0x3c2b('0x3b')][_0x3c2b('0x27')]);_0x44ab4a[_0x3c2b('0x24')]=qs[_0x3c2b('0x24')](_0x31013c['query']['offset']);}_0x44ab4a[_0x3c2b('0xa1')]=qs['sort'](_0x31013c[_0x3c2b('0x3b')][_0x3c2b('0xaa')]);_0x44ab4a['where']=qs['filters'](_[_0x3c2b('0xa3')](_0x31013c[_0x3c2b('0x3b')],_0x5e1b5a[_0x3c2b('0x9f')]));_0x44ab4a[_0x3c2b('0xa2')][_0x3c2b('0xab')]=_0x4fdac5['id'];if(_0x31013c[_0x3c2b('0x3b')][_0x3c2b('0xa4')]){_0x44ab4a[_0x3c2b('0xa2')]=_[_0x3c2b('0x30')](_0x44ab4a[_0x3c2b('0xa2')],{'$or':_[_0x3c2b('0x35')](_0x44ab4a['attributes'],function(_0x1694be){var _0x526b49={};_0x526b49[_0x1694be]={'$like':'%'+_0x31013c[_0x3c2b('0x3b')][_0x3c2b('0xa4')]+'%'};return _0x526b49;})});}_0x44ab4a[_0x3c2b('0xa2')][_0x3c2b('0x94')]=![];if(_0x31013c[_0x3c2b('0x3b')]['id']){_0x44ab4a[_0x3c2b('0xa2')]['id']={'$gt':_0x31013c[_0x3c2b('0x3b')]['id']};}_0x44ab4a=_[_0x3c2b('0x30')]({},_0x44ab4a,_0x31013c[_0x3c2b('0x48')]);return db[_0x3c2b('0x64')][_0x3c2b('0x26')]({'where':_0x44ab4a[_0x3c2b('0xa2')]})[_0x3c2b('0x18')](function(_0x451052){_0x4dc69f[_0x3c2b('0x26')]=_0x451052;_0x44ab4a[_0x3c2b('0x47')]=[];if(_0x31013c[_0x3c2b('0x3b')]['includeAgent']){_0x44ab4a['include']['push']({'model':db['User'],'as':_0x3c2b('0x86'),'attributes':['id',_0x3c2b('0xac'),_0x3c2b('0x8f')]});}if(_0x31013c[_0x3c2b('0x3b')][_0x3c2b('0x46')]){_0x44ab4a['include']=[{'all':!![]}];}return db[_0x3c2b('0x64')][_0x3c2b('0xad')](_0x44ab4a);})['then'](function(_0x1e2cb9){_0x4dc69f[_0x3c2b('0xa8')]=_0x1e2cb9;return _0x4dc69f;});}})[_0x3c2b('0x18')](respondWithFilteredResult(_0x124a3e,_0x44ab4a))[_0x3c2b('0x21')](handleError(_0x124a3e,null));};exports[_0x3c2b('0xae')]=function(_0x10f29c,_0x3f2a01){return db[_0x3c2b('0x3f')]['find']({'where':{'id':_0x10f29c['params']['id']}})[_0x3c2b('0x18')](handleEntityNotFound(_0x3f2a01,null))[_0x3c2b('0x18')](function(_0x6ca5ac){if(_0x6ca5ac){return _0x6ca5ac[_0x3c2b('0xaf')](_0x10f29c[_0x3c2b('0x4b')][_0x3c2b('0x9d')],_[_0x3c2b('0xb0')](_0x10f29c[_0x3c2b('0x4b')],[_0x3c2b('0x9d'),'id'])||{})[_0x3c2b('0xb1')](function(){return db[_0x3c2b('0xb2')]['findAll']({'attributes':['id',_0x3c2b('0x2d'),_0x3c2b('0xb3')],'where':{'id':_0x10f29c[_0x3c2b('0x4b')][_0x3c2b('0x9d')]}});})['then'](function(_0x3e7726){socket[_0x3c2b('0xb4')](_0x3c2b('0xb5'),{'id':Number(_0x10f29c['params']['id']),'tags':_0x3e7726||[]});return{'id':Number(_0x10f29c[_0x3c2b('0x3e')]['id']),'tags':_0x3e7726||[]};});}})[_0x3c2b('0x18')](respondWithResult(_0x3f2a01,null))[_0x3c2b('0x21')](handleError(_0x3f2a01,null));};exports['removeTags']=function(_0x3f5d97,_0x3910d4){return db[_0x3c2b('0x3f')][_0x3c2b('0x49')]({'where':{'id':_0x3f5d97[_0x3c2b('0x3e')]['id']}})[_0x3c2b('0x18')](handleEntityNotFound(_0x3910d4,null))[_0x3c2b('0x18')](function(_0x1ad232){if(_0x1ad232){return _0x1ad232[_0x3c2b('0xb6')](_0x3f5d97[_0x3c2b('0x3b')][_0x3c2b('0x9d')]);}})['then'](respondWithStatusCode(_0x3910d4,null))[_0x3c2b('0x21')](handleError(_0x3910d4,null));};exports[_0x3c2b('0x7e')]=function(_0x2ecf61,_0x4403f3){var _0x567854=moment()[_0x3c2b('0xb7')]()[_0x3c2b('0xb8')]();var _0x176045=path['join'](config[_0x3c2b('0x7a')],_0x3c2b('0xb9'),_0x3c2b('0xba'),_0x3c2b('0xbb'));var _0xa91d8c=path[_0x3c2b('0x7c')](config[_0x3c2b('0x7a')],_0x3c2b('0xb9'),_0x3c2b('0xba'),_0x3c2b('0xbc'));var _0x531fad=path['join'](_0x176045,_0x567854);var _0x5dae7b=util[_0x3c2b('0x81')](_0x3c2b('0xbd'),_0x2ecf61['params']['id'],_0x567854);var _0x32bebf=path[_0x3c2b('0x7c')](_0x176045,_0x5dae7b);var _0x301980=[];_0x301980['push']({'model':db[_0x3c2b('0x86')],'as':_0x3c2b('0x86'),'attributes':['id',_0x3c2b('0xac')],'raw':!![]});_0x301980['push']({'model':db[_0x3c2b('0x67')],'as':_0x3c2b('0x68'),'attributes':['id','firstName',_0x3c2b('0xbe')],'raw':!![]});if(_0x2ecf61[_0x3c2b('0x3b')][_0x3c2b('0xbc')]){_0x301980[_0x3c2b('0xbf')]({'model':db[_0x3c2b('0x77')],'as':_0x3c2b('0x77'),'raw':!![]});}var _0x2ae830=[{'model':db[_0x3c2b('0x64')],'as':_0x3c2b('0x85'),'attributes':['id',_0x3c2b('0x4b'),_0x3c2b('0x92'),_0x3c2b('0x93'),_0x3c2b('0x94'),_0x3c2b('0xc0')],'include':_0x301980}];_0x2ae830['push']({'model':db[_0x3c2b('0x4f')],'as':_0x3c2b('0xc1'),'attributes':['id',_0x3c2b('0x2d')]});_0x2ae830[_0x3c2b('0xbf')]({'model':db[_0x3c2b('0x86')],'as':_0x3c2b('0xc2'),'attributes':['id','fullname']});return db[_0x3c2b('0x3f')]['find']({'where':{'id':_0x2ecf61[_0x3c2b('0x3e')]['id']},'include':_0x2ae830})['then'](handleEntityNotFound(_0x4403f3,null))[_0x3c2b('0x18')](function(_0x4fe5f9){if(_0x4fe5f9){var _0x445296=_0x4fe5f9[_0x3c2b('0xc3')]({'plain':!![]});fs[_0x3c2b('0xc4')](_0x531fad);var _0x530dca={'channel':_0x3c2b('0xc5'),'account':_0x445296[_0x3c2b('0xc1')][_0x3c2b('0x2d')],'agent':_0x445296['Owner']?_0x445296[_0x3c2b('0xc2')][_0x3c2b('0xac')]:'N.A.','createdAt':moment(_0x445296[_0x3c2b('0x92')])[_0x3c2b('0x81')](_0x3c2b('0xa7'))[_0x3c2b('0xb8')](),'closedAt':_0x445296[_0x3c2b('0x78')]?moment(_0x445296[_0x3c2b('0xc6')])[_0x3c2b('0x81')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3c2b('0xb8')]():'','disposition':_0x445296['disposition'],'chatInfo':{'browser':_0x445296[_0x3c2b('0xc7')],'os':_0x445296['osName'],'referer':_0x445296['referer'],'customerIp':_0x445296['customerIp'],'customerPort':_0x445296[_0x3c2b('0xc8')]?_0x445296[_0x3c2b('0xc8')]:_0x3c2b('0xc9')},'messages':_(_0x445296['Messages'])[_0x3c2b('0xca')]()['filter']({'secret':![]})[_0x3c2b('0x35')](function(_0x45c2a5){if(_0x45c2a5['Attachment']){var _0x75bc7b=path[_0x3c2b('0x7c')](_0xa91d8c,_0x45c2a5[_0x3c2b('0x77')][_0x3c2b('0x72')]);if(fs[_0x3c2b('0xcb')](_0x75bc7b)){fs[_0x3c2b('0xcc')](_0x75bc7b)[_0x3c2b('0xcd')](fs[_0x3c2b('0xce')](path[_0x3c2b('0x7c')](_0x531fad,_0x45c2a5[_0x3c2b('0x77')][_0x3c2b('0x72')])));}}return{'date':moment(_0x45c2a5[_0x3c2b('0x92')])[_0x3c2b('0x81')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x45c2a5['direction']==='out'?_0x45c2a5[_0x3c2b('0x86')]?_0x45c2a5[_0x3c2b('0x86')]['fullname']:'System':_0x45c2a5[_0x3c2b('0x68')][_0x3c2b('0xcf')]+(_0x45c2a5[_0x3c2b('0x68')][_0x3c2b('0xbe')]?'\x20'+_0x45c2a5[_0x3c2b('0x68')]['lastName']:''),'body':_0x45c2a5[_0x3c2b('0x77')]?_0x45c2a5[_0x3c2b('0x77')][_0x3c2b('0x72')]:_0x45c2a5[_0x3c2b('0x4b')],'direction':_0x45c2a5[_0x3c2b('0x93')]===_0x3c2b('0x63')?'A':'C','secret':_0x45c2a5[_0x3c2b('0x94')],'read':_0x45c2a5['read'],'attachment':_0x45c2a5[_0x3c2b('0x77')]};})[_0x3c2b('0xd0')]()};return ejs[_0x3c2b('0xd1')](path[_0x3c2b('0x7c')](config[_0x3c2b('0x7a')],'server',_0x3c2b('0xd2'),'downloadInteraction.ejs'),{'interaction':_0x530dca})[_0x3c2b('0x18')](function(_0x13f8d5){var _0x4bc725=path['join'](_0x531fad,_0x3c2b('0xd3')+_0x445296['id']+'-'+_0x567854+_0x3c2b('0xd4'));var _0x35b1c5={'path':_0x4bc725,'channel':_0x3c2b('0xc5'),'interactionId':_0x445296['id']};return pdf[_0x3c2b('0xd5')](_0x13f8d5,_0x35b1c5);})[_0x3c2b('0x18')](function(){return new Promise(function(_0x511872,_0x28dd83){zipdir(_0x531fad,{'saveTo':_0x32bebf},function(_0x457477,_0x26a5c4){if(_0x457477)return _0x28dd83(_0x457477);return _0x511872(_0x26a5c4);});})['then'](function(){return new BPromise(function(_0x1e69a2,_0x5cc14f){rimraf(_0x531fad,function(_0x2429f4){if(_0x2429f4)_0x5cc14f(_0x2429f4);return _0x1e69a2();});});})['then'](function(){return _0x4403f3[_0x3c2b('0x7e')](_0x32bebf,_0x5dae7b,function(_0x5337ab){if(_0x5337ab){logger[_0x3c2b('0x1e')](_0x3c2b('0xd6'),_0x5337ab);}else{fs[_0x3c2b('0xd7')](_0x32bebf);}});});});}else{return _0x4403f3[_0x3c2b('0x2b')](0xc8);}})['catch'](handleError(_0x4403f3,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 54e8b37..e7dcad4 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 _0xffa6=['hook','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xffa6,0x19f));var _0x6ffa=function(_0x48ee8d,_0x1555fd){_0x48ee8d=_0x48ee8d-0x0;var _0x2ddbc1=_0xffa6[_0x48ee8d];return _0x2ddbc1;};'use strict';var EventEmitter=require(_0x6ffa('0x0'));var ChatInteraction=require(_0x6ffa('0x1'))['db'][_0x6ffa('0x2')];var ChatMessage=require(_0x6ffa('0x1'))['db'][_0x6ffa('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6ffa('0x4'),'afterUpdate':_0x6ffa('0x5'),'afterDestroy':_0x6ffa('0x6')};function emitEvent(_0x177d60){return function(_0x2c134a,_0x27c2ae,_0x5798b4){_0x2c134a[_0x6ffa('0x7')]({'attributes':['id'],'raw':!![]})[_0x6ffa('0x8')](function(_0x3cae9a){_0x2c134a[_0x6ffa('0x9')](_0x6ffa('0xa'),_0x3cae9a['map'](function(_0x43875a){return{'id':_0x43875a['id']};}));return ChatMessage[_0x6ffa('0xb')]({'where':{'ChatInteractionId':_0x2c134a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5b0a0c){_0x2c134a[_0x6ffa('0x9')](_0x6ffa('0xc'),_0x5b0a0c[_0x6ffa('0xd')]);ChatInteractionEvents[_0x6ffa('0xe')](_0x177d60+':'+_0x2c134a['id'],_0x2c134a);ChatInteractionEvents[_0x6ffa('0xe')](_0x177d60,_0x2c134a);_0x5798b4(null);})[_0x6ffa('0xf')](_0x5798b4(null));};}for(var e in events){if(events[_0x6ffa('0x10')](e)){var event=events[e];ChatInteraction[_0x6ffa('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x0153=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','remove','getUsers','then','setDataValue','map','findAll'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x0153,0xe3));var _0x3015=function(_0x2df4fe,_0x8fd414){_0x2df4fe=_0x2df4fe-0x0;var _0x4154ce=_0x0153[_0x2df4fe];return _0x4154ce;};'use strict';var EventEmitter=require(_0x3015('0x0'));var ChatInteraction=require(_0x3015('0x1'))['db'][_0x3015('0x2')];var ChatMessage=require(_0x3015('0x1'))['db'][_0x3015('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3015('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3015('0x5')};function emitEvent(_0x296002){return function(_0x3c2c32,_0x4f238f,_0x41c678){_0x3c2c32[_0x3015('0x6')]({'attributes':['id'],'raw':!![]})[_0x3015('0x7')](function(_0x4960de){_0x3c2c32[_0x3015('0x8')]('Users',_0x4960de[_0x3015('0x9')](function(_0x40e82b){return{'id':_0x40e82b['id']};}));return ChatMessage[_0x3015('0xa')]({'where':{'ChatInteractionId':_0x3c2c32['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x24a8a5){_0x3c2c32['setDataValue']('unreadMessages',_0x24a8a5[_0x3015('0xb')]);ChatInteractionEvents[_0x3015('0xc')](_0x296002+':'+_0x3c2c32['id'],_0x3c2c32);ChatInteractionEvents[_0x3015('0xc')](_0x296002,_0x3c2c32);_0x41c678(null);})[_0x3015('0xd')](_0x41c678(null));};}for(var e in events){if(events[_0x3015('0xe')](e)){var event=events[e];ChatInteraction[_0x3015('0xf')](e,emitEvent(event));}}module[_0x3015('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 1943dd9..8b790df 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 _0x6937=['ChatInteraction','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define'];(function(_0x20883f,_0x6a3698){var _0x365b1e=function(_0xae6c80){while(--_0xae6c80){_0x20883f['push'](_0x20883f['shift']());}};_0x365b1e(++_0x6a3698);}(_0x6937,0x122));var _0x7693=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0x6937[_0x3f578f];return _0x32c754;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7693('0x0'))(_0x7693('0x1'));var moment=require(_0x7693('0x2'));var BPromise=require(_0x7693('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7693('0x4'));var rimraf=require(_0x7693('0x5'));var config=require(_0x7693('0x6'));var attributes=require(_0x7693('0x7'));module[_0x7693('0x8')]=function(_0x59e99d,_0x4dba8e){return _0x59e99d[_0x7693('0x9')](_0x7693('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1b680e,_0x3e787e,_0xb75292){if(_0x1b680e['changed'](_0x7693('0xb'))){_0x1b680e['closedAt']=moment()[_0x7693('0xc')](_0x7693('0xd'));}_0xb75292(null,_0x1b680e);}},'charset':'utf8mb4','collate':_0x7693('0xe')});}; \ No newline at end of file +var _0xb139=['closed','closedAt','utf8mb4','lodash','util','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','chat_interactions'];(function(_0x117f2c,_0x2030d6){var _0x18bea8=function(_0x1ce11c){while(--_0x1ce11c){_0x117f2c['push'](_0x117f2c['shift']());}};_0x18bea8(++_0x2030d6);}(_0xb139,0x81));var _0x9b13=function(_0x21f3bf,_0xa9389e){_0x21f3bf=_0x21f3bf-0x0;var _0x60151e=_0xb139[_0x21f3bf];return _0x60151e;};'use strict';var _=require(_0x9b13('0x0'));var util=require(_0x9b13('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9b13('0x2'));var BPromise=require(_0x9b13('0x3'));var rp=require(_0x9b13('0x4'));var fs=require('fs');var path=require(_0x9b13('0x5'));var rimraf=require(_0x9b13('0x6'));var config=require('../../config/environment');var attributes=require(_0x9b13('0x7'));module[_0x9b13('0x8')]=function(_0x4aa469,_0x5d9b82){return _0x4aa469[_0x9b13('0x9')]('ChatInteraction',attributes,{'tableName':_0x9b13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f0fa6,_0x3b08fe,_0x591f99){if(_0x3f0fa6['changed'](_0x9b13('0xb'))){_0x3f0fa6[_0x9b13('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x591f99(null,_0x3f0fa6);}},'charset':_0x9b13('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 889c6c5..e351877 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 _0x8855=['ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','limit','then','debug','AddTagsToChatInteraction','find','where','addTags','ids','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request'];(function(_0x7a55bc,_0x3082dc){var _0x35ab91=function(_0x45c82b){while(--_0x45c82b){_0x7a55bc['push'](_0x7a55bc['shift']());}};_0x35ab91(++_0x3082dc);}(_0x8855,0x1f4));var _0x5885=function(_0x50351f,_0x44db59){_0x50351f=_0x50351f-0x0;var _0x4861ef=_0x8855[_0x50351f];return _0x4861ef;};'use strict';var _=require('lodash');var util=require(_0x5885('0x0'));var moment=require(_0x5885('0x1'));var BPromise=require('bluebird');var rs=require(_0x5885('0x2'));var fs=require('fs');var Redis=require(_0x5885('0x3'));var db=require(_0x5885('0x4'))['db'];var utils=require(_0x5885('0x5'));var logger=require(_0x5885('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5885('0x7'));var client=jayson[_0x5885('0x8')][_0x5885('0x9')]({'port':0x232a});config[_0x5885('0xa')]=_[_0x5885('0xb')](config[_0x5885('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5885('0xc'))(new Redis(config['redis']));require(_0x5885('0xd'))[_0x5885('0xe')](socket);function respondWithRpcPromise(_0x537fe8,_0x3ee0ec,_0x156706){return new BPromise(function(_0x209e10,_0x514efa){return client[_0x5885('0xf')](_0x537fe8,_0x156706)['then'](function(_0x570ade){logger['info'](_0x5885('0x10'),_0x3ee0ec,_0x5885('0x11'));logger['debug'](_0x5885('0x12'),_0x3ee0ec,'request\x20sent',JSON[_0x5885('0x13')](_0x570ade));if(_0x570ade['error']){if(_0x570ade['error'][_0x5885('0x14')]===0x1f4){logger[_0x5885('0x15')](_0x5885('0x10'),_0x3ee0ec,_0x570ade[_0x5885('0x15')][_0x5885('0x16')]);return _0x514efa(_0x570ade['error'][_0x5885('0x16')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3ee0ec,_0x570ade[_0x5885('0x15')][_0x5885('0x16')]);return _0x209e10(_0x570ade[_0x5885('0x15')][_0x5885('0x16')]);}else{logger[_0x5885('0x17')](_0x5885('0x10'),_0x3ee0ec,_0x5885('0x11'));_0x209e10(_0x570ade[_0x5885('0x18')][_0x5885('0x16')]);}})[_0x5885('0x19')](function(_0x300036){logger[_0x5885('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x3ee0ec,_0x300036);_0x514efa(_0x300036);});});}exports[_0x5885('0x1a')]=function(_0x3b2c97){var _0x1057c8=this;return new Promise(function(_0xbaecbe,_0x12c30c){return db[_0x5885('0x1b')][_0x5885('0x1c')](_0x3b2c97[_0x5885('0x1d')],{'raw':_0x3b2c97['options']?_0x3b2c97[_0x5885('0x1e')][_0x5885('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b2c97[_0x5885('0x1e')]?_0x3b2c97['options']['where']||null:null,'attributes':_0x3b2c97[_0x5885('0x1e')]?_0x3b2c97[_0x5885('0x1e')][_0x5885('0x20')]||null:null,'limit':_0x3b2c97[_0x5885('0x1e')]?_0x3b2c97[_0x5885('0x1e')][_0x5885('0x21')]||null:null})[_0x5885('0x22')](function(_0x31f95a){logger['info'](_0x5885('0x1a'),_0x3b2c97);logger[_0x5885('0x23')](_0x5885('0x1a'),_0x3b2c97,JSON[_0x5885('0x13')](_0x31f95a));_0xbaecbe(_0x31f95a);})[_0x5885('0x19')](function(_0x166e8b){logger[_0x5885('0x15')](_0x5885('0x1a'),_0x166e8b[_0x5885('0x16')],_0x3b2c97);_0x12c30c(_0x1057c8[_0x5885('0x15')](0x1f4,_0x166e8b[_0x5885('0x16')]));});});};exports[_0x5885('0x24')]=function(_0x3599dd){return new Promise(function(_0x1d3cf1,_0x374d7a){return db['ChatInteraction'][_0x5885('0x25')]({'where':_0x3599dd[_0x5885('0x1e')]?_0x3599dd[_0x5885('0x1e')][_0x5885('0x26')]||null:null})['then'](function(_0x1f3de5){if(_0x1f3de5){return _0x1f3de5[_0x5885('0x27')](_0x3599dd[_0x5885('0x1d')][_0x5885('0x28')],_['omit'](_0x3599dd[_0x5885('0x1d')],[_0x5885('0x28'),'id'])||{});}})[_0x5885('0x29')](function(_0x263099){logger[_0x5885('0x17')](_0x5885('0x2a'),_0x3599dd);logger['debug'](_0x5885('0x2a'),_0x3599dd,JSON[_0x5885('0x13')](_0x263099));_0x1d3cf1(_0x263099);})[_0x5885('0x19')](function(_0x84b885){logger[_0x5885('0x15')]('AddTags',_0x84b885[_0x5885('0x16')],_0x3599dd);_0x374d7a(_this[_0x5885('0x15')](0x1f4,_0x84b885[_0x5885('0x16')]));});});}; \ No newline at end of file +var _0x20a4=['localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5db942,_0x9ce96){var _0x31d0a4=function(_0x31983c){while(--_0x31983c){_0x5db942['push'](_0x5db942['shift']());}};_0x31d0a4(++_0x9ce96);}(_0x20a4,0x155));var _0x420a=function(_0x5cd925,_0x20a89f){_0x5cd925=_0x5cd925-0x0;var _0x34a72c=_0x20a4[_0x5cd925];return _0x34a72c;};'use strict';var _=require('lodash');var util=require(_0x420a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x420a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x420a('0x2'));var logger=require(_0x420a('0x3'))(_0x420a('0x4'));var config=require(_0x420a('0x5'));var jayson=require(_0x420a('0x6'));var client=jayson[_0x420a('0x7')][_0x420a('0x8')]({'port':0x232a});config[_0x420a('0x9')]=_['defaults'](config[_0x420a('0x9')],{'host':_0x420a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x420a('0xb'))[_0x420a('0xc')](socket);function respondWithRpcPromise(_0x27e52a,_0x4ad16a,_0x1397b1){return new BPromise(function(_0x10331b,_0x21bc66){return client[_0x420a('0xd')](_0x27e52a,_0x1397b1)[_0x420a('0xe')](function(_0x212b34){logger[_0x420a('0xf')](_0x420a('0x10'),_0x4ad16a,_0x420a('0x11'));logger[_0x420a('0x12')](_0x420a('0x13'),_0x4ad16a,_0x420a('0x11'),JSON[_0x420a('0x14')](_0x212b34));if(_0x212b34[_0x420a('0x15')]){if(_0x212b34[_0x420a('0x15')][_0x420a('0x16')]===0x1f4){logger[_0x420a('0x15')](_0x420a('0x10'),_0x4ad16a,_0x212b34['error'][_0x420a('0x17')]);return _0x21bc66(_0x212b34[_0x420a('0x15')][_0x420a('0x17')]);}logger[_0x420a('0x15')](_0x420a('0x10'),_0x4ad16a,_0x212b34[_0x420a('0x15')][_0x420a('0x17')]);return _0x10331b(_0x212b34['error'][_0x420a('0x17')]);}else{logger[_0x420a('0xf')](_0x420a('0x10'),_0x4ad16a,_0x420a('0x11'));_0x10331b(_0x212b34['result'][_0x420a('0x17')]);}})[_0x420a('0x18')](function(_0x5f5220){logger[_0x420a('0x15')](_0x420a('0x10'),_0x4ad16a,_0x5f5220);_0x21bc66(_0x5f5220);});});}exports[_0x420a('0x19')]=function(_0x50add9){var _0x2ed096=this;return new Promise(function(_0x292a7f,_0x187ad1){return db[_0x420a('0x1a')][_0x420a('0x1b')](_0x50add9[_0x420a('0x1c')],{'raw':_0x50add9['options']?_0x50add9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50add9[_0x420a('0x1d')]?_0x50add9['options'][_0x420a('0x1e')]||null:null,'attributes':_0x50add9[_0x420a('0x1d')]?_0x50add9[_0x420a('0x1d')][_0x420a('0x1f')]||null:null,'limit':_0x50add9['options']?_0x50add9['options']['limit']||null:null})[_0x420a('0xe')](function(_0x4f2bed){logger[_0x420a('0xf')]('UpdateChatInteraction',_0x50add9);logger[_0x420a('0x12')](_0x420a('0x19'),_0x50add9,JSON[_0x420a('0x14')](_0x4f2bed));_0x292a7f(_0x4f2bed);})[_0x420a('0x18')](function(_0x46c9a1){logger['error']('UpdateChatInteraction',_0x46c9a1[_0x420a('0x17')],_0x50add9);_0x187ad1(_0x2ed096[_0x420a('0x15')](0x1f4,_0x46c9a1[_0x420a('0x17')]));});});};exports[_0x420a('0x20')]=function(_0x5d1f37){return new Promise(function(_0x20809,_0x199cfa){return db[_0x420a('0x1a')][_0x420a('0x21')]({'where':_0x5d1f37[_0x420a('0x1d')]?_0x5d1f37[_0x420a('0x1d')][_0x420a('0x1e')]||null:null})['then'](function(_0xdab7a9){if(_0xdab7a9){return _0xdab7a9[_0x420a('0x22')](_0x5d1f37[_0x420a('0x1c')][_0x420a('0x23')],_[_0x420a('0x24')](_0x5d1f37[_0x420a('0x1c')],[_0x420a('0x23'),'id'])||{});}})[_0x420a('0x25')](function(_0xa3f2d4){logger[_0x420a('0xf')](_0x420a('0x26'),_0x5d1f37);logger[_0x420a('0x12')]('AddTags',_0x5d1f37,JSON[_0x420a('0x14')](_0xa3f2d4));_0x20809(_0xa3f2d4);})[_0x420a('0x18')](function(_0x47c2f7){logger[_0x420a('0x15')](_0x420a('0x26'),_0x47c2f7[_0x420a('0x17')],_0x5d1f37);_0x199cfa(_this['error'](0x1f4,_0x47c2f7[_0x420a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a3acff6..d128d14 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 _0x4920=['save','update','emit','removeListener','register','chatInteraction:','./chatInteraction.events'];(function(_0x37d67d,_0x6ad517){var _0x5eaf3e=function(_0x454555){while(--_0x454555){_0x37d67d['push'](_0x37d67d['shift']());}};_0x5eaf3e(++_0x6ad517);}(_0x4920,0x14f));var _0x0492=function(_0x10eb54,_0x32c017){_0x10eb54=_0x10eb54-0x0;var _0x8622f1=_0x4920[_0x10eb54];return _0x8622f1;};'use strict';var ChatInteractionEvents=require(_0x0492('0x0'));var events=[_0x0492('0x1'),'remove',_0x0492('0x2')];function createListener(_0xc7efe8,_0x578058){return function(_0x494edc){_0x578058[_0x0492('0x3')](_0xc7efe8,_0x494edc);};}function removeListener(_0x3ec644,_0x19eba8){return function(){ChatInteractionEvents[_0x0492('0x4')](_0x3ec644,_0x19eba8);};}exports[_0x0492('0x5')]=function(_0xe42d95){for(var _0x100910=0x0,_0x390988=events['length'];_0x100910<_0x390988;_0x100910++){var _0x2d40a3=events[_0x100910];var _0x347f3c=createListener(_0x0492('0x6')+_0x2d40a3,_0xe42d95);ChatInteractionEvents['on'](_0x2d40a3,_0x347f3c);}}; \ No newline at end of file +var _0x9028=['./chatInteraction.events','save','update','removeListener','chatInteraction:'];(function(_0x181d06,_0x44bf9f){var _0x2f84a0=function(_0x9afdb2){while(--_0x9afdb2){_0x181d06['push'](_0x181d06['shift']());}};_0x2f84a0(++_0x44bf9f);}(_0x9028,0x16d));var _0x8902=function(_0x14cc92,_0x350557){_0x14cc92=_0x14cc92-0x0;var _0x2c1883=_0x9028[_0x14cc92];return _0x2c1883;};'use strict';var ChatInteractionEvents=require(_0x8902('0x0'));var events=[_0x8902('0x1'),'remove',_0x8902('0x2')];function createListener(_0x3f1a04,_0x878386){return function(_0x230a10){_0x878386['emit'](_0x3f1a04,_0x230a10);};}function removeListener(_0x201ec0,_0xa03ab6){return function(){ChatInteractionEvents[_0x8902('0x3')](_0x201ec0,_0xa03ab6);};}exports['register']=function(_0x1a0785){for(var _0x25c335=0x0,_0x41e8b8=events['length'];_0x25c335<_0x41e8b8;_0x25c335++){var _0x392444=events[_0x25c335];var _0x46d44e=createListener(_0x8902('0x4')+_0x392444,_0x1a0785);ChatInteractionEvents['on'](_0x392444,_0x46d44e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index cc36dee..7685961 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 _0xc288=['addMessage','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/custom_update','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','describe','/:id','show','get','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xc288,0x1e6));var _0x8c28=function(_0x549826,_0x20ac7f){_0x549826=_0x549826-0x0;var _0x1fb6d2=_0xc288[_0x549826];return _0x1fb6d2;};'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[_0x8c28('0x0')]();var fs_extra=require(_0x8c28('0x1'));var auth=require(_0x8c28('0x2'));var interaction=require(_0x8c28('0x3'));var config=require(_0x8c28('0x4'));var controller=require(_0x8c28('0x5'));router['get']('/',auth[_0x8c28('0x6')](),controller[_0x8c28('0x7')]);router['get']('/describe',auth[_0x8c28('0x6')](),controller[_0x8c28('0x8')]);router['get'](_0x8c28('0x9'),auth['isChatInteractionAuthorized'](),controller[_0x8c28('0xa')]);router[_0x8c28('0xb')](_0x8c28('0xc'),auth[_0x8c28('0xd')](),controller[_0x8c28('0xe')]);router['get'](_0x8c28('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x8c28('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x8c28('0x11')]);router[_0x8c28('0xb')](_0x8c28('0x12'),auth[_0x8c28('0x6')](),controller[_0x8c28('0x13')]);router[_0x8c28('0x14')]('/',auth['isAuthenticated'](),controller[_0x8c28('0x15')]);router['post']('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x8c28('0x16')]);var upload=multer({'storage':multer[_0x8c28('0x17')]({'destination':function(_0x1da0f3,_0x5c7520,_0x5a603e){_0x5a603e(null,path[_0x8c28('0x18')](config[_0x8c28('0x19')],_0x8c28('0x1a')));},'filename':function(_0x16f445,_0x4cc173,_0x127e41){_0x127e41(null,util[_0x8c28('0x1b')](_0x8c28('0x1c'),Date[_0x8c28('0x1d')](),_0x4cc173[_0x8c28('0x1e')][_0x8c28('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8c28('0x14')]('/:id/attachment_upload',upload[_0x8c28('0x20')](_0x8c28('0x21')),controller['attachmentUpload']);router[_0x8c28('0x14')](_0x8c28('0xf'),auth[_0x8c28('0xd')](),controller[_0x8c28('0x22')]);router[_0x8c28('0x14')]('/:id/tags',auth[_0x8c28('0x6')](),interaction[_0x8c28('0x23')](_0x8c28('0x24'),_0x8c28('0x25')),controller[_0x8c28('0x26')]);router['put'](_0x8c28('0x9'),auth['isAuthenticated'](),interaction[_0x8c28('0x23')](_0x8c28('0x24'),_0x8c28('0x27')),controller[_0x8c28('0x28')]);router[_0x8c28('0x29')](_0x8c28('0x2a'),controller['customUpdate']);router[_0x8c28('0x29')](_0x8c28('0x2b'),auth[_0x8c28('0xd')](),controller[_0x8c28('0x2c')]);router['put']('/:id/close',controller[_0x8c28('0x2d')]);router[_0x8c28('0x2e')]('/:id',auth['isAuthenticated'](),interaction[_0x8c28('0x23')](_0x8c28('0x24'),_0x8c28('0x2f')),controller[_0x8c28('0x30')]);router[_0x8c28('0x2e')](_0x8c28('0x31'),auth[_0x8c28('0x6')](),controller[_0x8c28('0x32')]);module[_0x8c28('0x33')]=router; \ No newline at end of file +var _0x6f75=['index','get','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/download','post','/:id/vidaoo','diskStorage','join','%s-%s','now','single','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','/:id','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','destroy','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated'];(function(_0x4dfa97,_0x1ff1bd){var _0x1b8036=function(_0x31fe38){while(--_0x31fe38){_0x4dfa97['push'](_0x4dfa97['shift']());}};_0x1b8036(++_0x1ff1bd);}(_0x6f75,0x193));var _0x56f7=function(_0x45d445,_0x395834){_0x45d445=_0x45d445-0x0;var _0x3ba016=_0x6f75[_0x45d445];return _0x3ba016;};'use strict';var multer=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x56f7('0x2'));var auth=require(_0x56f7('0x3'));var interaction=require(_0x56f7('0x4'));var config=require('../../config/environment');var controller=require(_0x56f7('0x5'));router['get']('/',auth[_0x56f7('0x6')](),controller[_0x56f7('0x7')]);router[_0x56f7('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x56f7('0x9')]);router['get']('/:id',auth[_0x56f7('0xa')](),controller[_0x56f7('0xb')]);router['get'](_0x56f7('0xc'),auth[_0x56f7('0xa')](),controller[_0x56f7('0xd')]);router['get'](_0x56f7('0xe'),auth['isAuthenticated'](),controller[_0x56f7('0xf')]);router[_0x56f7('0x8')]('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x56f7('0x8')](_0x56f7('0x10'),auth[_0x56f7('0x6')](),controller['download']);router[_0x56f7('0x11')]('/',auth[_0x56f7('0x6')](),controller['create']);router['post'](_0x56f7('0x12'),auth[_0x56f7('0x6')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x56f7('0x13')]({'destination':function(_0x19dfe1,_0x44373a,_0x396e95){_0x396e95(null,path[_0x56f7('0x14')](config['root'],'server/files/attachments/'));},'filename':function(_0x1644de,_0x4bdfb5,_0x122430){_0x122430(null,util['format'](_0x56f7('0x15'),Date[_0x56f7('0x16')](),_0x4bdfb5['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x56f7('0x11')]('/:id/attachment_upload',upload[_0x56f7('0x17')]('file'),controller['attachmentUpload']);router[_0x56f7('0x11')](_0x56f7('0xe'),auth[_0x56f7('0xa')](),controller[_0x56f7('0x18')]);router[_0x56f7('0x11')](_0x56f7('0x19'),auth['isAuthenticated'](),interaction['tracked'](_0x56f7('0x1a'),_0x56f7('0x1b')),controller[_0x56f7('0x1c')]);router[_0x56f7('0x1d')](_0x56f7('0x1e'),auth[_0x56f7('0x6')](),interaction[_0x56f7('0x1f')](_0x56f7('0x1a'),_0x56f7('0x20')),controller[_0x56f7('0x21')]);router[_0x56f7('0x1d')](_0x56f7('0x22'),controller[_0x56f7('0x23')]);router[_0x56f7('0x1d')](_0x56f7('0x24'),auth[_0x56f7('0xa')](),controller[_0x56f7('0x25')]);router[_0x56f7('0x1d')](_0x56f7('0x26'),controller['close']);router[_0x56f7('0x27')](_0x56f7('0x1e'),auth[_0x56f7('0x6')](),interaction[_0x56f7('0x1f')](_0x56f7('0x1a'),'chatinteraction:destroy'),controller[_0x56f7('0x28')]);router[_0x56f7('0x27')](_0x56f7('0x19'),auth[_0x56f7('0x6')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index b15ebef..a8ba000 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 _0x598b=['BOOLEAN','INTEGER','sequelize','TEXT'];(function(_0x3a23b4,_0x49d839){var _0x302bca=function(_0x5e478f){while(--_0x5e478f){_0x3a23b4['push'](_0x3a23b4['shift']());}};_0x302bca(++_0x49d839);}(_0x598b,0x132));var _0xb598=function(_0x40dfda,_0x4cc1b5){_0x40dfda=_0x40dfda-0x0;var _0x4e6be7=_0x598b[_0x40dfda];return _0x4e6be7;};'use strict';var Sequelize=require(_0xb598('0x0'));module['exports']={'body':{'type':Sequelize[_0xb598('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb598('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb598('0x3')]}}; \ No newline at end of file +var _0xcad1=['exports','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x2e1906,_0xa281e9){var _0x3ea10e=function(_0x19749){while(--_0x19749){_0x2e1906['push'](_0x2e1906['shift']());}};_0x3ea10e(++_0xa281e9);}(_0xcad1,0xb8));var _0x1cad=function(_0x15c2ce,_0x31cc5a){_0x15c2ce=_0x15c2ce-0x0;var _0x4aaba2=_0xcad1[_0x15c2ce];return _0x4aaba2;};'use strict';var Sequelize=require(_0x1cad('0x0'));module[_0x1cad('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1cad('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1cad('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1cad('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 24a6086..656ffda 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 _0x0ab0=['map','ChatInternalMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','get','messages','lastMessageAt','createdAt','format','lastMessage','getUsers','User','agent','admin','user','fullname','internal','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','all','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x0ab0,0x180));var _0x00ab=function(_0x245d73,_0x314faa){_0x245d73=_0x245d73-0x0;var _0x56ef67=_0x0ab0[_0x245d73];return _0x56ef67;};'use strict';var emlformat=require(_0x00ab('0x0'));var rimraf=require(_0x00ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00ab('0x2'));var rp=require(_0x00ab('0x3'));var moment=require(_0x00ab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x00ab('0x5'));var util=require('util');var path=require(_0x00ab('0x6'));var sox=require(_0x00ab('0x7'));var csv=require(_0x00ab('0x8'));var ejs=require(_0x00ab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x00ab('0xa'));var squel=require('squel');var crypto=require(_0x00ab('0xb'));var jsforce=require(_0x00ab('0xc'));var deskjs=require(_0x00ab('0xd'));var toCsv=require(_0x00ab('0x8'));var querystring=require(_0x00ab('0xe'));var Papa=require(_0x00ab('0xf'));var Redis=require('ioredis');var authService=require(_0x00ab('0x10'));var qs=require(_0x00ab('0x11'));var as=require(_0x00ab('0x12'));var hardwareService=require(_0x00ab('0x13'));var logger=require(_0x00ab('0x14'))(_0x00ab('0x15'));var utils=require(_0x00ab('0x16'));var config=require(_0x00ab('0x17'));var licenseUtil=require(_0x00ab('0x18'));var db=require(_0x00ab('0x19'))['db'];config[_0x00ab('0x1a')]=_[_0x00ab('0x1b')](config[_0x00ab('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x00ab('0x1c'))(new Redis(config[_0x00ab('0x1a')]));require(_0x00ab('0x1d'))['register'](socket);function respondWithStatusCode(_0x1ca8ed,_0x3bf89b){_0x3bf89b=_0x3bf89b||0xcc;return function(_0x37bd40){if(_0x37bd40){return _0x1ca8ed[_0x00ab('0x1e')](_0x3bf89b);}return _0x1ca8ed['status'](_0x3bf89b)[_0x00ab('0x1f')]();};}function respondWithResult(_0x4f602d,_0x3b0fc1){_0x3b0fc1=_0x3b0fc1||0xc8;return function(_0x4b3925){if(_0x4b3925){return _0x4f602d[_0x00ab('0x20')](_0x3b0fc1)[_0x00ab('0x21')](_0x4b3925);}};}function respondWithFilteredResult(_0xf56992,_0x4e7d8b){return function(_0x30681c){if(_0x30681c){var _0x5101b2=typeof _0x4e7d8b[_0x00ab('0x22')]===_0x00ab('0x23')&&typeof _0x4e7d8b['limit']===_0x00ab('0x23');var _0x40c2d4=_0x30681c['count'];var _0x191688=_0x5101b2?0x0:_0x4e7d8b[_0x00ab('0x22')];var _0x56609b=_0x5101b2?_0x30681c[_0x00ab('0x24')]:_0x4e7d8b['offset']+_0x4e7d8b['limit'];var _0x3b7a42;if(_0x56609b>=_0x40c2d4){_0x56609b=_0x40c2d4;_0x3b7a42=0xc8;}else{_0x3b7a42=0xce;}_0xf56992[_0x00ab('0x20')](_0x3b7a42);return _0xf56992['set'](_0x00ab('0x25'),_0x191688+'-'+_0x56609b+'/'+_0x40c2d4)[_0x00ab('0x21')](_0x30681c);}return null;};}function patchUpdates(_0xa8d511){return function(_0x37b8ba){try{jsonpatch[_0x00ab('0x26')](_0x37b8ba,_0xa8d511,!![]);}catch(_0x5da797){return BPromise[_0x00ab('0x27')](_0x5da797);}return _0x37b8ba[_0x00ab('0x28')]();};}function saveUpdates(_0x15c88d,_0x964e34){return function(_0x4d10ec){if(_0x4d10ec){return _0x4d10ec[_0x00ab('0x29')](_0x15c88d)[_0x00ab('0x2a')](function(_0x1eb957){return _0x1eb957;});}return null;};}function removeEntity(_0x1d2e0b,_0x52bc82){return function(_0x2f1e3d){if(_0x2f1e3d){return _0x2f1e3d[_0x00ab('0x2b')]()[_0x00ab('0x2a')](function(){_0x1d2e0b[_0x00ab('0x20')](0xcc)[_0x00ab('0x1f')]();});}};}function handleEntityNotFound(_0x5bb0c5,_0x2a4fcc){return function(_0x5c9d01){if(!_0x5c9d01){_0x5bb0c5[_0x00ab('0x1e')](0x194);}return _0x5c9d01;};}function handleError(_0x5d7191,_0x47926c){_0x47926c=_0x47926c||0x1f4;return function(_0x152b4d){logger['error'](_0x152b4d[_0x00ab('0x2c')]);if(_0x152b4d[_0x00ab('0x2d')]){delete _0x152b4d[_0x00ab('0x2d')];}_0x5d7191['status'](_0x47926c)[_0x00ab('0x2e')](_0x152b4d);};}exports[_0x00ab('0x2f')]=function(_0x1699e6,_0x2f2ed3){var _0x42a09c={},_0x24cbc5={},_0x27f0c8={'count':0x0,'rows':[]};var _0x1b6981=_[_0x00ab('0x30')](db[_0x00ab('0x31')][_0x00ab('0x32')],function(_0x1439fe){return{'name':_0x1439fe['fieldName'],'type':_0x1439fe[_0x00ab('0x33')]['key']};});_0x24cbc5[_0x00ab('0x34')]=_[_0x00ab('0x30')](_0x1b6981,_0x00ab('0x2d'));_0x24cbc5[_0x00ab('0x35')]=_[_0x00ab('0x36')](_0x1699e6[_0x00ab('0x35')]);_0x24cbc5[_0x00ab('0x37')]=_[_0x00ab('0x38')](_0x24cbc5[_0x00ab('0x34')],_0x24cbc5[_0x00ab('0x35')]);_0x42a09c[_0x00ab('0x39')]=_['intersection'](_0x24cbc5['model'],qs[_0x00ab('0x3a')](_0x1699e6[_0x00ab('0x35')][_0x00ab('0x3a')]));_0x42a09c[_0x00ab('0x39')]=_0x42a09c[_0x00ab('0x39')][_0x00ab('0x3b')]?_0x42a09c['attributes']:_0x24cbc5[_0x00ab('0x34')];if(!_0x1699e6[_0x00ab('0x35')][_0x00ab('0x3c')](_0x00ab('0x3d'))){_0x42a09c[_0x00ab('0x3e')]=qs[_0x00ab('0x3e')](_0x1699e6[_0x00ab('0x35')][_0x00ab('0x3e')]);_0x42a09c[_0x00ab('0x22')]=qs[_0x00ab('0x22')](_0x1699e6[_0x00ab('0x35')][_0x00ab('0x22')]);}_0x42a09c['order']=qs[_0x00ab('0x3f')](_0x1699e6[_0x00ab('0x35')][_0x00ab('0x3f')]);_0x42a09c['where']=qs[_0x00ab('0x37')](_['pick'](_0x1699e6[_0x00ab('0x35')],_0x24cbc5['filters']),_0x1b6981);if(_0x1699e6[_0x00ab('0x35')][_0x00ab('0x40')]){_0x42a09c[_0x00ab('0x41')]=_[_0x00ab('0x42')](_0x42a09c[_0x00ab('0x41')],{'$or':_[_0x00ab('0x30')](_0x1b6981,function(_0x4fc32d){if(_0x4fc32d[_0x00ab('0x33')]!==_0x00ab('0x43')){var _0x401013={};_0x401013[_0x4fc32d[_0x00ab('0x2d')]]={'$like':'%'+_0x1699e6[_0x00ab('0x35')][_0x00ab('0x40')]+'%'};return _0x401013;}})});}_0x42a09c=_[_0x00ab('0x42')]({},_0x42a09c,_0x1699e6[_0x00ab('0x44')]);var _0x2164ea={'where':_0x42a09c['where']};return db['ChatInternalMessage']['count'](_0x2164ea)[_0x00ab('0x2a')](function(_0x35ce24){_0x27f0c8['count']=_0x35ce24;if(_0x1699e6[_0x00ab('0x35')][_0x00ab('0x45')]){_0x42a09c[_0x00ab('0x46')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x00ab('0x47')](_0x42a09c);})[_0x00ab('0x2a')](function(_0x502e37){_0x27f0c8[_0x00ab('0x48')]=_0x502e37;return _0x27f0c8;})[_0x00ab('0x2a')](respondWithFilteredResult(_0x2f2ed3,_0x42a09c))[_0x00ab('0x49')](handleError(_0x2f2ed3,null));};exports['show']=function(_0x2a4d30,_0x288699){var _0x4b3b5f={'raw':!![],'where':{'id':_0x2a4d30[_0x00ab('0x4a')]['id']}},_0x234769={};_0x234769[_0x00ab('0x34')]=_[_0x00ab('0x36')](db['ChatInternalMessage'][_0x00ab('0x32')]);_0x234769[_0x00ab('0x35')]=_['keys'](_0x2a4d30[_0x00ab('0x35')]);_0x234769['filters']=_[_0x00ab('0x38')](_0x234769[_0x00ab('0x34')],_0x234769[_0x00ab('0x35')]);_0x4b3b5f[_0x00ab('0x39')]=_[_0x00ab('0x38')](_0x234769[_0x00ab('0x34')],qs[_0x00ab('0x3a')](_0x2a4d30[_0x00ab('0x35')]['fields']));_0x4b3b5f[_0x00ab('0x39')]=_0x4b3b5f[_0x00ab('0x39')][_0x00ab('0x3b')]?_0x4b3b5f[_0x00ab('0x39')]:_0x234769[_0x00ab('0x34')];if(_0x2a4d30[_0x00ab('0x35')][_0x00ab('0x45')]){_0x4b3b5f['include']=[{'all':!![]}];}_0x4b3b5f=_[_0x00ab('0x42')]({},_0x4b3b5f,_0x2a4d30[_0x00ab('0x44')]);return db[_0x00ab('0x31')][_0x00ab('0x4b')](_0x4b3b5f)[_0x00ab('0x2a')](handleEntityNotFound(_0x288699,null))['then'](respondWithResult(_0x288699,null))[_0x00ab('0x49')](handleError(_0x288699,null));};exports[_0x00ab('0x4c')]=function(_0x1aafa9,_0x4e2e9c){return db[_0x00ab('0x31')][_0x00ab('0x4c')](_0x1aafa9[_0x00ab('0x4d')],{})['then'](respondWithResult(_0x4e2e9c,0xc9))[_0x00ab('0x49')](handleError(_0x4e2e9c,null));};exports['update']=function(_0x4ce71c,_0x27c36c){if(_0x4ce71c[_0x00ab('0x4d')]['id']){delete _0x4ce71c[_0x00ab('0x4d')]['id'];}return db[_0x00ab('0x31')][_0x00ab('0x4b')]({'where':{'id':_0x4ce71c[_0x00ab('0x4a')]['id']}})[_0x00ab('0x2a')](handleEntityNotFound(_0x27c36c,null))[_0x00ab('0x2a')](saveUpdates(_0x4ce71c[_0x00ab('0x4d')],null))[_0x00ab('0x2a')](respondWithResult(_0x27c36c,null))[_0x00ab('0x49')](handleError(_0x27c36c,null));};exports[_0x00ab('0x2b')]=function(_0x26d6aa,_0x2678cd){return db[_0x00ab('0x31')][_0x00ab('0x4b')]({'where':{'id':_0x26d6aa[_0x00ab('0x4a')]['id']}})[_0x00ab('0x2a')](handleEntityNotFound(_0x2678cd,null))['then'](removeEntity(_0x2678cd,null))['catch'](handleError(_0x2678cd,null));};exports[_0x00ab('0x4e')]=function(_0x4d46b1,_0x19417f){return db[_0x00ab('0x31')][_0x00ab('0x4e')]()[_0x00ab('0x2a')](respondWithResult(_0x19417f,null))[_0x00ab('0x49')](handleError(_0x19417f,null));};function wrapUser(_0x307cff){return function(_0xf099b0){var _0x4cd136=_0x307cff[_0x00ab('0x4f')]({'plain':!![]});_0x4cd136[_0x00ab('0x50')]=[];if(_0xf099b0){_0x4cd136[_0x00ab('0x51')]=_0xf099b0[_0x00ab('0x52')];_0x4cd136['lastMessage']=_0xf099b0;}else{_0x4cd136[_0x00ab('0x51')]=moment(0x0)[_0x00ab('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x4cd136[_0x00ab('0x54')]={};}return _0x4cd136;};}exports[_0x00ab('0x55')]=function(_0x2ed2e5,_0x1f9f1f,_0x42943f){var _0x51931c=[];return db[_0x00ab('0x56')][_0x00ab('0x47')]({'where':{'role':[_0x00ab('0x57'),_0x00ab('0x58'),_0x00ab('0x59')]},'attributes':['id',_0x00ab('0x5a'),_0x00ab('0x2d'),'role','userpic',_0x00ab('0x5b'),'online','lastLoginAt','allowmessenger',_0x00ab('0x5c')],'order':qs[_0x00ab('0x3f')](_0x00ab('0x5d')),'include':[{'model':db[_0x00ab('0x5e')],'as':_0x00ab('0x5f'),'attributes':['id',_0x00ab('0x2d'),_0x00ab('0x33')],'through':{'attributes':[]}}]})['then'](function(_0x50094c){if(_0x50094c){var _0x38de85=_0x2ed2e5['user']['get']({'plain':!![]});if(!_0x38de85)throw new Error(_0x00ab('0x60'));if(_0x38de85[_0x00ab('0x61')]===_0x00ab('0x59')){return db[_0x00ab('0x62')][_0x00ab('0x4b')]({'where':{'name':_0x00ab('0x63'),'userProfileId':_0x38de85['userProfileId']},'raw':!![]})[_0x00ab('0x2a')](function(_0x250ce0){if(_0x250ce0){if(_0x250ce0[_0x00ab('0x64')]===0x0){return db[_0x00ab('0x65')][_0x00ab('0x47')]({'where':{'sectionId':_0x250ce0['id']},'raw':!![]})[_0x00ab('0x2a')](function(_0x1486d7){var _0x26b98a=[];if(_[_0x00ab('0x66')](_0x1486d7)){_0x26b98a=_[_0x00ab('0x40')](_0x50094c,function(_0x2d6b9b){if(_0x2d6b9b[_0x00ab('0x61')]!==_0x00ab('0x57')){return _0x2d6b9b;}});return _0x26b98a;}else{for(var _0x5cbc4d=0x0;_0x5cbc4d<_0x50094c[_0x00ab('0x3b')];_0x5cbc4d++){var _0x66221b=_0x50094c[_0x5cbc4d];if(_0x66221b[_0x00ab('0x61')]===_0x00ab('0x57')){var _0x5c0e50=_[_0x00ab('0x4b')](_0x1486d7,function(_0x3091ad){return _0x3091ad[_0x00ab('0x67')]===_0x66221b['id'];});if(_0x5c0e50)_0x26b98a[_0x00ab('0x68')](_0x66221b);}else{_0x26b98a[_0x00ab('0x68')](_0x66221b);}}return _0x26b98a;}});}else{return _0x50094c;}}else{var _0x5c7438=_['filter'](_0x50094c,function(_0x1867bc){if(_0x1867bc[_0x00ab('0x61')]!=='agent'){return _0x1867bc;}});return _0x5c7438;}});}else{return _0x50094c;}}})[_0x00ab('0x2a')](function(_0x4cff5a){var _0x1b7518=[];if(_0x4cff5a){_0x51931c=_0x4cff5a;for(var _0x2f2663=0x0;_0x2f2663<_0x4cff5a[_0x00ab('0x3b')];_0x2f2663+=0x1){_0x51931c[_0x2f2663][_0x00ab('0x50')]=[];_0x1b7518[_0x00ab('0x68')](db[_0x00ab('0x31')][_0x00ab('0x4b')]({'where':{'FromId':[_0x2ed2e5[_0x00ab('0x59')]['id'],_0x4cff5a[_0x2f2663]['id']],'ToId':[_0x2ed2e5[_0x00ab('0x59')]['id'],_0x4cff5a[_0x2f2663]['id']],'ChatGroupId':null},'attributes':['id',_0x00ab('0x52'),_0x00ab('0x69'),'ToId',_0x00ab('0x6a'),_0x00ab('0x4d')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x00ab('0x2a')](wrapUser(_0x4cff5a[_0x2f2663])));}return BPromise[_0x00ab('0x6b')](_0x1b7518);}return[];})['then'](function(_0x46b7da){return{'rows':_0x46b7da,'count':_0x46b7da['length']};})['then'](respondWithResult(_0x1f9f1f,null))[_0x00ab('0x49')](handleError(_0x1f9f1f,null));}; \ No newline at end of file +var _0x68b8=['VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','create','body','find','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','push','FromId','ToId','-createdAt','all','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','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','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type'];(function(_0x534063,_0x570103){var _0x3797a9=function(_0x3ddb76){while(--_0x3ddb76){_0x534063['push'](_0x534063['shift']());}};_0x3797a9(++_0x570103);}(_0x68b8,0xfe));var _0x868b=function(_0x300c89,_0x25fcad){_0x300c89=_0x300c89-0x0;var _0x41762e=_0x68b8[_0x300c89];return _0x41762e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x868b('0x0'));var zipdir=require(_0x868b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x868b('0x2'));var moment=require(_0x868b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x868b('0x4'));var util=require(_0x868b('0x5'));var path=require(_0x868b('0x6'));var sox=require('sox');var csv=require(_0x868b('0x7'));var ejs=require(_0x868b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x868b('0x9'));var crypto=require(_0x868b('0xa'));var jsforce=require(_0x868b('0xb'));var deskjs=require(_0x868b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x868b('0xd'));var Papa=require(_0x868b('0xe'));var Redis=require(_0x868b('0xf'));var authService=require(_0x868b('0x10'));var qs=require(_0x868b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x868b('0x12'));var logger=require(_0x868b('0x13'))(_0x868b('0x14'));var utils=require('../../config/utils');var config=require(_0x868b('0x15'));var licenseUtil=require(_0x868b('0x16'));var db=require('../../mysqldb')['db'];config[_0x868b('0x17')]=_[_0x868b('0x18')](config[_0x868b('0x17')],{'host':_0x868b('0x19'),'port':0x18eb});var socket=require(_0x868b('0x1a'))(new Redis(config[_0x868b('0x17')]));require(_0x868b('0x1b'))[_0x868b('0x1c')](socket);function respondWithStatusCode(_0x47222f,_0x2ab9df){_0x2ab9df=_0x2ab9df||0xcc;return function(_0x24e6fc){if(_0x24e6fc){return _0x47222f[_0x868b('0x1d')](_0x2ab9df);}return _0x47222f[_0x868b('0x1e')](_0x2ab9df)[_0x868b('0x1f')]();};}function respondWithResult(_0x5a7af0,_0x457206){_0x457206=_0x457206||0xc8;return function(_0x47adf0){if(_0x47adf0){return _0x5a7af0[_0x868b('0x1e')](_0x457206)[_0x868b('0x20')](_0x47adf0);}};}function respondWithFilteredResult(_0x723c43,_0x1ab26d){return function(_0x5df215){if(_0x5df215){var _0x51912c=typeof _0x1ab26d[_0x868b('0x21')]===_0x868b('0x22')&&typeof _0x1ab26d[_0x868b('0x23')]===_0x868b('0x22');var _0x59e3a2=_0x5df215[_0x868b('0x24')];var _0x22e1f6=_0x51912c?0x0:_0x1ab26d[_0x868b('0x21')];var _0x19fb7a=_0x51912c?_0x5df215['count']:_0x1ab26d[_0x868b('0x21')]+_0x1ab26d[_0x868b('0x23')];var _0x57643c;if(_0x19fb7a>=_0x59e3a2){_0x19fb7a=_0x59e3a2;_0x57643c=0xc8;}else{_0x57643c=0xce;}_0x723c43[_0x868b('0x1e')](_0x57643c);return _0x723c43['set']('Content-Range',_0x22e1f6+'-'+_0x19fb7a+'/'+_0x59e3a2)['json'](_0x5df215);}return null;};}function patchUpdates(_0x3cd341){return function(_0x28f3f8){try{jsonpatch[_0x868b('0x25')](_0x28f3f8,_0x3cd341,!![]);}catch(_0x4e7141){return BPromise[_0x868b('0x26')](_0x4e7141);}return _0x28f3f8[_0x868b('0x27')]();};}function saveUpdates(_0x38717e,_0x635c66){return function(_0x20cf33){if(_0x20cf33){return _0x20cf33['update'](_0x38717e)[_0x868b('0x28')](function(_0x2843df){return _0x2843df;});}return null;};}function removeEntity(_0x41921e,_0x51e21c){return function(_0x4691df){if(_0x4691df){return _0x4691df[_0x868b('0x29')]()[_0x868b('0x28')](function(){_0x41921e[_0x868b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x213edf,_0x55c299){return function(_0x5aab1a){if(!_0x5aab1a){_0x213edf[_0x868b('0x1d')](0x194);}return _0x5aab1a;};}function handleError(_0x92c20b,_0xfd2c95){_0xfd2c95=_0xfd2c95||0x1f4;return function(_0x5a6d2c){logger[_0x868b('0x2a')](_0x5a6d2c[_0x868b('0x2b')]);if(_0x5a6d2c['name']){delete _0x5a6d2c[_0x868b('0x2c')];}_0x92c20b['status'](_0xfd2c95)[_0x868b('0x2d')](_0x5a6d2c);};}exports['index']=function(_0x25d266,_0x3a06d1){var _0x2f273d={},_0x3d3338={},_0x982034={'count':0x0,'rows':[]};var _0x6b3a1b=_['map'](db[_0x868b('0x2e')][_0x868b('0x2f')],function(_0xe5e483){return{'name':_0xe5e483[_0x868b('0x30')],'type':_0xe5e483['type'][_0x868b('0x31')]};});_0x3d3338['model']=_[_0x868b('0x32')](_0x6b3a1b,_0x868b('0x2c'));_0x3d3338[_0x868b('0x33')]=_[_0x868b('0x34')](_0x25d266[_0x868b('0x33')]);_0x3d3338[_0x868b('0x35')]=_[_0x868b('0x36')](_0x3d3338[_0x868b('0x37')],_0x3d3338[_0x868b('0x33')]);_0x2f273d[_0x868b('0x38')]=_[_0x868b('0x36')](_0x3d3338[_0x868b('0x37')],qs[_0x868b('0x39')](_0x25d266[_0x868b('0x33')][_0x868b('0x39')]));_0x2f273d[_0x868b('0x38')]=_0x2f273d['attributes'][_0x868b('0x3a')]?_0x2f273d['attributes']:_0x3d3338[_0x868b('0x37')];if(!_0x25d266[_0x868b('0x33')][_0x868b('0x3b')](_0x868b('0x3c'))){_0x2f273d[_0x868b('0x23')]=qs[_0x868b('0x23')](_0x25d266['query'][_0x868b('0x23')]);_0x2f273d[_0x868b('0x21')]=qs[_0x868b('0x21')](_0x25d266[_0x868b('0x33')][_0x868b('0x21')]);}_0x2f273d[_0x868b('0x3d')]=qs[_0x868b('0x3e')](_0x25d266[_0x868b('0x33')][_0x868b('0x3e')]);_0x2f273d[_0x868b('0x3f')]=qs['filters'](_[_0x868b('0x40')](_0x25d266[_0x868b('0x33')],_0x3d3338[_0x868b('0x35')]),_0x6b3a1b);if(_0x25d266[_0x868b('0x33')][_0x868b('0x41')]){_0x2f273d[_0x868b('0x3f')]=_['merge'](_0x2f273d[_0x868b('0x3f')],{'$or':_[_0x868b('0x32')](_0x6b3a1b,function(_0x49b493){if(_0x49b493[_0x868b('0x42')]!==_0x868b('0x43')){var _0x3d64a1={};_0x3d64a1[_0x49b493[_0x868b('0x2c')]]={'$like':'%'+_0x25d266[_0x868b('0x33')][_0x868b('0x41')]+'%'};return _0x3d64a1;}})});}_0x2f273d=_[_0x868b('0x44')]({},_0x2f273d,_0x25d266['options']);var _0x4a43cd={'where':_0x2f273d[_0x868b('0x3f')]};return db[_0x868b('0x2e')][_0x868b('0x24')](_0x4a43cd)[_0x868b('0x28')](function(_0x194547){_0x982034[_0x868b('0x24')]=_0x194547;if(_0x25d266[_0x868b('0x33')][_0x868b('0x45')]){_0x2f273d[_0x868b('0x46')]=[{'all':!![]}];}return db[_0x868b('0x2e')][_0x868b('0x47')](_0x2f273d);})[_0x868b('0x28')](function(_0x5b6f97){_0x982034[_0x868b('0x48')]=_0x5b6f97;return _0x982034;})['then'](respondWithFilteredResult(_0x3a06d1,_0x2f273d))[_0x868b('0x49')](handleError(_0x3a06d1,null));};exports['show']=function(_0x4c4916,_0x3b97ad){var _0x79be97={'raw':!![],'where':{'id':_0x4c4916[_0x868b('0x4a')]['id']}},_0xb24a60={};_0xb24a60[_0x868b('0x37')]=_[_0x868b('0x34')](db[_0x868b('0x2e')][_0x868b('0x2f')]);_0xb24a60['query']=_['keys'](_0x4c4916[_0x868b('0x33')]);_0xb24a60[_0x868b('0x35')]=_[_0x868b('0x36')](_0xb24a60['model'],_0xb24a60[_0x868b('0x33')]);_0x79be97[_0x868b('0x38')]=_['intersection'](_0xb24a60[_0x868b('0x37')],qs['fields'](_0x4c4916[_0x868b('0x33')][_0x868b('0x39')]));_0x79be97[_0x868b('0x38')]=_0x79be97[_0x868b('0x38')][_0x868b('0x3a')]?_0x79be97[_0x868b('0x38')]:_0xb24a60[_0x868b('0x37')];if(_0x4c4916[_0x868b('0x33')][_0x868b('0x45')]){_0x79be97[_0x868b('0x46')]=[{'all':!![]}];}_0x79be97=_[_0x868b('0x44')]({},_0x79be97,_0x4c4916['options']);return db[_0x868b('0x2e')]['find'](_0x79be97)[_0x868b('0x28')](handleEntityNotFound(_0x3b97ad,null))[_0x868b('0x28')](respondWithResult(_0x3b97ad,null))[_0x868b('0x49')](handleError(_0x3b97ad,null));};exports[_0x868b('0x4b')]=function(_0x3222ae,_0x589a34){return db['ChatInternalMessage'][_0x868b('0x4b')](_0x3222ae[_0x868b('0x4c')],{})[_0x868b('0x28')](respondWithResult(_0x589a34,0xc9))['catch'](handleError(_0x589a34,null));};exports['update']=function(_0x14acae,_0x16801e){if(_0x14acae[_0x868b('0x4c')]['id']){delete _0x14acae[_0x868b('0x4c')]['id'];}return db[_0x868b('0x2e')][_0x868b('0x4d')]({'where':{'id':_0x14acae['params']['id']}})[_0x868b('0x28')](handleEntityNotFound(_0x16801e,null))[_0x868b('0x28')](saveUpdates(_0x14acae['body'],null))[_0x868b('0x28')](respondWithResult(_0x16801e,null))[_0x868b('0x49')](handleError(_0x16801e,null));};exports[_0x868b('0x29')]=function(_0x2ee78e,_0x1ebc30){return db[_0x868b('0x2e')]['find']({'where':{'id':_0x2ee78e[_0x868b('0x4a')]['id']}})[_0x868b('0x28')](handleEntityNotFound(_0x1ebc30,null))[_0x868b('0x28')](removeEntity(_0x1ebc30,null))[_0x868b('0x49')](handleError(_0x1ebc30,null));};exports['describe']=function(_0x3c69eb,_0x202594){return db[_0x868b('0x2e')]['describe']()[_0x868b('0x28')](respondWithResult(_0x202594,null))[_0x868b('0x49')](handleError(_0x202594,null));};function wrapUser(_0xfb1a53){return function(_0x3373b5){var _0x1928f1=_0xfb1a53['get']({'plain':!![]});_0x1928f1[_0x868b('0x4e')]=[];if(_0x3373b5){_0x1928f1[_0x868b('0x4f')]=_0x3373b5[_0x868b('0x50')];_0x1928f1['lastMessage']=_0x3373b5;}else{_0x1928f1[_0x868b('0x4f')]=moment(0x0)[_0x868b('0x51')](_0x868b('0x52'));_0x1928f1['lastMessage']={};}return _0x1928f1;};}exports[_0x868b('0x53')]=function(_0x344c6f,_0x27d142,_0x2459b8){var _0x5f1863=[];return db[_0x868b('0x54')][_0x868b('0x47')]({'where':{'role':[_0x868b('0x55'),_0x868b('0x56'),_0x868b('0x57')]},'attributes':['id','fullname',_0x868b('0x2c'),_0x868b('0x58'),_0x868b('0x59'),'internal',_0x868b('0x5a'),_0x868b('0x5b'),_0x868b('0x5c'),_0x868b('0x5d')],'order':qs['sort'](_0x868b('0x5e')),'include':[{'model':db[_0x868b('0x5f')],'as':_0x868b('0x60'),'attributes':['id',_0x868b('0x2c'),'type'],'through':{'attributes':[]}}]})[_0x868b('0x28')](function(_0x1cf90b){if(_0x1cf90b){var _0x4c46ee=_0x344c6f[_0x868b('0x57')]['get']({'plain':!![]});if(!_0x4c46ee)throw new Error(_0x868b('0x61'));if(_0x4c46ee[_0x868b('0x58')]===_0x868b('0x57')){return db['UserProfileSection'][_0x868b('0x4d')]({'where':{'name':_0x868b('0x62'),'userProfileId':_0x4c46ee[_0x868b('0x63')]},'raw':!![]})[_0x868b('0x28')](function(_0x16d0de){if(_0x16d0de){if(_0x16d0de[_0x868b('0x64')]===0x0){return db[_0x868b('0x65')][_0x868b('0x47')]({'where':{'sectionId':_0x16d0de['id']},'raw':!![]})[_0x868b('0x28')](function(_0x1822c9){var _0x493152=[];if(_['isEmpty'](_0x1822c9)){_0x493152=_[_0x868b('0x41')](_0x1cf90b,function(_0x1cf3eb){if(_0x1cf3eb[_0x868b('0x58')]!==_0x868b('0x55')){return _0x1cf3eb;}});return _0x493152;}else{for(var _0x119e49=0x0;_0x119e49<_0x1cf90b[_0x868b('0x3a')];_0x119e49++){var _0x597d83=_0x1cf90b[_0x119e49];if(_0x597d83[_0x868b('0x58')]==='agent'){var _0x4a1b2c=_[_0x868b('0x4d')](_0x1822c9,function(_0x7a50f0){return _0x7a50f0['resourceId']===_0x597d83['id'];});if(_0x4a1b2c)_0x493152['push'](_0x597d83);}else{_0x493152['push'](_0x597d83);}}return _0x493152;}});}else{return _0x1cf90b;}}else{var _0x234f46=_['filter'](_0x1cf90b,function(_0x104320){if(_0x104320['role']!==_0x868b('0x55')){return _0x104320;}});return _0x234f46;}});}else{return _0x1cf90b;}}})[_0x868b('0x28')](function(_0x5ca81a){var _0x1271d5=[];if(_0x5ca81a){_0x5f1863=_0x5ca81a;for(var _0x55ae56=0x0;_0x55ae56<_0x5ca81a[_0x868b('0x3a')];_0x55ae56+=0x1){_0x5f1863[_0x55ae56][_0x868b('0x4e')]=[];_0x1271d5[_0x868b('0x66')](db[_0x868b('0x2e')][_0x868b('0x4d')]({'where':{'FromId':[_0x344c6f[_0x868b('0x57')]['id'],_0x5ca81a[_0x55ae56]['id']],'ToId':[_0x344c6f[_0x868b('0x57')]['id'],_0x5ca81a[_0x55ae56]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x868b('0x67'),_0x868b('0x68'),'read',_0x868b('0x4c')],'order':qs[_0x868b('0x3e')](_0x868b('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5ca81a[_0x55ae56])));}return BPromise[_0x868b('0x6a')](_0x1271d5);}return[];})[_0x868b('0x28')](function(_0x2b3691){return{'rows':_0x2b3691,'count':_0x2b3691[_0x868b('0x3a')]};})['then'](respondWithResult(_0x27d142,null))[_0x868b('0x49')](handleError(_0x27d142,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 13ee0a1..8ac8a8a 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 _0xadcf=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xadcf,0xbf));var _0xfadc=function(_0x16b1b8,_0x432d03){_0x16b1b8=_0x16b1b8-0x0;var _0x558b1e=_0xadcf[_0x16b1b8];return _0x558b1e;};'use strict';var EventEmitter=require(_0xfadc('0x0'));var ChatInternalMessage=require(_0xfadc('0x1'))['db'][_0xfadc('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xfadc('0x3')](0x0);var events={'afterCreate':_0xfadc('0x4'),'afterUpdate':_0xfadc('0x5'),'afterDestroy':_0xfadc('0x6')};function emitEvent(_0x1c3c34){return function(_0x38f816,_0x398a54,_0xb188cf){ChatInternalMessageEvents[_0xfadc('0x7')](_0x1c3c34+':'+_0x38f816['id'],_0x38f816);ChatInternalMessageEvents[_0xfadc('0x7')](_0x1c3c34,_0x38f816);_0xb188cf(null);};}for(var e in events){if(events[_0xfadc('0x8')](e)){var event=events[e];ChatInternalMessage[_0xfadc('0x9')](e,emitEvent(event));}}module[_0xfadc('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe354=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1d9163,_0x79567d){var _0xb42197=function(_0x3818e8){while(--_0x3818e8){_0x1d9163['push'](_0x1d9163['shift']());}};_0xb42197(++_0x79567d);}(_0xe354,0x12d));var _0x4e35=function(_0x523d55,_0x4f0259){_0x523d55=_0x523d55-0x0;var _0x2c2bc8=_0xe354[_0x523d55];return _0x2c2bc8;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4e35('0x0')](0x0);var events={'afterCreate':_0x4e35('0x1'),'afterUpdate':_0x4e35('0x2'),'afterDestroy':_0x4e35('0x3')};function emitEvent(_0x26446f){return function(_0x2f1ae3,_0x47368b,_0x506d9c){ChatInternalMessageEvents[_0x4e35('0x4')](_0x26446f+':'+_0x2f1ae3['id'],_0x2f1ae3);ChatInternalMessageEvents[_0x4e35('0x4')](_0x26446f,_0x2f1ae3);_0x506d9c(null);};}for(var e in events){if(events[_0x4e35('0x5')](e)){var event=events[e];ChatInternalMessage[_0x4e35('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 0ab2b19..0d5d58d 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 _0xe22b=['exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','api','request-promise','path','rimraf','./chatInternalMessage.attributes'];(function(_0x1e3870,_0x373b28){var _0x2c46fc=function(_0x2511cd){while(--_0x2511cd){_0x1e3870['push'](_0x1e3870['shift']());}};_0x2c46fc(++_0x373b28);}(_0xe22b,0xe1));var _0xbe22=function(_0xd863d4,_0x16e470){_0xd863d4=_0xd863d4-0x0;var _0x58143d=_0xe22b[_0xd863d4];return _0x58143d;};'use strict';var _=require(_0xbe22('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe22('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbe22('0x2'));var fs=require('fs');var path=require(_0xbe22('0x3'));var rimraf=require(_0xbe22('0x4'));var config=require('../../config/environment');var attributes=require(_0xbe22('0x5'));module[_0xbe22('0x6')]=function(_0x1ee75b,_0x3be2e4){return _0x1ee75b[_0xbe22('0x7')](_0xbe22('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe22('0x9'),'collate':_0xbe22('0xa')});}; \ No newline at end of file +var _0xceac=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0xceac,0x7e));var _0xccea=function(_0x3272b0,_0x51ed45){_0x3272b0=_0x3272b0-0x0;var _0x4daf85=_0xceac[_0x3272b0];return _0x4daf85;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xccea('0x0'));var moment=require(_0xccea('0x1'));var BPromise=require(_0xccea('0x2'));var rp=require(_0xccea('0x3'));var fs=require('fs');var path=require(_0xccea('0x4'));var rimraf=require(_0xccea('0x5'));var config=require(_0xccea('0x6'));var attributes=require(_0xccea('0x7'));module[_0xccea('0x8')]=function(_0xfe1a0,_0xf9d3a5){return _0xfe1a0[_0xccea('0x9')]('ChatInternalMessage',attributes,{'tableName':_0xccea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xccea('0xb'),'collate':_0xccea('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 7ebfb4d..e6b697d 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 _0xcc62=['message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0xcc62,0x10b));var _0x2cc6=function(_0x4eff88,_0x34fe47){_0x4eff88=_0x4eff88-0x0;var _0x5aa05c=_0xcc62[_0x4eff88];return _0x5aa05c;};'use strict';var _=require(_0x2cc6('0x0'));var util=require('util');var moment=require(_0x2cc6('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cc6('0x2'));var fs=require('fs');var Redis=require(_0x2cc6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2cc6('0x4'));var logger=require('../../config/logger')(_0x2cc6('0x5'));var config=require('../../config/environment');var jayson=require(_0x2cc6('0x6'));var client=jayson[_0x2cc6('0x7')]['http']({'port':0x232a});config[_0x2cc6('0x8')]=_['defaults'](config[_0x2cc6('0x8')],{'host':_0x2cc6('0x9'),'port':0x18eb});var socket=require(_0x2cc6('0xa'))(new Redis(config['redis']));require(_0x2cc6('0xb'))['register'](socket);function respondWithRpcPromise(_0x18f5e8,_0x4b8837,_0x52174d){return new BPromise(function(_0x26cae8,_0x5caf11){return client['request'](_0x18f5e8,_0x52174d)[_0x2cc6('0xc')](function(_0x402d7f){logger[_0x2cc6('0xd')](_0x2cc6('0xe'),_0x4b8837,'request\x20sent');logger[_0x2cc6('0xf')](_0x2cc6('0x10'),_0x4b8837,'request\x20sent',JSON['stringify'](_0x402d7f));if(_0x402d7f[_0x2cc6('0x11')]){if(_0x402d7f['error'][_0x2cc6('0x12')]===0x1f4){logger[_0x2cc6('0x11')](_0x2cc6('0xe'),_0x4b8837,_0x402d7f['error'][_0x2cc6('0x13')]);return _0x5caf11(_0x402d7f[_0x2cc6('0x11')][_0x2cc6('0x13')]);}logger[_0x2cc6('0x11')](_0x2cc6('0xe'),_0x4b8837,_0x402d7f['error'][_0x2cc6('0x13')]);return _0x26cae8(_0x402d7f[_0x2cc6('0x11')][_0x2cc6('0x13')]);}else{logger[_0x2cc6('0xd')](_0x2cc6('0xe'),_0x4b8837,_0x2cc6('0x14'));_0x26cae8(_0x402d7f['result'][_0x2cc6('0x13')]);}})[_0x2cc6('0x15')](function(_0x15b051){logger['error'](_0x2cc6('0xe'),_0x4b8837,_0x15b051);_0x5caf11(_0x15b051);});});} \ No newline at end of file +var _0x9a3b=['./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis'];(function(_0x2f9c2d,_0x3ada7f){var _0x1bdf24=function(_0x37320c){while(--_0x37320c){_0x2f9c2d['push'](_0x2f9c2d['shift']());}};_0x1bdf24(++_0x3ada7f);}(_0x9a3b,0x83));var _0xb9a3=function(_0x4ce2f4,_0x5e3d4a){_0x4ce2f4=_0x4ce2f4-0x0;var _0x13145e=_0x9a3b[_0x4ce2f4];return _0x13145e;};'use strict';var _=require(_0xb9a3('0x0'));var util=require('util');var moment=require(_0xb9a3('0x1'));var BPromise=require(_0xb9a3('0x2'));var rs=require(_0xb9a3('0x3'));var fs=require('fs');var Redis=require(_0xb9a3('0x4'));var db=require(_0xb9a3('0x5'))['db'];var utils=require(_0xb9a3('0x6'));var logger=require('../../config/logger')(_0xb9a3('0x7'));var config=require('../../config/environment');var jayson=require(_0xb9a3('0x8'));var client=jayson[_0xb9a3('0x9')][_0xb9a3('0xa')]({'port':0x232a});config['redis']=_[_0xb9a3('0xb')](config[_0xb9a3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9a3('0xc')]));require(_0xb9a3('0xd'))['register'](socket);function respondWithRpcPromise(_0x2816b2,_0x12aa71,_0x1dfe43){return new BPromise(function(_0x3b23df,_0x5cfb06){return client[_0xb9a3('0xe')](_0x2816b2,_0x1dfe43)[_0xb9a3('0xf')](function(_0x525c21){logger[_0xb9a3('0x10')](_0xb9a3('0x11'),_0x12aa71,_0xb9a3('0x12'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x12aa71,_0xb9a3('0x12'),JSON[_0xb9a3('0x13')](_0x525c21));if(_0x525c21[_0xb9a3('0x14')]){if(_0x525c21[_0xb9a3('0x14')]['code']===0x1f4){logger[_0xb9a3('0x14')](_0xb9a3('0x11'),_0x12aa71,_0x525c21['error']['message']);return _0x5cfb06(_0x525c21[_0xb9a3('0x14')]['message']);}logger[_0xb9a3('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x12aa71,_0x525c21[_0xb9a3('0x14')][_0xb9a3('0x15')]);return _0x3b23df(_0x525c21[_0xb9a3('0x14')][_0xb9a3('0x15')]);}else{logger[_0xb9a3('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x12aa71,'request\x20sent');_0x3b23df(_0x525c21[_0xb9a3('0x16')][_0xb9a3('0x15')]);}})[_0xb9a3('0x17')](function(_0x1858fb){logger['error'](_0xb9a3('0x11'),_0x12aa71,_0x1858fb);_0x5cfb06(_0x1858fb);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 440787b..29742e9 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 _0x8d0b=['removeListener','register','chatInternalMessage:','remove','update'];(function(_0x4a0801,_0x55b298){var _0x47306d=function(_0x415a91){while(--_0x415a91){_0x4a0801['push'](_0x4a0801['shift']());}};_0x47306d(++_0x55b298);}(_0x8d0b,0x111));var _0xb8d0=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0x8d0b[_0x21d0c3];return _0x4df18e;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0xb8d0('0x0'),_0xb8d0('0x1')];function createListener(_0x2a9160,_0x4eebc6){return function(_0x4a0b3b){_0x4eebc6['emit'](_0x2a9160,_0x4a0b3b);};}function removeListener(_0x4d7490,_0x23b889){return function(){ChatInternalMessageEvents[_0xb8d0('0x2')](_0x4d7490,_0x23b889);};}exports[_0xb8d0('0x3')]=function(_0x412065){for(var _0x147bd7=0x0,_0x1c8b11=events['length'];_0x147bd7<_0x1c8b11;_0x147bd7++){var _0x20c01b=events[_0x147bd7];var _0x102de4=createListener(_0xb8d0('0x4')+_0x20c01b,_0x412065);ChatInternalMessageEvents['on'](_0x20c01b,_0x102de4);}}; \ No newline at end of file +var _0xa654=['emit','removeListener','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x540123,_0x4e3196){var _0x35e9d6=function(_0x12ce8c){while(--_0x12ce8c){_0x540123['push'](_0x540123['shift']());}};_0x35e9d6(++_0x4e3196);}(_0xa654,0x194));var _0x4a65=function(_0x13c460,_0x296ba9){_0x13c460=_0x13c460-0x0;var _0x3ac773=_0xa654[_0x13c460];return _0x3ac773;};'use strict';var ChatInternalMessageEvents=require(_0x4a65('0x0'));var events=[_0x4a65('0x1'),_0x4a65('0x2'),_0x4a65('0x3')];function createListener(_0x2eec26,_0x5d3a36){return function(_0xaba231){_0x5d3a36[_0x4a65('0x4')](_0x2eec26,_0xaba231);};}function removeListener(_0x291644,_0x2e2d6e){return function(){ChatInternalMessageEvents[_0x4a65('0x5')](_0x291644,_0x2e2d6e);};}exports['register']=function(_0x3c52ed){for(var _0x3ed5ea=0x0,_0x44cf58=events[_0x4a65('0x6')];_0x3ed5ea<_0x44cf58;_0x3ed5ea++){var _0x38a4e9=events[_0x3ed5ea];var _0x58b7ce=createListener(_0x4a65('0x7')+_0x38a4e9,_0x3c52ed);ChatInternalMessageEvents['on'](_0x38a4e9,_0x58b7ce);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 13c775d..81e59d3 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 _0xb477=['util','path','express','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users','/:id','show','post','create','update','destroy','exports','multer'];(function(_0x61b886,_0x51db41){var _0x29ac7f=function(_0xddf273){while(--_0xddf273){_0x61b886['push'](_0x61b886['shift']());}};_0x29ac7f(++_0x51db41);}(_0xb477,0x84));var _0x7b47=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xb477[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0x7b47('0x0'));var util=require(_0x7b47('0x1'));var path=require(_0x7b47('0x2'));var timeout=require('connect-timeout');var express=require(_0x7b47('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7b47('0x4'));var config=require(_0x7b47('0x5'));var controller=require(_0x7b47('0x6'));router[_0x7b47('0x7')]('/',auth[_0x7b47('0x8')](),controller[_0x7b47('0x9')]);router['get'](_0x7b47('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7b47('0x7')](_0x7b47('0xb'),auth['isAuthenticated'](),controller['getUsers']);router['get'](_0x7b47('0xc'),auth[_0x7b47('0x8')](),controller[_0x7b47('0xd')]);router[_0x7b47('0xe')]('/',auth[_0x7b47('0x8')](),controller[_0x7b47('0xf')]);router['put'](_0x7b47('0xc'),controller[_0x7b47('0x10')]);router['delete'](_0x7b47('0xc'),auth[_0x7b47('0x8')](),controller[_0x7b47('0x11')]);module[_0x7b47('0x12')]=router; \ No newline at end of file +var _0xe609=['put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','getUsers','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe609,0x164));var _0x9e60=function(_0xb260f8,_0xc008c5){_0xb260f8=_0xb260f8-0x0;var _0x63096d=_0xe609[_0xb260f8];return _0x63096d;};'use strict';var multer=require(_0x9e60('0x0'));var util=require(_0x9e60('0x1'));var path=require(_0x9e60('0x2'));var timeout=require(_0x9e60('0x3'));var express=require(_0x9e60('0x4'));var router=express[_0x9e60('0x5')]();var fs_extra=require(_0x9e60('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9e60('0x7'));var config=require(_0x9e60('0x8'));var controller=require(_0x9e60('0x9'));router[_0x9e60('0xa')]('/',auth[_0x9e60('0xb')](),controller[_0x9e60('0xc')]);router['get'](_0x9e60('0xd'),auth['isAuthenticated'](),controller[_0x9e60('0xe')]);router['get']('/users',auth[_0x9e60('0xb')](),controller[_0x9e60('0xf')]);router[_0x9e60('0xa')]('/:id',auth[_0x9e60('0xb')](),controller[_0x9e60('0x10')]);router[_0x9e60('0x11')]('/',auth[_0x9e60('0xb')](),controller[_0x9e60('0x12')]);router[_0x9e60('0x13')]('/:id',controller[_0x9e60('0x14')]);router[_0x9e60('0x15')](_0x9e60('0x16'),auth['isAuthenticated'](),controller[_0x9e60('0x17')]);module[_0x9e60('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 69e4409..168dc6a 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 _0x9158=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x5e4278,_0x53ed71){var _0x2b35fe=function(_0x172b6f){while(--_0x172b6f){_0x5e4278['push'](_0x5e4278['shift']());}};_0x2b35fe(++_0x53ed71);}(_0x9158,0x16e));var _0x8915=function(_0x51b3a6,_0x396a17){_0x51b3a6=_0x51b3a6-0x0;var _0x3e86e7=_0x9158[_0x51b3a6];return _0x3e86e7;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'body':{'type':Sequelize[_0x8915('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8915('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8915('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8915('0x5')]},'providerName':{'type':Sequelize[_0x8915('0x6')]},'providerResponse':{'type':Sequelize[_0x8915('0x2')]}}; \ No newline at end of file +var _0x18f3=['DATE','STRING','exports','TEXT','medium','ENUM','out'];(function(_0x5079fb,_0x5a998d){var _0x415467=function(_0x558b69){while(--_0x558b69){_0x5079fb['push'](_0x5079fb['shift']());}};_0x415467(++_0x5a998d);}(_0x18f3,0x19f));var _0x318f=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x18f3[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require('sequelize');module[_0x318f('0x0')]={'body':{'type':Sequelize[_0x318f('0x1')](_0x318f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x318f('0x3')]('in','out'),'defaultValue':_0x318f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x318f('0x5')]},'providerName':{'type':Sequelize[_0x318f('0x6')]},'providerResponse':{'type':Sequelize[_0x318f('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index b0c08d4..ed7b1b3 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 _0x2efb=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','chat-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','internal','manual','interface','SIP/%s','channel','EventManager','parse','formData','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','contact','fullname','email','motionChannel','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x726f26,_0x284383){var _0xf6645e=function(_0x2a6675){while(--_0x2a6675){_0x726f26['push'](_0x726f26['shift']());}};_0xf6645e(++_0x284383);}(_0x2efb,0x105));var _0xb2ef=function(_0xa6e944,_0x70fd99){_0xa6e944=_0xa6e944-0x0;var _0x2e6a6b=_0x2efb[_0xa6e944];return _0x2e6a6b;};'use strict';var emlformat=require(_0xb2ef('0x0'));var rimraf=require(_0xb2ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb2ef('0x2'));var rp=require(_0xb2ef('0x3'));var moment=require(_0xb2ef('0x4'));var BPromise=require(_0xb2ef('0x5'));var Mustache=require(_0xb2ef('0x6'));var util=require(_0xb2ef('0x7'));var path=require(_0xb2ef('0x8'));var sox=require(_0xb2ef('0x9'));var csv=require(_0xb2ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb2ef('0xb'));var _=require('lodash');var squel=require(_0xb2ef('0xc'));var crypto=require(_0xb2ef('0xd'));var jsforce=require(_0xb2ef('0xe'));var deskjs=require(_0xb2ef('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb2ef('0x10'));var Redis=require(_0xb2ef('0x11'));var authService=require(_0xb2ef('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb2ef('0x13'));var hardwareService=require(_0xb2ef('0x14'));var logger=require(_0xb2ef('0x15'))(_0xb2ef('0x16'));var utils=require(_0xb2ef('0x17'));var config=require(_0xb2ef('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb2ef('0x19'))['db'];config[_0xb2ef('0x1a')]=_[_0xb2ef('0x1b')](config[_0xb2ef('0x1a')],{'host':_0xb2ef('0x1c'),'port':0x18eb});var socket=require(_0xb2ef('0x1d'))(new Redis(config['redis']));require(_0xb2ef('0x1e'))[_0xb2ef('0x1f')](socket);var jayson=require(_0xb2ef('0x20'));var client=jayson[_0xb2ef('0x21')][_0xb2ef('0x22')]({'port':0x232c});var client9002=jayson[_0xb2ef('0x21')][_0xb2ef('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x87ae42,_0x59c2cb,_0x38b29b,_0x299d82){return new BPromise(function(_0x5158a7,_0x447bc4){var _0x39be25=_0x299d82||client;return _0x39be25[_0xb2ef('0x23')](_0x87ae42,_0x38b29b)[_0xb2ef('0x24')](function(_0xcaa4c4){logger[_0xb2ef('0x25')](_0xb2ef('0x26'),_0x59c2cb,_0xb2ef('0x27'));logger[_0xb2ef('0x28')](_0xb2ef('0x29'),_0x59c2cb,_0xb2ef('0x27'),JSON[_0xb2ef('0x2a')](_0xcaa4c4));if(_0xcaa4c4[_0xb2ef('0x2b')]){if(_0xcaa4c4[_0xb2ef('0x2b')][_0xb2ef('0x2c')]===0x1f4){logger[_0xb2ef('0x2b')](_0xb2ef('0x26'),_0x59c2cb,_0xcaa4c4[_0xb2ef('0x2b')]['message']);return _0x447bc4(_0xcaa4c4[_0xb2ef('0x2b')][_0xb2ef('0x2d')]);}logger[_0xb2ef('0x2b')](_0xb2ef('0x26'),_0x59c2cb,_0xcaa4c4['error'][_0xb2ef('0x2d')]);return _0x5158a7(_0xcaa4c4[_0xb2ef('0x2b')]['message']);}else{logger[_0xb2ef('0x25')](_0xb2ef('0x26'),_0x59c2cb,_0xb2ef('0x27'));_0x5158a7(_0xcaa4c4['result']['message']);}})[_0xb2ef('0x2e')](function(_0x4f82a2){logger[_0xb2ef('0x2b')](_0xb2ef('0x26'),_0x59c2cb,_0x4f82a2);_0x447bc4(_0x4f82a2);});});}function respondWithStatusCode(_0x67599c,_0x24e8c1){_0x24e8c1=_0x24e8c1||0xcc;return function(_0x26379d){if(_0x26379d){return _0x67599c[_0xb2ef('0x2f')](_0x24e8c1);}return _0x67599c[_0xb2ef('0x30')](_0x24e8c1)[_0xb2ef('0x31')]();};}function respondWithResult(_0x4300db,_0x38217c){_0x38217c=_0x38217c||0xc8;return function(_0x47ddba){if(_0x47ddba){return _0x4300db[_0xb2ef('0x30')](_0x38217c)['json'](_0x47ddba);}};}function respondWithFilteredResult(_0x18b184,_0x168318){return function(_0x1ead7a){if(_0x1ead7a){var _0x2983fa=typeof _0x168318['offset']===_0xb2ef('0x32')&&typeof _0x168318['limit']===_0xb2ef('0x32');var _0x1b4086=_0x1ead7a[_0xb2ef('0x33')];var _0x4af76c=_0x2983fa?0x0:_0x168318[_0xb2ef('0x34')];var _0x2e7914=_0x2983fa?_0x1ead7a[_0xb2ef('0x33')]:_0x168318['offset']+_0x168318[_0xb2ef('0x35')];var _0xefdf2a;if(_0x2e7914>=_0x1b4086){_0x2e7914=_0x1b4086;_0xefdf2a=0xc8;}else{_0xefdf2a=0xce;}_0x18b184['status'](_0xefdf2a);return _0x18b184['set'](_0xb2ef('0x36'),_0x4af76c+'-'+_0x2e7914+'/'+_0x1b4086)['json'](_0x1ead7a);}return null;};}function patchUpdates(_0xcf330e){return function(_0x12f291){try{jsonpatch[_0xb2ef('0x37')](_0x12f291,_0xcf330e,!![]);}catch(_0x32a4c5){return BPromise[_0xb2ef('0x38')](_0x32a4c5);}return _0x12f291['save']();};}function saveUpdates(_0x4f33a6,_0x286dba){return function(_0x181131){if(_0x181131){return _0x181131[_0xb2ef('0x39')](_0x4f33a6)[_0xb2ef('0x24')](function(_0x315afa){return _0x315afa;});}return null;};}function removeEntity(_0x3d3a8e,_0x1f0cdc){return function(_0x624136){if(_0x624136){return _0x624136[_0xb2ef('0x3a')]()[_0xb2ef('0x24')](function(){_0x3d3a8e[_0xb2ef('0x30')](0xcc)[_0xb2ef('0x31')]();});}};}function handleEntityNotFound(_0x547109,_0x2e2c6c){return function(_0x487e5c){if(!_0x487e5c){_0x547109[_0xb2ef('0x2f')](0x194);}return _0x487e5c;};}function handleError(_0x1e7777,_0x2468d8){_0x2468d8=_0x2468d8||0x1f4;return function(_0x2768d3){logger[_0xb2ef('0x2b')](_0x2768d3[_0xb2ef('0x3b')]);if(_0x2768d3[_0xb2ef('0x3c')]){delete _0x2768d3[_0xb2ef('0x3c')];}_0x1e7777[_0xb2ef('0x30')](_0x2468d8)[_0xb2ef('0x3d')](_0x2768d3);};}exports[_0xb2ef('0x3e')]=function(_0x1d66bd,_0x34b1f7){var _0x8b4829={},_0x211836={},_0x45eaf7={'count':0x0,'rows':[]};var _0x16034c=_[_0xb2ef('0x3f')](db[_0xb2ef('0x40')][_0xb2ef('0x41')],function(_0x357130){return{'name':_0x357130[_0xb2ef('0x42')],'type':_0x357130[_0xb2ef('0x43')][_0xb2ef('0x44')]};});_0x211836[_0xb2ef('0x45')]=_[_0xb2ef('0x3f')](_0x16034c,_0xb2ef('0x3c'));_0x211836['query']=_['keys'](_0x1d66bd[_0xb2ef('0x46')]);_0x211836['filters']=_['intersection'](_0x211836[_0xb2ef('0x45')],_0x211836[_0xb2ef('0x46')]);_0x8b4829[_0xb2ef('0x47')]=_[_0xb2ef('0x48')](_0x211836[_0xb2ef('0x45')],qs[_0xb2ef('0x49')](_0x1d66bd[_0xb2ef('0x46')][_0xb2ef('0x49')]));_0x8b4829[_0xb2ef('0x47')]=_0x8b4829[_0xb2ef('0x47')][_0xb2ef('0x4a')]?_0x8b4829[_0xb2ef('0x47')]:_0x211836['model'];if(!_0x1d66bd['query']['hasOwnProperty'](_0xb2ef('0x4b'))){_0x8b4829[_0xb2ef('0x35')]=qs[_0xb2ef('0x35')](_0x1d66bd[_0xb2ef('0x46')][_0xb2ef('0x35')]);_0x8b4829[_0xb2ef('0x34')]=qs[_0xb2ef('0x34')](_0x1d66bd[_0xb2ef('0x46')][_0xb2ef('0x34')]);}_0x8b4829[_0xb2ef('0x4c')]=qs[_0xb2ef('0x4d')](_0x1d66bd[_0xb2ef('0x46')][_0xb2ef('0x4d')]);_0x8b4829[_0xb2ef('0x4e')]=qs[_0xb2ef('0x4f')](_[_0xb2ef('0x50')](_0x1d66bd[_0xb2ef('0x46')],_0x211836['filters']),_0x16034c);if(_0x1d66bd[_0xb2ef('0x46')][_0xb2ef('0x51')]){_0x8b4829[_0xb2ef('0x4e')]=_[_0xb2ef('0x52')](_0x8b4829[_0xb2ef('0x4e')],{'$or':_[_0xb2ef('0x3f')](_0x16034c,function(_0x293152){if(_0x293152[_0xb2ef('0x43')]!==_0xb2ef('0x53')){var _0x2217a8={};_0x2217a8[_0x293152[_0xb2ef('0x3c')]]={'$like':'%'+_0x1d66bd['query'][_0xb2ef('0x51')]+'%'};return _0x2217a8;}})});}_0x8b4829=_['merge']({},_0x8b4829,_0x1d66bd[_0xb2ef('0x54')]);var _0xd3f1f0={'where':_0x8b4829[_0xb2ef('0x4e')]};return db[_0xb2ef('0x40')][_0xb2ef('0x33')](_0xd3f1f0)[_0xb2ef('0x24')](function(_0x3bd72a){_0x45eaf7[_0xb2ef('0x33')]=_0x3bd72a;if(_0x1d66bd[_0xb2ef('0x46')][_0xb2ef('0x55')]){_0x8b4829[_0xb2ef('0x56')]=[{'all':!![]}];}return db['ChatMessage'][_0xb2ef('0x57')](_0x8b4829);})[_0xb2ef('0x24')](function(_0xf61e85){_0x45eaf7[_0xb2ef('0x58')]=_0xf61e85;return _0x45eaf7;})[_0xb2ef('0x24')](respondWithFilteredResult(_0x34b1f7,_0x8b4829))[_0xb2ef('0x2e')](handleError(_0x34b1f7,null));};exports[_0xb2ef('0x59')]=function(_0x2f20c6,_0x20b13c){var _0x38168a={'raw':!![],'where':{'id':_0x2f20c6[_0xb2ef('0x5a')]['id']}},_0x53981c={};_0x53981c[_0xb2ef('0x45')]=_[_0xb2ef('0x5b')](db[_0xb2ef('0x40')][_0xb2ef('0x41')]);_0x53981c[_0xb2ef('0x46')]=_[_0xb2ef('0x5b')](_0x2f20c6[_0xb2ef('0x46')]);_0x53981c[_0xb2ef('0x4f')]=_[_0xb2ef('0x48')](_0x53981c[_0xb2ef('0x45')],_0x53981c['query']);_0x38168a['attributes']=_[_0xb2ef('0x48')](_0x53981c['model'],qs['fields'](_0x2f20c6['query'][_0xb2ef('0x49')]));_0x38168a[_0xb2ef('0x47')]=_0x38168a['attributes'][_0xb2ef('0x4a')]?_0x38168a[_0xb2ef('0x47')]:_0x53981c[_0xb2ef('0x45')];if(_0x2f20c6[_0xb2ef('0x46')]['includeAll']){_0x38168a[_0xb2ef('0x56')]=[{'all':!![]}];}_0x38168a=_['merge']({},_0x38168a,_0x2f20c6[_0xb2ef('0x54')]);return db[_0xb2ef('0x40')][_0xb2ef('0x5c')](_0x38168a)[_0xb2ef('0x24')](handleEntityNotFound(_0x20b13c,null))['then'](respondWithResult(_0x20b13c,null))['catch'](handleError(_0x20b13c,null));};exports[_0xb2ef('0x5d')]=function(_0x23f38c,_0x14ee72){return db[_0xb2ef('0x40')][_0xb2ef('0x5d')](_0x23f38c[_0xb2ef('0x5e')],{})[_0xb2ef('0x24')](respondWithResult(_0x14ee72,0xc9))[_0xb2ef('0x2e')](handleError(_0x14ee72,null));};exports[_0xb2ef('0x39')]=function(_0x11fb10,_0x232e4a){if(_0x11fb10[_0xb2ef('0x5e')]['id']){delete _0x11fb10['body']['id'];}return db[_0xb2ef('0x40')][_0xb2ef('0x5c')]({'where':{'id':_0x11fb10[_0xb2ef('0x5a')]['id']}})[_0xb2ef('0x24')](handleEntityNotFound(_0x232e4a,null))['then'](saveUpdates(_0x11fb10['body'],null))['then'](respondWithResult(_0x232e4a,null))[_0xb2ef('0x2e')](handleError(_0x232e4a,null));};exports[_0xb2ef('0x3a')]=function(_0x266d1f,_0x549ff3){return db[_0xb2ef('0x40')][_0xb2ef('0x5c')]({'where':{'id':_0x266d1f[_0xb2ef('0x5a')]['id']}})[_0xb2ef('0x24')](handleEntityNotFound(_0x549ff3,null))[_0xb2ef('0x24')](removeEntity(_0x549ff3,null))[_0xb2ef('0x2e')](handleError(_0x549ff3,null));};exports[_0xb2ef('0x5f')]=function(_0x1de7e1,_0x209dd2){return db[_0xb2ef('0x40')][_0xb2ef('0x5f')]()[_0xb2ef('0x24')](respondWithResult(_0x209dd2,null))['catch'](handleError(_0x209dd2,null));};var interaction_log=require(_0xb2ef('0x15'))(_0xb2ef('0x60'));exports[_0xb2ef('0x61')]=function(_0x46e9a4,_0x12dfd4,_0x20721f){var _0x3a8921={'agent':{},'channel':'chat'};if(_0x46e9a4[_0xb2ef('0x5e')]['id']){delete _0x46e9a4[_0xb2ef('0x5e')]['id'];}_0x46e9a4['body']['read']=!![];_0x46e9a4[_0xb2ef('0x5e')][_0xb2ef('0x62')]=moment()[_0xb2ef('0x63')](_0xb2ef('0x64'));_0x46e9a4[_0xb2ef('0x5e')][_0xb2ef('0x65')]=_0x46e9a4[_0xb2ef('0x5e')][_0xb2ef('0x65')]||_0x46e9a4[_0xb2ef('0x66')]['id'];_0x3a8921['agent']['id']=_0x46e9a4[_0xb2ef('0x5e')][_0xb2ef('0x65')];return db[_0xb2ef('0x40')][_0xb2ef('0x5c')]({'where':{'id':_0x46e9a4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x12dfd4,null))['then'](saveUpdates(_0x46e9a4[_0xb2ef('0x5e')],null))[_0xb2ef('0x24')](function(_0x11c59d){if(_0x11c59d){_0x3a8921[_0xb2ef('0x2d')]=_0x11c59d['get']({'plain':!![]});return db[_0xb2ef('0x67')][_0xb2ef('0x5c')]({'where':{'id':_0x11c59d[_0xb2ef('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x12dfd4,null))[_0xb2ef('0x24')](function(_0x5670c5){if(_0x5670c5){return _0x5670c5[_0xb2ef('0x39')]({'UserId':_0x46e9a4['body'][_0xb2ef('0x65')],'read1stAt':_[_0xb2ef('0x69')](_0x5670c5[_0xb2ef('0x6a')])?moment()[_0xb2ef('0x63')](_0xb2ef('0x64')):undefined});}return null;})[_0xb2ef('0x24')](function(_0x594aa4){if(_0x594aa4){_0x3a8921[_0xb2ef('0x6b')]=_0x594aa4[_0xb2ef('0x6c')]({'plain':!![]});interaction_log['info'](_0xb2ef('0x6d'),_0x46e9a4[_0xb2ef('0x66')]['id'],_0x46e9a4[_0xb2ef('0x66')][_0xb2ef('0x3c')],_0x46e9a4[_0xb2ef('0x66')]['role'],_0x3a8921['interaction']['id'],_0x46e9a4[_0xb2ef('0x5e')]?JSON[_0xb2ef('0x2a')](_0x46e9a4[_0xb2ef('0x5e')]):_0xb2ef('0x6e'));return respondWithRpcPromise(_0xb2ef('0x6f'),_0xb2ef('0x70'),_0x3a8921);}return null;})[_0xb2ef('0x24')](function(_0x38f872){var _0x2e3291=_0xb2ef('0x71')+_0x38f872['message'][_0xb2ef('0x72')];return db[_0xb2ef('0x73')][_0xb2ef('0x46')](_0x2e3291,{'type':db[_0xb2ef('0x74')][_0xb2ef('0x75')][_0xb2ef('0x76')],'raw':!![]})[_0xb2ef('0x24')](function(_0x349922){return _0x349922;});})['then'](function(_0x166274){if(_0x166274){_0x3a8921[_0xb2ef('0x2d')]['contact']=_0x166274[0x0];if(!_0x46e9a4[_0xb2ef('0x5e')][_0xb2ef('0x65')])return;return db[_0xb2ef('0x77')][_0xb2ef('0x5c')]({'where':{'id':_0x46e9a4['body'][_0xb2ef('0x65')],'role':_0xb2ef('0x78')},'attributes':['id','name','fullname','email',_0xb2ef('0x79')],'raw':!![]});}return null;})[_0xb2ef('0x24')](function(_0x5c104a){if(!_0x5c104a)return null;_0x3a8921['message'][_0xb2ef('0x78')]=_0x5c104a;return _0x3a8921;})[_0xb2ef('0x24')](function(_0x5a5ee0){if(_0x5a5ee0){if(_0x46e9a4[_0xb2ef('0x5e')][_0xb2ef('0x7a')]){_0x3a8921[_0xb2ef('0x2d')][_0xb2ef('0x7b')]=util[_0xb2ef('0x63')](_0xb2ef('0x7c'),_0x46e9a4[_0xb2ef('0x66')][_0xb2ef('0x3c')]);_0x3a8921[_0xb2ef('0x2d')][_0xb2ef('0x7d')]=_0x3a8921[_0xb2ef('0x7d')];_0x3a8921[_0xb2ef('0x2d')]['motionChannel']=_0x3a8921['channel'];_0x3a8921[_0xb2ef('0x2d')]['event']='accept';return respondWithRpcPromise(_0xb2ef('0x7e'),_0xb2ef('0x7e'),{'event':'acceptmessage','message':_[_0xb2ef('0x52')](_0x3a8921['message'],JSON[_0xb2ef('0x7f')](_0x3a8921[_0xb2ef('0x6b')][_0xb2ef('0x80')]))},client9002)['then'](function(){return _0x3a8921;});}return _0x3a8921;}return null;})['then'](respondWithResult(_0x12dfd4,null))[_0xb2ef('0x2e')](handleError(_0x12dfd4,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['reject']=function(_0x3b6a63,_0x4c6d8e,_0x1be800){var _0x133a50={'agent':{},'channel':_0xb2ef('0x81')};if(_0x3b6a63['body']['id']){delete _0x3b6a63[_0xb2ef('0x5e')]['id'];}_0x3b6a63[_0xb2ef('0x5e')]['UserId']=_0x3b6a63[_0xb2ef('0x5e')][_0xb2ef('0x65')]||_0x3b6a63['user']['id'];_0x133a50[_0xb2ef('0x78')]['id']=_0x3b6a63['body'][_0xb2ef('0x65')];return db['ChatMessage'][_0xb2ef('0x5c')]({'where':{'id':_0x3b6a63['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4c6d8e,null))[_0xb2ef('0x24')](function(_0x1c7e66){if(_0x1c7e66){_0x133a50['message']=_0x1c7e66[_0xb2ef('0x6c')]({'plain':!![]});return db[_0xb2ef('0x67')][_0xb2ef('0x5c')]({'where':{'id':_0x1c7e66['ChatInteractionId']}});}return null;})[_0xb2ef('0x24')](handleEntityNotFound(_0x4c6d8e,null))[_0xb2ef('0x24')](function(_0x559703){if(_0x559703){_0x133a50[_0xb2ef('0x6b')]=_0x559703[_0xb2ef('0x6c')]({'plain':!![]});interaction_log[_0xb2ef('0x25')](_0xb2ef('0x82'),_0x3b6a63[_0xb2ef('0x66')]['id'],_0x3b6a63[_0xb2ef('0x66')][_0xb2ef('0x3c')],_0x3b6a63['user'][_0xb2ef('0x83')],_0x133a50[_0xb2ef('0x6b')]['id'],_0x3b6a63['body']?JSON[_0xb2ef('0x2a')](_0x3b6a63['body']):_0xb2ef('0x6e'));return respondWithRpcPromise('RejectMessage',_0xb2ef('0x84'),_0x133a50);}return null;})['then'](function(_0x35f83a){var _0x2e9dcd=_0xb2ef('0x71')+_0x35f83a['message']['ContactId'];return db[_0xb2ef('0x73')][_0xb2ef('0x46')](_0x2e9dcd,{'type':db[_0xb2ef('0x74')][_0xb2ef('0x75')]['SELECT'],'raw':!![]})[_0xb2ef('0x24')](function(_0x2f72c2){return _0x2f72c2;});})[_0xb2ef('0x24')](function(_0x2063fc){if(_0x2063fc){_0x133a50['message'][_0xb2ef('0x85')]=_0x2063fc[0x0];if(!_0x3b6a63[_0xb2ef('0x5e')][_0xb2ef('0x65')])return;return db[_0xb2ef('0x77')]['find']({'where':{'id':_0x3b6a63[_0xb2ef('0x5e')]['UserId'],'role':_0xb2ef('0x78')},'attributes':['id','name',_0xb2ef('0x86'),_0xb2ef('0x87'),_0xb2ef('0x79')],'raw':!![]});}return null;})[_0xb2ef('0x24')](function(_0x7dadd1){if(!_0x7dadd1)return null;_0x133a50[_0xb2ef('0x2d')][_0xb2ef('0x78')]=_0x7dadd1;return _0x133a50;})[_0xb2ef('0x24')](function(_0x429557){if(_0x429557){_0x429557[_0xb2ef('0x2d')][_0xb2ef('0x7b')]=util[_0xb2ef('0x63')](_0xb2ef('0x7c'),_0x3b6a63[_0xb2ef('0x66')][_0xb2ef('0x3c')]);_0x429557[_0xb2ef('0x2d')][_0xb2ef('0x7d')]=_0x133a50[_0xb2ef('0x7d')];_0x429557[_0xb2ef('0x2d')][_0xb2ef('0x88')]=_0x133a50[_0xb2ef('0x7d')];_0x429557[_0xb2ef('0x2d')][_0xb2ef('0x89')]=_0xb2ef('0x38');respondWithRpcPromise('EventManager',_0xb2ef('0x7e'),{'event':_0xb2ef('0x8a'),'message':_[_0xb2ef('0x52')](_0x133a50['message'],JSON[_0xb2ef('0x7f')](_0x133a50[_0xb2ef('0x6b')][_0xb2ef('0x80')]))},client9002);return _0x133a50;}return null;})[_0xb2ef('0x24')](respondWithResult(_0x4c6d8e,null))[_0xb2ef('0x2e')](handleError(_0x4c6d8e,null));}; \ No newline at end of file +var _0x8801=['http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','limit','undefined','set','apply','reject','save','update','stack','name','map','ChatMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','options','count','includeAll','include','rows','catch','show','rawAttributes','length','find','create','body','params','destroy','describe','chat','read','readAt','format','user','agent','UserId','ChatInteraction','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','motionChannel','channel','event','accept','EventManager','acceptmessage','merge','chat-interactions','contact','formData','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client'];(function(_0x1d4629,_0x4947e3){var _0x257c2f=function(_0x127b12){while(--_0x127b12){_0x1d4629['push'](_0x1d4629['shift']());}};_0x257c2f(++_0x4947e3);}(_0x8801,0x66));var _0x1880=function(_0x300b47,_0x291657){_0x300b47=_0x300b47-0x0;var _0x9e8566=_0x8801[_0x300b47];return _0x9e8566;};'use strict';var emlformat=require(_0x1880('0x0'));var rimraf=require(_0x1880('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1880('0x2'));var rp=require(_0x1880('0x3'));var moment=require(_0x1880('0x4'));var BPromise=require(_0x1880('0x5'));var Mustache=require(_0x1880('0x6'));var util=require(_0x1880('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1880('0x8'));var ejs=require(_0x1880('0x9'));var fs=require('fs');var fs_extra=require(_0x1880('0xa'));var _=require('lodash');var squel=require(_0x1880('0xb'));var crypto=require(_0x1880('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1880('0xd'));var toCsv=require(_0x1880('0x8'));var querystring=require(_0x1880('0xe'));var Papa=require(_0x1880('0xf'));var Redis=require(_0x1880('0x10'));var authService=require(_0x1880('0x11'));var qs=require(_0x1880('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1880('0x13'));var logger=require(_0x1880('0x14'))(_0x1880('0x15'));var utils=require(_0x1880('0x16'));var config=require(_0x1880('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1880('0x18'))['db'];config['redis']=_[_0x1880('0x19')](config[_0x1880('0x1a')],{'host':_0x1880('0x1b'),'port':0x18eb});var socket=require(_0x1880('0x1c'))(new Redis(config[_0x1880('0x1a')]));require(_0x1880('0x1d'))['register'](socket);var jayson=require(_0x1880('0x1e'));var client=jayson[_0x1880('0x1f')][_0x1880('0x20')]({'port':0x232c});var client9002=jayson[_0x1880('0x1f')][_0x1880('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x20d3a5,_0x6dc18a,_0x15bc53,_0x4ec086){return new BPromise(function(_0x5e6ce7,_0x5b934){var _0x2d32b3=_0x4ec086||client;return _0x2d32b3[_0x1880('0x21')](_0x20d3a5,_0x15bc53)[_0x1880('0x22')](function(_0x424165){logger[_0x1880('0x23')](_0x1880('0x24'),_0x6dc18a,_0x1880('0x25'));logger[_0x1880('0x26')](_0x1880('0x27'),_0x6dc18a,_0x1880('0x25'),JSON[_0x1880('0x28')](_0x424165));if(_0x424165[_0x1880('0x29')]){if(_0x424165[_0x1880('0x29')][_0x1880('0x2a')]===0x1f4){logger[_0x1880('0x29')](_0x1880('0x24'),_0x6dc18a,_0x424165[_0x1880('0x29')][_0x1880('0x2b')]);return _0x5b934(_0x424165[_0x1880('0x29')][_0x1880('0x2b')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x6dc18a,_0x424165[_0x1880('0x29')]['message']);return _0x5e6ce7(_0x424165[_0x1880('0x29')][_0x1880('0x2b')]);}else{logger[_0x1880('0x23')]('ChatMessage,\x20%s,\x20%s',_0x6dc18a,_0x1880('0x25'));_0x5e6ce7(_0x424165[_0x1880('0x2c')][_0x1880('0x2b')]);}})['catch'](function(_0x3aaaad){logger[_0x1880('0x29')](_0x1880('0x24'),_0x6dc18a,_0x3aaaad);_0x5b934(_0x3aaaad);});});}function respondWithStatusCode(_0x311e06,_0x2d47e8){_0x2d47e8=_0x2d47e8||0xcc;return function(_0x5b9fe4){if(_0x5b9fe4){return _0x311e06[_0x1880('0x2d')](_0x2d47e8);}return _0x311e06['status'](_0x2d47e8)[_0x1880('0x2e')]();};}function respondWithResult(_0x5df3f8,_0x9eb922){_0x9eb922=_0x9eb922||0xc8;return function(_0x4b8338){if(_0x4b8338){return _0x5df3f8[_0x1880('0x2f')](_0x9eb922)[_0x1880('0x30')](_0x4b8338);}};}function respondWithFilteredResult(_0x1ae82e,_0x4d6110){return function(_0x2a354a){if(_0x2a354a){var _0x5a1189=typeof _0x4d6110[_0x1880('0x31')]==='undefined'&&typeof _0x4d6110[_0x1880('0x32')]===_0x1880('0x33');var _0x2b6f9b=_0x2a354a['count'];var _0x5e2185=_0x5a1189?0x0:_0x4d6110[_0x1880('0x31')];var _0x516dc2=_0x5a1189?_0x2a354a['count']:_0x4d6110[_0x1880('0x31')]+_0x4d6110['limit'];var _0x4a186c;if(_0x516dc2>=_0x2b6f9b){_0x516dc2=_0x2b6f9b;_0x4a186c=0xc8;}else{_0x4a186c=0xce;}_0x1ae82e[_0x1880('0x2f')](_0x4a186c);return _0x1ae82e[_0x1880('0x34')]('Content-Range',_0x5e2185+'-'+_0x516dc2+'/'+_0x2b6f9b)[_0x1880('0x30')](_0x2a354a);}return null;};}function patchUpdates(_0x13d984){return function(_0x39358e){try{jsonpatch[_0x1880('0x35')](_0x39358e,_0x13d984,!![]);}catch(_0x163b45){return BPromise[_0x1880('0x36')](_0x163b45);}return _0x39358e[_0x1880('0x37')]();};}function saveUpdates(_0x317737,_0x20ebfa){return function(_0x5dbd73){if(_0x5dbd73){return _0x5dbd73[_0x1880('0x38')](_0x317737)[_0x1880('0x22')](function(_0x422794){return _0x422794;});}return null;};}function removeEntity(_0x561b24,_0x12a484){return function(_0x41bd0d){if(_0x41bd0d){return _0x41bd0d['destroy']()[_0x1880('0x22')](function(){_0x561b24['status'](0xcc)[_0x1880('0x2e')]();});}};}function handleEntityNotFound(_0x58e4bb,_0x44c874){return function(_0x4fd36d){if(!_0x4fd36d){_0x58e4bb[_0x1880('0x2d')](0x194);}return _0x4fd36d;};}function handleError(_0x32e0f1,_0x4ef814){_0x4ef814=_0x4ef814||0x1f4;return function(_0xb42d90){logger['error'](_0xb42d90[_0x1880('0x39')]);if(_0xb42d90[_0x1880('0x3a')]){delete _0xb42d90['name'];}_0x32e0f1[_0x1880('0x2f')](_0x4ef814)['send'](_0xb42d90);};}exports['index']=function(_0x540c48,_0xa25c59){var _0x2c7d8c={},_0x15779f={},_0x25327a={'count':0x0,'rows':[]};var _0x16d3cf=_[_0x1880('0x3b')](db[_0x1880('0x3c')]['rawAttributes'],function(_0x343353){return{'name':_0x343353[_0x1880('0x3d')],'type':_0x343353[_0x1880('0x3e')][_0x1880('0x3f')]};});_0x15779f[_0x1880('0x40')]=_['map'](_0x16d3cf,_0x1880('0x3a'));_0x15779f[_0x1880('0x41')]=_[_0x1880('0x42')](_0x540c48[_0x1880('0x41')]);_0x15779f['filters']=_[_0x1880('0x43')](_0x15779f['model'],_0x15779f[_0x1880('0x41')]);_0x2c7d8c[_0x1880('0x44')]=_[_0x1880('0x43')](_0x15779f[_0x1880('0x40')],qs['fields'](_0x540c48['query'][_0x1880('0x45')]));_0x2c7d8c[_0x1880('0x44')]=_0x2c7d8c[_0x1880('0x44')]['length']?_0x2c7d8c[_0x1880('0x44')]:_0x15779f['model'];if(!_0x540c48[_0x1880('0x41')][_0x1880('0x46')](_0x1880('0x47'))){_0x2c7d8c[_0x1880('0x32')]=qs[_0x1880('0x32')](_0x540c48[_0x1880('0x41')][_0x1880('0x32')]);_0x2c7d8c[_0x1880('0x31')]=qs['offset'](_0x540c48[_0x1880('0x41')][_0x1880('0x31')]);}_0x2c7d8c[_0x1880('0x48')]=qs[_0x1880('0x49')](_0x540c48['query'][_0x1880('0x49')]);_0x2c7d8c[_0x1880('0x4a')]=qs[_0x1880('0x4b')](_[_0x1880('0x4c')](_0x540c48[_0x1880('0x41')],_0x15779f[_0x1880('0x4b')]),_0x16d3cf);if(_0x540c48[_0x1880('0x41')]['filter']){_0x2c7d8c['where']=_['merge'](_0x2c7d8c[_0x1880('0x4a')],{'$or':_[_0x1880('0x3b')](_0x16d3cf,function(_0x3cc5d4){if(_0x3cc5d4[_0x1880('0x3e')]!==_0x1880('0x4d')){var _0xa83d2e={};_0xa83d2e[_0x3cc5d4[_0x1880('0x3a')]]={'$like':'%'+_0x540c48[_0x1880('0x41')]['filter']+'%'};return _0xa83d2e;}})});}_0x2c7d8c=_['merge']({},_0x2c7d8c,_0x540c48[_0x1880('0x4e')]);var _0x7701a3={'where':_0x2c7d8c[_0x1880('0x4a')]};return db[_0x1880('0x3c')][_0x1880('0x4f')](_0x7701a3)['then'](function(_0x1f2e56){_0x25327a['count']=_0x1f2e56;if(_0x540c48['query'][_0x1880('0x50')]){_0x2c7d8c[_0x1880('0x51')]=[{'all':!![]}];}return db[_0x1880('0x3c')]['findAll'](_0x2c7d8c);})[_0x1880('0x22')](function(_0x5a5ba6){_0x25327a[_0x1880('0x52')]=_0x5a5ba6;return _0x25327a;})[_0x1880('0x22')](respondWithFilteredResult(_0xa25c59,_0x2c7d8c))[_0x1880('0x53')](handleError(_0xa25c59,null));};exports[_0x1880('0x54')]=function(_0x59ff70,_0x23bcb0){var _0x274ecd={'raw':!![],'where':{'id':_0x59ff70['params']['id']}},_0xe28d86={};_0xe28d86[_0x1880('0x40')]=_['keys'](db[_0x1880('0x3c')][_0x1880('0x55')]);_0xe28d86[_0x1880('0x41')]=_[_0x1880('0x42')](_0x59ff70['query']);_0xe28d86[_0x1880('0x4b')]=_[_0x1880('0x43')](_0xe28d86[_0x1880('0x40')],_0xe28d86['query']);_0x274ecd[_0x1880('0x44')]=_['intersection'](_0xe28d86[_0x1880('0x40')],qs['fields'](_0x59ff70[_0x1880('0x41')][_0x1880('0x45')]));_0x274ecd[_0x1880('0x44')]=_0x274ecd['attributes'][_0x1880('0x56')]?_0x274ecd[_0x1880('0x44')]:_0xe28d86[_0x1880('0x40')];if(_0x59ff70['query']['includeAll']){_0x274ecd[_0x1880('0x51')]=[{'all':!![]}];}_0x274ecd=_['merge']({},_0x274ecd,_0x59ff70[_0x1880('0x4e')]);return db[_0x1880('0x3c')][_0x1880('0x57')](_0x274ecd)[_0x1880('0x22')](handleEntityNotFound(_0x23bcb0,null))['then'](respondWithResult(_0x23bcb0,null))[_0x1880('0x53')](handleError(_0x23bcb0,null));};exports[_0x1880('0x58')]=function(_0x2ca4fb,_0x442fdc){return db['ChatMessage'][_0x1880('0x58')](_0x2ca4fb[_0x1880('0x59')],{})[_0x1880('0x22')](respondWithResult(_0x442fdc,0xc9))[_0x1880('0x53')](handleError(_0x442fdc,null));};exports[_0x1880('0x38')]=function(_0x3f85aa,_0x3a24ba){if(_0x3f85aa['body']['id']){delete _0x3f85aa[_0x1880('0x59')]['id'];}return db[_0x1880('0x3c')][_0x1880('0x57')]({'where':{'id':_0x3f85aa[_0x1880('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3a24ba,null))['then'](saveUpdates(_0x3f85aa['body'],null))[_0x1880('0x22')](respondWithResult(_0x3a24ba,null))['catch'](handleError(_0x3a24ba,null));};exports[_0x1880('0x5b')]=function(_0x5477d0,_0x1227ed){return db[_0x1880('0x3c')]['find']({'where':{'id':_0x5477d0['params']['id']}})[_0x1880('0x22')](handleEntityNotFound(_0x1227ed,null))[_0x1880('0x22')](removeEntity(_0x1227ed,null))[_0x1880('0x53')](handleError(_0x1227ed,null));};exports['describe']=function(_0x4a1395,_0x7f802b){return db['ChatMessage'][_0x1880('0x5c')]()[_0x1880('0x22')](respondWithResult(_0x7f802b,null))[_0x1880('0x53')](handleError(_0x7f802b,null));};var interaction_log=require(_0x1880('0x14'))('chat-interactions');exports['accept']=function(_0x33f323,_0x15d128,_0x820366){var _0x308a7d={'agent':{},'channel':_0x1880('0x5d')};if(_0x33f323[_0x1880('0x59')]['id']){delete _0x33f323[_0x1880('0x59')]['id'];}_0x33f323[_0x1880('0x59')][_0x1880('0x5e')]=!![];_0x33f323[_0x1880('0x59')][_0x1880('0x5f')]=moment()[_0x1880('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x33f323[_0x1880('0x59')]['UserId']=_0x33f323[_0x1880('0x59')]['UserId']||_0x33f323[_0x1880('0x61')]['id'];_0x308a7d[_0x1880('0x62')]['id']=_0x33f323[_0x1880('0x59')][_0x1880('0x63')];return db['ChatMessage'][_0x1880('0x57')]({'where':{'id':_0x33f323[_0x1880('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x15d128,null))[_0x1880('0x22')](saveUpdates(_0x33f323[_0x1880('0x59')],null))[_0x1880('0x22')](function(_0x56d566){if(_0x56d566){_0x308a7d[_0x1880('0x2b')]=_0x56d566['get']({'plain':!![]});return db[_0x1880('0x64')][_0x1880('0x57')]({'where':{'id':_0x56d566[_0x1880('0x65')]}});}return null;})[_0x1880('0x22')](handleEntityNotFound(_0x15d128,null))['then'](function(_0x215711){if(_0x215711){return _0x215711[_0x1880('0x38')]({'UserId':_0x33f323['body'][_0x1880('0x63')],'read1stAt':_[_0x1880('0x66')](_0x215711['read1stAt'])?moment()[_0x1880('0x60')](_0x1880('0x67')):undefined});}return null;})['then'](function(_0x3fc40b){if(_0x3fc40b){_0x308a7d[_0x1880('0x68')]=_0x3fc40b[_0x1880('0x69')]({'plain':!![]});interaction_log['info'](_0x1880('0x6a'),_0x33f323[_0x1880('0x61')]['id'],_0x33f323['user'][_0x1880('0x3a')],_0x33f323[_0x1880('0x61')][_0x1880('0x6b')],_0x308a7d[_0x1880('0x68')]['id'],_0x33f323[_0x1880('0x59')]?JSON[_0x1880('0x28')](_0x33f323['body']):_0x1880('0x6c'));return respondWithRpcPromise(_0x1880('0x6d'),_0x1880('0x6e'),_0x308a7d);}return null;})[_0x1880('0x22')](function(_0xef07c1){var _0x58adae=_0x1880('0x6f')+_0xef07c1[_0x1880('0x2b')][_0x1880('0x70')];return db[_0x1880('0x71')][_0x1880('0x41')](_0x58adae,{'type':db[_0x1880('0x72')][_0x1880('0x73')][_0x1880('0x74')],'raw':!![]})[_0x1880('0x22')](function(_0x24a1ca){return _0x24a1ca;});})['then'](function(_0x30d7b1){if(_0x30d7b1){_0x308a7d[_0x1880('0x2b')]['contact']=_0x30d7b1[0x0];if(!_0x33f323[_0x1880('0x59')][_0x1880('0x63')])return;return db[_0x1880('0x75')][_0x1880('0x57')]({'where':{'id':_0x33f323[_0x1880('0x59')][_0x1880('0x63')],'role':_0x1880('0x62')},'attributes':['id',_0x1880('0x3a'),_0x1880('0x76'),_0x1880('0x77'),_0x1880('0x78')],'raw':!![]});}return null;})[_0x1880('0x22')](function(_0x3aa82f){if(!_0x3aa82f)return null;_0x308a7d[_0x1880('0x2b')]['agent']=_0x3aa82f;return _0x308a7d;})[_0x1880('0x22')](function(_0x3bcc05){if(_0x3bcc05){if(_0x33f323[_0x1880('0x59')][_0x1880('0x79')]){_0x308a7d[_0x1880('0x2b')][_0x1880('0x7a')]=util[_0x1880('0x60')](_0x1880('0x7b'),_0x33f323['user']['name']);_0x308a7d['message']['channel']=_0x308a7d['channel'];_0x308a7d[_0x1880('0x2b')][_0x1880('0x7c')]=_0x308a7d[_0x1880('0x7d')];_0x308a7d['message'][_0x1880('0x7e')]=_0x1880('0x7f');return respondWithRpcPromise(_0x1880('0x80'),_0x1880('0x80'),{'event':_0x1880('0x81'),'message':_[_0x1880('0x82')](_0x308a7d[_0x1880('0x2b')],JSON['parse'](_0x308a7d[_0x1880('0x68')]['formData']))},client9002)['then'](function(){return _0x308a7d;});}return _0x308a7d;}return null;})['then'](respondWithResult(_0x15d128,null))[_0x1880('0x53')](handleError(_0x15d128,null));};var interaction_log=require(_0x1880('0x14'))(_0x1880('0x83'));exports['reject']=function(_0x1027d8,_0xd80fde,_0x3c8d3c){var _0x5549e6={'agent':{},'channel':_0x1880('0x5d')};if(_0x1027d8[_0x1880('0x59')]['id']){delete _0x1027d8[_0x1880('0x59')]['id'];}_0x1027d8[_0x1880('0x59')][_0x1880('0x63')]=_0x1027d8[_0x1880('0x59')][_0x1880('0x63')]||_0x1027d8[_0x1880('0x61')]['id'];_0x5549e6[_0x1880('0x62')]['id']=_0x1027d8[_0x1880('0x59')]['UserId'];return db[_0x1880('0x3c')]['find']({'where':{'id':_0x1027d8[_0x1880('0x5a')]['id'],'UserId':null}})[_0x1880('0x22')](handleEntityNotFound(_0xd80fde,null))['then'](function(_0x4f8f54){if(_0x4f8f54){_0x5549e6[_0x1880('0x2b')]=_0x4f8f54[_0x1880('0x69')]({'plain':!![]});return db[_0x1880('0x64')][_0x1880('0x57')]({'where':{'id':_0x4f8f54[_0x1880('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xd80fde,null))[_0x1880('0x22')](function(_0x3b44aa){if(_0x3b44aa){_0x5549e6['interaction']=_0x3b44aa[_0x1880('0x69')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1027d8['user']['id'],_0x1027d8[_0x1880('0x61')][_0x1880('0x3a')],_0x1027d8[_0x1880('0x61')]['role'],_0x5549e6[_0x1880('0x68')]['id'],_0x1027d8[_0x1880('0x59')]?JSON[_0x1880('0x28')](_0x1027d8['body']):_0x1880('0x6c'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5549e6);}return null;})[_0x1880('0x22')](function(_0x68f005){var _0x5b8cfe='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x68f005[_0x1880('0x2b')]['ContactId'];return db[_0x1880('0x71')]['query'](_0x5b8cfe,{'type':db[_0x1880('0x72')][_0x1880('0x73')][_0x1880('0x74')],'raw':!![]})[_0x1880('0x22')](function(_0x2d107c){return _0x2d107c;});})[_0x1880('0x22')](function(_0x54410f){if(_0x54410f){_0x5549e6[_0x1880('0x2b')][_0x1880('0x84')]=_0x54410f[0x0];if(!_0x1027d8['body'][_0x1880('0x63')])return;return db[_0x1880('0x75')][_0x1880('0x57')]({'where':{'id':_0x1027d8['body'][_0x1880('0x63')],'role':_0x1880('0x62')},'attributes':['id',_0x1880('0x3a'),_0x1880('0x76'),_0x1880('0x77'),'internal'],'raw':!![]});}return null;})[_0x1880('0x22')](function(_0x566a91){if(!_0x566a91)return null;_0x5549e6['message']['agent']=_0x566a91;return _0x5549e6;})[_0x1880('0x22')](function(_0x413877){if(_0x413877){_0x413877['message'][_0x1880('0x7a')]=util[_0x1880('0x60')]('SIP/%s',_0x1027d8[_0x1880('0x61')][_0x1880('0x3a')]);_0x413877['message'][_0x1880('0x7d')]=_0x5549e6['channel'];_0x413877['message'][_0x1880('0x7c')]=_0x5549e6[_0x1880('0x7d')];_0x413877[_0x1880('0x2b')][_0x1880('0x7e')]=_0x1880('0x36');respondWithRpcPromise(_0x1880('0x80'),_0x1880('0x80'),{'event':'rejectmessage','message':_['merge'](_0x5549e6[_0x1880('0x2b')],JSON['parse'](_0x5549e6[_0x1880('0x68')][_0x1880('0x85')]))},client9002);return _0x5549e6;}return null;})[_0x1880('0x22')](respondWithResult(_0xd80fde,null))[_0x1880('0x53')](handleError(_0xd80fde,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index e3c653a..c370b61 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 _0x3953=['events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x16c01c,_0x36885a){var _0x4a0a17=function(_0x2868d9){while(--_0x2868d9){_0x16c01c['push'](_0x16c01c['shift']());}};_0x4a0a17(++_0x36885a);}(_0x3953,0xa2));var _0x3395=function(_0x54e11d,_0x2c7e51){_0x54e11d=_0x54e11d-0x0;var _0x54d7ee=_0x3953[_0x54e11d];return _0x54d7ee;};'use strict';var EventEmitter=require(_0x3395('0x0'));var ChatMessage=require(_0x3395('0x1'))['db'][_0x3395('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3395('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3395('0x4'),'afterDestroy':_0x3395('0x5')};function emitEvent(_0x940eb6){return function(_0x4bb202,_0x23a058,_0x4a7804){ChatMessageEvents[_0x3395('0x6')](_0x940eb6+':'+_0x4bb202['id'],_0x4bb202);ChatMessageEvents[_0x3395('0x6')](_0x940eb6,_0x4bb202);_0x4a7804(null);};}for(var e in events){if(events[_0x3395('0x7')](e)){var event=events[e];ChatMessage[_0x3395('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x6921=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x6921,0x173));var _0x1692=function(_0x1a93c2,_0x3560e4){_0x1a93c2=_0x1a93c2-0x0;var _0x7b27d3=_0x6921[_0x1a93c2];return _0x7b27d3;};'use strict';var EventEmitter=require(_0x1692('0x0'));var ChatMessage=require(_0x1692('0x1'))['db'][_0x1692('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1692('0x3')](0x0);var events={'afterCreate':_0x1692('0x4'),'afterUpdate':_0x1692('0x5'),'afterDestroy':_0x1692('0x6')};function emitEvent(_0x5976c5){return function(_0x861491,_0x29883e,_0x21746e){ChatMessageEvents[_0x1692('0x7')](_0x5976c5+':'+_0x861491['id'],_0x861491);ChatMessageEvents['emit'](_0x5976c5,_0x861491);_0x21746e(null);};}for(var e in events){if(events[_0x1692('0x8')](e)){var event=events[e];ChatMessage[_0x1692('0x9')](e,emitEvent(event));}}module[_0x1692('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5f634da..6c2c2b2 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 _0x0360=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x551f8b,_0x15fac5){var _0x28a22c=function(_0x40eec1){while(--_0x40eec1){_0x551f8b['push'](_0x551f8b['shift']());}};_0x28a22c(++_0x15fac5);}(_0x0360,0xae));var _0x0036=function(_0x6b2d05,_0x3c3d14){_0x6b2d05=_0x6b2d05-0x0;var _0x19dcc8=_0x0360[_0x6b2d05];return _0x19dcc8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0036('0x0'));var moment=require(_0x0036('0x1'));var BPromise=require(_0x0036('0x2'));var rp=require(_0x0036('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0036('0x4'));var config=require(_0x0036('0x5'));var attributes=require(_0x0036('0x6'));module[_0x0036('0x7')]=function(_0x57b3f7,_0x128865){return _0x57b3f7[_0x0036('0x8')](_0x0036('0x9'),attributes,{'tableName':_0x0036('0xa'),'paranoid':![],'indexes':[{'name':_0x0036('0xb'),'fields':[_0x0036('0xc')],'type':_0x0036('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xaf961f,_0x4cdbeb,_0x487bb2){var _0x2f9b2d=_0x57b3f7[_0x0036('0xe')];var _0x361a81=_0xaf961f['get']({'plain':!![]});if(_0x361a81[_0x0036('0xf')]['toLowerCase']()==='in'||_0x361a81[_0x0036('0xf')][_0x0036('0x10')]()===_0x0036('0x11')&&!_0x361a81[_0x0036('0x12')]&&!_[_0x0036('0x13')](_0x361a81[_0x0036('0x14')])){_0x2f9b2d[_0x0036('0x15')][_0x0036('0x16')]({'where':{'id':_0x361a81['ChatInteractionId']}})[_0x0036('0x17')](function(_0x1ddd1e){if(_0x1ddd1e){_0x1ddd1e[_0x0036('0x18')]({'lastMsgAt':_0x361a81[_0x0036('0x19')],'lastMsgDirection':_0x361a81[_0x0036('0xf')][_0x0036('0x10')]()});}})['catch'](function(_0x4e4eba){console[_0x0036('0x1a')](_0x4e4eba);});}_0x487bb2();}},'charset':_0x0036('0x1b'),'collate':_0x0036('0x1c')});}; \ No newline at end of file +var _0x27e6=['../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','then','update','catch','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x5dd440,_0x379ea0){var _0x4fc360=function(_0x219c65){while(--_0x219c65){_0x5dd440['push'](_0x5dd440['shift']());}};_0x4fc360(++_0x379ea0);}(_0x27e6,0x121));var _0x627e=function(_0x58ebd2,_0xefcf97){_0x58ebd2=_0x58ebd2-0x0;var _0x3b074e=_0x27e6[_0x58ebd2];return _0x3b074e;};'use strict';var _=require(_0x627e('0x0'));var util=require(_0x627e('0x1'));var logger=require(_0x627e('0x2'))(_0x627e('0x3'));var moment=require(_0x627e('0x4'));var BPromise=require('bluebird');var rp=require(_0x627e('0x5'));var fs=require('fs');var path=require(_0x627e('0x6'));var rimraf=require(_0x627e('0x7'));var config=require(_0x627e('0x8'));var attributes=require('./chatMessage.attributes');module[_0x627e('0x9')]=function(_0x480c11,_0x516027){return _0x480c11[_0x627e('0xa')](_0x627e('0xb'),attributes,{'tableName':_0x627e('0xc'),'paranoid':![],'indexes':[{'name':_0x627e('0xd'),'fields':[_0x627e('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c7b2e,_0x4440a7,_0x2ebbcf){var _0x2f1e6b=_0x480c11['models'];var _0x36b7b2=_0x1c7b2e[_0x627e('0xf')]({'plain':!![]});if(_0x36b7b2[_0x627e('0x10')][_0x627e('0x11')]()==='in'||_0x36b7b2[_0x627e('0x10')][_0x627e('0x11')]()===_0x627e('0x12')&&!_0x36b7b2[_0x627e('0x13')]&&!_['isNil'](_0x36b7b2[_0x627e('0x14')])){_0x2f1e6b[_0x627e('0x15')][_0x627e('0x16')]({'where':{'id':_0x36b7b2['ChatInteractionId']}})[_0x627e('0x17')](function(_0xc18de4){if(_0xc18de4){_0xc18de4[_0x627e('0x18')]({'lastMsgAt':_0x36b7b2['createdAt'],'lastMsgDirection':_0x36b7b2[_0x627e('0x10')]['toLowerCase']()});}})[_0x627e('0x19')](function(_0x82d324){console['error'](_0x82d324);});}_0x2ebbcf();}},'charset':_0x627e('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index ffecda5..25aa358 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 _0xe6c0=['debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatMessage.socket','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe6c0,0x88));var _0x0e6c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe6c0[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x0e6c('0x0'));var moment=require(_0x0e6c('0x1'));var BPromise=require(_0x0e6c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e6c('0x3'));var db=require(_0x0e6c('0x4'))['db'];var utils=require(_0x0e6c('0x5'));var logger=require(_0x0e6c('0x6'))(_0x0e6c('0x7'));var config=require(_0x0e6c('0x8'));var jayson=require(_0x0e6c('0x9'));var client=jayson[_0x0e6c('0xa')][_0x0e6c('0xb')]({'port':0x232a});config[_0x0e6c('0xc')]=_['defaults'](config[_0x0e6c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e6c('0xd'))(new Redis(config[_0x0e6c('0xc')]));require(_0x0e6c('0xe'))['register'](socket);function respondWithRpcPromise(_0x1ab680,_0x4a847f,_0x5055a2){return new BPromise(function(_0x4fafb8,_0xef9308){return client[_0x0e6c('0xf')](_0x1ab680,_0x5055a2)['then'](function(_0x48951f){logger[_0x0e6c('0x10')](_0x0e6c('0x11'),_0x4a847f,_0x0e6c('0x12'));logger[_0x0e6c('0x13')](_0x0e6c('0x14'),_0x4a847f,_0x0e6c('0x12'),JSON['stringify'](_0x48951f));if(_0x48951f[_0x0e6c('0x15')]){if(_0x48951f[_0x0e6c('0x15')]['code']===0x1f4){logger[_0x0e6c('0x15')](_0x0e6c('0x11'),_0x4a847f,_0x48951f[_0x0e6c('0x15')][_0x0e6c('0x16')]);return _0xef9308(_0x48951f['error'][_0x0e6c('0x16')]);}logger[_0x0e6c('0x15')](_0x0e6c('0x11'),_0x4a847f,_0x48951f[_0x0e6c('0x15')][_0x0e6c('0x16')]);return _0x4fafb8(_0x48951f[_0x0e6c('0x15')][_0x0e6c('0x16')]);}else{logger['info'](_0x0e6c('0x11'),_0x4a847f,_0x0e6c('0x12'));_0x4fafb8(_0x48951f[_0x0e6c('0x17')][_0x0e6c('0x16')]);}})[_0x0e6c('0x18')](function(_0x436ad6){logger[_0x0e6c('0x15')]('ChatMessage,\x20%s,\x20%s',_0x4a847f,_0x436ad6);_0xef9308(_0x436ad6);});});}exports[_0x0e6c('0x19')]=function(_0x15878){var _0x3cf4fd=this;return new Promise(function(_0x477a30,_0x3e73bf){return db[_0x0e6c('0x1a')][_0x0e6c('0x1b')](_0x15878['body'],{'raw':_0x15878[_0x0e6c('0x1c')]?_0x15878[_0x0e6c('0x1c')][_0x0e6c('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2ed28c){logger['info'](_0x0e6c('0x19'),_0x15878);logger[_0x0e6c('0x13')](_0x0e6c('0x19'),_0x15878,JSON[_0x0e6c('0x1e')](_0x2ed28c));_0x477a30(_0x2ed28c);})[_0x0e6c('0x18')](function(_0x55028e){logger['error'](_0x0e6c('0x19'),_0x55028e[_0x0e6c('0x16')],_0x15878);_0x3e73bf(_0x3cf4fd[_0x0e6c('0x15')](0x1f4,_0x55028e[_0x0e6c('0x16')]));});});}; \ No newline at end of file +var _0x70e2=['body','options','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create'];(function(_0x395568,_0x3035b5){var _0x2c2485=function(_0x28588c){while(--_0x28588c){_0x395568['push'](_0x395568['shift']());}};_0x2c2485(++_0x3035b5);}(_0x70e2,0x107));var _0x270e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x70e2[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x270e('0x0'));var util=require(_0x270e('0x1'));var moment=require(_0x270e('0x2'));var BPromise=require(_0x270e('0x3'));var rs=require(_0x270e('0x4'));var fs=require('fs');var Redis=require(_0x270e('0x5'));var db=require(_0x270e('0x6'))['db'];var utils=require(_0x270e('0x7'));var logger=require(_0x270e('0x8'))(_0x270e('0x9'));var config=require('../../config/environment');var jayson=require(_0x270e('0xa'));var client=jayson['client'][_0x270e('0xb')]({'port':0x232a});config[_0x270e('0xc')]=_[_0x270e('0xd')](config[_0x270e('0xc')],{'host':_0x270e('0xe'),'port':0x18eb});var socket=require(_0x270e('0xf'))(new Redis(config['redis']));require(_0x270e('0x10'))[_0x270e('0x11')](socket);function respondWithRpcPromise(_0x5bdebb,_0x5c956c,_0x2e0e47){return new BPromise(function(_0x306840,_0x2b6e72){return client[_0x270e('0x12')](_0x5bdebb,_0x2e0e47)[_0x270e('0x13')](function(_0x5719b0){logger['info'](_0x270e('0x14'),_0x5c956c,'request\x20sent');logger[_0x270e('0x15')](_0x270e('0x16'),_0x5c956c,_0x270e('0x17'),JSON[_0x270e('0x18')](_0x5719b0));if(_0x5719b0[_0x270e('0x19')]){if(_0x5719b0[_0x270e('0x19')][_0x270e('0x1a')]===0x1f4){logger[_0x270e('0x19')](_0x270e('0x14'),_0x5c956c,_0x5719b0['error']['message']);return _0x2b6e72(_0x5719b0[_0x270e('0x19')][_0x270e('0x1b')]);}logger[_0x270e('0x19')](_0x270e('0x14'),_0x5c956c,_0x5719b0['error'][_0x270e('0x1b')]);return _0x306840(_0x5719b0['error'][_0x270e('0x1b')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x5c956c,'request\x20sent');_0x306840(_0x5719b0[_0x270e('0x1c')][_0x270e('0x1b')]);}})[_0x270e('0x1d')](function(_0x391685){logger[_0x270e('0x19')](_0x270e('0x14'),_0x5c956c,_0x391685);_0x2b6e72(_0x391685);});});}exports[_0x270e('0x1e')]=function(_0x2abbab){var _0x45f0f0=this;return new Promise(function(_0x350fca,_0x77216d){return db[_0x270e('0x1f')][_0x270e('0x20')](_0x2abbab[_0x270e('0x21')],{'raw':_0x2abbab[_0x270e('0x22')]?_0x2abbab[_0x270e('0x22')][_0x270e('0x23')]===undefined?!![]:![]:!![]})[_0x270e('0x13')](function(_0x2dbcce){logger[_0x270e('0x24')](_0x270e('0x1e'),_0x2abbab);logger[_0x270e('0x15')](_0x270e('0x1e'),_0x2abbab,JSON['stringify'](_0x2dbcce));_0x350fca(_0x2dbcce);})[_0x270e('0x1d')](function(_0x503dd0){logger[_0x270e('0x19')]('CreateChatMessage',_0x503dd0['message'],_0x2abbab);_0x77216d(_0x45f0f0['error'](0x1f4,_0x503dd0[_0x270e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 8e8df58..6cc1eb5 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 _0x25fa=['remove','update','emit','removeListener','length','chatMessage:','./chatMessage.events'];(function(_0x1ee611,_0x377a3a){var _0x3bce0a=function(_0x5357c6){while(--_0x5357c6){_0x1ee611['push'](_0x1ee611['shift']());}};_0x3bce0a(++_0x377a3a);}(_0x25fa,0x109));var _0xa25f=function(_0x24568f,_0x361551){_0x24568f=_0x24568f-0x0;var _0x220479=_0x25fa[_0x24568f];return _0x220479;};'use strict';var ChatMessageEvents=require(_0xa25f('0x0'));var events=['save',_0xa25f('0x1'),_0xa25f('0x2')];function createListener(_0x57e272,_0x408155){return function(_0xb88bd8){_0x408155[_0xa25f('0x3')](_0x57e272,_0xb88bd8);};}function removeListener(_0x4d0b34,_0x4e444d){return function(){ChatMessageEvents[_0xa25f('0x4')](_0x4d0b34,_0x4e444d);};}exports['register']=function(_0x2ea9ea){for(var _0x3ab530=0x0,_0x29666d=events[_0xa25f('0x5')];_0x3ab530<_0x29666d;_0x3ab530++){var _0x22982b=events[_0x3ab530];var _0x168907=createListener(_0xa25f('0x6')+_0x22982b,_0x2ea9ea);ChatMessageEvents['on'](_0x22982b,_0x168907);}}; \ No newline at end of file +var _0x6d19=['./chatMessage.events','save','remove','update','removeListener','register','length','chatMessage:'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x6d19,0x160));var _0x96d1=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x6d19[_0x4792c8];return _0x35edb1;};'use strict';var ChatMessageEvents=require(_0x96d1('0x0'));var events=[_0x96d1('0x1'),_0x96d1('0x2'),_0x96d1('0x3')];function createListener(_0x874fcb,_0x31518c){return function(_0x36405d){_0x31518c['emit'](_0x874fcb,_0x36405d);};}function removeListener(_0x186315,_0x394a34){return function(){ChatMessageEvents[_0x96d1('0x4')](_0x186315,_0x394a34);};}exports[_0x96d1('0x5')]=function(_0x58854b){for(var _0x32b7d9=0x0,_0x230638=events[_0x96d1('0x6')];_0x32b7d9<_0x230638;_0x32b7d9++){var _0x58ade3=events[_0x32b7d9];var _0xba2d03=createListener(_0x96d1('0x7')+_0x58ade3,_0x58854b);ChatMessageEvents['on'](_0x58ade3,_0xba2d03);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 812fa26..d27ebc6 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 _0x2e32=['fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','describe','/:id','post','tracked','chatmessage:create','create','update','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x474148,_0x1343ad){var _0x531750=function(_0x1914ab){while(--_0x1914ab){_0x474148['push'](_0x474148['shift']());}};_0x531750(++_0x1343ad);}(_0x2e32,0x128));var _0x22e3=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x2e32[_0x26f702];return _0x11417d;};'use strict';var multer=require('multer');var util=require(_0x22e3('0x0'));var path=require('path');var timeout=require(_0x22e3('0x1'));var express=require(_0x22e3('0x2'));var router=express[_0x22e3('0x3')]();var fs_extra=require(_0x22e3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x22e3('0x5'));var config=require(_0x22e3('0x6'));var controller=require(_0x22e3('0x7'));router['get']('/',auth[_0x22e3('0x8')](),controller[_0x22e3('0x9')]);router[_0x22e3('0xa')]('/describe',auth[_0x22e3('0x8')](),controller[_0x22e3('0xb')]);router['get'](_0x22e3('0xc'),auth[_0x22e3('0x8')](),controller['show']);router[_0x22e3('0xd')]('/',auth[_0x22e3('0x8')](),interaction[_0x22e3('0xe')]('chat',_0x22e3('0xf')),controller[_0x22e3('0x10')]);router['put'](_0x22e3('0xc'),controller[_0x22e3('0x11')]);router[_0x22e3('0x12')](_0x22e3('0x13'),auth[_0x22e3('0x8')](),controller['accept']);router[_0x22e3('0x12')](_0x22e3('0x14'),auth['isAuthenticated'](),controller[_0x22e3('0x15')]);router[_0x22e3('0x16')]('/:id',auth[_0x22e3('0x8')](),controller[_0x22e3('0x17')]);module[_0x22e3('0x18')]=router; \ No newline at end of file +var _0xef60=['chatmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xef60,0x189));var _0x0ef6=function(_0x2c9989,_0x538f37){_0x2c9989=_0x2c9989-0x0;var _0x33663e=_0xef60[_0x2c9989];return _0x33663e;};'use strict';var multer=require('multer');var util=require(_0x0ef6('0x0'));var path=require(_0x0ef6('0x1'));var timeout=require(_0x0ef6('0x2'));var express=require('express');var router=express[_0x0ef6('0x3')]();var fs_extra=require(_0x0ef6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0ef6('0x5'));var config=require('../../config/environment');var controller=require(_0x0ef6('0x6'));router[_0x0ef6('0x7')]('/',auth[_0x0ef6('0x8')](),controller['index']);router[_0x0ef6('0x7')](_0x0ef6('0x9'),auth['isAuthenticated'](),controller[_0x0ef6('0xa')]);router[_0x0ef6('0x7')](_0x0ef6('0xb'),auth[_0x0ef6('0x8')](),controller[_0x0ef6('0xc')]);router[_0x0ef6('0xd')]('/',auth[_0x0ef6('0x8')](),interaction[_0x0ef6('0xe')]('chat',_0x0ef6('0xf')),controller[_0x0ef6('0x10')]);router['put'](_0x0ef6('0xb'),controller['update']);router[_0x0ef6('0x11')](_0x0ef6('0x12'),auth[_0x0ef6('0x8')](),controller[_0x0ef6('0x13')]);router[_0x0ef6('0x11')](_0x0ef6('0x14'),auth[_0x0ef6('0x8')](),controller[_0x0ef6('0x15')]);router[_0x0ef6('0x16')]('/:id',auth[_0x0ef6('0x8')](),controller['destroy']);module[_0x0ef6('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 45a5c33..b07c4a8 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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x55af86,_0x5c8ff6){_0x55af86=_0x55af86-0x0;var _0x58df3b=_0x0b0e[_0x55af86];return _0x58df3b;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x5aa847,_0x34149b){var _0x18c377=function(_0x417a3b){while(--_0x417a3b){_0x5aa847['push'](_0x5aa847['shift']());}};_0x18c377(++_0x34149b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a17ab,_0x58c7f4){_0x5a17ab=_0x5a17ab-0x0;var _0x44bc4c=_0x5f2f[_0x5a17ab];return _0x44bc4c;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 5e79dcc..cfc7b99 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(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x7a54,0x106));var _0x47a5=function(_0x3bac36,_0x31036c){_0x3bac36=_0x3bac36-0x0;var _0x1a2be6=_0x7a54[_0x3bac36];return _0x1a2be6;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x112676,_0x46a05b){var _0x45ee73=function(_0xf34549){while(--_0xf34549){_0x112676['push'](_0x112676['shift']());}};_0x45ee73(++_0x46a05b);}(_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(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index db0b7a0..65419c7 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad5f=['exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3e6793,_0x48ec08){var _0x5277f0=function(_0x590cc7){while(--_0x590cc7){_0x3e6793['push'](_0x3e6793['shift']());}};_0x5277f0(++_0x48ec08);}(_0xad5f,0x1a8));var _0xfad5=function(_0x913b85,_0x213182){_0x913b85=_0x913b85-0x0;var _0x1ce434=_0xad5f[_0x913b85];return _0x1ce434;};'use strict';var EventEmitter=require(_0xfad5('0x0'));var ChatOfflineMessage=require(_0xfad5('0x1'))['db'][_0xfad5('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xfad5('0x3')](0x0);var events={'afterCreate':_0xfad5('0x4'),'afterUpdate':_0xfad5('0x5'),'afterDestroy':'remove'};function emitEvent(_0xcc61b1){return function(_0x316561,_0x1ae06d,_0x2da73e){ChatOfflineMessageEvents[_0xfad5('0x6')](_0xcc61b1+':'+_0x316561['id'],_0x316561);ChatOfflineMessageEvents[_0xfad5('0x6')](_0xcc61b1,_0x316561);_0x2da73e(null);};}for(var e in events){if(events[_0xfad5('0x7')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xfad5('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x81a5=['emit','exports','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','remove'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x81a5,0x17c));var _0x581a=function(_0x31992b,_0x31ddd7){_0x31992b=_0x31992b-0x0;var _0xebda77=_0x81a5[_0x31992b];return _0xebda77;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x581a('0x0'))['db'][_0x581a('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x581a('0x2')](0x0);var events={'afterCreate':_0x581a('0x3'),'afterUpdate':'update','afterDestroy':_0x581a('0x4')};function emitEvent(_0x107c57){return function(_0x55940d,_0x3d31cd,_0x4b28eb){ChatOfflineMessageEvents[_0x581a('0x5')](_0x107c57+':'+_0x55940d['id'],_0x55940d);ChatOfflineMessageEvents[_0x581a('0x5')](_0x107c57,_0x55940d);_0x4b28eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x581a('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index c043910..6aaa808 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 _0x9bfb=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x313911,_0x4e7da1){var _0x369790=function(_0x2aeb31){while(--_0x2aeb31){_0x313911['push'](_0x313911['shift']());}};_0x369790(++_0x4e7da1);}(_0x9bfb,0x16a));var _0xb9bf=function(_0x195fbb,_0x3e7933){_0x195fbb=_0x195fbb-0x0;var _0x6c5304=_0x9bfb[_0x195fbb];return _0x6c5304;};'use strict';var attributes=require(_0xb9bf('0x0'));module[_0xb9bf('0x1')]=function(_0x5f4620){return _0x5f4620[_0xb9bf('0x2')](_0xb9bf('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9bf('0x4'),'collate':_0xb9bf('0x5')});}; \ No newline at end of file +var _0xa53c=['utf8mb4_unicode_ci','ChatOfflineMessage','utf8mb4'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0xa53c,0x8e));var _0xca53=function(_0x47cc3f,_0x2dcc5d){_0x47cc3f=_0x47cc3f-0x0;var _0x272464=_0xa53c[_0x47cc3f];return _0x272464;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x4792ab){return _0x4792ab['define'](_0xca53('0x0'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xca53('0x1'),'collate':_0xca53('0x2')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index c2cf29d..7293974 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 _0x3d17=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','lodash','util','moment'];(function(_0x46cc70,_0x46ee26){var _0xa54f3c=function(_0x30d94b){while(--_0x30d94b){_0x46cc70['push'](_0x46cc70['shift']());}};_0xa54f3c(++_0x46ee26);}(_0x3d17,0x1cb));var _0x73d1=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x3d17[_0x5e3701];return _0x345dcf;};'use strict';var _=require(_0x73d1('0x0'));var util=require(_0x73d1('0x1'));var moment=require(_0x73d1('0x2'));var BPromise=require(_0x73d1('0x3'));var rs=require(_0x73d1('0x4'));var fs=require('fs');var Redis=require(_0x73d1('0x5'));var db=require(_0x73d1('0x6'))['db'];var utils=require(_0x73d1('0x7'));var logger=require('../../config/logger')(_0x73d1('0x8'));var config=require(_0x73d1('0x9'));var jayson=require(_0x73d1('0xa'));var client=jayson[_0x73d1('0xb')][_0x73d1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48a4d3,_0x1e6ee1,_0x1d018b){return new BPromise(function(_0x5261b5,_0x6319a6){return client[_0x73d1('0xd')](_0x48a4d3,_0x1d018b)[_0x73d1('0xe')](function(_0xf34cac){logger[_0x73d1('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1e6ee1,_0x73d1('0x10'));logger[_0x73d1('0x11')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1e6ee1,'request\x20sent',JSON['stringify'](_0xf34cac));if(_0xf34cac[_0x73d1('0x12')]){if(_0xf34cac[_0x73d1('0x12')][_0x73d1('0x13')]===0x1f4){logger[_0x73d1('0x12')](_0x73d1('0x14'),_0x1e6ee1,_0xf34cac[_0x73d1('0x12')][_0x73d1('0x15')]);return _0x6319a6(_0xf34cac['error'][_0x73d1('0x15')]);}logger[_0x73d1('0x12')](_0x73d1('0x14'),_0x1e6ee1,_0xf34cac['error'][_0x73d1('0x15')]);return _0x5261b5(_0xf34cac['error'][_0x73d1('0x15')]);}else{logger[_0x73d1('0xf')](_0x73d1('0x14'),_0x1e6ee1,_0x73d1('0x10'));_0x5261b5(_0xf34cac['result']['message']);}})['catch'](function(_0x179ae1){logger[_0x73d1('0x12')](_0x73d1('0x14'),_0x1e6ee1,_0x179ae1);_0x6319a6(_0x179ae1);});});} \ No newline at end of file +var _0x9208=['error','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9208,0x108));var _0x8920=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9208[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8920('0x0'));var util=require(_0x8920('0x1'));var moment=require('moment');var BPromise=require(_0x8920('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8920('0x3'))['db'];var utils=require(_0x8920('0x4'));var logger=require(_0x8920('0x5'))(_0x8920('0x6'));var config=require('../../config/environment');var jayson=require(_0x8920('0x7'));var client=jayson[_0x8920('0x8')][_0x8920('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54eb58,_0x3db362,_0x185860){return new BPromise(function(_0x24f425,_0x2dd9b1){return client[_0x8920('0xa')](_0x54eb58,_0x185860)[_0x8920('0xb')](function(_0x3a7211){logger[_0x8920('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3db362,_0x8920('0xd'));logger[_0x8920('0xe')](_0x8920('0xf'),_0x3db362,_0x8920('0xd'),JSON['stringify'](_0x3a7211));if(_0x3a7211[_0x8920('0x10')]){if(_0x3a7211[_0x8920('0x10')]['code']===0x1f4){logger[_0x8920('0x10')](_0x8920('0x11'),_0x3db362,_0x3a7211['error'][_0x8920('0x12')]);return _0x2dd9b1(_0x3a7211['error'][_0x8920('0x12')]);}logger[_0x8920('0x10')](_0x8920('0x11'),_0x3db362,_0x3a7211[_0x8920('0x10')][_0x8920('0x12')]);return _0x24f425(_0x3a7211[_0x8920('0x10')][_0x8920('0x12')]);}else{logger[_0x8920('0xc')](_0x8920('0x11'),_0x3db362,_0x8920('0xd'));_0x24f425(_0x3a7211['result'][_0x8920('0x12')]);}})[_0x8920('0x13')](function(_0x6924c8){logger['error'](_0x8920('0x11'),_0x3db362,_0x6924c8);_0x2dd9b1(_0x6924c8);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 373468c..fcd8a27 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 _0xdac8=['./chatOfflineMessage.controller','get','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x553559,_0x1a3e3f){var _0x51819=function(_0xcfe7d9){while(--_0xcfe7d9){_0x553559['push'](_0x553559['shift']());}};_0x51819(++_0x1a3e3f);}(_0xdac8,0x11f));var _0x8dac=function(_0x4a8ecb,_0x3d7e49){_0x4a8ecb=_0x4a8ecb-0x0;var _0x3301f0=_0xdac8[_0x4a8ecb];return _0x3301f0;};'use strict';var multer=require(_0x8dac('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8dac('0x1'));var express=require(_0x8dac('0x2'));var router=express[_0x8dac('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8dac('0x4'));var interaction=require(_0x8dac('0x5'));var config=require(_0x8dac('0x6'));var controller=require(_0x8dac('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8dac('0x8')](_0x8dac('0x9'),auth['isAuthenticated'](),controller[_0x8dac('0xa')]);router[_0x8dac('0x8')](_0x8dac('0xb'),auth[_0x8dac('0xc')](),controller[_0x8dac('0xd')]);router[_0x8dac('0xe')]('/',auth[_0x8dac('0xc')](),controller[_0x8dac('0xf')]);router[_0x8dac('0x10')]('/:id',auth[_0x8dac('0xc')](),controller[_0x8dac('0x11')]);router[_0x8dac('0x12')](_0x8dac('0xb'),auth['isAuthenticated'](),controller[_0x8dac('0x13')]);module[_0x8dac('0x14')]=router; \ No newline at end of file +var _0x1c78=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0x1c78,0x1b2));var _0x81c7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1c78[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x81c7('0x0'));var util=require(_0x81c7('0x1'));var path=require('path');var timeout=require(_0x81c7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x81c7('0x3'));var auth=require(_0x81c7('0x4'));var interaction=require(_0x81c7('0x5'));var config=require(_0x81c7('0x6'));var controller=require(_0x81c7('0x7'));router[_0x81c7('0x8')]('/',auth[_0x81c7('0x9')](),controller['index']);router[_0x81c7('0x8')]('/describe',auth[_0x81c7('0x9')](),controller[_0x81c7('0xa')]);router[_0x81c7('0x8')](_0x81c7('0xb'),auth['isAuthenticated'](),controller[_0x81c7('0xc')]);router[_0x81c7('0xd')]('/',auth['isAuthenticated'](),controller[_0x81c7('0xe')]);router['put'](_0x81c7('0xb'),auth['isAuthenticated'](),controller[_0x81c7('0xf')]);router[_0x81c7('0x10')]('/:id',auth[_0x81c7('0x9')](),controller[_0x81c7('0x11')]);module[_0x81c7('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 537bc1f..55856f0 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 _0x7c2d=['exports','mouseOver','INTEGER'];(function(_0x2424de,_0x4f093e){var _0x56add1=function(_0xf05dee){while(--_0xf05dee){_0x2424de['push'](_0x2424de['shift']());}};_0x56add1(++_0x4f093e);}(_0x7c2d,0x11d));var _0xd7c2=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x7c2d[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require('sequelize');module[_0xd7c2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd7c2('0x1'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd7c2('0x2')]}}; \ No newline at end of file +var _0x2fc3=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x12e1b8,_0x423530){var _0x5d4243=function(_0x367d3f){while(--_0x367d3f){_0x12e1b8['push'](_0x12e1b8['shift']());}};_0x5d4243(++_0x423530);}(_0x2fc3,0x104));var _0x32fc=function(_0x788559,_0x1f69fa){_0x788559=_0x788559-0x0;var _0xe3a758=_0x2fc3[_0x788559];return _0xe3a758;};'use strict';var Sequelize=require(_0x32fc('0x0'));module[_0x32fc('0x1')]={'name':{'type':Sequelize[_0x32fc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x32fc('0x3')](_0x32fc('0x4'),_0x32fc('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x32fc('0x2')]},'timeout':{'type':Sequelize[_0x32fc('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 4b1aa61..ed019a3 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 _0x503a=['path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','options','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x3c6181,_0x36229f){var _0x3ddd5f=function(_0x4b096e){while(--_0x4b096e){_0x3c6181['push'](_0x3c6181['shift']());}};_0x3ddd5f(++_0x36229f);}(_0x503a,0x19d));var _0xa503=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x503a[_0x397cfb];return _0x15fed9;};'use strict';var emlformat=require(_0xa503('0x0'));var rimraf=require(_0xa503('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa503('0x2'));var rp=require('request-promise');var moment=require(_0xa503('0x3'));var BPromise=require(_0xa503('0x4'));var Mustache=require(_0xa503('0x5'));var util=require(_0xa503('0x6'));var path=require(_0xa503('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa503('0x8'));var _=require(_0xa503('0x9'));var squel=require('squel');var crypto=require(_0xa503('0xa'));var jsforce=require(_0xa503('0xb'));var deskjs=require(_0xa503('0xc'));var toCsv=require(_0xa503('0xd'));var querystring=require(_0xa503('0xe'));var Papa=require(_0xa503('0xf'));var Redis=require(_0xa503('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa503('0x11'));var as=require(_0xa503('0x12'));var hardwareService=require(_0xa503('0x13'));var logger=require('../../config/logger')(_0xa503('0x14'));var utils=require('../../config/utils');var config=require(_0xa503('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa503('0x16'))['db'];function respondWithStatusCode(_0x29df40,_0x4a47a2){_0x4a47a2=_0x4a47a2||0xcc;return function(_0x524b6c){if(_0x524b6c){return _0x29df40[_0xa503('0x17')](_0x4a47a2);}return _0x29df40[_0xa503('0x18')](_0x4a47a2)[_0xa503('0x19')]();};}function respondWithResult(_0x1db19b,_0x32174a){_0x32174a=_0x32174a||0xc8;return function(_0x1c1971){if(_0x1c1971){return _0x1db19b[_0xa503('0x18')](_0x32174a)[_0xa503('0x1a')](_0x1c1971);}};}function respondWithFilteredResult(_0x3ae1b0,_0x3e81b7){return function(_0x3cbfb6){if(_0x3cbfb6){var _0x36f98d=typeof _0x3e81b7[_0xa503('0x1b')]===_0xa503('0x1c')&&typeof _0x3e81b7['limit']===_0xa503('0x1c');var _0x2a9557=_0x3cbfb6[_0xa503('0x1d')];var _0x11e4a5=_0x36f98d?0x0:_0x3e81b7[_0xa503('0x1b')];var _0x5aae98=_0x36f98d?_0x3cbfb6[_0xa503('0x1d')]:_0x3e81b7['offset']+_0x3e81b7[_0xa503('0x1e')];var _0x4157f5;if(_0x5aae98>=_0x2a9557){_0x5aae98=_0x2a9557;_0x4157f5=0xc8;}else{_0x4157f5=0xce;}_0x3ae1b0[_0xa503('0x18')](_0x4157f5);return _0x3ae1b0[_0xa503('0x1f')](_0xa503('0x20'),_0x11e4a5+'-'+_0x5aae98+'/'+_0x2a9557)[_0xa503('0x1a')](_0x3cbfb6);}return null;};}function patchUpdates(_0x207bfb){return function(_0x10486f){try{jsonpatch[_0xa503('0x21')](_0x10486f,_0x207bfb,!![]);}catch(_0x22f758){return BPromise[_0xa503('0x22')](_0x22f758);}return _0x10486f[_0xa503('0x23')]();};}function saveUpdates(_0x57a26e,_0x5d56e8){return function(_0x420de8){if(_0x420de8){return _0x420de8[_0xa503('0x24')](_0x57a26e)[_0xa503('0x25')](function(_0x469ad6){return _0x469ad6;});}return null;};}function removeEntity(_0x1b125c,_0x5e0402){return function(_0x19f679){if(_0x19f679){return _0x19f679[_0xa503('0x26')]()[_0xa503('0x25')](function(){_0x1b125c['status'](0xcc)[_0xa503('0x19')]();});}};}function handleEntityNotFound(_0x22c7ec,_0x49df0e){return function(_0x686750){if(!_0x686750){_0x22c7ec['sendStatus'](0x194);}return _0x686750;};}function handleError(_0x26b787,_0x2b059d){_0x2b059d=_0x2b059d||0x1f4;return function(_0x3289d4){logger[_0xa503('0x27')](_0x3289d4['stack']);if(_0x3289d4['name']){delete _0x3289d4[_0xa503('0x28')];}_0x26b787[_0xa503('0x18')](_0x2b059d)[_0xa503('0x29')](_0x3289d4);};}exports[_0xa503('0x2a')]=function(_0x37dee2,_0x404733){var _0x57f92b={'raw':!![],'where':{'id':_0x37dee2[_0xa503('0x2b')]['id']}},_0x156f08={};_0x156f08[_0xa503('0x2c')]=_[_0xa503('0x2d')](db['ChatProactiveAction'][_0xa503('0x2e')]);_0x156f08['query']=_[_0xa503('0x2d')](_0x37dee2[_0xa503('0x2f')]);_0x156f08[_0xa503('0x30')]=_[_0xa503('0x31')](_0x156f08[_0xa503('0x2c')],_0x156f08[_0xa503('0x2f')]);_0x57f92b[_0xa503('0x32')]=_['intersection'](_0x156f08[_0xa503('0x2c')],qs[_0xa503('0x33')](_0x37dee2[_0xa503('0x2f')][_0xa503('0x33')]));_0x57f92b[_0xa503('0x32')]=_0x57f92b[_0xa503('0x32')][_0xa503('0x34')]?_0x57f92b[_0xa503('0x32')]:_0x156f08[_0xa503('0x2c')];if(_0x37dee2['query'][_0xa503('0x35')]){_0x57f92b['include']=[{'all':!![]}];}_0x57f92b=_['merge']({},_0x57f92b,_0x37dee2[_0xa503('0x36')]);return db[_0xa503('0x37')][_0xa503('0x38')](_0x57f92b)[_0xa503('0x25')](handleEntityNotFound(_0x404733,null))[_0xa503('0x25')](respondWithResult(_0x404733,null))[_0xa503('0x39')](handleError(_0x404733,null));};exports[_0xa503('0x3a')]=function(_0x5477b9,_0x5952ec){return db[_0xa503('0x37')][_0xa503('0x3a')](_0x5477b9[_0xa503('0x3b')],{})[_0xa503('0x25')](respondWithResult(_0x5952ec,0xc9))[_0xa503('0x39')](handleError(_0x5952ec,null));};exports[_0xa503('0x24')]=function(_0x9d39c2,_0x22bcd5){if(_0x9d39c2['body']['id']){delete _0x9d39c2[_0xa503('0x3b')]['id'];}return db[_0xa503('0x37')][_0xa503('0x38')]({'where':{'id':_0x9d39c2[_0xa503('0x2b')]['id']}})['then'](handleEntityNotFound(_0x22bcd5,null))[_0xa503('0x25')](saveUpdates(_0x9d39c2[_0xa503('0x3b')],null))['then'](respondWithResult(_0x22bcd5,null))[_0xa503('0x39')](handleError(_0x22bcd5,null));};exports['destroy']=function(_0xcc6711,_0x21e6b8){return db['ChatProactiveAction'][_0xa503('0x38')]({'where':{'id':_0xcc6711[_0xa503('0x2b')]['id']}})['then'](handleEntityNotFound(_0x21e6b8,null))[_0xa503('0x25')](removeEntity(_0x21e6b8,null))[_0xa503('0x39')](handleError(_0x21e6b8,null));}; \ No newline at end of file +var _0x864a=['set','Content-Range','reject','update','then','destroy','stack','name','send','model','ChatProactiveAction','rawAttributes','keys','query','filters','attributes','intersection','fields','length','includeAll','options','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x864a,0x8a));var _0xa864=function(_0x311a2f,_0xa832c1){_0x311a2f=_0x311a2f-0x0;var _0x33b564=_0x864a[_0x311a2f];return _0x33b564;};'use strict';var emlformat=require(_0xa864('0x0'));var rimraf=require(_0xa864('0x1'));var zipdir=require(_0xa864('0x2'));var jsonpatch=require(_0xa864('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa864('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa864('0x5'));var csv=require(_0xa864('0x6'));var ejs=require(_0xa864('0x7'));var fs=require('fs');var fs_extra=require(_0xa864('0x8'));var _=require(_0xa864('0x9'));var squel=require('squel');var crypto=require(_0xa864('0xa'));var jsforce=require(_0xa864('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa864('0x6'));var querystring=require(_0xa864('0xc'));var Papa=require(_0xa864('0xd'));var Redis=require(_0xa864('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa864('0xf'));var hardwareService=require(_0xa864('0x10'));var logger=require(_0xa864('0x11'))(_0xa864('0x12'));var utils=require(_0xa864('0x13'));var config=require(_0xa864('0x14'));var licenseUtil=require(_0xa864('0x15'));var db=require(_0xa864('0x16'))['db'];function respondWithStatusCode(_0x44a6b7,_0x1c4242){_0x1c4242=_0x1c4242||0xcc;return function(_0x5f3cc2){if(_0x5f3cc2){return _0x44a6b7[_0xa864('0x17')](_0x1c4242);}return _0x44a6b7[_0xa864('0x18')](_0x1c4242)['end']();};}function respondWithResult(_0x9e3d5a,_0x6e0430){_0x6e0430=_0x6e0430||0xc8;return function(_0x2d82d1){if(_0x2d82d1){return _0x9e3d5a[_0xa864('0x18')](_0x6e0430)[_0xa864('0x19')](_0x2d82d1);}};}function respondWithFilteredResult(_0x2aeed5,_0x4a3055){return function(_0x43a1f7){if(_0x43a1f7){var _0x212513=typeof _0x4a3055[_0xa864('0x1a')]===_0xa864('0x1b')&&typeof _0x4a3055[_0xa864('0x1c')]===_0xa864('0x1b');var _0x2e8336=_0x43a1f7[_0xa864('0x1d')];var _0x5e7d59=_0x212513?0x0:_0x4a3055[_0xa864('0x1a')];var _0x40cc6a=_0x212513?_0x43a1f7['count']:_0x4a3055[_0xa864('0x1a')]+_0x4a3055[_0xa864('0x1c')];var _0x1b3941;if(_0x40cc6a>=_0x2e8336){_0x40cc6a=_0x2e8336;_0x1b3941=0xc8;}else{_0x1b3941=0xce;}_0x2aeed5[_0xa864('0x18')](_0x1b3941);return _0x2aeed5[_0xa864('0x1e')](_0xa864('0x1f'),_0x5e7d59+'-'+_0x40cc6a+'/'+_0x2e8336)[_0xa864('0x19')](_0x43a1f7);}return null;};}function patchUpdates(_0x91b2dc){return function(_0x7e9cab){try{jsonpatch['apply'](_0x7e9cab,_0x91b2dc,!![]);}catch(_0xc4c6ce){return BPromise[_0xa864('0x20')](_0xc4c6ce);}return _0x7e9cab['save']();};}function saveUpdates(_0x14873a,_0x37dc42){return function(_0x31d019){if(_0x31d019){return _0x31d019[_0xa864('0x21')](_0x14873a)[_0xa864('0x22')](function(_0x3b6bd5){return _0x3b6bd5;});}return null;};}function removeEntity(_0x452be5,_0x544415){return function(_0x282b12){if(_0x282b12){return _0x282b12[_0xa864('0x23')]()['then'](function(){_0x452be5[_0xa864('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f2068,_0x7beb66){return function(_0x2e7123){if(!_0x2e7123){_0x3f2068['sendStatus'](0x194);}return _0x2e7123;};}function handleError(_0x4ec4e4,_0xa77740){_0xa77740=_0xa77740||0x1f4;return function(_0x474872){logger['error'](_0x474872[_0xa864('0x24')]);if(_0x474872[_0xa864('0x25')]){delete _0x474872[_0xa864('0x25')];}_0x4ec4e4[_0xa864('0x18')](_0xa77740)[_0xa864('0x26')](_0x474872);};}exports['show']=function(_0x4235e8,_0x1b3e9f){var _0x4e519b={'raw':!![],'where':{'id':_0x4235e8['params']['id']}},_0x18da54={};_0x18da54[_0xa864('0x27')]=_['keys'](db[_0xa864('0x28')][_0xa864('0x29')]);_0x18da54['query']=_[_0xa864('0x2a')](_0x4235e8[_0xa864('0x2b')]);_0x18da54[_0xa864('0x2c')]=_['intersection'](_0x18da54[_0xa864('0x27')],_0x18da54['query']);_0x4e519b[_0xa864('0x2d')]=_[_0xa864('0x2e')](_0x18da54[_0xa864('0x27')],qs['fields'](_0x4235e8[_0xa864('0x2b')][_0xa864('0x2f')]));_0x4e519b['attributes']=_0x4e519b['attributes'][_0xa864('0x30')]?_0x4e519b[_0xa864('0x2d')]:_0x18da54['model'];if(_0x4235e8[_0xa864('0x2b')][_0xa864('0x31')]){_0x4e519b['include']=[{'all':!![]}];}_0x4e519b=_['merge']({},_0x4e519b,_0x4235e8[_0xa864('0x32')]);return db[_0xa864('0x28')][_0xa864('0x33')](_0x4e519b)[_0xa864('0x22')](handleEntityNotFound(_0x1b3e9f,null))[_0xa864('0x22')](respondWithResult(_0x1b3e9f,null))['catch'](handleError(_0x1b3e9f,null));};exports[_0xa864('0x34')]=function(_0x23b518,_0x59b186){return db['ChatProactiveAction']['create'](_0x23b518[_0xa864('0x35')],{})[_0xa864('0x22')](respondWithResult(_0x59b186,0xc9))[_0xa864('0x36')](handleError(_0x59b186,null));};exports['update']=function(_0x319842,_0x2bfcdc){if(_0x319842['body']['id']){delete _0x319842['body']['id'];}return db[_0xa864('0x28')][_0xa864('0x33')]({'where':{'id':_0x319842[_0xa864('0x37')]['id']}})[_0xa864('0x22')](handleEntityNotFound(_0x2bfcdc,null))[_0xa864('0x22')](saveUpdates(_0x319842[_0xa864('0x35')],null))[_0xa864('0x22')](respondWithResult(_0x2bfcdc,null))[_0xa864('0x36')](handleError(_0x2bfcdc,null));};exports[_0xa864('0x23')]=function(_0x136185,_0x9cba3b){return db[_0xa864('0x28')][_0xa864('0x33')]({'where':{'id':_0x136185[_0xa864('0x37')]['id']}})[_0xa864('0x22')](handleEntityNotFound(_0x9cba3b,null))['then'](removeEntity(_0x9cba3b,null))['catch'](handleError(_0x9cba3b,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6f07fd7..c368f1f 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 _0x2240=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util'];(function(_0x5e8160,_0x4ce8dd){var _0x27bd5e=function(_0x20429f){while(--_0x20429f){_0x5e8160['push'](_0x5e8160['shift']());}};_0x27bd5e(++_0x4ce8dd);}(_0x2240,0xa7));var _0x0224=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2240[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0224('0x0'));var util=require(_0x0224('0x1'));var logger=require(_0x0224('0x2'))(_0x0224('0x3'));var moment=require(_0x0224('0x4'));var BPromise=require(_0x0224('0x5'));var rp=require(_0x0224('0x6'));var fs=require('fs');var path=require(_0x0224('0x7'));var rimraf=require(_0x0224('0x8'));var config=require('../../config/environment');var attributes=require(_0x0224('0x9'));module[_0x0224('0xa')]=function(_0x339055,_0x2f13ed){return _0x339055[_0x0224('0xb')](_0x0224('0xc'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf85=['./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x38612f,_0x5c7a75){var _0x28bfff=function(_0x37318c){while(--_0x37318c){_0x38612f['push'](_0x38612f['shift']());}};_0x28bfff(++_0x5c7a75);}(_0xdf85,0x1c6));var _0x5df8=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xdf85[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x5df8('0x0'));var util=require('util');var logger=require(_0x5df8('0x1'))(_0x5df8('0x2'));var moment=require(_0x5df8('0x3'));var BPromise=require(_0x5df8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5df8('0x5'));var config=require('../../config/environment');var attributes=require(_0x5df8('0x6'));module[_0x5df8('0x7')]=function(_0x58b590,_0x5c9508){return _0x58b590[_0x5df8('0x8')]('ChatProactiveAction',attributes,{'tableName':_0x5df8('0x9'),'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 94bddfc..4e19ce4 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 _0x9e49=['code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x5ac417,_0x18ec00){var _0x26d2da=function(_0x430ff4){while(--_0x430ff4){_0x5ac417['push'](_0x5ac417['shift']());}};_0x26d2da(++_0x18ec00);}(_0x9e49,0x17f));var _0x99e4=function(_0x833d9b,_0x19a5d6){_0x833d9b=_0x833d9b-0x0;var _0x2cc2a4=_0x9e49[_0x833d9b];return _0x2cc2a4;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x99e4('0x0'));var rs=require(_0x99e4('0x1'));var fs=require('fs');var Redis=require(_0x99e4('0x2'));var db=require(_0x99e4('0x3'))['db'];var utils=require(_0x99e4('0x4'));var logger=require(_0x99e4('0x5'))(_0x99e4('0x6'));var config=require('../../config/environment');var jayson=require(_0x99e4('0x7'));var client=jayson[_0x99e4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5216a8,_0x19f12d,_0x3b3872){return new BPromise(function(_0x3a5043,_0x361875){return client[_0x99e4('0x9')](_0x5216a8,_0x3b3872)[_0x99e4('0xa')](function(_0x238fbd){logger[_0x99e4('0xb')](_0x99e4('0xc'),_0x19f12d,_0x99e4('0xd'));logger[_0x99e4('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x19f12d,_0x99e4('0xd'),JSON['stringify'](_0x238fbd));if(_0x238fbd['error']){if(_0x238fbd[_0x99e4('0xf')][_0x99e4('0x10')]===0x1f4){logger[_0x99e4('0xf')](_0x99e4('0xc'),_0x19f12d,_0x238fbd['error'][_0x99e4('0x11')]);return _0x361875(_0x238fbd[_0x99e4('0xf')][_0x99e4('0x11')]);}logger[_0x99e4('0xf')](_0x99e4('0xc'),_0x19f12d,_0x238fbd[_0x99e4('0xf')]['message']);return _0x3a5043(_0x238fbd[_0x99e4('0xf')]['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x19f12d,_0x99e4('0xd'));_0x3a5043(_0x238fbd['result'][_0x99e4('0x11')]);}})[_0x99e4('0x12')](function(_0x116426){logger['error'](_0x99e4('0xc'),_0x19f12d,_0x116426);_0x361875(_0x116426);});});} \ No newline at end of file +var _0x0a9e=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x5742b1,_0x347a7d){var _0x1672a4=function(_0x32d22d){while(--_0x32d22d){_0x5742b1['push'](_0x5742b1['shift']());}};_0x1672a4(++_0x347a7d);}(_0x0a9e,0x180));var _0xe0a9=function(_0x4c1a13,_0x3a12b1){_0x4c1a13=_0x4c1a13-0x0;var _0x784143=_0x0a9e[_0x4c1a13];return _0x784143;};'use strict';var _=require(_0xe0a9('0x0'));var util=require(_0xe0a9('0x1'));var moment=require(_0xe0a9('0x2'));var BPromise=require(_0xe0a9('0x3'));var rs=require(_0xe0a9('0x4'));var fs=require('fs');var Redis=require(_0xe0a9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0a9('0x6'));var logger=require(_0xe0a9('0x7'))(_0xe0a9('0x8'));var config=require('../../config/environment');var jayson=require(_0xe0a9('0x9'));var client=jayson[_0xe0a9('0xa')][_0xe0a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa0de0,_0x2f2b9f,_0x532e89){return new BPromise(function(_0x326bde,_0x1261f2){return client[_0xe0a9('0xc')](_0xa0de0,_0x532e89)[_0xe0a9('0xd')](function(_0x2c1b37){logger[_0xe0a9('0xe')](_0xe0a9('0xf'),_0x2f2b9f,'request\x20sent');logger[_0xe0a9('0x10')](_0xe0a9('0x11'),_0x2f2b9f,_0xe0a9('0x12'),JSON[_0xe0a9('0x13')](_0x2c1b37));if(_0x2c1b37[_0xe0a9('0x14')]){if(_0x2c1b37[_0xe0a9('0x14')]['code']===0x1f4){logger[_0xe0a9('0x14')](_0xe0a9('0xf'),_0x2f2b9f,_0x2c1b37[_0xe0a9('0x14')]['message']);return _0x1261f2(_0x2c1b37[_0xe0a9('0x14')][_0xe0a9('0x15')]);}logger[_0xe0a9('0x14')](_0xe0a9('0xf'),_0x2f2b9f,_0x2c1b37[_0xe0a9('0x14')][_0xe0a9('0x15')]);return _0x326bde(_0x2c1b37[_0xe0a9('0x14')]['message']);}else{logger[_0xe0a9('0xe')](_0xe0a9('0xf'),_0x2f2b9f,_0xe0a9('0x12'));_0x326bde(_0x2c1b37[_0xe0a9('0x16')][_0xe0a9('0x15')]);}})[_0xe0a9('0x17')](function(_0x116619){logger[_0xe0a9('0x14')](_0xe0a9('0xf'),_0x2f2b9f,_0x116619);_0x1261f2(_0x116619);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index dbdc0e5..15f72a8 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 _0x33c5=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','util','path','express','Router'];(function(_0x196e05,_0x5cf779){var _0x21396a=function(_0x106333){while(--_0x106333){_0x196e05['push'](_0x196e05['shift']());}};_0x21396a(++_0x5cf779);}(_0x33c5,0xe6));var _0x533c=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0x33c5[_0x1a8bbc];return _0x212fc2;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var fs_extra=require(_0x533c('0x4'));var auth=require(_0x533c('0x5'));var interaction=require(_0x533c('0x6'));var config=require('../../config/environment');var controller=require(_0x533c('0x7'));router[_0x533c('0x8')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0xb')]);router[_0x533c('0xc')]('/',auth[_0x533c('0xa')](),controller[_0x533c('0xd')]);router[_0x533c('0xe')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0xf')]);router[_0x533c('0x10')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2eb2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','show','post','create','put','update','delete','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2eb2,0x19f));var _0x22eb=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x2eb2[_0x3de8a4];return _0x4635cf;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x22eb('0x7')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xa')]);router[_0x22eb('0xb')]('/',auth[_0x22eb('0x9')](),controller[_0x22eb('0xc')]);router[_0x22eb('0xd')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xe')]);router[_0x22eb('0xf')]('/:id',auth[_0x22eb('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 2e7fbfc..e34ca6f 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 _0xadb6=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x1d3af2,_0x3e1edf){var _0x533053=function(_0x16e9d6){while(--_0x16e9d6){_0x1d3af2['push'](_0x1d3af2['shift']());}};_0x533053(++_0x3e1edf);}(_0xadb6,0x1ee));var _0x6adb=function(_0x41c768,_0x213f31){_0x41c768=_0x41c768-0x0;var _0x93edd=_0xadb6[_0x41c768];return _0x93edd;};'use strict';var Sequelize=require(_0x6adb('0x0'));module['exports']={'name':{'type':Sequelize[_0x6adb('0x1')],'unique':_0x6adb('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6adb('0x1')]},'timeout':{'type':Sequelize[_0x6adb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6adb('0x4')](_0x6adb('0x5'),_0x6adb('0x6'),_0x6adb('0x7'))}}; \ No newline at end of file +var _0xe55b=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x504a3d,_0x419142){var _0x503027=function(_0x14225b){while(--_0x14225b){_0x504a3d['push'](_0x504a3d['shift']());}};_0x503027(++_0x419142);}(_0xe55b,0x183));var _0xbe55=function(_0x3d2438,_0x2e7922){_0x3d2438=_0x3d2438-0x0;var _0xd18de5=_0xe55b[_0x3d2438];return _0xd18de5;};'use strict';var Sequelize=require(_0xbe55('0x0'));module[_0xbe55('0x1')]={'name':{'type':Sequelize[_0xbe55('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xbe55('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbe55('0x4')](_0xbe55('0x5'),_0xbe55('0x6'),_0xbe55('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index c934138..bd96e1e 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 _0x66ee=['getTeams','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_chat_queues','join','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','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','message','result','catch','status','offset','undefined','limit','count','set','json','apply','reject','save','update','get','ChatQueues','UserProfileResource','destroy','end','sendStatus','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','body','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP'];(function(_0x2f9da1,_0x5edd19){var _0x2955db=function(_0x50b349){while(--_0x50b349){_0x2f9da1['push'](_0x2f9da1['shift']());}};_0x2955db(++_0x5edd19);}(_0x66ee,0xc2));var _0xe66e=function(_0x35116d,_0x30c8c7){_0x35116d=_0x35116d-0x0;var _0x16b2ab=_0x66ee[_0x35116d];return _0x16b2ab;};'use strict';var emlformat=require(_0xe66e('0x0'));var rimraf=require(_0xe66e('0x1'));var zipdir=require(_0xe66e('0x2'));var jsonpatch=require(_0xe66e('0x3'));var rp=require(_0xe66e('0x4'));var moment=require(_0xe66e('0x5'));var BPromise=require(_0xe66e('0x6'));var Mustache=require(_0xe66e('0x7'));var util=require(_0xe66e('0x8'));var path=require('path');var sox=require(_0xe66e('0x9'));var csv=require(_0xe66e('0xa'));var ejs=require(_0xe66e('0xb'));var fs=require('fs');var fs_extra=require(_0xe66e('0xc'));var _=require(_0xe66e('0xd'));var squel=require(_0xe66e('0xe'));var crypto=require(_0xe66e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe66e('0x10'));var toCsv=require(_0xe66e('0xa'));var querystring=require('querystring');var Papa=require(_0xe66e('0x11'));var Redis=require(_0xe66e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe66e('0x13'));var as=require(_0xe66e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe66e('0x15'))(_0xe66e('0x16'));var utils=require('../../config/utils');var config=require(_0xe66e('0x17'));var licenseUtil=require(_0xe66e('0x18'));var db=require(_0xe66e('0x19'))['db'];config[_0xe66e('0x1a')]=_[_0xe66e('0x1b')](config[_0xe66e('0x1a')],{'host':_0xe66e('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe66e('0x1d'))[_0xe66e('0x1e')](socket);var jayson=require(_0xe66e('0x1f'));var client=jayson[_0xe66e('0x20')][_0xe66e('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4bc0e7,_0x44b6c7,_0x137628,_0x4673ce){return new BPromise(function(_0x31aa0a,_0x43905d){var _0x2cad5b=_0x4673ce||client;return _0x2cad5b[_0xe66e('0x22')](_0x4bc0e7,_0x137628)[_0xe66e('0x23')](function(_0x3b28ff){logger[_0xe66e('0x24')](_0xe66e('0x25'),_0x44b6c7,_0xe66e('0x26'));logger[_0xe66e('0x27')](_0xe66e('0x28'),_0x44b6c7,_0xe66e('0x26'),JSON[_0xe66e('0x29')](_0x3b28ff));if(_0x3b28ff[_0xe66e('0x2a')]){if(_0x3b28ff[_0xe66e('0x2a')]['code']===0x1f4){logger[_0xe66e('0x2a')](_0xe66e('0x25'),_0x44b6c7,_0x3b28ff[_0xe66e('0x2a')][_0xe66e('0x2b')]);return _0x43905d(_0x3b28ff['error'][_0xe66e('0x2b')]);}logger[_0xe66e('0x2a')](_0xe66e('0x25'),_0x44b6c7,_0x3b28ff['error'][_0xe66e('0x2b')]);return _0x31aa0a(_0x3b28ff[_0xe66e('0x2a')]['message']);}else{logger[_0xe66e('0x24')](_0xe66e('0x25'),_0x44b6c7,_0xe66e('0x26'));_0x31aa0a(_0x3b28ff[_0xe66e('0x2c')][_0xe66e('0x2b')]);}})[_0xe66e('0x2d')](function(_0x2fb8d5){logger[_0xe66e('0x2a')](_0xe66e('0x25'),_0x44b6c7,_0x2fb8d5);_0x43905d(_0x2fb8d5);});});}function respondWithStatusCode(_0xcf6a82,_0x4db0d4){_0x4db0d4=_0x4db0d4||0xcc;return function(_0x287050){if(_0x287050){return _0xcf6a82['sendStatus'](_0x4db0d4);}return _0xcf6a82['status'](_0x4db0d4)['end']();};}function respondWithResult(_0x11718e,_0x1221af){_0x1221af=_0x1221af||0xc8;return function(_0x3ccf77){if(_0x3ccf77){return _0x11718e[_0xe66e('0x2e')](_0x1221af)['json'](_0x3ccf77);}};}function respondWithFilteredResult(_0xafd651,_0x25eaa7){return function(_0x12a61f){if(_0x12a61f){var _0x3b9905=typeof _0x25eaa7[_0xe66e('0x2f')]===_0xe66e('0x30')&&typeof _0x25eaa7[_0xe66e('0x31')]===_0xe66e('0x30');var _0x515e72=_0x12a61f['count'];var _0x2efcce=_0x3b9905?0x0:_0x25eaa7['offset'];var _0x5d954d=_0x3b9905?_0x12a61f[_0xe66e('0x32')]:_0x25eaa7[_0xe66e('0x2f')]+_0x25eaa7[_0xe66e('0x31')];var _0x5246d5;if(_0x5d954d>=_0x515e72){_0x5d954d=_0x515e72;_0x5246d5=0xc8;}else{_0x5246d5=0xce;}_0xafd651[_0xe66e('0x2e')](_0x5246d5);return _0xafd651[_0xe66e('0x33')]('Content-Range',_0x2efcce+'-'+_0x5d954d+'/'+_0x515e72)[_0xe66e('0x34')](_0x12a61f);}return null;};}function patchUpdates(_0x40622b){return function(_0x2076d6){try{jsonpatch[_0xe66e('0x35')](_0x2076d6,_0x40622b,!![]);}catch(_0x47016c){return BPromise[_0xe66e('0x36')](_0x47016c);}return _0x2076d6[_0xe66e('0x37')]();};}function saveUpdates(_0xfdc22,_0x1f532e){return function(_0x4d65b8){if(_0x4d65b8){return _0x4d65b8[_0xe66e('0x38')](_0xfdc22)['then'](function(_0x3f81e1){return _0x3f81e1;});}return null;};}function removeEntity(_0x3acb7d,_0x173b84){return function(_0x3e0e14){if(_0x3e0e14){return _0x3e0e14['destroy']()['then'](function(){var _0x19265c=_0x3e0e14[_0xe66e('0x39')]({'plain':!![]});var _0x508199=_0xe66e('0x3a');return db[_0xe66e('0x3b')][_0xe66e('0x3c')]({'where':{'type':_0x508199,'resourceId':_0x19265c['id']}})[_0xe66e('0x23')](function(){return _0x3e0e14;});})[_0xe66e('0x23')](function(){_0x3acb7d[_0xe66e('0x2e')](0xcc)[_0xe66e('0x3d')]();});}};}function handleEntityNotFound(_0x3920a3,_0x429a94){return function(_0x400e33){if(!_0x400e33){_0x3920a3[_0xe66e('0x3e')](0x194);}return _0x400e33;};}function handleError(_0x819f14,_0xd33254){_0xd33254=_0xd33254||0x1f4;return function(_0x25eb2b){logger['error'](_0x25eb2b['stack']);if(_0x25eb2b[_0xe66e('0x3f')]){delete _0x25eb2b['name'];}_0x819f14['status'](_0xd33254)[_0xe66e('0x40')](_0x25eb2b);};}exports[_0xe66e('0x41')]=function(_0x25d993,_0x2df3a1){var _0x53529d={},_0x49432a={},_0x29263c={'count':0x0,'rows':[]};var _0xae65ff=_[_0xe66e('0x42')](db[_0xe66e('0x43')][_0xe66e('0x44')],function(_0x446df4){return{'name':_0x446df4[_0xe66e('0x45')],'type':_0x446df4[_0xe66e('0x46')][_0xe66e('0x47')]};});_0x49432a[_0xe66e('0x48')]=_[_0xe66e('0x42')](_0xae65ff,'name');_0x49432a[_0xe66e('0x49')]=_[_0xe66e('0x4a')](_0x25d993[_0xe66e('0x49')]);_0x49432a[_0xe66e('0x4b')]=_[_0xe66e('0x4c')](_0x49432a[_0xe66e('0x48')],_0x49432a[_0xe66e('0x49')]);_0x53529d[_0xe66e('0x4d')]=_[_0xe66e('0x4c')](_0x49432a[_0xe66e('0x48')],qs[_0xe66e('0x4e')](_0x25d993[_0xe66e('0x49')][_0xe66e('0x4e')]));_0x53529d[_0xe66e('0x4d')]=_0x53529d['attributes'][_0xe66e('0x4f')]?_0x53529d[_0xe66e('0x4d')]:_0x49432a[_0xe66e('0x48')];if(!_0x25d993[_0xe66e('0x49')][_0xe66e('0x50')](_0xe66e('0x51'))){_0x53529d[_0xe66e('0x31')]=qs[_0xe66e('0x31')](_0x25d993[_0xe66e('0x49')]['limit']);_0x53529d[_0xe66e('0x2f')]=qs['offset'](_0x25d993['query'][_0xe66e('0x2f')]);}_0x53529d['order']=qs[_0xe66e('0x52')](_0x25d993[_0xe66e('0x49')][_0xe66e('0x52')]);_0x53529d[_0xe66e('0x53')]=qs[_0xe66e('0x4b')](_[_0xe66e('0x54')](_0x25d993[_0xe66e('0x49')],_0x49432a[_0xe66e('0x4b')]),_0xae65ff);if(_0x25d993[_0xe66e('0x49')][_0xe66e('0x55')]){_0x53529d[_0xe66e('0x53')]=_[_0xe66e('0x56')](_0x53529d[_0xe66e('0x53')],{'$or':_[_0xe66e('0x42')](_0xae65ff,function(_0x3b6488){if(_0x3b6488[_0xe66e('0x46')]!==_0xe66e('0x57')){var _0x4a36eb={};_0x4a36eb[_0x3b6488[_0xe66e('0x3f')]]={'$like':'%'+_0x25d993[_0xe66e('0x49')][_0xe66e('0x55')]+'%'};return _0x4a36eb;}})});}_0x53529d=_[_0xe66e('0x56')]({},_0x53529d,_0x25d993['options']);var _0x3e5b45={'where':_0x53529d[_0xe66e('0x53')]};return db[_0xe66e('0x43')][_0xe66e('0x32')](_0x3e5b45)['then'](function(_0x35ca11){_0x29263c[_0xe66e('0x32')]=_0x35ca11;if(_0x25d993[_0xe66e('0x49')][_0xe66e('0x58')]){_0x53529d['include']=[{'all':!![]}];}return db[_0xe66e('0x43')]['findAll'](_0x53529d);})[_0xe66e('0x23')](function(_0x7bfdcd){_0x29263c[_0xe66e('0x59')]=_0x7bfdcd;return _0x29263c;})[_0xe66e('0x23')](respondWithFilteredResult(_0x2df3a1,_0x53529d))[_0xe66e('0x2d')](handleError(_0x2df3a1,null));};exports[_0xe66e('0x5a')]=function(_0xd87b8c,_0x200fba){var _0x2d2b75={'raw':!![],'where':{'id':_0xd87b8c[_0xe66e('0x5b')]['id']}},_0x58705c={};_0x58705c['model']=_['keys'](db[_0xe66e('0x43')][_0xe66e('0x44')]);_0x58705c[_0xe66e('0x49')]=_[_0xe66e('0x4a')](_0xd87b8c['query']);_0x58705c['filters']=_['intersection'](_0x58705c['model'],_0x58705c[_0xe66e('0x49')]);_0x2d2b75[_0xe66e('0x4d')]=_[_0xe66e('0x4c')](_0x58705c[_0xe66e('0x48')],qs[_0xe66e('0x4e')](_0xd87b8c['query'][_0xe66e('0x4e')]));_0x2d2b75[_0xe66e('0x4d')]=_0x2d2b75[_0xe66e('0x4d')]['length']?_0x2d2b75[_0xe66e('0x4d')]:_0x58705c[_0xe66e('0x48')];if(_0xd87b8c[_0xe66e('0x49')][_0xe66e('0x58')]){_0x2d2b75[_0xe66e('0x5c')]=[{'all':!![]}];}_0x2d2b75=_['merge']({},_0x2d2b75,_0xd87b8c[_0xe66e('0x5d')]);return db[_0xe66e('0x43')][_0xe66e('0x5e')](_0x2d2b75)[_0xe66e('0x23')](handleEntityNotFound(_0x200fba,null))[_0xe66e('0x23')](respondWithResult(_0x200fba,null))[_0xe66e('0x2d')](handleError(_0x200fba,null));};exports[_0xe66e('0x5f')]=function(_0x2f8bf4,_0x31b7fd){return db[_0xe66e('0x43')][_0xe66e('0x5f')](_0x2f8bf4['body'],{})[_0xe66e('0x23')](function(_0x570da7){var _0x1e665a=_0x2f8bf4[_0xe66e('0x60')][_0xe66e('0x39')]({'plain':!![]});if(!_0x1e665a)throw new Error(_0xe66e('0x61'));if(_0x1e665a['role']===_0xe66e('0x60')){var _0x125ad5=_0x570da7[_0xe66e('0x39')]({'plain':!![]});var _0x423f96=_0xe66e('0x3a');return db[_0xe66e('0x62')]['find']({'where':{'name':_0x423f96,'userProfileId':_0x1e665a['userProfileId']},'raw':!![]})[_0xe66e('0x23')](function(_0x561540){if(_0x561540&&_0x561540[_0xe66e('0x63')]===0x0){return db[_0xe66e('0x3b')][_0xe66e('0x5f')]({'name':_0x125ad5[_0xe66e('0x3f')],'resourceId':_0x125ad5['id'],'type':_0x561540[_0xe66e('0x3f')],'sectionId':_0x561540['id']},{})[_0xe66e('0x23')](function(){return _0x570da7;});}else{return _0x570da7;}})[_0xe66e('0x2d')](function(_0x3ef12f){logger[_0xe66e('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ef12f);throw _0x3ef12f;});}return _0x570da7;})[_0xe66e('0x23')](respondWithResult(_0x31b7fd,0xc9))[_0xe66e('0x2d')](handleError(_0x31b7fd,null));};exports[_0xe66e('0x38')]=function(_0xecb837,_0x22d956){if(_0xecb837['body']['id']){delete _0xecb837[_0xe66e('0x64')]['id'];}return db[_0xe66e('0x43')][_0xe66e('0x5e')]({'where':{'id':_0xecb837[_0xe66e('0x5b')]['id']}})[_0xe66e('0x23')](handleEntityNotFound(_0x22d956,null))['then'](saveUpdates(_0xecb837[_0xe66e('0x64')],null))['then'](respondWithResult(_0x22d956,null))[_0xe66e('0x2d')](handleError(_0x22d956,null));};exports[_0xe66e('0x3c')]=function(_0x2ebe42,_0x52f319){return db[_0xe66e('0x43')]['find']({'where':{'id':_0x2ebe42[_0xe66e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x52f319,null))[_0xe66e('0x23')](removeEntity(_0x52f319,null))[_0xe66e('0x2d')](handleError(_0x52f319,null));};exports[_0xe66e('0x65')]=function(_0x152ae5,_0x11ec7b){return db[_0xe66e('0x43')]['describe']()[_0xe66e('0x23')](respondWithResult(_0x11ec7b,null))[_0xe66e('0x2d')](handleError(_0x11ec7b,null));};exports[_0xe66e('0x66')]=function(_0x2f7770,_0x5b2864,_0x3980b1){var _0x50f053={'raw':!![],'where':{}},_0x3c0423={},_0x31ef96;return db[_0xe66e('0x43')][_0xe66e('0x67')]({'where':{'id':_0x2f7770['params']['id']}})['then'](handleEntityNotFound(_0x5b2864,null))[_0xe66e('0x23')](function(_0x5cf711){if(_0x5cf711){_0x31ef96=_0x5cf711['get']({'plain':!![]});_0x3c0423['model']=_['keys'](db[_0xe66e('0x68')]['rawAttributes']);_0x3c0423[_0xe66e('0x49')]=_[_0xe66e('0x4a')](_0x2f7770[_0xe66e('0x49')]);_0x3c0423['filters']=_['intersection'](_0x3c0423[_0xe66e('0x48')],_0x3c0423['query']);_0x50f053[_0xe66e('0x4d')]=_[_0xe66e('0x4c')](_0x3c0423[_0xe66e('0x48')],qs[_0xe66e('0x4e')](_0x2f7770[_0xe66e('0x49')]['fields']));_0x50f053[_0xe66e('0x4d')]=_0x50f053[_0xe66e('0x4d')][_0xe66e('0x4f')]?_0x50f053[_0xe66e('0x4d')]:_0x3c0423['model'];if(!_0x2f7770[_0xe66e('0x49')][_0xe66e('0x50')](_0xe66e('0x51'))){_0x50f053[_0xe66e('0x31')]=qs['limit'](_0x2f7770['query'][_0xe66e('0x31')]);_0x50f053[_0xe66e('0x2f')]=qs[_0xe66e('0x2f')](_0x2f7770[_0xe66e('0x49')]['offset']);}_0x50f053['order']=qs[_0xe66e('0x52')](_0x2f7770['query']['sort']);_0x50f053[_0xe66e('0x53')]=qs[_0xe66e('0x4b')](_[_0xe66e('0x54')](_0x2f7770[_0xe66e('0x49')],_0x3c0423[_0xe66e('0x4b')]));_0x50f053['where'][_0xe66e('0x69')]=_0x5cf711['id'];if(_0x2f7770[_0xe66e('0x49')][_0xe66e('0x55')]){_0x50f053[_0xe66e('0x53')]=_[_0xe66e('0x56')](_0x50f053['where'],{'$or':_['map'](_0x50f053[_0xe66e('0x4d')],function(_0x5ea8db){var _0x59aec9={};_0x59aec9[_0x5ea8db]={'$like':'%'+_0x2f7770[_0xe66e('0x49')][_0xe66e('0x55')]+'%'};return _0x59aec9;})});}_0x50f053=_['merge']({},_0x50f053,_0x2f7770['options']);return db['UserChatQueue'][_0xe66e('0x6a')](_0x50f053);}})[_0xe66e('0x23')](function(_0x56fd8f){if(_0x56fd8f){return db[_0xe66e('0x6b')][_0xe66e('0x6c')]({'where':{'id':_[_0xe66e('0x42')](_0x56fd8f,_0xe66e('0x6d')),'role':_0xe66e('0x6e')},'attributes':['id','name',_0xe66e('0x6f'),_0xe66e('0x70'),_0xe66e('0x71')]});}})[_0xe66e('0x23')](function(_0x440f26){if(_0x440f26){return{'count':_0x440f26[_0xe66e('0x32')],'rows':_[_0xe66e('0x42')](_0x440f26[_0xe66e('0x59')],function(_0x2f05df){return{'membername':_0x2f05df['name'],'UserId':_0x2f05df['id'],'queue_name':_0x31ef96[_0xe66e('0x3f')],'ChatQueueId':_0x31ef96['id'],'interface':util['format'](_0xe66e('0x72'),_0xe66e('0x73'),_0x2f05df[_0xe66e('0x3f')]),'penalty':0x0,'paused':_0x2f05df[_0xe66e('0x6f')],'createdAt':_0x2f05df[_0xe66e('0x71')],'updatedAt':_0x2f05df['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe66e('0x23')](respondWithFilteredResult(_0x5b2864,_0x50f053))[_0xe66e('0x2d')](handleError(_0x5b2864,null));};exports[_0xe66e('0x74')]=function(_0x4d3934,_0x4c0f7,_0x1a8e4c){var _0x499475={};var _0x9f7a39={};var _0x4e95e4;var _0x5e4052;return db[_0xe66e('0x43')][_0xe66e('0x67')]({'where':{'id':_0x4d3934[_0xe66e('0x5b')]['id']}})[_0xe66e('0x23')](handleEntityNotFound(_0x4c0f7,null))[_0xe66e('0x23')](function(_0x365376){if(_0x365376){_0x4e95e4=_0x365376;_0x9f7a39[_0xe66e('0x48')]=_['keys'](db['Team']['rawAttributes']);_0x9f7a39[_0xe66e('0x49')]=_[_0xe66e('0x4a')](_0x4d3934[_0xe66e('0x49')]);_0x9f7a39['filters']=_[_0xe66e('0x4c')](_0x9f7a39['model'],_0x9f7a39['query']);_0x499475[_0xe66e('0x4d')]=_[_0xe66e('0x4c')](_0x9f7a39[_0xe66e('0x48')],qs['fields'](_0x4d3934[_0xe66e('0x49')]['fields']));_0x499475[_0xe66e('0x4d')]=_0x499475[_0xe66e('0x4d')][_0xe66e('0x4f')]?_0x499475[_0xe66e('0x4d')]:_0x9f7a39[_0xe66e('0x48')];_0x499475['order']=qs[_0xe66e('0x52')](_0x4d3934[_0xe66e('0x49')][_0xe66e('0x52')]);_0x499475[_0xe66e('0x53')]=qs[_0xe66e('0x4b')](_[_0xe66e('0x54')](_0x4d3934[_0xe66e('0x49')],_0x9f7a39[_0xe66e('0x4b')]));if(_0x4d3934[_0xe66e('0x49')][_0xe66e('0x55')]){_0x499475[_0xe66e('0x53')]=_[_0xe66e('0x56')](_0x499475[_0xe66e('0x53')],{'$or':_[_0xe66e('0x42')](_0x499475['attributes'],function(_0x50deab){var _0x35cc26={};_0x35cc26[_0x50deab]={'$like':'%'+_0x4d3934[_0xe66e('0x49')]['filter']+'%'};return _0x35cc26;})});}_0x499475=_[_0xe66e('0x56')]({},_0x499475,_0x4d3934[_0xe66e('0x5d')]);return _0x4e95e4['getTeams'](_0x499475);}})[_0xe66e('0x23')](function(_0x2df2bc){if(_0x2df2bc){_0x5e4052=_0x2df2bc[_0xe66e('0x4f')];if(!_0x4d3934['query'][_0xe66e('0x50')](_0xe66e('0x51'))){_0x499475[_0xe66e('0x31')]=qs[_0xe66e('0x31')](_0x4d3934[_0xe66e('0x49')]['limit']);_0x499475[_0xe66e('0x2f')]=qs[_0xe66e('0x2f')](_0x4d3934['query']['offset']);}return _0x4e95e4[_0xe66e('0x74')](_0x499475);}})['then'](function(_0x52a051){if(_0x52a051){return _0x52a051?{'count':_0x5e4052,'rows':_0x52a051}:null;}})[_0xe66e('0x23')](respondWithResult(_0x4c0f7,null))[_0xe66e('0x2d')](handleError(_0x4c0f7,null));};exports['addTeams']=function(_0x5e43c8,_0x22c01e,_0x45e12d){var _0x426db9=_0x5e43c8[_0xe66e('0x64')]['ids'];return db[_0xe66e('0x75')][_0xe66e('0x6a')]({'where':{'id':_0x426db9},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe66e('0x76'),'attributes':['id',_0xe66e('0x3f'),'online',_0xe66e('0x77'),_0xe66e('0x78')],'raw':!![]}]})['then'](function(_0x233dd3){if(_0x233dd3){var _0x252703=_[_0xe66e('0x79')](_0x233dd3,function(_0xbf5f55){var _0x41f29a=_0xbf5f55[_0xe66e('0x39')]({'plain':!![]});return _0x41f29a['Agents'];});return db[_0xe66e('0x43')][_0xe66e('0x5e')]({'where':{'id':_0x5e43c8[_0xe66e('0x5b')]['id']}})[_0xe66e('0x23')](function(_0x49a055){return db[_0xe66e('0x7a')][_0xe66e('0x7b')](function(_0x2b67db){return _0x49a055[_0xe66e('0x7c')](_0x426db9,{'transaction':_0x2b67db})[_0xe66e('0x23')](function(){return BPromise[_0xe66e('0x7d')](_0x252703,function(_0x408507){return db['UserChatQueue'][_0xe66e('0x7e')]({'where':{'UserId':_0x408507['id'],'ChatQueueId':_0x5e43c8[_0xe66e('0x5b')]['id']},'transaction':_0x2b67db});});})[_0xe66e('0x23')](function(){_0x252703[_0xe66e('0x7f')](function(_0x59ad21){socket[_0xe66e('0x80')](_0xe66e('0x81'),{'UserId':_0x59ad21['id'],'ChatQueueId':_0x49a055['id']});});});});});}})[_0xe66e('0x23')](respondWithStatusCode(_0x22c01e,null))['catch'](handleError(_0x22c01e,null));};exports[_0xe66e('0x82')]=function(_0x507d38,_0x20ba61,_0x533f74){return db[_0xe66e('0x75')][_0xe66e('0x6a')]({'where':{'id':_0x507d38[_0xe66e('0x49')][_0xe66e('0x83')]},'attributes':['id'],'include':[{'model':db[_0xe66e('0x6b')],'as':_0xe66e('0x76'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x20ba61,null))['then'](function(_0x3889ae){var _0x5f212d=_[_0xe66e('0x42')](_0x3889ae,'id');var _0x401db4=[];var _0x3218b5=[];var _0x51ba42=squel['select']();_0x51ba42[_0xe66e('0x84')](_0xe66e('0x85'))[_0xe66e('0x86')](_0xe66e('0x87'),'tq')[_0xe66e('0x88')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe66e('0x53')]('ChatQueueId\x20=\x20?',_0x507d38[_0xe66e('0x5b')]['id']);for(var _0x554772=0x0;_0x554772<_0x3889ae['length'];_0x554772+=0x1){let _0x2576c7=_0x3889ae[_0x554772];for(var _0x40779f=0x0;_0x40779f<_0x2576c7[_0xe66e('0x76')][_0xe66e('0x4f')];_0x40779f+=0x1){let _0x54f80c=_0x2576c7['Agents'][_0x40779f];var _0x1e9ffd=_0x51ba42['clone']();_0x1e9ffd['where'](_0xe66e('0x89'),_0x54f80c['id']);_0x3218b5['push'](db[_0xe66e('0x7a')][_0xe66e('0x49')](_0x1e9ffd['toString'](),{'type':db[_0xe66e('0x7a')][_0xe66e('0x8a')][_0xe66e('0x8b')]})[_0xe66e('0x23')](function(_0x24396e){if(_0x24396e[_0xe66e('0x4f')]===0x1){return _0x54f80c['id'];}else{var _0x56b568=_[_0xe66e('0x8c')](_[_0xe66e('0x42')](_0x24396e,_0xe66e('0x8d')),function(_0x42526a){return _[_0xe66e('0x8e')](_0x5f212d,_0x42526a);});if(_0x56b568){return _0x54f80c['id'];}}}));}}return BPromise[_0xe66e('0x8f')](_0x3218b5)['then'](function(_0x5cc3a6){_0x401db4=_(_0x401db4)['union'](_0x5cc3a6)[_0xe66e('0x90')]()[_0xe66e('0x91')]();return db['ChatQueue'][_0xe66e('0x5e')]({'where':{'id':_0x507d38['params']['id']}})[_0xe66e('0x23')](function(_0x4f7ac0){return db[_0xe66e('0x7a')]['transaction'](function(_0xb4ee5d){return _0x4f7ac0[_0xe66e('0x82')](_0x507d38['query'][_0xe66e('0x83')],{'transaction':_0xb4ee5d})[_0xe66e('0x23')](function(){if(!_[_0xe66e('0x92')](_0x401db4)){return _0x4f7ac0[_0xe66e('0x93')](_0x401db4,{'transaction':_0xb4ee5d});}})[_0xe66e('0x23')](function(){_0x401db4[_0xe66e('0x7f')](function(_0x47df19){socket['emit'](_0xe66e('0x94'),{'UserId':_0x47df19,'ChatQueueId':_0x4f7ac0['id']});});});});});});})[_0xe66e('0x23')](respondWithStatusCode(_0x20ba61,null))[_0xe66e('0x2d')](handleError(_0x20ba61,null));};exports[_0xe66e('0x95')]=function(_0x28bb7f,_0xc8c939,_0x201ba9){return db[_0xe66e('0x43')][_0xe66e('0x5e')]({'where':{'id':_0x28bb7f[_0xe66e('0x5b')]['id']}})[_0xe66e('0x23')](handleEntityNotFound(_0xc8c939,null))[_0xe66e('0x23')](function(_0x29edbc){if(_0x29edbc){return _0x29edbc[_0xe66e('0x95')](_0x28bb7f[_0xe66e('0x64')]['ids'],_[_0xe66e('0x96')](_0x28bb7f[_0xe66e('0x64')],[_0xe66e('0x83'),'id'])||{})[_0xe66e('0x97')](function(_0x24d5ba){for(var _0x2e393b=0x0;_0x2e393b<_0x28bb7f[_0xe66e('0x64')][_0xe66e('0x83')][_0xe66e('0x4f')];_0x2e393b+=0x1){socket[_0xe66e('0x80')]('userChatQueue:save',{'UserId':Number(_0x28bb7f['body'][_0xe66e('0x83')][_0x2e393b]),'ChatQueueId':Number(_0x28bb7f[_0xe66e('0x5b')]['id'])});}return _0x24d5ba;});}})['then'](respondWithResult(_0xc8c939,null))[_0xe66e('0x2d')](handleError(_0xc8c939,null));};exports[_0xe66e('0x93')]=function(_0x4b04ef,_0xe28823,_0x19e7cf){return db[_0xe66e('0x43')][_0xe66e('0x5e')]({'where':{'id':_0x4b04ef[_0xe66e('0x5b')]['id']}})[_0xe66e('0x23')](handleEntityNotFound(_0xe28823,null))[_0xe66e('0x23')](function(_0x156f4a){if(_0x156f4a){return _0x156f4a['removeAgents'](_0x4b04ef[_0xe66e('0x49')][_0xe66e('0x83')])['then'](function(){if(_[_0xe66e('0x98')](_0x4b04ef['query'][_0xe66e('0x83')])){for(var _0x757d9b=0x0;_0x757d9b<_0x4b04ef[_0xe66e('0x49')][_0xe66e('0x83')]['length'];_0x757d9b+=0x1){socket['emit'](_0xe66e('0x94'),{'UserId':Number(_0x4b04ef[_0xe66e('0x49')][_0xe66e('0x83')][_0x757d9b]),'ChatQueueId':Number(_0x4b04ef[_0xe66e('0x5b')]['id'])});}}else{socket[_0xe66e('0x80')](_0xe66e('0x94'),{'UserId':Number(_0x4b04ef['query']['ids']),'ChatQueueId':Number(_0x4b04ef[_0xe66e('0x5b')]['id'])});}});}})[_0xe66e('0x23')](respondWithStatusCode(_0xe28823,null))[_0xe66e('0x2d')](handleError(_0xe28823,null));};exports[_0xe66e('0x99')]=function(_0x4d710a,_0xf4399b,_0x346b29){var _0x53a4e2={};var _0x439650={};var _0x18af32;var _0x554911;return db['ChatQueue'][_0xe66e('0x67')]({'where':{'id':_0x4d710a[_0xe66e('0x5b')]['id']}})[_0xe66e('0x23')](handleEntityNotFound(_0xf4399b,null))[_0xe66e('0x23')](function(_0x27216f){if(_0x27216f){_0x18af32=_0x27216f;_0x439650['model']=_['keys'](db['User']['rawAttributes']);_0x439650[_0xe66e('0x49')]=_[_0xe66e('0x4a')](_0x4d710a[_0xe66e('0x49')]);_0x439650[_0xe66e('0x4b')]=_[_0xe66e('0x4c')](_0x439650['model'],_0x439650[_0xe66e('0x49')]);_0x53a4e2[_0xe66e('0x4d')]=_[_0xe66e('0x4c')](_0x439650[_0xe66e('0x48')],qs[_0xe66e('0x4e')](_0x4d710a[_0xe66e('0x49')]['fields']));_0x53a4e2[_0xe66e('0x4d')]=_0x53a4e2['attributes'][_0xe66e('0x4f')]?_0x53a4e2[_0xe66e('0x4d')]:_0x439650[_0xe66e('0x48')];_0x53a4e2[_0xe66e('0x9a')]=qs[_0xe66e('0x52')](_0x4d710a[_0xe66e('0x49')][_0xe66e('0x52')]);_0x53a4e2[_0xe66e('0x53')]=qs['filters'](_[_0xe66e('0x54')](_0x4d710a[_0xe66e('0x49')],_0x439650[_0xe66e('0x4b')]));if(_0x4d710a[_0xe66e('0x49')]['filter']){_0x53a4e2[_0xe66e('0x53')]=_[_0xe66e('0x56')](_0x53a4e2[_0xe66e('0x53')],{'$or':_[_0xe66e('0x42')](_0x53a4e2[_0xe66e('0x4d')],function(_0x30ae9b){var _0x212902={};_0x212902[_0x30ae9b]={'$like':'%'+_0x4d710a[_0xe66e('0x49')][_0xe66e('0x55')]+'%'};return _0x212902;})});}_0x53a4e2=_[_0xe66e('0x56')]({},_0x53a4e2,_0x4d710a[_0xe66e('0x5d')]);return _0x18af32[_0xe66e('0x99')](_0x53a4e2);}})[_0xe66e('0x23')](function(_0x5d661e){if(_0x5d661e){_0x554911=_0x5d661e[_0xe66e('0x4f')];if(!_0x4d710a[_0xe66e('0x49')][_0xe66e('0x50')](_0xe66e('0x51'))){_0x53a4e2['limit']=qs[_0xe66e('0x31')](_0x4d710a['query'][_0xe66e('0x31')]);_0x53a4e2['offset']=qs[_0xe66e('0x2f')](_0x4d710a[_0xe66e('0x49')][_0xe66e('0x2f')]);}return _0x18af32[_0xe66e('0x99')](_0x53a4e2);}})[_0xe66e('0x23')](function(_0x43d78f){if(_0x43d78f){return _0x43d78f?{'count':_0x554911,'rows':_0x43d78f}:null;}})[_0xe66e('0x23')](respondWithResult(_0xf4399b,null))[_0xe66e('0x2d')](handleError(_0xf4399b,null));}; \ No newline at end of file +var _0x4228=['chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','findAll','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','get','ChatQueues','UserProfileResource','stack','name','send','index','ChatQueue','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','destroy','params','describe','getMembers','UserChatQueue','hasOwnProperty','nolimit','ChatQueueId','User','findAndCountAll'];(function(_0x2f6259,_0x2113f4){var _0x6a75c1=function(_0x582336){while(--_0x582336){_0x2f6259['push'](_0x2f6259['shift']());}};_0x6a75c1(++_0x2113f4);}(_0x4228,0xc8));var _0x8422=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4228[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8422('0x0'));var rimraf=require(_0x8422('0x1'));var zipdir=require(_0x8422('0x2'));var jsonpatch=require(_0x8422('0x3'));var rp=require('request-promise');var moment=require(_0x8422('0x4'));var BPromise=require(_0x8422('0x5'));var Mustache=require(_0x8422('0x6'));var util=require(_0x8422('0x7'));var path=require(_0x8422('0x8'));var sox=require(_0x8422('0x9'));var csv=require(_0x8422('0xa'));var ejs=require(_0x8422('0xb'));var fs=require('fs');var fs_extra=require(_0x8422('0xc'));var _=require(_0x8422('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8422('0xe'));var deskjs=require(_0x8422('0xf'));var toCsv=require(_0x8422('0xa'));var querystring=require(_0x8422('0x10'));var Papa=require(_0x8422('0x11'));var Redis=require(_0x8422('0x12'));var authService=require(_0x8422('0x13'));var qs=require(_0x8422('0x14'));var as=require(_0x8422('0x15'));var hardwareService=require(_0x8422('0x16'));var logger=require(_0x8422('0x17'))('api');var utils=require(_0x8422('0x18'));var config=require(_0x8422('0x19'));var licenseUtil=require(_0x8422('0x1a'));var db=require(_0x8422('0x1b'))['db'];config[_0x8422('0x1c')]=_[_0x8422('0x1d')](config[_0x8422('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x8422('0x1e'))(new Redis(config[_0x8422('0x1c')]));require(_0x8422('0x1f'))[_0x8422('0x20')](socket);var jayson=require(_0x8422('0x21'));var client=jayson[_0x8422('0x22')][_0x8422('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x58c4ac,_0x17e161,_0x3c1d35,_0x1909e7){return new BPromise(function(_0x2cb8a4,_0xb29d4f){var _0x334b2e=_0x1909e7||client;return _0x334b2e[_0x8422('0x24')](_0x58c4ac,_0x3c1d35)[_0x8422('0x25')](function(_0x1911fd){logger[_0x8422('0x26')](_0x8422('0x27'),_0x17e161,'request\x20sent');logger['debug'](_0x8422('0x28'),_0x17e161,'request\x20sent',JSON[_0x8422('0x29')](_0x1911fd));if(_0x1911fd['error']){if(_0x1911fd[_0x8422('0x2a')][_0x8422('0x2b')]===0x1f4){logger[_0x8422('0x2a')](_0x8422('0x27'),_0x17e161,_0x1911fd[_0x8422('0x2a')][_0x8422('0x2c')]);return _0xb29d4f(_0x1911fd['error'][_0x8422('0x2c')]);}logger[_0x8422('0x2a')](_0x8422('0x27'),_0x17e161,_0x1911fd[_0x8422('0x2a')][_0x8422('0x2c')]);return _0x2cb8a4(_0x1911fd[_0x8422('0x2a')]['message']);}else{logger['info'](_0x8422('0x27'),_0x17e161,_0x8422('0x2d'));_0x2cb8a4(_0x1911fd[_0x8422('0x2e')][_0x8422('0x2c')]);}})['catch'](function(_0x43d82f){logger['error'](_0x8422('0x27'),_0x17e161,_0x43d82f);_0xb29d4f(_0x43d82f);});});}function respondWithStatusCode(_0x2bb2d2,_0x5b9aa9){_0x5b9aa9=_0x5b9aa9||0xcc;return function(_0x593425){if(_0x593425){return _0x2bb2d2[_0x8422('0x2f')](_0x5b9aa9);}return _0x2bb2d2[_0x8422('0x30')](_0x5b9aa9)[_0x8422('0x31')]();};}function respondWithResult(_0x437110,_0x4fe47c){_0x4fe47c=_0x4fe47c||0xc8;return function(_0x226691){if(_0x226691){return _0x437110['status'](_0x4fe47c)[_0x8422('0x32')](_0x226691);}};}function respondWithFilteredResult(_0x1ae89b,_0x3a2637){return function(_0x5de5dd){if(_0x5de5dd){var _0x481bb1=typeof _0x3a2637[_0x8422('0x33')]===_0x8422('0x34')&&typeof _0x3a2637['limit']===_0x8422('0x34');var _0x1954eb=_0x5de5dd[_0x8422('0x35')];var _0x2b8975=_0x481bb1?0x0:_0x3a2637[_0x8422('0x33')];var _0x1dbe84=_0x481bb1?_0x5de5dd['count']:_0x3a2637[_0x8422('0x33')]+_0x3a2637[_0x8422('0x36')];var _0x356675;if(_0x1dbe84>=_0x1954eb){_0x1dbe84=_0x1954eb;_0x356675=0xc8;}else{_0x356675=0xce;}_0x1ae89b[_0x8422('0x30')](_0x356675);return _0x1ae89b['set'](_0x8422('0x37'),_0x2b8975+'-'+_0x1dbe84+'/'+_0x1954eb)[_0x8422('0x32')](_0x5de5dd);}return null;};}function patchUpdates(_0x47c804){return function(_0xdff644){try{jsonpatch[_0x8422('0x38')](_0xdff644,_0x47c804,!![]);}catch(_0x3eeceb){return BPromise['reject'](_0x3eeceb);}return _0xdff644['save']();};}function saveUpdates(_0x2d212e,_0x3e18b2){return function(_0x133e42){if(_0x133e42){return _0x133e42[_0x8422('0x39')](_0x2d212e)[_0x8422('0x25')](function(_0x1e1041){return _0x1e1041;});}return null;};}function removeEntity(_0x4db904,_0x5364b4){return function(_0x23fe37){if(_0x23fe37){return _0x23fe37['destroy']()[_0x8422('0x25')](function(){var _0x41009a=_0x23fe37[_0x8422('0x3a')]({'plain':!![]});var _0x1020c4=_0x8422('0x3b');return db[_0x8422('0x3c')]['destroy']({'where':{'type':_0x1020c4,'resourceId':_0x41009a['id']}})[_0x8422('0x25')](function(){return _0x23fe37;});})['then'](function(){_0x4db904[_0x8422('0x30')](0xcc)[_0x8422('0x31')]();});}};}function handleEntityNotFound(_0x369b5f,_0x52dc15){return function(_0xe2af4e){if(!_0xe2af4e){_0x369b5f[_0x8422('0x2f')](0x194);}return _0xe2af4e;};}function handleError(_0x57fca2,_0x4f1979){_0x4f1979=_0x4f1979||0x1f4;return function(_0x4e10a3){logger[_0x8422('0x2a')](_0x4e10a3[_0x8422('0x3d')]);if(_0x4e10a3[_0x8422('0x3e')]){delete _0x4e10a3[_0x8422('0x3e')];}_0x57fca2[_0x8422('0x30')](_0x4f1979)[_0x8422('0x3f')](_0x4e10a3);};}exports[_0x8422('0x40')]=function(_0x39d1f6,_0x303cab){var _0x51e51f={},_0x5663f7={},_0xd4f31d={'count':0x0,'rows':[]};var _0x38125d=_['map'](db[_0x8422('0x41')][_0x8422('0x42')],function(_0xa757d9){return{'name':_0xa757d9['fieldName'],'type':_0xa757d9['type'][_0x8422('0x43')]};});_0x5663f7[_0x8422('0x44')]=_[_0x8422('0x45')](_0x38125d,_0x8422('0x3e'));_0x5663f7[_0x8422('0x46')]=_[_0x8422('0x47')](_0x39d1f6[_0x8422('0x46')]);_0x5663f7[_0x8422('0x48')]=_[_0x8422('0x49')](_0x5663f7[_0x8422('0x44')],_0x5663f7[_0x8422('0x46')]);_0x51e51f[_0x8422('0x4a')]=_['intersection'](_0x5663f7[_0x8422('0x44')],qs[_0x8422('0x4b')](_0x39d1f6[_0x8422('0x46')][_0x8422('0x4b')]));_0x51e51f['attributes']=_0x51e51f[_0x8422('0x4a')][_0x8422('0x4c')]?_0x51e51f[_0x8422('0x4a')]:_0x5663f7[_0x8422('0x44')];if(!_0x39d1f6[_0x8422('0x46')]['hasOwnProperty']('nolimit')){_0x51e51f[_0x8422('0x36')]=qs['limit'](_0x39d1f6[_0x8422('0x46')][_0x8422('0x36')]);_0x51e51f[_0x8422('0x33')]=qs[_0x8422('0x33')](_0x39d1f6[_0x8422('0x46')][_0x8422('0x33')]);}_0x51e51f[_0x8422('0x4d')]=qs[_0x8422('0x4e')](_0x39d1f6[_0x8422('0x46')][_0x8422('0x4e')]);_0x51e51f[_0x8422('0x4f')]=qs[_0x8422('0x48')](_[_0x8422('0x50')](_0x39d1f6[_0x8422('0x46')],_0x5663f7[_0x8422('0x48')]),_0x38125d);if(_0x39d1f6['query'][_0x8422('0x51')]){_0x51e51f[_0x8422('0x4f')]=_[_0x8422('0x52')](_0x51e51f['where'],{'$or':_[_0x8422('0x45')](_0x38125d,function(_0x522b48){if(_0x522b48[_0x8422('0x53')]!==_0x8422('0x54')){var _0x1fa0be={};_0x1fa0be[_0x522b48[_0x8422('0x3e')]]={'$like':'%'+_0x39d1f6['query']['filter']+'%'};return _0x1fa0be;}})});}_0x51e51f=_[_0x8422('0x52')]({},_0x51e51f,_0x39d1f6[_0x8422('0x55')]);var _0x395dbb={'where':_0x51e51f[_0x8422('0x4f')]};return db['ChatQueue'][_0x8422('0x35')](_0x395dbb)[_0x8422('0x25')](function(_0x591c22){_0xd4f31d[_0x8422('0x35')]=_0x591c22;if(_0x39d1f6[_0x8422('0x46')]['includeAll']){_0x51e51f[_0x8422('0x56')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x51e51f);})['then'](function(_0x55b1ff){_0xd4f31d[_0x8422('0x57')]=_0x55b1ff;return _0xd4f31d;})[_0x8422('0x25')](respondWithFilteredResult(_0x303cab,_0x51e51f))[_0x8422('0x58')](handleError(_0x303cab,null));};exports[_0x8422('0x59')]=function(_0xcfb863,_0x13f4a0){var _0xe79e2d={'raw':!![],'where':{'id':_0xcfb863['params']['id']}},_0x28f09e={};_0x28f09e[_0x8422('0x44')]=_[_0x8422('0x47')](db[_0x8422('0x41')][_0x8422('0x42')]);_0x28f09e[_0x8422('0x46')]=_[_0x8422('0x47')](_0xcfb863[_0x8422('0x46')]);_0x28f09e['filters']=_[_0x8422('0x49')](_0x28f09e['model'],_0x28f09e[_0x8422('0x46')]);_0xe79e2d[_0x8422('0x4a')]=_[_0x8422('0x49')](_0x28f09e[_0x8422('0x44')],qs[_0x8422('0x4b')](_0xcfb863['query'][_0x8422('0x4b')]));_0xe79e2d[_0x8422('0x4a')]=_0xe79e2d[_0x8422('0x4a')][_0x8422('0x4c')]?_0xe79e2d['attributes']:_0x28f09e['model'];if(_0xcfb863[_0x8422('0x46')][_0x8422('0x5a')]){_0xe79e2d[_0x8422('0x56')]=[{'all':!![]}];}_0xe79e2d=_[_0x8422('0x52')]({},_0xe79e2d,_0xcfb863[_0x8422('0x55')]);return db['ChatQueue'][_0x8422('0x5b')](_0xe79e2d)[_0x8422('0x25')](handleEntityNotFound(_0x13f4a0,null))[_0x8422('0x25')](respondWithResult(_0x13f4a0,null))['catch'](handleError(_0x13f4a0,null));};exports[_0x8422('0x5c')]=function(_0x4e5f0d,_0x2d1583){return db[_0x8422('0x41')][_0x8422('0x5c')](_0x4e5f0d['body'],{})[_0x8422('0x25')](function(_0xd53c2b){var _0x4b82ef=_0x4e5f0d['user']['get']({'plain':!![]});if(!_0x4b82ef)throw new Error(_0x8422('0x5d'));if(_0x4b82ef[_0x8422('0x5e')]===_0x8422('0x5f')){var _0x301f59=_0xd53c2b[_0x8422('0x3a')]({'plain':!![]});var _0x223bcf='ChatQueues';return db[_0x8422('0x60')][_0x8422('0x5b')]({'where':{'name':_0x223bcf,'userProfileId':_0x4b82ef[_0x8422('0x61')]},'raw':!![]})[_0x8422('0x25')](function(_0x55330e){if(_0x55330e&&_0x55330e[_0x8422('0x62')]===0x0){return db[_0x8422('0x3c')][_0x8422('0x5c')]({'name':_0x301f59['name'],'resourceId':_0x301f59['id'],'type':_0x55330e[_0x8422('0x3e')],'sectionId':_0x55330e['id']},{})['then'](function(){return _0xd53c2b;});}else{return _0xd53c2b;}})[_0x8422('0x58')](function(_0x59ea6b){logger[_0x8422('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59ea6b);throw _0x59ea6b;});}return _0xd53c2b;})[_0x8422('0x25')](respondWithResult(_0x2d1583,0xc9))[_0x8422('0x58')](handleError(_0x2d1583,null));};exports['update']=function(_0x2f5201,_0x2bce3c){if(_0x2f5201[_0x8422('0x63')]['id']){delete _0x2f5201[_0x8422('0x63')]['id'];}return db[_0x8422('0x41')]['find']({'where':{'id':_0x2f5201['params']['id']}})[_0x8422('0x25')](handleEntityNotFound(_0x2bce3c,null))['then'](saveUpdates(_0x2f5201[_0x8422('0x63')],null))[_0x8422('0x25')](respondWithResult(_0x2bce3c,null))[_0x8422('0x58')](handleError(_0x2bce3c,null));};exports[_0x8422('0x64')]=function(_0x26cc92,_0x1dbd3a){return db[_0x8422('0x41')][_0x8422('0x5b')]({'where':{'id':_0x26cc92[_0x8422('0x65')]['id']}})[_0x8422('0x25')](handleEntityNotFound(_0x1dbd3a,null))['then'](removeEntity(_0x1dbd3a,null))[_0x8422('0x58')](handleError(_0x1dbd3a,null));};exports[_0x8422('0x66')]=function(_0x50d814,_0x7c8f12){return db['ChatQueue'][_0x8422('0x66')]()['then'](respondWithResult(_0x7c8f12,null))[_0x8422('0x58')](handleError(_0x7c8f12,null));};exports[_0x8422('0x67')]=function(_0x67c0d5,_0x25b31f,_0x128861){var _0xe83d3a={'raw':!![],'where':{}},_0x561e9a={},_0x33aaad;return db[_0x8422('0x41')]['findOne']({'where':{'id':_0x67c0d5[_0x8422('0x65')]['id']}})[_0x8422('0x25')](handleEntityNotFound(_0x25b31f,null))['then'](function(_0x55f878){if(_0x55f878){_0x33aaad=_0x55f878[_0x8422('0x3a')]({'plain':!![]});_0x561e9a[_0x8422('0x44')]=_['keys'](db[_0x8422('0x68')][_0x8422('0x42')]);_0x561e9a[_0x8422('0x46')]=_[_0x8422('0x47')](_0x67c0d5['query']);_0x561e9a['filters']=_[_0x8422('0x49')](_0x561e9a[_0x8422('0x44')],_0x561e9a[_0x8422('0x46')]);_0xe83d3a['attributes']=_[_0x8422('0x49')](_0x561e9a[_0x8422('0x44')],qs[_0x8422('0x4b')](_0x67c0d5[_0x8422('0x46')][_0x8422('0x4b')]));_0xe83d3a[_0x8422('0x4a')]=_0xe83d3a[_0x8422('0x4a')][_0x8422('0x4c')]?_0xe83d3a[_0x8422('0x4a')]:_0x561e9a['model'];if(!_0x67c0d5['query'][_0x8422('0x69')](_0x8422('0x6a'))){_0xe83d3a['limit']=qs[_0x8422('0x36')](_0x67c0d5['query'][_0x8422('0x36')]);_0xe83d3a[_0x8422('0x33')]=qs['offset'](_0x67c0d5[_0x8422('0x46')][_0x8422('0x33')]);}_0xe83d3a[_0x8422('0x4d')]=qs['sort'](_0x67c0d5[_0x8422('0x46')]['sort']);_0xe83d3a[_0x8422('0x4f')]=qs[_0x8422('0x48')](_[_0x8422('0x50')](_0x67c0d5['query'],_0x561e9a[_0x8422('0x48')]));_0xe83d3a[_0x8422('0x4f')][_0x8422('0x6b')]=_0x55f878['id'];if(_0x67c0d5[_0x8422('0x46')][_0x8422('0x51')]){_0xe83d3a['where']=_['merge'](_0xe83d3a['where'],{'$or':_[_0x8422('0x45')](_0xe83d3a[_0x8422('0x4a')],function(_0x23fa70){var _0x3fe84b={};_0x3fe84b[_0x23fa70]={'$like':'%'+_0x67c0d5[_0x8422('0x46')][_0x8422('0x51')]+'%'};return _0x3fe84b;})});}_0xe83d3a=_[_0x8422('0x52')]({},_0xe83d3a,_0x67c0d5[_0x8422('0x55')]);return db[_0x8422('0x68')]['findAll'](_0xe83d3a);}})[_0x8422('0x25')](function(_0x3d1917){if(_0x3d1917){return db[_0x8422('0x6c')][_0x8422('0x6d')]({'where':{'id':_[_0x8422('0x45')](_0x3d1917,'UserId'),'role':'agent'},'attributes':['id','name',_0x8422('0x6e'),_0x8422('0x6f'),_0x8422('0x70')]});}})[_0x8422('0x25')](function(_0x46179f){if(_0x46179f){return{'count':_0x46179f[_0x8422('0x35')],'rows':_[_0x8422('0x45')](_0x46179f[_0x8422('0x57')],function(_0x4c47b5){return{'membername':_0x4c47b5[_0x8422('0x3e')],'UserId':_0x4c47b5['id'],'queue_name':_0x33aaad['name'],'ChatQueueId':_0x33aaad['id'],'interface':util[_0x8422('0x71')](_0x8422('0x72'),_0x8422('0x73'),_0x4c47b5[_0x8422('0x3e')]),'penalty':0x0,'paused':_0x4c47b5['chatPause'],'createdAt':_0x4c47b5['createdAt'],'updatedAt':_0x4c47b5[_0x8422('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8422('0x25')](respondWithFilteredResult(_0x25b31f,_0xe83d3a))[_0x8422('0x58')](handleError(_0x25b31f,null));};exports[_0x8422('0x74')]=function(_0xa44b5,_0x93ae56,_0x4b4853){var _0x36ce5e={};var _0x38da5f={};var _0x2edc5e;var _0xade523;return db[_0x8422('0x41')][_0x8422('0x75')]({'where':{'id':_0xa44b5['params']['id']}})['then'](handleEntityNotFound(_0x93ae56,null))[_0x8422('0x25')](function(_0x4a92ce){if(_0x4a92ce){_0x2edc5e=_0x4a92ce;_0x38da5f[_0x8422('0x44')]=_[_0x8422('0x47')](db[_0x8422('0x76')][_0x8422('0x42')]);_0x38da5f[_0x8422('0x46')]=_[_0x8422('0x47')](_0xa44b5['query']);_0x38da5f[_0x8422('0x48')]=_[_0x8422('0x49')](_0x38da5f['model'],_0x38da5f[_0x8422('0x46')]);_0x36ce5e[_0x8422('0x4a')]=_['intersection'](_0x38da5f[_0x8422('0x44')],qs[_0x8422('0x4b')](_0xa44b5[_0x8422('0x46')][_0x8422('0x4b')]));_0x36ce5e['attributes']=_0x36ce5e[_0x8422('0x4a')][_0x8422('0x4c')]?_0x36ce5e[_0x8422('0x4a')]:_0x38da5f[_0x8422('0x44')];_0x36ce5e[_0x8422('0x4d')]=qs[_0x8422('0x4e')](_0xa44b5['query'][_0x8422('0x4e')]);_0x36ce5e[_0x8422('0x4f')]=qs[_0x8422('0x48')](_[_0x8422('0x50')](_0xa44b5[_0x8422('0x46')],_0x38da5f[_0x8422('0x48')]));if(_0xa44b5[_0x8422('0x46')]['filter']){_0x36ce5e[_0x8422('0x4f')]=_[_0x8422('0x52')](_0x36ce5e[_0x8422('0x4f')],{'$or':_[_0x8422('0x45')](_0x36ce5e[_0x8422('0x4a')],function(_0x229d6f){var _0x5923be={};_0x5923be[_0x229d6f]={'$like':'%'+_0xa44b5[_0x8422('0x46')]['filter']+'%'};return _0x5923be;})});}_0x36ce5e=_[_0x8422('0x52')]({},_0x36ce5e,_0xa44b5[_0x8422('0x55')]);return _0x2edc5e[_0x8422('0x74')](_0x36ce5e);}})[_0x8422('0x25')](function(_0x1600a5){if(_0x1600a5){_0xade523=_0x1600a5['length'];if(!_0xa44b5[_0x8422('0x46')][_0x8422('0x69')]('nolimit')){_0x36ce5e[_0x8422('0x36')]=qs[_0x8422('0x36')](_0xa44b5[_0x8422('0x46')]['limit']);_0x36ce5e[_0x8422('0x33')]=qs[_0x8422('0x33')](_0xa44b5[_0x8422('0x46')][_0x8422('0x33')]);}return _0x2edc5e[_0x8422('0x74')](_0x36ce5e);}})['then'](function(_0x3df109){if(_0x3df109){return _0x3df109?{'count':_0xade523,'rows':_0x3df109}:null;}})[_0x8422('0x25')](respondWithResult(_0x93ae56,null))['catch'](handleError(_0x93ae56,null));};exports[_0x8422('0x77')]=function(_0x4812ae,_0xd0910e,_0x50ad66){var _0x18fd68=_0x4812ae[_0x8422('0x63')][_0x8422('0x78')];return db['Team']['findAll']({'where':{'id':_0x18fd68},'attributes':['id'],'include':[{'model':db[_0x8422('0x6c')],'as':_0x8422('0x79'),'attributes':['id','name',_0x8422('0x7a'),_0x8422('0x7b'),_0x8422('0x7c')],'raw':!![]}]})['then'](function(_0x13f11a){if(_0x13f11a){var _0xe3c514=_[_0x8422('0x7d')](_0x13f11a,function(_0x226388){var _0x207f99=_0x226388['get']({'plain':!![]});return _0x207f99[_0x8422('0x79')];});return db[_0x8422('0x41')]['find']({'where':{'id':_0x4812ae[_0x8422('0x65')]['id']}})[_0x8422('0x25')](function(_0x5a7981){return db[_0x8422('0x7e')][_0x8422('0x7f')](function(_0x14fa9a){return _0x5a7981[_0x8422('0x77')](_0x18fd68,{'transaction':_0x14fa9a})[_0x8422('0x25')](function(){return BPromise[_0x8422('0x80')](_0xe3c514,function(_0x59cc28){return db[_0x8422('0x68')][_0x8422('0x81')]({'where':{'UserId':_0x59cc28['id'],'ChatQueueId':_0x4812ae[_0x8422('0x65')]['id']},'transaction':_0x14fa9a});});})[_0x8422('0x25')](function(){_0xe3c514['forEach'](function(_0x3fc1dd){socket[_0x8422('0x82')](_0x8422('0x83'),{'UserId':_0x3fc1dd['id'],'ChatQueueId':_0x5a7981['id']});});});});});}})[_0x8422('0x25')](respondWithStatusCode(_0xd0910e,null))[_0x8422('0x58')](handleError(_0xd0910e,null));};exports[_0x8422('0x84')]=function(_0x14e113,_0x4c41b8,_0x136897){return db[_0x8422('0x76')][_0x8422('0x85')]({'where':{'id':_0x14e113['query'][_0x8422('0x78')]},'attributes':['id'],'include':[{'model':db[_0x8422('0x6c')],'as':_0x8422('0x79'),'attributes':['id'],'raw':!![]}]})[_0x8422('0x25')](handleEntityNotFound(_0x4c41b8,null))[_0x8422('0x25')](function(_0x2c08c4){var _0x4fd9ab=_[_0x8422('0x45')](_0x2c08c4,'id');var _0x11e55d=[];var _0x50b2be=[];var _0xcfe54a=squel['select']();_0xcfe54a[_0x8422('0x86')](_0x8422('0x87'))[_0x8422('0x88')](_0x8422('0x89'),'tq')[_0x8422('0x8a')](_0x8422('0x8b'),'ut',_0x8422('0x8c'))[_0x8422('0x4f')]('ChatQueueId\x20=\x20?',_0x14e113[_0x8422('0x65')]['id']);for(var _0x54fe5e=0x0;_0x54fe5e<_0x2c08c4['length'];_0x54fe5e+=0x1){let _0x5c7e45=_0x2c08c4[_0x54fe5e];for(var _0x11a76c=0x0;_0x11a76c<_0x5c7e45[_0x8422('0x79')][_0x8422('0x4c')];_0x11a76c+=0x1){let _0x5c9bae=_0x5c7e45[_0x8422('0x79')][_0x11a76c];var _0x1d4522=_0xcfe54a[_0x8422('0x8d')]();_0x1d4522[_0x8422('0x4f')]('ut.UserId\x20=\x20?',_0x5c9bae['id']);_0x50b2be['push'](db[_0x8422('0x7e')][_0x8422('0x46')](_0x1d4522['toString'](),{'type':db['sequelize']['QueryTypes'][_0x8422('0x8e')]})[_0x8422('0x25')](function(_0xae568b){if(_0xae568b[_0x8422('0x4c')]===0x1){return _0x5c9bae['id'];}else{var _0x4b62df=_[_0x8422('0x8f')](_['map'](_0xae568b,_0x8422('0x90')),function(_0x2ea0b0){return _[_0x8422('0x91')](_0x4fd9ab,_0x2ea0b0);});if(_0x4b62df){return _0x5c9bae['id'];}}}));}}return BPromise[_0x8422('0x92')](_0x50b2be)['then'](function(_0x3d3c40){_0x11e55d=_(_0x11e55d)['union'](_0x3d3c40)[_0x8422('0x93')]()[_0x8422('0x94')]();return db['ChatQueue']['find']({'where':{'id':_0x14e113[_0x8422('0x65')]['id']}})[_0x8422('0x25')](function(_0x305619){return db[_0x8422('0x7e')]['transaction'](function(_0x161209){return _0x305619[_0x8422('0x84')](_0x14e113['query'][_0x8422('0x78')],{'transaction':_0x161209})[_0x8422('0x25')](function(){if(!_[_0x8422('0x95')](_0x11e55d)){return _0x305619[_0x8422('0x96')](_0x11e55d,{'transaction':_0x161209});}})['then'](function(){_0x11e55d[_0x8422('0x97')](function(_0x568a87){socket[_0x8422('0x82')]('userChatQueue:remove',{'UserId':_0x568a87,'ChatQueueId':_0x305619['id']});});});});});});})[_0x8422('0x25')](respondWithStatusCode(_0x4c41b8,null))['catch'](handleError(_0x4c41b8,null));};exports['addAgents']=function(_0x55ae60,_0x32b2b5,_0x9dccd8){return db['ChatQueue'][_0x8422('0x5b')]({'where':{'id':_0x55ae60['params']['id']}})[_0x8422('0x25')](handleEntityNotFound(_0x32b2b5,null))['then'](function(_0x104129){if(_0x104129){return _0x104129['addAgents'](_0x55ae60['body']['ids'],_['omit'](_0x55ae60[_0x8422('0x63')],[_0x8422('0x78'),'id'])||{})['spread'](function(_0x23f351){for(var _0x418dfc=0x0;_0x418dfc<_0x55ae60[_0x8422('0x63')][_0x8422('0x78')]['length'];_0x418dfc+=0x1){socket[_0x8422('0x82')]('userChatQueue:save',{'UserId':Number(_0x55ae60[_0x8422('0x63')][_0x8422('0x78')][_0x418dfc]),'ChatQueueId':Number(_0x55ae60[_0x8422('0x65')]['id'])});}return _0x23f351;});}})[_0x8422('0x25')](respondWithResult(_0x32b2b5,null))[_0x8422('0x58')](handleError(_0x32b2b5,null));};exports[_0x8422('0x96')]=function(_0x5e3b1f,_0x4f0f60,_0x440696){return db['ChatQueue'][_0x8422('0x5b')]({'where':{'id':_0x5e3b1f['params']['id']}})['then'](handleEntityNotFound(_0x4f0f60,null))['then'](function(_0xfde3ab){if(_0xfde3ab){return _0xfde3ab[_0x8422('0x96')](_0x5e3b1f['query']['ids'])[_0x8422('0x25')](function(){if(_[_0x8422('0x98')](_0x5e3b1f[_0x8422('0x46')][_0x8422('0x78')])){for(var _0x47c77d=0x0;_0x47c77d<_0x5e3b1f['query']['ids'][_0x8422('0x4c')];_0x47c77d+=0x1){socket['emit'](_0x8422('0x99'),{'UserId':Number(_0x5e3b1f['query'][_0x8422('0x78')][_0x47c77d]),'ChatQueueId':Number(_0x5e3b1f[_0x8422('0x65')]['id'])});}}else{socket[_0x8422('0x82')]('userChatQueue:remove',{'UserId':Number(_0x5e3b1f[_0x8422('0x46')]['ids']),'ChatQueueId':Number(_0x5e3b1f[_0x8422('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x4f0f60,null))[_0x8422('0x58')](handleError(_0x4f0f60,null));};exports[_0x8422('0x9a')]=function(_0x436491,_0x13fd89,_0x30e678){var _0x356e80={};var _0x215ba4={};var _0x3c4ab9;var _0x3ce79f;return db[_0x8422('0x41')]['findOne']({'where':{'id':_0x436491[_0x8422('0x65')]['id']}})[_0x8422('0x25')](handleEntityNotFound(_0x13fd89,null))[_0x8422('0x25')](function(_0x1bdc16){if(_0x1bdc16){_0x3c4ab9=_0x1bdc16;_0x215ba4[_0x8422('0x44')]=_[_0x8422('0x47')](db[_0x8422('0x6c')][_0x8422('0x42')]);_0x215ba4['query']=_['keys'](_0x436491[_0x8422('0x46')]);_0x215ba4[_0x8422('0x48')]=_['intersection'](_0x215ba4[_0x8422('0x44')],_0x215ba4[_0x8422('0x46')]);_0x356e80[_0x8422('0x4a')]=_['intersection'](_0x215ba4[_0x8422('0x44')],qs[_0x8422('0x4b')](_0x436491['query']['fields']));_0x356e80[_0x8422('0x4a')]=_0x356e80['attributes']['length']?_0x356e80['attributes']:_0x215ba4[_0x8422('0x44')];_0x356e80[_0x8422('0x4d')]=qs['sort'](_0x436491[_0x8422('0x46')]['sort']);_0x356e80[_0x8422('0x4f')]=qs[_0x8422('0x48')](_[_0x8422('0x50')](_0x436491[_0x8422('0x46')],_0x215ba4[_0x8422('0x48')]));if(_0x436491[_0x8422('0x46')]['filter']){_0x356e80[_0x8422('0x4f')]=_[_0x8422('0x52')](_0x356e80[_0x8422('0x4f')],{'$or':_['map'](_0x356e80[_0x8422('0x4a')],function(_0x55ff7b){var _0x2d3f18={};_0x2d3f18[_0x55ff7b]={'$like':'%'+_0x436491[_0x8422('0x46')][_0x8422('0x51')]+'%'};return _0x2d3f18;})});}_0x356e80=_[_0x8422('0x52')]({},_0x356e80,_0x436491[_0x8422('0x55')]);return _0x3c4ab9[_0x8422('0x9a')](_0x356e80);}})['then'](function(_0x25487d){if(_0x25487d){_0x3ce79f=_0x25487d[_0x8422('0x4c')];if(!_0x436491[_0x8422('0x46')][_0x8422('0x69')]('nolimit')){_0x356e80[_0x8422('0x36')]=qs[_0x8422('0x36')](_0x436491['query'][_0x8422('0x36')]);_0x356e80[_0x8422('0x33')]=qs[_0x8422('0x33')](_0x436491[_0x8422('0x46')][_0x8422('0x33')]);}return _0x3c4ab9['getAgents'](_0x356e80);}})[_0x8422('0x25')](function(_0x5730f1){if(_0x5730f1){return _0x5730f1?{'count':_0x3ce79f,'rows':_0x5730f1}:null;}})[_0x8422('0x25')](respondWithResult(_0x13fd89,null))['catch'](handleError(_0x13fd89,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 121f352..4c0e64c 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 _0xf26a=['events','../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x26bb37,_0x169d5a){var _0x26e7ab=function(_0x4daf30){while(--_0x4daf30){_0x26bb37['push'](_0x26bb37['shift']());}};_0x26e7ab(++_0x169d5a);}(_0xf26a,0x158));var _0xaf26=function(_0x3ac2ca,_0x101b94){_0x3ac2ca=_0x3ac2ca-0x0;var _0x4667aa=_0xf26a[_0x3ac2ca];return _0x4667aa;};'use strict';var EventEmitter=require(_0xaf26('0x0'));var ChatQueue=require(_0xaf26('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf26('0x2'),'afterUpdate':'update','afterDestroy':_0xaf26('0x3')};function emitEvent(_0x1b935b){return function(_0x3471b2,_0x5d3bc,_0x1cb812){ChatQueueEvents[_0xaf26('0x4')](_0x1b935b+':'+_0x3471b2['id'],_0x3471b2);ChatQueueEvents[_0xaf26('0x4')](_0x1b935b,_0x3471b2);_0x1cb812(null);};}for(var e in events){if(events[_0xaf26('0x5')](e)){var event=events[e];ChatQueue[_0xaf26('0x6')](e,emitEvent(event));}}module[_0xaf26('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xfa58=['ChatQueue','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x172eb5,_0x2a5111){var _0x1ea8b2=function(_0x272943){while(--_0x272943){_0x172eb5['push'](_0x172eb5['shift']());}};_0x1ea8b2(++_0x2a5111);}(_0xfa58,0x157));var _0x8fa5=function(_0x572637,_0x216d95){_0x572637=_0x572637-0x0;var _0xb6748=_0xfa58[_0x572637];return _0xb6748;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x8fa5('0x0'))['db'][_0x8fa5('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8fa5('0x2'),'afterUpdate':'update','afterDestroy':_0x8fa5('0x3')};function emitEvent(_0x1a31d7){return function(_0xfaf04d,_0x16d98e,_0x5ac0d1){ChatQueueEvents[_0x8fa5('0x4')](_0x1a31d7+':'+_0xfaf04d['id'],_0xfaf04d);ChatQueueEvents[_0x8fa5('0x4')](_0x1a31d7,_0xfaf04d);_0x5ac0d1(null);};}for(var e in events){if(events[_0x8fa5('0x5')](e)){var event=events[e];ChatQueue[_0x8fa5('0x6')](e,emitEvent(event));}}module[_0x8fa5('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 34d23c5..1d7845d 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 _0xd224=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x5e8a62,_0x248c5b){var _0x251625=function(_0x4c1bb8){while(--_0x4c1bb8){_0x5e8a62['push'](_0x5e8a62['shift']());}};_0x251625(++_0x248c5b);}(_0xd224,0x12c));var _0x4d22=function(_0x363a32,_0x48e24f){_0x363a32=_0x363a32-0x0;var _0x3786b2=_0xd224[_0x363a32];return _0x3786b2;};'use strict';var _=require(_0x4d22('0x0'));var util=require(_0x4d22('0x1'));var logger=require('../../config/logger')(_0x4d22('0x2'));var moment=require(_0x4d22('0x3'));var BPromise=require(_0x4d22('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4d22('0x5'));var config=require(_0x4d22('0x6'));var attributes=require(_0x4d22('0x7'));module[_0x4d22('0x8')]=function(_0x4f6a06,_0xafb374){return _0x4f6a06[_0x4d22('0x9')](_0x4d22('0xa'),attributes,{'tableName':_0x4d22('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0673=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue'];(function(_0x1b1448,_0x4189e1){var _0x3d32f2=function(_0x7928d){while(--_0x7928d){_0x1b1448['push'](_0x1b1448['shift']());}};_0x3d32f2(++_0x4189e1);}(_0x0673,0xa5));var _0x3067=function(_0x3782be,_0x4464bb){_0x3782be=_0x3782be-0x0;var _0x3dffa0=_0x0673[_0x3782be];return _0x3dffa0;};'use strict';var _=require(_0x3067('0x0'));var util=require(_0x3067('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3067('0x2'));var BPromise=require(_0x3067('0x3'));var rp=require(_0x3067('0x4'));var fs=require('fs');var path=require(_0x3067('0x5'));var rimraf=require(_0x3067('0x6'));var config=require(_0x3067('0x7'));var attributes=require(_0x3067('0x8'));module['exports']=function(_0x4fac90,_0x21eec1){return _0x4fac90[_0x3067('0x9')](_0x3067('0xa'),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 5b18502..4df03e2 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 _0x4ad3=['then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','include','model','map','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatQueue.socket','register','request'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x4ad3,0x1b1));var _0x34ad=function(_0x3f9ec3,_0x3dfd37){_0x3f9ec3=_0x3f9ec3-0x0;var _0xe85b13=_0x4ad3[_0x3f9ec3];return _0xe85b13;};'use strict';var _=require(_0x34ad('0x0'));var util=require(_0x34ad('0x1'));var moment=require(_0x34ad('0x2'));var BPromise=require(_0x34ad('0x3'));var rs=require(_0x34ad('0x4'));var fs=require('fs');var Redis=require(_0x34ad('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ad('0x6'));var logger=require(_0x34ad('0x7'))(_0x34ad('0x8'));var config=require(_0x34ad('0x9'));var jayson=require(_0x34ad('0xa'));var client=jayson[_0x34ad('0xb')][_0x34ad('0xc')]({'port':0x232a});config[_0x34ad('0xd')]=_[_0x34ad('0xe')](config[_0x34ad('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x34ad('0xd')]));require(_0x34ad('0xf'))[_0x34ad('0x10')](socket);function respondWithRpcPromise(_0x1e1d8c,_0x56a16c,_0x43e756){return new BPromise(function(_0x126fe0,_0x3ba937){return client[_0x34ad('0x11')](_0x1e1d8c,_0x43e756)[_0x34ad('0x12')](function(_0x2c1d64){logger[_0x34ad('0x13')](_0x34ad('0x14'),_0x56a16c,_0x34ad('0x15'));logger[_0x34ad('0x16')](_0x34ad('0x17'),_0x56a16c,_0x34ad('0x15'),JSON[_0x34ad('0x18')](_0x2c1d64));if(_0x2c1d64[_0x34ad('0x19')]){if(_0x2c1d64[_0x34ad('0x19')][_0x34ad('0x1a')]===0x1f4){logger['error'](_0x34ad('0x14'),_0x56a16c,_0x2c1d64[_0x34ad('0x19')][_0x34ad('0x1b')]);return _0x3ba937(_0x2c1d64['error'][_0x34ad('0x1b')]);}logger[_0x34ad('0x19')](_0x34ad('0x14'),_0x56a16c,_0x2c1d64[_0x34ad('0x19')][_0x34ad('0x1b')]);return _0x126fe0(_0x2c1d64['error'][_0x34ad('0x1b')]);}else{logger['info'](_0x34ad('0x14'),_0x56a16c,_0x34ad('0x15'));_0x126fe0(_0x2c1d64[_0x34ad('0x1c')][_0x34ad('0x1b')]);}})[_0x34ad('0x1d')](function(_0x4b7f3e){logger[_0x34ad('0x19')](_0x34ad('0x14'),_0x56a16c,_0x4b7f3e);_0x3ba937(_0x4b7f3e);});});}exports[_0x34ad('0x1e')]=function(_0x15bf30){var _0x36b82f=this;return new Promise(function(_0xffdd2e,_0x3c178a){return db[_0x34ad('0x1f')][_0x34ad('0x20')]({'raw':_0x15bf30['options']?_0x15bf30[_0x34ad('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x15bf30[_0x34ad('0x21')]?_0x15bf30['options'][_0x34ad('0x22')]||null:null,'attributes':_0x15bf30[_0x34ad('0x21')]?_0x15bf30[_0x34ad('0x21')][_0x34ad('0x23')]||null:null,'limit':_0x15bf30[_0x34ad('0x21')]?_0x15bf30[_0x34ad('0x21')]['limit']||null:null,'include':_0x15bf30[_0x34ad('0x21')]?_0x15bf30['options'][_0x34ad('0x24')]?_['map'](_0x15bf30['options'][_0x34ad('0x24')],function(_0x3df4ca){return{'model':db[_0x3df4ca[_0x34ad('0x25')]],'as':_0x3df4ca['as'],'attributes':_0x3df4ca[_0x34ad('0x23')],'include':_0x3df4ca[_0x34ad('0x24')]?_[_0x34ad('0x26')](_0x3df4ca[_0x34ad('0x24')],function(_0x3b7ac5){return{'model':db[_0x3b7ac5[_0x34ad('0x25')]],'as':_0x3b7ac5['as'],'attributes':_0x3b7ac5[_0x34ad('0x23')],'include':_0x3b7ac5['include']?_[_0x34ad('0x26')](_0x3b7ac5[_0x34ad('0x24')],function(_0x23bb04){return{'model':db[_0x23bb04[_0x34ad('0x25')]],'as':_0x23bb04['as'],'attributes':_0x23bb04[_0x34ad('0x23')]};}):[]};}):[]};}):[]:[]})[_0x34ad('0x12')](function(_0x2daf92){logger[_0x34ad('0x13')](_0x34ad('0x1e'),_0x15bf30);logger[_0x34ad('0x16')](_0x34ad('0x1e'),_0x15bf30,JSON[_0x34ad('0x18')](_0x2daf92));_0xffdd2e(_0x2daf92);})[_0x34ad('0x1d')](function(_0xf0f8b7){logger[_0x34ad('0x19')](_0x34ad('0x1e'),_0xf0f8b7['message'],_0x15bf30);_0x3c178a(_0x36b82f[_0x34ad('0x19')](0x1f4,_0xf0f8b7['message']));});});};exports[_0x34ad('0x27')]=function(_0xedd677){var _0x41c1da=this;return new Promise(function(_0x3750a8,_0x5f2c31){return db[_0x34ad('0x1f')][_0x34ad('0x28')]({'raw':_0xedd677[_0x34ad('0x21')]?_0xedd677[_0x34ad('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0xedd677['options']?_0xedd677['options'][_0x34ad('0x22')]||null:null,'attributes':_0xedd677[_0x34ad('0x21')]?_0xedd677[_0x34ad('0x21')][_0x34ad('0x23')]||null:null,'include':_0xedd677[_0x34ad('0x21')]?_0xedd677['options'][_0x34ad('0x24')]?_[_0x34ad('0x26')](_0xedd677[_0x34ad('0x21')][_0x34ad('0x24')],function(_0x1b79b3){return{'model':db[_0x1b79b3[_0x34ad('0x25')]],'as':_0x1b79b3['as'],'attributes':_0x1b79b3[_0x34ad('0x23')],'include':_0x1b79b3[_0x34ad('0x24')]?_[_0x34ad('0x26')](_0x1b79b3[_0x34ad('0x24')],function(_0x437930){return{'model':db[_0x437930[_0x34ad('0x25')]],'as':_0x437930['as'],'attributes':_0x437930[_0x34ad('0x23')],'include':_0x437930[_0x34ad('0x24')]?_[_0x34ad('0x26')](_0x437930[_0x34ad('0x24')],function(_0x41a5a2){return{'model':db[_0x41a5a2[_0x34ad('0x25')]],'as':_0x41a5a2['as'],'attributes':_0x41a5a2[_0x34ad('0x23')]};}):[]};}):[]};}):[]:[]})[_0x34ad('0x12')](function(_0x47d6d4){logger['info'](_0x34ad('0x27'),_0xedd677);logger[_0x34ad('0x16')](_0x34ad('0x27'),_0xedd677,JSON[_0x34ad('0x18')](_0x47d6d4));_0x3750a8(_0x47d6d4);})[_0x34ad('0x1d')](function(_0x157c8b){logger[_0x34ad('0x19')](_0x34ad('0x27'),_0x157c8b[_0x34ad('0x1b')],_0xedd677);_0x5f2c31(_0x41c1da[_0x34ad('0x19')](0x1f4,_0x157c8b['message']));});});}; \ No newline at end of file +var _0xed03=['ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','where','limit','include','map','attributes','model','info','stringify','ShowChatQueue','find','raw','lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x52f568,_0xdc7ca0){var _0x909310=function(_0x20d9ac){while(--_0x20d9ac){_0x52f568['push'](_0x52f568['shift']());}};_0x909310(++_0xdc7ca0);}(_0xed03,0xdc));var _0x3ed0=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xed03[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x3ed0('0x0'));var util=require(_0x3ed0('0x1'));var moment=require('moment');var BPromise=require(_0x3ed0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ed0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ed0('0x4'))('rpc');var config=require(_0x3ed0('0x5'));var jayson=require(_0x3ed0('0x6'));var client=jayson[_0x3ed0('0x7')][_0x3ed0('0x8')]({'port':0x232a});config[_0x3ed0('0x9')]=_[_0x3ed0('0xa')](config[_0x3ed0('0x9')],{'host':_0x3ed0('0xb'),'port':0x18eb});var socket=require(_0x3ed0('0xc'))(new Redis(config[_0x3ed0('0x9')]));require(_0x3ed0('0xd'))[_0x3ed0('0xe')](socket);function respondWithRpcPromise(_0x14c005,_0x1aa928,_0x5b6150){return new BPromise(function(_0x2febdc,_0x4af4de){return client[_0x3ed0('0xf')](_0x14c005,_0x5b6150)[_0x3ed0('0x10')](function(_0x774658){logger['info'](_0x3ed0('0x11'),_0x1aa928,_0x3ed0('0x12'));logger[_0x3ed0('0x13')](_0x3ed0('0x14'),_0x1aa928,_0x3ed0('0x12'),JSON['stringify'](_0x774658));if(_0x774658[_0x3ed0('0x15')]){if(_0x774658[_0x3ed0('0x15')][_0x3ed0('0x16')]===0x1f4){logger[_0x3ed0('0x15')](_0x3ed0('0x11'),_0x1aa928,_0x774658['error'][_0x3ed0('0x17')]);return _0x4af4de(_0x774658[_0x3ed0('0x15')]['message']);}logger[_0x3ed0('0x15')](_0x3ed0('0x11'),_0x1aa928,_0x774658[_0x3ed0('0x15')][_0x3ed0('0x17')]);return _0x2febdc(_0x774658[_0x3ed0('0x15')][_0x3ed0('0x17')]);}else{logger['info'](_0x3ed0('0x11'),_0x1aa928,_0x3ed0('0x12'));_0x2febdc(_0x774658['result'][_0x3ed0('0x17')]);}})[_0x3ed0('0x18')](function(_0x387f03){logger[_0x3ed0('0x15')](_0x3ed0('0x11'),_0x1aa928,_0x387f03);_0x4af4de(_0x387f03);});});}exports[_0x3ed0('0x19')]=function(_0x564ada){var _0x3e0f2e=this;return new Promise(function(_0x47867f,_0x2ea67a){return db[_0x3ed0('0x1a')][_0x3ed0('0x1b')]({'raw':_0x564ada[_0x3ed0('0x1c')]?_0x564ada[_0x3ed0('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x564ada[_0x3ed0('0x1c')]?_0x564ada[_0x3ed0('0x1c')][_0x3ed0('0x1d')]||null:null,'attributes':_0x564ada[_0x3ed0('0x1c')]?_0x564ada[_0x3ed0('0x1c')]['attributes']||null:null,'limit':_0x564ada[_0x3ed0('0x1c')]?_0x564ada[_0x3ed0('0x1c')][_0x3ed0('0x1e')]||null:null,'include':_0x564ada[_0x3ed0('0x1c')]?_0x564ada[_0x3ed0('0x1c')][_0x3ed0('0x1f')]?_[_0x3ed0('0x20')](_0x564ada[_0x3ed0('0x1c')][_0x3ed0('0x1f')],function(_0x4d08ce){return{'model':db[_0x4d08ce['model']],'as':_0x4d08ce['as'],'attributes':_0x4d08ce[_0x3ed0('0x21')],'include':_0x4d08ce[_0x3ed0('0x1f')]?_[_0x3ed0('0x20')](_0x4d08ce[_0x3ed0('0x1f')],function(_0x440109){return{'model':db[_0x440109[_0x3ed0('0x22')]],'as':_0x440109['as'],'attributes':_0x440109['attributes'],'include':_0x440109['include']?_[_0x3ed0('0x20')](_0x440109[_0x3ed0('0x1f')],function(_0x2a5e86){return{'model':db[_0x2a5e86[_0x3ed0('0x22')]],'as':_0x2a5e86['as'],'attributes':_0x2a5e86[_0x3ed0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3ed0('0x10')](function(_0x307f9f){logger[_0x3ed0('0x23')](_0x3ed0('0x19'),_0x564ada);logger[_0x3ed0('0x13')]('GetChatQueue',_0x564ada,JSON[_0x3ed0('0x24')](_0x307f9f));_0x47867f(_0x307f9f);})['catch'](function(_0x3b08ea){logger[_0x3ed0('0x15')](_0x3ed0('0x19'),_0x3b08ea[_0x3ed0('0x17')],_0x564ada);_0x2ea67a(_0x3e0f2e[_0x3ed0('0x15')](0x1f4,_0x3b08ea[_0x3ed0('0x17')]));});});};exports[_0x3ed0('0x25')]=function(_0x2e5b7a){var _0xc9c4d8=this;return new Promise(function(_0x4c0d28,_0xedad6){return db[_0x3ed0('0x1a')][_0x3ed0('0x26')]({'raw':_0x2e5b7a[_0x3ed0('0x1c')]?_0x2e5b7a[_0x3ed0('0x1c')][_0x3ed0('0x27')]===undefined?!![]:![]:!![],'where':_0x2e5b7a['options']?_0x2e5b7a[_0x3ed0('0x1c')][_0x3ed0('0x1d')]||null:null,'attributes':_0x2e5b7a['options']?_0x2e5b7a[_0x3ed0('0x1c')][_0x3ed0('0x21')]||null:null,'include':_0x2e5b7a[_0x3ed0('0x1c')]?_0x2e5b7a[_0x3ed0('0x1c')]['include']?_[_0x3ed0('0x20')](_0x2e5b7a[_0x3ed0('0x1c')][_0x3ed0('0x1f')],function(_0x590801){return{'model':db[_0x590801[_0x3ed0('0x22')]],'as':_0x590801['as'],'attributes':_0x590801['attributes'],'include':_0x590801[_0x3ed0('0x1f')]?_[_0x3ed0('0x20')](_0x590801[_0x3ed0('0x1f')],function(_0x49da90){return{'model':db[_0x49da90['model']],'as':_0x49da90['as'],'attributes':_0x49da90[_0x3ed0('0x21')],'include':_0x49da90['include']?_['map'](_0x49da90[_0x3ed0('0x1f')],function(_0x2b1ca9){return{'model':db[_0x2b1ca9[_0x3ed0('0x22')]],'as':_0x2b1ca9['as'],'attributes':_0x2b1ca9[_0x3ed0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3ed0('0x10')](function(_0x18bc64){logger[_0x3ed0('0x23')]('ShowChatQueue',_0x2e5b7a);logger['debug'](_0x3ed0('0x25'),_0x2e5b7a,JSON[_0x3ed0('0x24')](_0x18bc64));_0x4c0d28(_0x18bc64);})[_0x3ed0('0x18')](function(_0x23f871){logger[_0x3ed0('0x15')](_0x3ed0('0x25'),_0x23f871['message'],_0x2e5b7a);_0xedad6(_0xc9c4d8[_0x3ed0('0x15')](0x1f4,_0x23f871['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 5c805a6..4e803b0 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 _0x72b1=['register','length','./chatQueue.events','remove','update','emit','removeListener'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x72b1,0x16e));var _0x172b=function(_0x3c043c,_0x5d384a){_0x3c043c=_0x3c043c-0x0;var _0x2e7e79=_0x72b1[_0x3c043c];return _0x2e7e79;};'use strict';var ChatQueueEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatQueueEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatQueue:'+_0x517363,_0x475fd6);ChatQueueEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file +var _0x84ab=['update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save','remove'];(function(_0x29bca0,_0x22ebf4){var _0x28be22=function(_0x46fe58){while(--_0x46fe58){_0x29bca0['push'](_0x29bca0['shift']());}};_0x28be22(++_0x22ebf4);}(_0x84ab,0x12f));var _0xb84a=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x84ab[_0x4bf96c];return _0x281d09;};'use strict';var ChatQueueEvents=require(_0xb84a('0x0'));var events=[_0xb84a('0x1'),_0xb84a('0x2'),_0xb84a('0x3')];function createListener(_0x473c3,_0x512f13){return function(_0xc83587){_0x512f13[_0xb84a('0x4')](_0x473c3,_0xc83587);};}function removeListener(_0x47b8e3,_0x9d3a00){return function(){ChatQueueEvents[_0xb84a('0x5')](_0x47b8e3,_0x9d3a00);};}exports[_0xb84a('0x6')]=function(_0x5b9def){for(var _0x521a64=0x0,_0x4dc496=events[_0xb84a('0x7')];_0x521a64<_0x4dc496;_0x521a64++){var _0x4fac4d=events[_0x521a64];var _0x3e9086=createListener(_0xb84a('0x8')+_0x4fac4d,_0x5b9def);ChatQueueEvents['on'](_0x4fac4d,_0x3e9086);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 8ae2df8..c20323b 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x2aae30,_0x4d834d){var _0x1ea85b=function(_0x6df1f8){while(--_0x6df1f8){_0x2aae30['push'](_0x2aae30['shift']());}};_0x1ea85b(++_0x4d834d);}(_0x55ca,0x126));var _0xa55c=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x55ca[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x3e0d44,_0xc4f9ff){var _0x297f42=function(_0xb5a246){while(--_0xb5a246){_0x3e0d44['push'](_0x3e0d44['shift']());}};_0x297f42(++_0xc4f9ff);}(_0x55ca,0x126));var _0xa55c=function(_0x45f575,_0x3ae51c){_0x45f575=_0x45f575-0x0;var _0xd8e1a1=_0x55ca[_0x45f575];return _0xd8e1a1;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 1a5699c..c785313 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 _0x3e06=['sequelize','exports','STRING','DATE','moment'];(function(_0x3cbb40,_0x3b3f92){var _0x59c30=function(_0x5e165b){while(--_0x5e165b){_0x3cbb40['push'](_0x3cbb40['shift']());}};_0x59c30(++_0x3b3f92);}(_0x3e06,0x153));var _0x63e0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x3e06[_0x19950b];return _0x3c6b41;};'use strict';var moment=require(_0x63e0('0x0'));var Sequelize=require(_0x63e0('0x1'));module[_0x63e0('0x2')]={'uniqueid':{'type':Sequelize[_0x63e0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x63e0('0x3')]},'joinAt':{'type':Sequelize[_0x63e0('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x63e0('0x4')]},'exitAt':{'type':Sequelize[_0x63e0('0x4')]},'reason':{'type':Sequelize[_0x63e0('0x3')]}}; \ No newline at end of file +var _0xb99f=['sequelize','exports','STRING','DATE'];(function(_0x3307ba,_0x234b22){var _0x41d6c3=function(_0x6cded3){while(--_0x6cded3){_0x3307ba['push'](_0x3307ba['shift']());}};_0x41d6c3(++_0x234b22);}(_0xb99f,0x1e8));var _0xfb99=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb99f[_0x53ccf2];return _0x5a2964;};'use strict';var moment=require('moment');var Sequelize=require(_0xfb99('0x0'));module[_0xfb99('0x1')]={'uniqueid':{'type':Sequelize[_0xfb99('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfb99('0x2')]},'joinAt':{'type':Sequelize[_0xfb99('0x3')]},'leaveAt':{'type':Sequelize[_0xfb99('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfb99('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c3ef942..43f4161 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 _0x0650=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','ChatQueueReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name','rawAttributes','fieldName','key','model'];(function(_0x4fdcba,_0x2bebdc){var _0x1eea3e=function(_0x49e225){while(--_0x49e225){_0x4fdcba['push'](_0x4fdcba['shift']());}};_0x1eea3e(++_0x2bebdc);}(_0x0650,0xed));var _0x0065=function(_0x12ec3e,_0x396b4a){_0x12ec3e=_0x12ec3e-0x0;var _0x12cbbe=_0x0650[_0x12ec3e];return _0x12cbbe;};'use strict';var emlformat=require(_0x0065('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0065('0x1'));var jsonpatch=require(_0x0065('0x2'));var rp=require('request-promise');var moment=require(_0x0065('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0065('0x4'));var util=require(_0x0065('0x5'));var path=require(_0x0065('0x6'));var sox=require('sox');var csv=require(_0x0065('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0065('0x8'));var crypto=require(_0x0065('0x9'));var jsforce=require(_0x0065('0xa'));var deskjs=require(_0x0065('0xb'));var toCsv=require(_0x0065('0x7'));var querystring=require(_0x0065('0xc'));var Papa=require(_0x0065('0xd'));var Redis=require(_0x0065('0xe'));var authService=require(_0x0065('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0065('0x10'));var hardwareService=require(_0x0065('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0065('0x12'));var licenseUtil=require(_0x0065('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45c7d1,_0x4255f6){_0x4255f6=_0x4255f6||0xcc;return function(_0x4c6296){if(_0x4c6296){return _0x45c7d1[_0x0065('0x14')](_0x4255f6);}return _0x45c7d1[_0x0065('0x15')](_0x4255f6)['end']();};}function respondWithResult(_0x5ae653,_0x1b9b1e){_0x1b9b1e=_0x1b9b1e||0xc8;return function(_0x5c0b74){if(_0x5c0b74){return _0x5ae653['status'](_0x1b9b1e)[_0x0065('0x16')](_0x5c0b74);}};}function respondWithFilteredResult(_0x5773d6,_0x38a870){return function(_0x48d817){if(_0x48d817){var _0x391fc1=typeof _0x38a870[_0x0065('0x17')]===_0x0065('0x18')&&typeof _0x38a870[_0x0065('0x19')]===_0x0065('0x18');var _0x34b0e2=_0x48d817[_0x0065('0x1a')];var _0x393d6e=_0x391fc1?0x0:_0x38a870['offset'];var _0x18bfa1=_0x391fc1?_0x48d817[_0x0065('0x1a')]:_0x38a870['offset']+_0x38a870[_0x0065('0x19')];var _0x3a0517;if(_0x18bfa1>=_0x34b0e2){_0x18bfa1=_0x34b0e2;_0x3a0517=0xc8;}else{_0x3a0517=0xce;}_0x5773d6[_0x0065('0x15')](_0x3a0517);return _0x5773d6[_0x0065('0x1b')](_0x0065('0x1c'),_0x393d6e+'-'+_0x18bfa1+'/'+_0x34b0e2)[_0x0065('0x16')](_0x48d817);}return null;};}function patchUpdates(_0x319e7a){return function(_0x529e30){try{jsonpatch['apply'](_0x529e30,_0x319e7a,!![]);}catch(_0x4b1213){return BPromise[_0x0065('0x1d')](_0x4b1213);}return _0x529e30[_0x0065('0x1e')]();};}function saveUpdates(_0x5b60c3,_0x2de3ae){return function(_0x5f1733){if(_0x5f1733){return _0x5f1733[_0x0065('0x1f')](_0x5b60c3)[_0x0065('0x20')](function(_0x3ec265){return _0x3ec265;});}return null;};}function removeEntity(_0x376452,_0x161b4c){return function(_0x1efa70){if(_0x1efa70){return _0x1efa70[_0x0065('0x21')]()['then'](function(){_0x376452[_0x0065('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4a4e,_0x3c715a){return function(_0x5924b3){if(!_0x5924b3){_0x4b4a4e[_0x0065('0x14')](0x194);}return _0x5924b3;};}function handleError(_0x6bf13b,_0x5db92c){_0x5db92c=_0x5db92c||0x1f4;return function(_0x123604){logger['error'](_0x123604['stack']);if(_0x123604[_0x0065('0x22')]){delete _0x123604[_0x0065('0x22')];}_0x6bf13b['status'](_0x5db92c)['send'](_0x123604);};}exports['index']=function(_0x51e091,_0x2e554f){var _0x1a977a={},_0x1f8813={},_0x369d08={'count':0x0,'rows':[]};var _0x4f15f5=_['map'](db['ChatQueueReport'][_0x0065('0x23')],function(_0x3a5286){return{'name':_0x3a5286[_0x0065('0x24')],'type':_0x3a5286['type'][_0x0065('0x25')]};});_0x1f8813[_0x0065('0x26')]=_['map'](_0x4f15f5,_0x0065('0x22'));_0x1f8813[_0x0065('0x27')]=_[_0x0065('0x28')](_0x51e091[_0x0065('0x27')]);_0x1f8813[_0x0065('0x29')]=_[_0x0065('0x2a')](_0x1f8813[_0x0065('0x26')],_0x1f8813[_0x0065('0x27')]);_0x1a977a['attributes']=_['intersection'](_0x1f8813['model'],qs[_0x0065('0x2b')](_0x51e091[_0x0065('0x27')][_0x0065('0x2b')]));_0x1a977a[_0x0065('0x2c')]=_0x1a977a[_0x0065('0x2c')][_0x0065('0x2d')]?_0x1a977a[_0x0065('0x2c')]:_0x1f8813['model'];if(!_0x51e091[_0x0065('0x27')][_0x0065('0x2e')](_0x0065('0x2f'))){_0x1a977a[_0x0065('0x19')]=qs[_0x0065('0x19')](_0x51e091['query'][_0x0065('0x19')]);_0x1a977a[_0x0065('0x17')]=qs[_0x0065('0x17')](_0x51e091[_0x0065('0x27')][_0x0065('0x17')]);}_0x1a977a[_0x0065('0x30')]=qs[_0x0065('0x31')](_0x51e091[_0x0065('0x27')][_0x0065('0x31')]);_0x1a977a[_0x0065('0x32')]=qs['filters'](_[_0x0065('0x33')](_0x51e091[_0x0065('0x27')],_0x1f8813[_0x0065('0x29')]),_0x4f15f5);if(_0x51e091['query'][_0x0065('0x34')]){_0x1a977a[_0x0065('0x32')]=_[_0x0065('0x35')](_0x1a977a[_0x0065('0x32')],{'$or':_[_0x0065('0x36')](_0x4f15f5,function(_0x231986){if(_0x231986['type']!==_0x0065('0x37')){var _0x2d1ba9={};_0x2d1ba9[_0x231986[_0x0065('0x22')]]={'$like':'%'+_0x51e091['query'][_0x0065('0x34')]+'%'};return _0x2d1ba9;}})});}_0x1a977a=_['merge']({},_0x1a977a,_0x51e091[_0x0065('0x38')]);var _0x37a434={'where':_0x1a977a['where']};return db[_0x0065('0x39')][_0x0065('0x1a')](_0x37a434)[_0x0065('0x20')](function(_0x3c1d6b){_0x369d08[_0x0065('0x1a')]=_0x3c1d6b;if(_0x51e091[_0x0065('0x27')]['includeAll']){_0x1a977a[_0x0065('0x3a')]=[{'all':!![]}];}return db[_0x0065('0x39')][_0x0065('0x3b')](_0x1a977a);})[_0x0065('0x20')](function(_0x1d251d){_0x369d08[_0x0065('0x3c')]=_0x1d251d;return _0x369d08;})[_0x0065('0x20')](respondWithFilteredResult(_0x2e554f,_0x1a977a))[_0x0065('0x3d')](handleError(_0x2e554f,null));};exports[_0x0065('0x3e')]=function(_0x41d6f7,_0x26cef9){var _0x32ab66={'raw':!![],'where':{'id':_0x41d6f7[_0x0065('0x3f')]['id']}},_0x35722d={};_0x35722d[_0x0065('0x26')]=_[_0x0065('0x28')](db[_0x0065('0x39')][_0x0065('0x23')]);_0x35722d[_0x0065('0x27')]=_[_0x0065('0x28')](_0x41d6f7[_0x0065('0x27')]);_0x35722d[_0x0065('0x29')]=_[_0x0065('0x2a')](_0x35722d['model'],_0x35722d[_0x0065('0x27')]);_0x32ab66['attributes']=_[_0x0065('0x2a')](_0x35722d['model'],qs[_0x0065('0x2b')](_0x41d6f7['query'][_0x0065('0x2b')]));_0x32ab66[_0x0065('0x2c')]=_0x32ab66[_0x0065('0x2c')]['length']?_0x32ab66['attributes']:_0x35722d[_0x0065('0x26')];if(_0x41d6f7[_0x0065('0x27')][_0x0065('0x40')]){_0x32ab66[_0x0065('0x3a')]=[{'all':!![]}];}_0x32ab66=_['merge']({},_0x32ab66,_0x41d6f7[_0x0065('0x38')]);return db[_0x0065('0x39')][_0x0065('0x41')](_0x32ab66)[_0x0065('0x20')](handleEntityNotFound(_0x26cef9,null))[_0x0065('0x20')](respondWithResult(_0x26cef9,null))['catch'](handleError(_0x26cef9,null));};exports[_0x0065('0x42')]=function(_0x5ef382,_0x339730){return db[_0x0065('0x39')][_0x0065('0x42')](_0x5ef382[_0x0065('0x43')],{})['then'](respondWithResult(_0x339730,0xc9))[_0x0065('0x3d')](handleError(_0x339730,null));};exports['update']=function(_0x86fa3d,_0x20b727){if(_0x86fa3d[_0x0065('0x43')]['id']){delete _0x86fa3d[_0x0065('0x43')]['id'];}return db[_0x0065('0x39')][_0x0065('0x41')]({'where':{'id':_0x86fa3d[_0x0065('0x3f')]['id']}})[_0x0065('0x20')](handleEntityNotFound(_0x20b727,null))[_0x0065('0x20')](saveUpdates(_0x86fa3d[_0x0065('0x43')],null))[_0x0065('0x20')](respondWithResult(_0x20b727,null))['catch'](handleError(_0x20b727,null));};exports[_0x0065('0x21')]=function(_0xcd7d13,_0x277b74){return db[_0x0065('0x39')][_0x0065('0x41')]({'where':{'id':_0xcd7d13[_0x0065('0x3f')]['id']}})[_0x0065('0x20')](handleEntityNotFound(_0x277b74,null))['then'](removeEntity(_0x277b74,null))['catch'](handleError(_0x277b74,null));};exports[_0x0065('0x44')]=function(_0x2da487,_0xf7e228){return db[_0x0065('0x39')][_0x0065('0x44')]()[_0x0065('0x20')](respondWithResult(_0xf7e228,null))[_0x0065('0x3d')](handleError(_0xf7e228,null));}; \ No newline at end of file +var _0x8a87=['name','send','index','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','params','ChatQueueReport','rawAttributes','options','find','catch','create','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x10ae6b,_0x3bf4a1){var _0x3838bb=function(_0x395dc5){while(--_0x395dc5){_0x10ae6b['push'](_0x10ae6b['shift']());}};_0x3838bb(++_0x3bf4a1);}(_0x8a87,0x6b));var _0x78a8=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x8a87[_0x4521e3];return _0x46a272;};'use strict';var emlformat=require(_0x78a8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x78a8('0x1'));var rp=require('request-promise');var moment=require(_0x78a8('0x2'));var BPromise=require(_0x78a8('0x3'));var Mustache=require(_0x78a8('0x4'));var util=require('util');var path=require(_0x78a8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x78a8('0x6'));var fs=require('fs');var fs_extra=require(_0x78a8('0x7'));var _=require(_0x78a8('0x8'));var squel=require(_0x78a8('0x9'));var crypto=require(_0x78a8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x78a8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x78a8('0xc'));var Papa=require('papaparse');var Redis=require(_0x78a8('0xd'));var authService=require(_0x78a8('0xe'));var qs=require(_0x78a8('0xf'));var as=require(_0x78a8('0x10'));var hardwareService=require(_0x78a8('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x78a8('0x12'));var config=require(_0x78a8('0x13'));var licenseUtil=require(_0x78a8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27d979,_0x40a9c9){_0x40a9c9=_0x40a9c9||0xcc;return function(_0x1276d4){if(_0x1276d4){return _0x27d979[_0x78a8('0x15')](_0x40a9c9);}return _0x27d979['status'](_0x40a9c9)[_0x78a8('0x16')]();};}function respondWithResult(_0x35b5ca,_0x30f579){_0x30f579=_0x30f579||0xc8;return function(_0x29dd7f){if(_0x29dd7f){return _0x35b5ca[_0x78a8('0x17')](_0x30f579)[_0x78a8('0x18')](_0x29dd7f);}};}function respondWithFilteredResult(_0x59c75e,_0x58a68b){return function(_0x556177){if(_0x556177){var _0x27d055=typeof _0x58a68b[_0x78a8('0x19')]===_0x78a8('0x1a')&&typeof _0x58a68b[_0x78a8('0x1b')]===_0x78a8('0x1a');var _0x5129bb=_0x556177['count'];var _0x958370=_0x27d055?0x0:_0x58a68b[_0x78a8('0x19')];var _0x4d6980=_0x27d055?_0x556177[_0x78a8('0x1c')]:_0x58a68b[_0x78a8('0x19')]+_0x58a68b['limit'];var _0x29cfbc;if(_0x4d6980>=_0x5129bb){_0x4d6980=_0x5129bb;_0x29cfbc=0xc8;}else{_0x29cfbc=0xce;}_0x59c75e['status'](_0x29cfbc);return _0x59c75e['set'](_0x78a8('0x1d'),_0x958370+'-'+_0x4d6980+'/'+_0x5129bb)[_0x78a8('0x18')](_0x556177);}return null;};}function patchUpdates(_0x14b31f){return function(_0x5e1d26){try{jsonpatch[_0x78a8('0x1e')](_0x5e1d26,_0x14b31f,!![]);}catch(_0x4be376){return BPromise['reject'](_0x4be376);}return _0x5e1d26[_0x78a8('0x1f')]();};}function saveUpdates(_0x429c9,_0x295c8f){return function(_0x257d3a){if(_0x257d3a){return _0x257d3a[_0x78a8('0x20')](_0x429c9)[_0x78a8('0x21')](function(_0x149adc){return _0x149adc;});}return null;};}function removeEntity(_0x4bcf27,_0x1834aa){return function(_0x5e5e22){if(_0x5e5e22){return _0x5e5e22[_0x78a8('0x22')]()[_0x78a8('0x21')](function(){_0x4bcf27[_0x78a8('0x17')](0xcc)[_0x78a8('0x16')]();});}};}function handleEntityNotFound(_0x2f12b0,_0x262dd6){return function(_0x2e8fa3){if(!_0x2e8fa3){_0x2f12b0[_0x78a8('0x15')](0x194);}return _0x2e8fa3;};}function handleError(_0x116253,_0x5bd96c){_0x5bd96c=_0x5bd96c||0x1f4;return function(_0x2c07a2){logger[_0x78a8('0x23')](_0x2c07a2[_0x78a8('0x24')]);if(_0x2c07a2[_0x78a8('0x25')]){delete _0x2c07a2['name'];}_0x116253[_0x78a8('0x17')](_0x5bd96c)[_0x78a8('0x26')](_0x2c07a2);};}exports[_0x78a8('0x27')]=function(_0x29f24b,_0x391530){var _0x5454aa={},_0x565d9c={},_0x118b8f={'count':0x0,'rows':[]};var _0x5a536e=_[_0x78a8('0x28')](db['ChatQueueReport']['rawAttributes'],function(_0x4e7aab){return{'name':_0x4e7aab['fieldName'],'type':_0x4e7aab[_0x78a8('0x29')][_0x78a8('0x2a')]};});_0x565d9c[_0x78a8('0x2b')]=_[_0x78a8('0x28')](_0x5a536e,_0x78a8('0x25'));_0x565d9c['query']=_[_0x78a8('0x2c')](_0x29f24b[_0x78a8('0x2d')]);_0x565d9c[_0x78a8('0x2e')]=_[_0x78a8('0x2f')](_0x565d9c[_0x78a8('0x2b')],_0x565d9c[_0x78a8('0x2d')]);_0x5454aa[_0x78a8('0x30')]=_[_0x78a8('0x2f')](_0x565d9c['model'],qs[_0x78a8('0x31')](_0x29f24b['query']['fields']));_0x5454aa[_0x78a8('0x30')]=_0x5454aa['attributes'][_0x78a8('0x32')]?_0x5454aa['attributes']:_0x565d9c[_0x78a8('0x2b')];if(!_0x29f24b[_0x78a8('0x2d')][_0x78a8('0x33')](_0x78a8('0x34'))){_0x5454aa[_0x78a8('0x1b')]=qs[_0x78a8('0x1b')](_0x29f24b[_0x78a8('0x2d')][_0x78a8('0x1b')]);_0x5454aa[_0x78a8('0x19')]=qs['offset'](_0x29f24b[_0x78a8('0x2d')][_0x78a8('0x19')]);}_0x5454aa[_0x78a8('0x35')]=qs[_0x78a8('0x36')](_0x29f24b[_0x78a8('0x2d')]['sort']);_0x5454aa['where']=qs[_0x78a8('0x2e')](_['pick'](_0x29f24b[_0x78a8('0x2d')],_0x565d9c[_0x78a8('0x2e')]),_0x5a536e);if(_0x29f24b[_0x78a8('0x2d')][_0x78a8('0x37')]){_0x5454aa[_0x78a8('0x38')]=_[_0x78a8('0x39')](_0x5454aa['where'],{'$or':_[_0x78a8('0x28')](_0x5a536e,function(_0x21b4a5){if(_0x21b4a5['type']!==_0x78a8('0x3a')){var _0xfe0029={};_0xfe0029[_0x21b4a5['name']]={'$like':'%'+_0x29f24b['query'][_0x78a8('0x37')]+'%'};return _0xfe0029;}})});}_0x5454aa=_[_0x78a8('0x39')]({},_0x5454aa,_0x29f24b['options']);var _0x1819d0={'where':_0x5454aa[_0x78a8('0x38')]};return db['ChatQueueReport']['count'](_0x1819d0)[_0x78a8('0x21')](function(_0x26395f){_0x118b8f[_0x78a8('0x1c')]=_0x26395f;if(_0x29f24b['query'][_0x78a8('0x3b')]){_0x5454aa[_0x78a8('0x3c')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x78a8('0x3d')](_0x5454aa);})[_0x78a8('0x21')](function(_0x2d0fe0){_0x118b8f['rows']=_0x2d0fe0;return _0x118b8f;})[_0x78a8('0x21')](respondWithFilteredResult(_0x391530,_0x5454aa))['catch'](handleError(_0x391530,null));};exports[_0x78a8('0x3e')]=function(_0x235624,_0x282e74){var _0x3e8c3d={'raw':!![],'where':{'id':_0x235624[_0x78a8('0x3f')]['id']}},_0x371d19={};_0x371d19[_0x78a8('0x2b')]=_[_0x78a8('0x2c')](db[_0x78a8('0x40')][_0x78a8('0x41')]);_0x371d19['query']=_[_0x78a8('0x2c')](_0x235624[_0x78a8('0x2d')]);_0x371d19[_0x78a8('0x2e')]=_['intersection'](_0x371d19['model'],_0x371d19[_0x78a8('0x2d')]);_0x3e8c3d[_0x78a8('0x30')]=_['intersection'](_0x371d19[_0x78a8('0x2b')],qs[_0x78a8('0x31')](_0x235624['query'][_0x78a8('0x31')]));_0x3e8c3d[_0x78a8('0x30')]=_0x3e8c3d['attributes']['length']?_0x3e8c3d[_0x78a8('0x30')]:_0x371d19[_0x78a8('0x2b')];if(_0x235624['query'][_0x78a8('0x3b')]){_0x3e8c3d['include']=[{'all':!![]}];}_0x3e8c3d=_[_0x78a8('0x39')]({},_0x3e8c3d,_0x235624[_0x78a8('0x42')]);return db[_0x78a8('0x40')][_0x78a8('0x43')](_0x3e8c3d)[_0x78a8('0x21')](handleEntityNotFound(_0x282e74,null))['then'](respondWithResult(_0x282e74,null))[_0x78a8('0x44')](handleError(_0x282e74,null));};exports[_0x78a8('0x45')]=function(_0x38f812,_0x53a3aa){return db[_0x78a8('0x40')][_0x78a8('0x45')](_0x38f812[_0x78a8('0x46')],{})[_0x78a8('0x21')](respondWithResult(_0x53a3aa,0xc9))[_0x78a8('0x44')](handleError(_0x53a3aa,null));};exports[_0x78a8('0x20')]=function(_0xd22dd3,_0x3b6cb7){if(_0xd22dd3['body']['id']){delete _0xd22dd3[_0x78a8('0x46')]['id'];}return db[_0x78a8('0x40')]['find']({'where':{'id':_0xd22dd3['params']['id']}})['then'](handleEntityNotFound(_0x3b6cb7,null))['then'](saveUpdates(_0xd22dd3[_0x78a8('0x46')],null))[_0x78a8('0x21')](respondWithResult(_0x3b6cb7,null))[_0x78a8('0x44')](handleError(_0x3b6cb7,null));};exports['destroy']=function(_0x9cfc96,_0x190d68){return db[_0x78a8('0x40')]['find']({'where':{'id':_0x9cfc96[_0x78a8('0x3f')]['id']}})['then'](handleEntityNotFound(_0x190d68,null))[_0x78a8('0x21')](removeEntity(_0x190d68,null))['catch'](handleError(_0x190d68,null));};exports[_0x78a8('0x47')]=function(_0x563f76,_0x1de362){return db[_0x78a8('0x40')][_0x78a8('0x47')]()[_0x78a8('0x21')](respondWithResult(_0x1de362,null))[_0x78a8('0x44')](handleError(_0x1de362,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 44840d8..0de6c86 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3fed95,_0x43ae94){var _0xdc4a03=function(_0x36183c){while(--_0x36183c){_0x3fed95['push'](_0x3fed95['shift']());}};_0xdc4a03(++_0x43ae94);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xb7e7[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_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 c376699..888205f 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 _0x86ea=['catch','update','where','attributes','limit','UpdateChatQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','ChatQueueReport,\x20%s,\x20%s','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify'];(function(_0x531c31,_0x30804e){var _0x234a39=function(_0x38f39f){while(--_0x38f39f){_0x531c31['push'](_0x531c31['shift']());}};_0x234a39(++_0x30804e);}(_0x86ea,0x187));var _0xa86e=function(_0xa9eb56,_0x4a86b1){_0xa9eb56=_0xa9eb56-0x0;var _0x3f53c9=_0x86ea[_0xa9eb56];return _0x3f53c9;};'use strict';var _=require(_0xa86e('0x0'));var util=require(_0xa86e('0x1'));var moment=require('moment');var BPromise=require(_0xa86e('0x2'));var rs=require(_0xa86e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa86e('0x4'))['db'];var utils=require(_0xa86e('0x5'));var logger=require(_0xa86e('0x6'))(_0xa86e('0x7'));var config=require(_0xa86e('0x8'));var jayson=require(_0xa86e('0x9'));var client=jayson[_0xa86e('0xa')][_0xa86e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1306c3,_0x2d2d0b,_0x508227){return new BPromise(function(_0x59b1a8,_0x1e87d7){return client[_0xa86e('0xc')](_0x1306c3,_0x508227)[_0xa86e('0xd')](function(_0xd716ad){logger[_0xa86e('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x2d2d0b,_0xa86e('0xf'));logger[_0xa86e('0x10')](_0xa86e('0x11'),_0x2d2d0b,_0xa86e('0xf'),JSON['stringify'](_0xd716ad));if(_0xd716ad['error']){if(_0xd716ad['error'][_0xa86e('0x12')]===0x1f4){logger[_0xa86e('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x2d2d0b,_0xd716ad[_0xa86e('0x13')][_0xa86e('0x14')]);return _0x1e87d7(_0xd716ad[_0xa86e('0x13')][_0xa86e('0x14')]);}logger[_0xa86e('0x13')](_0xa86e('0x15'),_0x2d2d0b,_0xd716ad['error'][_0xa86e('0x14')]);return _0x59b1a8(_0xd716ad[_0xa86e('0x13')]['message']);}else{logger[_0xa86e('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x2d2d0b,'request\x20sent');_0x59b1a8(_0xd716ad['result']['message']);}})['catch'](function(_0x2eeb83){logger[_0xa86e('0x13')](_0xa86e('0x15'),_0x2d2d0b,_0x2eeb83);_0x1e87d7(_0x2eeb83);});});}exports[_0xa86e('0x16')]=function(_0x133bf8){var _0x2f9ac6=this;return new Promise(function(_0x4321fe,_0xc30386){return db[_0xa86e('0x17')][_0xa86e('0x18')](_0x133bf8[_0xa86e('0x19')],{'raw':_0x133bf8[_0xa86e('0x1a')]?_0x133bf8[_0xa86e('0x1a')][_0xa86e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1001e5){logger[_0xa86e('0xe')](_0xa86e('0x16'),_0x133bf8);logger[_0xa86e('0x10')](_0xa86e('0x16'),_0x133bf8,JSON[_0xa86e('0x1c')](_0x1001e5));_0x4321fe(_0x1001e5);})[_0xa86e('0x1d')](function(_0x7bf7cf){logger['error']('CreateChatQueueReport',_0x7bf7cf['message'],_0x133bf8);_0xc30386(_0x2f9ac6[_0xa86e('0x13')](0x1f4,_0x7bf7cf[_0xa86e('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x5597b1){var _0x4cc784=this;return new Promise(function(_0x5f34dd,_0xf8d0d0){return db['ChatQueueReport'][_0xa86e('0x1e')](_0x5597b1[_0xa86e('0x19')],{'raw':_0x5597b1['options']?_0x5597b1['options'][_0xa86e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5597b1[_0xa86e('0x1a')]?_0x5597b1[_0xa86e('0x1a')][_0xa86e('0x1f')]||null:null,'attributes':_0x5597b1[_0xa86e('0x1a')]?_0x5597b1[_0xa86e('0x1a')][_0xa86e('0x20')]||null:null,'limit':_0x5597b1[_0xa86e('0x1a')]?_0x5597b1['options'][_0xa86e('0x21')]||null:null})[_0xa86e('0xd')](function(_0x5abf2e){logger[_0xa86e('0xe')](_0xa86e('0x22'),_0x5597b1);logger[_0xa86e('0x10')](_0xa86e('0x22'),_0x5597b1,JSON['stringify'](_0x5abf2e));_0x5f34dd(_0x5abf2e);})[_0xa86e('0x1d')](function(_0x24b712){logger[_0xa86e('0x13')](_0xa86e('0x22'),_0x24b712['message'],_0x5597b1);_0xf8d0d0(_0x4cc784['error'](0x1f4,_0x24b712['message']));});});}; \ No newline at end of file +var _0xb6a0=['http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','limit','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xb6a0,0xf0));var _0x0b6a=function(_0x196fb2,_0xe6ed5f){_0x196fb2=_0x196fb2-0x0;var _0x142a70=_0xb6a0[_0x196fb2];return _0x142a70;};'use strict';var _=require('lodash');var util=require(_0x0b6a('0x0'));var moment=require('moment');var BPromise=require(_0x0b6a('0x1'));var rs=require(_0x0b6a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b6a('0x3'))['db'];var utils=require(_0x0b6a('0x4'));var logger=require(_0x0b6a('0x5'))('rpc');var config=require(_0x0b6a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0b6a('0x7')][_0x0b6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x558f55,_0x5a4c9f,_0x18bc48){return new BPromise(function(_0x404669,_0x2a1210){return client[_0x0b6a('0x9')](_0x558f55,_0x18bc48)[_0x0b6a('0xa')](function(_0xd30f96){logger[_0x0b6a('0xb')](_0x0b6a('0xc'),_0x5a4c9f,_0x0b6a('0xd'));logger[_0x0b6a('0xe')](_0x0b6a('0xf'),_0x5a4c9f,_0x0b6a('0xd'),JSON[_0x0b6a('0x10')](_0xd30f96));if(_0xd30f96[_0x0b6a('0x11')]){if(_0xd30f96['error'][_0x0b6a('0x12')]===0x1f4){logger['error'](_0x0b6a('0xc'),_0x5a4c9f,_0xd30f96[_0x0b6a('0x11')][_0x0b6a('0x13')]);return _0x2a1210(_0xd30f96[_0x0b6a('0x11')]['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x5a4c9f,_0xd30f96['error'][_0x0b6a('0x13')]);return _0x404669(_0xd30f96[_0x0b6a('0x11')][_0x0b6a('0x13')]);}else{logger[_0x0b6a('0xb')](_0x0b6a('0xc'),_0x5a4c9f,_0x0b6a('0xd'));_0x404669(_0xd30f96[_0x0b6a('0x14')][_0x0b6a('0x13')]);}})[_0x0b6a('0x15')](function(_0x4765da){logger[_0x0b6a('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x5a4c9f,_0x4765da);_0x2a1210(_0x4765da);});});}exports[_0x0b6a('0x16')]=function(_0x14001b){var _0x470b0b=this;return new Promise(function(_0x3a9d69,_0x7345cb){return db[_0x0b6a('0x17')][_0x0b6a('0x18')](_0x14001b[_0x0b6a('0x19')],{'raw':_0x14001b[_0x0b6a('0x1a')]?_0x14001b[_0x0b6a('0x1a')][_0x0b6a('0x1b')]===undefined?!![]:![]:!![]})[_0x0b6a('0xa')](function(_0x51efca){logger['info'](_0x0b6a('0x16'),_0x14001b);logger[_0x0b6a('0xe')](_0x0b6a('0x16'),_0x14001b,JSON[_0x0b6a('0x10')](_0x51efca));_0x3a9d69(_0x51efca);})['catch'](function(_0x83a5dc){logger[_0x0b6a('0x11')](_0x0b6a('0x16'),_0x83a5dc['message'],_0x14001b);_0x7345cb(_0x470b0b[_0x0b6a('0x11')](0x1f4,_0x83a5dc[_0x0b6a('0x13')]));});});};exports[_0x0b6a('0x1c')]=function(_0x5795d3){var _0x32717e=this;return new Promise(function(_0xdf9490,_0x385e3e){return db['ChatQueueReport'][_0x0b6a('0x1d')](_0x5795d3[_0x0b6a('0x19')],{'raw':_0x5795d3['options']?_0x5795d3['options'][_0x0b6a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5795d3[_0x0b6a('0x1a')]?_0x5795d3['options']['where']||null:null,'attributes':_0x5795d3['options']?_0x5795d3[_0x0b6a('0x1a')]['attributes']||null:null,'limit':_0x5795d3[_0x0b6a('0x1a')]?_0x5795d3[_0x0b6a('0x1a')][_0x0b6a('0x1e')]||null:null})[_0x0b6a('0xa')](function(_0x4748f8){logger[_0x0b6a('0xb')](_0x0b6a('0x1c'),_0x5795d3);logger[_0x0b6a('0xe')]('UpdateChatQueueReport',_0x5795d3,JSON[_0x0b6a('0x10')](_0x4748f8));_0xdf9490(_0x4748f8);})[_0x0b6a('0x15')](function(_0x1ed33e){logger[_0x0b6a('0x11')](_0x0b6a('0x1c'),_0x1ed33e[_0x0b6a('0x13')],_0x5795d3);_0x385e3e(_0x32717e['error'](0x1f4,_0x1ed33e[_0x0b6a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index f1d9389..f1746cc 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 _0x3c5e=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x3c5e,0x182));var _0xe3c5=function(_0x2c6a99,_0x48ac51){_0x2c6a99=_0x2c6a99-0x0;var _0x26b56f=_0x3c5e[_0x2c6a99];return _0x26b56f;};'use strict';var multer=require(_0xe3c5('0x0'));var util=require('util');var path=require(_0xe3c5('0x1'));var timeout=require(_0xe3c5('0x2'));var express=require(_0xe3c5('0x3'));var router=express[_0xe3c5('0x4')]();var fs_extra=require(_0xe3c5('0x5'));var auth=require(_0xe3c5('0x6'));var interaction=require(_0xe3c5('0x7'));var config=require(_0xe3c5('0x8'));var controller=require('./chatQueueReport.controller');router[_0xe3c5('0x9')]('/',auth[_0xe3c5('0xa')](),controller['index']);router['get'](_0xe3c5('0xb'),auth[_0xe3c5('0xa')](),controller[_0xe3c5('0xc')]);router[_0xe3c5('0x9')](_0xe3c5('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe3c5('0xe')]);router[_0xe3c5('0xf')](_0xe3c5('0xd'),auth[_0xe3c5('0xa')](),controller[_0xe3c5('0x10')]);router[_0xe3c5('0x11')](_0xe3c5('0xd'),auth[_0xe3c5('0xa')](),controller[_0xe3c5('0x12')]);module[_0xe3c5('0x13')]=router; \ No newline at end of file +var _0xfb22=['index','/describe','describe','/:id','show','put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x13972c,_0x16ddf9){var _0x5d5d7e=function(_0x1f7073){while(--_0x1f7073){_0x13972c['push'](_0x13972c['shift']());}};_0x5d5d7e(++_0x16ddf9);}(_0xfb22,0x15e));var _0x2fb2=function(_0x352b44,_0x4a91a1){_0x352b44=_0x352b44-0x0;var _0x3e8baa=_0xfb22[_0x352b44];return _0x3e8baa;};'use strict';var multer=require(_0x2fb2('0x0'));var util=require(_0x2fb2('0x1'));var path=require(_0x2fb2('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fb2('0x3'));var router=express[_0x2fb2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2fb2('0x5'));var interaction=require(_0x2fb2('0x6'));var config=require(_0x2fb2('0x7'));var controller=require(_0x2fb2('0x8'));router[_0x2fb2('0x9')]('/',auth[_0x2fb2('0xa')](),controller[_0x2fb2('0xb')]);router[_0x2fb2('0x9')](_0x2fb2('0xc'),auth[_0x2fb2('0xa')](),controller[_0x2fb2('0xd')]);router[_0x2fb2('0x9')](_0x2fb2('0xe'),auth['isAuthenticated'](),controller[_0x2fb2('0xf')]);router['post']('/',auth[_0x2fb2('0xa')](),controller['create']);router[_0x2fb2('0x10')](_0x2fb2('0xe'),auth[_0x2fb2('0xa')](),controller[_0x2fb2('0x11')]);router['delete'](_0x2fb2('0xe'),auth[_0x2fb2('0xa')](),controller[_0x2fb2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 4ea4091..23c7aab 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2c1a6d,_0x47829c){_0x2c1a6d=_0x2c1a6d-0x0;var _0x22e8fd=_0x9bde[_0x2c1a6d];return _0x22e8fd;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2d99e9,_0x5b5af0){var _0x4b9d95=function(_0x3fdfc9){while(--_0x3fdfc9){_0x2d99e9['push'](_0x2d99e9['shift']());}};_0x4b9d95(++_0x5b5af0);}(_0xaa88,0x137));var _0x8aa8=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0xaa88[_0x170772];return _0x3ef69c;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index fb9d422..c5e69e5 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 _0x33f2=['../../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','name','send','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','type','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x17a773,_0x12f6da){var _0x58ba4f=function(_0x5c7bea){while(--_0x5c7bea){_0x17a773['push'](_0x17a773['shift']());}};_0x58ba4f(++_0x12f6da);}(_0x33f2,0x8a));var _0x233f=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0x33f2[_0x210d7f];return _0x42d687;};'use strict';var emlformat=require(_0x233f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x233f('0x1'));var rp=require(_0x233f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x233f('0x3'));var util=require(_0x233f('0x4'));var path=require(_0x233f('0x5'));var sox=require(_0x233f('0x6'));var csv=require(_0x233f('0x7'));var ejs=require(_0x233f('0x8'));var fs=require('fs');var fs_extra=require(_0x233f('0x9'));var _=require(_0x233f('0xa'));var squel=require('squel');var crypto=require(_0x233f('0xb'));var jsforce=require(_0x233f('0xc'));var deskjs=require(_0x233f('0xd'));var toCsv=require(_0x233f('0x7'));var querystring=require(_0x233f('0xe'));var Papa=require(_0x233f('0xf'));var Redis=require(_0x233f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x233f('0x11'));var as=require(_0x233f('0x12'));var hardwareService=require(_0x233f('0x13'));var logger=require(_0x233f('0x14'))(_0x233f('0x15'));var utils=require(_0x233f('0x16'));var config=require(_0x233f('0x17'));var licenseUtil=require(_0x233f('0x18'));var db=require(_0x233f('0x19'))['db'];function respondWithStatusCode(_0x1234d2,_0x280d76){_0x280d76=_0x280d76||0xcc;return function(_0x28e22a){if(_0x28e22a){return _0x1234d2['sendStatus'](_0x280d76);}return _0x1234d2[_0x233f('0x1a')](_0x280d76)[_0x233f('0x1b')]();};}function respondWithResult(_0x14b947,_0x5acde7){_0x5acde7=_0x5acde7||0xc8;return function(_0x4caf1b){if(_0x4caf1b){return _0x14b947[_0x233f('0x1a')](_0x5acde7)[_0x233f('0x1c')](_0x4caf1b);}};}function respondWithFilteredResult(_0x4558d9,_0x1e17dd){return function(_0x2ef214){if(_0x2ef214){var _0x581f80=typeof _0x1e17dd[_0x233f('0x1d')]===_0x233f('0x1e')&&typeof _0x1e17dd[_0x233f('0x1f')]===_0x233f('0x1e');var _0x3130bd=_0x2ef214[_0x233f('0x20')];var _0x31782d=_0x581f80?0x0:_0x1e17dd['offset'];var _0x2bca78=_0x581f80?_0x2ef214[_0x233f('0x20')]:_0x1e17dd[_0x233f('0x1d')]+_0x1e17dd[_0x233f('0x1f')];var _0x233dfd;if(_0x2bca78>=_0x3130bd){_0x2bca78=_0x3130bd;_0x233dfd=0xc8;}else{_0x233dfd=0xce;}_0x4558d9[_0x233f('0x1a')](_0x233dfd);return _0x4558d9[_0x233f('0x21')](_0x233f('0x22'),_0x31782d+'-'+_0x2bca78+'/'+_0x3130bd)[_0x233f('0x1c')](_0x2ef214);}return null;};}function patchUpdates(_0x1bf278){return function(_0x3b2add){try{jsonpatch[_0x233f('0x23')](_0x3b2add,_0x1bf278,!![]);}catch(_0x18dbc4){return BPromise[_0x233f('0x24')](_0x18dbc4);}return _0x3b2add[_0x233f('0x25')]();};}function saveUpdates(_0xb48225,_0x3c8ccf){return function(_0x2fcbea){if(_0x2fcbea){return _0x2fcbea[_0x233f('0x26')](_0xb48225)[_0x233f('0x27')](function(_0x565f74){return _0x565f74;});}return null;};}function removeEntity(_0x42baf7,_0x23181b){return function(_0x59c4b5){if(_0x59c4b5){return _0x59c4b5[_0x233f('0x28')]()[_0x233f('0x27')](function(){_0x42baf7[_0x233f('0x1a')](0xcc)[_0x233f('0x1b')]();});}};}function handleEntityNotFound(_0x552f66,_0x416639){return function(_0xc35bcc){if(!_0xc35bcc){_0x552f66[_0x233f('0x29')](0x194);}return _0xc35bcc;};}function handleError(_0x22e56b,_0x40f2e1){_0x40f2e1=_0x40f2e1||0x1f4;return function(_0xe8333e){logger['error'](_0xe8333e[_0x233f('0x2a')]);if(_0xe8333e['name']){delete _0xe8333e[_0x233f('0x2b')];}_0x22e56b[_0x233f('0x1a')](_0x40f2e1)[_0x233f('0x2c')](_0xe8333e);};}exports['index']=function(_0x1d118b,_0x3724c4){var _0x529717={},_0x290ff3={},_0x5e71b1={'count':0x0,'rows':[]};var _0x1fe785=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x23c78f){return{'name':_0x23c78f[_0x233f('0x2d')],'type':_0x23c78f['type'][_0x233f('0x2e')]};});_0x290ff3[_0x233f('0x2f')]=_['map'](_0x1fe785,_0x233f('0x2b'));_0x290ff3[_0x233f('0x30')]=_[_0x233f('0x31')](_0x1d118b['query']);_0x290ff3[_0x233f('0x32')]=_[_0x233f('0x33')](_0x290ff3[_0x233f('0x2f')],_0x290ff3[_0x233f('0x30')]);_0x529717[_0x233f('0x34')]=_[_0x233f('0x33')](_0x290ff3[_0x233f('0x2f')],qs[_0x233f('0x35')](_0x1d118b[_0x233f('0x30')][_0x233f('0x35')]));_0x529717[_0x233f('0x34')]=_0x529717[_0x233f('0x34')][_0x233f('0x36')]?_0x529717[_0x233f('0x34')]:_0x290ff3['model'];if(!_0x1d118b[_0x233f('0x30')][_0x233f('0x37')](_0x233f('0x38'))){_0x529717['limit']=qs[_0x233f('0x1f')](_0x1d118b['query'][_0x233f('0x1f')]);_0x529717['offset']=qs['offset'](_0x1d118b[_0x233f('0x30')][_0x233f('0x1d')]);}_0x529717['order']=qs[_0x233f('0x39')](_0x1d118b[_0x233f('0x30')][_0x233f('0x39')]);_0x529717[_0x233f('0x3a')]=qs[_0x233f('0x32')](_['pick'](_0x1d118b['query'],_0x290ff3[_0x233f('0x32')]),_0x1fe785);if(_0x1d118b[_0x233f('0x30')][_0x233f('0x3b')]){_0x529717[_0x233f('0x3a')]=_[_0x233f('0x3c')](_0x529717[_0x233f('0x3a')],{'$or':_[_0x233f('0x3d')](_0x1fe785,function(_0x3b521e){if(_0x3b521e[_0x233f('0x3e')]!==_0x233f('0x3f')){var _0x5a328a={};_0x5a328a[_0x3b521e['name']]={'$like':'%'+_0x1d118b[_0x233f('0x30')]['filter']+'%'};return _0x5a328a;}})});}_0x529717=_[_0x233f('0x3c')]({},_0x529717,_0x1d118b[_0x233f('0x40')]);var _0x7fcbe0={'where':_0x529717[_0x233f('0x3a')]};return db[_0x233f('0x41')]['count'](_0x7fcbe0)[_0x233f('0x27')](function(_0x3bd8a7){_0x5e71b1[_0x233f('0x20')]=_0x3bd8a7;if(_0x1d118b[_0x233f('0x30')][_0x233f('0x42')]){_0x529717[_0x233f('0x43')]=[{'all':!![]}];}return db[_0x233f('0x41')][_0x233f('0x44')](_0x529717);})[_0x233f('0x27')](function(_0x4f9f4b){_0x5e71b1[_0x233f('0x45')]=_0x4f9f4b;return _0x5e71b1;})[_0x233f('0x27')](respondWithFilteredResult(_0x3724c4,_0x529717))['catch'](handleError(_0x3724c4,null));};exports[_0x233f('0x46')]=function(_0x1b699e,_0xa6906b){var _0x1c5389={'raw':!![],'where':{'id':_0x1b699e[_0x233f('0x47')]['id']}},_0x1b5586={};_0x1b5586[_0x233f('0x2f')]=_[_0x233f('0x31')](db['ChatTransferReport'][_0x233f('0x48')]);_0x1b5586['query']=_[_0x233f('0x31')](_0x1b699e[_0x233f('0x30')]);_0x1b5586[_0x233f('0x32')]=_[_0x233f('0x33')](_0x1b5586[_0x233f('0x2f')],_0x1b5586['query']);_0x1c5389[_0x233f('0x34')]=_[_0x233f('0x33')](_0x1b5586[_0x233f('0x2f')],qs[_0x233f('0x35')](_0x1b699e['query'][_0x233f('0x35')]));_0x1c5389[_0x233f('0x34')]=_0x1c5389['attributes'][_0x233f('0x36')]?_0x1c5389[_0x233f('0x34')]:_0x1b5586['model'];if(_0x1b699e[_0x233f('0x30')][_0x233f('0x42')]){_0x1c5389[_0x233f('0x43')]=[{'all':!![]}];}_0x1c5389=_[_0x233f('0x3c')]({},_0x1c5389,_0x1b699e['options']);return db[_0x233f('0x41')][_0x233f('0x49')](_0x1c5389)['then'](handleEntityNotFound(_0xa6906b,null))[_0x233f('0x27')](respondWithResult(_0xa6906b,null))[_0x233f('0x4a')](handleError(_0xa6906b,null));};exports[_0x233f('0x4b')]=function(_0x4283da,_0x1d30d2){return db[_0x233f('0x41')][_0x233f('0x4b')](_0x4283da[_0x233f('0x4c')],{})[_0x233f('0x27')](respondWithResult(_0x1d30d2,0xc9))[_0x233f('0x4a')](handleError(_0x1d30d2,null));};exports[_0x233f('0x26')]=function(_0x4412ef,_0x18d12a){if(_0x4412ef['body']['id']){delete _0x4412ef['body']['id'];}return db['ChatTransferReport'][_0x233f('0x49')]({'where':{'id':_0x4412ef[_0x233f('0x47')]['id']}})[_0x233f('0x27')](handleEntityNotFound(_0x18d12a,null))[_0x233f('0x27')](saveUpdates(_0x4412ef[_0x233f('0x4c')],null))[_0x233f('0x27')](respondWithResult(_0x18d12a,null))[_0x233f('0x4a')](handleError(_0x18d12a,null));};exports[_0x233f('0x28')]=function(_0x34aaf0,_0x32eec8){return db[_0x233f('0x41')]['find']({'where':{'id':_0x34aaf0[_0x233f('0x47')]['id']}})[_0x233f('0x27')](handleEntityNotFound(_0x32eec8,null))[_0x233f('0x27')](removeEntity(_0x32eec8,null))[_0x233f('0x4a')](handleError(_0x32eec8,null));};exports[_0x233f('0x4d')]=function(_0x2d6231,_0x11c8c9){return db['ChatTransferReport'][_0x233f('0x4d')]()['then'](respondWithResult(_0x11c8c9,null))[_0x233f('0x4a')](handleError(_0x11c8c9,null));}; \ No newline at end of file +var _0x70a5=['undefined','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','ChatTransferReport','findAll','rows','catch','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','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','status','end'];(function(_0x5c20fd,_0x26463b){var _0x45cf09=function(_0x5294e9){while(--_0x5294e9){_0x5c20fd['push'](_0x5c20fd['shift']());}};_0x45cf09(++_0x26463b);}(_0x70a5,0x7b));var _0x570a=function(_0x1a6a02,_0x360521){_0x1a6a02=_0x1a6a02-0x0;var _0x34b1dc=_0x70a5[_0x1a6a02];return _0x34b1dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x570a('0x0'));var zipdir=require(_0x570a('0x1'));var jsonpatch=require(_0x570a('0x2'));var rp=require(_0x570a('0x3'));var moment=require('moment');var BPromise=require(_0x570a('0x4'));var Mustache=require(_0x570a('0x5'));var util=require(_0x570a('0x6'));var path=require(_0x570a('0x7'));var sox=require(_0x570a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x570a('0x9'));var _=require(_0x570a('0xa'));var squel=require('squel');var crypto=require(_0x570a('0xb'));var jsforce=require(_0x570a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x570a('0xd'));var querystring=require(_0x570a('0xe'));var Papa=require(_0x570a('0xf'));var Redis=require(_0x570a('0x10'));var authService=require(_0x570a('0x11'));var qs=require(_0x570a('0x12'));var as=require(_0x570a('0x13'));var hardwareService=require(_0x570a('0x14'));var logger=require('../../config/logger')(_0x570a('0x15'));var utils=require(_0x570a('0x16'));var config=require(_0x570a('0x17'));var licenseUtil=require(_0x570a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcafb61,_0x1403d8){_0x1403d8=_0x1403d8||0xcc;return function(_0x1d02e8){if(_0x1d02e8){return _0xcafb61['sendStatus'](_0x1403d8);}return _0xcafb61[_0x570a('0x19')](_0x1403d8)[_0x570a('0x1a')]();};}function respondWithResult(_0x1ce01b,_0x164d2e){_0x164d2e=_0x164d2e||0xc8;return function(_0x34e875){if(_0x34e875){return _0x1ce01b[_0x570a('0x19')](_0x164d2e)['json'](_0x34e875);}};}function respondWithFilteredResult(_0x773978,_0xcc7610){return function(_0x2eaa1f){if(_0x2eaa1f){var _0x2dd5cd=typeof _0xcc7610['offset']===_0x570a('0x1b')&&typeof _0xcc7610['limit']===_0x570a('0x1b');var _0x1a3bc6=_0x2eaa1f[_0x570a('0x1c')];var _0x1d3d98=_0x2dd5cd?0x0:_0xcc7610[_0x570a('0x1d')];var _0x1a89f8=_0x2dd5cd?_0x2eaa1f[_0x570a('0x1c')]:_0xcc7610[_0x570a('0x1d')]+_0xcc7610['limit'];var _0x46a9ce;if(_0x1a89f8>=_0x1a3bc6){_0x1a89f8=_0x1a3bc6;_0x46a9ce=0xc8;}else{_0x46a9ce=0xce;}_0x773978[_0x570a('0x19')](_0x46a9ce);return _0x773978['set'](_0x570a('0x1e'),_0x1d3d98+'-'+_0x1a89f8+'/'+_0x1a3bc6)[_0x570a('0x1f')](_0x2eaa1f);}return null;};}function patchUpdates(_0x3761eb){return function(_0x3673ce){try{jsonpatch[_0x570a('0x20')](_0x3673ce,_0x3761eb,!![]);}catch(_0x2c5aa1){return BPromise[_0x570a('0x21')](_0x2c5aa1);}return _0x3673ce[_0x570a('0x22')]();};}function saveUpdates(_0x293544,_0x40e75b){return function(_0x7cb61e){if(_0x7cb61e){return _0x7cb61e[_0x570a('0x23')](_0x293544)[_0x570a('0x24')](function(_0x55a3d4){return _0x55a3d4;});}return null;};}function removeEntity(_0x525799,_0x594a25){return function(_0x5c90cf){if(_0x5c90cf){return _0x5c90cf[_0x570a('0x25')]()[_0x570a('0x24')](function(){_0x525799[_0x570a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x79aef3,_0x1e7750){return function(_0x11c1e5){if(!_0x11c1e5){_0x79aef3[_0x570a('0x26')](0x194);}return _0x11c1e5;};}function handleError(_0xf83502,_0xe66f2c){_0xe66f2c=_0xe66f2c||0x1f4;return function(_0x4e5f1a){logger['error'](_0x4e5f1a['stack']);if(_0x4e5f1a['name']){delete _0x4e5f1a[_0x570a('0x27')];}_0xf83502[_0x570a('0x19')](_0xe66f2c)[_0x570a('0x28')](_0x4e5f1a);};}exports[_0x570a('0x29')]=function(_0x49d087,_0x1248e0){var _0x32334a={},_0x340c80={},_0x42a866={'count':0x0,'rows':[]};var _0x925a2a=_[_0x570a('0x2a')](db['ChatTransferReport'][_0x570a('0x2b')],function(_0x1f0a76){return{'name':_0x1f0a76[_0x570a('0x2c')],'type':_0x1f0a76['type']['key']};});_0x340c80[_0x570a('0x2d')]=_[_0x570a('0x2a')](_0x925a2a,_0x570a('0x27'));_0x340c80['query']=_[_0x570a('0x2e')](_0x49d087[_0x570a('0x2f')]);_0x340c80[_0x570a('0x30')]=_[_0x570a('0x31')](_0x340c80['model'],_0x340c80[_0x570a('0x2f')]);_0x32334a[_0x570a('0x32')]=_[_0x570a('0x31')](_0x340c80[_0x570a('0x2d')],qs[_0x570a('0x33')](_0x49d087[_0x570a('0x2f')][_0x570a('0x33')]));_0x32334a[_0x570a('0x32')]=_0x32334a[_0x570a('0x32')][_0x570a('0x34')]?_0x32334a[_0x570a('0x32')]:_0x340c80[_0x570a('0x2d')];if(!_0x49d087[_0x570a('0x2f')]['hasOwnProperty'](_0x570a('0x35'))){_0x32334a[_0x570a('0x36')]=qs['limit'](_0x49d087[_0x570a('0x2f')][_0x570a('0x36')]);_0x32334a[_0x570a('0x1d')]=qs['offset'](_0x49d087[_0x570a('0x2f')][_0x570a('0x1d')]);}_0x32334a[_0x570a('0x37')]=qs[_0x570a('0x38')](_0x49d087[_0x570a('0x2f')]['sort']);_0x32334a[_0x570a('0x39')]=qs[_0x570a('0x30')](_[_0x570a('0x3a')](_0x49d087[_0x570a('0x2f')],_0x340c80[_0x570a('0x30')]),_0x925a2a);if(_0x49d087[_0x570a('0x2f')][_0x570a('0x3b')]){_0x32334a[_0x570a('0x39')]=_[_0x570a('0x3c')](_0x32334a['where'],{'$or':_['map'](_0x925a2a,function(_0x1da7c9){if(_0x1da7c9[_0x570a('0x3d')]!==_0x570a('0x3e')){var _0x459b30={};_0x459b30[_0x1da7c9[_0x570a('0x27')]]={'$like':'%'+_0x49d087[_0x570a('0x2f')][_0x570a('0x3b')]+'%'};return _0x459b30;}})});}_0x32334a=_[_0x570a('0x3c')]({},_0x32334a,_0x49d087[_0x570a('0x3f')]);var _0x15f05d={'where':_0x32334a['where']};return db['ChatTransferReport'][_0x570a('0x1c')](_0x15f05d)[_0x570a('0x24')](function(_0x1c45a8){_0x42a866[_0x570a('0x1c')]=_0x1c45a8;if(_0x49d087[_0x570a('0x2f')][_0x570a('0x40')]){_0x32334a[_0x570a('0x41')]=[{'all':!![]}];}return db[_0x570a('0x42')][_0x570a('0x43')](_0x32334a);})[_0x570a('0x24')](function(_0xc532e1){_0x42a866[_0x570a('0x44')]=_0xc532e1;return _0x42a866;})[_0x570a('0x24')](respondWithFilteredResult(_0x1248e0,_0x32334a))[_0x570a('0x45')](handleError(_0x1248e0,null));};exports['show']=function(_0x3605c2,_0x4de68f){var _0x1a5a22={'raw':!![],'where':{'id':_0x3605c2[_0x570a('0x46')]['id']}},_0x2c4717={};_0x2c4717[_0x570a('0x2d')]=_[_0x570a('0x2e')](db[_0x570a('0x42')][_0x570a('0x2b')]);_0x2c4717[_0x570a('0x2f')]=_['keys'](_0x3605c2['query']);_0x2c4717['filters']=_[_0x570a('0x31')](_0x2c4717[_0x570a('0x2d')],_0x2c4717[_0x570a('0x2f')]);_0x1a5a22[_0x570a('0x32')]=_['intersection'](_0x2c4717[_0x570a('0x2d')],qs[_0x570a('0x33')](_0x3605c2['query'][_0x570a('0x33')]));_0x1a5a22[_0x570a('0x32')]=_0x1a5a22[_0x570a('0x32')][_0x570a('0x34')]?_0x1a5a22[_0x570a('0x32')]:_0x2c4717[_0x570a('0x2d')];if(_0x3605c2[_0x570a('0x2f')][_0x570a('0x40')]){_0x1a5a22[_0x570a('0x41')]=[{'all':!![]}];}_0x1a5a22=_[_0x570a('0x3c')]({},_0x1a5a22,_0x3605c2[_0x570a('0x3f')]);return db['ChatTransferReport']['find'](_0x1a5a22)[_0x570a('0x24')](handleEntityNotFound(_0x4de68f,null))['then'](respondWithResult(_0x4de68f,null))[_0x570a('0x45')](handleError(_0x4de68f,null));};exports[_0x570a('0x47')]=function(_0x310210,_0x3f6e40){return db[_0x570a('0x42')][_0x570a('0x47')](_0x310210['body'],{})[_0x570a('0x24')](respondWithResult(_0x3f6e40,0xc9))[_0x570a('0x45')](handleError(_0x3f6e40,null));};exports[_0x570a('0x23')]=function(_0x132b4d,_0x4598df){if(_0x132b4d[_0x570a('0x48')]['id']){delete _0x132b4d['body']['id'];}return db['ChatTransferReport'][_0x570a('0x49')]({'where':{'id':_0x132b4d[_0x570a('0x46')]['id']}})[_0x570a('0x24')](handleEntityNotFound(_0x4598df,null))[_0x570a('0x24')](saveUpdates(_0x132b4d[_0x570a('0x48')],null))[_0x570a('0x24')](respondWithResult(_0x4598df,null))[_0x570a('0x45')](handleError(_0x4598df,null));};exports[_0x570a('0x25')]=function(_0x35749,_0x392711){return db[_0x570a('0x42')][_0x570a('0x49')]({'where':{'id':_0x35749[_0x570a('0x46')]['id']}})[_0x570a('0x24')](handleEntityNotFound(_0x392711,null))[_0x570a('0x24')](removeEntity(_0x392711,null))[_0x570a('0x45')](handleError(_0x392711,null));};exports['describe']=function(_0x3865fc,_0x115682){return db[_0x570a('0x42')][_0x570a('0x4a')]()[_0x570a('0x24')](respondWithResult(_0x115682,null))['catch'](handleError(_0x115682,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 4d01206..798bd02 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 _0x24c0=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','./chatTransferReport.attributes','exports'];(function(_0x104b8e,_0x5729ba){var _0x4e9575=function(_0x394d0c){while(--_0x394d0c){_0x104b8e['push'](_0x104b8e['shift']());}};_0x4e9575(++_0x5729ba);}(_0x24c0,0x7b));var _0x024c=function(_0x30fc1f,_0x56890f){_0x30fc1f=_0x30fc1f-0x0;var _0x5b25ff=_0x24c0[_0x30fc1f];return _0x5b25ff;};'use strict';var _=require(_0x024c('0x0'));var util=require(_0x024c('0x1'));var logger=require(_0x024c('0x2'))(_0x024c('0x3'));var moment=require(_0x024c('0x4'));var BPromise=require(_0x024c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x024c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x024c('0x7'));module[_0x024c('0x8')]=function(_0x3395a3,_0x15617){return _0x3395a3['define'](_0x024c('0x9'),attributes,{'tableName':_0x024c('0xa'),'paranoid':![],'indexes':[{'name':_0x024c('0xb'),'fields':[_0x024c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa0f9=['path','rimraf','../../config/environment','./chatTransferReport.attributes','define','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xa0f9,0x12f));var _0x9a0f=function(_0x3aadde,_0x50f23f){_0x3aadde=_0x3aadde-0x0;var _0x21df4e=_0xa0f9[_0x3aadde];return _0x21df4e;};'use strict';var _=require(_0x9a0f('0x0'));var util=require(_0x9a0f('0x1'));var logger=require(_0x9a0f('0x2'))(_0x9a0f('0x3'));var moment=require('moment');var BPromise=require(_0x9a0f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a0f('0x5'));var rimraf=require(_0x9a0f('0x6'));var config=require(_0x9a0f('0x7'));var attributes=require(_0x9a0f('0x8'));module['exports']=function(_0x1690b8,_0x4e70bf){return _0x1690b8[_0x9a0f('0x9')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x9a0f('0xa'),'fields':[_0x9a0f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index b893644..73b93a8 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 _0x32a6=['client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x23a0db,_0x67ef5a){var _0x1b3e1f=function(_0xc15843){while(--_0xc15843){_0x23a0db['push'](_0x23a0db['shift']());}};_0x1b3e1f(++_0x67ef5a);}(_0x32a6,0x113));var _0x632a=function(_0x402231,_0x46a48b){_0x402231=_0x402231-0x0;var _0x208268=_0x32a6[_0x402231];return _0x208268;};'use strict';var _=require(_0x632a('0x0'));var util=require(_0x632a('0x1'));var moment=require('moment');var BPromise=require(_0x632a('0x2'));var rs=require(_0x632a('0x3'));var fs=require('fs');var Redis=require(_0x632a('0x4'));var db=require(_0x632a('0x5'))['db'];var utils=require(_0x632a('0x6'));var logger=require(_0x632a('0x7'))(_0x632a('0x8'));var config=require(_0x632a('0x9'));var jayson=require(_0x632a('0xa'));var client=jayson[_0x632a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34fb2a,_0x3ae652,_0x1cd592){return new BPromise(function(_0x3a3193,_0xc55839){return client[_0x632a('0xc')](_0x34fb2a,_0x1cd592)[_0x632a('0xd')](function(_0x3ef1f5){logger[_0x632a('0xe')](_0x632a('0xf'),_0x3ae652,_0x632a('0x10'));logger[_0x632a('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x3ae652,_0x632a('0x10'),JSON[_0x632a('0x12')](_0x3ef1f5));if(_0x3ef1f5[_0x632a('0x13')]){if(_0x3ef1f5[_0x632a('0x13')][_0x632a('0x14')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x3ae652,_0x3ef1f5[_0x632a('0x13')]['message']);return _0xc55839(_0x3ef1f5['error']['message']);}logger[_0x632a('0x13')](_0x632a('0xf'),_0x3ae652,_0x3ef1f5[_0x632a('0x13')][_0x632a('0x15')]);return _0x3a3193(_0x3ef1f5[_0x632a('0x13')][_0x632a('0x15')]);}else{logger[_0x632a('0xe')](_0x632a('0xf'),_0x3ae652,_0x632a('0x10'));_0x3a3193(_0x3ef1f5['result'][_0x632a('0x15')]);}})['catch'](function(_0x21321e){logger[_0x632a('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x3ae652,_0x21321e);_0xc55839(_0x21321e);});});} \ No newline at end of file +var _0x374b=['request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','ChatTransferReport,\x20%s,\x20%s'];(function(_0x77bffe,_0x5d9e28){var _0x220405=function(_0x450b9a){while(--_0x450b9a){_0x77bffe['push'](_0x77bffe['shift']());}};_0x220405(++_0x5d9e28);}(_0x374b,0xe6));var _0xb374=function(_0x51ae60,_0x6dd534){_0x51ae60=_0x51ae60-0x0;var _0x3154e4=_0x374b[_0x51ae60];return _0x3154e4;};'use strict';var _=require(_0xb374('0x0'));var util=require(_0xb374('0x1'));var moment=require('moment');var BPromise=require(_0xb374('0x2'));var rs=require(_0xb374('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb374('0x4'))['db'];var utils=require(_0xb374('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb374('0x6'));var jayson=require(_0xb374('0x7'));var client=jayson[_0xb374('0x8')][_0xb374('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f900b,_0x6104c2,_0xea72ad){return new BPromise(function(_0x4c3c6a,_0x19f135){return client['request'](_0x2f900b,_0xea72ad)[_0xb374('0xa')](function(_0x5889ba){logger['info'](_0xb374('0xb'),_0x6104c2,_0xb374('0xc'));logger[_0xb374('0xd')](_0xb374('0xe'),_0x6104c2,'request\x20sent',JSON[_0xb374('0xf')](_0x5889ba));if(_0x5889ba[_0xb374('0x10')]){if(_0x5889ba[_0xb374('0x10')][_0xb374('0x11')]===0x1f4){logger[_0xb374('0x10')](_0xb374('0xb'),_0x6104c2,_0x5889ba['error']['message']);return _0x19f135(_0x5889ba[_0xb374('0x10')][_0xb374('0x12')]);}logger['error'](_0xb374('0xb'),_0x6104c2,_0x5889ba[_0xb374('0x10')][_0xb374('0x12')]);return _0x4c3c6a(_0x5889ba[_0xb374('0x10')]['message']);}else{logger[_0xb374('0x13')](_0xb374('0xb'),_0x6104c2,_0xb374('0xc'));_0x4c3c6a(_0x5889ba[_0xb374('0x14')][_0xb374('0x12')]);}})[_0xb374('0x15')](function(_0x211e0a){logger[_0xb374('0x10')](_0xb374('0xb'),_0x6104c2,_0x211e0a);_0x19f135(_0x211e0a);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index a0e8110..d43eac1 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 _0x7fe3=['create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','post'];(function(_0xa522f,_0x5debbc){var _0x2083b0=function(_0x288f01){while(--_0x288f01){_0xa522f['push'](_0xa522f['shift']());}};_0x2083b0(++_0x5debbc);}(_0x7fe3,0x1bd));var _0x37fe=function(_0x2f197f,_0x521749){_0x2f197f=_0x2f197f-0x0;var _0x540fce=_0x7fe3[_0x2f197f];return _0x540fce;};'use strict';var multer=require(_0x37fe('0x0'));var util=require(_0x37fe('0x1'));var path=require(_0x37fe('0x2'));var timeout=require('connect-timeout');var express=require(_0x37fe('0x3'));var router=express[_0x37fe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x37fe('0x5'));var interaction=require(_0x37fe('0x6'));var config=require(_0x37fe('0x7'));var controller=require(_0x37fe('0x8'));router[_0x37fe('0x9')]('/',auth[_0x37fe('0xa')](),controller[_0x37fe('0xb')]);router[_0x37fe('0x9')]('/describe',auth[_0x37fe('0xa')](),controller[_0x37fe('0xc')]);router['get'](_0x37fe('0xd'),auth[_0x37fe('0xa')](),controller['show']);router[_0x37fe('0xe')]('/',auth[_0x37fe('0xa')](),controller[_0x37fe('0xf')]);router[_0x37fe('0x10')](_0x37fe('0xd'),auth[_0x37fe('0xa')](),controller['update']);router[_0x37fe('0x11')](_0x37fe('0xd'),auth['isAuthenticated'](),controller[_0x37fe('0x12')]);module[_0x37fe('0x13')]=router; \ No newline at end of file +var _0xd66c=['/describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get'];(function(_0x1f318d,_0x597fff){var _0x58a8f1=function(_0x262878){while(--_0x262878){_0x1f318d['push'](_0x1f318d['shift']());}};_0x58a8f1(++_0x597fff);}(_0xd66c,0x1d7));var _0xcd66=function(_0x45025f,_0x503c8f){_0x45025f=_0x45025f-0x0;var _0x422107=_0xd66c[_0x45025f];return _0x422107;};'use strict';var multer=require(_0xcd66('0x0'));var util=require(_0xcd66('0x1'));var path=require(_0xcd66('0x2'));var timeout=require(_0xcd66('0x3'));var express=require(_0xcd66('0x4'));var router=express[_0xcd66('0x5')]();var fs_extra=require(_0xcd66('0x6'));var auth=require(_0xcd66('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcd66('0x8'));var controller=require(_0xcd66('0x9'));router['get']('/',auth[_0xcd66('0xa')](),controller[_0xcd66('0xb')]);router[_0xcd66('0xc')](_0xcd66('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xcd66('0xc')]('/:id',auth[_0xcd66('0xa')](),controller[_0xcd66('0xe')]);router[_0xcd66('0xf')]('/',auth[_0xcd66('0xa')](),controller[_0xcd66('0x10')]);router['put'](_0xcd66('0x11'),auth['isAuthenticated'](),controller[_0xcd66('0x12')]);router[_0xcd66('0x13')](_0xcd66('0x11'),auth[_0xcd66('0xa')](),controller[_0xcd66('0x14')]);module[_0xcd66('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index fda23df..59e73b6 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 _0xb58b=['alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','ENUM','squared','rounded','We\x20are\x20here!','Chat','Contact\x20us','BOOLEAN','TEXT','Form\x20properly\x20submitted','Type\x20a\x20message','Skip','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT'];(function(_0x46c5db,_0xb68a07){var _0x3b6b37=function(_0x286424){while(--_0x286424){_0x46c5db['push'](_0x46c5db['shift']());}};_0x3b6b37(++_0xb68a07);}(_0xb58b,0x1f1));var _0xbb58=function(_0x409b7b,_0x1d5585){_0x409b7b=_0x409b7b-0x0;var _0x57eb7c=_0xb58b[_0x409b7b];return _0x57eb7c;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xbb58('0x0'));module[_0xbb58('0x1')]={'name':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbb58('0x3')},'description':{'type':Sequelize[_0xbb58('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x4')},'key':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbb58('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbb58('0x8')]('rounded',_0xbb58('0x9')),'defaultValue':_0xbb58('0xa')},'header_online':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0xc')},'offline_chat_button':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0xd')},'download_transcript':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xbb58('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x11')},'closingMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x12')},'conditionAgreement':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xbb58('0x8')](_0xbb58('0x13'),_0xbb58('0x14')),'defaultValue':_0xbb58('0x13')},'ratingStarsNumber':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':function(){return JSON[_0xbb58('0x15')]({'items':[{'type':_0xbb58('0x16'),'variable':null,'config':{'placeholder':_0xbb58('0x17'),'type':'text','required':!![]},'props':{'title':_0xbb58('0x17'),'helpText':''}},{'type':'input','props':{'title':_0xbb58('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbb58('0x4'),'type':_0xbb58('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbb58('0x18')](_0xbb58('0x19'))?JSON[_0xbb58('0x1a')](this[_0xbb58('0x18')](_0xbb58('0x19'))):{};},'set':function(_0x4e0303){return this[_0xbb58('0x1b')](_0xbb58('0x19'),JSON[_0xbb58('0x15')](_0x4e0303));}},'offlineForm':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':function(){return JSON[_0xbb58('0x15')]({'items':[{'type':_0xbb58('0x16'),'props':{'title':_0xbb58('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbb58('0x4'),'type':_0xbb58('0x4')},'variable':null},{'type':_0xbb58('0x1c'),'config':{'placeholder':_0xbb58('0x1d')},'props':{'title':_0xbb58('0x1d'),'helpText':_0xbb58('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0xbb58('0x18')](_0xbb58('0x1f'))?JSON['parse'](this[_0xbb58('0x18')](_0xbb58('0x1f'))):{};},'set':function(_0x12b3eb){return this[_0xbb58('0x1b')](_0xbb58('0x1f'),JSON[_0xbb58('0x15')](_0x12b3eb));}},'token':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':function(){return rs[_0xbb58('0x20')]();}},'autoclose':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbb58('0x2')]},'forwardOffline':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbb58('0x2')]},'waitingTitle':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x21')},'waitingMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x22')},'offlineMessageSubject':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x23')},'offlineMessageBody':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x12')},'sendUnmanaged':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x25')},'enableCustomerAttachment':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbb58('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbb58('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbb58('0x26');}},'notificationSound':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x27')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x29')},'messagesAlignment':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x2a')},'defaultTitle':{'type':Sequelize[_0xbb58('0x2')]},'customerAvatar':{'type':Sequelize[_0xbb58('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbb58('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb58('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xbb58('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb58('0x7')],'comment':_0xbb58('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xc29171){if(!_0xc29171)this[_0xbb58('0x1b')](_0xbb58('0x2d'),null);this[_0xbb58('0x1b')](_0xbb58('0x2e'),_0xc29171);}},'vidaooEscalation':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x2f')},'vidaooNote':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':function(){return _0xbb58('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9bde=['setDataValue','stringify','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','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','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','INTEGER','input','text','name','getDataValue','onlineForm','parse'];(function(_0x520085,_0x5d83ef){var _0x5da934=function(_0x242468){while(--_0x242468){_0x520085['push'](_0x520085['shift']());}};_0x5da934(++_0x5d83ef);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2510e8,_0x49b9e1){_0x2510e8=_0x2510e8-0x0;var _0x56f17e=_0x9bde[_0x2510e8];return _0x56f17e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe9bd('0x0'));module['exports']={'name':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe9bd('0x2')},'description':{'type':Sequelize[_0xe9bd('0x1')]},'mapKey':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0x3')},'mapKeyOffline':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0x3')},'key':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xe9bd('0x4')},'customerAlias':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![],'defaultValue':_0xe9bd('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![],'defaultValue':_0xe9bd('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![],'defaultValue':_0xe9bd('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![],'defaultValue':_0xe9bd('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xe9bd('0x8')](_0xe9bd('0x9'),'squared'),'defaultValue':_0xe9bd('0x9')},'header_online':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0xa')},'start_chat_button':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0xb')},'download_transcript':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xe9bd('0xc')},'defaultWhiteLabel':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xe9bd('0xd')]},'closingQuestion':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0xf')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe9bd('0x10')},'noteTitle':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe9bd('0x12')},'closingMessage':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0x13')},'closingMessageButton':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0x14')},'ratingType':{'type':Sequelize[_0xe9bd('0x8')](_0xe9bd('0x15'),_0xe9bd('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xe9bd('0x17')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xe9bd('0xd')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xe9bd('0x18'),'variable':null,'config':{'placeholder':'name','type':_0xe9bd('0x19'),'required':!![]},'props':{'title':_0xe9bd('0x1a'),'helpText':''}},{'type':_0xe9bd('0x18'),'props':{'title':_0xe9bd('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xe9bd('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe9bd('0x1b')](_0xe9bd('0x1c'))?JSON[_0xe9bd('0x1d')](this[_0xe9bd('0x1b')](_0xe9bd('0x1c'))):{};},'set':function(_0x399f3c){return this[_0xe9bd('0x1e')](_0xe9bd('0x1c'),JSON['stringify'](_0x399f3c));}},'offlineForm':{'type':Sequelize[_0xe9bd('0xd')],'defaultValue':function(){return JSON[_0xe9bd('0x1f')]({'items':[{'type':'input','props':{'title':_0xe9bd('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xe9bd('0x3'),'type':_0xe9bd('0x3')},'variable':null},{'type':_0xe9bd('0x20'),'config':{'placeholder':_0xe9bd('0x21')},'props':{'title':_0xe9bd('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xe9bd('0x22'))?JSON['parse'](this[_0xe9bd('0x1b')](_0xe9bd('0x22'))):{};},'set':function(_0x27f80c){return this[_0xe9bd('0x1e')](_0xe9bd('0x22'),JSON['stringify'](_0x27f80c));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe9bd('0x23')]();}},'autoclose':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xe9bd('0x1')]},'forwardOffline':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xe9bd('0x1')]},'waitingTitle':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe9bd('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0x27')},'skipUnmanaged':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0x28')},'sendUnmanaged':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0x29')},'enableCustomerAttachment':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xe9bd('0xd')]},'showAgentAvatar':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xe9bd('0x1')]},'notificationTemplate':{'type':Sequelize[_0xe9bd('0xd')],'defaultValue':function(){return _0xe9bd('0x2a');}},'notificationSound':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xe9bd('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xe9bd('0x17')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xe9bd('0x2b')},'defaultTitle':{'type':Sequelize[_0xe9bd('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xe9bd('0x17')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe9bd('0x17')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xe9bd('0x1')],'defaultValue':_0xe9bd('0x2c')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe9bd('0x17')],'comment':_0xe9bd('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![],'comment':_0xe9bd('0x2e'),'set':function(_0x253359){if(!_0x253359)this[_0xe9bd('0x1e')](_0xe9bd('0x2f'),null);this[_0xe9bd('0x1e')](_0xe9bd('0x30'),_0x253359);}},'vidaooEscalation':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe9bd('0x31')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xe9bd('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xe9bd('0xd')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xe9bd('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index aa968f2..3273bd1 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 _0xa530=['increment','all','some','URL','origin','3.1.0','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','color_button','hideWhenOffline','IntervalId','READ_COMMITTED','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getProactiveActions','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','url','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','update','destroy','get','stack','name','send','index','Pause','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ChatWebsite','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','find','create','body','user','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','Disposition','getDispositions','findOne','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sitepic','agentAvatar','addCustomerAvatar','filename','addSystemAvatar','systemAvatar','file','getLogo','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','join','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','updatedAt','DESC','ChatApplication','Applications','List','account','applications','list','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','ListId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','server','files','attachments','offline-chat','basename','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','../../config/license/util','virtual','License'];(function(_0x2171c4,_0x3e59c8){var _0x9bed4e=function(_0x568206){while(--_0x568206){_0x2171c4['push'](_0x2171c4['shift']());}};_0x9bed4e(++_0x3e59c8);}(_0xa530,0x150));var _0x0a53=function(_0x3640e2,_0x562103){_0x3640e2=_0x3640e2-0x0;var _0x277415=_0xa530[_0x3640e2];return _0x277415;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x0a53('0x0'));var util=require(_0x0a53('0x1'));var path=require(_0x0a53('0x2'));var ejs=require(_0x0a53('0x3'));var fs=require('fs');var fs_extra=require(_0x0a53('0x4'));var _=require(_0x0a53('0x5'));var querystring=require(_0x0a53('0x6'));var Redis=require(_0x0a53('0x7'));var qs=require(_0x0a53('0x8'));var logger=require(_0x0a53('0x9'))('api');var config=require('../../config/environment');var url=require(_0x0a53('0xa'));var db=require(_0x0a53('0xb'))['db'];config[_0x0a53('0xc')]=_[_0x0a53('0xd')](config[_0x0a53('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a53('0xe'))(new Redis(config[_0x0a53('0xc')]));require(_0x0a53('0xf'))['register'](socket);var htmlToText=require(_0x0a53('0x10'));var jayson=require(_0x0a53('0x11'));var client=jayson[_0x0a53('0x12')][_0x0a53('0x13')]({'port':0x232c});var client9002=jayson[_0x0a53('0x12')][_0x0a53('0x13')]({'port':0x232a});var client9003=jayson['client'][_0x0a53('0x13')]({'port':0x232b});var client9001=jayson['client'][_0x0a53('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x2f2878,_0x3dd1f2,_0x320b63,_0x2d6c2c){return new BPromise(function(_0x1597d1,_0x12cd83){var _0x42acca=_0x2d6c2c||client;return _0x42acca['request'](_0x2f2878,_0x320b63)[_0x0a53('0x14')](function(_0x6a5c04){logger['info'](_0x0a53('0x15'),_0x3dd1f2,_0x0a53('0x16'));logger['debug'](_0x0a53('0x17'),_0x3dd1f2,'request\x20sent',JSON['stringify'](_0x6a5c04));if(_0x6a5c04[_0x0a53('0x18')]){if(_0x6a5c04[_0x0a53('0x18')][_0x0a53('0x19')]===0x1f4){logger[_0x0a53('0x18')](_0x0a53('0x15'),_0x3dd1f2,_0x6a5c04[_0x0a53('0x18')][_0x0a53('0x1a')]);return _0x12cd83(_0x6a5c04[_0x0a53('0x18')][_0x0a53('0x1a')]);}logger[_0x0a53('0x18')](_0x0a53('0x15'),_0x3dd1f2,_0x6a5c04['error'][_0x0a53('0x1a')]);return _0x1597d1(_0x6a5c04[_0x0a53('0x18')][_0x0a53('0x1a')]);}else{logger[_0x0a53('0x1b')](_0x0a53('0x15'),_0x3dd1f2,_0x0a53('0x16'));_0x1597d1(_0x6a5c04[_0x0a53('0x1c')][_0x0a53('0x1a')]);}})[_0x0a53('0x1d')](function(_0x4b5172){logger[_0x0a53('0x18')](_0x0a53('0x15'),_0x3dd1f2,_0x4b5172);_0x12cd83(_0x4b5172);});});}function respondWithStatusCode(_0x2d46de,_0x233b33){_0x233b33=_0x233b33||0xcc;return function(_0x440ba8){if(_0x440ba8){return _0x2d46de[_0x0a53('0x1e')](_0x233b33);}return _0x2d46de[_0x0a53('0x1f')](_0x233b33)[_0x0a53('0x20')]();};}function respondWithResult(_0x1b88bd,_0xc2917d){_0xc2917d=_0xc2917d||0xc8;return function(_0x3ffc52){if(_0x3ffc52){return _0x1b88bd[_0x0a53('0x1f')](_0xc2917d)[_0x0a53('0x21')](_0x3ffc52);}};}function respondWithFilteredResult(_0x1aacaf,_0x29fa2a){return function(_0x250713){if(_0x250713){var _0x5854f8=typeof _0x29fa2a['offset']==='undefined'&&typeof _0x29fa2a[_0x0a53('0x22')]===_0x0a53('0x23');var _0x38dfa2=_0x250713['count'];var _0x57c1f8=_0x5854f8?0x0:_0x29fa2a['offset'];var _0x4d99a6=_0x5854f8?_0x250713[_0x0a53('0x24')]:_0x29fa2a[_0x0a53('0x25')]+_0x29fa2a[_0x0a53('0x22')];var _0x465417;if(_0x4d99a6>=_0x38dfa2){_0x4d99a6=_0x38dfa2;_0x465417=0xc8;}else{_0x465417=0xce;}_0x1aacaf[_0x0a53('0x1f')](_0x465417);return _0x1aacaf[_0x0a53('0x26')](_0x0a53('0x27'),_0x57c1f8+'-'+_0x4d99a6+'/'+_0x38dfa2)[_0x0a53('0x21')](_0x250713);}return null;};}function saveUpdates(_0x4396a2){return function(_0x500a91){if(_0x500a91){return _0x500a91[_0x0a53('0x28')](_0x4396a2)['then'](function(_0x422b0f){return _0x422b0f;});}return null;};}function removeEntity(_0x271bd8){return function(_0x5b456a){if(_0x5b456a){return _0x5b456a[_0x0a53('0x29')]()[_0x0a53('0x14')](function(){var _0x111058=_0x5b456a[_0x0a53('0x2a')]({'plain':!![]});var _0x4f5135='ChatWebsites';return db['UserProfileResource'][_0x0a53('0x29')]({'where':{'type':_0x4f5135,'resourceId':_0x111058['id']}})['then'](function(){return _0x5b456a;});})[_0x0a53('0x14')](function(){_0x271bd8['status'](0xcc)[_0x0a53('0x20')]();});}};}function handleEntityNotFound(_0x5aff73){return function(_0x4010a6){if(!_0x4010a6){_0x5aff73['sendStatus'](0x194);}return _0x4010a6;};}function handleError(_0x1e33c3,_0x2c6d25){_0x2c6d25=_0x2c6d25||0x1f4;return function(_0x3c98f5){logger['error'](_0x3c98f5[_0x0a53('0x2b')]);if(_0x3c98f5[_0x0a53('0x2c')]){delete _0x3c98f5['name'];}_0x1e33c3[_0x0a53('0x1f')](_0x2c6d25)[_0x0a53('0x2d')](_0x3c98f5);};}exports[_0x0a53('0x2e')]=function(_0x14c600,_0x20f7c1){var _0xc1a6b6={'include':[{'model':db[_0x0a53('0x2f')],'as':'mandatoryDispositionPause'}]},_0xc5cb20={},_0x5745ae={'count':0x0,'rows':[]};var _0x46193b=_[_0x0a53('0x30')](db['ChatWebsite']['rawAttributes'],function(_0x2cf6d5){return{'name':_0x2cf6d5[_0x0a53('0x31')],'type':_0x2cf6d5[_0x0a53('0x32')]['key']};});_0xc5cb20[_0x0a53('0x33')]=_['map'](_0x46193b,_0x0a53('0x2c'));_0xc5cb20[_0x0a53('0x34')]=_[_0x0a53('0x35')](_0x14c600['query']);_0xc5cb20[_0x0a53('0x36')]=_['intersection'](_0xc5cb20[_0x0a53('0x33')],_0xc5cb20[_0x0a53('0x34')]);_0xc1a6b6[_0x0a53('0x37')]=_[_0x0a53('0x38')](_0xc5cb20[_0x0a53('0x33')],qs['fields'](_0x14c600['query'][_0x0a53('0x39')]));_0xc1a6b6[_0x0a53('0x37')]=_0xc1a6b6[_0x0a53('0x37')][_0x0a53('0x3a')]?_0xc1a6b6[_0x0a53('0x37')]:_0xc5cb20['model'];if(!_0x14c600[_0x0a53('0x34')][_0x0a53('0x3b')](_0x0a53('0x3c'))){_0xc1a6b6[_0x0a53('0x22')]=qs[_0x0a53('0x22')](_0x14c600[_0x0a53('0x34')][_0x0a53('0x22')]);_0xc1a6b6[_0x0a53('0x25')]=qs[_0x0a53('0x25')](_0x14c600[_0x0a53('0x34')]['offset']);}_0xc1a6b6[_0x0a53('0x3d')]=qs['sort'](_0x14c600[_0x0a53('0x34')][_0x0a53('0x3e')]);_0xc1a6b6[_0x0a53('0x3f')]=qs[_0x0a53('0x36')](_[_0x0a53('0x40')](_0x14c600[_0x0a53('0x34')],_0xc5cb20[_0x0a53('0x36')]),_0x46193b);if(_0x14c600[_0x0a53('0x34')][_0x0a53('0x41')]){_0xc1a6b6[_0x0a53('0x3f')]=_[_0x0a53('0x42')](_0xc1a6b6[_0x0a53('0x3f')],{'$or':_[_0x0a53('0x30')](_0x46193b,function(_0x467da6){if(_0x467da6[_0x0a53('0x32')]!=='VIRTUAL'){var _0x2013fa={};_0x2013fa[_0x467da6['name']]={'$like':'%'+_0x14c600[_0x0a53('0x34')][_0x0a53('0x41')]+'%'};return _0x2013fa;}})});}_0xc1a6b6=_[_0x0a53('0x42')]({},_0xc1a6b6,_0x14c600[_0x0a53('0x43')]);var _0x36b851={'where':_0xc1a6b6[_0x0a53('0x3f')]};return db[_0x0a53('0x44')]['count'](_0x36b851)[_0x0a53('0x14')](function(_0xf38e94){_0x5745ae[_0x0a53('0x24')]=_0xf38e94;if(_0x14c600['query'][_0x0a53('0x45')]){_0xc1a6b6[_0x0a53('0x46')]=[{'all':!![]}];}return db['ChatWebsite'][_0x0a53('0x47')](_0xc1a6b6);})[_0x0a53('0x14')](function(_0x33323e){_0x5745ae[_0x0a53('0x48')]=_0x33323e;return _0x5745ae;})[_0x0a53('0x14')](respondWithFilteredResult(_0x20f7c1,_0xc1a6b6))[_0x0a53('0x1d')](handleError(_0x20f7c1,null));};exports[_0x0a53('0x49')]=function(_0xfcd6a5,_0x205b98){var _0x4136c6={'raw':![],'where':{'id':_0xfcd6a5[_0x0a53('0x4a')]['id']},'include':[{'model':db[_0x0a53('0x2f')],'as':_0x0a53('0x4b')}]},_0x293904={};_0x293904[_0x0a53('0x33')]=_[_0x0a53('0x35')](db['ChatWebsite'][_0x0a53('0x4c')]);_0x293904[_0x0a53('0x34')]=_[_0x0a53('0x35')](_0xfcd6a5['query']);_0x293904['filters']=_['intersection'](_0x293904[_0x0a53('0x33')],_0x293904[_0x0a53('0x34')]);_0x4136c6[_0x0a53('0x37')]=_[_0x0a53('0x38')](_0x293904[_0x0a53('0x33')],qs['fields'](_0xfcd6a5[_0x0a53('0x34')][_0x0a53('0x39')]));_0x4136c6['attributes']=_0x4136c6[_0x0a53('0x37')]['length']?_0x4136c6['attributes']:_0x293904[_0x0a53('0x33')];if(_0xfcd6a5['query'][_0x0a53('0x45')]){_0x4136c6[_0x0a53('0x46')]=[{'all':!![]}];}_0x4136c6=_[_0x0a53('0x42')]({},_0x4136c6,_0xfcd6a5[_0x0a53('0x43')]);return db[_0x0a53('0x44')][_0x0a53('0x4d')](_0x4136c6)[_0x0a53('0x14')](handleEntityNotFound(_0x205b98,null))[_0x0a53('0x14')](respondWithResult(_0x205b98,null))[_0x0a53('0x1d')](handleError(_0x205b98,null));};exports[_0x0a53('0x4e')]=function(_0x3a7c08,_0x184eef){return db[_0x0a53('0x44')][_0x0a53('0x4e')](_0x3a7c08[_0x0a53('0x4f')],{})[_0x0a53('0x14')](function(_0x4e9ebb){var _0x14054c=_0x3a7c08['user']['get']({'plain':!![]});if(!_0x14054c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14054c['role']===_0x0a53('0x50')){var _0x45837f=_0x4e9ebb[_0x0a53('0x2a')]({'plain':!![]});var _0xbfd80a=_0x0a53('0x51');return db[_0x0a53('0x52')]['find']({'where':{'name':_0xbfd80a,'userProfileId':_0x14054c[_0x0a53('0x53')]},'raw':!![]})[_0x0a53('0x14')](function(_0x4a3607){if(_0x4a3607&&_0x4a3607[_0x0a53('0x54')]===0x0){return db[_0x0a53('0x55')]['create']({'name':_0x45837f[_0x0a53('0x2c')],'resourceId':_0x45837f['id'],'type':_0x4a3607[_0x0a53('0x2c')],'sectionId':_0x4a3607['id']},{})['then'](function(){return _0x4e9ebb;});}else{return _0x4e9ebb;}})[_0x0a53('0x1d')](function(_0x3b4e62){logger[_0x0a53('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b4e62);throw _0x3b4e62;});}return _0x4e9ebb;})[_0x0a53('0x14')](respondWithResult(_0x184eef,0xc9))['catch'](handleError(_0x184eef,null));};exports[_0x0a53('0x28')]=function(_0x53b0ac,_0x44c4b2){if(_0x53b0ac[_0x0a53('0x4f')]['id']){delete _0x53b0ac['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x53b0ac[_0x0a53('0x4a')]['id']},'include':[{'model':db[_0x0a53('0x2f')],'as':_0x0a53('0x4b')}]})[_0x0a53('0x14')](handleEntityNotFound(_0x44c4b2,null))[_0x0a53('0x14')](saveUpdates(_0x53b0ac[_0x0a53('0x4f')],null))[_0x0a53('0x14')](respondWithResult(_0x44c4b2,null))['catch'](handleError(_0x44c4b2,null));};exports[_0x0a53('0x29')]=function(_0x1762e9,_0x2e2f0e){return db[_0x0a53('0x44')]['find']({'where':{'id':_0x1762e9[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x2e2f0e,null))[_0x0a53('0x14')](removeEntity(_0x2e2f0e,null))[_0x0a53('0x1d')](handleError(_0x2e2f0e,null));};exports[_0x0a53('0x56')]=function(_0x43cfe3,_0xc045b0){return db['ChatWebsite']['describe']()[_0x0a53('0x14')](respondWithResult(_0xc045b0,null))[_0x0a53('0x1d')](handleError(_0xc045b0,null));};exports[_0x0a53('0x57')]=function(_0x1f1b59,_0xc2e7dd){if(_0x1f1b59['body']['id']){delete _0x1f1b59[_0x0a53('0x4f')]['id'];}return db[_0x0a53('0x44')][_0x0a53('0x4d')]({'where':{'id':_0x1f1b59[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0xc2e7dd,null))['then'](function(_0x3c98f3){if(_0x3c98f3){_0x1f1b59[_0x0a53('0x4f')]['ChatWebsiteId']=_0x3c98f3['id'];return db[_0x0a53('0x58')][_0x0a53('0x4e')](_0x1f1b59[_0x0a53('0x4f')]);}})[_0x0a53('0x14')](respondWithResult(_0xc2e7dd,null))['catch'](handleError(_0xc2e7dd,null));};exports[_0x0a53('0x59')]=function(_0x8e02a7,_0xb121ff){var _0x53f502={'raw':![],'where':{}};var _0x23f5e0={};var _0x55b9a3={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0a53('0x5a')]({'where':{'id':_0x8e02a7[_0x0a53('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb121ff,null))[_0x0a53('0x14')](function(_0x356ac0){if(_0x356ac0){_0x23f5e0['model']=_[_0x0a53('0x35')](db[_0x0a53('0x58')][_0x0a53('0x4c')]);_0x23f5e0[_0x0a53('0x34')]=_[_0x0a53('0x35')](_0x8e02a7[_0x0a53('0x34')]);_0x23f5e0[_0x0a53('0x36')]=_['intersection'](_0x23f5e0[_0x0a53('0x33')],_0x23f5e0[_0x0a53('0x34')]);_0x53f502['attributes']=_[_0x0a53('0x38')](_0x23f5e0[_0x0a53('0x33')],qs[_0x0a53('0x39')](_0x8e02a7[_0x0a53('0x34')][_0x0a53('0x39')]));_0x53f502[_0x0a53('0x37')]=_0x53f502['attributes'][_0x0a53('0x3a')]?_0x53f502[_0x0a53('0x37')]:_0x23f5e0[_0x0a53('0x33')];if(!_0x8e02a7[_0x0a53('0x34')][_0x0a53('0x3b')]('nolimit')){_0x53f502['limit']=qs['limit'](_0x8e02a7[_0x0a53('0x34')]['limit']);_0x53f502[_0x0a53('0x25')]=qs[_0x0a53('0x25')](_0x8e02a7['query'][_0x0a53('0x25')]);}_0x53f502['order']=qs[_0x0a53('0x3e')](_0x8e02a7[_0x0a53('0x34')][_0x0a53('0x3e')]);_0x53f502['where']=qs[_0x0a53('0x36')](_[_0x0a53('0x40')](_0x8e02a7[_0x0a53('0x34')],_0x23f5e0['filters']));_0x53f502[_0x0a53('0x3f')][_0x0a53('0x5b')]=_0x356ac0['id'];if(_0x8e02a7[_0x0a53('0x34')]['filter']){_0x53f502[_0x0a53('0x3f')]=_['merge'](_0x53f502['where'],{'$or':_['map'](_0x53f502[_0x0a53('0x37')],function(_0x27aeb3){var _0x2c970b={};_0x2c970b[_0x27aeb3]={'$like':'%'+_0x8e02a7['query'][_0x0a53('0x41')]+'%'};return _0x2c970b;})});}_0x53f502=_[_0x0a53('0x42')]({},_0x53f502,_0x8e02a7[_0x0a53('0x43')]);return db[_0x0a53('0x58')][_0x0a53('0x24')]({'where':_0x53f502[_0x0a53('0x3f')]})[_0x0a53('0x14')](function(_0x2faa9d){_0x55b9a3['count']=_0x2faa9d;if(_0x8e02a7[_0x0a53('0x34')][_0x0a53('0x45')]){_0x53f502[_0x0a53('0x46')]=[{'all':!![]}];}return db[_0x0a53('0x58')]['findAll'](_0x53f502);})[_0x0a53('0x14')](function(_0x1b50c2){_0x55b9a3[_0x0a53('0x48')]=_0x1b50c2;return _0x55b9a3;});}})['then'](respondWithFilteredResult(_0xb121ff,_0x53f502))[_0x0a53('0x1d')](handleError(_0xb121ff,null));};exports[_0x0a53('0x5c')]=function(_0x3f1376,_0x2b91a5){return db['ChatWebsite']['find']({'where':{'id':_0x3f1376[_0x0a53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2b91a5,null))[_0x0a53('0x14')](function(_0x24759e){if(_0x24759e){return _0x24759e[_0x0a53('0x5c')](_0x3f1376['query'][_0x0a53('0x5d')]);}})['then'](respondWithStatusCode(_0x2b91a5,null))['catch'](handleError(_0x2b91a5,null));};exports[_0x0a53('0x5e')]=function(_0x4fc3b2,_0x585e2a){if(_0x4fc3b2[_0x0a53('0x4f')]['id']){delete _0x4fc3b2['body']['id'];}return db[_0x0a53('0x44')][_0x0a53('0x4d')]({'where':{'id':_0x4fc3b2[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x585e2a,null))[_0x0a53('0x14')](function(_0x2f06c7){if(_0x2f06c7){_0x4fc3b2[_0x0a53('0x4f')][_0x0a53('0x5b')]=_0x2f06c7['id'];return db[_0x0a53('0x5f')][_0x0a53('0x4e')](_0x4fc3b2[_0x0a53('0x4f')]);}})[_0x0a53('0x14')](respondWithResult(_0x585e2a,null))[_0x0a53('0x1d')](handleError(_0x585e2a,null));};exports['getAnswers']=function(_0x8855b9,_0x4f3eba){var _0x197034={'raw':![],'where':{}};var _0x302f50={};var _0x15533a={'count':0x0,'rows':[]};return db[_0x0a53('0x44')][_0x0a53('0x5a')]({'where':{'id':_0x8855b9['params']['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x4f3eba,null))[_0x0a53('0x14')](function(_0x56e714){if(_0x56e714){_0x302f50[_0x0a53('0x33')]=_[_0x0a53('0x35')](db[_0x0a53('0x5f')][_0x0a53('0x4c')]);_0x302f50['query']=_['keys'](_0x8855b9[_0x0a53('0x34')]);_0x302f50[_0x0a53('0x36')]=_[_0x0a53('0x38')](_0x302f50[_0x0a53('0x33')],_0x302f50[_0x0a53('0x34')]);_0x197034[_0x0a53('0x37')]=_[_0x0a53('0x38')](_0x302f50['model'],qs[_0x0a53('0x39')](_0x8855b9[_0x0a53('0x34')][_0x0a53('0x39')]));_0x197034[_0x0a53('0x37')]=_0x197034[_0x0a53('0x37')][_0x0a53('0x3a')]?_0x197034[_0x0a53('0x37')]:_0x302f50[_0x0a53('0x33')];if(!_0x8855b9[_0x0a53('0x34')]['hasOwnProperty'](_0x0a53('0x3c'))){_0x197034[_0x0a53('0x22')]=qs[_0x0a53('0x22')](_0x8855b9[_0x0a53('0x34')][_0x0a53('0x22')]);_0x197034[_0x0a53('0x25')]=qs[_0x0a53('0x25')](_0x8855b9[_0x0a53('0x34')][_0x0a53('0x25')]);}_0x197034[_0x0a53('0x3d')]=qs[_0x0a53('0x3e')](_0x8855b9[_0x0a53('0x34')][_0x0a53('0x3e')]);_0x197034[_0x0a53('0x3f')]=qs['filters'](_[_0x0a53('0x40')](_0x8855b9['query'],_0x302f50['filters']));_0x197034[_0x0a53('0x3f')][_0x0a53('0x5b')]=_0x56e714['id'];if(_0x8855b9[_0x0a53('0x34')][_0x0a53('0x41')]){_0x197034['where']=_[_0x0a53('0x42')](_0x197034[_0x0a53('0x3f')],{'$or':_[_0x0a53('0x30')](_0x197034[_0x0a53('0x37')],function(_0x52db68){var _0x448178={};_0x448178[_0x52db68]={'$like':'%'+_0x8855b9[_0x0a53('0x34')][_0x0a53('0x41')]+'%'};return _0x448178;})});}_0x197034=_['merge']({},_0x197034,_0x8855b9['options']);return db[_0x0a53('0x5f')][_0x0a53('0x24')]({'where':_0x197034['where']})[_0x0a53('0x14')](function(_0x40798f){_0x15533a['count']=_0x40798f;if(_0x8855b9[_0x0a53('0x34')]['includeAll']){_0x197034['include']=[{'all':!![]}];}return db[_0x0a53('0x5f')][_0x0a53('0x47')](_0x197034);})['then'](function(_0x4c75a9){_0x15533a[_0x0a53('0x48')]=_0x4c75a9;return _0x15533a;});}})[_0x0a53('0x14')](respondWithFilteredResult(_0x4f3eba,_0x197034))[_0x0a53('0x1d')](handleError(_0x4f3eba,null));};exports[_0x0a53('0x60')]=function(_0x20004d,_0x7d9de1){return db['ChatWebsite'][_0x0a53('0x4d')]({'where':{'id':_0x20004d[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x7d9de1,null))['then'](function(_0x580b57){if(_0x580b57){return _0x580b57[_0x0a53('0x60')](_0x20004d['query'][_0x0a53('0x5d')]);}})[_0x0a53('0x14')](respondWithStatusCode(_0x7d9de1,null))['catch'](handleError(_0x7d9de1,null));};exports['addLogo']=function(_0x1d550d,_0xef531f){_0x1d550d[_0x0a53('0x4f')][_0x0a53('0x61')]=_0x1d550d['file']['filename'];return db[_0x0a53('0x44')][_0x0a53('0x4d')]({'where':{'id':_0x1d550d[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0xef531f,null))[_0x0a53('0x14')](saveUpdates(_0x1d550d[_0x0a53('0x4f')],null))[_0x0a53('0x14')](respondWithResult(_0xef531f,null))[_0x0a53('0x1d')](handleError(_0xef531f,null));};exports['addAvatar']=function(_0x178fa2,_0x27f65d){_0x178fa2['body'][_0x0a53('0x62')]=_0x178fa2['file']['filename'];return db['ChatWebsite'][_0x0a53('0x4d')]({'where':{'id':_0x178fa2['params']['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x27f65d,null))['then'](saveUpdates(_0x178fa2[_0x0a53('0x4f')],null))[_0x0a53('0x14')](respondWithResult(_0x27f65d,null))[_0x0a53('0x1d')](handleError(_0x27f65d,null));};exports[_0x0a53('0x63')]=function(_0x2d2434,_0x47c121){_0x2d2434[_0x0a53('0x4f')]['customerAvatar']=_0x2d2434['file'][_0x0a53('0x64')];return db[_0x0a53('0x44')][_0x0a53('0x4d')]({'where':{'id':_0x2d2434['params']['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x47c121,null))[_0x0a53('0x14')](saveUpdates(_0x2d2434[_0x0a53('0x4f')],null))[_0x0a53('0x14')](respondWithResult(_0x47c121,null))[_0x0a53('0x1d')](handleError(_0x47c121,null));};exports[_0x0a53('0x65')]=function(_0x538609,_0x55287f){_0x538609[_0x0a53('0x4f')][_0x0a53('0x66')]=_0x538609[_0x0a53('0x67')]['filename'];return db[_0x0a53('0x44')][_0x0a53('0x4d')]({'where':{'id':_0x538609[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x55287f,null))[_0x0a53('0x14')](saveUpdates(_0x538609['body'],null))[_0x0a53('0x14')](respondWithResult(_0x55287f,null))[_0x0a53('0x1d')](handleError(_0x55287f,null));};exports[_0x0a53('0x68')]=function(_0x1bed5d,_0x24169e){var _0x599f37=path['join'](config['root'],_0x0a53('0x69'));var _0x150329={'where':{'id':_0x1bed5d[_0x0a53('0x4a')]['id']},'attributes':['id',_0x0a53('0x61')],'raw':!![]};var _0x52ae57=![];return require('../../config/license/util')[_0x0a53('0x6a')]()[_0x0a53('0x14')](function(_0x19f3ce){if(_0x19f3ce){_0x52ae57=_0x19f3ce[_0x0a53('0x6b')];}})[_0x0a53('0x14')](function(){return db['ChatWebsite']['find'](_0x150329);})[_0x0a53('0x14')](handleEntityNotFound(_0x24169e,null))[_0x0a53('0x14')](function(_0x255fb3){if(_0x255fb3){if(!_[_0x0a53('0x6c')](_0x255fb3[_0x0a53('0x61')])){if(fs['existsSync'](path[_0x0a53('0x6d')](config[_0x0a53('0x6e')],_0x0a53('0x6f'),_0x255fb3[_0x0a53('0x61')]))&&_0x52ae57){_0x599f37=path[_0x0a53('0x6d')](config['root'],_0x0a53('0x6f'),_0x255fb3[_0x0a53('0x61')]);}}return _0x24169e[_0x0a53('0x70')](_0x599f37);}})[_0x0a53('0x1d')](handleError(_0x24169e,null));};exports[_0x0a53('0x71')]=function(_0xbdd5c1,_0x394100){var _0x4da7bb=path[_0x0a53('0x6d')](config['root'],_0x0a53('0x72'));var _0x46a36a={'where':{'id':_0xbdd5c1[_0x0a53('0x4a')]['id']},'attributes':['id',_0x0a53('0x62')],'raw':!![]};return db[_0x0a53('0x44')][_0x0a53('0x4d')](_0x46a36a)[_0x0a53('0x14')](handleEntityNotFound(_0x394100,null))['then'](function(_0x2c077b){if(_0x2c077b){if(!_[_0x0a53('0x6c')](_0x2c077b[_0x0a53('0x62')])){if(fs[_0x0a53('0x73')](path[_0x0a53('0x6d')](config[_0x0a53('0x6e')],'server/files/images/avatars/',_0x2c077b[_0x0a53('0x62')]))){_0x4da7bb=path[_0x0a53('0x6d')](config[_0x0a53('0x6e')],_0x0a53('0x74'),_0x2c077b[_0x0a53('0x62')]);}}return _0x394100['download'](_0x4da7bb);}})[_0x0a53('0x1d')](handleError(_0x394100,null));};exports[_0x0a53('0x75')]=function(_0x1c2668,_0x3073c5){var _0x181b00=path[_0x0a53('0x6d')](config[_0x0a53('0x6e')],_0x0a53('0x76'));var _0x35f80e={'where':{'id':_0x1c2668[_0x0a53('0x4a')]['id']},'attributes':['id',_0x0a53('0x77'),_0x0a53('0x78')],'raw':!![]};return db[_0x0a53('0x44')][_0x0a53('0x4d')](_0x35f80e)['then'](handleEntityNotFound(_0x3073c5,null))[_0x0a53('0x14')](function(_0x53bd02){if(_0x53bd02){if(!_['isNil'](_0x53bd02[_0x0a53('0x77')])){if(fs[_0x0a53('0x73')](path[_0x0a53('0x6d')](config[_0x0a53('0x6e')],_0x0a53('0x74'),_0x53bd02[_0x0a53('0x77')]))&&_0x53bd02['showCustomerAvatar']){_0x181b00=path[_0x0a53('0x6d')](config[_0x0a53('0x6e')],_0x0a53('0x74'),_0x53bd02[_0x0a53('0x77')]);}}return _0x3073c5[_0x0a53('0x70')](_0x181b00);}})[_0x0a53('0x1d')](handleError(_0x3073c5,null));};exports[_0x0a53('0x79')]=function(_0x2b5d3a,_0x1e8444){var _0x95d180=path[_0x0a53('0x6d')](config['root'],_0x0a53('0x7a'));var _0x1c995f={'where':{'id':_0x2b5d3a[_0x0a53('0x4a')]['id']},'attributes':['id',_0x0a53('0x66')],'raw':!![]};return db['ChatWebsite'][_0x0a53('0x4d')](_0x1c995f)[_0x0a53('0x14')](handleEntityNotFound(_0x1e8444,null))[_0x0a53('0x14')](function(_0x45ff33){if(_0x45ff33){if(!_[_0x0a53('0x6c')](_0x45ff33[_0x0a53('0x66')])){if(fs[_0x0a53('0x73')](path[_0x0a53('0x6d')](config[_0x0a53('0x6e')],_0x0a53('0x74'),_0x45ff33[_0x0a53('0x66')]))){_0x95d180=path[_0x0a53('0x6d')](config[_0x0a53('0x6e')],_0x0a53('0x74'),_0x45ff33[_0x0a53('0x66')]);}}return _0x1e8444[_0x0a53('0x70')](_0x95d180);}})[_0x0a53('0x1d')](handleError(_0x1e8444,null));};exports[_0x0a53('0x7b')]=function(_0x4bf266,_0x51d969){var _0x3c263d=require(_0x0a53('0x7c'));var _0x3d4451=new _0x3c263d();var _0x302dcf=_0x3d4451['setUA'](_0x4bf266[_0x0a53('0x7d')][_0x0a53('0x7e')])[_0x0a53('0x7f')]();var _0x2d75b0={'body':_0x4bf266['body'],'channel':_0x0a53('0x80')};var _0x516f21=[];var _0x8f79de=[];var _0x4b76f4={};var _0x2dc6b9=![];return db['CmContact'][_0x0a53('0x56')]()[_0x0a53('0x14')](function(_0x1730ec){if(!_0x1730ec){throw new db[(_0x0a53('0x81'))][(_0x0a53('0x82'))](_0x0a53('0x83'));}_0x516f21=_[_0x0a53('0x84')](_[_0x0a53('0x35')](_0x1730ec),[_0x0a53('0x85'),'updatedAt']);_0x8f79de=_[_0x0a53('0x84')](_[_0x0a53('0x35')](_0x1730ec),[_0x0a53('0x85'),'updatedAt',_0x0a53('0x86'),'ListId']);if(_0x4bf266[_0x0a53('0x4f')]['id']){delete _0x4bf266[_0x0a53('0x4f')]['id'];}if(_[_0x0a53('0x6c')](_0x4bf266[_0x0a53('0x4f')][_0x0a53('0x87')])){throw new db[(_0x0a53('0x81'))]['ValidationError'](_0x0a53('0x88'));}if(_[_0x0a53('0x6c')](_0x4bf266[_0x0a53('0x4f')][_0x0a53('0x4f')])||_0x4bf266[_0x0a53('0x4f')][_0x0a53('0x4f')]===''){throw new db['Sequelize'][(_0x0a53('0x82'))](_0x0a53('0x89'));}if(_[_0x0a53('0x6c')](_0x4bf266['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x0a53('0x8a')+_0x8f79de);}if(!_[_0x0a53('0x8b')](_0x8f79de,_0x4bf266[_0x0a53('0x4f')][_0x0a53('0x8c')])){throw new db[(_0x0a53('0x81'))][(_0x0a53('0x82'))](_0x0a53('0x8d')+_0x8f79de);}_0x4b76f4[_0x4bf266['body'][_0x0a53('0x8c')]]=_0x4bf266['body'][_0x0a53('0x87')];})['then'](function(){return db[_0x0a53('0x44')][_0x0a53('0x4d')]({'where':{'id':_0x4bf266[_0x0a53('0x4a')]['id']},'include':[{'model':db[_0x0a53('0x8e')],'as':'List','include':[{'model':db[_0x0a53('0x8f')],'as':_0x0a53('0x90'),'where':_0x4b76f4,'limit':0x1,'order':[[_0x0a53('0x91'),_0x0a53('0x92')]]}]},{'model':db[_0x0a53('0x93')],'as':_0x0a53('0x94')}]});})[_0x0a53('0x14')](handleEntityNotFound(_0x51d969,null))[_0x0a53('0x14')](function(_0x5d6b94){if(_0x5d6b94&&_0x5d6b94[_0x0a53('0x95')]){_0x2d75b0[_0x0a53('0x96')]=_0x5d6b94;_0x2d75b0[_0x0a53('0x97')]=_0x5d6b94[_0x0a53('0x94')];_0x2d75b0[_0x0a53('0x98')]=_0x5d6b94[_0x0a53('0x95')];_0x2d75b0['applications']=_['orderBy'](_0x2d75b0[_0x0a53('0x97')],[_0x0a53('0x99')],[_0x0a53('0x9a')]);if(_0x2d75b0[_0x0a53('0x96')][_0x0a53('0x94')]){delete _0x2d75b0[_0x0a53('0x96')][_0x0a53('0x94')];}if(_0x2d75b0[_0x0a53('0x96')][_0x0a53('0x95')]&&_0x2d75b0[_0x0a53('0x96')][_0x0a53('0x95')]['Contacts']['length']){return _0x2d75b0[_0x0a53('0x96')][_0x0a53('0x95')][_0x0a53('0x90')][0x0];}var _0xdfd54c=_[_0x0a53('0xd')](_0x4bf266[_0x0a53('0x4f')],{'firstName':_0x4bf266[_0x0a53('0x4f')][_0x0a53('0x87')],'ListId':_0x5d6b94['ListId']});_0xdfd54c[_0x4bf266[_0x0a53('0x4f')][_0x0a53('0x8c')]]=_0x4bf266[_0x0a53('0x4f')][_0x0a53('0x87')];return db[_0x0a53('0x8f')][_0x0a53('0x4e')](_0xdfd54c,{'fields':_0x516f21,'raw':!![]});}})['then'](handleEntityNotFound(_0x51d969,null))[_0x0a53('0x14')](function(_0xbe7593){_0x2d75b0[_0x0a53('0x9b')]=_0xbe7593;var _0x46a419=_0x4bf266['body'][_0x0a53('0x9c')];if(_0x4bf266[_0x0a53('0x7d')][_0x0a53('0x9d')]){_0x46a419=_0x4bf266[_0x0a53('0x7d')][_0x0a53('0x9d')];}else if(_0x4bf266[_0x0a53('0x7d')][_0x0a53('0x9e')]){_0x46a419=_[_0x0a53('0x9f')](_0x4bf266[_0x0a53('0x7d')][_0x0a53('0x9e')][_0x0a53('0xa0')](','));}if(_0xbe7593){var _0x555d4b={'ContactId':_0xbe7593['id'],'ChatWebsiteId':_0x4bf266[_0x0a53('0x4a')]['id'],'from':(_0xbe7593[_0x0a53('0xa1')]||'')+'\x20'+(_0xbe7593[_0x0a53('0xa2')]||''),'customerIp':_0x46a419,'customerPort':_0x4bf266[_0x0a53('0x7d')][_0x0a53('0xa3')]?_0x4bf266['headers']['x-real-port']:null,'referer':_0x4bf266['body'][_0x0a53('0xa4')],'browserName':_0x302dcf[_0x0a53('0xa5')][_0x0a53('0x2c')]&&_0x302dcf['browser']['version']?util[_0x0a53('0xa6')](_0x0a53('0xa7'),_0x302dcf[_0x0a53('0xa5')][_0x0a53('0x2c')],_0x302dcf[_0x0a53('0xa5')][_0x0a53('0xa8')]):'unknown','browserVersion':_0x302dcf[_0x0a53('0xa5')][_0x0a53('0xa8')]||_0x0a53('0xa9'),'osName':util[_0x0a53('0xa6')](_0x0a53('0xa7'),_0x302dcf['os'][_0x0a53('0x2c')],_0x302dcf['os'][_0x0a53('0xa8')]),'osVersion':_0x302dcf['os']['version'],'deviceModel':_0x302dcf['device'][_0x0a53('0x33')]&&_0x302dcf[_0x0a53('0xaa')][_0x0a53('0xab')]?util[_0x0a53('0xa6')]('%s\x20%s\x20%s',_0x302dcf[_0x0a53('0xaa')][_0x0a53('0x33')],_0x302dcf['device'][_0x0a53('0xab')],_0x302dcf['device'][_0x0a53('0x32')]):null,'deviceVendor':_0x302dcf[_0x0a53('0xaa')]['vendor'],'deviceType':_0x302dcf[_0x0a53('0xaa')]['type'],'formData':JSON[_0x0a53('0xac')](_0x4bf266['body'])};var _0x313ece={'ChatWebsiteId':_0x4bf266[_0x0a53('0x4a')]['id'],'closed':![]};if(_0x4bf266[_0x0a53('0x4f')][_0x0a53('0xad')]){_0x313ece[_0x0a53('0xad')]=_0x4bf266['body']['threadId'];return db[_0x0a53('0xae')][_0x0a53('0x4d')]({'where':_0x313ece})['then'](function(_0x509a98){if(_0x509a98){return[_0x509a98,![]];}_0x555d4b[_0x0a53('0xad')]=_0x4bf266[_0x0a53('0x4f')][_0x0a53('0xad')];_0x555d4b['externalUrl']=_0x4bf266['body'][_0x0a53('0xaf')];return db[_0x0a53('0xae')][_0x0a53('0x4e')](_0x555d4b)[_0x0a53('0x14')](function(_0x573dd2){return[_0x573dd2,!![]];});});}_0x313ece[_0x0a53('0xb0')]=_0xbe7593['id'];if(_0x4bf266[_0x0a53('0x4f')]['interaction']&&_0x4bf266[_0x0a53('0x4f')][_0x0a53('0xb1')]['id']){_0x313ece['id']=_0x4bf266[_0x0a53('0x4f')]['interaction']['id'];return db[_0x0a53('0xae')]['find']({'where':_0x313ece})[_0x0a53('0x14')](function(_0x4aa573){if(_0x4aa573){return[_0x4aa573,![]];}return db[_0x0a53('0xae')][_0x0a53('0x4e')](_0x555d4b)[_0x0a53('0x14')](function(_0x1402fe){return[_0x1402fe,!![]];});});}return db[_0x0a53('0xae')][_0x0a53('0x4e')](_0x555d4b)[_0x0a53('0x14')](function(_0x38581c){return[_0x38581c,!![]];});}})[_0x0a53('0xb2')](function(_0x50d23e,_0x3ab018){if(_0x50d23e){_0x2dc6b9=_0x3ab018;if(!_0x3ab018){var _0x35ba3a={'from':(_0x2d75b0[_0x0a53('0x9b')][_0x0a53('0xa1')]||'')+'\x20'+(_0x2d75b0['contact'][_0x0a53('0xa2')]||'')};if(_0x4bf266['body'][_0x0a53('0xad')]&&_0x4bf266[_0x0a53('0x4f')][_0x0a53('0xb3')]&&_0x4bf266['body'][_0x0a53('0xad')]!=_0x4bf266[_0x0a53('0x4f')]['messageId']){_0x35ba3a[_0x0a53('0xad')]=_0x4bf266[_0x0a53('0x4f')][_0x0a53('0xb3')];}return _0x50d23e['update'](_0x35ba3a);}else{return _0x50d23e;}}})[_0x0a53('0x14')](function(_0x54eea7){_0x2d75b0[_0x0a53('0xb1')]=_0x54eea7[_0x0a53('0x2a')]({'plain':!![]});_0x2d75b0[_0x0a53('0xb1')][_0x0a53('0xb4')]=_0x2dc6b9;if(_0x2d75b0[_0x0a53('0xb1')][_0x0a53('0xb4')]){if(_0x2d75b0[_0x0a53('0x96')][_0x0a53('0xb5')]){_0x2d75b0[_0x0a53('0x97')][_0x0a53('0xb6')]({'id':0x0,'priority':_0x2d75b0['applications']['length']+0x1,'app':'close','appdata':_0x0a53('0xb7'),'interval':'*,*,*,*'});}}return db[_0x0a53('0xb8')][_0x0a53('0x4e')]({'body':_0x4bf266[_0x0a53('0x4f')]['body'],'ChatWebsiteId':_0x4bf266['params']['id'],'ChatInteractionId':_0x54eea7['id'],'direction':'in','ContactId':_0x2d75b0['contact']['id'],'AttachmentId':_0x4bf266[_0x0a53('0x4f')][_0x0a53('0xb9')]});})[_0x0a53('0x14')](function(_0x3b60c7){_0x2d75b0['message']=_0x3b60c7;if(_0x2d75b0[_0x0a53('0xb1')]['UserId']){return db[_0x0a53('0xba')]['find']({'attributes':['id',_0x0a53('0x2c')],'where':{'id':_0x2d75b0['interaction'][_0x0a53('0xbb')]}})[_0x0a53('0x14')](function(_0x250061){if(_0x250061){_0x2d75b0[_0x0a53('0x97')][_0x0a53('0xbc')]({'id':0x0,'priority':0x0,'app':_0x0a53('0xbd'),'appdata':_0x250061[_0x0a53('0x2c')]+','+(_0x2d75b0['account'][_0x0a53('0xbe')]||0xa),'interval':_0x0a53('0xbf')});_0x2d75b0[_0x0a53('0xc0')]=!![];}return respondWithRpcPromise(_0x0a53('0xc1'),'startRouting',_0x2d75b0);});}return respondWithRpcPromise(_0x0a53('0xc1'),_0x0a53('0xc2'),_0x2d75b0);})[_0x0a53('0x14')](function(_0xb4794e){respondWithRpcPromise('EventManager',_0x0a53('0xc3'),{'event':_0x0a53('0x7b'),'message':_0xb4794e},client9002);return _0xb4794e;})[_0x0a53('0x14')](respondWithResult(_0x51d969,null))[_0x0a53('0x1d')](handleError(_0x51d969,null));};exports[_0x0a53('0xc4')]=function(_0x2c02f1,_0x1aa136){var _0x5d5f31,_0x4213dd,_0x30599e;var _0x42dc30=[];var _0x856b48={};var _0x1e3a86=_0x2c02f1['files']||[];var _0x3c3875=[];var _0x5b9edd;return db[_0x0a53('0x8f')][_0x0a53('0x56')]()['then'](function(_0x4897a2){if(!_0x4897a2){throw new db[(_0x0a53('0x81'))]['ValidationError'](_0x0a53('0x83'));}_0x42dc30=_[_0x0a53('0x84')](_[_0x0a53('0x35')](_0x4897a2),['createdAt',_0x0a53('0x91'),_0x0a53('0x86'),_0x0a53('0xc5')]);if(_0x2c02f1[_0x0a53('0x4f')]['id']){delete _0x2c02f1[_0x0a53('0x4f')]['id'];}if(_[_0x0a53('0x6c')](_0x2c02f1[_0x0a53('0x4f')][_0x0a53('0x87')])){throw _0x1aa136[_0x0a53('0x1f')](0x1f4)[_0x0a53('0x2d')](new db[(_0x0a53('0x81'))][(_0x0a53('0x82'))]('from\x20is\x20mandatory'));}if(_[_0x0a53('0x6c')](_0x2c02f1[_0x0a53('0x4f')][_0x0a53('0x4f')])||_0x2c02f1['body']['body']===''){throw _0x1aa136[_0x0a53('0x1f')](0x1f4)['send'](new db['Sequelize'][(_0x0a53('0x82'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0a53('0x6c')](_0x2c02f1['body'][_0x0a53('0xc6')])){throw _0x1aa136[_0x0a53('0x1f')](0x1f4)[_0x0a53('0x2d')](new db[(_0x0a53('0x81'))][(_0x0a53('0x82'))](_0x0a53('0xc7')+_0x42dc30));}if(!_[_0x0a53('0x8b')](_0x42dc30,_0x2c02f1['body'][_0x0a53('0xc6')])){throw _0x1aa136[_0x0a53('0x1f')](0x1f4)['send'](new db[(_0x0a53('0x81'))][(_0x0a53('0x82'))](_0x0a53('0xc8')+_0x42dc30));}_0x856b48[_0x2c02f1[_0x0a53('0x4f')][_0x0a53('0xc6')]]=_0x2c02f1[_0x0a53('0x4f')][_0x0a53('0x87')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2c02f1[_0x0a53('0x4a')]['id']},'include':[{'model':db[_0x0a53('0x8e')],'as':'List'},{'model':db[_0x0a53('0xc9')],'as':_0x0a53('0xc9')}]});})[_0x0a53('0x14')](handleEntityNotFound(_0x1aa136,null))[_0x0a53('0x14')](function(_0x248d20){if(_0x248d20&&_0x248d20[_0x0a53('0x95')]){_0x4213dd=_0x248d20;var _0x6f90e9=_[_0x0a53('0xd')](_0x2c02f1[_0x0a53('0x4f')],{'firstName':_0x2c02f1[_0x0a53('0x4f')]['from'],'phone':_0x2c02f1[_0x0a53('0x4f')]['from'],'ListId':_0x248d20[_0x0a53('0xc5')]});_0x6f90e9[_0x2c02f1['body']['mapKeyOffline']]=_0x2c02f1[_0x0a53('0x4f')][_0x0a53('0x87')];return db[_0x0a53('0x8f')][_0x0a53('0xca')]({'where':_0x856b48,'defaults':_0x6f90e9});}})[_0x0a53('0xb2')](function(_0x4bca75){if(_0x4bca75){_0x30599e=_0x4bca75;var _0x80a88c=fs[_0x0a53('0xcb')](path[_0x0a53('0x6d')](config[_0x0a53('0x6e')],_0x0a53('0xcc')),_0x0a53('0xcd'));var _0x41096c=ejs[_0x0a53('0xce')](_0x80a88c,{'body':_[_0x0a53('0xcf')](_0x2c02f1[_0x0a53('0x4f')][_0x0a53('0x4f')]),'bodyTitle':_0x4213dd['offlineMessageBody']});return db[_0x0a53('0xd0')]['create']({'body':_0x41096c,'plainBody':htmlToText[_0x0a53('0xd1')](_0x41096c),'ContactId':_0x4bca75['id'],'ChatWebsiteId':_0x4213dd['id']});}})[_0x0a53('0x14')](function(_0x3e8758){_0x5b9edd=_0x3e8758;if(_0x1e3a86[_0x0a53('0x3a')]){var _0x36583c=_0x1e3a86[_0x0a53('0x30')](function(_0x93fe89){return{'name':_0x93fe89[_0x0a53('0xd2')],'basename':_0x93fe89[_0x0a53('0x64')],'type':_0x93fe89['mimetype'],'ChatOfflineMessageId':_0x3e8758['id']};});_0x3c3875=_0x36583c['map'](_0x3214b0=>{var _0xf23ad={'filename':_0x3214b0[_0x0a53('0x2c')],'path':path['join'](config['root'],_0x0a53('0xd3'),_0x0a53('0xd4'),_0x0a53('0xd5'),_0x0a53('0xd6'),_0x3214b0[_0x0a53('0xd7')])};return _0xf23ad;});if(!_0x4213dd['openNewInteraction']){return db[_0x0a53('0xd8')][_0x0a53('0xd9')](function(_0x4e0251){return db['Attachment'][_0x0a53('0xda')](_0x36583c,{'transaction':_0x4e0251});});}}})[_0x0a53('0x14')](function(){if(_0x5b9edd){_0x5d5f31=_0x5b9edd;return db[_0x0a53('0xc9')][_0x0a53('0x5a')]({'where':{'service':!![]},'include':[{'model':db[_0x0a53('0xdb')],'as':_0x0a53('0xdc'),'raw':!![],'include':[{'model':db[_0x0a53('0xdd')],'as':_0x0a53('0xdd'),'raw':!![]}]}]});}})[_0x0a53('0x14')](function(_0x29b29b){if(_0x29b29b&&_0x29b29b[_0x0a53('0xdc')]&&_0x4213dd[_0x0a53('0xde')]&&_0x4213dd[_0x0a53('0xdf')]){var _0x45e625=_0x29b29b['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x0a53('0xe0'),{'account':_0x45e625,'message':{'from':util[_0x0a53('0xa6')](_0x0a53('0xe1'),_0x29b29b[_0x0a53('0x2c')],_0x29b29b[_0x0a53('0xe2')]||_0x29b29b[_0x0a53('0xdc')][_0x0a53('0x50')]),'to':_0x4213dd[_0x0a53('0xdf')],'subject':_0x4213dd[_0x0a53('0xe3')],'html':_0x5d5f31[_0x0a53('0x4f')],'attachments':_0x3c3875}},client9003)['then'](function(){return _0x5d5f31;})['catch'](function(_0x52c1fc){logger[_0x0a53('0x18')](_0x52c1fc);});}})[_0x0a53('0x14')](function(){if(_0x4213dd&&_0x4213dd['openNewInteraction']&&_0x4213dd[_0x0a53('0xe4')]){var _0x5f497f=[];if(_0x1e3a86[_0x0a53('0x3a')]){_0x5f497f=_0x1e3a86['map'](function(_0x3c57bd){return{'name':_0x3c57bd[_0x0a53('0xd2')],'basename':_0x3c57bd['filename'],'type':_0x3c57bd[_0x0a53('0xe5')],'ChatOfflineMessageId':_0x5b9edd['id']};});}var _0x35785e;if(!_[_0x0a53('0x6c')](_0x4213dd[_0x0a53('0xe6')])){var _0x438f85=_[_0x0a53('0x30')](_0x2c02f1['body'],function(_0x34d8a1){return _0x34d8a1;});var _0x30ea5e=_[_0x0a53('0xe7')](_0x438f85)[0x0];var _0x505f5e=_[_0x0a53('0xe8')](_0x30ea5e,function(_0x5da380){return _0x5da380;});_0x35785e=_0x505f5e[0x1][_0x4213dd[_0x0a53('0xe6')]];}var _0x4bd8f9={'from':_0x30599e[_0x0a53('0xe2')],'firstName':_0x30599e[_0x0a53('0xa1')],'lastName':_0x30599e[_0x0a53('0xa2')],'mapKey':_0x0a53('0xe2'),'message':{'from':_0x30599e[_0x0a53('0xe2')],'to':_0x4213dd[_0x0a53('0xc9')]['email'],'cc':'','subject':_[_0x0a53('0x6c')](_0x35785e)?_0x4213dd[_0x0a53('0xe3')]:_0x35785e,'messageId':'','sentAt':new Date(),'attach':_0x5f497f[_0x0a53('0x3a')],'attachments':_0x5f497f,'originChannel':_0x0a53('0xe9'),'ChatWebsiteId':_0x4213dd['id'],'ChatOfflineMessageId':_0x5d5f31['id'],'originTo':_0x4213dd['MailAccount'][_0x0a53('0xe2')]},'body':_0x5d5f31[_0x0a53('0x4f')]};var _0x326684={'account':{'id':_0x4213dd[_0x0a53('0xe4')]},'body':_0x4bd8f9,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x0a53('0xea'),_0x0a53('0xeb'),_0x326684,client9001)[_0x0a53('0x14')](function(){return _0x5d5f31;})[_0x0a53('0x1d')](function(_0x3dcb2f){logger['error'](_0x3dcb2f);});}return;})[_0x0a53('0x14')](function(){if(_0x5d5f31){return _0x5d5f31;}})[_0x0a53('0x14')](respondWithResult(_0x1aa136,null))[_0x0a53('0x1d')](function(_0x497757){logger['error'](_0x0a53('0x1d'),_0x497757);for(var _0x1b13f2 of _0x1e3a86){var _0x43c4af=path[_0x0a53('0x6d')](config[_0x0a53('0x6e')],_0x0a53('0xd3'),_0x0a53('0xd4'),_0x0a53('0xd5'),_0x0a53('0xd6'),_0x1b13f2[_0x0a53('0x64')]);fs_extra[_0x0a53('0xec')](_0x43c4af)['catch'](function(_0x5cbaa6){logger[_0x0a53('0x18')](_0x0a53('0xed'),_0x43c4af,_0x5cbaa6);});}});};exports[_0x0a53('0xee')]=function(_0x557c2a,_0x11b002){return db[_0x0a53('0xae')][_0x0a53('0x4d')]({'where':{'id':_0x557c2a[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x11b002,null))[_0x0a53('0x14')](function(_0x2c776a){if(_0x2c776a){return _0x2c776a[_0x0a53('0xee')](_0x557c2a[_0x0a53('0x4f')][_0x0a53('0x5d')],_[_0x0a53('0xef')](_0x557c2a[_0x0a53('0x4f')],['ids','id'])||{});}})[_0x0a53('0x14')](respondWithResult(_0x11b002,null))[_0x0a53('0x1d')](handleError(_0x11b002,null));};exports[_0x0a53('0xf0')]=function(_0x29035f,_0x260214){var _0x595d76={'raw':![],'where':{}};var _0x2d679b={};var _0x2b2cdd={'count':0x0,'rows':[]};return db[_0x0a53('0x44')][_0x0a53('0x5a')]({'where':{'id':_0x29035f[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x260214,null))['then'](function(_0x5145c5){if(_0x5145c5){_0x2d679b[_0x0a53('0x33')]=_[_0x0a53('0x35')](db[_0x0a53('0xae')]['rawAttributes']);_0x2d679b['query']=_[_0x0a53('0x35')](_0x29035f['query']);_0x2d679b['filters']=_[_0x0a53('0x38')](_0x2d679b[_0x0a53('0x33')],_0x2d679b[_0x0a53('0x34')]);_0x595d76[_0x0a53('0x37')]=_[_0x0a53('0x38')](_0x2d679b[_0x0a53('0x33')],qs[_0x0a53('0x39')](_0x29035f[_0x0a53('0x34')][_0x0a53('0x39')]));_0x595d76['attributes']=_0x595d76['attributes'][_0x0a53('0x3a')]?_0x595d76[_0x0a53('0x37')]:_0x2d679b['model'];if(!_0x29035f[_0x0a53('0x34')][_0x0a53('0x3b')](_0x0a53('0x3c'))){_0x595d76[_0x0a53('0x22')]=qs[_0x0a53('0x22')](_0x29035f[_0x0a53('0x34')][_0x0a53('0x22')]);_0x595d76[_0x0a53('0x25')]=qs[_0x0a53('0x25')](_0x29035f[_0x0a53('0x34')][_0x0a53('0x25')]);}_0x595d76['order']=qs[_0x0a53('0x3e')](_0x29035f[_0x0a53('0x34')]['sort']);_0x595d76['where']=qs[_0x0a53('0x36')](_[_0x0a53('0x40')](_0x29035f[_0x0a53('0x34')],_0x2d679b[_0x0a53('0x36')]));_0x595d76[_0x0a53('0x3f')]['ChatWebsiteId']=_0x5145c5['id'];if(_0x29035f[_0x0a53('0x34')]['filter']){_0x595d76[_0x0a53('0x3f')]=_[_0x0a53('0x42')](_0x595d76[_0x0a53('0x3f')],{'$or':_[_0x0a53('0x30')](_0x595d76[_0x0a53('0x37')],function(_0x489023){var _0x3e4111={};_0x3e4111[_0x489023]={'$like':'%'+_0x29035f[_0x0a53('0x34')][_0x0a53('0x41')]+'%'};return _0x3e4111;})});}_0x595d76=_[_0x0a53('0x42')]({},_0x595d76,_0x29035f['options']);return db[_0x0a53('0xae')][_0x0a53('0x24')]({'where':_0x595d76['where']})[_0x0a53('0x14')](function(_0x5d55a5){_0x2b2cdd[_0x0a53('0x24')]=_0x5d55a5;if(_0x29035f[_0x0a53('0x34')][_0x0a53('0x45')]){_0x595d76[_0x0a53('0x46')]=[{'model':db[_0x0a53('0x8f')],'as':_0x0a53('0xf1'),'required':![]},{'model':db[_0x0a53('0xba')],'as':_0x0a53('0xf2'),'attributes':[_0x0a53('0x2c'),_0x0a53('0xf3'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a53('0x2c'),_0x0a53('0xf4')],'where':_0x29035f['query'][_0x0a53('0xf5')]?{'id':_0x29035f[_0x0a53('0x34')][_0x0a53('0xf5')]}:undefined,'required':_0x29035f['query'][_0x0a53('0xf5')]?!![]:![]}];}return db['ChatInteraction'][_0x0a53('0x47')](_0x595d76);})[_0x0a53('0x14')](function(_0x2b00b3){_0x2b2cdd['rows']=_0x2b00b3;return _0x2b2cdd;});}})[_0x0a53('0x14')](respondWithFilteredResult(_0x260214,_0x595d76))[_0x0a53('0x1d')](handleError(_0x260214,null));};function iftimePromise(_0x2b9b8f,_0x21bdf3){return respondWithRpcPromise(_0x0a53('0xf6'),_0x0a53('0xf7'),{'command':_0x21bdf3[_0x0a53('0xf8')]?util['format'](_0x0a53('0xf9'),_0x2b9b8f[_0x0a53('0xfa')],_0x21bdf3[_0x0a53('0xf8')]):util[_0x0a53('0xa6')](_0x0a53('0xfb'),_0x2b9b8f[_0x0a53('0xfa')])},client9002)[_0x0a53('0x14')](function(_0x5952b5){var _0x34ccd0=_0x5952b5&&_0x5952b5['indexOf']('true')>=0x0?!![]:![];logger[_0x0a53('0x1b')](_0x0a53('0xfc'),_0x21bdf3['id'],_0x2b9b8f['id'],_0x2b9b8f[_0x0a53('0xfa')],_0x34ccd0?_0x0a53('0xfd'):_0x0a53('0xfe'),_0x21bdf3[_0x0a53('0xf8')]?_0x21bdf3[_0x0a53('0xf8')]:_0x0a53('0xff'));return _0x34ccd0;})[_0x0a53('0x1d')](function(_0x107e2){logger['error'](_0x0a53('0xfc'),_0x21bdf3['id'],_0x2b9b8f['id'],_0x2b9b8f[_0x0a53('0xfa')],util[_0x0a53('0x100')](_0x107e2,{'showHidden':![],'depth':null}),_0x21bdf3[_0x0a53('0xf8')]?_0x21bdf3[_0x0a53('0xf8')]:_0x0a53('0xff'));return![];});}exports['getSnippet']=function(_0x51b468,_0x2243c0){var _0x165ae0=0x0;var _0x2076c9=0x0;var _0x14f642=![];var _0x45866b;var _0xce7606;return db[_0x0a53('0x44')]['find']({'where':{'id':_0x51b468[_0x0a53('0x4a')]['id']},'include':[{'model':db[_0x0a53('0x101')],'as':_0x0a53('0x101'),'include':[{'model':db[_0x0a53('0x101')],'as':_0x0a53('0x102'),'attributes':['id',_0x0a53('0xfa')],'raw':!![]}]}]})[_0x0a53('0x14')](handleEntityNotFound(_0x2243c0,null))[_0x0a53('0x14')](function(_0xbbc016){if(_0xbbc016){_0x45866b=_0xbbc016;return _0xbbc016['getProactiveActions']({'raw':!![]});}})[_0x0a53('0x14')](function(_0x24ef2a){if(_0x45866b){if(_0x24ef2a){_0xce7606=_0x24ef2a;}}return require(_0x0a53('0x103'))['getLicense']();})[_0x0a53('0x14')](function(_0x56f799){if(_0x56f799){_0x2076c9=_0x56f799[_0x0a53('0x104')];_0x14f642=_0x56f799['custom'];}})[_0x0a53('0x14')](function(){return db[_0x0a53('0xae')][_0x0a53('0x24')]({'where':{'closed':![]}});})[_0x0a53('0x14')](function(_0x2c51c0){_0x165ae0=_0x2c51c0;if(_0x2076c9&&_0x2c51c0>_0x2076c9){return db[_0x0a53('0x105')][_0x0a53('0x5a')]({'where':{'id':0x1}})[_0x0a53('0x14')](function(_0x30bcfc){if(_0x30bcfc){_0x30bcfc[_0x0a53('0x106')]('chatLicenseExceeded');}});}})[_0x0a53('0x14')](function(){if(_0x45866b[_0x0a53('0x101')]&&_0x45866b[_0x0a53('0x101')][_0x0a53('0x102')]){var _0x4969db=[];for(var _0x5336c5=0x0;_0x5336c5<_0x45866b[_0x0a53('0x101')][_0x0a53('0x102')]['length'];_0x5336c5++){var _0x58b49f=_0x45866b[_0x0a53('0x101')][_0x0a53('0x102')][_0x5336c5][_0x0a53('0x2a')]({'plain':!![]});_0x4969db[_0x0a53('0xb6')](iftimePromise(_0x58b49f,_0x45866b));}return BPromise[_0x0a53('0x107')](_0x4969db)[_0x0a53('0x14')](function(_0x560e2a){return _[_0x0a53('0x108')](_0x560e2a);});}else{return!![];}})[_0x0a53('0x14')](function(_0x29e88d){var _0x2e52c7=fs[_0x0a53('0xcb')](path[_0x0a53('0x6d')](config[_0x0a53('0x6e')],'server/files/chat/iframe.ejs'),'utf8');var _0x4253bd=new url[(_0x0a53('0x109'))](_0x45866b['address'])[_0x0a53('0x10a')];var _0x72e02b=_0x0a53('0x10b');var _0x99a0b4=![];var _0x415888={'chatVersion':_0x72e02b,'chatWebsiteAddressOrigin':_0x4253bd,'remote':_0x45866b['remote'],'query':querystring[_0x0a53('0xac')](_[_0x0a53('0x42')](_0x45866b[_0x0a53('0x2a')]({'plain':!![]}),{'customerIp':_0x51b468[_0x0a53('0x7d')][_0x0a53('0x9e')]||_0x51b468[_0x0a53('0x7d')][_0x0a53('0x10c')]||_0x51b468[_0x0a53('0x10d')][_0x0a53('0x10e')]||_0x51b468['ip'],'referer':_0x51b468['headers'][_0x0a53('0xa4')],'openedInteractions':_0x165ae0,'maxInteractions':_0x2076c9,'virtual':_0x14f642[_0x0a53('0x104')],'online':_0x29e88d,'custom':_0x14f642}))[_0x0a53('0x10f')](/'/g,'\x5c\x27')};_0x2243c0['send'](ejs[_0x0a53('0xce')](Mustache[_0x0a53('0xce')](_0x2e52c7,_0x415888),{'proactiveActions':_0xce7606,'alignment':_0x45866b[_0x0a53('0x110')],'verticalAlignment':_0x45866b[_0x0a53('0x111')],'div_color':_0x45866b[_0x0a53('0xf4')],'labelText':_0x45866b['labelText'],'text_color':_0x45866b[_0x0a53('0x112')],'text_button_color':_0x45866b['textButtonColor'],'button_color':_0x45866b[_0x0a53('0x113')],'background_color':_0x45866b['backgroundColor'],'hideWhenOffline':_0x45866b[_0x0a53('0x114')],'intervalId':_0x45866b[_0x0a53('0x115')],'isDevelopment':_0x99a0b4,'chatVersion':_0x72e02b}));})['catch'](handleError(_0x2243c0,null));};exports['addApplications']=function(_0x35ced6,_0x35af6e){var _0x3a8cce=_0x35ced6[_0x0a53('0x4a')]['id'];var _0x1b023e=_0x35ced6['body'];var _0x119adc=0xc8;var _0x4866ec=null;return db[_0x0a53('0xd8')]['transaction']({'isolationLevel':db[_0x0a53('0xd8')]['Transaction']['ISOLATION_LEVELS'][_0x0a53('0x116')]},function(_0x3ad718){return db[_0x0a53('0x44')][_0x0a53('0x5a')]({'where':{'id':_0x3a8cce},'transaction':_0x3ad718})[_0x0a53('0x14')](function(_0x1c5cfd){if(_0x1c5cfd){return db['ChatApplication'][_0x0a53('0x29')]({'where':{'ChatWebsiteId':_0x3a8cce},'transaction':_0x3ad718})['then'](function(){var _0x29a76a=_[_0x0a53('0x30')](_0x1b023e,function(_0xc08c7b){_0xc08c7b['ChatWebsiteId']=_0x3a8cce;return _0xc08c7b;});return db[_0x0a53('0x93')]['bulkCreate'](_0x29a76a,{'transaction':_0x3ad718});});}else{_0x119adc=0x194;_0x4866ec=[];}});})['then'](function(){if(_0x119adc!==0x194){return db[_0x0a53('0x93')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x3a8cce},'order':_0x0a53('0x99')})[_0x0a53('0x14')](function(_0x48c3c8){_0x4866ec=_0x48c3c8;});}})[_0x0a53('0x1d')](function(_0x2b68f5){_0x119adc=0x1f4;logger[_0x0a53('0x18')](_0x2b68f5[_0x0a53('0x2b')]);if(_0x2b68f5[_0x0a53('0x2c')]){delete _0x2b68f5['name'];}_0x4866ec=_0x2b68f5;})['finally'](function(){if(_0x4866ec===null){_0x35af6e['sendStatus'](_0x119adc);}else{if(_0x119adc===0x1f4){_0x35af6e[_0x0a53('0x1f')](_0x119adc)[_0x0a53('0x2d')](_0x4866ec);}else{_0x35af6e[_0x0a53('0x1f')](_0x119adc)[_0x0a53('0x21')](_0x4866ec);}}});};exports[_0x0a53('0x117')]=function(_0x37c9ff,_0x2c2a4f){var _0x200b2e={};var _0x11b2ce={};var _0x525568;var _0x5eac13;return db[_0x0a53('0x44')]['findOne']({'where':{'id':_0x37c9ff[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x2c2a4f,null))[_0x0a53('0x14')](function(_0x139b29){if(_0x139b29){_0x525568=_0x139b29;_0x11b2ce[_0x0a53('0x33')]=_[_0x0a53('0x35')](db[_0x0a53('0x93')][_0x0a53('0x4c')]);_0x11b2ce[_0x0a53('0x34')]=_[_0x0a53('0x35')](_0x37c9ff[_0x0a53('0x34')]);_0x11b2ce[_0x0a53('0x36')]=_['intersection'](_0x11b2ce[_0x0a53('0x33')],_0x11b2ce[_0x0a53('0x34')]);_0x200b2e[_0x0a53('0x37')]=_['intersection'](_0x11b2ce['model'],qs[_0x0a53('0x39')](_0x37c9ff[_0x0a53('0x34')][_0x0a53('0x39')]));_0x200b2e[_0x0a53('0x37')]=_0x200b2e[_0x0a53('0x37')]['length']?_0x200b2e[_0x0a53('0x37')]:_0x11b2ce['model'];_0x200b2e[_0x0a53('0x3d')]=qs[_0x0a53('0x3e')](_0x37c9ff[_0x0a53('0x34')][_0x0a53('0x3e')]);_0x200b2e[_0x0a53('0x3f')]=qs[_0x0a53('0x36')](_[_0x0a53('0x40')](_0x37c9ff['query'],_0x11b2ce['filters']));if(_0x37c9ff[_0x0a53('0x34')][_0x0a53('0x41')]){_0x200b2e['where']=_[_0x0a53('0x42')](_0x200b2e[_0x0a53('0x3f')],{'$or':_[_0x0a53('0x30')](_0x200b2e[_0x0a53('0x37')],function(_0x2b9a83){var _0xa962ef={};_0xa962ef[_0x2b9a83]={'$like':'%'+_0x37c9ff[_0x0a53('0x34')]['filter']+'%'};return _0xa962ef;})});}_0x200b2e=_[_0x0a53('0x42')]({},_0x200b2e,_0x37c9ff['options']);return _0x525568['getApplications'](_0x200b2e);}})['then'](function(_0x3331a6){if(_0x3331a6){_0x5eac13=_0x3331a6['length'];if(!_0x37c9ff[_0x0a53('0x34')][_0x0a53('0x3b')]('nolimit')){_0x200b2e[_0x0a53('0x22')]=qs['limit'](_0x37c9ff['query']['limit']);_0x200b2e[_0x0a53('0x25')]=qs['offset'](_0x37c9ff[_0x0a53('0x34')][_0x0a53('0x25')]);}return _0x525568['getApplications'](_0x200b2e);}})[_0x0a53('0x14')](function(_0x52bb65){if(_0x52bb65){return _0x52bb65?{'count':_0x5eac13,'rows':_0x52bb65}:null;}})['then'](respondWithResult(_0x2c2a4f,null))[_0x0a53('0x1d')](handleError(_0x2c2a4f,null));};exports[_0x0a53('0x118')]=function(_0x3e6372,_0x38058e){return db[_0x0a53('0x119')][_0x0a53('0x4d')]({'where':{'id':_0x3e6372[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x38058e,null))[_0x0a53('0x14')](function(_0xdcc659){if(_0xdcc659){return _0xdcc659[_0x0a53('0x118')](_0x3e6372[_0x0a53('0x4f')][_0x0a53('0x5d')],_[_0x0a53('0xef')](_0x3e6372[_0x0a53('0x4f')],[_0x0a53('0x5d'),'id'])||{});}})[_0x0a53('0x14')](respondWithResult(_0x38058e,null))[_0x0a53('0x1d')](handleError(_0x38058e,null));};exports['getProactiveActions']=function(_0x101d03,_0x3affca){var _0x37fa6f={};var _0x2d686f={};var _0x222457;var _0x2e9cf1;return db[_0x0a53('0x44')][_0x0a53('0x5a')]({'where':{'id':_0x101d03[_0x0a53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3affca,null))[_0x0a53('0x14')](function(_0x87e5fe){if(_0x87e5fe){_0x222457=_0x87e5fe;_0x2d686f['model']=_[_0x0a53('0x35')](db[_0x0a53('0x11a')][_0x0a53('0x4c')]);_0x2d686f['query']=_[_0x0a53('0x35')](_0x101d03[_0x0a53('0x34')]);_0x2d686f[_0x0a53('0x36')]=_[_0x0a53('0x38')](_0x2d686f['model'],_0x2d686f[_0x0a53('0x34')]);_0x37fa6f[_0x0a53('0x37')]=_[_0x0a53('0x38')](_0x2d686f[_0x0a53('0x33')],qs[_0x0a53('0x39')](_0x101d03[_0x0a53('0x34')][_0x0a53('0x39')]));_0x37fa6f['attributes']=_0x37fa6f['attributes'][_0x0a53('0x3a')]?_0x37fa6f[_0x0a53('0x37')]:_0x2d686f[_0x0a53('0x33')];_0x37fa6f[_0x0a53('0x3d')]=qs[_0x0a53('0x3e')](_0x101d03['query'][_0x0a53('0x3e')]);_0x37fa6f['where']=qs[_0x0a53('0x36')](_[_0x0a53('0x40')](_0x101d03[_0x0a53('0x34')],_0x2d686f['filters']));if(_0x101d03[_0x0a53('0x34')][_0x0a53('0x41')]){_0x37fa6f[_0x0a53('0x3f')]=_[_0x0a53('0x42')](_0x37fa6f[_0x0a53('0x3f')],{'$or':_[_0x0a53('0x30')](_0x37fa6f[_0x0a53('0x37')],function(_0x1d111c){var _0x231f36={};_0x231f36[_0x1d111c]={'$like':'%'+_0x101d03[_0x0a53('0x34')]['filter']+'%'};return _0x231f36;})});}_0x37fa6f=_[_0x0a53('0x42')]({},_0x37fa6f,_0x101d03[_0x0a53('0x43')]);return _0x222457[_0x0a53('0x11b')](_0x37fa6f);}})[_0x0a53('0x14')](function(_0x5b2144){if(_0x5b2144){_0x2e9cf1=_0x5b2144['length'];if(!_0x101d03[_0x0a53('0x34')]['hasOwnProperty'](_0x0a53('0x3c'))){_0x37fa6f[_0x0a53('0x22')]=qs[_0x0a53('0x22')](_0x101d03[_0x0a53('0x34')][_0x0a53('0x22')]);_0x37fa6f[_0x0a53('0x25')]=qs['offset'](_0x101d03[_0x0a53('0x34')][_0x0a53('0x25')]);}return _0x222457[_0x0a53('0x11b')](_0x37fa6f);}})[_0x0a53('0x14')](function(_0x3e20f4){if(_0x3e20f4){return _0x3e20f4?{'count':_0x2e9cf1,'rows':_0x3e20f4}:null;}})[_0x0a53('0x14')](respondWithResult(_0x3affca,null))['catch'](handleError(_0x3affca,null));};exports[_0x0a53('0x11c')]=function(_0x5d199a,_0x433b81){var _0x3a4cb3=_0x5d199a[_0x0a53('0x34')][_0x0a53('0x11d')]==='false'?_0x0a53('0x11e'):_0x0a53('0x11f');return db[_0x0a53('0x44')][_0x0a53('0x4d')]({'attributes':['id',_0x3a4cb3],'where':{'id':_0x5d199a[_0x0a53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x433b81,null))['then'](function(_0x123cd9){if(_0x123cd9){var _0x5d6228=_0x123cd9[_0x3a4cb3];var _0x3e95bd=_0x5d6228&&_0x5d6228[_0x0a53('0x120')]?_0x5d6228[_0x0a53('0x120')]:[];_0x433b81['send']({'fromKey':_[_0x0a53('0x6c')](_0x5d6228['fromKey'])?undefined:_0x5d6228[_0x0a53('0x121')],'count':_0x3e95bd[_0x0a53('0x3a')],'rows':_0x3e95bd});}})['catch'](handleError(_0x433b81,null));};exports[_0x0a53('0x122')]=function(_0x41b776,_0x2a2039){var _0x503aac={'raw':![],'where':{}};var _0x34c1c5={};var _0x353ce4={'count':0x0,'rows':[]};return db[_0x0a53('0x44')][_0x0a53('0x5a')]({'where':{'id':_0x41b776[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x2a2039,null))[_0x0a53('0x14')](function(_0x2d9e5c){if(_0x2d9e5c){_0x34c1c5[_0x0a53('0x33')]=_[_0x0a53('0x35')](db[_0x0a53('0xd0')][_0x0a53('0x4c')]);_0x34c1c5[_0x0a53('0x34')]=_['keys'](_0x41b776['query']);_0x34c1c5['filters']=_[_0x0a53('0x38')](_0x34c1c5[_0x0a53('0x33')],_0x34c1c5[_0x0a53('0x34')]);_0x503aac[_0x0a53('0x37')]=_[_0x0a53('0x38')](_0x34c1c5['model'],qs[_0x0a53('0x39')](_0x41b776['query'][_0x0a53('0x39')]));_0x503aac[_0x0a53('0x37')]=_0x503aac[_0x0a53('0x37')][_0x0a53('0x3a')]?_0x503aac['attributes']:_0x34c1c5[_0x0a53('0x33')];if(!_0x41b776[_0x0a53('0x34')][_0x0a53('0x3b')](_0x0a53('0x3c'))){_0x503aac[_0x0a53('0x22')]=qs[_0x0a53('0x22')](_0x41b776['query'][_0x0a53('0x22')]);_0x503aac[_0x0a53('0x25')]=qs[_0x0a53('0x25')](_0x41b776[_0x0a53('0x34')]['offset']);}_0x503aac[_0x0a53('0x3d')]=qs[_0x0a53('0x3e')](_0x41b776[_0x0a53('0x34')][_0x0a53('0x3e')]);_0x503aac[_0x0a53('0x3f')]=qs[_0x0a53('0x36')](_['pick'](_0x41b776[_0x0a53('0x34')],_0x34c1c5[_0x0a53('0x36')]));_0x503aac[_0x0a53('0x3f')][_0x0a53('0x5b')]=_0x2d9e5c['id'];if(_0x41b776[_0x0a53('0x34')]['filter']){_0x503aac['where']=_[_0x0a53('0x42')](_0x503aac['where'],{'$or':_[_0x0a53('0x30')](_0x503aac['attributes'],function(_0x5962ee){var _0x27d8a4={};_0x27d8a4[_0x5962ee]={'$like':'%'+_0x41b776[_0x0a53('0x34')]['filter']+'%'};return _0x27d8a4;})});}_0x503aac=_[_0x0a53('0x42')]({},_0x503aac,_0x41b776[_0x0a53('0x43')]);return db['ChatOfflineMessage'][_0x0a53('0x24')]({'where':_0x503aac[_0x0a53('0x3f')]})[_0x0a53('0x14')](function(_0xa51ffe){_0x353ce4['count']=_0xa51ffe;if(_0x41b776[_0x0a53('0x34')][_0x0a53('0x45')]){_0x503aac[_0x0a53('0x46')]=[{'all':!![]}];}else{_0x503aac['include']=[{'model':db[_0x0a53('0x8f')],'as':_0x0a53('0xf1'),'required':![]},{'model':db[_0x0a53('0x123')],'as':_0x0a53('0x124'),'required':![]}];}return db[_0x0a53('0xd0')][_0x0a53('0x47')](_0x503aac);})[_0x0a53('0x14')](function(_0x4223ab){_0x353ce4[_0x0a53('0x48')]=_0x4223ab;return _0x353ce4;});}})['then'](respondWithFilteredResult(_0x2a2039,_0x503aac))[_0x0a53('0x1d')](handleError(_0x2a2039,null));};exports['addAgents']=function(_0x6db847,_0x31c942){return db[_0x0a53('0x44')][_0x0a53('0x4d')]({'where':{'id':_0x6db847[_0x0a53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x31c942,null))[_0x0a53('0x14')](function(_0x133bd8){if(_0x133bd8){return _0x133bd8[_0x0a53('0x125')](_0x6db847[_0x0a53('0x4f')][_0x0a53('0x5d')],_[_0x0a53('0xef')](_0x6db847[_0x0a53('0x4f')],[_0x0a53('0x5d'),'id'])||{})[_0x0a53('0xb2')](function(_0x490011){for(var _0x4d8dd4=0x0;_0x4d8dd4<_0x6db847['body'][_0x0a53('0x5d')][_0x0a53('0x3a')];_0x4d8dd4+=0x1){socket[_0x0a53('0x126')](_0x0a53('0x127'),{'UserId':Number(_0x6db847[_0x0a53('0x4f')][_0x0a53('0x5d')][_0x4d8dd4]),'ChatWebsiteId':Number(_0x6db847[_0x0a53('0x4a')]['id'])});}return _0x490011;});}})[_0x0a53('0x14')](respondWithResult(_0x31c942,null))[_0x0a53('0x1d')](handleError(_0x31c942,null));};exports[_0x0a53('0x128')]=function(_0x5d5e62,_0x175eca){return db[_0x0a53('0x44')][_0x0a53('0x4d')]({'where':{'id':_0x5d5e62[_0x0a53('0x4a')]['id']}})[_0x0a53('0x14')](handleEntityNotFound(_0x175eca,null))[_0x0a53('0x14')](function(_0x46b113){if(_0x46b113){return _0x46b113[_0x0a53('0x128')](_0x5d5e62['query'][_0x0a53('0x5d')])[_0x0a53('0x14')](function(){if(_['isArray'](_0x5d5e62[_0x0a53('0x34')][_0x0a53('0x5d')])){for(var _0x3402c1=0x0;_0x3402c1<_0x5d5e62[_0x0a53('0x34')][_0x0a53('0x5d')]['length'];_0x3402c1+=0x1){socket[_0x0a53('0x126')](_0x0a53('0x129'),{'UserId':Number(_0x5d5e62[_0x0a53('0x34')][_0x0a53('0x5d')][_0x3402c1]),'ChatWebsiteId':Number(_0x5d5e62[_0x0a53('0x4a')]['id'])});}}else{socket[_0x0a53('0x126')](_0x0a53('0x129'),{'UserId':Number(_0x5d5e62[_0x0a53('0x34')][_0x0a53('0x5d')]),'ChatWebsiteId':Number(_0x5d5e62[_0x0a53('0x4a')]['id'])});}});}})[_0x0a53('0x14')](respondWithStatusCode(_0x175eca,null))[_0x0a53('0x1d')](handleError(_0x175eca,null));};exports[_0x0a53('0x12a')]=function(_0x5f11f3,_0x486eab){var _0x5929c7={};var _0x3865b5={};var _0xc87833;var _0x14fa32;return db[_0x0a53('0x44')][_0x0a53('0x5a')]({'where':{'id':_0x5f11f3[_0x0a53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x486eab,null))[_0x0a53('0x14')](function(_0x12ab73){if(_0x12ab73){_0xc87833=_0x12ab73;_0x3865b5['model']=_['keys'](db[_0x0a53('0xba')]['rawAttributes']);_0x3865b5[_0x0a53('0x34')]=_[_0x0a53('0x35')](_0x5f11f3[_0x0a53('0x34')]);_0x3865b5[_0x0a53('0x36')]=_['intersection'](_0x3865b5[_0x0a53('0x33')],_0x3865b5[_0x0a53('0x34')]);_0x5929c7[_0x0a53('0x37')]=_[_0x0a53('0x38')](_0x3865b5['model'],qs[_0x0a53('0x39')](_0x5f11f3[_0x0a53('0x34')][_0x0a53('0x39')]));_0x5929c7[_0x0a53('0x37')]=_0x5929c7[_0x0a53('0x37')][_0x0a53('0x3a')]?_0x5929c7[_0x0a53('0x37')]:_0x3865b5[_0x0a53('0x33')];_0x5929c7[_0x0a53('0x3d')]=qs[_0x0a53('0x3e')](_0x5f11f3[_0x0a53('0x34')][_0x0a53('0x3e')]);_0x5929c7[_0x0a53('0x3f')]=qs['filters'](_[_0x0a53('0x40')](_0x5f11f3['query'],_0x3865b5['filters']));if(_0x5f11f3[_0x0a53('0x34')][_0x0a53('0x41')]){_0x5929c7['where']=_['merge'](_0x5929c7[_0x0a53('0x3f')],{'$or':_[_0x0a53('0x30')](_0x5929c7[_0x0a53('0x37')],function(_0x42d870){var _0x18f64b={};_0x18f64b[_0x42d870]={'$like':'%'+_0x5f11f3[_0x0a53('0x34')]['filter']+'%'};return _0x18f64b;})});}_0x5929c7=_[_0x0a53('0x42')]({},_0x5929c7,_0x5f11f3[_0x0a53('0x43')]);return _0xc87833[_0x0a53('0x12a')](_0x5929c7);}})[_0x0a53('0x14')](function(_0x1fd100){if(_0x1fd100){_0x14fa32=_0x1fd100[_0x0a53('0x3a')];if(!_0x5f11f3[_0x0a53('0x34')]['hasOwnProperty']('nolimit')){_0x5929c7['limit']=qs[_0x0a53('0x22')](_0x5f11f3[_0x0a53('0x34')][_0x0a53('0x22')]);_0x5929c7[_0x0a53('0x25')]=qs[_0x0a53('0x25')](_0x5f11f3[_0x0a53('0x34')][_0x0a53('0x25')]);}return _0xc87833[_0x0a53('0x12a')](_0x5929c7);}})[_0x0a53('0x14')](function(_0x2cf21b){if(_0x2cf21b){return _0x2cf21b?{'count':_0x14fa32,'rows':_0x2cf21b}:null;}})[_0x0a53('0x14')](respondWithResult(_0x486eab,null))['catch'](handleError(_0x486eab,null));}; \ No newline at end of file +var _0x049d=['describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','merge','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','existsSync','setUA','user-agent','getResult','chat','Sequelize','difference','createdAt','updatedAt','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Applications','account','list','applications','orderBy','priority','asc','CmContact','customerIp','headers','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','files','no\x20available\x20attributes','CompanyId','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','mapKeyOffline','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','offlineMessageBody','fromString','originalname','mimetype','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','user','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Owner','fullname','internal','Tags','tag','timezone','iftime\x20%s','interval','true','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','getSnippet','Interval','Intervals','getProactiveActions','virtual','custom','License','chatLicenseExceeded','all','some','utf8','URL','origin','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','hideWhenOffline','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','omit','ChatProactiveAction','getFields','false','onlineForm','items','getOfflineMessages','ChatOfflineMessage','Contact','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','ejs','fs-extra','lodash','querystring','ioredis','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','options','ChatWebsite','includeAll','include','findAll','rows','show','mandatoryDispositionPause','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','params'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x049d,0xcf));var _0xd049=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x049d[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xd049('0x0'));var Mustache=require(_0xd049('0x1'));var util=require('util');var path=require('path');var ejs=require(_0xd049('0x2'));var fs=require('fs');var fs_extra=require(_0xd049('0x3'));var _=require(_0xd049('0x4'));var querystring=require(_0xd049('0x5'));var Redis=require(_0xd049('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd049('0x7'));var config=require('../../config/environment');var url=require('url');var db=require(_0xd049('0x8'))['db'];config['redis']=_['defaults'](config[_0xd049('0x9')],{'host':_0xd049('0xa'),'port':0x18eb});var socket=require(_0xd049('0xb'))(new Redis(config[_0xd049('0x9')]));require(_0xd049('0xc'))[_0xd049('0xd')](socket);var htmlToText=require(_0xd049('0xe'));var jayson=require(_0xd049('0xf'));var client=jayson['client'][_0xd049('0x10')]({'port':0x232c});var client9002=jayson[_0xd049('0x11')][_0xd049('0x10')]({'port':0x232a});var client9003=jayson[_0xd049('0x11')]['http']({'port':0x232b});var client9001=jayson[_0xd049('0x11')][_0xd049('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x25179a,_0x1fcee3,_0x1e503a,_0x5bb4cf){return new BPromise(function(_0x52f591,_0x42ef63){var _0x157555=_0x5bb4cf||client;return _0x157555[_0xd049('0x12')](_0x25179a,_0x1e503a)[_0xd049('0x13')](function(_0x2117e7){logger[_0xd049('0x14')](_0xd049('0x15'),_0x1fcee3,'request\x20sent');logger[_0xd049('0x16')](_0xd049('0x17'),_0x1fcee3,_0xd049('0x18'),JSON[_0xd049('0x19')](_0x2117e7));if(_0x2117e7[_0xd049('0x1a')]){if(_0x2117e7[_0xd049('0x1a')][_0xd049('0x1b')]===0x1f4){logger[_0xd049('0x1a')](_0xd049('0x15'),_0x1fcee3,_0x2117e7['error'][_0xd049('0x1c')]);return _0x42ef63(_0x2117e7[_0xd049('0x1a')][_0xd049('0x1c')]);}logger[_0xd049('0x1a')](_0xd049('0x15'),_0x1fcee3,_0x2117e7[_0xd049('0x1a')][_0xd049('0x1c')]);return _0x52f591(_0x2117e7[_0xd049('0x1a')][_0xd049('0x1c')]);}else{logger['info'](_0xd049('0x15'),_0x1fcee3,_0xd049('0x18'));_0x52f591(_0x2117e7['result'][_0xd049('0x1c')]);}})[_0xd049('0x1d')](function(_0x26e80d){logger[_0xd049('0x1a')](_0xd049('0x15'),_0x1fcee3,_0x26e80d);_0x42ef63(_0x26e80d);});});}function respondWithStatusCode(_0x5f4b3c,_0x5db176){_0x5db176=_0x5db176||0xcc;return function(_0x1e6976){if(_0x1e6976){return _0x5f4b3c[_0xd049('0x1e')](_0x5db176);}return _0x5f4b3c[_0xd049('0x1f')](_0x5db176)[_0xd049('0x20')]();};}function respondWithResult(_0x33255c,_0x4b0ed4){_0x4b0ed4=_0x4b0ed4||0xc8;return function(_0x1e3293){if(_0x1e3293){return _0x33255c['status'](_0x4b0ed4)['json'](_0x1e3293);}};}function respondWithFilteredResult(_0xfeeaf9,_0x241cc3){return function(_0x1ea484){if(_0x1ea484){var _0x53a110=typeof _0x241cc3[_0xd049('0x21')]===_0xd049('0x22')&&typeof _0x241cc3[_0xd049('0x23')]===_0xd049('0x22');var _0x4ac63b=_0x1ea484[_0xd049('0x24')];var _0x571068=_0x53a110?0x0:_0x241cc3[_0xd049('0x21')];var _0x440c39=_0x53a110?_0x1ea484['count']:_0x241cc3[_0xd049('0x21')]+_0x241cc3[_0xd049('0x23')];var _0x30c3d8;if(_0x440c39>=_0x4ac63b){_0x440c39=_0x4ac63b;_0x30c3d8=0xc8;}else{_0x30c3d8=0xce;}_0xfeeaf9[_0xd049('0x1f')](_0x30c3d8);return _0xfeeaf9[_0xd049('0x25')]('Content-Range',_0x571068+'-'+_0x440c39+'/'+_0x4ac63b)[_0xd049('0x26')](_0x1ea484);}return null;};}function saveUpdates(_0x5e61d3){return function(_0x263e7d){if(_0x263e7d){return _0x263e7d[_0xd049('0x27')](_0x5e61d3)[_0xd049('0x13')](function(_0xd40933){return _0xd40933;});}return null;};}function removeEntity(_0x382080){return function(_0x1fe16d){if(_0x1fe16d){return _0x1fe16d[_0xd049('0x28')]()[_0xd049('0x13')](function(){var _0x1c8007=_0x1fe16d[_0xd049('0x29')]({'plain':!![]});var _0x35097e='ChatWebsites';return db[_0xd049('0x2a')]['destroy']({'where':{'type':_0x35097e,'resourceId':_0x1c8007['id']}})['then'](function(){return _0x1fe16d;});})[_0xd049('0x13')](function(){_0x382080[_0xd049('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a7470){return function(_0x4da09a){if(!_0x4da09a){_0x5a7470[_0xd049('0x1e')](0x194);}return _0x4da09a;};}function handleError(_0x69199d,_0x1b05a3){_0x1b05a3=_0x1b05a3||0x1f4;return function(_0x9b53f6){logger[_0xd049('0x1a')](_0x9b53f6[_0xd049('0x2b')]);if(_0x9b53f6['name']){delete _0x9b53f6[_0xd049('0x2c')];}_0x69199d[_0xd049('0x1f')](_0x1b05a3)[_0xd049('0x2d')](_0x9b53f6);};}exports[_0xd049('0x2e')]=function(_0x71e6fc,_0x170a1e){var _0x4418bb={'include':[{'model':db[_0xd049('0x2f')],'as':'mandatoryDispositionPause'}]},_0x5b56f8={},_0x2bb61d={'count':0x0,'rows':[]};var _0x27742b=_['map'](db['ChatWebsite'][_0xd049('0x30')],function(_0x2a2be9){return{'name':_0x2a2be9[_0xd049('0x31')],'type':_0x2a2be9['type']['key']};});_0x5b56f8[_0xd049('0x32')]=_[_0xd049('0x33')](_0x27742b,_0xd049('0x2c'));_0x5b56f8[_0xd049('0x34')]=_[_0xd049('0x35')](_0x71e6fc[_0xd049('0x34')]);_0x5b56f8[_0xd049('0x36')]=_[_0xd049('0x37')](_0x5b56f8[_0xd049('0x32')],_0x5b56f8[_0xd049('0x34')]);_0x4418bb[_0xd049('0x38')]=_[_0xd049('0x37')](_0x5b56f8['model'],qs['fields'](_0x71e6fc[_0xd049('0x34')][_0xd049('0x39')]));_0x4418bb[_0xd049('0x38')]=_0x4418bb[_0xd049('0x38')][_0xd049('0x3a')]?_0x4418bb['attributes']:_0x5b56f8[_0xd049('0x32')];if(!_0x71e6fc[_0xd049('0x34')][_0xd049('0x3b')](_0xd049('0x3c'))){_0x4418bb['limit']=qs[_0xd049('0x23')](_0x71e6fc[_0xd049('0x34')]['limit']);_0x4418bb[_0xd049('0x21')]=qs[_0xd049('0x21')](_0x71e6fc[_0xd049('0x34')][_0xd049('0x21')]);}_0x4418bb[_0xd049('0x3d')]=qs[_0xd049('0x3e')](_0x71e6fc['query'][_0xd049('0x3e')]);_0x4418bb['where']=qs[_0xd049('0x36')](_[_0xd049('0x3f')](_0x71e6fc[_0xd049('0x34')],_0x5b56f8[_0xd049('0x36')]),_0x27742b);if(_0x71e6fc['query']['filter']){_0x4418bb[_0xd049('0x40')]=_['merge'](_0x4418bb['where'],{'$or':_[_0xd049('0x33')](_0x27742b,function(_0x509207){if(_0x509207[_0xd049('0x41')]!==_0xd049('0x42')){var _0x257cfa={};_0x257cfa[_0x509207['name']]={'$like':'%'+_0x71e6fc[_0xd049('0x34')][_0xd049('0x43')]+'%'};return _0x257cfa;}})});}_0x4418bb=_['merge']({},_0x4418bb,_0x71e6fc[_0xd049('0x44')]);var _0x6cf10={'where':_0x4418bb[_0xd049('0x40')]};return db[_0xd049('0x45')]['count'](_0x6cf10)['then'](function(_0x4ce495){_0x2bb61d[_0xd049('0x24')]=_0x4ce495;if(_0x71e6fc['query'][_0xd049('0x46')]){_0x4418bb[_0xd049('0x47')]=[{'all':!![]}];}return db[_0xd049('0x45')][_0xd049('0x48')](_0x4418bb);})[_0xd049('0x13')](function(_0x59643d){_0x2bb61d[_0xd049('0x49')]=_0x59643d;return _0x2bb61d;})[_0xd049('0x13')](respondWithFilteredResult(_0x170a1e,_0x4418bb))[_0xd049('0x1d')](handleError(_0x170a1e,null));};exports[_0xd049('0x4a')]=function(_0xdad9de,_0x1a135f){var _0x43c540={'raw':![],'where':{'id':_0xdad9de['params']['id']},'include':[{'model':db['Pause'],'as':_0xd049('0x4b')}]},_0x3c5553={};_0x3c5553[_0xd049('0x32')]=_[_0xd049('0x35')](db[_0xd049('0x45')]['rawAttributes']);_0x3c5553[_0xd049('0x34')]=_['keys'](_0xdad9de[_0xd049('0x34')]);_0x3c5553[_0xd049('0x36')]=_[_0xd049('0x37')](_0x3c5553[_0xd049('0x32')],_0x3c5553[_0xd049('0x34')]);_0x43c540[_0xd049('0x38')]=_[_0xd049('0x37')](_0x3c5553['model'],qs[_0xd049('0x39')](_0xdad9de[_0xd049('0x34')][_0xd049('0x39')]));_0x43c540[_0xd049('0x38')]=_0x43c540[_0xd049('0x38')]['length']?_0x43c540[_0xd049('0x38')]:_0x3c5553[_0xd049('0x32')];if(_0xdad9de['query'][_0xd049('0x46')]){_0x43c540[_0xd049('0x47')]=[{'all':!![]}];}_0x43c540=_['merge']({},_0x43c540,_0xdad9de[_0xd049('0x44')]);return db[_0xd049('0x45')]['find'](_0x43c540)[_0xd049('0x13')](handleEntityNotFound(_0x1a135f,null))['then'](respondWithResult(_0x1a135f,null))['catch'](handleError(_0x1a135f,null));};exports[_0xd049('0x4c')]=function(_0x22e4bc,_0x305a52){return db['ChatWebsite'][_0xd049('0x4c')](_0x22e4bc[_0xd049('0x4d')],{})[_0xd049('0x13')](function(_0x1f8dd2){var _0x301625=_0x22e4bc['user'][_0xd049('0x29')]({'plain':!![]});if(!_0x301625)throw new Error(_0xd049('0x4e'));if(_0x301625[_0xd049('0x4f')]==='user'){var _0x2d9b6d=_0x1f8dd2[_0xd049('0x29')]({'plain':!![]});var _0x1b4159='ChatWebsites';return db[_0xd049('0x50')]['find']({'where':{'name':_0x1b4159,'userProfileId':_0x301625['userProfileId']},'raw':!![]})['then'](function(_0x3f10ca){if(_0x3f10ca&&_0x3f10ca['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2d9b6d[_0xd049('0x2c')],'resourceId':_0x2d9b6d['id'],'type':_0x3f10ca[_0xd049('0x2c')],'sectionId':_0x3f10ca['id']},{})[_0xd049('0x13')](function(){return _0x1f8dd2;});}else{return _0x1f8dd2;}})['catch'](function(_0x5dce70){logger[_0xd049('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dce70);throw _0x5dce70;});}return _0x1f8dd2;})[_0xd049('0x13')](respondWithResult(_0x305a52,0xc9))[_0xd049('0x1d')](handleError(_0x305a52,null));};exports[_0xd049('0x27')]=function(_0x23f7ba,_0x2eefa6){if(_0x23f7ba['body']['id']){delete _0x23f7ba['body']['id'];}return db['ChatWebsite'][_0xd049('0x51')]({'where':{'id':_0x23f7ba[_0xd049('0x52')]['id']},'include':[{'model':db[_0xd049('0x2f')],'as':_0xd049('0x4b')}]})[_0xd049('0x13')](handleEntityNotFound(_0x2eefa6,null))['then'](saveUpdates(_0x23f7ba['body'],null))[_0xd049('0x13')](respondWithResult(_0x2eefa6,null))[_0xd049('0x1d')](handleError(_0x2eefa6,null));};exports[_0xd049('0x28')]=function(_0x45ebb3,_0x295d49){return db['ChatWebsite'][_0xd049('0x51')]({'where':{'id':_0x45ebb3['params']['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x295d49,null))[_0xd049('0x13')](removeEntity(_0x295d49,null))[_0xd049('0x1d')](handleError(_0x295d49,null));};exports[_0xd049('0x53')]=function(_0x40fac7,_0x487c55){return db['ChatWebsite'][_0xd049('0x53')]()['then'](respondWithResult(_0x487c55,null))['catch'](handleError(_0x487c55,null));};exports[_0xd049('0x54')]=function(_0x22b839,_0x13cddc){if(_0x22b839[_0xd049('0x4d')]['id']){delete _0x22b839[_0xd049('0x4d')]['id'];}return db[_0xd049('0x45')]['find']({'where':{'id':_0x22b839['params']['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x13cddc,null))['then'](function(_0x3798c5){if(_0x3798c5){_0x22b839[_0xd049('0x4d')][_0xd049('0x55')]=_0x3798c5['id'];return db['Disposition'][_0xd049('0x4c')](_0x22b839[_0xd049('0x4d')]);}})['then'](respondWithResult(_0x13cddc,null))[_0xd049('0x1d')](handleError(_0x13cddc,null));};exports[_0xd049('0x56')]=function(_0x3aa0db,_0x528b6e){var _0x4b176f={'raw':![],'where':{}};var _0x103df6={};var _0x33dfa4={'count':0x0,'rows':[]};return db[_0xd049('0x45')][_0xd049('0x57')]({'where':{'id':_0x3aa0db[_0xd049('0x52')]['id']}})['then'](handleEntityNotFound(_0x528b6e,null))[_0xd049('0x13')](function(_0x21dd5f){if(_0x21dd5f){_0x103df6[_0xd049('0x32')]=_['keys'](db[_0xd049('0x58')]['rawAttributes']);_0x103df6[_0xd049('0x34')]=_[_0xd049('0x35')](_0x3aa0db[_0xd049('0x34')]);_0x103df6['filters']=_[_0xd049('0x37')](_0x103df6[_0xd049('0x32')],_0x103df6[_0xd049('0x34')]);_0x4b176f[_0xd049('0x38')]=_[_0xd049('0x37')](_0x103df6[_0xd049('0x32')],qs[_0xd049('0x39')](_0x3aa0db[_0xd049('0x34')]['fields']));_0x4b176f['attributes']=_0x4b176f[_0xd049('0x38')][_0xd049('0x3a')]?_0x4b176f['attributes']:_0x103df6[_0xd049('0x32')];if(!_0x3aa0db['query']['hasOwnProperty'](_0xd049('0x3c'))){_0x4b176f[_0xd049('0x23')]=qs[_0xd049('0x23')](_0x3aa0db[_0xd049('0x34')][_0xd049('0x23')]);_0x4b176f[_0xd049('0x21')]=qs[_0xd049('0x21')](_0x3aa0db[_0xd049('0x34')][_0xd049('0x21')]);}_0x4b176f[_0xd049('0x3d')]=qs[_0xd049('0x3e')](_0x3aa0db[_0xd049('0x34')][_0xd049('0x3e')]);_0x4b176f[_0xd049('0x40')]=qs['filters'](_['pick'](_0x3aa0db[_0xd049('0x34')],_0x103df6[_0xd049('0x36')]));_0x4b176f[_0xd049('0x40')]['ChatWebsiteId']=_0x21dd5f['id'];if(_0x3aa0db['query'][_0xd049('0x43')]){_0x4b176f[_0xd049('0x40')]=_[_0xd049('0x59')](_0x4b176f[_0xd049('0x40')],{'$or':_[_0xd049('0x33')](_0x4b176f[_0xd049('0x38')],function(_0x5886f2){var _0x57f547={};_0x57f547[_0x5886f2]={'$like':'%'+_0x3aa0db[_0xd049('0x34')][_0xd049('0x43')]+'%'};return _0x57f547;})});}_0x4b176f=_[_0xd049('0x59')]({},_0x4b176f,_0x3aa0db['options']);return db[_0xd049('0x58')]['count']({'where':_0x4b176f[_0xd049('0x40')]})[_0xd049('0x13')](function(_0xa641e9){_0x33dfa4[_0xd049('0x24')]=_0xa641e9;if(_0x3aa0db[_0xd049('0x34')][_0xd049('0x46')]){_0x4b176f[_0xd049('0x47')]=[{'all':!![]}];}return db[_0xd049('0x58')]['findAll'](_0x4b176f);})['then'](function(_0xdd46cf){_0x33dfa4['rows']=_0xdd46cf;return _0x33dfa4;});}})[_0xd049('0x13')](respondWithFilteredResult(_0x528b6e,_0x4b176f))[_0xd049('0x1d')](handleError(_0x528b6e,null));};exports['removeDispositions']=function(_0x459f7c,_0x20cc9c){return db['ChatWebsite'][_0xd049('0x51')]({'where':{'id':_0x459f7c[_0xd049('0x52')]['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x20cc9c,null))[_0xd049('0x13')](function(_0x5760e0){if(_0x5760e0){return _0x5760e0[_0xd049('0x5a')](_0x459f7c['query'][_0xd049('0x5b')]);}})[_0xd049('0x13')](respondWithStatusCode(_0x20cc9c,null))['catch'](handleError(_0x20cc9c,null));};exports[_0xd049('0x5c')]=function(_0x329843,_0x24ea1f){if(_0x329843[_0xd049('0x4d')]['id']){delete _0x329843[_0xd049('0x4d')]['id'];}return db[_0xd049('0x45')][_0xd049('0x51')]({'where':{'id':_0x329843[_0xd049('0x52')]['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x24ea1f,null))['then'](function(_0x4a0762){if(_0x4a0762){_0x329843[_0xd049('0x4d')][_0xd049('0x55')]=_0x4a0762['id'];return db[_0xd049('0x5d')][_0xd049('0x4c')](_0x329843[_0xd049('0x4d')]);}})['then'](respondWithResult(_0x24ea1f,null))['catch'](handleError(_0x24ea1f,null));};exports[_0xd049('0x5e')]=function(_0x38856e,_0x5c1100){var _0x721048={'raw':![],'where':{}};var _0x25c8c7={};var _0x6a7d19={'count':0x0,'rows':[]};return db[_0xd049('0x45')][_0xd049('0x57')]({'where':{'id':_0x38856e['params']['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x5c1100,null))[_0xd049('0x13')](function(_0x16c02d){if(_0x16c02d){_0x25c8c7['model']=_[_0xd049('0x35')](db[_0xd049('0x5d')]['rawAttributes']);_0x25c8c7[_0xd049('0x34')]=_['keys'](_0x38856e['query']);_0x25c8c7[_0xd049('0x36')]=_[_0xd049('0x37')](_0x25c8c7['model'],_0x25c8c7['query']);_0x721048[_0xd049('0x38')]=_[_0xd049('0x37')](_0x25c8c7[_0xd049('0x32')],qs[_0xd049('0x39')](_0x38856e[_0xd049('0x34')][_0xd049('0x39')]));_0x721048['attributes']=_0x721048['attributes'][_0xd049('0x3a')]?_0x721048[_0xd049('0x38')]:_0x25c8c7[_0xd049('0x32')];if(!_0x38856e[_0xd049('0x34')][_0xd049('0x3b')]('nolimit')){_0x721048['limit']=qs[_0xd049('0x23')](_0x38856e[_0xd049('0x34')][_0xd049('0x23')]);_0x721048[_0xd049('0x21')]=qs[_0xd049('0x21')](_0x38856e[_0xd049('0x34')][_0xd049('0x21')]);}_0x721048[_0xd049('0x3d')]=qs[_0xd049('0x3e')](_0x38856e[_0xd049('0x34')][_0xd049('0x3e')]);_0x721048[_0xd049('0x40')]=qs[_0xd049('0x36')](_[_0xd049('0x3f')](_0x38856e['query'],_0x25c8c7['filters']));_0x721048[_0xd049('0x40')][_0xd049('0x55')]=_0x16c02d['id'];if(_0x38856e['query']['filter']){_0x721048[_0xd049('0x40')]=_[_0xd049('0x59')](_0x721048[_0xd049('0x40')],{'$or':_[_0xd049('0x33')](_0x721048[_0xd049('0x38')],function(_0x368fba){var _0x4bd406={};_0x4bd406[_0x368fba]={'$like':'%'+_0x38856e[_0xd049('0x34')]['filter']+'%'};return _0x4bd406;})});}_0x721048=_[_0xd049('0x59')]({},_0x721048,_0x38856e[_0xd049('0x44')]);return db[_0xd049('0x5d')]['count']({'where':_0x721048['where']})[_0xd049('0x13')](function(_0x46ae59){_0x6a7d19[_0xd049('0x24')]=_0x46ae59;if(_0x38856e[_0xd049('0x34')][_0xd049('0x46')]){_0x721048[_0xd049('0x47')]=[{'all':!![]}];}return db[_0xd049('0x5d')][_0xd049('0x48')](_0x721048);})[_0xd049('0x13')](function(_0x5de90a){_0x6a7d19[_0xd049('0x49')]=_0x5de90a;return _0x6a7d19;});}})['then'](respondWithFilteredResult(_0x5c1100,_0x721048))['catch'](handleError(_0x5c1100,null));};exports[_0xd049('0x5f')]=function(_0x358266,_0xcb2a42){return db['ChatWebsite'][_0xd049('0x51')]({'where':{'id':_0x358266[_0xd049('0x52')]['id']}})['then'](handleEntityNotFound(_0xcb2a42,null))[_0xd049('0x13')](function(_0x343176){if(_0x343176){return _0x343176['removeAnswers'](_0x358266[_0xd049('0x34')][_0xd049('0x5b')]);}})[_0xd049('0x13')](respondWithStatusCode(_0xcb2a42,null))[_0xd049('0x1d')](handleError(_0xcb2a42,null));};exports['addLogo']=function(_0x1cd9a8,_0x3576ec){_0x1cd9a8[_0xd049('0x4d')][_0xd049('0x60')]=_0x1cd9a8[_0xd049('0x61')][_0xd049('0x62')];return db['ChatWebsite']['find']({'where':{'id':_0x1cd9a8[_0xd049('0x52')]['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x3576ec,null))[_0xd049('0x13')](saveUpdates(_0x1cd9a8[_0xd049('0x4d')],null))[_0xd049('0x13')](respondWithResult(_0x3576ec,null))[_0xd049('0x1d')](handleError(_0x3576ec,null));};exports[_0xd049('0x63')]=function(_0x3847a0,_0x3e1b71){_0x3847a0['body'][_0xd049('0x64')]=_0x3847a0[_0xd049('0x61')][_0xd049('0x62')];return db[_0xd049('0x45')][_0xd049('0x51')]({'where':{'id':_0x3847a0[_0xd049('0x52')]['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x3e1b71,null))[_0xd049('0x13')](saveUpdates(_0x3847a0[_0xd049('0x4d')],null))[_0xd049('0x13')](respondWithResult(_0x3e1b71,null))[_0xd049('0x1d')](handleError(_0x3e1b71,null));};exports[_0xd049('0x65')]=function(_0x1161ad,_0x4478f5){_0x1161ad[_0xd049('0x4d')][_0xd049('0x66')]=_0x1161ad[_0xd049('0x61')][_0xd049('0x62')];return db[_0xd049('0x45')][_0xd049('0x51')]({'where':{'id':_0x1161ad['params']['id']}})['then'](handleEntityNotFound(_0x4478f5,null))[_0xd049('0x13')](saveUpdates(_0x1161ad['body'],null))[_0xd049('0x13')](respondWithResult(_0x4478f5,null))[_0xd049('0x1d')](handleError(_0x4478f5,null));};exports[_0xd049('0x67')]=function(_0x128577,_0x51bbd7){_0x128577[_0xd049('0x4d')][_0xd049('0x68')]=_0x128577[_0xd049('0x61')]['filename'];return db[_0xd049('0x45')][_0xd049('0x51')]({'where':{'id':_0x128577[_0xd049('0x52')]['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x51bbd7,null))['then'](saveUpdates(_0x128577['body'],null))[_0xd049('0x13')](respondWithResult(_0x51bbd7,null))[_0xd049('0x1d')](handleError(_0x51bbd7,null));};exports[_0xd049('0x69')]=function(_0xb1b24b,_0x5b9863){var _0x1eb738=path[_0xd049('0x6a')](config[_0xd049('0x6b')],'server/files/images/logos/default_logo.svg');var _0x43c35f={'where':{'id':_0xb1b24b[_0xd049('0x52')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x2530fb=![];return require(_0xd049('0x6c'))[_0xd049('0x6d')]()[_0xd049('0x13')](function(_0x2a5459){if(_0x2a5459){_0x2530fb=_0x2a5459['custom'];}})[_0xd049('0x13')](function(){return db['ChatWebsite'][_0xd049('0x51')](_0x43c35f);})[_0xd049('0x13')](handleEntityNotFound(_0x5b9863,null))[_0xd049('0x13')](function(_0xbdd754){if(_0xbdd754){if(!_['isNil'](_0xbdd754['sitepic'])){if(fs['existsSync'](path['join'](config[_0xd049('0x6b')],_0xd049('0x6e'),_0xbdd754[_0xd049('0x60')]))&&_0x2530fb){_0x1eb738=path[_0xd049('0x6a')](config[_0xd049('0x6b')],_0xd049('0x6e'),_0xbdd754[_0xd049('0x60')]);}}return _0x5b9863[_0xd049('0x6f')](_0x1eb738);}})[_0xd049('0x1d')](handleError(_0x5b9863,null));};exports[_0xd049('0x70')]=function(_0x20962a,_0x529339){var _0x599226=path['join'](config[_0xd049('0x6b')],_0xd049('0x71'));var _0x3a649a={'where':{'id':_0x20962a[_0xd049('0x52')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0xd049('0x51')](_0x3a649a)[_0xd049('0x13')](handleEntityNotFound(_0x529339,null))[_0xd049('0x13')](function(_0x2439c9){if(_0x2439c9){if(!_[_0xd049('0x72')](_0x2439c9[_0xd049('0x64')])){if(fs['existsSync'](path[_0xd049('0x6a')](config[_0xd049('0x6b')],'server/files/images/avatars/',_0x2439c9[_0xd049('0x64')]))){_0x599226=path[_0xd049('0x6a')](config[_0xd049('0x6b')],_0xd049('0x73'),_0x2439c9[_0xd049('0x64')]);}}return _0x529339['download'](_0x599226);}})[_0xd049('0x1d')](handleError(_0x529339,null));};exports['getCustomerAvatar']=function(_0x4f0925,_0x43bca1){var _0x23fdcf=path[_0xd049('0x6a')](config['root'],_0xd049('0x74'));var _0x287dbb={'where':{'id':_0x4f0925[_0xd049('0x52')]['id']},'attributes':['id','customerAvatar',_0xd049('0x75')],'raw':!![]};return db[_0xd049('0x45')][_0xd049('0x51')](_0x287dbb)['then'](handleEntityNotFound(_0x43bca1,null))[_0xd049('0x13')](function(_0xa8df35){if(_0xa8df35){if(!_['isNil'](_0xa8df35['customerAvatar'])){if(fs['existsSync'](path[_0xd049('0x6a')](config['root'],_0xd049('0x73'),_0xa8df35[_0xd049('0x66')]))&&_0xa8df35['showCustomerAvatar']){_0x23fdcf=path[_0xd049('0x6a')](config[_0xd049('0x6b')],_0xd049('0x73'),_0xa8df35[_0xd049('0x66')]);}}return _0x43bca1[_0xd049('0x6f')](_0x23fdcf);}})['catch'](handleError(_0x43bca1,null));};exports['getSystemAvatar']=function(_0x51fdfc,_0x56f1ac){var _0x53bb2b=path[_0xd049('0x6a')](config['root'],_0xd049('0x76'));var _0x26a3f5={'where':{'id':_0x51fdfc[_0xd049('0x52')]['id']},'attributes':['id',_0xd049('0x68')],'raw':!![]};return db[_0xd049('0x45')]['find'](_0x26a3f5)[_0xd049('0x13')](handleEntityNotFound(_0x56f1ac,null))[_0xd049('0x13')](function(_0x5d0170){if(_0x5d0170){if(!_['isNil'](_0x5d0170[_0xd049('0x68')])){if(fs[_0xd049('0x77')](path[_0xd049('0x6a')](config[_0xd049('0x6b')],_0xd049('0x73'),_0x5d0170[_0xd049('0x68')]))){_0x53bb2b=path[_0xd049('0x6a')](config['root'],_0xd049('0x73'),_0x5d0170[_0xd049('0x68')]);}}return _0x56f1ac[_0xd049('0x6f')](_0x53bb2b);}})[_0xd049('0x1d')](handleError(_0x56f1ac,null));};exports['notify']=function(_0x2843d4,_0x185b25){var _0x5d353e=require('user-agent-parser');var _0x3b5a42=new _0x5d353e();var _0x51a214=_0x3b5a42[_0xd049('0x78')](_0x2843d4['headers'][_0xd049('0x79')])[_0xd049('0x7a')]();var _0x26db11={'body':_0x2843d4[_0xd049('0x4d')],'channel':_0xd049('0x7b')};var _0x18ef16=[];var _0x429d7b=[];var _0x1083da={};var _0x51862b=![];return db['CmContact']['describe']()['then'](function(_0x70dd99){if(!_0x70dd99){throw new db[(_0xd049('0x7c'))]['ValidationError']('no\x20available\x20attributes');}_0x18ef16=_[_0xd049('0x7d')](_[_0xd049('0x35')](_0x70dd99),[_0xd049('0x7e'),_0xd049('0x7f')]);_0x429d7b=_[_0xd049('0x7d')](_[_0xd049('0x35')](_0x70dd99),['createdAt','updatedAt','CompanyId',_0xd049('0x80')]);if(_0x2843d4[_0xd049('0x4d')]['id']){delete _0x2843d4[_0xd049('0x4d')]['id'];}if(_[_0xd049('0x72')](_0x2843d4[_0xd049('0x4d')][_0xd049('0x81')])){throw new db[(_0xd049('0x7c'))][(_0xd049('0x82'))](_0xd049('0x83'));}if(_[_0xd049('0x72')](_0x2843d4[_0xd049('0x4d')][_0xd049('0x4d')])||_0x2843d4[_0xd049('0x4d')]['body']===''){throw new db['Sequelize'][(_0xd049('0x82'))](_0xd049('0x84'));}if(_[_0xd049('0x72')](_0x2843d4[_0xd049('0x4d')][_0xd049('0x85')])){throw new db[(_0xd049('0x7c'))][(_0xd049('0x82'))](_0xd049('0x86')+_0x429d7b);}if(!_[_0xd049('0x87')](_0x429d7b,_0x2843d4[_0xd049('0x4d')][_0xd049('0x85')])){throw new db[(_0xd049('0x7c'))]['ValidationError'](_0xd049('0x88')+_0x429d7b);}_0x1083da[_0x2843d4['body'][_0xd049('0x85')]]=_0x2843d4[_0xd049('0x4d')][_0xd049('0x81')];})[_0xd049('0x13')](function(){return db[_0xd049('0x45')][_0xd049('0x51')]({'where':{'id':_0x2843d4[_0xd049('0x52')]['id']},'include':[{'model':db[_0xd049('0x89')],'as':_0xd049('0x8a'),'include':[{'model':db['CmContact'],'as':_0xd049('0x8b'),'where':_0x1083da,'limit':0x1,'order':[[_0xd049('0x7f'),'DESC']]}]},{'model':db[_0xd049('0x8c')],'as':_0xd049('0x8d')}]});})[_0xd049('0x13')](handleEntityNotFound(_0x185b25,null))[_0xd049('0x13')](function(_0x153cc0){if(_0x153cc0&&_0x153cc0['List']){_0x26db11[_0xd049('0x8e')]=_0x153cc0;_0x26db11['applications']=_0x153cc0[_0xd049('0x8d')];_0x26db11[_0xd049('0x8f')]=_0x153cc0[_0xd049('0x8a')];_0x26db11[_0xd049('0x90')]=_[_0xd049('0x91')](_0x26db11[_0xd049('0x90')],[_0xd049('0x92')],[_0xd049('0x93')]);if(_0x26db11[_0xd049('0x8e')][_0xd049('0x8d')]){delete _0x26db11[_0xd049('0x8e')][_0xd049('0x8d')];}if(_0x26db11[_0xd049('0x8e')][_0xd049('0x8a')]&&_0x26db11[_0xd049('0x8e')]['List'][_0xd049('0x8b')][_0xd049('0x3a')]){return _0x26db11['account'][_0xd049('0x8a')][_0xd049('0x8b')][0x0];}var _0x5d46fd=_['defaults'](_0x2843d4[_0xd049('0x4d')],{'firstName':_0x2843d4['body']['from'],'ListId':_0x153cc0[_0xd049('0x80')]});_0x5d46fd[_0x2843d4[_0xd049('0x4d')]['mapKey']]=_0x2843d4[_0xd049('0x4d')]['from'];return db[_0xd049('0x94')][_0xd049('0x4c')](_0x5d46fd,{'fields':_0x18ef16,'raw':!![]});}})['then'](handleEntityNotFound(_0x185b25,null))[_0xd049('0x13')](function(_0x4ac8cb){_0x26db11['contact']=_0x4ac8cb;var _0x5e058d=_0x2843d4['body'][_0xd049('0x95')];if(_0x2843d4[_0xd049('0x96')][_0xd049('0x97')]){_0x5e058d=_0x2843d4[_0xd049('0x96')][_0xd049('0x97')];}else if(_0x2843d4[_0xd049('0x96')]['x-forwarded-for']){_0x5e058d=_['first'](_0x2843d4['headers'][_0xd049('0x98')][_0xd049('0x99')](','));}if(_0x4ac8cb){var _0x4c7b86={'ContactId':_0x4ac8cb['id'],'ChatWebsiteId':_0x2843d4['params']['id'],'from':(_0x4ac8cb[_0xd049('0x9a')]||'')+'\x20'+(_0x4ac8cb[_0xd049('0x9b')]||''),'customerIp':_0x5e058d,'customerPort':_0x2843d4[_0xd049('0x96')][_0xd049('0x9c')]?_0x2843d4[_0xd049('0x96')]['x-real-port']:null,'referer':_0x2843d4[_0xd049('0x4d')]['referer'],'browserName':_0x51a214[_0xd049('0x9d')]['name']&&_0x51a214[_0xd049('0x9d')][_0xd049('0x9e')]?util[_0xd049('0x9f')](_0xd049('0xa0'),_0x51a214[_0xd049('0x9d')]['name'],_0x51a214[_0xd049('0x9d')][_0xd049('0x9e')]):_0xd049('0xa1'),'browserVersion':_0x51a214[_0xd049('0x9d')][_0xd049('0x9e')]||_0xd049('0xa1'),'osName':util[_0xd049('0x9f')]('%s\x20%s',_0x51a214['os']['name'],_0x51a214['os'][_0xd049('0x9e')]),'osVersion':_0x51a214['os'][_0xd049('0x9e')],'deviceModel':_0x51a214['device']['model']&&_0x51a214[_0xd049('0xa2')][_0xd049('0xa3')]?util[_0xd049('0x9f')](_0xd049('0xa4'),_0x51a214[_0xd049('0xa2')]['model'],_0x51a214[_0xd049('0xa2')][_0xd049('0xa3')],_0x51a214[_0xd049('0xa2')]['type']):null,'deviceVendor':_0x51a214['device'][_0xd049('0xa3')],'deviceType':_0x51a214[_0xd049('0xa2')][_0xd049('0x41')],'formData':JSON[_0xd049('0x19')](_0x2843d4[_0xd049('0x4d')])};var _0xf7a070={'ChatWebsiteId':_0x2843d4[_0xd049('0x52')]['id'],'closed':![]};if(_0x2843d4[_0xd049('0x4d')][_0xd049('0xa5')]){_0xf7a070[_0xd049('0xa5')]=_0x2843d4[_0xd049('0x4d')][_0xd049('0xa5')];return db[_0xd049('0xa6')][_0xd049('0x51')]({'where':_0xf7a070})[_0xd049('0x13')](function(_0x49284f){if(_0x49284f){return[_0x49284f,![]];}_0x4c7b86['threadId']=_0x2843d4['body'][_0xd049('0xa5')];_0x4c7b86[_0xd049('0xa7')]=_0x2843d4[_0xd049('0x4d')][_0xd049('0xa7')];return db[_0xd049('0xa6')][_0xd049('0x4c')](_0x4c7b86)[_0xd049('0x13')](function(_0x406a9c){return[_0x406a9c,!![]];});});}_0xf7a070[_0xd049('0xa8')]=_0x4ac8cb['id'];if(_0x2843d4[_0xd049('0x4d')][_0xd049('0xa9')]&&_0x2843d4['body'][_0xd049('0xa9')]['id']){_0xf7a070['id']=_0x2843d4[_0xd049('0x4d')]['interaction']['id'];return db[_0xd049('0xa6')][_0xd049('0x51')]({'where':_0xf7a070})[_0xd049('0x13')](function(_0x4df19c){if(_0x4df19c){return[_0x4df19c,![]];}return db[_0xd049('0xa6')][_0xd049('0x4c')](_0x4c7b86)[_0xd049('0x13')](function(_0x435e46){return[_0x435e46,!![]];});});}return db[_0xd049('0xa6')][_0xd049('0x4c')](_0x4c7b86)[_0xd049('0x13')](function(_0x2dbadf){return[_0x2dbadf,!![]];});}})[_0xd049('0xaa')](function(_0x36c15f,_0x32ba44){if(_0x36c15f){_0x51862b=_0x32ba44;if(!_0x32ba44){var _0x1cb7bd={'from':(_0x26db11[_0xd049('0xab')]['firstName']||'')+'\x20'+(_0x26db11[_0xd049('0xab')][_0xd049('0x9b')]||'')};if(_0x2843d4[_0xd049('0x4d')][_0xd049('0xa5')]&&_0x2843d4[_0xd049('0x4d')][_0xd049('0xac')]&&_0x2843d4['body'][_0xd049('0xa5')]!=_0x2843d4[_0xd049('0x4d')][_0xd049('0xac')]){_0x1cb7bd[_0xd049('0xa5')]=_0x2843d4['body']['messageId'];}return _0x36c15f[_0xd049('0x27')](_0x1cb7bd);}else{return _0x36c15f;}}})[_0xd049('0x13')](function(_0x292869){_0x26db11['interaction']=_0x292869[_0xd049('0x29')]({'plain':!![]});_0x26db11[_0xd049('0xa9')][_0xd049('0xad')]=_0x51862b;if(_0x26db11['interaction'][_0xd049('0xad')]){if(_0x26db11[_0xd049('0x8e')][_0xd049('0xae')]){_0x26db11['applications'][_0xd049('0xaf')]({'id':0x0,'priority':_0x26db11['applications'][_0xd049('0x3a')]+0x1,'app':_0xd049('0xb0'),'appdata':_0xd049('0xb1'),'interval':_0xd049('0xb2')});}}return db[_0xd049('0xb3')][_0xd049('0x4c')]({'body':_0x2843d4[_0xd049('0x4d')][_0xd049('0x4d')],'ChatWebsiteId':_0x2843d4[_0xd049('0x52')]['id'],'ChatInteractionId':_0x292869['id'],'direction':'in','ContactId':_0x26db11[_0xd049('0xab')]['id'],'AttachmentId':_0x2843d4[_0xd049('0x4d')]['AttachmentId']});})['then'](function(_0x5bf7c7){_0x26db11[_0xd049('0x1c')]=_0x5bf7c7;if(_0x26db11[_0xd049('0xa9')]['UserId']){return db[_0xd049('0xb4')][_0xd049('0x51')]({'attributes':['id','name'],'where':{'id':_0x26db11[_0xd049('0xa9')][_0xd049('0xb5')]}})[_0xd049('0x13')](function(_0xa42f4a){if(_0xa42f4a){_0x26db11[_0xd049('0x90')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd049('0xb6'),'appdata':_0xa42f4a[_0xd049('0x2c')]+','+(_0x26db11[_0xd049('0x8e')][_0xd049('0xb7')]||0xa),'interval':_0xd049('0xb2')});_0x26db11[_0xd049('0xb8')]=!![];}return respondWithRpcPromise(_0xd049('0xb9'),_0xd049('0xba'),_0x26db11);});}return respondWithRpcPromise(_0xd049('0xb9'),_0xd049('0xba'),_0x26db11);})[_0xd049('0x13')](function(_0x5bd8f6){respondWithRpcPromise(_0xd049('0xbb'),'EventManager',{'event':_0xd049('0xbc'),'message':_0x5bd8f6},client9002);return _0x5bd8f6;})[_0xd049('0x13')](respondWithResult(_0x185b25,null))['catch'](handleError(_0x185b25,null));};exports['offline']=function(_0x1d3a3b,_0x5a6758){var _0x233a44,_0x526e71,_0x1d1c35;var _0x91285=[];var _0x2c40da={};var _0x50684a=_0x1d3a3b[_0xd049('0xbd')]||[];var _0x5018a7=[];var _0x1f311e;return db[_0xd049('0x94')][_0xd049('0x53')]()[_0xd049('0x13')](function(_0x5dc335){if(!_0x5dc335){throw new db[(_0xd049('0x7c'))][(_0xd049('0x82'))](_0xd049('0xbe'));}_0x91285=_[_0xd049('0x7d')](_[_0xd049('0x35')](_0x5dc335),['createdAt',_0xd049('0x7f'),_0xd049('0xbf'),_0xd049('0x80')]);if(_0x1d3a3b[_0xd049('0x4d')]['id']){delete _0x1d3a3b[_0xd049('0x4d')]['id'];}if(_[_0xd049('0x72')](_0x1d3a3b[_0xd049('0x4d')]['from'])){throw _0x5a6758[_0xd049('0x1f')](0x1f4)['send'](new db[(_0xd049('0x7c'))]['ValidationError'](_0xd049('0x83')));}if(_['isNil'](_0x1d3a3b[_0xd049('0x4d')][_0xd049('0x4d')])||_0x1d3a3b[_0xd049('0x4d')][_0xd049('0x4d')]===''){throw _0x5a6758[_0xd049('0x1f')](0x1f4)[_0xd049('0x2d')](new db[(_0xd049('0x7c'))]['ValidationError'](_0xd049('0x84')));}if(_[_0xd049('0x72')](_0x1d3a3b[_0xd049('0x4d')]['mapKeyOffline'])){throw _0x5a6758[_0xd049('0x1f')](0x1f4)[_0xd049('0x2d')](new db[(_0xd049('0x7c'))]['ValidationError'](_0xd049('0xc0')+_0x91285));}if(!_[_0xd049('0x87')](_0x91285,_0x1d3a3b['body']['mapKeyOffline'])){throw _0x5a6758[_0xd049('0x1f')](0x1f4)[_0xd049('0x2d')](new db['Sequelize'][(_0xd049('0x82'))](_0xd049('0xc1')+_0x91285));}_0x2c40da[_0x1d3a3b[_0xd049('0x4d')]['mapKeyOffline']]=_0x1d3a3b[_0xd049('0x4d')]['from'];})[_0xd049('0x13')](function(){return db[_0xd049('0x45')][_0xd049('0x51')]({'where':{'id':_0x1d3a3b[_0xd049('0x52')]['id']},'include':[{'model':db[_0xd049('0x89')],'as':_0xd049('0x8a')},{'model':db[_0xd049('0xc2')],'as':_0xd049('0xc2')}]});})['then'](handleEntityNotFound(_0x5a6758,null))['then'](function(_0x5db175){if(_0x5db175&&_0x5db175[_0xd049('0x8a')]){_0x526e71=_0x5db175;var _0x7cc6bf=_['defaults'](_0x1d3a3b[_0xd049('0x4d')],{'firstName':_0x1d3a3b[_0xd049('0x4d')][_0xd049('0x81')],'phone':_0x1d3a3b[_0xd049('0x4d')]['from'],'ListId':_0x5db175[_0xd049('0x80')]});_0x7cc6bf[_0x1d3a3b[_0xd049('0x4d')][_0xd049('0xc3')]]=_0x1d3a3b[_0xd049('0x4d')]['from'];return db[_0xd049('0x94')][_0xd049('0xc4')]({'where':_0x2c40da,'defaults':_0x7cc6bf});}})[_0xd049('0xaa')](function(_0x16ca52){if(_0x16ca52){_0x1d1c35=_0x16ca52;var _0x209884=fs[_0xd049('0xc5')](path[_0xd049('0x6a')](config[_0xd049('0x6b')],_0xd049('0xc6')),'utf8');var _0x349121=ejs['render'](_0x209884,{'body':_['toPairs'](_0x1d3a3b[_0xd049('0x4d')][_0xd049('0x4d')]),'bodyTitle':_0x526e71[_0xd049('0xc7')]});return db['ChatOfflineMessage']['create']({'body':_0x349121,'plainBody':htmlToText[_0xd049('0xc8')](_0x349121),'ContactId':_0x16ca52['id'],'ChatWebsiteId':_0x526e71['id']});}})['then'](function(_0x3abbed){_0x1f311e=_0x3abbed;if(_0x50684a[_0xd049('0x3a')]){var _0x52a610=_0x50684a[_0xd049('0x33')](function(_0x5810c6){return{'name':_0x5810c6[_0xd049('0xc9')],'basename':_0x5810c6[_0xd049('0x62')],'type':_0x5810c6[_0xd049('0xca')],'ChatOfflineMessageId':_0x3abbed['id']};});_0x5018a7=_0x52a610[_0xd049('0x33')](_0x478865=>{var _0x52ed5a={'filename':_0x478865['name'],'path':path[_0xd049('0x6a')](config[_0xd049('0x6b')],'server',_0xd049('0xbd'),'attachments',_0xd049('0xcb'),_0x478865['basename'])};return _0x52ed5a;});if(!_0x526e71[_0xd049('0xcc')]){return db[_0xd049('0xcd')][_0xd049('0xce')](function(_0x4fe6c6){return db[_0xd049('0xcf')][_0xd049('0xd0')](_0x52a610,{'transaction':_0x4fe6c6});});}}})[_0xd049('0x13')](function(){if(_0x1f311e){_0x233a44=_0x1f311e;return db[_0xd049('0xc2')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xd049('0xd1')],'as':_0xd049('0xd2'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0xd049('0x13')](function(_0x1b938e){if(_0x1b938e&&_0x1b938e['Smtp']&&_0x526e71[_0xd049('0xd3')]&&_0x526e71[_0xd049('0xd4')]){var _0x4ba468=_0x1b938e[_0xd049('0xd5')]();return respondWithRpcPromise(_0xd049('0xd6'),_0xd049('0xd7'),{'account':_0x4ba468,'message':{'from':util[_0xd049('0x9f')]('\x22%s\x22\x20<%s>',_0x1b938e['name'],_0x1b938e[_0xd049('0xd8')]||_0x1b938e[_0xd049('0xd2')][_0xd049('0xd9')]),'to':_0x526e71[_0xd049('0xd4')],'subject':_0x526e71[_0xd049('0xda')],'html':_0x233a44['body'],'attachments':_0x5018a7}},client9003)[_0xd049('0x13')](function(){return _0x233a44;})[_0xd049('0x1d')](function(_0x30c96a){logger['error'](_0x30c96a);});}})[_0xd049('0x13')](function(){if(_0x526e71&&_0x526e71[_0xd049('0xcc')]&&_0x526e71[_0xd049('0xdb')]){var _0x36ad28=[];if(_0x50684a[_0xd049('0x3a')]){_0x36ad28=_0x50684a['map'](function(_0x3610dd){return{'name':_0x3610dd[_0xd049('0xc9')],'basename':_0x3610dd[_0xd049('0x62')],'type':_0x3610dd[_0xd049('0xca')],'ChatOfflineMessageId':_0x1f311e['id']};});}var _0x17c2fa;if(!_[_0xd049('0x72')](_0x526e71[_0xd049('0xdc')])){var _0x5e6dd4=_['map'](_0x1d3a3b[_0xd049('0x4d')],function(_0x1a136c){return _0x1a136c;});var _0x4a917d=_[_0xd049('0xdd')](_0x5e6dd4)[0x0];var _0xc3a697=_[_0xd049('0xde')](_0x4a917d,function(_0x345d0c){return _0x345d0c;});_0x17c2fa=_0xc3a697[0x1][_0x526e71[_0xd049('0xdc')]];}var _0x278635={'from':_0x1d1c35['email'],'firstName':_0x1d1c35['firstName'],'lastName':_0x1d1c35['lastName'],'mapKey':_0xd049('0xd8'),'message':{'from':_0x1d1c35[_0xd049('0xd8')],'to':_0x526e71[_0xd049('0xc2')]['email'],'cc':'','subject':_[_0xd049('0x72')](_0x17c2fa)?_0x526e71[_0xd049('0xda')]:_0x17c2fa,'messageId':'','sentAt':new Date(),'attach':_0x36ad28[_0xd049('0x3a')],'attachments':_0x36ad28,'originChannel':_0xd049('0xdf'),'ChatWebsiteId':_0x526e71['id'],'ChatOfflineMessageId':_0x233a44['id'],'originTo':_0x526e71[_0xd049('0xc2')][_0xd049('0xd8')]},'body':_0x233a44['body']};var _0x240197={'account':{'id':_0x526e71[_0xd049('0xdb')]},'body':_0x278635,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xd049('0xe0'),_0x240197,client9001)[_0xd049('0x13')](function(){return _0x233a44;})['catch'](function(_0x42264b){logger['error'](_0x42264b);});}return;})[_0xd049('0x13')](function(){if(_0x233a44){return _0x233a44;}})[_0xd049('0x13')](respondWithResult(_0x5a6758,null))[_0xd049('0x1d')](function(_0x52ed4c){logger[_0xd049('0x1a')](_0xd049('0x1d'),_0x52ed4c);for(var _0x32336f of _0x50684a){var _0x2e18ac=path[_0xd049('0x6a')](config[_0xd049('0x6b')],'server',_0xd049('0xbd'),'attachments',_0xd049('0xcb'),_0x32336f['filename']);fs_extra[_0xd049('0xe1')](_0x2e18ac)[_0xd049('0x1d')](function(_0x422fac){logger['error'](_0xd049('0xe2'),_0x2e18ac,_0x422fac);});}});};exports[_0xd049('0xe3')]=function(_0x42fc7a,_0x9ef843){return db[_0xd049('0xa6')][_0xd049('0x51')]({'where':{'id':_0x42fc7a[_0xd049('0x52')]['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x9ef843,null))['then'](function(_0x4b8fb3){if(_0x4b8fb3){return _0x4b8fb3[_0xd049('0xe3')](_0x42fc7a[_0xd049('0x4d')][_0xd049('0x5b')],_['omit'](_0x42fc7a[_0xd049('0x4d')],['ids','id'])||{});}})[_0xd049('0x13')](respondWithResult(_0x9ef843,null))[_0xd049('0x1d')](handleError(_0x9ef843,null));};exports[_0xd049('0xe4')]=function(_0x4b3b34,_0x3de619){var _0x3590db={'raw':![],'where':{}};var _0xde4db0={};var _0xec821d={'count':0x0,'rows':[]};return db[_0xd049('0x45')][_0xd049('0x57')]({'where':{'id':_0x4b3b34['params']['id']}})['then'](handleEntityNotFound(_0x3de619,null))['then'](function(_0x3dc1d4){if(_0x3dc1d4){_0xde4db0[_0xd049('0x32')]=_['keys'](db[_0xd049('0xa6')]['rawAttributes']);_0xde4db0[_0xd049('0x34')]=_['keys'](_0x4b3b34[_0xd049('0x34')]);_0xde4db0[_0xd049('0x36')]=_[_0xd049('0x37')](_0xde4db0[_0xd049('0x32')],_0xde4db0[_0xd049('0x34')]);_0x3590db[_0xd049('0x38')]=_[_0xd049('0x37')](_0xde4db0[_0xd049('0x32')],qs['fields'](_0x4b3b34[_0xd049('0x34')][_0xd049('0x39')]));_0x3590db[_0xd049('0x38')]=_0x3590db[_0xd049('0x38')][_0xd049('0x3a')]?_0x3590db[_0xd049('0x38')]:_0xde4db0[_0xd049('0x32')];if(!_0x4b3b34[_0xd049('0x34')][_0xd049('0x3b')](_0xd049('0x3c'))){_0x3590db['limit']=qs[_0xd049('0x23')](_0x4b3b34[_0xd049('0x34')][_0xd049('0x23')]);_0x3590db[_0xd049('0x21')]=qs[_0xd049('0x21')](_0x4b3b34[_0xd049('0x34')][_0xd049('0x21')]);}_0x3590db[_0xd049('0x3d')]=qs[_0xd049('0x3e')](_0x4b3b34['query'][_0xd049('0x3e')]);_0x3590db['where']=qs[_0xd049('0x36')](_[_0xd049('0x3f')](_0x4b3b34['query'],_0xde4db0[_0xd049('0x36')]));_0x3590db['where'][_0xd049('0x55')]=_0x3dc1d4['id'];if(_0x4b3b34[_0xd049('0x34')][_0xd049('0x43')]){_0x3590db['where']=_[_0xd049('0x59')](_0x3590db['where'],{'$or':_[_0xd049('0x33')](_0x3590db[_0xd049('0x38')],function(_0xd4a76b){var _0x5aaf72={};_0x5aaf72[_0xd4a76b]={'$like':'%'+_0x4b3b34['query'][_0xd049('0x43')]+'%'};return _0x5aaf72;})});}_0x3590db=_['merge']({},_0x3590db,_0x4b3b34[_0xd049('0x44')]);return db[_0xd049('0xa6')][_0xd049('0x24')]({'where':_0x3590db['where']})[_0xd049('0x13')](function(_0x18c833){_0xec821d[_0xd049('0x24')]=_0x18c833;if(_0x4b3b34['query']['includeAll']){_0x3590db['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xd049('0xb4')],'as':_0xd049('0xe5'),'attributes':[_0xd049('0x2c'),_0xd049('0xe6'),_0xd049('0xe7')],'required':![]},{'model':db['Tag'],'as':_0xd049('0xe8'),'attributes':['id',_0xd049('0x2c'),'color'],'where':_0x4b3b34[_0xd049('0x34')][_0xd049('0xe9')]?{'id':_0x4b3b34[_0xd049('0x34')]['tag']}:undefined,'required':_0x4b3b34[_0xd049('0x34')][_0xd049('0xe9')]?!![]:![]}];}return db['ChatInteraction'][_0xd049('0x48')](_0x3590db);})[_0xd049('0x13')](function(_0x3b061e){_0xec821d[_0xd049('0x49')]=_0x3b061e;return _0xec821d;});}})[_0xd049('0x13')](respondWithFilteredResult(_0x3de619,_0x3590db))[_0xd049('0x1d')](handleError(_0x3de619,null));};function iftimePromise(_0x4abaf8,_0x44141a){return respondWithRpcPromise('Command','getSnippet',{'command':_0x44141a[_0xd049('0xea')]?util[_0xd049('0x9f')]('iftime\x20%s,%s',_0x4abaf8['interval'],_0x44141a[_0xd049('0xea')]):util[_0xd049('0x9f')](_0xd049('0xeb'),_0x4abaf8[_0xd049('0xec')])},client9002)[_0xd049('0x13')](function(_0x22663c){var _0x2a5736=_0x22663c&&_0x22663c['indexOf'](_0xd049('0xed'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x44141a['id'],_0x4abaf8['id'],_0x4abaf8[_0xd049('0xec')],_0x2a5736?'ONLINE':'OFFLINE',_0x44141a[_0xd049('0xea')]?_0x44141a[_0xd049('0xea')]:_0xd049('0xee'));return _0x2a5736;})[_0xd049('0x1d')](function(_0x50c5d9){logger[_0xd049('0x1a')](_0xd049('0xef'),_0x44141a['id'],_0x4abaf8['id'],_0x4abaf8['interval'],util['inspect'](_0x50c5d9,{'showHidden':![],'depth':null}),_0x44141a['timezone']?_0x44141a['timezone']:_0xd049('0xee'));return![];});}exports[_0xd049('0xf0')]=function(_0xea3238,_0x18f6a1){var _0x21fabb=0x0;var _0x3a7aad=0x0;var _0x278b05=![];var _0x138714;var _0x252065;return db[_0xd049('0x45')][_0xd049('0x51')]({'where':{'id':_0xea3238[_0xd049('0x52')]['id']},'include':[{'model':db[_0xd049('0xf1')],'as':_0xd049('0xf1'),'include':[{'model':db[_0xd049('0xf1')],'as':_0xd049('0xf2'),'attributes':['id',_0xd049('0xec')],'raw':!![]}]}]})[_0xd049('0x13')](handleEntityNotFound(_0x18f6a1,null))[_0xd049('0x13')](function(_0x33916d){if(_0x33916d){_0x138714=_0x33916d;return _0x33916d[_0xd049('0xf3')]({'raw':!![]});}})[_0xd049('0x13')](function(_0x4e749c){if(_0x138714){if(_0x4e749c){_0x252065=_0x4e749c;}}return require('../../config/license/util')[_0xd049('0x6d')]();})[_0xd049('0x13')](function(_0x366420){if(_0x366420){_0x3a7aad=_0x366420[_0xd049('0xf4')];_0x278b05=_0x366420[_0xd049('0xf5')];}})[_0xd049('0x13')](function(){return db['ChatInteraction'][_0xd049('0x24')]({'where':{'closed':![]}});})[_0xd049('0x13')](function(_0x242f16){_0x21fabb=_0x242f16;if(_0x3a7aad&&_0x242f16>_0x3a7aad){return db[_0xd049('0xf6')]['findOne']({'where':{'id':0x1}})[_0xd049('0x13')](function(_0x275ac6){if(_0x275ac6){_0x275ac6['increment'](_0xd049('0xf7'));}});}})['then'](function(){if(_0x138714[_0xd049('0xf1')]&&_0x138714[_0xd049('0xf1')][_0xd049('0xf2')]){var _0x1089ea=[];for(var _0x59f77f=0x0;_0x59f77f<_0x138714['Interval']['Intervals'][_0xd049('0x3a')];_0x59f77f++){var _0x19b9e5=_0x138714[_0xd049('0xf1')][_0xd049('0xf2')][_0x59f77f][_0xd049('0x29')]({'plain':!![]});_0x1089ea[_0xd049('0xaf')](iftimePromise(_0x19b9e5,_0x138714));}return BPromise[_0xd049('0xf8')](_0x1089ea)[_0xd049('0x13')](function(_0x1653c2){return _[_0xd049('0xf9')](_0x1653c2);});}else{return!![];}})[_0xd049('0x13')](function(_0x3c2dab){var _0x531ce8=fs['readFileSync'](path[_0xd049('0x6a')](config['root'],'server/files/chat/iframe.ejs'),_0xd049('0xfa'));var _0xa2a58c=new url[(_0xd049('0xfb'))](_0x138714['address'])[_0xd049('0xfc')];var _0x43c8ce='3.1.0';var _0x141518=![];var _0x1f44f6={'chatVersion':_0x43c8ce,'chatWebsiteAddressOrigin':_0xa2a58c,'remote':_0x138714[_0xd049('0xfd')],'query':querystring[_0xd049('0x19')](_[_0xd049('0x59')](_0x138714[_0xd049('0x29')]({'plain':!![]}),{'customerIp':_0xea3238[_0xd049('0x96')][_0xd049('0x98')]||_0xea3238['headers'][_0xd049('0xfe')]||_0xea3238[_0xd049('0xff')][_0xd049('0x100')]||_0xea3238['ip'],'referer':_0xea3238[_0xd049('0x96')]['referer'],'openedInteractions':_0x21fabb,'maxInteractions':_0x3a7aad,'virtual':_0x278b05[_0xd049('0xf4')],'online':_0x3c2dab,'custom':_0x278b05}))[_0xd049('0x101')](/'/g,'\x5c\x27')};_0x18f6a1[_0xd049('0x2d')](ejs[_0xd049('0x102')](Mustache[_0xd049('0x102')](_0x531ce8,_0x1f44f6),{'proactiveActions':_0x252065,'alignment':_0x138714[_0xd049('0x103')],'verticalAlignment':_0x138714[_0xd049('0x104')],'div_color':_0x138714[_0xd049('0x105')],'labelText':_0x138714[_0xd049('0x106')],'text_color':_0x138714[_0xd049('0x107')],'text_button_color':_0x138714[_0xd049('0x108')],'button_color':_0x138714[_0xd049('0x109')],'background_color':_0x138714['backgroundColor'],'hideWhenOffline':_0x138714[_0xd049('0x10a')],'intervalId':_0x138714['IntervalId'],'isDevelopment':_0x141518,'chatVersion':_0x43c8ce}));})[_0xd049('0x1d')](handleError(_0x18f6a1,null));};exports[_0xd049('0x10b')]=function(_0x10393c,_0x2c1a0e){var _0x427478=_0x10393c[_0xd049('0x52')]['id'];var _0x2ffecd=_0x10393c[_0xd049('0x4d')];var _0xecadb8=0xc8;var _0x167f8e=null;return db['sequelize'][_0xd049('0xce')]({'isolationLevel':db['sequelize']['Transaction'][_0xd049('0x10c')][_0xd049('0x10d')]},function(_0x1b220d){return db[_0xd049('0x45')]['findOne']({'where':{'id':_0x427478},'transaction':_0x1b220d})[_0xd049('0x13')](function(_0x3163d9){if(_0x3163d9){return db[_0xd049('0x8c')][_0xd049('0x28')]({'where':{'ChatWebsiteId':_0x427478},'transaction':_0x1b220d})[_0xd049('0x13')](function(){var _0x3a685f=_['map'](_0x2ffecd,function(_0x4315a2){_0x4315a2[_0xd049('0x55')]=_0x427478;return _0x4315a2;});return db[_0xd049('0x8c')][_0xd049('0xd0')](_0x3a685f,{'transaction':_0x1b220d});});}else{_0xecadb8=0x194;_0x167f8e=[];}});})[_0xd049('0x13')](function(){if(_0xecadb8!==0x194){return db[_0xd049('0x8c')][_0xd049('0x10e')]({'where':{'ChatWebsiteId':_0x427478},'order':_0xd049('0x92')})['then'](function(_0xcbf0aa){_0x167f8e=_0xcbf0aa;});}})['catch'](function(_0x2f043a){_0xecadb8=0x1f4;logger[_0xd049('0x1a')](_0x2f043a[_0xd049('0x2b')]);if(_0x2f043a[_0xd049('0x2c')]){delete _0x2f043a[_0xd049('0x2c')];}_0x167f8e=_0x2f043a;})[_0xd049('0x10f')](function(){if(_0x167f8e===null){_0x2c1a0e[_0xd049('0x1e')](_0xecadb8);}else{if(_0xecadb8===0x1f4){_0x2c1a0e['status'](_0xecadb8)['send'](_0x167f8e);}else{_0x2c1a0e[_0xd049('0x1f')](_0xecadb8)[_0xd049('0x26')](_0x167f8e);}}});};exports[_0xd049('0x110')]=function(_0x76d631,_0x2adf38){var _0x52c846={};var _0x46ddf0={};var _0x3c1250;var _0x444353;return db[_0xd049('0x45')]['findOne']({'where':{'id':_0x76d631[_0xd049('0x52')]['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x2adf38,null))[_0xd049('0x13')](function(_0x4fa5af){if(_0x4fa5af){_0x3c1250=_0x4fa5af;_0x46ddf0[_0xd049('0x32')]=_[_0xd049('0x35')](db['ChatApplication'][_0xd049('0x30')]);_0x46ddf0[_0xd049('0x34')]=_[_0xd049('0x35')](_0x76d631[_0xd049('0x34')]);_0x46ddf0[_0xd049('0x36')]=_[_0xd049('0x37')](_0x46ddf0[_0xd049('0x32')],_0x46ddf0[_0xd049('0x34')]);_0x52c846[_0xd049('0x38')]=_['intersection'](_0x46ddf0[_0xd049('0x32')],qs['fields'](_0x76d631[_0xd049('0x34')]['fields']));_0x52c846[_0xd049('0x38')]=_0x52c846[_0xd049('0x38')]['length']?_0x52c846[_0xd049('0x38')]:_0x46ddf0['model'];_0x52c846[_0xd049('0x3d')]=qs[_0xd049('0x3e')](_0x76d631[_0xd049('0x34')][_0xd049('0x3e')]);_0x52c846[_0xd049('0x40')]=qs[_0xd049('0x36')](_['pick'](_0x76d631[_0xd049('0x34')],_0x46ddf0[_0xd049('0x36')]));if(_0x76d631[_0xd049('0x34')][_0xd049('0x43')]){_0x52c846[_0xd049('0x40')]=_[_0xd049('0x59')](_0x52c846['where'],{'$or':_[_0xd049('0x33')](_0x52c846['attributes'],function(_0x5cdf20){var _0x2f3531={};_0x2f3531[_0x5cdf20]={'$like':'%'+_0x76d631[_0xd049('0x34')]['filter']+'%'};return _0x2f3531;})});}_0x52c846=_[_0xd049('0x59')]({},_0x52c846,_0x76d631['options']);return _0x3c1250['getApplications'](_0x52c846);}})[_0xd049('0x13')](function(_0x551024){if(_0x551024){_0x444353=_0x551024[_0xd049('0x3a')];if(!_0x76d631['query'][_0xd049('0x3b')](_0xd049('0x3c'))){_0x52c846[_0xd049('0x23')]=qs[_0xd049('0x23')](_0x76d631['query'][_0xd049('0x23')]);_0x52c846[_0xd049('0x21')]=qs[_0xd049('0x21')](_0x76d631[_0xd049('0x34')]['offset']);}return _0x3c1250[_0xd049('0x110')](_0x52c846);}})[_0xd049('0x13')](function(_0x37756a){if(_0x37756a){return _0x37756a?{'count':_0x444353,'rows':_0x37756a}:null;}})['then'](respondWithResult(_0x2adf38,null))['catch'](handleError(_0x2adf38,null));};exports['addProactiveActions']=function(_0x4b278e,_0x556fc3){return db[_0xd049('0x111')]['find']({'where':{'id':_0x4b278e['params']['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x556fc3,null))[_0xd049('0x13')](function(_0xc4670d){if(_0xc4670d){return _0xc4670d[_0xd049('0x112')](_0x4b278e[_0xd049('0x4d')]['ids'],_[_0xd049('0x113')](_0x4b278e[_0xd049('0x4d')],[_0xd049('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x556fc3,null))[_0xd049('0x1d')](handleError(_0x556fc3,null));};exports[_0xd049('0xf3')]=function(_0x191dcb,_0x3acc28){var _0x5379b0={};var _0x233cb3={};var _0x382672;var _0x3ea625;return db[_0xd049('0x45')][_0xd049('0x57')]({'where':{'id':_0x191dcb[_0xd049('0x52')]['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x3acc28,null))[_0xd049('0x13')](function(_0x80d2d4){if(_0x80d2d4){_0x382672=_0x80d2d4;_0x233cb3[_0xd049('0x32')]=_[_0xd049('0x35')](db[_0xd049('0x114')][_0xd049('0x30')]);_0x233cb3[_0xd049('0x34')]=_[_0xd049('0x35')](_0x191dcb['query']);_0x233cb3[_0xd049('0x36')]=_['intersection'](_0x233cb3[_0xd049('0x32')],_0x233cb3[_0xd049('0x34')]);_0x5379b0['attributes']=_[_0xd049('0x37')](_0x233cb3[_0xd049('0x32')],qs[_0xd049('0x39')](_0x191dcb['query'][_0xd049('0x39')]));_0x5379b0[_0xd049('0x38')]=_0x5379b0[_0xd049('0x38')][_0xd049('0x3a')]?_0x5379b0['attributes']:_0x233cb3[_0xd049('0x32')];_0x5379b0[_0xd049('0x3d')]=qs[_0xd049('0x3e')](_0x191dcb['query'][_0xd049('0x3e')]);_0x5379b0[_0xd049('0x40')]=qs[_0xd049('0x36')](_['pick'](_0x191dcb[_0xd049('0x34')],_0x233cb3[_0xd049('0x36')]));if(_0x191dcb[_0xd049('0x34')]['filter']){_0x5379b0[_0xd049('0x40')]=_['merge'](_0x5379b0[_0xd049('0x40')],{'$or':_[_0xd049('0x33')](_0x5379b0[_0xd049('0x38')],function(_0x27cc55){var _0x399b57={};_0x399b57[_0x27cc55]={'$like':'%'+_0x191dcb['query']['filter']+'%'};return _0x399b57;})});}_0x5379b0=_[_0xd049('0x59')]({},_0x5379b0,_0x191dcb['options']);return _0x382672[_0xd049('0xf3')](_0x5379b0);}})[_0xd049('0x13')](function(_0x48fda0){if(_0x48fda0){_0x3ea625=_0x48fda0['length'];if(!_0x191dcb[_0xd049('0x34')][_0xd049('0x3b')](_0xd049('0x3c'))){_0x5379b0[_0xd049('0x23')]=qs[_0xd049('0x23')](_0x191dcb['query'][_0xd049('0x23')]);_0x5379b0[_0xd049('0x21')]=qs[_0xd049('0x21')](_0x191dcb[_0xd049('0x34')][_0xd049('0x21')]);}return _0x382672['getProactiveActions'](_0x5379b0);}})[_0xd049('0x13')](function(_0x4bf930){if(_0x4bf930){return _0x4bf930?{'count':_0x3ea625,'rows':_0x4bf930}:null;}})[_0xd049('0x13')](respondWithResult(_0x3acc28,null))[_0xd049('0x1d')](handleError(_0x3acc28,null));};exports[_0xd049('0x115')]=function(_0x38d3a5,_0x13457a){var _0x155bcd=_0x38d3a5['query']['online']===_0xd049('0x116')?'offlineForm':_0xd049('0x117');return db[_0xd049('0x45')]['find']({'attributes':['id',_0x155bcd],'where':{'id':_0x38d3a5['params']['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x13457a,null))[_0xd049('0x13')](function(_0x2f6028){if(_0x2f6028){var _0x1ce765=_0x2f6028[_0x155bcd];var _0x32e2da=_0x1ce765&&_0x1ce765[_0xd049('0x118')]?_0x1ce765['items']:[];_0x13457a[_0xd049('0x2d')]({'fromKey':_[_0xd049('0x72')](_0x1ce765['fromKey'])?undefined:_0x1ce765['fromKey'],'count':_0x32e2da['length'],'rows':_0x32e2da});}})[_0xd049('0x1d')](handleError(_0x13457a,null));};exports[_0xd049('0x119')]=function(_0x1fab03,_0x36bd5f){var _0x5dbaec={'raw':![],'where':{}};var _0x5a727d={};var _0x9fbba3={'count':0x0,'rows':[]};return db[_0xd049('0x45')]['findOne']({'where':{'id':_0x1fab03[_0xd049('0x52')]['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x36bd5f,null))[_0xd049('0x13')](function(_0x3a5d92){if(_0x3a5d92){_0x5a727d[_0xd049('0x32')]=_[_0xd049('0x35')](db[_0xd049('0x11a')][_0xd049('0x30')]);_0x5a727d[_0xd049('0x34')]=_['keys'](_0x1fab03['query']);_0x5a727d['filters']=_[_0xd049('0x37')](_0x5a727d['model'],_0x5a727d[_0xd049('0x34')]);_0x5dbaec['attributes']=_[_0xd049('0x37')](_0x5a727d[_0xd049('0x32')],qs[_0xd049('0x39')](_0x1fab03[_0xd049('0x34')][_0xd049('0x39')]));_0x5dbaec[_0xd049('0x38')]=_0x5dbaec[_0xd049('0x38')][_0xd049('0x3a')]?_0x5dbaec[_0xd049('0x38')]:_0x5a727d[_0xd049('0x32')];if(!_0x1fab03[_0xd049('0x34')][_0xd049('0x3b')]('nolimit')){_0x5dbaec[_0xd049('0x23')]=qs[_0xd049('0x23')](_0x1fab03['query'][_0xd049('0x23')]);_0x5dbaec[_0xd049('0x21')]=qs[_0xd049('0x21')](_0x1fab03[_0xd049('0x34')]['offset']);}_0x5dbaec[_0xd049('0x3d')]=qs[_0xd049('0x3e')](_0x1fab03[_0xd049('0x34')][_0xd049('0x3e')]);_0x5dbaec[_0xd049('0x40')]=qs[_0xd049('0x36')](_[_0xd049('0x3f')](_0x1fab03['query'],_0x5a727d[_0xd049('0x36')]));_0x5dbaec[_0xd049('0x40')]['ChatWebsiteId']=_0x3a5d92['id'];if(_0x1fab03[_0xd049('0x34')][_0xd049('0x43')]){_0x5dbaec[_0xd049('0x40')]=_[_0xd049('0x59')](_0x5dbaec['where'],{'$or':_[_0xd049('0x33')](_0x5dbaec['attributes'],function(_0x29b4d5){var _0x415f38={};_0x415f38[_0x29b4d5]={'$like':'%'+_0x1fab03['query'][_0xd049('0x43')]+'%'};return _0x415f38;})});}_0x5dbaec=_[_0xd049('0x59')]({},_0x5dbaec,_0x1fab03[_0xd049('0x44')]);return db['ChatOfflineMessage']['count']({'where':_0x5dbaec[_0xd049('0x40')]})['then'](function(_0x35e5ad){_0x9fbba3[_0xd049('0x24')]=_0x35e5ad;if(_0x1fab03['query'][_0xd049('0x46')]){_0x5dbaec[_0xd049('0x47')]=[{'all':!![]}];}else{_0x5dbaec['include']=[{'model':db[_0xd049('0x94')],'as':_0xd049('0x11b'),'required':![]},{'model':db[_0xd049('0xcf')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x5dbaec);})[_0xd049('0x13')](function(_0x1ce8c1){_0x9fbba3[_0xd049('0x49')]=_0x1ce8c1;return _0x9fbba3;});}})[_0xd049('0x13')](respondWithFilteredResult(_0x36bd5f,_0x5dbaec))['catch'](handleError(_0x36bd5f,null));};exports[_0xd049('0x11c')]=function(_0x46b08a,_0x21b86c){return db[_0xd049('0x45')][_0xd049('0x51')]({'where':{'id':_0x46b08a['params']['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x21b86c,null))[_0xd049('0x13')](function(_0xd1940b){if(_0xd1940b){return _0xd1940b['addAgents'](_0x46b08a[_0xd049('0x4d')][_0xd049('0x5b')],_[_0xd049('0x113')](_0x46b08a['body'],[_0xd049('0x5b'),'id'])||{})[_0xd049('0xaa')](function(_0x4c58b7){for(var _0x5c7f23=0x0;_0x5c7f23<_0x46b08a[_0xd049('0x4d')]['ids'][_0xd049('0x3a')];_0x5c7f23+=0x1){socket[_0xd049('0x11d')](_0xd049('0x11e'),{'UserId':Number(_0x46b08a['body'][_0xd049('0x5b')][_0x5c7f23]),'ChatWebsiteId':Number(_0x46b08a['params']['id'])});}return _0x4c58b7;});}})['then'](respondWithResult(_0x21b86c,null))['catch'](handleError(_0x21b86c,null));};exports[_0xd049('0x11f')]=function(_0x1b68a5,_0x4ab4d3){return db[_0xd049('0x45')][_0xd049('0x51')]({'where':{'id':_0x1b68a5['params']['id']}})[_0xd049('0x13')](handleEntityNotFound(_0x4ab4d3,null))['then'](function(_0x3d6c7c){if(_0x3d6c7c){return _0x3d6c7c[_0xd049('0x11f')](_0x1b68a5[_0xd049('0x34')][_0xd049('0x5b')])[_0xd049('0x13')](function(){if(_['isArray'](_0x1b68a5[_0xd049('0x34')][_0xd049('0x5b')])){for(var _0x4c072a=0x0;_0x4c072a<_0x1b68a5[_0xd049('0x34')]['ids'][_0xd049('0x3a')];_0x4c072a+=0x1){socket[_0xd049('0x11d')](_0xd049('0x120'),{'UserId':Number(_0x1b68a5[_0xd049('0x34')][_0xd049('0x5b')][_0x4c072a]),'ChatWebsiteId':Number(_0x1b68a5[_0xd049('0x52')]['id'])});}}else{socket['emit'](_0xd049('0x120'),{'UserId':Number(_0x1b68a5[_0xd049('0x34')][_0xd049('0x5b')]),'ChatWebsiteId':Number(_0x1b68a5[_0xd049('0x52')]['id'])});}});}})[_0xd049('0x13')](respondWithStatusCode(_0x4ab4d3,null))[_0xd049('0x1d')](handleError(_0x4ab4d3,null));};exports['getAgents']=function(_0x557ae2,_0x3312ce){var _0x2e7abf={};var _0x4d9953={};var _0x55d0ea;var _0x92430a;return db[_0xd049('0x45')][_0xd049('0x57')]({'where':{'id':_0x557ae2[_0xd049('0x52')]['id']}})['then'](handleEntityNotFound(_0x3312ce,null))[_0xd049('0x13')](function(_0x2b02f5){if(_0x2b02f5){_0x55d0ea=_0x2b02f5;_0x4d9953['model']=_[_0xd049('0x35')](db[_0xd049('0xb4')][_0xd049('0x30')]);_0x4d9953[_0xd049('0x34')]=_[_0xd049('0x35')](_0x557ae2[_0xd049('0x34')]);_0x4d9953[_0xd049('0x36')]=_[_0xd049('0x37')](_0x4d9953[_0xd049('0x32')],_0x4d9953[_0xd049('0x34')]);_0x2e7abf[_0xd049('0x38')]=_['intersection'](_0x4d9953[_0xd049('0x32')],qs[_0xd049('0x39')](_0x557ae2['query'][_0xd049('0x39')]));_0x2e7abf[_0xd049('0x38')]=_0x2e7abf[_0xd049('0x38')]['length']?_0x2e7abf[_0xd049('0x38')]:_0x4d9953['model'];_0x2e7abf[_0xd049('0x3d')]=qs[_0xd049('0x3e')](_0x557ae2[_0xd049('0x34')][_0xd049('0x3e')]);_0x2e7abf[_0xd049('0x40')]=qs[_0xd049('0x36')](_[_0xd049('0x3f')](_0x557ae2[_0xd049('0x34')],_0x4d9953[_0xd049('0x36')]));if(_0x557ae2[_0xd049('0x34')]['filter']){_0x2e7abf[_0xd049('0x40')]=_[_0xd049('0x59')](_0x2e7abf[_0xd049('0x40')],{'$or':_[_0xd049('0x33')](_0x2e7abf[_0xd049('0x38')],function(_0x2c931c){var _0x32fefc={};_0x32fefc[_0x2c931c]={'$like':'%'+_0x557ae2['query'][_0xd049('0x43')]+'%'};return _0x32fefc;})});}_0x2e7abf=_[_0xd049('0x59')]({},_0x2e7abf,_0x557ae2[_0xd049('0x44')]);return _0x55d0ea[_0xd049('0x121')](_0x2e7abf);}})[_0xd049('0x13')](function(_0x5ec923){if(_0x5ec923){_0x92430a=_0x5ec923[_0xd049('0x3a')];if(!_0x557ae2[_0xd049('0x34')][_0xd049('0x3b')](_0xd049('0x3c'))){_0x2e7abf[_0xd049('0x23')]=qs[_0xd049('0x23')](_0x557ae2['query'][_0xd049('0x23')]);_0x2e7abf[_0xd049('0x21')]=qs[_0xd049('0x21')](_0x557ae2[_0xd049('0x34')][_0xd049('0x21')]);}return _0x55d0ea[_0xd049('0x121')](_0x2e7abf);}})[_0xd049('0x13')](function(_0x391792){if(_0x391792){return _0x391792?{'count':_0x92430a,'rows':_0x391792}:null;}})['then'](respondWithResult(_0x3312ce,null))['catch'](handleError(_0x3312ce,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 0787a89..26fd755 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 _0x56e6=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x146242,_0x4f52b2){var _0x45c774=function(_0xe625d2){while(--_0xe625d2){_0x146242['push'](_0x146242['shift']());}};_0x45c774(++_0x4f52b2);}(_0x56e6,0x6b));var _0x656e=function(_0x452ea6,_0x5dedd8){_0x452ea6=_0x452ea6-0x0;var _0x456381=_0x56e6[_0x452ea6];return _0x456381;};'use strict';var EventEmitter=require(_0x656e('0x0'));var ChatWebsite=require(_0x656e('0x1'))['db'][_0x656e('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x656e('0x3')](0x0);var events={'afterCreate':_0x656e('0x4'),'afterUpdate':_0x656e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x40a874){return function(_0x23c947,_0xe7d540,_0x162ffe){ChatWebsiteEvents[_0x656e('0x6')](_0x40a874+':'+_0x23c947['id'],_0x23c947);ChatWebsiteEvents[_0x656e('0x6')](_0x40a874,_0x23c947);_0x162ffe(null);};}for(var e in events){if(events[_0x656e('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x656e('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xf25a=['../../mysqldb','ChatWebsite','save','update','remove','hasOwnProperty','events'];(function(_0x15ddc9,_0x209223){var _0x2fc9e8=function(_0x2d5e5f){while(--_0x2d5e5f){_0x15ddc9['push'](_0x15ddc9['shift']());}};_0x2fc9e8(++_0x209223);}(_0xf25a,0x195));var _0xaf25=function(_0x43f582,_0x1ba83d){_0x43f582=_0x43f582-0x0;var _0x2b3082=_0xf25a[_0x43f582];return _0x2b3082;};'use strict';var EventEmitter=require(_0xaf25('0x0'));var ChatWebsite=require(_0xaf25('0x1'))['db'][_0xaf25('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf25('0x3'),'afterUpdate':_0xaf25('0x4'),'afterDestroy':_0xaf25('0x5')};function emitEvent(_0x4d4252){return function(_0x1ef749,_0x49e3b2,_0x1142c7){ChatWebsiteEvents['emit'](_0x4d4252+':'+_0x1ef749['id'],_0x1ef749);ChatWebsiteEvents['emit'](_0x4d4252,_0x1ef749);_0x1142c7(null);};}for(var e in events){if(events[_0xaf25('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index f961207..d2aec9d 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 _0x33da=['exports','define','ChatWebsite','chat_websites','lodash','bluebird','request-promise','path'];(function(_0x93e6a1,_0x11e83d){var _0x37a194=function(_0x40144b){while(--_0x40144b){_0x93e6a1['push'](_0x93e6a1['shift']());}};_0x37a194(++_0x11e83d);}(_0x33da,0x1d4));var _0xa33d=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0x33da[_0x3a16d4];return _0x31ea9c;};'use strict';var _=require(_0xa33d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa33d('0x1'));var rp=require(_0xa33d('0x2'));var fs=require('fs');var path=require(_0xa33d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0xa33d('0x4')]=function(_0x314725,_0x1c62a1){return _0x314725[_0xa33d('0x5')](_0xa33d('0x6'),attributes,{'tableName':_0xa33d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2cb=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatWebsite'];(function(_0x1358a6,_0x23372a){var _0x336ecc=function(_0x1fcedb){while(--_0x1fcedb){_0x1358a6['push'](_0x1358a6['shift']());}};_0x336ecc(++_0x23372a);}(_0xd2cb,0x1b0));var _0xbd2c=function(_0x1c4fa8,_0x10c2cd){_0x1c4fa8=_0x1c4fa8-0x0;var _0x5502cc=_0xd2cb[_0x1c4fa8];return _0x5502cc;};'use strict';var _=require(_0xbd2c('0x0'));var util=require(_0xbd2c('0x1'));var logger=require(_0xbd2c('0x2'))(_0xbd2c('0x3'));var moment=require('moment');var BPromise=require(_0xbd2c('0x4'));var rp=require(_0xbd2c('0x5'));var fs=require('fs');var path=require(_0xbd2c('0x6'));var rimraf=require(_0xbd2c('0x7'));var config=require(_0xbd2c('0x8'));var attributes=require('./chatWebsite.attributes');module[_0xbd2c('0x9')]=function(_0x41d9b1,_0x4e1285){return _0x41d9b1[_0xbd2c('0xa')](_0xbd2c('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 983e5b5..61b7c0d 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 _0x3ac2=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x990dc5,_0x29cef5){var _0x3699ac=function(_0xaf13){while(--_0xaf13){_0x990dc5['push'](_0x990dc5['shift']());}};_0x3699ac(++_0x29cef5);}(_0x3ac2,0xb8));var _0x23ac=function(_0x521bb6,_0x2b02b8){_0x521bb6=_0x521bb6-0x0;var _0x43d45f=_0x3ac2[_0x521bb6];return _0x43d45f;};'use strict';var _=require('lodash');var util=require(_0x23ac('0x0'));var moment=require(_0x23ac('0x1'));var BPromise=require('bluebird');var rs=require(_0x23ac('0x2'));var fs=require('fs');var Redis=require(_0x23ac('0x3'));var db=require(_0x23ac('0x4'))['db'];var utils=require(_0x23ac('0x5'));var logger=require('../../config/logger')(_0x23ac('0x6'));var config=require(_0x23ac('0x7'));var jayson=require(_0x23ac('0x8'));var client=jayson[_0x23ac('0x9')][_0x23ac('0xa')]({'port':0x232a});config[_0x23ac('0xb')]=_['defaults'](config[_0x23ac('0xb')],{'host':_0x23ac('0xc'),'port':0x18eb});var socket=require(_0x23ac('0xd'))(new Redis(config[_0x23ac('0xb')]));require(_0x23ac('0xe'))[_0x23ac('0xf')](socket);function respondWithRpcPromise(_0x460163,_0x46fdb4,_0x1a0c1b){return new BPromise(function(_0x7bed82,_0x2d43f2){return client[_0x23ac('0x10')](_0x460163,_0x1a0c1b)[_0x23ac('0x11')](function(_0xb909a){logger['info'](_0x23ac('0x12'),_0x46fdb4,'request\x20sent');logger[_0x23ac('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x46fdb4,_0x23ac('0x14'),JSON['stringify'](_0xb909a));if(_0xb909a[_0x23ac('0x15')]){if(_0xb909a[_0x23ac('0x15')][_0x23ac('0x16')]===0x1f4){logger[_0x23ac('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x46fdb4,_0xb909a[_0x23ac('0x15')][_0x23ac('0x17')]);return _0x2d43f2(_0xb909a[_0x23ac('0x15')][_0x23ac('0x17')]);}logger[_0x23ac('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x46fdb4,_0xb909a[_0x23ac('0x15')][_0x23ac('0x17')]);return _0x7bed82(_0xb909a['error'][_0x23ac('0x17')]);}else{logger[_0x23ac('0x18')](_0x23ac('0x12'),_0x46fdb4,_0x23ac('0x14'));_0x7bed82(_0xb909a[_0x23ac('0x19')][_0x23ac('0x17')]);}})[_0x23ac('0x1a')](function(_0x5b9ab3){logger[_0x23ac('0x15')](_0x23ac('0x12'),_0x46fdb4,_0x5b9ab3);_0x2d43f2(_0x5b9ab3);});});} \ No newline at end of file +var _0x8a34=['defaults','localhost','socket.io-emitter','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x3e8587,_0x2f4fc7){var _0x27b557=function(_0x5ae806){while(--_0x5ae806){_0x3e8587['push'](_0x3e8587['shift']());}};_0x27b557(++_0x2f4fc7);}(_0x8a34,0x77));var _0x48a3=function(_0x32aac9,_0x5eb63d){_0x32aac9=_0x32aac9-0x0;var _0x51bafd=_0x8a34[_0x32aac9];return _0x51bafd;};'use strict';var _=require('lodash');var util=require(_0x48a3('0x0'));var moment=require('moment');var BPromise=require(_0x48a3('0x1'));var rs=require(_0x48a3('0x2'));var fs=require('fs');var Redis=require(_0x48a3('0x3'));var db=require(_0x48a3('0x4'))['db'];var utils=require(_0x48a3('0x5'));var logger=require('../../config/logger')(_0x48a3('0x6'));var config=require(_0x48a3('0x7'));var jayson=require(_0x48a3('0x8'));var client=jayson[_0x48a3('0x9')]['http']({'port':0x232a});config[_0x48a3('0xa')]=_[_0x48a3('0xb')](config[_0x48a3('0xa')],{'host':_0x48a3('0xc'),'port':0x18eb});var socket=require(_0x48a3('0xd'))(new Redis(config[_0x48a3('0xa')]));require('./chatWebsite.socket')[_0x48a3('0xe')](socket);function respondWithRpcPromise(_0x5b30fc,_0x204d3e,_0x1d9ada){return new BPromise(function(_0x196a66,_0x5b6dd2){return client[_0x48a3('0xf')](_0x5b30fc,_0x1d9ada)[_0x48a3('0x10')](function(_0x3ad578){logger['info'](_0x48a3('0x11'),_0x204d3e,_0x48a3('0x12'));logger[_0x48a3('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x204d3e,_0x48a3('0x12'),JSON[_0x48a3('0x14')](_0x3ad578));if(_0x3ad578[_0x48a3('0x15')]){if(_0x3ad578[_0x48a3('0x15')][_0x48a3('0x16')]===0x1f4){logger[_0x48a3('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x204d3e,_0x3ad578[_0x48a3('0x15')]['message']);return _0x5b6dd2(_0x3ad578[_0x48a3('0x15')][_0x48a3('0x17')]);}logger[_0x48a3('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x204d3e,_0x3ad578['error'][_0x48a3('0x17')]);return _0x196a66(_0x3ad578[_0x48a3('0x15')][_0x48a3('0x17')]);}else{logger[_0x48a3('0x18')](_0x48a3('0x11'),_0x204d3e,_0x48a3('0x12'));_0x196a66(_0x3ad578['result'][_0x48a3('0x17')]);}})[_0x48a3('0x19')](function(_0x6563c4){logger['error'](_0x48a3('0x11'),_0x204d3e,_0x6563c4);_0x5b6dd2(_0x6563c4);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 6efa12f..c498a15 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 _0xb3b3=['chatWebsite:','./chatWebsite.events','save','remove','emit','removeListener','length'];(function(_0x321e39,_0x2f99c8){var _0x2e5be2=function(_0x14fa6a){while(--_0x14fa6a){_0x321e39['push'](_0x321e39['shift']());}};_0x2e5be2(++_0x2f99c8);}(_0xb3b3,0xc5));var _0x3b3b=function(_0x2985d6,_0x1dd3f1){_0x2985d6=_0x2985d6-0x0;var _0x5ad2bb=_0xb3b3[_0x2985d6];return _0x5ad2bb;};'use strict';var ChatWebsiteEvents=require(_0x3b3b('0x0'));var events=[_0x3b3b('0x1'),_0x3b3b('0x2'),'update'];function createListener(_0x5a6deb,_0x3d8932){return function(_0x53dec7){_0x3d8932[_0x3b3b('0x3')](_0x5a6deb,_0x53dec7);};}function removeListener(_0x20a21d,_0x574747){return function(){ChatWebsiteEvents[_0x3b3b('0x4')](_0x20a21d,_0x574747);};}exports['register']=function(_0x386f32){for(var _0xe2d9a2=0x0,_0x132234=events[_0x3b3b('0x5')];_0xe2d9a2<_0x132234;_0xe2d9a2++){var _0x1ca1f1=events[_0xe2d9a2];var _0x187b23=createListener(_0x3b3b('0x6')+_0x1ca1f1,_0x386f32);ChatWebsiteEvents['on'](_0x1ca1f1,_0x187b23);}}; \ No newline at end of file +var _0xbd8a=['update','emit','removeListener','register','length','chatWebsite:','save'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xbd8a,0x133));var _0xabd8=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xbd8a[_0x48d6a3];return _0x38bfa0;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xabd8('0x0'),'remove',_0xabd8('0x1')];function createListener(_0x47f8cf,_0x1f7efa){return function(_0x5bae34){_0x1f7efa[_0xabd8('0x2')](_0x47f8cf,_0x5bae34);};}function removeListener(_0x22b467,_0x45b759){return function(){ChatWebsiteEvents[_0xabd8('0x3')](_0x22b467,_0x45b759);};}exports[_0xabd8('0x4')]=function(_0x11fb27){for(var _0x3986f2=0x0,_0x3908d3=events[_0xabd8('0x5')];_0x3986f2<_0x3908d3;_0x3986f2++){var _0x2103f0=events[_0x3986f2];var _0x42aac4=createListener(_0xabd8('0x6')+_0x2103f0,_0x11fb27);ChatWebsiteEvents['on'](_0x2103f0,_0x42aac4);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 6389cdd..522ffcf 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 _0xe644=['removeAnswers','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/:id','show','getDispositions','/:id/canned_answers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','/:id/dispositions','addDisposition','addAnswer','join','root','format','%s-%s','now','originalname','post','single','file','addLogo','diskStorage','addAvatar','server/files/images/avatars/','/:id/notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addAgents','update','destroy','delete','removeDispositions'];(function(_0x5a5585,_0xf2eccd){var _0x167909=function(_0x17020d){while(--_0x17020d){_0x5a5585['push'](_0x5a5585['shift']());}};_0x167909(++_0xf2eccd);}(_0xe644,0x1eb));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var path=require('path');var timeout=require(_0x4e64('0x2'));var express=require('express');var router=express[_0x4e64('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4e64('0x4'));var interaction=require(_0x4e64('0x5'));var config=require(_0x4e64('0x6'));var controller=require(_0x4e64('0x7'));router['get']('/',auth[_0x4e64('0x8')](),controller[_0x4e64('0x9')]);router[_0x4e64('0xa')]('/describe',auth[_0x4e64('0x8')](),controller['describe']);router['get'](_0x4e64('0xb'),auth[_0x4e64('0x8')](),controller[_0x4e64('0xc')]);router[_0x4e64('0xa')]('/:id/dispositions',auth[_0x4e64('0x8')](),controller[_0x4e64('0xd')]);router[_0x4e64('0xa')](_0x4e64('0xe'),auth[_0x4e64('0x8')](),controller['getAnswers']);router[_0x4e64('0xa')](_0x4e64('0xf'),controller[_0x4e64('0x10')]);router[_0x4e64('0xa')]('/:id/avatar',controller[_0x4e64('0x11')]);router['get'](_0x4e64('0x12'),controller[_0x4e64('0x13')]);router['get'](_0x4e64('0x14'),controller[_0x4e64('0x15')]);router[_0x4e64('0xa')](_0x4e64('0x16'),auth['isAuthenticated'](),controller[_0x4e64('0x17')]);router[_0x4e64('0xa')](_0x4e64('0x18'),controller[_0x4e64('0x19')]);router[_0x4e64('0xa')](_0x4e64('0x1a'),auth[_0x4e64('0x8')](),controller[_0x4e64('0x1b')]);router[_0x4e64('0xa')](_0x4e64('0x1c'),auth[_0x4e64('0x8')](),controller[_0x4e64('0x1d')]);router[_0x4e64('0xa')](_0x4e64('0x1e'),controller[_0x4e64('0x1f')]);router['get'](_0x4e64('0x20'),auth[_0x4e64('0x8')](),controller[_0x4e64('0x21')]);router[_0x4e64('0xa')](_0x4e64('0x22'),auth[_0x4e64('0x8')](),controller[_0x4e64('0x23')]);router['post']('/',auth[_0x4e64('0x8')](),controller[_0x4e64('0x24')]);router['post'](_0x4e64('0x25'),auth[_0x4e64('0x8')](),controller[_0x4e64('0x26')]);router['post']('/:id/canned_answers',auth[_0x4e64('0x8')](),controller[_0x4e64('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1673cc,_0x8fd4,_0x117e09){_0x117e09(null,path[_0x4e64('0x28')](config[_0x4e64('0x29')],'server/files/images/logos/'));},'filename':function(_0x1d68c6,_0x2178aa,_0x310496){_0x310496(null,util[_0x4e64('0x2a')](_0x4e64('0x2b'),Date[_0x4e64('0x2c')](),_0x2178aa[_0x4e64('0x2d')]));}})});router[_0x4e64('0x2e')](_0x4e64('0xf'),upload[_0x4e64('0x2f')](_0x4e64('0x30')),controller[_0x4e64('0x31')]);var upload=multer({'storage':multer[_0x4e64('0x32')]({'destination':function(_0x3e412d,_0x5ab9f3,_0x144f3e){_0x144f3e(null,path[_0x4e64('0x28')](config[_0x4e64('0x29')],'server/files/images/avatars/'));},'filename':function(_0x1ce79d,_0x5c2a2f,_0x39d6b7){_0x39d6b7(null,util['format']('%s-%s',Date['now'](),_0x5c2a2f[_0x4e64('0x2d')]));}})});router[_0x4e64('0x2e')]('/:id/avatar',upload['single'](_0x4e64('0x30')),controller[_0x4e64('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53945b,_0x3e4e05,_0x5efdbe){_0x5efdbe(null,path[_0x4e64('0x28')](config[_0x4e64('0x29')],'server/files/images/avatars/'));},'filename':function(_0x1cdab9,_0x56b94c,_0xded7c3){_0xded7c3(null,util[_0x4e64('0x2a')]('%s-%s',Date[_0x4e64('0x2c')](),_0x56b94c[_0x4e64('0x2d')]));}})});router[_0x4e64('0x2e')](_0x4e64('0x12'),upload[_0x4e64('0x2f')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1818ce,_0x3e3fc4,_0x295611){_0x295611(null,path[_0x4e64('0x28')](config['root'],_0x4e64('0x34')));},'filename':function(_0x34ae4c,_0x14c3ce,_0x3b7950){_0x3b7950(null,util[_0x4e64('0x2a')](_0x4e64('0x2b'),Date[_0x4e64('0x2c')](),_0x14c3ce[_0x4e64('0x2d')]));}})});router['post'](_0x4e64('0x14'),upload[_0x4e64('0x2f')]('file'),controller['addSystemAvatar']);router['post'](_0x4e64('0x35'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x4e64('0x32')]({'destination':function(_0x21796,_0x1b0f4e,_0x1f7314){const _0x2bcb8c=path['join'](config[_0x4e64('0x29')],'server/files',_0x4e64('0x36'),_0x4e64('0x37'));fs_extra[_0x4e64('0x38')](_0x2bcb8c,function(){_0x1f7314(null,_0x2bcb8c);});},'filename':function(_0x2b1816,_0x1a3f0b,_0x448348){const _0x94f611=_0x1a3f0b[_0x4e64('0x2d')][_0x4e64('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x36df6d=path[_0x4e64('0x3a')](_0x94f611);const _0x5bad6d=Date[_0x4e64('0x2c')]()+'-'+_0x94f611[_0x4e64('0x39')](_0x36df6d,'')+_0x36df6d;_0x448348(null,_0x5bad6d);}})});router[_0x4e64('0x2e')](_0x4e64('0x3b'),offlineUploadMulter[_0x4e64('0x3c')](),controller[_0x4e64('0x3d')]);router[_0x4e64('0x2e')](_0x4e64('0x16'),auth[_0x4e64('0x8')](),controller[_0x4e64('0x3e')]);router[_0x4e64('0x2e')](_0x4e64('0x1a'),auth[_0x4e64('0x8')](),controller[_0x4e64('0x3f')]);router[_0x4e64('0x2e')](_0x4e64('0x1c'),auth[_0x4e64('0x8')](),controller['addProactiveActions']);router['post']('/:id/users',auth[_0x4e64('0x8')](),controller[_0x4e64('0x40')]);router['put']('/:id',auth[_0x4e64('0x8')](),controller[_0x4e64('0x41')]);router['delete'](_0x4e64('0xb'),auth[_0x4e64('0x8')](),controller[_0x4e64('0x42')]);router[_0x4e64('0x43')]('/:id/dispositions',auth[_0x4e64('0x8')](),controller[_0x4e64('0x44')]);router[_0x4e64('0x43')](_0x4e64('0xe'),auth[_0x4e64('0x8')](),controller[_0x4e64('0x45')]);router[_0x4e64('0x43')](_0x4e64('0x22'),auth[_0x4e64('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x3f4c=['describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','diskStorage','join','root','%s-%s','now','originalname','/:id/logo','single','file','addLogo','/:id/avatar','addAvatar','server/files/images/avatars/','format','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','ensureDir','replace','extname','any','addInteraction','addApplications','addProactiveActions','addAgents','put','delete','removeAnswers','removeAgents','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe'];(function(_0x39104f,_0x13890f){var _0x3aa11b=function(_0x349847){while(--_0x349847){_0x39104f['push'](_0x39104f['shift']());}};_0x3aa11b(++_0x13890f);}(_0x3f4c,0x1ef));var _0xc3f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f4c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc3f4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc3f4('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc3f4('0x2'));var interaction=require(_0xc3f4('0x3'));var config=require(_0xc3f4('0x4'));var controller=require(_0xc3f4('0x5'));router[_0xc3f4('0x6')]('/',auth[_0xc3f4('0x7')](),controller['index']);router[_0xc3f4('0x6')](_0xc3f4('0x8'),auth[_0xc3f4('0x7')](),controller[_0xc3f4('0x9')]);router['get'](_0xc3f4('0xa'),auth[_0xc3f4('0x7')](),controller['show']);router[_0xc3f4('0x6')]('/:id/dispositions',auth[_0xc3f4('0x7')](),controller[_0xc3f4('0xb')]);router[_0xc3f4('0x6')](_0xc3f4('0xc'),auth[_0xc3f4('0x7')](),controller[_0xc3f4('0xd')]);router[_0xc3f4('0x6')]('/:id/logo',controller['getLogo']);router[_0xc3f4('0x6')]('/:id/avatar',controller['getAvatar']);router[_0xc3f4('0x6')](_0xc3f4('0xe'),controller[_0xc3f4('0xf')]);router[_0xc3f4('0x6')](_0xc3f4('0x10'),controller[_0xc3f4('0x11')]);router[_0xc3f4('0x6')](_0xc3f4('0x12'),auth[_0xc3f4('0x7')](),controller['getInteractions']);router[_0xc3f4('0x6')](_0xc3f4('0x13'),controller[_0xc3f4('0x14')]);router[_0xc3f4('0x6')]('/:id/applications',auth[_0xc3f4('0x7')](),controller[_0xc3f4('0x15')]);router['get'](_0xc3f4('0x16'),auth[_0xc3f4('0x7')](),controller['getProactiveActions']);router[_0xc3f4('0x6')]('/:id/fields',controller[_0xc3f4('0x17')]);router['get'](_0xc3f4('0x18'),auth['isAuthenticated'](),controller[_0xc3f4('0x19')]);router[_0xc3f4('0x6')](_0xc3f4('0x1a'),auth[_0xc3f4('0x7')](),controller[_0xc3f4('0x1b')]);router[_0xc3f4('0x1c')]('/',auth['isAuthenticated'](),controller[_0xc3f4('0x1d')]);router[_0xc3f4('0x1c')](_0xc3f4('0x1e'),auth[_0xc3f4('0x7')](),controller['addDisposition']);router[_0xc3f4('0x1c')](_0xc3f4('0xc'),auth[_0xc3f4('0x7')](),controller[_0xc3f4('0x1f')]);var upload=multer({'storage':multer[_0xc3f4('0x20')]({'destination':function(_0x43c539,_0x168040,_0x5d2eb7){_0x5d2eb7(null,path[_0xc3f4('0x21')](config[_0xc3f4('0x22')],'server/files/images/logos/'));},'filename':function(_0x2e907f,_0xf7c2dc,_0xe49b7e){_0xe49b7e(null,util['format'](_0xc3f4('0x23'),Date[_0xc3f4('0x24')](),_0xf7c2dc[_0xc3f4('0x25')]));}})});router[_0xc3f4('0x1c')](_0xc3f4('0x26'),upload[_0xc3f4('0x27')](_0xc3f4('0x28')),controller[_0xc3f4('0x29')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x58b424,_0x103e6a,_0x73221e){_0x73221e(null,path[_0xc3f4('0x21')](config[_0xc3f4('0x22')],'server/files/images/avatars/'));},'filename':function(_0x907b82,_0x3c718d,_0x58d0ac){_0x58d0ac(null,util['format'](_0xc3f4('0x23'),Date['now'](),_0x3c718d[_0xc3f4('0x25')]));}})});router[_0xc3f4('0x1c')](_0xc3f4('0x2a'),upload[_0xc3f4('0x27')](_0xc3f4('0x28')),controller[_0xc3f4('0x2b')]);var upload=multer({'storage':multer[_0xc3f4('0x20')]({'destination':function(_0x177888,_0xfcf561,_0x2bf013){_0x2bf013(null,path[_0xc3f4('0x21')](config[_0xc3f4('0x22')],_0xc3f4('0x2c')));},'filename':function(_0x55b19b,_0x244d3f,_0x3403d9){_0x3403d9(null,util[_0xc3f4('0x2d')](_0xc3f4('0x23'),Date[_0xc3f4('0x24')](),_0x244d3f['originalname']));}})});router['post'](_0xc3f4('0xe'),upload[_0xc3f4('0x27')](_0xc3f4('0x28')),controller[_0xc3f4('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b1979,_0x10589e,_0x1c2e45){_0x1c2e45(null,path[_0xc3f4('0x21')](config[_0xc3f4('0x22')],_0xc3f4('0x2c')));},'filename':function(_0xdb23f0,_0x2ef58c,_0x517392){_0x517392(null,util[_0xc3f4('0x2d')](_0xc3f4('0x23'),Date[_0xc3f4('0x24')](),_0x2ef58c['originalname']));}})});router[_0xc3f4('0x1c')]('/:id/system_avatar',upload['single'](_0xc3f4('0x28')),controller[_0xc3f4('0x2f')]);router[_0xc3f4('0x1c')](_0xc3f4('0x30'),controller[_0xc3f4('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0xc3f4('0x20')]({'destination':function(_0x175b87,_0x218b10,_0x52dd0a){const _0x235bde=path[_0xc3f4('0x21')](config[_0xc3f4('0x22')],_0xc3f4('0x32'),'attachments','offline-chat');fs_extra[_0xc3f4('0x33')](_0x235bde,function(){_0x52dd0a(null,_0x235bde);});},'filename':function(_0x21b63b,_0x59277f,_0x38f9ca){const _0x1b5c9e=_0x59277f['originalname'][_0xc3f4('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x977be3=path[_0xc3f4('0x35')](_0x1b5c9e);const _0x3412d1=Date['now']()+'-'+_0x1b5c9e[_0xc3f4('0x34')](_0x977be3,'')+_0x977be3;_0x38f9ca(null,_0x3412d1);}})});router['post']('/:id/offline',offlineUploadMulter[_0xc3f4('0x36')](),controller['offline']);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0xc3f4('0x37')]);router[_0xc3f4('0x1c')]('/:id/applications',auth[_0xc3f4('0x7')](),controller[_0xc3f4('0x38')]);router['post'](_0xc3f4('0x16'),auth[_0xc3f4('0x7')](),controller[_0xc3f4('0x39')]);router['post'](_0xc3f4('0x1a'),auth[_0xc3f4('0x7')](),controller[_0xc3f4('0x3a')]);router[_0xc3f4('0x3b')](_0xc3f4('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc3f4('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xc3f4('0x3c')](_0xc3f4('0x1e'),auth[_0xc3f4('0x7')](),controller['removeDispositions']);router[_0xc3f4('0x3c')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc3f4('0x3d')]);router[_0xc3f4('0x3c')](_0xc3f4('0x1a'),auth[_0xc3f4('0x7')](),controller[_0xc3f4('0x3e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index eee9ec9..8fb11d6 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca0e=['exports','express','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','use','isAuthenticated'];(function(_0x3ca3e2,_0x159af3){var _0x905966=function(_0x144b6c){while(--_0x144b6c){_0x3ca3e2['push'](_0x3ca3e2['shift']());}};_0x905966(++_0x159af3);}(_0xca0e,0x1d5));var _0xeca0=function(_0x162ac4,_0x5dd373){_0x162ac4=_0x162ac4-0x0;var _0x41250f=_0xca0e[_0x162ac4];return _0x41250f;};var beaverLogger=require('beaver-logger/server');var express=require(_0xeca0('0x0'));var auth=require(_0xeca0('0x1'));var config=require(_0xeca0('0x2'));var router=express[_0xeca0('0x3')]();var isProduction=config[_0xeca0('0x4')]===_0xeca0('0x5')||![];function clientSideLogs(_0x560018,_0x54a1c1,_0x1e0bb5){var _0x1c15ee=_0x560018[_0xeca0('0x6')][_0xeca0('0x7')](_0xeca0('0x8'));if(!_0x1c15ee){throw new Error(_0xeca0('0x9'));}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x1c15ee,'enableCors':!isProduction})(_0x560018,_0x54a1c1,_0x1e0bb5);}router[_0xeca0('0xa')](auth[_0xeca0('0xb')](),clientSideLogs);module[_0xeca0('0xc')]=router; \ No newline at end of file +var _0x28fd=['exports','beaver-logger/server','express','../components/auth/service','../config/environment','env','production','app','get','client-side-logger','expressEndpoint','/client-logs','use','isAuthenticated'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x28fd,0x135));var _0xd28f=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x28fd[_0x34325b];return _0x3da348;};var beaverLogger=require(_0xd28f('0x0'));var express=require(_0xd28f('0x1'));var auth=require(_0xd28f('0x2'));var config=require(_0xd28f('0x3'));var router=express['Router']();var isProduction=config[_0xd28f('0x4')]===_0xd28f('0x5')||![];function clientSideLogs(_0x39163b,_0x7aca7,_0x27f215){var _0x1bfc0c=_0x39163b[_0xd28f('0x6')][_0xd28f('0x7')](_0xd28f('0x8'));if(!_0x1bfc0c){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xd28f('0x9')]({'uri':_0xd28f('0xa'),'logger':_0x1bfc0c,'enableCors':!isProduction})(_0x39163b,_0x7aca7,_0x27f215);}router[_0xd28f('0xb')](auth[_0xd28f('0xc')](),clientSideLogs);module[_0xd28f('0xd')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 5e85437..1828701 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 _0xbdbd=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','STRING','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','MicrosoftAzure'];(function(_0x3bd530,_0x6007c0){var _0xe3e781=function(_0x2757c3){while(--_0x2757c3){_0x3bd530['push'](_0x3bd530['shift']());}};_0xe3e781(++_0x6007c0);}(_0xbdbd,0xeb));var _0xdbdb=function(_0x3e82be,_0x4bb290){_0x3e82be=_0x3e82be-0x0;var _0x5c9d92=_0xbdbd[_0x3e82be];return _0x5c9d92;};'use strict';var Sequelize=require(_0xdbdb('0x0'));module[_0xdbdb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xdbdb('0x2')](_0xdbdb('0x3'),'Google',_0xdbdb('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xdbdb('0x5'),_0xdbdb('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0xdbdb('0x7')},'data2':{'type':Sequelize['STRING'],'comment':_0xdbdb('0x8')},'data3':{'type':Sequelize[_0xdbdb('0x9')],'comment':_0xdbdb('0xa')},'data4':{'type':Sequelize[_0xdbdb('0x9')],'comment':_0xdbdb('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':_0xdbdb('0xc')},'data6':{'type':Sequelize[_0xdbdb('0xd')],'comment':_0xdbdb('0xe')},'data7':{'type':Sequelize[_0xdbdb('0xd')],'comment':_0xdbdb('0xf')}}; \ No newline at end of file +var _0xeeb0=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','MicrosoftAzure','Outlook365'];(function(_0xea9a5d,_0x4fbf4a){var _0x344633=function(_0x11de98){while(--_0x11de98){_0xea9a5d['push'](_0xea9a5d['shift']());}};_0x344633(++_0x4fbf4a);}(_0xeeb0,0xb5));var _0x0eeb=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0xeeb0[_0x387dc1];return _0x17567c;};'use strict';var Sequelize=require(_0x0eeb('0x0'));module[_0x0eeb('0x1')]={'name':{'type':Sequelize[_0x0eeb('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x0eeb('0x3'),'Google',_0x0eeb('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x0eeb('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0x0eeb('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x0eeb('0x2')],'comment':_0x0eeb('0x6')},'data3':{'type':Sequelize[_0x0eeb('0x2')],'comment':_0x0eeb('0x7')},'data4':{'type':Sequelize['STRING'],'comment':_0x0eeb('0x8')},'data5':{'type':Sequelize[_0x0eeb('0x9')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x0eeb('0x9')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x0eeb('0x9')],'comment':_0x0eeb('0xa')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 8770cb0..bb55bb1 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 _0x36d7=['set','Content-Range','update','destroy','then','end','error','stack','name','send','slice','index','map','CloudProvider','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','fields','create','Name\x20parameter\x20not\x20specified','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','json','offset','undefined','limit','count','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x36d7,0x10d));var _0x736d=function(_0x203f90,_0x1f112d){_0x203f90=_0x203f90-0x0;var _0x3f8714=_0x36d7[_0x203f90];return _0x3f8714;};'use strict';var _=require('lodash');var Redis=require(_0x736d('0x0'));var qs=require(_0x736d('0x1'));var encryptor=require(_0x736d('0x2'));var config=require('../../config/environment');var logger=require(_0x736d('0x3'))('api');var db=require(_0x736d('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_[_0x736d('0x5')](config[_0x736d('0x6')],{'host':_0x736d('0x7'),'port':0x18eb});var socket=require(_0x736d('0x8'))(new Redis(config[_0x736d('0x6')]));var redis=new Redis(config[_0x736d('0x6')]);function respondWithStatusCode(_0xdb924b,_0x40b786){_0x40b786=_0x40b786||0xcc;return function(_0x504e74){if(_0x504e74){return _0xdb924b[_0x736d('0x9')](_0x40b786);}return _0xdb924b['status'](_0x40b786)['end']();};}function respondWithResult(_0x2c59a5,_0x2899ca){_0x2899ca=_0x2899ca||0xc8;return function(_0x13e160){if(_0x13e160){return _0x2c59a5['status'](_0x2899ca)[_0x736d('0xa')](_0x13e160);}};}function respondWithFilteredResult(_0xfcd7cd,_0x5de6a7){return function(_0x3b4b3c){if(_0x3b4b3c){var _0x5720ae=typeof _0x5de6a7[_0x736d('0xb')]===_0x736d('0xc')&&typeof _0x5de6a7[_0x736d('0xd')]==='undefined';var _0x1232af=_0x3b4b3c[_0x736d('0xe')];var _0x49982b=_0x5720ae?0x0:_0x5de6a7[_0x736d('0xb')];var _0x4a57d0=_0x5720ae?_0x3b4b3c[_0x736d('0xe')]:_0x5de6a7[_0x736d('0xb')]+_0x5de6a7['limit'];var _0x130793;if(_0x4a57d0>=_0x1232af){_0x4a57d0=_0x1232af;_0x130793=0xc8;}else{_0x130793=0xce;}_0xfcd7cd[_0x736d('0xf')](_0x130793);return _0xfcd7cd[_0x736d('0x10')](_0x736d('0x11'),_0x49982b+'-'+_0x4a57d0+'/'+_0x1232af)['json'](_0x3b4b3c);}return null;};}function saveUpdates(_0x1f7fb2){return function(_0x308322){if(_0x308322){return _0x308322[_0x736d('0x12')](_0x1f7fb2)['then'](function(_0x336312){return _0x336312;});}return null;};}function removeEntity(_0x44ec98){return function(_0xf105fe){if(_0xf105fe){return _0xf105fe[_0x736d('0x13')]()[_0x736d('0x14')](function(){_0x44ec98[_0x736d('0xf')](0xcc)[_0x736d('0x15')]();});}};}function handleEntityNotFound(_0x430642){return function(_0x30566f){if(!_0x30566f){_0x430642[_0x736d('0x9')](0x194);}return _0x30566f;};}function handleError(_0x2a1da9,_0x38c322){_0x38c322=_0x38c322||0x1f4;return function(_0x215bae){logger[_0x736d('0x16')](_0x215bae[_0x736d('0x17')]);if(_0x215bae[_0x736d('0x18')]){delete _0x215bae['name'];}_0x2a1da9[_0x736d('0xf')](_0x38c322)[_0x736d('0x19')](_0x215bae);};}function maskClientSecret(_0x555856){return _['padEnd'](_0x555856[_0x736d('0x1a')](0x0,0x3),0x14,'*');}exports[_0x736d('0x1b')]=function(_0x938e6d,_0x3a40ab){var _0x4b272a={},_0x527e60={},_0x45fad0={'count':0x0,'rows':[]};var _0x83c125=_[_0x736d('0x1c')](db[_0x736d('0x1d')][_0x736d('0x1e')],function(_0x836365){return{'name':_0x836365['fieldName'],'type':_0x836365['type'][_0x736d('0x1f')]};});_0x527e60['model']=_[_0x736d('0x1c')](_0x83c125,_0x736d('0x18'));_0x527e60[_0x736d('0x20')]=_[_0x736d('0x21')](_0x938e6d[_0x736d('0x20')]);_0x527e60[_0x736d('0x22')]=_[_0x736d('0x23')](_0x527e60[_0x736d('0x24')],_0x527e60[_0x736d('0x20')]);_0x4b272a[_0x736d('0x25')]=_[_0x736d('0x23')](_0x527e60[_0x736d('0x24')],qs['fields'](_0x938e6d[_0x736d('0x20')]['fields']));_0x4b272a[_0x736d('0x25')]=_0x4b272a[_0x736d('0x25')][_0x736d('0x26')]?_0x4b272a[_0x736d('0x25')]:_0x527e60[_0x736d('0x24')];if(!_0x938e6d[_0x736d('0x20')][_0x736d('0x27')](_0x736d('0x28'))){_0x4b272a[_0x736d('0xd')]=qs[_0x736d('0xd')](_0x938e6d[_0x736d('0x20')][_0x736d('0xd')]);_0x4b272a[_0x736d('0xb')]=qs[_0x736d('0xb')](_0x938e6d[_0x736d('0x20')][_0x736d('0xb')]);}_0x4b272a[_0x736d('0x29')]=qs[_0x736d('0x2a')](_0x938e6d[_0x736d('0x20')][_0x736d('0x2a')]);_0x4b272a['where']=qs[_0x736d('0x22')](_['pick'](_0x938e6d[_0x736d('0x20')],_0x527e60[_0x736d('0x22')]),_0x83c125);if(_0x938e6d[_0x736d('0x20')]['filter']){_0x4b272a[_0x736d('0x2b')]=_['merge'](_0x4b272a[_0x736d('0x2b')],{'$or':_[_0x736d('0x1c')](_0x83c125,function(_0x26f582){if(_0x26f582[_0x736d('0x2c')]!==_0x736d('0x2d')){var _0x2e7eb0={};_0x2e7eb0[_0x26f582['name']]={'$like':'%'+_0x938e6d[_0x736d('0x20')][_0x736d('0x2e')]+'%'};return _0x2e7eb0;}})});}_0x4b272a=_[_0x736d('0x2f')]({},_0x4b272a,_0x938e6d[_0x736d('0x30')]);var _0x19163a={'where':_0x4b272a['where']};return db['CloudProvider'][_0x736d('0xe')](_0x19163a)[_0x736d('0x14')](function(_0x244f35){_0x45fad0[_0x736d('0xe')]=_0x244f35;if(_0x938e6d['query'][_0x736d('0x31')]){_0x4b272a[_0x736d('0x32')]=[{'all':!![]}];}return db[_0x736d('0x1d')][_0x736d('0x33')](_0x4b272a);})[_0x736d('0x14')](function(_0x2deb4c){_0x45fad0[_0x736d('0x34')]=_['map'](_0x2deb4c,function(_0x5c3ad8){if(_0x5c3ad8[_0x736d('0x35')]===_0x736d('0x36')){var _0x25d58f=encryptor['decryptString'](_0x5c3ad8[_0x736d('0x37')]);_0x5c3ad8[_0x736d('0x37')]=maskClientSecret(_0x25d58f);}return _0x5c3ad8;});return _0x45fad0;})[_0x736d('0x14')](respondWithFilteredResult(_0x3a40ab,_0x4b272a))[_0x736d('0x38')](handleError(_0x3a40ab,null));};exports[_0x736d('0x39')]=function(_0x3fae37,_0x46a65f){var _0x28cb89={'raw':!![],'where':{'id':_0x3fae37[_0x736d('0x3a')]['id']}},_0x331764={};_0x331764['model']=_[_0x736d('0x21')](db['CloudProvider'][_0x736d('0x1e')]);_0x331764[_0x736d('0x20')]=_[_0x736d('0x21')](_0x3fae37['query']);_0x331764[_0x736d('0x22')]=_[_0x736d('0x23')](_0x331764[_0x736d('0x24')],_0x331764[_0x736d('0x20')]);_0x28cb89['attributes']=_[_0x736d('0x23')](_0x331764[_0x736d('0x24')],qs[_0x736d('0x3b')](_0x3fae37[_0x736d('0x20')][_0x736d('0x3b')]));_0x28cb89['attributes']=_0x28cb89[_0x736d('0x25')][_0x736d('0x26')]?_0x28cb89[_0x736d('0x25')]:_0x331764['model'];if(_0x3fae37['query'][_0x736d('0x31')]){_0x28cb89[_0x736d('0x32')]=[{'all':!![]}];}_0x28cb89=_[_0x736d('0x2f')]({},_0x28cb89,_0x3fae37[_0x736d('0x30')]);return db[_0x736d('0x1d')]['find'](_0x28cb89)[_0x736d('0x14')](handleEntityNotFound(_0x46a65f,null))['then'](function(_0x4a4ba5){if(_0x4a4ba5['service']==='MicrosoftAzure'){var _0x39d48e=encryptor['decryptString'](_0x4a4ba5[_0x736d('0x37')]);_0x4a4ba5[_0x736d('0x37')]=maskClientSecret(_0x39d48e);}return _0x4a4ba5;})[_0x736d('0x14')](respondWithResult(_0x46a65f,null))[_0x736d('0x38')](handleError(_0x46a65f,null));};exports[_0x736d('0x3c')]=function(_0xf4392,_0x298034){if(!_0xf4392['body'][_0x736d('0x18')])throw new Error(_0x736d('0x3d'));if(!_0xf4392[_0x736d('0x3e')]['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x116db0=db[_0x736d('0x1d')][_0x736d('0x1e')]['service'][_0x736d('0x3f')];if(!_0x116db0[_0x736d('0x40')](_0xf4392['body'][_0x736d('0x35')]))throw new Error(_0x736d('0x41')+_0x116db0[_0x736d('0x42')](',\x20'));if(_0xf4392[_0x736d('0x3e')][_0x736d('0x35')]==='MicrosoftAzure'&&_0xf4392[_0x736d('0x3e')][_0x736d('0x37')]){_0xf4392['body'][_0x736d('0x37')]=encryptor[_0x736d('0x43')](_0xf4392[_0x736d('0x3e')][_0x736d('0x37')]);}return db['CloudProvider'][_0x736d('0x3c')](_0xf4392[_0x736d('0x3e')],{})[_0x736d('0x14')](respondWithResult(_0x298034,0xc9))['catch'](handleError(_0x298034,null));};exports[_0x736d('0x12')]=function(_0x17fa73,_0x27f360){if(_0x17fa73[_0x736d('0x3e')]['id']){delete _0x17fa73[_0x736d('0x3e')]['id'];}return db[_0x736d('0x1d')][_0x736d('0x44')]({'where':{'id':_0x17fa73[_0x736d('0x3a')]['id']}})[_0x736d('0x14')](handleEntityNotFound(_0x27f360,null))[_0x736d('0x14')](function(_0x52b2d9){if(_0x52b2d9[_0x736d('0x35')]===_0x736d('0x36')&&_0x17fa73[_0x736d('0x3e')][_0x736d('0x37')]){_0x17fa73[_0x736d('0x3e')][_0x736d('0x37')]=encryptor[_0x736d('0x43')](_0x17fa73[_0x736d('0x3e')][_0x736d('0x37')]);}return _0x52b2d9;})[_0x736d('0x14')](saveUpdates(_0x17fa73[_0x736d('0x3e')],null))['then'](respondWithResult(_0x27f360,null))[_0x736d('0x38')](handleError(_0x27f360,null));};exports[_0x736d('0x13')]=function(_0x3b6c35,_0x263b31){return db[_0x736d('0x1d')]['find']({'where':{'id':_0x3b6c35[_0x736d('0x3a')]['id']}})[_0x736d('0x14')](handleEntityNotFound(_0x263b31,null))['then'](removeEntity(_0x263b31,null))[_0x736d('0x38')](handleError(_0x263b31,null));};exports[_0x736d('0x45')]=function(_0x2dc79d,_0x158509){return db[_0x736d('0x1d')][_0x736d('0x46')]({'where':{'id':_0x2dc79d[_0x736d('0x3a')]['id']},'raw':!![]})[_0x736d('0x14')](function(_0x1adde5){if(!_0x1adde5)return _0x158509[_0x736d('0x9')](0x194);return{'url':oauth[_0x736d('0x47')](_0x1adde5,_0x2dc79d[_0x736d('0x48')]['id'])};})[_0x736d('0x14')](respondWithResult(_0x158509,null))[_0x736d('0x38')](handleError(_0x158509,null));};exports[_0x736d('0x49')]=function(_0x312f2c,_0x34bc98){var _0xc00079=_0x312f2c[_0x736d('0x3e')];var _0x212a3d;var _0x1f7994;if(_0xc00079['error'])throw _0xc00079;redis['get'](_0xc00079[_0x736d('0x4a')])['then'](function(_0x4ba58f){if(!_0x4ba58f)throw new Error('Invalid\x20state\x20parameter');_0x212a3d=JSON['parse'](_0x4ba58f);var _0x2a14f8=Buffer[_0x736d('0x4b')](_0xc00079['state'],_0x736d('0x4c'))[_0x736d('0x4d')](_0x736d('0x4e'));_0x1f7994=JSON['parse'](_0x2a14f8);if(!oauth[_0x736d('0x4f')](_0xc00079[_0x736d('0x50')],_0x212a3d[_0x736d('0x51')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x736d('0x52')](_0xc00079[_0x736d('0x4a')]);return oauth[_0x736d('0x53')](_0xc00079['code'],_0x212a3d);})[_0x736d('0x14')](function(_0x3f0822){_0x212a3d[_0x736d('0x54')]=_0x3f0822[_0x736d('0x55')];_0x212a3d[_0x736d('0x56')]=_0x3f0822[_0x736d('0x57')];return db['CloudProvider'][_0x736d('0x12')]({'data5':_0x212a3d['data5'],'data6':_0x212a3d['data6']},{'where':{'id':_0x212a3d['id']}});})[_0x736d('0x14')](function(){oauth['startRefreshInterval'](_0x212a3d);socket[_0x736d('0x58')](_0x736d('0x59'),{'id':_0x1f7994['id']});return;})[_0x736d('0x14')](respondWithStatusCode(_0x34bc98,null))[_0x736d('0x38')](function(_0x21d95a){if(_0x1f7994){socket[_0x736d('0x58')](_0x736d('0x5a'),{'id':_0x1f7994['id']});}if(!_0x212a3d){logger[_0x736d('0x16')](_0x736d('0x5b'),_0x21d95a);return _0x34bc98[_0x736d('0xf')](0x1f4)[_0x736d('0x19')](_0x21d95a[_0x736d('0x5c')]);}logger[_0x736d('0x16')](_0x736d('0x5d'),_0x212a3d['id'],JSON[_0x736d('0x5e')](_0x21d95a));});}; \ No newline at end of file +var _0x09e8=['CloudProvider','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','keys','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','find','params','oauth2MicrosoftAuthorize','findOne','user','parse','from','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','state','getOauth2MicrosoftAccessToken','access_token','data5','data6','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','redis','defaults','localhost','socket.io-emitter','status','offset','undefined','limit','count','set','Content-Range','then','destroy','sendStatus','error','stack','name','send','padEnd','slice','index','map'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x09e8,0x95));var _0x809e=function(_0x11ca5c,_0x270dd6){_0x11ca5c=_0x11ca5c-0x0;var _0x196716=_0x09e8[_0x11ca5c];return _0x196716;};'use strict';var _=require('lodash');var Redis=require(_0x809e('0x0'));var qs=require(_0x809e('0x1'));var encryptor=require(_0x809e('0x2'));var config=require(_0x809e('0x3'));var logger=require(_0x809e('0x4'))('api');var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0x809e('0x5')]=_[_0x809e('0x6')](config[_0x809e('0x5')],{'host':_0x809e('0x7'),'port':0x18eb});var socket=require(_0x809e('0x8'))(new Redis(config[_0x809e('0x5')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x52b164,_0x5046d8){_0x5046d8=_0x5046d8||0xcc;return function(_0x55a7a9){if(_0x55a7a9){return _0x52b164['sendStatus'](_0x5046d8);}return _0x52b164[_0x809e('0x9')](_0x5046d8)['end']();};}function respondWithResult(_0x261e53,_0x4b8bb3){_0x4b8bb3=_0x4b8bb3||0xc8;return function(_0x3b6b0f){if(_0x3b6b0f){return _0x261e53['status'](_0x4b8bb3)['json'](_0x3b6b0f);}};}function respondWithFilteredResult(_0x2598cd,_0x511a8c){return function(_0x4fdbd1){if(_0x4fdbd1){var _0x4334fc=typeof _0x511a8c[_0x809e('0xa')]===_0x809e('0xb')&&typeof _0x511a8c[_0x809e('0xc')]==='undefined';var _0x5e70a6=_0x4fdbd1[_0x809e('0xd')];var _0x54a528=_0x4334fc?0x0:_0x511a8c[_0x809e('0xa')];var _0x4bf11d=_0x4334fc?_0x4fdbd1[_0x809e('0xd')]:_0x511a8c[_0x809e('0xa')]+_0x511a8c[_0x809e('0xc')];var _0x3d8863;if(_0x4bf11d>=_0x5e70a6){_0x4bf11d=_0x5e70a6;_0x3d8863=0xc8;}else{_0x3d8863=0xce;}_0x2598cd[_0x809e('0x9')](_0x3d8863);return _0x2598cd[_0x809e('0xe')](_0x809e('0xf'),_0x54a528+'-'+_0x4bf11d+'/'+_0x5e70a6)['json'](_0x4fdbd1);}return null;};}function saveUpdates(_0x7a3fdd){return function(_0x4da1c2){if(_0x4da1c2){return _0x4da1c2['update'](_0x7a3fdd)[_0x809e('0x10')](function(_0x19c2c2){return _0x19c2c2;});}return null;};}function removeEntity(_0x44cbc9){return function(_0x28b65a){if(_0x28b65a){return _0x28b65a[_0x809e('0x11')]()[_0x809e('0x10')](function(){_0x44cbc9[_0x809e('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x531b03){return function(_0xd9e546){if(!_0xd9e546){_0x531b03[_0x809e('0x12')](0x194);}return _0xd9e546;};}function handleError(_0x4d8f90,_0x4b6106){_0x4b6106=_0x4b6106||0x1f4;return function(_0x22c7fd){logger[_0x809e('0x13')](_0x22c7fd[_0x809e('0x14')]);if(_0x22c7fd[_0x809e('0x15')]){delete _0x22c7fd[_0x809e('0x15')];}_0x4d8f90[_0x809e('0x9')](_0x4b6106)[_0x809e('0x16')](_0x22c7fd);};}function maskClientSecret(_0x28934d){return _[_0x809e('0x17')](_0x28934d[_0x809e('0x18')](0x0,0x3),0x14,'*');}exports[_0x809e('0x19')]=function(_0x139e0c,_0x455c42){var _0x5e205e={},_0x290435={},_0x359364={'count':0x0,'rows':[]};var _0x1992ec=_[_0x809e('0x1a')](db[_0x809e('0x1b')][_0x809e('0x1c')],function(_0x25281d){return{'name':_0x25281d[_0x809e('0x1d')],'type':_0x25281d[_0x809e('0x1e')]['key']};});_0x290435[_0x809e('0x1f')]=_[_0x809e('0x1a')](_0x1992ec,_0x809e('0x15'));_0x290435[_0x809e('0x20')]=_['keys'](_0x139e0c[_0x809e('0x20')]);_0x290435[_0x809e('0x21')]=_['intersection'](_0x290435['model'],_0x290435['query']);_0x5e205e['attributes']=_[_0x809e('0x22')](_0x290435[_0x809e('0x1f')],qs[_0x809e('0x23')](_0x139e0c[_0x809e('0x20')][_0x809e('0x23')]));_0x5e205e[_0x809e('0x24')]=_0x5e205e['attributes']['length']?_0x5e205e[_0x809e('0x24')]:_0x290435['model'];if(!_0x139e0c['query'][_0x809e('0x25')](_0x809e('0x26'))){_0x5e205e[_0x809e('0xc')]=qs[_0x809e('0xc')](_0x139e0c[_0x809e('0x20')][_0x809e('0xc')]);_0x5e205e[_0x809e('0xa')]=qs[_0x809e('0xa')](_0x139e0c[_0x809e('0x20')][_0x809e('0xa')]);}_0x5e205e['order']=qs['sort'](_0x139e0c[_0x809e('0x20')][_0x809e('0x27')]);_0x5e205e[_0x809e('0x28')]=qs[_0x809e('0x21')](_[_0x809e('0x29')](_0x139e0c['query'],_0x290435[_0x809e('0x21')]),_0x1992ec);if(_0x139e0c[_0x809e('0x20')][_0x809e('0x2a')]){_0x5e205e[_0x809e('0x28')]=_['merge'](_0x5e205e[_0x809e('0x28')],{'$or':_[_0x809e('0x1a')](_0x1992ec,function(_0x44e5c7){if(_0x44e5c7[_0x809e('0x1e')]!==_0x809e('0x2b')){var _0x28dc4c={};_0x28dc4c[_0x44e5c7['name']]={'$like':'%'+_0x139e0c[_0x809e('0x20')]['filter']+'%'};return _0x28dc4c;}})});}_0x5e205e=_[_0x809e('0x2c')]({},_0x5e205e,_0x139e0c[_0x809e('0x2d')]);var _0x178f91={'where':_0x5e205e[_0x809e('0x28')]};return db[_0x809e('0x1b')]['count'](_0x178f91)['then'](function(_0x3c9380){_0x359364['count']=_0x3c9380;if(_0x139e0c[_0x809e('0x20')][_0x809e('0x2e')]){_0x5e205e[_0x809e('0x2f')]=[{'all':!![]}];}return db['CloudProvider'][_0x809e('0x30')](_0x5e205e);})[_0x809e('0x10')](function(_0x28f13a){_0x359364[_0x809e('0x31')]=_[_0x809e('0x1a')](_0x28f13a,function(_0x5a9aa3){if(_0x5a9aa3[_0x809e('0x32')]===_0x809e('0x33')){var _0x38fdc4=encryptor[_0x809e('0x34')](_0x5a9aa3[_0x809e('0x35')]);_0x5a9aa3[_0x809e('0x35')]=maskClientSecret(_0x38fdc4);}return _0x5a9aa3;});return _0x359364;})['then'](respondWithFilteredResult(_0x455c42,_0x5e205e))[_0x809e('0x36')](handleError(_0x455c42,null));};exports[_0x809e('0x37')]=function(_0x5ac292,_0x1452ba){var _0x4c944f={'raw':!![],'where':{'id':_0x5ac292['params']['id']}},_0x10e653={};_0x10e653[_0x809e('0x1f')]=_[_0x809e('0x38')](db['CloudProvider']['rawAttributes']);_0x10e653[_0x809e('0x20')]=_[_0x809e('0x38')](_0x5ac292[_0x809e('0x20')]);_0x10e653[_0x809e('0x21')]=_[_0x809e('0x22')](_0x10e653[_0x809e('0x1f')],_0x10e653[_0x809e('0x20')]);_0x4c944f[_0x809e('0x24')]=_['intersection'](_0x10e653[_0x809e('0x1f')],qs['fields'](_0x5ac292['query']['fields']));_0x4c944f[_0x809e('0x24')]=_0x4c944f[_0x809e('0x24')]['length']?_0x4c944f[_0x809e('0x24')]:_0x10e653[_0x809e('0x1f')];if(_0x5ac292[_0x809e('0x20')]['includeAll']){_0x4c944f[_0x809e('0x2f')]=[{'all':!![]}];}_0x4c944f=_[_0x809e('0x2c')]({},_0x4c944f,_0x5ac292[_0x809e('0x2d')]);return db[_0x809e('0x1b')]['find'](_0x4c944f)['then'](handleEntityNotFound(_0x1452ba,null))[_0x809e('0x10')](function(_0x50e3f6){if(_0x50e3f6['service']===_0x809e('0x33')){var _0xd42b24=encryptor['decryptString'](_0x50e3f6[_0x809e('0x35')]);_0x50e3f6[_0x809e('0x35')]=maskClientSecret(_0xd42b24);}return _0x50e3f6;})[_0x809e('0x10')](respondWithResult(_0x1452ba,null))[_0x809e('0x36')](handleError(_0x1452ba,null));};exports[_0x809e('0x39')]=function(_0x518956,_0x4f1ea2){if(!_0x518956[_0x809e('0x3a')][_0x809e('0x15')])throw new Error(_0x809e('0x3b'));if(!_0x518956['body'][_0x809e('0x32')])throw new Error(_0x809e('0x3c'));var _0x522d9d=db[_0x809e('0x1b')][_0x809e('0x1c')][_0x809e('0x32')][_0x809e('0x3d')];if(!_0x522d9d[_0x809e('0x3e')](_0x518956[_0x809e('0x3a')][_0x809e('0x32')]))throw new Error(_0x809e('0x3f')+_0x522d9d['join'](',\x20'));if(_0x518956[_0x809e('0x3a')][_0x809e('0x32')]===_0x809e('0x33')&&_0x518956[_0x809e('0x3a')][_0x809e('0x35')]){_0x518956[_0x809e('0x3a')][_0x809e('0x35')]=encryptor[_0x809e('0x40')](_0x518956['body'][_0x809e('0x35')]);}return db[_0x809e('0x1b')][_0x809e('0x39')](_0x518956[_0x809e('0x3a')],{})['then'](respondWithResult(_0x4f1ea2,0xc9))[_0x809e('0x36')](handleError(_0x4f1ea2,null));};exports['update']=function(_0x3dff64,_0x529b71){if(_0x3dff64[_0x809e('0x3a')]['id']){delete _0x3dff64[_0x809e('0x3a')]['id'];}return db[_0x809e('0x1b')][_0x809e('0x41')]({'where':{'id':_0x3dff64[_0x809e('0x42')]['id']}})['then'](handleEntityNotFound(_0x529b71,null))['then'](function(_0x415bf5){if(_0x415bf5['service']===_0x809e('0x33')&&_0x3dff64[_0x809e('0x3a')][_0x809e('0x35')]){_0x3dff64['body'][_0x809e('0x35')]=encryptor[_0x809e('0x40')](_0x3dff64[_0x809e('0x3a')][_0x809e('0x35')]);}return _0x415bf5;})[_0x809e('0x10')](saveUpdates(_0x3dff64['body'],null))[_0x809e('0x10')](respondWithResult(_0x529b71,null))[_0x809e('0x36')](handleError(_0x529b71,null));};exports[_0x809e('0x11')]=function(_0x3b2fb7,_0x192da4){return db[_0x809e('0x1b')][_0x809e('0x41')]({'where':{'id':_0x3b2fb7[_0x809e('0x42')]['id']}})[_0x809e('0x10')](handleEntityNotFound(_0x192da4,null))['then'](removeEntity(_0x192da4,null))[_0x809e('0x36')](handleError(_0x192da4,null));};exports[_0x809e('0x43')]=function(_0xce3bd0,_0x947447){return db[_0x809e('0x1b')][_0x809e('0x44')]({'where':{'id':_0xce3bd0[_0x809e('0x42')]['id']},'raw':!![]})[_0x809e('0x10')](function(_0x27efa8){if(!_0x27efa8)return _0x947447[_0x809e('0x12')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x27efa8,_0xce3bd0[_0x809e('0x45')]['id'])};})[_0x809e('0x10')](respondWithResult(_0x947447,null))['catch'](handleError(_0x947447,null));};exports['oauth2MicrosoftCallback']=function(_0x66cac1,_0x15329f){var _0x2da938=_0x66cac1[_0x809e('0x3a')];var _0x229d69;var _0xf063a;if(_0x2da938['error'])throw _0x2da938;redis['get'](_0x2da938['state'])['then'](function(_0x230e53){if(!_0x230e53)throw new Error('Invalid\x20state\x20parameter');_0x229d69=JSON[_0x809e('0x46')](_0x230e53);var _0xa6478b=Buffer[_0x809e('0x47')](_0x2da938['state'],'base64')[_0x809e('0x48')](_0x809e('0x49'));_0xf063a=JSON[_0x809e('0x46')](_0xa6478b);if(!oauth['isValidIdToken'](_0x2da938[_0x809e('0x4a')],_0x229d69[_0x809e('0x4b')]))throw new Error(_0x809e('0x4c'));redis['del'](_0x2da938[_0x809e('0x4d')]);return oauth[_0x809e('0x4e')](_0x2da938['code'],_0x229d69);})['then'](function(_0x5d8667){_0x229d69['data5']=_0x5d8667[_0x809e('0x4f')];_0x229d69['data6']=_0x5d8667['refresh_token'];return db[_0x809e('0x1b')]['update']({'data5':_0x229d69[_0x809e('0x50')],'data6':_0x229d69[_0x809e('0x51')]},{'where':{'id':_0x229d69['id']}});})[_0x809e('0x10')](function(){oauth[_0x809e('0x52')](_0x229d69);socket[_0x809e('0x53')]('microsoftAuthorization:success',{'id':_0xf063a['id']});return;})['then'](respondWithStatusCode(_0x15329f,null))[_0x809e('0x36')](function(_0x51700b){if(_0xf063a){socket[_0x809e('0x53')](_0x809e('0x54'),{'id':_0xf063a['id']});}if(!_0x229d69){logger[_0x809e('0x13')](_0x809e('0x55'),_0x51700b);return _0x15329f[_0x809e('0x9')](0x1f4)[_0x809e('0x16')](_0x51700b[_0x809e('0x56')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x229d69['id'],JSON[_0x809e('0x57')](_0x51700b));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2d7d40d..52dbbf0 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 _0xbf08=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0xbf08,0xe6));var _0x8bf0=function(_0x267224,_0x2fcf36){_0x267224=_0x267224-0x0;var _0x4655c8=_0xbf08[_0x267224];return _0x4655c8;};'use strict';var _=require(_0x8bf0('0x0'));var util=require('util');var logger=require(_0x8bf0('0x1'))('api');var moment=require(_0x8bf0('0x2'));var BPromise=require('bluebird');var rp=require(_0x8bf0('0x3'));var fs=require('fs');var path=require(_0x8bf0('0x4'));var rimraf=require(_0x8bf0('0x5'));var config=require(_0x8bf0('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x8bf0('0x7')]=function(_0x2ad77d,_0x32c8e2){return _0x2ad77d[_0x8bf0('0x8')](_0x8bf0('0x9'),attributes,{'tableName':_0x8bf0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d1e=['define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x166dd8,_0x12e7d0){var _0x148103=function(_0x34bf7d){while(--_0x34bf7d){_0x166dd8['push'](_0x166dd8['shift']());}};_0x148103(++_0x12e7d0);}(_0x5d1e,0x198));var _0xe5d1=function(_0x51ba4e,_0x74fea1){_0x51ba4e=_0x51ba4e-0x0;var _0xcbc87c=_0x5d1e[_0x51ba4e];return _0xcbc87c;};'use strict';var _=require(_0xe5d1('0x0'));var util=require(_0xe5d1('0x1'));var logger=require(_0xe5d1('0x2'))(_0xe5d1('0x3'));var moment=require(_0xe5d1('0x4'));var BPromise=require(_0xe5d1('0x5'));var rp=require(_0xe5d1('0x6'));var fs=require('fs');var path=require(_0xe5d1('0x7'));var rimraf=require(_0xe5d1('0x8'));var config=require(_0xe5d1('0x9'));var attributes=require(_0xe5d1('0xa'));module[_0xe5d1('0xb')]=function(_0x1b2a07,_0x26ef3a){return _0x1b2a07[_0xe5d1('0xc')](_0xe5d1('0xd'),attributes,{'tableName':_0xe5d1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 2a5b968..ff0105d 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9295=['update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','bind','intervals','all','inspect','exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','profile','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','openid','/authorize','map','type','data7','/.default','join','Outlook365','Dynamics365','replace','data2','code','id_token','from','stringify','toString','hex','client_id','data1','response_type','redirect_uri','data4','form_post','scope','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','decode','payload','issuer','aud','isAfter','unix','exp','then','data3','refresh_token','data6','{TENANT_ID}','data5','access_token','CloudProvider'];(function(_0x1d446b,_0x18ca6a){var _0x3d4f55=function(_0x2ae2f5){while(--_0x2ae2f5){_0x1d446b['push'](_0x1d446b['shift']());}};_0x3d4f55(++_0x18ca6a);}(_0x9295,0xa1));var _0x5929=function(_0x896cea,_0x460e8c){_0x896cea=_0x896cea-0x0;var _0x20af48=_0x9295[_0x896cea];return _0x20af48;};'use strict';var _=require(_0x5929('0x0'));var crypto=require(_0x5929('0x1'));var jwt=require(_0x5929('0x2'));var moment=require(_0x5929('0x3'));var Redis=require('ioredis');var rp=require(_0x5929('0x4'));var util=require(_0x5929('0x5'));var encryptor=require(_0x5929('0x6'));var config=require(_0x5929('0x7'));var logger=require(_0x5929('0x8'))(_0x5929('0x9'));var schedule=require(_0x5929('0xa'));var db=require(_0x5929('0xb'))['db'];config[_0x5929('0xc')]=_['defaults'](config[_0x5929('0xc')],{'host':_0x5929('0xd'),'port':0x18eb});var redis=new Redis(config[_0x5929('0xc')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x5929('0xe'),'email','offline_access',_0x5929('0xf'),_0x5929('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x5929('0x11'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x5929('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x25b764){var _0x50bf64=_[_0x5929('0x13')](AZURE_AUTH_SCOPES[_0x25b764[_0x5929('0x14')]]);if(_0x25b764[_0x5929('0x14')]==='Dynamics365')_0x50bf64['push'](_0x25b764[_0x5929('0x15')]+_0x5929('0x16'));return _0x50bf64[_0x5929('0x17')]('\x20');}function getAccessTokenScope(_0x14f9a8){if(_0x14f9a8['type']===_0x5929('0x18'))return _0x5929('0xf');if(_0x14f9a8['type']===_0x5929('0x19'))return _0x14f9a8['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x26114d,_0x237255){var _0x421e88=MICROSOFT_AUTH_URL[_0x5929('0x1a')]('{TENANT_ID}',_0x26114d[_0x5929('0x1b')]);var _0x4a5487=[_0x5929('0x1c'),_0x5929('0x1d')];var _0x2bfa52=Buffer[_0x5929('0x1e')](JSON[_0x5929('0x1f')]({'id':_0x237255}))[_0x5929('0x20')]('base64');var _0x3e6854=crypto['randomBytes'](0x10)['toString'](_0x5929('0x21'));var _0x9f36cc=getAuthorizationScopes(_0x26114d);var _0x99ff15=[{'key':_0x5929('0x22'),'value':_0x26114d[_0x5929('0x23')]},{'key':_0x5929('0x24'),'value':encodeURIComponent(_0x4a5487[_0x5929('0x17')]('\x20'))},{'key':_0x5929('0x25'),'value':_0x26114d[_0x5929('0x26')]},{'key':'response_mode','value':_0x5929('0x27')},{'key':_0x5929('0x28'),'value':encodeURIComponent(_0x9f36cc)},{'key':_0x5929('0x29'),'value':_0x2bfa52},{'key':_0x5929('0x2a'),'value':_0x3e6854},{'key':_0x5929('0x2b'),'value':_0x5929('0x2c')}];var _0x43f88f=_0x421e88+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x99ff15,function(_0x4a46f5){return _0x4a46f5[_0x5929('0x2d')]+'='+_0x4a46f5[_0x5929('0x2e')];})['join']('&');_0x26114d[_0x5929('0x2f')]={'issuer':_0x421e88['replace'](_0x5929('0x30'),''),'audience':_0x26114d[_0x5929('0x23')],'state':_0x2bfa52,'nonce':_0x3e6854};redis['set'](_0x2bfa52,JSON[_0x5929('0x1f')](_0x26114d));return _0x43f88f;}function isValidIdToken(_0x105de6,_0x1c85d7){try{var _0x4c6bb2=jwt[_0x5929('0x31')](_0x105de6,{'complete':!![]});var _0x34ebe6=_0x4c6bb2[_0x5929('0x32')];if(_0x34ebe6['iss']!==_0x1c85d7[_0x5929('0x33')])return![];if(_0x34ebe6[_0x5929('0x34')]!==_0x1c85d7['audience'])return![];if(_0x34ebe6[_0x5929('0x2a')]!==_0x1c85d7[_0x5929('0x2a')])return![];if(moment()[_0x5929('0x35')](moment[_0x5929('0x36')](_0x34ebe6[_0x5929('0x37')])))return![];return!![];}catch(_0x13bffb){throw _0x13bffb;}}function refreshOauth2MicrosoftAccessToken(_0x7d524){return Promise['resolve']()[_0x5929('0x38')](function(){if(_0x7d524[_0x5929('0x39')])return _0x7d524;return db['CloudProvider']['findOne']({'where':{'id':_0x7d524['id']},'raw':!![]});})['then'](function(_0x13f473){var _0x51f03b={'grant_type':_0x5929('0x3a'),'refresh_token':_0x13f473[_0x5929('0x3b')],'scope':getAccessTokenScope(_0x13f473),'redirect_uri':_0x13f473[_0x5929('0x26')],'client_id':_0x13f473['data1'],'client_secret':encryptor['decryptString'](_0x13f473[_0x5929('0x39')])};var _0x5a47d9={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x5929('0x1a')](_0x5929('0x3c'),_0x13f473[_0x5929('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x51f03b,'json':!![]};return rp(_0x5a47d9);})[_0x5929('0x38')](function(_0x80997e){_0x7d524[_0x5929('0x3d')]=_0x80997e[_0x5929('0x3e')];_0x7d524[_0x5929('0x3b')]=_0x80997e['refresh_token'];return db[_0x5929('0x3f')][_0x5929('0x40')]({'data5':_0x7d524[_0x5929('0x3d')],'data6':_0x7d524[_0x5929('0x3b')]},{'where':{'id':_0x7d524['id']}});})[_0x5929('0x38')](function(){return _0x7d524;})[_0x5929('0x41')](function(_0x28f9b9){logger[_0x5929('0x42')](_0x5929('0x43'),_0x7d524['id'],_0x28f9b9);});}function getOauth2MicrosoftAccessToken(_0x3294a8,_0x38669e){var _0x39ad34={'grant_type':_0x5929('0x44'),'code':_0x3294a8,'scope':getAccessTokenScope(_0x38669e),'redirect_uri':_0x38669e['data4'],'client_id':_0x38669e[_0x5929('0x23')],'client_secret':encryptor['decryptString'](_0x38669e[_0x5929('0x39')])};var _0x400280={'method':_0x5929('0x45'),'uri':MICROSOFT_AUTH_URL['replace'](_0x5929('0x3c'),_0x38669e[_0x5929('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x39ad34,'json':!![]};return rp(_0x400280);}function startRefreshInterval(_0x537ed7){var _0x212b63=schedule['intervals'];if(_0x212b63[_0x537ed7['id']])clearInterval(_0x212b63[_0x537ed7['id']]);_0x212b63[_0x537ed7['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x5929('0x46')](this,{'id':_0x537ed7['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x5929('0x47')]=_0x212b63;}function startAllRefreshIntervals(){return db[_0x5929('0x3f')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x5929('0x38')](function(_0x42b6ca){var _0x10aace=_0x42b6ca[_0x5929('0x13')](function(_0x3d6fe2){return refreshOauth2MicrosoftAccessToken(_0x3d6fe2)[_0x5929('0x38')](function(_0x27bd70){startRefreshInterval(_0x27bd70);});});return Promise[_0x5929('0x48')](_0x10aace);})[_0x5929('0x41')](function(_0x535e5f){var _0x1eb88=_0x535e5f?util[_0x5929('0x49')](_0x535e5f,{'showHidden':![],'depth':null}):'';logger[_0x5929('0x42')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x1eb88);});}module[_0x5929('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x8507=['prompt','login','value','join','oauth2Claims','oauth2/','set','payload','iss','aud','audience','unix','then','CloudProvider','findOne','refresh_token','data3','POST','replace','data2','data5','access_token','update','data6','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','email','offline_access','https://outlook.office.com/SMTP.Send','openid','/token','map','type','Dynamics365','push','Outlook365','data7','/.default','{TENANT_ID}','from','stringify','toString','base64','hex','client_id','data1','data4','response_mode','form_post','scope','nonce'];(function(_0x51e452,_0x434838){var _0xdc8be=function(_0x522097){while(--_0x522097){_0x51e452['push'](_0x51e452['shift']());}};_0xdc8be(++_0x434838);}(_0x8507,0x1df));var _0x7850=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8507[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7850('0x0'));var crypto=require('crypto');var jwt=require(_0x7850('0x1'));var moment=require(_0x7850('0x2'));var Redis=require('ioredis');var rp=require(_0x7850('0x3'));var util=require(_0x7850('0x4'));var encryptor=require(_0x7850('0x5'));var config=require(_0x7850('0x6'));var logger=require(_0x7850('0x7'))(_0x7850('0x8'));var schedule=require(_0x7850('0x9'));var db=require(_0x7850('0xa'))['db'];config['redis']=_['defaults'](config[_0x7850('0xb')],{'host':_0x7850('0xc'),'port':0x18eb});var redis=new Redis(config[_0x7850('0xb')]);var MICROSOFT_AUTH_URL=_0x7850('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile',_0x7850('0xe'),_0x7850('0xf'),'https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0x7850('0x10')],'Dynamics365':[_0x7850('0x11'),_0x7850('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x7850('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xa16545){var _0x2f9d2f=_[_0x7850('0x13')](AZURE_AUTH_SCOPES[_0xa16545[_0x7850('0x14')]]);if(_0xa16545['type']===_0x7850('0x15'))_0x2f9d2f[_0x7850('0x16')](_0xa16545['data7']+'/.default');return _0x2f9d2f['join']('\x20');}function getAccessTokenScope(_0x12ebc9){if(_0x12ebc9[_0x7850('0x14')]===_0x7850('0x17'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x12ebc9[_0x7850('0x14')]===_0x7850('0x15'))return _0x12ebc9[_0x7850('0x18')]+_0x7850('0x19');}function generateMicrosoftAuthorizationUrl(_0x20fea6,_0xe880c4){var _0x993cba=MICROSOFT_AUTH_URL['replace'](_0x7850('0x1a'),_0x20fea6['data2']);var _0x3be883=['code','id_token'];var _0x11d5c0=Buffer[_0x7850('0x1b')](JSON[_0x7850('0x1c')]({'id':_0xe880c4}))[_0x7850('0x1d')](_0x7850('0x1e'));var _0x163e41=crypto['randomBytes'](0x10)[_0x7850('0x1d')](_0x7850('0x1f'));var _0x1c821f=getAuthorizationScopes(_0x20fea6);var _0x2ac204=[{'key':_0x7850('0x20'),'value':_0x20fea6[_0x7850('0x21')]},{'key':'response_type','value':encodeURIComponent(_0x3be883['join']('\x20'))},{'key':'redirect_uri','value':_0x20fea6[_0x7850('0x22')]},{'key':_0x7850('0x23'),'value':_0x7850('0x24')},{'key':_0x7850('0x25'),'value':encodeURIComponent(_0x1c821f)},{'key':'state','value':_0x11d5c0},{'key':_0x7850('0x26'),'value':_0x163e41},{'key':_0x7850('0x27'),'value':_0x7850('0x28')}];var _0x32e0a9=_0x993cba+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x7850('0x13')](_0x2ac204,function(_0x3a0f07){return _0x3a0f07['key']+'='+_0x3a0f07[_0x7850('0x29')];})[_0x7850('0x2a')]('&');_0x20fea6[_0x7850('0x2b')]={'issuer':_0x993cba['replace'](_0x7850('0x2c'),''),'audience':_0x20fea6['data1'],'state':_0x11d5c0,'nonce':_0x163e41};redis[_0x7850('0x2d')](_0x11d5c0,JSON[_0x7850('0x1c')](_0x20fea6));return _0x32e0a9;}function isValidIdToken(_0x3036ce,_0x88eba3){try{var _0x34de8f=jwt['decode'](_0x3036ce,{'complete':!![]});var _0x15c263=_0x34de8f[_0x7850('0x2e')];if(_0x15c263[_0x7850('0x2f')]!==_0x88eba3['issuer'])return![];if(_0x15c263[_0x7850('0x30')]!==_0x88eba3[_0x7850('0x31')])return![];if(_0x15c263[_0x7850('0x26')]!==_0x88eba3[_0x7850('0x26')])return![];if(moment()['isAfter'](moment[_0x7850('0x32')](_0x15c263['exp'])))return![];return!![];}catch(_0xb8f992){throw _0xb8f992;}}function refreshOauth2MicrosoftAccessToken(_0x1a481e){return Promise['resolve']()[_0x7850('0x33')](function(){if(_0x1a481e['data3'])return _0x1a481e;return db[_0x7850('0x34')][_0x7850('0x35')]({'where':{'id':_0x1a481e['id']},'raw':!![]});})[_0x7850('0x33')](function(_0x310e27){var _0x1eb646={'grant_type':_0x7850('0x36'),'refresh_token':_0x310e27['data6'],'scope':getAccessTokenScope(_0x310e27),'redirect_uri':_0x310e27[_0x7850('0x22')],'client_id':_0x310e27[_0x7850('0x21')],'client_secret':encryptor['decryptString'](_0x310e27[_0x7850('0x37')])};var _0x3a35db={'method':_0x7850('0x38'),'uri':MICROSOFT_AUTH_URL[_0x7850('0x39')]('{TENANT_ID}',_0x310e27[_0x7850('0x3a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1eb646,'json':!![]};return rp(_0x3a35db);})['then'](function(_0x5a1b0e){_0x1a481e[_0x7850('0x3b')]=_0x5a1b0e[_0x7850('0x3c')];_0x1a481e['data6']=_0x5a1b0e[_0x7850('0x36')];return db[_0x7850('0x34')][_0x7850('0x3d')]({'data5':_0x1a481e[_0x7850('0x3b')],'data6':_0x1a481e[_0x7850('0x3e')]},{'where':{'id':_0x1a481e['id']}});})[_0x7850('0x33')](function(){return _0x1a481e;})[_0x7850('0x3f')](function(_0xe86b7f){logger[_0x7850('0x40')](_0x7850('0x41'),_0x1a481e['id'],_0xe86b7f);});}function getOauth2MicrosoftAccessToken(_0x1f8557,_0x5d4081){var _0x45f048={'grant_type':_0x7850('0x42'),'code':_0x1f8557,'scope':getAccessTokenScope(_0x5d4081),'redirect_uri':_0x5d4081[_0x7850('0x22')],'client_id':_0x5d4081['data1'],'client_secret':encryptor[_0x7850('0x43')](_0x5d4081[_0x7850('0x37')])};var _0x3b74fc={'method':_0x7850('0x38'),'uri':MICROSOFT_AUTH_URL[_0x7850('0x39')](_0x7850('0x1a'),_0x5d4081[_0x7850('0x3a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x45f048,'json':!![]};return rp(_0x3b74fc);}function startRefreshInterval(_0x2fc0c3){var _0x3e1d62=schedule[_0x7850('0x44')];if(_0x3e1d62[_0x2fc0c3['id']])clearInterval(_0x3e1d62[_0x2fc0c3['id']]);_0x3e1d62[_0x2fc0c3['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x2fc0c3['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7850('0x44')]=_0x3e1d62;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x7850('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x4b2f71){var _0x5e106e=_0x4b2f71[_0x7850('0x13')](function(_0x36dd90){return refreshOauth2MicrosoftAccessToken(_0x36dd90)[_0x7850('0x33')](function(_0x5c8718){startRefreshInterval(_0x5c8718);});});return Promise[_0x7850('0x46')](_0x5e106e);})[_0x7850('0x3f')](function(_0x2029f7){var _0x556cb1=_0x2029f7?util[_0x7850('0x47')](_0x2029f7,{'showHidden':![],'depth':null}):'';logger[_0x7850('0x40')](_0x7850('0x48'),_0x556cb1);});}module[_0x7850('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index d1297be..c949cf6 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 _0x7d37=['jayson/promise','http','request','then','info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0x7d37,0x1db));var _0x77d3=function(_0x1723ab,_0x78e59b){_0x1723ab=_0x1723ab-0x0;var _0xde596b=_0x7d37[_0x1723ab];return _0xde596b;};'use strict';var _=require(_0x77d3('0x0'));var util=require(_0x77d3('0x1'));var moment=require(_0x77d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x77d3('0x3'));var fs=require('fs');var Redis=require(_0x77d3('0x4'));var db=require(_0x77d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77d3('0x6'))(_0x77d3('0x7'));var config=require('../../config/environment');var jayson=require(_0x77d3('0x8'));var client=jayson['client'][_0x77d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x519c6e,_0x40235d,_0x373da8){return new BPromise(function(_0x5c0108,_0x555390){return client[_0x77d3('0xa')](_0x519c6e,_0x373da8)[_0x77d3('0xb')](function(_0x506caa){logger[_0x77d3('0xc')]('CloudProvider,\x20%s,\x20%s',_0x40235d,_0x77d3('0xd'));logger['debug'](_0x77d3('0xe'),_0x40235d,'request\x20sent',JSON[_0x77d3('0xf')](_0x506caa));if(_0x506caa[_0x77d3('0x10')]){if(_0x506caa[_0x77d3('0x10')][_0x77d3('0x11')]===0x1f4){logger[_0x77d3('0x10')](_0x77d3('0x12'),_0x40235d,_0x506caa[_0x77d3('0x10')][_0x77d3('0x13')]);return _0x555390(_0x506caa[_0x77d3('0x10')]['message']);}logger[_0x77d3('0x10')]('CloudProvider,\x20%s,\x20%s',_0x40235d,_0x506caa['error']['message']);return _0x5c0108(_0x506caa[_0x77d3('0x10')][_0x77d3('0x13')]);}else{logger[_0x77d3('0xc')](_0x77d3('0x12'),_0x40235d,_0x77d3('0xd'));_0x5c0108(_0x506caa['result'][_0x77d3('0x13')]);}})[_0x77d3('0x14')](function(_0x5e92d8){logger['error'](_0x77d3('0x12'),_0x40235d,_0x5e92d8);_0x555390(_0x5e92d8);});});} \ No newline at end of file +var _0x5458=['rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x5458,0x1c7));var _0x8545=function(_0x32cbf0,_0x47b073){_0x32cbf0=_0x32cbf0-0x0;var _0x332b2e=_0x5458[_0x32cbf0];return _0x332b2e;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var moment=require(_0x8545('0x2'));var BPromise=require('bluebird');var rs=require(_0x8545('0x3'));var fs=require('fs');var Redis=require(_0x8545('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8545('0x5'));var logger=require(_0x8545('0x6'))(_0x8545('0x7'));var config=require('../../config/environment');var jayson=require(_0x8545('0x8'));var client=jayson[_0x8545('0x9')][_0x8545('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359d01,_0x5062c7,_0x291bc9){return new BPromise(function(_0x507ed8,_0x2cc4f4){return client[_0x8545('0xb')](_0x359d01,_0x291bc9)[_0x8545('0xc')](function(_0x10931d){logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));logger[_0x8545('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5062c7,_0x8545('0xf'),JSON[_0x8545('0x11')](_0x10931d));if(_0x10931d[_0x8545('0x12')]){if(_0x10931d['error'][_0x8545('0x13')]===0x1f4){logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);return _0x2cc4f4(_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);}logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d['error'][_0x8545('0x14')]);return _0x507ed8(_0x10931d[_0x8545('0x12')]['message']);}else{logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));_0x507ed8(_0x10931d['result'][_0x8545('0x14')]);}})[_0x8545('0x15')](function(_0x3374f7){logger['error']('CloudProvider,\x20%s,\x20%s',_0x5062c7,_0x3374f7);_0x2cc4f4(_0x3374f7);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 943d1e6..cd75a64 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 _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x1d102c,_0x1bbef1){var _0x45b606=function(_0x571877){while(--_0x571877){_0x1d102c['push'](_0x1d102c['shift']());}};_0x45b606(++_0x1bbef1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x43d750,_0x2b3053){var _0x425111=function(_0x37fe0c){while(--_0x37fe0c){_0x43d750['push'](_0x43d750['shift']());}};_0x425111(++_0x2b3053);}(_0xadb5,0xad));var _0x5adb=function(_0x4c3d09,_0x1b139a){_0x4c3d09=_0x4c3d09-0x0;var _0x8396a7=_0xadb5[_0x4c3d09];return _0x8396a7;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 7513bfb..6eef111 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 _0x795a=['exports','STRING'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x795a,0xa2));var _0xa795=function(_0x5614c2,_0x52e16a){_0x5614c2=_0x5614c2-0x0;var _0xb1e171=_0x795a[_0x5614c2];return _0xb1e171;};'use strict';var Sequelize=require('sequelize');module[_0xa795('0x0')]={'name':{'type':Sequelize[_0xa795('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa795('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xa795('0x1')]},'phone':{'type':Sequelize[_0xa795('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa795('0x1')]},'postalCode':{'type':Sequelize[_0xa795('0x1')]},'city':{'type':Sequelize[_0xa795('0x1')]},'country':{'type':Sequelize[_0xa795('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa795('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xa795('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa795('0x1')]}}; \ No newline at end of file +var _0xfd28=['exports','STRING'];(function(_0x576795,_0x184e80){var _0x2176d9=function(_0x501290){while(--_0x501290){_0x576795['push'](_0x576795['shift']());}};_0x2176d9(++_0x184e80);}(_0xfd28,0x148));var _0x8fd2=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0xfd28[_0x35d775];return _0x59384d;};'use strict';var Sequelize=require('sequelize');module[_0x8fd2('0x0')]={'name':{'type':Sequelize[_0x8fd2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8fd2('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x8fd2('0x1')]},'phone':{'type':Sequelize[_0x8fd2('0x1')]},'fax':{'type':Sequelize[_0x8fd2('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x8fd2('0x1')]},'postalCode':{'type':Sequelize[_0x8fd2('0x1')]},'city':{'type':Sequelize[_0x8fd2('0x1')]},'country':{'type':Sequelize[_0x8fd2('0x1')]},'email':{'type':Sequelize[_0x8fd2('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x8fd2('0x1')]},'sCity':{'type':Sequelize[_0x8fd2('0x1')]},'sCountry':{'type':Sequelize[_0x8fd2('0x1')]},'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 95200f2..330fa07 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 _0xc76c=['fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','reject','update','destroy','then','Companies','UserProfileResource','stack','name','send','CmCompany','describe','model','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','map','includeAll','include','findAll','rows','catch','keys','rawAttributes','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','body','params','addContacts','CmContact','omit','ids','findOne','getContacts','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x2d2f47,_0x4923d8){var _0x4011c9=function(_0x3b4106){while(--_0x3b4106){_0x2d2f47['push'](_0x2d2f47['shift']());}};_0x4011c9(++_0x4923d8);}(_0xc76c,0xa5));var _0xcc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xcc76('0x0'));var rimraf=require(_0xcc76('0x1'));var zipdir=require(_0xcc76('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc76('0x3'));var moment=require(_0xcc76('0x4'));var BPromise=require(_0xcc76('0x5'));var Mustache=require(_0xcc76('0x6'));var util=require(_0xcc76('0x7'));var path=require(_0xcc76('0x8'));var sox=require(_0xcc76('0x9'));var csv=require('to-csv');var ejs=require(_0xcc76('0xa'));var fs=require('fs');var fs_extra=require(_0xcc76('0xb'));var _=require(_0xcc76('0xc'));var squel=require(_0xcc76('0xd'));var crypto=require('crypto');var jsforce=require(_0xcc76('0xe'));var deskjs=require(_0xcc76('0xf'));var toCsv=require(_0xcc76('0x10'));var querystring=require(_0xcc76('0x11'));var Papa=require(_0xcc76('0x12'));var Redis=require(_0xcc76('0x13'));var authService=require(_0xcc76('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc76('0x15'));var hardwareService=require(_0xcc76('0x16'));var logger=require(_0xcc76('0x17'))(_0xcc76('0x18'));var utils=require(_0xcc76('0x19'));var config=require(_0xcc76('0x1a'));var licenseUtil=require(_0xcc76('0x1b'));var db=require(_0xcc76('0x1c'))['db'];function respondWithStatusCode(_0x1f2821,_0x33a35c){_0x33a35c=_0x33a35c||0xcc;return function(_0x49dde9){if(_0x49dde9){return _0x1f2821[_0xcc76('0x1d')](_0x33a35c);}return _0x1f2821['status'](_0x33a35c)[_0xcc76('0x1e')]();};}function respondWithResult(_0x123e01,_0x5c2ad0){_0x5c2ad0=_0x5c2ad0||0xc8;return function(_0xd1dc84){if(_0xd1dc84){return _0x123e01[_0xcc76('0x1f')](_0x5c2ad0)[_0xcc76('0x20')](_0xd1dc84);}};}function respondWithFilteredResult(_0x1cd82c,_0x47edfc){return function(_0x4b32c2){if(_0x4b32c2){var _0x258ca3=typeof _0x47edfc[_0xcc76('0x21')]===_0xcc76('0x22')&&typeof _0x47edfc['limit']===_0xcc76('0x22');var _0x45e7cc=_0x4b32c2[_0xcc76('0x23')];var _0x20f657=_0x258ca3?0x0:_0x47edfc[_0xcc76('0x21')];var _0xc7f81a=_0x258ca3?_0x4b32c2['count']:_0x47edfc[_0xcc76('0x21')]+_0x47edfc[_0xcc76('0x24')];var _0x3623de;if(_0xc7f81a>=_0x45e7cc){_0xc7f81a=_0x45e7cc;_0x3623de=0xc8;}else{_0x3623de=0xce;}_0x1cd82c[_0xcc76('0x1f')](_0x3623de);return _0x1cd82c['set']('Content-Range',_0x20f657+'-'+_0xc7f81a+'/'+_0x45e7cc)['json'](_0x4b32c2);}return null;};}function patchUpdates(_0xb42ef5){return function(_0x442809){try{jsonpatch['apply'](_0x442809,_0xb42ef5,!![]);}catch(_0x2a0bdb){return BPromise[_0xcc76('0x25')](_0x2a0bdb);}return _0x442809['save']();};}function saveUpdates(_0x15c244,_0x1ed2ee){return function(_0x47baa6){if(_0x47baa6){return _0x47baa6[_0xcc76('0x26')](_0x15c244)['then'](function(_0x355230){return _0x355230;});}return null;};}function removeEntity(_0x1d1cac,_0x16e5d1){return function(_0x576717){if(_0x576717){return _0x576717[_0xcc76('0x27')]()[_0xcc76('0x28')](function(){var _0x99da74=_0x576717['get']({'plain':!![]});var _0x90cb56=_0xcc76('0x29');return db[_0xcc76('0x2a')][_0xcc76('0x27')]({'where':{'type':_0x90cb56,'resourceId':_0x99da74['id']}})[_0xcc76('0x28')](function(){return _0x576717;});})[_0xcc76('0x28')](function(){_0x1d1cac[_0xcc76('0x1f')](0xcc)[_0xcc76('0x1e')]();});}};}function handleEntityNotFound(_0xf4ebe5,_0x5c1569){return function(_0x45538c){if(!_0x45538c){_0xf4ebe5['sendStatus'](0x194);}return _0x45538c;};}function handleError(_0x3b1fe2,_0x338300){_0x338300=_0x338300||0x1f4;return function(_0x454256){logger['error'](_0x454256[_0xcc76('0x2b')]);if(_0x454256[_0xcc76('0x2c')]){delete _0x454256['name'];}_0x3b1fe2['status'](_0x338300)[_0xcc76('0x2d')](_0x454256);};}exports['index']=function(_0x355095,_0x19a6a0){var _0x5a731d={},_0x14df29={},_0x55ef5e={'count':0x0,'rows':[]};return db[_0xcc76('0x2e')][_0xcc76('0x2f')]()[_0xcc76('0x28')](function(_0x478b9b){_0x14df29[_0xcc76('0x30')]=_['keys'](_0x478b9b);_0x14df29[_0xcc76('0x31')]=_['keys'](_0x355095['query']);_0x14df29['filters']=_[_0xcc76('0x32')](_0x14df29[_0xcc76('0x30')],_0x14df29['query']);_0x5a731d['attributes']=_['intersection'](_0x14df29[_0xcc76('0x30')],qs[_0xcc76('0x33')](_0x355095[_0xcc76('0x31')]['fields']));_0x5a731d[_0xcc76('0x34')]=_0x5a731d['attributes'][_0xcc76('0x35')]?_0x5a731d[_0xcc76('0x34')]:_0x14df29[_0xcc76('0x30')];if(!_0x355095[_0xcc76('0x31')][_0xcc76('0x36')]('nolimit')){_0x5a731d[_0xcc76('0x24')]=qs[_0xcc76('0x24')](_0x355095[_0xcc76('0x31')]['limit']);_0x5a731d[_0xcc76('0x21')]=qs[_0xcc76('0x21')](_0x355095['query'][_0xcc76('0x21')]);}_0x5a731d['order']=qs[_0xcc76('0x37')](_0x355095[_0xcc76('0x31')][_0xcc76('0x37')]);_0x5a731d[_0xcc76('0x38')]=qs[_0xcc76('0x39')](_[_0xcc76('0x3a')](_0x355095[_0xcc76('0x31')],_0x14df29['filters']),_0x478b9b);if(_0x355095['query'][_0xcc76('0x3b')]){_0x5a731d['where']=_[_0xcc76('0x3c')](_0x5a731d['where'],{'$or':_[_0xcc76('0x3d')](_0x5a731d['attributes'],function(_0x28aad1){var _0x38fcbf={};_0x38fcbf[_0x28aad1]={'$like':'%'+_0x355095[_0xcc76('0x31')][_0xcc76('0x3b')]+'%'};return _0x38fcbf;})});}_0x5a731d=_[_0xcc76('0x3c')]({},_0x5a731d,_0x355095['options']);var _0x30b681={'where':_0x5a731d['where']};return db[_0xcc76('0x2e')][_0xcc76('0x23')](_0x30b681)[_0xcc76('0x28')](function(_0x179ea3){_0x55ef5e[_0xcc76('0x23')]=_0x179ea3;if(_0x355095[_0xcc76('0x31')][_0xcc76('0x3e')]){_0x5a731d[_0xcc76('0x3f')]=[{'all':!![]}];}return db[_0xcc76('0x2e')][_0xcc76('0x40')](_0x5a731d);})[_0xcc76('0x28')](function(_0x1e527f){_0x55ef5e[_0xcc76('0x41')]=_0x1e527f;return _0x55ef5e;})[_0xcc76('0x28')](respondWithFilteredResult(_0x19a6a0,_0x5a731d))['catch'](handleError(_0x19a6a0,null));})[_0xcc76('0x42')](handleError(_0x19a6a0,null));};exports['show']=function(_0x1bf312,_0x2ffd61){var _0x15d317={'raw':![],'where':{'id':_0x1bf312['params']['id']}},_0x128e2d={};_0x128e2d[_0xcc76('0x30')]=_[_0xcc76('0x43')](db['CmCompany'][_0xcc76('0x44')]);_0x128e2d['query']=_[_0xcc76('0x43')](_0x1bf312[_0xcc76('0x31')]);_0x128e2d[_0xcc76('0x39')]=_[_0xcc76('0x32')](_0x128e2d[_0xcc76('0x30')],_0x128e2d[_0xcc76('0x31')]);_0x15d317['attributes']=_[_0xcc76('0x32')](_0x128e2d[_0xcc76('0x30')],qs[_0xcc76('0x33')](_0x1bf312[_0xcc76('0x31')][_0xcc76('0x33')]));_0x15d317['attributes']=_0x15d317[_0xcc76('0x34')]['length']?_0x15d317[_0xcc76('0x34')]:_0x128e2d[_0xcc76('0x30')];if(_0x1bf312[_0xcc76('0x31')]['includeAll']){_0x15d317[_0xcc76('0x3f')]=[{'all':!![]}];}_0x15d317=_['merge']({},_0x15d317,_0x1bf312[_0xcc76('0x45')]);return db[_0xcc76('0x2e')][_0xcc76('0x46')](_0x15d317)['then'](handleEntityNotFound(_0x2ffd61,null))[_0xcc76('0x28')](respondWithResult(_0x2ffd61,null))[_0xcc76('0x42')](handleError(_0x2ffd61,null));};exports[_0xcc76('0x47')]=function(_0x21d7a5,_0x2a2cdc){return db[_0xcc76('0x2e')][_0xcc76('0x47')](_0x21d7a5['body'],{})[_0xcc76('0x28')](function(_0x1f8bef){var _0xecab31=_0x21d7a5[_0xcc76('0x48')][_0xcc76('0x49')]({'plain':!![]});if(!_0xecab31)throw new Error(_0xcc76('0x4a'));if(_0xecab31[_0xcc76('0x4b')]===_0xcc76('0x48')){var _0x251590=_0x1f8bef[_0xcc76('0x49')]({'plain':!![]});var _0x4a079b=_0xcc76('0x29');return db[_0xcc76('0x4c')][_0xcc76('0x46')]({'where':{'name':_0x4a079b,'userProfileId':_0xecab31[_0xcc76('0x4d')]},'raw':!![]})[_0xcc76('0x28')](function(_0xe01c1){if(_0xe01c1&&_0xe01c1['autoAssociation']===0x0){return db[_0xcc76('0x2a')][_0xcc76('0x47')]({'name':_0x251590[_0xcc76('0x2c')],'resourceId':_0x251590['id'],'type':_0xe01c1[_0xcc76('0x2c')],'sectionId':_0xe01c1['id']},{})['then'](function(){return _0x1f8bef;});}else{return _0x1f8bef;}})[_0xcc76('0x42')](function(_0x30c141){logger[_0xcc76('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30c141);throw _0x30c141;});}return _0x1f8bef;})[_0xcc76('0x28')](respondWithResult(_0x2a2cdc,0xc9))[_0xcc76('0x42')](handleError(_0x2a2cdc,null));};exports[_0xcc76('0x26')]=function(_0x5d8bfb,_0x20fa0f){if(_0x5d8bfb[_0xcc76('0x4f')]['id']){delete _0x5d8bfb[_0xcc76('0x4f')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x5d8bfb[_0xcc76('0x50')]['id']}})[_0xcc76('0x28')](handleEntityNotFound(_0x20fa0f,null))[_0xcc76('0x28')](saveUpdates(_0x5d8bfb[_0xcc76('0x4f')],null))[_0xcc76('0x28')](respondWithResult(_0x20fa0f,null))['catch'](handleError(_0x20fa0f,null));};exports[_0xcc76('0x27')]=function(_0x2a6ddc,_0x2b733e){return db[_0xcc76('0x2e')][_0xcc76('0x46')]({'where':{'id':_0x2a6ddc[_0xcc76('0x50')]['id']}})['then'](handleEntityNotFound(_0x2b733e,null))[_0xcc76('0x28')](removeEntity(_0x2b733e,null))[_0xcc76('0x42')](handleError(_0x2b733e,null));};exports['describe']=function(_0x1438ee,_0x14e284){return db[_0xcc76('0x2e')][_0xcc76('0x2f')]()[_0xcc76('0x28')](respondWithResult(_0x14e284,null))['catch'](handleError(_0x14e284,null));};exports[_0xcc76('0x51')]=function(_0x16cf7b,_0x58f976,_0x128683){return db[_0xcc76('0x52')]['find']({'where':{'id':_0x16cf7b['params']['id']}})[_0xcc76('0x28')](handleEntityNotFound(_0x58f976,null))[_0xcc76('0x28')](function(_0x3e319d){if(_0x3e319d){return _0x3e319d[_0xcc76('0x51')](_0x16cf7b[_0xcc76('0x4f')]['ids'],_[_0xcc76('0x53')](_0x16cf7b[_0xcc76('0x4f')],[_0xcc76('0x54'),'id'])||{});}})[_0xcc76('0x28')](respondWithResult(_0x58f976,null))[_0xcc76('0x42')](handleError(_0x58f976,null));};exports['getContacts']=function(_0x1f3a4d,_0xd657d0,_0xfea923){var _0x9c6c7f={};var _0x4f6a02={};var _0xe8a75d;var _0x3df035;return db[_0xcc76('0x2e')][_0xcc76('0x55')]({'where':{'id':_0x1f3a4d[_0xcc76('0x50')]['id']}})[_0xcc76('0x28')](handleEntityNotFound(_0xd657d0,null))[_0xcc76('0x28')](function(_0x4054d2){if(_0x4054d2){_0xe8a75d=_0x4054d2;_0x4f6a02[_0xcc76('0x30')]=_[_0xcc76('0x43')](db[_0xcc76('0x52')][_0xcc76('0x44')]);_0x4f6a02['query']=_['keys'](_0x1f3a4d['query']);_0x4f6a02[_0xcc76('0x39')]=_['intersection'](_0x4f6a02['model'],_0x4f6a02[_0xcc76('0x31')]);_0x9c6c7f[_0xcc76('0x34')]=_[_0xcc76('0x32')](_0x4f6a02['model'],qs[_0xcc76('0x33')](_0x1f3a4d['query'][_0xcc76('0x33')]));_0x9c6c7f[_0xcc76('0x34')]=_0x9c6c7f[_0xcc76('0x34')][_0xcc76('0x35')]?_0x9c6c7f[_0xcc76('0x34')]:_0x4f6a02[_0xcc76('0x30')];_0x9c6c7f['order']=qs[_0xcc76('0x37')](_0x1f3a4d['query'][_0xcc76('0x37')]);_0x9c6c7f[_0xcc76('0x38')]=qs[_0xcc76('0x39')](_[_0xcc76('0x3a')](_0x1f3a4d[_0xcc76('0x31')],_0x4f6a02[_0xcc76('0x39')]));if(_0x1f3a4d['query'][_0xcc76('0x3b')]){_0x9c6c7f['where']=_[_0xcc76('0x3c')](_0x9c6c7f['where'],{'$or':_[_0xcc76('0x3d')](_0x9c6c7f[_0xcc76('0x34')],function(_0xa6634){var _0x5a2b75={};_0x5a2b75[_0xa6634]={'$like':'%'+_0x1f3a4d[_0xcc76('0x31')][_0xcc76('0x3b')]+'%'};return _0x5a2b75;})});}_0x9c6c7f=_[_0xcc76('0x3c')]({},_0x9c6c7f,_0x1f3a4d[_0xcc76('0x45')]);return _0xe8a75d[_0xcc76('0x56')](_0x9c6c7f);}})['then'](function(_0x26c0d3){if(_0x26c0d3){_0x3df035=_0x26c0d3[_0xcc76('0x35')];if(!_0x1f3a4d['query'][_0xcc76('0x36')](_0xcc76('0x57'))){_0x9c6c7f[_0xcc76('0x24')]=qs['limit'](_0x1f3a4d[_0xcc76('0x31')]['limit']);_0x9c6c7f['offset']=qs[_0xcc76('0x21')](_0x1f3a4d[_0xcc76('0x31')]['offset']);}return _0xe8a75d[_0xcc76('0x56')](_0x9c6c7f);}})[_0xcc76('0x28')](function(_0x170c50){if(_0x170c50){return _0x170c50?{'count':_0x3df035,'rows':_0x170c50}:null;}})[_0xcc76('0x28')](respondWithResult(_0xd657d0,null))['catch'](handleError(_0xd657d0,null));}; \ No newline at end of file +var _0xa1d5=['length','hasOwnProperty','order','sort','where','merge','map','filter','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','omit','findOne','rawAttributes','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','then','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa1d5,0x75));var _0x5a1d=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0xa1d5[_0x5c8827];return _0x50ffd5;};'use strict';var emlformat=require(_0x5a1d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a1d('0x1'));var jsonpatch=require(_0x5a1d('0x2'));var rp=require(_0x5a1d('0x3'));var moment=require(_0x5a1d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5a1d('0x5'));var util=require(_0x5a1d('0x6'));var path=require(_0x5a1d('0x7'));var sox=require('sox');var csv=require(_0x5a1d('0x8'));var ejs=require(_0x5a1d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5a1d('0xa'));var crypto=require(_0x5a1d('0xb'));var jsforce=require(_0x5a1d('0xc'));var deskjs=require(_0x5a1d('0xd'));var toCsv=require(_0x5a1d('0x8'));var querystring=require(_0x5a1d('0xe'));var Papa=require(_0x5a1d('0xf'));var Redis=require('ioredis');var authService=require(_0x5a1d('0x10'));var qs=require(_0x5a1d('0x11'));var as=require(_0x5a1d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5a1d('0x13'));var utils=require(_0x5a1d('0x14'));var config=require(_0x5a1d('0x15'));var licenseUtil=require(_0x5a1d('0x16'));var db=require(_0x5a1d('0x17'))['db'];function respondWithStatusCode(_0x1a6a76,_0x3cda85){_0x3cda85=_0x3cda85||0xcc;return function(_0x5d61f4){if(_0x5d61f4){return _0x1a6a76[_0x5a1d('0x18')](_0x3cda85);}return _0x1a6a76[_0x5a1d('0x19')](_0x3cda85)[_0x5a1d('0x1a')]();};}function respondWithResult(_0x2e5891,_0x573f6d){_0x573f6d=_0x573f6d||0xc8;return function(_0x2ce99d){if(_0x2ce99d){return _0x2e5891[_0x5a1d('0x19')](_0x573f6d)[_0x5a1d('0x1b')](_0x2ce99d);}};}function respondWithFilteredResult(_0x3aabae,_0x54cf5a){return function(_0x118bb2){if(_0x118bb2){var _0x1f4b7b=typeof _0x54cf5a[_0x5a1d('0x1c')]==='undefined'&&typeof _0x54cf5a[_0x5a1d('0x1d')]===_0x5a1d('0x1e');var _0x48a056=_0x118bb2['count'];var _0x5d8295=_0x1f4b7b?0x0:_0x54cf5a['offset'];var _0x54700c=_0x1f4b7b?_0x118bb2[_0x5a1d('0x1f')]:_0x54cf5a[_0x5a1d('0x1c')]+_0x54cf5a[_0x5a1d('0x1d')];var _0x27ca0f;if(_0x54700c>=_0x48a056){_0x54700c=_0x48a056;_0x27ca0f=0xc8;}else{_0x27ca0f=0xce;}_0x3aabae[_0x5a1d('0x19')](_0x27ca0f);return _0x3aabae[_0x5a1d('0x20')](_0x5a1d('0x21'),_0x5d8295+'-'+_0x54700c+'/'+_0x48a056)[_0x5a1d('0x1b')](_0x118bb2);}return null;};}function patchUpdates(_0x17a5a0){return function(_0x2eb937){try{jsonpatch[_0x5a1d('0x22')](_0x2eb937,_0x17a5a0,!![]);}catch(_0x215735){return BPromise['reject'](_0x215735);}return _0x2eb937['save']();};}function saveUpdates(_0x4300b1,_0x4d7207){return function(_0x136210){if(_0x136210){return _0x136210[_0x5a1d('0x23')](_0x4300b1)['then'](function(_0xc7cdd5){return _0xc7cdd5;});}return null;};}function removeEntity(_0x182775,_0x34348e){return function(_0x4f53a4){if(_0x4f53a4){return _0x4f53a4[_0x5a1d('0x24')]()[_0x5a1d('0x25')](function(){var _0x66bcb4=_0x4f53a4[_0x5a1d('0x26')]({'plain':!![]});var _0x36049c=_0x5a1d('0x27');return db[_0x5a1d('0x28')]['destroy']({'where':{'type':_0x36049c,'resourceId':_0x66bcb4['id']}})['then'](function(){return _0x4f53a4;});})[_0x5a1d('0x25')](function(){_0x182775[_0x5a1d('0x19')](0xcc)[_0x5a1d('0x1a')]();});}};}function handleEntityNotFound(_0x227f77,_0x329321){return function(_0x27d18e){if(!_0x27d18e){_0x227f77[_0x5a1d('0x18')](0x194);}return _0x27d18e;};}function handleError(_0x1bf6a1,_0x4cca2f){_0x4cca2f=_0x4cca2f||0x1f4;return function(_0x1e1975){logger[_0x5a1d('0x29')](_0x1e1975[_0x5a1d('0x2a')]);if(_0x1e1975['name']){delete _0x1e1975[_0x5a1d('0x2b')];}_0x1bf6a1[_0x5a1d('0x19')](_0x4cca2f)[_0x5a1d('0x2c')](_0x1e1975);};}exports[_0x5a1d('0x2d')]=function(_0x309680,_0x721dab){var _0x546ad3={},_0x535630={},_0x44f84c={'count':0x0,'rows':[]};return db[_0x5a1d('0x2e')][_0x5a1d('0x2f')]()[_0x5a1d('0x25')](function(_0x428097){_0x535630[_0x5a1d('0x30')]=_[_0x5a1d('0x31')](_0x428097);_0x535630[_0x5a1d('0x32')]=_['keys'](_0x309680[_0x5a1d('0x32')]);_0x535630[_0x5a1d('0x33')]=_[_0x5a1d('0x34')](_0x535630['model'],_0x535630['query']);_0x546ad3[_0x5a1d('0x35')]=_[_0x5a1d('0x34')](_0x535630[_0x5a1d('0x30')],qs[_0x5a1d('0x36')](_0x309680[_0x5a1d('0x32')][_0x5a1d('0x36')]));_0x546ad3[_0x5a1d('0x35')]=_0x546ad3[_0x5a1d('0x35')][_0x5a1d('0x37')]?_0x546ad3[_0x5a1d('0x35')]:_0x535630[_0x5a1d('0x30')];if(!_0x309680[_0x5a1d('0x32')][_0x5a1d('0x38')]('nolimit')){_0x546ad3[_0x5a1d('0x1d')]=qs[_0x5a1d('0x1d')](_0x309680[_0x5a1d('0x32')]['limit']);_0x546ad3[_0x5a1d('0x1c')]=qs[_0x5a1d('0x1c')](_0x309680[_0x5a1d('0x32')][_0x5a1d('0x1c')]);}_0x546ad3[_0x5a1d('0x39')]=qs['sort'](_0x309680[_0x5a1d('0x32')][_0x5a1d('0x3a')]);_0x546ad3[_0x5a1d('0x3b')]=qs[_0x5a1d('0x33')](_['pick'](_0x309680['query'],_0x535630['filters']),_0x428097);if(_0x309680[_0x5a1d('0x32')]['filter']){_0x546ad3['where']=_[_0x5a1d('0x3c')](_0x546ad3['where'],{'$or':_[_0x5a1d('0x3d')](_0x546ad3[_0x5a1d('0x35')],function(_0x17d7e9){var _0x333d6b={};_0x333d6b[_0x17d7e9]={'$like':'%'+_0x309680[_0x5a1d('0x32')][_0x5a1d('0x3e')]+'%'};return _0x333d6b;})});}_0x546ad3=_[_0x5a1d('0x3c')]({},_0x546ad3,_0x309680[_0x5a1d('0x3f')]);var _0x1ef6e0={'where':_0x546ad3['where']};return db[_0x5a1d('0x2e')]['count'](_0x1ef6e0)[_0x5a1d('0x25')](function(_0x44b09c){_0x44f84c['count']=_0x44b09c;if(_0x309680[_0x5a1d('0x32')][_0x5a1d('0x40')]){_0x546ad3[_0x5a1d('0x41')]=[{'all':!![]}];}return db[_0x5a1d('0x2e')][_0x5a1d('0x42')](_0x546ad3);})[_0x5a1d('0x25')](function(_0x3d8ef5){_0x44f84c[_0x5a1d('0x43')]=_0x3d8ef5;return _0x44f84c;})[_0x5a1d('0x25')](respondWithFilteredResult(_0x721dab,_0x546ad3))[_0x5a1d('0x44')](handleError(_0x721dab,null));})[_0x5a1d('0x44')](handleError(_0x721dab,null));};exports['show']=function(_0x5f4db7,_0x547a4f){var _0x570f76={'raw':![],'where':{'id':_0x5f4db7[_0x5a1d('0x45')]['id']}},_0x41cb05={};_0x41cb05[_0x5a1d('0x30')]=_[_0x5a1d('0x31')](db['CmCompany']['rawAttributes']);_0x41cb05[_0x5a1d('0x32')]=_['keys'](_0x5f4db7[_0x5a1d('0x32')]);_0x41cb05[_0x5a1d('0x33')]=_['intersection'](_0x41cb05[_0x5a1d('0x30')],_0x41cb05[_0x5a1d('0x32')]);_0x570f76[_0x5a1d('0x35')]=_[_0x5a1d('0x34')](_0x41cb05[_0x5a1d('0x30')],qs[_0x5a1d('0x36')](_0x5f4db7['query'][_0x5a1d('0x36')]));_0x570f76[_0x5a1d('0x35')]=_0x570f76[_0x5a1d('0x35')][_0x5a1d('0x37')]?_0x570f76[_0x5a1d('0x35')]:_0x41cb05[_0x5a1d('0x30')];if(_0x5f4db7['query'][_0x5a1d('0x40')]){_0x570f76[_0x5a1d('0x41')]=[{'all':!![]}];}_0x570f76=_['merge']({},_0x570f76,_0x5f4db7[_0x5a1d('0x3f')]);return db[_0x5a1d('0x2e')][_0x5a1d('0x46')](_0x570f76)['then'](handleEntityNotFound(_0x547a4f,null))[_0x5a1d('0x25')](respondWithResult(_0x547a4f,null))[_0x5a1d('0x44')](handleError(_0x547a4f,null));};exports[_0x5a1d('0x47')]=function(_0x32af5d,_0xc37fe2){return db[_0x5a1d('0x2e')][_0x5a1d('0x47')](_0x32af5d['body'],{})['then'](function(_0xed0bfe){var _0x5adca0=_0x32af5d[_0x5a1d('0x48')][_0x5a1d('0x26')]({'plain':!![]});if(!_0x5adca0)throw new Error(_0x5a1d('0x49'));if(_0x5adca0[_0x5a1d('0x4a')]==='user'){var _0x1f7e70=_0xed0bfe[_0x5a1d('0x26')]({'plain':!![]});var _0x1a56b1=_0x5a1d('0x27');return db[_0x5a1d('0x4b')][_0x5a1d('0x46')]({'where':{'name':_0x1a56b1,'userProfileId':_0x5adca0[_0x5a1d('0x4c')]},'raw':!![]})[_0x5a1d('0x25')](function(_0x8a2cd2){if(_0x8a2cd2&&_0x8a2cd2['autoAssociation']===0x0){return db['UserProfileResource'][_0x5a1d('0x47')]({'name':_0x1f7e70[_0x5a1d('0x2b')],'resourceId':_0x1f7e70['id'],'type':_0x8a2cd2[_0x5a1d('0x2b')],'sectionId':_0x8a2cd2['id']},{})[_0x5a1d('0x25')](function(){return _0xed0bfe;});}else{return _0xed0bfe;}})[_0x5a1d('0x44')](function(_0x1c98b5){logger['error'](_0x5a1d('0x4d'),_0x1c98b5);throw _0x1c98b5;});}return _0xed0bfe;})[_0x5a1d('0x25')](respondWithResult(_0xc37fe2,0xc9))[_0x5a1d('0x44')](handleError(_0xc37fe2,null));};exports[_0x5a1d('0x23')]=function(_0x5174bf,_0x1c200d){if(_0x5174bf[_0x5a1d('0x4e')]['id']){delete _0x5174bf[_0x5a1d('0x4e')]['id'];}return db[_0x5a1d('0x2e')][_0x5a1d('0x46')]({'where':{'id':_0x5174bf[_0x5a1d('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c200d,null))[_0x5a1d('0x25')](saveUpdates(_0x5174bf[_0x5a1d('0x4e')],null))[_0x5a1d('0x25')](respondWithResult(_0x1c200d,null))[_0x5a1d('0x44')](handleError(_0x1c200d,null));};exports[_0x5a1d('0x24')]=function(_0x18f676,_0x356c16){return db[_0x5a1d('0x2e')][_0x5a1d('0x46')]({'where':{'id':_0x18f676[_0x5a1d('0x45')]['id']}})['then'](handleEntityNotFound(_0x356c16,null))['then'](removeEntity(_0x356c16,null))[_0x5a1d('0x44')](handleError(_0x356c16,null));};exports['describe']=function(_0x463538,_0x50884e){return db[_0x5a1d('0x2e')][_0x5a1d('0x2f')]()[_0x5a1d('0x25')](respondWithResult(_0x50884e,null))[_0x5a1d('0x44')](handleError(_0x50884e,null));};exports[_0x5a1d('0x4f')]=function(_0x340829,_0x582c26,_0x553465){return db[_0x5a1d('0x50')][_0x5a1d('0x46')]({'where':{'id':_0x340829['params']['id']}})[_0x5a1d('0x25')](handleEntityNotFound(_0x582c26,null))[_0x5a1d('0x25')](function(_0x12c4b4){if(_0x12c4b4){return _0x12c4b4['addContacts'](_0x340829[_0x5a1d('0x4e')][_0x5a1d('0x51')],_[_0x5a1d('0x52')](_0x340829[_0x5a1d('0x4e')],[_0x5a1d('0x51'),'id'])||{});}})['then'](respondWithResult(_0x582c26,null))[_0x5a1d('0x44')](handleError(_0x582c26,null));};exports['getContacts']=function(_0x5e5af5,_0x37fa17,_0x2fc158){var _0x293ec2={};var _0x35a214={};var _0x2c73a8;var _0x736dd8;return db['CmCompany'][_0x5a1d('0x53')]({'where':{'id':_0x5e5af5[_0x5a1d('0x45')]['id']}})[_0x5a1d('0x25')](handleEntityNotFound(_0x37fa17,null))[_0x5a1d('0x25')](function(_0x5d984e){if(_0x5d984e){_0x2c73a8=_0x5d984e;_0x35a214[_0x5a1d('0x30')]=_[_0x5a1d('0x31')](db[_0x5a1d('0x50')][_0x5a1d('0x54')]);_0x35a214[_0x5a1d('0x32')]=_[_0x5a1d('0x31')](_0x5e5af5[_0x5a1d('0x32')]);_0x35a214[_0x5a1d('0x33')]=_[_0x5a1d('0x34')](_0x35a214[_0x5a1d('0x30')],_0x35a214[_0x5a1d('0x32')]);_0x293ec2[_0x5a1d('0x35')]=_[_0x5a1d('0x34')](_0x35a214[_0x5a1d('0x30')],qs[_0x5a1d('0x36')](_0x5e5af5[_0x5a1d('0x32')][_0x5a1d('0x36')]));_0x293ec2['attributes']=_0x293ec2[_0x5a1d('0x35')][_0x5a1d('0x37')]?_0x293ec2['attributes']:_0x35a214[_0x5a1d('0x30')];_0x293ec2['order']=qs[_0x5a1d('0x3a')](_0x5e5af5[_0x5a1d('0x32')][_0x5a1d('0x3a')]);_0x293ec2[_0x5a1d('0x3b')]=qs['filters'](_['pick'](_0x5e5af5['query'],_0x35a214[_0x5a1d('0x33')]));if(_0x5e5af5[_0x5a1d('0x32')][_0x5a1d('0x3e')]){_0x293ec2['where']=_[_0x5a1d('0x3c')](_0x293ec2[_0x5a1d('0x3b')],{'$or':_[_0x5a1d('0x3d')](_0x293ec2['attributes'],function(_0x44e610){var _0xf38cb8={};_0xf38cb8[_0x44e610]={'$like':'%'+_0x5e5af5[_0x5a1d('0x32')][_0x5a1d('0x3e')]+'%'};return _0xf38cb8;})});}_0x293ec2=_['merge']({},_0x293ec2,_0x5e5af5[_0x5a1d('0x3f')]);return _0x2c73a8['getContacts'](_0x293ec2);}})[_0x5a1d('0x25')](function(_0x3bc357){if(_0x3bc357){_0x736dd8=_0x3bc357[_0x5a1d('0x37')];if(!_0x5e5af5[_0x5a1d('0x32')]['hasOwnProperty'](_0x5a1d('0x55'))){_0x293ec2[_0x5a1d('0x1d')]=qs[_0x5a1d('0x1d')](_0x5e5af5[_0x5a1d('0x32')][_0x5a1d('0x1d')]);_0x293ec2['offset']=qs[_0x5a1d('0x1c')](_0x5e5af5[_0x5a1d('0x32')]['offset']);}return _0x2c73a8['getContacts'](_0x293ec2);}})['then'](function(_0x5c44b7){if(_0x5c44b7){return _0x5c44b7?{'count':_0x736dd8,'rows':_0x5c44b7}:null;}})[_0x5a1d('0x25')](respondWithResult(_0x37fa17,null))['catch'](handleError(_0x37fa17,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 27ad0c2..06b4164 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 _0x34d2=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','cm_companies','util'];(function(_0x4315e4,_0xc9e9b8){var _0x29e514=function(_0x13002e){while(--_0x13002e){_0x4315e4['push'](_0x4315e4['shift']());}};_0x29e514(++_0xc9e9b8);}(_0x34d2,0xc7));var _0x234d=function(_0x244f24,_0x262afa){_0x244f24=_0x244f24-0x0;var _0x1b5a51=_0x34d2[_0x244f24];return _0x1b5a51;};'use strict';var _=require('lodash');var util=require(_0x234d('0x0'));var logger=require(_0x234d('0x1'))(_0x234d('0x2'));var moment=require('moment');var BPromise=require(_0x234d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x234d('0x4'));var rimraf=require(_0x234d('0x5'));var config=require(_0x234d('0x6'));var attributes=require('./cmCompany.attributes');module[_0x234d('0x7')]=function(_0x97c5e1,_0x2a84ca){return _0x97c5e1[_0x234d('0x8')]('CmCompany',attributes,{'tableName':_0x234d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75b3=['api','bluebird','request-promise','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x470345,_0x300ba0){var _0x2093dd=function(_0x1202b7){while(--_0x1202b7){_0x470345['push'](_0x470345['shift']());}};_0x2093dd(++_0x300ba0);}(_0x75b3,0x17e));var _0x375b=function(_0x44458b,_0x3db654){_0x44458b=_0x44458b-0x0;var _0x30af2f=_0x75b3[_0x44458b];return _0x30af2f;};'use strict';var _=require(_0x375b('0x0'));var util=require(_0x375b('0x1'));var logger=require(_0x375b('0x2'))(_0x375b('0x3'));var moment=require('moment');var BPromise=require(_0x375b('0x4'));var rp=require(_0x375b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x375b('0x6'));var attributes=require(_0x375b('0x7'));module[_0x375b('0x8')]=function(_0xebd122,_0x5bb122){return _0xebd122['define'](_0x375b('0x9'),attributes,{'tableName':_0x375b('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 a0f677c..d3a3537 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 _0x7198=['stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7198,0x1cf));var _0x8719=function(_0x2f6cd6,_0x52fbd0){_0x2f6cd6=_0x2f6cd6-0x0;var _0x363b5c=_0x7198[_0x2f6cd6];return _0x363b5c;};'use strict';var _=require(_0x8719('0x0'));var util=require(_0x8719('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8719('0x2'));var fs=require('fs');var Redis=require(_0x8719('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8719('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8719('0x5'));var client=jayson[_0x8719('0x6')][_0x8719('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ea90a,_0x429b94,_0x41219f){return new BPromise(function(_0x35e602,_0x20e3e6){return client[_0x8719('0x8')](_0x1ea90a,_0x41219f)['then'](function(_0x5510eb){logger['info'](_0x8719('0x9'),_0x429b94,_0x8719('0xa'));logger['debug'](_0x8719('0xb'),_0x429b94,'request\x20sent',JSON[_0x8719('0xc')](_0x5510eb));if(_0x5510eb[_0x8719('0xd')]){if(_0x5510eb['error'][_0x8719('0xe')]===0x1f4){logger[_0x8719('0xd')](_0x8719('0x9'),_0x429b94,_0x5510eb[_0x8719('0xd')][_0x8719('0xf')]);return _0x20e3e6(_0x5510eb[_0x8719('0xd')][_0x8719('0xf')]);}logger[_0x8719('0xd')](_0x8719('0x9'),_0x429b94,_0x5510eb[_0x8719('0xd')][_0x8719('0xf')]);return _0x35e602(_0x5510eb[_0x8719('0xd')][_0x8719('0xf')]);}else{logger[_0x8719('0x10')](_0x8719('0x9'),_0x429b94,_0x8719('0xa'));_0x35e602(_0x5510eb[_0x8719('0x11')][_0x8719('0xf')]);}})[_0x8719('0x12')](function(_0x4572e8){logger[_0x8719('0xd')](_0x8719('0x9'),_0x429b94,_0x4572e8);_0x20e3e6(_0x4572e8);});});} \ No newline at end of file +var _0xbb24=['stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x24d87b,_0x5e3ba3){var _0x29739e=function(_0x45cd3b){while(--_0x45cd3b){_0x24d87b['push'](_0x24d87b['shift']());}};_0x29739e(++_0x5e3ba3);}(_0xbb24,0x166));var _0x4bb2=function(_0x31b38f,_0x5efbd2){_0x31b38f=_0x31b38f-0x0;var _0xa19bd2=_0xbb24[_0x31b38f];return _0xa19bd2;};'use strict';var _=require(_0x4bb2('0x0'));var util=require('util');var moment=require(_0x4bb2('0x1'));var BPromise=require(_0x4bb2('0x2'));var rs=require(_0x4bb2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bb2('0x4'))['db'];var utils=require(_0x4bb2('0x5'));var logger=require(_0x4bb2('0x6'))(_0x4bb2('0x7'));var config=require(_0x4bb2('0x8'));var jayson=require(_0x4bb2('0x9'));var client=jayson[_0x4bb2('0xa')][_0x4bb2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x426617,_0xd84499,_0xb1b004){return new BPromise(function(_0xffc9b,_0x1e5340){return client['request'](_0x426617,_0xb1b004)[_0x4bb2('0xc')](function(_0x29f706){logger[_0x4bb2('0xd')]('CmCompany,\x20%s,\x20%s',_0xd84499,'request\x20sent');logger['debug'](_0x4bb2('0xe'),_0xd84499,_0x4bb2('0xf'),JSON[_0x4bb2('0x10')](_0x29f706));if(_0x29f706[_0x4bb2('0x11')]){if(_0x29f706[_0x4bb2('0x11')][_0x4bb2('0x12')]===0x1f4){logger[_0x4bb2('0x11')](_0x4bb2('0x13'),_0xd84499,_0x29f706[_0x4bb2('0x11')][_0x4bb2('0x14')]);return _0x1e5340(_0x29f706[_0x4bb2('0x11')][_0x4bb2('0x14')]);}logger[_0x4bb2('0x11')](_0x4bb2('0x13'),_0xd84499,_0x29f706[_0x4bb2('0x11')][_0x4bb2('0x14')]);return _0xffc9b(_0x29f706['error'][_0x4bb2('0x14')]);}else{logger[_0x4bb2('0xd')](_0x4bb2('0x13'),_0xd84499,_0x4bb2('0xf'));_0xffc9b(_0x29f706[_0x4bb2('0x15')]['message']);}})['catch'](function(_0x3246d1){logger[_0x4bb2('0x11')](_0x4bb2('0x13'),_0xd84499,_0x3246d1);_0x1e5340(_0x3246d1);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 542f73c..d216d48 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 _0xb2ba=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','/describe','isAuthenticated','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0xb2ba,0x1b5));var _0xab2b=function(_0x3e231f,_0x592b25){_0x3e231f=_0x3e231f-0x0;var _0xafd21c=_0xb2ba[_0x3e231f];return _0xafd21c;};'use strict';var multer=require(_0xab2b('0x0'));var util=require(_0xab2b('0x1'));var path=require(_0xab2b('0x2'));var timeout=require(_0xab2b('0x3'));var express=require(_0xab2b('0x4'));var router=express[_0xab2b('0x5')]();var fs_extra=require(_0xab2b('0x6'));var auth=require(_0xab2b('0x7'));var interaction=require(_0xab2b('0x8'));var config=require(_0xab2b('0x9'));var controller=require(_0xab2b('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xab2b('0xb')](_0xab2b('0xc'),auth[_0xab2b('0xd')](),controller[_0xab2b('0xe')]);router['get'](_0xab2b('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xab2b('0xb')](_0xab2b('0x10'),auth[_0xab2b('0xd')](),controller[_0xab2b('0x11')]);router[_0xab2b('0x12')]('/',auth[_0xab2b('0xd')](),controller[_0xab2b('0x13')]);router[_0xab2b('0x12')]('/:id/contacts',auth[_0xab2b('0xd')](),controller[_0xab2b('0x14')]);router[_0xab2b('0x15')](_0xab2b('0xf'),auth['isAuthenticated'](),controller[_0xab2b('0x16')]);router[_0xab2b('0x17')](_0xab2b('0xf'),auth['isAuthenticated'](),controller[_0xab2b('0x18')]);module[_0xab2b('0x19')]=router; \ No newline at end of file +var _0x658e=['../../components/auth/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','/describe','describe','get','/:id','post','addContacts','put','update','exports','multer','util','path','express'];(function(_0x32b62c,_0x3b18d5){var _0x3a2e4a=function(_0x59005c){while(--_0x59005c){_0x32b62c['push'](_0x32b62c['shift']());}};_0x3a2e4a(++_0x3b18d5);}(_0x658e,0x19a));var _0xe658=function(_0x496ba1,_0x4127d3){_0x496ba1=_0x496ba1-0x0;var _0x65a30b=_0x658e[_0x496ba1];return _0x65a30b;};'use strict';var multer=require(_0xe658('0x0'));var util=require(_0xe658('0x1'));var path=require(_0xe658('0x2'));var timeout=require('connect-timeout');var express=require(_0xe658('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe658('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe658('0x5'));var controller=require(_0xe658('0x6'));router['get']('/',auth[_0xe658('0x7')](),controller[_0xe658('0x8')]);router['get'](_0xe658('0x9'),auth[_0xe658('0x7')](),controller[_0xe658('0xa')]);router[_0xe658('0xb')](_0xe658('0xc'),auth[_0xe658('0x7')](),controller['show']);router[_0xe658('0xb')]('/:id/contacts',auth[_0xe658('0x7')](),controller['getContacts']);router[_0xe658('0xd')]('/',auth[_0xe658('0x7')](),controller['create']);router[_0xe658('0xd')]('/:id/contacts',auth[_0xe658('0x7')](),controller[_0xe658('0xe')]);router[_0xe658('0xf')]('/:id',auth[_0xe658('0x7')](),controller[_0xe658('0x10')]);router['delete']('/:id',auth[_0xe658('0x7')](),controller['destroy']);module[_0xe658('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index ddaf71d..6d578d6 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 _0xc7a4=['TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','STRING'];(function(_0x594921,_0x305c63){var _0x42ec6a=function(_0x35be16){while(--_0x35be16){_0x594921['push'](_0x594921['shift']());}};_0x42ec6a(++_0x305c63);}(_0xc7a4,0x1ed));var _0x4c7a=function(_0x5256be,_0x5c4249){_0x5256be=_0x5256be-0x0;var _0x6d394e=_0xc7a4[_0x5256be];return _0x6d394e;};'use strict';var _=require(_0x4c7a('0x0'));var Sequelize=require(_0x4c7a('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x4c7a('0x2')]},'postalCode':{'type':Sequelize[_0x4c7a('0x2')]},'city':{'type':Sequelize[_0x4c7a('0x2')]},'country':{'type':Sequelize[_0x4c7a('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4c7a('0x3')]},'phone':{'type':Sequelize[_0x4c7a('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x4c7a('0x2')]},'email':{'type':Sequelize[_0x4c7a('0x2')]},'url':{'type':Sequelize[_0x4c7a('0x2')]},'facebook':{'type':Sequelize[_0x4c7a('0x2')]},'fb_data':{'type':Sequelize[_0x4c7a('0x2')]},'twitter':{'type':Sequelize[_0x4c7a('0x2')]},'skype':{'type':Sequelize[_0x4c7a('0x2')]},'teams':{'type':Sequelize[_0x4c7a('0x2')]},'viber':{'type':Sequelize[_0x4c7a('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x4c7a('0x2')]},'telegram':{'type':Sequelize[_0x4c7a('0x2')]},'UserId':{'type':Sequelize[_0x4c7a('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x4c7a('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4c7a('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4c7a('0x6')],'defaultValue':Sequelize[_0x4c7a('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x4c7a('0x4')]}}; \ No newline at end of file +var _0x4ae1=['DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x46ce14,_0x4f7796){var _0x1f15f0=function(_0x314f19){while(--_0x314f19){_0x46ce14['push'](_0x46ce14['shift']());}};_0x1f15f0(++_0x4f7796);}(_0x4ae1,0x1aa));var _0x14ae=function(_0x2deac4,_0xc27a2b){_0x2deac4=_0x2deac4-0x0;var _0x1c0bda=_0x4ae1[_0x2deac4];return _0x1c0bda;};'use strict';var _=require('lodash');var Sequelize=require(_0x14ae('0x0'));module[_0x14ae('0x1')]={'firstName':{'type':Sequelize[_0x14ae('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x14ae('0x2')]},'street':{'type':Sequelize[_0x14ae('0x2')]},'postalCode':{'type':Sequelize[_0x14ae('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x14ae('0x2')]},'dateOfBirth':{'type':Sequelize[_0x14ae('0x2')]},'description':{'type':Sequelize[_0x14ae('0x3')]},'phone':{'type':Sequelize[_0x14ae('0x2')]},'mobile':{'type':Sequelize[_0x14ae('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x14ae('0x2')]},'url':{'type':Sequelize[_0x14ae('0x2')]},'facebook':{'type':Sequelize[_0x14ae('0x2')]},'fb_data':{'type':Sequelize[_0x14ae('0x2')]},'twitter':{'type':Sequelize[_0x14ae('0x2')]},'skype':{'type':Sequelize[_0x14ae('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x14ae('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x14ae('0x2')]},'UserId':{'type':Sequelize[_0x14ae('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x14ae('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x14ae('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x14ae('0x6')],'defaultValue':Sequelize[_0x14ae('0x7')]},'dialTimezone':{'type':Sequelize[_0x14ae('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 2404fd0..2785c6e 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 _0x1c21=['rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','include','rows','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','join','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','upload','parse','meta','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','getJourney','mail','chat','sms','openchannel','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','UserId','fullname','DESC','findAndCountAll','alias','Website','closed','closedAt','disposition','thirdDisposition','Account','Owner','Tags','browserName','deviceModel','osName','ratingMessage','ratingType','referer','subject','externalUrl','threadId','Interaction','sortBy','reverse','value','moment','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','./cmContact.socket','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','name','send','index','describe','findAll','query','user','catch','CmContact','find','params','keys','length','startsWith','cf_','columnName','displayName','analytics','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','get','mergeWith','isArray','tags','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','push','show','color','tag','Phones','ItemType','literal','Phones.OrderBy','$and','CmCustomField','omit','format','pickBy','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','sequelize','text','phone','CmHopper','getTags','findOne','model','Tag','rawAttributes','attributes','intersection','fields','order','sort','pick','filters','filter','map','options','hasOwnProperty','nolimit','setTags','setAdditionalPhones','all','ContactItemType','OrderBy','item_types','ItemTypeId','items','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','fromContactId','CmContactId','toContactId'];(function(_0x5cb165,_0x45376a){var _0x336aaa=function(_0x3c4777){while(--_0x3c4777){_0x5cb165['push'](_0x5cb165['shift']());}};_0x336aaa(++_0x45376a);}(_0x1c21,0x15d));var _0x11c2=function(_0x36f07b,_0x58a755){_0x36f07b=_0x36f07b-0x0;var _0x4e5329=_0x1c21[_0x36f07b];return _0x4e5329;};'use strict';var moment=require(_0x11c2('0x0'));var BPromise=require('bluebird');var util=require(_0x11c2('0x1'));var path=require(_0x11c2('0x2'));var fs=require('fs');var _=require(_0x11c2('0x3'));var squel=require(_0x11c2('0x4'));var Papa=require(_0x11c2('0x5'));var Redis=require(_0x11c2('0x6'));var contacts=require(_0x11c2('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x11c2('0x8'))(_0x11c2('0x9'));var config=require(_0x11c2('0xa'));var shared=require(_0x11c2('0xb'));var db=require(_0x11c2('0xc'))['db'];config[_0x11c2('0xd')]=_[_0x11c2('0xe')](config[_0x11c2('0xd')],{'host':_0x11c2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x11c2('0x10'))['register'](socket);function respondWithResult(_0x3fe15a,_0x58823c){_0x58823c=_0x58823c||0xc8;return function(_0x598d13){if(_0x598d13){return _0x3fe15a[_0x11c2('0x11')](_0x58823c)[_0x11c2('0x12')](_0x598d13);}};}function respondWithFilteredResult(_0x36129c,_0x14a92e){return function(_0x59a6b5){if(_0x59a6b5){var _0x1ded52=typeof _0x14a92e[_0x11c2('0x13')]===_0x11c2('0x14')&&typeof _0x14a92e[_0x11c2('0x15')]===_0x11c2('0x14');var _0x228f26=_0x59a6b5[_0x11c2('0x16')];var _0x2327e4=_0x1ded52?0x0:_0x14a92e[_0x11c2('0x13')];var _0x4f7134=_0x1ded52?_0x59a6b5[_0x11c2('0x16')]:_0x14a92e[_0x11c2('0x13')]+_0x14a92e['limit'];var _0x135a24;if(_0x4f7134>=_0x228f26){_0x4f7134=_0x228f26;_0x135a24=0xc8;}else{_0x135a24=0xce;}_0x36129c['status'](_0x135a24);return _0x36129c[_0x11c2('0x17')](_0x11c2('0x18'),_0x2327e4+'-'+_0x4f7134+'/'+_0x228f26)[_0x11c2('0x12')](_0x59a6b5);}return null;};}function saveUpdates(_0x3ea195){return function(_0xd1ec63){if(_0xd1ec63){return _0xd1ec63[_0x11c2('0x19')](_0x3ea195)[_0x11c2('0x1a')](function(_0x5bd700){return _0x5bd700;});}return null;};}function removeEntity(_0x2a7e2c){return function(_0x18daa0){if(_0x18daa0){return _0x18daa0[_0x11c2('0x1b')]()[_0x11c2('0x1a')](function(){_0x2a7e2c['status'](0xcc)[_0x11c2('0x1c')]();});}};}function handleEntityNotFound(_0x47747c){return function(_0x34b6ec){if(!_0x34b6ec){_0x47747c[_0x11c2('0x1d')](0x194);}return _0x34b6ec;};}function handleError(_0xc005b1,_0xa84988){_0xa84988=_0xa84988||0x1f4;return function(_0x573c7a){logger['error'](_0x573c7a['stack']);if(_0x573c7a[_0x11c2('0x1e')]){delete _0x573c7a[_0x11c2('0x1e')];}_0xc005b1['status'](_0xa84988)[_0x11c2('0x1f')](_0x573c7a);};}exports[_0x11c2('0x20')]=function(_0x237113,_0x2ea376){var _0x255c87={};return contacts[_0x11c2('0x21')]()['then'](function(_0x39f92c){_0x255c87=qs['getOptions'](_0x39f92c,_0x237113);return contacts[_0x11c2('0x22')](_0x237113[_0x11c2('0x23')],_0x237113[_0x11c2('0x24')],_0x255c87,_0x39f92c);})['then'](respondWithFilteredResult(_0x2ea376,_0x255c87))[_0x11c2('0x25')](handleError(_0x2ea376,null));};exports[_0x11c2('0x1b')]=function(_0x2ff257,_0xcf852){return db[_0x11c2('0x26')][_0x11c2('0x27')]({'where':{'id':_0x2ff257[_0x11c2('0x28')]['id']}})[_0x11c2('0x1a')](handleEntityNotFound(_0xcf852,null))[_0x11c2('0x1a')](removeEntity(_0xcf852,null))[_0x11c2('0x25')](handleError(_0xcf852,null));};exports['describe']=function(_0x3b6236,_0x26733d){return db[_0x11c2('0x26')]['describe']()[_0x11c2('0x1a')](function(_0x1c3161){delete _0x1c3161['tags'];for(var _0x56fd68=0x0;_0x56fd680x0){return new Promise(function(_0x344d6a){var _0x580c97=[];for(var _0x218ae8=0x0;_0x218ae8<_0x3a24f5[_0x11c2('0x2a')];_0x218ae8++){_0x580c97[_0x11c2('0x60')](insertAdditionalPhones(_0x3a24f5[_0x218ae8]['contact'],_0x3a24f5[_0x218ae8][_0x11c2('0x59')]));}Promise['all'](_0x580c97)[_0x11c2('0x1a')](function(){_0x344d6a(0x1);});})[_0x11c2('0x1a')](function(){return{'success':_0x373659,'failure':_0x38fd9d,'duplicates':_0x286b38};});}else{return{'success':_0x373659,'failure':_0x38fd9d,'duplicates':_0x286b38};}}})[_0x11c2('0x1a')](respondWithResult(_0x2fef5b,0xc9))['catch'](handleError(_0x2fef5b,null));};exports[_0x11c2('0x61')]=function(_0x4dd016,_0x3f0f7f){var _0x4a5d3f;return db[_0x11c2('0x26')][_0x11c2('0x21')]()[_0x11c2('0x1a')](function(_0x157bf4){return db[_0x11c2('0x26')]['find']({'where':{'id':_0x4dd016[_0x11c2('0x28')]['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x11c2('0x1e'),_0x11c2('0x62')],'required':_0x4dd016['query'][_0x11c2('0x63')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x11c2('0x64'),'where':{'CmContactId':_0x4dd016[_0x11c2('0x28')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x11c2('0x65')}]}],'order':[db['sequelize'][_0x11c2('0x66')](_0x11c2('0x67'))],'attributes':_[_0x11c2('0x29')](_0x157bf4)});})['then'](function(_0x25e610){if(!_[_0x11c2('0x55')](_0x25e610)){_0x4a5d3f=_0x25e610['get']({'plain':!![]});var _0x167a93={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x25e610&&_0x25e610[_0x11c2('0x5f')]){if(_0x25e610[_0x11c2('0x5f')]){_0x167a93[_0x11c2('0x5d')][_0x11c2('0x68')][_0x11c2('0x60')]({'ListId':{'$ne':_0x25e610[_0x11c2('0x5f')]}});}}return db[_0x11c2('0x69')][_0x11c2('0x22')](_0x167a93);}})[_0x11c2('0x1a')](function(_0x5320c6){if(!_[_0x11c2('0x55')](_0x5320c6)){return _[_0x11c2('0x6a')](_0x4a5d3f,_['map'](_0x5320c6,function(_0x28984f){return util[_0x11c2('0x6b')]('cf_%d',_0x28984f['id']);}));}})[_0x11c2('0x1a')](handleEntityNotFound(_0x3f0f7f,null))[_0x11c2('0x1a')](respondWithResult(_0x3f0f7f,null))[_0x11c2('0x25')](handleError(_0x3f0f7f,null));};exports[_0x11c2('0x19')]=function(_0x417076,_0x1b1567){var _0x43e6cd;if(_0x417076[_0x11c2('0x37')]['id']){delete _0x417076[_0x11c2('0x37')]['id'];}if(!_[_0x11c2('0x55')](_0x417076[_0x11c2('0x37')][_0x11c2('0x56')])){var _0x48cc5d=_0x417076[_0x11c2('0x37')][_0x11c2('0x56')];if(!_[_0x11c2('0x55')](shared[_0x11c2('0x57')][_0x48cc5d]))_0x417076[_0x11c2('0x37')][_0x11c2('0x58')]=shared['timezones'][_0x48cc5d]['utcOffset'];}return db[_0x11c2('0x26')]['find']({'where':{'id':_0x417076[_0x11c2('0x28')]['id']}})[_0x11c2('0x1a')](handleEntityNotFound(_0x1b1567,null))[_0x11c2('0x1a')](saveUpdates(_0x417076[_0x11c2('0x37')],null))[_0x11c2('0x1a')](function(_0x381f66){_0x43e6cd=_0x381f66;var _0x3d9299={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x381f66&&_0x381f66['ListId']){if(_0x381f66['ListId']){_0x3d9299[_0x11c2('0x5d')][_0x11c2('0x68')][_0x11c2('0x60')]({'ListId':{'$ne':_0x381f66[_0x11c2('0x5f')]}});}}return db[_0x11c2('0x69')]['findAll'](_0x3d9299);})[_0x11c2('0x1a')](function(_0x200009){if(_0x200009){return _[_0x11c2('0x6a')](_[_0x11c2('0x6c')](_0x417076[_0x11c2('0x37')],function(_0x3bd64f,_0x182c2d){return _['startsWith'](_0x182c2d,_0x11c2('0x2c'));}),_['map'](_0x200009,function(_0x23fed7){return util['format'](_0x11c2('0x6d'),_0x23fed7['id']);}));}})['then'](function(_0x3184c8){if(_0x3184c8&&!_[_0x11c2('0x6e')](_0x3184c8)){var _0x135bbf=squel[_0x11c2('0x19')]()['table'](_0x11c2('0x6f'))['setFields'](_0x3184c8)[_0x11c2('0x5d')](_0x11c2('0x70'),_0x417076[_0x11c2('0x28')]['id'])[_0x11c2('0x71')]();return db[_0x11c2('0x72')][_0x11c2('0x23')](_0x135bbf[_0x11c2('0x73')],{'replacements':_0x135bbf[_0x11c2('0x32')]});}})[_0x11c2('0x1a')](function(){if(_0x417076[_0x11c2('0x37')][_0x11c2('0x74')]&&_0x43e6cd){return db[_0x11c2('0x75')][_0x11c2('0x19')]({'phone':_0x417076['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x43e6cd['id']}});}})['then'](function(){return _0x43e6cd;})['then'](respondWithResult(_0x1b1567,null))[_0x11c2('0x25')](handleError(_0x1b1567,null));};exports[_0x11c2('0x76')]=function(_0xa0d421,_0x1c8b80){var _0x1da245={};var _0x9ee09e={};var _0x3cadf3;var _0x32de86;return db[_0x11c2('0x26')][_0x11c2('0x77')]({'where':{'id':_0xa0d421[_0x11c2('0x28')]['id']}})[_0x11c2('0x1a')](handleEntityNotFound(_0x1c8b80,null))[_0x11c2('0x1a')](function(_0x3855c2){if(_0x3855c2){_0x3cadf3=_0x3855c2;_0x9ee09e[_0x11c2('0x78')]=_[_0x11c2('0x29')](db[_0x11c2('0x79')][_0x11c2('0x7a')]);_0x9ee09e['query']=_[_0x11c2('0x29')](_0xa0d421['query']);_0x9ee09e['filters']=_['intersection'](_0x9ee09e['model'],_0x9ee09e[_0x11c2('0x23')]);_0x1da245[_0x11c2('0x7b')]=_[_0x11c2('0x7c')](_0x9ee09e[_0x11c2('0x78')],qs['fields'](_0xa0d421[_0x11c2('0x23')][_0x11c2('0x7d')]));_0x1da245[_0x11c2('0x7b')]=_0x1da245['attributes'][_0x11c2('0x2a')]?_0x1da245[_0x11c2('0x7b')]:_0x9ee09e['model'];_0x1da245[_0x11c2('0x7e')]=qs['sort'](_0xa0d421[_0x11c2('0x23')][_0x11c2('0x7f')]);_0x1da245[_0x11c2('0x5d')]=qs['filters'](_[_0x11c2('0x80')](_0xa0d421['query'],_0x9ee09e[_0x11c2('0x81')]));if(_0xa0d421['query'][_0x11c2('0x82')]){_0x1da245[_0x11c2('0x5d')]=_[_0x11c2('0x36')](_0x1da245['where'],{'$or':_[_0x11c2('0x83')](_0x1da245[_0x11c2('0x7b')],function(_0x5b08ea){var _0x390f5f={};_0x390f5f[_0x5b08ea]={'$like':'%'+_0xa0d421['query'][_0x11c2('0x82')]+'%'};return _0x390f5f;})});}_0x1da245=_[_0x11c2('0x36')]({},_0x1da245,_0xa0d421[_0x11c2('0x84')]);return _0x3cadf3['getTags'](_0x1da245);}})[_0x11c2('0x1a')](function(_0x1f9cc3){if(_0x1f9cc3){_0x32de86=_0x1f9cc3[_0x11c2('0x2a')];if(!_0xa0d421[_0x11c2('0x23')][_0x11c2('0x85')](_0x11c2('0x86'))){_0x1da245['limit']=qs[_0x11c2('0x15')](_0xa0d421['query'][_0x11c2('0x15')]);_0x1da245[_0x11c2('0x13')]=qs[_0x11c2('0x13')](_0xa0d421[_0x11c2('0x23')]['offset']);}return _0x3cadf3['getTags'](_0x1da245);}})[_0x11c2('0x1a')](function(_0x475195){if(_0x475195){return _0x475195?{'count':_0x32de86,'rows':_0x475195}:null;}})['then'](respondWithResult(_0x1c8b80,null))['catch'](handleError(_0x1c8b80,null));};exports[_0x11c2('0x87')]=function(_0x3d36ea,_0x16c7ea){if(_0x3d36ea[_0x11c2('0x37')]['id']){delete _0x3d36ea[_0x11c2('0x37')]['id'];}return db[_0x11c2('0x26')]['findOne']({'where':{'id':_0x3d36ea[_0x11c2('0x28')]['id']}})[_0x11c2('0x1a')](handleEntityNotFound(_0x16c7ea,null))[_0x11c2('0x1a')](function(_0x3c1c92){if(_0x3c1c92){return _0x3c1c92[_0x11c2('0x87')](_0x3d36ea[_0x11c2('0x37')]['ids']||[]);}return null;})['then'](respondWithResult(_0x16c7ea,null))[_0x11c2('0x25')](handleError(_0x16c7ea,null));};exports[_0x11c2('0x88')]=function(_0x259a1d,_0x53c7e3){var _0x4848ca=[];_0x4848ca[_0x11c2('0x60')](addAdditionalPhones(_0x259a1d[_0x11c2('0x37')]));Promise[_0x11c2('0x89')](_0x4848ca)[_0x11c2('0x1a')](function(){_0x4848ca=[];_0x4848ca[_0x11c2('0x60')](deleteCmHopperPhones(_0x259a1d['body']['id']));_0x4848ca[_0x11c2('0x60')](addCmHopperPhones(_0x259a1d[_0x11c2('0x37')]['id']));Promise[_0x11c2('0x89')](_0x4848ca)['then'](function(){return[0x1];})[_0x11c2('0x1a')](respondWithResult(_0x53c7e3,null));});};function addAdditionalPhones(_0x1f21fa){var _0x5acb4d;return new Promise(function(_0x377e22){return db[_0x11c2('0x4a')][_0x11c2('0x1b')]({'where':{'CmContactId':_0x1f21fa['id']}})[_0x11c2('0x1a')](function(){db[_0x11c2('0x8a')][_0x11c2('0x22')]({'raw':!![],'attributes':['id',_0x11c2('0x8b')]})[_0x11c2('0x1a')](function(_0x136b27){var _0x14234e=[];for(var _0x3ce865=0x0;_0x3ce865<_0x1f21fa['items']['length'];_0x3ce865++){var _0x151de9=_0x1f21fa[_0x11c2('0x8c')]?_[_0x11c2('0x55')](_0x1f21fa[_0x11c2('0x8c')][_0x3ce865])?'':_0x1f21fa[_0x11c2('0x8c')][_0x3ce865]:_0x1f21fa['items'][_0x3ce865][_0x11c2('0x8d')]?_0x1f21fa[_0x11c2('0x8e')][_0x3ce865][_0x11c2('0x8d')]:'';var _0x11681b=_['isNil'](_0x1f21fa[_0x11c2('0x8e')][_0x3ce865][_0x11c2('0x8f')])?'':_0x1f21fa[_0x11c2('0x8e')][_0x3ce865][_0x11c2('0x8f')];var _0x1159f9=_0x151de9+':'+_0x1f21fa['items'][_0x3ce865][_0x11c2('0x74')]+'§'+_0x11681b;if(_[_0x11c2('0x55')](_0x5acb4d))_0x5acb4d=_0x1159f9;else _0x5acb4d+=';'+_0x1159f9;var _0x367345=null;var _0x46b173=null;if(_0x1f21fa[_0x11c2('0x8c')]){if(!_['isNil'](_0x1f21fa[_0x11c2('0x8c')][_0x3ce865])){_0x46b173=_[_0x11c2('0x27')](_0x136b27,function(_0x457880){return _0x457880['id']===_0x1f21fa['item_types'][_0x3ce865];});if(!_[_0x11c2('0x55')](_0x46b173)){_0x367345=_0x46b173[_0x11c2('0x8b')];}}}else{if(!_['isNil'](_0x1f21fa[_0x11c2('0x8e')][_0x3ce865])){_0x46b173=_['find'](_0x136b27,function(_0x39f85d){return _0x39f85d['id']===_0x1f21fa[_0x11c2('0x8e')][_0x3ce865][_0x11c2('0x8d')];});if(!_[_0x11c2('0x55')](_0x46b173)){_0x367345=_0x3ce865;}}}if(_[_0x11c2('0x55')](_0x367345)){_0x367345=0x64;}_0x14234e['push'](addAdditionalPhone(_0x1f21fa['id'],_0x1f21fa['items'][_0x3ce865][_0x11c2('0x74')],_0x1f21fa[_0x11c2('0x8c')]?_['isNil'](_0x1f21fa[_0x11c2('0x8c')][_0x3ce865])?null:_0x1f21fa['item_types'][_0x3ce865]:_0x1f21fa[_0x11c2('0x8e')][_0x3ce865][_0x11c2('0x8d')]?_0x1f21fa[_0x11c2('0x8e')][_0x3ce865][_0x11c2('0x8d')]:null,_0x367345,_0x11681b));}Promise[_0x11c2('0x89')](_0x14234e)['then'](function(){db[_0x11c2('0x26')][_0x11c2('0x19')]({'AdditionalPhones':_0x5acb4d},{'where':{'id':_0x1f21fa['id']}})[_0x11c2('0x1a')](function(){_0x377e22(0x1);});});});});});}function addAdditionalPhone(_0x582287,_0x572794,_0x498417,_0x553bcc,_0x1c8cc7){return db[_0x11c2('0x4a')][_0x11c2('0x27')]({'where':{'CmContactId':_0x582287,'item':_0x572794}})['then'](function(_0x5a100c){if(_0x5a100c)logger[_0x11c2('0x33')](_0x11c2('0x90'),_0x5a100c);else{db[_0x11c2('0x4a')][_0x11c2('0x41')]({'CmContactId':_0x582287,'item':_0x572794,'ItemTypeId':_0x498417,'OrderBy':_0x553bcc,'ItemClass':_0x11c2('0x91'),'description':_0x1c8cc7});}});}function deleteCmHopperPhones(_0x4a1726){return new Promise(function(_0x777c79){return db[_0x11c2('0x75')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4a1726}})[_0x11c2('0x1a')](function(_0x50bb79){db[_0x11c2('0x92')][_0x11c2('0x1b')]({'where':{'CmHopperId':{'$in':_[_0x11c2('0x83')](_0x50bb79,'id')}}});})[_0x11c2('0x1a')](function(){_0x777c79(0x1);});});}function addCmHopperPhones(_0x390a52){return new Promise(function(_0x37b9cb){return db['CmHopper'][_0x11c2('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x390a52}})[_0x11c2('0x1a')](function(_0x2c2215){var _0x286690=[];_[_0x11c2('0x83')](_0x2c2215,function(_0x3e4c42){_0x286690[_0x11c2('0x60')](createCmHopperPhone(_0x390a52,_0x3e4c42['id']));});Promise[_0x11c2('0x89')](_0x286690)[_0x11c2('0x1a')](function(){_0x37b9cb(0x1);});});});}function createCmHopperPhone(_0x3f835e,_0x56506f){return new Promise(function(_0x19a946){db[_0x11c2('0x4a')][_0x11c2('0x22')]({'raw':!![],'attributes':['item',_0x11c2('0x8b')],'where':{'CmContactId':_0x3f835e,'ItemClass':_0x11c2('0x91')},'include':[{'model':db['ContactItemType'],'attributes':[_0x11c2('0x8b')],'as':'ItemType'}],'order':[_0x11c2('0x8b'),db['sequelize'][_0x11c2('0x66')](_0x11c2('0x93'))]})['then'](function(_0x2d3113){var _0x357027=0x1;var _0x296553=_[_0x11c2('0x83')](_0x2d3113,function(_0x24cf51){_0x24cf51[_0x11c2('0x94')]=_0x56506f;_0x24cf51['phone']=_0x24cf51['item'];_0x24cf51[_0x11c2('0x8b')]=_0x357027;delete _0x24cf51[_0x11c2('0x95')];_0x357027=_0x357027+0x1;return _0x24cf51;});return db['CmHopperAdditionalPhone'][_0x11c2('0x5a')](_0x296553,{});})[_0x11c2('0x1a')](function(){_0x19a946(0x1);});});}function insertAdditionalPhones(_0x36d7c1,_0x5160f0){return new Promise(function(_0x88f755){var _0x20739a=[];for(var _0x2cd16b=0x0;_0x2cd16b<_0x5160f0['length'];_0x2cd16b++){var _0x27a850=_0x5160f0[_0x2cd16b];_0x20739a[_0x11c2('0x60')](parseContactItemType(_0x27a850));}Promise[_0x11c2('0x89')](_0x20739a)[_0x11c2('0x1a')](function(){var _0x1539b4={'id':_0x36d7c1['id'],'items':_0x5160f0};return addAdditionalPhones(_0x1539b4)[_0x11c2('0x1a')](function(){return addCmHopperPhones(_0x36d7c1['id']);});})['then'](function(){_0x88f755(_0x36d7c1);});});}function parseContactItemType(_0x789275){return new Promise(function(_0x45c03b){if(_0x789275[_0x11c2('0x85')](_0x11c2('0x8d'))){_0x45c03b(_0x789275);}else{return db['ContactItemType']['find']({'where':{'name':_0x789275['ItemType']}})[_0x11c2('0x1a')](function(_0x37cbd2){if(_[_0x11c2('0x55')](_0x37cbd2))_0x789275[_0x11c2('0x8d')]=null;else _0x789275[_0x11c2('0x8d')]=_0x37cbd2['id'];_0x45c03b(_0x789275);});}});}exports['getAdditionalPhones']=function(_0x179a8f,_0x390896){return db[_0x11c2('0x4a')][_0x11c2('0x22')]({'raw':!![],'where':{'CmContactId':_0x179a8f['params']['id'],'ItemClass':_0x11c2('0x91')},'include':[{'model':db[_0x11c2('0x8a')],'as':'ItemType'}],'order':[[_0x11c2('0x8b')],[db[_0x11c2('0x72')][_0x11c2('0x66')](_0x11c2('0x93'))]]})[_0x11c2('0x1a')](function(_0x53271a){return _0x53271a;})['then'](respondWithResult(_0x390896,null))[_0x11c2('0x25')](handleError(_0x390896,null));};exports['duplicateAdditionalPhones']=function(_0x2aac2d,_0xb88431){return db[_0x11c2('0x4a')][_0x11c2('0x22')]({'raw':!![],'where':{'CmContactId':_0x2aac2d['body'][_0x11c2('0x96')]}})['then'](function(_0x2319fb){var _0x50e38e=_['map'](_0x2319fb,function(_0x3f161f){_0x3f161f[_0x11c2('0x97')]=_0x2aac2d[_0x11c2('0x37')][_0x11c2('0x98')];return _0x3f161f;});return db[_0x11c2('0x4a')][_0x11c2('0x5a')](_0x50e38e,{});})[_0x11c2('0x1a')](function(){return addCmHopperPhones(_0x2aac2d[_0x11c2('0x37')]['toContactId']);})['then'](function(){return['ok'];})[_0x11c2('0x1a')](respondWithResult(_0xb88431,null))[_0x11c2('0x25')](handleError(_0xb88431,null));};exports[_0x11c2('0x99')]=function(_0x169db5,_0x53ba1e){var _0x1f0197=[];_0x1f0197[_0x11c2('0x60')](createCmHopperPhone(_0x169db5[_0x11c2('0x37')]['id'],_0x169db5[_0x11c2('0x37')][_0x11c2('0x9a')]));Promise[_0x11c2('0x89')](_0x1f0197)[_0x11c2('0x1a')](function(){return[0x1];})[_0x11c2('0x1a')](respondWithResult(_0x53ba1e,null));};exports[_0x11c2('0x9b')]=function(_0x141d63,_0x427048){var _0x46cf61={'raw':![],'where':{}};var _0x2edb95={};var _0x4b62b9={'count':0x0,'rows':[]};return db['CmContact'][_0x11c2('0x77')]({'where':{'id':_0x141d63['params']['id']}})[_0x11c2('0x1a')](handleEntityNotFound(_0x427048,null))[_0x11c2('0x1a')](function(_0x3639dc){if(_0x3639dc){_0x2edb95[_0x11c2('0x78')]=_[_0x11c2('0x29')](db[_0x11c2('0x75')][_0x11c2('0x7a')]);_0x2edb95[_0x11c2('0x23')]=_[_0x11c2('0x29')](_0x141d63['query']);_0x2edb95[_0x11c2('0x81')]=_[_0x11c2('0x7c')](_0x2edb95[_0x11c2('0x78')],_0x2edb95[_0x11c2('0x23')]);_0x46cf61['attributes']=_[_0x11c2('0x7c')](_0x2edb95[_0x11c2('0x78')],qs[_0x11c2('0x7d')](_0x141d63[_0x11c2('0x23')][_0x11c2('0x7d')]));_0x46cf61[_0x11c2('0x7b')]=_0x46cf61[_0x11c2('0x7b')][_0x11c2('0x2a')]?_0x46cf61['attributes']:_0x2edb95[_0x11c2('0x78')];if(!_0x141d63[_0x11c2('0x23')][_0x11c2('0x85')](_0x11c2('0x86'))){_0x46cf61[_0x11c2('0x15')]=qs['limit'](_0x141d63['query'][_0x11c2('0x15')]);_0x46cf61['offset']=qs[_0x11c2('0x13')](_0x141d63[_0x11c2('0x23')][_0x11c2('0x13')]);}_0x46cf61[_0x11c2('0x7e')]=qs[_0x11c2('0x7f')](_0x141d63['query'][_0x11c2('0x7f')]);_0x46cf61[_0x11c2('0x5d')]=qs[_0x11c2('0x81')](_[_0x11c2('0x80')](_0x141d63[_0x11c2('0x23')],_0x2edb95['filters']));_0x46cf61[_0x11c2('0x5d')][_0x11c2('0x9c')]=_0x3639dc['id'];if(_0x141d63[_0x11c2('0x23')][_0x11c2('0x82')]){_0x46cf61[_0x11c2('0x5d')]=_[_0x11c2('0x36')](_0x46cf61[_0x11c2('0x5d')],{'$or':_[_0x11c2('0x83')](_0x46cf61['attributes'],function(_0x187e72){var _0x5dde6a={};_0x5dde6a[_0x187e72]={'$like':'%'+_0x141d63[_0x11c2('0x23')][_0x11c2('0x82')]+'%'};return _0x5dde6a;})});}_0x46cf61=_[_0x11c2('0x36')]({},_0x46cf61,_0x141d63['options']);return db[_0x11c2('0x75')][_0x11c2('0x16')]({'where':_0x46cf61[_0x11c2('0x5d')]})['then'](function(_0x59f5bf){_0x4b62b9['count']=_0x59f5bf;if(_0x141d63[_0x11c2('0x23')][_0x11c2('0x9d')]){_0x46cf61[_0x11c2('0x9e')]=[{'all':!![]}];}return db[_0x11c2('0x75')][_0x11c2('0x22')](_0x46cf61);})[_0x11c2('0x1a')](function(_0x1a6281){_0x4b62b9[_0x11c2('0x9f')]=_0x1a6281;return _0x4b62b9;});}})[_0x11c2('0x1a')](respondWithFilteredResult(_0x427048,_0x46cf61))[_0x11c2('0x25')](handleError(_0x427048,null));};exports['getHopperHistories']=function(_0x2ad3cb,_0x13dcd7){var _0x2ee113={'raw':!![],'where':{}};var _0x2ec4a6={};var _0x19fb6e={'count':0x0,'rows':[]};return db['CmContact'][_0x11c2('0x77')]({'where':{'id':_0x2ad3cb[_0x11c2('0x28')]['id']}})['then'](handleEntityNotFound(_0x13dcd7,null))[_0x11c2('0x1a')](function(_0x58eed6){if(_0x58eed6){_0x2ec4a6[_0x11c2('0x78')]=_[_0x11c2('0x29')](db['CmHopperHistory'][_0x11c2('0x7a')]);_0x2ec4a6[_0x11c2('0x23')]=_[_0x11c2('0x29')](_0x2ad3cb['query']);_0x2ec4a6[_0x11c2('0x81')]=_[_0x11c2('0x7c')](_0x2ec4a6[_0x11c2('0x78')],_0x2ec4a6['query']);_0x2ee113[_0x11c2('0x7b')]=_[_0x11c2('0x7c')](_0x2ec4a6[_0x11c2('0x78')],qs[_0x11c2('0x7d')](_0x2ad3cb['query'][_0x11c2('0x7d')]));_0x2ee113[_0x11c2('0x7b')]=_0x2ee113[_0x11c2('0x7b')]['length']?_0x2ee113[_0x11c2('0x7b')]:_0x2ec4a6[_0x11c2('0x78')];if(!_0x2ad3cb[_0x11c2('0x23')][_0x11c2('0x85')](_0x11c2('0x86'))){_0x2ee113[_0x11c2('0x15')]=qs[_0x11c2('0x15')](_0x2ad3cb['query'][_0x11c2('0x15')]);_0x2ee113['offset']=qs[_0x11c2('0x13')](_0x2ad3cb['query'][_0x11c2('0x13')]);}_0x2ee113[_0x11c2('0x7e')]=qs['sort'](_0x2ad3cb[_0x11c2('0x23')]['sort']);_0x2ee113[_0x11c2('0x5d')]=qs[_0x11c2('0x81')](_[_0x11c2('0x80')](_0x2ad3cb[_0x11c2('0x23')],_0x2ec4a6[_0x11c2('0x81')]));_0x2ee113[_0x11c2('0x5d')][_0x11c2('0x9c')]=_0x58eed6['id'];if(_0x2ad3cb['query']['filter']){_0x2ee113[_0x11c2('0x5d')]=_['merge'](_0x2ee113[_0x11c2('0x5d')],{'$or':_[_0x11c2('0x83')](_0x2ee113[_0x11c2('0x7b')],function(_0x1e8cd4){var _0x371c87={};_0x371c87[_0x1e8cd4]={'$like':'%'+_0x2ad3cb[_0x11c2('0x23')][_0x11c2('0x82')]+'%'};return _0x371c87;})});}_0x2ee113=_[_0x11c2('0x36')]({},_0x2ee113,_0x2ad3cb[_0x11c2('0x84')]);return db[_0x11c2('0x4c')][_0x11c2('0x16')]({'where':_0x2ee113[_0x11c2('0x5d')]})[_0x11c2('0x1a')](function(_0x384e1c){_0x19fb6e[_0x11c2('0x16')]=_0x384e1c;if(_0x2ad3cb['query'][_0x11c2('0x9d')]){_0x2ee113[_0x11c2('0x9e')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x11c2('0x22')](_0x2ee113);})['then'](function(_0x5d9b1a){_0x19fb6e[_0x11c2('0x9f')]=_0x5d9b1a;return _0x19fb6e;});}})[_0x11c2('0x1a')](respondWithFilteredResult(_0x13dcd7,_0x2ee113))[_0x11c2('0x25')](handleError(_0x13dcd7,null));};exports[_0x11c2('0xa0')]=function(_0x3a2012,_0x4c367d){var _0x4dfc7f={'raw':!![],'where':{}};var _0x56834e={};var _0x4feeab={'count':0x0,'rows':[]};return db[_0x11c2('0x26')][_0x11c2('0x77')]({'where':{'id':_0x3a2012[_0x11c2('0x28')]['id']}})[_0x11c2('0x1a')](handleEntityNotFound(_0x4c367d,null))[_0x11c2('0x1a')](function(_0x83b0d0){if(_0x83b0d0){_0x56834e[_0x11c2('0x78')]=_[_0x11c2('0x29')](db[_0x11c2('0x4b')]['rawAttributes']);_0x56834e['query']=_[_0x11c2('0x29')](_0x3a2012[_0x11c2('0x23')]);_0x56834e[_0x11c2('0x81')]=_['intersection'](_0x56834e[_0x11c2('0x78')],_0x56834e[_0x11c2('0x23')]);_0x4dfc7f[_0x11c2('0x7b')]=_[_0x11c2('0x7c')](_0x56834e['model'],qs[_0x11c2('0x7d')](_0x3a2012[_0x11c2('0x23')][_0x11c2('0x7d')]));_0x4dfc7f[_0x11c2('0x7b')]=_0x4dfc7f[_0x11c2('0x7b')][_0x11c2('0x2a')]?_0x4dfc7f[_0x11c2('0x7b')]:_0x56834e[_0x11c2('0x78')];if(!_0x3a2012['query'][_0x11c2('0x85')](_0x11c2('0x86'))){_0x4dfc7f['limit']=qs[_0x11c2('0x15')](_0x3a2012[_0x11c2('0x23')][_0x11c2('0x15')]);_0x4dfc7f['offset']=qs[_0x11c2('0x13')](_0x3a2012[_0x11c2('0x23')][_0x11c2('0x13')]);}_0x4dfc7f[_0x11c2('0x7e')]=qs[_0x11c2('0x7f')](_0x3a2012[_0x11c2('0x23')][_0x11c2('0x7f')]);_0x4dfc7f[_0x11c2('0x5d')]=qs[_0x11c2('0x81')](_[_0x11c2('0x80')](_0x3a2012[_0x11c2('0x23')],_0x56834e[_0x11c2('0x81')]));_0x4dfc7f[_0x11c2('0x5d')][_0x11c2('0x9c')]=_0x83b0d0['id'];if(_0x3a2012[_0x11c2('0x23')]['filter']){_0x4dfc7f[_0x11c2('0x5d')]=_['merge'](_0x4dfc7f[_0x11c2('0x5d')],{'$or':_[_0x11c2('0x83')](_0x4dfc7f[_0x11c2('0x7b')],function(_0x17d042){var _0x2046a4={};_0x2046a4[_0x17d042]={'$like':'%'+_0x3a2012[_0x11c2('0x23')][_0x11c2('0x82')]+'%'};return _0x2046a4;})});}_0x4dfc7f=_['merge']({},_0x4dfc7f,_0x3a2012[_0x11c2('0x84')]);return db[_0x11c2('0x4b')][_0x11c2('0x16')]({'where':_0x4dfc7f['where']})[_0x11c2('0x1a')](function(_0x898f49){_0x4feeab['count']=_0x898f49;if(_0x3a2012[_0x11c2('0x23')][_0x11c2('0x9d')]){_0x4dfc7f[_0x11c2('0x9e')]=[{'all':!![]}];}return db[_0x11c2('0x4b')]['findAll'](_0x4dfc7f);})[_0x11c2('0x1a')](function(_0x124845){_0x4feeab[_0x11c2('0x9f')]=_0x124845;return _0x4feeab;});}})[_0x11c2('0x1a')](respondWithFilteredResult(_0x4c367d,_0x4dfc7f))[_0x11c2('0x25')](handleError(_0x4c367d,null));};exports[_0x11c2('0xa1')]=function(_0x490197,_0x3de60f){var _0x556fa5={'raw':!![],'where':{}};var _0x1ffe2a={};var _0x91d40f={'count':0x0,'rows':[]};return db['CmContact'][_0x11c2('0x77')]({'where':{'id':_0x490197['params']['id']}})[_0x11c2('0x1a')](handleEntityNotFound(_0x3de60f,null))[_0x11c2('0x1a')](function(_0x55f17a){if(_0x55f17a){_0x1ffe2a[_0x11c2('0x78')]=_[_0x11c2('0x29')](db[_0x11c2('0xa2')][_0x11c2('0x7a')]);_0x1ffe2a[_0x11c2('0x23')]=_[_0x11c2('0x29')](_0x490197[_0x11c2('0x23')]);_0x1ffe2a[_0x11c2('0x81')]=_['intersection'](_0x1ffe2a[_0x11c2('0x78')],_0x1ffe2a[_0x11c2('0x23')]);_0x556fa5['attributes']=_[_0x11c2('0x7c')](_0x1ffe2a['model'],qs[_0x11c2('0x7d')](_0x490197['query'][_0x11c2('0x7d')]));_0x556fa5['attributes']=_0x556fa5[_0x11c2('0x7b')]['length']?_0x556fa5['attributes']:_0x1ffe2a[_0x11c2('0x78')];if(!_0x490197[_0x11c2('0x23')][_0x11c2('0x85')](_0x11c2('0x86'))){_0x556fa5[_0x11c2('0x15')]=qs[_0x11c2('0x15')](_0x490197[_0x11c2('0x23')][_0x11c2('0x15')]);_0x556fa5[_0x11c2('0x13')]=qs['offset'](_0x490197[_0x11c2('0x23')][_0x11c2('0x13')]);}_0x556fa5[_0x11c2('0x7e')]=qs['sort'](_0x490197[_0x11c2('0x23')][_0x11c2('0x7f')]);_0x556fa5[_0x11c2('0x5d')]=qs[_0x11c2('0x81')](_[_0x11c2('0x80')](_0x490197[_0x11c2('0x23')],_0x1ffe2a[_0x11c2('0x81')]));_0x556fa5[_0x11c2('0x5d')][_0x11c2('0x9c')]=_0x55f17a['id'];if(_0x490197[_0x11c2('0x23')][_0x11c2('0x82')]){_0x556fa5['where']=_[_0x11c2('0x36')](_0x556fa5[_0x11c2('0x5d')],{'$or':_['map'](_0x556fa5['attributes'],function(_0x17c980){var _0x1de9d0={};_0x1de9d0[_0x17c980]={'$like':'%'+_0x490197[_0x11c2('0x23')][_0x11c2('0x82')]+'%'};return _0x1de9d0;})});}_0x556fa5=_[_0x11c2('0x36')]({},_0x556fa5,_0x490197[_0x11c2('0x84')]);return db['JscriptySessionReport'][_0x11c2('0x16')]({'where':_0x556fa5[_0x11c2('0x5d')]})[_0x11c2('0x1a')](function(_0x3504bf){_0x91d40f['count']=_0x3504bf;if(_0x490197[_0x11c2('0x23')]['includeAll']){_0x556fa5[_0x11c2('0x9e')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x556fa5);})[_0x11c2('0x1a')](function(_0x43ff48){_0x91d40f['rows']=_0x43ff48;return _0x91d40f;});}})[_0x11c2('0x1a')](respondWithFilteredResult(_0x3de60f,_0x556fa5))[_0x11c2('0x25')](handleError(_0x3de60f,null));};exports[_0x11c2('0xa3')]=function(_0x1f2acd,_0x428bf0){try{if(!_0x1f2acd[_0x11c2('0x37')][_0x11c2('0x5f')]){throw new Error(_0x11c2('0xa4'));}if(!_0x1f2acd['body'][_0x11c2('0xa5')]){throw new Error(_0x11c2('0xa6'));}if(!_0x1f2acd['body'][_0x11c2('0xa7')]){throw new Error(_0x11c2('0xa8'));}if(!_0x1f2acd['body'][_0x11c2('0xa9')]){throw new Error(_0x11c2('0xaa'));}var _0x15114f=_0x1f2acd['body'][_0x11c2('0xa5')][_0x11c2('0xab')](',');var _0x509620=_0x1f2acd['body'][_0x11c2('0xa7')][_0x11c2('0xab')](',');if(!_0x15114f[_0x11c2('0x2a')]||!_0x509620['length']||_0x15114f[_0x11c2('0x2a')]!==_0x509620['length']){throw new Error(_0x11c2('0xac'));}_0x1f2acd['body']['fields']=_[_0x11c2('0xad')](_0x15114f,_0x509620);if(!_0x1f2acd[_0x11c2('0x37')][_0x11c2('0x7d')][_0x11c2('0x74')]){throw new Error(_0x11c2('0xae'));}if(!_0x1f2acd[_0x11c2('0x37')][_0x11c2('0x7d')][_0x11c2('0xaf')]){throw new Error(_0x11c2('0xb0'));}var _0x422893=path[_0x11c2('0xb1')](config['root'],_0x11c2('0xb2'),_0x1f2acd[_0x11c2('0xb3')][_0x11c2('0xb4')]);fs['chmodSync'](_0x422893,parseInt(_0x11c2('0xb5'),0x8));var _0x39d968=require(_0x11c2('0xb6'))[_0x11c2('0xb7')](path[_0x11c2('0xb1')](__dirname,_0x11c2('0xb8')),[_0x422893,_0x1f2acd[_0x11c2('0x37')][_0x11c2('0xa5')],_0x1f2acd[_0x11c2('0x37')][_0x11c2('0xa7')],_0x1f2acd[_0x11c2('0x37')][_0x11c2('0x5f')],_0x1f2acd[_0x11c2('0x37')][_0x11c2('0xb9')],_0x1f2acd[_0x11c2('0x37')][_0x11c2('0x5c')],_0x1f2acd[_0x11c2('0x37')]['socket_timestamp']]);return _0x428bf0[_0x11c2('0x11')](0xc8)[_0x11c2('0x12')]({'message':'File\x20uploaded\x20correctly!','pid':_0x39d968[_0x11c2('0xba')]});}catch(_0x2c8a23){return _0x428bf0['status'](0x1f4)[_0x11c2('0x1f')](_0x2c8a23);}};exports[_0x11c2('0xbb')]=function(_0x456080,_0x8153d6){var _0x501c60=fs['createReadStream'](_0x456080[_0x11c2('0xb3')][_0x11c2('0x2')]);Papa[_0x11c2('0xbc')](_0x501c60,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x54fe8b){return _0x8153d6[_0x11c2('0x11')](0xc8)[_0x11c2('0x12')]({'file':_0x456080[_0x11c2('0xb3')],'fields':_0x54fe8b[_0x11c2('0xbd')]['fields']});}});};exports['import']=function(_0x27d242,_0xbfbd00){return db[_0x11c2('0xbe')][_0x11c2('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x11c2('0xbf')}})['then'](function(_0x17cc02){var _0x496eb8=![];if(!_0x27d242[_0x11c2('0x37')][_0x11c2('0x5f')]){throw new Error(_0x11c2('0xa4'));}if(!_0x27d242['body'][_0x11c2('0xc0')][_0x11c2('0x74')]){throw new Error(_0x11c2('0xae'));}if(!_0x27d242['body'][_0x11c2('0xc0')][_0x11c2('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x27d242[_0x11c2('0x37')][_0x11c2('0xa9')]){throw new Error(_0x11c2('0xaa'));}var _0x499f3d=require('child_process')[_0x11c2('0xb7')](path[_0x11c2('0xb1')](__dirname,_0x11c2('0xc1')),[_0x27d242[_0x11c2('0x28')]['id'],JSON[_0x11c2('0xc2')](_0x27d242['body']),JSON[_0x11c2('0xc2')](_0x17cc02)]);_0x499f3d['on'](_0x11c2('0xc3'),function(){_0x496eb8=!![];return _0xbfbd00[_0x11c2('0x11')](0xc8)[_0x11c2('0x12')]({'message':_0x11c2('0xc4'),'pid':_0x499f3d[_0x11c2('0xba')]});});_0x499f3d['on'](_0x11c2('0xc5'),function(_0x2a0650){if(_0x2a0650&&!_0x496eb8){return _0xbfbd00[_0x11c2('0x11')](0x1f4)[_0x11c2('0x12')]({'message':_0x11c2('0xc6'),'pid':_0x499f3d[_0x11c2('0xba')]});}});})['catch'](handleError(_0xbfbd00,null));};exports[_0x11c2('0xc7')]=function(_0x3720fa,_0xe98fe0){return db[_0x11c2('0xbe')][_0x11c2('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x11c2('0x1a')](function(_0x936dd9){var _0x4f996b=![];if(!_0x3720fa[_0x11c2('0x37')][_0x11c2('0x5f')]){throw new Error(_0x11c2('0xa4'));}if(!_0x3720fa[_0x11c2('0x37')][_0x11c2('0xc0')][_0x11c2('0x74')]){throw new Error(_0x11c2('0xae'));}if(!_0x3720fa[_0x11c2('0x37')][_0x11c2('0xc0')][_0x11c2('0xaf')]){throw new Error(_0x11c2('0xb0'));}if(!_0x3720fa[_0x11c2('0x37')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x4472ff=require(_0x11c2('0xb6'))[_0x11c2('0xb7')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x3720fa[_0x11c2('0x28')]['id'],JSON[_0x11c2('0xc2')](_0x3720fa[_0x11c2('0x37')]),JSON[_0x11c2('0xc2')](_0x936dd9)]);_0x4472ff['on'](_0x11c2('0xc3'),function(){_0x4f996b=!![];return _0xe98fe0[_0x11c2('0x11')](0xc8)[_0x11c2('0x12')]({'message':_0x11c2('0xc4'),'pid':_0x4472ff[_0x11c2('0xba')]});});_0x4472ff['on']('exit',function(_0x2922c3){if(_0x2922c3&&!_0x4f996b){return _0xe98fe0[_0x11c2('0x11')](0x1f4)[_0x11c2('0x12')]({'message':_0x11c2('0xc6'),'pid':_0x4472ff[_0x11c2('0xba')]});}});})[_0x11c2('0x25')](handleError(_0xe98fe0,null));};exports[_0x11c2('0xc8')]=function(_0x41b7d2,_0x3814e0){var _0x43ae2e=[_0x11c2('0xc9'),_0x11c2('0xca'),_0x11c2('0xcb'),_0x11c2('0xcc'),'fax',_0x11c2('0xcd'),_0x11c2('0xce')];var _0x3b5aee={'offset':0x0,'order':qs['sort'](_0x11c2('0xcf'))},_0x46ceda={'count':0x0,'rows':[]};Promise[_0x11c2('0xd0')]()[_0x11c2('0x1a')](function(){if(_0x41b7d2[_0x11c2('0x23')][_0x11c2('0xd1')]){if(!_[_0x11c2('0xd2')](_0x43ae2e,_0x41b7d2[_0x11c2('0x23')][_0x11c2('0xd1')][_0x11c2('0xd3')]())){throw new Error(_0x11c2('0xd4'));}_0x43ae2e=[_0x41b7d2['query']['channel'][_0x11c2('0xd3')]()];}if(_0x41b7d2[_0x11c2('0x23')][_0x11c2('0xd5')]){try{var _0x154d33=JSON[_0x11c2('0xbc')](_0x41b7d2[_0x11c2('0x23')][_0x11c2('0xd5')]);if(!moment(_0x154d33[_0x11c2('0x3d')])[_0x11c2('0xd6')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x154d33['to'])[_0x11c2('0xd6')]()){throw new Error(_0x11c2('0xd7'));}}catch(_0x1016f6){throw new Error(_0x11c2('0xd8'));}}if(!_0x41b7d2['query'][_0x11c2('0x85')](_0x11c2('0x86'))){_0x3b5aee[_0x11c2('0x15')]=qs[_0x11c2('0x15')](_0x41b7d2['query'][_0x11c2('0x15')]||0xa);_0x3b5aee[_0x11c2('0x13')]=qs[_0x11c2('0x13')](_0x41b7d2[_0x11c2('0x23')][_0x11c2('0x13')]);}var _0x18a38c=_0x43ae2e[_0x11c2('0x83')](function(_0x1dbc5c){if(_0x1dbc5c===_0x11c2('0xce')){var _0xd63a8d={'attributes':['id',_0x11c2('0xd9'),_0x11c2('0x31'),_0x11c2('0xda'),_0x11c2('0xdb'),'callerid',_0x11c2('0xdc'),_0x11c2('0xdd'),_0x11c2('0xde'),_0x11c2('0xdf'),_0x11c2('0xe0'),'userDisposition','userSecondDisposition','userThirdDisposition',_0x11c2('0xe1')],'where':{'ContactId':_0x41b7d2[_0x11c2('0x28')]['id']},'include':[{'model':db[_0x11c2('0xbe')],'as':_0x11c2('0xbe'),'attributes':['id',_0x11c2('0x1e'),_0x11c2('0xe2'),'alias']}],'order':[[_0x11c2('0xe0'),_0x11c2('0xe3')]]};if(_0x41b7d2[_0x11c2('0x23')][_0x11c2('0xd5')]){_0xd63a8d[_0x11c2('0x5d')][_0x11c2('0xe0')]={'$gte':_0x154d33[_0x11c2('0x3d')],'$lte':_0x154d33['to']};}return db['VoiceCallReport'][_0x11c2('0xe4')](_0xd63a8d)[_0x11c2('0x1a')](function(_0x34e4bf){_0x46ceda[_0x11c2('0x16')]+=_0x34e4bf['count'];return _[_0x11c2('0x83')](_0x34e4bf[_0x11c2('0x9f')],function(_0x517894){var _0xc1b035=_0x517894['get']({'plain':!![]});_0xc1b035[_0x11c2('0xd1')]=_0x1dbc5c;if(_0xc1b035['User']){_0xc1b035[_0x11c2('0xbe')]={'id':_0xc1b035[_0x11c2('0xbe')]['id'],'name':_0xc1b035[_0x11c2('0xbe')]['name'],'fullname':_0xc1b035[_0x11c2('0xbe')]['fullname'],'alias':_0xc1b035[_0x11c2('0xbe')][_0x11c2('0xe5')]};}return _0xc1b035;});});}else{var _0x21f10c=_['startCase'](_0x1dbc5c)+(_0x1dbc5c===_0x11c2('0xca')?_0x11c2('0xe6'):'Account');var _0x2352a3={'attributes':['id',_0x11c2('0xe7'),_0x11c2('0xe8'),_0x11c2('0xe0'),_0x11c2('0xdf'),_0x11c2('0xe9'),'secondDisposition',_0x11c2('0xea'),_0x11c2('0xe1'),_0x21f10c+'Id'],'where':{'ContactId':_0x41b7d2[_0x11c2('0x28')]['id']},'include':[{'model':db[_0x21f10c],'as':_0x11c2('0xeb'),'attributes':['id',_0x11c2('0x1e'),'key']},{'model':db[_0x11c2('0xbe')],'as':_0x11c2('0xec'),'attributes':['id',_0x11c2('0x1e'),_0x11c2('0xe2')]},{'model':db[_0x11c2('0x79')],'as':_0x11c2('0xed'),'attributes':['id',_0x11c2('0x1e'),'color'],'through':{'attributes':[]}}],'order':[[_0x11c2('0xe0'),_0x11c2('0xe3')]]};if(_0x41b7d2[_0x11c2('0x23')][_0x11c2('0xd5')]){_0x2352a3[_0x11c2('0x5d')][_0x11c2('0xe0')]={'$gte':_0x154d33['from'],'$lte':_0x154d33['to']};}switch(_0x1dbc5c){case _0x11c2('0xca'):_0x2352a3[_0x11c2('0x7b')][_0x11c2('0x60')](_0x11c2('0xee'),'customerIp','customerPort',_0x11c2('0xef'),_0x11c2('0xf0'),_0x11c2('0xf1'),_0x11c2('0xf2'),'ratingValue',_0x11c2('0xf3'));break;case'mail':_0x2352a3[_0x11c2('0x7b')][_0x11c2('0x60')](_0x11c2('0xf4'),'substatus');break;case _0x11c2('0xcc'):_0x2352a3[_0x11c2('0x7b')][_0x11c2('0x60')](_0x11c2('0xf5'),_0x11c2('0xf6'));break;}return db[_['startCase'](_0x1dbc5c)+_0x11c2('0xf7')][_0x11c2('0xe4')](_0x2352a3)[_0x11c2('0x1a')](function(_0x374776){_0x46ceda[_0x11c2('0x16')]+=_0x374776['count'];return _[_0x11c2('0x83')](_0x374776[_0x11c2('0x9f')],function(_0x5aa15b){var _0x2345ce=_0x5aa15b[_0x11c2('0x38')]({'plain':!![]});_0x2345ce[_0x11c2('0xd1')]=_0x1dbc5c;if(_0x2345ce[_0x11c2('0xec')]){_0x2345ce[_0x11c2('0xec')]={'id':_0x2345ce[_0x11c2('0xec')]['id'],'name':_0x2345ce[_0x11c2('0xec')][_0x11c2('0x1e')],'fullname':_0x2345ce[_0x11c2('0xec')][_0x11c2('0xe2')]};}return _0x2345ce;});});}});return Promise[_0x11c2('0x89')](_0x18a38c);})[_0x11c2('0x1a')](function(_0x474eda){return _(_0x474eda)['flatten']()[_0x11c2('0xf8')](_0x11c2('0xe0'))[_0x11c2('0xf9')]()[_0x11c2('0xfa')]();})[_0x11c2('0x1a')](function(_0x3cfcfd){_0x46ceda[_0x11c2('0x9f')]=_0x3b5aee[_0x11c2('0x15')]?_0x3cfcfd['slice'](_0x3b5aee[_0x11c2('0x13')],_0x3b5aee[_0x11c2('0x13')]+_0x3b5aee['limit']):_0x3cfcfd;return _0x46ceda;})[_0x11c2('0x1a')](respondWithFilteredResult(_0x3814e0,_0x3b5aee))[_0x11c2('0x25')](handleError(_0x3814e0,null));}; \ No newline at end of file +var _0xfa54=['findOrCreate','contact','all','Tag','Tags','color','tag','CmContactHasItem','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','find','isEmpty','cm_contacts','setFields','text','phone','getTags','findOne','rawAttributes','filters','model','attributes','intersection','fields','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','getHoppers','order','ContactId','includeAll','include','rows','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','json','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','binding','No\x20phone\x20column\x20specified','stringify','message','start\x20child\x20process\x20correctly!','exit','importUpdates','User','agent','../../components/import/cm/csvUpdates','error\x20child\x20process','getJourney','mail','chat','sms','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','range','isValid','uniqueid','destination','callerid','starttime','endtime','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','DESC','VoiceCallReport','fullname','Website','Account','closedAt','disposition','Owner','browserName','customerIp','customerPort','deviceModel','ratingType','ratingValue','subject','substatus','threadId','startCase','Interaction','findAndCountAll','flatten','reverse','value','slice','moment','util','path','squel','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','offset','limit','undefined','count','set','update','then','destroy','name','send','index','findAll','query','user','catch','CmContact','params','describe','tags','keys','length','startsWith','cf_','columnName','displayName','CmCustomField','alias','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','create','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','push','ListId'];(function(_0x5e7eec,_0x24ce86){var _0x25cc20=function(_0x1bc32a){while(--_0x1bc32a){_0x5e7eec['push'](_0x5e7eec['shift']());}};_0x25cc20(++_0x24ce86);}(_0xfa54,0x188));var _0x4fa5=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xfa54[_0x3e5086];return _0xfeb102;};'use strict';var moment=require(_0x4fa5('0x0'));var BPromise=require('bluebird');var util=require(_0x4fa5('0x1'));var path=require(_0x4fa5('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4fa5('0x3'));var Papa=require(_0x4fa5('0x4'));var Redis=require(_0x4fa5('0x5'));var contacts=require('../../components/contacts');var qs=require(_0x4fa5('0x6'));var logger=require('../../config/logger')(_0x4fa5('0x7'));var config=require('../../config/environment');var shared=require(_0x4fa5('0x8'));var db=require(_0x4fa5('0x9'))['db'];config['redis']=_['defaults'](config[_0x4fa5('0xa')],{'host':_0x4fa5('0xb'),'port':0x18eb});var socket=require(_0x4fa5('0xc'))(new Redis(config[_0x4fa5('0xa')]));require(_0x4fa5('0xd'))[_0x4fa5('0xe')](socket);function respondWithResult(_0x1f9d97,_0x8b73ec){_0x8b73ec=_0x8b73ec||0xc8;return function(_0x622670){if(_0x622670){return _0x1f9d97[_0x4fa5('0xf')](_0x8b73ec)['json'](_0x622670);}};}function respondWithFilteredResult(_0x7d6365,_0xc47a88){return function(_0x59b571){if(_0x59b571){var _0xf4262b=typeof _0xc47a88[_0x4fa5('0x10')]==='undefined'&&typeof _0xc47a88[_0x4fa5('0x11')]===_0x4fa5('0x12');var _0x590ae6=_0x59b571[_0x4fa5('0x13')];var _0x12f0bc=_0xf4262b?0x0:_0xc47a88[_0x4fa5('0x10')];var _0x5a751c=_0xf4262b?_0x59b571['count']:_0xc47a88[_0x4fa5('0x10')]+_0xc47a88[_0x4fa5('0x11')];var _0x50d24e;if(_0x5a751c>=_0x590ae6){_0x5a751c=_0x590ae6;_0x50d24e=0xc8;}else{_0x50d24e=0xce;}_0x7d6365[_0x4fa5('0xf')](_0x50d24e);return _0x7d6365[_0x4fa5('0x14')]('Content-Range',_0x12f0bc+'-'+_0x5a751c+'/'+_0x590ae6)['json'](_0x59b571);}return null;};}function saveUpdates(_0x415097){return function(_0x21575d){if(_0x21575d){return _0x21575d[_0x4fa5('0x15')](_0x415097)[_0x4fa5('0x16')](function(_0x4cf7fd){return _0x4cf7fd;});}return null;};}function removeEntity(_0x3a465d){return function(_0x45756e){if(_0x45756e){return _0x45756e[_0x4fa5('0x17')]()[_0x4fa5('0x16')](function(){_0x3a465d[_0x4fa5('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53c248){return function(_0x4aca8a){if(!_0x4aca8a){_0x53c248['sendStatus'](0x194);}return _0x4aca8a;};}function handleError(_0x94a720,_0x1e1170){_0x1e1170=_0x1e1170||0x1f4;return function(_0x5079b0){logger['error'](_0x5079b0['stack']);if(_0x5079b0[_0x4fa5('0x18')]){delete _0x5079b0[_0x4fa5('0x18')];}_0x94a720[_0x4fa5('0xf')](_0x1e1170)[_0x4fa5('0x19')](_0x5079b0);};}exports[_0x4fa5('0x1a')]=function(_0x3610a2,_0x180823){var _0x40f524={};return contacts['describe']()['then'](function(_0x394a9a){_0x40f524=qs['getOptions'](_0x394a9a,_0x3610a2);return contacts[_0x4fa5('0x1b')](_0x3610a2[_0x4fa5('0x1c')],_0x3610a2[_0x4fa5('0x1d')],_0x40f524,_0x394a9a);})[_0x4fa5('0x16')](respondWithFilteredResult(_0x180823,_0x40f524))[_0x4fa5('0x1e')](handleError(_0x180823,null));};exports['destroy']=function(_0x36a926,_0x5ab5d5){return db[_0x4fa5('0x1f')]['find']({'where':{'id':_0x36a926[_0x4fa5('0x20')]['id']}})['then'](handleEntityNotFound(_0x5ab5d5,null))[_0x4fa5('0x16')](removeEntity(_0x5ab5d5,null))[_0x4fa5('0x1e')](handleError(_0x5ab5d5,null));};exports[_0x4fa5('0x21')]=function(_0x3621bc,_0x51f8a2){return db[_0x4fa5('0x1f')][_0x4fa5('0x21')]()[_0x4fa5('0x16')](function(_0x1789f1){delete _0x1789f1[_0x4fa5('0x22')];for(var _0x5d924f=0x0;_0x5d924f0x0){return new Promise(function(_0x4561ac){var _0x320ffd=[];for(var _0x171bf1=0x0;_0x171bf1<_0x105328['length'];_0x171bf1++){_0x320ffd['push'](insertAdditionalPhones(_0x105328[_0x171bf1][_0x4fa5('0x5b')],_0x105328[_0x171bf1][_0x4fa5('0x54')]));}Promise[_0x4fa5('0x5c')](_0x320ffd)[_0x4fa5('0x16')](function(){_0x4561ac(0x1);});})[_0x4fa5('0x16')](function(){return{'success':_0x245653,'failure':_0x513819,'duplicates':_0x16503f};});}else{return{'success':_0x245653,'failure':_0x513819,'duplicates':_0x16503f};}}})[_0x4fa5('0x16')](respondWithResult(_0x19de6a,0xc9))[_0x4fa5('0x1e')](handleError(_0x19de6a,null));};exports['show']=function(_0x5ebdda,_0x18e8d6){var _0x21f8af;return db[_0x4fa5('0x1f')]['describe']()[_0x4fa5('0x16')](function(_0x32362b){return db[_0x4fa5('0x1f')]['find']({'where':{'id':_0x5ebdda[_0x4fa5('0x20')]['id']},'include':[{'model':db[_0x4fa5('0x5d')],'as':_0x4fa5('0x5e'),'attributes':['id',_0x4fa5('0x18'),_0x4fa5('0x5f')],'required':_0x5ebdda[_0x4fa5('0x1c')][_0x4fa5('0x60')]?!![]:![]},{'model':db[_0x4fa5('0x61')],'as':_0x4fa5('0x62'),'where':{'CmContactId':_0x5ebdda[_0x4fa5('0x20')]['id']},'required':![],'include':[{'model':db[_0x4fa5('0x63')],'as':_0x4fa5('0x64')}]}],'order':[db[_0x4fa5('0x65')][_0x4fa5('0x66')](_0x4fa5('0x67'))],'attributes':_[_0x4fa5('0x23')](_0x32362b)});})['then'](function(_0x4db6ab){if(!_[_0x4fa5('0x50')](_0x4db6ab)){_0x21f8af=_0x4db6ab['get']({'plain':!![]});var _0x3a9e19={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4db6ab&&_0x4db6ab[_0x4fa5('0x59')]){if(_0x4db6ab[_0x4fa5('0x59')]){_0x3a9e19[_0x4fa5('0x57')][_0x4fa5('0x68')][_0x4fa5('0x58')]({'ListId':{'$ne':_0x4db6ab[_0x4fa5('0x59')]}});}}return db[_0x4fa5('0x29')][_0x4fa5('0x1b')](_0x3a9e19);}})['then'](function(_0x3811a3){if(!_['isNil'](_0x3811a3)){return _[_0x4fa5('0x69')](_0x21f8af,_[_0x4fa5('0x6a')](_0x3811a3,function(_0x57ae0e){return util[_0x4fa5('0x6b')](_0x4fa5('0x6c'),_0x57ae0e['id']);}));}})[_0x4fa5('0x16')](handleEntityNotFound(_0x18e8d6,null))[_0x4fa5('0x16')](respondWithResult(_0x18e8d6,null))[_0x4fa5('0x1e')](handleError(_0x18e8d6,null));};exports['update']=function(_0x1491a4,_0x1e0b46){var _0x575788;if(_0x1491a4[_0x4fa5('0x32')]['id']){delete _0x1491a4[_0x4fa5('0x32')]['id'];}if(!_[_0x4fa5('0x50')](_0x1491a4['body'][_0x4fa5('0x51')])){var _0x1b5a3e=_0x1491a4[_0x4fa5('0x32')][_0x4fa5('0x51')];if(!_[_0x4fa5('0x50')](shared['timezones'][_0x1b5a3e]))_0x1491a4[_0x4fa5('0x32')][_0x4fa5('0x53')]=shared[_0x4fa5('0x52')][_0x1b5a3e]['utcOffset'];}return db[_0x4fa5('0x1f')][_0x4fa5('0x6d')]({'where':{'id':_0x1491a4[_0x4fa5('0x20')]['id']}})[_0x4fa5('0x16')](handleEntityNotFound(_0x1e0b46,null))['then'](saveUpdates(_0x1491a4[_0x4fa5('0x32')],null))[_0x4fa5('0x16')](function(_0x3aa5e8){_0x575788=_0x3aa5e8;var _0x5393a6={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3aa5e8&&_0x3aa5e8[_0x4fa5('0x59')]){if(_0x3aa5e8[_0x4fa5('0x59')]){_0x5393a6[_0x4fa5('0x57')][_0x4fa5('0x68')][_0x4fa5('0x58')]({'ListId':{'$ne':_0x3aa5e8[_0x4fa5('0x59')]}});}}return db[_0x4fa5('0x29')][_0x4fa5('0x1b')](_0x5393a6);})[_0x4fa5('0x16')](function(_0x50d918){if(_0x50d918){return _[_0x4fa5('0x69')](_['pickBy'](_0x1491a4[_0x4fa5('0x32')],function(_0x23ac6e,_0xacd7c5){return _['startsWith'](_0xacd7c5,_0x4fa5('0x26'));}),_['map'](_0x50d918,function(_0x3b4ace){return util[_0x4fa5('0x6b')](_0x4fa5('0x6c'),_0x3b4ace['id']);}));}})[_0x4fa5('0x16')](function(_0xa17b89){if(_0xa17b89&&!_[_0x4fa5('0x6e')](_0xa17b89)){var _0x187669=squel['update']()['table'](_0x4fa5('0x6f'))[_0x4fa5('0x70')](_0xa17b89)[_0x4fa5('0x57')]('id\x20=\x20?',_0x1491a4[_0x4fa5('0x20')]['id'])['toParam']();return db[_0x4fa5('0x65')]['query'](_0x187669[_0x4fa5('0x71')],{'replacements':_0x187669['values']});}})['then'](function(){if(_0x1491a4[_0x4fa5('0x32')][_0x4fa5('0x72')]&&_0x575788){return db[_0x4fa5('0x39')][_0x4fa5('0x15')]({'phone':_0x1491a4[_0x4fa5('0x32')][_0x4fa5('0x72')],'OrderBy':0x0},{'where':{'ContactId':_0x575788['id']}});}})[_0x4fa5('0x16')](function(){return _0x575788;})[_0x4fa5('0x16')](respondWithResult(_0x1e0b46,null))['catch'](handleError(_0x1e0b46,null));};exports[_0x4fa5('0x73')]=function(_0x94dcd4,_0x1b3e6b){var _0x299e43={};var _0x5af868={};var _0x4af36d;var _0x1ad83f;return db[_0x4fa5('0x1f')][_0x4fa5('0x74')]({'where':{'id':_0x94dcd4[_0x4fa5('0x20')]['id']}})[_0x4fa5('0x16')](handleEntityNotFound(_0x1b3e6b,null))[_0x4fa5('0x16')](function(_0x3a7bce){if(_0x3a7bce){_0x4af36d=_0x3a7bce;_0x5af868['model']=_[_0x4fa5('0x23')](db['Tag'][_0x4fa5('0x75')]);_0x5af868[_0x4fa5('0x1c')]=_[_0x4fa5('0x23')](_0x94dcd4[_0x4fa5('0x1c')]);_0x5af868[_0x4fa5('0x76')]=_['intersection'](_0x5af868[_0x4fa5('0x77')],_0x5af868['query']);_0x299e43[_0x4fa5('0x78')]=_[_0x4fa5('0x79')](_0x5af868[_0x4fa5('0x77')],qs['fields'](_0x94dcd4['query'][_0x4fa5('0x7a')]));_0x299e43[_0x4fa5('0x78')]=_0x299e43[_0x4fa5('0x78')][_0x4fa5('0x24')]?_0x299e43['attributes']:_0x5af868[_0x4fa5('0x77')];_0x299e43['order']=qs[_0x4fa5('0x7b')](_0x94dcd4['query'][_0x4fa5('0x7b')]);_0x299e43['where']=qs[_0x4fa5('0x76')](_[_0x4fa5('0x7c')](_0x94dcd4[_0x4fa5('0x1c')],_0x5af868[_0x4fa5('0x76')]));if(_0x94dcd4[_0x4fa5('0x1c')][_0x4fa5('0x7d')]){_0x299e43[_0x4fa5('0x57')]=_[_0x4fa5('0x31')](_0x299e43['where'],{'$or':_[_0x4fa5('0x6a')](_0x299e43[_0x4fa5('0x78')],function(_0x393ab7){var _0x2cf149={};_0x2cf149[_0x393ab7]={'$like':'%'+_0x94dcd4[_0x4fa5('0x1c')][_0x4fa5('0x7d')]+'%'};return _0x2cf149;})});}_0x299e43=_['merge']({},_0x299e43,_0x94dcd4[_0x4fa5('0x7e')]);return _0x4af36d[_0x4fa5('0x73')](_0x299e43);}})['then'](function(_0x278182){if(_0x278182){_0x1ad83f=_0x278182[_0x4fa5('0x24')];if(!_0x94dcd4[_0x4fa5('0x1c')][_0x4fa5('0x30')](_0x4fa5('0x7f'))){_0x299e43[_0x4fa5('0x11')]=qs['limit'](_0x94dcd4[_0x4fa5('0x1c')]['limit']);_0x299e43[_0x4fa5('0x10')]=qs['offset'](_0x94dcd4['query']['offset']);}return _0x4af36d['getTags'](_0x299e43);}})[_0x4fa5('0x16')](function(_0x51b8c8){if(_0x51b8c8){return _0x51b8c8?{'count':_0x1ad83f,'rows':_0x51b8c8}:null;}})['then'](respondWithResult(_0x1b3e6b,null))[_0x4fa5('0x1e')](handleError(_0x1b3e6b,null));};exports[_0x4fa5('0x80')]=function(_0x15d230,_0x42fe68){if(_0x15d230['body']['id']){delete _0x15d230[_0x4fa5('0x32')]['id'];}return db[_0x4fa5('0x1f')][_0x4fa5('0x74')]({'where':{'id':_0x15d230[_0x4fa5('0x20')]['id']}})[_0x4fa5('0x16')](handleEntityNotFound(_0x42fe68,null))[_0x4fa5('0x16')](function(_0x4d8b6d){if(_0x4d8b6d){return _0x4d8b6d['setTags'](_0x15d230['body'][_0x4fa5('0x81')]||[]);}return null;})[_0x4fa5('0x16')](respondWithResult(_0x42fe68,null))['catch'](handleError(_0x42fe68,null));};exports[_0x4fa5('0x82')]=function(_0x263bf0,_0xc450b1){var _0x189233=[];_0x189233[_0x4fa5('0x58')](addAdditionalPhones(_0x263bf0[_0x4fa5('0x32')]));Promise[_0x4fa5('0x5c')](_0x189233)[_0x4fa5('0x16')](function(){_0x189233=[];_0x189233['push'](deleteCmHopperPhones(_0x263bf0[_0x4fa5('0x32')]['id']));_0x189233[_0x4fa5('0x58')](addCmHopperPhones(_0x263bf0[_0x4fa5('0x32')]['id']));Promise['all'](_0x189233)[_0x4fa5('0x16')](function(){return[0x1];})[_0x4fa5('0x16')](respondWithResult(_0xc450b1,null));});};function addAdditionalPhones(_0x1581de){var _0x333643;return new Promise(function(_0x5269c6){return db[_0x4fa5('0x61')][_0x4fa5('0x17')]({'where':{'CmContactId':_0x1581de['id']}})[_0x4fa5('0x16')](function(){db[_0x4fa5('0x63')]['findAll']({'raw':!![],'attributes':['id',_0x4fa5('0x83')]})[_0x4fa5('0x16')](function(_0x3348fd){var _0x3ba86e=[];for(var _0x24f7dd=0x0;_0x24f7dd<_0x1581de['items'][_0x4fa5('0x24')];_0x24f7dd++){var _0x32fd8e=_0x1581de[_0x4fa5('0x84')]?_[_0x4fa5('0x50')](_0x1581de[_0x4fa5('0x84')][_0x24f7dd])?'':_0x1581de[_0x4fa5('0x84')][_0x24f7dd]:_0x1581de[_0x4fa5('0x85')][_0x24f7dd][_0x4fa5('0x86')]?_0x1581de[_0x4fa5('0x85')][_0x24f7dd][_0x4fa5('0x86')]:'';var _0x47e0bb=_[_0x4fa5('0x50')](_0x1581de[_0x4fa5('0x85')][_0x24f7dd][_0x4fa5('0x87')])?'':_0x1581de['items'][_0x24f7dd][_0x4fa5('0x87')];var _0x55ba4c=_0x32fd8e+':'+_0x1581de[_0x4fa5('0x85')][_0x24f7dd]['phone']+'§'+_0x47e0bb;if(_[_0x4fa5('0x50')](_0x333643))_0x333643=_0x55ba4c;else _0x333643+=';'+_0x55ba4c;var _0xf2518f=null;var _0x24c14d=null;if(_0x1581de['item_types']){if(!_['isNil'](_0x1581de[_0x4fa5('0x84')][_0x24f7dd])){_0x24c14d=_[_0x4fa5('0x6d')](_0x3348fd,function(_0x2ba1f7){return _0x2ba1f7['id']===_0x1581de[_0x4fa5('0x84')][_0x24f7dd];});if(!_[_0x4fa5('0x50')](_0x24c14d)){_0xf2518f=_0x24c14d[_0x4fa5('0x83')];}}}else{if(!_[_0x4fa5('0x50')](_0x1581de['items'][_0x24f7dd])){_0x24c14d=_[_0x4fa5('0x6d')](_0x3348fd,function(_0xeee7bf){return _0xeee7bf['id']===_0x1581de['items'][_0x24f7dd][_0x4fa5('0x86')];});if(!_[_0x4fa5('0x50')](_0x24c14d)){_0xf2518f=_0x24f7dd;}}}if(_[_0x4fa5('0x50')](_0xf2518f)){_0xf2518f=0x64;}_0x3ba86e[_0x4fa5('0x58')](addAdditionalPhone(_0x1581de['id'],_0x1581de[_0x4fa5('0x85')][_0x24f7dd]['phone'],_0x1581de[_0x4fa5('0x84')]?_['isNil'](_0x1581de[_0x4fa5('0x84')][_0x24f7dd])?null:_0x1581de[_0x4fa5('0x84')][_0x24f7dd]:_0x1581de['items'][_0x24f7dd][_0x4fa5('0x86')]?_0x1581de['items'][_0x24f7dd]['ItemTypeId']:null,_0xf2518f,_0x47e0bb));}Promise[_0x4fa5('0x5c')](_0x3ba86e)['then'](function(){db[_0x4fa5('0x1f')][_0x4fa5('0x15')]({'AdditionalPhones':_0x333643},{'where':{'id':_0x1581de['id']}})[_0x4fa5('0x16')](function(){_0x5269c6(0x1);});});});});});}function addAdditionalPhone(_0x42fbf8,_0x5d2904,_0x31ed84,_0x56b1db,_0x309aa6){return db['CmContactHasItem'][_0x4fa5('0x6d')]({'where':{'CmContactId':_0x42fbf8,'item':_0x5d2904}})[_0x4fa5('0x16')](function(_0x5d5bdd){if(_0x5d5bdd)logger[_0x4fa5('0x2d')](_0x4fa5('0x88'),_0x5d5bdd);else{db['CmContactHasItem']['create']({'CmContactId':_0x42fbf8,'item':_0x5d2904,'ItemTypeId':_0x31ed84,'OrderBy':_0x56b1db,'ItemClass':_0x4fa5('0x89'),'description':_0x309aa6});}});}function deleteCmHopperPhones(_0x5b8f55){return new Promise(function(_0x4630ac){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5b8f55}})[_0x4fa5('0x16')](function(_0x5c8a89){db[_0x4fa5('0x8a')][_0x4fa5('0x17')]({'where':{'CmHopperId':{'$in':_[_0x4fa5('0x6a')](_0x5c8a89,'id')}}});})[_0x4fa5('0x16')](function(){_0x4630ac(0x1);});});}function addCmHopperPhones(_0x3ad1ee){return new Promise(function(_0x3570d3){return db[_0x4fa5('0x39')][_0x4fa5('0x1b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3ad1ee}})[_0x4fa5('0x16')](function(_0x15d424){var _0x4789d9=[];_[_0x4fa5('0x6a')](_0x15d424,function(_0x117b8c){_0x4789d9[_0x4fa5('0x58')](createCmHopperPhone(_0x3ad1ee,_0x117b8c['id']));});Promise[_0x4fa5('0x5c')](_0x4789d9)[_0x4fa5('0x16')](function(){_0x3570d3(0x1);});});});}function createCmHopperPhone(_0x3d65a1,_0x35a9c8){return new Promise(function(_0x161477){db[_0x4fa5('0x61')][_0x4fa5('0x1b')]({'raw':!![],'attributes':['item',_0x4fa5('0x83')],'where':{'CmContactId':_0x3d65a1,'ItemClass':_0x4fa5('0x89')},'include':[{'model':db['ContactItemType'],'attributes':[_0x4fa5('0x83')],'as':_0x4fa5('0x64')}],'order':[_0x4fa5('0x83'),db['sequelize'][_0x4fa5('0x66')](_0x4fa5('0x8b'))]})[_0x4fa5('0x16')](function(_0x4f5767){var _0x837074=0x1;var _0x1eb237=_[_0x4fa5('0x6a')](_0x4f5767,function(_0x2c3aee){_0x2c3aee[_0x4fa5('0x8c')]=_0x35a9c8;_0x2c3aee[_0x4fa5('0x72')]=_0x2c3aee[_0x4fa5('0x8d')];_0x2c3aee[_0x4fa5('0x83')]=_0x837074;delete _0x2c3aee[_0x4fa5('0x8e')];_0x837074=_0x837074+0x1;return _0x2c3aee;});return db[_0x4fa5('0x8a')][_0x4fa5('0x55')](_0x1eb237,{});})[_0x4fa5('0x16')](function(){_0x161477(0x1);});});}function insertAdditionalPhones(_0x3e4341,_0x4cf591){return new Promise(function(_0x154730){var _0x5f0c9d=[];for(var _0x2b11d8=0x0;_0x2b11d8<_0x4cf591[_0x4fa5('0x24')];_0x2b11d8++){var _0x191e11=_0x4cf591[_0x2b11d8];_0x5f0c9d[_0x4fa5('0x58')](parseContactItemType(_0x191e11));}Promise[_0x4fa5('0x5c')](_0x5f0c9d)['then'](function(){var _0x21d8f1={'id':_0x3e4341['id'],'items':_0x4cf591};return addAdditionalPhones(_0x21d8f1)['then'](function(){return addCmHopperPhones(_0x3e4341['id']);});})[_0x4fa5('0x16')](function(){_0x154730(_0x3e4341);});});}function parseContactItemType(_0x5f1e79){return new Promise(function(_0x30d766){if(_0x5f1e79[_0x4fa5('0x30')]('ItemTypeId')){_0x30d766(_0x5f1e79);}else{return db[_0x4fa5('0x63')]['find']({'where':{'name':_0x5f1e79['ItemType']}})[_0x4fa5('0x16')](function(_0x49ed6b){if(_['isNil'](_0x49ed6b))_0x5f1e79[_0x4fa5('0x86')]=null;else _0x5f1e79[_0x4fa5('0x86')]=_0x49ed6b['id'];_0x30d766(_0x5f1e79);});}});}exports[_0x4fa5('0x8f')]=function(_0x1f332c,_0x2299ce){return db[_0x4fa5('0x61')][_0x4fa5('0x1b')]({'raw':!![],'where':{'CmContactId':_0x1f332c[_0x4fa5('0x20')]['id'],'ItemClass':_0x4fa5('0x89')},'include':[{'model':db[_0x4fa5('0x63')],'as':_0x4fa5('0x64')}],'order':[[_0x4fa5('0x83')],[db[_0x4fa5('0x65')][_0x4fa5('0x66')](_0x4fa5('0x8b'))]]})[_0x4fa5('0x16')](function(_0x3fc621){return _0x3fc621;})['then'](respondWithResult(_0x2299ce,null))[_0x4fa5('0x1e')](handleError(_0x2299ce,null));};exports[_0x4fa5('0x90')]=function(_0x3c9b94,_0x47d522){return db[_0x4fa5('0x61')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3c9b94[_0x4fa5('0x32')][_0x4fa5('0x91')]}})[_0x4fa5('0x16')](function(_0x48e334){var _0x3960e1=_[_0x4fa5('0x6a')](_0x48e334,function(_0x39930d){_0x39930d[_0x4fa5('0x92')]=_0x3c9b94[_0x4fa5('0x32')][_0x4fa5('0x93')];return _0x39930d;});return db['CmContactHasItem'][_0x4fa5('0x55')](_0x3960e1,{});})[_0x4fa5('0x16')](function(){return addCmHopperPhones(_0x3c9b94[_0x4fa5('0x32')]['toContactId']);})[_0x4fa5('0x16')](function(){return['ok'];})[_0x4fa5('0x16')](respondWithResult(_0x47d522,null))[_0x4fa5('0x1e')](handleError(_0x47d522,null));};exports['rescheduleAdditionalPhones']=function(_0x4c2c72,_0x2eea11){var _0xa5c40b=[];_0xa5c40b[_0x4fa5('0x58')](createCmHopperPhone(_0x4c2c72['body']['id'],_0x4c2c72['body']['hopperId']));Promise[_0x4fa5('0x5c')](_0xa5c40b)[_0x4fa5('0x16')](function(){return[0x1];})[_0x4fa5('0x16')](respondWithResult(_0x2eea11,null));};exports[_0x4fa5('0x94')]=function(_0x207b71,_0x597db2){var _0x420727={'raw':![],'where':{}};var _0x4a4c31={};var _0x4d8e21={'count':0x0,'rows':[]};return db[_0x4fa5('0x1f')][_0x4fa5('0x74')]({'where':{'id':_0x207b71[_0x4fa5('0x20')]['id']}})[_0x4fa5('0x16')](handleEntityNotFound(_0x597db2,null))[_0x4fa5('0x16')](function(_0x1f3808){if(_0x1f3808){_0x4a4c31[_0x4fa5('0x77')]=_['keys'](db[_0x4fa5('0x39')][_0x4fa5('0x75')]);_0x4a4c31['query']=_[_0x4fa5('0x23')](_0x207b71[_0x4fa5('0x1c')]);_0x4a4c31['filters']=_['intersection'](_0x4a4c31['model'],_0x4a4c31[_0x4fa5('0x1c')]);_0x420727['attributes']=_[_0x4fa5('0x79')](_0x4a4c31['model'],qs[_0x4fa5('0x7a')](_0x207b71[_0x4fa5('0x1c')]['fields']));_0x420727[_0x4fa5('0x78')]=_0x420727[_0x4fa5('0x78')]['length']?_0x420727[_0x4fa5('0x78')]:_0x4a4c31['model'];if(!_0x207b71['query'][_0x4fa5('0x30')](_0x4fa5('0x7f'))){_0x420727['limit']=qs[_0x4fa5('0x11')](_0x207b71[_0x4fa5('0x1c')][_0x4fa5('0x11')]);_0x420727['offset']=qs['offset'](_0x207b71[_0x4fa5('0x1c')]['offset']);}_0x420727[_0x4fa5('0x95')]=qs['sort'](_0x207b71[_0x4fa5('0x1c')][_0x4fa5('0x7b')]);_0x420727[_0x4fa5('0x57')]=qs[_0x4fa5('0x76')](_['pick'](_0x207b71[_0x4fa5('0x1c')],_0x4a4c31[_0x4fa5('0x76')]));_0x420727[_0x4fa5('0x57')][_0x4fa5('0x96')]=_0x1f3808['id'];if(_0x207b71['query'][_0x4fa5('0x7d')]){_0x420727[_0x4fa5('0x57')]=_[_0x4fa5('0x31')](_0x420727[_0x4fa5('0x57')],{'$or':_[_0x4fa5('0x6a')](_0x420727[_0x4fa5('0x78')],function(_0x170082){var _0x359d56={};_0x359d56[_0x170082]={'$like':'%'+_0x207b71[_0x4fa5('0x1c')]['filter']+'%'};return _0x359d56;})});}_0x420727=_[_0x4fa5('0x31')]({},_0x420727,_0x207b71['options']);return db[_0x4fa5('0x39')]['count']({'where':_0x420727['where']})[_0x4fa5('0x16')](function(_0x1431fa){_0x4d8e21[_0x4fa5('0x13')]=_0x1431fa;if(_0x207b71[_0x4fa5('0x1c')][_0x4fa5('0x97')]){_0x420727[_0x4fa5('0x98')]=[{'all':!![]}];}return db['CmHopper'][_0x4fa5('0x1b')](_0x420727);})[_0x4fa5('0x16')](function(_0x3b5de9){_0x4d8e21[_0x4fa5('0x99')]=_0x3b5de9;return _0x4d8e21;});}})[_0x4fa5('0x16')](respondWithFilteredResult(_0x597db2,_0x420727))['catch'](handleError(_0x597db2,null));};exports['getHopperHistories']=function(_0x33b758,_0x375b46){var _0x19d76a={'raw':!![],'where':{}};var _0x10a5ef={};var _0x5c199d={'count':0x0,'rows':[]};return db[_0x4fa5('0x1f')][_0x4fa5('0x74')]({'where':{'id':_0x33b758[_0x4fa5('0x20')]['id']}})[_0x4fa5('0x16')](handleEntityNotFound(_0x375b46,null))[_0x4fa5('0x16')](function(_0x28072d){if(_0x28072d){_0x10a5ef[_0x4fa5('0x77')]=_[_0x4fa5('0x23')](db[_0x4fa5('0x46')][_0x4fa5('0x75')]);_0x10a5ef[_0x4fa5('0x1c')]=_[_0x4fa5('0x23')](_0x33b758[_0x4fa5('0x1c')]);_0x10a5ef['filters']=_[_0x4fa5('0x79')](_0x10a5ef['model'],_0x10a5ef['query']);_0x19d76a[_0x4fa5('0x78')]=_[_0x4fa5('0x79')](_0x10a5ef['model'],qs[_0x4fa5('0x7a')](_0x33b758[_0x4fa5('0x1c')][_0x4fa5('0x7a')]));_0x19d76a[_0x4fa5('0x78')]=_0x19d76a[_0x4fa5('0x78')][_0x4fa5('0x24')]?_0x19d76a[_0x4fa5('0x78')]:_0x10a5ef[_0x4fa5('0x77')];if(!_0x33b758[_0x4fa5('0x1c')][_0x4fa5('0x30')](_0x4fa5('0x7f'))){_0x19d76a[_0x4fa5('0x11')]=qs[_0x4fa5('0x11')](_0x33b758[_0x4fa5('0x1c')][_0x4fa5('0x11')]);_0x19d76a[_0x4fa5('0x10')]=qs[_0x4fa5('0x10')](_0x33b758[_0x4fa5('0x1c')][_0x4fa5('0x10')]);}_0x19d76a[_0x4fa5('0x95')]=qs[_0x4fa5('0x7b')](_0x33b758[_0x4fa5('0x1c')][_0x4fa5('0x7b')]);_0x19d76a[_0x4fa5('0x57')]=qs[_0x4fa5('0x76')](_['pick'](_0x33b758[_0x4fa5('0x1c')],_0x10a5ef[_0x4fa5('0x76')]));_0x19d76a[_0x4fa5('0x57')][_0x4fa5('0x96')]=_0x28072d['id'];if(_0x33b758[_0x4fa5('0x1c')][_0x4fa5('0x7d')]){_0x19d76a[_0x4fa5('0x57')]=_[_0x4fa5('0x31')](_0x19d76a[_0x4fa5('0x57')],{'$or':_[_0x4fa5('0x6a')](_0x19d76a['attributes'],function(_0x30d6ac){var _0x50e46d={};_0x50e46d[_0x30d6ac]={'$like':'%'+_0x33b758['query']['filter']+'%'};return _0x50e46d;})});}_0x19d76a=_[_0x4fa5('0x31')]({},_0x19d76a,_0x33b758[_0x4fa5('0x7e')]);return db[_0x4fa5('0x46')][_0x4fa5('0x13')]({'where':_0x19d76a[_0x4fa5('0x57')]})['then'](function(_0x1010f4){_0x5c199d['count']=_0x1010f4;if(_0x33b758[_0x4fa5('0x1c')][_0x4fa5('0x97')]){_0x19d76a['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x4fa5('0x1b')](_0x19d76a);})[_0x4fa5('0x16')](function(_0x3bd8cf){_0x5c199d[_0x4fa5('0x99')]=_0x3bd8cf;return _0x5c199d;});}})[_0x4fa5('0x16')](respondWithFilteredResult(_0x375b46,_0x19d76a))[_0x4fa5('0x1e')](handleError(_0x375b46,null));};exports[_0x4fa5('0x9a')]=function(_0x34e3b7,_0x35cb5d){var _0x139fdc={'raw':!![],'where':{}};var _0x249dbd={};var _0x6106eb={'count':0x0,'rows':[]};return db[_0x4fa5('0x1f')][_0x4fa5('0x74')]({'where':{'id':_0x34e3b7[_0x4fa5('0x20')]['id']}})[_0x4fa5('0x16')](handleEntityNotFound(_0x35cb5d,null))[_0x4fa5('0x16')](function(_0xfe7d9c){if(_0xfe7d9c){_0x249dbd['model']=_[_0x4fa5('0x23')](db[_0x4fa5('0x45')][_0x4fa5('0x75')]);_0x249dbd[_0x4fa5('0x1c')]=_[_0x4fa5('0x23')](_0x34e3b7[_0x4fa5('0x1c')]);_0x249dbd[_0x4fa5('0x76')]=_['intersection'](_0x249dbd['model'],_0x249dbd[_0x4fa5('0x1c')]);_0x139fdc[_0x4fa5('0x78')]=_[_0x4fa5('0x79')](_0x249dbd['model'],qs['fields'](_0x34e3b7[_0x4fa5('0x1c')][_0x4fa5('0x7a')]));_0x139fdc[_0x4fa5('0x78')]=_0x139fdc[_0x4fa5('0x78')]['length']?_0x139fdc[_0x4fa5('0x78')]:_0x249dbd[_0x4fa5('0x77')];if(!_0x34e3b7[_0x4fa5('0x1c')]['hasOwnProperty'](_0x4fa5('0x7f'))){_0x139fdc[_0x4fa5('0x11')]=qs[_0x4fa5('0x11')](_0x34e3b7[_0x4fa5('0x1c')][_0x4fa5('0x11')]);_0x139fdc['offset']=qs['offset'](_0x34e3b7[_0x4fa5('0x1c')][_0x4fa5('0x10')]);}_0x139fdc[_0x4fa5('0x95')]=qs[_0x4fa5('0x7b')](_0x34e3b7[_0x4fa5('0x1c')]['sort']);_0x139fdc[_0x4fa5('0x57')]=qs[_0x4fa5('0x76')](_['pick'](_0x34e3b7[_0x4fa5('0x1c')],_0x249dbd[_0x4fa5('0x76')]));_0x139fdc[_0x4fa5('0x57')]['ContactId']=_0xfe7d9c['id'];if(_0x34e3b7[_0x4fa5('0x1c')][_0x4fa5('0x7d')]){_0x139fdc[_0x4fa5('0x57')]=_[_0x4fa5('0x31')](_0x139fdc[_0x4fa5('0x57')],{'$or':_['map'](_0x139fdc[_0x4fa5('0x78')],function(_0x2ddbc3){var _0x3cfda6={};_0x3cfda6[_0x2ddbc3]={'$like':'%'+_0x34e3b7[_0x4fa5('0x1c')][_0x4fa5('0x7d')]+'%'};return _0x3cfda6;})});}_0x139fdc=_[_0x4fa5('0x31')]({},_0x139fdc,_0x34e3b7[_0x4fa5('0x7e')]);return db['CmHopperFinal'][_0x4fa5('0x13')]({'where':_0x139fdc[_0x4fa5('0x57')]})[_0x4fa5('0x16')](function(_0xcb7176){_0x6106eb[_0x4fa5('0x13')]=_0xcb7176;if(_0x34e3b7[_0x4fa5('0x1c')]['includeAll']){_0x139fdc[_0x4fa5('0x98')]=[{'all':!![]}];}return db[_0x4fa5('0x45')][_0x4fa5('0x1b')](_0x139fdc);})[_0x4fa5('0x16')](function(_0x4382ce){_0x6106eb['rows']=_0x4382ce;return _0x6106eb;});}})[_0x4fa5('0x16')](respondWithFilteredResult(_0x35cb5d,_0x139fdc))[_0x4fa5('0x1e')](handleError(_0x35cb5d,null));};exports[_0x4fa5('0x9b')]=function(_0x34902f,_0x5a3550){var _0x45c591={'raw':!![],'where':{}};var _0x16e8fb={};var _0x15bb1e={'count':0x0,'rows':[]};return db['CmContact'][_0x4fa5('0x74')]({'where':{'id':_0x34902f[_0x4fa5('0x20')]['id']}})[_0x4fa5('0x16')](handleEntityNotFound(_0x5a3550,null))[_0x4fa5('0x16')](function(_0xc83f6a){if(_0xc83f6a){_0x16e8fb[_0x4fa5('0x77')]=_[_0x4fa5('0x23')](db[_0x4fa5('0x4d')][_0x4fa5('0x75')]);_0x16e8fb[_0x4fa5('0x1c')]=_[_0x4fa5('0x23')](_0x34902f[_0x4fa5('0x1c')]);_0x16e8fb[_0x4fa5('0x76')]=_[_0x4fa5('0x79')](_0x16e8fb['model'],_0x16e8fb[_0x4fa5('0x1c')]);_0x45c591['attributes']=_['intersection'](_0x16e8fb[_0x4fa5('0x77')],qs[_0x4fa5('0x7a')](_0x34902f[_0x4fa5('0x1c')][_0x4fa5('0x7a')]));_0x45c591[_0x4fa5('0x78')]=_0x45c591[_0x4fa5('0x78')][_0x4fa5('0x24')]?_0x45c591[_0x4fa5('0x78')]:_0x16e8fb[_0x4fa5('0x77')];if(!_0x34902f[_0x4fa5('0x1c')]['hasOwnProperty'](_0x4fa5('0x7f'))){_0x45c591[_0x4fa5('0x11')]=qs[_0x4fa5('0x11')](_0x34902f[_0x4fa5('0x1c')]['limit']);_0x45c591[_0x4fa5('0x10')]=qs[_0x4fa5('0x10')](_0x34902f[_0x4fa5('0x1c')]['offset']);}_0x45c591[_0x4fa5('0x95')]=qs[_0x4fa5('0x7b')](_0x34902f[_0x4fa5('0x1c')][_0x4fa5('0x7b')]);_0x45c591[_0x4fa5('0x57')]=qs[_0x4fa5('0x76')](_['pick'](_0x34902f[_0x4fa5('0x1c')],_0x16e8fb[_0x4fa5('0x76')]));_0x45c591['where']['ContactId']=_0xc83f6a['id'];if(_0x34902f[_0x4fa5('0x1c')][_0x4fa5('0x7d')]){_0x45c591['where']=_['merge'](_0x45c591[_0x4fa5('0x57')],{'$or':_[_0x4fa5('0x6a')](_0x45c591['attributes'],function(_0x4b2b73){var _0x4bfb64={};_0x4bfb64[_0x4b2b73]={'$like':'%'+_0x34902f['query'][_0x4fa5('0x7d')]+'%'};return _0x4bfb64;})});}_0x45c591=_[_0x4fa5('0x31')]({},_0x45c591,_0x34902f[_0x4fa5('0x7e')]);return db[_0x4fa5('0x4d')][_0x4fa5('0x13')]({'where':_0x45c591[_0x4fa5('0x57')]})[_0x4fa5('0x16')](function(_0x40cc95){_0x15bb1e['count']=_0x40cc95;if(_0x34902f[_0x4fa5('0x1c')][_0x4fa5('0x97')]){_0x45c591[_0x4fa5('0x98')]=[{'all':!![]}];}return db[_0x4fa5('0x4d')][_0x4fa5('0x1b')](_0x45c591);})[_0x4fa5('0x16')](function(_0x5657c1){_0x15bb1e[_0x4fa5('0x99')]=_0x5657c1;return _0x15bb1e;});}})[_0x4fa5('0x16')](respondWithFilteredResult(_0x5a3550,_0x45c591))[_0x4fa5('0x1e')](handleError(_0x5a3550,null));};exports[_0x4fa5('0x9c')]=function(_0x183c1e,_0x15bf0b){try{if(!_0x183c1e[_0x4fa5('0x32')][_0x4fa5('0x59')]){throw new Error(_0x4fa5('0x9d'));}if(!_0x183c1e[_0x4fa5('0x32')][_0x4fa5('0x9e')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x183c1e['body']['binding_values']){throw new Error(_0x4fa5('0x9f'));}if(!_0x183c1e[_0x4fa5('0x32')][_0x4fa5('0xa0')]){throw new Error(_0x4fa5('0xa1'));}var _0x1abc98=_0x183c1e[_0x4fa5('0x32')][_0x4fa5('0x9e')][_0x4fa5('0xa2')](',');var _0xac3194=_0x183c1e[_0x4fa5('0x32')][_0x4fa5('0xa3')][_0x4fa5('0xa2')](',');if(!_0x1abc98['length']||!_0xac3194[_0x4fa5('0x24')]||_0x1abc98['length']!==_0xac3194[_0x4fa5('0x24')]){throw new Error(_0x4fa5('0xa4'));}_0x183c1e['body'][_0x4fa5('0x7a')]=_[_0x4fa5('0xa5')](_0x1abc98,_0xac3194);if(!_0x183c1e[_0x4fa5('0x32')][_0x4fa5('0x7a')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x183c1e[_0x4fa5('0x32')][_0x4fa5('0x7a')][_0x4fa5('0xa6')]){throw new Error(_0x4fa5('0xa7'));}var _0xd2a80d=path[_0x4fa5('0x37')](config[_0x4fa5('0xa8')],_0x4fa5('0xa9'),_0x183c1e[_0x4fa5('0xaa')][_0x4fa5('0xab')]);fs[_0x4fa5('0xac')](_0xd2a80d,parseInt('0777',0x8));var _0x21d486=require(_0x4fa5('0xad'))[_0x4fa5('0xae')](path[_0x4fa5('0x37')](__dirname,_0x4fa5('0xaf')),[_0xd2a80d,_0x183c1e['body'][_0x4fa5('0x9e')],_0x183c1e[_0x4fa5('0x32')][_0x4fa5('0xa3')],_0x183c1e[_0x4fa5('0x32')][_0x4fa5('0x59')],_0x183c1e[_0x4fa5('0x32')]['CompanyId'],_0x183c1e[_0x4fa5('0x32')][_0x4fa5('0x56')],_0x183c1e[_0x4fa5('0x32')][_0x4fa5('0xa0')]]);return _0x15bf0b['status'](0xc8)[_0x4fa5('0xb0')]({'message':_0x4fa5('0xb1'),'pid':_0x21d486[_0x4fa5('0xb2')]});}catch(_0xf8818b){return _0x15bf0b[_0x4fa5('0xf')](0x1f4)[_0x4fa5('0x19')](_0xf8818b);}};exports[_0x4fa5('0xb3')]=function(_0x47e0a6,_0x2a4bc1){var _0x361b63=fs[_0x4fa5('0xb4')](_0x47e0a6[_0x4fa5('0xaa')]['path']);Papa[_0x4fa5('0xb5')](_0x361b63,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x233c50){return _0x2a4bc1[_0x4fa5('0xf')](0xc8)[_0x4fa5('0xb0')]({'file':_0x47e0a6['file'],'fields':_0x233c50[_0x4fa5('0xb6')][_0x4fa5('0x7a')]});}});};exports['import']=function(_0x2a19fb,_0x3cc35a){return db['User'][_0x4fa5('0x1b')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x4bd4dc){var _0x5eeb90=![];if(!_0x2a19fb[_0x4fa5('0x32')]['ListId']){throw new Error(_0x4fa5('0x9d'));}if(!_0x2a19fb[_0x4fa5('0x32')][_0x4fa5('0xb7')][_0x4fa5('0x72')]){throw new Error(_0x4fa5('0xb8'));}if(!_0x2a19fb[_0x4fa5('0x32')][_0x4fa5('0xb7')][_0x4fa5('0xa6')]){throw new Error(_0x4fa5('0xa7'));}if(!_0x2a19fb[_0x4fa5('0x32')]['socket_timestamp']){throw new Error(_0x4fa5('0xa1'));}var _0x1b4bc5=require(_0x4fa5('0xad'))['fork'](path[_0x4fa5('0x37')](__dirname,'../../components/import/cm/csv2'),[_0x2a19fb['params']['id'],JSON['stringify'](_0x2a19fb[_0x4fa5('0x32')]),JSON[_0x4fa5('0xb9')](_0x4bd4dc)]);_0x1b4bc5['on'](_0x4fa5('0xba'),function(){_0x5eeb90=!![];return _0x3cc35a[_0x4fa5('0xf')](0xc8)[_0x4fa5('0xb0')]({'message':_0x4fa5('0xbb'),'pid':_0x1b4bc5['pid']});});_0x1b4bc5['on'](_0x4fa5('0xbc'),function(_0x535919){if(_0x535919&&!_0x5eeb90){return _0x3cc35a[_0x4fa5('0xf')](0x1f4)[_0x4fa5('0xb0')]({'message':'error\x20child\x20process','pid':_0x1b4bc5['pid']});}});})[_0x4fa5('0x1e')](handleError(_0x3cc35a,null));};exports[_0x4fa5('0xbd')]=function(_0x32dbf7,_0x766db7){return db[_0x4fa5('0xbe')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x4fa5('0xbf')}})[_0x4fa5('0x16')](function(_0x17d58a){var _0x1cae35=![];if(!_0x32dbf7['body'][_0x4fa5('0x59')]){throw new Error(_0x4fa5('0x9d'));}if(!_0x32dbf7[_0x4fa5('0x32')][_0x4fa5('0xb7')][_0x4fa5('0x72')]){throw new Error(_0x4fa5('0xb8'));}if(!_0x32dbf7[_0x4fa5('0x32')][_0x4fa5('0xb7')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x32dbf7[_0x4fa5('0x32')][_0x4fa5('0xa0')]){throw new Error(_0x4fa5('0xa1'));}var _0x4dba87=require(_0x4fa5('0xad'))['fork'](path[_0x4fa5('0x37')](__dirname,_0x4fa5('0xc0')),[_0x32dbf7[_0x4fa5('0x20')]['id'],JSON[_0x4fa5('0xb9')](_0x32dbf7['body']),JSON[_0x4fa5('0xb9')](_0x17d58a)]);_0x4dba87['on'](_0x4fa5('0xba'),function(){_0x1cae35=!![];return _0x766db7['status'](0xc8)[_0x4fa5('0xb0')]({'message':_0x4fa5('0xbb'),'pid':_0x4dba87['pid']});});_0x4dba87['on'](_0x4fa5('0xbc'),function(_0x51892a){if(_0x51892a&&!_0x1cae35){return _0x766db7[_0x4fa5('0xf')](0x1f4)['json']({'message':_0x4fa5('0xc1'),'pid':_0x4dba87[_0x4fa5('0xb2')]});}});})['catch'](handleError(_0x766db7,null));};exports[_0x4fa5('0xc2')]=function(_0x534190,_0x589545){var _0x83be63=[_0x4fa5('0xc3'),_0x4fa5('0xc4'),_0x4fa5('0xc5'),'openchannel',_0x4fa5('0xc6'),_0x4fa5('0xc7'),_0x4fa5('0xc8')];var _0x22b305={'offset':0x0,'order':qs[_0x4fa5('0x7b')](_0x4fa5('0xc9'))},_0x11f0f1={'count':0x0,'rows':[]};Promise['resolve']()[_0x4fa5('0x16')](function(){if(_0x534190['query'][_0x4fa5('0xca')]){if(!_[_0x4fa5('0xcb')](_0x83be63,_0x534190[_0x4fa5('0x1c')][_0x4fa5('0xca')][_0x4fa5('0xcc')]())){throw new Error('Invalid\x20channel');}_0x83be63=[_0x534190[_0x4fa5('0x1c')][_0x4fa5('0xca')][_0x4fa5('0xcc')]()];}if(_0x534190['query'][_0x4fa5('0xcd')]){try{var _0x35b86e=JSON[_0x4fa5('0xb5')](_0x534190['query']['range']);if(!moment(_0x35b86e[_0x4fa5('0x33')])[_0x4fa5('0xce')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x35b86e['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x575f02){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x534190[_0x4fa5('0x1c')][_0x4fa5('0x30')]('nolimit')){_0x22b305['limit']=qs['limit'](_0x534190[_0x4fa5('0x1c')][_0x4fa5('0x11')]||0xa);_0x22b305[_0x4fa5('0x10')]=qs['offset'](_0x534190['query'][_0x4fa5('0x10')]);}var _0x2e977d=_0x83be63[_0x4fa5('0x6a')](function(_0x4e9319){if(_0x4e9319===_0x4fa5('0xc8')){var _0x277644={'attributes':['id',_0x4fa5('0xcf'),_0x4fa5('0x2c'),'source',_0x4fa5('0xd0'),_0x4fa5('0xd1'),_0x4fa5('0xd2'),_0x4fa5('0xd3'),'duration',_0x4fa5('0xd4'),_0x4fa5('0xd5'),'userDisposition',_0x4fa5('0xd6'),_0x4fa5('0xd7'),_0x4fa5('0xd8')],'where':{'ContactId':_0x534190[_0x4fa5('0x20')]['id']},'include':[{'model':db[_0x4fa5('0xbe')],'as':_0x4fa5('0xbe'),'attributes':['id',_0x4fa5('0x18'),'fullname',_0x4fa5('0x2a')]}],'order':[[_0x4fa5('0xd5'),_0x4fa5('0xd9')]]};if(_0x534190[_0x4fa5('0x1c')][_0x4fa5('0xcd')]){_0x277644[_0x4fa5('0x57')]['createdAt']={'$gte':_0x35b86e[_0x4fa5('0x33')],'$lte':_0x35b86e['to']};}return db[_0x4fa5('0xda')]['findAndCountAll'](_0x277644)[_0x4fa5('0x16')](function(_0x5a078d){_0x11f0f1[_0x4fa5('0x13')]+=_0x5a078d[_0x4fa5('0x13')];return _['map'](_0x5a078d[_0x4fa5('0x99')],function(_0x57be32){var _0x564a41=_0x57be32[_0x4fa5('0x34')]({'plain':!![]});_0x564a41[_0x4fa5('0xca')]=_0x4e9319;if(_0x564a41['User']){_0x564a41[_0x4fa5('0xbe')]={'id':_0x564a41[_0x4fa5('0xbe')]['id'],'name':_0x564a41[_0x4fa5('0xbe')][_0x4fa5('0x18')],'fullname':_0x564a41[_0x4fa5('0xbe')][_0x4fa5('0xdb')],'alias':_0x564a41['User'][_0x4fa5('0x2a')]};}return _0x564a41;});});}else{var _0x3f6b0d=_['startCase'](_0x4e9319)+(_0x4e9319===_0x4fa5('0xc4')?_0x4fa5('0xdc'):_0x4fa5('0xdd'));var _0x51931e={'attributes':['id','closed',_0x4fa5('0xde'),'createdAt',_0x4fa5('0xd4'),_0x4fa5('0xdf'),'secondDisposition','thirdDisposition',_0x4fa5('0xd8'),_0x3f6b0d+'Id'],'where':{'ContactId':_0x534190[_0x4fa5('0x20')]['id']},'include':[{'model':db[_0x3f6b0d],'as':'Account','attributes':['id',_0x4fa5('0x18'),'key']},{'model':db['User'],'as':_0x4fa5('0xe0'),'attributes':['id','name','fullname']},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x4fa5('0x18'),_0x4fa5('0x5f')],'through':{'attributes':[]}}],'order':[['createdAt',_0x4fa5('0xd9')]]};if(_0x534190['query'][_0x4fa5('0xcd')]){_0x51931e[_0x4fa5('0x57')]['createdAt']={'$gte':_0x35b86e['from'],'$lte':_0x35b86e['to']};}switch(_0x4e9319){case _0x4fa5('0xc4'):_0x51931e[_0x4fa5('0x78')]['push'](_0x4fa5('0xe1'),_0x4fa5('0xe2'),_0x4fa5('0xe3'),_0x4fa5('0xe4'),'osName','ratingMessage',_0x4fa5('0xe5'),_0x4fa5('0xe6'),'referer');break;case _0x4fa5('0xc3'):_0x51931e[_0x4fa5('0x78')][_0x4fa5('0x58')](_0x4fa5('0xe7'),_0x4fa5('0xe8'));break;case'openchannel':_0x51931e['attributes']['push']('externalUrl',_0x4fa5('0xe9'));break;}return db[_[_0x4fa5('0xea')](_0x4e9319)+_0x4fa5('0xeb')][_0x4fa5('0xec')](_0x51931e)[_0x4fa5('0x16')](function(_0x2caaac){_0x11f0f1[_0x4fa5('0x13')]+=_0x2caaac['count'];return _['map'](_0x2caaac[_0x4fa5('0x99')],function(_0x4564f0){var _0xd856e4=_0x4564f0[_0x4fa5('0x34')]({'plain':!![]});_0xd856e4[_0x4fa5('0xca')]=_0x4e9319;if(_0xd856e4[_0x4fa5('0xe0')]){_0xd856e4[_0x4fa5('0xe0')]={'id':_0xd856e4['Owner']['id'],'name':_0xd856e4[_0x4fa5('0xe0')]['name'],'fullname':_0xd856e4['Owner'][_0x4fa5('0xdb')]};}return _0xd856e4;});});}});return Promise['all'](_0x2e977d);})[_0x4fa5('0x16')](function(_0x1a25b3){return _(_0x1a25b3)[_0x4fa5('0xed')]()['sortBy'](_0x4fa5('0xd5'))[_0x4fa5('0xee')]()[_0x4fa5('0xef')]();})['then'](function(_0x28d62e){_0x11f0f1['rows']=_0x22b305['limit']?_0x28d62e[_0x4fa5('0xf0')](_0x22b305[_0x4fa5('0x10')],_0x22b305[_0x4fa5('0x10')]+_0x22b305[_0x4fa5('0x11')]):_0x28d62e;return _0x11f0f1;})[_0x4fa5('0x16')](respondWithFilteredResult(_0x589545,_0x22b305))[_0x4fa5('0x1e')](handleError(_0x589545,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 46ab2f4..576be47 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8939=['CmContact','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x590214,_0x25a53b){var _0x4c3347=function(_0x2220c8){while(--_0x2220c8){_0x590214['push'](_0x590214['shift']());}};_0x4c3347(++_0x25a53b);}(_0x8939,0x116));var _0x9893=function(_0x33317f,_0x2c7e17){_0x33317f=_0x33317f-0x0;var _0x282e61=_0x8939[_0x33317f];return _0x282e61;};'use strict';var EventEmitter=require(_0x9893('0x0'));var CmContact=require(_0x9893('0x1'))['db'][_0x9893('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9893('0x3')](0x0);var events={'afterCreate':_0x9893('0x4'),'afterUpdate':_0x9893('0x5'),'afterDestroy':_0x9893('0x6')};function emitEvent(_0x4bfd3a){return function(_0x41f518,_0x1475c2,_0x343e6a){CmContactEvents['emit'](_0x4bfd3a+':'+_0x41f518['id'],_0x41f518);CmContactEvents['emit'](_0x4bfd3a,_0x41f518);_0x343e6a(null);};}for(var e in events){if(events[_0x9893('0x7')](e)){var event=events[e];CmContact[_0x9893('0x8')](e,emitEvent(event));}}module[_0x9893('0x9')]=CmContactEvents; \ No newline at end of file +var _0x8821=['../../mysqldb','CmContact','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x8821,0x15e));var _0x1882=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0x8821[_0x5aa373];return _0x590e8e;};'use strict';var EventEmitter=require(_0x1882('0x0'));var CmContact=require(_0x1882('0x1'))['db'][_0x1882('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1882('0x3'),'afterUpdate':_0x1882('0x4'),'afterDestroy':_0x1882('0x5')};function emitEvent(_0x817d4){return function(_0xec823e,_0x44bbd6,_0x3c51f9){CmContactEvents[_0x1882('0x6')](_0x817d4+':'+_0xec823e['id'],_0xec823e);CmContactEvents[_0x1882('0x6')](_0x817d4,_0xec823e);_0x3c51f9(null);};}for(var e in events){if(events[_0x1882('0x7')](e)){var event=events[e];CmContact[_0x1882('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 6d9d340..58578aa 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaa3=['Lists','length','always','onlyIfOpen','VoiceQueue','CmList','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','BlackLists','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment/shared','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','findOne','then','isNil','timezones','utcOffset','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType'];(function(_0x2f40d0,_0x5055e9){var _0x20ffa4=function(_0x533d4e){while(--_0x533d4e){_0x2f40d0['push'](_0x2f40d0['shift']());}};_0x20ffa4(++_0x5055e9);}(_0xbaa3,0x190));var _0x3baa=function(_0x36d5d5,_0x1c1590){_0x36d5d5=_0x36d5d5-0x0;var _0x4eaa56=_0xbaa3[_0x36d5d5];return _0x4eaa56;};'use strict';var _=require(_0x3baa('0x0'));var util=require(_0x3baa('0x1'));var logger=require('../../config/logger')(_0x3baa('0x2'));var moment=require(_0x3baa('0x3'));var BPromise=require(_0x3baa('0x4'));var rp=require(_0x3baa('0x5'));var fs=require('fs');var path=require(_0x3baa('0x6'));var rimraf=require(_0x3baa('0x7'));var config=require('../../config/environment');var shared=require(_0x3baa('0x8'));var attributes=require('./cmContact.attributes');module['exports']=function(_0x161e38,_0x5146be){return _0x161e38[_0x3baa('0x9')](_0x3baa('0xa'),attributes,{'tableName':_0x3baa('0xb'),'paranoid':!![],'indexes':[{'name':_0x3baa('0xc'),'fields':['phone']},{'name':_0x3baa('0xd'),'fields':[_0x3baa('0xe'),'lastName',_0x3baa('0xc'),_0x3baa('0xf'),_0x3baa('0x10'),_0x3baa('0x11')],'type':_0x3baa('0x12')}],'timestamps':!![],'charset':_0x3baa('0x13'),'collate':_0x3baa('0x14'),'hooks':{'afterCreate':function(_0x2f62e2,_0x4b3784,_0x412352){var _0x38fac9=_0x161e38[_0x3baa('0x15')];var _0x2cdab8=_0x2f62e2[_0x3baa('0x16')]({'plain':!![]});function _0x511275(){return function(_0x28e273){logger[_0x3baa('0x17')](_0x3baa('0x18'),_0x3baa('0x19'),util[_0x3baa('0x1a')](_0x28e273,{'showHidden':![],'depth':null}));};}function _0x56ff1e(_0x5e35d0,_0x1d2ff9){var _0x487f2f=_0x1d2ff9[_0x3baa('0x1b')]?_0x1d2ff9[_0x3baa('0x1b')]:moment()[_0x3baa('0x1c')](_0x3baa('0x1d'));return new BPromise(function(_0x407aa2,_0x48133e){if(_['isNil'](_0x1d2ff9[_0x3baa('0x1e')])){_0x407aa2({'ret':_0x487f2f});}else{_0x38fac9['VoiceQueue'][_0x3baa('0x1f')]({'where':{'id':_0x5e35d0['id']}})[_0x3baa('0x20')](function(_0x3bda30){if(!_[_0x3baa('0x21')](_0x3bda30)){var _0x20f79d=_0x3bda30[_0x3baa('0x1e')];if(!_[_0x3baa('0x21')](_0x20f79d)){var _0x4ffea5=shared[_0x3baa('0x22')];var _0x798d80=_0x4ffea5[_0x20f79d];var _0x3e9cad=_0x4ffea5[_0x1d2ff9['dialTimezone']];if(!_[_0x3baa('0x21')](_0x798d80)&&!_[_0x3baa('0x21')](_0x3e9cad)){var _0xe1b492=_0x798d80['utcOffset']-_0x3e9cad[_0x3baa('0x23')];_0x487f2f=_0x1d2ff9[_0x3baa('0x1b')]?_0x1d2ff9['scheduledat']:moment();var _0x7ba6b2=moment(_0x487f2f)['add'](_0xe1b492,_0x3baa('0x24'));_0x407aa2({'ret':_0x7ba6b2[_0x3baa('0x1c')](_0x3baa('0x1d'))});}else _0x407aa2({'ret':_0x487f2f});}else _0x407aa2({'ret':_0x487f2f});}else{_0x407aa2({'ret':_0x487f2f});}});}});return 0xa;}var _0x1ccdea=function(_0x56c676){return new BPromise(function(_0x3e73cd,_0x5d28c2){_0x56ff1e(_0x56c676,_0x2cdab8)[_0x3baa('0x20')](function(_0x48e82e){_0x2cdab8[_0x3baa('0x1b')]=_0x48e82e[_0x3baa('0x25')];_0x38fac9[_0x3baa('0x26')]['findOne']({'where':{'phone':_0x2cdab8['phone'],'VoiceQueueId':_0x56c676['id']}})[_0x3baa('0x20')](function(_0x12cdde){if(!_[_0x3baa('0x21')](_0x12cdde)){throw new Error(_0x3baa('0x27')+_0x2cdab8[_0x3baa('0xc')]+_0x3baa('0x28')+_0x56c676['id']);}return _0x38fac9[_0x3baa('0x26')][_0x3baa('0x29')]({'phone':_0x2cdab8[_0x3baa('0xc')],'ContactId':_0x2cdab8['id'],'ListId':_0x2cdab8[_0x3baa('0x2a')],'priority':_0x2cdab8[_0x3baa('0x2b')]?_0x2cdab8[_0x3baa('0x2b')]:0x2,'scheduledat':_0x2cdab8[_0x3baa('0x1b')]?_0x2cdab8[_0x3baa('0x1b')]:moment()[_0x3baa('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2cdab8['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2cdab8['callbackUniqueid']?_0x2cdab8[_0x3baa('0x2c')]:undefined,'callbackat':_0x2cdab8[_0x3baa('0x2c')]?moment()[_0x3baa('0x1c')](_0x3baa('0x1d')):undefined,'VoiceQueueId':_0x56c676['id']});})[_0x3baa('0x2d')](function(_0x133454){_0x5d28c2(_0x133454);});});});};var _0x592677=function(_0x4976f1){return new BPromise(function(_0x46e923,_0x397ab7){_0x56ff1e(_0x4976f1,_0x2cdab8)[_0x3baa('0x20')](function(_0x19909f){_0x2cdab8[_0x3baa('0x1b')]=_0x19909f[_0x3baa('0x25')];_0x38fac9[_0x3baa('0x26')][_0x3baa('0x1f')]({'where':{'phone':_0x2cdab8[_0x3baa('0xc')],'VoiceQueueId':_0x4976f1['id']}})[_0x3baa('0x20')](function(_0x599027){if(!_[_0x3baa('0x21')](_0x599027)){throw new Error(_0x3baa('0x27')+_0x2cdab8[_0x3baa('0xc')]+_0x3baa('0x2e')+_0x4976f1['id']);}return _0x38fac9[_0x3baa('0x2f')][_0x3baa('0x1f')]({'where':{'calleridnum':_0x2cdab8[_0x3baa('0xc')],'VoiceQueueId':_0x4976f1['id']}});})[_0x3baa('0x20')](function(_0x4c961a){if(!_['isNil'](_0x4c961a)){throw new Error(_0x3baa('0x30')+_0x2cdab8[_0x3baa('0xc')]+_0x3baa('0x31')+_0x4976f1['id']);}return _0x38fac9[_0x3baa('0x26')][_0x3baa('0x29')]({'phone':_0x2cdab8[_0x3baa('0xc')],'ContactId':_0x2cdab8['id'],'ListId':_0x2cdab8[_0x3baa('0x2a')],'priority':_0x2cdab8[_0x3baa('0x2b')]?_0x2cdab8[_0x3baa('0x2b')]:0x2,'scheduledat':_0x2cdab8['scheduledat']?_0x2cdab8[_0x3baa('0x1b')]:moment()[_0x3baa('0x1c')](_0x3baa('0x1d')),'callback':_0x2cdab8[_0x3baa('0x2c')]?!![]:![],'callbackuniqueid':_0x2cdab8[_0x3baa('0x2c')]?_0x2cdab8[_0x3baa('0x2c')]:undefined,'callbackat':_0x2cdab8[_0x3baa('0x2c')]?moment()[_0x3baa('0x1c')](_0x3baa('0x1d')):undefined,'VoiceQueueId':_0x4976f1['id']});})[_0x3baa('0x2d')](function(_0x4efc6d){_0x397ab7(_0x4efc6d);});});});};function _0x28c3b7(){return function(_0x3b1bd3){logger[_0x3baa('0x17')](_0x3baa('0x18'),_0x3baa('0x19'),util[_0x3baa('0x1a')](_0x3b1bd3,{'showHidden':![],'depth':null}));};}function _0x5a8c1d(_0x384b32,_0x407a12){var _0x157ab5=_0x407a12['scheduledat']?_0x407a12['scheduledat']:moment()['format'](_0x3baa('0x1d'));return new BPromise(function(_0x30e8e8,_0x17eda2){if(_[_0x3baa('0x21')](_0x407a12[_0x3baa('0x1e')])){_0x30e8e8({'ret':_0x157ab5});}else{_0x38fac9['Campaign'][_0x3baa('0x1f')]({'where':{'id':_0x384b32['id']}})[_0x3baa('0x20')](function(_0x476c8e){if(!_['isNil'](_0x476c8e)){var _0x295e73=_0x476c8e[_0x3baa('0x1e')];if(!_[_0x3baa('0x21')](_0x295e73)){var _0x48bd75=shared[_0x3baa('0x22')];var _0x489afa=_0x48bd75[_0x295e73];var _0x15aba0=_0x48bd75[_0x407a12[_0x3baa('0x1e')]];if(!_['isNil'](_0x489afa)&&!_[_0x3baa('0x21')](_0x15aba0)){var _0x18b1de=_0x489afa['utcOffset']-_0x15aba0[_0x3baa('0x23')];_0x157ab5=_0x407a12[_0x3baa('0x1b')]?_0x407a12['scheduledat']:moment();var _0x3996cb=moment(_0x157ab5)[_0x3baa('0x32')](_0x18b1de,_0x3baa('0x24'));_0x30e8e8({'ret':_0x3996cb[_0x3baa('0x1c')](_0x3baa('0x1d'))});}else _0x30e8e8({'ret':_0x157ab5});}else _0x30e8e8({'ret':_0x157ab5});}else{_0x30e8e8({'ret':_0x157ab5});}});}});return 0xa;}var _0xb45338=function(_0x484a8f){return new BPromise(function(_0x4e29f5,_0x4acf08){_0x5a8c1d(_0x484a8f,_0x2cdab8)[_0x3baa('0x20')](function(_0x3a8bb9){_0x2cdab8[_0x3baa('0x1b')]=_0x3a8bb9[_0x3baa('0x25')];_0x38fac9[_0x3baa('0x26')][_0x3baa('0x1f')]({'where':{'phone':_0x2cdab8[_0x3baa('0xc')],'CampaignId':_0x484a8f['id']}})[_0x3baa('0x20')](function(_0x4966cc){if(!_[_0x3baa('0x21')](_0x4966cc)){throw new Error(_0x3baa('0x27')+_0x2cdab8[_0x3baa('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x484a8f['id']);}return _0x38fac9[_0x3baa('0x26')]['create']({'phone':_0x2cdab8[_0x3baa('0xc')],'ContactId':_0x2cdab8['id'],'ListId':_0x2cdab8['ListId'],'priority':_0x2cdab8[_0x3baa('0x2b')]?_0x2cdab8['priority']:0x2,'scheduledat':_0x2cdab8['scheduledat']?_0x2cdab8[_0x3baa('0x1b')]:moment()[_0x3baa('0x1c')](_0x3baa('0x1d')),'callback':_0x2cdab8[_0x3baa('0x2c')]?!![]:![],'callbackuniqueid':_0x2cdab8[_0x3baa('0x2c')]?_0x2cdab8['callbackUniqueid']:undefined,'callbackat':_0x2cdab8[_0x3baa('0x2c')]?moment()['format'](_0x3baa('0x1d')):undefined,'CampaignId':_0x484a8f['id']});})['catch'](function(_0x320661){_0x4acf08(_0x320661);});});});};var _0x294da4=function(_0x5c2af4){return new BPromise(function(_0x42c3ce,_0x2b0f67){_0x5a8c1d(_0x5c2af4,_0x2cdab8)[_0x3baa('0x20')](function(_0x5c7179){_0x2cdab8[_0x3baa('0x1b')]=_0x5c7179['ret'];_0x38fac9[_0x3baa('0x26')][_0x3baa('0x1f')]({'where':{'phone':_0x2cdab8['phone'],'CampaignId':_0x5c2af4['id']}})[_0x3baa('0x20')](function(_0x3578d1){if(!_['isNil'](_0x3578d1)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2cdab8[_0x3baa('0xc')]+_0x3baa('0x33')+_0x5c2af4['id']);}return _0x38fac9['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x2cdab8['phone'],'CampaignId':_0x5c2af4['id']}});})['then'](function(_0x59cfdd){if(!_[_0x3baa('0x21')](_0x59cfdd)){throw new Error(_0x3baa('0x30')+_0x2cdab8[_0x3baa('0xc')]+_0x3baa('0x34')+_0x5c2af4['id']);}return _0x38fac9[_0x3baa('0x26')][_0x3baa('0x29')]({'phone':_0x2cdab8[_0x3baa('0xc')],'ContactId':_0x2cdab8['id'],'ListId':_0x2cdab8['ListId'],'priority':_0x2cdab8[_0x3baa('0x2b')]?_0x2cdab8[_0x3baa('0x2b')]:0x2,'scheduledat':_0x2cdab8[_0x3baa('0x1b')]?_0x2cdab8[_0x3baa('0x1b')]:moment()['format'](_0x3baa('0x1d')),'callback':_0x2cdab8[_0x3baa('0x2c')]?!![]:![],'callbackuniqueid':_0x2cdab8[_0x3baa('0x2c')]?_0x2cdab8[_0x3baa('0x2c')]:undefined,'callbackat':_0x2cdab8['callbackUniqueid']?moment()[_0x3baa('0x1c')](_0x3baa('0x1d')):undefined,'CampaignId':_0x5c2af4['id']});})[_0x3baa('0x2d')](function(_0x43e274){_0x2b0f67(_0x43e274);});});});};if(_0x2cdab8['ListId']){_0x38fac9['VoiceQueue'][_0x3baa('0x35')]({'where':{'type':_0x3baa('0x36')},'attributes':['id',_0x3baa('0x37'),_0x3baa('0x1e')],'include':[{'model':_0x38fac9['CmList'],'as':_0x3baa('0x38'),'where':{'id':_0x2cdab8['ListId']}}]})[_0x3baa('0x20')](function(_0x305fd6){if(_0x305fd6){var _0x277958=[];for(var _0x2069a4=0x0,_0x135243;_0x2069a4<_0x305fd6[_0x3baa('0x39')];_0x2069a4+=0x1){_0x135243=_0x305fd6[_0x2069a4][_0x3baa('0x16')]({'plain':!![]});switch(_0x135243[_0x3baa('0x37')]){case _0x3baa('0x3a'):_0x592677(_0x135243)[_0x3baa('0x2d')](_0x511275());break;case _0x3baa('0x3b'):_0x1ccdea(_0x135243)['catch'](_0x511275());break;default:_0x5a8c1d(_0x135243,_0x2cdab8)[_0x3baa('0x20')](function(_0x276797){_0x2cdab8['scheduledat']=_0x276797[_0x3baa('0x25')];_0x38fac9[_0x3baa('0x26')][_0x3baa('0x29')]({'phone':_0x2cdab8[_0x3baa('0xc')],'ContactId':_0x2cdab8['id'],'ListId':_0x2cdab8[_0x3baa('0x2a')],'scheduledat':_0x2cdab8[_0x3baa('0x1b')]?_0x2cdab8[_0x3baa('0x1b')]:moment()[_0x3baa('0x1c')](_0x3baa('0x1d')),'priority':_0x2cdab8[_0x3baa('0x2b')]?_0x2cdab8[_0x3baa('0x2b')]:0x2,'callback':_0x2cdab8[_0x3baa('0x2c')]?!![]:![],'callbackuniqueid':_0x2cdab8['callbackUniqueid']?_0x2cdab8[_0x3baa('0x2c')]:undefined,'callbackat':_0x2cdab8['callbackUniqueid']?moment()[_0x3baa('0x1c')](_0x3baa('0x1d')):undefined,'VoiceQueueId':_0x135243['id']})[_0x3baa('0x2d')](_0x511275());});}}}})[_0x3baa('0x20')](function(){return _0x38fac9[_0x3baa('0x3c')][_0x3baa('0x35')]({'where':{'type':_0x3baa('0x36')},'attributes':['id'],'include':[{'model':_0x38fac9[_0x3baa('0x3d')],'as':'BlackLists','where':{'id':_0x2cdab8[_0x3baa('0x2a')]}}]})[_0x3baa('0x20')](function(_0x1c38a4){if(_0x1c38a4){var _0x5528d6=[];for(var _0x42a97c=0x0,_0x2836d8;_0x42a97c<_0x1c38a4['length'];_0x42a97c+=0x1){_0x2836d8=_0x1c38a4[_0x42a97c][_0x3baa('0x16')]({'plain':!![]});_0x38fac9[_0x3baa('0x3e')][_0x3baa('0x29')]({'phone':_0x2cdab8['phone'],'ContactId':_0x2cdab8['id'],'ListId':_0x2cdab8[_0x3baa('0x2a')],'VoiceQueueId':_0x2836d8['id']})[_0x3baa('0x2d')](function(_0x256e20){logger[_0x3baa('0x17')](_0x3baa('0x3f'),_0x3baa('0x19'),_0x256e20[_0x3baa('0x40')]);});}}});})['then'](function(){return _0x38fac9[_0x3baa('0x41')]['findAll']({'attributes':['id',_0x3baa('0x37'),_0x3baa('0x1e')],'include':[{'model':_0x38fac9[_0x3baa('0x3d')],'as':_0x3baa('0x38'),'where':{'id':_0x2cdab8[_0x3baa('0x2a')]}}]})[_0x3baa('0x20')](function(_0x485981){if(_0x485981){var _0x561a67=[];for(var _0x35d5f3=0x0,_0xe203f;_0x35d5f3<_0x485981['length'];_0x35d5f3+=0x1){_0xe203f=_0x485981[_0x35d5f3]['get']({'plain':!![]});switch(_0xe203f[_0x3baa('0x37')]){case _0x3baa('0x3a'):_0x294da4(_0xe203f)[_0x3baa('0x2d')](_0x28c3b7());break;case'onlyIfOpen':_0xb45338(_0xe203f)[_0x3baa('0x2d')](_0x28c3b7());break;default:_0x38fac9[_0x3baa('0x26')][_0x3baa('0x29')]({'phone':_0x2cdab8[_0x3baa('0xc')],'ContactId':_0x2cdab8['id'],'ListId':_0x2cdab8[_0x3baa('0x2a')],'scheduledat':_0x2cdab8[_0x3baa('0x1b')]?_0x2cdab8[_0x3baa('0x1b')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2cdab8[_0x3baa('0x2b')]?_0x2cdab8[_0x3baa('0x2b')]:0x2,'callback':_0x2cdab8['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2cdab8[_0x3baa('0x2c')]?_0x2cdab8[_0x3baa('0x2c')]:undefined,'callbackat':_0x2cdab8[_0x3baa('0x2c')]?moment()['format'](_0x3baa('0x1d')):undefined,'CampaignId':_0xe203f['id']})['catch'](_0x28c3b7());}}}});})[_0x3baa('0x20')](function(){return _0x38fac9['Campaign'][_0x3baa('0x35')]({'attributes':['id'],'include':[{'model':_0x38fac9[_0x3baa('0x3d')],'as':_0x3baa('0x42'),'where':{'id':_0x2cdab8[_0x3baa('0x2a')]}}]})['then'](function(_0x507755){if(_0x507755){var _0x26a33d=[];for(var _0x22caae=0x0,_0x39a6b6;_0x22caae<_0x507755[_0x3baa('0x39')];_0x22caae+=0x1){_0x39a6b6=_0x507755[_0x22caae][_0x3baa('0x16')]({'plain':!![]});_0x38fac9['CmHopperBlack'][_0x3baa('0x29')]({'phone':_0x2cdab8['phone'],'ContactId':_0x2cdab8['id'],'ListId':_0x2cdab8[_0x3baa('0x2a')],'CampaignId':_0x39a6b6['id']})['catch'](function(_0x45211b){logger[_0x3baa('0x17')](_0x3baa('0x3f'),_0x3baa('0x19'),_0x45211b[_0x3baa('0x40')]);});}}});})['then'](function(){_0x412352();})[_0x3baa('0x2d')](function(_0x556ab0){logger[_0x3baa('0x17')](_0x3baa('0x3f'),_0x3baa('0x19'),_0x556ab0['message']);_0x412352(_0x556ab0);});}else{_0x412352(new Error(_0x3baa('0x43')));}},'afterDestroy':function(_0x46cdcc,_0x3f21cb,_0x3289c6){var _0x5de85d=_0x161e38['models'];var _0x43f322=_0x46cdcc[_0x3baa('0x16')]({'plain':!![]});return _0x5de85d[_0x3baa('0x26')][_0x3baa('0x35')]({'raw':!![],'where':{'ListId':_0x43f322['ListId'],'ContactId':_0x43f322['id']}})[_0x3baa('0x20')](function(_0x3937bf){if(!_[_0x3baa('0x44')](_0x3937bf)){var _0x31c9fe=[];for(var _0x1f1720=0x0;_0x1f1720<_0x3937bf[_0x3baa('0x39')];_0x1f1720+=0x1){var _0x20be2c=_0x5de85d['CmHopper'][_0x3baa('0x45')]({'where':{'ListId':_0x3937bf[_0x1f1720][_0x3baa('0x2a')],'ContactId':_0x3937bf[_0x1f1720][_0x3baa('0x46')],'VoiceQueueId':_0x3937bf[_0x1f1720][_0x3baa('0x47')],'CampaignId':_0x3937bf[_0x1f1720][_0x3baa('0x48')]}});_0x31c9fe[_0x3baa('0x49')](_0x20be2c);}return BPromise['all'](_0x31c9fe);}})[_0x3baa('0x20')](function(_0x26ac3a){logger[_0x3baa('0x4a')]('[CmContact][afterDestroy][Succesfull]',util[_0x3baa('0x1a')](_0x26ac3a,{'showHidden':![],'depth':null}));_0x3289c6();})[_0x3baa('0x2d')](function(_0x51c08e){logger['error'](_0x3baa('0x4b'),util[_0x3baa('0x1a')](_0x51c08e,{'showHidden':![],'depth':null}));_0x3289c6(_0x51c08e);});}}});}; \ No newline at end of file +var _0x639b=['email','utf8mb4','models','error','cmContact','afterCreate','inspect','scheduledat','format','isNil','dialTimezone','VoiceQueue','then','utcOffset','add','minutes','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','YYYY-MM-DD\x20HH:mm:ss','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','create','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','length','onlyIfOpen','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','get','always','destroy','ContactId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','define','CmContact','cm_contacts','phone','firstName'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x639b,0x7f));var _0xb639=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x639b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb639('0x0'));var util=require('util');var logger=require(_0xb639('0x1'))(_0xb639('0x2'));var moment=require(_0xb639('0x3'));var BPromise=require(_0xb639('0x4'));var rp=require(_0xb639('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb639('0x6'));var config=require(_0xb639('0x7'));var shared=require(_0xb639('0x8'));var attributes=require(_0xb639('0x9'));module['exports']=function(_0x6b0751,_0x5b58e2){return _0x6b0751[_0xb639('0xa')](_0xb639('0xb'),attributes,{'tableName':_0xb639('0xc'),'paranoid':!![],'indexes':[{'name':_0xb639('0xd'),'fields':[_0xb639('0xd')]},{'name':'fti_cm_contacts','fields':[_0xb639('0xe'),'lastName',_0xb639('0xd'),'mobile','fax',_0xb639('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xb639('0x10'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x1dfe4d,_0x5296f9,_0x3d7bee){var _0x31a389=_0x6b0751[_0xb639('0x11')];var _0x573851=_0x1dfe4d['get']({'plain':!![]});function _0x3aeafd(){return function(_0x927a0c){logger[_0xb639('0x12')](_0xb639('0x13'),_0xb639('0x14'),util[_0xb639('0x15')](_0x927a0c,{'showHidden':![],'depth':null}));};}function _0x2dba0d(_0xac674f,_0x1725fd){var _0x2e4682=_0x1725fd[_0xb639('0x16')]?_0x1725fd[_0xb639('0x16')]:moment()[_0xb639('0x17')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x3e8b48,_0x37e3db){if(_[_0xb639('0x18')](_0x1725fd[_0xb639('0x19')])){_0x3e8b48({'ret':_0x2e4682});}else{_0x31a389[_0xb639('0x1a')]['findOne']({'where':{'id':_0xac674f['id']}})[_0xb639('0x1b')](function(_0x15be2f){if(!_[_0xb639('0x18')](_0x15be2f)){var _0x2f93cb=_0x15be2f[_0xb639('0x19')];if(!_[_0xb639('0x18')](_0x2f93cb)){var _0x1df35d=shared['timezones'];var _0x1693f8=_0x1df35d[_0x2f93cb];var _0xe45785=_0x1df35d[_0x1725fd[_0xb639('0x19')]];if(!_[_0xb639('0x18')](_0x1693f8)&&!_[_0xb639('0x18')](_0xe45785)){var _0x5b5d76=_0x1693f8[_0xb639('0x1c')]-_0xe45785['utcOffset'];_0x2e4682=_0x1725fd['scheduledat']?_0x1725fd[_0xb639('0x16')]:moment();var _0x56a309=moment(_0x2e4682)[_0xb639('0x1d')](_0x5b5d76,_0xb639('0x1e'));_0x3e8b48({'ret':_0x56a309[_0xb639('0x17')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x3e8b48({'ret':_0x2e4682});}else _0x3e8b48({'ret':_0x2e4682});}else{_0x3e8b48({'ret':_0x2e4682});}});}});return 0xa;}var _0x11a739=function(_0x4e5b2a){return new BPromise(function(_0x6f1503,_0xfce345){_0x2dba0d(_0x4e5b2a,_0x573851)[_0xb639('0x1b')](function(_0x3476ae){_0x573851['scheduledat']=_0x3476ae['ret'];_0x31a389[_0xb639('0x1f')][_0xb639('0x20')]({'where':{'phone':_0x573851[_0xb639('0xd')],'VoiceQueueId':_0x4e5b2a['id']}})[_0xb639('0x1b')](function(_0x3df5ec){if(!_['isNil'](_0x3df5ec)){throw new Error(_0xb639('0x21')+_0x573851[_0xb639('0xd')]+_0xb639('0x22')+_0x4e5b2a['id']);}return _0x31a389[_0xb639('0x1f')]['create']({'phone':_0x573851[_0xb639('0xd')],'ContactId':_0x573851['id'],'ListId':_0x573851[_0xb639('0x23')],'priority':_0x573851[_0xb639('0x24')]?_0x573851[_0xb639('0x24')]:0x2,'scheduledat':_0x573851[_0xb639('0x16')]?_0x573851[_0xb639('0x16')]:moment()[_0xb639('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x573851[_0xb639('0x25')]?!![]:![],'callbackuniqueid':_0x573851['callbackUniqueid']?_0x573851[_0xb639('0x25')]:undefined,'callbackat':_0x573851[_0xb639('0x25')]?moment()[_0xb639('0x17')](_0xb639('0x26')):undefined,'VoiceQueueId':_0x4e5b2a['id']});})[_0xb639('0x27')](function(_0x54119e){_0xfce345(_0x54119e);});});});};var _0x32a198=function(_0x27e3c8){return new BPromise(function(_0x5cdf5a,_0x46aae1){_0x2dba0d(_0x27e3c8,_0x573851)['then'](function(_0x3dc86b){_0x573851[_0xb639('0x16')]=_0x3dc86b[_0xb639('0x28')];_0x31a389[_0xb639('0x1f')]['findOne']({'where':{'phone':_0x573851[_0xb639('0xd')],'VoiceQueueId':_0x27e3c8['id']}})[_0xb639('0x1b')](function(_0x2d3fed){if(!_['isNil'](_0x2d3fed)){throw new Error('cmContact,\x20afterCreate\x20'+_0x573851[_0xb639('0xd')]+_0xb639('0x29')+_0x27e3c8['id']);}return _0x31a389[_0xb639('0x2a')][_0xb639('0x20')]({'where':{'calleridnum':_0x573851[_0xb639('0xd')],'VoiceQueueId':_0x27e3c8['id']}});})[_0xb639('0x1b')](function(_0x5eb3a8){if(!_[_0xb639('0x18')](_0x5eb3a8)){throw new Error(_0xb639('0x2b')+_0x573851['phone']+_0xb639('0x2c')+_0x27e3c8['id']);}return _0x31a389[_0xb639('0x1f')]['create']({'phone':_0x573851['phone'],'ContactId':_0x573851['id'],'ListId':_0x573851[_0xb639('0x23')],'priority':_0x573851[_0xb639('0x24')]?_0x573851[_0xb639('0x24')]:0x2,'scheduledat':_0x573851['scheduledat']?_0x573851[_0xb639('0x16')]:moment()[_0xb639('0x17')](_0xb639('0x26')),'callback':_0x573851[_0xb639('0x25')]?!![]:![],'callbackuniqueid':_0x573851[_0xb639('0x25')]?_0x573851['callbackUniqueid']:undefined,'callbackat':_0x573851[_0xb639('0x25')]?moment()[_0xb639('0x17')](_0xb639('0x26')):undefined,'VoiceQueueId':_0x27e3c8['id']});})[_0xb639('0x27')](function(_0x479b93){_0x46aae1(_0x479b93);});});});};function _0x338fbf(){return function(_0xef1755){logger[_0xb639('0x12')](_0xb639('0x13'),'afterCreate',util[_0xb639('0x15')](_0xef1755,{'showHidden':![],'depth':null}));};}function _0x566c79(_0x5729bc,_0x4d6207){var _0x4b298d=_0x4d6207[_0xb639('0x16')]?_0x4d6207[_0xb639('0x16')]:moment()['format'](_0xb639('0x26'));return new BPromise(function(_0x552743,_0x4a7c67){if(_[_0xb639('0x18')](_0x4d6207[_0xb639('0x19')])){_0x552743({'ret':_0x4b298d});}else{_0x31a389[_0xb639('0x2d')][_0xb639('0x20')]({'where':{'id':_0x5729bc['id']}})[_0xb639('0x1b')](function(_0x31fad4){if(!_['isNil'](_0x31fad4)){var _0x54bcc6=_0x31fad4[_0xb639('0x19')];if(!_[_0xb639('0x18')](_0x54bcc6)){var _0x4c96f5=shared[_0xb639('0x2e')];var _0x396a97=_0x4c96f5[_0x54bcc6];var _0x4ba54b=_0x4c96f5[_0x4d6207['dialTimezone']];if(!_['isNil'](_0x396a97)&&!_[_0xb639('0x18')](_0x4ba54b)){var _0x4643ea=_0x396a97[_0xb639('0x1c')]-_0x4ba54b[_0xb639('0x1c')];_0x4b298d=_0x4d6207[_0xb639('0x16')]?_0x4d6207[_0xb639('0x16')]:moment();var _0x230902=moment(_0x4b298d)[_0xb639('0x1d')](_0x4643ea,_0xb639('0x1e'));_0x552743({'ret':_0x230902[_0xb639('0x17')](_0xb639('0x26'))});}else _0x552743({'ret':_0x4b298d});}else _0x552743({'ret':_0x4b298d});}else{_0x552743({'ret':_0x4b298d});}});}});return 0xa;}var _0x323f53=function(_0x3c3969){return new BPromise(function(_0x503f78,_0x463eef){_0x566c79(_0x3c3969,_0x573851)[_0xb639('0x1b')](function(_0x5f1b68){_0x573851['scheduledat']=_0x5f1b68[_0xb639('0x28')];_0x31a389[_0xb639('0x1f')][_0xb639('0x20')]({'where':{'phone':_0x573851[_0xb639('0xd')],'CampaignId':_0x3c3969['id']}})['then'](function(_0x42b4c6){if(!_['isNil'](_0x42b4c6)){throw new Error(_0xb639('0x21')+_0x573851[_0xb639('0xd')]+_0xb639('0x2f')+_0x3c3969['id']);}return _0x31a389['CmHopper'][_0xb639('0x30')]({'phone':_0x573851[_0xb639('0xd')],'ContactId':_0x573851['id'],'ListId':_0x573851[_0xb639('0x23')],'priority':_0x573851[_0xb639('0x24')]?_0x573851[_0xb639('0x24')]:0x2,'scheduledat':_0x573851['scheduledat']?_0x573851[_0xb639('0x16')]:moment()[_0xb639('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x573851[_0xb639('0x25')]?!![]:![],'callbackuniqueid':_0x573851['callbackUniqueid']?_0x573851[_0xb639('0x25')]:undefined,'callbackat':_0x573851[_0xb639('0x25')]?moment()['format'](_0xb639('0x26')):undefined,'CampaignId':_0x3c3969['id']});})[_0xb639('0x27')](function(_0x90770){_0x463eef(_0x90770);});});});};var _0x5ee8b2=function(_0x353089){return new BPromise(function(_0x207ef1,_0x1eef30){_0x566c79(_0x353089,_0x573851)[_0xb639('0x1b')](function(_0x2cacca){_0x573851['scheduledat']=_0x2cacca[_0xb639('0x28')];_0x31a389[_0xb639('0x1f')][_0xb639('0x20')]({'where':{'phone':_0x573851[_0xb639('0xd')],'CampaignId':_0x353089['id']}})[_0xb639('0x1b')](function(_0x755be9){if(!_[_0xb639('0x18')](_0x755be9)){throw new Error(_0xb639('0x21')+_0x573851[_0xb639('0xd')]+_0xb639('0x31')+_0x353089['id']);}return _0x31a389[_0xb639('0x2a')][_0xb639('0x20')]({'where':{'calleridnum':_0x573851['phone'],'CampaignId':_0x353089['id']}});})['then'](function(_0x429ac6){if(!_['isNil'](_0x429ac6)){throw new Error(_0xb639('0x2b')+_0x573851[_0xb639('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x353089['id']);}return _0x31a389[_0xb639('0x1f')][_0xb639('0x30')]({'phone':_0x573851[_0xb639('0xd')],'ContactId':_0x573851['id'],'ListId':_0x573851['ListId'],'priority':_0x573851['priority']?_0x573851[_0xb639('0x24')]:0x2,'scheduledat':_0x573851[_0xb639('0x16')]?_0x573851[_0xb639('0x16')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x573851[_0xb639('0x25')]?!![]:![],'callbackuniqueid':_0x573851[_0xb639('0x25')]?_0x573851[_0xb639('0x25')]:undefined,'callbackat':_0x573851['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x353089['id']});})[_0xb639('0x27')](function(_0xb3071a){_0x1eef30(_0xb3071a);});});});};if(_0x573851['ListId']){_0x31a389[_0xb639('0x1a')][_0xb639('0x32')]({'where':{'type':_0xb639('0x33')},'attributes':['id',_0xb639('0x34'),_0xb639('0x19')],'include':[{'model':_0x31a389['CmList'],'as':_0xb639('0x35'),'where':{'id':_0x573851['ListId']}}]})[_0xb639('0x1b')](function(_0x1c578c){if(_0x1c578c){var _0x686cb6=[];for(var _0x578a75=0x0,_0x3b791b;_0x578a75<_0x1c578c[_0xb639('0x36')];_0x578a75+=0x1){_0x3b791b=_0x1c578c[_0x578a75]['get']({'plain':!![]});switch(_0x3b791b['dialCheckDuplicateType']){case'always':_0x32a198(_0x3b791b)['catch'](_0x3aeafd());break;case _0xb639('0x37'):_0x11a739(_0x3b791b)[_0xb639('0x27')](_0x3aeafd());break;default:_0x566c79(_0x3b791b,_0x573851)[_0xb639('0x1b')](function(_0x3ff5f5){_0x573851[_0xb639('0x16')]=_0x3ff5f5[_0xb639('0x28')];_0x31a389[_0xb639('0x1f')][_0xb639('0x30')]({'phone':_0x573851['phone'],'ContactId':_0x573851['id'],'ListId':_0x573851[_0xb639('0x23')],'scheduledat':_0x573851['scheduledat']?_0x573851[_0xb639('0x16')]:moment()[_0xb639('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x573851[_0xb639('0x24')]?_0x573851[_0xb639('0x24')]:0x2,'callback':_0x573851[_0xb639('0x25')]?!![]:![],'callbackuniqueid':_0x573851[_0xb639('0x25')]?_0x573851[_0xb639('0x25')]:undefined,'callbackat':_0x573851[_0xb639('0x25')]?moment()['format'](_0xb639('0x26')):undefined,'VoiceQueueId':_0x3b791b['id']})[_0xb639('0x27')](_0x3aeafd());});}}}})[_0xb639('0x1b')](function(){return _0x31a389['VoiceQueue'][_0xb639('0x32')]({'where':{'type':_0xb639('0x33')},'attributes':['id'],'include':[{'model':_0x31a389[_0xb639('0x38')],'as':_0xb639('0x39'),'where':{'id':_0x573851['ListId']}}]})[_0xb639('0x1b')](function(_0x5d46eb){if(_0x5d46eb){var _0x2c3939=[];for(var _0x145a24=0x0,_0xbd25b;_0x145a24<_0x5d46eb[_0xb639('0x36')];_0x145a24+=0x1){_0xbd25b=_0x5d46eb[_0x145a24]['get']({'plain':!![]});_0x31a389[_0xb639('0x3a')][_0xb639('0x30')]({'phone':_0x573851[_0xb639('0xd')],'ContactId':_0x573851['id'],'ListId':_0x573851[_0xb639('0x23')],'VoiceQueueId':_0xbd25b['id']})[_0xb639('0x27')](function(_0x1e6771){logger[_0xb639('0x12')](_0xb639('0x3b'),_0xb639('0x14'),_0x1e6771[_0xb639('0x3c')]);});}}});})['then'](function(){return _0x31a389[_0xb639('0x2d')][_0xb639('0x32')]({'attributes':['id',_0xb639('0x34'),_0xb639('0x19')],'include':[{'model':_0x31a389['CmList'],'as':_0xb639('0x35'),'where':{'id':_0x573851[_0xb639('0x23')]}}]})[_0xb639('0x1b')](function(_0x8a5178){if(_0x8a5178){var _0x42f268=[];for(var _0x1fdd2f=0x0,_0x5223ae;_0x1fdd2f<_0x8a5178[_0xb639('0x36')];_0x1fdd2f+=0x1){_0x5223ae=_0x8a5178[_0x1fdd2f][_0xb639('0x3d')]({'plain':!![]});switch(_0x5223ae[_0xb639('0x34')]){case _0xb639('0x3e'):_0x5ee8b2(_0x5223ae)[_0xb639('0x27')](_0x338fbf());break;case'onlyIfOpen':_0x323f53(_0x5223ae)['catch'](_0x338fbf());break;default:_0x31a389[_0xb639('0x1f')][_0xb639('0x30')]({'phone':_0x573851[_0xb639('0xd')],'ContactId':_0x573851['id'],'ListId':_0x573851['ListId'],'scheduledat':_0x573851[_0xb639('0x16')]?_0x573851[_0xb639('0x16')]:moment()[_0xb639('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x573851['priority']?_0x573851[_0xb639('0x24')]:0x2,'callback':_0x573851['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x573851[_0xb639('0x25')]?_0x573851[_0xb639('0x25')]:undefined,'callbackat':_0x573851['callbackUniqueid']?moment()[_0xb639('0x17')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5223ae['id']})[_0xb639('0x27')](_0x338fbf());}}}});})[_0xb639('0x1b')](function(){return _0x31a389[_0xb639('0x2d')][_0xb639('0x32')]({'attributes':['id'],'include':[{'model':_0x31a389[_0xb639('0x38')],'as':'BlackLists','where':{'id':_0x573851['ListId']}}]})['then'](function(_0x4abecc){if(_0x4abecc){var _0x519d98=[];for(var _0x44fa99=0x0,_0x4f3464;_0x44fa99<_0x4abecc['length'];_0x44fa99+=0x1){_0x4f3464=_0x4abecc[_0x44fa99][_0xb639('0x3d')]({'plain':!![]});_0x31a389[_0xb639('0x3a')][_0xb639('0x30')]({'phone':_0x573851[_0xb639('0xd')],'ContactId':_0x573851['id'],'ListId':_0x573851[_0xb639('0x23')],'CampaignId':_0x4f3464['id']})['catch'](function(_0x33f3a7){logger[_0xb639('0x12')](_0xb639('0x3b'),_0xb639('0x14'),_0x33f3a7[_0xb639('0x3c')]);});}}});})[_0xb639('0x1b')](function(){_0x3d7bee();})[_0xb639('0x27')](function(_0x1ba38f){logger[_0xb639('0x12')](_0xb639('0x3b'),_0xb639('0x14'),_0x1ba38f[_0xb639('0x3c')]);_0x3d7bee(_0x1ba38f);});}else{_0x3d7bee(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x4f8ea8,_0x4cbfe3,_0x5e6423){var _0x391524=_0x6b0751[_0xb639('0x11')];var _0x54a6c7=_0x4f8ea8[_0xb639('0x3d')]({'plain':!![]});return _0x391524[_0xb639('0x1f')]['findAll']({'raw':!![],'where':{'ListId':_0x54a6c7['ListId'],'ContactId':_0x54a6c7['id']}})[_0xb639('0x1b')](function(_0x528d73){if(!_['isEmpty'](_0x528d73)){var _0x3196ef=[];for(var _0x24a0aa=0x0;_0x24a0aa<_0x528d73[_0xb639('0x36')];_0x24a0aa+=0x1){var _0x1badf3=_0x391524[_0xb639('0x1f')][_0xb639('0x3f')]({'where':{'ListId':_0x528d73[_0x24a0aa][_0xb639('0x23')],'ContactId':_0x528d73[_0x24a0aa][_0xb639('0x40')],'VoiceQueueId':_0x528d73[_0x24a0aa]['VoiceQueueId'],'CampaignId':_0x528d73[_0x24a0aa][_0xb639('0x41')]}});_0x3196ef[_0xb639('0x42')](_0x1badf3);}return BPromise[_0xb639('0x43')](_0x3196ef);}})[_0xb639('0x1b')](function(_0xb6ee92){logger[_0xb639('0x44')](_0xb639('0x45'),util[_0xb639('0x15')](_0xb6ee92,{'showHidden':![],'depth':null}));_0x5e6423();})[_0xb639('0x27')](function(_0x1c0880){logger[_0xb639('0x12')](_0xb639('0x46'),util['inspect'](_0x1c0880,{'showHidden':![],'depth':null}));_0x5e6423(_0x1c0880);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index e981d70..ee25be6 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x27e2c2,_0x5896bd){var _0x481414=function(_0x30b65b){while(--_0x30b65b){_0x27e2c2['push'](_0x27e2c2['shift']());}};_0x481414(++_0x5896bd);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});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);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3070b1,_0x569810){var _0x2e1020=function(_0x4dd759){while(--_0x4dd759){_0x3070b1['push'](_0x3070b1['shift']());}};_0x2e1020(++_0x569810);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index cb5571b..2839695 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc874=['sequelize','INTEGER','STRING','PHONE'];(function(_0x4da8c4,_0x165083){var _0x2aa9ea=function(_0x82bf87){while(--_0x82bf87){_0x4da8c4['push'](_0x4da8c4['shift']());}};_0x2aa9ea(++_0x165083);}(_0xc874,0x154));var _0x4c87=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xc874[_0x3f2a90];return _0xb46279;};'use strict';var Sequelize=require(_0x4c87('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x4c87('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x4c87('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x4c87('0x3')},'OrderBy':{'type':Sequelize[_0x4c87('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x4c87('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x7e16=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x497eb3,_0x234fd2){var _0x326757=function(_0x1d0abe){while(--_0x1d0abe){_0x497eb3['push'](_0x497eb3['shift']());}};_0x326757(++_0x234fd2);}(_0x7e16,0x16f));var _0x67e1=function(_0x581691,_0x561bc6){_0x581691=_0x581691-0x0;var _0x515546=_0x7e16[_0x581691];return _0x515546;};'use strict';var Sequelize=require(_0x67e1('0x0'));module[_0x67e1('0x1')]={'CmContactId':{'type':Sequelize[_0x67e1('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x67e1('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x67e1('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x67e1('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index a07e503..6a9feb0 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a2a=['../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','autoAssociation','catch','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x26d457,_0x194d25){var _0x343508=function(_0x3e5855){while(--_0x3e5855){_0x26d457['push'](_0x26d457['shift']());}};_0x343508(++_0x194d25);}(_0x1a2a,0xde));var _0xa1a2=function(_0x545e86,_0x46a2ed){_0x545e86=_0x545e86-0x0;var _0xa98055=_0x1a2a[_0x545e86];return _0xa98055;};'use strict';var emlformat=require(_0xa1a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa1a2('0x1'));var rp=require(_0xa1a2('0x2'));var moment=require(_0xa1a2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa1a2('0x4'));var util=require(_0xa1a2('0x5'));var path=require(_0xa1a2('0x6'));var sox=require(_0xa1a2('0x7'));var csv=require(_0xa1a2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1a2('0x9'));var _=require('lodash');var squel=require(_0xa1a2('0xa'));var crypto=require('crypto');var jsforce=require(_0xa1a2('0xb'));var deskjs=require(_0xa1a2('0xc'));var toCsv=require(_0xa1a2('0x8'));var querystring=require(_0xa1a2('0xd'));var Papa=require(_0xa1a2('0xe'));var Redis=require(_0xa1a2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1a2('0x10'));var as=require(_0xa1a2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1a2('0x12'))(_0xa1a2('0x13'));var utils=require(_0xa1a2('0x14'));var config=require(_0xa1a2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1a2('0x16'))['db'];function respondWithStatusCode(_0x28b095,_0x4d78f7){_0x4d78f7=_0x4d78f7||0xcc;return function(_0x35a41c){if(_0x35a41c){return _0x28b095[_0xa1a2('0x17')](_0x4d78f7);}return _0x28b095[_0xa1a2('0x18')](_0x4d78f7)['end']();};}function respondWithResult(_0x409c07,_0x4b39ca){_0x4b39ca=_0x4b39ca||0xc8;return function(_0x24a435){if(_0x24a435){return _0x409c07[_0xa1a2('0x18')](_0x4b39ca)[_0xa1a2('0x19')](_0x24a435);}};}function respondWithFilteredResult(_0x5adbfa,_0x295a22){return function(_0x7e221e){if(_0x7e221e){var _0x5011ce=typeof _0x295a22[_0xa1a2('0x1a')]==='undefined'&&typeof _0x295a22[_0xa1a2('0x1b')]===_0xa1a2('0x1c');var _0x4bebe8=_0x7e221e['count'];var _0x47e45f=_0x5011ce?0x0:_0x295a22[_0xa1a2('0x1a')];var _0x4448fe=_0x5011ce?_0x7e221e['count']:_0x295a22['offset']+_0x295a22[_0xa1a2('0x1b')];var _0x3097d8;if(_0x4448fe>=_0x4bebe8){_0x4448fe=_0x4bebe8;_0x3097d8=0xc8;}else{_0x3097d8=0xce;}_0x5adbfa[_0xa1a2('0x18')](_0x3097d8);return _0x5adbfa[_0xa1a2('0x1d')](_0xa1a2('0x1e'),_0x47e45f+'-'+_0x4448fe+'/'+_0x4bebe8)['json'](_0x7e221e);}return null;};}function patchUpdates(_0x130b5b){return function(_0x479224){try{jsonpatch[_0xa1a2('0x1f')](_0x479224,_0x130b5b,!![]);}catch(_0x8026){return BPromise[_0xa1a2('0x20')](_0x8026);}return _0x479224[_0xa1a2('0x21')]();};}function saveUpdates(_0xb6c75a,_0x5e80d9){return function(_0x12daf8){if(_0x12daf8){return _0x12daf8[_0xa1a2('0x22')](_0xb6c75a)[_0xa1a2('0x23')](function(_0x20a165){return _0x20a165;});}return null;};}function removeEntity(_0x1164b5,_0x254676){return function(_0x1150c0){if(_0x1150c0){return _0x1150c0[_0xa1a2('0x24')]()['then'](function(){var _0xc403f6=_0x1150c0['get']({'plain':!![]});var _0x4ee945='CmContactHasItems';return db[_0xa1a2('0x25')][_0xa1a2('0x24')]({'where':{'type':_0x4ee945,'resourceId':_0xc403f6['id']}})[_0xa1a2('0x23')](function(){return _0x1150c0;});})[_0xa1a2('0x23')](function(){_0x1164b5[_0xa1a2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56649e,_0x209fb4){return function(_0x3c1c1f){if(!_0x3c1c1f){_0x56649e['sendStatus'](0x194);}return _0x3c1c1f;};}function handleError(_0x443a4c,_0x539a5f){_0x539a5f=_0x539a5f||0x1f4;return function(_0xb3c661){logger['error'](_0xb3c661[_0xa1a2('0x26')]);if(_0xb3c661[_0xa1a2('0x27')]){delete _0xb3c661[_0xa1a2('0x27')];}_0x443a4c['status'](_0x539a5f)[_0xa1a2('0x28')](_0xb3c661);};}exports[_0xa1a2('0x29')]=function(_0x5b790c,_0x493766){var _0x171fcf={},_0x4230c8={},_0x26ed3b={'count':0x0,'rows':[]};var _0x3edbaf=_[_0xa1a2('0x2a')](db[_0xa1a2('0x2b')][_0xa1a2('0x2c')],function(_0x30574e){return{'name':_0x30574e[_0xa1a2('0x2d')],'type':_0x30574e[_0xa1a2('0x2e')]['key']};});_0x4230c8['model']=_[_0xa1a2('0x2a')](_0x3edbaf,_0xa1a2('0x27'));_0x4230c8[_0xa1a2('0x2f')]=_[_0xa1a2('0x30')](_0x5b790c[_0xa1a2('0x2f')]);_0x4230c8[_0xa1a2('0x31')]=_[_0xa1a2('0x32')](_0x4230c8[_0xa1a2('0x33')],_0x4230c8[_0xa1a2('0x2f')]);_0x171fcf[_0xa1a2('0x34')]=_[_0xa1a2('0x32')](_0x4230c8[_0xa1a2('0x33')],qs[_0xa1a2('0x35')](_0x5b790c['query']['fields']));_0x171fcf[_0xa1a2('0x34')]=_0x171fcf[_0xa1a2('0x34')][_0xa1a2('0x36')]?_0x171fcf[_0xa1a2('0x34')]:_0x4230c8['model'];if(!_0x5b790c['query'][_0xa1a2('0x37')]('nolimit')){_0x171fcf[_0xa1a2('0x1b')]=qs[_0xa1a2('0x1b')](_0x5b790c[_0xa1a2('0x2f')][_0xa1a2('0x1b')]);_0x171fcf[_0xa1a2('0x1a')]=qs[_0xa1a2('0x1a')](_0x5b790c['query']['offset']);}_0x171fcf[_0xa1a2('0x38')]=qs[_0xa1a2('0x39')](_0x5b790c[_0xa1a2('0x2f')]['sort']);_0x171fcf[_0xa1a2('0x3a')]=qs[_0xa1a2('0x31')](_[_0xa1a2('0x3b')](_0x5b790c['query'],_0x4230c8[_0xa1a2('0x31')]),_0x3edbaf);if(_0x5b790c[_0xa1a2('0x2f')][_0xa1a2('0x3c')]){_0x171fcf[_0xa1a2('0x3a')]=_[_0xa1a2('0x3d')](_0x171fcf['where'],{'$or':_['map'](_0x3edbaf,function(_0x320e3d){if(_0x320e3d[_0xa1a2('0x2e')]!==_0xa1a2('0x3e')){var _0x23bb3c={};_0x23bb3c[_0x320e3d['name']]={'$like':'%'+_0x5b790c[_0xa1a2('0x2f')]['filter']+'%'};return _0x23bb3c;}})});}_0x171fcf=_[_0xa1a2('0x3d')]({},_0x171fcf,_0x5b790c[_0xa1a2('0x3f')]);var _0x3f9d89={'where':_0x171fcf['where']};return db[_0xa1a2('0x2b')][_0xa1a2('0x40')](_0x3f9d89)[_0xa1a2('0x23')](function(_0x16f05b){_0x26ed3b[_0xa1a2('0x40')]=_0x16f05b;if(_0x5b790c['query'][_0xa1a2('0x41')]){_0x171fcf[_0xa1a2('0x42')]=[{'all':!![]}];}return db[_0xa1a2('0x2b')][_0xa1a2('0x43')](_0x171fcf);})['then'](function(_0x5daeba){_0x26ed3b[_0xa1a2('0x44')]=_0x5daeba;return _0x26ed3b;})[_0xa1a2('0x23')](respondWithFilteredResult(_0x493766,_0x171fcf))['catch'](handleError(_0x493766,null));};exports[_0xa1a2('0x45')]=function(_0x17686b,_0x376a10){var _0xe3a28c={'raw':!![],'where':{'id':_0x17686b[_0xa1a2('0x46')]['id']}},_0x57aeb6={};_0x57aeb6[_0xa1a2('0x33')]=_[_0xa1a2('0x30')](db['CmContactHasItem'][_0xa1a2('0x2c')]);_0x57aeb6['query']=_['keys'](_0x17686b['query']);_0x57aeb6[_0xa1a2('0x31')]=_[_0xa1a2('0x32')](_0x57aeb6['model'],_0x57aeb6['query']);_0xe3a28c[_0xa1a2('0x34')]=_[_0xa1a2('0x32')](_0x57aeb6[_0xa1a2('0x33')],qs[_0xa1a2('0x35')](_0x17686b['query'][_0xa1a2('0x35')]));_0xe3a28c['attributes']=_0xe3a28c[_0xa1a2('0x34')][_0xa1a2('0x36')]?_0xe3a28c[_0xa1a2('0x34')]:_0x57aeb6[_0xa1a2('0x33')];if(_0x17686b[_0xa1a2('0x2f')][_0xa1a2('0x41')]){_0xe3a28c[_0xa1a2('0x42')]=[{'all':!![]}];}_0xe3a28c=_[_0xa1a2('0x3d')]({},_0xe3a28c,_0x17686b['options']);return db[_0xa1a2('0x2b')][_0xa1a2('0x47')](_0xe3a28c)['then'](handleEntityNotFound(_0x376a10,null))[_0xa1a2('0x23')](respondWithResult(_0x376a10,null))['catch'](handleError(_0x376a10,null));};exports['create']=function(_0x258aa4,_0x1080c4){return db['CmContactHasItem'][_0xa1a2('0x48')](_0x258aa4[_0xa1a2('0x49')],{})['then'](function(_0x2babd9){var _0x52cc05=_0x258aa4[_0xa1a2('0x4a')]['get']({'plain':!![]});if(!_0x52cc05)throw new Error(_0xa1a2('0x4b'));if(_0x52cc05[_0xa1a2('0x4c')]==='user'){var _0x5b9b43=_0x2babd9['get']({'plain':!![]});var _0x22ef6b=_0xa1a2('0x4d');return db[_0xa1a2('0x4e')][_0xa1a2('0x47')]({'where':{'name':_0x22ef6b,'userProfileId':_0x52cc05['userProfileId']},'raw':!![]})[_0xa1a2('0x23')](function(_0x441672){if(_0x441672&&_0x441672[_0xa1a2('0x4f')]===0x0){return db[_0xa1a2('0x25')]['create']({'name':_0x5b9b43[_0xa1a2('0x27')],'resourceId':_0x5b9b43['id'],'type':_0x441672['name'],'sectionId':_0x441672['id']},{})[_0xa1a2('0x23')](function(){return _0x2babd9;});}else{return _0x2babd9;}})[_0xa1a2('0x50')](function(_0x5b28f3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b28f3);throw _0x5b28f3;});}return _0x2babd9;})['then'](respondWithResult(_0x1080c4,0xc9))[_0xa1a2('0x50')](handleError(_0x1080c4,null));};exports[_0xa1a2('0x22')]=function(_0x235f15,_0x11481c){if(_0x235f15[_0xa1a2('0x49')]['id']){delete _0x235f15[_0xa1a2('0x49')]['id'];}return db[_0xa1a2('0x2b')][_0xa1a2('0x47')]({'where':{'id':_0x235f15[_0xa1a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x11481c,null))[_0xa1a2('0x23')](saveUpdates(_0x235f15[_0xa1a2('0x49')],null))[_0xa1a2('0x23')](respondWithResult(_0x11481c,null))[_0xa1a2('0x50')](handleError(_0x11481c,null));};exports[_0xa1a2('0x24')]=function(_0x25138d,_0x210458){return db[_0xa1a2('0x2b')][_0xa1a2('0x47')]({'where':{'id':_0x25138d[_0xa1a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x210458,null))[_0xa1a2('0x23')](removeEntity(_0x210458,null))[_0xa1a2('0x50')](handleError(_0x210458,null));}; \ No newline at end of file +var _0xc49c=['destroy','error','name','send','index','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmContactHasItem','include','findAll','rows','catch','show','params','includeAll','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0xe9b670,_0x208e68){var _0x31c2f2=function(_0x2f5823){while(--_0x2f5823){_0xe9b670['push'](_0xe9b670['shift']());}};_0x31c2f2(++_0x208e68);}(_0xc49c,0xcc));var _0xcc49=function(_0x557d63,_0xf5102f){_0x557d63=_0x557d63-0x0;var _0x3468c6=_0xc49c[_0x557d63];return _0x3468c6;};'use strict';var emlformat=require(_0xcc49('0x0'));var rimraf=require(_0xcc49('0x1'));var zipdir=require(_0xcc49('0x2'));var jsonpatch=require(_0xcc49('0x3'));var rp=require('request-promise');var moment=require(_0xcc49('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcc49('0x5'));var util=require(_0xcc49('0x6'));var path=require(_0xcc49('0x7'));var sox=require(_0xcc49('0x8'));var csv=require('to-csv');var ejs=require(_0xcc49('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc49('0xa'));var squel=require(_0xcc49('0xb'));var crypto=require(_0xcc49('0xc'));var jsforce=require(_0xcc49('0xd'));var deskjs=require(_0xcc49('0xe'));var toCsv=require(_0xcc49('0xf'));var querystring=require('querystring');var Papa=require(_0xcc49('0x10'));var Redis=require(_0xcc49('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcc49('0x12'));var as=require(_0xcc49('0x13'));var hardwareService=require(_0xcc49('0x14'));var logger=require(_0xcc49('0x15'))('api');var utils=require(_0xcc49('0x16'));var config=require(_0xcc49('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d1b08,_0xb55f36){_0xb55f36=_0xb55f36||0xcc;return function(_0x38c2c5){if(_0x38c2c5){return _0x4d1b08[_0xcc49('0x18')](_0xb55f36);}return _0x4d1b08[_0xcc49('0x19')](_0xb55f36)[_0xcc49('0x1a')]();};}function respondWithResult(_0x4f8b34,_0x456878){_0x456878=_0x456878||0xc8;return function(_0x557791){if(_0x557791){return _0x4f8b34['status'](_0x456878)[_0xcc49('0x1b')](_0x557791);}};}function respondWithFilteredResult(_0x4173db,_0x46a158){return function(_0x3f1b40){if(_0x3f1b40){var _0x1d8d88=typeof _0x46a158[_0xcc49('0x1c')]===_0xcc49('0x1d')&&typeof _0x46a158[_0xcc49('0x1e')]===_0xcc49('0x1d');var _0x551717=_0x3f1b40[_0xcc49('0x1f')];var _0x3e8a3e=_0x1d8d88?0x0:_0x46a158[_0xcc49('0x1c')];var _0x5c609e=_0x1d8d88?_0x3f1b40[_0xcc49('0x1f')]:_0x46a158[_0xcc49('0x1c')]+_0x46a158[_0xcc49('0x1e')];var _0x1b47c8;if(_0x5c609e>=_0x551717){_0x5c609e=_0x551717;_0x1b47c8=0xc8;}else{_0x1b47c8=0xce;}_0x4173db[_0xcc49('0x19')](_0x1b47c8);return _0x4173db[_0xcc49('0x20')](_0xcc49('0x21'),_0x3e8a3e+'-'+_0x5c609e+'/'+_0x551717)[_0xcc49('0x1b')](_0x3f1b40);}return null;};}function patchUpdates(_0x196ed4){return function(_0x18c8c0){try{jsonpatch[_0xcc49('0x22')](_0x18c8c0,_0x196ed4,!![]);}catch(_0x4c7335){return BPromise[_0xcc49('0x23')](_0x4c7335);}return _0x18c8c0[_0xcc49('0x24')]();};}function saveUpdates(_0x38ce49,_0xc53f04){return function(_0x14efa6){if(_0x14efa6){return _0x14efa6[_0xcc49('0x25')](_0x38ce49)[_0xcc49('0x26')](function(_0x4d0d9e){return _0x4d0d9e;});}return null;};}function removeEntity(_0x5a7e7f,_0x1f4d68){return function(_0x71752d){if(_0x71752d){return _0x71752d[_0xcc49('0x27')]()[_0xcc49('0x26')](function(){var _0x586b44=_0x71752d['get']({'plain':!![]});var _0x59de8f='CmContactHasItems';return db['UserProfileResource'][_0xcc49('0x27')]({'where':{'type':_0x59de8f,'resourceId':_0x586b44['id']}})[_0xcc49('0x26')](function(){return _0x71752d;});})[_0xcc49('0x26')](function(){_0x5a7e7f[_0xcc49('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb7e0,_0x29ddaa){return function(_0x1b6934){if(!_0x1b6934){_0x1eb7e0[_0xcc49('0x18')](0x194);}return _0x1b6934;};}function handleError(_0x14783a,_0x5ecf53){_0x5ecf53=_0x5ecf53||0x1f4;return function(_0x24ebe8){logger[_0xcc49('0x28')](_0x24ebe8['stack']);if(_0x24ebe8[_0xcc49('0x29')]){delete _0x24ebe8[_0xcc49('0x29')];}_0x14783a[_0xcc49('0x19')](_0x5ecf53)[_0xcc49('0x2a')](_0x24ebe8);};}exports[_0xcc49('0x2b')]=function(_0x35f46a,_0x581b46){var _0x353b88={},_0x5cb557={},_0x4e8850={'count':0x0,'rows':[]};var _0x157046=_['map'](db['CmContactHasItem'][_0xcc49('0x2c')],function(_0x49bd3b){return{'name':_0x49bd3b['fieldName'],'type':_0x49bd3b[_0xcc49('0x2d')]['key']};});_0x5cb557[_0xcc49('0x2e')]=_[_0xcc49('0x2f')](_0x157046,_0xcc49('0x29'));_0x5cb557['query']=_[_0xcc49('0x30')](_0x35f46a[_0xcc49('0x31')]);_0x5cb557[_0xcc49('0x32')]=_[_0xcc49('0x33')](_0x5cb557[_0xcc49('0x2e')],_0x5cb557['query']);_0x353b88[_0xcc49('0x34')]=_['intersection'](_0x5cb557[_0xcc49('0x2e')],qs[_0xcc49('0x35')](_0x35f46a[_0xcc49('0x31')][_0xcc49('0x35')]));_0x353b88[_0xcc49('0x34')]=_0x353b88[_0xcc49('0x34')]['length']?_0x353b88['attributes']:_0x5cb557['model'];if(!_0x35f46a[_0xcc49('0x31')][_0xcc49('0x36')](_0xcc49('0x37'))){_0x353b88[_0xcc49('0x1e')]=qs['limit'](_0x35f46a[_0xcc49('0x31')][_0xcc49('0x1e')]);_0x353b88[_0xcc49('0x1c')]=qs['offset'](_0x35f46a['query'][_0xcc49('0x1c')]);}_0x353b88[_0xcc49('0x38')]=qs['sort'](_0x35f46a[_0xcc49('0x31')][_0xcc49('0x39')]);_0x353b88[_0xcc49('0x3a')]=qs[_0xcc49('0x32')](_[_0xcc49('0x3b')](_0x35f46a[_0xcc49('0x31')],_0x5cb557[_0xcc49('0x32')]),_0x157046);if(_0x35f46a[_0xcc49('0x31')][_0xcc49('0x3c')]){_0x353b88[_0xcc49('0x3a')]=_[_0xcc49('0x3d')](_0x353b88['where'],{'$or':_[_0xcc49('0x2f')](_0x157046,function(_0x4c63f8){if(_0x4c63f8['type']!==_0xcc49('0x3e')){var _0x146573={};_0x146573[_0x4c63f8[_0xcc49('0x29')]]={'$like':'%'+_0x35f46a[_0xcc49('0x31')][_0xcc49('0x3c')]+'%'};return _0x146573;}})});}_0x353b88=_[_0xcc49('0x3d')]({},_0x353b88,_0x35f46a[_0xcc49('0x3f')]);var _0x5b329e={'where':_0x353b88[_0xcc49('0x3a')]};return db[_0xcc49('0x40')][_0xcc49('0x1f')](_0x5b329e)['then'](function(_0x35cd4a){_0x4e8850[_0xcc49('0x1f')]=_0x35cd4a;if(_0x35f46a[_0xcc49('0x31')]['includeAll']){_0x353b88[_0xcc49('0x41')]=[{'all':!![]}];}return db[_0xcc49('0x40')][_0xcc49('0x42')](_0x353b88);})[_0xcc49('0x26')](function(_0x4388a7){_0x4e8850[_0xcc49('0x43')]=_0x4388a7;return _0x4e8850;})[_0xcc49('0x26')](respondWithFilteredResult(_0x581b46,_0x353b88))[_0xcc49('0x44')](handleError(_0x581b46,null));};exports[_0xcc49('0x45')]=function(_0x13c630,_0x41acbc){var _0x28aade={'raw':!![],'where':{'id':_0x13c630[_0xcc49('0x46')]['id']}},_0x1f8d03={};_0x1f8d03[_0xcc49('0x2e')]=_[_0xcc49('0x30')](db['CmContactHasItem']['rawAttributes']);_0x1f8d03[_0xcc49('0x31')]=_[_0xcc49('0x30')](_0x13c630['query']);_0x1f8d03['filters']=_['intersection'](_0x1f8d03[_0xcc49('0x2e')],_0x1f8d03[_0xcc49('0x31')]);_0x28aade['attributes']=_['intersection'](_0x1f8d03[_0xcc49('0x2e')],qs[_0xcc49('0x35')](_0x13c630[_0xcc49('0x31')][_0xcc49('0x35')]));_0x28aade[_0xcc49('0x34')]=_0x28aade[_0xcc49('0x34')]['length']?_0x28aade[_0xcc49('0x34')]:_0x1f8d03['model'];if(_0x13c630[_0xcc49('0x31')][_0xcc49('0x47')]){_0x28aade[_0xcc49('0x41')]=[{'all':!![]}];}_0x28aade=_['merge']({},_0x28aade,_0x13c630['options']);return db[_0xcc49('0x40')][_0xcc49('0x48')](_0x28aade)[_0xcc49('0x26')](handleEntityNotFound(_0x41acbc,null))[_0xcc49('0x26')](respondWithResult(_0x41acbc,null))['catch'](handleError(_0x41acbc,null));};exports['create']=function(_0x21d08c,_0x3a8e33){return db[_0xcc49('0x40')]['create'](_0x21d08c['body'],{})[_0xcc49('0x26')](function(_0x22c4da){var _0x419849=_0x21d08c[_0xcc49('0x49')][_0xcc49('0x4a')]({'plain':!![]});if(!_0x419849)throw new Error(_0xcc49('0x4b'));if(_0x419849['role']===_0xcc49('0x49')){var _0x51b1f1=_0x22c4da[_0xcc49('0x4a')]({'plain':!![]});var _0x3ddacd=_0xcc49('0x4c');return db['UserProfileSection'][_0xcc49('0x48')]({'where':{'name':_0x3ddacd,'userProfileId':_0x419849['userProfileId']},'raw':!![]})['then'](function(_0x3f27b3){if(_0x3f27b3&&_0x3f27b3['autoAssociation']===0x0){return db[_0xcc49('0x4d')][_0xcc49('0x4e')]({'name':_0x51b1f1[_0xcc49('0x29')],'resourceId':_0x51b1f1['id'],'type':_0x3f27b3['name'],'sectionId':_0x3f27b3['id']},{})['then'](function(){return _0x22c4da;});}else{return _0x22c4da;}})[_0xcc49('0x44')](function(_0x53d618){logger[_0xcc49('0x28')](_0xcc49('0x4f'),_0x53d618);throw _0x53d618;});}return _0x22c4da;})[_0xcc49('0x26')](respondWithResult(_0x3a8e33,0xc9))['catch'](handleError(_0x3a8e33,null));};exports[_0xcc49('0x25')]=function(_0x53c505,_0x189e30){if(_0x53c505['body']['id']){delete _0x53c505[_0xcc49('0x50')]['id'];}return db[_0xcc49('0x40')][_0xcc49('0x48')]({'where':{'id':_0x53c505['params']['id']}})[_0xcc49('0x26')](handleEntityNotFound(_0x189e30,null))[_0xcc49('0x26')](saveUpdates(_0x53c505[_0xcc49('0x50')],null))[_0xcc49('0x26')](respondWithResult(_0x189e30,null))[_0xcc49('0x44')](handleError(_0x189e30,null));};exports['destroy']=function(_0x45a61a,_0x2799e1){return db[_0xcc49('0x40')][_0xcc49('0x48')]({'where':{'id':_0x45a61a[_0xcc49('0x46')]['id']}})['then'](handleEntityNotFound(_0x2799e1,null))[_0xcc49('0x26')](removeEntity(_0x2799e1,null))[_0xcc49('0x44')](handleError(_0x2799e1,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 8eb93e2..a264cee 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ab4=['../../config/logger','api','moment','bluebird','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash'];(function(_0x15d13d,_0x203689){var _0x2eadf5=function(_0x352ee8){while(--_0x352ee8){_0x15d13d['push'](_0x15d13d['shift']());}};_0x2eadf5(++_0x203689);}(_0x4ab4,0x1b7));var _0x44ab=function(_0x42672d,_0x972b32){_0x42672d=_0x42672d-0x0;var _0x5b03de=_0x4ab4[_0x42672d];return _0x5b03de;};'use strict';var _=require(_0x44ab('0x0'));var util=require('util');var logger=require(_0x44ab('0x1'))(_0x44ab('0x2'));var moment=require(_0x44ab('0x3'));var BPromise=require(_0x44ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x44ab('0x5'));var rimraf=require('rimraf');var config=require(_0x44ab('0x6'));var attributes=require(_0x44ab('0x7'));module[_0x44ab('0x8')]=function(_0x90fc11,_0x3b140f){return _0x90fc11[_0x44ab('0x9')](_0x44ab('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5ed=['bluebird','request-promise','path','rimraf','../../config/environment','define','CmContactHasItem','util','api'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xe5ed,0x10c));var _0xde5e=function(_0x5b4710,_0x4e9cd8){_0x5b4710=_0x5b4710-0x0;var _0xb44355=_0xe5ed[_0x5b4710];return _0xb44355;};'use strict';var _=require('lodash');var util=require(_0xde5e('0x0'));var logger=require('../../config/logger')(_0xde5e('0x1'));var moment=require('moment');var BPromise=require(_0xde5e('0x2'));var rp=require(_0xde5e('0x3'));var fs=require('fs');var path=require(_0xde5e('0x4'));var rimraf=require(_0xde5e('0x5'));var config=require(_0xde5e('0x6'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x46eaed,_0x117bf8){return _0x46eaed[_0xde5e('0x7')](_0xde5e('0x8'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 6d53dbd..c7ab977 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66be=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x66be,0x147));var _0xe66b=function(_0x7344e5,_0x51fa40){_0x7344e5=_0x7344e5-0x0;var _0x4978e4=_0x66be[_0x7344e5];return _0x4978e4;};'use strict';var _=require(_0xe66b('0x0'));var util=require('util');var moment=require(_0xe66b('0x1'));var BPromise=require(_0xe66b('0x2'));var rs=require(_0xe66b('0x3'));var fs=require('fs');var Redis=require(_0xe66b('0x4'));var db=require(_0xe66b('0x5'))['db'];var utils=require(_0xe66b('0x6'));var logger=require(_0xe66b('0x7'))(_0xe66b('0x8'));var config=require(_0xe66b('0x9'));var jayson=require(_0xe66b('0xa'));var client=jayson[_0xe66b('0xb')][_0xe66b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b299b,_0x316f2f,_0x462463){return new BPromise(function(_0x584cab,_0x1f0970){return client[_0xe66b('0xd')](_0x3b299b,_0x462463)[_0xe66b('0xe')](function(_0x499aed){logger[_0xe66b('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x316f2f,_0xe66b('0x10'));logger[_0xe66b('0x11')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x316f2f,'request\x20sent',JSON[_0xe66b('0x12')](_0x499aed));if(_0x499aed['error']){if(_0x499aed[_0xe66b('0x13')][_0xe66b('0x14')]===0x1f4){logger[_0xe66b('0x13')](_0xe66b('0x15'),_0x316f2f,_0x499aed[_0xe66b('0x13')]['message']);return _0x1f0970(_0x499aed[_0xe66b('0x13')][_0xe66b('0x16')]);}logger[_0xe66b('0x13')](_0xe66b('0x15'),_0x316f2f,_0x499aed[_0xe66b('0x13')][_0xe66b('0x16')]);return _0x584cab(_0x499aed[_0xe66b('0x13')][_0xe66b('0x16')]);}else{logger[_0xe66b('0xf')](_0xe66b('0x15'),_0x316f2f,'request\x20sent');_0x584cab(_0x499aed['result']['message']);}})[_0xe66b('0x17')](function(_0x209678){logger[_0xe66b('0x13')](_0xe66b('0x15'),_0x316f2f,_0x209678);_0x1f0970(_0x209678);});});} \ No newline at end of file +var _0x8093=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','info','CmContactHasItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x2617c0,_0x101d8a){var _0x36cf01=function(_0x550d0c){while(--_0x550d0c){_0x2617c0['push'](_0x2617c0['shift']());}};_0x36cf01(++_0x101d8a);}(_0x8093,0x17f));var _0x3809=function(_0x14f7fe,_0x5132c4){_0x14f7fe=_0x14f7fe-0x0;var _0x3d8309=_0x8093[_0x14f7fe];return _0x3d8309;};'use strict';var _=require(_0x3809('0x0'));var util=require(_0x3809('0x1'));var moment=require('moment');var BPromise=require(_0x3809('0x2'));var rs=require(_0x3809('0x3'));var fs=require('fs');var Redis=require(_0x3809('0x4'));var db=require(_0x3809('0x5'))['db'];var utils=require(_0x3809('0x6'));var logger=require(_0x3809('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3809('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x169a76,_0x4eff16,_0x1a1762){return new BPromise(function(_0x342618,_0x32ceea){return client['request'](_0x169a76,_0x1a1762)['then'](function(_0x2222fc){logger[_0x3809('0x9')](_0x3809('0xa'),_0x4eff16,'request\x20sent');logger[_0x3809('0xb')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x4eff16,_0x3809('0xc'),JSON[_0x3809('0xd')](_0x2222fc));if(_0x2222fc['error']){if(_0x2222fc[_0x3809('0xe')][_0x3809('0xf')]===0x1f4){logger[_0x3809('0xe')](_0x3809('0xa'),_0x4eff16,_0x2222fc[_0x3809('0xe')][_0x3809('0x10')]);return _0x32ceea(_0x2222fc['error'][_0x3809('0x10')]);}logger[_0x3809('0xe')](_0x3809('0xa'),_0x4eff16,_0x2222fc[_0x3809('0xe')][_0x3809('0x10')]);return _0x342618(_0x2222fc[_0x3809('0xe')][_0x3809('0x10')]);}else{logger[_0x3809('0x9')](_0x3809('0xa'),_0x4eff16,'request\x20sent');_0x342618(_0x2222fc[_0x3809('0x11')][_0x3809('0x10')]);}})[_0x3809('0x12')](function(_0x2b87f2){logger['error'](_0x3809('0xa'),_0x4eff16,_0x2b87f2);_0x32ceea(_0x2b87f2);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 8a18926..7d03162 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6c0=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','post','create','put','update','delete','exports','multer'];(function(_0x24dac7,_0x2ffbaa){var _0x32c81f=function(_0x5e6475){while(--_0x5e6475){_0x24dac7['push'](_0x24dac7['shift']());}};_0x32c81f(++_0x2ffbaa);}(_0xf6c0,0x194));var _0x0f6c=function(_0x4e46ec,_0xa6c629){_0x4e46ec=_0x4e46ec-0x0;var _0x2fdfe0=_0xf6c0[_0x4e46ec];return _0x2fdfe0;};'use strict';var multer=require(_0x0f6c('0x0'));var util=require('util');var path=require(_0x0f6c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0f6c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0f6c('0x3'));var interaction=require(_0x0f6c('0x4'));var config=require(_0x0f6c('0x5'));var controller=require('./cmContactHasItem.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0f6c('0x6')]);router['get'](_0x0f6c('0x7'),auth[_0x0f6c('0x8')](),controller['show']);router[_0x0f6c('0x9')]('/',auth[_0x0f6c('0x8')](),controller[_0x0f6c('0xa')]);router[_0x0f6c('0xb')](_0x0f6c('0x7'),auth['isAuthenticated'](),controller[_0x0f6c('0xc')]);router[_0x0f6c('0xd')](_0x0f6c('0x7'),auth[_0x0f6c('0x8')](),controller['destroy']);module[_0x0f6c('0xe')]=router; \ No newline at end of file +var _0x7d4d=['/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d4d,0xd9));var _0xd7d4=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x7d4d[_0xac151d];return _0x111dba;};'use strict';var multer=require('multer');var util=require(_0xd7d4('0x0'));var path=require(_0xd7d4('0x1'));var timeout=require(_0xd7d4('0x2'));var express=require(_0xd7d4('0x3'));var router=express[_0xd7d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd7d4('0x5'));var interaction=require(_0xd7d4('0x6'));var config=require(_0xd7d4('0x7'));var controller=require('./cmContactHasItem.controller');router[_0xd7d4('0x8')]('/',auth[_0xd7d4('0x9')](),controller[_0xd7d4('0xa')]);router['get'](_0xd7d4('0xb'),auth[_0xd7d4('0x9')](),controller[_0xd7d4('0xc')]);router[_0xd7d4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd7d4('0xe')]('/:id',auth[_0xd7d4('0x9')](),controller[_0xd7d4('0xf')]);router[_0xd7d4('0x10')](_0xd7d4('0xb'),auth['isAuthenticated'](),controller[_0xd7d4('0x11')]);module[_0xd7d4('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 31a5262..5324df3 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 _0x8e4f=['lodash','exports','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values','stringify','BOOLEAN','ENUM','voice','sequelize'];(function(_0x205a39,_0x2d0f3d){var _0x387119=function(_0x5a8af2){while(--_0x5a8af2){_0x205a39['push'](_0x205a39['shift']());}};_0x387119(++_0x2d0f3d);}(_0x8e4f,0x8f));var _0xf8e4=function(_0x1e9ae1,_0x10dc5d){_0x1e9ae1=_0x1e9ae1-0x0;var _0xc6bc15=_0x8e4f[_0x1e9ae1];return _0xc6bc15;};'use strict';var Sequelize=require(_0xf8e4('0x0'));var _=require(_0xf8e4('0x1'));module[_0xf8e4('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4e16fb){return this[_0xf8e4('0x3')](_0xf8e4('0x4'));}},'alias':{'type':Sequelize[_0xf8e4('0x5')],'allowNull':![],'set':function(_0x46e38a){this[_0xf8e4('0x6')](_0xf8e4('0x4'),_0x46e38a?_0x46e38a:this['getDataValue'](_0xf8e4('0x7')));}},'type':{'type':Sequelize[_0xf8e4('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf8e4('0x8')](_0xf8e4('0x9')),'get':function(){if(this['getDataValue'](_0xf8e4('0xa'))===_0xf8e4('0xb')){return JSON[_0xf8e4('0xc')](this[_0xf8e4('0x3')]('values'));}else{return this['getDataValue'](_0xf8e4('0xd'));}},'set':function(_0x5b2b96){if(Array['isArray'](_0x5b2b96)){this[_0xf8e4('0x6')](_0xf8e4('0xd'),JSON[_0xf8e4('0xe')](_0x5b2b96));}else{this[_0xf8e4('0x6')]('values',_0x5b2b96);}}},'required':{'type':Sequelize[_0xf8e4('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf8e4('0x10')](_0xf8e4('0x11'))}}; \ No newline at end of file +var _0x1260=['BOOLEAN','voice','sequelize','VIRTUAL','alias','STRING','setDataValue','getDataValue','type','select','parse','values','isArray','stringify'];(function(_0x5bfb78,_0x22e3ff){var _0x4efd00=function(_0x5c9496){while(--_0x5c9496){_0x5bfb78['push'](_0x5bfb78['shift']());}};_0x4efd00(++_0x22e3ff);}(_0x1260,0x1b4));var _0x0126=function(_0x36b22b,_0x33bf3d){_0x36b22b=_0x36b22b-0x0;var _0x30ee19=_0x1260[_0x36b22b];return _0x30ee19;};'use strict';var Sequelize=require(_0x0126('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0126('0x1')],'get':function(_0x51d920){return this['getDataValue'](_0x0126('0x2'));}},'alias':{'type':Sequelize[_0x0126('0x3')],'allowNull':![],'set':function(_0x524e0b){this[_0x0126('0x4')](_0x0126('0x2'),_0x524e0b?_0x524e0b:this[_0x0126('0x5')]('name'));}},'type':{'type':Sequelize[_0x0126('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x0126('0x5')](_0x0126('0x6'))===_0x0126('0x7')){return JSON[_0x0126('0x8')](this[_0x0126('0x5')](_0x0126('0x9')));}else{return this['getDataValue'](_0x0126('0x9'));}},'set':function(_0x2ef89e){if(Array[_0x0126('0xa')](_0x2ef89e)){this['setDataValue'](_0x0126('0x9'),JSON[_0x0126('0xb')](_0x2ef89e));}else{this[_0x0126('0x4')]('values',_0x2ef89e);}}},'required':{'type':Sequelize[_0x0126('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x0126('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x0126('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index a51c9e3..4ac3ab8 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 _0xcb22=['INTEGER','BOOLEAN','queryInterface','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','status','error','stack','send','index','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','map','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','destroy','create','sequelize','transaction','Sequelize','TEXT','number'];(function(_0x5e5bce,_0x13934f){var _0x585b7d=function(_0x3ddb9d){while(--_0x3ddb9d){_0x5e5bce['push'](_0x5e5bce['shift']());}};_0x585b7d(++_0x13934f);}(_0xcb22,0x1be));var _0x2cb2=function(_0x594ca3,_0x34672e){_0x594ca3=_0x594ca3-0x0;var _0x54916e=_0xcb22[_0x594ca3];return _0x54916e;};'use strict';var emlformat=require(_0x2cb2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cb2('0x1'));var jsonpatch=require(_0x2cb2('0x2'));var rp=require(_0x2cb2('0x3'));var moment=require(_0x2cb2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2cb2('0x5'));var util=require('util');var path=require(_0x2cb2('0x6'));var sox=require(_0x2cb2('0x7'));var csv=require(_0x2cb2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2cb2('0x9'));var _=require(_0x2cb2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2cb2('0xb'));var deskjs=require(_0x2cb2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2cb2('0xd'));var Papa=require(_0x2cb2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2cb2('0xf'));var as=require(_0x2cb2('0x10'));var hardwareService=require(_0x2cb2('0x11'));var logger=require(_0x2cb2('0x12'))(_0x2cb2('0x13'));var utils=require('../../config/utils');var config=require(_0x2cb2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2cb2('0x15'))['db'];function respondWithStatusCode(_0x440f18,_0x391aee){_0x391aee=_0x391aee||0xcc;return function(_0x2a145f){if(_0x2a145f){return _0x440f18[_0x2cb2('0x16')](_0x391aee);}return _0x440f18['status'](_0x391aee)[_0x2cb2('0x17')]();};}function respondWithResult(_0x21b515,_0x5a20e9){_0x5a20e9=_0x5a20e9||0xc8;return function(_0x16296b){if(_0x16296b){return _0x21b515['status'](_0x5a20e9)['json'](_0x16296b);}};}function respondWithFilteredResult(_0x58950b,_0x5af880){return function(_0x2f9735){if(_0x2f9735){var _0x42d897=typeof _0x5af880[_0x2cb2('0x18')]===_0x2cb2('0x19')&&typeof _0x5af880[_0x2cb2('0x1a')]===_0x2cb2('0x19');var _0xbf8eca=_0x2f9735[_0x2cb2('0x1b')];var _0xf0e23c=_0x42d897?0x0:_0x5af880[_0x2cb2('0x18')];var _0x50b253=_0x42d897?_0x2f9735[_0x2cb2('0x1b')]:_0x5af880['offset']+_0x5af880[_0x2cb2('0x1a')];var _0x53d007;if(_0x50b253>=_0xbf8eca){_0x50b253=_0xbf8eca;_0x53d007=0xc8;}else{_0x53d007=0xce;}_0x58950b['status'](_0x53d007);return _0x58950b[_0x2cb2('0x1c')](_0x2cb2('0x1d'),_0xf0e23c+'-'+_0x50b253+'/'+_0xbf8eca)[_0x2cb2('0x1e')](_0x2f9735);}return null;};}function patchUpdates(_0x15dfe2){return function(_0x5d7ceb){try{jsonpatch[_0x2cb2('0x1f')](_0x5d7ceb,_0x15dfe2,!![]);}catch(_0x31c448){return BPromise[_0x2cb2('0x20')](_0x31c448);}return _0x5d7ceb['save']();};}function saveUpdates(_0x54d2f1,_0x2b463b){return function(_0x516ae9){if(_0x516ae9){return _0x516ae9['update'](_0x54d2f1)['then'](function(_0x37c8cc){return _0x37c8cc;});}return null;};}function removeEntity(_0x4db3b3,_0x314aac){return function(_0x38c3cc){if(_0x38c3cc){return _0x38c3cc['destroy']()[_0x2cb2('0x21')](function(){_0x4db3b3[_0x2cb2('0x22')](0xcc)[_0x2cb2('0x17')]();});}};}function handleEntityNotFound(_0x27ca94,_0x515970){return function(_0x5a45d1){if(!_0x5a45d1){_0x27ca94['sendStatus'](0x194);}return _0x5a45d1;};}function handleError(_0x118431,_0x48f121){_0x48f121=_0x48f121||0x1f4;return function(_0x56ca23){logger[_0x2cb2('0x23')](_0x56ca23[_0x2cb2('0x24')]);if(_0x56ca23['name']){delete _0x56ca23['name'];}_0x118431['status'](_0x48f121)[_0x2cb2('0x25')](_0x56ca23);};}exports[_0x2cb2('0x26')]=function(_0x34edda,_0x2357a6){var _0x396b6b={},_0x5a4830={},_0x3e3322={'count':0x0,'rows':[]};var _0x3e3328=_['map'](db[_0x2cb2('0x27')][_0x2cb2('0x28')],function(_0x25095a){return{'name':_0x25095a[_0x2cb2('0x29')],'type':_0x25095a[_0x2cb2('0x2a')][_0x2cb2('0x2b')]};});_0x5a4830['model']=_[_0x2cb2('0x2c')](_[_0x2cb2('0x2d')](_0x3e3328,'name'),[_0x2cb2('0x2e')]);_0x5a4830[_0x2cb2('0x2f')]=_[_0x2cb2('0x30')](_0x34edda['query']);_0x5a4830[_0x2cb2('0x31')]=_[_0x2cb2('0x32')](_0x5a4830[_0x2cb2('0x33')],_0x5a4830[_0x2cb2('0x2f')]);_0x396b6b['attributes']=_[_0x2cb2('0x32')](_0x5a4830[_0x2cb2('0x33')],qs[_0x2cb2('0x34')](_0x34edda[_0x2cb2('0x2f')][_0x2cb2('0x34')]));_0x396b6b[_0x2cb2('0x35')]=_0x396b6b[_0x2cb2('0x35')][_0x2cb2('0x36')]?_0x396b6b[_0x2cb2('0x35')]:_0x5a4830['model'];if(!_0x34edda[_0x2cb2('0x2f')][_0x2cb2('0x37')](_0x2cb2('0x38'))){_0x396b6b[_0x2cb2('0x1a')]=qs['limit'](_0x34edda['query'][_0x2cb2('0x1a')]);_0x396b6b[_0x2cb2('0x18')]=qs['offset'](_0x34edda[_0x2cb2('0x2f')][_0x2cb2('0x18')]);}_0x396b6b[_0x2cb2('0x39')]=qs[_0x2cb2('0x3a')](_0x34edda[_0x2cb2('0x2f')][_0x2cb2('0x3a')]);_0x396b6b[_0x2cb2('0x3b')]=qs[_0x2cb2('0x31')](_[_0x2cb2('0x3c')](_0x34edda['query'],_0x5a4830['filters']),_0x3e3328);if(_0x34edda[_0x2cb2('0x2f')][_0x2cb2('0x3d')]){_0x396b6b[_0x2cb2('0x3b')]=_[_0x2cb2('0x3e')](_0x396b6b['where'],{'$or':_[_0x2cb2('0x2d')](_0x3e3328,function(_0x4b9eed){if(_0x4b9eed['type']!==_0x2cb2('0x3f')){var _0x329bfe={};_0x329bfe[_0x4b9eed[_0x2cb2('0x2e')]]={'$like':'%'+_0x34edda[_0x2cb2('0x2f')][_0x2cb2('0x3d')]+'%'};return _0x329bfe;}})});}_0x396b6b=_[_0x2cb2('0x3e')]({},_0x396b6b,_0x34edda[_0x2cb2('0x40')]);var _0x2ca764={'where':_0x396b6b['where']};return db[_0x2cb2('0x27')][_0x2cb2('0x1b')](_0x2ca764)[_0x2cb2('0x21')](function(_0x3d7f8b){_0x3e3322[_0x2cb2('0x1b')]=_0x3d7f8b;if(_0x34edda[_0x2cb2('0x2f')][_0x2cb2('0x41')]){_0x396b6b[_0x2cb2('0x42')]=[{'all':!![]}];}return db['CmCustomField'][_0x2cb2('0x43')](_0x396b6b);})['then'](function(_0x13430c){_0x3e3322[_0x2cb2('0x44')]=_0x13430c;return _0x3e3322;})[_0x2cb2('0x21')](respondWithFilteredResult(_0x2357a6,_0x396b6b))[_0x2cb2('0x45')](handleError(_0x2357a6,null));};exports[_0x2cb2('0x46')]=function(_0x5eabe2,_0x21955){var _0x3f0362={'raw':!![],'where':{'id':_0x5eabe2[_0x2cb2('0x47')]['id']}},_0x18aa1d={};_0x18aa1d[_0x2cb2('0x33')]=_[_0x2cb2('0x30')](db[_0x2cb2('0x27')][_0x2cb2('0x28')]);_0x18aa1d[_0x2cb2('0x2f')]=_[_0x2cb2('0x30')](_0x5eabe2[_0x2cb2('0x2f')]);_0x18aa1d[_0x2cb2('0x31')]=_['intersection'](_0x18aa1d[_0x2cb2('0x33')],_0x18aa1d[_0x2cb2('0x2f')]);_0x3f0362[_0x2cb2('0x35')]=_['intersection'](_0x18aa1d[_0x2cb2('0x33')],qs[_0x2cb2('0x34')](_0x5eabe2['query']['fields']));_0x3f0362[_0x2cb2('0x35')]=_0x3f0362[_0x2cb2('0x35')][_0x2cb2('0x36')]?_0x3f0362[_0x2cb2('0x35')]:_0x18aa1d['model'];if(_0x5eabe2[_0x2cb2('0x2f')][_0x2cb2('0x41')]){_0x3f0362['include']=[{'all':!![]}];}_0x3f0362=_[_0x2cb2('0x3e')]({},_0x3f0362,_0x5eabe2[_0x2cb2('0x40')]);return db[_0x2cb2('0x27')][_0x2cb2('0x48')](_0x3f0362)[_0x2cb2('0x21')](handleEntityNotFound(_0x21955,null))[_0x2cb2('0x21')](respondWithResult(_0x21955,null))[_0x2cb2('0x45')](handleError(_0x21955,null));};exports[_0x2cb2('0x49')]=function(_0x1ff0fc,_0xdad2e3){if(_0x1ff0fc['body']['id']){delete _0x1ff0fc[_0x2cb2('0x4a')]['id'];}return db[_0x2cb2('0x27')][_0x2cb2('0x48')]({'where':{'id':_0x1ff0fc[_0x2cb2('0x47')]['id']}})[_0x2cb2('0x21')](handleEntityNotFound(_0xdad2e3,null))[_0x2cb2('0x21')](saveUpdates(_0x1ff0fc['body'],null))[_0x2cb2('0x21')](respondWithResult(_0xdad2e3,null))[_0x2cb2('0x45')](handleError(_0xdad2e3,null));};exports[_0x2cb2('0x4b')]=function(_0x230389,_0x237427){return db[_0x2cb2('0x27')][_0x2cb2('0x48')]({'where':{'id':_0x230389[_0x2cb2('0x47')]['id']}})[_0x2cb2('0x21')](handleEntityNotFound(_0x237427,null))[_0x2cb2('0x21')](removeEntity(_0x237427,null))['catch'](handleError(_0x237427,null));};exports[_0x2cb2('0x4c')]=function(_0x35ea50,_0x35a9a6){var _0xd4d0c9;return db[_0x2cb2('0x4d')][_0x2cb2('0x4e')](function(_0x34714c){return db[_0x2cb2('0x27')][_0x2cb2('0x4c')](_0x35ea50[_0x2cb2('0x4a')],{'transaction':_0x34714c})[_0x2cb2('0x21')](function(_0x3bfc49){_0xd4d0c9=_0x3bfc49;var _0x4ef1ee={'type':db[_0x2cb2('0x4f')][_0x2cb2('0x50')],'transaction':_0x34714c};switch(_0x35ea50[_0x2cb2('0x4a')][_0x2cb2('0x2a')]){case'text':_0x4ef1ee[_0x2cb2('0x2a')]=db[_0x2cb2('0x4f')][_0x2cb2('0x50')];break;case _0x2cb2('0x51'):_0x4ef1ee[_0x2cb2('0x2a')]=db[_0x2cb2('0x4f')][_0x2cb2('0x52')];break;case'switch':_0x4ef1ee[_0x2cb2('0x2a')]=db[_0x2cb2('0x4f')][_0x2cb2('0x53')];_0x4ef1ee['defaultValue']=![];break;default:}return db[_0x2cb2('0x4d')][_0x2cb2('0x54')]['addColumn'](_0x2cb2('0x55'),util[_0x2cb2('0x56')](_0x2cb2('0x57'),_0xd4d0c9['id']),_0x4ef1ee);})[_0x2cb2('0x21')](function(){return _0xd4d0c9;});})[_0x2cb2('0x21')](respondWithResult(_0x35a9a6,0xc9))[_0x2cb2('0x45')](handleError(_0x35a9a6,null));}; \ No newline at end of file +var _0xac20=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','update','body','create','transaction','Sequelize','TEXT','number','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf'];(function(_0x181d03,_0x207db3){var _0x2f6623=function(_0x269167){while(--_0x269167){_0x181d03['push'](_0x181d03['shift']());}};_0x2f6623(++_0x207db3);}(_0xac20,0xaf));var _0x0ac2=function(_0x1719cb,_0x36c0c5){_0x1719cb=_0x1719cb-0x0;var _0x14e35a=_0xac20[_0x1719cb];return _0x14e35a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ac2('0x0'));var zipdir=require(_0x0ac2('0x1'));var jsonpatch=require(_0x0ac2('0x2'));var rp=require(_0x0ac2('0x3'));var moment=require(_0x0ac2('0x4'));var BPromise=require(_0x0ac2('0x5'));var Mustache=require(_0x0ac2('0x6'));var util=require(_0x0ac2('0x7'));var path=require(_0x0ac2('0x8'));var sox=require(_0x0ac2('0x9'));var csv=require(_0x0ac2('0xa'));var ejs=require(_0x0ac2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ac2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0ac2('0xd'));var toCsv=require(_0x0ac2('0xa'));var querystring=require(_0x0ac2('0xe'));var Papa=require(_0x0ac2('0xf'));var Redis=require(_0x0ac2('0x10'));var authService=require(_0x0ac2('0x11'));var qs=require(_0x0ac2('0x12'));var as=require(_0x0ac2('0x13'));var hardwareService=require(_0x0ac2('0x14'));var logger=require('../../config/logger')(_0x0ac2('0x15'));var utils=require(_0x0ac2('0x16'));var config=require(_0x0ac2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f4e4d,_0x24d880){_0x24d880=_0x24d880||0xcc;return function(_0x3f1837){if(_0x3f1837){return _0x2f4e4d[_0x0ac2('0x18')](_0x24d880);}return _0x2f4e4d[_0x0ac2('0x19')](_0x24d880)[_0x0ac2('0x1a')]();};}function respondWithResult(_0x35ab3f,_0x1cdf17){_0x1cdf17=_0x1cdf17||0xc8;return function(_0x344192){if(_0x344192){return _0x35ab3f['status'](_0x1cdf17)[_0x0ac2('0x1b')](_0x344192);}};}function respondWithFilteredResult(_0x4476fb,_0x56d10b){return function(_0x120697){if(_0x120697){var _0x260d1d=typeof _0x56d10b[_0x0ac2('0x1c')]==='undefined'&&typeof _0x56d10b['limit']===_0x0ac2('0x1d');var _0x4017ba=_0x120697[_0x0ac2('0x1e')];var _0xe7a2c0=_0x260d1d?0x0:_0x56d10b[_0x0ac2('0x1c')];var _0x32dc5d=_0x260d1d?_0x120697[_0x0ac2('0x1e')]:_0x56d10b[_0x0ac2('0x1c')]+_0x56d10b['limit'];var _0x180e95;if(_0x32dc5d>=_0x4017ba){_0x32dc5d=_0x4017ba;_0x180e95=0xc8;}else{_0x180e95=0xce;}_0x4476fb[_0x0ac2('0x19')](_0x180e95);return _0x4476fb[_0x0ac2('0x1f')](_0x0ac2('0x20'),_0xe7a2c0+'-'+_0x32dc5d+'/'+_0x4017ba)['json'](_0x120697);}return null;};}function patchUpdates(_0xb977ae){return function(_0x4faa48){try{jsonpatch['apply'](_0x4faa48,_0xb977ae,!![]);}catch(_0x488de0){return BPromise[_0x0ac2('0x21')](_0x488de0);}return _0x4faa48[_0x0ac2('0x22')]();};}function saveUpdates(_0x33e446,_0x43e7e2){return function(_0x18b272){if(_0x18b272){return _0x18b272['update'](_0x33e446)[_0x0ac2('0x23')](function(_0x4f2a52){return _0x4f2a52;});}return null;};}function removeEntity(_0x45b44c,_0x2ca3bc){return function(_0x3b3e32){if(_0x3b3e32){return _0x3b3e32[_0x0ac2('0x24')]()[_0x0ac2('0x23')](function(){_0x45b44c['status'](0xcc)[_0x0ac2('0x1a')]();});}};}function handleEntityNotFound(_0x11806b,_0x318863){return function(_0xef87c7){if(!_0xef87c7){_0x11806b[_0x0ac2('0x18')](0x194);}return _0xef87c7;};}function handleError(_0x2465aa,_0x89dad9){_0x89dad9=_0x89dad9||0x1f4;return function(_0x405cc4){logger[_0x0ac2('0x25')](_0x405cc4[_0x0ac2('0x26')]);if(_0x405cc4[_0x0ac2('0x27')]){delete _0x405cc4[_0x0ac2('0x27')];}_0x2465aa[_0x0ac2('0x19')](_0x89dad9)[_0x0ac2('0x28')](_0x405cc4);};}exports[_0x0ac2('0x29')]=function(_0x3c2fc8,_0x21d3bb){var _0x28ac17={},_0x291f0e={},_0x1d978a={'count':0x0,'rows':[]};var _0x38cc59=_[_0x0ac2('0x2a')](db[_0x0ac2('0x2b')][_0x0ac2('0x2c')],function(_0x1319cd){return{'name':_0x1319cd[_0x0ac2('0x2d')],'type':_0x1319cd[_0x0ac2('0x2e')][_0x0ac2('0x2f')]};});_0x291f0e[_0x0ac2('0x30')]=_['differenceBy'](_['map'](_0x38cc59,_0x0ac2('0x27')),[_0x0ac2('0x27')]);_0x291f0e['query']=_[_0x0ac2('0x31')](_0x3c2fc8[_0x0ac2('0x32')]);_0x291f0e[_0x0ac2('0x33')]=_[_0x0ac2('0x34')](_0x291f0e['model'],_0x291f0e[_0x0ac2('0x32')]);_0x28ac17[_0x0ac2('0x35')]=_[_0x0ac2('0x34')](_0x291f0e[_0x0ac2('0x30')],qs['fields'](_0x3c2fc8[_0x0ac2('0x32')][_0x0ac2('0x36')]));_0x28ac17[_0x0ac2('0x35')]=_0x28ac17[_0x0ac2('0x35')]['length']?_0x28ac17[_0x0ac2('0x35')]:_0x291f0e[_0x0ac2('0x30')];if(!_0x3c2fc8[_0x0ac2('0x32')]['hasOwnProperty'](_0x0ac2('0x37'))){_0x28ac17[_0x0ac2('0x38')]=qs[_0x0ac2('0x38')](_0x3c2fc8['query'][_0x0ac2('0x38')]);_0x28ac17['offset']=qs[_0x0ac2('0x1c')](_0x3c2fc8['query'][_0x0ac2('0x1c')]);}_0x28ac17[_0x0ac2('0x39')]=qs['sort'](_0x3c2fc8['query'][_0x0ac2('0x3a')]);_0x28ac17['where']=qs[_0x0ac2('0x33')](_[_0x0ac2('0x3b')](_0x3c2fc8[_0x0ac2('0x32')],_0x291f0e[_0x0ac2('0x33')]),_0x38cc59);if(_0x3c2fc8[_0x0ac2('0x32')][_0x0ac2('0x3c')]){_0x28ac17[_0x0ac2('0x3d')]=_[_0x0ac2('0x3e')](_0x28ac17[_0x0ac2('0x3d')],{'$or':_['map'](_0x38cc59,function(_0x36b2ec){if(_0x36b2ec['type']!==_0x0ac2('0x3f')){var _0x2553de={};_0x2553de[_0x36b2ec['name']]={'$like':'%'+_0x3c2fc8[_0x0ac2('0x32')][_0x0ac2('0x3c')]+'%'};return _0x2553de;}})});}_0x28ac17=_[_0x0ac2('0x3e')]({},_0x28ac17,_0x3c2fc8[_0x0ac2('0x40')]);var _0x44d821={'where':_0x28ac17['where']};return db[_0x0ac2('0x2b')][_0x0ac2('0x1e')](_0x44d821)[_0x0ac2('0x23')](function(_0x253724){_0x1d978a[_0x0ac2('0x1e')]=_0x253724;if(_0x3c2fc8[_0x0ac2('0x32')][_0x0ac2('0x41')]){_0x28ac17[_0x0ac2('0x42')]=[{'all':!![]}];}return db[_0x0ac2('0x2b')][_0x0ac2('0x43')](_0x28ac17);})[_0x0ac2('0x23')](function(_0x3b9308){_0x1d978a[_0x0ac2('0x44')]=_0x3b9308;return _0x1d978a;})[_0x0ac2('0x23')](respondWithFilteredResult(_0x21d3bb,_0x28ac17))['catch'](handleError(_0x21d3bb,null));};exports[_0x0ac2('0x45')]=function(_0x34074c,_0x6ebe8c){var _0x19ac1f={'raw':!![],'where':{'id':_0x34074c[_0x0ac2('0x46')]['id']}},_0x5d72fd={};_0x5d72fd['model']=_[_0x0ac2('0x31')](db['CmCustomField']['rawAttributes']);_0x5d72fd[_0x0ac2('0x32')]=_[_0x0ac2('0x31')](_0x34074c[_0x0ac2('0x32')]);_0x5d72fd[_0x0ac2('0x33')]=_[_0x0ac2('0x34')](_0x5d72fd['model'],_0x5d72fd[_0x0ac2('0x32')]);_0x19ac1f[_0x0ac2('0x35')]=_[_0x0ac2('0x34')](_0x5d72fd[_0x0ac2('0x30')],qs[_0x0ac2('0x36')](_0x34074c['query'][_0x0ac2('0x36')]));_0x19ac1f['attributes']=_0x19ac1f[_0x0ac2('0x35')][_0x0ac2('0x47')]?_0x19ac1f[_0x0ac2('0x35')]:_0x5d72fd['model'];if(_0x34074c[_0x0ac2('0x32')][_0x0ac2('0x41')]){_0x19ac1f[_0x0ac2('0x42')]=[{'all':!![]}];}_0x19ac1f=_['merge']({},_0x19ac1f,_0x34074c['options']);return db[_0x0ac2('0x2b')][_0x0ac2('0x48')](_0x19ac1f)[_0x0ac2('0x23')](handleEntityNotFound(_0x6ebe8c,null))[_0x0ac2('0x23')](respondWithResult(_0x6ebe8c,null))[_0x0ac2('0x49')](handleError(_0x6ebe8c,null));};exports[_0x0ac2('0x4a')]=function(_0x34e808,_0x1551d0){if(_0x34e808['body']['id']){delete _0x34e808[_0x0ac2('0x4b')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x34e808[_0x0ac2('0x46')]['id']}})[_0x0ac2('0x23')](handleEntityNotFound(_0x1551d0,null))[_0x0ac2('0x23')](saveUpdates(_0x34e808[_0x0ac2('0x4b')],null))['then'](respondWithResult(_0x1551d0,null))[_0x0ac2('0x49')](handleError(_0x1551d0,null));};exports[_0x0ac2('0x24')]=function(_0x234e8e,_0x2fed30){return db['CmCustomField'][_0x0ac2('0x48')]({'where':{'id':_0x234e8e[_0x0ac2('0x46')]['id']}})['then'](handleEntityNotFound(_0x2fed30,null))['then'](removeEntity(_0x2fed30,null))['catch'](handleError(_0x2fed30,null));};exports[_0x0ac2('0x4c')]=function(_0x3a767d,_0x46bc25){var _0x475e63;return db['sequelize'][_0x0ac2('0x4d')](function(_0x6c4b8f){return db[_0x0ac2('0x2b')][_0x0ac2('0x4c')](_0x3a767d[_0x0ac2('0x4b')],{'transaction':_0x6c4b8f})[_0x0ac2('0x23')](function(_0x3d581f){_0x475e63=_0x3d581f;var _0x472525={'type':db[_0x0ac2('0x4e')][_0x0ac2('0x4f')],'transaction':_0x6c4b8f};switch(_0x3a767d[_0x0ac2('0x4b')][_0x0ac2('0x2e')]){case'text':_0x472525[_0x0ac2('0x2e')]=db['Sequelize'][_0x0ac2('0x4f')];break;case _0x0ac2('0x50'):_0x472525[_0x0ac2('0x2e')]=db['Sequelize']['INTEGER'];break;case'switch':_0x472525[_0x0ac2('0x2e')]=db[_0x0ac2('0x4e')][_0x0ac2('0x51')];_0x472525['defaultValue']=![];break;default:}return db[_0x0ac2('0x52')][_0x0ac2('0x53')][_0x0ac2('0x54')](_0x0ac2('0x55'),util[_0x0ac2('0x56')](_0x0ac2('0x57'),_0x475e63['id']),_0x472525);})['then'](function(){return _0x475e63;});})['then'](respondWithResult(_0x46bc25,0xc9))['catch'](handleError(_0x46bc25,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index a4ed947..a92e767 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 _0x4ea7=['path','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x43cdc3,_0x9ccb13){var _0x2936bd=function(_0x3a6b1b){while(--_0x3a6b1b){_0x43cdc3['push'](_0x43cdc3['shift']());}};_0x2936bd(++_0x9ccb13);}(_0x4ea7,0x17c));var _0x74ea=function(_0x110b0e,_0x4e0b2b){_0x110b0e=_0x110b0e-0x0;var _0x3c1323=_0x4ea7[_0x110b0e];return _0x3c1323;};'use strict';var _=require(_0x74ea('0x0'));var util=require(_0x74ea('0x1'));var logger=require(_0x74ea('0x2'))('api');var moment=require('moment');var BPromise=require(_0x74ea('0x3'));var rp=require(_0x74ea('0x4'));var fs=require('fs');var path=require(_0x74ea('0x5'));var rimraf=require('rimraf');var config=require(_0x74ea('0x6'));var attributes=require(_0x74ea('0x7'));module[_0x74ea('0x8')]=function(_0x5f5cd8,_0x5f4f3c){return _0x5f5cd8['define'](_0x74ea('0x9'),attributes,{'tableName':_0x74ea('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a86=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','api','moment'];(function(_0x243b06,_0x5872f2){var _0x3845aa=function(_0x1ab17f){while(--_0x1ab17f){_0x243b06['push'](_0x243b06['shift']());}};_0x3845aa(++_0x5872f2);}(_0x3a86,0x1aa));var _0x63a8=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x3a86[_0x34325b];return _0x3da348;};'use strict';var _=require(_0x63a8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x63a8('0x1'));var moment=require(_0x63a8('0x2'));var BPromise=require(_0x63a8('0x3'));var rp=require(_0x63a8('0x4'));var fs=require('fs');var path=require(_0x63a8('0x5'));var rimraf=require(_0x63a8('0x6'));var config=require(_0x63a8('0x7'));var attributes=require(_0x63a8('0x8'));module[_0x63a8('0x9')]=function(_0x1cbbf5,_0x4fbed){return _0x1cbbf5[_0x63a8('0xa')](_0x63a8('0xb'),attributes,{'tableName':_0x63a8('0xc'),'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 eb55163..c5c489c 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 _0xf734=['lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1802c4,_0x56d935){var _0x214746=function(_0x8d5f00){while(--_0x8d5f00){_0x1802c4['push'](_0x1802c4['shift']());}};_0x214746(++_0x56d935);}(_0xf734,0x1e0));var _0x4f73=function(_0x9c66,_0x2f563a){_0x9c66=_0x9c66-0x0;var _0x305a14=_0xf734[_0x9c66];return _0x305a14;};'use strict';var _=require(_0x4f73('0x0'));var util=require(_0x4f73('0x1'));var moment=require(_0x4f73('0x2'));var BPromise=require(_0x4f73('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f73('0x4'));var db=require(_0x4f73('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f73('0x6'));var config=require(_0x4f73('0x7'));var jayson=require(_0x4f73('0x8'));var client=jayson[_0x4f73('0x9')][_0x4f73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1eaa9d,_0x392c29,_0xb371fe){return new BPromise(function(_0x264b89,_0x246c96){return client[_0x4f73('0xb')](_0x1eaa9d,_0xb371fe)[_0x4f73('0xc')](function(_0x20feb0){logger[_0x4f73('0xd')](_0x4f73('0xe'),_0x392c29,_0x4f73('0xf'));logger[_0x4f73('0x10')](_0x4f73('0x11'),_0x392c29,_0x4f73('0xf'),JSON[_0x4f73('0x12')](_0x20feb0));if(_0x20feb0[_0x4f73('0x13')]){if(_0x20feb0[_0x4f73('0x13')][_0x4f73('0x14')]===0x1f4){logger[_0x4f73('0x13')](_0x4f73('0xe'),_0x392c29,_0x20feb0[_0x4f73('0x13')][_0x4f73('0x15')]);return _0x246c96(_0x20feb0[_0x4f73('0x13')][_0x4f73('0x15')]);}logger['error'](_0x4f73('0xe'),_0x392c29,_0x20feb0[_0x4f73('0x13')][_0x4f73('0x15')]);return _0x264b89(_0x20feb0[_0x4f73('0x13')][_0x4f73('0x15')]);}else{logger[_0x4f73('0xd')](_0x4f73('0xe'),_0x392c29,_0x4f73('0xf'));_0x264b89(_0x20feb0[_0x4f73('0x16')][_0x4f73('0x15')]);}})[_0x4f73('0x17')](function(_0x559cfd){logger[_0x4f73('0x13')](_0x4f73('0xe'),_0x392c29,_0x559cfd);_0x246c96(_0x559cfd);});});} \ No newline at end of file +var _0x59d9=['request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x2807b5,_0x1d67b0){var _0x127630=function(_0xf5ae9e){while(--_0xf5ae9e){_0x2807b5['push'](_0x2807b5['shift']());}};_0x127630(++_0x1d67b0);}(_0x59d9,0x1f0));var _0x959d=function(_0x35bee1,_0x17ce80){_0x35bee1=_0x35bee1-0x0;var _0x306583=_0x59d9[_0x35bee1];return _0x306583;};'use strict';var _=require(_0x959d('0x0'));var util=require(_0x959d('0x1'));var moment=require(_0x959d('0x2'));var BPromise=require(_0x959d('0x3'));var rs=require(_0x959d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x959d('0x5'))['db'];var utils=require(_0x959d('0x6'));var logger=require(_0x959d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x959d('0x8')][_0x959d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x216e80,_0xcc577,_0x19c593){return new BPromise(function(_0x40333c,_0x22656a){return client[_0x959d('0xa')](_0x216e80,_0x19c593)[_0x959d('0xb')](function(_0x4205f2){logger[_0x959d('0xc')](_0x959d('0xd'),_0xcc577,_0x959d('0xe'));logger[_0x959d('0xf')](_0x959d('0x10'),_0xcc577,_0x959d('0xe'),JSON[_0x959d('0x11')](_0x4205f2));if(_0x4205f2['error']){if(_0x4205f2[_0x959d('0x12')][_0x959d('0x13')]===0x1f4){logger[_0x959d('0x12')](_0x959d('0xd'),_0xcc577,_0x4205f2[_0x959d('0x12')][_0x959d('0x14')]);return _0x22656a(_0x4205f2[_0x959d('0x12')]['message']);}logger[_0x959d('0x12')](_0x959d('0xd'),_0xcc577,_0x4205f2['error']['message']);return _0x40333c(_0x4205f2[_0x959d('0x12')]['message']);}else{logger[_0x959d('0xc')](_0x959d('0xd'),_0xcc577,_0x959d('0xe'));_0x40333c(_0x4205f2[_0x959d('0x15')]['message']);}})[_0x959d('0x16')](function(_0x3fa571){logger[_0x959d('0x12')](_0x959d('0xd'),_0xcc577,_0x3fa571);_0x22656a(_0x3fa571);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 363dd89..41b3dde 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 _0x9973=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','get','/:id','isAuthenticated','create','put','update','delete','destroy'];(function(_0x36729f,_0x59bce8){var _0x365066=function(_0x2d9177){while(--_0x2d9177){_0x36729f['push'](_0x36729f['shift']());}};_0x365066(++_0x59bce8);}(_0x9973,0x157));var _0x3997=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9973[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0x3997('0x0'));var path=require(_0x3997('0x1'));var timeout=require('connect-timeout');var express=require(_0x3997('0x2'));var router=express[_0x3997('0x3')]();var fs_extra=require(_0x3997('0x4'));var auth=require(_0x3997('0x5'));var interaction=require(_0x3997('0x6'));var config=require(_0x3997('0x7'));var controller=require(_0x3997('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3997('0x9')]);router[_0x3997('0xa')](_0x3997('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x3997('0xc')](),controller[_0x3997('0xd')]);router[_0x3997('0xe')](_0x3997('0xb'),auth[_0x3997('0xc')](),controller[_0x3997('0xf')]);router[_0x3997('0x10')](_0x3997('0xb'),auth[_0x3997('0xc')](),controller[_0x3997('0x11')]);module[_0x3997('0x12')]=router; \ No newline at end of file +var _0x943c=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var path=require(_0xc943('0x2'));var timeout=require(_0xc943('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc943('0x4'));var auth=require(_0xc943('0x5'));var interaction=require(_0xc943('0x6'));var config=require('../../config/environment');var controller=require(_0xc943('0x7'));router[_0xc943('0x8')]('/',auth[_0xc943('0x9')](),controller[_0xc943('0xa')]);router[_0xc943('0x8')](_0xc943('0xb'),auth[_0xc943('0x9')](),controller['show']);router[_0xc943('0xc')]('/',auth[_0xc943('0x9')](),controller[_0xc943('0xd')]);router[_0xc943('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xc943('0xf')]);router[_0xc943('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc943('0x11')]);module[_0xc943('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index b212c61..b679b18 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 _0x11c4=['contactListQueue','moment','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED'];(function(_0x12335b,_0x48f4b7){var _0x38b3da=function(_0x53d015){while(--_0x53d015){_0x12335b['push'](_0x12335b['shift']());}};_0x38b3da(++_0x48f4b7);}(_0x11c4,0xe2));var _0x411c=function(_0x3f5ecd,_0xb19122){_0x3f5ecd=_0x3f5ecd-0x0;var _0x3dfe90=_0x11c4[_0x3f5ecd];return _0x3dfe90;};'use strict';var moment=require(_0x411c('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x411c('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x411c('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x411c('0x3')](_0x411c('0x4'))},'countbusyretry':{'type':Sequelize[_0x411c('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x411c('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x411c('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x411c('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x411c('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x411c('0x6')]},'priority':{'type':Sequelize[_0x411c('0x5')](0x2)[_0x411c('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x411c('0x5')],'unique':_0x411c('0x8')},'ListId':{'type':Sequelize[_0x411c('0x5')],'unique':_0x411c('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x411c('0x5')],'unique':_0x411c('0x8')},'CampaignId':{'type':Sequelize[_0x411c('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x411c('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x411c('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x411c('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x411c('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x411c('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x411c('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x411c('0x6')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xe1a7=['moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue'];(function(_0x55b460,_0x497077){var _0x3ac537=function(_0xd709b3){while(--_0xd709b3){_0x55b460['push'](_0x55b460['shift']());}};_0x3ac537(++_0x497077);}(_0xe1a7,0xea));var _0x7e1a=function(_0xda7f8a,_0x442276){_0xda7f8a=_0xda7f8a-0x0;var _0x55ed5d=_0xe1a7[_0xda7f8a];return _0x55ed5d;};'use strict';var moment=require(_0x7e1a('0x0'));var Sequelize=require(_0x7e1a('0x1'));module[_0x7e1a('0x2')]={'phone':{'type':Sequelize[_0x7e1a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x7e1a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7e1a('0x5')],'defaultValue':moment()['format'](_0x7e1a('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7e1a('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7e1a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x7e1a('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7e1a('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7e1a('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x7e1a('0x8')},'UserId':{'type':Sequelize[_0x7e1a('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x7e1a('0x7')],'unique':_0x7e1a('0x8')},'CampaignId':{'type':Sequelize[_0x7e1a('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x7e1a('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7e1a('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7e1a('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7e1a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7e1a('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x7e1a('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x7e1a('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 5a60d0d..0d56bdf 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 _0xd8b1=['lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','offset','undefined','limit','count','status','set','Content-Range','json','update','then','sendStatus','error','stack','name','map','CmHopper','fieldName','type','model','query','keys','filters','concat','$or','$gt','$lt','$lte','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','rawAttributes','find','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledat','phone','LOCK','UPDATE','Contact','Company','CmList','List','VoiceQueue','Queue','getPreviewRecall','findOne','recallme','CmCompany','dialActive','isNumber','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8b1,0x105));var _0x1d8b=function(_0x2489a0,_0x1e47ea){_0x2489a0=_0x2489a0-0x0;var _0x596008=_0xd8b1[_0x2489a0];return _0x596008;};'use strict';var moment=require(_0x1d8b('0x0'));var _=require(_0x1d8b('0x1'));var qs=require(_0x1d8b('0x2'));var logger=require(_0x1d8b('0x3'))(_0x1d8b('0x4'));var shared=require('../../config/environment');var db=require(_0x1d8b('0x5'))['db'];function respondWithResult(_0x417c87,_0x531170){_0x531170=_0x531170||0xc8;return function(_0xad218){if(_0xad218){return _0x417c87['status'](_0x531170)['json'](_0xad218);}};}function respondWithFilteredResult(_0x4d5ba0,_0x27534c){return function(_0x5f5bbd){if(_0x5f5bbd){var _0x3eb93a=typeof _0x27534c[_0x1d8b('0x6')]===_0x1d8b('0x7')&&typeof _0x27534c[_0x1d8b('0x8')]==='undefined';var _0x4c099e=_0x5f5bbd[_0x1d8b('0x9')];var _0x51ba29=_0x3eb93a?0x0:_0x27534c['offset'];var _0x321de3=_0x3eb93a?_0x5f5bbd['count']:_0x27534c[_0x1d8b('0x6')]+_0x27534c['limit'];var _0x1b4d0e;if(_0x321de3>=_0x4c099e){_0x321de3=_0x4c099e;_0x1b4d0e=0xc8;}else{_0x1b4d0e=0xce;}_0x4d5ba0[_0x1d8b('0xa')](_0x1b4d0e);return _0x4d5ba0[_0x1d8b('0xb')](_0x1d8b('0xc'),_0x51ba29+'-'+_0x321de3+'/'+_0x4c099e)[_0x1d8b('0xd')](_0x5f5bbd);}return null;};}function saveUpdates(_0xfd985b,_0x4f506a){return function(_0xec0671){if(_0xec0671){return _0xec0671[_0x1d8b('0xe')](_0xfd985b)[_0x1d8b('0xf')](function(_0x1bf879){return _0x1bf879;});}return null;};}function handleEntityNotFound(_0x4486a8,_0x3a23d0){return function(_0x46bd8c){if(!_0x46bd8c){_0x4486a8[_0x1d8b('0x10')](0x194);}return _0x46bd8c;};}function handleError(_0x4fa6d8,_0x50c75f){_0x50c75f=_0x50c75f||0x1f4;return function(_0x3d54d3){logger[_0x1d8b('0x11')](_0x3d54d3[_0x1d8b('0x12')]);if(_0x3d54d3[_0x1d8b('0x13')]){delete _0x3d54d3[_0x1d8b('0x13')];}_0x4fa6d8[_0x1d8b('0xa')](_0x50c75f)['send'](_0x3d54d3);};}exports['index']=function(_0x3380d6,_0x100a9b){var _0x3710b2={},_0x1b6440={},_0x41b6fe={'count':0x0,'rows':[]};var _0x5d52c0=_[_0x1d8b('0x14')](db[_0x1d8b('0x15')]['rawAttributes'],function(_0x2d03e2){return{'name':_0x2d03e2[_0x1d8b('0x16')],'type':_0x2d03e2[_0x1d8b('0x17')]['key']};});_0x1b6440[_0x1d8b('0x18')]=_[_0x1d8b('0x14')](_0x5d52c0,_0x1d8b('0x13'));_0x1b6440[_0x1d8b('0x19')]=_[_0x1d8b('0x1a')](_0x3380d6[_0x1d8b('0x19')]);_0x1b6440[_0x1d8b('0x1b')]=_['intersection'](_0x1b6440[_0x1d8b('0x18')],_0x1b6440[_0x1d8b('0x19')]);_0x1b6440[_0x1d8b('0x1b')]=_[_0x1d8b('0x1c')](_0x1b6440['filters'],['$and',_0x1d8b('0x1d'),_0x1d8b('0x1e'),'$gte',_0x1d8b('0x1f'),_0x1d8b('0x20'),'$ne','$eq',_0x1d8b('0x21'),_0x1d8b('0x22'),_0x1d8b('0x23'),_0x1d8b('0x24'),_0x1d8b('0x25'),_0x1d8b('0x26'),_0x1d8b('0x27'),'$iLike',_0x1d8b('0x28'),'$like',_0x1d8b('0x29'),'$contains',_0x1d8b('0x2a'),_0x1d8b('0x2b')]);_0x3710b2[_0x1d8b('0x2c')]=_[_0x1d8b('0x2d')](_0x1b6440['model'],qs['fields'](_0x3380d6[_0x1d8b('0x19')][_0x1d8b('0x2e')]));_0x3710b2[_0x1d8b('0x2c')]=_0x3710b2[_0x1d8b('0x2c')][_0x1d8b('0x2f')]?_0x3710b2[_0x1d8b('0x2c')]:_0x1b6440['model'];if(!_0x3380d6[_0x1d8b('0x19')][_0x1d8b('0x30')](_0x1d8b('0x31'))){_0x3710b2[_0x1d8b('0x8')]=qs[_0x1d8b('0x8')](_0x3380d6[_0x1d8b('0x19')][_0x1d8b('0x8')]);_0x3710b2[_0x1d8b('0x6')]=qs[_0x1d8b('0x6')](_0x3380d6['query'][_0x1d8b('0x6')]);}_0x3710b2['order']=qs['sort'](_0x3380d6['query'][_0x1d8b('0x32')]);_0x3710b2[_0x1d8b('0x33')]=qs[_0x1d8b('0x1b')](_[_0x1d8b('0x34')](_0x3380d6[_0x1d8b('0x19')],_0x1b6440['filters']),_0x5d52c0);if(_0x3380d6[_0x1d8b('0x19')][_0x1d8b('0x35')]){_0x3710b2[_0x1d8b('0x33')]=_[_0x1d8b('0x36')](_0x3710b2[_0x1d8b('0x33')],{'$or':_[_0x1d8b('0x14')](_0x5d52c0,function(_0x32eec8){if(_0x32eec8[_0x1d8b('0x17')]!=='VIRTUAL'){var _0x45517f={};_0x45517f[_0x32eec8['name']]={'$like':'%'+_0x3380d6[_0x1d8b('0x19')]['filter']+'%'};return _0x45517f;}})});}_0x3710b2=_[_0x1d8b('0x36')]({},_0x3710b2,_0x3380d6[_0x1d8b('0x37')]);var _0x10c520={'where':_0x3710b2['where']};return db[_0x1d8b('0x15')][_0x1d8b('0x9')](_0x10c520)[_0x1d8b('0xf')](function(_0x197a15){_0x41b6fe['count']=_0x197a15;if(_0x3380d6[_0x1d8b('0x19')][_0x1d8b('0x38')]){_0x3710b2['include']=[{'all':!![]}];}return db[_0x1d8b('0x15')]['findAll'](_0x3710b2);})['then'](function(_0x59b7ee){_0x41b6fe[_0x1d8b('0x39')]=_0x59b7ee;return _0x41b6fe;})[_0x1d8b('0xf')](respondWithFilteredResult(_0x100a9b,_0x3710b2))[_0x1d8b('0x3a')](handleError(_0x100a9b,null));};exports[_0x1d8b('0x3b')]=function(_0x441a27,_0xe3569b){var _0xaee456={'raw':!![],'where':{'id':_0x441a27[_0x1d8b('0x3c')]['id']}},_0x5e7e57={};_0x5e7e57['model']=_[_0x1d8b('0x1a')](db['CmHopper'][_0x1d8b('0x3d')]);_0x5e7e57[_0x1d8b('0x19')]=_[_0x1d8b('0x1a')](_0x441a27[_0x1d8b('0x19')]);_0x5e7e57[_0x1d8b('0x1b')]=_[_0x1d8b('0x2d')](_0x5e7e57[_0x1d8b('0x18')],_0x5e7e57['query']);_0xaee456['attributes']=_[_0x1d8b('0x2d')](_0x5e7e57[_0x1d8b('0x18')],qs[_0x1d8b('0x2e')](_0x441a27[_0x1d8b('0x19')][_0x1d8b('0x2e')]));_0xaee456['attributes']=_0xaee456[_0x1d8b('0x2c')][_0x1d8b('0x2f')]?_0xaee456['attributes']:_0x5e7e57['model'];if(_0x441a27['query'][_0x1d8b('0x38')]){_0xaee456['include']=[{'all':!![]}];}_0xaee456=_[_0x1d8b('0x36')]({},_0xaee456,_0x441a27[_0x1d8b('0x37')]);return db['CmHopper'][_0x1d8b('0x3e')](_0xaee456)[_0x1d8b('0xf')](handleEntityNotFound(_0xe3569b,null))[_0x1d8b('0xf')](respondWithResult(_0xe3569b,null))[_0x1d8b('0x3a')](handleError(_0xe3569b,null));};exports[_0x1d8b('0x3f')]=function(_0x571ea6,_0x495536){return db[_0x1d8b('0x15')][_0x1d8b('0x3f')](_0x571ea6[_0x1d8b('0x40')],{})['then'](respondWithResult(_0x495536,0xc9))[_0x1d8b('0x3a')](handleError(_0x495536,null));};exports[_0x1d8b('0xe')]=function(_0x143d7c,_0x30971f){if(_0x143d7c[_0x1d8b('0x40')]['id']){delete _0x143d7c[_0x1d8b('0x40')]['id'];}return db[_0x1d8b('0x15')][_0x1d8b('0x3e')]({'where':{'id':_0x143d7c['params']['id']}})[_0x1d8b('0xf')](handleEntityNotFound(_0x30971f,null))[_0x1d8b('0xf')](saveUpdates(_0x143d7c[_0x1d8b('0x40')],null))[_0x1d8b('0xf')](respondWithResult(_0x30971f,null))[_0x1d8b('0x3a')](handleError(_0x30971f,null));};exports[_0x1d8b('0x41')]=function(_0x44cc0f,_0x15c069){return db['CmHopper'][_0x1d8b('0x41')]()[_0x1d8b('0xf')](respondWithResult(_0x15c069,null))['catch'](handleError(_0x15c069,null));};exports['destroy']=function(_0x33d7cd,_0x51584d){var _0x36635f;var _0x185f50=_0x33d7cd[_0x1d8b('0x3c')]['id'];return db[_0x1d8b('0x15')][_0x1d8b('0x3e')]({'where':{'id':_0x33d7cd[_0x1d8b('0x3c')]['id']}})[_0x1d8b('0xf')](handleEntityNotFound(_0x51584d,null))[_0x1d8b('0xf')](function(_0x280c02){if(_0x280c02){return _0x280c02[_0x1d8b('0x42')]()[_0x1d8b('0xf')](function(_0x29d30c){return _0x29d30c;});}})[_0x1d8b('0xf')](function(_0x11a39d){_0x36635f=_0x11a39d;if(_0x11a39d){if(_0x11a39d[_0x1d8b('0x43')]||_0x11a39d[_0x1d8b('0x44')]){return db[_0x11a39d['VoiceQueueId']?'VoiceQueue':_0x1d8b('0x45')][_0x1d8b('0x3e')]({'where':{'id':_0x11a39d['VoiceQueueId']?_0x11a39d[_0x1d8b('0x43')]:_0x11a39d['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x1bcd96){var _0x2e0383={};if(_0x1bcd96){_[_0x1d8b('0x36')](_0x2e0383,_[_0x1d8b('0x46')](_0x36635f['dataValues'],[_0x1d8b('0x47'),_0x1d8b('0x48'),'id']));_0x2e0383[_0x1d8b('0x49')]=0x15;_0x2e0383[_0x1d8b('0x4a')]=_0x1d8b('0x4b');_0x2e0383['campaign']=_0x1bcd96[_0x1d8b('0x13')];_0x2e0383[_0x1d8b('0x4c')]=_0x33d7cd[_0x1d8b('0x4d')]['name'];_0x2e0383[_0x1d8b('0x4e')]=_0x33d7cd[_0x1d8b('0x4d')]['id'];_0x2e0383[_0x1d8b('0x4b')]=!![];_0x2e0383['deletedat']=moment()[_0x1d8b('0x4f')](_0x1d8b('0x50'));_0x2e0383['calleridnum']=_0x36635f['phone'];_0x2e0383[_0x1d8b('0x51')]=_0x36635f[_0x1d8b('0x43')]?_0x1d8b('0x52'):_0x1d8b('0x53');return db[_0x1d8b('0x54')][_0x1d8b('0x3e')]({'where':{'id':_0x2e0383[_0x1d8b('0x55')]},'attributes':[_0x1d8b('0x56'),_0x1d8b('0x57')]})[_0x1d8b('0xf')](function(_0x461ace){if(!_['isNil'](_0x51584d)&&!_[_0x1d8b('0x58')](_0x461ace[_0x1d8b('0x56')])){_0x2e0383[_0x1d8b('0x59')]=_0x461ace[_0x1d8b('0x56')];if(!_[_0x1d8b('0x58')](_0x461ace[_0x1d8b('0x57')])){_0x2e0383['calleridname']+='\x20'+_0x461ace['lastName'];}}})[_0x1d8b('0x5a')](function(){return db[_0x1d8b('0x5b')]['create'](_0x2e0383);});}})[_0x1d8b('0xf')](function(_0xe6c3fa){return db['CmHopperAdditionalPhone'][_0x1d8b('0x42')]({'where':{'CmHopperId':_0x185f50}});})[_0x1d8b('0xf')](function(){return _0x51584d['status'](0xcc)[_0x1d8b('0x5c')]();})[_0x1d8b('0x3a')](handleError(_0x51584d,null));};exports[_0x1d8b('0x5d')]=function(_0x435482,_0x58dfc){var _0x3cd223=[];return db['CmContact'][_0x1d8b('0x41')]()[_0x1d8b('0xf')](function(_0x4e061c){_0x3cd223=_[_0x1d8b('0x1a')](_0x4e061c);return _0x435482[_0x1d8b('0x4d')][_0x1d8b('0x5e')]({'where':{'type':_0x1d8b('0x5f'),'dialActive':!![],'dialMethod':_0x1d8b('0x60')},'attributes':['id','dialOrderByScheduledAt',_0x1d8b('0x61')],'raw':!![]});})[_0x1d8b('0xf')](function(_0x2a44ab){if(_0x2a44ab&&_0x2a44ab[_0x1d8b('0x2f')]){return db['sequelize']['transaction'](function(_0x227845){var _0x37f9e6={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1d8b('0x4f')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x2a44ab,'id')},'$or':[{'UserId':null},{'UserId':_0x435482['user']['id']}]};var _0x2f02a2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2a44ab)[_0x1d8b('0x35')](['dialPreviewAutoRecallMe',0x0])[_0x1d8b('0x14')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x435482[_0x1d8b('0x4d')]['id']}]};var _0x165fb1={'$or':[_0x37f9e6,_0x2f02a2]};var _0x19b293=[];if(_0x435482[_0x1d8b('0x40')][_0x1d8b('0x62')]&&_0x435482[_0x1d8b('0x40')][_0x1d8b('0x62')]===_0x1d8b('0x63')){if(!_[_0x1d8b('0x64')](_0x435482[_0x1d8b('0x40')][_0x1d8b('0x65')])){_0x165fb1['id']={'$in':_0x435482['body'][_0x1d8b('0x65')]};}_0x19b293=[[_0x1d8b('0x66'),_0x1d8b('0x67')],[_0x1d8b('0x68'),_0x2a44ab[0x0][_0x1d8b('0x69')]===_0x1d8b('0x67')?_0x1d8b('0x6a'):_0x1d8b('0x67')],db[_0x1d8b('0x6b')][_0x1d8b('0x6c')](_0x1d8b('0x6d')),['id',_0x1d8b('0x6a')]];}else{if(!_[_0x1d8b('0x64')](_0x435482[_0x1d8b('0x40')][_0x1d8b('0x65')])){_0x165fb1['id']={'$notIn':_0x435482[_0x1d8b('0x40')][_0x1d8b('0x65')]};}_0x19b293=[[_0x1d8b('0x66'),_0x1d8b('0x6a')],[_0x1d8b('0x68'),_0x2a44ab[0x0][_0x1d8b('0x69')]],db[_0x1d8b('0x6b')][_0x1d8b('0x6c')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x1d8b('0x67')]];}return db[_0x1d8b('0x15')]['findOne']({'attributes':['id',_0x1d8b('0x6e'),_0x1d8b('0x6f'),'recallme'],'where':_0x165fb1,'order':_0x19b293,'transaction':_0x227845,'lock':_0x227845[_0x1d8b('0x70')][_0x1d8b('0x71')],'include':[{'model':db[_0x1d8b('0x54')],'as':_0x1d8b('0x72'),'attributes':_0x3cd223,'include':[{'model':db['CmCompany'],'as':_0x1d8b('0x73'),'attributes':['id','name']}]},{'model':db[_0x1d8b('0x74')],'as':_0x1d8b('0x75'),'attributes':['id',_0x1d8b('0x13')]},{'model':db[_0x1d8b('0x76')],'as':_0x1d8b('0x77'),'attributes':['id','name','dialActive']}]})['then'](function(_0x47f6f){if(_0x47f6f){return _0x47f6f[_0x1d8b('0xe')]({'UserId':_0x435482[_0x1d8b('0x4d')]['id']},{'transaction':_0x227845});}});});}})[_0x1d8b('0xf')](handleEntityNotFound(_0x58dfc,null))[_0x1d8b('0xf')](respondWithResult(_0x58dfc,null))[_0x1d8b('0x3a')](handleError(_0x58dfc,null));};exports[_0x1d8b('0x78')]=function(_0x4a60c1,_0x41c4c3,_0x35171d){var _0x526da9=[];var _0x45c76b=_0x4a60c1[_0x1d8b('0x3c')]['id'];var _0x42b66a=_0x4a60c1['user']['id'];return db[_0x1d8b('0x54')][_0x1d8b('0x41')]()['then'](function(_0x300ffb){_0x526da9=_[_0x1d8b('0x1a')](_0x300ffb);return db[_0x1d8b('0x6b')]['transaction'](function(_0x1a3c4c){const _0x222978={'id':_0x45c76b};return db[_0x1d8b('0x15')][_0x1d8b('0x79')]({'attributes':['id',_0x1d8b('0x6e'),_0x1d8b('0x7a')],'where':_0x222978,'transaction':_0x1a3c4c,'lock':_0x1a3c4c[_0x1d8b('0x70')][_0x1d8b('0x71')],'include':[{'model':db[_0x1d8b('0x54')],'as':'Contact','attributes':_0x526da9,'include':[{'model':db[_0x1d8b('0x7b')],'as':'Company','attributes':['id',_0x1d8b('0x13')]}]},{'model':db[_0x1d8b('0x74')],'as':_0x1d8b('0x75'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x1d8b('0x77'),'attributes':['id','name',_0x1d8b('0x7c')]}]})[_0x1d8b('0xf')](function(_0x6f5c0d){if(_0x6f5c0d){return _0x6f5c0d[_0x1d8b('0xe')]({'UserId':_0x42b66a},{'transaction':_0x1a3c4c});}});});})[_0x1d8b('0xf')](handleEntityNotFound(_0x41c4c3,null))[_0x1d8b('0xf')](respondWithResult(_0x41c4c3,null))[_0x1d8b('0x3a')](handleError(_0x41c4c3,null));};exports['getOpenContacts']=function(_0x5a85d7,_0x383fe3){return _0x5a85d7[_0x1d8b('0x4d')]['getVoiceQueues']({'where':{'type':_0x1d8b('0x5f'),'dialActive':!![],'dialMethod':_0x1d8b('0x60')},'attributes':['id'],'raw':!![]})['then'](function(_0x977610){if(_0x977610&&_0x977610[_0x1d8b('0x2f')]){return db[_0x1d8b('0x15')][_0x1d8b('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1d8b('0x4f')](_0x1d8b('0x50'))},'VoiceQueueId':{'$in':_[_0x1d8b('0x14')](_0x977610,'id')},'$or':[{'UserId':null},{'UserId':_0x5a85d7[_0x1d8b('0x4d')]['id']}]}});}return 0x0;})[_0x1d8b('0xf')](function(_0x3e2f6f){if(!_[_0x1d8b('0x58')](_0x3e2f6f)&&_[_0x1d8b('0x7d')](_0x3e2f6f)){return _0x383fe3[_0x1d8b('0xa')](0xc8)['json']({'contacts':_0x3e2f6f});}else{logger[_0x1d8b('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0x1d8b('0x7e'));_0x383fe3['sendStatus'](0x194);}})['catch'](handleError(_0x383fe3,null));};exports[_0x1d8b('0x7f')]=function(_0xbf3c45,_0x3f5703){var _0x5cb898=shared[_0x1d8b('0x80')];var _0x34af39=[];_[_0x1d8b('0x14')](_0x5cb898,function(_0x298a67){_0x34af39[_0x1d8b('0x81')]({'id':_0x298a67[_0x1d8b('0x13')],'name':_0x298a67[_0x1d8b('0x13')],'utcOffset':_0x298a67[_0x1d8b('0x82')]});});return _0x3f5703['status'](0xc8)[_0x1d8b('0xd')]({'tz':_0x34af39});};exports['getTimezone']=function(_0x479d71,_0x3af3d4){var _0x4dc9d3=shared[_0x1d8b('0x80')];var _0x4d4302={};if(!_[_0x1d8b('0x58')](_0x4dc9d3[_0x479d71[_0x1d8b('0x40')]['id']]))_0x4d4302=_0x4dc9d3[_0x479d71['body']['id']];return _0x3af3d4[_0x1d8b('0xa')](0xc8)[_0x1d8b('0xd')](_0x4d4302);}; \ No newline at end of file +var _0xf2ca=['attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','destroy','CampaignId','VoiceQueueId','omit','dataValues','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','value','direction','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','LOCK','CmCompany','Company','CmList','List','VoiceQueue','Queue','findOne','scheduledat','Contact','dialActive','getOpenContacts','preview','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','json','offset','undefined','count','status','set','Content-Range','update','then','sendStatus','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','key','model','query','filters','intersection','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$any'];(function(_0x29920c,_0x57fb6f){var _0x49bd86=function(_0x36262e){while(--_0x36262e){_0x29920c['push'](_0x29920c['shift']());}};_0x49bd86(++_0x57fb6f);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x12877b,_0x8650cf){_0x12877b=_0x12877b-0x0;var _0x3549ff=_0xf2ca[_0x12877b];return _0x3549ff;};'use strict';var moment=require(_0xaf2c('0x0'));var _=require(_0xaf2c('0x1'));var qs=require(_0xaf2c('0x2'));var logger=require('../../config/logger')(_0xaf2c('0x3'));var shared=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];function respondWithResult(_0x219511,_0x3a724c){_0x3a724c=_0x3a724c||0xc8;return function(_0x10c910){if(_0x10c910){return _0x219511['status'](_0x3a724c)[_0xaf2c('0x6')](_0x10c910);}};}function respondWithFilteredResult(_0x100d17,_0x297740){return function(_0x1f9531){if(_0x1f9531){var _0x58351f=typeof _0x297740[_0xaf2c('0x7')]===_0xaf2c('0x8')&&typeof _0x297740['limit']===_0xaf2c('0x8');var _0x4ba0a2=_0x1f9531[_0xaf2c('0x9')];var _0x4a0064=_0x58351f?0x0:_0x297740[_0xaf2c('0x7')];var _0x144a7a=_0x58351f?_0x1f9531[_0xaf2c('0x9')]:_0x297740[_0xaf2c('0x7')]+_0x297740['limit'];var _0x4adc8c;if(_0x144a7a>=_0x4ba0a2){_0x144a7a=_0x4ba0a2;_0x4adc8c=0xc8;}else{_0x4adc8c=0xce;}_0x100d17[_0xaf2c('0xa')](_0x4adc8c);return _0x100d17[_0xaf2c('0xb')](_0xaf2c('0xc'),_0x4a0064+'-'+_0x144a7a+'/'+_0x4ba0a2)[_0xaf2c('0x6')](_0x1f9531);}return null;};}function saveUpdates(_0x285dac,_0x59a59b){return function(_0x590126){if(_0x590126){return _0x590126[_0xaf2c('0xd')](_0x285dac)[_0xaf2c('0xe')](function(_0x935959){return _0x935959;});}return null;};}function handleEntityNotFound(_0x18a8a5,_0x293ca6){return function(_0x152c73){if(!_0x152c73){_0x18a8a5[_0xaf2c('0xf')](0x194);}return _0x152c73;};}function handleError(_0x3c1088,_0x2119c8){_0x2119c8=_0x2119c8||0x1f4;return function(_0x1d0633){logger[_0xaf2c('0x10')](_0x1d0633[_0xaf2c('0x11')]);if(_0x1d0633[_0xaf2c('0x12')]){delete _0x1d0633[_0xaf2c('0x12')];}_0x3c1088[_0xaf2c('0xa')](_0x2119c8)['send'](_0x1d0633);};}exports[_0xaf2c('0x13')]=function(_0x553163,_0x278a28){var _0x474c80={},_0x1d544a={},_0x578492={'count':0x0,'rows':[]};var _0x28ae7b=_[_0xaf2c('0x14')](db[_0xaf2c('0x15')][_0xaf2c('0x16')],function(_0x3f977c){return{'name':_0x3f977c[_0xaf2c('0x17')],'type':_0x3f977c['type'][_0xaf2c('0x18')]};});_0x1d544a[_0xaf2c('0x19')]=_[_0xaf2c('0x14')](_0x28ae7b,_0xaf2c('0x12'));_0x1d544a[_0xaf2c('0x1a')]=_['keys'](_0x553163[_0xaf2c('0x1a')]);_0x1d544a[_0xaf2c('0x1b')]=_[_0xaf2c('0x1c')](_0x1d544a['model'],_0x1d544a['query']);_0x1d544a[_0xaf2c('0x1b')]=_[_0xaf2c('0x1d')](_0x1d544a[_0xaf2c('0x1b')],[_0xaf2c('0x1e'),'$or',_0xaf2c('0x1f'),_0xaf2c('0x20'),_0xaf2c('0x21'),_0xaf2c('0x22'),_0xaf2c('0x23'),_0xaf2c('0x24'),_0xaf2c('0x25'),'$between',_0xaf2c('0x26'),_0xaf2c('0x27'),_0xaf2c('0x28'),_0xaf2c('0x29'),'$notLike',_0xaf2c('0x2a'),'$notILike',_0xaf2c('0x29'),_0xaf2c('0x2b'),_0xaf2c('0x2c'),'$contained',_0xaf2c('0x2d')]);_0x474c80[_0xaf2c('0x2e')]=_[_0xaf2c('0x1c')](_0x1d544a['model'],qs[_0xaf2c('0x2f')](_0x553163[_0xaf2c('0x1a')][_0xaf2c('0x2f')]));_0x474c80[_0xaf2c('0x2e')]=_0x474c80['attributes'][_0xaf2c('0x30')]?_0x474c80[_0xaf2c('0x2e')]:_0x1d544a[_0xaf2c('0x19')];if(!_0x553163['query']['hasOwnProperty'](_0xaf2c('0x31'))){_0x474c80['limit']=qs[_0xaf2c('0x32')](_0x553163['query'][_0xaf2c('0x32')]);_0x474c80[_0xaf2c('0x7')]=qs['offset'](_0x553163[_0xaf2c('0x1a')][_0xaf2c('0x7')]);}_0x474c80['order']=qs[_0xaf2c('0x33')](_0x553163[_0xaf2c('0x1a')][_0xaf2c('0x33')]);_0x474c80[_0xaf2c('0x34')]=qs[_0xaf2c('0x1b')](_[_0xaf2c('0x35')](_0x553163['query'],_0x1d544a[_0xaf2c('0x1b')]),_0x28ae7b);if(_0x553163['query'][_0xaf2c('0x36')]){_0x474c80['where']=_[_0xaf2c('0x37')](_0x474c80['where'],{'$or':_[_0xaf2c('0x14')](_0x28ae7b,function(_0x4e877e){if(_0x4e877e[_0xaf2c('0x38')]!=='VIRTUAL'){var _0x30fd87={};_0x30fd87[_0x4e877e[_0xaf2c('0x12')]]={'$like':'%'+_0x553163[_0xaf2c('0x1a')][_0xaf2c('0x36')]+'%'};return _0x30fd87;}})});}_0x474c80=_[_0xaf2c('0x37')]({},_0x474c80,_0x553163['options']);var _0x4cba13={'where':_0x474c80[_0xaf2c('0x34')]};return db[_0xaf2c('0x15')][_0xaf2c('0x9')](_0x4cba13)[_0xaf2c('0xe')](function(_0x4eeecf){_0x578492[_0xaf2c('0x9')]=_0x4eeecf;if(_0x553163['query'][_0xaf2c('0x39')]){_0x474c80[_0xaf2c('0x3a')]=[{'all':!![]}];}return db['CmHopper'][_0xaf2c('0x3b')](_0x474c80);})[_0xaf2c('0xe')](function(_0x25bebd){_0x578492[_0xaf2c('0x3c')]=_0x25bebd;return _0x578492;})[_0xaf2c('0xe')](respondWithFilteredResult(_0x278a28,_0x474c80))[_0xaf2c('0x3d')](handleError(_0x278a28,null));};exports[_0xaf2c('0x3e')]=function(_0x310d3b,_0x296ca8){var _0x106eb9={'raw':!![],'where':{'id':_0x310d3b[_0xaf2c('0x3f')]['id']}},_0x28e2b5={};_0x28e2b5[_0xaf2c('0x19')]=_['keys'](db['CmHopper']['rawAttributes']);_0x28e2b5[_0xaf2c('0x1a')]=_[_0xaf2c('0x40')](_0x310d3b[_0xaf2c('0x1a')]);_0x28e2b5[_0xaf2c('0x1b')]=_[_0xaf2c('0x1c')](_0x28e2b5[_0xaf2c('0x19')],_0x28e2b5['query']);_0x106eb9[_0xaf2c('0x2e')]=_[_0xaf2c('0x1c')](_0x28e2b5[_0xaf2c('0x19')],qs['fields'](_0x310d3b['query'][_0xaf2c('0x2f')]));_0x106eb9['attributes']=_0x106eb9[_0xaf2c('0x2e')][_0xaf2c('0x30')]?_0x106eb9[_0xaf2c('0x2e')]:_0x28e2b5[_0xaf2c('0x19')];if(_0x310d3b['query'][_0xaf2c('0x39')]){_0x106eb9['include']=[{'all':!![]}];}_0x106eb9=_[_0xaf2c('0x37')]({},_0x106eb9,_0x310d3b[_0xaf2c('0x41')]);return db['CmHopper'][_0xaf2c('0x42')](_0x106eb9)['then'](handleEntityNotFound(_0x296ca8,null))[_0xaf2c('0xe')](respondWithResult(_0x296ca8,null))[_0xaf2c('0x3d')](handleError(_0x296ca8,null));};exports[_0xaf2c('0x43')]=function(_0x339f35,_0x16eeb2){return db[_0xaf2c('0x15')][_0xaf2c('0x43')](_0x339f35[_0xaf2c('0x44')],{})[_0xaf2c('0xe')](respondWithResult(_0x16eeb2,0xc9))['catch'](handleError(_0x16eeb2,null));};exports['update']=function(_0x18e62b,_0x4d0977){if(_0x18e62b['body']['id']){delete _0x18e62b['body']['id'];}return db[_0xaf2c('0x15')][_0xaf2c('0x42')]({'where':{'id':_0x18e62b[_0xaf2c('0x3f')]['id']}})[_0xaf2c('0xe')](handleEntityNotFound(_0x4d0977,null))['then'](saveUpdates(_0x18e62b[_0xaf2c('0x44')],null))['then'](respondWithResult(_0x4d0977,null))[_0xaf2c('0x3d')](handleError(_0x4d0977,null));};exports['describe']=function(_0x166c26,_0x133e8c){return db[_0xaf2c('0x15')][_0xaf2c('0x45')]()[_0xaf2c('0xe')](respondWithResult(_0x133e8c,null))['catch'](handleError(_0x133e8c,null));};exports[_0xaf2c('0x46')]=function(_0x26afee,_0x4b3ca4){var _0x4e8efd;var _0x367b30=_0x26afee['params']['id'];return db[_0xaf2c('0x15')][_0xaf2c('0x42')]({'where':{'id':_0x26afee[_0xaf2c('0x3f')]['id']}})[_0xaf2c('0xe')](handleEntityNotFound(_0x4b3ca4,null))[_0xaf2c('0xe')](function(_0x27a3c0){if(_0x27a3c0){return _0x27a3c0[_0xaf2c('0x46')]()[_0xaf2c('0xe')](function(_0x31ccfe){return _0x31ccfe;});}})[_0xaf2c('0xe')](function(_0x371486){_0x4e8efd=_0x371486;if(_0x371486){if(_0x371486['VoiceQueueId']||_0x371486[_0xaf2c('0x47')]){return db[_0x371486[_0xaf2c('0x48')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x371486[_0xaf2c('0x48')]?_0x371486[_0xaf2c('0x48')]:_0x371486['CampaignId']},'attributes':['id',_0xaf2c('0x12')],'raw':!![]});}}})[_0xaf2c('0xe')](function(_0x1497fa){var _0x3085e5={};if(_0x1497fa){_[_0xaf2c('0x37')](_0x3085e5,_[_0xaf2c('0x49')](_0x4e8efd[_0xaf2c('0x4a')],['createdAt',_0xaf2c('0x4b'),'id']));_0x3085e5[_0xaf2c('0x4c')]=0x15;_0x3085e5['statedesc']=_0xaf2c('0x4d');_0x3085e5[_0xaf2c('0x4e')]=_0x1497fa[_0xaf2c('0x12')];_0x3085e5[_0xaf2c('0x4f')]=_0x26afee[_0xaf2c('0x50')][_0xaf2c('0x12')];_0x3085e5[_0xaf2c('0x51')]=_0x26afee[_0xaf2c('0x50')]['id'];_0x3085e5[_0xaf2c('0x4d')]=!![];_0x3085e5[_0xaf2c('0x52')]=moment()[_0xaf2c('0x53')](_0xaf2c('0x54'));_0x3085e5[_0xaf2c('0x55')]=_0x4e8efd[_0xaf2c('0x56')];_0x3085e5[_0xaf2c('0x57')]=_0x4e8efd[_0xaf2c('0x48')]?_0xaf2c('0x58'):_0xaf2c('0x59');return db[_0xaf2c('0x5a')][_0xaf2c('0x42')]({'where':{'id':_0x3085e5['ContactId']},'attributes':[_0xaf2c('0x5b'),_0xaf2c('0x5c')]})[_0xaf2c('0xe')](function(_0x5b8b68){if(!_[_0xaf2c('0x5d')](_0x4b3ca4)&&!_['isNil'](_0x5b8b68[_0xaf2c('0x5b')])){_0x3085e5[_0xaf2c('0x5e')]=_0x5b8b68[_0xaf2c('0x5b')];if(!_[_0xaf2c('0x5d')](_0x5b8b68[_0xaf2c('0x5c')])){_0x3085e5[_0xaf2c('0x5e')]+='\x20'+_0x5b8b68[_0xaf2c('0x5c')];}}})[_0xaf2c('0x5f')](function(){return db[_0xaf2c('0x60')]['create'](_0x3085e5);});}})[_0xaf2c('0xe')](function(_0x400dcd){return db[_0xaf2c('0x61')][_0xaf2c('0x46')]({'where':{'CmHopperId':_0x367b30}});})[_0xaf2c('0xe')](function(){return _0x4b3ca4['status'](0xcc)[_0xaf2c('0x62')]();})[_0xaf2c('0x3d')](handleError(_0x4b3ca4,null));};exports['getPreview']=function(_0x33aa67,_0xeb3be0){var _0x4b7070=[];return db['CmContact'][_0xaf2c('0x45')]()[_0xaf2c('0xe')](function(_0xc83d19){_0x4b7070=_[_0xaf2c('0x40')](_0xc83d19);return _0x33aa67['user'][_0xaf2c('0x63')]({'where':{'type':_0xaf2c('0x64'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xaf2c('0x65'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xaf2c('0xe')](function(_0xe6a251){if(_0xe6a251&&_0xe6a251[_0xaf2c('0x30')]){return db[_0xaf2c('0x66')][_0xaf2c('0x67')](function(_0x348f7e){var _0x1c9639={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xaf2c('0x53')](_0xaf2c('0x54'))},'VoiceQueueId':{'$in':_[_0xaf2c('0x14')](_0xe6a251,'id')},'$or':[{'UserId':null},{'UserId':_0x33aa67['user']['id']}]};var _0x79d962={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xe6a251)[_0xaf2c('0x36')]([_0xaf2c('0x68'),0x0])[_0xaf2c('0x14')]('id')[_0xaf2c('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x33aa67['user']['id']}]};var _0xbfb776={'$or':[_0x1c9639,_0x79d962]};var _0x28b09f=[];if(_0x33aa67[_0xaf2c('0x44')][_0xaf2c('0x6a')]&&_0x33aa67[_0xaf2c('0x44')]['direction']==='prev'){if(!_[_0xaf2c('0x6b')](_0x33aa67[_0xaf2c('0x44')]['hopperIds'])){_0xbfb776['id']={'$in':_0x33aa67[_0xaf2c('0x44')][_0xaf2c('0x6c')]};}_0x28b09f=[[_0xaf2c('0x6d'),'ASC'],[_0xaf2c('0x6e'),_0xe6a251[0x0][_0xaf2c('0x65')]===_0xaf2c('0x6f')?_0xaf2c('0x70'):'ASC'],db[_0xaf2c('0x66')][_0xaf2c('0x71')](_0xaf2c('0x72')),['id',_0xaf2c('0x70')]];}else{if(!_[_0xaf2c('0x6b')](_0x33aa67[_0xaf2c('0x44')][_0xaf2c('0x6c')])){_0xbfb776['id']={'$notIn':_0x33aa67[_0xaf2c('0x44')][_0xaf2c('0x6c')]};}_0x28b09f=[[_0xaf2c('0x6d'),_0xaf2c('0x70')],['scheduledAt',_0xe6a251[0x0][_0xaf2c('0x65')]],db['sequelize'][_0xaf2c('0x71')](_0xaf2c('0x73')),['id','ASC']];}return db[_0xaf2c('0x15')]['findOne']({'attributes':['id','scheduledat',_0xaf2c('0x56'),_0xaf2c('0x74')],'where':_0xbfb776,'order':_0x28b09f,'transaction':_0x348f7e,'lock':_0x348f7e[_0xaf2c('0x75')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x4b7070,'include':[{'model':db[_0xaf2c('0x76')],'as':_0xaf2c('0x77'),'attributes':['id','name']}]},{'model':db[_0xaf2c('0x78')],'as':_0xaf2c('0x79'),'attributes':['id',_0xaf2c('0x12')]},{'model':db[_0xaf2c('0x7a')],'as':_0xaf2c('0x7b'),'attributes':['id',_0xaf2c('0x12'),'dialActive']}]})[_0xaf2c('0xe')](function(_0x399a67){if(_0x399a67){return _0x399a67[_0xaf2c('0xd')]({'UserId':_0x33aa67['user']['id']},{'transaction':_0x348f7e});}});});}})[_0xaf2c('0xe')](handleEntityNotFound(_0xeb3be0,null))[_0xaf2c('0xe')](respondWithResult(_0xeb3be0,null))[_0xaf2c('0x3d')](handleError(_0xeb3be0,null));};exports['getPreviewRecall']=function(_0x3a23a8,_0x31125a,_0x433f9e){var _0x5f705=[];var _0x491160=_0x3a23a8[_0xaf2c('0x3f')]['id'];var _0x309532=_0x3a23a8[_0xaf2c('0x50')]['id'];return db['CmContact']['describe']()[_0xaf2c('0xe')](function(_0x1b7dc1){_0x5f705=_['keys'](_0x1b7dc1);return db[_0xaf2c('0x66')][_0xaf2c('0x67')](function(_0x5365fa){const _0x41e739={'id':_0x491160};return db[_0xaf2c('0x15')][_0xaf2c('0x7c')]({'attributes':['id',_0xaf2c('0x7d'),_0xaf2c('0x74')],'where':_0x41e739,'transaction':_0x5365fa,'lock':_0x5365fa['LOCK']['UPDATE'],'include':[{'model':db[_0xaf2c('0x5a')],'as':_0xaf2c('0x7e'),'attributes':_0x5f705,'include':[{'model':db[_0xaf2c('0x76')],'as':'Company','attributes':['id',_0xaf2c('0x12')]}]},{'model':db[_0xaf2c('0x78')],'as':_0xaf2c('0x79'),'attributes':['id',_0xaf2c('0x12')]},{'model':db[_0xaf2c('0x7a')],'as':'Queue','attributes':['id',_0xaf2c('0x12'),_0xaf2c('0x7f')]}]})[_0xaf2c('0xe')](function(_0x1ef61f){if(_0x1ef61f){return _0x1ef61f[_0xaf2c('0xd')]({'UserId':_0x309532},{'transaction':_0x5365fa});}});});})[_0xaf2c('0xe')](handleEntityNotFound(_0x31125a,null))['then'](respondWithResult(_0x31125a,null))[_0xaf2c('0x3d')](handleError(_0x31125a,null));};exports[_0xaf2c('0x80')]=function(_0x483774,_0x5beb89){return _0x483774['user'][_0xaf2c('0x63')]({'where':{'type':_0xaf2c('0x64'),'dialActive':!![],'dialMethod':_0xaf2c('0x81')},'attributes':['id'],'raw':!![]})[_0xaf2c('0xe')](function(_0x499bbe){if(_0x499bbe&&_0x499bbe[_0xaf2c('0x30')]){return db[_0xaf2c('0x15')][_0xaf2c('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xaf2c('0x53')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xaf2c('0x14')](_0x499bbe,'id')},'$or':[{'UserId':null},{'UserId':_0x483774[_0xaf2c('0x50')]['id']}]}});}return 0x0;})[_0xaf2c('0xe')](function(_0x205e33){if(!_[_0xaf2c('0x5d')](_0x205e33)&&_['isNumber'](_0x205e33)){return _0x5beb89[_0xaf2c('0xa')](0xc8)[_0xaf2c('0x6')]({'contacts':_0x205e33});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xaf2c('0x80'),0x194,_0xaf2c('0x82'));_0x5beb89['sendStatus'](0x194);}})[_0xaf2c('0x3d')](handleError(_0x5beb89,null));};exports[_0xaf2c('0x83')]=function(_0x3b084f,_0xa75d65){var _0x24a09f=shared[_0xaf2c('0x84')];var _0x2a3cb4=[];_[_0xaf2c('0x14')](_0x24a09f,function(_0x4ac636){_0x2a3cb4[_0xaf2c('0x85')]({'id':_0x4ac636['name'],'name':_0x4ac636[_0xaf2c('0x12')],'utcOffset':_0x4ac636[_0xaf2c('0x86')]});});return _0xa75d65['status'](0xc8)['json']({'tz':_0x2a3cb4});};exports[_0xaf2c('0x87')]=function(_0x201546,_0xb8fee2){var _0x542b14=shared[_0xaf2c('0x84')];var _0x25df5c={};if(!_[_0xaf2c('0x5d')](_0x542b14[_0x201546['body']['id']]))_0x25df5c=_0x542b14[_0x201546['body']['id']];return _0xb8fee2['status'](0xc8)['json'](_0x25df5c);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 8399dc3..d4b1b99 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 _0x53ec=['moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x53ec,0x192));var _0xc53e=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x53ec[_0x5d30b4];return _0x1acfb8;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['util','../../config/logger','api','path','rimraf','./cmHopper.attributes','exports','CmHopper','scheduledat','priority','lodash'];(function(_0x2c862e,_0x13279c){var _0x2ec7ab=function(_0x4651f5){while(--_0x4651f5){_0x2c862e['push'](_0x2c862e['shift']());}};_0x2ec7ab(++_0x13279c);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1f77ee,_0x490240){_0x1f77ee=_0x1f77ee-0x0;var _0xa17984=_0xd8fb[_0x1f77ee];return _0xa17984;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]},{'name':'phone','fields':['phone']},{'name':_0xbd8f('0xa'),'fields':[_0xbd8f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 782bcfa..5891f68 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 _0x6c1f=['voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','raw','options','where','attributes','limit','map','include','model','then','info','debug','stringify','message','error','ShowCmHopper','catch','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','UPDATE','Contact','User','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','LOCK','GetContactRecallMe','GetCmHopperPreview','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0x6c1f,0x158));var _0xf6c1=function(_0x1de8cc,_0x3e3f90){_0x1de8cc=_0x1de8cc-0x0;var _0x6f59fa=_0x6c1f[_0x1de8cc];return _0x6f59fa;};'use strict';var _=require('lodash');var util=require(_0xf6c1('0x0'));var moment=require(_0xf6c1('0x1'));var BPromise=require(_0xf6c1('0x2'));var db=require(_0xf6c1('0x3'))['db'];var logger=require(_0xf6c1('0x4'))(_0xf6c1('0x5'));exports[_0xf6c1('0x6')]=function(_0x348e05){var _0x2fd698=this;return new Promise(function(_0x4a69c3,_0x28a231){return db[_0xf6c1('0x7')]['findAll']({'raw':_0x348e05['options']?_0x348e05['options'][_0xf6c1('0x8')]===undefined?!![]:![]:!![],'where':_0x348e05['options']?_0x348e05[_0xf6c1('0x9')][_0xf6c1('0xa')]||null:null,'attributes':_0x348e05[_0xf6c1('0x9')]?_0x348e05[_0xf6c1('0x9')][_0xf6c1('0xb')]||null:null,'limit':_0x348e05['options']?_0x348e05[_0xf6c1('0x9')][_0xf6c1('0xc')]||null:null,'include':_0x348e05[_0xf6c1('0x9')]?_0x348e05[_0xf6c1('0x9')]['include']?_[_0xf6c1('0xd')](_0x348e05[_0xf6c1('0x9')][_0xf6c1('0xe')],function(_0x41993f){return{'model':db[_0x41993f['model']],'as':_0x41993f['as'],'attributes':_0x41993f[_0xf6c1('0xb')],'include':_0x41993f['include']?_[_0xf6c1('0xd')](_0x41993f['include'],function(_0x428b30){return{'model':db[_0x428b30['model']],'as':_0x428b30['as'],'attributes':_0x428b30[_0xf6c1('0xb')],'include':_0x428b30[_0xf6c1('0xe')]?_['map'](_0x428b30[_0xf6c1('0xe')],function(_0x226d12){return{'model':db[_0x226d12[_0xf6c1('0xf')]],'as':_0x226d12['as'],'attributes':_0x226d12[_0xf6c1('0xb')]};}):[]};}):[]};}):[]:[]})[_0xf6c1('0x10')](function(_0x8dab43){logger[_0xf6c1('0x11')](_0xf6c1('0x6'),_0x348e05);logger[_0xf6c1('0x12')]('GetCmHopper',_0x348e05,JSON[_0xf6c1('0x13')](_0x8dab43));_0x4a69c3(_0x8dab43);})['catch'](function(_0x36d235){logger['error'](_0xf6c1('0x6'),_0x36d235[_0xf6c1('0x14')],_0x348e05);_0x28a231(_0x2fd698[_0xf6c1('0x15')](0x1f4,_0x36d235[_0xf6c1('0x14')]));});});};exports['ShowCmHopper']=function(_0x404c8a){var _0x3f6d1e=this;return new Promise(function(_0x5612a5,_0x1057b8){return db[_0xf6c1('0x7')]['find']({'raw':_0x404c8a[_0xf6c1('0x9')]?_0x404c8a[_0xf6c1('0x9')][_0xf6c1('0x8')]===undefined?!![]:![]:!![],'where':_0x404c8a[_0xf6c1('0x9')]?_0x404c8a[_0xf6c1('0x9')][_0xf6c1('0xa')]||null:null,'attributes':_0x404c8a[_0xf6c1('0x9')]?_0x404c8a[_0xf6c1('0x9')][_0xf6c1('0xb')]||null:null,'include':_0x404c8a['options']?_0x404c8a[_0xf6c1('0x9')][_0xf6c1('0xe')]?_['map'](_0x404c8a[_0xf6c1('0x9')][_0xf6c1('0xe')],function(_0x2160db){return{'model':db[_0x2160db[_0xf6c1('0xf')]],'as':_0x2160db['as'],'attributes':_0x2160db['attributes'],'include':_0x2160db['include']?_['map'](_0x2160db[_0xf6c1('0xe')],function(_0x145972){return{'model':db[_0x145972[_0xf6c1('0xf')]],'as':_0x145972['as'],'attributes':_0x145972[_0xf6c1('0xb')],'include':_0x145972[_0xf6c1('0xe')]?_[_0xf6c1('0xd')](_0x145972[_0xf6c1('0xe')],function(_0x33cd02){return{'model':db[_0x33cd02['model']],'as':_0x33cd02['as'],'attributes':_0x33cd02[_0xf6c1('0xb')]};}):[]};}):[]};}):[]:[]})[_0xf6c1('0x10')](function(_0x586421){logger[_0xf6c1('0x11')](_0xf6c1('0x16'),_0x404c8a);logger[_0xf6c1('0x12')]('ShowCmHopper',_0x404c8a,JSON['stringify'](_0x586421));_0x5612a5(_0x586421);})[_0xf6c1('0x17')](function(_0x45cdaa){logger[_0xf6c1('0x15')](_0xf6c1('0x16'),_0x45cdaa[_0xf6c1('0x14')],_0x404c8a);_0x1057b8(_0x3f6d1e[_0xf6c1('0x15')](0x1f4,_0x45cdaa[_0xf6c1('0x14')]));});});};exports[_0xf6c1('0x18')]=function(_0x59e8cd){var _0x170fd9=this;return new Promise(function(_0x2cb7a6,_0x393814){return db['CmHopper']['create'](_0x59e8cd[_0xf6c1('0x19')],{'raw':_0x59e8cd['options']?_0x59e8cd['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x135014){logger[_0xf6c1('0x11')](_0xf6c1('0x18'),_0x59e8cd);logger['debug'](_0xf6c1('0x18'),_0x59e8cd,JSON['stringify'](_0x135014));_0x2cb7a6(_0x135014);})[_0xf6c1('0x17')](function(_0x1b043f){logger['error']('CreateCmHopper',_0x1b043f[_0xf6c1('0x14')],_0x59e8cd);_0x393814(_0x170fd9[_0xf6c1('0x15')](0x1f4,_0x1b043f['message']));});});};exports[_0xf6c1('0x1a')]=function(_0x238245){var _0x7918ea=this;return new Promise(function(_0x1310ed,_0x169046){return db['CmHopper'][_0xf6c1('0x1b')](_0x238245[_0xf6c1('0x19')],{'raw':_0x238245[_0xf6c1('0x9')]?_0x238245[_0xf6c1('0x9')][_0xf6c1('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x238245['options']?_0x238245[_0xf6c1('0x9')]['where']||null:null,'attributes':_0x238245[_0xf6c1('0x9')]?_0x238245['options'][_0xf6c1('0xb')]||null:null,'limit':_0x238245['options']?_0x238245[_0xf6c1('0x9')]['limit']||null:null})[_0xf6c1('0x10')](function(_0x3f3571){logger['info'](_0xf6c1('0x1a'),_0x238245);logger[_0xf6c1('0x11')](_0xf6c1('0x1c'),JSON[_0xf6c1('0x13')](_0x238245[_0xf6c1('0x9')][_0xf6c1('0xa')]),_0x238245[_0xf6c1('0x19')]['active']);logger[_0xf6c1('0x12')](_0xf6c1('0x1a'),_0x238245,JSON[_0xf6c1('0x13')](_0x3f3571));_0x1310ed(_0x3f3571);})['catch'](function(_0x5270af){logger[_0xf6c1('0x15')]('UpdateCmHopper',_0x5270af[_0xf6c1('0x14')],_0x238245);_0x169046(_0x7918ea['error'](0x1f4,_0x5270af[_0xf6c1('0x14')]));});});};exports[_0xf6c1('0x1d')]=function(_0x20a622){var _0x589a89=this;return new Promise(function(_0x24590a,_0x567839){return db[_0xf6c1('0x7')][_0xf6c1('0x1e')]({'where':_0x20a622[_0xf6c1('0x9')]?_0x20a622[_0xf6c1('0x9')][_0xf6c1('0xa')]||null:null})[_0xf6c1('0x10')](function(_0x50f313){logger['info']('DestroyCmHopper',_0x20a622);logger[_0xf6c1('0x12')](_0xf6c1('0x1d'),_0x20a622,JSON['stringify'](_0x50f313));_0x24590a(_0x50f313);})['catch'](function(_0x2d618d){logger[_0xf6c1('0x15')](_0xf6c1('0x1d'),_0x2d618d[_0xf6c1('0x14')],_0x20a622);_0x567839(_0x589a89['error'](0x1f4,_0x2d618d[_0xf6c1('0x14')]));});});};exports[_0xf6c1('0x1f')]=function(_0x22800a){var _0x1f2f73=this;return new Promise(function(_0x1a1013,_0x45d1f9){return db[_0xf6c1('0x20')][_0xf6c1('0x21')]()[_0xf6c1('0x10')](function(_0x12c6ea){return db[_0xf6c1('0x22')][_0xf6c1('0x23')](function(_0x30c826){return db[_0xf6c1('0x7')][_0xf6c1('0x24')]({'where':_0x22800a[_0xf6c1('0x9')]?_0x22800a[_0xf6c1('0x9')][_0xf6c1('0xa')]||null:null,'attributes':_0x22800a[_0xf6c1('0x9')]?_0x22800a['options'][_0xf6c1('0xb')]||null:null,'limit':_0x22800a['options']?_0x22800a[_0xf6c1('0x9')][_0xf6c1('0xc')]||null:null,'order':_0x22800a['options']?_0x22800a['options'][_0xf6c1('0x25')]||null:null,'transaction':_0x30c826,'lock':_0x30c826['LOCK'][_0xf6c1('0x26')],'include':[{'model':db[_0xf6c1('0x20')],'as':_0xf6c1('0x27'),'attributes':_['keys'](_0x12c6ea)},{'model':db[_0xf6c1('0x28')],'as':_0xf6c1('0x29'),'attributes':['id','name',_0xf6c1('0x2a')]}]})['then'](function(_0x365f70){var _0x441e46=[];var _0x43a1e0=[];for(var _0x36b41f=0x0;_0x36b41f<_0x365f70[_0xf6c1('0x2b')];_0x36b41f+=0x1){var _0x4f73a8=_0x365f70[_0x36b41f][_0xf6c1('0x2c')];if(_0x4f73a8===null){_0x441e46[_0xf6c1('0x2d')](_0x365f70[_0x36b41f][_0xf6c1('0x1b')](_0x22800a[_0xf6c1('0x19')],{'transaction':_0x30c826}));}else if(!_0x43a1e0[_0xf6c1('0x2e')](_0x4f73a8)){_0x43a1e0[_0xf6c1('0x2d')](_0x4f73a8);_0x441e46[_0xf6c1('0x2d')](_0x365f70[_0x36b41f][_0xf6c1('0x1b')](_0x22800a['body'],{'transaction':_0x30c826}));}}return BPromise[_0xf6c1('0x2f')](_0x441e46);});})[_0xf6c1('0x10')](function(_0x2d846c){logger['info'](_0xf6c1('0x1f'),_0x22800a);if(_0x2d846c[_0xf6c1('0x2b')]>0x0){logger[_0xf6c1('0x11')](_0xf6c1('0x30'),_0x2d846c[0x0][_0xf6c1('0x31')]['id'],_0x2d846c[0x0]['dataValues'][_0xf6c1('0x32')],_0x2d846c[0x0]['dataValues'][_0xf6c1('0x33')]);}logger['debug']('GetContactDialer',_0x22800a,JSON['stringify'](_0x2d846c));_0x1a1013(_0x2d846c);})[_0xf6c1('0x17')](function(_0x1a839a){logger[_0xf6c1('0x15')](_0xf6c1('0x1f'),_0x1a839a[_0xf6c1('0x14')],_0x22800a);_0x45d1f9(_0x1f2f73[_0xf6c1('0x15')](0x1f4,_0x1a839a[_0xf6c1('0x14')]));});});});};exports[_0xf6c1('0x34')]=function(_0x268f5f){var _0x4a53a9=this;return new Promise(function(_0x4e36f6,_0x135945){return db[_0xf6c1('0x22')][_0xf6c1('0x23')](function(_0x820184){return db[_0xf6c1('0x35')][_0xf6c1('0x36')](_0x268f5f[_0xf6c1('0x19')],{'raw':_0x268f5f[_0xf6c1('0x9')]?_0x268f5f['options'][_0xf6c1('0x8')]===undefined?!![]:![]:!![],'transaction':_0x820184})['then'](function(){logger[_0xf6c1('0x11')](_0xf6c1('0x37'),JSON[_0xf6c1('0x13')](_0x268f5f['options'][_0xf6c1('0xa')]),_0x268f5f['options'][_0xf6c1('0xa')]['active']);return db[_0xf6c1('0x7')]['destroy']({'where':_0x268f5f[_0xf6c1('0x9')]?_0x268f5f[_0xf6c1('0x9')][_0xf6c1('0xa')]||null:null,'transaction':_0x820184});});})[_0xf6c1('0x10')](function(_0x34ece8){logger[_0xf6c1('0x11')](_0xf6c1('0x34'),_0x268f5f);logger[_0xf6c1('0x12')]('MoveContactManagedDialer',_0x268f5f,JSON['stringify'](_0x34ece8));_0x4e36f6(_0x34ece8);})[_0xf6c1('0x17')](function(_0x432c82){logger[_0xf6c1('0x15')](_0xf6c1('0x34'),_0x432c82[_0xf6c1('0x14')],_0x268f5f);_0x135945(_0x4a53a9['error'](0x1f4,_0x432c82[_0xf6c1('0x14')]));});});};exports[_0xf6c1('0x38')]=function(_0x2291e5){var _0x487ab6=this;return new Promise(function(_0x3bf58a,_0x1f7756){return db[_0xf6c1('0x7')]['findAll']({'raw':_0x2291e5[_0xf6c1('0x9')]?_0x2291e5[_0xf6c1('0x9')][_0xf6c1('0x8')]===undefined?!![]:![]:!![],'where':_0x2291e5['options']?_0x2291e5[_0xf6c1('0x9')]['where']||null:null,'attributes':[[db[_0xf6c1('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf6c1('0x22')][_0xf6c1('0x39')](_0xf6c1('0x3a')+util[_0xf6c1('0x3b')](_0xf6c1('0x3c'),moment()[_0xf6c1('0x3b')](_0xf6c1('0x3d')))+_0xf6c1('0x3e')))),_0xf6c1('0x3f')]]})[_0xf6c1('0x10')](function(_0xbfaeee){logger['info'](_0xf6c1('0x38'),_0x2291e5);logger[_0xf6c1('0x12')](_0xf6c1('0x38'),_0x2291e5,JSON[_0xf6c1('0x13')](_0xbfaeee));_0x3bf58a(_0xbfaeee);})['catch'](function(_0x20284d){logger[_0xf6c1('0x15')](_0xf6c1('0x38'),_0x20284d[_0xf6c1('0x14')],_0x2291e5);_0x1f7756(_0x487ab6[_0xf6c1('0x15')](0x1f4,_0x20284d[_0xf6c1('0x14')]));});});};exports['GetContactRecallMe']=function(_0x313953){var _0xbfdbc1=this;return new Promise(function(_0x460d82,_0x2575b3){return db[_0xf6c1('0x20')][_0xf6c1('0x21')]()[_0xf6c1('0x10')](function(){return db[_0xf6c1('0x22')][_0xf6c1('0x23')](function(_0x4321a9){return db['CmHopper'][_0xf6c1('0x24')]({'where':_0x313953[_0xf6c1('0x9')]?_0x313953[_0xf6c1('0x9')][_0xf6c1('0xa')]||null:null,'attributes':_0x313953[_0xf6c1('0x9')]?_0x313953[_0xf6c1('0x9')][_0xf6c1('0xb')]||null:null,'limit':0x1,'order':_0x313953[_0xf6c1('0x9')]?_0x313953[_0xf6c1('0x9')][_0xf6c1('0x25')]||null:null,'group':db[_0xf6c1('0x7')]['UserId'],'transaction':_0x4321a9,'lock':_0x4321a9[_0xf6c1('0x40')][_0xf6c1('0x26')],'include':_0x313953[_0xf6c1('0x9')]?_0x313953[_0xf6c1('0x9')][_0xf6c1('0xe')]?_[_0xf6c1('0xd')](_0x313953['options'][_0xf6c1('0xe')],function(_0x4d772b){return{'model':db[_0x4d772b['model']],'as':_0x4d772b['as'],'attributes':_0x4d772b[_0xf6c1('0xb')],'include':_0x4d772b[_0xf6c1('0xe')]?_[_0xf6c1('0xd')](_0x4d772b['include'],function(_0x1a691b){return{'model':db[_0x1a691b[_0xf6c1('0xf')]],'as':_0x1a691b['as'],'attributes':_0x1a691b[_0xf6c1('0xb')],'include':_0x1a691b['include']?_[_0xf6c1('0xd')](_0x1a691b[_0xf6c1('0xe')],function(_0x1fcbe){return{'model':db[_0x1fcbe[_0xf6c1('0xf')]],'as':_0x1fcbe['as'],'attributes':_0x1fcbe[_0xf6c1('0xb')]};}):[]};}):[]};}):[]:[]})[_0xf6c1('0x10')](function(_0x26a142){var _0x4f7d87=[];for(var _0x54c132=0x0;_0x54c132<_0x26a142[_0xf6c1('0x2b')];_0x54c132+=0x1){_0x4f7d87[_0xf6c1('0x2d')](_0x26a142[_0x54c132][_0xf6c1('0x1b')](_0x313953[_0xf6c1('0x19')],{'transaction':_0x4321a9}));}return BPromise['all'](_0x4f7d87);});})[_0xf6c1('0x10')](function(_0x26f488){logger[_0xf6c1('0x11')]('GetContactRecallMe',_0x313953);logger[_0xf6c1('0x12')](_0xf6c1('0x41'),_0x313953,JSON[_0xf6c1('0x13')](_0x26f488));_0x460d82(_0x26f488);})[_0xf6c1('0x17')](function(_0x357431){logger[_0xf6c1('0x15')](_0xf6c1('0x41'),_0x357431[_0xf6c1('0x14')],_0x313953);_0x2575b3(_0xbfdbc1[_0xf6c1('0x15')](0x1f4,_0x357431[_0xf6c1('0x14')]));});});});};exports[_0xf6c1('0x42')]=function(_0x27904a){var _0x12b375=this;return new Promise(function(_0xf18a29,_0x14a1b2){db['CmContact'][_0xf6c1('0x21')]()[_0xf6c1('0x10')](function(_0x43a4d1){return db[_0xf6c1('0x7')][_0xf6c1('0x24')]({'raw':_0x27904a[_0xf6c1('0x9')]?_0x27904a[_0xf6c1('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x27904a[_0xf6c1('0x9')]?_0x27904a[_0xf6c1('0x9')][_0xf6c1('0xa')]||null:null,'attributes':_0x27904a['options']?_0x27904a[_0xf6c1('0x9')][_0xf6c1('0xb')]||null:null,'limit':_0x27904a[_0xf6c1('0x9')]?_0x27904a[_0xf6c1('0x9')][_0xf6c1('0xc')]||null:null,'include':_0x27904a[_0xf6c1('0x9')]?_0x27904a['options'][_0xf6c1('0xe')]?_[_0xf6c1('0xd')](_0x27904a[_0xf6c1('0x9')][_0xf6c1('0xe')],function(_0x4dc70f){return{'model':db[_0x4dc70f[_0xf6c1('0xf')]],'as':_0x4dc70f['as'],'attributes':_0x4dc70f['as']==='Contact'?_[_0xf6c1('0x43')](_0x43a4d1):_0x4dc70f['attributes'],'include':_0x4dc70f[_0xf6c1('0xe')]?_[_0xf6c1('0xd')](_0x4dc70f[_0xf6c1('0xe')],function(_0x3444d9){return{'model':db[_0x3444d9[_0xf6c1('0xf')]],'as':_0x3444d9['as'],'attributes':_0x3444d9['attributes'],'include':_0x3444d9[_0xf6c1('0xe')]?_[_0xf6c1('0xd')](_0x3444d9[_0xf6c1('0xe')],function(_0x1831c6){return{'model':db[_0x1831c6[_0xf6c1('0xf')]],'as':_0x1831c6['as'],'attributes':_0x1831c6['attributes']};}):[]};}):[]};}):[]:[]})[_0xf6c1('0x10')](function(_0xde082b){logger['info'](_0xf6c1('0x6'),_0x27904a);logger[_0xf6c1('0x12')]('GetCmHopper',_0x27904a,JSON[_0xf6c1('0x13')](_0xde082b));_0xf18a29(_0xde082b);})['catch'](function(_0x4cea6d){logger['error'](_0xf6c1('0x6'),_0x4cea6d[_0xf6c1('0x14')],_0x27904a);_0x14a1b2(_0x12b375[_0xf6c1('0x15')](0x1f4,_0x4cea6d['message']));});});});};exports[_0xf6c1('0x44')]=function(_0x533893){var _0x39f251=this;return new Promise(function(_0xf65273,_0x254d76){return db[_0xf6c1('0x20')][_0xf6c1('0x45')]({'raw':!![],'where':{'phone':_0x533893[_0xf6c1('0x9')][_0xf6c1('0xa')][_0xf6c1('0x46')]},'attributes':['id',_0xf6c1('0x47')],'order':[['id',_0xf6c1('0x48')]]})[_0xf6c1('0x10')](function(_0x23f28e){logger[_0xf6c1('0x11')](_0xf6c1('0x49'),_0x533893);logger[_0xf6c1('0x12')](_0xf6c1('0x49'),_0x533893,JSON[_0xf6c1('0x13')](_0x23f28e));_0xf65273(_0x23f28e);})[_0xf6c1('0x17')](function(_0x216a16){logger[_0xf6c1('0x15')](_0xf6c1('0x49'),_0x216a16[_0xf6c1('0x14')],_0x533893);_0x254d76(_0x39f251[_0xf6c1('0x15')](0x1f4,_0x216a16['message']));});});};exports[_0xf6c1('0x4a')]=function(_0x5df877){var _0x5d3f70=this;return new Promise(function(_0x16ae46,_0x1f919f){return db[_0xf6c1('0x22')][_0xf6c1('0x23')](function(_0x4e2928){var _0x432a0d=_0x5df877[_0xf6c1('0x9')]&&_0x5df877['options'][_0xf6c1('0xa')]?_0x5df877[_0xf6c1('0x9')]['where']:{};return db[_0xf6c1('0x7')][_0xf6c1('0x1b')](_0x5df877[_0xf6c1('0x19')],{'where':_0x432a0d,'transaction':_0x4e2928})[_0xf6c1('0x10')](function(_0x8c0dfc){logger['info']('ResetActiveCalls',_0x5df877);logger[_0xf6c1('0x12')](_0xf6c1('0x4a'),_0x5df877,JSON[_0xf6c1('0x13')](_0x8c0dfc));_0x16ae46(_0x8c0dfc);})[_0xf6c1('0x17')](function(_0xa92aed){logger['error'](_0xf6c1('0x4a'),_0xa92aed[_0xf6c1('0x14')],_0x5df877);_0x1f919f(_0x5d3f70[_0xf6c1('0x15')](0x1f4,_0xa92aed['message']));});});});};exports[_0xf6c1('0x4b')]=function(_0x2d4c6a){var _0x312659=this;var _0x68006f=_0x2d4c6a[_0xf6c1('0x19')][_0xf6c1('0xa')][_0xf6c1('0x4c')];var _0x50a87a=_0x2d4c6a[_0xf6c1('0x19')][_0xf6c1('0xa')][_0xf6c1('0x4d')];var _0x501587=_0x2d4c6a[_0xf6c1('0x19')][_0xf6c1('0xa')][_0xf6c1('0x4e')];return new Promise(function(_0x3ab311,_0x44e578){return db[_0xf6c1('0x7')][_0xf6c1('0x24')]({'where':{'voiceQueueId':{'$in':_0x68006f},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0xf6c1('0x4f')+_0x50a87a+_0xf6c1('0x50')),'$gt':db['sequelize'][_0xf6c1('0x39')](_0xf6c1('0x51'))}},'UserId':{'$in':_0x501587}},'include':[{'model':db[_0xf6c1('0x20')],'as':'Contact'},{'model':db[_0xf6c1('0x28')],'as':_0xf6c1('0x29'),'attributes':['id','name','voicePause']},{'model':db[_0xf6c1('0x52')],'as':_0xf6c1('0x53')}]})[_0xf6c1('0x10')](function(_0x3de65e){if(_0x3de65e[_0xf6c1('0x2b')]>0x0){return db[_0xf6c1('0x22')][_0xf6c1('0x23')](function(_0x7f0b65){return db[_0xf6c1('0x7')]['update']({'recallmeNotifiedDate':db[_0xf6c1('0x22')][_0xf6c1('0x39')](_0xf6c1('0x51'))},{'where':{'id':{'$in':_[_0xf6c1('0xd')](_0x3de65e,'id')}},'transaction':_0x7f0b65})['then'](function(){_0x3ab311(_0x3de65e);})[_0xf6c1('0x17')](function(_0xd31633){logger[_0xf6c1('0x15')](_0xf6c1('0x4b'),_0xd31633['message'],_0x2d4c6a);_0x44e578(_0x312659[_0xf6c1('0x15')](0x1f4,_0xd31633[_0xf6c1('0x14')]));});})[_0xf6c1('0x17')](function(_0x1cddf5){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x1cddf5[_0xf6c1('0x14')],_0x2d4c6a);_0x44e578(_0x312659['error'](0x1f4,_0x1cddf5[_0xf6c1('0x14')]));});}else{_0x3ab311(_0x3de65e);}});});}; \ No newline at end of file +var _0x7451=['destroy','sequelize','COUNT','`scheduledat`\x20>=\x20','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','NOW()','name','CmList','List','lodash','moment','bluebird','../../mysqldb','../../config/logger','CmHopper','findAll','raw','options','where','attributes','limit','include','model','map','then','info','GetCmHopper','stringify','catch','error','message','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','debug','DestroyCmHopper','CmContact','describe','order','UPDATE','Contact','keys','User','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]'];(function(_0xb21360,_0x35f6c2){var _0x5df799=function(_0x26f8ed){while(--_0x26f8ed){_0xb21360['push'](_0xb21360['shift']());}};_0x5df799(++_0x35f6c2);}(_0x7451,0x1ec));var _0x1745=function(_0x13e403,_0xf45b57){_0x13e403=_0x13e403-0x0;var _0x298a17=_0x7451[_0x13e403];return _0x298a17;};'use strict';var _=require(_0x1745('0x0'));var util=require('util');var moment=require(_0x1745('0x1'));var BPromise=require(_0x1745('0x2'));var db=require(_0x1745('0x3'))['db'];var logger=require(_0x1745('0x4'))('rpc');exports['GetCmHopper']=function(_0x4fa875){var _0x56f9d0=this;return new Promise(function(_0x4b1cf2,_0x90e4f5){return db[_0x1745('0x5')][_0x1745('0x6')]({'raw':_0x4fa875['options']?_0x4fa875['options'][_0x1745('0x7')]===undefined?!![]:![]:!![],'where':_0x4fa875['options']?_0x4fa875[_0x1745('0x8')][_0x1745('0x9')]||null:null,'attributes':_0x4fa875['options']?_0x4fa875[_0x1745('0x8')][_0x1745('0xa')]||null:null,'limit':_0x4fa875[_0x1745('0x8')]?_0x4fa875['options'][_0x1745('0xb')]||null:null,'include':_0x4fa875[_0x1745('0x8')]?_0x4fa875[_0x1745('0x8')][_0x1745('0xc')]?_['map'](_0x4fa875[_0x1745('0x8')]['include'],function(_0x16add9){return{'model':db[_0x16add9[_0x1745('0xd')]],'as':_0x16add9['as'],'attributes':_0x16add9['attributes'],'include':_0x16add9[_0x1745('0xc')]?_[_0x1745('0xe')](_0x16add9[_0x1745('0xc')],function(_0x1f2309){return{'model':db[_0x1f2309[_0x1745('0xd')]],'as':_0x1f2309['as'],'attributes':_0x1f2309['attributes'],'include':_0x1f2309[_0x1745('0xc')]?_[_0x1745('0xe')](_0x1f2309[_0x1745('0xc')],function(_0xd20778){return{'model':db[_0xd20778[_0x1745('0xd')]],'as':_0xd20778['as'],'attributes':_0xd20778[_0x1745('0xa')]};}):[]};}):[]};}):[]:[]})[_0x1745('0xf')](function(_0x31510a){logger[_0x1745('0x10')](_0x1745('0x11'),_0x4fa875);logger['debug'](_0x1745('0x11'),_0x4fa875,JSON[_0x1745('0x12')](_0x31510a));_0x4b1cf2(_0x31510a);})[_0x1745('0x13')](function(_0x1b5c1e){logger[_0x1745('0x14')](_0x1745('0x11'),_0x1b5c1e[_0x1745('0x15')],_0x4fa875);_0x90e4f5(_0x56f9d0[_0x1745('0x14')](0x1f4,_0x1b5c1e[_0x1745('0x15')]));});});};exports[_0x1745('0x16')]=function(_0x28555e){var _0x4e4638=this;return new Promise(function(_0xc7ce26,_0x3f93a8){return db['CmHopper'][_0x1745('0x17')]({'raw':_0x28555e[_0x1745('0x8')]?_0x28555e[_0x1745('0x8')][_0x1745('0x7')]===undefined?!![]:![]:!![],'where':_0x28555e[_0x1745('0x8')]?_0x28555e[_0x1745('0x8')][_0x1745('0x9')]||null:null,'attributes':_0x28555e[_0x1745('0x8')]?_0x28555e['options'][_0x1745('0xa')]||null:null,'include':_0x28555e[_0x1745('0x8')]?_0x28555e[_0x1745('0x8')][_0x1745('0xc')]?_['map'](_0x28555e[_0x1745('0x8')]['include'],function(_0x2fcfd0){return{'model':db[_0x2fcfd0[_0x1745('0xd')]],'as':_0x2fcfd0['as'],'attributes':_0x2fcfd0['attributes'],'include':_0x2fcfd0['include']?_['map'](_0x2fcfd0['include'],function(_0x43e18b){return{'model':db[_0x43e18b['model']],'as':_0x43e18b['as'],'attributes':_0x43e18b[_0x1745('0xa')],'include':_0x43e18b[_0x1745('0xc')]?_[_0x1745('0xe')](_0x43e18b[_0x1745('0xc')],function(_0x2e1757){return{'model':db[_0x2e1757['model']],'as':_0x2e1757['as'],'attributes':_0x2e1757[_0x1745('0xa')]};}):[]};}):[]};}):[]:[]})[_0x1745('0xf')](function(_0x5093d3){logger[_0x1745('0x10')](_0x1745('0x16'),_0x28555e);logger['debug'](_0x1745('0x16'),_0x28555e,JSON[_0x1745('0x12')](_0x5093d3));_0xc7ce26(_0x5093d3);})[_0x1745('0x13')](function(_0xa58284){logger[_0x1745('0x14')](_0x1745('0x16'),_0xa58284[_0x1745('0x15')],_0x28555e);_0x3f93a8(_0x4e4638['error'](0x1f4,_0xa58284[_0x1745('0x15')]));});});};exports[_0x1745('0x18')]=function(_0x1d7b2f){var _0x635662=this;return new Promise(function(_0x2ec072,_0x4a60cf){return db[_0x1745('0x5')][_0x1745('0x19')](_0x1d7b2f[_0x1745('0x1a')],{'raw':_0x1d7b2f['options']?_0x1d7b2f[_0x1745('0x8')][_0x1745('0x7')]===undefined?!![]:![]:!![]})[_0x1745('0xf')](function(_0x40383a){logger[_0x1745('0x10')]('CreateCmHopper',_0x1d7b2f);logger['debug'](_0x1745('0x18'),_0x1d7b2f,JSON['stringify'](_0x40383a));_0x2ec072(_0x40383a);})[_0x1745('0x13')](function(_0x2f47f8){logger[_0x1745('0x14')](_0x1745('0x18'),_0x2f47f8['message'],_0x1d7b2f);_0x4a60cf(_0x635662['error'](0x1f4,_0x2f47f8['message']));});});};exports[_0x1745('0x1b')]=function(_0x7b96bd){var _0x4541c1=this;return new Promise(function(_0x4e20e3,_0x138fe2){return db['CmHopper'][_0x1745('0x1c')](_0x7b96bd['body'],{'raw':_0x7b96bd[_0x1745('0x8')]?_0x7b96bd['options'][_0x1745('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7b96bd[_0x1745('0x8')]?_0x7b96bd['options'][_0x1745('0x9')]||null:null,'attributes':_0x7b96bd[_0x1745('0x8')]?_0x7b96bd[_0x1745('0x8')][_0x1745('0xa')]||null:null,'limit':_0x7b96bd[_0x1745('0x8')]?_0x7b96bd[_0x1745('0x8')][_0x1745('0xb')]||null:null})[_0x1745('0xf')](function(_0x19dc01){logger['info'](_0x1745('0x1b'),_0x7b96bd);logger[_0x1745('0x10')](_0x1745('0x1d'),JSON[_0x1745('0x12')](_0x7b96bd['options']['where']),_0x7b96bd[_0x1745('0x1a')][_0x1745('0x1e')]);logger[_0x1745('0x1f')](_0x1745('0x1b'),_0x7b96bd,JSON[_0x1745('0x12')](_0x19dc01));_0x4e20e3(_0x19dc01);})['catch'](function(_0xdc1cf3){logger[_0x1745('0x14')]('UpdateCmHopper',_0xdc1cf3[_0x1745('0x15')],_0x7b96bd);_0x138fe2(_0x4541c1[_0x1745('0x14')](0x1f4,_0xdc1cf3['message']));});});};exports[_0x1745('0x20')]=function(_0x3f82bc){var _0x227643=this;return new Promise(function(_0x11e435,_0x5b0e5e){return db['CmHopper']['destroy']({'where':_0x3f82bc['options']?_0x3f82bc[_0x1745('0x8')][_0x1745('0x9')]||null:null})['then'](function(_0x480327){logger['info'](_0x1745('0x20'),_0x3f82bc);logger[_0x1745('0x1f')](_0x1745('0x20'),_0x3f82bc,JSON[_0x1745('0x12')](_0x480327));_0x11e435(_0x480327);})[_0x1745('0x13')](function(_0x56b1ab){logger[_0x1745('0x14')](_0x1745('0x20'),_0x56b1ab[_0x1745('0x15')],_0x3f82bc);_0x5b0e5e(_0x227643['error'](0x1f4,_0x56b1ab[_0x1745('0x15')]));});});};exports['GetContactDialer']=function(_0x2ce503){var _0x54f6fb=this;return new Promise(function(_0x188aab,_0x3a0b2d){return db[_0x1745('0x21')][_0x1745('0x22')]()[_0x1745('0xf')](function(_0x5b4fb3){return db['sequelize']['transaction'](function(_0x443dae){return db[_0x1745('0x5')][_0x1745('0x6')]({'where':_0x2ce503['options']?_0x2ce503[_0x1745('0x8')][_0x1745('0x9')]||null:null,'attributes':_0x2ce503[_0x1745('0x8')]?_0x2ce503[_0x1745('0x8')][_0x1745('0xa')]||null:null,'limit':_0x2ce503[_0x1745('0x8')]?_0x2ce503[_0x1745('0x8')][_0x1745('0xb')]||null:null,'order':_0x2ce503[_0x1745('0x8')]?_0x2ce503['options'][_0x1745('0x23')]||null:null,'transaction':_0x443dae,'lock':_0x443dae['LOCK'][_0x1745('0x24')],'include':[{'model':db['CmContact'],'as':_0x1745('0x25'),'attributes':_[_0x1745('0x26')](_0x5b4fb3)},{'model':db[_0x1745('0x27')],'as':_0x1745('0x28'),'attributes':['id','name',_0x1745('0x29')]}]})[_0x1745('0xf')](function(_0x21ab98){var _0x1603e2=[];var _0x3d3182=[];for(var _0x20e4ef=0x0;_0x20e4ef<_0x21ab98[_0x1745('0x2a')];_0x20e4ef+=0x1){var _0x5d84c3=_0x21ab98[_0x20e4ef][_0x1745('0x2b')];if(_0x5d84c3===null){_0x1603e2[_0x1745('0x2c')](_0x21ab98[_0x20e4ef]['update'](_0x2ce503['body'],{'transaction':_0x443dae}));}else if(!_0x3d3182[_0x1745('0x2d')](_0x5d84c3)){_0x3d3182[_0x1745('0x2c')](_0x5d84c3);_0x1603e2[_0x1745('0x2c')](_0x21ab98[_0x20e4ef][_0x1745('0x1c')](_0x2ce503[_0x1745('0x1a')],{'transaction':_0x443dae}));}}return BPromise[_0x1745('0x2e')](_0x1603e2);});})[_0x1745('0xf')](function(_0x10d6ae){logger[_0x1745('0x10')](_0x1745('0x2f'),_0x2ce503);if(_0x10d6ae[_0x1745('0x2a')]>0x0){logger['info'](_0x1745('0x30'),_0x10d6ae[0x0][_0x1745('0x31')]['id'],_0x10d6ae[0x0][_0x1745('0x31')]['ContactId'],_0x10d6ae[0x0][_0x1745('0x31')][_0x1745('0x1e')]);}logger[_0x1745('0x1f')](_0x1745('0x2f'),_0x2ce503,JSON[_0x1745('0x12')](_0x10d6ae));_0x188aab(_0x10d6ae);})[_0x1745('0x13')](function(_0x3906b3){logger['error'](_0x1745('0x2f'),_0x3906b3[_0x1745('0x15')],_0x2ce503);_0x3a0b2d(_0x54f6fb[_0x1745('0x14')](0x1f4,_0x3906b3[_0x1745('0x15')]));});});});};exports[_0x1745('0x32')]=function(_0x4e49a3){var _0x4c15b0=this;return new Promise(function(_0x270744,_0x24f364){return db['sequelize'][_0x1745('0x33')](function(_0x843374){return db[_0x1745('0x34')]['create'](_0x4e49a3[_0x1745('0x1a')],{'raw':_0x4e49a3['options']?_0x4e49a3[_0x1745('0x8')][_0x1745('0x7')]===undefined?!![]:![]:!![],'transaction':_0x843374})[_0x1745('0xf')](function(){logger[_0x1745('0x10')](_0x1745('0x35'),JSON[_0x1745('0x12')](_0x4e49a3[_0x1745('0x8')][_0x1745('0x9')]),_0x4e49a3[_0x1745('0x8')]['where'][_0x1745('0x1e')]);return db[_0x1745('0x5')][_0x1745('0x36')]({'where':_0x4e49a3[_0x1745('0x8')]?_0x4e49a3[_0x1745('0x8')][_0x1745('0x9')]||null:null,'transaction':_0x843374});});})[_0x1745('0xf')](function(_0x38d70d){logger['info'](_0x1745('0x32'),_0x4e49a3);logger[_0x1745('0x1f')]('MoveContactManagedDialer',_0x4e49a3,JSON['stringify'](_0x38d70d));_0x270744(_0x38d70d);})[_0x1745('0x13')](function(_0x59d58a){logger['error'](_0x1745('0x32'),_0x59d58a[_0x1745('0x15')],_0x4e49a3);_0x24f364(_0x4c15b0['error'](0x1f4,_0x59d58a['message']));});});};exports['CountReScheduled']=function(_0x4f085){var _0x36386f=this;return new Promise(function(_0x128c31,_0x5e3ac6){return db[_0x1745('0x5')][_0x1745('0x6')]({'raw':_0x4f085['options']?_0x4f085[_0x1745('0x8')][_0x1745('0x7')]===undefined?!![]:![]:!![],'where':_0x4f085[_0x1745('0x8')]?_0x4f085[_0x1745('0x8')][_0x1745('0x9')]||null:null,'attributes':[[db[_0x1745('0x37')]['fn'](_0x1745('0x38'),db[_0x1745('0x37')]['fn']('IF',db[_0x1745('0x37')]['literal'](_0x1745('0x39')+util['format']('\x22%s\x22',moment()['format'](_0x1745('0x3a')))+'\x20,\x201,\x20null'))),_0x1745('0x3b')]]})[_0x1745('0xf')](function(_0x357ead){logger[_0x1745('0x10')](_0x1745('0x3c'),_0x4f085);logger['debug']('CountReScheduled',_0x4f085,JSON[_0x1745('0x12')](_0x357ead));_0x128c31(_0x357ead);})[_0x1745('0x13')](function(_0x4638e7){logger[_0x1745('0x14')](_0x1745('0x3c'),_0x4638e7[_0x1745('0x15')],_0x4f085);_0x5e3ac6(_0x36386f[_0x1745('0x14')](0x1f4,_0x4638e7[_0x1745('0x15')]));});});};exports[_0x1745('0x3d')]=function(_0x1e2202){var _0x3167fd=this;return new Promise(function(_0x2eca6f,_0x4ac360){return db[_0x1745('0x21')]['describe']()['then'](function(){return db['sequelize'][_0x1745('0x33')](function(_0x2ad18d){return db[_0x1745('0x5')]['findAll']({'where':_0x1e2202[_0x1745('0x8')]?_0x1e2202[_0x1745('0x8')][_0x1745('0x9')]||null:null,'attributes':_0x1e2202[_0x1745('0x8')]?_0x1e2202[_0x1745('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x1e2202['options']?_0x1e2202[_0x1745('0x8')][_0x1745('0x23')]||null:null,'group':db['CmHopper'][_0x1745('0x2b')],'transaction':_0x2ad18d,'lock':_0x2ad18d['LOCK'][_0x1745('0x24')],'include':_0x1e2202['options']?_0x1e2202[_0x1745('0x8')][_0x1745('0xc')]?_[_0x1745('0xe')](_0x1e2202[_0x1745('0x8')][_0x1745('0xc')],function(_0x38e0ba){return{'model':db[_0x38e0ba[_0x1745('0xd')]],'as':_0x38e0ba['as'],'attributes':_0x38e0ba[_0x1745('0xa')],'include':_0x38e0ba['include']?_['map'](_0x38e0ba[_0x1745('0xc')],function(_0x3488ac){return{'model':db[_0x3488ac[_0x1745('0xd')]],'as':_0x3488ac['as'],'attributes':_0x3488ac[_0x1745('0xa')],'include':_0x3488ac[_0x1745('0xc')]?_[_0x1745('0xe')](_0x3488ac[_0x1745('0xc')],function(_0x29dc2b){return{'model':db[_0x29dc2b[_0x1745('0xd')]],'as':_0x29dc2b['as'],'attributes':_0x29dc2b[_0x1745('0xa')]};}):[]};}):[]};}):[]:[]})[_0x1745('0xf')](function(_0x900063){var _0x455511=[];for(var _0x571ead=0x0;_0x571ead<_0x900063[_0x1745('0x2a')];_0x571ead+=0x1){_0x455511[_0x1745('0x2c')](_0x900063[_0x571ead][_0x1745('0x1c')](_0x1e2202[_0x1745('0x1a')],{'transaction':_0x2ad18d}));}return BPromise[_0x1745('0x2e')](_0x455511);});})['then'](function(_0x54c98a){logger['info'](_0x1745('0x3d'),_0x1e2202);logger[_0x1745('0x1f')](_0x1745('0x3d'),_0x1e2202,JSON[_0x1745('0x12')](_0x54c98a));_0x2eca6f(_0x54c98a);})[_0x1745('0x13')](function(_0x4bbcab){logger[_0x1745('0x14')](_0x1745('0x3d'),_0x4bbcab[_0x1745('0x15')],_0x1e2202);_0x4ac360(_0x3167fd[_0x1745('0x14')](0x1f4,_0x4bbcab[_0x1745('0x15')]));});});});};exports[_0x1745('0x3e')]=function(_0x11fc0d){var _0x188fa8=this;return new Promise(function(_0x1fd1dc,_0x1cbd1d){db['CmContact']['describe']()[_0x1745('0xf')](function(_0xd93235){return db[_0x1745('0x5')]['findAll']({'raw':_0x11fc0d[_0x1745('0x8')]?_0x11fc0d[_0x1745('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x11fc0d[_0x1745('0x8')]?_0x11fc0d[_0x1745('0x8')][_0x1745('0x9')]||null:null,'attributes':_0x11fc0d['options']?_0x11fc0d[_0x1745('0x8')][_0x1745('0xa')]||null:null,'limit':_0x11fc0d[_0x1745('0x8')]?_0x11fc0d[_0x1745('0x8')][_0x1745('0xb')]||null:null,'include':_0x11fc0d[_0x1745('0x8')]?_0x11fc0d[_0x1745('0x8')][_0x1745('0xc')]?_[_0x1745('0xe')](_0x11fc0d['options'][_0x1745('0xc')],function(_0x3db94a){return{'model':db[_0x3db94a[_0x1745('0xd')]],'as':_0x3db94a['as'],'attributes':_0x3db94a['as']===_0x1745('0x25')?_[_0x1745('0x26')](_0xd93235):_0x3db94a[_0x1745('0xa')],'include':_0x3db94a[_0x1745('0xc')]?_[_0x1745('0xe')](_0x3db94a['include'],function(_0x24db59){return{'model':db[_0x24db59[_0x1745('0xd')]],'as':_0x24db59['as'],'attributes':_0x24db59[_0x1745('0xa')],'include':_0x24db59[_0x1745('0xc')]?_[_0x1745('0xe')](_0x24db59['include'],function(_0x199354){return{'model':db[_0x199354[_0x1745('0xd')]],'as':_0x199354['as'],'attributes':_0x199354[_0x1745('0xa')]};}):[]};}):[]};}):[]:[]})[_0x1745('0xf')](function(_0x4ebfc2){logger[_0x1745('0x10')](_0x1745('0x11'),_0x11fc0d);logger['debug'](_0x1745('0x11'),_0x11fc0d,JSON[_0x1745('0x12')](_0x4ebfc2));_0x1fd1dc(_0x4ebfc2);})[_0x1745('0x13')](function(_0x309e66){logger['error'](_0x1745('0x11'),_0x309e66['message'],_0x11fc0d);_0x1cbd1d(_0x188fa8[_0x1745('0x14')](0x1f4,_0x309e66[_0x1745('0x15')]));});});});};exports[_0x1745('0x3f')]=function(_0x453a03){var _0x48c24b=this;return new Promise(function(_0x549256,_0x167ea1){return db['CmContact'][_0x1745('0x40')]({'raw':!![],'where':{'phone':_0x453a03['options'][_0x1745('0x9')][_0x1745('0x41')]},'attributes':['id',_0x1745('0x42')],'order':[['id',_0x1745('0x43')]]})['then'](function(_0x16d2e6){logger[_0x1745('0x10')](_0x1745('0x44'),_0x453a03);logger[_0x1745('0x1f')]('getContactByPhone',_0x453a03,JSON[_0x1745('0x12')](_0x16d2e6));_0x549256(_0x16d2e6);})[_0x1745('0x13')](function(_0xd6d345){logger[_0x1745('0x14')](_0x1745('0x44'),_0xd6d345[_0x1745('0x15')],_0x453a03);_0x167ea1(_0x48c24b[_0x1745('0x14')](0x1f4,_0xd6d345[_0x1745('0x15')]));});});};exports[_0x1745('0x45')]=function(_0x324e79){var _0x377172=this;return new Promise(function(_0x1cb09c,_0x27a596){return db['sequelize']['transaction'](function(_0x48c5d8){var _0x34d2bf=_0x324e79['options']&&_0x324e79[_0x1745('0x8')][_0x1745('0x9')]?_0x324e79[_0x1745('0x8')][_0x1745('0x9')]:{};return db[_0x1745('0x5')][_0x1745('0x1c')](_0x324e79[_0x1745('0x1a')],{'where':_0x34d2bf,'transaction':_0x48c5d8})[_0x1745('0xf')](function(_0x1a2ce7){logger['info'](_0x1745('0x45'),_0x324e79);logger['debug'](_0x1745('0x45'),_0x324e79,JSON[_0x1745('0x12')](_0x1a2ce7));_0x1cb09c(_0x1a2ce7);})['catch'](function(_0x10c585){logger[_0x1745('0x14')](_0x1745('0x45'),_0x10c585[_0x1745('0x15')],_0x324e79);_0x27a596(_0x377172[_0x1745('0x14')](0x1f4,_0x10c585[_0x1745('0x15')]));});});});};exports[_0x1745('0x46')]=function(_0x4d77f6){var _0xbea09f=this;var _0x143a0b=_0x4d77f6['body'][_0x1745('0x9')]['voiceQueueIds'];var _0x538af5=_0x4d77f6[_0x1745('0x1a')][_0x1745('0x9')]['interval'];var _0x894869=_0x4d77f6[_0x1745('0x1a')][_0x1745('0x9')][_0x1745('0x47')];return new Promise(function(_0x3f7484,_0x5256a5){return db['CmHopper'][_0x1745('0x6')]({'where':{'voiceQueueId':{'$in':_0x143a0b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x1745('0x37')][_0x1745('0x48')](_0x1745('0x49')+_0x538af5+'\x20MINUTE'),'$gt':db[_0x1745('0x37')]['literal'](_0x1745('0x4a'))}},'UserId':{'$in':_0x894869}},'include':[{'model':db['CmContact'],'as':_0x1745('0x25')},{'model':db[_0x1745('0x27')],'as':_0x1745('0x28'),'attributes':['id',_0x1745('0x4b'),_0x1745('0x29')]},{'model':db[_0x1745('0x4c')],'as':_0x1745('0x4d')}]})[_0x1745('0xf')](function(_0x5f39ef){if(_0x5f39ef[_0x1745('0x2a')]>0x0){return db[_0x1745('0x37')][_0x1745('0x33')](function(_0x364321){return db[_0x1745('0x5')][_0x1745('0x1c')]({'recallmeNotifiedDate':db[_0x1745('0x37')][_0x1745('0x48')](_0x1745('0x4a'))},{'where':{'id':{'$in':_['map'](_0x5f39ef,'id')}},'transaction':_0x364321})[_0x1745('0xf')](function(){_0x3f7484(_0x5f39ef);})[_0x1745('0x13')](function(_0x9becfb){logger['error'](_0x1745('0x46'),_0x9becfb[_0x1745('0x15')],_0x4d77f6);_0x5256a5(_0xbea09f[_0x1745('0x14')](0x1f4,_0x9becfb[_0x1745('0x15')]));});})[_0x1745('0x13')](function(_0x11d33e){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x11d33e[_0x1745('0x15')],_0x4d77f6);_0x5256a5(_0xbea09f[_0x1745('0x14')](0x1f4,_0x11d33e[_0x1745('0x15')]));});}else{_0x3f7484(_0x5f39ef);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 64c4e08..f014027 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 _0xd6dc=['/opencontacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','getPreview','/timezone','getTimezone','put','update','destroy','exports','Router','./cmHopper.controller','get','/describe','isAuthenticated'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xd6dc,0x163));var _0xcd6d=function(_0x3c4955,_0x40c473){_0x3c4955=_0x3c4955-0x0;var _0x402bd9=_0xd6dc[_0x3c4955];return _0x402bd9;};'use strict';var express=require('express');var router=express[_0xcd6d('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xcd6d('0x1'));router[_0xcd6d('0x2')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcd6d('0x2')](_0xcd6d('0x3'),auth[_0xcd6d('0x4')](),controller['describe']);router[_0xcd6d('0x2')](_0xcd6d('0x5'),auth[_0xcd6d('0x4')](),controller['getOpenContacts']);router[_0xcd6d('0x2')]('/timezones',auth[_0xcd6d('0x4')](),controller[_0xcd6d('0x6')]);router[_0xcd6d('0x2')](_0xcd6d('0x7'),auth[_0xcd6d('0x4')](),controller[_0xcd6d('0x8')]);router[_0xcd6d('0x2')](_0xcd6d('0x9'),auth['isAuthenticated'](),controller[_0xcd6d('0xa')]);router[_0xcd6d('0xb')]('/',auth[_0xcd6d('0x4')](),controller[_0xcd6d('0xc')]);router[_0xcd6d('0xb')]('/preview',auth[_0xcd6d('0x4')](),controller[_0xcd6d('0xd')]);router[_0xcd6d('0xb')](_0xcd6d('0xe'),auth[_0xcd6d('0x4')](),controller[_0xcd6d('0xf')]);router[_0xcd6d('0x10')](_0xcd6d('0x7'),auth[_0xcd6d('0x4')](),controller[_0xcd6d('0x11')]);router['delete'](_0xcd6d('0x7'),auth[_0xcd6d('0x4')](),controller[_0xcd6d('0x12')]);module[_0xcd6d('0x13')]=router; \ No newline at end of file +var _0x2e64=['/timezone','getTimezone','put','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','create','post','getPreview'];(function(_0x1f3b30,_0x2a5338){var _0x3bd163=function(_0x282224){while(--_0x282224){_0x1f3b30['push'](_0x1f3b30['shift']());}};_0x3bd163(++_0x2a5338);}(_0x2e64,0x125));var _0x42e6=function(_0x24d6fd,_0x5d6c97){_0x24d6fd=_0x24d6fd-0x0;var _0x33dc15=_0x2e64[_0x24d6fd];return _0x33dc15;};'use strict';var express=require(_0x42e6('0x0'));var router=express[_0x42e6('0x1')]();var auth=require(_0x42e6('0x2'));var controller=require(_0x42e6('0x3'));router[_0x42e6('0x4')]('/',auth['isAuthenticated'](),controller[_0x42e6('0x5')]);router['get']('/describe',auth[_0x42e6('0x6')](),controller[_0x42e6('0x7')]);router[_0x42e6('0x4')](_0x42e6('0x8'),auth[_0x42e6('0x6')](),controller[_0x42e6('0x9')]);router[_0x42e6('0x4')](_0x42e6('0xa'),auth[_0x42e6('0x6')](),controller[_0x42e6('0xb')]);router['get'](_0x42e6('0xc'),auth['isAuthenticated'](),controller[_0x42e6('0xd')]);router['get'](_0x42e6('0xe'),auth[_0x42e6('0x6')](),controller[_0x42e6('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x42e6('0x10')]);router[_0x42e6('0x11')]('/preview',auth[_0x42e6('0x6')](),controller[_0x42e6('0x12')]);router['post'](_0x42e6('0x13'),auth['isAuthenticated'](),controller[_0x42e6('0x14')]);router[_0x42e6('0x15')](_0x42e6('0xc'),auth[_0x42e6('0x6')](),controller['update']);router['delete'](_0x42e6('0xc'),auth[_0x42e6('0x6')](),controller[_0x42e6('0x16')]);module[_0x42e6('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 4a6cf9a..eb1c95e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a49=['sequelize','exports','INTEGER','STRING','DATE','moment'];(function(_0x351540,_0x2982c9){var _0x342221=function(_0x33cff9){while(--_0x33cff9){_0x351540['push'](_0x351540['shift']());}};_0x342221(++_0x2982c9);}(_0x2a49,0x6b));var _0x92a4=function(_0x4f2e00,_0x2af548){_0x4f2e00=_0x4f2e00-0x0;var _0x5ae463=_0x2a49[_0x4f2e00];return _0x5ae463;};'use strict';var moment=require(_0x92a4('0x0'));var Sequelize=require(_0x92a4('0x1'));module[_0x92a4('0x2')]={'CmHopperId':{'type':Sequelize[_0x92a4('0x3')]},'phone':{'type':Sequelize[_0x92a4('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x92a4('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x92a4('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x92a4('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x92a4('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x92a4('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x92a4('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x92a4('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x92a4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1b53=['moment','sequelize','exports','STRING','INTEGER','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x570496,_0x26a150){var _0x1d4204=function(_0x4176cd){while(--_0x4176cd){_0x570496['push'](_0x570496['shift']());}};_0x1d4204(++_0x26a150);}(_0x1b53,0x165));var _0x31b5=function(_0x264075,_0x43328e){_0x264075=_0x264075-0x0;var _0x4bcc05=_0x1b53[_0x264075];return _0x4bcc05;};'use strict';var moment=require(_0x31b5('0x0'));var Sequelize=require(_0x31b5('0x1'));module[_0x31b5('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x31b5('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x31b5('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x31b5('0x5')](_0x31b5('0x6'))},'countbusyretry':{'type':Sequelize[_0x31b5('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x31b5('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x31b5('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 8403e22..c07bcd4 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1dda=['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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','error','stack','send','CmHopperAdditionalPhone','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','map','type','VIRTUAL','options','includeAll','rows','show','params','length','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x4706a6,_0x5a1c63){var _0x1bb705=function(_0x484ebb){while(--_0x484ebb){_0x4706a6['push'](_0x4706a6['shift']());}};_0x1bb705(++_0x5a1c63);}(_0x1dda,0x1ab));var _0xa1dd=function(_0x21a2b3,_0x5d6564){_0x21a2b3=_0x21a2b3-0x0;var _0x4651a7=_0x1dda[_0x21a2b3];return _0x4651a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1dd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1dd('0x1'));var rp=require(_0xa1dd('0x2'));var moment=require(_0xa1dd('0x3'));var BPromise=require(_0xa1dd('0x4'));var Mustache=require(_0xa1dd('0x5'));var util=require(_0xa1dd('0x6'));var path=require(_0xa1dd('0x7'));var sox=require(_0xa1dd('0x8'));var csv=require(_0xa1dd('0x9'));var ejs=require(_0xa1dd('0xa'));var fs=require('fs');var fs_extra=require(_0xa1dd('0xb'));var _=require(_0xa1dd('0xc'));var squel=require(_0xa1dd('0xd'));var crypto=require(_0xa1dd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa1dd('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa1dd('0x10'));var Papa=require(_0xa1dd('0x11'));var Redis=require(_0xa1dd('0x12'));var authService=require(_0xa1dd('0x13'));var qs=require(_0xa1dd('0x14'));var as=require(_0xa1dd('0x15'));var hardwareService=require(_0xa1dd('0x16'));var logger=require(_0xa1dd('0x17'))('api');var utils=require(_0xa1dd('0x18'));var config=require(_0xa1dd('0x19'));var licenseUtil=require(_0xa1dd('0x1a'));var db=require(_0xa1dd('0x1b'))['db'];function respondWithStatusCode(_0x8b8126,_0x224e35){_0x224e35=_0x224e35||0xcc;return function(_0x16e8ec){if(_0x16e8ec){return _0x8b8126[_0xa1dd('0x1c')](_0x224e35);}return _0x8b8126[_0xa1dd('0x1d')](_0x224e35)[_0xa1dd('0x1e')]();};}function respondWithResult(_0x2c9cf7,_0x5eb7a4){_0x5eb7a4=_0x5eb7a4||0xc8;return function(_0x199f1a){if(_0x199f1a){return _0x2c9cf7[_0xa1dd('0x1d')](_0x5eb7a4)[_0xa1dd('0x1f')](_0x199f1a);}};}function respondWithFilteredResult(_0xe0fcfc,_0x51e9b8){return function(_0xedd018){if(_0xedd018){var _0x5b4691=typeof _0x51e9b8[_0xa1dd('0x20')]==='undefined'&&typeof _0x51e9b8[_0xa1dd('0x21')]===_0xa1dd('0x22');var _0x208685=_0xedd018[_0xa1dd('0x23')];var _0x4fe0f0=_0x5b4691?0x0:_0x51e9b8[_0xa1dd('0x20')];var _0x12e47d=_0x5b4691?_0xedd018[_0xa1dd('0x23')]:_0x51e9b8['offset']+_0x51e9b8[_0xa1dd('0x21')];var _0x1f81ec;if(_0x12e47d>=_0x208685){_0x12e47d=_0x208685;_0x1f81ec=0xc8;}else{_0x1f81ec=0xce;}_0xe0fcfc['status'](_0x1f81ec);return _0xe0fcfc[_0xa1dd('0x24')](_0xa1dd('0x25'),_0x4fe0f0+'-'+_0x12e47d+'/'+_0x208685)[_0xa1dd('0x1f')](_0xedd018);}return null;};}function patchUpdates(_0x2fb92d){return function(_0x204991){try{jsonpatch[_0xa1dd('0x26')](_0x204991,_0x2fb92d,!![]);}catch(_0x546cad){return BPromise[_0xa1dd('0x27')](_0x546cad);}return _0x204991[_0xa1dd('0x28')]();};}function saveUpdates(_0x5c49c5,_0x2155c7){return function(_0x53ee24){if(_0x53ee24){return _0x53ee24['update'](_0x5c49c5)[_0xa1dd('0x29')](function(_0x44ad5a){return _0x44ad5a;});}return null;};}function removeEntity(_0x1bdba4,_0x5ab259){return function(_0x7e9743){if(_0x7e9743){return _0x7e9743[_0xa1dd('0x2a')]()[_0xa1dd('0x29')](function(){var _0x4020c4=_0x7e9743[_0xa1dd('0x2b')]({'plain':!![]});var _0x4b7951='CmHopperAdditionalPhones';return db['UserProfileResource'][_0xa1dd('0x2a')]({'where':{'type':_0x4b7951,'resourceId':_0x4020c4['id']}})[_0xa1dd('0x29')](function(){return _0x7e9743;});})['then'](function(){_0x1bdba4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x367b88,_0x544c48){return function(_0x145b49){if(!_0x145b49){_0x367b88['sendStatus'](0x194);}return _0x145b49;};}function handleError(_0x29487f,_0x35a114){_0x35a114=_0x35a114||0x1f4;return function(_0x3f5ba0){logger[_0xa1dd('0x2c')](_0x3f5ba0[_0xa1dd('0x2d')]);if(_0x3f5ba0['name']){delete _0x3f5ba0['name'];}_0x29487f[_0xa1dd('0x1d')](_0x35a114)[_0xa1dd('0x2e')](_0x3f5ba0);};}exports['index']=function(_0x39f185,_0x5382c0){var _0x3258da={},_0x938efd={},_0x5b4376={'count':0x0,'rows':[]};var _0x3a8fc4=_['map'](db[_0xa1dd('0x2f')][_0xa1dd('0x30')],function(_0x3d5eaf){return{'name':_0x3d5eaf['fieldName'],'type':_0x3d5eaf['type'][_0xa1dd('0x31')]};});_0x938efd[_0xa1dd('0x32')]=_['map'](_0x3a8fc4,_0xa1dd('0x33'));_0x938efd[_0xa1dd('0x34')]=_[_0xa1dd('0x35')](_0x39f185[_0xa1dd('0x34')]);_0x938efd[_0xa1dd('0x36')]=_[_0xa1dd('0x37')](_0x938efd['model'],_0x938efd['query']);_0x3258da[_0xa1dd('0x38')]=_[_0xa1dd('0x37')](_0x938efd[_0xa1dd('0x32')],qs[_0xa1dd('0x39')](_0x39f185[_0xa1dd('0x34')][_0xa1dd('0x39')]));_0x3258da['attributes']=_0x3258da[_0xa1dd('0x38')]['length']?_0x3258da[_0xa1dd('0x38')]:_0x938efd[_0xa1dd('0x32')];if(!_0x39f185[_0xa1dd('0x34')]['hasOwnProperty'](_0xa1dd('0x3a'))){_0x3258da['limit']=qs['limit'](_0x39f185['query'][_0xa1dd('0x21')]);_0x3258da[_0xa1dd('0x20')]=qs[_0xa1dd('0x20')](_0x39f185[_0xa1dd('0x34')][_0xa1dd('0x20')]);}_0x3258da[_0xa1dd('0x3b')]=qs[_0xa1dd('0x3c')](_0x39f185[_0xa1dd('0x34')]['sort']);_0x3258da['where']=qs[_0xa1dd('0x36')](_[_0xa1dd('0x3d')](_0x39f185[_0xa1dd('0x34')],_0x938efd[_0xa1dd('0x36')]),_0x3a8fc4);if(_0x39f185[_0xa1dd('0x34')][_0xa1dd('0x3e')]){_0x3258da[_0xa1dd('0x3f')]=_['merge'](_0x3258da['where'],{'$or':_[_0xa1dd('0x40')](_0x3a8fc4,function(_0x4a1e56){if(_0x4a1e56[_0xa1dd('0x41')]!==_0xa1dd('0x42')){var _0x36864d={};_0x36864d[_0x4a1e56['name']]={'$like':'%'+_0x39f185[_0xa1dd('0x34')][_0xa1dd('0x3e')]+'%'};return _0x36864d;}})});}_0x3258da=_['merge']({},_0x3258da,_0x39f185[_0xa1dd('0x43')]);var _0x3d5e96={'where':_0x3258da[_0xa1dd('0x3f')]};return db[_0xa1dd('0x2f')]['count'](_0x3d5e96)[_0xa1dd('0x29')](function(_0x4b37a9){_0x5b4376[_0xa1dd('0x23')]=_0x4b37a9;if(_0x39f185[_0xa1dd('0x34')][_0xa1dd('0x44')]){_0x3258da['include']=[{'all':!![]}];}return db[_0xa1dd('0x2f')]['findAll'](_0x3258da);})[_0xa1dd('0x29')](function(_0x1b2fee){_0x5b4376[_0xa1dd('0x45')]=_0x1b2fee;return _0x5b4376;})['then'](respondWithFilteredResult(_0x5382c0,_0x3258da))['catch'](handleError(_0x5382c0,null));};exports[_0xa1dd('0x46')]=function(_0x38a96f,_0x2ca9b2){var _0x54280a={'raw':!![],'where':{'id':_0x38a96f[_0xa1dd('0x47')]['id']}},_0x10084d={};_0x10084d['model']=_[_0xa1dd('0x35')](db['CmHopperAdditionalPhone'][_0xa1dd('0x30')]);_0x10084d[_0xa1dd('0x34')]=_[_0xa1dd('0x35')](_0x38a96f['query']);_0x10084d['filters']=_[_0xa1dd('0x37')](_0x10084d['model'],_0x10084d[_0xa1dd('0x34')]);_0x54280a['attributes']=_[_0xa1dd('0x37')](_0x10084d['model'],qs[_0xa1dd('0x39')](_0x38a96f[_0xa1dd('0x34')][_0xa1dd('0x39')]));_0x54280a[_0xa1dd('0x38')]=_0x54280a[_0xa1dd('0x38')][_0xa1dd('0x48')]?_0x54280a[_0xa1dd('0x38')]:_0x10084d[_0xa1dd('0x32')];if(_0x38a96f[_0xa1dd('0x34')]['includeAll']){_0x54280a[_0xa1dd('0x49')]=[{'all':!![]}];}_0x54280a=_[_0xa1dd('0x4a')]({},_0x54280a,_0x38a96f[_0xa1dd('0x43')]);return db[_0xa1dd('0x2f')][_0xa1dd('0x4b')](_0x54280a)[_0xa1dd('0x29')](handleEntityNotFound(_0x2ca9b2,null))[_0xa1dd('0x29')](respondWithResult(_0x2ca9b2,null))['catch'](handleError(_0x2ca9b2,null));};exports[_0xa1dd('0x4c')]=function(_0x1ffd90,_0x35f61e){return db['CmHopperAdditionalPhone'][_0xa1dd('0x4c')](_0x1ffd90[_0xa1dd('0x4d')],{})[_0xa1dd('0x29')](function(_0x2e3f62){var _0x1185d4=_0x1ffd90[_0xa1dd('0x4e')][_0xa1dd('0x2b')]({'plain':!![]});if(!_0x1185d4)throw new Error(_0xa1dd('0x4f'));if(_0x1185d4[_0xa1dd('0x50')]===_0xa1dd('0x4e')){var _0x18a1ae=_0x2e3f62[_0xa1dd('0x2b')]({'plain':!![]});var _0x50e85f=_0xa1dd('0x51');return db['UserProfileSection'][_0xa1dd('0x4b')]({'where':{'name':_0x50e85f,'userProfileId':_0x1185d4[_0xa1dd('0x52')]},'raw':!![]})[_0xa1dd('0x29')](function(_0x2cb819){if(_0x2cb819&&_0x2cb819[_0xa1dd('0x53')]===0x0){return db[_0xa1dd('0x54')][_0xa1dd('0x4c')]({'name':_0x18a1ae['name'],'resourceId':_0x18a1ae['id'],'type':_0x2cb819[_0xa1dd('0x33')],'sectionId':_0x2cb819['id']},{})[_0xa1dd('0x29')](function(){return _0x2e3f62;});}else{return _0x2e3f62;}})['catch'](function(_0x3918aa){logger[_0xa1dd('0x2c')](_0xa1dd('0x55'),_0x3918aa);throw _0x3918aa;});}return _0x2e3f62;})['then'](respondWithResult(_0x35f61e,0xc9))[_0xa1dd('0x56')](handleError(_0x35f61e,null));};exports['update']=function(_0x2a68ff,_0xa05930){if(_0x2a68ff[_0xa1dd('0x4d')]['id']){delete _0x2a68ff[_0xa1dd('0x4d')]['id'];}return db[_0xa1dd('0x2f')][_0xa1dd('0x4b')]({'where':{'id':_0x2a68ff[_0xa1dd('0x47')]['id']}})['then'](handleEntityNotFound(_0xa05930,null))[_0xa1dd('0x29')](saveUpdates(_0x2a68ff[_0xa1dd('0x4d')],null))[_0xa1dd('0x29')](respondWithResult(_0xa05930,null))[_0xa1dd('0x56')](handleError(_0xa05930,null));};exports[_0xa1dd('0x2a')]=function(_0x3c66ac,_0x3d3638){return db[_0xa1dd('0x2f')]['find']({'where':{'id':_0x3c66ac[_0xa1dd('0x47')]['id']}})[_0xa1dd('0x29')](handleEntityNotFound(_0x3d3638,null))[_0xa1dd('0x29')](removeEntity(_0x3d3638,null))[_0xa1dd('0x56')](handleError(_0x3d3638,null));}; \ No newline at end of file +var _0x6930=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','CmHopperAdditionalPhones','error','stack','name','send','index','map','CmHopperAdditionalPhone'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x6930,0x173));var _0x0693=function(_0x29fc1c,_0x5a3b9a){_0x29fc1c=_0x29fc1c-0x0;var _0x4f15d1=_0x6930[_0x29fc1c];return _0x4f15d1;};'use strict';var emlformat=require(_0x0693('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0693('0x1'));var jsonpatch=require(_0x0693('0x2'));var rp=require(_0x0693('0x3'));var moment=require(_0x0693('0x4'));var BPromise=require(_0x0693('0x5'));var Mustache=require(_0x0693('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0693('0x7'));var csv=require(_0x0693('0x8'));var ejs=require(_0x0693('0x9'));var fs=require('fs');var fs_extra=require(_0x0693('0xa'));var _=require(_0x0693('0xb'));var squel=require(_0x0693('0xc'));var crypto=require(_0x0693('0xd'));var jsforce=require(_0x0693('0xe'));var deskjs=require(_0x0693('0xf'));var toCsv=require(_0x0693('0x8'));var querystring=require(_0x0693('0x10'));var Papa=require(_0x0693('0x11'));var Redis=require(_0x0693('0x12'));var authService=require(_0x0693('0x13'));var qs=require(_0x0693('0x14'));var as=require(_0x0693('0x15'));var hardwareService=require(_0x0693('0x16'));var logger=require(_0x0693('0x17'))(_0x0693('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0693('0x19'));var db=require(_0x0693('0x1a'))['db'];function respondWithStatusCode(_0x4c33e1,_0x256316){_0x256316=_0x256316||0xcc;return function(_0x20ea41){if(_0x20ea41){return _0x4c33e1[_0x0693('0x1b')](_0x256316);}return _0x4c33e1[_0x0693('0x1c')](_0x256316)[_0x0693('0x1d')]();};}function respondWithResult(_0x42b6d6,_0x48b60c){_0x48b60c=_0x48b60c||0xc8;return function(_0x2d01e6){if(_0x2d01e6){return _0x42b6d6[_0x0693('0x1c')](_0x48b60c)[_0x0693('0x1e')](_0x2d01e6);}};}function respondWithFilteredResult(_0xc69fc9,_0xc315c){return function(_0x557d70){if(_0x557d70){var _0x2f375f=typeof _0xc315c[_0x0693('0x1f')]==='undefined'&&typeof _0xc315c[_0x0693('0x20')]===_0x0693('0x21');var _0x2ff508=_0x557d70[_0x0693('0x22')];var _0x2bb6d6=_0x2f375f?0x0:_0xc315c[_0x0693('0x1f')];var _0x5632f9=_0x2f375f?_0x557d70[_0x0693('0x22')]:_0xc315c['offset']+_0xc315c[_0x0693('0x20')];var _0x44d74f;if(_0x5632f9>=_0x2ff508){_0x5632f9=_0x2ff508;_0x44d74f=0xc8;}else{_0x44d74f=0xce;}_0xc69fc9[_0x0693('0x1c')](_0x44d74f);return _0xc69fc9[_0x0693('0x23')](_0x0693('0x24'),_0x2bb6d6+'-'+_0x5632f9+'/'+_0x2ff508)[_0x0693('0x1e')](_0x557d70);}return null;};}function patchUpdates(_0x3c81cc){return function(_0x1ac2de){try{jsonpatch[_0x0693('0x25')](_0x1ac2de,_0x3c81cc,!![]);}catch(_0x252e58){return BPromise[_0x0693('0x26')](_0x252e58);}return _0x1ac2de['save']();};}function saveUpdates(_0x124fa1,_0x5a97a4){return function(_0x242ae0){if(_0x242ae0){return _0x242ae0[_0x0693('0x27')](_0x124fa1)[_0x0693('0x28')](function(_0x5bdfaa){return _0x5bdfaa;});}return null;};}function removeEntity(_0x327d96,_0x4aaa2d){return function(_0x370ab7){if(_0x370ab7){return _0x370ab7['destroy']()['then'](function(){var _0xe7f640=_0x370ab7['get']({'plain':!![]});var _0x1d5c59=_0x0693('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x1d5c59,'resourceId':_0xe7f640['id']}})['then'](function(){return _0x370ab7;});})[_0x0693('0x28')](function(){_0x327d96['status'](0xcc)[_0x0693('0x1d')]();});}};}function handleEntityNotFound(_0x585f95,_0xe1e50b){return function(_0x1bb727){if(!_0x1bb727){_0x585f95[_0x0693('0x1b')](0x194);}return _0x1bb727;};}function handleError(_0x5259a3,_0x292e6f){_0x292e6f=_0x292e6f||0x1f4;return function(_0x49ff79){logger[_0x0693('0x2a')](_0x49ff79[_0x0693('0x2b')]);if(_0x49ff79[_0x0693('0x2c')]){delete _0x49ff79[_0x0693('0x2c')];}_0x5259a3[_0x0693('0x1c')](_0x292e6f)[_0x0693('0x2d')](_0x49ff79);};}exports[_0x0693('0x2e')]=function(_0x210870,_0x3f65b5){var _0x13fa68={},_0x39110b={},_0x4fa6e2={'count':0x0,'rows':[]};var _0x582b8b=_[_0x0693('0x2f')](db[_0x0693('0x30')][_0x0693('0x31')],function(_0xa3b807){return{'name':_0xa3b807[_0x0693('0x32')],'type':_0xa3b807[_0x0693('0x33')][_0x0693('0x34')]};});_0x39110b[_0x0693('0x35')]=_[_0x0693('0x2f')](_0x582b8b,_0x0693('0x2c'));_0x39110b['query']=_[_0x0693('0x36')](_0x210870[_0x0693('0x37')]);_0x39110b[_0x0693('0x38')]=_[_0x0693('0x39')](_0x39110b[_0x0693('0x35')],_0x39110b[_0x0693('0x37')]);_0x13fa68[_0x0693('0x3a')]=_[_0x0693('0x39')](_0x39110b[_0x0693('0x35')],qs[_0x0693('0x3b')](_0x210870['query']['fields']));_0x13fa68[_0x0693('0x3a')]=_0x13fa68['attributes'][_0x0693('0x3c')]?_0x13fa68[_0x0693('0x3a')]:_0x39110b[_0x0693('0x35')];if(!_0x210870[_0x0693('0x37')][_0x0693('0x3d')]('nolimit')){_0x13fa68[_0x0693('0x20')]=qs[_0x0693('0x20')](_0x210870[_0x0693('0x37')]['limit']);_0x13fa68[_0x0693('0x1f')]=qs[_0x0693('0x1f')](_0x210870[_0x0693('0x37')][_0x0693('0x1f')]);}_0x13fa68['order']=qs['sort'](_0x210870[_0x0693('0x37')][_0x0693('0x3e')]);_0x13fa68[_0x0693('0x3f')]=qs[_0x0693('0x38')](_['pick'](_0x210870[_0x0693('0x37')],_0x39110b['filters']),_0x582b8b);if(_0x210870[_0x0693('0x37')]['filter']){_0x13fa68[_0x0693('0x3f')]=_[_0x0693('0x40')](_0x13fa68[_0x0693('0x3f')],{'$or':_[_0x0693('0x2f')](_0x582b8b,function(_0x3936c1){if(_0x3936c1[_0x0693('0x33')]!==_0x0693('0x41')){var _0x308c09={};_0x308c09[_0x3936c1['name']]={'$like':'%'+_0x210870[_0x0693('0x37')]['filter']+'%'};return _0x308c09;}})});}_0x13fa68=_[_0x0693('0x40')]({},_0x13fa68,_0x210870[_0x0693('0x42')]);var _0x3aa9d1={'where':_0x13fa68[_0x0693('0x3f')]};return db[_0x0693('0x30')]['count'](_0x3aa9d1)[_0x0693('0x28')](function(_0x2437bf){_0x4fa6e2[_0x0693('0x22')]=_0x2437bf;if(_0x210870[_0x0693('0x37')][_0x0693('0x43')]){_0x13fa68[_0x0693('0x44')]=[{'all':!![]}];}return db[_0x0693('0x30')]['findAll'](_0x13fa68);})['then'](function(_0x1e4611){_0x4fa6e2[_0x0693('0x45')]=_0x1e4611;return _0x4fa6e2;})[_0x0693('0x28')](respondWithFilteredResult(_0x3f65b5,_0x13fa68))[_0x0693('0x46')](handleError(_0x3f65b5,null));};exports[_0x0693('0x47')]=function(_0x1a8307,_0x3dc1d9){var _0x25891a={'raw':!![],'where':{'id':_0x1a8307[_0x0693('0x48')]['id']}},_0x16d899={};_0x16d899[_0x0693('0x35')]=_[_0x0693('0x36')](db[_0x0693('0x30')][_0x0693('0x31')]);_0x16d899[_0x0693('0x37')]=_['keys'](_0x1a8307['query']);_0x16d899['filters']=_[_0x0693('0x39')](_0x16d899[_0x0693('0x35')],_0x16d899[_0x0693('0x37')]);_0x25891a[_0x0693('0x3a')]=_['intersection'](_0x16d899['model'],qs['fields'](_0x1a8307[_0x0693('0x37')]['fields']));_0x25891a[_0x0693('0x3a')]=_0x25891a[_0x0693('0x3a')][_0x0693('0x3c')]?_0x25891a[_0x0693('0x3a')]:_0x16d899[_0x0693('0x35')];if(_0x1a8307[_0x0693('0x37')][_0x0693('0x43')]){_0x25891a[_0x0693('0x44')]=[{'all':!![]}];}_0x25891a=_[_0x0693('0x40')]({},_0x25891a,_0x1a8307[_0x0693('0x42')]);return db[_0x0693('0x30')][_0x0693('0x49')](_0x25891a)[_0x0693('0x28')](handleEntityNotFound(_0x3dc1d9,null))[_0x0693('0x28')](respondWithResult(_0x3dc1d9,null))['catch'](handleError(_0x3dc1d9,null));};exports[_0x0693('0x4a')]=function(_0x7e7832,_0x573ecb){return db['CmHopperAdditionalPhone'][_0x0693('0x4a')](_0x7e7832[_0x0693('0x4b')],{})[_0x0693('0x28')](function(_0x21312f){var _0xe88e94=_0x7e7832['user']['get']({'plain':!![]});if(!_0xe88e94)throw new Error(_0x0693('0x4c'));if(_0xe88e94[_0x0693('0x4d')]==='user'){var _0x269827=_0x21312f[_0x0693('0x4e')]({'plain':!![]});var _0x249a6e=_0x0693('0x29');return db[_0x0693('0x4f')][_0x0693('0x49')]({'where':{'name':_0x249a6e,'userProfileId':_0xe88e94['userProfileId']},'raw':!![]})[_0x0693('0x28')](function(_0xb7011b){if(_0xb7011b&&_0xb7011b[_0x0693('0x50')]===0x0){return db[_0x0693('0x51')][_0x0693('0x4a')]({'name':_0x269827[_0x0693('0x2c')],'resourceId':_0x269827['id'],'type':_0xb7011b[_0x0693('0x2c')],'sectionId':_0xb7011b['id']},{})['then'](function(){return _0x21312f;});}else{return _0x21312f;}})[_0x0693('0x46')](function(_0xa60a3c){logger[_0x0693('0x2a')](_0x0693('0x52'),_0xa60a3c);throw _0xa60a3c;});}return _0x21312f;})[_0x0693('0x28')](respondWithResult(_0x573ecb,0xc9))[_0x0693('0x46')](handleError(_0x573ecb,null));};exports[_0x0693('0x27')]=function(_0x5950cb,_0x1cd55a){if(_0x5950cb[_0x0693('0x4b')]['id']){delete _0x5950cb['body']['id'];}return db[_0x0693('0x30')]['find']({'where':{'id':_0x5950cb[_0x0693('0x48')]['id']}})[_0x0693('0x28')](handleEntityNotFound(_0x1cd55a,null))[_0x0693('0x28')](saveUpdates(_0x5950cb[_0x0693('0x4b')],null))[_0x0693('0x28')](respondWithResult(_0x1cd55a,null))[_0x0693('0x46')](handleError(_0x1cd55a,null));};exports[_0x0693('0x53')]=function(_0x64cfe8,_0x186235){return db[_0x0693('0x30')][_0x0693('0x49')]({'where':{'id':_0x64cfe8[_0x0693('0x48')]['id']}})[_0x0693('0x28')](handleEntityNotFound(_0x186235,null))[_0x0693('0x28')](removeEntity(_0x186235,null))[_0x0693('0x46')](handleError(_0x186235,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index e49611d..f55aed4 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd87=['moment','bluebird','path','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x5381ea,_0x45431e){var _0x418b3b=function(_0x341894){while(--_0x341894){_0x5381ea['push'](_0x5381ea['shift']());}};_0x418b3b(++_0x45431e);}(_0xfd87,0x1b5));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var logger=require(_0x7fd8('0x2'))('api');var moment=require(_0x7fd8('0x3'));var BPromise=require(_0x7fd8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fd8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7fd8('0x6'));module[_0x7fd8('0x7')]=function(_0x198b0a,_0xe27c31){return _0x198b0a['define'](_0x7fd8('0x8'),attributes,{'tableName':_0x7fd8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe854=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','moment'];(function(_0x69f70d,_0x1239f9){var _0x15486b=function(_0x29fa7c){while(--_0x29fa7c){_0x69f70d['push'](_0x69f70d['shift']());}};_0x15486b(++_0x1239f9);}(_0xe854,0x105));var _0x4e85=function(_0x3a0f77,_0x39f605){_0x3a0f77=_0x3a0f77-0x0;var _0x54fd0c=_0xe854[_0x3a0f77];return _0x54fd0c;};'use strict';var _=require(_0x4e85('0x0'));var util=require(_0x4e85('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4e85('0x2'));var BPromise=require(_0x4e85('0x3'));var rp=require(_0x4e85('0x4'));var fs=require('fs');var path=require(_0x4e85('0x5'));var rimraf=require(_0x4e85('0x6'));var config=require(_0x4e85('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x4e85('0x8')]=function(_0x4fcc9a,_0x930878){return _0x4fcc9a[_0x4e85('0x9')](_0x4e85('0xa'),attributes,{'tableName':_0x4e85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index d90a679..223c8f4 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bda=['OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','VerifyAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','countabandonedretry','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone'];(function(_0x1638f4,_0x370a51){var _0x56a7c6=function(_0x4365b3){while(--_0x4365b3){_0x1638f4['push'](_0x1638f4['shift']());}};_0x56a7c6(++_0x370a51);}(_0x7bda,0x171));var _0xa7bd=function(_0x1c3352,_0x216fda){_0x1c3352=_0x1c3352-0x0;var _0x2848b2=_0x7bda[_0x1c3352];return _0x2848b2;};'use strict';var _=require(_0xa7bd('0x0'));var util=require(_0xa7bd('0x1'));var moment=require('moment');var BPromise=require(_0xa7bd('0x2'));var rs=require(_0xa7bd('0x3'));var fs=require('fs');var Redis=require(_0xa7bd('0x4'));var db=require(_0xa7bd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7bd('0x6'))(_0xa7bd('0x7'));var config=require('../../config/environment');var jayson=require(_0xa7bd('0x8'));var client=jayson[_0xa7bd('0x9')][_0xa7bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29b280,_0x734191,_0x168772){return new BPromise(function(_0x2b9fa2,_0x5d44ed){return client[_0xa7bd('0xb')](_0x29b280,_0x168772)['then'](function(_0x63e22e){logger[_0xa7bd('0xc')](_0xa7bd('0xd'),_0x734191,_0xa7bd('0xe'));logger[_0xa7bd('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x734191,'request\x20sent',JSON[_0xa7bd('0x10')](_0x63e22e));if(_0x63e22e['error']){if(_0x63e22e[_0xa7bd('0x11')][_0xa7bd('0x12')]===0x1f4){logger[_0xa7bd('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x734191,_0x63e22e[_0xa7bd('0x11')][_0xa7bd('0x13')]);return _0x5d44ed(_0x63e22e[_0xa7bd('0x11')][_0xa7bd('0x13')]);}logger[_0xa7bd('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x734191,_0x63e22e[_0xa7bd('0x11')][_0xa7bd('0x13')]);return _0x2b9fa2(_0x63e22e[_0xa7bd('0x11')][_0xa7bd('0x13')]);}else{logger['info'](_0xa7bd('0xd'),_0x734191,_0xa7bd('0xe'));_0x2b9fa2(_0x63e22e['result'][_0xa7bd('0x13')]);}})[_0xa7bd('0x14')](function(_0x2dc179){logger[_0xa7bd('0x11')](_0xa7bd('0xd'),_0x734191,_0x2dc179);_0x5d44ed(_0x2dc179);});});}exports['VerifyAdditionalPhones']=function(_0x2cb250){var _0x165dab=this;return new Promise(function(_0x423b31,_0x52da82){return db[_0xa7bd('0x15')][_0xa7bd('0x16')]({'raw':!![],'where':{'ContactId':_0x2cb250[_0xa7bd('0x17')][_0xa7bd('0x18')],'ListId':_0x2cb250['body'][_0xa7bd('0x19')],'VoiceQueueId':_0x2cb250[_0xa7bd('0x17')][_0xa7bd('0x1a')]===undefined?null:_0x2cb250[_0xa7bd('0x17')]['VoiceQueueId'],'CampaignId':_0x2cb250[_0xa7bd('0x17')][_0xa7bd('0x1b')]===undefined?null:_0x2cb250[_0xa7bd('0x17')][_0xa7bd('0x1b')]}})[_0xa7bd('0x1c')](function(_0x2f3f7f){if(_0x2f3f7f!=null){return db[_0xa7bd('0x1d')][_0xa7bd('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2f3f7f['id'],'OrderBy':{'$gt':_0x2f3f7f['OrderBy']}},'order':[[_0xa7bd('0x1e'),_0xa7bd('0x1f')]]})[_0xa7bd('0x1c')](function(_0x4c3b0b){var _0x839a9=0x0;if(_0x4c3b0b){if(_0x4c3b0b[_0xa7bd('0x20')]+_0x4c3b0b[_0xa7bd('0x21')]+_0x4c3b0b[_0xa7bd('0x22')]+_0x4c3b0b[_0xa7bd('0x23')]+_0x4c3b0b[_0xa7bd('0x24')]+_0x4c3b0b['countabandonedretry']+_0x4c3b0b[_0xa7bd('0x25')]+_0x4c3b0b['countagentrejectretry']<_0x2cb250['entity']['dialGlobalMaxRetry'])_0x839a9=0x1;_0x423b31({'additional':_0x839a9});}else{return db[_0xa7bd('0x1d')][_0xa7bd('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2f3f7f['id']},'order':[[_0xa7bd('0x1e'),_0xa7bd('0x1f')]]})[_0xa7bd('0x1c')](function(_0x591b42){var _0x1ae25d=0x0;if(_0x591b42){if(_0x591b42[_0xa7bd('0x20')]+_0x591b42[_0xa7bd('0x21')]+_0x591b42[_0xa7bd('0x22')]+_0x591b42[_0xa7bd('0x23')]+_0x591b42['countdropretry']+_0x591b42['countabandonedretry']+_0x591b42[_0xa7bd('0x25')]+_0x591b42[_0xa7bd('0x26')]<_0x2cb250['entity'][_0xa7bd('0x27')])_0x1ae25d=0x1;_0x423b31({'additional':_0x1ae25d});}else{_0x423b31({'additional':0x0});}})[_0xa7bd('0x14')](function(_0x4a438d){logger[_0xa7bd('0x11')]('VerifyAdditionalPhones',_0x4a438d[_0xa7bd('0x13')]);_0x52da82(_0x165dab['error'](0x1f4,_0x4a438d[_0xa7bd('0x13')]));});}})[_0xa7bd('0x14')](function(_0x5d9674){logger[_0xa7bd('0x11')](_0xa7bd('0x28'),_0x5d9674[_0xa7bd('0x13')]);_0x52da82(_0x165dab[_0xa7bd('0x11')](0x1f4,_0x5d9674['message']));});}else _0x423b31({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x356b95){var _0x5be036=this;return new Promise(function(_0x5ed38d,_0xb620d1){return db['CmHopper'][_0xa7bd('0x16')]({'raw':!![],'where':{'ContactId':_0x356b95[_0xa7bd('0x17')][_0xa7bd('0x18')],'ListId':_0x356b95[_0xa7bd('0x17')][_0xa7bd('0x19')],'VoiceQueueId':_0x356b95[_0xa7bd('0x17')][_0xa7bd('0x1a')]===undefined?null:_0x356b95[_0xa7bd('0x17')][_0xa7bd('0x1a')],'CampaignId':_0x356b95[_0xa7bd('0x17')]['CampaignId']===undefined?null:_0x356b95['body'][_0xa7bd('0x1b')]}})[_0xa7bd('0x1c')](function(_0x59c160){if(_0x59c160!=null){return db[_0xa7bd('0x1d')][_0xa7bd('0x16')]({'raw':!![],'where':{'CmHopperId':_0x59c160['id'],'OrderBy':{'$gte':_0x59c160['OrderBy']}},'order':[[_0xa7bd('0x1e'),_0xa7bd('0x1f')]]})[_0xa7bd('0x1c')](function(_0x19a00d){if(_0x19a00d)return activateAdditionalPhone(_0x59c160,_0x356b95[_0xa7bd('0x17')],_0x19a00d,_0x356b95[_0xa7bd('0x29')],_0x356b95['waitTime'])['then'](function(_0x3c655d){_0x5ed38d(_0x3c655d);});else{return db[_0xa7bd('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x59c160['id']},'order':[['OrderBy',_0xa7bd('0x1f')]]})['then'](function(_0x2fd436){if(_0x2fd436)return activateAdditionalPhone(_0x59c160,_0x356b95[_0xa7bd('0x17')],_0x2fd436,_0x356b95[_0xa7bd('0x29')],_0x356b95[_0xa7bd('0x2a')])['then'](function(_0x11180e){_0x5ed38d(_0x11180e);});else{_0x5ed38d({'id':_0x59c160['id'],'phone':''});}})[_0xa7bd('0x14')](function(_0x38a605){logger[_0xa7bd('0x11')](_0xa7bd('0x28'),_0x38a605[_0xa7bd('0x13')]);_0xb620d1(_0x5be036['error'](0x1f4,_0x38a605[_0xa7bd('0x13')]));});}})[_0xa7bd('0x14')](function(_0x4d98fd){logger[_0xa7bd('0x11')](_0xa7bd('0x28'),_0x4d98fd[_0xa7bd('0x13')]);_0xb620d1(_0x5be036[_0xa7bd('0x11')](0x1f4,_0x4d98fd[_0xa7bd('0x13')]));});}else _0x5ed38d(0x1);});});};function activateAdditionalPhone(_0x5d6035,_0x14b429,_0x2ccc46,_0x547d9e,_0x2973c3){return new Promise(function(_0x10af43,_0x554982){var _0x3f0af7;if(_[_0xa7bd('0x2b')](_0x2ccc46[_0xa7bd('0x2c')])){_0x2ccc46[_0xa7bd('0x2c')]=moment();}if(moment()>moment(_0x2ccc46[_0xa7bd('0x2c')])){_0x3f0af7=moment()[_0xa7bd('0x2d')](_0x2973c3||0x3,_0xa7bd('0x2e'));}else{if(_0x2ccc46['OrderBy']==0x0){_0x3f0af7=moment(_0x2ccc46[_0xa7bd('0x2c')]);}else{_0x3f0af7=moment()[_0xa7bd('0x2d')](_0x2973c3||0x3,'minutes');}}if(_[_0xa7bd('0x2b')](_0x3f0af7)){_0x3f0af7=moment()['add'](_0x2973c3||0x3,_0xa7bd('0x2e'));}var _0x4ae803={'phone':_0x5d6035[_0xa7bd('0x2f')],'active':0x0,'OrderBy':_[_0xa7bd('0x2b')](_0x5d6035[_0xa7bd('0x1e')])?0x0:_0x5d6035['OrderBy'],'scheduledat':moment()['add'](_0x547d9e||0x1,_0xa7bd('0x2e')),'countbusyretry':_0x14b429['countbusyretry'],'countcongestionretry':_0x14b429[_0xa7bd('0x21')],'countnoanswerretry':_0x14b429[_0xa7bd('0x22')],'countnosuchnumberretry':_0x14b429[_0xa7bd('0x23')],'countdropretry':_0x14b429['countdropretry'],'countabandonedretry':_0x14b429[_0xa7bd('0x30')],'countmachineretry':_0x14b429[_0xa7bd('0x25')],'countagentrejectretry':_0x14b429[_0xa7bd('0x26')],'createdAt':_0x14b429[_0xa7bd('0x31')],'updatedAt':_0x14b429[_0xa7bd('0x32')]};var _0x22f646={'CmHopperId':_0x5d6035['id'],'phone':_0x2ccc46['phone'],'active':0x0,'OrderBy':_[_0xa7bd('0x2b')](_0x2ccc46[_0xa7bd('0x1e')])?0x0:_0x2ccc46[_0xa7bd('0x1e')],'scheduledat':_0x3f0af7,'countbusyretry':_0x2ccc46['countbusyretry'],'countcongestionretry':_0x2ccc46[_0xa7bd('0x21')],'countnoanswerretry':_0x2ccc46[_0xa7bd('0x22')],'countnosuchnumberretry':_0x2ccc46['countnosuchnumberretry'],'countdropretry':_0x2ccc46[_0xa7bd('0x24')],'countabandonedretry':_0x2ccc46[_0xa7bd('0x30')],'countmachineretry':_0x2ccc46[_0xa7bd('0x25')],'countagentrejectretry':_0x2ccc46[_0xa7bd('0x26')],'createdAt':_0x2ccc46[_0xa7bd('0x31')],'updatedAt':_0x2ccc46['updatedAt']};return db[_0xa7bd('0x33')][_0xa7bd('0x34')](function(_0x505371){return db[_0xa7bd('0x1d')][_0xa7bd('0x35')](_0x4ae803,{'where':{'id':_0x2ccc46['id']}},{'transaction':_0x505371})[_0xa7bd('0x1c')](function(){return db['CmHopper']['update'](_0x22f646,{'where':{'id':_0x5d6035['id']}},{'transaction':_0x505371});});})['then'](function(_0x295a81){_0x10af43({'id':_0x5d6035['id'],'phone':_0x2ccc46[_0xa7bd('0x2f')]});})['catch'](function(_0x22cd57){logger[_0xa7bd('0x11')](_0xa7bd('0x36'),_0x22cd57[_0xa7bd('0x13')]);_0x554982({'error':_0x22cd57[_0xa7bd('0x13')]});});});}exports[_0xa7bd('0x37')]=function(_0x4a8322){var _0x535cfb=this;return new Promise(function(_0x47634e,_0x300c22){return db[_0xa7bd('0x15')][_0xa7bd('0x35')](_0x4a8322[_0xa7bd('0x17')][_0xa7bd('0x38')],{'where':{'id':_0x4a8322['body']['id']}})[_0xa7bd('0x1c')](function(_0xc79986){_0x47634e(_0xc79986);})[_0xa7bd('0x14')](function(_0x374d17){logger[_0xa7bd('0x11')]('IncrementPreviewCounters',_0x374d17['message']);_0x300c22(_0x535cfb[_0xa7bd('0x11')](0x1f4,_0x374d17[_0xa7bd('0x13')]));});});}; \ No newline at end of file +var _0x669f=['minutes','createdAt','updatedAt','phone','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','countabandonedretry','dialGlobalMaxRetry','duration','waitTime','isNil','scheduledat','add'];(function(_0x4a7d93,_0x289389){var _0x4dc20b=function(_0x3d3579){while(--_0x3d3579){_0x4a7d93['push'](_0x4a7d93['shift']());}};_0x4dc20b(++_0x289389);}(_0x669f,0x12a));var _0xf669=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x669f[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require(_0xf669('0x0'));var util=require(_0xf669('0x1'));var moment=require(_0xf669('0x2'));var BPromise=require(_0xf669('0x3'));var rs=require(_0xf669('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf669('0x5'))['db'];var utils=require(_0xf669('0x6'));var logger=require('../../config/logger')(_0xf669('0x7'));var config=require(_0xf669('0x8'));var jayson=require(_0xf669('0x9'));var client=jayson[_0xf669('0xa')][_0xf669('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb7c213,_0x64cb69,_0x52e46e){return new BPromise(function(_0x316cbb,_0x542dd0){return client[_0xf669('0xc')](_0xb7c213,_0x52e46e)[_0xf669('0xd')](function(_0x554f67){logger[_0xf669('0xe')](_0xf669('0xf'),_0x64cb69,_0xf669('0x10'));logger['debug'](_0xf669('0x11'),_0x64cb69,_0xf669('0x10'),JSON[_0xf669('0x12')](_0x554f67));if(_0x554f67[_0xf669('0x13')]){if(_0x554f67[_0xf669('0x13')][_0xf669('0x14')]===0x1f4){logger[_0xf669('0x13')](_0xf669('0xf'),_0x64cb69,_0x554f67[_0xf669('0x13')][_0xf669('0x15')]);return _0x542dd0(_0x554f67[_0xf669('0x13')][_0xf669('0x15')]);}logger[_0xf669('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x64cb69,_0x554f67[_0xf669('0x13')][_0xf669('0x15')]);return _0x316cbb(_0x554f67['error']['message']);}else{logger[_0xf669('0xe')](_0xf669('0xf'),_0x64cb69,_0xf669('0x10'));_0x316cbb(_0x554f67[_0xf669('0x16')][_0xf669('0x15')]);}})[_0xf669('0x17')](function(_0x12d941){logger[_0xf669('0x13')](_0xf669('0xf'),_0x64cb69,_0x12d941);_0x542dd0(_0x12d941);});});}exports[_0xf669('0x18')]=function(_0x5825e4){var _0x66dd76=this;return new Promise(function(_0x13d9fe,_0x36b454){return db[_0xf669('0x19')]['findOne']({'raw':!![],'where':{'ContactId':_0x5825e4[_0xf669('0x1a')][_0xf669('0x1b')],'ListId':_0x5825e4[_0xf669('0x1a')][_0xf669('0x1c')],'VoiceQueueId':_0x5825e4['body'][_0xf669('0x1d')]===undefined?null:_0x5825e4[_0xf669('0x1a')]['VoiceQueueId'],'CampaignId':_0x5825e4[_0xf669('0x1a')]['CampaignId']===undefined?null:_0x5825e4['body'][_0xf669('0x1e')]}})[_0xf669('0xd')](function(_0x507345){if(_0x507345!=null){return db[_0xf669('0x1f')][_0xf669('0x20')]({'raw':!![],'where':{'CmHopperId':_0x507345['id'],'OrderBy':{'$gt':_0x507345[_0xf669('0x21')]}},'order':[[_0xf669('0x21'),_0xf669('0x22')]]})[_0xf669('0xd')](function(_0xf2d1fc){var _0x53466e=0x0;if(_0xf2d1fc){if(_0xf2d1fc[_0xf669('0x23')]+_0xf2d1fc[_0xf669('0x24')]+_0xf2d1fc[_0xf669('0x25')]+_0xf2d1fc[_0xf669('0x26')]+_0xf2d1fc[_0xf669('0x27')]+_0xf2d1fc['countabandonedretry']+_0xf2d1fc[_0xf669('0x28')]+_0xf2d1fc[_0xf669('0x29')]<_0x5825e4[_0xf669('0x2a')]['dialGlobalMaxRetry'])_0x53466e=0x1;_0x13d9fe({'additional':_0x53466e});}else{return db[_0xf669('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x507345['id']},'order':[[_0xf669('0x21'),_0xf669('0x22')]]})[_0xf669('0xd')](function(_0x5289fe){var _0x1e312b=0x0;if(_0x5289fe){if(_0x5289fe[_0xf669('0x23')]+_0x5289fe[_0xf669('0x24')]+_0x5289fe[_0xf669('0x25')]+_0x5289fe[_0xf669('0x26')]+_0x5289fe[_0xf669('0x27')]+_0x5289fe[_0xf669('0x2b')]+_0x5289fe[_0xf669('0x28')]+_0x5289fe[_0xf669('0x29')]<_0x5825e4['entity'][_0xf669('0x2c')])_0x1e312b=0x1;_0x13d9fe({'additional':_0x1e312b});}else{_0x13d9fe({'additional':0x0});}})[_0xf669('0x17')](function(_0x57bbce){logger[_0xf669('0x13')]('VerifyAdditionalPhones',_0x57bbce['message']);_0x36b454(_0x66dd76[_0xf669('0x13')](0x1f4,_0x57bbce[_0xf669('0x15')]));});}})['catch'](function(_0x185dcd){logger[_0xf669('0x13')]('VerifyAdditionalPhones',_0x185dcd[_0xf669('0x15')]);_0x36b454(_0x66dd76[_0xf669('0x13')](0x1f4,_0x185dcd['message']));});}else _0x13d9fe({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x195f93){var _0xd0500d=this;return new Promise(function(_0x2a3938,_0x4aa8df){return db[_0xf669('0x19')][_0xf669('0x20')]({'raw':!![],'where':{'ContactId':_0x195f93[_0xf669('0x1a')][_0xf669('0x1b')],'ListId':_0x195f93[_0xf669('0x1a')][_0xf669('0x1c')],'VoiceQueueId':_0x195f93['body'][_0xf669('0x1d')]===undefined?null:_0x195f93['body']['VoiceQueueId'],'CampaignId':_0x195f93[_0xf669('0x1a')][_0xf669('0x1e')]===undefined?null:_0x195f93['body'][_0xf669('0x1e')]}})['then'](function(_0x4ebc75){if(_0x4ebc75!=null){return db['CmHopperAdditionalPhone'][_0xf669('0x20')]({'raw':!![],'where':{'CmHopperId':_0x4ebc75['id'],'OrderBy':{'$gte':_0x4ebc75[_0xf669('0x21')]}},'order':[['OrderBy',_0xf669('0x22')]]})['then'](function(_0x5cfe4e){if(_0x5cfe4e)return activateAdditionalPhone(_0x4ebc75,_0x195f93[_0xf669('0x1a')],_0x5cfe4e,_0x195f93[_0xf669('0x2d')],_0x195f93[_0xf669('0x2e')])[_0xf669('0xd')](function(_0x502c84){_0x2a3938(_0x502c84);});else{return db[_0xf669('0x1f')][_0xf669('0x20')]({'raw':!![],'where':{'CmHopperId':_0x4ebc75['id']},'order':[[_0xf669('0x21'),_0xf669('0x22')]]})['then'](function(_0x2c4fc7){if(_0x2c4fc7)return activateAdditionalPhone(_0x4ebc75,_0x195f93[_0xf669('0x1a')],_0x2c4fc7,_0x195f93['duration'],_0x195f93[_0xf669('0x2e')])[_0xf669('0xd')](function(_0x3685d9){_0x2a3938(_0x3685d9);});else{_0x2a3938({'id':_0x4ebc75['id'],'phone':''});}})['catch'](function(_0x2e5fbc){logger[_0xf669('0x13')]('VerifyAdditionalPhones',_0x2e5fbc['message']);_0x4aa8df(_0xd0500d['error'](0x1f4,_0x2e5fbc[_0xf669('0x15')]));});}})[_0xf669('0x17')](function(_0x5eb482){logger[_0xf669('0x13')](_0xf669('0x18'),_0x5eb482['message']);_0x4aa8df(_0xd0500d[_0xf669('0x13')](0x1f4,_0x5eb482['message']));});}else _0x2a3938(0x1);});});};function activateAdditionalPhone(_0x23041d,_0xa0656c,_0x503e7c,_0x28643c,_0x18f8c7){return new Promise(function(_0x268ab1,_0x191e5d){var _0x15206b;if(_[_0xf669('0x2f')](_0x503e7c[_0xf669('0x30')])){_0x503e7c[_0xf669('0x30')]=moment();}if(moment()>moment(_0x503e7c['scheduledat'])){_0x15206b=moment()[_0xf669('0x31')](_0x18f8c7||0x3,'minutes');}else{if(_0x503e7c[_0xf669('0x21')]==0x0){_0x15206b=moment(_0x503e7c[_0xf669('0x30')]);}else{_0x15206b=moment()[_0xf669('0x31')](_0x18f8c7||0x3,_0xf669('0x32'));}}if(_[_0xf669('0x2f')](_0x15206b)){_0x15206b=moment()[_0xf669('0x31')](_0x18f8c7||0x3,'minutes');}var _0x499647={'phone':_0x23041d['phone'],'active':0x0,'OrderBy':_[_0xf669('0x2f')](_0x23041d[_0xf669('0x21')])?0x0:_0x23041d[_0xf669('0x21')],'scheduledat':moment()[_0xf669('0x31')](_0x28643c||0x1,_0xf669('0x32')),'countbusyretry':_0xa0656c[_0xf669('0x23')],'countcongestionretry':_0xa0656c['countcongestionretry'],'countnoanswerretry':_0xa0656c[_0xf669('0x25')],'countnosuchnumberretry':_0xa0656c[_0xf669('0x26')],'countdropretry':_0xa0656c['countdropretry'],'countabandonedretry':_0xa0656c[_0xf669('0x2b')],'countmachineretry':_0xa0656c[_0xf669('0x28')],'countagentrejectretry':_0xa0656c[_0xf669('0x29')],'createdAt':_0xa0656c[_0xf669('0x33')],'updatedAt':_0xa0656c[_0xf669('0x34')]};var _0x50e576={'CmHopperId':_0x23041d['id'],'phone':_0x503e7c[_0xf669('0x35')],'active':0x0,'OrderBy':_[_0xf669('0x2f')](_0x503e7c[_0xf669('0x21')])?0x0:_0x503e7c[_0xf669('0x21')],'scheduledat':_0x15206b,'countbusyretry':_0x503e7c[_0xf669('0x23')],'countcongestionretry':_0x503e7c['countcongestionretry'],'countnoanswerretry':_0x503e7c[_0xf669('0x25')],'countnosuchnumberretry':_0x503e7c[_0xf669('0x26')],'countdropretry':_0x503e7c[_0xf669('0x27')],'countabandonedretry':_0x503e7c[_0xf669('0x2b')],'countmachineretry':_0x503e7c[_0xf669('0x28')],'countagentrejectretry':_0x503e7c[_0xf669('0x29')],'createdAt':_0x503e7c[_0xf669('0x33')],'updatedAt':_0x503e7c[_0xf669('0x34')]};return db[_0xf669('0x36')][_0xf669('0x37')](function(_0x20bfa5){return db['CmHopperAdditionalPhone'][_0xf669('0x38')](_0x499647,{'where':{'id':_0x503e7c['id']}},{'transaction':_0x20bfa5})[_0xf669('0xd')](function(){return db['CmHopper'][_0xf669('0x38')](_0x50e576,{'where':{'id':_0x23041d['id']}},{'transaction':_0x20bfa5});});})['then'](function(_0x4ede90){_0x268ab1({'id':_0x23041d['id'],'phone':_0x503e7c[_0xf669('0x35')]});})[_0xf669('0x17')](function(_0x1e822f){logger[_0xf669('0x13')]('activateAdditionalPhone',_0x1e822f[_0xf669('0x15')]);_0x191e5d({'error':_0x1e822f[_0xf669('0x15')]});});});}exports['IncrementPreviewCounters']=function(_0x4c51bc){var _0xb118a6=this;return new Promise(function(_0x1e0078,_0x25f274){return db['CmHopper'][_0xf669('0x38')](_0x4c51bc[_0xf669('0x1a')]['field'],{'where':{'id':_0x4c51bc[_0xf669('0x1a')]['id']}})[_0xf669('0xd')](function(_0x30e831){_0x1e0078(_0x30e831);})['catch'](function(_0x306824){logger[_0xf669('0x13')](_0xf669('0x39'),_0x306824['message']);_0x25f274(_0xb118a6[_0xf669('0x13')](0x1f4,_0x306824[_0xf669('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index ddae127..0892262 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe06f=['/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index'];(function(_0x551597,_0x11e749){var _0x51dfed=function(_0x3f03d7){while(--_0x3f03d7){_0x551597['push'](_0x551597['shift']());}};_0x51dfed(++_0x11e749);}(_0xe06f,0x104));var _0xfe06=function(_0x459c5d,_0x57664a){_0x459c5d=_0x459c5d-0x0;var _0x8c65c2=_0xe06f[_0x459c5d];return _0x8c65c2;};'use strict';var multer=require('multer');var util=require(_0xfe06('0x0'));var path=require(_0xfe06('0x1'));var timeout=require(_0xfe06('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfe06('0x3'));var interaction=require(_0xfe06('0x4'));var config=require(_0xfe06('0x5'));var controller=require(_0xfe06('0x6'));router[_0xfe06('0x7')]('/',auth[_0xfe06('0x8')](),controller[_0xfe06('0x9')]);router[_0xfe06('0x7')](_0xfe06('0xa'),auth[_0xfe06('0x8')](),controller['show']);router[_0xfe06('0xb')]('/',auth['isAuthenticated'](),controller[_0xfe06('0xc')]);router[_0xfe06('0xd')](_0xfe06('0xa'),auth[_0xfe06('0x8')](),controller[_0xfe06('0xe')]);router[_0xfe06('0xf')](_0xfe06('0xa'),auth['isAuthenticated'](),controller[_0xfe06('0x10')]);module[_0xfe06('0x11')]=router; \ No newline at end of file +var _0xff16=['update','delete','/:id','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','post','create'];(function(_0x17c18a,_0x5a4bd6){var _0x3e5d54=function(_0x4e8cbe){while(--_0x4e8cbe){_0x17c18a['push'](_0x17c18a['shift']());}};_0x3e5d54(++_0x5a4bd6);}(_0xff16,0xd0));var _0x6ff1=function(_0x3ce04c,_0x1a0e7e){_0x3ce04c=_0x3ce04c-0x0;var _0x16d462=_0xff16[_0x3ce04c];return _0x16d462;};'use strict';var multer=require(_0x6ff1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6ff1('0x1'));var router=express[_0x6ff1('0x2')]();var fs_extra=require(_0x6ff1('0x3'));var auth=require(_0x6ff1('0x4'));var interaction=require(_0x6ff1('0x5'));var config=require(_0x6ff1('0x6'));var controller=require(_0x6ff1('0x7'));router['get']('/',auth[_0x6ff1('0x8')](),controller[_0x6ff1('0x9')]);router[_0x6ff1('0xa')]('/:id',auth[_0x6ff1('0x8')](),controller['show']);router[_0x6ff1('0xb')]('/',auth[_0x6ff1('0x8')](),controller[_0x6ff1('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6ff1('0xd')]);router[_0x6ff1('0xe')](_0x6ff1('0xf'),auth['isAuthenticated'](),controller[_0x6ff1('0x10')]);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 1e5f1b4..b3cd8cc 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 _0xdb8b=['INTEGER','contactListQueue','sequelize','exports','STRING'];(function(_0x101569,_0x37ca7a){var _0x35d65d=function(_0x12835b){while(--_0x12835b){_0x101569['push'](_0x101569['shift']());}};_0x35d65d(++_0x37ca7a);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x31711f,_0x2081c9){_0x31711f=_0x31711f-0x0;var _0x450320=_0xdb8b[_0x31711f];return _0x450320;};'use strict';var moment=require('moment');var Sequelize=require(_0xbdb8('0x0'));module[_0xbdb8('0x1')]={'phone':{'type':Sequelize[_0xbdb8('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xbdb8('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xbdb8('0x3')],'unique':_0xbdb8('0x4')}}; \ No newline at end of file +var _0x7722=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x7722,0x14e));var _0x2772=function(_0x4ca387,_0x8cfd80){_0x4ca387=_0x4ca387-0x0;var _0x581339=_0x7722[_0x4ca387];return _0x581339;};'use strict';var moment=require(_0x2772('0x0'));var Sequelize=require(_0x2772('0x1'));module[_0x2772('0x2')]={'phone':{'type':Sequelize[_0x2772('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2772('0x4')],'unique':_0x2772('0x5')},'ListId':{'type':Sequelize[_0x2772('0x4')],'unique':_0x2772('0x5')},'VoiceQueueId':{'type':Sequelize[_0x2772('0x4')],'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 5c4faa7..5ab207e 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 _0x7c7f=['body','find','params','catch','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','send','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','include','rows','show','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c7f,0x163));var _0xf7c7=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x7c7f[_0x29db36];return _0x234e87;};'use strict';var emlformat=require(_0xf7c7('0x0'));var rimraf=require(_0xf7c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7c7('0x2'));var moment=require(_0xf7c7('0x3'));var BPromise=require(_0xf7c7('0x4'));var Mustache=require('mustache');var util=require(_0xf7c7('0x5'));var path=require(_0xf7c7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7c7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf7c7('0x8'));var crypto=require(_0xf7c7('0x9'));var jsforce=require(_0xf7c7('0xa'));var deskjs=require(_0xf7c7('0xb'));var toCsv=require(_0xf7c7('0xc'));var querystring=require('querystring');var Papa=require(_0xf7c7('0xd'));var Redis=require('ioredis');var authService=require(_0xf7c7('0xe'));var qs=require(_0xf7c7('0xf'));var as=require(_0xf7c7('0x10'));var hardwareService=require(_0xf7c7('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf7c7('0x12'));var licenseUtil=require(_0xf7c7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f3a76,_0x12167c){_0x12167c=_0x12167c||0xcc;return function(_0x2c3313){if(_0x2c3313){return _0x5f3a76[_0xf7c7('0x14')](_0x12167c);}return _0x5f3a76[_0xf7c7('0x15')](_0x12167c)['end']();};}function respondWithResult(_0x571e83,_0x103442){_0x103442=_0x103442||0xc8;return function(_0x491988){if(_0x491988){return _0x571e83[_0xf7c7('0x15')](_0x103442)[_0xf7c7('0x16')](_0x491988);}};}function respondWithFilteredResult(_0x3888c7,_0x52fc80){return function(_0x9cd3d2){if(_0x9cd3d2){var _0x75f675=typeof _0x52fc80[_0xf7c7('0x17')]==='undefined'&&typeof _0x52fc80[_0xf7c7('0x18')]==='undefined';var _0x36de35=_0x9cd3d2[_0xf7c7('0x19')];var _0x553ac2=_0x75f675?0x0:_0x52fc80[_0xf7c7('0x17')];var _0x51b3f3=_0x75f675?_0x9cd3d2['count']:_0x52fc80[_0xf7c7('0x17')]+_0x52fc80[_0xf7c7('0x18')];var _0x54338a;if(_0x51b3f3>=_0x36de35){_0x51b3f3=_0x36de35;_0x54338a=0xc8;}else{_0x54338a=0xce;}_0x3888c7[_0xf7c7('0x15')](_0x54338a);return _0x3888c7[_0xf7c7('0x1a')](_0xf7c7('0x1b'),_0x553ac2+'-'+_0x51b3f3+'/'+_0x36de35)[_0xf7c7('0x16')](_0x9cd3d2);}return null;};}function patchUpdates(_0x32df10){return function(_0x1d9d8d){try{jsonpatch[_0xf7c7('0x1c')](_0x1d9d8d,_0x32df10,!![]);}catch(_0x3b6c6c){return BPromise[_0xf7c7('0x1d')](_0x3b6c6c);}return _0x1d9d8d[_0xf7c7('0x1e')]();};}function saveUpdates(_0xcf6819,_0x675424){return function(_0x233dcb){if(_0x233dcb){return _0x233dcb[_0xf7c7('0x1f')](_0xcf6819)[_0xf7c7('0x20')](function(_0x4638d8){return _0x4638d8;});}return null;};}function removeEntity(_0x48fd83,_0x5da18c){return function(_0x5cfed5){if(_0x5cfed5){return _0x5cfed5['destroy']()[_0xf7c7('0x20')](function(){_0x48fd83['status'](0xcc)[_0xf7c7('0x21')]();});}};}function handleEntityNotFound(_0x46fff5,_0x2f292c){return function(_0x148a6f){if(!_0x148a6f){_0x46fff5[_0xf7c7('0x14')](0x194);}return _0x148a6f;};}function handleError(_0x5e5d87,_0x28adcd){_0x28adcd=_0x28adcd||0x1f4;return function(_0x3370f0){logger[_0xf7c7('0x22')](_0x3370f0[_0xf7c7('0x23')]);if(_0x3370f0['name']){delete _0x3370f0['name'];}_0x5e5d87[_0xf7c7('0x15')](_0x28adcd)[_0xf7c7('0x24')](_0x3370f0);};}exports['index']=function(_0x212fae,_0x446350){var _0x21d90f={},_0x32fcef={},_0x2ddf40={'count':0x0,'rows':[]};var _0x20adee=_[_0xf7c7('0x25')](db[_0xf7c7('0x26')][_0xf7c7('0x27')],function(_0x490323){return{'name':_0x490323[_0xf7c7('0x28')],'type':_0x490323[_0xf7c7('0x29')]['key']};});_0x32fcef[_0xf7c7('0x2a')]=_[_0xf7c7('0x25')](_0x20adee,'name');_0x32fcef[_0xf7c7('0x2b')]=_[_0xf7c7('0x2c')](_0x212fae[_0xf7c7('0x2b')]);_0x32fcef['filters']=_[_0xf7c7('0x2d')](_0x32fcef[_0xf7c7('0x2a')],_0x32fcef[_0xf7c7('0x2b')]);_0x21d90f[_0xf7c7('0x2e')]=_[_0xf7c7('0x2d')](_0x32fcef['model'],qs[_0xf7c7('0x2f')](_0x212fae[_0xf7c7('0x2b')][_0xf7c7('0x2f')]));_0x21d90f[_0xf7c7('0x2e')]=_0x21d90f[_0xf7c7('0x2e')][_0xf7c7('0x30')]?_0x21d90f['attributes']:_0x32fcef[_0xf7c7('0x2a')];if(!_0x212fae[_0xf7c7('0x2b')][_0xf7c7('0x31')](_0xf7c7('0x32'))){_0x21d90f[_0xf7c7('0x18')]=qs['limit'](_0x212fae['query']['limit']);_0x21d90f[_0xf7c7('0x17')]=qs[_0xf7c7('0x17')](_0x212fae[_0xf7c7('0x2b')][_0xf7c7('0x17')]);}_0x21d90f[_0xf7c7('0x33')]=qs[_0xf7c7('0x34')](_0x212fae['query'][_0xf7c7('0x34')]);_0x21d90f[_0xf7c7('0x35')]=qs[_0xf7c7('0x36')](_[_0xf7c7('0x37')](_0x212fae[_0xf7c7('0x2b')],_0x32fcef[_0xf7c7('0x36')]),_0x20adee);if(_0x212fae['query'][_0xf7c7('0x38')]){_0x21d90f[_0xf7c7('0x35')]=_[_0xf7c7('0x39')](_0x21d90f['where'],{'$or':_[_0xf7c7('0x25')](_0x20adee,function(_0x3a74b6){if(_0x3a74b6[_0xf7c7('0x29')]!==_0xf7c7('0x3a')){var _0x183b1c={};_0x183b1c[_0x3a74b6[_0xf7c7('0x3b')]]={'$like':'%'+_0x212fae['query']['filter']+'%'};return _0x183b1c;}})});}_0x21d90f=_['merge']({},_0x21d90f,_0x212fae[_0xf7c7('0x3c')]);var _0x5df012={'where':_0x21d90f[_0xf7c7('0x35')]};return db[_0xf7c7('0x26')][_0xf7c7('0x19')](_0x5df012)[_0xf7c7('0x20')](function(_0x439455){_0x2ddf40[_0xf7c7('0x19')]=_0x439455;if(_0x212fae[_0xf7c7('0x2b')]['includeAll']){_0x21d90f[_0xf7c7('0x3d')]=[{'all':!![]}];}return db[_0xf7c7('0x26')]['findAll'](_0x21d90f);})[_0xf7c7('0x20')](function(_0x3a122a){_0x2ddf40[_0xf7c7('0x3e')]=_0x3a122a;return _0x2ddf40;})[_0xf7c7('0x20')](respondWithFilteredResult(_0x446350,_0x21d90f))['catch'](handleError(_0x446350,null));};exports[_0xf7c7('0x3f')]=function(_0x5379d9,_0x4365e1){var _0x4ffde0={'raw':!![],'where':{'id':_0x5379d9['params']['id']}},_0x2aa9fe={};_0x2aa9fe['model']=_[_0xf7c7('0x2c')](db['CmHopperBlack'][_0xf7c7('0x27')]);_0x2aa9fe[_0xf7c7('0x2b')]=_[_0xf7c7('0x2c')](_0x5379d9[_0xf7c7('0x2b')]);_0x2aa9fe[_0xf7c7('0x36')]=_['intersection'](_0x2aa9fe[_0xf7c7('0x2a')],_0x2aa9fe[_0xf7c7('0x2b')]);_0x4ffde0[_0xf7c7('0x2e')]=_[_0xf7c7('0x2d')](_0x2aa9fe[_0xf7c7('0x2a')],qs['fields'](_0x5379d9[_0xf7c7('0x2b')]['fields']));_0x4ffde0[_0xf7c7('0x2e')]=_0x4ffde0['attributes'][_0xf7c7('0x30')]?_0x4ffde0[_0xf7c7('0x2e')]:_0x2aa9fe[_0xf7c7('0x2a')];if(_0x5379d9[_0xf7c7('0x2b')][_0xf7c7('0x40')]){_0x4ffde0[_0xf7c7('0x3d')]=[{'all':!![]}];}_0x4ffde0=_[_0xf7c7('0x39')]({},_0x4ffde0,_0x5379d9[_0xf7c7('0x3c')]);return db[_0xf7c7('0x26')]['find'](_0x4ffde0)[_0xf7c7('0x20')](handleEntityNotFound(_0x4365e1,null))['then'](respondWithResult(_0x4365e1,null))['catch'](handleError(_0x4365e1,null));};exports[_0xf7c7('0x1f')]=function(_0x37d9e1,_0xd6aafa){if(_0x37d9e1[_0xf7c7('0x41')]['id']){delete _0x37d9e1[_0xf7c7('0x41')]['id'];}return db['CmHopperBlack'][_0xf7c7('0x42')]({'where':{'id':_0x37d9e1[_0xf7c7('0x43')]['id']}})['then'](handleEntityNotFound(_0xd6aafa,null))['then'](saveUpdates(_0x37d9e1['body'],null))[_0xf7c7('0x20')](respondWithResult(_0xd6aafa,null))[_0xf7c7('0x44')](handleError(_0xd6aafa,null));};exports['destroy']=function(_0x164971,_0x374737){return db[_0xf7c7('0x26')]['find']({'where':{'id':_0x164971[_0xf7c7('0x43')]['id']}})['then'](handleEntityNotFound(_0x374737,null))[_0xf7c7('0x20')](removeEntity(_0x374737,null))[_0xf7c7('0x44')](handleError(_0x374737,null));};exports[_0xf7c7('0x45')]=function(_0x222434,_0x4e617d){return db[_0xf7c7('0x26')][_0xf7c7('0x45')]()[_0xf7c7('0x20')](respondWithResult(_0x4e617d,null))[_0xf7c7('0x44')](handleError(_0x4e617d,null));}; \ No newline at end of file +var _0xbd6d=['save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','merge','includeAll','findAll','rows','catch','show','include','options','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd6d,0xc5));var _0xdbd6=function(_0xe33d82,_0x5e6a3e){_0xe33d82=_0xe33d82-0x0;var _0x3c8d54=_0xbd6d[_0xe33d82];return _0x3c8d54;};'use strict';var emlformat=require(_0xdbd6('0x0'));var rimraf=require(_0xdbd6('0x1'));var zipdir=require(_0xdbd6('0x2'));var jsonpatch=require(_0xdbd6('0x3'));var rp=require(_0xdbd6('0x4'));var moment=require('moment');var BPromise=require(_0xdbd6('0x5'));var Mustache=require(_0xdbd6('0x6'));var util=require(_0xdbd6('0x7'));var path=require(_0xdbd6('0x8'));var sox=require(_0xdbd6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbd6('0xa'));var _=require(_0xdbd6('0xb'));var squel=require(_0xdbd6('0xc'));var crypto=require(_0xdbd6('0xd'));var jsforce=require(_0xdbd6('0xe'));var deskjs=require(_0xdbd6('0xf'));var toCsv=require(_0xdbd6('0x10'));var querystring=require(_0xdbd6('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbd6('0x12'));var qs=require(_0xdbd6('0x13'));var as=require(_0xdbd6('0x14'));var hardwareService=require(_0xdbd6('0x15'));var logger=require(_0xdbd6('0x16'))(_0xdbd6('0x17'));var utils=require(_0xdbd6('0x18'));var config=require(_0xdbd6('0x19'));var licenseUtil=require(_0xdbd6('0x1a'));var db=require(_0xdbd6('0x1b'))['db'];function respondWithStatusCode(_0xe3e793,_0x11426f){_0x11426f=_0x11426f||0xcc;return function(_0x2783df){if(_0x2783df){return _0xe3e793[_0xdbd6('0x1c')](_0x11426f);}return _0xe3e793[_0xdbd6('0x1d')](_0x11426f)[_0xdbd6('0x1e')]();};}function respondWithResult(_0x20acdd,_0x6dd415){_0x6dd415=_0x6dd415||0xc8;return function(_0xd3bb74){if(_0xd3bb74){return _0x20acdd[_0xdbd6('0x1d')](_0x6dd415)[_0xdbd6('0x1f')](_0xd3bb74);}};}function respondWithFilteredResult(_0x277379,_0x65663){return function(_0x2dd6db){if(_0x2dd6db){var _0x217853=typeof _0x65663[_0xdbd6('0x20')]==='undefined'&&typeof _0x65663['limit']===_0xdbd6('0x21');var _0xd8a2e6=_0x2dd6db[_0xdbd6('0x22')];var _0x2e8f98=_0x217853?0x0:_0x65663[_0xdbd6('0x20')];var _0x24d18d=_0x217853?_0x2dd6db[_0xdbd6('0x22')]:_0x65663[_0xdbd6('0x20')]+_0x65663[_0xdbd6('0x23')];var _0x4c0cee;if(_0x24d18d>=_0xd8a2e6){_0x24d18d=_0xd8a2e6;_0x4c0cee=0xc8;}else{_0x4c0cee=0xce;}_0x277379[_0xdbd6('0x1d')](_0x4c0cee);return _0x277379[_0xdbd6('0x24')](_0xdbd6('0x25'),_0x2e8f98+'-'+_0x24d18d+'/'+_0xd8a2e6)['json'](_0x2dd6db);}return null;};}function patchUpdates(_0x5eaf33){return function(_0x56079a){try{jsonpatch[_0xdbd6('0x26')](_0x56079a,_0x5eaf33,!![]);}catch(_0x5dc9c2){return BPromise[_0xdbd6('0x27')](_0x5dc9c2);}return _0x56079a[_0xdbd6('0x28')]();};}function saveUpdates(_0x1be67a,_0x52bd7e){return function(_0xab5746){if(_0xab5746){return _0xab5746[_0xdbd6('0x29')](_0x1be67a)[_0xdbd6('0x2a')](function(_0x3d99c7){return _0x3d99c7;});}return null;};}function removeEntity(_0xc01849,_0x2af7ee){return function(_0x59ce84){if(_0x59ce84){return _0x59ce84[_0xdbd6('0x2b')]()['then'](function(){_0xc01849['status'](0xcc)[_0xdbd6('0x1e')]();});}};}function handleEntityNotFound(_0x41a557,_0x2622ce){return function(_0x88849d){if(!_0x88849d){_0x41a557[_0xdbd6('0x1c')](0x194);}return _0x88849d;};}function handleError(_0x4365ea,_0x1a9098){_0x1a9098=_0x1a9098||0x1f4;return function(_0xfedbc4){logger[_0xdbd6('0x2c')](_0xfedbc4[_0xdbd6('0x2d')]);if(_0xfedbc4[_0xdbd6('0x2e')]){delete _0xfedbc4[_0xdbd6('0x2e')];}_0x4365ea[_0xdbd6('0x1d')](_0x1a9098)[_0xdbd6('0x2f')](_0xfedbc4);};}exports[_0xdbd6('0x30')]=function(_0x565e69,_0x110031){var _0xf2f9b7={},_0x5861dc={},_0x577723={'count':0x0,'rows':[]};var _0x588d5c=_[_0xdbd6('0x31')](db[_0xdbd6('0x32')][_0xdbd6('0x33')],function(_0xf4e856){return{'name':_0xf4e856[_0xdbd6('0x34')],'type':_0xf4e856['type'][_0xdbd6('0x35')]};});_0x5861dc[_0xdbd6('0x36')]=_[_0xdbd6('0x31')](_0x588d5c,_0xdbd6('0x2e'));_0x5861dc[_0xdbd6('0x37')]=_[_0xdbd6('0x38')](_0x565e69[_0xdbd6('0x37')]);_0x5861dc['filters']=_[_0xdbd6('0x39')](_0x5861dc['model'],_0x5861dc[_0xdbd6('0x37')]);_0xf2f9b7[_0xdbd6('0x3a')]=_[_0xdbd6('0x39')](_0x5861dc[_0xdbd6('0x36')],qs[_0xdbd6('0x3b')](_0x565e69[_0xdbd6('0x37')][_0xdbd6('0x3b')]));_0xf2f9b7[_0xdbd6('0x3a')]=_0xf2f9b7[_0xdbd6('0x3a')][_0xdbd6('0x3c')]?_0xf2f9b7[_0xdbd6('0x3a')]:_0x5861dc[_0xdbd6('0x36')];if(!_0x565e69[_0xdbd6('0x37')]['hasOwnProperty']('nolimit')){_0xf2f9b7['limit']=qs[_0xdbd6('0x23')](_0x565e69[_0xdbd6('0x37')][_0xdbd6('0x23')]);_0xf2f9b7[_0xdbd6('0x20')]=qs[_0xdbd6('0x20')](_0x565e69[_0xdbd6('0x37')]['offset']);}_0xf2f9b7[_0xdbd6('0x3d')]=qs['sort'](_0x565e69[_0xdbd6('0x37')][_0xdbd6('0x3e')]);_0xf2f9b7[_0xdbd6('0x3f')]=qs['filters'](_[_0xdbd6('0x40')](_0x565e69[_0xdbd6('0x37')],_0x5861dc[_0xdbd6('0x41')]),_0x588d5c);if(_0x565e69[_0xdbd6('0x37')][_0xdbd6('0x42')]){_0xf2f9b7['where']=_[_0xdbd6('0x43')](_0xf2f9b7[_0xdbd6('0x3f')],{'$or':_[_0xdbd6('0x31')](_0x588d5c,function(_0xa2d2bc){if(_0xa2d2bc['type']!=='VIRTUAL'){var _0x29541b={};_0x29541b[_0xa2d2bc[_0xdbd6('0x2e')]]={'$like':'%'+_0x565e69[_0xdbd6('0x37')][_0xdbd6('0x42')]+'%'};return _0x29541b;}})});}_0xf2f9b7=_['merge']({},_0xf2f9b7,_0x565e69['options']);var _0x33dce9={'where':_0xf2f9b7['where']};return db[_0xdbd6('0x32')][_0xdbd6('0x22')](_0x33dce9)[_0xdbd6('0x2a')](function(_0xc382a1){_0x577723['count']=_0xc382a1;if(_0x565e69[_0xdbd6('0x37')][_0xdbd6('0x44')]){_0xf2f9b7['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xdbd6('0x45')](_0xf2f9b7);})[_0xdbd6('0x2a')](function(_0x1f3ce1){_0x577723[_0xdbd6('0x46')]=_0x1f3ce1;return _0x577723;})['then'](respondWithFilteredResult(_0x110031,_0xf2f9b7))[_0xdbd6('0x47')](handleError(_0x110031,null));};exports[_0xdbd6('0x48')]=function(_0x1282dd,_0x53f80d){var _0x17fd57={'raw':!![],'where':{'id':_0x1282dd['params']['id']}},_0x35a752={};_0x35a752['model']=_[_0xdbd6('0x38')](db[_0xdbd6('0x32')][_0xdbd6('0x33')]);_0x35a752['query']=_[_0xdbd6('0x38')](_0x1282dd[_0xdbd6('0x37')]);_0x35a752['filters']=_[_0xdbd6('0x39')](_0x35a752[_0xdbd6('0x36')],_0x35a752[_0xdbd6('0x37')]);_0x17fd57[_0xdbd6('0x3a')]=_[_0xdbd6('0x39')](_0x35a752['model'],qs[_0xdbd6('0x3b')](_0x1282dd[_0xdbd6('0x37')][_0xdbd6('0x3b')]));_0x17fd57['attributes']=_0x17fd57['attributes'][_0xdbd6('0x3c')]?_0x17fd57[_0xdbd6('0x3a')]:_0x35a752[_0xdbd6('0x36')];if(_0x1282dd[_0xdbd6('0x37')]['includeAll']){_0x17fd57[_0xdbd6('0x49')]=[{'all':!![]}];}_0x17fd57=_['merge']({},_0x17fd57,_0x1282dd[_0xdbd6('0x4a')]);return db['CmHopperBlack']['find'](_0x17fd57)['then'](handleEntityNotFound(_0x53f80d,null))['then'](respondWithResult(_0x53f80d,null))[_0xdbd6('0x47')](handleError(_0x53f80d,null));};exports[_0xdbd6('0x29')]=function(_0x378bdc,_0x2528a9){if(_0x378bdc[_0xdbd6('0x4b')]['id']){delete _0x378bdc[_0xdbd6('0x4b')]['id'];}return db[_0xdbd6('0x32')][_0xdbd6('0x4c')]({'where':{'id':_0x378bdc[_0xdbd6('0x4d')]['id']}})[_0xdbd6('0x2a')](handleEntityNotFound(_0x2528a9,null))['then'](saveUpdates(_0x378bdc[_0xdbd6('0x4b')],null))['then'](respondWithResult(_0x2528a9,null))[_0xdbd6('0x47')](handleError(_0x2528a9,null));};exports[_0xdbd6('0x2b')]=function(_0x4fbfdb,_0x309f54){return db[_0xdbd6('0x32')][_0xdbd6('0x4c')]({'where':{'id':_0x4fbfdb[_0xdbd6('0x4d')]['id']}})[_0xdbd6('0x2a')](handleEntityNotFound(_0x309f54,null))[_0xdbd6('0x2a')](removeEntity(_0x309f54,null))['catch'](handleError(_0x309f54,null));};exports[_0xdbd6('0x4e')]=function(_0x464d9d,_0x2fefb5){return db['CmHopperBlack'][_0xdbd6('0x4e')]()[_0xdbd6('0x2a')](respondWithResult(_0x2fefb5,null))['catch'](handleError(_0x2fefb5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 7771223..1211bdd 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 _0x6770=['cm_hopper_black','util','../../config/logger','api','bluebird','request-promise','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x2f8177,_0x1bb2a9){var _0x249cb4=function(_0x22929f){while(--_0x22929f){_0x2f8177['push'](_0x2f8177['shift']());}};_0x249cb4(++_0x1bb2a9);}(_0x6770,0x90));var _0x0677=function(_0x590b57,_0x56732b){_0x590b57=_0x590b57-0x0;var _0x535584=_0x6770[_0x590b57];return _0x535584;};'use strict';var _=require('lodash');var util=require(_0x0677('0x0'));var logger=require(_0x0677('0x1'))(_0x0677('0x2'));var moment=require('moment');var BPromise=require(_0x0677('0x3'));var rp=require(_0x0677('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0677('0x5'));var config=require('../../config/environment');var attributes=require(_0x0677('0x6'));module[_0x0677('0x7')]=function(_0x369c05,_0x2fb1f5){return _0x369c05[_0x0677('0x8')](_0x0677('0x9'),attributes,{'tableName':_0x0677('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ea6=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black'];(function(_0x2c4da8,_0x3c3ef5){var _0x555447=function(_0x3bed28){while(--_0x3bed28){_0x2c4da8['push'](_0x2c4da8['shift']());}};_0x555447(++_0x3c3ef5);}(_0x4ea6,0xe6));var _0x64ea=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x4ea6[_0x58a4ac];return _0x545810;};'use strict';var _=require('lodash');var util=require(_0x64ea('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x64ea('0x1'));var BPromise=require(_0x64ea('0x2'));var rp=require(_0x64ea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64ea('0x4'));var config=require(_0x64ea('0x5'));var attributes=require(_0x64ea('0x6'));module[_0x64ea('0x7')]=function(_0xda82c4,_0x494b25){return _0xda82c4['define'](_0x64ea('0x8'),attributes,{'tableName':_0x64ea('0x9'),'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 3d55bae..72da9bd 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 _0x9614=['client','http','request','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','model','map','then','UpdateCmHopperBlack','limit','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x53f323,_0x11151d){var _0xc58489=function(_0x4e6ee5){while(--_0x4e6ee5){_0x53f323['push'](_0x53f323['shift']());}};_0xc58489(++_0x11151d);}(_0x9614,0x13d));var _0x4961=function(_0x1fe7bf,_0x24493f){_0x1fe7bf=_0x1fe7bf-0x0;var _0x340e1f=_0x9614[_0x1fe7bf];return _0x340e1f;};'use strict';var _=require(_0x4961('0x0'));var util=require('util');var moment=require(_0x4961('0x1'));var BPromise=require(_0x4961('0x2'));var rs=require(_0x4961('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4961('0x4'))(_0x4961('0x5'));var config=require(_0x4961('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4961('0x7')][_0x4961('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x333ad3,_0x505611,_0x3b0403){return new BPromise(function(_0x241ce0,_0x22e307){return client[_0x4961('0x9')](_0x333ad3,_0x3b0403)['then'](function(_0xdb9e5a){logger[_0x4961('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x505611,_0x4961('0xb'));logger[_0x4961('0xc')](_0x4961('0xd'),_0x505611,_0x4961('0xb'),JSON[_0x4961('0xe')](_0xdb9e5a));if(_0xdb9e5a[_0x4961('0xf')]){if(_0xdb9e5a[_0x4961('0xf')][_0x4961('0x10')]===0x1f4){logger[_0x4961('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x505611,_0xdb9e5a[_0x4961('0xf')]['message']);return _0x22e307(_0xdb9e5a[_0x4961('0xf')][_0x4961('0x11')]);}logger[_0x4961('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x505611,_0xdb9e5a[_0x4961('0xf')]['message']);return _0x241ce0(_0xdb9e5a[_0x4961('0xf')]['message']);}else{logger[_0x4961('0xa')](_0x4961('0x12'),_0x505611,_0x4961('0xb'));_0x241ce0(_0xdb9e5a[_0x4961('0x13')]['message']);}})[_0x4961('0x14')](function(_0x335895){logger[_0x4961('0xf')](_0x4961('0x12'),_0x505611,_0x335895);_0x22e307(_0x335895);});});}exports[_0x4961('0x15')]=function(_0x37546e){var _0x50d15d=this;return new Promise(function(_0x2a0e3c,_0x24fcf8){return db[_0x4961('0x16')][_0x4961('0x17')]({'raw':_0x37546e[_0x4961('0x18')]?_0x37546e[_0x4961('0x18')][_0x4961('0x19')]===undefined?!![]:![]:!![],'where':_0x37546e['options']?_0x37546e[_0x4961('0x18')][_0x4961('0x1a')]||null:null,'attributes':_0x37546e[_0x4961('0x18')]?_0x37546e['options'][_0x4961('0x1b')]||null:null,'limit':_0x37546e[_0x4961('0x18')]?_0x37546e[_0x4961('0x18')]['limit']||null:null,'include':_0x37546e[_0x4961('0x18')]?_0x37546e[_0x4961('0x18')][_0x4961('0x1c')]?_['map'](_0x37546e[_0x4961('0x18')][_0x4961('0x1c')],function(_0x81a537){return{'model':db[_0x81a537[_0x4961('0x1d')]],'as':_0x81a537['as'],'attributes':_0x81a537['attributes'],'include':_0x81a537[_0x4961('0x1c')]?_[_0x4961('0x1e')](_0x81a537['include'],function(_0x4dd75a){return{'model':db[_0x4dd75a[_0x4961('0x1d')]],'as':_0x4dd75a['as'],'attributes':_0x4dd75a['attributes'],'include':_0x4dd75a[_0x4961('0x1c')]?_[_0x4961('0x1e')](_0x4dd75a['include'],function(_0x574c65){return{'model':db[_0x574c65[_0x4961('0x1d')]],'as':_0x574c65['as'],'attributes':_0x574c65[_0x4961('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4961('0x1f')](function(_0x42d977){logger[_0x4961('0xa')](_0x4961('0x15'),_0x37546e);logger[_0x4961('0xc')](_0x4961('0x15'),_0x37546e,JSON['stringify'](_0x42d977));_0x2a0e3c(_0x42d977);})['catch'](function(_0x470639){logger[_0x4961('0xf')](_0x4961('0x15'),_0x470639[_0x4961('0x11')],_0x37546e);_0x24fcf8(_0x50d15d[_0x4961('0xf')](0x1f4,_0x470639[_0x4961('0x11')]));});});};exports[_0x4961('0x20')]=function(_0x6ae4de){var _0x11d027=this;return new Promise(function(_0x5cf639,_0x31f653){return db[_0x4961('0x16')]['update'](_0x6ae4de['body'],{'raw':_0x6ae4de['options']?_0x6ae4de['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6ae4de[_0x4961('0x18')]?_0x6ae4de[_0x4961('0x18')][_0x4961('0x1a')]||null:null,'attributes':_0x6ae4de[_0x4961('0x18')]?_0x6ae4de['options'][_0x4961('0x1b')]||null:null,'limit':_0x6ae4de[_0x4961('0x18')]?_0x6ae4de[_0x4961('0x18')][_0x4961('0x21')]||null:null})[_0x4961('0x1f')](function(_0x4a6e2e){logger[_0x4961('0xa')](_0x4961('0x20'),_0x6ae4de);logger['debug'](_0x4961('0x20'),_0x6ae4de,JSON[_0x4961('0xe')](_0x4a6e2e));_0x5cf639(_0x4a6e2e);})[_0x4961('0x14')](function(_0xee5c87){logger[_0x4961('0xf')]('UpdateCmHopperBlack',_0xee5c87[_0x4961('0x11')],_0x6ae4de);_0x31f653(_0x11d027[_0x4961('0xf')](0x1f4,_0xee5c87[_0x4961('0x11')]));});});};exports[_0x4961('0x22')]=function(_0x45bf13){var _0x274985=this;return new Promise(function(_0x1eae8a,_0x456a96){return db[_0x4961('0x16')][_0x4961('0x23')]({'where':_0x45bf13[_0x4961('0x18')]?_0x45bf13[_0x4961('0x18')][_0x4961('0x1a')]||null:null})['then'](function(_0xd4c86d){logger[_0x4961('0xa')](_0x4961('0x22'),_0x45bf13);logger['debug'](_0x4961('0x22'),_0x45bf13,JSON[_0x4961('0xe')](_0xd4c86d));_0x1eae8a(_0xd4c86d);})['catch'](function(_0x4017ad){logger['error'](_0x4961('0x22'),_0x4017ad[_0x4961('0x11')],_0x45bf13);_0x456a96(_0x274985[_0x4961('0xf')](0x1f4,_0x4017ad[_0x4961('0x11')]));});});}; \ No newline at end of file +var _0xa0f1=['attributes','include','map','model','GetCmHopperBlack','update','body','where','limit','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','options','raw'];(function(_0x1c6a50,_0x380d41){var _0x22b9ce=function(_0x10f1bf){while(--_0x10f1bf){_0x1c6a50['push'](_0x1c6a50['shift']());}};_0x22b9ce(++_0x380d41);}(_0xa0f1,0x198));var _0x1a0f=function(_0x443a8d,_0x57fd16){_0x443a8d=_0x443a8d-0x0;var _0x1f2adc=_0xa0f1[_0x443a8d];return _0x1f2adc;};'use strict';var _=require('lodash');var util=require(_0x1a0f('0x0'));var moment=require(_0x1a0f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a0f('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a0f('0x3'))(_0x1a0f('0x4'));var config=require(_0x1a0f('0x5'));var jayson=require(_0x1a0f('0x6'));var client=jayson[_0x1a0f('0x7')][_0x1a0f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11e9c9,_0x42e6e3,_0x21458a){return new BPromise(function(_0x3ffebd,_0x2691e0){return client[_0x1a0f('0x9')](_0x11e9c9,_0x21458a)[_0x1a0f('0xa')](function(_0x1f003f){logger['info'](_0x1a0f('0xb'),_0x42e6e3,_0x1a0f('0xc'));logger[_0x1a0f('0xd')](_0x1a0f('0xe'),_0x42e6e3,_0x1a0f('0xc'),JSON[_0x1a0f('0xf')](_0x1f003f));if(_0x1f003f['error']){if(_0x1f003f[_0x1a0f('0x10')][_0x1a0f('0x11')]===0x1f4){logger['error'](_0x1a0f('0xb'),_0x42e6e3,_0x1f003f[_0x1a0f('0x10')]['message']);return _0x2691e0(_0x1f003f[_0x1a0f('0x10')]['message']);}logger[_0x1a0f('0x10')](_0x1a0f('0xb'),_0x42e6e3,_0x1f003f[_0x1a0f('0x10')][_0x1a0f('0x12')]);return _0x3ffebd(_0x1f003f[_0x1a0f('0x10')][_0x1a0f('0x12')]);}else{logger[_0x1a0f('0x13')](_0x1a0f('0xb'),_0x42e6e3,_0x1a0f('0xc'));_0x3ffebd(_0x1f003f[_0x1a0f('0x14')][_0x1a0f('0x12')]);}})[_0x1a0f('0x15')](function(_0x558350){logger[_0x1a0f('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x42e6e3,_0x558350);_0x2691e0(_0x558350);});});}exports['GetCmHopperBlack']=function(_0x211532){var _0x58181f=this;return new Promise(function(_0x24d037,_0x376c16){return db['CmHopperBlack']['findAll']({'raw':_0x211532[_0x1a0f('0x16')]?_0x211532[_0x1a0f('0x16')][_0x1a0f('0x17')]===undefined?!![]:![]:!![],'where':_0x211532[_0x1a0f('0x16')]?_0x211532[_0x1a0f('0x16')]['where']||null:null,'attributes':_0x211532[_0x1a0f('0x16')]?_0x211532['options'][_0x1a0f('0x18')]||null:null,'limit':_0x211532[_0x1a0f('0x16')]?_0x211532[_0x1a0f('0x16')]['limit']||null:null,'include':_0x211532['options']?_0x211532[_0x1a0f('0x16')][_0x1a0f('0x19')]?_[_0x1a0f('0x1a')](_0x211532['options'][_0x1a0f('0x19')],function(_0x5efc86){return{'model':db[_0x5efc86[_0x1a0f('0x1b')]],'as':_0x5efc86['as'],'attributes':_0x5efc86[_0x1a0f('0x18')],'include':_0x5efc86['include']?_[_0x1a0f('0x1a')](_0x5efc86['include'],function(_0x2e86e8){return{'model':db[_0x2e86e8[_0x1a0f('0x1b')]],'as':_0x2e86e8['as'],'attributes':_0x2e86e8[_0x1a0f('0x18')],'include':_0x2e86e8[_0x1a0f('0x19')]?_['map'](_0x2e86e8[_0x1a0f('0x19')],function(_0x3e1a74){return{'model':db[_0x3e1a74[_0x1a0f('0x1b')]],'as':_0x3e1a74['as'],'attributes':_0x3e1a74[_0x1a0f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1a0f('0xa')](function(_0x3571db){logger['info'](_0x1a0f('0x1c'),_0x211532);logger[_0x1a0f('0xd')](_0x1a0f('0x1c'),_0x211532,JSON[_0x1a0f('0xf')](_0x3571db));_0x24d037(_0x3571db);})[_0x1a0f('0x15')](function(_0x46ce39){logger[_0x1a0f('0x10')](_0x1a0f('0x1c'),_0x46ce39[_0x1a0f('0x12')],_0x211532);_0x376c16(_0x58181f[_0x1a0f('0x10')](0x1f4,_0x46ce39[_0x1a0f('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x3a7dfa){var _0x5020e7=this;return new Promise(function(_0x2c3cf0,_0x39555a){return db['CmHopperBlack'][_0x1a0f('0x1d')](_0x3a7dfa[_0x1a0f('0x1e')],{'raw':_0x3a7dfa[_0x1a0f('0x16')]?_0x3a7dfa[_0x1a0f('0x16')][_0x1a0f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a7dfa[_0x1a0f('0x16')]?_0x3a7dfa['options'][_0x1a0f('0x1f')]||null:null,'attributes':_0x3a7dfa[_0x1a0f('0x16')]?_0x3a7dfa['options']['attributes']||null:null,'limit':_0x3a7dfa[_0x1a0f('0x16')]?_0x3a7dfa[_0x1a0f('0x16')][_0x1a0f('0x20')]||null:null})[_0x1a0f('0xa')](function(_0x10ee48){logger[_0x1a0f('0x13')](_0x1a0f('0x21'),_0x3a7dfa);logger[_0x1a0f('0xd')]('UpdateCmHopperBlack',_0x3a7dfa,JSON[_0x1a0f('0xf')](_0x10ee48));_0x2c3cf0(_0x10ee48);})[_0x1a0f('0x15')](function(_0x53b410){logger['error']('UpdateCmHopperBlack',_0x53b410[_0x1a0f('0x12')],_0x3a7dfa);_0x39555a(_0x5020e7[_0x1a0f('0x10')](0x1f4,_0x53b410[_0x1a0f('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x38f3ce){var _0xbf8a9c=this;return new Promise(function(_0x4fe627,_0x4f36bb){return db['CmHopperBlack'][_0x1a0f('0x22')]({'where':_0x38f3ce[_0x1a0f('0x16')]?_0x38f3ce['options'][_0x1a0f('0x1f')]||null:null})[_0x1a0f('0xa')](function(_0x6412c9){logger[_0x1a0f('0x13')](_0x1a0f('0x23'),_0x38f3ce);logger[_0x1a0f('0xd')]('DestroyCmHopperBlack',_0x38f3ce,JSON[_0x1a0f('0xf')](_0x6412c9));_0x4fe627(_0x6412c9);})['catch'](function(_0x497bce){logger[_0x1a0f('0x10')](_0x1a0f('0x23'),_0x497bce[_0x1a0f('0x12')],_0x38f3ce);_0x4f36bb(_0xbf8a9c[_0x1a0f('0x10')](0x1f4,_0x497bce['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 1840171..7657410 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 _0xeff8=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','update','exports','multer'];(function(_0x8994e1,_0x45a361){var _0x3d17c1=function(_0x55a70e){while(--_0x55a70e){_0x8994e1['push'](_0x8994e1['shift']());}};_0x3d17c1(++_0x45a361);}(_0xeff8,0x186));var _0x8eff=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xeff8[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get']('/',auth[_0x8eff('0x9')](),controller[_0x8eff('0xa')]);router[_0x8eff('0xb')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xb')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['show']);router['put'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller[_0x8eff('0xf')]);router['delete'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['destroy']);module[_0x8eff('0x10')]=router; \ No newline at end of file +var _0x6050=['/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','describe','get'];(function(_0x3df332,_0x592dde){var _0x2c094f=function(_0x2e278d){while(--_0x2e278d){_0x3df332['push'](_0x3df332['shift']());}};_0x2c094f(++_0x592dde);}(_0x6050,0x196));var _0x0605=function(_0x195ee8,_0x5b1d54){_0x195ee8=_0x195ee8-0x0;var _0x25d95e=_0x6050[_0x195ee8];return _0x25d95e;};'use strict';var multer=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var path=require(_0x0605('0x2'));var timeout=require(_0x0605('0x3'));var express=require(_0x0605('0x4'));var router=express[_0x0605('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0605('0x6'));var interaction=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0605('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0605('0xa')]);router[_0x0605('0xb')](_0x0605('0xc'),auth[_0x0605('0xd')](),controller[_0x0605('0xe')]);router['put'](_0x0605('0xc'),auth[_0x0605('0xd')](),controller[_0x0605('0xf')]);router[_0x0605('0x10')](_0x0605('0xc'),auth[_0x0605('0xd')](),controller[_0x0605('0x11')]);module[_0x0605('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 2d0856d..93f90e8 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 _0x8bc3=['getDataValue','endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x28a77c,_0x34d3d8){var _0x407cb0=function(_0x199588){while(--_0x199588){_0x28a77c['push'](_0x28a77c['shift']());}};_0x407cb0(++_0x34d3d8);}(_0x8bc3,0x1aa));var _0x38bc=function(_0x3e449b,_0x4db44f){_0x3e449b=_0x3e449b-0x0;var _0x15ae82=_0x8bc3[_0x3e449b];return _0x15ae82;};'use strict';var Sequelize=require(_0x38bc('0x0'));var moment=require(_0x38bc('0x1'));module[_0x38bc('0x2')]={'state':{'type':Sequelize[_0x38bc('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x38bc('0x4')]},'scheduledat':{'type':Sequelize[_0x38bc('0x5')]},'countbusyretry':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x38bc('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x38bc('0x4')]},'calleridname':{'type':Sequelize[_0x38bc('0x4')]},'starttime':{'type':Sequelize[_0x38bc('0x5')]},'responsetime':{'type':Sequelize[_0x38bc('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x38bc('0x5')]},'endtime':{'type':Sequelize[_0x38bc('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x38bc('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x38bc('0x4')]},'disposition':{'type':Sequelize[_0x38bc('0x4')]},'secondDisposition':{'type':Sequelize[_0x38bc('0x4')]},'thirdDisposition':{'type':Sequelize[_0x38bc('0x4')]},'dispositionat':{'type':Sequelize[_0x38bc('0x5')],'set':function(_0x31c076){var _0x33e781=this[_0x38bc('0x6')](_0x38bc('0x7'));if(_0x33e781&&_0x31c076){this['setDataValue'](_0x38bc('0x8'),moment(_0x31c076)[_0x38bc('0x9')](moment(_0x33e781),_0x38bc('0xa')));}}},'amd':{'type':Sequelize[_0x38bc('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x38bc('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x38bc('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x38bc('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x38bc('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x38bc('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x38bc('0x5')]},'deleted':{'type':Sequelize[_0x38bc('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x38bc('0x5')]},'recallme':{'type':Sequelize[_0x38bc('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x38bc('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x38bc('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc02f=['BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc02f,0x1c9));var _0xfc02=function(_0x34edb4,_0xc66aca){_0x34edb4=_0x34edb4-0x0;var _0x85288c=_0xc02f[_0x34edb4];return _0x85288c;};'use strict';var Sequelize=require(_0xfc02('0x0'));var moment=require(_0xfc02('0x1'));module['exports']={'state':{'type':Sequelize[_0xfc02('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xfc02('0x3')]},'scheduledat':{'type':Sequelize[_0xfc02('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfc02('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfc02('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfc02('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xfc02('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfc02('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xfc02('0x4')]},'answertime':{'type':Sequelize[_0xfc02('0x4')]},'droptime':{'type':Sequelize[_0xfc02('0x4')]},'endtime':{'type':Sequelize[_0xfc02('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfc02('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfc02('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfc02('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfc02('0x3')]},'campaign':{'type':Sequelize[_0xfc02('0x3')]},'campaigntype':{'type':Sequelize[_0xfc02('0x3')]},'membername':{'type':Sequelize[_0xfc02('0x3')]},'reason':{'type':Sequelize[_0xfc02('0x3')]},'disposition':{'type':Sequelize[_0xfc02('0x3')]},'secondDisposition':{'type':Sequelize[_0xfc02('0x3')]},'thirdDisposition':{'type':Sequelize[_0xfc02('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x586991){var _0xa7fa11=this[_0xfc02('0x5')](_0xfc02('0x6'));if(_0xa7fa11&&_0x586991){this[_0xfc02('0x7')](_0xfc02('0x8'),moment(_0x586991)[_0xfc02('0x9')](moment(_0xa7fa11),_0xfc02('0xa')));}}},'amd':{'type':Sequelize[_0xfc02('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfc02('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xfc02('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xfc02('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xfc02('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfc02('0x4')]},'deleted':{'type':Sequelize[_0xfc02('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xfc02('0x4')]},'recallme':{'type':Sequelize[_0xfc02('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xfc02('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xfc02('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfc02('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfc02('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfc02('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 806d46e..788bdcf 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 _0x4137=['squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','literal','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['CmHopperFinal'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['describe']=function(_0x513657,_0x3c1f1a){return db['CmHopperFinal']['describe']()[_0x7413('0x25')](respondWithResult(_0x3c1f1a,null))[_0x7413('0x47')](handleError(_0x3c1f1a,null));};exports['update']=function(_0x2aa12c,_0x586d25){if(_0x2aa12c['body'][_0x7413('0x48')]){delete _0x2aa12c['body'][_0x7413('0x48')];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'uniqueid':_0x2aa12c[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x586d25,null))[_0x7413('0x25')](saveUpdates(_0x2aa12c[_0x7413('0x49')],null))[_0x7413('0x25')](respondWithResult(_0x586d25,null))[_0x7413('0x47')](handleError(_0x586d25,null));};exports[_0x7413('0x4a')]=function(_0x50a27d,_0x369891,_0x501407){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x50a27d[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x4d')))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x51')))),_0x7413('0x52')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x55')))),'abandonedContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x369891,null))[_0x7413('0x25')](respondWithResult(_0x369891,null))[_0x7413('0x47')](handleError(_0x369891,null));};exports[_0x7413('0x5a')]=function(_0x28130e,_0x593571,_0x35f7e8){return db['CmHopperFinal'][_0x7413('0x41')]({'raw':![],'where':{'CampaignId':_0x28130e[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x5b')))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x51')))),'congestionContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7413('0x5c')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x593571,null))[_0x7413('0x25')](respondWithResult(_0x593571,null))[_0x7413('0x47')](handleError(_0x593571,null));};exports[_0x7413('0x5d')]=function(_0x2c504e,_0x50910a,_0x5988bd){return db[_0x7413('0x5e')]['find']({'where':{'id':_0x2c504e[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x50910a,null))['then'](function(_0x2be9b1){var _0x4b676a;if(_0x2be9b1){_0x4b676a=squel[_0x7413('0x5f')]()[_0x7413('0x60')]('cm_hopper')['fromQuery']([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),'ListId',_0x7413('0x64'),_0x7413('0x65'),_0x7413('0x66')],squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x69'),'phone')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x62'))['field'](_0x7413('0x6b'),_0x7413('0x63'))[_0x7413('0x68')](_0x7413('0x6c'),_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x6e'),_0x7413('0x64'))[_0x7413('0x68')]('NOW()',_0x7413('0x65'))[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x71'),_0x2c504e['params']['id']['toString']())[_0x7413('0x3b')](_0x7413('0x72'),_0x2c504e['body'][_0x7413('0x73')][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('phone')[_0x7413('0x6f')]('cm_hopper')[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x77'))[_0x7413('0x6f')](_0x7413('0x70'))[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]())[_0x7413('0x3b')]('state\x20=\x204'))['group']('ContactId'))[_0x7413('0x74')]();return db['sequelize'][_0x7413('0x32')](_0x4b676a);}return[];})[_0x7413('0x25')](respondWithResult(_0x50910a,null))[_0x7413('0x47')](handleError(_0x50910a,null));};exports[_0x7413('0x78')]=function(_0x470c21,_0x17c115,_0xbba3c7){return db[_0x7413('0x79')][_0x7413('0x46')]({'where':{'id':_0x470c21['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x17c115,null))[_0x7413('0x25')](function(_0x38bb4e){var _0x4ea60e;if(_0x38bb4e){_0x4ea60e=squel[_0x7413('0x5f')]()[_0x7413('0x60')](_0x7413('0x7a'))[_0x7413('0x7b')]([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),_0x7413('0x6d'),_0x7413('0x7c'),_0x7413('0x65'),'updatedAt'],squel[_0x7413('0x67')]()[_0x7413('0x68')]('ANY_VALUE(calleridnum)',_0x7413('0x61'))[_0x7413('0x68')]('NOW()',_0x7413('0x62'))[_0x7413('0x68')](_0x7413('0x6b'),'ContactId')[_0x7413('0x68')]('ANY_VALUE(ListId)',_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x7d'),_0x7413('0x7c'))[_0x7413('0x68')](_0x7413('0x6a'),'createdAt')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x72'),_0x470c21['body']['state'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x7413('0x68')](_0x7413('0x61'))[_0x7413('0x6f')]('cm_hopper')['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('calleridnum')['from'](_0x7413('0x70'))[_0x7413('0x3b')]('CampaignId\x20=\x20?',_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x7f')))[_0x7413('0x80')](_0x7413('0x63')))[_0x7413('0x74')]();return db[_0x7413('0x4b')][_0x7413('0x32')](_0x4ea60e);}return[];})['then'](respondWithResult(_0x17c115,null))[_0x7413('0x47')](handleError(_0x17c115,null));};exports[_0x7413('0x81')]=function(_0x59d665,_0x1f3e26,_0xccd480){return db[_0x7413('0x82')]['findOne']({'where':{'VoiceQueueId':_0x59d665['body']['VoiceQueueId'],'CampaignId':_0x59d665[_0x7413('0x49')][_0x7413('0x7c')],'ContactId':_0x59d665[_0x7413('0x49')][_0x7413('0x63')]}})[_0x7413('0x25')](handleEntityNotFound(_0x1f3e26,null))[_0x7413('0x25')](function(_0x207293){if(_0x207293){return _0x207293;}return null;})[_0x7413('0x25')](respondWithResult(_0x1f3e26,null))['catch'](handleError(_0x1f3e26,null));}; \ No newline at end of file +var _0x5496=['set','Content-Range','apply','reject','save','update','then','error','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','dropContacts','abandonedContacts','reCallContacts','answeringMachine','into','cm_hopper','fromQuery','ListId','VoiceQueueId','createdAt','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count'];(function(_0x4b0e75,_0x23cb6d){var _0x2a8111=function(_0x54f8eb){while(--_0x54f8eb){_0x4b0e75['push'](_0x4b0e75['shift']());}};_0x2a8111(++_0x23cb6d);}(_0x5496,0x175));var _0x6549=function(_0x2f3fcc,_0x1d9dc0){_0x2f3fcc=_0x2f3fcc-0x0;var _0x422fd0=_0x5496[_0x2f3fcc];return _0x422fd0;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':!![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['describe']()[_0x6549('0x26')](respondWithResult(_0x1712f3,null))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0x6121af,_0xa4c650){if(_0x6121af[_0x6549('0x4c')][_0x6549('0x4d')]){delete _0x6121af[_0x6549('0x4c')]['uniqueid'];}return db[_0x6549('0x2b')]['find']({'where':{'uniqueid':_0x6121af[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0xa4c650,null))[_0x6549('0x26')](saveUpdates(_0x6121af['body'],null))[_0x6549('0x26')](respondWithResult(_0xa4c650,null))[_0x6549('0x43')](handleError(_0xa4c650,null));};exports[_0x6549('0x4e')]=function(_0x5300c8,_0x19ac50,_0x17d7ce){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x5300c8[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn']('COUNT',db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x52')))),_0x6549('0x53')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x55')))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x57')))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),'dropContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5c')))),'abandonedContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5d')))),'reCallContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x5e')))),'answeringMachine']]})[_0x6549('0x26')](handleEntityNotFound(_0x19ac50,null))[_0x6549('0x26')](respondWithResult(_0x19ac50,null))[_0x6549('0x43')](handleError(_0x19ac50,null));};exports[_0x6549('0x5f')]=function(_0x2da535,_0x45eb28,_0x3b01d9){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'CampaignId':_0x2da535[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x52')))),_0x6549('0x53')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x203,\x201,\x20null'))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),_0x6549('0x60')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5c')))),_0x6549('0x61')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5d')))),_0x6549('0x62')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6549('0x63')]]})['then'](handleEntityNotFound(_0x45eb28,null))[_0x6549('0x26')](respondWithResult(_0x45eb28,null))[_0x6549('0x43')](handleError(_0x45eb28,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x372b67,_0x2c00a1,_0x2e6b4b){return db['VoiceQueue'][_0x6549('0x4a')]({'where':{'id':_0x372b67[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x2c00a1,null))[_0x6549('0x26')](function(_0x15b906){var _0x34c5f9;if(_0x15b906){_0x34c5f9=squel['insert']()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone','scheduledAt','ContactId',_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69'),'updatedAt'],squel['select']()[_0x6549('0x6a')]('ANY_VALUE(calleridnum)',_0x6549('0x6b'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x6d'))[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))['field'](_0x6549('0x70'),_0x6549('0x67'))[_0x6549('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x6549('0x68'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x69'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x71'))['from'](_0x6549('0x72'))['where'](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x372b67[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())['where'](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67['params']['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db[_0x6549('0x50')]['query'](_0x34c5f9);}return[];})[_0x6549('0x26')](respondWithResult(_0x2c00a1,null))[_0x6549('0x43')](handleError(_0x2c00a1,null));};exports[_0x6549('0x7e')]=function(_0x35bad6,_0x371d8a,_0xfde69e){return db[_0x6549('0x7f')][_0x6549('0x4a')]({'where':{'id':_0x35bad6[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x371d8a,null))[_0x6549('0x26')](function(_0x1da2d7){var _0x348d55;if(_0x1da2d7){_0x348d55=squel[_0x6549('0x80')]()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone',_0x6549('0x6d'),_0x6549('0x6f'),_0x6549('0x67'),_0x6549('0x81'),_0x6549('0x69'),_0x6549('0x71')],squel[_0x6549('0x79')]()['field'](_0x6549('0x82'),'phone')['field'](_0x6549('0x6c'),'scheduledAt')[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))[_0x6549('0x6a')](_0x6549('0x70'),'ListId')[_0x6549('0x6a')]('ANY_VALUE(CampaignId)',_0x6549('0x81'))[_0x6549('0x6a')](_0x6549('0x6c'),'createdAt')[_0x6549('0x6a')](_0x6549('0x6c'),'updatedAt')['from'](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x83'),_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x35bad6[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))['where']('CampaignId\x20=\x20?',_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')]('CampaignId\x20=\x20?',_0x35bad6['params']['id']['toString']())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db['sequelize'][_0x6549('0x32')](_0x348d55);}return[];})[_0x6549('0x26')](respondWithResult(_0x371d8a,null))[_0x6549('0x43')](handleError(_0x371d8a,null));};exports[_0x6549('0x84')]=function(_0x230874,_0x3be369,_0xaf1a80){return db[_0x6549('0x85')][_0x6549('0x86')]({'where':{'VoiceQueueId':_0x230874[_0x6549('0x4c')][_0x6549('0x68')],'CampaignId':_0x230874['body'][_0x6549('0x81')],'ContactId':_0x230874[_0x6549('0x4c')][_0x6549('0x6f')]}})[_0x6549('0x26')](handleEntityNotFound(_0x3be369,null))['then'](function(_0x158c92){if(_0x158c92){return _0x158c92;}return null;})[_0x6549('0x26')](respondWithResult(_0x3be369,null))[_0x6549('0x43')](handleError(_0x3be369,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index c0ac01a..f604b99 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 _0x9d5a=['cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','CmHopperFinal'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x9d5a,0xc6));var _0xa9d5=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x9d5a[_0x2fee96];return _0x2e6ad1;};'use strict';var _=require(_0xa9d5('0x0'));var util=require(_0xa9d5('0x1'));var logger=require(_0xa9d5('0x2'))(_0xa9d5('0x3'));var moment=require(_0xa9d5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9d5('0x5'));var fs=require('fs');var path=require(_0xa9d5('0x6'));var rimraf=require(_0xa9d5('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xa9d5('0x8')]=function(_0x286a75,_0x205cf4){return _0x286a75['define'](_0xa9d5('0x9'),attributes,{'tableName':_0xa9d5('0xa'),'paranoid':![],'indexes':[{'name':_0xa9d5('0xb'),'fields':[_0xa9d5('0xb')]},{'name':'uniqueid','fields':[_0xa9d5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4b8=['../../config/logger','api','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x38cd87,_0x32c713){var _0x299574=function(_0x22a71c){while(--_0x22a71c){_0x38cd87['push'](_0x38cd87['shift']());}};_0x299574(++_0x32c713);}(_0xc4b8,0x15d));var _0x8c4b=function(_0xf3f965,_0x466c6f){_0xf3f965=_0xf3f965-0x0;var _0x29e2b2=_0xc4b8[_0xf3f965];return _0x29e2b2;};'use strict';var _=require(_0x8c4b('0x0'));var util=require(_0x8c4b('0x1'));var logger=require(_0x8c4b('0x2'))(_0x8c4b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c4b('0x4'));var rimraf=require(_0x8c4b('0x5'));var config=require(_0x8c4b('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x8c4b('0x7')]=function(_0x4998c0,_0x40162e){return _0x4998c0[_0x8c4b('0x8')](_0x8c4b('0x9'),attributes,{'tableName':_0x8c4b('0xa'),'paranoid':![],'indexes':[{'name':_0x8c4b('0xb'),'fields':[_0x8c4b('0xb')]},{'name':_0x8c4b('0xc'),'fields':[_0x8c4b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 3496db4..23eb894 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3be3a2,_0x1d5c3a){var _0x2a7a91=function(_0x319319){while(--_0x319319){_0x3be3a2['push'](_0x3be3a2['shift']());}};_0x2a7a91(++_0x1d5c3a);}(_0x7a54,0x106));var _0x47a5=function(_0x13454c,_0x428002){_0x13454c=_0x13454c-0x0;var _0x252201=_0x7a54[_0x13454c];return _0x252201;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x161f18,_0xe2abb8){var _0xcd7e11=function(_0x7dd6aa){while(--_0x7dd6aa){_0x161f18['push'](_0x161f18['shift']());}};_0xcd7e11(++_0xe2abb8);}(_0x7a54,0x106));var _0x47a5=function(_0x1fde99,_0x17f6bf){_0x1fde99=_0x1fde99-0x0;var _0x3d7e55=_0x7a54[_0x1fde99];return _0x3d7e55;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index f9ae702..782fdf7 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 _0x3ed4=['checkContactHopper','put','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper'];(function(_0x2a9d9c,_0x2cf00d){var _0x530a61=function(_0x3c8f2d){while(--_0x3c8f2d){_0x2a9d9c['push'](_0x2a9d9c['shift']());}};_0x530a61(++_0x2cf00d);}(_0x3ed4,0xdf));var _0x43ed=function(_0x2a91b6,_0x1b7dbc){_0x2a91b6=_0x2a91b6-0x0;var _0xfc802c=_0x3ed4[_0x2a91b6];return _0xfc802c;};'use strict';var multer=require(_0x43ed('0x0'));var util=require('util');var path=require(_0x43ed('0x1'));var timeout=require(_0x43ed('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43ed('0x3'));var interaction=require(_0x43ed('0x4'));var config=require(_0x43ed('0x5'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x43ed('0x6')]);router[_0x43ed('0x7')](_0x43ed('0x8'),auth[_0x43ed('0x9')](),controller[_0x43ed('0xa')]);router['get'](_0x43ed('0xb'),auth[_0x43ed('0x9')](),controller['show']);router[_0x43ed('0x7')](_0x43ed('0xc'),auth['isAuthenticated'](),controller[_0x43ed('0xd')]);router[_0x43ed('0x7')]('/campaign/countAttributes/:id',auth[_0x43ed('0x9')](),controller[_0x43ed('0xe')]);router[_0x43ed('0xf')]('/voice/queue/moveContacts/:id',auth[_0x43ed('0x9')](),controller[_0x43ed('0x10')]);router[_0x43ed('0xf')]('/voice/campaign/moveContacts/:id',auth[_0x43ed('0x9')](),controller[_0x43ed('0x11')]);router[_0x43ed('0xf')](_0x43ed('0x12'),auth[_0x43ed('0x9')](),controller[_0x43ed('0x13')]);router[_0x43ed('0x14')](_0x43ed('0xb'),auth[_0x43ed('0x9')](),controller['update']);module[_0x43ed('0x15')]=router; \ No newline at end of file +var _0x7366=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','isAuthenticated','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','index','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7366,0x9d));var _0x6736=function(_0x587ac3,_0x2cf4be){_0x587ac3=_0x587ac3-0x0;var _0x4364f3=_0x7366[_0x587ac3];return _0x4364f3;};'use strict';var multer=require(_0x6736('0x0'));var util=require(_0x6736('0x1'));var path=require(_0x6736('0x2'));var timeout=require(_0x6736('0x3'));var express=require(_0x6736('0x4'));var router=express[_0x6736('0x5')]();var fs_extra=require(_0x6736('0x6'));var auth=require(_0x6736('0x7'));var interaction=require(_0x6736('0x8'));var config=require('../../config/environment');var controller=require(_0x6736('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6736('0xa')]);router[_0x6736('0xb')](_0x6736('0xc'),auth['isAuthenticated'](),controller[_0x6736('0xd')]);router[_0x6736('0xb')](_0x6736('0xe'),auth['isAuthenticated'](),controller[_0x6736('0xf')]);router[_0x6736('0xb')](_0x6736('0x10'),auth['isAuthenticated'](),controller[_0x6736('0x11')]);router['get'](_0x6736('0x12'),auth[_0x6736('0x13')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x6736('0x14')](_0x6736('0x15'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0x6736('0x16'),auth[_0x6736('0x13')](),controller[_0x6736('0x17')]);router[_0x6736('0x14')](_0x6736('0x18'),auth[_0x6736('0x13')](),controller[_0x6736('0x19')]);router[_0x6736('0x1a')](_0x6736('0xe'),auth[_0x6736('0x13')](),controller[_0x6736('0x1b')]);module[_0x6736('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 2250f1d..1d489ab 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 _0x7b58=['BOOLEAN','INTEGER','DATE','STRING'];(function(_0x2e4ee0,_0x534108){var _0x246854=function(_0x7cad4b){while(--_0x7cad4b){_0x2e4ee0['push'](_0x2e4ee0['shift']());}};_0x246854(++_0x534108);}(_0x7b58,0xad));var _0x87b5=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x7b58[_0x3b2369];return _0x5a1367;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x87b5('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x87b5('0x1')]},'countbusyretry':{'type':Sequelize[_0x87b5('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x87b5('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x87b5('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x87b5('0x2')]},'calleridnum':{'type':Sequelize[_0x87b5('0x2')]},'calleridname':{'type':Sequelize[_0x87b5('0x2')]},'starttime':{'type':Sequelize[_0x87b5('0x1')]},'responsetime':{'type':Sequelize[_0x87b5('0x1')]},'answertime':{'type':Sequelize[_0x87b5('0x1')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x87b5('0x1')]},'ringtime':{'type':Sequelize[_0x87b5('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x87b5('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x87b5('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x87b5('0x2')]},'campaign':{'type':Sequelize[_0x87b5('0x2')]},'campaigntype':{'type':Sequelize[_0x87b5('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x87b5('0x2')]},'amd':{'type':Sequelize[_0x87b5('0x3')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x87b5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x87b5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x87b5('0x1')]},'recallme':{'type':Sequelize[_0x87b5('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x87b5('0x1')]},'edited':{'type':Sequelize[_0x87b5('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x87b5('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x87b5('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x87b5('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4e30=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x7f4aa7,_0x2d9334){var _0x3066d4=function(_0x13cc34){while(--_0x13cc34){_0x7f4aa7['push'](_0x7f4aa7['shift']());}};_0x3066d4(++_0x2d9334);}(_0x4e30,0x112));var _0x04e3=function(_0x2e22f5,_0x49b0b9){_0x2e22f5=_0x2e22f5-0x0;var _0x557e01=_0x4e30[_0x2e22f5];return _0x557e01;};'use strict';var Sequelize=require('sequelize');module[_0x04e3('0x0')]={'state':{'type':Sequelize[_0x04e3('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x04e3('0x2')]},'scheduledat':{'type':Sequelize[_0x04e3('0x3')]},'countbusyretry':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x04e3('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x04e3('0x2')]},'originatecalleridname':{'type':Sequelize[_0x04e3('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x04e3('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x04e3('0x3')]},'droptime':{'type':Sequelize[_0x04e3('0x3')]},'endtime':{'type':Sequelize[_0x04e3('0x3')]},'ringtime':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x04e3('0x2')]},'campaign':{'type':Sequelize[_0x04e3('0x2')]},'campaigntype':{'type':Sequelize[_0x04e3('0x2')]},'membername':{'type':Sequelize[_0x04e3('0x2')]},'reason':{'type':Sequelize[_0x04e3('0x2')]},'amd':{'type':Sequelize[_0x04e3('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x04e3('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x04e3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x04e3('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x04e3('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x04e3('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x04e3('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x04e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 1a074ef..d17c94d 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 _0xa04d=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','then','destroy','error','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','describe','update','uniqueid','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto'];(function(_0x31ddf3,_0x510230){var _0x1ab5a2=function(_0x4646e3){while(--_0x4646e3){_0x31ddf3['push'](_0x31ddf3['shift']());}};_0x1ab5a2(++_0x510230);}(_0xa04d,0x166));var _0xda04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa04d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xda04('0x0'));var jsonpatch=require(_0xda04('0x1'));var rp=require(_0xda04('0x2'));var moment=require(_0xda04('0x3'));var BPromise=require(_0xda04('0x4'));var Mustache=require(_0xda04('0x5'));var util=require('util');var path=require(_0xda04('0x6'));var sox=require(_0xda04('0x7'));var csv=require(_0xda04('0x8'));var ejs=require(_0xda04('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xda04('0xa'));var crypto=require(_0xda04('0xb'));var jsforce=require(_0xda04('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xda04('0x8'));var querystring=require(_0xda04('0xd'));var Papa=require(_0xda04('0xe'));var Redis=require(_0xda04('0xf'));var authService=require(_0xda04('0x10'));var qs=require(_0xda04('0x11'));var as=require(_0xda04('0x12'));var hardwareService=require(_0xda04('0x13'));var logger=require(_0xda04('0x14'))('api');var utils=require(_0xda04('0x15'));var config=require(_0xda04('0x16'));var licenseUtil=require(_0xda04('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb4a0db,_0x36ab3b){_0x36ab3b=_0x36ab3b||0xcc;return function(_0x483bb8){if(_0x483bb8){return _0xb4a0db[_0xda04('0x18')](_0x36ab3b);}return _0xb4a0db[_0xda04('0x19')](_0x36ab3b)[_0xda04('0x1a')]();};}function respondWithResult(_0x2eab8a,_0x452c7d){_0x452c7d=_0x452c7d||0xc8;return function(_0x24f48f){if(_0x24f48f){return _0x2eab8a[_0xda04('0x19')](_0x452c7d)['json'](_0x24f48f);}};}function respondWithFilteredResult(_0x5ba331,_0x3b6f94){return function(_0x290d2b){if(_0x290d2b){var _0x561b78=typeof _0x3b6f94[_0xda04('0x1b')]==='undefined'&&typeof _0x3b6f94[_0xda04('0x1c')]===_0xda04('0x1d');var _0x5253bf=_0x290d2b[_0xda04('0x1e')];var _0x4edbf5=_0x561b78?0x0:_0x3b6f94[_0xda04('0x1b')];var _0x35d427=_0x561b78?_0x290d2b[_0xda04('0x1e')]:_0x3b6f94['offset']+_0x3b6f94['limit'];var _0x550fd1;if(_0x35d427>=_0x5253bf){_0x35d427=_0x5253bf;_0x550fd1=0xc8;}else{_0x550fd1=0xce;}_0x5ba331['status'](_0x550fd1);return _0x5ba331[_0xda04('0x1f')]('Content-Range',_0x4edbf5+'-'+_0x35d427+'/'+_0x5253bf)['json'](_0x290d2b);}return null;};}function patchUpdates(_0x164737){return function(_0x2b6366){try{jsonpatch[_0xda04('0x20')](_0x2b6366,_0x164737,!![]);}catch(_0x5b3a63){return BPromise[_0xda04('0x21')](_0x5b3a63);}return _0x2b6366['save']();};}function saveUpdates(_0x4d445c,_0x21f05a){return function(_0x4f5940){if(_0x4f5940){return _0x4f5940['update'](_0x4d445c)[_0xda04('0x22')](function(_0x2b0d74){return _0x2b0d74;});}return null;};}function removeEntity(_0xc540e9,_0x4410f2){return function(_0x1698ee){if(_0x1698ee){return _0x1698ee[_0xda04('0x23')]()[_0xda04('0x22')](function(){_0xc540e9[_0xda04('0x19')](0xcc)[_0xda04('0x1a')]();});}};}function handleEntityNotFound(_0x240a4b,_0x494be9){return function(_0x192525){if(!_0x192525){_0x240a4b['sendStatus'](0x194);}return _0x192525;};}function handleError(_0x36176b,_0x3b5b40){_0x3b5b40=_0x3b5b40||0x1f4;return function(_0x127994){logger[_0xda04('0x24')](_0x127994['stack']);if(_0x127994['name']){delete _0x127994[_0xda04('0x25')];}_0x36176b[_0xda04('0x19')](_0x3b5b40)[_0xda04('0x26')](_0x127994);};}exports['index']=function(_0x1898bf,_0x2e846a){var _0x336cb1={},_0x39c676={},_0x11674b={'count':0x0,'rows':[]};var _0x301001=_[_0xda04('0x27')](db[_0xda04('0x28')][_0xda04('0x29')],function(_0x9b3d7c){return{'name':_0x9b3d7c[_0xda04('0x2a')],'type':_0x9b3d7c[_0xda04('0x2b')][_0xda04('0x2c')]};});_0x39c676[_0xda04('0x2d')]=_['map'](_0x301001,_0xda04('0x25'));_0x39c676[_0xda04('0x2e')]=_[_0xda04('0x2f')](_0x1898bf[_0xda04('0x2e')]);_0x39c676[_0xda04('0x30')]=_['intersection'](_0x39c676[_0xda04('0x2d')],_0x39c676[_0xda04('0x2e')]);_0x336cb1[_0xda04('0x31')]=_['intersection'](_0x39c676[_0xda04('0x2d')],qs[_0xda04('0x32')](_0x1898bf[_0xda04('0x2e')][_0xda04('0x32')]));_0x336cb1[_0xda04('0x31')]=_0x336cb1[_0xda04('0x31')][_0xda04('0x33')]?_0x336cb1[_0xda04('0x31')]:_0x39c676[_0xda04('0x2d')];if(!_0x1898bf[_0xda04('0x2e')]['hasOwnProperty']('nolimit')){_0x336cb1['limit']=qs[_0xda04('0x1c')](_0x1898bf['query'][_0xda04('0x1c')]);_0x336cb1[_0xda04('0x1b')]=qs[_0xda04('0x1b')](_0x1898bf[_0xda04('0x2e')][_0xda04('0x1b')]);}_0x336cb1[_0xda04('0x34')]=qs['sort'](_0x1898bf['query'][_0xda04('0x35')]);_0x336cb1[_0xda04('0x36')]=qs[_0xda04('0x30')](_[_0xda04('0x37')](_0x1898bf[_0xda04('0x2e')],_0x39c676[_0xda04('0x30')]),_0x301001);if(_0x1898bf[_0xda04('0x2e')][_0xda04('0x38')]){_0x336cb1['where']=_[_0xda04('0x39')](_0x336cb1[_0xda04('0x36')],{'$or':_[_0xda04('0x27')](_0x301001,function(_0xd36fbd){if(_0xd36fbd[_0xda04('0x2b')]!==_0xda04('0x3a')){var _0x397556={};_0x397556[_0xd36fbd['name']]={'$like':'%'+_0x1898bf[_0xda04('0x2e')][_0xda04('0x38')]+'%'};return _0x397556;}})});}_0x336cb1=_[_0xda04('0x39')]({},_0x336cb1,_0x1898bf[_0xda04('0x3b')]);var _0x595de9={'where':_0x336cb1[_0xda04('0x36')]};return db[_0xda04('0x28')]['count'](_0x595de9)[_0xda04('0x22')](function(_0x340c3f){_0x11674b[_0xda04('0x1e')]=_0x340c3f;if(_0x1898bf[_0xda04('0x2e')][_0xda04('0x3c')]){_0x336cb1[_0xda04('0x3d')]=[{'all':!![]}];}return db[_0xda04('0x28')][_0xda04('0x3e')](_0x336cb1);})[_0xda04('0x22')](function(_0x46835a){_0x11674b[_0xda04('0x3f')]=_0x46835a;return _0x11674b;})[_0xda04('0x22')](respondWithFilteredResult(_0x2e846a,_0x336cb1))['catch'](handleError(_0x2e846a,null));};exports[_0xda04('0x40')]=function(_0x58951f,_0x3ab6b9){var _0x920178={'raw':!![],'where':{'id':_0x58951f[_0xda04('0x41')]['id']}},_0x3fd5f8={};_0x3fd5f8[_0xda04('0x2d')]=_[_0xda04('0x2f')](db[_0xda04('0x28')][_0xda04('0x29')]);_0x3fd5f8[_0xda04('0x2e')]=_['keys'](_0x58951f[_0xda04('0x2e')]);_0x3fd5f8[_0xda04('0x30')]=_[_0xda04('0x42')](_0x3fd5f8[_0xda04('0x2d')],_0x3fd5f8['query']);_0x920178['attributes']=_['intersection'](_0x3fd5f8[_0xda04('0x2d')],qs[_0xda04('0x32')](_0x58951f['query'][_0xda04('0x32')]));_0x920178[_0xda04('0x31')]=_0x920178['attributes'][_0xda04('0x33')]?_0x920178[_0xda04('0x31')]:_0x3fd5f8[_0xda04('0x2d')];if(_0x58951f[_0xda04('0x2e')][_0xda04('0x3c')]){_0x920178['include']=[{'all':!![]}];}_0x920178=_[_0xda04('0x39')]({},_0x920178,_0x58951f[_0xda04('0x3b')]);return db[_0xda04('0x28')][_0xda04('0x43')](_0x920178)[_0xda04('0x22')](handleEntityNotFound(_0x3ab6b9,null))[_0xda04('0x22')](respondWithResult(_0x3ab6b9,null))[_0xda04('0x44')](handleError(_0x3ab6b9,null));};exports[_0xda04('0x45')]=function(_0x3556ea,_0x2835ec){return db[_0xda04('0x28')][_0xda04('0x45')](_0x3556ea[_0xda04('0x46')],{})[_0xda04('0x22')](respondWithResult(_0x2835ec,0xc9))['catch'](handleError(_0x2835ec,null));};exports[_0xda04('0x47')]=function(_0x1efb1d,_0x16af21){return db[_0xda04('0x28')][_0xda04('0x47')]()['then'](respondWithResult(_0x16af21,null))[_0xda04('0x44')](handleError(_0x16af21,null));};exports[_0xda04('0x48')]=function(_0x10f2c8,_0x4f5f0a){if(_0x10f2c8[_0xda04('0x46')]['uniqueid']){delete _0x10f2c8['body'][_0xda04('0x49')];}return db[_0xda04('0x28')][_0xda04('0x43')]({'where':{'uniqueid':_0x10f2c8[_0xda04('0x41')]['id']}})['then'](handleEntityNotFound(_0x4f5f0a,null))[_0xda04('0x22')](saveUpdates(_0x10f2c8[_0xda04('0x46')],null))[_0xda04('0x22')](respondWithResult(_0x4f5f0a,null))[_0xda04('0x44')](handleError(_0x4f5f0a,null));}; \ No newline at end of file +var _0x3f0e=['index','map','CmHopperHistory','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','merge','options','then','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','describe','body','uniqueid','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','sendStatus','stack','name','send'];(function(_0x288a64,_0x1974e7){var _0x2e012c=function(_0x25d13d){while(--_0x25d13d){_0x288a64['push'](_0x288a64['shift']());}};_0x2e012c(++_0x1974e7);}(_0x3f0e,0x68));var _0xe3f0=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3f0e[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0xe3f0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe3f0('0x1'));var rp=require(_0xe3f0('0x2'));var moment=require(_0xe3f0('0x3'));var BPromise=require(_0xe3f0('0x4'));var Mustache=require('mustache');var util=require(_0xe3f0('0x5'));var path=require(_0xe3f0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe3f0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe3f0('0x8'));var squel=require(_0xe3f0('0x9'));var crypto=require(_0xe3f0('0xa'));var jsforce=require(_0xe3f0('0xb'));var deskjs=require(_0xe3f0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe3f0('0xd'));var Papa=require(_0xe3f0('0xe'));var Redis=require('ioredis');var authService=require(_0xe3f0('0xf'));var qs=require(_0xe3f0('0x10'));var as=require(_0xe3f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3f0('0x12'))(_0xe3f0('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe3f0('0x14'));var db=require(_0xe3f0('0x15'))['db'];function respondWithStatusCode(_0x3074d1,_0x54e477){_0x54e477=_0x54e477||0xcc;return function(_0x69f2a1){if(_0x69f2a1){return _0x3074d1['sendStatus'](_0x54e477);}return _0x3074d1[_0xe3f0('0x16')](_0x54e477)[_0xe3f0('0x17')]();};}function respondWithResult(_0x39eda3,_0x1d83cb){_0x1d83cb=_0x1d83cb||0xc8;return function(_0x637283){if(_0x637283){return _0x39eda3['status'](_0x1d83cb)[_0xe3f0('0x18')](_0x637283);}};}function respondWithFilteredResult(_0x1f5955,_0x15e7e8){return function(_0x56fb5a){if(_0x56fb5a){var _0x440c51=typeof _0x15e7e8[_0xe3f0('0x19')]===_0xe3f0('0x1a')&&typeof _0x15e7e8[_0xe3f0('0x1b')]===_0xe3f0('0x1a');var _0x48faed=_0x56fb5a[_0xe3f0('0x1c')];var _0x7e93e9=_0x440c51?0x0:_0x15e7e8['offset'];var _0x1ab10c=_0x440c51?_0x56fb5a['count']:_0x15e7e8[_0xe3f0('0x19')]+_0x15e7e8[_0xe3f0('0x1b')];var _0x7529dc;if(_0x1ab10c>=_0x48faed){_0x1ab10c=_0x48faed;_0x7529dc=0xc8;}else{_0x7529dc=0xce;}_0x1f5955['status'](_0x7529dc);return _0x1f5955[_0xe3f0('0x1d')](_0xe3f0('0x1e'),_0x7e93e9+'-'+_0x1ab10c+'/'+_0x48faed)['json'](_0x56fb5a);}return null;};}function patchUpdates(_0x3ecfc6){return function(_0x16ff29){try{jsonpatch[_0xe3f0('0x1f')](_0x16ff29,_0x3ecfc6,!![]);}catch(_0x4441cd){return BPromise['reject'](_0x4441cd);}return _0x16ff29[_0xe3f0('0x20')]();};}function saveUpdates(_0x372378,_0x368faa){return function(_0x318505){if(_0x318505){return _0x318505[_0xe3f0('0x21')](_0x372378)['then'](function(_0x5c0095){return _0x5c0095;});}return null;};}function removeEntity(_0x9c6c,_0x385398){return function(_0x2990e1){if(_0x2990e1){return _0x2990e1['destroy']()['then'](function(){_0x9c6c[_0xe3f0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f041f,_0x1ec9ee){return function(_0x3a1e90){if(!_0x3a1e90){_0x2f041f[_0xe3f0('0x22')](0x194);}return _0x3a1e90;};}function handleError(_0x45aca3,_0x4e21d9){_0x4e21d9=_0x4e21d9||0x1f4;return function(_0x121160){logger['error'](_0x121160[_0xe3f0('0x23')]);if(_0x121160[_0xe3f0('0x24')]){delete _0x121160[_0xe3f0('0x24')];}_0x45aca3[_0xe3f0('0x16')](_0x4e21d9)[_0xe3f0('0x25')](_0x121160);};}exports[_0xe3f0('0x26')]=function(_0xbf4fb6,_0x306c7f){var _0x184a4c={},_0x19b178={},_0x2936fd={'count':0x0,'rows':[]};var _0x3e1367=_[_0xe3f0('0x27')](db[_0xe3f0('0x28')]['rawAttributes'],function(_0x3191b4){return{'name':_0x3191b4[_0xe3f0('0x29')],'type':_0x3191b4['type']['key']};});_0x19b178[_0xe3f0('0x2a')]=_[_0xe3f0('0x27')](_0x3e1367,'name');_0x19b178[_0xe3f0('0x2b')]=_['keys'](_0xbf4fb6[_0xe3f0('0x2b')]);_0x19b178['filters']=_[_0xe3f0('0x2c')](_0x19b178[_0xe3f0('0x2a')],_0x19b178['query']);_0x184a4c[_0xe3f0('0x2d')]=_['intersection'](_0x19b178[_0xe3f0('0x2a')],qs[_0xe3f0('0x2e')](_0xbf4fb6[_0xe3f0('0x2b')][_0xe3f0('0x2e')]));_0x184a4c[_0xe3f0('0x2d')]=_0x184a4c[_0xe3f0('0x2d')][_0xe3f0('0x2f')]?_0x184a4c[_0xe3f0('0x2d')]:_0x19b178[_0xe3f0('0x2a')];if(!_0xbf4fb6[_0xe3f0('0x2b')][_0xe3f0('0x30')]('nolimit')){_0x184a4c[_0xe3f0('0x1b')]=qs[_0xe3f0('0x1b')](_0xbf4fb6[_0xe3f0('0x2b')][_0xe3f0('0x1b')]);_0x184a4c[_0xe3f0('0x19')]=qs[_0xe3f0('0x19')](_0xbf4fb6[_0xe3f0('0x2b')][_0xe3f0('0x19')]);}_0x184a4c['order']=qs['sort'](_0xbf4fb6[_0xe3f0('0x2b')][_0xe3f0('0x31')]);_0x184a4c['where']=qs[_0xe3f0('0x32')](_[_0xe3f0('0x33')](_0xbf4fb6[_0xe3f0('0x2b')],_0x19b178[_0xe3f0('0x32')]),_0x3e1367);if(_0xbf4fb6[_0xe3f0('0x2b')][_0xe3f0('0x34')]){_0x184a4c[_0xe3f0('0x35')]=_['merge'](_0x184a4c[_0xe3f0('0x35')],{'$or':_[_0xe3f0('0x27')](_0x3e1367,function(_0xb6125e){if(_0xb6125e['type']!=='VIRTUAL'){var _0x2d7b49={};_0x2d7b49[_0xb6125e[_0xe3f0('0x24')]]={'$like':'%'+_0xbf4fb6[_0xe3f0('0x2b')][_0xe3f0('0x34')]+'%'};return _0x2d7b49;}})});}_0x184a4c=_[_0xe3f0('0x36')]({},_0x184a4c,_0xbf4fb6[_0xe3f0('0x37')]);var _0x4d47d0={'where':_0x184a4c['where']};return db[_0xe3f0('0x28')][_0xe3f0('0x1c')](_0x4d47d0)[_0xe3f0('0x38')](function(_0x1a4bd4){_0x2936fd[_0xe3f0('0x1c')]=_0x1a4bd4;if(_0xbf4fb6[_0xe3f0('0x2b')]['includeAll']){_0x184a4c[_0xe3f0('0x39')]=[{'all':!![]}];}return db[_0xe3f0('0x28')][_0xe3f0('0x3a')](_0x184a4c);})[_0xe3f0('0x38')](function(_0x35c37a){_0x2936fd[_0xe3f0('0x3b')]=_0x35c37a;return _0x2936fd;})[_0xe3f0('0x38')](respondWithFilteredResult(_0x306c7f,_0x184a4c))[_0xe3f0('0x3c')](handleError(_0x306c7f,null));};exports[_0xe3f0('0x3d')]=function(_0xa1df6f,_0x409458){var _0x39113f={'raw':!![],'where':{'id':_0xa1df6f[_0xe3f0('0x3e')]['id']}},_0x52e889={};_0x52e889[_0xe3f0('0x2a')]=_[_0xe3f0('0x3f')](db[_0xe3f0('0x28')][_0xe3f0('0x40')]);_0x52e889[_0xe3f0('0x2b')]=_['keys'](_0xa1df6f[_0xe3f0('0x2b')]);_0x52e889[_0xe3f0('0x32')]=_[_0xe3f0('0x2c')](_0x52e889[_0xe3f0('0x2a')],_0x52e889[_0xe3f0('0x2b')]);_0x39113f[_0xe3f0('0x2d')]=_['intersection'](_0x52e889[_0xe3f0('0x2a')],qs[_0xe3f0('0x2e')](_0xa1df6f[_0xe3f0('0x2b')]['fields']));_0x39113f[_0xe3f0('0x2d')]=_0x39113f[_0xe3f0('0x2d')][_0xe3f0('0x2f')]?_0x39113f[_0xe3f0('0x2d')]:_0x52e889[_0xe3f0('0x2a')];if(_0xa1df6f[_0xe3f0('0x2b')][_0xe3f0('0x41')]){_0x39113f[_0xe3f0('0x39')]=[{'all':!![]}];}_0x39113f=_[_0xe3f0('0x36')]({},_0x39113f,_0xa1df6f[_0xe3f0('0x37')]);return db[_0xe3f0('0x28')][_0xe3f0('0x42')](_0x39113f)[_0xe3f0('0x38')](handleEntityNotFound(_0x409458,null))[_0xe3f0('0x38')](respondWithResult(_0x409458,null))['catch'](handleError(_0x409458,null));};exports[_0xe3f0('0x43')]=function(_0x552d98,_0x4956c9){return db[_0xe3f0('0x28')][_0xe3f0('0x43')](_0x552d98['body'],{})['then'](respondWithResult(_0x4956c9,0xc9))[_0xe3f0('0x3c')](handleError(_0x4956c9,null));};exports[_0xe3f0('0x44')]=function(_0x525e57,_0x937d3b){return db[_0xe3f0('0x28')][_0xe3f0('0x44')]()[_0xe3f0('0x38')](respondWithResult(_0x937d3b,null))['catch'](handleError(_0x937d3b,null));};exports[_0xe3f0('0x21')]=function(_0x5d2d52,_0x3269f9){if(_0x5d2d52[_0xe3f0('0x45')][_0xe3f0('0x46')]){delete _0x5d2d52[_0xe3f0('0x45')][_0xe3f0('0x46')];}return db['CmHopperHistory'][_0xe3f0('0x42')]({'where':{'uniqueid':_0x5d2d52[_0xe3f0('0x3e')]['id']}})[_0xe3f0('0x38')](handleEntityNotFound(_0x3269f9,null))[_0xe3f0('0x38')](saveUpdates(_0x5d2d52[_0xe3f0('0x45')],null))[_0xe3f0('0x38')](respondWithResult(_0x3269f9,null))[_0xe3f0('0x3c')](handleError(_0x3269f9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index df0d1ab..700982f 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 _0xc0f9=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','cm_hopper_history','endtime'];(function(_0x1c9a0e,_0x13e6b7){var _0x5d597f=function(_0x3621ab){while(--_0x3621ab){_0x1c9a0e['push'](_0x1c9a0e['shift']());}};_0x5d597f(++_0x13e6b7);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x5257bf,_0xf39844){_0x5257bf=_0x5257bf-0x0;var _0x30f32b=_0xc0f9[_0x5257bf];return _0x30f32b;};'use strict';var _=require(_0x9c0f('0x0'));var util=require(_0x9c0f('0x1'));var logger=require(_0x9c0f('0x2'))(_0x9c0f('0x3'));var moment=require(_0x9c0f('0x4'));var BPromise=require(_0x9c0f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c0f('0x6'));var rimraf=require(_0x9c0f('0x7'));var config=require(_0x9c0f('0x8'));var attributes=require('./cmHopperHistory.attributes');module[_0x9c0f('0x9')]=function(_0x18f28e,_0x2eab65){return _0x18f28e[_0x9c0f('0xa')]('CmHopperHistory',attributes,{'tableName':_0x9c0f('0xb'),'paranoid':![],'indexes':[{'name':_0x9c0f('0xc'),'fields':[_0x9c0f('0xc')]},{'name':_0x9c0f('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x88c7=['uniqueid','lodash','api','moment','path','rimraf','./cmHopperHistory.attributes','exports','define','endtime'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0x88c7,0x6f));var _0x788c=function(_0x5c7d1a,_0x33c2ba){_0x5c7d1a=_0x5c7d1a-0x0;var _0x44eca6=_0x88c7[_0x5c7d1a];return _0x44eca6;};'use strict';var _=require(_0x788c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x788c('0x1'));var moment=require(_0x788c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x788c('0x3'));var rimraf=require(_0x788c('0x4'));var config=require('../../config/environment');var attributes=require(_0x788c('0x5'));module[_0x788c('0x6')]=function(_0x4e6f8b,_0xbde9d1){return _0x4e6f8b[_0x788c('0x7')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x788c('0x8'),'fields':[_0x788c('0x8')]},{'name':_0x788c('0x9'),'fields':[_0x788c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index cc3b71f..9ee5583 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 _0x0c39=['`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','CmHopperHistory,\x20%s,\x20%s','catch','CreateCmHopperHistory','create','body','options','raw','CmHopperHistory','findAll','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0x0c39,0x1b3));var _0x90c3=function(_0x2aff87,_0x14e2f8){_0x2aff87=_0x2aff87-0x0;var _0x5841be=_0x0c39[_0x2aff87];return _0x5841be;};'use strict';var _=require(_0x90c3('0x0'));var util=require(_0x90c3('0x1'));var moment=require('moment');var BPromise=require(_0x90c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90c3('0x3'));var db=require(_0x90c3('0x4'))['db'];var utils=require(_0x90c3('0x5'));var logger=require('../../config/logger')(_0x90c3('0x6'));var config=require(_0x90c3('0x7'));var jayson=require(_0x90c3('0x8'));var client=jayson[_0x90c3('0x9')][_0x90c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5170d8,_0x4ccfd6,_0x292444){return new BPromise(function(_0x1b5dca,_0x351076){return client[_0x90c3('0xb')](_0x5170d8,_0x292444)[_0x90c3('0xc')](function(_0x2716e5){logger[_0x90c3('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x4ccfd6,_0x90c3('0xe'));logger[_0x90c3('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4ccfd6,_0x90c3('0xe'),JSON[_0x90c3('0x10')](_0x2716e5));if(_0x2716e5[_0x90c3('0x11')]){if(_0x2716e5[_0x90c3('0x11')]['code']===0x1f4){logger[_0x90c3('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x4ccfd6,_0x2716e5[_0x90c3('0x11')]['message']);return _0x351076(_0x2716e5[_0x90c3('0x11')][_0x90c3('0x12')]);}logger['error'](_0x90c3('0x13'),_0x4ccfd6,_0x2716e5['error']['message']);return _0x1b5dca(_0x2716e5[_0x90c3('0x11')][_0x90c3('0x12')]);}else{logger[_0x90c3('0xd')](_0x90c3('0x13'),_0x4ccfd6,_0x90c3('0xe'));_0x1b5dca(_0x2716e5['result'][_0x90c3('0x12')]);}})[_0x90c3('0x14')](function(_0x3f2933){logger[_0x90c3('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x4ccfd6,_0x3f2933);_0x351076(_0x3f2933);});});}exports[_0x90c3('0x15')]=function(_0x3e41ad){var _0x327ca6=this;return new Promise(function(_0x1c9661,_0x2c7e6f){return db['CmHopperHistory'][_0x90c3('0x16')](_0x3e41ad[_0x90c3('0x17')],{'raw':_0x3e41ad['options']?_0x3e41ad[_0x90c3('0x18')][_0x90c3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x16b19d){logger['info']('CreateCmHopperHistory',_0x3e41ad);logger[_0x90c3('0xf')](_0x90c3('0x15'),_0x3e41ad,JSON[_0x90c3('0x10')](_0x16b19d));_0x1c9661(_0x16b19d);})[_0x90c3('0x14')](function(_0x47f265){logger[_0x90c3('0x11')](_0x90c3('0x15'),_0x47f265[_0x90c3('0x12')],_0x3e41ad);_0x2c7e6f(_0x327ca6[_0x90c3('0x11')](0x1f4,_0x47f265[_0x90c3('0x12')]));});});};exports['AvgHandleTime']=function(_0x2d76df){var _0xc4d7ad=this;return new Promise(function(_0x22dc04,_0x1f17fc){return db[_0x90c3('0x1a')][_0x90c3('0x1b')]({'raw':_0x2d76df['options']?_0x2d76df['options'][_0x90c3('0x19')]===undefined?!![]:![]:!![],'where':_0x2d76df[_0x90c3('0x18')]?_0x2d76df[_0x90c3('0x18')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x90c3('0x1c')][_0x90c3('0x1d')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn']('COUNT',db[_0x90c3('0x1c')]['fn']('IF',db[_0x90c3('0x1c')][_0x90c3('0x1e')](_0x90c3('0x1f')))),_0x90c3('0x20')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db[_0x90c3('0x1c')]['fn']('IF',db[_0x90c3('0x1c')][_0x90c3('0x1e')](_0x90c3('0x22')))),_0x90c3('0x23')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x90c3('0x1e')](_0x90c3('0x24')))),_0x90c3('0x25')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x26'),db[_0x90c3('0x1c')]['fn']('IF',db[_0x90c3('0x1c')][_0x90c3('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x90c3('0x27')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x26'),db['sequelize']['fn']('IF',db[_0x90c3('0x1c')]['literal'](_0x90c3('0x28')))),_0x90c3('0x29')]]})[_0x90c3('0xc')](function(_0x4f2589){logger[_0x90c3('0xd')](_0x90c3('0x2a'),_0x2d76df);logger[_0x90c3('0xf')](_0x90c3('0x2a'),_0x2d76df,JSON[_0x90c3('0x10')](_0x4f2589));_0x22dc04(_0x4f2589);})[_0x90c3('0x14')](function(_0x4ccf47){logger['error'](_0x90c3('0x2a'),_0x4ccf47[_0x90c3('0x12')],_0x2d76df);_0x1f17fc(_0xc4d7ad[_0x90c3('0x11')](0x1f4,_0x4ccf47[_0x90c3('0x12')]));});});};exports[_0x90c3('0x2b')]=function(_0x44307a){var _0x536e60=this;return new Promise(function(_0x584010,_0x45fde2){return db[_0x90c3('0x1a')][_0x90c3('0x1b')]({'raw':_0x44307a[_0x90c3('0x18')]?_0x44307a[_0x90c3('0x18')][_0x90c3('0x19')]===undefined?!![]:![]:!![],'where':_0x44307a['options']?_0x44307a[_0x90c3('0x18')][_0x90c3('0x2c')]||null:null,'attributes':[[_0x90c3('0x2d'),_0x90c3('0x2e')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db[_0x90c3('0x1c')]['fn']('IF',db[_0x90c3('0x1c')][_0x90c3('0x1e')](_0x90c3('0x2f')))),_0x90c3('0x30')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x90c3('0x1e')](_0x90c3('0x31')))),_0x90c3('0x32')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db[_0x90c3('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x90c3('0x33')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db[_0x90c3('0x1c')]['fn']('IF',db['sequelize'][_0x90c3('0x1e')]('`state`\x20=\x205,\x201,\x20null'))),_0x90c3('0x34')],[db[_0x90c3('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x90c3('0x1c')]['literal'](_0x90c3('0x35')))),_0x90c3('0x36')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db[_0x90c3('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x90c3('0x37')))),_0x90c3('0x38')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db['sequelize']['fn']('IF',db[_0x90c3('0x1c')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x90c3('0x39')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db['sequelize']['fn']('IF',db[_0x90c3('0x1c')][_0x90c3('0x1e')](_0x90c3('0x3a')))),_0x90c3('0x3b')],[db[_0x90c3('0x1c')]['fn']('COUNT',db[_0x90c3('0x1c')]['fn']('IF',db['sequelize'][_0x90c3('0x1e')]('`state`\x20=\x2013,\x201,\x20null'))),_0x90c3('0x3c')],[db['sequelize']['fn'](_0x90c3('0x21'),db[_0x90c3('0x1c')]['fn']('IF',db[_0x90c3('0x1c')]['literal'](_0x90c3('0x3d')))),'outboundOriginateFailureCallsDay'],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db['sequelize']['fn']('IF',db[_0x90c3('0x1c')]['literal'](_0x90c3('0x3e')))),_0x90c3('0x3f')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db[_0x90c3('0x1c')]['fn']('IF',db[_0x90c3('0x1c')][_0x90c3('0x1e')]('`state`\x20=\x2016,\x201,\x20null'))),_0x90c3('0x40')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db[_0x90c3('0x1c')]['fn']('IF',db[_0x90c3('0x1c')][_0x90c3('0x1e')](_0x90c3('0x41')))),_0x90c3('0x3f')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db[_0x90c3('0x1c')]['fn']('IF',db[_0x90c3('0x1c')][_0x90c3('0x1e')](_0x90c3('0x42')))),_0x90c3('0x43')]],'group':[_0x90c3('0x2d')]})[_0x90c3('0xc')](function(_0x4fcc50){logger[_0x90c3('0xd')](_0x90c3('0x2b'),_0x44307a);logger[_0x90c3('0xf')](_0x90c3('0x2b'),_0x44307a,JSON[_0x90c3('0x10')](_0x4fcc50));_0x584010(_0x4fcc50);})[_0x90c3('0x14')](function(_0x4c05bb){logger[_0x90c3('0x11')](_0x90c3('0x2b'),_0x4c05bb[_0x90c3('0x12')],_0x44307a);_0x45fde2(_0x536e60[_0x90c3('0x11')](0x1f4,_0x4c05bb[_0x90c3('0x12')]));});});};exports[_0x90c3('0x44')]=function(_0x1f5125){var _0xfe5479=this;return new Promise(function(_0x206b83,_0x168b7b){return db[_0x90c3('0x1a')][_0x90c3('0x1b')]({'raw':_0x1f5125[_0x90c3('0x18')]?_0x1f5125[_0x90c3('0x18')][_0x90c3('0x19')]===undefined?!![]:![]:!![],'where':_0x1f5125[_0x90c3('0x18')]?_0x1f5125[_0x90c3('0x18')][_0x90c3('0x2c')]||null:null,'attributes':[[_0x90c3('0x2d'),_0x90c3('0x2e')],[db['sequelize']['fn'](_0x90c3('0x21'),db['sequelize']['col']('id')),_0x90c3('0x45')],[db[_0x90c3('0x1c')]['fn'](_0x90c3('0x21'),db[_0x90c3('0x1c')]['fn']('IF',db[_0x90c3('0x1c')][_0x90c3('0x1e')](_0x90c3('0x1f')))),_0x90c3('0x46')]],'group':[_0x90c3('0x2d')]})[_0x90c3('0xc')](function(_0x3f477d){logger[_0x90c3('0xd')](_0x90c3('0x44'),_0x1f5125);logger[_0x90c3('0xf')](_0x90c3('0x44'),_0x1f5125,JSON['stringify'](_0x3f477d));_0x206b83(_0x3f477d);})[_0x90c3('0x14')](function(_0x38b88f){logger[_0x90c3('0x11')](_0x90c3('0x44'),_0x38b88f[_0x90c3('0x12')],_0x1f5125);_0x168b7b(_0xfe5479[_0x90c3('0x11')](0x1f4,_0x38b88f[_0x90c3('0x12')]));});});}; \ No newline at end of file +var _0x191a=['`state`\x20=\x204,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','findAll','sequelize','col','literal','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x191a,0xef));var _0xa191=function(_0x3c5d53,_0x28138f){_0x3c5d53=_0x3c5d53-0x0;var _0x42fd32=_0x191a[_0x3c5d53];return _0x42fd32;};'use strict';var _=require(_0xa191('0x0'));var util=require('util');var moment=require(_0xa191('0x1'));var BPromise=require(_0xa191('0x2'));var rs=require(_0xa191('0x3'));var fs=require('fs');var Redis=require(_0xa191('0x4'));var db=require(_0xa191('0x5'))['db'];var utils=require(_0xa191('0x6'));var logger=require(_0xa191('0x7'))(_0xa191('0x8'));var config=require(_0xa191('0x9'));var jayson=require(_0xa191('0xa'));var client=jayson[_0xa191('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae6ee,_0xe1de49,_0x5d340a){return new BPromise(function(_0xfab268,_0x2216ae){return client['request'](_0x3ae6ee,_0x5d340a)[_0xa191('0xc')](function(_0x23f34a){logger[_0xa191('0xd')](_0xa191('0xe'),_0xe1de49,'request\x20sent');logger[_0xa191('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xe1de49,'request\x20sent',JSON[_0xa191('0x10')](_0x23f34a));if(_0x23f34a[_0xa191('0x11')]){if(_0x23f34a[_0xa191('0x11')][_0xa191('0x12')]===0x1f4){logger[_0xa191('0x11')](_0xa191('0xe'),_0xe1de49,_0x23f34a[_0xa191('0x11')]['message']);return _0x2216ae(_0x23f34a[_0xa191('0x11')]['message']);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xe1de49,_0x23f34a[_0xa191('0x11')][_0xa191('0x13')]);return _0xfab268(_0x23f34a[_0xa191('0x11')][_0xa191('0x13')]);}else{logger['info'](_0xa191('0xe'),_0xe1de49,_0xa191('0x14'));_0xfab268(_0x23f34a['result'][_0xa191('0x13')]);}})[_0xa191('0x15')](function(_0x1c179b){logger[_0xa191('0x11')](_0xa191('0xe'),_0xe1de49,_0x1c179b);_0x2216ae(_0x1c179b);});});}exports[_0xa191('0x16')]=function(_0x3c53bd){var _0x2eeaf2=this;return new Promise(function(_0x5d7155,_0x2644dd){return db[_0xa191('0x17')][_0xa191('0x18')](_0x3c53bd['body'],{'raw':_0x3c53bd[_0xa191('0x19')]?_0x3c53bd[_0xa191('0x19')][_0xa191('0x1a')]===undefined?!![]:![]:!![]})[_0xa191('0xc')](function(_0xe39816){logger['info'](_0xa191('0x16'),_0x3c53bd);logger[_0xa191('0xf')](_0xa191('0x16'),_0x3c53bd,JSON[_0xa191('0x10')](_0xe39816));_0x5d7155(_0xe39816);})[_0xa191('0x15')](function(_0x5f24a7){logger['error'](_0xa191('0x16'),_0x5f24a7[_0xa191('0x13')],_0x3c53bd);_0x2644dd(_0x2eeaf2['error'](0x1f4,_0x5f24a7[_0xa191('0x13')]));});});};exports[_0xa191('0x1b')]=function(_0x2405ce){var _0x346788=this;return new Promise(function(_0x3cbc94,_0x53e8be){return db['CmHopperHistory'][_0xa191('0x1c')]({'raw':_0x2405ce[_0xa191('0x19')]?_0x2405ce[_0xa191('0x19')][_0xa191('0x1a')]===undefined?!![]:![]:!![],'where':_0x2405ce['options']?_0x2405ce['options']['where']||null:null,'attributes':[[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')][_0xa191('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db['sequelize'][_0xa191('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0xa191('0x20')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')]['literal'](_0xa191('0x22')))),_0xa191('0x23')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')]['literal'](_0xa191('0x24')))),_0xa191('0x25')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x26'),db[_0xa191('0x1d')]['fn']('IF',db['sequelize'][_0xa191('0x1f')](_0xa191('0x27')))),_0xa191('0x28')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x26'),db['sequelize']['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x29')))),_0xa191('0x2a')]]})['then'](function(_0x23fe53){logger[_0xa191('0xd')](_0xa191('0x1b'),_0x2405ce);logger[_0xa191('0xf')](_0xa191('0x1b'),_0x2405ce,JSON['stringify'](_0x23fe53));_0x3cbc94(_0x23fe53);})['catch'](function(_0x605ec4){logger[_0xa191('0x11')](_0xa191('0x1b'),_0x605ec4['message'],_0x2405ce);_0x53e8be(_0x346788[_0xa191('0x11')](0x1f4,_0x605ec4['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x5f1900){var _0x3e5b3a=this;return new Promise(function(_0x2c726a,_0x1fa539){return db[_0xa191('0x17')][_0xa191('0x1c')]({'raw':_0x5f1900[_0xa191('0x19')]?_0x5f1900['options'][_0xa191('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f1900['options']?_0x5f1900[_0xa191('0x19')][_0xa191('0x2b')]||null:null,'attributes':[[_0xa191('0x2c'),_0xa191('0x2d')],[db['sequelize']['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xa191('0x2e')))),'outboundNoSuchCallsDay'],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x2f')))),_0xa191('0x30')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')]['literal'](_0xa191('0x31')))),'outboundAnswerCallsDay'],[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x32')))),'outboundCongestionCallsDay'],[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x33')))),_0xa191('0x34')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x35')))),_0xa191('0x36')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x37')))),_0xa191('0x38')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x39')))),_0xa191('0x3a')],[db['sequelize']['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')]['literal'](_0xa191('0x3b')))),_0xa191('0x3c')],[db['sequelize']['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db['sequelize'][_0xa191('0x1f')](_0xa191('0x3d')))),_0xa191('0x3e')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x3f')))),_0xa191('0x40')],[db[_0xa191('0x1d')]['fn']('COUNT',db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x41')))),_0xa191('0x3e')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')][_0xa191('0x1f')](_0xa191('0x42')))),_0xa191('0x43')]],'group':[_0xa191('0x2c')]})[_0xa191('0xc')](function(_0x3e96b7){logger['info'](_0xa191('0x44'),_0x5f1900);logger[_0xa191('0xf')](_0xa191('0x44'),_0x5f1900,JSON[_0xa191('0x10')](_0x3e96b7));_0x2c726a(_0x3e96b7);})['catch'](function(_0xabcbe2){logger[_0xa191('0x11')](_0xa191('0x44'),_0xabcbe2[_0xa191('0x13')],_0x5f1900);_0x1fa539(_0x3e5b3a['error'](0x1f4,_0xabcbe2[_0xa191('0x13')]));});});};exports[_0xa191('0x45')]=function(_0x438f8f){var _0x5c964b=this;return new Promise(function(_0x42f741,_0x4c92aa){return db[_0xa191('0x17')][_0xa191('0x1c')]({'raw':_0x438f8f['options']?_0x438f8f[_0xa191('0x19')][_0xa191('0x1a')]===undefined?!![]:![]:!![],'where':_0x438f8f[_0xa191('0x19')]?_0x438f8f[_0xa191('0x19')][_0xa191('0x2b')]||null:null,'attributes':[[_0xa191('0x2c'),_0xa191('0x2d')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')][_0xa191('0x1e')]('id')),_0xa191('0x46')],[db[_0xa191('0x1d')]['fn'](_0xa191('0x21'),db[_0xa191('0x1d')]['fn']('IF',db[_0xa191('0x1d')]['literal'](_0xa191('0x31')))),_0xa191('0x47')]],'group':[_0xa191('0x2c')]})[_0xa191('0xc')](function(_0x3e9dfa){logger[_0xa191('0xd')](_0xa191('0x45'),_0x438f8f);logger[_0xa191('0xf')](_0xa191('0x45'),_0x438f8f,JSON[_0xa191('0x10')](_0x3e9dfa));_0x42f741(_0x3e9dfa);})[_0xa191('0x15')](function(_0x346f7c){logger['error']('GetCampaignHopperHistory',_0x346f7c[_0xa191('0x13')],_0x438f8f);_0x4c92aa(_0x5c964b[_0xa191('0x11')](0x1f4,_0x346f7c[_0xa191('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 2be005b..c6ce800 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 _0x0d8d=['post','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0d8d,0x92));var _0xd0d8=function(_0x6be029,_0x1ebc18){_0x6be029=_0x6be029-0x0;var _0xe2df60=_0x0d8d[_0x6be029];return _0xe2df60;};'use strict';var multer=require(_0xd0d8('0x0'));var util=require(_0xd0d8('0x1'));var path=require('path');var timeout=require(_0xd0d8('0x2'));var express=require(_0xd0d8('0x3'));var router=express[_0xd0d8('0x4')]();var fs_extra=require(_0xd0d8('0x5'));var auth=require(_0xd0d8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0d8('0x7'));var controller=require(_0xd0d8('0x8'));router[_0xd0d8('0x9')]('/',auth[_0xd0d8('0xa')](),controller[_0xd0d8('0xb')]);router[_0xd0d8('0x9')](_0xd0d8('0xc'),auth[_0xd0d8('0xa')](),controller[_0xd0d8('0xd')]);router[_0xd0d8('0x9')](_0xd0d8('0xe'),auth['isAuthenticated'](),controller[_0xd0d8('0xf')]);router[_0xd0d8('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd0d8('0xe'),auth[_0xd0d8('0xa')](),controller[_0xd0d8('0x11')]);module['exports']=router; \ No newline at end of file +var _0xdef6=['connect-timeout','fs-extra','./cmHopperHistory.controller','get','index','isAuthenticated','describe','/:id','show','create','put','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdef6,0x138));var _0x6def=function(_0x4aeb44,_0x419730){_0x4aeb44=_0x4aeb44-0x0;var _0x1aa240=_0xdef6[_0x4aeb44];return _0x1aa240;};'use strict';var multer=require(_0x6def('0x0'));var util=require(_0x6def('0x1'));var path=require(_0x6def('0x2'));var timeout=require(_0x6def('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6def('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6def('0x5'));router[_0x6def('0x6')]('/',auth['isAuthenticated'](),controller[_0x6def('0x7')]);router[_0x6def('0x6')]('/describe',auth[_0x6def('0x8')](),controller[_0x6def('0x9')]);router[_0x6def('0x6')](_0x6def('0xa'),auth[_0x6def('0x8')](),controller[_0x6def('0xb')]);router['post']('/',auth[_0x6def('0x8')](),controller[_0x6def('0xc')]);router[_0x6def('0xd')](_0x6def('0xa'),auth[_0x6def('0x8')](),controller['update']);module[_0x6def('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 8658aa8..fbb0394 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 _0xae24=['sequelize','STRING'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xae24,0x182));var _0x4ae2=function(_0x5007fe,_0x467c64){_0x5007fe=_0x5007fe-0x0;var _0x110ce2=_0xae24[_0x5007fe];return _0x110ce2;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4ae2('0x1')]},'dialPrefix':{'type':Sequelize[_0x4ae2('0x1')]}}; \ No newline at end of file +var _0x6631=['sequelize','exports','STRING','name'];(function(_0x2ad95d,_0x9d4131){var _0x34322e=function(_0x269a21){while(--_0x269a21){_0x2ad95d['push'](_0x2ad95d['shift']());}};_0x34322e(++_0x9d4131);}(_0x6631,0x134));var _0x1663=function(_0x43566f,_0x122791){_0x43566f=_0x43566f-0x0;var _0x264822=_0x6631[_0x43566f];return _0x264822;};'use strict';var Sequelize=require(_0x1663('0x0'));module[_0x1663('0x1')]={'name':{'type':Sequelize[_0x1663('0x2')],'unique':_0x1663('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1663('0x2')]},'dialPrefix':{'type':Sequelize[_0x1663('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 4ab5ef9..da7847b 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 _0x97dd=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','ListId','each','omit','success','push','message','json','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','getContactsCsv','ContactItemType','alias','select','cm_contacts','c.ListId\x20=\x20?','field','c.cf_','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','list_%d_%s.csv','Content-type','text/csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','switch','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','count','limit','set','reject','save','update','then','destroy','Lists','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','CmList','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error'];(function(_0x30bb21,_0x79b6f8){var _0x41d6e9=function(_0x1f8d07){while(--_0x1f8d07){_0x30bb21['push'](_0x30bb21['shift']());}};_0x41d6e9(++_0x79b6f8);}(_0x97dd,0xef));var _0xd97d=function(_0x511830,_0x40b62b){_0x511830=_0x511830-0x0;var _0x2a78ad=_0x97dd[_0x511830];return _0x2a78ad;};'use strict';var emlformat=require(_0xd97d('0x0'));var rimraf=require(_0xd97d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd97d('0x2'));var rp=require(_0xd97d('0x3'));var moment=require(_0xd97d('0x4'));var BPromise=require(_0xd97d('0x5'));var Mustache=require('mustache');var util=require(_0xd97d('0x6'));var path=require('path');var sox=require(_0xd97d('0x7'));var csv=require(_0xd97d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd97d('0x9'));var _=require(_0xd97d('0xa'));var squel=require(_0xd97d('0xb'));var crypto=require('crypto');var jsforce=require(_0xd97d('0xc'));var deskjs=require(_0xd97d('0xd'));var toCsv=require(_0xd97d('0x8'));var querystring=require('querystring');var Papa=require(_0xd97d('0xe'));var Redis=require(_0xd97d('0xf'));var authService=require(_0xd97d('0x10'));var qs=require(_0xd97d('0x11'));var as=require(_0xd97d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd97d('0x13'))(_0xd97d('0x14'));var utils=require(_0xd97d('0x15'));var config=require(_0xd97d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd97d('0x17'))['db'];var csv_results;config['redis']=_[_0xd97d('0x18')](config[_0xd97d('0x19')],{'host':_0xd97d('0x1a'),'port':0x18eb});var socket=require(_0xd97d('0x1b'))(new Redis(config[_0xd97d('0x19')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x21f32f,_0x11a583){_0x11a583=_0x11a583||0xcc;return function(_0x318422){if(_0x318422){return _0x21f32f[_0xd97d('0x1c')](_0x11a583);}return _0x21f32f[_0xd97d('0x1d')](_0x11a583)[_0xd97d('0x1e')]();};}function respondWithResult(_0x349483,_0x555d16){_0x555d16=_0x555d16||0xc8;return function(_0x21e377){if(_0x21e377){return _0x349483['status'](_0x555d16)['json'](_0x21e377);}};}function respondWithFilteredResult(_0x4a25fe,_0x4f8b1b){return function(_0x2a96b4){if(_0x2a96b4){var _0x2507f6=typeof _0x4f8b1b[_0xd97d('0x1f')]===_0xd97d('0x20')&&typeof _0x4f8b1b['limit']===_0xd97d('0x20');var _0x10061b=_0x2a96b4[_0xd97d('0x21')];var _0x13cbb6=_0x2507f6?0x0:_0x4f8b1b[_0xd97d('0x1f')];var _0x2a51c0=_0x2507f6?_0x2a96b4[_0xd97d('0x21')]:_0x4f8b1b[_0xd97d('0x1f')]+_0x4f8b1b[_0xd97d('0x22')];var _0x313aa5;if(_0x2a51c0>=_0x10061b){_0x2a51c0=_0x10061b;_0x313aa5=0xc8;}else{_0x313aa5=0xce;}_0x4a25fe[_0xd97d('0x1d')](_0x313aa5);return _0x4a25fe[_0xd97d('0x23')]('Content-Range',_0x13cbb6+'-'+_0x2a51c0+'/'+_0x10061b)['json'](_0x2a96b4);}return null;};}function patchUpdates(_0x33b660){return function(_0x162fe8){try{jsonpatch['apply'](_0x162fe8,_0x33b660,!![]);}catch(_0x42ad45){return BPromise[_0xd97d('0x24')](_0x42ad45);}return _0x162fe8[_0xd97d('0x25')]();};}function saveUpdates(_0x4f8fb8,_0xac8d20){return function(_0x4bb724){if(_0x4bb724){return _0x4bb724[_0xd97d('0x26')](_0x4f8fb8)[_0xd97d('0x27')](function(_0x2477e3){return _0x2477e3;});}return null;};}function removeEntity(_0x861c0,_0x2406d0){return function(_0x4e6769){if(_0x4e6769){return _0x4e6769[_0xd97d('0x28')]()[_0xd97d('0x27')](function(){var _0x1a9a09=_0x4e6769['get']({'plain':!![]});var _0x4a5c6a=_0xd97d('0x29');return db[_0xd97d('0x2a')][_0xd97d('0x28')]({'where':{'type':_0x4a5c6a,'resourceId':_0x1a9a09['id']}})[_0xd97d('0x27')](function(){return _0x4e6769;});})[_0xd97d('0x27')](function(){_0x861c0[_0xd97d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fc2ae,_0x3ff801){return function(_0x2ba996){if(!_0x2ba996){_0x4fc2ae[_0xd97d('0x1c')](0x194);}return _0x2ba996;};}function handleError(_0x3397b0,_0x3cefa9){_0x3cefa9=_0x3cefa9||0x1f4;return function(_0x890fc5){logger['error'](_0x890fc5[_0xd97d('0x2b')]);if(_0x890fc5[_0xd97d('0x2c')]){delete _0x890fc5[_0xd97d('0x2c')];}_0x3397b0['status'](_0x3cefa9)[_0xd97d('0x2d')](_0x890fc5);};}exports[_0xd97d('0x2e')]=function(_0x59846b,_0x3a5ac0){var _0x96ebc5={},_0x4dd8ff={},_0x4942d5={'count':0x0,'rows':[]};var _0x3c94a5=_[_0xd97d('0x2f')](db['CmList'][_0xd97d('0x30')],function(_0x238977){return{'name':_0x238977[_0xd97d('0x31')],'type':_0x238977[_0xd97d('0x32')][_0xd97d('0x33')]};});_0x4dd8ff[_0xd97d('0x34')]=_[_0xd97d('0x2f')](_0x3c94a5,_0xd97d('0x2c'));_0x4dd8ff['query']=_[_0xd97d('0x35')](_0x59846b[_0xd97d('0x36')]);_0x4dd8ff[_0xd97d('0x37')]=_[_0xd97d('0x38')](_0x4dd8ff[_0xd97d('0x34')],_0x4dd8ff['query']);_0x96ebc5['attributes']=_[_0xd97d('0x38')](_0x4dd8ff[_0xd97d('0x34')],qs[_0xd97d('0x39')](_0x59846b[_0xd97d('0x36')]['fields']));_0x96ebc5['attributes']=_0x96ebc5[_0xd97d('0x3a')][_0xd97d('0x3b')]?_0x96ebc5[_0xd97d('0x3a')]:_0x4dd8ff['model'];if(!_0x59846b['query'][_0xd97d('0x3c')](_0xd97d('0x3d'))){_0x96ebc5['limit']=qs[_0xd97d('0x22')](_0x59846b[_0xd97d('0x36')]['limit']);_0x96ebc5[_0xd97d('0x1f')]=qs[_0xd97d('0x1f')](_0x59846b[_0xd97d('0x36')][_0xd97d('0x1f')]);}_0x96ebc5[_0xd97d('0x3e')]=qs[_0xd97d('0x3f')](_0x59846b[_0xd97d('0x36')]['sort']);_0x96ebc5['where']=qs[_0xd97d('0x37')](_[_0xd97d('0x40')](_0x59846b['query'],_0x4dd8ff[_0xd97d('0x37')]),_0x3c94a5);if(_0x59846b['query'][_0xd97d('0x41')]){_0x96ebc5[_0xd97d('0x42')]=_['merge'](_0x96ebc5['where'],{'$or':_['map'](_0x3c94a5,function(_0x4dfecb){if(_0x4dfecb[_0xd97d('0x32')]!==_0xd97d('0x43')){var _0x11f5e3={};_0x11f5e3[_0x4dfecb['name']]={'$like':'%'+_0x59846b['query'][_0xd97d('0x41')]+'%'};return _0x11f5e3;}})});}_0x96ebc5=_[_0xd97d('0x44')]({},_0x96ebc5,_0x59846b[_0xd97d('0x45')]);var _0x2d9a15={'where':_0x96ebc5['where']};return db[_0xd97d('0x46')]['count'](_0x2d9a15)[_0xd97d('0x27')](function(_0x52f28b){_0x4942d5[_0xd97d('0x21')]=_0x52f28b;if(_0x59846b[_0xd97d('0x36')]['includeAll']){_0x96ebc5[_0xd97d('0x47')]=[{'all':!![]}];}return db[_0xd97d('0x46')][_0xd97d('0x48')](_0x96ebc5);})['then'](function(_0x16c9e8){_0x4942d5[_0xd97d('0x49')]=_0x16c9e8;return _0x4942d5;})['then'](respondWithFilteredResult(_0x3a5ac0,_0x96ebc5))[_0xd97d('0x4a')](handleError(_0x3a5ac0,null));};exports[_0xd97d('0x4b')]=function(_0xa5dc84,_0x4b1ec0){var _0x4dea65={'raw':![],'where':{'id':_0xa5dc84[_0xd97d('0x4c')]['id']}},_0x74d893={};_0x74d893[_0xd97d('0x34')]=_['keys'](db['CmList'][_0xd97d('0x30')]);_0x74d893[_0xd97d('0x36')]=_[_0xd97d('0x35')](_0xa5dc84['query']);_0x74d893[_0xd97d('0x37')]=_['intersection'](_0x74d893[_0xd97d('0x34')],_0x74d893[_0xd97d('0x36')]);_0x4dea65[_0xd97d('0x3a')]=_[_0xd97d('0x38')](_0x74d893[_0xd97d('0x34')],qs[_0xd97d('0x39')](_0xa5dc84[_0xd97d('0x36')]['fields']));_0x4dea65['attributes']=_0x4dea65[_0xd97d('0x3a')][_0xd97d('0x3b')]?_0x4dea65[_0xd97d('0x3a')]:_0x74d893[_0xd97d('0x34')];if(_0xa5dc84[_0xd97d('0x36')][_0xd97d('0x4d')]){_0x4dea65[_0xd97d('0x47')]=[{'all':!![]}];}_0x4dea65=_[_0xd97d('0x44')]({},_0x4dea65,_0xa5dc84['options']);return db['CmList'][_0xd97d('0x4e')](_0x4dea65)[_0xd97d('0x27')](handleEntityNotFound(_0x4b1ec0,null))[_0xd97d('0x27')](respondWithResult(_0x4b1ec0,null))[_0xd97d('0x4a')](handleError(_0x4b1ec0,null));};exports[_0xd97d('0x4f')]=function(_0x79798c,_0x1aafec){return db[_0xd97d('0x46')][_0xd97d('0x4f')](_0x79798c[_0xd97d('0x50')],{})[_0xd97d('0x27')](function(_0x53e1d7){var _0x11dd2f=_0x79798c[_0xd97d('0x51')][_0xd97d('0x52')]({'plain':!![]});if(!_0x11dd2f)throw new Error(_0xd97d('0x53'));if(_0x11dd2f['role']===_0xd97d('0x51')){var _0x5f08bd=_0x53e1d7[_0xd97d('0x52')]({'plain':!![]});var _0x266ac4=_0xd97d('0x29');return db[_0xd97d('0x54')][_0xd97d('0x4e')]({'where':{'name':_0x266ac4,'userProfileId':_0x11dd2f[_0xd97d('0x55')]},'raw':!![]})[_0xd97d('0x27')](function(_0x2da924){if(_0x2da924&&_0x2da924['autoAssociation']===0x0){return db[_0xd97d('0x2a')][_0xd97d('0x4f')]({'name':_0x5f08bd[_0xd97d('0x2c')],'resourceId':_0x5f08bd['id'],'type':_0x2da924['name'],'sectionId':_0x2da924['id']},{})[_0xd97d('0x27')](function(){return _0x53e1d7;});}else{return _0x53e1d7;}})[_0xd97d('0x4a')](function(_0x165c82){logger[_0xd97d('0x56')](_0xd97d('0x57'),_0x165c82);throw _0x165c82;});}return _0x53e1d7;})[_0xd97d('0x27')](respondWithResult(_0x1aafec,0xc9))[_0xd97d('0x4a')](handleError(_0x1aafec,null));};exports[_0xd97d('0x26')]=function(_0x9a1f96,_0x1b03c0){if(_0x9a1f96[_0xd97d('0x50')]['id']){delete _0x9a1f96[_0xd97d('0x50')]['id'];}return db[_0xd97d('0x46')][_0xd97d('0x4e')]({'where':{'id':_0x9a1f96['params']['id']}})[_0xd97d('0x27')](handleEntityNotFound(_0x1b03c0,null))['then'](saveUpdates(_0x9a1f96[_0xd97d('0x50')],null))[_0xd97d('0x27')](respondWithResult(_0x1b03c0,null))[_0xd97d('0x4a')](handleError(_0x1b03c0,null));};exports[_0xd97d('0x28')]=function(_0x5c4991,_0x4139c6){return db[_0xd97d('0x46')]['find']({'where':{'id':_0x5c4991['params']['id']}})[_0xd97d('0x27')](handleEntityNotFound(_0x4139c6,null))[_0xd97d('0x27')](removeEntity(_0x4139c6,null))['catch'](handleError(_0x4139c6,null));};exports[_0xd97d('0x58')]=function(_0x3789e4,_0x358a23){return db[_0xd97d('0x46')]['describe']()[_0xd97d('0x27')](respondWithResult(_0x358a23,null))[_0xd97d('0x4a')](handleError(_0x358a23,null));};exports['addDisposition']=function(_0x471d9f,_0x1d3e15,_0x26a9cd){if(_0x471d9f[_0xd97d('0x50')]['id']){delete _0x471d9f[_0xd97d('0x50')]['id'];}return db['CmList'][_0xd97d('0x4e')]({'where':{'id':_0x471d9f['params']['id']}})['then'](handleEntityNotFound(_0x1d3e15,null))[_0xd97d('0x27')](function(_0x55df30){if(_0x55df30){_0x471d9f['body']['ListId']=_0x55df30['id'];return db[_0xd97d('0x59')][_0xd97d('0x4f')](_0x471d9f[_0xd97d('0x50')]);}})[_0xd97d('0x27')](respondWithResult(_0x1d3e15,null))[_0xd97d('0x4a')](handleError(_0x1d3e15,null));};exports[_0xd97d('0x5a')]=function(_0x185dac,_0x2849ea,_0x451195){var _0x10996a={'raw':![],'where':{}};var _0x1c44ee={};var _0x16837c={'count':0x0,'rows':[]};return db[_0xd97d('0x46')]['findOne']({'where':{'id':_0x185dac[_0xd97d('0x4c')]['id']}})[_0xd97d('0x27')](handleEntityNotFound(_0x2849ea,null))[_0xd97d('0x27')](function(_0x2e5243){if(_0x2e5243){_0x1c44ee['model']=_[_0xd97d('0x35')](db[_0xd97d('0x59')][_0xd97d('0x30')]);_0x1c44ee['query']=_[_0xd97d('0x35')](_0x185dac[_0xd97d('0x36')]);_0x1c44ee[_0xd97d('0x37')]=_[_0xd97d('0x38')](_0x1c44ee[_0xd97d('0x34')],_0x1c44ee[_0xd97d('0x36')]);_0x10996a[_0xd97d('0x3a')]=_[_0xd97d('0x38')](_0x1c44ee[_0xd97d('0x34')],qs[_0xd97d('0x39')](_0x185dac[_0xd97d('0x36')][_0xd97d('0x39')]));_0x10996a[_0xd97d('0x3a')]=_0x10996a[_0xd97d('0x3a')][_0xd97d('0x3b')]?_0x10996a['attributes']:_0x1c44ee['model'];if(!_0x185dac[_0xd97d('0x36')][_0xd97d('0x3c')](_0xd97d('0x3d'))){_0x10996a[_0xd97d('0x22')]=qs[_0xd97d('0x22')](_0x185dac[_0xd97d('0x36')][_0xd97d('0x22')]);_0x10996a[_0xd97d('0x1f')]=qs[_0xd97d('0x1f')](_0x185dac[_0xd97d('0x36')]['offset']);}_0x10996a[_0xd97d('0x3e')]=qs[_0xd97d('0x3f')](_0x185dac[_0xd97d('0x36')][_0xd97d('0x3f')]);_0x10996a['where']=qs[_0xd97d('0x37')](_[_0xd97d('0x40')](_0x185dac[_0xd97d('0x36')],_0x1c44ee[_0xd97d('0x37')]));_0x10996a[_0xd97d('0x42')]['ListId']=_0x2e5243['id'];if(_0x185dac[_0xd97d('0x36')][_0xd97d('0x41')]){_0x10996a['where']=_[_0xd97d('0x44')](_0x10996a['where'],{'$or':_[_0xd97d('0x2f')](_0x10996a[_0xd97d('0x3a')],function(_0x3c7658){var _0x277c65={};_0x277c65[_0x3c7658]={'$like':'%'+_0x185dac[_0xd97d('0x36')][_0xd97d('0x41')]+'%'};return _0x277c65;})});}_0x10996a=_[_0xd97d('0x44')]({},_0x10996a,_0x185dac[_0xd97d('0x45')]);return db[_0xd97d('0x59')][_0xd97d('0x21')]({'where':_0x10996a[_0xd97d('0x42')]})[_0xd97d('0x27')](function(_0x4f2550){_0x16837c[_0xd97d('0x21')]=_0x4f2550;if(_0x185dac[_0xd97d('0x36')][_0xd97d('0x4d')]){_0x10996a[_0xd97d('0x47')]=[{'all':!![]}];}return db[_0xd97d('0x59')]['findAll'](_0x10996a);})[_0xd97d('0x27')](function(_0x357b64){_0x16837c[_0xd97d('0x49')]=_0x357b64;return _0x16837c;});}})[_0xd97d('0x27')](respondWithFilteredResult(_0x2849ea,_0x10996a))[_0xd97d('0x4a')](handleError(_0x2849ea,null));};exports[_0xd97d('0x5b')]=function(_0x262a77,_0x6adbf3,_0x2d9e36){return db[_0xd97d('0x46')][_0xd97d('0x4e')]({'where':{'id':_0x262a77[_0xd97d('0x4c')]['id']}})[_0xd97d('0x27')](handleEntityNotFound(_0x6adbf3,null))[_0xd97d('0x27')](function(_0x4745d6){if(_0x4745d6){return _0x4745d6[_0xd97d('0x5b')](_0x262a77[_0xd97d('0x36')][_0xd97d('0x5c')]);}})[_0xd97d('0x27')](respondWithStatusCode(_0x6adbf3,null))['catch'](handleError(_0x6adbf3,null));};exports[_0xd97d('0x5d')]=function(_0xd6fe15,_0x8b6a5a,_0x4090d4){return db[_0xd97d('0x46')][_0xd97d('0x4e')]({'where':{'id':_0xd6fe15[_0xd97d('0x4c')]['id']}})[_0xd97d('0x27')](handleEntityNotFound(_0x8b6a5a,null))[_0xd97d('0x27')](function(_0x489ea9){if(_0x489ea9){var _0x180c24=[];var _0x27d6d2={'success':[],'errors':[]};return db[_0xd97d('0x5e')][_0xd97d('0x58')]()['then'](function(_0x463a41){if(_0xd6fe15[_0xd97d('0x50')]['tags']&&_[_0xd97d('0x5f')](_0xd6fe15[_0xd97d('0x50')][_0xd97d('0x60')])){if(_0xd6fe15[_0xd97d('0x50')][_0xd97d('0x60')][_0xd97d('0x3b')]){_0xd6fe15[_0xd97d('0x50')][_0xd97d('0x60')]=_0xd6fe15[_0xd97d('0x50')][_0xd97d('0x60')][_0xd97d('0x61')](';')+';';}else{_0xd6fe15[_0xd97d('0x50')][_0xd97d('0x60')]=null;}}else{_0xd6fe15[_0xd97d('0x50')][_0xd97d('0x60')]=null;}if(_0xd6fe15[_0xd97d('0x50')]&&_[_0xd97d('0x5f')](_0xd6fe15['body'])){for(var _0x1404d6=0x0;_0x1404d6<_0xd6fe15['body']['length'];_0x1404d6+=0x1){_0xd6fe15[_0xd97d('0x50')][_0x1404d6][_0xd97d('0x62')]=_0xd6fe15[_0xd97d('0x4c')]['id'];_0x180c24['push'](_0xd6fe15['body'][_0x1404d6]);}return BPromise[_0xd97d('0x63')](_0x180c24,function(_0x375694){return db[_0xd97d('0x5e')]['create'](_[_0xd97d('0x64')](_0x375694,[_0xd97d('0x5c'),'id'])||{},{'fields':_[_0xd97d('0x35')](_0x463a41),'raw':!![]})['then'](function(_0x3cb78a){_0x27d6d2[_0xd97d('0x65')][_0xd97d('0x66')](_0x3cb78a['dataValues']);})[_0xd97d('0x4a')](function(_0x1056e5){_0x27d6d2['errors'][_0xd97d('0x66')]({'data':_0x375694,'error':_0x1056e5[_0xd97d('0x67')]});});})[_0xd97d('0x27')](function(_0x47ab0c){return _0x27d6d2;})[_0xd97d('0x4a')](function(_0x520471){return _0x520471;});}else{_0x8b6a5a['status'](0x190)[_0xd97d('0x68')]({'message':_0xd97d('0x69')});}});}})[_0xd97d('0x27')](respondWithResult(_0x8b6a5a,null))[_0xd97d('0x4a')](handleError(_0x8b6a5a,null));};exports[_0xd97d('0x6a')]=function(_0x44da97,_0x1061a1,_0x469c98){var _0xbe302d;return db[_0xd97d('0x46')]['find']({'where':{'id':_0x44da97['params']['id']},'include':[{'model':db[_0xd97d('0x6b')],'as':_0xd97d('0x6c')}]})['then'](handleEntityNotFound(_0x1061a1,null))[_0xd97d('0x27')](function(_0x2621f4){if(_0x2621f4){_0xbe302d=_0x2621f4;return db[_0xd97d('0x5e')][_0xd97d('0x30')];}})[_0xd97d('0x27')](function(_0x205778){if(_0x205778){var _0x3f2397={};var _0xb8cced={};_0xb8cced[_0xd97d('0x34')]=_[_0xd97d('0x6d')](_['keys'](_0x205778),_['map'](_0xbe302d['CustomFields'],function(_0x1529e5){return util['format'](_0xd97d('0x6e'),_0x1529e5['id']);}));_0xb8cced[_0xd97d('0x36')]=_['keys'](_0x44da97[_0xd97d('0x36')]);_0xb8cced[_0xd97d('0x37')]=_[_0xd97d('0x38')](_0xb8cced['model'],_0xb8cced[_0xd97d('0x36')]);_0x3f2397[_0xd97d('0x3a')]=_[_0xd97d('0x38')](_0xb8cced['model'],qs[_0xd97d('0x39')](_0x44da97[_0xd97d('0x36')][_0xd97d('0x39')]));_0x3f2397[_0xd97d('0x3a')]=_0x3f2397['attributes'][_0xd97d('0x3b')]?_0x3f2397[_0xd97d('0x3a')]:_0xb8cced[_0xd97d('0x34')];if(!_0x44da97[_0xd97d('0x36')][_0xd97d('0x3c')](_0xd97d('0x3d'))){_0x3f2397[_0xd97d('0x22')]=qs[_0xd97d('0x22')](_0x44da97['query'][_0xd97d('0x22')]);_0x3f2397[_0xd97d('0x1f')]=qs[_0xd97d('0x1f')](_0x44da97[_0xd97d('0x36')][_0xd97d('0x1f')]);}_0x3f2397[_0xd97d('0x3e')]=qs['sort'](_0x44da97[_0xd97d('0x36')][_0xd97d('0x3f')]);_0x3f2397[_0xd97d('0x42')]=qs['filters'](_[_0xd97d('0x40')](_0x44da97[_0xd97d('0x36')],_0xb8cced[_0xd97d('0x37')]));_0x3f2397['raw']=!![];if(_0x44da97['query'][_0xd97d('0x41')]){_0x3f2397['where']=_[_0xd97d('0x44')](_0x3f2397[_0xd97d('0x42')],{'$or':_[_0xd97d('0x2f')](_0x3f2397['attributes'],function(_0xde5231){var _0x14deac={};_0x14deac[_0xde5231]={'$like':'%'+_0x44da97[_0xd97d('0x36')][_0xd97d('0x41')]+'%'};return _0x14deac;})});}_0x3f2397=_['merge']({},_0x3f2397,_0x44da97[_0xd97d('0x45')]);return _0xbe302d['getContacts'](_0x3f2397);}})[_0xd97d('0x27')](respondWithResult(_0x1061a1,null))[_0xd97d('0x4a')](handleError(_0x1061a1,null));};exports[_0xd97d('0x6f')]=function(_0x1d4604,_0x52998a,_0x210537){var _0x4b16ed;var _0x24007e;var _0x1aa3b3;var _0x88296b=_0x1d4604[_0xd97d('0x4c')]['id'];csv_results=[];return db[_0xd97d('0x70')][_0xd97d('0x48')]({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})[_0xd97d('0x27')](function(_0x35cc9e){_0x4b16ed=_0x35cc9e;var _0x193f10=_[_0xd97d('0x35')](db[_0xd97d('0x5e')]['rawAttributes']);return db[_0xd97d('0x6b')][_0xd97d('0x48')]({'raw':!![],'attributes':['id',_0xd97d('0x71')]})[_0xd97d('0x27')](function(_0x12531a){_0x24007e=_0x12531a;var _0x5ce853=squel[_0xd97d('0x72')]()[_0xd97d('0x39')](_0x193f10)['from'](_0xd97d('0x73'),'c')[_0xd97d('0x42')](_0xd97d('0x74'),_0x88296b)[_0xd97d('0x42')]('c.deletedAt\x20is\x20null')['distinct']();for(var _0x41db12=0x0;_0x41db12<_0x24007e['length'];_0x41db12++){_0x5ce853[_0xd97d('0x75')](_0xd97d('0x76')+_0x24007e[_0x41db12]['id'],_0xd97d('0x77')+_0x24007e[_0x41db12][_0xd97d('0x71')]);}for(var _0x41db12=0x0;_0x41db12<_0x4b16ed[_0xd97d('0x3b')];_0x41db12++){_0x5ce853['field'](squel['select']()['field'](_0xd97d('0x78'))[_0xd97d('0x79')](_0xd97d('0x7a'))[_0xd97d('0x42')](_0xd97d('0x7b'),_0x4b16ed[_0x41db12]['id'])[_0xd97d('0x42')](_0xd97d('0x7c')),_0xd97d('0x7d')+_0x4b16ed[_0x41db12][_0xd97d('0x2c')]);_0x5ce853[_0xd97d('0x75')](squel['select']()['field'](_0xd97d('0x7e'))[_0xd97d('0x79')](_0xd97d('0x7a'))[_0xd97d('0x42')](_0xd97d('0x7b'),_0x4b16ed[_0x41db12]['id'])[_0xd97d('0x42')](_0xd97d('0x7c')),_0xd97d('0x7f')+_0x4b16ed[_0x41db12][_0xd97d('0x2c')]);}var _0x5053ad=[];_0x5053ad['push'](_0x5ce853[_0xd97d('0x80')]());BPromise[_0xd97d('0x63')](_0x5053ad,handleQuery)[_0xd97d('0x27')](function(_0x447f46){handleQuery(_0x5ce853[_0xd97d('0x80')]());var _0x3a3f0c=csv_results[0x0];if(!_[_0xd97d('0x81')](_0x3a3f0c)){var _0x2dc6b7=toCsv(_0x3a3f0c);var _0x2e8feb=Date[_0xd97d('0x82')]();fs['writeFileSync'](util['format'](_0xd97d('0x83'),_0x88296b,_0x2e8feb),_0x2dc6b7);_0x52998a[_0xd97d('0x84')](_0xd97d('0x85'),_0xd97d('0x86')+util[_0xd97d('0x87')](_0xd97d('0x88'),_0x88296b,_0x2e8feb));_0x52998a[_0xd97d('0x84')](_0xd97d('0x89'),_0xd97d('0x8a'));return _0x52998a['download'](util[_0xd97d('0x87')](_0xd97d('0x83'),_0x88296b,_0x2e8feb));}else{return _0x52998a[_0xd97d('0x1c')](0xcc);}});});});};exports[_0xd97d('0x8b')]=function(_0x3ac42e,_0x2086d7,_0x44bcc4){var _0x213ced;delete _0x3ac42e[_0xd97d('0x50')]['id'];return db[_0xd97d('0x46')][_0xd97d('0x8c')]({'where':{'id':_0x3ac42e['params']['id']}})['then'](handleEntityNotFound(_0x2086d7,null))['then'](function(_0x3c9ac9){if(_0x3c9ac9){return db[_0xd97d('0x8d')][_0xd97d('0x8e')](function(_0x25eb12){return db[_0xd97d('0x6b')][_0xd97d('0x4f')](_0x3ac42e[_0xd97d('0x50')],{'transaction':_0x25eb12})['then'](function(_0x983422){_0x213ced=_0x983422;return _0x3c9ac9[_0xd97d('0x8f')](_0x983422,{'transaction':_0x25eb12});})[_0xd97d('0x27')](function(){var _0x4ce422={'type':db[_0xd97d('0x90')][_0xd97d('0x91')],'transaction':_0x25eb12};switch(_0x3ac42e['body'][_0xd97d('0x32')]){case'text':_0x4ce422[_0xd97d('0x32')]=db[_0xd97d('0x90')][_0xd97d('0x91')];break;case _0xd97d('0x92'):_0x4ce422['type']=db['Sequelize']['INTEGER'];break;case _0xd97d('0x93'):_0x4ce422[_0xd97d('0x32')]=db[_0xd97d('0x90')]['BOOLEAN'];_0x4ce422[_0xd97d('0x94')]=![];break;default:}return db[_0xd97d('0x8d')][_0xd97d('0x95')]['addColumn']('cm_contacts',util[_0xd97d('0x87')](_0xd97d('0x96'),_0x213ced['id']),_0x4ce422);})[_0xd97d('0x27')](function(){return _0x213ced;});});}})['then'](respondWithResult(_0x2086d7,null))['catch'](handleError(_0x2086d7,null));};exports[_0xd97d('0x97')]=function(_0x47901d,_0x27d4e9,_0x27519a){var _0x3fd945={};var _0x2976bc={};var _0x2e5ae3;var _0x30e383;return db[_0xd97d('0x46')][_0xd97d('0x8c')]({'where':{'id':_0x47901d[_0xd97d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x27d4e9,null))[_0xd97d('0x27')](function(_0x37e53c){if(_0x37e53c){_0x2e5ae3=_0x37e53c;_0x2976bc['model']=_[_0xd97d('0x35')](db[_0xd97d('0x6b')][_0xd97d('0x30')]);_0x2976bc[_0xd97d('0x36')]=_['keys'](_0x47901d[_0xd97d('0x36')]);_0x2976bc['filters']=_[_0xd97d('0x38')](_0x2976bc[_0xd97d('0x34')],_0x2976bc[_0xd97d('0x36')]);_0x3fd945[_0xd97d('0x3a')]=_[_0xd97d('0x38')](_0x2976bc['model'],qs[_0xd97d('0x39')](_0x47901d[_0xd97d('0x36')][_0xd97d('0x39')]));_0x3fd945[_0xd97d('0x3a')]=_0x3fd945[_0xd97d('0x3a')][_0xd97d('0x3b')]?_0x3fd945[_0xd97d('0x3a')]:_0x2976bc['model'];_0x3fd945['order']=qs[_0xd97d('0x3f')](_0x47901d[_0xd97d('0x36')][_0xd97d('0x3f')]);_0x3fd945[_0xd97d('0x42')]=qs[_0xd97d('0x37')](_[_0xd97d('0x40')](_0x47901d[_0xd97d('0x36')],_0x2976bc[_0xd97d('0x37')]));_0x3fd945['where']=_[_0xd97d('0x44')](_0x3fd945[_0xd97d('0x42')],{'$or':[{'ListId':_0x37e53c['id']},{'ListId':null}]});if(_0x47901d[_0xd97d('0x36')][_0xd97d('0x41')]){_0x3fd945['where']=_['merge'](_0x3fd945[_0xd97d('0x42')],{'$or':_['map'](_0x3fd945[_0xd97d('0x3a')],function(_0x3eec79){var _0x2d3137={};_0x2d3137[_0x3eec79]={'$like':'%'+_0x47901d['query'][_0xd97d('0x41')]+'%'};return _0x2d3137;})});}_0x3fd945=_[_0xd97d('0x44')]({},_0x3fd945,_0x47901d[_0xd97d('0x45')]);return db[_0xd97d('0x6b')][_0xd97d('0x98')](_0x3fd945);}})[_0xd97d('0x27')](respondWithResult(_0x27d4e9,null))[_0xd97d('0x4a')](handleError(_0x27d4e9,null));};exports[_0xd97d('0x99')]=function(_0xb707b2,_0xeff0b6){return db[_0xd97d('0x6b')][_0xd97d('0x98')]({'where':{'ListId':null}})[_0xd97d('0x27')](handleEntityNotFound(_0xeff0b6,null))[_0xd97d('0x27')](function(_0x8df2b0){return _0x8df2b0;})['then'](respondWithResult(_0xeff0b6,null))['catch'](handleError(_0xeff0b6,null));};exports[_0xd97d('0x9a')]=function(_0x283a82,_0x281ae4,_0x546e0f){return db[_0xd97d('0x46')][_0xd97d('0x4e')]({'where':{'id':_0x283a82['params']['id']}})[_0xd97d('0x27')](handleEntityNotFound(_0x281ae4,null))[_0xd97d('0x27')](function(_0x5c7e8e){if(_0x5c7e8e){return _0x5c7e8e[_0xd97d('0x9a')](_0x283a82[_0xd97d('0x50')][_0xd97d('0x5c')],_[_0xd97d('0x64')](_0x283a82[_0xd97d('0x50')],[_0xd97d('0x5c'),'id'])||{})[_0xd97d('0x9b')](function(_0xf91919){for(var _0x33883e=0x0;_0x33883e<_0x283a82[_0xd97d('0x50')][_0xd97d('0x5c')]['length'];_0x33883e+=0x1){socket['emit'](_0xd97d('0x9c'),{'UserId':Number(_0x283a82[_0xd97d('0x50')][_0xd97d('0x5c')][_0x33883e]),'CmListId':Number(_0x283a82[_0xd97d('0x4c')]['id'])});}return _0xf91919;});}})[_0xd97d('0x27')](respondWithResult(_0x281ae4,null))['catch'](handleError(_0x281ae4,null));};exports[_0xd97d('0x9d')]=function(_0x3fbcad,_0x553e19,_0x2d694b){return db[_0xd97d('0x46')][_0xd97d('0x4e')]({'where':{'id':_0x3fbcad['params']['id']}})[_0xd97d('0x27')](handleEntityNotFound(_0x553e19,null))['then'](function(_0x37d8ee){if(_0x37d8ee){return _0x37d8ee[_0xd97d('0x9d')](_0x3fbcad['query'][_0xd97d('0x5c')])['then'](function(){if(_[_0xd97d('0x5f')](_0x3fbcad[_0xd97d('0x36')][_0xd97d('0x5c')])){for(var _0x2c56c2=0x0;_0x2c56c2<_0x3fbcad['query'][_0xd97d('0x5c')][_0xd97d('0x3b')];_0x2c56c2+=0x1){socket[_0xd97d('0x9e')]('userCmList:remove',{'UserId':Number(_0x3fbcad[_0xd97d('0x36')][_0xd97d('0x5c')][_0x2c56c2]),'CmListId':Number(_0x3fbcad['params']['id'])});}}else{socket[_0xd97d('0x9e')](_0xd97d('0x9f'),{'UserId':Number(_0x3fbcad[_0xd97d('0x36')][_0xd97d('0x5c')]),'CmListId':Number(_0x3fbcad[_0xd97d('0x4c')]['id'])});}});}})[_0xd97d('0x27')](respondWithStatusCode(_0x553e19,null))[_0xd97d('0x4a')](handleError(_0x553e19,null));};exports[_0xd97d('0xa0')]=function(_0x5d157c,_0x5a71c1,_0x424a8d){var _0x5dc709={};var _0x30f98d={};var _0xa7964f;var _0x493100;return db[_0xd97d('0x46')][_0xd97d('0x8c')]({'where':{'id':_0x5d157c[_0xd97d('0x4c')]['id']}})[_0xd97d('0x27')](handleEntityNotFound(_0x5a71c1,null))[_0xd97d('0x27')](function(_0x5f4356){if(_0x5f4356){_0xa7964f=_0x5f4356;_0x30f98d[_0xd97d('0x34')]=_[_0xd97d('0x35')](db[_0xd97d('0xa1')][_0xd97d('0x30')]);_0x30f98d[_0xd97d('0x36')]=_[_0xd97d('0x35')](_0x5d157c['query']);_0x30f98d[_0xd97d('0x37')]=_['intersection'](_0x30f98d['model'],_0x30f98d[_0xd97d('0x36')]);_0x5dc709['attributes']=_[_0xd97d('0x38')](_0x30f98d[_0xd97d('0x34')],qs['fields'](_0x5d157c[_0xd97d('0x36')][_0xd97d('0x39')]));_0x5dc709[_0xd97d('0x3a')]=_0x5dc709[_0xd97d('0x3a')][_0xd97d('0x3b')]?_0x5dc709['attributes']:_0x30f98d[_0xd97d('0x34')];_0x5dc709[_0xd97d('0x3e')]=qs[_0xd97d('0x3f')](_0x5d157c[_0xd97d('0x36')][_0xd97d('0x3f')]);_0x5dc709['where']=qs[_0xd97d('0x37')](_[_0xd97d('0x40')](_0x5d157c[_0xd97d('0x36')],_0x30f98d[_0xd97d('0x37')]));if(_0x5d157c[_0xd97d('0x36')][_0xd97d('0x41')]){_0x5dc709[_0xd97d('0x42')]=_[_0xd97d('0x44')](_0x5dc709[_0xd97d('0x42')],{'$or':_[_0xd97d('0x2f')](_0x5dc709[_0xd97d('0x3a')],function(_0x5444bd){var _0x2fc71e={};_0x2fc71e[_0x5444bd]={'$like':'%'+_0x5d157c[_0xd97d('0x36')][_0xd97d('0x41')]+'%'};return _0x2fc71e;})});}_0x5dc709=_[_0xd97d('0x44')]({},_0x5dc709,_0x5d157c[_0xd97d('0x45')]);return _0xa7964f[_0xd97d('0xa0')](_0x5dc709);}})[_0xd97d('0x27')](function(_0x532c27){if(_0x532c27){_0x493100=_0x532c27[_0xd97d('0x3b')];if(!_0x5d157c['query']['hasOwnProperty'](_0xd97d('0x3d'))){_0x5dc709[_0xd97d('0x22')]=qs[_0xd97d('0x22')](_0x5d157c[_0xd97d('0x36')][_0xd97d('0x22')]);_0x5dc709['offset']=qs['offset'](_0x5d157c[_0xd97d('0x36')][_0xd97d('0x1f')]);}return _0xa7964f['getAgents'](_0x5dc709);}})[_0xd97d('0x27')](function(_0xd1dda5){if(_0xd1dda5){return _0xd1dda5?{'count':_0x493100,'rows':_0xd1dda5}:null;}})['then'](respondWithResult(_0x5a71c1,null))[_0xd97d('0x4a')](handleError(_0x5a71c1,null));};function handleQuery(_0xe5fa2a){logger[_0xd97d('0xa2')](_0xe5fa2a);return db['sequelize'][_0xd97d('0x36')](_0xe5fa2a)[_0xd97d('0x9b')](function(_0x53dffc){csv_results[_0xd97d('0x66')](_0x53dffc);})[_0xd97d('0x4a')](function(_0x7a9e63){logger[_0xd97d('0x56')](_0x7a9e63[_0xd97d('0x67')]);});} \ No newline at end of file +var _0xd9a3=['ids','CmContact','tags','join','isArray','push','each','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','getContacts','getContactsCsv','ContactItemType','findAll','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','item','cm_contact_has_items','additionalPhone_','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','findOne','sequelize','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','Lists','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','include','params','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','find','ListId','Disposition','getDispositions','nolimit','order','includeAll','removeDispositions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd9a3,0x18a));var _0x3d9a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd9a3[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x3d9a('0x0'));var rimraf=require(_0x3d9a('0x1'));var zipdir=require(_0x3d9a('0x2'));var jsonpatch=require(_0x3d9a('0x3'));var rp=require(_0x3d9a('0x4'));var moment=require(_0x3d9a('0x5'));var BPromise=require(_0x3d9a('0x6'));var Mustache=require(_0x3d9a('0x7'));var util=require(_0x3d9a('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d9a('0x9'));var fs=require('fs');var fs_extra=require(_0x3d9a('0xa'));var _=require(_0x3d9a('0xb'));var squel=require(_0x3d9a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d9a('0xd'));var toCsv=require(_0x3d9a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3d9a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3d9a('0x10'));var hardwareService=require(_0x3d9a('0x11'));var logger=require('../../config/logger')(_0x3d9a('0x12'));var utils=require(_0x3d9a('0x13'));var config=require(_0x3d9a('0x14'));var licenseUtil=require(_0x3d9a('0x15'));var db=require(_0x3d9a('0x16'))['db'];var csv_results;config[_0x3d9a('0x17')]=_[_0x3d9a('0x18')](config[_0x3d9a('0x17')],{'host':_0x3d9a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d9a('0x17')]));require(_0x3d9a('0x1a'))[_0x3d9a('0x1b')](socket);function respondWithStatusCode(_0x3878db,_0x394c6f){_0x394c6f=_0x394c6f||0xcc;return function(_0xb23082){if(_0xb23082){return _0x3878db['sendStatus'](_0x394c6f);}return _0x3878db['status'](_0x394c6f)['end']();};}function respondWithResult(_0x196057,_0x4cd680){_0x4cd680=_0x4cd680||0xc8;return function(_0x4bc31c){if(_0x4bc31c){return _0x196057[_0x3d9a('0x1c')](_0x4cd680)['json'](_0x4bc31c);}};}function respondWithFilteredResult(_0x498f3d,_0x23f46f){return function(_0x27a921){if(_0x27a921){var _0x2dd87a=typeof _0x23f46f['offset']===_0x3d9a('0x1d')&&typeof _0x23f46f[_0x3d9a('0x1e')]===_0x3d9a('0x1d');var _0x27c3ef=_0x27a921[_0x3d9a('0x1f')];var _0x5701c9=_0x2dd87a?0x0:_0x23f46f[_0x3d9a('0x20')];var _0x340ef5=_0x2dd87a?_0x27a921[_0x3d9a('0x1f')]:_0x23f46f[_0x3d9a('0x20')]+_0x23f46f[_0x3d9a('0x1e')];var _0x35ffcb;if(_0x340ef5>=_0x27c3ef){_0x340ef5=_0x27c3ef;_0x35ffcb=0xc8;}else{_0x35ffcb=0xce;}_0x498f3d['status'](_0x35ffcb);return _0x498f3d[_0x3d9a('0x21')](_0x3d9a('0x22'),_0x5701c9+'-'+_0x340ef5+'/'+_0x27c3ef)[_0x3d9a('0x23')](_0x27a921);}return null;};}function patchUpdates(_0x6e5105){return function(_0xba397){try{jsonpatch[_0x3d9a('0x24')](_0xba397,_0x6e5105,!![]);}catch(_0x3b3ec9){return BPromise[_0x3d9a('0x25')](_0x3b3ec9);}return _0xba397[_0x3d9a('0x26')]();};}function saveUpdates(_0x47525c,_0xdbc9da){return function(_0x4963f5){if(_0x4963f5){return _0x4963f5['update'](_0x47525c)[_0x3d9a('0x27')](function(_0xb12d82){return _0xb12d82;});}return null;};}function removeEntity(_0x1d91b0,_0x29ecb0){return function(_0x555819){if(_0x555819){return _0x555819[_0x3d9a('0x28')]()[_0x3d9a('0x27')](function(){var _0x12457f=_0x555819[_0x3d9a('0x29')]({'plain':!![]});var _0x355940=_0x3d9a('0x2a');return db[_0x3d9a('0x2b')][_0x3d9a('0x28')]({'where':{'type':_0x355940,'resourceId':_0x12457f['id']}})[_0x3d9a('0x27')](function(){return _0x555819;});})[_0x3d9a('0x27')](function(){_0x1d91b0[_0x3d9a('0x1c')](0xcc)[_0x3d9a('0x2c')]();});}};}function handleEntityNotFound(_0x11c8d5,_0x40c78b){return function(_0x480a94){if(!_0x480a94){_0x11c8d5[_0x3d9a('0x2d')](0x194);}return _0x480a94;};}function handleError(_0x1d4fee,_0x73b461){_0x73b461=_0x73b461||0x1f4;return function(_0x29dda7){logger[_0x3d9a('0x2e')](_0x29dda7[_0x3d9a('0x2f')]);if(_0x29dda7[_0x3d9a('0x30')]){delete _0x29dda7[_0x3d9a('0x30')];}_0x1d4fee[_0x3d9a('0x1c')](_0x73b461)[_0x3d9a('0x31')](_0x29dda7);};}exports[_0x3d9a('0x32')]=function(_0x2ed276,_0x5a8349){var _0x286316={},_0x4f9f0e={},_0x413679={'count':0x0,'rows':[]};var _0x4dcc30=_[_0x3d9a('0x33')](db[_0x3d9a('0x34')]['rawAttributes'],function(_0xfb2e4c){return{'name':_0xfb2e4c[_0x3d9a('0x35')],'type':_0xfb2e4c[_0x3d9a('0x36')][_0x3d9a('0x37')]};});_0x4f9f0e[_0x3d9a('0x38')]=_[_0x3d9a('0x33')](_0x4dcc30,_0x3d9a('0x30'));_0x4f9f0e[_0x3d9a('0x39')]=_[_0x3d9a('0x3a')](_0x2ed276['query']);_0x4f9f0e[_0x3d9a('0x3b')]=_[_0x3d9a('0x3c')](_0x4f9f0e[_0x3d9a('0x38')],_0x4f9f0e[_0x3d9a('0x39')]);_0x286316[_0x3d9a('0x3d')]=_[_0x3d9a('0x3c')](_0x4f9f0e['model'],qs[_0x3d9a('0x3e')](_0x2ed276['query'][_0x3d9a('0x3e')]));_0x286316[_0x3d9a('0x3d')]=_0x286316[_0x3d9a('0x3d')][_0x3d9a('0x3f')]?_0x286316['attributes']:_0x4f9f0e[_0x3d9a('0x38')];if(!_0x2ed276[_0x3d9a('0x39')][_0x3d9a('0x40')]('nolimit')){_0x286316[_0x3d9a('0x1e')]=qs[_0x3d9a('0x1e')](_0x2ed276[_0x3d9a('0x39')][_0x3d9a('0x1e')]);_0x286316[_0x3d9a('0x20')]=qs[_0x3d9a('0x20')](_0x2ed276[_0x3d9a('0x39')]['offset']);}_0x286316['order']=qs[_0x3d9a('0x41')](_0x2ed276[_0x3d9a('0x39')][_0x3d9a('0x41')]);_0x286316['where']=qs[_0x3d9a('0x3b')](_[_0x3d9a('0x42')](_0x2ed276[_0x3d9a('0x39')],_0x4f9f0e[_0x3d9a('0x3b')]),_0x4dcc30);if(_0x2ed276[_0x3d9a('0x39')][_0x3d9a('0x43')]){_0x286316['where']=_['merge'](_0x286316[_0x3d9a('0x44')],{'$or':_[_0x3d9a('0x33')](_0x4dcc30,function(_0x1da8e4){if(_0x1da8e4[_0x3d9a('0x36')]!==_0x3d9a('0x45')){var _0x580634={};_0x580634[_0x1da8e4[_0x3d9a('0x30')]]={'$like':'%'+_0x2ed276[_0x3d9a('0x39')][_0x3d9a('0x43')]+'%'};return _0x580634;}})});}_0x286316=_[_0x3d9a('0x46')]({},_0x286316,_0x2ed276[_0x3d9a('0x47')]);var _0x1a8050={'where':_0x286316[_0x3d9a('0x44')]};return db[_0x3d9a('0x34')]['count'](_0x1a8050)[_0x3d9a('0x27')](function(_0x3a3188){_0x413679[_0x3d9a('0x1f')]=_0x3a3188;if(_0x2ed276[_0x3d9a('0x39')]['includeAll']){_0x286316[_0x3d9a('0x48')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x286316);})['then'](function(_0x1178a4){_0x413679['rows']=_0x1178a4;return _0x413679;})[_0x3d9a('0x27')](respondWithFilteredResult(_0x5a8349,_0x286316))['catch'](handleError(_0x5a8349,null));};exports['show']=function(_0x1bbedb,_0x381ecc){var _0x588514={'raw':![],'where':{'id':_0x1bbedb[_0x3d9a('0x49')]['id']}},_0x2f902e={};_0x2f902e[_0x3d9a('0x38')]=_[_0x3d9a('0x3a')](db[_0x3d9a('0x34')][_0x3d9a('0x4a')]);_0x2f902e[_0x3d9a('0x39')]=_[_0x3d9a('0x3a')](_0x1bbedb[_0x3d9a('0x39')]);_0x2f902e[_0x3d9a('0x3b')]=_[_0x3d9a('0x3c')](_0x2f902e['model'],_0x2f902e[_0x3d9a('0x39')]);_0x588514[_0x3d9a('0x3d')]=_[_0x3d9a('0x3c')](_0x2f902e[_0x3d9a('0x38')],qs[_0x3d9a('0x3e')](_0x1bbedb[_0x3d9a('0x39')][_0x3d9a('0x3e')]));_0x588514['attributes']=_0x588514[_0x3d9a('0x3d')]['length']?_0x588514[_0x3d9a('0x3d')]:_0x2f902e[_0x3d9a('0x38')];if(_0x1bbedb[_0x3d9a('0x39')]['includeAll']){_0x588514[_0x3d9a('0x48')]=[{'all':!![]}];}_0x588514=_[_0x3d9a('0x46')]({},_0x588514,_0x1bbedb[_0x3d9a('0x47')]);return db[_0x3d9a('0x34')]['find'](_0x588514)['then'](handleEntityNotFound(_0x381ecc,null))['then'](respondWithResult(_0x381ecc,null))[_0x3d9a('0x4b')](handleError(_0x381ecc,null));};exports[_0x3d9a('0x4c')]=function(_0x573550,_0x4b74b0){return db['CmList'][_0x3d9a('0x4c')](_0x573550[_0x3d9a('0x4d')],{})[_0x3d9a('0x27')](function(_0x4dc132){var _0x4217ee=_0x573550[_0x3d9a('0x4e')]['get']({'plain':!![]});if(!_0x4217ee)throw new Error(_0x3d9a('0x4f'));if(_0x4217ee[_0x3d9a('0x50')]===_0x3d9a('0x4e')){var _0x449129=_0x4dc132[_0x3d9a('0x29')]({'plain':!![]});var _0x4897de=_0x3d9a('0x2a');return db[_0x3d9a('0x51')]['find']({'where':{'name':_0x4897de,'userProfileId':_0x4217ee['userProfileId']},'raw':!![]})[_0x3d9a('0x27')](function(_0x1b0a16){if(_0x1b0a16&&_0x1b0a16[_0x3d9a('0x52')]===0x0){return db[_0x3d9a('0x2b')]['create']({'name':_0x449129['name'],'resourceId':_0x449129['id'],'type':_0x1b0a16[_0x3d9a('0x30')],'sectionId':_0x1b0a16['id']},{})[_0x3d9a('0x27')](function(){return _0x4dc132;});}else{return _0x4dc132;}})[_0x3d9a('0x4b')](function(_0xe0cb32){logger['error'](_0x3d9a('0x53'),_0xe0cb32);throw _0xe0cb32;});}return _0x4dc132;})[_0x3d9a('0x27')](respondWithResult(_0x4b74b0,0xc9))[_0x3d9a('0x4b')](handleError(_0x4b74b0,null));};exports[_0x3d9a('0x54')]=function(_0x3383ea,_0x557c72){if(_0x3383ea[_0x3d9a('0x4d')]['id']){delete _0x3383ea[_0x3d9a('0x4d')]['id'];}return db[_0x3d9a('0x34')]['find']({'where':{'id':_0x3383ea[_0x3d9a('0x49')]['id']}})[_0x3d9a('0x27')](handleEntityNotFound(_0x557c72,null))[_0x3d9a('0x27')](saveUpdates(_0x3383ea['body'],null))[_0x3d9a('0x27')](respondWithResult(_0x557c72,null))[_0x3d9a('0x4b')](handleError(_0x557c72,null));};exports['destroy']=function(_0x165eeb,_0x2f63f4){return db[_0x3d9a('0x34')]['find']({'where':{'id':_0x165eeb['params']['id']}})[_0x3d9a('0x27')](handleEntityNotFound(_0x2f63f4,null))['then'](removeEntity(_0x2f63f4,null))['catch'](handleError(_0x2f63f4,null));};exports[_0x3d9a('0x55')]=function(_0x79509d,_0x57cc48){return db[_0x3d9a('0x34')][_0x3d9a('0x55')]()[_0x3d9a('0x27')](respondWithResult(_0x57cc48,null))[_0x3d9a('0x4b')](handleError(_0x57cc48,null));};exports[_0x3d9a('0x56')]=function(_0x3426c2,_0x475249,_0x5e543d){if(_0x3426c2[_0x3d9a('0x4d')]['id']){delete _0x3426c2[_0x3d9a('0x4d')]['id'];}return db[_0x3d9a('0x34')][_0x3d9a('0x57')]({'where':{'id':_0x3426c2[_0x3d9a('0x49')]['id']}})[_0x3d9a('0x27')](handleEntityNotFound(_0x475249,null))['then'](function(_0x287403){if(_0x287403){_0x3426c2['body'][_0x3d9a('0x58')]=_0x287403['id'];return db[_0x3d9a('0x59')]['create'](_0x3426c2[_0x3d9a('0x4d')]);}})[_0x3d9a('0x27')](respondWithResult(_0x475249,null))[_0x3d9a('0x4b')](handleError(_0x475249,null));};exports[_0x3d9a('0x5a')]=function(_0x3cd0cd,_0x29a534,_0x456541){var _0x22957b={'raw':![],'where':{}};var _0x5ea748={};var _0x324eda={'count':0x0,'rows':[]};return db[_0x3d9a('0x34')]['findOne']({'where':{'id':_0x3cd0cd[_0x3d9a('0x49')]['id']}})[_0x3d9a('0x27')](handleEntityNotFound(_0x29a534,null))[_0x3d9a('0x27')](function(_0x256420){if(_0x256420){_0x5ea748['model']=_[_0x3d9a('0x3a')](db[_0x3d9a('0x59')][_0x3d9a('0x4a')]);_0x5ea748[_0x3d9a('0x39')]=_[_0x3d9a('0x3a')](_0x3cd0cd[_0x3d9a('0x39')]);_0x5ea748['filters']=_[_0x3d9a('0x3c')](_0x5ea748[_0x3d9a('0x38')],_0x5ea748['query']);_0x22957b['attributes']=_[_0x3d9a('0x3c')](_0x5ea748[_0x3d9a('0x38')],qs[_0x3d9a('0x3e')](_0x3cd0cd[_0x3d9a('0x39')][_0x3d9a('0x3e')]));_0x22957b[_0x3d9a('0x3d')]=_0x22957b['attributes'][_0x3d9a('0x3f')]?_0x22957b[_0x3d9a('0x3d')]:_0x5ea748[_0x3d9a('0x38')];if(!_0x3cd0cd['query'][_0x3d9a('0x40')](_0x3d9a('0x5b'))){_0x22957b[_0x3d9a('0x1e')]=qs[_0x3d9a('0x1e')](_0x3cd0cd['query'][_0x3d9a('0x1e')]);_0x22957b['offset']=qs[_0x3d9a('0x20')](_0x3cd0cd[_0x3d9a('0x39')][_0x3d9a('0x20')]);}_0x22957b[_0x3d9a('0x5c')]=qs[_0x3d9a('0x41')](_0x3cd0cd[_0x3d9a('0x39')][_0x3d9a('0x41')]);_0x22957b['where']=qs['filters'](_[_0x3d9a('0x42')](_0x3cd0cd[_0x3d9a('0x39')],_0x5ea748[_0x3d9a('0x3b')]));_0x22957b[_0x3d9a('0x44')][_0x3d9a('0x58')]=_0x256420['id'];if(_0x3cd0cd[_0x3d9a('0x39')]['filter']){_0x22957b[_0x3d9a('0x44')]=_[_0x3d9a('0x46')](_0x22957b['where'],{'$or':_[_0x3d9a('0x33')](_0x22957b[_0x3d9a('0x3d')],function(_0x478dea){var _0x2f23f0={};_0x2f23f0[_0x478dea]={'$like':'%'+_0x3cd0cd[_0x3d9a('0x39')][_0x3d9a('0x43')]+'%'};return _0x2f23f0;})});}_0x22957b=_['merge']({},_0x22957b,_0x3cd0cd[_0x3d9a('0x47')]);return db[_0x3d9a('0x59')][_0x3d9a('0x1f')]({'where':_0x22957b[_0x3d9a('0x44')]})[_0x3d9a('0x27')](function(_0x5b3224){_0x324eda['count']=_0x5b3224;if(_0x3cd0cd[_0x3d9a('0x39')][_0x3d9a('0x5d')]){_0x22957b[_0x3d9a('0x48')]=[{'all':!![]}];}return db[_0x3d9a('0x59')]['findAll'](_0x22957b);})[_0x3d9a('0x27')](function(_0x15d3a3){_0x324eda['rows']=_0x15d3a3;return _0x324eda;});}})['then'](respondWithFilteredResult(_0x29a534,_0x22957b))[_0x3d9a('0x4b')](handleError(_0x29a534,null));};exports[_0x3d9a('0x5e')]=function(_0x3b17e5,_0xb0cabc,_0x51e438){return db[_0x3d9a('0x34')]['find']({'where':{'id':_0x3b17e5[_0x3d9a('0x49')]['id']}})[_0x3d9a('0x27')](handleEntityNotFound(_0xb0cabc,null))[_0x3d9a('0x27')](function(_0x18432e){if(_0x18432e){return _0x18432e[_0x3d9a('0x5e')](_0x3b17e5[_0x3d9a('0x39')][_0x3d9a('0x5f')]);}})['then'](respondWithStatusCode(_0xb0cabc,null))[_0x3d9a('0x4b')](handleError(_0xb0cabc,null));};exports['addContacts']=function(_0x24cbba,_0x2847db,_0x29dc9d){return db[_0x3d9a('0x34')]['find']({'where':{'id':_0x24cbba[_0x3d9a('0x49')]['id']}})[_0x3d9a('0x27')](handleEntityNotFound(_0x2847db,null))[_0x3d9a('0x27')](function(_0x65b99e){if(_0x65b99e){var _0x1869f1=[];var _0x358e3f={'success':[],'errors':[]};return db[_0x3d9a('0x60')]['describe']()[_0x3d9a('0x27')](function(_0x57d74f){if(_0x24cbba[_0x3d9a('0x4d')]['tags']&&_['isArray'](_0x24cbba[_0x3d9a('0x4d')][_0x3d9a('0x61')])){if(_0x24cbba[_0x3d9a('0x4d')][_0x3d9a('0x61')]['length']){_0x24cbba[_0x3d9a('0x4d')]['tags']=_0x24cbba[_0x3d9a('0x4d')][_0x3d9a('0x61')][_0x3d9a('0x62')](';')+';';}else{_0x24cbba[_0x3d9a('0x4d')][_0x3d9a('0x61')]=null;}}else{_0x24cbba[_0x3d9a('0x4d')]['tags']=null;}if(_0x24cbba[_0x3d9a('0x4d')]&&_[_0x3d9a('0x63')](_0x24cbba[_0x3d9a('0x4d')])){for(var _0x15bbcf=0x0;_0x15bbcf<_0x24cbba[_0x3d9a('0x4d')][_0x3d9a('0x3f')];_0x15bbcf+=0x1){_0x24cbba[_0x3d9a('0x4d')][_0x15bbcf]['ListId']=_0x24cbba['params']['id'];_0x1869f1[_0x3d9a('0x64')](_0x24cbba[_0x3d9a('0x4d')][_0x15bbcf]);}return BPromise[_0x3d9a('0x65')](_0x1869f1,function(_0x19ffe8){return db[_0x3d9a('0x60')][_0x3d9a('0x4c')](_['omit'](_0x19ffe8,['ids','id'])||{},{'fields':_['keys'](_0x57d74f),'raw':!![]})[_0x3d9a('0x27')](function(_0x378694){_0x358e3f[_0x3d9a('0x66')][_0x3d9a('0x64')](_0x378694[_0x3d9a('0x67')]);})[_0x3d9a('0x4b')](function(_0x1e7cff){_0x358e3f['errors'][_0x3d9a('0x64')]({'data':_0x19ffe8,'error':_0x1e7cff[_0x3d9a('0x68')]});});})['then'](function(_0x46b497){return _0x358e3f;})[_0x3d9a('0x4b')](function(_0x2186fd){return _0x2186fd;});}else{_0x2847db[_0x3d9a('0x1c')](0x190)[_0x3d9a('0x23')]({'message':_0x3d9a('0x69')});}});}})[_0x3d9a('0x27')](respondWithResult(_0x2847db,null))['catch'](handleError(_0x2847db,null));};exports['getContacts']=function(_0x1f21da,_0x5e25b8,_0xc5fc6f){var _0x2a8909;return db['CmList'][_0x3d9a('0x57')]({'where':{'id':_0x1f21da[_0x3d9a('0x49')]['id']},'include':[{'model':db[_0x3d9a('0x6a')],'as':_0x3d9a('0x6b')}]})[_0x3d9a('0x27')](handleEntityNotFound(_0x5e25b8,null))[_0x3d9a('0x27')](function(_0x1c03cd){if(_0x1c03cd){_0x2a8909=_0x1c03cd;return db[_0x3d9a('0x60')]['rawAttributes'];}})[_0x3d9a('0x27')](function(_0xfbe0ff){if(_0xfbe0ff){var _0x114749={};var _0x492b63={};_0x492b63['model']=_[_0x3d9a('0x6c')](_[_0x3d9a('0x3a')](_0xfbe0ff),_['map'](_0x2a8909['CustomFields'],function(_0x129224){return util[_0x3d9a('0x6d')](_0x3d9a('0x6e'),_0x129224['id']);}));_0x492b63['query']=_[_0x3d9a('0x3a')](_0x1f21da[_0x3d9a('0x39')]);_0x492b63[_0x3d9a('0x3b')]=_['intersection'](_0x492b63['model'],_0x492b63[_0x3d9a('0x39')]);_0x114749[_0x3d9a('0x3d')]=_[_0x3d9a('0x3c')](_0x492b63[_0x3d9a('0x38')],qs[_0x3d9a('0x3e')](_0x1f21da[_0x3d9a('0x39')][_0x3d9a('0x3e')]));_0x114749[_0x3d9a('0x3d')]=_0x114749[_0x3d9a('0x3d')][_0x3d9a('0x3f')]?_0x114749[_0x3d9a('0x3d')]:_0x492b63[_0x3d9a('0x38')];if(!_0x1f21da[_0x3d9a('0x39')][_0x3d9a('0x40')](_0x3d9a('0x5b'))){_0x114749[_0x3d9a('0x1e')]=qs[_0x3d9a('0x1e')](_0x1f21da[_0x3d9a('0x39')]['limit']);_0x114749['offset']=qs['offset'](_0x1f21da['query'][_0x3d9a('0x20')]);}_0x114749[_0x3d9a('0x5c')]=qs['sort'](_0x1f21da['query']['sort']);_0x114749[_0x3d9a('0x44')]=qs[_0x3d9a('0x3b')](_[_0x3d9a('0x42')](_0x1f21da['query'],_0x492b63[_0x3d9a('0x3b')]));_0x114749['raw']=!![];if(_0x1f21da[_0x3d9a('0x39')][_0x3d9a('0x43')]){_0x114749[_0x3d9a('0x44')]=_[_0x3d9a('0x46')](_0x114749[_0x3d9a('0x44')],{'$or':_[_0x3d9a('0x33')](_0x114749[_0x3d9a('0x3d')],function(_0x6791dd){var _0x23bd5b={};_0x23bd5b[_0x6791dd]={'$like':'%'+_0x1f21da[_0x3d9a('0x39')][_0x3d9a('0x43')]+'%'};return _0x23bd5b;})});}_0x114749=_[_0x3d9a('0x46')]({},_0x114749,_0x1f21da[_0x3d9a('0x47')]);return _0x2a8909[_0x3d9a('0x6f')](_0x114749);}})[_0x3d9a('0x27')](respondWithResult(_0x5e25b8,null))[_0x3d9a('0x4b')](handleError(_0x5e25b8,null));};exports[_0x3d9a('0x70')]=function(_0x34e10c,_0x112014,_0x1c7e51){var _0x30f631;var _0x111788;var _0x110a6c;var _0x546268=_0x34e10c['params']['id'];csv_results=[];return db[_0x3d9a('0x71')][_0x3d9a('0x72')]({'attributes':['id','name'],'raw':!![],'order':[_0x3d9a('0x73')]})[_0x3d9a('0x27')](function(_0x2d9c67){_0x30f631=_0x2d9c67;var _0x286b98=_['keys'](db['CmContact']['rawAttributes']);return db['CmCustomField'][_0x3d9a('0x72')]({'raw':!![],'attributes':['id',_0x3d9a('0x74')]})[_0x3d9a('0x27')](function(_0x40d7ec){_0x111788=_0x40d7ec;var _0x14b932=squel[_0x3d9a('0x75')]()['fields'](_0x286b98)['from'](_0x3d9a('0x76'),'c')[_0x3d9a('0x44')](_0x3d9a('0x77'),_0x546268)[_0x3d9a('0x44')](_0x3d9a('0x78'))[_0x3d9a('0x79')]();for(var _0x4c968c=0x0;_0x4c968c<_0x111788[_0x3d9a('0x3f')];_0x4c968c++){_0x14b932[_0x3d9a('0x7a')]('c.cf_'+_0x111788[_0x4c968c]['id'],'customField_'+_0x111788[_0x4c968c][_0x3d9a('0x74')]);}for(var _0x4c968c=0x0;_0x4c968c<_0x30f631['length'];_0x4c968c++){_0x14b932[_0x3d9a('0x7a')](squel[_0x3d9a('0x75')]()[_0x3d9a('0x7a')](_0x3d9a('0x7b'))['from'](_0x3d9a('0x7c'))['where']('ItemTypeId\x20=\x20?',_0x30f631[_0x4c968c]['id'])[_0x3d9a('0x44')]('CmContactId\x20=\x20c.id'),_0x3d9a('0x7d')+_0x30f631[_0x4c968c][_0x3d9a('0x30')]);_0x14b932[_0x3d9a('0x7a')](squel['select']()[_0x3d9a('0x7a')]('description')['from'](_0x3d9a('0x7c'))[_0x3d9a('0x44')]('ItemTypeId\x20=\x20?',_0x30f631[_0x4c968c]['id'])[_0x3d9a('0x44')](_0x3d9a('0x7e')),_0x3d9a('0x7f')+_0x30f631[_0x4c968c][_0x3d9a('0x30')]);}var _0x101632=[];_0x101632[_0x3d9a('0x64')](_0x14b932[_0x3d9a('0x80')]());BPromise[_0x3d9a('0x65')](_0x101632,handleQuery)[_0x3d9a('0x27')](function(_0x2d33f6){handleQuery(_0x14b932[_0x3d9a('0x80')]());var _0x31c2e5=csv_results[0x0];if(!_['isEmpty'](_0x31c2e5)){var _0x3eb4ec=toCsv(_0x31c2e5);var _0x425981=Date[_0x3d9a('0x81')]();fs[_0x3d9a('0x82')](util[_0x3d9a('0x6d')](_0x3d9a('0x83'),_0x546268,_0x425981),_0x3eb4ec);_0x112014['setHeader'](_0x3d9a('0x84'),_0x3d9a('0x85')+util[_0x3d9a('0x6d')](_0x3d9a('0x86'),_0x546268,_0x425981));_0x112014['setHeader'](_0x3d9a('0x87'),_0x3d9a('0x88'));return _0x112014[_0x3d9a('0x89')](util[_0x3d9a('0x6d')](_0x3d9a('0x83'),_0x546268,_0x425981));}else{return _0x112014[_0x3d9a('0x2d')](0xcc);}});});});};exports[_0x3d9a('0x8a')]=function(_0x5b49ab,_0x5fb07b,_0x3857a9){var _0x1e3cfd;delete _0x5b49ab[_0x3d9a('0x4d')]['id'];return db[_0x3d9a('0x34')][_0x3d9a('0x8b')]({'where':{'id':_0x5b49ab[_0x3d9a('0x49')]['id']}})['then'](handleEntityNotFound(_0x5fb07b,null))[_0x3d9a('0x27')](function(_0x544684){if(_0x544684){return db[_0x3d9a('0x8c')][_0x3d9a('0x8d')](function(_0x8db4e0){return db[_0x3d9a('0x6a')][_0x3d9a('0x4c')](_0x5b49ab[_0x3d9a('0x4d')],{'transaction':_0x8db4e0})['then'](function(_0x30e5e7){_0x1e3cfd=_0x30e5e7;return _0x544684['addCustomFields'](_0x30e5e7,{'transaction':_0x8db4e0});})['then'](function(){var _0x1d670b={'type':db[_0x3d9a('0x8e')][_0x3d9a('0x8f')],'transaction':_0x8db4e0};switch(_0x5b49ab[_0x3d9a('0x4d')][_0x3d9a('0x36')]){case'text':_0x1d670b[_0x3d9a('0x36')]=db['Sequelize'][_0x3d9a('0x8f')];break;case _0x3d9a('0x90'):_0x1d670b[_0x3d9a('0x36')]=db['Sequelize'][_0x3d9a('0x91')];break;case'switch':_0x1d670b[_0x3d9a('0x36')]=db[_0x3d9a('0x8e')][_0x3d9a('0x92')];_0x1d670b[_0x3d9a('0x93')]=![];break;default:}return db[_0x3d9a('0x8c')][_0x3d9a('0x94')][_0x3d9a('0x95')]('cm_contacts',util[_0x3d9a('0x6d')](_0x3d9a('0x96'),_0x1e3cfd['id']),_0x1d670b);})[_0x3d9a('0x27')](function(){return _0x1e3cfd;});});}})[_0x3d9a('0x27')](respondWithResult(_0x5fb07b,null))[_0x3d9a('0x4b')](handleError(_0x5fb07b,null));};exports[_0x3d9a('0x97')]=function(_0x3aa00f,_0x5d8673,_0x2a87fc){var _0x135c5a={};var _0xf4c7bf={};var _0x5e7b62;var _0x2ebbfe;return db[_0x3d9a('0x34')][_0x3d9a('0x8b')]({'where':{'id':_0x3aa00f[_0x3d9a('0x49')]['id']}})[_0x3d9a('0x27')](handleEntityNotFound(_0x5d8673,null))[_0x3d9a('0x27')](function(_0x50fb7d){if(_0x50fb7d){_0x5e7b62=_0x50fb7d;_0xf4c7bf[_0x3d9a('0x38')]=_['keys'](db[_0x3d9a('0x6a')][_0x3d9a('0x4a')]);_0xf4c7bf[_0x3d9a('0x39')]=_[_0x3d9a('0x3a')](_0x3aa00f[_0x3d9a('0x39')]);_0xf4c7bf[_0x3d9a('0x3b')]=_[_0x3d9a('0x3c')](_0xf4c7bf[_0x3d9a('0x38')],_0xf4c7bf['query']);_0x135c5a[_0x3d9a('0x3d')]=_[_0x3d9a('0x3c')](_0xf4c7bf[_0x3d9a('0x38')],qs[_0x3d9a('0x3e')](_0x3aa00f[_0x3d9a('0x39')][_0x3d9a('0x3e')]));_0x135c5a[_0x3d9a('0x3d')]=_0x135c5a['attributes'][_0x3d9a('0x3f')]?_0x135c5a['attributes']:_0xf4c7bf[_0x3d9a('0x38')];_0x135c5a[_0x3d9a('0x5c')]=qs[_0x3d9a('0x41')](_0x3aa00f[_0x3d9a('0x39')][_0x3d9a('0x41')]);_0x135c5a[_0x3d9a('0x44')]=qs[_0x3d9a('0x3b')](_['pick'](_0x3aa00f[_0x3d9a('0x39')],_0xf4c7bf['filters']));_0x135c5a[_0x3d9a('0x44')]=_[_0x3d9a('0x46')](_0x135c5a['where'],{'$or':[{'ListId':_0x50fb7d['id']},{'ListId':null}]});if(_0x3aa00f[_0x3d9a('0x39')][_0x3d9a('0x43')]){_0x135c5a[_0x3d9a('0x44')]=_['merge'](_0x135c5a[_0x3d9a('0x44')],{'$or':_['map'](_0x135c5a[_0x3d9a('0x3d')],function(_0x1274f5){var _0x49e600={};_0x49e600[_0x1274f5]={'$like':'%'+_0x3aa00f[_0x3d9a('0x39')][_0x3d9a('0x43')]+'%'};return _0x49e600;})});}_0x135c5a=_['merge']({},_0x135c5a,_0x3aa00f[_0x3d9a('0x47')]);return db[_0x3d9a('0x6a')][_0x3d9a('0x98')](_0x135c5a);}})[_0x3d9a('0x27')](respondWithResult(_0x5d8673,null))[_0x3d9a('0x4b')](handleError(_0x5d8673,null));};exports[_0x3d9a('0x99')]=function(_0x11d3ef,_0x470bc8){return db['CmCustomField'][_0x3d9a('0x98')]({'where':{'ListId':null}})[_0x3d9a('0x27')](handleEntityNotFound(_0x470bc8,null))[_0x3d9a('0x27')](function(_0x12eea6){return _0x12eea6;})[_0x3d9a('0x27')](respondWithResult(_0x470bc8,null))[_0x3d9a('0x4b')](handleError(_0x470bc8,null));};exports['addAgents']=function(_0x37b62c,_0x1b12e5,_0x8069f4){return db[_0x3d9a('0x34')][_0x3d9a('0x57')]({'where':{'id':_0x37b62c['params']['id']}})[_0x3d9a('0x27')](handleEntityNotFound(_0x1b12e5,null))[_0x3d9a('0x27')](function(_0x533701){if(_0x533701){return _0x533701[_0x3d9a('0x9a')](_0x37b62c[_0x3d9a('0x4d')][_0x3d9a('0x5f')],_['omit'](_0x37b62c[_0x3d9a('0x4d')],['ids','id'])||{})[_0x3d9a('0x9b')](function(_0x2e162e){for(var _0x1cbe5d=0x0;_0x1cbe5d<_0x37b62c[_0x3d9a('0x4d')][_0x3d9a('0x5f')][_0x3d9a('0x3f')];_0x1cbe5d+=0x1){socket['emit'](_0x3d9a('0x9c'),{'UserId':Number(_0x37b62c[_0x3d9a('0x4d')]['ids'][_0x1cbe5d]),'CmListId':Number(_0x37b62c[_0x3d9a('0x49')]['id'])});}return _0x2e162e;});}})['then'](respondWithResult(_0x1b12e5,null))['catch'](handleError(_0x1b12e5,null));};exports[_0x3d9a('0x9d')]=function(_0x3e34e6,_0x456125,_0x2348c0){return db[_0x3d9a('0x34')][_0x3d9a('0x57')]({'where':{'id':_0x3e34e6[_0x3d9a('0x49')]['id']}})[_0x3d9a('0x27')](handleEntityNotFound(_0x456125,null))[_0x3d9a('0x27')](function(_0xcce399){if(_0xcce399){return _0xcce399[_0x3d9a('0x9d')](_0x3e34e6['query'][_0x3d9a('0x5f')])['then'](function(){if(_['isArray'](_0x3e34e6['query'][_0x3d9a('0x5f')])){for(var _0x5c7efa=0x0;_0x5c7efa<_0x3e34e6[_0x3d9a('0x39')][_0x3d9a('0x5f')][_0x3d9a('0x3f')];_0x5c7efa+=0x1){socket[_0x3d9a('0x9e')](_0x3d9a('0x9f'),{'UserId':Number(_0x3e34e6['query'][_0x3d9a('0x5f')][_0x5c7efa]),'CmListId':Number(_0x3e34e6['params']['id'])});}}else{socket[_0x3d9a('0x9e')](_0x3d9a('0x9f'),{'UserId':Number(_0x3e34e6['query'][_0x3d9a('0x5f')]),'CmListId':Number(_0x3e34e6[_0x3d9a('0x49')]['id'])});}});}})[_0x3d9a('0x27')](respondWithStatusCode(_0x456125,null))[_0x3d9a('0x4b')](handleError(_0x456125,null));};exports[_0x3d9a('0xa0')]=function(_0x5a2632,_0x1dd200,_0x2b1724){var _0x452581={};var _0x668e0e={};var _0x1c5f15;var _0xae950a;return db[_0x3d9a('0x34')][_0x3d9a('0x8b')]({'where':{'id':_0x5a2632['params']['id']}})['then'](handleEntityNotFound(_0x1dd200,null))[_0x3d9a('0x27')](function(_0x28353a){if(_0x28353a){_0x1c5f15=_0x28353a;_0x668e0e['model']=_[_0x3d9a('0x3a')](db[_0x3d9a('0xa1')][_0x3d9a('0x4a')]);_0x668e0e['query']=_[_0x3d9a('0x3a')](_0x5a2632[_0x3d9a('0x39')]);_0x668e0e[_0x3d9a('0x3b')]=_[_0x3d9a('0x3c')](_0x668e0e['model'],_0x668e0e[_0x3d9a('0x39')]);_0x452581['attributes']=_[_0x3d9a('0x3c')](_0x668e0e['model'],qs[_0x3d9a('0x3e')](_0x5a2632['query'][_0x3d9a('0x3e')]));_0x452581[_0x3d9a('0x3d')]=_0x452581[_0x3d9a('0x3d')][_0x3d9a('0x3f')]?_0x452581[_0x3d9a('0x3d')]:_0x668e0e['model'];_0x452581[_0x3d9a('0x5c')]=qs[_0x3d9a('0x41')](_0x5a2632[_0x3d9a('0x39')][_0x3d9a('0x41')]);_0x452581[_0x3d9a('0x44')]=qs[_0x3d9a('0x3b')](_[_0x3d9a('0x42')](_0x5a2632['query'],_0x668e0e[_0x3d9a('0x3b')]));if(_0x5a2632['query'][_0x3d9a('0x43')]){_0x452581['where']=_[_0x3d9a('0x46')](_0x452581[_0x3d9a('0x44')],{'$or':_['map'](_0x452581['attributes'],function(_0x36ae9d){var _0x532cfd={};_0x532cfd[_0x36ae9d]={'$like':'%'+_0x5a2632[_0x3d9a('0x39')][_0x3d9a('0x43')]+'%'};return _0x532cfd;})});}_0x452581=_['merge']({},_0x452581,_0x5a2632['options']);return _0x1c5f15[_0x3d9a('0xa0')](_0x452581);}})[_0x3d9a('0x27')](function(_0x303d1c){if(_0x303d1c){_0xae950a=_0x303d1c[_0x3d9a('0x3f')];if(!_0x5a2632[_0x3d9a('0x39')]['hasOwnProperty'](_0x3d9a('0x5b'))){_0x452581[_0x3d9a('0x1e')]=qs[_0x3d9a('0x1e')](_0x5a2632[_0x3d9a('0x39')]['limit']);_0x452581[_0x3d9a('0x20')]=qs['offset'](_0x5a2632[_0x3d9a('0x39')][_0x3d9a('0x20')]);}return _0x1c5f15[_0x3d9a('0xa0')](_0x452581);}})[_0x3d9a('0x27')](function(_0x271e97){if(_0x271e97){return _0x271e97?{'count':_0xae950a,'rows':_0x271e97}:null;}})['then'](respondWithResult(_0x1dd200,null))[_0x3d9a('0x4b')](handleError(_0x1dd200,null));};function handleQuery(_0xc3ee4a){logger[_0x3d9a('0xa2')](_0xc3ee4a);return db[_0x3d9a('0x8c')]['query'](_0xc3ee4a)[_0x3d9a('0x9b')](function(_0x466d5f){csv_results['push'](_0x466d5f);})[_0x3d9a('0x4b')](function(_0x5c00ba){logger[_0x3d9a('0x2e')](_0x5c00ba[_0x3d9a('0x68')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 9e563ca..8ebfa8b 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0x5fc3[_0x2e4cbf];return _0x52840f;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0xd8813a,_0x315766){var _0x487db6=function(_0x538ca9){while(--_0x538ca9){_0xd8813a['push'](_0xd8813a['shift']());}};_0x487db6(++_0x315766);}(_0x814b,0x1a2));var _0xb814=function(_0x4976eb,_0x4b09d1){_0x4976eb=_0x4976eb-0x0;var _0x5dd7b2=_0x814b[_0x4976eb];return _0x5dd7b2;};'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 28760eb..82e3057 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 _0xa75b=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','api','moment','bluebird'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0xa75b,0x170));var _0xba75=function(_0x33e703,_0x349b05){_0x33e703=_0x33e703-0x0;var _0x44e739=_0xa75b[_0x33e703];return _0x44e739;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba75('0x1'));var moment=require(_0xba75('0x2'));var BPromise=require(_0xba75('0x3'));var rp=require(_0xba75('0x4'));var fs=require('fs');var path=require(_0xba75('0x5'));var rimraf=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var attributes=require(_0xba75('0x8'));module[_0xba75('0x9')]=function(_0x41afc9,_0x2baa28){return _0x41afc9[_0xba75('0xa')](_0xba75('0xb'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2750=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c3755,_0xa08779){var _0x5dffb4=function(_0x4b7724){while(--_0x4b7724){_0x3c3755['push'](_0x3c3755['shift']());}};_0x5dffb4(++_0xa08779);}(_0x2750,0x13b));var _0x0275=function(_0x558d82,_0x3d678d){_0x558d82=_0x558d82-0x0;var _0x5d040d=_0x2750[_0x558d82];return _0x5d040d;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'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 329406d..84a159a 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 _0x70f8=['stringify','error','CmList,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x458bfd,_0x520d2a){var _0x5c89c0=function(_0x48917d){while(--_0x48917d){_0x458bfd['push'](_0x458bfd['shift']());}};_0x5c89c0(++_0x520d2a);}(_0x70f8,0x1bf));var _0x870f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x70f8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x870f('0x0'));var util=require(_0x870f('0x1'));var moment=require('moment');var BPromise=require(_0x870f('0x2'));var rs=require(_0x870f('0x3'));var fs=require('fs');var Redis=require(_0x870f('0x4'));var db=require(_0x870f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x870f('0x6'));var config=require(_0x870f('0x7'));var jayson=require(_0x870f('0x8'));var client=jayson[_0x870f('0x9')][_0x870f('0xa')]({'port':0x232a});config[_0x870f('0xb')]=_['defaults'](config[_0x870f('0xb')],{'host':_0x870f('0xc'),'port':0x18eb});var socket=require(_0x870f('0xd'))(new Redis(config['redis']));require('./cmList.socket')[_0x870f('0xe')](socket);function respondWithRpcPromise(_0x2f5b1c,_0x1154fd,_0x145a5c){return new BPromise(function(_0x5ef4d4,_0x228769){return client[_0x870f('0xf')](_0x2f5b1c,_0x145a5c)[_0x870f('0x10')](function(_0x1a8f07){logger[_0x870f('0x11')]('CmList,\x20%s,\x20%s',_0x1154fd,_0x870f('0x12'));logger[_0x870f('0x13')](_0x870f('0x14'),_0x1154fd,_0x870f('0x12'),JSON[_0x870f('0x15')](_0x1a8f07));if(_0x1a8f07[_0x870f('0x16')]){if(_0x1a8f07[_0x870f('0x16')]['code']===0x1f4){logger[_0x870f('0x16')](_0x870f('0x17'),_0x1154fd,_0x1a8f07[_0x870f('0x16')]['message']);return _0x228769(_0x1a8f07[_0x870f('0x16')][_0x870f('0x18')]);}logger[_0x870f('0x16')](_0x870f('0x17'),_0x1154fd,_0x1a8f07['error'][_0x870f('0x18')]);return _0x5ef4d4(_0x1a8f07['error'][_0x870f('0x18')]);}else{logger[_0x870f('0x11')]('CmList,\x20%s,\x20%s',_0x1154fd,'request\x20sent');_0x5ef4d4(_0x1a8f07['result'][_0x870f('0x18')]);}})[_0x870f('0x19')](function(_0x30838d){logger[_0x870f('0x16')](_0x870f('0x17'),_0x1154fd,_0x30838d);_0x228769(_0x30838d);});});} \ No newline at end of file +var _0x8aab=['socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','http','redis','defaults','localhost'];(function(_0x2c7597,_0x311720){var _0x49fbf3=function(_0x43914d){while(--_0x43914d){_0x2c7597['push'](_0x2c7597['shift']());}};_0x49fbf3(++_0x311720);}(_0x8aab,0xde));var _0xb8aa=function(_0x667258,_0x3ac01a){_0x667258=_0x667258-0x0;var _0x28c29a=_0x8aab[_0x667258];return _0x28c29a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb8aa('0x0'));var BPromise=require(_0xb8aa('0x1'));var rs=require(_0xb8aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8aa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb8aa('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb8aa('0x5')]({'port':0x232a});config[_0xb8aa('0x6')]=_[_0xb8aa('0x7')](config['redis'],{'host':_0xb8aa('0x8'),'port':0x18eb});var socket=require(_0xb8aa('0x9'))(new Redis(config[_0xb8aa('0x6')]));require(_0xb8aa('0xa'))[_0xb8aa('0xb')](socket);function respondWithRpcPromise(_0xc6bcc4,_0x1585e6,_0x1e7366){return new BPromise(function(_0x33bfe5,_0x5ebec1){return client[_0xb8aa('0xc')](_0xc6bcc4,_0x1e7366)['then'](function(_0x411c31){logger[_0xb8aa('0xd')](_0xb8aa('0xe'),_0x1585e6,_0xb8aa('0xf'));logger[_0xb8aa('0x10')]('CmList,\x20%s,\x20%s,\x20%s',_0x1585e6,_0xb8aa('0xf'),JSON['stringify'](_0x411c31));if(_0x411c31[_0xb8aa('0x11')]){if(_0x411c31[_0xb8aa('0x11')]['code']===0x1f4){logger['error'](_0xb8aa('0xe'),_0x1585e6,_0x411c31['error'][_0xb8aa('0x12')]);return _0x5ebec1(_0x411c31[_0xb8aa('0x11')][_0xb8aa('0x12')]);}logger['error']('CmList,\x20%s,\x20%s',_0x1585e6,_0x411c31[_0xb8aa('0x11')][_0xb8aa('0x12')]);return _0x33bfe5(_0x411c31[_0xb8aa('0x11')][_0xb8aa('0x12')]);}else{logger[_0xb8aa('0xd')](_0xb8aa('0xe'),_0x1585e6,_0xb8aa('0xf'));_0x33bfe5(_0x411c31[_0xb8aa('0x13')][_0xb8aa('0x12')]);}})[_0xb8aa('0x14')](function(_0x1e47c6){logger['error'](_0xb8aa('0xe'),_0x1585e6,_0x1e47c6);_0x5ebec1(_0x1e47c6);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 15367d7..d1a17db 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 _0x06cd=['removeListener','register','length','cmList:','./cmList.events','save','remove','update'];(function(_0x588839,_0x1bebd4){var _0x5c7318=function(_0x2b5e40){while(--_0x2b5e40){_0x588839['push'](_0x588839['shift']());}};_0x5c7318(++_0x1bebd4);}(_0x06cd,0x12c));var _0xd06c=function(_0x4e3c23,_0x511f97){_0x4e3c23=_0x4e3c23-0x0;var _0xa23ded=_0x06cd[_0x4e3c23];return _0xa23ded;};'use strict';var CmListEvents=require(_0xd06c('0x0'));var events=[_0xd06c('0x1'),_0xd06c('0x2'),_0xd06c('0x3')];function createListener(_0x47e550,_0x50e05a){return function(_0x2875e4){_0x50e05a['emit'](_0x47e550,_0x2875e4);};}function removeListener(_0x4c7b59,_0x4a26f1){return function(){CmListEvents[_0xd06c('0x4')](_0x4c7b59,_0x4a26f1);};}exports[_0xd06c('0x5')]=function(_0x3db9a2){for(var _0x521454=0x0,_0x2bcdef=events[_0xd06c('0x6')];_0x521454<_0x2bcdef;_0x521454++){var _0x50cdc8=events[_0x521454];var _0x2b78ea=createListener(_0xd06c('0x7')+_0x50cdc8,_0x3db9a2);CmListEvents['on'](_0x50cdc8,_0x2b78ea);}}; \ No newline at end of file +var _0x07fb=['length','cmList:','remove','update','emit','removeListener','register'];(function(_0x201d15,_0x462965){var _0x4c829e=function(_0x1c94c7){while(--_0x1c94c7){_0x201d15['push'](_0x201d15['shift']());}};_0x4c829e(++_0x462965);}(_0x07fb,0x113));var _0xb07f=function(_0x8bca01,_0x2548d5){_0x8bca01=_0x8bca01-0x0;var _0x3a4091=_0x07fb[_0x8bca01];return _0x3a4091;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xb07f('0x0'),_0xb07f('0x1')];function createListener(_0x57c710,_0x4c1af1){return function(_0x44a1c7){_0x4c1af1[_0xb07f('0x2')](_0x57c710,_0x44a1c7);};}function removeListener(_0x859638,_0x3aba3b){return function(){CmListEvents[_0xb07f('0x3')](_0x859638,_0x3aba3b);};}exports[_0xb07f('0x4')]=function(_0x3c3b17){for(var _0x438e12=0x0,_0xb6b7ee=events[_0xb07f('0x5')];_0x438e12<_0xb6b7ee;_0x438e12++){var _0xbb2f6b=events[_0x438e12];var _0x198402=createListener(_0xb07f('0x6')+_0xbb2f6b,_0x3c3b17);CmListEvents['on'](_0xbb2f6b,_0x198402);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 4e0a80c..27bc0b0 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 _0xe07b=['../../config/environment','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getAgents','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','/:id/users','addAgents','destroy','delete','removeAgents','multer','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1a43fc,_0xbebb8a){var _0x57a4b0=function(_0x202bc8){while(--_0x202bc8){_0x1a43fc['push'](_0x1a43fc['shift']());}};_0x57a4b0(++_0xbebb8a);}(_0xe07b,0x181));var _0xbe07=function(_0x15a9d0,_0x32ef2c){_0x15a9d0=_0x15a9d0-0x0;var _0x1729ee=_0xe07b[_0x15a9d0];return _0x1729ee;};'use strict';var multer=require(_0xbe07('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe07('0x1'));var router=express[_0xbe07('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbe07('0x3'));var interaction=require(_0xbe07('0x4'));var config=require(_0xbe07('0x5'));var controller=require('./cmList.controller');router[_0xbe07('0x6')]('/',auth[_0xbe07('0x7')](),controller[_0xbe07('0x8')]);router[_0xbe07('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xbe07('0x9')]);router[_0xbe07('0x6')](_0xbe07('0xa'),auth[_0xbe07('0x7')](),controller[_0xbe07('0xb')]);router[_0xbe07('0x6')](_0xbe07('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbe07('0x6')]('/:id/dispositions',auth[_0xbe07('0x7')](),controller[_0xbe07('0xd')]);router[_0xbe07('0x6')](_0xbe07('0xe'),auth[_0xbe07('0x7')](),controller[_0xbe07('0xf')]);router[_0xbe07('0x6')](_0xbe07('0x10'),auth[_0xbe07('0x7')](),controller['getContactsCsv']);router['get'](_0xbe07('0x11'),auth[_0xbe07('0x7')](),controller['getCustomFields']);router[_0xbe07('0x6')]('/:id/users',auth[_0xbe07('0x7')](),controller[_0xbe07('0x12')]);router[_0xbe07('0x13')]('/',auth[_0xbe07('0x7')](),controller[_0xbe07('0x14')]);router[_0xbe07('0x13')](_0xbe07('0x15'),auth['isAuthenticated'](),controller[_0xbe07('0x16')]);router['post']('/:id/contacts',auth[_0xbe07('0x7')](),controller[_0xbe07('0x17')]);router[_0xbe07('0x13')](_0xbe07('0x11'),auth[_0xbe07('0x7')](),controller[_0xbe07('0x18')]);router[_0xbe07('0x13')](_0xbe07('0x19'),auth['isAuthenticated'](),controller[_0xbe07('0x1a')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xbe07('0xc'),auth[_0xbe07('0x7')](),controller[_0xbe07('0x1b')]);router[_0xbe07('0x1c')](_0xbe07('0x15'),auth[_0xbe07('0x7')](),controller['removeDispositions']);router[_0xbe07('0x1c')](_0xbe07('0x19'),auth[_0xbe07('0x7')](),controller[_0xbe07('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xeb93=['/:id/dispositions','addContacts','addCustomField','addAgents','put','update','delete','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','index','get','/describe','isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xeb93,0x195));var _0x3eb9=function(_0x38e177,_0x59ec9f){_0x38e177=_0x38e177-0x0;var _0x1faf15=_0xeb93[_0x38e177];return _0x1faf15;};'use strict';var multer=require('multer');var util=require(_0x3eb9('0x0'));var path=require(_0x3eb9('0x1'));var timeout=require('connect-timeout');var express=require(_0x3eb9('0x2'));var router=express[_0x3eb9('0x3')]();var fs_extra=require(_0x3eb9('0x4'));var auth=require(_0x3eb9('0x5'));var interaction=require(_0x3eb9('0x6'));var config=require(_0x3eb9('0x7'));var controller=require(_0x3eb9('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3eb9('0x9')]);router[_0x3eb9('0xa')](_0x3eb9('0xb'),auth[_0x3eb9('0xc')](),controller[_0x3eb9('0xd')]);router['get'](_0x3eb9('0xe'),auth[_0x3eb9('0xc')](),controller[_0x3eb9('0xf')]);router[_0x3eb9('0xa')](_0x3eb9('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x3eb9('0xa')]('/:id/dispositions',auth[_0x3eb9('0xc')](),controller[_0x3eb9('0x11')]);router[_0x3eb9('0xa')](_0x3eb9('0x12'),auth[_0x3eb9('0xc')](),controller[_0x3eb9('0x13')]);router[_0x3eb9('0xa')](_0x3eb9('0x14'),auth[_0x3eb9('0xc')](),controller[_0x3eb9('0x15')]);router[_0x3eb9('0xa')](_0x3eb9('0x16'),auth[_0x3eb9('0xc')](),controller[_0x3eb9('0x17')]);router['get'](_0x3eb9('0x18'),auth[_0x3eb9('0xc')](),controller['getAgents']);router[_0x3eb9('0x19')]('/',auth['isAuthenticated'](),controller[_0x3eb9('0x1a')]);router[_0x3eb9('0x19')](_0x3eb9('0x1b'),auth[_0x3eb9('0xc')](),controller['addDisposition']);router[_0x3eb9('0x19')](_0x3eb9('0x12'),auth[_0x3eb9('0xc')](),controller[_0x3eb9('0x1c')]);router['post'](_0x3eb9('0x16'),auth[_0x3eb9('0xc')](),controller[_0x3eb9('0x1d')]);router[_0x3eb9('0x19')](_0x3eb9('0x18'),auth[_0x3eb9('0xc')](),controller[_0x3eb9('0x1e')]);router[_0x3eb9('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x3eb9('0x20')]);router[_0x3eb9('0x21')](_0x3eb9('0x10'),auth[_0x3eb9('0xc')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x3eb9('0xc')](),controller['removeDispositions']);router[_0x3eb9('0x21')](_0x3eb9('0x18'),auth['isAuthenticated'](),controller[_0x3eb9('0x22')]);module[_0x3eb9('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 353a926..97e1f66 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 _0x4776=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x1418eb,_0x3b9e3b){var _0x2f1254=function(_0x49e394){while(--_0x49e394){_0x1418eb['push'](_0x1418eb['shift']());}};_0x2f1254(++_0x3b9e3b);}(_0x4776,0x1a0));var _0x6477=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x4776[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x6477('0x0'));module[_0x6477('0x1')]={'name':{'type':Sequelize[_0x6477('0x2')],'get':function(_0x4a8820){return this['getDataValue'](_0x6477('0x3'));}},'field':{'type':Sequelize[_0x6477('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x2742=['field','STRING','sequelize','getDataValue'];(function(_0x2a3067,_0x29f35b){var _0x163230=function(_0x385ddd){while(--_0x385ddd){_0x2a3067['push'](_0x2a3067['shift']());}};_0x163230(++_0x29f35b);}(_0x2742,0x8a));var _0x2274=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2742[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2274('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x311be0){return this[_0x2274('0x1')](_0x2274('0x2'));}},'field':{'type':Sequelize[_0x2274('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x2274('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 6e7f956..0d68c40 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 _0x7a54=['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','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0xa19e09,_0x93d068){var _0x1fd014=function(_0x217c78){while(--_0x217c78){_0xa19e09['push'](_0xa19e09['shift']());}};_0x1fd014(++_0x93d068);}(_0x7a54,0x106));var _0x47a5=function(_0x2e267b,_0x7e9cd1){_0x2e267b=_0x2e267b-0x0;var _0x2980f4=_0x7a54[_0x2e267b];return _0x2980f4;};'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('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['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','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x13b153,_0x34c1b0){var _0x394313=function(_0x4376cd){while(--_0x4376cd){_0x13b153['push'](_0x13b153['shift']());}};_0x394313(++_0x34c1b0);}(_0x7a54,0x106));var _0x47a5=function(_0x355826,_0x15d1d4){_0x355826=_0x355826-0x0;var _0x194273=_0x7a54[_0x355826];return _0x194273;};'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('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index b0c52be..a9e2bd1 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 _0xcbfa=['Condition','tools_conditions','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0xcbfa,0xf2));var _0xacbf=function(_0x3ecf65,_0x3bac13){_0x3ecf65=_0x3ecf65-0x0;var _0x1907df=_0xcbfa[_0x3ecf65];return _0x1907df;};'use strict';var _=require(_0xacbf('0x0'));var util=require(_0xacbf('0x1'));var logger=require('../../config/logger')(_0xacbf('0x2'));var moment=require(_0xacbf('0x3'));var BPromise=require(_0xacbf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xacbf('0x5'));var rimraf=require(_0xacbf('0x6'));var config=require(_0xacbf('0x7'));var attributes=require('./condition.attributes');module[_0xacbf('0x8')]=function(_0xd0027,_0x30fee3){return _0xd0027[_0xacbf('0x9')](_0xacbf('0xa'),attributes,{'tableName':_0xacbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf446=['bluebird','rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger','moment'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0xf446,0x130));var _0x6f44=function(_0x497c12,_0x531c07){_0x497c12=_0x497c12-0x0;var _0x32b610=_0xf446[_0x497c12];return _0x32b610;};'use strict';var _=require(_0x6f44('0x0'));var util=require(_0x6f44('0x1'));var logger=require(_0x6f44('0x2'))('api');var moment=require(_0x6f44('0x3'));var BPromise=require(_0x6f44('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6f44('0x5'));var config=require(_0x6f44('0x6'));var attributes=require(_0x6f44('0x7'));module[_0x6f44('0x8')]=function(_0x2e50d8,_0x480dd2){return _0x2e50d8[_0x6f44('0x9')]('Condition',attributes,{'tableName':_0x6f44('0xa'),'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 d983597..d003cb0 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 _0xa44b=['debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x64e926,_0x16f95b){var _0x48b68a=function(_0x500b26){while(--_0x500b26){_0x64e926['push'](_0x64e926['shift']());}};_0x48b68a(++_0x16f95b);}(_0xa44b,0x126));var _0xba44=function(_0xdfca8d,_0x377316){_0xdfca8d=_0xdfca8d-0x0;var _0x1cbe00=_0xa44b[_0xdfca8d];return _0x1cbe00;};'use strict';var _=require(_0xba44('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba44('0x1'));var rs=require(_0xba44('0x2'));var fs=require('fs');var Redis=require(_0xba44('0x3'));var db=require(_0xba44('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xba44('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xba44('0x6')][_0xba44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f47cd,_0x14eaa1,_0x5571bf){return new BPromise(function(_0x48c937,_0x8809e7){return client[_0xba44('0x8')](_0x2f47cd,_0x5571bf)['then'](function(_0x4a9304){logger[_0xba44('0x9')](_0xba44('0xa'),_0x14eaa1,_0xba44('0xb'));logger[_0xba44('0xc')](_0xba44('0xd'),_0x14eaa1,_0xba44('0xb'),JSON['stringify'](_0x4a9304));if(_0x4a9304[_0xba44('0xe')]){if(_0x4a9304[_0xba44('0xe')][_0xba44('0xf')]===0x1f4){logger[_0xba44('0xe')]('Condition,\x20%s,\x20%s',_0x14eaa1,_0x4a9304[_0xba44('0xe')][_0xba44('0x10')]);return _0x8809e7(_0x4a9304[_0xba44('0xe')]['message']);}logger[_0xba44('0xe')]('Condition,\x20%s,\x20%s',_0x14eaa1,_0x4a9304[_0xba44('0xe')][_0xba44('0x10')]);return _0x48c937(_0x4a9304[_0xba44('0xe')]['message']);}else{logger[_0xba44('0x9')]('Condition,\x20%s,\x20%s',_0x14eaa1,_0xba44('0xb'));_0x48c937(_0x4a9304['result'][_0xba44('0x10')]);}})['catch'](function(_0x20904a){logger[_0xba44('0xe')](_0xba44('0xa'),_0x14eaa1,_0x20904a);_0x8809e7(_0x20904a);});});} \ No newline at end of file +var _0xe297=['result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','message','Condition,\x20%s,\x20%s'];(function(_0x395d57,_0x1f26af){var _0x2c3ccb=function(_0x146f48){while(--_0x146f48){_0x395d57['push'](_0x395d57['shift']());}};_0x2c3ccb(++_0x1f26af);}(_0xe297,0x10b));var _0x7e29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe297[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7e29('0x0'));var util=require(_0x7e29('0x1'));var moment=require('moment');var BPromise=require(_0x7e29('0x2'));var rs=require(_0x7e29('0x3'));var fs=require('fs');var Redis=require(_0x7e29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e29('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7e29('0x6'));var client=jayson[_0x7e29('0x7')][_0x7e29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c278b,_0x2c0fdb,_0x32994f){return new BPromise(function(_0x5d29b6,_0x45f4d7){return client[_0x7e29('0x9')](_0x4c278b,_0x32994f)[_0x7e29('0xa')](function(_0x45be73){logger[_0x7e29('0xb')]('Condition,\x20%s,\x20%s',_0x2c0fdb,_0x7e29('0xc'));logger[_0x7e29('0xd')](_0x7e29('0xe'),_0x2c0fdb,_0x7e29('0xc'),JSON['stringify'](_0x45be73));if(_0x45be73[_0x7e29('0xf')]){if(_0x45be73['error']['code']===0x1f4){logger[_0x7e29('0xf')]('Condition,\x20%s,\x20%s',_0x2c0fdb,_0x45be73['error'][_0x7e29('0x10')]);return _0x45f4d7(_0x45be73[_0x7e29('0xf')][_0x7e29('0x10')]);}logger[_0x7e29('0xf')](_0x7e29('0x11'),_0x2c0fdb,_0x45be73[_0x7e29('0xf')][_0x7e29('0x10')]);return _0x5d29b6(_0x45be73['error']['message']);}else{logger[_0x7e29('0xb')](_0x7e29('0x11'),_0x2c0fdb,_0x7e29('0xc'));_0x5d29b6(_0x45be73[_0x7e29('0x12')][_0x7e29('0x10')]);}})['catch'](function(_0x59b994){logger[_0x7e29('0xf')](_0x7e29('0x11'),_0x2c0fdb,_0x59b994);_0x45f4d7(_0x59b994);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index b51716d..82c6156 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 _0xd48a=['fs-extra','../../components/auth/service','../../config/environment','/:id','update','delete','isAuthenticated','destroy','exports','connect-timeout','Router'];(function(_0x297fe8,_0x2c9c7e){var _0x337023=function(_0x17eda0){while(--_0x17eda0){_0x297fe8['push'](_0x297fe8['shift']());}};_0x337023(++_0x2c9c7e);}(_0xd48a,0x127));var _0xad48=function(_0x326aca,_0x29899d){_0x326aca=_0x326aca-0x0;var _0x3b0a70=_0xd48a[_0x326aca];return _0x3b0a70;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xad48('0x0'));var express=require('express');var router=express[_0xad48('0x1')]();var fs_extra=require(_0xad48('0x2'));var auth=require(_0xad48('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xad48('0x4'));var controller=require('./condition.controller');router['put'](_0xad48('0x5'),auth['isAuthenticated'](),controller[_0xad48('0x6')]);router[_0xad48('0x7')](_0xad48('0x5'),auth[_0xad48('0x8')](),controller[_0xad48('0x9')]);module[_0xad48('0xa')]=router; \ No newline at end of file +var _0x43f8=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','delete','multer','util','path','connect-timeout'];(function(_0x5472e5,_0x18f03b){var _0x147ef5=function(_0x3e830c){while(--_0x3e830c){_0x5472e5['push'](_0x5472e5['shift']());}};_0x147ef5(++_0x18f03b);}(_0x43f8,0x1eb));var _0x843f=function(_0x4b06c2,_0x4efd46){_0x4b06c2=_0x4b06c2-0x0;var _0xe01afd=_0x43f8[_0x4b06c2];return _0xe01afd;};'use strict';var multer=require(_0x843f('0x0'));var util=require(_0x843f('0x1'));var path=require(_0x843f('0x2'));var timeout=require(_0x843f('0x3'));var express=require(_0x843f('0x4'));var router=express[_0x843f('0x5')]();var fs_extra=require(_0x843f('0x6'));var auth=require(_0x843f('0x7'));var interaction=require(_0x843f('0x8'));var config=require(_0x843f('0x9'));var controller=require(_0x843f('0xa'));router['put'](_0x843f('0xb'),auth[_0x843f('0xc')](),controller[_0x843f('0xd')]);router[_0x843f('0xe')]('/:id',auth[_0x843f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 868ee2d..90666ab 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd115=['name','STRING','sequelize','exports'];(function(_0x19a784,_0x200d5c){var _0x390e16=function(_0x29d19f){while(--_0x29d19f){_0x19a784['push'](_0x19a784['shift']());}};_0x390e16(++_0x200d5c);}(_0xd115,0x9e));var _0x5d11=function(_0x37a123,_0x107be2){_0x37a123=_0x37a123-0x0;var _0x4a7a3e=_0xd115[_0x37a123];return _0x4a7a3e;};'use strict';var Sequelize=require(_0x5d11('0x0'));module[_0x5d11('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5d11('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x5d11('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x9a56=['STRING','sequelize','name','INTEGER'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x9a56,0x1b5));var _0x69a5=function(_0x512b2f,_0x2bd3a6){_0x512b2f=_0x512b2f-0x0;var _0x258764=_0x9a56[_0x512b2f];return _0x258764;};'use strict';var Sequelize=require(_0x69a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x69a5('0x1')},'OrderBy':{'type':Sequelize[_0x69a5('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x69a5('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1bdb948..e80ba21 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfff0=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0xd5160a,_0x572c4b){var _0x576cf9=function(_0xa95da6){while(--_0xa95da6){_0xd5160a['push'](_0xd5160a['shift']());}};_0x576cf9(++_0x572c4b);}(_0xfff0,0x139));var _0x0fff=function(_0x2d2b99,_0x53d78f){_0x2d2b99=_0x2d2b99-0x0;var _0x2d25d9=_0xfff0[_0x2d2b99];return _0x2d25d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];function respondWithStatusCode(_0x13f768,_0x5abecd){_0x5abecd=_0x5abecd||0xcc;return function(_0x1fb243){if(_0x1fb243){return _0x13f768['sendStatus'](_0x5abecd);}return _0x13f768[_0x0fff('0x19')](_0x5abecd)[_0x0fff('0x1a')]();};}function respondWithResult(_0x38fc82,_0x2c0322){_0x2c0322=_0x2c0322||0xc8;return function(_0x55e5fa){if(_0x55e5fa){return _0x38fc82['status'](_0x2c0322)[_0x0fff('0x1b')](_0x55e5fa);}};}function respondWithFilteredResult(_0x50a9e4,_0x5636fd){return function(_0x51ceea){if(_0x51ceea){var _0x1fb430=typeof _0x5636fd[_0x0fff('0x1c')]==='undefined'&&typeof _0x5636fd[_0x0fff('0x1d')]===_0x0fff('0x1e');var _0x540a67=_0x51ceea['count'];var _0x48f36d=_0x1fb430?0x0:_0x5636fd[_0x0fff('0x1c')];var _0x606792=_0x1fb430?_0x51ceea[_0x0fff('0x1f')]:_0x5636fd[_0x0fff('0x1c')]+_0x5636fd[_0x0fff('0x1d')];var _0xe89b4a;if(_0x606792>=_0x540a67){_0x606792=_0x540a67;_0xe89b4a=0xc8;}else{_0xe89b4a=0xce;}_0x50a9e4['status'](_0xe89b4a);return _0x50a9e4[_0x0fff('0x20')](_0x0fff('0x21'),_0x48f36d+'-'+_0x606792+'/'+_0x540a67)[_0x0fff('0x1b')](_0x51ceea);}return null;};}function patchUpdates(_0x49d211){return function(_0x5e27df){try{jsonpatch[_0x0fff('0x22')](_0x5e27df,_0x49d211,!![]);}catch(_0x330e29){return BPromise[_0x0fff('0x23')](_0x330e29);}return _0x5e27df[_0x0fff('0x24')]();};}function saveUpdates(_0x502393,_0x155132){return function(_0x2f8665){if(_0x2f8665){return _0x2f8665[_0x0fff('0x25')](_0x502393)[_0x0fff('0x26')](function(_0x16e7f4){return _0x16e7f4;});}return null;};}function removeEntity(_0x17fba6,_0x580b8e){return function(_0x6a116c){if(_0x6a116c){return _0x6a116c[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x24cd18=_0x6a116c[_0x0fff('0x28')]({'plain':!![]});var _0x23d9f8='ContactItemTypes';return db[_0x0fff('0x29')][_0x0fff('0x27')]({'where':{'type':_0x23d9f8,'resourceId':_0x24cd18['id']}})[_0x0fff('0x26')](function(){return _0x6a116c;});})[_0x0fff('0x26')](function(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x27bd76,_0x3e6fef){return function(_0x44e54a){if(!_0x44e54a){_0x27bd76[_0x0fff('0x2a')](0x194);}return _0x44e54a;};}function handleError(_0x40651c,_0x2c39e3){_0x2c39e3=_0x2c39e3||0x1f4;return function(_0x495734){logger[_0x0fff('0x2b')](_0x495734[_0x0fff('0x2c')]);if(_0x495734[_0x0fff('0x2d')]){delete _0x495734[_0x0fff('0x2d')];}_0x40651c[_0x0fff('0x19')](_0x2c39e3)[_0x0fff('0x2e')](_0x495734);};}exports['index']=function(_0x31f9a4,_0xa16c29){var _0x351102={},_0x48f1d1={},_0x1016fa={'count':0x0,'rows':[]};var _0x3fa6fc=_['map'](db[_0x0fff('0x2f')][_0x0fff('0x30')],function(_0x15bb46){return{'name':_0x15bb46[_0x0fff('0x31')],'type':_0x15bb46[_0x0fff('0x32')][_0x0fff('0x33')]};});_0x48f1d1[_0x0fff('0x34')]=_[_0x0fff('0x35')](_0x3fa6fc,_0x0fff('0x2d'));_0x48f1d1[_0x0fff('0x36')]=_['keys'](_0x31f9a4[_0x0fff('0x36')]);_0x48f1d1[_0x0fff('0x37')]=_[_0x0fff('0x38')](_0x48f1d1[_0x0fff('0x34')],_0x48f1d1[_0x0fff('0x36')]);_0x351102['attributes']=_['intersection'](_0x48f1d1[_0x0fff('0x34')],qs[_0x0fff('0x39')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x39')]));_0x351102['attributes']=_0x351102[_0x0fff('0x3a')][_0x0fff('0x3b')]?_0x351102[_0x0fff('0x3a')]:_0x48f1d1[_0x0fff('0x34')];if(!_0x31f9a4['query'][_0x0fff('0x3c')](_0x0fff('0x3d'))){_0x351102[_0x0fff('0x1d')]=qs[_0x0fff('0x1d')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x1d')]);_0x351102[_0x0fff('0x1c')]=qs[_0x0fff('0x1c')](_0x31f9a4[_0x0fff('0x36')][_0x0fff('0x1c')]);}_0x351102[_0x0fff('0x3e')]=qs[_0x0fff('0x3f')](_0x31f9a4['query'][_0x0fff('0x3f')]);_0x351102[_0x0fff('0x40')]=qs[_0x0fff('0x37')](_[_0x0fff('0x41')](_0x31f9a4[_0x0fff('0x36')],_0x48f1d1[_0x0fff('0x37')]),_0x3fa6fc);if(_0x31f9a4['query'][_0x0fff('0x42')]){_0x351102[_0x0fff('0x40')]=_[_0x0fff('0x43')](_0x351102[_0x0fff('0x40')],{'$or':_[_0x0fff('0x35')](_0x3fa6fc,function(_0x101151){if(_0x101151[_0x0fff('0x32')]!==_0x0fff('0x44')){var _0x28e0aa={};_0x28e0aa[_0x101151['name']]={'$like':'%'+_0x31f9a4[_0x0fff('0x36')]['filter']+'%'};return _0x28e0aa;}})});}_0x351102=_[_0x0fff('0x43')]({},_0x351102,_0x31f9a4[_0x0fff('0x45')]);var _0x126f6a={'where':_0x351102['where']};return db['ContactItemType'][_0x0fff('0x1f')](_0x126f6a)[_0x0fff('0x26')](function(_0x311348){_0x1016fa['count']=_0x311348;if(_0x31f9a4['query'][_0x0fff('0x46')]){_0x351102['include']=[{'all':!![]}];}return db[_0x0fff('0x2f')][_0x0fff('0x47')](_0x351102);})[_0x0fff('0x26')](function(_0x309d75){_0x1016fa[_0x0fff('0x48')]=_0x309d75;return _0x1016fa;})[_0x0fff('0x26')](respondWithFilteredResult(_0xa16c29,_0x351102))['catch'](handleError(_0xa16c29,null));};exports[_0x0fff('0x49')]=function(_0x39b829,_0x2a8c5e){var _0x41b4d5={'raw':!![],'where':{'id':_0x39b829[_0x0fff('0x4a')]['id']}},_0x7157e5={};_0x7157e5[_0x0fff('0x34')]=_['keys'](db[_0x0fff('0x2f')][_0x0fff('0x30')]);_0x7157e5[_0x0fff('0x36')]=_['keys'](_0x39b829[_0x0fff('0x36')]);_0x7157e5[_0x0fff('0x37')]=_[_0x0fff('0x38')](_0x7157e5[_0x0fff('0x34')],_0x7157e5[_0x0fff('0x36')]);_0x41b4d5[_0x0fff('0x3a')]=_[_0x0fff('0x38')](_0x7157e5[_0x0fff('0x34')],qs[_0x0fff('0x39')](_0x39b829[_0x0fff('0x36')][_0x0fff('0x39')]));_0x41b4d5['attributes']=_0x41b4d5[_0x0fff('0x3a')][_0x0fff('0x3b')]?_0x41b4d5['attributes']:_0x7157e5[_0x0fff('0x34')];if(_0x39b829[_0x0fff('0x36')][_0x0fff('0x46')]){_0x41b4d5['include']=[{'all':!![]}];}_0x41b4d5=_['merge']({},_0x41b4d5,_0x39b829[_0x0fff('0x45')]);return db['ContactItemType']['find'](_0x41b4d5)[_0x0fff('0x26')](handleEntityNotFound(_0x2a8c5e,null))[_0x0fff('0x26')](respondWithResult(_0x2a8c5e,null))[_0x0fff('0x4b')](handleError(_0x2a8c5e,null));};exports[_0x0fff('0x4c')]=function(_0x3b4b8e,_0x1a7677){return db['ContactItemType'][_0x0fff('0x4c')](_0x3b4b8e[_0x0fff('0x4d')],{})[_0x0fff('0x26')](function(_0x32568a){var _0x30c4d6=_0x3b4b8e[_0x0fff('0x4e')]['get']({'plain':!![]});if(!_0x30c4d6)throw new Error(_0x0fff('0x4f'));if(_0x30c4d6[_0x0fff('0x50')]==='user'){var _0x1fc872=_0x32568a['get']({'plain':!![]});var _0x5f1943='ContactItemTypes';return db[_0x0fff('0x51')][_0x0fff('0x52')]({'where':{'name':_0x5f1943,'userProfileId':_0x30c4d6[_0x0fff('0x53')]},'raw':!![]})[_0x0fff('0x26')](function(_0x579291){if(_0x579291&&_0x579291['autoAssociation']===0x0){return db[_0x0fff('0x29')][_0x0fff('0x4c')]({'name':_0x1fc872[_0x0fff('0x2d')],'resourceId':_0x1fc872['id'],'type':_0x579291[_0x0fff('0x2d')],'sectionId':_0x579291['id']},{})[_0x0fff('0x26')](function(){return _0x32568a;});}else{return _0x32568a;}})['catch'](function(_0x3b401c){logger[_0x0fff('0x2b')](_0x0fff('0x54'),_0x3b401c);throw _0x3b401c;});}return _0x32568a;})[_0x0fff('0x26')](respondWithResult(_0x1a7677,0xc9))[_0x0fff('0x4b')](handleError(_0x1a7677,null));};exports[_0x0fff('0x25')]=function(_0x1af59f,_0x236da3){if(_0x1af59f[_0x0fff('0x4d')]['id']){delete _0x1af59f[_0x0fff('0x4d')]['id'];}return db[_0x0fff('0x2f')][_0x0fff('0x52')]({'where':{'id':_0x1af59f[_0x0fff('0x4a')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x236da3,null))[_0x0fff('0x26')](saveUpdates(_0x1af59f[_0x0fff('0x4d')],null))[_0x0fff('0x26')](respondWithResult(_0x236da3,null))[_0x0fff('0x4b')](handleError(_0x236da3,null));};exports[_0x0fff('0x27')]=function(_0x398513,_0x18c853){return db['ContactItemType'][_0x0fff('0x52')]({'where':{'id':_0x398513[_0x0fff('0x4a')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x18c853,null))[_0x0fff('0x26')](db['CmContactHasItem'][_0x0fff('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x398513['params']['id']}}))[_0x0fff('0x26')](removeEntity(_0x18c853,null))[_0x0fff('0x4b')](handleError(_0x18c853,null));}; \ No newline at end of file +var _0x4888=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ContactItemType','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x4888,0x198));var _0x8488=function(_0x537bcd,_0x13bae1){_0x537bcd=_0x537bcd-0x0;var _0x6cc881=_0x4888[_0x537bcd];return _0x6cc881;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){var _0x5b8885=_0x290b33['get']({'plain':!![]});var _0x472624='ContactItemTypes';return db['UserProfileResource'][_0x8488('0x22')]({'where':{'type':_0x472624,'resourceId':_0x5b8885['id']}})[_0x8488('0x21')](function(){return _0x290b33;});})[_0x8488('0x21')](function(){_0x140b0b[_0x8488('0x17')](0xcc)[_0x8488('0x23')]();});}};}function handleEntityNotFound(_0x503b83,_0x1b0519){return function(_0x38c137){if(!_0x38c137){_0x503b83[_0x8488('0x24')](0x194);}return _0x38c137;};}function handleError(_0x3df1f9,_0x460001){_0x460001=_0x460001||0x1f4;return function(_0x27f5cf){logger[_0x8488('0x25')](_0x27f5cf[_0x8488('0x26')]);if(_0x27f5cf[_0x8488('0x27')]){delete _0x27f5cf[_0x8488('0x27')];}_0x3df1f9[_0x8488('0x17')](_0x460001)['send'](_0x27f5cf);};}exports['index']=function(_0x4e3fe2,_0x292fe8){var _0x408c36={},_0x19cf42={},_0x121dcc={'count':0x0,'rows':[]};var _0x117321=_[_0x8488('0x28')](db['ContactItemType'][_0x8488('0x29')],function(_0x14f378){return{'name':_0x14f378[_0x8488('0x2a')],'type':_0x14f378[_0x8488('0x2b')][_0x8488('0x2c')]};});_0x19cf42['model']=_[_0x8488('0x28')](_0x117321,_0x8488('0x27'));_0x19cf42['query']=_[_0x8488('0x2d')](_0x4e3fe2[_0x8488('0x2e')]);_0x19cf42[_0x8488('0x2f')]=_[_0x8488('0x30')](_0x19cf42[_0x8488('0x31')],_0x19cf42['query']);_0x408c36[_0x8488('0x32')]=_[_0x8488('0x30')](_0x19cf42[_0x8488('0x31')],qs['fields'](_0x4e3fe2[_0x8488('0x2e')]['fields']));_0x408c36[_0x8488('0x32')]=_0x408c36[_0x8488('0x32')][_0x8488('0x33')]?_0x408c36[_0x8488('0x32')]:_0x19cf42['model'];if(!_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x34')](_0x8488('0x35'))){_0x408c36['limit']=qs[_0x8488('0x1a')](_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x1a')]);_0x408c36[_0x8488('0x19')]=qs[_0x8488('0x19')](_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x19')]);}_0x408c36[_0x8488('0x36')]=qs[_0x8488('0x37')](_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x37')]);_0x408c36['where']=qs['filters'](_[_0x8488('0x38')](_0x4e3fe2[_0x8488('0x2e')],_0x19cf42[_0x8488('0x2f')]),_0x117321);if(_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x39')]){_0x408c36[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x408c36[_0x8488('0x3a')],{'$or':_[_0x8488('0x28')](_0x117321,function(_0x5f561c){if(_0x5f561c[_0x8488('0x2b')]!==_0x8488('0x3c')){var _0x11a258={};_0x11a258[_0x5f561c['name']]={'$like':'%'+_0x4e3fe2[_0x8488('0x2e')][_0x8488('0x39')]+'%'};return _0x11a258;}})});}_0x408c36=_[_0x8488('0x3b')]({},_0x408c36,_0x4e3fe2[_0x8488('0x3d')]);var _0x44d5f2={'where':_0x408c36[_0x8488('0x3a')]};return db[_0x8488('0x3e')]['count'](_0x44d5f2)[_0x8488('0x21')](function(_0x1c33a1){_0x121dcc[_0x8488('0x1c')]=_0x1c33a1;if(_0x4e3fe2['query'][_0x8488('0x3f')]){_0x408c36['include']=[{'all':!![]}];}return db[_0x8488('0x3e')][_0x8488('0x40')](_0x408c36);})['then'](function(_0x22a3f3){_0x121dcc[_0x8488('0x41')]=_0x22a3f3;return _0x121dcc;})[_0x8488('0x21')](respondWithFilteredResult(_0x292fe8,_0x408c36))[_0x8488('0x42')](handleError(_0x292fe8,null));};exports[_0x8488('0x43')]=function(_0x4e5c83,_0x3724be){var _0x50c31d={'raw':!![],'where':{'id':_0x4e5c83[_0x8488('0x44')]['id']}},_0x3440ae={};_0x3440ae[_0x8488('0x31')]=_[_0x8488('0x2d')](db[_0x8488('0x3e')][_0x8488('0x29')]);_0x3440ae[_0x8488('0x2e')]=_[_0x8488('0x2d')](_0x4e5c83[_0x8488('0x2e')]);_0x3440ae[_0x8488('0x2f')]=_[_0x8488('0x30')](_0x3440ae[_0x8488('0x31')],_0x3440ae[_0x8488('0x2e')]);_0x50c31d[_0x8488('0x32')]=_[_0x8488('0x30')](_0x3440ae[_0x8488('0x31')],qs[_0x8488('0x45')](_0x4e5c83['query'][_0x8488('0x45')]));_0x50c31d[_0x8488('0x32')]=_0x50c31d[_0x8488('0x32')][_0x8488('0x33')]?_0x50c31d['attributes']:_0x3440ae[_0x8488('0x31')];if(_0x4e5c83[_0x8488('0x2e')][_0x8488('0x3f')]){_0x50c31d[_0x8488('0x46')]=[{'all':!![]}];}_0x50c31d=_['merge']({},_0x50c31d,_0x4e5c83[_0x8488('0x3d')]);return db[_0x8488('0x3e')][_0x8488('0x47')](_0x50c31d)[_0x8488('0x21')](handleEntityNotFound(_0x3724be,null))[_0x8488('0x21')](respondWithResult(_0x3724be,null))[_0x8488('0x42')](handleError(_0x3724be,null));};exports[_0x8488('0x48')]=function(_0x299d8e,_0x1bc2e1){return db[_0x8488('0x3e')][_0x8488('0x48')](_0x299d8e[_0x8488('0x49')],{})[_0x8488('0x21')](function(_0x58b319){var _0x56bc65=_0x299d8e[_0x8488('0x4a')][_0x8488('0x4b')]({'plain':!![]});if(!_0x56bc65)throw new Error(_0x8488('0x4c'));if(_0x56bc65[_0x8488('0x4d')]===_0x8488('0x4a')){var _0x22d22c=_0x58b319[_0x8488('0x4b')]({'plain':!![]});var _0x27dfd2=_0x8488('0x4e');return db['UserProfileSection'][_0x8488('0x47')]({'where':{'name':_0x27dfd2,'userProfileId':_0x56bc65[_0x8488('0x4f')]},'raw':!![]})['then'](function(_0x35e08a){if(_0x35e08a&&_0x35e08a[_0x8488('0x50')]===0x0){return db[_0x8488('0x51')][_0x8488('0x48')]({'name':_0x22d22c['name'],'resourceId':_0x22d22c['id'],'type':_0x35e08a[_0x8488('0x27')],'sectionId':_0x35e08a['id']},{})[_0x8488('0x21')](function(){return _0x58b319;});}else{return _0x58b319;}})[_0x8488('0x42')](function(_0x5c55bf){logger[_0x8488('0x25')](_0x8488('0x52'),_0x5c55bf);throw _0x5c55bf;});}return _0x58b319;})[_0x8488('0x21')](respondWithResult(_0x1bc2e1,0xc9))[_0x8488('0x42')](handleError(_0x1bc2e1,null));};exports['update']=function(_0x2eff23,_0x574bf1){if(_0x2eff23['body']['id']){delete _0x2eff23[_0x8488('0x49')]['id'];}return db['ContactItemType'][_0x8488('0x47')]({'where':{'id':_0x2eff23[_0x8488('0x44')]['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x574bf1,null))[_0x8488('0x21')](saveUpdates(_0x2eff23[_0x8488('0x49')],null))[_0x8488('0x21')](respondWithResult(_0x574bf1,null))['catch'](handleError(_0x574bf1,null));};exports[_0x8488('0x22')]=function(_0x693741,_0x21765b){return db[_0x8488('0x3e')][_0x8488('0x47')]({'where':{'id':_0x693741['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x21765b,null))['then'](db[_0x8488('0x53')][_0x8488('0x54')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x693741['params']['id']}}))[_0x8488('0x21')](removeEntity(_0x21765b,null))[_0x8488('0x42')](handleError(_0x21765b,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 268e4d5..7d97e79 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4ca=['exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes'];(function(_0x306320,_0xd44cd9){var _0x4de305=function(_0xbf74a5){while(--_0xbf74a5){_0x306320['push'](_0x306320['shift']());}};_0x4de305(++_0xd44cd9);}(_0xd4ca,0x1d2));var _0xad4c=function(_0x3053b1,_0x477e0e){_0x3053b1=_0x3053b1-0x0;var _0x5d4207=_0xd4ca[_0x3053b1];return _0x5d4207;};'use strict';var _=require(_0xad4c('0x0'));var util=require(_0xad4c('0x1'));var logger=require(_0xad4c('0x2'))(_0xad4c('0x3'));var moment=require(_0xad4c('0x4'));var BPromise=require(_0xad4c('0x5'));var rp=require(_0xad4c('0x6'));var fs=require('fs');var path=require(_0xad4c('0x7'));var rimraf=require(_0xad4c('0x8'));var config=require('../../config/environment');var attributes=require(_0xad4c('0x9'));module[_0xad4c('0xa')]=function(_0x9c2b2e,_0x1df83f){return _0x9c2b2e[_0xad4c('0xb')](_0xad4c('0xc'),attributes,{'tableName':_0xad4c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5f2=['request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird'];(function(_0x2f4ee6,_0x24a540){var _0x28f20e=function(_0x239715){while(--_0x239715){_0x2f4ee6['push'](_0x2f4ee6['shift']());}};_0x28f20e(++_0x24a540);}(_0xc5f2,0x150));var _0x2c5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c5f('0x0'));var util=require(_0x2c5f('0x1'));var logger=require(_0x2c5f('0x2'))(_0x2c5f('0x3'));var moment=require('moment');var BPromise=require(_0x2c5f('0x4'));var rp=require(_0x2c5f('0x5'));var fs=require('fs');var path=require(_0x2c5f('0x6'));var rimraf=require(_0x2c5f('0x7'));var config=require(_0x2c5f('0x8'));var attributes=require(_0x2c5f('0x9'));module['exports']=function(_0x10ef43,_0x46d1cc){return _0x10ef43['define']('ContactItemType',attributes,{'tableName':_0x2c5f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index bc7333a..cc3f854 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12aa=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','ContactItemType,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x38eaeb,_0x6b7dfb){var _0xd7cffb=function(_0x147997){while(--_0x147997){_0x38eaeb['push'](_0x38eaeb['shift']());}};_0xd7cffb(++_0x6b7dfb);}(_0x12aa,0x1a0));var _0xa12a=function(_0x30a77c,_0x143926){_0x30a77c=_0x30a77c-0x0;var _0x35d3e2=_0x12aa[_0x30a77c];return _0x35d3e2;};'use strict';var _=require(_0xa12a('0x0'));var util=require(_0xa12a('0x1'));var moment=require('moment');var BPromise=require(_0xa12a('0x2'));var rs=require(_0xa12a('0x3'));var fs=require('fs');var Redis=require(_0xa12a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa12a('0x5'));var logger=require(_0xa12a('0x6'))('rpc');var config=require(_0xa12a('0x7'));var jayson=require(_0xa12a('0x8'));var client=jayson[_0xa12a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf785c7,_0x261987,_0xfc8356){return new BPromise(function(_0x5a6901,_0x365fa5){return client[_0xa12a('0xa')](_0xf785c7,_0xfc8356)[_0xa12a('0xb')](function(_0x30d8e6){logger['info']('ContactItemType,\x20%s,\x20%s',_0x261987,_0xa12a('0xc'));logger[_0xa12a('0xd')](_0xa12a('0xe'),_0x261987,_0xa12a('0xc'),JSON[_0xa12a('0xf')](_0x30d8e6));if(_0x30d8e6['error']){if(_0x30d8e6[_0xa12a('0x10')]['code']===0x1f4){logger[_0xa12a('0x10')](_0xa12a('0x11'),_0x261987,_0x30d8e6[_0xa12a('0x10')]['message']);return _0x365fa5(_0x30d8e6[_0xa12a('0x10')][_0xa12a('0x12')]);}logger[_0xa12a('0x10')](_0xa12a('0x11'),_0x261987,_0x30d8e6['error'][_0xa12a('0x12')]);return _0x5a6901(_0x30d8e6[_0xa12a('0x10')]['message']);}else{logger[_0xa12a('0x13')](_0xa12a('0x11'),_0x261987,_0xa12a('0xc'));_0x5a6901(_0x30d8e6[_0xa12a('0x14')]['message']);}})[_0xa12a('0x15')](function(_0x28bdbe){logger['error'](_0xa12a('0x11'),_0x261987,_0x28bdbe);_0x365fa5(_0x28bdbe);});});} \ No newline at end of file +var _0xded4=['error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x5a87ca,_0x7a453a){var _0xe33923=function(_0x43f8f9){while(--_0x43f8f9){_0x5a87ca['push'](_0x5a87ca['shift']());}};_0xe33923(++_0x7a453a);}(_0xded4,0x1bd));var _0x4ded=function(_0x1d9d26,_0x5825fe){_0x1d9d26=_0x1d9d26-0x0;var _0x941f14=_0xded4[_0x1d9d26];return _0x941f14;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ded('0x0'));var BPromise=require(_0x4ded('0x1'));var rs=require(_0x4ded('0x2'));var fs=require('fs');var Redis=require(_0x4ded('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ded('0x4'));var logger=require('../../config/logger')(_0x4ded('0x5'));var config=require(_0x4ded('0x6'));var jayson=require(_0x4ded('0x7'));var client=jayson[_0x4ded('0x8')][_0x4ded('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6a0d15,_0x53802c,_0x51ea60){return new BPromise(function(_0x1a2eeb,_0x24212f){return client[_0x4ded('0xa')](_0x6a0d15,_0x51ea60)[_0x4ded('0xb')](function(_0x1e8609){logger[_0x4ded('0xc')](_0x4ded('0xd'),_0x53802c,_0x4ded('0xe'));logger[_0x4ded('0xf')](_0x4ded('0x10'),_0x53802c,_0x4ded('0xe'),JSON['stringify'](_0x1e8609));if(_0x1e8609[_0x4ded('0x11')]){if(_0x1e8609['error'][_0x4ded('0x12')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x53802c,_0x1e8609[_0x4ded('0x11')]['message']);return _0x24212f(_0x1e8609[_0x4ded('0x11')][_0x4ded('0x13')]);}logger[_0x4ded('0x11')](_0x4ded('0xd'),_0x53802c,_0x1e8609['error'][_0x4ded('0x13')]);return _0x1a2eeb(_0x1e8609['error'][_0x4ded('0x13')]);}else{logger[_0x4ded('0xc')](_0x4ded('0xd'),_0x53802c,'request\x20sent');_0x1a2eeb(_0x1e8609['result'][_0x4ded('0x13')]);}})[_0x4ded('0x14')](function(_0xe8cbcf){logger[_0x4ded('0x11')](_0x4ded('0xd'),_0x53802c,_0xe8cbcf);_0x24212f(_0xe8cbcf);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 0fc2f8d..b9add02 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbfa=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdbfa,0x93));var _0xadbf=function(_0x38b04a,_0xc8d4){_0x38b04a=_0x38b04a-0x0;var _0x2bc033=_0xdbfa[_0x38b04a];return _0x2bc033;};'use strict';var multer=require(_0xadbf('0x0'));var util=require(_0xadbf('0x1'));var path=require(_0xadbf('0x2'));var timeout=require(_0xadbf('0x3'));var express=require(_0xadbf('0x4'));var router=express['Router']();var fs_extra=require(_0xadbf('0x5'));var auth=require(_0xadbf('0x6'));var interaction=require(_0xadbf('0x7'));var config=require(_0xadbf('0x8'));var controller=require(_0xadbf('0x9'));router[_0xadbf('0xa')]('/',auth[_0xadbf('0xb')](),controller['index']);router['get']('/:id',auth[_0xadbf('0xb')](),controller[_0xadbf('0xc')]);router[_0xadbf('0xd')]('/',auth['isAuthenticated'](),controller[_0xadbf('0xe')]);router[_0xadbf('0xf')](_0xadbf('0x10'),auth[_0xadbf('0xb')](),controller[_0xadbf('0x11')]);router[_0xadbf('0x12')](_0xadbf('0x10'),auth[_0xadbf('0xb')](),controller[_0xadbf('0x13')]);module[_0xadbf('0x14')]=router; \ No newline at end of file +var _0x6790=['fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','express'];(function(_0x23553a,_0x4750ab){var _0x42e2b0=function(_0x3caaff){while(--_0x3caaff){_0x23553a['push'](_0x23553a['shift']());}};_0x42e2b0(++_0x4750ab);}(_0x6790,0x84));var _0x0679=function(_0x32d9c0,_0x5d60ec){_0x32d9c0=_0x32d9c0-0x0;var _0x43614d=_0x6790[_0x32d9c0];return _0x43614d;};'use strict';var multer=require(_0x0679('0x0'));var util=require('util');var path=require(_0x0679('0x1'));var timeout=require(_0x0679('0x2'));var express=require(_0x0679('0x3'));var router=express['Router']();var fs_extra=require(_0x0679('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0679('0x5'));var config=require(_0x0679('0x6'));var controller=require(_0x0679('0x7'));router['get']('/',auth[_0x0679('0x8')](),controller['index']);router[_0x0679('0x9')](_0x0679('0xa'),auth[_0x0679('0x8')](),controller[_0x0679('0xb')]);router[_0x0679('0xc')]('/',auth[_0x0679('0x8')](),controller[_0x0679('0xd')]);router[_0x0679('0xe')](_0x0679('0xa'),auth['isAuthenticated'](),controller[_0x0679('0xf')]);router['delete'](_0x0679('0xa'),auth[_0x0679('0x8')](),controller[_0x0679('0x10')]);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 e2f013a..d79751e 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 _0xb7e7=['STRING','sequelize'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xb7e7[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x5ed7e1,_0xa6c49d){var _0x1b9e4f=function(_0x4c9f53){while(--_0x4c9f53){_0x5ed7e1['push'](_0x5ed7e1['shift']());}};_0x1b9e4f(++_0xa6c49d);}(_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/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index d6e1ee6..9b8cb6a 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 _0x4dd4=['clone','omit','createdAt','updatedAt','autoAssociation','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','counter','attrMetric','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','pick','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Dashboard','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x5ba834,_0x39a9c4){var _0x2e2795=function(_0x33a7b0){while(--_0x33a7b0){_0x5ba834['push'](_0x5ba834['shift']());}};_0x2e2795(++_0x39a9c4);}(_0x4dd4,0x13b));var _0x44dd=function(_0x199cfe,_0x2b1c25){_0x199cfe=_0x199cfe-0x0;var _0x592abb=_0x4dd4[_0x199cfe];return _0x592abb;};'use strict';var emlformat=require(_0x44dd('0x0'));var rimraf=require(_0x44dd('0x1'));var zipdir=require(_0x44dd('0x2'));var jsonpatch=require(_0x44dd('0x3'));var rp=require('request-promise');var moment=require(_0x44dd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x44dd('0x5'));var util=require(_0x44dd('0x6'));var path=require(_0x44dd('0x7'));var sox=require(_0x44dd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44dd('0x9'));var _=require(_0x44dd('0xa'));var squel=require(_0x44dd('0xb'));var crypto=require('crypto');var jsforce=require(_0x44dd('0xc'));var deskjs=require(_0x44dd('0xd'));var toCsv=require(_0x44dd('0xe'));var querystring=require(_0x44dd('0xf'));var Papa=require(_0x44dd('0x10'));var Redis=require(_0x44dd('0x11'));var authService=require(_0x44dd('0x12'));var qs=require(_0x44dd('0x13'));var as=require(_0x44dd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44dd('0x15'))(_0x44dd('0x16'));var utils=require(_0x44dd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x44dd('0x18'));var db=require('../../mysqldb')['db'];config[_0x44dd('0x19')]=_[_0x44dd('0x1a')](config['redis'],{'host':_0x44dd('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0x44dd('0x1c')](socket);function respondWithStatusCode(_0x305035,_0x4a6b53){_0x4a6b53=_0x4a6b53||0xcc;return function(_0x392259){if(_0x392259){return _0x305035[_0x44dd('0x1d')](_0x4a6b53);}return _0x305035[_0x44dd('0x1e')](_0x4a6b53)[_0x44dd('0x1f')]();};}function respondWithResult(_0xc5c88a,_0x1591c4){_0x1591c4=_0x1591c4||0xc8;return function(_0x52ce9b){if(_0x52ce9b){return _0xc5c88a[_0x44dd('0x1e')](_0x1591c4)['json'](_0x52ce9b);}};}function respondWithFilteredResult(_0x5664e0,_0x380189){return function(_0x1324ba){if(_0x1324ba){var _0x418f1e=typeof _0x380189['offset']===_0x44dd('0x20')&&typeof _0x380189[_0x44dd('0x21')]===_0x44dd('0x20');var _0x45db54=_0x1324ba[_0x44dd('0x22')];var _0x4a6cf6=_0x418f1e?0x0:_0x380189['offset'];var _0x2fc4db=_0x418f1e?_0x1324ba[_0x44dd('0x22')]:_0x380189[_0x44dd('0x23')]+_0x380189[_0x44dd('0x21')];var _0x3ecc1c;if(_0x2fc4db>=_0x45db54){_0x2fc4db=_0x45db54;_0x3ecc1c=0xc8;}else{_0x3ecc1c=0xce;}_0x5664e0[_0x44dd('0x1e')](_0x3ecc1c);return _0x5664e0[_0x44dd('0x24')](_0x44dd('0x25'),_0x4a6cf6+'-'+_0x2fc4db+'/'+_0x45db54)['json'](_0x1324ba);}return null;};}function patchUpdates(_0x100cf7){return function(_0x3558f1){try{jsonpatch[_0x44dd('0x26')](_0x3558f1,_0x100cf7,!![]);}catch(_0x49ebba){return BPromise[_0x44dd('0x27')](_0x49ebba);}return _0x3558f1[_0x44dd('0x28')]();};}function saveUpdates(_0x4fb672,_0x53b45f){return function(_0xec6fa0){if(_0xec6fa0){return _0xec6fa0[_0x44dd('0x29')](_0x4fb672)[_0x44dd('0x2a')](function(_0x5da535){return _0x5da535;});}return null;};}function removeEntity(_0x21d30b,_0x22408b){return function(_0x55da31){if(_0x55da31){return _0x55da31['destroy']()['then'](function(){var _0x41375e=_0x55da31[_0x44dd('0x2b')]({'plain':!![]});var _0x4317f8=_0x44dd('0x2c');return db[_0x44dd('0x2d')][_0x44dd('0x2e')]({'where':{'type':_0x4317f8,'resourceId':_0x41375e['id']}})[_0x44dd('0x2a')](function(){return _0x55da31;});})['then'](function(){_0x21d30b[_0x44dd('0x1e')](0xcc)[_0x44dd('0x1f')]();});}};}function handleEntityNotFound(_0x4478f6,_0x120370){return function(_0x2d09d2){if(!_0x2d09d2){_0x4478f6['sendStatus'](0x194);}return _0x2d09d2;};}function handleError(_0x3da2f9,_0x3e8fc5){_0x3e8fc5=_0x3e8fc5||0x1f4;return function(_0x4aee05){logger[_0x44dd('0x2f')](_0x4aee05[_0x44dd('0x30')]);if(_0x4aee05[_0x44dd('0x31')]){delete _0x4aee05['name'];}_0x3da2f9['status'](_0x3e8fc5)[_0x44dd('0x32')](_0x4aee05);};}exports[_0x44dd('0x33')]=function(_0x24485d,_0x3b24a1){var _0x28a009={},_0x1135d0={},_0x417865={'count':0x0,'rows':[]};var _0x5bf41a=_[_0x44dd('0x34')](db['Dashboard'][_0x44dd('0x35')],function(_0x5eff87){return{'name':_0x5eff87[_0x44dd('0x36')],'type':_0x5eff87[_0x44dd('0x37')][_0x44dd('0x38')]};});_0x1135d0[_0x44dd('0x39')]=_[_0x44dd('0x34')](_0x5bf41a,_0x44dd('0x31'));_0x1135d0[_0x44dd('0x3a')]=_[_0x44dd('0x3b')](_0x24485d[_0x44dd('0x3a')]);_0x1135d0[_0x44dd('0x3c')]=_[_0x44dd('0x3d')](_0x1135d0[_0x44dd('0x39')],_0x1135d0[_0x44dd('0x3a')]);_0x28a009[_0x44dd('0x3e')]=_[_0x44dd('0x3d')](_0x1135d0['model'],qs['fields'](_0x24485d[_0x44dd('0x3a')][_0x44dd('0x3f')]));_0x28a009[_0x44dd('0x3e')]=_0x28a009[_0x44dd('0x3e')][_0x44dd('0x40')]?_0x28a009[_0x44dd('0x3e')]:_0x1135d0[_0x44dd('0x39')];if(!_0x24485d['query'][_0x44dd('0x41')](_0x44dd('0x42'))){_0x28a009['limit']=qs[_0x44dd('0x21')](_0x24485d[_0x44dd('0x3a')][_0x44dd('0x21')]);_0x28a009['offset']=qs[_0x44dd('0x23')](_0x24485d[_0x44dd('0x3a')]['offset']);}_0x28a009[_0x44dd('0x43')]=qs[_0x44dd('0x44')](_0x24485d[_0x44dd('0x3a')]['sort']);_0x28a009[_0x44dd('0x45')]=qs[_0x44dd('0x3c')](_['pick'](_0x24485d[_0x44dd('0x3a')],_0x1135d0[_0x44dd('0x3c')]),_0x5bf41a);if(_0x24485d[_0x44dd('0x3a')][_0x44dd('0x46')]){_0x28a009['where']=_[_0x44dd('0x47')](_0x28a009[_0x44dd('0x45')],{'$or':_['map'](_0x5bf41a,function(_0x18be0d){if(_0x18be0d['type']!==_0x44dd('0x48')){var _0x35a88f={};_0x35a88f[_0x18be0d['name']]={'$like':'%'+_0x24485d[_0x44dd('0x3a')][_0x44dd('0x46')]+'%'};return _0x35a88f;}})});}_0x28a009=_[_0x44dd('0x47')]({},_0x28a009,_0x24485d[_0x44dd('0x49')]);var _0x553720={'where':_0x28a009[_0x44dd('0x45')]};return db[_0x44dd('0x4a')]['count'](_0x553720)[_0x44dd('0x2a')](function(_0xad1ed3){_0x417865['count']=_0xad1ed3;if(_0x24485d[_0x44dd('0x3a')][_0x44dd('0x4b')]){_0x28a009['include']=[{'all':!![]}];}return db['Dashboard'][_0x44dd('0x4c')](_0x28a009);})['then'](function(_0x589c64){_0x417865[_0x44dd('0x4d')]=_0x589c64;return _0x417865;})[_0x44dd('0x2a')](respondWithFilteredResult(_0x3b24a1,_0x28a009))[_0x44dd('0x4e')](handleError(_0x3b24a1,null));};exports[_0x44dd('0x4f')]=function(_0x2a544a,_0x336ee1){var _0x75d59d={'raw':![],'where':{'id':_0x2a544a[_0x44dd('0x50')]['id']}},_0x2c3f13={};_0x2c3f13[_0x44dd('0x39')]=_[_0x44dd('0x3b')](db['Dashboard'][_0x44dd('0x35')]);_0x2c3f13[_0x44dd('0x3a')]=_[_0x44dd('0x3b')](_0x2a544a[_0x44dd('0x3a')]);_0x2c3f13['filters']=_[_0x44dd('0x3d')](_0x2c3f13[_0x44dd('0x39')],_0x2c3f13[_0x44dd('0x3a')]);_0x75d59d['attributes']=_[_0x44dd('0x3d')](_0x2c3f13[_0x44dd('0x39')],qs[_0x44dd('0x3f')](_0x2a544a[_0x44dd('0x3a')][_0x44dd('0x3f')]));_0x75d59d[_0x44dd('0x3e')]=_0x75d59d[_0x44dd('0x3e')]['length']?_0x75d59d[_0x44dd('0x3e')]:_0x2c3f13[_0x44dd('0x39')];if(_0x2a544a[_0x44dd('0x3a')][_0x44dd('0x4b')]){_0x75d59d[_0x44dd('0x51')]=[{'all':!![]}];}_0x75d59d=_['merge']({},_0x75d59d,_0x2a544a['options']);return db[_0x44dd('0x4a')][_0x44dd('0x52')](_0x75d59d)[_0x44dd('0x2a')](handleEntityNotFound(_0x336ee1,null))[_0x44dd('0x2a')](respondWithResult(_0x336ee1,null))[_0x44dd('0x4e')](handleError(_0x336ee1,null));};exports[_0x44dd('0x53')]=function(_0x78b313,_0x2a935d){return db['Dashboard'][_0x44dd('0x53')](_0x78b313[_0x44dd('0x54')],{})[_0x44dd('0x2a')](function(_0x99e6be){var _0x21e3d5=_0x78b313[_0x44dd('0x55')][_0x44dd('0x2b')]({'plain':!![]});if(!_0x21e3d5)throw new Error(_0x44dd('0x56'));if(_0x21e3d5[_0x44dd('0x57')]===_0x44dd('0x55')){var _0xf659b5=_0x99e6be[_0x44dd('0x2b')]({'plain':!![]});var _0x3211be=_0x44dd('0x2c');return db['UserProfileSection'][_0x44dd('0x52')]({'where':{'name':_0x3211be,'userProfileId':_0x21e3d5[_0x44dd('0x58')]},'raw':!![]})['then'](function(_0x3600a2){if(_0x3600a2&&_0x3600a2['autoAssociation']===0x0){return db[_0x44dd('0x2d')]['create']({'name':_0xf659b5[_0x44dd('0x31')],'resourceId':_0xf659b5['id'],'type':_0x3600a2[_0x44dd('0x31')],'sectionId':_0x3600a2['id']},{})[_0x44dd('0x2a')](function(){return _0x99e6be;});}else{return _0x99e6be;}})[_0x44dd('0x4e')](function(_0x39546a){logger[_0x44dd('0x2f')](_0x44dd('0x59'),_0x39546a);throw _0x39546a;});}return _0x99e6be;})[_0x44dd('0x2a')](respondWithResult(_0x2a935d,0xc9))[_0x44dd('0x4e')](handleError(_0x2a935d,null));};exports[_0x44dd('0x5a')]=function(_0x120897,_0x5986fa){var _0x2deb7f={'where':{'id':_0x120897['params']['id']}},_0x175427={};_0x175427[_0x44dd('0x39')]=_[_0x44dd('0x3b')](db['Dashboard'][_0x44dd('0x35')]);_0x2deb7f[_0x44dd('0x3e')]=_['intersection'](_0x175427[_0x44dd('0x39')],qs[_0x44dd('0x3f')](_0x120897[_0x44dd('0x3a')]['fields']));_0x2deb7f[_0x44dd('0x3e')]=_0x2deb7f[_0x44dd('0x3e')][_0x44dd('0x40')]?_0x2deb7f['attributes']:_0x175427[_0x44dd('0x39')];if(_0x120897['query'][_0x44dd('0x4b')]){_0x2deb7f[_0x44dd('0x51')]=[{'all':!![]}];}_0x2deb7f=_[_0x44dd('0x47')]({},_0x2deb7f,_0x120897[_0x44dd('0x49')]);return db[_0x44dd('0x4a')][_0x44dd('0x52')](_0x2deb7f)[_0x44dd('0x2a')](handleEntityNotFound(_0x5986fa,null))[_0x44dd('0x2a')](function(_0x341832){if(_0x341832){var _0x384292=_0x341832[_0x44dd('0x2b')]({'plain':!![]});_0x384292=qs[_0x44dd('0x5b')](_0x384292,['id',_0x44dd('0x5c'),_0x44dd('0x5d')]);_0x120897[_0x44dd('0x54')]=_[_0x44dd('0x5b')](_0x120897[_0x44dd('0x54')],['id',_0x44dd('0x5c'),_0x44dd('0x5d')]);return db[_0x44dd('0x4a')][_0x44dd('0x53')](_[_0x44dd('0x47')](_0x384292,_0x120897['body']),{'include':_0x120897['query'][_0x44dd('0x4b')]?[{'all':!![]}]:undefined})[_0x44dd('0x2a')](function(_0x2f79ed){var _0x28ebbf=_0x120897[_0x44dd('0x55')][_0x44dd('0x2b')]({'plain':!![]});if(!_0x28ebbf)throw new Error(_0x44dd('0x56'));if(_0x28ebbf['role']===_0x44dd('0x55')){var _0x116c89=_0x2f79ed[_0x44dd('0x2b')]({'plain':!![]});var _0x534edf=_0x44dd('0x2c');return db['UserProfileSection'][_0x44dd('0x52')]({'where':{'name':_0x534edf,'userProfileId':_0x28ebbf[_0x44dd('0x58')]},'raw':!![]})[_0x44dd('0x2a')](function(_0x5fe34e){if(_0x5fe34e&&_0x5fe34e[_0x44dd('0x5e')]===0x0){return db[_0x44dd('0x2d')][_0x44dd('0x53')]({'name':_0x116c89['name'],'resourceId':_0x116c89['id'],'type':_0x5fe34e[_0x44dd('0x31')],'sectionId':_0x5fe34e['id']},{})['then'](function(){return _0x2f79ed;});}else{return _0x2f79ed;}})[_0x44dd('0x4e')](function(_0x2df1db){logger[_0x44dd('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2df1db);throw _0x2df1db;});}return _0x2f79ed;});}})[_0x44dd('0x2a')](respondWithResult(_0x5986fa,0xc9))[_0x44dd('0x4e')](handleError(_0x5986fa,null));};exports[_0x44dd('0x29')]=function(_0x234cd5,_0x5f1fc8){if(_0x234cd5[_0x44dd('0x54')]['id']){delete _0x234cd5[_0x44dd('0x54')]['id'];}return db['Dashboard'][_0x44dd('0x52')]({'where':{'id':_0x234cd5['params']['id']}})['then'](handleEntityNotFound(_0x5f1fc8,null))[_0x44dd('0x2a')](saveUpdates(_0x234cd5[_0x44dd('0x54')],null))[_0x44dd('0x2a')](respondWithResult(_0x5f1fc8,null))['catch'](handleError(_0x5f1fc8,null));};exports[_0x44dd('0x2e')]=function(_0x442d02,_0x2f112c){return db[_0x44dd('0x4a')][_0x44dd('0x52')]({'where':{'id':_0x442d02[_0x44dd('0x50')]['id']}})[_0x44dd('0x2a')](handleEntityNotFound(_0x2f112c,null))[_0x44dd('0x2a')](removeEntity(_0x2f112c,null))['catch'](handleError(_0x2f112c,null));};function widgetAttributes(_0x199ead){try{switch(_0x199ead[_0x44dd('0x37')]){case _0x44dd('0x5f'):return[{'name':_0x44dd('0x60'),'value':_0x199ead[_0x44dd('0x60')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x0]?_0x199ead[_0x44dd('0x61')][0x0][_0x44dd('0x62')]:undefined)||_0x44dd('0x63')}];case _0x44dd('0x64'):return[{'name':_0x44dd('0x65'),'value':_0x199ead['attrPath']||(_0x199ead[_0x44dd('0x61')]&&_0x199ead['attrs'][0x0]?_0x199ead['attrs'][0x0][_0x44dd('0x62')]:undefined)||''}];case _0x44dd('0x66'):return[{'name':'attrHourFormat','value':_0x199ead[_0x44dd('0x67')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x0]?_0x199ead[_0x44dd('0x61')][0x0][_0x44dd('0x62')]:undefined)||'HH:mm:ss'},{'name':_0x44dd('0x68'),'value':_0x199ead[_0x44dd('0x68')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x1]?_0x199ead[_0x44dd('0x61')][0x1][_0x44dd('0x62')]:undefined)||_0x44dd('0x69')},{'name':'attrFontSize','value':_0x199ead['attrFontSize']||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x2]?_0x199ead[_0x44dd('0x61')][0x2]['value']:undefined)||0xc}];case _0x44dd('0x6a'):return[{'name':_0x44dd('0x6b'),'value':_0x199ead[_0x44dd('0x6b')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead['attrs'][0x0]?_0x199ead[_0x44dd('0x61')][0x0][_0x44dd('0x62')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x199ead[_0x44dd('0x6c')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x1]?_0x199ead[_0x44dd('0x61')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x199ead[_0x44dd('0x6d')]||(_0x199ead['attrs']&&_0x199ead[_0x44dd('0x61')][0x2]?_0x199ead[_0x44dd('0x61')][0x2]['value']:undefined)||0x14},{'name':_0x44dd('0x6e'),'value':_0x199ead[_0x44dd('0x6e')]||(_0x199ead['attrs']&&_0x199ead[_0x44dd('0x61')][0x3]?_0x199ead[_0x44dd('0x61')][0x3][_0x44dd('0x62')]:undefined)||_0x44dd('0x6f')},{'name':'attrEmailAccounts','value':_0x199ead[_0x44dd('0x70')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead['attrs'][0x4]?_0x199ead[_0x44dd('0x61')][0x4][_0x44dd('0x62')]:undefined)||''},{'name':_0x44dd('0x71'),'value':_0x199ead[_0x44dd('0x71')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x5]?_0x199ead[_0x44dd('0x61')][0x5]['value']:undefined)||''},{'name':_0x44dd('0x72'),'value':_0x199ead['attrSmsAccounts']||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x6]?_0x199ead[_0x44dd('0x61')][0x6][_0x44dd('0x62')]:undefined)||''},{'name':_0x44dd('0x73'),'value':_0x199ead[_0x44dd('0x73')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x7]?_0x199ead[_0x44dd('0x61')][0x7][_0x44dd('0x62')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x199ead[_0x44dd('0x74')]||(_0x199ead['attrs']&&_0x199ead['attrs'][0x8]?_0x199ead[_0x44dd('0x61')][0x8][_0x44dd('0x62')]:undefined)||''},{'name':_0x44dd('0x75'),'value':_0x199ead[_0x44dd('0x75')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x9]?_0x199ead['attrs'][0x9][_0x44dd('0x62')]:undefined)||''}];case _0x44dd('0x76'):case _0x44dd('0x77'):return[{'name':_0x44dd('0x78'),'value':_0x199ead[_0x44dd('0x78')]||(_0x199ead['attrs']&&_0x199ead['attrs'][0x0]?_0x199ead[_0x44dd('0x61')][0x0][_0x44dd('0x62')]:undefined)||_0x44dd('0x79')},{'name':'attrSerie2','value':_0x199ead[_0x44dd('0x7a')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x1]?_0x199ead[_0x44dd('0x61')][0x1]['value']:undefined)||null},{'name':_0x44dd('0x7b'),'value':_0x199ead[_0x44dd('0x7b')]||(_0x199ead['attrs']&&_0x199ead[_0x44dd('0x61')][0x2]?_0x199ead[_0x44dd('0x61')][0x2][_0x44dd('0x62')]:undefined)||null},{'name':_0x44dd('0x6c'),'value':_0x199ead['attrVoiceQueues']||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x3]?_0x199ead[_0x44dd('0x61')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x199ead[_0x44dd('0x6e')]||(_0x199ead['attrs']&&_0x199ead[_0x44dd('0x61')][0x4]?_0x199ead['attrs'][0x4]['value']:undefined)||_0x44dd('0x6f')},{'name':_0x44dd('0x70'),'value':_0x199ead[_0x44dd('0x70')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x5]?_0x199ead[_0x44dd('0x61')][0x5][_0x44dd('0x62')]:undefined)||''},{'name':_0x44dd('0x71'),'value':_0x199ead[_0x44dd('0x71')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x6]?_0x199ead[_0x44dd('0x61')][0x6]['value']:undefined)||''},{'name':_0x44dd('0x72'),'value':_0x199ead['attrSmsAccounts']||(_0x199ead['attrs']&&_0x199ead[_0x44dd('0x61')][0x7]?_0x199ead[_0x44dd('0x61')][0x7][_0x44dd('0x62')]:undefined)||''},{'name':_0x44dd('0x73'),'value':_0x199ead['attrOpenchannelAccounts']||(_0x199ead[_0x44dd('0x61')]&&_0x199ead[_0x44dd('0x61')][0x8]?_0x199ead[_0x44dd('0x61')][0x8][_0x44dd('0x62')]:undefined)||''},{'name':_0x44dd('0x74'),'value':_0x199ead[_0x44dd('0x74')]||(_0x199ead['attrs']&&_0x199ead[_0x44dd('0x61')][0x9]?_0x199ead[_0x44dd('0x61')][0x9][_0x44dd('0x62')]:undefined)||''},{'name':_0x44dd('0x75'),'value':_0x199ead[_0x44dd('0x75')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead['attrs'][0xa]?_0x199ead[_0x44dd('0x61')][0xa][_0x44dd('0x62')]:undefined)||''}];case _0x44dd('0x7c'):return[{'name':_0x44dd('0x7d'),'type':_0x199ead[_0x44dd('0x7e')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead['attrs'][0x0]?_0x199ead[_0x44dd('0x61')][0x0][_0x44dd('0x37')]:undefined)||null,'value':_0x199ead['attrReport']||(_0x199ead[_0x44dd('0x61')]&&_0x199ead['attrs'][0x0]?_0x199ead[_0x44dd('0x61')][0x0][_0x44dd('0x62')]:undefined)||null},{'name':_0x44dd('0x7f'),'value':_0x199ead[_0x44dd('0x7f')]||(_0x199ead[_0x44dd('0x61')]&&_0x199ead['attrs'][0x1]?_0x199ead[_0x44dd('0x61')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1f8021){logger[_0x44dd('0x2f')](_0x44dd('0x80'),JSON[_0x44dd('0x81')](_0x1f8021));return[];}}exports[_0x44dd('0x82')]=function(_0x198c1f,_0x57d177,_0x44973f){if(_0x198c1f[_0x44dd('0x54')]['id']){delete _0x198c1f[_0x44dd('0x54')]['id'];}return db['Dashboard'][_0x44dd('0x52')]({'where':{'id':_0x198c1f['params']['id']}})[_0x44dd('0x2a')](handleEntityNotFound(_0x57d177,null))[_0x44dd('0x2a')](function(_0x3a2e58){if(_0x3a2e58){_0x198c1f[_0x44dd('0x54')][_0x44dd('0x83')]=_0x3a2e58['id'];_0x198c1f[_0x44dd('0x54')][_0x44dd('0x61')]=widgetAttributes(_0x198c1f['body']);return db[_0x44dd('0x84')][_0x44dd('0x53')](_0x198c1f[_0x44dd('0x54')]);}})[_0x44dd('0x2a')](respondWithResult(_0x57d177,null))[_0x44dd('0x4e')](handleError(_0x57d177,null));};exports[_0x44dd('0x85')]=function(_0x576b9f,_0x2215ca,_0x2bcb49){var _0x50211e={};var _0x399b7b={};var _0xb0476;var _0x308c18;return db[_0x44dd('0x4a')]['findOne']({'where':{'id':_0x576b9f['params']['id']}})[_0x44dd('0x2a')](handleEntityNotFound(_0x2215ca,null))['then'](function(_0x4b6312){if(_0x4b6312){_0xb0476=_0x4b6312;_0x399b7b[_0x44dd('0x39')]=_[_0x44dd('0x3b')](db[_0x44dd('0x84')]['rawAttributes']);_0x399b7b[_0x44dd('0x3a')]=_[_0x44dd('0x3b')](_0x576b9f[_0x44dd('0x3a')]);_0x399b7b[_0x44dd('0x3c')]=_[_0x44dd('0x3d')](_0x399b7b[_0x44dd('0x39')],_0x399b7b[_0x44dd('0x3a')]);_0x50211e[_0x44dd('0x3e')]=_['intersection'](_0x399b7b[_0x44dd('0x39')],qs['fields'](_0x576b9f['query'][_0x44dd('0x3f')]));_0x50211e['attributes']=_0x50211e['attributes'][_0x44dd('0x40')]?_0x50211e['attributes']:_0x399b7b[_0x44dd('0x39')];_0x50211e[_0x44dd('0x43')]=qs['sort'](_0x576b9f['query']['sort']);_0x50211e[_0x44dd('0x45')]=qs[_0x44dd('0x3c')](_[_0x44dd('0x86')](_0x576b9f['query'],_0x399b7b[_0x44dd('0x3c')]));if(_0x576b9f[_0x44dd('0x3a')][_0x44dd('0x46')]){_0x50211e[_0x44dd('0x45')]=_[_0x44dd('0x47')](_0x50211e[_0x44dd('0x45')],{'$or':_[_0x44dd('0x34')](_0x50211e[_0x44dd('0x3e')],function(_0x34158c){var _0x61e92b={};_0x61e92b[_0x34158c]={'$like':'%'+_0x576b9f[_0x44dd('0x3a')][_0x44dd('0x46')]+'%'};return _0x61e92b;})});}_0x50211e=_[_0x44dd('0x47')]({},_0x50211e,_0x576b9f['options']);return _0xb0476[_0x44dd('0x85')](_0x50211e);}})[_0x44dd('0x2a')](function(_0x1222b9){if(_0x1222b9){_0x308c18=_0x1222b9[_0x44dd('0x40')];if(!_0x576b9f['query']['hasOwnProperty'](_0x44dd('0x42'))){_0x50211e[_0x44dd('0x21')]=qs['limit'](_0x576b9f[_0x44dd('0x3a')]['limit']);_0x50211e['offset']=qs[_0x44dd('0x23')](_0x576b9f[_0x44dd('0x3a')][_0x44dd('0x23')]);}return _0xb0476[_0x44dd('0x85')](_0x50211e);}})[_0x44dd('0x2a')](function(_0x923a44){if(_0x923a44){return _0x923a44?{'count':_0x308c18,'rows':_0x923a44}:null;}})[_0x44dd('0x2a')](respondWithResult(_0x2215ca,null))[_0x44dd('0x4e')](handleError(_0x2215ca,null));}; \ No newline at end of file +var _0xc4c9=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','omit','createdAt','body','updatedAt','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','findOne','getItems','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','map','Dashboard','rawAttributes','fieldName','type','model','query'];(function(_0x33f9c6,_0x24cc4f){var _0x1edc0d=function(_0x49dfb8){while(--_0x49dfb8){_0x33f9c6['push'](_0x33f9c6['shift']());}};_0x1edc0d(++_0x24cc4f);}(_0xc4c9,0xce));var _0x9c4c=function(_0x5d2f4f,_0x1a081f){_0x5d2f4f=_0x5d2f4f-0x0;var _0x400656=_0xc4c9[_0x5d2f4f];return _0x400656;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c4c('0x0'));var zipdir=require(_0x9c4c('0x1'));var jsonpatch=require(_0x9c4c('0x2'));var rp=require(_0x9c4c('0x3'));var moment=require('moment');var BPromise=require(_0x9c4c('0x4'));var Mustache=require(_0x9c4c('0x5'));var util=require('util');var path=require(_0x9c4c('0x6'));var sox=require(_0x9c4c('0x7'));var csv=require(_0x9c4c('0x8'));var ejs=require(_0x9c4c('0x9'));var fs=require('fs');var fs_extra=require(_0x9c4c('0xa'));var _=require('lodash');var squel=require(_0x9c4c('0xb'));var crypto=require(_0x9c4c('0xc'));var jsforce=require(_0x9c4c('0xd'));var deskjs=require(_0x9c4c('0xe'));var toCsv=require(_0x9c4c('0x8'));var querystring=require(_0x9c4c('0xf'));var Papa=require(_0x9c4c('0x10'));var Redis=require(_0x9c4c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9c4c('0x12'));var as=require(_0x9c4c('0x13'));var hardwareService=require(_0x9c4c('0x14'));var logger=require('../../config/logger')(_0x9c4c('0x15'));var utils=require(_0x9c4c('0x16'));var config=require(_0x9c4c('0x17'));var licenseUtil=require(_0x9c4c('0x18'));var db=require(_0x9c4c('0x19'))['db'];config[_0x9c4c('0x1a')]=_[_0x9c4c('0x1b')](config['redis'],{'host':_0x9c4c('0x1c'),'port':0x18eb});var socket=require(_0x9c4c('0x1d'))(new Redis(config[_0x9c4c('0x1a')]));require(_0x9c4c('0x1e'))[_0x9c4c('0x1f')](socket);function respondWithStatusCode(_0x5c0f66,_0x461f6d){_0x461f6d=_0x461f6d||0xcc;return function(_0x2309c8){if(_0x2309c8){return _0x5c0f66['sendStatus'](_0x461f6d);}return _0x5c0f66[_0x9c4c('0x20')](_0x461f6d)[_0x9c4c('0x21')]();};}function respondWithResult(_0x349ff0,_0x36145e){_0x36145e=_0x36145e||0xc8;return function(_0x2ccc38){if(_0x2ccc38){return _0x349ff0[_0x9c4c('0x20')](_0x36145e)[_0x9c4c('0x22')](_0x2ccc38);}};}function respondWithFilteredResult(_0x32986c,_0x31114b){return function(_0x2d2fe5){if(_0x2d2fe5){var _0x66403c=typeof _0x31114b[_0x9c4c('0x23')]===_0x9c4c('0x24')&&typeof _0x31114b[_0x9c4c('0x25')]==='undefined';var _0x49d643=_0x2d2fe5[_0x9c4c('0x26')];var _0x307196=_0x66403c?0x0:_0x31114b['offset'];var _0x20aee2=_0x66403c?_0x2d2fe5[_0x9c4c('0x26')]:_0x31114b[_0x9c4c('0x23')]+_0x31114b[_0x9c4c('0x25')];var _0x21dcff;if(_0x20aee2>=_0x49d643){_0x20aee2=_0x49d643;_0x21dcff=0xc8;}else{_0x21dcff=0xce;}_0x32986c[_0x9c4c('0x20')](_0x21dcff);return _0x32986c[_0x9c4c('0x27')]('Content-Range',_0x307196+'-'+_0x20aee2+'/'+_0x49d643)['json'](_0x2d2fe5);}return null;};}function patchUpdates(_0x3a3bc1){return function(_0x2627e8){try{jsonpatch[_0x9c4c('0x28')](_0x2627e8,_0x3a3bc1,!![]);}catch(_0x319eac){return BPromise['reject'](_0x319eac);}return _0x2627e8[_0x9c4c('0x29')]();};}function saveUpdates(_0x39980c,_0x4246d8){return function(_0x56d424){if(_0x56d424){return _0x56d424[_0x9c4c('0x2a')](_0x39980c)[_0x9c4c('0x2b')](function(_0x3c93c0){return _0x3c93c0;});}return null;};}function removeEntity(_0xe81e83,_0x3f2ad3){return function(_0xca11f){if(_0xca11f){return _0xca11f[_0x9c4c('0x2c')]()[_0x9c4c('0x2b')](function(){var _0x49f1ba=_0xca11f[_0x9c4c('0x2d')]({'plain':!![]});var _0x5cdc6b=_0x9c4c('0x2e');return db[_0x9c4c('0x2f')]['destroy']({'where':{'type':_0x5cdc6b,'resourceId':_0x49f1ba['id']}})[_0x9c4c('0x2b')](function(){return _0xca11f;});})['then'](function(){_0xe81e83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cac0b,_0x20b421){return function(_0x30418f){if(!_0x30418f){_0x1cac0b[_0x9c4c('0x30')](0x194);}return _0x30418f;};}function handleError(_0x112449,_0x3411bd){_0x3411bd=_0x3411bd||0x1f4;return function(_0x2c00db){logger[_0x9c4c('0x31')](_0x2c00db[_0x9c4c('0x32')]);if(_0x2c00db['name']){delete _0x2c00db[_0x9c4c('0x33')];}_0x112449[_0x9c4c('0x20')](_0x3411bd)[_0x9c4c('0x34')](_0x2c00db);};}exports['index']=function(_0x39649e,_0x5ee92b){var _0x454328={},_0x3aaf44={},_0x173f05={'count':0x0,'rows':[]};var _0x29082f=_[_0x9c4c('0x35')](db[_0x9c4c('0x36')][_0x9c4c('0x37')],function(_0x3414d2){return{'name':_0x3414d2[_0x9c4c('0x38')],'type':_0x3414d2[_0x9c4c('0x39')]['key']};});_0x3aaf44[_0x9c4c('0x3a')]=_[_0x9c4c('0x35')](_0x29082f,_0x9c4c('0x33'));_0x3aaf44[_0x9c4c('0x3b')]=_['keys'](_0x39649e['query']);_0x3aaf44[_0x9c4c('0x3c')]=_[_0x9c4c('0x3d')](_0x3aaf44['model'],_0x3aaf44[_0x9c4c('0x3b')]);_0x454328[_0x9c4c('0x3e')]=_[_0x9c4c('0x3d')](_0x3aaf44[_0x9c4c('0x3a')],qs['fields'](_0x39649e[_0x9c4c('0x3b')][_0x9c4c('0x3f')]));_0x454328[_0x9c4c('0x3e')]=_0x454328['attributes']['length']?_0x454328[_0x9c4c('0x3e')]:_0x3aaf44['model'];if(!_0x39649e[_0x9c4c('0x3b')][_0x9c4c('0x40')](_0x9c4c('0x41'))){_0x454328[_0x9c4c('0x25')]=qs['limit'](_0x39649e[_0x9c4c('0x3b')][_0x9c4c('0x25')]);_0x454328['offset']=qs[_0x9c4c('0x23')](_0x39649e['query'][_0x9c4c('0x23')]);}_0x454328[_0x9c4c('0x42')]=qs[_0x9c4c('0x43')](_0x39649e[_0x9c4c('0x3b')][_0x9c4c('0x43')]);_0x454328[_0x9c4c('0x44')]=qs[_0x9c4c('0x3c')](_[_0x9c4c('0x45')](_0x39649e[_0x9c4c('0x3b')],_0x3aaf44[_0x9c4c('0x3c')]),_0x29082f);if(_0x39649e[_0x9c4c('0x3b')]['filter']){_0x454328[_0x9c4c('0x44')]=_['merge'](_0x454328['where'],{'$or':_[_0x9c4c('0x35')](_0x29082f,function(_0xcd8522){if(_0xcd8522[_0x9c4c('0x39')]!==_0x9c4c('0x46')){var _0x24e621={};_0x24e621[_0xcd8522['name']]={'$like':'%'+_0x39649e['query'][_0x9c4c('0x47')]+'%'};return _0x24e621;}})});}_0x454328=_[_0x9c4c('0x48')]({},_0x454328,_0x39649e['options']);var _0x3a76d6={'where':_0x454328[_0x9c4c('0x44')]};return db[_0x9c4c('0x36')][_0x9c4c('0x26')](_0x3a76d6)['then'](function(_0x33ace4){_0x173f05[_0x9c4c('0x26')]=_0x33ace4;if(_0x39649e[_0x9c4c('0x3b')][_0x9c4c('0x49')]){_0x454328[_0x9c4c('0x4a')]=[{'all':!![]}];}return db[_0x9c4c('0x36')][_0x9c4c('0x4b')](_0x454328);})[_0x9c4c('0x2b')](function(_0x2125fa){_0x173f05[_0x9c4c('0x4c')]=_0x2125fa;return _0x173f05;})[_0x9c4c('0x2b')](respondWithFilteredResult(_0x5ee92b,_0x454328))[_0x9c4c('0x4d')](handleError(_0x5ee92b,null));};exports[_0x9c4c('0x4e')]=function(_0x6f7a34,_0x24ffd5){var _0x47b1c8={'raw':![],'where':{'id':_0x6f7a34[_0x9c4c('0x4f')]['id']}},_0x290aa6={};_0x290aa6[_0x9c4c('0x3a')]=_[_0x9c4c('0x50')](db[_0x9c4c('0x36')][_0x9c4c('0x37')]);_0x290aa6['query']=_[_0x9c4c('0x50')](_0x6f7a34[_0x9c4c('0x3b')]);_0x290aa6[_0x9c4c('0x3c')]=_[_0x9c4c('0x3d')](_0x290aa6[_0x9c4c('0x3a')],_0x290aa6['query']);_0x47b1c8[_0x9c4c('0x3e')]=_[_0x9c4c('0x3d')](_0x290aa6['model'],qs[_0x9c4c('0x3f')](_0x6f7a34[_0x9c4c('0x3b')][_0x9c4c('0x3f')]));_0x47b1c8['attributes']=_0x47b1c8[_0x9c4c('0x3e')][_0x9c4c('0x51')]?_0x47b1c8['attributes']:_0x290aa6[_0x9c4c('0x3a')];if(_0x6f7a34[_0x9c4c('0x3b')][_0x9c4c('0x49')]){_0x47b1c8[_0x9c4c('0x4a')]=[{'all':!![]}];}_0x47b1c8=_[_0x9c4c('0x48')]({},_0x47b1c8,_0x6f7a34[_0x9c4c('0x52')]);return db['Dashboard'][_0x9c4c('0x53')](_0x47b1c8)[_0x9c4c('0x2b')](handleEntityNotFound(_0x24ffd5,null))[_0x9c4c('0x2b')](respondWithResult(_0x24ffd5,null))['catch'](handleError(_0x24ffd5,null));};exports['create']=function(_0x2044f9,_0xa45ecc){return db[_0x9c4c('0x36')]['create'](_0x2044f9['body'],{})['then'](function(_0x2c6425){var _0x21ee75=_0x2044f9[_0x9c4c('0x54')]['get']({'plain':!![]});if(!_0x21ee75)throw new Error(_0x9c4c('0x55'));if(_0x21ee75[_0x9c4c('0x56')]===_0x9c4c('0x54')){var _0x4401b6=_0x2c6425['get']({'plain':!![]});var _0x4bb802='CustomDashboards';return db[_0x9c4c('0x57')][_0x9c4c('0x53')]({'where':{'name':_0x4bb802,'userProfileId':_0x21ee75[_0x9c4c('0x58')]},'raw':!![]})[_0x9c4c('0x2b')](function(_0x35e960){if(_0x35e960&&_0x35e960[_0x9c4c('0x59')]===0x0){return db[_0x9c4c('0x2f')][_0x9c4c('0x5a')]({'name':_0x4401b6['name'],'resourceId':_0x4401b6['id'],'type':_0x35e960[_0x9c4c('0x33')],'sectionId':_0x35e960['id']},{})[_0x9c4c('0x2b')](function(){return _0x2c6425;});}else{return _0x2c6425;}})['catch'](function(_0x4f3355){logger[_0x9c4c('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f3355);throw _0x4f3355;});}return _0x2c6425;})[_0x9c4c('0x2b')](respondWithResult(_0xa45ecc,0xc9))[_0x9c4c('0x4d')](handleError(_0xa45ecc,null));};exports['clone']=function(_0x360289,_0x3b8332){var _0x52498d={'where':{'id':_0x360289[_0x9c4c('0x4f')]['id']}},_0x48138b={};_0x48138b['model']=_[_0x9c4c('0x50')](db[_0x9c4c('0x36')][_0x9c4c('0x37')]);_0x52498d['attributes']=_[_0x9c4c('0x3d')](_0x48138b[_0x9c4c('0x3a')],qs['fields'](_0x360289[_0x9c4c('0x3b')][_0x9c4c('0x3f')]));_0x52498d[_0x9c4c('0x3e')]=_0x52498d[_0x9c4c('0x3e')][_0x9c4c('0x51')]?_0x52498d[_0x9c4c('0x3e')]:_0x48138b[_0x9c4c('0x3a')];if(_0x360289[_0x9c4c('0x3b')][_0x9c4c('0x49')]){_0x52498d[_0x9c4c('0x4a')]=[{'all':!![]}];}_0x52498d=_[_0x9c4c('0x48')]({},_0x52498d,_0x360289[_0x9c4c('0x52')]);return db[_0x9c4c('0x36')][_0x9c4c('0x53')](_0x52498d)['then'](handleEntityNotFound(_0x3b8332,null))['then'](function(_0x35a179){if(_0x35a179){var _0x41b7e2=_0x35a179['get']({'plain':!![]});_0x41b7e2=qs[_0x9c4c('0x5b')](_0x41b7e2,['id',_0x9c4c('0x5c'),'updatedAt']);_0x360289[_0x9c4c('0x5d')]=_[_0x9c4c('0x5b')](_0x360289[_0x9c4c('0x5d')],['id',_0x9c4c('0x5c'),_0x9c4c('0x5e')]);return db[_0x9c4c('0x36')][_0x9c4c('0x5a')](_[_0x9c4c('0x48')](_0x41b7e2,_0x360289['body']),{'include':_0x360289[_0x9c4c('0x3b')][_0x9c4c('0x49')]?[{'all':!![]}]:undefined})[_0x9c4c('0x2b')](function(_0x20e144){var _0x181539=_0x360289[_0x9c4c('0x54')][_0x9c4c('0x2d')]({'plain':!![]});if(!_0x181539)throw new Error(_0x9c4c('0x55'));if(_0x181539[_0x9c4c('0x56')]===_0x9c4c('0x54')){var _0x4bdeff=_0x20e144['get']({'plain':!![]});var _0x381550='CustomDashboards';return db[_0x9c4c('0x57')]['find']({'where':{'name':_0x381550,'userProfileId':_0x181539[_0x9c4c('0x58')]},'raw':!![]})['then'](function(_0x20197e){if(_0x20197e&&_0x20197e[_0x9c4c('0x59')]===0x0){return db['UserProfileResource'][_0x9c4c('0x5a')]({'name':_0x4bdeff[_0x9c4c('0x33')],'resourceId':_0x4bdeff['id'],'type':_0x20197e[_0x9c4c('0x33')],'sectionId':_0x20197e['id']},{})[_0x9c4c('0x2b')](function(){return _0x20e144;});}else{return _0x20e144;}})['catch'](function(_0x4a1ce){logger[_0x9c4c('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a1ce);throw _0x4a1ce;});}return _0x20e144;});}})['then'](respondWithResult(_0x3b8332,0xc9))[_0x9c4c('0x4d')](handleError(_0x3b8332,null));};exports[_0x9c4c('0x2a')]=function(_0x2968e8,_0x5c5c16){if(_0x2968e8[_0x9c4c('0x5d')]['id']){delete _0x2968e8['body']['id'];}return db[_0x9c4c('0x36')]['find']({'where':{'id':_0x2968e8[_0x9c4c('0x4f')]['id']}})[_0x9c4c('0x2b')](handleEntityNotFound(_0x5c5c16,null))[_0x9c4c('0x2b')](saveUpdates(_0x2968e8['body'],null))['then'](respondWithResult(_0x5c5c16,null))[_0x9c4c('0x4d')](handleError(_0x5c5c16,null));};exports[_0x9c4c('0x2c')]=function(_0x595c99,_0x25bf9b){return db[_0x9c4c('0x36')][_0x9c4c('0x53')]({'where':{'id':_0x595c99['params']['id']}})[_0x9c4c('0x2b')](handleEntityNotFound(_0x25bf9b,null))[_0x9c4c('0x2b')](removeEntity(_0x25bf9b,null))[_0x9c4c('0x4d')](handleError(_0x25bf9b,null));};function widgetAttributes(_0xc3f59c){try{switch(_0xc3f59c[_0x9c4c('0x39')]){case'iframe':return[{'name':_0x9c4c('0x5f'),'value':_0xc3f59c[_0x9c4c('0x5f')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x0]?_0xc3f59c['attrs'][0x0]['value']:undefined)||_0x9c4c('0x61')}];case _0x9c4c('0x62'):return[{'name':_0x9c4c('0x63'),'value':_0xc3f59c[_0x9c4c('0x63')]||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x0]?_0xc3f59c[_0x9c4c('0x60')][0x0]['value']:undefined)||''}];case _0x9c4c('0x64'):return[{'name':'attrHourFormat','value':_0xc3f59c[_0x9c4c('0x65')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x0]?_0xc3f59c[_0x9c4c('0x60')][0x0][_0x9c4c('0x66')]:undefined)||_0x9c4c('0x67')},{'name':_0x9c4c('0x68'),'value':_0xc3f59c[_0x9c4c('0x68')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c['attrs'][0x1]?_0xc3f59c[_0x9c4c('0x60')][0x1][_0x9c4c('0x66')]:undefined)||_0x9c4c('0x69')},{'name':_0x9c4c('0x6a'),'value':_0xc3f59c['attrFontSize']||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x2]?_0xc3f59c[_0x9c4c('0x60')][0x2][_0x9c4c('0x66')]:undefined)||0xc}];case _0x9c4c('0x6b'):return[{'name':_0x9c4c('0x6c'),'value':_0xc3f59c[_0x9c4c('0x6c')]||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x0]?_0xc3f59c['attrs'][0x0][_0x9c4c('0x66')]:undefined)||_0x9c4c('0x6d')},{'name':_0x9c4c('0x6e'),'value':_0xc3f59c[_0x9c4c('0x6e')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x1]?_0xc3f59c[_0x9c4c('0x60')][0x1]['value']:undefined)||[]},{'name':_0x9c4c('0x6a'),'value':_0xc3f59c[_0x9c4c('0x6a')]||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x2]?_0xc3f59c['attrs'][0x2][_0x9c4c('0x66')]:undefined)||0x14},{'name':_0x9c4c('0x6f'),'value':_0xc3f59c['attrChannel']||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x3]?_0xc3f59c[_0x9c4c('0x60')][0x3]['value']:undefined)||'voice'},{'name':_0x9c4c('0x70'),'value':_0xc3f59c[_0x9c4c('0x70')]||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x4]?_0xc3f59c['attrs'][0x4][_0x9c4c('0x66')]:undefined)||''},{'name':_0x9c4c('0x71'),'value':_0xc3f59c[_0x9c4c('0x71')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x5]?_0xc3f59c[_0x9c4c('0x60')][0x5][_0x9c4c('0x66')]:undefined)||''},{'name':_0x9c4c('0x72'),'value':_0xc3f59c[_0x9c4c('0x72')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x6]?_0xc3f59c[_0x9c4c('0x60')][0x6][_0x9c4c('0x66')]:undefined)||''},{'name':_0x9c4c('0x73'),'value':_0xc3f59c[_0x9c4c('0x73')]||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x7]?_0xc3f59c[_0x9c4c('0x60')][0x7][_0x9c4c('0x66')]:undefined)||''},{'name':_0x9c4c('0x74'),'value':_0xc3f59c[_0x9c4c('0x74')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c['attrs'][0x8]?_0xc3f59c[_0x9c4c('0x60')][0x8][_0x9c4c('0x66')]:undefined)||''},{'name':'attrChatWebsites','value':_0xc3f59c['attrChatWebsites']||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x9]?_0xc3f59c['attrs'][0x9][_0x9c4c('0x66')]:undefined)||''}];case _0x9c4c('0x75'):case _0x9c4c('0x76'):return[{'name':_0x9c4c('0x77'),'value':_0xc3f59c[_0x9c4c('0x77')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x0]?_0xc3f59c[_0x9c4c('0x60')][0x0][_0x9c4c('0x66')]:undefined)||_0x9c4c('0x6d')},{'name':_0x9c4c('0x78'),'value':_0xc3f59c['attrSerie2']||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x1]?_0xc3f59c[_0x9c4c('0x60')][0x1][_0x9c4c('0x66')]:undefined)||null},{'name':_0x9c4c('0x79'),'value':_0xc3f59c[_0x9c4c('0x79')]||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x2]?_0xc3f59c['attrs'][0x2][_0x9c4c('0x66')]:undefined)||null},{'name':_0x9c4c('0x6e'),'value':_0xc3f59c['attrVoiceQueues']||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x3]?_0xc3f59c['attrs'][0x3][_0x9c4c('0x66')]:undefined)||[]},{'name':_0x9c4c('0x6f'),'value':_0xc3f59c[_0x9c4c('0x6f')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x4]?_0xc3f59c[_0x9c4c('0x60')][0x4][_0x9c4c('0x66')]:undefined)||'voice'},{'name':_0x9c4c('0x70'),'value':_0xc3f59c[_0x9c4c('0x70')]||(_0xc3f59c['attrs']&&_0xc3f59c['attrs'][0x5]?_0xc3f59c['attrs'][0x5][_0x9c4c('0x66')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xc3f59c[_0x9c4c('0x71')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x6]?_0xc3f59c[_0x9c4c('0x60')][0x6][_0x9c4c('0x66')]:undefined)||''},{'name':_0x9c4c('0x72'),'value':_0xc3f59c[_0x9c4c('0x72')]||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x7]?_0xc3f59c[_0x9c4c('0x60')][0x7][_0x9c4c('0x66')]:undefined)||''},{'name':_0x9c4c('0x73'),'value':_0xc3f59c[_0x9c4c('0x73')]||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x8]?_0xc3f59c['attrs'][0x8]['value']:undefined)||''},{'name':_0x9c4c('0x74'),'value':_0xc3f59c[_0x9c4c('0x74')]||(_0xc3f59c['attrs']&&_0xc3f59c[_0x9c4c('0x60')][0x9]?_0xc3f59c['attrs'][0x9][_0x9c4c('0x66')]:undefined)||''},{'name':_0x9c4c('0x7a'),'value':_0xc3f59c[_0x9c4c('0x7a')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c['attrs'][0xa]?_0xc3f59c['attrs'][0xa]['value']:undefined)||''}];case _0x9c4c('0x7b'):return[{'name':_0x9c4c('0x7c'),'type':_0xc3f59c[_0x9c4c('0x7d')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c['attrs'][0x0]?_0xc3f59c[_0x9c4c('0x60')][0x0][_0x9c4c('0x39')]:undefined)||null,'value':_0xc3f59c[_0x9c4c('0x7c')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x0]?_0xc3f59c[_0x9c4c('0x60')][0x0][_0x9c4c('0x66')]:undefined)||null},{'name':_0x9c4c('0x7e'),'value':_0xc3f59c[_0x9c4c('0x7e')]||(_0xc3f59c[_0x9c4c('0x60')]&&_0xc3f59c[_0x9c4c('0x60')][0x1]?_0xc3f59c[_0x9c4c('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x447564){logger[_0x9c4c('0x31')](_0x9c4c('0x7f'),JSON['stringify'](_0x447564));return[];}}exports[_0x9c4c('0x80')]=function(_0x249b11,_0x3280a5,_0x28c049){if(_0x249b11[_0x9c4c('0x5d')]['id']){delete _0x249b11[_0x9c4c('0x5d')]['id'];}return db[_0x9c4c('0x36')][_0x9c4c('0x53')]({'where':{'id':_0x249b11[_0x9c4c('0x4f')]['id']}})[_0x9c4c('0x2b')](handleEntityNotFound(_0x3280a5,null))['then'](function(_0x2ff8e8){if(_0x2ff8e8){_0x249b11[_0x9c4c('0x5d')][_0x9c4c('0x81')]=_0x2ff8e8['id'];_0x249b11[_0x9c4c('0x5d')][_0x9c4c('0x60')]=widgetAttributes(_0x249b11[_0x9c4c('0x5d')]);return db[_0x9c4c('0x82')][_0x9c4c('0x5a')](_0x249b11[_0x9c4c('0x5d')]);}})[_0x9c4c('0x2b')](respondWithResult(_0x3280a5,null))[_0x9c4c('0x4d')](handleError(_0x3280a5,null));};exports['getItems']=function(_0x2c0324,_0x570f37,_0x2c42e4){var _0x339144={};var _0x1dda08={};var _0x5c09d9;var _0x121487;return db[_0x9c4c('0x36')][_0x9c4c('0x83')]({'where':{'id':_0x2c0324[_0x9c4c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x570f37,null))[_0x9c4c('0x2b')](function(_0x9d0b4c){if(_0x9d0b4c){_0x5c09d9=_0x9d0b4c;_0x1dda08[_0x9c4c('0x3a')]=_['keys'](db[_0x9c4c('0x82')]['rawAttributes']);_0x1dda08[_0x9c4c('0x3b')]=_['keys'](_0x2c0324[_0x9c4c('0x3b')]);_0x1dda08[_0x9c4c('0x3c')]=_[_0x9c4c('0x3d')](_0x1dda08[_0x9c4c('0x3a')],_0x1dda08[_0x9c4c('0x3b')]);_0x339144[_0x9c4c('0x3e')]=_[_0x9c4c('0x3d')](_0x1dda08[_0x9c4c('0x3a')],qs[_0x9c4c('0x3f')](_0x2c0324[_0x9c4c('0x3b')]['fields']));_0x339144['attributes']=_0x339144['attributes'][_0x9c4c('0x51')]?_0x339144[_0x9c4c('0x3e')]:_0x1dda08[_0x9c4c('0x3a')];_0x339144[_0x9c4c('0x42')]=qs[_0x9c4c('0x43')](_0x2c0324['query'][_0x9c4c('0x43')]);_0x339144[_0x9c4c('0x44')]=qs[_0x9c4c('0x3c')](_[_0x9c4c('0x45')](_0x2c0324[_0x9c4c('0x3b')],_0x1dda08[_0x9c4c('0x3c')]));if(_0x2c0324[_0x9c4c('0x3b')][_0x9c4c('0x47')]){_0x339144[_0x9c4c('0x44')]=_[_0x9c4c('0x48')](_0x339144['where'],{'$or':_[_0x9c4c('0x35')](_0x339144[_0x9c4c('0x3e')],function(_0x4c5da8){var _0x1a705b={};_0x1a705b[_0x4c5da8]={'$like':'%'+_0x2c0324['query'][_0x9c4c('0x47')]+'%'};return _0x1a705b;})});}_0x339144=_['merge']({},_0x339144,_0x2c0324[_0x9c4c('0x52')]);return _0x5c09d9[_0x9c4c('0x84')](_0x339144);}})[_0x9c4c('0x2b')](function(_0x3ef0ae){if(_0x3ef0ae){_0x121487=_0x3ef0ae[_0x9c4c('0x51')];if(!_0x2c0324['query']['hasOwnProperty']('nolimit')){_0x339144[_0x9c4c('0x25')]=qs[_0x9c4c('0x25')](_0x2c0324[_0x9c4c('0x3b')][_0x9c4c('0x25')]);_0x339144[_0x9c4c('0x23')]=qs[_0x9c4c('0x23')](_0x2c0324[_0x9c4c('0x3b')]['offset']);}return _0x5c09d9[_0x9c4c('0x84')](_0x339144);}})['then'](function(_0x2ada97){if(_0x2ada97){return _0x2ada97?{'count':_0x121487,'rows':_0x2ada97}:null;}})[_0x9c4c('0x2b')](respondWithResult(_0x570f37,null))[_0x9c4c('0x4d')](handleError(_0x570f37,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index eb3e5c9..f07900a 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 _0x8115=['Dashboard','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x42fcb3,_0x644df8){var _0x52a705=function(_0x9097fd){while(--_0x9097fd){_0x42fcb3['push'](_0x42fcb3['shift']());}};_0x52a705(++_0x644df8);}(_0x8115,0x1c0));var _0x5811=function(_0x462ebd,_0x490183){_0x462ebd=_0x462ebd-0x0;var _0x29fca2=_0x8115[_0x462ebd];return _0x29fca2;};'use strict';var EventEmitter=require(_0x5811('0x0'));var Dashboard=require(_0x5811('0x1'))['db'][_0x5811('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5811('0x3')](0x0);var events={'afterCreate':_0x5811('0x4'),'afterUpdate':'update','afterDestroy':_0x5811('0x5')};function emitEvent(_0x1b0936){return function(_0x438443,_0x594677,_0x4f4d94){DashboardEvents[_0x5811('0x6')](_0x1b0936+':'+_0x438443['id'],_0x438443);DashboardEvents[_0x5811('0x6')](_0x1b0936,_0x438443);_0x4f4d94(null);};}for(var e in events){if(events[_0x5811('0x7')](e)){var event=events[e];Dashboard[_0x5811('0x8')](e,emitEvent(event));}}module[_0x5811('0x9')]=DashboardEvents; \ No newline at end of file +var _0xb6b7=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0xcf11a9,_0x23c71a){var _0x335106=function(_0x51733c){while(--_0x51733c){_0xcf11a9['push'](_0xcf11a9['shift']());}};_0x335106(++_0x23c71a);}(_0xb6b7,0xe4));var _0x7b6b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb6b7[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x7b6b('0x0'));var Dashboard=require(_0x7b6b('0x1'))['db'][_0x7b6b('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7b6b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7b6b('0x4')};function emitEvent(_0x415478){return function(_0xeb5c0f,_0x433239,_0x4d4223){DashboardEvents[_0x7b6b('0x5')](_0x415478+':'+_0xeb5c0f['id'],_0xeb5c0f);DashboardEvents[_0x7b6b('0x5')](_0x415478,_0xeb5c0f);_0x4d4223(null);};}for(var e in events){if(events[_0x7b6b('0x6')](e)){var event=events[e];Dashboard[_0x7b6b('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index cb56328..00305b8 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 _0x921e=['path','../../config/environment','exports','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x921e,0xca));var _0xe921=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x921e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe921('0x0'));var logger=require(_0xe921('0x1'))(_0xe921('0x2'));var moment=require('moment');var BPromise=require(_0xe921('0x3'));var rp=require(_0xe921('0x4'));var fs=require('fs');var path=require(_0xe921('0x5'));var rimraf=require('rimraf');var config=require(_0xe921('0x6'));var attributes=require('./dashboard.attributes');module[_0xe921('0x7')]=function(_0xc663d4,_0x4560b2){return _0xc663d4[_0xe921('0x8')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56ce=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Dashboard','dashboards','lodash','../../config/logger','api'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0x56ce,0x1e9));var _0xe56c=function(_0x2bc7ba,_0x2e1d5f){_0x2bc7ba=_0x2bc7ba-0x0;var _0x3a8252=_0x56ce[_0x2bc7ba];return _0x3a8252;};'use strict';var _=require(_0xe56c('0x0'));var util=require('util');var logger=require(_0xe56c('0x1'))(_0xe56c('0x2'));var moment=require(_0xe56c('0x3'));var BPromise=require(_0xe56c('0x4'));var rp=require(_0xe56c('0x5'));var fs=require('fs');var path=require(_0xe56c('0x6'));var rimraf=require(_0xe56c('0x7'));var config=require(_0xe56c('0x8'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x253482,_0x53aaf5){return _0x253482[_0xe56c('0x9')](_0xe56c('0xa'),attributes,{'tableName':_0xe56c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index d546484..13924e1 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 _0xdc22=['request\x20sent','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0xb55900,_0x196f1e){var _0x5dfbb=function(_0x74c34b){while(--_0x74c34b){_0xb55900['push'](_0xb55900['shift']());}};_0x5dfbb(++_0x196f1e);}(_0xdc22,0xf7));var _0x2dc2=function(_0x446f11,_0x95cf21){_0x446f11=_0x446f11-0x0;var _0x385cb5=_0xdc22[_0x446f11];return _0x385cb5;};'use strict';var _=require(_0x2dc2('0x0'));var util=require('util');var moment=require(_0x2dc2('0x1'));var BPromise=require(_0x2dc2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2dc2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2dc2('0x4'));var logger=require(_0x2dc2('0x5'))(_0x2dc2('0x6'));var config=require(_0x2dc2('0x7'));var jayson=require(_0x2dc2('0x8'));var client=jayson[_0x2dc2('0x9')][_0x2dc2('0xa')]({'port':0x232a});config[_0x2dc2('0xb')]=_[_0x2dc2('0xc')](config[_0x2dc2('0xb')],{'host':_0x2dc2('0xd'),'port':0x18eb});var socket=require(_0x2dc2('0xe'))(new Redis(config[_0x2dc2('0xb')]));require(_0x2dc2('0xf'))[_0x2dc2('0x10')](socket);function respondWithRpcPromise(_0x3d0d7a,_0x55c25b,_0x18b8c9){return new BPromise(function(_0x2cd94e,_0x180b4e){return client[_0x2dc2('0x11')](_0x3d0d7a,_0x18b8c9)[_0x2dc2('0x12')](function(_0x3a4828){logger[_0x2dc2('0x13')](_0x2dc2('0x14'),_0x55c25b,'request\x20sent');logger[_0x2dc2('0x15')](_0x2dc2('0x16'),_0x55c25b,_0x2dc2('0x17'),JSON[_0x2dc2('0x18')](_0x3a4828));if(_0x3a4828['error']){if(_0x3a4828['error'][_0x2dc2('0x19')]===0x1f4){logger[_0x2dc2('0x1a')]('Dashboard,\x20%s,\x20%s',_0x55c25b,_0x3a4828['error'][_0x2dc2('0x1b')]);return _0x180b4e(_0x3a4828[_0x2dc2('0x1a')][_0x2dc2('0x1b')]);}logger[_0x2dc2('0x1a')]('Dashboard,\x20%s,\x20%s',_0x55c25b,_0x3a4828['error'][_0x2dc2('0x1b')]);return _0x2cd94e(_0x3a4828[_0x2dc2('0x1a')]['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x55c25b,'request\x20sent');_0x2cd94e(_0x3a4828[_0x2dc2('0x1c')][_0x2dc2('0x1b')]);}})[_0x2dc2('0x1d')](function(_0x1db235){logger[_0x2dc2('0x1a')]('Dashboard,\x20%s,\x20%s',_0x55c25b,_0x1db235);_0x180b4e(_0x1db235);});});} \ No newline at end of file +var _0x6fc2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x520c1e,_0x15ffe8){var _0x263070=function(_0x35ff78){while(--_0x35ff78){_0x520c1e['push'](_0x520c1e['shift']());}};_0x263070(++_0x15ffe8);}(_0x6fc2,0x13c));var _0x26fc=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x6fc2[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x26fc('0x0'));var util=require(_0x26fc('0x1'));var moment=require(_0x26fc('0x2'));var BPromise=require(_0x26fc('0x3'));var rs=require(_0x26fc('0x4'));var fs=require('fs');var Redis=require(_0x26fc('0x5'));var db=require(_0x26fc('0x6'))['db'];var utils=require(_0x26fc('0x7'));var logger=require(_0x26fc('0x8'))('rpc');var config=require(_0x26fc('0x9'));var jayson=require(_0x26fc('0xa'));var client=jayson['client'][_0x26fc('0xb')]({'port':0x232a});config[_0x26fc('0xc')]=_[_0x26fc('0xd')](config[_0x26fc('0xc')],{'host':_0x26fc('0xe'),'port':0x18eb});var socket=require(_0x26fc('0xf'))(new Redis(config['redis']));require(_0x26fc('0x10'))[_0x26fc('0x11')](socket);function respondWithRpcPromise(_0x407c03,_0x4a7cd9,_0xfad78){return new BPromise(function(_0x105758,_0x4f61bb){return client[_0x26fc('0x12')](_0x407c03,_0xfad78)['then'](function(_0xa269d6){logger[_0x26fc('0x13')](_0x26fc('0x14'),_0x4a7cd9,_0x26fc('0x15'));logger[_0x26fc('0x16')](_0x26fc('0x17'),_0x4a7cd9,_0x26fc('0x15'),JSON[_0x26fc('0x18')](_0xa269d6));if(_0xa269d6[_0x26fc('0x19')]){if(_0xa269d6['error']['code']===0x1f4){logger[_0x26fc('0x19')](_0x26fc('0x14'),_0x4a7cd9,_0xa269d6[_0x26fc('0x19')][_0x26fc('0x1a')]);return _0x4f61bb(_0xa269d6['error'][_0x26fc('0x1a')]);}logger[_0x26fc('0x19')]('Dashboard,\x20%s,\x20%s',_0x4a7cd9,_0xa269d6[_0x26fc('0x19')][_0x26fc('0x1a')]);return _0x105758(_0xa269d6['error'][_0x26fc('0x1a')]);}else{logger[_0x26fc('0x13')](_0x26fc('0x14'),_0x4a7cd9,_0x26fc('0x15'));_0x105758(_0xa269d6[_0x26fc('0x1b')][_0x26fc('0x1a')]);}})[_0x26fc('0x1c')](function(_0x4f2078){logger['error']('Dashboard,\x20%s,\x20%s',_0x4a7cd9,_0x4f2078);_0x4f61bb(_0x4f2078);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index fc5c46e..3e03f2f 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 _0x9cfd=['save','remove','update','emit','removeListener','register','length','dashboard:'];(function(_0xbd4a81,_0x5374fe){var _0x28c58f=function(_0x5d6c56){while(--_0x5d6c56){_0xbd4a81['push'](_0xbd4a81['shift']());}};_0x28c58f(++_0x5374fe);}(_0x9cfd,0x138));var _0xd9cf=function(_0x3662e1,_0x30cd29){_0x3662e1=_0x3662e1-0x0;var _0x110c6d=_0x9cfd[_0x3662e1];return _0x110c6d;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xd9cf('0x0'),_0xd9cf('0x1'),_0xd9cf('0x2')];function createListener(_0x52adf8,_0x131c5c){return function(_0x1a8f7c){_0x131c5c[_0xd9cf('0x3')](_0x52adf8,_0x1a8f7c);};}function removeListener(_0x1170a9,_0x2a3111){return function(){DashboardEvents[_0xd9cf('0x4')](_0x1170a9,_0x2a3111);};}exports[_0xd9cf('0x5')]=function(_0x313b6e){for(var _0x5e8966=0x0,_0x48fb09=events[_0xd9cf('0x6')];_0x5e8966<_0x48fb09;_0x5e8966++){var _0xa7c858=events[_0x5e8966];var _0xa0d5b7=createListener(_0xd9cf('0x7')+_0xa7c858,_0x313b6e);DashboardEvents['on'](_0xa7c858,_0xa0d5b7);}}; \ No newline at end of file +var _0x2dcc=['./dashboard.events','save','remove','update','emit','removeListener','register','length'];(function(_0x43362e,_0x4b7521){var _0x1d9ac0=function(_0xe9a9dd){while(--_0xe9a9dd){_0x43362e['push'](_0x43362e['shift']());}};_0x1d9ac0(++_0x4b7521);}(_0x2dcc,0xa8));var _0xc2dc=function(_0x3e8f7e,_0x29dc42){_0x3e8f7e=_0x3e8f7e-0x0;var _0xf3b492=_0x2dcc[_0x3e8f7e];return _0xf3b492;};'use strict';var DashboardEvents=require(_0xc2dc('0x0'));var events=[_0xc2dc('0x1'),_0xc2dc('0x2'),_0xc2dc('0x3')];function createListener(_0x2c3190,_0x4ecb47){return function(_0x16ad58){_0x4ecb47[_0xc2dc('0x4')](_0x2c3190,_0x16ad58);};}function removeListener(_0x10b9dc,_0x24b6b3){return function(){DashboardEvents[_0xc2dc('0x5')](_0x10b9dc,_0x24b6b3);};}exports[_0xc2dc('0x6')]=function(_0x474e31){for(var _0x460f98=0x0,_0x2e70b7=events[_0xc2dc('0x7')];_0x460f98<_0x2e70b7;_0x460f98++){var _0x31e983=events[_0x460f98];var _0x27dcd5=createListener('dashboard:'+_0x31e983,_0x474e31);DashboardEvents['on'](_0x31e983,_0x27dcd5);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index a370af6..8f165b7 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 _0x81b9=['isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x81b9,0x81));var _0x981b=function(_0x55e5e6,_0x1d7889){_0x55e5e6=_0x55e5e6-0x0;var _0x22fcfc=_0x81b9[_0x55e5e6];return _0x22fcfc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x981b('0x0'));var timeout=require(_0x981b('0x1'));var express=require(_0x981b('0x2'));var router=express[_0x981b('0x3')]();var fs_extra=require(_0x981b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x981b('0x5'));var config=require(_0x981b('0x6'));var controller=require(_0x981b('0x7'));router[_0x981b('0x8')]('/',auth[_0x981b('0x9')](),controller[_0x981b('0xa')]);router['get'](_0x981b('0xb'),auth[_0x981b('0x9')](),controller[_0x981b('0xc')]);router[_0x981b('0x8')](_0x981b('0xd'),auth[_0x981b('0x9')](),controller[_0x981b('0xe')]);router[_0x981b('0xf')]('/',auth['isAuthenticated'](),controller[_0x981b('0x10')]);router[_0x981b('0xf')](_0x981b('0x11'),auth[_0x981b('0x9')](),controller[_0x981b('0x12')]);router['post'](_0x981b('0xd'),auth[_0x981b('0x9')](),controller[_0x981b('0x13')]);router[_0x981b('0x14')](_0x981b('0xb'),auth[_0x981b('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x981b('0x15')]);module[_0x981b('0x16')]=router; \ No newline at end of file +var _0xd344=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./dashboard.controller','get','index','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put'];(function(_0x55aa90,_0x3c6090){var _0x1db5ba=function(_0x482eab){while(--_0x482eab){_0x55aa90['push'](_0x55aa90['shift']());}};_0x1db5ba(++_0x3c6090);}(_0xd344,0x1ba));var _0x4d34=function(_0x1a6c30,_0xbed9c9){_0x1a6c30=_0x1a6c30-0x0;var _0x5c3277=_0xd344[_0x1a6c30];return _0x5c3277;};'use strict';var multer=require(_0x4d34('0x0'));var util=require(_0x4d34('0x1'));var path=require(_0x4d34('0x2'));var timeout=require(_0x4d34('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4d34('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4d34('0x5'));var controller=require(_0x4d34('0x6'));router[_0x4d34('0x7')]('/',auth['isAuthenticated'](),controller[_0x4d34('0x8')]);router[_0x4d34('0x7')]('/:id',auth[_0x4d34('0x9')](),controller['show']);router[_0x4d34('0x7')](_0x4d34('0xa'),auth[_0x4d34('0x9')](),controller[_0x4d34('0xb')]);router[_0x4d34('0xc')]('/',auth[_0x4d34('0x9')](),controller[_0x4d34('0xd')]);router[_0x4d34('0xc')](_0x4d34('0xe'),auth[_0x4d34('0x9')](),controller[_0x4d34('0xf')]);router[_0x4d34('0xc')](_0x4d34('0xa'),auth['isAuthenticated'](),controller[_0x4d34('0x10')]);router[_0x4d34('0x11')](_0x4d34('0x12'),auth[_0x4d34('0x9')](),controller[_0x4d34('0x13')]);router[_0x4d34('0x14')](_0x4d34('0x12'),auth['isAuthenticated'](),controller[_0x4d34('0x15')]);module[_0x4d34('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8ed2db5..54b2993 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 _0x71ab=['setDataValue','stringify','INTEGER','#2196f3','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x71ab,0x64));var _0xb71a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x71ab[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xb71a('0x0'));var _=require('lodash');module[_0xb71a('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb71a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb71a('0x3')](_0xb71a('0x4')),'get':function(){try{return JSON[_0xb71a('0x5')](this[_0xb71a('0x6')](_0xb71a('0x7')));}catch(_0x2192e8){return[];}},'set':function(_0x38d931){try{this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')](_0x38d931));}catch(_0x2a4c86){this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb71a('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':_0xb71a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb71a('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xfcf0=['sequelize','squel','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xfcf0,0x138));var _0x0fcf=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0xfcf0[_0x45ae0d];return _0x371826;};'use strict';var Sequelize=require(_0x0fcf('0x0'));var squel=require(_0x0fcf('0x1'));var _=require('lodash');module[_0x0fcf('0x2')]={'title':{'type':Sequelize[_0x0fcf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0fcf('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0fcf('0x4')]('long'),'get':function(){try{return JSON[_0x0fcf('0x5')](this[_0x0fcf('0x6')](_0x0fcf('0x7')));}catch(_0x3af316){return[];}},'set':function(_0x1bace8){try{this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')](_0x1bace8));}catch(_0x50c575){this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0fcf('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0fcf('0xa')]},'col':{'type':Sequelize[_0x0fcf('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0fcf('0x3')]},'titleFontSize':{'type':Sequelize[_0x0fcf('0xa')],'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 0d8bc78..1605edc 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 _0xfa9f=['params','model','keys','DashboardItem','query','intersection','fields','length','includeAll','include','merge','destroy','find','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','voice','attrWhatsappAccounts','web-report','reportType','type','attrReport','attrRefresh','stringify','body','create','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','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','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','sendStatus','error','stack','name','show'];(function(_0x370a0c,_0x45c71c){var _0x593215=function(_0x31cfec){while(--_0x31cfec){_0x370a0c['push'](_0x370a0c['shift']());}};_0x593215(++_0x45c71c);}(_0xfa9f,0x93));var _0xffa9=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0xfa9f[_0xe719ec];return _0x4842a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xffa9('0x0'));var zipdir=require(_0xffa9('0x1'));var jsonpatch=require(_0xffa9('0x2'));var rp=require(_0xffa9('0x3'));var moment=require(_0xffa9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xffa9('0x5'));var util=require('util');var path=require(_0xffa9('0x6'));var sox=require(_0xffa9('0x7'));var csv=require('to-csv');var ejs=require(_0xffa9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xffa9('0x9'));var crypto=require(_0xffa9('0xa'));var jsforce=require(_0xffa9('0xb'));var deskjs=require(_0xffa9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xffa9('0xd'));var Papa=require(_0xffa9('0xe'));var Redis=require(_0xffa9('0xf'));var authService=require(_0xffa9('0x10'));var qs=require(_0xffa9('0x11'));var as=require(_0xffa9('0x12'));var hardwareService=require(_0xffa9('0x13'));var logger=require(_0xffa9('0x14'))(_0xffa9('0x15'));var utils=require(_0xffa9('0x16'));var config=require(_0xffa9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xffa9('0x18'))['db'];config[_0xffa9('0x19')]=_[_0xffa9('0x1a')](config[_0xffa9('0x19')],{'host':_0xffa9('0x1b'),'port':0x18eb});var socket=require(_0xffa9('0x1c'))(new Redis(config[_0xffa9('0x19')]));require(_0xffa9('0x1d'))[_0xffa9('0x1e')](socket);function respondWithStatusCode(_0x3dd57f,_0x5812d0){_0x5812d0=_0x5812d0||0xcc;return function(_0x42205d){if(_0x42205d){return _0x3dd57f['sendStatus'](_0x5812d0);}return _0x3dd57f[_0xffa9('0x1f')](_0x5812d0)[_0xffa9('0x20')]();};}function respondWithResult(_0x54cae8,_0x7ad8ba){_0x7ad8ba=_0x7ad8ba||0xc8;return function(_0x2eacc0){if(_0x2eacc0){return _0x54cae8[_0xffa9('0x1f')](_0x7ad8ba)['json'](_0x2eacc0);}};}function respondWithFilteredResult(_0x3ef1bb,_0x6723b6){return function(_0x3cd552){if(_0x3cd552){var _0x2e87a8=typeof _0x6723b6['offset']===_0xffa9('0x21')&&typeof _0x6723b6['limit']===_0xffa9('0x21');var _0x19bec8=_0x3cd552[_0xffa9('0x22')];var _0x389e70=_0x2e87a8?0x0:_0x6723b6[_0xffa9('0x23')];var _0x4486db=_0x2e87a8?_0x3cd552['count']:_0x6723b6[_0xffa9('0x23')]+_0x6723b6[_0xffa9('0x24')];var _0x41eb49;if(_0x4486db>=_0x19bec8){_0x4486db=_0x19bec8;_0x41eb49=0xc8;}else{_0x41eb49=0xce;}_0x3ef1bb[_0xffa9('0x1f')](_0x41eb49);return _0x3ef1bb[_0xffa9('0x25')](_0xffa9('0x26'),_0x389e70+'-'+_0x4486db+'/'+_0x19bec8)[_0xffa9('0x27')](_0x3cd552);}return null;};}function patchUpdates(_0x24218a){return function(_0x43ee08){try{jsonpatch['apply'](_0x43ee08,_0x24218a,!![]);}catch(_0x55ab54){return BPromise[_0xffa9('0x28')](_0x55ab54);}return _0x43ee08[_0xffa9('0x29')]();};}function saveUpdates(_0x2230ef,_0x48a6aa){return function(_0x5d3401){if(_0x5d3401){return _0x5d3401[_0xffa9('0x2a')](_0x2230ef)[_0xffa9('0x2b')](function(_0xb22ae3){return _0xb22ae3;});}return null;};}function removeEntity(_0x5e5dfa,_0x573a85){return function(_0x43f0c7){if(_0x43f0c7){return _0x43f0c7['destroy']()[_0xffa9('0x2b')](function(){_0x5e5dfa[_0xffa9('0x1f')](0xcc)[_0xffa9('0x20')]();});}};}function handleEntityNotFound(_0x331606,_0x415fcd){return function(_0x1aa814){if(!_0x1aa814){_0x331606[_0xffa9('0x2c')](0x194);}return _0x1aa814;};}function handleError(_0x5d1df6,_0x23e449){_0x23e449=_0x23e449||0x1f4;return function(_0x430dbe){logger[_0xffa9('0x2d')](_0x430dbe[_0xffa9('0x2e')]);if(_0x430dbe[_0xffa9('0x2f')]){delete _0x430dbe[_0xffa9('0x2f')];}_0x5d1df6['status'](_0x23e449)['send'](_0x430dbe);};}exports[_0xffa9('0x30')]=function(_0x3484f6,_0x3b01fe){var _0x45a8a4={'raw':![],'where':{'id':_0x3484f6[_0xffa9('0x31')]['id']}},_0xd353c4={};_0xd353c4[_0xffa9('0x32')]=_[_0xffa9('0x33')](db[_0xffa9('0x34')]['rawAttributes']);_0xd353c4[_0xffa9('0x35')]=_[_0xffa9('0x33')](_0x3484f6[_0xffa9('0x35')]);_0xd353c4['filters']=_[_0xffa9('0x36')](_0xd353c4[_0xffa9('0x32')],_0xd353c4[_0xffa9('0x35')]);_0x45a8a4['attributes']=_[_0xffa9('0x36')](_0xd353c4[_0xffa9('0x32')],qs[_0xffa9('0x37')](_0x3484f6['query'][_0xffa9('0x37')]));_0x45a8a4['attributes']=_0x45a8a4['attributes'][_0xffa9('0x38')]?_0x45a8a4['attributes']:_0xd353c4[_0xffa9('0x32')];if(_0x3484f6[_0xffa9('0x35')][_0xffa9('0x39')]){_0x45a8a4[_0xffa9('0x3a')]=[{'all':!![]}];}_0x45a8a4=_[_0xffa9('0x3b')]({},_0x45a8a4,_0x3484f6['options']);return db[_0xffa9('0x34')]['find'](_0x45a8a4)['then'](handleEntityNotFound(_0x3b01fe,null))[_0xffa9('0x2b')](respondWithResult(_0x3b01fe,null))['catch'](handleError(_0x3b01fe,null));};exports[_0xffa9('0x3c')]=function(_0x346251,_0x48a41f){return db['DashboardItem'][_0xffa9('0x3d')]({'where':{'id':_0x346251['params']['id']}})[_0xffa9('0x2b')](handleEntityNotFound(_0x48a41f,null))[_0xffa9('0x2b')](removeEntity(_0x48a41f,null))['catch'](handleError(_0x48a41f,null));};function widgetAttributes(_0x48c479){try{switch(_0x48c479['type']){case'iframe':return[{'name':_0xffa9('0x3e'),'value':_0x48c479[_0xffa9('0x3e')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479['attrs'][0x0]?_0x48c479[_0xffa9('0x3f')][0x0][_0xffa9('0x40')]:undefined)||_0xffa9('0x41')}];case _0xffa9('0x42'):return[{'name':_0xffa9('0x43'),'value':_0x48c479['attrPath']||(_0x48c479['attrs']&&_0x48c479[_0xffa9('0x3f')][0x0]?_0x48c479[_0xffa9('0x3f')][0x0][_0xffa9('0x40')]:undefined)||''}];case _0xffa9('0x44'):return[{'name':'attrHourFormat','value':_0x48c479[_0xffa9('0x45')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479['attrs'][0x0]?_0x48c479[_0xffa9('0x3f')][0x0][_0xffa9('0x40')]:undefined)||_0xffa9('0x46')},{'name':'attrTimezone','value':_0x48c479['attrTimezone']||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x1]?_0x48c479[_0xffa9('0x3f')][0x1][_0xffa9('0x40')]:undefined)||'0.00'},{'name':_0xffa9('0x47'),'value':_0x48c479[_0xffa9('0x47')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x2]?_0x48c479[_0xffa9('0x3f')][0x2][_0xffa9('0x40')]:undefined)||0xc}];case _0xffa9('0x48'):return[{'name':_0xffa9('0x49'),'value':_0x48c479[_0xffa9('0x49')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x0]?_0x48c479[_0xffa9('0x3f')][0x0][_0xffa9('0x40')]:undefined)||_0xffa9('0x4a')},{'name':_0xffa9('0x4b'),'value':_0x48c479['attrVoiceQueues']||(_0x48c479['attrs']&&_0x48c479[_0xffa9('0x3f')][0x1]?_0x48c479[_0xffa9('0x3f')][0x1][_0xffa9('0x40')]:undefined)||[]},{'name':_0xffa9('0x47'),'value':_0x48c479[_0xffa9('0x47')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479['attrs'][0x2]?_0x48c479[_0xffa9('0x3f')][0x2][_0xffa9('0x40')]:undefined)||0x14},{'name':'attrChannel','value':_0x48c479['attrChannel']||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x3]?_0x48c479[_0xffa9('0x3f')][0x3]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x48c479[_0xffa9('0x4c')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x4]?_0x48c479[_0xffa9('0x3f')][0x4][_0xffa9('0x40')]:undefined)||''},{'name':_0xffa9('0x4d'),'value':_0x48c479[_0xffa9('0x4d')]||(_0x48c479['attrs']&&_0x48c479[_0xffa9('0x3f')][0x5]?_0x48c479[_0xffa9('0x3f')][0x5][_0xffa9('0x40')]:undefined)||''},{'name':_0xffa9('0x4e'),'value':_0x48c479[_0xffa9('0x4e')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479['attrs'][0x6]?_0x48c479[_0xffa9('0x3f')][0x6]['value']:undefined)||''},{'name':_0xffa9('0x4f'),'value':_0x48c479[_0xffa9('0x4f')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x7]?_0x48c479[_0xffa9('0x3f')][0x7][_0xffa9('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x48c479['attrWhatsappAccounts']||(_0x48c479['attrs']&&_0x48c479[_0xffa9('0x3f')][0x8]?_0x48c479[_0xffa9('0x3f')][0x8]['value']:undefined)||''},{'name':_0xffa9('0x50'),'value':_0x48c479[_0xffa9('0x50')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x9]?_0x48c479[_0xffa9('0x3f')][0x9][_0xffa9('0x40')]:undefined)||''}];case _0xffa9('0x51'):case _0xffa9('0x52'):return[{'name':_0xffa9('0x53'),'value':_0x48c479[_0xffa9('0x53')]||(_0x48c479['attrs']&&_0x48c479[_0xffa9('0x3f')][0x0]?_0x48c479[_0xffa9('0x3f')][0x0][_0xffa9('0x40')]:undefined)||_0xffa9('0x4a')},{'name':'attrSerie2','value':_0x48c479[_0xffa9('0x54')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x1]?_0x48c479['attrs'][0x1][_0xffa9('0x40')]:undefined)||null},{'name':_0xffa9('0x55'),'value':_0x48c479['attrSerie3']||(_0x48c479['attrs']&&_0x48c479[_0xffa9('0x3f')][0x2]?_0x48c479[_0xffa9('0x3f')][0x2][_0xffa9('0x40')]:undefined)||null},{'name':_0xffa9('0x4b'),'value':_0x48c479[_0xffa9('0x4b')]||(_0x48c479['attrs']&&_0x48c479['attrs'][0x3]?_0x48c479['attrs'][0x3][_0xffa9('0x40')]:undefined)||[]},{'name':_0xffa9('0x56'),'value':_0x48c479[_0xffa9('0x56')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x4]?_0x48c479[_0xffa9('0x3f')][0x4]['value']:undefined)||_0xffa9('0x57')},{'name':_0xffa9('0x4c'),'value':_0x48c479[_0xffa9('0x4c')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479['attrs'][0x5]?_0x48c479[_0xffa9('0x3f')][0x5][_0xffa9('0x40')]:undefined)||''},{'name':_0xffa9('0x4d'),'value':_0x48c479[_0xffa9('0x4d')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x6]?_0x48c479[_0xffa9('0x3f')][0x6][_0xffa9('0x40')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x48c479[_0xffa9('0x4e')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x7]?_0x48c479[_0xffa9('0x3f')][0x7][_0xffa9('0x40')]:undefined)||''},{'name':_0xffa9('0x4f'),'value':_0x48c479[_0xffa9('0x4f')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479['attrs'][0x8]?_0x48c479[_0xffa9('0x3f')][0x8]['value']:undefined)||''},{'name':_0xffa9('0x58'),'value':_0x48c479[_0xffa9('0x58')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x9]?_0x48c479['attrs'][0x9][_0xffa9('0x40')]:undefined)||''},{'name':_0xffa9('0x50'),'value':_0x48c479[_0xffa9('0x50')]||(_0x48c479['attrs']&&_0x48c479[_0xffa9('0x3f')][0xa]?_0x48c479[_0xffa9('0x3f')][0xa][_0xffa9('0x40')]:undefined)||''}];case _0xffa9('0x59'):return[{'name':'attrReport','type':_0x48c479[_0xffa9('0x5a')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479['attrs'][0x0]?_0x48c479[_0xffa9('0x3f')][0x0][_0xffa9('0x5b')]:undefined)||null,'value':_0x48c479[_0xffa9('0x5c')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479[_0xffa9('0x3f')][0x0]?_0x48c479[_0xffa9('0x3f')][0x0]['value']:undefined)||null},{'name':_0xffa9('0x5d'),'value':_0x48c479[_0xffa9('0x5d')]||(_0x48c479[_0xffa9('0x3f')]&&_0x48c479['attrs'][0x1]?_0x48c479[_0xffa9('0x3f')][0x1][_0xffa9('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x1860a4){logger[_0xffa9('0x2d')]('widgetAttributes:\x20%s',JSON[_0xffa9('0x5e')](_0x1860a4));return[];}}exports['create']=function(_0x4e6c2e,_0x99ae3c){if(_0x4e6c2e['body']){_0x4e6c2e['body'][_0xffa9('0x3f')]=widgetAttributes(_0x4e6c2e[_0xffa9('0x5f')]);}return db[_0xffa9('0x34')][_0xffa9('0x60')](_0x4e6c2e[_0xffa9('0x5f')],{})[_0xffa9('0x2b')](respondWithResult(_0x99ae3c,0xc9))[_0xffa9('0x61')](handleError(_0x99ae3c,null));};exports[_0xffa9('0x2a')]=function(_0x4415e4,_0x54781a){if(_0x4415e4[_0xffa9('0x5f')]['id']){delete _0x4415e4[_0xffa9('0x5f')]['id'];}_0x4415e4[_0xffa9('0x5f')]['attrs']=widgetAttributes(_0x4415e4['body']);return db['DashboardItem'][_0xffa9('0x3d')]({'where':{'id':_0x4415e4['params']['id']}})[_0xffa9('0x2b')](handleEntityNotFound(_0x54781a,null))[_0xffa9('0x2b')](saveUpdates(_0x4415e4['body'],null))[_0xffa9('0x2b')](respondWithResult(_0x54781a,null))[_0xffa9('0x61')](handleError(_0x54781a,null));}; \ No newline at end of file +var _0x3f1c=['value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrMetric','total','attrVoiceQueues','attrFontSize','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','attrReport','attrRefresh','stringify','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','DashboardItem','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','type','iframe','attrUrl','attrs'];(function(_0x43855d,_0xb399bf){var _0x4f90cd=function(_0x327276){while(--_0x327276){_0x43855d['push'](_0x43855d['shift']());}};_0x4f90cd(++_0xb399bf);}(_0x3f1c,0xd4));var _0xc3f1=function(_0xc92314,_0x3a59a8){_0xc92314=_0xc92314-0x0;var _0x295263=_0x3f1c[_0xc92314];return _0x295263;};'use strict';var emlformat=require(_0xc3f1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc3f1('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3f1('0x2'));var Mustache=require(_0xc3f1('0x3'));var util=require(_0xc3f1('0x4'));var path=require(_0xc3f1('0x5'));var sox=require(_0xc3f1('0x6'));var csv=require('to-csv');var ejs=require(_0xc3f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3f1('0x8'));var squel=require(_0xc3f1('0x9'));var crypto=require(_0xc3f1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3f1('0xb'));var querystring=require('querystring');var Papa=require(_0xc3f1('0xc'));var Redis=require(_0xc3f1('0xd'));var authService=require(_0xc3f1('0xe'));var qs=require(_0xc3f1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f1('0x10'));var logger=require('../../config/logger')(_0xc3f1('0x11'));var utils=require('../../config/utils');var config=require(_0xc3f1('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc3f1('0x13')]=_[_0xc3f1('0x14')](config[_0xc3f1('0x13')],{'host':_0xc3f1('0x15'),'port':0x18eb});var socket=require(_0xc3f1('0x16'))(new Redis(config[_0xc3f1('0x13')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x1d9ea7,_0x3ad406){_0x3ad406=_0x3ad406||0xcc;return function(_0x2ea6c2){if(_0x2ea6c2){return _0x1d9ea7[_0xc3f1('0x17')](_0x3ad406);}return _0x1d9ea7['status'](_0x3ad406)[_0xc3f1('0x18')]();};}function respondWithResult(_0xee643,_0x593c28){_0x593c28=_0x593c28||0xc8;return function(_0x46b599){if(_0x46b599){return _0xee643['status'](_0x593c28)[_0xc3f1('0x19')](_0x46b599);}};}function respondWithFilteredResult(_0x59e1e3,_0x462599){return function(_0x420d75){if(_0x420d75){var _0x3ed046=typeof _0x462599[_0xc3f1('0x1a')]==='undefined'&&typeof _0x462599[_0xc3f1('0x1b')]===_0xc3f1('0x1c');var _0x3f97b2=_0x420d75[_0xc3f1('0x1d')];var _0x27a37c=_0x3ed046?0x0:_0x462599['offset'];var _0x68d412=_0x3ed046?_0x420d75['count']:_0x462599['offset']+_0x462599[_0xc3f1('0x1b')];var _0x1d3ebb;if(_0x68d412>=_0x3f97b2){_0x68d412=_0x3f97b2;_0x1d3ebb=0xc8;}else{_0x1d3ebb=0xce;}_0x59e1e3[_0xc3f1('0x1e')](_0x1d3ebb);return _0x59e1e3[_0xc3f1('0x1f')]('Content-Range',_0x27a37c+'-'+_0x68d412+'/'+_0x3f97b2)[_0xc3f1('0x19')](_0x420d75);}return null;};}function patchUpdates(_0x2df1a4){return function(_0xb27830){try{jsonpatch[_0xc3f1('0x20')](_0xb27830,_0x2df1a4,!![]);}catch(_0x151c8a){return BPromise[_0xc3f1('0x21')](_0x151c8a);}return _0xb27830[_0xc3f1('0x22')]();};}function saveUpdates(_0x294f50,_0x5706d9){return function(_0x47a68d){if(_0x47a68d){return _0x47a68d[_0xc3f1('0x23')](_0x294f50)[_0xc3f1('0x24')](function(_0x3b1eb9){return _0x3b1eb9;});}return null;};}function removeEntity(_0x49d98d,_0x5e1b6a){return function(_0x188f46){if(_0x188f46){return _0x188f46[_0xc3f1('0x25')]()[_0xc3f1('0x24')](function(){_0x49d98d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x136e7a,_0x2ce433){return function(_0x5e7970){if(!_0x5e7970){_0x136e7a['sendStatus'](0x194);}return _0x5e7970;};}function handleError(_0x381264,_0x2e873d){_0x2e873d=_0x2e873d||0x1f4;return function(_0x5cb85d){logger[_0xc3f1('0x26')](_0x5cb85d[_0xc3f1('0x27')]);if(_0x5cb85d[_0xc3f1('0x28')]){delete _0x5cb85d[_0xc3f1('0x28')];}_0x381264[_0xc3f1('0x1e')](_0x2e873d)[_0xc3f1('0x29')](_0x5cb85d);};}exports[_0xc3f1('0x2a')]=function(_0x481a48,_0x22957c){var _0x136a16={'raw':![],'where':{'id':_0x481a48[_0xc3f1('0x2b')]['id']}},_0x1782d7={};_0x1782d7[_0xc3f1('0x2c')]=_['keys'](db[_0xc3f1('0x2d')]['rawAttributes']);_0x1782d7[_0xc3f1('0x2e')]=_['keys'](_0x481a48['query']);_0x1782d7[_0xc3f1('0x2f')]=_[_0xc3f1('0x30')](_0x1782d7['model'],_0x1782d7[_0xc3f1('0x2e')]);_0x136a16[_0xc3f1('0x31')]=_['intersection'](_0x1782d7[_0xc3f1('0x2c')],qs['fields'](_0x481a48[_0xc3f1('0x2e')][_0xc3f1('0x32')]));_0x136a16[_0xc3f1('0x31')]=_0x136a16[_0xc3f1('0x31')][_0xc3f1('0x33')]?_0x136a16['attributes']:_0x1782d7[_0xc3f1('0x2c')];if(_0x481a48[_0xc3f1('0x2e')]['includeAll']){_0x136a16[_0xc3f1('0x34')]=[{'all':!![]}];}_0x136a16=_[_0xc3f1('0x35')]({},_0x136a16,_0x481a48[_0xc3f1('0x36')]);return db['DashboardItem'][_0xc3f1('0x37')](_0x136a16)[_0xc3f1('0x24')](handleEntityNotFound(_0x22957c,null))['then'](respondWithResult(_0x22957c,null))[_0xc3f1('0x38')](handleError(_0x22957c,null));};exports[_0xc3f1('0x25')]=function(_0x5e7016,_0x3c0e33){return db[_0xc3f1('0x2d')][_0xc3f1('0x37')]({'where':{'id':_0x5e7016[_0xc3f1('0x2b')]['id']}})[_0xc3f1('0x24')](handleEntityNotFound(_0x3c0e33,null))[_0xc3f1('0x24')](removeEntity(_0x3c0e33,null))[_0xc3f1('0x38')](handleError(_0x3c0e33,null));};function widgetAttributes(_0x303c88){try{switch(_0x303c88[_0xc3f1('0x39')]){case _0xc3f1('0x3a'):return[{'name':_0xc3f1('0x3b'),'value':_0x303c88['attrUrl']||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88['attrs'][0x0]?_0x303c88['attrs'][0x0][_0xc3f1('0x3d')]:undefined)||_0xc3f1('0x3e')}];case _0xc3f1('0x3f'):return[{'name':'attrPath','value':_0x303c88[_0xc3f1('0x40')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x0]?_0x303c88[_0xc3f1('0x3c')][0x0][_0xc3f1('0x3d')]:undefined)||''}];case _0xc3f1('0x41'):return[{'name':'attrHourFormat','value':_0x303c88[_0xc3f1('0x42')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x0]?_0x303c88['attrs'][0x0]['value']:undefined)||_0xc3f1('0x43')},{'name':_0xc3f1('0x44'),'value':_0x303c88['attrTimezone']||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x1]?_0x303c88['attrs'][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x303c88['attrFontSize']||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x2]?_0x303c88[_0xc3f1('0x3c')][0x2][_0xc3f1('0x3d')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x303c88[_0xc3f1('0x45')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x0]?_0x303c88[_0xc3f1('0x3c')][0x0][_0xc3f1('0x3d')]:undefined)||_0xc3f1('0x46')},{'name':_0xc3f1('0x47'),'value':_0x303c88[_0xc3f1('0x47')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88['attrs'][0x1]?_0x303c88[_0xc3f1('0x3c')][0x1][_0xc3f1('0x3d')]:undefined)||[]},{'name':'attrFontSize','value':_0x303c88[_0xc3f1('0x48')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x2]?_0x303c88[_0xc3f1('0x3c')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x303c88['attrChannel']||(_0x303c88['attrs']&&_0x303c88[_0xc3f1('0x3c')][0x3]?_0x303c88[_0xc3f1('0x3c')][0x3]['value']:undefined)||_0xc3f1('0x49')},{'name':_0xc3f1('0x4a'),'value':_0x303c88[_0xc3f1('0x4a')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x4]?_0x303c88[_0xc3f1('0x3c')][0x4][_0xc3f1('0x3d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x303c88[_0xc3f1('0x4b')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88['attrs'][0x5]?_0x303c88[_0xc3f1('0x3c')][0x5][_0xc3f1('0x3d')]:undefined)||''},{'name':_0xc3f1('0x4c'),'value':_0x303c88['attrSmsAccounts']||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x6]?_0x303c88['attrs'][0x6][_0xc3f1('0x3d')]:undefined)||''},{'name':_0xc3f1('0x4d'),'value':_0x303c88[_0xc3f1('0x4d')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x7]?_0x303c88[_0xc3f1('0x3c')][0x7][_0xc3f1('0x3d')]:undefined)||''},{'name':_0xc3f1('0x4e'),'value':_0x303c88[_0xc3f1('0x4e')]||(_0x303c88['attrs']&&_0x303c88[_0xc3f1('0x3c')][0x8]?_0x303c88['attrs'][0x8][_0xc3f1('0x3d')]:undefined)||''},{'name':_0xc3f1('0x4f'),'value':_0x303c88[_0xc3f1('0x4f')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x9]?_0x303c88[_0xc3f1('0x3c')][0x9][_0xc3f1('0x3d')]:undefined)||''}];case'multibar-chart':case _0xc3f1('0x50'):return[{'name':_0xc3f1('0x51'),'value':_0x303c88['attrSerie1']||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x0]?_0x303c88[_0xc3f1('0x3c')][0x0][_0xc3f1('0x3d')]:undefined)||_0xc3f1('0x46')},{'name':'attrSerie2','value':_0x303c88[_0xc3f1('0x52')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x1]?_0x303c88[_0xc3f1('0x3c')][0x1][_0xc3f1('0x3d')]:undefined)||null},{'name':_0xc3f1('0x53'),'value':_0x303c88['attrSerie3']||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88['attrs'][0x2]?_0x303c88['attrs'][0x2][_0xc3f1('0x3d')]:undefined)||null},{'name':_0xc3f1('0x47'),'value':_0x303c88[_0xc3f1('0x47')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x3]?_0x303c88[_0xc3f1('0x3c')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x303c88[_0xc3f1('0x54')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88['attrs'][0x4]?_0x303c88[_0xc3f1('0x3c')][0x4][_0xc3f1('0x3d')]:undefined)||'voice'},{'name':_0xc3f1('0x4a'),'value':_0x303c88['attrEmailAccounts']||(_0x303c88['attrs']&&_0x303c88[_0xc3f1('0x3c')][0x5]?_0x303c88[_0xc3f1('0x3c')][0x5][_0xc3f1('0x3d')]:undefined)||''},{'name':_0xc3f1('0x4b'),'value':_0x303c88[_0xc3f1('0x4b')]||(_0x303c88['attrs']&&_0x303c88[_0xc3f1('0x3c')][0x6]?_0x303c88[_0xc3f1('0x3c')][0x6][_0xc3f1('0x3d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x303c88['attrSmsAccounts']||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88['attrs'][0x7]?_0x303c88['attrs'][0x7]['value']:undefined)||''},{'name':_0xc3f1('0x4d'),'value':_0x303c88[_0xc3f1('0x4d')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x8]?_0x303c88['attrs'][0x8][_0xc3f1('0x3d')]:undefined)||''},{'name':_0xc3f1('0x4e'),'value':_0x303c88[_0xc3f1('0x4e')]||(_0x303c88['attrs']&&_0x303c88['attrs'][0x9]?_0x303c88[_0xc3f1('0x3c')][0x9][_0xc3f1('0x3d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x303c88['attrChatWebsites']||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0xa]?_0x303c88['attrs'][0xa][_0xc3f1('0x3d')]:undefined)||''}];case _0xc3f1('0x55'):return[{'name':_0xc3f1('0x56'),'type':_0x303c88['reportType']||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x0]?_0x303c88[_0xc3f1('0x3c')][0x0]['type']:undefined)||null,'value':_0x303c88[_0xc3f1('0x56')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x0]?_0x303c88['attrs'][0x0][_0xc3f1('0x3d')]:undefined)||null},{'name':_0xc3f1('0x57'),'value':_0x303c88[_0xc3f1('0x57')]||(_0x303c88[_0xc3f1('0x3c')]&&_0x303c88[_0xc3f1('0x3c')][0x1]?_0x303c88[_0xc3f1('0x3c')][0x1][_0xc3f1('0x3d')]:undefined)||0x0}];default:return[];}}catch(_0x17ab2c){logger[_0xc3f1('0x26')]('widgetAttributes:\x20%s',JSON[_0xc3f1('0x58')](_0x17ab2c));return[];}}exports[_0xc3f1('0x59')]=function(_0x148d26,_0x4e683c){if(_0x148d26[_0xc3f1('0x5a')]){_0x148d26[_0xc3f1('0x5a')]['attrs']=widgetAttributes(_0x148d26['body']);}return db[_0xc3f1('0x2d')][_0xc3f1('0x59')](_0x148d26[_0xc3f1('0x5a')],{})[_0xc3f1('0x24')](respondWithResult(_0x4e683c,0xc9))[_0xc3f1('0x38')](handleError(_0x4e683c,null));};exports[_0xc3f1('0x23')]=function(_0x4aba64,_0x22b222){if(_0x4aba64[_0xc3f1('0x5a')]['id']){delete _0x4aba64[_0xc3f1('0x5a')]['id'];}_0x4aba64[_0xc3f1('0x5a')][_0xc3f1('0x3c')]=widgetAttributes(_0x4aba64[_0xc3f1('0x5a')]);return db[_0xc3f1('0x2d')][_0xc3f1('0x37')]({'where':{'id':_0x4aba64[_0xc3f1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x22b222,null))[_0xc3f1('0x24')](saveUpdates(_0x4aba64['body'],null))[_0xc3f1('0x24')](respondWithResult(_0x22b222,null))[_0xc3f1('0x38')](handleError(_0x22b222,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a11b01b..a7265d9 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 _0x5351=['events','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2ea9fd,_0x45d80b){var _0x27d18e=function(_0x20a0c9){while(--_0x20a0c9){_0x2ea9fd['push'](_0x2ea9fd['shift']());}};_0x27d18e(++_0x45d80b);}(_0x5351,0x140));var _0x1535=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5351[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x1535('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1535('0x1')](0x0);var events={'afterCreate':_0x1535('0x2'),'afterUpdate':'update','afterDestroy':_0x1535('0x3')};function emitEvent(_0xb286d){return function(_0x4f972f,_0x54d684,_0x5dbb8d){DashboardItemEvents[_0x1535('0x4')](_0xb286d+':'+_0x4f972f['id'],_0x4f972f);DashboardItemEvents[_0x1535('0x4')](_0xb286d,_0x4f972f);_0x5dbb8d(null);};}for(var e in events){if(events[_0x1535('0x5')](e)){var event=events[e];DashboardItem[_0x1535('0x6')](e,emitEvent(event));}}module[_0x1535('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x6ce3=['hasOwnProperty','hook','exports','save','emit'];(function(_0x4e5ee5,_0x1acb8a){var _0x3e5776=function(_0x418cb0){while(--_0x418cb0){_0x4e5ee5['push'](_0x4e5ee5['shift']());}};_0x3e5776(++_0x1acb8a);}(_0x6ce3,0xc1));var _0x36ce=function(_0x390fad,_0x1fef28){_0x390fad=_0x390fad-0x0;var _0x3effcd=_0x6ce3[_0x390fad];return _0x3effcd;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x36ce('0x0'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2fcdb5){return function(_0x611588,_0x4a5450,_0x488b42){DashboardItemEvents[_0x36ce('0x1')](_0x2fcdb5+':'+_0x611588['id'],_0x611588);DashboardItemEvents['emit'](_0x2fcdb5,_0x611588);_0x488b42(null);};}for(var e in events){if(events[_0x36ce('0x2')](e)){var event=events[e];DashboardItem[_0x36ce('0x3')](e,emitEvent(event));}}module[_0x36ce('0x4')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 7eb9b42..0307cfc 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 _0x4853=['path','rimraf','define','DashboardItem','dashboard_items','util','api','moment','bluebird','request-promise'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x4853,0x11d));var _0x3485=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4853[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x3485('0x0'));var logger=require('../../config/logger')(_0x3485('0x1'));var moment=require(_0x3485('0x2'));var BPromise=require(_0x3485('0x3'));var rp=require(_0x3485('0x4'));var fs=require('fs');var path=require(_0x3485('0x5'));var rimraf=require(_0x3485('0x6'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x249d2c,_0x7512e3){return _0x249d2c[_0x3485('0x7')](_0x3485('0x8'),attributes,{'tableName':_0x3485('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bff=['api','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','define','DashboardItem','lodash','../../config/logger'];(function(_0x15e024,_0x552471){var _0x5747d5=function(_0x596a5d){while(--_0x596a5d){_0x15e024['push'](_0x15e024['shift']());}};_0x5747d5(++_0x552471);}(_0x3bff,0xd0));var _0xf3bf=function(_0x4f95c5,_0x3d47c8){_0x4f95c5=_0x4f95c5-0x0;var _0x192ec2=_0x3bff[_0x4f95c5];return _0x192ec2;};'use strict';var _=require(_0xf3bf('0x0'));var util=require('util');var logger=require(_0xf3bf('0x1'))(_0xf3bf('0x2'));var moment=require('moment');var BPromise=require(_0xf3bf('0x3'));var rp=require(_0xf3bf('0x4'));var fs=require('fs');var path=require(_0xf3bf('0x5'));var rimraf=require(_0xf3bf('0x6'));var config=require('../../config/environment');var attributes=require(_0xf3bf('0x7'));module['exports']=function(_0x1eb3f2,_0x465b8d){return _0x1eb3f2[_0xf3bf('0x8')](_0xf3bf('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 3cb8c5b..f56038a 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 _0xd170=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x4d150a,_0x25f904){var _0x885bd4=function(_0x552a7d){while(--_0x552a7d){_0x4d150a['push'](_0x4d150a['shift']());}};_0x885bd4(++_0x25f904);}(_0xd170,0x1d0));var _0x0d17=function(_0x318666,_0x58de8f){_0x318666=_0x318666-0x0;var _0x251b10=_0xd170[_0x318666];return _0x251b10;};'use strict';var _=require('lodash');var util=require(_0x0d17('0x0'));var moment=require(_0x0d17('0x1'));var BPromise=require('bluebird');var rs=require(_0x0d17('0x2'));var fs=require('fs');var Redis=require(_0x0d17('0x3'));var db=require(_0x0d17('0x4'))['db'];var utils=require(_0x0d17('0x5'));var logger=require(_0x0d17('0x6'))(_0x0d17('0x7'));var config=require(_0x0d17('0x8'));var jayson=require(_0x0d17('0x9'));var client=jayson[_0x0d17('0xa')][_0x0d17('0xb')]({'port':0x232a});config['redis']=_[_0x0d17('0xc')](config[_0x0d17('0xd')],{'host':_0x0d17('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d17('0xd')]));require(_0x0d17('0xf'))[_0x0d17('0x10')](socket);function respondWithRpcPromise(_0x2b6156,_0x2ce4b2,_0xd7d5d9){return new BPromise(function(_0x2361a4,_0x1d1f02){return client[_0x0d17('0x11')](_0x2b6156,_0xd7d5d9)[_0x0d17('0x12')](function(_0x3aa383){logger[_0x0d17('0x13')](_0x0d17('0x14'),_0x2ce4b2,'request\x20sent');logger[_0x0d17('0x15')](_0x0d17('0x16'),_0x2ce4b2,_0x0d17('0x17'),JSON[_0x0d17('0x18')](_0x3aa383));if(_0x3aa383['error']){if(_0x3aa383['error']['code']===0x1f4){logger[_0x0d17('0x19')](_0x0d17('0x14'),_0x2ce4b2,_0x3aa383['error'][_0x0d17('0x1a')]);return _0x1d1f02(_0x3aa383[_0x0d17('0x19')][_0x0d17('0x1a')]);}logger[_0x0d17('0x19')](_0x0d17('0x14'),_0x2ce4b2,_0x3aa383[_0x0d17('0x19')]['message']);return _0x2361a4(_0x3aa383[_0x0d17('0x19')][_0x0d17('0x1a')]);}else{logger[_0x0d17('0x13')]('DashboardItem,\x20%s,\x20%s',_0x2ce4b2,_0x0d17('0x17'));_0x2361a4(_0x3aa383[_0x0d17('0x1b')][_0x0d17('0x1a')]);}})[_0x0d17('0x1c')](function(_0x50ccb9){logger[_0x0d17('0x19')]('DashboardItem,\x20%s,\x20%s',_0x2ce4b2,_0x50ccb9);_0x1d1f02(_0x50ccb9);});});} \ No newline at end of file +var _0x98b7=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x54229d,_0x3937cd){var _0x9b165e=function(_0x11f54a){while(--_0x11f54a){_0x54229d['push'](_0x54229d['shift']());}};_0x9b165e(++_0x3937cd);}(_0x98b7,0x127));var _0x798b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x98b7[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x798b('0x0'));var util=require('util');var moment=require(_0x798b('0x1'));var BPromise=require(_0x798b('0x2'));var rs=require(_0x798b('0x3'));var fs=require('fs');var Redis=require(_0x798b('0x4'));var db=require(_0x798b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x798b('0x6'))(_0x798b('0x7'));var config=require(_0x798b('0x8'));var jayson=require(_0x798b('0x9'));var client=jayson[_0x798b('0xa')][_0x798b('0xb')]({'port':0x232a});config[_0x798b('0xc')]=_[_0x798b('0xd')](config[_0x798b('0xc')],{'host':_0x798b('0xe'),'port':0x18eb});var socket=require(_0x798b('0xf'))(new Redis(config['redis']));require(_0x798b('0x10'))[_0x798b('0x11')](socket);function respondWithRpcPromise(_0x5e0582,_0x266b8e,_0x3f86a3){return new BPromise(function(_0x554b6a,_0x124686){return client[_0x798b('0x12')](_0x5e0582,_0x3f86a3)[_0x798b('0x13')](function(_0x3e5305){logger['info'](_0x798b('0x14'),_0x266b8e,_0x798b('0x15'));logger[_0x798b('0x16')](_0x798b('0x17'),_0x266b8e,'request\x20sent',JSON[_0x798b('0x18')](_0x3e5305));if(_0x3e5305['error']){if(_0x3e5305['error'][_0x798b('0x19')]===0x1f4){logger[_0x798b('0x1a')](_0x798b('0x14'),_0x266b8e,_0x3e5305[_0x798b('0x1a')][_0x798b('0x1b')]);return _0x124686(_0x3e5305['error'][_0x798b('0x1b')]);}logger['error'](_0x798b('0x14'),_0x266b8e,_0x3e5305[_0x798b('0x1a')][_0x798b('0x1b')]);return _0x554b6a(_0x3e5305[_0x798b('0x1a')]['message']);}else{logger[_0x798b('0x1c')](_0x798b('0x14'),_0x266b8e,_0x798b('0x15'));_0x554b6a(_0x3e5305[_0x798b('0x1d')]['message']);}})['catch'](function(_0x289cc3){logger[_0x798b('0x1a')](_0x798b('0x14'),_0x266b8e,_0x289cc3);_0x124686(_0x289cc3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 998e897..65d6875 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 _0xcfe5=['remove','update','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x154dd0,_0x393596){var _0x28d54f=function(_0x3addef){while(--_0x3addef){_0x154dd0['push'](_0x154dd0['shift']());}};_0x28d54f(++_0x393596);}(_0xcfe5,0x86));var _0x5cfe=function(_0x1e1e6c,_0x1100fd){_0x1e1e6c=_0x1e1e6c-0x0;var _0x3197d0=_0xcfe5[_0x1e1e6c];return _0x3197d0;};'use strict';var DashboardItemEvents=require(_0x5cfe('0x0'));var events=[_0x5cfe('0x1'),_0x5cfe('0x2'),_0x5cfe('0x3')];function createListener(_0x429669,_0x3f445f){return function(_0x419b57){_0x3f445f['emit'](_0x429669,_0x419b57);};}function removeListener(_0x560f29,_0x19a9ae){return function(){DashboardItemEvents[_0x5cfe('0x4')](_0x560f29,_0x19a9ae);};}exports[_0x5cfe('0x5')]=function(_0x6d1a85){for(var _0x3bc703=0x0,_0xa3eab1=events[_0x5cfe('0x6')];_0x3bc703<_0xa3eab1;_0x3bc703++){var _0xf7396f=events[_0x3bc703];var _0x1db38e=createListener(_0x5cfe('0x7')+_0xf7396f,_0x6d1a85);DashboardItemEvents['on'](_0xf7396f,_0x1db38e);}}; \ No newline at end of file +var _0x8541=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x21fcd1,_0x23bf21){var _0x9f3c46=function(_0x578b89){while(--_0x578b89){_0x21fcd1['push'](_0x21fcd1['shift']());}};_0x9f3c46(++_0x23bf21);}(_0x8541,0x1d7));var _0x1854=function(_0x3684d1,_0x465b86){_0x3684d1=_0x3684d1-0x0;var _0x236042=_0x8541[_0x3684d1];return _0x236042;};'use strict';var DashboardItemEvents=require(_0x1854('0x0'));var events=[_0x1854('0x1'),_0x1854('0x2'),_0x1854('0x3')];function createListener(_0x8272d2,_0x58ec53){return function(_0x462fb0){_0x58ec53[_0x1854('0x4')](_0x8272d2,_0x462fb0);};}function removeListener(_0x2700ac,_0x59f23e){return function(){DashboardItemEvents[_0x1854('0x5')](_0x2700ac,_0x59f23e);};}exports[_0x1854('0x6')]=function(_0x4fd11c){for(var _0x4aec5e=0x0,_0x38fa6=events[_0x1854('0x7')];_0x4aec5e<_0x38fa6;_0x4aec5e++){var _0x4f140b=events[_0x4aec5e];var _0x6e1666=createListener(_0x1854('0x8')+_0x4f140b,_0x4fd11c);DashboardItemEvents['on'](_0x4f140b,_0x6e1666);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 80ca958..64418a5 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 _0xf1a3=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0xf1a3,0x10a));var _0x3f1a=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0xf1a3[_0x5311e8];return _0x582ad8;};'use strict';var multer=require(_0x3f1a('0x0'));var util=require(_0x3f1a('0x1'));var path=require(_0x3f1a('0x2'));var timeout=require(_0x3f1a('0x3'));var express=require(_0x3f1a('0x4'));var router=express[_0x3f1a('0x5')]();var fs_extra=require(_0x3f1a('0x6'));var auth=require(_0x3f1a('0x7'));var interaction=require(_0x3f1a('0x8'));var config=require(_0x3f1a('0x9'));var controller=require('./dashboardItem.controller');router['get'](_0x3f1a('0xa'),auth[_0x3f1a('0xb')](),controller[_0x3f1a('0xc')]);router[_0x3f1a('0xd')]('/',auth['isAuthenticated'](),controller[_0x3f1a('0xe')]);router[_0x3f1a('0xf')](_0x3f1a('0xa'),auth[_0x3f1a('0xb')](),controller['update']);router['delete'](_0x3f1a('0xa'),auth[_0x3f1a('0xb')](),controller[_0x3f1a('0x10')]);module[_0x3f1a('0x11')]=router; \ No newline at end of file +var _0xf6d8=['Router','fs-extra','../../config/environment','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x3ec561,_0x3e1d4c){var _0x32957b=function(_0x375779){while(--_0x375779){_0x3ec561['push'](_0x3ec561['shift']());}};_0x32957b(++_0x3e1d4c);}(_0xf6d8,0x1ec));var _0x8f6d=function(_0x5e0869,_0x3e9e08){_0x5e0869=_0x5e0869-0x0;var _0x4648cf=_0xf6d8[_0x5e0869];return _0x4648cf;};'use strict';var multer=require('multer');var util=require(_0x8f6d('0x0'));var path=require(_0x8f6d('0x1'));var timeout=require(_0x8f6d('0x2'));var express=require(_0x8f6d('0x3'));var router=express[_0x8f6d('0x4')]();var fs_extra=require(_0x8f6d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8f6d('0x6'));var controller=require('./dashboardItem.controller');router['get']('/:id',auth[_0x8f6d('0x7')](),controller[_0x8f6d('0x8')]);router[_0x8f6d('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8f6d('0xa')](_0x8f6d('0xb'),auth[_0x8f6d('0x7')](),controller[_0x8f6d('0xc')]);router[_0x8f6d('0xd')]('/:id',auth[_0x8f6d('0x7')](),controller[_0x8f6d('0xe')]);module[_0x8f6d('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index e3780a4..2cbf8a5 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 _0x2ab1=['sequelize','exports','STRING','ENUM','second','third','first'];(function(_0x5b2cdd,_0x10cbce){var _0x98cd9b=function(_0x23be7c){while(--_0x23be7c){_0x5b2cdd['push'](_0x5b2cdd['shift']());}};_0x98cd9b(++_0x10cbce);}(_0x2ab1,0x134));var _0x12ab=function(_0x15728d,_0x41e08d){_0x15728d=_0x15728d-0x0;var _0x5d1d6d=_0x2ab1[_0x15728d];return _0x5d1d6d;};'use strict';var Sequelize=require(_0x12ab('0x0'));module[_0x12ab('0x1')]={'name':{'type':Sequelize[_0x12ab('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x12ab('0x3')]('first',_0x12ab('0x4'),_0x12ab('0x5')),'allowNull':![],'defaultValue':_0x12ab('0x6')},'description':{'type':Sequelize[_0x12ab('0x2')]}}; \ No newline at end of file +var _0x289c=['second','third','first','sequelize','exports','STRING','ENUM'];(function(_0x265c86,_0x180655){var _0x3cff61=function(_0x1c4cf6){while(--_0x1c4cf6){_0x265c86['push'](_0x265c86['shift']());}};_0x3cff61(++_0x180655);}(_0x289c,0x14c));var _0xc289=function(_0x49ff68,_0x1ef9e3){_0x49ff68=_0x49ff68-0x0;var _0x373207=_0x289c[_0x49ff68];return _0x373207;};'use strict';var Sequelize=require(_0xc289('0x0'));module[_0xc289('0x1')]={'name':{'type':Sequelize[_0xc289('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xc289('0x3')]('first',_0xc289('0x4'),_0xc289('0x5')),'allowNull':![],'defaultValue':_0xc289('0x6')},'description':{'type':Sequelize[_0xc289('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 31b5159..f7770af 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 _0xda11=['status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','name','send','index','map','Disposition','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','find','userProfileId','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x55f103,_0x35e964){var _0x32d0d8=function(_0x1a1e5d){while(--_0x1a1e5d){_0x55f103['push'](_0x55f103['shift']());}};_0x32d0d8(++_0x35e964);}(_0xda11,0x136));var _0x1da1=function(_0x587c8a,_0x208f9a){_0x587c8a=_0x587c8a-0x0;var _0x2cbbf6=_0xda11[_0x587c8a];return _0x2cbbf6;};'use strict';var emlformat=require(_0x1da1('0x0'));var rimraf=require(_0x1da1('0x1'));var zipdir=require(_0x1da1('0x2'));var jsonpatch=require(_0x1da1('0x3'));var rp=require(_0x1da1('0x4'));var moment=require('moment');var BPromise=require(_0x1da1('0x5'));var Mustache=require(_0x1da1('0x6'));var util=require(_0x1da1('0x7'));var path=require(_0x1da1('0x8'));var sox=require(_0x1da1('0x9'));var csv=require(_0x1da1('0xa'));var ejs=require(_0x1da1('0xb'));var fs=require('fs');var fs_extra=require(_0x1da1('0xc'));var _=require('lodash');var squel=require(_0x1da1('0xd'));var crypto=require(_0x1da1('0xe'));var jsforce=require(_0x1da1('0xf'));var deskjs=require(_0x1da1('0x10'));var toCsv=require(_0x1da1('0xa'));var querystring=require(_0x1da1('0x11'));var Papa=require(_0x1da1('0x12'));var Redis=require(_0x1da1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1da1('0x14'));var as=require(_0x1da1('0x15'));var hardwareService=require(_0x1da1('0x16'));var logger=require('../../config/logger')(_0x1da1('0x17'));var utils=require(_0x1da1('0x18'));var config=require(_0x1da1('0x19'));var licenseUtil=require(_0x1da1('0x1a'));var db=require(_0x1da1('0x1b'))['db'];function respondWithStatusCode(_0x2933bc,_0x1cfd2b){_0x1cfd2b=_0x1cfd2b||0xcc;return function(_0x28cb90){if(_0x28cb90){return _0x2933bc[_0x1da1('0x1c')](_0x1cfd2b);}return _0x2933bc['status'](_0x1cfd2b)[_0x1da1('0x1d')]();};}function respondWithResult(_0x2ca4c8,_0x564186){_0x564186=_0x564186||0xc8;return function(_0x455629){if(_0x455629){return _0x2ca4c8[_0x1da1('0x1e')](_0x564186)[_0x1da1('0x1f')](_0x455629);}};}function respondWithFilteredResult(_0x463c65,_0x462702){return function(_0x102f42){if(_0x102f42){var _0x529df9=typeof _0x462702[_0x1da1('0x20')]===_0x1da1('0x21')&&typeof _0x462702['limit']===_0x1da1('0x21');var _0x364210=_0x102f42[_0x1da1('0x22')];var _0xab5956=_0x529df9?0x0:_0x462702[_0x1da1('0x20')];var _0x5543cd=_0x529df9?_0x102f42[_0x1da1('0x22')]:_0x462702[_0x1da1('0x20')]+_0x462702[_0x1da1('0x23')];var _0x351bb4;if(_0x5543cd>=_0x364210){_0x5543cd=_0x364210;_0x351bb4=0xc8;}else{_0x351bb4=0xce;}_0x463c65[_0x1da1('0x1e')](_0x351bb4);return _0x463c65[_0x1da1('0x24')](_0x1da1('0x25'),_0xab5956+'-'+_0x5543cd+'/'+_0x364210)['json'](_0x102f42);}return null;};}function patchUpdates(_0x2104dd){return function(_0xa4609e){try{jsonpatch[_0x1da1('0x26')](_0xa4609e,_0x2104dd,!![]);}catch(_0x87d49a){return BPromise[_0x1da1('0x27')](_0x87d49a);}return _0xa4609e[_0x1da1('0x28')]();};}function saveUpdates(_0x3fa929,_0x29c988){return function(_0x33717e){if(_0x33717e){return _0x33717e[_0x1da1('0x29')](_0x3fa929)[_0x1da1('0x2a')](function(_0x4c0bdc){return _0x4c0bdc;});}return null;};}function removeEntity(_0x96d7bf,_0x1d534b){return function(_0x23643d){if(_0x23643d){return _0x23643d['destroy']()[_0x1da1('0x2a')](function(){var _0x1ba743=_0x23643d['get']({'plain':!![]});var _0x1451a5='Dispositions';return db[_0x1da1('0x2b')][_0x1da1('0x2c')]({'where':{'type':_0x1451a5,'resourceId':_0x1ba743['id']}})[_0x1da1('0x2a')](function(){return _0x23643d;});})[_0x1da1('0x2a')](function(){_0x96d7bf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38da6c,_0x4e0f4e){return function(_0x5e7341){if(!_0x5e7341){_0x38da6c[_0x1da1('0x1c')](0x194);}return _0x5e7341;};}function handleError(_0x5ca8d8,_0xcf76a2){_0xcf76a2=_0xcf76a2||0x1f4;return function(_0x33c749){logger['error'](_0x33c749['stack']);if(_0x33c749[_0x1da1('0x2d')]){delete _0x33c749['name'];}_0x5ca8d8[_0x1da1('0x1e')](_0xcf76a2)[_0x1da1('0x2e')](_0x33c749);};}exports[_0x1da1('0x2f')]=function(_0x5c2832,_0x32a963){var _0xc9d09c={},_0x45c7b1={},_0x25dfd8={'count':0x0,'rows':[]};var _0x2be9ab=_[_0x1da1('0x30')](db[_0x1da1('0x31')]['rawAttributes'],function(_0xc1ff4e){return{'name':_0xc1ff4e['fieldName'],'type':_0xc1ff4e[_0x1da1('0x32')]['key']};});_0x45c7b1['model']=_['map'](_0x2be9ab,_0x1da1('0x2d'));_0x45c7b1[_0x1da1('0x33')]=_[_0x1da1('0x34')](_0x5c2832[_0x1da1('0x33')]);_0x45c7b1[_0x1da1('0x35')]=_[_0x1da1('0x36')](_0x45c7b1[_0x1da1('0x37')],_0x45c7b1['query']);_0xc9d09c[_0x1da1('0x38')]=_['intersection'](_0x45c7b1['model'],qs['fields'](_0x5c2832[_0x1da1('0x33')][_0x1da1('0x39')]));_0xc9d09c['attributes']=_0xc9d09c['attributes'][_0x1da1('0x3a')]?_0xc9d09c[_0x1da1('0x38')]:_0x45c7b1[_0x1da1('0x37')];if(!_0x5c2832['query'][_0x1da1('0x3b')](_0x1da1('0x3c'))){_0xc9d09c[_0x1da1('0x23')]=qs[_0x1da1('0x23')](_0x5c2832[_0x1da1('0x33')]['limit']);_0xc9d09c[_0x1da1('0x20')]=qs[_0x1da1('0x20')](_0x5c2832['query']['offset']);}_0xc9d09c['order']=qs[_0x1da1('0x3d')](_0x5c2832[_0x1da1('0x33')][_0x1da1('0x3d')]);_0xc9d09c[_0x1da1('0x3e')]=qs[_0x1da1('0x35')](_[_0x1da1('0x3f')](_0x5c2832['query'],_0x45c7b1[_0x1da1('0x35')]),_0x2be9ab);if(_0x5c2832[_0x1da1('0x33')][_0x1da1('0x40')]){_0xc9d09c[_0x1da1('0x3e')]=_[_0x1da1('0x41')](_0xc9d09c[_0x1da1('0x3e')],{'$or':_['map'](_0x2be9ab,function(_0x54f85d){if(_0x54f85d[_0x1da1('0x32')]!==_0x1da1('0x42')){var _0x824243={};_0x824243[_0x54f85d[_0x1da1('0x2d')]]={'$like':'%'+_0x5c2832[_0x1da1('0x33')][_0x1da1('0x40')]+'%'};return _0x824243;}})});}_0xc9d09c=_[_0x1da1('0x41')]({},_0xc9d09c,_0x5c2832[_0x1da1('0x43')]);var _0x34e29c={'where':_0xc9d09c[_0x1da1('0x3e')]};return db[_0x1da1('0x31')][_0x1da1('0x22')](_0x34e29c)[_0x1da1('0x2a')](function(_0x4b5183){_0x25dfd8['count']=_0x4b5183;if(_0x5c2832['query']['includeAll']){_0xc9d09c[_0x1da1('0x44')]=[{'all':!![]}];}return db[_0x1da1('0x31')][_0x1da1('0x45')](_0xc9d09c);})[_0x1da1('0x2a')](function(_0x463a26){_0x25dfd8[_0x1da1('0x46')]=_0x463a26;return _0x25dfd8;})[_0x1da1('0x2a')](respondWithFilteredResult(_0x32a963,_0xc9d09c))[_0x1da1('0x47')](handleError(_0x32a963,null));};exports[_0x1da1('0x48')]=function(_0x1eebe1,_0x3443ea){var _0x5e78b1={'raw':!![],'where':{'id':_0x1eebe1[_0x1da1('0x49')]['id']}},_0x139bb3={};_0x139bb3['model']=_[_0x1da1('0x34')](db[_0x1da1('0x31')]['rawAttributes']);_0x139bb3[_0x1da1('0x33')]=_[_0x1da1('0x34')](_0x1eebe1[_0x1da1('0x33')]);_0x139bb3[_0x1da1('0x35')]=_[_0x1da1('0x36')](_0x139bb3[_0x1da1('0x37')],_0x139bb3[_0x1da1('0x33')]);_0x5e78b1[_0x1da1('0x38')]=_['intersection'](_0x139bb3['model'],qs[_0x1da1('0x39')](_0x1eebe1[_0x1da1('0x33')][_0x1da1('0x39')]));_0x5e78b1[_0x1da1('0x38')]=_0x5e78b1[_0x1da1('0x38')][_0x1da1('0x3a')]?_0x5e78b1['attributes']:_0x139bb3[_0x1da1('0x37')];if(_0x1eebe1[_0x1da1('0x33')][_0x1da1('0x4a')]){_0x5e78b1['include']=[{'all':!![]}];}_0x5e78b1=_[_0x1da1('0x41')]({},_0x5e78b1,_0x1eebe1[_0x1da1('0x43')]);return db['Disposition']['find'](_0x5e78b1)[_0x1da1('0x2a')](handleEntityNotFound(_0x3443ea,null))['then'](respondWithResult(_0x3443ea,null))['catch'](handleError(_0x3443ea,null));};exports['create']=function(_0x1ca042,_0x4afb44){return db[_0x1da1('0x31')]['create'](_0x1ca042[_0x1da1('0x4b')],{})[_0x1da1('0x2a')](function(_0x49c11d){var _0x4091fe=_0x1ca042[_0x1da1('0x4c')][_0x1da1('0x4d')]({'plain':!![]});if(!_0x4091fe)throw new Error(_0x1da1('0x4e'));if(_0x4091fe[_0x1da1('0x4f')]==='user'){var _0x2c5f84=_0x49c11d[_0x1da1('0x4d')]({'plain':!![]});var _0x258ef6=_0x1da1('0x50');return db[_0x1da1('0x51')][_0x1da1('0x52')]({'where':{'name':_0x258ef6,'userProfileId':_0x4091fe[_0x1da1('0x53')]},'raw':!![]})[_0x1da1('0x2a')](function(_0x514cef){if(_0x514cef&&_0x514cef['autoAssociation']===0x0){return db[_0x1da1('0x2b')]['create']({'name':_0x2c5f84['name'],'resourceId':_0x2c5f84['id'],'type':_0x514cef['name'],'sectionId':_0x514cef['id']},{})[_0x1da1('0x2a')](function(){return _0x49c11d;});}else{return _0x49c11d;}})[_0x1da1('0x47')](function(_0x513bd1){logger[_0x1da1('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x513bd1);throw _0x513bd1;});}return _0x49c11d;})['then'](respondWithResult(_0x4afb44,0xc9))[_0x1da1('0x47')](handleError(_0x4afb44,null));};exports['update']=function(_0x35d8d8,_0x32c6f5){if(_0x35d8d8['body']['id']){delete _0x35d8d8['body']['id'];}return db[_0x1da1('0x31')]['find']({'where':{'id':_0x35d8d8[_0x1da1('0x49')]['id']}})[_0x1da1('0x2a')](handleEntityNotFound(_0x32c6f5,null))['then'](saveUpdates(_0x35d8d8['body'],null))['then'](respondWithResult(_0x32c6f5,null))['catch'](handleError(_0x32c6f5,null));};exports[_0x1da1('0x2c')]=function(_0x61731b,_0x38f5cb){return db[_0x1da1('0x31')]['find']({'where':{'id':_0x61731b['params']['id']}})[_0x1da1('0x2a')](handleEntityNotFound(_0x38f5cb,null))['then'](removeEntity(_0x38f5cb,null))['catch'](handleError(_0x38f5cb,null));}; \ No newline at end of file +var _0x6746=['params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','then','get','UserProfileResource','error','stack','name','index','Disposition','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','length','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x5ee971,_0x345ce0){var _0x50f892=function(_0xd3a32b){while(--_0xd3a32b){_0x5ee971['push'](_0x5ee971['shift']());}};_0x50f892(++_0x345ce0);}(_0x6746,0xa9));var _0x6674=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x6746[_0x2bc3f4];return _0x14ac53;};'use strict';var emlformat=require(_0x6674('0x0'));var rimraf=require(_0x6674('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6674('0x2'));var moment=require(_0x6674('0x3'));var BPromise=require(_0x6674('0x4'));var Mustache=require(_0x6674('0x5'));var util=require(_0x6674('0x6'));var path=require(_0x6674('0x7'));var sox=require(_0x6674('0x8'));var csv=require(_0x6674('0x9'));var ejs=require(_0x6674('0xa'));var fs=require('fs');var fs_extra=require(_0x6674('0xb'));var _=require(_0x6674('0xc'));var squel=require(_0x6674('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6674('0xe'));var toCsv=require(_0x6674('0x9'));var querystring=require(_0x6674('0xf'));var Papa=require('papaparse');var Redis=require(_0x6674('0x10'));var authService=require(_0x6674('0x11'));var qs=require(_0x6674('0x12'));var as=require(_0x6674('0x13'));var hardwareService=require(_0x6674('0x14'));var logger=require(_0x6674('0x15'))(_0x6674('0x16'));var utils=require(_0x6674('0x17'));var config=require(_0x6674('0x18'));var licenseUtil=require(_0x6674('0x19'));var db=require(_0x6674('0x1a'))['db'];function respondWithStatusCode(_0x125a65,_0x8d469d){_0x8d469d=_0x8d469d||0xcc;return function(_0x4488d0){if(_0x4488d0){return _0x125a65[_0x6674('0x1b')](_0x8d469d);}return _0x125a65['status'](_0x8d469d)[_0x6674('0x1c')]();};}function respondWithResult(_0x442ce9,_0x50f96e){_0x50f96e=_0x50f96e||0xc8;return function(_0x451600){if(_0x451600){return _0x442ce9[_0x6674('0x1d')](_0x50f96e)[_0x6674('0x1e')](_0x451600);}};}function respondWithFilteredResult(_0x187dc9,_0x5c4ac7){return function(_0x50479d){if(_0x50479d){var _0x1e9807=typeof _0x5c4ac7[_0x6674('0x1f')]==='undefined'&&typeof _0x5c4ac7[_0x6674('0x20')]===_0x6674('0x21');var _0x46cd3c=_0x50479d[_0x6674('0x22')];var _0x22222f=_0x1e9807?0x0:_0x5c4ac7[_0x6674('0x1f')];var _0x28df51=_0x1e9807?_0x50479d['count']:_0x5c4ac7['offset']+_0x5c4ac7[_0x6674('0x20')];var _0xd1355f;if(_0x28df51>=_0x46cd3c){_0x28df51=_0x46cd3c;_0xd1355f=0xc8;}else{_0xd1355f=0xce;}_0x187dc9[_0x6674('0x1d')](_0xd1355f);return _0x187dc9[_0x6674('0x23')](_0x6674('0x24'),_0x22222f+'-'+_0x28df51+'/'+_0x46cd3c)[_0x6674('0x1e')](_0x50479d);}return null;};}function patchUpdates(_0x10b412){return function(_0x5b5d84){try{jsonpatch[_0x6674('0x25')](_0x5b5d84,_0x10b412,!![]);}catch(_0x2b61dc){return BPromise['reject'](_0x2b61dc);}return _0x5b5d84['save']();};}function saveUpdates(_0x56427f,_0x129d26){return function(_0x5172d0){if(_0x5172d0){return _0x5172d0[_0x6674('0x26')](_0x56427f)['then'](function(_0x4b21d8){return _0x4b21d8;});}return null;};}function removeEntity(_0x4c6ec5,_0x40edc3){return function(_0x5aa591){if(_0x5aa591){return _0x5aa591[_0x6674('0x27')]()[_0x6674('0x28')](function(){var _0x12553c=_0x5aa591[_0x6674('0x29')]({'plain':!![]});var _0xe8db15='Dispositions';return db[_0x6674('0x2a')][_0x6674('0x27')]({'where':{'type':_0xe8db15,'resourceId':_0x12553c['id']}})['then'](function(){return _0x5aa591;});})['then'](function(){_0x4c6ec5['status'](0xcc)[_0x6674('0x1c')]();});}};}function handleEntityNotFound(_0x16d4fa,_0x4abc63){return function(_0xc035bd){if(!_0xc035bd){_0x16d4fa[_0x6674('0x1b')](0x194);}return _0xc035bd;};}function handleError(_0x4b88f0,_0x5ca98c){_0x5ca98c=_0x5ca98c||0x1f4;return function(_0x55e2b7){logger[_0x6674('0x2b')](_0x55e2b7[_0x6674('0x2c')]);if(_0x55e2b7[_0x6674('0x2d')]){delete _0x55e2b7[_0x6674('0x2d')];}_0x4b88f0[_0x6674('0x1d')](_0x5ca98c)['send'](_0x55e2b7);};}exports[_0x6674('0x2e')]=function(_0x2a4498,_0x1b62ad){var _0x44b808={},_0x5f0e4e={},_0xf3f857={'count':0x0,'rows':[]};var _0x1187a9=_['map'](db[_0x6674('0x2f')][_0x6674('0x30')],function(_0x5861d7){return{'name':_0x5861d7[_0x6674('0x31')],'type':_0x5861d7[_0x6674('0x32')][_0x6674('0x33')]};});_0x5f0e4e['model']=_[_0x6674('0x34')](_0x1187a9,_0x6674('0x2d'));_0x5f0e4e[_0x6674('0x35')]=_[_0x6674('0x36')](_0x2a4498[_0x6674('0x35')]);_0x5f0e4e[_0x6674('0x37')]=_[_0x6674('0x38')](_0x5f0e4e[_0x6674('0x39')],_0x5f0e4e[_0x6674('0x35')]);_0x44b808[_0x6674('0x3a')]=_[_0x6674('0x38')](_0x5f0e4e[_0x6674('0x39')],qs[_0x6674('0x3b')](_0x2a4498['query'][_0x6674('0x3b')]));_0x44b808['attributes']=_0x44b808[_0x6674('0x3a')]['length']?_0x44b808[_0x6674('0x3a')]:_0x5f0e4e['model'];if(!_0x2a4498['query'][_0x6674('0x3c')]('nolimit')){_0x44b808[_0x6674('0x20')]=qs[_0x6674('0x20')](_0x2a4498['query']['limit']);_0x44b808['offset']=qs[_0x6674('0x1f')](_0x2a4498['query']['offset']);}_0x44b808[_0x6674('0x3d')]=qs[_0x6674('0x3e')](_0x2a4498[_0x6674('0x35')][_0x6674('0x3e')]);_0x44b808[_0x6674('0x3f')]=qs[_0x6674('0x37')](_[_0x6674('0x40')](_0x2a4498['query'],_0x5f0e4e[_0x6674('0x37')]),_0x1187a9);if(_0x2a4498[_0x6674('0x35')]['filter']){_0x44b808[_0x6674('0x3f')]=_[_0x6674('0x41')](_0x44b808[_0x6674('0x3f')],{'$or':_[_0x6674('0x34')](_0x1187a9,function(_0x18a9cc){if(_0x18a9cc[_0x6674('0x32')]!=='VIRTUAL'){var _0x10f320={};_0x10f320[_0x18a9cc['name']]={'$like':'%'+_0x2a4498[_0x6674('0x35')][_0x6674('0x42')]+'%'};return _0x10f320;}})});}_0x44b808=_[_0x6674('0x41')]({},_0x44b808,_0x2a4498[_0x6674('0x43')]);var _0x13e330={'where':_0x44b808[_0x6674('0x3f')]};return db['Disposition'][_0x6674('0x22')](_0x13e330)['then'](function(_0x4afb36){_0xf3f857['count']=_0x4afb36;if(_0x2a4498['query'][_0x6674('0x44')]){_0x44b808['include']=[{'all':!![]}];}return db[_0x6674('0x2f')][_0x6674('0x45')](_0x44b808);})[_0x6674('0x28')](function(_0x2da69d){_0xf3f857[_0x6674('0x46')]=_0x2da69d;return _0xf3f857;})[_0x6674('0x28')](respondWithFilteredResult(_0x1b62ad,_0x44b808))[_0x6674('0x47')](handleError(_0x1b62ad,null));};exports[_0x6674('0x48')]=function(_0x45fb67,_0x345dcb){var _0x36fd9a={'raw':!![],'where':{'id':_0x45fb67['params']['id']}},_0x2ef7c9={};_0x2ef7c9[_0x6674('0x39')]=_[_0x6674('0x36')](db[_0x6674('0x2f')][_0x6674('0x30')]);_0x2ef7c9[_0x6674('0x35')]=_['keys'](_0x45fb67[_0x6674('0x35')]);_0x2ef7c9[_0x6674('0x37')]=_[_0x6674('0x38')](_0x2ef7c9[_0x6674('0x39')],_0x2ef7c9[_0x6674('0x35')]);_0x36fd9a[_0x6674('0x3a')]=_['intersection'](_0x2ef7c9[_0x6674('0x39')],qs[_0x6674('0x3b')](_0x45fb67['query']['fields']));_0x36fd9a['attributes']=_0x36fd9a['attributes'][_0x6674('0x49')]?_0x36fd9a[_0x6674('0x3a')]:_0x2ef7c9[_0x6674('0x39')];if(_0x45fb67['query'][_0x6674('0x44')]){_0x36fd9a[_0x6674('0x4a')]=[{'all':!![]}];}_0x36fd9a=_[_0x6674('0x41')]({},_0x36fd9a,_0x45fb67[_0x6674('0x43')]);return db[_0x6674('0x2f')]['find'](_0x36fd9a)[_0x6674('0x28')](handleEntityNotFound(_0x345dcb,null))['then'](respondWithResult(_0x345dcb,null))[_0x6674('0x47')](handleError(_0x345dcb,null));};exports[_0x6674('0x4b')]=function(_0x4991aa,_0x122ea9){return db[_0x6674('0x2f')][_0x6674('0x4b')](_0x4991aa['body'],{})[_0x6674('0x28')](function(_0x44789b){var _0x14e005=_0x4991aa['user'][_0x6674('0x29')]({'plain':!![]});if(!_0x14e005)throw new Error(_0x6674('0x4c'));if(_0x14e005['role']===_0x6674('0x4d')){var _0x4cf746=_0x44789b[_0x6674('0x29')]({'plain':!![]});var _0x516107='Dispositions';return db[_0x6674('0x4e')][_0x6674('0x4f')]({'where':{'name':_0x516107,'userProfileId':_0x14e005[_0x6674('0x50')]},'raw':!![]})[_0x6674('0x28')](function(_0x5e6dec){if(_0x5e6dec&&_0x5e6dec['autoAssociation']===0x0){return db[_0x6674('0x2a')][_0x6674('0x4b')]({'name':_0x4cf746[_0x6674('0x2d')],'resourceId':_0x4cf746['id'],'type':_0x5e6dec[_0x6674('0x2d')],'sectionId':_0x5e6dec['id']},{})[_0x6674('0x28')](function(){return _0x44789b;});}else{return _0x44789b;}})[_0x6674('0x47')](function(_0xbb02d7){logger['error'](_0x6674('0x51'),_0xbb02d7);throw _0xbb02d7;});}return _0x44789b;})[_0x6674('0x28')](respondWithResult(_0x122ea9,0xc9))[_0x6674('0x47')](handleError(_0x122ea9,null));};exports[_0x6674('0x26')]=function(_0x436214,_0x40bbb5){if(_0x436214[_0x6674('0x52')]['id']){delete _0x436214[_0x6674('0x52')]['id'];}return db[_0x6674('0x2f')][_0x6674('0x4f')]({'where':{'id':_0x436214[_0x6674('0x53')]['id']}})[_0x6674('0x28')](handleEntityNotFound(_0x40bbb5,null))[_0x6674('0x28')](saveUpdates(_0x436214['body'],null))[_0x6674('0x28')](respondWithResult(_0x40bbb5,null))['catch'](handleError(_0x40bbb5,null));};exports['destroy']=function(_0x58fef3,_0xcad940){return db['Disposition'][_0x6674('0x4f')]({'where':{'id':_0x58fef3[_0x6674('0x53')]['id']}})[_0x6674('0x28')](handleEntityNotFound(_0xcad940,null))[_0x6674('0x28')](removeEntity(_0xcad940,null))[_0x6674('0x47')](handleError(_0xcad940,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ff949b5..cdfb39a 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 _0xd0d8=['name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','api','moment','bluebird','request-promise','path','./disposition.attributes','tools_dispositions','name_voice'];(function(_0x3c923d,_0x4c91d9){var _0x32f5a5=function(_0x23cba2){while(--_0x23cba2){_0x3c923d['push'](_0x3c923d['shift']());}};_0x32f5a5(++_0x4c91d9);}(_0xd0d8,0xa7));var _0x8d0d=function(_0x651909,_0x15c6b4){_0x651909=_0x651909-0x0;var _0x572299=_0xd0d8[_0x651909];return _0x572299;};'use strict';var _=require(_0x8d0d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8d0d('0x1'));var moment=require(_0x8d0d('0x2'));var BPromise=require(_0x8d0d('0x3'));var rp=require(_0x8d0d('0x4'));var fs=require('fs');var path=require(_0x8d0d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8d0d('0x6'));module['exports']=function(_0x3d7c31,_0x495669){return _0x3d7c31['define']('Disposition',attributes,{'tableName':_0x8d0d('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8d0d('0x8'),'fields':[_0x8d0d('0x9'),_0x8d0d('0xa')]},{'unique':!![],'name':_0x8d0d('0xb'),'fields':['name',_0x8d0d('0xc')]},{'unique':!![],'name':_0x8d0d('0xd'),'fields':[_0x8d0d('0x9'),_0x8d0d('0xe')]},{'unique':!![],'name':_0x8d0d('0xf'),'fields':['name',_0x8d0d('0x10')]},{'unique':!![],'name':'name_fax','fields':[_0x8d0d('0x9'),_0x8d0d('0x11')]},{'unique':!![],'name':_0x8d0d('0x12'),'fields':[_0x8d0d('0x9'),_0x8d0d('0x13')]},{'unique':!![],'name':_0x8d0d('0x14'),'fields':['name',_0x8d0d('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b92=['name','MailAccountId','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','ChatWebsiteId','name_mail'];(function(_0x1dee49,_0x5ada47){var _0x4a6515=function(_0x492502){while(--_0x492502){_0x1dee49['push'](_0x1dee49['shift']());}};_0x4a6515(++_0x5ada47);}(_0x5b92,0xb7));var _0x25b9=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x5b92[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x25b9('0x0'));var util=require('util');var logger=require(_0x25b9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x25b9('0x2'));var rp=require(_0x25b9('0x3'));var fs=require('fs');var path=require(_0x25b9('0x4'));var rimraf=require(_0x25b9('0x5'));var config=require(_0x25b9('0x6'));var attributes=require(_0x25b9('0x7'));module[_0x25b9('0x8')]=function(_0x128dac,_0x2df378){return _0x128dac[_0x25b9('0x9')](_0x25b9('0xa'),attributes,{'tableName':_0x25b9('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x25b9('0xc'),'fields':['name','ListId']},{'unique':!![],'name':'name_chat','fields':['name',_0x25b9('0xd')]},{'unique':!![],'name':_0x25b9('0xe'),'fields':[_0x25b9('0xf'),_0x25b9('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0x25b9('0xf'),_0x25b9('0x11')]},{'unique':!![],'name':_0x25b9('0x12'),'fields':[_0x25b9('0xf'),'FaxAccountId']},{'unique':!![],'name':_0x25b9('0x13'),'fields':[_0x25b9('0xf'),_0x25b9('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x25b9('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index da7d791..79fee3b 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(_0x27fced,_0x59d69c){var _0x3264d3=function(_0x383601){while(--_0x383601){_0x27fced['push'](_0x27fced['shift']());}};_0x3264d3(++_0x59d69c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x2afb1f,_0x4c2622){var _0x479bb8=function(_0x4b2e99){while(--_0x4b2e99){_0x2afb1f['push'](_0x2afb1f['shift']());}};_0x479bb8(++_0x4c2622);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 8cebb7a..a1a5c11 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 _0xfe36=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','/:id'];(function(_0x53d96a,_0x537fb8){var _0x4ef9d2=function(_0x37b5f7){while(--_0x37b5f7){_0x53d96a['push'](_0x53d96a['shift']());}};_0x4ef9d2(++_0x537fb8);}(_0xfe36,0x15c));var _0x6fe3=function(_0x2ba796,_0x5df69b){_0x2ba796=_0x2ba796-0x0;var _0x28850e=_0xfe36[_0x2ba796];return _0x28850e;};'use strict';var multer=require('multer');var util=require(_0x6fe3('0x0'));var path=require(_0x6fe3('0x1'));var timeout=require(_0x6fe3('0x2'));var express=require(_0x6fe3('0x3'));var router=express[_0x6fe3('0x4')]();var fs_extra=require(_0x6fe3('0x5'));var auth=require(_0x6fe3('0x6'));var interaction=require(_0x6fe3('0x7'));var config=require('../../config/environment');var controller=require(_0x6fe3('0x8'));router[_0x6fe3('0x9')]('/',auth[_0x6fe3('0xa')](),controller['index']);router[_0x6fe3('0x9')](_0x6fe3('0xb'),auth[_0x6fe3('0xa')](),controller[_0x6fe3('0xc')]);router[_0x6fe3('0xd')]('/',auth[_0x6fe3('0xa')](),controller[_0x6fe3('0xe')]);router[_0x6fe3('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6fe3('0x10')]);router[_0x6fe3('0x11')](_0x6fe3('0xb'),auth[_0x6fe3('0xa')](),controller[_0x6fe3('0x12')]);module[_0x6fe3('0x13')]=router; \ No newline at end of file +var _0xc2e2=['update','delete','destroy','exports','util','path','Router','../../config/environment','./disposition.controller','isAuthenticated','get','/:id','show','post','create','put'];(function(_0x5efc7f,_0x553a12){var _0x105d16=function(_0x5534fe){while(--_0x5534fe){_0x5efc7f['push'](_0x5efc7f['shift']());}};_0x105d16(++_0x553a12);}(_0xc2e2,0x194));var _0x2c2e=function(_0x2a745f,_0x917f1b){_0x2a745f=_0x2a745f-0x0;var _0x5b05d0=_0xc2e2[_0x2a745f];return _0x5b05d0;};'use strict';var multer=require('multer');var util=require(_0x2c2e('0x0'));var path=require(_0x2c2e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2c2e('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2c2e('0x3'));var controller=require(_0x2c2e('0x4'));router['get']('/',auth[_0x2c2e('0x5')](),controller['index']);router[_0x2c2e('0x6')](_0x2c2e('0x7'),auth[_0x2c2e('0x5')](),controller[_0x2c2e('0x8')]);router[_0x2c2e('0x9')]('/',auth[_0x2c2e('0x5')](),controller[_0x2c2e('0xa')]);router[_0x2c2e('0xb')]('/:id',auth[_0x2c2e('0x5')](),controller[_0x2c2e('0xc')]);router[_0x2c2e('0xd')](_0x2c2e('0x7'),auth[_0x2c2e('0x5')](),controller[_0x2c2e('0xe')]);module[_0x2c2e('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index b3e1d24..5f88bdb 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 _0x1aea=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI'];(function(_0x5c3eaf,_0xefd852){var _0x5ddade=function(_0x2cc62d){while(--_0x2cc62d){_0x5c3eaf['push'](_0x5c3eaf['shift']());}};_0x5ddade(++_0xefd852);}(_0x1aea,0x1d4));var _0xa1ae=function(_0x28f153,_0x4852ed){_0x28f153=_0x28f153-0x0;var _0x56b861=_0x1aea[_0x28f153];return _0x56b861;};'use strict';var Sequelize=require(_0xa1ae('0x0'));module[_0xa1ae('0x1')]={'name':{'type':Sequelize[_0xa1ae('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa1ae('0x2')]},'ecm':{'type':Sequelize[_0xa1ae('0x3')](_0xa1ae('0x4'),'no'),'defaultValue':_0xa1ae('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xa1ae('0x2')],'unique':_0xa1ae('0x5')},'minrate':{'type':Sequelize[_0xa1ae('0x3')](_0xa1ae('0x6'),_0xa1ae('0x7'),_0xa1ae('0x8'),_0xa1ae('0x9'),'12000',_0xa1ae('0xa')),'defaultValue':_0xa1ae('0x7')},'maxrate':{'type':Sequelize[_0xa1ae('0x3')](_0xa1ae('0x6'),_0xa1ae('0x7'),'7200',_0xa1ae('0x9'),'12000','14400'),'defaultValue':_0xa1ae('0xa')},'modem':{'type':Sequelize[_0xa1ae('0x2')],'defaultValue':_0xa1ae('0xb')},'gateway':{'type':Sequelize[_0xa1ae('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[_0xa1ae('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xa1ae('0xd'),_0xa1ae('0xe'),_0xa1ae('0xf'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xa1ae('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa1ae('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa1ae('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa1ae('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa1ae('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa1ae('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xa1ae('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xb346d6){if(!_0xb346d6)this[_0xa1ae('0x13')](_0xa1ae('0x14'),null);this[_0xa1ae('0x13')](_0xa1ae('0x15'),_0xb346d6);}}}; \ No newline at end of file +var _0xcd9f=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0xd5d6fd,_0x110e34){var _0x11be08=function(_0x167458){while(--_0x167458){_0xd5d6fd['push'](_0xd5d6fd['shift']());}};_0x11be08(++_0x110e34);}(_0xcd9f,0xe9));var _0xfcd9=function(_0xa0ea3a,_0x2ce499){_0xa0ea3a=_0xa0ea3a-0x0;var _0x220f1f=_0xcd9f[_0xa0ea3a];return _0x220f1f;};'use strict';var Sequelize=require(_0xfcd9('0x0'));module[_0xfcd9('0x1')]={'name':{'type':Sequelize[_0xfcd9('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xfcd9('0x3')](_0xfcd9('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xfcd9('0x2')],'defaultValue':_0xfcd9('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xfcd9('0x3')](_0xfcd9('0x6'),_0xfcd9('0x7'),_0xfcd9('0x8'),_0xfcd9('0x9'),'12000',_0xfcd9('0xa')),'defaultValue':_0xfcd9('0x7')},'maxrate':{'type':Sequelize[_0xfcd9('0x3')](_0xfcd9('0x6'),_0xfcd9('0x7'),'7200',_0xfcd9('0x9'),'12000',_0xfcd9('0xa')),'defaultValue':_0xfcd9('0xa')},'modem':{'type':Sequelize[_0xfcd9('0x2')],'defaultValue':_0xfcd9('0xb')},'gateway':{'type':Sequelize['STRING'],'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[_0xfcd9('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xfcd9('0x3')](_0xfcd9('0xd'),_0xfcd9('0xe'),_0xfcd9('0xf'),'KHOMP'),'defaultValue':_0xfcd9('0xd')},'key':{'type':Sequelize[_0xfcd9('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfcd9('0x10')],'defaultValue':function(){return _0xfcd9('0x11');}},'notificationSound':{'type':Sequelize[_0xfcd9('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfcd9('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfcd9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfcd9('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfcd9('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfcd9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfcd9('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xfcd9('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x227ce9){if(!_0x227ce9)this[_0xfcd9('0x14')](_0xfcd9('0x15'),null);this[_0xfcd9('0x14')](_0xfcd9('0x16'),_0x227ce9);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ee72219..7fe59d1 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 _0x6d2d=['FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','context','from-voip-provider','exten','app','type','description','Fax\x20Extension','priority','appdata','push','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','update','get','FaxAccounts','UserProfileResource','destroy','name','send','index','Pause','map','FaxAccount','rawAttributes','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','show','params','mandatoryDispositionPause','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','keys','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','addInteraction'];(function(_0x52ac8d,_0x5c8337){var _0x2aad15=function(_0x3cf6d7){while(--_0x3cf6d7){_0x52ac8d['push'](_0x52ac8d['shift']());}};_0x2aad15(++_0x5c8337);}(_0x6d2d,0x1e2));var _0xd6d2=function(_0x10ec47,_0x400ada){_0x10ec47=_0x10ec47-0x0;var _0x5c45bd=_0x6d2d[_0x10ec47];return _0x5c45bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6d2('0x0'));var zipdir=require(_0xd6d2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6d2('0x2'));var moment=require(_0xd6d2('0x3'));var BPromise=require(_0xd6d2('0x4'));var Mustache=require('mustache');var util=require(_0xd6d2('0x5'));var path=require(_0xd6d2('0x6'));var sox=require(_0xd6d2('0x7'));var csv=require('to-csv');var ejs=require(_0xd6d2('0x8'));var fs=require('fs');var fs_extra=require(_0xd6d2('0x9'));var _=require(_0xd6d2('0xa'));var squel=require('squel');var crypto=require(_0xd6d2('0xb'));var jsforce=require(_0xd6d2('0xc'));var deskjs=require(_0xd6d2('0xd'));var toCsv=require(_0xd6d2('0xe'));var querystring=require(_0xd6d2('0xf'));var Papa=require('papaparse');var Redis=require(_0xd6d2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd6d2('0x11'));var as=require(_0xd6d2('0x12'));var hardwareService=require(_0xd6d2('0x13'));var logger=require(_0xd6d2('0x14'))(_0xd6d2('0x15'));var utils=require(_0xd6d2('0x16'));var config=require(_0xd6d2('0x17'));var licenseUtil=require(_0xd6d2('0x18'));var db=require('../../mysqldb')['db'];config[_0xd6d2('0x19')]=_[_0xd6d2('0x1a')](config[_0xd6d2('0x19')],{'host':_0xd6d2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6d2('0x19')]));require('./faxAccount.socket')[_0xd6d2('0x1c')](socket);var jayson=require(_0xd6d2('0x1d'));var client=jayson[_0xd6d2('0x1e')][_0xd6d2('0x1f')]({'port':0x232c});var client9002=jayson[_0xd6d2('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363883,_0x54d9f1,_0x2d4c10,_0x557bc0){return new BPromise(function(_0x5e56bc,_0x3cd1af){var _0x41f8b5=_0x557bc0||client;return _0x41f8b5[_0xd6d2('0x20')](_0x363883,_0x2d4c10)[_0xd6d2('0x21')](function(_0xd64a71){logger[_0xd6d2('0x22')](_0xd6d2('0x23'),_0x54d9f1,'request\x20sent');logger[_0xd6d2('0x24')](_0xd6d2('0x25'),_0x54d9f1,'request\x20sent',JSON['stringify'](_0xd64a71));if(_0xd64a71['error']){if(_0xd64a71[_0xd6d2('0x26')][_0xd6d2('0x27')]===0x1f4){logger[_0xd6d2('0x26')](_0xd6d2('0x23'),_0x54d9f1,_0xd64a71[_0xd6d2('0x26')][_0xd6d2('0x28')]);return _0x3cd1af(_0xd64a71[_0xd6d2('0x26')][_0xd6d2('0x28')]);}logger[_0xd6d2('0x26')]('FaxAccount,\x20%s,\x20%s',_0x54d9f1,_0xd64a71['error'][_0xd6d2('0x28')]);return _0x5e56bc(_0xd64a71[_0xd6d2('0x26')]['message']);}else{logger[_0xd6d2('0x22')]('FaxAccount,\x20%s,\x20%s',_0x54d9f1,'request\x20sent');_0x5e56bc(_0xd64a71[_0xd6d2('0x29')][_0xd6d2('0x28')]);}})[_0xd6d2('0x2a')](function(_0x2a7dd2){logger[_0xd6d2('0x26')](_0xd6d2('0x23'),_0x54d9f1,_0x2a7dd2);_0x3cd1af(_0x2a7dd2);});});}function respondWithStatusCode(_0x4cae19,_0x5a90f4){_0x5a90f4=_0x5a90f4||0xcc;return function(_0x523eb3){if(_0x523eb3){return _0x4cae19[_0xd6d2('0x2b')](_0x5a90f4);}return _0x4cae19[_0xd6d2('0x2c')](_0x5a90f4)[_0xd6d2('0x2d')]();};}function respondWithResult(_0xa5b1ba,_0x4e94d3){_0x4e94d3=_0x4e94d3||0xc8;return function(_0x464beb){if(_0x464beb){return _0xa5b1ba[_0xd6d2('0x2c')](_0x4e94d3)[_0xd6d2('0x2e')](_0x464beb);}};}function respondWithFilteredResult(_0x20c466,_0x17c1e5){return function(_0x37c787){if(_0x37c787){var _0x15f9b4=typeof _0x17c1e5[_0xd6d2('0x2f')]===_0xd6d2('0x30')&&typeof _0x17c1e5[_0xd6d2('0x31')]==='undefined';var _0x4c2bdb=_0x37c787['count'];var _0x280ad0=_0x15f9b4?0x0:_0x17c1e5[_0xd6d2('0x2f')];var _0x23cfea=_0x15f9b4?_0x37c787['count']:_0x17c1e5[_0xd6d2('0x2f')]+_0x17c1e5[_0xd6d2('0x31')];var _0x184004;if(_0x23cfea>=_0x4c2bdb){_0x23cfea=_0x4c2bdb;_0x184004=0xc8;}else{_0x184004=0xce;}_0x20c466[_0xd6d2('0x2c')](_0x184004);return _0x20c466[_0xd6d2('0x32')](_0xd6d2('0x33'),_0x280ad0+'-'+_0x23cfea+'/'+_0x4c2bdb)[_0xd6d2('0x2e')](_0x37c787);}return null;};}function patchUpdates(_0x185408){return function(_0x236b1e){try{jsonpatch['apply'](_0x236b1e,_0x185408,!![]);}catch(_0x5d382c){return BPromise['reject'](_0x5d382c);}return _0x236b1e[_0xd6d2('0x34')]();};}function saveUpdates(_0x1cd745,_0x140479){return function(_0x4d53d8){if(_0x4d53d8){return _0x4d53d8[_0xd6d2('0x35')](_0x1cd745)['then'](function(_0xe9d62){return _0xe9d62;});}return null;};}function removeEntity(_0x4ab52c,_0x541fb6){return function(_0x337d7f){if(_0x337d7f){return _0x337d7f['destroy']()[_0xd6d2('0x21')](function(){var _0xe6a1dd=_0x337d7f[_0xd6d2('0x36')]({'plain':!![]});var _0x128b0a=_0xd6d2('0x37');return db[_0xd6d2('0x38')][_0xd6d2('0x39')]({'where':{'type':_0x128b0a,'resourceId':_0xe6a1dd['id']}})[_0xd6d2('0x21')](function(){return _0x337d7f;});})[_0xd6d2('0x21')](function(){_0x4ab52c[_0xd6d2('0x2c')](0xcc)[_0xd6d2('0x2d')]();});}};}function handleEntityNotFound(_0x2b5ea8,_0x9ce514){return function(_0x505952){if(!_0x505952){_0x2b5ea8['sendStatus'](0x194);}return _0x505952;};}function handleError(_0x2d26b6,_0xeccaef){_0xeccaef=_0xeccaef||0x1f4;return function(_0x47913c){logger['error'](_0x47913c['stack']);if(_0x47913c[_0xd6d2('0x3a')]){delete _0x47913c[_0xd6d2('0x3a')];}_0x2d26b6[_0xd6d2('0x2c')](_0xeccaef)[_0xd6d2('0x3b')](_0x47913c);};}exports[_0xd6d2('0x3c')]=function(_0x137893,_0x3dc374){var _0x3d06b2={'include':[{'model':db[_0xd6d2('0x3d')],'as':'mandatoryDispositionPause'}]},_0x11675b={},_0x2d0ba2={'count':0x0,'rows':[]};var _0x21124b=_[_0xd6d2('0x3e')](db[_0xd6d2('0x3f')][_0xd6d2('0x40')],function(_0xda7cdc){return{'name':_0xda7cdc['fieldName'],'type':_0xda7cdc['type'][_0xd6d2('0x41')]};});_0x11675b[_0xd6d2('0x42')]=_['map'](_0x21124b,_0xd6d2('0x3a'));_0x11675b['query']=_['keys'](_0x137893[_0xd6d2('0x43')]);_0x11675b[_0xd6d2('0x44')]=_['intersection'](_0x11675b[_0xd6d2('0x42')],_0x11675b[_0xd6d2('0x43')]);_0x3d06b2['attributes']=_[_0xd6d2('0x45')](_0x11675b[_0xd6d2('0x42')],qs[_0xd6d2('0x46')](_0x137893[_0xd6d2('0x43')][_0xd6d2('0x46')]));_0x3d06b2['attributes']=_0x3d06b2['attributes'][_0xd6d2('0x47')]?_0x3d06b2[_0xd6d2('0x48')]:_0x11675b['model'];if(!_0x137893[_0xd6d2('0x43')][_0xd6d2('0x49')]('nolimit')){_0x3d06b2[_0xd6d2('0x31')]=qs['limit'](_0x137893[_0xd6d2('0x43')][_0xd6d2('0x31')]);_0x3d06b2[_0xd6d2('0x2f')]=qs['offset'](_0x137893['query'][_0xd6d2('0x2f')]);}_0x3d06b2[_0xd6d2('0x4a')]=qs[_0xd6d2('0x4b')](_0x137893[_0xd6d2('0x43')]['sort']);_0x3d06b2[_0xd6d2('0x4c')]=qs[_0xd6d2('0x44')](_[_0xd6d2('0x4d')](_0x137893[_0xd6d2('0x43')],_0x11675b[_0xd6d2('0x44')]),_0x21124b);if(_0x137893[_0xd6d2('0x43')][_0xd6d2('0x4e')]){_0x3d06b2['where']=_[_0xd6d2('0x4f')](_0x3d06b2[_0xd6d2('0x4c')],{'$or':_['map'](_0x21124b,function(_0x22ece5){if(_0x22ece5['type']!==_0xd6d2('0x50')){var _0x425230={};_0x425230[_0x22ece5[_0xd6d2('0x3a')]]={'$like':'%'+_0x137893['query']['filter']+'%'};return _0x425230;}})});}_0x3d06b2=_[_0xd6d2('0x4f')]({},_0x3d06b2,_0x137893['options']);var _0x14f392={'where':_0x3d06b2[_0xd6d2('0x4c')]};return db[_0xd6d2('0x3f')][_0xd6d2('0x51')](_0x14f392)[_0xd6d2('0x21')](function(_0x4c447b){_0x2d0ba2[_0xd6d2('0x51')]=_0x4c447b;if(_0x137893['query'][_0xd6d2('0x52')]){_0x3d06b2['include']=[{'all':!![]}];}return db[_0xd6d2('0x3f')][_0xd6d2('0x53')](_0x3d06b2);})[_0xd6d2('0x21')](function(_0x417fe2){_0x2d0ba2[_0xd6d2('0x54')]=_0x417fe2;return _0x2d0ba2;})[_0xd6d2('0x21')](respondWithFilteredResult(_0x3dc374,_0x3d06b2))[_0xd6d2('0x2a')](handleError(_0x3dc374,null));};exports[_0xd6d2('0x55')]=function(_0x2fe5d1,_0x22ac3b){var _0x37d220={'raw':![],'where':{'id':_0x2fe5d1[_0xd6d2('0x56')]['id']},'include':[{'model':db[_0xd6d2('0x3d')],'as':_0xd6d2('0x57')}]},_0x2301eb={};_0x2301eb[_0xd6d2('0x42')]=_['keys'](db[_0xd6d2('0x3f')][_0xd6d2('0x40')]);_0x2301eb[_0xd6d2('0x43')]=_['keys'](_0x2fe5d1[_0xd6d2('0x43')]);_0x2301eb['filters']=_[_0xd6d2('0x45')](_0x2301eb['model'],_0x2301eb[_0xd6d2('0x43')]);_0x37d220['attributes']=_[_0xd6d2('0x45')](_0x2301eb[_0xd6d2('0x42')],qs['fields'](_0x2fe5d1[_0xd6d2('0x43')][_0xd6d2('0x46')]));_0x37d220[_0xd6d2('0x48')]=_0x37d220[_0xd6d2('0x48')][_0xd6d2('0x47')]?_0x37d220[_0xd6d2('0x48')]:_0x2301eb['model'];if(_0x2fe5d1[_0xd6d2('0x43')][_0xd6d2('0x52')]){_0x37d220[_0xd6d2('0x58')]=[{'all':!![]}];}_0x37d220=_[_0xd6d2('0x4f')]({},_0x37d220,_0x2fe5d1[_0xd6d2('0x59')]);return db['FaxAccount'][_0xd6d2('0x5a')](_0x37d220)['then'](handleEntityNotFound(_0x22ac3b,null))[_0xd6d2('0x21')](respondWithResult(_0x22ac3b,null))[_0xd6d2('0x2a')](handleError(_0x22ac3b,null));};exports['create']=function(_0x3d1536,_0x3cfdeb){return db[_0xd6d2('0x3f')][_0xd6d2('0x5b')](_0x3d1536[_0xd6d2('0x5c')],{})[_0xd6d2('0x21')](function(_0x4b32b3){var _0x30ea40=_0x3d1536['user'][_0xd6d2('0x36')]({'plain':!![]});if(!_0x30ea40)throw new Error(_0xd6d2('0x5d'));if(_0x30ea40['role']===_0xd6d2('0x5e')){var _0x190d5c=_0x4b32b3[_0xd6d2('0x36')]({'plain':!![]});var _0x49dcc7=_0xd6d2('0x37');return db[_0xd6d2('0x5f')][_0xd6d2('0x5a')]({'where':{'name':_0x49dcc7,'userProfileId':_0x30ea40[_0xd6d2('0x60')]},'raw':!![]})[_0xd6d2('0x21')](function(_0x40eb31){if(_0x40eb31&&_0x40eb31[_0xd6d2('0x61')]===0x0){return db[_0xd6d2('0x38')][_0xd6d2('0x5b')]({'name':_0x190d5c['name'],'resourceId':_0x190d5c['id'],'type':_0x40eb31['name'],'sectionId':_0x40eb31['id']},{})['then'](function(){return _0x4b32b3;});}else{return _0x4b32b3;}})[_0xd6d2('0x2a')](function(_0x3aaf0e){logger['error'](_0xd6d2('0x62'),_0x3aaf0e);throw _0x3aaf0e;});}return _0x4b32b3;})['then'](respondWithResult(_0x3cfdeb,0xc9))[_0xd6d2('0x2a')](handleError(_0x3cfdeb,null));};exports['update']=function(_0x442791,_0x39376a){if(_0x442791['body']['id']){delete _0x442791[_0xd6d2('0x5c')]['id'];}return db[_0xd6d2('0x3f')]['find']({'where':{'id':_0x442791[_0xd6d2('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xd6d2('0x57')}]})[_0xd6d2('0x21')](handleEntityNotFound(_0x39376a,null))[_0xd6d2('0x21')](saveUpdates(_0x442791[_0xd6d2('0x5c')],null))[_0xd6d2('0x21')](respondWithResult(_0x39376a,null))[_0xd6d2('0x2a')](handleError(_0x39376a,null));};exports[_0xd6d2('0x39')]=function(_0xa75bf9,_0x206457){return db['FaxAccount'][_0xd6d2('0x5a')]({'where':{'id':_0xa75bf9[_0xd6d2('0x56')]['id']}})[_0xd6d2('0x21')](handleEntityNotFound(_0x206457,null))[_0xd6d2('0x21')](removeEntity(_0x206457,null))[_0xd6d2('0x2a')](handleError(_0x206457,null));};exports[_0xd6d2('0x63')]=function(_0x3a27be,_0xdffa3b){return db[_0xd6d2('0x3f')]['describe']()[_0xd6d2('0x21')](respondWithResult(_0xdffa3b,null))[_0xd6d2('0x2a')](handleError(_0xdffa3b,null));};exports[_0xd6d2('0x64')]=function(_0x106132,_0x17c30b,_0x2bb821){if(_0x106132['body']['id']){delete _0x106132[_0xd6d2('0x5c')]['id'];}return db[_0xd6d2('0x3f')][_0xd6d2('0x5a')]({'where':{'id':_0x106132[_0xd6d2('0x56')]['id']}})[_0xd6d2('0x21')](handleEntityNotFound(_0x17c30b,null))['then'](function(_0xa3b7ac){if(_0xa3b7ac){_0x106132[_0xd6d2('0x5c')][_0xd6d2('0x65')]=_0xa3b7ac['id'];return db[_0xd6d2('0x66')]['create'](_0x106132[_0xd6d2('0x5c')]);}})[_0xd6d2('0x21')](respondWithResult(_0x17c30b,null))[_0xd6d2('0x2a')](handleError(_0x17c30b,null));};exports[_0xd6d2('0x67')]=function(_0x2dc5cc,_0x39410e,_0x55d751){var _0x2f5596={'raw':![],'where':{}};var _0x8d2a47={};var _0x5b6e2a={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd6d2('0x68')]({'where':{'id':_0x2dc5cc[_0xd6d2('0x56')]['id']}})['then'](handleEntityNotFound(_0x39410e,null))[_0xd6d2('0x21')](function(_0x1faf2d){if(_0x1faf2d){_0x8d2a47[_0xd6d2('0x42')]=_['keys'](db[_0xd6d2('0x66')][_0xd6d2('0x40')]);_0x8d2a47[_0xd6d2('0x43')]=_[_0xd6d2('0x69')](_0x2dc5cc[_0xd6d2('0x43')]);_0x8d2a47[_0xd6d2('0x44')]=_['intersection'](_0x8d2a47[_0xd6d2('0x42')],_0x8d2a47[_0xd6d2('0x43')]);_0x2f5596[_0xd6d2('0x48')]=_[_0xd6d2('0x45')](_0x8d2a47[_0xd6d2('0x42')],qs[_0xd6d2('0x46')](_0x2dc5cc[_0xd6d2('0x43')][_0xd6d2('0x46')]));_0x2f5596[_0xd6d2('0x48')]=_0x2f5596['attributes'][_0xd6d2('0x47')]?_0x2f5596[_0xd6d2('0x48')]:_0x8d2a47[_0xd6d2('0x42')];if(!_0x2dc5cc['query'][_0xd6d2('0x49')](_0xd6d2('0x6a'))){_0x2f5596[_0xd6d2('0x31')]=qs[_0xd6d2('0x31')](_0x2dc5cc[_0xd6d2('0x43')][_0xd6d2('0x31')]);_0x2f5596[_0xd6d2('0x2f')]=qs['offset'](_0x2dc5cc[_0xd6d2('0x43')]['offset']);}_0x2f5596['order']=qs[_0xd6d2('0x4b')](_0x2dc5cc[_0xd6d2('0x43')][_0xd6d2('0x4b')]);_0x2f5596['where']=qs[_0xd6d2('0x44')](_[_0xd6d2('0x4d')](_0x2dc5cc[_0xd6d2('0x43')],_0x8d2a47['filters']));_0x2f5596[_0xd6d2('0x4c')][_0xd6d2('0x65')]=_0x1faf2d['id'];if(_0x2dc5cc[_0xd6d2('0x43')][_0xd6d2('0x4e')]){_0x2f5596[_0xd6d2('0x4c')]=_[_0xd6d2('0x4f')](_0x2f5596[_0xd6d2('0x4c')],{'$or':_['map'](_0x2f5596[_0xd6d2('0x48')],function(_0x146994){var _0x26744e={};_0x26744e[_0x146994]={'$like':'%'+_0x2dc5cc[_0xd6d2('0x43')]['filter']+'%'};return _0x26744e;})});}_0x2f5596=_[_0xd6d2('0x4f')]({},_0x2f5596,_0x2dc5cc[_0xd6d2('0x59')]);return db[_0xd6d2('0x66')]['count']({'where':_0x2f5596[_0xd6d2('0x4c')]})['then'](function(_0x5b3ebd){_0x5b6e2a[_0xd6d2('0x51')]=_0x5b3ebd;if(_0x2dc5cc['query'][_0xd6d2('0x52')]){_0x2f5596[_0xd6d2('0x58')]=[{'all':!![]}];}return db[_0xd6d2('0x66')]['findAll'](_0x2f5596);})['then'](function(_0x4c1d93){_0x5b6e2a[_0xd6d2('0x54')]=_0x4c1d93;return _0x5b6e2a;});}})[_0xd6d2('0x21')](respondWithFilteredResult(_0x39410e,_0x2f5596))[_0xd6d2('0x2a')](handleError(_0x39410e,null));};exports[_0xd6d2('0x6b')]=function(_0x570b7b,_0x38d8ac,_0x9d5d12){return db['FaxAccount'][_0xd6d2('0x5a')]({'where':{'id':_0x570b7b[_0xd6d2('0x56')]['id']}})[_0xd6d2('0x21')](handleEntityNotFound(_0x38d8ac,null))[_0xd6d2('0x21')](function(_0x21b608){if(_0x21b608){return _0x21b608['removeDispositions'](_0x570b7b[_0xd6d2('0x43')][_0xd6d2('0x6c')]);}})[_0xd6d2('0x21')](respondWithStatusCode(_0x38d8ac,null))[_0xd6d2('0x2a')](handleError(_0x38d8ac,null));};exports[_0xd6d2('0x6d')]=function(_0x4d1a00,_0x4f9f56,_0x3323f6){if(_0x4d1a00[_0xd6d2('0x5c')]['id']){delete _0x4d1a00[_0xd6d2('0x5c')]['id'];}return db[_0xd6d2('0x3f')]['find']({'where':{'id':_0x4d1a00['params']['id']}})[_0xd6d2('0x21')](handleEntityNotFound(_0x4f9f56,null))[_0xd6d2('0x21')](function(_0x3812eb){if(_0x3812eb){_0x4d1a00[_0xd6d2('0x5c')][_0xd6d2('0x65')]=_0x3812eb['id'];return db[_0xd6d2('0x6e')][_0xd6d2('0x5b')](_0x4d1a00['body']);}})[_0xd6d2('0x21')](respondWithResult(_0x4f9f56,null))[_0xd6d2('0x2a')](handleError(_0x4f9f56,null));};exports['getAnswers']=function(_0x545a43,_0x4a90e0,_0x393559){var _0x2d425e={'raw':![],'where':{}};var _0x57992c={};var _0x46b27a={'count':0x0,'rows':[]};return db[_0xd6d2('0x3f')]['findOne']({'where':{'id':_0x545a43['params']['id']}})[_0xd6d2('0x21')](handleEntityNotFound(_0x4a90e0,null))[_0xd6d2('0x21')](function(_0x2b19c9){if(_0x2b19c9){_0x57992c[_0xd6d2('0x42')]=_[_0xd6d2('0x69')](db[_0xd6d2('0x6e')][_0xd6d2('0x40')]);_0x57992c[_0xd6d2('0x43')]=_[_0xd6d2('0x69')](_0x545a43[_0xd6d2('0x43')]);_0x57992c[_0xd6d2('0x44')]=_[_0xd6d2('0x45')](_0x57992c[_0xd6d2('0x42')],_0x57992c[_0xd6d2('0x43')]);_0x2d425e['attributes']=_[_0xd6d2('0x45')](_0x57992c[_0xd6d2('0x42')],qs[_0xd6d2('0x46')](_0x545a43['query'][_0xd6d2('0x46')]));_0x2d425e['attributes']=_0x2d425e[_0xd6d2('0x48')][_0xd6d2('0x47')]?_0x2d425e[_0xd6d2('0x48')]:_0x57992c[_0xd6d2('0x42')];if(!_0x545a43['query'][_0xd6d2('0x49')](_0xd6d2('0x6a'))){_0x2d425e[_0xd6d2('0x31')]=qs[_0xd6d2('0x31')](_0x545a43['query'][_0xd6d2('0x31')]);_0x2d425e[_0xd6d2('0x2f')]=qs[_0xd6d2('0x2f')](_0x545a43['query']['offset']);}_0x2d425e['order']=qs[_0xd6d2('0x4b')](_0x545a43[_0xd6d2('0x43')][_0xd6d2('0x4b')]);_0x2d425e[_0xd6d2('0x4c')]=qs[_0xd6d2('0x44')](_[_0xd6d2('0x4d')](_0x545a43[_0xd6d2('0x43')],_0x57992c['filters']));_0x2d425e[_0xd6d2('0x4c')]['FaxAccountId']=_0x2b19c9['id'];if(_0x545a43[_0xd6d2('0x43')]['filter']){_0x2d425e[_0xd6d2('0x4c')]=_[_0xd6d2('0x4f')](_0x2d425e['where'],{'$or':_['map'](_0x2d425e[_0xd6d2('0x48')],function(_0x37af64){var _0xde98ad={};_0xde98ad[_0x37af64]={'$like':'%'+_0x545a43[_0xd6d2('0x43')]['filter']+'%'};return _0xde98ad;})});}_0x2d425e=_[_0xd6d2('0x4f')]({},_0x2d425e,_0x545a43[_0xd6d2('0x59')]);return db[_0xd6d2('0x6e')][_0xd6d2('0x51')]({'where':_0x2d425e[_0xd6d2('0x4c')]})[_0xd6d2('0x21')](function(_0x11266d){_0x46b27a[_0xd6d2('0x51')]=_0x11266d;if(_0x545a43[_0xd6d2('0x43')]['includeAll']){_0x2d425e[_0xd6d2('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd6d2('0x53')](_0x2d425e);})['then'](function(_0xabc823){_0x46b27a[_0xd6d2('0x54')]=_0xabc823;return _0x46b27a;});}})[_0xd6d2('0x21')](respondWithFilteredResult(_0x4a90e0,_0x2d425e))[_0xd6d2('0x2a')](handleError(_0x4a90e0,null));};exports['removeAnswers']=function(_0x85973,_0x5d5188,_0x2d7da7){return db[_0xd6d2('0x3f')][_0xd6d2('0x5a')]({'where':{'id':_0x85973[_0xd6d2('0x56')]['id']}})[_0xd6d2('0x21')](handleEntityNotFound(_0x5d5188,null))[_0xd6d2('0x21')](function(_0x4a6668){if(_0x4a6668){return _0x4a6668['removeAnswers'](_0x85973[_0xd6d2('0x43')]['ids']);}})[_0xd6d2('0x21')](respondWithStatusCode(_0x5d5188,null))[_0xd6d2('0x2a')](handleError(_0x5d5188,null));};exports[_0xd6d2('0x6f')]=function(_0x22b1bc,_0x2e2a56,_0x5b6c51){return db[_0xd6d2('0x70')][_0xd6d2('0x5a')]({'where':{'id':_0x22b1bc[_0xd6d2('0x56')]['id']}})[_0xd6d2('0x21')](handleEntityNotFound(_0x2e2a56,null))[_0xd6d2('0x21')](function(_0xec165f){if(_0xec165f){return _0xec165f[_0xd6d2('0x6f')](_0x22b1bc[_0xd6d2('0x5c')][_0xd6d2('0x6c')],_[_0xd6d2('0x71')](_0x22b1bc[_0xd6d2('0x5c')],[_0xd6d2('0x6c'),'id'])||{});}})[_0xd6d2('0x21')](respondWithResult(_0x2e2a56,null))['catch'](handleError(_0x2e2a56,null));};exports[_0xd6d2('0x72')]=function(_0x18e6fd,_0x13fc57,_0x1a05c3){var _0x1bdf30={'raw':![],'where':{}};var _0x6fdfe3={};var _0x33f939={'count':0x0,'rows':[]};return db[_0xd6d2('0x3f')]['findOne']({'where':{'id':_0x18e6fd['params']['id']}})['then'](handleEntityNotFound(_0x13fc57,null))['then'](function(_0x4a00fb){if(_0x4a00fb){_0x6fdfe3[_0xd6d2('0x42')]=_['keys'](db[_0xd6d2('0x70')]['rawAttributes']);_0x6fdfe3[_0xd6d2('0x43')]=_[_0xd6d2('0x69')](_0x18e6fd['query']);_0x6fdfe3[_0xd6d2('0x44')]=_['intersection'](_0x6fdfe3['model'],_0x6fdfe3['query']);_0x1bdf30[_0xd6d2('0x48')]=_[_0xd6d2('0x45')](_0x6fdfe3[_0xd6d2('0x42')],qs['fields'](_0x18e6fd[_0xd6d2('0x43')][_0xd6d2('0x46')]));_0x1bdf30[_0xd6d2('0x48')]=_0x1bdf30[_0xd6d2('0x48')]['length']?_0x1bdf30['attributes']:_0x6fdfe3[_0xd6d2('0x42')];if(!_0x18e6fd[_0xd6d2('0x43')][_0xd6d2('0x49')](_0xd6d2('0x6a'))){_0x1bdf30['limit']=qs[_0xd6d2('0x31')](_0x18e6fd[_0xd6d2('0x43')]['limit']);_0x1bdf30[_0xd6d2('0x2f')]=qs[_0xd6d2('0x2f')](_0x18e6fd['query'][_0xd6d2('0x2f')]);}_0x1bdf30['order']=qs[_0xd6d2('0x4b')](_0x18e6fd['query'][_0xd6d2('0x4b')]);_0x1bdf30['where']=qs['filters'](_[_0xd6d2('0x4d')](_0x18e6fd[_0xd6d2('0x43')],_0x6fdfe3[_0xd6d2('0x44')]));_0x1bdf30[_0xd6d2('0x4c')][_0xd6d2('0x65')]=_0x4a00fb['id'];if(_0x18e6fd[_0xd6d2('0x43')][_0xd6d2('0x4e')]){_0x1bdf30[_0xd6d2('0x4c')]=_[_0xd6d2('0x4f')](_0x1bdf30['where'],{'$or':_[_0xd6d2('0x3e')](_0x1bdf30[_0xd6d2('0x48')],function(_0x7e6fa1){var _0x156850={};_0x156850[_0x7e6fa1]={'$like':'%'+_0x18e6fd[_0xd6d2('0x43')]['filter']+'%'};return _0x156850;})});}_0x1bdf30=_[_0xd6d2('0x4f')]({},_0x1bdf30,_0x18e6fd[_0xd6d2('0x59')]);return db[_0xd6d2('0x70')][_0xd6d2('0x51')]({'where':_0x1bdf30[_0xd6d2('0x4c')]})['then'](function(_0x499bcd){_0x33f939[_0xd6d2('0x51')]=_0x499bcd;if(_0x18e6fd['query'][_0xd6d2('0x52')]){_0x1bdf30['include']=[{'model':db[_0xd6d2('0x73')],'as':_0xd6d2('0x74'),'required':![]},{'model':db['User'],'as':_0xd6d2('0x75'),'attributes':[_0xd6d2('0x3a'),'fullname',_0xd6d2('0x76')],'required':![]},{'model':db[_0xd6d2('0x77')],'as':'Tags','attributes':['id',_0xd6d2('0x3a'),_0xd6d2('0x78')],'where':_0x18e6fd[_0xd6d2('0x43')][_0xd6d2('0x79')]?{'id':_0x18e6fd[_0xd6d2('0x43')][_0xd6d2('0x79')]}:undefined,'required':_0x18e6fd[_0xd6d2('0x43')][_0xd6d2('0x79')]?!![]:![]}];}return db['FaxInteraction'][_0xd6d2('0x53')](_0x1bdf30);})[_0xd6d2('0x21')](function(_0x49475f){_0x33f939['rows']=_0x49475f;return _0x33f939;});}})['then'](respondWithFilteredResult(_0x13fc57,_0x1bdf30))[_0xd6d2('0x2a')](handleError(_0x13fc57,null));};exports[_0xd6d2('0x7a')]=function(_0x53d082,_0x4f7435){var _0x5e3035=_0x53d082[_0xd6d2('0x56')]['id'];var _0x5c0d87=_0x53d082[_0xd6d2('0x5c')];var _0x5e86ca=0xc8;var _0x469067=null;return db[_0xd6d2('0x7b')][_0xd6d2('0x7c')]({'isolationLevel':db[_0xd6d2('0x7b')][_0xd6d2('0x7d')][_0xd6d2('0x7e')][_0xd6d2('0x7f')]},function(_0x2df896){return db['FaxAccount'][_0xd6d2('0x68')]({'where':{'id':_0x5e3035},'transaction':_0x2df896})[_0xd6d2('0x21')](function(_0x28bae9){if(_0x28bae9){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x5e3035},'transaction':_0x2df896})[_0xd6d2('0x21')](function(){var _0x165006=_[_0xd6d2('0x3e')](_0x5c0d87,function(_0x3ecad9){_0x3ecad9[_0xd6d2('0x65')]=_0x5e3035;return _0x3ecad9;});return db[_0xd6d2('0x80')][_0xd6d2('0x81')](_0x165006,{'transaction':_0x2df896});});}else{_0x5e86ca=0x194;_0x469067=[];}});})['then'](function(){if(_0x5e86ca!==0x194){return db[_0xd6d2('0x80')][_0xd6d2('0x82')]({'where':{'FaxAccountId':_0x5e3035},'order':'priority'})[_0xd6d2('0x21')](function(_0xf781e6){_0x469067=_0xf781e6;});}})['catch'](function(_0x5044df){_0x5e86ca=0x1f4;logger[_0xd6d2('0x26')](_0x5044df[_0xd6d2('0x83')]);if(_0x5044df[_0xd6d2('0x3a')]){delete _0x5044df[_0xd6d2('0x3a')];}_0x469067=_0x5044df;})[_0xd6d2('0x84')](function(){if(_0x469067===null){_0x4f7435[_0xd6d2('0x2b')](_0x5e86ca);}else{if(_0x5e86ca===0x1f4){_0x4f7435[_0xd6d2('0x2c')](_0x5e86ca)[_0xd6d2('0x3b')](_0x469067);}else{_0x4f7435[_0xd6d2('0x2c')](_0x5e86ca)[_0xd6d2('0x2e')](_0x469067);}}});};exports[_0xd6d2('0x85')]=function(_0x8d188b,_0xfd7fea,_0x49b04c){var _0x287d7a={};var _0x581808={};var _0x4e13ac;var _0x3de3a6;return db[_0xd6d2('0x3f')][_0xd6d2('0x68')]({'where':{'id':_0x8d188b['params']['id']}})[_0xd6d2('0x21')](handleEntityNotFound(_0xfd7fea,null))[_0xd6d2('0x21')](function(_0x9acd4a){if(_0x9acd4a){_0x4e13ac=_0x9acd4a;_0x581808['model']=_[_0xd6d2('0x69')](db['FaxApplication'][_0xd6d2('0x40')]);_0x581808['query']=_[_0xd6d2('0x69')](_0x8d188b[_0xd6d2('0x43')]);_0x581808[_0xd6d2('0x44')]=_[_0xd6d2('0x45')](_0x581808['model'],_0x581808[_0xd6d2('0x43')]);_0x287d7a[_0xd6d2('0x48')]=_[_0xd6d2('0x45')](_0x581808[_0xd6d2('0x42')],qs[_0xd6d2('0x46')](_0x8d188b[_0xd6d2('0x43')][_0xd6d2('0x46')]));_0x287d7a[_0xd6d2('0x48')]=_0x287d7a[_0xd6d2('0x48')][_0xd6d2('0x47')]?_0x287d7a['attributes']:_0x581808['model'];_0x287d7a['order']=qs['sort'](_0x8d188b['query'][_0xd6d2('0x4b')]);_0x287d7a[_0xd6d2('0x4c')]=qs[_0xd6d2('0x44')](_[_0xd6d2('0x4d')](_0x8d188b['query'],_0x581808[_0xd6d2('0x44')]));if(_0x8d188b[_0xd6d2('0x43')][_0xd6d2('0x4e')]){_0x287d7a[_0xd6d2('0x4c')]=_[_0xd6d2('0x4f')](_0x287d7a[_0xd6d2('0x4c')],{'$or':_[_0xd6d2('0x3e')](_0x287d7a['attributes'],function(_0x3daa26){var _0x2e7e92={};_0x2e7e92[_0x3daa26]={'$like':'%'+_0x8d188b[_0xd6d2('0x43')]['filter']+'%'};return _0x2e7e92;})});}_0x287d7a=_['merge']({},_0x287d7a,_0x8d188b['options']);return _0x4e13ac['getApplications'](_0x287d7a);}})['then'](function(_0x55bc89){if(_0x55bc89){_0x3de3a6=_0x55bc89[_0xd6d2('0x47')];if(!_0x8d188b[_0xd6d2('0x43')][_0xd6d2('0x49')](_0xd6d2('0x6a'))){_0x287d7a[_0xd6d2('0x31')]=qs[_0xd6d2('0x31')](_0x8d188b[_0xd6d2('0x43')][_0xd6d2('0x31')]);_0x287d7a[_0xd6d2('0x2f')]=qs[_0xd6d2('0x2f')](_0x8d188b[_0xd6d2('0x43')][_0xd6d2('0x2f')]);}return _0x4e13ac[_0xd6d2('0x85')](_0x287d7a);}})[_0xd6d2('0x21')](function(_0x576fd9){if(_0x576fd9){return _0x576fd9?{'count':_0x3de3a6,'rows':_0x576fd9}:null;}})[_0xd6d2('0x21')](respondWithResult(_0xfd7fea,null))[_0xd6d2('0x2a')](handleError(_0xfd7fea,null));};function Extension(_0x2057a9,_0x56905a,_0x2ef7fb,_0xd4a579){this[_0xd6d2('0x86')]=_0xd6d2('0x87');this[_0xd6d2('0x88')]=_0x2057a9['localstationid'];this[_0xd6d2('0x89')]=_0xd4a579;this[_0xd6d2('0x8a')]='system';this[_0xd6d2('0x8b')]=_0xd6d2('0x8c');this[_0xd6d2('0x65')]=_0x2057a9['id'];this[_0xd6d2('0x8d')]=_0x56905a;this[_0xd6d2('0x8e')]=_0x2ef7fb;}function createExtensionsReciveFax(_0x45d155){var _0x573885=0x1;var _0x3fa1f8=[];_0x3fa1f8[_0xd6d2('0x8f')](new Extension(_0x45d155,_0x573885,'','Answer'));_0x573885+=0x1;_0x3fa1f8['push'](new Extension(_0x45d155,_0x573885,_0xd6d2('0x90'),_0xd6d2('0x91')));_0x573885+=0x1;for(var _0x4691e7 in _0x45d155){if(_0x45d155[_0xd6d2('0x49')](_0x4691e7)&&(_0x4691e7===_0xd6d2('0x92')||_0x4691e7===_0xd6d2('0x93')||_0x4691e7===_0xd6d2('0x94')||_0x4691e7===_0xd6d2('0x95')||_0x4691e7==='headerinfo'||_0x4691e7==='maxrate'||_0x4691e7==='minrate'||_0x4691e7===_0xd6d2('0x96')||_0x4691e7===_0xd6d2('0x97'))){_0x3fa1f8[_0xd6d2('0x8f')](new Extension(_0x45d155,_0x573885,'FAXOPT('+_0x4691e7+')='+_0x45d155[_0x4691e7],_0xd6d2('0x91')));_0x573885+=0x1;}}_0x3fa1f8[_0xd6d2('0x8f')](new Extension(_0x45d155,_0x573885,'6',_0xd6d2('0x98')));_0x573885+=0x1;_0x3fa1f8[_0xd6d2('0x8f')](new Extension(_0x45d155,_0x573885,_0xd6d2('0x99'),_0xd6d2('0x9a')));_0x573885=0x0;return _0x3fa1f8;}exports['addAccountApplications']=function(_0x4bb91e,_0x551749,_0x56d6ff){var _0x57f099;return db[_0xd6d2('0x7b')][_0xd6d2('0x7c')](function(_0x1a62e4){return db[_0xd6d2('0x3f')][_0xd6d2('0x5b')](_0x4bb91e['body'],{'transaction':_0x1a62e4})[_0xd6d2('0x21')](function(_0x26057f){_0x57f099=_0x26057f['get']({'plain':!![]});return db['VoiceExtension'][_0xd6d2('0x81')](createExtensionsReciveFax(_0x57f099),{'transaction':_0x1a62e4});});})[_0xd6d2('0x21')](function(){return _0x57f099;})[_0xd6d2('0x21')](respondWithResult(_0x551749,null))['catch'](handleError(_0x551749,null));};exports[_0xd6d2('0x9b')]=function(_0x121990,_0x2dfc3d,_0x1c5441){var _0x3b01f1;return db['sequelize']['transaction'](function(_0x43a418){return db[_0xd6d2('0x3f')][_0xd6d2('0x35')](_0x121990[_0xd6d2('0x5c')],{'where':{'id':_0x121990[_0xd6d2('0x5c')]['id']},'transaction':_0x43a418})[_0xd6d2('0x21')](function(_0x158de4){return db['VoiceExtension'][_0xd6d2('0x39')]({'where':{'FaxAccountId':_0x121990['body']['id']},'transaction':_0x43a418})[_0xd6d2('0x21')](function(_0x363adf){return db[_0xd6d2('0x9c')][_0xd6d2('0x81')](createExtensionsReciveFax(_['omit'](_0x121990[_0xd6d2('0x5c')],[_0xd6d2('0x9d'),_0xd6d2('0x41'),_0xd6d2('0x9e'),_0xd6d2('0x9f'),_0xd6d2('0xa0'),_0xd6d2('0xa1')])),{'transaction':_0x43a418});});});})['then'](function(){return db[_0xd6d2('0x3f')][_0xd6d2('0xa2')](_0x121990[_0xd6d2('0x5c')]['id']);})[_0xd6d2('0x21')](respondWithResult(_0x2dfc3d,null))[_0xd6d2('0x2a')](handleError(_0x2dfc3d,null));};exports[_0xd6d2('0xa3')]=function(_0x2e334f,_0x3ba528,_0x16adbe){var _0x52e7a1={'raw':!![],'where':{}};var _0xc35626={};var _0x25e62a={'count':0x0,'rows':[]};return db[_0xd6d2('0x3f')]['findOne']({'where':{'id':_0x2e334f['params']['id']}})['then'](handleEntityNotFound(_0x3ba528,null))[_0xd6d2('0x21')](function(_0x465bba){if(_0x465bba){_0xc35626['model']=_['keys'](db[_0xd6d2('0xa4')][_0xd6d2('0x40')]);_0xc35626[_0xd6d2('0x43')]=_[_0xd6d2('0x69')](_0x2e334f['query']);_0xc35626[_0xd6d2('0x44')]=_[_0xd6d2('0x45')](_0xc35626[_0xd6d2('0x42')],_0xc35626[_0xd6d2('0x43')]);_0x52e7a1[_0xd6d2('0x48')]=_[_0xd6d2('0x45')](_0xc35626[_0xd6d2('0x42')],qs['fields'](_0x2e334f['query'][_0xd6d2('0x46')]));_0x52e7a1['attributes']=_0x52e7a1[_0xd6d2('0x48')]['length']?_0x52e7a1[_0xd6d2('0x48')]:_0xc35626[_0xd6d2('0x42')];if(!_0x2e334f[_0xd6d2('0x43')][_0xd6d2('0x49')](_0xd6d2('0x6a'))){_0x52e7a1[_0xd6d2('0x31')]=qs[_0xd6d2('0x31')](_0x2e334f[_0xd6d2('0x43')][_0xd6d2('0x31')]);_0x52e7a1[_0xd6d2('0x2f')]=qs[_0xd6d2('0x2f')](_0x2e334f[_0xd6d2('0x43')][_0xd6d2('0x2f')]);}_0x52e7a1[_0xd6d2('0x4a')]=qs[_0xd6d2('0x4b')](_0x2e334f['query']['sort']);_0x52e7a1['where']=qs[_0xd6d2('0x44')](_[_0xd6d2('0x4d')](_0x2e334f[_0xd6d2('0x43')],_0xc35626[_0xd6d2('0x44')]));_0x52e7a1[_0xd6d2('0x4c')][_0xd6d2('0x65')]=_0x465bba['id'];if(_0x2e334f[_0xd6d2('0x43')][_0xd6d2('0x4e')]){_0x52e7a1['where']=_[_0xd6d2('0x4f')](_0x52e7a1[_0xd6d2('0x4c')],{'$or':_[_0xd6d2('0x3e')](_0x52e7a1[_0xd6d2('0x48')],function(_0xf52b51){var _0x25ea0f={};_0x25ea0f[_0xf52b51]={'$like':'%'+_0x2e334f[_0xd6d2('0x43')]['filter']+'%'};return _0x25ea0f;})});}if(_0x2e334f['query'][_0xd6d2('0xa5')]){var _0x13d597=_0x2e334f['query'][_0xd6d2('0xa5')][_0xd6d2('0xa6')](',');var _0x3be13f={};_0x3be13f[_0x13d597[0x0]]={'$gte':moment(_0x13d597[0x1])[_0xd6d2('0xa7')](_0xd6d2('0xa8'))};_0x52e7a1['where']=_[_0xd6d2('0x4f')](_0x52e7a1[_0xd6d2('0x4c')],_0x3be13f);}_0x52e7a1=_[_0xd6d2('0x4f')]({},_0x52e7a1,_0x2e334f[_0xd6d2('0x59')]);return db['FaxMessage'][_0xd6d2('0x51')]({'where':_0x52e7a1['where']})[_0xd6d2('0x21')](function(_0x475d48){_0x25e62a[_0xd6d2('0x51')]=_0x475d48;if(_0x2e334f[_0xd6d2('0x43')][_0xd6d2('0x52')]){_0x52e7a1[_0xd6d2('0x58')]=[{'all':!![]}];}return db[_0xd6d2('0xa4')]['findAll'](_0x52e7a1);})[_0xd6d2('0x21')](function(_0x18754){_0x25e62a[_0xd6d2('0x54')]=_0x18754;return _0x25e62a;});}})[_0xd6d2('0x21')](respondWithFilteredResult(_0x3ba528,_0x52e7a1))[_0xd6d2('0x2a')](handleError(_0x3ba528,null));};exports['send']=function(_0x4ac143,_0x5099c6,_0x239c60){var _0x4607c7,_0x3f4c83={},_0x297974;if(_0x4ac143['body']['to']){_0x297974=_0x4ac143[_0xd6d2('0x5c')]['to'][0x0];}return db[_0xd6d2('0x3f')][_0xd6d2('0x5a')]({'where':{'id':_0x4ac143[_0xd6d2('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0xd6d2('0xa9'),'include':[{'model':db[_0xd6d2('0x73')],'as':_0xd6d2('0xaa'),'where':{'fax':_0x297974},'limit':0x1,'order':[[_0xd6d2('0x9f'),_0xd6d2('0xab')]]}]}]})[_0xd6d2('0x21')](handleEntityNotFound(_0x5099c6,null))[_0xd6d2('0x21')](function(_0x563783){_0x4607c7=_0x563783;if(_0x4ac143['body'][_0xd6d2('0xac')]&&_0x4ac143[_0xd6d2('0x5c')][_0xd6d2('0xac')]['length']){for(var _0x29d6c5=0x0;_0x29d6c5<_0x4ac143[_0xd6d2('0x5c')][_0xd6d2('0xac')][_0xd6d2('0x47')];_0x29d6c5+=0x1){_0x4ac143[_0xd6d2('0x5c')]['attachments'][_0x29d6c5]={'filename':_0x4ac143[_0xd6d2('0x5c')][_0xd6d2('0xac')][_0x29d6c5]['name'],'id':_0x4ac143['body'][_0xd6d2('0xac')][_0x29d6c5]['id'],'path':path['join'](config['root'],_0xd6d2('0xad'),_0x4ac143[_0xd6d2('0x5c')][_0xd6d2('0xac')][_0x29d6c5][_0xd6d2('0xae')])};}}return respondWithRpcPromise(_0xd6d2('0xaf'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x4ac143['params']['id'])?undefined:_0x4ac143[_0xd6d2('0x56')]['id'],'path':_[_0xd6d2('0xb0')](_0x4ac143['body'][_0xd6d2('0xac')][0x0][_0xd6d2('0x6')])?undefined:_0x4ac143[_0xd6d2('0x5c')][_0xd6d2('0xac')][0x0][_0xd6d2('0x6')],'fax':_[_0xd6d2('0xb0')](_0x4ac143[_0xd6d2('0x5c')]['to'][0x0])?undefined:_0x4ac143[_0xd6d2('0x5c')]['to'][0x0]},client9002);})[_0xd6d2('0x21')](function(){if(_0x4607c7){if(_['isNil'](_0x4ac143[_0xd6d2('0x5c')][_0xd6d2('0xb1')])){_0x4ac143[_0xd6d2('0x5c')][_0xd6d2('0xb1')]=util['format'](_0xd6d2('0xb2'),_0x4607c7[_0xd6d2('0x3a')],_0x4607c7['fax']);}if(_0x4607c7[_0xd6d2('0xa9')]){if(_0x4607c7[_0xd6d2('0xa9')][_0xd6d2('0xaa')][_0xd6d2('0x47')]){return _0x4607c7['List'][_0xd6d2('0xaa')][0x0];}else{return db['CmContact']['create'](_[_0xd6d2('0x1a')](_0x4ac143['body'],{'firstName':_0x4ac143['body']['to'][0x0],'phone':_0x4ac143['body']['to'][0x0],'fax':_0x4ac143[_0xd6d2('0x5c')]['to'][0x0],'ListId':_0x4607c7['ListId']}));}}else{throw new Error(_0xd6d2('0xb3'));}}else{throw new Error(_0xd6d2('0xb4'));}})[_0xd6d2('0x21')](function(_0x88136b){if(_0x88136b){return db['FaxInteraction']['find']({'where':{'ContactId':_0x88136b['id'],'closed':![],'FaxAccountId':_0x4607c7['id']}})[_0xd6d2('0x21')](function(_0x269535){if(_0x269535){return[_0x269535,![]];}return db[_0xd6d2('0x70')][_0xd6d2('0x5b')]({'UserId':_0x4ac143[_0xd6d2('0x5e')]['id'],'ContactId':_0x88136b['id'],'FaxAccountId':_0x4607c7['id'],'fax':_0x4ac143[_0xd6d2('0x5c')]['to'][0x0],'firstMsgDirection':_0xd6d2('0xb5'),'Messages':[_[_0xd6d2('0x4f')](_0x4ac143['body'],{'read':![],'body':_0x4ac143['body']['attachments'][0x0][_0xd6d2('0xb6')],'FaxAccountId':_0x4607c7['id'],'UserId':_0x4ac143[_0xd6d2('0x5e')]['id'],'ContactId':_0x88136b['id'],'AttachmentId':_0x4ac143['body'][_0xd6d2('0xac')][0x0]['id']})]},{'include':[{'model':db[_0xd6d2('0xa4')],'as':_0xd6d2('0xb7')}]})[_0xd6d2('0x21')](function(_0x54f195){return[_0x54f195,!![]];});});}else{throw new Error(_0xd6d2('0xb8'));}})['spread'](function(_0x3b4976,_0x48076f){if(_0x48076f){return _0x3b4976;}return db['FaxMessage'][_0xd6d2('0x5b')]({'direction':_0xd6d2('0xb5'),'read':![],'body':_0x4ac143[_0xd6d2('0x5c')][_0xd6d2('0xac')][0x0][_0xd6d2('0xb6')],'FaxAccountId':_0x4607c7['id'],'FaxInteractionId':_0x3b4976['id'],'UserId':_0x4ac143[_0xd6d2('0x5e')]['id'],'ContactId':_0x3b4976[_0xd6d2('0xb9')],'AttachmentId':_0x4ac143[_0xd6d2('0x5c')][_0xd6d2('0xac')][0x0]['id']})['then'](function(_0x5489f4){_0x3b4976['dataValues']['Messages']=[];_0x3b4976[_0xd6d2('0xba')][_0xd6d2('0xb7')]['push'](_0x5489f4[_0xd6d2('0xba')]);return _0x3b4976;});})['then'](function(_0x328ed8){respondWithRpcPromise(_0xd6d2('0xbb'),_0xd6d2('0xbb'),{'FaxAccountId':_['isNil'](_0x4ac143['params']['id'])?undefined:_0x4ac143[_0xd6d2('0x56')]['id'],'path':_[_0xd6d2('0xb0')](_0x4ac143['body'][_0xd6d2('0xac')][0x0]['path'])?undefined:_0x4ac143[_0xd6d2('0x5c')][_0xd6d2('0xac')][0x0][_0xd6d2('0x6')],'fax':_[_0xd6d2('0xb0')](_0x4ac143[_0xd6d2('0x5c')]['to'][0x0])?undefined:_0x4ac143[_0xd6d2('0x5c')]['to'][0x0],'AttachmentId':_0x4ac143[_0xd6d2('0x5c')][_0xd6d2('0xac')][0x0]['id']},client9002)[_0xd6d2('0x21')](function(_0x114277){logger[_0xd6d2('0x22')](_0xd6d2('0xbc'),_0x114277);})[_0xd6d2('0x2a')](function(_0x28b071){logger[_0xd6d2('0x22')](_0xd6d2('0xbc'),_0x28b071);});return _0x328ed8;})['then'](respondWithResult(_0x5099c6,null))[_0xd6d2('0x2a')](handleError(_0x5099c6,null));};exports[_0xd6d2('0xbd')]=function(_0x2d6711,_0x2c9398,_0x5989be){return db[_0xd6d2('0x3f')][_0xd6d2('0x5a')]({'where':{'id':_0x2d6711[_0xd6d2('0x56')]['id']}})[_0xd6d2('0x21')](handleEntityNotFound(_0x2c9398,null))[_0xd6d2('0x21')](function(_0x62eb71){if(_0x62eb71){return _0x62eb71[_0xd6d2('0xbd')](_0x2d6711[_0xd6d2('0x5c')]['ids'],_[_0xd6d2('0x71')](_0x2d6711['body'],[_0xd6d2('0x6c'),'id'])||{})[_0xd6d2('0xbe')](function(_0x3261b3){for(var _0x4a9248=0x0;_0x4a9248<_0x2d6711[_0xd6d2('0x5c')]['ids'][_0xd6d2('0x47')];_0x4a9248+=0x1){socket[_0xd6d2('0xbf')](_0xd6d2('0xc0'),{'UserId':Number(_0x2d6711[_0xd6d2('0x5c')][_0xd6d2('0x6c')][_0x4a9248]),'FaxAccountId':Number(_0x2d6711[_0xd6d2('0x56')]['id'])});}return _0x3261b3;});}})['then'](respondWithResult(_0x2c9398,null))['catch'](handleError(_0x2c9398,null));};exports[_0xd6d2('0xc1')]=function(_0x5b0a1e,_0x1d1154,_0x4e9da7){return db[_0xd6d2('0x3f')][_0xd6d2('0x5a')]({'where':{'id':_0x5b0a1e['params']['id']}})['then'](handleEntityNotFound(_0x1d1154,null))[_0xd6d2('0x21')](function(_0x10775a){if(_0x10775a){return _0x10775a['removeAgents'](_0x5b0a1e['query'][_0xd6d2('0x6c')])[_0xd6d2('0x21')](function(){if(_[_0xd6d2('0xc2')](_0x5b0a1e[_0xd6d2('0x43')][_0xd6d2('0x6c')])){for(var _0xf37ab7=0x0;_0xf37ab7<_0x5b0a1e[_0xd6d2('0x43')][_0xd6d2('0x6c')]['length'];_0xf37ab7+=0x1){socket[_0xd6d2('0xbf')](_0xd6d2('0xc3'),{'UserId':Number(_0x5b0a1e[_0xd6d2('0x43')][_0xd6d2('0x6c')][_0xf37ab7]),'FaxAccountId':Number(_0x5b0a1e['params']['id'])});}}else{socket[_0xd6d2('0xbf')](_0xd6d2('0xc3'),{'UserId':Number(_0x5b0a1e['query']['ids']),'FaxAccountId':Number(_0x5b0a1e['params']['id'])});}});}})[_0xd6d2('0x21')](respondWithStatusCode(_0x1d1154,null))[_0xd6d2('0x2a')](handleError(_0x1d1154,null));};exports[_0xd6d2('0xc4')]=function(_0x59b750,_0x8c63f,_0x16fd9c){var _0x340acb={};var _0x2bf93e={};var _0x2e5969;var _0x228d9d;return db['FaxAccount'][_0xd6d2('0x68')]({'where':{'id':_0x59b750['params']['id']}})[_0xd6d2('0x21')](handleEntityNotFound(_0x8c63f,null))[_0xd6d2('0x21')](function(_0x39344a){if(_0x39344a){_0x2e5969=_0x39344a;_0x2bf93e[_0xd6d2('0x42')]=_[_0xd6d2('0x69')](db[_0xd6d2('0xc5')][_0xd6d2('0x40')]);_0x2bf93e[_0xd6d2('0x43')]=_[_0xd6d2('0x69')](_0x59b750['query']);_0x2bf93e[_0xd6d2('0x44')]=_[_0xd6d2('0x45')](_0x2bf93e[_0xd6d2('0x42')],_0x2bf93e['query']);_0x340acb[_0xd6d2('0x48')]=_[_0xd6d2('0x45')](_0x2bf93e[_0xd6d2('0x42')],qs['fields'](_0x59b750[_0xd6d2('0x43')][_0xd6d2('0x46')]));_0x340acb[_0xd6d2('0x48')]=_0x340acb[_0xd6d2('0x48')]['length']?_0x340acb['attributes']:_0x2bf93e[_0xd6d2('0x42')];_0x340acb['order']=qs[_0xd6d2('0x4b')](_0x59b750[_0xd6d2('0x43')]['sort']);_0x340acb[_0xd6d2('0x4c')]=qs[_0xd6d2('0x44')](_[_0xd6d2('0x4d')](_0x59b750['query'],_0x2bf93e[_0xd6d2('0x44')]));if(_0x59b750['query'][_0xd6d2('0x4e')]){_0x340acb[_0xd6d2('0x4c')]=_['merge'](_0x340acb['where'],{'$or':_[_0xd6d2('0x3e')](_0x340acb[_0xd6d2('0x48')],function(_0x54b3d1){var _0x46f004={};_0x46f004[_0x54b3d1]={'$like':'%'+_0x59b750[_0xd6d2('0x43')][_0xd6d2('0x4e')]+'%'};return _0x46f004;})});}_0x340acb=_['merge']({},_0x340acb,_0x59b750[_0xd6d2('0x59')]);return _0x2e5969[_0xd6d2('0xc4')](_0x340acb);}})['then'](function(_0xe7a4eb){if(_0xe7a4eb){_0x228d9d=_0xe7a4eb[_0xd6d2('0x47')];if(!_0x59b750[_0xd6d2('0x43')][_0xd6d2('0x49')](_0xd6d2('0x6a'))){_0x340acb[_0xd6d2('0x31')]=qs[_0xd6d2('0x31')](_0x59b750[_0xd6d2('0x43')][_0xd6d2('0x31')]);_0x340acb[_0xd6d2('0x2f')]=qs[_0xd6d2('0x2f')](_0x59b750[_0xd6d2('0x43')][_0xd6d2('0x2f')]);}return _0x2e5969[_0xd6d2('0xc4')](_0x340acb);}})[_0xd6d2('0x21')](function(_0x4bc063){if(_0x4bc063){return _0x4bc063?{'count':_0x228d9d,'rows':_0x4bc063}:null;}})['then'](respondWithResult(_0x8c63f,null))[_0xd6d2('0x2a')](handleError(_0x8c63f,null));}; \ No newline at end of file +var _0x57f5=['addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','omit','FaxInteraction','CmContact','User','Owner','fullname','internal','Tags','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','priority','Answer','push','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','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','bulkCreate','updateAccountApplications','VoiceExtension','tech','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','undefined','count','Content-Range','save','destroy','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','FaxAccount','includeAll','include','findAll','rows','Pause','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','body','describe','addDisposition','FaxAccountId','Disposition','findOne','keys','nolimit','pick','removeDispositions','ids'];(function(_0x1a0251,_0x40a52e){var _0xfd94d1=function(_0x1c51c6){while(--_0x1c51c6){_0x1a0251['push'](_0x1a0251['shift']());}};_0xfd94d1(++_0x40a52e);}(_0x57f5,0x121));var _0x557f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x57f5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x557f('0x0'));var zipdir=require(_0x557f('0x1'));var jsonpatch=require(_0x557f('0x2'));var rp=require(_0x557f('0x3'));var moment=require(_0x557f('0x4'));var BPromise=require(_0x557f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x557f('0x6'));var sox=require('sox');var csv=require(_0x557f('0x7'));var ejs=require(_0x557f('0x8'));var fs=require('fs');var fs_extra=require(_0x557f('0x9'));var _=require(_0x557f('0xa'));var squel=require(_0x557f('0xb'));var crypto=require(_0x557f('0xc'));var jsforce=require(_0x557f('0xd'));var deskjs=require(_0x557f('0xe'));var toCsv=require(_0x557f('0x7'));var querystring=require(_0x557f('0xf'));var Papa=require(_0x557f('0x10'));var Redis=require(_0x557f('0x11'));var authService=require(_0x557f('0x12'));var qs=require(_0x557f('0x13'));var as=require(_0x557f('0x14'));var hardwareService=require(_0x557f('0x15'));var logger=require('../../config/logger')(_0x557f('0x16'));var utils=require(_0x557f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x557f('0x18'));var db=require('../../mysqldb')['db'];config[_0x557f('0x19')]=_[_0x557f('0x1a')](config[_0x557f('0x19')],{'host':_0x557f('0x1b'),'port':0x18eb});var socket=require(_0x557f('0x1c'))(new Redis(config['redis']));require(_0x557f('0x1d'))['register'](socket);var jayson=require(_0x557f('0x1e'));var client=jayson[_0x557f('0x1f')][_0x557f('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x557f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4340fc,_0x25f2ac,_0x5708d0,_0x49b60e){return new BPromise(function(_0x37a6cc,_0x379207){var _0xd8694e=_0x49b60e||client;return _0xd8694e[_0x557f('0x21')](_0x4340fc,_0x5708d0)[_0x557f('0x22')](function(_0x1a2e57){logger[_0x557f('0x23')](_0x557f('0x24'),_0x25f2ac,'request\x20sent');logger[_0x557f('0x25')](_0x557f('0x26'),_0x25f2ac,'request\x20sent',JSON[_0x557f('0x27')](_0x1a2e57));if(_0x1a2e57[_0x557f('0x28')]){if(_0x1a2e57[_0x557f('0x28')][_0x557f('0x29')]===0x1f4){logger['error'](_0x557f('0x24'),_0x25f2ac,_0x1a2e57[_0x557f('0x28')][_0x557f('0x2a')]);return _0x379207(_0x1a2e57['error'][_0x557f('0x2a')]);}logger[_0x557f('0x28')]('FaxAccount,\x20%s,\x20%s',_0x25f2ac,_0x1a2e57[_0x557f('0x28')][_0x557f('0x2a')]);return _0x37a6cc(_0x1a2e57[_0x557f('0x28')][_0x557f('0x2a')]);}else{logger[_0x557f('0x23')](_0x557f('0x24'),_0x25f2ac,'request\x20sent');_0x37a6cc(_0x1a2e57[_0x557f('0x2b')][_0x557f('0x2a')]);}})[_0x557f('0x2c')](function(_0x37648c){logger['error']('FaxAccount,\x20%s,\x20%s',_0x25f2ac,_0x37648c);_0x379207(_0x37648c);});});}function respondWithStatusCode(_0x5041a9,_0x35c99a){_0x35c99a=_0x35c99a||0xcc;return function(_0x12a2c5){if(_0x12a2c5){return _0x5041a9['sendStatus'](_0x35c99a);}return _0x5041a9[_0x557f('0x2d')](_0x35c99a)[_0x557f('0x2e')]();};}function respondWithResult(_0x53418c,_0x44e5ff){_0x44e5ff=_0x44e5ff||0xc8;return function(_0x46249a){if(_0x46249a){return _0x53418c[_0x557f('0x2d')](_0x44e5ff)[_0x557f('0x2f')](_0x46249a);}};}function respondWithFilteredResult(_0x1b1802,_0x52408a){return function(_0x8213e4){if(_0x8213e4){var _0x30d8f7=typeof _0x52408a[_0x557f('0x30')]==='undefined'&&typeof _0x52408a[_0x557f('0x31')]===_0x557f('0x32');var _0xa223e6=_0x8213e4[_0x557f('0x33')];var _0x33313a=_0x30d8f7?0x0:_0x52408a[_0x557f('0x30')];var _0x2ac5e8=_0x30d8f7?_0x8213e4[_0x557f('0x33')]:_0x52408a[_0x557f('0x30')]+_0x52408a['limit'];var _0x3a60fc;if(_0x2ac5e8>=_0xa223e6){_0x2ac5e8=_0xa223e6;_0x3a60fc=0xc8;}else{_0x3a60fc=0xce;}_0x1b1802[_0x557f('0x2d')](_0x3a60fc);return _0x1b1802['set'](_0x557f('0x34'),_0x33313a+'-'+_0x2ac5e8+'/'+_0xa223e6)['json'](_0x8213e4);}return null;};}function patchUpdates(_0x6c7733){return function(_0x5f1bd1){try{jsonpatch['apply'](_0x5f1bd1,_0x6c7733,!![]);}catch(_0x5851b9){return BPromise['reject'](_0x5851b9);}return _0x5f1bd1[_0x557f('0x35')]();};}function saveUpdates(_0x4f2852,_0x229c27){return function(_0x4dcba8){if(_0x4dcba8){return _0x4dcba8['update'](_0x4f2852)['then'](function(_0x2a1463){return _0x2a1463;});}return null;};}function removeEntity(_0x428f89,_0x4c63ad){return function(_0x55bb8d){if(_0x55bb8d){return _0x55bb8d[_0x557f('0x36')]()[_0x557f('0x22')](function(){var _0x5b5dc8=_0x55bb8d['get']({'plain':!![]});var _0xef1349=_0x557f('0x37');return db[_0x557f('0x38')][_0x557f('0x36')]({'where':{'type':_0xef1349,'resourceId':_0x5b5dc8['id']}})[_0x557f('0x22')](function(){return _0x55bb8d;});})['then'](function(){_0x428f89[_0x557f('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a9ef,_0x428d9d){return function(_0x3a950b){if(!_0x3a950b){_0x15a9ef[_0x557f('0x39')](0x194);}return _0x3a950b;};}function handleError(_0x5577dc,_0x5f4dc7){_0x5f4dc7=_0x5f4dc7||0x1f4;return function(_0x4f94ad){logger[_0x557f('0x28')](_0x4f94ad[_0x557f('0x3a')]);if(_0x4f94ad[_0x557f('0x3b')]){delete _0x4f94ad[_0x557f('0x3b')];}_0x5577dc[_0x557f('0x2d')](_0x5f4dc7)[_0x557f('0x3c')](_0x4f94ad);};}exports[_0x557f('0x3d')]=function(_0x1b75a5,_0x5d9aad){var _0x5c7f97={'include':[{'model':db['Pause'],'as':_0x557f('0x3e')}]},_0x20227f={},_0x18914f={'count':0x0,'rows':[]};var _0x3a50e6=_[_0x557f('0x3f')](db['FaxAccount'][_0x557f('0x40')],function(_0x47bc42){return{'name':_0x47bc42[_0x557f('0x41')],'type':_0x47bc42[_0x557f('0x42')][_0x557f('0x43')]};});_0x20227f['model']=_[_0x557f('0x3f')](_0x3a50e6,_0x557f('0x3b'));_0x20227f[_0x557f('0x44')]=_['keys'](_0x1b75a5[_0x557f('0x44')]);_0x20227f['filters']=_[_0x557f('0x45')](_0x20227f[_0x557f('0x46')],_0x20227f[_0x557f('0x44')]);_0x5c7f97[_0x557f('0x47')]=_[_0x557f('0x45')](_0x20227f[_0x557f('0x46')],qs[_0x557f('0x48')](_0x1b75a5[_0x557f('0x44')][_0x557f('0x48')]));_0x5c7f97[_0x557f('0x47')]=_0x5c7f97[_0x557f('0x47')][_0x557f('0x49')]?_0x5c7f97[_0x557f('0x47')]:_0x20227f[_0x557f('0x46')];if(!_0x1b75a5[_0x557f('0x44')][_0x557f('0x4a')]('nolimit')){_0x5c7f97[_0x557f('0x31')]=qs[_0x557f('0x31')](_0x1b75a5[_0x557f('0x44')][_0x557f('0x31')]);_0x5c7f97[_0x557f('0x30')]=qs[_0x557f('0x30')](_0x1b75a5[_0x557f('0x44')][_0x557f('0x30')]);}_0x5c7f97[_0x557f('0x4b')]=qs['sort'](_0x1b75a5['query'][_0x557f('0x4c')]);_0x5c7f97[_0x557f('0x4d')]=qs['filters'](_['pick'](_0x1b75a5['query'],_0x20227f[_0x557f('0x4e')]),_0x3a50e6);if(_0x1b75a5[_0x557f('0x44')][_0x557f('0x4f')]){_0x5c7f97[_0x557f('0x4d')]=_[_0x557f('0x50')](_0x5c7f97[_0x557f('0x4d')],{'$or':_['map'](_0x3a50e6,function(_0x1f2238){if(_0x1f2238[_0x557f('0x42')]!==_0x557f('0x51')){var _0x154d0e={};_0x154d0e[_0x1f2238[_0x557f('0x3b')]]={'$like':'%'+_0x1b75a5[_0x557f('0x44')][_0x557f('0x4f')]+'%'};return _0x154d0e;}})});}_0x5c7f97=_[_0x557f('0x50')]({},_0x5c7f97,_0x1b75a5[_0x557f('0x52')]);var _0x4139d5={'where':_0x5c7f97[_0x557f('0x4d')]};return db[_0x557f('0x53')][_0x557f('0x33')](_0x4139d5)[_0x557f('0x22')](function(_0x46ecd5){_0x18914f[_0x557f('0x33')]=_0x46ecd5;if(_0x1b75a5[_0x557f('0x44')][_0x557f('0x54')]){_0x5c7f97[_0x557f('0x55')]=[{'all':!![]}];}return db[_0x557f('0x53')][_0x557f('0x56')](_0x5c7f97);})[_0x557f('0x22')](function(_0x41a506){_0x18914f[_0x557f('0x57')]=_0x41a506;return _0x18914f;})[_0x557f('0x22')](respondWithFilteredResult(_0x5d9aad,_0x5c7f97))[_0x557f('0x2c')](handleError(_0x5d9aad,null));};exports['show']=function(_0x29a82b,_0x4d9085){var _0x3640b4={'raw':![],'where':{'id':_0x29a82b['params']['id']},'include':[{'model':db[_0x557f('0x58')],'as':_0x557f('0x3e')}]},_0x2fd488={};_0x2fd488[_0x557f('0x46')]=_['keys'](db[_0x557f('0x53')][_0x557f('0x40')]);_0x2fd488[_0x557f('0x44')]=_['keys'](_0x29a82b[_0x557f('0x44')]);_0x2fd488['filters']=_['intersection'](_0x2fd488[_0x557f('0x46')],_0x2fd488[_0x557f('0x44')]);_0x3640b4[_0x557f('0x47')]=_[_0x557f('0x45')](_0x2fd488[_0x557f('0x46')],qs[_0x557f('0x48')](_0x29a82b[_0x557f('0x44')]['fields']));_0x3640b4[_0x557f('0x47')]=_0x3640b4['attributes'][_0x557f('0x49')]?_0x3640b4['attributes']:_0x2fd488[_0x557f('0x46')];if(_0x29a82b[_0x557f('0x44')][_0x557f('0x54')]){_0x3640b4['include']=[{'all':!![]}];}_0x3640b4=_[_0x557f('0x50')]({},_0x3640b4,_0x29a82b['options']);return db[_0x557f('0x53')][_0x557f('0x59')](_0x3640b4)['then'](handleEntityNotFound(_0x4d9085,null))[_0x557f('0x22')](respondWithResult(_0x4d9085,null))[_0x557f('0x2c')](handleError(_0x4d9085,null));};exports['create']=function(_0x4478f1,_0x4d37ed){return db['FaxAccount'][_0x557f('0x5a')](_0x4478f1['body'],{})[_0x557f('0x22')](function(_0x102894){var _0xb351c8=_0x4478f1[_0x557f('0x5b')][_0x557f('0x5c')]({'plain':!![]});if(!_0xb351c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb351c8[_0x557f('0x5d')]==='user'){var _0x46ad79=_0x102894['get']({'plain':!![]});var _0x59bd87=_0x557f('0x37');return db[_0x557f('0x5e')][_0x557f('0x59')]({'where':{'name':_0x59bd87,'userProfileId':_0xb351c8[_0x557f('0x5f')]},'raw':!![]})[_0x557f('0x22')](function(_0x35a29b){if(_0x35a29b&&_0x35a29b[_0x557f('0x60')]===0x0){return db[_0x557f('0x38')][_0x557f('0x5a')]({'name':_0x46ad79['name'],'resourceId':_0x46ad79['id'],'type':_0x35a29b[_0x557f('0x3b')],'sectionId':_0x35a29b['id']},{})['then'](function(){return _0x102894;});}else{return _0x102894;}})[_0x557f('0x2c')](function(_0x358737){logger['error'](_0x557f('0x61'),_0x358737);throw _0x358737;});}return _0x102894;})[_0x557f('0x22')](respondWithResult(_0x4d37ed,0xc9))[_0x557f('0x2c')](handleError(_0x4d37ed,null));};exports[_0x557f('0x62')]=function(_0x2c93fa,_0x441ab9){if(_0x2c93fa['body']['id']){delete _0x2c93fa['body']['id'];}return db['FaxAccount'][_0x557f('0x59')]({'where':{'id':_0x2c93fa[_0x557f('0x63')]['id']},'include':[{'model':db[_0x557f('0x58')],'as':'mandatoryDispositionPause'}]})[_0x557f('0x22')](handleEntityNotFound(_0x441ab9,null))[_0x557f('0x22')](saveUpdates(_0x2c93fa[_0x557f('0x64')],null))[_0x557f('0x22')](respondWithResult(_0x441ab9,null))[_0x557f('0x2c')](handleError(_0x441ab9,null));};exports[_0x557f('0x36')]=function(_0x58a192,_0x2c5acc){return db[_0x557f('0x53')]['find']({'where':{'id':_0x58a192[_0x557f('0x63')]['id']}})[_0x557f('0x22')](handleEntityNotFound(_0x2c5acc,null))[_0x557f('0x22')](removeEntity(_0x2c5acc,null))[_0x557f('0x2c')](handleError(_0x2c5acc,null));};exports['describe']=function(_0x10aaff,_0x5375ba){return db[_0x557f('0x53')][_0x557f('0x65')]()[_0x557f('0x22')](respondWithResult(_0x5375ba,null))[_0x557f('0x2c')](handleError(_0x5375ba,null));};exports[_0x557f('0x66')]=function(_0x58005e,_0x21e7e2,_0x8244ab){if(_0x58005e[_0x557f('0x64')]['id']){delete _0x58005e[_0x557f('0x64')]['id'];}return db['FaxAccount'][_0x557f('0x59')]({'where':{'id':_0x58005e[_0x557f('0x63')]['id']}})['then'](handleEntityNotFound(_0x21e7e2,null))[_0x557f('0x22')](function(_0x4c9844){if(_0x4c9844){_0x58005e[_0x557f('0x64')][_0x557f('0x67')]=_0x4c9844['id'];return db[_0x557f('0x68')][_0x557f('0x5a')](_0x58005e[_0x557f('0x64')]);}})['then'](respondWithResult(_0x21e7e2,null))[_0x557f('0x2c')](handleError(_0x21e7e2,null));};exports['getDispositions']=function(_0x4ceca8,_0x47306d,_0x868fe3){var _0x208017={'raw':![],'where':{}};var _0x4fe8fb={};var _0xbadf82={'count':0x0,'rows':[]};return db[_0x557f('0x53')][_0x557f('0x69')]({'where':{'id':_0x4ceca8['params']['id']}})[_0x557f('0x22')](handleEntityNotFound(_0x47306d,null))['then'](function(_0x29efc7){if(_0x29efc7){_0x4fe8fb[_0x557f('0x46')]=_[_0x557f('0x6a')](db[_0x557f('0x68')][_0x557f('0x40')]);_0x4fe8fb[_0x557f('0x44')]=_[_0x557f('0x6a')](_0x4ceca8['query']);_0x4fe8fb[_0x557f('0x4e')]=_[_0x557f('0x45')](_0x4fe8fb[_0x557f('0x46')],_0x4fe8fb[_0x557f('0x44')]);_0x208017[_0x557f('0x47')]=_[_0x557f('0x45')](_0x4fe8fb[_0x557f('0x46')],qs['fields'](_0x4ceca8[_0x557f('0x44')]['fields']));_0x208017[_0x557f('0x47')]=_0x208017[_0x557f('0x47')][_0x557f('0x49')]?_0x208017[_0x557f('0x47')]:_0x4fe8fb['model'];if(!_0x4ceca8['query'][_0x557f('0x4a')](_0x557f('0x6b'))){_0x208017['limit']=qs['limit'](_0x4ceca8[_0x557f('0x44')][_0x557f('0x31')]);_0x208017[_0x557f('0x30')]=qs['offset'](_0x4ceca8[_0x557f('0x44')][_0x557f('0x30')]);}_0x208017[_0x557f('0x4b')]=qs['sort'](_0x4ceca8[_0x557f('0x44')][_0x557f('0x4c')]);_0x208017['where']=qs[_0x557f('0x4e')](_[_0x557f('0x6c')](_0x4ceca8[_0x557f('0x44')],_0x4fe8fb['filters']));_0x208017[_0x557f('0x4d')][_0x557f('0x67')]=_0x29efc7['id'];if(_0x4ceca8['query'][_0x557f('0x4f')]){_0x208017['where']=_['merge'](_0x208017[_0x557f('0x4d')],{'$or':_['map'](_0x208017[_0x557f('0x47')],function(_0x4509c6){var _0x39a695={};_0x39a695[_0x4509c6]={'$like':'%'+_0x4ceca8['query']['filter']+'%'};return _0x39a695;})});}_0x208017=_[_0x557f('0x50')]({},_0x208017,_0x4ceca8[_0x557f('0x52')]);return db[_0x557f('0x68')][_0x557f('0x33')]({'where':_0x208017[_0x557f('0x4d')]})[_0x557f('0x22')](function(_0x7b8fe3){_0xbadf82[_0x557f('0x33')]=_0x7b8fe3;if(_0x4ceca8[_0x557f('0x44')][_0x557f('0x54')]){_0x208017[_0x557f('0x55')]=[{'all':!![]}];}return db[_0x557f('0x68')][_0x557f('0x56')](_0x208017);})[_0x557f('0x22')](function(_0x2acfc4){_0xbadf82[_0x557f('0x57')]=_0x2acfc4;return _0xbadf82;});}})['then'](respondWithFilteredResult(_0x47306d,_0x208017))['catch'](handleError(_0x47306d,null));};exports[_0x557f('0x6d')]=function(_0x478acb,_0x371099,_0x4baa16){return db[_0x557f('0x53')][_0x557f('0x59')]({'where':{'id':_0x478acb['params']['id']}})[_0x557f('0x22')](handleEntityNotFound(_0x371099,null))['then'](function(_0x5004b8){if(_0x5004b8){return _0x5004b8[_0x557f('0x6d')](_0x478acb[_0x557f('0x44')][_0x557f('0x6e')]);}})['then'](respondWithStatusCode(_0x371099,null))['catch'](handleError(_0x371099,null));};exports[_0x557f('0x6f')]=function(_0x59d5de,_0x151c8b,_0x81a259){if(_0x59d5de[_0x557f('0x64')]['id']){delete _0x59d5de['body']['id'];}return db[_0x557f('0x53')][_0x557f('0x59')]({'where':{'id':_0x59d5de[_0x557f('0x63')]['id']}})['then'](handleEntityNotFound(_0x151c8b,null))[_0x557f('0x22')](function(_0xf6ef78){if(_0xf6ef78){_0x59d5de[_0x557f('0x64')]['FaxAccountId']=_0xf6ef78['id'];return db['CannedAnswer'][_0x557f('0x5a')](_0x59d5de['body']);}})['then'](respondWithResult(_0x151c8b,null))['catch'](handleError(_0x151c8b,null));};exports[_0x557f('0x70')]=function(_0xd3104,_0x1f27f2,_0x377ae4){var _0x3b922b={'raw':![],'where':{}};var _0x8a27fe={};var _0x6f6a95={'count':0x0,'rows':[]};return db['FaxAccount'][_0x557f('0x69')]({'where':{'id':_0xd3104[_0x557f('0x63')]['id']}})[_0x557f('0x22')](handleEntityNotFound(_0x1f27f2,null))[_0x557f('0x22')](function(_0x34e224){if(_0x34e224){_0x8a27fe[_0x557f('0x46')]=_[_0x557f('0x6a')](db[_0x557f('0x71')][_0x557f('0x40')]);_0x8a27fe[_0x557f('0x44')]=_[_0x557f('0x6a')](_0xd3104['query']);_0x8a27fe[_0x557f('0x4e')]=_['intersection'](_0x8a27fe[_0x557f('0x46')],_0x8a27fe[_0x557f('0x44')]);_0x3b922b[_0x557f('0x47')]=_['intersection'](_0x8a27fe[_0x557f('0x46')],qs[_0x557f('0x48')](_0xd3104[_0x557f('0x44')][_0x557f('0x48')]));_0x3b922b[_0x557f('0x47')]=_0x3b922b[_0x557f('0x47')][_0x557f('0x49')]?_0x3b922b[_0x557f('0x47')]:_0x8a27fe['model'];if(!_0xd3104['query'][_0x557f('0x4a')](_0x557f('0x6b'))){_0x3b922b[_0x557f('0x31')]=qs[_0x557f('0x31')](_0xd3104[_0x557f('0x44')][_0x557f('0x31')]);_0x3b922b['offset']=qs[_0x557f('0x30')](_0xd3104[_0x557f('0x44')]['offset']);}_0x3b922b['order']=qs[_0x557f('0x4c')](_0xd3104[_0x557f('0x44')][_0x557f('0x4c')]);_0x3b922b[_0x557f('0x4d')]=qs[_0x557f('0x4e')](_[_0x557f('0x6c')](_0xd3104['query'],_0x8a27fe['filters']));_0x3b922b[_0x557f('0x4d')][_0x557f('0x67')]=_0x34e224['id'];if(_0xd3104['query'][_0x557f('0x4f')]){_0x3b922b[_0x557f('0x4d')]=_[_0x557f('0x50')](_0x3b922b[_0x557f('0x4d')],{'$or':_[_0x557f('0x3f')](_0x3b922b[_0x557f('0x47')],function(_0x56a860){var _0x18cde7={};_0x18cde7[_0x56a860]={'$like':'%'+_0xd3104[_0x557f('0x44')]['filter']+'%'};return _0x18cde7;})});}_0x3b922b=_[_0x557f('0x50')]({},_0x3b922b,_0xd3104[_0x557f('0x52')]);return db['CannedAnswer'][_0x557f('0x33')]({'where':_0x3b922b['where']})[_0x557f('0x22')](function(_0x4873a4){_0x6f6a95[_0x557f('0x33')]=_0x4873a4;if(_0xd3104[_0x557f('0x44')]['includeAll']){_0x3b922b[_0x557f('0x55')]=[{'all':!![]}];}return db[_0x557f('0x71')][_0x557f('0x56')](_0x3b922b);})[_0x557f('0x22')](function(_0x33d451){_0x6f6a95[_0x557f('0x57')]=_0x33d451;return _0x6f6a95;});}})[_0x557f('0x22')](respondWithFilteredResult(_0x1f27f2,_0x3b922b))[_0x557f('0x2c')](handleError(_0x1f27f2,null));};exports[_0x557f('0x72')]=function(_0x26aab9,_0xd1213c,_0x3313c5){return db[_0x557f('0x53')]['find']({'where':{'id':_0x26aab9[_0x557f('0x63')]['id']}})[_0x557f('0x22')](handleEntityNotFound(_0xd1213c,null))[_0x557f('0x22')](function(_0x1b5e97){if(_0x1b5e97){return _0x1b5e97[_0x557f('0x72')](_0x26aab9[_0x557f('0x44')][_0x557f('0x6e')]);}})[_0x557f('0x22')](respondWithStatusCode(_0xd1213c,null))[_0x557f('0x2c')](handleError(_0xd1213c,null));};exports[_0x557f('0x73')]=function(_0x1439c9,_0x435402,_0x54ed43){return db['FaxInteraction']['find']({'where':{'id':_0x1439c9[_0x557f('0x63')]['id']}})[_0x557f('0x22')](handleEntityNotFound(_0x435402,null))[_0x557f('0x22')](function(_0x148e8f){if(_0x148e8f){return _0x148e8f[_0x557f('0x73')](_0x1439c9[_0x557f('0x64')]['ids'],_[_0x557f('0x74')](_0x1439c9[_0x557f('0x64')],[_0x557f('0x6e'),'id'])||{});}})[_0x557f('0x22')](respondWithResult(_0x435402,null))[_0x557f('0x2c')](handleError(_0x435402,null));};exports['getInteractions']=function(_0x3e2317,_0x3aaa78,_0x391467){var _0x55eb68={'raw':![],'where':{}};var _0x2e6c49={};var _0x710317={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3e2317[_0x557f('0x63')]['id']}})['then'](handleEntityNotFound(_0x3aaa78,null))['then'](function(_0x5c839a){if(_0x5c839a){_0x2e6c49[_0x557f('0x46')]=_[_0x557f('0x6a')](db[_0x557f('0x75')][_0x557f('0x40')]);_0x2e6c49[_0x557f('0x44')]=_['keys'](_0x3e2317[_0x557f('0x44')]);_0x2e6c49[_0x557f('0x4e')]=_[_0x557f('0x45')](_0x2e6c49[_0x557f('0x46')],_0x2e6c49['query']);_0x55eb68[_0x557f('0x47')]=_[_0x557f('0x45')](_0x2e6c49['model'],qs['fields'](_0x3e2317[_0x557f('0x44')][_0x557f('0x48')]));_0x55eb68[_0x557f('0x47')]=_0x55eb68[_0x557f('0x47')][_0x557f('0x49')]?_0x55eb68[_0x557f('0x47')]:_0x2e6c49[_0x557f('0x46')];if(!_0x3e2317[_0x557f('0x44')][_0x557f('0x4a')](_0x557f('0x6b'))){_0x55eb68['limit']=qs[_0x557f('0x31')](_0x3e2317[_0x557f('0x44')][_0x557f('0x31')]);_0x55eb68[_0x557f('0x30')]=qs[_0x557f('0x30')](_0x3e2317['query'][_0x557f('0x30')]);}_0x55eb68['order']=qs[_0x557f('0x4c')](_0x3e2317[_0x557f('0x44')][_0x557f('0x4c')]);_0x55eb68[_0x557f('0x4d')]=qs['filters'](_[_0x557f('0x6c')](_0x3e2317[_0x557f('0x44')],_0x2e6c49[_0x557f('0x4e')]));_0x55eb68[_0x557f('0x4d')][_0x557f('0x67')]=_0x5c839a['id'];if(_0x3e2317[_0x557f('0x44')][_0x557f('0x4f')]){_0x55eb68['where']=_['merge'](_0x55eb68[_0x557f('0x4d')],{'$or':_[_0x557f('0x3f')](_0x55eb68[_0x557f('0x47')],function(_0x52e329){var _0x54b104={};_0x54b104[_0x52e329]={'$like':'%'+_0x3e2317[_0x557f('0x44')]['filter']+'%'};return _0x54b104;})});}_0x55eb68=_['merge']({},_0x55eb68,_0x3e2317[_0x557f('0x52')]);return db[_0x557f('0x75')][_0x557f('0x33')]({'where':_0x55eb68[_0x557f('0x4d')]})[_0x557f('0x22')](function(_0x45bbe6){_0x710317[_0x557f('0x33')]=_0x45bbe6;if(_0x3e2317[_0x557f('0x44')][_0x557f('0x54')]){_0x55eb68[_0x557f('0x55')]=[{'model':db[_0x557f('0x76')],'as':'Contact','required':![]},{'model':db[_0x557f('0x77')],'as':_0x557f('0x78'),'attributes':[_0x557f('0x3b'),_0x557f('0x79'),_0x557f('0x7a')],'required':![]},{'model':db['Tag'],'as':_0x557f('0x7b'),'attributes':['id',_0x557f('0x3b'),'color'],'where':_0x3e2317['query'][_0x557f('0x7c')]?{'id':_0x3e2317[_0x557f('0x44')][_0x557f('0x7c')]}:undefined,'required':_0x3e2317[_0x557f('0x44')][_0x557f('0x7c')]?!![]:![]}];}return db[_0x557f('0x75')][_0x557f('0x56')](_0x55eb68);})['then'](function(_0x513577){_0x710317['rows']=_0x513577;return _0x710317;});}})[_0x557f('0x22')](respondWithFilteredResult(_0x3aaa78,_0x55eb68))[_0x557f('0x2c')](handleError(_0x3aaa78,null));};exports[_0x557f('0x7d')]=function(_0x1c6120,_0x2b4479){var _0x13d041=_0x1c6120[_0x557f('0x63')]['id'];var _0x1182bf=_0x1c6120['body'];var _0x59ef9f=0xc8;var _0x5e9b6f=null;return db[_0x557f('0x7e')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x557f('0x7f')][_0x557f('0x80')]},function(_0x36d1ef){return db['FaxAccount']['findOne']({'where':{'id':_0x13d041},'transaction':_0x36d1ef})[_0x557f('0x22')](function(_0x3b4da8){if(_0x3b4da8){return db[_0x557f('0x81')][_0x557f('0x36')]({'where':{'FaxAccountId':_0x13d041},'transaction':_0x36d1ef})[_0x557f('0x22')](function(){var _0x261ab4=_[_0x557f('0x3f')](_0x1182bf,function(_0x405d09){_0x405d09[_0x557f('0x67')]=_0x13d041;return _0x405d09;});return db[_0x557f('0x81')]['bulkCreate'](_0x261ab4,{'transaction':_0x36d1ef});});}else{_0x59ef9f=0x194;_0x5e9b6f=[];}});})[_0x557f('0x22')](function(){if(_0x59ef9f!==0x194){return db[_0x557f('0x81')][_0x557f('0x82')]({'where':{'FaxAccountId':_0x13d041},'order':'priority'})[_0x557f('0x22')](function(_0x5539c7){_0x5e9b6f=_0x5539c7;});}})[_0x557f('0x2c')](function(_0x57cb42){_0x59ef9f=0x1f4;logger[_0x557f('0x28')](_0x57cb42[_0x557f('0x3a')]);if(_0x57cb42[_0x557f('0x3b')]){delete _0x57cb42[_0x557f('0x3b')];}_0x5e9b6f=_0x57cb42;})[_0x557f('0x83')](function(){if(_0x5e9b6f===null){_0x2b4479['sendStatus'](_0x59ef9f);}else{if(_0x59ef9f===0x1f4){_0x2b4479['status'](_0x59ef9f)[_0x557f('0x3c')](_0x5e9b6f);}else{_0x2b4479[_0x557f('0x2d')](_0x59ef9f)['json'](_0x5e9b6f);}}});};exports[_0x557f('0x84')]=function(_0x45f3d1,_0x5d379d,_0x13f0d8){var _0x10acc7={};var _0x1f1b4e={};var _0x558a1d;var _0x5810a8;return db[_0x557f('0x53')][_0x557f('0x69')]({'where':{'id':_0x45f3d1['params']['id']}})['then'](handleEntityNotFound(_0x5d379d,null))['then'](function(_0x5b64ce){if(_0x5b64ce){_0x558a1d=_0x5b64ce;_0x1f1b4e[_0x557f('0x46')]=_[_0x557f('0x6a')](db['FaxApplication'][_0x557f('0x40')]);_0x1f1b4e[_0x557f('0x44')]=_[_0x557f('0x6a')](_0x45f3d1['query']);_0x1f1b4e[_0x557f('0x4e')]=_['intersection'](_0x1f1b4e[_0x557f('0x46')],_0x1f1b4e[_0x557f('0x44')]);_0x10acc7[_0x557f('0x47')]=_['intersection'](_0x1f1b4e['model'],qs[_0x557f('0x48')](_0x45f3d1[_0x557f('0x44')][_0x557f('0x48')]));_0x10acc7[_0x557f('0x47')]=_0x10acc7[_0x557f('0x47')][_0x557f('0x49')]?_0x10acc7['attributes']:_0x1f1b4e[_0x557f('0x46')];_0x10acc7[_0x557f('0x4b')]=qs[_0x557f('0x4c')](_0x45f3d1[_0x557f('0x44')][_0x557f('0x4c')]);_0x10acc7[_0x557f('0x4d')]=qs[_0x557f('0x4e')](_['pick'](_0x45f3d1[_0x557f('0x44')],_0x1f1b4e['filters']));if(_0x45f3d1[_0x557f('0x44')]['filter']){_0x10acc7[_0x557f('0x4d')]=_[_0x557f('0x50')](_0x10acc7[_0x557f('0x4d')],{'$or':_[_0x557f('0x3f')](_0x10acc7['attributes'],function(_0x2166be){var _0x5b6330={};_0x5b6330[_0x2166be]={'$like':'%'+_0x45f3d1[_0x557f('0x44')][_0x557f('0x4f')]+'%'};return _0x5b6330;})});}_0x10acc7=_[_0x557f('0x50')]({},_0x10acc7,_0x45f3d1[_0x557f('0x52')]);return _0x558a1d[_0x557f('0x84')](_0x10acc7);}})['then'](function(_0x47613e){if(_0x47613e){_0x5810a8=_0x47613e[_0x557f('0x49')];if(!_0x45f3d1[_0x557f('0x44')]['hasOwnProperty'](_0x557f('0x6b'))){_0x10acc7[_0x557f('0x31')]=qs[_0x557f('0x31')](_0x45f3d1['query'][_0x557f('0x31')]);_0x10acc7['offset']=qs['offset'](_0x45f3d1[_0x557f('0x44')]['offset']);}return _0x558a1d[_0x557f('0x84')](_0x10acc7);}})[_0x557f('0x22')](function(_0x33770a){if(_0x33770a){return _0x33770a?{'count':_0x5810a8,'rows':_0x33770a}:null;}})[_0x557f('0x22')](respondWithResult(_0x5d379d,null))[_0x557f('0x2c')](handleError(_0x5d379d,null));};function Extension(_0x368adc,_0x578980,_0x59e161,_0x241978){this[_0x557f('0x85')]=_0x557f('0x86');this[_0x557f('0x87')]=_0x368adc[_0x557f('0x88')];this['app']=_0x241978;this[_0x557f('0x42')]=_0x557f('0x89');this[_0x557f('0x8a')]=_0x557f('0x8b');this[_0x557f('0x67')]=_0x368adc['id'];this[_0x557f('0x8c')]=_0x578980;this['appdata']=_0x59e161;}function createExtensionsReciveFax(_0x4e9b22){var _0x3dcdad=0x1;var _0x17f631=[];_0x17f631['push'](new Extension(_0x4e9b22,_0x3dcdad,'',_0x557f('0x8d')));_0x3dcdad+=0x1;_0x17f631[_0x557f('0x8e')](new Extension(_0x4e9b22,_0x3dcdad,'CDR(type)=inbound-fax','Set'));_0x3dcdad+=0x1;for(var _0x4457b1 in _0x4e9b22){if(_0x4e9b22[_0x557f('0x4a')](_0x4457b1)&&(_0x4457b1===_0x557f('0x8f')||_0x4457b1==='localstationid'||_0x4457b1==='gateway'||_0x4457b1===_0x557f('0x90')||_0x4457b1===_0x557f('0x91')||_0x4457b1===_0x557f('0x92')||_0x4457b1===_0x557f('0x93')||_0x4457b1===_0x557f('0x94')||_0x4457b1===_0x557f('0x95'))){_0x17f631[_0x557f('0x8e')](new Extension(_0x4e9b22,_0x3dcdad,_0x557f('0x96')+_0x4457b1+')='+_0x4e9b22[_0x4457b1],_0x557f('0x97')));_0x3dcdad+=0x1;}}_0x17f631[_0x557f('0x8e')](new Extension(_0x4e9b22,_0x3dcdad,'6',_0x557f('0x98')));_0x3dcdad+=0x1;_0x17f631[_0x557f('0x8e')](new Extension(_0x4e9b22,_0x3dcdad,_0x557f('0x99'),_0x557f('0x9a')));_0x3dcdad=0x0;return _0x17f631;}exports[_0x557f('0x9b')]=function(_0x5ab578,_0x2cf986,_0x4ef541){var _0x49ea5e;return db[_0x557f('0x7e')][_0x557f('0x9c')](function(_0x2fbcfe){return db[_0x557f('0x53')][_0x557f('0x5a')](_0x5ab578['body'],{'transaction':_0x2fbcfe})[_0x557f('0x22')](function(_0x23a469){_0x49ea5e=_0x23a469[_0x557f('0x5c')]({'plain':!![]});return db['VoiceExtension'][_0x557f('0x9d')](createExtensionsReciveFax(_0x49ea5e),{'transaction':_0x2fbcfe});});})[_0x557f('0x22')](function(){return _0x49ea5e;})[_0x557f('0x22')](respondWithResult(_0x2cf986,null))[_0x557f('0x2c')](handleError(_0x2cf986,null));};exports[_0x557f('0x9e')]=function(_0x224291,_0x2cfbcb,_0x39a266){var _0x4dc379;return db['sequelize'][_0x557f('0x9c')](function(_0x15d1db){return db[_0x557f('0x53')]['update'](_0x224291['body'],{'where':{'id':_0x224291[_0x557f('0x64')]['id']},'transaction':_0x15d1db})[_0x557f('0x22')](function(_0xa8fc71){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x224291[_0x557f('0x64')]['id']},'transaction':_0x15d1db})[_0x557f('0x22')](function(_0x2251ee){return db[_0x557f('0x9f')][_0x557f('0x9d')](createExtensionsReciveFax(_[_0x557f('0x74')](_0x224291[_0x557f('0x64')],[_0x557f('0xa0'),_0x557f('0x43'),'createdAt',_0x557f('0xa1'),_0x557f('0xa2'),_0x557f('0xa3')])),{'transaction':_0x15d1db});});});})['then'](function(){return db['FaxAccount'][_0x557f('0xa4')](_0x224291['body']['id']);})[_0x557f('0x22')](respondWithResult(_0x2cfbcb,null))[_0x557f('0x2c')](handleError(_0x2cfbcb,null));};exports[_0x557f('0xa5')]=function(_0x553a83,_0x5b4eae,_0x94439c){var _0x5f1b08={'raw':!![],'where':{}};var _0x244f74={};var _0x3a0904={'count':0x0,'rows':[]};return db[_0x557f('0x53')][_0x557f('0x69')]({'where':{'id':_0x553a83[_0x557f('0x63')]['id']}})[_0x557f('0x22')](handleEntityNotFound(_0x5b4eae,null))[_0x557f('0x22')](function(_0x32b645){if(_0x32b645){_0x244f74[_0x557f('0x46')]=_[_0x557f('0x6a')](db[_0x557f('0xa6')][_0x557f('0x40')]);_0x244f74['query']=_[_0x557f('0x6a')](_0x553a83['query']);_0x244f74[_0x557f('0x4e')]=_['intersection'](_0x244f74[_0x557f('0x46')],_0x244f74[_0x557f('0x44')]);_0x5f1b08[_0x557f('0x47')]=_[_0x557f('0x45')](_0x244f74['model'],qs[_0x557f('0x48')](_0x553a83['query'][_0x557f('0x48')]));_0x5f1b08[_0x557f('0x47')]=_0x5f1b08[_0x557f('0x47')][_0x557f('0x49')]?_0x5f1b08['attributes']:_0x244f74[_0x557f('0x46')];if(!_0x553a83[_0x557f('0x44')][_0x557f('0x4a')](_0x557f('0x6b'))){_0x5f1b08[_0x557f('0x31')]=qs[_0x557f('0x31')](_0x553a83[_0x557f('0x44')][_0x557f('0x31')]);_0x5f1b08[_0x557f('0x30')]=qs['offset'](_0x553a83[_0x557f('0x44')][_0x557f('0x30')]);}_0x5f1b08[_0x557f('0x4b')]=qs[_0x557f('0x4c')](_0x553a83[_0x557f('0x44')][_0x557f('0x4c')]);_0x5f1b08[_0x557f('0x4d')]=qs[_0x557f('0x4e')](_[_0x557f('0x6c')](_0x553a83[_0x557f('0x44')],_0x244f74[_0x557f('0x4e')]));_0x5f1b08[_0x557f('0x4d')][_0x557f('0x67')]=_0x32b645['id'];if(_0x553a83[_0x557f('0x44')][_0x557f('0x4f')]){_0x5f1b08[_0x557f('0x4d')]=_[_0x557f('0x50')](_0x5f1b08[_0x557f('0x4d')],{'$or':_['map'](_0x5f1b08[_0x557f('0x47')],function(_0x3888e2){var _0x109496={};_0x109496[_0x3888e2]={'$like':'%'+_0x553a83['query'][_0x557f('0x4f')]+'%'};return _0x109496;})});}if(_0x553a83[_0x557f('0x44')][_0x557f('0xa7')]){var _0x1d7cd7=_0x553a83[_0x557f('0x44')]['$gte'][_0x557f('0xa8')](',');var _0x3e4921={};_0x3e4921[_0x1d7cd7[0x0]]={'$gte':moment(_0x1d7cd7[0x1])[_0x557f('0xa9')](_0x557f('0xaa'))};_0x5f1b08[_0x557f('0x4d')]=_['merge'](_0x5f1b08[_0x557f('0x4d')],_0x3e4921);}_0x5f1b08=_['merge']({},_0x5f1b08,_0x553a83[_0x557f('0x52')]);return db[_0x557f('0xa6')][_0x557f('0x33')]({'where':_0x5f1b08[_0x557f('0x4d')]})[_0x557f('0x22')](function(_0x5eceeb){_0x3a0904['count']=_0x5eceeb;if(_0x553a83[_0x557f('0x44')][_0x557f('0x54')]){_0x5f1b08[_0x557f('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0x557f('0x56')](_0x5f1b08);})['then'](function(_0x17c5f5){_0x3a0904[_0x557f('0x57')]=_0x17c5f5;return _0x3a0904;});}})[_0x557f('0x22')](respondWithFilteredResult(_0x5b4eae,_0x5f1b08))[_0x557f('0x2c')](handleError(_0x5b4eae,null));};exports['send']=function(_0x249c60,_0x50c284,_0x18a55f){var _0x19544f,_0xd10804={},_0x4c6226;if(_0x249c60[_0x557f('0x64')]['to']){_0x4c6226=_0x249c60[_0x557f('0x64')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x249c60['params']['id']},'include':[{'model':db['CmList'],'as':_0x557f('0xab'),'include':[{'model':db['CmContact'],'as':_0x557f('0xac'),'where':{'fax':_0x4c6226},'limit':0x1,'order':[[_0x557f('0xa1'),_0x557f('0xad')]]}]}]})[_0x557f('0x22')](handleEntityNotFound(_0x50c284,null))[_0x557f('0x22')](function(_0x2d77a1){_0x19544f=_0x2d77a1;if(_0x249c60[_0x557f('0x64')][_0x557f('0xae')]&&_0x249c60['body'][_0x557f('0xae')][_0x557f('0x49')]){for(var _0x5ce051=0x0;_0x5ce051<_0x249c60[_0x557f('0x64')][_0x557f('0xae')][_0x557f('0x49')];_0x5ce051+=0x1){_0x249c60['body'][_0x557f('0xae')][_0x5ce051]={'filename':_0x249c60[_0x557f('0x64')]['attachments'][_0x5ce051][_0x557f('0x3b')],'id':_0x249c60[_0x557f('0x64')][_0x557f('0xae')][_0x5ce051]['id'],'path':path[_0x557f('0xaf')](config[_0x557f('0xb0')],'server/files/attachments',_0x249c60[_0x557f('0x64')]['attachments'][_0x5ce051][_0x557f('0xb1')])};}}return respondWithRpcPromise(_0x557f('0xb2'),_0x557f('0xb2'),{'FaxAccountId':_['isNil'](_0x249c60[_0x557f('0x63')]['id'])?undefined:_0x249c60['params']['id'],'path':_[_0x557f('0xb3')](_0x249c60[_0x557f('0x64')][_0x557f('0xae')][0x0][_0x557f('0x6')])?undefined:_0x249c60[_0x557f('0x64')][_0x557f('0xae')][0x0][_0x557f('0x6')],'fax':_[_0x557f('0xb3')](_0x249c60[_0x557f('0x64')]['to'][0x0])?undefined:_0x249c60[_0x557f('0x64')]['to'][0x0]},client9002);})[_0x557f('0x22')](function(){if(_0x19544f){if(_[_0x557f('0xb3')](_0x249c60[_0x557f('0x64')][_0x557f('0xb4')])){_0x249c60[_0x557f('0x64')][_0x557f('0xb4')]=util[_0x557f('0xa9')]('\x22%s\x22\x20<%s>',_0x19544f[_0x557f('0x3b')],_0x19544f[_0x557f('0xb5')]);}if(_0x19544f[_0x557f('0xab')]){if(_0x19544f[_0x557f('0xab')][_0x557f('0xac')][_0x557f('0x49')]){return _0x19544f[_0x557f('0xab')][_0x557f('0xac')][0x0];}else{return db[_0x557f('0x76')][_0x557f('0x5a')](_[_0x557f('0x1a')](_0x249c60[_0x557f('0x64')],{'firstName':_0x249c60['body']['to'][0x0],'phone':_0x249c60['body']['to'][0x0],'fax':_0x249c60[_0x557f('0x64')]['to'][0x0],'ListId':_0x19544f[_0x557f('0xa3')]}));}}else{throw new Error(_0x557f('0xb6'));}}else{throw new Error(_0x557f('0xb7'));}})[_0x557f('0x22')](function(_0x1a6eec){if(_0x1a6eec){return db[_0x557f('0x75')][_0x557f('0x59')]({'where':{'ContactId':_0x1a6eec['id'],'closed':![],'FaxAccountId':_0x19544f['id']}})[_0x557f('0x22')](function(_0x302efd){if(_0x302efd){return[_0x302efd,![]];}return db['FaxInteraction']['create']({'UserId':_0x249c60[_0x557f('0x5b')]['id'],'ContactId':_0x1a6eec['id'],'FaxAccountId':_0x19544f['id'],'fax':_0x249c60[_0x557f('0x64')]['to'][0x0],'firstMsgDirection':_0x557f('0xb8'),'Messages':[_[_0x557f('0x50')](_0x249c60[_0x557f('0x64')],{'read':![],'body':_0x249c60[_0x557f('0x64')][_0x557f('0xae')][0x0][_0x557f('0xb9')],'FaxAccountId':_0x19544f['id'],'UserId':_0x249c60[_0x557f('0x5b')]['id'],'ContactId':_0x1a6eec['id'],'AttachmentId':_0x249c60[_0x557f('0x64')][_0x557f('0xae')][0x0]['id']})]},{'include':[{'model':db[_0x557f('0xa6')],'as':_0x557f('0xba')}]})[_0x557f('0x22')](function(_0x59d13c){return[_0x59d13c,!![]];});});}else{throw new Error(_0x557f('0xbb'));}})['spread'](function(_0x230558,_0x3b320c){if(_0x3b320c){return _0x230558;}return db[_0x557f('0xa6')][_0x557f('0x5a')]({'direction':_0x557f('0xb8'),'read':![],'body':_0x249c60[_0x557f('0x64')][_0x557f('0xae')][0x0][_0x557f('0xb9')],'FaxAccountId':_0x19544f['id'],'FaxInteractionId':_0x230558['id'],'UserId':_0x249c60['user']['id'],'ContactId':_0x230558[_0x557f('0xbc')],'AttachmentId':_0x249c60[_0x557f('0x64')][_0x557f('0xae')][0x0]['id']})[_0x557f('0x22')](function(_0x2f32e2){_0x230558[_0x557f('0xbd')][_0x557f('0xba')]=[];_0x230558[_0x557f('0xbd')][_0x557f('0xba')][_0x557f('0x8e')](_0x2f32e2['dataValues']);return _0x230558;});})[_0x557f('0x22')](function(_0x3a558f){respondWithRpcPromise(_0x557f('0xbe'),_0x557f('0xbe'),{'FaxAccountId':_[_0x557f('0xb3')](_0x249c60['params']['id'])?undefined:_0x249c60[_0x557f('0x63')]['id'],'path':_['isNil'](_0x249c60[_0x557f('0x64')]['attachments'][0x0][_0x557f('0x6')])?undefined:_0x249c60[_0x557f('0x64')][_0x557f('0xae')][0x0][_0x557f('0x6')],'fax':_[_0x557f('0xb3')](_0x249c60['body']['to'][0x0])?undefined:_0x249c60[_0x557f('0x64')]['to'][0x0],'AttachmentId':_0x249c60[_0x557f('0x64')][_0x557f('0xae')][0x0]['id']},client9002)['then'](function(_0x28718d){logger[_0x557f('0x23')](_0x557f('0xbf'),_0x28718d);})['catch'](function(_0x1f6dd5){logger[_0x557f('0x23')](_0x557f('0xbf'),_0x1f6dd5);});return _0x3a558f;})[_0x557f('0x22')](respondWithResult(_0x50c284,null))[_0x557f('0x2c')](handleError(_0x50c284,null));};exports[_0x557f('0xc0')]=function(_0x17c303,_0x556246,_0x551e7b){return db[_0x557f('0x53')][_0x557f('0x59')]({'where':{'id':_0x17c303[_0x557f('0x63')]['id']}})['then'](handleEntityNotFound(_0x556246,null))['then'](function(_0x463557){if(_0x463557){return _0x463557[_0x557f('0xc0')](_0x17c303[_0x557f('0x64')][_0x557f('0x6e')],_[_0x557f('0x74')](_0x17c303['body'],[_0x557f('0x6e'),'id'])||{})[_0x557f('0xc1')](function(_0x270dcc){for(var _0x34fb08=0x0;_0x34fb08<_0x17c303[_0x557f('0x64')][_0x557f('0x6e')]['length'];_0x34fb08+=0x1){socket[_0x557f('0xc2')](_0x557f('0xc3'),{'UserId':Number(_0x17c303[_0x557f('0x64')][_0x557f('0x6e')][_0x34fb08]),'FaxAccountId':Number(_0x17c303[_0x557f('0x63')]['id'])});}return _0x270dcc;});}})[_0x557f('0x22')](respondWithResult(_0x556246,null))[_0x557f('0x2c')](handleError(_0x556246,null));};exports['removeAgents']=function(_0xd53b4e,_0x5cec7b,_0xefdb7e){return db[_0x557f('0x53')][_0x557f('0x59')]({'where':{'id':_0xd53b4e[_0x557f('0x63')]['id']}})['then'](handleEntityNotFound(_0x5cec7b,null))['then'](function(_0x1695a9){if(_0x1695a9){return _0x1695a9[_0x557f('0xc4')](_0xd53b4e[_0x557f('0x44')]['ids'])[_0x557f('0x22')](function(){if(_[_0x557f('0xc5')](_0xd53b4e[_0x557f('0x44')]['ids'])){for(var _0x19563d=0x0;_0x19563d<_0xd53b4e[_0x557f('0x44')][_0x557f('0x6e')]['length'];_0x19563d+=0x1){socket[_0x557f('0xc2')](_0x557f('0xc6'),{'UserId':Number(_0xd53b4e['query'][_0x557f('0x6e')][_0x19563d]),'FaxAccountId':Number(_0xd53b4e['params']['id'])});}}else{socket[_0x557f('0xc2')](_0x557f('0xc6'),{'UserId':Number(_0xd53b4e[_0x557f('0x44')]['ids']),'FaxAccountId':Number(_0xd53b4e[_0x557f('0x63')]['id'])});}});}})[_0x557f('0x22')](respondWithStatusCode(_0x5cec7b,null))[_0x557f('0x2c')](handleError(_0x5cec7b,null));};exports[_0x557f('0xc7')]=function(_0xcf305b,_0x6ace77,_0x4feaa0){var _0x30165d={};var _0x31dfcc={};var _0x506b40;var _0xb485d1;return db[_0x557f('0x53')][_0x557f('0x69')]({'where':{'id':_0xcf305b[_0x557f('0x63')]['id']}})[_0x557f('0x22')](handleEntityNotFound(_0x6ace77,null))[_0x557f('0x22')](function(_0x16bab7){if(_0x16bab7){_0x506b40=_0x16bab7;_0x31dfcc[_0x557f('0x46')]=_[_0x557f('0x6a')](db['User'][_0x557f('0x40')]);_0x31dfcc[_0x557f('0x44')]=_[_0x557f('0x6a')](_0xcf305b[_0x557f('0x44')]);_0x31dfcc[_0x557f('0x4e')]=_[_0x557f('0x45')](_0x31dfcc[_0x557f('0x46')],_0x31dfcc[_0x557f('0x44')]);_0x30165d[_0x557f('0x47')]=_[_0x557f('0x45')](_0x31dfcc[_0x557f('0x46')],qs[_0x557f('0x48')](_0xcf305b[_0x557f('0x44')][_0x557f('0x48')]));_0x30165d[_0x557f('0x47')]=_0x30165d[_0x557f('0x47')][_0x557f('0x49')]?_0x30165d['attributes']:_0x31dfcc[_0x557f('0x46')];_0x30165d[_0x557f('0x4b')]=qs[_0x557f('0x4c')](_0xcf305b[_0x557f('0x44')][_0x557f('0x4c')]);_0x30165d[_0x557f('0x4d')]=qs['filters'](_[_0x557f('0x6c')](_0xcf305b[_0x557f('0x44')],_0x31dfcc['filters']));if(_0xcf305b[_0x557f('0x44')][_0x557f('0x4f')]){_0x30165d['where']=_[_0x557f('0x50')](_0x30165d[_0x557f('0x4d')],{'$or':_[_0x557f('0x3f')](_0x30165d[_0x557f('0x47')],function(_0x524159){var _0x2874f8={};_0x2874f8[_0x524159]={'$like':'%'+_0xcf305b[_0x557f('0x44')][_0x557f('0x4f')]+'%'};return _0x2874f8;})});}_0x30165d=_[_0x557f('0x50')]({},_0x30165d,_0xcf305b['options']);return _0x506b40['getAgents'](_0x30165d);}})[_0x557f('0x22')](function(_0x1b04ea){if(_0x1b04ea){_0xb485d1=_0x1b04ea[_0x557f('0x49')];if(!_0xcf305b[_0x557f('0x44')][_0x557f('0x4a')](_0x557f('0x6b'))){_0x30165d[_0x557f('0x31')]=qs[_0x557f('0x31')](_0xcf305b['query'][_0x557f('0x31')]);_0x30165d[_0x557f('0x30')]=qs[_0x557f('0x30')](_0xcf305b['query']['offset']);}return _0x506b40[_0x557f('0xc7')](_0x30165d);}})[_0x557f('0x22')](function(_0x567fa5){if(_0x567fa5){return _0x567fa5?{'count':_0xb485d1,'rows':_0x567fa5}:null;}})[_0x557f('0x22')](respondWithResult(_0x6ace77,null))[_0x557f('0x2c')](handleError(_0x6ace77,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b8dd3b3..8c42547 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 _0x5554=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x348890,_0x799cca){var _0x2ee8f4=function(_0x259478){while(--_0x259478){_0x348890['push'](_0x348890['shift']());}};_0x2ee8f4(++_0x799cca);}(_0x5554,0x185));var _0x4555=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5554[_0x465028];return _0xb783d4;};'use strict';var EventEmitter=require(_0x4555('0x0'));var FaxAccount=require(_0x4555('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4555('0x2')](0x0);var events={'afterCreate':_0x4555('0x3'),'afterUpdate':_0x4555('0x4'),'afterDestroy':_0x4555('0x5')};function emitEvent(_0x42e0d5){return function(_0x526b1e,_0x3e9cef,_0x232d36){FaxAccountEvents[_0x4555('0x6')](_0x42e0d5+':'+_0x526b1e['id'],_0x526b1e);FaxAccountEvents[_0x4555('0x6')](_0x42e0d5,_0x526b1e);_0x232d36(null);};}for(var e in events){if(events[_0x4555('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x4555('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xd34c=['emit','hook','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd34c,0x185));var _0xcd34=function(_0x532ba7,_0x3553a8){_0x532ba7=_0x532ba7-0x0;var _0x2550ec=_0xd34c[_0x532ba7];return _0x2550ec;};'use strict';var EventEmitter=require(_0xcd34('0x0'));var FaxAccount=require(_0xcd34('0x1'))['db'][_0xcd34('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xcd34('0x3')](0x0);var events={'afterCreate':_0xcd34('0x4'),'afterUpdate':_0xcd34('0x5'),'afterDestroy':_0xcd34('0x6')};function emitEvent(_0x150496){return function(_0x43c34e,_0x18a988,_0x5d5e4c){FaxAccountEvents[_0xcd34('0x7')](_0x150496+':'+_0x43c34e['id'],_0x43c34e);FaxAccountEvents[_0xcd34('0x7')](_0x150496,_0x43c34e);_0x5d5e4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xcd34('0x8')](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 96b1924..a40ed98 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 _0xe91c=['util','api','moment','bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash'];(function(_0x572674,_0x2891a7){var _0x1228a7=function(_0x576e86){while(--_0x576e86){_0x572674['push'](_0x572674['shift']());}};_0x1228a7(++_0x2891a7);}(_0xe91c,0x15b));var _0xce91=function(_0x566957,_0x2587ac){_0x566957=_0x566957-0x0;var _0x4cbcde=_0xe91c[_0x566957];return _0x4cbcde;};'use strict';var _=require(_0xce91('0x0'));var util=require(_0xce91('0x1'));var logger=require('../../config/logger')(_0xce91('0x2'));var moment=require(_0xce91('0x3'));var BPromise=require(_0xce91('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce91('0x5'));var rimraf=require(_0xce91('0x6'));var config=require(_0xce91('0x7'));var attributes=require(_0xce91('0x8'));module[_0xce91('0x9')]=function(_0x8dd92c,_0x3d5f38){return _0x8dd92c['define'](_0xce91('0xa'),attributes,{'tableName':_0xce91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0e1=['./faxAccount.attributes','define','FaxAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x166e5c,_0x157ddd){var _0x22dd58=function(_0x5a9fc8){while(--_0x5a9fc8){_0x166e5c['push'](_0x166e5c['shift']());}};_0x22dd58(++_0x157ddd);}(_0xc0e1,0x85));var _0x1c0e=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0xc0e1[_0x368bba];return _0x409f8f;};'use strict';var _=require(_0x1c0e('0x0'));var util=require(_0x1c0e('0x1'));var logger=require(_0x1c0e('0x2'))(_0x1c0e('0x3'));var moment=require(_0x1c0e('0x4'));var BPromise=require(_0x1c0e('0x5'));var rp=require(_0x1c0e('0x6'));var fs=require('fs');var path=require(_0x1c0e('0x7'));var rimraf=require(_0x1c0e('0x8'));var config=require(_0x1c0e('0x9'));var attributes=require(_0x1c0e('0xa'));module['exports']=function(_0x32b167,_0x4a2ce2){return _0x32b167[_0x1c0e('0xb')](_0x1c0e('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 c5a0937..14f4909 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 _0x087b=['CmContact','describe','Sequelize','keys','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','account','CmList','List','Contacts','FaxApplication','Applications','applications','list','orderBy','length','create','contact','FaxInteraction','find','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','body','fax'];(function(_0x59e705,_0x4527f9){var _0x422ae8=function(_0x417613){while(--_0x417613){_0x59e705['push'](_0x59e705['shift']());}};_0x422ae8(++_0x4527f9);}(_0x087b,0x18f));var _0xb087=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x087b[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require(_0xb087('0x2'));var BPromise=require(_0xb087('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb087('0x4'));var db=require(_0xb087('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb087('0x6'))(_0xb087('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb087('0x8')][_0xb087('0x9')]({'port':0x232c});config['redis']=_[_0xb087('0xa')](config['redis'],{'host':_0xb087('0xb'),'port':0x18eb});var socket=require(_0xb087('0xc'))(new Redis(config[_0xb087('0xd')]));require(_0xb087('0xe'))['register'](socket);function respondWithRpcPromise(_0x1b9b08,_0x3dc497,_0x185b3b){return new BPromise(function(_0x5813e8,_0x3bf11e){return client[_0xb087('0xf')](_0x1b9b08,_0x185b3b)[_0xb087('0x10')](function(_0x5da604){logger[_0xb087('0x11')]('FaxAccount,\x20%s,\x20%s',_0x3dc497,'request\x20sent');logger[_0xb087('0x12')](_0xb087('0x13'),_0x3dc497,_0xb087('0x14'),JSON[_0xb087('0x15')](_0x5da604));if(_0x5da604[_0xb087('0x16')]){if(_0x5da604['error'][_0xb087('0x17')]===0x1f4){logger[_0xb087('0x16')](_0xb087('0x18'),_0x3dc497,_0x5da604['error'][_0xb087('0x19')]);return _0x3bf11e(_0x5da604[_0xb087('0x16')][_0xb087('0x19')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x3dc497,_0x5da604[_0xb087('0x16')][_0xb087('0x19')]);return _0x5813e8(_0x5da604[_0xb087('0x16')][_0xb087('0x19')]);}else{logger[_0xb087('0x11')](_0xb087('0x18'),_0x3dc497,_0xb087('0x14'));_0x5813e8(_0x5da604[_0xb087('0x1a')][_0xb087('0x19')]);}})[_0xb087('0x1b')](function(_0xe14b23){logger[_0xb087('0x16')]('FaxAccount,\x20%s,\x20%s',_0x3dc497,_0xe14b23);_0x3bf11e(_0xe14b23);});});}exports[_0xb087('0x1c')]=function(_0x29f4af){var _0x3c906e=this;return new Promise(function(_0x20efb8,_0x413c36){return db[_0xb087('0x1d')][_0xb087('0x1e')]({'raw':_0x29f4af[_0xb087('0x1f')]?_0x29f4af[_0xb087('0x1f')][_0xb087('0x20')]===undefined?!![]:![]:!![],'where':_0x29f4af[_0xb087('0x1f')]?_0x29f4af['options'][_0xb087('0x21')]||null:null,'attributes':_0x29f4af[_0xb087('0x1f')]?_0x29f4af[_0xb087('0x1f')][_0xb087('0x22')]||null:null,'limit':_0x29f4af['options']?_0x29f4af[_0xb087('0x1f')][_0xb087('0x23')]||null:null,'include':_0x29f4af[_0xb087('0x1f')]?_0x29f4af['options'][_0xb087('0x24')]?_['map'](_0x29f4af['options'][_0xb087('0x24')],function(_0x50c013){return{'model':db[_0x50c013['model']],'as':_0x50c013['as'],'attributes':_0x50c013[_0xb087('0x22')],'include':_0x50c013[_0xb087('0x24')]?_[_0xb087('0x25')](_0x50c013[_0xb087('0x24')],function(_0x2408f3){return{'model':db[_0x2408f3[_0xb087('0x26')]],'as':_0x2408f3['as'],'attributes':_0x2408f3['attributes'],'include':_0x2408f3['include']?_[_0xb087('0x25')](_0x2408f3['include'],function(_0x3ef8f1){return{'model':db[_0x3ef8f1[_0xb087('0x26')]],'as':_0x3ef8f1['as'],'attributes':_0x3ef8f1[_0xb087('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb087('0x10')](function(_0x12eb8a){logger[_0xb087('0x11')]('GetFaxAccount',_0x29f4af);logger[_0xb087('0x12')](_0xb087('0x1c'),_0x29f4af,JSON[_0xb087('0x15')](_0x12eb8a));_0x20efb8(_0x12eb8a);})[_0xb087('0x1b')](function(_0x63704a){logger[_0xb087('0x16')]('GetFaxAccount',_0x63704a['message'],_0x29f4af);_0x413c36(_0x3c906e[_0xb087('0x16')](0x1f4,_0x63704a[_0xb087('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x3c5982,_0x20a5e3,_0x34cdd9){var _0x2bedc2=this;return new Promise(function(_0x41bb77,_0x429ecc){var _0x14994b={'body':_0x3c5982[_0xb087('0x27')],'channel':_0xb087('0x28')};var _0x4f68ee=[];var _0x3870e0=[];var _0x28d287={};return db[_0xb087('0x29')][_0xb087('0x2a')]()['then'](function(_0x2189d8){if(!_0x2189d8){throw new db[(_0xb087('0x2b'))]['ValidationError']('no\x20available\x20attributes');}_0x4f68ee=_['difference'](_[_0xb087('0x2c')](_0x2189d8),[_0xb087('0x2d'),_0xb087('0x2e')]);_0x3870e0=_[_0xb087('0x2f')](_[_0xb087('0x2c')](_0x2189d8),[_0xb087('0x2d'),_0xb087('0x2e'),_0xb087('0x30'),_0xb087('0x31')]);if(_0x3c5982[_0xb087('0x27')]['id']){delete _0x3c5982[_0xb087('0x27')]['id'];}if(_[_0xb087('0x32')](_0x3c5982[_0xb087('0x27')]['from'])){throw new db['Sequelize']['ValidationError'](_0xb087('0x33'));}if(_['isNil'](_0x3c5982[_0xb087('0x27')]['body'])||_0x3c5982['body'][_0xb087('0x27')]===''){throw new db[(_0xb087('0x2b'))][(_0xb087('0x34'))](_0xb087('0x35'));}if(_['isNil'](_0x3c5982[_0xb087('0x27')][_0xb087('0x36')])){throw new db['Sequelize'][(_0xb087('0x34'))](_0xb087('0x37')+_0x3870e0);}if(!_[_0xb087('0x38')](_0x3870e0,_0x3c5982[_0xb087('0x27')][_0xb087('0x36')])){throw new db[(_0xb087('0x2b'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3870e0);}_0x28d287[_0x3c5982[_0xb087('0x27')]['mapKey']]=_0x3c5982[_0xb087('0x27')][_0xb087('0x39')];})[_0xb087('0x10')](function(){return db[_0xb087('0x1d')]['find']({'where':{'id':_0x3c5982[_0xb087('0x3a')]['id']},'include':[{'model':db[_0xb087('0x3b')],'as':_0xb087('0x3c'),'include':[{'model':db[_0xb087('0x29')],'as':_0xb087('0x3d'),'where':_0x28d287,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xb087('0x3e')],'as':_0xb087('0x3f')}]});})[_0xb087('0x10')](function(_0x12dea1){if(_0x12dea1&&_0x12dea1['List']){var _0x16264c=_0x12dea1['get']({'plain':!![]});_0x14994b[_0xb087('0x3a')]=_0x16264c;_0x14994b[_0xb087('0x40')]=_0x16264c[_0xb087('0x3f')];_0x14994b[_0xb087('0x41')]=_0x16264c['List'];_0x14994b['applications']=_[_0xb087('0x42')](_0x14994b[_0xb087('0x40')],['priority'],['asc']);if(_0x14994b[_0xb087('0x3a')][_0xb087('0x3f')]){delete _0x14994b[_0xb087('0x3a')][_0xb087('0x3f')];}if(_0x14994b[_0xb087('0x3a')][_0xb087('0x3c')]&&_0x14994b['account'][_0xb087('0x3c')]['Contacts'][_0xb087('0x43')]){return _0x14994b[_0xb087('0x3a')][_0xb087('0x3c')][_0xb087('0x3d')][0x0];}var _0x35200c=_[_0xb087('0xa')](_0x3c5982[_0xb087('0x27')],{'firstName':_0x3c5982[_0xb087('0x27')]['from'],'ListId':_0x16264c[_0xb087('0x31')]});_0x35200c[_0x3c5982[_0xb087('0x27')][_0xb087('0x36')]]=_0x3c5982[_0xb087('0x27')][_0xb087('0x39')];return db['CmContact'][_0xb087('0x44')](_0x35200c,{'fields':_0x4f68ee,'raw':!![]});}})[_0xb087('0x10')](function(_0x1d0229){_0x14994b[_0xb087('0x45')]=_0x1d0229;if(_0x1d0229){var _0x2d47d8={'ContactId':_0x1d0229['id'],'FaxAccountId':_0x3c5982[_0xb087('0x3a')]['id'],'fax':_0x1d0229[_0xb087('0x28')]};return db[_0xb087('0x46')][_0xb087('0x47')]({'where':{'ContactId':_0x1d0229['id'],'closed':![],'FaxAccountId':_0x3c5982[_0xb087('0x3a')]['id']}})[_0xb087('0x10')](function(_0x184c1a){if(_0x184c1a){return[_0x184c1a,![]];}return db[_0xb087('0x46')]['create'](_0x2d47d8)[_0xb087('0x10')](function(_0x4b0b67){return[_0x4b0b67,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb087('0x48')](function(_0x3f05b2,_0x65161d){var _0x333cd8=_0x3f05b2['get']({'plain':!![]});if(_0x65161d){if(_0x14994b['account'][_0xb087('0x49')]){_0x14994b[_0xb087('0x40')]['push']({'id':0x0,'priority':_0x14994b['applications']['length']+0x1,'app':_0xb087('0x4a'),'appdata':_0xb087('0x4b'),'interval':_0xb087('0x4c')});}_0x333cd8['created']=!![];}else{_0x333cd8[_0xb087('0x4d')]=![];}_0x14994b[_0xb087('0x4e')]=_0x333cd8;return db['FaxMessage'][_0xb087('0x44')]({'body':_0x3c5982['body'][_0xb087('0x27')],'FaxAccountId':_0x3c5982[_0xb087('0x3a')]['id'],'FaxInteractionId':_0x3f05b2['id'],'direction':'in','ContactId':_0x3f05b2[_0xb087('0x4f')],'AttachmentId':_0x3c5982['body'][_0xb087('0x50')]});})['then'](function(_0x123ce2){_0x14994b[_0xb087('0x19')]=_0x123ce2;if(_0x14994b[_0xb087('0x4e')][_0xb087('0x51')]){return db['User']['find']({'attributes':['id',_0xb087('0x52')],'where':{'id':_0x14994b[_0xb087('0x4e')][_0xb087('0x51')]}})['then'](function(_0xc24195){if(_0xc24195){_0x14994b[_0xb087('0x40')][_0xb087('0x53')]({'id':0x0,'priority':0x0,'app':_0xb087('0x54'),'appdata':_0xc24195[_0xb087('0x52')]+','+(_0x14994b[_0xb087('0x3a')][_0xb087('0x55')]||0xa),'interval':_0xb087('0x4c')});}return respondWithRpcPromise(_0xb087('0x56'),_0xb087('0x57'),_0x14994b);});}return respondWithRpcPromise(_0xb087('0x56'),_0xb087('0x57'),_0x14994b);})['then'](function(_0x1a619a){_0x41bb77(_0x1a619a);})[_0xb087('0x1b')](function(_0x51fdba){_0x429ecc(_0x2bedc2[_0xb087('0x16')](0x1f4,_0x51fdba[_0xb087('0x19')]));});});}; \ No newline at end of file +var _0xb974=['length','contact','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','created','interaction','ContactId','AttachmentId','UserId','User','find','name','waitForTheAssignedAgent','startRouting','Start','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','map','model','include','catch','body','fax','CmContact','describe','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','FaxApplication','Applications','get','account','list','applications','priority','asc'];(function(_0x5ef0f7,_0x27f1ac){var _0x2f4823=function(_0x3c7354){while(--_0x3c7354){_0x5ef0f7['push'](_0x5ef0f7['shift']());}};_0x2f4823(++_0x27f1ac);}(_0xb974,0x173));var _0x4b97=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb974[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x4b97('0x0'));var moment=require('moment');var BPromise=require(_0x4b97('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b97('0x2'));var db=require(_0x4b97('0x3'))['db'];var utils=require(_0x4b97('0x4'));var logger=require(_0x4b97('0x5'))('rpc');var config=require(_0x4b97('0x6'));var jayson=require(_0x4b97('0x7'));var client=jayson[_0x4b97('0x8')][_0x4b97('0x9')]({'port':0x232c});config[_0x4b97('0xa')]=_[_0x4b97('0xb')](config[_0x4b97('0xa')],{'host':_0x4b97('0xc'),'port':0x18eb});var socket=require(_0x4b97('0xd'))(new Redis(config[_0x4b97('0xa')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0xa127ff,_0x5e29ec,_0x5a9dd6){return new BPromise(function(_0x15aaf5,_0x2eda4d){return client[_0x4b97('0xe')](_0xa127ff,_0x5a9dd6)[_0x4b97('0xf')](function(_0xc01959){logger['info'](_0x4b97('0x10'),_0x5e29ec,_0x4b97('0x11'));logger[_0x4b97('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5e29ec,_0x4b97('0x11'),JSON[_0x4b97('0x13')](_0xc01959));if(_0xc01959['error']){if(_0xc01959[_0x4b97('0x14')][_0x4b97('0x15')]===0x1f4){logger[_0x4b97('0x14')](_0x4b97('0x10'),_0x5e29ec,_0xc01959[_0x4b97('0x14')][_0x4b97('0x16')]);return _0x2eda4d(_0xc01959[_0x4b97('0x14')][_0x4b97('0x16')]);}logger[_0x4b97('0x14')]('FaxAccount,\x20%s,\x20%s',_0x5e29ec,_0xc01959[_0x4b97('0x14')][_0x4b97('0x16')]);return _0x15aaf5(_0xc01959[_0x4b97('0x14')][_0x4b97('0x16')]);}else{logger[_0x4b97('0x17')]('FaxAccount,\x20%s,\x20%s',_0x5e29ec,'request\x20sent');_0x15aaf5(_0xc01959[_0x4b97('0x18')]['message']);}})['catch'](function(_0x4c3b0e){logger['error']('FaxAccount,\x20%s,\x20%s',_0x5e29ec,_0x4c3b0e);_0x2eda4d(_0x4c3b0e);});});}exports[_0x4b97('0x19')]=function(_0x91eb64){var _0x46555b=this;return new Promise(function(_0x5d490f,_0x237355){return db[_0x4b97('0x1a')][_0x4b97('0x1b')]({'raw':_0x91eb64[_0x4b97('0x1c')]?_0x91eb64[_0x4b97('0x1c')][_0x4b97('0x1d')]===undefined?!![]:![]:!![],'where':_0x91eb64[_0x4b97('0x1c')]?_0x91eb64['options']['where']||null:null,'attributes':_0x91eb64[_0x4b97('0x1c')]?_0x91eb64[_0x4b97('0x1c')][_0x4b97('0x1e')]||null:null,'limit':_0x91eb64['options']?_0x91eb64[_0x4b97('0x1c')][_0x4b97('0x1f')]||null:null,'include':_0x91eb64['options']?_0x91eb64[_0x4b97('0x1c')]['include']?_[_0x4b97('0x20')](_0x91eb64[_0x4b97('0x1c')]['include'],function(_0x40688d){return{'model':db[_0x40688d[_0x4b97('0x21')]],'as':_0x40688d['as'],'attributes':_0x40688d[_0x4b97('0x1e')],'include':_0x40688d[_0x4b97('0x22')]?_['map'](_0x40688d['include'],function(_0x56b3bc){return{'model':db[_0x56b3bc[_0x4b97('0x21')]],'as':_0x56b3bc['as'],'attributes':_0x56b3bc[_0x4b97('0x1e')],'include':_0x56b3bc[_0x4b97('0x22')]?_['map'](_0x56b3bc['include'],function(_0x7a3ad9){return{'model':db[_0x7a3ad9[_0x4b97('0x21')]],'as':_0x7a3ad9['as'],'attributes':_0x7a3ad9[_0x4b97('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4b97('0xf')](function(_0x5a0c01){logger['info'](_0x4b97('0x19'),_0x91eb64);logger[_0x4b97('0x12')]('GetFaxAccount',_0x91eb64,JSON[_0x4b97('0x13')](_0x5a0c01));_0x5d490f(_0x5a0c01);})[_0x4b97('0x23')](function(_0x38062a){logger[_0x4b97('0x14')]('GetFaxAccount',_0x38062a['message'],_0x91eb64);_0x237355(_0x46555b['error'](0x1f4,_0x38062a[_0x4b97('0x16')]));});});};exports['NotifyFaxAccount']=function(_0x571bdd,_0x14cdd7,_0x5685e5){var _0xab6797=this;return new Promise(function(_0x1d06cc,_0x5afe43){var _0x3eb3e2={'body':_0x571bdd[_0x4b97('0x24')],'channel':_0x4b97('0x25')};var _0x452791=[];var _0x388635=[];var _0x319b4c={};return db[_0x4b97('0x26')][_0x4b97('0x27')]()[_0x4b97('0xf')](function(_0x2c5c6a){if(!_0x2c5c6a){throw new db['Sequelize']['ValidationError'](_0x4b97('0x28'));}_0x452791=_[_0x4b97('0x29')](_['keys'](_0x2c5c6a),[_0x4b97('0x2a'),_0x4b97('0x2b')]);_0x388635=_[_0x4b97('0x29')](_[_0x4b97('0x2c')](_0x2c5c6a),[_0x4b97('0x2a'),_0x4b97('0x2b'),_0x4b97('0x2d'),_0x4b97('0x2e')]);if(_0x571bdd['body']['id']){delete _0x571bdd[_0x4b97('0x24')]['id'];}if(_[_0x4b97('0x2f')](_0x571bdd[_0x4b97('0x24')][_0x4b97('0x30')])){throw new db[(_0x4b97('0x31'))][(_0x4b97('0x32'))](_0x4b97('0x33'));}if(_['isNil'](_0x571bdd[_0x4b97('0x24')][_0x4b97('0x24')])||_0x571bdd[_0x4b97('0x24')][_0x4b97('0x24')]===''){throw new db[(_0x4b97('0x31'))][(_0x4b97('0x32'))](_0x4b97('0x34'));}if(_[_0x4b97('0x2f')](_0x571bdd[_0x4b97('0x24')][_0x4b97('0x35')])){throw new db['Sequelize'][(_0x4b97('0x32'))](_0x4b97('0x36')+_0x388635);}if(!_[_0x4b97('0x37')](_0x388635,_0x571bdd['body'][_0x4b97('0x35')])){throw new db[(_0x4b97('0x31'))][(_0x4b97('0x32'))](_0x4b97('0x38')+_0x388635);}_0x319b4c[_0x571bdd[_0x4b97('0x24')][_0x4b97('0x35')]]=_0x571bdd['body'][_0x4b97('0x30')];})['then'](function(){return db[_0x4b97('0x1a')]['find']({'where':{'id':_0x571bdd['account']['id']},'include':[{'model':db[_0x4b97('0x39')],'as':_0x4b97('0x3a'),'include':[{'model':db['CmContact'],'as':_0x4b97('0x3b'),'where':_0x319b4c,'limit':0x1,'order':[['updatedAt',_0x4b97('0x3c')]]}]},{'model':db[_0x4b97('0x3d')],'as':_0x4b97('0x3e')}]});})['then'](function(_0x26089b){if(_0x26089b&&_0x26089b[_0x4b97('0x3a')]){var _0x5acf1c=_0x26089b[_0x4b97('0x3f')]({'plain':!![]});_0x3eb3e2[_0x4b97('0x40')]=_0x5acf1c;_0x3eb3e2['applications']=_0x5acf1c['Applications'];_0x3eb3e2[_0x4b97('0x41')]=_0x5acf1c[_0x4b97('0x3a')];_0x3eb3e2['applications']=_['orderBy'](_0x3eb3e2[_0x4b97('0x42')],[_0x4b97('0x43')],[_0x4b97('0x44')]);if(_0x3eb3e2[_0x4b97('0x40')][_0x4b97('0x3e')]){delete _0x3eb3e2[_0x4b97('0x40')]['Applications'];}if(_0x3eb3e2['account'][_0x4b97('0x3a')]&&_0x3eb3e2[_0x4b97('0x40')][_0x4b97('0x3a')]['Contacts'][_0x4b97('0x45')]){return _0x3eb3e2[_0x4b97('0x40')][_0x4b97('0x3a')][_0x4b97('0x3b')][0x0];}var _0x5b54d5=_['defaults'](_0x571bdd[_0x4b97('0x24')],{'firstName':_0x571bdd['body'][_0x4b97('0x30')],'ListId':_0x5acf1c['ListId']});_0x5b54d5[_0x571bdd[_0x4b97('0x24')][_0x4b97('0x35')]]=_0x571bdd[_0x4b97('0x24')][_0x4b97('0x30')];return db[_0x4b97('0x26')]['create'](_0x5b54d5,{'fields':_0x452791,'raw':!![]});}})['then'](function(_0x558ad5){_0x3eb3e2[_0x4b97('0x46')]=_0x558ad5;if(_0x558ad5){var _0x2825c5={'ContactId':_0x558ad5['id'],'FaxAccountId':_0x571bdd[_0x4b97('0x40')]['id'],'fax':_0x558ad5[_0x4b97('0x25')]};return db[_0x4b97('0x47')]['find']({'where':{'ContactId':_0x558ad5['id'],'closed':![],'FaxAccountId':_0x571bdd[_0x4b97('0x40')]['id']}})['then'](function(_0x3920e1){if(_0x3920e1){return[_0x3920e1,![]];}return db['FaxInteraction'][_0x4b97('0x48')](_0x2825c5)[_0x4b97('0xf')](function(_0x84c169){return[_0x84c169,!![]];});});}else{throw new Error(_0x4b97('0x49'));}})[_0x4b97('0x4a')](function(_0x93d630,_0x509e92){var _0x5a12ee=_0x93d630[_0x4b97('0x3f')]({'plain':!![]});if(_0x509e92){if(_0x3eb3e2[_0x4b97('0x40')][_0x4b97('0x4b')]){_0x3eb3e2[_0x4b97('0x42')][_0x4b97('0x4c')]({'id':0x0,'priority':_0x3eb3e2[_0x4b97('0x42')][_0x4b97('0x45')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x5a12ee[_0x4b97('0x4d')]=!![];}else{_0x5a12ee['created']=![];}_0x3eb3e2[_0x4b97('0x4e')]=_0x5a12ee;return db['FaxMessage'][_0x4b97('0x48')]({'body':_0x571bdd[_0x4b97('0x24')][_0x4b97('0x24')],'FaxAccountId':_0x571bdd['account']['id'],'FaxInteractionId':_0x93d630['id'],'direction':'in','ContactId':_0x93d630[_0x4b97('0x4f')],'AttachmentId':_0x571bdd[_0x4b97('0x24')][_0x4b97('0x50')]});})[_0x4b97('0xf')](function(_0x4ca1ca){_0x3eb3e2[_0x4b97('0x16')]=_0x4ca1ca;if(_0x3eb3e2[_0x4b97('0x4e')][_0x4b97('0x51')]){return db[_0x4b97('0x52')][_0x4b97('0x53')]({'attributes':['id','name'],'where':{'id':_0x3eb3e2['interaction'][_0x4b97('0x51')]}})[_0x4b97('0xf')](function(_0x4885cd){if(_0x4885cd){_0x3eb3e2[_0x4b97('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4885cd[_0x4b97('0x54')]+','+(_0x3eb3e2[_0x4b97('0x40')][_0x4b97('0x55')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x4b97('0x56'),_0x3eb3e2);});}return respondWithRpcPromise(_0x4b97('0x57'),'startRouting',_0x3eb3e2);})['then'](function(_0x551868){_0x1d06cc(_0x551868);})['catch'](function(_0x417d61){_0x5afe43(_0xab6797[_0x4b97('0x14')](0x1f4,_0x417d61[_0x4b97('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f86c694..25a2494 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 _0xf1ab=['./faxAccount.events','save','emit','register','faxAccount:'];(function(_0x42327a,_0x35f533){var _0x57c67c=function(_0x29fa4b){while(--_0x29fa4b){_0x42327a['push'](_0x42327a['shift']());}};_0x57c67c(++_0x35f533);}(_0xf1ab,0x1c2));var _0xbf1a=function(_0x506bb0,_0x3b75a1){_0x506bb0=_0x506bb0-0x0;var _0x3e0e17=_0xf1ab[_0x506bb0];return _0x3e0e17;};'use strict';var FaxAccountEvents=require(_0xbf1a('0x0'));var events=[_0xbf1a('0x1'),'remove','update'];function createListener(_0xb70c97,_0x44e39d){return function(_0x178a04){_0x44e39d[_0xbf1a('0x2')](_0xb70c97,_0x178a04);};}function removeListener(_0x3c408a,_0x2f7be8){return function(){FaxAccountEvents['removeListener'](_0x3c408a,_0x2f7be8);};}exports[_0xbf1a('0x3')]=function(_0x105165){for(var _0x2496e3=0x0,_0x52a97f=events['length'];_0x2496e3<_0x52a97f;_0x2496e3++){var _0x17f45=events[_0x2496e3];var _0x48189b=createListener(_0xbf1a('0x4')+_0x17f45,_0x105165);FaxAccountEvents['on'](_0x17f45,_0x48189b);}}; \ No newline at end of file +var _0xb7d9=['register','length','./faxAccount.events','remove','update','removeListener'];(function(_0x28892d,_0x53b905){var _0x181e4d=function(_0x58f645){while(--_0x58f645){_0x28892d['push'](_0x28892d['shift']());}};_0x181e4d(++_0x53b905);}(_0xb7d9,0x1b2));var _0x9b7d=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0xb7d9[_0x47adb8];return _0x4689a8;};'use strict';var FaxAccountEvents=require(_0x9b7d('0x0'));var events=['save',_0x9b7d('0x1'),_0x9b7d('0x2')];function createListener(_0x4c2fa0,_0x300026){return function(_0x507d0d){_0x300026['emit'](_0x4c2fa0,_0x507d0d);};}function removeListener(_0x3d438b,_0x1217ad){return function(){FaxAccountEvents[_0x9b7d('0x3')](_0x3d438b,_0x1217ad);};}exports[_0x9b7d('0x4')]=function(_0x52d42e){for(var _0x476790=0x0,_0x2c8e67=events[_0x9b7d('0x5')];_0x476790<_0x2c8e67;_0x476790++){var _0x2ba2e1=events[_0x476790];var _0x42ace3=createListener('faxAccount:'+_0x2ba2e1,_0x52d42e);FaxAccountEvents['on'](_0x2ba2e1,_0x42ace3);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 40fbb9b..ee1408d 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(_0x500771,_0x1f3306){var _0xf9ce52=function(_0x1eb0ef){while(--_0x1eb0ef){_0x500771['push'](_0x500771['shift']());}};_0xf9ce52(++_0x1f3306);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x17d4ce,_0xdef672){var _0x5e9043=function(_0x4078d7){while(--_0x4078d7){_0x17d4ce['push'](_0x17d4ce['shift']());}};_0x5e9043(++_0xdef672);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 3fc87be..245d74f 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 _0x0918=['exports','INTEGER','STRING','*,*,*,*'];(function(_0xc84838,_0x47e144){var _0x5d14f9=function(_0xe4a36d){while(--_0xe4a36d){_0xc84838['push'](_0xc84838['shift']());}};_0x5d14f9(++_0x47e144);}(_0x0918,0x1b4));var _0x8091=function(_0x158245,_0x248176){_0x158245=_0x158245-0x0;var _0x3efcaa=_0x0918[_0x158245];return _0x3efcaa;};'use strict';var Sequelize=require('sequelize');module[_0x8091('0x0')]={'priority':{'type':Sequelize[_0x8091('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8091('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8091('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8091('0x3')}}; \ No newline at end of file +var _0x4861=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x365153,_0x18a7aa){var _0x5d5cd0=function(_0x27980d){while(--_0x27980d){_0x365153['push'](_0x365153['shift']());}};_0x5d5cd0(++_0x18a7aa);}(_0x4861,0x170));var _0x1486=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x4861[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');module[_0x1486('0x0')]={'priority':{'type':Sequelize[_0x1486('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1486('0x2')],'allowNull':![],'defaultValue':_0x1486('0x3')},'appdata':{'type':Sequelize[_0x1486('0x4')]()},'description':{'type':Sequelize[_0x1486('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1486('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index beeef7b..ffd3ff9 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 _0x7d8a=['json','apply','reject','save','update','then','destroy','end','stack','send','index','map','rawAttributes','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','name','options','FaxApplication','includeAll','include','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x3fc9d1,_0x10aa9a){var _0x971c7d=function(_0x493971){while(--_0x493971){_0x3fc9d1['push'](_0x3fc9d1['shift']());}};_0x971c7d(++_0x10aa9a);}(_0x7d8a,0x158));var _0xa7d8=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x7d8a[_0x420b24];return _0x4da552;};'use strict';var emlformat=require(_0xa7d8('0x0'));var rimraf=require(_0xa7d8('0x1'));var zipdir=require(_0xa7d8('0x2'));var jsonpatch=require(_0xa7d8('0x3'));var rp=require(_0xa7d8('0x4'));var moment=require(_0xa7d8('0x5'));var BPromise=require(_0xa7d8('0x6'));var Mustache=require(_0xa7d8('0x7'));var util=require('util');var path=require('path');var sox=require(_0xa7d8('0x8'));var csv=require(_0xa7d8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa7d8('0xa'));var squel=require('squel');var crypto=require(_0xa7d8('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa7d8('0x9'));var querystring=require(_0xa7d8('0xc'));var Papa=require(_0xa7d8('0xd'));var Redis=require(_0xa7d8('0xe'));var authService=require(_0xa7d8('0xf'));var qs=require(_0xa7d8('0x10'));var as=require(_0xa7d8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7d8('0x12'))(_0xa7d8('0x13'));var utils=require('../../config/utils');var config=require(_0xa7d8('0x14'));var licenseUtil=require(_0xa7d8('0x15'));var db=require(_0xa7d8('0x16'))['db'];function respondWithStatusCode(_0x5354e1,_0x189e20){_0x189e20=_0x189e20||0xcc;return function(_0x2c9f41){if(_0x2c9f41){return _0x5354e1[_0xa7d8('0x17')](_0x189e20);}return _0x5354e1[_0xa7d8('0x18')](_0x189e20)['end']();};}function respondWithResult(_0x3d2678,_0x2635c4){_0x2635c4=_0x2635c4||0xc8;return function(_0x14e8f1){if(_0x14e8f1){return _0x3d2678[_0xa7d8('0x18')](_0x2635c4)['json'](_0x14e8f1);}};}function respondWithFilteredResult(_0x72edf6,_0xb884bd){return function(_0x16d1c7){if(_0x16d1c7){var _0x1fb595=typeof _0xb884bd[_0xa7d8('0x19')]===_0xa7d8('0x1a')&&typeof _0xb884bd[_0xa7d8('0x1b')]===_0xa7d8('0x1a');var _0xa9ffdf=_0x16d1c7['count'];var _0x296996=_0x1fb595?0x0:_0xb884bd['offset'];var _0x375ee9=_0x1fb595?_0x16d1c7[_0xa7d8('0x1c')]:_0xb884bd['offset']+_0xb884bd['limit'];var _0x3bf348;if(_0x375ee9>=_0xa9ffdf){_0x375ee9=_0xa9ffdf;_0x3bf348=0xc8;}else{_0x3bf348=0xce;}_0x72edf6['status'](_0x3bf348);return _0x72edf6[_0xa7d8('0x1d')](_0xa7d8('0x1e'),_0x296996+'-'+_0x375ee9+'/'+_0xa9ffdf)[_0xa7d8('0x1f')](_0x16d1c7);}return null;};}function patchUpdates(_0x1969b0){return function(_0x28ead5){try{jsonpatch[_0xa7d8('0x20')](_0x28ead5,_0x1969b0,!![]);}catch(_0x2a0881){return BPromise[_0xa7d8('0x21')](_0x2a0881);}return _0x28ead5[_0xa7d8('0x22')]();};}function saveUpdates(_0x4b1cd7,_0x4dd06a){return function(_0xb0078){if(_0xb0078){return _0xb0078[_0xa7d8('0x23')](_0x4b1cd7)[_0xa7d8('0x24')](function(_0x335e09){return _0x335e09;});}return null;};}function removeEntity(_0x5ec4a3,_0x12ff52){return function(_0x110a41){if(_0x110a41){return _0x110a41[_0xa7d8('0x25')]()[_0xa7d8('0x24')](function(){_0x5ec4a3[_0xa7d8('0x18')](0xcc)[_0xa7d8('0x26')]();});}};}function handleEntityNotFound(_0x2b0b84,_0x44f3ca){return function(_0x53e123){if(!_0x53e123){_0x2b0b84[_0xa7d8('0x17')](0x194);}return _0x53e123;};}function handleError(_0x5d1a22,_0x4baa42){_0x4baa42=_0x4baa42||0x1f4;return function(_0x4028fc){logger['error'](_0x4028fc[_0xa7d8('0x27')]);if(_0x4028fc['name']){delete _0x4028fc['name'];}_0x5d1a22[_0xa7d8('0x18')](_0x4baa42)[_0xa7d8('0x28')](_0x4028fc);};}exports[_0xa7d8('0x29')]=function(_0x29de3b,_0x4814d8){var _0x2a297f={},_0x4cc846={},_0x5e97de={'count':0x0,'rows':[]};var _0x59a9cd=_[_0xa7d8('0x2a')](db['FaxApplication'][_0xa7d8('0x2b')],function(_0x19fb94){return{'name':_0x19fb94['fieldName'],'type':_0x19fb94[_0xa7d8('0x2c')][_0xa7d8('0x2d')]};});_0x4cc846['model']=_[_0xa7d8('0x2a')](_0x59a9cd,'name');_0x4cc846[_0xa7d8('0x2e')]=_['keys'](_0x29de3b[_0xa7d8('0x2e')]);_0x4cc846['filters']=_[_0xa7d8('0x2f')](_0x4cc846['model'],_0x4cc846['query']);_0x2a297f['attributes']=_[_0xa7d8('0x2f')](_0x4cc846[_0xa7d8('0x30')],qs[_0xa7d8('0x31')](_0x29de3b[_0xa7d8('0x2e')][_0xa7d8('0x31')]));_0x2a297f['attributes']=_0x2a297f[_0xa7d8('0x32')][_0xa7d8('0x33')]?_0x2a297f[_0xa7d8('0x32')]:_0x4cc846['model'];if(!_0x29de3b[_0xa7d8('0x2e')][_0xa7d8('0x34')](_0xa7d8('0x35'))){_0x2a297f[_0xa7d8('0x1b')]=qs[_0xa7d8('0x1b')](_0x29de3b[_0xa7d8('0x2e')][_0xa7d8('0x1b')]);_0x2a297f[_0xa7d8('0x19')]=qs[_0xa7d8('0x19')](_0x29de3b['query'][_0xa7d8('0x19')]);}_0x2a297f[_0xa7d8('0x36')]=qs[_0xa7d8('0x37')](_0x29de3b[_0xa7d8('0x2e')]['sort']);_0x2a297f[_0xa7d8('0x38')]=qs['filters'](_[_0xa7d8('0x39')](_0x29de3b[_0xa7d8('0x2e')],_0x4cc846[_0xa7d8('0x3a')]),_0x59a9cd);if(_0x29de3b[_0xa7d8('0x2e')][_0xa7d8('0x3b')]){_0x2a297f['where']=_[_0xa7d8('0x3c')](_0x2a297f['where'],{'$or':_[_0xa7d8('0x2a')](_0x59a9cd,function(_0x18aa30){if(_0x18aa30[_0xa7d8('0x2c')]!==_0xa7d8('0x3d')){var _0x51bdda={};_0x51bdda[_0x18aa30[_0xa7d8('0x3e')]]={'$like':'%'+_0x29de3b[_0xa7d8('0x2e')]['filter']+'%'};return _0x51bdda;}})});}_0x2a297f=_[_0xa7d8('0x3c')]({},_0x2a297f,_0x29de3b[_0xa7d8('0x3f')]);var _0x2dff64={'where':_0x2a297f[_0xa7d8('0x38')]};return db[_0xa7d8('0x40')][_0xa7d8('0x1c')](_0x2dff64)[_0xa7d8('0x24')](function(_0x42fde6){_0x5e97de[_0xa7d8('0x1c')]=_0x42fde6;if(_0x29de3b[_0xa7d8('0x2e')][_0xa7d8('0x41')]){_0x2a297f[_0xa7d8('0x42')]=[{'all':!![]}];}return db[_0xa7d8('0x40')]['findAll'](_0x2a297f);})[_0xa7d8('0x24')](function(_0x1558e2){_0x5e97de[_0xa7d8('0x43')]=_0x1558e2;return _0x5e97de;})[_0xa7d8('0x24')](respondWithFilteredResult(_0x4814d8,_0x2a297f))[_0xa7d8('0x44')](handleError(_0x4814d8,null));};exports[_0xa7d8('0x45')]=function(_0x3a0fe4,_0x3ac350){var _0x440d2e={'raw':!![],'where':{'id':_0x3a0fe4['params']['id']}},_0xbced5e={};_0xbced5e[_0xa7d8('0x30')]=_[_0xa7d8('0x46')](db[_0xa7d8('0x40')][_0xa7d8('0x2b')]);_0xbced5e[_0xa7d8('0x2e')]=_[_0xa7d8('0x46')](_0x3a0fe4[_0xa7d8('0x2e')]);_0xbced5e[_0xa7d8('0x3a')]=_[_0xa7d8('0x2f')](_0xbced5e[_0xa7d8('0x30')],_0xbced5e[_0xa7d8('0x2e')]);_0x440d2e[_0xa7d8('0x32')]=_['intersection'](_0xbced5e[_0xa7d8('0x30')],qs['fields'](_0x3a0fe4['query'][_0xa7d8('0x31')]));_0x440d2e[_0xa7d8('0x32')]=_0x440d2e[_0xa7d8('0x32')]['length']?_0x440d2e[_0xa7d8('0x32')]:_0xbced5e[_0xa7d8('0x30')];if(_0x3a0fe4[_0xa7d8('0x2e')][_0xa7d8('0x41')]){_0x440d2e[_0xa7d8('0x42')]=[{'all':!![]}];}_0x440d2e=_[_0xa7d8('0x3c')]({},_0x440d2e,_0x3a0fe4[_0xa7d8('0x3f')]);return db['FaxApplication'][_0xa7d8('0x47')](_0x440d2e)[_0xa7d8('0x24')](handleEntityNotFound(_0x3ac350,null))[_0xa7d8('0x24')](respondWithResult(_0x3ac350,null))[_0xa7d8('0x44')](handleError(_0x3ac350,null));};exports['create']=function(_0x334b08,_0x536b7f){return db[_0xa7d8('0x40')][_0xa7d8('0x48')](_0x334b08[_0xa7d8('0x49')],{})['then'](respondWithResult(_0x536b7f,0xc9))[_0xa7d8('0x44')](handleError(_0x536b7f,null));};exports[_0xa7d8('0x23')]=function(_0x25e0c1,_0x170e3a){if(_0x25e0c1[_0xa7d8('0x49')]['id']){delete _0x25e0c1['body']['id'];}return db[_0xa7d8('0x40')]['find']({'where':{'id':_0x25e0c1[_0xa7d8('0x4a')]['id']}})[_0xa7d8('0x24')](handleEntityNotFound(_0x170e3a,null))[_0xa7d8('0x24')](saveUpdates(_0x25e0c1[_0xa7d8('0x49')],null))['then'](respondWithResult(_0x170e3a,null))[_0xa7d8('0x44')](handleError(_0x170e3a,null));};exports[_0xa7d8('0x25')]=function(_0x4dfe33,_0x161353){return db['FaxApplication'][_0xa7d8('0x47')]({'where':{'id':_0x4dfe33[_0xa7d8('0x4a')]['id']}})[_0xa7d8('0x24')](handleEntityNotFound(_0x161353,null))['then'](removeEntity(_0x161353,null))[_0xa7d8('0x44')](handleError(_0x161353,null));}; \ No newline at end of file +var _0x5de8=['error','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x1bba84,_0x55eff0){var _0x36a324=function(_0x406aa4){while(--_0x406aa4){_0x1bba84['push'](_0x1bba84['shift']());}};_0x36a324(++_0x55eff0);}(_0x5de8,0x6f));var _0x85de=function(_0x142705,_0x209f68){_0x142705=_0x142705-0x0;var _0x24c857=_0x5de8[_0x142705];return _0x24c857;};'use strict';var emlformat=require(_0x85de('0x0'));var rimraf=require(_0x85de('0x1'));var zipdir=require(_0x85de('0x2'));var jsonpatch=require(_0x85de('0x3'));var rp=require(_0x85de('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x85de('0x5'));var util=require(_0x85de('0x6'));var path=require(_0x85de('0x7'));var sox=require(_0x85de('0x8'));var csv=require(_0x85de('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x85de('0xa'));var _=require(_0x85de('0xb'));var squel=require(_0x85de('0xc'));var crypto=require(_0x85de('0xd'));var jsforce=require(_0x85de('0xe'));var deskjs=require(_0x85de('0xf'));var toCsv=require(_0x85de('0x9'));var querystring=require(_0x85de('0x10'));var Papa=require('papaparse');var Redis=require(_0x85de('0x11'));var authService=require(_0x85de('0x12'));var qs=require(_0x85de('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85de('0x14'));var logger=require(_0x85de('0x15'))('api');var utils=require(_0x85de('0x16'));var config=require(_0x85de('0x17'));var licenseUtil=require(_0x85de('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4febbd,_0x3a321f){_0x3a321f=_0x3a321f||0xcc;return function(_0x1d5dd9){if(_0x1d5dd9){return _0x4febbd[_0x85de('0x19')](_0x3a321f);}return _0x4febbd[_0x85de('0x1a')](_0x3a321f)[_0x85de('0x1b')]();};}function respondWithResult(_0x4eef53,_0x4b3f0c){_0x4b3f0c=_0x4b3f0c||0xc8;return function(_0x56df0c){if(_0x56df0c){return _0x4eef53[_0x85de('0x1a')](_0x4b3f0c)[_0x85de('0x1c')](_0x56df0c);}};}function respondWithFilteredResult(_0x28c291,_0x39d207){return function(_0x2e3b66){if(_0x2e3b66){var _0x94a3ff=typeof _0x39d207[_0x85de('0x1d')]===_0x85de('0x1e')&&typeof _0x39d207['limit']===_0x85de('0x1e');var _0x45d689=_0x2e3b66[_0x85de('0x1f')];var _0x333527=_0x94a3ff?0x0:_0x39d207[_0x85de('0x1d')];var _0x56a069=_0x94a3ff?_0x2e3b66['count']:_0x39d207['offset']+_0x39d207[_0x85de('0x20')];var _0x272788;if(_0x56a069>=_0x45d689){_0x56a069=_0x45d689;_0x272788=0xc8;}else{_0x272788=0xce;}_0x28c291[_0x85de('0x1a')](_0x272788);return _0x28c291[_0x85de('0x21')](_0x85de('0x22'),_0x333527+'-'+_0x56a069+'/'+_0x45d689)[_0x85de('0x1c')](_0x2e3b66);}return null;};}function patchUpdates(_0x5a7e38){return function(_0x50fdfe){try{jsonpatch[_0x85de('0x23')](_0x50fdfe,_0x5a7e38,!![]);}catch(_0xd7e020){return BPromise[_0x85de('0x24')](_0xd7e020);}return _0x50fdfe[_0x85de('0x25')]();};}function saveUpdates(_0x475762,_0x2bc210){return function(_0x56d19e){if(_0x56d19e){return _0x56d19e[_0x85de('0x26')](_0x475762)['then'](function(_0x17a303){return _0x17a303;});}return null;};}function removeEntity(_0x54aeb1,_0xfaabe6){return function(_0x482654){if(_0x482654){return _0x482654[_0x85de('0x27')]()[_0x85de('0x28')](function(){_0x54aeb1[_0x85de('0x1a')](0xcc)[_0x85de('0x1b')]();});}};}function handleEntityNotFound(_0x39df9c,_0x598817){return function(_0x450453){if(!_0x450453){_0x39df9c[_0x85de('0x19')](0x194);}return _0x450453;};}function handleError(_0x3e9c17,_0xfc26d2){_0xfc26d2=_0xfc26d2||0x1f4;return function(_0x584d07){logger[_0x85de('0x29')](_0x584d07['stack']);if(_0x584d07[_0x85de('0x2a')]){delete _0x584d07[_0x85de('0x2a')];}_0x3e9c17['status'](_0xfc26d2)['send'](_0x584d07);};}exports[_0x85de('0x2b')]=function(_0x387094,_0x4a59cf){var _0x4641a2={},_0x5bc3f8={},_0x1ce952={'count':0x0,'rows':[]};var _0x40eb4c=_[_0x85de('0x2c')](db['FaxApplication'][_0x85de('0x2d')],function(_0x3af974){return{'name':_0x3af974['fieldName'],'type':_0x3af974[_0x85de('0x2e')][_0x85de('0x2f')]};});_0x5bc3f8[_0x85de('0x30')]=_['map'](_0x40eb4c,'name');_0x5bc3f8[_0x85de('0x31')]=_[_0x85de('0x32')](_0x387094['query']);_0x5bc3f8['filters']=_[_0x85de('0x33')](_0x5bc3f8[_0x85de('0x30')],_0x5bc3f8[_0x85de('0x31')]);_0x4641a2[_0x85de('0x34')]=_[_0x85de('0x33')](_0x5bc3f8[_0x85de('0x30')],qs[_0x85de('0x35')](_0x387094[_0x85de('0x31')][_0x85de('0x35')]));_0x4641a2['attributes']=_0x4641a2[_0x85de('0x34')]['length']?_0x4641a2[_0x85de('0x34')]:_0x5bc3f8[_0x85de('0x30')];if(!_0x387094[_0x85de('0x31')]['hasOwnProperty'](_0x85de('0x36'))){_0x4641a2['limit']=qs[_0x85de('0x20')](_0x387094[_0x85de('0x31')]['limit']);_0x4641a2['offset']=qs[_0x85de('0x1d')](_0x387094['query'][_0x85de('0x1d')]);}_0x4641a2[_0x85de('0x37')]=qs[_0x85de('0x38')](_0x387094[_0x85de('0x31')][_0x85de('0x38')]);_0x4641a2[_0x85de('0x39')]=qs[_0x85de('0x3a')](_[_0x85de('0x3b')](_0x387094[_0x85de('0x31')],_0x5bc3f8['filters']),_0x40eb4c);if(_0x387094[_0x85de('0x31')][_0x85de('0x3c')]){_0x4641a2['where']=_[_0x85de('0x3d')](_0x4641a2[_0x85de('0x39')],{'$or':_['map'](_0x40eb4c,function(_0x3a5957){if(_0x3a5957[_0x85de('0x2e')]!==_0x85de('0x3e')){var _0x729162={};_0x729162[_0x3a5957[_0x85de('0x2a')]]={'$like':'%'+_0x387094[_0x85de('0x31')][_0x85de('0x3c')]+'%'};return _0x729162;}})});}_0x4641a2=_[_0x85de('0x3d')]({},_0x4641a2,_0x387094[_0x85de('0x3f')]);var _0x4e7c3f={'where':_0x4641a2[_0x85de('0x39')]};return db[_0x85de('0x40')][_0x85de('0x1f')](_0x4e7c3f)['then'](function(_0x84b08a){_0x1ce952[_0x85de('0x1f')]=_0x84b08a;if(_0x387094[_0x85de('0x31')][_0x85de('0x41')]){_0x4641a2[_0x85de('0x42')]=[{'all':!![]}];}return db['FaxApplication'][_0x85de('0x43')](_0x4641a2);})[_0x85de('0x28')](function(_0x130ab2){_0x1ce952[_0x85de('0x44')]=_0x130ab2;return _0x1ce952;})[_0x85de('0x28')](respondWithFilteredResult(_0x4a59cf,_0x4641a2))[_0x85de('0x45')](handleError(_0x4a59cf,null));};exports[_0x85de('0x46')]=function(_0x36c33f,_0x371b34){var _0x299da5={'raw':!![],'where':{'id':_0x36c33f[_0x85de('0x47')]['id']}},_0x26c325={};_0x26c325[_0x85de('0x30')]=_['keys'](db[_0x85de('0x40')]['rawAttributes']);_0x26c325[_0x85de('0x31')]=_[_0x85de('0x32')](_0x36c33f[_0x85de('0x31')]);_0x26c325[_0x85de('0x3a')]=_['intersection'](_0x26c325[_0x85de('0x30')],_0x26c325['query']);_0x299da5[_0x85de('0x34')]=_[_0x85de('0x33')](_0x26c325[_0x85de('0x30')],qs[_0x85de('0x35')](_0x36c33f[_0x85de('0x31')][_0x85de('0x35')]));_0x299da5['attributes']=_0x299da5[_0x85de('0x34')][_0x85de('0x48')]?_0x299da5[_0x85de('0x34')]:_0x26c325['model'];if(_0x36c33f[_0x85de('0x31')][_0x85de('0x41')]){_0x299da5[_0x85de('0x42')]=[{'all':!![]}];}_0x299da5=_[_0x85de('0x3d')]({},_0x299da5,_0x36c33f[_0x85de('0x3f')]);return db[_0x85de('0x40')][_0x85de('0x49')](_0x299da5)[_0x85de('0x28')](handleEntityNotFound(_0x371b34,null))[_0x85de('0x28')](respondWithResult(_0x371b34,null))[_0x85de('0x45')](handleError(_0x371b34,null));};exports[_0x85de('0x4a')]=function(_0x90e4d9,_0x486c10){return db[_0x85de('0x40')]['create'](_0x90e4d9[_0x85de('0x4b')],{})[_0x85de('0x28')](respondWithResult(_0x486c10,0xc9))[_0x85de('0x45')](handleError(_0x486c10,null));};exports[_0x85de('0x26')]=function(_0x4b1ac7,_0x433889){if(_0x4b1ac7['body']['id']){delete _0x4b1ac7[_0x85de('0x4b')]['id'];}return db[_0x85de('0x40')][_0x85de('0x49')]({'where':{'id':_0x4b1ac7[_0x85de('0x47')]['id']}})[_0x85de('0x28')](handleEntityNotFound(_0x433889,null))[_0x85de('0x28')](saveUpdates(_0x4b1ac7['body'],null))['then'](respondWithResult(_0x433889,null))['catch'](handleError(_0x433889,null));};exports[_0x85de('0x27')]=function(_0x147cf6,_0x5b2a84){return db[_0x85de('0x40')]['find']({'where':{'id':_0x147cf6['params']['id']}})[_0x85de('0x28')](handleEntityNotFound(_0x5b2a84,null))['then'](removeEntity(_0x5b2a84,null))[_0x85de('0x45')](handleError(_0x5b2a84,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e2784c8..aeb4e95 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 _0x0eec=['moment','request-promise','path','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x0eec,0x1b6));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc0ee('0x0'));var util=require(_0xc0ee('0x1'));var logger=require(_0xc0ee('0x2'))(_0xc0ee('0x3'));var moment=require(_0xc0ee('0x4'));var BPromise=require('bluebird');var rp=require(_0xc0ee('0x5'));var fs=require('fs');var path=require(_0xc0ee('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc0ee('0x7'));module[_0xc0ee('0x8')]=function(_0x6b8139,_0x735fda){return _0x6b8139[_0xc0ee('0x9')]('FaxApplication',attributes,{'tableName':_0xc0ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc0ee('0xb'),'collate':_0xc0ee('0xc')});}; \ No newline at end of file +var _0xa0ca=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxApplication','utf8mb4_unicode_ci'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xa0ca,0x12b));var _0xaa0c=function(_0x386d37,_0x3e5e19){_0x386d37=_0x386d37-0x0;var _0x3f8016=_0xa0ca[_0x386d37];return _0x3f8016;};'use strict';var _=require(_0xaa0c('0x0'));var util=require(_0xaa0c('0x1'));var logger=require(_0xaa0c('0x2'))(_0xaa0c('0x3'));var moment=require(_0xaa0c('0x4'));var BPromise=require(_0xaa0c('0x5'));var rp=require(_0xaa0c('0x6'));var fs=require('fs');var path=require(_0xaa0c('0x7'));var rimraf=require(_0xaa0c('0x8'));var config=require(_0xaa0c('0x9'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x5a5663,_0x3e6f1d){return _0x5a5663[_0xaa0c('0xa')](_0xaa0c('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaa0c('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 65942e5..ae79f36 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 _0xea1c=['http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x274f60,_0x5f06aa){var _0x122887=function(_0x389e59){while(--_0x389e59){_0x274f60['push'](_0x274f60['shift']());}};_0x122887(++_0x5f06aa);}(_0xea1c,0xc1));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcea1('0x0'));var moment=require(_0xcea1('0x1'));var BPromise=require(_0xcea1('0x2'));var rs=require(_0xcea1('0x3'));var fs=require('fs');var Redis=require(_0xcea1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcea1('0x5'));var logger=require(_0xcea1('0x6'))('rpc');var config=require(_0xcea1('0x7'));var jayson=require(_0xcea1('0x8'));var client=jayson[_0xcea1('0x9')][_0xcea1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b97d7,_0x5875d1,_0x593e11){return new BPromise(function(_0x5c454d,_0x20ef17){return client['request'](_0x5b97d7,_0x593e11)[_0xcea1('0xb')](function(_0x1b7d73){logger['info'](_0xcea1('0xc'),_0x5875d1,_0xcea1('0xd'));logger[_0xcea1('0xe')](_0xcea1('0xf'),_0x5875d1,_0xcea1('0xd'),JSON['stringify'](_0x1b7d73));if(_0x1b7d73['error']){if(_0x1b7d73[_0xcea1('0x10')][_0xcea1('0x11')]===0x1f4){logger[_0xcea1('0x10')](_0xcea1('0xc'),_0x5875d1,_0x1b7d73['error']['message']);return _0x20ef17(_0x1b7d73['error'][_0xcea1('0x12')]);}logger[_0xcea1('0x10')](_0xcea1('0xc'),_0x5875d1,_0x1b7d73[_0xcea1('0x10')][_0xcea1('0x12')]);return _0x5c454d(_0x1b7d73['error'][_0xcea1('0x12')]);}else{logger['info'](_0xcea1('0xc'),_0x5875d1,_0xcea1('0xd'));_0x5c454d(_0x1b7d73[_0xcea1('0x13')]['message']);}})['catch'](function(_0x574300){logger[_0xcea1('0x10')]('FaxApplication,\x20%s,\x20%s',_0x5875d1,_0x574300);_0x20ef17(_0x574300);});});}exports[_0xcea1('0x14')]=function(_0x22c564){var _0x19b094=this;return new Promise(function(_0x140ea4,_0x3eb4da){return db[_0xcea1('0x15')][_0xcea1('0x16')](_0x22c564[_0xcea1('0x17')],{'raw':_0x22c564[_0xcea1('0x18')]?_0x22c564[_0xcea1('0x18')][_0xcea1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22c564[_0xcea1('0x18')]?_0x22c564['options'][_0xcea1('0x1a')]||null:null,'attributes':_0x22c564[_0xcea1('0x18')]?_0x22c564['options'][_0xcea1('0x1b')]||null:null,'limit':_0x22c564[_0xcea1('0x18')]?_0x22c564[_0xcea1('0x18')]['limit']||null:null})[_0xcea1('0xb')](function(_0x23f1c7){logger['info'](_0xcea1('0x14'),_0x22c564);logger[_0xcea1('0xe')](_0xcea1('0x14'),_0x22c564,JSON['stringify'](_0x23f1c7));_0x140ea4(_0x23f1c7);})[_0xcea1('0x1c')](function(_0x5b96e0){logger['error'](_0xcea1('0x14'),_0x5b96e0[_0xcea1('0x12')],_0x22c564);_0x3eb4da(_0x19b094['error'](0x1f4,_0x5b96e0[_0xcea1('0x12')]));});});}; \ No newline at end of file +var _0x91a5=['UpdateFaxApplication','FaxApplication','update','body','options','where','then','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x26369b,_0x55ed9c){var _0xad37b7=function(_0x79f703){while(--_0x79f703){_0x26369b['push'](_0x26369b['shift']());}};_0xad37b7(++_0x55ed9c);}(_0x91a5,0x78));var _0x591a=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x91a5[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require(_0x591a('0x0'));var util=require('util');var moment=require(_0x591a('0x1'));var BPromise=require(_0x591a('0x2'));var rs=require(_0x591a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x591a('0x4'))(_0x591a('0x5'));var config=require(_0x591a('0x6'));var jayson=require(_0x591a('0x7'));var client=jayson['client'][_0x591a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10dd2e,_0xc97542,_0x149d15){return new BPromise(function(_0x5773d5,_0x25af36){return client[_0x591a('0x9')](_0x10dd2e,_0x149d15)['then'](function(_0x5c43f2){logger[_0x591a('0xa')](_0x591a('0xb'),_0xc97542,_0x591a('0xc'));logger[_0x591a('0xd')](_0x591a('0xe'),_0xc97542,'request\x20sent',JSON[_0x591a('0xf')](_0x5c43f2));if(_0x5c43f2['error']){if(_0x5c43f2['error'][_0x591a('0x10')]===0x1f4){logger[_0x591a('0x11')](_0x591a('0xb'),_0xc97542,_0x5c43f2[_0x591a('0x11')][_0x591a('0x12')]);return _0x25af36(_0x5c43f2['error'][_0x591a('0x12')]);}logger[_0x591a('0x11')](_0x591a('0xb'),_0xc97542,_0x5c43f2[_0x591a('0x11')][_0x591a('0x12')]);return _0x5773d5(_0x5c43f2[_0x591a('0x11')][_0x591a('0x12')]);}else{logger[_0x591a('0xa')](_0x591a('0xb'),_0xc97542,_0x591a('0xc'));_0x5773d5(_0x5c43f2[_0x591a('0x13')]['message']);}})['catch'](function(_0x580f98){logger[_0x591a('0x11')](_0x591a('0xb'),_0xc97542,_0x580f98);_0x25af36(_0x580f98);});});}exports[_0x591a('0x14')]=function(_0x7915a3){var _0x132309=this;return new Promise(function(_0x4b4630,_0x382225){return db[_0x591a('0x15')][_0x591a('0x16')](_0x7915a3[_0x591a('0x17')],{'raw':_0x7915a3[_0x591a('0x18')]?_0x7915a3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7915a3[_0x591a('0x18')]?_0x7915a3[_0x591a('0x18')][_0x591a('0x19')]||null:null,'attributes':_0x7915a3[_0x591a('0x18')]?_0x7915a3[_0x591a('0x18')]['attributes']||null:null,'limit':_0x7915a3[_0x591a('0x18')]?_0x7915a3[_0x591a('0x18')]['limit']||null:null})[_0x591a('0x1a')](function(_0x3303d5){logger[_0x591a('0xa')](_0x591a('0x14'),_0x7915a3);logger[_0x591a('0xd')](_0x591a('0x14'),_0x7915a3,JSON[_0x591a('0xf')](_0x3303d5));_0x4b4630(_0x3303d5);})[_0x591a('0x1b')](function(_0x3887ef){logger[_0x591a('0x11')](_0x591a('0x14'),_0x3887ef[_0x591a('0x12')],_0x7915a3);_0x382225(_0x132309[_0x591a('0x11')](0x1f4,_0x3887ef[_0x591a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 188e43c..2f77c68 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 _0xefda=['post','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xefda,0x96));var _0xaefd=function(_0x51fdc7,_0x1cb68f){_0x51fdc7=_0x51fdc7-0x0;var _0x3becb8=_0xefda[_0x51fdc7];return _0x3becb8;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['show']);router[_0xaefd('0xc')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaefd('0xe')]);router[_0xaefd('0xf')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x10')]);module[_0xaefd('0x11')]=router; \ No newline at end of file +var _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x4c710e,_0x127b8b){_0x4c710e=_0x4c710e-0x0;var _0x29c35c=_0xd7d1[_0x4c710e];return _0x29c35c;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 5509fa2..e76ea12 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 _0xfec5=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xfec5,0xba));var _0x5fec=function(_0x3c1822,_0x11b1f1){_0x3c1822=_0x3c1822-0x0;var _0x4edab5=_0xfec5[_0x3c1822];return _0x4edab5;};'use strict';var Sequelize=require(_0x5fec('0x0'));module[_0x5fec('0x1')]={'closed':{'type':Sequelize[_0x5fec('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5fec('0x3')]},'disposition':{'type':Sequelize[_0x5fec('0x4')]},'secondDisposition':{'type':Sequelize[_0x5fec('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5fec('0x4')]},'note':{'type':Sequelize[_0x5fec('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x5fec('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x5fec('0x5')]('in',_0x5fec('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5fec('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5fec('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xf903=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x32d917,_0x1010f1){var _0x39d97a=function(_0x1732ee){while(--_0x1732ee){_0x32d917['push'](_0x32d917['shift']());}};_0x39d97a(++_0x1010f1);}(_0xf903,0xa6));var _0x3f90=function(_0x2c8661,_0x212022){_0x2c8661=_0x2c8661-0x0;var _0x395c74=_0xf903[_0x2c8661];return _0x395c74;};'use strict';var Sequelize=require(_0x3f90('0x0'));module[_0x3f90('0x1')]={'closed':{'type':Sequelize[_0x3f90('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3f90('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3f90('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3f90('0x3')]},'fax':{'type':Sequelize[_0x3f90('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3f90('0x5')]('in',_0x3f90('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3f90('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3f90('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 aa305d4..c59d6eb 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 _0x8933=['user','catch','show','params','model','keys','query','intersection','attributes','fields','includeAll','include','merge','options','FaxInteraction','create','body','update','find','describe','FaxMessage','ids','getMessages','findOne','rawAttributes','filters','length','hasOwnProperty','nolimit','order','sort','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','omit','spread','Tag','color','emit','faxInteractionTags:save','join','root','server','files','tmp','attachments','format','push','Attachment','createdAt','get','mkdirSync','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','download','log','err','rimraf','zip-dir','bluebird','util','lodash','ioredis','../../components/interaction/service','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','stack','name','send','map','fieldName','key','getOptions','findAll','fax'];(function(_0x2bba18,_0x317987){var _0x3576af=function(_0x2cbee4){while(--_0x2cbee4){_0x2bba18['push'](_0x2bba18['shift']());}};_0x3576af(++_0x317987);}(_0x8933,0x177));var _0x3893=function(_0x5d0f6e,_0x56884){_0x5d0f6e=_0x5d0f6e-0x0;var _0x373f3f=_0x8933[_0x5d0f6e];return _0x373f3f;};'use strict';var rimraf=require(_0x3893('0x0'));var zipdir=require(_0x3893('0x1'));var moment=require('moment');var BPromise=require(_0x3893('0x2'));var util=require(_0x3893('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x3893('0x4'));var Redis=require(_0x3893('0x5'));var interaction=require(_0x3893('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3893('0x7'));var config=require(_0x3893('0x8'));var db=require(_0x3893('0x9'))['db'];config['redis']=_[_0x3893('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3893('0xb'))(new Redis(config[_0x3893('0xc')]));require(_0x3893('0xd'))[_0x3893('0xe')](socket);function respondWithStatusCode(_0x1ff968,_0x28c334){_0x28c334=_0x28c334||0xcc;return function(_0x442d4c){if(_0x442d4c){return _0x1ff968[_0x3893('0xf')](_0x28c334);}return _0x1ff968[_0x3893('0x10')](_0x28c334)[_0x3893('0x11')]();};}function respondWithResult(_0x51768c,_0x4bc7f2){_0x4bc7f2=_0x4bc7f2||0xc8;return function(_0x533d8d){if(_0x533d8d){return _0x51768c['status'](_0x4bc7f2)[_0x3893('0x12')](_0x533d8d);}};}function respondWithFilteredResult(_0x57a058,_0x25c64c){return function(_0x362555){if(_0x362555){var _0x236a91=typeof _0x25c64c[_0x3893('0x13')]===_0x3893('0x14')&&typeof _0x25c64c['limit']===_0x3893('0x14');var _0x364b7c=_0x362555[_0x3893('0x15')];var _0x607e67=_0x236a91?0x0:_0x25c64c['offset'];var _0x328122=_0x236a91?_0x362555[_0x3893('0x15')]:_0x25c64c['offset']+_0x25c64c[_0x3893('0x16')];var _0x5814a0;if(_0x328122>=_0x364b7c){_0x328122=_0x364b7c;_0x5814a0=0xc8;}else{_0x5814a0=0xce;}_0x57a058['status'](_0x5814a0);return _0x57a058[_0x3893('0x17')](_0x3893('0x18'),_0x607e67+'-'+_0x328122+'/'+_0x364b7c)['json'](_0x362555);}return null;};}function saveUpdates(_0x4d3417){return function(_0x2f69b2){if(_0x2f69b2){return _0x2f69b2['update'](_0x4d3417)[_0x3893('0x19')](function(_0x1230ae){return _0x1230ae;});}return null;};}function removeEntity(_0x6e7ceb){return function(_0x3b8327){if(_0x3b8327){return _0x3b8327[_0x3893('0x1a')]()[_0x3893('0x19')](function(){_0x6e7ceb['status'](0xcc)[_0x3893('0x11')]();});}};}function handleEntityNotFound(_0x4e1086){return function(_0x201b6d){if(!_0x201b6d){_0x4e1086[_0x3893('0xf')](0x194);}return _0x201b6d;};}function handleError(_0x4c6e76,_0x333aac){_0x333aac=_0x333aac||0x1f4;return function(_0x3bfdf6){logger[_0x3893('0x1b')](_0x3bfdf6[_0x3893('0x1c')]);if(_0x3bfdf6[_0x3893('0x1d')]){delete _0x3bfdf6['name'];}_0x4c6e76['status'](_0x333aac)[_0x3893('0x1e')](_0x3bfdf6);};}exports['index']=function(_0x64e1c,_0x4cac6f){var _0xa048ab={};var _0x32be2d=_[_0x3893('0x1f')](db['FaxInteraction']['rawAttributes'],function(_0x3e6d39){return{'name':_0x3e6d39[_0x3893('0x20')],'type':_0x3e6d39['type'][_0x3893('0x21')]};});_0xa048ab=qs[_0x3893('0x22')](_0x32be2d,_0x64e1c);return interaction[_0x3893('0x23')](_0x3893('0x24'),_0x64e1c['query'],_0x64e1c[_0x3893('0x25')],_0xa048ab,_0x32be2d)[_0x3893('0x19')](respondWithFilteredResult(_0x4cac6f,_0xa048ab))[_0x3893('0x26')](handleError(_0x4cac6f,null));};exports[_0x3893('0x27')]=function(_0x93615a,_0x12c87f){var _0x5f51f6={'raw':![],'where':{'id':_0x93615a[_0x3893('0x28')]['id']}},_0x592574={};_0x592574[_0x3893('0x29')]=_[_0x3893('0x2a')](db['FaxInteraction']['rawAttributes']);_0x592574[_0x3893('0x2b')]=_[_0x3893('0x2a')](_0x93615a[_0x3893('0x2b')]);_0x592574['filters']=_[_0x3893('0x2c')](_0x592574[_0x3893('0x29')],_0x592574['query']);_0x5f51f6[_0x3893('0x2d')]=_[_0x3893('0x2c')](_0x592574['model'],qs[_0x3893('0x2e')](_0x93615a[_0x3893('0x2b')][_0x3893('0x2e')]));_0x5f51f6[_0x3893('0x2d')]=_0x5f51f6['attributes']['length']?_0x5f51f6[_0x3893('0x2d')]:_0x592574['model'];if(_0x93615a[_0x3893('0x2b')][_0x3893('0x2f')]){_0x5f51f6[_0x3893('0x30')]=[{'all':!![]}];}_0x5f51f6=_[_0x3893('0x31')]({},_0x5f51f6,_0x93615a[_0x3893('0x32')]);return db[_0x3893('0x33')]['find'](_0x5f51f6)[_0x3893('0x19')](handleEntityNotFound(_0x12c87f,null))[_0x3893('0x19')](respondWithResult(_0x12c87f,null))[_0x3893('0x26')](handleError(_0x12c87f,null));};exports['create']=function(_0x4a278e,_0x59f8d0){return db[_0x3893('0x33')][_0x3893('0x34')](_0x4a278e[_0x3893('0x35')],{})[_0x3893('0x19')](respondWithResult(_0x59f8d0,0xc9))[_0x3893('0x26')](handleError(_0x59f8d0,null));};exports[_0x3893('0x36')]=function(_0x751368,_0x1777d4){if(_0x751368[_0x3893('0x35')]['id']){delete _0x751368[_0x3893('0x35')]['id'];}return db[_0x3893('0x33')][_0x3893('0x37')]({'where':{'id':_0x751368[_0x3893('0x28')]['id']}})[_0x3893('0x19')](handleEntityNotFound(_0x1777d4,null))[_0x3893('0x19')](saveUpdates(_0x751368[_0x3893('0x35')],null))[_0x3893('0x19')](respondWithResult(_0x1777d4,null))[_0x3893('0x26')](handleError(_0x1777d4,null));};exports[_0x3893('0x1a')]=function(_0x4f7ad7,_0x407594){return db['FaxInteraction'][_0x3893('0x37')]({'where':{'id':_0x4f7ad7[_0x3893('0x28')]['id']}})[_0x3893('0x19')](handleEntityNotFound(_0x407594,null))['then'](removeEntity(_0x407594,null))[_0x3893('0x26')](handleError(_0x407594,null));};exports['describe']=function(_0x421d38,_0x326f57){return db[_0x3893('0x33')][_0x3893('0x38')]()[_0x3893('0x19')](respondWithResult(_0x326f57,null))[_0x3893('0x26')](handleError(_0x326f57,null));};exports['addMessage']=function(_0x50b0ba,_0x2ae869){return db[_0x3893('0x39')][_0x3893('0x37')]({'where':{'id':_0x50b0ba['params']['id']}})['then'](handleEntityNotFound(_0x2ae869,null))['then'](function(_0x44f3a5){if(_0x44f3a5){return _0x44f3a5['addMessage'](_0x50b0ba[_0x3893('0x35')][_0x3893('0x3a')],_['omit'](_0x50b0ba[_0x3893('0x35')],[_0x3893('0x3a'),'id'])||{});}})[_0x3893('0x19')](respondWithResult(_0x2ae869,null))[_0x3893('0x26')](handleError(_0x2ae869,null));};exports[_0x3893('0x3b')]=function(_0x5d649a,_0x1a137a){var _0x4af2c3={'raw':![],'where':{}};var _0x5bf0b3={};var _0xbea39={'count':0x0,'rows':[]};return db[_0x3893('0x33')][_0x3893('0x3c')]({'where':{'id':_0x5d649a[_0x3893('0x28')]['id']}})[_0x3893('0x19')](handleEntityNotFound(_0x1a137a,null))[_0x3893('0x19')](function(_0x3a0896){if(_0x3a0896){_0x5bf0b3['model']=_[_0x3893('0x2a')](db['FaxMessage'][_0x3893('0x3d')]);_0x5bf0b3[_0x3893('0x2b')]=_[_0x3893('0x2a')](_0x5d649a[_0x3893('0x2b')]);_0x5bf0b3[_0x3893('0x3e')]=_[_0x3893('0x2c')](_0x5bf0b3['model'],_0x5bf0b3[_0x3893('0x2b')]);_0x4af2c3[_0x3893('0x2d')]=_['intersection'](_0x5bf0b3[_0x3893('0x29')],qs['fields'](_0x5d649a[_0x3893('0x2b')][_0x3893('0x2e')]));_0x4af2c3[_0x3893('0x2d')]=_0x4af2c3['attributes'][_0x3893('0x3f')]?_0x4af2c3[_0x3893('0x2d')]:_0x5bf0b3['model'];if(!_0x5d649a['query'][_0x3893('0x40')](_0x3893('0x41'))){_0x4af2c3['limit']=qs[_0x3893('0x16')](_0x5d649a['query'][_0x3893('0x16')]);_0x4af2c3[_0x3893('0x13')]=qs[_0x3893('0x13')](_0x5d649a[_0x3893('0x2b')][_0x3893('0x13')]);}_0x4af2c3[_0x3893('0x42')]=qs[_0x3893('0x43')](_0x5d649a[_0x3893('0x2b')][_0x3893('0x43')]);_0x4af2c3[_0x3893('0x44')]=qs[_0x3893('0x3e')](_['pick'](_0x5d649a[_0x3893('0x2b')],_0x5bf0b3[_0x3893('0x3e')]));_0x4af2c3[_0x3893('0x44')]['FaxInteractionId']=_0x3a0896['id'];if(_0x5d649a['query'][_0x3893('0x45')]){_0x4af2c3[_0x3893('0x44')]=_[_0x3893('0x31')](_0x4af2c3['where'],{'$or':_[_0x3893('0x1f')](_0x4af2c3['attributes'],function(_0x37dd80){var _0xbcd6eb={};_0xbcd6eb[_0x37dd80]={'$like':'%'+_0x5d649a[_0x3893('0x2b')]['filter']+'%'};return _0xbcd6eb;})});}if(_0x5d649a[_0x3893('0x2b')][_0x3893('0x46')]){var _0x8c6509=_0x5d649a['query'][_0x3893('0x46')][_0x3893('0x47')](',');var _0x52f20a={};_0x52f20a[_0x8c6509[0x0]]={'$gte':moment(_0x8c6509[0x1])['format'](_0x3893('0x48'))};_0x4af2c3[_0x3893('0x44')]=_[_0x3893('0x31')](_0x4af2c3[_0x3893('0x44')],_0x52f20a);}_0x4af2c3=_[_0x3893('0x31')]({},_0x4af2c3,_0x5d649a[_0x3893('0x32')]);return db[_0x3893('0x39')][_0x3893('0x15')]({'where':_0x4af2c3[_0x3893('0x44')]})[_0x3893('0x19')](function(_0x2f8378){_0xbea39['count']=_0x2f8378;if(_0x5d649a['query']['includeAll']){_0x4af2c3[_0x3893('0x30')]=[{'all':!![]}];}return db[_0x3893('0x39')][_0x3893('0x23')](_0x4af2c3);})['then'](function(_0x4340e5){_0xbea39[_0x3893('0x49')]=_0x4340e5;return _0xbea39;});}})[_0x3893('0x19')](respondWithFilteredResult(_0x1a137a,_0x4af2c3))[_0x3893('0x26')](handleError(_0x1a137a,null));};exports['addTags']=function(_0x3b17cb,_0x8d1d45){return db[_0x3893('0x33')]['find']({'where':{'id':_0x3b17cb[_0x3893('0x28')]['id']}})[_0x3893('0x19')](handleEntityNotFound(_0x8d1d45,null))[_0x3893('0x19')](function(_0x112a98){if(_0x112a98){return _0x112a98[_0x3893('0x4a')](_0x3b17cb[_0x3893('0x35')][_0x3893('0x3a')],_[_0x3893('0x4b')](_0x3b17cb[_0x3893('0x35')],[_0x3893('0x3a'),'id'])||{})[_0x3893('0x4c')](function(){return db[_0x3893('0x4d')][_0x3893('0x23')]({'attributes':['id',_0x3893('0x1d'),_0x3893('0x4e')],'where':{'id':_0x3b17cb[_0x3893('0x35')][_0x3893('0x3a')]}});})[_0x3893('0x19')](function(_0x19ca54){socket[_0x3893('0x4f')](_0x3893('0x50'),{'id':Number(_0x3b17cb[_0x3893('0x28')]['id']),'tags':_0x19ca54||[]});return{'id':Number(_0x3b17cb[_0x3893('0x28')]['id']),'tags':_0x19ca54||[]};});}})[_0x3893('0x19')](respondWithResult(_0x8d1d45,null))[_0x3893('0x26')](handleError(_0x8d1d45,null));};exports['removeTags']=function(_0x1b4c8b,_0x21be23){return db[_0x3893('0x33')][_0x3893('0x37')]({'where':{'id':_0x1b4c8b['params']['id']}})[_0x3893('0x19')](handleEntityNotFound(_0x21be23,null))[_0x3893('0x19')](function(_0x3cf1f8){if(_0x3cf1f8){return _0x3cf1f8['removeTags'](_0x1b4c8b[_0x3893('0x2b')][_0x3893('0x3a')]);}})[_0x3893('0x19')](respondWithStatusCode(_0x21be23,null))[_0x3893('0x26')](handleError(_0x21be23,null));};exports['download']=function(_0x3b0695,_0x2006e6){var _0x3dbe3c=moment()['unix']()['toString']();var _0x20c5d4=path[_0x3893('0x51')](config[_0x3893('0x52')],_0x3893('0x53'),_0x3893('0x54'),_0x3893('0x55'));var _0x41b2ff=path[_0x3893('0x51')](config[_0x3893('0x52')],_0x3893('0x53'),_0x3893('0x54'),_0x3893('0x56'));var _0xdc5928=path[_0x3893('0x51')](_0x20c5d4,_0x3dbe3c);var _0x2fd897=util[_0x3893('0x57')]('transcript-%d-%s.zip',_0x3b0695[_0x3893('0x28')]['id'],_0x3dbe3c);var _0x4268fe=path[_0x3893('0x51')](_0x20c5d4,_0x2fd897);var _0x50bfff=[];_0x50bfff[_0x3893('0x58')]({'model':db[_0x3893('0x59')],'as':_0x3893('0x59'),'raw':!![]});var _0xa25362=[{'model':db[_0x3893('0x39')],'as':'Messages','attributes':['id','body',_0x3893('0x5a')],'include':_0x50bfff}];return db[_0x3893('0x33')][_0x3893('0x37')]({'where':{'id':_0x3b0695[_0x3893('0x28')]['id']},'include':_0xa25362})[_0x3893('0x19')](handleEntityNotFound(_0x2006e6,null))[_0x3893('0x19')](function(_0x4102fa){if(_0x4102fa&&_0x4102fa['Messages']){var _0x42c8c5=_0x4102fa[_0x3893('0x5b')]({'plain':!![]});fs[_0x3893('0x5c')](_0xdc5928);for(var _0x19a448=0x0;_0x19a448<_0x42c8c5[_0x3893('0x5d')][_0x3893('0x3f')];_0x19a448++){var _0x190093=_0x42c8c5[_0x3893('0x5d')][_0x19a448][_0x3893('0x59')];if(_0x190093){var _0x5da638=path[_0x3893('0x51')](_0x41b2ff,_0x190093[_0x3893('0x5e')]);if(fs[_0x3893('0x5f')](_0x5da638)){fs[_0x3893('0x60')](_0x5da638)[_0x3893('0x61')](fs[_0x3893('0x62')](path['join'](_0xdc5928,_0x190093['basename'])));}}}return BPromise[_0x3893('0x63')]()['then'](function(){return new BPromise(function(_0x2e841c,_0x13b2c5){zipdir(_0xdc5928,{'saveTo':_0x4268fe},function(_0x13fd21,_0x3793c6){if(_0x13fd21)return _0x13b2c5(_0x13fd21);return _0x2e841c(_0x3793c6);});})[_0x3893('0x19')](function(){return new BPromise(function(_0x9306b0,_0xf06884){rimraf(_0xdc5928,function(_0x20aa41){if(_0x20aa41)_0xf06884(_0x20aa41);return _0x9306b0();});});})['then'](function(){return _0x2006e6[_0x3893('0x64')](_0x4268fe,_0x2fd897,function(_0x1f5e94){if(_0x1f5e94){console[_0x3893('0x65')](_0x3893('0x66'),_0x1f5e94);}else{fs['unlinkSync'](_0x4268fe);}});});});}else{return _0x2006e6['sendStatus'](0xc8);}})[_0x3893('0x26')](handleError(_0x2006e6,null));}; \ No newline at end of file +var _0x5490=['createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','resolve','log','err','unlinkSync','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','findAll','fax','query','user','show','keys','filters','model','intersection','attributes','length','include','options','find','create','body','catch','params','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','fields','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','includeAll','rows','addTags','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','Attachment','Messages'];(function(_0x1d45da,_0x2d99b0){var _0x106f6f=function(_0x269839){while(--_0x269839){_0x1d45da['push'](_0x1d45da['shift']());}};_0x106f6f(++_0x2d99b0);}(_0x5490,0x152));var _0x0549=function(_0x2b99f9,_0x350594){_0x2b99f9=_0x2b99f9-0x0;var _0x4077df=_0x5490[_0x2b99f9];return _0x4077df;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0549('0x0'));var moment=require(_0x0549('0x1'));var BPromise=require(_0x0549('0x2'));var util=require(_0x0549('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0549('0x4'));var Redis=require(_0x0549('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x0549('0x6'));var logger=require(_0x0549('0x7'))(_0x0549('0x8'));var config=require(_0x0549('0x9'));var db=require(_0x0549('0xa'))['db'];config['redis']=_[_0x0549('0xb')](config[_0x0549('0xc')],{'host':_0x0549('0xd'),'port':0x18eb});var socket=require(_0x0549('0xe'))(new Redis(config[_0x0549('0xc')]));require(_0x0549('0xf'))['register'](socket);function respondWithStatusCode(_0x1fb3cb,_0x13e107){_0x13e107=_0x13e107||0xcc;return function(_0x2debe7){if(_0x2debe7){return _0x1fb3cb[_0x0549('0x10')](_0x13e107);}return _0x1fb3cb[_0x0549('0x11')](_0x13e107)[_0x0549('0x12')]();};}function respondWithResult(_0x5cbe4d,_0x1f1057){_0x1f1057=_0x1f1057||0xc8;return function(_0x272aae){if(_0x272aae){return _0x5cbe4d['status'](_0x1f1057)[_0x0549('0x13')](_0x272aae);}};}function respondWithFilteredResult(_0x2aac61,_0x23ea0a){return function(_0x547b69){if(_0x547b69){var _0x12f9c6=typeof _0x23ea0a[_0x0549('0x14')]==='undefined'&&typeof _0x23ea0a[_0x0549('0x15')]===_0x0549('0x16');var _0xbae0f6=_0x547b69[_0x0549('0x17')];var _0x16733a=_0x12f9c6?0x0:_0x23ea0a[_0x0549('0x14')];var _0x2d84f9=_0x12f9c6?_0x547b69[_0x0549('0x17')]:_0x23ea0a[_0x0549('0x14')]+_0x23ea0a['limit'];var _0x53565f;if(_0x2d84f9>=_0xbae0f6){_0x2d84f9=_0xbae0f6;_0x53565f=0xc8;}else{_0x53565f=0xce;}_0x2aac61[_0x0549('0x11')](_0x53565f);return _0x2aac61[_0x0549('0x18')](_0x0549('0x19'),_0x16733a+'-'+_0x2d84f9+'/'+_0xbae0f6)['json'](_0x547b69);}return null;};}function saveUpdates(_0x23ecb4){return function(_0x5e8df0){if(_0x5e8df0){return _0x5e8df0[_0x0549('0x1a')](_0x23ecb4)[_0x0549('0x1b')](function(_0x2c5f5a){return _0x2c5f5a;});}return null;};}function removeEntity(_0xaffb82){return function(_0x4d6cb5){if(_0x4d6cb5){return _0x4d6cb5[_0x0549('0x1c')]()[_0x0549('0x1b')](function(){_0xaffb82['status'](0xcc)[_0x0549('0x12')]();});}};}function handleEntityNotFound(_0x110d89){return function(_0x45a472){if(!_0x45a472){_0x110d89[_0x0549('0x10')](0x194);}return _0x45a472;};}function handleError(_0x245883,_0x480b65){_0x480b65=_0x480b65||0x1f4;return function(_0x524d69){logger['error'](_0x524d69[_0x0549('0x1d')]);if(_0x524d69[_0x0549('0x1e')]){delete _0x524d69[_0x0549('0x1e')];}_0x245883[_0x0549('0x11')](_0x480b65)[_0x0549('0x1f')](_0x524d69);};}exports[_0x0549('0x20')]=function(_0x2dd9ba,_0x35a6af){var _0x1518d4={};var _0x257265=_[_0x0549('0x21')](db[_0x0549('0x22')][_0x0549('0x23')],function(_0x388762){return{'name':_0x388762[_0x0549('0x24')],'type':_0x388762[_0x0549('0x25')][_0x0549('0x26')]};});_0x1518d4=qs['getOptions'](_0x257265,_0x2dd9ba);return interaction[_0x0549('0x27')](_0x0549('0x28'),_0x2dd9ba[_0x0549('0x29')],_0x2dd9ba[_0x0549('0x2a')],_0x1518d4,_0x257265)[_0x0549('0x1b')](respondWithFilteredResult(_0x35a6af,_0x1518d4))['catch'](handleError(_0x35a6af,null));};exports[_0x0549('0x2b')]=function(_0x2d5812,_0xfe4f15){var _0x44bbf9={'raw':![],'where':{'id':_0x2d5812['params']['id']}},_0x51372b={};_0x51372b['model']=_[_0x0549('0x2c')](db['FaxInteraction']['rawAttributes']);_0x51372b['query']=_[_0x0549('0x2c')](_0x2d5812[_0x0549('0x29')]);_0x51372b[_0x0549('0x2d')]=_['intersection'](_0x51372b[_0x0549('0x2e')],_0x51372b[_0x0549('0x29')]);_0x44bbf9['attributes']=_[_0x0549('0x2f')](_0x51372b[_0x0549('0x2e')],qs['fields'](_0x2d5812[_0x0549('0x29')]['fields']));_0x44bbf9[_0x0549('0x30')]=_0x44bbf9[_0x0549('0x30')][_0x0549('0x31')]?_0x44bbf9[_0x0549('0x30')]:_0x51372b[_0x0549('0x2e')];if(_0x2d5812['query']['includeAll']){_0x44bbf9[_0x0549('0x32')]=[{'all':!![]}];}_0x44bbf9=_['merge']({},_0x44bbf9,_0x2d5812[_0x0549('0x33')]);return db[_0x0549('0x22')][_0x0549('0x34')](_0x44bbf9)['then'](handleEntityNotFound(_0xfe4f15,null))[_0x0549('0x1b')](respondWithResult(_0xfe4f15,null))['catch'](handleError(_0xfe4f15,null));};exports['create']=function(_0x466977,_0x551c00){return db['FaxInteraction'][_0x0549('0x35')](_0x466977[_0x0549('0x36')],{})[_0x0549('0x1b')](respondWithResult(_0x551c00,0xc9))[_0x0549('0x37')](handleError(_0x551c00,null));};exports[_0x0549('0x1a')]=function(_0x54909c,_0x40c8ad){if(_0x54909c[_0x0549('0x36')]['id']){delete _0x54909c[_0x0549('0x36')]['id'];}return db[_0x0549('0x22')][_0x0549('0x34')]({'where':{'id':_0x54909c[_0x0549('0x38')]['id']}})[_0x0549('0x1b')](handleEntityNotFound(_0x40c8ad,null))[_0x0549('0x1b')](saveUpdates(_0x54909c['body'],null))[_0x0549('0x1b')](respondWithResult(_0x40c8ad,null))[_0x0549('0x37')](handleError(_0x40c8ad,null));};exports[_0x0549('0x1c')]=function(_0xb04a67,_0x5d9c16){return db[_0x0549('0x22')]['find']({'where':{'id':_0xb04a67[_0x0549('0x38')]['id']}})[_0x0549('0x1b')](handleEntityNotFound(_0x5d9c16,null))[_0x0549('0x1b')](removeEntity(_0x5d9c16,null))['catch'](handleError(_0x5d9c16,null));};exports['describe']=function(_0x57b055,_0x501171){return db[_0x0549('0x22')][_0x0549('0x39')]()[_0x0549('0x1b')](respondWithResult(_0x501171,null))[_0x0549('0x37')](handleError(_0x501171,null));};exports[_0x0549('0x3a')]=function(_0x1729e0,_0x4632ed){return db[_0x0549('0x3b')][_0x0549('0x34')]({'where':{'id':_0x1729e0[_0x0549('0x38')]['id']}})[_0x0549('0x1b')](handleEntityNotFound(_0x4632ed,null))[_0x0549('0x1b')](function(_0x2b3da7){if(_0x2b3da7){return _0x2b3da7['addMessage'](_0x1729e0[_0x0549('0x36')]['ids'],_[_0x0549('0x3c')](_0x1729e0[_0x0549('0x36')],[_0x0549('0x3d'),'id'])||{});}})[_0x0549('0x1b')](respondWithResult(_0x4632ed,null))[_0x0549('0x37')](handleError(_0x4632ed,null));};exports[_0x0549('0x3e')]=function(_0x3d7674,_0x1672d5){var _0xffd48e={'raw':![],'where':{}};var _0x340958={};var _0x3496b9={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x0549('0x3f')]({'where':{'id':_0x3d7674[_0x0549('0x38')]['id']}})['then'](handleEntityNotFound(_0x1672d5,null))[_0x0549('0x1b')](function(_0x267dd9){if(_0x267dd9){_0x340958[_0x0549('0x2e')]=_['keys'](db[_0x0549('0x3b')][_0x0549('0x23')]);_0x340958[_0x0549('0x29')]=_[_0x0549('0x2c')](_0x3d7674[_0x0549('0x29')]);_0x340958[_0x0549('0x2d')]=_[_0x0549('0x2f')](_0x340958[_0x0549('0x2e')],_0x340958[_0x0549('0x29')]);_0xffd48e[_0x0549('0x30')]=_[_0x0549('0x2f')](_0x340958[_0x0549('0x2e')],qs['fields'](_0x3d7674['query'][_0x0549('0x40')]));_0xffd48e[_0x0549('0x30')]=_0xffd48e[_0x0549('0x30')][_0x0549('0x31')]?_0xffd48e[_0x0549('0x30')]:_0x340958[_0x0549('0x2e')];if(!_0x3d7674['query'][_0x0549('0x41')](_0x0549('0x42'))){_0xffd48e[_0x0549('0x15')]=qs['limit'](_0x3d7674['query']['limit']);_0xffd48e[_0x0549('0x14')]=qs['offset'](_0x3d7674[_0x0549('0x29')]['offset']);}_0xffd48e[_0x0549('0x43')]=qs[_0x0549('0x44')](_0x3d7674[_0x0549('0x29')][_0x0549('0x44')]);_0xffd48e[_0x0549('0x45')]=qs[_0x0549('0x2d')](_[_0x0549('0x46')](_0x3d7674[_0x0549('0x29')],_0x340958[_0x0549('0x2d')]));_0xffd48e['where'][_0x0549('0x47')]=_0x267dd9['id'];if(_0x3d7674[_0x0549('0x29')][_0x0549('0x48')]){_0xffd48e['where']=_['merge'](_0xffd48e[_0x0549('0x45')],{'$or':_[_0x0549('0x21')](_0xffd48e[_0x0549('0x30')],function(_0x205593){var _0x44a1ca={};_0x44a1ca[_0x205593]={'$like':'%'+_0x3d7674[_0x0549('0x29')]['filter']+'%'};return _0x44a1ca;})});}if(_0x3d7674['query'][_0x0549('0x49')]){var _0x3a7959=_0x3d7674[_0x0549('0x29')][_0x0549('0x49')]['split'](',');var _0x56f8da={};_0x56f8da[_0x3a7959[0x0]]={'$gte':moment(_0x3a7959[0x1])[_0x0549('0x4a')](_0x0549('0x4b'))};_0xffd48e[_0x0549('0x45')]=_[_0x0549('0x4c')](_0xffd48e[_0x0549('0x45')],_0x56f8da);}_0xffd48e=_['merge']({},_0xffd48e,_0x3d7674[_0x0549('0x33')]);return db[_0x0549('0x3b')][_0x0549('0x17')]({'where':_0xffd48e[_0x0549('0x45')]})[_0x0549('0x1b')](function(_0x404e1a){_0x3496b9[_0x0549('0x17')]=_0x404e1a;if(_0x3d7674[_0x0549('0x29')][_0x0549('0x4d')]){_0xffd48e[_0x0549('0x32')]=[{'all':!![]}];}return db[_0x0549('0x3b')][_0x0549('0x27')](_0xffd48e);})['then'](function(_0xeb74e3){_0x3496b9[_0x0549('0x4e')]=_0xeb74e3;return _0x3496b9;});}})['then'](respondWithFilteredResult(_0x1672d5,_0xffd48e))[_0x0549('0x37')](handleError(_0x1672d5,null));};exports[_0x0549('0x4f')]=function(_0x19dade,_0x227ab9){return db[_0x0549('0x22')][_0x0549('0x34')]({'where':{'id':_0x19dade[_0x0549('0x38')]['id']}})[_0x0549('0x1b')](handleEntityNotFound(_0x227ab9,null))[_0x0549('0x1b')](function(_0x2644b0){if(_0x2644b0){return _0x2644b0[_0x0549('0x50')](_0x19dade['body'][_0x0549('0x3d')],_[_0x0549('0x3c')](_0x19dade[_0x0549('0x36')],[_0x0549('0x3d'),'id'])||{})[_0x0549('0x51')](function(){return db[_0x0549('0x52')]['findAll']({'attributes':['id',_0x0549('0x1e'),_0x0549('0x53')],'where':{'id':_0x19dade[_0x0549('0x36')][_0x0549('0x3d')]}});})[_0x0549('0x1b')](function(_0x3f370f){socket['emit'](_0x0549('0x54'),{'id':Number(_0x19dade[_0x0549('0x38')]['id']),'tags':_0x3f370f||[]});return{'id':Number(_0x19dade['params']['id']),'tags':_0x3f370f||[]};});}})['then'](respondWithResult(_0x227ab9,null))['catch'](handleError(_0x227ab9,null));};exports[_0x0549('0x55')]=function(_0x4492cc,_0x5714e1){return db[_0x0549('0x22')][_0x0549('0x34')]({'where':{'id':_0x4492cc[_0x0549('0x38')]['id']}})[_0x0549('0x1b')](handleEntityNotFound(_0x5714e1,null))[_0x0549('0x1b')](function(_0xc7394d){if(_0xc7394d){return _0xc7394d[_0x0549('0x55')](_0x4492cc[_0x0549('0x29')][_0x0549('0x3d')]);}})[_0x0549('0x1b')](respondWithStatusCode(_0x5714e1,null))[_0x0549('0x37')](handleError(_0x5714e1,null));};exports[_0x0549('0x56')]=function(_0xdddab1,_0x2c558a){var _0x1a37c3=moment()[_0x0549('0x57')]()[_0x0549('0x58')]();var _0x4fcbdb=path['join'](config[_0x0549('0x59')],_0x0549('0x5a'),_0x0549('0x5b'),_0x0549('0x5c'));var _0x1af4e2=path[_0x0549('0x5d')](config['root'],_0x0549('0x5a'),'files','attachments');var _0x3ac465=path[_0x0549('0x5d')](_0x4fcbdb,_0x1a37c3);var _0x491369=util['format'](_0x0549('0x5e'),_0xdddab1['params']['id'],_0x1a37c3);var _0x18cd8d=path[_0x0549('0x5d')](_0x4fcbdb,_0x491369);var _0x51d647=[];_0x51d647[_0x0549('0x5f')]({'model':db[_0x0549('0x60')],'as':_0x0549('0x60'),'raw':!![]});var _0xb0c9ca=[{'model':db[_0x0549('0x3b')],'as':_0x0549('0x61'),'attributes':['id','body',_0x0549('0x62')],'include':_0x51d647}];return db[_0x0549('0x22')][_0x0549('0x34')]({'where':{'id':_0xdddab1[_0x0549('0x38')]['id']},'include':_0xb0c9ca})[_0x0549('0x1b')](handleEntityNotFound(_0x2c558a,null))[_0x0549('0x1b')](function(_0x373d21){if(_0x373d21&&_0x373d21[_0x0549('0x61')]){var _0x5ed577=_0x373d21[_0x0549('0x63')]({'plain':!![]});fs[_0x0549('0x64')](_0x3ac465);for(var _0x3036b3=0x0;_0x3036b3<_0x5ed577['Messages'][_0x0549('0x31')];_0x3036b3++){var _0x540fbd=_0x5ed577[_0x0549('0x61')][_0x3036b3][_0x0549('0x60')];if(_0x540fbd){var _0x215207=path[_0x0549('0x5d')](_0x1af4e2,_0x540fbd[_0x0549('0x65')]);if(fs[_0x0549('0x66')](_0x215207)){fs[_0x0549('0x67')](_0x215207)[_0x0549('0x68')](fs['createWriteStream'](path[_0x0549('0x5d')](_0x3ac465,_0x540fbd['basename'])));}}}return BPromise[_0x0549('0x69')]()[_0x0549('0x1b')](function(){return new BPromise(function(_0x5b7e79,_0x3b963d){zipdir(_0x3ac465,{'saveTo':_0x18cd8d},function(_0x5aa273,_0x1b0f96){if(_0x5aa273)return _0x3b963d(_0x5aa273);return _0x5b7e79(_0x1b0f96);});})[_0x0549('0x1b')](function(){return new BPromise(function(_0xd71c9,_0x1cd6a6){rimraf(_0x3ac465,function(_0x42b909){if(_0x42b909)_0x1cd6a6(_0x42b909);return _0xd71c9();});});})[_0x0549('0x1b')](function(){return _0x2c558a[_0x0549('0x56')](_0x18cd8d,_0x491369,function(_0x5d26cc){if(_0x5d26cc){console[_0x0549('0x6a')](_0x0549('0x6b'),_0x5d26cc);}else{fs[_0x0549('0x6c')](_0x18cd8d);}});});});}else{return _0x2c558a[_0x0549('0x10')](0xc8);}})['catch'](handleError(_0x2c558a,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a4a8d85..0b643c7 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 _0x88eb=['events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','hook','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x88eb,0x72));var _0xb88e=function(_0x1b2749,_0x312077){_0x1b2749=_0x1b2749-0x0;var _0x1f833e=_0x88eb[_0x1b2749];return _0x1f833e;};'use strict';var EventEmitter=require(_0xb88e('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xb88e('0x1')];var FaxMessage=require(_0xb88e('0x2'))['db'][_0xb88e('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb88e('0x4')](0x0);var events={'afterCreate':_0xb88e('0x5'),'afterUpdate':_0xb88e('0x6'),'afterDestroy':_0xb88e('0x7')};function emitEvent(_0x51ef9f){return function(_0xe04804,_0x52702c,_0x1a3335){_0xe04804[_0xb88e('0x8')]({'attributes':['id'],'raw':!![]})[_0xb88e('0x9')](function(_0x2f85c6){_0xe04804[_0xb88e('0xa')](_0xb88e('0xb'),_0x2f85c6[_0xb88e('0xc')](function(_0x10a11d){return{'id':_0x10a11d['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xe04804['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb88e('0x9')](function(_0x37150d){_0xe04804[_0xb88e('0xa')](_0xb88e('0xd'),_0x37150d['length']);FaxInteractionEvents[_0xb88e('0xe')](_0x51ef9f+':'+_0xe04804['id'],_0xe04804);FaxInteractionEvents[_0xb88e('0xe')](_0x51ef9f,_0xe04804);_0x1a3335(null);})[_0xb88e('0xf')](_0x1a3335(null));};}for(var e in events){if(events[_0xb88e('0x10')](e)){var event=events[e];FaxInteraction[_0xb88e('0x11')](e,emitEvent(event));}}module[_0xb88e('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0xcf1b=['exports','events','../../mysqldb','FaxMessage','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xcf1b,0x188));var _0xbcf1=function(_0x525150,_0x1d6e0c){_0x525150=_0x525150-0x0;var _0x380c2f=_0xcf1b[_0x525150];return _0x380c2f;};'use strict';var EventEmitter=require(_0xbcf1('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xbcf1('0x1'))['db'][_0xbcf1('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbcf1('0x3'),'afterUpdate':_0xbcf1('0x4'),'afterDestroy':_0xbcf1('0x5')};function emitEvent(_0x5b4131){return function(_0x3805c2,_0x29abb8,_0x2c5a58){_0x3805c2[_0xbcf1('0x6')]({'attributes':['id'],'raw':!![]})[_0xbcf1('0x7')](function(_0x5c5c31){_0x3805c2[_0xbcf1('0x8')](_0xbcf1('0x9'),_0x5c5c31[_0xbcf1('0xa')](function(_0x2c31a4){return{'id':_0x2c31a4['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3805c2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbcf1('0x7')](function(_0x3071b4){_0x3805c2['setDataValue'](_0xbcf1('0xb'),_0x3071b4['length']);FaxInteractionEvents[_0xbcf1('0xc')](_0x5b4131+':'+_0x3805c2['id'],_0x3805c2);FaxInteractionEvents[_0xbcf1('0xc')](_0x5b4131,_0x3805c2);_0x2c5a58(null);})[_0xbcf1('0xd')](_0x2c5a58(null));};}for(var e in events){if(events[_0xbcf1('0xe')](e)){var event=events[e];FaxInteraction[_0xbcf1('0xf')](e,emitEvent(event));}}module[_0xbcf1('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 b4853ff..a0df2ef 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 _0xb758=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format'];(function(_0x3f848a,_0x57e33f){var _0x504c7b=function(_0x4157e9){while(--_0x4157e9){_0x3f848a['push'](_0x3f848a['shift']());}};_0x504c7b(++_0x57e33f);}(_0xb758,0x14a));var _0x8b75=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0xb758[_0x4bed75];return _0x2dd8e8;};'use strict';var _=require(_0x8b75('0x0'));var util=require(_0x8b75('0x1'));var logger=require(_0x8b75('0x2'))(_0x8b75('0x3'));var moment=require('moment');var BPromise=require(_0x8b75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b75('0x5'));var rimraf=require('rimraf');var config=require(_0x8b75('0x6'));var attributes=require(_0x8b75('0x7'));module['exports']=function(_0x1827b5,_0x3793b6){return _0x1827b5[_0x8b75('0x8')](_0x8b75('0x9'),attributes,{'tableName':_0x8b75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46badf,_0xe55857,_0x4467ff){if(_0x46badf[_0x8b75('0xb')](_0x8b75('0xc'))){_0x46badf[_0x8b75('0xd')]=moment()[_0x8b75('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4467ff(null,_0x46badf);}}});}; \ No newline at end of file +var _0x86de=['./faxInteraction.attributes','FaxInteraction','fax_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xe4c712,_0x1e26d5){var _0x101962=function(_0x1bfc5a){while(--_0x1bfc5a){_0xe4c712['push'](_0xe4c712['shift']());}};_0x101962(++_0x1e26d5);}(_0x86de,0x11a));var _0xe86d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x86de[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe86d('0x0'));var logger=require(_0xe86d('0x1'))('api');var moment=require(_0xe86d('0x2'));var BPromise=require(_0xe86d('0x3'));var rp=require(_0xe86d('0x4'));var fs=require('fs');var path=require(_0xe86d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe86d('0x6'));module['exports']=function(_0x1c4602,_0x2547a2){return _0x1c4602['define'](_0xe86d('0x7'),attributes,{'tableName':_0xe86d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x157146,_0x4bebce,_0x241a79){if(_0x157146[_0xe86d('0x9')]('closed')){_0x157146[_0xe86d('0xa')]=moment()['format'](_0xe86d('0xb'));}_0x241a79(null,_0x157146);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 678c116..7be7c08 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 _0x9a4c=['catch','FaxInteraction','body','options','raw','attributes','limit','info','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','find','where','addTags','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0x9a4c,0xd3));var _0xc9a4=function(_0x487476,_0x1f226c){_0x487476=_0x487476-0x0;var _0x4a41d1=_0x9a4c[_0x487476];return _0x4a41d1;};'use strict';var _=require(_0xc9a4('0x0'));var util=require(_0xc9a4('0x1'));var moment=require(_0xc9a4('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9a4('0x3'));var fs=require('fs');var Redis=require(_0xc9a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9a4('0x5'));var logger=require('../../config/logger')(_0xc9a4('0x6'));var config=require(_0xc9a4('0x7'));var jayson=require(_0xc9a4('0x8'));var client=jayson[_0xc9a4('0x9')][_0xc9a4('0xa')]({'port':0x232a});config[_0xc9a4('0xb')]=_[_0xc9a4('0xc')](config[_0xc9a4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc9a4('0xd'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xc9a4('0xe')](socket);function respondWithRpcPromise(_0x780d8a,_0x5570a9,_0x53c7e5){return new BPromise(function(_0x447365,_0x5668b9){return client['request'](_0x780d8a,_0x53c7e5)[_0xc9a4('0xf')](function(_0x29541d){logger['info'](_0xc9a4('0x10'),_0x5570a9,_0xc9a4('0x11'));logger[_0xc9a4('0x12')](_0xc9a4('0x13'),_0x5570a9,_0xc9a4('0x11'),JSON['stringify'](_0x29541d));if(_0x29541d[_0xc9a4('0x14')]){if(_0x29541d['error']['code']===0x1f4){logger[_0xc9a4('0x14')](_0xc9a4('0x10'),_0x5570a9,_0x29541d[_0xc9a4('0x14')]['message']);return _0x5668b9(_0x29541d[_0xc9a4('0x14')][_0xc9a4('0x15')]);}logger[_0xc9a4('0x14')](_0xc9a4('0x10'),_0x5570a9,_0x29541d[_0xc9a4('0x14')][_0xc9a4('0x15')]);return _0x447365(_0x29541d['error'][_0xc9a4('0x15')]);}else{logger['info'](_0xc9a4('0x10'),_0x5570a9,_0xc9a4('0x11'));_0x447365(_0x29541d[_0xc9a4('0x16')]['message']);}})[_0xc9a4('0x17')](function(_0x37a9e7){logger[_0xc9a4('0x14')](_0xc9a4('0x10'),_0x5570a9,_0x37a9e7);_0x5668b9(_0x37a9e7);});});}exports['UpdateFaxInteraction']=function(_0x55db50){var _0x278e26=this;return new Promise(function(_0x10e0c5,_0x34ee94){return db[_0xc9a4('0x18')]['update'](_0x55db50[_0xc9a4('0x19')],{'raw':_0x55db50[_0xc9a4('0x1a')]?_0x55db50[_0xc9a4('0x1a')][_0xc9a4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55db50[_0xc9a4('0x1a')]?_0x55db50['options']['where']||null:null,'attributes':_0x55db50[_0xc9a4('0x1a')]?_0x55db50[_0xc9a4('0x1a')][_0xc9a4('0x1c')]||null:null,'limit':_0x55db50['options']?_0x55db50['options'][_0xc9a4('0x1d')]||null:null})[_0xc9a4('0xf')](function(_0x1251b7){logger[_0xc9a4('0x1e')]('UpdateFaxInteraction',_0x55db50);logger[_0xc9a4('0x12')](_0xc9a4('0x1f'),_0x55db50,JSON[_0xc9a4('0x20')](_0x1251b7));_0x10e0c5(_0x1251b7);})[_0xc9a4('0x17')](function(_0x5e8ffe){logger[_0xc9a4('0x14')]('UpdateFaxInteraction',_0x5e8ffe[_0xc9a4('0x15')],_0x55db50);_0x34ee94(_0x278e26[_0xc9a4('0x14')](0x1f4,_0x5e8ffe[_0xc9a4('0x15')]));});});};exports[_0xc9a4('0x21')]=function(_0xc711a9){return new Promise(function(_0xed054b,_0x430c3d){return db[_0xc9a4('0x18')][_0xc9a4('0x22')]({'where':_0xc711a9[_0xc9a4('0x1a')]?_0xc711a9['options'][_0xc9a4('0x23')]||null:null})['then'](function(_0x2cbd02){if(_0x2cbd02){return _0x2cbd02[_0xc9a4('0x24')](_0xc711a9['body'][_0xc9a4('0x25')],_['omit'](_0xc711a9[_0xc9a4('0x19')],['ids','id'])||{});}})['spread'](function(_0x40f1ad){logger[_0xc9a4('0x1e')](_0xc9a4('0x26'),_0xc711a9);logger[_0xc9a4('0x12')](_0xc9a4('0x26'),_0xc711a9,JSON[_0xc9a4('0x20')](_0x40f1ad));_0xed054b(_0x40f1ad);})[_0xc9a4('0x17')](function(_0x58a70b){logger[_0xc9a4('0x14')]('AddTags',_0x58a70b[_0xc9a4('0x15')],_0xc711a9);_0x430c3d(_this[_0xc9a4('0x14')](0x1f4,_0x58a70b['message']));});});}; \ No newline at end of file +var _0xada5=['message','info','result','catch','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToFaxInteraction','FaxInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4127dc,_0x5558fe){var _0x310070=function(_0x190691){while(--_0x190691){_0x4127dc['push'](_0x4127dc['shift']());}};_0x310070(++_0x5558fe);}(_0xada5,0x6e));var _0x5ada=function(_0xdc4a1e,_0x5c5bec){_0xdc4a1e=_0xdc4a1e-0x0;var _0x296e2c=_0xada5[_0xdc4a1e];return _0x296e2c;};'use strict';var _=require(_0x5ada('0x0'));var util=require(_0x5ada('0x1'));var moment=require(_0x5ada('0x2'));var BPromise=require(_0x5ada('0x3'));var rs=require(_0x5ada('0x4'));var fs=require('fs');var Redis=require(_0x5ada('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ada('0x6'));var logger=require(_0x5ada('0x7'))(_0x5ada('0x8'));var config=require(_0x5ada('0x9'));var jayson=require(_0x5ada('0xa'));var client=jayson[_0x5ada('0xb')][_0x5ada('0xc')]({'port':0x232a});config[_0x5ada('0xd')]=_['defaults'](config[_0x5ada('0xd')],{'host':_0x5ada('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5ada('0xd')]));require(_0x5ada('0xf'))[_0x5ada('0x10')](socket);function respondWithRpcPromise(_0xe3644c,_0x3349f6,_0xf0012d){return new BPromise(function(_0x14bc91,_0x1b2b7a){return client[_0x5ada('0x11')](_0xe3644c,_0xf0012d)[_0x5ada('0x12')](function(_0x38c370){logger['info'](_0x5ada('0x13'),_0x3349f6,_0x5ada('0x14'));logger[_0x5ada('0x15')](_0x5ada('0x16'),_0x3349f6,_0x5ada('0x14'),JSON['stringify'](_0x38c370));if(_0x38c370[_0x5ada('0x17')]){if(_0x38c370[_0x5ada('0x17')][_0x5ada('0x18')]===0x1f4){logger['error'](_0x5ada('0x13'),_0x3349f6,_0x38c370[_0x5ada('0x17')]['message']);return _0x1b2b7a(_0x38c370[_0x5ada('0x17')][_0x5ada('0x19')]);}logger[_0x5ada('0x17')](_0x5ada('0x13'),_0x3349f6,_0x38c370['error'][_0x5ada('0x19')]);return _0x14bc91(_0x38c370[_0x5ada('0x17')][_0x5ada('0x19')]);}else{logger[_0x5ada('0x1a')](_0x5ada('0x13'),_0x3349f6,_0x5ada('0x14'));_0x14bc91(_0x38c370[_0x5ada('0x1b')]['message']);}})[_0x5ada('0x1c')](function(_0x4c601d){logger[_0x5ada('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x3349f6,_0x4c601d);_0x1b2b7a(_0x4c601d);});});}exports[_0x5ada('0x1d')]=function(_0x309b15){var _0x22b1b6=this;return new Promise(function(_0x2e6541,_0x2de545){return db['FaxInteraction'][_0x5ada('0x1e')](_0x309b15[_0x5ada('0x1f')],{'raw':_0x309b15[_0x5ada('0x20')]?_0x309b15['options'][_0x5ada('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x309b15[_0x5ada('0x20')]?_0x309b15[_0x5ada('0x20')][_0x5ada('0x22')]||null:null,'attributes':_0x309b15[_0x5ada('0x20')]?_0x309b15[_0x5ada('0x20')][_0x5ada('0x23')]||null:null,'limit':_0x309b15[_0x5ada('0x20')]?_0x309b15[_0x5ada('0x20')][_0x5ada('0x24')]||null:null})['then'](function(_0xf2e632){logger[_0x5ada('0x1a')](_0x5ada('0x1d'),_0x309b15);logger[_0x5ada('0x15')](_0x5ada('0x1d'),_0x309b15,JSON[_0x5ada('0x25')](_0xf2e632));_0x2e6541(_0xf2e632);})[_0x5ada('0x1c')](function(_0x2c6e7e){logger[_0x5ada('0x17')](_0x5ada('0x1d'),_0x2c6e7e[_0x5ada('0x19')],_0x309b15);_0x2de545(_0x22b1b6[_0x5ada('0x17')](0x1f4,_0x2c6e7e['message']));});});};exports[_0x5ada('0x26')]=function(_0x48ebf9){return new Promise(function(_0x2f02f5,_0x366e0d){return db[_0x5ada('0x27')][_0x5ada('0x28')]({'where':_0x48ebf9[_0x5ada('0x20')]?_0x48ebf9['options']['where']||null:null})[_0x5ada('0x12')](function(_0xe89d6e){if(_0xe89d6e){return _0xe89d6e[_0x5ada('0x29')](_0x48ebf9['body']['ids'],_[_0x5ada('0x2a')](_0x48ebf9[_0x5ada('0x1f')],[_0x5ada('0x2b'),'id'])||{});}})['spread'](function(_0x2d7e79){logger[_0x5ada('0x1a')](_0x5ada('0x2c'),_0x48ebf9);logger[_0x5ada('0x15')](_0x5ada('0x2c'),_0x48ebf9,JSON[_0x5ada('0x25')](_0x2d7e79));_0x2f02f5(_0x2d7e79);})[_0x5ada('0x1c')](function(_0x203ddf){logger['error'](_0x5ada('0x2c'),_0x203ddf['message'],_0x48ebf9);_0x366e0d(_this[_0x5ada('0x17')](0x1f4,_0x203ddf['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f2f53a2..6daa5d5 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 _0xe2c3=['register','length','./faxInteraction.events','save','remove','update','removeListener'];(function(_0x2aa26b,_0x114a85){var _0x3fbd53=function(_0x307713){while(--_0x307713){_0x2aa26b['push'](_0x2aa26b['shift']());}};_0x3fbd53(++_0x114a85);}(_0xe2c3,0xe2));var _0x3e2c=function(_0x2ce5e3,_0x429426){_0x2ce5e3=_0x2ce5e3-0x0;var _0xe1e73c=_0xe2c3[_0x2ce5e3];return _0xe1e73c;};'use strict';var FaxInteractionEvents=require(_0x3e2c('0x0'));var events=[_0x3e2c('0x1'),_0x3e2c('0x2'),_0x3e2c('0x3')];function createListener(_0x1f135f,_0x4bfc7c){return function(_0x1cd1e5){_0x4bfc7c['emit'](_0x1f135f,_0x1cd1e5);};}function removeListener(_0x541554,_0xd5752){return function(){FaxInteractionEvents[_0x3e2c('0x4')](_0x541554,_0xd5752);};}exports[_0x3e2c('0x5')]=function(_0x1855ae){for(var _0x413dea=0x0,_0xb80973=events[_0x3e2c('0x6')];_0x413dea<_0xb80973;_0x413dea++){var _0x58c5c7=events[_0x413dea];var _0xec2c5b=createListener('faxInteraction:'+_0x58c5c7,_0x1855ae);FaxInteractionEvents['on'](_0x58c5c7,_0xec2c5b);}}; \ No newline at end of file +var _0x2438=['./faxInteraction.events','save','remove','update','emit','removeListener','register','length','faxInteraction:'];(function(_0xb68695,_0x1881a4){var _0x15a817=function(_0x4d04d6){while(--_0x4d04d6){_0xb68695['push'](_0xb68695['shift']());}};_0x15a817(++_0x1881a4);}(_0x2438,0x15f));var _0x8243=function(_0x19ef1e,_0x506bcb){_0x19ef1e=_0x19ef1e-0x0;var _0x10d295=_0x2438[_0x19ef1e];return _0x10d295;};'use strict';var FaxInteractionEvents=require(_0x8243('0x0'));var events=[_0x8243('0x1'),_0x8243('0x2'),_0x8243('0x3')];function createListener(_0xc10a00,_0x1df0de){return function(_0x2e1970){_0x1df0de[_0x8243('0x4')](_0xc10a00,_0x2e1970);};}function removeListener(_0x1b32e,_0x3026db){return function(){FaxInteractionEvents[_0x8243('0x5')](_0x1b32e,_0x3026db);};}exports[_0x8243('0x6')]=function(_0x3be08f){for(var _0x5c9670=0x0,_0x3736f5=events[_0x8243('0x7')];_0x5c9670<_0x3736f5;_0x5c9670++){var _0x34d4cd=events[_0x5c9670];var _0x56d2d4=createListener(_0x8243('0x8')+_0x34d4cd,_0x3be08f);FaxInteractionEvents['on'](_0x34d4cd,_0x56d2d4);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index fa12df8..78cc3e2 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 _0x5c11=['/:id/messages','getMessages','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x4faedc,_0x3f5ecb){var _0x3132a5=function(_0x19ab6f){while(--_0x19ab6f){_0x4faedc['push'](_0x4faedc['shift']());}};_0x3132a5(++_0x3f5ecb);}(_0x5c11,0xa4));var _0x15c1=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5c11[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x15c1('0x0'));var util=require(_0x15c1('0x1'));var path=require(_0x15c1('0x2'));var timeout=require(_0x15c1('0x3'));var express=require('express');var router=express[_0x15c1('0x4')]();var fs_extra=require(_0x15c1('0x5'));var auth=require(_0x15c1('0x6'));var interaction=require(_0x15c1('0x7'));var config=require(_0x15c1('0x8'));var controller=require(_0x15c1('0x9'));router[_0x15c1('0xa')]('/',auth['isAuthenticated'](),controller[_0x15c1('0xb')]);router[_0x15c1('0xa')](_0x15c1('0xc'),auth[_0x15c1('0xd')](),controller[_0x15c1('0xe')]);router[_0x15c1('0xa')](_0x15c1('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x15c1('0xa')](_0x15c1('0x10'),auth[_0x15c1('0xd')](),controller[_0x15c1('0x11')]);router['get']('/:id/download',auth[_0x15c1('0xd')](),controller['download']);router[_0x15c1('0x12')]('/',auth[_0x15c1('0xd')](),controller[_0x15c1('0x13')]);router[_0x15c1('0x12')](_0x15c1('0x10'),auth[_0x15c1('0xd')](),controller['addMessage']);router[_0x15c1('0x12')](_0x15c1('0x14'),auth[_0x15c1('0xd')](),interaction[_0x15c1('0x15')](_0x15c1('0x16'),_0x15c1('0x17')),controller['addTags']);router[_0x15c1('0x18')](_0x15c1('0xf'),auth[_0x15c1('0xd')](),interaction[_0x15c1('0x15')](_0x15c1('0x16'),_0x15c1('0x19')),controller['update']);router[_0x15c1('0x1a')](_0x15c1('0xf'),auth['isAuthenticated'](),interaction[_0x15c1('0x15')](_0x15c1('0x16'),'faxinteraction:destroy'),controller[_0x15c1('0x1b')]);router[_0x15c1('0x1a')]('/:id/tags',auth[_0x15c1('0xd')](),controller[_0x15c1('0x1c')]);module[_0x15c1('0x1d')]=router; \ No newline at end of file +var _0x3217=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','tracked','fax','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','multer','connect-timeout','express','Router'];(function(_0x4ca3b4,_0x2450bc){var _0x51ea64=function(_0x1bdfd4){while(--_0x1bdfd4){_0x4ca3b4['push'](_0x4ca3b4['shift']());}};_0x51ea64(++_0x2450bc);}(_0x3217,0x17c));var _0x7321=function(_0x506bce,_0x3a3ba7){_0x506bce=_0x506bce-0x0;var _0x5650c3=_0x3217[_0x506bce];return _0x5650c3;};'use strict';var multer=require(_0x7321('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7321('0x1'));var express=require(_0x7321('0x2'));var router=express[_0x7321('0x3')]();var fs_extra=require(_0x7321('0x4'));var auth=require(_0x7321('0x5'));var interaction=require(_0x7321('0x6'));var config=require(_0x7321('0x7'));var controller=require(_0x7321('0x8'));router[_0x7321('0x9')]('/',auth[_0x7321('0xa')](),controller[_0x7321('0xb')]);router['get'](_0x7321('0xc'),auth[_0x7321('0xa')](),controller[_0x7321('0xd')]);router[_0x7321('0x9')](_0x7321('0xe'),auth[_0x7321('0xa')](),controller[_0x7321('0xf')]);router[_0x7321('0x9')](_0x7321('0x10'),auth[_0x7321('0xa')](),controller[_0x7321('0x11')]);router['get'](_0x7321('0x12'),auth[_0x7321('0xa')](),controller[_0x7321('0x13')]);router[_0x7321('0x14')]('/',auth[_0x7321('0xa')](),controller['create']);router[_0x7321('0x14')](_0x7321('0x10'),auth[_0x7321('0xa')](),controller['addMessage']);router[_0x7321('0x14')](_0x7321('0x15'),auth[_0x7321('0xa')](),interaction[_0x7321('0x16')](_0x7321('0x17'),'faxinteraction:addtags'),controller[_0x7321('0x18')]);router[_0x7321('0x19')](_0x7321('0xe'),auth['isAuthenticated'](),interaction[_0x7321('0x16')]('fax',_0x7321('0x1a')),controller[_0x7321('0x1b')]);router[_0x7321('0x1c')](_0x7321('0xe'),auth[_0x7321('0xa')](),interaction[_0x7321('0x16')]('fax',_0x7321('0x1d')),controller[_0x7321('0x1e')]);router[_0x7321('0x1c')](_0x7321('0x15'),auth[_0x7321('0xa')](),controller[_0x7321('0x1f')]);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 5e87d02..c785422 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 _0xde64=['ENUM','out','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3f1324,_0x495823){var _0x3eb1af=function(_0xf945ad){while(--_0xf945ad){_0x3f1324['push'](_0x3f1324['shift']());}};_0x3eb1af(++_0x495823);}(_0xde64,0x17c));var _0x4de6=function(_0x4b3e21,_0x9bc51b){_0x4b3e21=_0x4b3e21-0x0;var _0x4c675a=_0xde64[_0x4b3e21];return _0x4c675a;};'use strict';var Sequelize=require(_0x4de6('0x0'));module[_0x4de6('0x1')]={'body':{'type':Sequelize[_0x4de6('0x2')](_0x4de6('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4de6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4de6('0x5')]('in','out'),'defaultValue':_0x4de6('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x4de6('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xab5b=['sequelize','exports','medium','BOOLEAN','out','DATE'];(function(_0x14b49b,_0x32f537){var _0x2129b1=function(_0x5a85a8){while(--_0x5a85a8){_0x14b49b['push'](_0x14b49b['shift']());}};_0x2129b1(++_0x32f537);}(_0xab5b,0x11a));var _0xbab5=function(_0x4384bd,_0x230237){_0x4384bd=_0x4384bd-0x0;var _0x2a0be4=_0xab5b[_0x4384bd];return _0x2a0be4;};'use strict';var Sequelize=require(_0xbab5('0x0'));module[_0xbab5('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbab5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbab5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xbab5('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xbab5('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6844cfd..243a1f4 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 _0x2a6c=['include','rows','merge','options','find','body','params','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','FaxInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[FAXMESSAGE: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','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','channel','motionChannel','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','internal','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','join','server','files','attachments','basename','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','FaxMessage','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a6c,0x152));var _0xc2a6=function(_0x2d3044,_0xe2f524){_0x2d3044=_0x2d3044-0x0;var _0x23aaad=_0x2a6c[_0x2d3044];return _0x23aaad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc2a6('0x0'));var rp=require(_0xc2a6('0x1'));var moment=require(_0xc2a6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc2a6('0x3'));var util=require(_0xc2a6('0x4'));var path=require('path');var sox=require(_0xc2a6('0x5'));var csv=require(_0xc2a6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc2a6('0x7'));var squel=require(_0xc2a6('0x8'));var crypto=require(_0xc2a6('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc2a6('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc2a6('0xb'));var Papa=require('papaparse');var Redis=require(_0xc2a6('0xc'));var authService=require(_0xc2a6('0xd'));var qs=require(_0xc2a6('0xe'));var as=require(_0xc2a6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2a6('0x10'))(_0xc2a6('0x11'));var utils=require(_0xc2a6('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc2a6('0x13'))['db'];config[_0xc2a6('0x14')]=_[_0xc2a6('0x15')](config[_0xc2a6('0x14')],{'host':_0xc2a6('0x16'),'port':0x18eb});var socket=require(_0xc2a6('0x17'))(new Redis(config[_0xc2a6('0x14')]));require(_0xc2a6('0x18'))[_0xc2a6('0x19')](socket);var jayson=require(_0xc2a6('0x1a'));var client=jayson[_0xc2a6('0x1b')][_0xc2a6('0x1c')]({'port':0x232c});var client9002=jayson[_0xc2a6('0x1b')][_0xc2a6('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x205e67,_0x410537,_0x1ae4eb,_0xdef9fc){return new BPromise(function(_0x4c699c,_0x569834){var _0x3e3f18=_0xdef9fc||client;return _0x3e3f18[_0xc2a6('0x1d')](_0x205e67,_0x1ae4eb)['then'](function(_0x2c7653){logger['info'](_0xc2a6('0x1e'),_0x410537,_0xc2a6('0x1f'));logger[_0xc2a6('0x20')](_0xc2a6('0x21'),_0x410537,_0xc2a6('0x1f'),JSON['stringify'](_0x2c7653));if(_0x2c7653[_0xc2a6('0x22')]){if(_0x2c7653[_0xc2a6('0x22')][_0xc2a6('0x23')]===0x1f4){logger['error'](_0xc2a6('0x1e'),_0x410537,_0x2c7653[_0xc2a6('0x22')]['message']);return _0x569834(_0x2c7653['error'][_0xc2a6('0x24')]);}logger[_0xc2a6('0x22')](_0xc2a6('0x1e'),_0x410537,_0x2c7653[_0xc2a6('0x22')][_0xc2a6('0x24')]);return _0x4c699c(_0x2c7653['error'][_0xc2a6('0x24')]);}else{logger[_0xc2a6('0x25')]('FaxMessage,\x20%s,\x20%s',_0x410537,_0xc2a6('0x1f'));_0x4c699c(_0x2c7653['result'][_0xc2a6('0x24')]);}})[_0xc2a6('0x26')](function(_0x1fe9b0){logger[_0xc2a6('0x22')](_0xc2a6('0x1e'),_0x410537,_0x1fe9b0);_0x569834(_0x1fe9b0);});});}function respondWithStatusCode(_0x18a336,_0x3db5ae){_0x3db5ae=_0x3db5ae||0xcc;return function(_0x45e01a){if(_0x45e01a){return _0x18a336[_0xc2a6('0x27')](_0x3db5ae);}return _0x18a336[_0xc2a6('0x28')](_0x3db5ae)[_0xc2a6('0x29')]();};}function respondWithResult(_0x4e76b7,_0x187a0f){_0x187a0f=_0x187a0f||0xc8;return function(_0x3ebf3f){if(_0x3ebf3f){return _0x4e76b7[_0xc2a6('0x28')](_0x187a0f)[_0xc2a6('0x2a')](_0x3ebf3f);}};}function respondWithFilteredResult(_0x12b116,_0x35ac50){return function(_0x476f16){if(_0x476f16){var _0x51aff0=typeof _0x35ac50[_0xc2a6('0x2b')]===_0xc2a6('0x2c')&&typeof _0x35ac50[_0xc2a6('0x2d')]===_0xc2a6('0x2c');var _0x5f1664=_0x476f16[_0xc2a6('0x2e')];var _0x109574=_0x51aff0?0x0:_0x35ac50['offset'];var _0x12b4f0=_0x51aff0?_0x476f16[_0xc2a6('0x2e')]:_0x35ac50[_0xc2a6('0x2b')]+_0x35ac50[_0xc2a6('0x2d')];var _0x46cf8d;if(_0x12b4f0>=_0x5f1664){_0x12b4f0=_0x5f1664;_0x46cf8d=0xc8;}else{_0x46cf8d=0xce;}_0x12b116['status'](_0x46cf8d);return _0x12b116[_0xc2a6('0x2f')](_0xc2a6('0x30'),_0x109574+'-'+_0x12b4f0+'/'+_0x5f1664)[_0xc2a6('0x2a')](_0x476f16);}return null;};}function patchUpdates(_0x5e712f){return function(_0x3d1d6b){try{jsonpatch[_0xc2a6('0x31')](_0x3d1d6b,_0x5e712f,!![]);}catch(_0x4d40db){return BPromise[_0xc2a6('0x32')](_0x4d40db);}return _0x3d1d6b['save']();};}function saveUpdates(_0x55650a,_0xca2e92){return function(_0x3bf16d){if(_0x3bf16d){return _0x3bf16d[_0xc2a6('0x33')](_0x55650a)[_0xc2a6('0x34')](function(_0x425557){return _0x425557;});}return null;};}function removeEntity(_0x37a4f7,_0x5c6cb8){return function(_0x39344a){if(_0x39344a){return _0x39344a[_0xc2a6('0x35')]()[_0xc2a6('0x34')](function(){_0x37a4f7[_0xc2a6('0x28')](0xcc)[_0xc2a6('0x29')]();});}};}function handleEntityNotFound(_0x9dd3ee,_0x5b72b5){return function(_0x3bb9be){if(!_0x3bb9be){_0x9dd3ee['sendStatus'](0x194);}return _0x3bb9be;};}function handleError(_0x355f11,_0x2e4390){_0x2e4390=_0x2e4390||0x1f4;return function(_0x29d505){logger[_0xc2a6('0x22')](_0x29d505[_0xc2a6('0x36')]);if(_0x29d505[_0xc2a6('0x37')]){delete _0x29d505[_0xc2a6('0x37')];}_0x355f11[_0xc2a6('0x28')](_0x2e4390)[_0xc2a6('0x38')](_0x29d505);};}exports['index']=function(_0x530246,_0x42167e){var _0xd60af={},_0x3272b6={},_0x3c7b1c={'count':0x0,'rows':[]};var _0x1a916d=_['map'](db[_0xc2a6('0x39')][_0xc2a6('0x3a')],function(_0x138900){return{'name':_0x138900[_0xc2a6('0x3b')],'type':_0x138900[_0xc2a6('0x3c')][_0xc2a6('0x3d')]};});_0x3272b6[_0xc2a6('0x3e')]=_[_0xc2a6('0x3f')](_0x1a916d,_0xc2a6('0x37'));_0x3272b6['query']=_[_0xc2a6('0x40')](_0x530246[_0xc2a6('0x41')]);_0x3272b6[_0xc2a6('0x42')]=_[_0xc2a6('0x43')](_0x3272b6[_0xc2a6('0x3e')],_0x3272b6[_0xc2a6('0x41')]);_0xd60af['attributes']=_[_0xc2a6('0x43')](_0x3272b6[_0xc2a6('0x3e')],qs[_0xc2a6('0x44')](_0x530246[_0xc2a6('0x41')][_0xc2a6('0x44')]));_0xd60af[_0xc2a6('0x45')]=_0xd60af[_0xc2a6('0x45')][_0xc2a6('0x46')]?_0xd60af[_0xc2a6('0x45')]:_0x3272b6[_0xc2a6('0x3e')];if(!_0x530246[_0xc2a6('0x41')][_0xc2a6('0x47')]('nolimit')){_0xd60af[_0xc2a6('0x2d')]=qs['limit'](_0x530246[_0xc2a6('0x41')]['limit']);_0xd60af[_0xc2a6('0x2b')]=qs[_0xc2a6('0x2b')](_0x530246[_0xc2a6('0x41')][_0xc2a6('0x2b')]);}_0xd60af[_0xc2a6('0x48')]=qs['sort'](_0x530246[_0xc2a6('0x41')][_0xc2a6('0x49')]);_0xd60af[_0xc2a6('0x4a')]=qs[_0xc2a6('0x42')](_[_0xc2a6('0x4b')](_0x530246[_0xc2a6('0x41')],_0x3272b6[_0xc2a6('0x42')]),_0x1a916d);if(_0x530246['query'][_0xc2a6('0x4c')]){_0xd60af[_0xc2a6('0x4a')]=_['merge'](_0xd60af[_0xc2a6('0x4a')],{'$or':_['map'](_0x1a916d,function(_0xa3a518){if(_0xa3a518[_0xc2a6('0x3c')]!==_0xc2a6('0x4d')){var _0x207ef6={};_0x207ef6[_0xa3a518['name']]={'$like':'%'+_0x530246[_0xc2a6('0x41')]['filter']+'%'};return _0x207ef6;}})});}_0xd60af=_['merge']({},_0xd60af,_0x530246['options']);var _0x4a37da={'where':_0xd60af[_0xc2a6('0x4a')]};return db[_0xc2a6('0x39')][_0xc2a6('0x2e')](_0x4a37da)[_0xc2a6('0x34')](function(_0x3ee1cb){_0x3c7b1c['count']=_0x3ee1cb;if(_0x530246[_0xc2a6('0x41')][_0xc2a6('0x4e')]){_0xd60af[_0xc2a6('0x4f')]=[{'all':!![]}];}return db[_0xc2a6('0x39')]['findAll'](_0xd60af);})[_0xc2a6('0x34')](function(_0x2e7642){_0x3c7b1c[_0xc2a6('0x50')]=_0x2e7642;return _0x3c7b1c;})[_0xc2a6('0x34')](respondWithFilteredResult(_0x42167e,_0xd60af))['catch'](handleError(_0x42167e,null));};exports['show']=function(_0x455f8b,_0x5628f9){var _0x59407={'raw':!![],'where':{'id':_0x455f8b['params']['id']}},_0x160951={};_0x160951[_0xc2a6('0x3e')]=_['keys'](db[_0xc2a6('0x39')][_0xc2a6('0x3a')]);_0x160951[_0xc2a6('0x41')]=_['keys'](_0x455f8b[_0xc2a6('0x41')]);_0x160951[_0xc2a6('0x42')]=_[_0xc2a6('0x43')](_0x160951[_0xc2a6('0x3e')],_0x160951[_0xc2a6('0x41')]);_0x59407[_0xc2a6('0x45')]=_[_0xc2a6('0x43')](_0x160951[_0xc2a6('0x3e')],qs[_0xc2a6('0x44')](_0x455f8b[_0xc2a6('0x41')][_0xc2a6('0x44')]));_0x59407[_0xc2a6('0x45')]=_0x59407[_0xc2a6('0x45')][_0xc2a6('0x46')]?_0x59407[_0xc2a6('0x45')]:_0x160951[_0xc2a6('0x3e')];if(_0x455f8b[_0xc2a6('0x41')][_0xc2a6('0x4e')]){_0x59407['include']=[{'all':!![]}];}_0x59407=_[_0xc2a6('0x51')]({},_0x59407,_0x455f8b[_0xc2a6('0x52')]);return db[_0xc2a6('0x39')][_0xc2a6('0x53')](_0x59407)[_0xc2a6('0x34')](handleEntityNotFound(_0x5628f9,null))['then'](respondWithResult(_0x5628f9,null))[_0xc2a6('0x26')](handleError(_0x5628f9,null));};exports['update']=function(_0x3256b1,_0x19cf18){if(_0x3256b1[_0xc2a6('0x54')]['id']){delete _0x3256b1[_0xc2a6('0x54')]['id'];}return db[_0xc2a6('0x39')][_0xc2a6('0x53')]({'where':{'id':_0x3256b1[_0xc2a6('0x55')]['id']}})['then'](handleEntityNotFound(_0x19cf18,null))[_0xc2a6('0x34')](saveUpdates(_0x3256b1['body'],null))['then'](respondWithResult(_0x19cf18,null))[_0xc2a6('0x26')](handleError(_0x19cf18,null));};exports[_0xc2a6('0x35')]=function(_0x533a11,_0x565657){return db[_0xc2a6('0x39')][_0xc2a6('0x53')]({'where':{'id':_0x533a11[_0xc2a6('0x55')]['id']}})['then'](handleEntityNotFound(_0x565657,null))[_0xc2a6('0x34')](removeEntity(_0x565657,null))[_0xc2a6('0x26')](handleError(_0x565657,null));};exports[_0xc2a6('0x56')]=function(_0x5f235f,_0x41f7c6){return db['FaxMessage'][_0xc2a6('0x56')]()[_0xc2a6('0x34')](respondWithResult(_0x41f7c6,null))[_0xc2a6('0x26')](handleError(_0x41f7c6,null));};var interaction_log=require(_0xc2a6('0x10'))(_0xc2a6('0x57'));exports[_0xc2a6('0x58')]=function(_0x24363c,_0xea3af5,_0x553120){var _0x46e890={'agent':{},'channel':_0xc2a6('0x59')};if(_0x24363c['body']['id']){delete _0x24363c[_0xc2a6('0x54')]['id'];}_0x24363c[_0xc2a6('0x54')][_0xc2a6('0x5a')]=!![];_0x24363c['body'][_0xc2a6('0x5b')]=moment()[_0xc2a6('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x24363c[_0xc2a6('0x54')][_0xc2a6('0x5d')]=_0x24363c[_0xc2a6('0x54')]['UserId']||_0x24363c[_0xc2a6('0x5e')]['id'];_0x46e890[_0xc2a6('0x5f')]['id']=_0x24363c[_0xc2a6('0x54')][_0xc2a6('0x5d')];return db[_0xc2a6('0x39')][_0xc2a6('0x53')]({'where':{'id':_0x24363c[_0xc2a6('0x55')]['id'],'UserId':null}})[_0xc2a6('0x34')](handleEntityNotFound(_0xea3af5,null))[_0xc2a6('0x34')](saveUpdates(_0x24363c[_0xc2a6('0x54')],null))['then'](function(_0x11716d){if(_0x11716d){_0x46e890['message']=_0x11716d['get']({'plain':!![]});return db['FaxInteraction'][_0xc2a6('0x53')]({'where':{'id':_0x11716d[_0xc2a6('0x60')]}});}return null;})[_0xc2a6('0x34')](handleEntityNotFound(_0xea3af5,null))[_0xc2a6('0x34')](function(_0x561349){if(_0x561349){return _0x561349['update']({'UserId':_0x24363c[_0xc2a6('0x54')]['UserId'],'read1stAt':_[_0xc2a6('0x61')](_0x561349['read1stAt'])?moment()[_0xc2a6('0x5c')](_0xc2a6('0x62')):undefined});}return null;})[_0xc2a6('0x34')](function(_0x23fd56){if(_0x23fd56){_0x46e890[_0xc2a6('0x63')]=_0x23fd56[_0xc2a6('0x64')]({'plain':!![]});interaction_log[_0xc2a6('0x25')](_0xc2a6('0x65'),_0x24363c[_0xc2a6('0x5e')]['id'],_0x24363c[_0xc2a6('0x5e')][_0xc2a6('0x37')],_0x24363c[_0xc2a6('0x5e')][_0xc2a6('0x66')],_0x46e890[_0xc2a6('0x63')]['id'],_0x24363c['body']?JSON['stringify'](_0x24363c[_0xc2a6('0x54')]):_0xc2a6('0x67'));return respondWithRpcPromise(_0xc2a6('0x68'),_0xc2a6('0x69'),_0x46e890);}return null;})['then'](function(_0x165307){var _0x7eb84=_0xc2a6('0x6a')+_0x165307[_0xc2a6('0x24')][_0xc2a6('0x6b')];return db[_0xc2a6('0x6c')]['query'](_0x7eb84,{'type':db[_0xc2a6('0x6d')][_0xc2a6('0x6e')][_0xc2a6('0x6f')],'raw':!![]})[_0xc2a6('0x34')](function(_0x2a87f6){return _0x2a87f6;});})[_0xc2a6('0x34')](function(_0x575487){if(_0x575487){_0x46e890[_0xc2a6('0x24')][_0xc2a6('0x70')]=_0x575487[0x0];if(!_0x24363c['body'][_0xc2a6('0x5d')])return;return db[_0xc2a6('0x71')]['find']({'where':{'id':_0x24363c['body'][_0xc2a6('0x5d')],'role':_0xc2a6('0x5f')},'attributes':['id',_0xc2a6('0x37'),_0xc2a6('0x72'),_0xc2a6('0x73'),'internal'],'raw':!![]});}return null;})[_0xc2a6('0x34')](function(_0x476df9){if(!_0x476df9)return null;_0x46e890[_0xc2a6('0x24')]['agent']=_0x476df9;return _0x46e890;})['then'](function(_0x189410){if(_0x189410){if(_0x24363c[_0xc2a6('0x54')][_0xc2a6('0x74')]){_0x46e890[_0xc2a6('0x24')]['interface']=util['format']('SIP/%s',_0x24363c['user'][_0xc2a6('0x37')]);_0x46e890[_0xc2a6('0x24')][_0xc2a6('0x75')]=_0x46e890[_0xc2a6('0x75')];_0x46e890[_0xc2a6('0x24')][_0xc2a6('0x76')]=_0x46e890[_0xc2a6('0x75')];_0x46e890[_0xc2a6('0x24')]['event']=_0xc2a6('0x58');return respondWithRpcPromise('EventManager',_0xc2a6('0x77'),{'event':_0xc2a6('0x78'),'message':_0x46e890['message']},client9002)['then'](function(){return _0x46e890;});}return _0x46e890;}return null;})[_0xc2a6('0x34')](respondWithResult(_0xea3af5,null))[_0xc2a6('0x26')](handleError(_0xea3af5,null));};var interaction_log=require(_0xc2a6('0x10'))('fax-interactions');exports[_0xc2a6('0x32')]=function(_0x5bb105,_0x31666c,_0x1b7d18){var _0x52e744={'agent':{},'channel':'fax'};if(_0x5bb105[_0xc2a6('0x54')]['id']){delete _0x5bb105[_0xc2a6('0x54')]['id'];}_0x5bb105[_0xc2a6('0x54')]['UserId']=_0x5bb105[_0xc2a6('0x54')][_0xc2a6('0x5d')]||_0x5bb105[_0xc2a6('0x5e')]['id'];_0x52e744[_0xc2a6('0x5f')]['id']=_0x5bb105[_0xc2a6('0x54')]['UserId'];return db[_0xc2a6('0x39')][_0xc2a6('0x53')]({'where':{'id':_0x5bb105['params']['id'],'UserId':null}})[_0xc2a6('0x34')](handleEntityNotFound(_0x31666c,null))['then'](function(_0x4d4700){if(_0x4d4700){_0x52e744[_0xc2a6('0x24')]=_0x4d4700[_0xc2a6('0x64')]({'plain':!![]});return db[_0xc2a6('0x79')][_0xc2a6('0x53')]({'where':{'id':_0x4d4700['FaxInteractionId']}});}return null;})[_0xc2a6('0x34')](handleEntityNotFound(_0x31666c,null))[_0xc2a6('0x34')](function(_0x2aefd7){if(_0x2aefd7){_0x52e744['interaction']=_0x2aefd7['get']({'plain':!![]});interaction_log['info'](_0xc2a6('0x7a'),_0x5bb105[_0xc2a6('0x5e')]['id'],_0x5bb105['user']['name'],_0x5bb105[_0xc2a6('0x5e')]['role'],_0x52e744[_0xc2a6('0x63')]['id'],_0x5bb105[_0xc2a6('0x54')]?JSON[_0xc2a6('0x7b')](_0x5bb105[_0xc2a6('0x54')]):_0xc2a6('0x67'));return respondWithRpcPromise(_0xc2a6('0x7c'),'rejectMessage',_0x52e744);}return null;})['then'](function(_0x5c45fd){var _0x1de56b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5c45fd[_0xc2a6('0x24')][_0xc2a6('0x6b')];return db['sequelize'][_0xc2a6('0x41')](_0x1de56b,{'type':db[_0xc2a6('0x6d')][_0xc2a6('0x6e')][_0xc2a6('0x6f')],'raw':!![]})['then'](function(_0x3bf3bb){return _0x3bf3bb;});})[_0xc2a6('0x34')](function(_0x1699bd){if(_0x1699bd){_0x52e744[_0xc2a6('0x24')]['contact']=_0x1699bd[0x0];if(!_0x5bb105[_0xc2a6('0x54')][_0xc2a6('0x5d')])return;return db['User']['find']({'where':{'id':_0x5bb105[_0xc2a6('0x54')][_0xc2a6('0x5d')],'role':'agent'},'attributes':['id',_0xc2a6('0x37'),_0xc2a6('0x72'),'email',_0xc2a6('0x7d')],'raw':!![]});}return null;})[_0xc2a6('0x34')](function(_0x1e81e9){if(!_0x1e81e9)return null;_0x52e744[_0xc2a6('0x24')][_0xc2a6('0x5f')]=_0x1e81e9;return _0x52e744;})[_0xc2a6('0x34')](function(_0x37fe69){if(_0x37fe69){_0x37fe69[_0xc2a6('0x24')]['interface']=util[_0xc2a6('0x5c')]('SIP/%s',_0x5bb105['user']['name']);_0x37fe69[_0xc2a6('0x24')][_0xc2a6('0x75')]=_0x52e744[_0xc2a6('0x75')];_0x37fe69[_0xc2a6('0x24')][_0xc2a6('0x76')]=_0x52e744[_0xc2a6('0x75')];_0x37fe69['message']['event']=_0xc2a6('0x32');respondWithRpcPromise(_0xc2a6('0x77'),'EventManager',{'event':_0xc2a6('0x7e'),'message':_0x37fe69[_0xc2a6('0x24')]},client9002);return _0x52e744;}return null;})[_0xc2a6('0x34')](respondWithResult(_0x31666c,null))['catch'](handleError(_0x31666c,null));};exports[_0xc2a6('0x7f')]=function(_0xabff7c,_0x24b3c2){var _0x578384;return db[_0xc2a6('0x39')][_0xc2a6('0x7f')](_0xabff7c['body'],{})[_0xc2a6('0x34')](function(_0x20d703){_0x578384=_0x20d703;return db['CmContact'][_0xc2a6('0x80')]({'where':{'id':_0x578384[_0xc2a6('0x6b')]}});})['then'](function(_0x543eaf){if(_[_0xc2a6('0x61')](_0x543eaf)){return;}else{_0x578384[_0xc2a6('0x59')]=_0x543eaf[_0xc2a6('0x59')];return db[_0xc2a6('0x81')][_0xc2a6('0x80')]({'where':{'id':_0x578384[_0xc2a6('0x82')]}});}})[_0xc2a6('0x34')](function(_0x58180a){return respondWithRpcPromise(_0xc2a6('0x83'),_0xc2a6('0x83'),{'FaxAccountId':_[_0xc2a6('0x61')](_0xabff7c[_0xc2a6('0x54')])?undefined:_0xabff7c[_0xc2a6('0x54')]['FaxAccountId'],'path':_[_0xc2a6('0x61')](_0x58180a)?undefined:util[_0xc2a6('0x5c')](_0xc2a6('0x84'),_0x58180a['basename']),'fax':_[_0xc2a6('0x61')](_0x578384[_0xc2a6('0x59')])?undefined:_0x578384[_0xc2a6('0x59')],'AttachmentId':_0x578384[_0xc2a6('0x82')]},client9002);})[_0xc2a6('0x34')](respondWithResult(_0x24b3c2,0xc9))[_0xc2a6('0x26')](handleError(_0x24b3c2,null));};exports[_0xc2a6('0x85')]=function(_0x1402cd,_0x10bb70){var _0x556ffb=path[_0xc2a6('0x86')](config['root'],_0xc2a6('0x87'),_0xc2a6('0x88'),_0xc2a6('0x89'));return db[_0xc2a6('0x39')][_0xc2a6('0x53')]({'where':{'id':_0x1402cd[_0xc2a6('0x55')]['id']},'include':[{'model':db['Attachment'],'as':_0xc2a6('0x81')}]})[_0xc2a6('0x34')](handleEntityNotFound(_0x10bb70,null))[_0xc2a6('0x34')](function(_0x9ae79e){if(_0x9ae79e){return _0x10bb70[_0xc2a6('0x85')](path[_0xc2a6('0x86')](_0x556ffb,_0x9ae79e[_0xc2a6('0x81')][_0xc2a6('0x8a')]));}})[_0xc2a6('0x26')](handleError(_0x10bb70,null));}; \ No newline at end of file +var _0x78d2=['AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','basename','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','client','http','request','info','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','request\x20sent','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','map','FaxMessage','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','body','destroy','catch','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','role','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','interface','rejectmessage','CmContact','findOne','Attachment'];(function(_0x23e9a6,_0x42d2a7){var _0x5d7c65=function(_0x57999d){while(--_0x57999d){_0x23e9a6['push'](_0x23e9a6['shift']());}};_0x5d7c65(++_0x42d2a7);}(_0x78d2,0x98));var _0x278d=function(_0x37dcaa,_0x43dafe){_0x37dcaa=_0x37dcaa-0x0;var _0x1054b8=_0x78d2[_0x37dcaa];return _0x1054b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x278d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x278d('0x1'));var rp=require(_0x278d('0x2'));var moment=require(_0x278d('0x3'));var BPromise=require(_0x278d('0x4'));var Mustache=require(_0x278d('0x5'));var util=require(_0x278d('0x6'));var path=require(_0x278d('0x7'));var sox=require(_0x278d('0x8'));var csv=require(_0x278d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x278d('0xa'));var _=require('lodash');var squel=require(_0x278d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x278d('0xc'));var toCsv=require(_0x278d('0x9'));var querystring=require(_0x278d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x278d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x278d('0xf'));var logger=require('../../config/logger')(_0x278d('0x10'));var utils=require(_0x278d('0x11'));var config=require(_0x278d('0x12'));var licenseUtil=require(_0x278d('0x13'));var db=require(_0x278d('0x14'))['db'];config['redis']=_[_0x278d('0x15')](config['redis'],{'host':_0x278d('0x16'),'port':0x18eb});var socket=require(_0x278d('0x17'))(new Redis(config[_0x278d('0x18')]));require(_0x278d('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x278d('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x278d('0x1a')][_0x278d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2fcd6f,_0x5acbf8,_0x4d932a,_0x1d6b1f){return new BPromise(function(_0x1318a5,_0x5abd9c){var _0x1341fd=_0x1d6b1f||client;return _0x1341fd[_0x278d('0x1c')](_0x2fcd6f,_0x4d932a)['then'](function(_0x2a2187){logger[_0x278d('0x1d')]('FaxMessage,\x20%s,\x20%s',_0x5acbf8,'request\x20sent');logger[_0x278d('0x1e')](_0x278d('0x1f'),_0x5acbf8,'request\x20sent',JSON['stringify'](_0x2a2187));if(_0x2a2187[_0x278d('0x20')]){if(_0x2a2187[_0x278d('0x20')]['code']===0x1f4){logger['error'](_0x278d('0x21'),_0x5acbf8,_0x2a2187[_0x278d('0x20')][_0x278d('0x22')]);return _0x5abd9c(_0x2a2187[_0x278d('0x20')][_0x278d('0x22')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x5acbf8,_0x2a2187['error']['message']);return _0x1318a5(_0x2a2187[_0x278d('0x20')]['message']);}else{logger[_0x278d('0x1d')](_0x278d('0x21'),_0x5acbf8,_0x278d('0x23'));_0x1318a5(_0x2a2187[_0x278d('0x24')][_0x278d('0x22')]);}})['catch'](function(_0x481917){logger[_0x278d('0x20')](_0x278d('0x21'),_0x5acbf8,_0x481917);_0x5abd9c(_0x481917);});});}function respondWithStatusCode(_0x28d9d3,_0x775011){_0x775011=_0x775011||0xcc;return function(_0x2ca6af){if(_0x2ca6af){return _0x28d9d3[_0x278d('0x25')](_0x775011);}return _0x28d9d3[_0x278d('0x26')](_0x775011)[_0x278d('0x27')]();};}function respondWithResult(_0x278ef4,_0x10e99d){_0x10e99d=_0x10e99d||0xc8;return function(_0x1fb22a){if(_0x1fb22a){return _0x278ef4[_0x278d('0x26')](_0x10e99d)[_0x278d('0x28')](_0x1fb22a);}};}function respondWithFilteredResult(_0x7e4cf1,_0x1bd4fb){return function(_0x2b1011){if(_0x2b1011){var _0x1c6a50=typeof _0x1bd4fb[_0x278d('0x29')]===_0x278d('0x2a')&&typeof _0x1bd4fb[_0x278d('0x2b')]===_0x278d('0x2a');var _0x2a0c81=_0x2b1011['count'];var _0x2057cf=_0x1c6a50?0x0:_0x1bd4fb[_0x278d('0x29')];var _0x358ee=_0x1c6a50?_0x2b1011[_0x278d('0x2c')]:_0x1bd4fb['offset']+_0x1bd4fb[_0x278d('0x2b')];var _0x5eac80;if(_0x358ee>=_0x2a0c81){_0x358ee=_0x2a0c81;_0x5eac80=0xc8;}else{_0x5eac80=0xce;}_0x7e4cf1[_0x278d('0x26')](_0x5eac80);return _0x7e4cf1[_0x278d('0x2d')]('Content-Range',_0x2057cf+'-'+_0x358ee+'/'+_0x2a0c81)['json'](_0x2b1011);}return null;};}function patchUpdates(_0x267aec){return function(_0xe8d398){try{jsonpatch[_0x278d('0x2e')](_0xe8d398,_0x267aec,!![]);}catch(_0x5b702f){return BPromise[_0x278d('0x2f')](_0x5b702f);}return _0xe8d398[_0x278d('0x30')]();};}function saveUpdates(_0x9ef020,_0x9235c8){return function(_0x25e51b){if(_0x25e51b){return _0x25e51b[_0x278d('0x31')](_0x9ef020)['then'](function(_0x2608fa){return _0x2608fa;});}return null;};}function removeEntity(_0x184e46,_0xcc3787){return function(_0x416ff4){if(_0x416ff4){return _0x416ff4['destroy']()[_0x278d('0x32')](function(){_0x184e46['status'](0xcc)[_0x278d('0x27')]();});}};}function handleEntityNotFound(_0x4782f3,_0x398f85){return function(_0xf115c3){if(!_0xf115c3){_0x4782f3[_0x278d('0x25')](0x194);}return _0xf115c3;};}function handleError(_0x58decc,_0x2aa2aa){_0x2aa2aa=_0x2aa2aa||0x1f4;return function(_0x53aa1c){logger['error'](_0x53aa1c[_0x278d('0x33')]);if(_0x53aa1c['name']){delete _0x53aa1c[_0x278d('0x34')];}_0x58decc[_0x278d('0x26')](_0x2aa2aa)[_0x278d('0x35')](_0x53aa1c);};}exports['index']=function(_0x2436e5,_0x35055d){var _0x30c71c={},_0x4200e2={},_0x56d872={'count':0x0,'rows':[]};var _0x529bd4=_[_0x278d('0x36')](db[_0x278d('0x37')][_0x278d('0x38')],function(_0x4c8d31){return{'name':_0x4c8d31[_0x278d('0x39')],'type':_0x4c8d31[_0x278d('0x3a')]['key']};});_0x4200e2[_0x278d('0x3b')]=_[_0x278d('0x36')](_0x529bd4,_0x278d('0x34'));_0x4200e2['query']=_[_0x278d('0x3c')](_0x2436e5['query']);_0x4200e2['filters']=_[_0x278d('0x3d')](_0x4200e2[_0x278d('0x3b')],_0x4200e2[_0x278d('0x3e')]);_0x30c71c[_0x278d('0x3f')]=_[_0x278d('0x3d')](_0x4200e2[_0x278d('0x3b')],qs['fields'](_0x2436e5[_0x278d('0x3e')][_0x278d('0x40')]));_0x30c71c[_0x278d('0x3f')]=_0x30c71c['attributes']['length']?_0x30c71c[_0x278d('0x3f')]:_0x4200e2[_0x278d('0x3b')];if(!_0x2436e5[_0x278d('0x3e')][_0x278d('0x41')](_0x278d('0x42'))){_0x30c71c['limit']=qs['limit'](_0x2436e5[_0x278d('0x3e')][_0x278d('0x2b')]);_0x30c71c[_0x278d('0x29')]=qs['offset'](_0x2436e5[_0x278d('0x3e')][_0x278d('0x29')]);}_0x30c71c[_0x278d('0x43')]=qs['sort'](_0x2436e5['query'][_0x278d('0x44')]);_0x30c71c[_0x278d('0x45')]=qs[_0x278d('0x46')](_[_0x278d('0x47')](_0x2436e5[_0x278d('0x3e')],_0x4200e2[_0x278d('0x46')]),_0x529bd4);if(_0x2436e5['query'][_0x278d('0x48')]){_0x30c71c[_0x278d('0x45')]=_[_0x278d('0x49')](_0x30c71c[_0x278d('0x45')],{'$or':_[_0x278d('0x36')](_0x529bd4,function(_0x3e0cde){if(_0x3e0cde[_0x278d('0x3a')]!=='VIRTUAL'){var _0x398f58={};_0x398f58[_0x3e0cde['name']]={'$like':'%'+_0x2436e5['query'][_0x278d('0x48')]+'%'};return _0x398f58;}})});}_0x30c71c=_[_0x278d('0x49')]({},_0x30c71c,_0x2436e5[_0x278d('0x4a')]);var _0x51c978={'where':_0x30c71c['where']};return db[_0x278d('0x37')][_0x278d('0x2c')](_0x51c978)[_0x278d('0x32')](function(_0x5c6c62){_0x56d872[_0x278d('0x2c')]=_0x5c6c62;if(_0x2436e5[_0x278d('0x3e')][_0x278d('0x4b')]){_0x30c71c[_0x278d('0x4c')]=[{'all':!![]}];}return db[_0x278d('0x37')][_0x278d('0x4d')](_0x30c71c);})[_0x278d('0x32')](function(_0x5d556e){_0x56d872[_0x278d('0x4e')]=_0x5d556e;return _0x56d872;})['then'](respondWithFilteredResult(_0x35055d,_0x30c71c))['catch'](handleError(_0x35055d,null));};exports[_0x278d('0x4f')]=function(_0xc664,_0x534f67){var _0x498fa9={'raw':!![],'where':{'id':_0xc664[_0x278d('0x50')]['id']}},_0x1fef9c={};_0x1fef9c[_0x278d('0x3b')]=_[_0x278d('0x3c')](db[_0x278d('0x37')][_0x278d('0x38')]);_0x1fef9c[_0x278d('0x3e')]=_['keys'](_0xc664['query']);_0x1fef9c[_0x278d('0x46')]=_[_0x278d('0x3d')](_0x1fef9c[_0x278d('0x3b')],_0x1fef9c[_0x278d('0x3e')]);_0x498fa9['attributes']=_[_0x278d('0x3d')](_0x1fef9c[_0x278d('0x3b')],qs[_0x278d('0x40')](_0xc664[_0x278d('0x3e')][_0x278d('0x40')]));_0x498fa9['attributes']=_0x498fa9[_0x278d('0x3f')][_0x278d('0x51')]?_0x498fa9[_0x278d('0x3f')]:_0x1fef9c[_0x278d('0x3b')];if(_0xc664[_0x278d('0x3e')][_0x278d('0x4b')]){_0x498fa9['include']=[{'all':!![]}];}_0x498fa9=_[_0x278d('0x49')]({},_0x498fa9,_0xc664[_0x278d('0x4a')]);return db[_0x278d('0x37')][_0x278d('0x52')](_0x498fa9)[_0x278d('0x32')](handleEntityNotFound(_0x534f67,null))[_0x278d('0x32')](respondWithResult(_0x534f67,null))['catch'](handleError(_0x534f67,null));};exports[_0x278d('0x31')]=function(_0x861ab3,_0xc757fb){if(_0x861ab3[_0x278d('0x53')]['id']){delete _0x861ab3[_0x278d('0x53')]['id'];}return db['FaxMessage'][_0x278d('0x52')]({'where':{'id':_0x861ab3['params']['id']}})[_0x278d('0x32')](handleEntityNotFound(_0xc757fb,null))[_0x278d('0x32')](saveUpdates(_0x861ab3[_0x278d('0x53')],null))[_0x278d('0x32')](respondWithResult(_0xc757fb,null))['catch'](handleError(_0xc757fb,null));};exports[_0x278d('0x54')]=function(_0x471126,_0x40083f){return db[_0x278d('0x37')][_0x278d('0x52')]({'where':{'id':_0x471126[_0x278d('0x50')]['id']}})[_0x278d('0x32')](handleEntityNotFound(_0x40083f,null))['then'](removeEntity(_0x40083f,null))[_0x278d('0x55')](handleError(_0x40083f,null));};exports[_0x278d('0x56')]=function(_0xeb5c46,_0x4e6f15){return db[_0x278d('0x37')]['describe']()[_0x278d('0x32')](respondWithResult(_0x4e6f15,null))[_0x278d('0x55')](handleError(_0x4e6f15,null));};var interaction_log=require('../../config/logger')(_0x278d('0x57'));exports[_0x278d('0x58')]=function(_0x32395b,_0x56eca3,_0x4e191d){var _0x1d4259={'agent':{},'channel':_0x278d('0x59')};if(_0x32395b['body']['id']){delete _0x32395b[_0x278d('0x53')]['id'];}_0x32395b[_0x278d('0x53')]['read']=!![];_0x32395b['body'][_0x278d('0x5a')]=moment()[_0x278d('0x5b')](_0x278d('0x5c'));_0x32395b[_0x278d('0x53')][_0x278d('0x5d')]=_0x32395b[_0x278d('0x53')][_0x278d('0x5d')]||_0x32395b['user']['id'];_0x1d4259['agent']['id']=_0x32395b['body'][_0x278d('0x5d')];return db[_0x278d('0x37')][_0x278d('0x52')]({'where':{'id':_0x32395b[_0x278d('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x56eca3,null))[_0x278d('0x32')](saveUpdates(_0x32395b[_0x278d('0x53')],null))[_0x278d('0x32')](function(_0x12ca1f){if(_0x12ca1f){_0x1d4259['message']=_0x12ca1f[_0x278d('0x5e')]({'plain':!![]});return db[_0x278d('0x5f')][_0x278d('0x52')]({'where':{'id':_0x12ca1f[_0x278d('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x56eca3,null))['then'](function(_0x522a69){if(_0x522a69){return _0x522a69[_0x278d('0x31')]({'UserId':_0x32395b[_0x278d('0x53')]['UserId'],'read1stAt':_[_0x278d('0x61')](_0x522a69['read1stAt'])?moment()[_0x278d('0x5b')](_0x278d('0x5c')):undefined});}return null;})['then'](function(_0x110f4c){if(_0x110f4c){_0x1d4259[_0x278d('0x62')]=_0x110f4c[_0x278d('0x5e')]({'plain':!![]});interaction_log[_0x278d('0x1d')](_0x278d('0x63'),_0x32395b[_0x278d('0x64')]['id'],_0x32395b[_0x278d('0x64')][_0x278d('0x34')],_0x32395b['user']['role'],_0x1d4259[_0x278d('0x62')]['id'],_0x32395b['body']?JSON[_0x278d('0x65')](_0x32395b[_0x278d('0x53')]):_0x278d('0x66'));return respondWithRpcPromise(_0x278d('0x67'),_0x278d('0x68'),_0x1d4259);}return null;})['then'](function(_0x489420){var _0x2b94d7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x489420['message'][_0x278d('0x69')];return db['sequelize'][_0x278d('0x3e')](_0x2b94d7,{'type':db[_0x278d('0x6a')][_0x278d('0x6b')][_0x278d('0x6c')],'raw':!![]})['then'](function(_0x19f28d){return _0x19f28d;});})[_0x278d('0x32')](function(_0x14f689){if(_0x14f689){_0x1d4259[_0x278d('0x22')][_0x278d('0x6d')]=_0x14f689[0x0];if(!_0x32395b[_0x278d('0x53')][_0x278d('0x5d')])return;return db['User']['find']({'where':{'id':_0x32395b[_0x278d('0x53')][_0x278d('0x5d')],'role':_0x278d('0x6e')},'attributes':['id',_0x278d('0x34'),_0x278d('0x6f'),_0x278d('0x70'),_0x278d('0x71')],'raw':!![]});}return null;})[_0x278d('0x32')](function(_0x1b03bb){if(!_0x1b03bb)return null;_0x1d4259[_0x278d('0x22')][_0x278d('0x6e')]=_0x1b03bb;return _0x1d4259;})['then'](function(_0x488a48){if(_0x488a48){if(_0x32395b[_0x278d('0x53')]['manual']){_0x1d4259[_0x278d('0x22')]['interface']=util['format'](_0x278d('0x72'),_0x32395b[_0x278d('0x64')][_0x278d('0x34')]);_0x1d4259[_0x278d('0x22')][_0x278d('0x73')]=_0x1d4259[_0x278d('0x73')];_0x1d4259[_0x278d('0x22')][_0x278d('0x74')]=_0x1d4259[_0x278d('0x73')];_0x1d4259[_0x278d('0x22')][_0x278d('0x75')]='accept';return respondWithRpcPromise('EventManager',_0x278d('0x76'),{'event':_0x278d('0x77'),'message':_0x1d4259[_0x278d('0x22')]},client9002)[_0x278d('0x32')](function(){return _0x1d4259;});}return _0x1d4259;}return null;})[_0x278d('0x32')](respondWithResult(_0x56eca3,null))[_0x278d('0x55')](handleError(_0x56eca3,null));};var interaction_log=require(_0x278d('0x78'))('fax-interactions');exports[_0x278d('0x2f')]=function(_0x5d4b64,_0x461ed2,_0x14d6df){var _0x3532a6={'agent':{},'channel':_0x278d('0x59')};if(_0x5d4b64[_0x278d('0x53')]['id']){delete _0x5d4b64[_0x278d('0x53')]['id'];}_0x5d4b64[_0x278d('0x53')][_0x278d('0x5d')]=_0x5d4b64[_0x278d('0x53')][_0x278d('0x5d')]||_0x5d4b64['user']['id'];_0x3532a6['agent']['id']=_0x5d4b64[_0x278d('0x53')][_0x278d('0x5d')];return db[_0x278d('0x37')][_0x278d('0x52')]({'where':{'id':_0x5d4b64[_0x278d('0x50')]['id'],'UserId':null}})[_0x278d('0x32')](handleEntityNotFound(_0x461ed2,null))[_0x278d('0x32')](function(_0x4d9847){if(_0x4d9847){_0x3532a6['message']=_0x4d9847['get']({'plain':!![]});return db[_0x278d('0x5f')][_0x278d('0x52')]({'where':{'id':_0x4d9847['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x461ed2,null))[_0x278d('0x32')](function(_0xe4b232){if(_0xe4b232){_0x3532a6[_0x278d('0x62')]=_0xe4b232[_0x278d('0x5e')]({'plain':!![]});interaction_log[_0x278d('0x1d')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5d4b64[_0x278d('0x64')]['id'],_0x5d4b64['user'][_0x278d('0x34')],_0x5d4b64['user'][_0x278d('0x79')],_0x3532a6['interaction']['id'],_0x5d4b64[_0x278d('0x53')]?JSON['stringify'](_0x5d4b64[_0x278d('0x53')]):_0x278d('0x66'));return respondWithRpcPromise(_0x278d('0x7a'),'rejectMessage',_0x3532a6);}return null;})[_0x278d('0x32')](function(_0xe5c69d){var _0x205d84=_0x278d('0x7b')+_0xe5c69d[_0x278d('0x22')]['ContactId'];return db[_0x278d('0x7c')]['query'](_0x205d84,{'type':db[_0x278d('0x6a')][_0x278d('0x6b')][_0x278d('0x6c')],'raw':!![]})[_0x278d('0x32')](function(_0x3e5095){return _0x3e5095;});})[_0x278d('0x32')](function(_0x45a228){if(_0x45a228){_0x3532a6[_0x278d('0x22')][_0x278d('0x6d')]=_0x45a228[0x0];if(!_0x5d4b64['body'][_0x278d('0x5d')])return;return db['User'][_0x278d('0x52')]({'where':{'id':_0x5d4b64['body'][_0x278d('0x5d')],'role':_0x278d('0x6e')},'attributes':['id',_0x278d('0x34'),_0x278d('0x6f'),_0x278d('0x70'),_0x278d('0x71')],'raw':!![]});}return null;})[_0x278d('0x32')](function(_0x25be68){if(!_0x25be68)return null;_0x3532a6[_0x278d('0x22')]['agent']=_0x25be68;return _0x3532a6;})['then'](function(_0x5293db){if(_0x5293db){_0x5293db[_0x278d('0x22')][_0x278d('0x7d')]=util[_0x278d('0x5b')](_0x278d('0x72'),_0x5d4b64['user'][_0x278d('0x34')]);_0x5293db['message']['channel']=_0x3532a6['channel'];_0x5293db['message'][_0x278d('0x74')]=_0x3532a6[_0x278d('0x73')];_0x5293db[_0x278d('0x22')]['event']=_0x278d('0x2f');respondWithRpcPromise(_0x278d('0x76'),_0x278d('0x76'),{'event':_0x278d('0x7e'),'message':_0x5293db[_0x278d('0x22')]},client9002);return _0x3532a6;}return null;})[_0x278d('0x32')](respondWithResult(_0x461ed2,null))[_0x278d('0x55')](handleError(_0x461ed2,null));};exports['create']=function(_0x25a206,_0x1893ad){var _0x4bcd6a;return db[_0x278d('0x37')]['create'](_0x25a206[_0x278d('0x53')],{})[_0x278d('0x32')](function(_0x524c1f){_0x4bcd6a=_0x524c1f;return db[_0x278d('0x7f')][_0x278d('0x80')]({'where':{'id':_0x4bcd6a[_0x278d('0x69')]}});})[_0x278d('0x32')](function(_0x1ef547){if(_[_0x278d('0x61')](_0x1ef547)){return;}else{_0x4bcd6a[_0x278d('0x59')]=_0x1ef547[_0x278d('0x59')];return db[_0x278d('0x81')][_0x278d('0x80')]({'where':{'id':_0x4bcd6a[_0x278d('0x82')]}});}})[_0x278d('0x32')](function(_0x257bf0){return respondWithRpcPromise('SendFax',_0x278d('0x83'),{'FaxAccountId':_[_0x278d('0x61')](_0x25a206[_0x278d('0x53')])?undefined:_0x25a206['body'][_0x278d('0x84')],'path':_['isNil'](_0x257bf0)?undefined:util[_0x278d('0x5b')](_0x278d('0x85'),_0x257bf0['basename']),'fax':_['isNil'](_0x4bcd6a['fax'])?undefined:_0x4bcd6a[_0x278d('0x59')],'AttachmentId':_0x4bcd6a[_0x278d('0x82')]},client9002);})[_0x278d('0x32')](respondWithResult(_0x1893ad,0xc9))[_0x278d('0x55')](handleError(_0x1893ad,null));};exports[_0x278d('0x86')]=function(_0x43683b,_0x17e62c){var _0x101253=path[_0x278d('0x87')](config[_0x278d('0x88')],_0x278d('0x89'),_0x278d('0x8a'),_0x278d('0x8b'));return db[_0x278d('0x37')][_0x278d('0x52')]({'where':{'id':_0x43683b[_0x278d('0x50')]['id']},'include':[{'model':db['Attachment'],'as':_0x278d('0x81')}]})['then'](handleEntityNotFound(_0x17e62c,null))[_0x278d('0x32')](function(_0x3a2ed9){if(_0x3a2ed9){return _0x17e62c['download'](path[_0x278d('0x87')](_0x101253,_0x3a2ed9[_0x278d('0x81')][_0x278d('0x8c')]));}})[_0x278d('0x55')](handleError(_0x17e62c,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index d8aa146..976d655 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 _0x576b=['emit','hasOwnProperty','hook','exports','setMaxListeners','save','remove'];(function(_0x575f44,_0x444098){var _0x195a90=function(_0x33d79f){while(--_0x33d79f){_0x575f44['push'](_0x575f44['shift']());}};_0x195a90(++_0x444098);}(_0x576b,0x1d9));var _0xb576=function(_0x4b233e,_0xc53d71){_0x4b233e=_0x4b233e-0x0;var _0x3819ba=_0x576b[_0x4b233e];return _0x3819ba;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xb576('0x0')](0x0);var events={'afterCreate':_0xb576('0x1'),'afterUpdate':'update','afterDestroy':_0xb576('0x2')};function emitEvent(_0x45dbdf){return function(_0x4e022a,_0x20cb85,_0x25bfec){FaxMessageEvents[_0xb576('0x3')](_0x45dbdf+':'+_0x4e022a['id'],_0x4e022a);FaxMessageEvents[_0xb576('0x3')](_0x45dbdf,_0x4e022a);_0x25bfec(null);};}for(var e in events){if(events[_0xb576('0x4')](e)){var event=events[e];FaxMessage[_0xb576('0x5')](e,emitEvent(event));}}module[_0xb576('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x3714=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x49cccd,_0x1ad8b3){var _0x52443c=function(_0x3218d2){while(--_0x3218d2){_0x49cccd['push'](_0x49cccd['shift']());}};_0x52443c(++_0x1ad8b3);}(_0x3714,0x95));var _0x4371=function(_0x3d5791,_0x3a858b){_0x3d5791=_0x3d5791-0x0;var _0x4a7962=_0x3714[_0x3d5791];return _0x4a7962;};'use strict';var EventEmitter=require(_0x4371('0x0'));var FaxMessage=require(_0x4371('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4371('0x2')](0x0);var events={'afterCreate':_0x4371('0x3'),'afterUpdate':_0x4371('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21bccf){return function(_0x20929e,_0x2c0435,_0x5a2ffa){FaxMessageEvents[_0x4371('0x5')](_0x21bccf+':'+_0x20929e['id'],_0x20929e);FaxMessageEvents['emit'](_0x21bccf,_0x20929e);_0x5a2ffa(null);};}for(var e in events){if(events[_0x4371('0x6')](e)){var event=events[e];FaxMessage[_0x4371('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index ac0b932..2c95512 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 _0x7127=['update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','api','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','FULLTEXT','direction','toLowerCase','out','isNil','FaxInteraction','findOne','FaxInteractionId','then'];(function(_0x593ba4,_0xdcc518){var _0x209bea=function(_0x4da944){while(--_0x4da944){_0x593ba4['push'](_0x593ba4['shift']());}};_0x209bea(++_0xdcc518);}(_0x7127,0x165));var _0x7712=function(_0x3a02aa,_0x33a2c7){_0x3a02aa=_0x3a02aa-0x0;var _0x33313b=_0x7127[_0x3a02aa];return _0x33313b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7712('0x0'));var moment=require(_0x7712('0x1'));var BPromise=require('bluebird');var rp=require(_0x7712('0x2'));var fs=require('fs');var path=require(_0x7712('0x3'));var rimraf=require(_0x7712('0x4'));var config=require(_0x7712('0x5'));var attributes=require(_0x7712('0x6'));module[_0x7712('0x7')]=function(_0x15425e,_0x59b02b){return _0x15425e[_0x7712('0x8')](_0x7712('0x9'),attributes,{'tableName':_0x7712('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x7712('0xb')],'type':_0x7712('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c892d,_0x25f263,_0x1ee270){var _0x27d5a8=_0x15425e['models'];var _0x457b7c=_0x2c892d['get']({'plain':!![]});if(_0x457b7c[_0x7712('0xd')][_0x7712('0xe')]()==='in'||_0x457b7c['direction'][_0x7712('0xe')]()===_0x7712('0xf')&&!_0x457b7c['secret']&&!_[_0x7712('0x10')](_0x457b7c['UserId'])){_0x27d5a8[_0x7712('0x11')][_0x7712('0x12')]({'where':{'id':_0x457b7c[_0x7712('0x13')]}})[_0x7712('0x14')](function(_0x4af331){if(_0x4af331){_0x4af331[_0x7712('0x15')]({'lastMsgAt':_0x457b7c[_0x7712('0x16')],'lastMsgDirection':_0x457b7c[_0x7712('0xd')][_0x7712('0xe')]()});}})[_0x7712('0x17')](function(_0x185a99){console[_0x7712('0x18')](_0x185a99);});}_0x1ee270();}},'charset':_0x7712('0x19'),'collate':_0x7712('0x1a')});}; \ No newline at end of file +var _0x4945=['out','isNil','UserId','findOne','then','update','error','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x4ec183,_0x4b41cb){var _0xe8726f=function(_0x5863a6){while(--_0x5863a6){_0x4ec183['push'](_0x4ec183['shift']());}};_0xe8726f(++_0x4b41cb);}(_0x4945,0x17f));var _0x5494=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4945[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5494('0x0'));var util=require('util');var logger=require(_0x5494('0x1'))(_0x5494('0x2'));var moment=require('moment');var BPromise=require(_0x5494('0x3'));var rp=require(_0x5494('0x4'));var fs=require('fs');var path=require(_0x5494('0x5'));var rimraf=require(_0x5494('0x6'));var config=require(_0x5494('0x7'));var attributes=require(_0x5494('0x8'));module['exports']=function(_0x55c352,_0xdc11da){return _0x55c352['define'](_0x5494('0x9'),attributes,{'tableName':_0x5494('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x5494('0xb')],'type':_0x5494('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ddf7b,_0x334441,_0xfdd04){var _0x3d444e=_0x55c352[_0x5494('0xd')];var _0x39c438=_0x1ddf7b[_0x5494('0xe')]({'plain':!![]});if(_0x39c438[_0x5494('0xf')]['toLowerCase']()==='in'||_0x39c438['direction'][_0x5494('0x10')]()===_0x5494('0x11')&&!_0x39c438['secret']&&!_[_0x5494('0x12')](_0x39c438[_0x5494('0x13')])){_0x3d444e['FaxInteraction'][_0x5494('0x14')]({'where':{'id':_0x39c438['FaxInteractionId']}})[_0x5494('0x15')](function(_0x2414d0){if(_0x2414d0){_0x2414d0[_0x5494('0x16')]({'lastMsgAt':_0x39c438['createdAt'],'lastMsgDirection':_0x39c438[_0x5494('0xf')][_0x5494('0x10')]()});}})['catch'](function(_0x12bd90){console[_0x5494('0x17')](_0x12bd90);});}_0xfdd04();}},'charset':_0x5494('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index dac4869..9c907f9 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 _0x5c12=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','then','stringify','UpdateFaxMessage','raw','attributes','limit','util','moment','randomstring','ioredis'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x5c12,0x188));var _0x25c1=function(_0x5dbb84,_0x1bbce9){_0x5dbb84=_0x5dbb84-0x0;var _0x1d6eae=_0x5c12[_0x5dbb84];return _0x1d6eae;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});config[_0x25c1('0xb')]=_['defaults'](config['redis'],{'host':_0x25c1('0xc'),'port':0x18eb});var socket=require(_0x25c1('0xd'))(new Redis(config[_0x25c1('0xb')]));require(_0x25c1('0xe'))[_0x25c1('0xf')](socket);function respondWithRpcPromise(_0x588f30,_0x3e062e,_0x41c89d){return new BPromise(function(_0x11a223,_0x81f0f4){return client[_0x25c1('0x10')](_0x588f30,_0x41c89d)['then'](function(_0x196e2f){logger[_0x25c1('0x11')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));logger[_0x25c1('0x13')](_0x25c1('0x14'),_0x3e062e,_0x25c1('0x12'),JSON['stringify'](_0x196e2f));if(_0x196e2f['error']){if(_0x196e2f['error']['code']===0x1f4){logger[_0x25c1('0x15')](_0x25c1('0x16'),_0x3e062e,_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);return _0x81f0f4(_0x196e2f[_0x25c1('0x15')]['message']);}logger[_0x25c1('0x15')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x196e2f['error']['message']);return _0x11a223(_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));_0x11a223(_0x196e2f['result'][_0x25c1('0x17')]);}})[_0x25c1('0x18')](function(_0x5c3c5d){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x5c3c5d);_0x81f0f4(_0x5c3c5d);});});}exports[_0x25c1('0x19')]=function(_0x3d3149){var _0x22a36e=this;return new Promise(function(_0x1bf95d,_0x481c12){return db[_0x25c1('0x1a')][_0x25c1('0x1b')](_0x3d3149[_0x25c1('0x1c')],{'raw':_0x3d3149[_0x25c1('0x1d')]?_0x3d3149['options']['raw']===undefined?!![]:![]:!![]})[_0x25c1('0x1e')](function(_0xac3335){logger[_0x25c1('0x11')](_0x25c1('0x19'),_0x3d3149);logger[_0x25c1('0x13')](_0x25c1('0x19'),_0x3d3149,JSON[_0x25c1('0x1f')](_0xac3335));_0x1bf95d(_0xac3335);})[_0x25c1('0x18')](function(_0x14ffd9){logger[_0x25c1('0x15')](_0x25c1('0x19'),_0x14ffd9[_0x25c1('0x17')],_0x3d3149);_0x481c12(_0x22a36e[_0x25c1('0x15')](0x1f4,_0x14ffd9['message']));});});};exports[_0x25c1('0x20')]=function(_0x20dbb9){var _0x1b1c96=this;return new Promise(function(_0x1fb59f,_0x21fdb8){return db[_0x25c1('0x1a')]['update'](_0x20dbb9[_0x25c1('0x1c')],{'raw':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')]['where']||null:null,'attributes':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9['options'][_0x25c1('0x22')]||null:null,'limit':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x23')]||null:null})[_0x25c1('0x1e')](function(_0x21069c){logger[_0x25c1('0x11')](_0x25c1('0x20'),_0x20dbb9);logger[_0x25c1('0x13')]('UpdateFaxMessage',_0x20dbb9,JSON[_0x25c1('0x1f')](_0x21069c));_0x1fb59f(_0x21069c);})['catch'](function(_0x492715){logger[_0x25c1('0x15')](_0x25c1('0x20'),_0x492715['message'],_0x20dbb9);_0x21fdb8(_0x1b1c96[_0x25c1('0x15')](0x1f4,_0x492715['message']));});});}; \ No newline at end of file +var _0x6aa7=['redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','create','options','raw','catch','update','body','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x4b82c8,_0x4c964b){var _0x4d8fc7=function(_0x3524fc){while(--_0x3524fc){_0x4b82c8['push'](_0x4b82c8['shift']());}};_0x4d8fc7(++_0x4c964b);}(_0x6aa7,0x178));var _0x76aa=function(_0x3b394e,_0x1cfb26){_0x3b394e=_0x3b394e-0x0;var _0x108f49=_0x6aa7[_0x3b394e];return _0x108f49;};'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});config[_0x76aa('0x9')]=_[_0x76aa('0xa')](config[_0x76aa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x76aa('0xb'))(new Redis(config[_0x76aa('0x9')]));require(_0x76aa('0xc'))['register'](socket);function respondWithRpcPromise(_0xcd99aa,_0x25856d,_0x41643a){return new BPromise(function(_0x16cb50,_0x37f1ab){return client[_0x76aa('0xd')](_0xcd99aa,_0x41643a)[_0x76aa('0xe')](function(_0x8dc35c){logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,'request\x20sent');logger[_0x76aa('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x25856d,_0x76aa('0x12'),JSON[_0x76aa('0x13')](_0x8dc35c));if(_0x8dc35c[_0x76aa('0x14')]){if(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x25856d,_0x8dc35c[_0x76aa('0x14')]['message']);return _0x37f1ab(_0x8dc35c[_0x76aa('0x14')][_0x76aa('0x16')]);}logger['error'](_0x76aa('0x10'),_0x25856d,_0x8dc35c['error'][_0x76aa('0x16')]);return _0x16cb50(_0x8dc35c['error'][_0x76aa('0x16')]);}else{logger[_0x76aa('0xf')](_0x76aa('0x10'),_0x25856d,_0x76aa('0x12'));_0x16cb50(_0x8dc35c[_0x76aa('0x17')][_0x76aa('0x16')]);}})['catch'](function(_0x5d6202){logger[_0x76aa('0x14')](_0x76aa('0x10'),_0x25856d,_0x5d6202);_0x37f1ab(_0x5d6202);});});}exports[_0x76aa('0x18')]=function(_0x15b931){var _0x15109b=this;return new Promise(function(_0x191560,_0x19af92){return db[_0x76aa('0x19')][_0x76aa('0x1a')](_0x15b931['body'],{'raw':_0x15b931[_0x76aa('0x1b')]?_0x15b931[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x41463a){logger[_0x76aa('0xf')](_0x76aa('0x18'),_0x15b931);logger[_0x76aa('0x11')](_0x76aa('0x18'),_0x15b931,JSON[_0x76aa('0x13')](_0x41463a));_0x191560(_0x41463a);})[_0x76aa('0x1d')](function(_0x3363b3){logger[_0x76aa('0x14')](_0x76aa('0x18'),_0x3363b3[_0x76aa('0x16')],_0x15b931);_0x19af92(_0x15109b[_0x76aa('0x14')](0x1f4,_0x3363b3[_0x76aa('0x16')]));});});};exports['UpdateFaxMessage']=function(_0xb5e8a9){var _0x1d6d15=this;return new Promise(function(_0x25c614,_0x2e7ab4){return db[_0x76aa('0x19')][_0x76aa('0x1e')](_0xb5e8a9[_0x76aa('0x1f')],{'raw':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb5e8a9['options']?_0xb5e8a9[_0x76aa('0x1b')]['where']||null:null,'attributes':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x20')]||null:null,'limit':_0xb5e8a9[_0x76aa('0x1b')]?_0xb5e8a9[_0x76aa('0x1b')][_0x76aa('0x21')]||null:null})[_0x76aa('0xe')](function(_0x3827ec){logger[_0x76aa('0xf')](_0x76aa('0x22'),_0xb5e8a9);logger['debug'](_0x76aa('0x22'),_0xb5e8a9,JSON[_0x76aa('0x13')](_0x3827ec));_0x25c614(_0x3827ec);})[_0x76aa('0x1d')](function(_0x928ccf){logger[_0x76aa('0x14')](_0x76aa('0x22'),_0x928ccf[_0x76aa('0x16')],_0xb5e8a9);_0x2e7ab4(_0x1d6d15['error'](0x1f4,_0x928ccf[_0x76aa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 8430d5a..4fff04e 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 _0x582c=['emit','removeListener','register','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x582c,0x191));var _0xc582=function(_0x4812e0,_0x2ccf3c){_0x4812e0=_0x4812e0-0x0;var _0x252e0f=_0x582c[_0x4812e0];return _0x252e0f;};'use strict';var FaxMessageEvents=require(_0xc582('0x0'));var events=[_0xc582('0x1'),_0xc582('0x2'),_0xc582('0x3')];function createListener(_0x17cd01,_0x486ca5){return function(_0x20a372){_0x486ca5[_0xc582('0x4')](_0x17cd01,_0x20a372);};}function removeListener(_0x5a2f64,_0x5c04f0){return function(){FaxMessageEvents[_0xc582('0x5')](_0x5a2f64,_0x5c04f0);};}exports[_0xc582('0x6')]=function(_0x17fbdf){for(var _0xe0bb82=0x0,_0x46bee1=events[_0xc582('0x7')];_0xe0bb82<_0x46bee1;_0xe0bb82++){var _0x11a64c=events[_0xe0bb82];var _0x4b067b=createListener(_0xc582('0x8')+_0x11a64c,_0x17fbdf);FaxMessageEvents['on'](_0x11a64c,_0x4b067b);}}; \ No newline at end of file +var _0xb614=['emit','length','./faxMessage.events','save','remove','update'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb614,0x188));var _0x4b61=function(_0x2b451b,_0x1bbbcc){_0x2b451b=_0x2b451b-0x0;var _0x2b38cb=_0xb614[_0x2b451b];return _0x2b38cb;};'use strict';var FaxMessageEvents=require(_0x4b61('0x0'));var events=[_0x4b61('0x1'),_0x4b61('0x2'),_0x4b61('0x3')];function createListener(_0x2c3917,_0x2002a0){return function(_0x58f44e){_0x2002a0[_0x4b61('0x4')](_0x2c3917,_0x58f44e);};}function removeListener(_0x3db1ce,_0x1c9e58){return function(){FaxMessageEvents['removeListener'](_0x3db1ce,_0x1c9e58);};}exports['register']=function(_0x1c7da3){for(var _0x1b1997=0x0,_0x306e4e=events[_0x4b61('0x5')];_0x1b1997<_0x306e4e;_0x1b1997++){var _0x29e7c4=events[_0x1b1997];var _0x22976e=createListener('faxMessage:'+_0x29e7c4,_0x1c7da3);FaxMessageEvents['on'](_0x29e7c4,_0x22976e);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index abdfd09..f2a0c0b 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 _0x579c=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x14362f,_0x259f11){var _0x41df87=function(_0x6ffeb5){while(--_0x6ffeb5){_0x14362f['push'](_0x14362f['shift']());}};_0x41df87(++_0x259f11);}(_0x579c,0xda));var _0xc579=function(_0x40e608,_0x3ca39b){_0x40e608=_0x40e608-0x0;var _0x5abb79=_0x579c[_0x40e608];return _0x5abb79;};'use strict';var multer=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var path=require(_0xc579('0x2'));var timeout=require(_0xc579('0x3'));var express=require(_0xc579('0x4'));var router=express['Router']();var fs_extra=require(_0xc579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var controller=require(_0xc579('0x8'));router[_0xc579('0x9')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xb')]);router[_0xc579('0x9')]('/describe',auth[_0xc579('0xa')](),controller[_0xc579('0xc')]);router[_0xc579('0x9')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0xe')]);router[_0xc579('0x9')](_0xc579('0xf'),auth['isAuthenticated'](),controller[_0xc579('0x10')]);router[_0xc579('0x11')]('/',auth[_0xc579('0xa')](),interaction[_0xc579('0x12')](_0xc579('0x13'),_0xc579('0x14')),controller[_0xc579('0x15')]);router[_0xc579('0x16')](_0xc579('0xd'),auth[_0xc579('0xa')](),controller[_0xc579('0x17')]);router['put'](_0xc579('0x18'),auth['isAuthenticated'](),controller[_0xc579('0x19')]);router['put'](_0xc579('0x1a'),auth['isAuthenticated'](),controller[_0xc579('0x1b')]);router['delete'](_0xc579('0xd'),auth[_0xc579('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4522=['destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','fax','faxmessage:create','create','put','reject'];(function(_0x512693,_0x1c254b){var _0x567a37=function(_0x3a7bff){while(--_0x3a7bff){_0x512693['push'](_0x512693['shift']());}};_0x567a37(++_0x1c254b);}(_0x4522,0x1a0));var _0x2452=function(_0x42c8ce,_0xdc007f){_0x42c8ce=_0x42c8ce-0x0;var _0x348975=_0x4522[_0x42c8ce];return _0x348975;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['get']('/:id/download',auth[_0x2452('0x9')](),controller['download']);router['post']('/',auth[_0x2452('0x9')](),interaction[_0x2452('0xf')](_0x2452('0x10'),_0x2452('0x11')),controller[_0x2452('0x12')]);router[_0x2452('0x13')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller['update']);router['put']('/:id/accept',auth[_0x2452('0x9')](),controller['accept']);router[_0x2452('0x13')]('/:id/reject',auth[_0x2452('0x9')](),controller[_0x2452('0x14')]);router['delete'](_0x2452('0xd'),auth['isAuthenticated'](),controller[_0x2452('0x15')]);module[_0x2452('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index ba90607..a0a0a53 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 _0x8bca=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0xb1fbab,_0x57f1fc){var _0x18488d=function(_0x166a31){while(--_0x166a31){_0xb1fbab['push'](_0xb1fbab['shift']());}};_0x18488d(++_0x57f1fc);}(_0x8bca,0x12b));var _0xa8bc=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x8bca[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xa8bc('0x0'));module[_0xa8bc('0x1')]={'name':{'type':Sequelize[_0xa8bc('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa8bc('0x2')]},'timeout':{'type':Sequelize[_0xa8bc('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa8bc('0x4')](_0xa8bc('0x5'),_0xa8bc('0x6'),_0xa8bc('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa8bc('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb89a=['sequelize','STRING','rrmemory','beepall','roundrobin','INTEGER'];(function(_0x1b8684,_0x3d8a1f){var _0x5b5610=function(_0x1e2f05){while(--_0x1e2f05){_0x1b8684['push'](_0x1b8684['shift']());}};_0x5b5610(++_0x3d8a1f);}(_0xb89a,0xde));var _0xab89=function(_0x25b459,_0x347064){_0x25b459=_0x25b459-0x0;var _0x4da043=_0xb89a[_0x25b459];return _0x4da043;};'use strict';var Sequelize=require(_0xab89('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xab89('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xab89('0x2'),_0xab89('0x3'),_0xab89('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xab89('0x5')],'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 7e02a2a..0a127c9 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 _0xb964=['offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','FaxQueues','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','include','findAll','rows','catch','params','includeAll','create','body','role','user','UserProfileSection','autoAssociation','UserProfileResource','error','find','describe','getMembers','hasOwnProperty','options','UserFaxQueue','UserId','agent','updatedAt','createdAt','format','getTeams','findOne','Team','pick','ids','User','Agents','online','voicePause','interface','flatMap','transaction','addTeams','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','all','union','value','isEmpty','userFaxQueue:remove','addAgents','spread','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xb964,0xef));var _0x4b96=function(_0x2a1c0f,_0x4145ac){_0x2a1c0f=_0x2a1c0f-0x0;var _0x201671=_0xb964[_0x2a1c0f];return _0x201671;};'use strict';var emlformat=require(_0x4b96('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b96('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b96('0x2'));var moment=require(_0x4b96('0x3'));var BPromise=require(_0x4b96('0x4'));var Mustache=require(_0x4b96('0x5'));var util=require(_0x4b96('0x6'));var path=require(_0x4b96('0x7'));var sox=require('sox');var csv=require(_0x4b96('0x8'));var ejs=require(_0x4b96('0x9'));var fs=require('fs');var fs_extra=require(_0x4b96('0xa'));var _=require(_0x4b96('0xb'));var squel=require(_0x4b96('0xc'));var crypto=require(_0x4b96('0xd'));var jsforce=require(_0x4b96('0xe'));var deskjs=require(_0x4b96('0xf'));var toCsv=require(_0x4b96('0x8'));var querystring=require(_0x4b96('0x10'));var Papa=require('papaparse');var Redis=require(_0x4b96('0x11'));var authService=require(_0x4b96('0x12'));var qs=require(_0x4b96('0x13'));var as=require(_0x4b96('0x14'));var hardwareService=require(_0x4b96('0x15'));var logger=require(_0x4b96('0x16'))(_0x4b96('0x17'));var utils=require('../../config/utils');var config=require(_0x4b96('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4b96('0x19')]=_['defaults'](config[_0x4b96('0x19')],{'host':_0x4b96('0x1a'),'port':0x18eb});var socket=require(_0x4b96('0x1b'))(new Redis(config[_0x4b96('0x19')]));require(_0x4b96('0x1c'))[_0x4b96('0x1d')](socket);function respondWithStatusCode(_0x59eeda,_0x2f9af0){_0x2f9af0=_0x2f9af0||0xcc;return function(_0x523ee8){if(_0x523ee8){return _0x59eeda[_0x4b96('0x1e')](_0x2f9af0);}return _0x59eeda[_0x4b96('0x1f')](_0x2f9af0)['end']();};}function respondWithResult(_0x357f83,_0x26762f){_0x26762f=_0x26762f||0xc8;return function(_0x2ef76b){if(_0x2ef76b){return _0x357f83[_0x4b96('0x1f')](_0x26762f)[_0x4b96('0x20')](_0x2ef76b);}};}function respondWithFilteredResult(_0x5a2c11,_0x2e8ae0){return function(_0x31466f){if(_0x31466f){var _0x3abc0a=typeof _0x2e8ae0[_0x4b96('0x21')]===_0x4b96('0x22')&&typeof _0x2e8ae0[_0x4b96('0x23')]===_0x4b96('0x22');var _0x3c412d=_0x31466f[_0x4b96('0x24')];var _0x184752=_0x3abc0a?0x0:_0x2e8ae0[_0x4b96('0x21')];var _0x3d8431=_0x3abc0a?_0x31466f[_0x4b96('0x24')]:_0x2e8ae0['offset']+_0x2e8ae0[_0x4b96('0x23')];var _0x55595c;if(_0x3d8431>=_0x3c412d){_0x3d8431=_0x3c412d;_0x55595c=0xc8;}else{_0x55595c=0xce;}_0x5a2c11[_0x4b96('0x1f')](_0x55595c);return _0x5a2c11[_0x4b96('0x25')](_0x4b96('0x26'),_0x184752+'-'+_0x3d8431+'/'+_0x3c412d)[_0x4b96('0x20')](_0x31466f);}return null;};}function patchUpdates(_0x23cfd2){return function(_0x57b61a){try{jsonpatch[_0x4b96('0x27')](_0x57b61a,_0x23cfd2,!![]);}catch(_0x4ef2b2){return BPromise[_0x4b96('0x28')](_0x4ef2b2);}return _0x57b61a['save']();};}function saveUpdates(_0xc33807,_0x4a7e65){return function(_0x5c813b){if(_0x5c813b){return _0x5c813b[_0x4b96('0x29')](_0xc33807)[_0x4b96('0x2a')](function(_0x417c93){return _0x417c93;});}return null;};}function removeEntity(_0x273214,_0x36ffd4){return function(_0x29eaf1){if(_0x29eaf1){return _0x29eaf1[_0x4b96('0x2b')]()[_0x4b96('0x2a')](function(){var _0x3391ac=_0x29eaf1[_0x4b96('0x2c')]({'plain':!![]});var _0x691e17=_0x4b96('0x2d');return db['UserProfileResource'][_0x4b96('0x2b')]({'where':{'type':_0x691e17,'resourceId':_0x3391ac['id']}})[_0x4b96('0x2a')](function(){return _0x29eaf1;});})[_0x4b96('0x2a')](function(){_0x273214[_0x4b96('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59b9e3,_0x2ff7f8){return function(_0x1ded9c){if(!_0x1ded9c){_0x59b9e3['sendStatus'](0x194);}return _0x1ded9c;};}function handleError(_0x69d7fb,_0x1d01b3){_0x1d01b3=_0x1d01b3||0x1f4;return function(_0x4cd4b9){logger['error'](_0x4cd4b9[_0x4b96('0x2e')]);if(_0x4cd4b9['name']){delete _0x4cd4b9[_0x4b96('0x2f')];}_0x69d7fb['status'](_0x1d01b3)[_0x4b96('0x30')](_0x4cd4b9);};}exports[_0x4b96('0x31')]=function(_0x106ae3,_0x59c82c){var _0x4d7524={},_0x8b958a={},_0x25829e={'count':0x0,'rows':[]};var _0x39a93a=_['map'](db[_0x4b96('0x32')][_0x4b96('0x33')],function(_0x588fff){return{'name':_0x588fff[_0x4b96('0x34')],'type':_0x588fff[_0x4b96('0x35')][_0x4b96('0x36')]};});_0x8b958a[_0x4b96('0x37')]=_[_0x4b96('0x38')](_0x39a93a,_0x4b96('0x2f'));_0x8b958a['query']=_[_0x4b96('0x39')](_0x106ae3[_0x4b96('0x3a')]);_0x8b958a[_0x4b96('0x3b')]=_[_0x4b96('0x3c')](_0x8b958a[_0x4b96('0x37')],_0x8b958a[_0x4b96('0x3a')]);_0x4d7524[_0x4b96('0x3d')]=_[_0x4b96('0x3c')](_0x8b958a[_0x4b96('0x37')],qs[_0x4b96('0x3e')](_0x106ae3[_0x4b96('0x3a')][_0x4b96('0x3e')]));_0x4d7524[_0x4b96('0x3d')]=_0x4d7524['attributes'][_0x4b96('0x3f')]?_0x4d7524[_0x4b96('0x3d')]:_0x8b958a[_0x4b96('0x37')];if(!_0x106ae3[_0x4b96('0x3a')]['hasOwnProperty'](_0x4b96('0x40'))){_0x4d7524[_0x4b96('0x23')]=qs[_0x4b96('0x23')](_0x106ae3[_0x4b96('0x3a')][_0x4b96('0x23')]);_0x4d7524[_0x4b96('0x21')]=qs[_0x4b96('0x21')](_0x106ae3[_0x4b96('0x3a')][_0x4b96('0x21')]);}_0x4d7524[_0x4b96('0x41')]=qs[_0x4b96('0x42')](_0x106ae3['query'][_0x4b96('0x42')]);_0x4d7524['where']=qs['filters'](_['pick'](_0x106ae3[_0x4b96('0x3a')],_0x8b958a[_0x4b96('0x3b')]),_0x39a93a);if(_0x106ae3['query'][_0x4b96('0x43')]){_0x4d7524[_0x4b96('0x44')]=_[_0x4b96('0x45')](_0x4d7524[_0x4b96('0x44')],{'$or':_[_0x4b96('0x38')](_0x39a93a,function(_0x3d678e){if(_0x3d678e[_0x4b96('0x35')]!=='VIRTUAL'){var _0x3535e3={};_0x3535e3[_0x3d678e['name']]={'$like':'%'+_0x106ae3[_0x4b96('0x3a')][_0x4b96('0x43')]+'%'};return _0x3535e3;}})});}_0x4d7524=_[_0x4b96('0x45')]({},_0x4d7524,_0x106ae3['options']);var _0x5b2a71={'where':_0x4d7524[_0x4b96('0x44')]};return db[_0x4b96('0x32')][_0x4b96('0x24')](_0x5b2a71)[_0x4b96('0x2a')](function(_0x4d5d83){_0x25829e[_0x4b96('0x24')]=_0x4d5d83;if(_0x106ae3[_0x4b96('0x3a')]['includeAll']){_0x4d7524[_0x4b96('0x46')]=[{'all':!![]}];}return db[_0x4b96('0x32')][_0x4b96('0x47')](_0x4d7524);})[_0x4b96('0x2a')](function(_0x39df72){_0x25829e[_0x4b96('0x48')]=_0x39df72;return _0x25829e;})[_0x4b96('0x2a')](respondWithFilteredResult(_0x59c82c,_0x4d7524))[_0x4b96('0x49')](handleError(_0x59c82c,null));};exports['show']=function(_0x5426cc,_0x4f78fa){var _0xa9c15f={'raw':!![],'where':{'id':_0x5426cc[_0x4b96('0x4a')]['id']}},_0x5b7d48={};_0x5b7d48[_0x4b96('0x37')]=_[_0x4b96('0x39')](db[_0x4b96('0x32')][_0x4b96('0x33')]);_0x5b7d48[_0x4b96('0x3a')]=_[_0x4b96('0x39')](_0x5426cc[_0x4b96('0x3a')]);_0x5b7d48[_0x4b96('0x3b')]=_[_0x4b96('0x3c')](_0x5b7d48[_0x4b96('0x37')],_0x5b7d48[_0x4b96('0x3a')]);_0xa9c15f[_0x4b96('0x3d')]=_[_0x4b96('0x3c')](_0x5b7d48[_0x4b96('0x37')],qs[_0x4b96('0x3e')](_0x5426cc[_0x4b96('0x3a')]['fields']));_0xa9c15f[_0x4b96('0x3d')]=_0xa9c15f[_0x4b96('0x3d')][_0x4b96('0x3f')]?_0xa9c15f[_0x4b96('0x3d')]:_0x5b7d48['model'];if(_0x5426cc[_0x4b96('0x3a')][_0x4b96('0x4b')]){_0xa9c15f['include']=[{'all':!![]}];}_0xa9c15f=_[_0x4b96('0x45')]({},_0xa9c15f,_0x5426cc['options']);return db['FaxQueue']['find'](_0xa9c15f)[_0x4b96('0x2a')](handleEntityNotFound(_0x4f78fa,null))[_0x4b96('0x2a')](respondWithResult(_0x4f78fa,null))['catch'](handleError(_0x4f78fa,null));};exports[_0x4b96('0x4c')]=function(_0x4cb51e,_0x3fc3e1){return db['FaxQueue'][_0x4b96('0x4c')](_0x4cb51e[_0x4b96('0x4d')],{})['then'](function(_0x3d7655){var _0x491625=_0x4cb51e['user'][_0x4b96('0x2c')]({'plain':!![]});if(!_0x491625)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x491625[_0x4b96('0x4e')]===_0x4b96('0x4f')){var _0x5890e6=_0x3d7655[_0x4b96('0x2c')]({'plain':!![]});var _0x362d29='FaxQueues';return db[_0x4b96('0x50')]['find']({'where':{'name':_0x362d29,'userProfileId':_0x491625['userProfileId']},'raw':!![]})['then'](function(_0x3a0bd2){if(_0x3a0bd2&&_0x3a0bd2[_0x4b96('0x51')]===0x0){return db[_0x4b96('0x52')][_0x4b96('0x4c')]({'name':_0x5890e6[_0x4b96('0x2f')],'resourceId':_0x5890e6['id'],'type':_0x3a0bd2[_0x4b96('0x2f')],'sectionId':_0x3a0bd2['id']},{})[_0x4b96('0x2a')](function(){return _0x3d7655;});}else{return _0x3d7655;}})['catch'](function(_0x59de26){logger[_0x4b96('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59de26);throw _0x59de26;});}return _0x3d7655;})[_0x4b96('0x2a')](respondWithResult(_0x3fc3e1,0xc9))['catch'](handleError(_0x3fc3e1,null));};exports[_0x4b96('0x29')]=function(_0x597773,_0x5869e2){if(_0x597773['body']['id']){delete _0x597773[_0x4b96('0x4d')]['id'];}return db[_0x4b96('0x32')]['find']({'where':{'id':_0x597773[_0x4b96('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5869e2,null))['then'](saveUpdates(_0x597773[_0x4b96('0x4d')],null))[_0x4b96('0x2a')](respondWithResult(_0x5869e2,null))[_0x4b96('0x49')](handleError(_0x5869e2,null));};exports[_0x4b96('0x2b')]=function(_0x43cf20,_0x597921){return db[_0x4b96('0x32')][_0x4b96('0x54')]({'where':{'id':_0x43cf20['params']['id']}})[_0x4b96('0x2a')](handleEntityNotFound(_0x597921,null))[_0x4b96('0x2a')](removeEntity(_0x597921,null))[_0x4b96('0x49')](handleError(_0x597921,null));};exports[_0x4b96('0x55')]=function(_0x5a086f,_0x19e89b){return db[_0x4b96('0x32')][_0x4b96('0x55')]()[_0x4b96('0x2a')](respondWithResult(_0x19e89b,null))[_0x4b96('0x49')](handleError(_0x19e89b,null));};exports[_0x4b96('0x56')]=function(_0x537927,_0x54ff58,_0x3ce0a1){var _0x101d01={'raw':!![],'where':{}},_0x1f7b7a={},_0x14a338;return db[_0x4b96('0x32')]['findOne']({'where':{'id':_0x537927[_0x4b96('0x4a')]['id']}})[_0x4b96('0x2a')](handleEntityNotFound(_0x54ff58,null))[_0x4b96('0x2a')](function(_0x25d8dd){if(_0x25d8dd){_0x14a338=_0x25d8dd[_0x4b96('0x2c')]({'plain':!![]});_0x1f7b7a[_0x4b96('0x37')]=_['keys'](db['UserFaxQueue'][_0x4b96('0x33')]);_0x1f7b7a[_0x4b96('0x3a')]=_['keys'](_0x537927[_0x4b96('0x3a')]);_0x1f7b7a['filters']=_['intersection'](_0x1f7b7a['model'],_0x1f7b7a[_0x4b96('0x3a')]);_0x101d01[_0x4b96('0x3d')]=_['intersection'](_0x1f7b7a['model'],qs[_0x4b96('0x3e')](_0x537927[_0x4b96('0x3a')]['fields']));_0x101d01[_0x4b96('0x3d')]=_0x101d01['attributes']['length']?_0x101d01[_0x4b96('0x3d')]:_0x1f7b7a['model'];if(!_0x537927[_0x4b96('0x3a')][_0x4b96('0x57')](_0x4b96('0x40'))){_0x101d01['limit']=qs[_0x4b96('0x23')](_0x537927[_0x4b96('0x3a')]['limit']);_0x101d01[_0x4b96('0x21')]=qs[_0x4b96('0x21')](_0x537927[_0x4b96('0x3a')][_0x4b96('0x21')]);}_0x101d01['order']=qs[_0x4b96('0x42')](_0x537927[_0x4b96('0x3a')][_0x4b96('0x42')]);_0x101d01[_0x4b96('0x44')]=qs[_0x4b96('0x3b')](_['pick'](_0x537927[_0x4b96('0x3a')],_0x1f7b7a[_0x4b96('0x3b')]));_0x101d01[_0x4b96('0x44')]['FaxQueueId']=_0x25d8dd['id'];if(_0x537927[_0x4b96('0x3a')]['filter']){_0x101d01[_0x4b96('0x44')]=_['merge'](_0x101d01[_0x4b96('0x44')],{'$or':_[_0x4b96('0x38')](_0x101d01[_0x4b96('0x3d')],function(_0x4b66c8){var _0x4e7f46={};_0x4e7f46[_0x4b66c8]={'$like':'%'+_0x537927[_0x4b96('0x3a')]['filter']+'%'};return _0x4e7f46;})});}_0x101d01=_[_0x4b96('0x45')]({},_0x101d01,_0x537927[_0x4b96('0x58')]);return db[_0x4b96('0x59')]['findAll'](_0x101d01);}})['then'](function(_0x60af1d){if(_0x60af1d){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x60af1d,_0x4b96('0x5a')),'role':_0x4b96('0x5b')},'attributes':['id',_0x4b96('0x2f'),'faxPause',_0x4b96('0x5c'),_0x4b96('0x5d')]});}})[_0x4b96('0x2a')](function(_0x59782c){if(_0x59782c){return{'count':_0x59782c[_0x4b96('0x24')],'rows':_[_0x4b96('0x38')](_0x59782c[_0x4b96('0x48')],function(_0x236cda){return{'membername':_0x236cda[_0x4b96('0x2f')],'UserId':_0x236cda['id'],'queue_name':_0x14a338[_0x4b96('0x2f')],'FaxQueueId':_0x14a338['id'],'interface':util[_0x4b96('0x5e')]('%s/%s','SIP',_0x236cda[_0x4b96('0x2f')]),'penalty':0x0,'paused':_0x236cda['faxPause'],'createdAt':_0x236cda[_0x4b96('0x5d')],'updatedAt':_0x236cda['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b96('0x2a')](respondWithFilteredResult(_0x54ff58,_0x101d01))['catch'](handleError(_0x54ff58,null));};exports[_0x4b96('0x5f')]=function(_0x518780,_0x91c27b,_0x3e82c9){var _0x3335a9={};var _0x3276d8={};var _0x3a3248;var _0x2a3f06;return db['FaxQueue'][_0x4b96('0x60')]({'where':{'id':_0x518780['params']['id']}})[_0x4b96('0x2a')](handleEntityNotFound(_0x91c27b,null))[_0x4b96('0x2a')](function(_0x363d12){if(_0x363d12){_0x3a3248=_0x363d12;_0x3276d8[_0x4b96('0x37')]=_['keys'](db[_0x4b96('0x61')][_0x4b96('0x33')]);_0x3276d8[_0x4b96('0x3a')]=_[_0x4b96('0x39')](_0x518780['query']);_0x3276d8[_0x4b96('0x3b')]=_[_0x4b96('0x3c')](_0x3276d8[_0x4b96('0x37')],_0x3276d8[_0x4b96('0x3a')]);_0x3335a9['attributes']=_[_0x4b96('0x3c')](_0x3276d8[_0x4b96('0x37')],qs[_0x4b96('0x3e')](_0x518780[_0x4b96('0x3a')][_0x4b96('0x3e')]));_0x3335a9[_0x4b96('0x3d')]=_0x3335a9[_0x4b96('0x3d')]['length']?_0x3335a9['attributes']:_0x3276d8[_0x4b96('0x37')];_0x3335a9[_0x4b96('0x41')]=qs['sort'](_0x518780['query'][_0x4b96('0x42')]);_0x3335a9[_0x4b96('0x44')]=qs[_0x4b96('0x3b')](_[_0x4b96('0x62')](_0x518780[_0x4b96('0x3a')],_0x3276d8[_0x4b96('0x3b')]));if(_0x518780[_0x4b96('0x3a')][_0x4b96('0x43')]){_0x3335a9[_0x4b96('0x44')]=_[_0x4b96('0x45')](_0x3335a9[_0x4b96('0x44')],{'$or':_[_0x4b96('0x38')](_0x3335a9[_0x4b96('0x3d')],function(_0x146e85){var _0x5bf090={};_0x5bf090[_0x146e85]={'$like':'%'+_0x518780[_0x4b96('0x3a')]['filter']+'%'};return _0x5bf090;})});}_0x3335a9=_['merge']({},_0x3335a9,_0x518780['options']);return _0x3a3248[_0x4b96('0x5f')](_0x3335a9);}})[_0x4b96('0x2a')](function(_0x1c88c9){if(_0x1c88c9){_0x2a3f06=_0x1c88c9[_0x4b96('0x3f')];if(!_0x518780[_0x4b96('0x3a')][_0x4b96('0x57')](_0x4b96('0x40'))){_0x3335a9[_0x4b96('0x23')]=qs['limit'](_0x518780[_0x4b96('0x3a')][_0x4b96('0x23')]);_0x3335a9[_0x4b96('0x21')]=qs['offset'](_0x518780[_0x4b96('0x3a')]['offset']);}return _0x3a3248[_0x4b96('0x5f')](_0x3335a9);}})[_0x4b96('0x2a')](function(_0x520b38){if(_0x520b38){return _0x520b38?{'count':_0x2a3f06,'rows':_0x520b38}:null;}})['then'](respondWithResult(_0x91c27b,null))[_0x4b96('0x49')](handleError(_0x91c27b,null));};exports['addTeams']=function(_0x2e2439,_0x12273c,_0x26fbc6){var _0x5a740d=_0x2e2439['body'][_0x4b96('0x63')];return db['Team'][_0x4b96('0x47')]({'where':{'id':_0x5a740d},'attributes':['id'],'include':[{'model':db[_0x4b96('0x64')],'as':_0x4b96('0x65'),'attributes':['id',_0x4b96('0x2f'),_0x4b96('0x66'),_0x4b96('0x67'),_0x4b96('0x68')],'raw':!![]}]})[_0x4b96('0x2a')](function(_0x1131fb){if(_0x1131fb){var _0x2b9077=_[_0x4b96('0x69')](_0x1131fb,function(_0x3fc152){var _0x3aaa25=_0x3fc152['get']({'plain':!![]});return _0x3aaa25[_0x4b96('0x65')];});return db['FaxQueue'][_0x4b96('0x54')]({'where':{'id':_0x2e2439['params']['id']}})[_0x4b96('0x2a')](function(_0x498cff){return db['sequelize'][_0x4b96('0x6a')](function(_0x585806){return _0x498cff[_0x4b96('0x6b')](_0x5a740d,{'transaction':_0x585806})[_0x4b96('0x2a')](function(){return BPromise['each'](_0x2b9077,function(_0x5df228){return db[_0x4b96('0x59')][_0x4b96('0x6c')]({'where':{'UserId':_0x5df228['id'],'FaxQueueId':_0x2e2439[_0x4b96('0x4a')]['id']},'transaction':_0x585806});});})[_0x4b96('0x2a')](function(){_0x2b9077[_0x4b96('0x6d')](function(_0x3b8524){socket[_0x4b96('0x6e')](_0x4b96('0x6f'),{'UserId':_0x3b8524['id'],'FaxQueueId':_0x498cff['id']});});});});});}})[_0x4b96('0x2a')](respondWithStatusCode(_0x12273c,null))['catch'](handleError(_0x12273c,null));};exports[_0x4b96('0x70')]=function(_0x38b13b,_0x30f9a2,_0x247357){return db[_0x4b96('0x61')]['findAll']({'where':{'id':_0x38b13b[_0x4b96('0x3a')][_0x4b96('0x63')]},'attributes':['id'],'include':[{'model':db[_0x4b96('0x64')],'as':_0x4b96('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x30f9a2,null))[_0x4b96('0x2a')](function(_0x525a30){var _0x14708f=_[_0x4b96('0x38')](_0x525a30,'id');var _0x46f8b1=[];var _0xaca6c0=[];var _0x322b4a=squel[_0x4b96('0x71')]();_0x322b4a[_0x4b96('0x72')](_0x4b96('0x73'))['from'](_0x4b96('0x74'),'tq')['join'](_0x4b96('0x75'),'ut',_0x4b96('0x76'))['where'](_0x4b96('0x77'),_0x38b13b[_0x4b96('0x4a')]['id']);for(var _0x25c833=0x0;_0x25c833<_0x525a30[_0x4b96('0x3f')];_0x25c833+=0x1){let _0x4a7451=_0x525a30[_0x25c833];for(var _0x2fda4f=0x0;_0x2fda4f<_0x4a7451[_0x4b96('0x65')]['length'];_0x2fda4f+=0x1){let _0x1eb79b=_0x4a7451['Agents'][_0x2fda4f];var _0xc522ee=_0x322b4a[_0x4b96('0x78')]();_0xc522ee['where'](_0x4b96('0x79'),_0x1eb79b['id']);_0xaca6c0[_0x4b96('0x7a')](db[_0x4b96('0x7b')]['query'](_0xc522ee[_0x4b96('0x7c')](),{'type':db[_0x4b96('0x7b')][_0x4b96('0x7d')][_0x4b96('0x7e')]})[_0x4b96('0x2a')](function(_0x5c101b){if(_0x5c101b[_0x4b96('0x3f')]===0x1){return _0x1eb79b['id'];}else{var _0x4ed67f=_['every'](_['map'](_0x5c101b,_0x4b96('0x7f')),function(_0x1f83da){return _['includes'](_0x14708f,_0x1f83da);});if(_0x4ed67f){return _0x1eb79b['id'];}}}));}}return BPromise[_0x4b96('0x80')](_0xaca6c0)[_0x4b96('0x2a')](function(_0x5ada61){_0x46f8b1=_(_0x46f8b1)[_0x4b96('0x81')](_0x5ada61)['compact']()[_0x4b96('0x82')]();return db[_0x4b96('0x32')]['find']({'where':{'id':_0x38b13b[_0x4b96('0x4a')]['id']}})['then'](function(_0x6292af){return db[_0x4b96('0x7b')][_0x4b96('0x6a')](function(_0x10bd9d){return _0x6292af[_0x4b96('0x70')](_0x38b13b[_0x4b96('0x3a')][_0x4b96('0x63')],{'transaction':_0x10bd9d})[_0x4b96('0x2a')](function(){if(!_[_0x4b96('0x83')](_0x46f8b1)){return _0x6292af['removeAgents'](_0x46f8b1,{'transaction':_0x10bd9d});}})[_0x4b96('0x2a')](function(){_0x46f8b1[_0x4b96('0x6d')](function(_0x5646a6){socket['emit'](_0x4b96('0x84'),{'UserId':_0x5646a6,'FaxQueueId':_0x6292af['id']});});});});});});})['then'](respondWithStatusCode(_0x30f9a2,null))[_0x4b96('0x49')](handleError(_0x30f9a2,null));};exports[_0x4b96('0x85')]=function(_0x16ab5a,_0x51ef1f,_0x2c65aa){return db['FaxQueue'][_0x4b96('0x54')]({'where':{'id':_0x16ab5a[_0x4b96('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51ef1f,null))[_0x4b96('0x2a')](function(_0xe58d23){if(_0xe58d23){return _0xe58d23['addAgents'](_0x16ab5a[_0x4b96('0x4d')][_0x4b96('0x63')],_['omit'](_0x16ab5a['body'],[_0x4b96('0x63'),'id'])||{})[_0x4b96('0x86')](function(_0x1679ad){for(var _0x42f9d3=0x0;_0x42f9d3<_0x16ab5a[_0x4b96('0x4d')][_0x4b96('0x63')][_0x4b96('0x3f')];_0x42f9d3+=0x1){socket[_0x4b96('0x6e')](_0x4b96('0x6f'),{'UserId':Number(_0x16ab5a[_0x4b96('0x4d')][_0x4b96('0x63')][_0x42f9d3]),'FaxQueueId':Number(_0x16ab5a[_0x4b96('0x4a')]['id'])});}return _0x1679ad;});}})[_0x4b96('0x2a')](respondWithResult(_0x51ef1f,null))[_0x4b96('0x49')](handleError(_0x51ef1f,null));};exports['removeAgents']=function(_0x18d70c,_0x20ddb7,_0x3b4e6e){return db[_0x4b96('0x32')][_0x4b96('0x54')]({'where':{'id':_0x18d70c[_0x4b96('0x4a')]['id']}})[_0x4b96('0x2a')](handleEntityNotFound(_0x20ddb7,null))[_0x4b96('0x2a')](function(_0x5cb05b){if(_0x5cb05b){return _0x5cb05b['removeAgents'](_0x18d70c[_0x4b96('0x3a')][_0x4b96('0x63')])[_0x4b96('0x2a')](function(){if(_['isArray'](_0x18d70c[_0x4b96('0x3a')][_0x4b96('0x63')])){for(var _0x25ac1b=0x0;_0x25ac1b<_0x18d70c[_0x4b96('0x3a')][_0x4b96('0x63')]['length'];_0x25ac1b+=0x1){socket[_0x4b96('0x6e')](_0x4b96('0x84'),{'UserId':Number(_0x18d70c[_0x4b96('0x3a')][_0x4b96('0x63')][_0x25ac1b]),'FaxQueueId':Number(_0x18d70c[_0x4b96('0x4a')]['id'])});}}else{socket[_0x4b96('0x6e')](_0x4b96('0x84'),{'UserId':Number(_0x18d70c[_0x4b96('0x3a')][_0x4b96('0x63')]),'FaxQueueId':Number(_0x18d70c[_0x4b96('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x20ddb7,null))['catch'](handleError(_0x20ddb7,null));};exports[_0x4b96('0x87')]=function(_0x48ae7c,_0x4571d2,_0x49864e){var _0x339cec={};var _0x2e1118={};var _0x349f8d;var _0x49314b;return db[_0x4b96('0x32')][_0x4b96('0x60')]({'where':{'id':_0x48ae7c['params']['id']}})[_0x4b96('0x2a')](handleEntityNotFound(_0x4571d2,null))[_0x4b96('0x2a')](function(_0x2c5921){if(_0x2c5921){_0x349f8d=_0x2c5921;_0x2e1118['model']=_[_0x4b96('0x39')](db['User'][_0x4b96('0x33')]);_0x2e1118[_0x4b96('0x3a')]=_[_0x4b96('0x39')](_0x48ae7c[_0x4b96('0x3a')]);_0x2e1118[_0x4b96('0x3b')]=_['intersection'](_0x2e1118[_0x4b96('0x37')],_0x2e1118[_0x4b96('0x3a')]);_0x339cec['attributes']=_[_0x4b96('0x3c')](_0x2e1118[_0x4b96('0x37')],qs['fields'](_0x48ae7c[_0x4b96('0x3a')][_0x4b96('0x3e')]));_0x339cec[_0x4b96('0x3d')]=_0x339cec['attributes']['length']?_0x339cec[_0x4b96('0x3d')]:_0x2e1118['model'];_0x339cec[_0x4b96('0x41')]=qs['sort'](_0x48ae7c['query'][_0x4b96('0x42')]);_0x339cec[_0x4b96('0x44')]=qs[_0x4b96('0x3b')](_[_0x4b96('0x62')](_0x48ae7c[_0x4b96('0x3a')],_0x2e1118[_0x4b96('0x3b')]));if(_0x48ae7c[_0x4b96('0x3a')][_0x4b96('0x43')]){_0x339cec[_0x4b96('0x44')]=_['merge'](_0x339cec[_0x4b96('0x44')],{'$or':_[_0x4b96('0x38')](_0x339cec[_0x4b96('0x3d')],function(_0x55b1ea){var _0x247569={};_0x247569[_0x55b1ea]={'$like':'%'+_0x48ae7c[_0x4b96('0x3a')][_0x4b96('0x43')]+'%'};return _0x247569;})});}_0x339cec=_[_0x4b96('0x45')]({},_0x339cec,_0x48ae7c[_0x4b96('0x58')]);return _0x349f8d[_0x4b96('0x87')](_0x339cec);}})[_0x4b96('0x2a')](function(_0x52b6ca){if(_0x52b6ca){_0x49314b=_0x52b6ca[_0x4b96('0x3f')];if(!_0x48ae7c[_0x4b96('0x3a')][_0x4b96('0x57')](_0x4b96('0x40'))){_0x339cec[_0x4b96('0x23')]=qs[_0x4b96('0x23')](_0x48ae7c['query'][_0x4b96('0x23')]);_0x339cec[_0x4b96('0x21')]=qs[_0x4b96('0x21')](_0x48ae7c['query'][_0x4b96('0x21')]);}return _0x349f8d[_0x4b96('0x87')](_0x339cec);}})[_0x4b96('0x2a')](function(_0x4f403d){if(_0x4f403d){return _0x4f403d?{'count':_0x49314b,'rows':_0x4f403d}:null;}})[_0x4b96('0x2a')](respondWithResult(_0x4571d2,null))['catch'](handleError(_0x4571d2,null));}; \ No newline at end of file +var _0x5b52=['role','FaxQueues','UserProfileSection','params','describe','getMembers','findOne','rawAttributes','FaxQueueId','options','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','nolimit','addTeams','Team','Agents','interface','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','union','compact','value','ids','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','FaxQueue','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x12962b,_0x58ebfb){var _0x39c433=function(_0x1be2c2){while(--_0x1be2c2){_0x12962b['push'](_0x12962b['shift']());}};_0x39c433(++_0x58ebfb);}(_0x5b52,0x159));var _0x25b5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5b52[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x25b5('0x0'));var rimraf=require(_0x25b5('0x1'));var zipdir=require(_0x25b5('0x2'));var jsonpatch=require(_0x25b5('0x3'));var rp=require(_0x25b5('0x4'));var moment=require(_0x25b5('0x5'));var BPromise=require(_0x25b5('0x6'));var Mustache=require(_0x25b5('0x7'));var util=require(_0x25b5('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x25b5('0x9'));var ejs=require(_0x25b5('0xa'));var fs=require('fs');var fs_extra=require(_0x25b5('0xb'));var _=require(_0x25b5('0xc'));var squel=require(_0x25b5('0xd'));var crypto=require(_0x25b5('0xe'));var jsforce=require(_0x25b5('0xf'));var deskjs=require(_0x25b5('0x10'));var toCsv=require(_0x25b5('0x9'));var querystring=require('querystring');var Papa=require(_0x25b5('0x11'));var Redis=require('ioredis');var authService=require(_0x25b5('0x12'));var qs=require(_0x25b5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x25b5('0x14'))(_0x25b5('0x15'));var utils=require(_0x25b5('0x16'));var config=require(_0x25b5('0x17'));var licenseUtil=require(_0x25b5('0x18'));var db=require(_0x25b5('0x19'))['db'];config['redis']=_[_0x25b5('0x1a')](config['redis'],{'host':_0x25b5('0x1b'),'port':0x18eb});var socket=require(_0x25b5('0x1c'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x25b5('0x1d')](socket);function respondWithStatusCode(_0x2eec63,_0xed3299){_0xed3299=_0xed3299||0xcc;return function(_0x240603){if(_0x240603){return _0x2eec63['sendStatus'](_0xed3299);}return _0x2eec63[_0x25b5('0x1e')](_0xed3299)[_0x25b5('0x1f')]();};}function respondWithResult(_0x4847db,_0x9192d3){_0x9192d3=_0x9192d3||0xc8;return function(_0x3ed7cf){if(_0x3ed7cf){return _0x4847db['status'](_0x9192d3)[_0x25b5('0x20')](_0x3ed7cf);}};}function respondWithFilteredResult(_0x319fd3,_0x175584){return function(_0x3c7296){if(_0x3c7296){var _0x4e7199=typeof _0x175584['offset']===_0x25b5('0x21')&&typeof _0x175584[_0x25b5('0x22')]===_0x25b5('0x21');var _0x3817f4=_0x3c7296['count'];var _0x4ac5cc=_0x4e7199?0x0:_0x175584[_0x25b5('0x23')];var _0x6f1e65=_0x4e7199?_0x3c7296[_0x25b5('0x24')]:_0x175584[_0x25b5('0x23')]+_0x175584[_0x25b5('0x22')];var _0x53831d;if(_0x6f1e65>=_0x3817f4){_0x6f1e65=_0x3817f4;_0x53831d=0xc8;}else{_0x53831d=0xce;}_0x319fd3[_0x25b5('0x1e')](_0x53831d);return _0x319fd3[_0x25b5('0x25')](_0x25b5('0x26'),_0x4ac5cc+'-'+_0x6f1e65+'/'+_0x3817f4)['json'](_0x3c7296);}return null;};}function patchUpdates(_0x4b27e4){return function(_0x4c4790){try{jsonpatch[_0x25b5('0x27')](_0x4c4790,_0x4b27e4,!![]);}catch(_0xc71ba2){return BPromise[_0x25b5('0x28')](_0xc71ba2);}return _0x4c4790[_0x25b5('0x29')]();};}function saveUpdates(_0x5a1362,_0x405928){return function(_0x4b8c50){if(_0x4b8c50){return _0x4b8c50[_0x25b5('0x2a')](_0x5a1362)[_0x25b5('0x2b')](function(_0x3087a9){return _0x3087a9;});}return null;};}function removeEntity(_0xd3fabb,_0x18adb0){return function(_0xb4aa0c){if(_0xb4aa0c){return _0xb4aa0c[_0x25b5('0x2c')]()[_0x25b5('0x2b')](function(){var _0x21ff65=_0xb4aa0c[_0x25b5('0x2d')]({'plain':!![]});var _0x246c78='FaxQueues';return db[_0x25b5('0x2e')]['destroy']({'where':{'type':_0x246c78,'resourceId':_0x21ff65['id']}})[_0x25b5('0x2b')](function(){return _0xb4aa0c;});})[_0x25b5('0x2b')](function(){_0xd3fabb['status'](0xcc)[_0x25b5('0x1f')]();});}};}function handleEntityNotFound(_0x3fb312,_0x3de41e){return function(_0x1b76e1){if(!_0x1b76e1){_0x3fb312[_0x25b5('0x2f')](0x194);}return _0x1b76e1;};}function handleError(_0x36afff,_0x161057){_0x161057=_0x161057||0x1f4;return function(_0x358f6c){logger[_0x25b5('0x30')](_0x358f6c[_0x25b5('0x31')]);if(_0x358f6c[_0x25b5('0x32')]){delete _0x358f6c[_0x25b5('0x32')];}_0x36afff['status'](_0x161057)[_0x25b5('0x33')](_0x358f6c);};}exports[_0x25b5('0x34')]=function(_0x33aa0b,_0x5933fa){var _0x415d7b={},_0x1ce9b9={},_0x2c41de={'count':0x0,'rows':[]};var _0x1abfec=_[_0x25b5('0x35')](db[_0x25b5('0x36')]['rawAttributes'],function(_0x342c87){return{'name':_0x342c87['fieldName'],'type':_0x342c87['type'][_0x25b5('0x37')]};});_0x1ce9b9[_0x25b5('0x38')]=_[_0x25b5('0x35')](_0x1abfec,_0x25b5('0x32'));_0x1ce9b9['query']=_[_0x25b5('0x39')](_0x33aa0b[_0x25b5('0x3a')]);_0x1ce9b9[_0x25b5('0x3b')]=_[_0x25b5('0x3c')](_0x1ce9b9[_0x25b5('0x38')],_0x1ce9b9[_0x25b5('0x3a')]);_0x415d7b[_0x25b5('0x3d')]=_[_0x25b5('0x3c')](_0x1ce9b9[_0x25b5('0x38')],qs[_0x25b5('0x3e')](_0x33aa0b[_0x25b5('0x3a')][_0x25b5('0x3e')]));_0x415d7b[_0x25b5('0x3d')]=_0x415d7b[_0x25b5('0x3d')][_0x25b5('0x3f')]?_0x415d7b[_0x25b5('0x3d')]:_0x1ce9b9['model'];if(!_0x33aa0b[_0x25b5('0x3a')]['hasOwnProperty']('nolimit')){_0x415d7b[_0x25b5('0x22')]=qs[_0x25b5('0x22')](_0x33aa0b[_0x25b5('0x3a')][_0x25b5('0x22')]);_0x415d7b[_0x25b5('0x23')]=qs[_0x25b5('0x23')](_0x33aa0b[_0x25b5('0x3a')][_0x25b5('0x23')]);}_0x415d7b[_0x25b5('0x40')]=qs[_0x25b5('0x41')](_0x33aa0b[_0x25b5('0x3a')][_0x25b5('0x41')]);_0x415d7b[_0x25b5('0x42')]=qs['filters'](_[_0x25b5('0x43')](_0x33aa0b[_0x25b5('0x3a')],_0x1ce9b9['filters']),_0x1abfec);if(_0x33aa0b[_0x25b5('0x3a')]['filter']){_0x415d7b[_0x25b5('0x42')]=_[_0x25b5('0x44')](_0x415d7b[_0x25b5('0x42')],{'$or':_[_0x25b5('0x35')](_0x1abfec,function(_0x1a926f){if(_0x1a926f['type']!==_0x25b5('0x45')){var _0x8e92e1={};_0x8e92e1[_0x1a926f[_0x25b5('0x32')]]={'$like':'%'+_0x33aa0b[_0x25b5('0x3a')][_0x25b5('0x46')]+'%'};return _0x8e92e1;}})});}_0x415d7b=_[_0x25b5('0x44')]({},_0x415d7b,_0x33aa0b['options']);var _0x17b1d9={'where':_0x415d7b[_0x25b5('0x42')]};return db[_0x25b5('0x36')]['count'](_0x17b1d9)[_0x25b5('0x2b')](function(_0xf0534f){_0x2c41de[_0x25b5('0x24')]=_0xf0534f;if(_0x33aa0b['query'][_0x25b5('0x47')]){_0x415d7b[_0x25b5('0x48')]=[{'all':!![]}];}return db[_0x25b5('0x36')][_0x25b5('0x49')](_0x415d7b);})[_0x25b5('0x2b')](function(_0x1dbac9){_0x2c41de[_0x25b5('0x4a')]=_0x1dbac9;return _0x2c41de;})['then'](respondWithFilteredResult(_0x5933fa,_0x415d7b))[_0x25b5('0x4b')](handleError(_0x5933fa,null));};exports['show']=function(_0x39a36b,_0x21d829){var _0x3f16a1={'raw':!![],'where':{'id':_0x39a36b['params']['id']}},_0x4100e3={};_0x4100e3[_0x25b5('0x38')]=_[_0x25b5('0x39')](db['FaxQueue']['rawAttributes']);_0x4100e3[_0x25b5('0x3a')]=_[_0x25b5('0x39')](_0x39a36b[_0x25b5('0x3a')]);_0x4100e3[_0x25b5('0x3b')]=_[_0x25b5('0x3c')](_0x4100e3['model'],_0x4100e3['query']);_0x3f16a1[_0x25b5('0x3d')]=_[_0x25b5('0x3c')](_0x4100e3[_0x25b5('0x38')],qs[_0x25b5('0x3e')](_0x39a36b[_0x25b5('0x3a')][_0x25b5('0x3e')]));_0x3f16a1[_0x25b5('0x3d')]=_0x3f16a1[_0x25b5('0x3d')][_0x25b5('0x3f')]?_0x3f16a1[_0x25b5('0x3d')]:_0x4100e3[_0x25b5('0x38')];if(_0x39a36b[_0x25b5('0x3a')]['includeAll']){_0x3f16a1[_0x25b5('0x48')]=[{'all':!![]}];}_0x3f16a1=_['merge']({},_0x3f16a1,_0x39a36b['options']);return db['FaxQueue'][_0x25b5('0x4c')](_0x3f16a1)[_0x25b5('0x2b')](handleEntityNotFound(_0x21d829,null))[_0x25b5('0x2b')](respondWithResult(_0x21d829,null))[_0x25b5('0x4b')](handleError(_0x21d829,null));};exports[_0x25b5('0x4d')]=function(_0x343532,_0x2e3471){return db[_0x25b5('0x36')][_0x25b5('0x4d')](_0x343532[_0x25b5('0x4e')],{})['then'](function(_0x2e7f1e){var _0x4de88e=_0x343532[_0x25b5('0x4f')][_0x25b5('0x2d')]({'plain':!![]});if(!_0x4de88e)throw new Error(_0x25b5('0x50'));if(_0x4de88e[_0x25b5('0x51')]==='user'){var _0x46aa4e=_0x2e7f1e[_0x25b5('0x2d')]({'plain':!![]});var _0x5b96bf=_0x25b5('0x52');return db[_0x25b5('0x53')][_0x25b5('0x4c')]({'where':{'name':_0x5b96bf,'userProfileId':_0x4de88e['userProfileId']},'raw':!![]})['then'](function(_0x5d2d59){if(_0x5d2d59&&_0x5d2d59['autoAssociation']===0x0){return db[_0x25b5('0x2e')][_0x25b5('0x4d')]({'name':_0x46aa4e['name'],'resourceId':_0x46aa4e['id'],'type':_0x5d2d59[_0x25b5('0x32')],'sectionId':_0x5d2d59['id']},{})[_0x25b5('0x2b')](function(){return _0x2e7f1e;});}else{return _0x2e7f1e;}})[_0x25b5('0x4b')](function(_0x24acdd){logger[_0x25b5('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24acdd);throw _0x24acdd;});}return _0x2e7f1e;})[_0x25b5('0x2b')](respondWithResult(_0x2e3471,0xc9))['catch'](handleError(_0x2e3471,null));};exports['update']=function(_0x30bd08,_0x3d9151){if(_0x30bd08[_0x25b5('0x4e')]['id']){delete _0x30bd08[_0x25b5('0x4e')]['id'];}return db['FaxQueue'][_0x25b5('0x4c')]({'where':{'id':_0x30bd08[_0x25b5('0x54')]['id']}})[_0x25b5('0x2b')](handleEntityNotFound(_0x3d9151,null))[_0x25b5('0x2b')](saveUpdates(_0x30bd08[_0x25b5('0x4e')],null))[_0x25b5('0x2b')](respondWithResult(_0x3d9151,null))['catch'](handleError(_0x3d9151,null));};exports[_0x25b5('0x2c')]=function(_0x164f09,_0x572bce){return db['FaxQueue'][_0x25b5('0x4c')]({'where':{'id':_0x164f09[_0x25b5('0x54')]['id']}})[_0x25b5('0x2b')](handleEntityNotFound(_0x572bce,null))[_0x25b5('0x2b')](removeEntity(_0x572bce,null))[_0x25b5('0x4b')](handleError(_0x572bce,null));};exports['describe']=function(_0x5c5948,_0x4d4855){return db[_0x25b5('0x36')][_0x25b5('0x55')]()['then'](respondWithResult(_0x4d4855,null))['catch'](handleError(_0x4d4855,null));};exports[_0x25b5('0x56')]=function(_0x1c2406,_0x403401,_0x5663c0){var _0x4a0b03={'raw':!![],'where':{}},_0x513785={},_0x3b7d7f;return db[_0x25b5('0x36')][_0x25b5('0x57')]({'where':{'id':_0x1c2406['params']['id']}})['then'](handleEntityNotFound(_0x403401,null))[_0x25b5('0x2b')](function(_0x536f87){if(_0x536f87){_0x3b7d7f=_0x536f87[_0x25b5('0x2d')]({'plain':!![]});_0x513785['model']=_[_0x25b5('0x39')](db['UserFaxQueue'][_0x25b5('0x58')]);_0x513785[_0x25b5('0x3a')]=_[_0x25b5('0x39')](_0x1c2406[_0x25b5('0x3a')]);_0x513785[_0x25b5('0x3b')]=_[_0x25b5('0x3c')](_0x513785[_0x25b5('0x38')],_0x513785['query']);_0x4a0b03[_0x25b5('0x3d')]=_['intersection'](_0x513785[_0x25b5('0x38')],qs[_0x25b5('0x3e')](_0x1c2406[_0x25b5('0x3a')][_0x25b5('0x3e')]));_0x4a0b03['attributes']=_0x4a0b03[_0x25b5('0x3d')][_0x25b5('0x3f')]?_0x4a0b03[_0x25b5('0x3d')]:_0x513785[_0x25b5('0x38')];if(!_0x1c2406['query']['hasOwnProperty']('nolimit')){_0x4a0b03[_0x25b5('0x22')]=qs[_0x25b5('0x22')](_0x1c2406[_0x25b5('0x3a')]['limit']);_0x4a0b03[_0x25b5('0x23')]=qs[_0x25b5('0x23')](_0x1c2406[_0x25b5('0x3a')][_0x25b5('0x23')]);}_0x4a0b03[_0x25b5('0x40')]=qs[_0x25b5('0x41')](_0x1c2406[_0x25b5('0x3a')][_0x25b5('0x41')]);_0x4a0b03[_0x25b5('0x42')]=qs[_0x25b5('0x3b')](_['pick'](_0x1c2406[_0x25b5('0x3a')],_0x513785[_0x25b5('0x3b')]));_0x4a0b03[_0x25b5('0x42')][_0x25b5('0x59')]=_0x536f87['id'];if(_0x1c2406[_0x25b5('0x3a')]['filter']){_0x4a0b03['where']=_[_0x25b5('0x44')](_0x4a0b03['where'],{'$or':_['map'](_0x4a0b03[_0x25b5('0x3d')],function(_0x4c0521){var _0x606663={};_0x606663[_0x4c0521]={'$like':'%'+_0x1c2406[_0x25b5('0x3a')][_0x25b5('0x46')]+'%'};return _0x606663;})});}_0x4a0b03=_['merge']({},_0x4a0b03,_0x1c2406[_0x25b5('0x5a')]);return db[_0x25b5('0x5b')][_0x25b5('0x49')](_0x4a0b03);}})['then'](function(_0x4415ea){if(_0x4415ea){return db[_0x25b5('0x5c')][_0x25b5('0x5d')]({'where':{'id':_[_0x25b5('0x35')](_0x4415ea,_0x25b5('0x5e')),'role':_0x25b5('0x5f')},'attributes':['id',_0x25b5('0x32'),_0x25b5('0x60'),_0x25b5('0x61'),_0x25b5('0x62')]});}})[_0x25b5('0x2b')](function(_0x5b2831){if(_0x5b2831){return{'count':_0x5b2831[_0x25b5('0x24')],'rows':_[_0x25b5('0x35')](_0x5b2831[_0x25b5('0x4a')],function(_0x25fcaf){return{'membername':_0x25fcaf['name'],'UserId':_0x25fcaf['id'],'queue_name':_0x3b7d7f[_0x25b5('0x32')],'FaxQueueId':_0x3b7d7f['id'],'interface':util[_0x25b5('0x63')]('%s/%s',_0x25b5('0x64'),_0x25fcaf['name']),'penalty':0x0,'paused':_0x25fcaf[_0x25b5('0x60')],'createdAt':_0x25fcaf['createdAt'],'updatedAt':_0x25fcaf[_0x25b5('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x25b5('0x2b')](respondWithFilteredResult(_0x403401,_0x4a0b03))[_0x25b5('0x4b')](handleError(_0x403401,null));};exports['getTeams']=function(_0x8b21b5,_0x27eadc,_0x4fd294){var _0x38aa2a={};var _0x18bcef={};var _0x474b98;var _0x4cef76;return db['FaxQueue'][_0x25b5('0x57')]({'where':{'id':_0x8b21b5[_0x25b5('0x54')]['id']}})['then'](handleEntityNotFound(_0x27eadc,null))['then'](function(_0x387540){if(_0x387540){_0x474b98=_0x387540;_0x18bcef[_0x25b5('0x38')]=_[_0x25b5('0x39')](db['Team']['rawAttributes']);_0x18bcef[_0x25b5('0x3a')]=_[_0x25b5('0x39')](_0x8b21b5[_0x25b5('0x3a')]);_0x18bcef[_0x25b5('0x3b')]=_[_0x25b5('0x3c')](_0x18bcef[_0x25b5('0x38')],_0x18bcef[_0x25b5('0x3a')]);_0x38aa2a['attributes']=_[_0x25b5('0x3c')](_0x18bcef[_0x25b5('0x38')],qs['fields'](_0x8b21b5[_0x25b5('0x3a')][_0x25b5('0x3e')]));_0x38aa2a['attributes']=_0x38aa2a['attributes'][_0x25b5('0x3f')]?_0x38aa2a[_0x25b5('0x3d')]:_0x18bcef['model'];_0x38aa2a[_0x25b5('0x40')]=qs['sort'](_0x8b21b5[_0x25b5('0x3a')][_0x25b5('0x41')]);_0x38aa2a[_0x25b5('0x42')]=qs['filters'](_[_0x25b5('0x43')](_0x8b21b5[_0x25b5('0x3a')],_0x18bcef[_0x25b5('0x3b')]));if(_0x8b21b5[_0x25b5('0x3a')]['filter']){_0x38aa2a[_0x25b5('0x42')]=_['merge'](_0x38aa2a[_0x25b5('0x42')],{'$or':_[_0x25b5('0x35')](_0x38aa2a[_0x25b5('0x3d')],function(_0x5db4d4){var _0x557a68={};_0x557a68[_0x5db4d4]={'$like':'%'+_0x8b21b5['query'][_0x25b5('0x46')]+'%'};return _0x557a68;})});}_0x38aa2a=_['merge']({},_0x38aa2a,_0x8b21b5[_0x25b5('0x5a')]);return _0x474b98[_0x25b5('0x65')](_0x38aa2a);}})[_0x25b5('0x2b')](function(_0x5c7f2f){if(_0x5c7f2f){_0x4cef76=_0x5c7f2f[_0x25b5('0x3f')];if(!_0x8b21b5[_0x25b5('0x3a')]['hasOwnProperty'](_0x25b5('0x66'))){_0x38aa2a['limit']=qs[_0x25b5('0x22')](_0x8b21b5[_0x25b5('0x3a')][_0x25b5('0x22')]);_0x38aa2a[_0x25b5('0x23')]=qs[_0x25b5('0x23')](_0x8b21b5[_0x25b5('0x3a')]['offset']);}return _0x474b98[_0x25b5('0x65')](_0x38aa2a);}})['then'](function(_0x3c16e5){if(_0x3c16e5){return _0x3c16e5?{'count':_0x4cef76,'rows':_0x3c16e5}:null;}})['then'](respondWithResult(_0x27eadc,null))[_0x25b5('0x4b')](handleError(_0x27eadc,null));};exports[_0x25b5('0x67')]=function(_0xe84ab4,_0x3ca73f,_0x4ec3fb){var _0x54c56c=_0xe84ab4['body']['ids'];return db[_0x25b5('0x68')][_0x25b5('0x49')]({'where':{'id':_0x54c56c},'attributes':['id'],'include':[{'model':db[_0x25b5('0x5c')],'as':_0x25b5('0x69'),'attributes':['id',_0x25b5('0x32'),'online','voicePause',_0x25b5('0x6a')],'raw':!![]}]})[_0x25b5('0x2b')](function(_0x10d681){if(_0x10d681){var _0x4a3fce=_['flatMap'](_0x10d681,function(_0x5bf1dd){var _0xf354df=_0x5bf1dd[_0x25b5('0x2d')]({'plain':!![]});return _0xf354df[_0x25b5('0x69')];});return db[_0x25b5('0x36')][_0x25b5('0x4c')]({'where':{'id':_0xe84ab4[_0x25b5('0x54')]['id']}})[_0x25b5('0x2b')](function(_0x1dddb4){return db['sequelize']['transaction'](function(_0x2de626){return _0x1dddb4[_0x25b5('0x67')](_0x54c56c,{'transaction':_0x2de626})[_0x25b5('0x2b')](function(){return BPromise[_0x25b5('0x6b')](_0x4a3fce,function(_0x589689){return db[_0x25b5('0x5b')][_0x25b5('0x6c')]({'where':{'UserId':_0x589689['id'],'FaxQueueId':_0xe84ab4[_0x25b5('0x54')]['id']},'transaction':_0x2de626});});})[_0x25b5('0x2b')](function(){_0x4a3fce[_0x25b5('0x6d')](function(_0xe0df4d){socket[_0x25b5('0x6e')](_0x25b5('0x6f'),{'UserId':_0xe0df4d['id'],'FaxQueueId':_0x1dddb4['id']});});});});});}})[_0x25b5('0x2b')](respondWithStatusCode(_0x3ca73f,null))[_0x25b5('0x4b')](handleError(_0x3ca73f,null));};exports[_0x25b5('0x70')]=function(_0x42b1c9,_0x55f21c,_0x406180){return db[_0x25b5('0x68')][_0x25b5('0x49')]({'where':{'id':_0x42b1c9['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x25b5('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x25b5('0x2b')](handleEntityNotFound(_0x55f21c,null))[_0x25b5('0x2b')](function(_0x742025){var _0x4b1bd5=_[_0x25b5('0x35')](_0x742025,'id');var _0x56dd12=[];var _0x386eeb=[];var _0x4f0fac=squel[_0x25b5('0x71')]();_0x4f0fac[_0x25b5('0x72')](_0x25b5('0x73'))[_0x25b5('0x74')](_0x25b5('0x75'),'tq')[_0x25b5('0x76')](_0x25b5('0x77'),'ut',_0x25b5('0x78'))['where'](_0x25b5('0x79'),_0x42b1c9[_0x25b5('0x54')]['id']);for(var _0x3a3559=0x0;_0x3a3559<_0x742025['length'];_0x3a3559+=0x1){let _0x1e7bbb=_0x742025[_0x3a3559];for(var _0x464e11=0x0;_0x464e11<_0x1e7bbb[_0x25b5('0x69')]['length'];_0x464e11+=0x1){let _0x5c86e5=_0x1e7bbb['Agents'][_0x464e11];var _0x58d146=_0x4f0fac['clone']();_0x58d146[_0x25b5('0x42')](_0x25b5('0x7a'),_0x5c86e5['id']);_0x386eeb[_0x25b5('0x7b')](db[_0x25b5('0x7c')][_0x25b5('0x3a')](_0x58d146[_0x25b5('0x7d')](),{'type':db[_0x25b5('0x7c')][_0x25b5('0x7e')]['SELECT']})['then'](function(_0xa4a00d){if(_0xa4a00d[_0x25b5('0x3f')]===0x1){return _0x5c86e5['id'];}else{var _0x30da51=_[_0x25b5('0x7f')](_[_0x25b5('0x35')](_0xa4a00d,_0x25b5('0x80')),function(_0xc5efaf){return _[_0x25b5('0x81')](_0x4b1bd5,_0xc5efaf);});if(_0x30da51){return _0x5c86e5['id'];}}}));}}return BPromise['all'](_0x386eeb)[_0x25b5('0x2b')](function(_0x34e0db){_0x56dd12=_(_0x56dd12)[_0x25b5('0x82')](_0x34e0db)[_0x25b5('0x83')]()[_0x25b5('0x84')]();return db[_0x25b5('0x36')][_0x25b5('0x4c')]({'where':{'id':_0x42b1c9[_0x25b5('0x54')]['id']}})['then'](function(_0x5acf74){return db[_0x25b5('0x7c')]['transaction'](function(_0x2c645b){return _0x5acf74[_0x25b5('0x70')](_0x42b1c9[_0x25b5('0x3a')][_0x25b5('0x85')],{'transaction':_0x2c645b})['then'](function(){if(!_['isEmpty'](_0x56dd12)){return _0x5acf74['removeAgents'](_0x56dd12,{'transaction':_0x2c645b});}})[_0x25b5('0x2b')](function(){_0x56dd12['forEach'](function(_0x2541a3){socket['emit'](_0x25b5('0x86'),{'UserId':_0x2541a3,'FaxQueueId':_0x5acf74['id']});});});});});});})[_0x25b5('0x2b')](respondWithStatusCode(_0x55f21c,null))[_0x25b5('0x4b')](handleError(_0x55f21c,null));};exports[_0x25b5('0x87')]=function(_0x29fa30,_0x5efa49,_0x316d25){return db[_0x25b5('0x36')]['find']({'where':{'id':_0x29fa30[_0x25b5('0x54')]['id']}})[_0x25b5('0x2b')](handleEntityNotFound(_0x5efa49,null))[_0x25b5('0x2b')](function(_0x3f91d9){if(_0x3f91d9){return _0x3f91d9[_0x25b5('0x87')](_0x29fa30[_0x25b5('0x4e')][_0x25b5('0x85')],_[_0x25b5('0x88')](_0x29fa30[_0x25b5('0x4e')],[_0x25b5('0x85'),'id'])||{})[_0x25b5('0x89')](function(_0x592ee2){for(var _0x1152df=0x0;_0x1152df<_0x29fa30[_0x25b5('0x4e')][_0x25b5('0x85')][_0x25b5('0x3f')];_0x1152df+=0x1){socket[_0x25b5('0x6e')](_0x25b5('0x6f'),{'UserId':Number(_0x29fa30['body'][_0x25b5('0x85')][_0x1152df]),'FaxQueueId':Number(_0x29fa30['params']['id'])});}return _0x592ee2;});}})[_0x25b5('0x2b')](respondWithResult(_0x5efa49,null))[_0x25b5('0x4b')](handleError(_0x5efa49,null));};exports[_0x25b5('0x8a')]=function(_0x5f03d2,_0x33ba3b,_0x162699){return db['FaxQueue']['find']({'where':{'id':_0x5f03d2['params']['id']}})['then'](handleEntityNotFound(_0x33ba3b,null))[_0x25b5('0x2b')](function(_0x30abe9){if(_0x30abe9){return _0x30abe9[_0x25b5('0x8a')](_0x5f03d2['query']['ids'])[_0x25b5('0x2b')](function(){if(_[_0x25b5('0x8b')](_0x5f03d2[_0x25b5('0x3a')][_0x25b5('0x85')])){for(var _0x40cc0f=0x0;_0x40cc0f<_0x5f03d2[_0x25b5('0x3a')]['ids'][_0x25b5('0x3f')];_0x40cc0f+=0x1){socket[_0x25b5('0x6e')](_0x25b5('0x86'),{'UserId':Number(_0x5f03d2[_0x25b5('0x3a')]['ids'][_0x40cc0f]),'FaxQueueId':Number(_0x5f03d2[_0x25b5('0x54')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x5f03d2['query'][_0x25b5('0x85')]),'FaxQueueId':Number(_0x5f03d2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x33ba3b,null))['catch'](handleError(_0x33ba3b,null));};exports[_0x25b5('0x8c')]=function(_0xd5a148,_0x4a4919,_0x1fa7ee){var _0x3d0831={};var _0x9e0523={};var _0x4d6781;var _0x1dca3c;return db[_0x25b5('0x36')][_0x25b5('0x57')]({'where':{'id':_0xd5a148[_0x25b5('0x54')]['id']}})['then'](handleEntityNotFound(_0x4a4919,null))['then'](function(_0x3d2622){if(_0x3d2622){_0x4d6781=_0x3d2622;_0x9e0523[_0x25b5('0x38')]=_[_0x25b5('0x39')](db[_0x25b5('0x5c')][_0x25b5('0x58')]);_0x9e0523[_0x25b5('0x3a')]=_[_0x25b5('0x39')](_0xd5a148['query']);_0x9e0523[_0x25b5('0x3b')]=_[_0x25b5('0x3c')](_0x9e0523['model'],_0x9e0523['query']);_0x3d0831[_0x25b5('0x3d')]=_[_0x25b5('0x3c')](_0x9e0523[_0x25b5('0x38')],qs['fields'](_0xd5a148[_0x25b5('0x3a')]['fields']));_0x3d0831[_0x25b5('0x3d')]=_0x3d0831['attributes'][_0x25b5('0x3f')]?_0x3d0831[_0x25b5('0x3d')]:_0x9e0523[_0x25b5('0x38')];_0x3d0831[_0x25b5('0x40')]=qs[_0x25b5('0x41')](_0xd5a148[_0x25b5('0x3a')][_0x25b5('0x41')]);_0x3d0831[_0x25b5('0x42')]=qs[_0x25b5('0x3b')](_[_0x25b5('0x43')](_0xd5a148[_0x25b5('0x3a')],_0x9e0523[_0x25b5('0x3b')]));if(_0xd5a148['query']['filter']){_0x3d0831[_0x25b5('0x42')]=_[_0x25b5('0x44')](_0x3d0831[_0x25b5('0x42')],{'$or':_[_0x25b5('0x35')](_0x3d0831['attributes'],function(_0x2e1c37){var _0x23d057={};_0x23d057[_0x2e1c37]={'$like':'%'+_0xd5a148[_0x25b5('0x3a')]['filter']+'%'};return _0x23d057;})});}_0x3d0831=_[_0x25b5('0x44')]({},_0x3d0831,_0xd5a148['options']);return _0x4d6781['getAgents'](_0x3d0831);}})[_0x25b5('0x2b')](function(_0x17a256){if(_0x17a256){_0x1dca3c=_0x17a256[_0x25b5('0x3f')];if(!_0xd5a148[_0x25b5('0x3a')][_0x25b5('0x8d')](_0x25b5('0x66'))){_0x3d0831[_0x25b5('0x22')]=qs[_0x25b5('0x22')](_0xd5a148[_0x25b5('0x3a')][_0x25b5('0x22')]);_0x3d0831['offset']=qs[_0x25b5('0x23')](_0xd5a148['query'][_0x25b5('0x23')]);}return _0x4d6781[_0x25b5('0x8c')](_0x3d0831);}})[_0x25b5('0x2b')](function(_0xf75683){if(_0xf75683){return _0xf75683?{'count':_0x1dca3c,'rows':_0xf75683}:null;}})['then'](respondWithResult(_0x4a4919,null))[_0x25b5('0x4b')](handleError(_0x4a4919,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 11836c9..a0cff81 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 _0x2c83=['../../mysqldb','FaxQueue','setMaxListeners','save','emit','exports','events'];(function(_0x2a77de,_0x5c56f5){var _0x532075=function(_0x333d04){while(--_0x333d04){_0x2a77de['push'](_0x2a77de['shift']());}};_0x532075(++_0x5c56f5);}(_0x2c83,0x195));var _0x32c8=function(_0x2a5e09,_0x448633){_0x2a5e09=_0x2a5e09-0x0;var _0x49b7a3=_0x2c83[_0x2a5e09];return _0x49b7a3;};'use strict';var EventEmitter=require(_0x32c8('0x0'));var FaxQueue=require(_0x32c8('0x1'))['db'][_0x32c8('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x32c8('0x3')](0x0);var events={'afterCreate':_0x32c8('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x56eb0a){return function(_0x5dbdca,_0x4d40c8,_0x1faccc){FaxQueueEvents[_0x32c8('0x5')](_0x56eb0a+':'+_0x5dbdca['id'],_0x5dbdca);FaxQueueEvents[_0x32c8('0x5')](_0x56eb0a,_0x5dbdca);_0x1faccc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x32c8('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x317c=['FaxQueue','setMaxListeners','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x54fbb0,_0x274859){var _0x37143b=function(_0x16d22f){while(--_0x16d22f){_0x54fbb0['push'](_0x54fbb0['shift']());}};_0x37143b(++_0x274859);}(_0x317c,0x1d6));var _0xc317=function(_0x59a6fe,_0x33d393){_0x59a6fe=_0x59a6fe-0x0;var _0x141a3d=_0x317c[_0x59a6fe];return _0x141a3d;};'use strict';var EventEmitter=require(_0xc317('0x0'));var FaxQueue=require(_0xc317('0x1'))['db'][_0xc317('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xc317('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc317('0x4'),'afterDestroy':'remove'};function emitEvent(_0x37ff80){return function(_0x4e80f0,_0x4cf101,_0x4102f0){FaxQueueEvents['emit'](_0x37ff80+':'+_0x4e80f0['id'],_0x4e80f0);FaxQueueEvents[_0xc317('0x5')](_0x37ff80,_0x4e80f0);_0x4102f0(null);};}for(var e in events){if(events[_0xc317('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xc317('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 27b3a18..cfb7106 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 _0xddc7=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x534bba,_0x53514d){var _0xb6d504=function(_0x1acf45){while(--_0x1acf45){_0x534bba['push'](_0x534bba['shift']());}};_0xb6d504(++_0x53514d);}(_0xddc7,0x1dc));var _0x7ddc=function(_0x57f6ad,_0x4795b6){_0x57f6ad=_0x57f6ad-0x0;var _0x425c09=_0xddc7[_0x57f6ad];return _0x425c09;};'use strict';var _=require(_0x7ddc('0x0'));var util=require(_0x7ddc('0x1'));var logger=require(_0x7ddc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7ddc('0x3'));var rp=require(_0x7ddc('0x4'));var fs=require('fs');var path=require(_0x7ddc('0x5'));var rimraf=require(_0x7ddc('0x6'));var config=require(_0x7ddc('0x7'));var attributes=require(_0x7ddc('0x8'));module[_0x7ddc('0x9')]=function(_0x2a1207,_0x480984){return _0x2a1207[_0x7ddc('0xa')](_0x7ddc('0xb'),attributes,{'tableName':_0x7ddc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5868=['../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0x5868,0x101));var _0x8586=function(_0x546d73,_0x20787c){_0x546d73=_0x546d73-0x0;var _0x52ac33=_0x5868[_0x546d73];return _0x52ac33;};'use strict';var _=require(_0x8586('0x0'));var util=require(_0x8586('0x1'));var logger=require(_0x8586('0x2'))(_0x8586('0x3'));var moment=require('moment');var BPromise=require(_0x8586('0x4'));var rp=require(_0x8586('0x5'));var fs=require('fs');var path=require(_0x8586('0x6'));var rimraf=require('rimraf');var config=require(_0x8586('0x7'));var attributes=require(_0x8586('0x8'));module[_0x8586('0x9')]=function(_0x5280f9,_0x51bfb2){return _0x5280f9['define'](_0x8586('0xa'),attributes,{'tableName':_0x8586('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 467ff67..325f4fa 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 _0xc596=['include','model','attributes','stringify','ShowFaxQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','limit','map'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc596,0x125));var _0x6c59=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0xc596[_0x5235dd];return _0x13059d;};'use strict';var _=require(_0x6c59('0x0'));var util=require(_0x6c59('0x1'));var moment=require(_0x6c59('0x2'));var BPromise=require(_0x6c59('0x3'));var rs=require(_0x6c59('0x4'));var fs=require('fs');var Redis=require(_0x6c59('0x5'));var db=require(_0x6c59('0x6'))['db'];var utils=require(_0x6c59('0x7'));var logger=require(_0x6c59('0x8'))(_0x6c59('0x9'));var config=require('../../config/environment');var jayson=require(_0x6c59('0xa'));var client=jayson[_0x6c59('0xb')][_0x6c59('0xc')]({'port':0x232a});config[_0x6c59('0xd')]=_[_0x6c59('0xe')](config[_0x6c59('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c59('0xf'))(new Redis(config['redis']));require(_0x6c59('0x10'))['register'](socket);function respondWithRpcPromise(_0x2eefc5,_0x34b76e,_0x2db5e3){return new BPromise(function(_0x55c8c9,_0x6bf0db){return client['request'](_0x2eefc5,_0x2db5e3)[_0x6c59('0x11')](function(_0x179869){logger[_0x6c59('0x12')](_0x6c59('0x13'),_0x34b76e,_0x6c59('0x14'));logger[_0x6c59('0x15')](_0x6c59('0x16'),_0x34b76e,_0x6c59('0x14'),JSON['stringify'](_0x179869));if(_0x179869[_0x6c59('0x17')]){if(_0x179869[_0x6c59('0x17')][_0x6c59('0x18')]===0x1f4){logger[_0x6c59('0x17')](_0x6c59('0x13'),_0x34b76e,_0x179869[_0x6c59('0x17')][_0x6c59('0x19')]);return _0x6bf0db(_0x179869['error']['message']);}logger[_0x6c59('0x17')]('FaxQueue,\x20%s,\x20%s',_0x34b76e,_0x179869[_0x6c59('0x17')]['message']);return _0x55c8c9(_0x179869['error']['message']);}else{logger[_0x6c59('0x12')](_0x6c59('0x13'),_0x34b76e,_0x6c59('0x14'));_0x55c8c9(_0x179869[_0x6c59('0x1a')][_0x6c59('0x19')]);}})[_0x6c59('0x1b')](function(_0x4c5b69){logger[_0x6c59('0x17')](_0x6c59('0x13'),_0x34b76e,_0x4c5b69);_0x6bf0db(_0x4c5b69);});});}exports[_0x6c59('0x1c')]=function(_0x319bf5){var _0x2c066e=this;return new Promise(function(_0x35c88d,_0x43e6ca){return db[_0x6c59('0x1d')][_0x6c59('0x1e')]({'raw':_0x319bf5['options']?_0x319bf5['options']['raw']===undefined?!![]:![]:!![],'where':_0x319bf5[_0x6c59('0x1f')]?_0x319bf5[_0x6c59('0x1f')][_0x6c59('0x20')]||null:null,'attributes':_0x319bf5[_0x6c59('0x1f')]?_0x319bf5['options']['attributes']||null:null,'limit':_0x319bf5[_0x6c59('0x1f')]?_0x319bf5[_0x6c59('0x1f')][_0x6c59('0x21')]||null:null,'include':_0x319bf5['options']?_0x319bf5['options']['include']?_[_0x6c59('0x22')](_0x319bf5[_0x6c59('0x1f')][_0x6c59('0x23')],function(_0x12e2c1){return{'model':db[_0x12e2c1[_0x6c59('0x24')]],'as':_0x12e2c1['as'],'attributes':_0x12e2c1['attributes'],'include':_0x12e2c1[_0x6c59('0x23')]?_[_0x6c59('0x22')](_0x12e2c1[_0x6c59('0x23')],function(_0x366c1c){return{'model':db[_0x366c1c['model']],'as':_0x366c1c['as'],'attributes':_0x366c1c[_0x6c59('0x25')],'include':_0x366c1c[_0x6c59('0x23')]?_[_0x6c59('0x22')](_0x366c1c['include'],function(_0x5123d5){return{'model':db[_0x5123d5[_0x6c59('0x24')]],'as':_0x5123d5['as'],'attributes':_0x5123d5[_0x6c59('0x25')]};}):[]};}):[]};}):[]:[]})[_0x6c59('0x11')](function(_0x585046){logger['info'](_0x6c59('0x1c'),_0x319bf5);logger[_0x6c59('0x15')](_0x6c59('0x1c'),_0x319bf5,JSON[_0x6c59('0x26')](_0x585046));_0x35c88d(_0x585046);})[_0x6c59('0x1b')](function(_0xbe422d){logger[_0x6c59('0x17')](_0x6c59('0x1c'),_0xbe422d[_0x6c59('0x19')],_0x319bf5);_0x43e6ca(_0x2c066e[_0x6c59('0x17')](0x1f4,_0xbe422d[_0x6c59('0x19')]));});});};exports[_0x6c59('0x27')]=function(_0x5daf31){var _0x4275d2=this;return new Promise(function(_0x5d5121,_0x247a1b){return db[_0x6c59('0x1d')]['find']({'raw':_0x5daf31[_0x6c59('0x1f')]?_0x5daf31[_0x6c59('0x1f')][_0x6c59('0x28')]===undefined?!![]:![]:!![],'where':_0x5daf31[_0x6c59('0x1f')]?_0x5daf31[_0x6c59('0x1f')][_0x6c59('0x20')]||null:null,'attributes':_0x5daf31[_0x6c59('0x1f')]?_0x5daf31[_0x6c59('0x1f')][_0x6c59('0x25')]||null:null,'include':_0x5daf31[_0x6c59('0x1f')]?_0x5daf31[_0x6c59('0x1f')][_0x6c59('0x23')]?_[_0x6c59('0x22')](_0x5daf31[_0x6c59('0x1f')][_0x6c59('0x23')],function(_0x573d44){return{'model':db[_0x573d44['model']],'as':_0x573d44['as'],'attributes':_0x573d44['attributes'],'include':_0x573d44['include']?_[_0x6c59('0x22')](_0x573d44[_0x6c59('0x23')],function(_0x387994){return{'model':db[_0x387994[_0x6c59('0x24')]],'as':_0x387994['as'],'attributes':_0x387994[_0x6c59('0x25')],'include':_0x387994[_0x6c59('0x23')]?_[_0x6c59('0x22')](_0x387994[_0x6c59('0x23')],function(_0x224e8e){return{'model':db[_0x224e8e['model']],'as':_0x224e8e['as'],'attributes':_0x224e8e[_0x6c59('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35d367){logger[_0x6c59('0x12')](_0x6c59('0x27'),_0x5daf31);logger[_0x6c59('0x15')]('ShowFaxQueue',_0x5daf31,JSON[_0x6c59('0x26')](_0x35d367));_0x5d5121(_0x35d367);})[_0x6c59('0x1b')](function(_0x43c49f){logger[_0x6c59('0x17')]('ShowFaxQueue',_0x43c49f[_0x6c59('0x19')],_0x5daf31);_0x247a1b(_0x4275d2[_0x6c59('0x17')](0x1f4,_0x43c49f[_0x6c59('0x19')]));});});}; \ No newline at end of file +var _0x189a=['request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','options','raw','attributes','limit','include','map','model','then','ShowFaxQueue','FaxQueue','find','where','debug','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxQueue.socket','register','info','FaxQueue,\x20%s,\x20%s'];(function(_0x145ad1,_0x43402d){var _0x48c189=function(_0x2a563){while(--_0x2a563){_0x145ad1['push'](_0x145ad1['shift']());}};_0x48c189(++_0x43402d);}(_0x189a,0x162));var _0xa189=function(_0x51a295,_0x98ba4a){_0x51a295=_0x51a295-0x0;var _0x40900d=_0x189a[_0x51a295];return _0x40900d;};'use strict';var _=require(_0xa189('0x0'));var util=require(_0xa189('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa189('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa189('0x3'));var logger=require(_0xa189('0x4'))(_0xa189('0x5'));var config=require(_0xa189('0x6'));var jayson=require(_0xa189('0x7'));var client=jayson[_0xa189('0x8')]['http']({'port':0x232a});config[_0xa189('0x9')]=_[_0xa189('0xa')](config[_0xa189('0x9')],{'host':_0xa189('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa189('0xc'))[_0xa189('0xd')](socket);function respondWithRpcPromise(_0x54c552,_0x35a912,_0x433590){return new BPromise(function(_0xb071a,_0x4f10c9){return client['request'](_0x54c552,_0x433590)['then'](function(_0x20fa7a){logger[_0xa189('0xe')](_0xa189('0xf'),_0x35a912,_0xa189('0x10'));logger['debug'](_0xa189('0x11'),_0x35a912,'request\x20sent',JSON[_0xa189('0x12')](_0x20fa7a));if(_0x20fa7a[_0xa189('0x13')]){if(_0x20fa7a[_0xa189('0x13')][_0xa189('0x14')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x35a912,_0x20fa7a['error'][_0xa189('0x15')]);return _0x4f10c9(_0x20fa7a[_0xa189('0x13')]['message']);}logger[_0xa189('0x13')](_0xa189('0xf'),_0x35a912,_0x20fa7a['error'][_0xa189('0x15')]);return _0xb071a(_0x20fa7a[_0xa189('0x13')][_0xa189('0x15')]);}else{logger['info'](_0xa189('0xf'),_0x35a912,'request\x20sent');_0xb071a(_0x20fa7a['result'][_0xa189('0x15')]);}})[_0xa189('0x16')](function(_0x1b9d86){logger['error']('FaxQueue,\x20%s,\x20%s',_0x35a912,_0x1b9d86);_0x4f10c9(_0x1b9d86);});});}exports[_0xa189('0x17')]=function(_0x52953a){var _0x140e32=this;return new Promise(function(_0x33c573,_0x5f5150){return db['FaxQueue']['findAll']({'raw':_0x52953a['options']?_0x52953a[_0xa189('0x18')][_0xa189('0x19')]===undefined?!![]:![]:!![],'where':_0x52953a['options']?_0x52953a['options']['where']||null:null,'attributes':_0x52953a[_0xa189('0x18')]?_0x52953a['options'][_0xa189('0x1a')]||null:null,'limit':_0x52953a[_0xa189('0x18')]?_0x52953a[_0xa189('0x18')][_0xa189('0x1b')]||null:null,'include':_0x52953a[_0xa189('0x18')]?_0x52953a['options'][_0xa189('0x1c')]?_[_0xa189('0x1d')](_0x52953a[_0xa189('0x18')][_0xa189('0x1c')],function(_0x176223){return{'model':db[_0x176223[_0xa189('0x1e')]],'as':_0x176223['as'],'attributes':_0x176223['attributes'],'include':_0x176223[_0xa189('0x1c')]?_[_0xa189('0x1d')](_0x176223[_0xa189('0x1c')],function(_0x70c15f){return{'model':db[_0x70c15f[_0xa189('0x1e')]],'as':_0x70c15f['as'],'attributes':_0x70c15f[_0xa189('0x1a')],'include':_0x70c15f[_0xa189('0x1c')]?_[_0xa189('0x1d')](_0x70c15f['include'],function(_0x523a6e){return{'model':db[_0x523a6e[_0xa189('0x1e')]],'as':_0x523a6e['as'],'attributes':_0x523a6e[_0xa189('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa189('0x1f')](function(_0x11840e){logger[_0xa189('0xe')](_0xa189('0x17'),_0x52953a);logger['debug']('GetFaxQueue',_0x52953a,JSON['stringify'](_0x11840e));_0x33c573(_0x11840e);})['catch'](function(_0x14c591){logger[_0xa189('0x13')](_0xa189('0x17'),_0x14c591['message'],_0x52953a);_0x5f5150(_0x140e32[_0xa189('0x13')](0x1f4,_0x14c591[_0xa189('0x15')]));});});};exports[_0xa189('0x20')]=function(_0x46ba18){var _0x2895ed=this;return new Promise(function(_0x58cdb5,_0x2ac0fb){return db[_0xa189('0x21')][_0xa189('0x22')]({'raw':_0x46ba18[_0xa189('0x18')]?_0x46ba18[_0xa189('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x46ba18[_0xa189('0x18')]?_0x46ba18['options'][_0xa189('0x23')]||null:null,'attributes':_0x46ba18[_0xa189('0x18')]?_0x46ba18[_0xa189('0x18')]['attributes']||null:null,'include':_0x46ba18[_0xa189('0x18')]?_0x46ba18[_0xa189('0x18')]['include']?_[_0xa189('0x1d')](_0x46ba18['options'][_0xa189('0x1c')],function(_0x58924){return{'model':db[_0x58924[_0xa189('0x1e')]],'as':_0x58924['as'],'attributes':_0x58924[_0xa189('0x1a')],'include':_0x58924[_0xa189('0x1c')]?_[_0xa189('0x1d')](_0x58924['include'],function(_0x144463){return{'model':db[_0x144463[_0xa189('0x1e')]],'as':_0x144463['as'],'attributes':_0x144463[_0xa189('0x1a')],'include':_0x144463[_0xa189('0x1c')]?_[_0xa189('0x1d')](_0x144463[_0xa189('0x1c')],function(_0x2cd6ec){return{'model':db[_0x2cd6ec[_0xa189('0x1e')]],'as':_0x2cd6ec['as'],'attributes':_0x2cd6ec[_0xa189('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa189('0x1f')](function(_0x9c7411){logger[_0xa189('0xe')](_0xa189('0x20'),_0x46ba18);logger[_0xa189('0x24')]('ShowFaxQueue',_0x46ba18,JSON[_0xa189('0x12')](_0x9c7411));_0x58cdb5(_0x9c7411);})[_0xa189('0x16')](function(_0x1119bd){logger[_0xa189('0x13')](_0xa189('0x20'),_0x1119bd[_0xa189('0x15')],_0x46ba18);_0x2ac0fb(_0x2895ed[_0xa189('0x13')](0x1f4,_0x1119bd[_0xa189('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 246935b..12bc872 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 _0x5b0c=['register','length','faxQueue:','./faxQueue.events','remove','update','emit','removeListener'];(function(_0x227ea0,_0x4d3e91){var _0x5edb7e=function(_0x7c4636){while(--_0x7c4636){_0x227ea0['push'](_0x227ea0['shift']());}};_0x5edb7e(++_0x4d3e91);}(_0x5b0c,0xd3));var _0xc5b0=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0x5b0c[_0x1c5142];return _0x1268cb;};'use strict';var FaxQueueEvents=require(_0xc5b0('0x0'));var events=['save',_0xc5b0('0x1'),_0xc5b0('0x2')];function createListener(_0x1ba072,_0x40dba2){return function(_0x26dd18){_0x40dba2[_0xc5b0('0x3')](_0x1ba072,_0x26dd18);};}function removeListener(_0x1848d5,_0x47ccc8){return function(){FaxQueueEvents[_0xc5b0('0x4')](_0x1848d5,_0x47ccc8);};}exports[_0xc5b0('0x5')]=function(_0x5ae3fb){for(var _0x2f745b=0x0,_0x3df913=events[_0xc5b0('0x6')];_0x2f745b<_0x3df913;_0x2f745b++){var _0x17dff0=events[_0x2f745b];var _0x4e1b05=createListener(_0xc5b0('0x7')+_0x17dff0,_0x5ae3fb);FaxQueueEvents['on'](_0x17dff0,_0x4e1b05);}}; \ No newline at end of file +var _0x0dc1=['faxQueue:','./faxQueue.events','save','emit','register','length'];(function(_0x5773e0,_0x42143c){var _0x4ece69=function(_0xb2a199){while(--_0xb2a199){_0x5773e0['push'](_0x5773e0['shift']());}};_0x4ece69(++_0x42143c);}(_0x0dc1,0x175));var _0x10dc=function(_0x343869,_0xeca2ee){_0x343869=_0x343869-0x0;var _0x59a2a2=_0x0dc1[_0x343869];return _0x59a2a2;};'use strict';var FaxQueueEvents=require(_0x10dc('0x0'));var events=[_0x10dc('0x1'),'remove','update'];function createListener(_0xe1309,_0x10d3c3){return function(_0x43b78e){_0x10d3c3[_0x10dc('0x2')](_0xe1309,_0x43b78e);};}function removeListener(_0x1bd979,_0x5cb911){return function(){FaxQueueEvents['removeListener'](_0x1bd979,_0x5cb911);};}exports[_0x10dc('0x3')]=function(_0x519772){for(var _0x78e112=0x0,_0x51a098=events[_0x10dc('0x4')];_0x78e112<_0x51a098;_0x78e112++){var _0x52c5c8=events[_0x78e112];var _0x24de60=createListener(_0x10dc('0x5')+_0x52c5c8,_0x519772);FaxQueueEvents['on'](_0x52c5c8,_0x24de60);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index afcbbfe..b43f0df 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 _0x199c=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x199c,0x1d8));var _0xc199=function(_0x50df78,_0x1242ac){_0x50df78=_0x50df78-0x0;var _0x37b686=_0x199c[_0x50df78];return _0x37b686;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc199('0x0'));var timeout=require(_0xc199('0x1'));var express=require(_0xc199('0x2'));var router=express[_0xc199('0x3')]();var fs_extra=require(_0xc199('0x4'));var auth=require(_0xc199('0x5'));var interaction=require(_0xc199('0x6'));var config=require(_0xc199('0x7'));var controller=require('./faxQueue.controller');router[_0xc199('0x8')]('/',auth[_0xc199('0x9')](),controller['index']);router['get'](_0xc199('0xa'),auth[_0xc199('0x9')](),controller[_0xc199('0xb')]);router[_0xc199('0x8')](_0xc199('0xc'),auth[_0xc199('0x9')](),controller[_0xc199('0xd')]);router[_0xc199('0x8')]('/:id/members',auth[_0xc199('0x9')](),controller[_0xc199('0xe')]);router[_0xc199('0x8')](_0xc199('0xf'),auth[_0xc199('0x9')](),controller[_0xc199('0x10')]);router['get'](_0xc199('0x11'),auth[_0xc199('0x9')](),controller[_0xc199('0x12')]);router[_0xc199('0x13')]('/',auth[_0xc199('0x9')](),controller['create']);router[_0xc199('0x13')](_0xc199('0xf'),auth[_0xc199('0x9')](),controller[_0xc199('0x14')]);router[_0xc199('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xc199('0x15')]);router['put'](_0xc199('0xc'),auth[_0xc199('0x9')](),controller['update']);router[_0xc199('0x16')]('/:id',auth[_0xc199('0x9')](),controller[_0xc199('0x17')]);router[_0xc199('0x16')](_0xc199('0xf'),auth[_0xc199('0x9')](),controller[_0xc199('0x18')]);router[_0xc199('0x16')](_0xc199('0x11'),auth[_0xc199('0x9')](),controller[_0xc199('0x19')]);module[_0xc199('0x1a')]=router; \ No newline at end of file +var _0xd046=['util','path','connect-timeout','Router','../../components/interaction/service','./faxQueue.controller','index','get','describe','show','/:id/members','/:id/teams','isAuthenticated','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeAgents','exports'];(function(_0x43588f,_0x34c7b5){var _0x4be053=function(_0x4ab94b){while(--_0x4ab94b){_0x43588f['push'](_0x43588f['shift']());}};_0x4be053(++_0x34c7b5);}(_0xd046,0x129));var _0x6d04=function(_0x252941,_0x56fff8){_0x252941=_0x252941-0x0;var _0x2e5dd1=_0xd046[_0x252941];return _0x2e5dd1;};'use strict';var multer=require('multer');var util=require(_0x6d04('0x0'));var path=require(_0x6d04('0x1'));var timeout=require(_0x6d04('0x2'));var express=require('express');var router=express[_0x6d04('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d04('0x4'));var config=require('../../config/environment');var controller=require(_0x6d04('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d04('0x6')]);router[_0x6d04('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x6d04('0x8')]);router[_0x6d04('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router['get'](_0x6d04('0xa'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x6d04('0xb'),auth[_0x6d04('0xc')](),controller[_0x6d04('0xd')]);router[_0x6d04('0x7')]('/:id/users',auth[_0x6d04('0xc')](),controller[_0x6d04('0xe')]);router[_0x6d04('0xf')]('/',auth[_0x6d04('0xc')](),controller[_0x6d04('0x10')]);router[_0x6d04('0xf')](_0x6d04('0xb'),auth[_0x6d04('0xc')](),controller[_0x6d04('0x11')]);router[_0x6d04('0xf')](_0x6d04('0x12'),auth[_0x6d04('0xc')](),controller[_0x6d04('0x13')]);router[_0x6d04('0x14')](_0x6d04('0x15'),auth[_0x6d04('0xc')](),controller[_0x6d04('0x16')]);router[_0x6d04('0x17')](_0x6d04('0x15'),auth[_0x6d04('0xc')](),controller[_0x6d04('0x18')]);router[_0x6d04('0x17')](_0x6d04('0xb'),auth[_0x6d04('0xc')](),controller['removeTeams']);router[_0x6d04('0x17')](_0x6d04('0x12'),auth[_0x6d04('0xc')](),controller[_0x6d04('0x19')]);module[_0x6d04('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 3e4265b..c7a243a 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 _0x3d0d=['moment','exports','STRING','DATE'];(function(_0x12a2d9,_0xf0f1b){var _0xce19ca=function(_0x5c4b44){while(--_0x5c4b44){_0x12a2d9['push'](_0x12a2d9['shift']());}};_0xce19ca(++_0xf0f1b);}(_0x3d0d,0x1d4));var _0xd3d0=function(_0x17a7c9,_0x20ee1b){_0x17a7c9=_0x17a7c9-0x0;var _0x64001d=_0x3d0d[_0x17a7c9];return _0x64001d;};'use strict';var moment=require(_0xd3d0('0x0'));var Sequelize=require('sequelize');module[_0xd3d0('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd3d0('0x2')]},'joinAt':{'type':Sequelize[_0xd3d0('0x3')]},'leaveAt':{'type':Sequelize[_0xd3d0('0x3')]},'acceptAt':{'type':Sequelize[_0xd3d0('0x3')]},'exitAt':{'type':Sequelize[_0xd3d0('0x3')]},'reason':{'type':Sequelize[_0xd3d0('0x2')]}}; \ No newline at end of file +var _0xdf67=['sequelize','exports','STRING','DATE','moment'];(function(_0x229c6b,_0x456bf5){var _0x59b418=function(_0x540a50){while(--_0x540a50){_0x229c6b['push'](_0x229c6b['shift']());}};_0x59b418(++_0x456bf5);}(_0xdf67,0x117));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x7df6('0x0'));var Sequelize=require(_0x7df6('0x1'));module[_0x7df6('0x2')]={'uniqueid':{'type':Sequelize[_0x7df6('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7df6('0x4')]},'leaveAt':{'type':Sequelize[_0x7df6('0x4')]},'acceptAt':{'type':Sequelize[_0x7df6('0x4')]},'exitAt':{'type':Sequelize[_0x7df6('0x4')]},'reason':{'type':Sequelize[_0x7df6('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index f56c3d0..117f322 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 _0xb9a7=['include','rows','catch','show','params','rawAttributes','intersection','create','body','describe','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','stack','map','FaxQueueReport','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll'];(function(_0xee7477,_0x47f8e8){var _0x333237=function(_0x280cbe){while(--_0x280cbe){_0xee7477['push'](_0xee7477['shift']());}};_0x333237(++_0x47f8e8);}(_0xb9a7,0x112));var _0x7b9a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xb9a7[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)[_0x7b9a('0x15')]();});}};}function handleEntityNotFound(_0x23219e,_0x5809f5){return function(_0x39b7ec){if(!_0x39b7ec){_0x23219e['sendStatus'](0x194);}return _0x39b7ec;};}function handleError(_0x31eb67,_0x3091ab){_0x3091ab=_0x3091ab||0x1f4;return function(_0x4c2271){logger['error'](_0x4c2271[_0x7b9a('0x20')]);if(_0x4c2271['name']){delete _0x4c2271['name'];}_0x31eb67[_0x7b9a('0x14')](_0x3091ab)['send'](_0x4c2271);};}exports['index']=function(_0x3847b4,_0x4d5880){var _0x5c89b6={},_0x314b6d={},_0x4fee38={'count':0x0,'rows':[]};var _0x1553ae=_[_0x7b9a('0x21')](db[_0x7b9a('0x22')]['rawAttributes'],function(_0x45ccf5){return{'name':_0x45ccf5[_0x7b9a('0x23')],'type':_0x45ccf5[_0x7b9a('0x24')][_0x7b9a('0x25')]};});_0x314b6d[_0x7b9a('0x26')]=_[_0x7b9a('0x21')](_0x1553ae,'name');_0x314b6d['query']=_[_0x7b9a('0x27')](_0x3847b4[_0x7b9a('0x28')]);_0x314b6d[_0x7b9a('0x29')]=_['intersection'](_0x314b6d[_0x7b9a('0x26')],_0x314b6d[_0x7b9a('0x28')]);_0x5c89b6['attributes']=_['intersection'](_0x314b6d[_0x7b9a('0x26')],qs[_0x7b9a('0x2a')](_0x3847b4['query'][_0x7b9a('0x2a')]));_0x5c89b6[_0x7b9a('0x2b')]=_0x5c89b6[_0x7b9a('0x2b')][_0x7b9a('0x2c')]?_0x5c89b6[_0x7b9a('0x2b')]:_0x314b6d['model'];if(!_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x2d')](_0x7b9a('0x2e'))){_0x5c89b6[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x3847b4[_0x7b9a('0x28')]['limit']);_0x5c89b6['offset']=qs[_0x7b9a('0x17')](_0x3847b4[_0x7b9a('0x28')]['offset']);}_0x5c89b6[_0x7b9a('0x2f')]=qs[_0x7b9a('0x30')](_0x3847b4[_0x7b9a('0x28')]['sort']);_0x5c89b6[_0x7b9a('0x31')]=qs[_0x7b9a('0x29')](_['pick'](_0x3847b4['query'],_0x314b6d[_0x7b9a('0x29')]),_0x1553ae);if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]){_0x5c89b6[_0x7b9a('0x31')]=_[_0x7b9a('0x33')](_0x5c89b6[_0x7b9a('0x31')],{'$or':_[_0x7b9a('0x21')](_0x1553ae,function(_0x380f4b){if(_0x380f4b['type']!==_0x7b9a('0x34')){var _0x5ac175={};_0x5ac175[_0x380f4b[_0x7b9a('0x35')]]={'$like':'%'+_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]+'%'};return _0x5ac175;}})});}_0x5c89b6=_[_0x7b9a('0x33')]({},_0x5c89b6,_0x3847b4[_0x7b9a('0x36')]);var _0x89951b={'where':_0x5c89b6['where']};return db[_0x7b9a('0x22')][_0x7b9a('0x19')](_0x89951b)[_0x7b9a('0x1e')](function(_0x1bc1f0){_0x4fee38['count']=_0x1bc1f0;if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x5c89b6[_0x7b9a('0x38')]=[{'all':!![]}];}return db[_0x7b9a('0x22')]['findAll'](_0x5c89b6);})[_0x7b9a('0x1e')](function(_0x53d89a){_0x4fee38[_0x7b9a('0x39')]=_0x53d89a;return _0x4fee38;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x4d5880,_0x5c89b6))[_0x7b9a('0x3a')](handleError(_0x4d5880,null));};exports[_0x7b9a('0x3b')]=function(_0x43fad0,_0x41f541){var _0x56e274={'raw':!![],'where':{'id':_0x43fad0[_0x7b9a('0x3c')]['id']}},_0x33edc6={};_0x33edc6[_0x7b9a('0x26')]=_['keys'](db['FaxQueueReport'][_0x7b9a('0x3d')]);_0x33edc6[_0x7b9a('0x28')]=_[_0x7b9a('0x27')](_0x43fad0[_0x7b9a('0x28')]);_0x33edc6[_0x7b9a('0x29')]=_[_0x7b9a('0x3e')](_0x33edc6['model'],_0x33edc6['query']);_0x56e274['attributes']=_[_0x7b9a('0x3e')](_0x33edc6[_0x7b9a('0x26')],qs['fields'](_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x2a')]));_0x56e274[_0x7b9a('0x2b')]=_0x56e274['attributes'][_0x7b9a('0x2c')]?_0x56e274['attributes']:_0x33edc6[_0x7b9a('0x26')];if(_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x56e274[_0x7b9a('0x38')]=[{'all':!![]}];}_0x56e274=_[_0x7b9a('0x33')]({},_0x56e274,_0x43fad0['options']);return db[_0x7b9a('0x22')]['find'](_0x56e274)[_0x7b9a('0x1e')](handleEntityNotFound(_0x41f541,null))['then'](respondWithResult(_0x41f541,null))['catch'](handleError(_0x41f541,null));};exports[_0x7b9a('0x3f')]=function(_0x3727ef,_0x717d08){return db[_0x7b9a('0x22')][_0x7b9a('0x3f')](_0x3727ef[_0x7b9a('0x40')],{})[_0x7b9a('0x1e')](respondWithResult(_0x717d08,0xc9))[_0x7b9a('0x3a')](handleError(_0x717d08,null));};exports[_0x7b9a('0x1d')]=function(_0x5088c7,_0x1d7957){if(_0x5088c7[_0x7b9a('0x40')]['id']){delete _0x5088c7['body']['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x5088c7[_0x7b9a('0x3c')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1d7957,null))[_0x7b9a('0x1e')](saveUpdates(_0x5088c7[_0x7b9a('0x40')],null))['then'](respondWithResult(_0x1d7957,null))[_0x7b9a('0x3a')](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1f')]=function(_0x287dea,_0x33b200){return db[_0x7b9a('0x22')]['find']({'where':{'id':_0x287dea[_0x7b9a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x33b200,null))[_0x7b9a('0x1e')](removeEntity(_0x33b200,null))[_0x7b9a('0x3a')](handleError(_0x33b200,null));};exports[_0x7b9a('0x41')]=function(_0x3f42a2,_0x52f2ca){return db[_0x7b9a('0x22')][_0x7b9a('0x41')]()[_0x7b9a('0x1e')](respondWithResult(_0x52f2ca,null))[_0x7b9a('0x3a')](handleError(_0x52f2ca,null));}; \ No newline at end of file +var _0x8bdf=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','then','destroy','stack','name','send','map','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','FaxQueueReport','includeAll','include','rows','show','rawAttributes','keys','filters','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3e25bc,_0x1b01f3){var _0x345958=function(_0x289e7e){while(--_0x289e7e){_0x3e25bc['push'](_0x3e25bc['shift']());}};_0x345958(++_0x1b01f3);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x8bdf[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xf8bd('0x0'));var rimraf=require(_0xf8bd('0x1'));var zipdir=require(_0xf8bd('0x2'));var jsonpatch=require(_0xf8bd('0x3'));var rp=require(_0xf8bd('0x4'));var moment=require('moment');var BPromise=require(_0xf8bd('0x5'));var Mustache=require(_0xf8bd('0x6'));var util=require(_0xf8bd('0x7'));var path=require(_0xf8bd('0x8'));var sox=require(_0xf8bd('0x9'));var csv=require(_0xf8bd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf8bd('0xb'));var crypto=require(_0xf8bd('0xc'));var jsforce=require(_0xf8bd('0xd'));var deskjs=require(_0xf8bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf8bd('0xf'));var Papa=require(_0xf8bd('0x10'));var Redis=require('ioredis');var authService=require(_0xf8bd('0x11'));var qs=require(_0xf8bd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8bd('0x13'));var logger=require(_0xf8bd('0x14'))(_0xf8bd('0x15'));var utils=require(_0xf8bd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf8bd('0x17'));var db=require(_0xf8bd('0x18'))['db'];function respondWithStatusCode(_0x5ec9ad,_0x1a009e){_0x1a009e=_0x1a009e||0xcc;return function(_0x49e8c6){if(_0x49e8c6){return _0x5ec9ad[_0xf8bd('0x19')](_0x1a009e);}return _0x5ec9ad[_0xf8bd('0x1a')](_0x1a009e)[_0xf8bd('0x1b')]();};}function respondWithResult(_0x172c5e,_0x43d517){_0x43d517=_0x43d517||0xc8;return function(_0xa0ee74){if(_0xa0ee74){return _0x172c5e['status'](_0x43d517)['json'](_0xa0ee74);}};}function respondWithFilteredResult(_0x49478a,_0x13350a){return function(_0x33facf){if(_0x33facf){var _0x54dc30=typeof _0x13350a[_0xf8bd('0x1c')]===_0xf8bd('0x1d')&&typeof _0x13350a[_0xf8bd('0x1e')]===_0xf8bd('0x1d');var _0x54cf43=_0x33facf[_0xf8bd('0x1f')];var _0x3e69be=_0x54dc30?0x0:_0x13350a['offset'];var _0x2c006c=_0x54dc30?_0x33facf[_0xf8bd('0x1f')]:_0x13350a[_0xf8bd('0x1c')]+_0x13350a[_0xf8bd('0x1e')];var _0xf06524;if(_0x2c006c>=_0x54cf43){_0x2c006c=_0x54cf43;_0xf06524=0xc8;}else{_0xf06524=0xce;}_0x49478a[_0xf8bd('0x1a')](_0xf06524);return _0x49478a['set'](_0xf8bd('0x20'),_0x3e69be+'-'+_0x2c006c+'/'+_0x54cf43)[_0xf8bd('0x21')](_0x33facf);}return null;};}function patchUpdates(_0x5bd4fe){return function(_0x116946){try{jsonpatch['apply'](_0x116946,_0x5bd4fe,!![]);}catch(_0x30d533){return BPromise[_0xf8bd('0x22')](_0x30d533);}return _0x116946['save']();};}function saveUpdates(_0x469813,_0x45eb2d){return function(_0x4c575f){if(_0x4c575f){return _0x4c575f['update'](_0x469813)[_0xf8bd('0x23')](function(_0x4c6ff){return _0x4c6ff;});}return null;};}function removeEntity(_0x4edd5a,_0x280b5b){return function(_0x59d0b9){if(_0x59d0b9){return _0x59d0b9[_0xf8bd('0x24')]()[_0xf8bd('0x23')](function(){_0x4edd5a['status'](0xcc)[_0xf8bd('0x1b')]();});}};}function handleEntityNotFound(_0x4de830,_0x1dd9bd){return function(_0x5b85f5){if(!_0x5b85f5){_0x4de830[_0xf8bd('0x19')](0x194);}return _0x5b85f5;};}function handleError(_0x480bc8,_0x136bd2){_0x136bd2=_0x136bd2||0x1f4;return function(_0x4fe184){logger['error'](_0x4fe184[_0xf8bd('0x25')]);if(_0x4fe184['name']){delete _0x4fe184[_0xf8bd('0x26')];}_0x480bc8[_0xf8bd('0x1a')](_0x136bd2)[_0xf8bd('0x27')](_0x4fe184);};}exports['index']=function(_0x258d09,_0x3974ff){var _0xa3ff13={},_0x3aa54a={},_0x4fc088={'count':0x0,'rows':[]};var _0x4bff64=_[_0xf8bd('0x28')](db['FaxQueueReport']['rawAttributes'],function(_0x5407f9){return{'name':_0x5407f9['fieldName'],'type':_0x5407f9[_0xf8bd('0x29')][_0xf8bd('0x2a')]};});_0x3aa54a['model']=_[_0xf8bd('0x28')](_0x4bff64,_0xf8bd('0x26'));_0x3aa54a['query']=_['keys'](_0x258d09[_0xf8bd('0x2b')]);_0x3aa54a['filters']=_[_0xf8bd('0x2c')](_0x3aa54a[_0xf8bd('0x2d')],_0x3aa54a[_0xf8bd('0x2b')]);_0xa3ff13[_0xf8bd('0x2e')]=_[_0xf8bd('0x2c')](_0x3aa54a[_0xf8bd('0x2d')],qs['fields'](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x2f')]));_0xa3ff13['attributes']=_0xa3ff13['attributes'][_0xf8bd('0x30')]?_0xa3ff13[_0xf8bd('0x2e')]:_0x3aa54a['model'];if(!_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x31')](_0xf8bd('0x32'))){_0xa3ff13[_0xf8bd('0x1e')]=qs[_0xf8bd('0x1e')](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x1e')]);_0xa3ff13['offset']=qs[_0xf8bd('0x1c')](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x1c')]);}_0xa3ff13[_0xf8bd('0x33')]=qs[_0xf8bd('0x34')](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x34')]);_0xa3ff13['where']=qs['filters'](_[_0xf8bd('0x35')](_0x258d09['query'],_0x3aa54a['filters']),_0x4bff64);if(_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x36')]){_0xa3ff13[_0xf8bd('0x37')]=_[_0xf8bd('0x38')](_0xa3ff13[_0xf8bd('0x37')],{'$or':_['map'](_0x4bff64,function(_0x477be8){if(_0x477be8[_0xf8bd('0x29')]!==_0xf8bd('0x39')){var _0x4e0e7e={};_0x4e0e7e[_0x477be8['name']]={'$like':'%'+_0x258d09[_0xf8bd('0x2b')]['filter']+'%'};return _0x4e0e7e;}})});}_0xa3ff13=_['merge']({},_0xa3ff13,_0x258d09[_0xf8bd('0x3a')]);var _0x4a53fb={'where':_0xa3ff13[_0xf8bd('0x37')]};return db[_0xf8bd('0x3b')][_0xf8bd('0x1f')](_0x4a53fb)[_0xf8bd('0x23')](function(_0x21ab29){_0x4fc088[_0xf8bd('0x1f')]=_0x21ab29;if(_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x3c')]){_0xa3ff13[_0xf8bd('0x3d')]=[{'all':!![]}];}return db[_0xf8bd('0x3b')]['findAll'](_0xa3ff13);})[_0xf8bd('0x23')](function(_0x2deecd){_0x4fc088[_0xf8bd('0x3e')]=_0x2deecd;return _0x4fc088;})[_0xf8bd('0x23')](respondWithFilteredResult(_0x3974ff,_0xa3ff13))['catch'](handleError(_0x3974ff,null));};exports[_0xf8bd('0x3f')]=function(_0x1f11f8,_0x46e7d4){var _0x282a35={'raw':!![],'where':{'id':_0x1f11f8['params']['id']}},_0x504366={};_0x504366['model']=_['keys'](db['FaxQueueReport'][_0xf8bd('0x40')]);_0x504366[_0xf8bd('0x2b')]=_[_0xf8bd('0x41')](_0x1f11f8[_0xf8bd('0x2b')]);_0x504366[_0xf8bd('0x42')]=_[_0xf8bd('0x2c')](_0x504366[_0xf8bd('0x2d')],_0x504366[_0xf8bd('0x2b')]);_0x282a35['attributes']=_[_0xf8bd('0x2c')](_0x504366[_0xf8bd('0x2d')],qs[_0xf8bd('0x2f')](_0x1f11f8[_0xf8bd('0x2b')][_0xf8bd('0x2f')]));_0x282a35[_0xf8bd('0x2e')]=_0x282a35[_0xf8bd('0x2e')][_0xf8bd('0x30')]?_0x282a35[_0xf8bd('0x2e')]:_0x504366['model'];if(_0x1f11f8[_0xf8bd('0x2b')][_0xf8bd('0x3c')]){_0x282a35[_0xf8bd('0x3d')]=[{'all':!![]}];}_0x282a35=_[_0xf8bd('0x38')]({},_0x282a35,_0x1f11f8[_0xf8bd('0x3a')]);return db[_0xf8bd('0x3b')][_0xf8bd('0x43')](_0x282a35)['then'](handleEntityNotFound(_0x46e7d4,null))[_0xf8bd('0x23')](respondWithResult(_0x46e7d4,null))[_0xf8bd('0x44')](handleError(_0x46e7d4,null));};exports[_0xf8bd('0x45')]=function(_0x57e228,_0x1d6912){return db['FaxQueueReport'][_0xf8bd('0x45')](_0x57e228[_0xf8bd('0x46')],{})[_0xf8bd('0x23')](respondWithResult(_0x1d6912,0xc9))['catch'](handleError(_0x1d6912,null));};exports[_0xf8bd('0x47')]=function(_0x411023,_0x29b5a5){if(_0x411023[_0xf8bd('0x46')]['id']){delete _0x411023[_0xf8bd('0x46')]['id'];}return db[_0xf8bd('0x3b')][_0xf8bd('0x43')]({'where':{'id':_0x411023[_0xf8bd('0x48')]['id']}})[_0xf8bd('0x23')](handleEntityNotFound(_0x29b5a5,null))[_0xf8bd('0x23')](saveUpdates(_0x411023[_0xf8bd('0x46')],null))[_0xf8bd('0x23')](respondWithResult(_0x29b5a5,null))[_0xf8bd('0x44')](handleError(_0x29b5a5,null));};exports[_0xf8bd('0x24')]=function(_0x13dbe6,_0x2b0cb9){return db[_0xf8bd('0x3b')]['find']({'where':{'id':_0x13dbe6[_0xf8bd('0x48')]['id']}})[_0xf8bd('0x23')](handleEntityNotFound(_0x2b0cb9,null))[_0xf8bd('0x23')](removeEntity(_0x2b0cb9,null))[_0xf8bd('0x44')](handleError(_0x2b0cb9,null));};exports[_0xf8bd('0x49')]=function(_0x20d1c1,_0x283dfe){return db[_0xf8bd('0x3b')][_0xf8bd('0x49')]()['then'](respondWithResult(_0x283dfe,null))[_0xf8bd('0x44')](handleError(_0x283dfe,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a42d676..c8bae47 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x140022,_0x16c6d8){var _0x5b021c=function(_0x4f2c6c){while(--_0x4f2c6c){_0x140022['push'](_0x140022['shift']());}};_0x5b021c(++_0x16c6d8);}(_0x1261,0x144));var _0x1126=function(_0x3e690a,_0x31aa0f){_0x3e690a=_0x3e690a-0x0;var _0x435ca0=_0x1261[_0x3e690a];return _0x435ca0;};'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 +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x1c9be8,_0x460eef){var _0x5619e2=function(_0x48aad6){while(--_0x48aad6){_0x1c9be8['push'](_0x1c9be8['shift']());}};_0x5619e2(++_0x460eef);}(_0xf494,0x1c6));var _0x4f49=function(_0x2bec8b,_0x2e2504){_0x2bec8b=_0x2bec8b-0x0;var _0x28e691=_0xf494[_0x2bec8b];return _0x28e691;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('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 e9cac4b..e3e2669 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 _0x2693=['limit','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','where','attributes'];(function(_0x2114fc,_0x487b68){var _0x32e291=function(_0x108936){while(--_0x108936){_0x2114fc['push'](_0x2114fc['shift']());}};_0x32e291(++_0x487b68);}(_0x2693,0x98));var _0x3269=function(_0x5878a6,_0xacae30){_0x5878a6=_0x5878a6-0x0;var _0x43240d=_0x2693[_0x5878a6];return _0x43240d;};'use strict';var _=require(_0x3269('0x0'));var util=require(_0x3269('0x1'));var moment=require(_0x3269('0x2'));var BPromise=require(_0x3269('0x3'));var rs=require(_0x3269('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3269('0x5'));var logger=require(_0x3269('0x6'))(_0x3269('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3269('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc32881,_0x2b5288,_0x34e111){return new BPromise(function(_0x50aceb,_0x5e0ffc){return client[_0x3269('0x9')](_0xc32881,_0x34e111)[_0x3269('0xa')](function(_0x2613b6){logger[_0x3269('0xb')](_0x3269('0xc'),_0x2b5288,'request\x20sent');logger['debug'](_0x3269('0xd'),_0x2b5288,'request\x20sent',JSON[_0x3269('0xe')](_0x2613b6));if(_0x2613b6[_0x3269('0xf')]){if(_0x2613b6[_0x3269('0xf')][_0x3269('0x10')]===0x1f4){logger['error'](_0x3269('0xc'),_0x2b5288,_0x2613b6[_0x3269('0xf')]['message']);return _0x5e0ffc(_0x2613b6[_0x3269('0xf')][_0x3269('0x11')]);}logger[_0x3269('0xf')](_0x3269('0xc'),_0x2b5288,_0x2613b6['error']['message']);return _0x50aceb(_0x2613b6[_0x3269('0xf')][_0x3269('0x11')]);}else{logger[_0x3269('0xb')](_0x3269('0xc'),_0x2b5288,'request\x20sent');_0x50aceb(_0x2613b6['result'][_0x3269('0x11')]);}})[_0x3269('0x12')](function(_0x367bba){logger[_0x3269('0xf')](_0x3269('0xc'),_0x2b5288,_0x367bba);_0x5e0ffc(_0x367bba);});});}exports['CreateFaxQueueReport']=function(_0x1284a8){var _0x23d86f=this;return new Promise(function(_0x4d6338,_0x2ea37e){return db[_0x3269('0x13')][_0x3269('0x14')](_0x1284a8[_0x3269('0x15')],{'raw':_0x1284a8[_0x3269('0x16')]?_0x1284a8[_0x3269('0x16')][_0x3269('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2ef8df){logger['info'](_0x3269('0x18'),_0x1284a8);logger['debug'](_0x3269('0x18'),_0x1284a8,JSON[_0x3269('0xe')](_0x2ef8df));_0x4d6338(_0x2ef8df);})[_0x3269('0x12')](function(_0xe56fc3){logger['error'](_0x3269('0x18'),_0xe56fc3[_0x3269('0x11')],_0x1284a8);_0x2ea37e(_0x23d86f[_0x3269('0xf')](0x1f4,_0xe56fc3['message']));});});};exports[_0x3269('0x19')]=function(_0x1120c8){var _0x153976=this;return new Promise(function(_0x1862e6,_0xebf773){return db['FaxQueueReport']['update'](_0x1120c8[_0x3269('0x15')],{'raw':_0x1120c8[_0x3269('0x16')]?_0x1120c8[_0x3269('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1120c8[_0x3269('0x16')]?_0x1120c8[_0x3269('0x16')][_0x3269('0x1a')]||null:null,'attributes':_0x1120c8['options']?_0x1120c8[_0x3269('0x16')][_0x3269('0x1b')]||null:null,'limit':_0x1120c8[_0x3269('0x16')]?_0x1120c8[_0x3269('0x16')][_0x3269('0x1c')]||null:null})[_0x3269('0xa')](function(_0x4914ab){logger[_0x3269('0xb')](_0x3269('0x19'),_0x1120c8);logger[_0x3269('0x1d')](_0x3269('0x19'),_0x1120c8,JSON['stringify'](_0x4914ab));_0x1862e6(_0x4914ab);})[_0x3269('0x12')](function(_0x22d76d){logger['error'](_0x3269('0x19'),_0x22d76d[_0x3269('0x11')],_0x1120c8);_0xebf773(_0x153976[_0x3269('0xf')](0x1f4,_0x22d76d['message']));});});}; \ No newline at end of file +var _0x3b07=['CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','debug','UpdateFaxQueueReport','update','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3b07,0x160));var _0x73b0=function(_0x122763,_0x593c26){_0x122763=_0x122763-0x0;var _0x3491b0=_0x3b07[_0x122763];return _0x3491b0;};'use strict';var _=require(_0x73b0('0x0'));var util=require(_0x73b0('0x1'));var moment=require(_0x73b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x73b0('0x3'));var fs=require('fs');var Redis=require(_0x73b0('0x4'));var db=require(_0x73b0('0x5'))['db'];var utils=require(_0x73b0('0x6'));var logger=require(_0x73b0('0x7'))('rpc');var config=require(_0x73b0('0x8'));var jayson=require(_0x73b0('0x9'));var client=jayson[_0x73b0('0xa')][_0x73b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x174294,_0x44e333,_0x30b8f7){return new BPromise(function(_0x28479a,_0x5263ab){return client[_0x73b0('0xc')](_0x174294,_0x30b8f7)['then'](function(_0x3035f0){logger[_0x73b0('0xd')](_0x73b0('0xe'),_0x44e333,'request\x20sent');logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x44e333,_0x73b0('0xf'),JSON[_0x73b0('0x10')](_0x3035f0));if(_0x3035f0['error']){if(_0x3035f0[_0x73b0('0x11')]['code']===0x1f4){logger[_0x73b0('0x11')](_0x73b0('0xe'),_0x44e333,_0x3035f0[_0x73b0('0x11')][_0x73b0('0x12')]);return _0x5263ab(_0x3035f0[_0x73b0('0x11')][_0x73b0('0x12')]);}logger[_0x73b0('0x11')](_0x73b0('0xe'),_0x44e333,_0x3035f0[_0x73b0('0x11')][_0x73b0('0x12')]);return _0x28479a(_0x3035f0[_0x73b0('0x11')][_0x73b0('0x12')]);}else{logger[_0x73b0('0xd')](_0x73b0('0xe'),_0x44e333,'request\x20sent');_0x28479a(_0x3035f0['result'][_0x73b0('0x12')]);}})[_0x73b0('0x13')](function(_0x152c20){logger[_0x73b0('0x11')](_0x73b0('0xe'),_0x44e333,_0x152c20);_0x5263ab(_0x152c20);});});}exports[_0x73b0('0x14')]=function(_0x144823){var _0x4f9ea1=this;return new Promise(function(_0x104d82,_0x49fb70){return db[_0x73b0('0x15')][_0x73b0('0x16')](_0x144823[_0x73b0('0x17')],{'raw':_0x144823['options']?_0x144823[_0x73b0('0x18')][_0x73b0('0x19')]===undefined?!![]:![]:!![]})[_0x73b0('0x1a')](function(_0x4cee26){logger[_0x73b0('0xd')]('CreateFaxQueueReport',_0x144823);logger[_0x73b0('0x1b')](_0x73b0('0x14'),_0x144823,JSON[_0x73b0('0x10')](_0x4cee26));_0x104d82(_0x4cee26);})[_0x73b0('0x13')](function(_0x11b99b){logger[_0x73b0('0x11')](_0x73b0('0x14'),_0x11b99b[_0x73b0('0x12')],_0x144823);_0x49fb70(_0x4f9ea1[_0x73b0('0x11')](0x1f4,_0x11b99b[_0x73b0('0x12')]));});});};exports[_0x73b0('0x1c')]=function(_0x3ba897){var _0x57401d=this;return new Promise(function(_0x33e74c,_0xd2f899){return db['FaxQueueReport'][_0x73b0('0x1d')](_0x3ba897['body'],{'raw':_0x3ba897['options']?_0x3ba897[_0x73b0('0x18')][_0x73b0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ba897[_0x73b0('0x18')]?_0x3ba897[_0x73b0('0x18')]['where']||null:null,'attributes':_0x3ba897[_0x73b0('0x18')]?_0x3ba897[_0x73b0('0x18')]['attributes']||null:null,'limit':_0x3ba897[_0x73b0('0x18')]?_0x3ba897['options'][_0x73b0('0x1e')]||null:null})[_0x73b0('0x1a')](function(_0x4e8b71){logger[_0x73b0('0xd')]('UpdateFaxQueueReport',_0x3ba897);logger[_0x73b0('0x1b')](_0x73b0('0x1c'),_0x3ba897,JSON[_0x73b0('0x10')](_0x4e8b71));_0x33e74c(_0x4e8b71);})['catch'](function(_0x50ddf7){logger['error'](_0x73b0('0x1c'),_0x50ddf7[_0x73b0('0x12')],_0x3ba897);_0xd2f899(_0x57401d[_0x73b0('0x11')](0x1f4,_0x50ddf7['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 09441c4..a05c36e 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 _0xbe35=['/describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x4dcd7e,_0x3026fc){var _0x1d7ebd=function(_0x9ba5a){while(--_0x9ba5a){_0x4dcd7e['push'](_0x4dcd7e['shift']());}};_0x1d7ebd(++_0x3026fc);}(_0xbe35,0x12b));var _0x5be3=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xbe35[_0x255d5b];return _0x3e141a;};'use strict';var multer=require(_0x5be3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5be3('0x1'));var router=express['Router']();var fs_extra=require(_0x5be3('0x2'));var auth=require(_0x5be3('0x3'));var interaction=require(_0x5be3('0x4'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x5be3('0x5')]('/',auth['isAuthenticated'](),controller[_0x5be3('0x6')]);router[_0x5be3('0x5')](_0x5be3('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x5be3('0x5')](_0x5be3('0x8'),auth[_0x5be3('0x9')](),controller[_0x5be3('0xa')]);router[_0x5be3('0xb')]('/',auth[_0x5be3('0x9')](),controller[_0x5be3('0xc')]);router[_0x5be3('0xd')](_0x5be3('0x8'),auth[_0x5be3('0x9')](),controller[_0x5be3('0xe')]);router[_0x5be3('0xf')](_0x5be3('0x8'),auth[_0x5be3('0x9')](),controller[_0x5be3('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3927=['delete','destroy','multer','util','express','Router','fs-extra','../../config/environment','./faxQueueReport.controller','index','get','/describe','describe','/:id','isAuthenticated','post','create','update'];(function(_0x32845c,_0x5d792f){var _0x17f711=function(_0x314eda){while(--_0x314eda){_0x32845c['push'](_0x32845c['shift']());}};_0x17f711(++_0x5d792f);}(_0x3927,0x92));var _0x7392=function(_0x58abe7,_0x54a403){_0x58abe7=_0x58abe7-0x0;var _0x85170c=_0x3927[_0x58abe7];return _0x85170c;};'use strict';var multer=require(_0x7392('0x0'));var util=require(_0x7392('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7392('0x2'));var router=express[_0x7392('0x3')]();var fs_extra=require(_0x7392('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7392('0x5'));var controller=require(_0x7392('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7392('0x7')]);router[_0x7392('0x8')](_0x7392('0x9'),auth['isAuthenticated'](),controller[_0x7392('0xa')]);router[_0x7392('0x8')](_0x7392('0xb'),auth[_0x7392('0xc')](),controller['show']);router[_0x7392('0xd')]('/',auth[_0x7392('0xc')](),controller[_0x7392('0xe')]);router['put'](_0x7392('0xb'),auth[_0x7392('0xc')](),controller[_0x7392('0xf')]);router[_0x7392('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x7392('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4136f49..ccaedd0 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3d2891,_0x2ef8b7){var _0x160143=function(_0x56e780){while(--_0x56e780){_0x3d2891['push'](_0x3d2891['shift']());}};_0x160143(++_0x2ef8b7);}(_0xaa88,0x137));var _0x8aa8=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xaa88[_0x1f9f37];return _0x21c080;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x21b894,_0x48b6d4){var _0x4fc99c=function(_0x2898bd){while(--_0x2898bd){_0x21b894['push'](_0x21b894['shift']());}};_0x4fc99c(++_0x48b6d4);}(_0xaa88,0x137));var _0x8aa8=function(_0x57f8c0,_0x136cf6){_0x57f8c0=_0x57f8c0-0x0;var _0x117f08=_0xaa88[_0x57f8c0];return _0x117f08;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e379107..60e716f 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 _0x9e50=['mustache','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x9e50,0xe3));var _0x09e5=function(_0x36814b,_0x5be26b){_0x36814b=_0x36814b-0x0;var _0x2aa56d=_0x9e50[_0x36814b];return _0x2aa56d;};'use strict';var emlformat=require(_0x09e5('0x0'));var rimraf=require(_0x09e5('0x1'));var zipdir=require(_0x09e5('0x2'));var jsonpatch=require(_0x09e5('0x3'));var rp=require(_0x09e5('0x4'));var moment=require(_0x09e5('0x5'));var BPromise=require(_0x09e5('0x6'));var Mustache=require(_0x09e5('0x7'));var util=require('util');var path=require(_0x09e5('0x8'));var sox=require('sox');var csv=require(_0x09e5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09e5('0xa'));var _=require(_0x09e5('0xb'));var squel=require(_0x09e5('0xc'));var crypto=require('crypto');var jsforce=require(_0x09e5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x09e5('0x9'));var querystring=require(_0x09e5('0xe'));var Papa=require(_0x09e5('0xf'));var Redis=require(_0x09e5('0x10'));var authService=require(_0x09e5('0x11'));var qs=require(_0x09e5('0x12'));var as=require(_0x09e5('0x13'));var hardwareService=require(_0x09e5('0x14'));var logger=require(_0x09e5('0x15'))(_0x09e5('0x16'));var utils=require(_0x09e5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x09e5('0x18'))['db'];function respondWithStatusCode(_0x3cc5c7,_0x56b86b){_0x56b86b=_0x56b86b||0xcc;return function(_0x5446ff){if(_0x5446ff){return _0x3cc5c7[_0x09e5('0x19')](_0x56b86b);}return _0x3cc5c7['status'](_0x56b86b)[_0x09e5('0x1a')]();};}function respondWithResult(_0x3417e8,_0x33c41e){_0x33c41e=_0x33c41e||0xc8;return function(_0x7b73e7){if(_0x7b73e7){return _0x3417e8[_0x09e5('0x1b')](_0x33c41e)[_0x09e5('0x1c')](_0x7b73e7);}};}function respondWithFilteredResult(_0x42f155,_0x199464){return function(_0x46aee1){if(_0x46aee1){var _0x2abfb5=typeof _0x199464[_0x09e5('0x1d')]===_0x09e5('0x1e')&&typeof _0x199464['limit']===_0x09e5('0x1e');var _0x209172=_0x46aee1[_0x09e5('0x1f')];var _0xbcec13=_0x2abfb5?0x0:_0x199464['offset'];var _0x2a836e=_0x2abfb5?_0x46aee1[_0x09e5('0x1f')]:_0x199464[_0x09e5('0x1d')]+_0x199464[_0x09e5('0x20')];var _0x3841b5;if(_0x2a836e>=_0x209172){_0x2a836e=_0x209172;_0x3841b5=0xc8;}else{_0x3841b5=0xce;}_0x42f155[_0x09e5('0x1b')](_0x3841b5);return _0x42f155[_0x09e5('0x21')]('Content-Range',_0xbcec13+'-'+_0x2a836e+'/'+_0x209172)[_0x09e5('0x1c')](_0x46aee1);}return null;};}function patchUpdates(_0x2c4d1c){return function(_0x577e4e){try{jsonpatch[_0x09e5('0x22')](_0x577e4e,_0x2c4d1c,!![]);}catch(_0x1bf2fa){return BPromise[_0x09e5('0x23')](_0x1bf2fa);}return _0x577e4e[_0x09e5('0x24')]();};}function saveUpdates(_0x245d5c,_0x5a073a){return function(_0x48a8cd){if(_0x48a8cd){return _0x48a8cd[_0x09e5('0x25')](_0x245d5c)[_0x09e5('0x26')](function(_0x11c8fb){return _0x11c8fb;});}return null;};}function removeEntity(_0x29b492,_0x21bda7){return function(_0x28f359){if(_0x28f359){return _0x28f359[_0x09e5('0x27')]()[_0x09e5('0x26')](function(){_0x29b492['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa48f,_0x32d0b3){return function(_0x5687ab){if(!_0x5687ab){_0x3fa48f['sendStatus'](0x194);}return _0x5687ab;};}function handleError(_0x4aed7c,_0x97383){_0x97383=_0x97383||0x1f4;return function(_0x1f21db){logger[_0x09e5('0x28')](_0x1f21db[_0x09e5('0x29')]);if(_0x1f21db[_0x09e5('0x2a')]){delete _0x1f21db['name'];}_0x4aed7c[_0x09e5('0x1b')](_0x97383)[_0x09e5('0x2b')](_0x1f21db);};}exports['index']=function(_0x3abc21,_0x5d552e){var _0x1e5119={},_0x48b1f2={},_0x23b7da={'count':0x0,'rows':[]};var _0x5bf6ff=_[_0x09e5('0x2c')](db[_0x09e5('0x2d')][_0x09e5('0x2e')],function(_0x5221d4){return{'name':_0x5221d4[_0x09e5('0x2f')],'type':_0x5221d4[_0x09e5('0x30')][_0x09e5('0x31')]};});_0x48b1f2[_0x09e5('0x32')]=_['map'](_0x5bf6ff,'name');_0x48b1f2[_0x09e5('0x33')]=_[_0x09e5('0x34')](_0x3abc21[_0x09e5('0x33')]);_0x48b1f2[_0x09e5('0x35')]=_[_0x09e5('0x36')](_0x48b1f2[_0x09e5('0x32')],_0x48b1f2['query']);_0x1e5119[_0x09e5('0x37')]=_[_0x09e5('0x36')](_0x48b1f2['model'],qs[_0x09e5('0x38')](_0x3abc21['query'][_0x09e5('0x38')]));_0x1e5119[_0x09e5('0x37')]=_0x1e5119[_0x09e5('0x37')][_0x09e5('0x39')]?_0x1e5119['attributes']:_0x48b1f2[_0x09e5('0x32')];if(!_0x3abc21[_0x09e5('0x33')][_0x09e5('0x3a')](_0x09e5('0x3b'))){_0x1e5119[_0x09e5('0x20')]=qs['limit'](_0x3abc21['query']['limit']);_0x1e5119[_0x09e5('0x1d')]=qs[_0x09e5('0x1d')](_0x3abc21[_0x09e5('0x33')][_0x09e5('0x1d')]);}_0x1e5119[_0x09e5('0x3c')]=qs[_0x09e5('0x3d')](_0x3abc21[_0x09e5('0x33')][_0x09e5('0x3d')]);_0x1e5119[_0x09e5('0x3e')]=qs[_0x09e5('0x35')](_[_0x09e5('0x3f')](_0x3abc21[_0x09e5('0x33')],_0x48b1f2[_0x09e5('0x35')]),_0x5bf6ff);if(_0x3abc21['query'][_0x09e5('0x40')]){_0x1e5119[_0x09e5('0x3e')]=_[_0x09e5('0x41')](_0x1e5119[_0x09e5('0x3e')],{'$or':_['map'](_0x5bf6ff,function(_0x2bc9b9){if(_0x2bc9b9[_0x09e5('0x30')]!=='VIRTUAL'){var _0x5b5a54={};_0x5b5a54[_0x2bc9b9[_0x09e5('0x2a')]]={'$like':'%'+_0x3abc21[_0x09e5('0x33')][_0x09e5('0x40')]+'%'};return _0x5b5a54;}})});}_0x1e5119=_[_0x09e5('0x41')]({},_0x1e5119,_0x3abc21[_0x09e5('0x42')]);var _0x3f9635={'where':_0x1e5119[_0x09e5('0x3e')]};return db['FaxTransferReport']['count'](_0x3f9635)[_0x09e5('0x26')](function(_0x51cbbd){_0x23b7da[_0x09e5('0x1f')]=_0x51cbbd;if(_0x3abc21[_0x09e5('0x33')][_0x09e5('0x43')]){_0x1e5119[_0x09e5('0x44')]=[{'all':!![]}];}return db[_0x09e5('0x2d')][_0x09e5('0x45')](_0x1e5119);})[_0x09e5('0x26')](function(_0x45aa34){_0x23b7da[_0x09e5('0x46')]=_0x45aa34;return _0x23b7da;})[_0x09e5('0x26')](respondWithFilteredResult(_0x5d552e,_0x1e5119))[_0x09e5('0x47')](handleError(_0x5d552e,null));};exports[_0x09e5('0x48')]=function(_0x57c95e,_0x49ec86){var _0x121e32={'raw':!![],'where':{'id':_0x57c95e[_0x09e5('0x49')]['id']}},_0x278192={};_0x278192[_0x09e5('0x32')]=_[_0x09e5('0x34')](db[_0x09e5('0x2d')]['rawAttributes']);_0x278192[_0x09e5('0x33')]=_[_0x09e5('0x34')](_0x57c95e['query']);_0x278192[_0x09e5('0x35')]=_[_0x09e5('0x36')](_0x278192[_0x09e5('0x32')],_0x278192[_0x09e5('0x33')]);_0x121e32['attributes']=_['intersection'](_0x278192['model'],qs['fields'](_0x57c95e[_0x09e5('0x33')][_0x09e5('0x38')]));_0x121e32['attributes']=_0x121e32[_0x09e5('0x37')][_0x09e5('0x39')]?_0x121e32[_0x09e5('0x37')]:_0x278192[_0x09e5('0x32')];if(_0x57c95e[_0x09e5('0x33')][_0x09e5('0x43')]){_0x121e32[_0x09e5('0x44')]=[{'all':!![]}];}_0x121e32=_[_0x09e5('0x41')]({},_0x121e32,_0x57c95e[_0x09e5('0x42')]);return db[_0x09e5('0x2d')][_0x09e5('0x4a')](_0x121e32)['then'](handleEntityNotFound(_0x49ec86,null))[_0x09e5('0x26')](respondWithResult(_0x49ec86,null))[_0x09e5('0x47')](handleError(_0x49ec86,null));};exports[_0x09e5('0x4b')]=function(_0xcdb2e3,_0x30ced2){return db[_0x09e5('0x2d')][_0x09e5('0x4b')](_0xcdb2e3[_0x09e5('0x4c')],{})[_0x09e5('0x26')](respondWithResult(_0x30ced2,0xc9))[_0x09e5('0x47')](handleError(_0x30ced2,null));};exports[_0x09e5('0x25')]=function(_0x3af1ea,_0x1fdb83){if(_0x3af1ea['body']['id']){delete _0x3af1ea[_0x09e5('0x4c')]['id'];}return db[_0x09e5('0x2d')]['find']({'where':{'id':_0x3af1ea[_0x09e5('0x49')]['id']}})[_0x09e5('0x26')](handleEntityNotFound(_0x1fdb83,null))[_0x09e5('0x26')](saveUpdates(_0x3af1ea['body'],null))[_0x09e5('0x26')](respondWithResult(_0x1fdb83,null))[_0x09e5('0x47')](handleError(_0x1fdb83,null));};exports['destroy']=function(_0x232157,_0x1e768a){return db['FaxTransferReport']['find']({'where':{'id':_0x232157[_0x09e5('0x49')]['id']}})[_0x09e5('0x26')](handleEntityNotFound(_0x1e768a,null))[_0x09e5('0x26')](removeEntity(_0x1e768a,null))[_0x09e5('0x47')](handleError(_0x1e768a,null));};exports[_0x09e5('0x4d')]=function(_0x14938a,_0x301d36){return db['FaxTransferReport']['describe']()[_0x09e5('0x26')](respondWithResult(_0x301d36,null))[_0x09e5('0x47')](handleError(_0x301d36,null));}; \ No newline at end of file +var _0x1179=['stack','name','send','map','FaxTransferReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','update','then','destroy','end','error'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0x1179,0x1df));var _0x9117=function(_0x1465d4,_0x2d3d48){_0x1465d4=_0x1465d4-0x0;var _0x118a84=_0x1179[_0x1465d4];return _0x118a84;};'use strict';var emlformat=require(_0x9117('0x0'));var rimraf=require(_0x9117('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9117('0x2'));var rp=require(_0x9117('0x3'));var moment=require(_0x9117('0x4'));var BPromise=require(_0x9117('0x5'));var Mustache=require('mustache');var util=require(_0x9117('0x6'));var path=require(_0x9117('0x7'));var sox=require(_0x9117('0x8'));var csv=require(_0x9117('0x9'));var ejs=require(_0x9117('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9117('0xb'));var squel=require(_0x9117('0xc'));var crypto=require(_0x9117('0xd'));var jsforce=require(_0x9117('0xe'));var deskjs=require(_0x9117('0xf'));var toCsv=require(_0x9117('0x9'));var querystring=require(_0x9117('0x10'));var Papa=require(_0x9117('0x11'));var Redis=require(_0x9117('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9117('0x13'));var as=require(_0x9117('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9117('0x15'))(_0x9117('0x16'));var utils=require('../../config/utils');var config=require(_0x9117('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9117('0x18'))['db'];function respondWithStatusCode(_0x13f95b,_0xcf748d){_0xcf748d=_0xcf748d||0xcc;return function(_0x7b23c9){if(_0x7b23c9){return _0x13f95b[_0x9117('0x19')](_0xcf748d);}return _0x13f95b['status'](_0xcf748d)['end']();};}function respondWithResult(_0x5de409,_0x449d8c){_0x449d8c=_0x449d8c||0xc8;return function(_0xfeb8bd){if(_0xfeb8bd){return _0x5de409[_0x9117('0x1a')](_0x449d8c)[_0x9117('0x1b')](_0xfeb8bd);}};}function respondWithFilteredResult(_0x2d06a0,_0x19b633){return function(_0x380fc5){if(_0x380fc5){var _0x7822e6=typeof _0x19b633['offset']===_0x9117('0x1c')&&typeof _0x19b633[_0x9117('0x1d')]===_0x9117('0x1c');var _0x5ac60f=_0x380fc5[_0x9117('0x1e')];var _0x1045e1=_0x7822e6?0x0:_0x19b633[_0x9117('0x1f')];var _0x24745b=_0x7822e6?_0x380fc5[_0x9117('0x1e')]:_0x19b633[_0x9117('0x1f')]+_0x19b633[_0x9117('0x1d')];var _0x178dbc;if(_0x24745b>=_0x5ac60f){_0x24745b=_0x5ac60f;_0x178dbc=0xc8;}else{_0x178dbc=0xce;}_0x2d06a0[_0x9117('0x1a')](_0x178dbc);return _0x2d06a0['set'](_0x9117('0x20'),_0x1045e1+'-'+_0x24745b+'/'+_0x5ac60f)[_0x9117('0x1b')](_0x380fc5);}return null;};}function patchUpdates(_0x622908){return function(_0x1779a6){try{jsonpatch['apply'](_0x1779a6,_0x622908,!![]);}catch(_0x12728e){return BPromise[_0x9117('0x21')](_0x12728e);}return _0x1779a6['save']();};}function saveUpdates(_0x35f88a,_0x27acdf){return function(_0x8e9864){if(_0x8e9864){return _0x8e9864[_0x9117('0x22')](_0x35f88a)[_0x9117('0x23')](function(_0x550a5c){return _0x550a5c;});}return null;};}function removeEntity(_0x12878b,_0x34500a){return function(_0x441087){if(_0x441087){return _0x441087[_0x9117('0x24')]()[_0x9117('0x23')](function(){_0x12878b[_0x9117('0x1a')](0xcc)[_0x9117('0x25')]();});}};}function handleEntityNotFound(_0x38ec68,_0x163337){return function(_0x28baae){if(!_0x28baae){_0x38ec68['sendStatus'](0x194);}return _0x28baae;};}function handleError(_0x1bd2fd,_0x285dce){_0x285dce=_0x285dce||0x1f4;return function(_0x176edb){logger[_0x9117('0x26')](_0x176edb[_0x9117('0x27')]);if(_0x176edb[_0x9117('0x28')]){delete _0x176edb['name'];}_0x1bd2fd[_0x9117('0x1a')](_0x285dce)[_0x9117('0x29')](_0x176edb);};}exports['index']=function(_0x2b7fb4,_0xc4af27){var _0x535697={},_0xf52363={},_0x103f28={'count':0x0,'rows':[]};var _0x3aeab0=_[_0x9117('0x2a')](db[_0x9117('0x2b')][_0x9117('0x2c')],function(_0x2563cb){return{'name':_0x2563cb['fieldName'],'type':_0x2563cb['type']['key']};});_0xf52363[_0x9117('0x2d')]=_[_0x9117('0x2a')](_0x3aeab0,'name');_0xf52363[_0x9117('0x2e')]=_[_0x9117('0x2f')](_0x2b7fb4['query']);_0xf52363[_0x9117('0x30')]=_[_0x9117('0x31')](_0xf52363[_0x9117('0x2d')],_0xf52363[_0x9117('0x2e')]);_0x535697[_0x9117('0x32')]=_['intersection'](_0xf52363[_0x9117('0x2d')],qs[_0x9117('0x33')](_0x2b7fb4['query'][_0x9117('0x33')]));_0x535697['attributes']=_0x535697[_0x9117('0x32')][_0x9117('0x34')]?_0x535697[_0x9117('0x32')]:_0xf52363[_0x9117('0x2d')];if(!_0x2b7fb4[_0x9117('0x2e')][_0x9117('0x35')](_0x9117('0x36'))){_0x535697[_0x9117('0x1d')]=qs[_0x9117('0x1d')](_0x2b7fb4['query']['limit']);_0x535697[_0x9117('0x1f')]=qs[_0x9117('0x1f')](_0x2b7fb4[_0x9117('0x2e')][_0x9117('0x1f')]);}_0x535697[_0x9117('0x37')]=qs[_0x9117('0x38')](_0x2b7fb4[_0x9117('0x2e')][_0x9117('0x38')]);_0x535697[_0x9117('0x39')]=qs[_0x9117('0x30')](_[_0x9117('0x3a')](_0x2b7fb4[_0x9117('0x2e')],_0xf52363[_0x9117('0x30')]),_0x3aeab0);if(_0x2b7fb4[_0x9117('0x2e')][_0x9117('0x3b')]){_0x535697[_0x9117('0x39')]=_[_0x9117('0x3c')](_0x535697[_0x9117('0x39')],{'$or':_[_0x9117('0x2a')](_0x3aeab0,function(_0x2ac5e5){if(_0x2ac5e5[_0x9117('0x3d')]!==_0x9117('0x3e')){var _0x3b72c0={};_0x3b72c0[_0x2ac5e5[_0x9117('0x28')]]={'$like':'%'+_0x2b7fb4[_0x9117('0x2e')][_0x9117('0x3b')]+'%'};return _0x3b72c0;}})});}_0x535697=_['merge']({},_0x535697,_0x2b7fb4[_0x9117('0x3f')]);var _0x463670={'where':_0x535697[_0x9117('0x39')]};return db['FaxTransferReport'][_0x9117('0x1e')](_0x463670)['then'](function(_0xe66b89){_0x103f28[_0x9117('0x1e')]=_0xe66b89;if(_0x2b7fb4[_0x9117('0x2e')][_0x9117('0x40')]){_0x535697[_0x9117('0x41')]=[{'all':!![]}];}return db[_0x9117('0x2b')][_0x9117('0x42')](_0x535697);})[_0x9117('0x23')](function(_0x4af648){_0x103f28['rows']=_0x4af648;return _0x103f28;})['then'](respondWithFilteredResult(_0xc4af27,_0x535697))[_0x9117('0x43')](handleError(_0xc4af27,null));};exports[_0x9117('0x44')]=function(_0xe932c4,_0x2ceedb){var _0x459496={'raw':!![],'where':{'id':_0xe932c4[_0x9117('0x45')]['id']}},_0x3ef4b0={};_0x3ef4b0[_0x9117('0x2d')]=_[_0x9117('0x2f')](db[_0x9117('0x2b')][_0x9117('0x2c')]);_0x3ef4b0[_0x9117('0x2e')]=_['keys'](_0xe932c4[_0x9117('0x2e')]);_0x3ef4b0[_0x9117('0x30')]=_[_0x9117('0x31')](_0x3ef4b0[_0x9117('0x2d')],_0x3ef4b0['query']);_0x459496['attributes']=_['intersection'](_0x3ef4b0['model'],qs[_0x9117('0x33')](_0xe932c4['query'][_0x9117('0x33')]));_0x459496[_0x9117('0x32')]=_0x459496[_0x9117('0x32')][_0x9117('0x34')]?_0x459496[_0x9117('0x32')]:_0x3ef4b0[_0x9117('0x2d')];if(_0xe932c4[_0x9117('0x2e')][_0x9117('0x40')]){_0x459496[_0x9117('0x41')]=[{'all':!![]}];}_0x459496=_[_0x9117('0x3c')]({},_0x459496,_0xe932c4[_0x9117('0x3f')]);return db[_0x9117('0x2b')][_0x9117('0x46')](_0x459496)['then'](handleEntityNotFound(_0x2ceedb,null))[_0x9117('0x23')](respondWithResult(_0x2ceedb,null))[_0x9117('0x43')](handleError(_0x2ceedb,null));};exports[_0x9117('0x47')]=function(_0x4b2238,_0xcdf1ae){return db[_0x9117('0x2b')][_0x9117('0x47')](_0x4b2238[_0x9117('0x48')],{})[_0x9117('0x23')](respondWithResult(_0xcdf1ae,0xc9))[_0x9117('0x43')](handleError(_0xcdf1ae,null));};exports['update']=function(_0x10a4dd,_0x5a51ae){if(_0x10a4dd[_0x9117('0x48')]['id']){delete _0x10a4dd[_0x9117('0x48')]['id'];}return db[_0x9117('0x2b')][_0x9117('0x46')]({'where':{'id':_0x10a4dd[_0x9117('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a51ae,null))['then'](saveUpdates(_0x10a4dd[_0x9117('0x48')],null))[_0x9117('0x23')](respondWithResult(_0x5a51ae,null))['catch'](handleError(_0x5a51ae,null));};exports[_0x9117('0x24')]=function(_0x278f29,_0x733d63){return db['FaxTransferReport']['find']({'where':{'id':_0x278f29[_0x9117('0x45')]['id']}})[_0x9117('0x23')](handleEntityNotFound(_0x733d63,null))['then'](removeEntity(_0x733d63,null))['catch'](handleError(_0x733d63,null));};exports[_0x9117('0x49')]=function(_0x4f5a76,_0x219f63){return db[_0x9117('0x2b')][_0x9117('0x49')]()[_0x9117('0x23')](respondWithResult(_0x219f63,null))[_0x9117('0x43')](handleError(_0x219f63,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ef4a42f..4801df5 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 _0xb0d2=['rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x1337cd,_0x1bedc6){var _0x1a3a5c=function(_0x188234){while(--_0x188234){_0x1337cd['push'](_0x1337cd['shift']());}};_0x1a3a5c(++_0x1bedc6);}(_0xb0d2,0x1b4));var _0x2b0d=function(_0x84d83d,_0x266fd2){_0x84d83d=_0x84d83d-0x0;var _0x1fe9f7=_0xb0d2[_0x84d83d];return _0x1fe9f7;};'use strict';var _=require(_0x2b0d('0x0'));var util=require('util');var logger=require(_0x2b0d('0x1'))(_0x2b0d('0x2'));var moment=require(_0x2b0d('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b0d('0x4'));var fs=require('fs');var path=require(_0x2b0d('0x5'));var rimraf=require(_0x2b0d('0x6'));var config=require(_0x2b0d('0x7'));var attributes=require(_0x2b0d('0x8'));module['exports']=function(_0xe828d8,_0x13b580){return _0xe828d8[_0x2b0d('0x9')](_0x2b0d('0xa'),attributes,{'tableName':_0x2b0d('0xb'),'paranoid':![],'indexes':[{'name':_0x2b0d('0xc'),'fields':[_0x2b0d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e1e=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x5e1e,0x137));var _0xe5e1=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x5e1e[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xe5e1('0x0'));var util=require(_0xe5e1('0x1'));var logger=require(_0xe5e1('0x2'))('api');var moment=require(_0xe5e1('0x3'));var BPromise=require(_0xe5e1('0x4'));var rp=require(_0xe5e1('0x5'));var fs=require('fs');var path=require(_0xe5e1('0x6'));var rimraf=require(_0xe5e1('0x7'));var config=require(_0xe5e1('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0xe5e1('0x9')]=function(_0x396c75,_0x27b765){return _0x396c75[_0xe5e1('0xa')](_0xe5e1('0xb'),attributes,{'tableName':_0xe5e1('0xc'),'paranoid':![],'indexes':[{'name':_0xe5e1('0xd'),'fields':[_0xe5e1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 6c920c9..2503c37 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 _0x6305=['http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0x6305,0xc5));var _0x5630=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6305[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x5630('0x0'));var util=require(_0x5630('0x1'));var moment=require('moment');var BPromise=require(_0x5630('0x2'));var rs=require(_0x5630('0x3'));var fs=require('fs');var Redis=require(_0x5630('0x4'));var db=require(_0x5630('0x5'))['db'];var utils=require(_0x5630('0x6'));var logger=require(_0x5630('0x7'))('rpc');var config=require(_0x5630('0x8'));var jayson=require(_0x5630('0x9'));var client=jayson['client'][_0x5630('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fc016,_0x514998,_0x1fd9f8){return new BPromise(function(_0x338c83,_0x174491){return client[_0x5630('0xb')](_0x4fc016,_0x1fd9f8)[_0x5630('0xc')](function(_0x3b8a70){logger[_0x5630('0xd')](_0x5630('0xe'),_0x514998,_0x5630('0xf'));logger[_0x5630('0x10')](_0x5630('0x11'),_0x514998,'request\x20sent',JSON[_0x5630('0x12')](_0x3b8a70));if(_0x3b8a70[_0x5630('0x13')]){if(_0x3b8a70[_0x5630('0x13')][_0x5630('0x14')]===0x1f4){logger[_0x5630('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x514998,_0x3b8a70[_0x5630('0x13')][_0x5630('0x15')]);return _0x174491(_0x3b8a70['error']['message']);}logger[_0x5630('0x13')](_0x5630('0xe'),_0x514998,_0x3b8a70[_0x5630('0x13')]['message']);return _0x338c83(_0x3b8a70['error'][_0x5630('0x15')]);}else{logger[_0x5630('0xd')](_0x5630('0xe'),_0x514998,_0x5630('0xf'));_0x338c83(_0x3b8a70[_0x5630('0x16')][_0x5630('0x15')]);}})['catch'](function(_0x3f661f){logger[_0x5630('0x13')](_0x5630('0xe'),_0x514998,_0x3f661f);_0x174491(_0x3f661f);});});} \ No newline at end of file +var _0xbf87=['then','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0xbf87,0x106));var _0x7bf8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbf87[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7bf8('0x0'));var util=require(_0x7bf8('0x1'));var moment=require(_0x7bf8('0x2'));var BPromise=require('bluebird');var rs=require(_0x7bf8('0x3'));var fs=require('fs');var Redis=require(_0x7bf8('0x4'));var db=require(_0x7bf8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7bf8('0x6'));var config=require('../../config/environment');var jayson=require(_0x7bf8('0x7'));var client=jayson[_0x7bf8('0x8')][_0x7bf8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x380970,_0x4b4289,_0x3cde5d){return new BPromise(function(_0x2251fd,_0x2cf52b){return client[_0x7bf8('0xa')](_0x380970,_0x3cde5d)[_0x7bf8('0xb')](function(_0x2b163b){logger[_0x7bf8('0xc')](_0x7bf8('0xd'),_0x4b4289,'request\x20sent');logger['debug'](_0x7bf8('0xe'),_0x4b4289,_0x7bf8('0xf'),JSON['stringify'](_0x2b163b));if(_0x2b163b[_0x7bf8('0x10')]){if(_0x2b163b['error'][_0x7bf8('0x11')]===0x1f4){logger[_0x7bf8('0x10')](_0x7bf8('0xd'),_0x4b4289,_0x2b163b[_0x7bf8('0x10')][_0x7bf8('0x12')]);return _0x2cf52b(_0x2b163b[_0x7bf8('0x10')]['message']);}logger[_0x7bf8('0x10')](_0x7bf8('0xd'),_0x4b4289,_0x2b163b[_0x7bf8('0x10')][_0x7bf8('0x12')]);return _0x2251fd(_0x2b163b['error']['message']);}else{logger['info'](_0x7bf8('0xd'),_0x4b4289,_0x7bf8('0xf'));_0x2251fd(_0x2b163b[_0x7bf8('0x13')][_0x7bf8('0x12')]);}})[_0x7bf8('0x14')](function(_0x4f3e8a){logger['error'](_0x7bf8('0xd'),_0x4b4289,_0x4f3e8a);_0x2cf52b(_0x4f3e8a);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 1df51f5..616f562 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 _0xb75b=['util','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','delete','exports','multer'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xb75b,0x194));var _0xbb75=function(_0x53fcad,_0x588f27){_0x53fcad=_0x53fcad-0x0;var _0x24c21f=_0xb75b[_0x53fcad];return _0x24c21f;};'use strict';var multer=require(_0xbb75('0x0'));var util=require(_0xbb75('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb75('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbb75('0x3'));var config=require(_0xbb75('0x4'));var controller=require('./faxTransferReport.controller');router[_0xbb75('0x5')]('/',auth[_0xbb75('0x6')](),controller[_0xbb75('0x7')]);router[_0xbb75('0x5')](_0xbb75('0x8'),auth[_0xbb75('0x6')](),controller[_0xbb75('0x9')]);router[_0xbb75('0x5')](_0xbb75('0xa'),auth[_0xbb75('0x6')](),controller[_0xbb75('0xb')]);router[_0xbb75('0xc')]('/',auth[_0xbb75('0x6')](),controller['create']);router['put'](_0xbb75('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xbb75('0xd')](_0xbb75('0xa'),auth[_0xbb75('0x6')](),controller['destroy']);module[_0xbb75('0xe')]=router; \ No newline at end of file +var _0xd4b5=['/:id','post','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x280367,_0x3d1359){var _0x3c523d=function(_0x309126){while(--_0x309126){_0x280367['push'](_0x280367['shift']());}};_0x3c523d(++_0x3d1359);}(_0xd4b5,0x16d));var _0x5d4b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xd4b5[_0x5b561d];return _0x431060;};'use strict';var multer=require('multer');var util=require(_0x5d4b('0x0'));var path=require('path');var timeout=require(_0x5d4b('0x1'));var express=require(_0x5d4b('0x2'));var router=express[_0x5d4b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5d4b('0x4'));var interaction=require(_0x5d4b('0x5'));var config=require(_0x5d4b('0x6'));var controller=require(_0x5d4b('0x7'));router[_0x5d4b('0x8')]('/',auth['isAuthenticated'](),controller[_0x5d4b('0x9')]);router['get'](_0x5d4b('0xa'),auth[_0x5d4b('0xb')](),controller[_0x5d4b('0xc')]);router[_0x5d4b('0x8')](_0x5d4b('0xd'),auth[_0x5d4b('0xb')](),controller['show']);router[_0x5d4b('0xe')]('/',auth[_0x5d4b('0xb')](),controller['create']);router['put'](_0x5d4b('0xd'),auth[_0x5d4b('0xb')](),controller[_0x5d4b('0xf')]);router[_0x5d4b('0x10')]('/:id',auth[_0x5d4b('0xb')](),controller[_0x5d4b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 580ff6a..d9de7a8 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 _0xa6bf=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4fe821,_0x3c8c14){var _0x54dd21=function(_0x44e6f5){while(--_0x44e6f5){_0x4fe821['push'](_0x4fe821['shift']());}};_0x54dd21(++_0x3c8c14);}(_0xa6bf,0x84));var _0xfa6b=function(_0x1d8a39,_0x34e7d7){_0x1d8a39=_0x1d8a39-0x0;var _0x30729c=_0xa6bf[_0x1d8a39];return _0x30729c;};'use strict';var multer=require('multer');var util=require(_0xfa6b('0x0'));var path=require(_0xfa6b('0x1'));var timeout=require(_0xfa6b('0x2'));var express=require(_0xfa6b('0x3'));var router=express[_0xfa6b('0x4')]();var fs_extra=require(_0xfa6b('0x5'));var auth=require(_0xfa6b('0x6'));var interaction=require(_0xfa6b('0x7'));var config=require(_0xfa6b('0x8'));var controller=require('./intDeskAccount.controller');router[_0xfa6b('0x9')]('/',auth[_0xfa6b('0xa')](),controller[_0xfa6b('0xb')]);router[_0xfa6b('0x9')]('/:id',auth[_0xfa6b('0xa')](),controller[_0xfa6b('0xc')]);router['get'](_0xfa6b('0xd'),auth['isAuthenticated'](),controller[_0xfa6b('0xe')]);router['get']('/:id/fields',auth[_0xfa6b('0xa')](),controller[_0xfa6b('0xf')]);router[_0xfa6b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xfa6b('0x11')]);router['put']('/:id',auth[_0xfa6b('0xa')](),controller[_0xfa6b('0x12')]);router[_0xfa6b('0x13')](_0xfa6b('0x14'),auth[_0xfa6b('0xa')](),controller[_0xfa6b('0x15')]);module[_0xfa6b('0x16')]=router; \ No newline at end of file +var _0x3bbf=['express','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','delete','destroy','exports','path','connect-timeout'];(function(_0x24fa1a,_0x16d9c2){var _0xc5621f=function(_0x5616ac){while(--_0x5616ac){_0x24fa1a['push'](_0x24fa1a['shift']());}};_0xc5621f(++_0x16d9c2);}(_0x3bbf,0x18a));var _0xf3bb=function(_0x2e9d70,_0xa87320){_0x2e9d70=_0x2e9d70-0x0;var _0xb9c226=_0x3bbf[_0x2e9d70];return _0xb9c226;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf3bb('0x0'));var timeout=require(_0xf3bb('0x1'));var express=require(_0xf3bb('0x2'));var router=express['Router']();var fs_extra=require(_0xf3bb('0x3'));var auth=require(_0xf3bb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf3bb('0x5'));var controller=require(_0xf3bb('0x6'));router[_0xf3bb('0x7')]('/',auth[_0xf3bb('0x8')](),controller[_0xf3bb('0x9')]);router[_0xf3bb('0x7')](_0xf3bb('0xa'),auth['isAuthenticated'](),controller[_0xf3bb('0xb')]);router[_0xf3bb('0x7')](_0xf3bb('0xc'),auth[_0xf3bb('0x8')](),controller[_0xf3bb('0xd')]);router[_0xf3bb('0x7')](_0xf3bb('0xe'),auth['isAuthenticated'](),controller[_0xf3bb('0xf')]);router[_0xf3bb('0x10')]('/',auth['isAuthenticated'](),controller[_0xf3bb('0x11')]);router[_0xf3bb('0x10')]('/:id/configurations',auth[_0xf3bb('0x8')](),controller['addConfiguration']);router['put']('/:id',auth[_0xf3bb('0x8')](),controller[_0xf3bb('0x12')]);router[_0xf3bb('0x13')](_0xf3bb('0xa'),auth[_0xf3bb('0x8')](),controller[_0xf3bb('0x14')]);module[_0xf3bb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 58eac3e..20631e9 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 _0x4b57=['integrationTab','newTab','STRING','ENUM','basic'];(function(_0x19ce7a,_0x2317f7){var _0x57d7b1=function(_0x547bb1){while(--_0x547bb1){_0x19ce7a['push'](_0x19ce7a['shift']());}};_0x57d7b1(++_0x2317f7);}(_0x4b57,0xe3));var _0x74b5=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0x4b57[_0x417baa];return _0x42724f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x74b5('0x0')]},'description':{'type':Sequelize[_0x74b5('0x0')]},'username':{'type':Sequelize[_0x74b5('0x0')]},'remoteUri':{'type':Sequelize[_0x74b5('0x0')]},'authType':{'type':Sequelize[_0x74b5('0x1')](_0x74b5('0x2')),'defaultValue':_0x74b5('0x2')},'password':{'type':Sequelize[_0x74b5('0x0')]},'consumerKey':{'type':Sequelize[_0x74b5('0x0')]},'consumerSecret':{'type':Sequelize[_0x74b5('0x0')]},'token':{'type':Sequelize[_0x74b5('0x0')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x74b5('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x74b5('0x1')](_0x74b5('0x3'),_0x74b5('0x4')),'defaultValue':_0x74b5('0x3')}}; \ No newline at end of file +var _0xd4fc=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x3c7601,_0x5eb803){var _0x254f65=function(_0x1a65ad){while(--_0x1a65ad){_0x3c7601['push'](_0x3c7601['shift']());}};_0x254f65(++_0x5eb803);}(_0xd4fc,0x187));var _0xcd4f=function(_0x245c4b,_0x5666de){_0x245c4b=_0x245c4b-0x0;var _0x43b69f=_0xd4fc[_0x245c4b];return _0x43b69f;};'use strict';var Sequelize=require(_0xcd4f('0x0'));module[_0xcd4f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcd4f('0x2')]},'username':{'type':Sequelize[_0xcd4f('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xcd4f('0x3')](_0xcd4f('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xcd4f('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xcd4f('0x2')]},'token':{'type':Sequelize[_0xcd4f('0x2')]},'tokenSecret':{'type':Sequelize[_0xcd4f('0x2')]},'serverUrl':{'type':Sequelize[_0xcd4f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xcd4f('0x5'),_0xcd4f('0x6')),'defaultValue':_0xcd4f('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 49dd995..38d2918 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 _0x3166=['%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','base64','_embedded','name','label','test','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','limit','undefined','count','offset','set','apply','reject','update','then','destroy','sendStatus','stack','send','DeskAccount','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','length','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3166,0x83));var _0x6316=function(_0x2586aa,_0x4497ec){_0x2586aa=_0x2586aa-0x0;var _0x1f5f12=_0x3166[_0x2586aa];return _0x1f5f12;};'use strict';var emlformat=require(_0x6316('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6316('0x1'));var jsonpatch=require(_0x6316('0x2'));var rp=require(_0x6316('0x3'));var moment=require(_0x6316('0x4'));var BPromise=require(_0x6316('0x5'));var Mustache=require(_0x6316('0x6'));var util=require(_0x6316('0x7'));var path=require(_0x6316('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6316('0x9'));var fs=require('fs');var fs_extra=require(_0x6316('0xa'));var _=require(_0x6316('0xb'));var squel=require(_0x6316('0xc'));var crypto=require(_0x6316('0xd'));var jsforce=require(_0x6316('0xe'));var deskjs=require(_0x6316('0xf'));var toCsv=require(_0x6316('0x10'));var querystring=require(_0x6316('0x11'));var Papa=require(_0x6316('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6316('0x13'));var as=require(_0x6316('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6316('0x15'))('api');var utils=require(_0x6316('0x16'));var config=require(_0x6316('0x17'));var licenseUtil=require(_0x6316('0x18'));var db=require(_0x6316('0x19'))['db'];var integrations=require(_0x6316('0x1a'));function respondWithStatusCode(_0xbab988,_0x5f0888){_0x5f0888=_0x5f0888||0xcc;return function(_0x5482d8){if(_0x5482d8){return _0xbab988['sendStatus'](_0x5f0888);}return _0xbab988['status'](_0x5f0888)[_0x6316('0x1b')]();};}function respondWithResult(_0x3bba2a,_0x3d152d){_0x3d152d=_0x3d152d||0xc8;return function(_0x5d9b7e){if(_0x5d9b7e){return _0x3bba2a[_0x6316('0x1c')](_0x3d152d)[_0x6316('0x1d')](_0x5d9b7e);}};}function respondWithFilteredResult(_0x8cbbb5,_0xcf71ae){return function(_0x1a5982){if(_0x1a5982){var _0x1fb44c=typeof _0xcf71ae['offset']==='undefined'&&typeof _0xcf71ae[_0x6316('0x1e')]===_0x6316('0x1f');var _0x54eb34=_0x1a5982[_0x6316('0x20')];var _0x1e4271=_0x1fb44c?0x0:_0xcf71ae[_0x6316('0x21')];var _0x268642=_0x1fb44c?_0x1a5982[_0x6316('0x20')]:_0xcf71ae[_0x6316('0x21')]+_0xcf71ae[_0x6316('0x1e')];var _0x4c5a38;if(_0x268642>=_0x54eb34){_0x268642=_0x54eb34;_0x4c5a38=0xc8;}else{_0x4c5a38=0xce;}_0x8cbbb5[_0x6316('0x1c')](_0x4c5a38);return _0x8cbbb5[_0x6316('0x22')]('Content-Range',_0x1e4271+'-'+_0x268642+'/'+_0x54eb34)[_0x6316('0x1d')](_0x1a5982);}return null;};}function patchUpdates(_0x84670f){return function(_0x1db0fc){try{jsonpatch[_0x6316('0x23')](_0x1db0fc,_0x84670f,!![]);}catch(_0x267c71){return BPromise[_0x6316('0x24')](_0x267c71);}return _0x1db0fc['save']();};}function saveUpdates(_0x3ac42e,_0xcc16b4){return function(_0x1ced38){if(_0x1ced38){return _0x1ced38[_0x6316('0x25')](_0x3ac42e)[_0x6316('0x26')](function(_0x58f57b){return _0x58f57b;});}return null;};}function removeEntity(_0x377812,_0x5d5536){return function(_0x8b2cba){if(_0x8b2cba){return _0x8b2cba[_0x6316('0x27')]()[_0x6316('0x26')](function(){_0x377812['status'](0xcc)[_0x6316('0x1b')]();});}};}function handleEntityNotFound(_0x85aa70,_0x2062f7){return function(_0x5a37f8){if(!_0x5a37f8){_0x85aa70[_0x6316('0x28')](0x194);}return _0x5a37f8;};}function handleError(_0x1b7945,_0x597c0a){_0x597c0a=_0x597c0a||0x1f4;return function(_0xdc8644){logger['error'](_0xdc8644[_0x6316('0x29')]);if(_0xdc8644['name']){delete _0xdc8644['name'];}_0x1b7945[_0x6316('0x1c')](_0x597c0a)[_0x6316('0x2a')](_0xdc8644);};}exports['index']=function(_0xa8292e,_0x25cf1c){var _0x3cde35={},_0x4bb8e4={},_0x2d5f4f={'count':0x0,'rows':[]};var _0x56a537=_['map'](db[_0x6316('0x2b')][_0x6316('0x2c')],function(_0x57a56e){return{'name':_0x57a56e['fieldName'],'type':_0x57a56e[_0x6316('0x2d')]['key']};});_0x4bb8e4[_0x6316('0x2e')]=_[_0x6316('0x2f')](_0x56a537,'name');_0x4bb8e4[_0x6316('0x30')]=_[_0x6316('0x31')](_0xa8292e['query']);_0x4bb8e4['filters']=_[_0x6316('0x32')](_0x4bb8e4[_0x6316('0x2e')],_0x4bb8e4[_0x6316('0x30')]);_0x3cde35[_0x6316('0x33')]=_[_0x6316('0x32')](_0x4bb8e4[_0x6316('0x2e')],qs[_0x6316('0x34')](_0xa8292e[_0x6316('0x30')][_0x6316('0x34')]));_0x3cde35['attributes']=_0x3cde35[_0x6316('0x33')]['length']?_0x3cde35['attributes']:_0x4bb8e4[_0x6316('0x2e')];if(!_0xa8292e[_0x6316('0x30')][_0x6316('0x35')](_0x6316('0x36'))){_0x3cde35[_0x6316('0x1e')]=qs[_0x6316('0x1e')](_0xa8292e[_0x6316('0x30')][_0x6316('0x1e')]);_0x3cde35[_0x6316('0x21')]=qs[_0x6316('0x21')](_0xa8292e['query'][_0x6316('0x21')]);}_0x3cde35['order']=qs[_0x6316('0x37')](_0xa8292e[_0x6316('0x30')][_0x6316('0x37')]);_0x3cde35['where']=qs[_0x6316('0x38')](_[_0x6316('0x39')](_0xa8292e[_0x6316('0x30')],_0x4bb8e4['filters']),_0x56a537);if(_0xa8292e['query'][_0x6316('0x3a')]){_0x3cde35[_0x6316('0x3b')]=_[_0x6316('0x3c')](_0x3cde35[_0x6316('0x3b')],{'$or':_['map'](_0x56a537,function(_0xdf9eae){if(_0xdf9eae[_0x6316('0x2d')]!==_0x6316('0x3d')){var _0x28b45d={};_0x28b45d[_0xdf9eae['name']]={'$like':'%'+_0xa8292e['query']['filter']+'%'};return _0x28b45d;}})});}_0x3cde35=_['merge']({},_0x3cde35,_0xa8292e[_0x6316('0x3e')]);var _0x164dfd={'where':_0x3cde35['where']};return db[_0x6316('0x2b')][_0x6316('0x20')](_0x164dfd)[_0x6316('0x26')](function(_0x460ece){_0x2d5f4f['count']=_0x460ece;if(_0xa8292e[_0x6316('0x30')][_0x6316('0x3f')]){_0x3cde35[_0x6316('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0x6316('0x41')](_0x3cde35);})[_0x6316('0x26')](function(_0x369584){_0x2d5f4f['rows']=_0x369584;return _0x2d5f4f;})[_0x6316('0x26')](respondWithFilteredResult(_0x25cf1c,_0x3cde35))[_0x6316('0x42')](handleError(_0x25cf1c,null));};exports[_0x6316('0x43')]=function(_0x28bf84,_0xe7efac){var _0x5c0f8c={'raw':![],'where':{'id':_0x28bf84[_0x6316('0x44')]['id']}},_0xa4a7b1={};_0xa4a7b1[_0x6316('0x2e')]=_[_0x6316('0x31')](db[_0x6316('0x2b')][_0x6316('0x2c')]);_0xa4a7b1['query']=_[_0x6316('0x31')](_0x28bf84[_0x6316('0x30')]);_0xa4a7b1[_0x6316('0x38')]=_[_0x6316('0x32')](_0xa4a7b1[_0x6316('0x2e')],_0xa4a7b1[_0x6316('0x30')]);_0x5c0f8c[_0x6316('0x33')]=_['intersection'](_0xa4a7b1['model'],qs[_0x6316('0x34')](_0x28bf84['query']['fields']));_0x5c0f8c[_0x6316('0x33')]=_0x5c0f8c[_0x6316('0x33')]['length']?_0x5c0f8c[_0x6316('0x33')]:_0xa4a7b1[_0x6316('0x2e')];if(_0x28bf84['query'][_0x6316('0x3f')]){_0x5c0f8c[_0x6316('0x40')]=[{'all':!![]}];}_0x5c0f8c=_[_0x6316('0x3c')]({},_0x5c0f8c,_0x28bf84[_0x6316('0x3e')]);return db[_0x6316('0x2b')][_0x6316('0x45')](_0x5c0f8c)['then'](handleEntityNotFound(_0xe7efac,null))[_0x6316('0x26')](respondWithResult(_0xe7efac,null))[_0x6316('0x42')](handleError(_0xe7efac,null));};exports[_0x6316('0x46')]=function(_0x12f77b,_0x4359fe){return db[_0x6316('0x2b')][_0x6316('0x46')](_0x12f77b[_0x6316('0x47')],{})[_0x6316('0x26')](respondWithResult(_0x4359fe,0xc9))[_0x6316('0x42')](handleError(_0x4359fe,null));};exports['update']=function(_0x2e9a5d,_0x1ae155){if(_0x2e9a5d[_0x6316('0x47')]['id']){delete _0x2e9a5d[_0x6316('0x47')]['id'];}return db[_0x6316('0x2b')][_0x6316('0x45')]({'where':{'id':_0x2e9a5d[_0x6316('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ae155,null))[_0x6316('0x26')](saveUpdates(_0x2e9a5d[_0x6316('0x47')],null))[_0x6316('0x26')](respondWithResult(_0x1ae155,null))[_0x6316('0x42')](handleError(_0x1ae155,null));};exports['destroy']=function(_0x181fc8,_0x5b95c2){return db['DeskAccount']['find']({'where':{'id':_0x181fc8[_0x6316('0x44')]['id']}})[_0x6316('0x26')](handleEntityNotFound(_0x5b95c2,null))['then'](removeEntity(_0x5b95c2,null))[_0x6316('0x42')](handleError(_0x5b95c2,null));};exports[_0x6316('0x48')]=function(_0x73aaef,_0x55f487,_0x58aa2d){var _0x3c244f={};var _0x4cc370={};var _0x3d0f44;var _0x47775e;return db[_0x6316('0x2b')]['findOne']({'where':{'id':_0x73aaef[_0x6316('0x44')]['id']}})[_0x6316('0x26')](handleEntityNotFound(_0x55f487,null))[_0x6316('0x26')](function(_0xac8cbc){if(_0xac8cbc){_0x3d0f44=_0xac8cbc;_0x4cc370[_0x6316('0x2e')]=_[_0x6316('0x31')](db['DeskConfiguration'][_0x6316('0x2c')]);_0x4cc370[_0x6316('0x30')]=_[_0x6316('0x31')](_0x73aaef[_0x6316('0x30')]);_0x4cc370['filters']=_[_0x6316('0x32')](_0x4cc370[_0x6316('0x2e')],_0x4cc370[_0x6316('0x30')]);_0x3c244f['attributes']=_['intersection'](_0x4cc370[_0x6316('0x2e')],qs[_0x6316('0x34')](_0x73aaef[_0x6316('0x30')][_0x6316('0x34')]));_0x3c244f['attributes']=_0x3c244f[_0x6316('0x33')][_0x6316('0x49')]?_0x3c244f[_0x6316('0x33')]:_0x4cc370[_0x6316('0x2e')];_0x3c244f['order']=qs[_0x6316('0x37')](_0x73aaef[_0x6316('0x30')]['sort']);_0x3c244f[_0x6316('0x3b')]=qs[_0x6316('0x38')](_[_0x6316('0x39')](_0x73aaef['query'],_0x4cc370['filters']));if(_0x73aaef['query'][_0x6316('0x3a')]){_0x3c244f[_0x6316('0x3b')]=_[_0x6316('0x3c')](_0x3c244f[_0x6316('0x3b')],{'$or':_[_0x6316('0x2f')](_0x3c244f[_0x6316('0x33')],function(_0x15491c){var _0x164eea={};_0x164eea[_0x15491c]={'$like':'%'+_0x73aaef['query'][_0x6316('0x3a')]+'%'};return _0x164eea;})});}_0x3c244f=_[_0x6316('0x3c')]({},_0x3c244f,_0x73aaef[_0x6316('0x3e')]);return _0x3d0f44[_0x6316('0x48')](_0x3c244f);}})[_0x6316('0x26')](function(_0x4196eb){if(_0x4196eb){_0x47775e=_0x4196eb[_0x6316('0x49')];if(!_0x73aaef[_0x6316('0x30')]['hasOwnProperty']('nolimit')){_0x3c244f[_0x6316('0x1e')]=qs[_0x6316('0x1e')](_0x73aaef[_0x6316('0x30')][_0x6316('0x1e')]);_0x3c244f['offset']=qs[_0x6316('0x21')](_0x73aaef[_0x6316('0x30')][_0x6316('0x21')]);}return _0x3d0f44[_0x6316('0x48')](_0x3c244f);}})[_0x6316('0x26')](function(_0x3ee650){if(_0x3ee650){return _0x3ee650?{'count':_0x47775e,'rows':_0x3ee650}:null;}})['then'](respondWithResult(_0x55f487,null))[_0x6316('0x42')](handleError(_0x55f487,null));};exports[_0x6316('0x4a')]=function(_0xc9c0e9,_0x1b3dcb,_0x491d51){if(_0xc9c0e9[_0x6316('0x47')]['id']){delete _0xc9c0e9[_0x6316('0x47')]['id'];}return db['DeskAccount'][_0x6316('0x4b')]({'where':{'id':_0xc9c0e9[_0x6316('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b3dcb,null))[_0x6316('0x26')](function(_0x762f08){if(_0x762f08){_0xc9c0e9[_0x6316('0x47')][_0x6316('0x4c')]=_0x762f08['id'];_0xc9c0e9[_0x6316('0x47')][_0x6316('0x4d')]=integrations[_0x6316('0x4e')](_0xc9c0e9[_0x6316('0x47')]['channel'],_0xc9c0e9[_0x6316('0x47')][_0x6316('0x2d')]);_0xc9c0e9['body'][_0x6316('0x4f')]=integrations[_0x6316('0x50')](_0xc9c0e9['body'][_0x6316('0x51')],_0xc9c0e9[_0x6316('0x47')][_0x6316('0x2d')]);return db[_0x6316('0x52')]['create'](_0xc9c0e9[_0x6316('0x47')],{'include':[{'model':db['DeskField'],'as':_0x6316('0x4d')},{'model':db[_0x6316('0x53')],'as':_0x6316('0x4f')}]});}return null;})[_0x6316('0x26')](respondWithResult(_0x1b3dcb,null))[_0x6316('0x42')](handleError(_0x1b3dcb,null));};exports[_0x6316('0x54')]=function(_0x285ebb,_0x1bd3e2,_0x3be9e0){var _0x1d554c=[{'name':'priority','label':_0x6316('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0xa0d558='';return db[_0x6316('0x2b')][_0x6316('0x4b')]({'where':{'id':_0x285ebb[_0x6316('0x44')]['id']},'attributes':['id',_0x6316('0x56'),_0x6316('0x57'),_0x6316('0x58'),_0x6316('0x59'),_0x6316('0x5a'),_0x6316('0x5b'),_0x6316('0x5c'),_0x6316('0x5d')]})[_0x6316('0x26')](handleEntityNotFound(_0x1bd3e2,null))[_0x6316('0x26')](function(_0x2ce155){if(_0x2ce155){_0xa0d558=_0x2ce155[_0x6316('0x56')];var _0x3d7ca=_0xa0d558[_0x6316('0x5e')](-0x1);if(_0x3d7ca==='/'){_0xa0d558=_0xa0d558[_0x6316('0x5f')](0x0,_0xa0d558[_0x6316('0x60')](_0x3d7ca));}var _0x644d76={'method':_0x6316('0x61'),'uri':util[_0x6316('0x62')](_0x6316('0x63'),_0xa0d558),'headers':{'Content-Type':'application/json','Accept':_0x6316('0x64')},'json':!![]};if(_0x2ce155['authType']===_0x6316('0x65')){_0x644d76[_0x6316('0x66')][_0x6316('0x67')]=util[_0x6316('0x62')](_0x6316('0x68'),new Buffer(util['format'](_0x6316('0x69'),_0x2ce155[_0x6316('0x58')],_0x2ce155[_0x6316('0x59')]))['toString'](_0x6316('0x6a')));}return rp(_0x644d76)[_0x6316('0x26')](function(_0x11e792){return _0x1d554c['concat'](_[_0x6316('0x2f')](_0x11e792[_0x6316('0x6b')]['entries'],function(_0x57292b){return{'id':_0x57292b['name'],'name':_0x57292b[_0x6316('0x6c')],'type':_0x57292b[_0x6316('0x2d')],'active':_0x57292b['active'],'label':_0x57292b[_0x6316('0x6d')],'custom':!![]};}));});}})[_0x6316('0x26')](function(_0xeec0a9){return{'count':_0xeec0a9[_0x6316('0x49')],'rows':_0xeec0a9};})[_0x6316('0x26')](respondWithResult(_0x1bd3e2,null))[_0x6316('0x42')](function(_0x251558){var _0x36a8b0=_0x285ebb['query'][_0x6316('0x6e')]?0x1f4:_0x251558['statusCode']||0x1f4;logger[_0x6316('0x6f')](_0x6316('0x70'),'getFields',_0x36a8b0,JSON['stringify'](_0x251558));delete _0x251558[_0x6316('0x6c')];if(_0x36a8b0===0x191){_0x36a8b0=0x190;}_0x1bd3e2['status'](_0x36a8b0)[_0x6316('0x2a')](_0x285ebb[_0x6316('0x30')][_0x6316('0x6e')]?{'message':_0x6316('0x71'),'statusCode':_0x251558[_0x6316('0x72')]}:_0x251558);});}; \ No newline at end of file +var _0x347c=['fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','count','include','rows','catch','show','params','includeAll','DeskAccount','find','create','body','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','DeskField','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','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/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x583633,_0x555633){var _0x472684=function(_0x2ce756){while(--_0x2ce756){_0x583633['push'](_0x583633['shift']());}};_0x472684(++_0x555633);}(_0x347c,0x1a3));var _0xc347=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x347c[_0x3d42d8];return _0x27fc41;};'use strict';var emlformat=require(_0xc347('0x0'));var rimraf=require(_0xc347('0x1'));var zipdir=require(_0xc347('0x2'));var jsonpatch=require(_0xc347('0x3'));var rp=require(_0xc347('0x4'));var moment=require('moment');var BPromise=require(_0xc347('0x5'));var Mustache=require(_0xc347('0x6'));var util=require(_0xc347('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc347('0x8'));var ejs=require(_0xc347('0x9'));var fs=require('fs');var fs_extra=require(_0xc347('0xa'));var _=require(_0xc347('0xb'));var squel=require(_0xc347('0xc'));var crypto=require(_0xc347('0xd'));var jsforce=require(_0xc347('0xe'));var deskjs=require(_0xc347('0xf'));var toCsv=require(_0xc347('0x8'));var querystring=require('querystring');var Papa=require(_0xc347('0x10'));var Redis=require(_0xc347('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc347('0x12'));var as=require(_0xc347('0x13'));var hardwareService=require(_0xc347('0x14'));var logger=require(_0xc347('0x15'))(_0xc347('0x16'));var utils=require(_0xc347('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc347('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc347('0x19'));function respondWithStatusCode(_0x14a35b,_0x214d19){_0x214d19=_0x214d19||0xcc;return function(_0x1b900f){if(_0x1b900f){return _0x14a35b[_0xc347('0x1a')](_0x214d19);}return _0x14a35b[_0xc347('0x1b')](_0x214d19)[_0xc347('0x1c')]();};}function respondWithResult(_0x43b419,_0x1962d3){_0x1962d3=_0x1962d3||0xc8;return function(_0x4e9cab){if(_0x4e9cab){return _0x43b419[_0xc347('0x1b')](_0x1962d3)[_0xc347('0x1d')](_0x4e9cab);}};}function respondWithFilteredResult(_0x39d709,_0x4b63e9){return function(_0x4ed013){if(_0x4ed013){var _0x506937=typeof _0x4b63e9['offset']==='undefined'&&typeof _0x4b63e9[_0xc347('0x1e')]==='undefined';var _0x5ccccc=_0x4ed013['count'];var _0x2e1074=_0x506937?0x0:_0x4b63e9[_0xc347('0x1f')];var _0x2c7f44=_0x506937?_0x4ed013['count']:_0x4b63e9[_0xc347('0x1f')]+_0x4b63e9[_0xc347('0x1e')];var _0x3f9275;if(_0x2c7f44>=_0x5ccccc){_0x2c7f44=_0x5ccccc;_0x3f9275=0xc8;}else{_0x3f9275=0xce;}_0x39d709[_0xc347('0x1b')](_0x3f9275);return _0x39d709[_0xc347('0x20')](_0xc347('0x21'),_0x2e1074+'-'+_0x2c7f44+'/'+_0x5ccccc)[_0xc347('0x1d')](_0x4ed013);}return null;};}function patchUpdates(_0x452268){return function(_0x38520f){try{jsonpatch['apply'](_0x38520f,_0x452268,!![]);}catch(_0x4835e7){return BPromise[_0xc347('0x22')](_0x4835e7);}return _0x38520f[_0xc347('0x23')]();};}function saveUpdates(_0x1fef41,_0x4fb89b){return function(_0x41a7fb){if(_0x41a7fb){return _0x41a7fb[_0xc347('0x24')](_0x1fef41)[_0xc347('0x25')](function(_0x3b4450){return _0x3b4450;});}return null;};}function removeEntity(_0x2f3427,_0x666987){return function(_0x49735a){if(_0x49735a){return _0x49735a[_0xc347('0x26')]()[_0xc347('0x25')](function(){_0x2f3427[_0xc347('0x1b')](0xcc)[_0xc347('0x1c')]();});}};}function handleEntityNotFound(_0x18377d,_0x3d1610){return function(_0x1ae241){if(!_0x1ae241){_0x18377d[_0xc347('0x1a')](0x194);}return _0x1ae241;};}function handleError(_0xd03810,_0x5e1b0f){_0x5e1b0f=_0x5e1b0f||0x1f4;return function(_0x56c4c9){logger['error'](_0x56c4c9[_0xc347('0x27')]);if(_0x56c4c9[_0xc347('0x28')]){delete _0x56c4c9[_0xc347('0x28')];}_0xd03810['status'](_0x5e1b0f)[_0xc347('0x29')](_0x56c4c9);};}exports[_0xc347('0x2a')]=function(_0x494a62,_0x38da43){var _0x5b8f6b={},_0xb524fd={},_0x35a01a={'count':0x0,'rows':[]};var _0x1ae317=_[_0xc347('0x2b')](db['DeskAccount'][_0xc347('0x2c')],function(_0x1be0b9){return{'name':_0x1be0b9[_0xc347('0x2d')],'type':_0x1be0b9[_0xc347('0x2e')][_0xc347('0x2f')]};});_0xb524fd[_0xc347('0x30')]=_['map'](_0x1ae317,_0xc347('0x28'));_0xb524fd[_0xc347('0x31')]=_[_0xc347('0x32')](_0x494a62[_0xc347('0x31')]);_0xb524fd[_0xc347('0x33')]=_['intersection'](_0xb524fd['model'],_0xb524fd['query']);_0x5b8f6b['attributes']=_[_0xc347('0x34')](_0xb524fd[_0xc347('0x30')],qs[_0xc347('0x35')](_0x494a62[_0xc347('0x31')]['fields']));_0x5b8f6b[_0xc347('0x36')]=_0x5b8f6b[_0xc347('0x36')][_0xc347('0x37')]?_0x5b8f6b[_0xc347('0x36')]:_0xb524fd[_0xc347('0x30')];if(!_0x494a62[_0xc347('0x31')]['hasOwnProperty'](_0xc347('0x38'))){_0x5b8f6b['limit']=qs['limit'](_0x494a62[_0xc347('0x31')]['limit']);_0x5b8f6b[_0xc347('0x1f')]=qs[_0xc347('0x1f')](_0x494a62['query'][_0xc347('0x1f')]);}_0x5b8f6b[_0xc347('0x39')]=qs[_0xc347('0x3a')](_0x494a62[_0xc347('0x31')]['sort']);_0x5b8f6b[_0xc347('0x3b')]=qs[_0xc347('0x33')](_[_0xc347('0x3c')](_0x494a62[_0xc347('0x31')],_0xb524fd[_0xc347('0x33')]),_0x1ae317);if(_0x494a62['query'][_0xc347('0x3d')]){_0x5b8f6b[_0xc347('0x3b')]=_[_0xc347('0x3e')](_0x5b8f6b[_0xc347('0x3b')],{'$or':_[_0xc347('0x2b')](_0x1ae317,function(_0x1d6c66){if(_0x1d6c66[_0xc347('0x2e')]!=='VIRTUAL'){var _0xc20b00={};_0xc20b00[_0x1d6c66[_0xc347('0x28')]]={'$like':'%'+_0x494a62[_0xc347('0x31')][_0xc347('0x3d')]+'%'};return _0xc20b00;}})});}_0x5b8f6b=_[_0xc347('0x3e')]({},_0x5b8f6b,_0x494a62[_0xc347('0x3f')]);var _0x4d9411={'where':_0x5b8f6b['where']};return db['DeskAccount']['count'](_0x4d9411)['then'](function(_0x118860){_0x35a01a[_0xc347('0x40')]=_0x118860;if(_0x494a62[_0xc347('0x31')]['includeAll']){_0x5b8f6b[_0xc347('0x41')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x5b8f6b);})['then'](function(_0x24951e){_0x35a01a[_0xc347('0x42')]=_0x24951e;return _0x35a01a;})[_0xc347('0x25')](respondWithFilteredResult(_0x38da43,_0x5b8f6b))[_0xc347('0x43')](handleError(_0x38da43,null));};exports[_0xc347('0x44')]=function(_0x171e3d,_0x882a6a){var _0x4ff3e6={'raw':![],'where':{'id':_0x171e3d[_0xc347('0x45')]['id']}},_0x4199f4={};_0x4199f4['model']=_[_0xc347('0x32')](db['DeskAccount'][_0xc347('0x2c')]);_0x4199f4[_0xc347('0x31')]=_[_0xc347('0x32')](_0x171e3d[_0xc347('0x31')]);_0x4199f4[_0xc347('0x33')]=_[_0xc347('0x34')](_0x4199f4[_0xc347('0x30')],_0x4199f4[_0xc347('0x31')]);_0x4ff3e6['attributes']=_[_0xc347('0x34')](_0x4199f4[_0xc347('0x30')],qs[_0xc347('0x35')](_0x171e3d[_0xc347('0x31')][_0xc347('0x35')]));_0x4ff3e6[_0xc347('0x36')]=_0x4ff3e6[_0xc347('0x36')][_0xc347('0x37')]?_0x4ff3e6[_0xc347('0x36')]:_0x4199f4['model'];if(_0x171e3d[_0xc347('0x31')][_0xc347('0x46')]){_0x4ff3e6[_0xc347('0x41')]=[{'all':!![]}];}_0x4ff3e6=_['merge']({},_0x4ff3e6,_0x171e3d[_0xc347('0x3f')]);return db[_0xc347('0x47')][_0xc347('0x48')](_0x4ff3e6)[_0xc347('0x25')](handleEntityNotFound(_0x882a6a,null))[_0xc347('0x25')](respondWithResult(_0x882a6a,null))[_0xc347('0x43')](handleError(_0x882a6a,null));};exports['create']=function(_0x1d3941,_0x31fdcf){return db[_0xc347('0x47')][_0xc347('0x49')](_0x1d3941[_0xc347('0x4a')],{})['then'](respondWithResult(_0x31fdcf,0xc9))['catch'](handleError(_0x31fdcf,null));};exports[_0xc347('0x24')]=function(_0x4c053a,_0x512699){if(_0x4c053a[_0xc347('0x4a')]['id']){delete _0x4c053a[_0xc347('0x4a')]['id'];}return db[_0xc347('0x47')][_0xc347('0x48')]({'where':{'id':_0x4c053a['params']['id']}})[_0xc347('0x25')](handleEntityNotFound(_0x512699,null))[_0xc347('0x25')](saveUpdates(_0x4c053a['body'],null))[_0xc347('0x25')](respondWithResult(_0x512699,null))[_0xc347('0x43')](handleError(_0x512699,null));};exports[_0xc347('0x26')]=function(_0x1de29f,_0x25992e){return db[_0xc347('0x47')][_0xc347('0x48')]({'where':{'id':_0x1de29f[_0xc347('0x45')]['id']}})[_0xc347('0x25')](handleEntityNotFound(_0x25992e,null))[_0xc347('0x25')](removeEntity(_0x25992e,null))[_0xc347('0x43')](handleError(_0x25992e,null));};exports[_0xc347('0x4b')]=function(_0x5c698e,_0x3d4c5d,_0x49b30a){var _0x35d710={};var _0xf62c48={};var _0x299eb2;var _0x316ef8;return db[_0xc347('0x47')]['findOne']({'where':{'id':_0x5c698e[_0xc347('0x45')]['id']}})[_0xc347('0x25')](handleEntityNotFound(_0x3d4c5d,null))[_0xc347('0x25')](function(_0x739bd4){if(_0x739bd4){_0x299eb2=_0x739bd4;_0xf62c48[_0xc347('0x30')]=_[_0xc347('0x32')](db['DeskConfiguration'][_0xc347('0x2c')]);_0xf62c48[_0xc347('0x31')]=_[_0xc347('0x32')](_0x5c698e[_0xc347('0x31')]);_0xf62c48['filters']=_[_0xc347('0x34')](_0xf62c48[_0xc347('0x30')],_0xf62c48[_0xc347('0x31')]);_0x35d710[_0xc347('0x36')]=_[_0xc347('0x34')](_0xf62c48[_0xc347('0x30')],qs['fields'](_0x5c698e[_0xc347('0x31')][_0xc347('0x35')]));_0x35d710[_0xc347('0x36')]=_0x35d710[_0xc347('0x36')]['length']?_0x35d710['attributes']:_0xf62c48[_0xc347('0x30')];_0x35d710[_0xc347('0x39')]=qs[_0xc347('0x3a')](_0x5c698e[_0xc347('0x31')][_0xc347('0x3a')]);_0x35d710['where']=qs[_0xc347('0x33')](_['pick'](_0x5c698e[_0xc347('0x31')],_0xf62c48[_0xc347('0x33')]));if(_0x5c698e[_0xc347('0x31')][_0xc347('0x3d')]){_0x35d710[_0xc347('0x3b')]=_[_0xc347('0x3e')](_0x35d710[_0xc347('0x3b')],{'$or':_[_0xc347('0x2b')](_0x35d710[_0xc347('0x36')],function(_0x3e0cac){var _0x114b2d={};_0x114b2d[_0x3e0cac]={'$like':'%'+_0x5c698e[_0xc347('0x31')][_0xc347('0x3d')]+'%'};return _0x114b2d;})});}_0x35d710=_[_0xc347('0x3e')]({},_0x35d710,_0x5c698e[_0xc347('0x3f')]);return _0x299eb2[_0xc347('0x4b')](_0x35d710);}})['then'](function(_0xab1294){if(_0xab1294){_0x316ef8=_0xab1294[_0xc347('0x37')];if(!_0x5c698e[_0xc347('0x31')][_0xc347('0x4c')](_0xc347('0x38'))){_0x35d710[_0xc347('0x1e')]=qs[_0xc347('0x1e')](_0x5c698e[_0xc347('0x31')][_0xc347('0x1e')]);_0x35d710[_0xc347('0x1f')]=qs[_0xc347('0x1f')](_0x5c698e['query'][_0xc347('0x1f')]);}return _0x299eb2[_0xc347('0x4b')](_0x35d710);}})['then'](function(_0x3c7da6){if(_0x3c7da6){return _0x3c7da6?{'count':_0x316ef8,'rows':_0x3c7da6}:null;}})['then'](respondWithResult(_0x3d4c5d,null))['catch'](handleError(_0x3d4c5d,null));};exports[_0xc347('0x4d')]=function(_0x3494a8,_0x53d947,_0x14cf4c){if(_0x3494a8['body']['id']){delete _0x3494a8[_0xc347('0x4a')]['id'];}return db[_0xc347('0x47')][_0xc347('0x4e')]({'where':{'id':_0x3494a8['params']['id']}})[_0xc347('0x25')](handleEntityNotFound(_0x53d947,null))[_0xc347('0x25')](function(_0x170198){if(_0x170198){_0x3494a8[_0xc347('0x4a')][_0xc347('0x4f')]=_0x170198['id'];_0x3494a8['body']['Subjects']=integrations[_0xc347('0x50')](_0x3494a8['body'][_0xc347('0x51')],_0x3494a8[_0xc347('0x4a')][_0xc347('0x2e')]);_0x3494a8[_0xc347('0x4a')][_0xc347('0x52')]=integrations[_0xc347('0x53')](_0x3494a8[_0xc347('0x4a')][_0xc347('0x51')],_0x3494a8[_0xc347('0x4a')]['type']);return db['DeskConfiguration'][_0xc347('0x49')](_0x3494a8[_0xc347('0x4a')],{'include':[{'model':db['DeskField'],'as':_0xc347('0x54')},{'model':db[_0xc347('0x55')],'as':_0xc347('0x52')}]});}return null;})['then'](respondWithResult(_0x53d947,null))[_0xc347('0x43')](handleError(_0x53d947,null));};exports['getFields']=function(_0x546ff3,_0x58115b,_0x1f0f10){var _0x306c01=[{'name':_0xc347('0x56'),'label':_0xc347('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 _0x1c8228='';return db[_0xc347('0x47')][_0xc347('0x4e')]({'where':{'id':_0x546ff3['params']['id']},'attributes':['id',_0xc347('0x57'),_0xc347('0x58'),_0xc347('0x59'),_0xc347('0x5a'),_0xc347('0x5b'),'consumerSecret',_0xc347('0x5c'),_0xc347('0x5d')]})[_0xc347('0x25')](handleEntityNotFound(_0x58115b,null))['then'](function(_0x5a9b93){if(_0x5a9b93){_0x1c8228=_0x5a9b93[_0xc347('0x57')];var _0x4e0060=_0x1c8228[_0xc347('0x5e')](-0x1);if(_0x4e0060==='/'){_0x1c8228=_0x1c8228[_0xc347('0x5f')](0x0,_0x1c8228['lastIndexOf'](_0x4e0060));}var _0xb9fb3d={'method':_0xc347('0x60'),'uri':util[_0xc347('0x61')](_0xc347('0x62'),_0x1c8228),'headers':{'Content-Type':_0xc347('0x63'),'Accept':_0xc347('0x63')},'json':!![]};if(_0x5a9b93['authType']==='basic'){_0xb9fb3d[_0xc347('0x64')][_0xc347('0x65')]=util[_0xc347('0x61')](_0xc347('0x66'),new Buffer(util[_0xc347('0x61')](_0xc347('0x67'),_0x5a9b93[_0xc347('0x59')],_0x5a9b93['password']))[_0xc347('0x68')](_0xc347('0x69')));}return rp(_0xb9fb3d)[_0xc347('0x25')](function(_0x3cc580){return _0x306c01[_0xc347('0x6a')](_[_0xc347('0x2b')](_0x3cc580[_0xc347('0x6b')][_0xc347('0x6c')],function(_0x1ecf56){return{'id':_0x1ecf56['name'],'name':_0x1ecf56[_0xc347('0x28')],'type':_0x1ecf56['type'],'active':_0x1ecf56[_0xc347('0x6d')],'label':_0x1ecf56[_0xc347('0x6e')],'custom':!![]};}));});}})[_0xc347('0x25')](function(_0x25430b){return{'count':_0x25430b['length'],'rows':_0x25430b};})[_0xc347('0x25')](respondWithResult(_0x58115b,null))[_0xc347('0x43')](function(_0x5e188c){var _0x122bdf=_0x546ff3[_0xc347('0x31')][_0xc347('0x6f')]?0x1f4:_0x5e188c[_0xc347('0x70')]||0x1f4;logger[_0xc347('0x71')](_0xc347('0x72'),_0xc347('0x73'),_0x122bdf,JSON[_0xc347('0x74')](_0x5e188c));delete _0x5e188c[_0xc347('0x28')];if(_0x122bdf===0x191){_0x122bdf=0x190;}_0x58115b[_0xc347('0x1b')](_0x122bdf)[_0xc347('0x29')](_0x546ff3[_0xc347('0x31')]['test']?{'message':_0xc347('0x75'),'statusCode':_0x5e188c['statusCode']}:_0x5e188c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3c14b9c..125e2bb 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 _0x5b82=['moment','bluebird','request-promise','path','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api'];(function(_0x5b8064,_0x18e7e2){var _0x111d62=function(_0x1a921c){while(--_0x1a921c){_0x5b8064['push'](_0x5b8064['shift']());}};_0x111d62(++_0x18e7e2);}(_0x5b82,0x7e));var _0x25b8=function(_0x42a09d,_0x372157){_0x42a09d=_0x42a09d-0x0;var _0x258d25=_0x5b82[_0x42a09d];return _0x258d25;};'use strict';var _=require(_0x25b8('0x0'));var util=require(_0x25b8('0x1'));var logger=require(_0x25b8('0x2'))(_0x25b8('0x3'));var moment=require(_0x25b8('0x4'));var BPromise=require(_0x25b8('0x5'));var rp=require(_0x25b8('0x6'));var fs=require('fs');var path=require(_0x25b8('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x25b8('0x8'));var integrations=require(_0x25b8('0x9'));module['exports']=function(_0x4504e3,_0x162b4c){return _0x4504e3[_0x25b8('0xa')](_0x25b8('0xb'),attributes,{'tableName':_0x25b8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9342=['path','rimraf','../../config/environment','define','DeskAccount','lodash','util','api','request-promise'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x9342,0x1e2));var _0x2934=function(_0x12fbb9,_0x4b565f){_0x12fbb9=_0x12fbb9-0x0;var _0x2ca246=_0x9342[_0x12fbb9];return _0x2ca246;};'use strict';var _=require(_0x2934('0x0'));var util=require(_0x2934('0x1'));var logger=require('../../config/logger')(_0x2934('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2934('0x3'));var fs=require('fs');var path=require(_0x2934('0x4'));var rimraf=require(_0x2934('0x5'));var config=require(_0x2934('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x496b6c,_0x2dab52){return _0x496b6c[_0x2934('0x7')](_0x2934('0x8'),attributes,{'tableName':'int_desk_accounts','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 5da28de..0287efb 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 _0xac08=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','map','include','model','debug','raw','ShowDeskAccount','lodash','moment'];(function(_0xbfb0f4,_0x1f2de4){var _0x1b9ac2=function(_0x59c316){while(--_0x59c316){_0xbfb0f4['push'](_0xbfb0f4['shift']());}};_0x1b9ac2(++_0x1f2de4);}(_0xac08,0x196));var _0x8ac0=function(_0x4fa308,_0x109e7f){_0x4fa308=_0x4fa308-0x0;var _0x538831=_0xac08[_0x4fa308];return _0x538831;};'use strict';var _=require(_0x8ac0('0x0'));var util=require('util');var moment=require(_0x8ac0('0x1'));var BPromise=require('bluebird');var rs=require(_0x8ac0('0x2'));var fs=require('fs');var Redis=require(_0x8ac0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ac0('0x4'));var logger=require(_0x8ac0('0x5'))(_0x8ac0('0x6'));var config=require(_0x8ac0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8ac0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xebd7ec,_0x512656,_0x68e269){return new BPromise(function(_0x130ff2,_0x4b06bc){return client[_0x8ac0('0x9')](_0xebd7ec,_0x68e269)[_0x8ac0('0xa')](function(_0x45603d){logger[_0x8ac0('0xb')](_0x8ac0('0xc'),_0x512656,_0x8ac0('0xd'));logger['debug'](_0x8ac0('0xe'),_0x512656,'request\x20sent',JSON[_0x8ac0('0xf')](_0x45603d));if(_0x45603d[_0x8ac0('0x10')]){if(_0x45603d[_0x8ac0('0x10')][_0x8ac0('0x11')]===0x1f4){logger[_0x8ac0('0x10')](_0x8ac0('0xc'),_0x512656,_0x45603d[_0x8ac0('0x10')]['message']);return _0x4b06bc(_0x45603d[_0x8ac0('0x10')][_0x8ac0('0x12')]);}logger[_0x8ac0('0x10')](_0x8ac0('0xc'),_0x512656,_0x45603d[_0x8ac0('0x10')][_0x8ac0('0x12')]);return _0x130ff2(_0x45603d[_0x8ac0('0x10')]['message']);}else{logger[_0x8ac0('0xb')]('DeskAccount,\x20%s,\x20%s',_0x512656,_0x8ac0('0xd'));_0x130ff2(_0x45603d[_0x8ac0('0x13')][_0x8ac0('0x12')]);}})[_0x8ac0('0x14')](function(_0x4e020e){logger[_0x8ac0('0x10')](_0x8ac0('0xc'),_0x512656,_0x4e020e);_0x4b06bc(_0x4e020e);});});}exports[_0x8ac0('0x15')]=function(_0x21dc02){var _0xf762b7=this;return new Promise(function(_0x1bce2c,_0x3e02e9){return db[_0x8ac0('0x16')][_0x8ac0('0x17')]({'raw':_0x21dc02['options']?_0x21dc02[_0x8ac0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x21dc02[_0x8ac0('0x18')]?_0x21dc02['options'][_0x8ac0('0x19')]||null:null,'attributes':_0x21dc02[_0x8ac0('0x18')]?_0x21dc02[_0x8ac0('0x18')][_0x8ac0('0x1a')]||null:null,'limit':_0x21dc02['options']?_0x21dc02[_0x8ac0('0x18')][_0x8ac0('0x1b')]||null:null,'include':_0x21dc02[_0x8ac0('0x18')]?_0x21dc02['options']['include']?_[_0x8ac0('0x1c')](_0x21dc02[_0x8ac0('0x18')][_0x8ac0('0x1d')],function(_0x2c32b6){return{'model':db[_0x2c32b6[_0x8ac0('0x1e')]],'as':_0x2c32b6['as'],'attributes':_0x2c32b6[_0x8ac0('0x1a')],'include':_0x2c32b6['include']?_[_0x8ac0('0x1c')](_0x2c32b6[_0x8ac0('0x1d')],function(_0x3a3dd5){return{'model':db[_0x3a3dd5[_0x8ac0('0x1e')]],'as':_0x3a3dd5['as'],'attributes':_0x3a3dd5[_0x8ac0('0x1a')],'include':_0x3a3dd5['include']?_[_0x8ac0('0x1c')](_0x3a3dd5[_0x8ac0('0x1d')],function(_0x13390f){return{'model':db[_0x13390f['model']],'as':_0x13390f['as'],'attributes':_0x13390f[_0x8ac0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8ac0('0xa')](function(_0x29752f){logger[_0x8ac0('0xb')]('GetDeskAccount',_0x21dc02);logger[_0x8ac0('0x1f')](_0x8ac0('0x15'),_0x21dc02,JSON[_0x8ac0('0xf')](_0x29752f));_0x1bce2c(_0x29752f);})[_0x8ac0('0x14')](function(_0x53b10c){logger['error'](_0x8ac0('0x15'),_0x53b10c[_0x8ac0('0x12')],_0x21dc02);_0x3e02e9(_0xf762b7[_0x8ac0('0x10')](0x1f4,_0x53b10c[_0x8ac0('0x12')]));});});};exports['ShowDeskAccount']=function(_0x440f95){var _0x376338=this;return new Promise(function(_0x3b1839,_0x2261df){return db[_0x8ac0('0x16')]['find']({'raw':_0x440f95['options']?_0x440f95['options'][_0x8ac0('0x20')]===undefined?!![]:![]:!![],'where':_0x440f95['options']?_0x440f95[_0x8ac0('0x18')][_0x8ac0('0x19')]||null:null,'attributes':_0x440f95[_0x8ac0('0x18')]?_0x440f95[_0x8ac0('0x18')][_0x8ac0('0x1a')]||null:null,'include':_0x440f95[_0x8ac0('0x18')]?_0x440f95[_0x8ac0('0x18')][_0x8ac0('0x1d')]?_[_0x8ac0('0x1c')](_0x440f95[_0x8ac0('0x18')][_0x8ac0('0x1d')],function(_0x316c7a){return{'model':db[_0x316c7a['model']],'as':_0x316c7a['as'],'attributes':_0x316c7a['attributes'],'include':_0x316c7a[_0x8ac0('0x1d')]?_['map'](_0x316c7a[_0x8ac0('0x1d')],function(_0x3ab110){return{'model':db[_0x3ab110['model']],'as':_0x3ab110['as'],'attributes':_0x3ab110[_0x8ac0('0x1a')],'include':_0x3ab110['include']?_['map'](_0x3ab110[_0x8ac0('0x1d')],function(_0xdd3156){return{'model':db[_0xdd3156[_0x8ac0('0x1e')]],'as':_0xdd3156['as'],'attributes':_0xdd3156[_0x8ac0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbee15f){logger[_0x8ac0('0xb')]('ShowDeskAccount',_0x440f95);logger[_0x8ac0('0x1f')](_0x8ac0('0x21'),_0x440f95,JSON['stringify'](_0xbee15f));_0x3b1839(_0xbee15f);})[_0x8ac0('0x14')](function(_0x4ddec0){logger[_0x8ac0('0x10')](_0x8ac0('0x21'),_0x4ddec0[_0x8ac0('0x12')],_0x440f95);_0x2261df(_0x376338[_0x8ac0('0x10')](0x1f4,_0x4ddec0[_0x8ac0('0x12')]));});});}; \ No newline at end of file +var _0x7dd1=['jayson/promise','client','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','findAll','options','where','attributes','limit','include','map','model','DeskAccount','find','raw','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment'];(function(_0xcc933b,_0xc40184){var _0x17d7dd=function(_0x7bae64){while(--_0x7bae64){_0xcc933b['push'](_0xcc933b['shift']());}};_0x17d7dd(++_0xc40184);}(_0x7dd1,0x191));var _0x17dd=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7dd1[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x17dd('0x0'));var util=require(_0x17dd('0x1'));var moment=require(_0x17dd('0x2'));var BPromise=require(_0x17dd('0x3'));var rs=require(_0x17dd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x17dd('0x5'));var config=require(_0x17dd('0x6'));var jayson=require(_0x17dd('0x7'));var client=jayson[_0x17dd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2265cb,_0x3a777e,_0x1465cc){return new BPromise(function(_0x52a555,_0x46fa87){return client['request'](_0x2265cb,_0x1465cc)[_0x17dd('0x9')](function(_0x408868){logger[_0x17dd('0xa')]('DeskAccount,\x20%s,\x20%s',_0x3a777e,_0x17dd('0xb'));logger[_0x17dd('0xc')](_0x17dd('0xd'),_0x3a777e,_0x17dd('0xb'),JSON[_0x17dd('0xe')](_0x408868));if(_0x408868[_0x17dd('0xf')]){if(_0x408868['error'][_0x17dd('0x10')]===0x1f4){logger[_0x17dd('0xf')](_0x17dd('0x11'),_0x3a777e,_0x408868[_0x17dd('0xf')][_0x17dd('0x12')]);return _0x46fa87(_0x408868['error'][_0x17dd('0x12')]);}logger[_0x17dd('0xf')](_0x17dd('0x11'),_0x3a777e,_0x408868['error'][_0x17dd('0x12')]);return _0x52a555(_0x408868[_0x17dd('0xf')][_0x17dd('0x12')]);}else{logger[_0x17dd('0xa')](_0x17dd('0x11'),_0x3a777e,'request\x20sent');_0x52a555(_0x408868[_0x17dd('0x13')][_0x17dd('0x12')]);}})[_0x17dd('0x14')](function(_0xe3aa08){logger[_0x17dd('0xf')]('DeskAccount,\x20%s,\x20%s',_0x3a777e,_0xe3aa08);_0x46fa87(_0xe3aa08);});});}exports[_0x17dd('0x15')]=function(_0x311c62){var _0x14549d=this;return new Promise(function(_0x295498,_0x303aa4){return db['DeskAccount'][_0x17dd('0x16')]({'raw':_0x311c62[_0x17dd('0x17')]?_0x311c62['options']['raw']===undefined?!![]:![]:!![],'where':_0x311c62[_0x17dd('0x17')]?_0x311c62[_0x17dd('0x17')][_0x17dd('0x18')]||null:null,'attributes':_0x311c62[_0x17dd('0x17')]?_0x311c62[_0x17dd('0x17')][_0x17dd('0x19')]||null:null,'limit':_0x311c62[_0x17dd('0x17')]?_0x311c62[_0x17dd('0x17')][_0x17dd('0x1a')]||null:null,'include':_0x311c62[_0x17dd('0x17')]?_0x311c62['options'][_0x17dd('0x1b')]?_[_0x17dd('0x1c')](_0x311c62['options'][_0x17dd('0x1b')],function(_0x25c393){return{'model':db[_0x25c393[_0x17dd('0x1d')]],'as':_0x25c393['as'],'attributes':_0x25c393[_0x17dd('0x19')],'include':_0x25c393[_0x17dd('0x1b')]?_[_0x17dd('0x1c')](_0x25c393[_0x17dd('0x1b')],function(_0x3194fd){return{'model':db[_0x3194fd['model']],'as':_0x3194fd['as'],'attributes':_0x3194fd[_0x17dd('0x19')],'include':_0x3194fd[_0x17dd('0x1b')]?_[_0x17dd('0x1c')](_0x3194fd[_0x17dd('0x1b')],function(_0x136d24){return{'model':db[_0x136d24[_0x17dd('0x1d')]],'as':_0x136d24['as'],'attributes':_0x136d24[_0x17dd('0x19')]};}):[]};}):[]};}):[]:[]})[_0x17dd('0x9')](function(_0x47dd2d){logger['info'](_0x17dd('0x15'),_0x311c62);logger['debug'](_0x17dd('0x15'),_0x311c62,JSON[_0x17dd('0xe')](_0x47dd2d));_0x295498(_0x47dd2d);})[_0x17dd('0x14')](function(_0x20ff34){logger[_0x17dd('0xf')](_0x17dd('0x15'),_0x20ff34[_0x17dd('0x12')],_0x311c62);_0x303aa4(_0x14549d[_0x17dd('0xf')](0x1f4,_0x20ff34[_0x17dd('0x12')]));});});};exports['ShowDeskAccount']=function(_0x171ac4){var _0x5c7e1b=this;return new Promise(function(_0x5a22c1,_0x5648b7){return db[_0x17dd('0x1e')][_0x17dd('0x1f')]({'raw':_0x171ac4[_0x17dd('0x17')]?_0x171ac4[_0x17dd('0x17')][_0x17dd('0x20')]===undefined?!![]:![]:!![],'where':_0x171ac4['options']?_0x171ac4[_0x17dd('0x17')][_0x17dd('0x18')]||null:null,'attributes':_0x171ac4[_0x17dd('0x17')]?_0x171ac4[_0x17dd('0x17')]['attributes']||null:null,'include':_0x171ac4[_0x17dd('0x17')]?_0x171ac4['options'][_0x17dd('0x1b')]?_[_0x17dd('0x1c')](_0x171ac4[_0x17dd('0x17')][_0x17dd('0x1b')],function(_0xdb27da){return{'model':db[_0xdb27da['model']],'as':_0xdb27da['as'],'attributes':_0xdb27da['attributes'],'include':_0xdb27da[_0x17dd('0x1b')]?_['map'](_0xdb27da[_0x17dd('0x1b')],function(_0x427e94){return{'model':db[_0x427e94[_0x17dd('0x1d')]],'as':_0x427e94['as'],'attributes':_0x427e94['attributes'],'include':_0x427e94[_0x17dd('0x1b')]?_[_0x17dd('0x1c')](_0x427e94['include'],function(_0x17a2ef){return{'model':db[_0x17a2ef[_0x17dd('0x1d')]],'as':_0x17a2ef['as'],'attributes':_0x17a2ef[_0x17dd('0x19')]};}):[]};}):[]};}):[]:[]})[_0x17dd('0x9')](function(_0x12fe94){logger[_0x17dd('0xa')](_0x17dd('0x21'),_0x171ac4);logger[_0x17dd('0xc')](_0x17dd('0x21'),_0x171ac4,JSON[_0x17dd('0xe')](_0x12fe94));_0x5a22c1(_0x12fe94);})['catch'](function(_0xa6871d){logger[_0x17dd('0xf')](_0x17dd('0x21'),_0xa6871d[_0x17dd('0x12')],_0x171ac4);_0x5648b7(_0x5c7e1b['error'](0x1f4,_0xa6871d[_0x17dd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index fada2d2..a688420 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x22c600,_0x3867e0){var _0x201b22=function(_0x4781cb){while(--_0x4781cb){_0x22c600['push'](_0x22c600['shift']());}};_0x201b22(++_0x3867e0);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x29d264,_0x5cb462){var _0x4e2e2f=function(_0x2327db){while(--_0x2327db){_0x29d264['push'](_0x29d264['shift']());}};_0x4e2e2f(++_0x5cb462);}(_0xedd9,0xfc));var _0x9edd=function(_0x5e1d35,_0xc30b5b){_0x5e1d35=_0x5e1d35-0x0;var _0x4150a2=_0xedd9[_0x5e1d35];return _0x4150a2;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 6d31e09..7e51251 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 _0x04fc=['STRING','sequelize'];(function(_0x2aa446,_0x337e53){var _0x14cf33=function(_0x47274b){while(--_0x47274b){_0x2aa446['push'](_0x2aa446['shift']());}};_0x14cf33(++_0x337e53);}(_0x04fc,0xa9));var _0xc04f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x04fc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc04f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc04f('0x1')]}}; \ No newline at end of file +var _0x5832=['STRING','exports'];(function(_0x2deee9,_0x58b00f){var _0x51a55e=function(_0x4de56a){while(--_0x4de56a){_0x2deee9['push'](_0x2deee9['shift']());}};_0x51a55e(++_0x58b00f);}(_0x5832,0x11b));var _0x2583=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0x5832[_0x59eefb];return _0x1a49e8;};'use strict';var Sequelize=require('sequelize');module[_0x2583('0x0')]={'name':{'type':Sequelize[_0x2583('0x1')]},'description':{'type':Sequelize[_0x2583('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 53c8887..9274717 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 _0x92ca=['params','find','create','body','getFields','findOne','DeskField','pick','filter','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x467765,_0x20b35a){var _0x3126e5=function(_0x36f903){while(--_0x36f903){_0x467765['push'](_0x467765['shift']());}};_0x3126e5(++_0x20b35a);}(_0x92ca,0xb5));var _0xa92c=function(_0x3d3d96,_0x28998e){_0x3d3d96=_0x3d3d96-0x0;var _0x2e479a=_0x92ca[_0x3d3d96];return _0x2e479a;};'use strict';var emlformat=require(_0xa92c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa92c('0x1'));var jsonpatch=require(_0xa92c('0x2'));var rp=require(_0xa92c('0x3'));var moment=require(_0xa92c('0x4'));var BPromise=require(_0xa92c('0x5'));var Mustache=require(_0xa92c('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa92c('0x7'));var csv=require('to-csv');var ejs=require(_0xa92c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa92c('0x9'));var squel=require(_0xa92c('0xa'));var crypto=require('crypto');var jsforce=require(_0xa92c('0xb'));var deskjs=require(_0xa92c('0xc'));var toCsv=require(_0xa92c('0xd'));var querystring=require(_0xa92c('0xe'));var Papa=require('papaparse');var Redis=require(_0xa92c('0xf'));var authService=require(_0xa92c('0x10'));var qs=require(_0xa92c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa92c('0x12'));var logger=require('../../config/logger')(_0xa92c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa92c('0x14'));var db=require(_0xa92c('0x15'))['db'];function respondWithStatusCode(_0x370eeb,_0x3e661f){_0x3e661f=_0x3e661f||0xcc;return function(_0x3e5356){if(_0x3e5356){return _0x370eeb[_0xa92c('0x16')](_0x3e661f);}return _0x370eeb[_0xa92c('0x17')](_0x3e661f)[_0xa92c('0x18')]();};}function respondWithResult(_0xb38789,_0x1f586f){_0x1f586f=_0x1f586f||0xc8;return function(_0x5ec7c3){if(_0x5ec7c3){return _0xb38789[_0xa92c('0x17')](_0x1f586f)['json'](_0x5ec7c3);}};}function respondWithFilteredResult(_0x55b95e,_0x206fba){return function(_0x27b325){if(_0x27b325){var _0x34b009=typeof _0x206fba[_0xa92c('0x19')]===_0xa92c('0x1a')&&typeof _0x206fba[_0xa92c('0x1b')]==='undefined';var _0x26ab52=_0x27b325[_0xa92c('0x1c')];var _0x127051=_0x34b009?0x0:_0x206fba[_0xa92c('0x19')];var _0x5c8e81=_0x34b009?_0x27b325[_0xa92c('0x1c')]:_0x206fba[_0xa92c('0x19')]+_0x206fba[_0xa92c('0x1b')];var _0x3e010d;if(_0x5c8e81>=_0x26ab52){_0x5c8e81=_0x26ab52;_0x3e010d=0xc8;}else{_0x3e010d=0xce;}_0x55b95e[_0xa92c('0x17')](_0x3e010d);return _0x55b95e[_0xa92c('0x1d')]('Content-Range',_0x127051+'-'+_0x5c8e81+'/'+_0x26ab52)[_0xa92c('0x1e')](_0x27b325);}return null;};}function patchUpdates(_0x43ab5e){return function(_0x26ff56){try{jsonpatch[_0xa92c('0x1f')](_0x26ff56,_0x43ab5e,!![]);}catch(_0x554330){return BPromise[_0xa92c('0x20')](_0x554330);}return _0x26ff56['save']();};}function saveUpdates(_0x531271,_0x1b4480){return function(_0x376389){if(_0x376389){return _0x376389[_0xa92c('0x21')](_0x531271)[_0xa92c('0x22')](function(_0x4cd972){return _0x4cd972;});}return null;};}function removeEntity(_0x5819a3,_0x27cc14){return function(_0x353b02){if(_0x353b02){return _0x353b02[_0xa92c('0x23')]()[_0xa92c('0x22')](function(){_0x5819a3['status'](0xcc)[_0xa92c('0x18')]();});}};}function handleEntityNotFound(_0x2bca4c,_0x392dcb){return function(_0x5ddbe7){if(!_0x5ddbe7){_0x2bca4c[_0xa92c('0x16')](0x194);}return _0x5ddbe7;};}function handleError(_0x102ab6,_0x4d9197){_0x4d9197=_0x4d9197||0x1f4;return function(_0x473e5d){logger[_0xa92c('0x24')](_0x473e5d['stack']);if(_0x473e5d[_0xa92c('0x25')]){delete _0x473e5d[_0xa92c('0x25')];}_0x102ab6['status'](_0x4d9197)[_0xa92c('0x26')](_0x473e5d);};}exports[_0xa92c('0x27')]=function(_0x5318e8,_0x11ca92){var _0x12093a={},_0x804763={},_0x1b4980={'count':0x0,'rows':[]};var _0x477b70=_[_0xa92c('0x28')](db[_0xa92c('0x29')][_0xa92c('0x2a')],function(_0x477687){return{'name':_0x477687[_0xa92c('0x2b')],'type':_0x477687['type'][_0xa92c('0x2c')]};});_0x804763[_0xa92c('0x2d')]=_[_0xa92c('0x28')](_0x477b70,_0xa92c('0x25'));_0x804763[_0xa92c('0x2e')]=_[_0xa92c('0x2f')](_0x5318e8[_0xa92c('0x2e')]);_0x804763[_0xa92c('0x30')]=_['intersection'](_0x804763[_0xa92c('0x2d')],_0x804763[_0xa92c('0x2e')]);_0x12093a[_0xa92c('0x31')]=_[_0xa92c('0x32')](_0x804763[_0xa92c('0x2d')],qs['fields'](_0x5318e8['query'][_0xa92c('0x33')]));_0x12093a[_0xa92c('0x31')]=_0x12093a[_0xa92c('0x31')][_0xa92c('0x34')]?_0x12093a[_0xa92c('0x31')]:_0x804763[_0xa92c('0x2d')];if(!_0x5318e8['query'][_0xa92c('0x35')](_0xa92c('0x36'))){_0x12093a[_0xa92c('0x1b')]=qs[_0xa92c('0x1b')](_0x5318e8[_0xa92c('0x2e')][_0xa92c('0x1b')]);_0x12093a[_0xa92c('0x19')]=qs[_0xa92c('0x19')](_0x5318e8['query']['offset']);}_0x12093a[_0xa92c('0x37')]=qs['sort'](_0x5318e8[_0xa92c('0x2e')][_0xa92c('0x38')]);_0x12093a['where']=qs[_0xa92c('0x30')](_['pick'](_0x5318e8[_0xa92c('0x2e')],_0x804763[_0xa92c('0x30')]),_0x477b70);if(_0x5318e8['query']['filter']){_0x12093a[_0xa92c('0x39')]=_[_0xa92c('0x3a')](_0x12093a[_0xa92c('0x39')],{'$or':_[_0xa92c('0x28')](_0x477b70,function(_0x199ae2){if(_0x199ae2[_0xa92c('0x3b')]!==_0xa92c('0x3c')){var _0x3506ef={};_0x3506ef[_0x199ae2['name']]={'$like':'%'+_0x5318e8['query']['filter']+'%'};return _0x3506ef;}})});}_0x12093a=_[_0xa92c('0x3a')]({},_0x12093a,_0x5318e8[_0xa92c('0x3d')]);var _0x27c525={'where':_0x12093a['where']};return db[_0xa92c('0x29')]['count'](_0x27c525)[_0xa92c('0x22')](function(_0x5546c6){_0x1b4980[_0xa92c('0x1c')]=_0x5546c6;if(_0x5318e8[_0xa92c('0x2e')][_0xa92c('0x3e')]){_0x12093a[_0xa92c('0x3f')]=[{'all':!![]}];}return db[_0xa92c('0x29')][_0xa92c('0x40')](_0x12093a);})[_0xa92c('0x22')](function(_0x130cd7){_0x1b4980[_0xa92c('0x41')]=_0x130cd7;return _0x1b4980;})[_0xa92c('0x22')](respondWithFilteredResult(_0x11ca92,_0x12093a))[_0xa92c('0x42')](handleError(_0x11ca92,null));};exports[_0xa92c('0x43')]=function(_0x531f89,_0x2eb424){var _0x48bd27={'raw':![],'where':{'id':_0x531f89[_0xa92c('0x44')]['id']}},_0x4b3fd8={};_0x4b3fd8[_0xa92c('0x2d')]=_[_0xa92c('0x2f')](db['DeskConfiguration'][_0xa92c('0x2a')]);_0x4b3fd8['query']=_[_0xa92c('0x2f')](_0x531f89[_0xa92c('0x2e')]);_0x4b3fd8[_0xa92c('0x30')]=_[_0xa92c('0x32')](_0x4b3fd8[_0xa92c('0x2d')],_0x4b3fd8[_0xa92c('0x2e')]);_0x48bd27['attributes']=_['intersection'](_0x4b3fd8[_0xa92c('0x2d')],qs[_0xa92c('0x33')](_0x531f89['query']['fields']));_0x48bd27[_0xa92c('0x31')]=_0x48bd27[_0xa92c('0x31')][_0xa92c('0x34')]?_0x48bd27[_0xa92c('0x31')]:_0x4b3fd8[_0xa92c('0x2d')];if(_0x531f89['query'][_0xa92c('0x3e')]){_0x48bd27['include']=[{'all':!![]}];}_0x48bd27=_[_0xa92c('0x3a')]({},_0x48bd27,_0x531f89[_0xa92c('0x3d')]);return db[_0xa92c('0x29')][_0xa92c('0x45')](_0x48bd27)[_0xa92c('0x22')](handleEntityNotFound(_0x2eb424,null))[_0xa92c('0x22')](respondWithResult(_0x2eb424,null))['catch'](handleError(_0x2eb424,null));};exports[_0xa92c('0x46')]=function(_0xf9aa46,_0xc62316){return db['DeskConfiguration'][_0xa92c('0x46')](_0xf9aa46[_0xa92c('0x47')],{})[_0xa92c('0x22')](respondWithResult(_0xc62316,0xc9))[_0xa92c('0x42')](handleError(_0xc62316,null));};exports[_0xa92c('0x21')]=function(_0x9ab4e1,_0x530e1d){if(_0x9ab4e1[_0xa92c('0x47')]['id']){delete _0x9ab4e1[_0xa92c('0x47')]['id'];}return db[_0xa92c('0x29')][_0xa92c('0x45')]({'where':{'id':_0x9ab4e1[_0xa92c('0x44')]['id']}})['then'](handleEntityNotFound(_0x530e1d,null))[_0xa92c('0x22')](saveUpdates(_0x9ab4e1[_0xa92c('0x47')],null))[_0xa92c('0x22')](respondWithResult(_0x530e1d,null))['catch'](handleError(_0x530e1d,null));};exports[_0xa92c('0x23')]=function(_0x47036c,_0x1984f6){return db[_0xa92c('0x29')][_0xa92c('0x45')]({'where':{'id':_0x47036c[_0xa92c('0x44')]['id']}})[_0xa92c('0x22')](handleEntityNotFound(_0x1984f6,null))[_0xa92c('0x22')](removeEntity(_0x1984f6,null))['catch'](handleError(_0x1984f6,null));};exports[_0xa92c('0x48')]=function(_0x2f804c,_0x2934b2,_0x1ea13c){var _0x290764={};var _0x30369c={};var _0x1d2db2;var _0x47b950;return db[_0xa92c('0x29')][_0xa92c('0x49')]({'where':{'id':_0x2f804c[_0xa92c('0x44')]['id']}})[_0xa92c('0x22')](handleEntityNotFound(_0x2934b2,null))[_0xa92c('0x22')](function(_0x481ec4){if(_0x481ec4){_0x1d2db2=_0x481ec4;_0x30369c[_0xa92c('0x2d')]=_['keys'](db[_0xa92c('0x4a')][_0xa92c('0x2a')]);_0x30369c[_0xa92c('0x2e')]=_[_0xa92c('0x2f')](_0x2f804c[_0xa92c('0x2e')]);_0x30369c[_0xa92c('0x30')]=_[_0xa92c('0x32')](_0x30369c[_0xa92c('0x2d')],_0x30369c[_0xa92c('0x2e')]);_0x290764[_0xa92c('0x31')]=_[_0xa92c('0x32')](_0x30369c['model'],qs['fields'](_0x2f804c[_0xa92c('0x2e')][_0xa92c('0x33')]));_0x290764[_0xa92c('0x31')]=_0x290764['attributes'][_0xa92c('0x34')]?_0x290764[_0xa92c('0x31')]:_0x30369c[_0xa92c('0x2d')];_0x290764[_0xa92c('0x37')]=qs[_0xa92c('0x38')](_0x2f804c[_0xa92c('0x2e')]['sort']);_0x290764['where']=qs[_0xa92c('0x30')](_[_0xa92c('0x4b')](_0x2f804c['query'],_0x30369c[_0xa92c('0x30')]));if(_0x2f804c[_0xa92c('0x2e')][_0xa92c('0x4c')]){_0x290764[_0xa92c('0x39')]=_[_0xa92c('0x3a')](_0x290764[_0xa92c('0x39')],{'$or':_[_0xa92c('0x28')](_0x290764[_0xa92c('0x31')],function(_0x61f598){var _0x2912b={};_0x2912b[_0x61f598]={'$like':'%'+_0x2f804c[_0xa92c('0x2e')][_0xa92c('0x4c')]+'%'};return _0x2912b;})});}_0x290764=_['merge']({},_0x290764,_0x2f804c[_0xa92c('0x3d')]);return _0x1d2db2[_0xa92c('0x48')](_0x290764);}})['then'](function(_0x1cd984){if(_0x1cd984){_0x47b950=_0x1cd984[_0xa92c('0x34')];if(!_0x2f804c[_0xa92c('0x2e')][_0xa92c('0x35')](_0xa92c('0x36'))){_0x290764[_0xa92c('0x1b')]=qs[_0xa92c('0x1b')](_0x2f804c[_0xa92c('0x2e')][_0xa92c('0x1b')]);_0x290764[_0xa92c('0x19')]=qs[_0xa92c('0x19')](_0x2f804c[_0xa92c('0x2e')][_0xa92c('0x19')]);}return _0x1d2db2['getFields'](_0x290764);}})['then'](function(_0x709111){if(_0x709111){return _0x709111?{'count':_0x47b950,'rows':_0x709111}:null;}})[_0xa92c('0x22')](respondWithResult(_0x2934b2,null))[_0xa92c('0x42')](handleError(_0x2934b2,null));};exports['getSubjects']=function(_0x46a89e,_0x1f3e6b,_0x3db1ed){var _0x3f7d63={};var _0x2449e2={};var _0x360bd6;var _0x1cee85;return db[_0xa92c('0x29')][_0xa92c('0x49')]({'where':{'id':_0x46a89e[_0xa92c('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f3e6b,null))[_0xa92c('0x22')](function(_0x225037){if(_0x225037){_0x360bd6=_0x225037;_0x2449e2[_0xa92c('0x2d')]=_[_0xa92c('0x2f')](db['DeskField'][_0xa92c('0x2a')]);_0x2449e2[_0xa92c('0x2e')]=_[_0xa92c('0x2f')](_0x46a89e['query']);_0x2449e2[_0xa92c('0x30')]=_[_0xa92c('0x32')](_0x2449e2['model'],_0x2449e2[_0xa92c('0x2e')]);_0x3f7d63[_0xa92c('0x31')]=_[_0xa92c('0x32')](_0x2449e2['model'],qs['fields'](_0x46a89e[_0xa92c('0x2e')][_0xa92c('0x33')]));_0x3f7d63[_0xa92c('0x31')]=_0x3f7d63['attributes'][_0xa92c('0x34')]?_0x3f7d63[_0xa92c('0x31')]:_0x2449e2['model'];_0x3f7d63[_0xa92c('0x37')]=qs[_0xa92c('0x38')](_0x46a89e['query'][_0xa92c('0x38')]);_0x3f7d63['where']=qs[_0xa92c('0x30')](_[_0xa92c('0x4b')](_0x46a89e[_0xa92c('0x2e')],_0x2449e2[_0xa92c('0x30')]));if(_0x46a89e[_0xa92c('0x2e')][_0xa92c('0x4c')]){_0x3f7d63[_0xa92c('0x39')]=_[_0xa92c('0x3a')](_0x3f7d63[_0xa92c('0x39')],{'$or':_[_0xa92c('0x28')](_0x3f7d63[_0xa92c('0x31')],function(_0x3ab490){var _0x98e426={};_0x98e426[_0x3ab490]={'$like':'%'+_0x46a89e[_0xa92c('0x2e')][_0xa92c('0x4c')]+'%'};return _0x98e426;})});}_0x3f7d63=_[_0xa92c('0x3a')]({},_0x3f7d63,_0x46a89e[_0xa92c('0x3d')]);return _0x360bd6[_0xa92c('0x4d')](_0x3f7d63);}})[_0xa92c('0x22')](function(_0xbaccc4){if(_0xbaccc4){_0x1cee85=_0xbaccc4[_0xa92c('0x34')];if(!_0x46a89e['query'][_0xa92c('0x35')](_0xa92c('0x36'))){_0x3f7d63['limit']=qs['limit'](_0x46a89e[_0xa92c('0x2e')]['limit']);_0x3f7d63['offset']=qs[_0xa92c('0x19')](_0x46a89e[_0xa92c('0x2e')][_0xa92c('0x19')]);}return _0x360bd6[_0xa92c('0x4d')](_0x3f7d63);}})[_0xa92c('0x22')](function(_0x17a415){if(_0x17a415){return _0x17a415?{'count':_0x1cee85,'rows':_0x17a415}:null;}})[_0xa92c('0x22')](respondWithResult(_0x1f3e6b,null))['catch'](handleError(_0x1f3e6b,null));};exports[_0xa92c('0x4e')]=function(_0x30861a,_0x3c03,_0x5e9bb5){var _0x5c1183={};var _0x58b604={};var _0x5237ef;var _0x12d4b2;return db[_0xa92c('0x29')]['findOne']({'where':{'id':_0x30861a[_0xa92c('0x44')]['id']}})[_0xa92c('0x22')](handleEntityNotFound(_0x3c03,null))[_0xa92c('0x22')](function(_0x48618f){if(_0x48618f){_0x5237ef=_0x48618f;_0x58b604[_0xa92c('0x2d')]=_[_0xa92c('0x2f')](db[_0xa92c('0x4a')][_0xa92c('0x2a')]);_0x58b604['query']=_[_0xa92c('0x2f')](_0x30861a['query']);_0x58b604[_0xa92c('0x30')]=_['intersection'](_0x58b604['model'],_0x58b604[_0xa92c('0x2e')]);_0x5c1183[_0xa92c('0x31')]=_[_0xa92c('0x32')](_0x58b604[_0xa92c('0x2d')],qs[_0xa92c('0x33')](_0x30861a[_0xa92c('0x2e')][_0xa92c('0x33')]));_0x5c1183['attributes']=_0x5c1183[_0xa92c('0x31')][_0xa92c('0x34')]?_0x5c1183[_0xa92c('0x31')]:_0x58b604[_0xa92c('0x2d')];_0x5c1183[_0xa92c('0x37')]=qs[_0xa92c('0x38')](_0x30861a['query'][_0xa92c('0x38')]);_0x5c1183['where']=qs['filters'](_[_0xa92c('0x4b')](_0x30861a[_0xa92c('0x2e')],_0x58b604['filters']));if(_0x30861a[_0xa92c('0x2e')][_0xa92c('0x4c')]){_0x5c1183[_0xa92c('0x39')]=_[_0xa92c('0x3a')](_0x5c1183[_0xa92c('0x39')],{'$or':_[_0xa92c('0x28')](_0x5c1183[_0xa92c('0x31')],function(_0x1fafb2){var _0x52d0ca={};_0x52d0ca[_0x1fafb2]={'$like':'%'+_0x30861a[_0xa92c('0x2e')]['filter']+'%'};return _0x52d0ca;})});}_0x5c1183=_[_0xa92c('0x3a')]({},_0x5c1183,_0x30861a['options']);return _0x5237ef[_0xa92c('0x4e')](_0x5c1183);}})[_0xa92c('0x22')](function(_0x1418bc){if(_0x1418bc){_0x12d4b2=_0x1418bc[_0xa92c('0x34')];if(!_0x30861a[_0xa92c('0x2e')][_0xa92c('0x35')](_0xa92c('0x36'))){_0x5c1183[_0xa92c('0x1b')]=qs['limit'](_0x30861a['query'][_0xa92c('0x1b')]);_0x5c1183[_0xa92c('0x19')]=qs[_0xa92c('0x19')](_0x30861a[_0xa92c('0x2e')][_0xa92c('0x19')]);}return _0x5237ef[_0xa92c('0x4e')](_0x5c1183);}})[_0xa92c('0x22')](function(_0x4d44a9){if(_0x4d44a9){return _0x4d44a9?{'count':_0x12d4b2,'rows':_0x4d44a9}:null;}})[_0xa92c('0x22')](respondWithResult(_0x3c03,null))[_0xa92c('0x42')](handleError(_0x3c03,null));};exports['getTags']=function(_0x56800b,_0x54e793,_0x4bba21){var _0x3c3ce7={};var _0x15a0be={};var _0x23b0ba;var _0x521006;return db['DeskConfiguration']['findOne']({'where':{'id':_0x56800b[_0xa92c('0x44')]['id']}})[_0xa92c('0x22')](handleEntityNotFound(_0x54e793,null))['then'](function(_0x535dd2){if(_0x535dd2){_0x23b0ba=_0x535dd2;_0x15a0be[_0xa92c('0x2d')]=_['keys'](db[_0xa92c('0x4f')]['rawAttributes']);_0x15a0be['query']=_['keys'](_0x56800b[_0xa92c('0x2e')]);_0x15a0be[_0xa92c('0x30')]=_['intersection'](_0x15a0be[_0xa92c('0x2d')],_0x15a0be[_0xa92c('0x2e')]);_0x3c3ce7['attributes']=_[_0xa92c('0x32')](_0x15a0be[_0xa92c('0x2d')],qs[_0xa92c('0x33')](_0x56800b[_0xa92c('0x2e')]['fields']));_0x3c3ce7[_0xa92c('0x31')]=_0x3c3ce7[_0xa92c('0x31')][_0xa92c('0x34')]?_0x3c3ce7['attributes']:_0x15a0be[_0xa92c('0x2d')];_0x3c3ce7['order']=qs[_0xa92c('0x38')](_0x56800b['query'][_0xa92c('0x38')]);_0x3c3ce7[_0xa92c('0x39')]=qs[_0xa92c('0x30')](_[_0xa92c('0x4b')](_0x56800b[_0xa92c('0x2e')],_0x15a0be['filters']));if(_0x56800b[_0xa92c('0x2e')]['filter']){_0x3c3ce7['where']=_[_0xa92c('0x3a')](_0x3c3ce7[_0xa92c('0x39')],{'$or':_['map'](_0x3c3ce7[_0xa92c('0x31')],function(_0xc73b1f){var _0x2f6783={};_0x2f6783[_0xc73b1f]={'$like':'%'+_0x56800b[_0xa92c('0x2e')][_0xa92c('0x4c')]+'%'};return _0x2f6783;})});}_0x3c3ce7=_[_0xa92c('0x3a')]({},_0x3c3ce7,_0x56800b[_0xa92c('0x3d')]);return _0x23b0ba[_0xa92c('0x50')](_0x3c3ce7);}})[_0xa92c('0x22')](function(_0x3974d8){if(_0x3974d8){_0x521006=_0x3974d8[_0xa92c('0x34')];if(!_0x56800b['query'][_0xa92c('0x35')](_0xa92c('0x36'))){_0x3c3ce7[_0xa92c('0x1b')]=qs[_0xa92c('0x1b')](_0x56800b[_0xa92c('0x2e')]['limit']);_0x3c3ce7[_0xa92c('0x19')]=qs[_0xa92c('0x19')](_0x56800b[_0xa92c('0x2e')][_0xa92c('0x19')]);}return _0x23b0ba[_0xa92c('0x50')](_0x3c3ce7);}})[_0xa92c('0x22')](function(_0x82d18a){if(_0x82d18a){return _0x82d18a?{'count':_0x521006,'rows':_0x82d18a}:null;}})[_0xa92c('0x22')](respondWithResult(_0x54e793,null))[_0xa92c('0x42')](handleError(_0x54e793,null));};exports[_0xa92c('0x51')]=function(_0xc7d303,_0x299f80,_0x1d07a7){if(_0xc7d303[_0xa92c('0x47')]['id']){delete _0xc7d303[_0xa92c('0x47')]['id'];}return db[_0xa92c('0x29')]['findOne']({'where':{'id':_0xc7d303[_0xa92c('0x44')]['id']}})['then'](handleEntityNotFound(_0x299f80,null))[_0xa92c('0x22')](function(_0x59e8c2){if(_0x59e8c2){return _0x59e8c2[_0xa92c('0x51')](_0xc7d303[_0xa92c('0x47')][_0xa92c('0x52')]||[]);}return null;})[_0xa92c('0x22')](respondWithResult(_0x299f80,null))['catch'](handleError(_0x299f80,null));}; \ No newline at end of file +var _0xcdcd=['getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','index','DeskConfiguration','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','include','findAll','catch','show','rawAttributes','includeAll','options','find','create','body','update','params','findOne','getFields'];(function(_0x198f58,_0x19dc8a){var _0x996b25=function(_0x51a3eb){while(--_0x51a3eb){_0x198f58['push'](_0x198f58['shift']());}};_0x996b25(++_0x19dc8a);}(_0xcdcd,0x156));var _0xdcdc=function(_0x4afe3b,_0x255e0d){_0x4afe3b=_0x4afe3b-0x0;var _0x2c22d1=_0xcdcd[_0x4afe3b];return _0x2c22d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdcdc('0x0'));var zipdir=require(_0xdcdc('0x1'));var jsonpatch=require(_0xdcdc('0x2'));var rp=require(_0xdcdc('0x3'));var moment=require(_0xdcdc('0x4'));var BPromise=require(_0xdcdc('0x5'));var Mustache=require(_0xdcdc('0x6'));var util=require(_0xdcdc('0x7'));var path=require(_0xdcdc('0x8'));var sox=require(_0xdcdc('0x9'));var csv=require(_0xdcdc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdcdc('0xb'));var _=require(_0xdcdc('0xc'));var squel=require(_0xdcdc('0xd'));var crypto=require(_0xdcdc('0xe'));var jsforce=require(_0xdcdc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdcdc('0xa'));var querystring=require(_0xdcdc('0x10'));var Papa=require(_0xdcdc('0x11'));var Redis=require(_0xdcdc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdcdc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdcdc('0x14'));var utils=require(_0xdcdc('0x15'));var config=require(_0xdcdc('0x16'));var licenseUtil=require(_0xdcdc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x78bc21,_0xae4520){_0xae4520=_0xae4520||0xcc;return function(_0x3451b8){if(_0x3451b8){return _0x78bc21[_0xdcdc('0x18')](_0xae4520);}return _0x78bc21['status'](_0xae4520)[_0xdcdc('0x19')]();};}function respondWithResult(_0x2fe43b,_0x2c7289){_0x2c7289=_0x2c7289||0xc8;return function(_0x1246fd){if(_0x1246fd){return _0x2fe43b[_0xdcdc('0x1a')](_0x2c7289)['json'](_0x1246fd);}};}function respondWithFilteredResult(_0x1ca24a,_0x2c48fc){return function(_0x1c64ac){if(_0x1c64ac){var _0x7a9e21=typeof _0x2c48fc[_0xdcdc('0x1b')]===_0xdcdc('0x1c')&&typeof _0x2c48fc[_0xdcdc('0x1d')]===_0xdcdc('0x1c');var _0x1d8873=_0x1c64ac[_0xdcdc('0x1e')];var _0x2f622d=_0x7a9e21?0x0:_0x2c48fc['offset'];var _0x507c52=_0x7a9e21?_0x1c64ac[_0xdcdc('0x1e')]:_0x2c48fc[_0xdcdc('0x1b')]+_0x2c48fc['limit'];var _0x5936a0;if(_0x507c52>=_0x1d8873){_0x507c52=_0x1d8873;_0x5936a0=0xc8;}else{_0x5936a0=0xce;}_0x1ca24a['status'](_0x5936a0);return _0x1ca24a[_0xdcdc('0x1f')](_0xdcdc('0x20'),_0x2f622d+'-'+_0x507c52+'/'+_0x1d8873)[_0xdcdc('0x21')](_0x1c64ac);}return null;};}function patchUpdates(_0x5ae27e){return function(_0x3d1a75){try{jsonpatch[_0xdcdc('0x22')](_0x3d1a75,_0x5ae27e,!![]);}catch(_0x36fd6f){return BPromise['reject'](_0x36fd6f);}return _0x3d1a75[_0xdcdc('0x23')]();};}function saveUpdates(_0x2dade4,_0x8ed834){return function(_0x4913cd){if(_0x4913cd){return _0x4913cd['update'](_0x2dade4)[_0xdcdc('0x24')](function(_0x37f869){return _0x37f869;});}return null;};}function removeEntity(_0x427578,_0x37746e){return function(_0x214da6){if(_0x214da6){return _0x214da6[_0xdcdc('0x25')]()['then'](function(){_0x427578[_0xdcdc('0x1a')](0xcc)[_0xdcdc('0x19')]();});}};}function handleEntityNotFound(_0x5a6341,_0x56fef4){return function(_0x2d2669){if(!_0x2d2669){_0x5a6341['sendStatus'](0x194);}return _0x2d2669;};}function handleError(_0x453b50,_0x2cd884){_0x2cd884=_0x2cd884||0x1f4;return function(_0x5d71e3){logger[_0xdcdc('0x26')](_0x5d71e3['stack']);if(_0x5d71e3[_0xdcdc('0x27')]){delete _0x5d71e3[_0xdcdc('0x27')];}_0x453b50[_0xdcdc('0x1a')](_0x2cd884)[_0xdcdc('0x28')](_0x5d71e3);};}exports[_0xdcdc('0x29')]=function(_0x437c08,_0x910b70){var _0x51ef32={},_0x1a59fa={},_0x2957da={'count':0x0,'rows':[]};var _0x17f94d=_['map'](db[_0xdcdc('0x2a')]['rawAttributes'],function(_0x2f2598){return{'name':_0x2f2598[_0xdcdc('0x2b')],'type':_0x2f2598['type'][_0xdcdc('0x2c')]};});_0x1a59fa[_0xdcdc('0x2d')]=_[_0xdcdc('0x2e')](_0x17f94d,_0xdcdc('0x27'));_0x1a59fa[_0xdcdc('0x2f')]=_[_0xdcdc('0x30')](_0x437c08[_0xdcdc('0x2f')]);_0x1a59fa[_0xdcdc('0x31')]=_[_0xdcdc('0x32')](_0x1a59fa[_0xdcdc('0x2d')],_0x1a59fa[_0xdcdc('0x2f')]);_0x51ef32[_0xdcdc('0x33')]=_[_0xdcdc('0x32')](_0x1a59fa[_0xdcdc('0x2d')],qs[_0xdcdc('0x34')](_0x437c08[_0xdcdc('0x2f')][_0xdcdc('0x34')]));_0x51ef32['attributes']=_0x51ef32[_0xdcdc('0x33')][_0xdcdc('0x35')]?_0x51ef32[_0xdcdc('0x33')]:_0x1a59fa[_0xdcdc('0x2d')];if(!_0x437c08[_0xdcdc('0x2f')][_0xdcdc('0x36')](_0xdcdc('0x37'))){_0x51ef32[_0xdcdc('0x1d')]=qs['limit'](_0x437c08[_0xdcdc('0x2f')][_0xdcdc('0x1d')]);_0x51ef32[_0xdcdc('0x1b')]=qs[_0xdcdc('0x1b')](_0x437c08[_0xdcdc('0x2f')][_0xdcdc('0x1b')]);}_0x51ef32[_0xdcdc('0x38')]=qs[_0xdcdc('0x39')](_0x437c08['query']['sort']);_0x51ef32[_0xdcdc('0x3a')]=qs[_0xdcdc('0x31')](_[_0xdcdc('0x3b')](_0x437c08['query'],_0x1a59fa['filters']),_0x17f94d);if(_0x437c08[_0xdcdc('0x2f')]['filter']){_0x51ef32['where']=_[_0xdcdc('0x3c')](_0x51ef32['where'],{'$or':_['map'](_0x17f94d,function(_0x2b0559){if(_0x2b0559[_0xdcdc('0x3d')]!==_0xdcdc('0x3e')){var _0x495325={};_0x495325[_0x2b0559['name']]={'$like':'%'+_0x437c08[_0xdcdc('0x2f')][_0xdcdc('0x3f')]+'%'};return _0x495325;}})});}_0x51ef32=_[_0xdcdc('0x3c')]({},_0x51ef32,_0x437c08['options']);var _0x201883={'where':_0x51ef32[_0xdcdc('0x3a')]};return db[_0xdcdc('0x2a')]['count'](_0x201883)[_0xdcdc('0x24')](function(_0x24cc82){_0x2957da['count']=_0x24cc82;if(_0x437c08[_0xdcdc('0x2f')]['includeAll']){_0x51ef32[_0xdcdc('0x40')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xdcdc('0x41')](_0x51ef32);})[_0xdcdc('0x24')](function(_0x108ce0){_0x2957da['rows']=_0x108ce0;return _0x2957da;})[_0xdcdc('0x24')](respondWithFilteredResult(_0x910b70,_0x51ef32))[_0xdcdc('0x42')](handleError(_0x910b70,null));};exports[_0xdcdc('0x43')]=function(_0x7afad0,_0x46f8f5){var _0x1a64c1={'raw':![],'where':{'id':_0x7afad0['params']['id']}},_0x1ed057={};_0x1ed057[_0xdcdc('0x2d')]=_[_0xdcdc('0x30')](db['DeskConfiguration'][_0xdcdc('0x44')]);_0x1ed057['query']=_[_0xdcdc('0x30')](_0x7afad0[_0xdcdc('0x2f')]);_0x1ed057[_0xdcdc('0x31')]=_[_0xdcdc('0x32')](_0x1ed057['model'],_0x1ed057['query']);_0x1a64c1[_0xdcdc('0x33')]=_[_0xdcdc('0x32')](_0x1ed057[_0xdcdc('0x2d')],qs[_0xdcdc('0x34')](_0x7afad0[_0xdcdc('0x2f')][_0xdcdc('0x34')]));_0x1a64c1[_0xdcdc('0x33')]=_0x1a64c1[_0xdcdc('0x33')][_0xdcdc('0x35')]?_0x1a64c1['attributes']:_0x1ed057[_0xdcdc('0x2d')];if(_0x7afad0[_0xdcdc('0x2f')][_0xdcdc('0x45')]){_0x1a64c1[_0xdcdc('0x40')]=[{'all':!![]}];}_0x1a64c1=_['merge']({},_0x1a64c1,_0x7afad0[_0xdcdc('0x46')]);return db['DeskConfiguration'][_0xdcdc('0x47')](_0x1a64c1)[_0xdcdc('0x24')](handleEntityNotFound(_0x46f8f5,null))[_0xdcdc('0x24')](respondWithResult(_0x46f8f5,null))[_0xdcdc('0x42')](handleError(_0x46f8f5,null));};exports['create']=function(_0x384fd5,_0x2e3911){return db[_0xdcdc('0x2a')][_0xdcdc('0x48')](_0x384fd5[_0xdcdc('0x49')],{})[_0xdcdc('0x24')](respondWithResult(_0x2e3911,0xc9))['catch'](handleError(_0x2e3911,null));};exports[_0xdcdc('0x4a')]=function(_0x50946d,_0x4fd0ac){if(_0x50946d[_0xdcdc('0x49')]['id']){delete _0x50946d['body']['id'];}return db[_0xdcdc('0x2a')][_0xdcdc('0x47')]({'where':{'id':_0x50946d[_0xdcdc('0x4b')]['id']}})[_0xdcdc('0x24')](handleEntityNotFound(_0x4fd0ac,null))[_0xdcdc('0x24')](saveUpdates(_0x50946d[_0xdcdc('0x49')],null))[_0xdcdc('0x24')](respondWithResult(_0x4fd0ac,null))['catch'](handleError(_0x4fd0ac,null));};exports['destroy']=function(_0x4ec963,_0x569e5d){return db[_0xdcdc('0x2a')]['find']({'where':{'id':_0x4ec963[_0xdcdc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x569e5d,null))[_0xdcdc('0x24')](removeEntity(_0x569e5d,null))[_0xdcdc('0x42')](handleError(_0x569e5d,null));};exports['getFields']=function(_0x571a91,_0x16ce81,_0x2e6809){var _0x272d82={};var _0x49be6b={};var _0x57a7c4;var _0x26ba71;return db[_0xdcdc('0x2a')][_0xdcdc('0x4c')]({'where':{'id':_0x571a91[_0xdcdc('0x4b')]['id']}})[_0xdcdc('0x24')](handleEntityNotFound(_0x16ce81,null))['then'](function(_0x586d05){if(_0x586d05){_0x57a7c4=_0x586d05;_0x49be6b[_0xdcdc('0x2d')]=_[_0xdcdc('0x30')](db['DeskField']['rawAttributes']);_0x49be6b[_0xdcdc('0x2f')]=_[_0xdcdc('0x30')](_0x571a91[_0xdcdc('0x2f')]);_0x49be6b[_0xdcdc('0x31')]=_[_0xdcdc('0x32')](_0x49be6b['model'],_0x49be6b[_0xdcdc('0x2f')]);_0x272d82['attributes']=_[_0xdcdc('0x32')](_0x49be6b[_0xdcdc('0x2d')],qs[_0xdcdc('0x34')](_0x571a91[_0xdcdc('0x2f')][_0xdcdc('0x34')]));_0x272d82[_0xdcdc('0x33')]=_0x272d82[_0xdcdc('0x33')]['length']?_0x272d82['attributes']:_0x49be6b[_0xdcdc('0x2d')];_0x272d82[_0xdcdc('0x38')]=qs['sort'](_0x571a91[_0xdcdc('0x2f')][_0xdcdc('0x39')]);_0x272d82['where']=qs[_0xdcdc('0x31')](_['pick'](_0x571a91[_0xdcdc('0x2f')],_0x49be6b['filters']));if(_0x571a91[_0xdcdc('0x2f')][_0xdcdc('0x3f')]){_0x272d82[_0xdcdc('0x3a')]=_[_0xdcdc('0x3c')](_0x272d82['where'],{'$or':_[_0xdcdc('0x2e')](_0x272d82[_0xdcdc('0x33')],function(_0x44aab9){var _0xf43928={};_0xf43928[_0x44aab9]={'$like':'%'+_0x571a91['query'][_0xdcdc('0x3f')]+'%'};return _0xf43928;})});}_0x272d82=_[_0xdcdc('0x3c')]({},_0x272d82,_0x571a91[_0xdcdc('0x46')]);return _0x57a7c4['getFields'](_0x272d82);}})['then'](function(_0x5d74d2){if(_0x5d74d2){_0x26ba71=_0x5d74d2[_0xdcdc('0x35')];if(!_0x571a91[_0xdcdc('0x2f')]['hasOwnProperty']('nolimit')){_0x272d82[_0xdcdc('0x1d')]=qs[_0xdcdc('0x1d')](_0x571a91['query'][_0xdcdc('0x1d')]);_0x272d82[_0xdcdc('0x1b')]=qs[_0xdcdc('0x1b')](_0x571a91[_0xdcdc('0x2f')]['offset']);}return _0x57a7c4[_0xdcdc('0x4d')](_0x272d82);}})['then'](function(_0x18b8d7){if(_0x18b8d7){return _0x18b8d7?{'count':_0x26ba71,'rows':_0x18b8d7}:null;}})[_0xdcdc('0x24')](respondWithResult(_0x16ce81,null))[_0xdcdc('0x42')](handleError(_0x16ce81,null));};exports[_0xdcdc('0x4e')]=function(_0x33a613,_0x961729,_0xae5541){var _0x1bb098={};var _0x3a130d={};var _0x115771;var _0x14706b;return db['DeskConfiguration'][_0xdcdc('0x4c')]({'where':{'id':_0x33a613['params']['id']}})[_0xdcdc('0x24')](handleEntityNotFound(_0x961729,null))['then'](function(_0x50f32f){if(_0x50f32f){_0x115771=_0x50f32f;_0x3a130d['model']=_[_0xdcdc('0x30')](db[_0xdcdc('0x4f')][_0xdcdc('0x44')]);_0x3a130d[_0xdcdc('0x2f')]=_[_0xdcdc('0x30')](_0x33a613[_0xdcdc('0x2f')]);_0x3a130d[_0xdcdc('0x31')]=_['intersection'](_0x3a130d[_0xdcdc('0x2d')],_0x3a130d['query']);_0x1bb098[_0xdcdc('0x33')]=_[_0xdcdc('0x32')](_0x3a130d[_0xdcdc('0x2d')],qs[_0xdcdc('0x34')](_0x33a613['query'][_0xdcdc('0x34')]));_0x1bb098['attributes']=_0x1bb098[_0xdcdc('0x33')]['length']?_0x1bb098[_0xdcdc('0x33')]:_0x3a130d[_0xdcdc('0x2d')];_0x1bb098[_0xdcdc('0x38')]=qs[_0xdcdc('0x39')](_0x33a613['query']['sort']);_0x1bb098['where']=qs[_0xdcdc('0x31')](_[_0xdcdc('0x3b')](_0x33a613[_0xdcdc('0x2f')],_0x3a130d[_0xdcdc('0x31')]));if(_0x33a613[_0xdcdc('0x2f')]['filter']){_0x1bb098[_0xdcdc('0x3a')]=_[_0xdcdc('0x3c')](_0x1bb098['where'],{'$or':_['map'](_0x1bb098[_0xdcdc('0x33')],function(_0x518581){var _0xa7457f={};_0xa7457f[_0x518581]={'$like':'%'+_0x33a613[_0xdcdc('0x2f')][_0xdcdc('0x3f')]+'%'};return _0xa7457f;})});}_0x1bb098=_['merge']({},_0x1bb098,_0x33a613[_0xdcdc('0x46')]);return _0x115771[_0xdcdc('0x4e')](_0x1bb098);}})['then'](function(_0x23133f){if(_0x23133f){_0x14706b=_0x23133f[_0xdcdc('0x35')];if(!_0x33a613['query'][_0xdcdc('0x36')](_0xdcdc('0x37'))){_0x1bb098[_0xdcdc('0x1d')]=qs[_0xdcdc('0x1d')](_0x33a613[_0xdcdc('0x2f')]['limit']);_0x1bb098['offset']=qs[_0xdcdc('0x1b')](_0x33a613[_0xdcdc('0x2f')][_0xdcdc('0x1b')]);}return _0x115771[_0xdcdc('0x4e')](_0x1bb098);}})[_0xdcdc('0x24')](function(_0x26596a){if(_0x26596a){return _0x26596a?{'count':_0x14706b,'rows':_0x26596a}:null;}})[_0xdcdc('0x24')](respondWithResult(_0x961729,null))['catch'](handleError(_0x961729,null));};exports[_0xdcdc('0x50')]=function(_0x1263ca,_0x103902,_0x15c800){var _0x4940d8={};var _0x129fb7={};var _0x8d0f12;var _0x19e66f;return db[_0xdcdc('0x2a')][_0xdcdc('0x4c')]({'where':{'id':_0x1263ca[_0xdcdc('0x4b')]['id']}})[_0xdcdc('0x24')](handleEntityNotFound(_0x103902,null))[_0xdcdc('0x24')](function(_0x51f945){if(_0x51f945){_0x8d0f12=_0x51f945;_0x129fb7[_0xdcdc('0x2d')]=_[_0xdcdc('0x30')](db[_0xdcdc('0x4f')]['rawAttributes']);_0x129fb7[_0xdcdc('0x2f')]=_['keys'](_0x1263ca['query']);_0x129fb7[_0xdcdc('0x31')]=_[_0xdcdc('0x32')](_0x129fb7[_0xdcdc('0x2d')],_0x129fb7[_0xdcdc('0x2f')]);_0x4940d8['attributes']=_[_0xdcdc('0x32')](_0x129fb7[_0xdcdc('0x2d')],qs[_0xdcdc('0x34')](_0x1263ca['query'][_0xdcdc('0x34')]));_0x4940d8[_0xdcdc('0x33')]=_0x4940d8[_0xdcdc('0x33')][_0xdcdc('0x35')]?_0x4940d8[_0xdcdc('0x33')]:_0x129fb7[_0xdcdc('0x2d')];_0x4940d8['order']=qs[_0xdcdc('0x39')](_0x1263ca[_0xdcdc('0x2f')][_0xdcdc('0x39')]);_0x4940d8[_0xdcdc('0x3a')]=qs['filters'](_[_0xdcdc('0x3b')](_0x1263ca[_0xdcdc('0x2f')],_0x129fb7['filters']));if(_0x1263ca[_0xdcdc('0x2f')]['filter']){_0x4940d8[_0xdcdc('0x3a')]=_[_0xdcdc('0x3c')](_0x4940d8[_0xdcdc('0x3a')],{'$or':_[_0xdcdc('0x2e')](_0x4940d8[_0xdcdc('0x33')],function(_0x2170cd){var _0x557929={};_0x557929[_0x2170cd]={'$like':'%'+_0x1263ca[_0xdcdc('0x2f')][_0xdcdc('0x3f')]+'%'};return _0x557929;})});}_0x4940d8=_[_0xdcdc('0x3c')]({},_0x4940d8,_0x1263ca['options']);return _0x8d0f12['getDescriptions'](_0x4940d8);}})[_0xdcdc('0x24')](function(_0xf80770){if(_0xf80770){_0x19e66f=_0xf80770['length'];if(!_0x1263ca['query'][_0xdcdc('0x36')](_0xdcdc('0x37'))){_0x4940d8[_0xdcdc('0x1d')]=qs[_0xdcdc('0x1d')](_0x1263ca[_0xdcdc('0x2f')][_0xdcdc('0x1d')]);_0x4940d8[_0xdcdc('0x1b')]=qs['offset'](_0x1263ca[_0xdcdc('0x2f')]['offset']);}return _0x8d0f12[_0xdcdc('0x50')](_0x4940d8);}})[_0xdcdc('0x24')](function(_0x502a59){if(_0x502a59){return _0x502a59?{'count':_0x19e66f,'rows':_0x502a59}:null;}})['then'](respondWithResult(_0x103902,null))[_0xdcdc('0x42')](handleError(_0x103902,null));};exports[_0xdcdc('0x51')]=function(_0x4841aa,_0x2ddae9,_0x5cdb15){var _0x8cb0f3={};var _0x14c372={};var _0x1448bb;var _0x1eba43;return db[_0xdcdc('0x2a')][_0xdcdc('0x4c')]({'where':{'id':_0x4841aa[_0xdcdc('0x4b')]['id']}})[_0xdcdc('0x24')](handleEntityNotFound(_0x2ddae9,null))['then'](function(_0x54ce46){if(_0x54ce46){_0x1448bb=_0x54ce46;_0x14c372[_0xdcdc('0x2d')]=_[_0xdcdc('0x30')](db[_0xdcdc('0x52')][_0xdcdc('0x44')]);_0x14c372[_0xdcdc('0x2f')]=_[_0xdcdc('0x30')](_0x4841aa[_0xdcdc('0x2f')]);_0x14c372[_0xdcdc('0x31')]=_[_0xdcdc('0x32')](_0x14c372[_0xdcdc('0x2d')],_0x14c372[_0xdcdc('0x2f')]);_0x8cb0f3['attributes']=_[_0xdcdc('0x32')](_0x14c372['model'],qs[_0xdcdc('0x34')](_0x4841aa[_0xdcdc('0x2f')][_0xdcdc('0x34')]));_0x8cb0f3['attributes']=_0x8cb0f3[_0xdcdc('0x33')]['length']?_0x8cb0f3[_0xdcdc('0x33')]:_0x14c372[_0xdcdc('0x2d')];_0x8cb0f3[_0xdcdc('0x38')]=qs[_0xdcdc('0x39')](_0x4841aa['query'][_0xdcdc('0x39')]);_0x8cb0f3[_0xdcdc('0x3a')]=qs[_0xdcdc('0x31')](_[_0xdcdc('0x3b')](_0x4841aa[_0xdcdc('0x2f')],_0x14c372[_0xdcdc('0x31')]));if(_0x4841aa['query'][_0xdcdc('0x3f')]){_0x8cb0f3['where']=_[_0xdcdc('0x3c')](_0x8cb0f3[_0xdcdc('0x3a')],{'$or':_[_0xdcdc('0x2e')](_0x8cb0f3[_0xdcdc('0x33')],function(_0x308722){var _0x3bf90e={};_0x3bf90e[_0x308722]={'$like':'%'+_0x4841aa[_0xdcdc('0x2f')]['filter']+'%'};return _0x3bf90e;})});}_0x8cb0f3=_['merge']({},_0x8cb0f3,_0x4841aa[_0xdcdc('0x46')]);return _0x1448bb[_0xdcdc('0x51')](_0x8cb0f3);}})[_0xdcdc('0x24')](function(_0x222e25){if(_0x222e25){_0x1eba43=_0x222e25['length'];if(!_0x4841aa[_0xdcdc('0x2f')]['hasOwnProperty']('nolimit')){_0x8cb0f3[_0xdcdc('0x1d')]=qs[_0xdcdc('0x1d')](_0x4841aa[_0xdcdc('0x2f')][_0xdcdc('0x1d')]);_0x8cb0f3[_0xdcdc('0x1b')]=qs[_0xdcdc('0x1b')](_0x4841aa[_0xdcdc('0x2f')][_0xdcdc('0x1b')]);}return _0x1448bb[_0xdcdc('0x51')](_0x8cb0f3);}})[_0xdcdc('0x24')](function(_0x530c5b){if(_0x530c5b){return _0x530c5b?{'count':_0x1eba43,'rows':_0x530c5b}:null;}})[_0xdcdc('0x24')](respondWithResult(_0x2ddae9,null))[_0xdcdc('0x42')](handleError(_0x2ddae9,null));};exports[_0xdcdc('0x53')]=function(_0x5d7471,_0x36b3ba,_0xd124c3){if(_0x5d7471[_0xdcdc('0x49')]['id']){delete _0x5d7471[_0xdcdc('0x49')]['id'];}return db[_0xdcdc('0x2a')]['findOne']({'where':{'id':_0x5d7471[_0xdcdc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36b3ba,null))[_0xdcdc('0x24')](function(_0x7df5bd){if(_0x7df5bd){return _0x7df5bd[_0xdcdc('0x53')](_0x5d7471[_0xdcdc('0x49')]['ids']||[]);}return null;})[_0xdcdc('0x24')](respondWithResult(_0x36b3ba,null))['catch'](handleError(_0x36b3ba,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 00d336e..55cec60 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 _0x24f1=['../../config/logger','api','moment','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x5a7dc1,_0x5c1fc5){var _0x54aeeb=function(_0x506f15){while(--_0x506f15){_0x5a7dc1['push'](_0x5a7dc1['shift']());}};_0x54aeeb(++_0x5c1fc5);}(_0x24f1,0xf0));var _0x124f=function(_0x20e882,_0x16185c){_0x20e882=_0x20e882-0x0;var _0x3e0dbe=_0x24f1[_0x20e882];return _0x3e0dbe;};'use strict';var _=require(_0x124f('0x0'));var util=require(_0x124f('0x1'));var logger=require(_0x124f('0x2'))(_0x124f('0x3'));var moment=require(_0x124f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x124f('0x5'));var config=require('../../config/environment');var attributes=require(_0x124f('0x6'));module[_0x124f('0x7')]=function(_0x347deb,_0x545f15){return _0x347deb[_0x124f('0x8')](_0x124f('0x9'),attributes,{'tableName':_0x124f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9929=['define','int_desk_configurations','lodash','moment','bluebird','request-promise','path','./intDeskConfiguration.attributes'];(function(_0x150d64,_0x43c935){var _0x4258e5=function(_0xb9d870){while(--_0xb9d870){_0x150d64['push'](_0x150d64['shift']());}};_0x4258e5(++_0x43c935);}(_0x9929,0x112));var _0x9992=function(_0x4e725b,_0x143ef9){_0x4e725b=_0x4e725b-0x0;var _0x543442=_0x9929[_0x4e725b];return _0x543442;};'use strict';var _=require(_0x9992('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9992('0x1'));var BPromise=require(_0x9992('0x2'));var rp=require(_0x9992('0x3'));var fs=require('fs');var path=require(_0x9992('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9992('0x5'));module['exports']=function(_0x2ccb01,_0x4231fd){return _0x2ccb01[_0x9992('0x6')]('DeskConfiguration',attributes,{'tableName':_0x9992('0x7'),'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 7e9bbfa..6b9f88a 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 _0xa0a3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','randomstring','ioredis'];(function(_0x22e735,_0x414f00){var _0x20a162=function(_0x233038){while(--_0x233038){_0x22e735['push'](_0x22e735['shift']());}};_0x20a162(++_0x414f00);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x5c35a6,_0x5b1729){_0x5c35a6=_0x5c35a6-0x0;var _0x2e0707=_0xa0a3[_0x5c35a6];return _0x2e0707;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var moment=require(_0x3a0a('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a0a('0x2'));var fs=require('fs');var Redis=require(_0x3a0a('0x3'));var db=require(_0x3a0a('0x4'))['db'];var utils=require(_0x3a0a('0x5'));var logger=require(_0x3a0a('0x6'))(_0x3a0a('0x7'));var config=require(_0x3a0a('0x8'));var jayson=require(_0x3a0a('0x9'));var client=jayson[_0x3a0a('0xa')][_0x3a0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4719d,_0x451873,_0x1766c1){return new BPromise(function(_0x5d98d3,_0x56ee1b){return client[_0x3a0a('0xc')](_0x4719d,_0x1766c1)[_0x3a0a('0xd')](function(_0x29207e){logger[_0x3a0a('0xe')](_0x3a0a('0xf'),_0x451873,_0x3a0a('0x10'));logger[_0x3a0a('0x11')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x451873,'request\x20sent',JSON[_0x3a0a('0x12')](_0x29207e));if(_0x29207e[_0x3a0a('0x13')]){if(_0x29207e['error']['code']===0x1f4){logger[_0x3a0a('0x13')](_0x3a0a('0xf'),_0x451873,_0x29207e['error'][_0x3a0a('0x14')]);return _0x56ee1b(_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);}logger[_0x3a0a('0x13')](_0x3a0a('0xf'),_0x451873,_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);return _0x5d98d3(_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);}else{logger[_0x3a0a('0xe')](_0x3a0a('0xf'),_0x451873,_0x3a0a('0x10'));_0x5d98d3(_0x29207e[_0x3a0a('0x15')][_0x3a0a('0x14')]);}})['catch'](function(_0x41a6b0){logger['error'](_0x3a0a('0xf'),_0x451873,_0x41a6b0);_0x56ee1b(_0x41a6b0);});});} \ No newline at end of file +var _0x9648=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','moment','randomstring','ioredis'];(function(_0x2590c7,_0x4eea69){var _0x4c7e7a=function(_0x509d88){while(--_0x509d88){_0x2590c7['push'](_0x2590c7['shift']());}};_0x4c7e7a(++_0x4eea69);}(_0x9648,0xa4));var _0x8964=function(_0x371db9,_0x442aeb){_0x371db9=_0x371db9-0x0;var _0x4664d1=_0x9648[_0x371db9];return _0x4664d1;};'use strict';var _=require(_0x8964('0x0'));var util=require('util');var moment=require(_0x8964('0x1'));var BPromise=require('bluebird');var rs=require(_0x8964('0x2'));var fs=require('fs');var Redis=require(_0x8964('0x3'));var db=require(_0x8964('0x4'))['db'];var utils=require(_0x8964('0x5'));var logger=require('../../config/logger')(_0x8964('0x6'));var config=require(_0x8964('0x7'));var jayson=require(_0x8964('0x8'));var client=jayson[_0x8964('0x9')][_0x8964('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27c139,_0x54fea9,_0x13b24f){return new BPromise(function(_0x11bf9a,_0x4a04b7){return client[_0x8964('0xb')](_0x27c139,_0x13b24f)['then'](function(_0x35dfef){logger['info'](_0x8964('0xc'),_0x54fea9,_0x8964('0xd'));logger[_0x8964('0xe')](_0x8964('0xf'),_0x54fea9,_0x8964('0xd'),JSON[_0x8964('0x10')](_0x35dfef));if(_0x35dfef[_0x8964('0x11')]){if(_0x35dfef[_0x8964('0x11')][_0x8964('0x12')]===0x1f4){logger[_0x8964('0x11')](_0x8964('0xc'),_0x54fea9,_0x35dfef[_0x8964('0x11')][_0x8964('0x13')]);return _0x4a04b7(_0x35dfef[_0x8964('0x11')][_0x8964('0x13')]);}logger[_0x8964('0x11')](_0x8964('0xc'),_0x54fea9,_0x35dfef[_0x8964('0x11')][_0x8964('0x13')]);return _0x11bf9a(_0x35dfef['error'][_0x8964('0x13')]);}else{logger[_0x8964('0x14')](_0x8964('0xc'),_0x54fea9,_0x8964('0xd'));_0x11bf9a(_0x35dfef['result'][_0x8964('0x13')]);}})['catch'](function(_0x5004f4){logger[_0x8964('0x11')](_0x8964('0xc'),_0x54fea9,_0x5004f4);_0x4a04b7(_0x5004f4);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ad017da..6918ef1 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 _0x1346=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index'];(function(_0x325339,_0x452225){var _0x335ff4=function(_0x5ddd8e){while(--_0x5ddd8e){_0x325339['push'](_0x325339['shift']());}};_0x335ff4(++_0x452225);}(_0x1346,0x95));var _0x6134=function(_0x22da0a,_0x429994){_0x22da0a=_0x22da0a-0x0;var _0xd38706=_0x1346[_0x22da0a];return _0xd38706;};'use strict';var multer=require('multer');var util=require(_0x6134('0x0'));var path=require(_0x6134('0x1'));var timeout=require('connect-timeout');var express=require(_0x6134('0x2'));var router=express[_0x6134('0x3')]();var fs_extra=require(_0x6134('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6134('0x5'));var config=require(_0x6134('0x6'));var controller=require(_0x6134('0x7'));router[_0x6134('0x8')]('/',auth[_0x6134('0x9')](),controller[_0x6134('0xa')]);router[_0x6134('0x8')](_0x6134('0xb'),auth['isAuthenticated'](),controller[_0x6134('0xc')]);router[_0x6134('0xd')]('/',auth['isAuthenticated'](),controller[_0x6134('0xe')]);router[_0x6134('0xf')](_0x6134('0xb'),auth[_0x6134('0x9')](),controller[_0x6134('0x10')]);router[_0x6134('0x11')]('/:id',auth[_0x6134('0x9')](),controller[_0x6134('0x12')]);module[_0x6134('0x13')]=router; \ No newline at end of file +var _0xa7db=['./intDeskField.controller','isAuthenticated','index','get','/:id','show','create','put','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x43fd44,_0x1286aa){var _0x1832ce=function(_0xb145ea){while(--_0xb145ea){_0x43fd44['push'](_0x43fd44['shift']());}};_0x1832ce(++_0x1286aa);}(_0xa7db,0xbf));var _0xba7d=function(_0x5dc97b,_0x5be55e){_0x5dc97b=_0x5dc97b-0x0;var _0x389928=_0xa7db[_0x5dc97b];return _0x389928;};'use strict';var multer=require(_0xba7d('0x0'));var util=require(_0xba7d('0x1'));var path=require(_0xba7d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xba7d('0x3'));var auth=require(_0xba7d('0x4'));var interaction=require(_0xba7d('0x5'));var config=require(_0xba7d('0x6'));var controller=require(_0xba7d('0x7'));router['get']('/',auth[_0xba7d('0x8')](),controller[_0xba7d('0x9')]);router[_0xba7d('0xa')](_0xba7d('0xb'),auth[_0xba7d('0x8')](),controller[_0xba7d('0xc')]);router['post']('/',auth[_0xba7d('0x8')](),controller[_0xba7d('0xd')]);router[_0xba7d('0xe')](_0xba7d('0xb'),auth[_0xba7d('0x8')](),controller['update']);router[_0xba7d('0xf')](_0xba7d('0xb'),auth['isAuthenticated'](),controller[_0xba7d('0x10')]);module[_0xba7d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 90fcd59..5dd3e4e 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 _0x7be5=['string','STRING','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x30b5fb,_0x5dfb37){var _0x1bbd69=function(_0x2988fc){while(--_0x2988fc){_0x30b5fb['push'](_0x30b5fb['shift']());}};_0x1bbd69(++_0x5dfb37);}(_0x7be5,0xa2));var _0x57be=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7be5[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x57be('0x0')]={'type':{'type':Sequelize[_0x57be('0x1')]('string',_0x57be('0x2'),_0x57be('0x3'),_0x57be('0x4'),_0x57be('0x5')),'defaultValue':_0x57be('0x6')},'content':{'type':Sequelize[_0x57be('0x7')]},'key':{'type':Sequelize[_0x57be('0x7')]},'keyType':{'type':Sequelize[_0x57be('0x1')](_0x57be('0x6'),_0x57be('0x2'),_0x57be('0x3'))},'keyContent':{'type':Sequelize[_0x57be('0x7')]},'idField':{'type':Sequelize[_0x57be('0x7')]},'nameField':{'type':Sequelize[_0x57be('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x57be('0x7')]}}; \ No newline at end of file +var _0x63fc=['ENUM','string','customVariable','picklist','STRING','BOOLEAN','exports'];(function(_0x17347d,_0x546f88){var _0xb6e42f=function(_0x58fdd8){while(--_0x58fdd8){_0x17347d['push'](_0x17347d['shift']());}};_0xb6e42f(++_0x546f88);}(_0x63fc,0x92));var _0xc63f=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x63fc[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require('sequelize');module[_0xc63f('0x0')]={'type':{'type':Sequelize[_0xc63f('0x1')](_0xc63f('0x2'),'variable',_0xc63f('0x3'),'keyValue',_0xc63f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc63f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc63f('0x1')]('string','variable',_0xc63f('0x3'))},'keyContent':{'type':Sequelize[_0xc63f('0x5')]},'idField':{'type':Sequelize[_0xc63f('0x5')]},'nameField':{'type':Sequelize[_0xc63f('0x5')]},'customField':{'type':Sequelize[_0xc63f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index ec78ea8..a1f5f50 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 _0x103f=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','update','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','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','index','DeskField','rawAttributes','fieldName','keys','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','type'];(function(_0x3b8c97,_0x55e350){var _0x2d94e1=function(_0x3bcbd3){while(--_0x3bcbd3){_0x3b8c97['push'](_0x3b8c97['shift']());}};_0x2d94e1(++_0x55e350);}(_0x103f,0x13e));var _0xf103=function(_0x3944a0,_0x367152){_0x3944a0=_0x3944a0-0x0;var _0x1c9ee9=_0x103f[_0x3944a0];return _0x1c9ee9;};'use strict';var emlformat=require(_0xf103('0x0'));var rimraf=require(_0xf103('0x1'));var zipdir=require(_0xf103('0x2'));var jsonpatch=require(_0xf103('0x3'));var rp=require(_0xf103('0x4'));var moment=require(_0xf103('0x5'));var BPromise=require(_0xf103('0x6'));var Mustache=require(_0xf103('0x7'));var util=require(_0xf103('0x8'));var path=require(_0xf103('0x9'));var sox=require('sox');var csv=require(_0xf103('0xa'));var ejs=require(_0xf103('0xb'));var fs=require('fs');var fs_extra=require(_0xf103('0xc'));var _=require(_0xf103('0xd'));var squel=require(_0xf103('0xe'));var crypto=require(_0xf103('0xf'));var jsforce=require(_0xf103('0x10'));var deskjs=require(_0xf103('0x11'));var toCsv=require(_0xf103('0xa'));var querystring=require(_0xf103('0x12'));var Papa=require(_0xf103('0x13'));var Redis=require(_0xf103('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf103('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf103('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xf103('0x17'));var config=require(_0xf103('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf103('0x19'))['db'];function respondWithStatusCode(_0x568960,_0x5735d1){_0x5735d1=_0x5735d1||0xcc;return function(_0x4e7ec5){if(_0x4e7ec5){return _0x568960[_0xf103('0x1a')](_0x5735d1);}return _0x568960['status'](_0x5735d1)[_0xf103('0x1b')]();};}function respondWithResult(_0x1e8765,_0x55ec64){_0x55ec64=_0x55ec64||0xc8;return function(_0x189a41){if(_0x189a41){return _0x1e8765[_0xf103('0x1c')](_0x55ec64)['json'](_0x189a41);}};}function respondWithFilteredResult(_0x1de2a8,_0x299ddf){return function(_0x5bf405){if(_0x5bf405){var _0x13be78=typeof _0x299ddf['offset']==='undefined'&&typeof _0x299ddf[_0xf103('0x1d')]===_0xf103('0x1e');var _0x31e26e=_0x5bf405[_0xf103('0x1f')];var _0x1659fa=_0x13be78?0x0:_0x299ddf[_0xf103('0x20')];var _0x5a2e85=_0x13be78?_0x5bf405[_0xf103('0x1f')]:_0x299ddf[_0xf103('0x20')]+_0x299ddf['limit'];var _0x21ea69;if(_0x5a2e85>=_0x31e26e){_0x5a2e85=_0x31e26e;_0x21ea69=0xc8;}else{_0x21ea69=0xce;}_0x1de2a8[_0xf103('0x1c')](_0x21ea69);return _0x1de2a8[_0xf103('0x21')](_0xf103('0x22'),_0x1659fa+'-'+_0x5a2e85+'/'+_0x31e26e)[_0xf103('0x23')](_0x5bf405);}return null;};}function patchUpdates(_0x5d28e9){return function(_0x32aaa5){try{jsonpatch[_0xf103('0x24')](_0x32aaa5,_0x5d28e9,!![]);}catch(_0x467b15){return BPromise[_0xf103('0x25')](_0x467b15);}return _0x32aaa5[_0xf103('0x26')]();};}function saveUpdates(_0x319c49,_0x3607ce){return function(_0x111e83){if(_0x111e83){return _0x111e83['update'](_0x319c49)[_0xf103('0x27')](function(_0x4fab08){return _0x4fab08;});}return null;};}function removeEntity(_0x470479,_0x4d1752){return function(_0x3a8d9e){if(_0x3a8d9e){return _0x3a8d9e[_0xf103('0x28')]()[_0xf103('0x27')](function(){_0x470479[_0xf103('0x1c')](0xcc)[_0xf103('0x1b')]();});}};}function handleEntityNotFound(_0x297198,_0x23a122){return function(_0x259797){if(!_0x259797){_0x297198['sendStatus'](0x194);}return _0x259797;};}function handleError(_0x2c415a,_0x4bdc52){_0x4bdc52=_0x4bdc52||0x1f4;return function(_0x259fdc){logger['error'](_0x259fdc[_0xf103('0x29')]);if(_0x259fdc[_0xf103('0x2a')]){delete _0x259fdc[_0xf103('0x2a')];}_0x2c415a[_0xf103('0x1c')](_0x4bdc52)['send'](_0x259fdc);};}exports[_0xf103('0x2b')]=function(_0x1d3cdd,_0x14b6b7){var _0x5a1f81={},_0x4adf44={},_0x1b0a13={'count':0x0,'rows':[]};var _0x7ee263=_['map'](db[_0xf103('0x2c')][_0xf103('0x2d')],function(_0x2fab93){return{'name':_0x2fab93[_0xf103('0x2e')],'type':_0x2fab93['type']['key']};});_0x4adf44['model']=_['map'](_0x7ee263,_0xf103('0x2a'));_0x4adf44['query']=_[_0xf103('0x2f')](_0x1d3cdd[_0xf103('0x30')]);_0x4adf44[_0xf103('0x31')]=_['intersection'](_0x4adf44['model'],_0x4adf44[_0xf103('0x30')]);_0x5a1f81[_0xf103('0x32')]=_['intersection'](_0x4adf44[_0xf103('0x33')],qs[_0xf103('0x34')](_0x1d3cdd[_0xf103('0x30')][_0xf103('0x34')]));_0x5a1f81[_0xf103('0x32')]=_0x5a1f81[_0xf103('0x32')][_0xf103('0x35')]?_0x5a1f81[_0xf103('0x32')]:_0x4adf44[_0xf103('0x33')];if(!_0x1d3cdd[_0xf103('0x30')][_0xf103('0x36')](_0xf103('0x37'))){_0x5a1f81[_0xf103('0x1d')]=qs[_0xf103('0x1d')](_0x1d3cdd[_0xf103('0x30')][_0xf103('0x1d')]);_0x5a1f81[_0xf103('0x20')]=qs['offset'](_0x1d3cdd[_0xf103('0x30')][_0xf103('0x20')]);}_0x5a1f81[_0xf103('0x38')]=qs['sort'](_0x1d3cdd[_0xf103('0x30')]['sort']);_0x5a1f81['where']=qs[_0xf103('0x31')](_[_0xf103('0x39')](_0x1d3cdd[_0xf103('0x30')],_0x4adf44[_0xf103('0x31')]),_0x7ee263);if(_0x1d3cdd[_0xf103('0x30')][_0xf103('0x3a')]){_0x5a1f81[_0xf103('0x3b')]=_[_0xf103('0x3c')](_0x5a1f81[_0xf103('0x3b')],{'$or':_['map'](_0x7ee263,function(_0x3cd906){if(_0x3cd906[_0xf103('0x3d')]!==_0xf103('0x3e')){var _0x4a192c={};_0x4a192c[_0x3cd906[_0xf103('0x2a')]]={'$like':'%'+_0x1d3cdd[_0xf103('0x30')][_0xf103('0x3a')]+'%'};return _0x4a192c;}})});}_0x5a1f81=_['merge']({},_0x5a1f81,_0x1d3cdd[_0xf103('0x3f')]);var _0x7ff67a={'where':_0x5a1f81[_0xf103('0x3b')]};return db[_0xf103('0x2c')][_0xf103('0x1f')](_0x7ff67a)['then'](function(_0x4c22b2){_0x1b0a13[_0xf103('0x1f')]=_0x4c22b2;if(_0x1d3cdd[_0xf103('0x30')][_0xf103('0x40')]){_0x5a1f81[_0xf103('0x41')]=[{'all':!![]}];}return db[_0xf103('0x2c')][_0xf103('0x42')](_0x5a1f81);})[_0xf103('0x27')](function(_0x304ce2){_0x1b0a13[_0xf103('0x43')]=_0x304ce2;return _0x1b0a13;})[_0xf103('0x27')](respondWithFilteredResult(_0x14b6b7,_0x5a1f81))[_0xf103('0x44')](handleError(_0x14b6b7,null));};exports[_0xf103('0x45')]=function(_0x439cf4,_0x26df37){var _0x434a3a={'raw':!![],'where':{'id':_0x439cf4[_0xf103('0x46')]['id']}},_0x16ed02={};_0x16ed02['model']=_['keys'](db[_0xf103('0x2c')][_0xf103('0x2d')]);_0x16ed02['query']=_[_0xf103('0x2f')](_0x439cf4[_0xf103('0x30')]);_0x16ed02[_0xf103('0x31')]=_[_0xf103('0x47')](_0x16ed02[_0xf103('0x33')],_0x16ed02['query']);_0x434a3a[_0xf103('0x32')]=_[_0xf103('0x47')](_0x16ed02['model'],qs[_0xf103('0x34')](_0x439cf4[_0xf103('0x30')][_0xf103('0x34')]));_0x434a3a[_0xf103('0x32')]=_0x434a3a[_0xf103('0x32')]['length']?_0x434a3a['attributes']:_0x16ed02['model'];if(_0x439cf4['query'][_0xf103('0x40')]){_0x434a3a[_0xf103('0x41')]=[{'all':!![]}];}_0x434a3a=_[_0xf103('0x3c')]({},_0x434a3a,_0x439cf4[_0xf103('0x3f')]);return db[_0xf103('0x2c')][_0xf103('0x48')](_0x434a3a)[_0xf103('0x27')](handleEntityNotFound(_0x26df37,null))[_0xf103('0x27')](respondWithResult(_0x26df37,null))[_0xf103('0x44')](handleError(_0x26df37,null));};exports[_0xf103('0x49')]=function(_0x326562,_0x2f6cca){return db[_0xf103('0x2c')]['create'](_0x326562[_0xf103('0x4a')],{})[_0xf103('0x27')](respondWithResult(_0x2f6cca,0xc9))['catch'](handleError(_0x2f6cca,null));};exports[_0xf103('0x4b')]=function(_0x5209ac,_0x382217){if(_0x5209ac[_0xf103('0x4a')]['id']){delete _0x5209ac[_0xf103('0x4a')]['id'];}return db[_0xf103('0x2c')][_0xf103('0x48')]({'where':{'id':_0x5209ac['params']['id']}})[_0xf103('0x27')](handleEntityNotFound(_0x382217,null))['then'](saveUpdates(_0x5209ac[_0xf103('0x4a')],null))[_0xf103('0x27')](respondWithResult(_0x382217,null))['catch'](handleError(_0x382217,null));};exports['destroy']=function(_0x267e8f,_0x677aaf){return db[_0xf103('0x2c')][_0xf103('0x48')]({'where':{'id':_0x267e8f[_0xf103('0x46')]['id']}})['then'](handleEntityNotFound(_0x677aaf,null))[_0xf103('0x27')](removeEntity(_0x677aaf,null))[_0xf103('0x44')](handleError(_0x677aaf,null));}; \ No newline at end of file +var _0x7181=['index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x814110,_0x4eef08){var _0x43538e=function(_0x548fa2){while(--_0x548fa2){_0x814110['push'](_0x814110['shift']());}};_0x43538e(++_0x4eef08);}(_0x7181,0x1ef));var _0x1718=function(_0x8e9597,_0x2aa555){_0x8e9597=_0x8e9597-0x0;var _0x3be06a=_0x7181[_0x8e9597];return _0x3be06a;};'use strict';var emlformat=require(_0x1718('0x0'));var rimraf=require(_0x1718('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1718('0x2'));var BPromise=require(_0x1718('0x3'));var Mustache=require(_0x1718('0x4'));var util=require(_0x1718('0x5'));var path=require(_0x1718('0x6'));var sox=require(_0x1718('0x7'));var csv=require(_0x1718('0x8'));var ejs=require(_0x1718('0x9'));var fs=require('fs');var fs_extra=require(_0x1718('0xa'));var _=require(_0x1718('0xb'));var squel=require(_0x1718('0xc'));var crypto=require(_0x1718('0xd'));var jsforce=require(_0x1718('0xe'));var deskjs=require(_0x1718('0xf'));var toCsv=require(_0x1718('0x8'));var querystring=require(_0x1718('0x10'));var Papa=require('papaparse');var Redis=require(_0x1718('0x11'));var authService=require(_0x1718('0x12'));var qs=require(_0x1718('0x13'));var as=require(_0x1718('0x14'));var hardwareService=require(_0x1718('0x15'));var logger=require(_0x1718('0x16'))(_0x1718('0x17'));var utils=require(_0x1718('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1922f1,_0x2ea52e){_0x2ea52e=_0x2ea52e||0xcc;return function(_0x342145){if(_0x342145){return _0x1922f1[_0x1718('0x19')](_0x2ea52e);}return _0x1922f1[_0x1718('0x1a')](_0x2ea52e)[_0x1718('0x1b')]();};}function respondWithResult(_0x21abeb,_0xad3335){_0xad3335=_0xad3335||0xc8;return function(_0x527638){if(_0x527638){return _0x21abeb[_0x1718('0x1a')](_0xad3335)[_0x1718('0x1c')](_0x527638);}};}function respondWithFilteredResult(_0x57ba7d,_0x213954){return function(_0x399a6b){if(_0x399a6b){var _0x4506cb=typeof _0x213954['offset']==='undefined'&&typeof _0x213954[_0x1718('0x1d')]===_0x1718('0x1e');var _0x283c5d=_0x399a6b[_0x1718('0x1f')];var _0x4283c8=_0x4506cb?0x0:_0x213954[_0x1718('0x20')];var _0x338233=_0x4506cb?_0x399a6b[_0x1718('0x1f')]:_0x213954['offset']+_0x213954['limit'];var _0x2e3557;if(_0x338233>=_0x283c5d){_0x338233=_0x283c5d;_0x2e3557=0xc8;}else{_0x2e3557=0xce;}_0x57ba7d[_0x1718('0x1a')](_0x2e3557);return _0x57ba7d[_0x1718('0x21')](_0x1718('0x22'),_0x4283c8+'-'+_0x338233+'/'+_0x283c5d)[_0x1718('0x1c')](_0x399a6b);}return null;};}function patchUpdates(_0x5597e7){return function(_0x3d59b8){try{jsonpatch[_0x1718('0x23')](_0x3d59b8,_0x5597e7,!![]);}catch(_0x532972){return BPromise[_0x1718('0x24')](_0x532972);}return _0x3d59b8['save']();};}function saveUpdates(_0x1618e7,_0x489289){return function(_0x2fde41){if(_0x2fde41){return _0x2fde41[_0x1718('0x25')](_0x1618e7)[_0x1718('0x26')](function(_0x280bc0){return _0x280bc0;});}return null;};}function removeEntity(_0x356d96,_0x433bfa){return function(_0x36eeff){if(_0x36eeff){return _0x36eeff[_0x1718('0x27')]()[_0x1718('0x26')](function(){_0x356d96[_0x1718('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b766,_0x13d002){return function(_0x3e766d){if(!_0x3e766d){_0x29b766['sendStatus'](0x194);}return _0x3e766d;};}function handleError(_0x4c0b82,_0x582eed){_0x582eed=_0x582eed||0x1f4;return function(_0x3562e8){logger[_0x1718('0x28')](_0x3562e8[_0x1718('0x29')]);if(_0x3562e8[_0x1718('0x2a')]){delete _0x3562e8[_0x1718('0x2a')];}_0x4c0b82['status'](_0x582eed)[_0x1718('0x2b')](_0x3562e8);};}exports[_0x1718('0x2c')]=function(_0x4a1a9f,_0x5635fc){var _0x3133a0={},_0x4d36cd={},_0x38b243={'count':0x0,'rows':[]};var _0x2ebb92=_[_0x1718('0x2d')](db[_0x1718('0x2e')][_0x1718('0x2f')],function(_0x288e7d){return{'name':_0x288e7d[_0x1718('0x30')],'type':_0x288e7d[_0x1718('0x31')][_0x1718('0x32')]};});_0x4d36cd[_0x1718('0x33')]=_[_0x1718('0x2d')](_0x2ebb92,_0x1718('0x2a'));_0x4d36cd['query']=_[_0x1718('0x34')](_0x4a1a9f[_0x1718('0x35')]);_0x4d36cd[_0x1718('0x36')]=_[_0x1718('0x37')](_0x4d36cd[_0x1718('0x33')],_0x4d36cd[_0x1718('0x35')]);_0x3133a0[_0x1718('0x38')]=_['intersection'](_0x4d36cd[_0x1718('0x33')],qs[_0x1718('0x39')](_0x4a1a9f[_0x1718('0x35')][_0x1718('0x39')]));_0x3133a0['attributes']=_0x3133a0[_0x1718('0x38')][_0x1718('0x3a')]?_0x3133a0['attributes']:_0x4d36cd[_0x1718('0x33')];if(!_0x4a1a9f['query'][_0x1718('0x3b')]('nolimit')){_0x3133a0[_0x1718('0x1d')]=qs[_0x1718('0x1d')](_0x4a1a9f[_0x1718('0x35')][_0x1718('0x1d')]);_0x3133a0['offset']=qs[_0x1718('0x20')](_0x4a1a9f[_0x1718('0x35')][_0x1718('0x20')]);}_0x3133a0['order']=qs[_0x1718('0x3c')](_0x4a1a9f[_0x1718('0x35')][_0x1718('0x3c')]);_0x3133a0['where']=qs['filters'](_[_0x1718('0x3d')](_0x4a1a9f['query'],_0x4d36cd[_0x1718('0x36')]),_0x2ebb92);if(_0x4a1a9f['query'][_0x1718('0x3e')]){_0x3133a0[_0x1718('0x3f')]=_[_0x1718('0x40')](_0x3133a0[_0x1718('0x3f')],{'$or':_[_0x1718('0x2d')](_0x2ebb92,function(_0x5ad84b){if(_0x5ad84b[_0x1718('0x31')]!==_0x1718('0x41')){var _0x2fe13f={};_0x2fe13f[_0x5ad84b[_0x1718('0x2a')]]={'$like':'%'+_0x4a1a9f[_0x1718('0x35')][_0x1718('0x3e')]+'%'};return _0x2fe13f;}})});}_0x3133a0=_['merge']({},_0x3133a0,_0x4a1a9f[_0x1718('0x42')]);var _0x4b5a96={'where':_0x3133a0[_0x1718('0x3f')]};return db[_0x1718('0x2e')]['count'](_0x4b5a96)[_0x1718('0x26')](function(_0x135d47){_0x38b243[_0x1718('0x1f')]=_0x135d47;if(_0x4a1a9f[_0x1718('0x35')][_0x1718('0x43')]){_0x3133a0[_0x1718('0x44')]=[{'all':!![]}];}return db['DeskField'][_0x1718('0x45')](_0x3133a0);})[_0x1718('0x26')](function(_0x3c013a){_0x38b243[_0x1718('0x46')]=_0x3c013a;return _0x38b243;})['then'](respondWithFilteredResult(_0x5635fc,_0x3133a0))[_0x1718('0x47')](handleError(_0x5635fc,null));};exports[_0x1718('0x48')]=function(_0x3bcccf,_0x29113e){var _0x5aaf4c={'raw':!![],'where':{'id':_0x3bcccf['params']['id']}},_0x526bc5={};_0x526bc5['model']=_[_0x1718('0x34')](db[_0x1718('0x2e')][_0x1718('0x2f')]);_0x526bc5[_0x1718('0x35')]=_[_0x1718('0x34')](_0x3bcccf[_0x1718('0x35')]);_0x526bc5['filters']=_[_0x1718('0x37')](_0x526bc5[_0x1718('0x33')],_0x526bc5[_0x1718('0x35')]);_0x5aaf4c[_0x1718('0x38')]=_[_0x1718('0x37')](_0x526bc5[_0x1718('0x33')],qs[_0x1718('0x39')](_0x3bcccf[_0x1718('0x35')]['fields']));_0x5aaf4c[_0x1718('0x38')]=_0x5aaf4c[_0x1718('0x38')][_0x1718('0x3a')]?_0x5aaf4c['attributes']:_0x526bc5[_0x1718('0x33')];if(_0x3bcccf[_0x1718('0x35')][_0x1718('0x43')]){_0x5aaf4c[_0x1718('0x44')]=[{'all':!![]}];}_0x5aaf4c=_['merge']({},_0x5aaf4c,_0x3bcccf[_0x1718('0x42')]);return db['DeskField'][_0x1718('0x49')](_0x5aaf4c)[_0x1718('0x26')](handleEntityNotFound(_0x29113e,null))[_0x1718('0x26')](respondWithResult(_0x29113e,null))[_0x1718('0x47')](handleError(_0x29113e,null));};exports['create']=function(_0x2f6fc2,_0x2d55a0){return db[_0x1718('0x2e')][_0x1718('0x4a')](_0x2f6fc2[_0x1718('0x4b')],{})[_0x1718('0x26')](respondWithResult(_0x2d55a0,0xc9))[_0x1718('0x47')](handleError(_0x2d55a0,null));};exports[_0x1718('0x25')]=function(_0x3708f4,_0x328ab8){if(_0x3708f4[_0x1718('0x4b')]['id']){delete _0x3708f4['body']['id'];}return db[_0x1718('0x2e')][_0x1718('0x49')]({'where':{'id':_0x3708f4['params']['id']}})[_0x1718('0x26')](handleEntityNotFound(_0x328ab8,null))[_0x1718('0x26')](saveUpdates(_0x3708f4['body'],null))[_0x1718('0x26')](respondWithResult(_0x328ab8,null))[_0x1718('0x47')](handleError(_0x328ab8,null));};exports[_0x1718('0x27')]=function(_0x1f1951,_0x4c90cd){return db[_0x1718('0x2e')]['find']({'where':{'id':_0x1f1951[_0x1718('0x4c')]['id']}})[_0x1718('0x26')](handleEntityNotFound(_0x4c90cd,null))[_0x1718('0x26')](removeEntity(_0x4c90cd,null))[_0x1718('0x47')](handleError(_0x4c90cd,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 3b11f79..96f5783 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 _0x52f9=['bluebird','request-promise','path','rimraf','../../config/environment','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','api','moment'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x52f9,0x15b));var _0x952f=function(_0x25e7f1,_0x29059f){_0x25e7f1=_0x25e7f1-0x0;var _0x5d8c35=_0x52f9[_0x25e7f1];return _0x5d8c35;};'use strict';var _=require('lodash');var util=require(_0x952f('0x0'));var logger=require('../../config/logger')(_0x952f('0x1'));var moment=require(_0x952f('0x2'));var BPromise=require(_0x952f('0x3'));var rp=require(_0x952f('0x4'));var fs=require('fs');var path=require(_0x952f('0x5'));var rimraf=require(_0x952f('0x6'));var config=require(_0x952f('0x7'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x3fbc26,_0x188cbd){return _0x3fbc26[_0x952f('0x8')](_0x952f('0x9'),attributes,{'tableName':_0x952f('0xa'),'paranoid':![],'indexes':[{'name':_0x952f('0xb'),'fields':[_0x952f('0xc'),_0x952f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6758=['desk_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','path','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields'];(function(_0x15c542,_0xcdffd0){var _0x556314=function(_0x4488da){while(--_0x4488da){_0x15c542['push'](_0x15c542['shift']());}};_0x556314(++_0xcdffd0);}(_0x6758,0xb9));var _0x8675=function(_0x116f69,_0x158807){_0x116f69=_0x116f69-0x0;var _0x1b190c=_0x6758[_0x116f69];return _0x1b190c;};'use strict';var _=require('lodash');var util=require(_0x8675('0x0'));var logger=require(_0x8675('0x1'))('api');var moment=require(_0x8675('0x2'));var BPromise=require(_0x8675('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8675('0x4'));var rimraf=require('rimraf');var config=require(_0x8675('0x5'));var attributes=require(_0x8675('0x6'));module[_0x8675('0x7')]=function(_0x1f9832,_0x2e2a72){return _0x1f9832['define'](_0x8675('0x8'),attributes,{'tableName':_0x8675('0x9'),'paranoid':![],'indexes':[{'name':_0x8675('0xa'),'fields':[_0x8675('0xb'),_0x8675('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 62fa75a..7249ee9 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 _0x2bc8=['info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2bc8,0x127));var _0x82bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x82bc('0x0'));var moment=require(_0x82bc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82bc('0x2'));var db=require(_0x82bc('0x3'))['db'];var utils=require(_0x82bc('0x4'));var logger=require(_0x82bc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x82bc('0x6'));var client=jayson['client'][_0x82bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4de4de,_0x34dc7d,_0x2d0819){return new BPromise(function(_0x215675,_0x120e60){return client[_0x82bc('0x8')](_0x4de4de,_0x2d0819)['then'](function(_0x30b6f8){logger[_0x82bc('0x9')](_0x82bc('0xa'),_0x34dc7d,_0x82bc('0xb'));logger[_0x82bc('0xc')](_0x82bc('0xd'),_0x34dc7d,'request\x20sent',JSON[_0x82bc('0xe')](_0x30b6f8));if(_0x30b6f8['error']){if(_0x30b6f8['error']['code']===0x1f4){logger[_0x82bc('0xf')](_0x82bc('0xa'),_0x34dc7d,_0x30b6f8[_0x82bc('0xf')]['message']);return _0x120e60(_0x30b6f8[_0x82bc('0xf')][_0x82bc('0x10')]);}logger[_0x82bc('0xf')]('DeskField,\x20%s,\x20%s',_0x34dc7d,_0x30b6f8['error'][_0x82bc('0x10')]);return _0x215675(_0x30b6f8[_0x82bc('0xf')][_0x82bc('0x10')]);}else{logger[_0x82bc('0x9')](_0x82bc('0xa'),_0x34dc7d,_0x82bc('0xb'));_0x215675(_0x30b6f8[_0x82bc('0x11')][_0x82bc('0x10')]);}})[_0x82bc('0x12')](function(_0xcb27a2){logger[_0x82bc('0xf')](_0x82bc('0xa'),_0x34dc7d,_0xcb27a2);_0x120e60(_0xcb27a2);});});} \ No newline at end of file +var _0x5585=['stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x3db64f,_0x458cf6){var _0x1b6593=function(_0x1d1752){while(--_0x1d1752){_0x3db64f['push'](_0x3db64f['shift']());}};_0x1b6593(++_0x458cf6);}(_0x5585,0xf6));var _0x5558=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5585[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x5558('0x0'));var moment=require(_0x5558('0x1'));var BPromise=require(_0x5558('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5558('0x3'));var db=require(_0x5558('0x4'))['db'];var utils=require(_0x5558('0x5'));var logger=require(_0x5558('0x6'))(_0x5558('0x7'));var config=require(_0x5558('0x8'));var jayson=require(_0x5558('0x9'));var client=jayson['client'][_0x5558('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x518da6,_0x152785,_0x5524f1){return new BPromise(function(_0x2bda03,_0x50299a){return client[_0x5558('0xb')](_0x518da6,_0x5524f1)[_0x5558('0xc')](function(_0x3b1e4){logger[_0x5558('0xd')](_0x5558('0xe'),_0x152785,_0x5558('0xf'));logger[_0x5558('0x10')](_0x5558('0x11'),_0x152785,_0x5558('0xf'),JSON[_0x5558('0x12')](_0x3b1e4));if(_0x3b1e4[_0x5558('0x13')]){if(_0x3b1e4[_0x5558('0x13')][_0x5558('0x14')]===0x1f4){logger[_0x5558('0x13')](_0x5558('0xe'),_0x152785,_0x3b1e4[_0x5558('0x13')]['message']);return _0x50299a(_0x3b1e4[_0x5558('0x13')][_0x5558('0x15')]);}logger[_0x5558('0x13')](_0x5558('0xe'),_0x152785,_0x3b1e4[_0x5558('0x13')]['message']);return _0x2bda03(_0x3b1e4[_0x5558('0x13')][_0x5558('0x15')]);}else{logger[_0x5558('0xd')](_0x5558('0xe'),_0x152785,_0x5558('0xf'));_0x2bda03(_0x3b1e4[_0x5558('0x16')]['message']);}})[_0x5558('0x17')](function(_0x2c4552){logger[_0x5558('0x13')](_0x5558('0xe'),_0x152785,_0x2c4552);_0x50299a(_0x2c4552);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ebe4d5c..82fd173 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 _0xf07b=['getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xf07b,0xb3));var _0xbf07=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf07b[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xbf07('0x0'));var util=require(_0xbf07('0x1'));var path=require('path');var timeout=require(_0xbf07('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbf07('0x3'));var interaction=require(_0xbf07('0x4'));var config=require('../../config/environment');var controller=require(_0xbf07('0x5'));router['get']('/',auth[_0xbf07('0x6')](),controller[_0xbf07('0x7')]);router[_0xbf07('0x8')](_0xbf07('0x9'),auth[_0xbf07('0x6')](),controller[_0xbf07('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xbf07('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xbf07('0xb')]);router[_0xbf07('0xc')]('/',auth[_0xbf07('0x6')](),controller[_0xbf07('0xd')]);router[_0xbf07('0xc')]('/:id/configurations',auth[_0xbf07('0x6')](),controller[_0xbf07('0xe')]);router[_0xbf07('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xbf07('0x10')]);router[_0xbf07('0x11')](_0xbf07('0x9'),auth['isAuthenticated'](),controller[_0xbf07('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4c84=['getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields'];(function(_0x55dbd8,_0x33ac3f){var _0x46c754=function(_0x22f448){while(--_0x22f448){_0x55dbd8['push'](_0x55dbd8['shift']());}};_0x46c754(++_0x33ac3f);}(_0x4c84,0x191));var _0x44c8=function(_0x2517ab,_0x1f1388){_0x2517ab=_0x2517ab-0x0;var _0x509f16=_0x4c84[_0x2517ab];return _0x509f16;};'use strict';var multer=require('multer');var util=require(_0x44c8('0x0'));var path=require(_0x44c8('0x1'));var timeout=require(_0x44c8('0x2'));var express=require(_0x44c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44c8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x44c8('0x5'));var controller=require('./intDynamics365Account.controller');router[_0x44c8('0x6')]('/',auth['isAuthenticated'](),controller[_0x44c8('0x7')]);router[_0x44c8('0x6')](_0x44c8('0x8'),auth[_0x44c8('0x9')](),controller[_0x44c8('0xa')]);router[_0x44c8('0x6')]('/:id/configurations',auth[_0x44c8('0x9')](),controller[_0x44c8('0xb')]);router['get'](_0x44c8('0xc'),auth['isAuthenticated'](),controller[_0x44c8('0xd')]);router['post']('/',auth[_0x44c8('0x9')](),controller[_0x44c8('0xe')]);router[_0x44c8('0xf')](_0x44c8('0x10'),auth[_0x44c8('0x9')](),controller[_0x44c8('0x11')]);router[_0x44c8('0x12')](_0x44c8('0x8'),auth[_0x44c8('0x9')](),controller[_0x44c8('0x13')]);router[_0x44c8('0x14')](_0x44c8('0x8'),auth[_0x44c8('0x9')](),controller[_0x44c8('0x15')]);module[_0x44c8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 84e8134..00085c0 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 _0x9f5a=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3cb2d0,_0x3dd6e0){var _0x1c366f=function(_0x17a86a){while(--_0x17a86a){_0x3cb2d0['push'](_0x3cb2d0['shift']());}};_0x1c366f(++_0x3dd6e0);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x7a0fc5,_0x306d6f){_0x7a0fc5=_0x7a0fc5-0x0;var _0x183467=_0x9f5a[_0x7a0fc5];return _0x183467;};'use strict';var Sequelize=require(_0xa9f5('0x0'));module[_0xa9f5('0x1')]={'name':{'type':Sequelize[_0xa9f5('0x2')]},'username':{'type':Sequelize[_0xa9f5('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa9f5('0x2')]},'tenantId':{'type':Sequelize[_0xa9f5('0x2')]},'clientId':{'type':Sequelize[_0xa9f5('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa9f5('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xa9f5('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8d0a=['STRING','BOOLEAN','sequelize','exports'];(function(_0x474282,_0x26319e){var _0x1c8187=function(_0x166a00){while(--_0x166a00){_0x474282['push'](_0x474282['shift']());}};_0x1c8187(++_0x26319e);}(_0x8d0a,0x172));var _0xa8d0=function(_0x1a90fd,_0x3aaa2a){_0x1a90fd=_0x1a90fd-0x0;var _0x2ba35f=_0x8d0a[_0x1a90fd];return _0x2ba35f;};'use strict';var Sequelize=require(_0xa8d0('0x0'));module[_0xa8d0('0x1')]={'name':{'type':Sequelize[_0xa8d0('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa8d0('0x2')]},'remoteUri':{'type':Sequelize[_0xa8d0('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa8d0('0x2')]},'clientSecret':{'type':Sequelize[_0xa8d0('0x2')]},'serverUrl':{'type':Sequelize[_0xa8d0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xa8d0('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 47d1baf..0aa4604 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 _0xa177=['include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','options','hasOwnProperty','nolimit','addConfiguration','AccountId','channel','Descriptions','Dynamics365Field','Subjects','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','phonenumber','regardingobjectid','accountidyominame','actualserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidyominame','prioritycodename','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','versionnumber','concat','username','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','https://login.microsoftonline.com/','tenantId','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','statusCode','stack','test','Wrong\x20credentials','OptionSet','Options','UserLocalizedLabel','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','Label','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','lodash','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x35339d,_0x406d7a){var _0x4bc173=function(_0x5c1102){while(--_0x5c1102){_0x35339d['push'](_0x35339d['shift']());}};_0x4bc173(++_0x406d7a);}(_0xa177,0x143));var _0x7a17=function(_0x36b6fc,_0x38d74c){_0x36b6fc=_0x36b6fc-0x0;var _0x1b4655=_0xa177[_0x36b6fc];return _0x1b4655;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x7a17('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x7a17('0x1'))(_0x7a17('0x2'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7a17('0x3'));function respondWithResult(_0x3be77e,_0x2a6cdb){_0x2a6cdb=_0x2a6cdb||0xc8;return function(_0xe35093){if(_0xe35093){return _0x3be77e[_0x7a17('0x4')](_0x2a6cdb)[_0x7a17('0x5')](_0xe35093);}};}function respondWithFilteredResult(_0x9ad53,_0x5542c6){return function(_0x5859f7){if(_0x5859f7){var _0x435a66=typeof _0x5542c6[_0x7a17('0x6')]===_0x7a17('0x7')&&typeof _0x5542c6[_0x7a17('0x8')]===_0x7a17('0x7');var _0x45f36f=_0x5859f7[_0x7a17('0x9')];var _0x554a0b=_0x435a66?0x0:_0x5542c6[_0x7a17('0x6')];var _0x1b0cc1=_0x435a66?_0x5859f7['count']:_0x5542c6['offset']+_0x5542c6['limit'];var _0xdeb181;if(_0x1b0cc1>=_0x45f36f){_0x1b0cc1=_0x45f36f;_0xdeb181=0xc8;}else{_0xdeb181=0xce;}_0x9ad53[_0x7a17('0x4')](_0xdeb181);return _0x9ad53[_0x7a17('0xa')](_0x7a17('0xb'),_0x554a0b+'-'+_0x1b0cc1+'/'+_0x45f36f)[_0x7a17('0x5')](_0x5859f7);}return null;};}function saveUpdates(_0x51fd0a){return function(_0x167b25){if(_0x167b25){return _0x167b25[_0x7a17('0xc')](_0x51fd0a)[_0x7a17('0xd')](function(_0x306382){return _0x306382;});}return null;};}function removeEntity(_0x5ac0b3){return function(_0x13af30){if(_0x13af30){return _0x13af30[_0x7a17('0xe')]()[_0x7a17('0xd')](function(){_0x5ac0b3[_0x7a17('0x4')](0xcc)[_0x7a17('0xf')]();});}};}function handleEntityNotFound(_0x12c94c){return function(_0x1922bd){if(!_0x1922bd){_0x12c94c[_0x7a17('0x10')](0x194);}return _0x1922bd;};}function handleError(_0x702a27,_0x11c0dd){_0x11c0dd=_0x11c0dd||0x1f4;return function(_0x5bdecc){logger[_0x7a17('0x11')](_0x5bdecc['stack']);if(_0x5bdecc[_0x7a17('0x12')]){delete _0x5bdecc[_0x7a17('0x12')];}_0x702a27[_0x7a17('0x4')](_0x11c0dd)[_0x7a17('0x13')](_0x5bdecc);};}exports[_0x7a17('0x14')]=function(_0x31a149,_0x1aafcd){var _0x3a2e4a={},_0x3207cf={},_0x387f39={'count':0x0,'rows':[]};var _0xe328d8=_[_0x7a17('0x15')](db[_0x7a17('0x16')][_0x7a17('0x17')],function(_0x131bc3){return{'name':_0x131bc3['fieldName'],'type':_0x131bc3[_0x7a17('0x18')][_0x7a17('0x19')]};});_0x3207cf[_0x7a17('0x1a')]=_[_0x7a17('0x15')](_0xe328d8,_0x7a17('0x12'));_0x3207cf[_0x7a17('0x1b')]=_[_0x7a17('0x1c')](_0x31a149[_0x7a17('0x1b')]);_0x3207cf[_0x7a17('0x1d')]=_[_0x7a17('0x1e')](_0x3207cf[_0x7a17('0x1a')],_0x3207cf[_0x7a17('0x1b')]);_0x3a2e4a['attributes']=_[_0x7a17('0x1e')](_0x3207cf[_0x7a17('0x1a')],qs[_0x7a17('0x1f')](_0x31a149[_0x7a17('0x1b')][_0x7a17('0x1f')]));_0x3a2e4a[_0x7a17('0x20')]=_0x3a2e4a[_0x7a17('0x20')][_0x7a17('0x21')]?_0x3a2e4a['attributes']:_0x3207cf['model'];if(!_0x31a149[_0x7a17('0x1b')]['hasOwnProperty']('nolimit')){_0x3a2e4a[_0x7a17('0x8')]=qs['limit'](_0x31a149[_0x7a17('0x1b')][_0x7a17('0x8')]);_0x3a2e4a[_0x7a17('0x6')]=qs[_0x7a17('0x6')](_0x31a149['query'][_0x7a17('0x6')]);}_0x3a2e4a[_0x7a17('0x22')]=qs['sort'](_0x31a149['query'][_0x7a17('0x23')]);_0x3a2e4a[_0x7a17('0x24')]=qs[_0x7a17('0x1d')](_[_0x7a17('0x25')](_0x31a149[_0x7a17('0x1b')],_0x3207cf[_0x7a17('0x1d')]),_0xe328d8);if(_0x31a149['query'][_0x7a17('0x26')]){_0x3a2e4a['where']=_[_0x7a17('0x27')](_0x3a2e4a[_0x7a17('0x24')],{'$or':_[_0x7a17('0x15')](_0xe328d8,function(_0x284ebd){if(_0x284ebd[_0x7a17('0x18')]!==_0x7a17('0x28')){var _0x5745fa={};_0x5745fa[_0x284ebd[_0x7a17('0x12')]]={'$like':'%'+_0x31a149[_0x7a17('0x1b')]['filter']+'%'};return _0x5745fa;}})});}_0x3a2e4a=_['merge']({},_0x3a2e4a,_0x31a149['options']);var _0x57ba24={'where':_0x3a2e4a['where']};return db[_0x7a17('0x16')][_0x7a17('0x9')](_0x57ba24)[_0x7a17('0xd')](function(_0x3738bc){_0x387f39[_0x7a17('0x9')]=_0x3738bc;if(_0x31a149['query']['includeAll']){_0x3a2e4a[_0x7a17('0x29')]=[{'all':!![]}];}return db[_0x7a17('0x16')][_0x7a17('0x2a')](_0x3a2e4a);})[_0x7a17('0xd')](function(_0x3f38b6){_0x387f39[_0x7a17('0x2b')]=_0x3f38b6;return _0x387f39;})[_0x7a17('0xd')](respondWithFilteredResult(_0x1aafcd,_0x3a2e4a))[_0x7a17('0x2c')](handleError(_0x1aafcd,null));};exports[_0x7a17('0x2d')]=function(_0x36d815,_0x5e5bef){var _0x5bbed3={'raw':![],'where':{'id':_0x36d815[_0x7a17('0x2e')]['id']}},_0x5a4655={};_0x5a4655[_0x7a17('0x1a')]=_[_0x7a17('0x1c')](db['Dynamics365Account']['rawAttributes']);_0x5a4655[_0x7a17('0x1b')]=_[_0x7a17('0x1c')](_0x36d815[_0x7a17('0x1b')]);_0x5a4655['filters']=_[_0x7a17('0x1e')](_0x5a4655['model'],_0x5a4655[_0x7a17('0x1b')]);_0x5bbed3[_0x7a17('0x20')]=_[_0x7a17('0x1e')](_0x5a4655[_0x7a17('0x1a')],qs[_0x7a17('0x1f')](_0x36d815[_0x7a17('0x1b')][_0x7a17('0x1f')]));_0x5bbed3[_0x7a17('0x20')]=_0x5bbed3[_0x7a17('0x20')][_0x7a17('0x21')]?_0x5bbed3[_0x7a17('0x20')]:_0x5a4655[_0x7a17('0x1a')];if(_0x36d815[_0x7a17('0x1b')]['includeAll']){_0x5bbed3[_0x7a17('0x29')]=[{'all':!![]}];}_0x5bbed3=_[_0x7a17('0x27')]({},_0x5bbed3,_0x36d815['options']);return db[_0x7a17('0x16')][_0x7a17('0x2f')](_0x5bbed3)[_0x7a17('0xd')](handleEntityNotFound(_0x5e5bef,null))['then'](respondWithResult(_0x5e5bef,null))[_0x7a17('0x2c')](handleError(_0x5e5bef,null));};exports[_0x7a17('0x30')]=function(_0x2b38b5,_0x3097ac){return db[_0x7a17('0x16')][_0x7a17('0x30')](_0x2b38b5[_0x7a17('0x31')],{})[_0x7a17('0xd')](respondWithResult(_0x3097ac,0xc9))[_0x7a17('0x2c')](handleError(_0x3097ac,null));};exports[_0x7a17('0xc')]=function(_0x382eca,_0x10cc03){if(_0x382eca[_0x7a17('0x31')]['id']){delete _0x382eca['body']['id'];}return db[_0x7a17('0x16')][_0x7a17('0x2f')]({'where':{'id':_0x382eca[_0x7a17('0x2e')]['id']}})[_0x7a17('0xd')](handleEntityNotFound(_0x10cc03,null))[_0x7a17('0xd')](saveUpdates(_0x382eca['body'],null))[_0x7a17('0xd')](respondWithResult(_0x10cc03,null))[_0x7a17('0x2c')](handleError(_0x10cc03,null));};exports['destroy']=function(_0x4ac82a,_0x3af501){return db[_0x7a17('0x16')][_0x7a17('0x2f')]({'where':{'id':_0x4ac82a[_0x7a17('0x2e')]['id']}})[_0x7a17('0xd')](handleEntityNotFound(_0x3af501,null))['then'](removeEntity(_0x3af501,null))[_0x7a17('0x2c')](handleError(_0x3af501,null));};exports[_0x7a17('0x32')]=function(_0xdb8457,_0x2e3b23){var _0x109b14={};var _0x15cf2c={};var _0x4a5ea5;var _0x473791;return db['Dynamics365Account'][_0x7a17('0x33')]({'where':{'id':_0xdb8457['params']['id']}})[_0x7a17('0xd')](handleEntityNotFound(_0x2e3b23,null))[_0x7a17('0xd')](function(_0x19c762){if(_0x19c762){_0x4a5ea5=_0x19c762;_0x15cf2c[_0x7a17('0x1a')]=_['keys'](db[_0x7a17('0x34')]['rawAttributes']);_0x15cf2c[_0x7a17('0x1b')]=_['keys'](_0xdb8457['query']);_0x15cf2c[_0x7a17('0x1d')]=_[_0x7a17('0x1e')](_0x15cf2c[_0x7a17('0x1a')],_0x15cf2c[_0x7a17('0x1b')]);_0x109b14[_0x7a17('0x20')]=_['intersection'](_0x15cf2c[_0x7a17('0x1a')],qs[_0x7a17('0x1f')](_0xdb8457['query'][_0x7a17('0x1f')]));_0x109b14['attributes']=_0x109b14[_0x7a17('0x20')]['length']?_0x109b14[_0x7a17('0x20')]:_0x15cf2c[_0x7a17('0x1a')];_0x109b14[_0x7a17('0x22')]=qs[_0x7a17('0x23')](_0xdb8457[_0x7a17('0x1b')][_0x7a17('0x23')]);_0x109b14[_0x7a17('0x24')]=qs[_0x7a17('0x1d')](_['pick'](_0xdb8457[_0x7a17('0x1b')],_0x15cf2c[_0x7a17('0x1d')]));if(_0xdb8457[_0x7a17('0x1b')][_0x7a17('0x26')]){_0x109b14[_0x7a17('0x24')]=_[_0x7a17('0x27')](_0x109b14[_0x7a17('0x24')],{'$or':_[_0x7a17('0x15')](_0x109b14[_0x7a17('0x20')],function(_0x3a99da){var _0x41998d={};_0x41998d[_0x3a99da]={'$like':'%'+_0xdb8457[_0x7a17('0x1b')][_0x7a17('0x26')]+'%'};return _0x41998d;})});}_0x109b14=_[_0x7a17('0x27')]({},_0x109b14,_0xdb8457[_0x7a17('0x35')]);return _0x4a5ea5[_0x7a17('0x32')](_0x109b14);}})[_0x7a17('0xd')](function(_0x5d940e){if(_0x5d940e){_0x473791=_0x5d940e[_0x7a17('0x21')];if(!_0xdb8457[_0x7a17('0x1b')][_0x7a17('0x36')](_0x7a17('0x37'))){_0x109b14['limit']=qs['limit'](_0xdb8457[_0x7a17('0x1b')][_0x7a17('0x8')]);_0x109b14[_0x7a17('0x6')]=qs[_0x7a17('0x6')](_0xdb8457['query'][_0x7a17('0x6')]);}return _0x4a5ea5[_0x7a17('0x32')](_0x109b14);}})[_0x7a17('0xd')](function(_0x5bc59c){if(_0x5bc59c){return _0x5bc59c?{'count':_0x473791,'rows':_0x5bc59c}:null;}})[_0x7a17('0xd')](respondWithResult(_0x2e3b23,null))[_0x7a17('0x2c')](handleError(_0x2e3b23,null));};exports[_0x7a17('0x38')]=function(_0x27c528,_0x12bd82){if(_0x27c528[_0x7a17('0x31')]['id']){delete _0x27c528[_0x7a17('0x31')]['id'];}return db[_0x7a17('0x16')][_0x7a17('0x33')]({'where':{'id':_0x27c528[_0x7a17('0x2e')]['id']}})['then'](handleEntityNotFound(_0x12bd82,null))[_0x7a17('0xd')](function(_0x7071cb){if(_0x7071cb){_0x27c528['body'][_0x7a17('0x39')]=_0x7071cb['id'];_0x27c528['body']['Subjects']=integrations['getSubjects'](_0x27c528[_0x7a17('0x31')][_0x7a17('0x3a')],_0x27c528[_0x7a17('0x31')][_0x7a17('0x18')]);_0x27c528['body'][_0x7a17('0x3b')]=integrations['getDescriptions'](_0x27c528['body'][_0x7a17('0x3a')],_0x27c528[_0x7a17('0x31')][_0x7a17('0x18')]);return db['Dynamics365Configuration'][_0x7a17('0x30')](_0x27c528[_0x7a17('0x31')],{'include':[{'model':db[_0x7a17('0x3c')],'as':_0x7a17('0x3d')},{'model':db[_0x7a17('0x3c')],'as':_0x7a17('0x3b')}]});}return null;})[_0x7a17('0xd')](respondWithResult(_0x12bd82,null))[_0x7a17('0x2c')](handleError(_0x12bd82,null));};function sanitizeRemoteUri(_0x364838){var _0xd19bd0=_0x364838[_0x7a17('0x3e')](-0x1);if(_0xd19bd0==='/')return _0x364838[_0x7a17('0x3f')](0x0,_0x364838[_0x7a17('0x40')](_0xd19bd0));return _0x364838;}function getWebApiUrl(_0x4dc1fc){return util[_0x7a17('0x41')](_0x7a17('0x42'),_0x4dc1fc);}exports['getFields']=function(_0x425a07,_0x205ca2){var _0x44fadf=_0x425a07[_0x7a17('0x1b')][_0x7a17('0x43')];var _0x2f5e3f=_0x44fadf===_0x7a17('0x44')?_0x7a17('0x45'):_0x7a17('0x46');var _0x5cd584='';var _0x1bce56='';var _0x4b74ad='';var _0x226b7c='';var _0x27fcfd='';var _0x316fa9='';var _0x33d70c='';var _0x46cc2e='';var _0x58e1c9=[_0x7a17('0x47'),_0x7a17('0x48'),'customerid',_0x7a17('0x49'),_0x7a17('0x4a'),'subject',_0x7a17('0x4b'),_0x7a17('0x4c'),'directioncode','phonecall_activity_parties'];var _0x29d622=['accountidname',_0x7a17('0x4d'),_0x7a17('0x4e'),'billedserviceunits','contactidname',_0x7a17('0x4f'),_0x7a17('0x50'),'contractidname',_0x7a17('0x51'),_0x7a17('0x52'),_0x7a17('0x53'),_0x7a17('0x54'),_0x7a17('0x55'),_0x7a17('0x56'),_0x7a17('0x57'),_0x7a17('0x58'),_0x7a17('0x59'),'customeridyominame',_0x7a17('0x5a'),_0x7a17('0x5b'),_0x7a17('0x5c'),_0x7a17('0x5d'),_0x7a17('0x5e'),'exchangerate',_0x7a17('0x5f'),_0x7a17('0x60'),_0x7a17('0x61'),'influencescore',_0x7a17('0x62'),'lastonholdtime','masteridname',_0x7a17('0x63'),_0x7a17('0x64'),'modifiedbyname',_0x7a17('0x65'),_0x7a17('0x66'),_0x7a17('0x67'),_0x7a17('0x68'),'msdyn_incidenttypename',_0x7a17('0x69'),_0x7a17('0x6a'),'onholdtime',_0x7a17('0x6b'),_0x7a17('0x6c'),_0x7a17('0x6d'),_0x7a17('0x6e'),'parentcaseidname','primarycontactidname',_0x7a17('0x6f'),_0x7a17('0x70'),'productidname','productserialnumber',_0x7a17('0x71'),_0x7a17('0x72'),_0x7a17('0x73'),_0x7a17('0x74'),_0x7a17('0x75'),_0x7a17('0x76'),_0x7a17('0x77'),_0x7a17('0x78'),_0x7a17('0x79'),_0x7a17('0x7a'),_0x7a17('0x7b'),_0x7a17('0x7c'),_0x7a17('0x7d'),'timezoneruleversionnumber',_0x7a17('0x7e'),'traversedpath','utcconversiontimezonecode',_0x7a17('0x7f')];var _0x37eec5=_0x58e1c9[_0x7a17('0x80')](_0x29d622);return db[_0x7a17('0x16')]['findOne']({'where':{'id':_0x425a07[_0x7a17('0x2e')]['id']},'attributes':['id',_0x7a17('0x81'),_0x7a17('0x82'),_0x7a17('0x83'),'tenantId',_0x7a17('0x84'),_0x7a17('0x85'),_0x7a17('0x86')],'include':[{'model':db[_0x7a17('0x87')],'as':_0x7a17('0x87'),'attributes':['id','data5',_0x7a17('0x88')]}]})[_0x7a17('0xd')](handleEntityNotFound(_0x205ca2,null))[_0x7a17('0xd')](function(_0x33f08c){if(_0x33f08c){if(_0x33f08c[_0x7a17('0x86')]){_0x33f08c[_0x7a17('0x89')]=_0x33f08c['CloudProvider'][_0x7a17('0x8a')];_0x46cc2e=sanitizeRemoteUri(_0x33f08c['CloudProvider']['data7']);_0x33d70c=getWebApiUrl(_0x46cc2e);return _0x33f08c;}_0x46cc2e=sanitizeRemoteUri(_0x33f08c['remoteUri']);_0x33d70c=getWebApiUrl(_0x46cc2e);var _0x5075e4={'method':'POST','uri':_0x7a17('0x8b')+_0x33f08c[_0x7a17('0x8c')]+_0x7a17('0x8d'),'form':{'client_id':_0x33f08c['clientId'],'resource':_0x46cc2e,'username':_0x33f08c[_0x7a17('0x81')],'password':_0x33f08c[_0x7a17('0x82')],'grant_type':_0x7a17('0x82'),'client_secret':_0x33f08c[_0x7a17('0x85')]},'json':!![]};return rp(_0x5075e4);}})[_0x7a17('0xd')](function(_0x13a2f1){_0x316fa9=_0x13a2f1[_0x7a17('0x89')];var _0x364cb7={'method':_0x7a17('0x8e'),'uri':encodeURI(_0x33d70c+_0x7a17('0x8f')+_0x2f5e3f+'\x27'),'headers':{'Authorization':_0x7a17('0x90')+_0x316fa9,'If-None-Match':null,'OData-Version':_0x7a17('0x91')},'json':!![]};return rp(_0x364cb7);})[_0x7a17('0xd')](function(_0x32f70d){var _0x5c9775=_0x32f70d[_0x7a17('0x92')][0x0];var _0x27203b=_0x5c9775[_0x7a17('0x93')];var _0x3e65ce={'method':_0x7a17('0x8e'),'uri':_0x33d70c+_0x7a17('0x94')+_0x27203b+_0x7a17('0x95'),'headers':{'Authorization':_0x7a17('0x90')+_0x316fa9,'If-None-Match':null,'OData-Version':_0x7a17('0x91')},'json':!![]};return rp(_0x3e65ce);})['then'](function(_0x4d16b3){_0x5cd584=_0x4d16b3;_0x1bce56=_0x5cd584[_0x7a17('0x96')];_0x1bce56=_[_0x7a17('0x97')](_0x1bce56,function(_0x24cfc5){return!_0x37eec5[_0x7a17('0x98')](_0x24cfc5[_0x7a17('0x99')]);});var _0xa4105d=[];var _0xe8b01e=[];_0x1bce56['forEach'](function(_0x333095){if(_0x333095[_0x7a17('0x9a')]){var _0x4c6c6e=_0x333095[_0x7a17('0x9a')][_0x7a17('0x3f')](_0x333095[_0x7a17('0x9a')]['lastIndexOf']('.')+0x1);if(_0x4c6c6e===_0x7a17('0x9b')){_0xa4105d[_0x7a17('0x9c')](getSelectList(_0x33d70c,_0x44fadf,_0xe8b01e,_0x5cd584[_0x7a17('0x93')],_0x333095[_0x7a17('0x93')],_0x316fa9));}}});return Promise[_0x7a17('0x9d')](_0xa4105d);})[_0x7a17('0xd')](function(_0x181ef3){_0x4b74ad=_0x181ef3[0x0];var _0x5e2a37=[];var _0x43a63e=[];_0x1bce56[_0x7a17('0x9e')](function(_0x7856ad){if(!_[_0x7a17('0x9f')](_0x7856ad[_0x7a17('0x9a')])){var _0x55c161=_0x7856ad[_0x7a17('0x9a')]['substring'](_0x7856ad[_0x7a17('0x9a')][_0x7a17('0x40')]('.')+0x1);if(_0x55c161===_0x7a17('0xa0')){_0x5e2a37['push'](getBooleanList(_0x33d70c,_0x44fadf,_0x43a63e,_0x5cd584[_0x7a17('0x93')],_0x7856ad[_0x7a17('0x93')],_0x316fa9));}}});return Promise['all'](_0x5e2a37);})[_0x7a17('0xd')](function(_0x53a469){_0x226b7c=_0x53a469[0x0];var _0x471aa5=[];var _0x9aa442=[];_0x1bce56[_0x7a17('0x9e')](function(_0x513110){if(_0x513110[_0x7a17('0x9a')]){var _0x27705=_0x513110[_0x7a17('0x9a')][_0x7a17('0x3f')](_0x513110[_0x7a17('0x9a')][_0x7a17('0x40')]('.')+0x1);if(_0x27705==='StringAttributeMetadata'||_0x27705===_0x7a17('0xa1')||_0x27705===_0x7a17('0xa2')||_0x27705==='IntegerAttributeMetadata'||_0x27705===_0x7a17('0xa3')||_0x27705==='DateTimeAttributeMetadata'||_0x27705===_0x7a17('0xa4')||_0x27705==='EntityNameAttributeMetadata'||_0x27705==='StateAttributeMetadata'||_0x27705===_0x7a17('0xa5')){_0x471aa5[_0x7a17('0x9c')](getInputList(_0x33d70c,_0x44fadf,_0x27705,_0x9aa442,_0x5cd584[_0x7a17('0x93')],_0x513110[_0x7a17('0x93')],_0x316fa9));}}});return Promise[_0x7a17('0x9d')](_0x471aa5);})[_0x7a17('0xd')](function(_0x363007){_0x27fcfd=_0x363007[0x0];var _0x2af112=_0x4b74ad[_0x7a17('0x80')](_0x226b7c)[_0x7a17('0x80')](_0x27fcfd);var _0x12036a={'count':_0x2af112['length'],'rows':_0x2af112};return _0x12036a;})[_0x7a17('0xd')](respondWithResult(_0x205ca2,null))[_0x7a17('0x2c')](function(_0x33170e){var _0x38a820=_0x425a07[_0x7a17('0x1b')]['test']?0x1f4:_0x33170e[_0x7a17('0xa6')]||0x1f4;logger[_0x7a17('0x11')](_0x33170e[_0x7a17('0xa7')]);delete _0x33170e[_0x7a17('0x12')];if(_0x38a820===0x191){_0x38a820=0x190;}_0x205ca2[_0x7a17('0x4')](_0x38a820)[_0x7a17('0x13')](_0x425a07['query'][_0x7a17('0xa8')]?{'message':_0x7a17('0xa9'),'statusCode':_0x33170e[_0x7a17('0xa6')]}:_0x33170e);});};function getSelectList(_0xf68c80,_0x17d696,_0x9ce3e2,_0x1ca367,_0x17e0cb,_0x567ffa){var _0x3b3153={'method':_0x7a17('0x8e'),'uri':_0xf68c80+_0x7a17('0x94')+_0x1ca367+')/Attributes('+_0x17e0cb+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x7a17('0x90')+_0x567ffa,'If-None-Match':null,'OData-Version':_0x7a17('0x91')},'json':!![]};return rp(_0x3b3153)[_0x7a17('0xd')](function(_0x53aaae){var _0x4c0897=[];var _0x857d7c=_0x53aaae[_0x7a17('0xaa')][_0x7a17('0xab')];_0x857d7c[_0x7a17('0x9e')](function(_0x332358){_0x4c0897[_0x7a17('0x9c')]({'name':_0x332358['Label'][_0x7a17('0xac')]['Label'],'value':String(_0x332358[_0x7a17('0xad')])});});var _0x47a354={'id':_0x17d696+'_'+_0x53aaae[_0x7a17('0x99')],'name':_0x53aaae[_0x7a17('0xae')][_0x7a17('0xac')]['Label'],'custom':![],'options':_0x4c0897};_0x9ce3e2[_0x7a17('0x9c')](_0x47a354);return _0x9ce3e2;});}function getBooleanList(_0x36d8f2,_0x1fa3ac,_0x4c722a,_0x27549f,_0x2e31c5,_0x5e5a56){var _0x3949e5={'method':_0x7a17('0x8e'),'uri':_0x36d8f2+'EntityDefinitions('+_0x27549f+_0x7a17('0xaf')+_0x2e31c5+_0x7a17('0xb0'),'headers':{'Authorization':_0x7a17('0x90')+_0x5e5a56,'If-None-Match':null,'OData-Version':_0x7a17('0x91')},'json':!![]};return rp(_0x3949e5)['then'](function(_0x13319a){var _0x38bd58=[];_0x38bd58[_0x7a17('0x9c')]({'name':_0x13319a[_0x7a17('0xaa')][_0x7a17('0xb1')][_0x7a17('0xb2')]['UserLocalizedLabel']['Label'],'value':'true'},{'name':_0x13319a['OptionSet']['FalseOption'][_0x7a17('0xb2')][_0x7a17('0xac')][_0x7a17('0xb2')],'value':_0x7a17('0xb3')});var _0x588efd={'id':_0x1fa3ac+'_'+_0x13319a[_0x7a17('0x99')],'name':_0x13319a[_0x7a17('0xae')][_0x7a17('0xac')][_0x7a17('0xb2')],'custom':![],'options':_0x38bd58};_0x4c722a['push'](_0x588efd);return _0x4c722a;});}function getInputList(_0x43ad5f,_0x1ff1df,_0x4faa75,_0x5e0bff,_0x265fd4,_0x3b3da1,_0x439006){var _0x321e00={'method':_0x7a17('0x8e'),'uri':_0x43ad5f+'EntityDefinitions('+_0x265fd4+')/Attributes('+_0x3b3da1+_0x7a17('0xb4')+_0x4faa75+_0x7a17('0xb5'),'headers':{'Authorization':_0x7a17('0x90')+_0x439006,'If-None-Match':null,'OData-Version':_0x7a17('0x91')},'json':!![]};return rp(_0x321e00)[_0x7a17('0xd')](function(_0x7cbe49){var _0x12d3f6={'id':_0x1ff1df+'_'+_0x7cbe49[_0x7a17('0x99')],'name':_0x7cbe49[_0x7a17('0xae')][_0x7a17('0xac')]?_0x7cbe49[_0x7a17('0xae')][_0x7a17('0xac')][_0x7a17('0xb2')]:_0x7cbe49[_0x7a17('0x99')],'custom':![],'options':[]};_0x5e0bff[_0x7a17('0x9c')](_0x12d3f6);return _0x5e0bff;});} \ No newline at end of file +var _0x1a56=['Subjects','slice','substring','lastIndexOf','%s/api/data/v9.0/','incident','Incident','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','sentimentvalue','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','data5','data7','modernAuthentication','access_token','CloudProvider','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','Bearer\x20','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','MetadataId','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','error','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','UserLocalizedLabel','Value','LogicalName','DisplayName','Label',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','limit','undefined','count','status','set','Content-Range','update','then','end','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','destroy','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field'];(function(_0x5ee92b,_0x6d49ef){var _0x2c5f8e=function(_0xb432c9){while(--_0xb432c9){_0x5ee92b['push'](_0x5ee92b['shift']());}};_0x2c5f8e(++_0x6d49ef);}(_0x1a56,0x13a));var _0x61a5=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x1a56[_0x2f6f50];return _0x2cf365;};'use strict';var rp=require(_0x61a5('0x0'));var util=require(_0x61a5('0x1'));var _=require(_0x61a5('0x2'));var qs=require(_0x61a5('0x3'));var logger=require(_0x61a5('0x4'))(_0x61a5('0x5'));var db=require(_0x61a5('0x6'))['db'];var integrations=require(_0x61a5('0x7'));function respondWithResult(_0x524c8b,_0x3452d8){_0x3452d8=_0x3452d8||0xc8;return function(_0x4c8f55){if(_0x4c8f55){return _0x524c8b['status'](_0x3452d8)[_0x61a5('0x8')](_0x4c8f55);}};}function respondWithFilteredResult(_0x1b3c48,_0xfd07ad){return function(_0x54477d){if(_0x54477d){var _0x326b66=typeof _0xfd07ad[_0x61a5('0x9')]==='undefined'&&typeof _0xfd07ad[_0x61a5('0xa')]===_0x61a5('0xb');var _0x439ad8=_0x54477d[_0x61a5('0xc')];var _0x499ddd=_0x326b66?0x0:_0xfd07ad['offset'];var _0x328bc5=_0x326b66?_0x54477d[_0x61a5('0xc')]:_0xfd07ad[_0x61a5('0x9')]+_0xfd07ad[_0x61a5('0xa')];var _0xee65d4;if(_0x328bc5>=_0x439ad8){_0x328bc5=_0x439ad8;_0xee65d4=0xc8;}else{_0xee65d4=0xce;}_0x1b3c48[_0x61a5('0xd')](_0xee65d4);return _0x1b3c48[_0x61a5('0xe')](_0x61a5('0xf'),_0x499ddd+'-'+_0x328bc5+'/'+_0x439ad8)[_0x61a5('0x8')](_0x54477d);}return null;};}function saveUpdates(_0x207a17){return function(_0x50a327){if(_0x50a327){return _0x50a327[_0x61a5('0x10')](_0x207a17)[_0x61a5('0x11')](function(_0xe4543){return _0xe4543;});}return null;};}function removeEntity(_0x31d00a){return function(_0x2ef1dc){if(_0x2ef1dc){return _0x2ef1dc['destroy']()[_0x61a5('0x11')](function(){_0x31d00a[_0x61a5('0xd')](0xcc)[_0x61a5('0x12')]();});}};}function handleEntityNotFound(_0x481ced){return function(_0x3b5d2d){if(!_0x3b5d2d){_0x481ced['sendStatus'](0x194);}return _0x3b5d2d;};}function handleError(_0x1532b5,_0x390e08){_0x390e08=_0x390e08||0x1f4;return function(_0x1f6522){logger['error'](_0x1f6522[_0x61a5('0x13')]);if(_0x1f6522['name']){delete _0x1f6522[_0x61a5('0x14')];}_0x1532b5[_0x61a5('0xd')](_0x390e08)[_0x61a5('0x15')](_0x1f6522);};}exports[_0x61a5('0x16')]=function(_0x7f7d01,_0x5053ee){var _0x1bb3a8={},_0x4cc1c8={},_0x93599d={'count':0x0,'rows':[]};var _0x45b282=_[_0x61a5('0x17')](db[_0x61a5('0x18')]['rawAttributes'],function(_0xcf431c){return{'name':_0xcf431c[_0x61a5('0x19')],'type':_0xcf431c[_0x61a5('0x1a')][_0x61a5('0x1b')]};});_0x4cc1c8[_0x61a5('0x1c')]=_[_0x61a5('0x17')](_0x45b282,_0x61a5('0x14'));_0x4cc1c8[_0x61a5('0x1d')]=_[_0x61a5('0x1e')](_0x7f7d01[_0x61a5('0x1d')]);_0x4cc1c8['filters']=_[_0x61a5('0x1f')](_0x4cc1c8[_0x61a5('0x1c')],_0x4cc1c8[_0x61a5('0x1d')]);_0x1bb3a8[_0x61a5('0x20')]=_['intersection'](_0x4cc1c8[_0x61a5('0x1c')],qs[_0x61a5('0x21')](_0x7f7d01[_0x61a5('0x1d')][_0x61a5('0x21')]));_0x1bb3a8[_0x61a5('0x20')]=_0x1bb3a8[_0x61a5('0x20')][_0x61a5('0x22')]?_0x1bb3a8[_0x61a5('0x20')]:_0x4cc1c8[_0x61a5('0x1c')];if(!_0x7f7d01[_0x61a5('0x1d')][_0x61a5('0x23')](_0x61a5('0x24'))){_0x1bb3a8[_0x61a5('0xa')]=qs[_0x61a5('0xa')](_0x7f7d01['query'][_0x61a5('0xa')]);_0x1bb3a8[_0x61a5('0x9')]=qs[_0x61a5('0x9')](_0x7f7d01[_0x61a5('0x1d')][_0x61a5('0x9')]);}_0x1bb3a8[_0x61a5('0x25')]=qs[_0x61a5('0x26')](_0x7f7d01[_0x61a5('0x1d')][_0x61a5('0x26')]);_0x1bb3a8[_0x61a5('0x27')]=qs[_0x61a5('0x28')](_[_0x61a5('0x29')](_0x7f7d01[_0x61a5('0x1d')],_0x4cc1c8['filters']),_0x45b282);if(_0x7f7d01[_0x61a5('0x1d')][_0x61a5('0x2a')]){_0x1bb3a8[_0x61a5('0x27')]=_['merge'](_0x1bb3a8[_0x61a5('0x27')],{'$or':_[_0x61a5('0x17')](_0x45b282,function(_0x41e5d2){if(_0x41e5d2[_0x61a5('0x1a')]!==_0x61a5('0x2b')){var _0x334b5f={};_0x334b5f[_0x41e5d2[_0x61a5('0x14')]]={'$like':'%'+_0x7f7d01[_0x61a5('0x1d')]['filter']+'%'};return _0x334b5f;}})});}_0x1bb3a8=_[_0x61a5('0x2c')]({},_0x1bb3a8,_0x7f7d01[_0x61a5('0x2d')]);var _0x41e266={'where':_0x1bb3a8['where']};return db[_0x61a5('0x18')]['count'](_0x41e266)[_0x61a5('0x11')](function(_0x42da56){_0x93599d[_0x61a5('0xc')]=_0x42da56;if(_0x7f7d01['query'][_0x61a5('0x2e')]){_0x1bb3a8['include']=[{'all':!![]}];}return db[_0x61a5('0x18')][_0x61a5('0x2f')](_0x1bb3a8);})[_0x61a5('0x11')](function(_0xa8320f){_0x93599d[_0x61a5('0x30')]=_0xa8320f;return _0x93599d;})['then'](respondWithFilteredResult(_0x5053ee,_0x1bb3a8))[_0x61a5('0x31')](handleError(_0x5053ee,null));};exports[_0x61a5('0x32')]=function(_0x55b71e,_0x129d7b){var _0x12f2db={'raw':![],'where':{'id':_0x55b71e[_0x61a5('0x33')]['id']}},_0x20456e={};_0x20456e[_0x61a5('0x1c')]=_[_0x61a5('0x1e')](db[_0x61a5('0x18')][_0x61a5('0x34')]);_0x20456e[_0x61a5('0x1d')]=_['keys'](_0x55b71e[_0x61a5('0x1d')]);_0x20456e[_0x61a5('0x28')]=_[_0x61a5('0x1f')](_0x20456e['model'],_0x20456e[_0x61a5('0x1d')]);_0x12f2db[_0x61a5('0x20')]=_[_0x61a5('0x1f')](_0x20456e['model'],qs[_0x61a5('0x21')](_0x55b71e[_0x61a5('0x1d')][_0x61a5('0x21')]));_0x12f2db[_0x61a5('0x20')]=_0x12f2db[_0x61a5('0x20')][_0x61a5('0x22')]?_0x12f2db[_0x61a5('0x20')]:_0x20456e[_0x61a5('0x1c')];if(_0x55b71e[_0x61a5('0x1d')]['includeAll']){_0x12f2db[_0x61a5('0x35')]=[{'all':!![]}];}_0x12f2db=_[_0x61a5('0x2c')]({},_0x12f2db,_0x55b71e[_0x61a5('0x2d')]);return db[_0x61a5('0x18')]['find'](_0x12f2db)[_0x61a5('0x11')](handleEntityNotFound(_0x129d7b,null))[_0x61a5('0x11')](respondWithResult(_0x129d7b,null))['catch'](handleError(_0x129d7b,null));};exports[_0x61a5('0x36')]=function(_0xac94a4,_0x21eb2b){return db[_0x61a5('0x18')][_0x61a5('0x36')](_0xac94a4[_0x61a5('0x37')],{})[_0x61a5('0x11')](respondWithResult(_0x21eb2b,0xc9))['catch'](handleError(_0x21eb2b,null));};exports['update']=function(_0x105860,_0x5a6ded){if(_0x105860[_0x61a5('0x37')]['id']){delete _0x105860[_0x61a5('0x37')]['id'];}return db[_0x61a5('0x18')][_0x61a5('0x38')]({'where':{'id':_0x105860['params']['id']}})[_0x61a5('0x11')](handleEntityNotFound(_0x5a6ded,null))[_0x61a5('0x11')](saveUpdates(_0x105860[_0x61a5('0x37')],null))['then'](respondWithResult(_0x5a6ded,null))[_0x61a5('0x31')](handleError(_0x5a6ded,null));};exports[_0x61a5('0x39')]=function(_0x1ac941,_0x43979c){return db[_0x61a5('0x18')][_0x61a5('0x38')]({'where':{'id':_0x1ac941[_0x61a5('0x33')]['id']}})[_0x61a5('0x11')](handleEntityNotFound(_0x43979c,null))[_0x61a5('0x11')](removeEntity(_0x43979c,null))[_0x61a5('0x31')](handleError(_0x43979c,null));};exports[_0x61a5('0x3a')]=function(_0x55fad0,_0x1d1235){var _0x2ee9f4={};var _0x472379={};var _0x24e7d1;var _0x22ee46;return db['Dynamics365Account'][_0x61a5('0x3b')]({'where':{'id':_0x55fad0[_0x61a5('0x33')]['id']}})['then'](handleEntityNotFound(_0x1d1235,null))[_0x61a5('0x11')](function(_0x297681){if(_0x297681){_0x24e7d1=_0x297681;_0x472379['model']=_[_0x61a5('0x1e')](db['Dynamics365Configuration']['rawAttributes']);_0x472379[_0x61a5('0x1d')]=_[_0x61a5('0x1e')](_0x55fad0[_0x61a5('0x1d')]);_0x472379['filters']=_[_0x61a5('0x1f')](_0x472379[_0x61a5('0x1c')],_0x472379[_0x61a5('0x1d')]);_0x2ee9f4['attributes']=_[_0x61a5('0x1f')](_0x472379[_0x61a5('0x1c')],qs['fields'](_0x55fad0[_0x61a5('0x1d')][_0x61a5('0x21')]));_0x2ee9f4['attributes']=_0x2ee9f4['attributes']['length']?_0x2ee9f4[_0x61a5('0x20')]:_0x472379[_0x61a5('0x1c')];_0x2ee9f4[_0x61a5('0x25')]=qs[_0x61a5('0x26')](_0x55fad0[_0x61a5('0x1d')][_0x61a5('0x26')]);_0x2ee9f4[_0x61a5('0x27')]=qs['filters'](_[_0x61a5('0x29')](_0x55fad0[_0x61a5('0x1d')],_0x472379['filters']));if(_0x55fad0[_0x61a5('0x1d')][_0x61a5('0x2a')]){_0x2ee9f4[_0x61a5('0x27')]=_[_0x61a5('0x2c')](_0x2ee9f4[_0x61a5('0x27')],{'$or':_[_0x61a5('0x17')](_0x2ee9f4[_0x61a5('0x20')],function(_0x300d66){var _0x110579={};_0x110579[_0x300d66]={'$like':'%'+_0x55fad0[_0x61a5('0x1d')]['filter']+'%'};return _0x110579;})});}_0x2ee9f4=_[_0x61a5('0x2c')]({},_0x2ee9f4,_0x55fad0['options']);return _0x24e7d1[_0x61a5('0x3a')](_0x2ee9f4);}})[_0x61a5('0x11')](function(_0x1fe710){if(_0x1fe710){_0x22ee46=_0x1fe710[_0x61a5('0x22')];if(!_0x55fad0['query'][_0x61a5('0x23')]('nolimit')){_0x2ee9f4[_0x61a5('0xa')]=qs['limit'](_0x55fad0[_0x61a5('0x1d')][_0x61a5('0xa')]);_0x2ee9f4[_0x61a5('0x9')]=qs[_0x61a5('0x9')](_0x55fad0['query'][_0x61a5('0x9')]);}return _0x24e7d1['getConfigurations'](_0x2ee9f4);}})[_0x61a5('0x11')](function(_0x501b7c){if(_0x501b7c){return _0x501b7c?{'count':_0x22ee46,'rows':_0x501b7c}:null;}})[_0x61a5('0x11')](respondWithResult(_0x1d1235,null))[_0x61a5('0x31')](handleError(_0x1d1235,null));};exports[_0x61a5('0x3c')]=function(_0x3b0460,_0x256447){if(_0x3b0460[_0x61a5('0x37')]['id']){delete _0x3b0460[_0x61a5('0x37')]['id'];}return db[_0x61a5('0x18')]['findOne']({'where':{'id':_0x3b0460[_0x61a5('0x33')]['id']}})[_0x61a5('0x11')](handleEntityNotFound(_0x256447,null))[_0x61a5('0x11')](function(_0x170817){if(_0x170817){_0x3b0460['body'][_0x61a5('0x3d')]=_0x170817['id'];_0x3b0460['body']['Subjects']=integrations[_0x61a5('0x3e')](_0x3b0460['body']['channel'],_0x3b0460[_0x61a5('0x37')]['type']);_0x3b0460['body'][_0x61a5('0x3f')]=integrations[_0x61a5('0x40')](_0x3b0460['body'][_0x61a5('0x41')],_0x3b0460[_0x61a5('0x37')][_0x61a5('0x1a')]);return db[_0x61a5('0x42')][_0x61a5('0x36')](_0x3b0460['body'],{'include':[{'model':db[_0x61a5('0x43')],'as':_0x61a5('0x44')},{'model':db['Dynamics365Field'],'as':_0x61a5('0x3f')}]});}return null;})['then'](respondWithResult(_0x256447,null))[_0x61a5('0x31')](handleError(_0x256447,null));};function sanitizeRemoteUri(_0xf73c2b){var _0x586a8b=_0xf73c2b[_0x61a5('0x45')](-0x1);if(_0x586a8b==='/')return _0xf73c2b[_0x61a5('0x46')](0x0,_0xf73c2b[_0x61a5('0x47')](_0x586a8b));return _0xf73c2b;}function getWebApiUrl(_0x2fa7d1){return util['format'](_0x61a5('0x48'),_0x2fa7d1);}exports['getFields']=function(_0x484d21,_0x2bddd4){var _0xcd346=_0x484d21[_0x61a5('0x1d')]['ticketType'];var _0x4fc372=_0xcd346===_0x61a5('0x49')?_0x61a5('0x4a'):'PhoneCall';var _0x14ea5d='';var _0x50d80c='';var _0x527007='';var _0x3c43b7='';var _0x377afd='';var _0x4f15a3='';var _0x58bc46='';var _0x4e0672='';var _0x3e7d85=['title',_0x61a5('0x4b'),_0x61a5('0x4c'),_0x61a5('0x4d'),'caseorigincode',_0x61a5('0x4e'),_0x61a5('0x4f'),_0x61a5('0x50'),_0x61a5('0x51'),_0x61a5('0x52')];var _0x5381da=[_0x61a5('0x53'),_0x61a5('0x54'),_0x61a5('0x55'),_0x61a5('0x56'),_0x61a5('0x57'),_0x61a5('0x58'),'contractdetailidname',_0x61a5('0x59'),_0x61a5('0x5a'),'createdbyexternalpartyyominame',_0x61a5('0x5b'),'createdbyyominame',_0x61a5('0x5c'),_0x61a5('0x5d'),_0x61a5('0x5e'),_0x61a5('0x5f'),_0x61a5('0x60'),_0x61a5('0x61'),_0x61a5('0x62'),_0x61a5('0x63'),_0x61a5('0x64'),_0x61a5('0x65'),'escalatedon',_0x61a5('0x66'),_0x61a5('0x67'),_0x61a5('0x68'),_0x61a5('0x69'),_0x61a5('0x6a'),_0x61a5('0x6b'),_0x61a5('0x6c'),_0x61a5('0x6d'),'modifiedbyexternalpartyname',_0x61a5('0x6e'),_0x61a5('0x6f'),'modifiedbyyominame','modifiedon',_0x61a5('0x70'),_0x61a5('0x71'),_0x61a5('0x72'),_0x61a5('0x73'),_0x61a5('0x74'),_0x61a5('0x75'),_0x61a5('0x76'),_0x61a5('0x77'),_0x61a5('0x78'),_0x61a5('0x79'),_0x61a5('0x7a'),'primarycontactidname',_0x61a5('0x7b'),_0x61a5('0x7c'),_0x61a5('0x7d'),_0x61a5('0x7e'),'resolveby',_0x61a5('0x7f'),_0x61a5('0x80'),'responsiblecontactidname','responsiblecontactidyominame',_0x61a5('0x81'),'slainvokedidname','slaname','socialprofileidname',_0x61a5('0x82'),'statuscode',_0x61a5('0x83'),_0x61a5('0x84'),_0x61a5('0x85'),_0x61a5('0x86'),_0x61a5('0x87'),'utcconversiontimezonecode',_0x61a5('0x88')];var _0x22dd53=_0x3e7d85[_0x61a5('0x89')](_0x5381da);return db[_0x61a5('0x18')][_0x61a5('0x3b')]({'where':{'id':_0x484d21[_0x61a5('0x33')]['id']},'attributes':['id',_0x61a5('0x8a'),_0x61a5('0x8b'),_0x61a5('0x8c'),_0x61a5('0x8d'),_0x61a5('0x8e'),'clientSecret','modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0x61a5('0x8f'),_0x61a5('0x90')]}]})['then'](handleEntityNotFound(_0x2bddd4,null))[_0x61a5('0x11')](function(_0x44edcd){if(_0x44edcd){if(_0x44edcd[_0x61a5('0x91')]){_0x44edcd[_0x61a5('0x92')]=_0x44edcd['CloudProvider']['data5'];_0x4e0672=sanitizeRemoteUri(_0x44edcd[_0x61a5('0x93')][_0x61a5('0x90')]);_0x58bc46=getWebApiUrl(_0x4e0672);return _0x44edcd;}_0x4e0672=sanitizeRemoteUri(_0x44edcd[_0x61a5('0x8c')]);_0x58bc46=getWebApiUrl(_0x4e0672);var _0x4fab1d={'method':'POST','uri':_0x61a5('0x94')+_0x44edcd['tenantId']+_0x61a5('0x95'),'form':{'client_id':_0x44edcd[_0x61a5('0x8e')],'resource':_0x4e0672,'username':_0x44edcd[_0x61a5('0x8a')],'password':_0x44edcd[_0x61a5('0x8b')],'grant_type':'password','client_secret':_0x44edcd[_0x61a5('0x96')]},'json':!![]};return rp(_0x4fab1d);}})[_0x61a5('0x11')](function(_0xfad699){_0x4f15a3=_0xfad699['access_token'];var _0x1c1842={'method':_0x61a5('0x97'),'uri':encodeURI(_0x58bc46+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4fc372+'\x27'),'headers':{'Authorization':_0x61a5('0x98')+_0x4f15a3,'If-None-Match':null,'OData-Version':_0x61a5('0x99')},'json':!![]};return rp(_0x1c1842);})[_0x61a5('0x11')](function(_0x3a5302){var _0x3ad665=_0x3a5302['value'][0x0];var _0x174c22=_0x3ad665['MetadataId'];var _0x21bcbe={'method':_0x61a5('0x97'),'uri':_0x58bc46+_0x61a5('0x9a')+_0x174c22+_0x61a5('0x9b'),'headers':{'Authorization':'Bearer\x20'+_0x4f15a3,'If-None-Match':null,'OData-Version':_0x61a5('0x99')},'json':!![]};return rp(_0x21bcbe);})[_0x61a5('0x11')](function(_0x3856d5){_0x14ea5d=_0x3856d5;_0x50d80c=_0x14ea5d[_0x61a5('0x9c')];_0x50d80c=_[_0x61a5('0x9d')](_0x50d80c,function(_0x1f1587){return!_0x22dd53['includes'](_0x1f1587['LogicalName']);});var _0x48d996=[];var _0x2fc8b1=[];_0x50d80c[_0x61a5('0x9e')](function(_0x4b1e05){if(_0x4b1e05[_0x61a5('0x9f')]){var _0x99b92b=_0x4b1e05['@odata.type']['substring'](_0x4b1e05[_0x61a5('0x9f')]['lastIndexOf']('.')+0x1);if(_0x99b92b==='PicklistAttributeMetadata'){_0x48d996[_0x61a5('0xa0')](getSelectList(_0x58bc46,_0xcd346,_0x2fc8b1,_0x14ea5d['MetadataId'],_0x4b1e05['MetadataId'],_0x4f15a3));}}});return Promise[_0x61a5('0xa1')](_0x48d996);})[_0x61a5('0x11')](function(_0x3e2fba){_0x527007=_0x3e2fba[0x0];var _0x4a3179=[];var _0x4c5c17=[];_0x50d80c['forEach'](function(_0xbd20bf){if(!_[_0x61a5('0xa2')](_0xbd20bf[_0x61a5('0x9f')])){var _0x2e7d4f=_0xbd20bf[_0x61a5('0x9f')][_0x61a5('0x46')](_0xbd20bf[_0x61a5('0x9f')][_0x61a5('0x47')]('.')+0x1);if(_0x2e7d4f===_0x61a5('0xa3')){_0x4a3179[_0x61a5('0xa0')](getBooleanList(_0x58bc46,_0xcd346,_0x4c5c17,_0x14ea5d[_0x61a5('0xa4')],_0xbd20bf[_0x61a5('0xa4')],_0x4f15a3));}}});return Promise[_0x61a5('0xa1')](_0x4a3179);})['then'](function(_0x214a74){_0x3c43b7=_0x214a74[0x0];var _0x2d1193=[];var _0x20f3f2=[];_0x50d80c[_0x61a5('0x9e')](function(_0x3eb695){if(_0x3eb695[_0x61a5('0x9f')]){var _0x28980e=_0x3eb695['@odata.type']['substring'](_0x3eb695['@odata.type'][_0x61a5('0x47')]('.')+0x1);if(_0x28980e==='StringAttributeMetadata'||_0x28980e===_0x61a5('0xa5')||_0x28980e===_0x61a5('0xa6')||_0x28980e==='IntegerAttributeMetadata'||_0x28980e==='MemoAttributeMetadata'||_0x28980e===_0x61a5('0xa7')||_0x28980e===_0x61a5('0xa8')||_0x28980e===_0x61a5('0xa9')||_0x28980e===_0x61a5('0xaa')||_0x28980e===_0x61a5('0xab')){_0x2d1193[_0x61a5('0xa0')](getInputList(_0x58bc46,_0xcd346,_0x28980e,_0x20f3f2,_0x14ea5d['MetadataId'],_0x3eb695[_0x61a5('0xa4')],_0x4f15a3));}}});return Promise['all'](_0x2d1193);})[_0x61a5('0x11')](function(_0x48a7f3){_0x377afd=_0x48a7f3[0x0];var _0x431014=_0x527007[_0x61a5('0x89')](_0x3c43b7)[_0x61a5('0x89')](_0x377afd);var _0x538622={'count':_0x431014[_0x61a5('0x22')],'rows':_0x431014};return _0x538622;})[_0x61a5('0x11')](respondWithResult(_0x2bddd4,null))[_0x61a5('0x31')](function(_0x1be7d3){var _0x32bdc8=_0x484d21['query'][_0x61a5('0xac')]?0x1f4:_0x1be7d3['statusCode']||0x1f4;logger[_0x61a5('0xad')](_0x1be7d3[_0x61a5('0x13')]);delete _0x1be7d3[_0x61a5('0x14')];if(_0x32bdc8===0x191){_0x32bdc8=0x190;}_0x2bddd4[_0x61a5('0xd')](_0x32bdc8)[_0x61a5('0x15')](_0x484d21[_0x61a5('0x1d')][_0x61a5('0xac')]?{'message':_0x61a5('0xae'),'statusCode':_0x1be7d3['statusCode']}:_0x1be7d3);});};function getSelectList(_0xdd19bf,_0x35fa44,_0xdb2e6b,_0x16f0f7,_0x2fc924,_0x29cfa5){var _0x192667={'method':_0x61a5('0x97'),'uri':_0xdd19bf+_0x61a5('0x9a')+_0x16f0f7+')/Attributes('+_0x2fc924+_0x61a5('0xaf')+_0x61a5('0xb0'),'headers':{'Authorization':_0x61a5('0x98')+_0x29cfa5,'If-None-Match':null,'OData-Version':_0x61a5('0x99')},'json':!![]};return rp(_0x192667)[_0x61a5('0x11')](function(_0x72bb37){var _0x10f974=[];var _0x19f79e=_0x72bb37['OptionSet']['Options'];_0x19f79e['forEach'](function(_0x21fd61){_0x10f974['push']({'name':_0x21fd61['Label'][_0x61a5('0xb1')]['Label'],'value':String(_0x21fd61[_0x61a5('0xb2')])});});var _0x595f46={'id':_0x35fa44+'_'+_0x72bb37[_0x61a5('0xb3')],'name':_0x72bb37[_0x61a5('0xb4')]['UserLocalizedLabel'][_0x61a5('0xb5')],'custom':![],'options':_0x10f974};_0xdb2e6b[_0x61a5('0xa0')](_0x595f46);return _0xdb2e6b;});}function getBooleanList(_0x3dfec6,_0x16fd43,_0x2e3b3c,_0x5eddbe,_0x36ffa2,_0x5e8e1e){var _0x5cfd40={'method':_0x61a5('0x97'),'uri':_0x3dfec6+_0x61a5('0x9a')+_0x5eddbe+_0x61a5('0xb6')+_0x36ffa2+_0x61a5('0xb7'),'headers':{'Authorization':_0x61a5('0x98')+_0x5e8e1e,'If-None-Match':null,'OData-Version':_0x61a5('0x99')},'json':!![]};return rp(_0x5cfd40)['then'](function(_0x1ffc6f){var _0x2f22d7=[];_0x2f22d7[_0x61a5('0xa0')]({'name':_0x1ffc6f[_0x61a5('0xb8')][_0x61a5('0xb9')][_0x61a5('0xb5')]['UserLocalizedLabel']['Label'],'value':_0x61a5('0xba')},{'name':_0x1ffc6f[_0x61a5('0xb8')][_0x61a5('0xbb')][_0x61a5('0xb5')][_0x61a5('0xb1')]['Label'],'value':_0x61a5('0xbc')});var _0x11a078={'id':_0x16fd43+'_'+_0x1ffc6f[_0x61a5('0xb3')],'name':_0x1ffc6f[_0x61a5('0xb4')][_0x61a5('0xb1')]['Label'],'custom':![],'options':_0x2f22d7};_0x2e3b3c[_0x61a5('0xa0')](_0x11a078);return _0x2e3b3c;});}function getInputList(_0x4802fd,_0x3d6f6f,_0x4c9306,_0x3184ff,_0x37892c,_0x58f4ce,_0x582415){var _0x3eae7d={'method':_0x61a5('0x97'),'uri':_0x4802fd+_0x61a5('0x9a')+_0x37892c+')/Attributes('+_0x58f4ce+_0x61a5('0xbd')+_0x4c9306+_0x61a5('0xbe'),'headers':{'Authorization':_0x61a5('0x98')+_0x582415,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3eae7d)['then'](function(_0x208d50){var _0x3952f1={'id':_0x3d6f6f+'_'+_0x208d50[_0x61a5('0xb3')],'name':_0x208d50[_0x61a5('0xb4')]['UserLocalizedLabel']?_0x208d50[_0x61a5('0xb4')][_0x61a5('0xb1')][_0x61a5('0xb5')]:_0x208d50[_0x61a5('0xb3')],'custom':![],'options':[]};_0x3184ff['push'](_0x3952f1);return _0x3184ff;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 12113c7..fea1d7e 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x512f81,_0x4a7986){var _0xa15099=function(_0x1f7371){while(--_0x1f7371){_0x512f81['push'](_0x512f81['shift']());}};_0xa15099(++_0x4a7986);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46f075,_0x403def){var _0x4f45c1=function(_0x580754){while(--_0x580754){_0x46f075['push'](_0x46f075['shift']());}};_0x4f45c1(++_0x403def);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index b23ec58..d218a3a 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 _0xd140=['util','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','find','ShowDynamics365Account','lodash'];(function(_0x10d048,_0x110c7d){var _0x43daa2=function(_0x4c3c9c){while(--_0x4c3c9c){_0x10d048['push'](_0x10d048['shift']());}};_0x43daa2(++_0x110c7d);}(_0xd140,0x117));var _0x0d14=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd140[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d14('0x0'));var util=require(_0x0d14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d14('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0d14('0x3'));var logger=require(_0x0d14('0x4'))(_0x0d14('0x5'));var config=require('../../config/environment');var jayson=require(_0x0d14('0x6'));var client=jayson[_0x0d14('0x7')][_0x0d14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x425460,_0x3c72c3,_0x10611d){return new BPromise(function(_0x2ddab7,_0x574316){return client[_0x0d14('0x9')](_0x425460,_0x10611d)['then'](function(_0x447f59){logger[_0x0d14('0xa')](_0x0d14('0xb'),_0x3c72c3,_0x0d14('0xc'));logger[_0x0d14('0xd')](_0x0d14('0xe'),_0x3c72c3,'request\x20sent',JSON[_0x0d14('0xf')](_0x447f59));if(_0x447f59['error']){if(_0x447f59[_0x0d14('0x10')][_0x0d14('0x11')]===0x1f4){logger[_0x0d14('0x10')](_0x0d14('0xb'),_0x3c72c3,_0x447f59[_0x0d14('0x10')][_0x0d14('0x12')]);return _0x574316(_0x447f59['error'][_0x0d14('0x12')]);}logger[_0x0d14('0x10')](_0x0d14('0xb'),_0x3c72c3,_0x447f59[_0x0d14('0x10')][_0x0d14('0x12')]);return _0x2ddab7(_0x447f59[_0x0d14('0x10')][_0x0d14('0x12')]);}else{logger[_0x0d14('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x3c72c3,_0x0d14('0xc'));_0x2ddab7(_0x447f59[_0x0d14('0x13')][_0x0d14('0x12')]);}})['catch'](function(_0x46c593){logger['error'](_0x0d14('0xb'),_0x3c72c3,_0x46c593);_0x574316(_0x46c593);});});}exports[_0x0d14('0x14')]=function(_0x2d082a){var _0x18f0a6=this;return new Promise(function(_0x38b45f,_0x416fd1){return db[_0x0d14('0x15')][_0x0d14('0x16')]({'raw':_0x2d082a[_0x0d14('0x17')]?_0x2d082a[_0x0d14('0x17')][_0x0d14('0x18')]===undefined?!![]:![]:!![],'where':_0x2d082a['options']?_0x2d082a[_0x0d14('0x17')][_0x0d14('0x19')]||null:null,'attributes':_0x2d082a[_0x0d14('0x17')]?_0x2d082a['options'][_0x0d14('0x1a')]||null:null,'limit':_0x2d082a[_0x0d14('0x17')]?_0x2d082a[_0x0d14('0x17')][_0x0d14('0x1b')]||null:null,'include':_0x2d082a[_0x0d14('0x17')]?_0x2d082a[_0x0d14('0x17')][_0x0d14('0x1c')]?_[_0x0d14('0x1d')](_0x2d082a['options']['include'],function(_0xddf269){return{'model':db[_0xddf269[_0x0d14('0x1e')]],'as':_0xddf269['as'],'attributes':_0xddf269['attributes'],'include':_0xddf269[_0x0d14('0x1c')]?_[_0x0d14('0x1d')](_0xddf269[_0x0d14('0x1c')],function(_0x5d030e){return{'model':db[_0x5d030e[_0x0d14('0x1e')]],'as':_0x5d030e['as'],'attributes':_0x5d030e[_0x0d14('0x1a')],'include':_0x5d030e[_0x0d14('0x1c')]?_[_0x0d14('0x1d')](_0x5d030e[_0x0d14('0x1c')],function(_0x411e9c){return{'model':db[_0x411e9c[_0x0d14('0x1e')]],'as':_0x411e9c['as'],'attributes':_0x411e9c[_0x0d14('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0d14('0x1f')](function(_0x2d5325){logger['info'](_0x0d14('0x14'),_0x2d082a);logger[_0x0d14('0xd')](_0x0d14('0x14'),_0x2d082a,JSON['stringify'](_0x2d5325));_0x38b45f(_0x2d5325);})[_0x0d14('0x20')](function(_0x2d4cea){logger[_0x0d14('0x10')](_0x0d14('0x14'),_0x2d4cea[_0x0d14('0x12')],_0x2d082a);_0x416fd1(_0x18f0a6['error'](0x1f4,_0x2d4cea[_0x0d14('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x91315f){var _0x5af209=this;return new Promise(function(_0x4ee3e2,_0x1d947e){return db[_0x0d14('0x15')][_0x0d14('0x21')]({'raw':_0x91315f[_0x0d14('0x17')]?_0x91315f[_0x0d14('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x91315f['options']?_0x91315f[_0x0d14('0x17')]['where']||null:null,'attributes':_0x91315f[_0x0d14('0x17')]?_0x91315f[_0x0d14('0x17')][_0x0d14('0x1a')]||null:null,'include':_0x91315f[_0x0d14('0x17')]?_0x91315f['options'][_0x0d14('0x1c')]?_[_0x0d14('0x1d')](_0x91315f[_0x0d14('0x17')][_0x0d14('0x1c')],function(_0x522e59){return{'model':db[_0x522e59['model']],'as':_0x522e59['as'],'attributes':_0x522e59['attributes'],'include':_0x522e59[_0x0d14('0x1c')]?_['map'](_0x522e59[_0x0d14('0x1c')],function(_0x526b6e){return{'model':db[_0x526b6e[_0x0d14('0x1e')]],'as':_0x526b6e['as'],'attributes':_0x526b6e[_0x0d14('0x1a')],'include':_0x526b6e['include']?_[_0x0d14('0x1d')](_0x526b6e[_0x0d14('0x1c')],function(_0x3a2283){return{'model':db[_0x3a2283[_0x0d14('0x1e')]],'as':_0x3a2283['as'],'attributes':_0x3a2283[_0x0d14('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0d14('0x1f')](function(_0x33e160){logger[_0x0d14('0xa')](_0x0d14('0x22'),_0x91315f);logger[_0x0d14('0xd')](_0x0d14('0x22'),_0x91315f,JSON['stringify'](_0x33e160));_0x4ee3e2(_0x33e160);})['catch'](function(_0x2d2e4f){logger['error']('ShowDynamics365Account',_0x2d2e4f[_0x0d14('0x12')],_0x91315f);_0x1d947e(_0x5af209[_0x0d14('0x10')](0x1f4,_0x2d2e4f[_0x0d14('0x12')]));});});}; \ No newline at end of file +var _0x1b7a=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','raw','options','where','map','include','model','attributes','ShowDynamics365Account','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3027f9,_0x3fe4da){var _0x20c607=function(_0x2e3c86){while(--_0x2e3c86){_0x3027f9['push'](_0x3027f9['shift']());}};_0x20c607(++_0x3fe4da);}(_0x1b7a,0x15a));var _0xa1b7=function(_0x1d1906,_0x20529f){_0x1d1906=_0x1d1906-0x0;var _0x59a372=_0x1b7a[_0x1d1906];return _0x59a372;};'use strict';var _=require('lodash');var util=require(_0xa1b7('0x0'));var moment=require('moment');var BPromise=require(_0xa1b7('0x1'));var rs=require(_0xa1b7('0x2'));var fs=require('fs');var Redis=require(_0xa1b7('0x3'));var db=require(_0xa1b7('0x4'))['db'];var utils=require(_0xa1b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa1b7('0x6'));var jayson=require(_0xa1b7('0x7'));var client=jayson[_0xa1b7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x396abc,_0x4368ce,_0x927a79){return new BPromise(function(_0x1b0d05,_0x3e8ff2){return client[_0xa1b7('0x9')](_0x396abc,_0x927a79)[_0xa1b7('0xa')](function(_0x5b1ebf){logger[_0xa1b7('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x4368ce,_0xa1b7('0xc'));logger[_0xa1b7('0xd')](_0xa1b7('0xe'),_0x4368ce,_0xa1b7('0xc'),JSON[_0xa1b7('0xf')](_0x5b1ebf));if(_0x5b1ebf[_0xa1b7('0x10')]){if(_0x5b1ebf[_0xa1b7('0x10')][_0xa1b7('0x11')]===0x1f4){logger['error'](_0xa1b7('0x12'),_0x4368ce,_0x5b1ebf[_0xa1b7('0x10')][_0xa1b7('0x13')]);return _0x3e8ff2(_0x5b1ebf[_0xa1b7('0x10')][_0xa1b7('0x13')]);}logger['error'](_0xa1b7('0x12'),_0x4368ce,_0x5b1ebf[_0xa1b7('0x10')]['message']);return _0x1b0d05(_0x5b1ebf[_0xa1b7('0x10')][_0xa1b7('0x13')]);}else{logger[_0xa1b7('0xb')](_0xa1b7('0x12'),_0x4368ce,'request\x20sent');_0x1b0d05(_0x5b1ebf[_0xa1b7('0x14')][_0xa1b7('0x13')]);}})[_0xa1b7('0x15')](function(_0x1fba41){logger[_0xa1b7('0x10')](_0xa1b7('0x12'),_0x4368ce,_0x1fba41);_0x3e8ff2(_0x1fba41);});});}exports[_0xa1b7('0x16')]=function(_0x1322bf){var _0x28f55e=this;return new Promise(function(_0x57d2a0,_0x4ab00f){return db[_0xa1b7('0x17')]['findAll']({'raw':_0x1322bf['options']?_0x1322bf['options'][_0xa1b7('0x18')]===undefined?!![]:![]:!![],'where':_0x1322bf[_0xa1b7('0x19')]?_0x1322bf[_0xa1b7('0x19')][_0xa1b7('0x1a')]||null:null,'attributes':_0x1322bf[_0xa1b7('0x19')]?_0x1322bf[_0xa1b7('0x19')]['attributes']||null:null,'limit':_0x1322bf[_0xa1b7('0x19')]?_0x1322bf[_0xa1b7('0x19')]['limit']||null:null,'include':_0x1322bf[_0xa1b7('0x19')]?_0x1322bf[_0xa1b7('0x19')]['include']?_[_0xa1b7('0x1b')](_0x1322bf[_0xa1b7('0x19')][_0xa1b7('0x1c')],function(_0x58118a){return{'model':db[_0x58118a[_0xa1b7('0x1d')]],'as':_0x58118a['as'],'attributes':_0x58118a[_0xa1b7('0x1e')],'include':_0x58118a[_0xa1b7('0x1c')]?_[_0xa1b7('0x1b')](_0x58118a[_0xa1b7('0x1c')],function(_0x3ebfce){return{'model':db[_0x3ebfce[_0xa1b7('0x1d')]],'as':_0x3ebfce['as'],'attributes':_0x3ebfce[_0xa1b7('0x1e')],'include':_0x3ebfce[_0xa1b7('0x1c')]?_[_0xa1b7('0x1b')](_0x3ebfce['include'],function(_0x20c18f){return{'model':db[_0x20c18f[_0xa1b7('0x1d')]],'as':_0x20c18f['as'],'attributes':_0x20c18f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa1b7('0xa')](function(_0x414d31){logger[_0xa1b7('0xb')](_0xa1b7('0x16'),_0x1322bf);logger[_0xa1b7('0xd')](_0xa1b7('0x16'),_0x1322bf,JSON[_0xa1b7('0xf')](_0x414d31));_0x57d2a0(_0x414d31);})['catch'](function(_0xb5d133){logger['error'](_0xa1b7('0x16'),_0xb5d133[_0xa1b7('0x13')],_0x1322bf);_0x4ab00f(_0x28f55e[_0xa1b7('0x10')](0x1f4,_0xb5d133[_0xa1b7('0x13')]));});});};exports[_0xa1b7('0x1f')]=function(_0x4defd){var _0x211a3c=this;return new Promise(function(_0xa0c5df,_0x4cf90e){return db['Dynamics365Account']['find']({'raw':_0x4defd['options']?_0x4defd[_0xa1b7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4defd[_0xa1b7('0x19')]?_0x4defd[_0xa1b7('0x19')]['where']||null:null,'attributes':_0x4defd[_0xa1b7('0x19')]?_0x4defd['options'][_0xa1b7('0x1e')]||null:null,'include':_0x4defd['options']?_0x4defd[_0xa1b7('0x19')][_0xa1b7('0x1c')]?_[_0xa1b7('0x1b')](_0x4defd[_0xa1b7('0x19')][_0xa1b7('0x1c')],function(_0x5c18c8){return{'model':db[_0x5c18c8[_0xa1b7('0x1d')]],'as':_0x5c18c8['as'],'attributes':_0x5c18c8[_0xa1b7('0x1e')],'include':_0x5c18c8[_0xa1b7('0x1c')]?_[_0xa1b7('0x1b')](_0x5c18c8[_0xa1b7('0x1c')],function(_0xd2b397){return{'model':db[_0xd2b397[_0xa1b7('0x1d')]],'as':_0xd2b397['as'],'attributes':_0xd2b397[_0xa1b7('0x1e')],'include':_0xd2b397[_0xa1b7('0x1c')]?_['map'](_0xd2b397[_0xa1b7('0x1c')],function(_0x5d738e){return{'model':db[_0x5d738e[_0xa1b7('0x1d')]],'as':_0x5d738e['as'],'attributes':_0x5d738e[_0xa1b7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa1b7('0xa')](function(_0xeabce6){logger[_0xa1b7('0xb')]('ShowDynamics365Account',_0x4defd);logger['debug'](_0xa1b7('0x1f'),_0x4defd,JSON[_0xa1b7('0xf')](_0xeabce6));_0xa0c5df(_0xeabce6);})[_0xa1b7('0x15')](function(_0x10527c){logger[_0xa1b7('0x10')](_0xa1b7('0x1f'),_0x10527c[_0xa1b7('0x13')],_0x4defd);_0x4cf90e(_0x211a3c[_0xa1b7('0x10')](0x1f4,_0x10527c[_0xa1b7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index d90514f..890f18c 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 _0x18b3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','destroy','exports','multer','util'];(function(_0x16adf1,_0x1273a5){var _0xc13362=function(_0x35e767){while(--_0x35e767){_0x16adf1['push'](_0x16adf1['shift']());}};_0xc13362(++_0x1273a5);}(_0x18b3,0x140));var _0x318b=function(_0x4f5acc,_0x3a537d){_0x4f5acc=_0x4f5acc-0x0;var _0x25fe2f=_0x18b3[_0x4f5acc];return _0x25fe2f;};'use strict';var multer=require(_0x318b('0x0'));var util=require(_0x318b('0x1'));var path=require('path');var timeout=require(_0x318b('0x2'));var express=require(_0x318b('0x3'));var router=express[_0x318b('0x4')]();var fs_extra=require(_0x318b('0x5'));var auth=require(_0x318b('0x6'));var interaction=require(_0x318b('0x7'));var config=require(_0x318b('0x8'));var controller=require('./intDynamics365Configuration.controller');router[_0x318b('0x9')]('/',auth[_0x318b('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x318b('0xb')]);router[_0x318b('0x9')]('/:id/fields',auth[_0x318b('0xa')](),controller[_0x318b('0xc')]);router['get'](_0x318b('0xd'),auth[_0x318b('0xa')](),controller[_0x318b('0xe')]);router[_0x318b('0x9')](_0x318b('0xf'),auth[_0x318b('0xa')](),controller[_0x318b('0x10')]);router[_0x318b('0x11')]('/',auth[_0x318b('0xa')](),controller[_0x318b('0x12')]);router[_0x318b('0x13')](_0x318b('0x14'),auth[_0x318b('0xa')](),controller['update']);router['delete'](_0x318b('0x14'),auth['isAuthenticated'](),controller[_0x318b('0x15')]);module[_0x318b('0x16')]=router; \ No newline at end of file +var _0xbecf=['update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put'];(function(_0x4befd0,_0x42b675){var _0x5b13cd=function(_0x1f8758){while(--_0x1f8758){_0x4befd0['push'](_0x4befd0['shift']());}};_0x5b13cd(++_0x42b675);}(_0xbecf,0x15c));var _0xfbec=function(_0x1ef3a0,_0x3b012b){_0x1ef3a0=_0x1ef3a0-0x0;var _0x5e4843=_0xbecf[_0x1ef3a0];return _0x5e4843;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfbec('0x0'));var timeout=require(_0xfbec('0x1'));var express=require(_0xfbec('0x2'));var router=express[_0xfbec('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfbec('0x4'));var interaction=require(_0xfbec('0x5'));var config=require(_0xfbec('0x6'));var controller=require(_0xfbec('0x7'));router[_0xfbec('0x8')]('/',auth['isAuthenticated'](),controller[_0xfbec('0x9')]);router[_0xfbec('0x8')](_0xfbec('0xa'),auth[_0xfbec('0xb')](),controller[_0xfbec('0xc')]);router[_0xfbec('0x8')](_0xfbec('0xd'),auth[_0xfbec('0xb')](),controller[_0xfbec('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xfbec('0xf')]);router[_0xfbec('0x8')](_0xfbec('0x10'),auth[_0xfbec('0xb')](),controller[_0xfbec('0x11')]);router['post']('/',auth[_0xfbec('0xb')](),controller[_0xfbec('0x12')]);router[_0xfbec('0x13')](_0xfbec('0xa'),auth['isAuthenticated'](),controller[_0xfbec('0x14')]);router[_0xfbec('0x15')](_0xfbec('0xa'),auth[_0xfbec('0xb')](),controller['destroy']);module[_0xfbec('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index de51c46..505cd0e 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 _0x29f6=['STRING','ENUM','phonecall','contact','BOOLEAN','sequelize'];(function(_0x1b3ce2,_0x348169){var _0x35773e=function(_0x4bf2b2){while(--_0x4bf2b2){_0x1b3ce2['push'](_0x1b3ce2['shift']());}};_0x35773e(++_0x348169);}(_0x29f6,0xd7));var _0x629f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x629f('0x0'));module['exports']={'name':{'type':Sequelize[_0x629f('0x1')]},'description':{'type':Sequelize[_0x629f('0x1')]},'ticketType':{'type':Sequelize[_0x629f('0x2')]('incident',_0x629f('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x629f('0x2')]('contact','nothing'),'defaultValue':_0x629f('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x629f('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x629f('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2f2d=['BOOLEAN','STRING','ENUM','incident','contact','nothing'];(function(_0x2303c6,_0x19c9a5){var _0xc20a02=function(_0x2622e3){while(--_0x2622e3){_0x2303c6['push'](_0x2303c6['shift']());}};_0xc20a02(++_0x19c9a5);}(_0x2f2d,0xc7));var _0xd2f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f2d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd2f2('0x0')]},'ticketType':{'type':Sequelize[_0xd2f2('0x1')]('incident','phonecall'),'defaultValue':_0xd2f2('0x2')},'moduleCreate':{'type':Sequelize['ENUM'](_0xd2f2('0x3'),_0xd2f2('0x4')),'defaultValue':_0xd2f2('0x3'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xd2f2('0x0')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xd2f2('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a0741cc..1217ef7 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 _0x521b=['findOne','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','reject','save','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','where','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','getFields','Dynamics365Field','nolimit','getSubjects'];(function(_0x539b87,_0x539a83){var _0x1a0df=function(_0x35d1b8){while(--_0x35d1b8){_0x539b87['push'](_0x539b87['shift']());}};_0x1a0df(++_0x539a83);}(_0x521b,0x1ac));var _0xb521=function(_0x2f2ff5,_0x352b1c){_0x2f2ff5=_0x2f2ff5-0x0;var _0x1df50c=_0x521b[_0x2f2ff5];return _0x1df50c;};'use strict';var emlformat=require(_0xb521('0x0'));var rimraf=require(_0xb521('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb521('0x2'));var rp=require(_0xb521('0x3'));var moment=require(_0xb521('0x4'));var BPromise=require(_0xb521('0x5'));var Mustache=require(_0xb521('0x6'));var util=require('util');var path=require(_0xb521('0x7'));var sox=require(_0xb521('0x8'));var csv=require(_0xb521('0x9'));var ejs=require(_0xb521('0xa'));var fs=require('fs');var fs_extra=require(_0xb521('0xb'));var _=require(_0xb521('0xc'));var squel=require(_0xb521('0xd'));var crypto=require(_0xb521('0xe'));var jsforce=require(_0xb521('0xf'));var deskjs=require(_0xb521('0x10'));var toCsv=require(_0xb521('0x9'));var querystring=require(_0xb521('0x11'));var Papa=require(_0xb521('0x12'));var Redis=require('ioredis');var authService=require(_0xb521('0x13'));var qs=require(_0xb521('0x14'));var as=require(_0xb521('0x15'));var hardwareService=require(_0xb521('0x16'));var logger=require(_0xb521('0x17'))(_0xb521('0x18'));var utils=require(_0xb521('0x19'));var config=require(_0xb521('0x1a'));var licenseUtil=require(_0xb521('0x1b'));var db=require(_0xb521('0x1c'))['db'];function respondWithStatusCode(_0x1ef375,_0x53be87){_0x53be87=_0x53be87||0xcc;return function(_0x5cd04a){if(_0x5cd04a){return _0x1ef375[_0xb521('0x1d')](_0x53be87);}return _0x1ef375[_0xb521('0x1e')](_0x53be87)['end']();};}function respondWithResult(_0x5d5965,_0x320874){_0x320874=_0x320874||0xc8;return function(_0x425847){if(_0x425847){return _0x5d5965['status'](_0x320874)[_0xb521('0x1f')](_0x425847);}};}function respondWithFilteredResult(_0x480109,_0x1b0a56){return function(_0x7f055c){if(_0x7f055c){var _0x178fbe=typeof _0x1b0a56['offset']==='undefined'&&typeof _0x1b0a56['limit']===_0xb521('0x20');var _0x2b1703=_0x7f055c[_0xb521('0x21')];var _0x29237b=_0x178fbe?0x0:_0x1b0a56[_0xb521('0x22')];var _0x39cc3b=_0x178fbe?_0x7f055c['count']:_0x1b0a56['offset']+_0x1b0a56['limit'];var _0x2dc671;if(_0x39cc3b>=_0x2b1703){_0x39cc3b=_0x2b1703;_0x2dc671=0xc8;}else{_0x2dc671=0xce;}_0x480109[_0xb521('0x1e')](_0x2dc671);return _0x480109[_0xb521('0x23')]('Content-Range',_0x29237b+'-'+_0x39cc3b+'/'+_0x2b1703)[_0xb521('0x1f')](_0x7f055c);}return null;};}function patchUpdates(_0x4230b7){return function(_0x2d82a8){try{jsonpatch['apply'](_0x2d82a8,_0x4230b7,!![]);}catch(_0x1a969d){return BPromise[_0xb521('0x24')](_0x1a969d);}return _0x2d82a8[_0xb521('0x25')]();};}function saveUpdates(_0x459d38,_0x481625){return function(_0x38cba4){if(_0x38cba4){return _0x38cba4[_0xb521('0x26')](_0x459d38)[_0xb521('0x27')](function(_0x38d419){return _0x38d419;});}return null;};}function removeEntity(_0xb412b1,_0x55766a){return function(_0x1808e7){if(_0x1808e7){return _0x1808e7['destroy']()[_0xb521('0x27')](function(){_0xb412b1[_0xb521('0x1e')](0xcc)[_0xb521('0x28')]();});}};}function handleEntityNotFound(_0x2359b9,_0x31a50a){return function(_0x30dbe3){if(!_0x30dbe3){_0x2359b9[_0xb521('0x1d')](0x194);}return _0x30dbe3;};}function handleError(_0x1895a7,_0x1ed0ba){_0x1ed0ba=_0x1ed0ba||0x1f4;return function(_0x5a403b){logger[_0xb521('0x29')](_0x5a403b[_0xb521('0x2a')]);if(_0x5a403b[_0xb521('0x2b')]){delete _0x5a403b[_0xb521('0x2b')];}_0x1895a7['status'](_0x1ed0ba)[_0xb521('0x2c')](_0x5a403b);};}exports['index']=function(_0x2a77d1,_0x2c5a6a){var _0x393da1={},_0x24569a={},_0x104e0b={'count':0x0,'rows':[]};var _0x36bde0=_[_0xb521('0x2d')](db['Dynamics365Configuration'][_0xb521('0x2e')],function(_0x38deec){return{'name':_0x38deec[_0xb521('0x2f')],'type':_0x38deec[_0xb521('0x30')]['key']};});_0x24569a[_0xb521('0x31')]=_[_0xb521('0x2d')](_0x36bde0,_0xb521('0x2b'));_0x24569a[_0xb521('0x32')]=_['keys'](_0x2a77d1[_0xb521('0x32')]);_0x24569a[_0xb521('0x33')]=_[_0xb521('0x34')](_0x24569a[_0xb521('0x31')],_0x24569a[_0xb521('0x32')]);_0x393da1[_0xb521('0x35')]=_[_0xb521('0x34')](_0x24569a[_0xb521('0x31')],qs[_0xb521('0x36')](_0x2a77d1[_0xb521('0x32')][_0xb521('0x36')]));_0x393da1[_0xb521('0x35')]=_0x393da1['attributes'][_0xb521('0x37')]?_0x393da1[_0xb521('0x35')]:_0x24569a['model'];if(!_0x2a77d1[_0xb521('0x32')][_0xb521('0x38')]('nolimit')){_0x393da1[_0xb521('0x39')]=qs[_0xb521('0x39')](_0x2a77d1['query'][_0xb521('0x39')]);_0x393da1[_0xb521('0x22')]=qs['offset'](_0x2a77d1['query']['offset']);}_0x393da1[_0xb521('0x3a')]=qs[_0xb521('0x3b')](_0x2a77d1['query'][_0xb521('0x3b')]);_0x393da1['where']=qs['filters'](_['pick'](_0x2a77d1[_0xb521('0x32')],_0x24569a['filters']),_0x36bde0);if(_0x2a77d1[_0xb521('0x32')][_0xb521('0x3c')]){_0x393da1[_0xb521('0x3d')]=_[_0xb521('0x3e')](_0x393da1[_0xb521('0x3d')],{'$or':_[_0xb521('0x2d')](_0x36bde0,function(_0x5281fc){if(_0x5281fc[_0xb521('0x30')]!==_0xb521('0x3f')){var _0x53533e={};_0x53533e[_0x5281fc[_0xb521('0x2b')]]={'$like':'%'+_0x2a77d1['query'][_0xb521('0x3c')]+'%'};return _0x53533e;}})});}_0x393da1=_[_0xb521('0x3e')]({},_0x393da1,_0x2a77d1[_0xb521('0x40')]);var _0x51d048={'where':_0x393da1['where']};return db[_0xb521('0x41')][_0xb521('0x21')](_0x51d048)['then'](function(_0x1bd9fc){_0x104e0b[_0xb521('0x21')]=_0x1bd9fc;if(_0x2a77d1['query'][_0xb521('0x42')]){_0x393da1[_0xb521('0x43')]=[{'all':!![]}];}return db[_0xb521('0x41')][_0xb521('0x44')](_0x393da1);})[_0xb521('0x27')](function(_0x17994a){_0x104e0b[_0xb521('0x45')]=_0x17994a;return _0x104e0b;})[_0xb521('0x27')](respondWithFilteredResult(_0x2c5a6a,_0x393da1))[_0xb521('0x46')](handleError(_0x2c5a6a,null));};exports[_0xb521('0x47')]=function(_0x4973e8,_0x4ad576){var _0x4e49ce={'raw':![],'where':{'id':_0x4973e8[_0xb521('0x48')]['id']}},_0x1f35b1={};_0x1f35b1[_0xb521('0x31')]=_['keys'](db[_0xb521('0x41')]['rawAttributes']);_0x1f35b1[_0xb521('0x32')]=_[_0xb521('0x49')](_0x4973e8[_0xb521('0x32')]);_0x1f35b1[_0xb521('0x33')]=_['intersection'](_0x1f35b1[_0xb521('0x31')],_0x1f35b1[_0xb521('0x32')]);_0x4e49ce[_0xb521('0x35')]=_[_0xb521('0x34')](_0x1f35b1[_0xb521('0x31')],qs[_0xb521('0x36')](_0x4973e8[_0xb521('0x32')][_0xb521('0x36')]));_0x4e49ce['attributes']=_0x4e49ce[_0xb521('0x35')][_0xb521('0x37')]?_0x4e49ce[_0xb521('0x35')]:_0x1f35b1['model'];if(_0x4973e8[_0xb521('0x32')][_0xb521('0x42')]){_0x4e49ce[_0xb521('0x43')]=[{'all':!![]}];}_0x4e49ce=_[_0xb521('0x3e')]({},_0x4e49ce,_0x4973e8[_0xb521('0x40')]);return db[_0xb521('0x41')]['find'](_0x4e49ce)[_0xb521('0x27')](handleEntityNotFound(_0x4ad576,null))['then'](respondWithResult(_0x4ad576,null))[_0xb521('0x46')](handleError(_0x4ad576,null));};exports[_0xb521('0x4a')]=function(_0x28cf78,_0x23a0b0){return db[_0xb521('0x41')]['create'](_0x28cf78[_0xb521('0x4b')],{})['then'](respondWithResult(_0x23a0b0,0xc9))[_0xb521('0x46')](handleError(_0x23a0b0,null));};exports[_0xb521('0x26')]=function(_0x36311f,_0x4dc5f9){if(_0x36311f[_0xb521('0x4b')]['id']){delete _0x36311f[_0xb521('0x4b')]['id'];}return db['Dynamics365Configuration'][_0xb521('0x4c')]({'where':{'id':_0x36311f[_0xb521('0x48')]['id']}})[_0xb521('0x27')](handleEntityNotFound(_0x4dc5f9,null))[_0xb521('0x27')](saveUpdates(_0x36311f['body'],null))[_0xb521('0x27')](respondWithResult(_0x4dc5f9,null))[_0xb521('0x46')](handleError(_0x4dc5f9,null));};exports[_0xb521('0x4d')]=function(_0x1f853e,_0x115294){return db['Dynamics365Configuration'][_0xb521('0x4c')]({'where':{'id':_0x1f853e[_0xb521('0x48')]['id']}})[_0xb521('0x27')](handleEntityNotFound(_0x115294,null))['then'](removeEntity(_0x115294,null))['catch'](handleError(_0x115294,null));};exports[_0xb521('0x4e')]=function(_0x3c8de3,_0xfa949e,_0x349c14){var _0x11ecd1={};var _0x1895b7={};var _0x3db833;var _0x260dd3;return db[_0xb521('0x41')]['findOne']({'where':{'id':_0x3c8de3[_0xb521('0x48')]['id']}})[_0xb521('0x27')](handleEntityNotFound(_0xfa949e,null))['then'](function(_0x153782){if(_0x153782){_0x3db833=_0x153782;_0x1895b7[_0xb521('0x31')]=_[_0xb521('0x49')](db[_0xb521('0x4f')][_0xb521('0x2e')]);_0x1895b7[_0xb521('0x32')]=_[_0xb521('0x49')](_0x3c8de3['query']);_0x1895b7[_0xb521('0x33')]=_[_0xb521('0x34')](_0x1895b7[_0xb521('0x31')],_0x1895b7[_0xb521('0x32')]);_0x11ecd1[_0xb521('0x35')]=_[_0xb521('0x34')](_0x1895b7[_0xb521('0x31')],qs[_0xb521('0x36')](_0x3c8de3['query']['fields']));_0x11ecd1[_0xb521('0x35')]=_0x11ecd1[_0xb521('0x35')][_0xb521('0x37')]?_0x11ecd1[_0xb521('0x35')]:_0x1895b7[_0xb521('0x31')];_0x11ecd1[_0xb521('0x3a')]=qs[_0xb521('0x3b')](_0x3c8de3[_0xb521('0x32')][_0xb521('0x3b')]);_0x11ecd1['where']=qs[_0xb521('0x33')](_['pick'](_0x3c8de3[_0xb521('0x32')],_0x1895b7[_0xb521('0x33')]));if(_0x3c8de3[_0xb521('0x32')][_0xb521('0x3c')]){_0x11ecd1['where']=_[_0xb521('0x3e')](_0x11ecd1[_0xb521('0x3d')],{'$or':_[_0xb521('0x2d')](_0x11ecd1[_0xb521('0x35')],function(_0x54617e){var _0x5efd53={};_0x5efd53[_0x54617e]={'$like':'%'+_0x3c8de3[_0xb521('0x32')][_0xb521('0x3c')]+'%'};return _0x5efd53;})});}_0x11ecd1=_[_0xb521('0x3e')]({},_0x11ecd1,_0x3c8de3['options']);return _0x3db833[_0xb521('0x4e')](_0x11ecd1);}})[_0xb521('0x27')](function(_0x5b54cb){if(_0x5b54cb){_0x260dd3=_0x5b54cb[_0xb521('0x37')];if(!_0x3c8de3[_0xb521('0x32')][_0xb521('0x38')](_0xb521('0x50'))){_0x11ecd1['limit']=qs['limit'](_0x3c8de3[_0xb521('0x32')]['limit']);_0x11ecd1[_0xb521('0x22')]=qs[_0xb521('0x22')](_0x3c8de3[_0xb521('0x32')]['offset']);}return _0x3db833[_0xb521('0x4e')](_0x11ecd1);}})[_0xb521('0x27')](function(_0x214320){if(_0x214320){return _0x214320?{'count':_0x260dd3,'rows':_0x214320}:null;}})['then'](respondWithResult(_0xfa949e,null))[_0xb521('0x46')](handleError(_0xfa949e,null));};exports[_0xb521('0x51')]=function(_0x19fedb,_0x459d36,_0x510880){var _0x2376d8={};var _0x253313={};var _0x177af2;var _0x72f1f1;return db[_0xb521('0x41')][_0xb521('0x52')]({'where':{'id':_0x19fedb['params']['id']}})['then'](handleEntityNotFound(_0x459d36,null))[_0xb521('0x27')](function(_0x66517){if(_0x66517){_0x177af2=_0x66517;_0x253313[_0xb521('0x31')]=_[_0xb521('0x49')](db['Dynamics365Field']['rawAttributes']);_0x253313[_0xb521('0x32')]=_[_0xb521('0x49')](_0x19fedb[_0xb521('0x32')]);_0x253313[_0xb521('0x33')]=_[_0xb521('0x34')](_0x253313['model'],_0x253313[_0xb521('0x32')]);_0x2376d8[_0xb521('0x35')]=_[_0xb521('0x34')](_0x253313['model'],qs[_0xb521('0x36')](_0x19fedb[_0xb521('0x32')][_0xb521('0x36')]));_0x2376d8[_0xb521('0x35')]=_0x2376d8['attributes'][_0xb521('0x37')]?_0x2376d8[_0xb521('0x35')]:_0x253313[_0xb521('0x31')];_0x2376d8['order']=qs[_0xb521('0x3b')](_0x19fedb[_0xb521('0x32')][_0xb521('0x3b')]);_0x2376d8[_0xb521('0x3d')]=qs[_0xb521('0x33')](_[_0xb521('0x53')](_0x19fedb[_0xb521('0x32')],_0x253313[_0xb521('0x33')]));if(_0x19fedb['query'][_0xb521('0x3c')]){_0x2376d8[_0xb521('0x3d')]=_[_0xb521('0x3e')](_0x2376d8['where'],{'$or':_[_0xb521('0x2d')](_0x2376d8[_0xb521('0x35')],function(_0x2368a7){var _0x3d69b5={};_0x3d69b5[_0x2368a7]={'$like':'%'+_0x19fedb[_0xb521('0x32')][_0xb521('0x3c')]+'%'};return _0x3d69b5;})});}_0x2376d8=_['merge']({},_0x2376d8,_0x19fedb['options']);return _0x177af2[_0xb521('0x51')](_0x2376d8);}})[_0xb521('0x27')](function(_0x332bbd){if(_0x332bbd){_0x72f1f1=_0x332bbd[_0xb521('0x37')];if(!_0x19fedb[_0xb521('0x32')][_0xb521('0x38')]('nolimit')){_0x2376d8[_0xb521('0x39')]=qs['limit'](_0x19fedb['query']['limit']);_0x2376d8[_0xb521('0x22')]=qs['offset'](_0x19fedb[_0xb521('0x32')]['offset']);}return _0x177af2[_0xb521('0x51')](_0x2376d8);}})['then'](function(_0x405225){if(_0x405225){return _0x405225?{'count':_0x72f1f1,'rows':_0x405225}:null;}})[_0xb521('0x27')](respondWithResult(_0x459d36,null))[_0xb521('0x46')](handleError(_0x459d36,null));};exports['getDescriptions']=function(_0x3aac60,_0x5d6330,_0x1dfbd2){var _0x550c9b={};var _0x5c3ca0={};var _0x3b49fd;var _0x397a31;return db['Dynamics365Configuration'][_0xb521('0x52')]({'where':{'id':_0x3aac60[_0xb521('0x48')]['id']}})[_0xb521('0x27')](handleEntityNotFound(_0x5d6330,null))[_0xb521('0x27')](function(_0x581880){if(_0x581880){_0x3b49fd=_0x581880;_0x5c3ca0[_0xb521('0x31')]=_[_0xb521('0x49')](db[_0xb521('0x4f')][_0xb521('0x2e')]);_0x5c3ca0[_0xb521('0x32')]=_[_0xb521('0x49')](_0x3aac60[_0xb521('0x32')]);_0x5c3ca0[_0xb521('0x33')]=_[_0xb521('0x34')](_0x5c3ca0[_0xb521('0x31')],_0x5c3ca0[_0xb521('0x32')]);_0x550c9b['attributes']=_[_0xb521('0x34')](_0x5c3ca0[_0xb521('0x31')],qs[_0xb521('0x36')](_0x3aac60[_0xb521('0x32')][_0xb521('0x36')]));_0x550c9b[_0xb521('0x35')]=_0x550c9b[_0xb521('0x35')][_0xb521('0x37')]?_0x550c9b[_0xb521('0x35')]:_0x5c3ca0[_0xb521('0x31')];_0x550c9b[_0xb521('0x3a')]=qs[_0xb521('0x3b')](_0x3aac60[_0xb521('0x32')]['sort']);_0x550c9b[_0xb521('0x3d')]=qs[_0xb521('0x33')](_['pick'](_0x3aac60[_0xb521('0x32')],_0x5c3ca0[_0xb521('0x33')]));if(_0x3aac60[_0xb521('0x32')][_0xb521('0x3c')]){_0x550c9b[_0xb521('0x3d')]=_[_0xb521('0x3e')](_0x550c9b['where'],{'$or':_[_0xb521('0x2d')](_0x550c9b['attributes'],function(_0x205db9){var _0x4c0094={};_0x4c0094[_0x205db9]={'$like':'%'+_0x3aac60[_0xb521('0x32')][_0xb521('0x3c')]+'%'};return _0x4c0094;})});}_0x550c9b=_['merge']({},_0x550c9b,_0x3aac60['options']);return _0x3b49fd[_0xb521('0x54')](_0x550c9b);}})['then'](function(_0x63be15){if(_0x63be15){_0x397a31=_0x63be15['length'];if(!_0x3aac60[_0xb521('0x32')][_0xb521('0x38')](_0xb521('0x50'))){_0x550c9b[_0xb521('0x39')]=qs[_0xb521('0x39')](_0x3aac60[_0xb521('0x32')][_0xb521('0x39')]);_0x550c9b[_0xb521('0x22')]=qs['offset'](_0x3aac60[_0xb521('0x32')]['offset']);}return _0x3b49fd[_0xb521('0x54')](_0x550c9b);}})[_0xb521('0x27')](function(_0x103646){if(_0x103646){return _0x103646?{'count':_0x397a31,'rows':_0x103646}:null;}})[_0xb521('0x27')](respondWithResult(_0x5d6330,null))[_0xb521('0x46')](handleError(_0x5d6330,null));}; \ No newline at end of file +var _0x1eea=['map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','Dynamics365Field','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index'];(function(_0x1eba65,_0x429c2f){var _0xc6775c=function(_0x27bc70){while(--_0x27bc70){_0x1eba65['push'](_0x1eba65['shift']());}};_0xc6775c(++_0x429c2f);}(_0x1eea,0x1e2));var _0xa1ee=function(_0x2e93a3,_0x6b7be5){_0x2e93a3=_0x2e93a3-0x0;var _0x4e0778=_0x1eea[_0x2e93a3];return _0x4e0778;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1ee('0x0'));var zipdir=require(_0xa1ee('0x1'));var jsonpatch=require(_0xa1ee('0x2'));var rp=require('request-promise');var moment=require(_0xa1ee('0x3'));var BPromise=require(_0xa1ee('0x4'));var Mustache=require('mustache');var util=require(_0xa1ee('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa1ee('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa1ee('0x7'));var squel=require('squel');var crypto=require(_0xa1ee('0x8'));var jsforce=require(_0xa1ee('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xa1ee('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa1ee('0xa'));var authService=require('../../components/auth/service');var qs=require(_0xa1ee('0xb'));var as=require(_0xa1ee('0xc'));var hardwareService=require(_0xa1ee('0xd'));var logger=require(_0xa1ee('0xe'))(_0xa1ee('0xf'));var utils=require('../../config/utils');var config=require(_0xa1ee('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1ee('0x11'))['db'];function respondWithStatusCode(_0x28abe2,_0x4c0f7f){_0x4c0f7f=_0x4c0f7f||0xcc;return function(_0x539e60){if(_0x539e60){return _0x28abe2[_0xa1ee('0x12')](_0x4c0f7f);}return _0x28abe2[_0xa1ee('0x13')](_0x4c0f7f)[_0xa1ee('0x14')]();};}function respondWithResult(_0x438b55,_0x2afce8){_0x2afce8=_0x2afce8||0xc8;return function(_0xaa4ad8){if(_0xaa4ad8){return _0x438b55[_0xa1ee('0x13')](_0x2afce8)['json'](_0xaa4ad8);}};}function respondWithFilteredResult(_0x48f315,_0x4ed1a5){return function(_0x1744a4){if(_0x1744a4){var _0xf64a0c=typeof _0x4ed1a5[_0xa1ee('0x15')]===_0xa1ee('0x16')&&typeof _0x4ed1a5[_0xa1ee('0x17')]===_0xa1ee('0x16');var _0x4a5779=_0x1744a4[_0xa1ee('0x18')];var _0x2db698=_0xf64a0c?0x0:_0x4ed1a5[_0xa1ee('0x15')];var _0x418c65=_0xf64a0c?_0x1744a4[_0xa1ee('0x18')]:_0x4ed1a5[_0xa1ee('0x15')]+_0x4ed1a5[_0xa1ee('0x17')];var _0x27fcc3;if(_0x418c65>=_0x4a5779){_0x418c65=_0x4a5779;_0x27fcc3=0xc8;}else{_0x27fcc3=0xce;}_0x48f315['status'](_0x27fcc3);return _0x48f315['set'](_0xa1ee('0x19'),_0x2db698+'-'+_0x418c65+'/'+_0x4a5779)['json'](_0x1744a4);}return null;};}function patchUpdates(_0x427d0b){return function(_0x42a990){try{jsonpatch[_0xa1ee('0x1a')](_0x42a990,_0x427d0b,!![]);}catch(_0x237440){return BPromise[_0xa1ee('0x1b')](_0x237440);}return _0x42a990[_0xa1ee('0x1c')]();};}function saveUpdates(_0x1cd0b4,_0x53023a){return function(_0x5decbb){if(_0x5decbb){return _0x5decbb[_0xa1ee('0x1d')](_0x1cd0b4)['then'](function(_0x49ef9f){return _0x49ef9f;});}return null;};}function removeEntity(_0x4dace5,_0x1a49ca){return function(_0x5c6b80){if(_0x5c6b80){return _0x5c6b80[_0xa1ee('0x1e')]()[_0xa1ee('0x1f')](function(){_0x4dace5['status'](0xcc)[_0xa1ee('0x14')]();});}};}function handleEntityNotFound(_0x23cd7a,_0x1c78ff){return function(_0x3fb395){if(!_0x3fb395){_0x23cd7a[_0xa1ee('0x12')](0x194);}return _0x3fb395;};}function handleError(_0x5b89a1,_0x3530a0){_0x3530a0=_0x3530a0||0x1f4;return function(_0x519c13){logger[_0xa1ee('0x20')](_0x519c13[_0xa1ee('0x21')]);if(_0x519c13[_0xa1ee('0x22')]){delete _0x519c13[_0xa1ee('0x22')];}_0x5b89a1[_0xa1ee('0x13')](_0x3530a0)['send'](_0x519c13);};}exports[_0xa1ee('0x23')]=function(_0x448835,_0xedd47a){var _0x330b09={},_0x189e93={},_0x9e7d4={'count':0x0,'rows':[]};var _0x29d873=_[_0xa1ee('0x24')](db[_0xa1ee('0x25')][_0xa1ee('0x26')],function(_0x34f3ad){return{'name':_0x34f3ad[_0xa1ee('0x27')],'type':_0x34f3ad[_0xa1ee('0x28')]['key']};});_0x189e93[_0xa1ee('0x29')]=_[_0xa1ee('0x24')](_0x29d873,'name');_0x189e93[_0xa1ee('0x2a')]=_[_0xa1ee('0x2b')](_0x448835[_0xa1ee('0x2a')]);_0x189e93['filters']=_[_0xa1ee('0x2c')](_0x189e93[_0xa1ee('0x29')],_0x189e93[_0xa1ee('0x2a')]);_0x330b09[_0xa1ee('0x2d')]=_[_0xa1ee('0x2c')](_0x189e93[_0xa1ee('0x29')],qs['fields'](_0x448835[_0xa1ee('0x2a')][_0xa1ee('0x2e')]));_0x330b09[_0xa1ee('0x2d')]=_0x330b09[_0xa1ee('0x2d')][_0xa1ee('0x2f')]?_0x330b09[_0xa1ee('0x2d')]:_0x189e93[_0xa1ee('0x29')];if(!_0x448835[_0xa1ee('0x2a')][_0xa1ee('0x30')]('nolimit')){_0x330b09[_0xa1ee('0x17')]=qs['limit'](_0x448835[_0xa1ee('0x2a')]['limit']);_0x330b09['offset']=qs[_0xa1ee('0x15')](_0x448835['query'][_0xa1ee('0x15')]);}_0x330b09[_0xa1ee('0x31')]=qs[_0xa1ee('0x32')](_0x448835[_0xa1ee('0x2a')][_0xa1ee('0x32')]);_0x330b09[_0xa1ee('0x33')]=qs[_0xa1ee('0x34')](_[_0xa1ee('0x35')](_0x448835[_0xa1ee('0x2a')],_0x189e93[_0xa1ee('0x34')]),_0x29d873);if(_0x448835[_0xa1ee('0x2a')][_0xa1ee('0x36')]){_0x330b09[_0xa1ee('0x33')]=_[_0xa1ee('0x37')](_0x330b09[_0xa1ee('0x33')],{'$or':_['map'](_0x29d873,function(_0x4a4552){if(_0x4a4552[_0xa1ee('0x28')]!==_0xa1ee('0x38')){var _0x1638e6={};_0x1638e6[_0x4a4552[_0xa1ee('0x22')]]={'$like':'%'+_0x448835[_0xa1ee('0x2a')][_0xa1ee('0x36')]+'%'};return _0x1638e6;}})});}_0x330b09=_['merge']({},_0x330b09,_0x448835[_0xa1ee('0x39')]);var _0x849eb4={'where':_0x330b09['where']};return db[_0xa1ee('0x25')][_0xa1ee('0x18')](_0x849eb4)['then'](function(_0x49562a){_0x9e7d4[_0xa1ee('0x18')]=_0x49562a;if(_0x448835['query'][_0xa1ee('0x3a')]){_0x330b09[_0xa1ee('0x3b')]=[{'all':!![]}];}return db[_0xa1ee('0x25')][_0xa1ee('0x3c')](_0x330b09);})[_0xa1ee('0x1f')](function(_0x397619){_0x9e7d4[_0xa1ee('0x3d')]=_0x397619;return _0x9e7d4;})[_0xa1ee('0x1f')](respondWithFilteredResult(_0xedd47a,_0x330b09))[_0xa1ee('0x3e')](handleError(_0xedd47a,null));};exports[_0xa1ee('0x3f')]=function(_0x362573,_0x145384){var _0x9d703={'raw':![],'where':{'id':_0x362573['params']['id']}},_0x3273ee={};_0x3273ee[_0xa1ee('0x29')]=_[_0xa1ee('0x2b')](db[_0xa1ee('0x25')][_0xa1ee('0x26')]);_0x3273ee['query']=_['keys'](_0x362573[_0xa1ee('0x2a')]);_0x3273ee[_0xa1ee('0x34')]=_[_0xa1ee('0x2c')](_0x3273ee[_0xa1ee('0x29')],_0x3273ee[_0xa1ee('0x2a')]);_0x9d703[_0xa1ee('0x2d')]=_[_0xa1ee('0x2c')](_0x3273ee['model'],qs[_0xa1ee('0x2e')](_0x362573[_0xa1ee('0x2a')][_0xa1ee('0x2e')]));_0x9d703[_0xa1ee('0x2d')]=_0x9d703[_0xa1ee('0x2d')]['length']?_0x9d703['attributes']:_0x3273ee[_0xa1ee('0x29')];if(_0x362573[_0xa1ee('0x2a')]['includeAll']){_0x9d703['include']=[{'all':!![]}];}_0x9d703=_[_0xa1ee('0x37')]({},_0x9d703,_0x362573[_0xa1ee('0x39')]);return db[_0xa1ee('0x25')][_0xa1ee('0x40')](_0x9d703)[_0xa1ee('0x1f')](handleEntityNotFound(_0x145384,null))['then'](respondWithResult(_0x145384,null))[_0xa1ee('0x3e')](handleError(_0x145384,null));};exports['create']=function(_0x430b36,_0x539228){return db[_0xa1ee('0x25')][_0xa1ee('0x41')](_0x430b36[_0xa1ee('0x42')],{})[_0xa1ee('0x1f')](respondWithResult(_0x539228,0xc9))[_0xa1ee('0x3e')](handleError(_0x539228,null));};exports[_0xa1ee('0x1d')]=function(_0x3ccd8c,_0x1172ae){if(_0x3ccd8c[_0xa1ee('0x42')]['id']){delete _0x3ccd8c[_0xa1ee('0x42')]['id'];}return db[_0xa1ee('0x25')][_0xa1ee('0x40')]({'where':{'id':_0x3ccd8c[_0xa1ee('0x43')]['id']}})[_0xa1ee('0x1f')](handleEntityNotFound(_0x1172ae,null))['then'](saveUpdates(_0x3ccd8c[_0xa1ee('0x42')],null))[_0xa1ee('0x1f')](respondWithResult(_0x1172ae,null))[_0xa1ee('0x3e')](handleError(_0x1172ae,null));};exports[_0xa1ee('0x1e')]=function(_0x5d9858,_0x3b8e32){return db[_0xa1ee('0x25')][_0xa1ee('0x40')]({'where':{'id':_0x5d9858[_0xa1ee('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b8e32,null))[_0xa1ee('0x1f')](removeEntity(_0x3b8e32,null))[_0xa1ee('0x3e')](handleError(_0x3b8e32,null));};exports[_0xa1ee('0x44')]=function(_0x5d3a99,_0x1ed539,_0x3b81f9){var _0x1b5ab3={};var _0x17a248={};var _0x46c6c6;var _0x175bb0;return db[_0xa1ee('0x25')][_0xa1ee('0x45')]({'where':{'id':_0x5d3a99[_0xa1ee('0x43')]['id']}})[_0xa1ee('0x1f')](handleEntityNotFound(_0x1ed539,null))[_0xa1ee('0x1f')](function(_0x428ce3){if(_0x428ce3){_0x46c6c6=_0x428ce3;_0x17a248[_0xa1ee('0x29')]=_[_0xa1ee('0x2b')](db[_0xa1ee('0x46')][_0xa1ee('0x26')]);_0x17a248[_0xa1ee('0x2a')]=_[_0xa1ee('0x2b')](_0x5d3a99['query']);_0x17a248[_0xa1ee('0x34')]=_[_0xa1ee('0x2c')](_0x17a248[_0xa1ee('0x29')],_0x17a248[_0xa1ee('0x2a')]);_0x1b5ab3[_0xa1ee('0x2d')]=_[_0xa1ee('0x2c')](_0x17a248[_0xa1ee('0x29')],qs[_0xa1ee('0x2e')](_0x5d3a99[_0xa1ee('0x2a')]['fields']));_0x1b5ab3[_0xa1ee('0x2d')]=_0x1b5ab3[_0xa1ee('0x2d')][_0xa1ee('0x2f')]?_0x1b5ab3[_0xa1ee('0x2d')]:_0x17a248['model'];_0x1b5ab3['order']=qs[_0xa1ee('0x32')](_0x5d3a99['query'][_0xa1ee('0x32')]);_0x1b5ab3[_0xa1ee('0x33')]=qs[_0xa1ee('0x34')](_[_0xa1ee('0x35')](_0x5d3a99[_0xa1ee('0x2a')],_0x17a248[_0xa1ee('0x34')]));if(_0x5d3a99['query']['filter']){_0x1b5ab3[_0xa1ee('0x33')]=_['merge'](_0x1b5ab3[_0xa1ee('0x33')],{'$or':_['map'](_0x1b5ab3[_0xa1ee('0x2d')],function(_0x57e0f2){var _0x3c123f={};_0x3c123f[_0x57e0f2]={'$like':'%'+_0x5d3a99[_0xa1ee('0x2a')][_0xa1ee('0x36')]+'%'};return _0x3c123f;})});}_0x1b5ab3=_[_0xa1ee('0x37')]({},_0x1b5ab3,_0x5d3a99[_0xa1ee('0x39')]);return _0x46c6c6[_0xa1ee('0x44')](_0x1b5ab3);}})[_0xa1ee('0x1f')](function(_0x5b727f){if(_0x5b727f){_0x175bb0=_0x5b727f[_0xa1ee('0x2f')];if(!_0x5d3a99[_0xa1ee('0x2a')][_0xa1ee('0x30')](_0xa1ee('0x47'))){_0x1b5ab3['limit']=qs['limit'](_0x5d3a99[_0xa1ee('0x2a')]['limit']);_0x1b5ab3[_0xa1ee('0x15')]=qs[_0xa1ee('0x15')](_0x5d3a99[_0xa1ee('0x2a')][_0xa1ee('0x15')]);}return _0x46c6c6[_0xa1ee('0x44')](_0x1b5ab3);}})[_0xa1ee('0x1f')](function(_0x9f3d77){if(_0x9f3d77){return _0x9f3d77?{'count':_0x175bb0,'rows':_0x9f3d77}:null;}})[_0xa1ee('0x1f')](respondWithResult(_0x1ed539,null))[_0xa1ee('0x3e')](handleError(_0x1ed539,null));};exports['getSubjects']=function(_0x102e6b,_0x59f6c0,_0x5f40f5){var _0x20a499={};var _0x1b062a={};var _0x523907;var _0x31876d;return db[_0xa1ee('0x25')][_0xa1ee('0x45')]({'where':{'id':_0x102e6b[_0xa1ee('0x43')]['id']}})['then'](handleEntityNotFound(_0x59f6c0,null))[_0xa1ee('0x1f')](function(_0xcf4813){if(_0xcf4813){_0x523907=_0xcf4813;_0x1b062a[_0xa1ee('0x29')]=_[_0xa1ee('0x2b')](db[_0xa1ee('0x46')][_0xa1ee('0x26')]);_0x1b062a[_0xa1ee('0x2a')]=_['keys'](_0x102e6b['query']);_0x1b062a['filters']=_[_0xa1ee('0x2c')](_0x1b062a['model'],_0x1b062a[_0xa1ee('0x2a')]);_0x20a499[_0xa1ee('0x2d')]=_[_0xa1ee('0x2c')](_0x1b062a[_0xa1ee('0x29')],qs['fields'](_0x102e6b[_0xa1ee('0x2a')][_0xa1ee('0x2e')]));_0x20a499[_0xa1ee('0x2d')]=_0x20a499[_0xa1ee('0x2d')][_0xa1ee('0x2f')]?_0x20a499['attributes']:_0x1b062a[_0xa1ee('0x29')];_0x20a499[_0xa1ee('0x31')]=qs[_0xa1ee('0x32')](_0x102e6b[_0xa1ee('0x2a')][_0xa1ee('0x32')]);_0x20a499['where']=qs[_0xa1ee('0x34')](_['pick'](_0x102e6b[_0xa1ee('0x2a')],_0x1b062a[_0xa1ee('0x34')]));if(_0x102e6b[_0xa1ee('0x2a')][_0xa1ee('0x36')]){_0x20a499[_0xa1ee('0x33')]=_[_0xa1ee('0x37')](_0x20a499[_0xa1ee('0x33')],{'$or':_[_0xa1ee('0x24')](_0x20a499['attributes'],function(_0x22abd3){var _0x4ef169={};_0x4ef169[_0x22abd3]={'$like':'%'+_0x102e6b['query'][_0xa1ee('0x36')]+'%'};return _0x4ef169;})});}_0x20a499=_['merge']({},_0x20a499,_0x102e6b['options']);return _0x523907['getSubjects'](_0x20a499);}})[_0xa1ee('0x1f')](function(_0x4219d9){if(_0x4219d9){_0x31876d=_0x4219d9[_0xa1ee('0x2f')];if(!_0x102e6b[_0xa1ee('0x2a')][_0xa1ee('0x30')](_0xa1ee('0x47'))){_0x20a499['limit']=qs[_0xa1ee('0x17')](_0x102e6b[_0xa1ee('0x2a')][_0xa1ee('0x17')]);_0x20a499[_0xa1ee('0x15')]=qs[_0xa1ee('0x15')](_0x102e6b[_0xa1ee('0x2a')]['offset']);}return _0x523907[_0xa1ee('0x48')](_0x20a499);}})[_0xa1ee('0x1f')](function(_0x35d9b2){if(_0x35d9b2){return _0x35d9b2?{'count':_0x31876d,'rows':_0x35d9b2}:null;}})[_0xa1ee('0x1f')](respondWithResult(_0x59f6c0,null))['catch'](handleError(_0x59f6c0,null));};exports[_0xa1ee('0x49')]=function(_0x226a96,_0x4b3355,_0x3aa313){var _0x3a7351={};var _0x4e5d05={};var _0x34c8bf;var _0x2b0ae9;return db['Dynamics365Configuration'][_0xa1ee('0x45')]({'where':{'id':_0x226a96[_0xa1ee('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b3355,null))[_0xa1ee('0x1f')](function(_0xa4711b){if(_0xa4711b){_0x34c8bf=_0xa4711b;_0x4e5d05[_0xa1ee('0x29')]=_[_0xa1ee('0x2b')](db[_0xa1ee('0x46')][_0xa1ee('0x26')]);_0x4e5d05['query']=_['keys'](_0x226a96[_0xa1ee('0x2a')]);_0x4e5d05[_0xa1ee('0x34')]=_[_0xa1ee('0x2c')](_0x4e5d05[_0xa1ee('0x29')],_0x4e5d05['query']);_0x3a7351[_0xa1ee('0x2d')]=_[_0xa1ee('0x2c')](_0x4e5d05[_0xa1ee('0x29')],qs[_0xa1ee('0x2e')](_0x226a96[_0xa1ee('0x2a')][_0xa1ee('0x2e')]));_0x3a7351['attributes']=_0x3a7351[_0xa1ee('0x2d')][_0xa1ee('0x2f')]?_0x3a7351['attributes']:_0x4e5d05[_0xa1ee('0x29')];_0x3a7351[_0xa1ee('0x31')]=qs['sort'](_0x226a96[_0xa1ee('0x2a')][_0xa1ee('0x32')]);_0x3a7351['where']=qs['filters'](_[_0xa1ee('0x35')](_0x226a96[_0xa1ee('0x2a')],_0x4e5d05[_0xa1ee('0x34')]));if(_0x226a96[_0xa1ee('0x2a')]['filter']){_0x3a7351[_0xa1ee('0x33')]=_[_0xa1ee('0x37')](_0x3a7351[_0xa1ee('0x33')],{'$or':_[_0xa1ee('0x24')](_0x3a7351[_0xa1ee('0x2d')],function(_0x37b7e8){var _0x19e570={};_0x19e570[_0x37b7e8]={'$like':'%'+_0x226a96['query'][_0xa1ee('0x36')]+'%'};return _0x19e570;})});}_0x3a7351=_[_0xa1ee('0x37')]({},_0x3a7351,_0x226a96['options']);return _0x34c8bf[_0xa1ee('0x49')](_0x3a7351);}})[_0xa1ee('0x1f')](function(_0x220e14){if(_0x220e14){_0x2b0ae9=_0x220e14['length'];if(!_0x226a96[_0xa1ee('0x2a')][_0xa1ee('0x30')](_0xa1ee('0x47'))){_0x3a7351[_0xa1ee('0x17')]=qs['limit'](_0x226a96['query']['limit']);_0x3a7351[_0xa1ee('0x15')]=qs[_0xa1ee('0x15')](_0x226a96['query'][_0xa1ee('0x15')]);}return _0x34c8bf['getDescriptions'](_0x3a7351);}})[_0xa1ee('0x1f')](function(_0x3c2aef){if(_0x3c2aef){return _0x3c2aef?{'count':_0x2b0ae9,'rows':_0x3c2aef}:null;}})[_0xa1ee('0x1f')](respondWithResult(_0x4b3355,null))[_0xa1ee('0x3e')](handleError(_0x4b3355,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 8506968..54c985c 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 _0xe5b3=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4311bd,_0x5a69c5){_0x4311bd=_0x4311bd-0x0;var _0xbad021=_0xe5b3[_0x4311bd];return _0xbad021;};'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 +var _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x406836,_0x5d773e){var _0x496904=function(_0x56762e){while(--_0x56762e){_0x406836['push'](_0x406836['shift']());}};_0x496904(++_0x5d773e);}(_0xdace,0xc5));var _0xedac=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0xdace[_0x5b740b];return _0x6f8f4e;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 4ce2430..0334652 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 _0x9b6b=['request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x24aa3f,_0x519ce6){var _0x217119=function(_0x3708aa){while(--_0x3708aa){_0x24aa3f['push'](_0x24aa3f['shift']());}};_0x217119(++_0x519ce6);}(_0x9b6b,0xbb));var _0xb9b6=function(_0x3fcefc,_0x3409df){_0x3fcefc=_0x3fcefc-0x0;var _0x5eeafe=_0x9b6b[_0x3fcefc];return _0x5eeafe;};'use strict';var _=require(_0xb9b6('0x0'));var util=require(_0xb9b6('0x1'));var moment=require(_0xb9b6('0x2'));var BPromise=require(_0xb9b6('0x3'));var rs=require(_0xb9b6('0x4'));var fs=require('fs');var Redis=require(_0xb9b6('0x5'));var db=require(_0xb9b6('0x6'))['db'];var utils=require(_0xb9b6('0x7'));var logger=require(_0xb9b6('0x8'))(_0xb9b6('0x9'));var config=require('../../config/environment');var jayson=require(_0xb9b6('0xa'));var client=jayson[_0xb9b6('0xb')][_0xb9b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14a057,_0x4e01d2,_0x3b97f4){return new BPromise(function(_0x54bd02,_0x32a551){return client[_0xb9b6('0xd')](_0x14a057,_0x3b97f4)[_0xb9b6('0xe')](function(_0x50bd31){logger[_0xb9b6('0xf')](_0xb9b6('0x10'),_0x4e01d2,_0xb9b6('0x11'));logger[_0xb9b6('0x12')](_0xb9b6('0x13'),_0x4e01d2,_0xb9b6('0x11'),JSON[_0xb9b6('0x14')](_0x50bd31));if(_0x50bd31[_0xb9b6('0x15')]){if(_0x50bd31['error'][_0xb9b6('0x16')]===0x1f4){logger[_0xb9b6('0x15')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4e01d2,_0x50bd31[_0xb9b6('0x15')][_0xb9b6('0x17')]);return _0x32a551(_0x50bd31[_0xb9b6('0x15')]['message']);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4e01d2,_0x50bd31[_0xb9b6('0x15')][_0xb9b6('0x17')]);return _0x54bd02(_0x50bd31['error']['message']);}else{logger[_0xb9b6('0xf')](_0xb9b6('0x10'),_0x4e01d2,_0xb9b6('0x11'));_0x54bd02(_0x50bd31['result']['message']);}})[_0xb9b6('0x18')](function(_0x51d28a){logger[_0xb9b6('0x15')](_0xb9b6('0x10'),_0x4e01d2,_0x51d28a);_0x32a551(_0x51d28a);});});} \ No newline at end of file +var _0xb8f6=['moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x3e774a,_0x1203f9){var _0x18a6d8=function(_0x1ed4fd){while(--_0x1ed4fd){_0x3e774a['push'](_0x3e774a['shift']());}};_0x18a6d8(++_0x1203f9);}(_0xb8f6,0xc6));var _0x6b8f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb8f6[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x6b8f('0x0'));var util=require(_0x6b8f('0x1'));var moment=require(_0x6b8f('0x2'));var BPromise=require(_0x6b8f('0x3'));var rs=require(_0x6b8f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b8f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6b8f('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b8f('0x7'));var client=jayson[_0x6b8f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x86027d,_0x44abd9,_0x17f287){return new BPromise(function(_0x154487,_0x1bd563){return client[_0x6b8f('0x9')](_0x86027d,_0x17f287)[_0x6b8f('0xa')](function(_0x3084f6){logger[_0x6b8f('0xb')](_0x6b8f('0xc'),_0x44abd9,_0x6b8f('0xd'));logger[_0x6b8f('0xe')](_0x6b8f('0xf'),_0x44abd9,_0x6b8f('0xd'),JSON[_0x6b8f('0x10')](_0x3084f6));if(_0x3084f6['error']){if(_0x3084f6[_0x6b8f('0x11')][_0x6b8f('0x12')]===0x1f4){logger[_0x6b8f('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x44abd9,_0x3084f6[_0x6b8f('0x11')][_0x6b8f('0x13')]);return _0x1bd563(_0x3084f6[_0x6b8f('0x11')][_0x6b8f('0x13')]);}logger[_0x6b8f('0x11')](_0x6b8f('0xc'),_0x44abd9,_0x3084f6['error'][_0x6b8f('0x13')]);return _0x154487(_0x3084f6['error'][_0x6b8f('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x44abd9,_0x6b8f('0xd'));_0x154487(_0x3084f6['result'][_0x6b8f('0x13')]);}})['catch'](function(_0x12eab3){logger[_0x6b8f('0x11')](_0x6b8f('0xc'),_0x44abd9,_0x12eab3);_0x1bd563(_0x12eab3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3741346..fa55705 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 _0x917e=['../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x917e,0x188));var _0xe917=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x917e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe917('0x0'));var util=require(_0xe917('0x1'));var path=require('path');var timeout=require(_0xe917('0x2'));var express=require(_0xe917('0x3'));var router=express[_0xe917('0x4')]();var fs_extra=require(_0xe917('0x5'));var auth=require(_0xe917('0x6'));var interaction=require(_0xe917('0x7'));var config=require(_0xe917('0x8'));var controller=require(_0xe917('0x9'));router['get']('/',auth[_0xe917('0xa')](),controller[_0xe917('0xb')]);router[_0xe917('0xc')](_0xe917('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe917('0xe')]('/',auth[_0xe917('0xa')](),controller[_0xe917('0xf')]);router[_0xe917('0x10')](_0xe917('0xd'),auth[_0xe917('0xa')](),controller[_0xe917('0x11')]);router[_0xe917('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfb20=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x50af24,_0x341478){var _0x4dbd63=function(_0xb6bf54){while(--_0xb6bf54){_0x50af24['push'](_0x50af24['shift']());}};_0x4dbd63(++_0x341478);}(_0xfb20,0x13b));var _0x0fb2=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xfb20[_0x2a67fe];return _0x57e726;};'use strict';var multer=require(_0x0fb2('0x0'));var util=require(_0x0fb2('0x1'));var path=require(_0x0fb2('0x2'));var timeout=require(_0x0fb2('0x3'));var express=require(_0x0fb2('0x4'));var router=express[_0x0fb2('0x5')]();var fs_extra=require(_0x0fb2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0fb2('0x7'));var config=require(_0x0fb2('0x8'));var controller=require(_0x0fb2('0x9'));router[_0x0fb2('0xa')]('/',auth[_0x0fb2('0xb')](),controller[_0x0fb2('0xc')]);router[_0x0fb2('0xa')](_0x0fb2('0xd'),auth[_0x0fb2('0xb')](),controller[_0x0fb2('0xe')]);router['post']('/',auth[_0x0fb2('0xb')](),controller['create']);router[_0x0fb2('0xf')](_0x0fb2('0xd'),auth[_0x0fb2('0xb')](),controller[_0x0fb2('0x10')]);router[_0x0fb2('0x11')]('/:id',auth[_0x0fb2('0xb')](),controller[_0x0fb2('0x12')]);module[_0x0fb2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 3d52ecf..2cc87c1 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 _0xc57a=['ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports'];(function(_0x3c68bb,_0x3ee29d){var _0x5e1fde=function(_0x20920e){while(--_0x20920e){_0x3c68bb['push'](_0x3c68bb['shift']());}};_0x5e1fde(++_0x3ee29d);}(_0xc57a,0xce));var _0xac57=function(_0x48f050,_0x5f1133){_0x48f050=_0x48f050-0x0;var _0x5083d4=_0xc57a[_0x48f050];return _0x5083d4;};'use strict';var Sequelize=require('sequelize');module[_0xac57('0x0')]={'type':{'type':Sequelize[_0xac57('0x1')]('string',_0xac57('0x2'),_0xac57('0x3'),_0xac57('0x4'),_0xac57('0x5')),'defaultValue':_0xac57('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xac57('0x1')](_0xac57('0x6'),_0xac57('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xac57('0x7')]},'idField':{'type':Sequelize[_0xac57('0x7')]},'nameField':{'type':Sequelize[_0xac57('0x7')]},'customField':{'type':Sequelize[_0xac57('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xac57('0x7')]}}; \ No newline at end of file +var _0x17c8=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x870732,_0x2e2062){var _0x505caa=function(_0x40bf21){while(--_0x40bf21){_0x870732['push'](_0x870732['shift']());}};_0x505caa(++_0x2e2062);}(_0x17c8,0x1a5));var _0x817c=function(_0x5817e8,_0x2f8433){_0x5817e8=_0x5817e8-0x0;var _0x4b2684=_0x17c8[_0x5817e8];return _0x4b2684;};'use strict';var Sequelize=require(_0x817c('0x0'));module[_0x817c('0x1')]={'type':{'type':Sequelize[_0x817c('0x2')](_0x817c('0x3'),_0x817c('0x4'),_0x817c('0x5'),_0x817c('0x6'),_0x817c('0x7')),'defaultValue':_0x817c('0x3')},'content':{'type':Sequelize[_0x817c('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x817c('0x5'))},'keyContent':{'type':Sequelize[_0x817c('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x817c('0x8')]},'customField':{'type':Sequelize[_0x817c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x817c('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 31550f7..f05ecb6 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 _0xcec4=['create','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','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/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','sendStatus','error','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xcec4,0x126));var _0x4cec=function(_0x51f658,_0x4c0282){_0x51f658=_0x51f658-0x0;var _0x3d8b0a=_0xcec4[_0x51f658];return _0x3d8b0a;};'use strict';var emlformat=require(_0x4cec('0x0'));var rimraf=require(_0x4cec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4cec('0x2'));var rp=require('request-promise');var moment=require(_0x4cec('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4cec('0x4'));var util=require(_0x4cec('0x5'));var path=require(_0x4cec('0x6'));var sox=require(_0x4cec('0x7'));var csv=require(_0x4cec('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4cec('0x9'));var _=require(_0x4cec('0xa'));var squel=require('squel');var crypto=require(_0x4cec('0xb'));var jsforce=require(_0x4cec('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4cec('0xd'));var Redis=require(_0x4cec('0xe'));var authService=require(_0x4cec('0xf'));var qs=require(_0x4cec('0x10'));var as=require(_0x4cec('0x11'));var hardwareService=require(_0x4cec('0x12'));var logger=require(_0x4cec('0x13'))(_0x4cec('0x14'));var utils=require(_0x4cec('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4cec('0x16'));var db=require(_0x4cec('0x17'))['db'];function respondWithStatusCode(_0x42cb99,_0x55a448){_0x55a448=_0x55a448||0xcc;return function(_0x2a37ff){if(_0x2a37ff){return _0x42cb99['sendStatus'](_0x55a448);}return _0x42cb99[_0x4cec('0x18')](_0x55a448)[_0x4cec('0x19')]();};}function respondWithResult(_0xfa7f06,_0x199e92){_0x199e92=_0x199e92||0xc8;return function(_0x3b0eb3){if(_0x3b0eb3){return _0xfa7f06[_0x4cec('0x18')](_0x199e92)[_0x4cec('0x1a')](_0x3b0eb3);}};}function respondWithFilteredResult(_0x4ab91f,_0x38f42c){return function(_0x1c1cb9){if(_0x1c1cb9){var _0x295d0a=typeof _0x38f42c[_0x4cec('0x1b')]===_0x4cec('0x1c')&&typeof _0x38f42c[_0x4cec('0x1d')]==='undefined';var _0x1736ae=_0x1c1cb9[_0x4cec('0x1e')];var _0xce52be=_0x295d0a?0x0:_0x38f42c[_0x4cec('0x1b')];var _0xfb14ea=_0x295d0a?_0x1c1cb9[_0x4cec('0x1e')]:_0x38f42c[_0x4cec('0x1b')]+_0x38f42c[_0x4cec('0x1d')];var _0x212326;if(_0xfb14ea>=_0x1736ae){_0xfb14ea=_0x1736ae;_0x212326=0xc8;}else{_0x212326=0xce;}_0x4ab91f[_0x4cec('0x18')](_0x212326);return _0x4ab91f[_0x4cec('0x1f')]('Content-Range',_0xce52be+'-'+_0xfb14ea+'/'+_0x1736ae)['json'](_0x1c1cb9);}return null;};}function patchUpdates(_0x5da4aa){return function(_0x31ba56){try{jsonpatch['apply'](_0x31ba56,_0x5da4aa,!![]);}catch(_0x1e1c6b){return BPromise[_0x4cec('0x20')](_0x1e1c6b);}return _0x31ba56[_0x4cec('0x21')]();};}function saveUpdates(_0x5d7c89,_0x1bd896){return function(_0x4ca55c){if(_0x4ca55c){return _0x4ca55c[_0x4cec('0x22')](_0x5d7c89)['then'](function(_0xfb5c90){return _0xfb5c90;});}return null;};}function removeEntity(_0x1dbed1,_0x5345c2){return function(_0x12ef16){if(_0x12ef16){return _0x12ef16['destroy']()[_0x4cec('0x23')](function(){_0x1dbed1['status'](0xcc)[_0x4cec('0x19')]();});}};}function handleEntityNotFound(_0x105a37,_0x2d667a){return function(_0x1135ad){if(!_0x1135ad){_0x105a37[_0x4cec('0x24')](0x194);}return _0x1135ad;};}function handleError(_0x25ebae,_0x2f36b9){_0x2f36b9=_0x2f36b9||0x1f4;return function(_0x3dafe2){logger[_0x4cec('0x25')](_0x3dafe2['stack']);if(_0x3dafe2[_0x4cec('0x26')]){delete _0x3dafe2[_0x4cec('0x26')];}_0x25ebae[_0x4cec('0x18')](_0x2f36b9)[_0x4cec('0x27')](_0x3dafe2);};}exports[_0x4cec('0x28')]=function(_0x4af7a9,_0x197aa9){var _0x2c666a={},_0x4b2004={},_0xa48af={'count':0x0,'rows':[]};var _0x4bc909=_[_0x4cec('0x29')](db['Dynamics365Field']['rawAttributes'],function(_0x1da834){return{'name':_0x1da834['fieldName'],'type':_0x1da834[_0x4cec('0x2a')][_0x4cec('0x2b')]};});_0x4b2004[_0x4cec('0x2c')]=_[_0x4cec('0x29')](_0x4bc909,_0x4cec('0x26'));_0x4b2004[_0x4cec('0x2d')]=_[_0x4cec('0x2e')](_0x4af7a9[_0x4cec('0x2d')]);_0x4b2004[_0x4cec('0x2f')]=_[_0x4cec('0x30')](_0x4b2004['model'],_0x4b2004[_0x4cec('0x2d')]);_0x2c666a['attributes']=_['intersection'](_0x4b2004[_0x4cec('0x2c')],qs[_0x4cec('0x31')](_0x4af7a9[_0x4cec('0x2d')]['fields']));_0x2c666a['attributes']=_0x2c666a[_0x4cec('0x32')]['length']?_0x2c666a[_0x4cec('0x32')]:_0x4b2004[_0x4cec('0x2c')];if(!_0x4af7a9[_0x4cec('0x2d')][_0x4cec('0x33')](_0x4cec('0x34'))){_0x2c666a[_0x4cec('0x1d')]=qs[_0x4cec('0x1d')](_0x4af7a9['query']['limit']);_0x2c666a['offset']=qs[_0x4cec('0x1b')](_0x4af7a9[_0x4cec('0x2d')][_0x4cec('0x1b')]);}_0x2c666a[_0x4cec('0x35')]=qs[_0x4cec('0x36')](_0x4af7a9['query'][_0x4cec('0x36')]);_0x2c666a[_0x4cec('0x37')]=qs[_0x4cec('0x2f')](_[_0x4cec('0x38')](_0x4af7a9[_0x4cec('0x2d')],_0x4b2004[_0x4cec('0x2f')]),_0x4bc909);if(_0x4af7a9['query'][_0x4cec('0x39')]){_0x2c666a[_0x4cec('0x37')]=_[_0x4cec('0x3a')](_0x2c666a['where'],{'$or':_[_0x4cec('0x29')](_0x4bc909,function(_0x1e4329){if(_0x1e4329[_0x4cec('0x2a')]!==_0x4cec('0x3b')){var _0x2f26e2={};_0x2f26e2[_0x1e4329[_0x4cec('0x26')]]={'$like':'%'+_0x4af7a9[_0x4cec('0x2d')][_0x4cec('0x39')]+'%'};return _0x2f26e2;}})});}_0x2c666a=_[_0x4cec('0x3a')]({},_0x2c666a,_0x4af7a9[_0x4cec('0x3c')]);var _0xc149ba={'where':_0x2c666a[_0x4cec('0x37')]};return db[_0x4cec('0x3d')][_0x4cec('0x1e')](_0xc149ba)[_0x4cec('0x23')](function(_0x2c444f){_0xa48af[_0x4cec('0x1e')]=_0x2c444f;if(_0x4af7a9[_0x4cec('0x2d')][_0x4cec('0x3e')]){_0x2c666a['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x4cec('0x3f')](_0x2c666a);})[_0x4cec('0x23')](function(_0x113118){_0xa48af[_0x4cec('0x40')]=_0x113118;return _0xa48af;})[_0x4cec('0x23')](respondWithFilteredResult(_0x197aa9,_0x2c666a))[_0x4cec('0x41')](handleError(_0x197aa9,null));};exports[_0x4cec('0x42')]=function(_0x19d3c3,_0x5dddd6){var _0x18e5f7={'raw':!![],'where':{'id':_0x19d3c3[_0x4cec('0x43')]['id']}},_0x76fe85={};_0x76fe85[_0x4cec('0x2c')]=_[_0x4cec('0x2e')](db[_0x4cec('0x3d')][_0x4cec('0x44')]);_0x76fe85[_0x4cec('0x2d')]=_[_0x4cec('0x2e')](_0x19d3c3[_0x4cec('0x2d')]);_0x76fe85['filters']=_[_0x4cec('0x30')](_0x76fe85['model'],_0x76fe85[_0x4cec('0x2d')]);_0x18e5f7[_0x4cec('0x32')]=_[_0x4cec('0x30')](_0x76fe85[_0x4cec('0x2c')],qs[_0x4cec('0x31')](_0x19d3c3[_0x4cec('0x2d')][_0x4cec('0x31')]));_0x18e5f7[_0x4cec('0x32')]=_0x18e5f7[_0x4cec('0x32')]['length']?_0x18e5f7[_0x4cec('0x32')]:_0x76fe85[_0x4cec('0x2c')];if(_0x19d3c3[_0x4cec('0x2d')][_0x4cec('0x3e')]){_0x18e5f7[_0x4cec('0x45')]=[{'all':!![]}];}_0x18e5f7=_[_0x4cec('0x3a')]({},_0x18e5f7,_0x19d3c3[_0x4cec('0x3c')]);return db['Dynamics365Field'][_0x4cec('0x46')](_0x18e5f7)[_0x4cec('0x23')](handleEntityNotFound(_0x5dddd6,null))[_0x4cec('0x23')](respondWithResult(_0x5dddd6,null))[_0x4cec('0x41')](handleError(_0x5dddd6,null));};exports['create']=function(_0x3f1dd1,_0x22465f){return db[_0x4cec('0x3d')][_0x4cec('0x47')](_0x3f1dd1[_0x4cec('0x48')],{})['then'](respondWithResult(_0x22465f,0xc9))['catch'](handleError(_0x22465f,null));};exports[_0x4cec('0x22')]=function(_0x46675c,_0xee33a7){if(_0x46675c[_0x4cec('0x48')]['id']){delete _0x46675c[_0x4cec('0x48')]['id'];}return db[_0x4cec('0x3d')][_0x4cec('0x46')]({'where':{'id':_0x46675c[_0x4cec('0x43')]['id']}})[_0x4cec('0x23')](handleEntityNotFound(_0xee33a7,null))[_0x4cec('0x23')](saveUpdates(_0x46675c[_0x4cec('0x48')],null))[_0x4cec('0x23')](respondWithResult(_0xee33a7,null))['catch'](handleError(_0xee33a7,null));};exports['destroy']=function(_0x13bdc5,_0x97d82e){return db[_0x4cec('0x3d')][_0x4cec('0x46')]({'where':{'id':_0x13bdc5[_0x4cec('0x43')]['id']}})['then'](handleEntityNotFound(_0x97d82e,null))[_0x4cec('0x23')](removeEntity(_0x97d82e,null))[_0x4cec('0x41')](handleError(_0x97d82e,null));}; \ No newline at end of file +var _0xe1d4=['undefined','limit','count','Content-Range','apply','update','destroy','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','then','rows','show','length','options','catch','create','body','find','params','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x14490c,_0x50e8ab){var _0x2f6825=function(_0x477b03){while(--_0x477b03){_0x14490c['push'](_0x14490c['shift']());}};_0x2f6825(++_0x50e8ab);}(_0xe1d4,0xc3));var _0x4e1d=function(_0x18767e,_0x5b0a8c){_0x18767e=_0x18767e-0x0;var _0x5d2a62=_0xe1d4[_0x18767e];return _0x5d2a62;};'use strict';var emlformat=require(_0x4e1d('0x0'));var rimraf=require(_0x4e1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4e1d('0x2'));var moment=require(_0x4e1d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4e1d('0x4'));var util=require(_0x4e1d('0x5'));var path=require(_0x4e1d('0x6'));var sox=require('sox');var csv=require(_0x4e1d('0x7'));var ejs=require(_0x4e1d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e1d('0x9'));var squel=require(_0x4e1d('0xa'));var crypto=require(_0x4e1d('0xb'));var jsforce=require(_0x4e1d('0xc'));var deskjs=require(_0x4e1d('0xd'));var toCsv=require(_0x4e1d('0x7'));var querystring=require(_0x4e1d('0xe'));var Papa=require(_0x4e1d('0xf'));var Redis=require(_0x4e1d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4e1d('0x11'));var as=require(_0x4e1d('0x12'));var hardwareService=require(_0x4e1d('0x13'));var logger=require(_0x4e1d('0x14'))(_0x4e1d('0x15'));var utils=require(_0x4e1d('0x16'));var config=require(_0x4e1d('0x17'));var licenseUtil=require(_0x4e1d('0x18'));var db=require(_0x4e1d('0x19'))['db'];function respondWithStatusCode(_0x53b19a,_0x2c17df){_0x2c17df=_0x2c17df||0xcc;return function(_0x2be80b){if(_0x2be80b){return _0x53b19a[_0x4e1d('0x1a')](_0x2c17df);}return _0x53b19a['status'](_0x2c17df)['end']();};}function respondWithResult(_0x29dbce,_0x363a9d){_0x363a9d=_0x363a9d||0xc8;return function(_0x4566bb){if(_0x4566bb){return _0x29dbce[_0x4e1d('0x1b')](_0x363a9d)[_0x4e1d('0x1c')](_0x4566bb);}};}function respondWithFilteredResult(_0x2f0e9f,_0xb1240){return function(_0x1c0adc){if(_0x1c0adc){var _0x58b41a=typeof _0xb1240[_0x4e1d('0x1d')]===_0x4e1d('0x1e')&&typeof _0xb1240[_0x4e1d('0x1f')]==='undefined';var _0x1f77b6=_0x1c0adc[_0x4e1d('0x20')];var _0x354a60=_0x58b41a?0x0:_0xb1240['offset'];var _0x3c5342=_0x58b41a?_0x1c0adc[_0x4e1d('0x20')]:_0xb1240[_0x4e1d('0x1d')]+_0xb1240[_0x4e1d('0x1f')];var _0x2f48f2;if(_0x3c5342>=_0x1f77b6){_0x3c5342=_0x1f77b6;_0x2f48f2=0xc8;}else{_0x2f48f2=0xce;}_0x2f0e9f['status'](_0x2f48f2);return _0x2f0e9f['set'](_0x4e1d('0x21'),_0x354a60+'-'+_0x3c5342+'/'+_0x1f77b6)[_0x4e1d('0x1c')](_0x1c0adc);}return null;};}function patchUpdates(_0x4df894){return function(_0x4e6352){try{jsonpatch[_0x4e1d('0x22')](_0x4e6352,_0x4df894,!![]);}catch(_0x8a90ea){return BPromise['reject'](_0x8a90ea);}return _0x4e6352['save']();};}function saveUpdates(_0xc750d4,_0x276b54){return function(_0x4216d4){if(_0x4216d4){return _0x4216d4[_0x4e1d('0x23')](_0xc750d4)['then'](function(_0x326d7e){return _0x326d7e;});}return null;};}function removeEntity(_0x3b7d9b,_0x837244){return function(_0x3795bf){if(_0x3795bf){return _0x3795bf[_0x4e1d('0x24')]()['then'](function(){_0x3b7d9b[_0x4e1d('0x1b')](0xcc)[_0x4e1d('0x25')]();});}};}function handleEntityNotFound(_0x496157,_0x498665){return function(_0x31edd4){if(!_0x31edd4){_0x496157['sendStatus'](0x194);}return _0x31edd4;};}function handleError(_0x2f38e9,_0x1ee11c){_0x1ee11c=_0x1ee11c||0x1f4;return function(_0x5810a6){logger[_0x4e1d('0x26')](_0x5810a6[_0x4e1d('0x27')]);if(_0x5810a6[_0x4e1d('0x28')]){delete _0x5810a6[_0x4e1d('0x28')];}_0x2f38e9['status'](_0x1ee11c)[_0x4e1d('0x29')](_0x5810a6);};}exports[_0x4e1d('0x2a')]=function(_0x26c2bf,_0x439072){var _0x55443b={},_0x54f377={},_0x4d9e82={'count':0x0,'rows':[]};var _0x5ba05e=_[_0x4e1d('0x2b')](db[_0x4e1d('0x2c')][_0x4e1d('0x2d')],function(_0x30037d){return{'name':_0x30037d[_0x4e1d('0x2e')],'type':_0x30037d[_0x4e1d('0x2f')][_0x4e1d('0x30')]};});_0x54f377[_0x4e1d('0x31')]=_['map'](_0x5ba05e,'name');_0x54f377[_0x4e1d('0x32')]=_[_0x4e1d('0x33')](_0x26c2bf[_0x4e1d('0x32')]);_0x54f377['filters']=_[_0x4e1d('0x34')](_0x54f377[_0x4e1d('0x31')],_0x54f377['query']);_0x55443b[_0x4e1d('0x35')]=_[_0x4e1d('0x34')](_0x54f377[_0x4e1d('0x31')],qs[_0x4e1d('0x36')](_0x26c2bf[_0x4e1d('0x32')][_0x4e1d('0x36')]));_0x55443b[_0x4e1d('0x35')]=_0x55443b['attributes']['length']?_0x55443b['attributes']:_0x54f377[_0x4e1d('0x31')];if(!_0x26c2bf[_0x4e1d('0x32')][_0x4e1d('0x37')]('nolimit')){_0x55443b[_0x4e1d('0x1f')]=qs[_0x4e1d('0x1f')](_0x26c2bf['query'][_0x4e1d('0x1f')]);_0x55443b[_0x4e1d('0x1d')]=qs[_0x4e1d('0x1d')](_0x26c2bf['query'][_0x4e1d('0x1d')]);}_0x55443b[_0x4e1d('0x38')]=qs[_0x4e1d('0x39')](_0x26c2bf[_0x4e1d('0x32')]['sort']);_0x55443b[_0x4e1d('0x3a')]=qs[_0x4e1d('0x3b')](_['pick'](_0x26c2bf['query'],_0x54f377[_0x4e1d('0x3b')]),_0x5ba05e);if(_0x26c2bf['query']['filter']){_0x55443b[_0x4e1d('0x3a')]=_[_0x4e1d('0x3c')](_0x55443b[_0x4e1d('0x3a')],{'$or':_[_0x4e1d('0x2b')](_0x5ba05e,function(_0x5ba841){if(_0x5ba841[_0x4e1d('0x2f')]!==_0x4e1d('0x3d')){var _0x3b18d1={};_0x3b18d1[_0x5ba841[_0x4e1d('0x28')]]={'$like':'%'+_0x26c2bf['query'][_0x4e1d('0x3e')]+'%'};return _0x3b18d1;}})});}_0x55443b=_[_0x4e1d('0x3c')]({},_0x55443b,_0x26c2bf['options']);var _0x2596eb={'where':_0x55443b[_0x4e1d('0x3a')]};return db[_0x4e1d('0x2c')][_0x4e1d('0x20')](_0x2596eb)['then'](function(_0x41fc18){_0x4d9e82['count']=_0x41fc18;if(_0x26c2bf[_0x4e1d('0x32')][_0x4e1d('0x3f')]){_0x55443b[_0x4e1d('0x40')]=[{'all':!![]}];}return db[_0x4e1d('0x2c')]['findAll'](_0x55443b);})[_0x4e1d('0x41')](function(_0x861fd5){_0x4d9e82[_0x4e1d('0x42')]=_0x861fd5;return _0x4d9e82;})[_0x4e1d('0x41')](respondWithFilteredResult(_0x439072,_0x55443b))['catch'](handleError(_0x439072,null));};exports[_0x4e1d('0x43')]=function(_0x33a372,_0x393144){var _0x31c141={'raw':!![],'where':{'id':_0x33a372['params']['id']}},_0x3abe24={};_0x3abe24[_0x4e1d('0x31')]=_['keys'](db['Dynamics365Field'][_0x4e1d('0x2d')]);_0x3abe24['query']=_[_0x4e1d('0x33')](_0x33a372[_0x4e1d('0x32')]);_0x3abe24['filters']=_[_0x4e1d('0x34')](_0x3abe24[_0x4e1d('0x31')],_0x3abe24[_0x4e1d('0x32')]);_0x31c141[_0x4e1d('0x35')]=_[_0x4e1d('0x34')](_0x3abe24['model'],qs[_0x4e1d('0x36')](_0x33a372[_0x4e1d('0x32')][_0x4e1d('0x36')]));_0x31c141['attributes']=_0x31c141[_0x4e1d('0x35')][_0x4e1d('0x44')]?_0x31c141['attributes']:_0x3abe24['model'];if(_0x33a372[_0x4e1d('0x32')][_0x4e1d('0x3f')]){_0x31c141[_0x4e1d('0x40')]=[{'all':!![]}];}_0x31c141=_['merge']({},_0x31c141,_0x33a372[_0x4e1d('0x45')]);return db[_0x4e1d('0x2c')]['find'](_0x31c141)[_0x4e1d('0x41')](handleEntityNotFound(_0x393144,null))[_0x4e1d('0x41')](respondWithResult(_0x393144,null))[_0x4e1d('0x46')](handleError(_0x393144,null));};exports[_0x4e1d('0x47')]=function(_0x5b17f7,_0xd0c68d){return db[_0x4e1d('0x2c')]['create'](_0x5b17f7[_0x4e1d('0x48')],{})[_0x4e1d('0x41')](respondWithResult(_0xd0c68d,0xc9))[_0x4e1d('0x46')](handleError(_0xd0c68d,null));};exports['update']=function(_0xccd447,_0x5eb754){if(_0xccd447[_0x4e1d('0x48')]['id']){delete _0xccd447[_0x4e1d('0x48')]['id'];}return db[_0x4e1d('0x2c')][_0x4e1d('0x49')]({'where':{'id':_0xccd447[_0x4e1d('0x4a')]['id']}})[_0x4e1d('0x41')](handleEntityNotFound(_0x5eb754,null))[_0x4e1d('0x41')](saveUpdates(_0xccd447[_0x4e1d('0x48')],null))[_0x4e1d('0x41')](respondWithResult(_0x5eb754,null))['catch'](handleError(_0x5eb754,null));};exports[_0x4e1d('0x24')]=function(_0x8bbf1d,_0x44dddd){return db[_0x4e1d('0x2c')][_0x4e1d('0x49')]({'where':{'id':_0x8bbf1d[_0x4e1d('0x4a')]['id']}})[_0x4e1d('0x41')](handleEntityNotFound(_0x44dddd,null))[_0x4e1d('0x41')](removeEntity(_0x44dddd,null))['catch'](handleError(_0x44dddd,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index d459810..04d23c5 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 _0x1309=['dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields'];(function(_0xd7ebef,_0x15c232){var _0x149857=function(_0x2a4429){while(--_0x2a4429){_0xd7ebef['push'](_0xd7ebef['shift']());}};_0x149857(++_0x15c232);}(_0x1309,0x1bd));var _0x9130=function(_0x5c48c5,_0x46c989){_0x5c48c5=_0x5c48c5-0x0;var _0x44a195=_0x1309[_0x5c48c5];return _0x44a195;};'use strict';var _=require(_0x9130('0x0'));var util=require(_0x9130('0x1'));var logger=require(_0x9130('0x2'))(_0x9130('0x3'));var moment=require(_0x9130('0x4'));var BPromise=require(_0x9130('0x5'));var rp=require(_0x9130('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9130('0x7'));var config=require(_0x9130('0x8'));var attributes=require(_0x9130('0x9'));module[_0x9130('0xa')]=function(_0xfb4e2f,_0x57ec06){return _0xfb4e2f[_0x9130('0xb')](_0x9130('0xc'),attributes,{'tableName':_0x9130('0xd'),'paranoid':![],'indexes':[{'name':_0x9130('0xe'),'fields':[_0x9130('0xf'),_0x9130('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4cb=['int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field'];(function(_0x16d028,_0x38dc25){var _0x2dbdb3=function(_0x455f3d){while(--_0x455f3d){_0x16d028['push'](_0x16d028['shift']());}};_0x2dbdb3(++_0x38dc25);}(_0xc4cb,0x14d));var _0xbc4c=function(_0x13a0d6,_0x9a1972){_0x13a0d6=_0x13a0d6-0x0;var _0x241df1=_0xc4cb[_0x13a0d6];return _0x241df1;};'use strict';var _=require(_0xbc4c('0x0'));var util=require('util');var logger=require(_0xbc4c('0x1'))(_0xbc4c('0x2'));var moment=require(_0xbc4c('0x3'));var BPromise=require(_0xbc4c('0x4'));var rp=require(_0xbc4c('0x5'));var fs=require('fs');var path=require(_0xbc4c('0x6'));var rimraf=require(_0xbc4c('0x7'));var config=require(_0xbc4c('0x8'));var attributes=require(_0xbc4c('0x9'));module[_0xbc4c('0xa')]=function(_0x3e8205,_0xb65c86){return _0x3e8205['define'](_0xbc4c('0xb'),attributes,{'tableName':_0xbc4c('0xc'),'paranoid':![],'indexes':[{'name':_0xbc4c('0xd'),'fields':['idField',_0xbc4c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 87fe55c..401e97a 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 _0x5669=['then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','http','request'];(function(_0x2ee1d3,_0x1a2c95){var _0x577bd9=function(_0x1d9556){while(--_0x1d9556){_0x2ee1d3['push'](_0x2ee1d3['shift']());}};_0x577bd9(++_0x1a2c95);}(_0x5669,0x138));var _0x9566=function(_0x30a604,_0x243139){_0x30a604=_0x30a604-0x0;var _0x4d918b=_0x5669[_0x30a604];return _0x4d918b;};'use strict';var _=require(_0x9566('0x0'));var util=require(_0x9566('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9566('0x2'));var fs=require('fs');var Redis=require(_0x9566('0x3'));var db=require(_0x9566('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9566('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9566('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4b1a1b,_0x46aab1,_0x199dda){return new BPromise(function(_0x273464,_0x347e93){return client[_0x9566('0x7')](_0x4b1a1b,_0x199dda)[_0x9566('0x8')](function(_0x3fc226){logger[_0x9566('0x9')](_0x9566('0xa'),_0x46aab1,'request\x20sent');logger[_0x9566('0xb')](_0x9566('0xc'),_0x46aab1,_0x9566('0xd'),JSON[_0x9566('0xe')](_0x3fc226));if(_0x3fc226['error']){if(_0x3fc226['error'][_0x9566('0xf')]===0x1f4){logger[_0x9566('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x46aab1,_0x3fc226[_0x9566('0x10')][_0x9566('0x11')]);return _0x347e93(_0x3fc226['error'][_0x9566('0x11')]);}logger[_0x9566('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x46aab1,_0x3fc226['error'][_0x9566('0x11')]);return _0x273464(_0x3fc226[_0x9566('0x10')][_0x9566('0x11')]);}else{logger[_0x9566('0x9')](_0x9566('0xa'),_0x46aab1,_0x9566('0xd'));_0x273464(_0x3fc226[_0x9566('0x12')]['message']);}})[_0x9566('0x13')](function(_0x1b901d){logger[_0x9566('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x46aab1,_0x1b901d);_0x347e93(_0x1b901d);});});} \ No newline at end of file +var _0x0119=['error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4e9337,_0x188b13){var _0xfa023a=function(_0x1203da){while(--_0x1203da){_0x4e9337['push'](_0x4e9337['shift']());}};_0xfa023a(++_0x188b13);}(_0x0119,0x180));var _0x9011=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x0119[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x9011('0x0'));var util=require(_0x9011('0x1'));var moment=require('moment');var BPromise=require(_0x9011('0x2'));var rs=require(_0x9011('0x3'));var fs=require('fs');var Redis=require(_0x9011('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9011('0x5'));var logger=require(_0x9011('0x6'))(_0x9011('0x7'));var config=require(_0x9011('0x8'));var jayson=require(_0x9011('0x9'));var client=jayson[_0x9011('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x114550,_0x10f4f5,_0x22c07a){return new BPromise(function(_0x302dd1,_0x532a84){return client[_0x9011('0xb')](_0x114550,_0x22c07a)['then'](function(_0x19b9cc){logger['info'](_0x9011('0xc'),_0x10f4f5,_0x9011('0xd'));logger['debug'](_0x9011('0xe'),_0x10f4f5,'request\x20sent',JSON[_0x9011('0xf')](_0x19b9cc));if(_0x19b9cc[_0x9011('0x10')]){if(_0x19b9cc['error'][_0x9011('0x11')]===0x1f4){logger[_0x9011('0x10')](_0x9011('0xc'),_0x10f4f5,_0x19b9cc['error'][_0x9011('0x12')]);return _0x532a84(_0x19b9cc[_0x9011('0x10')][_0x9011('0x12')]);}logger['error'](_0x9011('0xc'),_0x10f4f5,_0x19b9cc['error'][_0x9011('0x12')]);return _0x302dd1(_0x19b9cc[_0x9011('0x10')][_0x9011('0x12')]);}else{logger['info'](_0x9011('0xc'),_0x10f4f5,_0x9011('0xd'));_0x302dd1(_0x19b9cc['result'][_0x9011('0x12')]);}})[_0x9011('0x13')](function(_0x320231){logger[_0x9011('0x10')](_0x9011('0xc'),_0x10f4f5,_0x320231);_0x532a84(_0x320231);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7e78d26..6ea3c3b 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 _0x44e0=['destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','delete'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0x44e0,0x1a6));var _0x044e=function(_0x14d94c,_0x162c1b){_0x14d94c=_0x14d94c-0x0;var _0x43d21d=_0x44e0[_0x14d94c];return _0x43d21d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x044e('0x0'));var timeout=require(_0x044e('0x1'));var express=require('express');var router=express[_0x044e('0x2')]();var fs_extra=require(_0x044e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x044e('0x4'));var config=require(_0x044e('0x5'));var controller=require(_0x044e('0x6'));router[_0x044e('0x7')]('/',auth[_0x044e('0x8')](),controller[_0x044e('0x9')]);router['get'](_0x044e('0xa'),auth[_0x044e('0x8')](),controller[_0x044e('0xb')]);router[_0x044e('0x7')](_0x044e('0xc'),auth[_0x044e('0x8')](),controller[_0x044e('0xd')]);router['get'](_0x044e('0xe'),auth[_0x044e('0x8')](),controller[_0x044e('0xf')]);router['post']('/',auth[_0x044e('0x8')](),controller['create']);router[_0x044e('0x10')](_0x044e('0xc'),auth[_0x044e('0x8')](),controller['addConfiguration']);router[_0x044e('0x11')](_0x044e('0xa'),auth[_0x044e('0x8')](),controller['update']);router[_0x044e('0x12')](_0x044e('0xa'),auth[_0x044e('0x8')](),controller[_0x044e('0x13')]);module[_0x044e('0x14')]=router; \ No newline at end of file +var _0xa896=['isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa896,0x16f));var _0x6a89=function(_0x97d6d1,_0x23345d){_0x97d6d1=_0x97d6d1-0x0;var _0x336919=_0xa896[_0x97d6d1];return _0x336919;};'use strict';var multer=require(_0x6a89('0x0'));var util=require(_0x6a89('0x1'));var path=require('path');var timeout=require(_0x6a89('0x2'));var express=require(_0x6a89('0x3'));var router=express[_0x6a89('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6a89('0x5'));var config=require(_0x6a89('0x6'));var controller=require(_0x6a89('0x7'));router['get']('/',auth[_0x6a89('0x8')](),controller[_0x6a89('0x9')]);router[_0x6a89('0xa')](_0x6a89('0xb'),auth[_0x6a89('0x8')](),controller[_0x6a89('0xc')]);router['get'](_0x6a89('0xd'),auth[_0x6a89('0x8')](),controller[_0x6a89('0xe')]);router[_0x6a89('0xa')](_0x6a89('0xf'),auth[_0x6a89('0x8')](),controller[_0x6a89('0x10')]);router['post']('/',auth[_0x6a89('0x8')](),controller[_0x6a89('0x11')]);router[_0x6a89('0x12')]('/:id/configurations',auth[_0x6a89('0x8')](),controller[_0x6a89('0x13')]);router[_0x6a89('0x14')]('/:id',auth[_0x6a89('0x8')](),controller[_0x6a89('0x15')]);router[_0x6a89('0x16')](_0x6a89('0xb'),auth[_0x6a89('0x8')](),controller[_0x6a89('0x17')]);module[_0x6a89('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 79c8f29..9840569 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 _0x32b6=['remoteUri','sequelize','exports','STRING'];(function(_0x4f5dd9,_0x30b8c5){var _0x3c8624=function(_0x3d7f06){while(--_0x3d7f06){_0x4f5dd9['push'](_0x4f5dd9['shift']());}};_0x3c8624(++_0x30b8c5);}(_0x32b6,0x1d1));var _0x632b=function(_0x5eaab2,_0x558ead){_0x5eaab2=_0x5eaab2-0x0;var _0x3b80f5=_0x32b6[_0x5eaab2];return _0x3b80f5;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x632b('0x2')]},'username':{'type':Sequelize[_0x632b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x632b('0x2')],'unique':_0x632b('0x3')},'serverUrl':{'type':Sequelize[_0x632b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6d11=['exports','STRING','sequelize'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6d11,0xbf));var _0x16d1=function(_0x189cdf,_0x5558f9){_0x189cdf=_0x189cdf-0x0;var _0x16513d=_0x6d11[_0x189cdf];return _0x16513d;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'name':{'type':Sequelize[_0x16d1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x16d1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x16d1('0x2')]},'remoteUri':{'type':Sequelize[_0x16d1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 7783807..f9ab3e2 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 _0x89e8=['test','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','index','rawAttributes','fieldName','type','map','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','FreshdeskAccount','include','findAll','show','params','catch','create','body','find','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','api/v2/ticket_fields','format','Basic\x20%s','apiKey','agent','priority','source','ticket_type','group','company','remove','includes','custom_text','label','default','choices','capitalize'];(function(_0x3f8d82,_0xf85366){var _0x53ca0e=function(_0x118b97){while(--_0x118b97){_0x3f8d82['push'](_0x3f8d82['shift']());}};_0x53ca0e(++_0xf85366);}(_0x89e8,0x74));var _0x889e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x89e8[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x889e('0x0'));var rimraf=require(_0x889e('0x1'));var zipdir=require(_0x889e('0x2'));var jsonpatch=require(_0x889e('0x3'));var rp=require(_0x889e('0x4'));var moment=require(_0x889e('0x5'));var BPromise=require(_0x889e('0x6'));var Mustache=require(_0x889e('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x889e('0x8'));var ejs=require(_0x889e('0x9'));var fs=require('fs');var fs_extra=require(_0x889e('0xa'));var _=require('lodash');var squel=require(_0x889e('0xb'));var crypto=require('crypto');var jsforce=require(_0x889e('0xc'));var deskjs=require(_0x889e('0xd'));var toCsv=require(_0x889e('0x8'));var querystring=require('querystring');var Papa=require(_0x889e('0xe'));var Redis=require(_0x889e('0xf'));var authService=require(_0x889e('0x10'));var qs=require(_0x889e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x889e('0x12'));var logger=require(_0x889e('0x13'))('api');var utils=require(_0x889e('0x14'));var config=require(_0x889e('0x15'));var licenseUtil=require(_0x889e('0x16'));var db=require(_0x889e('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e20e3,_0x399161){_0x399161=_0x399161||0xcc;return function(_0x121e9e){if(_0x121e9e){return _0x3e20e3['sendStatus'](_0x399161);}return _0x3e20e3[_0x889e('0x18')](_0x399161)[_0x889e('0x19')]();};}function respondWithResult(_0x2b69db,_0xe9a1b9){_0xe9a1b9=_0xe9a1b9||0xc8;return function(_0x35e849){if(_0x35e849){return _0x2b69db['status'](_0xe9a1b9)['json'](_0x35e849);}};}function respondWithFilteredResult(_0x300ce7,_0x15cf93){return function(_0x335f98){if(_0x335f98){var _0x2de143=typeof _0x15cf93['offset']===_0x889e('0x1a')&&typeof _0x15cf93[_0x889e('0x1b')]==='undefined';var _0xf45988=_0x335f98['count'];var _0x75e219=_0x2de143?0x0:_0x15cf93[_0x889e('0x1c')];var _0x232452=_0x2de143?_0x335f98[_0x889e('0x1d')]:_0x15cf93[_0x889e('0x1c')]+_0x15cf93['limit'];var _0xa1b610;if(_0x232452>=_0xf45988){_0x232452=_0xf45988;_0xa1b610=0xc8;}else{_0xa1b610=0xce;}_0x300ce7[_0x889e('0x18')](_0xa1b610);return _0x300ce7['set'](_0x889e('0x1e'),_0x75e219+'-'+_0x232452+'/'+_0xf45988)[_0x889e('0x1f')](_0x335f98);}return null;};}function patchUpdates(_0x1db0db){return function(_0x552a11){try{jsonpatch[_0x889e('0x20')](_0x552a11,_0x1db0db,!![]);}catch(_0x2ff8ae){return BPromise[_0x889e('0x21')](_0x2ff8ae);}return _0x552a11[_0x889e('0x22')]();};}function saveUpdates(_0x590b6f,_0x539ed4){return function(_0x352256){if(_0x352256){return _0x352256[_0x889e('0x23')](_0x590b6f)[_0x889e('0x24')](function(_0x4bb8e1){return _0x4bb8e1;});}return null;};}function removeEntity(_0x956dae,_0x309e91){return function(_0x3cfb58){if(_0x3cfb58){return _0x3cfb58['destroy']()[_0x889e('0x24')](function(){_0x956dae['status'](0xcc)[_0x889e('0x19')]();});}};}function handleEntityNotFound(_0x331665,_0x2fc97a){return function(_0x4d0492){if(!_0x4d0492){_0x331665[_0x889e('0x25')](0x194);}return _0x4d0492;};}function handleError(_0x5aa515,_0x34db77){_0x34db77=_0x34db77||0x1f4;return function(_0x2fb8d9){logger[_0x889e('0x26')](_0x2fb8d9[_0x889e('0x27')]);if(_0x2fb8d9['name']){delete _0x2fb8d9['name'];}_0x5aa515[_0x889e('0x18')](_0x34db77)['send'](_0x2fb8d9);};}exports[_0x889e('0x28')]=function(_0x343c01,_0x3b3aad){var _0x9e8192={},_0x2553ff={},_0x484629={'count':0x0,'rows':[]};var _0x5c3da2=_['map'](db['FreshdeskAccount'][_0x889e('0x29')],function(_0x1cb4ed){return{'name':_0x1cb4ed[_0x889e('0x2a')],'type':_0x1cb4ed[_0x889e('0x2b')]['key']};});_0x2553ff['model']=_[_0x889e('0x2c')](_0x5c3da2,_0x889e('0x2d'));_0x2553ff[_0x889e('0x2e')]=_[_0x889e('0x2f')](_0x343c01[_0x889e('0x2e')]);_0x2553ff[_0x889e('0x30')]=_[_0x889e('0x31')](_0x2553ff['model'],_0x2553ff[_0x889e('0x2e')]);_0x9e8192['attributes']=_['intersection'](_0x2553ff[_0x889e('0x32')],qs[_0x889e('0x33')](_0x343c01[_0x889e('0x2e')]['fields']));_0x9e8192[_0x889e('0x34')]=_0x9e8192['attributes'][_0x889e('0x35')]?_0x9e8192[_0x889e('0x34')]:_0x2553ff[_0x889e('0x32')];if(!_0x343c01[_0x889e('0x2e')][_0x889e('0x36')](_0x889e('0x37'))){_0x9e8192[_0x889e('0x1b')]=qs['limit'](_0x343c01[_0x889e('0x2e')]['limit']);_0x9e8192[_0x889e('0x1c')]=qs['offset'](_0x343c01[_0x889e('0x2e')][_0x889e('0x1c')]);}_0x9e8192[_0x889e('0x38')]=qs[_0x889e('0x39')](_0x343c01[_0x889e('0x2e')][_0x889e('0x39')]);_0x9e8192['where']=qs[_0x889e('0x30')](_[_0x889e('0x3a')](_0x343c01[_0x889e('0x2e')],_0x2553ff[_0x889e('0x30')]),_0x5c3da2);if(_0x343c01[_0x889e('0x2e')][_0x889e('0x3b')]){_0x9e8192[_0x889e('0x3c')]=_[_0x889e('0x3d')](_0x9e8192[_0x889e('0x3c')],{'$or':_[_0x889e('0x2c')](_0x5c3da2,function(_0x27e2b9){if(_0x27e2b9[_0x889e('0x2b')]!=='VIRTUAL'){var _0x51f3a8={};_0x51f3a8[_0x27e2b9[_0x889e('0x2d')]]={'$like':'%'+_0x343c01[_0x889e('0x2e')][_0x889e('0x3b')]+'%'};return _0x51f3a8;}})});}_0x9e8192=_['merge']({},_0x9e8192,_0x343c01[_0x889e('0x3e')]);var _0x27757d={'where':_0x9e8192[_0x889e('0x3c')]};return db[_0x889e('0x3f')][_0x889e('0x1d')](_0x27757d)[_0x889e('0x24')](function(_0x5ee0e8){_0x484629[_0x889e('0x1d')]=_0x5ee0e8;if(_0x343c01['query']['includeAll']){_0x9e8192[_0x889e('0x40')]=[{'all':!![]}];}return db[_0x889e('0x3f')][_0x889e('0x41')](_0x9e8192);})[_0x889e('0x24')](function(_0x4d35d0){_0x484629['rows']=_0x4d35d0;return _0x484629;})[_0x889e('0x24')](respondWithFilteredResult(_0x3b3aad,_0x9e8192))['catch'](handleError(_0x3b3aad,null));};exports[_0x889e('0x42')]=function(_0x330ecd,_0x5c7205){var _0x4b89dc={'raw':![],'where':{'id':_0x330ecd[_0x889e('0x43')]['id']}},_0x18b45b={};_0x18b45b['model']=_[_0x889e('0x2f')](db['FreshdeskAccount'][_0x889e('0x29')]);_0x18b45b[_0x889e('0x2e')]=_[_0x889e('0x2f')](_0x330ecd[_0x889e('0x2e')]);_0x18b45b[_0x889e('0x30')]=_[_0x889e('0x31')](_0x18b45b[_0x889e('0x32')],_0x18b45b[_0x889e('0x2e')]);_0x4b89dc[_0x889e('0x34')]=_[_0x889e('0x31')](_0x18b45b[_0x889e('0x32')],qs[_0x889e('0x33')](_0x330ecd['query'][_0x889e('0x33')]));_0x4b89dc[_0x889e('0x34')]=_0x4b89dc[_0x889e('0x34')][_0x889e('0x35')]?_0x4b89dc['attributes']:_0x18b45b[_0x889e('0x32')];if(_0x330ecd[_0x889e('0x2e')]['includeAll']){_0x4b89dc[_0x889e('0x40')]=[{'all':!![]}];}_0x4b89dc=_[_0x889e('0x3d')]({},_0x4b89dc,_0x330ecd['options']);return db['FreshdeskAccount']['find'](_0x4b89dc)[_0x889e('0x24')](handleEntityNotFound(_0x5c7205,null))['then'](respondWithResult(_0x5c7205,null))[_0x889e('0x44')](handleError(_0x5c7205,null));};exports[_0x889e('0x45')]=function(_0x7bd28c,_0x630b2b){return db[_0x889e('0x3f')]['create'](_0x7bd28c[_0x889e('0x46')],{})[_0x889e('0x24')](respondWithResult(_0x630b2b,0xc9))[_0x889e('0x44')](handleError(_0x630b2b,null));};exports[_0x889e('0x23')]=function(_0x29f072,_0x28b3ce){if(_0x29f072['body']['id']){delete _0x29f072['body']['id'];}return db[_0x889e('0x3f')][_0x889e('0x47')]({'where':{'id':_0x29f072[_0x889e('0x43')]['id']}})['then'](handleEntityNotFound(_0x28b3ce,null))[_0x889e('0x24')](saveUpdates(_0x29f072[_0x889e('0x46')],null))[_0x889e('0x24')](respondWithResult(_0x28b3ce,null))[_0x889e('0x44')](handleError(_0x28b3ce,null));};exports[_0x889e('0x48')]=function(_0x25337b,_0x1f54e9){return db[_0x889e('0x3f')][_0x889e('0x47')]({'where':{'id':_0x25337b[_0x889e('0x43')]['id']}})[_0x889e('0x24')](handleEntityNotFound(_0x1f54e9,null))[_0x889e('0x24')](removeEntity(_0x1f54e9,null))[_0x889e('0x44')](handleError(_0x1f54e9,null));};exports[_0x889e('0x49')]=function(_0x2ecf81,_0x32ad34,_0x255840){var _0x48eb4a={};var _0x5de5f7={};var _0x4d41ac;var _0x419cac;return db['FreshdeskAccount'][_0x889e('0x4a')]({'where':{'id':_0x2ecf81[_0x889e('0x43')]['id']}})[_0x889e('0x24')](handleEntityNotFound(_0x32ad34,null))[_0x889e('0x24')](function(_0x5edd19){if(_0x5edd19){_0x4d41ac=_0x5edd19;_0x5de5f7[_0x889e('0x32')]=_['keys'](db[_0x889e('0x4b')][_0x889e('0x29')]);_0x5de5f7[_0x889e('0x2e')]=_[_0x889e('0x2f')](_0x2ecf81['query']);_0x5de5f7[_0x889e('0x30')]=_['intersection'](_0x5de5f7[_0x889e('0x32')],_0x5de5f7[_0x889e('0x2e')]);_0x48eb4a[_0x889e('0x34')]=_['intersection'](_0x5de5f7['model'],qs[_0x889e('0x33')](_0x2ecf81[_0x889e('0x2e')][_0x889e('0x33')]));_0x48eb4a['attributes']=_0x48eb4a[_0x889e('0x34')][_0x889e('0x35')]?_0x48eb4a['attributes']:_0x5de5f7['model'];_0x48eb4a[_0x889e('0x38')]=qs[_0x889e('0x39')](_0x2ecf81[_0x889e('0x2e')]['sort']);_0x48eb4a[_0x889e('0x3c')]=qs[_0x889e('0x30')](_['pick'](_0x2ecf81['query'],_0x5de5f7[_0x889e('0x30')]));if(_0x2ecf81[_0x889e('0x2e')][_0x889e('0x3b')]){_0x48eb4a[_0x889e('0x3c')]=_[_0x889e('0x3d')](_0x48eb4a[_0x889e('0x3c')],{'$or':_[_0x889e('0x2c')](_0x48eb4a[_0x889e('0x34')],function(_0x197de){var _0x298556={};_0x298556[_0x197de]={'$like':'%'+_0x2ecf81[_0x889e('0x2e')][_0x889e('0x3b')]+'%'};return _0x298556;})});}_0x48eb4a=_[_0x889e('0x3d')]({},_0x48eb4a,_0x2ecf81[_0x889e('0x3e')]);return _0x4d41ac['getConfigurations'](_0x48eb4a);}})['then'](function(_0xc93d27){if(_0xc93d27){_0x419cac=_0xc93d27['length'];if(!_0x2ecf81[_0x889e('0x2e')][_0x889e('0x36')](_0x889e('0x37'))){_0x48eb4a['limit']=qs['limit'](_0x2ecf81[_0x889e('0x2e')][_0x889e('0x1b')]);_0x48eb4a[_0x889e('0x1c')]=qs[_0x889e('0x1c')](_0x2ecf81[_0x889e('0x2e')][_0x889e('0x1c')]);}return _0x4d41ac[_0x889e('0x49')](_0x48eb4a);}})[_0x889e('0x24')](function(_0x51ddc2){if(_0x51ddc2){return _0x51ddc2?{'count':_0x419cac,'rows':_0x51ddc2}:null;}})[_0x889e('0x24')](respondWithResult(_0x32ad34,null))['catch'](handleError(_0x32ad34,null));};exports[_0x889e('0x4c')]=function(_0x143cae,_0x21fb4a,_0x94c01f){if(_0x143cae[_0x889e('0x46')]['id']){delete _0x143cae['body']['id'];}return db[_0x889e('0x3f')]['findOne']({'where':{'id':_0x143cae[_0x889e('0x43')]['id']}})[_0x889e('0x24')](handleEntityNotFound(_0x21fb4a,null))['then'](function(_0x181639){if(_0x181639){_0x143cae[_0x889e('0x46')][_0x889e('0x4d')]=_0x181639['id'];_0x143cae[_0x889e('0x46')][_0x889e('0x4e')]=integrations['getSubjects'](_0x143cae[_0x889e('0x46')][_0x889e('0x4f')],_0x143cae['body'][_0x889e('0x2b')]);_0x143cae[_0x889e('0x46')]['Descriptions']=integrations[_0x889e('0x50')](_0x143cae[_0x889e('0x46')]['channel'],_0x143cae[_0x889e('0x46')]['type']);return db['FreshdeskConfiguration'][_0x889e('0x45')](_0x143cae['body'],{'include':[{'model':db[_0x889e('0x51')],'as':_0x889e('0x4e')},{'model':db[_0x889e('0x51')],'as':_0x889e('0x52')}]});}return null;})[_0x889e('0x24')](respondWithResult(_0x21fb4a,null))['catch'](handleError(_0x21fb4a,null));};exports[_0x889e('0x53')]=function(_0x48b8f8,_0xb80bd2,_0x22fddf){var _0x3295ee='';return db[_0x889e('0x3f')][_0x889e('0x4a')]({'where':{'id':_0x48b8f8[_0x889e('0x43')]['id']},'attributes':['id',_0x889e('0x54'),'apiKey']})[_0x889e('0x24')](handleEntityNotFound(_0xb80bd2,null))[_0x889e('0x24')](function(_0x3f6507){if(_0x3f6507){_0x3295ee=_0x3f6507[_0x889e('0x54')];var _0x438067=_0x3295ee[_0x889e('0x55')](-0x1);if(_0x438067==='/'){_0x3295ee=_0x3295ee[_0x889e('0x56')](0x0,_0x3295ee[_0x889e('0x57')](_0x438067));}return rp({'method':_0x889e('0x58'),'uri':util['format']('%s/%s',_0x3295ee,_0x889e('0x59')),'headers':{'Authorization':util[_0x889e('0x5a')](_0x889e('0x5b'),new Buffer(util[_0x889e('0x5a')]('%s:X',_0x3f6507[_0x889e('0x5c')]))['toString']('base64'))},'json':!![]});}})[_0x889e('0x24')](function(_0xbb094f){if(_0xbb094f){var _0x5b095e=['requester','subject',_0x889e('0x5d'),'description',_0x889e('0x18'),_0x889e('0x5e'),'group',_0x889e('0x5f'),_0x889e('0x60'),_0x889e('0x61'),_0x889e('0x62')];_[_0x889e('0x63')](_0xbb094f,function(_0x53cf2e){return _0x5b095e[_0x889e('0x64')](_0x53cf2e[_0x889e('0x2d')])||!_0x53cf2e['default']&&_0x53cf2e['type']!==_0x889e('0x65')&&_0x53cf2e['type']!=='custom_dropdown';});return{'count':_0xbb094f[_0x889e('0x35')],'rows':_[_0x889e('0x2c')](_0xbb094f,function(_0x4f43fb){return{'id':_0x4f43fb[_0x889e('0x2d')],'name':_0x4f43fb[_0x889e('0x66')],'custom':!_0x4f43fb[_0x889e('0x67')],'options':_0x4f43fb[_0x889e('0x68')]?_[_0x889e('0x2c')](_0x4f43fb[_0x889e('0x68')],function(_0x44e18a){return{'name':_[_0x889e('0x69')](_0x44e18a),'value':_0x44e18a};}):[]};})};}})[_0x889e('0x24')](respondWithResult(_0xb80bd2,null))[_0x889e('0x44')](function(_0x5c8864){var _0x948512=_0x48b8f8['query'][_0x889e('0x6a')]?0x1f4:_0x5c8864['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x889e('0x53'),_0x948512,JSON[_0x889e('0x6b')](_0x5c8864));delete _0x5c8864[_0x889e('0x2d')];if(_0x948512===0x191){_0x948512=0x190;}_0xb80bd2[_0x889e('0x18')](_0x948512)[_0x889e('0x6c')](_0x48b8f8[_0x889e('0x2e')]['test']?{'message':_0x889e('0x6d'),'statusCode':_0x5c8864[_0x889e('0x6e')]}:_0x5c8864);});}; \ No newline at end of file +var _0xfa12=['../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','rawAttributes','filters','find','create','body','params','getConfigurations','findOne','nolimit','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','slice','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','format','%s:X','apiKey','toString','base64','requester','subject','agent','priority','group','source','ticket_type','remove','includes','custom_text','custom_dropdown','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x24a737,_0x3ff299){var _0x37b618=function(_0x3f0b2f){while(--_0x3f0b2f){_0x24a737['push'](_0x24a737['shift']());}};_0x37b618(++_0x3ff299);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x5ea25d,_0x3942e9){_0x5ea25d=_0x5ea25d-0x0;var _0x11acba=_0xfa12[_0x5ea25d];return _0x11acba;};'use strict';var emlformat=require(_0x2fa1('0x0'));var rimraf=require(_0x2fa1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2fa1('0x2'));var rp=require(_0x2fa1('0x3'));var moment=require(_0x2fa1('0x4'));var BPromise=require(_0x2fa1('0x5'));var Mustache=require('mustache');var util=require(_0x2fa1('0x6'));var path=require(_0x2fa1('0x7'));var sox=require(_0x2fa1('0x8'));var csv=require(_0x2fa1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fa1('0xa'));var _=require(_0x2fa1('0xb'));var squel=require('squel');var crypto=require(_0x2fa1('0xc'));var jsforce=require(_0x2fa1('0xd'));var deskjs=require(_0x2fa1('0xe'));var toCsv=require(_0x2fa1('0x9'));var querystring=require('querystring');var Papa=require(_0x2fa1('0xf'));var Redis=require(_0x2fa1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2fa1('0x11'));var as=require(_0x2fa1('0x12'));var hardwareService=require(_0x2fa1('0x13'));var logger=require(_0x2fa1('0x14'))(_0x2fa1('0x15'));var utils=require(_0x2fa1('0x16'));var config=require(_0x2fa1('0x17'));var licenseUtil=require(_0x2fa1('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2fa1('0x19'));function respondWithStatusCode(_0x4198e1,_0x311441){_0x311441=_0x311441||0xcc;return function(_0x3ccc0e){if(_0x3ccc0e){return _0x4198e1[_0x2fa1('0x1a')](_0x311441);}return _0x4198e1[_0x2fa1('0x1b')](_0x311441)['end']();};}function respondWithResult(_0xf81957,_0x409ea0){_0x409ea0=_0x409ea0||0xc8;return function(_0x39f334){if(_0x39f334){return _0xf81957[_0x2fa1('0x1b')](_0x409ea0)['json'](_0x39f334);}};}function respondWithFilteredResult(_0x3c79b6,_0x3d6647){return function(_0x59aa4d){if(_0x59aa4d){var _0x3f41f3=typeof _0x3d6647[_0x2fa1('0x1c')]===_0x2fa1('0x1d')&&typeof _0x3d6647[_0x2fa1('0x1e')]===_0x2fa1('0x1d');var _0x1307f8=_0x59aa4d[_0x2fa1('0x1f')];var _0x3722db=_0x3f41f3?0x0:_0x3d6647['offset'];var _0x31b4ab=_0x3f41f3?_0x59aa4d['count']:_0x3d6647['offset']+_0x3d6647[_0x2fa1('0x1e')];var _0x454595;if(_0x31b4ab>=_0x1307f8){_0x31b4ab=_0x1307f8;_0x454595=0xc8;}else{_0x454595=0xce;}_0x3c79b6[_0x2fa1('0x1b')](_0x454595);return _0x3c79b6[_0x2fa1('0x20')](_0x2fa1('0x21'),_0x3722db+'-'+_0x31b4ab+'/'+_0x1307f8)['json'](_0x59aa4d);}return null;};}function patchUpdates(_0x23f0d2){return function(_0x591d32){try{jsonpatch[_0x2fa1('0x22')](_0x591d32,_0x23f0d2,!![]);}catch(_0xdc3ed9){return BPromise[_0x2fa1('0x23')](_0xdc3ed9);}return _0x591d32[_0x2fa1('0x24')]();};}function saveUpdates(_0x24fe15,_0x3fa70d){return function(_0x1b3434){if(_0x1b3434){return _0x1b3434[_0x2fa1('0x25')](_0x24fe15)[_0x2fa1('0x26')](function(_0x15037c){return _0x15037c;});}return null;};}function removeEntity(_0x5021fb,_0x1eaa57){return function(_0x4e82b1){if(_0x4e82b1){return _0x4e82b1['destroy']()['then'](function(){_0x5021fb[_0x2fa1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a152c,_0x16a2b0){return function(_0x4627de){if(!_0x4627de){_0x4a152c[_0x2fa1('0x1a')](0x194);}return _0x4627de;};}function handleError(_0x398c53,_0x42cc71){_0x42cc71=_0x42cc71||0x1f4;return function(_0x21c57d){logger[_0x2fa1('0x27')](_0x21c57d[_0x2fa1('0x28')]);if(_0x21c57d[_0x2fa1('0x29')]){delete _0x21c57d[_0x2fa1('0x29')];}_0x398c53[_0x2fa1('0x1b')](_0x42cc71)[_0x2fa1('0x2a')](_0x21c57d);};}exports[_0x2fa1('0x2b')]=function(_0x44856f,_0x2a5dda){var _0xdb4308={},_0xd53b8={},_0x300970={'count':0x0,'rows':[]};var _0x5f41d1=_[_0x2fa1('0x2c')](db[_0x2fa1('0x2d')]['rawAttributes'],function(_0x1bf81b){return{'name':_0x1bf81b[_0x2fa1('0x2e')],'type':_0x1bf81b[_0x2fa1('0x2f')][_0x2fa1('0x30')]};});_0xd53b8[_0x2fa1('0x31')]=_['map'](_0x5f41d1,_0x2fa1('0x29'));_0xd53b8[_0x2fa1('0x32')]=_[_0x2fa1('0x33')](_0x44856f[_0x2fa1('0x32')]);_0xd53b8['filters']=_[_0x2fa1('0x34')](_0xd53b8[_0x2fa1('0x31')],_0xd53b8['query']);_0xdb4308[_0x2fa1('0x35')]=_['intersection'](_0xd53b8[_0x2fa1('0x31')],qs[_0x2fa1('0x36')](_0x44856f[_0x2fa1('0x32')][_0x2fa1('0x36')]));_0xdb4308[_0x2fa1('0x35')]=_0xdb4308[_0x2fa1('0x35')][_0x2fa1('0x37')]?_0xdb4308[_0x2fa1('0x35')]:_0xd53b8['model'];if(!_0x44856f[_0x2fa1('0x32')][_0x2fa1('0x38')]('nolimit')){_0xdb4308[_0x2fa1('0x1e')]=qs[_0x2fa1('0x1e')](_0x44856f[_0x2fa1('0x32')][_0x2fa1('0x1e')]);_0xdb4308[_0x2fa1('0x1c')]=qs[_0x2fa1('0x1c')](_0x44856f[_0x2fa1('0x32')][_0x2fa1('0x1c')]);}_0xdb4308['order']=qs['sort'](_0x44856f['query'][_0x2fa1('0x39')]);_0xdb4308[_0x2fa1('0x3a')]=qs['filters'](_['pick'](_0x44856f[_0x2fa1('0x32')],_0xd53b8['filters']),_0x5f41d1);if(_0x44856f[_0x2fa1('0x32')]['filter']){_0xdb4308[_0x2fa1('0x3a')]=_[_0x2fa1('0x3b')](_0xdb4308[_0x2fa1('0x3a')],{'$or':_[_0x2fa1('0x2c')](_0x5f41d1,function(_0x49deeb){if(_0x49deeb['type']!==_0x2fa1('0x3c')){var _0x7e4c5e={};_0x7e4c5e[_0x49deeb[_0x2fa1('0x29')]]={'$like':'%'+_0x44856f[_0x2fa1('0x32')][_0x2fa1('0x3d')]+'%'};return _0x7e4c5e;}})});}_0xdb4308=_[_0x2fa1('0x3b')]({},_0xdb4308,_0x44856f[_0x2fa1('0x3e')]);var _0x22d523={'where':_0xdb4308['where']};return db[_0x2fa1('0x2d')][_0x2fa1('0x1f')](_0x22d523)['then'](function(_0x27aaa3){_0x300970[_0x2fa1('0x1f')]=_0x27aaa3;if(_0x44856f[_0x2fa1('0x32')][_0x2fa1('0x3f')]){_0xdb4308[_0x2fa1('0x40')]=[{'all':!![]}];}return db[_0x2fa1('0x2d')][_0x2fa1('0x41')](_0xdb4308);})['then'](function(_0x1e600b){_0x300970[_0x2fa1('0x42')]=_0x1e600b;return _0x300970;})[_0x2fa1('0x26')](respondWithFilteredResult(_0x2a5dda,_0xdb4308))[_0x2fa1('0x43')](handleError(_0x2a5dda,null));};exports['show']=function(_0x2f4a0d,_0x229026){var _0x1180eb={'raw':![],'where':{'id':_0x2f4a0d['params']['id']}},_0x39577c={};_0x39577c[_0x2fa1('0x31')]=_[_0x2fa1('0x33')](db[_0x2fa1('0x2d')][_0x2fa1('0x44')]);_0x39577c[_0x2fa1('0x32')]=_[_0x2fa1('0x33')](_0x2f4a0d[_0x2fa1('0x32')]);_0x39577c[_0x2fa1('0x45')]=_[_0x2fa1('0x34')](_0x39577c[_0x2fa1('0x31')],_0x39577c['query']);_0x1180eb['attributes']=_['intersection'](_0x39577c[_0x2fa1('0x31')],qs['fields'](_0x2f4a0d['query']['fields']));_0x1180eb[_0x2fa1('0x35')]=_0x1180eb[_0x2fa1('0x35')][_0x2fa1('0x37')]?_0x1180eb[_0x2fa1('0x35')]:_0x39577c['model'];if(_0x2f4a0d[_0x2fa1('0x32')][_0x2fa1('0x3f')]){_0x1180eb[_0x2fa1('0x40')]=[{'all':!![]}];}_0x1180eb=_[_0x2fa1('0x3b')]({},_0x1180eb,_0x2f4a0d[_0x2fa1('0x3e')]);return db[_0x2fa1('0x2d')][_0x2fa1('0x46')](_0x1180eb)[_0x2fa1('0x26')](handleEntityNotFound(_0x229026,null))[_0x2fa1('0x26')](respondWithResult(_0x229026,null))[_0x2fa1('0x43')](handleError(_0x229026,null));};exports['create']=function(_0x34460a,_0x84798f){return db[_0x2fa1('0x2d')][_0x2fa1('0x47')](_0x34460a[_0x2fa1('0x48')],{})['then'](respondWithResult(_0x84798f,0xc9))[_0x2fa1('0x43')](handleError(_0x84798f,null));};exports[_0x2fa1('0x25')]=function(_0x1b8556,_0x19aff5){if(_0x1b8556['body']['id']){delete _0x1b8556['body']['id'];}return db[_0x2fa1('0x2d')]['find']({'where':{'id':_0x1b8556[_0x2fa1('0x49')]['id']}})[_0x2fa1('0x26')](handleEntityNotFound(_0x19aff5,null))[_0x2fa1('0x26')](saveUpdates(_0x1b8556[_0x2fa1('0x48')],null))[_0x2fa1('0x26')](respondWithResult(_0x19aff5,null))[_0x2fa1('0x43')](handleError(_0x19aff5,null));};exports['destroy']=function(_0x4d522f,_0x4ca733){return db['FreshdeskAccount']['find']({'where':{'id':_0x4d522f[_0x2fa1('0x49')]['id']}})[_0x2fa1('0x26')](handleEntityNotFound(_0x4ca733,null))[_0x2fa1('0x26')](removeEntity(_0x4ca733,null))[_0x2fa1('0x43')](handleError(_0x4ca733,null));};exports[_0x2fa1('0x4a')]=function(_0x557cde,_0x487990,_0x577197){var _0x3ccdc8={};var _0x105f26={};var _0x4b78b6;var _0x129b9b;return db[_0x2fa1('0x2d')][_0x2fa1('0x4b')]({'where':{'id':_0x557cde[_0x2fa1('0x49')]['id']}})[_0x2fa1('0x26')](handleEntityNotFound(_0x487990,null))['then'](function(_0x3b1923){if(_0x3b1923){_0x4b78b6=_0x3b1923;_0x105f26[_0x2fa1('0x31')]=_['keys'](db['FreshdeskConfiguration'][_0x2fa1('0x44')]);_0x105f26[_0x2fa1('0x32')]=_[_0x2fa1('0x33')](_0x557cde['query']);_0x105f26[_0x2fa1('0x45')]=_[_0x2fa1('0x34')](_0x105f26[_0x2fa1('0x31')],_0x105f26[_0x2fa1('0x32')]);_0x3ccdc8[_0x2fa1('0x35')]=_['intersection'](_0x105f26[_0x2fa1('0x31')],qs[_0x2fa1('0x36')](_0x557cde['query'][_0x2fa1('0x36')]));_0x3ccdc8[_0x2fa1('0x35')]=_0x3ccdc8[_0x2fa1('0x35')][_0x2fa1('0x37')]?_0x3ccdc8[_0x2fa1('0x35')]:_0x105f26[_0x2fa1('0x31')];_0x3ccdc8['order']=qs[_0x2fa1('0x39')](_0x557cde['query']['sort']);_0x3ccdc8['where']=qs[_0x2fa1('0x45')](_['pick'](_0x557cde['query'],_0x105f26[_0x2fa1('0x45')]));if(_0x557cde[_0x2fa1('0x32')][_0x2fa1('0x3d')]){_0x3ccdc8[_0x2fa1('0x3a')]=_[_0x2fa1('0x3b')](_0x3ccdc8[_0x2fa1('0x3a')],{'$or':_['map'](_0x3ccdc8['attributes'],function(_0x4c48b8){var _0x2ebcec={};_0x2ebcec[_0x4c48b8]={'$like':'%'+_0x557cde['query'][_0x2fa1('0x3d')]+'%'};return _0x2ebcec;})});}_0x3ccdc8=_[_0x2fa1('0x3b')]({},_0x3ccdc8,_0x557cde[_0x2fa1('0x3e')]);return _0x4b78b6[_0x2fa1('0x4a')](_0x3ccdc8);}})['then'](function(_0x31bfe1){if(_0x31bfe1){_0x129b9b=_0x31bfe1[_0x2fa1('0x37')];if(!_0x557cde['query'][_0x2fa1('0x38')](_0x2fa1('0x4c'))){_0x3ccdc8[_0x2fa1('0x1e')]=qs[_0x2fa1('0x1e')](_0x557cde['query'][_0x2fa1('0x1e')]);_0x3ccdc8['offset']=qs['offset'](_0x557cde[_0x2fa1('0x32')][_0x2fa1('0x1c')]);}return _0x4b78b6['getConfigurations'](_0x3ccdc8);}})['then'](function(_0x59d74f){if(_0x59d74f){return _0x59d74f?{'count':_0x129b9b,'rows':_0x59d74f}:null;}})[_0x2fa1('0x26')](respondWithResult(_0x487990,null))['catch'](handleError(_0x487990,null));};exports['addConfiguration']=function(_0x1c0b09,_0x3dc580,_0x2a54ba){if(_0x1c0b09[_0x2fa1('0x48')]['id']){delete _0x1c0b09[_0x2fa1('0x48')]['id'];}return db['FreshdeskAccount'][_0x2fa1('0x4b')]({'where':{'id':_0x1c0b09[_0x2fa1('0x49')]['id']}})[_0x2fa1('0x26')](handleEntityNotFound(_0x3dc580,null))[_0x2fa1('0x26')](function(_0x4e8d81){if(_0x4e8d81){_0x1c0b09[_0x2fa1('0x48')][_0x2fa1('0x4d')]=_0x4e8d81['id'];_0x1c0b09[_0x2fa1('0x48')][_0x2fa1('0x4e')]=integrations[_0x2fa1('0x4f')](_0x1c0b09[_0x2fa1('0x48')][_0x2fa1('0x50')],_0x1c0b09[_0x2fa1('0x48')][_0x2fa1('0x2f')]);_0x1c0b09[_0x2fa1('0x48')]['Descriptions']=integrations['getDescriptions'](_0x1c0b09[_0x2fa1('0x48')][_0x2fa1('0x50')],_0x1c0b09[_0x2fa1('0x48')][_0x2fa1('0x2f')]);return db['FreshdeskConfiguration'][_0x2fa1('0x47')](_0x1c0b09[_0x2fa1('0x48')],{'include':[{'model':db[_0x2fa1('0x51')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x2fa1('0x52')}]});}return null;})['then'](respondWithResult(_0x3dc580,null))['catch'](handleError(_0x3dc580,null));};exports[_0x2fa1('0x53')]=function(_0x424ebc,_0x2b4088,_0x295a28){var _0x4f6ded='';return db[_0x2fa1('0x2d')]['findOne']({'where':{'id':_0x424ebc['params']['id']},'attributes':['id',_0x2fa1('0x54'),'apiKey']})[_0x2fa1('0x26')](handleEntityNotFound(_0x2b4088,null))[_0x2fa1('0x26')](function(_0x4f3bfb){if(_0x4f3bfb){_0x4f6ded=_0x4f3bfb[_0x2fa1('0x54')];var _0x2f206d=_0x4f6ded[_0x2fa1('0x55')](-0x1);if(_0x2f206d==='/'){_0x4f6ded=_0x4f6ded['substring'](0x0,_0x4f6ded['lastIndexOf'](_0x2f206d));}return rp({'method':_0x2fa1('0x56'),'uri':util['format'](_0x2fa1('0x57'),_0x4f6ded,_0x2fa1('0x58')),'headers':{'Authorization':util['format'](_0x2fa1('0x59'),new Buffer(util[_0x2fa1('0x5a')](_0x2fa1('0x5b'),_0x4f3bfb[_0x2fa1('0x5c')]))[_0x2fa1('0x5d')](_0x2fa1('0x5e')))},'json':!![]});}})[_0x2fa1('0x26')](function(_0x50441f){if(_0x50441f){var _0x456cd2=[_0x2fa1('0x5f'),_0x2fa1('0x60'),_0x2fa1('0x61'),'description',_0x2fa1('0x1b'),_0x2fa1('0x62'),_0x2fa1('0x63'),_0x2fa1('0x64'),_0x2fa1('0x65'),_0x2fa1('0x63'),'company'];_[_0x2fa1('0x66')](_0x50441f,function(_0x524cc0){return _0x456cd2[_0x2fa1('0x67')](_0x524cc0[_0x2fa1('0x29')])||!_0x524cc0['default']&&_0x524cc0[_0x2fa1('0x2f')]!==_0x2fa1('0x68')&&_0x524cc0[_0x2fa1('0x2f')]!==_0x2fa1('0x69');});return{'count':_0x50441f[_0x2fa1('0x37')],'rows':_[_0x2fa1('0x2c')](_0x50441f,function(_0x183172){return{'id':_0x183172[_0x2fa1('0x29')],'name':_0x183172['label'],'custom':!_0x183172[_0x2fa1('0x6a')],'options':_0x183172[_0x2fa1('0x6b')]?_['map'](_0x183172[_0x2fa1('0x6b')],function(_0x25fefb){return{'name':_[_0x2fa1('0x6c')](_0x25fefb),'value':_0x25fefb};}):[]};})};}})[_0x2fa1('0x26')](respondWithResult(_0x2b4088,null))[_0x2fa1('0x43')](function(_0x52bc68){var _0x27c496=_0x424ebc['query'][_0x2fa1('0x6d')]?0x1f4:_0x52bc68[_0x2fa1('0x6e')]||0x1f4;logger[_0x2fa1('0x27')](_0x2fa1('0x6f'),_0x2fa1('0x53'),_0x27c496,JSON[_0x2fa1('0x70')](_0x52bc68));delete _0x52bc68['name'];if(_0x27c496===0x191){_0x27c496=0x190;}_0x2b4088[_0x2fa1('0x1b')](_0x27c496)[_0x2fa1('0x2a')](_0x424ebc[_0x2fa1('0x32')]['test']?{'message':_0x2fa1('0x71'),'statusCode':_0x52bc68[_0x2fa1('0x6e')]}:_0x52bc68);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 33c9e4c..73c6bbb 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 _0x74a0=['exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x74a0,0x155));var _0x074a=function(_0x3540ac,_0x3eccba){_0x3540ac=_0x3540ac-0x0;var _0x72ac9e=_0x74a0[_0x3540ac];return _0x72ac9e;};'use strict';var _=require(_0x074a('0x0'));var util=require(_0x074a('0x1'));var logger=require(_0x074a('0x2'))(_0x074a('0x3'));var moment=require(_0x074a('0x4'));var BPromise=require('bluebird');var rp=require(_0x074a('0x5'));var fs=require('fs');var path=require(_0x074a('0x6'));var rimraf=require('rimraf');var config=require(_0x074a('0x7'));var attributes=require(_0x074a('0x8'));var integrations=require(_0x074a('0x9'));module[_0x074a('0xa')]=function(_0x43a5bc,_0x5b11e2){return _0x43a5bc['define'](_0x074a('0xb'),attributes,{'tableName':_0x074a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x713f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger'];(function(_0x1e6d7e,_0x356775){var _0x4256a3=function(_0x3527f1){while(--_0x3527f1){_0x1e6d7e['push'](_0x1e6d7e['shift']());}};_0x4256a3(++_0x356775);}(_0x713f,0x186));var _0xf713=function(_0x9b1a8,_0x20aa23){_0x9b1a8=_0x9b1a8-0x0;var _0x3d4ee7=_0x713f[_0x9b1a8];return _0x3d4ee7;};'use strict';var _=require(_0xf713('0x0'));var util=require('util');var logger=require(_0xf713('0x1'))(_0xf713('0x2'));var moment=require(_0xf713('0x3'));var BPromise=require(_0xf713('0x4'));var rp=require(_0xf713('0x5'));var fs=require('fs');var path=require(_0xf713('0x6'));var rimraf=require(_0xf713('0x7'));var config=require(_0xf713('0x8'));var attributes=require(_0xf713('0x9'));var integrations=require(_0xf713('0xa'));module[_0xf713('0xb')]=function(_0x19104e,_0x13b9ba){return _0x19104e['define'](_0xf713('0xc'),attributes,{'tableName':_0xf713('0xd'),'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 ca90d46..0ff3c92 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 _0xd4ba=['request\x20sent','error','message','result','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','GetFreshdeskAccount','debug','stringify','catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x53378d,_0x1073a3){var _0x276376=function(_0x294054){while(--_0x294054){_0x53378d['push'](_0x53378d['shift']());}};_0x276376(++_0x1073a3);}(_0xd4ba,0x7c));var _0xad4b=function(_0x2a9ee6,_0xb18d68){_0x2a9ee6=_0x2a9ee6-0x0;var _0x45876e=_0xd4ba[_0x2a9ee6];return _0x45876e;};'use strict';var _=require(_0xad4b('0x0'));var util=require(_0xad4b('0x1'));var moment=require(_0xad4b('0x2'));var BPromise=require(_0xad4b('0x3'));var rs=require(_0xad4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad4b('0x5'));var logger=require(_0xad4b('0x6'))(_0xad4b('0x7'));var config=require(_0xad4b('0x8'));var jayson=require(_0xad4b('0x9'));var client=jayson[_0xad4b('0xa')][_0xad4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39988b,_0x4d16e2,_0x21198c){return new BPromise(function(_0x2054db,_0x27badc){return client[_0xad4b('0xc')](_0x39988b,_0x21198c)[_0xad4b('0xd')](function(_0x34f962){logger[_0xad4b('0xe')](_0xad4b('0xf'),_0x4d16e2,_0xad4b('0x10'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x4d16e2,_0xad4b('0x10'),JSON['stringify'](_0x34f962));if(_0x34f962[_0xad4b('0x11')]){if(_0x34f962[_0xad4b('0x11')]['code']===0x1f4){logger['error'](_0xad4b('0xf'),_0x4d16e2,_0x34f962[_0xad4b('0x11')]['message']);return _0x27badc(_0x34f962[_0xad4b('0x11')][_0xad4b('0x12')]);}logger[_0xad4b('0x11')](_0xad4b('0xf'),_0x4d16e2,_0x34f962[_0xad4b('0x11')][_0xad4b('0x12')]);return _0x2054db(_0x34f962[_0xad4b('0x11')]['message']);}else{logger[_0xad4b('0xe')](_0xad4b('0xf'),_0x4d16e2,_0xad4b('0x10'));_0x2054db(_0x34f962[_0xad4b('0x13')][_0xad4b('0x12')]);}})['catch'](function(_0x53d56f){logger[_0xad4b('0x11')](_0xad4b('0xf'),_0x4d16e2,_0x53d56f);_0x27badc(_0x53d56f);});});}exports['GetFreshdeskAccount']=function(_0x207c05){var _0x1041e4=this;return new Promise(function(_0x46c8fc,_0x69cee8){return db[_0xad4b('0x14')][_0xad4b('0x15')]({'raw':_0x207c05[_0xad4b('0x16')]?_0x207c05[_0xad4b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x207c05[_0xad4b('0x16')]?_0x207c05['options'][_0xad4b('0x17')]||null:null,'attributes':_0x207c05[_0xad4b('0x16')]?_0x207c05[_0xad4b('0x16')][_0xad4b('0x18')]||null:null,'limit':_0x207c05[_0xad4b('0x16')]?_0x207c05[_0xad4b('0x16')][_0xad4b('0x19')]||null:null,'include':_0x207c05['options']?_0x207c05[_0xad4b('0x16')][_0xad4b('0x1a')]?_[_0xad4b('0x1b')](_0x207c05['options'][_0xad4b('0x1a')],function(_0x432132){return{'model':db[_0x432132[_0xad4b('0x1c')]],'as':_0x432132['as'],'attributes':_0x432132[_0xad4b('0x18')],'include':_0x432132[_0xad4b('0x1a')]?_[_0xad4b('0x1b')](_0x432132[_0xad4b('0x1a')],function(_0x31bd0){return{'model':db[_0x31bd0[_0xad4b('0x1c')]],'as':_0x31bd0['as'],'attributes':_0x31bd0[_0xad4b('0x18')],'include':_0x31bd0[_0xad4b('0x1a')]?_[_0xad4b('0x1b')](_0x31bd0[_0xad4b('0x1a')],function(_0x591c2a){return{'model':db[_0x591c2a[_0xad4b('0x1c')]],'as':_0x591c2a['as'],'attributes':_0x591c2a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x32b2a2){logger[_0xad4b('0xe')](_0xad4b('0x1d'),_0x207c05);logger[_0xad4b('0x1e')]('GetFreshdeskAccount',_0x207c05,JSON[_0xad4b('0x1f')](_0x32b2a2));_0x46c8fc(_0x32b2a2);})[_0xad4b('0x20')](function(_0x29fe04){logger[_0xad4b('0x11')](_0xad4b('0x1d'),_0x29fe04[_0xad4b('0x12')],_0x207c05);_0x69cee8(_0x1041e4[_0xad4b('0x11')](0x1f4,_0x29fe04[_0xad4b('0x12')]));});});};exports[_0xad4b('0x21')]=function(_0x26624d){var _0x13a53a=this;return new Promise(function(_0x3e4203,_0x322cce){return db[_0xad4b('0x14')][_0xad4b('0x22')]({'raw':_0x26624d[_0xad4b('0x16')]?_0x26624d[_0xad4b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x26624d[_0xad4b('0x16')]?_0x26624d[_0xad4b('0x16')][_0xad4b('0x17')]||null:null,'attributes':_0x26624d[_0xad4b('0x16')]?_0x26624d[_0xad4b('0x16')]['attributes']||null:null,'include':_0x26624d[_0xad4b('0x16')]?_0x26624d[_0xad4b('0x16')]['include']?_[_0xad4b('0x1b')](_0x26624d['options'][_0xad4b('0x1a')],function(_0x3f0b1a){return{'model':db[_0x3f0b1a[_0xad4b('0x1c')]],'as':_0x3f0b1a['as'],'attributes':_0x3f0b1a[_0xad4b('0x18')],'include':_0x3f0b1a[_0xad4b('0x1a')]?_['map'](_0x3f0b1a[_0xad4b('0x1a')],function(_0x1b4e02){return{'model':db[_0x1b4e02[_0xad4b('0x1c')]],'as':_0x1b4e02['as'],'attributes':_0x1b4e02[_0xad4b('0x18')],'include':_0x1b4e02[_0xad4b('0x1a')]?_[_0xad4b('0x1b')](_0x1b4e02[_0xad4b('0x1a')],function(_0x778f33){return{'model':db[_0x778f33[_0xad4b('0x1c')]],'as':_0x778f33['as'],'attributes':_0x778f33[_0xad4b('0x18')]};}):[]};}):[]};}):[]:[]})[_0xad4b('0xd')](function(_0x17378f){logger['info'](_0xad4b('0x21'),_0x26624d);logger[_0xad4b('0x1e')](_0xad4b('0x21'),_0x26624d,JSON[_0xad4b('0x1f')](_0x17378f));_0x3e4203(_0x17378f);})[_0xad4b('0x20')](function(_0x3ca490){logger['error'](_0xad4b('0x21'),_0x3ca490['message'],_0x26624d);_0x322cce(_0x13a53a['error'](0x1f4,_0x3ca490['message']));});});}; \ No newline at end of file +var _0x4369=['model','then','stringify','find','ShowFreshdeskAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x200bdf,_0x5eb4cd){var _0xbdc6a0=function(_0x3f1baa){while(--_0x3f1baa){_0x200bdf['push'](_0x200bdf['shift']());}};_0xbdc6a0(++_0x5eb4cd);}(_0x4369,0x108));var _0x9436=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0x4369[_0xb0fe92];return _0x41787f;};'use strict';var _=require(_0x9436('0x0'));var util=require(_0x9436('0x1'));var moment=require('moment');var BPromise=require(_0x9436('0x2'));var rs=require(_0x9436('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9436('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9436('0x5'))(_0x9436('0x6'));var config=require(_0x9436('0x7'));var jayson=require(_0x9436('0x8'));var client=jayson[_0x9436('0x9')][_0x9436('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x574898,_0x1f6ece,_0x5479ff){return new BPromise(function(_0x5e1f68,_0x432623){return client[_0x9436('0xb')](_0x574898,_0x5479ff)['then'](function(_0x59e458){logger[_0x9436('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x1f6ece,_0x9436('0xd'));logger[_0x9436('0xe')](_0x9436('0xf'),_0x1f6ece,_0x9436('0xd'),JSON['stringify'](_0x59e458));if(_0x59e458[_0x9436('0x10')]){if(_0x59e458[_0x9436('0x10')][_0x9436('0x11')]===0x1f4){logger['error'](_0x9436('0x12'),_0x1f6ece,_0x59e458[_0x9436('0x10')]['message']);return _0x432623(_0x59e458['error'][_0x9436('0x13')]);}logger[_0x9436('0x10')](_0x9436('0x12'),_0x1f6ece,_0x59e458[_0x9436('0x10')][_0x9436('0x13')]);return _0x5e1f68(_0x59e458[_0x9436('0x10')][_0x9436('0x13')]);}else{logger[_0x9436('0xc')](_0x9436('0x12'),_0x1f6ece,'request\x20sent');_0x5e1f68(_0x59e458[_0x9436('0x14')][_0x9436('0x13')]);}})[_0x9436('0x15')](function(_0x37638d){logger[_0x9436('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x1f6ece,_0x37638d);_0x432623(_0x37638d);});});}exports[_0x9436('0x16')]=function(_0x1160fd){var _0x3df898=this;return new Promise(function(_0x46caa8,_0x191fd1){return db[_0x9436('0x17')][_0x9436('0x18')]({'raw':_0x1160fd[_0x9436('0x19')]?_0x1160fd[_0x9436('0x19')][_0x9436('0x1a')]===undefined?!![]:![]:!![],'where':_0x1160fd[_0x9436('0x19')]?_0x1160fd[_0x9436('0x19')][_0x9436('0x1b')]||null:null,'attributes':_0x1160fd[_0x9436('0x19')]?_0x1160fd[_0x9436('0x19')][_0x9436('0x1c')]||null:null,'limit':_0x1160fd['options']?_0x1160fd[_0x9436('0x19')][_0x9436('0x1d')]||null:null,'include':_0x1160fd[_0x9436('0x19')]?_0x1160fd['options'][_0x9436('0x1e')]?_['map'](_0x1160fd[_0x9436('0x19')][_0x9436('0x1e')],function(_0x2cb102){return{'model':db[_0x2cb102['model']],'as':_0x2cb102['as'],'attributes':_0x2cb102[_0x9436('0x1c')],'include':_0x2cb102[_0x9436('0x1e')]?_[_0x9436('0x1f')](_0x2cb102['include'],function(_0x5620ac){return{'model':db[_0x5620ac[_0x9436('0x20')]],'as':_0x5620ac['as'],'attributes':_0x5620ac[_0x9436('0x1c')],'include':_0x5620ac[_0x9436('0x1e')]?_[_0x9436('0x1f')](_0x5620ac[_0x9436('0x1e')],function(_0x202ef6){return{'model':db[_0x202ef6[_0x9436('0x20')]],'as':_0x202ef6['as'],'attributes':_0x202ef6[_0x9436('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9436('0x21')](function(_0x5945bf){logger[_0x9436('0xc')](_0x9436('0x16'),_0x1160fd);logger[_0x9436('0xe')](_0x9436('0x16'),_0x1160fd,JSON[_0x9436('0x22')](_0x5945bf));_0x46caa8(_0x5945bf);})[_0x9436('0x15')](function(_0x2c02a6){logger['error'](_0x9436('0x16'),_0x2c02a6['message'],_0x1160fd);_0x191fd1(_0x3df898[_0x9436('0x10')](0x1f4,_0x2c02a6[_0x9436('0x13')]));});});};exports['ShowFreshdeskAccount']=function(_0x5eee3e){var _0x42b1ac=this;return new Promise(function(_0x3408e5,_0x42a232){return db[_0x9436('0x17')][_0x9436('0x23')]({'raw':_0x5eee3e[_0x9436('0x19')]?_0x5eee3e[_0x9436('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5eee3e['options']?_0x5eee3e[_0x9436('0x19')][_0x9436('0x1b')]||null:null,'attributes':_0x5eee3e[_0x9436('0x19')]?_0x5eee3e['options'][_0x9436('0x1c')]||null:null,'include':_0x5eee3e[_0x9436('0x19')]?_0x5eee3e['options']['include']?_[_0x9436('0x1f')](_0x5eee3e['options'][_0x9436('0x1e')],function(_0x3637a1){return{'model':db[_0x3637a1[_0x9436('0x20')]],'as':_0x3637a1['as'],'attributes':_0x3637a1[_0x9436('0x1c')],'include':_0x3637a1['include']?_[_0x9436('0x1f')](_0x3637a1[_0x9436('0x1e')],function(_0x2cb3d9){return{'model':db[_0x2cb3d9[_0x9436('0x20')]],'as':_0x2cb3d9['as'],'attributes':_0x2cb3d9[_0x9436('0x1c')],'include':_0x2cb3d9[_0x9436('0x1e')]?_[_0x9436('0x1f')](_0x2cb3d9['include'],function(_0x2f150d){return{'model':db[_0x2f150d[_0x9436('0x20')]],'as':_0x2f150d['as'],'attributes':_0x2f150d[_0x9436('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b3dd5){logger[_0x9436('0xc')](_0x9436('0x24'),_0x5eee3e);logger[_0x9436('0xe')](_0x9436('0x24'),_0x5eee3e,JSON[_0x9436('0x22')](_0x1b3dd5));_0x3408e5(_0x1b3dd5);})[_0x9436('0x15')](function(_0xf17b9f){logger[_0x9436('0x10')]('ShowFreshdeskAccount',_0xf17b9f[_0x9436('0x13')],_0x5eee3e);_0x42a232(_0x42b1ac['error'](0x1f4,_0xf17b9f['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 6eeb5b5..c5d88c3 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 _0x69c5=['post','setTags','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','create'];(function(_0x16bbaf,_0x2c1a63){var _0x5bff5f=function(_0x3eac5f){while(--_0x3eac5f){_0x16bbaf['push'](_0x16bbaf['shift']());}};_0x5bff5f(++_0x2c1a63);}(_0x69c5,0x157));var _0x569c=function(_0x933bcc,_0x3e495c){_0x933bcc=_0x933bcc-0x0;var _0x3a1f44=_0x69c5[_0x933bcc];return _0x3a1f44;};'use strict';var multer=require(_0x569c('0x0'));var util=require(_0x569c('0x1'));var path=require(_0x569c('0x2'));var timeout=require('connect-timeout');var express=require(_0x569c('0x3'));var router=express['Router']();var fs_extra=require(_0x569c('0x4'));var auth=require(_0x569c('0x5'));var interaction=require(_0x569c('0x6'));var config=require(_0x569c('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x569c('0x8')]('/',auth[_0x569c('0x9')](),controller[_0x569c('0xa')]);router[_0x569c('0x8')]('/:id',auth[_0x569c('0x9')](),controller['show']);router[_0x569c('0x8')](_0x569c('0xb'),auth[_0x569c('0x9')](),controller['getFields']);router[_0x569c('0x8')](_0x569c('0xc'),auth[_0x569c('0x9')](),controller[_0x569c('0xd')]);router['get'](_0x569c('0xe'),auth[_0x569c('0x9')](),controller['getDescriptions']);router[_0x569c('0x8')](_0x569c('0xf'),auth[_0x569c('0x9')](),controller['getTags']);router['post']('/',auth[_0x569c('0x9')](),controller[_0x569c('0x10')]);router[_0x569c('0x11')](_0x569c('0xf'),auth[_0x569c('0x9')](),controller[_0x569c('0x12')]);router['put'](_0x569c('0x13'),auth[_0x569c('0x9')](),controller[_0x569c('0x14')]);router[_0x569c('0x15')](_0x569c('0x13'),auth[_0x569c('0x9')](),controller[_0x569c('0x16')]);module[_0x569c('0x17')]=router; \ No newline at end of file +var _0x5cf1=['fs-extra','../../components/auth/service','get','/:id','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x548e64,_0x29e562){var _0x47d34e=function(_0x397256){while(--_0x397256){_0x548e64['push'](_0x548e64['shift']());}};_0x47d34e(++_0x29e562);}(_0x5cf1,0x18b));var _0x15cf=function(_0x52e9e3,_0xe465a7){_0x52e9e3=_0x52e9e3-0x0;var _0x960a8d=_0x5cf1[_0x52e9e3];return _0x960a8d;};'use strict';var multer=require(_0x15cf('0x0'));var util=require('util');var path=require(_0x15cf('0x1'));var timeout=require(_0x15cf('0x2'));var express=require(_0x15cf('0x3'));var router=express['Router']();var fs_extra=require(_0x15cf('0x4'));var auth=require(_0x15cf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x15cf('0x6')](_0x15cf('0x7'),auth[_0x15cf('0x8')](),controller[_0x15cf('0x9')]);router[_0x15cf('0x6')]('/:id/fields',auth[_0x15cf('0x8')](),controller[_0x15cf('0xa')]);router[_0x15cf('0x6')](_0x15cf('0xb'),auth[_0x15cf('0x8')](),controller['getSubjects']);router['get'](_0x15cf('0xc'),auth[_0x15cf('0x8')](),controller[_0x15cf('0xd')]);router[_0x15cf('0x6')](_0x15cf('0xe'),auth[_0x15cf('0x8')](),controller['getTags']);router['post']('/',auth[_0x15cf('0x8')](),controller['create']);router['post'](_0x15cf('0xe'),auth[_0x15cf('0x8')](),controller[_0x15cf('0xf')]);router[_0x15cf('0x10')](_0x15cf('0x7'),auth[_0x15cf('0x8')](),controller[_0x15cf('0x11')]);router[_0x15cf('0x12')](_0x15cf('0x7'),auth[_0x15cf('0x8')](),controller[_0x15cf('0x13')]);module[_0x15cf('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 9df4e0b..d52dbe6 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 _0xd9ea=['STRING','exports'];(function(_0x21a5dd,_0x2d8450){var _0x169918=function(_0x252d34){while(--_0x252d34){_0x21a5dd['push'](_0x21a5dd['shift']());}};_0x169918(++_0x2d8450);}(_0xd9ea,0xc9));var _0xad9e=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xd9ea[_0x556927];return _0x5f1235;};'use strict';var Sequelize=require('sequelize');module[_0xad9e('0x0')]={'name':{'type':Sequelize[_0xad9e('0x1')]},'description':{'type':Sequelize[_0xad9e('0x1')]}}; \ No newline at end of file +var _0xc1b8=['sequelize','exports','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc1b8,0x13b));var _0x8c1b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc1b8[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x8c1b('0x0'));module[_0x8c1b('0x1')]={'name':{'type':Sequelize[_0x8c1b('0x2')]},'description':{'type':Sequelize[_0x8c1b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b4db910..a31af37 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 _0x6951=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','sendStatus','stack','name','send','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','then','catch','show','params','options','find','create','body','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x35fbe5,_0x59199f){var _0x2e259e=function(_0x1a2250){while(--_0x1a2250){_0x35fbe5['push'](_0x35fbe5['shift']());}};_0x2e259e(++_0x59199f);}(_0x6951,0x180));var _0x1695=function(_0x5e59d1,_0x578317){_0x5e59d1=_0x5e59d1-0x0;var _0x382dfe=_0x6951[_0x5e59d1];return _0x382dfe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1695('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1695('0x1'));var rp=require(_0x1695('0x2'));var moment=require(_0x1695('0x3'));var BPromise=require(_0x1695('0x4'));var Mustache=require(_0x1695('0x5'));var util=require('util');var path=require(_0x1695('0x6'));var sox=require(_0x1695('0x7'));var csv=require(_0x1695('0x8'));var ejs=require(_0x1695('0x9'));var fs=require('fs');var fs_extra=require(_0x1695('0xa'));var _=require(_0x1695('0xb'));var squel=require(_0x1695('0xc'));var crypto=require(_0x1695('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1695('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1695('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1695('0xf'));var hardwareService=require(_0x1695('0x10'));var logger=require(_0x1695('0x11'))(_0x1695('0x12'));var utils=require(_0x1695('0x13'));var config=require(_0x1695('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1695('0x15'))['db'];function respondWithStatusCode(_0x34cdab,_0x58d64d){_0x58d64d=_0x58d64d||0xcc;return function(_0x137fdd){if(_0x137fdd){return _0x34cdab['sendStatus'](_0x58d64d);}return _0x34cdab[_0x1695('0x16')](_0x58d64d)[_0x1695('0x17')]();};}function respondWithResult(_0x3b1a05,_0x38981f){_0x38981f=_0x38981f||0xc8;return function(_0x184ff3){if(_0x184ff3){return _0x3b1a05[_0x1695('0x16')](_0x38981f)['json'](_0x184ff3);}};}function respondWithFilteredResult(_0xd0f308,_0xb19135){return function(_0x158bce){if(_0x158bce){var _0x525985=typeof _0xb19135[_0x1695('0x18')]===_0x1695('0x19')&&typeof _0xb19135[_0x1695('0x1a')]==='undefined';var _0x59126d=_0x158bce['count'];var _0x4a2c59=_0x525985?0x0:_0xb19135[_0x1695('0x18')];var _0x62bd46=_0x525985?_0x158bce[_0x1695('0x1b')]:_0xb19135[_0x1695('0x18')]+_0xb19135[_0x1695('0x1a')];var _0x1ef152;if(_0x62bd46>=_0x59126d){_0x62bd46=_0x59126d;_0x1ef152=0xc8;}else{_0x1ef152=0xce;}_0xd0f308[_0x1695('0x16')](_0x1ef152);return _0xd0f308[_0x1695('0x1c')](_0x1695('0x1d'),_0x4a2c59+'-'+_0x62bd46+'/'+_0x59126d)[_0x1695('0x1e')](_0x158bce);}return null;};}function patchUpdates(_0x32dfcf){return function(_0xe07d19){try{jsonpatch[_0x1695('0x1f')](_0xe07d19,_0x32dfcf,!![]);}catch(_0x1c246c){return BPromise['reject'](_0x1c246c);}return _0xe07d19[_0x1695('0x20')]();};}function saveUpdates(_0x5bb308,_0x123903){return function(_0x2950b9){if(_0x2950b9){return _0x2950b9[_0x1695('0x21')](_0x5bb308)['then'](function(_0x2abf13){return _0x2abf13;});}return null;};}function removeEntity(_0x373002,_0x13c4ec){return function(_0xc53c75){if(_0xc53c75){return _0xc53c75['destroy']()['then'](function(){_0x373002[_0x1695('0x16')](0xcc)[_0x1695('0x17')]();});}};}function handleEntityNotFound(_0x16907b,_0x53adeb){return function(_0x30f078){if(!_0x30f078){_0x16907b[_0x1695('0x22')](0x194);}return _0x30f078;};}function handleError(_0x1bf1a4,_0x158549){_0x158549=_0x158549||0x1f4;return function(_0x2390fc){logger['error'](_0x2390fc[_0x1695('0x23')]);if(_0x2390fc[_0x1695('0x24')]){delete _0x2390fc[_0x1695('0x24')];}_0x1bf1a4[_0x1695('0x16')](_0x158549)[_0x1695('0x25')](_0x2390fc);};}exports['index']=function(_0x5b30f6,_0x53a698){var _0xce43b5={},_0x624ecf={},_0x4a0a5e={'count':0x0,'rows':[]};var _0x380202=_[_0x1695('0x26')](db[_0x1695('0x27')][_0x1695('0x28')],function(_0x3fb930){return{'name':_0x3fb930['fieldName'],'type':_0x3fb930[_0x1695('0x29')][_0x1695('0x2a')]};});_0x624ecf[_0x1695('0x2b')]=_[_0x1695('0x26')](_0x380202,_0x1695('0x24'));_0x624ecf[_0x1695('0x2c')]=_[_0x1695('0x2d')](_0x5b30f6['query']);_0x624ecf[_0x1695('0x2e')]=_['intersection'](_0x624ecf[_0x1695('0x2b')],_0x624ecf[_0x1695('0x2c')]);_0xce43b5[_0x1695('0x2f')]=_[_0x1695('0x30')](_0x624ecf['model'],qs[_0x1695('0x31')](_0x5b30f6[_0x1695('0x2c')]['fields']));_0xce43b5[_0x1695('0x2f')]=_0xce43b5[_0x1695('0x2f')][_0x1695('0x32')]?_0xce43b5[_0x1695('0x2f')]:_0x624ecf['model'];if(!_0x5b30f6['query']['hasOwnProperty'](_0x1695('0x33'))){_0xce43b5[_0x1695('0x1a')]=qs[_0x1695('0x1a')](_0x5b30f6[_0x1695('0x2c')][_0x1695('0x1a')]);_0xce43b5['offset']=qs['offset'](_0x5b30f6[_0x1695('0x2c')][_0x1695('0x18')]);}_0xce43b5[_0x1695('0x34')]=qs[_0x1695('0x35')](_0x5b30f6[_0x1695('0x2c')][_0x1695('0x35')]);_0xce43b5[_0x1695('0x36')]=qs[_0x1695('0x2e')](_[_0x1695('0x37')](_0x5b30f6[_0x1695('0x2c')],_0x624ecf[_0x1695('0x2e')]),_0x380202);if(_0x5b30f6[_0x1695('0x2c')]['filter']){_0xce43b5[_0x1695('0x36')]=_[_0x1695('0x38')](_0xce43b5[_0x1695('0x36')],{'$or':_['map'](_0x380202,function(_0x509ead){if(_0x509ead[_0x1695('0x29')]!==_0x1695('0x39')){var _0x43c93d={};_0x43c93d[_0x509ead[_0x1695('0x24')]]={'$like':'%'+_0x5b30f6[_0x1695('0x2c')][_0x1695('0x3a')]+'%'};return _0x43c93d;}})});}_0xce43b5=_[_0x1695('0x38')]({},_0xce43b5,_0x5b30f6['options']);var _0x263e4f={'where':_0xce43b5[_0x1695('0x36')]};return db['FreshdeskConfiguration']['count'](_0x263e4f)['then'](function(_0x22adfc){_0x4a0a5e[_0x1695('0x1b')]=_0x22adfc;if(_0x5b30f6[_0x1695('0x2c')][_0x1695('0x3b')]){_0xce43b5[_0x1695('0x3c')]=[{'all':!![]}];}return db[_0x1695('0x27')][_0x1695('0x3d')](_0xce43b5);})['then'](function(_0x546597){_0x4a0a5e[_0x1695('0x3e')]=_0x546597;return _0x4a0a5e;})[_0x1695('0x3f')](respondWithFilteredResult(_0x53a698,_0xce43b5))[_0x1695('0x40')](handleError(_0x53a698,null));};exports[_0x1695('0x41')]=function(_0xcaf058,_0x706b71){var _0x2af3c7={'raw':![],'where':{'id':_0xcaf058[_0x1695('0x42')]['id']}},_0x11b66b={};_0x11b66b[_0x1695('0x2b')]=_[_0x1695('0x2d')](db['FreshdeskConfiguration'][_0x1695('0x28')]);_0x11b66b[_0x1695('0x2c')]=_[_0x1695('0x2d')](_0xcaf058[_0x1695('0x2c')]);_0x11b66b[_0x1695('0x2e')]=_[_0x1695('0x30')](_0x11b66b[_0x1695('0x2b')],_0x11b66b['query']);_0x2af3c7[_0x1695('0x2f')]=_[_0x1695('0x30')](_0x11b66b[_0x1695('0x2b')],qs[_0x1695('0x31')](_0xcaf058[_0x1695('0x2c')][_0x1695('0x31')]));_0x2af3c7[_0x1695('0x2f')]=_0x2af3c7[_0x1695('0x2f')][_0x1695('0x32')]?_0x2af3c7['attributes']:_0x11b66b[_0x1695('0x2b')];if(_0xcaf058[_0x1695('0x2c')]['includeAll']){_0x2af3c7[_0x1695('0x3c')]=[{'all':!![]}];}_0x2af3c7=_['merge']({},_0x2af3c7,_0xcaf058[_0x1695('0x43')]);return db[_0x1695('0x27')][_0x1695('0x44')](_0x2af3c7)[_0x1695('0x3f')](handleEntityNotFound(_0x706b71,null))['then'](respondWithResult(_0x706b71,null))['catch'](handleError(_0x706b71,null));};exports[_0x1695('0x45')]=function(_0x5e87,_0x2d9fa1){return db[_0x1695('0x27')][_0x1695('0x45')](_0x5e87[_0x1695('0x46')],{})[_0x1695('0x3f')](respondWithResult(_0x2d9fa1,0xc9))[_0x1695('0x40')](handleError(_0x2d9fa1,null));};exports[_0x1695('0x21')]=function(_0x41d1d2,_0x563d9d){if(_0x41d1d2[_0x1695('0x46')]['id']){delete _0x41d1d2[_0x1695('0x46')]['id'];}return db[_0x1695('0x27')][_0x1695('0x44')]({'where':{'id':_0x41d1d2['params']['id']}})['then'](handleEntityNotFound(_0x563d9d,null))[_0x1695('0x3f')](saveUpdates(_0x41d1d2[_0x1695('0x46')],null))[_0x1695('0x3f')](respondWithResult(_0x563d9d,null))[_0x1695('0x40')](handleError(_0x563d9d,null));};exports['destroy']=function(_0x31a776,_0x43ec8c){return db[_0x1695('0x27')][_0x1695('0x44')]({'where':{'id':_0x31a776[_0x1695('0x42')]['id']}})['then'](handleEntityNotFound(_0x43ec8c,null))[_0x1695('0x3f')](removeEntity(_0x43ec8c,null))[_0x1695('0x40')](handleError(_0x43ec8c,null));};exports[_0x1695('0x47')]=function(_0x13f98e,_0x30241a,_0x1fbc35){var _0x4bdd8c={};var _0x2869eb={};var _0xed5f6e;var _0x2d34d8;return db['FreshdeskConfiguration'][_0x1695('0x48')]({'where':{'id':_0x13f98e[_0x1695('0x42')]['id']}})[_0x1695('0x3f')](handleEntityNotFound(_0x30241a,null))[_0x1695('0x3f')](function(_0x9a997e){if(_0x9a997e){_0xed5f6e=_0x9a997e;_0x2869eb['model']=_[_0x1695('0x2d')](db[_0x1695('0x49')][_0x1695('0x28')]);_0x2869eb[_0x1695('0x2c')]=_[_0x1695('0x2d')](_0x13f98e[_0x1695('0x2c')]);_0x2869eb[_0x1695('0x2e')]=_['intersection'](_0x2869eb[_0x1695('0x2b')],_0x2869eb['query']);_0x4bdd8c[_0x1695('0x2f')]=_[_0x1695('0x30')](_0x2869eb[_0x1695('0x2b')],qs[_0x1695('0x31')](_0x13f98e[_0x1695('0x2c')][_0x1695('0x31')]));_0x4bdd8c[_0x1695('0x2f')]=_0x4bdd8c['attributes'][_0x1695('0x32')]?_0x4bdd8c['attributes']:_0x2869eb[_0x1695('0x2b')];_0x4bdd8c['order']=qs[_0x1695('0x35')](_0x13f98e['query'][_0x1695('0x35')]);_0x4bdd8c[_0x1695('0x36')]=qs['filters'](_[_0x1695('0x37')](_0x13f98e[_0x1695('0x2c')],_0x2869eb[_0x1695('0x2e')]));if(_0x13f98e[_0x1695('0x2c')][_0x1695('0x3a')]){_0x4bdd8c[_0x1695('0x36')]=_[_0x1695('0x38')](_0x4bdd8c[_0x1695('0x36')],{'$or':_[_0x1695('0x26')](_0x4bdd8c[_0x1695('0x2f')],function(_0x1022ba){var _0x1f526b={};_0x1f526b[_0x1022ba]={'$like':'%'+_0x13f98e[_0x1695('0x2c')]['filter']+'%'};return _0x1f526b;})});}_0x4bdd8c=_[_0x1695('0x38')]({},_0x4bdd8c,_0x13f98e[_0x1695('0x43')]);return _0xed5f6e['getFields'](_0x4bdd8c);}})[_0x1695('0x3f')](function(_0x54f121){if(_0x54f121){_0x2d34d8=_0x54f121[_0x1695('0x32')];if(!_0x13f98e['query'][_0x1695('0x4a')](_0x1695('0x33'))){_0x4bdd8c[_0x1695('0x1a')]=qs[_0x1695('0x1a')](_0x13f98e[_0x1695('0x2c')][_0x1695('0x1a')]);_0x4bdd8c['offset']=qs[_0x1695('0x18')](_0x13f98e[_0x1695('0x2c')]['offset']);}return _0xed5f6e[_0x1695('0x47')](_0x4bdd8c);}})[_0x1695('0x3f')](function(_0xb0f337){if(_0xb0f337){return _0xb0f337?{'count':_0x2d34d8,'rows':_0xb0f337}:null;}})[_0x1695('0x3f')](respondWithResult(_0x30241a,null))[_0x1695('0x40')](handleError(_0x30241a,null));};exports[_0x1695('0x4b')]=function(_0x3c03d3,_0x196e67,_0x3f6f26){var _0x3d1314={};var _0xa90717={};var _0x49ae6b;var _0x353c83;return db[_0x1695('0x27')][_0x1695('0x48')]({'where':{'id':_0x3c03d3[_0x1695('0x42')]['id']}})[_0x1695('0x3f')](handleEntityNotFound(_0x196e67,null))[_0x1695('0x3f')](function(_0x395d88){if(_0x395d88){_0x49ae6b=_0x395d88;_0xa90717[_0x1695('0x2b')]=_[_0x1695('0x2d')](db[_0x1695('0x49')][_0x1695('0x28')]);_0xa90717[_0x1695('0x2c')]=_[_0x1695('0x2d')](_0x3c03d3['query']);_0xa90717[_0x1695('0x2e')]=_[_0x1695('0x30')](_0xa90717[_0x1695('0x2b')],_0xa90717[_0x1695('0x2c')]);_0x3d1314['attributes']=_[_0x1695('0x30')](_0xa90717[_0x1695('0x2b')],qs[_0x1695('0x31')](_0x3c03d3[_0x1695('0x2c')][_0x1695('0x31')]));_0x3d1314[_0x1695('0x2f')]=_0x3d1314[_0x1695('0x2f')][_0x1695('0x32')]?_0x3d1314['attributes']:_0xa90717['model'];_0x3d1314[_0x1695('0x34')]=qs[_0x1695('0x35')](_0x3c03d3[_0x1695('0x2c')][_0x1695('0x35')]);_0x3d1314[_0x1695('0x36')]=qs[_0x1695('0x2e')](_[_0x1695('0x37')](_0x3c03d3['query'],_0xa90717[_0x1695('0x2e')]));if(_0x3c03d3[_0x1695('0x2c')][_0x1695('0x3a')]){_0x3d1314[_0x1695('0x36')]=_[_0x1695('0x38')](_0x3d1314['where'],{'$or':_[_0x1695('0x26')](_0x3d1314[_0x1695('0x2f')],function(_0x14d357){var _0x2146eb={};_0x2146eb[_0x14d357]={'$like':'%'+_0x3c03d3[_0x1695('0x2c')][_0x1695('0x3a')]+'%'};return _0x2146eb;})});}_0x3d1314=_['merge']({},_0x3d1314,_0x3c03d3[_0x1695('0x43')]);return _0x49ae6b[_0x1695('0x4b')](_0x3d1314);}})[_0x1695('0x3f')](function(_0x3a3496){if(_0x3a3496){_0x353c83=_0x3a3496[_0x1695('0x32')];if(!_0x3c03d3[_0x1695('0x2c')][_0x1695('0x4a')](_0x1695('0x33'))){_0x3d1314[_0x1695('0x1a')]=qs['limit'](_0x3c03d3[_0x1695('0x2c')][_0x1695('0x1a')]);_0x3d1314[_0x1695('0x18')]=qs[_0x1695('0x18')](_0x3c03d3[_0x1695('0x2c')]['offset']);}return _0x49ae6b[_0x1695('0x4b')](_0x3d1314);}})[_0x1695('0x3f')](function(_0x35ab5c){if(_0x35ab5c){return _0x35ab5c?{'count':_0x353c83,'rows':_0x35ab5c}:null;}})[_0x1695('0x3f')](respondWithResult(_0x196e67,null))[_0x1695('0x40')](handleError(_0x196e67,null));};exports[_0x1695('0x4c')]=function(_0x5fc6dd,_0x13b80c,_0x25d45c){var _0x4fda04={};var _0x42663d={};var _0x17cb60;var _0x30d72a;return db[_0x1695('0x27')][_0x1695('0x48')]({'where':{'id':_0x5fc6dd['params']['id']}})[_0x1695('0x3f')](handleEntityNotFound(_0x13b80c,null))[_0x1695('0x3f')](function(_0x4670c1){if(_0x4670c1){_0x17cb60=_0x4670c1;_0x42663d[_0x1695('0x2b')]=_['keys'](db[_0x1695('0x49')]['rawAttributes']);_0x42663d['query']=_[_0x1695('0x2d')](_0x5fc6dd[_0x1695('0x2c')]);_0x42663d['filters']=_[_0x1695('0x30')](_0x42663d[_0x1695('0x2b')],_0x42663d[_0x1695('0x2c')]);_0x4fda04[_0x1695('0x2f')]=_[_0x1695('0x30')](_0x42663d[_0x1695('0x2b')],qs[_0x1695('0x31')](_0x5fc6dd[_0x1695('0x2c')][_0x1695('0x31')]));_0x4fda04[_0x1695('0x2f')]=_0x4fda04[_0x1695('0x2f')][_0x1695('0x32')]?_0x4fda04['attributes']:_0x42663d[_0x1695('0x2b')];_0x4fda04[_0x1695('0x34')]=qs[_0x1695('0x35')](_0x5fc6dd[_0x1695('0x2c')][_0x1695('0x35')]);_0x4fda04[_0x1695('0x36')]=qs[_0x1695('0x2e')](_[_0x1695('0x37')](_0x5fc6dd[_0x1695('0x2c')],_0x42663d[_0x1695('0x2e')]));if(_0x5fc6dd[_0x1695('0x2c')][_0x1695('0x3a')]){_0x4fda04[_0x1695('0x36')]=_['merge'](_0x4fda04[_0x1695('0x36')],{'$or':_[_0x1695('0x26')](_0x4fda04[_0x1695('0x2f')],function(_0x596e3c){var _0x4a9bd3={};_0x4a9bd3[_0x596e3c]={'$like':'%'+_0x5fc6dd[_0x1695('0x2c')]['filter']+'%'};return _0x4a9bd3;})});}_0x4fda04=_[_0x1695('0x38')]({},_0x4fda04,_0x5fc6dd[_0x1695('0x43')]);return _0x17cb60[_0x1695('0x4c')](_0x4fda04);}})[_0x1695('0x3f')](function(_0x3e9a2e){if(_0x3e9a2e){_0x30d72a=_0x3e9a2e[_0x1695('0x32')];if(!_0x5fc6dd[_0x1695('0x2c')][_0x1695('0x4a')]('nolimit')){_0x4fda04[_0x1695('0x1a')]=qs['limit'](_0x5fc6dd[_0x1695('0x2c')]['limit']);_0x4fda04[_0x1695('0x18')]=qs['offset'](_0x5fc6dd[_0x1695('0x2c')][_0x1695('0x18')]);}return _0x17cb60[_0x1695('0x4c')](_0x4fda04);}})[_0x1695('0x3f')](function(_0x14e41e){if(_0x14e41e){return _0x14e41e?{'count':_0x30d72a,'rows':_0x14e41e}:null;}})[_0x1695('0x3f')](respondWithResult(_0x13b80c,null))[_0x1695('0x40')](handleError(_0x13b80c,null));};exports['getTags']=function(_0x533043,_0x130821,_0x5acc01){var _0x543556={};var _0x1fb545={};var _0x618769;var _0x15b3ec;return db[_0x1695('0x27')][_0x1695('0x48')]({'where':{'id':_0x533043[_0x1695('0x42')]['id']}})[_0x1695('0x3f')](handleEntityNotFound(_0x130821,null))[_0x1695('0x3f')](function(_0x223278){if(_0x223278){_0x618769=_0x223278;_0x1fb545[_0x1695('0x2b')]=_[_0x1695('0x2d')](db[_0x1695('0x4d')]['rawAttributes']);_0x1fb545[_0x1695('0x2c')]=_[_0x1695('0x2d')](_0x533043[_0x1695('0x2c')]);_0x1fb545['filters']=_['intersection'](_0x1fb545[_0x1695('0x2b')],_0x1fb545[_0x1695('0x2c')]);_0x543556[_0x1695('0x2f')]=_['intersection'](_0x1fb545[_0x1695('0x2b')],qs[_0x1695('0x31')](_0x533043[_0x1695('0x2c')]['fields']));_0x543556[_0x1695('0x2f')]=_0x543556['attributes'][_0x1695('0x32')]?_0x543556[_0x1695('0x2f')]:_0x1fb545[_0x1695('0x2b')];_0x543556[_0x1695('0x34')]=qs[_0x1695('0x35')](_0x533043['query'][_0x1695('0x35')]);_0x543556[_0x1695('0x36')]=qs['filters'](_['pick'](_0x533043[_0x1695('0x2c')],_0x1fb545[_0x1695('0x2e')]));if(_0x533043[_0x1695('0x2c')][_0x1695('0x3a')]){_0x543556[_0x1695('0x36')]=_[_0x1695('0x38')](_0x543556[_0x1695('0x36')],{'$or':_['map'](_0x543556['attributes'],function(_0xa3a9ea){var _0x4fc96e={};_0x4fc96e[_0xa3a9ea]={'$like':'%'+_0x533043[_0x1695('0x2c')][_0x1695('0x3a')]+'%'};return _0x4fc96e;})});}_0x543556=_[_0x1695('0x38')]({},_0x543556,_0x533043[_0x1695('0x43')]);return _0x618769[_0x1695('0x4e')](_0x543556);}})['then'](function(_0x147618){if(_0x147618){_0x15b3ec=_0x147618[_0x1695('0x32')];if(!_0x533043[_0x1695('0x2c')]['hasOwnProperty'](_0x1695('0x33'))){_0x543556[_0x1695('0x1a')]=qs[_0x1695('0x1a')](_0x533043[_0x1695('0x2c')][_0x1695('0x1a')]);_0x543556[_0x1695('0x18')]=qs[_0x1695('0x18')](_0x533043['query'][_0x1695('0x18')]);}return _0x618769[_0x1695('0x4e')](_0x543556);}})[_0x1695('0x3f')](function(_0x44a385){if(_0x44a385){return _0x44a385?{'count':_0x15b3ec,'rows':_0x44a385}:null;}})[_0x1695('0x3f')](respondWithResult(_0x130821,null))[_0x1695('0x40')](handleError(_0x130821,null));};exports[_0x1695('0x4f')]=function(_0x494b78,_0x7119c6,_0x1996b7){if(_0x494b78[_0x1695('0x46')]['id']){delete _0x494b78['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x494b78[_0x1695('0x42')]['id']}})[_0x1695('0x3f')](handleEntityNotFound(_0x7119c6,null))[_0x1695('0x3f')](function(_0x50bfba){if(_0x50bfba){return _0x50bfba[_0x1695('0x4f')](_0x494b78[_0x1695('0x46')]['ids']||[]);}return null;})[_0x1695('0x3f')](respondWithResult(_0x7119c6,null))['catch'](handleError(_0x7119c6,null));}; \ No newline at end of file +var _0xb127=['limit','offset','count','apply','reject','save','update','then','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','keys','find','catch','create','body','destroy','findOne','FreshdeskField','getFields','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x1cd61f,_0x22e7af){var _0x27cee9=function(_0x5e122b){while(--_0x5e122b){_0x1cd61f['push'](_0x1cd61f['shift']());}};_0x27cee9(++_0x22e7af);}(_0xb127,0x8b));var _0x7b12=function(_0x2b017e,_0x380bfa){_0x2b017e=_0x2b017e-0x0;var _0x50136c=_0xb127[_0x2b017e];return _0x50136c;};'use strict';var emlformat=require(_0x7b12('0x0'));var rimraf=require(_0x7b12('0x1'));var zipdir=require(_0x7b12('0x2'));var jsonpatch=require(_0x7b12('0x3'));var rp=require(_0x7b12('0x4'));var moment=require(_0x7b12('0x5'));var BPromise=require(_0x7b12('0x6'));var Mustache=require(_0x7b12('0x7'));var util=require(_0x7b12('0x8'));var path=require(_0x7b12('0x9'));var sox=require(_0x7b12('0xa'));var csv=require(_0x7b12('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b12('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7b12('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7b12('0xe'));var toCsv=require(_0x7b12('0xb'));var querystring=require('querystring');var Papa=require(_0x7b12('0xf'));var Redis=require(_0x7b12('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7b12('0x11'));var as=require(_0x7b12('0x12'));var hardwareService=require(_0x7b12('0x13'));var logger=require('../../config/logger')(_0x7b12('0x14'));var utils=require(_0x7b12('0x15'));var config=require(_0x7b12('0x16'));var licenseUtil=require(_0x7b12('0x17'));var db=require(_0x7b12('0x18'))['db'];function respondWithStatusCode(_0x23e64e,_0x4f4d0c){_0x4f4d0c=_0x4f4d0c||0xcc;return function(_0x49d351){if(_0x49d351){return _0x23e64e['sendStatus'](_0x4f4d0c);}return _0x23e64e[_0x7b12('0x19')](_0x4f4d0c)[_0x7b12('0x1a')]();};}function respondWithResult(_0x4c334d,_0x5173a3){_0x5173a3=_0x5173a3||0xc8;return function(_0x55985b){if(_0x55985b){return _0x4c334d[_0x7b12('0x19')](_0x5173a3)[_0x7b12('0x1b')](_0x55985b);}};}function respondWithFilteredResult(_0x4ae0c2,_0x5a8cff){return function(_0x20b8f6){if(_0x20b8f6){var _0x39cb2e=typeof _0x5a8cff['offset']===_0x7b12('0x1c')&&typeof _0x5a8cff[_0x7b12('0x1d')]===_0x7b12('0x1c');var _0x4ba3e6=_0x20b8f6['count'];var _0x3f4a63=_0x39cb2e?0x0:_0x5a8cff[_0x7b12('0x1e')];var _0x3f0c45=_0x39cb2e?_0x20b8f6[_0x7b12('0x1f')]:_0x5a8cff[_0x7b12('0x1e')]+_0x5a8cff['limit'];var _0x5b52ba;if(_0x3f0c45>=_0x4ba3e6){_0x3f0c45=_0x4ba3e6;_0x5b52ba=0xc8;}else{_0x5b52ba=0xce;}_0x4ae0c2[_0x7b12('0x19')](_0x5b52ba);return _0x4ae0c2['set']('Content-Range',_0x3f4a63+'-'+_0x3f0c45+'/'+_0x4ba3e6)[_0x7b12('0x1b')](_0x20b8f6);}return null;};}function patchUpdates(_0x2caf2c){return function(_0xdd99e7){try{jsonpatch[_0x7b12('0x20')](_0xdd99e7,_0x2caf2c,!![]);}catch(_0x449d80){return BPromise[_0x7b12('0x21')](_0x449d80);}return _0xdd99e7[_0x7b12('0x22')]();};}function saveUpdates(_0x237728,_0x30c82e){return function(_0xe504c){if(_0xe504c){return _0xe504c[_0x7b12('0x23')](_0x237728)[_0x7b12('0x24')](function(_0x918a58){return _0x918a58;});}return null;};}function removeEntity(_0x536af4,_0x671e6e){return function(_0x2c8d15){if(_0x2c8d15){return _0x2c8d15['destroy']()[_0x7b12('0x24')](function(){_0x536af4[_0x7b12('0x19')](0xcc)[_0x7b12('0x1a')]();});}};}function handleEntityNotFound(_0x21f7a8,_0x3cd960){return function(_0x518c23){if(!_0x518c23){_0x21f7a8['sendStatus'](0x194);}return _0x518c23;};}function handleError(_0x11767d,_0x28dc38){_0x28dc38=_0x28dc38||0x1f4;return function(_0xff5275){logger[_0x7b12('0x25')](_0xff5275[_0x7b12('0x26')]);if(_0xff5275[_0x7b12('0x27')]){delete _0xff5275[_0x7b12('0x27')];}_0x11767d[_0x7b12('0x19')](_0x28dc38)[_0x7b12('0x28')](_0xff5275);};}exports[_0x7b12('0x29')]=function(_0x364ef3,_0x2efb9e){var _0x4bc501={},_0x1b8322={},_0x5bd9e9={'count':0x0,'rows':[]};var _0x3a50c0=_['map'](db[_0x7b12('0x2a')][_0x7b12('0x2b')],function(_0x194b96){return{'name':_0x194b96[_0x7b12('0x2c')],'type':_0x194b96['type'][_0x7b12('0x2d')]};});_0x1b8322[_0x7b12('0x2e')]=_[_0x7b12('0x2f')](_0x3a50c0,'name');_0x1b8322[_0x7b12('0x30')]=_['keys'](_0x364ef3['query']);_0x1b8322[_0x7b12('0x31')]=_[_0x7b12('0x32')](_0x1b8322[_0x7b12('0x2e')],_0x1b8322[_0x7b12('0x30')]);_0x4bc501[_0x7b12('0x33')]=_['intersection'](_0x1b8322[_0x7b12('0x2e')],qs[_0x7b12('0x34')](_0x364ef3[_0x7b12('0x30')][_0x7b12('0x34')]));_0x4bc501[_0x7b12('0x33')]=_0x4bc501[_0x7b12('0x33')][_0x7b12('0x35')]?_0x4bc501[_0x7b12('0x33')]:_0x1b8322['model'];if(!_0x364ef3[_0x7b12('0x30')][_0x7b12('0x36')]('nolimit')){_0x4bc501[_0x7b12('0x1d')]=qs[_0x7b12('0x1d')](_0x364ef3[_0x7b12('0x30')][_0x7b12('0x1d')]);_0x4bc501[_0x7b12('0x1e')]=qs[_0x7b12('0x1e')](_0x364ef3[_0x7b12('0x30')][_0x7b12('0x1e')]);}_0x4bc501[_0x7b12('0x37')]=qs[_0x7b12('0x38')](_0x364ef3[_0x7b12('0x30')]['sort']);_0x4bc501[_0x7b12('0x39')]=qs['filters'](_[_0x7b12('0x3a')](_0x364ef3[_0x7b12('0x30')],_0x1b8322[_0x7b12('0x31')]),_0x3a50c0);if(_0x364ef3['query']['filter']){_0x4bc501[_0x7b12('0x39')]=_[_0x7b12('0x3b')](_0x4bc501['where'],{'$or':_[_0x7b12('0x2f')](_0x3a50c0,function(_0x5693e1){if(_0x5693e1[_0x7b12('0x3c')]!==_0x7b12('0x3d')){var _0x3bb488={};_0x3bb488[_0x5693e1[_0x7b12('0x27')]]={'$like':'%'+_0x364ef3[_0x7b12('0x30')][_0x7b12('0x3e')]+'%'};return _0x3bb488;}})});}_0x4bc501=_['merge']({},_0x4bc501,_0x364ef3[_0x7b12('0x3f')]);var _0x4679ce={'where':_0x4bc501['where']};return db[_0x7b12('0x2a')][_0x7b12('0x1f')](_0x4679ce)[_0x7b12('0x24')](function(_0x4956cd){_0x5bd9e9[_0x7b12('0x1f')]=_0x4956cd;if(_0x364ef3[_0x7b12('0x30')][_0x7b12('0x40')]){_0x4bc501[_0x7b12('0x41')]=[{'all':!![]}];}return db[_0x7b12('0x2a')]['findAll'](_0x4bc501);})[_0x7b12('0x24')](function(_0x148033){_0x5bd9e9[_0x7b12('0x42')]=_0x148033;return _0x5bd9e9;})[_0x7b12('0x24')](respondWithFilteredResult(_0x2efb9e,_0x4bc501))['catch'](handleError(_0x2efb9e,null));};exports[_0x7b12('0x43')]=function(_0x61ea47,_0x7d468b){var _0x35ec70={'raw':![],'where':{'id':_0x61ea47[_0x7b12('0x44')]['id']}},_0xbff13d={};_0xbff13d[_0x7b12('0x2e')]=_[_0x7b12('0x45')](db[_0x7b12('0x2a')][_0x7b12('0x2b')]);_0xbff13d[_0x7b12('0x30')]=_['keys'](_0x61ea47[_0x7b12('0x30')]);_0xbff13d[_0x7b12('0x31')]=_[_0x7b12('0x32')](_0xbff13d['model'],_0xbff13d['query']);_0x35ec70[_0x7b12('0x33')]=_[_0x7b12('0x32')](_0xbff13d[_0x7b12('0x2e')],qs[_0x7b12('0x34')](_0x61ea47[_0x7b12('0x30')][_0x7b12('0x34')]));_0x35ec70[_0x7b12('0x33')]=_0x35ec70['attributes'][_0x7b12('0x35')]?_0x35ec70['attributes']:_0xbff13d[_0x7b12('0x2e')];if(_0x61ea47[_0x7b12('0x30')][_0x7b12('0x40')]){_0x35ec70[_0x7b12('0x41')]=[{'all':!![]}];}_0x35ec70=_[_0x7b12('0x3b')]({},_0x35ec70,_0x61ea47['options']);return db[_0x7b12('0x2a')][_0x7b12('0x46')](_0x35ec70)[_0x7b12('0x24')](handleEntityNotFound(_0x7d468b,null))[_0x7b12('0x24')](respondWithResult(_0x7d468b,null))[_0x7b12('0x47')](handleError(_0x7d468b,null));};exports[_0x7b12('0x48')]=function(_0x2be055,_0x153808){return db[_0x7b12('0x2a')][_0x7b12('0x48')](_0x2be055[_0x7b12('0x49')],{})['then'](respondWithResult(_0x153808,0xc9))[_0x7b12('0x47')](handleError(_0x153808,null));};exports['update']=function(_0x480126,_0x5cb5b3){if(_0x480126[_0x7b12('0x49')]['id']){delete _0x480126[_0x7b12('0x49')]['id'];}return db[_0x7b12('0x2a')][_0x7b12('0x46')]({'where':{'id':_0x480126[_0x7b12('0x44')]['id']}})[_0x7b12('0x24')](handleEntityNotFound(_0x5cb5b3,null))[_0x7b12('0x24')](saveUpdates(_0x480126[_0x7b12('0x49')],null))[_0x7b12('0x24')](respondWithResult(_0x5cb5b3,null))[_0x7b12('0x47')](handleError(_0x5cb5b3,null));};exports[_0x7b12('0x4a')]=function(_0x335c82,_0x3bcb77){return db[_0x7b12('0x2a')][_0x7b12('0x46')]({'where':{'id':_0x335c82[_0x7b12('0x44')]['id']}})[_0x7b12('0x24')](handleEntityNotFound(_0x3bcb77,null))[_0x7b12('0x24')](removeEntity(_0x3bcb77,null))['catch'](handleError(_0x3bcb77,null));};exports['getFields']=function(_0x42f5f8,_0x3c5208,_0x1d1d37){var _0xe7a070={};var _0xa041f8={};var _0x20dd3f;var _0x41eeec;return db['FreshdeskConfiguration'][_0x7b12('0x4b')]({'where':{'id':_0x42f5f8[_0x7b12('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c5208,null))[_0x7b12('0x24')](function(_0x183598){if(_0x183598){_0x20dd3f=_0x183598;_0xa041f8['model']=_['keys'](db[_0x7b12('0x4c')]['rawAttributes']);_0xa041f8['query']=_[_0x7b12('0x45')](_0x42f5f8[_0x7b12('0x30')]);_0xa041f8[_0x7b12('0x31')]=_[_0x7b12('0x32')](_0xa041f8['model'],_0xa041f8[_0x7b12('0x30')]);_0xe7a070[_0x7b12('0x33')]=_['intersection'](_0xa041f8[_0x7b12('0x2e')],qs[_0x7b12('0x34')](_0x42f5f8[_0x7b12('0x30')][_0x7b12('0x34')]));_0xe7a070['attributes']=_0xe7a070[_0x7b12('0x33')]['length']?_0xe7a070[_0x7b12('0x33')]:_0xa041f8['model'];_0xe7a070[_0x7b12('0x37')]=qs[_0x7b12('0x38')](_0x42f5f8[_0x7b12('0x30')][_0x7b12('0x38')]);_0xe7a070[_0x7b12('0x39')]=qs[_0x7b12('0x31')](_[_0x7b12('0x3a')](_0x42f5f8[_0x7b12('0x30')],_0xa041f8[_0x7b12('0x31')]));if(_0x42f5f8[_0x7b12('0x30')][_0x7b12('0x3e')]){_0xe7a070[_0x7b12('0x39')]=_[_0x7b12('0x3b')](_0xe7a070['where'],{'$or':_[_0x7b12('0x2f')](_0xe7a070['attributes'],function(_0x227646){var _0x3b67e6={};_0x3b67e6[_0x227646]={'$like':'%'+_0x42f5f8[_0x7b12('0x30')][_0x7b12('0x3e')]+'%'};return _0x3b67e6;})});}_0xe7a070=_[_0x7b12('0x3b')]({},_0xe7a070,_0x42f5f8[_0x7b12('0x3f')]);return _0x20dd3f[_0x7b12('0x4d')](_0xe7a070);}})[_0x7b12('0x24')](function(_0x569346){if(_0x569346){_0x41eeec=_0x569346[_0x7b12('0x35')];if(!_0x42f5f8[_0x7b12('0x30')]['hasOwnProperty'](_0x7b12('0x4e'))){_0xe7a070[_0x7b12('0x1d')]=qs['limit'](_0x42f5f8[_0x7b12('0x30')]['limit']);_0xe7a070[_0x7b12('0x1e')]=qs[_0x7b12('0x1e')](_0x42f5f8[_0x7b12('0x30')]['offset']);}return _0x20dd3f[_0x7b12('0x4d')](_0xe7a070);}})[_0x7b12('0x24')](function(_0x4368a1){if(_0x4368a1){return _0x4368a1?{'count':_0x41eeec,'rows':_0x4368a1}:null;}})[_0x7b12('0x24')](respondWithResult(_0x3c5208,null))['catch'](handleError(_0x3c5208,null));};exports[_0x7b12('0x4f')]=function(_0x57f104,_0x4f6deb,_0x12eca7){var _0x1994ea={};var _0x519ff0={};var _0x9f722;var _0x201658;return db[_0x7b12('0x2a')]['findOne']({'where':{'id':_0x57f104['params']['id']}})[_0x7b12('0x24')](handleEntityNotFound(_0x4f6deb,null))[_0x7b12('0x24')](function(_0x4ad573){if(_0x4ad573){_0x9f722=_0x4ad573;_0x519ff0[_0x7b12('0x2e')]=_[_0x7b12('0x45')](db[_0x7b12('0x4c')]['rawAttributes']);_0x519ff0[_0x7b12('0x30')]=_['keys'](_0x57f104[_0x7b12('0x30')]);_0x519ff0[_0x7b12('0x31')]=_[_0x7b12('0x32')](_0x519ff0['model'],_0x519ff0[_0x7b12('0x30')]);_0x1994ea['attributes']=_[_0x7b12('0x32')](_0x519ff0[_0x7b12('0x2e')],qs[_0x7b12('0x34')](_0x57f104[_0x7b12('0x30')][_0x7b12('0x34')]));_0x1994ea[_0x7b12('0x33')]=_0x1994ea[_0x7b12('0x33')][_0x7b12('0x35')]?_0x1994ea['attributes']:_0x519ff0['model'];_0x1994ea['order']=qs['sort'](_0x57f104[_0x7b12('0x30')][_0x7b12('0x38')]);_0x1994ea[_0x7b12('0x39')]=qs[_0x7b12('0x31')](_[_0x7b12('0x3a')](_0x57f104['query'],_0x519ff0[_0x7b12('0x31')]));if(_0x57f104[_0x7b12('0x30')][_0x7b12('0x3e')]){_0x1994ea[_0x7b12('0x39')]=_['merge'](_0x1994ea['where'],{'$or':_[_0x7b12('0x2f')](_0x1994ea['attributes'],function(_0x4d1076){var _0x4bcbb4={};_0x4bcbb4[_0x4d1076]={'$like':'%'+_0x57f104[_0x7b12('0x30')][_0x7b12('0x3e')]+'%'};return _0x4bcbb4;})});}_0x1994ea=_[_0x7b12('0x3b')]({},_0x1994ea,_0x57f104['options']);return _0x9f722['getSubjects'](_0x1994ea);}})[_0x7b12('0x24')](function(_0xdf4be0){if(_0xdf4be0){_0x201658=_0xdf4be0['length'];if(!_0x57f104[_0x7b12('0x30')][_0x7b12('0x36')](_0x7b12('0x4e'))){_0x1994ea[_0x7b12('0x1d')]=qs[_0x7b12('0x1d')](_0x57f104[_0x7b12('0x30')]['limit']);_0x1994ea['offset']=qs['offset'](_0x57f104[_0x7b12('0x30')][_0x7b12('0x1e')]);}return _0x9f722[_0x7b12('0x4f')](_0x1994ea);}})[_0x7b12('0x24')](function(_0x422270){if(_0x422270){return _0x422270?{'count':_0x201658,'rows':_0x422270}:null;}})[_0x7b12('0x24')](respondWithResult(_0x4f6deb,null))[_0x7b12('0x47')](handleError(_0x4f6deb,null));};exports['getDescriptions']=function(_0xa0907c,_0x40302f,_0x5e7e9a){var _0x5872fa={};var _0x313672={};var _0x5b554b;var _0x143a41;return db['FreshdeskConfiguration'][_0x7b12('0x4b')]({'where':{'id':_0xa0907c[_0x7b12('0x44')]['id']}})[_0x7b12('0x24')](handleEntityNotFound(_0x40302f,null))[_0x7b12('0x24')](function(_0x4e83fd){if(_0x4e83fd){_0x5b554b=_0x4e83fd;_0x313672[_0x7b12('0x2e')]=_['keys'](db[_0x7b12('0x4c')][_0x7b12('0x2b')]);_0x313672[_0x7b12('0x30')]=_[_0x7b12('0x45')](_0xa0907c['query']);_0x313672[_0x7b12('0x31')]=_[_0x7b12('0x32')](_0x313672[_0x7b12('0x2e')],_0x313672[_0x7b12('0x30')]);_0x5872fa[_0x7b12('0x33')]=_[_0x7b12('0x32')](_0x313672[_0x7b12('0x2e')],qs[_0x7b12('0x34')](_0xa0907c[_0x7b12('0x30')]['fields']));_0x5872fa[_0x7b12('0x33')]=_0x5872fa[_0x7b12('0x33')]['length']?_0x5872fa[_0x7b12('0x33')]:_0x313672[_0x7b12('0x2e')];_0x5872fa[_0x7b12('0x37')]=qs[_0x7b12('0x38')](_0xa0907c[_0x7b12('0x30')]['sort']);_0x5872fa['where']=qs[_0x7b12('0x31')](_[_0x7b12('0x3a')](_0xa0907c['query'],_0x313672[_0x7b12('0x31')]));if(_0xa0907c['query'][_0x7b12('0x3e')]){_0x5872fa[_0x7b12('0x39')]=_['merge'](_0x5872fa[_0x7b12('0x39')],{'$or':_['map'](_0x5872fa['attributes'],function(_0x204d73){var _0x19e99b={};_0x19e99b[_0x204d73]={'$like':'%'+_0xa0907c[_0x7b12('0x30')][_0x7b12('0x3e')]+'%'};return _0x19e99b;})});}_0x5872fa=_['merge']({},_0x5872fa,_0xa0907c[_0x7b12('0x3f')]);return _0x5b554b['getDescriptions'](_0x5872fa);}})[_0x7b12('0x24')](function(_0x4c582d){if(_0x4c582d){_0x143a41=_0x4c582d['length'];if(!_0xa0907c[_0x7b12('0x30')][_0x7b12('0x36')]('nolimit')){_0x5872fa[_0x7b12('0x1d')]=qs[_0x7b12('0x1d')](_0xa0907c[_0x7b12('0x30')][_0x7b12('0x1d')]);_0x5872fa[_0x7b12('0x1e')]=qs[_0x7b12('0x1e')](_0xa0907c[_0x7b12('0x30')]['offset']);}return _0x5b554b[_0x7b12('0x50')](_0x5872fa);}})[_0x7b12('0x24')](function(_0x45da3d){if(_0x45da3d){return _0x45da3d?{'count':_0x143a41,'rows':_0x45da3d}:null;}})[_0x7b12('0x24')](respondWithResult(_0x40302f,null))[_0x7b12('0x47')](handleError(_0x40302f,null));};exports[_0x7b12('0x51')]=function(_0x1094c7,_0x2a9835,_0x41f228){var _0x2082c8={};var _0x50da11={};var _0x33015f;var _0x39d2cf;return db[_0x7b12('0x2a')][_0x7b12('0x4b')]({'where':{'id':_0x1094c7['params']['id']}})[_0x7b12('0x24')](handleEntityNotFound(_0x2a9835,null))['then'](function(_0x73fe3e){if(_0x73fe3e){_0x33015f=_0x73fe3e;_0x50da11[_0x7b12('0x2e')]=_[_0x7b12('0x45')](db[_0x7b12('0x52')][_0x7b12('0x2b')]);_0x50da11[_0x7b12('0x30')]=_[_0x7b12('0x45')](_0x1094c7[_0x7b12('0x30')]);_0x50da11[_0x7b12('0x31')]=_['intersection'](_0x50da11[_0x7b12('0x2e')],_0x50da11[_0x7b12('0x30')]);_0x2082c8[_0x7b12('0x33')]=_[_0x7b12('0x32')](_0x50da11['model'],qs['fields'](_0x1094c7[_0x7b12('0x30')][_0x7b12('0x34')]));_0x2082c8[_0x7b12('0x33')]=_0x2082c8['attributes'][_0x7b12('0x35')]?_0x2082c8[_0x7b12('0x33')]:_0x50da11[_0x7b12('0x2e')];_0x2082c8[_0x7b12('0x37')]=qs[_0x7b12('0x38')](_0x1094c7[_0x7b12('0x30')][_0x7b12('0x38')]);_0x2082c8['where']=qs['filters'](_[_0x7b12('0x3a')](_0x1094c7[_0x7b12('0x30')],_0x50da11['filters']));if(_0x1094c7[_0x7b12('0x30')]['filter']){_0x2082c8[_0x7b12('0x39')]=_[_0x7b12('0x3b')](_0x2082c8[_0x7b12('0x39')],{'$or':_[_0x7b12('0x2f')](_0x2082c8[_0x7b12('0x33')],function(_0x104ea3){var _0x5ac7a5={};_0x5ac7a5[_0x104ea3]={'$like':'%'+_0x1094c7['query'][_0x7b12('0x3e')]+'%'};return _0x5ac7a5;})});}_0x2082c8=_[_0x7b12('0x3b')]({},_0x2082c8,_0x1094c7[_0x7b12('0x3f')]);return _0x33015f[_0x7b12('0x51')](_0x2082c8);}})['then'](function(_0x27ee9e){if(_0x27ee9e){_0x39d2cf=_0x27ee9e[_0x7b12('0x35')];if(!_0x1094c7['query'][_0x7b12('0x36')]('nolimit')){_0x2082c8[_0x7b12('0x1d')]=qs[_0x7b12('0x1d')](_0x1094c7['query'][_0x7b12('0x1d')]);_0x2082c8[_0x7b12('0x1e')]=qs['offset'](_0x1094c7[_0x7b12('0x30')][_0x7b12('0x1e')]);}return _0x33015f[_0x7b12('0x51')](_0x2082c8);}})['then'](function(_0x34cd88){if(_0x34cd88){return _0x34cd88?{'count':_0x39d2cf,'rows':_0x34cd88}:null;}})[_0x7b12('0x24')](respondWithResult(_0x2a9835,null))['catch'](handleError(_0x2a9835,null));};exports[_0x7b12('0x53')]=function(_0x53b34f,_0x3a3446,_0x2baa26){if(_0x53b34f['body']['id']){delete _0x53b34f[_0x7b12('0x49')]['id'];}return db[_0x7b12('0x2a')][_0x7b12('0x4b')]({'where':{'id':_0x53b34f[_0x7b12('0x44')]['id']}})['then'](handleEntityNotFound(_0x3a3446,null))[_0x7b12('0x24')](function(_0x94a1b1){if(_0x94a1b1){return _0x94a1b1[_0x7b12('0x53')](_0x53b34f[_0x7b12('0x49')]['ids']||[]);}return null;})[_0x7b12('0x24')](respondWithResult(_0x3a3446,null))[_0x7b12('0x47')](handleError(_0x3a3446,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f26e529..bbc4bdb 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 _0xffb3=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xffb3,0xa7));var _0x3ffb=function(_0xbf734e,_0x563ffc){_0xbf734e=_0xbf734e-0x0;var _0x25d851=_0xffb3[_0xbf734e];return _0x25d851;};'use strict';var _=require('lodash');var util=require(_0x3ffb('0x0'));var logger=require(_0x3ffb('0x1'))(_0x3ffb('0x2'));var moment=require(_0x3ffb('0x3'));var BPromise=require(_0x3ffb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3ffb('0x5'));var config=require(_0x3ffb('0x6'));var attributes=require(_0x3ffb('0x7'));module[_0x3ffb('0x8')]=function(_0x4cc2ac,_0x1edd77){return _0x4cc2ac[_0x3ffb('0x9')](_0x3ffb('0xa'),attributes,{'tableName':_0x3ffb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcde9=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xcde9,0xe9));var _0x9cde=function(_0x2ae1cc,_0x86bd86){_0x2ae1cc=_0x2ae1cc-0x0;var _0x4743d4=_0xcde9[_0x2ae1cc];return _0x4743d4;};'use strict';var _=require(_0x9cde('0x0'));var util=require(_0x9cde('0x1'));var logger=require(_0x9cde('0x2'))(_0x9cde('0x3'));var moment=require(_0x9cde('0x4'));var BPromise=require(_0x9cde('0x5'));var rp=require(_0x9cde('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cde('0x7'));var config=require(_0x9cde('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x9cde('0x9')]=function(_0x3c26c7,_0x50eb72){return _0x3c26c7[_0x9cde('0xa')](_0x9cde('0xb'),attributes,{'tableName':_0x9cde('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 dd2d000..4198a31 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 _0x6518=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6518,0x166));var _0x8651=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6518[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x8651('0x0'));var util=require(_0x8651('0x1'));var moment=require(_0x8651('0x2'));var BPromise=require(_0x8651('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8651('0x4'));var db=require(_0x8651('0x5'))['db'];var utils=require(_0x8651('0x6'));var logger=require(_0x8651('0x7'))(_0x8651('0x8'));var config=require(_0x8651('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8651('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57f428,_0x1f4f9e,_0x245b01){return new BPromise(function(_0x234479,_0xfd47e7){return client[_0x8651('0xb')](_0x57f428,_0x245b01)[_0x8651('0xc')](function(_0x5bc09f){logger[_0x8651('0xd')](_0x8651('0xe'),_0x1f4f9e,_0x8651('0xf'));logger[_0x8651('0x10')](_0x8651('0x11'),_0x1f4f9e,_0x8651('0xf'),JSON[_0x8651('0x12')](_0x5bc09f));if(_0x5bc09f[_0x8651('0x13')]){if(_0x5bc09f['error'][_0x8651('0x14')]===0x1f4){logger[_0x8651('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1f4f9e,_0x5bc09f[_0x8651('0x13')]['message']);return _0xfd47e7(_0x5bc09f[_0x8651('0x13')][_0x8651('0x15')]);}logger['error'](_0x8651('0xe'),_0x1f4f9e,_0x5bc09f[_0x8651('0x13')][_0x8651('0x15')]);return _0x234479(_0x5bc09f['error']['message']);}else{logger['info'](_0x8651('0xe'),_0x1f4f9e,_0x8651('0xf'));_0x234479(_0x5bc09f[_0x8651('0x16')][_0x8651('0x15')]);}})[_0x8651('0x17')](function(_0x562ef2){logger[_0x8651('0x13')](_0x8651('0xe'),_0x1f4f9e,_0x562ef2);_0xfd47e7(_0x562ef2);});});} \ No newline at end of file +var _0xc320=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0xb5850e,_0x3ece61){var _0x2372db=function(_0x1578d8){while(--_0x1578d8){_0xb5850e['push'](_0xb5850e['shift']());}};_0x2372db(++_0x3ece61);}(_0xc320,0xdd));var _0x0c32=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc320[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x0c32('0x0'));var util=require(_0x0c32('0x1'));var moment=require(_0x0c32('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c32('0x3'));var fs=require('fs');var Redis=require(_0x0c32('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c32('0x5'));var logger=require('../../config/logger')(_0x0c32('0x6'));var config=require(_0x0c32('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0c32('0x8')][_0x0c32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x569dc7,_0x455319,_0x4cbaf3){return new BPromise(function(_0x4d3f4a,_0x517b3e){return client[_0x0c32('0xa')](_0x569dc7,_0x4cbaf3)[_0x0c32('0xb')](function(_0x2deb57){logger[_0x0c32('0xc')](_0x0c32('0xd'),_0x455319,'request\x20sent');logger[_0x0c32('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x455319,_0x0c32('0xf'),JSON['stringify'](_0x2deb57));if(_0x2deb57[_0x0c32('0x10')]){if(_0x2deb57[_0x0c32('0x10')][_0x0c32('0x11')]===0x1f4){logger[_0x0c32('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x455319,_0x2deb57[_0x0c32('0x10')][_0x0c32('0x12')]);return _0x517b3e(_0x2deb57['error']['message']);}logger[_0x0c32('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x455319,_0x2deb57['error']['message']);return _0x4d3f4a(_0x2deb57[_0x0c32('0x10')]['message']);}else{logger[_0x0c32('0xc')](_0x0c32('0xd'),_0x455319,_0x0c32('0xf'));_0x4d3f4a(_0x2deb57['result'][_0x0c32('0x12')]);}})[_0x0c32('0x13')](function(_0x50661c){logger[_0x0c32('0x10')](_0x0c32('0xd'),_0x455319,_0x50661c);_0x517b3e(_0x50661c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 795ba7b..4b11ac0 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 _0x2182=['isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x183bb1,_0x3b4b14){var _0x789f30=function(_0xa06a9b){while(--_0xa06a9b){_0x183bb1['push'](_0x183bb1['shift']());}};_0x789f30(++_0x3b4b14);}(_0x2182,0xec));var _0x2218=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2182[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x2218('0x0'));var util=require(_0x2218('0x1'));var path=require(_0x2218('0x2'));var timeout=require(_0x2218('0x3'));var express=require('express');var router=express[_0x2218('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2218('0x5'));var interaction=require(_0x2218('0x6'));var config=require(_0x2218('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x2218('0x8')]('/',auth['isAuthenticated'](),controller[_0x2218('0x9')]);router[_0x2218('0x8')](_0x2218('0xa'),auth[_0x2218('0xb')](),controller[_0x2218('0xc')]);router[_0x2218('0xd')]('/',auth['isAuthenticated'](),controller[_0x2218('0xe')]);router['put']('/:id',auth[_0x2218('0xb')](),controller[_0x2218('0xf')]);router[_0x2218('0x10')]('/:id',auth[_0x2218('0xb')](),controller[_0x2218('0x11')]);module[_0x2218('0x12')]=router; \ No newline at end of file +var _0x63a8=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','show','post','create','/:id','update','destroy','multer'];(function(_0x1cbe9f,_0x4080d0){var _0x547a93=function(_0x51d28c){while(--_0x51d28c){_0x1cbe9f['push'](_0x1cbe9f['shift']());}};_0x547a93(++_0x4080d0);}(_0x63a8,0xd0));var _0x863a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x63a8[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x863a('0x0'));var util=require(_0x863a('0x1'));var path=require(_0x863a('0x2'));var timeout=require(_0x863a('0x3'));var express=require(_0x863a('0x4'));var router=express[_0x863a('0x5')]();var fs_extra=require(_0x863a('0x6'));var auth=require(_0x863a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x863a('0x8'));var controller=require(_0x863a('0x9'));router['get']('/',auth[_0x863a('0xa')](),controller[_0x863a('0xb')]);router[_0x863a('0xc')]('/:id',auth[_0x863a('0xa')](),controller[_0x863a('0xd')]);router[_0x863a('0xe')]('/',auth['isAuthenticated'](),controller[_0x863a('0xf')]);router['put'](_0x863a('0x10'),auth['isAuthenticated'](),controller[_0x863a('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x863a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 9d43939..0ccc442 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 _0x2f59=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x378830,_0xb532d7){var _0x4e4348=function(_0x496bc4){while(--_0x496bc4){_0x378830['push'](_0x378830['shift']());}};_0x4e4348(++_0xb532d7);}(_0x2f59,0x182));var _0x92f5=function(_0x1e952c,_0x1ac7b7){_0x1e952c=_0x1e952c-0x0;var _0x264625=_0x2f59[_0x1e952c];return _0x264625;};'use strict';var Sequelize=require(_0x92f5('0x0'));module['exports']={'type':{'type':Sequelize[_0x92f5('0x1')](_0x92f5('0x2'),_0x92f5('0x3'),_0x92f5('0x4'),_0x92f5('0x5'),_0x92f5('0x6')),'defaultValue':_0x92f5('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x92f5('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x92f5('0x7')]},'idField':{'type':Sequelize[_0x92f5('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x92f5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x92f5('0x7')]}}; \ No newline at end of file +var _0xeeda=['string','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xeeda,0x8e));var _0xaeed=function(_0x5e1fe8,_0x3ad779){_0x5e1fe8=_0x5e1fe8-0x0;var _0x404c9a=_0xeeda[_0x5e1fe8];return _0x404c9a;};'use strict';var Sequelize=require(_0xaeed('0x0'));module[_0xaeed('0x1')]={'type':{'type':Sequelize['ENUM'](_0xaeed('0x2'),'variable','customVariable',_0xaeed('0x3'),_0xaeed('0x4')),'defaultValue':_0xaeed('0x2')},'content':{'type':Sequelize[_0xaeed('0x5')]},'key':{'type':Sequelize[_0xaeed('0x5')]},'keyType':{'type':Sequelize[_0xaeed('0x6')]('string',_0xaeed('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xaeed('0x5')]},'nameField':{'type':Sequelize[_0xaeed('0x5')]},'customField':{'type':Sequelize[_0xaeed('0x8')],'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 8d8b24f..11b2697 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 _0x7341=['keys','includeAll','find','catch','create','body','zip-dir','request-promise','moment','mustache','util','path','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','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes'];(function(_0xa84991,_0x3fb37b){var _0x37226a=function(_0x1ec4a5){while(--_0x1ec4a5){_0xa84991['push'](_0xa84991['shift']());}};_0x37226a(++_0x3fb37b);}(_0x7341,0xe4));var _0x1734=function(_0x40dad9,_0x43bf88){_0x40dad9=_0x40dad9-0x0;var _0x244d5c=_0x7341[_0x40dad9];return _0x244d5c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1734('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1734('0x1'));var moment=require(_0x1734('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1734('0x3'));var util=require(_0x1734('0x4'));var path=require(_0x1734('0x5'));var sox=require(_0x1734('0x6'));var csv=require(_0x1734('0x7'));var ejs=require(_0x1734('0x8'));var fs=require('fs');var fs_extra=require(_0x1734('0x9'));var _=require('lodash');var squel=require(_0x1734('0xa'));var crypto=require(_0x1734('0xb'));var jsforce=require(_0x1734('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1734('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1734('0xd'));var authService=require(_0x1734('0xe'));var qs=require(_0x1734('0xf'));var as=require(_0x1734('0x10'));var hardwareService=require(_0x1734('0x11'));var logger=require(_0x1734('0x12'))(_0x1734('0x13'));var utils=require(_0x1734('0x14'));var config=require(_0x1734('0x15'));var licenseUtil=require(_0x1734('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4391a1,_0x449ab1){_0x449ab1=_0x449ab1||0xcc;return function(_0x44de07){if(_0x44de07){return _0x4391a1[_0x1734('0x17')](_0x449ab1);}return _0x4391a1[_0x1734('0x18')](_0x449ab1)[_0x1734('0x19')]();};}function respondWithResult(_0x9e7cf5,_0xd2f288){_0xd2f288=_0xd2f288||0xc8;return function(_0xb90c22){if(_0xb90c22){return _0x9e7cf5[_0x1734('0x18')](_0xd2f288)[_0x1734('0x1a')](_0xb90c22);}};}function respondWithFilteredResult(_0x27679e,_0x2162c9){return function(_0x2dd53c){if(_0x2dd53c){var _0x3989a6=typeof _0x2162c9[_0x1734('0x1b')]===_0x1734('0x1c')&&typeof _0x2162c9[_0x1734('0x1d')]===_0x1734('0x1c');var _0x56756c=_0x2dd53c['count'];var _0x1fa9c0=_0x3989a6?0x0:_0x2162c9[_0x1734('0x1b')];var _0x4a86d1=_0x3989a6?_0x2dd53c[_0x1734('0x1e')]:_0x2162c9['offset']+_0x2162c9['limit'];var _0x5b2789;if(_0x4a86d1>=_0x56756c){_0x4a86d1=_0x56756c;_0x5b2789=0xc8;}else{_0x5b2789=0xce;}_0x27679e[_0x1734('0x18')](_0x5b2789);return _0x27679e['set'](_0x1734('0x1f'),_0x1fa9c0+'-'+_0x4a86d1+'/'+_0x56756c)[_0x1734('0x1a')](_0x2dd53c);}return null;};}function patchUpdates(_0x4fc4ed){return function(_0x54b1bd){try{jsonpatch['apply'](_0x54b1bd,_0x4fc4ed,!![]);}catch(_0x1e7401){return BPromise['reject'](_0x1e7401);}return _0x54b1bd[_0x1734('0x20')]();};}function saveUpdates(_0x5ad801,_0x215ae4){return function(_0x42485f){if(_0x42485f){return _0x42485f[_0x1734('0x21')](_0x5ad801)[_0x1734('0x22')](function(_0x29bb2c){return _0x29bb2c;});}return null;};}function removeEntity(_0x45593e,_0x4285ee){return function(_0x44e420){if(_0x44e420){return _0x44e420[_0x1734('0x23')]()['then'](function(){_0x45593e[_0x1734('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e0023,_0x7478fd){return function(_0x46b2fa){if(!_0x46b2fa){_0x5e0023[_0x1734('0x17')](0x194);}return _0x46b2fa;};}function handleError(_0x157e35,_0x4435ac){_0x4435ac=_0x4435ac||0x1f4;return function(_0x2a95e3){logger[_0x1734('0x24')](_0x2a95e3[_0x1734('0x25')]);if(_0x2a95e3['name']){delete _0x2a95e3[_0x1734('0x26')];}_0x157e35['status'](_0x4435ac)[_0x1734('0x27')](_0x2a95e3);};}exports[_0x1734('0x28')]=function(_0xfca2ad,_0x52411b){var _0x3eb31b={},_0x3f9abe={},_0xf2d136={'count':0x0,'rows':[]};var _0x50efce=_[_0x1734('0x29')](db[_0x1734('0x2a')]['rawAttributes'],function(_0x1bd659){return{'name':_0x1bd659[_0x1734('0x2b')],'type':_0x1bd659[_0x1734('0x2c')][_0x1734('0x2d')]};});_0x3f9abe['model']=_[_0x1734('0x29')](_0x50efce,_0x1734('0x26'));_0x3f9abe['query']=_['keys'](_0xfca2ad[_0x1734('0x2e')]);_0x3f9abe[_0x1734('0x2f')]=_[_0x1734('0x30')](_0x3f9abe[_0x1734('0x31')],_0x3f9abe[_0x1734('0x2e')]);_0x3eb31b[_0x1734('0x32')]=_[_0x1734('0x30')](_0x3f9abe[_0x1734('0x31')],qs[_0x1734('0x33')](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x33')]));_0x3eb31b[_0x1734('0x32')]=_0x3eb31b[_0x1734('0x32')][_0x1734('0x34')]?_0x3eb31b[_0x1734('0x32')]:_0x3f9abe[_0x1734('0x31')];if(!_0xfca2ad[_0x1734('0x2e')]['hasOwnProperty'](_0x1734('0x35'))){_0x3eb31b['limit']=qs[_0x1734('0x1d')](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x1d')]);_0x3eb31b[_0x1734('0x1b')]=qs[_0x1734('0x1b')](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x1b')]);}_0x3eb31b[_0x1734('0x36')]=qs['sort'](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x37')]);_0x3eb31b[_0x1734('0x38')]=qs[_0x1734('0x2f')](_[_0x1734('0x39')](_0xfca2ad[_0x1734('0x2e')],_0x3f9abe[_0x1734('0x2f')]),_0x50efce);if(_0xfca2ad['query'][_0x1734('0x3a')]){_0x3eb31b[_0x1734('0x38')]=_[_0x1734('0x3b')](_0x3eb31b[_0x1734('0x38')],{'$or':_[_0x1734('0x29')](_0x50efce,function(_0x177068){if(_0x177068[_0x1734('0x2c')]!==_0x1734('0x3c')){var _0x4a6602={};_0x4a6602[_0x177068[_0x1734('0x26')]]={'$like':'%'+_0xfca2ad['query'][_0x1734('0x3a')]+'%'};return _0x4a6602;}})});}_0x3eb31b=_[_0x1734('0x3b')]({},_0x3eb31b,_0xfca2ad[_0x1734('0x3d')]);var _0x387aab={'where':_0x3eb31b[_0x1734('0x38')]};return db[_0x1734('0x2a')][_0x1734('0x1e')](_0x387aab)[_0x1734('0x22')](function(_0x54b877){_0xf2d136[_0x1734('0x1e')]=_0x54b877;if(_0xfca2ad[_0x1734('0x2e')]['includeAll']){_0x3eb31b[_0x1734('0x3e')]=[{'all':!![]}];}return db[_0x1734('0x2a')][_0x1734('0x3f')](_0x3eb31b);})[_0x1734('0x22')](function(_0x5f34e1){_0xf2d136[_0x1734('0x40')]=_0x5f34e1;return _0xf2d136;})['then'](respondWithFilteredResult(_0x52411b,_0x3eb31b))['catch'](handleError(_0x52411b,null));};exports[_0x1734('0x41')]=function(_0x3549ad,_0x13e4ea){var _0x71f9c1={'raw':!![],'where':{'id':_0x3549ad[_0x1734('0x42')]['id']}},_0x4fc418={};_0x4fc418[_0x1734('0x31')]=_['keys'](db[_0x1734('0x2a')][_0x1734('0x43')]);_0x4fc418['query']=_[_0x1734('0x44')](_0x3549ad['query']);_0x4fc418[_0x1734('0x2f')]=_[_0x1734('0x30')](_0x4fc418[_0x1734('0x31')],_0x4fc418[_0x1734('0x2e')]);_0x71f9c1[_0x1734('0x32')]=_[_0x1734('0x30')](_0x4fc418[_0x1734('0x31')],qs['fields'](_0x3549ad[_0x1734('0x2e')][_0x1734('0x33')]));_0x71f9c1['attributes']=_0x71f9c1[_0x1734('0x32')][_0x1734('0x34')]?_0x71f9c1[_0x1734('0x32')]:_0x4fc418[_0x1734('0x31')];if(_0x3549ad['query'][_0x1734('0x45')]){_0x71f9c1[_0x1734('0x3e')]=[{'all':!![]}];}_0x71f9c1=_[_0x1734('0x3b')]({},_0x71f9c1,_0x3549ad['options']);return db[_0x1734('0x2a')][_0x1734('0x46')](_0x71f9c1)[_0x1734('0x22')](handleEntityNotFound(_0x13e4ea,null))[_0x1734('0x22')](respondWithResult(_0x13e4ea,null))[_0x1734('0x47')](handleError(_0x13e4ea,null));};exports[_0x1734('0x48')]=function(_0xc45b98,_0x8bfed7){return db[_0x1734('0x2a')][_0x1734('0x48')](_0xc45b98[_0x1734('0x49')],{})[_0x1734('0x22')](respondWithResult(_0x8bfed7,0xc9))[_0x1734('0x47')](handleError(_0x8bfed7,null));};exports[_0x1734('0x21')]=function(_0x470110,_0x121c8c){if(_0x470110[_0x1734('0x49')]['id']){delete _0x470110[_0x1734('0x49')]['id'];}return db['FreshdeskField'][_0x1734('0x46')]({'where':{'id':_0x470110['params']['id']}})[_0x1734('0x22')](handleEntityNotFound(_0x121c8c,null))[_0x1734('0x22')](saveUpdates(_0x470110[_0x1734('0x49')],null))[_0x1734('0x22')](respondWithResult(_0x121c8c,null))['catch'](handleError(_0x121c8c,null));};exports['destroy']=function(_0x294097,_0xe86f1f){return db['FreshdeskField'][_0x1734('0x46')]({'where':{'id':_0x294097[_0x1734('0x42')]['id']}})[_0x1734('0x22')](handleEntityNotFound(_0xe86f1f,null))[_0x1734('0x22')](removeEntity(_0xe86f1f,null))[_0x1734('0x47')](handleError(_0xe86f1f,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(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0x2547,0x1cd));var _0x7254=function(_0x387115,_0x3b735f){_0x387115=_0x387115-0x0;var _0x400353=_0x2547[_0x387115];return _0x400353;};'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 1896d26..56dac9e 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 _0x43d3=['bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','moment'];(function(_0x35ea3d,_0x493666){var _0x162814=function(_0x3f5c22){while(--_0x3f5c22){_0x35ea3d['push'](_0x35ea3d['shift']());}};_0x162814(++_0x493666);}(_0x43d3,0x182));var _0x343d=function(_0x3d3b8d,_0x3cf713){_0x3d3b8d=_0x3d3b8d-0x0;var _0x18ccd2=_0x43d3[_0x3d3b8d];return _0x18ccd2;};'use strict';var _=require('lodash');var util=require(_0x343d('0x0'));var logger=require(_0x343d('0x1'))(_0x343d('0x2'));var moment=require(_0x343d('0x3'));var BPromise=require(_0x343d('0x4'));var rp=require(_0x343d('0x5'));var fs=require('fs');var path=require(_0x343d('0x6'));var rimraf=require(_0x343d('0x7'));var config=require('../../config/environment');var attributes=require(_0x343d('0x8'));module['exports']=function(_0x117216,_0x3aa08a){return _0x117216[_0x343d('0x9')](_0x343d('0xa'),attributes,{'tableName':_0x343d('0xb'),'paranoid':![],'indexes':[{'name':_0x343d('0xc'),'fields':[_0x343d('0xd'),_0x343d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14b9=['request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','../../config/logger','api','moment','bluebird'];(function(_0x64b0c5,_0x3670a2){var _0x4cf9ee=function(_0x58c9f2){while(--_0x58c9f2){_0x64b0c5['push'](_0x64b0c5['shift']());}};_0x4cf9ee(++_0x3670a2);}(_0x14b9,0x191));var _0x914b=function(_0x373eb5,_0x4cb059){_0x373eb5=_0x373eb5-0x0;var _0x13ba24=_0x14b9[_0x373eb5];return _0x13ba24;};'use strict';var _=require(_0x914b('0x0'));var util=require('util');var logger=require(_0x914b('0x1'))(_0x914b('0x2'));var moment=require(_0x914b('0x3'));var BPromise=require(_0x914b('0x4'));var rp=require(_0x914b('0x5'));var fs=require('fs');var path=require(_0x914b('0x6'));var rimraf=require('rimraf');var config=require(_0x914b('0x7'));var attributes=require(_0x914b('0x8'));module[_0x914b('0x9')]=function(_0x105ca0,_0x3aaec8){return _0x105ca0['define'](_0x914b('0xa'),attributes,{'tableName':_0x914b('0xb'),'paranoid':![],'indexes':[{'name':_0x914b('0xc'),'fields':[_0x914b('0xd'),'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 3fd8ef1..df9cbca 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 _0xa5de=['http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1182e7,_0x2bba08){var _0x102aa9=function(_0x55bdb1){while(--_0x55bdb1){_0x1182e7['push'](_0x1182e7['shift']());}};_0x102aa9(++_0x2bba08);}(_0xa5de,0xbb));var _0xea5d=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa5de[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xea5d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xea5d('0x1'));var rs=require(_0xea5d('0x2'));var fs=require('fs');var Redis=require(_0xea5d('0x3'));var db=require(_0xea5d('0x4'))['db'];var utils=require(_0xea5d('0x5'));var logger=require(_0xea5d('0x6'))(_0xea5d('0x7'));var config=require(_0xea5d('0x8'));var jayson=require(_0xea5d('0x9'));var client=jayson[_0xea5d('0xa')][_0xea5d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28685c,_0x24d7bc,_0xc8fae9){return new BPromise(function(_0x1b91ab,_0xb0ee3a){return client['request'](_0x28685c,_0xc8fae9)[_0xea5d('0xc')](function(_0x5de32d){logger[_0xea5d('0xd')](_0xea5d('0xe'),_0x24d7bc,_0xea5d('0xf'));logger[_0xea5d('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x24d7bc,_0xea5d('0xf'),JSON[_0xea5d('0x11')](_0x5de32d));if(_0x5de32d[_0xea5d('0x12')]){if(_0x5de32d[_0xea5d('0x12')]['code']===0x1f4){logger[_0xea5d('0x12')](_0xea5d('0xe'),_0x24d7bc,_0x5de32d[_0xea5d('0x12')][_0xea5d('0x13')]);return _0xb0ee3a(_0x5de32d[_0xea5d('0x12')][_0xea5d('0x13')]);}logger[_0xea5d('0x12')](_0xea5d('0xe'),_0x24d7bc,_0x5de32d[_0xea5d('0x12')][_0xea5d('0x13')]);return _0x1b91ab(_0x5de32d[_0xea5d('0x12')]['message']);}else{logger[_0xea5d('0xd')](_0xea5d('0xe'),_0x24d7bc,_0xea5d('0xf'));_0x1b91ab(_0x5de32d[_0xea5d('0x14')][_0xea5d('0x13')]);}})[_0xea5d('0x15')](function(_0x1d6b29){logger[_0xea5d('0x12')](_0xea5d('0xe'),_0x24d7bc,_0x1d6b29);_0xb0ee3a(_0x1d6b29);});});} \ No newline at end of file +var _0xb1fd=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x435ce7,_0x5bf1ef){var _0x47edc0=function(_0x3510a8){while(--_0x3510a8){_0x435ce7['push'](_0x435ce7['shift']());}};_0x47edc0(++_0x5bf1ef);}(_0xb1fd,0x81));var _0xdb1f=function(_0x14dbfe,_0x5638c6){_0x14dbfe=_0x14dbfe-0x0;var _0x50212c=_0xb1fd[_0x14dbfe];return _0x50212c;};'use strict';var _=require(_0xdb1f('0x0'));var util=require(_0xdb1f('0x1'));var moment=require(_0xdb1f('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb1f('0x3'));var fs=require('fs');var Redis=require(_0xdb1f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb1f('0x5'));var logger=require('../../config/logger')(_0xdb1f('0x6'));var config=require(_0xdb1f('0x7'));var jayson=require(_0xdb1f('0x8'));var client=jayson['client'][_0xdb1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x591202,_0x3bb807,_0xa4d9c5){return new BPromise(function(_0x269b74,_0x1feebe){return client[_0xdb1f('0xa')](_0x591202,_0xa4d9c5)[_0xdb1f('0xb')](function(_0x3844bc){logger[_0xdb1f('0xc')](_0xdb1f('0xd'),_0x3bb807,_0xdb1f('0xe'));logger[_0xdb1f('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x3bb807,_0xdb1f('0xe'),JSON['stringify'](_0x3844bc));if(_0x3844bc[_0xdb1f('0x10')]){if(_0x3844bc[_0xdb1f('0x10')][_0xdb1f('0x11')]===0x1f4){logger['error'](_0xdb1f('0xd'),_0x3bb807,_0x3844bc['error'][_0xdb1f('0x12')]);return _0x1feebe(_0x3844bc[_0xdb1f('0x10')][_0xdb1f('0x12')]);}logger[_0xdb1f('0x10')](_0xdb1f('0xd'),_0x3bb807,_0x3844bc[_0xdb1f('0x10')][_0xdb1f('0x12')]);return _0x269b74(_0x3844bc['error']['message']);}else{logger[_0xdb1f('0xc')](_0xdb1f('0xd'),_0x3bb807,'request\x20sent');_0x269b74(_0x3844bc[_0xdb1f('0x13')][_0xdb1f('0x12')]);}})[_0xdb1f('0x14')](function(_0x358800){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x3bb807,_0x358800);_0x1feebe(_0x358800);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 7ebd8c0..f02cf0b 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 _0x9348=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x9348,0x10d));var _0x8934=function(_0x62e424,_0x31e4b7){_0x62e424=_0x62e424-0x0;var _0x4df9ea=_0x9348[_0x62e424];return _0x4df9ea;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/:id',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x8934('0xd'),auth['isAuthenticated'](),controller[_0x8934('0xe')]);router[_0x8934('0xf')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);router[_0x8934('0xf')](_0x8934('0x11'),auth[_0x8934('0xa')](),controller[_0x8934('0x12')]);router['put'](_0x8934('0x13'),auth[_0x8934('0xa')](),controller[_0x8934('0x14')]);router[_0x8934('0x15')](_0x8934('0x13'),auth[_0x8934('0xa')](),controller['destroy']);module[_0x8934('0x16')]=router; \ No newline at end of file +var _0x57f8=['/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0xbd3e31,_0x4eb3cc){var _0x3eb2a4=function(_0x2f72de){while(--_0x2f72de){_0xbd3e31['push'](_0xbd3e31['shift']());}};_0x3eb2a4(++_0x4eb3cc);}(_0x57f8,0x198));var _0x857f=function(_0x355543,_0x2338dd){_0x355543=_0x355543-0x0;var _0x468604=_0x57f8[_0x355543];return _0x468604;};'use strict';var multer=require('multer');var util=require(_0x857f('0x0'));var path=require(_0x857f('0x1'));var timeout=require(_0x857f('0x2'));var express=require(_0x857f('0x3'));var router=express[_0x857f('0x4')]();var fs_extra=require(_0x857f('0x5'));var auth=require(_0x857f('0x6'));var interaction=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var controller=require(_0x857f('0x9'));router[_0x857f('0xa')]('/',auth[_0x857f('0xb')](),controller['index']);router[_0x857f('0xa')](_0x857f('0xc'),auth[_0x857f('0xb')](),controller['show']);router[_0x857f('0xa')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller['getConfigurations']);router[_0x857f('0xa')](_0x857f('0xe'),auth[_0x857f('0xb')](),controller['getFields']);router[_0x857f('0xf')]('/',auth[_0x857f('0xb')](),controller[_0x857f('0x10')]);router[_0x857f('0xf')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller[_0x857f('0x11')]);router['put'](_0x857f('0xc'),auth[_0x857f('0xb')](),controller[_0x857f('0x12')]);router[_0x857f('0x13')](_0x857f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x857f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 9ef3035..0a7af55 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 _0xfb11=['sequelize','STRING','username'];(function(_0x2abe94,_0x1f99c2){var _0x12b4df=function(_0x2764bd){while(--_0x2764bd){_0x2abe94['push'](_0x2abe94['shift']());}};_0x12b4df(++_0x1f99c2);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xfb11[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x1fb1('0x0'));module['exports']={'name':{'type':Sequelize[_0x1fb1('0x1')]},'description':{'type':Sequelize[_0x1fb1('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x1fb1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1fb1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x1fb1('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x958a=['sequelize','exports','STRING','username'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x958a,0x128));var _0xa958=function(_0x4b1557,_0x378f34){_0x4b1557=_0x4b1557-0x0;var _0x4ef4ad=_0x958a[_0x4b1557];return _0x4ef4ad;};'use strict';var Sequelize=require(_0xa958('0x0'));module[_0xa958('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa958('0x2')]},'username':{'type':Sequelize[_0xa958('0x2')],'unique':_0xa958('0x3')},'apiKey':{'type':Sequelize[_0xa958('0x2')]},'remoteUri':{'type':Sequelize[_0xa958('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa958('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 d17dea7..59203cb 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 _0xee4c=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','find','findOne','FreshsalesConfiguration','length','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','format','%s%s','/api/selector/owners','users','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x105114,_0x20a9c1){var _0x24797b=function(_0x3cabf5){while(--_0x3cabf5){_0x105114['push'](_0x105114['shift']());}};_0x24797b(++_0x20a9c1);}(_0xee4c,0x18f));var _0xcee4=function(_0x22ebdf,_0x30d33b){_0x22ebdf=_0x22ebdf-0x0;var _0x34c309=_0xee4c[_0x22ebdf];return _0x34c309;};'use strict';var emlformat=require(_0xcee4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcee4('0x1'));var jsonpatch=require(_0xcee4('0x2'));var rp=require('request-promise');var moment=require(_0xcee4('0x3'));var BPromise=require(_0xcee4('0x4'));var Mustache=require(_0xcee4('0x5'));var util=require(_0xcee4('0x6'));var path=require(_0xcee4('0x7'));var sox=require(_0xcee4('0x8'));var csv=require(_0xcee4('0x9'));var ejs=require(_0xcee4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcee4('0xb'));var jsforce=require(_0xcee4('0xc'));var deskjs=require(_0xcee4('0xd'));var toCsv=require(_0xcee4('0x9'));var querystring=require(_0xcee4('0xe'));var Papa=require(_0xcee4('0xf'));var Redis=require(_0xcee4('0x10'));var authService=require(_0xcee4('0x11'));var qs=require(_0xcee4('0x12'));var as=require(_0xcee4('0x13'));var hardwareService=require(_0xcee4('0x14'));var logger=require(_0xcee4('0x15'))(_0xcee4('0x16'));var utils=require(_0xcee4('0x17'));var config=require(_0xcee4('0x18'));var licenseUtil=require(_0xcee4('0x19'));var db=require(_0xcee4('0x1a'))['db'];var integrations=require(_0xcee4('0x1b'));function respondWithStatusCode(_0x208e9c,_0x37240a){_0x37240a=_0x37240a||0xcc;return function(_0x8e7656){if(_0x8e7656){return _0x208e9c[_0xcee4('0x1c')](_0x37240a);}return _0x208e9c[_0xcee4('0x1d')](_0x37240a)[_0xcee4('0x1e')]();};}function respondWithResult(_0x2ba50a,_0x3a26aa){_0x3a26aa=_0x3a26aa||0xc8;return function(_0x2fe990){if(_0x2fe990){return _0x2ba50a[_0xcee4('0x1d')](_0x3a26aa)[_0xcee4('0x1f')](_0x2fe990);}};}function respondWithFilteredResult(_0x43849c,_0x256ae3){return function(_0x4bcf5d){if(_0x4bcf5d){var _0xb5207f=typeof _0x256ae3[_0xcee4('0x20')]==='undefined'&&typeof _0x256ae3[_0xcee4('0x21')]===_0xcee4('0x22');var _0x2f912d=_0x4bcf5d['count'];var _0x1880a9=_0xb5207f?0x0:_0x256ae3[_0xcee4('0x20')];var _0x2a7ed8=_0xb5207f?_0x4bcf5d[_0xcee4('0x23')]:_0x256ae3['offset']+_0x256ae3['limit'];var _0x4313fb;if(_0x2a7ed8>=_0x2f912d){_0x2a7ed8=_0x2f912d;_0x4313fb=0xc8;}else{_0x4313fb=0xce;}_0x43849c[_0xcee4('0x1d')](_0x4313fb);return _0x43849c['set'](_0xcee4('0x24'),_0x1880a9+'-'+_0x2a7ed8+'/'+_0x2f912d)[_0xcee4('0x1f')](_0x4bcf5d);}return null;};}function patchUpdates(_0x36c411){return function(_0x3706f0){try{jsonpatch[_0xcee4('0x25')](_0x3706f0,_0x36c411,!![]);}catch(_0x12cddc){return BPromise[_0xcee4('0x26')](_0x12cddc);}return _0x3706f0[_0xcee4('0x27')]();};}function saveUpdates(_0x7d801d,_0x13d57a){return function(_0x5bffd4){if(_0x5bffd4){return _0x5bffd4[_0xcee4('0x28')](_0x7d801d)[_0xcee4('0x29')](function(_0x17b628){return _0x17b628;});}return null;};}function removeEntity(_0x408848,_0x160618){return function(_0xbe7782){if(_0xbe7782){return _0xbe7782[_0xcee4('0x2a')]()[_0xcee4('0x29')](function(){_0x408848[_0xcee4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c579c,_0x24b74e){return function(_0x234f7f){if(!_0x234f7f){_0x2c579c[_0xcee4('0x1c')](0x194);}return _0x234f7f;};}function handleError(_0x5a0fbc,_0x59cd46){_0x59cd46=_0x59cd46||0x1f4;return function(_0x2c6b64){logger[_0xcee4('0x2b')](_0x2c6b64[_0xcee4('0x2c')]);if(_0x2c6b64[_0xcee4('0x2d')]){delete _0x2c6b64[_0xcee4('0x2d')];}_0x5a0fbc[_0xcee4('0x1d')](_0x59cd46)[_0xcee4('0x2e')](_0x2c6b64);};}exports[_0xcee4('0x2f')]=function(_0x37f2be,_0x508cb6){var _0x28073a={},_0x515a06={},_0x36a395={'count':0x0,'rows':[]};var _0x1bcec3=_[_0xcee4('0x30')](db[_0xcee4('0x31')][_0xcee4('0x32')],function(_0x349500){return{'name':_0x349500[_0xcee4('0x33')],'type':_0x349500[_0xcee4('0x34')]['key']};});_0x515a06[_0xcee4('0x35')]=_['map'](_0x1bcec3,_0xcee4('0x2d'));_0x515a06[_0xcee4('0x36')]=_[_0xcee4('0x37')](_0x37f2be[_0xcee4('0x36')]);_0x515a06[_0xcee4('0x38')]=_[_0xcee4('0x39')](_0x515a06[_0xcee4('0x35')],_0x515a06[_0xcee4('0x36')]);_0x28073a[_0xcee4('0x3a')]=_['intersection'](_0x515a06[_0xcee4('0x35')],qs['fields'](_0x37f2be['query'][_0xcee4('0x3b')]));_0x28073a['attributes']=_0x28073a['attributes']['length']?_0x28073a[_0xcee4('0x3a')]:_0x515a06[_0xcee4('0x35')];if(!_0x37f2be['query'][_0xcee4('0x3c')](_0xcee4('0x3d'))){_0x28073a[_0xcee4('0x21')]=qs['limit'](_0x37f2be[_0xcee4('0x36')][_0xcee4('0x21')]);_0x28073a['offset']=qs['offset'](_0x37f2be[_0xcee4('0x36')][_0xcee4('0x20')]);}_0x28073a[_0xcee4('0x3e')]=qs[_0xcee4('0x3f')](_0x37f2be['query'][_0xcee4('0x3f')]);_0x28073a[_0xcee4('0x40')]=qs[_0xcee4('0x38')](_[_0xcee4('0x41')](_0x37f2be[_0xcee4('0x36')],_0x515a06[_0xcee4('0x38')]),_0x1bcec3);if(_0x37f2be['query'][_0xcee4('0x42')]){_0x28073a['where']=_[_0xcee4('0x43')](_0x28073a[_0xcee4('0x40')],{'$or':_[_0xcee4('0x30')](_0x1bcec3,function(_0x26f813){if(_0x26f813[_0xcee4('0x34')]!==_0xcee4('0x44')){var _0x34513e={};_0x34513e[_0x26f813['name']]={'$like':'%'+_0x37f2be[_0xcee4('0x36')][_0xcee4('0x42')]+'%'};return _0x34513e;}})});}_0x28073a=_['merge']({},_0x28073a,_0x37f2be[_0xcee4('0x45')]);var _0x4367fa={'where':_0x28073a['where']};return db[_0xcee4('0x31')][_0xcee4('0x23')](_0x4367fa)['then'](function(_0x2710ef){_0x36a395[_0xcee4('0x23')]=_0x2710ef;if(_0x37f2be[_0xcee4('0x36')]['includeAll']){_0x28073a[_0xcee4('0x46')]=[{'all':!![]}];}return db[_0xcee4('0x31')][_0xcee4('0x47')](_0x28073a);})[_0xcee4('0x29')](function(_0x3a2e0e){_0x36a395[_0xcee4('0x48')]=_0x3a2e0e;return _0x36a395;})['then'](respondWithFilteredResult(_0x508cb6,_0x28073a))[_0xcee4('0x49')](handleError(_0x508cb6,null));};exports['show']=function(_0x381fd0,_0x4192b2){var _0x1f6a5b={'raw':![],'where':{'id':_0x381fd0[_0xcee4('0x4a')]['id']}},_0x1c9ded={};_0x1c9ded['model']=_[_0xcee4('0x37')](db[_0xcee4('0x31')][_0xcee4('0x32')]);_0x1c9ded[_0xcee4('0x36')]=_[_0xcee4('0x37')](_0x381fd0['query']);_0x1c9ded[_0xcee4('0x38')]=_[_0xcee4('0x39')](_0x1c9ded[_0xcee4('0x35')],_0x1c9ded[_0xcee4('0x36')]);_0x1f6a5b[_0xcee4('0x3a')]=_[_0xcee4('0x39')](_0x1c9ded[_0xcee4('0x35')],qs[_0xcee4('0x3b')](_0x381fd0[_0xcee4('0x36')]['fields']));_0x1f6a5b[_0xcee4('0x3a')]=_0x1f6a5b[_0xcee4('0x3a')]['length']?_0x1f6a5b['attributes']:_0x1c9ded[_0xcee4('0x35')];if(_0x381fd0[_0xcee4('0x36')][_0xcee4('0x4b')]){_0x1f6a5b[_0xcee4('0x46')]=[{'all':!![]}];}_0x1f6a5b=_[_0xcee4('0x43')]({},_0x1f6a5b,_0x381fd0['options']);return db['FreshsalesAccount']['find'](_0x1f6a5b)[_0xcee4('0x29')](handleEntityNotFound(_0x4192b2,null))[_0xcee4('0x29')](respondWithResult(_0x4192b2,null))[_0xcee4('0x49')](handleError(_0x4192b2,null));};exports[_0xcee4('0x4c')]=function(_0x34d7dc,_0x5c67ec){return db[_0xcee4('0x31')]['create'](_0x34d7dc[_0xcee4('0x4d')],{})['then'](respondWithResult(_0x5c67ec,0xc9))[_0xcee4('0x49')](handleError(_0x5c67ec,null));};exports['update']=function(_0x5346f5,_0xf23ff3){if(_0x5346f5[_0xcee4('0x4d')]['id']){delete _0x5346f5[_0xcee4('0x4d')]['id'];}return db[_0xcee4('0x31')][_0xcee4('0x4e')]({'where':{'id':_0x5346f5[_0xcee4('0x4a')]['id']}})[_0xcee4('0x29')](handleEntityNotFound(_0xf23ff3,null))[_0xcee4('0x29')](saveUpdates(_0x5346f5[_0xcee4('0x4d')],null))[_0xcee4('0x29')](respondWithResult(_0xf23ff3,null))[_0xcee4('0x49')](handleError(_0xf23ff3,null));};exports[_0xcee4('0x2a')]=function(_0x14ed04,_0x4602c7){return db[_0xcee4('0x31')][_0xcee4('0x4e')]({'where':{'id':_0x14ed04['params']['id']}})['then'](handleEntityNotFound(_0x4602c7,null))[_0xcee4('0x29')](removeEntity(_0x4602c7,null))[_0xcee4('0x49')](handleError(_0x4602c7,null));};exports['getConfigurations']=function(_0x5db209,_0x580d29,_0x252a8f){var _0x2fb2f8={};var _0x39b876={};var _0x161291;var _0x2531b7;return db[_0xcee4('0x31')][_0xcee4('0x4f')]({'where':{'id':_0x5db209['params']['id']}})['then'](handleEntityNotFound(_0x580d29,null))[_0xcee4('0x29')](function(_0x54f941){if(_0x54f941){_0x161291=_0x54f941;_0x39b876['model']=_[_0xcee4('0x37')](db[_0xcee4('0x50')][_0xcee4('0x32')]);_0x39b876['query']=_[_0xcee4('0x37')](_0x5db209[_0xcee4('0x36')]);_0x39b876[_0xcee4('0x38')]=_[_0xcee4('0x39')](_0x39b876[_0xcee4('0x35')],_0x39b876['query']);_0x2fb2f8[_0xcee4('0x3a')]=_['intersection'](_0x39b876[_0xcee4('0x35')],qs[_0xcee4('0x3b')](_0x5db209[_0xcee4('0x36')][_0xcee4('0x3b')]));_0x2fb2f8[_0xcee4('0x3a')]=_0x2fb2f8[_0xcee4('0x3a')][_0xcee4('0x51')]?_0x2fb2f8['attributes']:_0x39b876[_0xcee4('0x35')];_0x2fb2f8['order']=qs[_0xcee4('0x3f')](_0x5db209[_0xcee4('0x36')][_0xcee4('0x3f')]);_0x2fb2f8[_0xcee4('0x40')]=qs[_0xcee4('0x38')](_['pick'](_0x5db209[_0xcee4('0x36')],_0x39b876['filters']));if(_0x5db209[_0xcee4('0x36')][_0xcee4('0x42')]){_0x2fb2f8[_0xcee4('0x40')]=_[_0xcee4('0x43')](_0x2fb2f8['where'],{'$or':_[_0xcee4('0x30')](_0x2fb2f8[_0xcee4('0x3a')],function(_0x4e0618){var _0xbb0cea={};_0xbb0cea[_0x4e0618]={'$like':'%'+_0x5db209[_0xcee4('0x36')][_0xcee4('0x42')]+'%'};return _0xbb0cea;})});}_0x2fb2f8=_['merge']({},_0x2fb2f8,_0x5db209[_0xcee4('0x45')]);return _0x161291[_0xcee4('0x52')](_0x2fb2f8);}})[_0xcee4('0x29')](function(_0x1cae6e){if(_0x1cae6e){_0x2531b7=_0x1cae6e['length'];if(!_0x5db209[_0xcee4('0x36')]['hasOwnProperty'](_0xcee4('0x3d'))){_0x2fb2f8[_0xcee4('0x21')]=qs[_0xcee4('0x21')](_0x5db209[_0xcee4('0x36')][_0xcee4('0x21')]);_0x2fb2f8['offset']=qs['offset'](_0x5db209[_0xcee4('0x36')][_0xcee4('0x20')]);}return _0x161291[_0xcee4('0x52')](_0x2fb2f8);}})[_0xcee4('0x29')](function(_0x2f3912){if(_0x2f3912){return _0x2f3912?{'count':_0x2531b7,'rows':_0x2f3912}:null;}})[_0xcee4('0x29')](respondWithResult(_0x580d29,null))[_0xcee4('0x49')](handleError(_0x580d29,null));};exports[_0xcee4('0x53')]=function(_0x2f2922,_0x1d0d5e,_0x2975f1){if(_0x2f2922[_0xcee4('0x4d')]['id']){delete _0x2f2922[_0xcee4('0x4d')]['id'];}return db['FreshsalesAccount'][_0xcee4('0x4f')]({'where':{'id':_0x2f2922[_0xcee4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d0d5e,null))[_0xcee4('0x29')](function(_0x230f28){if(_0x230f28){_0x2f2922[_0xcee4('0x4d')][_0xcee4('0x54')]=_0x230f28['id'];_0x2f2922['body'][_0xcee4('0x55')]=integrations[_0xcee4('0x56')](_0x2f2922[_0xcee4('0x4d')][_0xcee4('0x57')],_0x2f2922[_0xcee4('0x4d')][_0xcee4('0x34')]);_0x2f2922[_0xcee4('0x4d')][_0xcee4('0x58')]=integrations[_0xcee4('0x59')](_0x2f2922[_0xcee4('0x4d')][_0xcee4('0x57')],_0x2f2922[_0xcee4('0x4d')][_0xcee4('0x34')]);return db[_0xcee4('0x50')]['create'](_0x2f2922[_0xcee4('0x4d')],{'include':[{'model':db[_0xcee4('0x5a')],'as':_0xcee4('0x55')},{'model':db[_0xcee4('0x5a')],'as':_0xcee4('0x58')}]});}return null;})['then'](respondWithResult(_0x1d0d5e,null))['catch'](handleError(_0x1d0d5e,null));};exports[_0xcee4('0x5b')]=function(_0x1988b1,_0x613246,_0x36f23a){var _0x1f0cca='';var _0x56a0a1='';return db[_0xcee4('0x31')][_0xcee4('0x4f')]({'where':{'id':_0x1988b1[_0xcee4('0x4a')]['id']},'attributes':['id',_0xcee4('0x5c'),'remoteUri','apiKey']})[_0xcee4('0x29')](handleEntityNotFound(_0x613246,null))[_0xcee4('0x29')](function(_0x266c1a){if(_0x266c1a){_0x56a0a1=_0x266c1a[_0xcee4('0x5c')];_0x1f0cca=_0x266c1a[_0xcee4('0x5d')];var _0x153736=_0x266c1a['remoteUri'][_0xcee4('0x5e')](-0x1);if(_0x153736==='/'){_0x1f0cca=_0x1f0cca[_0xcee4('0x5f')](0x0,_0x1f0cca['lastIndexOf'](_0x153736));}return rp({'method':'GET','uri':util[_0xcee4('0x60')](_0xcee4('0x61'),_0x1f0cca,_0xcee4('0x62')),'headers':{'Authorization':'Token\x20token='+_0x266c1a['apiKey']},'json':!![]});}})[_0xcee4('0x29')](function(_0x3e29a4){if(_0x3e29a4){var _0x40abf2=_0x3e29a4[_0xcee4('0x63')];var _0x41ca8b=![];var _0x4c6107=null;for(_0x4c6107=0x0;_0x4c6107<_0x40abf2[_0xcee4('0x51')];_0x4c6107++){if(_0x40abf2[_0x4c6107]['email']===_0x56a0a1){_0x41ca8b=!![];}}if(_0x41ca8b){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x613246,null))[_0xcee4('0x49')](function(_0x26a782){var _0x19e908=_0x1988b1[_0xcee4('0x36')][_0xcee4('0x64')]?0x1f4:_0x26a782[_0xcee4('0x65')]||0x1f4;logger[_0xcee4('0x2b')](_0xcee4('0x66'),_0xcee4('0x5b'),_0x19e908,JSON[_0xcee4('0x67')](_0x26a782));delete _0x26a782[_0xcee4('0x2d')];if(_0x19e908===0x191){_0x19e908=0x190;}_0x613246[_0xcee4('0x1d')](_0x19e908)[_0xcee4('0x2e')](_0x1988b1['query'][_0xcee4('0x64')]?{'message':_0xcee4('0x68'),'statusCode':_0x26a782[_0xcee4('0x65')]}:_0x26a782);});}; \ No newline at end of file +var _0xb9ce=['save','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','catch','show','params','rawAttributes','create','update','body','find','findOne','FreshsalesConfiguration','options','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','lastIndexOf','GET','%s%s','users','email','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x332109,_0x474add){var _0x7a6ab2=function(_0x5132dd){while(--_0x5132dd){_0x332109['push'](_0x332109['shift']());}};_0x7a6ab2(++_0x474add);}(_0xb9ce,0xfd));var _0xeb9c=function(_0x316982,_0x4842e2){_0x316982=_0x316982-0x0;var _0x354ea8=_0xb9ce[_0x316982];return _0x354ea8;};'use strict';var emlformat=require(_0xeb9c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb9c('0x1'));var moment=require('moment');var BPromise=require(_0xeb9c('0x2'));var Mustache=require(_0xeb9c('0x3'));var util=require(_0xeb9c('0x4'));var path=require(_0xeb9c('0x5'));var sox=require('sox');var csv=require(_0xeb9c('0x6'));var ejs=require(_0xeb9c('0x7'));var fs=require('fs');var fs_extra=require(_0xeb9c('0x8'));var _=require(_0xeb9c('0x9'));var squel=require(_0xeb9c('0xa'));var crypto=require(_0xeb9c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xeb9c('0xc'));var toCsv=require(_0xeb9c('0x6'));var querystring=require(_0xeb9c('0xd'));var Papa=require(_0xeb9c('0xe'));var Redis=require(_0xeb9c('0xf'));var authService=require(_0xeb9c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeb9c('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb9c('0x14'));function respondWithStatusCode(_0x241da3,_0x3c2695){_0x3c2695=_0x3c2695||0xcc;return function(_0x493046){if(_0x493046){return _0x241da3[_0xeb9c('0x15')](_0x3c2695);}return _0x241da3['status'](_0x3c2695)[_0xeb9c('0x16')]();};}function respondWithResult(_0x32333e,_0x3fb589){_0x3fb589=_0x3fb589||0xc8;return function(_0x2e1247){if(_0x2e1247){return _0x32333e[_0xeb9c('0x17')](_0x3fb589)[_0xeb9c('0x18')](_0x2e1247);}};}function respondWithFilteredResult(_0x538235,_0x2a1c63){return function(_0x224062){if(_0x224062){var _0x3c4ebe=typeof _0x2a1c63[_0xeb9c('0x19')]===_0xeb9c('0x1a')&&typeof _0x2a1c63[_0xeb9c('0x1b')]===_0xeb9c('0x1a');var _0x4f8600=_0x224062[_0xeb9c('0x1c')];var _0x286a98=_0x3c4ebe?0x0:_0x2a1c63['offset'];var _0x27271b=_0x3c4ebe?_0x224062[_0xeb9c('0x1c')]:_0x2a1c63[_0xeb9c('0x19')]+_0x2a1c63[_0xeb9c('0x1b')];var _0x99072e;if(_0x27271b>=_0x4f8600){_0x27271b=_0x4f8600;_0x99072e=0xc8;}else{_0x99072e=0xce;}_0x538235[_0xeb9c('0x17')](_0x99072e);return _0x538235[_0xeb9c('0x1d')](_0xeb9c('0x1e'),_0x286a98+'-'+_0x27271b+'/'+_0x4f8600)[_0xeb9c('0x18')](_0x224062);}return null;};}function patchUpdates(_0x3c2a41){return function(_0x3314a9){try{jsonpatch['apply'](_0x3314a9,_0x3c2a41,!![]);}catch(_0x194af8){return BPromise[_0xeb9c('0x1f')](_0x194af8);}return _0x3314a9[_0xeb9c('0x20')]();};}function saveUpdates(_0x58ae77,_0x3f17bd){return function(_0x578f35){if(_0x578f35){return _0x578f35['update'](_0x58ae77)[_0xeb9c('0x21')](function(_0x37a0fc){return _0x37a0fc;});}return null;};}function removeEntity(_0x30a9ab,_0x2d10f0){return function(_0x3371f4){if(_0x3371f4){return _0x3371f4[_0xeb9c('0x22')]()[_0xeb9c('0x21')](function(){_0x30a9ab[_0xeb9c('0x17')](0xcc)[_0xeb9c('0x16')]();});}};}function handleEntityNotFound(_0xb98e7c,_0x33ddff){return function(_0x3a98db){if(!_0x3a98db){_0xb98e7c['sendStatus'](0x194);}return _0x3a98db;};}function handleError(_0x51b203,_0x3cf216){_0x3cf216=_0x3cf216||0x1f4;return function(_0x29f717){logger[_0xeb9c('0x23')](_0x29f717[_0xeb9c('0x24')]);if(_0x29f717[_0xeb9c('0x25')]){delete _0x29f717[_0xeb9c('0x25')];}_0x51b203[_0xeb9c('0x17')](_0x3cf216)[_0xeb9c('0x26')](_0x29f717);};}exports[_0xeb9c('0x27')]=function(_0x58848e,_0x15d15e){var _0x23b64c={},_0x1e1ce1={},_0x2d2ef4={'count':0x0,'rows':[]};var _0x316068=_[_0xeb9c('0x28')](db[_0xeb9c('0x29')]['rawAttributes'],function(_0x49eb30){return{'name':_0x49eb30[_0xeb9c('0x2a')],'type':_0x49eb30['type']['key']};});_0x1e1ce1[_0xeb9c('0x2b')]=_[_0xeb9c('0x28')](_0x316068,_0xeb9c('0x25'));_0x1e1ce1['query']=_[_0xeb9c('0x2c')](_0x58848e[_0xeb9c('0x2d')]);_0x1e1ce1[_0xeb9c('0x2e')]=_[_0xeb9c('0x2f')](_0x1e1ce1[_0xeb9c('0x2b')],_0x1e1ce1[_0xeb9c('0x2d')]);_0x23b64c['attributes']=_[_0xeb9c('0x2f')](_0x1e1ce1[_0xeb9c('0x2b')],qs[_0xeb9c('0x30')](_0x58848e[_0xeb9c('0x2d')][_0xeb9c('0x30')]));_0x23b64c[_0xeb9c('0x31')]=_0x23b64c[_0xeb9c('0x31')][_0xeb9c('0x32')]?_0x23b64c[_0xeb9c('0x31')]:_0x1e1ce1['model'];if(!_0x58848e[_0xeb9c('0x2d')][_0xeb9c('0x33')](_0xeb9c('0x34'))){_0x23b64c[_0xeb9c('0x1b')]=qs[_0xeb9c('0x1b')](_0x58848e['query']['limit']);_0x23b64c[_0xeb9c('0x19')]=qs[_0xeb9c('0x19')](_0x58848e[_0xeb9c('0x2d')][_0xeb9c('0x19')]);}_0x23b64c[_0xeb9c('0x35')]=qs[_0xeb9c('0x36')](_0x58848e[_0xeb9c('0x2d')]['sort']);_0x23b64c[_0xeb9c('0x37')]=qs[_0xeb9c('0x2e')](_[_0xeb9c('0x38')](_0x58848e['query'],_0x1e1ce1['filters']),_0x316068);if(_0x58848e[_0xeb9c('0x2d')][_0xeb9c('0x39')]){_0x23b64c[_0xeb9c('0x37')]=_[_0xeb9c('0x3a')](_0x23b64c[_0xeb9c('0x37')],{'$or':_[_0xeb9c('0x28')](_0x316068,function(_0xaa14d0){if(_0xaa14d0[_0xeb9c('0x3b')]!=='VIRTUAL'){var _0xdfa203={};_0xdfa203[_0xaa14d0['name']]={'$like':'%'+_0x58848e[_0xeb9c('0x2d')]['filter']+'%'};return _0xdfa203;}})});}_0x23b64c=_[_0xeb9c('0x3a')]({},_0x23b64c,_0x58848e['options']);var _0x434b7a={'where':_0x23b64c['where']};return db[_0xeb9c('0x29')][_0xeb9c('0x1c')](_0x434b7a)['then'](function(_0x524330){_0x2d2ef4['count']=_0x524330;if(_0x58848e[_0xeb9c('0x2d')][_0xeb9c('0x3c')]){_0x23b64c[_0xeb9c('0x3d')]=[{'all':!![]}];}return db[_0xeb9c('0x29')]['findAll'](_0x23b64c);})[_0xeb9c('0x21')](function(_0x127b6e){_0x2d2ef4['rows']=_0x127b6e;return _0x2d2ef4;})[_0xeb9c('0x21')](respondWithFilteredResult(_0x15d15e,_0x23b64c))[_0xeb9c('0x3e')](handleError(_0x15d15e,null));};exports[_0xeb9c('0x3f')]=function(_0x4978f3,_0x25e0bc){var _0x51dbf0={'raw':![],'where':{'id':_0x4978f3[_0xeb9c('0x40')]['id']}},_0x2a5459={};_0x2a5459['model']=_[_0xeb9c('0x2c')](db[_0xeb9c('0x29')][_0xeb9c('0x41')]);_0x2a5459[_0xeb9c('0x2d')]=_[_0xeb9c('0x2c')](_0x4978f3[_0xeb9c('0x2d')]);_0x2a5459[_0xeb9c('0x2e')]=_[_0xeb9c('0x2f')](_0x2a5459[_0xeb9c('0x2b')],_0x2a5459[_0xeb9c('0x2d')]);_0x51dbf0['attributes']=_[_0xeb9c('0x2f')](_0x2a5459[_0xeb9c('0x2b')],qs[_0xeb9c('0x30')](_0x4978f3['query'][_0xeb9c('0x30')]));_0x51dbf0[_0xeb9c('0x31')]=_0x51dbf0[_0xeb9c('0x31')]['length']?_0x51dbf0[_0xeb9c('0x31')]:_0x2a5459[_0xeb9c('0x2b')];if(_0x4978f3[_0xeb9c('0x2d')]['includeAll']){_0x51dbf0[_0xeb9c('0x3d')]=[{'all':!![]}];}_0x51dbf0=_[_0xeb9c('0x3a')]({},_0x51dbf0,_0x4978f3['options']);return db['FreshsalesAccount']['find'](_0x51dbf0)[_0xeb9c('0x21')](handleEntityNotFound(_0x25e0bc,null))['then'](respondWithResult(_0x25e0bc,null))[_0xeb9c('0x3e')](handleError(_0x25e0bc,null));};exports[_0xeb9c('0x42')]=function(_0x3f7cd9,_0xe2d4f1){return db[_0xeb9c('0x29')]['create'](_0x3f7cd9['body'],{})[_0xeb9c('0x21')](respondWithResult(_0xe2d4f1,0xc9))[_0xeb9c('0x3e')](handleError(_0xe2d4f1,null));};exports[_0xeb9c('0x43')]=function(_0x26ab11,_0x17beba){if(_0x26ab11['body']['id']){delete _0x26ab11[_0xeb9c('0x44')]['id'];}return db[_0xeb9c('0x29')][_0xeb9c('0x45')]({'where':{'id':_0x26ab11[_0xeb9c('0x40')]['id']}})[_0xeb9c('0x21')](handleEntityNotFound(_0x17beba,null))[_0xeb9c('0x21')](saveUpdates(_0x26ab11[_0xeb9c('0x44')],null))[_0xeb9c('0x21')](respondWithResult(_0x17beba,null))['catch'](handleError(_0x17beba,null));};exports[_0xeb9c('0x22')]=function(_0x413036,_0x5d9cf5){return db[_0xeb9c('0x29')][_0xeb9c('0x45')]({'where':{'id':_0x413036[_0xeb9c('0x40')]['id']}})['then'](handleEntityNotFound(_0x5d9cf5,null))['then'](removeEntity(_0x5d9cf5,null))[_0xeb9c('0x3e')](handleError(_0x5d9cf5,null));};exports['getConfigurations']=function(_0x1864ca,_0x91fdd1,_0x3259aa){var _0x1d2e34={};var _0x54b869={};var _0xa55ddb;var _0xe38fc5;return db[_0xeb9c('0x29')][_0xeb9c('0x46')]({'where':{'id':_0x1864ca[_0xeb9c('0x40')]['id']}})[_0xeb9c('0x21')](handleEntityNotFound(_0x91fdd1,null))[_0xeb9c('0x21')](function(_0x12e1ea){if(_0x12e1ea){_0xa55ddb=_0x12e1ea;_0x54b869['model']=_[_0xeb9c('0x2c')](db[_0xeb9c('0x47')][_0xeb9c('0x41')]);_0x54b869[_0xeb9c('0x2d')]=_[_0xeb9c('0x2c')](_0x1864ca[_0xeb9c('0x2d')]);_0x54b869[_0xeb9c('0x2e')]=_[_0xeb9c('0x2f')](_0x54b869['model'],_0x54b869[_0xeb9c('0x2d')]);_0x1d2e34['attributes']=_['intersection'](_0x54b869['model'],qs[_0xeb9c('0x30')](_0x1864ca[_0xeb9c('0x2d')][_0xeb9c('0x30')]));_0x1d2e34[_0xeb9c('0x31')]=_0x1d2e34[_0xeb9c('0x31')]['length']?_0x1d2e34['attributes']:_0x54b869['model'];_0x1d2e34[_0xeb9c('0x35')]=qs[_0xeb9c('0x36')](_0x1864ca[_0xeb9c('0x2d')][_0xeb9c('0x36')]);_0x1d2e34[_0xeb9c('0x37')]=qs[_0xeb9c('0x2e')](_[_0xeb9c('0x38')](_0x1864ca[_0xeb9c('0x2d')],_0x54b869[_0xeb9c('0x2e')]));if(_0x1864ca[_0xeb9c('0x2d')][_0xeb9c('0x39')]){_0x1d2e34[_0xeb9c('0x37')]=_['merge'](_0x1d2e34[_0xeb9c('0x37')],{'$or':_[_0xeb9c('0x28')](_0x1d2e34[_0xeb9c('0x31')],function(_0x57beab){var _0x8cff34={};_0x8cff34[_0x57beab]={'$like':'%'+_0x1864ca[_0xeb9c('0x2d')]['filter']+'%'};return _0x8cff34;})});}_0x1d2e34=_[_0xeb9c('0x3a')]({},_0x1d2e34,_0x1864ca[_0xeb9c('0x48')]);return _0xa55ddb[_0xeb9c('0x49')](_0x1d2e34);}})['then'](function(_0x256db3){if(_0x256db3){_0xe38fc5=_0x256db3[_0xeb9c('0x32')];if(!_0x1864ca[_0xeb9c('0x2d')][_0xeb9c('0x33')](_0xeb9c('0x34'))){_0x1d2e34[_0xeb9c('0x1b')]=qs[_0xeb9c('0x1b')](_0x1864ca[_0xeb9c('0x2d')][_0xeb9c('0x1b')]);_0x1d2e34['offset']=qs['offset'](_0x1864ca['query'][_0xeb9c('0x19')]);}return _0xa55ddb[_0xeb9c('0x49')](_0x1d2e34);}})[_0xeb9c('0x21')](function(_0x1d20af){if(_0x1d20af){return _0x1d20af?{'count':_0xe38fc5,'rows':_0x1d20af}:null;}})[_0xeb9c('0x21')](respondWithResult(_0x91fdd1,null))[_0xeb9c('0x3e')](handleError(_0x91fdd1,null));};exports['addConfiguration']=function(_0x144089,_0x5a0230,_0x51f552){if(_0x144089['body']['id']){delete _0x144089[_0xeb9c('0x44')]['id'];}return db[_0xeb9c('0x29')][_0xeb9c('0x46')]({'where':{'id':_0x144089['params']['id']}})[_0xeb9c('0x21')](handleEntityNotFound(_0x5a0230,null))[_0xeb9c('0x21')](function(_0x270a9b){if(_0x270a9b){_0x144089[_0xeb9c('0x44')][_0xeb9c('0x4a')]=_0x270a9b['id'];_0x144089[_0xeb9c('0x44')][_0xeb9c('0x4b')]=integrations[_0xeb9c('0x4c')](_0x144089[_0xeb9c('0x44')][_0xeb9c('0x4d')],_0x144089[_0xeb9c('0x44')][_0xeb9c('0x3b')]);_0x144089[_0xeb9c('0x44')][_0xeb9c('0x4e')]=integrations[_0xeb9c('0x4f')](_0x144089[_0xeb9c('0x44')]['channel'],_0x144089[_0xeb9c('0x44')][_0xeb9c('0x3b')]);return db[_0xeb9c('0x47')]['create'](_0x144089['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xeb9c('0x4b')},{'model':db[_0xeb9c('0x50')],'as':_0xeb9c('0x4e')}]});}return null;})[_0xeb9c('0x21')](respondWithResult(_0x5a0230,null))['catch'](handleError(_0x5a0230,null));};exports[_0xeb9c('0x51')]=function(_0x2c10fa,_0x2a2423,_0x5d1d05){var _0x1f3b08='';var _0x21d2e4='';return db[_0xeb9c('0x29')][_0xeb9c('0x46')]({'where':{'id':_0x2c10fa[_0xeb9c('0x40')]['id']},'attributes':['id',_0xeb9c('0x52'),'remoteUri',_0xeb9c('0x53')]})[_0xeb9c('0x21')](handleEntityNotFound(_0x2a2423,null))['then'](function(_0x3b46cc){if(_0x3b46cc){_0x21d2e4=_0x3b46cc['username'];_0x1f3b08=_0x3b46cc[_0xeb9c('0x54')];var _0xda5fe8=_0x3b46cc['remoteUri'][_0xeb9c('0x55')](-0x1);if(_0xda5fe8==='/'){_0x1f3b08=_0x1f3b08['substring'](0x0,_0x1f3b08[_0xeb9c('0x56')](_0xda5fe8));}return rp({'method':_0xeb9c('0x57'),'uri':util['format'](_0xeb9c('0x58'),_0x1f3b08,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x3b46cc[_0xeb9c('0x53')]},'json':!![]});}})['then'](function(_0x20f752){if(_0x20f752){var _0x5bcbe5=_0x20f752[_0xeb9c('0x59')];var _0x539ecc=![];var _0x36d145=null;for(_0x36d145=0x0;_0x36d145<_0x5bcbe5[_0xeb9c('0x32')];_0x36d145++){if(_0x5bcbe5[_0x36d145][_0xeb9c('0x5a')]===_0x21d2e4){_0x539ecc=!![];}}if(_0x539ecc){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xeb9c('0x21')](respondWithResult(_0x2a2423,null))[_0xeb9c('0x3e')](function(_0x43770d){var _0x247e2e=_0x2c10fa[_0xeb9c('0x2d')][_0xeb9c('0x5b')]?0x1f4:_0x43770d['statusCode']||0x1f4;logger[_0xeb9c('0x23')](_0xeb9c('0x5c'),_0xeb9c('0x51'),_0x247e2e,JSON[_0xeb9c('0x5d')](_0x43770d));delete _0x43770d[_0xeb9c('0x25')];if(_0x247e2e===0x191){_0x247e2e=0x190;}_0x2a2423['status'](_0x247e2e)['send'](_0x2c10fa[_0xeb9c('0x2d')][_0xeb9c('0x5b')]?{'message':_0xeb9c('0x5e'),'statusCode':_0x43770d['statusCode']}:_0x43770d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index b1adde8..fd8aecb 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 _0x5fdc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','lodash','util','../../config/logger','api'];(function(_0x126bdd,_0x4e5a7a){var _0x1c872c=function(_0x27de3d){while(--_0x27de3d){_0x126bdd['push'](_0x126bdd['shift']());}};_0x1c872c(++_0x4e5a7a);}(_0x5fdc,0x127));var _0xc5fd=function(_0x4469a5,_0x35fd14){_0x4469a5=_0x4469a5-0x0;var _0x18f92d=_0x5fdc[_0x4469a5];return _0x18f92d;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var logger=require(_0xc5fd('0x2'))(_0xc5fd('0x3'));var moment=require(_0xc5fd('0x4'));var BPromise=require(_0xc5fd('0x5'));var rp=require(_0xc5fd('0x6'));var fs=require('fs');var path=require(_0xc5fd('0x7'));var rimraf=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var attributes=require(_0xc5fd('0xa'));var integrations=require(_0xc5fd('0xb'));module[_0xc5fd('0xc')]=function(_0x216902,_0x15ffe7){return _0x216902['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','bluebird','request-promise','path'];(function(_0x248011,_0x1680da){var _0x442b35=function(_0xd73fec){while(--_0xd73fec){_0x248011['push'](_0x248011['shift']());}};_0x442b35(++_0x1680da);}(_0x7096,0x10c));var _0x6709=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x7096[_0xa1e3e3];return _0xc980e9;};'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'));var integrations=require(_0x6709('0x8'));module[_0x6709('0x9')]=function(_0xa35832,_0x3e2223){return _0xa35832[_0x6709('0xa')](_0x6709('0xb'),attributes,{'tableName':_0x6709('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index fe5ecd1..62b9910 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 _0x187d=['error','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','include','model','find','where','map','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x286f25,_0x382ea6){var _0x35fdaf=function(_0x2639a7){while(--_0x2639a7){_0x286f25['push'](_0x286f25['shift']());}};_0x35fdaf(++_0x382ea6);}(_0x187d,0x93));var _0xd187=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x187d[_0x138f59];return _0x3d114d;};'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')]('FreshsalesAccount,\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')]('GetFreshsalesAccount',_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['ShowFreshsalesAccount']=function(_0x140e54){var _0xb38778=this;return new Promise(function(_0x5bba10,_0x4cc587){return db[_0xd187('0x16')][_0xd187('0x1d')]({'raw':_0x140e54[_0xd187('0x18')]?_0x140e54[_0xd187('0x18')][_0xd187('0x19')]===undefined?!![]:![]:!![],'where':_0x140e54[_0xd187('0x18')]?_0x140e54[_0xd187('0x18')][_0xd187('0x1e')]||null:null,'attributes':_0x140e54['options']?_0x140e54[_0xd187('0x18')][_0xd187('0x1a')]||null:null,'include':_0x140e54[_0xd187('0x18')]?_0x140e54['options'][_0xd187('0x1b')]?_['map'](_0x140e54[_0xd187('0x18')][_0xd187('0x1b')],function(_0xf5b94e){return{'model':db[_0xf5b94e['model']],'as':_0xf5b94e['as'],'attributes':_0xf5b94e['attributes'],'include':_0xf5b94e[_0xd187('0x1b')]?_[_0xd187('0x1f')](_0xf5b94e['include'],function(_0x4591e0){return{'model':db[_0x4591e0[_0xd187('0x1c')]],'as':_0x4591e0['as'],'attributes':_0x4591e0[_0xd187('0x1a')],'include':_0x4591e0['include']?_['map'](_0x4591e0[_0xd187('0x1b')],function(_0xf32da2){return{'model':db[_0xf32da2['model']],'as':_0xf32da2['as'],'attributes':_0xf32da2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31d7f4){logger['info'](_0xd187('0x20'),_0x140e54);logger[_0xd187('0xf')]('ShowFreshsalesAccount',_0x140e54,JSON[_0xd187('0x11')](_0x31d7f4));_0x5bba10(_0x31d7f4);})['catch'](function(_0x293ce9){logger[_0xd187('0x12')]('ShowFreshsalesAccount',_0x293ce9[_0xd187('0x13')],_0x140e54);_0x4cc587(_0xb38778[_0xd187('0x12')](0x1f4,_0x293ce9['message']));});});}; \ No newline at end of file +var _0xfcf0=['request','info','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','FreshsalesAccount','find','ShowFreshsalesAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x13b963,_0x1ac6d3){var _0x3238dd=function(_0x708e91){while(--_0x708e91){_0x13b963['push'](_0x13b963['shift']());}};_0x3238dd(++_0x1ac6d3);}(_0xfcf0,0x138));var _0x0fcf=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0xfcf0[_0x310504];return _0x5b36d0;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});}exports[_0x0fcf('0x15')]=function(_0x19cfbd){var _0x567320=this;return new Promise(function(_0x18ea32,_0x1a8f58){return db['FreshsalesAccount'][_0x0fcf('0x16')]({'raw':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1a')]||null:null,'limit':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x1b')]||null:null,'include':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x19cfbd[_0x0fcf('0x17')]['include'],function(_0x2eef74){return{'model':db[_0x2eef74[_0x0fcf('0x1e')]],'as':_0x2eef74['as'],'attributes':_0x2eef74[_0x0fcf('0x1a')],'include':_0x2eef74[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x2eef74[_0x0fcf('0x1c')],function(_0x2ce990){return{'model':db[_0x2ce990[_0x0fcf('0x1e')]],'as':_0x2ce990['as'],'attributes':_0x2ce990[_0x0fcf('0x1a')],'include':_0x2ce990['include']?_[_0x0fcf('0x1d')](_0x2ce990[_0x0fcf('0x1c')],function(_0x41b7a2){return{'model':db[_0x41b7a2[_0x0fcf('0x1e')]],'as':_0x41b7a2['as'],'attributes':_0x41b7a2[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0fcf('0x1f')](function(_0x2730b0){logger['info'](_0x0fcf('0x15'),_0x19cfbd);logger[_0x0fcf('0xf')](_0x0fcf('0x15'),_0x19cfbd,JSON[_0x0fcf('0x11')](_0x2730b0));_0x18ea32(_0x2730b0);})['catch'](function(_0x5d9bcd){logger['error'](_0x0fcf('0x15'),_0x5d9bcd['message'],_0x19cfbd);_0x1a8f58(_0x567320[_0x0fcf('0x12')](0x1f4,_0x5d9bcd[_0x0fcf('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0xdfd3ec){var _0x117041=this;return new Promise(function(_0xa52f52,_0x161496){return db[_0x0fcf('0x20')][_0x0fcf('0x21')]({'raw':_0xdfd3ec['options']?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec['options'][_0x0fcf('0x1a')]||null:null,'include':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')],function(_0x344957){return{'model':db[_0x344957[_0x0fcf('0x1e')]],'as':_0x344957['as'],'attributes':_0x344957[_0x0fcf('0x1a')],'include':_0x344957[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x344957[_0x0fcf('0x1c')],function(_0x17346e){return{'model':db[_0x17346e['model']],'as':_0x17346e['as'],'attributes':_0x17346e['attributes'],'include':_0x17346e[_0x0fcf('0x1c')]?_['map'](_0x17346e['include'],function(_0x1a1e07){return{'model':db[_0x1a1e07[_0x0fcf('0x1e')]],'as':_0x1a1e07['as'],'attributes':_0x1a1e07[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e635){logger[_0x0fcf('0xd')](_0x0fcf('0x22'),_0xdfd3ec);logger[_0x0fcf('0xf')]('ShowFreshsalesAccount',_0xdfd3ec,JSON[_0x0fcf('0x11')](_0x57e635));_0xa52f52(_0x57e635);})[_0x0fcf('0x23')](function(_0x29067e){logger['error']('ShowFreshsalesAccount',_0x29067e['message'],_0xdfd3ec);_0x161496(_0x117041[_0x0fcf('0x12')](0x1f4,_0x29067e[_0x0fcf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 49f99f6..7c64241 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 _0xbf3a=['index','get','show','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','isAuthenticated'];(function(_0x2d09cf,_0x3e5d70){var _0x5858a2=function(_0x12f92f){while(--_0x12f92f){_0x2d09cf['push'](_0x2d09cf['shift']());}};_0x5858a2(++_0x3e5d70);}(_0xbf3a,0x1c6));var _0xabf3=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0xbf3a[_0x4695ba];return _0x524b7d;};'use strict';var multer=require(_0xabf3('0x0'));var util=require(_0xabf3('0x1'));var path=require('path');var timeout=require(_0xabf3('0x2'));var express=require('express');var router=express[_0xabf3('0x3')]();var fs_extra=require(_0xabf3('0x4'));var auth=require(_0xabf3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xabf3('0x6'));router['get']('/',auth[_0xabf3('0x7')](),controller[_0xabf3('0x8')]);router[_0xabf3('0x9')]('/:id',auth[_0xabf3('0x7')](),controller[_0xabf3('0xa')]);router[_0xabf3('0x9')]('/:id/subjects',auth[_0xabf3('0x7')](),controller['getSubjects']);router[_0xabf3('0x9')](_0xabf3('0xb'),auth['isAuthenticated'](),controller[_0xabf3('0xc')]);router[_0xabf3('0x9')](_0xabf3('0xd'),auth['isAuthenticated'](),controller[_0xabf3('0xe')]);router[_0xabf3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xabf3('0x10')](_0xabf3('0x11'),auth['isAuthenticated'](),controller[_0xabf3('0x12')]);router[_0xabf3('0x13')](_0xabf3('0x11'),auth[_0xabf3('0x7')](),controller[_0xabf3('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8df0=['isAuthenticated','getSubjects','/:id/fields','create','put','update','delete','/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8df0,0x11b));var _0x08df=function(_0x4f093a,_0x388369){_0x4f093a=_0x4f093a-0x0;var _0x8f7a31=_0x8df0[_0x4f093a];return _0x8f7a31;};'use strict';var multer=require('multer');var util=require(_0x08df('0x0'));var path=require(_0x08df('0x1'));var timeout=require('connect-timeout');var express=require(_0x08df('0x2'));var router=express[_0x08df('0x3')]();var fs_extra=require(_0x08df('0x4'));var auth=require(_0x08df('0x5'));var interaction=require(_0x08df('0x6'));var config=require(_0x08df('0x7'));var controller=require(_0x08df('0x8'));router[_0x08df('0x9')]('/',auth['isAuthenticated'](),controller[_0x08df('0xa')]);router[_0x08df('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x08df('0x9')]('/:id/subjects',auth[_0x08df('0xb')](),controller[_0x08df('0xc')]);router['get']('/:id/descriptions',auth[_0x08df('0xb')](),controller['getDescriptions']);router[_0x08df('0x9')](_0x08df('0xd'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x08df('0xe')]);router[_0x08df('0xf')]('/:id',auth[_0x08df('0xb')](),controller[_0x08df('0x10')]);router[_0x08df('0x11')](_0x08df('0x12'),auth[_0x08df('0xb')](),controller[_0x08df('0x13')]);module[_0x08df('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 906aeb0..a8b1530 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 _0xeece=['exports','STRING'];(function(_0x2e0ec0,_0x348b69){var _0x299b51=function(_0x4c715d){while(--_0x4c715d){_0x2e0ec0['push'](_0x2e0ec0['shift']());}};_0x299b51(++_0x348b69);}(_0xeece,0x114));var _0xeeec=function(_0x33deb7,_0x25181a){_0x33deb7=_0x33deb7-0x0;var _0x3dfeeb=_0xeece[_0x33deb7];return _0x3dfeeb;};'use strict';var Sequelize=require('sequelize');module[_0xeeec('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeeec('0x1')]}}; \ No newline at end of file +var _0xa2c7=['STRING','sequelize','exports'];(function(_0x242e80,_0x3516ae){var _0x4ef013=function(_0x2ed81c){while(--_0x2ed81c){_0x242e80['push'](_0x242e80['shift']());}};_0x4ef013(++_0x3516ae);}(_0xa2c7,0x121));var _0x7a2c=function(_0x4e0026,_0x2b52b6){_0x4e0026=_0x4e0026-0x0;var _0x3f8ee7=_0xa2c7[_0x4e0026];return _0x3f8ee7;};'use strict';var Sequelize=require(_0x7a2c('0x0'));module[_0x7a2c('0x1')]={'name':{'type':Sequelize[_0x7a2c('0x2')]},'description':{'type':Sequelize[_0x7a2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 4de2ef0..b7e4ecb 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 _0xc21d=['type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','FreshsalesConfiguration','includeAll','rows','catch','show','params','keys','length','include','merge','options','find','create','body','update','getSubjects','findOne','FreshsalesField','order','pick','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName'];(function(_0x319a88,_0x374983){var _0xd9c984=function(_0x280841){while(--_0x280841){_0x319a88['push'](_0x319a88['shift']());}};_0xd9c984(++_0x374983);}(_0xc21d,0x73));var _0xdc21=function(_0x57d4c4,_0x1eb1c7){_0x57d4c4=_0x57d4c4-0x0;var _0x551561=_0xc21d[_0x57d4c4];return _0x551561;};'use strict';var emlformat=require(_0xdc21('0x0'));var rimraf=require(_0xdc21('0x1'));var zipdir=require(_0xdc21('0x2'));var jsonpatch=require(_0xdc21('0x3'));var rp=require(_0xdc21('0x4'));var moment=require(_0xdc21('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc21('0x6'));var util=require('util');var path=require(_0xdc21('0x7'));var sox=require(_0xdc21('0x8'));var csv=require(_0xdc21('0x9'));var ejs=require(_0xdc21('0xa'));var fs=require('fs');var fs_extra=require(_0xdc21('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdc21('0xc'));var jsforce=require(_0xdc21('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdc21('0x9'));var querystring=require(_0xdc21('0xe'));var Papa=require(_0xdc21('0xf'));var Redis=require(_0xdc21('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdc21('0x11'));var hardwareService=require(_0xdc21('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdc21('0x13'));var db=require(_0xdc21('0x14'))['db'];function respondWithStatusCode(_0x119dad,_0x28b214){_0x28b214=_0x28b214||0xcc;return function(_0x2284f9){if(_0x2284f9){return _0x119dad[_0xdc21('0x15')](_0x28b214);}return _0x119dad[_0xdc21('0x16')](_0x28b214)[_0xdc21('0x17')]();};}function respondWithResult(_0x4bb5a3,_0x3e0950){_0x3e0950=_0x3e0950||0xc8;return function(_0x229fde){if(_0x229fde){return _0x4bb5a3[_0xdc21('0x16')](_0x3e0950)['json'](_0x229fde);}};}function respondWithFilteredResult(_0x45a799,_0x1b709f){return function(_0x1f2129){if(_0x1f2129){var _0x362f27=typeof _0x1b709f['offset']===_0xdc21('0x18')&&typeof _0x1b709f[_0xdc21('0x19')]===_0xdc21('0x18');var _0x498748=_0x1f2129[_0xdc21('0x1a')];var _0x5dee57=_0x362f27?0x0:_0x1b709f[_0xdc21('0x1b')];var _0x1bee97=_0x362f27?_0x1f2129[_0xdc21('0x1a')]:_0x1b709f['offset']+_0x1b709f['limit'];var _0xa707b2;if(_0x1bee97>=_0x498748){_0x1bee97=_0x498748;_0xa707b2=0xc8;}else{_0xa707b2=0xce;}_0x45a799[_0xdc21('0x16')](_0xa707b2);return _0x45a799[_0xdc21('0x1c')](_0xdc21('0x1d'),_0x5dee57+'-'+_0x1bee97+'/'+_0x498748)[_0xdc21('0x1e')](_0x1f2129);}return null;};}function patchUpdates(_0x3aaba4){return function(_0x9fa2e2){try{jsonpatch[_0xdc21('0x1f')](_0x9fa2e2,_0x3aaba4,!![]);}catch(_0x15c7e0){return BPromise[_0xdc21('0x20')](_0x15c7e0);}return _0x9fa2e2[_0xdc21('0x21')]();};}function saveUpdates(_0x7abf16,_0x3bc869){return function(_0x4f94ff){if(_0x4f94ff){return _0x4f94ff['update'](_0x7abf16)[_0xdc21('0x22')](function(_0x54e87b){return _0x54e87b;});}return null;};}function removeEntity(_0x20c17b,_0x4b07e7){return function(_0xc821c2){if(_0xc821c2){return _0xc821c2[_0xdc21('0x23')]()['then'](function(){_0x20c17b[_0xdc21('0x16')](0xcc)[_0xdc21('0x17')]();});}};}function handleEntityNotFound(_0x290716,_0x567a79){return function(_0x149cf6){if(!_0x149cf6){_0x290716[_0xdc21('0x15')](0x194);}return _0x149cf6;};}function handleError(_0x2a00ce,_0x27236e){_0x27236e=_0x27236e||0x1f4;return function(_0x3a969d){logger[_0xdc21('0x24')](_0x3a969d['stack']);if(_0x3a969d[_0xdc21('0x25')]){delete _0x3a969d[_0xdc21('0x25')];}_0x2a00ce['status'](_0x27236e)[_0xdc21('0x26')](_0x3a969d);};}exports[_0xdc21('0x27')]=function(_0x596300,_0x2913e9){var _0xaf27ee={},_0x3f443e={},_0xe39cb0={'count':0x0,'rows':[]};var _0x2cd79a=_[_0xdc21('0x28')](db['FreshsalesConfiguration'][_0xdc21('0x29')],function(_0x877f08){return{'name':_0x877f08[_0xdc21('0x2a')],'type':_0x877f08[_0xdc21('0x2b')][_0xdc21('0x2c')]};});_0x3f443e[_0xdc21('0x2d')]=_[_0xdc21('0x28')](_0x2cd79a,_0xdc21('0x25'));_0x3f443e[_0xdc21('0x2e')]=_['keys'](_0x596300[_0xdc21('0x2e')]);_0x3f443e[_0xdc21('0x2f')]=_[_0xdc21('0x30')](_0x3f443e[_0xdc21('0x2d')],_0x3f443e[_0xdc21('0x2e')]);_0xaf27ee[_0xdc21('0x31')]=_['intersection'](_0x3f443e[_0xdc21('0x2d')],qs[_0xdc21('0x32')](_0x596300[_0xdc21('0x2e')][_0xdc21('0x32')]));_0xaf27ee[_0xdc21('0x31')]=_0xaf27ee[_0xdc21('0x31')]['length']?_0xaf27ee[_0xdc21('0x31')]:_0x3f443e['model'];if(!_0x596300['query'][_0xdc21('0x33')](_0xdc21('0x34'))){_0xaf27ee[_0xdc21('0x19')]=qs[_0xdc21('0x19')](_0x596300[_0xdc21('0x2e')][_0xdc21('0x19')]);_0xaf27ee[_0xdc21('0x1b')]=qs[_0xdc21('0x1b')](_0x596300[_0xdc21('0x2e')][_0xdc21('0x1b')]);}_0xaf27ee['order']=qs[_0xdc21('0x35')](_0x596300['query']['sort']);_0xaf27ee[_0xdc21('0x36')]=qs[_0xdc21('0x2f')](_['pick'](_0x596300[_0xdc21('0x2e')],_0x3f443e['filters']),_0x2cd79a);if(_0x596300[_0xdc21('0x2e')][_0xdc21('0x37')]){_0xaf27ee['where']=_['merge'](_0xaf27ee[_0xdc21('0x36')],{'$or':_['map'](_0x2cd79a,function(_0x1c56ae){if(_0x1c56ae[_0xdc21('0x2b')]!==_0xdc21('0x38')){var _0x390437={};_0x390437[_0x1c56ae[_0xdc21('0x25')]]={'$like':'%'+_0x596300[_0xdc21('0x2e')]['filter']+'%'};return _0x390437;}})});}_0xaf27ee=_['merge']({},_0xaf27ee,_0x596300['options']);var _0x4d7f8c={'where':_0xaf27ee[_0xdc21('0x36')]};return db[_0xdc21('0x39')][_0xdc21('0x1a')](_0x4d7f8c)[_0xdc21('0x22')](function(_0x7bc08e){_0xe39cb0['count']=_0x7bc08e;if(_0x596300[_0xdc21('0x2e')][_0xdc21('0x3a')]){_0xaf27ee['include']=[{'all':!![]}];}return db[_0xdc21('0x39')]['findAll'](_0xaf27ee);})[_0xdc21('0x22')](function(_0x2703bb){_0xe39cb0[_0xdc21('0x3b')]=_0x2703bb;return _0xe39cb0;})[_0xdc21('0x22')](respondWithFilteredResult(_0x2913e9,_0xaf27ee))[_0xdc21('0x3c')](handleError(_0x2913e9,null));};exports[_0xdc21('0x3d')]=function(_0x5e086f,_0x729a40){var _0x40cf3b={'raw':![],'where':{'id':_0x5e086f[_0xdc21('0x3e')]['id']}},_0x17d96b={};_0x17d96b[_0xdc21('0x2d')]=_[_0xdc21('0x3f')](db['FreshsalesConfiguration'][_0xdc21('0x29')]);_0x17d96b[_0xdc21('0x2e')]=_[_0xdc21('0x3f')](_0x5e086f[_0xdc21('0x2e')]);_0x17d96b[_0xdc21('0x2f')]=_[_0xdc21('0x30')](_0x17d96b[_0xdc21('0x2d')],_0x17d96b['query']);_0x40cf3b[_0xdc21('0x31')]=_['intersection'](_0x17d96b[_0xdc21('0x2d')],qs[_0xdc21('0x32')](_0x5e086f[_0xdc21('0x2e')][_0xdc21('0x32')]));_0x40cf3b['attributes']=_0x40cf3b['attributes'][_0xdc21('0x40')]?_0x40cf3b[_0xdc21('0x31')]:_0x17d96b[_0xdc21('0x2d')];if(_0x5e086f['query'][_0xdc21('0x3a')]){_0x40cf3b[_0xdc21('0x41')]=[{'all':!![]}];}_0x40cf3b=_[_0xdc21('0x42')]({},_0x40cf3b,_0x5e086f[_0xdc21('0x43')]);return db[_0xdc21('0x39')][_0xdc21('0x44')](_0x40cf3b)[_0xdc21('0x22')](handleEntityNotFound(_0x729a40,null))[_0xdc21('0x22')](respondWithResult(_0x729a40,null))[_0xdc21('0x3c')](handleError(_0x729a40,null));};exports[_0xdc21('0x45')]=function(_0x2e7a9f,_0x2fd137){return db['FreshsalesConfiguration'][_0xdc21('0x45')](_0x2e7a9f[_0xdc21('0x46')],{})[_0xdc21('0x22')](respondWithResult(_0x2fd137,0xc9))[_0xdc21('0x3c')](handleError(_0x2fd137,null));};exports[_0xdc21('0x47')]=function(_0x1ac46b,_0x5c79ba){if(_0x1ac46b[_0xdc21('0x46')]['id']){delete _0x1ac46b[_0xdc21('0x46')]['id'];}return db[_0xdc21('0x39')]['find']({'where':{'id':_0x1ac46b[_0xdc21('0x3e')]['id']}})[_0xdc21('0x22')](handleEntityNotFound(_0x5c79ba,null))[_0xdc21('0x22')](saveUpdates(_0x1ac46b[_0xdc21('0x46')],null))[_0xdc21('0x22')](respondWithResult(_0x5c79ba,null))[_0xdc21('0x3c')](handleError(_0x5c79ba,null));};exports[_0xdc21('0x23')]=function(_0x58759c,_0x4dcf01){return db['FreshsalesConfiguration'][_0xdc21('0x44')]({'where':{'id':_0x58759c[_0xdc21('0x3e')]['id']}})[_0xdc21('0x22')](handleEntityNotFound(_0x4dcf01,null))['then'](removeEntity(_0x4dcf01,null))[_0xdc21('0x3c')](handleError(_0x4dcf01,null));};exports[_0xdc21('0x48')]=function(_0x4be7c4,_0x5359e6,_0x13c675){var _0x3f14e1={};var _0x1e5507={};var _0x4dff50;var _0x2df8eb;return db[_0xdc21('0x39')][_0xdc21('0x49')]({'where':{'id':_0x4be7c4[_0xdc21('0x3e')]['id']}})[_0xdc21('0x22')](handleEntityNotFound(_0x5359e6,null))[_0xdc21('0x22')](function(_0x507758){if(_0x507758){_0x4dff50=_0x507758;_0x1e5507[_0xdc21('0x2d')]=_[_0xdc21('0x3f')](db[_0xdc21('0x4a')][_0xdc21('0x29')]);_0x1e5507[_0xdc21('0x2e')]=_[_0xdc21('0x3f')](_0x4be7c4['query']);_0x1e5507[_0xdc21('0x2f')]=_[_0xdc21('0x30')](_0x1e5507[_0xdc21('0x2d')],_0x1e5507['query']);_0x3f14e1[_0xdc21('0x31')]=_[_0xdc21('0x30')](_0x1e5507[_0xdc21('0x2d')],qs[_0xdc21('0x32')](_0x4be7c4[_0xdc21('0x2e')]['fields']));_0x3f14e1[_0xdc21('0x31')]=_0x3f14e1[_0xdc21('0x31')][_0xdc21('0x40')]?_0x3f14e1['attributes']:_0x1e5507['model'];_0x3f14e1[_0xdc21('0x4b')]=qs[_0xdc21('0x35')](_0x4be7c4[_0xdc21('0x2e')][_0xdc21('0x35')]);_0x3f14e1['where']=qs['filters'](_[_0xdc21('0x4c')](_0x4be7c4['query'],_0x1e5507[_0xdc21('0x2f')]));if(_0x4be7c4[_0xdc21('0x2e')]['filter']){_0x3f14e1[_0xdc21('0x36')]=_[_0xdc21('0x42')](_0x3f14e1[_0xdc21('0x36')],{'$or':_[_0xdc21('0x28')](_0x3f14e1['attributes'],function(_0x59c5b4){var _0x5dcad0={};_0x5dcad0[_0x59c5b4]={'$like':'%'+_0x4be7c4[_0xdc21('0x2e')][_0xdc21('0x37')]+'%'};return _0x5dcad0;})});}_0x3f14e1=_[_0xdc21('0x42')]({},_0x3f14e1,_0x4be7c4['options']);return _0x4dff50[_0xdc21('0x48')](_0x3f14e1);}})['then'](function(_0x37b912){if(_0x37b912){_0x2df8eb=_0x37b912[_0xdc21('0x40')];if(!_0x4be7c4[_0xdc21('0x2e')][_0xdc21('0x33')](_0xdc21('0x34'))){_0x3f14e1[_0xdc21('0x19')]=qs['limit'](_0x4be7c4[_0xdc21('0x2e')][_0xdc21('0x19')]);_0x3f14e1[_0xdc21('0x1b')]=qs[_0xdc21('0x1b')](_0x4be7c4['query'][_0xdc21('0x1b')]);}return _0x4dff50['getSubjects'](_0x3f14e1);}})['then'](function(_0x2fda81){if(_0x2fda81){return _0x2fda81?{'count':_0x2df8eb,'rows':_0x2fda81}:null;}})[_0xdc21('0x22')](respondWithResult(_0x5359e6,null))[_0xdc21('0x3c')](handleError(_0x5359e6,null));};exports[_0xdc21('0x4d')]=function(_0x84916e,_0x9df67b,_0x3fcfa3){var _0x122faa={};var _0x584ca1={};var _0x1163b8;var _0x2c8324;return db[_0xdc21('0x39')][_0xdc21('0x49')]({'where':{'id':_0x84916e[_0xdc21('0x3e')]['id']}})[_0xdc21('0x22')](handleEntityNotFound(_0x9df67b,null))[_0xdc21('0x22')](function(_0x1558c2){if(_0x1558c2){_0x1163b8=_0x1558c2;_0x584ca1[_0xdc21('0x2d')]=_['keys'](db[_0xdc21('0x4a')][_0xdc21('0x29')]);_0x584ca1[_0xdc21('0x2e')]=_[_0xdc21('0x3f')](_0x84916e[_0xdc21('0x2e')]);_0x584ca1['filters']=_[_0xdc21('0x30')](_0x584ca1[_0xdc21('0x2d')],_0x584ca1['query']);_0x122faa['attributes']=_['intersection'](_0x584ca1[_0xdc21('0x2d')],qs[_0xdc21('0x32')](_0x84916e[_0xdc21('0x2e')][_0xdc21('0x32')]));_0x122faa[_0xdc21('0x31')]=_0x122faa[_0xdc21('0x31')][_0xdc21('0x40')]?_0x122faa[_0xdc21('0x31')]:_0x584ca1[_0xdc21('0x2d')];_0x122faa[_0xdc21('0x4b')]=qs['sort'](_0x84916e[_0xdc21('0x2e')]['sort']);_0x122faa[_0xdc21('0x36')]=qs[_0xdc21('0x2f')](_[_0xdc21('0x4c')](_0x84916e[_0xdc21('0x2e')],_0x584ca1[_0xdc21('0x2f')]));if(_0x84916e[_0xdc21('0x2e')][_0xdc21('0x37')]){_0x122faa['where']=_[_0xdc21('0x42')](_0x122faa[_0xdc21('0x36')],{'$or':_[_0xdc21('0x28')](_0x122faa[_0xdc21('0x31')],function(_0x331ecc){var _0x2a1219={};_0x2a1219[_0x331ecc]={'$like':'%'+_0x84916e[_0xdc21('0x2e')][_0xdc21('0x37')]+'%'};return _0x2a1219;})});}_0x122faa=_[_0xdc21('0x42')]({},_0x122faa,_0x84916e[_0xdc21('0x43')]);return _0x1163b8['getDescriptions'](_0x122faa);}})[_0xdc21('0x22')](function(_0x45bf12){if(_0x45bf12){_0x2c8324=_0x45bf12[_0xdc21('0x40')];if(!_0x84916e[_0xdc21('0x2e')][_0xdc21('0x33')](_0xdc21('0x34'))){_0x122faa[_0xdc21('0x19')]=qs[_0xdc21('0x19')](_0x84916e['query'][_0xdc21('0x19')]);_0x122faa[_0xdc21('0x1b')]=qs['offset'](_0x84916e['query'][_0xdc21('0x1b')]);}return _0x1163b8[_0xdc21('0x4d')](_0x122faa);}})[_0xdc21('0x22')](function(_0xcd6d5d){if(_0xcd6d5d){return _0xcd6d5d?{'count':_0x2c8324,'rows':_0xcd6d5d}:null;}})[_0xdc21('0x22')](respondWithResult(_0x9df67b,null))[_0xdc21('0x3c')](handleError(_0x9df67b,null));};exports[_0xdc21('0x4e')]=function(_0x1ac215,_0x19c396,_0x4aec4d){var _0x4a9875={};var _0x40ca9e={};var _0x3c3a96;var _0x353c6d;return db['FreshsalesConfiguration'][_0xdc21('0x49')]({'where':{'id':_0x1ac215[_0xdc21('0x3e')]['id']}})[_0xdc21('0x22')](handleEntityNotFound(_0x19c396,null))[_0xdc21('0x22')](function(_0xe05038){if(_0xe05038){_0x3c3a96=_0xe05038;_0x40ca9e[_0xdc21('0x2d')]=_['keys'](db['FreshsalesField'][_0xdc21('0x29')]);_0x40ca9e['query']=_[_0xdc21('0x3f')](_0x1ac215[_0xdc21('0x2e')]);_0x40ca9e[_0xdc21('0x2f')]=_[_0xdc21('0x30')](_0x40ca9e[_0xdc21('0x2d')],_0x40ca9e[_0xdc21('0x2e')]);_0x4a9875[_0xdc21('0x31')]=_[_0xdc21('0x30')](_0x40ca9e[_0xdc21('0x2d')],qs[_0xdc21('0x32')](_0x1ac215[_0xdc21('0x2e')][_0xdc21('0x32')]));_0x4a9875[_0xdc21('0x31')]=_0x4a9875['attributes'][_0xdc21('0x40')]?_0x4a9875[_0xdc21('0x31')]:_0x40ca9e[_0xdc21('0x2d')];_0x4a9875[_0xdc21('0x4b')]=qs['sort'](_0x1ac215['query']['sort']);_0x4a9875[_0xdc21('0x36')]=qs['filters'](_[_0xdc21('0x4c')](_0x1ac215['query'],_0x40ca9e[_0xdc21('0x2f')]));if(_0x1ac215['query'][_0xdc21('0x37')]){_0x4a9875['where']=_[_0xdc21('0x42')](_0x4a9875['where'],{'$or':_[_0xdc21('0x28')](_0x4a9875[_0xdc21('0x31')],function(_0x4ca5ef){var _0x28a787={};_0x28a787[_0x4ca5ef]={'$like':'%'+_0x1ac215[_0xdc21('0x2e')][_0xdc21('0x37')]+'%'};return _0x28a787;})});}_0x4a9875=_[_0xdc21('0x42')]({},_0x4a9875,_0x1ac215[_0xdc21('0x43')]);return _0x3c3a96[_0xdc21('0x4e')](_0x4a9875);}})[_0xdc21('0x22')](function(_0x2d74ab){if(_0x2d74ab){_0x353c6d=_0x2d74ab[_0xdc21('0x40')];if(!_0x1ac215['query'][_0xdc21('0x33')]('nolimit')){_0x4a9875[_0xdc21('0x19')]=qs[_0xdc21('0x19')](_0x1ac215[_0xdc21('0x2e')][_0xdc21('0x19')]);_0x4a9875[_0xdc21('0x1b')]=qs[_0xdc21('0x1b')](_0x1ac215[_0xdc21('0x2e')][_0xdc21('0x1b')]);}return _0x3c3a96[_0xdc21('0x4e')](_0x4a9875);}})['then'](function(_0x4c6177){if(_0x4c6177){return _0x4c6177?{'count':_0x353c6d,'rows':_0x4c6177}:null;}})[_0xdc21('0x22')](respondWithResult(_0x19c396,null))[_0xdc21('0x3c')](handleError(_0x19c396,null));}; \ No newline at end of file +var _0xfa06=['limit','status','Content-Range','apply','reject','save','then','destroy','error','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','options','findAll','catch','show','params','FreshsalesConfiguration','includeAll','merge','find','create','update','body','findOne','pick','getSubjects','getDescriptions','getFields','eml-format','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count'];(function(_0x1e2b25,_0x20877b){var _0x110982=function(_0x4f3fda){while(--_0x4f3fda){_0x1e2b25['push'](_0x1e2b25['shift']());}};_0x110982(++_0x20877b);}(_0xfa06,0xc4));var _0x6fa0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfa06[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x6fa0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6fa0('0x1'));var BPromise=require(_0x6fa0('0x2'));var Mustache=require(_0x6fa0('0x3'));var util=require(_0x6fa0('0x4'));var path=require(_0x6fa0('0x5'));var sox=require(_0x6fa0('0x6'));var csv=require('to-csv');var ejs=require(_0x6fa0('0x7'));var fs=require('fs');var fs_extra=require(_0x6fa0('0x8'));var _=require(_0x6fa0('0x9'));var squel=require(_0x6fa0('0xa'));var crypto=require(_0x6fa0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6fa0('0xc'));var toCsv=require(_0x6fa0('0xd'));var querystring=require(_0x6fa0('0xe'));var Papa=require(_0x6fa0('0xf'));var Redis=require(_0x6fa0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6fa0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fa0('0x12'));var logger=require(_0x6fa0('0x13'))(_0x6fa0('0x14'));var utils=require('../../config/utils');var config=require(_0x6fa0('0x15'));var licenseUtil=require(_0x6fa0('0x16'));var db=require(_0x6fa0('0x17'))['db'];function respondWithStatusCode(_0x5b3ba0,_0x4958fb){_0x4958fb=_0x4958fb||0xcc;return function(_0x59ec18){if(_0x59ec18){return _0x5b3ba0[_0x6fa0('0x18')](_0x4958fb);}return _0x5b3ba0['status'](_0x4958fb)['end']();};}function respondWithResult(_0xedddd6,_0x504607){_0x504607=_0x504607||0xc8;return function(_0x499bd5){if(_0x499bd5){return _0xedddd6['status'](_0x504607)[_0x6fa0('0x19')](_0x499bd5);}};}function respondWithFilteredResult(_0x2e6861,_0x591cd6){return function(_0x1742fa){if(_0x1742fa){var _0x56444f=typeof _0x591cd6[_0x6fa0('0x1a')]===_0x6fa0('0x1b')&&typeof _0x591cd6['limit']===_0x6fa0('0x1b');var _0x4c0ae4=_0x1742fa[_0x6fa0('0x1c')];var _0x497eba=_0x56444f?0x0:_0x591cd6[_0x6fa0('0x1a')];var _0xf3100=_0x56444f?_0x1742fa[_0x6fa0('0x1c')]:_0x591cd6[_0x6fa0('0x1a')]+_0x591cd6[_0x6fa0('0x1d')];var _0x1d5d54;if(_0xf3100>=_0x4c0ae4){_0xf3100=_0x4c0ae4;_0x1d5d54=0xc8;}else{_0x1d5d54=0xce;}_0x2e6861[_0x6fa0('0x1e')](_0x1d5d54);return _0x2e6861['set'](_0x6fa0('0x1f'),_0x497eba+'-'+_0xf3100+'/'+_0x4c0ae4)[_0x6fa0('0x19')](_0x1742fa);}return null;};}function patchUpdates(_0x32fdbc){return function(_0x24ef5c){try{jsonpatch[_0x6fa0('0x20')](_0x24ef5c,_0x32fdbc,!![]);}catch(_0x5344dc){return BPromise[_0x6fa0('0x21')](_0x5344dc);}return _0x24ef5c[_0x6fa0('0x22')]();};}function saveUpdates(_0x5c17da,_0x11cb66){return function(_0x15bdae){if(_0x15bdae){return _0x15bdae['update'](_0x5c17da)[_0x6fa0('0x23')](function(_0xc76016){return _0xc76016;});}return null;};}function removeEntity(_0xcdc8f4,_0x4f2fec){return function(_0x8dfea1){if(_0x8dfea1){return _0x8dfea1[_0x6fa0('0x24')]()[_0x6fa0('0x23')](function(){_0xcdc8f4[_0x6fa0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbba06d,_0xb273d7){return function(_0x32cd88){if(!_0x32cd88){_0xbba06d[_0x6fa0('0x18')](0x194);}return _0x32cd88;};}function handleError(_0x4bc444,_0x4e03ed){_0x4e03ed=_0x4e03ed||0x1f4;return function(_0x3ad3f4){logger[_0x6fa0('0x25')](_0x3ad3f4['stack']);if(_0x3ad3f4[_0x6fa0('0x26')]){delete _0x3ad3f4[_0x6fa0('0x26')];}_0x4bc444[_0x6fa0('0x1e')](_0x4e03ed)['send'](_0x3ad3f4);};}exports[_0x6fa0('0x27')]=function(_0xf7bc84,_0x1662bb){var _0x1d68a4={},_0x90747c={},_0x2b601b={'count':0x0,'rows':[]};var _0x12ee1a=_[_0x6fa0('0x28')](db['FreshsalesConfiguration'][_0x6fa0('0x29')],function(_0x40d317){return{'name':_0x40d317['fieldName'],'type':_0x40d317['type'][_0x6fa0('0x2a')]};});_0x90747c[_0x6fa0('0x2b')]=_['map'](_0x12ee1a,_0x6fa0('0x26'));_0x90747c[_0x6fa0('0x2c')]=_[_0x6fa0('0x2d')](_0xf7bc84[_0x6fa0('0x2c')]);_0x90747c[_0x6fa0('0x2e')]=_[_0x6fa0('0x2f')](_0x90747c[_0x6fa0('0x2b')],_0x90747c[_0x6fa0('0x2c')]);_0x1d68a4[_0x6fa0('0x30')]=_[_0x6fa0('0x2f')](_0x90747c['model'],qs[_0x6fa0('0x31')](_0xf7bc84[_0x6fa0('0x2c')][_0x6fa0('0x31')]));_0x1d68a4[_0x6fa0('0x30')]=_0x1d68a4[_0x6fa0('0x30')][_0x6fa0('0x32')]?_0x1d68a4[_0x6fa0('0x30')]:_0x90747c[_0x6fa0('0x2b')];if(!_0xf7bc84[_0x6fa0('0x2c')][_0x6fa0('0x33')](_0x6fa0('0x34'))){_0x1d68a4['limit']=qs[_0x6fa0('0x1d')](_0xf7bc84['query'][_0x6fa0('0x1d')]);_0x1d68a4[_0x6fa0('0x1a')]=qs[_0x6fa0('0x1a')](_0xf7bc84[_0x6fa0('0x2c')][_0x6fa0('0x1a')]);}_0x1d68a4[_0x6fa0('0x35')]=qs[_0x6fa0('0x36')](_0xf7bc84['query']['sort']);_0x1d68a4[_0x6fa0('0x37')]=qs[_0x6fa0('0x2e')](_['pick'](_0xf7bc84[_0x6fa0('0x2c')],_0x90747c['filters']),_0x12ee1a);if(_0xf7bc84[_0x6fa0('0x2c')][_0x6fa0('0x38')]){_0x1d68a4[_0x6fa0('0x37')]=_['merge'](_0x1d68a4[_0x6fa0('0x37')],{'$or':_['map'](_0x12ee1a,function(_0x1f4976){if(_0x1f4976[_0x6fa0('0x39')]!=='VIRTUAL'){var _0x53637e={};_0x53637e[_0x1f4976[_0x6fa0('0x26')]]={'$like':'%'+_0xf7bc84[_0x6fa0('0x2c')][_0x6fa0('0x38')]+'%'};return _0x53637e;}})});}_0x1d68a4=_['merge']({},_0x1d68a4,_0xf7bc84[_0x6fa0('0x3a')]);var _0x4103f9={'where':_0x1d68a4[_0x6fa0('0x37')]};return db['FreshsalesConfiguration'][_0x6fa0('0x1c')](_0x4103f9)[_0x6fa0('0x23')](function(_0x5c7244){_0x2b601b[_0x6fa0('0x1c')]=_0x5c7244;if(_0xf7bc84[_0x6fa0('0x2c')]['includeAll']){_0x1d68a4['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x6fa0('0x3b')](_0x1d68a4);})['then'](function(_0x29dd7e){_0x2b601b['rows']=_0x29dd7e;return _0x2b601b;})[_0x6fa0('0x23')](respondWithFilteredResult(_0x1662bb,_0x1d68a4))[_0x6fa0('0x3c')](handleError(_0x1662bb,null));};exports[_0x6fa0('0x3d')]=function(_0x1ffe88,_0x17068a){var _0xcced89={'raw':![],'where':{'id':_0x1ffe88[_0x6fa0('0x3e')]['id']}},_0x2bc595={};_0x2bc595['model']=_[_0x6fa0('0x2d')](db[_0x6fa0('0x3f')][_0x6fa0('0x29')]);_0x2bc595[_0x6fa0('0x2c')]=_[_0x6fa0('0x2d')](_0x1ffe88[_0x6fa0('0x2c')]);_0x2bc595[_0x6fa0('0x2e')]=_[_0x6fa0('0x2f')](_0x2bc595[_0x6fa0('0x2b')],_0x2bc595[_0x6fa0('0x2c')]);_0xcced89[_0x6fa0('0x30')]=_['intersection'](_0x2bc595['model'],qs[_0x6fa0('0x31')](_0x1ffe88[_0x6fa0('0x2c')]['fields']));_0xcced89['attributes']=_0xcced89['attributes'][_0x6fa0('0x32')]?_0xcced89[_0x6fa0('0x30')]:_0x2bc595[_0x6fa0('0x2b')];if(_0x1ffe88['query'][_0x6fa0('0x40')]){_0xcced89['include']=[{'all':!![]}];}_0xcced89=_[_0x6fa0('0x41')]({},_0xcced89,_0x1ffe88[_0x6fa0('0x3a')]);return db[_0x6fa0('0x3f')][_0x6fa0('0x42')](_0xcced89)[_0x6fa0('0x23')](handleEntityNotFound(_0x17068a,null))[_0x6fa0('0x23')](respondWithResult(_0x17068a,null))[_0x6fa0('0x3c')](handleError(_0x17068a,null));};exports[_0x6fa0('0x43')]=function(_0x318673,_0x40feea){return db[_0x6fa0('0x3f')][_0x6fa0('0x43')](_0x318673['body'],{})[_0x6fa0('0x23')](respondWithResult(_0x40feea,0xc9))[_0x6fa0('0x3c')](handleError(_0x40feea,null));};exports[_0x6fa0('0x44')]=function(_0x41b8db,_0xfa289){if(_0x41b8db['body']['id']){delete _0x41b8db['body']['id'];}return db['FreshsalesConfiguration'][_0x6fa0('0x42')]({'where':{'id':_0x41b8db[_0x6fa0('0x3e')]['id']}})[_0x6fa0('0x23')](handleEntityNotFound(_0xfa289,null))['then'](saveUpdates(_0x41b8db[_0x6fa0('0x45')],null))['then'](respondWithResult(_0xfa289,null))['catch'](handleError(_0xfa289,null));};exports[_0x6fa0('0x24')]=function(_0x56cbc0,_0x3ee843){return db[_0x6fa0('0x3f')][_0x6fa0('0x42')]({'where':{'id':_0x56cbc0['params']['id']}})[_0x6fa0('0x23')](handleEntityNotFound(_0x3ee843,null))['then'](removeEntity(_0x3ee843,null))['catch'](handleError(_0x3ee843,null));};exports['getSubjects']=function(_0x4c9fbe,_0x7bdbf6,_0x515fa6){var _0x405ec4={};var _0x126fc4={};var _0x5026a8;var _0x51442c;return db['FreshsalesConfiguration'][_0x6fa0('0x46')]({'where':{'id':_0x4c9fbe[_0x6fa0('0x3e')]['id']}})[_0x6fa0('0x23')](handleEntityNotFound(_0x7bdbf6,null))[_0x6fa0('0x23')](function(_0x1dc50b){if(_0x1dc50b){_0x5026a8=_0x1dc50b;_0x126fc4[_0x6fa0('0x2b')]=_[_0x6fa0('0x2d')](db['FreshsalesField'][_0x6fa0('0x29')]);_0x126fc4[_0x6fa0('0x2c')]=_['keys'](_0x4c9fbe[_0x6fa0('0x2c')]);_0x126fc4[_0x6fa0('0x2e')]=_[_0x6fa0('0x2f')](_0x126fc4[_0x6fa0('0x2b')],_0x126fc4[_0x6fa0('0x2c')]);_0x405ec4[_0x6fa0('0x30')]=_['intersection'](_0x126fc4[_0x6fa0('0x2b')],qs[_0x6fa0('0x31')](_0x4c9fbe[_0x6fa0('0x2c')][_0x6fa0('0x31')]));_0x405ec4[_0x6fa0('0x30')]=_0x405ec4['attributes'][_0x6fa0('0x32')]?_0x405ec4[_0x6fa0('0x30')]:_0x126fc4[_0x6fa0('0x2b')];_0x405ec4[_0x6fa0('0x35')]=qs[_0x6fa0('0x36')](_0x4c9fbe[_0x6fa0('0x2c')][_0x6fa0('0x36')]);_0x405ec4[_0x6fa0('0x37')]=qs[_0x6fa0('0x2e')](_[_0x6fa0('0x47')](_0x4c9fbe[_0x6fa0('0x2c')],_0x126fc4[_0x6fa0('0x2e')]));if(_0x4c9fbe[_0x6fa0('0x2c')][_0x6fa0('0x38')]){_0x405ec4[_0x6fa0('0x37')]=_[_0x6fa0('0x41')](_0x405ec4[_0x6fa0('0x37')],{'$or':_[_0x6fa0('0x28')](_0x405ec4[_0x6fa0('0x30')],function(_0x43794f){var _0x225fe7={};_0x225fe7[_0x43794f]={'$like':'%'+_0x4c9fbe[_0x6fa0('0x2c')][_0x6fa0('0x38')]+'%'};return _0x225fe7;})});}_0x405ec4=_[_0x6fa0('0x41')]({},_0x405ec4,_0x4c9fbe[_0x6fa0('0x3a')]);return _0x5026a8['getSubjects'](_0x405ec4);}})['then'](function(_0x37a47b){if(_0x37a47b){_0x51442c=_0x37a47b['length'];if(!_0x4c9fbe[_0x6fa0('0x2c')][_0x6fa0('0x33')]('nolimit')){_0x405ec4['limit']=qs[_0x6fa0('0x1d')](_0x4c9fbe[_0x6fa0('0x2c')][_0x6fa0('0x1d')]);_0x405ec4['offset']=qs[_0x6fa0('0x1a')](_0x4c9fbe[_0x6fa0('0x2c')][_0x6fa0('0x1a')]);}return _0x5026a8[_0x6fa0('0x48')](_0x405ec4);}})[_0x6fa0('0x23')](function(_0x2a03b3){if(_0x2a03b3){return _0x2a03b3?{'count':_0x51442c,'rows':_0x2a03b3}:null;}})[_0x6fa0('0x23')](respondWithResult(_0x7bdbf6,null))[_0x6fa0('0x3c')](handleError(_0x7bdbf6,null));};exports[_0x6fa0('0x49')]=function(_0x23251e,_0x23fc52,_0x38644b){var _0x2f166f={};var _0x5c2497={};var _0x3b28fb;var _0xdfd454;return db[_0x6fa0('0x3f')][_0x6fa0('0x46')]({'where':{'id':_0x23251e[_0x6fa0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x23fc52,null))[_0x6fa0('0x23')](function(_0x8804e0){if(_0x8804e0){_0x3b28fb=_0x8804e0;_0x5c2497[_0x6fa0('0x2b')]=_[_0x6fa0('0x2d')](db['FreshsalesField'][_0x6fa0('0x29')]);_0x5c2497[_0x6fa0('0x2c')]=_['keys'](_0x23251e['query']);_0x5c2497[_0x6fa0('0x2e')]=_[_0x6fa0('0x2f')](_0x5c2497[_0x6fa0('0x2b')],_0x5c2497['query']);_0x2f166f[_0x6fa0('0x30')]=_[_0x6fa0('0x2f')](_0x5c2497['model'],qs['fields'](_0x23251e[_0x6fa0('0x2c')][_0x6fa0('0x31')]));_0x2f166f[_0x6fa0('0x30')]=_0x2f166f[_0x6fa0('0x30')][_0x6fa0('0x32')]?_0x2f166f['attributes']:_0x5c2497[_0x6fa0('0x2b')];_0x2f166f[_0x6fa0('0x35')]=qs[_0x6fa0('0x36')](_0x23251e[_0x6fa0('0x2c')][_0x6fa0('0x36')]);_0x2f166f['where']=qs[_0x6fa0('0x2e')](_[_0x6fa0('0x47')](_0x23251e['query'],_0x5c2497[_0x6fa0('0x2e')]));if(_0x23251e['query']['filter']){_0x2f166f['where']=_['merge'](_0x2f166f[_0x6fa0('0x37')],{'$or':_['map'](_0x2f166f['attributes'],function(_0x42663d){var _0x163928={};_0x163928[_0x42663d]={'$like':'%'+_0x23251e[_0x6fa0('0x2c')][_0x6fa0('0x38')]+'%'};return _0x163928;})});}_0x2f166f=_['merge']({},_0x2f166f,_0x23251e[_0x6fa0('0x3a')]);return _0x3b28fb[_0x6fa0('0x49')](_0x2f166f);}})['then'](function(_0x3d4385){if(_0x3d4385){_0xdfd454=_0x3d4385['length'];if(!_0x23251e[_0x6fa0('0x2c')][_0x6fa0('0x33')](_0x6fa0('0x34'))){_0x2f166f[_0x6fa0('0x1d')]=qs[_0x6fa0('0x1d')](_0x23251e[_0x6fa0('0x2c')][_0x6fa0('0x1d')]);_0x2f166f[_0x6fa0('0x1a')]=qs[_0x6fa0('0x1a')](_0x23251e[_0x6fa0('0x2c')][_0x6fa0('0x1a')]);}return _0x3b28fb['getDescriptions'](_0x2f166f);}})[_0x6fa0('0x23')](function(_0x45278b){if(_0x45278b){return _0x45278b?{'count':_0xdfd454,'rows':_0x45278b}:null;}})[_0x6fa0('0x23')](respondWithResult(_0x23fc52,null))[_0x6fa0('0x3c')](handleError(_0x23fc52,null));};exports['getFields']=function(_0x4ed3c4,_0x403324,_0x4c6e56){var _0x458535={};var _0x487a71={};var _0x38729d;var _0x157521;return db[_0x6fa0('0x3f')][_0x6fa0('0x46')]({'where':{'id':_0x4ed3c4['params']['id']}})[_0x6fa0('0x23')](handleEntityNotFound(_0x403324,null))[_0x6fa0('0x23')](function(_0x14df8c){if(_0x14df8c){_0x38729d=_0x14df8c;_0x487a71[_0x6fa0('0x2b')]=_['keys'](db['FreshsalesField'][_0x6fa0('0x29')]);_0x487a71[_0x6fa0('0x2c')]=_['keys'](_0x4ed3c4[_0x6fa0('0x2c')]);_0x487a71[_0x6fa0('0x2e')]=_[_0x6fa0('0x2f')](_0x487a71['model'],_0x487a71[_0x6fa0('0x2c')]);_0x458535[_0x6fa0('0x30')]=_[_0x6fa0('0x2f')](_0x487a71[_0x6fa0('0x2b')],qs[_0x6fa0('0x31')](_0x4ed3c4['query'][_0x6fa0('0x31')]));_0x458535[_0x6fa0('0x30')]=_0x458535['attributes']['length']?_0x458535['attributes']:_0x487a71['model'];_0x458535[_0x6fa0('0x35')]=qs[_0x6fa0('0x36')](_0x4ed3c4[_0x6fa0('0x2c')][_0x6fa0('0x36')]);_0x458535[_0x6fa0('0x37')]=qs['filters'](_['pick'](_0x4ed3c4[_0x6fa0('0x2c')],_0x487a71[_0x6fa0('0x2e')]));if(_0x4ed3c4[_0x6fa0('0x2c')][_0x6fa0('0x38')]){_0x458535['where']=_['merge'](_0x458535[_0x6fa0('0x37')],{'$or':_[_0x6fa0('0x28')](_0x458535[_0x6fa0('0x30')],function(_0x4154ea){var _0xa3c4e4={};_0xa3c4e4[_0x4154ea]={'$like':'%'+_0x4ed3c4[_0x6fa0('0x2c')][_0x6fa0('0x38')]+'%'};return _0xa3c4e4;})});}_0x458535=_[_0x6fa0('0x41')]({},_0x458535,_0x4ed3c4['options']);return _0x38729d[_0x6fa0('0x4a')](_0x458535);}})[_0x6fa0('0x23')](function(_0x14452a){if(_0x14452a){_0x157521=_0x14452a[_0x6fa0('0x32')];if(!_0x4ed3c4[_0x6fa0('0x2c')][_0x6fa0('0x33')](_0x6fa0('0x34'))){_0x458535['limit']=qs['limit'](_0x4ed3c4[_0x6fa0('0x2c')][_0x6fa0('0x1d')]);_0x458535[_0x6fa0('0x1a')]=qs[_0x6fa0('0x1a')](_0x4ed3c4[_0x6fa0('0x2c')][_0x6fa0('0x1a')]);}return _0x38729d['getFields'](_0x458535);}})['then'](function(_0x1bc280){if(_0x1bc280){return _0x1bc280?{'count':_0x157521,'rows':_0x1bc280}:null;}})['then'](respondWithResult(_0x403324,null))[_0x6fa0('0x3c')](handleError(_0x403324,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 68d8f5d..3a365f9 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 _0x35eb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x3b942e,_0x43cb34){var _0x402b58=function(_0x2beea5){while(--_0x2beea5){_0x3b942e['push'](_0x3b942e['shift']());}};_0x402b58(++_0x43cb34);}(_0x35eb,0x138));var _0xb35e=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x35eb[_0x4b5813];return _0x423465;};'use strict';var _=require(_0xb35e('0x0'));var util=require(_0xb35e('0x1'));var logger=require(_0xb35e('0x2'))(_0xb35e('0x3'));var moment=require(_0xb35e('0x4'));var BPromise=require(_0xb35e('0x5'));var rp=require(_0xb35e('0x6'));var fs=require('fs');var path=require(_0xb35e('0x7'));var rimraf=require(_0xb35e('0x8'));var config=require('../../config/environment');var attributes=require(_0xb35e('0x9'));module['exports']=function(_0x6428c2,_0x42dce7){return _0x6428c2[_0xb35e('0xa')](_0xb35e('0xb'),attributes,{'tableName':_0xb35e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88d0=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x23b878,_0x41e5a0){var _0x3e4d14=function(_0x2b8651){while(--_0x2b8651){_0x23b878['push'](_0x23b878['shift']());}};_0x3e4d14(++_0x41e5a0);}(_0x88d0,0x68));var _0x088d=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x88d0[_0x5cc8b9];return _0x58892e;};'use strict';var _=require(_0x088d('0x0'));var util=require('util');var logger=require(_0x088d('0x1'))(_0x088d('0x2'));var moment=require(_0x088d('0x3'));var BPromise=require(_0x088d('0x4'));var rp=require(_0x088d('0x5'));var fs=require('fs');var path=require(_0x088d('0x6'));var rimraf=require(_0x088d('0x7'));var config=require(_0x088d('0x8'));var attributes=require(_0x088d('0x9'));module['exports']=function(_0x2cbb8c,_0x2f238c){return _0x2cbb8c[_0x088d('0xa')](_0x088d('0xb'),attributes,{'tableName':_0x088d('0xc'),'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 d398454..b2d534f 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 _0x2390=['message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1329ab,_0x48e49f){var _0x3f9966=function(_0x298c73){while(--_0x298c73){_0x1329ab['push'](_0x1329ab['shift']());}};_0x3f9966(++_0x48e49f);}(_0x2390,0x146));var _0x0239=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x2390[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0239('0x0'));var util=require('util');var moment=require(_0x0239('0x1'));var BPromise=require(_0x0239('0x2'));var rs=require(_0x0239('0x3'));var fs=require('fs');var Redis=require(_0x0239('0x4'));var db=require(_0x0239('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0239('0x6'));var config=require(_0x0239('0x7'));var jayson=require(_0x0239('0x8'));var client=jayson[_0x0239('0x9')][_0x0239('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35665a,_0x533b05,_0x1eb27d){return new BPromise(function(_0x4f8c80,_0x460def){return client['request'](_0x35665a,_0x1eb27d)[_0x0239('0xb')](function(_0x21d4c1){logger[_0x0239('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x533b05,'request\x20sent');logger[_0x0239('0xd')](_0x0239('0xe'),_0x533b05,_0x0239('0xf'),JSON[_0x0239('0x10')](_0x21d4c1));if(_0x21d4c1[_0x0239('0x11')]){if(_0x21d4c1[_0x0239('0x11')][_0x0239('0x12')]===0x1f4){logger[_0x0239('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x533b05,_0x21d4c1[_0x0239('0x11')][_0x0239('0x13')]);return _0x460def(_0x21d4c1[_0x0239('0x11')][_0x0239('0x13')]);}logger[_0x0239('0x11')](_0x0239('0x14'),_0x533b05,_0x21d4c1[_0x0239('0x11')][_0x0239('0x13')]);return _0x4f8c80(_0x21d4c1[_0x0239('0x11')]['message']);}else{logger[_0x0239('0xc')](_0x0239('0x14'),_0x533b05,'request\x20sent');_0x4f8c80(_0x21d4c1[_0x0239('0x15')]['message']);}})[_0x0239('0x16')](function(_0x552aad){logger[_0x0239('0x11')](_0x0239('0x14'),_0x533b05,_0x552aad);_0x460def(_0x552aad);});});} \ No newline at end of file +var _0x104c=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4ba5c3,_0x4e8089){var _0x155af1=function(_0x281053){while(--_0x281053){_0x4ba5c3['push'](_0x4ba5c3['shift']());}};_0x155af1(++_0x4e8089);}(_0x104c,0x137));var _0xc104=function(_0x7b3f70,_0x40a34f){_0x7b3f70=_0x7b3f70-0x0;var _0x5b247c=_0x104c[_0x7b3f70];return _0x5b247c;};'use strict';var _=require(_0xc104('0x0'));var util=require(_0xc104('0x1'));var moment=require(_0xc104('0x2'));var BPromise=require('bluebird');var rs=require(_0xc104('0x3'));var fs=require('fs');var Redis=require(_0xc104('0x4'));var db=require(_0xc104('0x5'))['db'];var utils=require(_0xc104('0x6'));var logger=require(_0xc104('0x7'))(_0xc104('0x8'));var config=require(_0xc104('0x9'));var jayson=require(_0xc104('0xa'));var client=jayson[_0xc104('0xb')][_0xc104('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x451a04,_0x1b8f10,_0x34847f){return new BPromise(function(_0x496d38,_0x179b0f){return client[_0xc104('0xd')](_0x451a04,_0x34847f)[_0xc104('0xe')](function(_0x4fdd2e){logger[_0xc104('0xf')](_0xc104('0x10'),_0x1b8f10,_0xc104('0x11'));logger[_0xc104('0x12')](_0xc104('0x13'),_0x1b8f10,_0xc104('0x11'),JSON[_0xc104('0x14')](_0x4fdd2e));if(_0x4fdd2e['error']){if(_0x4fdd2e[_0xc104('0x15')][_0xc104('0x16')]===0x1f4){logger[_0xc104('0x15')](_0xc104('0x10'),_0x1b8f10,_0x4fdd2e[_0xc104('0x15')]['message']);return _0x179b0f(_0x4fdd2e[_0xc104('0x15')]['message']);}logger[_0xc104('0x15')](_0xc104('0x10'),_0x1b8f10,_0x4fdd2e[_0xc104('0x15')][_0xc104('0x17')]);return _0x496d38(_0x4fdd2e[_0xc104('0x15')][_0xc104('0x17')]);}else{logger['info'](_0xc104('0x10'),_0x1b8f10,_0xc104('0x11'));_0x496d38(_0x4fdd2e[_0xc104('0x18')][_0xc104('0x17')]);}})[_0xc104('0x19')](function(_0x1f0777){logger[_0xc104('0x15')](_0xc104('0x10'),_0x1b8f10,_0x1f0777);_0x179b0f(_0x1f0777);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 25e6cb7..6919650 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 _0xd52a=['get','isAuthenticated','post','put','delete','/:id','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x12a674,_0x475b5b){var _0x28680a=function(_0x28791a){while(--_0x28791a){_0x12a674['push'](_0x12a674['shift']());}};_0x28680a(++_0x475b5b);}(_0xd52a,0xca));var _0xad52=function(_0x1e748a,_0x102cce){_0x1e748a=_0x1e748a-0x0;var _0x3a8767=_0xd52a[_0x1e748a];return _0x3a8767;};'use strict';var multer=require('multer');var util=require(_0xad52('0x0'));var path=require('path');var timeout=require(_0xad52('0x1'));var express=require(_0xad52('0x2'));var router=express[_0xad52('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xad52('0x4'));var interaction=require(_0xad52('0x5'));var config=require(_0xad52('0x6'));var controller=require(_0xad52('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xad52('0x8')]('/:id',auth[_0xad52('0x9')](),controller['show']);router[_0xad52('0xa')]('/',auth[_0xad52('0x9')](),controller['create']);router[_0xad52('0xb')]('/:id',auth[_0xad52('0x9')](),controller['update']);router[_0xad52('0xc')](_0xad52('0xd'),auth[_0xad52('0x9')](),controller[_0xad52('0xe')]);module['exports']=router; \ No newline at end of file +var _0xcf14=['index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated'];(function(_0x540dcf,_0x529f36){var _0x1ece9e=function(_0x2b9c31){while(--_0x2b9c31){_0x540dcf['push'](_0x540dcf['shift']());}};_0x1ece9e(++_0x529f36);}(_0xcf14,0xa1));var _0x4cf1=function(_0x197d32,_0x577e4c){_0x197d32=_0x197d32-0x0;var _0x3dab6b=_0xcf14[_0x197d32];return _0x3dab6b;};'use strict';var multer=require(_0x4cf1('0x0'));var util=require('util');var path=require(_0x4cf1('0x1'));var timeout=require(_0x4cf1('0x2'));var express=require('express');var router=express[_0x4cf1('0x3')]();var fs_extra=require(_0x4cf1('0x4'));var auth=require(_0x4cf1('0x5'));var interaction=require(_0x4cf1('0x6'));var config=require('../../config/environment');var controller=require(_0x4cf1('0x7'));router[_0x4cf1('0x8')]('/',auth[_0x4cf1('0x9')](),controller[_0x4cf1('0xa')]);router[_0x4cf1('0x8')](_0x4cf1('0xb'),auth[_0x4cf1('0x9')](),controller['show']);router[_0x4cf1('0xc')]('/',auth[_0x4cf1('0x9')](),controller[_0x4cf1('0xd')]);router[_0x4cf1('0xe')](_0x4cf1('0xb'),auth[_0x4cf1('0x9')](),controller[_0x4cf1('0xf')]);router[_0x4cf1('0x10')](_0x4cf1('0xb'),auth[_0x4cf1('0x9')](),controller[_0x4cf1('0x11')]);module[_0x4cf1('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index a3055a8..08451b4 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 _0x2263=['customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0x2263,0x1cf));var _0x3226=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0x2263[_0x499210];return _0x2e153d;};'use strict';var Sequelize=require(_0x3226('0x0'));module[_0x3226('0x1')]={'type':{'type':Sequelize[_0x3226('0x2')](_0x3226('0x3'),_0x3226('0x4'),_0x3226('0x5'),'keyValue',_0x3226('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3226('0x7')]},'key':{'type':Sequelize[_0x3226('0x7')]},'keyType':{'type':Sequelize[_0x3226('0x2')]('string',_0x3226('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x3226('0x7')]},'idField':{'type':Sequelize[_0x3226('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3226('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3226('0x7')]}}; \ No newline at end of file +var _0xe065=['exports','ENUM','string','variable','customVariable','STRING'];(function(_0x43e8a8,_0x2c957b){var _0x173919=function(_0x5d3d65){while(--_0x5d3d65){_0x43e8a8['push'](_0x43e8a8['shift']());}};_0x173919(++_0x2c957b);}(_0xe065,0xc0));var _0x5e06=function(_0x5b134f,_0x3f1074){_0x5b134f=_0x5b134f-0x0;var _0x3fe294=_0xe065[_0x5b134f];return _0x3fe294;};'use strict';var Sequelize=require('sequelize');module[_0x5e06('0x0')]={'type':{'type':Sequelize[_0x5e06('0x1')](_0x5e06('0x2'),_0x5e06('0x3'),_0x5e06('0x4'),'keyValue','picklist'),'defaultValue':_0x5e06('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5e06('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x5e06('0x3'),_0x5e06('0x4'))},'keyContent':{'type':Sequelize[_0x5e06('0x5')]},'idField':{'type':Sequelize[_0x5e06('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5e06('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index a7de8f4..dc150fe 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 _0xe61a=['rows','catch','show','params','filters','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','status','sendStatus','error','stack','name','map','FreshsalesField','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x19564e,_0x39ffc0){var _0x4eacd4=function(_0x3f5597){while(--_0x3f5597){_0x19564e['push'](_0x19564e['shift']());}};_0x4eacd4(++_0x39ffc0);}(_0xe61a,0x1c5));var _0xae61=function(_0x1164de,_0x1348a8){_0x1164de=_0x1164de-0x0;var _0xc9d23a=_0xe61a[_0x1164de];return _0xc9d23a;};'use strict';var emlformat=require(_0xae61('0x0'));var rimraf=require(_0xae61('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae61('0x2'));var rp=require(_0xae61('0x3'));var moment=require(_0xae61('0x4'));var BPromise=require(_0xae61('0x5'));var Mustache=require('mustache');var util=require(_0xae61('0x6'));var path=require(_0xae61('0x7'));var sox=require(_0xae61('0x8'));var csv=require(_0xae61('0x9'));var ejs=require(_0xae61('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae61('0xb'));var squel=require(_0xae61('0xc'));var crypto=require(_0xae61('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xae61('0xe'));var toCsv=require(_0xae61('0x9'));var querystring=require(_0xae61('0xf'));var Papa=require(_0xae61('0x10'));var Redis=require(_0xae61('0x11'));var authService=require(_0xae61('0x12'));var qs=require(_0xae61('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae61('0x14'));var logger=require(_0xae61('0x15'))(_0xae61('0x16'));var utils=require('../../config/utils');var config=require(_0xae61('0x17'));var licenseUtil=require(_0xae61('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7b59c3,_0x5d4ea3){_0x5d4ea3=_0x5d4ea3||0xcc;return function(_0x233fff){if(_0x233fff){return _0x7b59c3['sendStatus'](_0x5d4ea3);}return _0x7b59c3['status'](_0x5d4ea3)['end']();};}function respondWithResult(_0x31441e,_0x126204){_0x126204=_0x126204||0xc8;return function(_0x492217){if(_0x492217){return _0x31441e['status'](_0x126204)[_0xae61('0x19')](_0x492217);}};}function respondWithFilteredResult(_0x4c0b07,_0x1917ee){return function(_0x1ed10a){if(_0x1ed10a){var _0x331da6=typeof _0x1917ee[_0xae61('0x1a')]===_0xae61('0x1b')&&typeof _0x1917ee[_0xae61('0x1c')]===_0xae61('0x1b');var _0x59fef7=_0x1ed10a[_0xae61('0x1d')];var _0xf8b4ba=_0x331da6?0x0:_0x1917ee[_0xae61('0x1a')];var _0x5199cc=_0x331da6?_0x1ed10a[_0xae61('0x1d')]:_0x1917ee[_0xae61('0x1a')]+_0x1917ee['limit'];var _0x2d86a8;if(_0x5199cc>=_0x59fef7){_0x5199cc=_0x59fef7;_0x2d86a8=0xc8;}else{_0x2d86a8=0xce;}_0x4c0b07['status'](_0x2d86a8);return _0x4c0b07['set'](_0xae61('0x1e'),_0xf8b4ba+'-'+_0x5199cc+'/'+_0x59fef7)[_0xae61('0x19')](_0x1ed10a);}return null;};}function patchUpdates(_0x3c2d65){return function(_0x1a568f){try{jsonpatch[_0xae61('0x1f')](_0x1a568f,_0x3c2d65,!![]);}catch(_0x18dce4){return BPromise[_0xae61('0x20')](_0x18dce4);}return _0x1a568f['save']();};}function saveUpdates(_0x13d053,_0x499cd7){return function(_0x416359){if(_0x416359){return _0x416359['update'](_0x13d053)[_0xae61('0x21')](function(_0x2ddf22){return _0x2ddf22;});}return null;};}function removeEntity(_0x1045a,_0x5910d0){return function(_0x4a7c37){if(_0x4a7c37){return _0x4a7c37[_0xae61('0x22')]()['then'](function(){_0x1045a[_0xae61('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x450721,_0x57dcff){return function(_0xe859a8){if(!_0xe859a8){_0x450721[_0xae61('0x24')](0x194);}return _0xe859a8;};}function handleError(_0x2c38ec,_0x505faa){_0x505faa=_0x505faa||0x1f4;return function(_0x34e845){logger[_0xae61('0x25')](_0x34e845[_0xae61('0x26')]);if(_0x34e845[_0xae61('0x27')]){delete _0x34e845['name'];}_0x2c38ec[_0xae61('0x23')](_0x505faa)['send'](_0x34e845);};}exports['index']=function(_0x5984a5,_0x13cd29){var _0x34c08c={},_0x4fd183={},_0x3f3dbf={'count':0x0,'rows':[]};var _0x5a28f2=_[_0xae61('0x28')](db[_0xae61('0x29')][_0xae61('0x2a')],function(_0x3df023){return{'name':_0x3df023[_0xae61('0x2b')],'type':_0x3df023[_0xae61('0x2c')][_0xae61('0x2d')]};});_0x4fd183['model']=_['map'](_0x5a28f2,_0xae61('0x27'));_0x4fd183[_0xae61('0x2e')]=_[_0xae61('0x2f')](_0x5984a5[_0xae61('0x2e')]);_0x4fd183['filters']=_['intersection'](_0x4fd183['model'],_0x4fd183['query']);_0x34c08c[_0xae61('0x30')]=_[_0xae61('0x31')](_0x4fd183['model'],qs['fields'](_0x5984a5[_0xae61('0x2e')][_0xae61('0x32')]));_0x34c08c[_0xae61('0x30')]=_0x34c08c['attributes'][_0xae61('0x33')]?_0x34c08c[_0xae61('0x30')]:_0x4fd183[_0xae61('0x34')];if(!_0x5984a5[_0xae61('0x2e')][_0xae61('0x35')](_0xae61('0x36'))){_0x34c08c[_0xae61('0x1c')]=qs[_0xae61('0x1c')](_0x5984a5[_0xae61('0x2e')][_0xae61('0x1c')]);_0x34c08c[_0xae61('0x1a')]=qs[_0xae61('0x1a')](_0x5984a5[_0xae61('0x2e')][_0xae61('0x1a')]);}_0x34c08c[_0xae61('0x37')]=qs[_0xae61('0x38')](_0x5984a5[_0xae61('0x2e')]['sort']);_0x34c08c[_0xae61('0x39')]=qs['filters'](_[_0xae61('0x3a')](_0x5984a5[_0xae61('0x2e')],_0x4fd183['filters']),_0x5a28f2);if(_0x5984a5['query'][_0xae61('0x3b')]){_0x34c08c[_0xae61('0x39')]=_[_0xae61('0x3c')](_0x34c08c[_0xae61('0x39')],{'$or':_['map'](_0x5a28f2,function(_0x42846d){if(_0x42846d[_0xae61('0x2c')]!==_0xae61('0x3d')){var _0x4ecc9a={};_0x4ecc9a[_0x42846d[_0xae61('0x27')]]={'$like':'%'+_0x5984a5[_0xae61('0x2e')][_0xae61('0x3b')]+'%'};return _0x4ecc9a;}})});}_0x34c08c=_[_0xae61('0x3c')]({},_0x34c08c,_0x5984a5[_0xae61('0x3e')]);var _0x180297={'where':_0x34c08c['where']};return db[_0xae61('0x29')][_0xae61('0x1d')](_0x180297)[_0xae61('0x21')](function(_0x5bcb32){_0x3f3dbf[_0xae61('0x1d')]=_0x5bcb32;if(_0x5984a5['query'][_0xae61('0x3f')]){_0x34c08c[_0xae61('0x40')]=[{'all':!![]}];}return db[_0xae61('0x29')]['findAll'](_0x34c08c);})[_0xae61('0x21')](function(_0x4bce1a){_0x3f3dbf[_0xae61('0x41')]=_0x4bce1a;return _0x3f3dbf;})[_0xae61('0x21')](respondWithFilteredResult(_0x13cd29,_0x34c08c))[_0xae61('0x42')](handleError(_0x13cd29,null));};exports[_0xae61('0x43')]=function(_0x11f89d,_0x551c89){var _0x287b4e={'raw':!![],'where':{'id':_0x11f89d[_0xae61('0x44')]['id']}},_0x12ae35={};_0x12ae35[_0xae61('0x34')]=_['keys'](db[_0xae61('0x29')]['rawAttributes']);_0x12ae35['query']=_[_0xae61('0x2f')](_0x11f89d['query']);_0x12ae35[_0xae61('0x45')]=_[_0xae61('0x31')](_0x12ae35[_0xae61('0x34')],_0x12ae35[_0xae61('0x2e')]);_0x287b4e[_0xae61('0x30')]=_[_0xae61('0x31')](_0x12ae35[_0xae61('0x34')],qs['fields'](_0x11f89d['query'][_0xae61('0x32')]));_0x287b4e['attributes']=_0x287b4e[_0xae61('0x30')]['length']?_0x287b4e[_0xae61('0x30')]:_0x12ae35[_0xae61('0x34')];if(_0x11f89d[_0xae61('0x2e')][_0xae61('0x3f')]){_0x287b4e[_0xae61('0x40')]=[{'all':!![]}];}_0x287b4e=_['merge']({},_0x287b4e,_0x11f89d[_0xae61('0x3e')]);return db[_0xae61('0x29')][_0xae61('0x46')](_0x287b4e)['then'](handleEntityNotFound(_0x551c89,null))[_0xae61('0x21')](respondWithResult(_0x551c89,null))[_0xae61('0x42')](handleError(_0x551c89,null));};exports['create']=function(_0xf12d92,_0x39aabc){return db[_0xae61('0x29')][_0xae61('0x47')](_0xf12d92[_0xae61('0x48')],{})[_0xae61('0x21')](respondWithResult(_0x39aabc,0xc9))[_0xae61('0x42')](handleError(_0x39aabc,null));};exports[_0xae61('0x49')]=function(_0x5f0357,_0x4b6268){if(_0x5f0357[_0xae61('0x48')]['id']){delete _0x5f0357[_0xae61('0x48')]['id'];}return db[_0xae61('0x29')][_0xae61('0x46')]({'where':{'id':_0x5f0357[_0xae61('0x44')]['id']}})[_0xae61('0x21')](handleEntityNotFound(_0x4b6268,null))[_0xae61('0x21')](saveUpdates(_0x5f0357['body'],null))[_0xae61('0x21')](respondWithResult(_0x4b6268,null))[_0xae61('0x42')](handleError(_0x4b6268,null));};exports[_0xae61('0x22')]=function(_0x3e546e,_0x2c0e5e){return db['FreshsalesField'][_0xae61('0x46')]({'where':{'id':_0x3e546e[_0xae61('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c0e5e,null))[_0xae61('0x21')](removeEntity(_0x2c0e5e,null))[_0xae61('0x42')](handleError(_0x2c0e5e,null));}; \ No newline at end of file +var _0x623e=['mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','FreshsalesField','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x978648,_0x492a94){var _0x31ba2d=function(_0x288d0f){while(--_0x288d0f){_0x978648['push'](_0x978648['shift']());}};_0x31ba2d(++_0x492a94);}(_0x623e,0x1a9));var _0xe623=function(_0x1f5f28,_0x44503f){_0x1f5f28=_0x1f5f28-0x0;var _0x3c6ad0=_0x623e[_0x1f5f28];return _0x3c6ad0;};'use strict';var emlformat=require(_0xe623('0x0'));var rimraf=require(_0xe623('0x1'));var zipdir=require(_0xe623('0x2'));var jsonpatch=require(_0xe623('0x3'));var rp=require(_0xe623('0x4'));var moment=require(_0xe623('0x5'));var BPromise=require(_0xe623('0x6'));var Mustache=require(_0xe623('0x7'));var util=require(_0xe623('0x8'));var path=require(_0xe623('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe623('0xa'));var fs=require('fs');var fs_extra=require(_0xe623('0xb'));var _=require('lodash');var squel=require(_0xe623('0xc'));var crypto=require(_0xe623('0xd'));var jsforce=require(_0xe623('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe623('0xf'));var Papa=require(_0xe623('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe623('0x11'));var as=require(_0xe623('0x12'));var hardwareService=require(_0xe623('0x13'));var logger=require(_0xe623('0x14'))('api');var utils=require(_0xe623('0x15'));var config=require(_0xe623('0x16'));var licenseUtil=require(_0xe623('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d212,_0x582c09){_0x582c09=_0x582c09||0xcc;return function(_0x2eb02d){if(_0x2eb02d){return _0x44d212['sendStatus'](_0x582c09);}return _0x44d212[_0xe623('0x18')](_0x582c09)[_0xe623('0x19')]();};}function respondWithResult(_0x22d0f5,_0xce6ce5){_0xce6ce5=_0xce6ce5||0xc8;return function(_0x3fcc60){if(_0x3fcc60){return _0x22d0f5[_0xe623('0x18')](_0xce6ce5)[_0xe623('0x1a')](_0x3fcc60);}};}function respondWithFilteredResult(_0x2e836a,_0x2af613){return function(_0x376d12){if(_0x376d12){var _0x2eaf3f=typeof _0x2af613[_0xe623('0x1b')]===_0xe623('0x1c')&&typeof _0x2af613[_0xe623('0x1d')]==='undefined';var _0x17f9bf=_0x376d12[_0xe623('0x1e')];var _0x9c6056=_0x2eaf3f?0x0:_0x2af613[_0xe623('0x1b')];var _0x575fa6=_0x2eaf3f?_0x376d12[_0xe623('0x1e')]:_0x2af613[_0xe623('0x1b')]+_0x2af613[_0xe623('0x1d')];var _0x26092b;if(_0x575fa6>=_0x17f9bf){_0x575fa6=_0x17f9bf;_0x26092b=0xc8;}else{_0x26092b=0xce;}_0x2e836a[_0xe623('0x18')](_0x26092b);return _0x2e836a[_0xe623('0x1f')]('Content-Range',_0x9c6056+'-'+_0x575fa6+'/'+_0x17f9bf)[_0xe623('0x1a')](_0x376d12);}return null;};}function patchUpdates(_0x36f2a3){return function(_0x3bd16d){try{jsonpatch[_0xe623('0x20')](_0x3bd16d,_0x36f2a3,!![]);}catch(_0x28cdf9){return BPromise[_0xe623('0x21')](_0x28cdf9);}return _0x3bd16d['save']();};}function saveUpdates(_0x58483f,_0x2dab1b){return function(_0x57bfde){if(_0x57bfde){return _0x57bfde[_0xe623('0x22')](_0x58483f)[_0xe623('0x23')](function(_0x3a0b85){return _0x3a0b85;});}return null;};}function removeEntity(_0x54f9b9,_0x11353b){return function(_0x3d731c){if(_0x3d731c){return _0x3d731c['destroy']()[_0xe623('0x23')](function(){_0x54f9b9[_0xe623('0x18')](0xcc)[_0xe623('0x19')]();});}};}function handleEntityNotFound(_0x1b1e5e,_0x2a41cf){return function(_0x574bf3){if(!_0x574bf3){_0x1b1e5e[_0xe623('0x24')](0x194);}return _0x574bf3;};}function handleError(_0x2db03a,_0x3eec5f){_0x3eec5f=_0x3eec5f||0x1f4;return function(_0xa1d7ef){logger[_0xe623('0x25')](_0xa1d7ef[_0xe623('0x26')]);if(_0xa1d7ef[_0xe623('0x27')]){delete _0xa1d7ef[_0xe623('0x27')];}_0x2db03a[_0xe623('0x18')](_0x3eec5f)[_0xe623('0x28')](_0xa1d7ef);};}exports[_0xe623('0x29')]=function(_0x4ffb34,_0x617970){var _0x4cfbe1={},_0x28a8dc={},_0x502452={'count':0x0,'rows':[]};var _0x2c0a09=_[_0xe623('0x2a')](db[_0xe623('0x2b')]['rawAttributes'],function(_0x44f18b){return{'name':_0x44f18b[_0xe623('0x2c')],'type':_0x44f18b[_0xe623('0x2d')][_0xe623('0x2e')]};});_0x28a8dc[_0xe623('0x2f')]=_[_0xe623('0x2a')](_0x2c0a09,'name');_0x28a8dc['query']=_[_0xe623('0x30')](_0x4ffb34[_0xe623('0x31')]);_0x28a8dc[_0xe623('0x32')]=_[_0xe623('0x33')](_0x28a8dc['model'],_0x28a8dc['query']);_0x4cfbe1[_0xe623('0x34')]=_[_0xe623('0x33')](_0x28a8dc[_0xe623('0x2f')],qs['fields'](_0x4ffb34[_0xe623('0x31')][_0xe623('0x35')]));_0x4cfbe1['attributes']=_0x4cfbe1[_0xe623('0x34')][_0xe623('0x36')]?_0x4cfbe1[_0xe623('0x34')]:_0x28a8dc['model'];if(!_0x4ffb34[_0xe623('0x31')]['hasOwnProperty'](_0xe623('0x37'))){_0x4cfbe1[_0xe623('0x1d')]=qs[_0xe623('0x1d')](_0x4ffb34[_0xe623('0x31')][_0xe623('0x1d')]);_0x4cfbe1[_0xe623('0x1b')]=qs[_0xe623('0x1b')](_0x4ffb34[_0xe623('0x31')]['offset']);}_0x4cfbe1[_0xe623('0x38')]=qs['sort'](_0x4ffb34[_0xe623('0x31')]['sort']);_0x4cfbe1[_0xe623('0x39')]=qs[_0xe623('0x32')](_['pick'](_0x4ffb34[_0xe623('0x31')],_0x28a8dc[_0xe623('0x32')]),_0x2c0a09);if(_0x4ffb34['query']['filter']){_0x4cfbe1['where']=_[_0xe623('0x3a')](_0x4cfbe1['where'],{'$or':_[_0xe623('0x2a')](_0x2c0a09,function(_0x250d03){if(_0x250d03[_0xe623('0x2d')]!==_0xe623('0x3b')){var _0x5d8547={};_0x5d8547[_0x250d03[_0xe623('0x27')]]={'$like':'%'+_0x4ffb34['query'][_0xe623('0x3c')]+'%'};return _0x5d8547;}})});}_0x4cfbe1=_[_0xe623('0x3a')]({},_0x4cfbe1,_0x4ffb34[_0xe623('0x3d')]);var _0x647f15={'where':_0x4cfbe1[_0xe623('0x39')]};return db[_0xe623('0x2b')][_0xe623('0x1e')](_0x647f15)[_0xe623('0x23')](function(_0x2ca2dc){_0x502452[_0xe623('0x1e')]=_0x2ca2dc;if(_0x4ffb34['query'][_0xe623('0x3e')]){_0x4cfbe1[_0xe623('0x3f')]=[{'all':!![]}];}return db[_0xe623('0x2b')]['findAll'](_0x4cfbe1);})[_0xe623('0x23')](function(_0xe00181){_0x502452[_0xe623('0x40')]=_0xe00181;return _0x502452;})[_0xe623('0x23')](respondWithFilteredResult(_0x617970,_0x4cfbe1))['catch'](handleError(_0x617970,null));};exports[_0xe623('0x41')]=function(_0x5d2f20,_0x57da1e){var _0x29f058={'raw':!![],'where':{'id':_0x5d2f20[_0xe623('0x42')]['id']}},_0x7ce7ba={};_0x7ce7ba[_0xe623('0x2f')]=_[_0xe623('0x30')](db[_0xe623('0x2b')]['rawAttributes']);_0x7ce7ba[_0xe623('0x31')]=_[_0xe623('0x30')](_0x5d2f20['query']);_0x7ce7ba['filters']=_[_0xe623('0x33')](_0x7ce7ba[_0xe623('0x2f')],_0x7ce7ba[_0xe623('0x31')]);_0x29f058[_0xe623('0x34')]=_[_0xe623('0x33')](_0x7ce7ba[_0xe623('0x2f')],qs['fields'](_0x5d2f20[_0xe623('0x31')]['fields']));_0x29f058[_0xe623('0x34')]=_0x29f058[_0xe623('0x34')][_0xe623('0x36')]?_0x29f058[_0xe623('0x34')]:_0x7ce7ba[_0xe623('0x2f')];if(_0x5d2f20[_0xe623('0x31')]['includeAll']){_0x29f058[_0xe623('0x3f')]=[{'all':!![]}];}_0x29f058=_[_0xe623('0x3a')]({},_0x29f058,_0x5d2f20[_0xe623('0x3d')]);return db[_0xe623('0x2b')][_0xe623('0x43')](_0x29f058)['then'](handleEntityNotFound(_0x57da1e,null))[_0xe623('0x23')](respondWithResult(_0x57da1e,null))[_0xe623('0x44')](handleError(_0x57da1e,null));};exports[_0xe623('0x45')]=function(_0x5f55ff,_0x2b62a9){return db['FreshsalesField'][_0xe623('0x45')](_0x5f55ff['body'],{})[_0xe623('0x23')](respondWithResult(_0x2b62a9,0xc9))[_0xe623('0x44')](handleError(_0x2b62a9,null));};exports['update']=function(_0x72058,_0x31bd4d){if(_0x72058[_0xe623('0x46')]['id']){delete _0x72058[_0xe623('0x46')]['id'];}return db[_0xe623('0x2b')][_0xe623('0x43')]({'where':{'id':_0x72058[_0xe623('0x42')]['id']}})['then'](handleEntityNotFound(_0x31bd4d,null))[_0xe623('0x23')](saveUpdates(_0x72058['body'],null))[_0xe623('0x23')](respondWithResult(_0x31bd4d,null))[_0xe623('0x44')](handleError(_0x31bd4d,null));};exports[_0xe623('0x47')]=function(_0xbf8a70,_0x2147ad){return db['FreshsalesField'][_0xe623('0x43')]({'where':{'id':_0xbf8a70[_0xe623('0x42')]['id']}})[_0xe623('0x23')](handleEntityNotFound(_0x2147ad,null))[_0xe623('0x23')](removeEntity(_0x2147ad,null))[_0xe623('0x44')](handleError(_0x2147ad,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f3791f3..b63eb8b 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 _0x761c=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x4c55e0,_0x131a9f){var _0x1426cc=function(_0xbc696f){while(--_0xbc696f){_0x4c55e0['push'](_0x4c55e0['shift']());}};_0x1426cc(++_0x131a9f);}(_0x761c,0x18a));var _0xc761=function(_0x3cf9dd,_0x348e51){_0x3cf9dd=_0x3cf9dd-0x0;var _0x40771b=_0x761c[_0x3cf9dd];return _0x40771b;};'use strict';var _=require(_0xc761('0x0'));var util=require('util');var logger=require(_0xc761('0x1'))(_0xc761('0x2'));var moment=require('moment');var BPromise=require(_0xc761('0x3'));var rp=require(_0xc761('0x4'));var fs=require('fs');var path=require(_0xc761('0x5'));var rimraf=require('rimraf');var config=require(_0xc761('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xc761('0x7')]=function(_0x468f51,_0x23ba0b){return _0x468f51[_0xc761('0x8')](_0xc761('0x9'),attributes,{'tableName':_0xc761('0xa'),'paranoid':![],'indexes':[{'name':_0xc761('0xb'),'fields':['idField',_0xc761('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeba2=['path','rimraf','../../config/environment','define','FreshsalesField','freshsales_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5de8fa,_0x4665af){var _0x136868=function(_0xf16f59){while(--_0xf16f59){_0x5de8fa['push'](_0x5de8fa['shift']());}};_0x136868(++_0x4665af);}(_0xeba2,0x70));var _0x2eba=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xeba2[_0x313c96];return _0x522f53;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2eba('0x0'))(_0x2eba('0x1'));var moment=require(_0x2eba('0x2'));var BPromise=require(_0x2eba('0x3'));var rp=require(_0x2eba('0x4'));var fs=require('fs');var path=require(_0x2eba('0x5'));var rimraf=require(_0x2eba('0x6'));var config=require(_0x2eba('0x7'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x54a43d,_0xa693ce){return _0x54a43d[_0x2eba('0x8')](_0x2eba('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x2eba('0xa'),'fields':[_0x2eba('0xb'),_0x2eba('0xc')],'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 24574ad..55fff80 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 _0x7a54=['info','FreshsalesField,\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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x5d6749,_0x3c6252){_0x5d6749=_0x5d6749-0x0;var _0x5d4494=_0x7a54[_0x5d6749];return _0x5d4494;};'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')]('FreshsalesField,\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 _0x71ab=['http','request','then','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xfea7a,_0x31e497){var _0x2ac594=function(_0x4170c1){while(--_0x4170c1){_0xfea7a['push'](_0xfea7a['shift']());}};_0x2ac594(++_0x31e497);}(_0x71ab,0x64));var _0xb71a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x71ab[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a93f03b..34db459 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(_0x4437a7,_0x3257b2){var _0x5aa10b=function(_0xa35911){while(--_0xa35911){_0x4437a7['push'](_0x4437a7['shift']());}};_0x5aa10b(++_0x3257b2);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 _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(_0x531f70,_0x543e4a){var _0x5d713c=function(_0x2178a1){while(--_0x2178a1){_0x531f70['push'](_0x531f70['shift']());}};_0x5d713c(++_0x543e4a);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 9e53e49..2e88721 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 _0xa533=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x40585e,_0x485afe){var _0x2fbade=function(_0x409803){while(--_0x409803){_0x40585e['push'](_0x40585e['shift']());}};_0x2fbade(++_0x485afe);}(_0xa533,0x1c6));var _0x3a53=function(_0x5bc061,_0x4ce553){_0x5bc061=_0x5bc061-0x0;var _0x294686=_0xa533[_0x5bc061];return _0x294686;};'use strict';var Sequelize=require(_0x3a53('0x0'));module[_0x3a53('0x1')]={'name':{'type':Sequelize[_0x3a53('0x2')]},'description':{'type':Sequelize[_0x3a53('0x2')]},'username':{'type':Sequelize[_0x3a53('0x2')],'unique':_0x3a53('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3a53('0x2')]},'clientId':{'type':Sequelize[_0x3a53('0x2')]},'clientSecret':{'type':Sequelize[_0x3a53('0x2')]},'securityToken':{'type':Sequelize[_0x3a53('0x2')]},'serverUrl':{'type':Sequelize[_0x3a53('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3a53('0x4')](_0x3a53('0x5'),_0x3a53('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x53aa=['exports','STRING','ENUM','newTab','integrationTab','sequelize'];(function(_0xce58df,_0x4b6850){var _0x57b86a=function(_0x4599cd){while(--_0x4599cd){_0xce58df['push'](_0xce58df['shift']());}};_0x57b86a(++_0x4b6850);}(_0x53aa,0x167));var _0xa53a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x53aa[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xa53a('0x0'));module[_0xa53a('0x1')]={'name':{'type':Sequelize[_0xa53a('0x2')]},'description':{'type':Sequelize[_0xa53a('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xa53a('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa53a('0x2')]},'clientSecret':{'type':Sequelize[_0xa53a('0x2')]},'securityToken':{'type':Sequelize[_0xa53a('0x2')]},'serverUrl':{'type':Sequelize[_0xa53a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa53a('0x3')]('integrationTab',_0xa53a('0x4')),'defaultValue':_0xa53a('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 70554b3..a43329d 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 _0x0edf=['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','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','map','rawAttributes','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','type','filter','merge','options','includeAll','SalesforceAccount','catch','show','params','keys','find','create','body','update','findOne','SalesforceConfiguration','pick','length','getConfigurations','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','username','slice','substring','lastIndexOf','Connection','clientSecret','login','concat','securityToken','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','boolean','textarea','phone','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x5634ae,_0x36f9d6){var _0x521237=function(_0x4349f8){while(--_0x4349f8){_0x5634ae['push'](_0x5634ae['shift']());}};_0x521237(++_0x36f9d6);}(_0x0edf,0xf0));var _0xf0ed=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0edf[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xf0ed('0x0'));var rimraf=require(_0xf0ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0ed('0x2'));var rp=require(_0xf0ed('0x3'));var moment=require('moment');var BPromise=require(_0xf0ed('0x4'));var Mustache=require(_0xf0ed('0x5'));var util=require(_0xf0ed('0x6'));var path=require(_0xf0ed('0x7'));var sox=require(_0xf0ed('0x8'));var csv=require(_0xf0ed('0x9'));var ejs=require(_0xf0ed('0xa'));var fs=require('fs');var fs_extra=require(_0xf0ed('0xb'));var _=require(_0xf0ed('0xc'));var squel=require(_0xf0ed('0xd'));var crypto=require(_0xf0ed('0xe'));var jsforce=require(_0xf0ed('0xf'));var deskjs=require(_0xf0ed('0x10'));var toCsv=require(_0xf0ed('0x9'));var querystring=require(_0xf0ed('0x11'));var Papa=require(_0xf0ed('0x12'));var Redis=require(_0xf0ed('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf0ed('0x14'));var as=require(_0xf0ed('0x15'));var hardwareService=require(_0xf0ed('0x16'));var logger=require(_0xf0ed('0x17'))(_0xf0ed('0x18'));var utils=require(_0xf0ed('0x19'));var config=require(_0xf0ed('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0ed('0x1b'))['db'];var integrations=require(_0xf0ed('0x1c'));function respondWithStatusCode(_0x2ef009,_0x4d004e){_0x4d004e=_0x4d004e||0xcc;return function(_0x4d1e65){if(_0x4d1e65){return _0x2ef009[_0xf0ed('0x1d')](_0x4d004e);}return _0x2ef009['status'](_0x4d004e)[_0xf0ed('0x1e')]();};}function respondWithResult(_0xd52ed0,_0x25bb1c){_0x25bb1c=_0x25bb1c||0xc8;return function(_0x41c81f){if(_0x41c81f){return _0xd52ed0[_0xf0ed('0x1f')](_0x25bb1c)[_0xf0ed('0x20')](_0x41c81f);}};}function respondWithFilteredResult(_0x43258e,_0x1e6a3a){return function(_0x31f8d5){if(_0x31f8d5){var _0x2f958f=typeof _0x1e6a3a[_0xf0ed('0x21')]==='undefined'&&typeof _0x1e6a3a['limit']==='undefined';var _0x286508=_0x31f8d5[_0xf0ed('0x22')];var _0x69dded=_0x2f958f?0x0:_0x1e6a3a[_0xf0ed('0x21')];var _0x25d259=_0x2f958f?_0x31f8d5['count']:_0x1e6a3a['offset']+_0x1e6a3a[_0xf0ed('0x23')];var _0x1ac4ba;if(_0x25d259>=_0x286508){_0x25d259=_0x286508;_0x1ac4ba=0xc8;}else{_0x1ac4ba=0xce;}_0x43258e[_0xf0ed('0x1f')](_0x1ac4ba);return _0x43258e[_0xf0ed('0x24')](_0xf0ed('0x25'),_0x69dded+'-'+_0x25d259+'/'+_0x286508)[_0xf0ed('0x20')](_0x31f8d5);}return null;};}function patchUpdates(_0x3bb437){return function(_0x1b18e3){try{jsonpatch[_0xf0ed('0x26')](_0x1b18e3,_0x3bb437,!![]);}catch(_0x133e51){return BPromise[_0xf0ed('0x27')](_0x133e51);}return _0x1b18e3['save']();};}function saveUpdates(_0x442bb6,_0x3f11de){return function(_0x4b3dab){if(_0x4b3dab){return _0x4b3dab['update'](_0x442bb6)['then'](function(_0x3c2abe){return _0x3c2abe;});}return null;};}function removeEntity(_0x51e312,_0x45afe4){return function(_0x5e47cd){if(_0x5e47cd){return _0x5e47cd[_0xf0ed('0x28')]()[_0xf0ed('0x29')](function(){_0x51e312[_0xf0ed('0x1f')](0xcc)[_0xf0ed('0x1e')]();});}};}function handleEntityNotFound(_0x6399e6,_0x25299e){return function(_0x1d478b){if(!_0x1d478b){_0x6399e6['sendStatus'](0x194);}return _0x1d478b;};}function handleError(_0x21f276,_0x50bcfd){_0x50bcfd=_0x50bcfd||0x1f4;return function(_0x4550c5){logger[_0xf0ed('0x2a')](_0x4550c5[_0xf0ed('0x2b')]);if(_0x4550c5[_0xf0ed('0x2c')]){delete _0x4550c5[_0xf0ed('0x2c')];}_0x21f276[_0xf0ed('0x1f')](_0x50bcfd)[_0xf0ed('0x2d')](_0x4550c5);};}exports[_0xf0ed('0x2e')]=function(_0x19cf10,_0x21ea4){var _0x4fa7ac={},_0xaabf83={},_0x22a9df={'count':0x0,'rows':[]};var _0xb13faa=_[_0xf0ed('0x2f')](db['SalesforceAccount'][_0xf0ed('0x30')],function(_0x50152a){return{'name':_0x50152a['fieldName'],'type':_0x50152a['type'][_0xf0ed('0x31')]};});_0xaabf83['model']=_[_0xf0ed('0x2f')](_0xb13faa,_0xf0ed('0x2c'));_0xaabf83[_0xf0ed('0x32')]=_['keys'](_0x19cf10[_0xf0ed('0x32')]);_0xaabf83[_0xf0ed('0x33')]=_[_0xf0ed('0x34')](_0xaabf83[_0xf0ed('0x35')],_0xaabf83[_0xf0ed('0x32')]);_0x4fa7ac[_0xf0ed('0x36')]=_[_0xf0ed('0x34')](_0xaabf83[_0xf0ed('0x35')],qs[_0xf0ed('0x37')](_0x19cf10[_0xf0ed('0x32')]['fields']));_0x4fa7ac['attributes']=_0x4fa7ac['attributes']['length']?_0x4fa7ac[_0xf0ed('0x36')]:_0xaabf83[_0xf0ed('0x35')];if(!_0x19cf10[_0xf0ed('0x32')][_0xf0ed('0x38')]('nolimit')){_0x4fa7ac[_0xf0ed('0x23')]=qs[_0xf0ed('0x23')](_0x19cf10[_0xf0ed('0x32')][_0xf0ed('0x23')]);_0x4fa7ac[_0xf0ed('0x21')]=qs['offset'](_0x19cf10[_0xf0ed('0x32')][_0xf0ed('0x21')]);}_0x4fa7ac[_0xf0ed('0x39')]=qs['sort'](_0x19cf10[_0xf0ed('0x32')][_0xf0ed('0x3a')]);_0x4fa7ac[_0xf0ed('0x3b')]=qs[_0xf0ed('0x33')](_['pick'](_0x19cf10[_0xf0ed('0x32')],_0xaabf83[_0xf0ed('0x33')]),_0xb13faa);if(_0x19cf10[_0xf0ed('0x32')]['filter']){_0x4fa7ac[_0xf0ed('0x3b')]=_['merge'](_0x4fa7ac['where'],{'$or':_[_0xf0ed('0x2f')](_0xb13faa,function(_0x5e419a){if(_0x5e419a[_0xf0ed('0x3c')]!=='VIRTUAL'){var _0x4b4352={};_0x4b4352[_0x5e419a['name']]={'$like':'%'+_0x19cf10[_0xf0ed('0x32')][_0xf0ed('0x3d')]+'%'};return _0x4b4352;}})});}_0x4fa7ac=_[_0xf0ed('0x3e')]({},_0x4fa7ac,_0x19cf10[_0xf0ed('0x3f')]);var _0x7af639={'where':_0x4fa7ac[_0xf0ed('0x3b')]};return db['SalesforceAccount']['count'](_0x7af639)[_0xf0ed('0x29')](function(_0x2a05b1){_0x22a9df[_0xf0ed('0x22')]=_0x2a05b1;if(_0x19cf10['query'][_0xf0ed('0x40')]){_0x4fa7ac['include']=[{'all':!![]}];}return db[_0xf0ed('0x41')]['findAll'](_0x4fa7ac);})['then'](function(_0x27f2dc){_0x22a9df['rows']=_0x27f2dc;return _0x22a9df;})[_0xf0ed('0x29')](respondWithFilteredResult(_0x21ea4,_0x4fa7ac))[_0xf0ed('0x42')](handleError(_0x21ea4,null));};exports[_0xf0ed('0x43')]=function(_0xdd0c43,_0x28639a){var _0x286131={'raw':![],'where':{'id':_0xdd0c43[_0xf0ed('0x44')]['id']}},_0x2a6f03={};_0x2a6f03['model']=_[_0xf0ed('0x45')](db[_0xf0ed('0x41')]['rawAttributes']);_0x2a6f03[_0xf0ed('0x32')]=_[_0xf0ed('0x45')](_0xdd0c43[_0xf0ed('0x32')]);_0x2a6f03['filters']=_[_0xf0ed('0x34')](_0x2a6f03['model'],_0x2a6f03[_0xf0ed('0x32')]);_0x286131[_0xf0ed('0x36')]=_['intersection'](_0x2a6f03[_0xf0ed('0x35')],qs[_0xf0ed('0x37')](_0xdd0c43[_0xf0ed('0x32')][_0xf0ed('0x37')]));_0x286131[_0xf0ed('0x36')]=_0x286131['attributes']['length']?_0x286131[_0xf0ed('0x36')]:_0x2a6f03[_0xf0ed('0x35')];if(_0xdd0c43[_0xf0ed('0x32')][_0xf0ed('0x40')]){_0x286131['include']=[{'all':!![]}];}_0x286131=_[_0xf0ed('0x3e')]({},_0x286131,_0xdd0c43[_0xf0ed('0x3f')]);return db['SalesforceAccount'][_0xf0ed('0x46')](_0x286131)[_0xf0ed('0x29')](handleEntityNotFound(_0x28639a,null))[_0xf0ed('0x29')](respondWithResult(_0x28639a,null))[_0xf0ed('0x42')](handleError(_0x28639a,null));};exports[_0xf0ed('0x47')]=function(_0x497564,_0x5f50bf){return db[_0xf0ed('0x41')][_0xf0ed('0x47')](_0x497564[_0xf0ed('0x48')],{})[_0xf0ed('0x29')](respondWithResult(_0x5f50bf,0xc9))[_0xf0ed('0x42')](handleError(_0x5f50bf,null));};exports[_0xf0ed('0x49')]=function(_0x505231,_0x6f8cf1){if(_0x505231[_0xf0ed('0x48')]['id']){delete _0x505231[_0xf0ed('0x48')]['id'];}return db[_0xf0ed('0x41')]['find']({'where':{'id':_0x505231[_0xf0ed('0x44')]['id']}})[_0xf0ed('0x29')](handleEntityNotFound(_0x6f8cf1,null))[_0xf0ed('0x29')](saveUpdates(_0x505231['body'],null))[_0xf0ed('0x29')](respondWithResult(_0x6f8cf1,null))['catch'](handleError(_0x6f8cf1,null));};exports['destroy']=function(_0xf9b671,_0x52f668){return db[_0xf0ed('0x41')][_0xf0ed('0x46')]({'where':{'id':_0xf9b671['params']['id']}})[_0xf0ed('0x29')](handleEntityNotFound(_0x52f668,null))[_0xf0ed('0x29')](removeEntity(_0x52f668,null))[_0xf0ed('0x42')](handleError(_0x52f668,null));};exports['getConfigurations']=function(_0x10dca9,_0x4f10e3,_0x2cf47e){var _0x2c9d56={};var _0x161c85={};var _0xa09097;var _0x4b3e52;return db['SalesforceAccount'][_0xf0ed('0x4a')]({'where':{'id':_0x10dca9[_0xf0ed('0x44')]['id']}})[_0xf0ed('0x29')](handleEntityNotFound(_0x4f10e3,null))[_0xf0ed('0x29')](function(_0x5cd688){if(_0x5cd688){_0xa09097=_0x5cd688;_0x161c85[_0xf0ed('0x35')]=_[_0xf0ed('0x45')](db[_0xf0ed('0x4b')][_0xf0ed('0x30')]);_0x161c85[_0xf0ed('0x32')]=_[_0xf0ed('0x45')](_0x10dca9['query']);_0x161c85[_0xf0ed('0x33')]=_[_0xf0ed('0x34')](_0x161c85[_0xf0ed('0x35')],_0x161c85[_0xf0ed('0x32')]);_0x2c9d56['attributes']=_[_0xf0ed('0x34')](_0x161c85[_0xf0ed('0x35')],qs[_0xf0ed('0x37')](_0x10dca9[_0xf0ed('0x32')][_0xf0ed('0x37')]));_0x2c9d56[_0xf0ed('0x36')]=_0x2c9d56['attributes']['length']?_0x2c9d56[_0xf0ed('0x36')]:_0x161c85[_0xf0ed('0x35')];_0x2c9d56[_0xf0ed('0x39')]=qs['sort'](_0x10dca9[_0xf0ed('0x32')][_0xf0ed('0x3a')]);_0x2c9d56[_0xf0ed('0x3b')]=qs[_0xf0ed('0x33')](_[_0xf0ed('0x4c')](_0x10dca9[_0xf0ed('0x32')],_0x161c85['filters']));if(_0x10dca9['query']['filter']){_0x2c9d56[_0xf0ed('0x3b')]=_[_0xf0ed('0x3e')](_0x2c9d56[_0xf0ed('0x3b')],{'$or':_[_0xf0ed('0x2f')](_0x2c9d56[_0xf0ed('0x36')],function(_0x57309d){var _0x3ba076={};_0x3ba076[_0x57309d]={'$like':'%'+_0x10dca9['query']['filter']+'%'};return _0x3ba076;})});}_0x2c9d56=_[_0xf0ed('0x3e')]({},_0x2c9d56,_0x10dca9[_0xf0ed('0x3f')]);return _0xa09097['getConfigurations'](_0x2c9d56);}})['then'](function(_0x4dc7f4){if(_0x4dc7f4){_0x4b3e52=_0x4dc7f4[_0xf0ed('0x4d')];if(!_0x10dca9[_0xf0ed('0x32')][_0xf0ed('0x38')]('nolimit')){_0x2c9d56[_0xf0ed('0x23')]=qs[_0xf0ed('0x23')](_0x10dca9[_0xf0ed('0x32')][_0xf0ed('0x23')]);_0x2c9d56['offset']=qs[_0xf0ed('0x21')](_0x10dca9['query'][_0xf0ed('0x21')]);}return _0xa09097[_0xf0ed('0x4e')](_0x2c9d56);}})[_0xf0ed('0x29')](function(_0x243890){if(_0x243890){return _0x243890?{'count':_0x4b3e52,'rows':_0x243890}:null;}})['then'](respondWithResult(_0x4f10e3,null))['catch'](handleError(_0x4f10e3,null));};exports['addConfiguration']=function(_0x321a3c,_0x158f5d,_0x58a11c){if(_0x321a3c[_0xf0ed('0x48')]['id']){delete _0x321a3c[_0xf0ed('0x48')]['id'];}return db['SalesforceAccount'][_0xf0ed('0x4a')]({'where':{'id':_0x321a3c[_0xf0ed('0x44')]['id']}})[_0xf0ed('0x29')](handleEntityNotFound(_0x158f5d,null))['then'](function(_0x50200a){if(_0x50200a){_0x321a3c['body']['AccountId']=_0x50200a['id'];_0x321a3c[_0xf0ed('0x48')][_0xf0ed('0x4f')]=integrations[_0xf0ed('0x50')](_0x321a3c[_0xf0ed('0x48')][_0xf0ed('0x51')],_0x321a3c[_0xf0ed('0x48')][_0xf0ed('0x3c')]);_0x321a3c[_0xf0ed('0x48')][_0xf0ed('0x52')]=integrations[_0xf0ed('0x53')](_0x321a3c[_0xf0ed('0x48')][_0xf0ed('0x51')],_0x321a3c[_0xf0ed('0x48')][_0xf0ed('0x3c')]);return db[_0xf0ed('0x4b')][_0xf0ed('0x47')](_0x321a3c[_0xf0ed('0x48')],{'include':[{'model':db[_0xf0ed('0x54')],'as':'Subjects'},{'model':db[_0xf0ed('0x54')],'as':_0xf0ed('0x52')}]});}return null;})['then'](respondWithResult(_0x158f5d,null))[_0xf0ed('0x42')](handleError(_0x158f5d,null));};exports[_0xf0ed('0x55')]=function(_0x3f4348,_0x4cd441,_0x2d50c){var _0x29f72f;var _0xb8656a='';var _0x3d697b=_0xf0ed('0x56');return db['SalesforceAccount']['findOne']({'where':{'id':_0x3f4348[_0xf0ed('0x44')]['id']},'attributes':['id',_0xf0ed('0x57'),_0xf0ed('0x58'),'clientSecret',_0xf0ed('0x59'),'password','securityToken']})[_0xf0ed('0x29')](handleEntityNotFound(_0x4cd441,null))[_0xf0ed('0x29')](function(_0x1790f9){if(_0x1790f9){_0xb8656a=_0x1790f9[_0xf0ed('0x57')];var _0x571c35=_0xb8656a[_0xf0ed('0x5a')](-0x1);if(_0x571c35==='/'){_0xb8656a=_0xb8656a[_0xf0ed('0x5b')](0x0,_0xb8656a[_0xf0ed('0x5c')](_0x571c35));}_0x29f72f=new jsforce[(_0xf0ed('0x5d'))]({'oauth2':{'loginUrl':_0xb8656a,'clientId':_0x1790f9[_0xf0ed('0x58')],'clientSecret':_0x1790f9[_0xf0ed('0x5e')]}});return _0x29f72f[_0xf0ed('0x5f')](_0x1790f9['username'],_0x1790f9['password'][_0xf0ed('0x60')](_0x1790f9[_0xf0ed('0x61')]));}})[_0xf0ed('0x29')](function(_0x3c5df9){if(_0x3c5df9){if(!_[_0xf0ed('0x62')](_0x3f4348[_0xf0ed('0x32')]['ticketType'])){_0x3d697b=_0x3f4348[_0xf0ed('0x32')][_0xf0ed('0x63')];}return _0x29f72f['sobject'](_0x3d697b)[_0xf0ed('0x64')]();}})['then'](function(_0x493b40){var _0x37bd1c=[_0xf0ed('0x65'),_0xf0ed('0x66'),_0xf0ed('0x67'),'IsRecurrence',_0xf0ed('0x68'),_0xf0ed('0x69')];var _0x25399f=[_0xf0ed('0x6a'),_0xf0ed('0x6b'),_0xf0ed('0x6c'),_0xf0ed('0x6d'),'email',_0xf0ed('0x6e'),_0xf0ed('0x6f')];if(_0x493b40){_['remove'](_0x493b40[_0xf0ed('0x37')],function(_0x1d9c28){return _0x37bd1c[_0xf0ed('0x70')](_0x1d9c28[_0xf0ed('0x2c')])||!_0x25399f[_0xf0ed('0x70')](_0x1d9c28[_0xf0ed('0x3c')]);});return{'count':_0x493b40[_0xf0ed('0x37')]['length'],'rows':_['map'](_0x493b40[_0xf0ed('0x37')],function(_0x33e08e){return{'id':_0x33e08e[_0xf0ed('0x2c')],'name':_0x33e08e[_0xf0ed('0x71')],'custom':_0x33e08e[_0xf0ed('0x72')],'options':_0x33e08e[_0xf0ed('0x73')][_0xf0ed('0x4d')]>0x0?_['map'](_0x33e08e[_0xf0ed('0x73')],function(_0x145438){return{'name':_0x145438[_0xf0ed('0x71')],'value':_0x145438[_0xf0ed('0x74')]};}):_0x33e08e[_0xf0ed('0x3c')]==_0xf0ed('0x6d')?[{'name':_0xf0ed('0x75'),'value':_0xf0ed('0x76')},{'name':_0xf0ed('0x77'),'value':_0xf0ed('0x78')}]:[]};})};}})[_0xf0ed('0x29')](respondWithResult(_0x4cd441,null))[_0xf0ed('0x42')](function(_0x5864d5){var _0x51eeb1=_0x3f4348[_0xf0ed('0x32')][_0xf0ed('0x79')]?0x1f4:_0x5864d5[_0xf0ed('0x7a')]||0x1f4;logger[_0xf0ed('0x2a')](_0xf0ed('0x7b'),_0xf0ed('0x55'),_0x51eeb1,JSON['stringify'](_0x5864d5));delete _0x5864d5[_0xf0ed('0x2c')];if(_0x51eeb1===0x191){_0x51eeb1=0x190;}_0x4cd441[_0xf0ed('0x1f')](_0x51eeb1)['send'](_0x3f4348['query']['test']?{'message':_0xf0ed('0x7c'),'statusCode':_0x5864d5['statusCode']}:_0x5864d5);});}; \ No newline at end of file +var _0xa1c9=['Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','SalesforceAccount','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','AccountId','Subjects','channel','Descriptions','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','Subject','string','int','picklist','boolean','phone','remove','includes','label','custom','picklistValues','value','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields'];(function(_0x5ac897,_0x4284d3){var _0x541452=function(_0x27d54d){while(--_0x27d54d){_0x5ac897['push'](_0x5ac897['shift']());}};_0x541452(++_0x4284d3);}(_0xa1c9,0x1c1));var _0x9a1c=function(_0x4c2c23,_0x3d8d28){_0x4c2c23=_0x4c2c23-0x0;var _0x5c992e=_0xa1c9[_0x4c2c23];return _0x5c992e;};'use strict';var emlformat=require(_0x9a1c('0x0'));var rimraf=require(_0x9a1c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a1c('0x2'));var rp=require('request-promise');var moment=require(_0x9a1c('0x3'));var BPromise=require(_0x9a1c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9a1c('0x5'));var sox=require('sox');var csv=require(_0x9a1c('0x6'));var ejs=require(_0x9a1c('0x7'));var fs=require('fs');var fs_extra=require(_0x9a1c('0x8'));var _=require(_0x9a1c('0x9'));var squel=require('squel');var crypto=require(_0x9a1c('0xa'));var jsforce=require(_0x9a1c('0xb'));var deskjs=require(_0x9a1c('0xc'));var toCsv=require(_0x9a1c('0x6'));var querystring=require('querystring');var Papa=require(_0x9a1c('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9a1c('0xe'));var hardwareService=require(_0x9a1c('0xf'));var logger=require(_0x9a1c('0x10'))(_0x9a1c('0x11'));var utils=require(_0x9a1c('0x12'));var config=require(_0x9a1c('0x13'));var licenseUtil=require(_0x9a1c('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1d1a60,_0x1db79f){_0x1db79f=_0x1db79f||0xcc;return function(_0x4e9312){if(_0x4e9312){return _0x1d1a60[_0x9a1c('0x15')](_0x1db79f);}return _0x1d1a60[_0x9a1c('0x16')](_0x1db79f)[_0x9a1c('0x17')]();};}function respondWithResult(_0x1a990c,_0x21cd95){_0x21cd95=_0x21cd95||0xc8;return function(_0x31d802){if(_0x31d802){return _0x1a990c[_0x9a1c('0x16')](_0x21cd95)[_0x9a1c('0x18')](_0x31d802);}};}function respondWithFilteredResult(_0x305211,_0x37789d){return function(_0x3d7013){if(_0x3d7013){var _0xb08f44=typeof _0x37789d['offset']==='undefined'&&typeof _0x37789d[_0x9a1c('0x19')]===_0x9a1c('0x1a');var _0x33d006=_0x3d7013[_0x9a1c('0x1b')];var _0x551ece=_0xb08f44?0x0:_0x37789d[_0x9a1c('0x1c')];var _0x2c2263=_0xb08f44?_0x3d7013[_0x9a1c('0x1b')]:_0x37789d[_0x9a1c('0x1c')]+_0x37789d[_0x9a1c('0x19')];var _0x32548f;if(_0x2c2263>=_0x33d006){_0x2c2263=_0x33d006;_0x32548f=0xc8;}else{_0x32548f=0xce;}_0x305211[_0x9a1c('0x16')](_0x32548f);return _0x305211['set'](_0x9a1c('0x1d'),_0x551ece+'-'+_0x2c2263+'/'+_0x33d006)['json'](_0x3d7013);}return null;};}function patchUpdates(_0x326934){return function(_0x411b4a){try{jsonpatch['apply'](_0x411b4a,_0x326934,!![]);}catch(_0x42d9fd){return BPromise['reject'](_0x42d9fd);}return _0x411b4a[_0x9a1c('0x1e')]();};}function saveUpdates(_0x3feb02,_0x4e1841){return function(_0x1b0cd2){if(_0x1b0cd2){return _0x1b0cd2[_0x9a1c('0x1f')](_0x3feb02)[_0x9a1c('0x20')](function(_0x2172ce){return _0x2172ce;});}return null;};}function removeEntity(_0x49775d,_0x39c8ad){return function(_0x177041){if(_0x177041){return _0x177041[_0x9a1c('0x21')]()['then'](function(){_0x49775d[_0x9a1c('0x16')](0xcc)[_0x9a1c('0x17')]();});}};}function handleEntityNotFound(_0x302a48,_0x44bba5){return function(_0x3625a5){if(!_0x3625a5){_0x302a48[_0x9a1c('0x15')](0x194);}return _0x3625a5;};}function handleError(_0x5ba3da,_0xb8737d){_0xb8737d=_0xb8737d||0x1f4;return function(_0x1314cd){logger[_0x9a1c('0x22')](_0x1314cd['stack']);if(_0x1314cd[_0x9a1c('0x23')]){delete _0x1314cd[_0x9a1c('0x23')];}_0x5ba3da[_0x9a1c('0x16')](_0xb8737d)[_0x9a1c('0x24')](_0x1314cd);};}exports[_0x9a1c('0x25')]=function(_0x2c4a7a,_0x1dc89d){var _0x49fa05={},_0x2e7e0f={},_0x3a82b0={'count':0x0,'rows':[]};var _0x222043=_[_0x9a1c('0x26')](db['SalesforceAccount'][_0x9a1c('0x27')],function(_0x25a007){return{'name':_0x25a007[_0x9a1c('0x28')],'type':_0x25a007[_0x9a1c('0x29')]['key']};});_0x2e7e0f['model']=_[_0x9a1c('0x26')](_0x222043,'name');_0x2e7e0f[_0x9a1c('0x2a')]=_[_0x9a1c('0x2b')](_0x2c4a7a['query']);_0x2e7e0f[_0x9a1c('0x2c')]=_[_0x9a1c('0x2d')](_0x2e7e0f[_0x9a1c('0x2e')],_0x2e7e0f[_0x9a1c('0x2a')]);_0x49fa05['attributes']=_['intersection'](_0x2e7e0f['model'],qs[_0x9a1c('0x2f')](_0x2c4a7a[_0x9a1c('0x2a')][_0x9a1c('0x2f')]));_0x49fa05[_0x9a1c('0x30')]=_0x49fa05[_0x9a1c('0x30')][_0x9a1c('0x31')]?_0x49fa05['attributes']:_0x2e7e0f[_0x9a1c('0x2e')];if(!_0x2c4a7a[_0x9a1c('0x2a')][_0x9a1c('0x32')]('nolimit')){_0x49fa05[_0x9a1c('0x19')]=qs['limit'](_0x2c4a7a[_0x9a1c('0x2a')][_0x9a1c('0x19')]);_0x49fa05[_0x9a1c('0x1c')]=qs[_0x9a1c('0x1c')](_0x2c4a7a[_0x9a1c('0x2a')][_0x9a1c('0x1c')]);}_0x49fa05[_0x9a1c('0x33')]=qs[_0x9a1c('0x34')](_0x2c4a7a['query'][_0x9a1c('0x34')]);_0x49fa05['where']=qs[_0x9a1c('0x2c')](_[_0x9a1c('0x35')](_0x2c4a7a[_0x9a1c('0x2a')],_0x2e7e0f[_0x9a1c('0x2c')]),_0x222043);if(_0x2c4a7a['query'][_0x9a1c('0x36')]){_0x49fa05[_0x9a1c('0x37')]=_[_0x9a1c('0x38')](_0x49fa05[_0x9a1c('0x37')],{'$or':_[_0x9a1c('0x26')](_0x222043,function(_0x5aeba0){if(_0x5aeba0[_0x9a1c('0x29')]!==_0x9a1c('0x39')){var _0x16060f={};_0x16060f[_0x5aeba0['name']]={'$like':'%'+_0x2c4a7a['query'][_0x9a1c('0x36')]+'%'};return _0x16060f;}})});}_0x49fa05=_[_0x9a1c('0x38')]({},_0x49fa05,_0x2c4a7a[_0x9a1c('0x3a')]);var _0x10bc77={'where':_0x49fa05[_0x9a1c('0x37')]};return db['SalesforceAccount'][_0x9a1c('0x1b')](_0x10bc77)[_0x9a1c('0x20')](function(_0x3dfba1){_0x3a82b0[_0x9a1c('0x1b')]=_0x3dfba1;if(_0x2c4a7a['query'][_0x9a1c('0x3b')]){_0x49fa05[_0x9a1c('0x3c')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x49fa05);})[_0x9a1c('0x20')](function(_0x6dee96){_0x3a82b0[_0x9a1c('0x3d')]=_0x6dee96;return _0x3a82b0;})[_0x9a1c('0x20')](respondWithFilteredResult(_0x1dc89d,_0x49fa05))[_0x9a1c('0x3e')](handleError(_0x1dc89d,null));};exports[_0x9a1c('0x3f')]=function(_0x2242f6,_0x2af9be){var _0x54c613={'raw':![],'where':{'id':_0x2242f6['params']['id']}},_0x4c6577={};_0x4c6577['model']=_['keys'](db[_0x9a1c('0x40')][_0x9a1c('0x27')]);_0x4c6577[_0x9a1c('0x2a')]=_['keys'](_0x2242f6[_0x9a1c('0x2a')]);_0x4c6577[_0x9a1c('0x2c')]=_[_0x9a1c('0x2d')](_0x4c6577['model'],_0x4c6577['query']);_0x54c613[_0x9a1c('0x30')]=_[_0x9a1c('0x2d')](_0x4c6577[_0x9a1c('0x2e')],qs[_0x9a1c('0x2f')](_0x2242f6[_0x9a1c('0x2a')][_0x9a1c('0x2f')]));_0x54c613['attributes']=_0x54c613[_0x9a1c('0x30')][_0x9a1c('0x31')]?_0x54c613[_0x9a1c('0x30')]:_0x4c6577[_0x9a1c('0x2e')];if(_0x2242f6[_0x9a1c('0x2a')][_0x9a1c('0x3b')]){_0x54c613[_0x9a1c('0x3c')]=[{'all':!![]}];}_0x54c613=_[_0x9a1c('0x38')]({},_0x54c613,_0x2242f6[_0x9a1c('0x3a')]);return db[_0x9a1c('0x40')][_0x9a1c('0x41')](_0x54c613)[_0x9a1c('0x20')](handleEntityNotFound(_0x2af9be,null))['then'](respondWithResult(_0x2af9be,null))[_0x9a1c('0x3e')](handleError(_0x2af9be,null));};exports['create']=function(_0x5b9368,_0x3abf5e){return db[_0x9a1c('0x40')][_0x9a1c('0x42')](_0x5b9368[_0x9a1c('0x43')],{})['then'](respondWithResult(_0x3abf5e,0xc9))[_0x9a1c('0x3e')](handleError(_0x3abf5e,null));};exports[_0x9a1c('0x1f')]=function(_0x43c464,_0x4e2157){if(_0x43c464[_0x9a1c('0x43')]['id']){delete _0x43c464['body']['id'];}return db[_0x9a1c('0x40')][_0x9a1c('0x41')]({'where':{'id':_0x43c464[_0x9a1c('0x44')]['id']}})[_0x9a1c('0x20')](handleEntityNotFound(_0x4e2157,null))['then'](saveUpdates(_0x43c464['body'],null))[_0x9a1c('0x20')](respondWithResult(_0x4e2157,null))['catch'](handleError(_0x4e2157,null));};exports[_0x9a1c('0x21')]=function(_0x2a0a08,_0xb24c51){return db['SalesforceAccount']['find']({'where':{'id':_0x2a0a08[_0x9a1c('0x44')]['id']}})[_0x9a1c('0x20')](handleEntityNotFound(_0xb24c51,null))['then'](removeEntity(_0xb24c51,null))[_0x9a1c('0x3e')](handleError(_0xb24c51,null));};exports[_0x9a1c('0x45')]=function(_0x455903,_0x4cd1d4,_0x2977d2){var _0x11d57b={};var _0xe578ce={};var _0x33362c;var _0x150813;return db[_0x9a1c('0x40')][_0x9a1c('0x46')]({'where':{'id':_0x455903[_0x9a1c('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cd1d4,null))[_0x9a1c('0x20')](function(_0x5ea8f3){if(_0x5ea8f3){_0x33362c=_0x5ea8f3;_0xe578ce[_0x9a1c('0x2e')]=_[_0x9a1c('0x2b')](db[_0x9a1c('0x47')][_0x9a1c('0x27')]);_0xe578ce[_0x9a1c('0x2a')]=_[_0x9a1c('0x2b')](_0x455903[_0x9a1c('0x2a')]);_0xe578ce[_0x9a1c('0x2c')]=_[_0x9a1c('0x2d')](_0xe578ce[_0x9a1c('0x2e')],_0xe578ce[_0x9a1c('0x2a')]);_0x11d57b[_0x9a1c('0x30')]=_[_0x9a1c('0x2d')](_0xe578ce['model'],qs[_0x9a1c('0x2f')](_0x455903[_0x9a1c('0x2a')][_0x9a1c('0x2f')]));_0x11d57b['attributes']=_0x11d57b['attributes'][_0x9a1c('0x31')]?_0x11d57b[_0x9a1c('0x30')]:_0xe578ce[_0x9a1c('0x2e')];_0x11d57b[_0x9a1c('0x33')]=qs[_0x9a1c('0x34')](_0x455903[_0x9a1c('0x2a')][_0x9a1c('0x34')]);_0x11d57b[_0x9a1c('0x37')]=qs[_0x9a1c('0x2c')](_[_0x9a1c('0x35')](_0x455903[_0x9a1c('0x2a')],_0xe578ce['filters']));if(_0x455903[_0x9a1c('0x2a')]['filter']){_0x11d57b[_0x9a1c('0x37')]=_[_0x9a1c('0x38')](_0x11d57b['where'],{'$or':_[_0x9a1c('0x26')](_0x11d57b[_0x9a1c('0x30')],function(_0x2bd392){var _0x3b4a6e={};_0x3b4a6e[_0x2bd392]={'$like':'%'+_0x455903[_0x9a1c('0x2a')][_0x9a1c('0x36')]+'%'};return _0x3b4a6e;})});}_0x11d57b=_['merge']({},_0x11d57b,_0x455903[_0x9a1c('0x3a')]);return _0x33362c[_0x9a1c('0x45')](_0x11d57b);}})[_0x9a1c('0x20')](function(_0x8a735f){if(_0x8a735f){_0x150813=_0x8a735f[_0x9a1c('0x31')];if(!_0x455903[_0x9a1c('0x2a')][_0x9a1c('0x32')]('nolimit')){_0x11d57b[_0x9a1c('0x19')]=qs['limit'](_0x455903[_0x9a1c('0x2a')][_0x9a1c('0x19')]);_0x11d57b['offset']=qs[_0x9a1c('0x1c')](_0x455903['query'][_0x9a1c('0x1c')]);}return _0x33362c[_0x9a1c('0x45')](_0x11d57b);}})[_0x9a1c('0x20')](function(_0x23b164){if(_0x23b164){return _0x23b164?{'count':_0x150813,'rows':_0x23b164}:null;}})[_0x9a1c('0x20')](respondWithResult(_0x4cd1d4,null))[_0x9a1c('0x3e')](handleError(_0x4cd1d4,null));};exports['addConfiguration']=function(_0x15077a,_0x6310a9,_0x45f84e){if(_0x15077a[_0x9a1c('0x43')]['id']){delete _0x15077a[_0x9a1c('0x43')]['id'];}return db[_0x9a1c('0x40')][_0x9a1c('0x46')]({'where':{'id':_0x15077a[_0x9a1c('0x44')]['id']}})[_0x9a1c('0x20')](handleEntityNotFound(_0x6310a9,null))[_0x9a1c('0x20')](function(_0x1f3d1e){if(_0x1f3d1e){_0x15077a[_0x9a1c('0x43')][_0x9a1c('0x48')]=_0x1f3d1e['id'];_0x15077a[_0x9a1c('0x43')][_0x9a1c('0x49')]=integrations['getSubjects'](_0x15077a[_0x9a1c('0x43')][_0x9a1c('0x4a')],_0x15077a[_0x9a1c('0x43')]['type']);_0x15077a['body'][_0x9a1c('0x4b')]=integrations['getDescriptions'](_0x15077a[_0x9a1c('0x43')][_0x9a1c('0x4a')],_0x15077a[_0x9a1c('0x43')]['type']);return db[_0x9a1c('0x47')][_0x9a1c('0x42')](_0x15077a['body'],{'include':[{'model':db['SalesforceField'],'as':_0x9a1c('0x49')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x6310a9,null))['catch'](handleError(_0x6310a9,null));};exports['getFields']=function(_0x33b1be,_0x463bc7,_0x4b2baf){var _0x6dc77b;var _0x5da81d='';var _0x36b663=_0x9a1c('0x4c');return db[_0x9a1c('0x40')]['findOne']({'where':{'id':_0x33b1be[_0x9a1c('0x44')]['id']},'attributes':['id',_0x9a1c('0x4d'),_0x9a1c('0x4e'),_0x9a1c('0x4f'),_0x9a1c('0x50'),_0x9a1c('0x51'),_0x9a1c('0x52')]})[_0x9a1c('0x20')](handleEntityNotFound(_0x463bc7,null))[_0x9a1c('0x20')](function(_0x4e744e){if(_0x4e744e){_0x5da81d=_0x4e744e[_0x9a1c('0x4d')];var _0x5b6b4f=_0x5da81d[_0x9a1c('0x53')](-0x1);if(_0x5b6b4f==='/'){_0x5da81d=_0x5da81d['substring'](0x0,_0x5da81d[_0x9a1c('0x54')](_0x5b6b4f));}_0x6dc77b=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5da81d,'clientId':_0x4e744e['clientId'],'clientSecret':_0x4e744e['clientSecret']}});return _0x6dc77b[_0x9a1c('0x55')](_0x4e744e[_0x9a1c('0x50')],_0x4e744e[_0x9a1c('0x51')][_0x9a1c('0x56')](_0x4e744e[_0x9a1c('0x52')]));}})['then'](function(_0x407d5e){if(_0x407d5e){if(!_[_0x9a1c('0x57')](_0x33b1be['query'][_0x9a1c('0x58')])){_0x36b663=_0x33b1be[_0x9a1c('0x2a')][_0x9a1c('0x58')];}return _0x6dc77b[_0x9a1c('0x59')](_0x36b663)[_0x9a1c('0x5a')]();}})[_0x9a1c('0x20')](function(_0x387f4b){var _0x39afbe=[_0x9a1c('0x5b'),'ActivityDate',_0x9a1c('0x5c'),'IsRecurrence',_0x9a1c('0x5d'),'Description'];var _0x4c0311=[_0x9a1c('0x5e'),_0x9a1c('0x5f'),_0x9a1c('0x60'),_0x9a1c('0x61'),'email','textarea',_0x9a1c('0x62')];if(_0x387f4b){_[_0x9a1c('0x63')](_0x387f4b[_0x9a1c('0x2f')],function(_0x345f26){return _0x39afbe[_0x9a1c('0x64')](_0x345f26[_0x9a1c('0x23')])||!_0x4c0311[_0x9a1c('0x64')](_0x345f26[_0x9a1c('0x29')]);});return{'count':_0x387f4b[_0x9a1c('0x2f')]['length'],'rows':_[_0x9a1c('0x26')](_0x387f4b[_0x9a1c('0x2f')],function(_0x5a2f14){return{'id':_0x5a2f14['name'],'name':_0x5a2f14[_0x9a1c('0x65')],'custom':_0x5a2f14[_0x9a1c('0x66')],'options':_0x5a2f14[_0x9a1c('0x67')][_0x9a1c('0x31')]>0x0?_['map'](_0x5a2f14['picklistValues'],function(_0x5302d8){return{'name':_0x5302d8[_0x9a1c('0x65')],'value':_0x5302d8[_0x9a1c('0x68')]};}):_0x5a2f14[_0x9a1c('0x29')]==_0x9a1c('0x61')?[{'name':'True','value':_0x9a1c('0x69')},{'name':'False','value':_0x9a1c('0x6a')}]:[]};})};}})[_0x9a1c('0x20')](respondWithResult(_0x463bc7,null))[_0x9a1c('0x3e')](function(_0x2bee3f){var _0x4f3458=_0x33b1be[_0x9a1c('0x2a')][_0x9a1c('0x6b')]?0x1f4:_0x2bee3f[_0x9a1c('0x6c')]||0x1f4;logger[_0x9a1c('0x22')](_0x9a1c('0x6d'),_0x9a1c('0x6e'),_0x4f3458,JSON['stringify'](_0x2bee3f));delete _0x2bee3f[_0x9a1c('0x23')];if(_0x4f3458===0x191){_0x4f3458=0x190;}_0x463bc7[_0x9a1c('0x16')](_0x4f3458)['send'](_0x33b1be[_0x9a1c('0x2a')][_0x9a1c('0x6b')]?{'message':_0x9a1c('0x6f'),'statusCode':_0x2bee3f[_0x9a1c('0x6c')]}:_0x2bee3f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index f24d970..b9a7443 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 _0x7ec2=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7ec2,0x15c));var _0x27ec=function(_0x2ac40d,_0x5e30c4){_0x2ac40d=_0x2ac40d-0x0;var _0x81463f=_0x7ec2[_0x2ac40d];return _0x81463f;};'use strict';var _=require(_0x27ec('0x0'));var util=require(_0x27ec('0x1'));var logger=require(_0x27ec('0x2'))('api');var moment=require(_0x27ec('0x3'));var BPromise=require(_0x27ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27ec('0x5'));var rimraf=require(_0x27ec('0x6'));var config=require(_0x27ec('0x7'));var attributes=require(_0x27ec('0x8'));var integrations=require(_0x27ec('0x9'));module[_0x27ec('0xa')]=function(_0x2ac546,_0x280cdb){return _0x2ac546[_0x27ec('0xb')](_0x27ec('0xc'),attributes,{'tableName':_0x27ec('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x758e=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x42512a,_0x517e42){var _0x23d148=function(_0x4d1f40){while(--_0x4d1f40){_0x42512a['push'](_0x42512a['shift']());}};_0x23d148(++_0x517e42);}(_0x758e,0xc9));var _0xe758=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x758e[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xe758('0x0'));var util=require(_0xe758('0x1'));var logger=require(_0xe758('0x2'))('api');var moment=require(_0xe758('0x3'));var BPromise=require('bluebird');var rp=require(_0xe758('0x4'));var fs=require('fs');var path=require(_0xe758('0x5'));var rimraf=require(_0xe758('0x6'));var config=require(_0xe758('0x7'));var attributes=require(_0xe758('0x8'));var integrations=require(_0xe758('0x9'));module[_0xe758('0xa')]=function(_0x15208d,_0x19e678){return _0x15208d[_0xe758('0xb')](_0xe758('0xc'),attributes,{'tableName':_0xe758('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 5d393da..0be7ce7 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 _0x8bb2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetSalesforceAccount','SalesforceAccount','findAll','raw','options','where','attributes','limit','include','map','model','debug','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x8bb2,0x170));var _0x28bb=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x8bb2[_0x4350c2];return _0x8b6406;};'use strict';var _=require('lodash');var util=require(_0x28bb('0x0'));var moment=require(_0x28bb('0x1'));var BPromise=require(_0x28bb('0x2'));var rs=require(_0x28bb('0x3'));var fs=require('fs');var Redis=require(_0x28bb('0x4'));var db=require(_0x28bb('0x5'))['db'];var utils=require(_0x28bb('0x6'));var logger=require(_0x28bb('0x7'))(_0x28bb('0x8'));var config=require(_0x28bb('0x9'));var jayson=require(_0x28bb('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1812f6,_0xb5e942,_0xf9c9fd){return new BPromise(function(_0x1db65d,_0xcefe36){return client[_0x28bb('0xb')](_0x1812f6,_0xf9c9fd)[_0x28bb('0xc')](function(_0x10081c){logger[_0x28bb('0xd')](_0x28bb('0xe'),_0xb5e942,_0x28bb('0xf'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xb5e942,'request\x20sent',JSON[_0x28bb('0x10')](_0x10081c));if(_0x10081c[_0x28bb('0x11')]){if(_0x10081c[_0x28bb('0x11')][_0x28bb('0x12')]===0x1f4){logger['error'](_0x28bb('0xe'),_0xb5e942,_0x10081c[_0x28bb('0x11')]['message']);return _0xcefe36(_0x10081c[_0x28bb('0x11')][_0x28bb('0x13')]);}logger[_0x28bb('0x11')](_0x28bb('0xe'),_0xb5e942,_0x10081c[_0x28bb('0x11')][_0x28bb('0x13')]);return _0x1db65d(_0x10081c[_0x28bb('0x11')]['message']);}else{logger['info'](_0x28bb('0xe'),_0xb5e942,_0x28bb('0xf'));_0x1db65d(_0x10081c['result'][_0x28bb('0x13')]);}})['catch'](function(_0x236c91){logger[_0x28bb('0x11')](_0x28bb('0xe'),_0xb5e942,_0x236c91);_0xcefe36(_0x236c91);});});}exports[_0x28bb('0x14')]=function(_0x28711e){var _0x1f072d=this;return new Promise(function(_0x459249,_0x722dc5){return db[_0x28bb('0x15')][_0x28bb('0x16')]({'raw':_0x28711e['options']?_0x28711e['options'][_0x28bb('0x17')]===undefined?!![]:![]:!![],'where':_0x28711e['options']?_0x28711e[_0x28bb('0x18')][_0x28bb('0x19')]||null:null,'attributes':_0x28711e[_0x28bb('0x18')]?_0x28711e[_0x28bb('0x18')][_0x28bb('0x1a')]||null:null,'limit':_0x28711e[_0x28bb('0x18')]?_0x28711e[_0x28bb('0x18')][_0x28bb('0x1b')]||null:null,'include':_0x28711e['options']?_0x28711e[_0x28bb('0x18')][_0x28bb('0x1c')]?_[_0x28bb('0x1d')](_0x28711e[_0x28bb('0x18')][_0x28bb('0x1c')],function(_0x6e3f4){return{'model':db[_0x6e3f4[_0x28bb('0x1e')]],'as':_0x6e3f4['as'],'attributes':_0x6e3f4['attributes'],'include':_0x6e3f4['include']?_[_0x28bb('0x1d')](_0x6e3f4['include'],function(_0x2e6e77){return{'model':db[_0x2e6e77[_0x28bb('0x1e')]],'as':_0x2e6e77['as'],'attributes':_0x2e6e77[_0x28bb('0x1a')],'include':_0x2e6e77[_0x28bb('0x1c')]?_[_0x28bb('0x1d')](_0x2e6e77[_0x28bb('0x1c')],function(_0x353669){return{'model':db[_0x353669[_0x28bb('0x1e')]],'as':_0x353669['as'],'attributes':_0x353669[_0x28bb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x28bb('0xc')](function(_0x2f7715){logger[_0x28bb('0xd')]('GetSalesforceAccount',_0x28711e);logger[_0x28bb('0x1f')](_0x28bb('0x14'),_0x28711e,JSON['stringify'](_0x2f7715));_0x459249(_0x2f7715);})['catch'](function(_0x42bb35){logger[_0x28bb('0x11')]('GetSalesforceAccount',_0x42bb35['message'],_0x28711e);_0x722dc5(_0x1f072d[_0x28bb('0x11')](0x1f4,_0x42bb35[_0x28bb('0x13')]));});});};exports[_0x28bb('0x20')]=function(_0x55b3e7){var _0x395ac1=this;return new Promise(function(_0x229243,_0x1fd5fa){return db[_0x28bb('0x15')][_0x28bb('0x21')]({'raw':_0x55b3e7[_0x28bb('0x18')]?_0x55b3e7[_0x28bb('0x18')][_0x28bb('0x17')]===undefined?!![]:![]:!![],'where':_0x55b3e7['options']?_0x55b3e7[_0x28bb('0x18')][_0x28bb('0x19')]||null:null,'attributes':_0x55b3e7['options']?_0x55b3e7[_0x28bb('0x18')][_0x28bb('0x1a')]||null:null,'include':_0x55b3e7[_0x28bb('0x18')]?_0x55b3e7['options']['include']?_[_0x28bb('0x1d')](_0x55b3e7[_0x28bb('0x18')][_0x28bb('0x1c')],function(_0x127d17){return{'model':db[_0x127d17[_0x28bb('0x1e')]],'as':_0x127d17['as'],'attributes':_0x127d17[_0x28bb('0x1a')],'include':_0x127d17['include']?_[_0x28bb('0x1d')](_0x127d17[_0x28bb('0x1c')],function(_0x47c35f){return{'model':db[_0x47c35f['model']],'as':_0x47c35f['as'],'attributes':_0x47c35f[_0x28bb('0x1a')],'include':_0x47c35f['include']?_[_0x28bb('0x1d')](_0x47c35f['include'],function(_0x4b3228){return{'model':db[_0x4b3228[_0x28bb('0x1e')]],'as':_0x4b3228['as'],'attributes':_0x4b3228['attributes']};}):[]};}):[]};}):[]:[]})[_0x28bb('0xc')](function(_0x3e5cf7){logger[_0x28bb('0xd')](_0x28bb('0x20'),_0x55b3e7);logger[_0x28bb('0x1f')](_0x28bb('0x20'),_0x55b3e7,JSON[_0x28bb('0x10')](_0x3e5cf7));_0x229243(_0x3e5cf7);})['catch'](function(_0x3ae5e8){logger[_0x28bb('0x11')]('ShowSalesforceAccount',_0x3ae5e8[_0x28bb('0x13')],_0x55b3e7);_0x1fd5fa(_0x395ac1[_0x28bb('0x11')](0x1f4,_0x3ae5e8[_0x28bb('0x13')]));});});}; \ No newline at end of file +var _0x3d41=['catch','find','ShowSalesforceAccount','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','include','map','model','then'];(function(_0x1e2072,_0xe3cc90){var _0x22956b=function(_0x118dcf){while(--_0x118dcf){_0x1e2072['push'](_0x1e2072['shift']());}};_0x22956b(++_0xe3cc90);}(_0x3d41,0xea));var _0x13d4=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0x3d41[_0x1f239e];return _0x826971;};'use strict';var _=require('lodash');var util=require(_0x13d4('0x0'));var moment=require(_0x13d4('0x1'));var BPromise=require(_0x13d4('0x2'));var rs=require(_0x13d4('0x3'));var fs=require('fs');var Redis=require(_0x13d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x13d4('0x5'))(_0x13d4('0x6'));var config=require('../../config/environment');var jayson=require(_0x13d4('0x7'));var client=jayson[_0x13d4('0x8')][_0x13d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe97ed,_0x3d8567,_0x2a56a1){return new BPromise(function(_0x41fac8,_0x4de180){return client[_0x13d4('0xa')](_0xe97ed,_0x2a56a1)['then'](function(_0x4a380f){logger[_0x13d4('0xb')](_0x13d4('0xc'),_0x3d8567,'request\x20sent');logger[_0x13d4('0xd')](_0x13d4('0xe'),_0x3d8567,'request\x20sent',JSON[_0x13d4('0xf')](_0x4a380f));if(_0x4a380f[_0x13d4('0x10')]){if(_0x4a380f[_0x13d4('0x10')][_0x13d4('0x11')]===0x1f4){logger['error'](_0x13d4('0xc'),_0x3d8567,_0x4a380f[_0x13d4('0x10')][_0x13d4('0x12')]);return _0x4de180(_0x4a380f['error'][_0x13d4('0x12')]);}logger['error'](_0x13d4('0xc'),_0x3d8567,_0x4a380f[_0x13d4('0x10')][_0x13d4('0x12')]);return _0x41fac8(_0x4a380f[_0x13d4('0x10')][_0x13d4('0x12')]);}else{logger[_0x13d4('0xb')](_0x13d4('0xc'),_0x3d8567,'request\x20sent');_0x41fac8(_0x4a380f[_0x13d4('0x13')][_0x13d4('0x12')]);}})['catch'](function(_0x55cd7d){logger['error'](_0x13d4('0xc'),_0x3d8567,_0x55cd7d);_0x4de180(_0x55cd7d);});});}exports[_0x13d4('0x14')]=function(_0x185e89){var _0x113c98=this;return new Promise(function(_0x353ad6,_0x7e5e75){return db[_0x13d4('0x15')]['findAll']({'raw':_0x185e89[_0x13d4('0x16')]?_0x185e89['options'][_0x13d4('0x17')]===undefined?!![]:![]:!![],'where':_0x185e89[_0x13d4('0x16')]?_0x185e89[_0x13d4('0x16')][_0x13d4('0x18')]||null:null,'attributes':_0x185e89[_0x13d4('0x16')]?_0x185e89[_0x13d4('0x16')][_0x13d4('0x19')]||null:null,'limit':_0x185e89[_0x13d4('0x16')]?_0x185e89[_0x13d4('0x16')]['limit']||null:null,'include':_0x185e89['options']?_0x185e89[_0x13d4('0x16')][_0x13d4('0x1a')]?_[_0x13d4('0x1b')](_0x185e89[_0x13d4('0x16')][_0x13d4('0x1a')],function(_0x5e4e1e){return{'model':db[_0x5e4e1e[_0x13d4('0x1c')]],'as':_0x5e4e1e['as'],'attributes':_0x5e4e1e[_0x13d4('0x19')],'include':_0x5e4e1e[_0x13d4('0x1a')]?_[_0x13d4('0x1b')](_0x5e4e1e['include'],function(_0x25ee56){return{'model':db[_0x25ee56['model']],'as':_0x25ee56['as'],'attributes':_0x25ee56['attributes'],'include':_0x25ee56[_0x13d4('0x1a')]?_['map'](_0x25ee56[_0x13d4('0x1a')],function(_0x233434){return{'model':db[_0x233434[_0x13d4('0x1c')]],'as':_0x233434['as'],'attributes':_0x233434['attributes']};}):[]};}):[]};}):[]:[]})[_0x13d4('0x1d')](function(_0x3432ab){logger[_0x13d4('0xb')](_0x13d4('0x14'),_0x185e89);logger['debug']('GetSalesforceAccount',_0x185e89,JSON[_0x13d4('0xf')](_0x3432ab));_0x353ad6(_0x3432ab);})[_0x13d4('0x1e')](function(_0x72345e){logger[_0x13d4('0x10')]('GetSalesforceAccount',_0x72345e[_0x13d4('0x12')],_0x185e89);_0x7e5e75(_0x113c98[_0x13d4('0x10')](0x1f4,_0x72345e[_0x13d4('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x1c633c){var _0x43788a=this;return new Promise(function(_0x5f0062,_0x1e23ce){return db[_0x13d4('0x15')][_0x13d4('0x1f')]({'raw':_0x1c633c[_0x13d4('0x16')]?_0x1c633c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c633c[_0x13d4('0x16')]?_0x1c633c[_0x13d4('0x16')][_0x13d4('0x18')]||null:null,'attributes':_0x1c633c['options']?_0x1c633c[_0x13d4('0x16')]['attributes']||null:null,'include':_0x1c633c[_0x13d4('0x16')]?_0x1c633c[_0x13d4('0x16')][_0x13d4('0x1a')]?_['map'](_0x1c633c[_0x13d4('0x16')][_0x13d4('0x1a')],function(_0x4470fb){return{'model':db[_0x4470fb[_0x13d4('0x1c')]],'as':_0x4470fb['as'],'attributes':_0x4470fb[_0x13d4('0x19')],'include':_0x4470fb['include']?_['map'](_0x4470fb[_0x13d4('0x1a')],function(_0x423500){return{'model':db[_0x423500[_0x13d4('0x1c')]],'as':_0x423500['as'],'attributes':_0x423500[_0x13d4('0x19')],'include':_0x423500[_0x13d4('0x1a')]?_[_0x13d4('0x1b')](_0x423500['include'],function(_0x119787){return{'model':db[_0x119787['model']],'as':_0x119787['as'],'attributes':_0x119787[_0x13d4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x13d4('0x1d')](function(_0x4b30db){logger[_0x13d4('0xb')](_0x13d4('0x20'),_0x1c633c);logger[_0x13d4('0xd')](_0x13d4('0x20'),_0x1c633c,JSON[_0x13d4('0xf')](_0x4b30db));_0x5f0062(_0x4b30db);})[_0x13d4('0x1e')](function(_0x29446b){logger['error'](_0x13d4('0x20'),_0x29446b['message'],_0x1c633c);_0x1e23ce(_0x43788a[_0x13d4('0x10')](0x1f4,_0x29446b[_0x13d4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ace65df..8e3d0e3 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x4b41d3,_0x407de2){var _0x16950a=function(_0x542db0){while(--_0x542db0){_0x4b41d3['push'](_0x4b41d3['shift']());}};_0x16950a(++_0x407de2);}(_0x7a54,0x106));var _0x47a5=function(_0x38c43d,_0x2ddfab){_0x38c43d=_0x38c43d-0x0;var _0x4a45fb=_0x7a54[_0x38c43d];return _0x4a45fb;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5733fb,_0x26a642){var _0x3baaee=function(_0xbec1d1){while(--_0xbec1d1){_0x5733fb['push'](_0x5733fb['shift']());}};_0x3baaee(++_0x26a642);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 630e0f8..e11705b 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 _0x1a64=['lead','account_contact_lead','nothing','account','exports','STRING','Task','Case','ENUM','contact_lead','contact'];(function(_0x4fd131,_0x3def09){var _0x410f39=function(_0x40a183){while(--_0x40a183){_0x4fd131['push'](_0x4fd131['shift']());}};_0x410f39(++_0x3def09);}(_0x1a64,0x16f));var _0x41a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a64[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x41a6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x41a6('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x41a6('0x2'),_0x41a6('0x3')),'defaultValue':_0x41a6('0x2')},'moduleSearch':{'type':Sequelize[_0x41a6('0x4')](_0x41a6('0x5'),_0x41a6('0x6'),_0x41a6('0x7'),_0x41a6('0x8'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x41a6('0x4')](_0x41a6('0x9'),_0x41a6('0x6'),_0x41a6('0x7'),_0x41a6('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x41a6('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9fa9=['Task','Case','contact_lead','contact','lead','account_contact_lead','account','exports','STRING','ENUM'];(function(_0x10015b,_0x1c360a){var _0x1b9587=function(_0x2dfa66){while(--_0x2dfa66){_0x10015b['push'](_0x10015b['shift']());}};_0x1b9587(++_0x1c360a);}(_0x9fa9,0xb1));var _0x99fa=function(_0x1b3af4,_0x32bac3){_0x1b3af4=_0x1b3af4-0x0;var _0x283368=_0x9fa9[_0x1b3af4];return _0x283368;};'use strict';var Sequelize=require('sequelize');module[_0x99fa('0x0')]={'name':{'type':Sequelize[_0x99fa('0x1')]},'description':{'type':Sequelize[_0x99fa('0x1')]},'ticketType':{'type':Sequelize[_0x99fa('0x2')](_0x99fa('0x3'),_0x99fa('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x99fa('0x2')](_0x99fa('0x5'),_0x99fa('0x6'),_0x99fa('0x7'),_0x99fa('0x8'),_0x99fa('0x9')),'defaultValue':_0x99fa('0x5')},'moduleCreate':{'type':Sequelize[_0x99fa('0x2')]('nothing','contact',_0x99fa('0x7'),_0x99fa('0x9')),'defaultValue':_0x99fa('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x99fa('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x99fa('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 9ceda11..efdd092 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 _0xff19=['VIRTUAL','filter','includeAll','rows','catch','params','include','options','find','body','getFields','SalesforceField','merge','findOne','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','end','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type'];(function(_0x4bf43d,_0x5d0804){var _0x20f72d=function(_0x373a87){while(--_0x373a87){_0x4bf43d['push'](_0x4bf43d['shift']());}};_0x20f72d(++_0x5d0804);}(_0xff19,0x100));var _0x9ff1=function(_0x36335f,_0xf1aa1){_0x36335f=_0x36335f-0x0;var _0x5399f8=_0xff19[_0x36335f];return _0x5399f8;};'use strict';var emlformat=require(_0x9ff1('0x0'));var rimraf=require(_0x9ff1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9ff1('0x2'));var moment=require(_0x9ff1('0x3'));var BPromise=require(_0x9ff1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9ff1('0x5'));var sox=require(_0x9ff1('0x6'));var csv=require('to-csv');var ejs=require(_0x9ff1('0x7'));var fs=require('fs');var fs_extra=require(_0x9ff1('0x8'));var _=require(_0x9ff1('0x9'));var squel=require(_0x9ff1('0xa'));var crypto=require(_0x9ff1('0xb'));var jsforce=require(_0x9ff1('0xc'));var deskjs=require(_0x9ff1('0xd'));var toCsv=require(_0x9ff1('0xe'));var querystring=require('querystring');var Papa=require(_0x9ff1('0xf'));var Redis=require('ioredis');var authService=require(_0x9ff1('0x10'));var qs=require(_0x9ff1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ff1('0x12'));var logger=require(_0x9ff1('0x13'))(_0x9ff1('0x14'));var utils=require(_0x9ff1('0x15'));var config=require(_0x9ff1('0x16'));var licenseUtil=require(_0x9ff1('0x17'));var db=require(_0x9ff1('0x18'))['db'];function respondWithStatusCode(_0x591957,_0x1d12a8){_0x1d12a8=_0x1d12a8||0xcc;return function(_0x556481){if(_0x556481){return _0x591957[_0x9ff1('0x19')](_0x1d12a8);}return _0x591957[_0x9ff1('0x1a')](_0x1d12a8)['end']();};}function respondWithResult(_0xef9d83,_0x2d8673){_0x2d8673=_0x2d8673||0xc8;return function(_0x1203ba){if(_0x1203ba){return _0xef9d83[_0x9ff1('0x1a')](_0x2d8673)[_0x9ff1('0x1b')](_0x1203ba);}};}function respondWithFilteredResult(_0x3fd5de,_0x4c9d58){return function(_0x4cf960){if(_0x4cf960){var _0x345006=typeof _0x4c9d58[_0x9ff1('0x1c')]==='undefined'&&typeof _0x4c9d58[_0x9ff1('0x1d')]===_0x9ff1('0x1e');var _0x1bd1a6=_0x4cf960[_0x9ff1('0x1f')];var _0x5bb77e=_0x345006?0x0:_0x4c9d58[_0x9ff1('0x1c')];var _0x469d1e=_0x345006?_0x4cf960['count']:_0x4c9d58[_0x9ff1('0x1c')]+_0x4c9d58[_0x9ff1('0x1d')];var _0x45e7d4;if(_0x469d1e>=_0x1bd1a6){_0x469d1e=_0x1bd1a6;_0x45e7d4=0xc8;}else{_0x45e7d4=0xce;}_0x3fd5de[_0x9ff1('0x1a')](_0x45e7d4);return _0x3fd5de[_0x9ff1('0x20')]('Content-Range',_0x5bb77e+'-'+_0x469d1e+'/'+_0x1bd1a6)['json'](_0x4cf960);}return null;};}function patchUpdates(_0x43a5d2){return function(_0x52cb06){try{jsonpatch['apply'](_0x52cb06,_0x43a5d2,!![]);}catch(_0x2ef1d6){return BPromise[_0x9ff1('0x21')](_0x2ef1d6);}return _0x52cb06[_0x9ff1('0x22')]();};}function saveUpdates(_0x1efd33,_0x2894f1){return function(_0x77b89c){if(_0x77b89c){return _0x77b89c[_0x9ff1('0x23')](_0x1efd33)['then'](function(_0x2fff4c){return _0x2fff4c;});}return null;};}function removeEntity(_0x15ac30,_0x15f3d5){return function(_0x166331){if(_0x166331){return _0x166331[_0x9ff1('0x24')]()[_0x9ff1('0x25')](function(){_0x15ac30[_0x9ff1('0x1a')](0xcc)[_0x9ff1('0x26')]();});}};}function handleEntityNotFound(_0x17c09b,_0x534fcd){return function(_0x2cf9ec){if(!_0x2cf9ec){_0x17c09b[_0x9ff1('0x19')](0x194);}return _0x2cf9ec;};}function handleError(_0x485f4f,_0x32b6e5){_0x32b6e5=_0x32b6e5||0x1f4;return function(_0x5926b1){logger[_0x9ff1('0x27')](_0x5926b1[_0x9ff1('0x28')]);if(_0x5926b1[_0x9ff1('0x29')]){delete _0x5926b1['name'];}_0x485f4f[_0x9ff1('0x1a')](_0x32b6e5)[_0x9ff1('0x2a')](_0x5926b1);};}exports[_0x9ff1('0x2b')]=function(_0xf89f18,_0x4fb72b){var _0x2e18c7={},_0x576814={},_0x21df53={'count':0x0,'rows':[]};var _0x63879=_[_0x9ff1('0x2c')](db[_0x9ff1('0x2d')][_0x9ff1('0x2e')],function(_0x30723a){return{'name':_0x30723a[_0x9ff1('0x2f')],'type':_0x30723a['type'][_0x9ff1('0x30')]};});_0x576814['model']=_[_0x9ff1('0x2c')](_0x63879,'name');_0x576814[_0x9ff1('0x31')]=_[_0x9ff1('0x32')](_0xf89f18[_0x9ff1('0x31')]);_0x576814[_0x9ff1('0x33')]=_[_0x9ff1('0x34')](_0x576814[_0x9ff1('0x35')],_0x576814[_0x9ff1('0x31')]);_0x2e18c7[_0x9ff1('0x36')]=_[_0x9ff1('0x34')](_0x576814[_0x9ff1('0x35')],qs[_0x9ff1('0x37')](_0xf89f18[_0x9ff1('0x31')][_0x9ff1('0x37')]));_0x2e18c7['attributes']=_0x2e18c7['attributes'][_0x9ff1('0x38')]?_0x2e18c7['attributes']:_0x576814[_0x9ff1('0x35')];if(!_0xf89f18[_0x9ff1('0x31')][_0x9ff1('0x39')](_0x9ff1('0x3a'))){_0x2e18c7[_0x9ff1('0x1d')]=qs[_0x9ff1('0x1d')](_0xf89f18[_0x9ff1('0x31')][_0x9ff1('0x1d')]);_0x2e18c7[_0x9ff1('0x1c')]=qs[_0x9ff1('0x1c')](_0xf89f18[_0x9ff1('0x31')][_0x9ff1('0x1c')]);}_0x2e18c7[_0x9ff1('0x3b')]=qs[_0x9ff1('0x3c')](_0xf89f18[_0x9ff1('0x31')][_0x9ff1('0x3c')]);_0x2e18c7[_0x9ff1('0x3d')]=qs[_0x9ff1('0x33')](_[_0x9ff1('0x3e')](_0xf89f18[_0x9ff1('0x31')],_0x576814[_0x9ff1('0x33')]),_0x63879);if(_0xf89f18['query']['filter']){_0x2e18c7[_0x9ff1('0x3d')]=_['merge'](_0x2e18c7[_0x9ff1('0x3d')],{'$or':_[_0x9ff1('0x2c')](_0x63879,function(_0x1e9b60){if(_0x1e9b60[_0x9ff1('0x3f')]!==_0x9ff1('0x40')){var _0x3ff847={};_0x3ff847[_0x1e9b60[_0x9ff1('0x29')]]={'$like':'%'+_0xf89f18[_0x9ff1('0x31')][_0x9ff1('0x41')]+'%'};return _0x3ff847;}})});}_0x2e18c7=_['merge']({},_0x2e18c7,_0xf89f18['options']);var _0x3e089b={'where':_0x2e18c7[_0x9ff1('0x3d')]};return db[_0x9ff1('0x2d')][_0x9ff1('0x1f')](_0x3e089b)[_0x9ff1('0x25')](function(_0x4387cd){_0x21df53[_0x9ff1('0x1f')]=_0x4387cd;if(_0xf89f18['query'][_0x9ff1('0x42')]){_0x2e18c7['include']=[{'all':!![]}];}return db[_0x9ff1('0x2d')]['findAll'](_0x2e18c7);})[_0x9ff1('0x25')](function(_0x30b104){_0x21df53[_0x9ff1('0x43')]=_0x30b104;return _0x21df53;})[_0x9ff1('0x25')](respondWithFilteredResult(_0x4fb72b,_0x2e18c7))[_0x9ff1('0x44')](handleError(_0x4fb72b,null));};exports['show']=function(_0x3b478f,_0x1a72f3){var _0x135e45={'raw':![],'where':{'id':_0x3b478f[_0x9ff1('0x45')]['id']}},_0x43e809={};_0x43e809[_0x9ff1('0x35')]=_['keys'](db['SalesforceConfiguration']['rawAttributes']);_0x43e809[_0x9ff1('0x31')]=_[_0x9ff1('0x32')](_0x3b478f[_0x9ff1('0x31')]);_0x43e809['filters']=_[_0x9ff1('0x34')](_0x43e809[_0x9ff1('0x35')],_0x43e809[_0x9ff1('0x31')]);_0x135e45[_0x9ff1('0x36')]=_['intersection'](_0x43e809[_0x9ff1('0x35')],qs['fields'](_0x3b478f[_0x9ff1('0x31')][_0x9ff1('0x37')]));_0x135e45[_0x9ff1('0x36')]=_0x135e45[_0x9ff1('0x36')][_0x9ff1('0x38')]?_0x135e45[_0x9ff1('0x36')]:_0x43e809[_0x9ff1('0x35')];if(_0x3b478f['query'][_0x9ff1('0x42')]){_0x135e45[_0x9ff1('0x46')]=[{'all':!![]}];}_0x135e45=_['merge']({},_0x135e45,_0x3b478f[_0x9ff1('0x47')]);return db[_0x9ff1('0x2d')][_0x9ff1('0x48')](_0x135e45)[_0x9ff1('0x25')](handleEntityNotFound(_0x1a72f3,null))['then'](respondWithResult(_0x1a72f3,null))[_0x9ff1('0x44')](handleError(_0x1a72f3,null));};exports['create']=function(_0x16c6aa,_0x41cfd1){return db[_0x9ff1('0x2d')]['create'](_0x16c6aa['body'],{})[_0x9ff1('0x25')](respondWithResult(_0x41cfd1,0xc9))[_0x9ff1('0x44')](handleError(_0x41cfd1,null));};exports[_0x9ff1('0x23')]=function(_0x52b918,_0x5e46a4){if(_0x52b918[_0x9ff1('0x49')]['id']){delete _0x52b918[_0x9ff1('0x49')]['id'];}return db['SalesforceConfiguration'][_0x9ff1('0x48')]({'where':{'id':_0x52b918[_0x9ff1('0x45')]['id']}})[_0x9ff1('0x25')](handleEntityNotFound(_0x5e46a4,null))[_0x9ff1('0x25')](saveUpdates(_0x52b918[_0x9ff1('0x49')],null))['then'](respondWithResult(_0x5e46a4,null))[_0x9ff1('0x44')](handleError(_0x5e46a4,null));};exports[_0x9ff1('0x24')]=function(_0x2cf806,_0x3e5bac){return db[_0x9ff1('0x2d')][_0x9ff1('0x48')]({'where':{'id':_0x2cf806[_0x9ff1('0x45')]['id']}})[_0x9ff1('0x25')](handleEntityNotFound(_0x3e5bac,null))['then'](removeEntity(_0x3e5bac,null))[_0x9ff1('0x44')](handleError(_0x3e5bac,null));};exports[_0x9ff1('0x4a')]=function(_0x2ae724,_0x2945ed,_0x28c38f){var _0x3d2d6c={};var _0x51b677={};var _0x22d265;var _0x48de32;return db[_0x9ff1('0x2d')]['findOne']({'where':{'id':_0x2ae724['params']['id']}})[_0x9ff1('0x25')](handleEntityNotFound(_0x2945ed,null))[_0x9ff1('0x25')](function(_0x5c46e7){if(_0x5c46e7){_0x22d265=_0x5c46e7;_0x51b677[_0x9ff1('0x35')]=_[_0x9ff1('0x32')](db[_0x9ff1('0x4b')]['rawAttributes']);_0x51b677[_0x9ff1('0x31')]=_['keys'](_0x2ae724[_0x9ff1('0x31')]);_0x51b677[_0x9ff1('0x33')]=_[_0x9ff1('0x34')](_0x51b677[_0x9ff1('0x35')],_0x51b677['query']);_0x3d2d6c[_0x9ff1('0x36')]=_[_0x9ff1('0x34')](_0x51b677[_0x9ff1('0x35')],qs[_0x9ff1('0x37')](_0x2ae724[_0x9ff1('0x31')][_0x9ff1('0x37')]));_0x3d2d6c[_0x9ff1('0x36')]=_0x3d2d6c[_0x9ff1('0x36')][_0x9ff1('0x38')]?_0x3d2d6c[_0x9ff1('0x36')]:_0x51b677['model'];_0x3d2d6c[_0x9ff1('0x3b')]=qs[_0x9ff1('0x3c')](_0x2ae724['query']['sort']);_0x3d2d6c[_0x9ff1('0x3d')]=qs[_0x9ff1('0x33')](_['pick'](_0x2ae724[_0x9ff1('0x31')],_0x51b677[_0x9ff1('0x33')]));if(_0x2ae724['query'][_0x9ff1('0x41')]){_0x3d2d6c[_0x9ff1('0x3d')]=_['merge'](_0x3d2d6c[_0x9ff1('0x3d')],{'$or':_[_0x9ff1('0x2c')](_0x3d2d6c[_0x9ff1('0x36')],function(_0x477a1a){var _0x1114bd={};_0x1114bd[_0x477a1a]={'$like':'%'+_0x2ae724[_0x9ff1('0x31')][_0x9ff1('0x41')]+'%'};return _0x1114bd;})});}_0x3d2d6c=_[_0x9ff1('0x4c')]({},_0x3d2d6c,_0x2ae724[_0x9ff1('0x47')]);return _0x22d265['getFields'](_0x3d2d6c);}})['then'](function(_0xc810c5){if(_0xc810c5){_0x48de32=_0xc810c5[_0x9ff1('0x38')];if(!_0x2ae724['query'][_0x9ff1('0x39')]('nolimit')){_0x3d2d6c[_0x9ff1('0x1d')]=qs['limit'](_0x2ae724[_0x9ff1('0x31')][_0x9ff1('0x1d')]);_0x3d2d6c[_0x9ff1('0x1c')]=qs[_0x9ff1('0x1c')](_0x2ae724['query']['offset']);}return _0x22d265[_0x9ff1('0x4a')](_0x3d2d6c);}})[_0x9ff1('0x25')](function(_0x50fe58){if(_0x50fe58){return _0x50fe58?{'count':_0x48de32,'rows':_0x50fe58}:null;}})[_0x9ff1('0x25')](respondWithResult(_0x2945ed,null))['catch'](handleError(_0x2945ed,null));};exports['getSubjects']=function(_0x3b5725,_0x180ad8,_0x3c0dde){var _0x45645d={};var _0x3ed6d0={};var _0x399c61;var _0xeed046;return db['SalesforceConfiguration'][_0x9ff1('0x4d')]({'where':{'id':_0x3b5725[_0x9ff1('0x45')]['id']}})[_0x9ff1('0x25')](handleEntityNotFound(_0x180ad8,null))[_0x9ff1('0x25')](function(_0x3bae4a){if(_0x3bae4a){_0x399c61=_0x3bae4a;_0x3ed6d0['model']=_['keys'](db[_0x9ff1('0x4b')][_0x9ff1('0x2e')]);_0x3ed6d0[_0x9ff1('0x31')]=_['keys'](_0x3b5725[_0x9ff1('0x31')]);_0x3ed6d0['filters']=_[_0x9ff1('0x34')](_0x3ed6d0['model'],_0x3ed6d0[_0x9ff1('0x31')]);_0x45645d[_0x9ff1('0x36')]=_[_0x9ff1('0x34')](_0x3ed6d0[_0x9ff1('0x35')],qs['fields'](_0x3b5725[_0x9ff1('0x31')][_0x9ff1('0x37')]));_0x45645d['attributes']=_0x45645d[_0x9ff1('0x36')]['length']?_0x45645d[_0x9ff1('0x36')]:_0x3ed6d0[_0x9ff1('0x35')];_0x45645d[_0x9ff1('0x3b')]=qs['sort'](_0x3b5725[_0x9ff1('0x31')][_0x9ff1('0x3c')]);_0x45645d[_0x9ff1('0x3d')]=qs['filters'](_[_0x9ff1('0x3e')](_0x3b5725['query'],_0x3ed6d0[_0x9ff1('0x33')]));if(_0x3b5725[_0x9ff1('0x31')]['filter']){_0x45645d[_0x9ff1('0x3d')]=_[_0x9ff1('0x4c')](_0x45645d[_0x9ff1('0x3d')],{'$or':_[_0x9ff1('0x2c')](_0x45645d['attributes'],function(_0x5ac1ff){var _0x4fb155={};_0x4fb155[_0x5ac1ff]={'$like':'%'+_0x3b5725[_0x9ff1('0x31')]['filter']+'%'};return _0x4fb155;})});}_0x45645d=_[_0x9ff1('0x4c')]({},_0x45645d,_0x3b5725[_0x9ff1('0x47')]);return _0x399c61[_0x9ff1('0x4e')](_0x45645d);}})[_0x9ff1('0x25')](function(_0x492cfe){if(_0x492cfe){_0xeed046=_0x492cfe[_0x9ff1('0x38')];if(!_0x3b5725[_0x9ff1('0x31')][_0x9ff1('0x39')](_0x9ff1('0x3a'))){_0x45645d[_0x9ff1('0x1d')]=qs[_0x9ff1('0x1d')](_0x3b5725[_0x9ff1('0x31')][_0x9ff1('0x1d')]);_0x45645d[_0x9ff1('0x1c')]=qs[_0x9ff1('0x1c')](_0x3b5725[_0x9ff1('0x31')]['offset']);}return _0x399c61[_0x9ff1('0x4e')](_0x45645d);}})['then'](function(_0x1c2fc3){if(_0x1c2fc3){return _0x1c2fc3?{'count':_0xeed046,'rows':_0x1c2fc3}:null;}})[_0x9ff1('0x25')](respondWithResult(_0x180ad8,null))[_0x9ff1('0x44')](handleError(_0x180ad8,null));};exports[_0x9ff1('0x4f')]=function(_0x2a7061,_0x3ad2d9,_0x13cef3){var _0x4d2712={};var _0x39658b={};var _0x356aa0;var _0x831627;return db[_0x9ff1('0x2d')][_0x9ff1('0x4d')]({'where':{'id':_0x2a7061[_0x9ff1('0x45')]['id']}})[_0x9ff1('0x25')](handleEntityNotFound(_0x3ad2d9,null))[_0x9ff1('0x25')](function(_0x28be13){if(_0x28be13){_0x356aa0=_0x28be13;_0x39658b[_0x9ff1('0x35')]=_[_0x9ff1('0x32')](db[_0x9ff1('0x4b')][_0x9ff1('0x2e')]);_0x39658b[_0x9ff1('0x31')]=_[_0x9ff1('0x32')](_0x2a7061[_0x9ff1('0x31')]);_0x39658b[_0x9ff1('0x33')]=_['intersection'](_0x39658b[_0x9ff1('0x35')],_0x39658b[_0x9ff1('0x31')]);_0x4d2712['attributes']=_[_0x9ff1('0x34')](_0x39658b[_0x9ff1('0x35')],qs[_0x9ff1('0x37')](_0x2a7061[_0x9ff1('0x31')][_0x9ff1('0x37')]));_0x4d2712[_0x9ff1('0x36')]=_0x4d2712[_0x9ff1('0x36')][_0x9ff1('0x38')]?_0x4d2712[_0x9ff1('0x36')]:_0x39658b[_0x9ff1('0x35')];_0x4d2712[_0x9ff1('0x3b')]=qs[_0x9ff1('0x3c')](_0x2a7061[_0x9ff1('0x31')][_0x9ff1('0x3c')]);_0x4d2712['where']=qs['filters'](_[_0x9ff1('0x3e')](_0x2a7061[_0x9ff1('0x31')],_0x39658b[_0x9ff1('0x33')]));if(_0x2a7061[_0x9ff1('0x31')][_0x9ff1('0x41')]){_0x4d2712[_0x9ff1('0x3d')]=_[_0x9ff1('0x4c')](_0x4d2712['where'],{'$or':_[_0x9ff1('0x2c')](_0x4d2712[_0x9ff1('0x36')],function(_0x3fcb7e){var _0x300699={};_0x300699[_0x3fcb7e]={'$like':'%'+_0x2a7061[_0x9ff1('0x31')][_0x9ff1('0x41')]+'%'};return _0x300699;})});}_0x4d2712=_[_0x9ff1('0x4c')]({},_0x4d2712,_0x2a7061[_0x9ff1('0x47')]);return _0x356aa0[_0x9ff1('0x4f')](_0x4d2712);}})['then'](function(_0x1a44cb){if(_0x1a44cb){_0x831627=_0x1a44cb[_0x9ff1('0x38')];if(!_0x2a7061['query']['hasOwnProperty'](_0x9ff1('0x3a'))){_0x4d2712[_0x9ff1('0x1d')]=qs['limit'](_0x2a7061[_0x9ff1('0x31')][_0x9ff1('0x1d')]);_0x4d2712[_0x9ff1('0x1c')]=qs[_0x9ff1('0x1c')](_0x2a7061[_0x9ff1('0x31')][_0x9ff1('0x1c')]);}return _0x356aa0[_0x9ff1('0x4f')](_0x4d2712);}})['then'](function(_0x3c94d5){if(_0x3c94d5){return _0x3c94d5?{'count':_0x831627,'rows':_0x3c94d5}:null;}})[_0x9ff1('0x25')](respondWithResult(_0x3ad2d9,null))['catch'](handleError(_0x3ad2d9,null));}; \ No newline at end of file +var _0xc5d2=['keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','rawAttributes','fields','find','create','body','params','getFields','findOne','SalesforceField','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','SalesforceConfiguration','fieldName','type','key','model'];(function(_0xadc4ea,_0x506b7b){var _0x39f202=function(_0x171110){while(--_0x171110){_0xadc4ea['push'](_0xadc4ea['shift']());}};_0x39f202(++_0x506b7b);}(_0xc5d2,0x162));var _0x2c5d=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xc5d2[_0x1abb09];return _0xea1c07;};'use strict';var emlformat=require(_0x2c5d('0x0'));var rimraf=require(_0x2c5d('0x1'));var zipdir=require(_0x2c5d('0x2'));var jsonpatch=require(_0x2c5d('0x3'));var rp=require(_0x2c5d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2c5d('0x5'));var util=require(_0x2c5d('0x6'));var path=require(_0x2c5d('0x7'));var sox=require(_0x2c5d('0x8'));var csv=require('to-csv');var ejs=require(_0x2c5d('0x9'));var fs=require('fs');var fs_extra=require(_0x2c5d('0xa'));var _=require(_0x2c5d('0xb'));var squel=require(_0x2c5d('0xc'));var crypto=require('crypto');var jsforce=require(_0x2c5d('0xd'));var deskjs=require(_0x2c5d('0xe'));var toCsv=require(_0x2c5d('0xf'));var querystring=require(_0x2c5d('0x10'));var Papa=require(_0x2c5d('0x11'));var Redis=require(_0x2c5d('0x12'));var authService=require(_0x2c5d('0x13'));var qs=require(_0x2c5d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2c5d('0x15'));var config=require(_0x2c5d('0x16'));var licenseUtil=require(_0x2c5d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39e183,_0x7af76a){_0x7af76a=_0x7af76a||0xcc;return function(_0x5194d9){if(_0x5194d9){return _0x39e183[_0x2c5d('0x18')](_0x7af76a);}return _0x39e183[_0x2c5d('0x19')](_0x7af76a)['end']();};}function respondWithResult(_0x32acd1,_0x511b5c){_0x511b5c=_0x511b5c||0xc8;return function(_0x24af49){if(_0x24af49){return _0x32acd1[_0x2c5d('0x19')](_0x511b5c)[_0x2c5d('0x1a')](_0x24af49);}};}function respondWithFilteredResult(_0x59759e,_0x206d5f){return function(_0x46f3a7){if(_0x46f3a7){var _0x28532c=typeof _0x206d5f[_0x2c5d('0x1b')]===_0x2c5d('0x1c')&&typeof _0x206d5f['limit']===_0x2c5d('0x1c');var _0x5e3c77=_0x46f3a7[_0x2c5d('0x1d')];var _0x5ef393=_0x28532c?0x0:_0x206d5f['offset'];var _0x43dc1c=_0x28532c?_0x46f3a7['count']:_0x206d5f[_0x2c5d('0x1b')]+_0x206d5f[_0x2c5d('0x1e')];var _0x78fd06;if(_0x43dc1c>=_0x5e3c77){_0x43dc1c=_0x5e3c77;_0x78fd06=0xc8;}else{_0x78fd06=0xce;}_0x59759e[_0x2c5d('0x19')](_0x78fd06);return _0x59759e[_0x2c5d('0x1f')](_0x2c5d('0x20'),_0x5ef393+'-'+_0x43dc1c+'/'+_0x5e3c77)['json'](_0x46f3a7);}return null;};}function patchUpdates(_0x362b89){return function(_0x571665){try{jsonpatch[_0x2c5d('0x21')](_0x571665,_0x362b89,!![]);}catch(_0x59551b){return BPromise[_0x2c5d('0x22')](_0x59551b);}return _0x571665[_0x2c5d('0x23')]();};}function saveUpdates(_0x50e3cc,_0x15c820){return function(_0x28ca4e){if(_0x28ca4e){return _0x28ca4e[_0x2c5d('0x24')](_0x50e3cc)[_0x2c5d('0x25')](function(_0x3311a4){return _0x3311a4;});}return null;};}function removeEntity(_0x567f6e,_0x16fbe2){return function(_0x1dbd4f){if(_0x1dbd4f){return _0x1dbd4f[_0x2c5d('0x26')]()[_0x2c5d('0x25')](function(){_0x567f6e[_0x2c5d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ec0f,_0x38e2cb){return function(_0x27a248){if(!_0x27a248){_0x13ec0f['sendStatus'](0x194);}return _0x27a248;};}function handleError(_0x48d07f,_0xf9d8ac){_0xf9d8ac=_0xf9d8ac||0x1f4;return function(_0x277c40){logger['error'](_0x277c40[_0x2c5d('0x27')]);if(_0x277c40['name']){delete _0x277c40['name'];}_0x48d07f[_0x2c5d('0x19')](_0xf9d8ac)[_0x2c5d('0x28')](_0x277c40);};}exports['index']=function(_0x4218e2,_0x438970){var _0xac7473={},_0x2effab={},_0x5e6030={'count':0x0,'rows':[]};var _0x432c12=_['map'](db[_0x2c5d('0x29')]['rawAttributes'],function(_0x56a8f8){return{'name':_0x56a8f8[_0x2c5d('0x2a')],'type':_0x56a8f8[_0x2c5d('0x2b')][_0x2c5d('0x2c')]};});_0x2effab[_0x2c5d('0x2d')]=_['map'](_0x432c12,'name');_0x2effab['query']=_[_0x2c5d('0x2e')](_0x4218e2['query']);_0x2effab[_0x2c5d('0x2f')]=_[_0x2c5d('0x30')](_0x2effab['model'],_0x2effab[_0x2c5d('0x31')]);_0xac7473[_0x2c5d('0x32')]=_['intersection'](_0x2effab[_0x2c5d('0x2d')],qs['fields'](_0x4218e2[_0x2c5d('0x31')]['fields']));_0xac7473[_0x2c5d('0x32')]=_0xac7473[_0x2c5d('0x32')][_0x2c5d('0x33')]?_0xac7473[_0x2c5d('0x32')]:_0x2effab[_0x2c5d('0x2d')];if(!_0x4218e2['query'][_0x2c5d('0x34')](_0x2c5d('0x35'))){_0xac7473[_0x2c5d('0x1e')]=qs['limit'](_0x4218e2['query']['limit']);_0xac7473[_0x2c5d('0x1b')]=qs['offset'](_0x4218e2[_0x2c5d('0x31')][_0x2c5d('0x1b')]);}_0xac7473[_0x2c5d('0x36')]=qs[_0x2c5d('0x37')](_0x4218e2[_0x2c5d('0x31')][_0x2c5d('0x37')]);_0xac7473[_0x2c5d('0x38')]=qs[_0x2c5d('0x2f')](_[_0x2c5d('0x39')](_0x4218e2[_0x2c5d('0x31')],_0x2effab['filters']),_0x432c12);if(_0x4218e2[_0x2c5d('0x31')]['filter']){_0xac7473[_0x2c5d('0x38')]=_[_0x2c5d('0x3a')](_0xac7473['where'],{'$or':_[_0x2c5d('0x3b')](_0x432c12,function(_0x3ac6f9){if(_0x3ac6f9['type']!==_0x2c5d('0x3c')){var _0x2d017d={};_0x2d017d[_0x3ac6f9[_0x2c5d('0x3d')]]={'$like':'%'+_0x4218e2[_0x2c5d('0x31')]['filter']+'%'};return _0x2d017d;}})});}_0xac7473=_[_0x2c5d('0x3a')]({},_0xac7473,_0x4218e2[_0x2c5d('0x3e')]);var _0x28b389={'where':_0xac7473[_0x2c5d('0x38')]};return db['SalesforceConfiguration'][_0x2c5d('0x1d')](_0x28b389)['then'](function(_0x396be8){_0x5e6030[_0x2c5d('0x1d')]=_0x396be8;if(_0x4218e2['query'][_0x2c5d('0x3f')]){_0xac7473[_0x2c5d('0x40')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x2c5d('0x41')](_0xac7473);})[_0x2c5d('0x25')](function(_0x21525e){_0x5e6030[_0x2c5d('0x42')]=_0x21525e;return _0x5e6030;})['then'](respondWithFilteredResult(_0x438970,_0xac7473))[_0x2c5d('0x43')](handleError(_0x438970,null));};exports['show']=function(_0x26e47b,_0x1a185b){var _0x2a401c={'raw':![],'where':{'id':_0x26e47b['params']['id']}},_0x13ef93={};_0x13ef93[_0x2c5d('0x2d')]=_[_0x2c5d('0x2e')](db[_0x2c5d('0x29')][_0x2c5d('0x44')]);_0x13ef93[_0x2c5d('0x31')]=_[_0x2c5d('0x2e')](_0x26e47b[_0x2c5d('0x31')]);_0x13ef93[_0x2c5d('0x2f')]=_['intersection'](_0x13ef93['model'],_0x13ef93[_0x2c5d('0x31')]);_0x2a401c[_0x2c5d('0x32')]=_['intersection'](_0x13ef93[_0x2c5d('0x2d')],qs[_0x2c5d('0x45')](_0x26e47b[_0x2c5d('0x31')][_0x2c5d('0x45')]));_0x2a401c[_0x2c5d('0x32')]=_0x2a401c[_0x2c5d('0x32')]['length']?_0x2a401c[_0x2c5d('0x32')]:_0x13ef93[_0x2c5d('0x2d')];if(_0x26e47b['query']['includeAll']){_0x2a401c[_0x2c5d('0x40')]=[{'all':!![]}];}_0x2a401c=_[_0x2c5d('0x3a')]({},_0x2a401c,_0x26e47b[_0x2c5d('0x3e')]);return db[_0x2c5d('0x29')][_0x2c5d('0x46')](_0x2a401c)['then'](handleEntityNotFound(_0x1a185b,null))['then'](respondWithResult(_0x1a185b,null))[_0x2c5d('0x43')](handleError(_0x1a185b,null));};exports[_0x2c5d('0x47')]=function(_0x12a96e,_0x446ad8){return db[_0x2c5d('0x29')][_0x2c5d('0x47')](_0x12a96e[_0x2c5d('0x48')],{})[_0x2c5d('0x25')](respondWithResult(_0x446ad8,0xc9))[_0x2c5d('0x43')](handleError(_0x446ad8,null));};exports[_0x2c5d('0x24')]=function(_0x20da99,_0xdf1434){if(_0x20da99['body']['id']){delete _0x20da99[_0x2c5d('0x48')]['id'];}return db['SalesforceConfiguration'][_0x2c5d('0x46')]({'where':{'id':_0x20da99[_0x2c5d('0x49')]['id']}})[_0x2c5d('0x25')](handleEntityNotFound(_0xdf1434,null))['then'](saveUpdates(_0x20da99[_0x2c5d('0x48')],null))['then'](respondWithResult(_0xdf1434,null))[_0x2c5d('0x43')](handleError(_0xdf1434,null));};exports[_0x2c5d('0x26')]=function(_0x1b7c7d,_0x3cca0f){return db['SalesforceConfiguration']['find']({'where':{'id':_0x1b7c7d[_0x2c5d('0x49')]['id']}})[_0x2c5d('0x25')](handleEntityNotFound(_0x3cca0f,null))[_0x2c5d('0x25')](removeEntity(_0x3cca0f,null))['catch'](handleError(_0x3cca0f,null));};exports[_0x2c5d('0x4a')]=function(_0x25612c,_0x4ad8c4,_0x593d76){var _0x4742be={};var _0x445008={};var _0x330529;var _0x2c04b4;return db[_0x2c5d('0x29')][_0x2c5d('0x4b')]({'where':{'id':_0x25612c[_0x2c5d('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ad8c4,null))['then'](function(_0x3969cd){if(_0x3969cd){_0x330529=_0x3969cd;_0x445008[_0x2c5d('0x2d')]=_[_0x2c5d('0x2e')](db[_0x2c5d('0x4c')][_0x2c5d('0x44')]);_0x445008[_0x2c5d('0x31')]=_[_0x2c5d('0x2e')](_0x25612c[_0x2c5d('0x31')]);_0x445008[_0x2c5d('0x2f')]=_[_0x2c5d('0x30')](_0x445008[_0x2c5d('0x2d')],_0x445008['query']);_0x4742be[_0x2c5d('0x32')]=_[_0x2c5d('0x30')](_0x445008['model'],qs[_0x2c5d('0x45')](_0x25612c[_0x2c5d('0x31')][_0x2c5d('0x45')]));_0x4742be[_0x2c5d('0x32')]=_0x4742be[_0x2c5d('0x32')][_0x2c5d('0x33')]?_0x4742be[_0x2c5d('0x32')]:_0x445008['model'];_0x4742be[_0x2c5d('0x36')]=qs[_0x2c5d('0x37')](_0x25612c['query']['sort']);_0x4742be[_0x2c5d('0x38')]=qs['filters'](_['pick'](_0x25612c['query'],_0x445008[_0x2c5d('0x2f')]));if(_0x25612c[_0x2c5d('0x31')]['filter']){_0x4742be[_0x2c5d('0x38')]=_[_0x2c5d('0x3a')](_0x4742be['where'],{'$or':_[_0x2c5d('0x3b')](_0x4742be[_0x2c5d('0x32')],function(_0x59a898){var _0xc6a516={};_0xc6a516[_0x59a898]={'$like':'%'+_0x25612c['query'][_0x2c5d('0x4d')]+'%'};return _0xc6a516;})});}_0x4742be=_[_0x2c5d('0x3a')]({},_0x4742be,_0x25612c[_0x2c5d('0x3e')]);return _0x330529[_0x2c5d('0x4a')](_0x4742be);}})[_0x2c5d('0x25')](function(_0x15c116){if(_0x15c116){_0x2c04b4=_0x15c116[_0x2c5d('0x33')];if(!_0x25612c['query']['hasOwnProperty'](_0x2c5d('0x35'))){_0x4742be[_0x2c5d('0x1e')]=qs[_0x2c5d('0x1e')](_0x25612c[_0x2c5d('0x31')][_0x2c5d('0x1e')]);_0x4742be[_0x2c5d('0x1b')]=qs[_0x2c5d('0x1b')](_0x25612c[_0x2c5d('0x31')]['offset']);}return _0x330529[_0x2c5d('0x4a')](_0x4742be);}})[_0x2c5d('0x25')](function(_0x5eedf7){if(_0x5eedf7){return _0x5eedf7?{'count':_0x2c04b4,'rows':_0x5eedf7}:null;}})['then'](respondWithResult(_0x4ad8c4,null))[_0x2c5d('0x43')](handleError(_0x4ad8c4,null));};exports[_0x2c5d('0x4e')]=function(_0x3c4fd5,_0xdbc27a,_0x524404){var _0x38cf5e={};var _0x4a7bd7={};var _0x4dc298;var _0x2eb358;return db[_0x2c5d('0x29')][_0x2c5d('0x4b')]({'where':{'id':_0x3c4fd5[_0x2c5d('0x49')]['id']}})[_0x2c5d('0x25')](handleEntityNotFound(_0xdbc27a,null))[_0x2c5d('0x25')](function(_0x550783){if(_0x550783){_0x4dc298=_0x550783;_0x4a7bd7[_0x2c5d('0x2d')]=_[_0x2c5d('0x2e')](db['SalesforceField'][_0x2c5d('0x44')]);_0x4a7bd7[_0x2c5d('0x31')]=_[_0x2c5d('0x2e')](_0x3c4fd5[_0x2c5d('0x31')]);_0x4a7bd7[_0x2c5d('0x2f')]=_[_0x2c5d('0x30')](_0x4a7bd7['model'],_0x4a7bd7[_0x2c5d('0x31')]);_0x38cf5e[_0x2c5d('0x32')]=_['intersection'](_0x4a7bd7[_0x2c5d('0x2d')],qs['fields'](_0x3c4fd5['query'][_0x2c5d('0x45')]));_0x38cf5e[_0x2c5d('0x32')]=_0x38cf5e[_0x2c5d('0x32')][_0x2c5d('0x33')]?_0x38cf5e[_0x2c5d('0x32')]:_0x4a7bd7[_0x2c5d('0x2d')];_0x38cf5e[_0x2c5d('0x36')]=qs[_0x2c5d('0x37')](_0x3c4fd5[_0x2c5d('0x31')][_0x2c5d('0x37')]);_0x38cf5e[_0x2c5d('0x38')]=qs[_0x2c5d('0x2f')](_['pick'](_0x3c4fd5[_0x2c5d('0x31')],_0x4a7bd7[_0x2c5d('0x2f')]));if(_0x3c4fd5['query'][_0x2c5d('0x4d')]){_0x38cf5e['where']=_[_0x2c5d('0x3a')](_0x38cf5e[_0x2c5d('0x38')],{'$or':_['map'](_0x38cf5e[_0x2c5d('0x32')],function(_0x165663){var _0x54c764={};_0x54c764[_0x165663]={'$like':'%'+_0x3c4fd5[_0x2c5d('0x31')][_0x2c5d('0x4d')]+'%'};return _0x54c764;})});}_0x38cf5e=_[_0x2c5d('0x3a')]({},_0x38cf5e,_0x3c4fd5['options']);return _0x4dc298['getSubjects'](_0x38cf5e);}})[_0x2c5d('0x25')](function(_0x34399f){if(_0x34399f){_0x2eb358=_0x34399f[_0x2c5d('0x33')];if(!_0x3c4fd5[_0x2c5d('0x31')][_0x2c5d('0x34')](_0x2c5d('0x35'))){_0x38cf5e[_0x2c5d('0x1e')]=qs[_0x2c5d('0x1e')](_0x3c4fd5['query'][_0x2c5d('0x1e')]);_0x38cf5e[_0x2c5d('0x1b')]=qs[_0x2c5d('0x1b')](_0x3c4fd5['query'][_0x2c5d('0x1b')]);}return _0x4dc298[_0x2c5d('0x4e')](_0x38cf5e);}})[_0x2c5d('0x25')](function(_0x2e06ae){if(_0x2e06ae){return _0x2e06ae?{'count':_0x2eb358,'rows':_0x2e06ae}:null;}})[_0x2c5d('0x25')](respondWithResult(_0xdbc27a,null))[_0x2c5d('0x43')](handleError(_0xdbc27a,null));};exports[_0x2c5d('0x4f')]=function(_0x1f5ef3,_0x18650c,_0x2ec48f){var _0x24f3ff={};var _0x448dc2={};var _0xa7aabb;var _0x119b8b;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x1f5ef3[_0x2c5d('0x49')]['id']}})[_0x2c5d('0x25')](handleEntityNotFound(_0x18650c,null))[_0x2c5d('0x25')](function(_0x344ae2){if(_0x344ae2){_0xa7aabb=_0x344ae2;_0x448dc2[_0x2c5d('0x2d')]=_[_0x2c5d('0x2e')](db['SalesforceField'][_0x2c5d('0x44')]);_0x448dc2[_0x2c5d('0x31')]=_[_0x2c5d('0x2e')](_0x1f5ef3[_0x2c5d('0x31')]);_0x448dc2[_0x2c5d('0x2f')]=_[_0x2c5d('0x30')](_0x448dc2['model'],_0x448dc2[_0x2c5d('0x31')]);_0x24f3ff['attributes']=_['intersection'](_0x448dc2[_0x2c5d('0x2d')],qs['fields'](_0x1f5ef3[_0x2c5d('0x31')][_0x2c5d('0x45')]));_0x24f3ff[_0x2c5d('0x32')]=_0x24f3ff[_0x2c5d('0x32')][_0x2c5d('0x33')]?_0x24f3ff['attributes']:_0x448dc2[_0x2c5d('0x2d')];_0x24f3ff[_0x2c5d('0x36')]=qs[_0x2c5d('0x37')](_0x1f5ef3[_0x2c5d('0x31')][_0x2c5d('0x37')]);_0x24f3ff[_0x2c5d('0x38')]=qs[_0x2c5d('0x2f')](_[_0x2c5d('0x39')](_0x1f5ef3['query'],_0x448dc2[_0x2c5d('0x2f')]));if(_0x1f5ef3[_0x2c5d('0x31')]['filter']){_0x24f3ff[_0x2c5d('0x38')]=_[_0x2c5d('0x3a')](_0x24f3ff['where'],{'$or':_[_0x2c5d('0x3b')](_0x24f3ff[_0x2c5d('0x32')],function(_0x3f87d9){var _0xd589a9={};_0xd589a9[_0x3f87d9]={'$like':'%'+_0x1f5ef3[_0x2c5d('0x31')][_0x2c5d('0x4d')]+'%'};return _0xd589a9;})});}_0x24f3ff=_[_0x2c5d('0x3a')]({},_0x24f3ff,_0x1f5ef3[_0x2c5d('0x3e')]);return _0xa7aabb[_0x2c5d('0x4f')](_0x24f3ff);}})['then'](function(_0x1e8ac3){if(_0x1e8ac3){_0x119b8b=_0x1e8ac3['length'];if(!_0x1f5ef3[_0x2c5d('0x31')]['hasOwnProperty'](_0x2c5d('0x35'))){_0x24f3ff[_0x2c5d('0x1e')]=qs[_0x2c5d('0x1e')](_0x1f5ef3['query'][_0x2c5d('0x1e')]);_0x24f3ff[_0x2c5d('0x1b')]=qs[_0x2c5d('0x1b')](_0x1f5ef3[_0x2c5d('0x31')][_0x2c5d('0x1b')]);}return _0xa7aabb[_0x2c5d('0x4f')](_0x24f3ff);}})[_0x2c5d('0x25')](function(_0x14c496){if(_0x14c496){return _0x14c496?{'count':_0x119b8b,'rows':_0x14c496}:null;}})[_0x2c5d('0x25')](respondWithResult(_0x18650c,null))[_0x2c5d('0x43')](handleError(_0x18650c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 8d9b991..ad39965 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 _0x1845=['api','bluebird','request-promise','../../config/environment','define','int_salesforce_configurations','../../config/logger'];(function(_0x2f354c,_0x5c4d39){var _0x532d04=function(_0x26b53a){while(--_0x26b53a){_0x2f354c['push'](_0x2f354c['shift']());}};_0x532d04(++_0x5c4d39);}(_0x1845,0xa0));var _0x5184=function(_0x5055a1,_0x2282e3){_0x5055a1=_0x5055a1-0x0;var _0x583cb6=_0x1845[_0x5055a1];return _0x583cb6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5184('0x0'))(_0x5184('0x1'));var moment=require('moment');var BPromise=require(_0x5184('0x2'));var rp=require(_0x5184('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5184('0x4'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x127117,_0x638f8c){return _0x127117[_0x5184('0x5')]('SalesforceConfiguration',attributes,{'tableName':_0x5184('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb48b=['int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0xb266b9,_0x2cdfc0){var _0x313b29=function(_0x30a27c){while(--_0x30a27c){_0xb266b9['push'](_0xb266b9['shift']());}};_0x313b29(++_0x2cdfc0);}(_0xb48b,0x105));var _0xbb48=function(_0x3aee63,_0x37be7b){_0x3aee63=_0x3aee63-0x0;var _0x306d1f=_0xb48b[_0x3aee63];return _0x306d1f;};'use strict';var _=require(_0xbb48('0x0'));var util=require(_0xbb48('0x1'));var logger=require('../../config/logger')(_0xbb48('0x2'));var moment=require(_0xbb48('0x3'));var BPromise=require(_0xbb48('0x4'));var rp=require(_0xbb48('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbb48('0x6'));var attributes=require(_0xbb48('0x7'));module[_0xbb48('0x8')]=function(_0x34b79f,_0x321fb1){return _0x34b79f['define']('SalesforceConfiguration',attributes,{'tableName':_0xbb48('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 4b26352..fb5cfd9 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 _0xab24=['stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x4324e4,_0x2c9f7a){var _0x31c8b9=function(_0x1059a3){while(--_0x1059a3){_0x4324e4['push'](_0x4324e4['shift']());}};_0x31c8b9(++_0x2c9f7a);}(_0xab24,0x123));var _0x4ab2=function(_0x31bf0d,_0x3d284d){_0x31bf0d=_0x31bf0d-0x0;var _0x5330da=_0xab24[_0x31bf0d];return _0x5330da;};'use strict';var _=require(_0x4ab2('0x0'));var util=require('util');var moment=require(_0x4ab2('0x1'));var BPromise=require(_0x4ab2('0x2'));var rs=require(_0x4ab2('0x3'));var fs=require('fs');var Redis=require(_0x4ab2('0x4'));var db=require(_0x4ab2('0x5'))['db'];var utils=require(_0x4ab2('0x6'));var logger=require('../../config/logger')(_0x4ab2('0x7'));var config=require(_0x4ab2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4ab2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cb72e,_0x511269,_0xe5f2ef){return new BPromise(function(_0x436da6,_0x294124){return client[_0x4ab2('0xa')](_0x4cb72e,_0xe5f2ef)[_0x4ab2('0xb')](function(_0x1fbfc4){logger[_0x4ab2('0xc')](_0x4ab2('0xd'),_0x511269,_0x4ab2('0xe'));logger[_0x4ab2('0xf')](_0x4ab2('0x10'),_0x511269,_0x4ab2('0xe'),JSON[_0x4ab2('0x11')](_0x1fbfc4));if(_0x1fbfc4[_0x4ab2('0x12')]){if(_0x1fbfc4[_0x4ab2('0x12')][_0x4ab2('0x13')]===0x1f4){logger[_0x4ab2('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x511269,_0x1fbfc4[_0x4ab2('0x12')][_0x4ab2('0x14')]);return _0x294124(_0x1fbfc4['error']['message']);}logger['error'](_0x4ab2('0xd'),_0x511269,_0x1fbfc4[_0x4ab2('0x12')][_0x4ab2('0x14')]);return _0x436da6(_0x1fbfc4['error'][_0x4ab2('0x14')]);}else{logger[_0x4ab2('0xc')](_0x4ab2('0xd'),_0x511269,_0x4ab2('0xe'));_0x436da6(_0x1fbfc4['result'][_0x4ab2('0x14')]);}})[_0x4ab2('0x15')](function(_0x5a5ce0){logger[_0x4ab2('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x511269,_0x5a5ce0);_0x294124(_0x5a5ce0);});});} \ No newline at end of file +var _0x49b4=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x316fd4,_0x3d52ba){var _0x57fb0c=function(_0x4aeffa){while(--_0x4aeffa){_0x316fd4['push'](_0x316fd4['shift']());}};_0x57fb0c(++_0x3d52ba);}(_0x49b4,0x145));var _0x449b=function(_0xa218ee,_0x13d272){_0xa218ee=_0xa218ee-0x0;var _0x1791ae=_0x49b4[_0xa218ee];return _0x1791ae;};'use strict';var _=require(_0x449b('0x0'));var util=require(_0x449b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x449b('0x2'));var fs=require('fs');var Redis=require(_0x449b('0x3'));var db=require(_0x449b('0x4'))['db'];var utils=require(_0x449b('0x5'));var logger=require(_0x449b('0x6'))('rpc');var config=require(_0x449b('0x7'));var jayson=require(_0x449b('0x8'));var client=jayson[_0x449b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x287510,_0x133762,_0x1819d4){return new BPromise(function(_0x4251f3,_0x4c0c6c){return client[_0x449b('0xa')](_0x287510,_0x1819d4)['then'](function(_0x1fd5a0){logger[_0x449b('0xb')](_0x449b('0xc'),_0x133762,_0x449b('0xd'));logger[_0x449b('0xe')](_0x449b('0xf'),_0x133762,_0x449b('0xd'),JSON[_0x449b('0x10')](_0x1fd5a0));if(_0x1fd5a0[_0x449b('0x11')]){if(_0x1fd5a0[_0x449b('0x11')][_0x449b('0x12')]===0x1f4){logger[_0x449b('0x11')](_0x449b('0xc'),_0x133762,_0x1fd5a0[_0x449b('0x11')]['message']);return _0x4c0c6c(_0x1fd5a0[_0x449b('0x11')][_0x449b('0x13')]);}logger[_0x449b('0x11')](_0x449b('0xc'),_0x133762,_0x1fd5a0[_0x449b('0x11')]['message']);return _0x4251f3(_0x1fd5a0[_0x449b('0x11')][_0x449b('0x13')]);}else{logger[_0x449b('0xb')](_0x449b('0xc'),_0x133762,_0x449b('0xd'));_0x4251f3(_0x1fd5a0['result'][_0x449b('0x13')]);}})['catch'](function(_0x1a47b8){logger[_0x449b('0x11')](_0x449b('0xc'),_0x133762,_0x1a47b8);_0x4c0c6c(_0x1a47b8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 2bc152e..897507f 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 _0x64fc=['../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x560486,_0x3c0f54){var _0x431c4f=function(_0x338466){while(--_0x338466){_0x560486['push'](_0x560486['shift']());}};_0x431c4f(++_0x3c0f54);}(_0x64fc,0x88));var _0xc64f=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x64fc[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0xc64f('0x0'));var util=require(_0xc64f('0x1'));var path=require(_0xc64f('0x2'));var timeout=require(_0xc64f('0x3'));var express=require(_0xc64f('0x4'));var router=express[_0xc64f('0x5')]();var fs_extra=require(_0xc64f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc64f('0x7'));var config=require(_0xc64f('0x8'));var controller=require('./intSalesforceField.controller');router[_0xc64f('0x9')]('/',auth[_0xc64f('0xa')](),controller['index']);router[_0xc64f('0x9')](_0xc64f('0xb'),auth[_0xc64f('0xa')](),controller[_0xc64f('0xc')]);router[_0xc64f('0xd')]('/',auth[_0xc64f('0xa')](),controller[_0xc64f('0xe')]);router['put'](_0xc64f('0xb'),auth[_0xc64f('0xa')](),controller[_0xc64f('0xf')]);router[_0xc64f('0x10')](_0xc64f('0xb'),auth[_0xc64f('0xa')](),controller['destroy']);module[_0xc64f('0x11')]=router; \ No newline at end of file +var _0x37d3=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x85fcc7,_0x4960ee){var _0x6aeafb=function(_0xbf5c6b){while(--_0xbf5c6b){_0x85fcc7['push'](_0x85fcc7['shift']());}};_0x6aeafb(++_0x4960ee);}(_0x37d3,0xd0));var _0x337d=function(_0x21745c,_0x186f06){_0x21745c=_0x21745c-0x0;var _0x12e0b8=_0x37d3[_0x21745c];return _0x12e0b8;};'use strict';var multer=require(_0x337d('0x0'));var util=require(_0x337d('0x1'));var path=require(_0x337d('0x2'));var timeout=require(_0x337d('0x3'));var express=require(_0x337d('0x4'));var router=express['Router']();var fs_extra=require(_0x337d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x337d('0x6'));var config=require(_0x337d('0x7'));var controller=require('./intSalesforceField.controller');router[_0x337d('0x8')]('/',auth[_0x337d('0x9')](),controller[_0x337d('0xa')]);router[_0x337d('0x8')](_0x337d('0xb'),auth[_0x337d('0x9')](),controller[_0x337d('0xc')]);router[_0x337d('0xd')]('/',auth['isAuthenticated'](),controller[_0x337d('0xe')]);router[_0x337d('0xf')](_0x337d('0xb'),auth['isAuthenticated'](),controller[_0x337d('0x10')]);router[_0x337d('0x11')]('/:id',auth[_0x337d('0x9')](),controller[_0x337d('0x12')]);module[_0x337d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 9596b87..6869129 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 _0xebc7=['picklist','customVariable','STRING','exports','string','variable','keyValue'];(function(_0x5c7c31,_0x22aa86){var _0x193fdf=function(_0x271ade){while(--_0x271ade){_0x5c7c31['push'](_0x5c7c31['shift']());}};_0x193fdf(++_0x22aa86);}(_0xebc7,0x106));var _0x7ebc=function(_0x51f7b4,_0x3c0a59){_0x51f7b4=_0x51f7b4-0x0;var _0x5c4f45=_0xebc7[_0x51f7b4];return _0x5c4f45;};'use strict';var Sequelize=require('sequelize');module[_0x7ebc('0x0')]={'type':{'type':Sequelize['ENUM'](_0x7ebc('0x1'),_0x7ebc('0x2'),'customVariable',_0x7ebc('0x3'),_0x7ebc('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7ebc('0x1'),'variable',_0x7ebc('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7ebc('0x6')]},'variableName':{'type':Sequelize[_0x7ebc('0x6')]}}; \ No newline at end of file +var _0x8998=['string','variable','picklist','ENUM','STRING','exports'];(function(_0x30fd4c,_0x4100f5){var _0x93706b=function(_0xbdf6){while(--_0xbdf6){_0x30fd4c['push'](_0x30fd4c['shift']());}};_0x93706b(++_0x4100f5);}(_0x8998,0xdd));var _0x8899=function(_0x3daaec,_0x512019){_0x3daaec=_0x3daaec-0x0;var _0x48d8b3=_0x8998[_0x3daaec];return _0x48d8b3;};'use strict';var Sequelize=require('sequelize');module[_0x8899('0x0')]={'type':{'type':Sequelize['ENUM'](_0x8899('0x1'),_0x8899('0x2'),'customVariable','keyValue',_0x8899('0x3')),'defaultValue':_0x8899('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8899('0x4')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x8899('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x8899('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index bb1d3ff..d1bf72b 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 _0x5e27=['pick','merge','options','includeAll','include','rows','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','offset','limit','undefined','count','set','json','reject','update','destroy','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where'];(function(_0x492cd4,_0x2a640f){var _0x2c73f5=function(_0x720b8){while(--_0x720b8){_0x492cd4['push'](_0x492cd4['shift']());}};_0x2c73f5(++_0x2a640f);}(_0x5e27,0x1e8));var _0x75e2=function(_0x5ce947,_0x105560){_0x5ce947=_0x5ce947-0x0;var _0x5e37da=_0x5e27[_0x5ce947];return _0x5e37da;};'use strict';var emlformat=require(_0x75e2('0x0'));var rimraf=require(_0x75e2('0x1'));var zipdir=require(_0x75e2('0x2'));var jsonpatch=require(_0x75e2('0x3'));var rp=require(_0x75e2('0x4'));var moment=require(_0x75e2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x75e2('0x6'));var util=require('util');var path=require(_0x75e2('0x7'));var sox=require(_0x75e2('0x8'));var csv=require(_0x75e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75e2('0xa'));var _=require('lodash');var squel=require(_0x75e2('0xb'));var crypto=require(_0x75e2('0xc'));var jsforce=require(_0x75e2('0xd'));var deskjs=require(_0x75e2('0xe'));var toCsv=require(_0x75e2('0x9'));var querystring=require(_0x75e2('0xf'));var Papa=require(_0x75e2('0x10'));var Redis=require(_0x75e2('0x11'));var authService=require(_0x75e2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x75e2('0x13'));var hardwareService=require(_0x75e2('0x14'));var logger=require('../../config/logger')(_0x75e2('0x15'));var utils=require(_0x75e2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x296e7f,_0x4ee97f){_0x4ee97f=_0x4ee97f||0xcc;return function(_0x6fed64){if(_0x6fed64){return _0x296e7f['sendStatus'](_0x4ee97f);}return _0x296e7f[_0x75e2('0x17')](_0x4ee97f)[_0x75e2('0x18')]();};}function respondWithResult(_0x1cc4ea,_0x3999aa){_0x3999aa=_0x3999aa||0xc8;return function(_0x57c50a){if(_0x57c50a){return _0x1cc4ea[_0x75e2('0x17')](_0x3999aa)['json'](_0x57c50a);}};}function respondWithFilteredResult(_0x5ef139,_0x151e07){return function(_0x24c4b3){if(_0x24c4b3){var _0x561a8b=typeof _0x151e07[_0x75e2('0x19')]==='undefined'&&typeof _0x151e07[_0x75e2('0x1a')]===_0x75e2('0x1b');var _0x4d1ed8=_0x24c4b3[_0x75e2('0x1c')];var _0x2c8bfb=_0x561a8b?0x0:_0x151e07[_0x75e2('0x19')];var _0x1f2249=_0x561a8b?_0x24c4b3[_0x75e2('0x1c')]:_0x151e07[_0x75e2('0x19')]+_0x151e07['limit'];var _0x83fcfc;if(_0x1f2249>=_0x4d1ed8){_0x1f2249=_0x4d1ed8;_0x83fcfc=0xc8;}else{_0x83fcfc=0xce;}_0x5ef139[_0x75e2('0x17')](_0x83fcfc);return _0x5ef139[_0x75e2('0x1d')]('Content-Range',_0x2c8bfb+'-'+_0x1f2249+'/'+_0x4d1ed8)[_0x75e2('0x1e')](_0x24c4b3);}return null;};}function patchUpdates(_0x138b26){return function(_0x5288e6){try{jsonpatch['apply'](_0x5288e6,_0x138b26,!![]);}catch(_0x2ca3b9){return BPromise[_0x75e2('0x1f')](_0x2ca3b9);}return _0x5288e6['save']();};}function saveUpdates(_0x29a762,_0x4d4037){return function(_0x876ad0){if(_0x876ad0){return _0x876ad0[_0x75e2('0x20')](_0x29a762)['then'](function(_0x31ff3c){return _0x31ff3c;});}return null;};}function removeEntity(_0xcc3fb,_0x50e1f8){return function(_0x4f3370){if(_0x4f3370){return _0x4f3370[_0x75e2('0x21')]()[_0x75e2('0x22')](function(){_0xcc3fb[_0x75e2('0x17')](0xcc)[_0x75e2('0x18')]();});}};}function handleEntityNotFound(_0x286a92,_0x6d0693){return function(_0x45539e){if(!_0x45539e){_0x286a92['sendStatus'](0x194);}return _0x45539e;};}function handleError(_0x515c36,_0x3e63b1){_0x3e63b1=_0x3e63b1||0x1f4;return function(_0x313362){logger[_0x75e2('0x23')](_0x313362[_0x75e2('0x24')]);if(_0x313362[_0x75e2('0x25')]){delete _0x313362['name'];}_0x515c36[_0x75e2('0x17')](_0x3e63b1)[_0x75e2('0x26')](_0x313362);};}exports[_0x75e2('0x27')]=function(_0x512c86,_0x14b1a5){var _0x56992c={},_0x18c30f={},_0x37e2ef={'count':0x0,'rows':[]};var _0xb73e2=_[_0x75e2('0x28')](db[_0x75e2('0x29')][_0x75e2('0x2a')],function(_0x2b5b74){return{'name':_0x2b5b74[_0x75e2('0x2b')],'type':_0x2b5b74[_0x75e2('0x2c')][_0x75e2('0x2d')]};});_0x18c30f[_0x75e2('0x2e')]=_[_0x75e2('0x28')](_0xb73e2,'name');_0x18c30f[_0x75e2('0x2f')]=_['keys'](_0x512c86[_0x75e2('0x2f')]);_0x18c30f[_0x75e2('0x30')]=_['intersection'](_0x18c30f[_0x75e2('0x2e')],_0x18c30f[_0x75e2('0x2f')]);_0x56992c['attributes']=_[_0x75e2('0x31')](_0x18c30f[_0x75e2('0x2e')],qs[_0x75e2('0x32')](_0x512c86[_0x75e2('0x2f')][_0x75e2('0x32')]));_0x56992c[_0x75e2('0x33')]=_0x56992c[_0x75e2('0x33')][_0x75e2('0x34')]?_0x56992c[_0x75e2('0x33')]:_0x18c30f[_0x75e2('0x2e')];if(!_0x512c86['query']['hasOwnProperty']('nolimit')){_0x56992c[_0x75e2('0x1a')]=qs[_0x75e2('0x1a')](_0x512c86['query'][_0x75e2('0x1a')]);_0x56992c[_0x75e2('0x19')]=qs[_0x75e2('0x19')](_0x512c86['query']['offset']);}_0x56992c[_0x75e2('0x35')]=qs[_0x75e2('0x36')](_0x512c86['query'][_0x75e2('0x36')]);_0x56992c[_0x75e2('0x37')]=qs[_0x75e2('0x30')](_[_0x75e2('0x38')](_0x512c86[_0x75e2('0x2f')],_0x18c30f[_0x75e2('0x30')]),_0xb73e2);if(_0x512c86[_0x75e2('0x2f')]['filter']){_0x56992c[_0x75e2('0x37')]=_[_0x75e2('0x39')](_0x56992c['where'],{'$or':_[_0x75e2('0x28')](_0xb73e2,function(_0x2bd429){if(_0x2bd429[_0x75e2('0x2c')]!=='VIRTUAL'){var _0x1d69ea={};_0x1d69ea[_0x2bd429['name']]={'$like':'%'+_0x512c86[_0x75e2('0x2f')]['filter']+'%'};return _0x1d69ea;}})});}_0x56992c=_[_0x75e2('0x39')]({},_0x56992c,_0x512c86[_0x75e2('0x3a')]);var _0x125746={'where':_0x56992c[_0x75e2('0x37')]};return db[_0x75e2('0x29')]['count'](_0x125746)['then'](function(_0xddd8e7){_0x37e2ef[_0x75e2('0x1c')]=_0xddd8e7;if(_0x512c86[_0x75e2('0x2f')][_0x75e2('0x3b')]){_0x56992c[_0x75e2('0x3c')]=[{'all':!![]}];}return db[_0x75e2('0x29')]['findAll'](_0x56992c);})[_0x75e2('0x22')](function(_0x31e7b0){_0x37e2ef[_0x75e2('0x3d')]=_0x31e7b0;return _0x37e2ef;})['then'](respondWithFilteredResult(_0x14b1a5,_0x56992c))[_0x75e2('0x3e')](handleError(_0x14b1a5,null));};exports['show']=function(_0xf9a534,_0x27910a){var _0x5c1b37={'raw':!![],'where':{'id':_0xf9a534[_0x75e2('0x3f')]['id']}},_0xeeb256={};_0xeeb256[_0x75e2('0x2e')]=_['keys'](db[_0x75e2('0x29')]['rawAttributes']);_0xeeb256['query']=_[_0x75e2('0x40')](_0xf9a534[_0x75e2('0x2f')]);_0xeeb256[_0x75e2('0x30')]=_['intersection'](_0xeeb256['model'],_0xeeb256[_0x75e2('0x2f')]);_0x5c1b37[_0x75e2('0x33')]=_[_0x75e2('0x31')](_0xeeb256[_0x75e2('0x2e')],qs[_0x75e2('0x32')](_0xf9a534['query'][_0x75e2('0x32')]));_0x5c1b37[_0x75e2('0x33')]=_0x5c1b37[_0x75e2('0x33')]['length']?_0x5c1b37[_0x75e2('0x33')]:_0xeeb256[_0x75e2('0x2e')];if(_0xf9a534['query'][_0x75e2('0x3b')]){_0x5c1b37[_0x75e2('0x3c')]=[{'all':!![]}];}_0x5c1b37=_[_0x75e2('0x39')]({},_0x5c1b37,_0xf9a534[_0x75e2('0x3a')]);return db[_0x75e2('0x29')][_0x75e2('0x41')](_0x5c1b37)[_0x75e2('0x22')](handleEntityNotFound(_0x27910a,null))[_0x75e2('0x22')](respondWithResult(_0x27910a,null))[_0x75e2('0x3e')](handleError(_0x27910a,null));};exports['create']=function(_0x895f20,_0x504f00){return db['SalesforceField'][_0x75e2('0x42')](_0x895f20[_0x75e2('0x43')],{})['then'](respondWithResult(_0x504f00,0xc9))[_0x75e2('0x3e')](handleError(_0x504f00,null));};exports[_0x75e2('0x20')]=function(_0x1409e9,_0x137914){if(_0x1409e9[_0x75e2('0x43')]['id']){delete _0x1409e9[_0x75e2('0x43')]['id'];}return db[_0x75e2('0x29')][_0x75e2('0x41')]({'where':{'id':_0x1409e9['params']['id']}})['then'](handleEntityNotFound(_0x137914,null))[_0x75e2('0x22')](saveUpdates(_0x1409e9[_0x75e2('0x43')],null))[_0x75e2('0x22')](respondWithResult(_0x137914,null))[_0x75e2('0x3e')](handleError(_0x137914,null));};exports[_0x75e2('0x21')]=function(_0x556247,_0x4f8699){return db[_0x75e2('0x29')]['find']({'where':{'id':_0x556247[_0x75e2('0x3f')]['id']}})[_0x75e2('0x22')](handleEntityNotFound(_0x4f8699,null))[_0x75e2('0x22')](removeEntity(_0x4f8699,null))[_0x75e2('0x3e')](handleError(_0x4f8699,null));}; \ No newline at end of file +var _0x67b1=['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','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x10f494,_0x37b246){var _0x1d428=function(_0x5b8388){while(--_0x5b8388){_0x10f494['push'](_0x10f494['shift']());}};_0x1d428(++_0x37b246);}(_0x67b1,0x1b8));var _0x167b=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0x67b1[_0x3ff2f9];return _0x3b0913;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x167b('0x0'));var zipdir=require(_0x167b('0x1'));var jsonpatch=require(_0x167b('0x2'));var rp=require(_0x167b('0x3'));var moment=require(_0x167b('0x4'));var BPromise=require(_0x167b('0x5'));var Mustache=require(_0x167b('0x6'));var util=require(_0x167b('0x7'));var path=require(_0x167b('0x8'));var sox=require(_0x167b('0x9'));var csv=require(_0x167b('0xa'));var ejs=require(_0x167b('0xb'));var fs=require('fs');var fs_extra=require(_0x167b('0xc'));var _=require(_0x167b('0xd'));var squel=require('squel');var crypto=require(_0x167b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x167b('0xf'));var toCsv=require(_0x167b('0xa'));var querystring=require(_0x167b('0x10'));var Papa=require(_0x167b('0x11'));var Redis=require(_0x167b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x167b('0x13'));var as=require(_0x167b('0x14'));var hardwareService=require(_0x167b('0x15'));var logger=require('../../config/logger')(_0x167b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x167b('0x17'));var db=require(_0x167b('0x18'))['db'];function respondWithStatusCode(_0x2eb0c6,_0x4c8866){_0x4c8866=_0x4c8866||0xcc;return function(_0x4a2395){if(_0x4a2395){return _0x2eb0c6[_0x167b('0x19')](_0x4c8866);}return _0x2eb0c6[_0x167b('0x1a')](_0x4c8866)['end']();};}function respondWithResult(_0x4eb0b6,_0x57aea1){_0x57aea1=_0x57aea1||0xc8;return function(_0x2f9946){if(_0x2f9946){return _0x4eb0b6['status'](_0x57aea1)[_0x167b('0x1b')](_0x2f9946);}};}function respondWithFilteredResult(_0x2e60f7,_0x1ee6d1){return function(_0x1b84b0){if(_0x1b84b0){var _0x446c3f=typeof _0x1ee6d1[_0x167b('0x1c')]===_0x167b('0x1d')&&typeof _0x1ee6d1[_0x167b('0x1e')]===_0x167b('0x1d');var _0x20c03c=_0x1b84b0[_0x167b('0x1f')];var _0x264ead=_0x446c3f?0x0:_0x1ee6d1[_0x167b('0x1c')];var _0x32366c=_0x446c3f?_0x1b84b0[_0x167b('0x1f')]:_0x1ee6d1['offset']+_0x1ee6d1[_0x167b('0x1e')];var _0x43279e;if(_0x32366c>=_0x20c03c){_0x32366c=_0x20c03c;_0x43279e=0xc8;}else{_0x43279e=0xce;}_0x2e60f7[_0x167b('0x1a')](_0x43279e);return _0x2e60f7[_0x167b('0x20')](_0x167b('0x21'),_0x264ead+'-'+_0x32366c+'/'+_0x20c03c)[_0x167b('0x1b')](_0x1b84b0);}return null;};}function patchUpdates(_0x5c4d8b){return function(_0x580f38){try{jsonpatch[_0x167b('0x22')](_0x580f38,_0x5c4d8b,!![]);}catch(_0x1c4953){return BPromise['reject'](_0x1c4953);}return _0x580f38[_0x167b('0x23')]();};}function saveUpdates(_0x4d15a8,_0x57b886){return function(_0x35671b){if(_0x35671b){return _0x35671b[_0x167b('0x24')](_0x4d15a8)[_0x167b('0x25')](function(_0xc6a61){return _0xc6a61;});}return null;};}function removeEntity(_0x2e76d8,_0x109e00){return function(_0x582c7a){if(_0x582c7a){return _0x582c7a[_0x167b('0x26')]()[_0x167b('0x25')](function(){_0x2e76d8[_0x167b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50e3de,_0x39e0e1){return function(_0x1e84ec){if(!_0x1e84ec){_0x50e3de[_0x167b('0x19')](0x194);}return _0x1e84ec;};}function handleError(_0x45e313,_0x26e935){_0x26e935=_0x26e935||0x1f4;return function(_0x18b87e){logger[_0x167b('0x27')](_0x18b87e[_0x167b('0x28')]);if(_0x18b87e[_0x167b('0x29')]){delete _0x18b87e[_0x167b('0x29')];}_0x45e313[_0x167b('0x1a')](_0x26e935)[_0x167b('0x2a')](_0x18b87e);};}exports[_0x167b('0x2b')]=function(_0x2d16e5,_0x9ab80f){var _0x5d93e3={},_0x5f0fbc={},_0xff957c={'count':0x0,'rows':[]};var _0x4b927e=_['map'](db[_0x167b('0x2c')][_0x167b('0x2d')],function(_0x1613e3){return{'name':_0x1613e3[_0x167b('0x2e')],'type':_0x1613e3['type'][_0x167b('0x2f')]};});_0x5f0fbc['model']=_['map'](_0x4b927e,'name');_0x5f0fbc[_0x167b('0x30')]=_[_0x167b('0x31')](_0x2d16e5[_0x167b('0x30')]);_0x5f0fbc[_0x167b('0x32')]=_['intersection'](_0x5f0fbc[_0x167b('0x33')],_0x5f0fbc[_0x167b('0x30')]);_0x5d93e3[_0x167b('0x34')]=_[_0x167b('0x35')](_0x5f0fbc[_0x167b('0x33')],qs[_0x167b('0x36')](_0x2d16e5['query'][_0x167b('0x36')]));_0x5d93e3['attributes']=_0x5d93e3[_0x167b('0x34')][_0x167b('0x37')]?_0x5d93e3[_0x167b('0x34')]:_0x5f0fbc[_0x167b('0x33')];if(!_0x2d16e5[_0x167b('0x30')][_0x167b('0x38')](_0x167b('0x39'))){_0x5d93e3[_0x167b('0x1e')]=qs[_0x167b('0x1e')](_0x2d16e5[_0x167b('0x30')][_0x167b('0x1e')]);_0x5d93e3[_0x167b('0x1c')]=qs[_0x167b('0x1c')](_0x2d16e5[_0x167b('0x30')][_0x167b('0x1c')]);}_0x5d93e3[_0x167b('0x3a')]=qs['sort'](_0x2d16e5[_0x167b('0x30')][_0x167b('0x3b')]);_0x5d93e3[_0x167b('0x3c')]=qs[_0x167b('0x32')](_['pick'](_0x2d16e5[_0x167b('0x30')],_0x5f0fbc['filters']),_0x4b927e);if(_0x2d16e5[_0x167b('0x30')][_0x167b('0x3d')]){_0x5d93e3[_0x167b('0x3c')]=_[_0x167b('0x3e')](_0x5d93e3[_0x167b('0x3c')],{'$or':_['map'](_0x4b927e,function(_0x1a9f2b){if(_0x1a9f2b[_0x167b('0x3f')]!==_0x167b('0x40')){var _0x4c3619={};_0x4c3619[_0x1a9f2b[_0x167b('0x29')]]={'$like':'%'+_0x2d16e5[_0x167b('0x30')][_0x167b('0x3d')]+'%'};return _0x4c3619;}})});}_0x5d93e3=_[_0x167b('0x3e')]({},_0x5d93e3,_0x2d16e5['options']);var _0x1a13d7={'where':_0x5d93e3['where']};return db[_0x167b('0x2c')][_0x167b('0x1f')](_0x1a13d7)['then'](function(_0x4b87a7){_0xff957c['count']=_0x4b87a7;if(_0x2d16e5['query'][_0x167b('0x41')]){_0x5d93e3[_0x167b('0x42')]=[{'all':!![]}];}return db[_0x167b('0x2c')]['findAll'](_0x5d93e3);})[_0x167b('0x25')](function(_0x104811){_0xff957c[_0x167b('0x43')]=_0x104811;return _0xff957c;})[_0x167b('0x25')](respondWithFilteredResult(_0x9ab80f,_0x5d93e3))[_0x167b('0x44')](handleError(_0x9ab80f,null));};exports['show']=function(_0x1440fb,_0x4c67c1){var _0x1d024f={'raw':!![],'where':{'id':_0x1440fb[_0x167b('0x45')]['id']}},_0x188175={};_0x188175[_0x167b('0x33')]=_[_0x167b('0x31')](db['SalesforceField']['rawAttributes']);_0x188175['query']=_['keys'](_0x1440fb[_0x167b('0x30')]);_0x188175[_0x167b('0x32')]=_['intersection'](_0x188175[_0x167b('0x33')],_0x188175[_0x167b('0x30')]);_0x1d024f[_0x167b('0x34')]=_[_0x167b('0x35')](_0x188175[_0x167b('0x33')],qs['fields'](_0x1440fb[_0x167b('0x30')][_0x167b('0x36')]));_0x1d024f[_0x167b('0x34')]=_0x1d024f[_0x167b('0x34')][_0x167b('0x37')]?_0x1d024f[_0x167b('0x34')]:_0x188175['model'];if(_0x1440fb[_0x167b('0x30')]['includeAll']){_0x1d024f[_0x167b('0x42')]=[{'all':!![]}];}_0x1d024f=_[_0x167b('0x3e')]({},_0x1d024f,_0x1440fb[_0x167b('0x46')]);return db['SalesforceField'][_0x167b('0x47')](_0x1d024f)[_0x167b('0x25')](handleEntityNotFound(_0x4c67c1,null))[_0x167b('0x25')](respondWithResult(_0x4c67c1,null))['catch'](handleError(_0x4c67c1,null));};exports['create']=function(_0x2b937c,_0x3f9ad1){return db['SalesforceField'][_0x167b('0x48')](_0x2b937c[_0x167b('0x49')],{})[_0x167b('0x25')](respondWithResult(_0x3f9ad1,0xc9))[_0x167b('0x44')](handleError(_0x3f9ad1,null));};exports[_0x167b('0x24')]=function(_0x3dc3d7,_0x24ccd1){if(_0x3dc3d7['body']['id']){delete _0x3dc3d7[_0x167b('0x49')]['id'];}return db['SalesforceField'][_0x167b('0x47')]({'where':{'id':_0x3dc3d7[_0x167b('0x45')]['id']}})[_0x167b('0x25')](handleEntityNotFound(_0x24ccd1,null))[_0x167b('0x25')](saveUpdates(_0x3dc3d7[_0x167b('0x49')],null))[_0x167b('0x25')](respondWithResult(_0x24ccd1,null))[_0x167b('0x44')](handleError(_0x24ccd1,null));};exports['destroy']=function(_0x358399,_0x3da0e6){return db[_0x167b('0x2c')]['find']({'where':{'id':_0x358399[_0x167b('0x45')]['id']}})[_0x167b('0x25')](handleEntityNotFound(_0x3da0e6,null))[_0x167b('0x25')](removeEntity(_0x3da0e6,null))[_0x167b('0x44')](handleError(_0x3da0e6,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ca2f0e1..6588f86 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 _0xd259=['request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','idField','lodash','util','api','moment','bluebird'];(function(_0x5a585b,_0x31ca78){var _0x2fe620=function(_0x38c06f){while(--_0x38c06f){_0x5a585b['push'](_0x5a585b['shift']());}};_0x2fe620(++_0x31ca78);}(_0xd259,0xa4));var _0x9d25=function(_0x559a49,_0x1ebc72){_0x559a49=_0x559a49-0x0;var _0x4be34d=_0xd259[_0x559a49];return _0x4be34d;};'use strict';var _=require(_0x9d25('0x0'));var util=require(_0x9d25('0x1'));var logger=require('../../config/logger')(_0x9d25('0x2'));var moment=require(_0x9d25('0x3'));var BPromise=require(_0x9d25('0x4'));var rp=require(_0x9d25('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d25('0x6'));var config=require(_0x9d25('0x7'));var attributes=require(_0x9d25('0x8'));module['exports']=function(_0x11cee3,_0x2d9897){return _0x11cee3[_0x9d25('0x9')](_0x9d25('0xa'),attributes,{'tableName':_0x9d25('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x9d25('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb5c0=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x1c0316,_0x429ddd){var _0x13c7cd=function(_0x94581c){while(--_0x94581c){_0x1c0316['push'](_0x1c0316['shift']());}};_0x13c7cd(++_0x429ddd);}(_0xb5c0,0xc9));var _0x0b5c=function(_0x56b083,_0x29476f){_0x56b083=_0x56b083-0x0;var _0x1b01e6=_0xb5c0[_0x56b083];return _0x1b01e6;};'use strict';var _=require(_0x0b5c('0x0'));var util=require('util');var logger=require(_0x0b5c('0x1'))(_0x0b5c('0x2'));var moment=require('moment');var BPromise=require(_0x0b5c('0x3'));var rp=require(_0x0b5c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0b5c('0x5'));var attributes=require('./intSalesforceField.attributes');module[_0x0b5c('0x6')]=function(_0x3a1339,_0x56dca8){return _0x3a1339[_0x0b5c('0x7')](_0x0b5c('0x8'),attributes,{'tableName':_0x0b5c('0x9'),'paranoid':![],'indexes':[{'name':_0x0b5c('0xa'),'fields':[_0x0b5c('0xb'),_0x0b5c('0xc')],'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 3946541..52a6db6 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 _0x86a9=['SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x86a9,0x7c));var _0x986a=function(_0x193a9c,_0x4367){_0x193a9c=_0x193a9c-0x0;var _0x51d98e=_0x86a9[_0x193a9c];return _0x51d98e;};'use strict';var _=require(_0x986a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x986a('0x1'));var rs=require(_0x986a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x986a('0x3'))['db'];var utils=require(_0x986a('0x4'));var logger=require(_0x986a('0x5'))(_0x986a('0x6'));var config=require(_0x986a('0x7'));var jayson=require(_0x986a('0x8'));var client=jayson[_0x986a('0x9')][_0x986a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cf6ac,_0x3d06fb,_0x59e97a){return new BPromise(function(_0x5cf842,_0x1df673){return client[_0x986a('0xb')](_0x1cf6ac,_0x59e97a)[_0x986a('0xc')](function(_0x166363){logger[_0x986a('0xd')](_0x986a('0xe'),_0x3d06fb,_0x986a('0xf'));logger['debug'](_0x986a('0x10'),_0x3d06fb,_0x986a('0xf'),JSON[_0x986a('0x11')](_0x166363));if(_0x166363[_0x986a('0x12')]){if(_0x166363[_0x986a('0x12')][_0x986a('0x13')]===0x1f4){logger[_0x986a('0x12')]('SalesforceField,\x20%s,\x20%s',_0x3d06fb,_0x166363[_0x986a('0x12')][_0x986a('0x14')]);return _0x1df673(_0x166363[_0x986a('0x12')][_0x986a('0x14')]);}logger[_0x986a('0x12')](_0x986a('0xe'),_0x3d06fb,_0x166363[_0x986a('0x12')][_0x986a('0x14')]);return _0x5cf842(_0x166363[_0x986a('0x12')][_0x986a('0x14')]);}else{logger[_0x986a('0xd')](_0x986a('0xe'),_0x3d06fb,_0x986a('0xf'));_0x5cf842(_0x166363[_0x986a('0x15')][_0x986a('0x14')]);}})[_0x986a('0x16')](function(_0x41fd09){logger[_0x986a('0x12')]('SalesforceField,\x20%s,\x20%s',_0x3d06fb,_0x41fd09);_0x1df673(_0x41fd09);});});} \ No newline at end of file +var _0x24a5=['../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x158033,_0x2cc7b6){var _0x2abd68=function(_0x5817da){while(--_0x5817da){_0x158033['push'](_0x158033['shift']());}};_0x2abd68(++_0x2cc7b6);}(_0x24a5,0x1ec));var _0x524a=function(_0x226f2b,_0x30cb82){_0x226f2b=_0x226f2b-0x0;var _0x424c14=_0x24a5[_0x226f2b];return _0x424c14;};'use strict';var _=require(_0x524a('0x0'));var util=require(_0x524a('0x1'));var moment=require('moment');var BPromise=require(_0x524a('0x2'));var rs=require(_0x524a('0x3'));var fs=require('fs');var Redis=require(_0x524a('0x4'));var db=require(_0x524a('0x5'))['db'];var utils=require(_0x524a('0x6'));var logger=require(_0x524a('0x7'))('rpc');var config=require(_0x524a('0x8'));var jayson=require(_0x524a('0x9'));var client=jayson[_0x524a('0xa')][_0x524a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18a277,_0x2e669c,_0x4e9259){return new BPromise(function(_0x2fdf1a,_0x5a2ad7){return client[_0x524a('0xc')](_0x18a277,_0x4e9259)[_0x524a('0xd')](function(_0x30a6b0){logger[_0x524a('0xe')](_0x524a('0xf'),_0x2e669c,_0x524a('0x10'));logger[_0x524a('0x11')](_0x524a('0x12'),_0x2e669c,_0x524a('0x10'),JSON[_0x524a('0x13')](_0x30a6b0));if(_0x30a6b0[_0x524a('0x14')]){if(_0x30a6b0[_0x524a('0x14')][_0x524a('0x15')]===0x1f4){logger[_0x524a('0x14')](_0x524a('0xf'),_0x2e669c,_0x30a6b0[_0x524a('0x14')][_0x524a('0x16')]);return _0x5a2ad7(_0x30a6b0[_0x524a('0x14')][_0x524a('0x16')]);}logger[_0x524a('0x14')](_0x524a('0xf'),_0x2e669c,_0x30a6b0[_0x524a('0x14')]['message']);return _0x2fdf1a(_0x30a6b0[_0x524a('0x14')]['message']);}else{logger[_0x524a('0xe')](_0x524a('0xf'),_0x2e669c,_0x524a('0x10'));_0x2fdf1a(_0x30a6b0[_0x524a('0x17')]['message']);}})[_0x524a('0x18')](function(_0x673273){logger[_0x524a('0x14')](_0x524a('0xf'),_0x2e669c,_0x673273);_0x5a2ad7(_0x673273);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 91da7a5..432fa91 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 _0xa0e4=['index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xa0e4,0x1a3));var _0x4a0e=function(_0x3d3817,_0x5d0b91){_0x3d3817=_0x3d3817-0x0;var _0x4f23ce=_0xa0e4[_0x3d3817];return _0x4f23ce;};'use strict';var multer=require(_0x4a0e('0x0'));var util=require(_0x4a0e('0x1'));var path=require(_0x4a0e('0x2'));var timeout=require(_0x4a0e('0x3'));var express=require(_0x4a0e('0x4'));var router=express[_0x4a0e('0x5')]();var fs_extra=require(_0x4a0e('0x6'));var auth=require(_0x4a0e('0x7'));var interaction=require(_0x4a0e('0x8'));var config=require(_0x4a0e('0x9'));var controller=require(_0x4a0e('0xa'));router[_0x4a0e('0xb')]('/',auth[_0x4a0e('0xc')](),controller[_0x4a0e('0xd')]);router[_0x4a0e('0xb')]('/:id',auth[_0x4a0e('0xc')](),controller[_0x4a0e('0xe')]);router[_0x4a0e('0xb')](_0x4a0e('0xf'),auth[_0x4a0e('0xc')](),controller[_0x4a0e('0x10')]);router['get'](_0x4a0e('0x11'),auth[_0x4a0e('0xc')](),controller[_0x4a0e('0x12')]);router[_0x4a0e('0x13')]('/',auth[_0x4a0e('0xc')](),controller[_0x4a0e('0x14')]);router['post'](_0x4a0e('0xf'),auth[_0x4a0e('0xc')](),controller[_0x4a0e('0x15')]);router[_0x4a0e('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x4a0e('0x17')]);router['delete'](_0x4a0e('0x18'),auth[_0x4a0e('0xc')](),controller[_0x4a0e('0x19')]);module[_0x4a0e('0x1a')]=router; \ No newline at end of file +var _0x7b6b=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x533ec3,_0xd62d7d){var _0x28d6d8=function(_0x2ee5db){while(--_0x2ee5db){_0x533ec3['push'](_0x533ec3['shift']());}};_0x28d6d8(++_0xd62d7d);}(_0x7b6b,0xac));var _0xb7b6=function(_0x1b4390,_0x5b6e4c){_0x1b4390=_0x1b4390-0x0;var _0x28df84=_0x7b6b[_0x1b4390];return _0x28df84;};'use strict';var multer=require(_0xb7b6('0x0'));var util=require('util');var path=require(_0xb7b6('0x1'));var timeout=require(_0xb7b6('0x2'));var express=require(_0xb7b6('0x3'));var router=express['Router']();var fs_extra=require(_0xb7b6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb7b6('0x5'));var config=require(_0xb7b6('0x6'));var controller=require(_0xb7b6('0x7'));router[_0xb7b6('0x8')]('/',auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xa')]);router[_0xb7b6('0x8')](_0xb7b6('0xb'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xc')]);router[_0xb7b6('0x8')](_0xb7b6('0xd'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0xe')]);router[_0xb7b6('0x8')](_0xb7b6('0xf'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x10')]);router[_0xb7b6('0x11')]('/',auth[_0xb7b6('0x9')](),controller['create']);router[_0xb7b6('0x11')](_0xb7b6('0xd'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x12')]);router[_0xb7b6('0x13')](_0xb7b6('0xb'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x14')]);router[_0xb7b6('0x15')](_0xb7b6('0xb'),auth[_0xb7b6('0x9')](),controller[_0xb7b6('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b0a1fc0..587bab2 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 _0x1acd=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5704ec,_0x58eae7){var _0x482766=function(_0x2c791a){while(--_0x2c791a){_0x5704ec['push'](_0x5704ec['shift']());}};_0x482766(++_0x58eae7);}(_0x1acd,0x1e1));var _0xd1ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1acd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd1ac('0x0'));module[_0xd1ac('0x1')]={'name':{'type':Sequelize[_0xd1ac('0x2')]},'description':{'type':Sequelize[_0xd1ac('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xd1ac('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd1ac('0x2')]},'remoteUri':{'type':Sequelize[_0xd1ac('0x2')],'unique':_0xd1ac('0x4')},'serverUrl':{'type':Sequelize[_0xd1ac('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6f98=['username','remoteUri','sequelize','STRING'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x6f98,0xae));var _0x86f9=function(_0x36b355,_0xcc6cc1){_0x36b355=_0x36b355-0x0;var _0x533ce3=_0x6f98[_0x36b355];return _0x533ce3;};'use strict';var Sequelize=require(_0x86f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x86f9('0x1')]},'description':{'type':Sequelize[_0x86f9('0x1')]},'username':{'type':Sequelize[_0x86f9('0x1')],'unique':_0x86f9('0x2')},'password':{'type':Sequelize[_0x86f9('0x1')]},'email':{'type':Sequelize[_0x86f9('0x1')]},'remoteUri':{'type':Sequelize[_0x86f9('0x1')],'unique':_0x86f9('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 3845491..db6c43e 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 _0xb3eb=['sys_id','reopened_by','incident_state','urgency','company','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','password','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','username','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getDescriptions','channel','ServicenowField','Descriptions','getFields','made_sla','knowledge','subcategory','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','opened_by','user_input','sys_domain','state','sys_created_by','closed_at','cmdb_ci','impact','active','business_service','priority','rfc','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','work_notes','close_code','work_start','assignment_group','additional_assignee_list','calendar_duration','notify','sys_class_name','close_notes','closed_by'];(function(_0x268cd1,_0x46fe2d){var _0x7066cd=function(_0x21921c){while(--_0x21921c){_0x268cd1['push'](_0x268cd1['shift']());}};_0x7066cd(++_0x46fe2d);}(_0xb3eb,0x19e));var _0xbb3e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3eb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbb3e('0x0'));var rimraf=require(_0xbb3e('0x1'));var zipdir=require(_0xbb3e('0x2'));var jsonpatch=require(_0xbb3e('0x3'));var rp=require('request-promise');var moment=require(_0xbb3e('0x4'));var BPromise=require(_0xbb3e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbb3e('0x6'));var sox=require(_0xbb3e('0x7'));var csv=require(_0xbb3e('0x8'));var ejs=require(_0xbb3e('0x9'));var fs=require('fs');var fs_extra=require(_0xbb3e('0xa'));var _=require('lodash');var squel=require(_0xbb3e('0xb'));var crypto=require(_0xbb3e('0xc'));var jsforce=require(_0xbb3e('0xd'));var deskjs=require(_0xbb3e('0xe'));var toCsv=require(_0xbb3e('0x8'));var querystring=require(_0xbb3e('0xf'));var Papa=require(_0xbb3e('0x10'));var Redis=require(_0xbb3e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbb3e('0x12'));var as=require(_0xbb3e('0x13'));var hardwareService=require(_0xbb3e('0x14'));var logger=require(_0xbb3e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xbb3e('0x16'));var licenseUtil=require(_0xbb3e('0x17'));var db=require(_0xbb3e('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5286d2,_0x5d3e05){_0x5d3e05=_0x5d3e05||0xcc;return function(_0x327866){if(_0x327866){return _0x5286d2[_0xbb3e('0x19')](_0x5d3e05);}return _0x5286d2[_0xbb3e('0x1a')](_0x5d3e05)[_0xbb3e('0x1b')]();};}function respondWithResult(_0x1b9de7,_0x518b1c){_0x518b1c=_0x518b1c||0xc8;return function(_0x31e63f){if(_0x31e63f){return _0x1b9de7['status'](_0x518b1c)[_0xbb3e('0x1c')](_0x31e63f);}};}function respondWithFilteredResult(_0x281be0,_0x32d8f7){return function(_0x4ce1f3){if(_0x4ce1f3){var _0x5b365c=typeof _0x32d8f7[_0xbb3e('0x1d')]===_0xbb3e('0x1e')&&typeof _0x32d8f7[_0xbb3e('0x1f')]===_0xbb3e('0x1e');var _0x54cab6=_0x4ce1f3[_0xbb3e('0x20')];var _0x3f48e3=_0x5b365c?0x0:_0x32d8f7[_0xbb3e('0x1d')];var _0x5b11cd=_0x5b365c?_0x4ce1f3['count']:_0x32d8f7[_0xbb3e('0x1d')]+_0x32d8f7['limit'];var _0x1ac95a;if(_0x5b11cd>=_0x54cab6){_0x5b11cd=_0x54cab6;_0x1ac95a=0xc8;}else{_0x1ac95a=0xce;}_0x281be0[_0xbb3e('0x1a')](_0x1ac95a);return _0x281be0[_0xbb3e('0x21')](_0xbb3e('0x22'),_0x3f48e3+'-'+_0x5b11cd+'/'+_0x54cab6)['json'](_0x4ce1f3);}return null;};}function patchUpdates(_0x31ee62){return function(_0x58f953){try{jsonpatch[_0xbb3e('0x23')](_0x58f953,_0x31ee62,!![]);}catch(_0x29c74f){return BPromise['reject'](_0x29c74f);}return _0x58f953[_0xbb3e('0x24')]();};}function saveUpdates(_0x162b4d,_0x283dea){return function(_0x24cdf2){if(_0x24cdf2){return _0x24cdf2[_0xbb3e('0x25')](_0x162b4d)[_0xbb3e('0x26')](function(_0x207fa4){return _0x207fa4;});}return null;};}function removeEntity(_0x455e2e,_0x13fe37){return function(_0x1420ee){if(_0x1420ee){return _0x1420ee[_0xbb3e('0x27')]()[_0xbb3e('0x26')](function(){_0x455e2e['status'](0xcc)[_0xbb3e('0x1b')]();});}};}function handleEntityNotFound(_0x2fce9f,_0x2e7f8a){return function(_0xffdc07){if(!_0xffdc07){_0x2fce9f[_0xbb3e('0x19')](0x194);}return _0xffdc07;};}function handleError(_0x2aea1b,_0x589d72){_0x589d72=_0x589d72||0x1f4;return function(_0x46724f){logger[_0xbb3e('0x28')](_0x46724f[_0xbb3e('0x29')]);if(_0x46724f[_0xbb3e('0x2a')]){delete _0x46724f[_0xbb3e('0x2a')];}_0x2aea1b[_0xbb3e('0x1a')](_0x589d72)['send'](_0x46724f);};}exports['index']=function(_0x41fb77,_0x11fb9d){var _0x1164b2={},_0x3ee892={},_0x58efba={'count':0x0,'rows':[]};var _0x3c33ce=_[_0xbb3e('0x2b')](db[_0xbb3e('0x2c')][_0xbb3e('0x2d')],function(_0x393a12){return{'name':_0x393a12[_0xbb3e('0x2e')],'type':_0x393a12[_0xbb3e('0x2f')][_0xbb3e('0x30')]};});_0x3ee892[_0xbb3e('0x31')]=_[_0xbb3e('0x2b')](_0x3c33ce,_0xbb3e('0x2a'));_0x3ee892['query']=_[_0xbb3e('0x32')](_0x41fb77['query']);_0x3ee892[_0xbb3e('0x33')]=_[_0xbb3e('0x34')](_0x3ee892[_0xbb3e('0x31')],_0x3ee892[_0xbb3e('0x35')]);_0x1164b2['attributes']=_[_0xbb3e('0x34')](_0x3ee892[_0xbb3e('0x31')],qs[_0xbb3e('0x36')](_0x41fb77[_0xbb3e('0x35')][_0xbb3e('0x36')]));_0x1164b2[_0xbb3e('0x37')]=_0x1164b2[_0xbb3e('0x37')][_0xbb3e('0x38')]?_0x1164b2[_0xbb3e('0x37')]:_0x3ee892[_0xbb3e('0x31')];if(!_0x41fb77['query'][_0xbb3e('0x39')](_0xbb3e('0x3a'))){_0x1164b2[_0xbb3e('0x1f')]=qs[_0xbb3e('0x1f')](_0x41fb77[_0xbb3e('0x35')][_0xbb3e('0x1f')]);_0x1164b2['offset']=qs[_0xbb3e('0x1d')](_0x41fb77[_0xbb3e('0x35')][_0xbb3e('0x1d')]);}_0x1164b2['order']=qs[_0xbb3e('0x3b')](_0x41fb77[_0xbb3e('0x35')][_0xbb3e('0x3b')]);_0x1164b2[_0xbb3e('0x3c')]=qs[_0xbb3e('0x33')](_[_0xbb3e('0x3d')](_0x41fb77[_0xbb3e('0x35')],_0x3ee892[_0xbb3e('0x33')]),_0x3c33ce);if(_0x41fb77[_0xbb3e('0x35')][_0xbb3e('0x3e')]){_0x1164b2[_0xbb3e('0x3c')]=_[_0xbb3e('0x3f')](_0x1164b2[_0xbb3e('0x3c')],{'$or':_[_0xbb3e('0x2b')](_0x3c33ce,function(_0x34bc43){if(_0x34bc43[_0xbb3e('0x2f')]!=='VIRTUAL'){var _0x5a07c3={};_0x5a07c3[_0x34bc43[_0xbb3e('0x2a')]]={'$like':'%'+_0x41fb77[_0xbb3e('0x35')]['filter']+'%'};return _0x5a07c3;}})});}_0x1164b2=_['merge']({},_0x1164b2,_0x41fb77[_0xbb3e('0x40')]);var _0x19b078={'where':_0x1164b2[_0xbb3e('0x3c')]};return db[_0xbb3e('0x2c')]['count'](_0x19b078)[_0xbb3e('0x26')](function(_0x4828fa){_0x58efba[_0xbb3e('0x20')]=_0x4828fa;if(_0x41fb77['query'][_0xbb3e('0x41')]){_0x1164b2[_0xbb3e('0x42')]=[{'all':!![]}];}return db[_0xbb3e('0x2c')][_0xbb3e('0x43')](_0x1164b2);})[_0xbb3e('0x26')](function(_0x3e2e9b){_0x58efba[_0xbb3e('0x44')]=_0x3e2e9b;return _0x58efba;})['then'](respondWithFilteredResult(_0x11fb9d,_0x1164b2))[_0xbb3e('0x45')](handleError(_0x11fb9d,null));};exports[_0xbb3e('0x46')]=function(_0x4516f8,_0x26f67e){var _0x64e822={'raw':![],'where':{'id':_0x4516f8[_0xbb3e('0x47')]['id']}},_0x20eaac={};_0x20eaac[_0xbb3e('0x31')]=_[_0xbb3e('0x32')](db[_0xbb3e('0x2c')][_0xbb3e('0x2d')]);_0x20eaac[_0xbb3e('0x35')]=_[_0xbb3e('0x32')](_0x4516f8[_0xbb3e('0x35')]);_0x20eaac[_0xbb3e('0x33')]=_[_0xbb3e('0x34')](_0x20eaac[_0xbb3e('0x31')],_0x20eaac[_0xbb3e('0x35')]);_0x64e822[_0xbb3e('0x37')]=_[_0xbb3e('0x34')](_0x20eaac[_0xbb3e('0x31')],qs[_0xbb3e('0x36')](_0x4516f8['query'][_0xbb3e('0x36')]));_0x64e822[_0xbb3e('0x37')]=_0x64e822[_0xbb3e('0x37')][_0xbb3e('0x38')]?_0x64e822['attributes']:_0x20eaac[_0xbb3e('0x31')];if(_0x4516f8[_0xbb3e('0x35')][_0xbb3e('0x41')]){_0x64e822[_0xbb3e('0x42')]=[{'all':!![]}];}_0x64e822=_[_0xbb3e('0x3f')]({},_0x64e822,_0x4516f8[_0xbb3e('0x40')]);return db['ServicenowAccount'][_0xbb3e('0x48')](_0x64e822)['then'](handleEntityNotFound(_0x26f67e,null))[_0xbb3e('0x26')](respondWithResult(_0x26f67e,null))[_0xbb3e('0x45')](handleError(_0x26f67e,null));};exports[_0xbb3e('0x49')]=function(_0x565a61,_0x5dafc2){return db[_0xbb3e('0x2c')]['create'](_0x565a61[_0xbb3e('0x4a')],{})[_0xbb3e('0x26')](respondWithResult(_0x5dafc2,0xc9))['catch'](handleError(_0x5dafc2,null));};exports[_0xbb3e('0x25')]=function(_0x2c0e68,_0x21775d){if(_0x2c0e68[_0xbb3e('0x4a')]['id']){delete _0x2c0e68[_0xbb3e('0x4a')]['id'];}return db['ServicenowAccount'][_0xbb3e('0x48')]({'where':{'id':_0x2c0e68[_0xbb3e('0x47')]['id']}})[_0xbb3e('0x26')](handleEntityNotFound(_0x21775d,null))['then'](saveUpdates(_0x2c0e68[_0xbb3e('0x4a')],null))[_0xbb3e('0x26')](respondWithResult(_0x21775d,null))[_0xbb3e('0x45')](handleError(_0x21775d,null));};exports[_0xbb3e('0x27')]=function(_0x490e4f,_0xae5761){return db[_0xbb3e('0x2c')][_0xbb3e('0x48')]({'where':{'id':_0x490e4f['params']['id']}})[_0xbb3e('0x26')](handleEntityNotFound(_0xae5761,null))[_0xbb3e('0x26')](removeEntity(_0xae5761,null))[_0xbb3e('0x45')](handleError(_0xae5761,null));};exports['getConfigurations']=function(_0x3e1439,_0x547f33,_0x1daaca){var _0x17c5a2={};var _0x5cef8f={};var _0x99df10;var _0x118d27;return db[_0xbb3e('0x2c')][_0xbb3e('0x4b')]({'where':{'id':_0x3e1439[_0xbb3e('0x47')]['id']}})[_0xbb3e('0x26')](handleEntityNotFound(_0x547f33,null))[_0xbb3e('0x26')](function(_0x5326bf){if(_0x5326bf){_0x99df10=_0x5326bf;_0x5cef8f[_0xbb3e('0x31')]=_[_0xbb3e('0x32')](db[_0xbb3e('0x4c')][_0xbb3e('0x2d')]);_0x5cef8f[_0xbb3e('0x35')]=_[_0xbb3e('0x32')](_0x3e1439[_0xbb3e('0x35')]);_0x5cef8f['filters']=_[_0xbb3e('0x34')](_0x5cef8f['model'],_0x5cef8f['query']);_0x17c5a2['attributes']=_[_0xbb3e('0x34')](_0x5cef8f[_0xbb3e('0x31')],qs[_0xbb3e('0x36')](_0x3e1439[_0xbb3e('0x35')][_0xbb3e('0x36')]));_0x17c5a2[_0xbb3e('0x37')]=_0x17c5a2[_0xbb3e('0x37')][_0xbb3e('0x38')]?_0x17c5a2[_0xbb3e('0x37')]:_0x5cef8f[_0xbb3e('0x31')];_0x17c5a2['order']=qs[_0xbb3e('0x3b')](_0x3e1439[_0xbb3e('0x35')][_0xbb3e('0x3b')]);_0x17c5a2[_0xbb3e('0x3c')]=qs[_0xbb3e('0x33')](_[_0xbb3e('0x3d')](_0x3e1439['query'],_0x5cef8f[_0xbb3e('0x33')]));if(_0x3e1439[_0xbb3e('0x35')][_0xbb3e('0x3e')]){_0x17c5a2[_0xbb3e('0x3c')]=_[_0xbb3e('0x3f')](_0x17c5a2[_0xbb3e('0x3c')],{'$or':_[_0xbb3e('0x2b')](_0x17c5a2[_0xbb3e('0x37')],function(_0x2ce846){var _0xd79534={};_0xd79534[_0x2ce846]={'$like':'%'+_0x3e1439['query'][_0xbb3e('0x3e')]+'%'};return _0xd79534;})});}_0x17c5a2=_[_0xbb3e('0x3f')]({},_0x17c5a2,_0x3e1439[_0xbb3e('0x40')]);return _0x99df10[_0xbb3e('0x4d')](_0x17c5a2);}})['then'](function(_0x2aa789){if(_0x2aa789){_0x118d27=_0x2aa789['length'];if(!_0x3e1439[_0xbb3e('0x35')]['hasOwnProperty'](_0xbb3e('0x3a'))){_0x17c5a2['limit']=qs[_0xbb3e('0x1f')](_0x3e1439[_0xbb3e('0x35')][_0xbb3e('0x1f')]);_0x17c5a2[_0xbb3e('0x1d')]=qs[_0xbb3e('0x1d')](_0x3e1439[_0xbb3e('0x35')]['offset']);}return _0x99df10[_0xbb3e('0x4d')](_0x17c5a2);}})[_0xbb3e('0x26')](function(_0x11b00a){if(_0x11b00a){return _0x11b00a?{'count':_0x118d27,'rows':_0x11b00a}:null;}})[_0xbb3e('0x26')](respondWithResult(_0x547f33,null))[_0xbb3e('0x45')](handleError(_0x547f33,null));};exports[_0xbb3e('0x4e')]=function(_0x11fc76,_0x51850e,_0x5d349a){if(_0x11fc76[_0xbb3e('0x4a')]['id']){delete _0x11fc76[_0xbb3e('0x4a')]['id'];}return db[_0xbb3e('0x2c')]['findOne']({'where':{'id':_0x11fc76['params']['id']}})[_0xbb3e('0x26')](handleEntityNotFound(_0x51850e,null))[_0xbb3e('0x26')](function(_0x5ee9ce){if(_0x5ee9ce){_0x11fc76['body'][_0xbb3e('0x4f')]=_0x5ee9ce['id'];_0x11fc76[_0xbb3e('0x4a')][_0xbb3e('0x50')]=integrations['getSubjects'](_0x11fc76[_0xbb3e('0x4a')]['channel'],_0x11fc76['body'][_0xbb3e('0x2f')]);_0x11fc76['body']['Descriptions']=integrations[_0xbb3e('0x51')](_0x11fc76[_0xbb3e('0x4a')][_0xbb3e('0x52')],_0x11fc76[_0xbb3e('0x4a')][_0xbb3e('0x2f')]);return db[_0xbb3e('0x4c')][_0xbb3e('0x49')](_0x11fc76[_0xbb3e('0x4a')],{'include':[{'model':db['ServicenowField'],'as':_0xbb3e('0x50')},{'model':db[_0xbb3e('0x53')],'as':_0xbb3e('0x54')}]});}return null;})[_0xbb3e('0x26')](respondWithResult(_0x51850e,null))[_0xbb3e('0x45')](handleError(_0x51850e,null));};exports[_0xbb3e('0x55')]=function(_0x57a642,_0x14f5e6,_0xd13ed9){var _0x17e0f6=[_0xbb3e('0x56'),'hold_reason',_0xbb3e('0x57'),_0xbb3e('0x58'),'close_code','notify','incident_state',_0xbb3e('0x59'),_0xbb3e('0x5a')];var _0xb849f9=[_0xbb3e('0x5b'),_0xbb3e('0x56'),_0xbb3e('0x5c'),'watch_list',_0xbb3e('0x5d'),_0xbb3e('0x5e'),_0xbb3e('0x5f'),_0xbb3e('0x60'),_0xbb3e('0x61'),_0xbb3e('0x62'),'resolved_by','sys_updated_by',_0xbb3e('0x63'),_0xbb3e('0x64'),'sys_created_on',_0xbb3e('0x65'),_0xbb3e('0x66'),_0xbb3e('0x67'),_0xbb3e('0x57'),'order','calendar_stc',_0xbb3e('0x68'),_0xbb3e('0x69'),'delivery_plan',_0xbb3e('0x6a'),_0xbb3e('0x6b'),'work_notes_list',_0xbb3e('0x6c'),_0xbb3e('0x6d'),'sys_domain_path',_0xbb3e('0x6e'),'time_worked',_0xbb3e('0x6f'),_0xbb3e('0x70'),_0xbb3e('0x71'),_0xbb3e('0x72'),_0xbb3e('0x73'),_0xbb3e('0x74'),'resolved_at',_0xbb3e('0x75'),_0xbb3e('0x76'),_0xbb3e('0x58'),_0xbb3e('0x77'),'short_description',_0xbb3e('0x78'),'correlation_display','delivery_task',_0xbb3e('0x79'),_0xbb3e('0x7a'),'business_stc',_0xbb3e('0x7b'),'description',_0xbb3e('0x7c'),_0xbb3e('0x7d'),_0xbb3e('0x7e'),_0xbb3e('0x7f'),_0xbb3e('0x80'),'follow_up','parent_incident',_0xbb3e('0x81'),'contact_type',_0xbb3e('0x82'),_0xbb3e('0x83'),_0xbb3e('0x84'),'problem_id',_0xbb3e('0x85'),'reassignment_count',_0xbb3e('0x86'),_0xbb3e('0x87'),'severity','comments',_0xbb3e('0x88'),_0xbb3e('0x89'),_0xbb3e('0x8a'),_0xbb3e('0x8b'),_0xbb3e('0x8c'),'reopen_count',_0xbb3e('0x8d'),_0xbb3e('0x8e'),_0xbb3e('0x8f'),_0xbb3e('0x90'),_0xbb3e('0x91'),_0xbb3e('0x5a')];var _0x1ceccf='';var _0x49516e='';var _0x2c5d0b=[];var _0xfcdecf='';var _0x26bb08='';var _0x457c93=[];var _0x36c152='';var _0x178a36='';var _0x324aaf={};var _0x4fd5f3='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x57a642[_0xbb3e('0x47')]['id']},'attributes':['id','username',_0xbb3e('0x92'),'email','remoteUri',_0xbb3e('0x93')]})[_0xbb3e('0x26')](handleEntityNotFound(_0x14f5e6,null))[_0xbb3e('0x26')](function(_0x121a6f){if(_0x121a6f){_0x4fd5f3=_0x121a6f[_0xbb3e('0x94')];var _0x4c1aa4=_0x4fd5f3[_0xbb3e('0x95')](-0x1);if(_0x4c1aa4==='/'){_0x4fd5f3=_0x4fd5f3[_0xbb3e('0x96')](0x0,_0x4fd5f3[_0xbb3e('0x97')](_0x4c1aa4));}_0x178a36=util[_0xbb3e('0x98')](_0xbb3e('0x99'),_0x4fd5f3);_0x36c152=util[_0xbb3e('0x98')]('%s/api/now/table/',_0x4fd5f3);_0x324aaf={'user':_0x121a6f[_0xbb3e('0x9a')],'pass':_0x121a6f['password']};var _0x1a5ef9={'method':'GET','uri':_0x178a36+_0xbb3e('0x9b'),'auth':_0x324aaf,'json':!![]};return rp(_0x1a5ef9);}})[_0xbb3e('0x26')](function(_0x3c22aa){if(_0x3c22aa[_0xbb3e('0x9c')][_0xbb3e('0x38')]>0x0){_0x1ceccf=_0x3c22aa['result'];}console[_0xbb3e('0x9d')](_0xbb3e('0x9e'),_0x1ceccf);_0x457c93=[];_0x49516e=Object[_0xbb3e('0x9f')]([],_0x1ceccf);_[_0xbb3e('0xa0')](_0x49516e,function(_0x57f20d){return!_0x17e0f6[_0xbb3e('0xa1')](_0x57f20d[_0xbb3e('0x2a')]);});_0x49516e[_0xbb3e('0xa2')](function(_0x287fdd){var _0x69a31c=createFieldObject(_0x36c152,_0x324aaf,_0x287fdd[_0xbb3e('0xa3')],_0x287fdd[_0xbb3e('0x2a')],_0x287fdd[_0xbb3e('0xa4')],![]);_0x457c93[_0xbb3e('0xa5')](_0x69a31c);});return Promise[_0xbb3e('0xa6')](_0x457c93);})[_0xbb3e('0x26')](function(_0x4c2236){_0x2c5d0b=_0x4c2236;_0xfcdecf=Object[_0xbb3e('0x9f')]([],_0x1ceccf);console[_0xbb3e('0x9d')](_0xbb3e('0xa7'),_0x1ceccf);_['remove'](_0xfcdecf,function(_0x50433f){return _0xb849f9[_0xbb3e('0xa1')](_0x50433f[_0xbb3e('0x2a')]);});console['log'](_0xbb3e('0xa8'),_0xfcdecf);_0x457c93=[];_0xfcdecf[_0xbb3e('0xa2')](function(_0xebf9fd){var _0x805d3a=createFieldObject(_0x36c152,_0x324aaf,_0xebf9fd[_0xbb3e('0xa3')],_0xebf9fd[_0xbb3e('0x2a')],_0xebf9fd[_0xbb3e('0xa4')],!![]);_0x457c93[_0xbb3e('0xa5')](_0x805d3a);});return Promise['all'](_0x457c93);})['then'](function(_0x1c1054){_0x26bb08=_0x1c1054;var _0x4f8212=_0x2c5d0b[_0xbb3e('0xa9')](_0x26bb08);return{'count':_0x4f8212[_0xbb3e('0x38')],'rows':_0x4f8212};})[_0xbb3e('0x26')](respondWithResult(_0x14f5e6,null))[_0xbb3e('0x45')](function(_0x21721b){console[_0xbb3e('0x9d')](_0xbb3e('0xaa')+_0x21721b);var _0x46133a=_0x57a642['query'][_0xbb3e('0xab')]?0x1f4:_0x21721b['statusCode']||0x1f4;logger[_0xbb3e('0x28')](_0x21721b[_0xbb3e('0x29')]);delete _0x21721b[_0xbb3e('0x2a')];if(_0x46133a===0x191){_0x46133a=0x190;}_0x14f5e6[_0xbb3e('0x1a')](_0x46133a)['send'](_0x57a642[_0xbb3e('0x35')][_0xbb3e('0xab')]?{'message':'Wrong\x20credentials','statusCode':_0x21721b[_0xbb3e('0xac')]}:_0x21721b);});};function createFieldObject(_0x4f7358,_0x4bd451,_0x2ec4a7,_0x2a2c2b,_0x13c327,_0x14843d){return new Promise(function(_0x5679fb,_0x25a6a2){var _0x57eae2={'id':_0x2a2c2b,'name':_0x13c327,'custom':_0x14843d};if(_0x2ec4a7===_0xbb3e('0xad')){_0x57eae2[_0xbb3e('0x40')]=[{'name':_0xbb3e('0xae'),'value':_0xbb3e('0xaf')},{'name':_0xbb3e('0xb0'),'value':_0xbb3e('0xb1')}];_0x5679fb(_0x57eae2);}else{var _0x76e85e={'method':_0xbb3e('0xb2'),'uri':_0x4f7358+_0xbb3e('0xb3')+_0x2a2c2b,'auth':_0x4bd451,'json':!![]};return rp(_0x76e85e)['then'](function(_0x277673){var _0x561557=[];if(_0x277673[_0xbb3e('0x9c')]['length']>0x0){_0x277673[_0xbb3e('0x9c')][_0xbb3e('0xa2')](function(_0x57882b){if(_0x57882b[_0xbb3e('0xb4')]==='false'){var _0x5823b0={'name':_0x57882b[_0xbb3e('0xa4')],'value':_0x57882b['value']};_0x561557[_0xbb3e('0xa5')](_0x5823b0);}});}_0x57eae2[_0xbb3e('0x40')]=_0x561557;if(_0x57eae2[_0xbb3e('0x40')][_0xbb3e('0x38')]>0x0){_0x5679fb(_0x57eae2);}else{if(_0x14843d==![]){_0x5679fb();}else{_0x5679fb(_0x57eae2);}}});}});} \ No newline at end of file +var _0x40de=['findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','incident_state','severity','category','parent','upon_reject','hold_reason','approval_history','resolved_by','sys_updated_by','opened_by','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','opened_at','group_list','work_end','reopened_time','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','notify','sys_class_name','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','remove','includes','forEach','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','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','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','count','limit','set','apply','then','destroy','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','getConfigurations','sort','options'];(function(_0x569b67,_0x363d9e){var _0x50f6a8=function(_0x4b4940){while(--_0x4b4940){_0x569b67['push'](_0x569b67['shift']());}};_0x50f6a8(++_0x363d9e);}(_0x40de,0x6a));var _0xe40d=function(_0x1613d9,_0x2f583e){_0x1613d9=_0x1613d9-0x0;var _0x1ab5e0=_0x40de[_0x1613d9];return _0x1ab5e0;};'use strict';var emlformat=require(_0xe40d('0x0'));var rimraf=require(_0xe40d('0x1'));var zipdir=require(_0xe40d('0x2'));var jsonpatch=require(_0xe40d('0x3'));var rp=require(_0xe40d('0x4'));var moment=require(_0xe40d('0x5'));var BPromise=require(_0xe40d('0x6'));var Mustache=require(_0xe40d('0x7'));var util=require(_0xe40d('0x8'));var path=require(_0xe40d('0x9'));var sox=require(_0xe40d('0xa'));var csv=require('to-csv');var ejs=require(_0xe40d('0xb'));var fs=require('fs');var fs_extra=require(_0xe40d('0xc'));var _=require(_0xe40d('0xd'));var squel=require(_0xe40d('0xe'));var crypto=require(_0xe40d('0xf'));var jsforce=require(_0xe40d('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe40d('0x11'));var Papa=require(_0xe40d('0x12'));var Redis=require(_0xe40d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe40d('0x14'));var as=require(_0xe40d('0x15'));var hardwareService=require(_0xe40d('0x16'));var logger=require(_0xe40d('0x17'))('api');var utils=require(_0xe40d('0x18'));var config=require(_0xe40d('0x19'));var licenseUtil=require(_0xe40d('0x1a'));var db=require(_0xe40d('0x1b'))['db'];var integrations=require(_0xe40d('0x1c'));function respondWithStatusCode(_0x5e2739,_0x2901fb){_0x2901fb=_0x2901fb||0xcc;return function(_0x5619a3){if(_0x5619a3){return _0x5e2739[_0xe40d('0x1d')](_0x2901fb);}return _0x5e2739[_0xe40d('0x1e')](_0x2901fb)[_0xe40d('0x1f')]();};}function respondWithResult(_0x3f05a8,_0xf683a9){_0xf683a9=_0xf683a9||0xc8;return function(_0x348fa9){if(_0x348fa9){return _0x3f05a8['status'](_0xf683a9)[_0xe40d('0x20')](_0x348fa9);}};}function respondWithFilteredResult(_0x5d62b4,_0x2363f9){return function(_0x53e0b1){if(_0x53e0b1){var _0x475303=typeof _0x2363f9[_0xe40d('0x21')]==='undefined'&&typeof _0x2363f9['limit']==='undefined';var _0x3f98e8=_0x53e0b1[_0xe40d('0x22')];var _0x5a74b3=_0x475303?0x0:_0x2363f9[_0xe40d('0x21')];var _0x582d47=_0x475303?_0x53e0b1[_0xe40d('0x22')]:_0x2363f9[_0xe40d('0x21')]+_0x2363f9[_0xe40d('0x23')];var _0x44bf62;if(_0x582d47>=_0x3f98e8){_0x582d47=_0x3f98e8;_0x44bf62=0xc8;}else{_0x44bf62=0xce;}_0x5d62b4[_0xe40d('0x1e')](_0x44bf62);return _0x5d62b4[_0xe40d('0x24')]('Content-Range',_0x5a74b3+'-'+_0x582d47+'/'+_0x3f98e8)[_0xe40d('0x20')](_0x53e0b1);}return null;};}function patchUpdates(_0x41bfe4){return function(_0x4df78f){try{jsonpatch[_0xe40d('0x25')](_0x4df78f,_0x41bfe4,!![]);}catch(_0x1c7d6c){return BPromise['reject'](_0x1c7d6c);}return _0x4df78f['save']();};}function saveUpdates(_0x41b3e7,_0x5c27e5){return function(_0xf515bc){if(_0xf515bc){return _0xf515bc['update'](_0x41b3e7)[_0xe40d('0x26')](function(_0x182a52){return _0x182a52;});}return null;};}function removeEntity(_0x5d3ffc,_0x2dfb5d){return function(_0x573796){if(_0x573796){return _0x573796[_0xe40d('0x27')]()[_0xe40d('0x26')](function(){_0x5d3ffc[_0xe40d('0x1e')](0xcc)[_0xe40d('0x1f')]();});}};}function handleEntityNotFound(_0xca6e7a,_0x3c16cc){return function(_0x1bc15e){if(!_0x1bc15e){_0xca6e7a[_0xe40d('0x1d')](0x194);}return _0x1bc15e;};}function handleError(_0x22adcd,_0x30995e){_0x30995e=_0x30995e||0x1f4;return function(_0x58458b){logger['error'](_0x58458b[_0xe40d('0x28')]);if(_0x58458b[_0xe40d('0x29')]){delete _0x58458b['name'];}_0x22adcd[_0xe40d('0x1e')](_0x30995e)[_0xe40d('0x2a')](_0x58458b);};}exports[_0xe40d('0x2b')]=function(_0x36c736,_0x4a5324){var _0x146285={},_0x1d1970={},_0x1b5e02={'count':0x0,'rows':[]};var _0x25c89e=_['map'](db[_0xe40d('0x2c')][_0xe40d('0x2d')],function(_0x85c2e9){return{'name':_0x85c2e9[_0xe40d('0x2e')],'type':_0x85c2e9[_0xe40d('0x2f')][_0xe40d('0x30')]};});_0x1d1970[_0xe40d('0x31')]=_[_0xe40d('0x32')](_0x25c89e,_0xe40d('0x29'));_0x1d1970[_0xe40d('0x33')]=_[_0xe40d('0x34')](_0x36c736[_0xe40d('0x33')]);_0x1d1970[_0xe40d('0x35')]=_[_0xe40d('0x36')](_0x1d1970[_0xe40d('0x31')],_0x1d1970['query']);_0x146285[_0xe40d('0x37')]=_[_0xe40d('0x36')](_0x1d1970[_0xe40d('0x31')],qs[_0xe40d('0x38')](_0x36c736[_0xe40d('0x33')]['fields']));_0x146285[_0xe40d('0x37')]=_0x146285[_0xe40d('0x37')][_0xe40d('0x39')]?_0x146285[_0xe40d('0x37')]:_0x1d1970[_0xe40d('0x31')];if(!_0x36c736[_0xe40d('0x33')][_0xe40d('0x3a')](_0xe40d('0x3b'))){_0x146285[_0xe40d('0x23')]=qs['limit'](_0x36c736[_0xe40d('0x33')]['limit']);_0x146285[_0xe40d('0x21')]=qs[_0xe40d('0x21')](_0x36c736[_0xe40d('0x33')][_0xe40d('0x21')]);}_0x146285[_0xe40d('0x3c')]=qs['sort'](_0x36c736[_0xe40d('0x33')]['sort']);_0x146285[_0xe40d('0x3d')]=qs[_0xe40d('0x35')](_[_0xe40d('0x3e')](_0x36c736[_0xe40d('0x33')],_0x1d1970[_0xe40d('0x35')]),_0x25c89e);if(_0x36c736[_0xe40d('0x33')][_0xe40d('0x3f')]){_0x146285[_0xe40d('0x3d')]=_['merge'](_0x146285['where'],{'$or':_[_0xe40d('0x32')](_0x25c89e,function(_0x2d11f4){if(_0x2d11f4[_0xe40d('0x2f')]!==_0xe40d('0x40')){var _0x3b17d5={};_0x3b17d5[_0x2d11f4['name']]={'$like':'%'+_0x36c736[_0xe40d('0x33')][_0xe40d('0x3f')]+'%'};return _0x3b17d5;}})});}_0x146285=_[_0xe40d('0x41')]({},_0x146285,_0x36c736['options']);var _0x3965bf={'where':_0x146285[_0xe40d('0x3d')]};return db[_0xe40d('0x2c')][_0xe40d('0x22')](_0x3965bf)[_0xe40d('0x26')](function(_0x3b551c){_0x1b5e02[_0xe40d('0x22')]=_0x3b551c;if(_0x36c736[_0xe40d('0x33')]['includeAll']){_0x146285[_0xe40d('0x42')]=[{'all':!![]}];}return db[_0xe40d('0x2c')][_0xe40d('0x43')](_0x146285);})[_0xe40d('0x26')](function(_0x67007e){_0x1b5e02[_0xe40d('0x44')]=_0x67007e;return _0x1b5e02;})['then'](respondWithFilteredResult(_0x4a5324,_0x146285))[_0xe40d('0x45')](handleError(_0x4a5324,null));};exports[_0xe40d('0x46')]=function(_0x3bcbfd,_0x1be029){var _0x5e5601={'raw':![],'where':{'id':_0x3bcbfd['params']['id']}},_0x46d177={};_0x46d177[_0xe40d('0x31')]=_[_0xe40d('0x34')](db[_0xe40d('0x2c')][_0xe40d('0x2d')]);_0x46d177[_0xe40d('0x33')]=_[_0xe40d('0x34')](_0x3bcbfd['query']);_0x46d177[_0xe40d('0x35')]=_[_0xe40d('0x36')](_0x46d177['model'],_0x46d177['query']);_0x5e5601[_0xe40d('0x37')]=_[_0xe40d('0x36')](_0x46d177[_0xe40d('0x31')],qs[_0xe40d('0x38')](_0x3bcbfd[_0xe40d('0x33')][_0xe40d('0x38')]));_0x5e5601[_0xe40d('0x37')]=_0x5e5601[_0xe40d('0x37')][_0xe40d('0x39')]?_0x5e5601[_0xe40d('0x37')]:_0x46d177[_0xe40d('0x31')];if(_0x3bcbfd[_0xe40d('0x33')][_0xe40d('0x47')]){_0x5e5601['include']=[{'all':!![]}];}_0x5e5601=_[_0xe40d('0x41')]({},_0x5e5601,_0x3bcbfd['options']);return db['ServicenowAccount'][_0xe40d('0x48')](_0x5e5601)[_0xe40d('0x26')](handleEntityNotFound(_0x1be029,null))['then'](respondWithResult(_0x1be029,null))[_0xe40d('0x45')](handleError(_0x1be029,null));};exports[_0xe40d('0x49')]=function(_0x59dff7,_0x15f77a){return db[_0xe40d('0x2c')][_0xe40d('0x49')](_0x59dff7[_0xe40d('0x4a')],{})['then'](respondWithResult(_0x15f77a,0xc9))[_0xe40d('0x45')](handleError(_0x15f77a,null));};exports[_0xe40d('0x4b')]=function(_0x25d527,_0x42b5cd){if(_0x25d527[_0xe40d('0x4a')]['id']){delete _0x25d527[_0xe40d('0x4a')]['id'];}return db[_0xe40d('0x2c')][_0xe40d('0x48')]({'where':{'id':_0x25d527[_0xe40d('0x4c')]['id']}})[_0xe40d('0x26')](handleEntityNotFound(_0x42b5cd,null))[_0xe40d('0x26')](saveUpdates(_0x25d527[_0xe40d('0x4a')],null))['then'](respondWithResult(_0x42b5cd,null))[_0xe40d('0x45')](handleError(_0x42b5cd,null));};exports[_0xe40d('0x27')]=function(_0x1ba9a6,_0xa952e0){return db[_0xe40d('0x2c')][_0xe40d('0x48')]({'where':{'id':_0x1ba9a6[_0xe40d('0x4c')]['id']}})[_0xe40d('0x26')](handleEntityNotFound(_0xa952e0,null))[_0xe40d('0x26')](removeEntity(_0xa952e0,null))['catch'](handleError(_0xa952e0,null));};exports[_0xe40d('0x4d')]=function(_0x48cd61,_0x1f52f1,_0x3e3cc1){var _0x2b7ccc={};var _0x41eda0={};var _0x2e4490;var _0xc6b592;return db[_0xe40d('0x2c')]['findOne']({'where':{'id':_0x48cd61[_0xe40d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f52f1,null))[_0xe40d('0x26')](function(_0x585b77){if(_0x585b77){_0x2e4490=_0x585b77;_0x41eda0[_0xe40d('0x31')]=_[_0xe40d('0x34')](db['ServicenowConfiguration']['rawAttributes']);_0x41eda0[_0xe40d('0x33')]=_[_0xe40d('0x34')](_0x48cd61[_0xe40d('0x33')]);_0x41eda0[_0xe40d('0x35')]=_[_0xe40d('0x36')](_0x41eda0[_0xe40d('0x31')],_0x41eda0[_0xe40d('0x33')]);_0x2b7ccc[_0xe40d('0x37')]=_[_0xe40d('0x36')](_0x41eda0[_0xe40d('0x31')],qs[_0xe40d('0x38')](_0x48cd61[_0xe40d('0x33')][_0xe40d('0x38')]));_0x2b7ccc[_0xe40d('0x37')]=_0x2b7ccc['attributes'][_0xe40d('0x39')]?_0x2b7ccc[_0xe40d('0x37')]:_0x41eda0[_0xe40d('0x31')];_0x2b7ccc[_0xe40d('0x3c')]=qs[_0xe40d('0x4e')](_0x48cd61[_0xe40d('0x33')][_0xe40d('0x4e')]);_0x2b7ccc[_0xe40d('0x3d')]=qs[_0xe40d('0x35')](_[_0xe40d('0x3e')](_0x48cd61[_0xe40d('0x33')],_0x41eda0['filters']));if(_0x48cd61[_0xe40d('0x33')][_0xe40d('0x3f')]){_0x2b7ccc[_0xe40d('0x3d')]=_[_0xe40d('0x41')](_0x2b7ccc['where'],{'$or':_[_0xe40d('0x32')](_0x2b7ccc[_0xe40d('0x37')],function(_0x45e2db){var _0x1891fa={};_0x1891fa[_0x45e2db]={'$like':'%'+_0x48cd61['query']['filter']+'%'};return _0x1891fa;})});}_0x2b7ccc=_[_0xe40d('0x41')]({},_0x2b7ccc,_0x48cd61[_0xe40d('0x4f')]);return _0x2e4490['getConfigurations'](_0x2b7ccc);}})['then'](function(_0x157a88){if(_0x157a88){_0xc6b592=_0x157a88[_0xe40d('0x39')];if(!_0x48cd61[_0xe40d('0x33')]['hasOwnProperty'](_0xe40d('0x3b'))){_0x2b7ccc['limit']=qs['limit'](_0x48cd61['query'][_0xe40d('0x23')]);_0x2b7ccc['offset']=qs[_0xe40d('0x21')](_0x48cd61[_0xe40d('0x33')]['offset']);}return _0x2e4490[_0xe40d('0x4d')](_0x2b7ccc);}})['then'](function(_0x4fc649){if(_0x4fc649){return _0x4fc649?{'count':_0xc6b592,'rows':_0x4fc649}:null;}})['then'](respondWithResult(_0x1f52f1,null))[_0xe40d('0x45')](handleError(_0x1f52f1,null));};exports['addConfiguration']=function(_0x47bda0,_0x57c0a2,_0x202364){if(_0x47bda0['body']['id']){delete _0x47bda0[_0xe40d('0x4a')]['id'];}return db[_0xe40d('0x2c')][_0xe40d('0x50')]({'where':{'id':_0x47bda0[_0xe40d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57c0a2,null))['then'](function(_0x42c86b){if(_0x42c86b){_0x47bda0[_0xe40d('0x4a')][_0xe40d('0x51')]=_0x42c86b['id'];_0x47bda0[_0xe40d('0x4a')][_0xe40d('0x52')]=integrations['getSubjects'](_0x47bda0[_0xe40d('0x4a')]['channel'],_0x47bda0['body'][_0xe40d('0x2f')]);_0x47bda0[_0xe40d('0x4a')][_0xe40d('0x53')]=integrations[_0xe40d('0x54')](_0x47bda0[_0xe40d('0x4a')][_0xe40d('0x55')],_0x47bda0['body'][_0xe40d('0x2f')]);return db['ServicenowConfiguration'][_0xe40d('0x49')](_0x47bda0[_0xe40d('0x4a')],{'include':[{'model':db[_0xe40d('0x56')],'as':_0xe40d('0x52')},{'model':db[_0xe40d('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x57c0a2,null))[_0xe40d('0x45')](handleError(_0x57c0a2,null));};exports[_0xe40d('0x57')]=function(_0x353cb6,_0x482a60,_0x2015a7){var _0x51f964=[_0xe40d('0x58'),'hold_reason',_0xe40d('0x59'),_0xe40d('0x5a'),_0xe40d('0x5b'),'notify',_0xe40d('0x5c'),_0xe40d('0x5d'),_0xe40d('0x5e')];var _0x3abb2d=[_0xe40d('0x5f'),'made_sla','caused_by','watch_list',_0xe40d('0x60'),'sys_updated_on','child_incidents',_0xe40d('0x61'),_0xe40d('0x62'),'number',_0xe40d('0x63'),_0xe40d('0x64'),_0xe40d('0x65'),'user_input',_0xe40d('0x66'),'sys_domain',_0xe40d('0x67'),_0xe40d('0x68'),_0xe40d('0x59'),_0xe40d('0x3c'),_0xe40d('0x69'),_0xe40d('0x6a'),_0xe40d('0x6b'),_0xe40d('0x6c'),_0xe40d('0x6d'),_0xe40d('0x6e'),_0xe40d('0x6f'),_0xe40d('0x70'),_0xe40d('0x71'),'sys_domain_path',_0xe40d('0x72'),_0xe40d('0x73'),'expected_start',_0xe40d('0x74'),'business_duration',_0xe40d('0x75'),_0xe40d('0x76'),_0xe40d('0x77'),'resolved_at',_0xe40d('0x78'),_0xe40d('0x79'),_0xe40d('0x5a'),'work_notes',_0xe40d('0x7a'),_0xe40d('0x5b'),_0xe40d('0x7b'),_0xe40d('0x7c'),_0xe40d('0x7d'),_0xe40d('0x7e'),_0xe40d('0x7f'),_0xe40d('0x80'),'description',_0xe40d('0x81'),_0xe40d('0x82'),_0xe40d('0x83'),'close_notes',_0xe40d('0x84'),_0xe40d('0x85'),'parent_incident',_0xe40d('0x86'),_0xe40d('0x87'),_0xe40d('0x88'),_0xe40d('0x5c'),_0xe40d('0x89'),_0xe40d('0x8a'),'company','reassignment_count','activity_due',_0xe40d('0x8b'),_0xe40d('0x5d'),_0xe40d('0x8c'),_0xe40d('0x8d'),_0xe40d('0x8e'),_0xe40d('0x8f'),_0xe40d('0x90'),_0xe40d('0x91'),'reopen_count',_0xe40d('0x92'),'escalation',_0xe40d('0x93'),_0xe40d('0x94'),_0xe40d('0x95'),_0xe40d('0x5e')];var _0xf8dda2='';var _0x4b3060='';var _0x3a5dc=[];var _0x15c512='';var _0x4f7109='';var _0x382aa1=[];var _0x41626c='';var _0x309abb='';var _0x2677cf={};var _0x37c66c='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x353cb6[_0xe40d('0x4c')]['id']},'attributes':['id',_0xe40d('0x96'),_0xe40d('0x97'),_0xe40d('0x98'),_0xe40d('0x99'),_0xe40d('0x9a')]})[_0xe40d('0x26')](handleEntityNotFound(_0x482a60,null))[_0xe40d('0x26')](function(_0x4ba5f9){if(_0x4ba5f9){_0x37c66c=_0x4ba5f9[_0xe40d('0x99')];var _0x4e7928=_0x37c66c['slice'](-0x1);if(_0x4e7928==='/'){_0x37c66c=_0x37c66c[_0xe40d('0x9b')](0x0,_0x37c66c[_0xe40d('0x9c')](_0x4e7928));}_0x309abb=util[_0xe40d('0x9d')](_0xe40d('0x9e'),_0x37c66c);_0x41626c=util[_0xe40d('0x9d')](_0xe40d('0x9f'),_0x37c66c);_0x2677cf={'user':_0x4ba5f9[_0xe40d('0x96')],'pass':_0x4ba5f9['password']};var _0x52c664={'method':_0xe40d('0xa0'),'uri':_0x309abb+'incident?sysparm_display_value=all','auth':_0x2677cf,'json':!![]};return rp(_0x52c664);}})[_0xe40d('0x26')](function(_0x41d435){if(_0x41d435['result'][_0xe40d('0x39')]>0x0){_0xf8dda2=_0x41d435[_0xe40d('0xa1')];}console[_0xe40d('0xa2')](_0xe40d('0xa3'),_0xf8dda2);_0x382aa1=[];_0x4b3060=Object['assign']([],_0xf8dda2);_[_0xe40d('0xa4')](_0x4b3060,function(_0x1ca871){return!_0x51f964[_0xe40d('0xa5')](_0x1ca871['name']);});_0x4b3060[_0xe40d('0xa6')](function(_0x346601){var _0x217389=createFieldObject(_0x41626c,_0x2677cf,_0x346601['internalType'],_0x346601[_0xe40d('0x29')],_0x346601[_0xe40d('0xa7')],![]);_0x382aa1[_0xe40d('0xa8')](_0x217389);});return Promise[_0xe40d('0xa9')](_0x382aa1);})[_0xe40d('0x26')](function(_0x30778a){_0x3a5dc=_0x30778a;_0x15c512=Object[_0xe40d('0xaa')]([],_0xf8dda2);console[_0xe40d('0xa2')](_0xe40d('0xab'),_0xf8dda2);_[_0xe40d('0xa4')](_0x15c512,function(_0x3849e6){return _0x3abb2d['includes'](_0x3849e6[_0xe40d('0x29')]);});console['log'](_0xe40d('0xac'),_0x15c512);_0x382aa1=[];_0x15c512['forEach'](function(_0x4e50b0){var _0x5d51e3=createFieldObject(_0x41626c,_0x2677cf,_0x4e50b0[_0xe40d('0xad')],_0x4e50b0[_0xe40d('0x29')],_0x4e50b0[_0xe40d('0xa7')],!![]);_0x382aa1[_0xe40d('0xa8')](_0x5d51e3);});return Promise[_0xe40d('0xa9')](_0x382aa1);})[_0xe40d('0x26')](function(_0x3f684e){_0x4f7109=_0x3f684e;var _0x57e25c=_0x3a5dc['concat'](_0x4f7109);return{'count':_0x57e25c[_0xe40d('0x39')],'rows':_0x57e25c};})['then'](respondWithResult(_0x482a60,null))[_0xe40d('0x45')](function(_0x1b02ff){console[_0xe40d('0xa2')](_0xe40d('0xae')+_0x1b02ff);var _0x3b47f0=_0x353cb6[_0xe40d('0x33')][_0xe40d('0xaf')]?0x1f4:_0x1b02ff[_0xe40d('0xb0')]||0x1f4;logger[_0xe40d('0xb1')](_0x1b02ff[_0xe40d('0x28')]);delete _0x1b02ff[_0xe40d('0x29')];if(_0x3b47f0===0x191){_0x3b47f0=0x190;}_0x482a60['status'](_0x3b47f0)[_0xe40d('0x2a')](_0x353cb6['query']['test']?{'message':_0xe40d('0xb2'),'statusCode':_0x1b02ff['statusCode']}:_0x1b02ff);});};function createFieldObject(_0x2fc9b0,_0x49f15e,_0x4fcf6c,_0x2a2e4e,_0x40466d,_0x417049){return new Promise(function(_0x22d027,_0x2155c6){var _0x4ce0b6={'id':_0x2a2e4e,'name':_0x40466d,'custom':_0x417049};if(_0x4fcf6c===_0xe40d('0xb3')){_0x4ce0b6['options']=[{'name':_0xe40d('0xb4'),'value':'true'},{'name':_0xe40d('0xb5'),'value':'false'}];_0x22d027(_0x4ce0b6);}else{var _0x5ea5e9={'method':_0xe40d('0xa0'),'uri':_0x2fc9b0+_0xe40d('0xb6')+_0x2a2e4e,'auth':_0x49f15e,'json':!![]};return rp(_0x5ea5e9)['then'](function(_0x1066c0){var _0x18604e=[];if(_0x1066c0[_0xe40d('0xa1')][_0xe40d('0x39')]>0x0){_0x1066c0[_0xe40d('0xa1')][_0xe40d('0xa6')](function(_0x1dec28){if(_0x1dec28[_0xe40d('0xb7')]===_0xe40d('0xb8')){var _0x3b7e18={'name':_0x1dec28['label'],'value':_0x1dec28[_0xe40d('0xb9')]};_0x18604e[_0xe40d('0xa8')](_0x3b7e18);}});}_0x4ce0b6[_0xe40d('0x4f')]=_0x18604e;if(_0x4ce0b6['options'][_0xe40d('0x39')]>0x0){_0x22d027(_0x4ce0b6);}else{if(_0x417049==![]){_0x22d027();}else{_0x22d027(_0x4ce0b6);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 74cd2f8..28e56c9 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 _0x9c5a=['int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x156d79,_0x3b8e47){var _0x85dd72=function(_0x24f51f){while(--_0x24f51f){_0x156d79['push'](_0x156d79['shift']());}};_0x85dd72(++_0x3b8e47);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x32a0da,_0x9e5c4e){_0x32a0da=_0x32a0da-0x0;var _0xf354e4=_0x9c5a[_0x32a0da];return _0xf354e4;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xa9c5('0x8'));module['exports']=function(_0x394d84,_0x3df556){return _0x394d84['define']('ServicenowAccount',attributes,{'tableName':_0xa9c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2cf227,_0xdf3e70){var _0x39fb58=function(_0x193635){while(--_0x193635){_0x2cf227['push'](_0x2cf227['shift']());}};_0x39fb58(++_0xdf3e70);}(_0x4975,0x86));var _0x5497=function(_0x1324c4,_0x528525){_0x1324c4=_0x1324c4-0x0;var _0x4c643a=_0x4975[_0x1324c4];return _0x4c643a;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));var integrations=require(_0x5497('0xa'));module['exports']=function(_0x37e48d,_0x4f563d){return _0x37e48d[_0x5497('0xb')](_0x5497('0xc'),attributes,{'tableName':_0x5497('0xd'),'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 4c7cc73..03950df 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 _0x0e1b=['GetServicenowAccount','ShowServicenowAccount','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','findAll','raw','where','options','attributes','include','model','map'];(function(_0x5612bc,_0x4ebea7){var _0x24484c=function(_0x1dcf10){while(--_0x1dcf10){_0x5612bc['push'](_0x5612bc['shift']());}};_0x24484c(++_0x4ebea7);}(_0x0e1b,0xfa));var _0xb0e1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0e1b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb0e1('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0e1('0x1'));var db=require(_0xb0e1('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb0e1('0x3'))(_0xb0e1('0x4'));var config=require(_0xb0e1('0x5'));var jayson=require(_0xb0e1('0x6'));var client=jayson[_0xb0e1('0x7')][_0xb0e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48fbf2,_0x16144f,_0x46aac8){return new BPromise(function(_0x17cc8a,_0x2c8d22){return client[_0xb0e1('0x9')](_0x48fbf2,_0x46aac8)[_0xb0e1('0xa')](function(_0x5f5657){logger['info'](_0xb0e1('0xb'),_0x16144f,_0xb0e1('0xc'));logger[_0xb0e1('0xd')](_0xb0e1('0xe'),_0x16144f,_0xb0e1('0xc'),JSON[_0xb0e1('0xf')](_0x5f5657));if(_0x5f5657[_0xb0e1('0x10')]){if(_0x5f5657[_0xb0e1('0x10')]['code']===0x1f4){logger[_0xb0e1('0x10')](_0xb0e1('0xb'),_0x16144f,_0x5f5657[_0xb0e1('0x10')][_0xb0e1('0x11')]);return _0x2c8d22(_0x5f5657['error'][_0xb0e1('0x11')]);}logger[_0xb0e1('0x10')](_0xb0e1('0xb'),_0x16144f,_0x5f5657['error']['message']);return _0x17cc8a(_0x5f5657[_0xb0e1('0x10')][_0xb0e1('0x11')]);}else{logger[_0xb0e1('0x12')](_0xb0e1('0xb'),_0x16144f,_0xb0e1('0xc'));_0x17cc8a(_0x5f5657[_0xb0e1('0x13')][_0xb0e1('0x11')]);}})[_0xb0e1('0x14')](function(_0x47da7b){logger[_0xb0e1('0x10')](_0xb0e1('0xb'),_0x16144f,_0x47da7b);_0x2c8d22(_0x47da7b);});});}exports['GetServicenowAccount']=function(_0x5b4635){var _0x4c72d3=this;return new Promise(function(_0x374094,_0xee84bf){return db['ServicenowAccount'][_0xb0e1('0x15')]({'raw':_0x5b4635['options']?_0x5b4635['options'][_0xb0e1('0x16')]===undefined?!![]:![]:!![],'where':_0x5b4635['options']?_0x5b4635['options'][_0xb0e1('0x17')]||null:null,'attributes':_0x5b4635[_0xb0e1('0x18')]?_0x5b4635[_0xb0e1('0x18')][_0xb0e1('0x19')]||null:null,'limit':_0x5b4635[_0xb0e1('0x18')]?_0x5b4635[_0xb0e1('0x18')]['limit']||null:null,'include':_0x5b4635[_0xb0e1('0x18')]?_0x5b4635[_0xb0e1('0x18')]['include']?_['map'](_0x5b4635['options'][_0xb0e1('0x1a')],function(_0x4365cf){return{'model':db[_0x4365cf[_0xb0e1('0x1b')]],'as':_0x4365cf['as'],'attributes':_0x4365cf['attributes'],'include':_0x4365cf['include']?_[_0xb0e1('0x1c')](_0x4365cf[_0xb0e1('0x1a')],function(_0xf451d3){return{'model':db[_0xf451d3[_0xb0e1('0x1b')]],'as':_0xf451d3['as'],'attributes':_0xf451d3[_0xb0e1('0x19')],'include':_0xf451d3[_0xb0e1('0x1a')]?_[_0xb0e1('0x1c')](_0xf451d3['include'],function(_0x69c9a1){return{'model':db[_0x69c9a1[_0xb0e1('0x1b')]],'as':_0x69c9a1['as'],'attributes':_0x69c9a1[_0xb0e1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb0e1('0xa')](function(_0x23b857){logger[_0xb0e1('0x12')](_0xb0e1('0x1d'),_0x5b4635);logger[_0xb0e1('0xd')](_0xb0e1('0x1d'),_0x5b4635,JSON[_0xb0e1('0xf')](_0x23b857));_0x374094(_0x23b857);})['catch'](function(_0x1ff570){logger[_0xb0e1('0x10')](_0xb0e1('0x1d'),_0x1ff570[_0xb0e1('0x11')],_0x5b4635);_0xee84bf(_0x4c72d3[_0xb0e1('0x10')](0x1f4,_0x1ff570['message']));});});};exports[_0xb0e1('0x1e')]=function(_0x1aca21){var _0x534aae=this;return new Promise(function(_0x39dac3,_0x238995){return db['ServicenowAccount']['find']({'raw':_0x1aca21[_0xb0e1('0x18')]?_0x1aca21[_0xb0e1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1aca21[_0xb0e1('0x18')]?_0x1aca21[_0xb0e1('0x18')][_0xb0e1('0x17')]||null:null,'attributes':_0x1aca21[_0xb0e1('0x18')]?_0x1aca21[_0xb0e1('0x18')][_0xb0e1('0x19')]||null:null,'include':_0x1aca21[_0xb0e1('0x18')]?_0x1aca21[_0xb0e1('0x18')][_0xb0e1('0x1a')]?_[_0xb0e1('0x1c')](_0x1aca21[_0xb0e1('0x18')]['include'],function(_0x55e054){return{'model':db[_0x55e054['model']],'as':_0x55e054['as'],'attributes':_0x55e054[_0xb0e1('0x19')],'include':_0x55e054[_0xb0e1('0x1a')]?_[_0xb0e1('0x1c')](_0x55e054[_0xb0e1('0x1a')],function(_0x136426){return{'model':db[_0x136426[_0xb0e1('0x1b')]],'as':_0x136426['as'],'attributes':_0x136426['attributes'],'include':_0x136426[_0xb0e1('0x1a')]?_['map'](_0x136426[_0xb0e1('0x1a')],function(_0x5ad071){return{'model':db[_0x5ad071[_0xb0e1('0x1b')]],'as':_0x5ad071['as'],'attributes':_0x5ad071[_0xb0e1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb0e1('0xa')](function(_0x5424c9){logger[_0xb0e1('0x12')](_0xb0e1('0x1e'),_0x1aca21);logger['debug'](_0xb0e1('0x1e'),_0x1aca21,JSON[_0xb0e1('0xf')](_0x5424c9));_0x39dac3(_0x5424c9);})[_0xb0e1('0x14')](function(_0x2b4b7e){logger[_0xb0e1('0x10')](_0xb0e1('0x1e'),_0x2b4b7e[_0xb0e1('0x11')],_0x1aca21);_0x238995(_0x534aae[_0xb0e1('0x10')](0x1f4,_0x2b4b7e[_0xb0e1('0x11')]));});});}; \ No newline at end of file +var _0xd34b=['attributes','limit','include','map','model','debug','find','where','ShowServicenowAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw'];(function(_0x3c5c3c,_0x13b428){var _0x2a4714=function(_0x5d5ca3){while(--_0x5d5ca3){_0x3c5c3c['push'](_0x3c5c3c['shift']());}};_0x2a4714(++_0x13b428);}(_0xd34b,0x1a0));var _0xbd34=function(_0x378306,_0x3856a4){_0x378306=_0x378306-0x0;var _0x35be81=_0xd34b[_0x378306];return _0x35be81;};'use strict';var _=require('lodash');var util=require(_0xbd34('0x0'));var moment=require(_0xbd34('0x1'));var BPromise=require(_0xbd34('0x2'));var rs=require(_0xbd34('0x3'));var fs=require('fs');var Redis=require(_0xbd34('0x4'));var db=require(_0xbd34('0x5'))['db'];var utils=require(_0xbd34('0x6'));var logger=require(_0xbd34('0x7'))(_0xbd34('0x8'));var config=require(_0xbd34('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbd34('0xa')][_0xbd34('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ca49f,_0x5c4907,_0x5ad207){return new BPromise(function(_0x240782,_0x3e7dde){return client[_0xbd34('0xc')](_0x1ca49f,_0x5ad207)[_0xbd34('0xd')](function(_0x4dafc3){logger[_0xbd34('0xe')](_0xbd34('0xf'),_0x5c4907,_0xbd34('0x10'));logger['debug'](_0xbd34('0x11'),_0x5c4907,_0xbd34('0x10'),JSON[_0xbd34('0x12')](_0x4dafc3));if(_0x4dafc3[_0xbd34('0x13')]){if(_0x4dafc3[_0xbd34('0x13')][_0xbd34('0x14')]===0x1f4){logger[_0xbd34('0x13')](_0xbd34('0xf'),_0x5c4907,_0x4dafc3[_0xbd34('0x13')][_0xbd34('0x15')]);return _0x3e7dde(_0x4dafc3[_0xbd34('0x13')][_0xbd34('0x15')]);}logger[_0xbd34('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x5c4907,_0x4dafc3[_0xbd34('0x13')][_0xbd34('0x15')]);return _0x240782(_0x4dafc3[_0xbd34('0x13')][_0xbd34('0x15')]);}else{logger[_0xbd34('0xe')](_0xbd34('0xf'),_0x5c4907,'request\x20sent');_0x240782(_0x4dafc3[_0xbd34('0x16')][_0xbd34('0x15')]);}})[_0xbd34('0x17')](function(_0x55bfb3){logger[_0xbd34('0x13')](_0xbd34('0xf'),_0x5c4907,_0x55bfb3);_0x3e7dde(_0x55bfb3);});});}exports[_0xbd34('0x18')]=function(_0x1ff5a8){var _0x4d66db=this;return new Promise(function(_0xeef38,_0x42add9){return db[_0xbd34('0x19')]['findAll']({'raw':_0x1ff5a8[_0xbd34('0x1a')]?_0x1ff5a8[_0xbd34('0x1a')][_0xbd34('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ff5a8['options']?_0x1ff5a8['options']['where']||null:null,'attributes':_0x1ff5a8['options']?_0x1ff5a8[_0xbd34('0x1a')][_0xbd34('0x1c')]||null:null,'limit':_0x1ff5a8[_0xbd34('0x1a')]?_0x1ff5a8[_0xbd34('0x1a')][_0xbd34('0x1d')]||null:null,'include':_0x1ff5a8[_0xbd34('0x1a')]?_0x1ff5a8[_0xbd34('0x1a')][_0xbd34('0x1e')]?_[_0xbd34('0x1f')](_0x1ff5a8[_0xbd34('0x1a')][_0xbd34('0x1e')],function(_0x121f21){return{'model':db[_0x121f21['model']],'as':_0x121f21['as'],'attributes':_0x121f21[_0xbd34('0x1c')],'include':_0x121f21['include']?_[_0xbd34('0x1f')](_0x121f21['include'],function(_0xf2b369){return{'model':db[_0xf2b369[_0xbd34('0x20')]],'as':_0xf2b369['as'],'attributes':_0xf2b369[_0xbd34('0x1c')],'include':_0xf2b369[_0xbd34('0x1e')]?_['map'](_0xf2b369[_0xbd34('0x1e')],function(_0x87741b){return{'model':db[_0x87741b[_0xbd34('0x20')]],'as':_0x87741b['as'],'attributes':_0x87741b[_0xbd34('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbd34('0xd')](function(_0x3860b6){logger[_0xbd34('0xe')](_0xbd34('0x18'),_0x1ff5a8);logger[_0xbd34('0x21')]('GetServicenowAccount',_0x1ff5a8,JSON[_0xbd34('0x12')](_0x3860b6));_0xeef38(_0x3860b6);})[_0xbd34('0x17')](function(_0x19898a){logger[_0xbd34('0x13')](_0xbd34('0x18'),_0x19898a[_0xbd34('0x15')],_0x1ff5a8);_0x42add9(_0x4d66db[_0xbd34('0x13')](0x1f4,_0x19898a[_0xbd34('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x2e1ace){var _0x1ce673=this;return new Promise(function(_0x3c6205,_0x2ceb01){return db[_0xbd34('0x19')][_0xbd34('0x22')]({'raw':_0x2e1ace['options']?_0x2e1ace['options'][_0xbd34('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e1ace[_0xbd34('0x1a')]?_0x2e1ace[_0xbd34('0x1a')][_0xbd34('0x23')]||null:null,'attributes':_0x2e1ace['options']?_0x2e1ace[_0xbd34('0x1a')][_0xbd34('0x1c')]||null:null,'include':_0x2e1ace[_0xbd34('0x1a')]?_0x2e1ace[_0xbd34('0x1a')]['include']?_[_0xbd34('0x1f')](_0x2e1ace['options'][_0xbd34('0x1e')],function(_0x1fb0a1){return{'model':db[_0x1fb0a1['model']],'as':_0x1fb0a1['as'],'attributes':_0x1fb0a1[_0xbd34('0x1c')],'include':_0x1fb0a1[_0xbd34('0x1e')]?_['map'](_0x1fb0a1[_0xbd34('0x1e')],function(_0x34e811){return{'model':db[_0x34e811[_0xbd34('0x20')]],'as':_0x34e811['as'],'attributes':_0x34e811[_0xbd34('0x1c')],'include':_0x34e811['include']?_[_0xbd34('0x1f')](_0x34e811[_0xbd34('0x1e')],function(_0x1c5214){return{'model':db[_0x1c5214['model']],'as':_0x1c5214['as'],'attributes':_0x1c5214[_0xbd34('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbd34('0xd')](function(_0x57ea8b){logger[_0xbd34('0xe')](_0xbd34('0x24'),_0x2e1ace);logger[_0xbd34('0x21')](_0xbd34('0x24'),_0x2e1ace,JSON['stringify'](_0x57ea8b));_0x3c6205(_0x57ea8b);})[_0xbd34('0x17')](function(_0x17bed8){logger[_0xbd34('0x13')]('ShowServicenowAccount',_0x17bed8[_0xbd34('0x15')],_0x2e1ace);_0x2ceb01(_0x1ce673[_0xbd34('0x13')](0x1f4,_0x17bed8[_0xbd34('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 7c233c2..b600cad 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 _0xd9c3=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x42f649,_0x4a932d){var _0x4e4540=function(_0x57b00b){while(--_0x57b00b){_0x42f649['push'](_0x42f649['shift']());}};_0x4e4540(++_0x4a932d);}(_0xd9c3,0xcb));var _0x3d9c=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xd9c3[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0x3d9c('0x0'));var util=require(_0x3d9c('0x1'));var path=require(_0x3d9c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d9c('0x3'));var router=express['Router']();var fs_extra=require(_0x3d9c('0x4'));var auth=require(_0x3d9c('0x5'));var interaction=require(_0x3d9c('0x6'));var config=require('../../config/environment');var controller=require(_0x3d9c('0x7'));router[_0x3d9c('0x8')]('/',auth[_0x3d9c('0x9')](),controller[_0x3d9c('0xa')]);router['get']('/:id',auth[_0x3d9c('0x9')](),controller[_0x3d9c('0xb')]);router[_0x3d9c('0x8')](_0x3d9c('0xc'),auth[_0x3d9c('0x9')](),controller['getFields']);router[_0x3d9c('0x8')](_0x3d9c('0xd'),auth['isAuthenticated'](),controller[_0x3d9c('0xe')]);router[_0x3d9c('0x8')](_0x3d9c('0xf'),auth[_0x3d9c('0x9')](),controller[_0x3d9c('0x10')]);router[_0x3d9c('0x11')]('/',auth[_0x3d9c('0x9')](),controller[_0x3d9c('0x12')]);router[_0x3d9c('0x13')]('/:id',auth[_0x3d9c('0x9')](),controller[_0x3d9c('0x14')]);router[_0x3d9c('0x15')](_0x3d9c('0x16'),auth['isAuthenticated'](),controller[_0x3d9c('0x17')]);module['exports']=router; \ No newline at end of file +var _0x37d4=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37d4,0x1b4));var _0x437d=function(_0x566a82,_0x235929){_0x566a82=_0x566a82-0x0;var _0xe94f5c=_0x37d4[_0x566a82];return _0xe94f5c;};'use strict';var multer=require(_0x437d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x437d('0x1'));var router=express['Router']();var fs_extra=require(_0x437d('0x2'));var auth=require(_0x437d('0x3'));var interaction=require(_0x437d('0x4'));var config=require(_0x437d('0x5'));var controller=require(_0x437d('0x6'));router[_0x437d('0x7')]('/',auth[_0x437d('0x8')](),controller[_0x437d('0x9')]);router[_0x437d('0x7')](_0x437d('0xa'),auth[_0x437d('0x8')](),controller[_0x437d('0xb')]);router[_0x437d('0x7')](_0x437d('0xc'),auth['isAuthenticated'](),controller[_0x437d('0xd')]);router[_0x437d('0x7')](_0x437d('0xe'),auth[_0x437d('0x8')](),controller[_0x437d('0xf')]);router[_0x437d('0x7')](_0x437d('0x10'),auth[_0x437d('0x8')](),controller[_0x437d('0x11')]);router[_0x437d('0x12')]('/',auth[_0x437d('0x8')](),controller['create']);router[_0x437d('0x13')](_0x437d('0xa'),auth[_0x437d('0x8')](),controller[_0x437d('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x437d('0x15')]);module[_0x437d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 084702e..7b770a5 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 _0x4e03=['exports','STRING','sequelize'];(function(_0x185d2a,_0x308609){var _0x4dea27=function(_0x513443){while(--_0x513443){_0x185d2a['push'](_0x185d2a['shift']());}};_0x4dea27(++_0x308609);}(_0x4e03,0xbc));var _0x34e0=function(_0x11b538,_0x3d8dbb){_0x11b538=_0x11b538-0x0;var _0x56f750=_0x4e03[_0x11b538];return _0x56f750;};'use strict';var Sequelize=require(_0x34e0('0x0'));module[_0x34e0('0x1')]={'name':{'type':Sequelize[_0x34e0('0x2')]},'description':{'type':Sequelize[_0x34e0('0x2')]}}; \ No newline at end of file +var _0xb336=['STRING','sequelize'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xb336,0x1a9));var _0x6b33=function(_0x112ebe,_0x37c2c7){_0x112ebe=_0x112ebe-0x0;var _0x5f29e0=_0xb336[_0x112ebe];return _0x5f29e0;};'use strict';var Sequelize=require(_0x6b33('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6b33('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a6d2303..7bf617f 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 _0xa1f1=['reject','save','update','then','destroy','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','include','find','body','params','getFields','findOne','pick','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x3246a0,_0x32dcc3){var _0x3809ee=function(_0x398e63){while(--_0x398e63){_0x3246a0['push'](_0x3246a0['shift']());}};_0x3809ee(++_0x32dcc3);}(_0xa1f1,0x121));var _0x1a1f=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0xa1f1[_0x6eb833];return _0xdfc38c;};'use strict';var emlformat=require(_0x1a1f('0x0'));var rimraf=require(_0x1a1f('0x1'));var zipdir=require(_0x1a1f('0x2'));var jsonpatch=require(_0x1a1f('0x3'));var rp=require(_0x1a1f('0x4'));var moment=require(_0x1a1f('0x5'));var BPromise=require(_0x1a1f('0x6'));var Mustache=require(_0x1a1f('0x7'));var util=require(_0x1a1f('0x8'));var path=require('path');var sox=require(_0x1a1f('0x9'));var csv=require(_0x1a1f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a1f('0xb'));var _=require(_0x1a1f('0xc'));var squel=require(_0x1a1f('0xd'));var crypto=require(_0x1a1f('0xe'));var jsforce=require(_0x1a1f('0xf'));var deskjs=require(_0x1a1f('0x10'));var toCsv=require(_0x1a1f('0xa'));var querystring=require(_0x1a1f('0x11'));var Papa=require(_0x1a1f('0x12'));var Redis=require('ioredis');var authService=require(_0x1a1f('0x13'));var qs=require(_0x1a1f('0x14'));var as=require(_0x1a1f('0x15'));var hardwareService=require(_0x1a1f('0x16'));var logger=require(_0x1a1f('0x17'))('api');var utils=require(_0x1a1f('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1eceb3,_0x1be05e){_0x1be05e=_0x1be05e||0xcc;return function(_0x1e4fa2){if(_0x1e4fa2){return _0x1eceb3[_0x1a1f('0x19')](_0x1be05e);}return _0x1eceb3['status'](_0x1be05e)[_0x1a1f('0x1a')]();};}function respondWithResult(_0x21f3e0,_0x4f7676){_0x4f7676=_0x4f7676||0xc8;return function(_0x13c83c){if(_0x13c83c){return _0x21f3e0[_0x1a1f('0x1b')](_0x4f7676)[_0x1a1f('0x1c')](_0x13c83c);}};}function respondWithFilteredResult(_0x4c81f8,_0x31204a){return function(_0x48735e){if(_0x48735e){var _0x290d12=typeof _0x31204a[_0x1a1f('0x1d')]===_0x1a1f('0x1e')&&typeof _0x31204a[_0x1a1f('0x1f')]==='undefined';var _0x399a00=_0x48735e[_0x1a1f('0x20')];var _0x3b243f=_0x290d12?0x0:_0x31204a[_0x1a1f('0x1d')];var _0x1c4572=_0x290d12?_0x48735e[_0x1a1f('0x20')]:_0x31204a['offset']+_0x31204a[_0x1a1f('0x1f')];var _0x4efee2;if(_0x1c4572>=_0x399a00){_0x1c4572=_0x399a00;_0x4efee2=0xc8;}else{_0x4efee2=0xce;}_0x4c81f8[_0x1a1f('0x1b')](_0x4efee2);return _0x4c81f8['set'](_0x1a1f('0x21'),_0x3b243f+'-'+_0x1c4572+'/'+_0x399a00)['json'](_0x48735e);}return null;};}function patchUpdates(_0x124930){return function(_0x367675){try{jsonpatch[_0x1a1f('0x22')](_0x367675,_0x124930,!![]);}catch(_0x5c7960){return BPromise[_0x1a1f('0x23')](_0x5c7960);}return _0x367675[_0x1a1f('0x24')]();};}function saveUpdates(_0x49dcd7,_0x1e3c8f){return function(_0x121a5d){if(_0x121a5d){return _0x121a5d[_0x1a1f('0x25')](_0x49dcd7)[_0x1a1f('0x26')](function(_0x464138){return _0x464138;});}return null;};}function removeEntity(_0x8b9afe,_0x185017){return function(_0x33bb74){if(_0x33bb74){return _0x33bb74[_0x1a1f('0x27')]()[_0x1a1f('0x26')](function(){_0x8b9afe[_0x1a1f('0x1b')](0xcc)[_0x1a1f('0x1a')]();});}};}function handleEntityNotFound(_0x1028e4,_0x2fbd25){return function(_0x300bb8){if(!_0x300bb8){_0x1028e4[_0x1a1f('0x19')](0x194);}return _0x300bb8;};}function handleError(_0x18c52e,_0x588b1f){_0x588b1f=_0x588b1f||0x1f4;return function(_0x2d036d){logger['error'](_0x2d036d['stack']);if(_0x2d036d[_0x1a1f('0x28')]){delete _0x2d036d[_0x1a1f('0x28')];}_0x18c52e[_0x1a1f('0x1b')](_0x588b1f)[_0x1a1f('0x29')](_0x2d036d);};}exports[_0x1a1f('0x2a')]=function(_0xd4f60f,_0x4aec52){var _0x5825e5={},_0x561ef3={},_0x22b7f3={'count':0x0,'rows':[]};var _0x55a173=_[_0x1a1f('0x2b')](db[_0x1a1f('0x2c')][_0x1a1f('0x2d')],function(_0x39edf2){return{'name':_0x39edf2[_0x1a1f('0x2e')],'type':_0x39edf2[_0x1a1f('0x2f')][_0x1a1f('0x30')]};});_0x561ef3['model']=_[_0x1a1f('0x2b')](_0x55a173,_0x1a1f('0x28'));_0x561ef3[_0x1a1f('0x31')]=_[_0x1a1f('0x32')](_0xd4f60f[_0x1a1f('0x31')]);_0x561ef3[_0x1a1f('0x33')]=_[_0x1a1f('0x34')](_0x561ef3[_0x1a1f('0x35')],_0x561ef3['query']);_0x5825e5[_0x1a1f('0x36')]=_['intersection'](_0x561ef3[_0x1a1f('0x35')],qs[_0x1a1f('0x37')](_0xd4f60f[_0x1a1f('0x31')][_0x1a1f('0x37')]));_0x5825e5[_0x1a1f('0x36')]=_0x5825e5[_0x1a1f('0x36')][_0x1a1f('0x38')]?_0x5825e5[_0x1a1f('0x36')]:_0x561ef3[_0x1a1f('0x35')];if(!_0xd4f60f[_0x1a1f('0x31')][_0x1a1f('0x39')](_0x1a1f('0x3a'))){_0x5825e5[_0x1a1f('0x1f')]=qs[_0x1a1f('0x1f')](_0xd4f60f['query'][_0x1a1f('0x1f')]);_0x5825e5[_0x1a1f('0x1d')]=qs[_0x1a1f('0x1d')](_0xd4f60f[_0x1a1f('0x31')][_0x1a1f('0x1d')]);}_0x5825e5[_0x1a1f('0x3b')]=qs[_0x1a1f('0x3c')](_0xd4f60f[_0x1a1f('0x31')][_0x1a1f('0x3c')]);_0x5825e5[_0x1a1f('0x3d')]=qs[_0x1a1f('0x33')](_['pick'](_0xd4f60f[_0x1a1f('0x31')],_0x561ef3['filters']),_0x55a173);if(_0xd4f60f[_0x1a1f('0x31')]['filter']){_0x5825e5[_0x1a1f('0x3d')]=_[_0x1a1f('0x3e')](_0x5825e5[_0x1a1f('0x3d')],{'$or':_[_0x1a1f('0x2b')](_0x55a173,function(_0x2e6d9d){if(_0x2e6d9d[_0x1a1f('0x2f')]!==_0x1a1f('0x3f')){var _0x1386c2={};_0x1386c2[_0x2e6d9d[_0x1a1f('0x28')]]={'$like':'%'+_0xd4f60f[_0x1a1f('0x31')][_0x1a1f('0x40')]+'%'};return _0x1386c2;}})});}_0x5825e5=_[_0x1a1f('0x3e')]({},_0x5825e5,_0xd4f60f[_0x1a1f('0x41')]);var _0x541167={'where':_0x5825e5[_0x1a1f('0x3d')]};return db['ServicenowConfiguration'][_0x1a1f('0x20')](_0x541167)[_0x1a1f('0x26')](function(_0x90852){_0x22b7f3[_0x1a1f('0x20')]=_0x90852;if(_0xd4f60f[_0x1a1f('0x31')][_0x1a1f('0x42')]){_0x5825e5['include']=[{'all':!![]}];}return db[_0x1a1f('0x2c')][_0x1a1f('0x43')](_0x5825e5);})[_0x1a1f('0x26')](function(_0x3135b7){_0x22b7f3[_0x1a1f('0x44')]=_0x3135b7;return _0x22b7f3;})[_0x1a1f('0x26')](respondWithFilteredResult(_0x4aec52,_0x5825e5))[_0x1a1f('0x45')](handleError(_0x4aec52,null));};exports[_0x1a1f('0x46')]=function(_0x347f25,_0x15645f){var _0x143763={'raw':![],'where':{'id':_0x347f25['params']['id']}},_0x4923d5={};_0x4923d5['model']=_[_0x1a1f('0x32')](db['ServicenowConfiguration'][_0x1a1f('0x2d')]);_0x4923d5[_0x1a1f('0x31')]=_[_0x1a1f('0x32')](_0x347f25[_0x1a1f('0x31')]);_0x4923d5[_0x1a1f('0x33')]=_[_0x1a1f('0x34')](_0x4923d5[_0x1a1f('0x35')],_0x4923d5[_0x1a1f('0x31')]);_0x143763['attributes']=_[_0x1a1f('0x34')](_0x4923d5[_0x1a1f('0x35')],qs['fields'](_0x347f25['query']['fields']));_0x143763[_0x1a1f('0x36')]=_0x143763[_0x1a1f('0x36')][_0x1a1f('0x38')]?_0x143763[_0x1a1f('0x36')]:_0x4923d5[_0x1a1f('0x35')];if(_0x347f25['query'][_0x1a1f('0x42')]){_0x143763[_0x1a1f('0x47')]=[{'all':!![]}];}_0x143763=_[_0x1a1f('0x3e')]({},_0x143763,_0x347f25[_0x1a1f('0x41')]);return db[_0x1a1f('0x2c')][_0x1a1f('0x48')](_0x143763)[_0x1a1f('0x26')](handleEntityNotFound(_0x15645f,null))[_0x1a1f('0x26')](respondWithResult(_0x15645f,null))[_0x1a1f('0x45')](handleError(_0x15645f,null));};exports['create']=function(_0x59821d,_0x38ca86){return db[_0x1a1f('0x2c')]['create'](_0x59821d[_0x1a1f('0x49')],{})[_0x1a1f('0x26')](respondWithResult(_0x38ca86,0xc9))[_0x1a1f('0x45')](handleError(_0x38ca86,null));};exports[_0x1a1f('0x25')]=function(_0x2fc06d,_0x7dce19){if(_0x2fc06d[_0x1a1f('0x49')]['id']){delete _0x2fc06d[_0x1a1f('0x49')]['id'];}return db[_0x1a1f('0x2c')]['find']({'where':{'id':_0x2fc06d[_0x1a1f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7dce19,null))[_0x1a1f('0x26')](saveUpdates(_0x2fc06d['body'],null))[_0x1a1f('0x26')](respondWithResult(_0x7dce19,null))['catch'](handleError(_0x7dce19,null));};exports[_0x1a1f('0x27')]=function(_0x393e3d,_0x724de9){return db[_0x1a1f('0x2c')][_0x1a1f('0x48')]({'where':{'id':_0x393e3d['params']['id']}})[_0x1a1f('0x26')](handleEntityNotFound(_0x724de9,null))[_0x1a1f('0x26')](removeEntity(_0x724de9,null))['catch'](handleError(_0x724de9,null));};exports[_0x1a1f('0x4b')]=function(_0x5ab611,_0x5385cb,_0x2e0e8a){var _0x1d6d72={};var _0x3cc747={};var _0x432fd0;var _0x7ad5b3;return db['ServicenowConfiguration'][_0x1a1f('0x4c')]({'where':{'id':_0x5ab611[_0x1a1f('0x4a')]['id']}})[_0x1a1f('0x26')](handleEntityNotFound(_0x5385cb,null))[_0x1a1f('0x26')](function(_0x24f99e){if(_0x24f99e){_0x432fd0=_0x24f99e;_0x3cc747[_0x1a1f('0x35')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x3cc747[_0x1a1f('0x31')]=_[_0x1a1f('0x32')](_0x5ab611[_0x1a1f('0x31')]);_0x3cc747[_0x1a1f('0x33')]=_[_0x1a1f('0x34')](_0x3cc747[_0x1a1f('0x35')],_0x3cc747[_0x1a1f('0x31')]);_0x1d6d72['attributes']=_['intersection'](_0x3cc747[_0x1a1f('0x35')],qs[_0x1a1f('0x37')](_0x5ab611['query'][_0x1a1f('0x37')]));_0x1d6d72[_0x1a1f('0x36')]=_0x1d6d72['attributes']['length']?_0x1d6d72[_0x1a1f('0x36')]:_0x3cc747[_0x1a1f('0x35')];_0x1d6d72[_0x1a1f('0x3b')]=qs['sort'](_0x5ab611[_0x1a1f('0x31')]['sort']);_0x1d6d72[_0x1a1f('0x3d')]=qs[_0x1a1f('0x33')](_[_0x1a1f('0x4d')](_0x5ab611[_0x1a1f('0x31')],_0x3cc747[_0x1a1f('0x33')]));if(_0x5ab611[_0x1a1f('0x31')]['filter']){_0x1d6d72[_0x1a1f('0x3d')]=_[_0x1a1f('0x3e')](_0x1d6d72['where'],{'$or':_['map'](_0x1d6d72[_0x1a1f('0x36')],function(_0x56881b){var _0x3c227e={};_0x3c227e[_0x56881b]={'$like':'%'+_0x5ab611['query']['filter']+'%'};return _0x3c227e;})});}_0x1d6d72=_[_0x1a1f('0x3e')]({},_0x1d6d72,_0x5ab611[_0x1a1f('0x41')]);return _0x432fd0[_0x1a1f('0x4b')](_0x1d6d72);}})[_0x1a1f('0x26')](function(_0xd0172e){if(_0xd0172e){_0x7ad5b3=_0xd0172e[_0x1a1f('0x38')];if(!_0x5ab611['query']['hasOwnProperty']('nolimit')){_0x1d6d72[_0x1a1f('0x1f')]=qs['limit'](_0x5ab611[_0x1a1f('0x31')][_0x1a1f('0x1f')]);_0x1d6d72[_0x1a1f('0x1d')]=qs[_0x1a1f('0x1d')](_0x5ab611['query'][_0x1a1f('0x1d')]);}return _0x432fd0[_0x1a1f('0x4b')](_0x1d6d72);}})[_0x1a1f('0x26')](function(_0x44d73c){if(_0x44d73c){return _0x44d73c?{'count':_0x7ad5b3,'rows':_0x44d73c}:null;}})[_0x1a1f('0x26')](respondWithResult(_0x5385cb,null))[_0x1a1f('0x45')](handleError(_0x5385cb,null));};exports[_0x1a1f('0x4e')]=function(_0xb9795c,_0x5441c7,_0x2fe20e){var _0x535fad={};var _0x417763={};var _0x5eb9f5;var _0x66d0a8;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0xb9795c[_0x1a1f('0x4a')]['id']}})[_0x1a1f('0x26')](handleEntityNotFound(_0x5441c7,null))[_0x1a1f('0x26')](function(_0x135a57){if(_0x135a57){_0x5eb9f5=_0x135a57;_0x417763[_0x1a1f('0x35')]=_[_0x1a1f('0x32')](db[_0x1a1f('0x4f')][_0x1a1f('0x2d')]);_0x417763['query']=_['keys'](_0xb9795c[_0x1a1f('0x31')]);_0x417763[_0x1a1f('0x33')]=_[_0x1a1f('0x34')](_0x417763[_0x1a1f('0x35')],_0x417763[_0x1a1f('0x31')]);_0x535fad[_0x1a1f('0x36')]=_[_0x1a1f('0x34')](_0x417763['model'],qs[_0x1a1f('0x37')](_0xb9795c[_0x1a1f('0x31')][_0x1a1f('0x37')]));_0x535fad[_0x1a1f('0x36')]=_0x535fad[_0x1a1f('0x36')][_0x1a1f('0x38')]?_0x535fad[_0x1a1f('0x36')]:_0x417763[_0x1a1f('0x35')];_0x535fad['order']=qs[_0x1a1f('0x3c')](_0xb9795c['query'][_0x1a1f('0x3c')]);_0x535fad[_0x1a1f('0x3d')]=qs[_0x1a1f('0x33')](_[_0x1a1f('0x4d')](_0xb9795c[_0x1a1f('0x31')],_0x417763[_0x1a1f('0x33')]));if(_0xb9795c[_0x1a1f('0x31')][_0x1a1f('0x40')]){_0x535fad[_0x1a1f('0x3d')]=_[_0x1a1f('0x3e')](_0x535fad[_0x1a1f('0x3d')],{'$or':_['map'](_0x535fad['attributes'],function(_0x41a2e6){var _0x2bbb12={};_0x2bbb12[_0x41a2e6]={'$like':'%'+_0xb9795c[_0x1a1f('0x31')][_0x1a1f('0x40')]+'%'};return _0x2bbb12;})});}_0x535fad=_[_0x1a1f('0x3e')]({},_0x535fad,_0xb9795c[_0x1a1f('0x41')]);return _0x5eb9f5[_0x1a1f('0x4e')](_0x535fad);}})['then'](function(_0x46184b){if(_0x46184b){_0x66d0a8=_0x46184b[_0x1a1f('0x38')];if(!_0xb9795c[_0x1a1f('0x31')][_0x1a1f('0x39')]('nolimit')){_0x535fad[_0x1a1f('0x1f')]=qs[_0x1a1f('0x1f')](_0xb9795c['query']['limit']);_0x535fad[_0x1a1f('0x1d')]=qs[_0x1a1f('0x1d')](_0xb9795c['query'][_0x1a1f('0x1d')]);}return _0x5eb9f5[_0x1a1f('0x4e')](_0x535fad);}})['then'](function(_0x1fe010){if(_0x1fe010){return _0x1fe010?{'count':_0x66d0a8,'rows':_0x1fe010}:null;}})['then'](respondWithResult(_0x5441c7,null))[_0x1a1f('0x45')](handleError(_0x5441c7,null));};exports[_0x1a1f('0x50')]=function(_0x1e3bf8,_0x3992ea,_0x3b100a){var _0x1df3f5={};var _0x6b2fc7={};var _0x5bc9c2;var _0x437624;return db[_0x1a1f('0x2c')][_0x1a1f('0x4c')]({'where':{'id':_0x1e3bf8[_0x1a1f('0x4a')]['id']}})[_0x1a1f('0x26')](handleEntityNotFound(_0x3992ea,null))[_0x1a1f('0x26')](function(_0x14f19c){if(_0x14f19c){_0x5bc9c2=_0x14f19c;_0x6b2fc7[_0x1a1f('0x35')]=_[_0x1a1f('0x32')](db[_0x1a1f('0x4f')]['rawAttributes']);_0x6b2fc7[_0x1a1f('0x31')]=_[_0x1a1f('0x32')](_0x1e3bf8[_0x1a1f('0x31')]);_0x6b2fc7[_0x1a1f('0x33')]=_[_0x1a1f('0x34')](_0x6b2fc7[_0x1a1f('0x35')],_0x6b2fc7[_0x1a1f('0x31')]);_0x1df3f5[_0x1a1f('0x36')]=_[_0x1a1f('0x34')](_0x6b2fc7['model'],qs[_0x1a1f('0x37')](_0x1e3bf8[_0x1a1f('0x31')][_0x1a1f('0x37')]));_0x1df3f5['attributes']=_0x1df3f5[_0x1a1f('0x36')][_0x1a1f('0x38')]?_0x1df3f5[_0x1a1f('0x36')]:_0x6b2fc7[_0x1a1f('0x35')];_0x1df3f5[_0x1a1f('0x3b')]=qs[_0x1a1f('0x3c')](_0x1e3bf8[_0x1a1f('0x31')][_0x1a1f('0x3c')]);_0x1df3f5['where']=qs[_0x1a1f('0x33')](_[_0x1a1f('0x4d')](_0x1e3bf8[_0x1a1f('0x31')],_0x6b2fc7[_0x1a1f('0x33')]));if(_0x1e3bf8['query']['filter']){_0x1df3f5[_0x1a1f('0x3d')]=_[_0x1a1f('0x3e')](_0x1df3f5[_0x1a1f('0x3d')],{'$or':_[_0x1a1f('0x2b')](_0x1df3f5[_0x1a1f('0x36')],function(_0x5362bb){var _0x5b287c={};_0x5b287c[_0x5362bb]={'$like':'%'+_0x1e3bf8[_0x1a1f('0x31')][_0x1a1f('0x40')]+'%'};return _0x5b287c;})});}_0x1df3f5=_[_0x1a1f('0x3e')]({},_0x1df3f5,_0x1e3bf8[_0x1a1f('0x41')]);return _0x5bc9c2[_0x1a1f('0x50')](_0x1df3f5);}})['then'](function(_0x33a9ad){if(_0x33a9ad){_0x437624=_0x33a9ad[_0x1a1f('0x38')];if(!_0x1e3bf8[_0x1a1f('0x31')][_0x1a1f('0x39')](_0x1a1f('0x3a'))){_0x1df3f5[_0x1a1f('0x1f')]=qs[_0x1a1f('0x1f')](_0x1e3bf8['query'][_0x1a1f('0x1f')]);_0x1df3f5[_0x1a1f('0x1d')]=qs[_0x1a1f('0x1d')](_0x1e3bf8[_0x1a1f('0x31')][_0x1a1f('0x1d')]);}return _0x5bc9c2[_0x1a1f('0x50')](_0x1df3f5);}})[_0x1a1f('0x26')](function(_0x4e14a6){if(_0x4e14a6){return _0x4e14a6?{'count':_0x437624,'rows':_0x4e14a6}:null;}})[_0x1a1f('0x26')](respondWithResult(_0x3992ea,null))['catch'](handleError(_0x3992ea,null));}; \ No newline at end of file +var _0xab71=['count','set','Content-Range','apply','reject','update','then','error','stack','name','send','ServicenowConfiguration','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','getFields','ServicenowField','pick','filter','hasOwnProperty','getSubjects','getDescriptions','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xab71,0x167));var _0x1ab7=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0xab71[_0x4a5494];return _0x57cbb5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1ab7('0x0'));var jsonpatch=require(_0x1ab7('0x1'));var rp=require('request-promise');var moment=require(_0x1ab7('0x2'));var BPromise=require(_0x1ab7('0x3'));var Mustache=require(_0x1ab7('0x4'));var util=require(_0x1ab7('0x5'));var path=require(_0x1ab7('0x6'));var sox=require(_0x1ab7('0x7'));var csv=require(_0x1ab7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ab7('0x9'));var _=require(_0x1ab7('0xa'));var squel=require(_0x1ab7('0xb'));var crypto=require(_0x1ab7('0xc'));var jsforce=require(_0x1ab7('0xd'));var deskjs=require(_0x1ab7('0xe'));var toCsv=require(_0x1ab7('0x8'));var querystring=require(_0x1ab7('0xf'));var Papa=require(_0x1ab7('0x10'));var Redis=require('ioredis');var authService=require(_0x1ab7('0x11'));var qs=require(_0x1ab7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ab7('0x13'));var logger=require(_0x1ab7('0x14'))('api');var utils=require(_0x1ab7('0x15'));var config=require(_0x1ab7('0x16'));var licenseUtil=require(_0x1ab7('0x17'));var db=require(_0x1ab7('0x18'))['db'];function respondWithStatusCode(_0x4bc790,_0x1ecd67){_0x1ecd67=_0x1ecd67||0xcc;return function(_0x3cb988){if(_0x3cb988){return _0x4bc790[_0x1ab7('0x19')](_0x1ecd67);}return _0x4bc790[_0x1ab7('0x1a')](_0x1ecd67)['end']();};}function respondWithResult(_0x267e64,_0x5ab7e2){_0x5ab7e2=_0x5ab7e2||0xc8;return function(_0x2e03a7){if(_0x2e03a7){return _0x267e64['status'](_0x5ab7e2)[_0x1ab7('0x1b')](_0x2e03a7);}};}function respondWithFilteredResult(_0x11a7ed,_0x270352){return function(_0x141948){if(_0x141948){var _0x4b0657=typeof _0x270352[_0x1ab7('0x1c')]===_0x1ab7('0x1d')&&typeof _0x270352[_0x1ab7('0x1e')]===_0x1ab7('0x1d');var _0x1c8912=_0x141948[_0x1ab7('0x1f')];var _0x23212d=_0x4b0657?0x0:_0x270352[_0x1ab7('0x1c')];var _0x102c8f=_0x4b0657?_0x141948[_0x1ab7('0x1f')]:_0x270352[_0x1ab7('0x1c')]+_0x270352[_0x1ab7('0x1e')];var _0x5acb4f;if(_0x102c8f>=_0x1c8912){_0x102c8f=_0x1c8912;_0x5acb4f=0xc8;}else{_0x5acb4f=0xce;}_0x11a7ed['status'](_0x5acb4f);return _0x11a7ed[_0x1ab7('0x20')](_0x1ab7('0x21'),_0x23212d+'-'+_0x102c8f+'/'+_0x1c8912)['json'](_0x141948);}return null;};}function patchUpdates(_0x5e6ed6){return function(_0x338d23){try{jsonpatch[_0x1ab7('0x22')](_0x338d23,_0x5e6ed6,!![]);}catch(_0x5727e6){return BPromise[_0x1ab7('0x23')](_0x5727e6);}return _0x338d23['save']();};}function saveUpdates(_0x82431b,_0x332d5d){return function(_0x14232f){if(_0x14232f){return _0x14232f[_0x1ab7('0x24')](_0x82431b)[_0x1ab7('0x25')](function(_0x50115b){return _0x50115b;});}return null;};}function removeEntity(_0x1f840c,_0x5f49c8){return function(_0x29510d){if(_0x29510d){return _0x29510d['destroy']()[_0x1ab7('0x25')](function(){_0x1f840c[_0x1ab7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4489c1,_0x5c7a83){return function(_0x2ba2d5){if(!_0x2ba2d5){_0x4489c1['sendStatus'](0x194);}return _0x2ba2d5;};}function handleError(_0x58a451,_0x19089a){_0x19089a=_0x19089a||0x1f4;return function(_0x286b45){logger[_0x1ab7('0x26')](_0x286b45[_0x1ab7('0x27')]);if(_0x286b45[_0x1ab7('0x28')]){delete _0x286b45[_0x1ab7('0x28')];}_0x58a451['status'](_0x19089a)[_0x1ab7('0x29')](_0x286b45);};}exports['index']=function(_0x10203c,_0x5b6977){var _0x404c0a={},_0x592cd5={},_0x43cbfb={'count':0x0,'rows':[]};var _0x33d223=_['map'](db[_0x1ab7('0x2a')]['rawAttributes'],function(_0x4e87fe){return{'name':_0x4e87fe['fieldName'],'type':_0x4e87fe[_0x1ab7('0x2b')]['key']};});_0x592cd5[_0x1ab7('0x2c')]=_[_0x1ab7('0x2d')](_0x33d223,_0x1ab7('0x28'));_0x592cd5[_0x1ab7('0x2e')]=_[_0x1ab7('0x2f')](_0x10203c[_0x1ab7('0x2e')]);_0x592cd5[_0x1ab7('0x30')]=_[_0x1ab7('0x31')](_0x592cd5[_0x1ab7('0x2c')],_0x592cd5[_0x1ab7('0x2e')]);_0x404c0a['attributes']=_['intersection'](_0x592cd5[_0x1ab7('0x2c')],qs[_0x1ab7('0x32')](_0x10203c['query'][_0x1ab7('0x32')]));_0x404c0a['attributes']=_0x404c0a[_0x1ab7('0x33')][_0x1ab7('0x34')]?_0x404c0a[_0x1ab7('0x33')]:_0x592cd5[_0x1ab7('0x2c')];if(!_0x10203c['query']['hasOwnProperty'](_0x1ab7('0x35'))){_0x404c0a[_0x1ab7('0x1e')]=qs[_0x1ab7('0x1e')](_0x10203c[_0x1ab7('0x2e')][_0x1ab7('0x1e')]);_0x404c0a[_0x1ab7('0x1c')]=qs[_0x1ab7('0x1c')](_0x10203c[_0x1ab7('0x2e')]['offset']);}_0x404c0a[_0x1ab7('0x36')]=qs['sort'](_0x10203c[_0x1ab7('0x2e')][_0x1ab7('0x37')]);_0x404c0a[_0x1ab7('0x38')]=qs[_0x1ab7('0x30')](_['pick'](_0x10203c[_0x1ab7('0x2e')],_0x592cd5[_0x1ab7('0x30')]),_0x33d223);if(_0x10203c[_0x1ab7('0x2e')]['filter']){_0x404c0a[_0x1ab7('0x38')]=_[_0x1ab7('0x39')](_0x404c0a[_0x1ab7('0x38')],{'$or':_[_0x1ab7('0x2d')](_0x33d223,function(_0x466f82){if(_0x466f82[_0x1ab7('0x2b')]!==_0x1ab7('0x3a')){var _0x2b02e0={};_0x2b02e0[_0x466f82[_0x1ab7('0x28')]]={'$like':'%'+_0x10203c[_0x1ab7('0x2e')]['filter']+'%'};return _0x2b02e0;}})});}_0x404c0a=_[_0x1ab7('0x39')]({},_0x404c0a,_0x10203c[_0x1ab7('0x3b')]);var _0x445dd6={'where':_0x404c0a[_0x1ab7('0x38')]};return db[_0x1ab7('0x2a')][_0x1ab7('0x1f')](_0x445dd6)[_0x1ab7('0x25')](function(_0x470723){_0x43cbfb[_0x1ab7('0x1f')]=_0x470723;if(_0x10203c[_0x1ab7('0x2e')]['includeAll']){_0x404c0a[_0x1ab7('0x3c')]=[{'all':!![]}];}return db[_0x1ab7('0x2a')][_0x1ab7('0x3d')](_0x404c0a);})[_0x1ab7('0x25')](function(_0x10bc34){_0x43cbfb[_0x1ab7('0x3e')]=_0x10bc34;return _0x43cbfb;})[_0x1ab7('0x25')](respondWithFilteredResult(_0x5b6977,_0x404c0a))[_0x1ab7('0x3f')](handleError(_0x5b6977,null));};exports[_0x1ab7('0x40')]=function(_0xf247c9,_0x4d4de8){var _0xdf2b51={'raw':![],'where':{'id':_0xf247c9[_0x1ab7('0x41')]['id']}},_0xa49d2a={};_0xa49d2a[_0x1ab7('0x2c')]=_[_0x1ab7('0x2f')](db[_0x1ab7('0x2a')][_0x1ab7('0x42')]);_0xa49d2a['query']=_[_0x1ab7('0x2f')](_0xf247c9[_0x1ab7('0x2e')]);_0xa49d2a[_0x1ab7('0x30')]=_[_0x1ab7('0x31')](_0xa49d2a[_0x1ab7('0x2c')],_0xa49d2a['query']);_0xdf2b51[_0x1ab7('0x33')]=_[_0x1ab7('0x31')](_0xa49d2a['model'],qs['fields'](_0xf247c9[_0x1ab7('0x2e')][_0x1ab7('0x32')]));_0xdf2b51[_0x1ab7('0x33')]=_0xdf2b51[_0x1ab7('0x33')][_0x1ab7('0x34')]?_0xdf2b51[_0x1ab7('0x33')]:_0xa49d2a[_0x1ab7('0x2c')];if(_0xf247c9[_0x1ab7('0x2e')]['includeAll']){_0xdf2b51[_0x1ab7('0x3c')]=[{'all':!![]}];}_0xdf2b51=_[_0x1ab7('0x39')]({},_0xdf2b51,_0xf247c9[_0x1ab7('0x3b')]);return db[_0x1ab7('0x2a')][_0x1ab7('0x43')](_0xdf2b51)[_0x1ab7('0x25')](handleEntityNotFound(_0x4d4de8,null))['then'](respondWithResult(_0x4d4de8,null))[_0x1ab7('0x3f')](handleError(_0x4d4de8,null));};exports['create']=function(_0x338b22,_0x352863){return db['ServicenowConfiguration'][_0x1ab7('0x44')](_0x338b22['body'],{})[_0x1ab7('0x25')](respondWithResult(_0x352863,0xc9))[_0x1ab7('0x3f')](handleError(_0x352863,null));};exports[_0x1ab7('0x24')]=function(_0x7f1eea,_0x7c7db5){if(_0x7f1eea['body']['id']){delete _0x7f1eea[_0x1ab7('0x45')]['id'];}return db[_0x1ab7('0x2a')][_0x1ab7('0x43')]({'where':{'id':_0x7f1eea[_0x1ab7('0x41')]['id']}})[_0x1ab7('0x25')](handleEntityNotFound(_0x7c7db5,null))[_0x1ab7('0x25')](saveUpdates(_0x7f1eea[_0x1ab7('0x45')],null))[_0x1ab7('0x25')](respondWithResult(_0x7c7db5,null))['catch'](handleError(_0x7c7db5,null));};exports[_0x1ab7('0x46')]=function(_0x47f7cc,_0x3c8c6f){return db[_0x1ab7('0x2a')][_0x1ab7('0x43')]({'where':{'id':_0x47f7cc[_0x1ab7('0x41')]['id']}})[_0x1ab7('0x25')](handleEntityNotFound(_0x3c8c6f,null))['then'](removeEntity(_0x3c8c6f,null))[_0x1ab7('0x3f')](handleError(_0x3c8c6f,null));};exports[_0x1ab7('0x47')]=function(_0x1ae19b,_0x1335b7,_0x496e64){var _0x5507af={};var _0x33e6e2={};var _0x3647bd;var _0x405f89;return db[_0x1ab7('0x2a')]['findOne']({'where':{'id':_0x1ae19b[_0x1ab7('0x41')]['id']}})['then'](handleEntityNotFound(_0x1335b7,null))[_0x1ab7('0x25')](function(_0x5ae813){if(_0x5ae813){_0x3647bd=_0x5ae813;_0x33e6e2['model']=_[_0x1ab7('0x2f')](db[_0x1ab7('0x48')]['rawAttributes']);_0x33e6e2['query']=_[_0x1ab7('0x2f')](_0x1ae19b[_0x1ab7('0x2e')]);_0x33e6e2[_0x1ab7('0x30')]=_['intersection'](_0x33e6e2[_0x1ab7('0x2c')],_0x33e6e2[_0x1ab7('0x2e')]);_0x5507af[_0x1ab7('0x33')]=_[_0x1ab7('0x31')](_0x33e6e2['model'],qs['fields'](_0x1ae19b['query']['fields']));_0x5507af[_0x1ab7('0x33')]=_0x5507af['attributes'][_0x1ab7('0x34')]?_0x5507af['attributes']:_0x33e6e2[_0x1ab7('0x2c')];_0x5507af[_0x1ab7('0x36')]=qs['sort'](_0x1ae19b[_0x1ab7('0x2e')]['sort']);_0x5507af[_0x1ab7('0x38')]=qs[_0x1ab7('0x30')](_[_0x1ab7('0x49')](_0x1ae19b[_0x1ab7('0x2e')],_0x33e6e2[_0x1ab7('0x30')]));if(_0x1ae19b[_0x1ab7('0x2e')][_0x1ab7('0x4a')]){_0x5507af[_0x1ab7('0x38')]=_[_0x1ab7('0x39')](_0x5507af[_0x1ab7('0x38')],{'$or':_['map'](_0x5507af[_0x1ab7('0x33')],function(_0x125f97){var _0x40593a={};_0x40593a[_0x125f97]={'$like':'%'+_0x1ae19b[_0x1ab7('0x2e')]['filter']+'%'};return _0x40593a;})});}_0x5507af=_[_0x1ab7('0x39')]({},_0x5507af,_0x1ae19b[_0x1ab7('0x3b')]);return _0x3647bd[_0x1ab7('0x47')](_0x5507af);}})[_0x1ab7('0x25')](function(_0x5c8dc2){if(_0x5c8dc2){_0x405f89=_0x5c8dc2[_0x1ab7('0x34')];if(!_0x1ae19b[_0x1ab7('0x2e')][_0x1ab7('0x4b')](_0x1ab7('0x35'))){_0x5507af[_0x1ab7('0x1e')]=qs['limit'](_0x1ae19b[_0x1ab7('0x2e')][_0x1ab7('0x1e')]);_0x5507af[_0x1ab7('0x1c')]=qs[_0x1ab7('0x1c')](_0x1ae19b[_0x1ab7('0x2e')]['offset']);}return _0x3647bd[_0x1ab7('0x47')](_0x5507af);}})['then'](function(_0x7c16f6){if(_0x7c16f6){return _0x7c16f6?{'count':_0x405f89,'rows':_0x7c16f6}:null;}})[_0x1ab7('0x25')](respondWithResult(_0x1335b7,null))['catch'](handleError(_0x1335b7,null));};exports[_0x1ab7('0x4c')]=function(_0x520025,_0x3b37ac,_0x424762){var _0x27988d={};var _0x49b8bf={};var _0x4a44a9;var _0x259564;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x520025[_0x1ab7('0x41')]['id']}})['then'](handleEntityNotFound(_0x3b37ac,null))['then'](function(_0x14dca4){if(_0x14dca4){_0x4a44a9=_0x14dca4;_0x49b8bf[_0x1ab7('0x2c')]=_[_0x1ab7('0x2f')](db[_0x1ab7('0x48')][_0x1ab7('0x42')]);_0x49b8bf[_0x1ab7('0x2e')]=_[_0x1ab7('0x2f')](_0x520025['query']);_0x49b8bf[_0x1ab7('0x30')]=_[_0x1ab7('0x31')](_0x49b8bf[_0x1ab7('0x2c')],_0x49b8bf[_0x1ab7('0x2e')]);_0x27988d[_0x1ab7('0x33')]=_['intersection'](_0x49b8bf[_0x1ab7('0x2c')],qs['fields'](_0x520025[_0x1ab7('0x2e')]['fields']));_0x27988d[_0x1ab7('0x33')]=_0x27988d[_0x1ab7('0x33')][_0x1ab7('0x34')]?_0x27988d[_0x1ab7('0x33')]:_0x49b8bf[_0x1ab7('0x2c')];_0x27988d[_0x1ab7('0x36')]=qs['sort'](_0x520025['query'][_0x1ab7('0x37')]);_0x27988d[_0x1ab7('0x38')]=qs['filters'](_[_0x1ab7('0x49')](_0x520025[_0x1ab7('0x2e')],_0x49b8bf[_0x1ab7('0x30')]));if(_0x520025[_0x1ab7('0x2e')][_0x1ab7('0x4a')]){_0x27988d[_0x1ab7('0x38')]=_[_0x1ab7('0x39')](_0x27988d[_0x1ab7('0x38')],{'$or':_['map'](_0x27988d['attributes'],function(_0x839cd7){var _0x24cb39={};_0x24cb39[_0x839cd7]={'$like':'%'+_0x520025[_0x1ab7('0x2e')][_0x1ab7('0x4a')]+'%'};return _0x24cb39;})});}_0x27988d=_[_0x1ab7('0x39')]({},_0x27988d,_0x520025[_0x1ab7('0x3b')]);return _0x4a44a9[_0x1ab7('0x4c')](_0x27988d);}})[_0x1ab7('0x25')](function(_0x48d6b9){if(_0x48d6b9){_0x259564=_0x48d6b9['length'];if(!_0x520025['query'][_0x1ab7('0x4b')](_0x1ab7('0x35'))){_0x27988d[_0x1ab7('0x1e')]=qs['limit'](_0x520025[_0x1ab7('0x2e')][_0x1ab7('0x1e')]);_0x27988d[_0x1ab7('0x1c')]=qs[_0x1ab7('0x1c')](_0x520025['query'][_0x1ab7('0x1c')]);}return _0x4a44a9[_0x1ab7('0x4c')](_0x27988d);}})[_0x1ab7('0x25')](function(_0x20c293){if(_0x20c293){return _0x20c293?{'count':_0x259564,'rows':_0x20c293}:null;}})[_0x1ab7('0x25')](respondWithResult(_0x3b37ac,null))[_0x1ab7('0x3f')](handleError(_0x3b37ac,null));};exports[_0x1ab7('0x4d')]=function(_0x3a4ee2,_0x2dd88e,_0x1a9c39){var _0x4816ea={};var _0x35ee0c={};var _0x4edc0f;var _0x11e44a;return db[_0x1ab7('0x2a')]['findOne']({'where':{'id':_0x3a4ee2['params']['id']}})[_0x1ab7('0x25')](handleEntityNotFound(_0x2dd88e,null))[_0x1ab7('0x25')](function(_0x4d198b){if(_0x4d198b){_0x4edc0f=_0x4d198b;_0x35ee0c[_0x1ab7('0x2c')]=_[_0x1ab7('0x2f')](db['ServicenowField'][_0x1ab7('0x42')]);_0x35ee0c[_0x1ab7('0x2e')]=_[_0x1ab7('0x2f')](_0x3a4ee2[_0x1ab7('0x2e')]);_0x35ee0c[_0x1ab7('0x30')]=_['intersection'](_0x35ee0c[_0x1ab7('0x2c')],_0x35ee0c['query']);_0x4816ea[_0x1ab7('0x33')]=_[_0x1ab7('0x31')](_0x35ee0c[_0x1ab7('0x2c')],qs['fields'](_0x3a4ee2[_0x1ab7('0x2e')][_0x1ab7('0x32')]));_0x4816ea['attributes']=_0x4816ea['attributes'][_0x1ab7('0x34')]?_0x4816ea['attributes']:_0x35ee0c[_0x1ab7('0x2c')];_0x4816ea[_0x1ab7('0x36')]=qs[_0x1ab7('0x37')](_0x3a4ee2['query'][_0x1ab7('0x37')]);_0x4816ea[_0x1ab7('0x38')]=qs[_0x1ab7('0x30')](_[_0x1ab7('0x49')](_0x3a4ee2[_0x1ab7('0x2e')],_0x35ee0c[_0x1ab7('0x30')]));if(_0x3a4ee2[_0x1ab7('0x2e')][_0x1ab7('0x4a')]){_0x4816ea[_0x1ab7('0x38')]=_[_0x1ab7('0x39')](_0x4816ea['where'],{'$or':_[_0x1ab7('0x2d')](_0x4816ea[_0x1ab7('0x33')],function(_0x3b99c7){var _0x565e04={};_0x565e04[_0x3b99c7]={'$like':'%'+_0x3a4ee2[_0x1ab7('0x2e')][_0x1ab7('0x4a')]+'%'};return _0x565e04;})});}_0x4816ea=_[_0x1ab7('0x39')]({},_0x4816ea,_0x3a4ee2['options']);return _0x4edc0f['getDescriptions'](_0x4816ea);}})['then'](function(_0x42a95d){if(_0x42a95d){_0x11e44a=_0x42a95d['length'];if(!_0x3a4ee2[_0x1ab7('0x2e')][_0x1ab7('0x4b')](_0x1ab7('0x35'))){_0x4816ea['limit']=qs[_0x1ab7('0x1e')](_0x3a4ee2[_0x1ab7('0x2e')][_0x1ab7('0x1e')]);_0x4816ea['offset']=qs[_0x1ab7('0x1c')](_0x3a4ee2[_0x1ab7('0x2e')]['offset']);}return _0x4edc0f[_0x1ab7('0x4d')](_0x4816ea);}})[_0x1ab7('0x25')](function(_0x384b0e){if(_0x384b0e){return _0x384b0e?{'count':_0x11e44a,'rows':_0x384b0e}:null;}})[_0x1ab7('0x25')](respondWithResult(_0x2dd88e,null))[_0x1ab7('0x3f')](handleError(_0x2dd88e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c082ddb..4dbf22d 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 _0x8efc=['exports','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x8efc,0xb3));var _0xc8ef=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0x8efc[_0xb7cb72];return _0x4b7570;};'use strict';var _=require('lodash');var util=require(_0xc8ef('0x0'));var logger=require(_0xc8ef('0x1'))(_0xc8ef('0x2'));var moment=require(_0xc8ef('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8ef('0x4'));var fs=require('fs');var path=require(_0xc8ef('0x5'));var rimraf=require(_0xc8ef('0x6'));var config=require('../../config/environment');var attributes=require(_0xc8ef('0x7'));module[_0xc8ef('0x8')]=function(_0x1cd466,_0x13b433){return _0x1cd466['define'](_0xc8ef('0x9'),attributes,{'tableName':_0xc8ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfa6=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util','bluebird','request-promise','path','../../config/environment'];(function(_0x5c0259,_0xb2407f){var _0x2a80cb=function(_0x902f2c){while(--_0x902f2c){_0x5c0259['push'](_0x5c0259['shift']());}};_0x2a80cb(++_0xb2407f);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbfa6[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x6bfa('0x0'));var util=require(_0x6bfa('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6bfa('0x2'));var rp=require(_0x6bfa('0x3'));var fs=require('fs');var path=require(_0x6bfa('0x4'));var rimraf=require('rimraf');var config=require(_0x6bfa('0x5'));var attributes=require(_0x6bfa('0x6'));module[_0x6bfa('0x7')]=function(_0x39d9a3,_0x3a3a1a){return _0x39d9a3[_0x6bfa('0x8')](_0x6bfa('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 6bd139b..ca1634b 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 _0x8a68=['stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','request','then','info','debug','request\x20sent'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x8a68,0x183));var _0x88a6=function(_0x180dc2,_0x46ca81){_0x180dc2=_0x180dc2-0x0;var _0x41d17a=_0x8a68[_0x180dc2];return _0x41d17a;};'use strict';var _=require(_0x88a6('0x0'));var util=require(_0x88a6('0x1'));var moment=require('moment');var BPromise=require(_0x88a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88a6('0x3'));var db=require(_0x88a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x88a6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x88a6('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x159799,_0x2c0912,_0x25c814){return new BPromise(function(_0x55150a,_0x377915){return client[_0x88a6('0x7')](_0x159799,_0x25c814)[_0x88a6('0x8')](function(_0x3d4912){logger[_0x88a6('0x9')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2c0912,'request\x20sent');logger[_0x88a6('0xa')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x2c0912,_0x88a6('0xb'),JSON[_0x88a6('0xc')](_0x3d4912));if(_0x3d4912[_0x88a6('0xd')]){if(_0x3d4912['error'][_0x88a6('0xe')]===0x1f4){logger[_0x88a6('0xd')](_0x88a6('0xf'),_0x2c0912,_0x3d4912['error'][_0x88a6('0x10')]);return _0x377915(_0x3d4912[_0x88a6('0xd')][_0x88a6('0x10')]);}logger[_0x88a6('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2c0912,_0x3d4912[_0x88a6('0xd')][_0x88a6('0x10')]);return _0x55150a(_0x3d4912[_0x88a6('0xd')][_0x88a6('0x10')]);}else{logger['info'](_0x88a6('0xf'),_0x2c0912,_0x88a6('0xb'));_0x55150a(_0x3d4912[_0x88a6('0x11')][_0x88a6('0x10')]);}})[_0x88a6('0x12')](function(_0xa2637b){logger[_0x88a6('0xd')](_0x88a6('0xf'),_0x2c0912,_0xa2637b);_0x377915(_0xa2637b);});});} \ No newline at end of file +var _0xc7aa=['stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x2cf2c8,_0x21f60d){var _0x4013f8=function(_0x4014b9){while(--_0x4014b9){_0x2cf2c8['push'](_0x2cf2c8['shift']());}};_0x4013f8(++_0x21f60d);}(_0xc7aa,0x1a9));var _0xac7a=function(_0x274e97,_0x5cf0c7){_0x274e97=_0x274e97-0x0;var _0x151029=_0xc7aa[_0x274e97];return _0x151029;};'use strict';var _=require(_0xac7a('0x0'));var util=require(_0xac7a('0x1'));var moment=require('moment');var BPromise=require(_0xac7a('0x2'));var rs=require(_0xac7a('0x3'));var fs=require('fs');var Redis=require(_0xac7a('0x4'));var db=require(_0xac7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xac7a('0x7'));var client=jayson[_0xac7a('0x8')][_0xac7a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x568e4e,_0x4e4054,_0x2a7ddd){return new BPromise(function(_0x534bf3,_0x5bd184){return client[_0xac7a('0xa')](_0x568e4e,_0x2a7ddd)[_0xac7a('0xb')](function(_0x3cca8f){logger[_0xac7a('0xc')](_0xac7a('0xd'),_0x4e4054,_0xac7a('0xe'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4e4054,'request\x20sent',JSON[_0xac7a('0xf')](_0x3cca8f));if(_0x3cca8f[_0xac7a('0x10')]){if(_0x3cca8f[_0xac7a('0x10')][_0xac7a('0x11')]===0x1f4){logger[_0xac7a('0x10')](_0xac7a('0xd'),_0x4e4054,_0x3cca8f['error'][_0xac7a('0x12')]);return _0x5bd184(_0x3cca8f[_0xac7a('0x10')][_0xac7a('0x12')]);}logger[_0xac7a('0x10')](_0xac7a('0xd'),_0x4e4054,_0x3cca8f[_0xac7a('0x10')][_0xac7a('0x12')]);return _0x534bf3(_0x3cca8f['error'][_0xac7a('0x12')]);}else{logger[_0xac7a('0xc')](_0xac7a('0xd'),_0x4e4054,_0xac7a('0xe'));_0x534bf3(_0x3cca8f['result'][_0xac7a('0x12')]);}})[_0xac7a('0x13')](function(_0x36812c){logger[_0xac7a('0x10')](_0xac7a('0xd'),_0x4e4054,_0x36812c);_0x5bd184(_0x36812c);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 83b7d11..7c1cb8a 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 _0x1893=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5b882f,_0x3dd7d6){var _0x3e4055=function(_0x2adaf6){while(--_0x2adaf6){_0x5b882f['push'](_0x5b882f['shift']());}};_0x3e4055(++_0x3dd7d6);}(_0x1893,0x1da));var _0x3189=function(_0x48736b,_0x15ab78){_0x48736b=_0x48736b-0x0;var _0x144d7f=_0x1893[_0x48736b];return _0x144d7f;};'use strict';var multer=require('multer');var util=require(_0x3189('0x0'));var path=require(_0x3189('0x1'));var timeout=require(_0x3189('0x2'));var express=require(_0x3189('0x3'));var router=express[_0x3189('0x4')]();var fs_extra=require(_0x3189('0x5'));var auth=require(_0x3189('0x6'));var interaction=require(_0x3189('0x7'));var config=require(_0x3189('0x8'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x3189('0x9')](),controller[_0x3189('0xa')]);router[_0x3189('0xb')](_0x3189('0xc'),auth[_0x3189('0x9')](),controller[_0x3189('0xd')]);router[_0x3189('0xe')]('/',auth[_0x3189('0x9')](),controller['create']);router[_0x3189('0xf')](_0x3189('0xc'),auth['isAuthenticated'](),controller[_0x3189('0x10')]);router[_0x3189('0x11')](_0x3189('0xc'),auth['isAuthenticated'](),controller[_0x3189('0x12')]);module[_0x3189('0x13')]=router; \ No newline at end of file +var _0xc2d3=['../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5a939c,_0x47b042){var _0x4621ec=function(_0xe25072){while(--_0xe25072){_0x5a939c['push'](_0x5a939c['shift']());}};_0x4621ec(++_0x47b042);}(_0xc2d3,0x1c5));var _0x3c2d=function(_0x3e6dce,_0x4f6fa1){_0x3e6dce=_0x3e6dce-0x0;var _0x1e78b3=_0xc2d3[_0x3e6dce];return _0x1e78b3;};'use strict';var multer=require(_0x3c2d('0x0'));var util=require(_0x3c2d('0x1'));var path=require(_0x3c2d('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c2d('0x3'));var router=express[_0x3c2d('0x4')]();var fs_extra=require(_0x3c2d('0x5'));var auth=require(_0x3c2d('0x6'));var interaction=require(_0x3c2d('0x7'));var config=require('../../config/environment');var controller=require(_0x3c2d('0x8'));router[_0x3c2d('0x9')]('/',auth[_0x3c2d('0xa')](),controller['index']);router['get'](_0x3c2d('0xb'),auth[_0x3c2d('0xa')](),controller[_0x3c2d('0xc')]);router[_0x3c2d('0xd')]('/',auth['isAuthenticated'](),controller[_0x3c2d('0xe')]);router[_0x3c2d('0xf')](_0x3c2d('0xb'),auth[_0x3c2d('0xa')](),controller[_0x3c2d('0x10')]);router[_0x3c2d('0x11')]('/:id',auth[_0x3c2d('0xa')](),controller[_0x3c2d('0x12')]);module[_0x3c2d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e33e4ee..5761551 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 _0xf291=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf291,0x105));var _0x1f29=function(_0x332e12,_0x3d2be9){_0x332e12=_0x332e12-0x0;var _0x5748f5=_0xf291[_0x332e12];return _0x5748f5;};'use strict';var Sequelize=require(_0x1f29('0x0'));module[_0x1f29('0x1')]={'type':{'type':Sequelize[_0x1f29('0x2')](_0x1f29('0x3'),'variable',_0x1f29('0x4'),_0x1f29('0x5'),_0x1f29('0x6')),'defaultValue':_0x1f29('0x3')},'content':{'type':Sequelize[_0x1f29('0x7')]},'key':{'type':Sequelize[_0x1f29('0x7')]},'keyType':{'type':Sequelize[_0x1f29('0x2')](_0x1f29('0x3'),'variable',_0x1f29('0x4'))},'keyContent':{'type':Sequelize[_0x1f29('0x7')]},'idField':{'type':Sequelize[_0x1f29('0x7')]},'nameField':{'type':Sequelize[_0x1f29('0x7')]},'customField':{'type':Sequelize[_0x1f29('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1f29('0x7')]}}; \ No newline at end of file +var _0xc28f=['variable','keyValue','picklist','STRING','string','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x1ea776,_0x5da686){var _0x3d5dcd=function(_0x5a9568){while(--_0x5a9568){_0x1ea776['push'](_0x1ea776['shift']());}};_0x3d5dcd(++_0x5da686);}(_0xc28f,0x147));var _0xfc28=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xc28f[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0xfc28('0x0'));module[_0xfc28('0x1')]={'type':{'type':Sequelize[_0xfc28('0x2')]('string',_0xfc28('0x3'),'customVariable',_0xfc28('0x4'),_0xfc28('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfc28('0x6')]},'keyType':{'type':Sequelize[_0xfc28('0x2')](_0xfc28('0x7'),_0xfc28('0x3'),_0xfc28('0x8'))},'keyContent':{'type':Sequelize[_0xfc28('0x6')]},'idField':{'type':Sequelize[_0xfc28('0x6')]},'nameField':{'type':Sequelize[_0xfc28('0x6')]},'customField':{'type':Sequelize[_0xfc28('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfc28('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index ae90c7f..a4738e3 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 _0x5e4c=['params','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','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','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','ServicenowField','includeAll','include','rows','catch','show'];(function(_0x329ea0,_0x107160){var _0x58fdf8=function(_0x5006d5){while(--_0x5006d5){_0x329ea0['push'](_0x329ea0['shift']());}};_0x58fdf8(++_0x107160);}(_0x5e4c,0x1c1));var _0xc5e4=function(_0x591e98,_0x155604){_0x591e98=_0x591e98-0x0;var _0x333eb8=_0x5e4c[_0x591e98];return _0x333eb8;};'use strict';var emlformat=require(_0xc5e4('0x0'));var rimraf=require(_0xc5e4('0x1'));var zipdir=require(_0xc5e4('0x2'));var jsonpatch=require(_0xc5e4('0x3'));var rp=require('request-promise');var moment=require(_0xc5e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc5e4('0x5'));var util=require(_0xc5e4('0x6'));var path=require('path');var sox=require(_0xc5e4('0x7'));var csv=require(_0xc5e4('0x8'));var ejs=require(_0xc5e4('0x9'));var fs=require('fs');var fs_extra=require(_0xc5e4('0xa'));var _=require(_0xc5e4('0xb'));var squel=require(_0xc5e4('0xc'));var crypto=require(_0xc5e4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc5e4('0xe'));var toCsv=require(_0xc5e4('0x8'));var querystring=require(_0xc5e4('0xf'));var Papa=require('papaparse');var Redis=require(_0xc5e4('0x10'));var authService=require(_0xc5e4('0x11'));var qs=require(_0xc5e4('0x12'));var as=require(_0xc5e4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc5e4('0x14'));var utils=require(_0xc5e4('0x15'));var config=require(_0xc5e4('0x16'));var licenseUtil=require(_0xc5e4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x468292,_0x423c06){_0x423c06=_0x423c06||0xcc;return function(_0x2f3c2c){if(_0x2f3c2c){return _0x468292[_0xc5e4('0x18')](_0x423c06);}return _0x468292[_0xc5e4('0x19')](_0x423c06)['end']();};}function respondWithResult(_0x4bd752,_0x2f26c3){_0x2f26c3=_0x2f26c3||0xc8;return function(_0x3d3e72){if(_0x3d3e72){return _0x4bd752[_0xc5e4('0x19')](_0x2f26c3)['json'](_0x3d3e72);}};}function respondWithFilteredResult(_0x1a781f,_0x2f20bc){return function(_0x3016c8){if(_0x3016c8){var _0x516dfe=typeof _0x2f20bc['offset']===_0xc5e4('0x1a')&&typeof _0x2f20bc[_0xc5e4('0x1b')]===_0xc5e4('0x1a');var _0x5bef65=_0x3016c8[_0xc5e4('0x1c')];var _0x3f2b94=_0x516dfe?0x0:_0x2f20bc[_0xc5e4('0x1d')];var _0x49d45d=_0x516dfe?_0x3016c8[_0xc5e4('0x1c')]:_0x2f20bc[_0xc5e4('0x1d')]+_0x2f20bc[_0xc5e4('0x1b')];var _0x143b7c;if(_0x49d45d>=_0x5bef65){_0x49d45d=_0x5bef65;_0x143b7c=0xc8;}else{_0x143b7c=0xce;}_0x1a781f['status'](_0x143b7c);return _0x1a781f[_0xc5e4('0x1e')](_0xc5e4('0x1f'),_0x3f2b94+'-'+_0x49d45d+'/'+_0x5bef65)[_0xc5e4('0x20')](_0x3016c8);}return null;};}function patchUpdates(_0x4f1bd2){return function(_0x45e25d){try{jsonpatch[_0xc5e4('0x21')](_0x45e25d,_0x4f1bd2,!![]);}catch(_0x520ac2){return BPromise['reject'](_0x520ac2);}return _0x45e25d[_0xc5e4('0x22')]();};}function saveUpdates(_0x1f7ae0,_0x35a762){return function(_0x491489){if(_0x491489){return _0x491489[_0xc5e4('0x23')](_0x1f7ae0)[_0xc5e4('0x24')](function(_0x364942){return _0x364942;});}return null;};}function removeEntity(_0x59c9d1,_0x107148){return function(_0x557004){if(_0x557004){return _0x557004[_0xc5e4('0x25')]()[_0xc5e4('0x24')](function(){_0x59c9d1[_0xc5e4('0x19')](0xcc)[_0xc5e4('0x26')]();});}};}function handleEntityNotFound(_0x535127,_0x4d29f7){return function(_0x14cd50){if(!_0x14cd50){_0x535127[_0xc5e4('0x18')](0x194);}return _0x14cd50;};}function handleError(_0x56da33,_0x1ffa9b){_0x1ffa9b=_0x1ffa9b||0x1f4;return function(_0x1fd31f){logger[_0xc5e4('0x27')](_0x1fd31f[_0xc5e4('0x28')]);if(_0x1fd31f[_0xc5e4('0x29')]){delete _0x1fd31f[_0xc5e4('0x29')];}_0x56da33[_0xc5e4('0x19')](_0x1ffa9b)[_0xc5e4('0x2a')](_0x1fd31f);};}exports[_0xc5e4('0x2b')]=function(_0x2c85c6,_0x50dab8){var _0xbe926={},_0x397a32={},_0x3424fa={'count':0x0,'rows':[]};var _0x45a438=_[_0xc5e4('0x2c')](db['ServicenowField']['rawAttributes'],function(_0x1a810f){return{'name':_0x1a810f['fieldName'],'type':_0x1a810f[_0xc5e4('0x2d')][_0xc5e4('0x2e')]};});_0x397a32[_0xc5e4('0x2f')]=_[_0xc5e4('0x2c')](_0x45a438,_0xc5e4('0x29'));_0x397a32[_0xc5e4('0x30')]=_[_0xc5e4('0x31')](_0x2c85c6[_0xc5e4('0x30')]);_0x397a32[_0xc5e4('0x32')]=_[_0xc5e4('0x33')](_0x397a32[_0xc5e4('0x2f')],_0x397a32['query']);_0xbe926[_0xc5e4('0x34')]=_[_0xc5e4('0x33')](_0x397a32[_0xc5e4('0x2f')],qs[_0xc5e4('0x35')](_0x2c85c6[_0xc5e4('0x30')][_0xc5e4('0x35')]));_0xbe926['attributes']=_0xbe926[_0xc5e4('0x34')]['length']?_0xbe926['attributes']:_0x397a32['model'];if(!_0x2c85c6[_0xc5e4('0x30')][_0xc5e4('0x36')](_0xc5e4('0x37'))){_0xbe926['limit']=qs[_0xc5e4('0x1b')](_0x2c85c6[_0xc5e4('0x30')]['limit']);_0xbe926['offset']=qs[_0xc5e4('0x1d')](_0x2c85c6['query']['offset']);}_0xbe926['order']=qs['sort'](_0x2c85c6[_0xc5e4('0x30')][_0xc5e4('0x38')]);_0xbe926[_0xc5e4('0x39')]=qs[_0xc5e4('0x32')](_[_0xc5e4('0x3a')](_0x2c85c6['query'],_0x397a32['filters']),_0x45a438);if(_0x2c85c6[_0xc5e4('0x30')]['filter']){_0xbe926[_0xc5e4('0x39')]=_['merge'](_0xbe926[_0xc5e4('0x39')],{'$or':_[_0xc5e4('0x2c')](_0x45a438,function(_0x518706){if(_0x518706[_0xc5e4('0x2d')]!==_0xc5e4('0x3b')){var _0x31ebcc={};_0x31ebcc[_0x518706['name']]={'$like':'%'+_0x2c85c6[_0xc5e4('0x30')][_0xc5e4('0x3c')]+'%'};return _0x31ebcc;}})});}_0xbe926=_[_0xc5e4('0x3d')]({},_0xbe926,_0x2c85c6[_0xc5e4('0x3e')]);var _0x2f6f52={'where':_0xbe926[_0xc5e4('0x39')]};return db[_0xc5e4('0x3f')][_0xc5e4('0x1c')](_0x2f6f52)['then'](function(_0x35d4c7){_0x3424fa[_0xc5e4('0x1c')]=_0x35d4c7;if(_0x2c85c6[_0xc5e4('0x30')][_0xc5e4('0x40')]){_0xbe926[_0xc5e4('0x41')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0xbe926);})[_0xc5e4('0x24')](function(_0x2ef6c1){_0x3424fa[_0xc5e4('0x42')]=_0x2ef6c1;return _0x3424fa;})['then'](respondWithFilteredResult(_0x50dab8,_0xbe926))[_0xc5e4('0x43')](handleError(_0x50dab8,null));};exports[_0xc5e4('0x44')]=function(_0x3c45aa,_0x417170){var _0x44b41b={'raw':!![],'where':{'id':_0x3c45aa[_0xc5e4('0x45')]['id']}},_0x320ec9={};_0x320ec9[_0xc5e4('0x2f')]=_[_0xc5e4('0x31')](db[_0xc5e4('0x3f')]['rawAttributes']);_0x320ec9[_0xc5e4('0x30')]=_[_0xc5e4('0x31')](_0x3c45aa[_0xc5e4('0x30')]);_0x320ec9[_0xc5e4('0x32')]=_['intersection'](_0x320ec9[_0xc5e4('0x2f')],_0x320ec9['query']);_0x44b41b[_0xc5e4('0x34')]=_[_0xc5e4('0x33')](_0x320ec9['model'],qs[_0xc5e4('0x35')](_0x3c45aa[_0xc5e4('0x30')][_0xc5e4('0x35')]));_0x44b41b[_0xc5e4('0x34')]=_0x44b41b[_0xc5e4('0x34')][_0xc5e4('0x46')]?_0x44b41b[_0xc5e4('0x34')]:_0x320ec9['model'];if(_0x3c45aa[_0xc5e4('0x30')]['includeAll']){_0x44b41b[_0xc5e4('0x41')]=[{'all':!![]}];}_0x44b41b=_[_0xc5e4('0x3d')]({},_0x44b41b,_0x3c45aa['options']);return db[_0xc5e4('0x3f')]['find'](_0x44b41b)[_0xc5e4('0x24')](handleEntityNotFound(_0x417170,null))[_0xc5e4('0x24')](respondWithResult(_0x417170,null))[_0xc5e4('0x43')](handleError(_0x417170,null));};exports[_0xc5e4('0x47')]=function(_0x29e247,_0xe1ddf3){return db[_0xc5e4('0x3f')][_0xc5e4('0x47')](_0x29e247['body'],{})[_0xc5e4('0x24')](respondWithResult(_0xe1ddf3,0xc9))['catch'](handleError(_0xe1ddf3,null));};exports['update']=function(_0x4f3be6,_0x29309a){if(_0x4f3be6[_0xc5e4('0x48')]['id']){delete _0x4f3be6[_0xc5e4('0x48')]['id'];}return db['ServicenowField'][_0xc5e4('0x49')]({'where':{'id':_0x4f3be6['params']['id']}})[_0xc5e4('0x24')](handleEntityNotFound(_0x29309a,null))[_0xc5e4('0x24')](saveUpdates(_0x4f3be6[_0xc5e4('0x48')],null))[_0xc5e4('0x24')](respondWithResult(_0x29309a,null))[_0xc5e4('0x43')](handleError(_0x29309a,null));};exports['destroy']=function(_0x4e18ca,_0x4a81ef){return db[_0xc5e4('0x3f')][_0xc5e4('0x49')]({'where':{'id':_0x4e18ca[_0xc5e4('0x45')]['id']}})[_0xc5e4('0x24')](handleEntityNotFound(_0x4a81ef,null))[_0xc5e4('0x24')](removeEntity(_0x4a81ef,null))[_0xc5e4('0x43')](handleError(_0x4a81ef,null));}; \ No newline at end of file +var _0xf449=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','ServicenowField','type','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','keys','rawAttributes','length','includeAll','find','create','body','catch','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xf449,0x16f));var _0x9f44=function(_0x10c633,_0x3c2958){_0x10c633=_0x10c633-0x0;var _0x3ee994=_0xf449[_0x10c633];return _0x3ee994;};'use strict';var emlformat=require(_0x9f44('0x0'));var rimraf=require(_0x9f44('0x1'));var zipdir=require(_0x9f44('0x2'));var jsonpatch=require(_0x9f44('0x3'));var rp=require(_0x9f44('0x4'));var moment=require('moment');var BPromise=require(_0x9f44('0x5'));var Mustache=require(_0x9f44('0x6'));var util=require(_0x9f44('0x7'));var path=require(_0x9f44('0x8'));var sox=require(_0x9f44('0x9'));var csv=require(_0x9f44('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f44('0xb'));var _=require(_0x9f44('0xc'));var squel=require(_0x9f44('0xd'));var crypto=require(_0x9f44('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9f44('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9f44('0x10'));var Papa=require(_0x9f44('0x11'));var Redis=require(_0x9f44('0x12'));var authService=require(_0x9f44('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9f44('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f44('0x15'))(_0x9f44('0x16'));var utils=require(_0x9f44('0x17'));var config=require(_0x9f44('0x18'));var licenseUtil=require(_0x9f44('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x62b6b9,_0x5d3f02){_0x5d3f02=_0x5d3f02||0xcc;return function(_0x2f4a4d){if(_0x2f4a4d){return _0x62b6b9[_0x9f44('0x1a')](_0x5d3f02);}return _0x62b6b9[_0x9f44('0x1b')](_0x5d3f02)[_0x9f44('0x1c')]();};}function respondWithResult(_0x4e5dda,_0xe90942){_0xe90942=_0xe90942||0xc8;return function(_0x11f309){if(_0x11f309){return _0x4e5dda[_0x9f44('0x1b')](_0xe90942)[_0x9f44('0x1d')](_0x11f309);}};}function respondWithFilteredResult(_0x412bbc,_0x24f7fc){return function(_0x1985fd){if(_0x1985fd){var _0x393210=typeof _0x24f7fc[_0x9f44('0x1e')]===_0x9f44('0x1f')&&typeof _0x24f7fc[_0x9f44('0x20')]===_0x9f44('0x1f');var _0x128942=_0x1985fd[_0x9f44('0x21')];var _0x36c9a2=_0x393210?0x0:_0x24f7fc[_0x9f44('0x1e')];var _0x4ff3ab=_0x393210?_0x1985fd['count']:_0x24f7fc['offset']+_0x24f7fc[_0x9f44('0x20')];var _0x443325;if(_0x4ff3ab>=_0x128942){_0x4ff3ab=_0x128942;_0x443325=0xc8;}else{_0x443325=0xce;}_0x412bbc['status'](_0x443325);return _0x412bbc[_0x9f44('0x22')](_0x9f44('0x23'),_0x36c9a2+'-'+_0x4ff3ab+'/'+_0x128942)[_0x9f44('0x1d')](_0x1985fd);}return null;};}function patchUpdates(_0x1807eb){return function(_0x2f2b1a){try{jsonpatch[_0x9f44('0x24')](_0x2f2b1a,_0x1807eb,!![]);}catch(_0x272186){return BPromise[_0x9f44('0x25')](_0x272186);}return _0x2f2b1a[_0x9f44('0x26')]();};}function saveUpdates(_0x17833f,_0x176d5d){return function(_0x39411c){if(_0x39411c){return _0x39411c['update'](_0x17833f)[_0x9f44('0x27')](function(_0x43f195){return _0x43f195;});}return null;};}function removeEntity(_0x5f4460,_0xc09e56){return function(_0x2d8cd5){if(_0x2d8cd5){return _0x2d8cd5[_0x9f44('0x28')]()[_0x9f44('0x27')](function(){_0x5f4460[_0x9f44('0x1b')](0xcc)[_0x9f44('0x1c')]();});}};}function handleEntityNotFound(_0x5bd24d,_0x51b1f5){return function(_0x4be70f){if(!_0x4be70f){_0x5bd24d[_0x9f44('0x1a')](0x194);}return _0x4be70f;};}function handleError(_0x3ef53c,_0x5b538c){_0x5b538c=_0x5b538c||0x1f4;return function(_0x454f9f){logger[_0x9f44('0x29')](_0x454f9f[_0x9f44('0x2a')]);if(_0x454f9f[_0x9f44('0x2b')]){delete _0x454f9f[_0x9f44('0x2b')];}_0x3ef53c[_0x9f44('0x1b')](_0x5b538c)[_0x9f44('0x2c')](_0x454f9f);};}exports['index']=function(_0x3e5376,_0xdeffa3){var _0x5c7936={},_0x29e995={},_0x70cb43={'count':0x0,'rows':[]};var _0x4dd7ef=_[_0x9f44('0x2d')](db[_0x9f44('0x2e')]['rawAttributes'],function(_0x391f21){return{'name':_0x391f21['fieldName'],'type':_0x391f21[_0x9f44('0x2f')]['key']};});_0x29e995['model']=_[_0x9f44('0x2d')](_0x4dd7ef,_0x9f44('0x2b'));_0x29e995[_0x9f44('0x30')]=_['keys'](_0x3e5376[_0x9f44('0x30')]);_0x29e995[_0x9f44('0x31')]=_['intersection'](_0x29e995['model'],_0x29e995[_0x9f44('0x30')]);_0x5c7936[_0x9f44('0x32')]=_[_0x9f44('0x33')](_0x29e995[_0x9f44('0x34')],qs[_0x9f44('0x35')](_0x3e5376['query'][_0x9f44('0x35')]));_0x5c7936[_0x9f44('0x32')]=_0x5c7936[_0x9f44('0x32')]['length']?_0x5c7936[_0x9f44('0x32')]:_0x29e995[_0x9f44('0x34')];if(!_0x3e5376[_0x9f44('0x30')][_0x9f44('0x36')](_0x9f44('0x37'))){_0x5c7936[_0x9f44('0x20')]=qs[_0x9f44('0x20')](_0x3e5376[_0x9f44('0x30')]['limit']);_0x5c7936['offset']=qs[_0x9f44('0x1e')](_0x3e5376[_0x9f44('0x30')]['offset']);}_0x5c7936[_0x9f44('0x38')]=qs[_0x9f44('0x39')](_0x3e5376[_0x9f44('0x30')][_0x9f44('0x39')]);_0x5c7936[_0x9f44('0x3a')]=qs[_0x9f44('0x31')](_['pick'](_0x3e5376[_0x9f44('0x30')],_0x29e995[_0x9f44('0x31')]),_0x4dd7ef);if(_0x3e5376[_0x9f44('0x30')]['filter']){_0x5c7936[_0x9f44('0x3a')]=_[_0x9f44('0x3b')](_0x5c7936['where'],{'$or':_[_0x9f44('0x2d')](_0x4dd7ef,function(_0x4ee07e){if(_0x4ee07e['type']!==_0x9f44('0x3c')){var _0x3fc0a4={};_0x3fc0a4[_0x4ee07e[_0x9f44('0x2b')]]={'$like':'%'+_0x3e5376[_0x9f44('0x30')][_0x9f44('0x3d')]+'%'};return _0x3fc0a4;}})});}_0x5c7936=_[_0x9f44('0x3b')]({},_0x5c7936,_0x3e5376[_0x9f44('0x3e')]);var _0x30bd9a={'where':_0x5c7936['where']};return db[_0x9f44('0x2e')][_0x9f44('0x21')](_0x30bd9a)[_0x9f44('0x27')](function(_0x2f0af6){_0x70cb43[_0x9f44('0x21')]=_0x2f0af6;if(_0x3e5376['query']['includeAll']){_0x5c7936[_0x9f44('0x3f')]=[{'all':!![]}];}return db[_0x9f44('0x2e')][_0x9f44('0x40')](_0x5c7936);})['then'](function(_0x124fd8){_0x70cb43[_0x9f44('0x41')]=_0x124fd8;return _0x70cb43;})[_0x9f44('0x27')](respondWithFilteredResult(_0xdeffa3,_0x5c7936))['catch'](handleError(_0xdeffa3,null));};exports['show']=function(_0x4e40ea,_0x52637a){var _0x3b5d29={'raw':!![],'where':{'id':_0x4e40ea['params']['id']}},_0x25482c={};_0x25482c[_0x9f44('0x34')]=_[_0x9f44('0x42')](db[_0x9f44('0x2e')][_0x9f44('0x43')]);_0x25482c[_0x9f44('0x30')]=_['keys'](_0x4e40ea['query']);_0x25482c[_0x9f44('0x31')]=_[_0x9f44('0x33')](_0x25482c[_0x9f44('0x34')],_0x25482c[_0x9f44('0x30')]);_0x3b5d29['attributes']=_[_0x9f44('0x33')](_0x25482c['model'],qs[_0x9f44('0x35')](_0x4e40ea[_0x9f44('0x30')][_0x9f44('0x35')]));_0x3b5d29['attributes']=_0x3b5d29['attributes'][_0x9f44('0x44')]?_0x3b5d29[_0x9f44('0x32')]:_0x25482c[_0x9f44('0x34')];if(_0x4e40ea[_0x9f44('0x30')][_0x9f44('0x45')]){_0x3b5d29['include']=[{'all':!![]}];}_0x3b5d29=_[_0x9f44('0x3b')]({},_0x3b5d29,_0x4e40ea[_0x9f44('0x3e')]);return db['ServicenowField'][_0x9f44('0x46')](_0x3b5d29)[_0x9f44('0x27')](handleEntityNotFound(_0x52637a,null))[_0x9f44('0x27')](respondWithResult(_0x52637a,null))['catch'](handleError(_0x52637a,null));};exports[_0x9f44('0x47')]=function(_0x541226,_0x4e66a4){return db[_0x9f44('0x2e')]['create'](_0x541226[_0x9f44('0x48')],{})[_0x9f44('0x27')](respondWithResult(_0x4e66a4,0xc9))[_0x9f44('0x49')](handleError(_0x4e66a4,null));};exports[_0x9f44('0x4a')]=function(_0x5f4c11,_0x83f4cf){if(_0x5f4c11[_0x9f44('0x48')]['id']){delete _0x5f4c11[_0x9f44('0x48')]['id'];}return db[_0x9f44('0x2e')][_0x9f44('0x46')]({'where':{'id':_0x5f4c11[_0x9f44('0x4b')]['id']}})[_0x9f44('0x27')](handleEntityNotFound(_0x83f4cf,null))[_0x9f44('0x27')](saveUpdates(_0x5f4c11[_0x9f44('0x48')],null))[_0x9f44('0x27')](respondWithResult(_0x83f4cf,null))[_0x9f44('0x49')](handleError(_0x83f4cf,null));};exports[_0x9f44('0x28')]=function(_0xd19f58,_0x5037ca){return db[_0x9f44('0x2e')][_0x9f44('0x46')]({'where':{'id':_0xd19f58[_0x9f44('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5037ca,null))[_0x9f44('0x27')](removeEntity(_0x5037ca,null))[_0x9f44('0x49')](handleError(_0x5037ca,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 0ce6447..7e1a10f 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 _0x22e6=['path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22e6,0x19a));var _0x622e=function(_0x38133c,_0x2748cb){_0x38133c=_0x38133c-0x0;var _0x39bdde=_0x22e6[_0x38133c];return _0x39bdde;};'use strict';var _=require('lodash');var util=require(_0x622e('0x0'));var logger=require(_0x622e('0x1'))(_0x622e('0x2'));var moment=require(_0x622e('0x3'));var BPromise=require(_0x622e('0x4'));var rp=require(_0x622e('0x5'));var fs=require('fs');var path=require(_0x622e('0x6'));var rimraf=require(_0x622e('0x7'));var config=require('../../config/environment');var attributes=require(_0x622e('0x8'));module[_0x622e('0x9')]=function(_0x1206c1,_0x1f21ea){return _0x1206c1[_0x622e('0xa')](_0x622e('0xb'),attributes,{'tableName':_0x622e('0xc'),'paranoid':![],'indexes':[{'name':_0x622e('0xd'),'fields':[_0x622e('0xe'),_0x622e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd314=['servicenow_unique_index','idField','FieldId','lodash','util','moment','../../config/environment','./intServicenowField.attributes','define','int_servicenow_fields'];(function(_0x1fbb33,_0x32584c){var _0x14e0de=function(_0x14115f){while(--_0x14115f){_0x1fbb33['push'](_0x1fbb33['shift']());}};_0x14e0de(++_0x32584c);}(_0xd314,0xcb));var _0x4d31=function(_0x5cb278,_0x1d2a74){_0x5cb278=_0x5cb278-0x0;var _0x33abb6=_0xd314[_0x5cb278];return _0x33abb6;};'use strict';var _=require(_0x4d31('0x0'));var util=require(_0x4d31('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4d31('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4d31('0x3'));var attributes=require(_0x4d31('0x4'));module['exports']=function(_0x160f83,_0x5523f4){return _0x160f83[_0x4d31('0x5')]('ServicenowField',attributes,{'tableName':_0x4d31('0x6'),'paranoid':![],'indexes':[{'name':_0x4d31('0x7'),'fields':[_0x4d31('0x8'),_0x4d31('0x9')],'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 33a9221..1881ffb 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x4d4ab3,_0x4ccbd8){var _0x44e204=function(_0xf2ba88){while(--_0xf2ba88){_0x4d4ab3['push'](_0x4d4ab3['shift']());}};_0x44e204(++_0x4ccbd8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x42188e,_0x473ad1){var _0x45de1a=function(_0x3d5a03){while(--_0x3d5a03){_0x42188e['push'](_0x42188e['shift']());}};_0x45de1a(++_0x473ad1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xcb91[_0x39f34f];return _0x59fee1;};'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')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 4d5a1d5..35ce7a7 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x227aac,_0x460a2c){var _0x29bda1=function(_0x2840e4){while(--_0x2840e4){_0x227aac['push'](_0x227aac['shift']());}};_0x29bda1(++_0x460a2c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x44dc32,_0x3fca3b){var _0xa2f21=function(_0x19b7e7){while(--_0x19b7e7){_0x44dc32['push'](_0x44dc32['shift']());}};_0xa2f21(++_0x3fca3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 1c572ed..beb08e1 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(_0x49faf1,_0x1181b1){var _0x2770d7=function(_0xeecb2c){while(--_0xeecb2c){_0x49faf1['push'](_0x49faf1['shift']());}};_0x2770d7(++_0x1181b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x419d94,_0x25d36a){var _0x188867=function(_0x49a7f5){while(--_0x49a7f5){_0x419d94['push'](_0x419d94['shift']());}};_0x188867(++_0x25d36a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 97b3c99..6f3f393 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 _0xb693=['rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body','params','getConfigurations','keys','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','findOne','username','password','remoteUri','slice','lastIndexOf','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','POST','format','get_module_fields','values','remove','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','reject','save','update','then','stack','name','send','index','map','SugarcrmAccount'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xb693,0x139));var _0x3b69=function(_0x3e8930,_0x154364){_0x3e8930=_0x3e8930-0x0;var _0x15b38f=_0xb693[_0x3e8930];return _0x15b38f;};'use strict';var emlformat=require(_0x3b69('0x0'));var rimraf=require(_0x3b69('0x1'));var zipdir=require(_0x3b69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b69('0x3'));var moment=require(_0x3b69('0x4'));var BPromise=require(_0x3b69('0x5'));var Mustache=require('mustache');var util=require(_0x3b69('0x6'));var path=require(_0x3b69('0x7'));var sox=require('sox');var csv=require(_0x3b69('0x8'));var ejs=require(_0x3b69('0x9'));var fs=require('fs');var fs_extra=require(_0x3b69('0xa'));var _=require(_0x3b69('0xb'));var squel=require(_0x3b69('0xc'));var crypto=require(_0x3b69('0xd'));var jsforce=require(_0x3b69('0xe'));var deskjs=require(_0x3b69('0xf'));var toCsv=require(_0x3b69('0x8'));var querystring=require(_0x3b69('0x10'));var Papa=require('papaparse');var Redis=require(_0x3b69('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b69('0x12'));var hardwareService=require(_0x3b69('0x13'));var logger=require(_0x3b69('0x14'))(_0x3b69('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3b69('0x16'))['db'];var integrations=require(_0x3b69('0x17'));function respondWithStatusCode(_0x160633,_0x33d865){_0x33d865=_0x33d865||0xcc;return function(_0x45e612){if(_0x45e612){return _0x160633[_0x3b69('0x18')](_0x33d865);}return _0x160633[_0x3b69('0x19')](_0x33d865)[_0x3b69('0x1a')]();};}function respondWithResult(_0x3e2a29,_0x4c83da){_0x4c83da=_0x4c83da||0xc8;return function(_0x17373f){if(_0x17373f){return _0x3e2a29['status'](_0x4c83da)[_0x3b69('0x1b')](_0x17373f);}};}function respondWithFilteredResult(_0x53cbc0,_0x36bfe9){return function(_0x49126c){if(_0x49126c){var _0x1def9c=typeof _0x36bfe9['offset']===_0x3b69('0x1c')&&typeof _0x36bfe9['limit']===_0x3b69('0x1c');var _0x5312d4=_0x49126c[_0x3b69('0x1d')];var _0x23d770=_0x1def9c?0x0:_0x36bfe9[_0x3b69('0x1e')];var _0x2283a3=_0x1def9c?_0x49126c[_0x3b69('0x1d')]:_0x36bfe9[_0x3b69('0x1e')]+_0x36bfe9['limit'];var _0xbc30ae;if(_0x2283a3>=_0x5312d4){_0x2283a3=_0x5312d4;_0xbc30ae=0xc8;}else{_0xbc30ae=0xce;}_0x53cbc0['status'](_0xbc30ae);return _0x53cbc0['set']('Content-Range',_0x23d770+'-'+_0x2283a3+'/'+_0x5312d4)[_0x3b69('0x1b')](_0x49126c);}return null;};}function patchUpdates(_0x44c702){return function(_0x2c78ba){try{jsonpatch['apply'](_0x2c78ba,_0x44c702,!![]);}catch(_0x192a63){return BPromise[_0x3b69('0x1f')](_0x192a63);}return _0x2c78ba[_0x3b69('0x20')]();};}function saveUpdates(_0x4cd4de,_0x1f0179){return function(_0x238bb0){if(_0x238bb0){return _0x238bb0[_0x3b69('0x21')](_0x4cd4de)[_0x3b69('0x22')](function(_0x1c7bea){return _0x1c7bea;});}return null;};}function removeEntity(_0x8bf82b,_0x3d46d9){return function(_0x4c6d7a){if(_0x4c6d7a){return _0x4c6d7a['destroy']()[_0x3b69('0x22')](function(){_0x8bf82b[_0x3b69('0x19')](0xcc)[_0x3b69('0x1a')]();});}};}function handleEntityNotFound(_0x1982ae,_0x1d45bd){return function(_0x1b552d){if(!_0x1b552d){_0x1982ae[_0x3b69('0x18')](0x194);}return _0x1b552d;};}function handleError(_0x5bb15b,_0x582c29){_0x582c29=_0x582c29||0x1f4;return function(_0x155017){logger['error'](_0x155017[_0x3b69('0x23')]);if(_0x155017['name']){delete _0x155017[_0x3b69('0x24')];}_0x5bb15b[_0x3b69('0x19')](_0x582c29)[_0x3b69('0x25')](_0x155017);};}exports[_0x3b69('0x26')]=function(_0x42a897,_0x26ddd2){var _0x2c309b={},_0xbc6ca3={},_0x7e4c15={'count':0x0,'rows':[]};var _0x241f2b=_[_0x3b69('0x27')](db[_0x3b69('0x28')][_0x3b69('0x29')],function(_0xcad726){return{'name':_0xcad726['fieldName'],'type':_0xcad726[_0x3b69('0x2a')]['key']};});_0xbc6ca3[_0x3b69('0x2b')]=_[_0x3b69('0x27')](_0x241f2b,_0x3b69('0x24'));_0xbc6ca3[_0x3b69('0x2c')]=_['keys'](_0x42a897['query']);_0xbc6ca3[_0x3b69('0x2d')]=_[_0x3b69('0x2e')](_0xbc6ca3[_0x3b69('0x2b')],_0xbc6ca3[_0x3b69('0x2c')]);_0x2c309b[_0x3b69('0x2f')]=_[_0x3b69('0x2e')](_0xbc6ca3['model'],qs['fields'](_0x42a897[_0x3b69('0x2c')][_0x3b69('0x30')]));_0x2c309b[_0x3b69('0x2f')]=_0x2c309b[_0x3b69('0x2f')][_0x3b69('0x31')]?_0x2c309b[_0x3b69('0x2f')]:_0xbc6ca3[_0x3b69('0x2b')];if(!_0x42a897[_0x3b69('0x2c')]['hasOwnProperty'](_0x3b69('0x32'))){_0x2c309b[_0x3b69('0x33')]=qs[_0x3b69('0x33')](_0x42a897['query'][_0x3b69('0x33')]);_0x2c309b[_0x3b69('0x1e')]=qs[_0x3b69('0x1e')](_0x42a897[_0x3b69('0x2c')]['offset']);}_0x2c309b[_0x3b69('0x34')]=qs[_0x3b69('0x35')](_0x42a897['query'][_0x3b69('0x35')]);_0x2c309b[_0x3b69('0x36')]=qs[_0x3b69('0x2d')](_[_0x3b69('0x37')](_0x42a897[_0x3b69('0x2c')],_0xbc6ca3[_0x3b69('0x2d')]),_0x241f2b);if(_0x42a897['query'][_0x3b69('0x38')]){_0x2c309b['where']=_[_0x3b69('0x39')](_0x2c309b[_0x3b69('0x36')],{'$or':_['map'](_0x241f2b,function(_0x9c2fcc){if(_0x9c2fcc[_0x3b69('0x2a')]!==_0x3b69('0x3a')){var _0x3b05c6={};_0x3b05c6[_0x9c2fcc[_0x3b69('0x24')]]={'$like':'%'+_0x42a897['query'][_0x3b69('0x38')]+'%'};return _0x3b05c6;}})});}_0x2c309b=_[_0x3b69('0x39')]({},_0x2c309b,_0x42a897[_0x3b69('0x3b')]);var _0x4c9474={'where':_0x2c309b['where']};return db[_0x3b69('0x28')][_0x3b69('0x1d')](_0x4c9474)[_0x3b69('0x22')](function(_0x233b1c){_0x7e4c15[_0x3b69('0x1d')]=_0x233b1c;if(_0x42a897[_0x3b69('0x2c')][_0x3b69('0x3c')]){_0x2c309b[_0x3b69('0x3d')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x3b69('0x3e')](_0x2c309b);})['then'](function(_0x2d24db){_0x7e4c15[_0x3b69('0x3f')]=_0x2d24db;return _0x7e4c15;})[_0x3b69('0x22')](respondWithFilteredResult(_0x26ddd2,_0x2c309b))[_0x3b69('0x40')](handleError(_0x26ddd2,null));};exports[_0x3b69('0x41')]=function(_0x1e1ea9,_0x741e7){var _0x10e13a={'raw':![],'where':{'id':_0x1e1ea9['params']['id']}},_0xe32e04={};_0xe32e04['model']=_['keys'](db[_0x3b69('0x28')][_0x3b69('0x29')]);_0xe32e04['query']=_['keys'](_0x1e1ea9[_0x3b69('0x2c')]);_0xe32e04[_0x3b69('0x2d')]=_[_0x3b69('0x2e')](_0xe32e04[_0x3b69('0x2b')],_0xe32e04['query']);_0x10e13a[_0x3b69('0x2f')]=_[_0x3b69('0x2e')](_0xe32e04[_0x3b69('0x2b')],qs[_0x3b69('0x30')](_0x1e1ea9[_0x3b69('0x2c')][_0x3b69('0x30')]));_0x10e13a['attributes']=_0x10e13a['attributes'][_0x3b69('0x31')]?_0x10e13a[_0x3b69('0x2f')]:_0xe32e04['model'];if(_0x1e1ea9[_0x3b69('0x2c')][_0x3b69('0x3c')]){_0x10e13a[_0x3b69('0x3d')]=[{'all':!![]}];}_0x10e13a=_[_0x3b69('0x39')]({},_0x10e13a,_0x1e1ea9[_0x3b69('0x3b')]);return db[_0x3b69('0x28')][_0x3b69('0x42')](_0x10e13a)[_0x3b69('0x22')](handleEntityNotFound(_0x741e7,null))[_0x3b69('0x22')](respondWithResult(_0x741e7,null))[_0x3b69('0x40')](handleError(_0x741e7,null));};exports['create']=function(_0x42d84d,_0x4faf1b){return db['SugarcrmAccount']['create'](_0x42d84d[_0x3b69('0x43')],{})['then'](respondWithResult(_0x4faf1b,0xc9))[_0x3b69('0x40')](handleError(_0x4faf1b,null));};exports['update']=function(_0x55500f,_0x404aef){if(_0x55500f[_0x3b69('0x43')]['id']){delete _0x55500f[_0x3b69('0x43')]['id'];}return db[_0x3b69('0x28')][_0x3b69('0x42')]({'where':{'id':_0x55500f[_0x3b69('0x44')]['id']}})[_0x3b69('0x22')](handleEntityNotFound(_0x404aef,null))[_0x3b69('0x22')](saveUpdates(_0x55500f[_0x3b69('0x43')],null))[_0x3b69('0x22')](respondWithResult(_0x404aef,null))[_0x3b69('0x40')](handleError(_0x404aef,null));};exports['destroy']=function(_0x40e6e6,_0x2a1625){return db[_0x3b69('0x28')][_0x3b69('0x42')]({'where':{'id':_0x40e6e6[_0x3b69('0x44')]['id']}})[_0x3b69('0x22')](handleEntityNotFound(_0x2a1625,null))[_0x3b69('0x22')](removeEntity(_0x2a1625,null))[_0x3b69('0x40')](handleError(_0x2a1625,null));};exports[_0x3b69('0x45')]=function(_0x49f3d4,_0x25d0e7,_0x30cddb){var _0x46c85b={};var _0x3952be={};var _0x164805;var _0x44585b;return db[_0x3b69('0x28')]['findOne']({'where':{'id':_0x49f3d4[_0x3b69('0x44')]['id']}})['then'](handleEntityNotFound(_0x25d0e7,null))[_0x3b69('0x22')](function(_0xfcd231){if(_0xfcd231){_0x164805=_0xfcd231;_0x3952be['model']=_[_0x3b69('0x46')](db[_0x3b69('0x47')][_0x3b69('0x29')]);_0x3952be[_0x3b69('0x2c')]=_[_0x3b69('0x46')](_0x49f3d4['query']);_0x3952be[_0x3b69('0x2d')]=_['intersection'](_0x3952be[_0x3b69('0x2b')],_0x3952be['query']);_0x46c85b[_0x3b69('0x2f')]=_[_0x3b69('0x2e')](_0x3952be['model'],qs[_0x3b69('0x30')](_0x49f3d4[_0x3b69('0x2c')]['fields']));_0x46c85b[_0x3b69('0x2f')]=_0x46c85b[_0x3b69('0x2f')]['length']?_0x46c85b[_0x3b69('0x2f')]:_0x3952be['model'];_0x46c85b[_0x3b69('0x34')]=qs[_0x3b69('0x35')](_0x49f3d4[_0x3b69('0x2c')][_0x3b69('0x35')]);_0x46c85b[_0x3b69('0x36')]=qs[_0x3b69('0x2d')](_[_0x3b69('0x37')](_0x49f3d4[_0x3b69('0x2c')],_0x3952be[_0x3b69('0x2d')]));if(_0x49f3d4[_0x3b69('0x2c')][_0x3b69('0x38')]){_0x46c85b[_0x3b69('0x36')]=_[_0x3b69('0x39')](_0x46c85b[_0x3b69('0x36')],{'$or':_[_0x3b69('0x27')](_0x46c85b[_0x3b69('0x2f')],function(_0x4756f9){var _0x5a0dc2={};_0x5a0dc2[_0x4756f9]={'$like':'%'+_0x49f3d4[_0x3b69('0x2c')]['filter']+'%'};return _0x5a0dc2;})});}_0x46c85b=_[_0x3b69('0x39')]({},_0x46c85b,_0x49f3d4[_0x3b69('0x3b')]);return _0x164805[_0x3b69('0x45')](_0x46c85b);}})[_0x3b69('0x22')](function(_0x266769){if(_0x266769){_0x44585b=_0x266769[_0x3b69('0x31')];if(!_0x49f3d4[_0x3b69('0x2c')][_0x3b69('0x48')](_0x3b69('0x32'))){_0x46c85b[_0x3b69('0x33')]=qs[_0x3b69('0x33')](_0x49f3d4[_0x3b69('0x2c')][_0x3b69('0x33')]);_0x46c85b[_0x3b69('0x1e')]=qs[_0x3b69('0x1e')](_0x49f3d4[_0x3b69('0x2c')][_0x3b69('0x1e')]);}return _0x164805[_0x3b69('0x45')](_0x46c85b);}})['then'](function(_0x25c3d7){if(_0x25c3d7){return _0x25c3d7?{'count':_0x44585b,'rows':_0x25c3d7}:null;}})[_0x3b69('0x22')](respondWithResult(_0x25d0e7,null))[_0x3b69('0x40')](handleError(_0x25d0e7,null));};exports[_0x3b69('0x49')]=function(_0x3f5db7,_0x3fab9c,_0x2e51e3){if(_0x3f5db7['body']['id']){delete _0x3f5db7[_0x3b69('0x43')]['id'];}return db[_0x3b69('0x28')]['findOne']({'where':{'id':_0x3f5db7[_0x3b69('0x44')]['id']}})[_0x3b69('0x22')](handleEntityNotFound(_0x3fab9c,null))[_0x3b69('0x22')](function(_0x254bc9){if(_0x254bc9){_0x3f5db7[_0x3b69('0x43')][_0x3b69('0x4a')]=_0x254bc9['id'];_0x3f5db7['body']['Subjects']=integrations[_0x3b69('0x4b')](_0x3f5db7[_0x3b69('0x43')][_0x3b69('0x4c')],_0x3f5db7[_0x3b69('0x43')]['type']);_0x3f5db7[_0x3b69('0x43')][_0x3b69('0x4d')]=integrations[_0x3b69('0x4e')](_0x3f5db7[_0x3b69('0x43')][_0x3b69('0x4c')],_0x3f5db7[_0x3b69('0x43')][_0x3b69('0x2a')]);return db[_0x3b69('0x47')]['create'](_0x3f5db7[_0x3b69('0x43')],{'include':[{'model':db[_0x3b69('0x4f')],'as':_0x3b69('0x50')},{'model':db[_0x3b69('0x4f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3fab9c,null))[_0x3b69('0x40')](handleError(_0x3fab9c,null));};exports[_0x3b69('0x51')]=function(_0x3f114e,_0x49169d,_0x93db77){var _0x931049='';var _0x5aa17a=['id',_0x3b69('0x24'),_0x3b69('0x52'),_0x3b69('0x53'),'description',_0x3b69('0x54'),_0x3b69('0x55'),_0x3b69('0x56'),_0x3b69('0x57'),_0x3b69('0x58'),_0x3b69('0x59'),'direction'];return db[_0x3b69('0x28')][_0x3b69('0x5a')]({'where':{'id':_0x3f114e[_0x3b69('0x44')]['id']},'attributes':['id',_0x3b69('0x5b'),_0x3b69('0x5c'),_0x3b69('0x5d')]})['then'](handleEntityNotFound(_0x49169d,null))[_0x3b69('0x22')](function(_0x27e187){if(_0x27e187){_0x931049=_0x27e187[_0x3b69('0x5d')];var _0x4a51ac=_0x931049[_0x3b69('0x5e')](-0x1);if(_0x4a51ac==='/'){_0x931049=_0x931049['substring'](0x0,_0x931049[_0x3b69('0x5f')](_0x4a51ac));}return rp({'method':'POST','uri':util['format'](_0x3b69('0x60'),_0x931049,_0x3b69('0x61')),'json':!![],'form':{'method':_0x3b69('0x62'),'input_type':_0x3b69('0x63'),'response_type':_0x3b69('0x63'),'rest_data':JSON[_0x3b69('0x64')]({'user_auth':{'user_name':_0x27e187[_0x3b69('0x5b')],'password':_0x27e187[_0x3b69('0x5c')],'encryption':_0x3b69('0x65')},'application':_0x3b69('0x66')})}});}})[_0x3b69('0x22')](function(_0x13363b){if(_0x13363b&&_0x13363b[_0x3b69('0x24')]!=='Invalid\x20Login'&&_0x13363b[_0x3b69('0x24')]!==_0x3b69('0x67')){return rp({'method':_0x3b69('0x68'),'uri':util[_0x3b69('0x69')]('%s%s',_0x931049,_0x3b69('0x61')),'json':!![],'form':{'method':_0x3b69('0x6a'),'input_type':'JSON','response_type':_0x3b69('0x63'),'rest_data':JSON['stringify']({'session':_0x13363b['id'],'module_name':'Calls'})}})['then'](function(_0x431f50){if(_0x431f50){var _0x5abd54=_[_0x3b69('0x6b')](_0x431f50['module_fields']);_[_0x3b69('0x6c')](_0x5abd54,function(_0x3a3c22){return _0x5aa17a[_0x3b69('0x6d')](_0x3a3c22[_0x3b69('0x24')]);});return{'count':_0x5abd54[_0x3b69('0x31')],'rows':_['map'](_0x5abd54,function(_0x56fd84){return{'id':_0x56fd84[_0x3b69('0x24')],'name':_0x56fd84[_0x3b69('0x6e')],'custom':_[_0x3b69('0x6f')](_0x56fd84[_0x3b69('0x24')],'_c')?!![]:![],'options':_0x56fd84[_0x3b69('0x3b')]?_[_0x3b69('0x27')](_[_0x3b69('0x6b')](_0x56fd84[_0x3b69('0x3b')]),function(_0xc037e8){return{'name':_0xc037e8[_0x3b69('0x70')],'value':_0xc037e8[_0x3b69('0x24')]};}):[]};})};}})[_0x3b69('0x22')](respondWithResult(_0x49169d,null))[_0x3b69('0x40')](function(_0x20cde0){var _0xe62d4e=_0x3f114e['query'][_0x3b69('0x71')]?0x1f4:_0x20cde0[_0x3b69('0x72')]||0x1f4;logger[_0x3b69('0x73')](_0x3b69('0x74'),_0x3b69('0x51'),_0xe62d4e,JSON[_0x3b69('0x64')](_0x20cde0));delete _0x20cde0[_0x3b69('0x24')];if(_0xe62d4e===0x191){_0xe62d4e=0x190;}_0x49169d[_0x3b69('0x19')](_0xe62d4e)[_0x3b69('0x25')](_0x3f114e[_0x3b69('0x2c')][_0x3b69('0x71')]?{'message':_0x3b69('0x75'),'statusCode':_0x20cde0['statusCode']}:_0x20cde0);});}else{var _0x23dea=0x1f4;_0x49169d[_0x3b69('0x19')](_0x23dea)[_0x3b69('0x25')]({'message':_0x3b69('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x6460=['VIRTUAL','options','includeAll','include','then','rows','catch','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','%s%s','get_module_fields','Calls','values','module_fields','remove','includes','label','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','index','SugarcrmAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6460,0xb4));var _0x0646=function(_0x115acd,_0x55a3d4){_0x115acd=_0x115acd-0x0;var _0x3769d0=_0x6460[_0x115acd];return _0x3769d0;};'use strict';var emlformat=require(_0x0646('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0646('0x1'));var moment=require(_0x0646('0x2'));var BPromise=require(_0x0646('0x3'));var Mustache=require(_0x0646('0x4'));var util=require(_0x0646('0x5'));var path=require(_0x0646('0x6'));var sox=require(_0x0646('0x7'));var csv=require(_0x0646('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0646('0x9'));var jsforce=require(_0x0646('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0646('0x8'));var querystring=require(_0x0646('0xb'));var Papa=require(_0x0646('0xc'));var Redis=require(_0x0646('0xd'));var authService=require(_0x0646('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0646('0xf'));var hardwareService=require(_0x0646('0x10'));var logger=require(_0x0646('0x11'))(_0x0646('0x12'));var utils=require(_0x0646('0x13'));var config=require(_0x0646('0x14'));var licenseUtil=require(_0x0646('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0646('0x16'));function respondWithStatusCode(_0x102fe3,_0x4a7b8c){_0x4a7b8c=_0x4a7b8c||0xcc;return function(_0x46a1e6){if(_0x46a1e6){return _0x102fe3[_0x0646('0x17')](_0x4a7b8c);}return _0x102fe3['status'](_0x4a7b8c)['end']();};}function respondWithResult(_0x1ff324,_0x248dfd){_0x248dfd=_0x248dfd||0xc8;return function(_0x12149e){if(_0x12149e){return _0x1ff324[_0x0646('0x18')](_0x248dfd)['json'](_0x12149e);}};}function respondWithFilteredResult(_0x1bc552,_0x3dae3f){return function(_0x2b6f12){if(_0x2b6f12){var _0x83062=typeof _0x3dae3f['offset']===_0x0646('0x19')&&typeof _0x3dae3f['limit']===_0x0646('0x19');var _0x3f76b4=_0x2b6f12[_0x0646('0x1a')];var _0x189061=_0x83062?0x0:_0x3dae3f[_0x0646('0x1b')];var _0x3986c1=_0x83062?_0x2b6f12[_0x0646('0x1a')]:_0x3dae3f[_0x0646('0x1b')]+_0x3dae3f[_0x0646('0x1c')];var _0x3f03ad;if(_0x3986c1>=_0x3f76b4){_0x3986c1=_0x3f76b4;_0x3f03ad=0xc8;}else{_0x3f03ad=0xce;}_0x1bc552[_0x0646('0x18')](_0x3f03ad);return _0x1bc552['set'](_0x0646('0x1d'),_0x189061+'-'+_0x3986c1+'/'+_0x3f76b4)[_0x0646('0x1e')](_0x2b6f12);}return null;};}function patchUpdates(_0x16f12e){return function(_0x488302){try{jsonpatch[_0x0646('0x1f')](_0x488302,_0x16f12e,!![]);}catch(_0x4a8e23){return BPromise[_0x0646('0x20')](_0x4a8e23);}return _0x488302[_0x0646('0x21')]();};}function saveUpdates(_0x36b535,_0x4d0d46){return function(_0x334ccf){if(_0x334ccf){return _0x334ccf[_0x0646('0x22')](_0x36b535)['then'](function(_0x526e7e){return _0x526e7e;});}return null;};}function removeEntity(_0x2faabd,_0x45387b){return function(_0x8cf470){if(_0x8cf470){return _0x8cf470[_0x0646('0x23')]()['then'](function(){_0x2faabd[_0x0646('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x257e81,_0xca7879){return function(_0x14bf4d){if(!_0x14bf4d){_0x257e81[_0x0646('0x17')](0x194);}return _0x14bf4d;};}function handleError(_0x141c52,_0x453acd){_0x453acd=_0x453acd||0x1f4;return function(_0x35d242){logger[_0x0646('0x24')](_0x35d242[_0x0646('0x25')]);if(_0x35d242[_0x0646('0x26')]){delete _0x35d242[_0x0646('0x26')];}_0x141c52[_0x0646('0x18')](_0x453acd)['send'](_0x35d242);};}exports[_0x0646('0x27')]=function(_0x26d8a5,_0x32cb4d){var _0x4f091b={},_0xe82a17={},_0x57a91f={'count':0x0,'rows':[]};var _0x56579c=_['map'](db[_0x0646('0x28')][_0x0646('0x29')],function(_0x35ef9e){return{'name':_0x35ef9e[_0x0646('0x2a')],'type':_0x35ef9e[_0x0646('0x2b')][_0x0646('0x2c')]};});_0xe82a17['model']=_[_0x0646('0x2d')](_0x56579c,_0x0646('0x26'));_0xe82a17[_0x0646('0x2e')]=_[_0x0646('0x2f')](_0x26d8a5['query']);_0xe82a17[_0x0646('0x30')]=_[_0x0646('0x31')](_0xe82a17['model'],_0xe82a17[_0x0646('0x2e')]);_0x4f091b['attributes']=_[_0x0646('0x31')](_0xe82a17['model'],qs[_0x0646('0x32')](_0x26d8a5['query'][_0x0646('0x32')]));_0x4f091b[_0x0646('0x33')]=_0x4f091b['attributes'][_0x0646('0x34')]?_0x4f091b['attributes']:_0xe82a17[_0x0646('0x35')];if(!_0x26d8a5['query'][_0x0646('0x36')](_0x0646('0x37'))){_0x4f091b[_0x0646('0x1c')]=qs[_0x0646('0x1c')](_0x26d8a5[_0x0646('0x2e')][_0x0646('0x1c')]);_0x4f091b[_0x0646('0x1b')]=qs[_0x0646('0x1b')](_0x26d8a5[_0x0646('0x2e')][_0x0646('0x1b')]);}_0x4f091b[_0x0646('0x38')]=qs[_0x0646('0x39')](_0x26d8a5[_0x0646('0x2e')]['sort']);_0x4f091b[_0x0646('0x3a')]=qs[_0x0646('0x30')](_[_0x0646('0x3b')](_0x26d8a5[_0x0646('0x2e')],_0xe82a17[_0x0646('0x30')]),_0x56579c);if(_0x26d8a5['query'][_0x0646('0x3c')]){_0x4f091b[_0x0646('0x3a')]=_[_0x0646('0x3d')](_0x4f091b[_0x0646('0x3a')],{'$or':_[_0x0646('0x2d')](_0x56579c,function(_0x30376d){if(_0x30376d[_0x0646('0x2b')]!==_0x0646('0x3e')){var _0x317c55={};_0x317c55[_0x30376d['name']]={'$like':'%'+_0x26d8a5[_0x0646('0x2e')][_0x0646('0x3c')]+'%'};return _0x317c55;}})});}_0x4f091b=_[_0x0646('0x3d')]({},_0x4f091b,_0x26d8a5[_0x0646('0x3f')]);var _0x21ea0a={'where':_0x4f091b[_0x0646('0x3a')]};return db[_0x0646('0x28')][_0x0646('0x1a')](_0x21ea0a)['then'](function(_0x2e6f03){_0x57a91f[_0x0646('0x1a')]=_0x2e6f03;if(_0x26d8a5['query'][_0x0646('0x40')]){_0x4f091b[_0x0646('0x41')]=[{'all':!![]}];}return db[_0x0646('0x28')]['findAll'](_0x4f091b);})[_0x0646('0x42')](function(_0x52cd5f){_0x57a91f[_0x0646('0x43')]=_0x52cd5f;return _0x57a91f;})[_0x0646('0x42')](respondWithFilteredResult(_0x32cb4d,_0x4f091b))[_0x0646('0x44')](handleError(_0x32cb4d,null));};exports[_0x0646('0x45')]=function(_0x386cd8,_0x19a850){var _0x1b671a={'raw':![],'where':{'id':_0x386cd8[_0x0646('0x46')]['id']}},_0x53c999={};_0x53c999[_0x0646('0x35')]=_[_0x0646('0x2f')](db[_0x0646('0x28')]['rawAttributes']);_0x53c999[_0x0646('0x2e')]=_[_0x0646('0x2f')](_0x386cd8[_0x0646('0x2e')]);_0x53c999[_0x0646('0x30')]=_[_0x0646('0x31')](_0x53c999[_0x0646('0x35')],_0x53c999[_0x0646('0x2e')]);_0x1b671a['attributes']=_[_0x0646('0x31')](_0x53c999[_0x0646('0x35')],qs['fields'](_0x386cd8[_0x0646('0x2e')][_0x0646('0x32')]));_0x1b671a[_0x0646('0x33')]=_0x1b671a['attributes']['length']?_0x1b671a[_0x0646('0x33')]:_0x53c999[_0x0646('0x35')];if(_0x386cd8['query']['includeAll']){_0x1b671a[_0x0646('0x41')]=[{'all':!![]}];}_0x1b671a=_['merge']({},_0x1b671a,_0x386cd8['options']);return db[_0x0646('0x28')][_0x0646('0x47')](_0x1b671a)[_0x0646('0x42')](handleEntityNotFound(_0x19a850,null))[_0x0646('0x42')](respondWithResult(_0x19a850,null))[_0x0646('0x44')](handleError(_0x19a850,null));};exports[_0x0646('0x48')]=function(_0x24e47b,_0x49688b){return db[_0x0646('0x28')][_0x0646('0x48')](_0x24e47b[_0x0646('0x49')],{})[_0x0646('0x42')](respondWithResult(_0x49688b,0xc9))[_0x0646('0x44')](handleError(_0x49688b,null));};exports[_0x0646('0x22')]=function(_0x2c2789,_0x4792da){if(_0x2c2789[_0x0646('0x49')]['id']){delete _0x2c2789[_0x0646('0x49')]['id'];}return db[_0x0646('0x28')]['find']({'where':{'id':_0x2c2789[_0x0646('0x46')]['id']}})[_0x0646('0x42')](handleEntityNotFound(_0x4792da,null))[_0x0646('0x42')](saveUpdates(_0x2c2789['body'],null))[_0x0646('0x42')](respondWithResult(_0x4792da,null))['catch'](handleError(_0x4792da,null));};exports[_0x0646('0x23')]=function(_0x103db1,_0x9d86a6){return db[_0x0646('0x28')][_0x0646('0x47')]({'where':{'id':_0x103db1[_0x0646('0x46')]['id']}})['then'](handleEntityNotFound(_0x9d86a6,null))[_0x0646('0x42')](removeEntity(_0x9d86a6,null))[_0x0646('0x44')](handleError(_0x9d86a6,null));};exports[_0x0646('0x4a')]=function(_0x22e84b,_0x2fc75b,_0x3c239e){var _0x201d19={};var _0x546ce5={};var _0x378cb8;var _0x5829ec;return db[_0x0646('0x28')][_0x0646('0x4b')]({'where':{'id':_0x22e84b['params']['id']}})[_0x0646('0x42')](handleEntityNotFound(_0x2fc75b,null))[_0x0646('0x42')](function(_0xab8b21){if(_0xab8b21){_0x378cb8=_0xab8b21;_0x546ce5[_0x0646('0x35')]=_[_0x0646('0x2f')](db[_0x0646('0x4c')][_0x0646('0x29')]);_0x546ce5['query']=_[_0x0646('0x2f')](_0x22e84b[_0x0646('0x2e')]);_0x546ce5[_0x0646('0x30')]=_['intersection'](_0x546ce5[_0x0646('0x35')],_0x546ce5['query']);_0x201d19[_0x0646('0x33')]=_[_0x0646('0x31')](_0x546ce5[_0x0646('0x35')],qs['fields'](_0x22e84b[_0x0646('0x2e')][_0x0646('0x32')]));_0x201d19[_0x0646('0x33')]=_0x201d19['attributes'][_0x0646('0x34')]?_0x201d19['attributes']:_0x546ce5[_0x0646('0x35')];_0x201d19[_0x0646('0x38')]=qs[_0x0646('0x39')](_0x22e84b[_0x0646('0x2e')][_0x0646('0x39')]);_0x201d19[_0x0646('0x3a')]=qs[_0x0646('0x30')](_[_0x0646('0x3b')](_0x22e84b[_0x0646('0x2e')],_0x546ce5[_0x0646('0x30')]));if(_0x22e84b[_0x0646('0x2e')][_0x0646('0x3c')]){_0x201d19[_0x0646('0x3a')]=_[_0x0646('0x3d')](_0x201d19['where'],{'$or':_[_0x0646('0x2d')](_0x201d19[_0x0646('0x33')],function(_0x30a1dc){var _0x207611={};_0x207611[_0x30a1dc]={'$like':'%'+_0x22e84b[_0x0646('0x2e')]['filter']+'%'};return _0x207611;})});}_0x201d19=_[_0x0646('0x3d')]({},_0x201d19,_0x22e84b[_0x0646('0x3f')]);return _0x378cb8[_0x0646('0x4a')](_0x201d19);}})[_0x0646('0x42')](function(_0x3d450b){if(_0x3d450b){_0x5829ec=_0x3d450b['length'];if(!_0x22e84b['query']['hasOwnProperty'](_0x0646('0x37'))){_0x201d19[_0x0646('0x1c')]=qs['limit'](_0x22e84b[_0x0646('0x2e')][_0x0646('0x1c')]);_0x201d19[_0x0646('0x1b')]=qs[_0x0646('0x1b')](_0x22e84b[_0x0646('0x2e')][_0x0646('0x1b')]);}return _0x378cb8[_0x0646('0x4a')](_0x201d19);}})[_0x0646('0x42')](function(_0x2a5781){if(_0x2a5781){return _0x2a5781?{'count':_0x5829ec,'rows':_0x2a5781}:null;}})['then'](respondWithResult(_0x2fc75b,null))['catch'](handleError(_0x2fc75b,null));};exports['addConfiguration']=function(_0x29b022,_0x5a5bf6,_0x111bfb){if(_0x29b022[_0x0646('0x49')]['id']){delete _0x29b022[_0x0646('0x49')]['id'];}return db[_0x0646('0x28')][_0x0646('0x4b')]({'where':{'id':_0x29b022[_0x0646('0x46')]['id']}})[_0x0646('0x42')](handleEntityNotFound(_0x5a5bf6,null))['then'](function(_0x23ea2f){if(_0x23ea2f){_0x29b022['body'][_0x0646('0x4d')]=_0x23ea2f['id'];_0x29b022[_0x0646('0x49')][_0x0646('0x4e')]=integrations[_0x0646('0x4f')](_0x29b022['body'][_0x0646('0x50')],_0x29b022[_0x0646('0x49')][_0x0646('0x2b')]);_0x29b022[_0x0646('0x49')][_0x0646('0x51')]=integrations['getDescriptions'](_0x29b022[_0x0646('0x49')]['channel'],_0x29b022[_0x0646('0x49')][_0x0646('0x2b')]);return db['SugarcrmConfiguration'][_0x0646('0x48')](_0x29b022[_0x0646('0x49')],{'include':[{'model':db['SugarcrmField'],'as':_0x0646('0x4e')},{'model':db[_0x0646('0x52')],'as':'Descriptions'}]});}return null;})[_0x0646('0x42')](respondWithResult(_0x5a5bf6,null))['catch'](handleError(_0x5a5bf6,null));};exports[_0x0646('0x53')]=function(_0x501460,_0x2aafcf,_0x1a7cc4){var _0x3eda2f='';var _0x17ead8=['id',_0x0646('0x26'),_0x0646('0x54'),'created_by',_0x0646('0x55'),_0x0646('0x56'),_0x0646('0x57'),_0x0646('0x58'),_0x0646('0x59'),_0x0646('0x5a'),_0x0646('0x5b'),_0x0646('0x5c')];return db[_0x0646('0x28')][_0x0646('0x4b')]({'where':{'id':_0x501460[_0x0646('0x46')]['id']},'attributes':['id','username',_0x0646('0x5d'),_0x0646('0x5e')]})[_0x0646('0x42')](handleEntityNotFound(_0x2aafcf,null))[_0x0646('0x42')](function(_0x58e0c7){if(_0x58e0c7){_0x3eda2f=_0x58e0c7[_0x0646('0x5e')];var _0x1ab9cc=_0x3eda2f[_0x0646('0x5f')](-0x1);if(_0x1ab9cc==='/'){_0x3eda2f=_0x3eda2f[_0x0646('0x60')](0x0,_0x3eda2f[_0x0646('0x61')](_0x1ab9cc));}return rp({'method':'POST','uri':util[_0x0646('0x62')]('%s%s',_0x3eda2f,_0x0646('0x63')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x0646('0x64'),'rest_data':JSON[_0x0646('0x65')]({'user_auth':{'user_name':_0x58e0c7[_0x0646('0x66')],'password':_0x58e0c7[_0x0646('0x5d')],'encryption':_0x0646('0x67')},'application':_0x0646('0x68')})}});}})['then'](function(_0x1e750c){if(_0x1e750c&&_0x1e750c['name']!==_0x0646('0x69')&&_0x1e750c[_0x0646('0x26')]!==_0x0646('0x6a')){return rp({'method':_0x0646('0x6b'),'uri':util[_0x0646('0x62')](_0x0646('0x6c'),_0x3eda2f,_0x0646('0x63')),'json':!![],'form':{'method':_0x0646('0x6d'),'input_type':_0x0646('0x64'),'response_type':_0x0646('0x64'),'rest_data':JSON['stringify']({'session':_0x1e750c['id'],'module_name':_0x0646('0x6e')})}})[_0x0646('0x42')](function(_0x4027a2){if(_0x4027a2){var _0x4b88ef=_[_0x0646('0x6f')](_0x4027a2[_0x0646('0x70')]);_[_0x0646('0x71')](_0x4b88ef,function(_0x45d0f4){return _0x17ead8[_0x0646('0x72')](_0x45d0f4[_0x0646('0x26')]);});return{'count':_0x4b88ef['length'],'rows':_[_0x0646('0x2d')](_0x4b88ef,function(_0x23becd){return{'id':_0x23becd[_0x0646('0x26')],'name':_0x23becd[_0x0646('0x73')],'custom':_['endsWith'](_0x23becd['name'],'_c')?!![]:![],'options':_0x23becd[_0x0646('0x3f')]?_['map'](_[_0x0646('0x6f')](_0x23becd[_0x0646('0x3f')]),function(_0x356369){return{'name':_0x356369['value'],'value':_0x356369[_0x0646('0x26')]};}):[]};})};}})[_0x0646('0x42')](respondWithResult(_0x2aafcf,null))['catch'](function(_0x572574){var _0x316817=_0x501460[_0x0646('0x2e')][_0x0646('0x74')]?0x1f4:_0x572574['statusCode']||0x1f4;logger[_0x0646('0x24')](_0x0646('0x75'),_0x0646('0x53'),_0x316817,JSON[_0x0646('0x65')](_0x572574));delete _0x572574['name'];if(_0x316817===0x191){_0x316817=0x190;}_0x2aafcf['status'](_0x316817)[_0x0646('0x76')](_0x501460[_0x0646('0x2e')][_0x0646('0x74')]?{'message':_0x0646('0x77'),'statusCode':_0x572574[_0x0646('0x78')]}:_0x572574);});}else{var _0x341cab=0x1f4;_0x2aafcf[_0x0646('0x18')](_0x341cab)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 8e6e96c..c8c03b7 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 _0xb98b=['../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x1c7889,_0x24cd26){var _0x2f14e5=function(_0x9ae1b1){while(--_0x9ae1b1){_0x1c7889['push'](_0x1c7889['shift']());}};_0x2f14e5(++_0x24cd26);}(_0xb98b,0x144));var _0xbb98=function(_0x490f5c,_0x17f5bc){_0x490f5c=_0x490f5c-0x0;var _0x30317b=_0xb98b[_0x490f5c];return _0x30317b;};'use strict';var _=require(_0xbb98('0x0'));var util=require(_0xbb98('0x1'));var logger=require(_0xbb98('0x2'))(_0xbb98('0x3'));var moment=require('moment');var BPromise=require(_0xbb98('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb98('0x5'));var rimraf=require('rimraf');var config=require(_0xbb98('0x6'));var attributes=require(_0xbb98('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xbb98('0x8')]=function(_0x1bab20,_0x331e49){return _0x1bab20[_0xbb98('0x9')](_0xbb98('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0381=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x5f0a5b,_0x2d78d2){var _0x523878=function(_0x24834a){while(--_0x24834a){_0x5f0a5b['push'](_0x5f0a5b['shift']());}};_0x523878(++_0x2d78d2);}(_0x0381,0x1c7));var _0x1038=function(_0x1823bc,_0x2e97d0){_0x1823bc=_0x1823bc-0x0;var _0x1d47cf=_0x0381[_0x1823bc];return _0x1d47cf;};'use strict';var _=require(_0x1038('0x0'));var util=require(_0x1038('0x1'));var logger=require('../../config/logger')(_0x1038('0x2'));var moment=require(_0x1038('0x3'));var BPromise=require(_0x1038('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1038('0x5'));var rimraf=require(_0x1038('0x6'));var config=require(_0x1038('0x7'));var attributes=require(_0x1038('0x8'));var integrations=require(_0x1038('0x9'));module['exports']=function(_0x3bd247,_0x265f51){return _0x3bd247[_0x1038('0xa')](_0x1038('0xb'),attributes,{'tableName':_0x1038('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index b038392..3150681 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 _0x3835=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','limit','include','model','attributes','map','then','debug','ShowSugarcrmAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5f176f,_0x2a929a){var _0x2734cf=function(_0x4853a5){while(--_0x4853a5){_0x5f176f['push'](_0x5f176f['shift']());}};_0x2734cf(++_0x2a929a);}(_0x3835,0xf5));var _0x5383=function(_0x3ad451,_0x204dc2){_0x3ad451=_0x3ad451-0x0;var _0x178759=_0x3835[_0x3ad451];return _0x178759;};'use strict';var _=require(_0x5383('0x0'));var util=require(_0x5383('0x1'));var moment=require(_0x5383('0x2'));var BPromise=require(_0x5383('0x3'));var rs=require(_0x5383('0x4'));var fs=require('fs');var Redis=require(_0x5383('0x5'));var db=require(_0x5383('0x6'))['db'];var utils=require(_0x5383('0x7'));var logger=require('../../config/logger')(_0x5383('0x8'));var config=require(_0x5383('0x9'));var jayson=require(_0x5383('0xa'));var client=jayson[_0x5383('0xb')][_0x5383('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x423a7b,_0x2d6a96,_0x4bdfe9){return new BPromise(function(_0x163b4b,_0x55e82d){return client['request'](_0x423a7b,_0x4bdfe9)['then'](function(_0x18b004){logger['info'](_0x5383('0xd'),_0x2d6a96,'request\x20sent');logger['debug'](_0x5383('0xe'),_0x2d6a96,'request\x20sent',JSON[_0x5383('0xf')](_0x18b004));if(_0x18b004[_0x5383('0x10')]){if(_0x18b004['error'][_0x5383('0x11')]===0x1f4){logger[_0x5383('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x2d6a96,_0x18b004[_0x5383('0x10')]['message']);return _0x55e82d(_0x18b004['error']['message']);}logger[_0x5383('0x10')](_0x5383('0xd'),_0x2d6a96,_0x18b004['error'][_0x5383('0x12')]);return _0x163b4b(_0x18b004[_0x5383('0x10')][_0x5383('0x12')]);}else{logger[_0x5383('0x13')](_0x5383('0xd'),_0x2d6a96,'request\x20sent');_0x163b4b(_0x18b004[_0x5383('0x14')]['message']);}})['catch'](function(_0x4e996e){logger[_0x5383('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x2d6a96,_0x4e996e);_0x55e82d(_0x4e996e);});});}exports[_0x5383('0x15')]=function(_0x116100){var _0x259b00=this;return new Promise(function(_0x3f594d,_0x43beb4){return db[_0x5383('0x16')][_0x5383('0x17')]({'raw':_0x116100[_0x5383('0x18')]?_0x116100['options'][_0x5383('0x19')]===undefined?!![]:![]:!![],'where':_0x116100[_0x5383('0x18')]?_0x116100[_0x5383('0x18')]['where']||null:null,'attributes':_0x116100[_0x5383('0x18')]?_0x116100[_0x5383('0x18')]['attributes']||null:null,'limit':_0x116100[_0x5383('0x18')]?_0x116100[_0x5383('0x18')][_0x5383('0x1a')]||null:null,'include':_0x116100[_0x5383('0x18')]?_0x116100[_0x5383('0x18')][_0x5383('0x1b')]?_['map'](_0x116100['options']['include'],function(_0x286bd9){return{'model':db[_0x286bd9[_0x5383('0x1c')]],'as':_0x286bd9['as'],'attributes':_0x286bd9[_0x5383('0x1d')],'include':_0x286bd9[_0x5383('0x1b')]?_[_0x5383('0x1e')](_0x286bd9[_0x5383('0x1b')],function(_0x18c23c){return{'model':db[_0x18c23c[_0x5383('0x1c')]],'as':_0x18c23c['as'],'attributes':_0x18c23c[_0x5383('0x1d')],'include':_0x18c23c[_0x5383('0x1b')]?_[_0x5383('0x1e')](_0x18c23c['include'],function(_0x266dae){return{'model':db[_0x266dae['model']],'as':_0x266dae['as'],'attributes':_0x266dae[_0x5383('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5383('0x1f')](function(_0x4a8bea){logger['info'](_0x5383('0x15'),_0x116100);logger[_0x5383('0x20')](_0x5383('0x15'),_0x116100,JSON[_0x5383('0xf')](_0x4a8bea));_0x3f594d(_0x4a8bea);})['catch'](function(_0x421726){logger[_0x5383('0x10')](_0x5383('0x15'),_0x421726['message'],_0x116100);_0x43beb4(_0x259b00[_0x5383('0x10')](0x1f4,_0x421726[_0x5383('0x12')]));});});};exports[_0x5383('0x21')]=function(_0x4ea4ec){var _0x4cc9fc=this;return new Promise(function(_0x5ea7ef,_0x2add17){return db[_0x5383('0x16')][_0x5383('0x22')]({'raw':_0x4ea4ec['options']?_0x4ea4ec['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ea4ec['options']?_0x4ea4ec[_0x5383('0x18')][_0x5383('0x23')]||null:null,'attributes':_0x4ea4ec[_0x5383('0x18')]?_0x4ea4ec[_0x5383('0x18')]['attributes']||null:null,'include':_0x4ea4ec[_0x5383('0x18')]?_0x4ea4ec[_0x5383('0x18')][_0x5383('0x1b')]?_[_0x5383('0x1e')](_0x4ea4ec[_0x5383('0x18')]['include'],function(_0xeda071){return{'model':db[_0xeda071[_0x5383('0x1c')]],'as':_0xeda071['as'],'attributes':_0xeda071[_0x5383('0x1d')],'include':_0xeda071[_0x5383('0x1b')]?_[_0x5383('0x1e')](_0xeda071['include'],function(_0x1085e6){return{'model':db[_0x1085e6[_0x5383('0x1c')]],'as':_0x1085e6['as'],'attributes':_0x1085e6['attributes'],'include':_0x1085e6[_0x5383('0x1b')]?_[_0x5383('0x1e')](_0x1085e6[_0x5383('0x1b')],function(_0x4a23e7){return{'model':db[_0x4a23e7[_0x5383('0x1c')]],'as':_0x4a23e7['as'],'attributes':_0x4a23e7[_0x5383('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5383('0x1f')](function(_0x507bd5){logger[_0x5383('0x13')]('ShowSugarcrmAccount',_0x4ea4ec);logger[_0x5383('0x20')](_0x5383('0x21'),_0x4ea4ec,JSON['stringify'](_0x507bd5));_0x5ea7ef(_0x507bd5);})['catch'](function(_0xf828b2){logger[_0x5383('0x10')](_0x5383('0x21'),_0xf828b2[_0x5383('0x12')],_0x4ea4ec);_0x2add17(_0x4cc9fc['error'](0x1f4,_0xf828b2[_0x5383('0x12')]));});});}; \ No newline at end of file +var _0x0874=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','catch','ShowSugarcrmAccount','SugarcrmAccount','find','moment'];(function(_0x168bad,_0x11020c){var _0x5ac335=function(_0x167832){while(--_0x167832){_0x168bad['push'](_0x168bad['shift']());}};_0x5ac335(++_0x11020c);}(_0x0874,0x1af));var _0x4087=function(_0x3b726c,_0x163aa2){_0x3b726c=_0x3b726c-0x0;var _0x38d420=_0x0874[_0x3b726c];return _0x38d420;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4087('0x0'));var BPromise=require(_0x4087('0x1'));var rs=require(_0x4087('0x2'));var fs=require('fs');var Redis=require(_0x4087('0x3'));var db=require(_0x4087('0x4'))['db'];var utils=require(_0x4087('0x5'));var logger=require(_0x4087('0x6'))(_0x4087('0x7'));var config=require(_0x4087('0x8'));var jayson=require(_0x4087('0x9'));var client=jayson[_0x4087('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4abfa1,_0x1a4f67,_0x2d4135){return new BPromise(function(_0x482212,_0x3e42f2){return client[_0x4087('0xb')](_0x4abfa1,_0x2d4135)['then'](function(_0x5d298d){logger[_0x4087('0xc')](_0x4087('0xd'),_0x1a4f67,'request\x20sent');logger['debug'](_0x4087('0xe'),_0x1a4f67,_0x4087('0xf'),JSON[_0x4087('0x10')](_0x5d298d));if(_0x5d298d['error']){if(_0x5d298d[_0x4087('0x11')][_0x4087('0x12')]===0x1f4){logger[_0x4087('0x11')](_0x4087('0xd'),_0x1a4f67,_0x5d298d[_0x4087('0x11')][_0x4087('0x13')]);return _0x3e42f2(_0x5d298d['error'][_0x4087('0x13')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x1a4f67,_0x5d298d[_0x4087('0x11')]['message']);return _0x482212(_0x5d298d[_0x4087('0x11')][_0x4087('0x13')]);}else{logger[_0x4087('0xc')](_0x4087('0xd'),_0x1a4f67,_0x4087('0xf'));_0x482212(_0x5d298d['result']['message']);}})['catch'](function(_0x3dc675){logger[_0x4087('0x11')](_0x4087('0xd'),_0x1a4f67,_0x3dc675);_0x3e42f2(_0x3dc675);});});}exports[_0x4087('0x14')]=function(_0x46f23e){var _0x23c884=this;return new Promise(function(_0x34ad64,_0x4a1824){return db['SugarcrmAccount'][_0x4087('0x15')]({'raw':_0x46f23e[_0x4087('0x16')]?_0x46f23e[_0x4087('0x16')][_0x4087('0x17')]===undefined?!![]:![]:!![],'where':_0x46f23e[_0x4087('0x16')]?_0x46f23e[_0x4087('0x16')][_0x4087('0x18')]||null:null,'attributes':_0x46f23e[_0x4087('0x16')]?_0x46f23e[_0x4087('0x16')][_0x4087('0x19')]||null:null,'limit':_0x46f23e['options']?_0x46f23e['options'][_0x4087('0x1a')]||null:null,'include':_0x46f23e[_0x4087('0x16')]?_0x46f23e[_0x4087('0x16')]['include']?_[_0x4087('0x1b')](_0x46f23e[_0x4087('0x16')][_0x4087('0x1c')],function(_0x54d30e){return{'model':db[_0x54d30e[_0x4087('0x1d')]],'as':_0x54d30e['as'],'attributes':_0x54d30e['attributes'],'include':_0x54d30e[_0x4087('0x1c')]?_['map'](_0x54d30e['include'],function(_0x5c124c){return{'model':db[_0x5c124c['model']],'as':_0x5c124c['as'],'attributes':_0x5c124c['attributes'],'include':_0x5c124c['include']?_['map'](_0x5c124c[_0x4087('0x1c')],function(_0x44b2bf){return{'model':db[_0x44b2bf[_0x4087('0x1d')]],'as':_0x44b2bf['as'],'attributes':_0x44b2bf[_0x4087('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4087('0x1e')](function(_0x27f449){logger['info'](_0x4087('0x14'),_0x46f23e);logger[_0x4087('0x1f')](_0x4087('0x14'),_0x46f23e,JSON['stringify'](_0x27f449));_0x34ad64(_0x27f449);})[_0x4087('0x20')](function(_0x11d1ee){logger[_0x4087('0x11')](_0x4087('0x14'),_0x11d1ee[_0x4087('0x13')],_0x46f23e);_0x4a1824(_0x23c884[_0x4087('0x11')](0x1f4,_0x11d1ee[_0x4087('0x13')]));});});};exports[_0x4087('0x21')]=function(_0x14c776){var _0x270b46=this;return new Promise(function(_0x739faa,_0x3e5c89){return db[_0x4087('0x22')][_0x4087('0x23')]({'raw':_0x14c776[_0x4087('0x16')]?_0x14c776[_0x4087('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x14c776[_0x4087('0x16')]?_0x14c776[_0x4087('0x16')][_0x4087('0x18')]||null:null,'attributes':_0x14c776[_0x4087('0x16')]?_0x14c776['options'][_0x4087('0x19')]||null:null,'include':_0x14c776['options']?_0x14c776[_0x4087('0x16')]['include']?_[_0x4087('0x1b')](_0x14c776[_0x4087('0x16')][_0x4087('0x1c')],function(_0x20101d){return{'model':db[_0x20101d[_0x4087('0x1d')]],'as':_0x20101d['as'],'attributes':_0x20101d[_0x4087('0x19')],'include':_0x20101d[_0x4087('0x1c')]?_['map'](_0x20101d[_0x4087('0x1c')],function(_0x1eff02){return{'model':db[_0x1eff02['model']],'as':_0x1eff02['as'],'attributes':_0x1eff02['attributes'],'include':_0x1eff02['include']?_[_0x4087('0x1b')](_0x1eff02[_0x4087('0x1c')],function(_0xb7c1ea){return{'model':db[_0xb7c1ea['model']],'as':_0xb7c1ea['as'],'attributes':_0xb7c1ea[_0x4087('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ec5c0){logger[_0x4087('0xc')](_0x4087('0x21'),_0x14c776);logger[_0x4087('0x1f')]('ShowSugarcrmAccount',_0x14c776,JSON['stringify'](_0x2ec5c0));_0x739faa(_0x2ec5c0);})[_0x4087('0x20')](function(_0x131b60){logger['error'](_0x4087('0x21'),_0x131b60[_0x4087('0x13')],_0x14c776);_0x3e5c89(_0x270b46[_0x4087('0x11')](0x1f4,_0x131b60[_0x4087('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 8c7833d..7fc20a0 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 _0xa50e=['getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','/:id/subjects','getSubjects'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa50e,0xbb));var _0xea50=function(_0x686251,_0x51eb1d){_0x686251=_0x686251-0x0;var _0x4a0c34=_0xa50e[_0x686251];return _0x4a0c34;};'use strict';var multer=require(_0xea50('0x0'));var util=require(_0xea50('0x1'));var path=require(_0xea50('0x2'));var timeout=require('connect-timeout');var express=require(_0xea50('0x3'));var router=express[_0xea50('0x4')]();var fs_extra=require(_0xea50('0x5'));var auth=require(_0xea50('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xea50('0x7'));router[_0xea50('0x8')]('/',auth[_0xea50('0x9')](),controller['index']);router[_0xea50('0x8')](_0xea50('0xa'),auth[_0xea50('0x9')](),controller['show']);router[_0xea50('0x8')]('/:id/fields',auth[_0xea50('0x9')](),controller['getFields']);router[_0xea50('0x8')](_0xea50('0xb'),auth[_0xea50('0x9')](),controller[_0xea50('0xc')]);router['get']('/:id/descriptions',auth[_0xea50('0x9')](),controller[_0xea50('0xd')]);router[_0xea50('0xe')]('/',auth[_0xea50('0x9')](),controller[_0xea50('0xf')]);router[_0xea50('0x10')](_0xea50('0xa'),auth[_0xea50('0x9')](),controller['update']);router[_0xea50('0x11')](_0xea50('0xa'),auth[_0xea50('0x9')](),controller[_0xea50('0x12')]);module[_0xea50('0x13')]=router; \ No newline at end of file +var _0xd1ba=['../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x34967e,_0x11f483){var _0x406971=function(_0xc805e3){while(--_0xc805e3){_0x34967e['push'](_0x34967e['shift']());}};_0x406971(++_0x11f483);}(_0xd1ba,0xd5));var _0xad1b=function(_0x9f9575,_0x3aa01b){_0x9f9575=_0x9f9575-0x0;var _0x535026=_0xd1ba[_0x9f9575];return _0x535026;};'use strict';var multer=require(_0xad1b('0x0'));var util=require(_0xad1b('0x1'));var path=require(_0xad1b('0x2'));var timeout=require(_0xad1b('0x3'));var express=require(_0xad1b('0x4'));var router=express[_0xad1b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xad1b('0x6'));var interaction=require(_0xad1b('0x7'));var config=require(_0xad1b('0x8'));var controller=require(_0xad1b('0x9'));router[_0xad1b('0xa')]('/',auth[_0xad1b('0xb')](),controller['index']);router['get'](_0xad1b('0xc'),auth[_0xad1b('0xb')](),controller[_0xad1b('0xd')]);router[_0xad1b('0xa')]('/:id/fields',auth[_0xad1b('0xb')](),controller[_0xad1b('0xe')]);router[_0xad1b('0xa')]('/:id/subjects',auth[_0xad1b('0xb')](),controller['getSubjects']);router['get'](_0xad1b('0xf'),auth['isAuthenticated'](),controller[_0xad1b('0x10')]);router[_0xad1b('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xad1b('0xc'),auth[_0xad1b('0xb')](),controller[_0xad1b('0x12')]);router[_0xad1b('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xad1b('0x14')]);module[_0xad1b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 812f275..e945e8d 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 _0x220c=['sequelize','exports','STRING'];(function(_0x43660e,_0x3ae6d5){var _0x5d7694=function(_0x520edb){while(--_0x520edb){_0x43660e['push'](_0x43660e['shift']());}};_0x5d7694(++_0x3ae6d5);}(_0x220c,0x192));var _0xc220=function(_0x4296df,_0x532d06){_0x4296df=_0x4296df-0x0;var _0x5a40b1=_0x220c[_0x4296df];return _0x5a40b1;};'use strict';var Sequelize=require(_0xc220('0x0'));module[_0xc220('0x1')]={'name':{'type':Sequelize[_0xc220('0x2')]},'description':{'type':Sequelize[_0xc220('0x2')]}}; \ No newline at end of file +var _0x06d3=['sequelize'];(function(_0x29d8d7,_0x4b72f5){var _0x2cfd24=function(_0x44767d){while(--_0x44767d){_0x29d8d7['push'](_0x29d8d7['shift']());}};_0x2cfd24(++_0x4b72f5);}(_0x06d3,0x1f2));var _0x306d=function(_0x2b541d,_0x11de13){_0x2b541d=_0x2b541d-0x0;var _0x2710b1=_0x06d3[_0x2b541d];return _0x2710b1;};'use strict';var Sequelize=require(_0x306d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 06a3c1c..b4f0b38 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 _0x9b76=['sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','keys','find','create','body','params','getFields','findOne','order','hasOwnProperty','getSubjects','SugarcrmField','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x50e4a5,_0x3807a6){var _0x52776e=function(_0xc3ed4c){while(--_0xc3ed4c){_0x50e4a5['push'](_0x50e4a5['shift']());}};_0x52776e(++_0x3807a6);}(_0x9b76,0x1de));var _0x69b7=function(_0xf7c397,_0x17f589){_0xf7c397=_0xf7c397-0x0;var _0x580e9e=_0x9b76[_0xf7c397];return _0x580e9e;};'use strict';var emlformat=require(_0x69b7('0x0'));var rimraf=require(_0x69b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x69b7('0x2'));var rp=require(_0x69b7('0x3'));var moment=require(_0x69b7('0x4'));var BPromise=require(_0x69b7('0x5'));var Mustache=require(_0x69b7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x69b7('0x7'));var csv=require(_0x69b7('0x8'));var ejs=require(_0x69b7('0x9'));var fs=require('fs');var fs_extra=require(_0x69b7('0xa'));var _=require('lodash');var squel=require(_0x69b7('0xb'));var crypto=require(_0x69b7('0xc'));var jsforce=require(_0x69b7('0xd'));var deskjs=require(_0x69b7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x69b7('0xf'));var Papa=require('papaparse');var Redis=require(_0x69b7('0x10'));var authService=require(_0x69b7('0x11'));var qs=require(_0x69b7('0x12'));var as=require(_0x69b7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x69b7('0x14'))(_0x69b7('0x15'));var utils=require(_0x69b7('0x16'));var config=require(_0x69b7('0x17'));var licenseUtil=require(_0x69b7('0x18'));var db=require(_0x69b7('0x19'))['db'];function respondWithStatusCode(_0x6a12a0,_0x324f9e){_0x324f9e=_0x324f9e||0xcc;return function(_0x1580eb){if(_0x1580eb){return _0x6a12a0[_0x69b7('0x1a')](_0x324f9e);}return _0x6a12a0[_0x69b7('0x1b')](_0x324f9e)[_0x69b7('0x1c')]();};}function respondWithResult(_0x45fd8a,_0xe6f544){_0xe6f544=_0xe6f544||0xc8;return function(_0x529393){if(_0x529393){return _0x45fd8a[_0x69b7('0x1b')](_0xe6f544)[_0x69b7('0x1d')](_0x529393);}};}function respondWithFilteredResult(_0x486602,_0xd563b3){return function(_0x40b9c1){if(_0x40b9c1){var _0x588d47=typeof _0xd563b3['offset']==='undefined'&&typeof _0xd563b3[_0x69b7('0x1e')]===_0x69b7('0x1f');var _0x5a28f9=_0x40b9c1[_0x69b7('0x20')];var _0x42c30d=_0x588d47?0x0:_0xd563b3[_0x69b7('0x21')];var _0x25553b=_0x588d47?_0x40b9c1['count']:_0xd563b3['offset']+_0xd563b3['limit'];var _0x599b1b;if(_0x25553b>=_0x5a28f9){_0x25553b=_0x5a28f9;_0x599b1b=0xc8;}else{_0x599b1b=0xce;}_0x486602[_0x69b7('0x1b')](_0x599b1b);return _0x486602[_0x69b7('0x22')](_0x69b7('0x23'),_0x42c30d+'-'+_0x25553b+'/'+_0x5a28f9)[_0x69b7('0x1d')](_0x40b9c1);}return null;};}function patchUpdates(_0x1cdc63){return function(_0x5521f7){try{jsonpatch[_0x69b7('0x24')](_0x5521f7,_0x1cdc63,!![]);}catch(_0x4020ec){return BPromise[_0x69b7('0x25')](_0x4020ec);}return _0x5521f7[_0x69b7('0x26')]();};}function saveUpdates(_0x46e259,_0x1b4b8f){return function(_0x24c495){if(_0x24c495){return _0x24c495[_0x69b7('0x27')](_0x46e259)['then'](function(_0x4a9cb5){return _0x4a9cb5;});}return null;};}function removeEntity(_0x1094e5,_0x56e5da){return function(_0x4ebc53){if(_0x4ebc53){return _0x4ebc53[_0x69b7('0x28')]()[_0x69b7('0x29')](function(){_0x1094e5[_0x69b7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4497e1,_0xa0b0f8){return function(_0x31eb66){if(!_0x31eb66){_0x4497e1['sendStatus'](0x194);}return _0x31eb66;};}function handleError(_0x2f4bb3,_0x25b420){_0x25b420=_0x25b420||0x1f4;return function(_0x4156c2){logger[_0x69b7('0x2a')](_0x4156c2[_0x69b7('0x2b')]);if(_0x4156c2[_0x69b7('0x2c')]){delete _0x4156c2['name'];}_0x2f4bb3[_0x69b7('0x1b')](_0x25b420)[_0x69b7('0x2d')](_0x4156c2);};}exports[_0x69b7('0x2e')]=function(_0xd771ca,_0x490332){var _0x4cc50b={},_0x296b6b={},_0x1ff510={'count':0x0,'rows':[]};var _0x481099=_['map'](db[_0x69b7('0x2f')][_0x69b7('0x30')],function(_0xaed500){return{'name':_0xaed500[_0x69b7('0x31')],'type':_0xaed500[_0x69b7('0x32')][_0x69b7('0x33')]};});_0x296b6b[_0x69b7('0x34')]=_[_0x69b7('0x35')](_0x481099,_0x69b7('0x2c'));_0x296b6b['query']=_['keys'](_0xd771ca['query']);_0x296b6b[_0x69b7('0x36')]=_[_0x69b7('0x37')](_0x296b6b['model'],_0x296b6b[_0x69b7('0x38')]);_0x4cc50b[_0x69b7('0x39')]=_[_0x69b7('0x37')](_0x296b6b[_0x69b7('0x34')],qs[_0x69b7('0x3a')](_0xd771ca[_0x69b7('0x38')][_0x69b7('0x3a')]));_0x4cc50b[_0x69b7('0x39')]=_0x4cc50b[_0x69b7('0x39')][_0x69b7('0x3b')]?_0x4cc50b[_0x69b7('0x39')]:_0x296b6b[_0x69b7('0x34')];if(!_0xd771ca[_0x69b7('0x38')]['hasOwnProperty'](_0x69b7('0x3c'))){_0x4cc50b[_0x69b7('0x1e')]=qs[_0x69b7('0x1e')](_0xd771ca['query'][_0x69b7('0x1e')]);_0x4cc50b[_0x69b7('0x21')]=qs[_0x69b7('0x21')](_0xd771ca[_0x69b7('0x38')]['offset']);}_0x4cc50b['order']=qs[_0x69b7('0x3d')](_0xd771ca[_0x69b7('0x38')][_0x69b7('0x3d')]);_0x4cc50b[_0x69b7('0x3e')]=qs['filters'](_['pick'](_0xd771ca[_0x69b7('0x38')],_0x296b6b[_0x69b7('0x36')]),_0x481099);if(_0xd771ca[_0x69b7('0x38')][_0x69b7('0x3f')]){_0x4cc50b[_0x69b7('0x3e')]=_[_0x69b7('0x40')](_0x4cc50b[_0x69b7('0x3e')],{'$or':_['map'](_0x481099,function(_0x54924f){if(_0x54924f['type']!==_0x69b7('0x41')){var _0x33b527={};_0x33b527[_0x54924f['name']]={'$like':'%'+_0xd771ca[_0x69b7('0x38')][_0x69b7('0x3f')]+'%'};return _0x33b527;}})});}_0x4cc50b=_[_0x69b7('0x40')]({},_0x4cc50b,_0xd771ca[_0x69b7('0x42')]);var _0x1d68c6={'where':_0x4cc50b[_0x69b7('0x3e')]};return db['SugarcrmConfiguration']['count'](_0x1d68c6)['then'](function(_0x30164e){_0x1ff510[_0x69b7('0x20')]=_0x30164e;if(_0xd771ca[_0x69b7('0x38')][_0x69b7('0x43')]){_0x4cc50b[_0x69b7('0x44')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x69b7('0x45')](_0x4cc50b);})[_0x69b7('0x29')](function(_0x33c7d4){_0x1ff510['rows']=_0x33c7d4;return _0x1ff510;})[_0x69b7('0x29')](respondWithFilteredResult(_0x490332,_0x4cc50b))[_0x69b7('0x46')](handleError(_0x490332,null));};exports['show']=function(_0x474df6,_0x44cd98){var _0x23127d={'raw':![],'where':{'id':_0x474df6['params']['id']}},_0x2b03ce={};_0x2b03ce['model']=_['keys'](db[_0x69b7('0x2f')][_0x69b7('0x30')]);_0x2b03ce[_0x69b7('0x38')]=_[_0x69b7('0x47')](_0x474df6[_0x69b7('0x38')]);_0x2b03ce[_0x69b7('0x36')]=_[_0x69b7('0x37')](_0x2b03ce[_0x69b7('0x34')],_0x2b03ce[_0x69b7('0x38')]);_0x23127d['attributes']=_[_0x69b7('0x37')](_0x2b03ce[_0x69b7('0x34')],qs[_0x69b7('0x3a')](_0x474df6[_0x69b7('0x38')]['fields']));_0x23127d[_0x69b7('0x39')]=_0x23127d['attributes']['length']?_0x23127d[_0x69b7('0x39')]:_0x2b03ce[_0x69b7('0x34')];if(_0x474df6['query'][_0x69b7('0x43')]){_0x23127d[_0x69b7('0x44')]=[{'all':!![]}];}_0x23127d=_[_0x69b7('0x40')]({},_0x23127d,_0x474df6['options']);return db[_0x69b7('0x2f')][_0x69b7('0x48')](_0x23127d)[_0x69b7('0x29')](handleEntityNotFound(_0x44cd98,null))[_0x69b7('0x29')](respondWithResult(_0x44cd98,null))[_0x69b7('0x46')](handleError(_0x44cd98,null));};exports[_0x69b7('0x49')]=function(_0x3c3668,_0x202b3b){return db[_0x69b7('0x2f')][_0x69b7('0x49')](_0x3c3668[_0x69b7('0x4a')],{})['then'](respondWithResult(_0x202b3b,0xc9))[_0x69b7('0x46')](handleError(_0x202b3b,null));};exports['update']=function(_0x4a37da,_0x16a0d5){if(_0x4a37da['body']['id']){delete _0x4a37da[_0x69b7('0x4a')]['id'];}return db[_0x69b7('0x2f')][_0x69b7('0x48')]({'where':{'id':_0x4a37da[_0x69b7('0x4b')]['id']}})[_0x69b7('0x29')](handleEntityNotFound(_0x16a0d5,null))[_0x69b7('0x29')](saveUpdates(_0x4a37da['body'],null))[_0x69b7('0x29')](respondWithResult(_0x16a0d5,null))[_0x69b7('0x46')](handleError(_0x16a0d5,null));};exports[_0x69b7('0x28')]=function(_0x14426c,_0x9572a7){return db[_0x69b7('0x2f')][_0x69b7('0x48')]({'where':{'id':_0x14426c['params']['id']}})[_0x69b7('0x29')](handleEntityNotFound(_0x9572a7,null))[_0x69b7('0x29')](removeEntity(_0x9572a7,null))[_0x69b7('0x46')](handleError(_0x9572a7,null));};exports[_0x69b7('0x4c')]=function(_0x11bc69,_0x592cbb,_0x248c90){var _0x2992c9={};var _0x5bc79b={};var _0x549edd;var _0x3ba923;return db[_0x69b7('0x2f')][_0x69b7('0x4d')]({'where':{'id':_0x11bc69[_0x69b7('0x4b')]['id']}})[_0x69b7('0x29')](handleEntityNotFound(_0x592cbb,null))[_0x69b7('0x29')](function(_0xb3713b){if(_0xb3713b){_0x549edd=_0xb3713b;_0x5bc79b[_0x69b7('0x34')]=_['keys'](db['SugarcrmField'][_0x69b7('0x30')]);_0x5bc79b['query']=_['keys'](_0x11bc69[_0x69b7('0x38')]);_0x5bc79b[_0x69b7('0x36')]=_[_0x69b7('0x37')](_0x5bc79b['model'],_0x5bc79b[_0x69b7('0x38')]);_0x2992c9[_0x69b7('0x39')]=_['intersection'](_0x5bc79b[_0x69b7('0x34')],qs[_0x69b7('0x3a')](_0x11bc69['query'][_0x69b7('0x3a')]));_0x2992c9['attributes']=_0x2992c9[_0x69b7('0x39')][_0x69b7('0x3b')]?_0x2992c9[_0x69b7('0x39')]:_0x5bc79b[_0x69b7('0x34')];_0x2992c9[_0x69b7('0x4e')]=qs[_0x69b7('0x3d')](_0x11bc69[_0x69b7('0x38')][_0x69b7('0x3d')]);_0x2992c9['where']=qs['filters'](_['pick'](_0x11bc69[_0x69b7('0x38')],_0x5bc79b[_0x69b7('0x36')]));if(_0x11bc69[_0x69b7('0x38')][_0x69b7('0x3f')]){_0x2992c9[_0x69b7('0x3e')]=_[_0x69b7('0x40')](_0x2992c9[_0x69b7('0x3e')],{'$or':_[_0x69b7('0x35')](_0x2992c9[_0x69b7('0x39')],function(_0x176816){var _0x660e8e={};_0x660e8e[_0x176816]={'$like':'%'+_0x11bc69[_0x69b7('0x38')][_0x69b7('0x3f')]+'%'};return _0x660e8e;})});}_0x2992c9=_[_0x69b7('0x40')]({},_0x2992c9,_0x11bc69[_0x69b7('0x42')]);return _0x549edd[_0x69b7('0x4c')](_0x2992c9);}})[_0x69b7('0x29')](function(_0x45bb3a){if(_0x45bb3a){_0x3ba923=_0x45bb3a[_0x69b7('0x3b')];if(!_0x11bc69[_0x69b7('0x38')][_0x69b7('0x4f')](_0x69b7('0x3c'))){_0x2992c9[_0x69b7('0x1e')]=qs[_0x69b7('0x1e')](_0x11bc69[_0x69b7('0x38')][_0x69b7('0x1e')]);_0x2992c9[_0x69b7('0x21')]=qs[_0x69b7('0x21')](_0x11bc69[_0x69b7('0x38')][_0x69b7('0x21')]);}return _0x549edd[_0x69b7('0x4c')](_0x2992c9);}})['then'](function(_0x46f95d){if(_0x46f95d){return _0x46f95d?{'count':_0x3ba923,'rows':_0x46f95d}:null;}})['then'](respondWithResult(_0x592cbb,null))[_0x69b7('0x46')](handleError(_0x592cbb,null));};exports[_0x69b7('0x50')]=function(_0x23d768,_0x2218c9,_0x15cbec){var _0x5c7cbc={};var _0x2c538e={};var _0x3c8bf5;var _0x1e5274;return db[_0x69b7('0x2f')][_0x69b7('0x4d')]({'where':{'id':_0x23d768[_0x69b7('0x4b')]['id']}})[_0x69b7('0x29')](handleEntityNotFound(_0x2218c9,null))['then'](function(_0x358292){if(_0x358292){_0x3c8bf5=_0x358292;_0x2c538e['model']=_[_0x69b7('0x47')](db[_0x69b7('0x51')][_0x69b7('0x30')]);_0x2c538e[_0x69b7('0x38')]=_['keys'](_0x23d768['query']);_0x2c538e[_0x69b7('0x36')]=_[_0x69b7('0x37')](_0x2c538e[_0x69b7('0x34')],_0x2c538e[_0x69b7('0x38')]);_0x5c7cbc[_0x69b7('0x39')]=_[_0x69b7('0x37')](_0x2c538e[_0x69b7('0x34')],qs['fields'](_0x23d768[_0x69b7('0x38')]['fields']));_0x5c7cbc[_0x69b7('0x39')]=_0x5c7cbc[_0x69b7('0x39')][_0x69b7('0x3b')]?_0x5c7cbc[_0x69b7('0x39')]:_0x2c538e[_0x69b7('0x34')];_0x5c7cbc[_0x69b7('0x4e')]=qs[_0x69b7('0x3d')](_0x23d768[_0x69b7('0x38')]['sort']);_0x5c7cbc[_0x69b7('0x3e')]=qs[_0x69b7('0x36')](_[_0x69b7('0x52')](_0x23d768[_0x69b7('0x38')],_0x2c538e[_0x69b7('0x36')]));if(_0x23d768[_0x69b7('0x38')]['filter']){_0x5c7cbc['where']=_[_0x69b7('0x40')](_0x5c7cbc['where'],{'$or':_[_0x69b7('0x35')](_0x5c7cbc['attributes'],function(_0x239bfe){var _0x5a697e={};_0x5a697e[_0x239bfe]={'$like':'%'+_0x23d768['query'][_0x69b7('0x3f')]+'%'};return _0x5a697e;})});}_0x5c7cbc=_[_0x69b7('0x40')]({},_0x5c7cbc,_0x23d768[_0x69b7('0x42')]);return _0x3c8bf5[_0x69b7('0x50')](_0x5c7cbc);}})[_0x69b7('0x29')](function(_0x5c9dab){if(_0x5c9dab){_0x1e5274=_0x5c9dab['length'];if(!_0x23d768[_0x69b7('0x38')]['hasOwnProperty'](_0x69b7('0x3c'))){_0x5c7cbc[_0x69b7('0x1e')]=qs['limit'](_0x23d768['query'][_0x69b7('0x1e')]);_0x5c7cbc['offset']=qs[_0x69b7('0x21')](_0x23d768[_0x69b7('0x38')][_0x69b7('0x21')]);}return _0x3c8bf5[_0x69b7('0x50')](_0x5c7cbc);}})[_0x69b7('0x29')](function(_0x14be81){if(_0x14be81){return _0x14be81?{'count':_0x1e5274,'rows':_0x14be81}:null;}})[_0x69b7('0x29')](respondWithResult(_0x2218c9,null))[_0x69b7('0x46')](handleError(_0x2218c9,null));};exports[_0x69b7('0x53')]=function(_0x1c9ddd,_0x477b22,_0x316910){var _0x24dea0={};var _0x391688={};var _0x2f1fb8;var _0x14961c;return db[_0x69b7('0x2f')][_0x69b7('0x4d')]({'where':{'id':_0x1c9ddd[_0x69b7('0x4b')]['id']}})[_0x69b7('0x29')](handleEntityNotFound(_0x477b22,null))['then'](function(_0x358b32){if(_0x358b32){_0x2f1fb8=_0x358b32;_0x391688[_0x69b7('0x34')]=_[_0x69b7('0x47')](db[_0x69b7('0x51')][_0x69b7('0x30')]);_0x391688[_0x69b7('0x38')]=_['keys'](_0x1c9ddd['query']);_0x391688['filters']=_[_0x69b7('0x37')](_0x391688['model'],_0x391688[_0x69b7('0x38')]);_0x24dea0['attributes']=_[_0x69b7('0x37')](_0x391688[_0x69b7('0x34')],qs[_0x69b7('0x3a')](_0x1c9ddd[_0x69b7('0x38')][_0x69b7('0x3a')]));_0x24dea0[_0x69b7('0x39')]=_0x24dea0[_0x69b7('0x39')][_0x69b7('0x3b')]?_0x24dea0[_0x69b7('0x39')]:_0x391688[_0x69b7('0x34')];_0x24dea0[_0x69b7('0x4e')]=qs[_0x69b7('0x3d')](_0x1c9ddd[_0x69b7('0x38')]['sort']);_0x24dea0[_0x69b7('0x3e')]=qs['filters'](_[_0x69b7('0x52')](_0x1c9ddd[_0x69b7('0x38')],_0x391688['filters']));if(_0x1c9ddd[_0x69b7('0x38')][_0x69b7('0x3f')]){_0x24dea0['where']=_[_0x69b7('0x40')](_0x24dea0[_0x69b7('0x3e')],{'$or':_[_0x69b7('0x35')](_0x24dea0[_0x69b7('0x39')],function(_0x10865b){var _0x553b7a={};_0x553b7a[_0x10865b]={'$like':'%'+_0x1c9ddd['query']['filter']+'%'};return _0x553b7a;})});}_0x24dea0=_[_0x69b7('0x40')]({},_0x24dea0,_0x1c9ddd[_0x69b7('0x42')]);return _0x2f1fb8['getDescriptions'](_0x24dea0);}})[_0x69b7('0x29')](function(_0x8251ab){if(_0x8251ab){_0x14961c=_0x8251ab['length'];if(!_0x1c9ddd[_0x69b7('0x38')][_0x69b7('0x4f')]('nolimit')){_0x24dea0[_0x69b7('0x1e')]=qs[_0x69b7('0x1e')](_0x1c9ddd[_0x69b7('0x38')][_0x69b7('0x1e')]);_0x24dea0[_0x69b7('0x21')]=qs[_0x69b7('0x21')](_0x1c9ddd['query']['offset']);}return _0x2f1fb8[_0x69b7('0x53')](_0x24dea0);}})[_0x69b7('0x29')](function(_0x2e4f01){if(_0x2e4f01){return _0x2e4f01?{'count':_0x14961c,'rows':_0x2e4f01}:null;}})[_0x69b7('0x29')](respondWithResult(_0x477b22,null))[_0x69b7('0x46')](handleError(_0x477b22,null));}; \ No newline at end of file +var _0x7cec=['apply','reject','save','update','then','end','error','name','index','SugarcrmConfiguration','rawAttributes','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','destroy','getFields','SugarcrmField','sort','getSubjects','findOne','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x9de66,_0x1f0e19){var _0x275653=function(_0xd41e6d){while(--_0xd41e6d){_0x9de66['push'](_0x9de66['shift']());}};_0x275653(++_0x1f0e19);}(_0x7cec,0x17c));var _0xc7ce=function(_0x17ae55,_0x18f15a){_0x17ae55=_0x17ae55-0x0;var _0x1d4922=_0x7cec[_0x17ae55];return _0x1d4922;};'use strict';var emlformat=require(_0xc7ce('0x0'));var rimraf=require(_0xc7ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7ce('0x2'));var rp=require(_0xc7ce('0x3'));var moment=require(_0xc7ce('0x4'));var BPromise=require(_0xc7ce('0x5'));var Mustache=require(_0xc7ce('0x6'));var util=require(_0xc7ce('0x7'));var path=require(_0xc7ce('0x8'));var sox=require(_0xc7ce('0x9'));var csv=require(_0xc7ce('0xa'));var ejs=require(_0xc7ce('0xb'));var fs=require('fs');var fs_extra=require(_0xc7ce('0xc'));var _=require(_0xc7ce('0xd'));var squel=require(_0xc7ce('0xe'));var crypto=require(_0xc7ce('0xf'));var jsforce=require(_0xc7ce('0x10'));var deskjs=require(_0xc7ce('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc7ce('0x12'));var Redis=require(_0xc7ce('0x13'));var authService=require(_0xc7ce('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc7ce('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc7ce('0x16'));var utils=require(_0xc7ce('0x17'));var config=require(_0xc7ce('0x18'));var licenseUtil=require(_0xc7ce('0x19'));var db=require(_0xc7ce('0x1a'))['db'];function respondWithStatusCode(_0x413da2,_0x4d426a){_0x4d426a=_0x4d426a||0xcc;return function(_0x32aa75){if(_0x32aa75){return _0x413da2[_0xc7ce('0x1b')](_0x4d426a);}return _0x413da2[_0xc7ce('0x1c')](_0x4d426a)['end']();};}function respondWithResult(_0x40ce8b,_0x4ecb62){_0x4ecb62=_0x4ecb62||0xc8;return function(_0x25f615){if(_0x25f615){return _0x40ce8b[_0xc7ce('0x1c')](_0x4ecb62)[_0xc7ce('0x1d')](_0x25f615);}};}function respondWithFilteredResult(_0x58dfc5,_0xcf8b53){return function(_0x204f93){if(_0x204f93){var _0x3b9f0b=typeof _0xcf8b53[_0xc7ce('0x1e')]===_0xc7ce('0x1f')&&typeof _0xcf8b53[_0xc7ce('0x20')]===_0xc7ce('0x1f');var _0x10390a=_0x204f93[_0xc7ce('0x21')];var _0x1ece2b=_0x3b9f0b?0x0:_0xcf8b53['offset'];var _0x429138=_0x3b9f0b?_0x204f93['count']:_0xcf8b53['offset']+_0xcf8b53[_0xc7ce('0x20')];var _0x30c059;if(_0x429138>=_0x10390a){_0x429138=_0x10390a;_0x30c059=0xc8;}else{_0x30c059=0xce;}_0x58dfc5[_0xc7ce('0x1c')](_0x30c059);return _0x58dfc5['set'](_0xc7ce('0x22'),_0x1ece2b+'-'+_0x429138+'/'+_0x10390a)[_0xc7ce('0x1d')](_0x204f93);}return null;};}function patchUpdates(_0x4e5eaf){return function(_0x48e8b1){try{jsonpatch[_0xc7ce('0x23')](_0x48e8b1,_0x4e5eaf,!![]);}catch(_0x16421e){return BPromise[_0xc7ce('0x24')](_0x16421e);}return _0x48e8b1[_0xc7ce('0x25')]();};}function saveUpdates(_0x1b236f,_0x2edf48){return function(_0x2e1773){if(_0x2e1773){return _0x2e1773[_0xc7ce('0x26')](_0x1b236f)[_0xc7ce('0x27')](function(_0x13545e){return _0x13545e;});}return null;};}function removeEntity(_0x45c024,_0x3d322b){return function(_0x229d2b){if(_0x229d2b){return _0x229d2b['destroy']()['then'](function(){_0x45c024[_0xc7ce('0x1c')](0xcc)[_0xc7ce('0x28')]();});}};}function handleEntityNotFound(_0x1f65ca,_0x42abc6){return function(_0xe2fe81){if(!_0xe2fe81){_0x1f65ca[_0xc7ce('0x1b')](0x194);}return _0xe2fe81;};}function handleError(_0x25a943,_0x4d855e){_0x4d855e=_0x4d855e||0x1f4;return function(_0x143502){logger[_0xc7ce('0x29')](_0x143502['stack']);if(_0x143502['name']){delete _0x143502[_0xc7ce('0x2a')];}_0x25a943['status'](_0x4d855e)['send'](_0x143502);};}exports[_0xc7ce('0x2b')]=function(_0x3eb3d9,_0x5b74d1){var _0x354f4c={},_0x55d939={},_0x3db139={'count':0x0,'rows':[]};var _0x2a000b=_['map'](db[_0xc7ce('0x2c')][_0xc7ce('0x2d')],function(_0x276d08){return{'name':_0x276d08['fieldName'],'type':_0x276d08[_0xc7ce('0x2e')][_0xc7ce('0x2f')]};});_0x55d939['model']=_[_0xc7ce('0x30')](_0x2a000b,_0xc7ce('0x2a'));_0x55d939['query']=_[_0xc7ce('0x31')](_0x3eb3d9[_0xc7ce('0x32')]);_0x55d939[_0xc7ce('0x33')]=_[_0xc7ce('0x34')](_0x55d939['model'],_0x55d939[_0xc7ce('0x32')]);_0x354f4c[_0xc7ce('0x35')]=_[_0xc7ce('0x34')](_0x55d939[_0xc7ce('0x36')],qs[_0xc7ce('0x37')](_0x3eb3d9[_0xc7ce('0x32')][_0xc7ce('0x37')]));_0x354f4c[_0xc7ce('0x35')]=_0x354f4c['attributes'][_0xc7ce('0x38')]?_0x354f4c['attributes']:_0x55d939[_0xc7ce('0x36')];if(!_0x3eb3d9[_0xc7ce('0x32')][_0xc7ce('0x39')](_0xc7ce('0x3a'))){_0x354f4c['limit']=qs[_0xc7ce('0x20')](_0x3eb3d9[_0xc7ce('0x32')][_0xc7ce('0x20')]);_0x354f4c['offset']=qs['offset'](_0x3eb3d9[_0xc7ce('0x32')][_0xc7ce('0x1e')]);}_0x354f4c[_0xc7ce('0x3b')]=qs['sort'](_0x3eb3d9['query']['sort']);_0x354f4c[_0xc7ce('0x3c')]=qs[_0xc7ce('0x33')](_['pick'](_0x3eb3d9['query'],_0x55d939[_0xc7ce('0x33')]),_0x2a000b);if(_0x3eb3d9[_0xc7ce('0x32')][_0xc7ce('0x3d')]){_0x354f4c['where']=_['merge'](_0x354f4c[_0xc7ce('0x3c')],{'$or':_['map'](_0x2a000b,function(_0x2fc8a6){if(_0x2fc8a6[_0xc7ce('0x2e')]!==_0xc7ce('0x3e')){var _0x147162={};_0x147162[_0x2fc8a6[_0xc7ce('0x2a')]]={'$like':'%'+_0x3eb3d9[_0xc7ce('0x32')][_0xc7ce('0x3d')]+'%'};return _0x147162;}})});}_0x354f4c=_[_0xc7ce('0x3f')]({},_0x354f4c,_0x3eb3d9['options']);var _0x3dc121={'where':_0x354f4c[_0xc7ce('0x3c')]};return db[_0xc7ce('0x2c')]['count'](_0x3dc121)['then'](function(_0x1cb39b){_0x3db139[_0xc7ce('0x21')]=_0x1cb39b;if(_0x3eb3d9['query'][_0xc7ce('0x40')]){_0x354f4c[_0xc7ce('0x41')]=[{'all':!![]}];}return db[_0xc7ce('0x2c')][_0xc7ce('0x42')](_0x354f4c);})[_0xc7ce('0x27')](function(_0x59b71f){_0x3db139[_0xc7ce('0x43')]=_0x59b71f;return _0x3db139;})[_0xc7ce('0x27')](respondWithFilteredResult(_0x5b74d1,_0x354f4c))[_0xc7ce('0x44')](handleError(_0x5b74d1,null));};exports[_0xc7ce('0x45')]=function(_0x5422a3,_0x26875c){var _0x57a149={'raw':![],'where':{'id':_0x5422a3['params']['id']}},_0x431803={};_0x431803[_0xc7ce('0x36')]=_[_0xc7ce('0x31')](db[_0xc7ce('0x2c')]['rawAttributes']);_0x431803['query']=_[_0xc7ce('0x31')](_0x5422a3[_0xc7ce('0x32')]);_0x431803[_0xc7ce('0x33')]=_[_0xc7ce('0x34')](_0x431803['model'],_0x431803[_0xc7ce('0x32')]);_0x57a149[_0xc7ce('0x35')]=_[_0xc7ce('0x34')](_0x431803['model'],qs[_0xc7ce('0x37')](_0x5422a3[_0xc7ce('0x32')][_0xc7ce('0x37')]));_0x57a149['attributes']=_0x57a149[_0xc7ce('0x35')][_0xc7ce('0x38')]?_0x57a149[_0xc7ce('0x35')]:_0x431803[_0xc7ce('0x36')];if(_0x5422a3[_0xc7ce('0x32')]['includeAll']){_0x57a149[_0xc7ce('0x41')]=[{'all':!![]}];}_0x57a149=_[_0xc7ce('0x3f')]({},_0x57a149,_0x5422a3[_0xc7ce('0x46')]);return db[_0xc7ce('0x2c')][_0xc7ce('0x47')](_0x57a149)[_0xc7ce('0x27')](handleEntityNotFound(_0x26875c,null))['then'](respondWithResult(_0x26875c,null))[_0xc7ce('0x44')](handleError(_0x26875c,null));};exports['create']=function(_0x55a143,_0x5ec28a){return db[_0xc7ce('0x2c')][_0xc7ce('0x48')](_0x55a143[_0xc7ce('0x49')],{})[_0xc7ce('0x27')](respondWithResult(_0x5ec28a,0xc9))[_0xc7ce('0x44')](handleError(_0x5ec28a,null));};exports[_0xc7ce('0x26')]=function(_0x494807,_0x1ea763){if(_0x494807[_0xc7ce('0x49')]['id']){delete _0x494807[_0xc7ce('0x49')]['id'];}return db[_0xc7ce('0x2c')][_0xc7ce('0x47')]({'where':{'id':_0x494807[_0xc7ce('0x4a')]['id']}})[_0xc7ce('0x27')](handleEntityNotFound(_0x1ea763,null))[_0xc7ce('0x27')](saveUpdates(_0x494807[_0xc7ce('0x49')],null))[_0xc7ce('0x27')](respondWithResult(_0x1ea763,null))[_0xc7ce('0x44')](handleError(_0x1ea763,null));};exports[_0xc7ce('0x4b')]=function(_0x22d893,_0x1bb596){return db[_0xc7ce('0x2c')][_0xc7ce('0x47')]({'where':{'id':_0x22d893[_0xc7ce('0x4a')]['id']}})[_0xc7ce('0x27')](handleEntityNotFound(_0x1bb596,null))[_0xc7ce('0x27')](removeEntity(_0x1bb596,null))[_0xc7ce('0x44')](handleError(_0x1bb596,null));};exports[_0xc7ce('0x4c')]=function(_0x404b98,_0xe38d42,_0x4f545f){var _0x10ee18={};var _0x32a1a6={};var _0x1a814e;var _0x56e8be;return db[_0xc7ce('0x2c')]['findOne']({'where':{'id':_0x404b98[_0xc7ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe38d42,null))[_0xc7ce('0x27')](function(_0x237127){if(_0x237127){_0x1a814e=_0x237127;_0x32a1a6[_0xc7ce('0x36')]=_[_0xc7ce('0x31')](db[_0xc7ce('0x4d')][_0xc7ce('0x2d')]);_0x32a1a6['query']=_['keys'](_0x404b98['query']);_0x32a1a6[_0xc7ce('0x33')]=_['intersection'](_0x32a1a6[_0xc7ce('0x36')],_0x32a1a6[_0xc7ce('0x32')]);_0x10ee18[_0xc7ce('0x35')]=_[_0xc7ce('0x34')](_0x32a1a6['model'],qs[_0xc7ce('0x37')](_0x404b98[_0xc7ce('0x32')][_0xc7ce('0x37')]));_0x10ee18[_0xc7ce('0x35')]=_0x10ee18[_0xc7ce('0x35')]['length']?_0x10ee18[_0xc7ce('0x35')]:_0x32a1a6[_0xc7ce('0x36')];_0x10ee18[_0xc7ce('0x3b')]=qs[_0xc7ce('0x4e')](_0x404b98[_0xc7ce('0x32')][_0xc7ce('0x4e')]);_0x10ee18[_0xc7ce('0x3c')]=qs[_0xc7ce('0x33')](_['pick'](_0x404b98['query'],_0x32a1a6[_0xc7ce('0x33')]));if(_0x404b98['query'][_0xc7ce('0x3d')]){_0x10ee18[_0xc7ce('0x3c')]=_[_0xc7ce('0x3f')](_0x10ee18[_0xc7ce('0x3c')],{'$or':_[_0xc7ce('0x30')](_0x10ee18[_0xc7ce('0x35')],function(_0x32d109){var _0x5dab46={};_0x5dab46[_0x32d109]={'$like':'%'+_0x404b98[_0xc7ce('0x32')][_0xc7ce('0x3d')]+'%'};return _0x5dab46;})});}_0x10ee18=_['merge']({},_0x10ee18,_0x404b98[_0xc7ce('0x46')]);return _0x1a814e['getFields'](_0x10ee18);}})[_0xc7ce('0x27')](function(_0x106616){if(_0x106616){_0x56e8be=_0x106616[_0xc7ce('0x38')];if(!_0x404b98[_0xc7ce('0x32')][_0xc7ce('0x39')](_0xc7ce('0x3a'))){_0x10ee18[_0xc7ce('0x20')]=qs[_0xc7ce('0x20')](_0x404b98[_0xc7ce('0x32')][_0xc7ce('0x20')]);_0x10ee18[_0xc7ce('0x1e')]=qs[_0xc7ce('0x1e')](_0x404b98[_0xc7ce('0x32')][_0xc7ce('0x1e')]);}return _0x1a814e[_0xc7ce('0x4c')](_0x10ee18);}})['then'](function(_0x371c0e){if(_0x371c0e){return _0x371c0e?{'count':_0x56e8be,'rows':_0x371c0e}:null;}})[_0xc7ce('0x27')](respondWithResult(_0xe38d42,null))['catch'](handleError(_0xe38d42,null));};exports[_0xc7ce('0x4f')]=function(_0x15322c,_0x2a9aa1,_0x5b195e){var _0x36f9d9={};var _0x5ed65a={};var _0xabf251;var _0xb03f23;return db[_0xc7ce('0x2c')][_0xc7ce('0x50')]({'where':{'id':_0x15322c[_0xc7ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a9aa1,null))[_0xc7ce('0x27')](function(_0x194a3f){if(_0x194a3f){_0xabf251=_0x194a3f;_0x5ed65a[_0xc7ce('0x36')]=_[_0xc7ce('0x31')](db[_0xc7ce('0x4d')][_0xc7ce('0x2d')]);_0x5ed65a[_0xc7ce('0x32')]=_[_0xc7ce('0x31')](_0x15322c[_0xc7ce('0x32')]);_0x5ed65a[_0xc7ce('0x33')]=_[_0xc7ce('0x34')](_0x5ed65a[_0xc7ce('0x36')],_0x5ed65a[_0xc7ce('0x32')]);_0x36f9d9[_0xc7ce('0x35')]=_['intersection'](_0x5ed65a[_0xc7ce('0x36')],qs[_0xc7ce('0x37')](_0x15322c[_0xc7ce('0x32')]['fields']));_0x36f9d9[_0xc7ce('0x35')]=_0x36f9d9['attributes']['length']?_0x36f9d9[_0xc7ce('0x35')]:_0x5ed65a[_0xc7ce('0x36')];_0x36f9d9['order']=qs['sort'](_0x15322c['query'][_0xc7ce('0x4e')]);_0x36f9d9[_0xc7ce('0x3c')]=qs['filters'](_[_0xc7ce('0x51')](_0x15322c['query'],_0x5ed65a[_0xc7ce('0x33')]));if(_0x15322c['query'][_0xc7ce('0x3d')]){_0x36f9d9[_0xc7ce('0x3c')]=_[_0xc7ce('0x3f')](_0x36f9d9[_0xc7ce('0x3c')],{'$or':_[_0xc7ce('0x30')](_0x36f9d9[_0xc7ce('0x35')],function(_0x1193d2){var _0x43ca12={};_0x43ca12[_0x1193d2]={'$like':'%'+_0x15322c[_0xc7ce('0x32')]['filter']+'%'};return _0x43ca12;})});}_0x36f9d9=_[_0xc7ce('0x3f')]({},_0x36f9d9,_0x15322c['options']);return _0xabf251[_0xc7ce('0x4f')](_0x36f9d9);}})[_0xc7ce('0x27')](function(_0x520920){if(_0x520920){_0xb03f23=_0x520920[_0xc7ce('0x38')];if(!_0x15322c[_0xc7ce('0x32')][_0xc7ce('0x39')](_0xc7ce('0x3a'))){_0x36f9d9[_0xc7ce('0x20')]=qs[_0xc7ce('0x20')](_0x15322c[_0xc7ce('0x32')]['limit']);_0x36f9d9[_0xc7ce('0x1e')]=qs[_0xc7ce('0x1e')](_0x15322c['query'][_0xc7ce('0x1e')]);}return _0xabf251['getSubjects'](_0x36f9d9);}})[_0xc7ce('0x27')](function(_0x593d33){if(_0x593d33){return _0x593d33?{'count':_0xb03f23,'rows':_0x593d33}:null;}})[_0xc7ce('0x27')](respondWithResult(_0x2a9aa1,null))[_0xc7ce('0x44')](handleError(_0x2a9aa1,null));};exports[_0xc7ce('0x52')]=function(_0x37b89e,_0x49bd88,_0x535ac0){var _0x2f8498={};var _0x30e395={};var _0x3c9e97;var _0x37a891;return db[_0xc7ce('0x2c')][_0xc7ce('0x50')]({'where':{'id':_0x37b89e[_0xc7ce('0x4a')]['id']}})[_0xc7ce('0x27')](handleEntityNotFound(_0x49bd88,null))[_0xc7ce('0x27')](function(_0x3ed9ec){if(_0x3ed9ec){_0x3c9e97=_0x3ed9ec;_0x30e395['model']=_['keys'](db[_0xc7ce('0x4d')]['rawAttributes']);_0x30e395['query']=_['keys'](_0x37b89e[_0xc7ce('0x32')]);_0x30e395['filters']=_[_0xc7ce('0x34')](_0x30e395['model'],_0x30e395[_0xc7ce('0x32')]);_0x2f8498[_0xc7ce('0x35')]=_[_0xc7ce('0x34')](_0x30e395[_0xc7ce('0x36')],qs['fields'](_0x37b89e['query'][_0xc7ce('0x37')]));_0x2f8498[_0xc7ce('0x35')]=_0x2f8498['attributes'][_0xc7ce('0x38')]?_0x2f8498[_0xc7ce('0x35')]:_0x30e395['model'];_0x2f8498[_0xc7ce('0x3b')]=qs[_0xc7ce('0x4e')](_0x37b89e[_0xc7ce('0x32')][_0xc7ce('0x4e')]);_0x2f8498['where']=qs[_0xc7ce('0x33')](_[_0xc7ce('0x51')](_0x37b89e[_0xc7ce('0x32')],_0x30e395[_0xc7ce('0x33')]));if(_0x37b89e[_0xc7ce('0x32')]['filter']){_0x2f8498[_0xc7ce('0x3c')]=_[_0xc7ce('0x3f')](_0x2f8498[_0xc7ce('0x3c')],{'$or':_[_0xc7ce('0x30')](_0x2f8498[_0xc7ce('0x35')],function(_0x175252){var _0x5b6aa4={};_0x5b6aa4[_0x175252]={'$like':'%'+_0x37b89e['query'][_0xc7ce('0x3d')]+'%'};return _0x5b6aa4;})});}_0x2f8498=_[_0xc7ce('0x3f')]({},_0x2f8498,_0x37b89e[_0xc7ce('0x46')]);return _0x3c9e97['getDescriptions'](_0x2f8498);}})['then'](function(_0x5881f1){if(_0x5881f1){_0x37a891=_0x5881f1[_0xc7ce('0x38')];if(!_0x37b89e['query'][_0xc7ce('0x39')](_0xc7ce('0x3a'))){_0x2f8498[_0xc7ce('0x20')]=qs['limit'](_0x37b89e[_0xc7ce('0x32')][_0xc7ce('0x20')]);_0x2f8498[_0xc7ce('0x1e')]=qs[_0xc7ce('0x1e')](_0x37b89e[_0xc7ce('0x32')][_0xc7ce('0x1e')]);}return _0x3c9e97[_0xc7ce('0x52')](_0x2f8498);}})['then'](function(_0x195ef2){if(_0x195ef2){return _0x195ef2?{'count':_0x37a891,'rows':_0x195ef2}:null;}})[_0xc7ce('0x27')](respondWithResult(_0x49bd88,null))[_0xc7ce('0x44')](handleError(_0x49bd88,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5168f24..44a73d2 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 _0x5495=['path','rimraf','../../config/environment','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x36404e,_0x50c006){var _0x3012db=function(_0x18a7d8){while(--_0x18a7d8){_0x36404e['push'](_0x36404e['shift']());}};_0x3012db(++_0x50c006);}(_0x5495,0x1be));var _0x5549=function(_0x5e797d,_0x26dab9){_0x5e797d=_0x5e797d-0x0;var _0x2d6a23=_0x5495[_0x5e797d];return _0x2d6a23;};'use strict';var _=require('lodash');var util=require(_0x5549('0x0'));var logger=require(_0x5549('0x1'))(_0x5549('0x2'));var moment=require(_0x5549('0x3'));var BPromise=require(_0x5549('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5549('0x5'));var rimraf=require(_0x5549('0x6'));var config=require(_0x5549('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x509b7b,_0x23c709){return _0x509b7b[_0x5549('0x8')](_0x5549('0x9'),attributes,{'tableName':_0x5549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad7a=['../../config/logger','rimraf','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad7a,0xde));var _0xaad7=function(_0x2102b7,_0x55f03f){_0x2102b7=_0x2102b7-0x0;var _0x372c4c=_0xad7a[_0x2102b7];return _0x372c4c;};'use strict';var _=require(_0xaad7('0x0'));var util=require(_0xaad7('0x1'));var logger=require(_0xaad7('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaad7('0x3'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xaad7('0x4')]=function(_0x92fd42,_0xf77762){return _0x92fd42[_0xaad7('0x5')](_0xaad7('0x6'),attributes,{'tableName':_0xaad7('0x7'),'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 e7fb3bf..a7ae2c4 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 _0x98be=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98be,0xe5));var _0xe98b=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x98be[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xe98b('0x0'));var util=require(_0xe98b('0x1'));var moment=require(_0xe98b('0x2'));var BPromise=require(_0xe98b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe98b('0x4'));var db=require(_0xe98b('0x5'))['db'];var utils=require(_0xe98b('0x6'));var logger=require('../../config/logger')(_0xe98b('0x7'));var config=require(_0xe98b('0x8'));var jayson=require(_0xe98b('0x9'));var client=jayson[_0xe98b('0xa')][_0xe98b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2db238,_0x43fc38,_0x44e260){return new BPromise(function(_0x2cf3b7,_0x4c1506){return client['request'](_0x2db238,_0x44e260)['then'](function(_0x450b66){logger['info'](_0xe98b('0xc'),_0x43fc38,'request\x20sent');logger[_0xe98b('0xd')](_0xe98b('0xe'),_0x43fc38,_0xe98b('0xf'),JSON[_0xe98b('0x10')](_0x450b66));if(_0x450b66[_0xe98b('0x11')]){if(_0x450b66[_0xe98b('0x11')][_0xe98b('0x12')]===0x1f4){logger['error'](_0xe98b('0xc'),_0x43fc38,_0x450b66[_0xe98b('0x11')][_0xe98b('0x13')]);return _0x4c1506(_0x450b66[_0xe98b('0x11')][_0xe98b('0x13')]);}logger['error'](_0xe98b('0xc'),_0x43fc38,_0x450b66['error'][_0xe98b('0x13')]);return _0x2cf3b7(_0x450b66[_0xe98b('0x11')][_0xe98b('0x13')]);}else{logger[_0xe98b('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x43fc38,_0xe98b('0xf'));_0x2cf3b7(_0x450b66[_0xe98b('0x15')][_0xe98b('0x13')]);}})[_0xe98b('0x16')](function(_0x2a12e9){logger['error'](_0xe98b('0xc'),_0x43fc38,_0x2a12e9);_0x4c1506(_0x2a12e9);});});} \ No newline at end of file +var _0x3cf7=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x3cf7,0xac));var _0x73cf=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x3cf7[_0x4f3b2d];return _0x3dddfa;};'use strict';var _=require(_0x73cf('0x0'));var util=require('util');var moment=require(_0x73cf('0x1'));var BPromise=require(_0x73cf('0x2'));var rs=require(_0x73cf('0x3'));var fs=require('fs');var Redis=require(_0x73cf('0x4'));var db=require(_0x73cf('0x5'))['db'];var utils=require(_0x73cf('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x73cf('0x7'));var jayson=require(_0x73cf('0x8'));var client=jayson[_0x73cf('0x9')][_0x73cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x150b90,_0x2ffac8,_0xbd212a){return new BPromise(function(_0x41df9e,_0x3a242e){return client[_0x73cf('0xb')](_0x150b90,_0xbd212a)['then'](function(_0x6635c0){logger[_0x73cf('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ffac8,_0x73cf('0xd'));logger[_0x73cf('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2ffac8,_0x73cf('0xd'),JSON[_0x73cf('0xf')](_0x6635c0));if(_0x6635c0[_0x73cf('0x10')]){if(_0x6635c0[_0x73cf('0x10')][_0x73cf('0x11')]===0x1f4){logger[_0x73cf('0x10')](_0x73cf('0x12'),_0x2ffac8,_0x6635c0['error'][_0x73cf('0x13')]);return _0x3a242e(_0x6635c0[_0x73cf('0x10')][_0x73cf('0x13')]);}logger['error'](_0x73cf('0x12'),_0x2ffac8,_0x6635c0['error'][_0x73cf('0x13')]);return _0x41df9e(_0x6635c0[_0x73cf('0x10')][_0x73cf('0x13')]);}else{logger[_0x73cf('0xc')](_0x73cf('0x12'),_0x2ffac8,_0x73cf('0xd'));_0x41df9e(_0x6635c0[_0x73cf('0x14')][_0x73cf('0x13')]);}})[_0x73cf('0x15')](function(_0xffe370){logger[_0x73cf('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ffac8,_0xffe370);_0x3a242e(_0xffe370);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b4969b0..d77e24a 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 _0x8840=['./intSugarcrmField.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x53bb2b,_0x79a8fb){var _0x54afbb=function(_0x227322){while(--_0x227322){_0x53bb2b['push'](_0x53bb2b['shift']());}};_0x54afbb(++_0x79a8fb);}(_0x8840,0x1a9));var _0x0884=function(_0x530a58,_0x141d0a){_0x530a58=_0x530a58-0x0;var _0x46efd4=_0x8840[_0x530a58];return _0x46efd4;};'use strict';var multer=require(_0x0884('0x0'));var util=require('util');var path=require(_0x0884('0x1'));var timeout=require(_0x0884('0x2'));var express=require('express');var router=express[_0x0884('0x3')]();var fs_extra=require(_0x0884('0x4'));var auth=require(_0x0884('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0884('0x6'));var controller=require(_0x0884('0x7'));router[_0x0884('0x8')]('/',auth[_0x0884('0x9')](),controller['index']);router[_0x0884('0x8')](_0x0884('0xa'),auth[_0x0884('0x9')](),controller[_0x0884('0xb')]);router[_0x0884('0xc')]('/',auth['isAuthenticated'](),controller[_0x0884('0xd')]);router[_0x0884('0xe')](_0x0884('0xa'),auth[_0x0884('0x9')](),controller[_0x0884('0xf')]);router['delete'](_0x0884('0xa'),auth[_0x0884('0x9')](),controller[_0x0884('0x10')]);module[_0x0884('0x11')]=router; \ No newline at end of file +var _0x4ec5=['create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post'];(function(_0x3bceeb,_0x28713c){var _0x15446b=function(_0x428726){while(--_0x428726){_0x3bceeb['push'](_0x3bceeb['shift']());}};_0x15446b(++_0x28713c);}(_0x4ec5,0x124));var _0x54ec=function(_0x423258,_0x2960d2){_0x423258=_0x423258-0x0;var _0x1ea61b=_0x4ec5[_0x423258];return _0x1ea61b;};'use strict';var multer=require(_0x54ec('0x0'));var util=require('util');var path=require(_0x54ec('0x1'));var timeout=require(_0x54ec('0x2'));var express=require(_0x54ec('0x3'));var router=express['Router']();var fs_extra=require(_0x54ec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x54ec('0x5'));var config=require(_0x54ec('0x6'));var controller=require('./intSugarcrmField.controller');router[_0x54ec('0x7')]('/',auth[_0x54ec('0x8')](),controller[_0x54ec('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x54ec('0xa')]);router[_0x54ec('0xb')]('/',auth[_0x54ec('0x8')](),controller[_0x54ec('0xc')]);router[_0x54ec('0xd')](_0x54ec('0xe'),auth[_0x54ec('0x8')](),controller[_0x54ec('0xf')]);router[_0x54ec('0x10')](_0x54ec('0xe'),auth[_0x54ec('0x8')](),controller[_0x54ec('0x11')]);module[_0x54ec('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 08a11b6..ec5e499 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 _0x8b01=['string','STRING','BOOLEAN','sequelize','exports','variable','customVariable','picklist'];(function(_0x5385e8,_0x162424){var _0x271b34=function(_0x27f71d){while(--_0x27f71d){_0x5385e8['push'](_0x5385e8['shift']());}};_0x271b34(++_0x162424);}(_0x8b01,0x143));var _0x18b0=function(_0x330319,_0x4406b0){_0x330319=_0x330319-0x0;var _0x494d34=_0x8b01[_0x330319];return _0x494d34;};'use strict';var Sequelize=require(_0x18b0('0x0'));module[_0x18b0('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x18b0('0x2'),_0x18b0('0x3'),'keyValue',_0x18b0('0x4')),'defaultValue':_0x18b0('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x18b0('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x18b0('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x18b0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x18b0('0x6')]},'customField':{'type':Sequelize[_0x18b0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x18b0('0x6')]}}; \ No newline at end of file +var _0x8c07=['keyValue','picklist','STRING','ENUM','BOOLEAN','exports','string','variable','customVariable'];(function(_0x303ac4,_0x437429){var _0x4d5cec=function(_0x2647d0){while(--_0x2647d0){_0x303ac4['push'](_0x303ac4['shift']());}};_0x4d5cec(++_0x437429);}(_0x8c07,0x12e));var _0x78c0=function(_0x91567d,_0x30a1f1){_0x91567d=_0x91567d-0x0;var _0x138761=_0x8c07[_0x91567d];return _0x138761;};'use strict';var Sequelize=require('sequelize');module[_0x78c0('0x0')]={'type':{'type':Sequelize['ENUM'](_0x78c0('0x1'),_0x78c0('0x2'),_0x78c0('0x3'),_0x78c0('0x4'),_0x78c0('0x5')),'defaultValue':_0x78c0('0x1')},'content':{'type':Sequelize[_0x78c0('0x6')]},'key':{'type':Sequelize[_0x78c0('0x6')]},'keyType':{'type':Sequelize[_0x78c0('0x7')](_0x78c0('0x1'),'variable',_0x78c0('0x3'))},'keyContent':{'type':Sequelize[_0x78c0('0x6')]},'idField':{'type':Sequelize[_0x78c0('0x6')]},'nameField':{'type':Sequelize[_0x78c0('0x6')]},'customField':{'type':Sequelize[_0x78c0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x78c0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 3662344..726a7c2 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 _0xb831=['rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','then','destroy','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','update','eml-format'];(function(_0x2e3eb5,_0x40367e){var _0x1617fc=function(_0xe77b66){while(--_0xe77b66){_0x2e3eb5['push'](_0x2e3eb5['shift']());}};_0x1617fc(++_0x40367e);}(_0xb831,0x1af));var _0x1b83=function(_0x3d3fea,_0xb9616e){_0x3d3fea=_0x3d3fea-0x0;var _0x13744c=_0xb831[_0x3d3fea];return _0x13744c;};'use strict';var emlformat=require(_0x1b83('0x0'));var rimraf=require(_0x1b83('0x1'));var zipdir=require(_0x1b83('0x2'));var jsonpatch=require(_0x1b83('0x3'));var rp=require('request-promise');var moment=require(_0x1b83('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1b83('0x5'));var util=require('util');var path=require(_0x1b83('0x6'));var sox=require(_0x1b83('0x7'));var csv=require(_0x1b83('0x8'));var ejs=require(_0x1b83('0x9'));var fs=require('fs');var fs_extra=require(_0x1b83('0xa'));var _=require('lodash');var squel=require(_0x1b83('0xb'));var crypto=require(_0x1b83('0xc'));var jsforce=require(_0x1b83('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1b83('0x8'));var querystring=require('querystring');var Papa=require(_0x1b83('0xe'));var Redis=require(_0x1b83('0xf'));var authService=require(_0x1b83('0x10'));var qs=require(_0x1b83('0x11'));var as=require(_0x1b83('0x12'));var hardwareService=require(_0x1b83('0x13'));var logger=require('../../config/logger')(_0x1b83('0x14'));var utils=require('../../config/utils');var config=require(_0x1b83('0x15'));var licenseUtil=require(_0x1b83('0x16'));var db=require(_0x1b83('0x17'))['db'];function respondWithStatusCode(_0x591c10,_0x133383){_0x133383=_0x133383||0xcc;return function(_0x2438af){if(_0x2438af){return _0x591c10[_0x1b83('0x18')](_0x133383);}return _0x591c10[_0x1b83('0x19')](_0x133383)[_0x1b83('0x1a')]();};}function respondWithResult(_0x5368c9,_0x58a54a){_0x58a54a=_0x58a54a||0xc8;return function(_0x9e8979){if(_0x9e8979){return _0x5368c9[_0x1b83('0x19')](_0x58a54a)['json'](_0x9e8979);}};}function respondWithFilteredResult(_0x1aa264,_0x36e397){return function(_0x4ceca0){if(_0x4ceca0){var _0x279920=typeof _0x36e397[_0x1b83('0x1b')]===_0x1b83('0x1c')&&typeof _0x36e397[_0x1b83('0x1d')]==='undefined';var _0x2a497a=_0x4ceca0[_0x1b83('0x1e')];var _0x20539b=_0x279920?0x0:_0x36e397['offset'];var _0x96c3f7=_0x279920?_0x4ceca0[_0x1b83('0x1e')]:_0x36e397[_0x1b83('0x1b')]+_0x36e397[_0x1b83('0x1d')];var _0x4fe81e;if(_0x96c3f7>=_0x2a497a){_0x96c3f7=_0x2a497a;_0x4fe81e=0xc8;}else{_0x4fe81e=0xce;}_0x1aa264[_0x1b83('0x19')](_0x4fe81e);return _0x1aa264[_0x1b83('0x1f')](_0x1b83('0x20'),_0x20539b+'-'+_0x96c3f7+'/'+_0x2a497a)[_0x1b83('0x21')](_0x4ceca0);}return null;};}function patchUpdates(_0x3c8ebd){return function(_0x10bd34){try{jsonpatch['apply'](_0x10bd34,_0x3c8ebd,!![]);}catch(_0x405ece){return BPromise[_0x1b83('0x22')](_0x405ece);}return _0x10bd34['save']();};}function saveUpdates(_0x8a2c69,_0x3a6f7b){return function(_0x1afdf7){if(_0x1afdf7){return _0x1afdf7['update'](_0x8a2c69)[_0x1b83('0x23')](function(_0x5b96ff){return _0x5b96ff;});}return null;};}function removeEntity(_0x1755d8,_0x23ec1a){return function(_0x2371c7){if(_0x2371c7){return _0x2371c7[_0x1b83('0x24')]()[_0x1b83('0x23')](function(){_0x1755d8[_0x1b83('0x19')](0xcc)[_0x1b83('0x1a')]();});}};}function handleEntityNotFound(_0x1b767d,_0x27dcde){return function(_0xa69f41){if(!_0xa69f41){_0x1b767d[_0x1b83('0x18')](0x194);}return _0xa69f41;};}function handleError(_0x14f028,_0x29d3e3){_0x29d3e3=_0x29d3e3||0x1f4;return function(_0x11de58){logger['error'](_0x11de58['stack']);if(_0x11de58[_0x1b83('0x25')]){delete _0x11de58['name'];}_0x14f028['status'](_0x29d3e3)[_0x1b83('0x26')](_0x11de58);};}exports[_0x1b83('0x27')]=function(_0x4fc701,_0xc15276){var _0x44623d={},_0x526d71={},_0x1b5c04={'count':0x0,'rows':[]};var _0x36bf01=_[_0x1b83('0x28')](db[_0x1b83('0x29')][_0x1b83('0x2a')],function(_0x48e6ec){return{'name':_0x48e6ec['fieldName'],'type':_0x48e6ec[_0x1b83('0x2b')][_0x1b83('0x2c')]};});_0x526d71[_0x1b83('0x2d')]=_['map'](_0x36bf01,'name');_0x526d71[_0x1b83('0x2e')]=_[_0x1b83('0x2f')](_0x4fc701[_0x1b83('0x2e')]);_0x526d71['filters']=_[_0x1b83('0x30')](_0x526d71[_0x1b83('0x2d')],_0x526d71[_0x1b83('0x2e')]);_0x44623d[_0x1b83('0x31')]=_['intersection'](_0x526d71[_0x1b83('0x2d')],qs['fields'](_0x4fc701['query'][_0x1b83('0x32')]));_0x44623d['attributes']=_0x44623d[_0x1b83('0x31')][_0x1b83('0x33')]?_0x44623d[_0x1b83('0x31')]:_0x526d71[_0x1b83('0x2d')];if(!_0x4fc701[_0x1b83('0x2e')][_0x1b83('0x34')](_0x1b83('0x35'))){_0x44623d[_0x1b83('0x1d')]=qs[_0x1b83('0x1d')](_0x4fc701['query'][_0x1b83('0x1d')]);_0x44623d['offset']=qs[_0x1b83('0x1b')](_0x4fc701[_0x1b83('0x2e')]['offset']);}_0x44623d[_0x1b83('0x36')]=qs['sort'](_0x4fc701[_0x1b83('0x2e')][_0x1b83('0x37')]);_0x44623d[_0x1b83('0x38')]=qs[_0x1b83('0x39')](_['pick'](_0x4fc701[_0x1b83('0x2e')],_0x526d71['filters']),_0x36bf01);if(_0x4fc701[_0x1b83('0x2e')][_0x1b83('0x3a')]){_0x44623d[_0x1b83('0x38')]=_[_0x1b83('0x3b')](_0x44623d[_0x1b83('0x38')],{'$or':_[_0x1b83('0x28')](_0x36bf01,function(_0x1ccd67){if(_0x1ccd67[_0x1b83('0x2b')]!=='VIRTUAL'){var _0x1f7331={};_0x1f7331[_0x1ccd67[_0x1b83('0x25')]]={'$like':'%'+_0x4fc701['query']['filter']+'%'};return _0x1f7331;}})});}_0x44623d=_['merge']({},_0x44623d,_0x4fc701[_0x1b83('0x3c')]);var _0x33b16c={'where':_0x44623d[_0x1b83('0x38')]};return db[_0x1b83('0x29')][_0x1b83('0x1e')](_0x33b16c)[_0x1b83('0x23')](function(_0x325ca7){_0x1b5c04[_0x1b83('0x1e')]=_0x325ca7;if(_0x4fc701[_0x1b83('0x2e')]['includeAll']){_0x44623d['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x1b83('0x3d')](_0x44623d);})[_0x1b83('0x23')](function(_0x78c57e){_0x1b5c04[_0x1b83('0x3e')]=_0x78c57e;return _0x1b5c04;})[_0x1b83('0x23')](respondWithFilteredResult(_0xc15276,_0x44623d))[_0x1b83('0x3f')](handleError(_0xc15276,null));};exports[_0x1b83('0x40')]=function(_0xf4adcc,_0x22eac0){var _0x5086f={'raw':!![],'where':{'id':_0xf4adcc[_0x1b83('0x41')]['id']}},_0x4ddff5={};_0x4ddff5[_0x1b83('0x2d')]=_[_0x1b83('0x2f')](db[_0x1b83('0x29')]['rawAttributes']);_0x4ddff5['query']=_[_0x1b83('0x2f')](_0xf4adcc['query']);_0x4ddff5[_0x1b83('0x39')]=_[_0x1b83('0x30')](_0x4ddff5[_0x1b83('0x2d')],_0x4ddff5['query']);_0x5086f[_0x1b83('0x31')]=_[_0x1b83('0x30')](_0x4ddff5['model'],qs[_0x1b83('0x32')](_0xf4adcc[_0x1b83('0x2e')][_0x1b83('0x32')]));_0x5086f[_0x1b83('0x31')]=_0x5086f[_0x1b83('0x31')][_0x1b83('0x33')]?_0x5086f[_0x1b83('0x31')]:_0x4ddff5[_0x1b83('0x2d')];if(_0xf4adcc[_0x1b83('0x2e')][_0x1b83('0x42')]){_0x5086f[_0x1b83('0x43')]=[{'all':!![]}];}_0x5086f=_[_0x1b83('0x3b')]({},_0x5086f,_0xf4adcc[_0x1b83('0x3c')]);return db[_0x1b83('0x29')][_0x1b83('0x44')](_0x5086f)[_0x1b83('0x23')](handleEntityNotFound(_0x22eac0,null))[_0x1b83('0x23')](respondWithResult(_0x22eac0,null))[_0x1b83('0x3f')](handleError(_0x22eac0,null));};exports['create']=function(_0x15c439,_0x3bff57){return db[_0x1b83('0x29')][_0x1b83('0x45')](_0x15c439[_0x1b83('0x46')],{})[_0x1b83('0x23')](respondWithResult(_0x3bff57,0xc9))[_0x1b83('0x3f')](handleError(_0x3bff57,null));};exports[_0x1b83('0x47')]=function(_0x5cef87,_0x57e316){if(_0x5cef87['body']['id']){delete _0x5cef87[_0x1b83('0x46')]['id'];}return db[_0x1b83('0x29')][_0x1b83('0x44')]({'where':{'id':_0x5cef87['params']['id']}})['then'](handleEntityNotFound(_0x57e316,null))[_0x1b83('0x23')](saveUpdates(_0x5cef87[_0x1b83('0x46')],null))[_0x1b83('0x23')](respondWithResult(_0x57e316,null))[_0x1b83('0x3f')](handleError(_0x57e316,null));};exports[_0x1b83('0x24')]=function(_0x303017,_0x2dbae3){return db['SugarcrmField']['find']({'where':{'id':_0x303017[_0x1b83('0x41')]['id']}})[_0x1b83('0x23')](handleEntityNotFound(_0x2dbae3,null))[_0x1b83('0x23')](removeEntity(_0x2dbae3,null))['catch'](handleError(_0x2dbae3,null));}; \ No newline at end of file +var _0x3b3a=['catch','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','keys'];(function(_0x21d11,_0x2c4ebd){var _0x462170=function(_0x2edf7e){while(--_0x2edf7e){_0x21d11['push'](_0x21d11['shift']());}};_0x462170(++_0x2c4ebd);}(_0x3b3a,0x97));var _0xa3b3=function(_0x2f1c92,_0x57eb7a){_0x2f1c92=_0x2f1c92-0x0;var _0x1f155b=_0x3b3a[_0x2f1c92];return _0x1f155b;};'use strict';var emlformat=require(_0xa3b3('0x0'));var rimraf=require(_0xa3b3('0x1'));var zipdir=require(_0xa3b3('0x2'));var jsonpatch=require(_0xa3b3('0x3'));var rp=require('request-promise');var moment=require(_0xa3b3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa3b3('0x5'));var path=require(_0xa3b3('0x6'));var sox=require(_0xa3b3('0x7'));var csv=require(_0xa3b3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa3b3('0x9'));var _=require('lodash');var squel=require(_0xa3b3('0xa'));var crypto=require(_0xa3b3('0xb'));var jsforce=require(_0xa3b3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa3b3('0x8'));var querystring=require(_0xa3b3('0xd'));var Papa=require(_0xa3b3('0xe'));var Redis=require(_0xa3b3('0xf'));var authService=require(_0xa3b3('0x10'));var qs=require(_0xa3b3('0x11'));var as=require(_0xa3b3('0x12'));var hardwareService=require(_0xa3b3('0x13'));var logger=require(_0xa3b3('0x14'))(_0xa3b3('0x15'));var utils=require(_0xa3b3('0x16'));var config=require(_0xa3b3('0x17'));var licenseUtil=require(_0xa3b3('0x18'));var db=require(_0xa3b3('0x19'))['db'];function respondWithStatusCode(_0x556f47,_0xcfdf22){_0xcfdf22=_0xcfdf22||0xcc;return function(_0x456243){if(_0x456243){return _0x556f47[_0xa3b3('0x1a')](_0xcfdf22);}return _0x556f47[_0xa3b3('0x1b')](_0xcfdf22)[_0xa3b3('0x1c')]();};}function respondWithResult(_0x3ccfe6,_0x690d3){_0x690d3=_0x690d3||0xc8;return function(_0x45c5e5){if(_0x45c5e5){return _0x3ccfe6[_0xa3b3('0x1b')](_0x690d3)['json'](_0x45c5e5);}};}function respondWithFilteredResult(_0x5affae,_0x36c620){return function(_0x1ff508){if(_0x1ff508){var _0x143719=typeof _0x36c620[_0xa3b3('0x1d')]==='undefined'&&typeof _0x36c620[_0xa3b3('0x1e')]===_0xa3b3('0x1f');var _0x564378=_0x1ff508[_0xa3b3('0x20')];var _0x218604=_0x143719?0x0:_0x36c620[_0xa3b3('0x1d')];var _0xe2f54b=_0x143719?_0x1ff508[_0xa3b3('0x20')]:_0x36c620['offset']+_0x36c620[_0xa3b3('0x1e')];var _0x5b49dc;if(_0xe2f54b>=_0x564378){_0xe2f54b=_0x564378;_0x5b49dc=0xc8;}else{_0x5b49dc=0xce;}_0x5affae[_0xa3b3('0x1b')](_0x5b49dc);return _0x5affae[_0xa3b3('0x21')](_0xa3b3('0x22'),_0x218604+'-'+_0xe2f54b+'/'+_0x564378)[_0xa3b3('0x23')](_0x1ff508);}return null;};}function patchUpdates(_0x3a17c1){return function(_0x3877ea){try{jsonpatch[_0xa3b3('0x24')](_0x3877ea,_0x3a17c1,!![]);}catch(_0x37e99e){return BPromise['reject'](_0x37e99e);}return _0x3877ea[_0xa3b3('0x25')]();};}function saveUpdates(_0x1685b7,_0x69f727){return function(_0x505b0c){if(_0x505b0c){return _0x505b0c[_0xa3b3('0x26')](_0x1685b7)[_0xa3b3('0x27')](function(_0x21e23a){return _0x21e23a;});}return null;};}function removeEntity(_0x3914eb,_0x534fad){return function(_0x45fc8b){if(_0x45fc8b){return _0x45fc8b[_0xa3b3('0x28')]()[_0xa3b3('0x27')](function(){_0x3914eb[_0xa3b3('0x1b')](0xcc)[_0xa3b3('0x1c')]();});}};}function handleEntityNotFound(_0x140eb1,_0x4d51b5){return function(_0x5e9980){if(!_0x5e9980){_0x140eb1['sendStatus'](0x194);}return _0x5e9980;};}function handleError(_0x56405f,_0x213a82){_0x213a82=_0x213a82||0x1f4;return function(_0x1a817a){logger[_0xa3b3('0x29')](_0x1a817a[_0xa3b3('0x2a')]);if(_0x1a817a[_0xa3b3('0x2b')]){delete _0x1a817a[_0xa3b3('0x2b')];}_0x56405f[_0xa3b3('0x1b')](_0x213a82)[_0xa3b3('0x2c')](_0x1a817a);};}exports[_0xa3b3('0x2d')]=function(_0x2b92e6,_0x5ab913){var _0x7fe61e={},_0x1fd55e={},_0x449414={'count':0x0,'rows':[]};var _0x487fdb=_[_0xa3b3('0x2e')](db[_0xa3b3('0x2f')][_0xa3b3('0x30')],function(_0x5017f1){return{'name':_0x5017f1['fieldName'],'type':_0x5017f1['type']['key']};});_0x1fd55e[_0xa3b3('0x31')]=_[_0xa3b3('0x2e')](_0x487fdb,_0xa3b3('0x2b'));_0x1fd55e[_0xa3b3('0x32')]=_['keys'](_0x2b92e6[_0xa3b3('0x32')]);_0x1fd55e[_0xa3b3('0x33')]=_[_0xa3b3('0x34')](_0x1fd55e[_0xa3b3('0x31')],_0x1fd55e[_0xa3b3('0x32')]);_0x7fe61e[_0xa3b3('0x35')]=_[_0xa3b3('0x34')](_0x1fd55e[_0xa3b3('0x31')],qs['fields'](_0x2b92e6[_0xa3b3('0x32')][_0xa3b3('0x36')]));_0x7fe61e['attributes']=_0x7fe61e['attributes'][_0xa3b3('0x37')]?_0x7fe61e[_0xa3b3('0x35')]:_0x1fd55e[_0xa3b3('0x31')];if(!_0x2b92e6[_0xa3b3('0x32')]['hasOwnProperty'](_0xa3b3('0x38'))){_0x7fe61e[_0xa3b3('0x1e')]=qs[_0xa3b3('0x1e')](_0x2b92e6[_0xa3b3('0x32')][_0xa3b3('0x1e')]);_0x7fe61e['offset']=qs[_0xa3b3('0x1d')](_0x2b92e6[_0xa3b3('0x32')][_0xa3b3('0x1d')]);}_0x7fe61e['order']=qs[_0xa3b3('0x39')](_0x2b92e6[_0xa3b3('0x32')][_0xa3b3('0x39')]);_0x7fe61e[_0xa3b3('0x3a')]=qs[_0xa3b3('0x33')](_['pick'](_0x2b92e6[_0xa3b3('0x32')],_0x1fd55e[_0xa3b3('0x33')]),_0x487fdb);if(_0x2b92e6['query'][_0xa3b3('0x3b')]){_0x7fe61e[_0xa3b3('0x3a')]=_[_0xa3b3('0x3c')](_0x7fe61e[_0xa3b3('0x3a')],{'$or':_['map'](_0x487fdb,function(_0x518ec1){if(_0x518ec1['type']!==_0xa3b3('0x3d')){var _0x1e0956={};_0x1e0956[_0x518ec1[_0xa3b3('0x2b')]]={'$like':'%'+_0x2b92e6[_0xa3b3('0x32')]['filter']+'%'};return _0x1e0956;}})});}_0x7fe61e=_['merge']({},_0x7fe61e,_0x2b92e6[_0xa3b3('0x3e')]);var _0x583cd1={'where':_0x7fe61e[_0xa3b3('0x3a')]};return db[_0xa3b3('0x2f')][_0xa3b3('0x20')](_0x583cd1)[_0xa3b3('0x27')](function(_0x18b0e6){_0x449414[_0xa3b3('0x20')]=_0x18b0e6;if(_0x2b92e6[_0xa3b3('0x32')][_0xa3b3('0x3f')]){_0x7fe61e[_0xa3b3('0x40')]=[{'all':!![]}];}return db['SugarcrmField'][_0xa3b3('0x41')](_0x7fe61e);})[_0xa3b3('0x27')](function(_0x3c718d){_0x449414[_0xa3b3('0x42')]=_0x3c718d;return _0x449414;})['then'](respondWithFilteredResult(_0x5ab913,_0x7fe61e))['catch'](handleError(_0x5ab913,null));};exports['show']=function(_0x302930,_0xe268ec){var _0x44517b={'raw':!![],'where':{'id':_0x302930['params']['id']}},_0x4e3052={};_0x4e3052[_0xa3b3('0x31')]=_['keys'](db[_0xa3b3('0x2f')][_0xa3b3('0x30')]);_0x4e3052['query']=_[_0xa3b3('0x43')](_0x302930[_0xa3b3('0x32')]);_0x4e3052[_0xa3b3('0x33')]=_[_0xa3b3('0x34')](_0x4e3052[_0xa3b3('0x31')],_0x4e3052[_0xa3b3('0x32')]);_0x44517b[_0xa3b3('0x35')]=_[_0xa3b3('0x34')](_0x4e3052[_0xa3b3('0x31')],qs[_0xa3b3('0x36')](_0x302930[_0xa3b3('0x32')]['fields']));_0x44517b['attributes']=_0x44517b[_0xa3b3('0x35')]['length']?_0x44517b[_0xa3b3('0x35')]:_0x4e3052[_0xa3b3('0x31')];if(_0x302930[_0xa3b3('0x32')][_0xa3b3('0x3f')]){_0x44517b[_0xa3b3('0x40')]=[{'all':!![]}];}_0x44517b=_[_0xa3b3('0x3c')]({},_0x44517b,_0x302930[_0xa3b3('0x3e')]);return db[_0xa3b3('0x2f')]['find'](_0x44517b)['then'](handleEntityNotFound(_0xe268ec,null))[_0xa3b3('0x27')](respondWithResult(_0xe268ec,null))[_0xa3b3('0x44')](handleError(_0xe268ec,null));};exports['create']=function(_0x33aab5,_0x1ebc18){return db[_0xa3b3('0x2f')][_0xa3b3('0x45')](_0x33aab5['body'],{})['then'](respondWithResult(_0x1ebc18,0xc9))['catch'](handleError(_0x1ebc18,null));};exports[_0xa3b3('0x26')]=function(_0x2e9bff,_0x1da759){if(_0x2e9bff['body']['id']){delete _0x2e9bff[_0xa3b3('0x46')]['id'];}return db[_0xa3b3('0x2f')]['find']({'where':{'id':_0x2e9bff[_0xa3b3('0x47')]['id']}})[_0xa3b3('0x27')](handleEntityNotFound(_0x1da759,null))[_0xa3b3('0x27')](saveUpdates(_0x2e9bff[_0xa3b3('0x46')],null))[_0xa3b3('0x27')](respondWithResult(_0x1da759,null))['catch'](handleError(_0x1da759,null));};exports['destroy']=function(_0xe8afa0,_0xb2f930){return db[_0xa3b3('0x2f')][_0xa3b3('0x48')]({'where':{'id':_0xe8afa0['params']['id']}})[_0xa3b3('0x27')](handleEntityNotFound(_0xb2f930,null))[_0xa3b3('0x27')](removeEntity(_0xb2f930,null))[_0xa3b3('0x44')](handleError(_0xb2f930,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 3b7cf90..1de5e78 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 _0x372a=['moment','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x47935e,_0x30db48){var _0x82b09=function(_0x6feef7){while(--_0x6feef7){_0x47935e['push'](_0x47935e['shift']());}};_0x82b09(++_0x30db48);}(_0x372a,0x1ca));var _0xa372=function(_0xaeba0c,_0x434a50){_0xaeba0c=_0xaeba0c-0x0;var _0x27dc03=_0x372a[_0xaeba0c];return _0x27dc03;};'use strict';var _=require(_0xa372('0x0'));var util=require(_0xa372('0x1'));var logger=require(_0xa372('0x2'))(_0xa372('0x3'));var moment=require(_0xa372('0x4'));var BPromise=require('bluebird');var rp=require(_0xa372('0x5'));var fs=require('fs');var path=require(_0xa372('0x6'));var rimraf=require(_0xa372('0x7'));var config=require('../../config/environment');var attributes=require(_0xa372('0x8'));module[_0xa372('0x9')]=function(_0x9ef5a4,_0x4c4b1b){return _0x9ef5a4[_0xa372('0xa')]('SugarcrmField',attributes,{'tableName':_0xa372('0xb'),'paranoid':![],'indexes':[{'name':_0xa372('0xc'),'fields':['idField',_0xa372('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd652=['sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0xd652,0x152));var _0x2d65=function(_0x28e372,_0x33ebb5){_0x28e372=_0x28e372-0x0;var _0x1d8a88=_0xd652[_0x28e372];return _0x1d8a88;};'use strict';var _=require(_0x2d65('0x0'));var util=require(_0x2d65('0x1'));var logger=require(_0x2d65('0x2'))(_0x2d65('0x3'));var moment=require(_0x2d65('0x4'));var BPromise=require(_0x2d65('0x5'));var rp=require(_0x2d65('0x6'));var fs=require('fs');var path=require(_0x2d65('0x7'));var rimraf=require(_0x2d65('0x8'));var config=require(_0x2d65('0x9'));var attributes=require('./intSugarcrmField.attributes');module[_0x2d65('0xa')]=function(_0x3d1353,_0x4cd887){return _0x3d1353[_0x2d65('0xb')](_0x2d65('0xc'),attributes,{'tableName':_0x2d65('0xd'),'paranoid':![],'indexes':[{'name':_0x2d65('0xe'),'fields':['idField',_0x2d65('0xf')],'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 1783bc8..bfe887a 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 _0x614d=['client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise'];(function(_0x14bec8,_0x73c0ef){var _0x84d31e=function(_0x3b2a2d){while(--_0x3b2a2d){_0x14bec8['push'](_0x14bec8['shift']());}};_0x84d31e(++_0x73c0ef);}(_0x614d,0x1b2));var _0xd614=function(_0x804691,_0x4aa339){_0x804691=_0x804691-0x0;var _0x5e9d60=_0x614d[_0x804691];return _0x5e9d60;};'use strict';var _=require('lodash');var util=require(_0xd614('0x0'));var moment=require(_0xd614('0x1'));var BPromise=require(_0xd614('0x2'));var rs=require(_0xd614('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd614('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xd614('0x5'));var jayson=require(_0xd614('0x6'));var client=jayson[_0xd614('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38edbf,_0x4886f2,_0x36ff36){return new BPromise(function(_0x5c7719,_0x3e0e36){return client[_0xd614('0x8')](_0x38edbf,_0x36ff36)[_0xd614('0x9')](function(_0x17e05a){logger[_0xd614('0xa')](_0xd614('0xb'),_0x4886f2,_0xd614('0xc'));logger[_0xd614('0xd')](_0xd614('0xe'),_0x4886f2,'request\x20sent',JSON[_0xd614('0xf')](_0x17e05a));if(_0x17e05a[_0xd614('0x10')]){if(_0x17e05a[_0xd614('0x10')][_0xd614('0x11')]===0x1f4){logger['error'](_0xd614('0xb'),_0x4886f2,_0x17e05a[_0xd614('0x10')][_0xd614('0x12')]);return _0x3e0e36(_0x17e05a[_0xd614('0x10')][_0xd614('0x12')]);}logger[_0xd614('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x4886f2,_0x17e05a[_0xd614('0x10')]['message']);return _0x5c7719(_0x17e05a[_0xd614('0x10')][_0xd614('0x12')]);}else{logger[_0xd614('0xa')](_0xd614('0xb'),_0x4886f2,_0xd614('0xc'));_0x5c7719(_0x17e05a[_0xd614('0x13')][_0xd614('0x12')]);}})[_0xd614('0x14')](function(_0xec54e9){logger['error'](_0xd614('0xb'),_0x4886f2,_0xec54e9);_0x3e0e36(_0xec54e9);});});} \ No newline at end of file +var _0x9acd=['debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9acd,0x10f));var _0xd9ac=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9acd[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd9ac('0x0'));var BPromise=require(_0xd9ac('0x1'));var rs=require(_0xd9ac('0x2'));var fs=require('fs');var Redis=require(_0xd9ac('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd9ac('0x4'));var logger=require(_0xd9ac('0x5'))(_0xd9ac('0x6'));var config=require('../../config/environment');var jayson=require(_0xd9ac('0x7'));var client=jayson[_0xd9ac('0x8')][_0xd9ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bc5b8,_0x1c6048,_0x17a5c5){return new BPromise(function(_0x1d973a,_0x29946e){return client[_0xd9ac('0xa')](_0x5bc5b8,_0x17a5c5)[_0xd9ac('0xb')](function(_0x3081e1){logger[_0xd9ac('0xc')](_0xd9ac('0xd'),_0x1c6048,_0xd9ac('0xe'));logger[_0xd9ac('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x1c6048,_0xd9ac('0xe'),JSON[_0xd9ac('0x10')](_0x3081e1));if(_0x3081e1[_0xd9ac('0x11')]){if(_0x3081e1[_0xd9ac('0x11')][_0xd9ac('0x12')]===0x1f4){logger[_0xd9ac('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x1c6048,_0x3081e1[_0xd9ac('0x11')][_0xd9ac('0x13')]);return _0x29946e(_0x3081e1[_0xd9ac('0x11')][_0xd9ac('0x13')]);}logger[_0xd9ac('0x11')](_0xd9ac('0xd'),_0x1c6048,_0x3081e1[_0xd9ac('0x11')][_0xd9ac('0x13')]);return _0x1d973a(_0x3081e1[_0xd9ac('0x11')]['message']);}else{logger[_0xd9ac('0xc')](_0xd9ac('0xd'),_0x1c6048,_0xd9ac('0xe'));_0x1d973a(_0x3081e1[_0xd9ac('0x14')][_0xd9ac('0x13')]);}})[_0xd9ac('0x15')](function(_0x573e19){logger[_0xd9ac('0x11')](_0xd9ac('0xd'),_0x1c6048,_0x573e19);_0x29946e(_0x573e19);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index b031a9e..f60606a 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 _0x0a25=['/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x1f84e0,_0x5a3f85){var _0x18c5b6=function(_0x138807){while(--_0x138807){_0x1f84e0['push'](_0x1f84e0['shift']());}};_0x18c5b6(++_0x5a3f85);}(_0x0a25,0x68));var _0x50a2=function(_0x27c28c,_0x49ba23){_0x27c28c=_0x27c28c-0x0;var _0x1f5669=_0x0a25[_0x27c28c];return _0x1f5669;};'use strict';var multer=require(_0x50a2('0x0'));var util=require(_0x50a2('0x1'));var path=require('path');var timeout=require(_0x50a2('0x2'));var express=require(_0x50a2('0x3'));var router=express['Router']();var fs_extra=require(_0x50a2('0x4'));var auth=require(_0x50a2('0x5'));var interaction=require(_0x50a2('0x6'));var config=require(_0x50a2('0x7'));var controller=require(_0x50a2('0x8'));router[_0x50a2('0x9')]('/',auth[_0x50a2('0xa')](),controller[_0x50a2('0xb')]);router[_0x50a2('0x9')](_0x50a2('0xc'),auth[_0x50a2('0xa')](),controller[_0x50a2('0xd')]);router[_0x50a2('0x9')](_0x50a2('0xe'),auth[_0x50a2('0xa')](),controller[_0x50a2('0xf')]);router[_0x50a2('0x9')](_0x50a2('0x10'),auth['isAuthenticated'](),controller[_0x50a2('0x11')]);router[_0x50a2('0x12')]('/',auth[_0x50a2('0xa')](),controller[_0x50a2('0x13')]);router[_0x50a2('0x12')](_0x50a2('0xe'),auth['isAuthenticated'](),controller[_0x50a2('0x14')]);router[_0x50a2('0x15')](_0x50a2('0xc'),auth[_0x50a2('0xa')](),controller[_0x50a2('0x16')]);router[_0x50a2('0x17')](_0x50a2('0xc'),auth[_0x50a2('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x192f=['update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put'];(function(_0x41deb8,_0x458105){var _0x1e2084=function(_0x550d48){while(--_0x550d48){_0x41deb8['push'](_0x41deb8['shift']());}};_0x1e2084(++_0x458105);}(_0x192f,0xd6));var _0xf192=function(_0x467d28,_0x5b6cbe){_0x467d28=_0x467d28-0x0;var _0x15ea7f=_0x192f[_0x467d28];return _0x15ea7f;};'use strict';var multer=require(_0xf192('0x0'));var util=require('util');var path=require(_0xf192('0x1'));var timeout=require('connect-timeout');var express=require(_0xf192('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf192('0x3'));var interaction=require(_0xf192('0x4'));var config=require(_0xf192('0x5'));var controller=require(_0xf192('0x6'));router[_0xf192('0x7')]('/',auth[_0xf192('0x8')](),controller['index']);router[_0xf192('0x7')](_0xf192('0x9'),auth['isAuthenticated'](),controller[_0xf192('0xa')]);router[_0xf192('0x7')](_0xf192('0xb'),auth[_0xf192('0x8')](),controller[_0xf192('0xc')]);router['get']('/:id/fields',auth[_0xf192('0x8')](),controller[_0xf192('0xd')]);router[_0xf192('0xe')]('/',auth[_0xf192('0x8')](),controller[_0xf192('0xf')]);router[_0xf192('0xe')](_0xf192('0xb'),auth[_0xf192('0x8')](),controller['addConfiguration']);router[_0xf192('0x10')](_0xf192('0x9'),auth[_0xf192('0x8')](),controller[_0xf192('0x11')]);router[_0xf192('0x12')](_0xf192('0x9'),auth[_0xf192('0x8')](),controller[_0xf192('0x13')]);module[_0xf192('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index cc930ac..ea5a3d8 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 _0xb0d8=['sequelize','exports','STRING','HelpDesk'];(function(_0x5bdd45,_0x174a62){var _0x387fb5=function(_0x20736d){while(--_0x20736d){_0x5bdd45['push'](_0x5bdd45['shift']());}};_0x387fb5(++_0x174a62);}(_0xb0d8,0x198));var _0x8b0d=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0xb0d8[_0x20845e];return _0x28cf2b;};'use strict';var Sequelize=require(_0x8b0d('0x0'));module[_0x8b0d('0x1')]={'name':{'type':Sequelize[_0x8b0d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b0d('0x2')]},'username':{'type':Sequelize[_0x8b0d('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8b0d('0x3')},'remoteUri':{'type':Sequelize[_0x8b0d('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8b0d('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8b0d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7f91=['sequelize','exports','STRING'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x7f91,0x6c));var _0x17f9=function(_0x34d635,_0x2784fc){_0x34d635=_0x34d635-0x0;var _0x3ab288=_0x7f91[_0x34d635];return _0x3ab288;};'use strict';var Sequelize=require(_0x17f9('0x0'));module[_0x17f9('0x1')]={'name':{'type':Sequelize[_0x17f9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x17f9('0x2')]},'username':{'type':Sequelize[_0x17f9('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x17f9('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x17f9('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 b45d24a..3a97c6b 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 _0xa58b=['findAll','catch','show','params','includeAll','include','find','create','body','getConfigurations','findOne','VtigerConfiguration','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','describe','sessionName','reference','owner','remove','includes','false','label','cf_','picklist','picklistValues','test','statusCode','stringify','rimraf','zip-dir','request-promise','bluebird','mustache','util','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','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options'];(function(_0x1a09f3,_0x55835f){var _0x4bf28c=function(_0x543041){while(--_0x543041){_0x1a09f3['push'](_0x1a09f3['shift']());}};_0x4bf28c(++_0x55835f);}(_0xa58b,0xb0));var _0xba58=function(_0x5bd1a9,_0xa3be77){_0x5bd1a9=_0x5bd1a9-0x0;var _0x4da981=_0xa58b[_0x5bd1a9];return _0x4da981;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba58('0x0'));var zipdir=require(_0xba58('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba58('0x2'));var moment=require('moment');var BPromise=require(_0xba58('0x3'));var Mustache=require(_0xba58('0x4'));var util=require(_0xba58('0x5'));var path=require('path');var sox=require(_0xba58('0x6'));var csv=require(_0xba58('0x7'));var ejs=require(_0xba58('0x8'));var fs=require('fs');var fs_extra=require(_0xba58('0x9'));var _=require(_0xba58('0xa'));var squel=require(_0xba58('0xb'));var crypto=require(_0xba58('0xc'));var jsforce=require(_0xba58('0xd'));var deskjs=require(_0xba58('0xe'));var toCsv=require(_0xba58('0x7'));var querystring=require(_0xba58('0xf'));var Papa=require(_0xba58('0x10'));var Redis=require(_0xba58('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xba58('0x12'));var as=require(_0xba58('0x13'));var hardwareService=require(_0xba58('0x14'));var logger=require(_0xba58('0x15'))(_0xba58('0x16'));var utils=require(_0xba58('0x17'));var config=require(_0xba58('0x18'));var licenseUtil=require(_0xba58('0x19'));var db=require(_0xba58('0x1a'))['db'];var integrations=require(_0xba58('0x1b'));function respondWithStatusCode(_0x28d443,_0x4581d1){_0x4581d1=_0x4581d1||0xcc;return function(_0x2c927b){if(_0x2c927b){return _0x28d443[_0xba58('0x1c')](_0x4581d1);}return _0x28d443[_0xba58('0x1d')](_0x4581d1)[_0xba58('0x1e')]();};}function respondWithResult(_0x27f3ab,_0x4c4d12){_0x4c4d12=_0x4c4d12||0xc8;return function(_0x1a28a4){if(_0x1a28a4){return _0x27f3ab['status'](_0x4c4d12)[_0xba58('0x1f')](_0x1a28a4);}};}function respondWithFilteredResult(_0x1e139f,_0x186ac3){return function(_0x44bfbc){if(_0x44bfbc){var _0x2bc6a4=typeof _0x186ac3['offset']===_0xba58('0x20')&&typeof _0x186ac3[_0xba58('0x21')]===_0xba58('0x20');var _0x532428=_0x44bfbc[_0xba58('0x22')];var _0x3799e3=_0x2bc6a4?0x0:_0x186ac3[_0xba58('0x23')];var _0x2fcdb9=_0x2bc6a4?_0x44bfbc['count']:_0x186ac3[_0xba58('0x23')]+_0x186ac3[_0xba58('0x21')];var _0x33c64e;if(_0x2fcdb9>=_0x532428){_0x2fcdb9=_0x532428;_0x33c64e=0xc8;}else{_0x33c64e=0xce;}_0x1e139f[_0xba58('0x1d')](_0x33c64e);return _0x1e139f[_0xba58('0x24')](_0xba58('0x25'),_0x3799e3+'-'+_0x2fcdb9+'/'+_0x532428)[_0xba58('0x1f')](_0x44bfbc);}return null;};}function patchUpdates(_0x25030d){return function(_0x1d37b4){try{jsonpatch[_0xba58('0x26')](_0x1d37b4,_0x25030d,!![]);}catch(_0xaa30e){return BPromise[_0xba58('0x27')](_0xaa30e);}return _0x1d37b4[_0xba58('0x28')]();};}function saveUpdates(_0x141052,_0x57d30b){return function(_0x2a96de){if(_0x2a96de){return _0x2a96de[_0xba58('0x29')](_0x141052)['then'](function(_0x3e2524){return _0x3e2524;});}return null;};}function removeEntity(_0x4912f2,_0x17cb92){return function(_0x38a576){if(_0x38a576){return _0x38a576[_0xba58('0x2a')]()[_0xba58('0x2b')](function(){_0x4912f2[_0xba58('0x1d')](0xcc)[_0xba58('0x1e')]();});}};}function handleEntityNotFound(_0x81c123,_0x33dff8){return function(_0x236d27){if(!_0x236d27){_0x81c123[_0xba58('0x1c')](0x194);}return _0x236d27;};}function handleError(_0x2544a4,_0xc70d29){_0xc70d29=_0xc70d29||0x1f4;return function(_0x1567a6){logger[_0xba58('0x2c')](_0x1567a6[_0xba58('0x2d')]);if(_0x1567a6['name']){delete _0x1567a6[_0xba58('0x2e')];}_0x2544a4[_0xba58('0x1d')](_0xc70d29)[_0xba58('0x2f')](_0x1567a6);};}exports[_0xba58('0x30')]=function(_0x19597a,_0x441491){var _0xd68c4a={},_0x1db632={},_0x288716={'count':0x0,'rows':[]};var _0xa2e058=_[_0xba58('0x31')](db[_0xba58('0x32')][_0xba58('0x33')],function(_0x159fe2){return{'name':_0x159fe2[_0xba58('0x34')],'type':_0x159fe2[_0xba58('0x35')]['key']};});_0x1db632['model']=_[_0xba58('0x31')](_0xa2e058,_0xba58('0x2e'));_0x1db632[_0xba58('0x36')]=_[_0xba58('0x37')](_0x19597a[_0xba58('0x36')]);_0x1db632[_0xba58('0x38')]=_[_0xba58('0x39')](_0x1db632['model'],_0x1db632['query']);_0xd68c4a[_0xba58('0x3a')]=_['intersection'](_0x1db632[_0xba58('0x3b')],qs[_0xba58('0x3c')](_0x19597a[_0xba58('0x36')][_0xba58('0x3c')]));_0xd68c4a[_0xba58('0x3a')]=_0xd68c4a[_0xba58('0x3a')][_0xba58('0x3d')]?_0xd68c4a[_0xba58('0x3a')]:_0x1db632[_0xba58('0x3b')];if(!_0x19597a['query'][_0xba58('0x3e')](_0xba58('0x3f'))){_0xd68c4a[_0xba58('0x21')]=qs[_0xba58('0x21')](_0x19597a[_0xba58('0x36')][_0xba58('0x21')]);_0xd68c4a[_0xba58('0x23')]=qs[_0xba58('0x23')](_0x19597a[_0xba58('0x36')][_0xba58('0x23')]);}_0xd68c4a[_0xba58('0x40')]=qs[_0xba58('0x41')](_0x19597a[_0xba58('0x36')]['sort']);_0xd68c4a[_0xba58('0x42')]=qs[_0xba58('0x38')](_['pick'](_0x19597a[_0xba58('0x36')],_0x1db632['filters']),_0xa2e058);if(_0x19597a[_0xba58('0x36')][_0xba58('0x43')]){_0xd68c4a['where']=_[_0xba58('0x44')](_0xd68c4a['where'],{'$or':_[_0xba58('0x31')](_0xa2e058,function(_0x584476){if(_0x584476['type']!=='VIRTUAL'){var _0x82ea1c={};_0x82ea1c[_0x584476['name']]={'$like':'%'+_0x19597a['query'][_0xba58('0x43')]+'%'};return _0x82ea1c;}})});}_0xd68c4a=_[_0xba58('0x44')]({},_0xd68c4a,_0x19597a[_0xba58('0x45')]);var _0x43ff4e={'where':_0xd68c4a[_0xba58('0x42')]};return db[_0xba58('0x32')]['count'](_0x43ff4e)['then'](function(_0x216d01){_0x288716[_0xba58('0x22')]=_0x216d01;if(_0x19597a[_0xba58('0x36')]['includeAll']){_0xd68c4a['include']=[{'all':!![]}];}return db[_0xba58('0x32')][_0xba58('0x46')](_0xd68c4a);})[_0xba58('0x2b')](function(_0x2abb34){_0x288716['rows']=_0x2abb34;return _0x288716;})[_0xba58('0x2b')](respondWithFilteredResult(_0x441491,_0xd68c4a))[_0xba58('0x47')](handleError(_0x441491,null));};exports[_0xba58('0x48')]=function(_0xeb84ce,_0x31c938){var _0x46801a={'raw':![],'where':{'id':_0xeb84ce[_0xba58('0x49')]['id']}},_0x1b400d={};_0x1b400d[_0xba58('0x3b')]=_[_0xba58('0x37')](db['VtigerAccount'][_0xba58('0x33')]);_0x1b400d[_0xba58('0x36')]=_[_0xba58('0x37')](_0xeb84ce[_0xba58('0x36')]);_0x1b400d['filters']=_[_0xba58('0x39')](_0x1b400d[_0xba58('0x3b')],_0x1b400d[_0xba58('0x36')]);_0x46801a[_0xba58('0x3a')]=_[_0xba58('0x39')](_0x1b400d[_0xba58('0x3b')],qs[_0xba58('0x3c')](_0xeb84ce[_0xba58('0x36')][_0xba58('0x3c')]));_0x46801a[_0xba58('0x3a')]=_0x46801a['attributes'][_0xba58('0x3d')]?_0x46801a[_0xba58('0x3a')]:_0x1b400d[_0xba58('0x3b')];if(_0xeb84ce['query'][_0xba58('0x4a')]){_0x46801a[_0xba58('0x4b')]=[{'all':!![]}];}_0x46801a=_['merge']({},_0x46801a,_0xeb84ce[_0xba58('0x45')]);return db[_0xba58('0x32')][_0xba58('0x4c')](_0x46801a)['then'](handleEntityNotFound(_0x31c938,null))[_0xba58('0x2b')](respondWithResult(_0x31c938,null))['catch'](handleError(_0x31c938,null));};exports[_0xba58('0x4d')]=function(_0x4292c6,_0x483120){return db[_0xba58('0x32')]['create'](_0x4292c6[_0xba58('0x4e')],{})[_0xba58('0x2b')](respondWithResult(_0x483120,0xc9))[_0xba58('0x47')](handleError(_0x483120,null));};exports['update']=function(_0x578266,_0x5be772){if(_0x578266[_0xba58('0x4e')]['id']){delete _0x578266[_0xba58('0x4e')]['id'];}return db[_0xba58('0x32')]['find']({'where':{'id':_0x578266[_0xba58('0x49')]['id']}})['then'](handleEntityNotFound(_0x5be772,null))[_0xba58('0x2b')](saveUpdates(_0x578266[_0xba58('0x4e')],null))['then'](respondWithResult(_0x5be772,null))[_0xba58('0x47')](handleError(_0x5be772,null));};exports['destroy']=function(_0x163842,_0x5b281e){return db['VtigerAccount'][_0xba58('0x4c')]({'where':{'id':_0x163842[_0xba58('0x49')]['id']}})[_0xba58('0x2b')](handleEntityNotFound(_0x5b281e,null))[_0xba58('0x2b')](removeEntity(_0x5b281e,null))[_0xba58('0x47')](handleError(_0x5b281e,null));};exports[_0xba58('0x4f')]=function(_0x22eb8b,_0x44eb90,_0x5937c0){var _0x116510={};var _0x2f759c={};var _0xbfc846;var _0x1c88f8;return db['VtigerAccount'][_0xba58('0x50')]({'where':{'id':_0x22eb8b[_0xba58('0x49')]['id']}})[_0xba58('0x2b')](handleEntityNotFound(_0x44eb90,null))['then'](function(_0x479f7b){if(_0x479f7b){_0xbfc846=_0x479f7b;_0x2f759c[_0xba58('0x3b')]=_[_0xba58('0x37')](db[_0xba58('0x51')][_0xba58('0x33')]);_0x2f759c[_0xba58('0x36')]=_[_0xba58('0x37')](_0x22eb8b['query']);_0x2f759c['filters']=_['intersection'](_0x2f759c[_0xba58('0x3b')],_0x2f759c['query']);_0x116510[_0xba58('0x3a')]=_[_0xba58('0x39')](_0x2f759c[_0xba58('0x3b')],qs[_0xba58('0x3c')](_0x22eb8b['query'][_0xba58('0x3c')]));_0x116510[_0xba58('0x3a')]=_0x116510[_0xba58('0x3a')][_0xba58('0x3d')]?_0x116510[_0xba58('0x3a')]:_0x2f759c[_0xba58('0x3b')];_0x116510['order']=qs[_0xba58('0x41')](_0x22eb8b['query'][_0xba58('0x41')]);_0x116510[_0xba58('0x42')]=qs[_0xba58('0x38')](_[_0xba58('0x52')](_0x22eb8b['query'],_0x2f759c['filters']));if(_0x22eb8b[_0xba58('0x36')][_0xba58('0x43')]){_0x116510['where']=_['merge'](_0x116510[_0xba58('0x42')],{'$or':_['map'](_0x116510[_0xba58('0x3a')],function(_0x27165d){var _0x4b5143={};_0x4b5143[_0x27165d]={'$like':'%'+_0x22eb8b['query']['filter']+'%'};return _0x4b5143;})});}_0x116510=_[_0xba58('0x44')]({},_0x116510,_0x22eb8b[_0xba58('0x45')]);return _0xbfc846[_0xba58('0x4f')](_0x116510);}})['then'](function(_0x5ef717){if(_0x5ef717){_0x1c88f8=_0x5ef717['length'];if(!_0x22eb8b[_0xba58('0x36')][_0xba58('0x3e')]('nolimit')){_0x116510[_0xba58('0x21')]=qs[_0xba58('0x21')](_0x22eb8b['query']['limit']);_0x116510['offset']=qs[_0xba58('0x23')](_0x22eb8b[_0xba58('0x36')]['offset']);}return _0xbfc846['getConfigurations'](_0x116510);}})[_0xba58('0x2b')](function(_0x5ea8bd){if(_0x5ea8bd){return _0x5ea8bd?{'count':_0x1c88f8,'rows':_0x5ea8bd}:null;}})[_0xba58('0x2b')](respondWithResult(_0x44eb90,null))[_0xba58('0x47')](handleError(_0x44eb90,null));};exports['addConfiguration']=function(_0x42628a,_0x4d8c4c,_0x26cd44){if(_0x42628a['body']['id']){delete _0x42628a['body']['id'];}return db[_0xba58('0x32')][_0xba58('0x50')]({'where':{'id':_0x42628a[_0xba58('0x49')]['id']}})[_0xba58('0x2b')](handleEntityNotFound(_0x4d8c4c,null))[_0xba58('0x2b')](function(_0x24f83b){if(_0x24f83b){_0x42628a[_0xba58('0x4e')][_0xba58('0x53')]=_0x24f83b['id'];_0x42628a['body'][_0xba58('0x54')]=integrations[_0xba58('0x55')](_0x42628a[_0xba58('0x4e')][_0xba58('0x56')],_0x42628a['body'][_0xba58('0x35')]);_0x42628a['body'][_0xba58('0x57')]=integrations[_0xba58('0x58')](_0x42628a['body'][_0xba58('0x56')],_0x42628a[_0xba58('0x4e')][_0xba58('0x35')]);return db[_0xba58('0x51')][_0xba58('0x4d')](_0x42628a[_0xba58('0x4e')],{'include':[{'model':db[_0xba58('0x59')],'as':_0xba58('0x54')},{'model':db[_0xba58('0x59')],'as':_0xba58('0x57')}]});}return null;})[_0xba58('0x2b')](respondWithResult(_0x4d8c4c,null))['catch'](handleError(_0x4d8c4c,null));};var md5=require(_0xba58('0x5a'));exports[_0xba58('0x5b')]=function(_0x1e1a4b,_0x2bcc7f,_0x15cba9){var _0x5a5d8b=null;var _0x281a2e=null;var _0x463f6c=null;var _0x3f8dd3=null;var _0x57c25c='';return db['VtigerAccount'][_0xba58('0x50')]({'where':{'id':_0x1e1a4b[_0xba58('0x49')]['id']},'attributes':['id',_0xba58('0x2e'),_0xba58('0x5c'),_0xba58('0x5d'),_0xba58('0x5e'),_0xba58('0x5f'),_0xba58('0x60'),'accessKey']})['then'](handleEntityNotFound(_0x2bcc7f,null))['then'](function(_0x43150c){if(_0x43150c){_0x5a5d8b=_0x43150c[_0xba58('0x5c')];_0x281a2e=_0x43150c[_0xba58('0x61')];_0x463f6c=_0x43150c[_0xba58('0x5e')];_0x57c25c=_0x43150c[_0xba58('0x5f')];var _0x13a593=_0x57c25c['slice'](-0x1);if(_0x13a593==='/'){_0x57c25c=_0x57c25c[_0xba58('0x62')](0x0,_0x57c25c[_0xba58('0x63')](_0x13a593));}_0x3f8dd3=util[_0xba58('0x64')](_0xba58('0x65'),_0x57c25c);var _0x15220e={'method':_0xba58('0x66'),'uri':_0x3f8dd3,'qs':{'operation':_0xba58('0x67'),'username':_0x43150c[_0xba58('0x5c')]},'json':!![]};return rp(_0x15220e);}})[_0xba58('0x2b')](function(_0x19aacc){if(_0x19aacc['success']){var _0x5dccb7={'method':_0xba58('0x68'),'uri':_0x3f8dd3,'form':{'operation':_0xba58('0x69'),'username':_0x5a5d8b,'accessKey':md5(_0x19aacc[_0xba58('0x6a')][_0xba58('0x6b')]+_0x281a2e)},'json':!![]};return rp(_0x5dccb7);}})[_0xba58('0x2b')](function(_0x4bc1e9){if(_0x4bc1e9[_0xba58('0x6c')]){var _0x4d14c0={'method':_0xba58('0x66'),'uri':_0x3f8dd3,'qs':{'operation':_0xba58('0x6d'),'username':_0x5a5d8b,'sessionName':_0x4bc1e9[_0xba58('0x6a')][_0xba58('0x6e')],'elementType':_0x463f6c},'json':!![]};return rp(_0x4d14c0);}})['then'](function(_0x6c987b){if(_0x6c987b[_0xba58('0x6c')]){var _0x1ff33e=['autogenerated',_0xba58('0x6f'),_0xba58('0x70')];_[_0xba58('0x71')](_0x6c987b[_0xba58('0x6a')][_0xba58('0x3c')],function(_0x4ff5a9){return _0x1ff33e[_0xba58('0x72')](_0x4ff5a9[_0xba58('0x35')][_0xba58('0x2e')]);});_[_0xba58('0x71')](_0x6c987b[_0xba58('0x6a')][_0xba58('0x3c')],function(_0x465a5d){return _0x465a5d['editable']===_0xba58('0x73');});return{'count':_0x6c987b[_0xba58('0x6a')][_0xba58('0x3c')][_0xba58('0x3d')],'rows':_[_0xba58('0x31')](_0x6c987b['result'][_0xba58('0x3c')],function(_0x755ef0){return{'id':_0x755ef0[_0xba58('0x2e')],'name':_0x755ef0[_0xba58('0x74')],'custom':_['startsWith'](_0x755ef0['name'],_0xba58('0x75'))?!![]:![],'options':_0x755ef0['type']['name']===_0xba58('0x76')&&_0x755ef0[_0xba58('0x35')][_0xba58('0x77')]['length']>0x0?_['map'](_0x755ef0['type'][_0xba58('0x77')],function(_0x547b72){return{'name':_0x547b72[_0xba58('0x74')],'value':_0x547b72['value']};}):[]};})};}})[_0xba58('0x2b')](respondWithResult(_0x2bcc7f,null))[_0xba58('0x47')](function(_0xa0b456){console['log']('vTiger\x20error:\x20'+_0xa0b456);var _0x1fab9b=_0x1e1a4b[_0xba58('0x36')][_0xba58('0x78')]?0x1f4:_0xa0b456[_0xba58('0x79')]||0x1f4;logger[_0xba58('0x2c')]('getFields,\x20%s,\x20%s,\x20%s',_0xba58('0x5b'),_0x1fab9b,JSON[_0xba58('0x7a')](_0xa0b456));delete _0xa0b456[_0xba58('0x2e')];if(_0x1fab9b===0x191){_0x1fab9b=0x190;}_0x2bcc7f[_0xba58('0x1d')](_0x1fab9b)[_0xba58('0x2f')](_0x1e1a4b[_0xba58('0x36')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xa0b456[_0xba58('0x79')]}:_0xa0b456);});}; \ No newline at end of file +var _0x2998=['merge','type','VIRTUAL','options','includeAll','include','VtigerAccount','findAll','rows','show','params','keys','catch','create','body','find','getConfigurations','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','VtigerField','md5','getFields','findOne','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','login','result','token','success','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x540fca,_0x54263f){var _0x15e0cc=function(_0x4ab3b5){while(--_0x4ab3b5){_0x540fca['push'](_0x540fca['shift']());}};_0x15e0cc(++_0x54263f);}(_0x2998,0xbe));var _0x8299=function(_0x361737,_0x18ad5d){_0x361737=_0x361737-0x0;var _0x53c17c=_0x2998[_0x361737];return _0x53c17c;};'use strict';var emlformat=require(_0x8299('0x0'));var rimraf=require(_0x8299('0x1'));var zipdir=require(_0x8299('0x2'));var jsonpatch=require(_0x8299('0x3'));var rp=require('request-promise');var moment=require(_0x8299('0x4'));var BPromise=require(_0x8299('0x5'));var Mustache=require(_0x8299('0x6'));var util=require(_0x8299('0x7'));var path=require(_0x8299('0x8'));var sox=require(_0x8299('0x9'));var csv=require(_0x8299('0xa'));var ejs=require(_0x8299('0xb'));var fs=require('fs');var fs_extra=require(_0x8299('0xc'));var _=require('lodash');var squel=require(_0x8299('0xd'));var crypto=require(_0x8299('0xe'));var jsforce=require(_0x8299('0xf'));var deskjs=require(_0x8299('0x10'));var toCsv=require(_0x8299('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8299('0x11'));var authService=require(_0x8299('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8299('0x13'));var logger=require(_0x8299('0x14'))(_0x8299('0x15'));var utils=require(_0x8299('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8299('0x17'));var db=require(_0x8299('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5a8550,_0x5cc00e){_0x5cc00e=_0x5cc00e||0xcc;return function(_0x3fe4c3){if(_0x3fe4c3){return _0x5a8550[_0x8299('0x19')](_0x5cc00e);}return _0x5a8550[_0x8299('0x1a')](_0x5cc00e)[_0x8299('0x1b')]();};}function respondWithResult(_0xa8d2ff,_0x5b1b8c){_0x5b1b8c=_0x5b1b8c||0xc8;return function(_0x81b3c3){if(_0x81b3c3){return _0xa8d2ff[_0x8299('0x1a')](_0x5b1b8c)['json'](_0x81b3c3);}};}function respondWithFilteredResult(_0x203bd8,_0x33a5cd){return function(_0x3c4d38){if(_0x3c4d38){var _0x3051f3=typeof _0x33a5cd[_0x8299('0x1c')]===_0x8299('0x1d')&&typeof _0x33a5cd[_0x8299('0x1e')]===_0x8299('0x1d');var _0x30866d=_0x3c4d38[_0x8299('0x1f')];var _0x4ca191=_0x3051f3?0x0:_0x33a5cd[_0x8299('0x1c')];var _0x4554a3=_0x3051f3?_0x3c4d38['count']:_0x33a5cd[_0x8299('0x1c')]+_0x33a5cd[_0x8299('0x1e')];var _0x310171;if(_0x4554a3>=_0x30866d){_0x4554a3=_0x30866d;_0x310171=0xc8;}else{_0x310171=0xce;}_0x203bd8[_0x8299('0x1a')](_0x310171);return _0x203bd8[_0x8299('0x20')]('Content-Range',_0x4ca191+'-'+_0x4554a3+'/'+_0x30866d)[_0x8299('0x21')](_0x3c4d38);}return null;};}function patchUpdates(_0x2abc79){return function(_0x2dae43){try{jsonpatch[_0x8299('0x22')](_0x2dae43,_0x2abc79,!![]);}catch(_0x3c590e){return BPromise[_0x8299('0x23')](_0x3c590e);}return _0x2dae43[_0x8299('0x24')]();};}function saveUpdates(_0x2a31bd,_0x2daf3a){return function(_0x2218f6){if(_0x2218f6){return _0x2218f6[_0x8299('0x25')](_0x2a31bd)[_0x8299('0x26')](function(_0x11b60d){return _0x11b60d;});}return null;};}function removeEntity(_0x52a024,_0x1781b2){return function(_0x134527){if(_0x134527){return _0x134527[_0x8299('0x27')]()['then'](function(){_0x52a024[_0x8299('0x1a')](0xcc)[_0x8299('0x1b')]();});}};}function handleEntityNotFound(_0x3cde8f,_0x315da1){return function(_0x134038){if(!_0x134038){_0x3cde8f['sendStatus'](0x194);}return _0x134038;};}function handleError(_0x2002d8,_0x29b1df){_0x29b1df=_0x29b1df||0x1f4;return function(_0x44f8d0){logger['error'](_0x44f8d0[_0x8299('0x28')]);if(_0x44f8d0['name']){delete _0x44f8d0[_0x8299('0x29')];}_0x2002d8[_0x8299('0x1a')](_0x29b1df)[_0x8299('0x2a')](_0x44f8d0);};}exports[_0x8299('0x2b')]=function(_0x2735dd,_0x5a9269){var _0x236fc3={},_0xfe8390={},_0x487c8e={'count':0x0,'rows':[]};var _0xa4cbc9=_[_0x8299('0x2c')](db['VtigerAccount'][_0x8299('0x2d')],function(_0x503670){return{'name':_0x503670[_0x8299('0x2e')],'type':_0x503670['type'][_0x8299('0x2f')]};});_0xfe8390[_0x8299('0x30')]=_['map'](_0xa4cbc9,_0x8299('0x29'));_0xfe8390[_0x8299('0x31')]=_['keys'](_0x2735dd[_0x8299('0x31')]);_0xfe8390[_0x8299('0x32')]=_[_0x8299('0x33')](_0xfe8390[_0x8299('0x30')],_0xfe8390['query']);_0x236fc3[_0x8299('0x34')]=_[_0x8299('0x33')](_0xfe8390[_0x8299('0x30')],qs[_0x8299('0x35')](_0x2735dd[_0x8299('0x31')]['fields']));_0x236fc3[_0x8299('0x34')]=_0x236fc3[_0x8299('0x34')][_0x8299('0x36')]?_0x236fc3['attributes']:_0xfe8390['model'];if(!_0x2735dd[_0x8299('0x31')][_0x8299('0x37')](_0x8299('0x38'))){_0x236fc3['limit']=qs['limit'](_0x2735dd['query'][_0x8299('0x1e')]);_0x236fc3[_0x8299('0x1c')]=qs[_0x8299('0x1c')](_0x2735dd['query'][_0x8299('0x1c')]);}_0x236fc3[_0x8299('0x39')]=qs[_0x8299('0x3a')](_0x2735dd[_0x8299('0x31')][_0x8299('0x3a')]);_0x236fc3[_0x8299('0x3b')]=qs[_0x8299('0x32')](_[_0x8299('0x3c')](_0x2735dd[_0x8299('0x31')],_0xfe8390[_0x8299('0x32')]),_0xa4cbc9);if(_0x2735dd[_0x8299('0x31')][_0x8299('0x3d')]){_0x236fc3[_0x8299('0x3b')]=_[_0x8299('0x3e')](_0x236fc3[_0x8299('0x3b')],{'$or':_['map'](_0xa4cbc9,function(_0x2f0ffc){if(_0x2f0ffc[_0x8299('0x3f')]!==_0x8299('0x40')){var _0x799ade={};_0x799ade[_0x2f0ffc[_0x8299('0x29')]]={'$like':'%'+_0x2735dd[_0x8299('0x31')]['filter']+'%'};return _0x799ade;}})});}_0x236fc3=_['merge']({},_0x236fc3,_0x2735dd[_0x8299('0x41')]);var _0x37eb60={'where':_0x236fc3[_0x8299('0x3b')]};return db['VtigerAccount'][_0x8299('0x1f')](_0x37eb60)[_0x8299('0x26')](function(_0x26c248){_0x487c8e[_0x8299('0x1f')]=_0x26c248;if(_0x2735dd[_0x8299('0x31')][_0x8299('0x42')]){_0x236fc3[_0x8299('0x43')]=[{'all':!![]}];}return db[_0x8299('0x44')][_0x8299('0x45')](_0x236fc3);})['then'](function(_0xaa6044){_0x487c8e[_0x8299('0x46')]=_0xaa6044;return _0x487c8e;})[_0x8299('0x26')](respondWithFilteredResult(_0x5a9269,_0x236fc3))['catch'](handleError(_0x5a9269,null));};exports[_0x8299('0x47')]=function(_0x2a2aee,_0x45ec43){var _0x4dee3b={'raw':![],'where':{'id':_0x2a2aee[_0x8299('0x48')]['id']}},_0x5caf22={};_0x5caf22[_0x8299('0x30')]=_[_0x8299('0x49')](db[_0x8299('0x44')][_0x8299('0x2d')]);_0x5caf22['query']=_['keys'](_0x2a2aee[_0x8299('0x31')]);_0x5caf22[_0x8299('0x32')]=_[_0x8299('0x33')](_0x5caf22[_0x8299('0x30')],_0x5caf22[_0x8299('0x31')]);_0x4dee3b[_0x8299('0x34')]=_[_0x8299('0x33')](_0x5caf22[_0x8299('0x30')],qs[_0x8299('0x35')](_0x2a2aee[_0x8299('0x31')][_0x8299('0x35')]));_0x4dee3b[_0x8299('0x34')]=_0x4dee3b['attributes']['length']?_0x4dee3b[_0x8299('0x34')]:_0x5caf22['model'];if(_0x2a2aee[_0x8299('0x31')][_0x8299('0x42')]){_0x4dee3b[_0x8299('0x43')]=[{'all':!![]}];}_0x4dee3b=_[_0x8299('0x3e')]({},_0x4dee3b,_0x2a2aee['options']);return db[_0x8299('0x44')]['find'](_0x4dee3b)[_0x8299('0x26')](handleEntityNotFound(_0x45ec43,null))[_0x8299('0x26')](respondWithResult(_0x45ec43,null))[_0x8299('0x4a')](handleError(_0x45ec43,null));};exports[_0x8299('0x4b')]=function(_0x455af5,_0x594f8e){return db[_0x8299('0x44')][_0x8299('0x4b')](_0x455af5[_0x8299('0x4c')],{})[_0x8299('0x26')](respondWithResult(_0x594f8e,0xc9))['catch'](handleError(_0x594f8e,null));};exports[_0x8299('0x25')]=function(_0x1d9d10,_0x4220c3){if(_0x1d9d10['body']['id']){delete _0x1d9d10[_0x8299('0x4c')]['id'];}return db[_0x8299('0x44')]['find']({'where':{'id':_0x1d9d10['params']['id']}})['then'](handleEntityNotFound(_0x4220c3,null))[_0x8299('0x26')](saveUpdates(_0x1d9d10[_0x8299('0x4c')],null))[_0x8299('0x26')](respondWithResult(_0x4220c3,null))['catch'](handleError(_0x4220c3,null));};exports[_0x8299('0x27')]=function(_0x445e67,_0x4c85ba){return db[_0x8299('0x44')][_0x8299('0x4d')]({'where':{'id':_0x445e67[_0x8299('0x48')]['id']}})[_0x8299('0x26')](handleEntityNotFound(_0x4c85ba,null))[_0x8299('0x26')](removeEntity(_0x4c85ba,null))[_0x8299('0x4a')](handleError(_0x4c85ba,null));};exports[_0x8299('0x4e')]=function(_0x3a2bdf,_0x10f46a,_0x159bc1){var _0x4b76c3={};var _0x18d025={};var _0x219c3a;var _0x18dd90;return db[_0x8299('0x44')]['findOne']({'where':{'id':_0x3a2bdf[_0x8299('0x48')]['id']}})['then'](handleEntityNotFound(_0x10f46a,null))[_0x8299('0x26')](function(_0x15e27e){if(_0x15e27e){_0x219c3a=_0x15e27e;_0x18d025[_0x8299('0x30')]=_['keys'](db[_0x8299('0x4f')][_0x8299('0x2d')]);_0x18d025[_0x8299('0x31')]=_[_0x8299('0x49')](_0x3a2bdf[_0x8299('0x31')]);_0x18d025[_0x8299('0x32')]=_['intersection'](_0x18d025[_0x8299('0x30')],_0x18d025['query']);_0x4b76c3['attributes']=_['intersection'](_0x18d025['model'],qs[_0x8299('0x35')](_0x3a2bdf[_0x8299('0x31')]['fields']));_0x4b76c3[_0x8299('0x34')]=_0x4b76c3[_0x8299('0x34')][_0x8299('0x36')]?_0x4b76c3[_0x8299('0x34')]:_0x18d025[_0x8299('0x30')];_0x4b76c3['order']=qs[_0x8299('0x3a')](_0x3a2bdf[_0x8299('0x31')][_0x8299('0x3a')]);_0x4b76c3[_0x8299('0x3b')]=qs[_0x8299('0x32')](_['pick'](_0x3a2bdf[_0x8299('0x31')],_0x18d025[_0x8299('0x32')]));if(_0x3a2bdf['query'][_0x8299('0x3d')]){_0x4b76c3[_0x8299('0x3b')]=_[_0x8299('0x3e')](_0x4b76c3['where'],{'$or':_[_0x8299('0x2c')](_0x4b76c3['attributes'],function(_0x5dd080){var _0x56d09f={};_0x56d09f[_0x5dd080]={'$like':'%'+_0x3a2bdf[_0x8299('0x31')]['filter']+'%'};return _0x56d09f;})});}_0x4b76c3=_['merge']({},_0x4b76c3,_0x3a2bdf[_0x8299('0x41')]);return _0x219c3a['getConfigurations'](_0x4b76c3);}})[_0x8299('0x26')](function(_0x2213d3){if(_0x2213d3){_0x18dd90=_0x2213d3[_0x8299('0x36')];if(!_0x3a2bdf['query'][_0x8299('0x37')](_0x8299('0x38'))){_0x4b76c3[_0x8299('0x1e')]=qs['limit'](_0x3a2bdf['query'][_0x8299('0x1e')]);_0x4b76c3[_0x8299('0x1c')]=qs['offset'](_0x3a2bdf['query'][_0x8299('0x1c')]);}return _0x219c3a[_0x8299('0x4e')](_0x4b76c3);}})[_0x8299('0x26')](function(_0x34d278){if(_0x34d278){return _0x34d278?{'count':_0x18dd90,'rows':_0x34d278}:null;}})[_0x8299('0x26')](respondWithResult(_0x10f46a,null))[_0x8299('0x4a')](handleError(_0x10f46a,null));};exports[_0x8299('0x50')]=function(_0x5e7a69,_0x25c3e5,_0x5d0456){if(_0x5e7a69[_0x8299('0x4c')]['id']){delete _0x5e7a69[_0x8299('0x4c')]['id'];}return db[_0x8299('0x44')]['findOne']({'where':{'id':_0x5e7a69[_0x8299('0x48')]['id']}})['then'](handleEntityNotFound(_0x25c3e5,null))[_0x8299('0x26')](function(_0x355b58){if(_0x355b58){_0x5e7a69[_0x8299('0x4c')][_0x8299('0x51')]=_0x355b58['id'];_0x5e7a69[_0x8299('0x4c')][_0x8299('0x52')]=integrations[_0x8299('0x53')](_0x5e7a69[_0x8299('0x4c')]['channel'],_0x5e7a69['body'][_0x8299('0x3f')]);_0x5e7a69[_0x8299('0x4c')][_0x8299('0x54')]=integrations['getDescriptions'](_0x5e7a69['body'][_0x8299('0x55')],_0x5e7a69['body'][_0x8299('0x3f')]);return db[_0x8299('0x4f')][_0x8299('0x4b')](_0x5e7a69['body'],{'include':[{'model':db[_0x8299('0x56')],'as':_0x8299('0x52')},{'model':db['VtigerField'],'as':_0x8299('0x54')}]});}return null;})[_0x8299('0x26')](respondWithResult(_0x25c3e5,null))['catch'](handleError(_0x25c3e5,null));};var md5=require(_0x8299('0x57'));exports[_0x8299('0x58')]=function(_0xb41248,_0x542b03,_0x2608cb){var _0x22b431=null;var _0x1918fa=null;var _0x12b80a=null;var _0x50a84a=null;var _0x290744='';return db[_0x8299('0x44')][_0x8299('0x59')]({'where':{'id':_0xb41248['params']['id']},'attributes':['id',_0x8299('0x29'),_0x8299('0x5a'),_0x8299('0x5b'),_0x8299('0x5c'),'remoteUri',_0x8299('0x5d'),_0x8299('0x5e')]})['then'](handleEntityNotFound(_0x542b03,null))[_0x8299('0x26')](function(_0x99ba9a){if(_0x99ba9a){_0x22b431=_0x99ba9a['username'];_0x1918fa=_0x99ba9a[_0x8299('0x5e')];_0x12b80a=_0x99ba9a[_0x8299('0x5c')];_0x290744=_0x99ba9a[_0x8299('0x5f')];var _0x5bba6a=_0x290744[_0x8299('0x60')](-0x1);if(_0x5bba6a==='/'){_0x290744=_0x290744[_0x8299('0x61')](0x0,_0x290744[_0x8299('0x62')](_0x5bba6a));}_0x50a84a=util['format'](_0x8299('0x63'),_0x290744);var _0x5206bb={'method':'GET','uri':_0x50a84a,'qs':{'operation':_0x8299('0x64'),'username':_0x99ba9a['username']},'json':!![]};return rp(_0x5206bb);}})[_0x8299('0x26')](function(_0xb5cfaa){if(_0xb5cfaa['success']){var _0x377132={'method':'POST','uri':_0x50a84a,'form':{'operation':_0x8299('0x65'),'username':_0x22b431,'accessKey':md5(_0xb5cfaa[_0x8299('0x66')][_0x8299('0x67')]+_0x1918fa)},'json':!![]};return rp(_0x377132);}})[_0x8299('0x26')](function(_0x16f1e3){if(_0x16f1e3[_0x8299('0x68')]){var _0x2bf061={'method':'GET','uri':_0x50a84a,'qs':{'operation':_0x8299('0x69'),'username':_0x22b431,'sessionName':_0x16f1e3['result'][_0x8299('0x6a')],'elementType':_0x12b80a},'json':!![]};return rp(_0x2bf061);}})[_0x8299('0x26')](function(_0xefa180){if(_0xefa180[_0x8299('0x68')]){var _0xe9c70a=[_0x8299('0x6b'),_0x8299('0x6c'),_0x8299('0x6d')];_[_0x8299('0x6e')](_0xefa180[_0x8299('0x66')]['fields'],function(_0x100c70){return _0xe9c70a[_0x8299('0x6f')](_0x100c70[_0x8299('0x3f')][_0x8299('0x29')]);});_[_0x8299('0x6e')](_0xefa180[_0x8299('0x66')]['fields'],function(_0x54f32b){return _0x54f32b[_0x8299('0x70')]==='false';});return{'count':_0xefa180[_0x8299('0x66')][_0x8299('0x35')][_0x8299('0x36')],'rows':_['map'](_0xefa180[_0x8299('0x66')][_0x8299('0x35')],function(_0x3dba41){return{'id':_0x3dba41[_0x8299('0x29')],'name':_0x3dba41[_0x8299('0x71')],'custom':_[_0x8299('0x72')](_0x3dba41['name'],_0x8299('0x73'))?!![]:![],'options':_0x3dba41[_0x8299('0x3f')][_0x8299('0x29')]===_0x8299('0x74')&&_0x3dba41[_0x8299('0x3f')][_0x8299('0x75')][_0x8299('0x36')]>0x0?_['map'](_0x3dba41['type'][_0x8299('0x75')],function(_0x5700c3){return{'name':_0x5700c3[_0x8299('0x71')],'value':_0x5700c3[_0x8299('0x76')]};}):[]};})};}})[_0x8299('0x26')](respondWithResult(_0x542b03,null))[_0x8299('0x4a')](function(_0x659352){console[_0x8299('0x77')](_0x8299('0x78')+_0x659352);var _0x6e3168=_0xb41248['query'][_0x8299('0x79')]?0x1f4:_0x659352['statusCode']||0x1f4;logger[_0x8299('0x7a')](_0x8299('0x7b'),'getFields',_0x6e3168,JSON[_0x8299('0x7c')](_0x659352));delete _0x659352[_0x8299('0x29')];if(_0x6e3168===0x191){_0x6e3168=0x190;}_0x542b03['status'](_0x6e3168)[_0x8299('0x2a')](_0xb41248['query'][_0x8299('0x79')]?{'message':_0x8299('0x7d'),'statusCode':_0x659352['statusCode']}:_0x659352);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f2b7b7c..16e565f 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 _0xea51=['../../config/logger','api','moment','request-promise','path','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xea51,0xfa));var _0x1ea5=function(_0x5af621,_0x47cfda){_0x5af621=_0x5af621-0x0;var _0x4d1c1c=_0xea51[_0x5af621];return _0x4d1c1c;};'use strict';var _=require(_0x1ea5('0x0'));var util=require(_0x1ea5('0x1'));var logger=require(_0x1ea5('0x2'))(_0x1ea5('0x3'));var moment=require(_0x1ea5('0x4'));var BPromise=require('bluebird');var rp=require(_0x1ea5('0x5'));var fs=require('fs');var path=require(_0x1ea5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ea5('0x7'));var integrations=require(_0x1ea5('0x8'));module['exports']=function(_0x4c7d1f,_0x502144){return _0x4c7d1f[_0x1ea5('0x9')](_0x1ea5('0xa'),attributes,{'tableName':_0x1ea5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd578=['path','../../config/environment','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xd578,0x162));var _0x8d57=function(_0x37b004,_0xf05be8){_0x37b004=_0x37b004-0x0;var _0x48979d=_0xd578[_0x37b004];return _0x48979d;};'use strict';var _=require(_0x8d57('0x0'));var util=require('util');var logger=require(_0x8d57('0x1'))(_0x8d57('0x2'));var moment=require(_0x8d57('0x3'));var BPromise=require(_0x8d57('0x4'));var rp=require(_0x8d57('0x5'));var fs=require('fs');var path=require(_0x8d57('0x6'));var rimraf=require('rimraf');var config=require(_0x8d57('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x8d57('0x8'));module['exports']=function(_0x3fc13c,_0x15e598){return _0x3fc13c[_0x8d57('0x9')](_0x8d57('0xa'),attributes,{'tableName':_0x8d57('0xb'),'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 024157d..c703f0e 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 _0x2547=['../../config/logger','../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVtigerAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x25288d,_0x5ae7c8){var _0x1af36d=function(_0x433cf4){while(--_0x433cf4){_0x25288d['push'](_0x25288d['shift']());}};_0x1af36d(++_0x5ae7c8);}(_0x2547,0x1cd));var _0x7254=function(_0x4886a8,_0x469841){_0x4886a8=_0x4886a8-0x0;var _0x1a689f=_0x2547[_0x4886a8];return _0x1a689f;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var moment=require(_0x7254('0x1'));var BPromise=require(_0x7254('0x2'));var rs=require(_0x7254('0x3'));var fs=require('fs');var Redis=require(_0x7254('0x4'));var db=require(_0x7254('0x5'))['db'];var utils=require(_0x7254('0x6'));var logger=require(_0x7254('0x7'))('rpc');var config=require(_0x7254('0x8'));var jayson=require(_0x7254('0x9'));var client=jayson[_0x7254('0xa')][_0x7254('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b845f,_0x253b1e,_0x6e3d84){return new BPromise(function(_0x395913,_0x5da1ec){return client[_0x7254('0xc')](_0x4b845f,_0x6e3d84)['then'](function(_0x50925f){logger['info'](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));logger[_0x7254('0xf')](_0x7254('0x10'),_0x253b1e,_0x7254('0xe'),JSON[_0x7254('0x11')](_0x50925f));if(_0x50925f['error']){if(_0x50925f[_0x7254('0x12')]['code']===0x1f4){logger[_0x7254('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x5da1ec(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x395913(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}else{logger[_0x7254('0x14')](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));_0x395913(_0x50925f['result'][_0x7254('0x13')]);}})[_0x7254('0x15')](function(_0xf47255){logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0xf47255);_0x5da1ec(_0xf47255);});});}exports[_0x7254('0x16')]=function(_0x2737e0){var _0x5dd23b=this;return new Promise(function(_0x1f48f6,_0x2283b7){return db[_0x7254('0x17')][_0x7254('0x18')]({'raw':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1a')]===undefined?!![]:![]:!![],'where':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1b')]||null:null,'attributes':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1c')]||null:null,'limit':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1d')]||null:null,'include':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x2737e0[_0x7254('0x19')]['include'],function(_0x493bfd){return{'model':db[_0x493bfd[_0x7254('0x20')]],'as':_0x493bfd['as'],'attributes':_0x493bfd[_0x7254('0x1c')],'include':_0x493bfd[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x493bfd[_0x7254('0x1e')],function(_0x36b5d5){return{'model':db[_0x36b5d5[_0x7254('0x20')]],'as':_0x36b5d5['as'],'attributes':_0x36b5d5['attributes'],'include':_0x36b5d5[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x36b5d5[_0x7254('0x1e')],function(_0x494cdb){return{'model':db[_0x494cdb[_0x7254('0x20')]],'as':_0x494cdb['as'],'attributes':_0x494cdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x7254('0x21')](function(_0x134a9e){logger['info'](_0x7254('0x16'),_0x2737e0);logger[_0x7254('0xf')]('GetVtigerAccount',_0x2737e0,JSON[_0x7254('0x11')](_0x134a9e));_0x1f48f6(_0x134a9e);})[_0x7254('0x15')](function(_0x37cb5c){logger[_0x7254('0x12')](_0x7254('0x16'),_0x37cb5c[_0x7254('0x13')],_0x2737e0);_0x2283b7(_0x5dd23b['error'](0x1f4,_0x37cb5c[_0x7254('0x13')]));});});};exports[_0x7254('0x22')]=function(_0x5569be){var _0x2f75ea=this;return new Promise(function(_0x1279cd,_0x2be5fc){return db['VtigerAccount'][_0x7254('0x23')]({'raw':_0x5569be[_0x7254('0x19')]?_0x5569be[_0x7254('0x19')][_0x7254('0x1a')]===undefined?!![]:![]:!![],'where':_0x5569be[_0x7254('0x19')]?_0x5569be[_0x7254('0x19')][_0x7254('0x1b')]||null:null,'attributes':_0x5569be['options']?_0x5569be[_0x7254('0x19')]['attributes']||null:null,'include':_0x5569be['options']?_0x5569be[_0x7254('0x19')][_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x5569be[_0x7254('0x19')][_0x7254('0x1e')],function(_0x430420){return{'model':db[_0x430420[_0x7254('0x20')]],'as':_0x430420['as'],'attributes':_0x430420[_0x7254('0x1c')],'include':_0x430420[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x430420[_0x7254('0x1e')],function(_0x3b0abd){return{'model':db[_0x3b0abd[_0x7254('0x20')]],'as':_0x3b0abd['as'],'attributes':_0x3b0abd[_0x7254('0x1c')],'include':_0x3b0abd['include']?_[_0x7254('0x1f')](_0x3b0abd[_0x7254('0x1e')],function(_0x2ea976){return{'model':db[_0x2ea976[_0x7254('0x20')]],'as':_0x2ea976['as'],'attributes':_0x2ea976[_0x7254('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x140bb2){logger['info'](_0x7254('0x22'),_0x5569be);logger[_0x7254('0xf')](_0x7254('0x22'),_0x5569be,JSON[_0x7254('0x11')](_0x140bb2));_0x1279cd(_0x140bb2);})[_0x7254('0x15')](function(_0x4e6213){logger[_0x7254('0x12')]('ShowVtigerAccount',_0x4e6213[_0x7254('0x13')],_0x5569be);_0x2be5fc(_0x2f75ea[_0x7254('0x12')](0x1f4,_0x4e6213['message']));});});}; \ No newline at end of file +var _0x6c76=['findAll','options','raw','where','attributes','map','include','model','GetVtigerAccount','debug','ShowVtigerAccount','VtigerAccount','find','then','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2bd55b,_0x5b3b4c){var _0x103a71=function(_0x6821b8){while(--_0x6821b8){_0x2bd55b['push'](_0x2bd55b['shift']());}};_0x103a71(++_0x5b3b4c);}(_0x6c76,0x184));var _0x66c7=function(_0x1e6fb1,_0x5c3c99){_0x1e6fb1=_0x1e6fb1-0x0;var _0x7c02cd=_0x6c76[_0x1e6fb1];return _0x7c02cd;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});}exports['GetVtigerAccount']=function(_0x5129f6){var _0x8ad572=this;return new Promise(function(_0x19f29d,_0x47a299){return db['VtigerAccount'][_0x66c7('0x14')]({'raw':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x5129f6['options']?_0x5129f6['options'][_0x66c7('0x17')]||null:null,'attributes':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'limit':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['limit']||null:null,'include':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['include']?_[_0x66c7('0x19')](_0x5129f6[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fc9d3){return{'model':db[_0x1fc9d3['model']],'as':_0x1fc9d3['as'],'attributes':_0x1fc9d3[_0x66c7('0x18')],'include':_0x1fc9d3[_0x66c7('0x1a')]?_['map'](_0x1fc9d3[_0x66c7('0x1a')],function(_0x11a6b9){return{'model':db[_0x11a6b9[_0x66c7('0x1b')]],'as':_0x11a6b9['as'],'attributes':_0x11a6b9[_0x66c7('0x18')],'include':_0x11a6b9[_0x66c7('0x1a')]?_['map'](_0x11a6b9['include'],function(_0x4e514a){return{'model':db[_0x4e514a[_0x66c7('0x1b')]],'as':_0x4e514a['as'],'attributes':_0x4e514a[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9afd50){logger[_0x66c7('0xa')](_0x66c7('0x1c'),_0x5129f6);logger[_0x66c7('0x1d')](_0x66c7('0x1c'),_0x5129f6,JSON[_0x66c7('0xe')](_0x9afd50));_0x19f29d(_0x9afd50);})['catch'](function(_0xccefb2){logger[_0x66c7('0xf')](_0x66c7('0x1c'),_0xccefb2[_0x66c7('0x11')],_0x5129f6);_0x47a299(_0x8ad572[_0x66c7('0xf')](0x1f4,_0xccefb2['message']));});});};exports[_0x66c7('0x1e')]=function(_0x4f1a34){var _0xfbd97=this;return new Promise(function(_0x543fbf,_0x296875){return db[_0x66c7('0x1f')][_0x66c7('0x20')]({'raw':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x4f1a34['options']?_0x4f1a34['options'][_0x66c7('0x17')]||null:null,'attributes':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'include':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fd460){return{'model':db[_0x1fd460[_0x66c7('0x1b')]],'as':_0x1fd460['as'],'attributes':_0x1fd460['attributes'],'include':_0x1fd460['include']?_[_0x66c7('0x19')](_0x1fd460[_0x66c7('0x1a')],function(_0x367ad5){return{'model':db[_0x367ad5[_0x66c7('0x1b')]],'as':_0x367ad5['as'],'attributes':_0x367ad5[_0x66c7('0x18')],'include':_0x367ad5[_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x367ad5['include'],function(_0x30b90f){return{'model':db[_0x30b90f[_0x66c7('0x1b')]],'as':_0x30b90f['as'],'attributes':_0x30b90f[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x66c7('0x21')](function(_0x1e5993){logger[_0x66c7('0xa')](_0x66c7('0x1e'),_0x4f1a34);logger[_0x66c7('0x1d')](_0x66c7('0x1e'),_0x4f1a34,JSON[_0x66c7('0xe')](_0x1e5993));_0x543fbf(_0x1e5993);})[_0x66c7('0x13')](function(_0x4cd663){logger['error'](_0x66c7('0x1e'),_0x4cd663[_0x66c7('0x11')],_0x4f1a34);_0x296875(_0xfbd97[_0x66c7('0xf')](0x1f4,_0x4cd663['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c69dc1d..30ec852 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 _0x0531=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x51ef74,_0x5f88f7){var _0x432782=function(_0x5b1e4b){while(--_0x5b1e4b){_0x51ef74['push'](_0x51ef74['shift']());}};_0x432782(++_0x5f88f7);}(_0x0531,0x68));var _0x1053=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x0531[_0x1d1963];return _0x3f58bb;};'use strict';var multer=require(_0x1053('0x0'));var util=require(_0x1053('0x1'));var path=require(_0x1053('0x2'));var timeout=require('connect-timeout');var express=require(_0x1053('0x3'));var router=express[_0x1053('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1053('0x5'));var interaction=require(_0x1053('0x6'));var config=require(_0x1053('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0x1053('0x8')]('/',auth[_0x1053('0x9')](),controller['index']);router[_0x1053('0x8')](_0x1053('0xa'),auth[_0x1053('0x9')](),controller[_0x1053('0xb')]);router[_0x1053('0x8')](_0x1053('0xc'),auth['isAuthenticated'](),controller[_0x1053('0xd')]);router[_0x1053('0x8')](_0x1053('0xe'),auth['isAuthenticated'](),controller[_0x1053('0xf')]);router[_0x1053('0x8')]('/:id/descriptions',auth[_0x1053('0x9')](),controller[_0x1053('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1053('0x11')]);router[_0x1053('0x12')](_0x1053('0xa'),auth[_0x1053('0x9')](),controller['update']);router[_0x1053('0x13')](_0x1053('0xa'),auth[_0x1053('0x9')](),controller[_0x1053('0x14')]);module[_0x1053('0x15')]=router; \ No newline at end of file +var _0x48e7=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer'];(function(_0x4bbace,_0x2d4cd9){var _0x1a25cb=function(_0x375f76){while(--_0x375f76){_0x4bbace['push'](_0x4bbace['shift']());}};_0x1a25cb(++_0x2d4cd9);}(_0x48e7,0x112));var _0x748e=function(_0x34a223,_0x5b0fe9){_0x34a223=_0x34a223-0x0;var _0x4a9a0e=_0x48e7[_0x34a223];return _0x4a9a0e;};'use strict';var multer=require(_0x748e('0x0'));var util=require(_0x748e('0x1'));var path=require(_0x748e('0x2'));var timeout=require(_0x748e('0x3'));var express=require('express');var router=express[_0x748e('0x4')]();var fs_extra=require(_0x748e('0x5'));var auth=require(_0x748e('0x6'));var interaction=require(_0x748e('0x7'));var config=require(_0x748e('0x8'));var controller=require(_0x748e('0x9'));router[_0x748e('0xa')]('/',auth[_0x748e('0xb')](),controller[_0x748e('0xc')]);router['get'](_0x748e('0xd'),auth[_0x748e('0xb')](),controller[_0x748e('0xe')]);router['get']('/:id/fields',auth[_0x748e('0xb')](),controller['getFields']);router[_0x748e('0xa')](_0x748e('0xf'),auth[_0x748e('0xb')](),controller[_0x748e('0x10')]);router[_0x748e('0xa')](_0x748e('0x11'),auth[_0x748e('0xb')](),controller['getDescriptions']);router[_0x748e('0x12')]('/',auth[_0x748e('0xb')](),controller[_0x748e('0x13')]);router[_0x748e('0x14')]('/:id',auth[_0x748e('0xb')](),controller[_0x748e('0x15')]);router[_0x748e('0x16')](_0x748e('0xd'),auth[_0x748e('0xb')](),controller[_0x748e('0x17')]);module[_0x748e('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 80bb032..ef82778 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 _0xc85f=['exports','STRING','sequelize'];(function(_0x2872b0,_0x4b0855){var _0x58b379=function(_0x18954b){while(--_0x18954b){_0x2872b0['push'](_0x2872b0['shift']());}};_0x58b379(++_0x4b0855);}(_0xc85f,0x182));var _0xfc85=function(_0x457162,_0x1e848c){_0x457162=_0x457162-0x0;var _0x122edf=_0xc85f[_0x457162];return _0x122edf;};'use strict';var Sequelize=require(_0xfc85('0x0'));module[_0xfc85('0x1')]={'name':{'type':Sequelize[_0xfc85('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5c98=['sequelize','exports','STRING'];(function(_0x801bdb,_0x261b61){var _0xfe915c=function(_0x5ad212){while(--_0x5ad212){_0x801bdb['push'](_0x801bdb['shift']());}};_0xfe915c(++_0x261b61);}(_0x5c98,0x165));var _0x85c9=function(_0x5aaf47,_0x27038b){_0x5aaf47=_0x5aaf47-0x0;var _0x454b97=_0x5c98[_0x5aaf47];return _0x454b97;};'use strict';var Sequelize=require(_0x85c9('0x0'));module[_0x85c9('0x1')]={'name':{'type':Sequelize[_0x85c9('0x2')]},'description':{'type':Sequelize[_0x85c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index c77f9c7..188b49e 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 _0x211a=['options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','pick','getFields','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x47a18a,_0x410a88){var _0x2e0edc=function(_0x29f5e7){while(--_0x29f5e7){_0x47a18a['push'](_0x47a18a['shift']());}};_0x2e0edc(++_0x410a88);}(_0x211a,0x64));var _0xa211=function(_0x33c8ef,_0x5c5f9b){_0x33c8ef=_0x33c8ef-0x0;var _0x3cb4d1=_0x211a[_0x33c8ef];return _0x3cb4d1;};'use strict';var emlformat=require(_0xa211('0x0'));var rimraf=require(_0xa211('0x1'));var zipdir=require(_0xa211('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa211('0x3'));var moment=require('moment');var BPromise=require(_0xa211('0x4'));var Mustache=require(_0xa211('0x5'));var util=require(_0xa211('0x6'));var path=require(_0xa211('0x7'));var sox=require(_0xa211('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa211('0x9'));var _=require(_0xa211('0xa'));var squel=require('squel');var crypto=require(_0xa211('0xb'));var jsforce=require(_0xa211('0xc'));var deskjs=require(_0xa211('0xd'));var toCsv=require(_0xa211('0xe'));var querystring=require('querystring');var Papa=require(_0xa211('0xf'));var Redis=require(_0xa211('0x10'));var authService=require(_0xa211('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa211('0x12'));var hardwareService=require(_0xa211('0x13'));var logger=require(_0xa211('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa211('0x15'));var db=require(_0xa211('0x16'))['db'];function respondWithStatusCode(_0x2199a5,_0x3c8937){_0x3c8937=_0x3c8937||0xcc;return function(_0x2a6918){if(_0x2a6918){return _0x2199a5['sendStatus'](_0x3c8937);}return _0x2199a5[_0xa211('0x17')](_0x3c8937)['end']();};}function respondWithResult(_0x1d1af6,_0x2abdbf){_0x2abdbf=_0x2abdbf||0xc8;return function(_0x165e08){if(_0x165e08){return _0x1d1af6[_0xa211('0x17')](_0x2abdbf)[_0xa211('0x18')](_0x165e08);}};}function respondWithFilteredResult(_0x27b2f9,_0x22c8b9){return function(_0x4e7e81){if(_0x4e7e81){var _0x5cc1a6=typeof _0x22c8b9[_0xa211('0x19')]===_0xa211('0x1a')&&typeof _0x22c8b9[_0xa211('0x1b')]===_0xa211('0x1a');var _0x41ee49=_0x4e7e81[_0xa211('0x1c')];var _0x388809=_0x5cc1a6?0x0:_0x22c8b9['offset'];var _0x5ccab8=_0x5cc1a6?_0x4e7e81[_0xa211('0x1c')]:_0x22c8b9[_0xa211('0x19')]+_0x22c8b9[_0xa211('0x1b')];var _0x5a2223;if(_0x5ccab8>=_0x41ee49){_0x5ccab8=_0x41ee49;_0x5a2223=0xc8;}else{_0x5a2223=0xce;}_0x27b2f9[_0xa211('0x17')](_0x5a2223);return _0x27b2f9[_0xa211('0x1d')](_0xa211('0x1e'),_0x388809+'-'+_0x5ccab8+'/'+_0x41ee49)[_0xa211('0x18')](_0x4e7e81);}return null;};}function patchUpdates(_0xb9d10f){return function(_0x6f5c2c){try{jsonpatch[_0xa211('0x1f')](_0x6f5c2c,_0xb9d10f,!![]);}catch(_0x4364c4){return BPromise[_0xa211('0x20')](_0x4364c4);}return _0x6f5c2c[_0xa211('0x21')]();};}function saveUpdates(_0x492817,_0x1304d7){return function(_0x1f7e39){if(_0x1f7e39){return _0x1f7e39[_0xa211('0x22')](_0x492817)[_0xa211('0x23')](function(_0x1ddeda){return _0x1ddeda;});}return null;};}function removeEntity(_0x106a87,_0x3ce919){return function(_0x4de90d){if(_0x4de90d){return _0x4de90d[_0xa211('0x24')]()['then'](function(){_0x106a87['status'](0xcc)[_0xa211('0x25')]();});}};}function handleEntityNotFound(_0x8e04ec,_0x5a65e3){return function(_0x40e61d){if(!_0x40e61d){_0x8e04ec[_0xa211('0x26')](0x194);}return _0x40e61d;};}function handleError(_0x4a8c3b,_0x47fffe){_0x47fffe=_0x47fffe||0x1f4;return function(_0x5d49f1){logger[_0xa211('0x27')](_0x5d49f1[_0xa211('0x28')]);if(_0x5d49f1[_0xa211('0x29')]){delete _0x5d49f1[_0xa211('0x29')];}_0x4a8c3b[_0xa211('0x17')](_0x47fffe)[_0xa211('0x2a')](_0x5d49f1);};}exports[_0xa211('0x2b')]=function(_0x231c49,_0x50db0c){var _0x4dd5b0={},_0x1be3e8={},_0x458fed={'count':0x0,'rows':[]};var _0x2f9b8e=_['map'](db[_0xa211('0x2c')][_0xa211('0x2d')],function(_0x46e05d){return{'name':_0x46e05d[_0xa211('0x2e')],'type':_0x46e05d[_0xa211('0x2f')][_0xa211('0x30')]};});_0x1be3e8[_0xa211('0x31')]=_[_0xa211('0x32')](_0x2f9b8e,_0xa211('0x29'));_0x1be3e8[_0xa211('0x33')]=_[_0xa211('0x34')](_0x231c49[_0xa211('0x33')]);_0x1be3e8[_0xa211('0x35')]=_[_0xa211('0x36')](_0x1be3e8[_0xa211('0x31')],_0x1be3e8['query']);_0x4dd5b0[_0xa211('0x37')]=_[_0xa211('0x36')](_0x1be3e8[_0xa211('0x31')],qs[_0xa211('0x38')](_0x231c49[_0xa211('0x33')][_0xa211('0x38')]));_0x4dd5b0['attributes']=_0x4dd5b0[_0xa211('0x37')][_0xa211('0x39')]?_0x4dd5b0[_0xa211('0x37')]:_0x1be3e8[_0xa211('0x31')];if(!_0x231c49[_0xa211('0x33')][_0xa211('0x3a')](_0xa211('0x3b'))){_0x4dd5b0[_0xa211('0x1b')]=qs[_0xa211('0x1b')](_0x231c49[_0xa211('0x33')][_0xa211('0x1b')]);_0x4dd5b0[_0xa211('0x19')]=qs[_0xa211('0x19')](_0x231c49[_0xa211('0x33')][_0xa211('0x19')]);}_0x4dd5b0[_0xa211('0x3c')]=qs['sort'](_0x231c49['query'][_0xa211('0x3d')]);_0x4dd5b0[_0xa211('0x3e')]=qs[_0xa211('0x35')](_['pick'](_0x231c49['query'],_0x1be3e8[_0xa211('0x35')]),_0x2f9b8e);if(_0x231c49[_0xa211('0x33')][_0xa211('0x3f')]){_0x4dd5b0[_0xa211('0x3e')]=_[_0xa211('0x40')](_0x4dd5b0['where'],{'$or':_['map'](_0x2f9b8e,function(_0x17e1ef){if(_0x17e1ef['type']!==_0xa211('0x41')){var _0x2edc65={};_0x2edc65[_0x17e1ef[_0xa211('0x29')]]={'$like':'%'+_0x231c49[_0xa211('0x33')][_0xa211('0x3f')]+'%'};return _0x2edc65;}})});}_0x4dd5b0=_[_0xa211('0x40')]({},_0x4dd5b0,_0x231c49[_0xa211('0x42')]);var _0x21bd7e={'where':_0x4dd5b0['where']};return db[_0xa211('0x2c')][_0xa211('0x1c')](_0x21bd7e)[_0xa211('0x23')](function(_0x56b49d){_0x458fed[_0xa211('0x1c')]=_0x56b49d;if(_0x231c49[_0xa211('0x33')][_0xa211('0x43')]){_0x4dd5b0[_0xa211('0x44')]=[{'all':!![]}];}return db[_0xa211('0x2c')][_0xa211('0x45')](_0x4dd5b0);})[_0xa211('0x23')](function(_0x570378){_0x458fed[_0xa211('0x46')]=_0x570378;return _0x458fed;})['then'](respondWithFilteredResult(_0x50db0c,_0x4dd5b0))[_0xa211('0x47')](handleError(_0x50db0c,null));};exports[_0xa211('0x48')]=function(_0x1703c9,_0x4d36ce){var _0x2c96ae={'raw':![],'where':{'id':_0x1703c9[_0xa211('0x49')]['id']}},_0x2491df={};_0x2491df[_0xa211('0x31')]=_[_0xa211('0x34')](db[_0xa211('0x2c')][_0xa211('0x2d')]);_0x2491df[_0xa211('0x33')]=_[_0xa211('0x34')](_0x1703c9[_0xa211('0x33')]);_0x2491df['filters']=_['intersection'](_0x2491df[_0xa211('0x31')],_0x2491df[_0xa211('0x33')]);_0x2c96ae['attributes']=_[_0xa211('0x36')](_0x2491df[_0xa211('0x31')],qs['fields'](_0x1703c9[_0xa211('0x33')]['fields']));_0x2c96ae[_0xa211('0x37')]=_0x2c96ae[_0xa211('0x37')][_0xa211('0x39')]?_0x2c96ae[_0xa211('0x37')]:_0x2491df[_0xa211('0x31')];if(_0x1703c9[_0xa211('0x33')][_0xa211('0x43')]){_0x2c96ae[_0xa211('0x44')]=[{'all':!![]}];}_0x2c96ae=_['merge']({},_0x2c96ae,_0x1703c9['options']);return db[_0xa211('0x2c')][_0xa211('0x4a')](_0x2c96ae)[_0xa211('0x23')](handleEntityNotFound(_0x4d36ce,null))['then'](respondWithResult(_0x4d36ce,null))['catch'](handleError(_0x4d36ce,null));};exports[_0xa211('0x4b')]=function(_0x54f812,_0x5b164c){return db[_0xa211('0x2c')][_0xa211('0x4b')](_0x54f812[_0xa211('0x4c')],{})['then'](respondWithResult(_0x5b164c,0xc9))['catch'](handleError(_0x5b164c,null));};exports[_0xa211('0x22')]=function(_0x25032c,_0x127d90){if(_0x25032c['body']['id']){delete _0x25032c[_0xa211('0x4c')]['id'];}return db['VtigerConfiguration'][_0xa211('0x4a')]({'where':{'id':_0x25032c[_0xa211('0x49')]['id']}})[_0xa211('0x23')](handleEntityNotFound(_0x127d90,null))['then'](saveUpdates(_0x25032c['body'],null))['then'](respondWithResult(_0x127d90,null))[_0xa211('0x47')](handleError(_0x127d90,null));};exports['destroy']=function(_0xf01f29,_0x4970c1){return db[_0xa211('0x2c')]['find']({'where':{'id':_0xf01f29[_0xa211('0x49')]['id']}})[_0xa211('0x23')](handleEntityNotFound(_0x4970c1,null))[_0xa211('0x23')](removeEntity(_0x4970c1,null))[_0xa211('0x47')](handleError(_0x4970c1,null));};exports['getFields']=function(_0xab622b,_0x16a5b9,_0x3a2b88){var _0x376418={};var _0x2b715e={};var _0x11d688;var _0x8c5788;return db[_0xa211('0x2c')][_0xa211('0x4d')]({'where':{'id':_0xab622b[_0xa211('0x49')]['id']}})[_0xa211('0x23')](handleEntityNotFound(_0x16a5b9,null))[_0xa211('0x23')](function(_0x339cf7){if(_0x339cf7){_0x11d688=_0x339cf7;_0x2b715e[_0xa211('0x31')]=_['keys'](db['VtigerField'][_0xa211('0x2d')]);_0x2b715e[_0xa211('0x33')]=_['keys'](_0xab622b['query']);_0x2b715e[_0xa211('0x35')]=_[_0xa211('0x36')](_0x2b715e[_0xa211('0x31')],_0x2b715e['query']);_0x376418[_0xa211('0x37')]=_[_0xa211('0x36')](_0x2b715e[_0xa211('0x31')],qs[_0xa211('0x38')](_0xab622b[_0xa211('0x33')][_0xa211('0x38')]));_0x376418[_0xa211('0x37')]=_0x376418[_0xa211('0x37')][_0xa211('0x39')]?_0x376418[_0xa211('0x37')]:_0x2b715e[_0xa211('0x31')];_0x376418[_0xa211('0x3c')]=qs[_0xa211('0x3d')](_0xab622b[_0xa211('0x33')][_0xa211('0x3d')]);_0x376418[_0xa211('0x3e')]=qs['filters'](_[_0xa211('0x4e')](_0xab622b['query'],_0x2b715e[_0xa211('0x35')]));if(_0xab622b[_0xa211('0x33')][_0xa211('0x3f')]){_0x376418['where']=_[_0xa211('0x40')](_0x376418[_0xa211('0x3e')],{'$or':_[_0xa211('0x32')](_0x376418[_0xa211('0x37')],function(_0x1cc68f){var _0x571f54={};_0x571f54[_0x1cc68f]={'$like':'%'+_0xab622b[_0xa211('0x33')][_0xa211('0x3f')]+'%'};return _0x571f54;})});}_0x376418=_['merge']({},_0x376418,_0xab622b[_0xa211('0x42')]);return _0x11d688[_0xa211('0x4f')](_0x376418);}})[_0xa211('0x23')](function(_0x5623b9){if(_0x5623b9){_0x8c5788=_0x5623b9[_0xa211('0x39')];if(!_0xab622b[_0xa211('0x33')][_0xa211('0x3a')]('nolimit')){_0x376418[_0xa211('0x1b')]=qs[_0xa211('0x1b')](_0xab622b[_0xa211('0x33')][_0xa211('0x1b')]);_0x376418[_0xa211('0x19')]=qs[_0xa211('0x19')](_0xab622b['query'][_0xa211('0x19')]);}return _0x11d688[_0xa211('0x4f')](_0x376418);}})[_0xa211('0x23')](function(_0x524333){if(_0x524333){return _0x524333?{'count':_0x8c5788,'rows':_0x524333}:null;}})['then'](respondWithResult(_0x16a5b9,null))[_0xa211('0x47')](handleError(_0x16a5b9,null));};exports[_0xa211('0x50')]=function(_0x559f60,_0x3489d5,_0x28e3b2){var _0x224279={};var _0x2c4976={};var _0x1c7f03;var _0x2d57b5;return db['VtigerConfiguration'][_0xa211('0x4d')]({'where':{'id':_0x559f60[_0xa211('0x49')]['id']}})[_0xa211('0x23')](handleEntityNotFound(_0x3489d5,null))[_0xa211('0x23')](function(_0x395a3c){if(_0x395a3c){_0x1c7f03=_0x395a3c;_0x2c4976['model']=_[_0xa211('0x34')](db[_0xa211('0x51')][_0xa211('0x2d')]);_0x2c4976[_0xa211('0x33')]=_[_0xa211('0x34')](_0x559f60['query']);_0x2c4976[_0xa211('0x35')]=_['intersection'](_0x2c4976[_0xa211('0x31')],_0x2c4976[_0xa211('0x33')]);_0x224279[_0xa211('0x37')]=_[_0xa211('0x36')](_0x2c4976[_0xa211('0x31')],qs[_0xa211('0x38')](_0x559f60[_0xa211('0x33')][_0xa211('0x38')]));_0x224279[_0xa211('0x37')]=_0x224279[_0xa211('0x37')][_0xa211('0x39')]?_0x224279[_0xa211('0x37')]:_0x2c4976[_0xa211('0x31')];_0x224279['order']=qs[_0xa211('0x3d')](_0x559f60[_0xa211('0x33')][_0xa211('0x3d')]);_0x224279['where']=qs[_0xa211('0x35')](_['pick'](_0x559f60['query'],_0x2c4976[_0xa211('0x35')]));if(_0x559f60[_0xa211('0x33')][_0xa211('0x3f')]){_0x224279[_0xa211('0x3e')]=_[_0xa211('0x40')](_0x224279[_0xa211('0x3e')],{'$or':_['map'](_0x224279[_0xa211('0x37')],function(_0x168a88){var _0x58288b={};_0x58288b[_0x168a88]={'$like':'%'+_0x559f60[_0xa211('0x33')][_0xa211('0x3f')]+'%'};return _0x58288b;})});}_0x224279=_[_0xa211('0x40')]({},_0x224279,_0x559f60['options']);return _0x1c7f03[_0xa211('0x50')](_0x224279);}})[_0xa211('0x23')](function(_0x544829){if(_0x544829){_0x2d57b5=_0x544829[_0xa211('0x39')];if(!_0x559f60['query']['hasOwnProperty'](_0xa211('0x3b'))){_0x224279[_0xa211('0x1b')]=qs[_0xa211('0x1b')](_0x559f60[_0xa211('0x33')][_0xa211('0x1b')]);_0x224279[_0xa211('0x19')]=qs['offset'](_0x559f60[_0xa211('0x33')][_0xa211('0x19')]);}return _0x1c7f03[_0xa211('0x50')](_0x224279);}})[_0xa211('0x23')](function(_0x2e1fbd){if(_0x2e1fbd){return _0x2e1fbd?{'count':_0x2d57b5,'rows':_0x2e1fbd}:null;}})['then'](respondWithResult(_0x3489d5,null))['catch'](handleError(_0x3489d5,null));};exports['getDescriptions']=function(_0x414f4c,_0x264472,_0x439bd4){var _0x5552dd={};var _0xa9a10d={};var _0x29f0fa;var _0x330383;return db[_0xa211('0x2c')][_0xa211('0x4d')]({'where':{'id':_0x414f4c[_0xa211('0x49')]['id']}})[_0xa211('0x23')](handleEntityNotFound(_0x264472,null))[_0xa211('0x23')](function(_0x24a59b){if(_0x24a59b){_0x29f0fa=_0x24a59b;_0xa9a10d[_0xa211('0x31')]=_[_0xa211('0x34')](db[_0xa211('0x51')][_0xa211('0x2d')]);_0xa9a10d[_0xa211('0x33')]=_[_0xa211('0x34')](_0x414f4c[_0xa211('0x33')]);_0xa9a10d[_0xa211('0x35')]=_[_0xa211('0x36')](_0xa9a10d['model'],_0xa9a10d[_0xa211('0x33')]);_0x5552dd[_0xa211('0x37')]=_['intersection'](_0xa9a10d[_0xa211('0x31')],qs[_0xa211('0x38')](_0x414f4c[_0xa211('0x33')][_0xa211('0x38')]));_0x5552dd['attributes']=_0x5552dd[_0xa211('0x37')][_0xa211('0x39')]?_0x5552dd[_0xa211('0x37')]:_0xa9a10d['model'];_0x5552dd[_0xa211('0x3c')]=qs[_0xa211('0x3d')](_0x414f4c[_0xa211('0x33')]['sort']);_0x5552dd['where']=qs[_0xa211('0x35')](_[_0xa211('0x4e')](_0x414f4c[_0xa211('0x33')],_0xa9a10d[_0xa211('0x35')]));if(_0x414f4c[_0xa211('0x33')][_0xa211('0x3f')]){_0x5552dd[_0xa211('0x3e')]=_[_0xa211('0x40')](_0x5552dd[_0xa211('0x3e')],{'$or':_['map'](_0x5552dd[_0xa211('0x37')],function(_0xaf00fd){var _0x482f52={};_0x482f52[_0xaf00fd]={'$like':'%'+_0x414f4c['query'][_0xa211('0x3f')]+'%'};return _0x482f52;})});}_0x5552dd=_[_0xa211('0x40')]({},_0x5552dd,_0x414f4c[_0xa211('0x42')]);return _0x29f0fa[_0xa211('0x52')](_0x5552dd);}})[_0xa211('0x23')](function(_0x29a27d){if(_0x29a27d){_0x330383=_0x29a27d[_0xa211('0x39')];if(!_0x414f4c['query'][_0xa211('0x3a')](_0xa211('0x3b'))){_0x5552dd[_0xa211('0x1b')]=qs[_0xa211('0x1b')](_0x414f4c[_0xa211('0x33')][_0xa211('0x1b')]);_0x5552dd['offset']=qs[_0xa211('0x19')](_0x414f4c[_0xa211('0x33')]['offset']);}return _0x29f0fa[_0xa211('0x52')](_0x5552dd);}})[_0xa211('0x23')](function(_0x4c09fd){if(_0x4c09fd){return _0x4c09fd?{'count':_0x330383,'rows':_0x4c09fd}:null;}})[_0xa211('0x23')](respondWithResult(_0x264472,null))[_0xa211('0x47')](handleError(_0x264472,null));}; \ No newline at end of file +var _0x5a0a=['hasOwnProperty','nolimit','order','filter','merge','where','map','options','count','includeAll','rows','catch','show','params','include','find','create','body','getFields','pick','getSubjects','findOne','VtigerField','sort','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3b0c93,_0x1d4e5d){var _0x14fd4a=function(_0x22ed7c){while(--_0x22ed7c){_0x3b0c93['push'](_0x3b0c93['shift']());}};_0x14fd4a(++_0x1d4e5d);}(_0x5a0a,0x1a9));var _0xa5a0=function(_0x2bab3f,_0x5cca25){_0x2bab3f=_0x2bab3f-0x0;var _0x397c33=_0x5a0a[_0x2bab3f];return _0x397c33;};'use strict';var emlformat=require(_0xa5a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa5a0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5a0('0x2'));var moment=require(_0xa5a0('0x3'));var BPromise=require(_0xa5a0('0x4'));var Mustache=require(_0xa5a0('0x5'));var util=require(_0xa5a0('0x6'));var path=require('path');var sox=require(_0xa5a0('0x7'));var csv=require('to-csv');var ejs=require(_0xa5a0('0x8'));var fs=require('fs');var fs_extra=require(_0xa5a0('0x9'));var _=require(_0xa5a0('0xa'));var squel=require(_0xa5a0('0xb'));var crypto=require(_0xa5a0('0xc'));var jsforce=require(_0xa5a0('0xd'));var deskjs=require(_0xa5a0('0xe'));var toCsv=require(_0xa5a0('0xf'));var querystring=require(_0xa5a0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa5a0('0x11'));var qs=require(_0xa5a0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5a0('0x13'));var logger=require(_0xa5a0('0x14'))(_0xa5a0('0x15'));var utils=require(_0xa5a0('0x16'));var config=require(_0xa5a0('0x17'));var licenseUtil=require(_0xa5a0('0x18'));var db=require(_0xa5a0('0x19'))['db'];function respondWithStatusCode(_0x2edaa1,_0xce20ae){_0xce20ae=_0xce20ae||0xcc;return function(_0x52ba67){if(_0x52ba67){return _0x2edaa1[_0xa5a0('0x1a')](_0xce20ae);}return _0x2edaa1[_0xa5a0('0x1b')](_0xce20ae)['end']();};}function respondWithResult(_0x216860,_0xe140b7){_0xe140b7=_0xe140b7||0xc8;return function(_0xd34dd6){if(_0xd34dd6){return _0x216860[_0xa5a0('0x1b')](_0xe140b7)[_0xa5a0('0x1c')](_0xd34dd6);}};}function respondWithFilteredResult(_0x3017d8,_0x258ffc){return function(_0x3557a1){if(_0x3557a1){var _0x33a38e=typeof _0x258ffc['offset']==='undefined'&&typeof _0x258ffc['limit']===_0xa5a0('0x1d');var _0x58a90f=_0x3557a1['count'];var _0x197bd8=_0x33a38e?0x0:_0x258ffc[_0xa5a0('0x1e')];var _0x3ce681=_0x33a38e?_0x3557a1['count']:_0x258ffc['offset']+_0x258ffc[_0xa5a0('0x1f')];var _0x1c4541;if(_0x3ce681>=_0x58a90f){_0x3ce681=_0x58a90f;_0x1c4541=0xc8;}else{_0x1c4541=0xce;}_0x3017d8['status'](_0x1c4541);return _0x3017d8['set'](_0xa5a0('0x20'),_0x197bd8+'-'+_0x3ce681+'/'+_0x58a90f)[_0xa5a0('0x1c')](_0x3557a1);}return null;};}function patchUpdates(_0x3fd650){return function(_0x44adf3){try{jsonpatch[_0xa5a0('0x21')](_0x44adf3,_0x3fd650,!![]);}catch(_0x120ec2){return BPromise['reject'](_0x120ec2);}return _0x44adf3['save']();};}function saveUpdates(_0x39bb2b,_0x701d3c){return function(_0x36c7e0){if(_0x36c7e0){return _0x36c7e0[_0xa5a0('0x22')](_0x39bb2b)[_0xa5a0('0x23')](function(_0x53a4ea){return _0x53a4ea;});}return null;};}function removeEntity(_0x4e244a,_0x18b25c){return function(_0x501718){if(_0x501718){return _0x501718[_0xa5a0('0x24')]()[_0xa5a0('0x23')](function(){_0x4e244a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x488e30,_0x19db18){return function(_0xd93e21){if(!_0xd93e21){_0x488e30['sendStatus'](0x194);}return _0xd93e21;};}function handleError(_0x5b89c5,_0x49e9b0){_0x49e9b0=_0x49e9b0||0x1f4;return function(_0x459f61){logger[_0xa5a0('0x25')](_0x459f61[_0xa5a0('0x26')]);if(_0x459f61[_0xa5a0('0x27')]){delete _0x459f61[_0xa5a0('0x27')];}_0x5b89c5['status'](_0x49e9b0)[_0xa5a0('0x28')](_0x459f61);};}exports[_0xa5a0('0x29')]=function(_0x24ef8c,_0x5cd6a1){var _0x4bb3eb={},_0x1e7527={},_0x40d634={'count':0x0,'rows':[]};var _0x46873c=_['map'](db[_0xa5a0('0x2a')][_0xa5a0('0x2b')],function(_0x1efee8){return{'name':_0x1efee8[_0xa5a0('0x2c')],'type':_0x1efee8[_0xa5a0('0x2d')][_0xa5a0('0x2e')]};});_0x1e7527[_0xa5a0('0x2f')]=_['map'](_0x46873c,_0xa5a0('0x27'));_0x1e7527[_0xa5a0('0x30')]=_[_0xa5a0('0x31')](_0x24ef8c[_0xa5a0('0x30')]);_0x1e7527[_0xa5a0('0x32')]=_[_0xa5a0('0x33')](_0x1e7527[_0xa5a0('0x2f')],_0x1e7527[_0xa5a0('0x30')]);_0x4bb3eb[_0xa5a0('0x34')]=_[_0xa5a0('0x33')](_0x1e7527[_0xa5a0('0x2f')],qs[_0xa5a0('0x35')](_0x24ef8c[_0xa5a0('0x30')]['fields']));_0x4bb3eb['attributes']=_0x4bb3eb['attributes'][_0xa5a0('0x36')]?_0x4bb3eb[_0xa5a0('0x34')]:_0x1e7527[_0xa5a0('0x2f')];if(!_0x24ef8c[_0xa5a0('0x30')][_0xa5a0('0x37')](_0xa5a0('0x38'))){_0x4bb3eb[_0xa5a0('0x1f')]=qs[_0xa5a0('0x1f')](_0x24ef8c['query'][_0xa5a0('0x1f')]);_0x4bb3eb[_0xa5a0('0x1e')]=qs['offset'](_0x24ef8c['query'][_0xa5a0('0x1e')]);}_0x4bb3eb[_0xa5a0('0x39')]=qs['sort'](_0x24ef8c[_0xa5a0('0x30')]['sort']);_0x4bb3eb['where']=qs[_0xa5a0('0x32')](_['pick'](_0x24ef8c[_0xa5a0('0x30')],_0x1e7527[_0xa5a0('0x32')]),_0x46873c);if(_0x24ef8c[_0xa5a0('0x30')][_0xa5a0('0x3a')]){_0x4bb3eb['where']=_[_0xa5a0('0x3b')](_0x4bb3eb[_0xa5a0('0x3c')],{'$or':_[_0xa5a0('0x3d')](_0x46873c,function(_0x4f9be4){if(_0x4f9be4[_0xa5a0('0x2d')]!=='VIRTUAL'){var _0x802c4f={};_0x802c4f[_0x4f9be4['name']]={'$like':'%'+_0x24ef8c[_0xa5a0('0x30')][_0xa5a0('0x3a')]+'%'};return _0x802c4f;}})});}_0x4bb3eb=_['merge']({},_0x4bb3eb,_0x24ef8c[_0xa5a0('0x3e')]);var _0x1a869b={'where':_0x4bb3eb[_0xa5a0('0x3c')]};return db['VtigerConfiguration'][_0xa5a0('0x3f')](_0x1a869b)['then'](function(_0x27d3db){_0x40d634[_0xa5a0('0x3f')]=_0x27d3db;if(_0x24ef8c[_0xa5a0('0x30')][_0xa5a0('0x40')]){_0x4bb3eb['include']=[{'all':!![]}];}return db[_0xa5a0('0x2a')]['findAll'](_0x4bb3eb);})[_0xa5a0('0x23')](function(_0x51b8b0){_0x40d634[_0xa5a0('0x41')]=_0x51b8b0;return _0x40d634;})[_0xa5a0('0x23')](respondWithFilteredResult(_0x5cd6a1,_0x4bb3eb))[_0xa5a0('0x42')](handleError(_0x5cd6a1,null));};exports[_0xa5a0('0x43')]=function(_0x5a601a,_0x425c25){var _0x8674f7={'raw':![],'where':{'id':_0x5a601a[_0xa5a0('0x44')]['id']}},_0x4ac9a3={};_0x4ac9a3[_0xa5a0('0x2f')]=_[_0xa5a0('0x31')](db[_0xa5a0('0x2a')][_0xa5a0('0x2b')]);_0x4ac9a3[_0xa5a0('0x30')]=_[_0xa5a0('0x31')](_0x5a601a[_0xa5a0('0x30')]);_0x4ac9a3[_0xa5a0('0x32')]=_[_0xa5a0('0x33')](_0x4ac9a3[_0xa5a0('0x2f')],_0x4ac9a3['query']);_0x8674f7[_0xa5a0('0x34')]=_[_0xa5a0('0x33')](_0x4ac9a3[_0xa5a0('0x2f')],qs[_0xa5a0('0x35')](_0x5a601a[_0xa5a0('0x30')]['fields']));_0x8674f7[_0xa5a0('0x34')]=_0x8674f7[_0xa5a0('0x34')][_0xa5a0('0x36')]?_0x8674f7[_0xa5a0('0x34')]:_0x4ac9a3[_0xa5a0('0x2f')];if(_0x5a601a['query']['includeAll']){_0x8674f7[_0xa5a0('0x45')]=[{'all':!![]}];}_0x8674f7=_[_0xa5a0('0x3b')]({},_0x8674f7,_0x5a601a[_0xa5a0('0x3e')]);return db['VtigerConfiguration'][_0xa5a0('0x46')](_0x8674f7)[_0xa5a0('0x23')](handleEntityNotFound(_0x425c25,null))[_0xa5a0('0x23')](respondWithResult(_0x425c25,null))[_0xa5a0('0x42')](handleError(_0x425c25,null));};exports['create']=function(_0x315870,_0xd156fd){return db[_0xa5a0('0x2a')][_0xa5a0('0x47')](_0x315870[_0xa5a0('0x48')],{})[_0xa5a0('0x23')](respondWithResult(_0xd156fd,0xc9))[_0xa5a0('0x42')](handleError(_0xd156fd,null));};exports['update']=function(_0xcae8db,_0x2d71fe){if(_0xcae8db['body']['id']){delete _0xcae8db[_0xa5a0('0x48')]['id'];}return db[_0xa5a0('0x2a')][_0xa5a0('0x46')]({'where':{'id':_0xcae8db[_0xa5a0('0x44')]['id']}})[_0xa5a0('0x23')](handleEntityNotFound(_0x2d71fe,null))['then'](saveUpdates(_0xcae8db[_0xa5a0('0x48')],null))['then'](respondWithResult(_0x2d71fe,null))[_0xa5a0('0x42')](handleError(_0x2d71fe,null));};exports[_0xa5a0('0x24')]=function(_0x156faf,_0x2280e3){return db[_0xa5a0('0x2a')][_0xa5a0('0x46')]({'where':{'id':_0x156faf[_0xa5a0('0x44')]['id']}})[_0xa5a0('0x23')](handleEntityNotFound(_0x2280e3,null))[_0xa5a0('0x23')](removeEntity(_0x2280e3,null))[_0xa5a0('0x42')](handleError(_0x2280e3,null));};exports[_0xa5a0('0x49')]=function(_0x54364a,_0x59bb87,_0x49038d){var _0x43b5bd={};var _0x2c442c={};var _0x91e054;var _0x480b99;return db[_0xa5a0('0x2a')]['findOne']({'where':{'id':_0x54364a[_0xa5a0('0x44')]['id']}})[_0xa5a0('0x23')](handleEntityNotFound(_0x59bb87,null))[_0xa5a0('0x23')](function(_0x116f27){if(_0x116f27){_0x91e054=_0x116f27;_0x2c442c[_0xa5a0('0x2f')]=_[_0xa5a0('0x31')](db['VtigerField'][_0xa5a0('0x2b')]);_0x2c442c['query']=_[_0xa5a0('0x31')](_0x54364a[_0xa5a0('0x30')]);_0x2c442c[_0xa5a0('0x32')]=_['intersection'](_0x2c442c[_0xa5a0('0x2f')],_0x2c442c[_0xa5a0('0x30')]);_0x43b5bd['attributes']=_[_0xa5a0('0x33')](_0x2c442c[_0xa5a0('0x2f')],qs[_0xa5a0('0x35')](_0x54364a['query'][_0xa5a0('0x35')]));_0x43b5bd['attributes']=_0x43b5bd[_0xa5a0('0x34')][_0xa5a0('0x36')]?_0x43b5bd[_0xa5a0('0x34')]:_0x2c442c[_0xa5a0('0x2f')];_0x43b5bd[_0xa5a0('0x39')]=qs['sort'](_0x54364a['query']['sort']);_0x43b5bd[_0xa5a0('0x3c')]=qs['filters'](_[_0xa5a0('0x4a')](_0x54364a[_0xa5a0('0x30')],_0x2c442c[_0xa5a0('0x32')]));if(_0x54364a[_0xa5a0('0x30')][_0xa5a0('0x3a')]){_0x43b5bd[_0xa5a0('0x3c')]=_['merge'](_0x43b5bd[_0xa5a0('0x3c')],{'$or':_[_0xa5a0('0x3d')](_0x43b5bd[_0xa5a0('0x34')],function(_0x3455a5){var _0x2a7923={};_0x2a7923[_0x3455a5]={'$like':'%'+_0x54364a[_0xa5a0('0x30')][_0xa5a0('0x3a')]+'%'};return _0x2a7923;})});}_0x43b5bd=_[_0xa5a0('0x3b')]({},_0x43b5bd,_0x54364a['options']);return _0x91e054[_0xa5a0('0x49')](_0x43b5bd);}})[_0xa5a0('0x23')](function(_0x30f4fc){if(_0x30f4fc){_0x480b99=_0x30f4fc[_0xa5a0('0x36')];if(!_0x54364a[_0xa5a0('0x30')][_0xa5a0('0x37')]('nolimit')){_0x43b5bd[_0xa5a0('0x1f')]=qs[_0xa5a0('0x1f')](_0x54364a['query'][_0xa5a0('0x1f')]);_0x43b5bd[_0xa5a0('0x1e')]=qs['offset'](_0x54364a[_0xa5a0('0x30')][_0xa5a0('0x1e')]);}return _0x91e054['getFields'](_0x43b5bd);}})[_0xa5a0('0x23')](function(_0x2fa6ae){if(_0x2fa6ae){return _0x2fa6ae?{'count':_0x480b99,'rows':_0x2fa6ae}:null;}})['then'](respondWithResult(_0x59bb87,null))[_0xa5a0('0x42')](handleError(_0x59bb87,null));};exports[_0xa5a0('0x4b')]=function(_0x5e6cd1,_0x1ccf9d,_0x14b6f9){var _0xb098a4={};var _0x332944={};var _0xea8758;var _0x73eb35;return db[_0xa5a0('0x2a')][_0xa5a0('0x4c')]({'where':{'id':_0x5e6cd1[_0xa5a0('0x44')]['id']}})[_0xa5a0('0x23')](handleEntityNotFound(_0x1ccf9d,null))['then'](function(_0x48fa58){if(_0x48fa58){_0xea8758=_0x48fa58;_0x332944[_0xa5a0('0x2f')]=_['keys'](db[_0xa5a0('0x4d')][_0xa5a0('0x2b')]);_0x332944['query']=_[_0xa5a0('0x31')](_0x5e6cd1['query']);_0x332944['filters']=_[_0xa5a0('0x33')](_0x332944[_0xa5a0('0x2f')],_0x332944[_0xa5a0('0x30')]);_0xb098a4[_0xa5a0('0x34')]=_[_0xa5a0('0x33')](_0x332944[_0xa5a0('0x2f')],qs[_0xa5a0('0x35')](_0x5e6cd1[_0xa5a0('0x30')][_0xa5a0('0x35')]));_0xb098a4[_0xa5a0('0x34')]=_0xb098a4[_0xa5a0('0x34')][_0xa5a0('0x36')]?_0xb098a4[_0xa5a0('0x34')]:_0x332944[_0xa5a0('0x2f')];_0xb098a4[_0xa5a0('0x39')]=qs['sort'](_0x5e6cd1[_0xa5a0('0x30')][_0xa5a0('0x4e')]);_0xb098a4[_0xa5a0('0x3c')]=qs[_0xa5a0('0x32')](_[_0xa5a0('0x4a')](_0x5e6cd1['query'],_0x332944[_0xa5a0('0x32')]));if(_0x5e6cd1[_0xa5a0('0x30')][_0xa5a0('0x3a')]){_0xb098a4[_0xa5a0('0x3c')]=_[_0xa5a0('0x3b')](_0xb098a4['where'],{'$or':_[_0xa5a0('0x3d')](_0xb098a4[_0xa5a0('0x34')],function(_0x4e1864){var _0x3b078f={};_0x3b078f[_0x4e1864]={'$like':'%'+_0x5e6cd1[_0xa5a0('0x30')][_0xa5a0('0x3a')]+'%'};return _0x3b078f;})});}_0xb098a4=_[_0xa5a0('0x3b')]({},_0xb098a4,_0x5e6cd1['options']);return _0xea8758['getSubjects'](_0xb098a4);}})[_0xa5a0('0x23')](function(_0x2a43bc){if(_0x2a43bc){_0x73eb35=_0x2a43bc[_0xa5a0('0x36')];if(!_0x5e6cd1[_0xa5a0('0x30')][_0xa5a0('0x37')]('nolimit')){_0xb098a4['limit']=qs[_0xa5a0('0x1f')](_0x5e6cd1[_0xa5a0('0x30')]['limit']);_0xb098a4[_0xa5a0('0x1e')]=qs[_0xa5a0('0x1e')](_0x5e6cd1[_0xa5a0('0x30')][_0xa5a0('0x1e')]);}return _0xea8758['getSubjects'](_0xb098a4);}})[_0xa5a0('0x23')](function(_0x101edb){if(_0x101edb){return _0x101edb?{'count':_0x73eb35,'rows':_0x101edb}:null;}})['then'](respondWithResult(_0x1ccf9d,null))[_0xa5a0('0x42')](handleError(_0x1ccf9d,null));};exports[_0xa5a0('0x4f')]=function(_0x2da34b,_0x4b6550,_0x30caa0){var _0x4d986f={};var _0x531315={};var _0x4b2b7f;var _0x2b2123;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x2da34b[_0xa5a0('0x44')]['id']}})[_0xa5a0('0x23')](handleEntityNotFound(_0x4b6550,null))['then'](function(_0x2c083d){if(_0x2c083d){_0x4b2b7f=_0x2c083d;_0x531315[_0xa5a0('0x2f')]=_[_0xa5a0('0x31')](db[_0xa5a0('0x4d')]['rawAttributes']);_0x531315['query']=_[_0xa5a0('0x31')](_0x2da34b[_0xa5a0('0x30')]);_0x531315[_0xa5a0('0x32')]=_[_0xa5a0('0x33')](_0x531315[_0xa5a0('0x2f')],_0x531315[_0xa5a0('0x30')]);_0x4d986f['attributes']=_[_0xa5a0('0x33')](_0x531315[_0xa5a0('0x2f')],qs[_0xa5a0('0x35')](_0x2da34b['query'][_0xa5a0('0x35')]));_0x4d986f[_0xa5a0('0x34')]=_0x4d986f['attributes'][_0xa5a0('0x36')]?_0x4d986f[_0xa5a0('0x34')]:_0x531315[_0xa5a0('0x2f')];_0x4d986f['order']=qs[_0xa5a0('0x4e')](_0x2da34b[_0xa5a0('0x30')]['sort']);_0x4d986f[_0xa5a0('0x3c')]=qs[_0xa5a0('0x32')](_[_0xa5a0('0x4a')](_0x2da34b[_0xa5a0('0x30')],_0x531315['filters']));if(_0x2da34b[_0xa5a0('0x30')][_0xa5a0('0x3a')]){_0x4d986f[_0xa5a0('0x3c')]=_['merge'](_0x4d986f['where'],{'$or':_[_0xa5a0('0x3d')](_0x4d986f[_0xa5a0('0x34')],function(_0x8dbb3e){var _0xab8042={};_0xab8042[_0x8dbb3e]={'$like':'%'+_0x2da34b['query']['filter']+'%'};return _0xab8042;})});}_0x4d986f=_[_0xa5a0('0x3b')]({},_0x4d986f,_0x2da34b[_0xa5a0('0x3e')]);return _0x4b2b7f[_0xa5a0('0x4f')](_0x4d986f);}})[_0xa5a0('0x23')](function(_0x4624c3){if(_0x4624c3){_0x2b2123=_0x4624c3[_0xa5a0('0x36')];if(!_0x2da34b[_0xa5a0('0x30')]['hasOwnProperty'](_0xa5a0('0x38'))){_0x4d986f['limit']=qs[_0xa5a0('0x1f')](_0x2da34b[_0xa5a0('0x30')][_0xa5a0('0x1f')]);_0x4d986f[_0xa5a0('0x1e')]=qs[_0xa5a0('0x1e')](_0x2da34b[_0xa5a0('0x30')]['offset']);}return _0x4b2b7f[_0xa5a0('0x4f')](_0x4d986f);}})[_0xa5a0('0x23')](function(_0x3f0202){if(_0x3f0202){return _0x3f0202?{'count':_0x2b2123,'rows':_0x3f0202}:null;}})[_0xa5a0('0x23')](respondWithResult(_0x4b6550,null))[_0xa5a0('0x42')](handleError(_0x4b6550,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b87edd3..a830a9f 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 _0x1268=['exports','define','VtigerConfiguration','int_vtiger_configurations','util','api','moment','request-promise','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x14cf5e,_0x3b77b6){var _0x163602=function(_0x242028){while(--_0x242028){_0x14cf5e['push'](_0x14cf5e['shift']());}};_0x163602(++_0x3b77b6);}(_0x1268,0xcc));var _0x8126=function(_0x1177db,_0x48a193){_0x1177db=_0x1177db-0x0;var _0x279f79=_0x1268[_0x1177db];return _0x279f79;};'use strict';var _=require('lodash');var util=require(_0x8126('0x0'));var logger=require('../../config/logger')(_0x8126('0x1'));var moment=require(_0x8126('0x2'));var BPromise=require('bluebird');var rp=require(_0x8126('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8126('0x4'));var attributes=require(_0x8126('0x5'));module[_0x8126('0x6')]=function(_0x2fb792,_0x421e42){return _0x2fb792[_0x8126('0x7')](_0x8126('0x8'),attributes,{'tableName':_0x8126('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd140=['api','moment','bluebird','request-promise','path','rimraf','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x2e487b,_0x11209b){var _0x1b59c0=function(_0x159344){while(--_0x159344){_0x2e487b['push'](_0x2e487b['shift']());}};_0x1b59c0(++_0x11209b);}(_0xd140,0x15d));var _0x0d14=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd140[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d14('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0d14('0x1'));var moment=require(_0x0d14('0x2'));var BPromise=require(_0x0d14('0x3'));var rp=require(_0x0d14('0x4'));var fs=require('fs');var path=require(_0x0d14('0x5'));var rimraf=require(_0x0d14('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x520b0b,_0x565e7d){return _0x520b0b[_0x0d14('0x7')](_0x0d14('0x8'),attributes,{'tableName':_0x0d14('0x9'),'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 82d1c28..8481f02 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 _0xdd4b=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x47ebac,_0x536748){var _0x7de66=function(_0x66b851){while(--_0x66b851){_0x47ebac['push'](_0x47ebac['shift']());}};_0x7de66(++_0x536748);}(_0xdd4b,0x95));var _0xbdd4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdd4b[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xbdd4('0x0'));var util=require(_0xbdd4('0x1'));var moment=require(_0xbdd4('0x2'));var BPromise=require(_0xbdd4('0x3'));var rs=require(_0xbdd4('0x4'));var fs=require('fs');var Redis=require(_0xbdd4('0x5'));var db=require(_0xbdd4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdd4('0x7'))('rpc');var config=require(_0xbdd4('0x8'));var jayson=require(_0xbdd4('0x9'));var client=jayson[_0xbdd4('0xa')][_0xbdd4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x566df3,_0x17b72a,_0x4a3292){return new BPromise(function(_0x6187f4,_0x18c8f6){return client[_0xbdd4('0xc')](_0x566df3,_0x4a3292)[_0xbdd4('0xd')](function(_0x365fc8){logger[_0xbdd4('0xe')](_0xbdd4('0xf'),_0x17b72a,_0xbdd4('0x10'));logger[_0xbdd4('0x11')](_0xbdd4('0x12'),_0x17b72a,_0xbdd4('0x10'),JSON[_0xbdd4('0x13')](_0x365fc8));if(_0x365fc8[_0xbdd4('0x14')]){if(_0x365fc8[_0xbdd4('0x14')][_0xbdd4('0x15')]===0x1f4){logger[_0xbdd4('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x17b72a,_0x365fc8[_0xbdd4('0x14')][_0xbdd4('0x16')]);return _0x18c8f6(_0x365fc8[_0xbdd4('0x14')][_0xbdd4('0x16')]);}logger['error'](_0xbdd4('0xf'),_0x17b72a,_0x365fc8[_0xbdd4('0x14')][_0xbdd4('0x16')]);return _0x6187f4(_0x365fc8['error']['message']);}else{logger[_0xbdd4('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x17b72a,_0xbdd4('0x10'));_0x6187f4(_0x365fc8[_0xbdd4('0x17')][_0xbdd4('0x16')]);}})[_0xbdd4('0x18')](function(_0x36315e){logger[_0xbdd4('0x14')](_0xbdd4('0xf'),_0x17b72a,_0x36315e);_0x18c8f6(_0x36315e);});});} \ No newline at end of file +var _0xa934=['http','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x178492,_0x4f0e18){var _0xf730b4=function(_0x184f5d){while(--_0x184f5d){_0x178492['push'](_0x178492['shift']());}};_0xf730b4(++_0x4f0e18);}(_0xa934,0x1d4));var _0x4a93=function(_0xba0587,_0x482b99){_0xba0587=_0xba0587-0x0;var _0x5e6ebc=_0xa934[_0xba0587];return _0x5e6ebc;};'use strict';var _=require(_0x4a93('0x0'));var util=require(_0x4a93('0x1'));var moment=require(_0x4a93('0x2'));var BPromise=require(_0x4a93('0x3'));var rs=require(_0x4a93('0x4'));var fs=require('fs');var Redis=require(_0x4a93('0x5'));var db=require(_0x4a93('0x6'))['db'];var utils=require(_0x4a93('0x7'));var logger=require(_0x4a93('0x8'))('rpc');var config=require(_0x4a93('0x9'));var jayson=require(_0x4a93('0xa'));var client=jayson[_0x4a93('0xb')][_0x4a93('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12180a,_0x7bf724,_0xe0677b){return new BPromise(function(_0x3b71d8,_0x14303a){return client['request'](_0x12180a,_0xe0677b)[_0x4a93('0xd')](function(_0xe1bbd){logger[_0x4a93('0xe')](_0x4a93('0xf'),_0x7bf724,'request\x20sent');logger[_0x4a93('0x10')](_0x4a93('0x11'),_0x7bf724,_0x4a93('0x12'),JSON[_0x4a93('0x13')](_0xe1bbd));if(_0xe1bbd[_0x4a93('0x14')]){if(_0xe1bbd[_0x4a93('0x14')][_0x4a93('0x15')]===0x1f4){logger[_0x4a93('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x7bf724,_0xe1bbd[_0x4a93('0x14')][_0x4a93('0x16')]);return _0x14303a(_0xe1bbd[_0x4a93('0x14')][_0x4a93('0x16')]);}logger[_0x4a93('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x7bf724,_0xe1bbd['error'][_0x4a93('0x16')]);return _0x3b71d8(_0xe1bbd[_0x4a93('0x14')][_0x4a93('0x16')]);}else{logger[_0x4a93('0xe')](_0x4a93('0xf'),_0x7bf724,_0x4a93('0x12'));_0x3b71d8(_0xe1bbd[_0x4a93('0x17')]['message']);}})['catch'](function(_0x392c8e){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x7bf724,_0x392c8e);_0x14303a(_0x392c8e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 691d633..236185f 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 _0x2247=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x20e65c,_0x231b2e){var _0x13277c=function(_0x755341){while(--_0x755341){_0x20e65c['push'](_0x20e65c['shift']());}};_0x13277c(++_0x231b2e);}(_0x2247,0x6d));var _0x7224=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2247[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x7224('0x0'));var util=require('util');var path=require(_0x7224('0x1'));var timeout=require(_0x7224('0x2'));var express=require(_0x7224('0x3'));var router=express[_0x7224('0x4')]();var fs_extra=require(_0x7224('0x5'));var auth=require(_0x7224('0x6'));var interaction=require(_0x7224('0x7'));var config=require(_0x7224('0x8'));var controller=require('./intVtigerField.controller');router[_0x7224('0x9')]('/',auth[_0x7224('0xa')](),controller[_0x7224('0xb')]);router['get'](_0x7224('0xc'),auth[_0x7224('0xa')](),controller['show']);router[_0x7224('0xd')]('/',auth[_0x7224('0xa')](),controller[_0x7224('0xe')]);router[_0x7224('0xf')](_0x7224('0xc'),auth[_0x7224('0xa')](),controller[_0x7224('0x10')]);router['delete'](_0x7224('0xc'),auth[_0x7224('0xa')](),controller[_0x7224('0x11')]);module[_0x7224('0x12')]=router; \ No newline at end of file +var _0x04bc=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports'];(function(_0x4f700e,_0xc4df01){var _0x45ec02=function(_0x5e7445){while(--_0x5e7445){_0x4f700e['push'](_0x4f700e['shift']());}};_0x45ec02(++_0xc4df01);}(_0x04bc,0x1d4));var _0xc04b=function(_0x42c380,_0x35c686){_0x42c380=_0x42c380-0x0;var _0x4697d6=_0x04bc[_0x42c380];return _0x4697d6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc04b('0x0'));var timeout=require('connect-timeout');var express=require(_0xc04b('0x1'));var router=express[_0xc04b('0x2')]();var fs_extra=require(_0xc04b('0x3'));var auth=require(_0xc04b('0x4'));var interaction=require(_0xc04b('0x5'));var config=require(_0xc04b('0x6'));var controller=require(_0xc04b('0x7'));router[_0xc04b('0x8')]('/',auth[_0xc04b('0x9')](),controller['index']);router['get'](_0xc04b('0xa'),auth['isAuthenticated'](),controller[_0xc04b('0xb')]);router[_0xc04b('0xc')]('/',auth['isAuthenticated'](),controller[_0xc04b('0xd')]);router[_0xc04b('0xe')](_0xc04b('0xa'),auth[_0xc04b('0x9')](),controller[_0xc04b('0xf')]);router['delete'](_0xc04b('0xa'),auth[_0xc04b('0x9')](),controller[_0xc04b('0x10')]);module[_0xc04b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 11ac3b3..560ad12 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 _0xf0f2=['string','keyValue','picklist','STRING','variable','customVariable','BOOLEAN','exports','ENUM'];(function(_0x5a8c08,_0x2d6a6a){var _0x391b3c=function(_0x40ef94){while(--_0x40ef94){_0x5a8c08['push'](_0x5a8c08['shift']());}};_0x391b3c(++_0x2d6a6a);}(_0xf0f2,0x181));var _0x2f0f=function(_0x5ce00e,_0x5be1b1){_0x5ce00e=_0x5ce00e-0x0;var _0x2f825b=_0xf0f2[_0x5ce00e];return _0x2f825b;};'use strict';var Sequelize=require('sequelize');module[_0x2f0f('0x0')]={'type':{'type':Sequelize[_0x2f0f('0x1')](_0x2f0f('0x2'),'variable','customVariable',_0x2f0f('0x3'),_0x2f0f('0x4')),'defaultValue':_0x2f0f('0x2')},'content':{'type':Sequelize[_0x2f0f('0x5')]},'key':{'type':Sequelize[_0x2f0f('0x5')]},'keyType':{'type':Sequelize[_0x2f0f('0x1')](_0x2f0f('0x2'),_0x2f0f('0x6'),_0x2f0f('0x7'))},'keyContent':{'type':Sequelize[_0x2f0f('0x5')]},'idField':{'type':Sequelize[_0x2f0f('0x5')]},'nameField':{'type':Sequelize[_0x2f0f('0x5')]},'customField':{'type':Sequelize[_0x2f0f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2f0f('0x5')]}}; \ No newline at end of file +var _0x74ea=['sequelize','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x4faf64,_0x138f4f){var _0x49da9a=function(_0x409771){while(--_0x409771){_0x4faf64['push'](_0x4faf64['shift']());}};_0x49da9a(++_0x138f4f);}(_0x74ea,0x19d));var _0xa74e=function(_0x3dced1,_0x2bf503){_0x3dced1=_0x3dced1-0x0;var _0x5309ce=_0x74ea[_0x3dced1];return _0x5309ce;};'use strict';var Sequelize=require(_0xa74e('0x0'));module[_0xa74e('0x1')]={'type':{'type':Sequelize[_0xa74e('0x2')](_0xa74e('0x3'),_0xa74e('0x4'),_0xa74e('0x5'),'keyValue','picklist'),'defaultValue':_0xa74e('0x3')},'content':{'type':Sequelize[_0xa74e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa74e('0x2')](_0xa74e('0x3'),_0xa74e('0x4'),_0xa74e('0x5'))},'keyContent':{'type':Sequelize[_0xa74e('0x6')]},'idField':{'type':Sequelize[_0xa74e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa74e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9d57863..5f9ea2a 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 _0x1438=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','name','send','index','VtigerField','rawAttributes','fieldName','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5f2615,_0x4913dc){var _0x344d3d=function(_0x547aac){while(--_0x547aac){_0x5f2615['push'](_0x5f2615['shift']());}};_0x344d3d(++_0x4913dc);}(_0x1438,0x1b2));var _0x8143=function(_0x103478,_0x353eca){_0x103478=_0x103478-0x0;var _0x55d015=_0x1438[_0x103478];return _0x55d015;};'use strict';var emlformat=require(_0x8143('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8143('0x1'));var jsonpatch=require(_0x8143('0x2'));var rp=require(_0x8143('0x3'));var moment=require(_0x8143('0x4'));var BPromise=require(_0x8143('0x5'));var Mustache=require(_0x8143('0x6'));var util=require('util');var path=require(_0x8143('0x7'));var sox=require(_0x8143('0x8'));var csv=require(_0x8143('0x9'));var ejs=require(_0x8143('0xa'));var fs=require('fs');var fs_extra=require(_0x8143('0xb'));var _=require(_0x8143('0xc'));var squel=require('squel');var crypto=require(_0x8143('0xd'));var jsforce=require(_0x8143('0xe'));var deskjs=require(_0x8143('0xf'));var toCsv=require(_0x8143('0x9'));var querystring=require(_0x8143('0x10'));var Papa=require(_0x8143('0x11'));var Redis=require(_0x8143('0x12'));var authService=require(_0x8143('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8143('0x14'));var hardwareService=require(_0x8143('0x15'));var logger=require(_0x8143('0x16'))(_0x8143('0x17'));var utils=require(_0x8143('0x18'));var config=require(_0x8143('0x19'));var licenseUtil=require(_0x8143('0x1a'));var db=require(_0x8143('0x1b'))['db'];function respondWithStatusCode(_0x43ff4b,_0x1b3785){_0x1b3785=_0x1b3785||0xcc;return function(_0x38ae6c){if(_0x38ae6c){return _0x43ff4b[_0x8143('0x1c')](_0x1b3785);}return _0x43ff4b[_0x8143('0x1d')](_0x1b3785)[_0x8143('0x1e')]();};}function respondWithResult(_0x3b89a2,_0x1014bc){_0x1014bc=_0x1014bc||0xc8;return function(_0x58fcc1){if(_0x58fcc1){return _0x3b89a2[_0x8143('0x1d')](_0x1014bc)[_0x8143('0x1f')](_0x58fcc1);}};}function respondWithFilteredResult(_0x2d89a4,_0x33a2f7){return function(_0x581c5d){if(_0x581c5d){var _0xc0a570=typeof _0x33a2f7['offset']===_0x8143('0x20')&&typeof _0x33a2f7[_0x8143('0x21')]===_0x8143('0x20');var _0x3c2c5f=_0x581c5d[_0x8143('0x22')];var _0x4e6e80=_0xc0a570?0x0:_0x33a2f7['offset'];var _0x2277b4=_0xc0a570?_0x581c5d[_0x8143('0x22')]:_0x33a2f7[_0x8143('0x23')]+_0x33a2f7[_0x8143('0x21')];var _0x498b5b;if(_0x2277b4>=_0x3c2c5f){_0x2277b4=_0x3c2c5f;_0x498b5b=0xc8;}else{_0x498b5b=0xce;}_0x2d89a4[_0x8143('0x1d')](_0x498b5b);return _0x2d89a4[_0x8143('0x24')](_0x8143('0x25'),_0x4e6e80+'-'+_0x2277b4+'/'+_0x3c2c5f)[_0x8143('0x1f')](_0x581c5d);}return null;};}function patchUpdates(_0x34fda2){return function(_0x13c273){try{jsonpatch[_0x8143('0x26')](_0x13c273,_0x34fda2,!![]);}catch(_0x220c42){return BPromise['reject'](_0x220c42);}return _0x13c273['save']();};}function saveUpdates(_0x58a7a0,_0x1c88c7){return function(_0x2ae8bd){if(_0x2ae8bd){return _0x2ae8bd[_0x8143('0x27')](_0x58a7a0)[_0x8143('0x28')](function(_0x279db8){return _0x279db8;});}return null;};}function removeEntity(_0x12535c,_0x158cd4){return function(_0x2706be){if(_0x2706be){return _0x2706be[_0x8143('0x29')]()['then'](function(){_0x12535c[_0x8143('0x1d')](0xcc)[_0x8143('0x1e')]();});}};}function handleEntityNotFound(_0x5e6313,_0x1cd5f2){return function(_0x58fc0b){if(!_0x58fc0b){_0x5e6313[_0x8143('0x1c')](0x194);}return _0x58fc0b;};}function handleError(_0x321a44,_0x5db283){_0x5db283=_0x5db283||0x1f4;return function(_0x46a4e2){logger['error'](_0x46a4e2['stack']);if(_0x46a4e2[_0x8143('0x2a')]){delete _0x46a4e2[_0x8143('0x2a')];}_0x321a44[_0x8143('0x1d')](_0x5db283)[_0x8143('0x2b')](_0x46a4e2);};}exports[_0x8143('0x2c')]=function(_0x338f50,_0x34e50f){var _0x4164bd={},_0xcd5609={},_0x14a876={'count':0x0,'rows':[]};var _0x55bd0e=_['map'](db[_0x8143('0x2d')][_0x8143('0x2e')],function(_0x120407){return{'name':_0x120407[_0x8143('0x2f')],'type':_0x120407['type']['key']};});_0xcd5609['model']=_['map'](_0x55bd0e,_0x8143('0x2a'));_0xcd5609['query']=_[_0x8143('0x30')](_0x338f50[_0x8143('0x31')]);_0xcd5609[_0x8143('0x32')]=_['intersection'](_0xcd5609[_0x8143('0x33')],_0xcd5609[_0x8143('0x31')]);_0x4164bd[_0x8143('0x34')]=_[_0x8143('0x35')](_0xcd5609[_0x8143('0x33')],qs[_0x8143('0x36')](_0x338f50[_0x8143('0x31')]['fields']));_0x4164bd['attributes']=_0x4164bd[_0x8143('0x34')][_0x8143('0x37')]?_0x4164bd['attributes']:_0xcd5609['model'];if(!_0x338f50[_0x8143('0x31')][_0x8143('0x38')](_0x8143('0x39'))){_0x4164bd[_0x8143('0x21')]=qs[_0x8143('0x21')](_0x338f50['query']['limit']);_0x4164bd['offset']=qs[_0x8143('0x23')](_0x338f50[_0x8143('0x31')]['offset']);}_0x4164bd[_0x8143('0x3a')]=qs[_0x8143('0x3b')](_0x338f50[_0x8143('0x31')]['sort']);_0x4164bd[_0x8143('0x3c')]=qs[_0x8143('0x32')](_[_0x8143('0x3d')](_0x338f50[_0x8143('0x31')],_0xcd5609[_0x8143('0x32')]),_0x55bd0e);if(_0x338f50[_0x8143('0x31')][_0x8143('0x3e')]){_0x4164bd['where']=_[_0x8143('0x3f')](_0x4164bd[_0x8143('0x3c')],{'$or':_['map'](_0x55bd0e,function(_0x489590){if(_0x489590[_0x8143('0x40')]!==_0x8143('0x41')){var _0x5c9551={};_0x5c9551[_0x489590[_0x8143('0x2a')]]={'$like':'%'+_0x338f50[_0x8143('0x31')][_0x8143('0x3e')]+'%'};return _0x5c9551;}})});}_0x4164bd=_[_0x8143('0x3f')]({},_0x4164bd,_0x338f50['options']);var _0x462f39={'where':_0x4164bd[_0x8143('0x3c')]};return db['VtigerField'][_0x8143('0x22')](_0x462f39)[_0x8143('0x28')](function(_0x54d10e){_0x14a876[_0x8143('0x22')]=_0x54d10e;if(_0x338f50[_0x8143('0x31')][_0x8143('0x42')]){_0x4164bd['include']=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x4164bd);})['then'](function(_0x5539cb){_0x14a876[_0x8143('0x43')]=_0x5539cb;return _0x14a876;})[_0x8143('0x28')](respondWithFilteredResult(_0x34e50f,_0x4164bd))[_0x8143('0x44')](handleError(_0x34e50f,null));};exports[_0x8143('0x45')]=function(_0x24d717,_0x67f29a){var _0x1d77b5={'raw':!![],'where':{'id':_0x24d717[_0x8143('0x46')]['id']}},_0x2c6e8e={};_0x2c6e8e['model']=_['keys'](db[_0x8143('0x2d')][_0x8143('0x2e')]);_0x2c6e8e['query']=_[_0x8143('0x30')](_0x24d717[_0x8143('0x31')]);_0x2c6e8e[_0x8143('0x32')]=_['intersection'](_0x2c6e8e[_0x8143('0x33')],_0x2c6e8e['query']);_0x1d77b5[_0x8143('0x34')]=_[_0x8143('0x35')](_0x2c6e8e[_0x8143('0x33')],qs['fields'](_0x24d717[_0x8143('0x31')][_0x8143('0x36')]));_0x1d77b5[_0x8143('0x34')]=_0x1d77b5[_0x8143('0x34')][_0x8143('0x37')]?_0x1d77b5[_0x8143('0x34')]:_0x2c6e8e[_0x8143('0x33')];if(_0x24d717[_0x8143('0x31')]['includeAll']){_0x1d77b5[_0x8143('0x47')]=[{'all':!![]}];}_0x1d77b5=_['merge']({},_0x1d77b5,_0x24d717[_0x8143('0x48')]);return db[_0x8143('0x2d')][_0x8143('0x49')](_0x1d77b5)['then'](handleEntityNotFound(_0x67f29a,null))[_0x8143('0x28')](respondWithResult(_0x67f29a,null))[_0x8143('0x44')](handleError(_0x67f29a,null));};exports[_0x8143('0x4a')]=function(_0x37c50a,_0x169428){return db[_0x8143('0x2d')][_0x8143('0x4a')](_0x37c50a['body'],{})['then'](respondWithResult(_0x169428,0xc9))[_0x8143('0x44')](handleError(_0x169428,null));};exports[_0x8143('0x27')]=function(_0xcd2ff8,_0x2d2f81){if(_0xcd2ff8[_0x8143('0x4b')]['id']){delete _0xcd2ff8['body']['id'];}return db[_0x8143('0x2d')][_0x8143('0x49')]({'where':{'id':_0xcd2ff8[_0x8143('0x46')]['id']}})[_0x8143('0x28')](handleEntityNotFound(_0x2d2f81,null))[_0x8143('0x28')](saveUpdates(_0xcd2ff8[_0x8143('0x4b')],null))[_0x8143('0x28')](respondWithResult(_0x2d2f81,null))[_0x8143('0x44')](handleError(_0x2d2f81,null));};exports[_0x8143('0x29')]=function(_0x259ca7,_0x55805f){return db[_0x8143('0x2d')][_0x8143('0x49')]({'where':{'id':_0x259ca7[_0x8143('0x46')]['id']}})[_0x8143('0x28')](handleEntityNotFound(_0x55805f,null))[_0x8143('0x28')](removeEntity(_0x55805f,null))['catch'](handleError(_0x55805f,null));}; \ No newline at end of file +var _0x3bd9=['ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x523c66,_0x1450f2){var _0x9c2343=function(_0x382eaf){while(--_0x382eaf){_0x523c66['push'](_0x523c66['shift']());}};_0x9c2343(++_0x1450f2);}(_0x3bd9,0x126));var _0x93bd=function(_0x4cefd6,_0x22027e){_0x4cefd6=_0x4cefd6-0x0;var _0x37a303=_0x3bd9[_0x4cefd6];return _0x37a303;};'use strict';var emlformat=require(_0x93bd('0x0'));var rimraf=require(_0x93bd('0x1'));var zipdir=require(_0x93bd('0x2'));var jsonpatch=require(_0x93bd('0x3'));var rp=require('request-promise');var moment=require(_0x93bd('0x4'));var BPromise=require(_0x93bd('0x5'));var Mustache=require(_0x93bd('0x6'));var util=require(_0x93bd('0x7'));var path=require('path');var sox=require(_0x93bd('0x8'));var csv=require(_0x93bd('0x9'));var ejs=require(_0x93bd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x93bd('0xb'));var crypto=require(_0x93bd('0xc'));var jsforce=require(_0x93bd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x93bd('0x9'));var querystring=require(_0x93bd('0xe'));var Papa=require('papaparse');var Redis=require(_0x93bd('0xf'));var authService=require(_0x93bd('0x10'));var qs=require(_0x93bd('0x11'));var as=require(_0x93bd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x93bd('0x13'))(_0x93bd('0x14'));var utils=require(_0x93bd('0x15'));var config=require(_0x93bd('0x16'));var licenseUtil=require(_0x93bd('0x17'));var db=require(_0x93bd('0x18'))['db'];function respondWithStatusCode(_0x5edb11,_0x596a6e){_0x596a6e=_0x596a6e||0xcc;return function(_0x419e1f){if(_0x419e1f){return _0x5edb11[_0x93bd('0x19')](_0x596a6e);}return _0x5edb11[_0x93bd('0x1a')](_0x596a6e)[_0x93bd('0x1b')]();};}function respondWithResult(_0x401bb4,_0x587db8){_0x587db8=_0x587db8||0xc8;return function(_0xdc1480){if(_0xdc1480){return _0x401bb4[_0x93bd('0x1a')](_0x587db8)['json'](_0xdc1480);}};}function respondWithFilteredResult(_0x637a87,_0x2ba275){return function(_0x48c141){if(_0x48c141){var _0x1704d1=typeof _0x2ba275['offset']===_0x93bd('0x1c')&&typeof _0x2ba275[_0x93bd('0x1d')]===_0x93bd('0x1c');var _0x28ac8b=_0x48c141[_0x93bd('0x1e')];var _0x524cea=_0x1704d1?0x0:_0x2ba275[_0x93bd('0x1f')];var _0x3286cb=_0x1704d1?_0x48c141[_0x93bd('0x1e')]:_0x2ba275['offset']+_0x2ba275['limit'];var _0x4be382;if(_0x3286cb>=_0x28ac8b){_0x3286cb=_0x28ac8b;_0x4be382=0xc8;}else{_0x4be382=0xce;}_0x637a87[_0x93bd('0x1a')](_0x4be382);return _0x637a87[_0x93bd('0x20')](_0x93bd('0x21'),_0x524cea+'-'+_0x3286cb+'/'+_0x28ac8b)[_0x93bd('0x22')](_0x48c141);}return null;};}function patchUpdates(_0x4baf1e){return function(_0x58bde5){try{jsonpatch[_0x93bd('0x23')](_0x58bde5,_0x4baf1e,!![]);}catch(_0x5b6200){return BPromise[_0x93bd('0x24')](_0x5b6200);}return _0x58bde5[_0x93bd('0x25')]();};}function saveUpdates(_0x55c412,_0x34793d){return function(_0x59a99e){if(_0x59a99e){return _0x59a99e[_0x93bd('0x26')](_0x55c412)[_0x93bd('0x27')](function(_0x2ac5a3){return _0x2ac5a3;});}return null;};}function removeEntity(_0x26182f,_0x444df8){return function(_0x3be667){if(_0x3be667){return _0x3be667[_0x93bd('0x28')]()[_0x93bd('0x27')](function(){_0x26182f[_0x93bd('0x1a')](0xcc)[_0x93bd('0x1b')]();});}};}function handleEntityNotFound(_0x23282c,_0x5991a3){return function(_0x481794){if(!_0x481794){_0x23282c[_0x93bd('0x19')](0x194);}return _0x481794;};}function handleError(_0x13bf9f,_0x4f34f1){_0x4f34f1=_0x4f34f1||0x1f4;return function(_0x2b29da){logger[_0x93bd('0x29')](_0x2b29da[_0x93bd('0x2a')]);if(_0x2b29da[_0x93bd('0x2b')]){delete _0x2b29da['name'];}_0x13bf9f[_0x93bd('0x1a')](_0x4f34f1)[_0x93bd('0x2c')](_0x2b29da);};}exports['index']=function(_0x3301e6,_0x482d9f){var _0x16b3a2={},_0x5b8784={},_0x6b1f35={'count':0x0,'rows':[]};var _0x243ad2=_[_0x93bd('0x2d')](db[_0x93bd('0x2e')][_0x93bd('0x2f')],function(_0x50d608){return{'name':_0x50d608[_0x93bd('0x30')],'type':_0x50d608['type']['key']};});_0x5b8784[_0x93bd('0x31')]=_[_0x93bd('0x2d')](_0x243ad2,_0x93bd('0x2b'));_0x5b8784[_0x93bd('0x32')]=_[_0x93bd('0x33')](_0x3301e6[_0x93bd('0x32')]);_0x5b8784[_0x93bd('0x34')]=_[_0x93bd('0x35')](_0x5b8784[_0x93bd('0x31')],_0x5b8784[_0x93bd('0x32')]);_0x16b3a2[_0x93bd('0x36')]=_[_0x93bd('0x35')](_0x5b8784['model'],qs[_0x93bd('0x37')](_0x3301e6[_0x93bd('0x32')][_0x93bd('0x37')]));_0x16b3a2[_0x93bd('0x36')]=_0x16b3a2[_0x93bd('0x36')]['length']?_0x16b3a2[_0x93bd('0x36')]:_0x5b8784[_0x93bd('0x31')];if(!_0x3301e6[_0x93bd('0x32')][_0x93bd('0x38')](_0x93bd('0x39'))){_0x16b3a2[_0x93bd('0x1d')]=qs[_0x93bd('0x1d')](_0x3301e6['query'][_0x93bd('0x1d')]);_0x16b3a2[_0x93bd('0x1f')]=qs[_0x93bd('0x1f')](_0x3301e6[_0x93bd('0x32')][_0x93bd('0x1f')]);}_0x16b3a2[_0x93bd('0x3a')]=qs[_0x93bd('0x3b')](_0x3301e6[_0x93bd('0x32')][_0x93bd('0x3b')]);_0x16b3a2[_0x93bd('0x3c')]=qs[_0x93bd('0x34')](_[_0x93bd('0x3d')](_0x3301e6[_0x93bd('0x32')],_0x5b8784['filters']),_0x243ad2);if(_0x3301e6[_0x93bd('0x32')][_0x93bd('0x3e')]){_0x16b3a2[_0x93bd('0x3c')]=_['merge'](_0x16b3a2[_0x93bd('0x3c')],{'$or':_[_0x93bd('0x2d')](_0x243ad2,function(_0x4151b0){if(_0x4151b0[_0x93bd('0x3f')]!==_0x93bd('0x40')){var _0x262298={};_0x262298[_0x4151b0['name']]={'$like':'%'+_0x3301e6['query'][_0x93bd('0x3e')]+'%'};return _0x262298;}})});}_0x16b3a2=_[_0x93bd('0x41')]({},_0x16b3a2,_0x3301e6[_0x93bd('0x42')]);var _0x2c230f={'where':_0x16b3a2[_0x93bd('0x3c')]};return db[_0x93bd('0x2e')][_0x93bd('0x1e')](_0x2c230f)['then'](function(_0x4e810e){_0x6b1f35[_0x93bd('0x1e')]=_0x4e810e;if(_0x3301e6['query'][_0x93bd('0x43')]){_0x16b3a2['include']=[{'all':!![]}];}return db[_0x93bd('0x2e')][_0x93bd('0x44')](_0x16b3a2);})[_0x93bd('0x27')](function(_0x438cec){_0x6b1f35['rows']=_0x438cec;return _0x6b1f35;})[_0x93bd('0x27')](respondWithFilteredResult(_0x482d9f,_0x16b3a2))[_0x93bd('0x45')](handleError(_0x482d9f,null));};exports[_0x93bd('0x46')]=function(_0x3fa641,_0x5cfbc0){var _0x5023a2={'raw':!![],'where':{'id':_0x3fa641[_0x93bd('0x47')]['id']}},_0x3f1fca={};_0x3f1fca[_0x93bd('0x31')]=_[_0x93bd('0x33')](db[_0x93bd('0x2e')]['rawAttributes']);_0x3f1fca[_0x93bd('0x32')]=_['keys'](_0x3fa641['query']);_0x3f1fca[_0x93bd('0x34')]=_[_0x93bd('0x35')](_0x3f1fca[_0x93bd('0x31')],_0x3f1fca[_0x93bd('0x32')]);_0x5023a2['attributes']=_[_0x93bd('0x35')](_0x3f1fca['model'],qs[_0x93bd('0x37')](_0x3fa641[_0x93bd('0x32')][_0x93bd('0x37')]));_0x5023a2['attributes']=_0x5023a2[_0x93bd('0x36')]['length']?_0x5023a2[_0x93bd('0x36')]:_0x3f1fca[_0x93bd('0x31')];if(_0x3fa641[_0x93bd('0x32')][_0x93bd('0x43')]){_0x5023a2[_0x93bd('0x48')]=[{'all':!![]}];}_0x5023a2=_[_0x93bd('0x41')]({},_0x5023a2,_0x3fa641[_0x93bd('0x42')]);return db[_0x93bd('0x2e')][_0x93bd('0x49')](_0x5023a2)[_0x93bd('0x27')](handleEntityNotFound(_0x5cfbc0,null))[_0x93bd('0x27')](respondWithResult(_0x5cfbc0,null))[_0x93bd('0x45')](handleError(_0x5cfbc0,null));};exports['create']=function(_0x3325bb,_0x52d71b){return db[_0x93bd('0x2e')][_0x93bd('0x4a')](_0x3325bb[_0x93bd('0x4b')],{})['then'](respondWithResult(_0x52d71b,0xc9))['catch'](handleError(_0x52d71b,null));};exports[_0x93bd('0x26')]=function(_0x368fa6,_0x3fac9f){if(_0x368fa6['body']['id']){delete _0x368fa6[_0x93bd('0x4b')]['id'];}return db[_0x93bd('0x2e')]['find']({'where':{'id':_0x368fa6['params']['id']}})[_0x93bd('0x27')](handleEntityNotFound(_0x3fac9f,null))[_0x93bd('0x27')](saveUpdates(_0x368fa6[_0x93bd('0x4b')],null))[_0x93bd('0x27')](respondWithResult(_0x3fac9f,null))[_0x93bd('0x45')](handleError(_0x3fac9f,null));};exports[_0x93bd('0x28')]=function(_0x1e93c5,_0x5f5931){return db[_0x93bd('0x2e')][_0x93bd('0x49')]({'where':{'id':_0x1e93c5[_0x93bd('0x47')]['id']}})[_0x93bd('0x27')](handleEntityNotFound(_0x5f5931,null))[_0x93bd('0x27')](removeEntity(_0x5f5931,null))['catch'](handleError(_0x5f5931,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index d791fe3..af7b640 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 _0xe86e=['../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xa270f3,_0x293fd){var _0x48767f=function(_0x2db048){while(--_0x2db048){_0xa270f3['push'](_0xa270f3['shift']());}};_0x48767f(++_0x293fd);}(_0xe86e,0x1f0));var _0xee86=function(_0x840106,_0x59c538){_0x840106=_0x840106-0x0;var _0x41edcd=_0xe86e[_0x840106];return _0x41edcd;};'use strict';var _=require('lodash');var util=require(_0xee86('0x0'));var logger=require(_0xee86('0x1'))(_0xee86('0x2'));var moment=require(_0xee86('0x3'));var BPromise=require(_0xee86('0x4'));var rp=require(_0xee86('0x5'));var fs=require('fs');var path=require(_0xee86('0x6'));var rimraf=require(_0xee86('0x7'));var config=require(_0xee86('0x8'));var attributes=require(_0xee86('0x9'));module['exports']=function(_0x981edf,_0x24e9d8){return _0x981edf[_0xee86('0xa')](_0xee86('0xb'),attributes,{'tableName':_0xee86('0xc'),'paranoid':![],'indexes':[{'name':_0xee86('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabc9=['util','moment','bluebird','path','rimraf','../../config/environment','exports','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash'];(function(_0x24f259,_0x1b1935){var _0x3e73db=function(_0x4d8ea6){while(--_0x4d8ea6){_0x24f259['push'](_0x24f259['shift']());}};_0x3e73db(++_0x1b1935);}(_0xabc9,0x103));var _0x9abc=function(_0x4f6ae5,_0x230911){_0x4f6ae5=_0x4f6ae5-0x0;var _0x3be10b=_0xabc9[_0x4f6ae5];return _0x3be10b;};'use strict';var _=require(_0x9abc('0x0'));var util=require(_0x9abc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9abc('0x2'));var BPromise=require(_0x9abc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9abc('0x4'));var rimraf=require(_0x9abc('0x5'));var config=require(_0x9abc('0x6'));var attributes=require('./intVtigerField.attributes');module[_0x9abc('0x7')]=function(_0x53b073,_0x2c5123){return _0x53b073[_0x9abc('0x8')](_0x9abc('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x9abc('0xa'),'fields':[_0x9abc('0xb'),_0x9abc('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 53772e4..0415700 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 _0xd25b=['request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','jayson/promise','client','http'];(function(_0x38a54d,_0x132fde){var _0x2d1b0e=function(_0x11cac8){while(--_0x11cac8){_0x38a54d['push'](_0x38a54d['shift']());}};_0x2d1b0e(++_0x132fde);}(_0xd25b,0xef));var _0xbd25=function(_0xcd9bd1,_0x47074d){_0xcd9bd1=_0xcd9bd1-0x0;var _0x2cb496=_0xd25b[_0xcd9bd1];return _0x2cb496;};'use strict';var _=require(_0xbd25('0x0'));var util=require('util');var moment=require(_0xbd25('0x1'));var BPromise=require(_0xbd25('0x2'));var rs=require(_0xbd25('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd25('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbd25('0x5'));var client=jayson[_0xbd25('0x6')][_0xbd25('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45a601,_0x46a1a2,_0x416902){return new BPromise(function(_0x486949,_0xb19a33){return client[_0xbd25('0x8')](_0x45a601,_0x416902)[_0xbd25('0x9')](function(_0x24e285){logger[_0xbd25('0xa')](_0xbd25('0xb'),_0x46a1a2,_0xbd25('0xc'));logger['debug'](_0xbd25('0xd'),_0x46a1a2,'request\x20sent',JSON[_0xbd25('0xe')](_0x24e285));if(_0x24e285[_0xbd25('0xf')]){if(_0x24e285[_0xbd25('0xf')]['code']===0x1f4){logger[_0xbd25('0xf')](_0xbd25('0xb'),_0x46a1a2,_0x24e285[_0xbd25('0xf')][_0xbd25('0x10')]);return _0xb19a33(_0x24e285[_0xbd25('0xf')][_0xbd25('0x10')]);}logger[_0xbd25('0xf')](_0xbd25('0xb'),_0x46a1a2,_0x24e285['error']['message']);return _0x486949(_0x24e285[_0xbd25('0xf')][_0xbd25('0x10')]);}else{logger['info'](_0xbd25('0xb'),_0x46a1a2,'request\x20sent');_0x486949(_0x24e285[_0xbd25('0x11')][_0xbd25('0x10')]);}})[_0xbd25('0x12')](function(_0x55d7ca){logger[_0xbd25('0xf')]('VtigerField,\x20%s,\x20%s',_0x46a1a2,_0x55d7ca);_0xb19a33(_0x55d7ca);});});} \ No newline at end of file +var _0xffc4=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1a9f25,_0x2dd7f3){var _0x534bad=function(_0x18011e){while(--_0x18011e){_0x1a9f25['push'](_0x1a9f25['shift']());}};_0x534bad(++_0x2dd7f3);}(_0xffc4,0xeb));var _0x4ffc=function(_0x17c1e9,_0x1c5e8a){_0x17c1e9=_0x17c1e9-0x0;var _0x26f699=_0xffc4[_0x17c1e9];return _0x26f699;};'use strict';var _=require(_0x4ffc('0x0'));var util=require(_0x4ffc('0x1'));var moment=require(_0x4ffc('0x2'));var BPromise=require(_0x4ffc('0x3'));var rs=require(_0x4ffc('0x4'));var fs=require('fs');var Redis=require(_0x4ffc('0x5'));var db=require(_0x4ffc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ffc('0x7'))(_0x4ffc('0x8'));var config=require(_0x4ffc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4ffc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ec786,_0x236213,_0x532d97){return new BPromise(function(_0x261c3b,_0x329ec8){return client[_0x4ffc('0xb')](_0x2ec786,_0x532d97)[_0x4ffc('0xc')](function(_0x4d9329){logger['info'](_0x4ffc('0xd'),_0x236213,'request\x20sent');logger[_0x4ffc('0xe')](_0x4ffc('0xf'),_0x236213,_0x4ffc('0x10'),JSON[_0x4ffc('0x11')](_0x4d9329));if(_0x4d9329[_0x4ffc('0x12')]){if(_0x4d9329[_0x4ffc('0x12')][_0x4ffc('0x13')]===0x1f4){logger[_0x4ffc('0x12')](_0x4ffc('0xd'),_0x236213,_0x4d9329[_0x4ffc('0x12')]['message']);return _0x329ec8(_0x4d9329[_0x4ffc('0x12')][_0x4ffc('0x14')]);}logger[_0x4ffc('0x12')]('VtigerField,\x20%s,\x20%s',_0x236213,_0x4d9329[_0x4ffc('0x12')][_0x4ffc('0x14')]);return _0x261c3b(_0x4d9329[_0x4ffc('0x12')][_0x4ffc('0x14')]);}else{logger[_0x4ffc('0x15')](_0x4ffc('0xd'),_0x236213,'request\x20sent');_0x261c3b(_0x4d9329[_0x4ffc('0x16')][_0x4ffc('0x14')]);}})[_0x4ffc('0x17')](function(_0x123cb2){logger[_0x4ffc('0x12')]('VtigerField,\x20%s,\x20%s',_0x236213,_0x123cb2);_0x329ec8(_0x123cb2);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 00513d2..43fa4e9 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 _0x2281=['express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','delete','exports','util'];(function(_0x30e3e7,_0x2b95a6){var _0x2466ad=function(_0x43dfe5){while(--_0x43dfe5){_0x30e3e7['push'](_0x30e3e7['shift']());}};_0x2466ad(++_0x2b95a6);}(_0x2281,0xef));var _0x1228=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2281[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x1228('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1228('0x1'));var router=express['Router']();var fs_extra=require(_0x1228('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1228('0x3'));var config=require(_0x1228('0x4'));var controller=require(_0x1228('0x5'));router['get']('/',auth[_0x1228('0x6')](),controller[_0x1228('0x7')]);router[_0x1228('0x8')](_0x1228('0x9'),auth[_0x1228('0x6')](),controller[_0x1228('0xa')]);router['get']('/:id/configurations',auth[_0x1228('0x6')](),controller[_0x1228('0xb')]);router[_0x1228('0x8')](_0x1228('0xc'),auth[_0x1228('0x6')](),controller['getFields']);router[_0x1228('0xd')]('/',auth[_0x1228('0x6')](),controller[_0x1228('0xe')]);router[_0x1228('0xd')](_0x1228('0xf'),auth[_0x1228('0x6')](),controller[_0x1228('0x10')]);router[_0x1228('0x11')](_0x1228('0x9'),auth[_0x1228('0x6')](),controller['update']);router[_0x1228('0x12')](_0x1228('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x1228('0x13')]=router; \ No newline at end of file +var _0xa29a=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','show'];(function(_0x145782,_0x44a126){var _0x23ce0d=function(_0x428fee){while(--_0x428fee){_0x145782['push'](_0x145782['shift']());}};_0x23ce0d(++_0x44a126);}(_0xa29a,0x1ee));var _0xaa29=function(_0x5af775,_0x5aa70c){_0x5af775=_0x5af775-0x0;var _0x57bd0b=_0xa29a[_0x5af775];return _0x57bd0b;};'use strict';var multer=require(_0xaa29('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa29('0x1'));var express=require(_0xaa29('0x2'));var router=express[_0xaa29('0x3')]();var fs_extra=require(_0xaa29('0x4'));var auth=require(_0xaa29('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaa29('0x6'));router[_0xaa29('0x7')]('/',auth['isAuthenticated'](),controller[_0xaa29('0x8')]);router[_0xaa29('0x7')](_0xaa29('0x9'),auth[_0xaa29('0xa')](),controller[_0xaa29('0xb')]);router[_0xaa29('0x7')](_0xaa29('0xc'),auth[_0xaa29('0xa')](),controller[_0xaa29('0xd')]);router['get'](_0xaa29('0xe'),auth[_0xaa29('0xa')](),controller[_0xaa29('0xf')]);router['post']('/',auth[_0xaa29('0xa')](),controller[_0xaa29('0x10')]);router[_0xaa29('0x11')](_0xaa29('0xc'),auth['isAuthenticated'](),controller[_0xaa29('0x12')]);router['put']('/:id',auth[_0xaa29('0xa')](),controller['update']);router[_0xaa29('0x13')](_0xaa29('0x9'),auth[_0xaa29('0xa')](),controller[_0xaa29('0x14')]);module[_0xaa29('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index b237a10..4811cb1 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 _0xe944=['password','token','integrationTab','newTab','sequelize','STRING','remoteUri','ENUM'];(function(_0x5b5eb4,_0x41882f){var _0x421b47=function(_0x33f72f){while(--_0x33f72f){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x421b47(++_0x41882f);}(_0xe944,0x174));var _0x4e94=function(_0x3f6782,_0x1bf650){_0x3f6782=_0x3f6782-0x0;var _0x5f32a2=_0xe944[_0x3f6782];return _0x5f32a2;};'use strict';var Sequelize=require(_0x4e94('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4e94('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x4e94('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4e94('0x2')},'authType':{'type':Sequelize[_0x4e94('0x3')](_0x4e94('0x4'),_0x4e94('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x4e94('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4e94('0x3')](_0x4e94('0x6'),_0x4e94('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x687b=['remoteUri','ENUM','password','token','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x351478,_0x2494c7){var _0x30e075=function(_0x4faa53){while(--_0x4faa53){_0x351478['push'](_0x351478['shift']());}};_0x30e075(++_0x2494c7);}(_0x687b,0x14a));var _0xb687=function(_0x4dbc5d,_0x2d0a51){_0x4dbc5d=_0x4dbc5d-0x0;var _0x45b461=_0x687b[_0x4dbc5d];return _0x45b461;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')]},'description':{'type':Sequelize[_0xb687('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xb687('0x2')]},'token':{'type':Sequelize[_0xb687('0x2')]},'remoteUri':{'type':Sequelize[_0xb687('0x2')],'unique':_0xb687('0x3')},'authType':{'type':Sequelize[_0xb687('0x4')](_0xb687('0x5'),_0xb687('0x6')),'defaultValue':_0xb687('0x5')},'serverUrl':{'type':Sequelize[_0xb687('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb687('0x4')]('integrationTab',_0xb687('0x7')),'defaultValue':_0xb687('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index b8c0c0e..e343dd7 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 _0x36ee=['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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','index','map','ZendeskAccount','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','pick','options','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','token','remoteUri','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','includes','position','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','zip-dir','request-promise','moment','bluebird'];(function(_0xbe38bd,_0x881cd3){var _0x2c53d4=function(_0x1375ec){while(--_0x1375ec){_0xbe38bd['push'](_0xbe38bd['shift']());}};_0x2c53d4(++_0x881cd3);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x32981d,_0x27841e){_0x27841e=_0x27841e||0xcc;return function(_0x23abfb){if(_0x23abfb){return _0x32981d[_0xe36e('0x19')](_0x27841e);}return _0x32981d['status'](_0x27841e)[_0xe36e('0x1a')]();};}function respondWithResult(_0x521afa,_0x525155){_0x525155=_0x525155||0xc8;return function(_0x27ff47){if(_0x27ff47){return _0x521afa[_0xe36e('0x1b')](_0x525155)[_0xe36e('0x1c')](_0x27ff47);}};}function respondWithFilteredResult(_0x278135,_0xd6828e){return function(_0x924cd5){if(_0x924cd5){var _0x2096f6=typeof _0xd6828e[_0xe36e('0x1d')]===_0xe36e('0x1e')&&typeof _0xd6828e[_0xe36e('0x1f')]==='undefined';var _0x333554=_0x924cd5[_0xe36e('0x20')];var _0x56c019=_0x2096f6?0x0:_0xd6828e[_0xe36e('0x1d')];var _0x533c06=_0x2096f6?_0x924cd5[_0xe36e('0x20')]:_0xd6828e[_0xe36e('0x1d')]+_0xd6828e['limit'];var _0x472825;if(_0x533c06>=_0x333554){_0x533c06=_0x333554;_0x472825=0xc8;}else{_0x472825=0xce;}_0x278135[_0xe36e('0x1b')](_0x472825);return _0x278135[_0xe36e('0x21')]('Content-Range',_0x56c019+'-'+_0x533c06+'/'+_0x333554)[_0xe36e('0x1c')](_0x924cd5);}return null;};}function patchUpdates(_0x21bcf9){return function(_0x3f0ae3){try{jsonpatch[_0xe36e('0x22')](_0x3f0ae3,_0x21bcf9,!![]);}catch(_0x2c4e30){return BPromise[_0xe36e('0x23')](_0x2c4e30);}return _0x3f0ae3['save']();};}function saveUpdates(_0xd71137,_0x4f214a){return function(_0x23bcf3){if(_0x23bcf3){return _0x23bcf3[_0xe36e('0x24')](_0xd71137)[_0xe36e('0x25')](function(_0x53e13a){return _0x53e13a;});}return null;};}function removeEntity(_0x598a7a,_0x4749a8){return function(_0x10818d){if(_0x10818d){return _0x10818d[_0xe36e('0x26')]()[_0xe36e('0x25')](function(){_0x598a7a[_0xe36e('0x1b')](0xcc)[_0xe36e('0x1a')]();});}};}function handleEntityNotFound(_0x1a045c,_0x5ac484){return function(_0x3cafbf){if(!_0x3cafbf){_0x1a045c[_0xe36e('0x19')](0x194);}return _0x3cafbf;};}function handleError(_0x10597f,_0x262caa){_0x262caa=_0x262caa||0x1f4;return function(_0x5e58d8){logger[_0xe36e('0x27')](_0x5e58d8['stack']);if(_0x5e58d8[_0xe36e('0x28')]){delete _0x5e58d8['name'];}_0x10597f[_0xe36e('0x1b')](_0x262caa)['send'](_0x5e58d8);};}exports[_0xe36e('0x29')]=function(_0x4c5d98,_0x3b1045){var _0x59548b={},_0x4bb75b={},_0x5d8fd8={'count':0x0,'rows':[]};var _0x5b5d53=_[_0xe36e('0x2a')](db[_0xe36e('0x2b')]['rawAttributes'],function(_0x4ac819){return{'name':_0x4ac819[_0xe36e('0x2c')],'type':_0x4ac819[_0xe36e('0x2d')][_0xe36e('0x2e')]};});_0x4bb75b[_0xe36e('0x2f')]=_[_0xe36e('0x2a')](_0x5b5d53,_0xe36e('0x28'));_0x4bb75b['query']=_[_0xe36e('0x30')](_0x4c5d98[_0xe36e('0x31')]);_0x4bb75b['filters']=_[_0xe36e('0x32')](_0x4bb75b[_0xe36e('0x2f')],_0x4bb75b[_0xe36e('0x31')]);_0x59548b[_0xe36e('0x33')]=_[_0xe36e('0x32')](_0x4bb75b[_0xe36e('0x2f')],qs[_0xe36e('0x34')](_0x4c5d98[_0xe36e('0x31')][_0xe36e('0x34')]));_0x59548b[_0xe36e('0x33')]=_0x59548b[_0xe36e('0x33')]['length']?_0x59548b[_0xe36e('0x33')]:_0x4bb75b['model'];if(!_0x4c5d98['query'][_0xe36e('0x35')]('nolimit')){_0x59548b[_0xe36e('0x1f')]=qs[_0xe36e('0x1f')](_0x4c5d98[_0xe36e('0x31')][_0xe36e('0x1f')]);_0x59548b['offset']=qs['offset'](_0x4c5d98[_0xe36e('0x31')][_0xe36e('0x1d')]);}_0x59548b[_0xe36e('0x36')]=qs[_0xe36e('0x37')](_0x4c5d98['query'][_0xe36e('0x37')]);_0x59548b[_0xe36e('0x38')]=qs[_0xe36e('0x39')](_['pick'](_0x4c5d98[_0xe36e('0x31')],_0x4bb75b[_0xe36e('0x39')]),_0x5b5d53);if(_0x4c5d98['query'][_0xe36e('0x3a')]){_0x59548b[_0xe36e('0x38')]=_[_0xe36e('0x3b')](_0x59548b[_0xe36e('0x38')],{'$or':_[_0xe36e('0x2a')](_0x5b5d53,function(_0x2fc909){if(_0x2fc909[_0xe36e('0x2d')]!==_0xe36e('0x3c')){var _0x458a4e={};_0x458a4e[_0x2fc909[_0xe36e('0x28')]]={'$like':'%'+_0x4c5d98[_0xe36e('0x31')][_0xe36e('0x3a')]+'%'};return _0x458a4e;}})});}_0x59548b=_[_0xe36e('0x3b')]({},_0x59548b,_0x4c5d98['options']);var _0x23d36e={'where':_0x59548b[_0xe36e('0x38')]};return db[_0xe36e('0x2b')][_0xe36e('0x20')](_0x23d36e)[_0xe36e('0x25')](function(_0x4d133b){_0x5d8fd8['count']=_0x4d133b;if(_0x4c5d98[_0xe36e('0x31')][_0xe36e('0x3d')]){_0x59548b[_0xe36e('0x3e')]=[{'all':!![]}];}return db[_0xe36e('0x2b')][_0xe36e('0x3f')](_0x59548b);})[_0xe36e('0x25')](function(_0xff4f63){_0x5d8fd8[_0xe36e('0x40')]=_0xff4f63;return _0x5d8fd8;})['then'](respondWithFilteredResult(_0x3b1045,_0x59548b))[_0xe36e('0x41')](handleError(_0x3b1045,null));};exports[_0xe36e('0x42')]=function(_0x4788a0,_0x21dc35){var _0x5ef3e4={'raw':![],'where':{'id':_0x4788a0[_0xe36e('0x43')]['id']}},_0x23e344={};_0x23e344[_0xe36e('0x2f')]=_[_0xe36e('0x30')](db[_0xe36e('0x2b')]['rawAttributes']);_0x23e344[_0xe36e('0x31')]=_[_0xe36e('0x30')](_0x4788a0[_0xe36e('0x31')]);_0x23e344[_0xe36e('0x39')]=_[_0xe36e('0x32')](_0x23e344[_0xe36e('0x2f')],_0x23e344['query']);_0x5ef3e4[_0xe36e('0x33')]=_[_0xe36e('0x32')](_0x23e344[_0xe36e('0x2f')],qs[_0xe36e('0x34')](_0x4788a0[_0xe36e('0x31')]['fields']));_0x5ef3e4[_0xe36e('0x33')]=_0x5ef3e4[_0xe36e('0x33')][_0xe36e('0x44')]?_0x5ef3e4[_0xe36e('0x33')]:_0x23e344[_0xe36e('0x2f')];if(_0x4788a0[_0xe36e('0x31')][_0xe36e('0x3d')]){_0x5ef3e4[_0xe36e('0x3e')]=[{'all':!![]}];}_0x5ef3e4=_[_0xe36e('0x3b')]({},_0x5ef3e4,_0x4788a0['options']);return db['ZendeskAccount'][_0xe36e('0x45')](_0x5ef3e4)['then'](handleEntityNotFound(_0x21dc35,null))[_0xe36e('0x25')](respondWithResult(_0x21dc35,null))[_0xe36e('0x41')](handleError(_0x21dc35,null));};exports[_0xe36e('0x46')]=function(_0x25aa09,_0x51641c){return db[_0xe36e('0x2b')][_0xe36e('0x46')](_0x25aa09['body'],{})[_0xe36e('0x25')](respondWithResult(_0x51641c,0xc9))[_0xe36e('0x41')](handleError(_0x51641c,null));};exports[_0xe36e('0x24')]=function(_0x42eae5,_0x15895d){if(_0x42eae5[_0xe36e('0x47')]['id']){delete _0x42eae5[_0xe36e('0x47')]['id'];}return db[_0xe36e('0x2b')][_0xe36e('0x45')]({'where':{'id':_0x42eae5[_0xe36e('0x43')]['id']}})[_0xe36e('0x25')](handleEntityNotFound(_0x15895d,null))[_0xe36e('0x25')](saveUpdates(_0x42eae5[_0xe36e('0x47')],null))[_0xe36e('0x25')](respondWithResult(_0x15895d,null))[_0xe36e('0x41')](handleError(_0x15895d,null));};exports['destroy']=function(_0x3262bf,_0x55aadf){return db['ZendeskAccount'][_0xe36e('0x45')]({'where':{'id':_0x3262bf[_0xe36e('0x43')]['id']}})['then'](handleEntityNotFound(_0x55aadf,null))[_0xe36e('0x25')](removeEntity(_0x55aadf,null))[_0xe36e('0x41')](handleError(_0x55aadf,null));};exports[_0xe36e('0x48')]=function(_0x1f4a5d,_0xa4be24,_0x22788b){var _0x935e84={};var _0x41e10d={};var _0x4d5762;var _0x55d190;return db[_0xe36e('0x2b')][_0xe36e('0x49')]({'where':{'id':_0x1f4a5d['params']['id']}})[_0xe36e('0x25')](handleEntityNotFound(_0xa4be24,null))[_0xe36e('0x25')](function(_0x3e1040){if(_0x3e1040){_0x4d5762=_0x3e1040;_0x41e10d[_0xe36e('0x2f')]=_[_0xe36e('0x30')](db['ZendeskConfiguration']['rawAttributes']);_0x41e10d['query']=_['keys'](_0x1f4a5d[_0xe36e('0x31')]);_0x41e10d[_0xe36e('0x39')]=_[_0xe36e('0x32')](_0x41e10d[_0xe36e('0x2f')],_0x41e10d[_0xe36e('0x31')]);_0x935e84[_0xe36e('0x33')]=_[_0xe36e('0x32')](_0x41e10d[_0xe36e('0x2f')],qs[_0xe36e('0x34')](_0x1f4a5d['query'][_0xe36e('0x34')]));_0x935e84[_0xe36e('0x33')]=_0x935e84['attributes'][_0xe36e('0x44')]?_0x935e84[_0xe36e('0x33')]:_0x41e10d[_0xe36e('0x2f')];_0x935e84[_0xe36e('0x36')]=qs[_0xe36e('0x37')](_0x1f4a5d[_0xe36e('0x31')][_0xe36e('0x37')]);_0x935e84[_0xe36e('0x38')]=qs[_0xe36e('0x39')](_[_0xe36e('0x4a')](_0x1f4a5d[_0xe36e('0x31')],_0x41e10d[_0xe36e('0x39')]));if(_0x1f4a5d[_0xe36e('0x31')][_0xe36e('0x3a')]){_0x935e84[_0xe36e('0x38')]=_[_0xe36e('0x3b')](_0x935e84[_0xe36e('0x38')],{'$or':_[_0xe36e('0x2a')](_0x935e84[_0xe36e('0x33')],function(_0x3e7d8d){var _0x362204={};_0x362204[_0x3e7d8d]={'$like':'%'+_0x1f4a5d[_0xe36e('0x31')][_0xe36e('0x3a')]+'%'};return _0x362204;})});}_0x935e84=_[_0xe36e('0x3b')]({},_0x935e84,_0x1f4a5d[_0xe36e('0x4b')]);return _0x4d5762['getConfigurations'](_0x935e84);}})[_0xe36e('0x25')](function(_0xedaa96){if(_0xedaa96){_0x55d190=_0xedaa96['length'];if(!_0x1f4a5d[_0xe36e('0x31')][_0xe36e('0x35')](_0xe36e('0x4c'))){_0x935e84[_0xe36e('0x1f')]=qs[_0xe36e('0x1f')](_0x1f4a5d[_0xe36e('0x31')]['limit']);_0x935e84[_0xe36e('0x1d')]=qs['offset'](_0x1f4a5d[_0xe36e('0x31')][_0xe36e('0x1d')]);}return _0x4d5762[_0xe36e('0x48')](_0x935e84);}})[_0xe36e('0x25')](function(_0x2a767d){if(_0x2a767d){return _0x2a767d?{'count':_0x55d190,'rows':_0x2a767d}:null;}})[_0xe36e('0x25')](respondWithResult(_0xa4be24,null))[_0xe36e('0x41')](handleError(_0xa4be24,null));};exports[_0xe36e('0x4d')]=function(_0x4c8d2b,_0x34c7a5,_0xcafb87){if(_0x4c8d2b['body']['id']){delete _0x4c8d2b[_0xe36e('0x47')]['id'];}return db[_0xe36e('0x2b')][_0xe36e('0x49')]({'where':{'id':_0x4c8d2b[_0xe36e('0x43')]['id']}})[_0xe36e('0x25')](handleEntityNotFound(_0x34c7a5,null))[_0xe36e('0x25')](function(_0x3d4874){if(_0x3d4874){_0x4c8d2b['body'][_0xe36e('0x4e')]=_0x3d4874['id'];_0x4c8d2b[_0xe36e('0x47')][_0xe36e('0x4f')]=integrations[_0xe36e('0x50')](_0x4c8d2b[_0xe36e('0x47')][_0xe36e('0x51')],_0x4c8d2b[_0xe36e('0x47')][_0xe36e('0x2d')]);_0x4c8d2b[_0xe36e('0x47')][_0xe36e('0x52')]=integrations[_0xe36e('0x53')](_0x4c8d2b['body'][_0xe36e('0x51')],_0x4c8d2b[_0xe36e('0x47')][_0xe36e('0x2d')]);return db[_0xe36e('0x54')]['create'](_0x4c8d2b['body'],{'include':[{'model':db[_0xe36e('0x55')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xe36e('0x25')](respondWithResult(_0x34c7a5,null))['catch'](handleError(_0x34c7a5,null));};exports[_0xe36e('0x56')]=function(_0x2f7093,_0x258a63,_0x221a90){var _0x1bd60d='';return db[_0xe36e('0x2b')][_0xe36e('0x49')]({'where':{'id':_0x2f7093[_0xe36e('0x43')]['id']},'attributes':['id',_0xe36e('0x57'),'password',_0xe36e('0x58'),'authType',_0xe36e('0x59')]})['then'](handleEntityNotFound(_0x258a63,null))[_0xe36e('0x25')](function(_0x209e45){if(_0x209e45){_0x1bd60d=_0x209e45[_0xe36e('0x59')];var _0x29a372=_0x1bd60d['slice'](-0x1);if(_0x29a372==='/'){_0x1bd60d=_0x1bd60d['substring'](0x0,_0x1bd60d[_0xe36e('0x5a')](_0x29a372));}var _0x2b44a6={'method':_0xe36e('0x5b'),'uri':util[_0xe36e('0x5c')](_0xe36e('0x5d'),_0x1bd60d,_0xe36e('0x5e')),'json':!![]};switch(_0x209e45['authType']){case _0xe36e('0x5f'):_0x2b44a6[_0xe36e('0x60')]={'Authorization':util['format'](_0xe36e('0x61'),new Buffer(util['format'](_0xe36e('0x62'),_0x209e45[_0xe36e('0x57')],_0x209e45[_0xe36e('0x5f')]))[_0xe36e('0x63')]('base64'))};break;case _0xe36e('0x58'):_0x2b44a6['headers']={'Authorization':util['format'](_0xe36e('0x61'),new Buffer(util[_0xe36e('0x5c')]('%s/token:%s',_0x209e45['username'],_0x209e45[_0xe36e('0x58')]))['toString'](_0xe36e('0x64')))};break;default:throw new db[(_0xe36e('0x65'))][(_0xe36e('0x66'))](_0xe36e('0x67'));}return rp(_0x2b44a6);}})[_0xe36e('0x25')](function(_0x16c26a){if(_0x16c26a){var _0x590885=[_0xe36e('0x68'),_0xe36e('0x69'),_0xe36e('0x6a'),_0xe36e('0x6b')];_['remove'](_0x16c26a[_0xe36e('0x5e')],function(_0x37409f){return _0x590885[_0xe36e('0x6c')](_0x37409f[_0xe36e('0x2d')]);});return{'count':_0x16c26a['ticket_fields'][_0xe36e('0x44')],'rows':_['map'](_0x16c26a[_0xe36e('0x5e')],function(_0x5d3dac){return{'id':_0x5d3dac['id'],'name':_0x5d3dac[_0xe36e('0x6d')]>0x7?_0x5d3dac['title']:_0x5d3dac['type'],'custom':_0x5d3dac[_0xe36e('0x6d')]>0x7?!![]:![],'options':_0x5d3dac[_0xe36e('0x6e')]?_0x5d3dac[_0xe36e('0x6e')]:_0x5d3dac['custom_field_options']?_0x5d3dac[_0xe36e('0x6f')]:[]};})};}})[_0xe36e('0x25')](respondWithResult(_0x258a63,null))['catch'](function(_0x3beba7){var _0x369576=_0x2f7093[_0xe36e('0x31')]['test']?0x1f4:_0x3beba7['statusCode']||0x1f4;logger[_0xe36e('0x27')](_0xe36e('0x70'),_0xe36e('0x56'),_0x369576,JSON[_0xe36e('0x71')](_0x3beba7));delete _0x3beba7[_0xe36e('0x28')];if(_0x369576===0x191){_0x369576=0x190;}_0x258a63['status'](_0x369576)[_0xe36e('0x72')](_0x2f7093[_0xe36e('0x31')][_0xe36e('0x73')]?{'message':_0xe36e('0x74'),'statusCode':_0x3beba7[_0xe36e('0x75')]}:_0x3beba7);});}; \ No newline at end of file +var _0x1c7c=['moment','mustache','util','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','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','name','send','index','map','ZendeskAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','base64','headers','Unknown\x20authentication\x20type','subject','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x223a45,_0x163416){var _0x39d9ce=function(_0x393a29){while(--_0x393a29){_0x223a45['push'](_0x223a45['shift']());}};_0x39d9ce(++_0x163416);}(_0x1c7c,0x164));var _0xc1c7=function(_0x23cd08,_0x291899){_0x23cd08=_0x23cd08-0x0;var _0x5ca11b=_0x1c7c[_0x23cd08];return _0x5ca11b;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];var integrations=require(_0xc1c7('0x1b'));function respondWithStatusCode(_0x376cab,_0x35feaa){_0x35feaa=_0x35feaa||0xcc;return function(_0x2dad6e){if(_0x2dad6e){return _0x376cab[_0xc1c7('0x1c')](_0x35feaa);}return _0x376cab[_0xc1c7('0x1d')](_0x35feaa)[_0xc1c7('0x1e')]();};}function respondWithResult(_0xdfc7d9,_0x1b6905){_0x1b6905=_0x1b6905||0xc8;return function(_0x99b874){if(_0x99b874){return _0xdfc7d9[_0xc1c7('0x1d')](_0x1b6905)['json'](_0x99b874);}};}function respondWithFilteredResult(_0x3e1f0e,_0x335600){return function(_0x21911c){if(_0x21911c){var _0x555b59=typeof _0x335600[_0xc1c7('0x1f')]===_0xc1c7('0x20')&&typeof _0x335600[_0xc1c7('0x21')]===_0xc1c7('0x20');var _0x20439e=_0x21911c[_0xc1c7('0x22')];var _0x21758a=_0x555b59?0x0:_0x335600[_0xc1c7('0x1f')];var _0x5d44e9=_0x555b59?_0x21911c[_0xc1c7('0x22')]:_0x335600[_0xc1c7('0x1f')]+_0x335600[_0xc1c7('0x21')];var _0x1bc9d;if(_0x5d44e9>=_0x20439e){_0x5d44e9=_0x20439e;_0x1bc9d=0xc8;}else{_0x1bc9d=0xce;}_0x3e1f0e['status'](_0x1bc9d);return _0x3e1f0e[_0xc1c7('0x23')]('Content-Range',_0x21758a+'-'+_0x5d44e9+'/'+_0x20439e)[_0xc1c7('0x24')](_0x21911c);}return null;};}function patchUpdates(_0x195c5f){return function(_0x567cd4){try{jsonpatch['apply'](_0x567cd4,_0x195c5f,!![]);}catch(_0x2d006f){return BPromise[_0xc1c7('0x25')](_0x2d006f);}return _0x567cd4[_0xc1c7('0x26')]();};}function saveUpdates(_0x4c6b34,_0x813853){return function(_0x341b41){if(_0x341b41){return _0x341b41[_0xc1c7('0x27')](_0x4c6b34)[_0xc1c7('0x28')](function(_0x2e64c4){return _0x2e64c4;});}return null;};}function removeEntity(_0x3a2483,_0x3180fd){return function(_0x120168){if(_0x120168){return _0x120168[_0xc1c7('0x29')]()[_0xc1c7('0x28')](function(){_0x3a2483[_0xc1c7('0x1d')](0xcc)[_0xc1c7('0x1e')]();});}};}function handleEntityNotFound(_0x33aac7,_0x260a3f){return function(_0xf1c405){if(!_0xf1c405){_0x33aac7[_0xc1c7('0x1c')](0x194);}return _0xf1c405;};}function handleError(_0x5edb34,_0xf0ab9c){_0xf0ab9c=_0xf0ab9c||0x1f4;return function(_0x13a1f9){logger['error'](_0x13a1f9['stack']);if(_0x13a1f9[_0xc1c7('0x2a')]){delete _0x13a1f9['name'];}_0x5edb34['status'](_0xf0ab9c)[_0xc1c7('0x2b')](_0x13a1f9);};}exports[_0xc1c7('0x2c')]=function(_0x46d045,_0x243450){var _0x461360={},_0x4adb81={},_0x574e1c={'count':0x0,'rows':[]};var _0x1b6f97=_[_0xc1c7('0x2d')](db[_0xc1c7('0x2e')][_0xc1c7('0x2f')],function(_0x2e35f1){return{'name':_0x2e35f1['fieldName'],'type':_0x2e35f1['type'][_0xc1c7('0x30')]};});_0x4adb81[_0xc1c7('0x31')]=_['map'](_0x1b6f97,_0xc1c7('0x2a'));_0x4adb81[_0xc1c7('0x32')]=_[_0xc1c7('0x33')](_0x46d045[_0xc1c7('0x32')]);_0x4adb81[_0xc1c7('0x34')]=_[_0xc1c7('0x35')](_0x4adb81[_0xc1c7('0x31')],_0x4adb81['query']);_0x461360[_0xc1c7('0x36')]=_[_0xc1c7('0x35')](_0x4adb81[_0xc1c7('0x31')],qs[_0xc1c7('0x37')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x37')]));_0x461360[_0xc1c7('0x36')]=_0x461360[_0xc1c7('0x36')][_0xc1c7('0x38')]?_0x461360['attributes']:_0x4adb81['model'];if(!_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x39')](_0xc1c7('0x3a'))){_0x461360[_0xc1c7('0x21')]=qs[_0xc1c7('0x21')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x21')]);_0x461360[_0xc1c7('0x1f')]=qs[_0xc1c7('0x1f')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x1f')]);}_0x461360[_0xc1c7('0x3b')]=qs[_0xc1c7('0x3c')](_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x3c')]);_0x461360[_0xc1c7('0x3d')]=qs[_0xc1c7('0x34')](_[_0xc1c7('0x3e')](_0x46d045[_0xc1c7('0x32')],_0x4adb81[_0xc1c7('0x34')]),_0x1b6f97);if(_0x46d045[_0xc1c7('0x32')]['filter']){_0x461360['where']=_['merge'](_0x461360[_0xc1c7('0x3d')],{'$or':_['map'](_0x1b6f97,function(_0x53bf70){if(_0x53bf70[_0xc1c7('0x3f')]!==_0xc1c7('0x40')){var _0x2cd728={};_0x2cd728[_0x53bf70[_0xc1c7('0x2a')]]={'$like':'%'+_0x46d045['query'][_0xc1c7('0x41')]+'%'};return _0x2cd728;}})});}_0x461360=_[_0xc1c7('0x42')]({},_0x461360,_0x46d045[_0xc1c7('0x43')]);var _0x3e5a61={'where':_0x461360[_0xc1c7('0x3d')]};return db[_0xc1c7('0x2e')][_0xc1c7('0x22')](_0x3e5a61)[_0xc1c7('0x28')](function(_0x1d4621){_0x574e1c[_0xc1c7('0x22')]=_0x1d4621;if(_0x46d045[_0xc1c7('0x32')][_0xc1c7('0x44')]){_0x461360[_0xc1c7('0x45')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xc1c7('0x46')](_0x461360);})[_0xc1c7('0x28')](function(_0x508b32){_0x574e1c[_0xc1c7('0x47')]=_0x508b32;return _0x574e1c;})[_0xc1c7('0x28')](respondWithFilteredResult(_0x243450,_0x461360))[_0xc1c7('0x48')](handleError(_0x243450,null));};exports[_0xc1c7('0x49')]=function(_0x46a1b5,_0x2c09de){var _0xd5e06a={'raw':![],'where':{'id':_0x46a1b5[_0xc1c7('0x4a')]['id']}},_0x1e0248={};_0x1e0248[_0xc1c7('0x31')]=_['keys'](db[_0xc1c7('0x2e')][_0xc1c7('0x2f')]);_0x1e0248['query']=_['keys'](_0x46a1b5[_0xc1c7('0x32')]);_0x1e0248[_0xc1c7('0x34')]=_[_0xc1c7('0x35')](_0x1e0248[_0xc1c7('0x31')],_0x1e0248[_0xc1c7('0x32')]);_0xd5e06a['attributes']=_[_0xc1c7('0x35')](_0x1e0248[_0xc1c7('0x31')],qs['fields'](_0x46a1b5['query']['fields']));_0xd5e06a[_0xc1c7('0x36')]=_0xd5e06a[_0xc1c7('0x36')][_0xc1c7('0x38')]?_0xd5e06a['attributes']:_0x1e0248[_0xc1c7('0x31')];if(_0x46a1b5[_0xc1c7('0x32')]['includeAll']){_0xd5e06a[_0xc1c7('0x45')]=[{'all':!![]}];}_0xd5e06a=_[_0xc1c7('0x42')]({},_0xd5e06a,_0x46a1b5[_0xc1c7('0x43')]);return db[_0xc1c7('0x2e')][_0xc1c7('0x4b')](_0xd5e06a)[_0xc1c7('0x28')](handleEntityNotFound(_0x2c09de,null))[_0xc1c7('0x28')](respondWithResult(_0x2c09de,null))[_0xc1c7('0x48')](handleError(_0x2c09de,null));};exports[_0xc1c7('0x4c')]=function(_0x3ec5de,_0xa49f73){return db[_0xc1c7('0x2e')][_0xc1c7('0x4c')](_0x3ec5de[_0xc1c7('0x4d')],{})[_0xc1c7('0x28')](respondWithResult(_0xa49f73,0xc9))[_0xc1c7('0x48')](handleError(_0xa49f73,null));};exports[_0xc1c7('0x27')]=function(_0x1addc8,_0x5da115){if(_0x1addc8[_0xc1c7('0x4d')]['id']){delete _0x1addc8['body']['id'];}return db[_0xc1c7('0x2e')][_0xc1c7('0x4b')]({'where':{'id':_0x1addc8[_0xc1c7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5da115,null))[_0xc1c7('0x28')](saveUpdates(_0x1addc8[_0xc1c7('0x4d')],null))['then'](respondWithResult(_0x5da115,null))['catch'](handleError(_0x5da115,null));};exports['destroy']=function(_0x302185,_0x415416){return db['ZendeskAccount'][_0xc1c7('0x4b')]({'where':{'id':_0x302185[_0xc1c7('0x4a')]['id']}})[_0xc1c7('0x28')](handleEntityNotFound(_0x415416,null))[_0xc1c7('0x28')](removeEntity(_0x415416,null))[_0xc1c7('0x48')](handleError(_0x415416,null));};exports[_0xc1c7('0x4e')]=function(_0x4cad6a,_0x259e55,_0x568377){var _0x307b5e={};var _0x456ac1={};var _0x37dca9;var _0x557cb6;return db[_0xc1c7('0x2e')][_0xc1c7('0x4f')]({'where':{'id':_0x4cad6a[_0xc1c7('0x4a')]['id']}})[_0xc1c7('0x28')](handleEntityNotFound(_0x259e55,null))[_0xc1c7('0x28')](function(_0x45dfa2){if(_0x45dfa2){_0x37dca9=_0x45dfa2;_0x456ac1[_0xc1c7('0x31')]=_[_0xc1c7('0x33')](db['ZendeskConfiguration'][_0xc1c7('0x2f')]);_0x456ac1[_0xc1c7('0x32')]=_[_0xc1c7('0x33')](_0x4cad6a['query']);_0x456ac1['filters']=_[_0xc1c7('0x35')](_0x456ac1[_0xc1c7('0x31')],_0x456ac1[_0xc1c7('0x32')]);_0x307b5e['attributes']=_[_0xc1c7('0x35')](_0x456ac1['model'],qs[_0xc1c7('0x37')](_0x4cad6a[_0xc1c7('0x32')][_0xc1c7('0x37')]));_0x307b5e[_0xc1c7('0x36')]=_0x307b5e[_0xc1c7('0x36')][_0xc1c7('0x38')]?_0x307b5e[_0xc1c7('0x36')]:_0x456ac1['model'];_0x307b5e[_0xc1c7('0x3b')]=qs[_0xc1c7('0x3c')](_0x4cad6a[_0xc1c7('0x32')]['sort']);_0x307b5e[_0xc1c7('0x3d')]=qs['filters'](_[_0xc1c7('0x3e')](_0x4cad6a['query'],_0x456ac1[_0xc1c7('0x34')]));if(_0x4cad6a[_0xc1c7('0x32')][_0xc1c7('0x41')]){_0x307b5e[_0xc1c7('0x3d')]=_[_0xc1c7('0x42')](_0x307b5e['where'],{'$or':_['map'](_0x307b5e['attributes'],function(_0xbce766){var _0x28231b={};_0x28231b[_0xbce766]={'$like':'%'+_0x4cad6a[_0xc1c7('0x32')][_0xc1c7('0x41')]+'%'};return _0x28231b;})});}_0x307b5e=_[_0xc1c7('0x42')]({},_0x307b5e,_0x4cad6a[_0xc1c7('0x43')]);return _0x37dca9['getConfigurations'](_0x307b5e);}})[_0xc1c7('0x28')](function(_0xe5882){if(_0xe5882){_0x557cb6=_0xe5882[_0xc1c7('0x38')];if(!_0x4cad6a[_0xc1c7('0x32')]['hasOwnProperty'](_0xc1c7('0x3a'))){_0x307b5e[_0xc1c7('0x21')]=qs[_0xc1c7('0x21')](_0x4cad6a['query'][_0xc1c7('0x21')]);_0x307b5e[_0xc1c7('0x1f')]=qs[_0xc1c7('0x1f')](_0x4cad6a[_0xc1c7('0x32')]['offset']);}return _0x37dca9['getConfigurations'](_0x307b5e);}})[_0xc1c7('0x28')](function(_0x203790){if(_0x203790){return _0x203790?{'count':_0x557cb6,'rows':_0x203790}:null;}})['then'](respondWithResult(_0x259e55,null))[_0xc1c7('0x48')](handleError(_0x259e55,null));};exports[_0xc1c7('0x50')]=function(_0x4b27f5,_0x12aaac,_0x6eec68){if(_0x4b27f5['body']['id']){delete _0x4b27f5[_0xc1c7('0x4d')]['id'];}return db[_0xc1c7('0x2e')][_0xc1c7('0x4f')]({'where':{'id':_0x4b27f5[_0xc1c7('0x4a')]['id']}})[_0xc1c7('0x28')](handleEntityNotFound(_0x12aaac,null))[_0xc1c7('0x28')](function(_0x1ed9fc){if(_0x1ed9fc){_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x51')]=_0x1ed9fc['id'];_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x52')]=integrations[_0xc1c7('0x53')](_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x54')],_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x3f')]);_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x55')]=integrations[_0xc1c7('0x56')](_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x54')],_0x4b27f5[_0xc1c7('0x4d')][_0xc1c7('0x3f')]);return db[_0xc1c7('0x57')][_0xc1c7('0x4c')](_0x4b27f5[_0xc1c7('0x4d')],{'include':[{'model':db[_0xc1c7('0x58')],'as':_0xc1c7('0x52')},{'model':db['ZendeskField'],'as':_0xc1c7('0x55')}]});}return null;})[_0xc1c7('0x28')](respondWithResult(_0x12aaac,null))[_0xc1c7('0x48')](handleError(_0x12aaac,null));};exports[_0xc1c7('0x59')]=function(_0x268de7,_0x1cd622,_0x1ccd7d){var _0x29181f='';return db['ZendeskAccount'][_0xc1c7('0x4f')]({'where':{'id':_0x268de7[_0xc1c7('0x4a')]['id']},'attributes':['id',_0xc1c7('0x5a'),_0xc1c7('0x5b'),_0xc1c7('0x5c'),_0xc1c7('0x5d'),_0xc1c7('0x5e')]})[_0xc1c7('0x28')](handleEntityNotFound(_0x1cd622,null))['then'](function(_0x378f7f){if(_0x378f7f){_0x29181f=_0x378f7f[_0xc1c7('0x5e')];var _0x32ed03=_0x29181f[_0xc1c7('0x5f')](-0x1);if(_0x32ed03==='/'){_0x29181f=_0x29181f[_0xc1c7('0x60')](0x0,_0x29181f[_0xc1c7('0x61')](_0x32ed03));}var _0x426698={'method':_0xc1c7('0x62'),'uri':util[_0xc1c7('0x63')](_0xc1c7('0x64'),_0x29181f,_0xc1c7('0x65')),'json':!![]};switch(_0x378f7f[_0xc1c7('0x5d')]){case'password':_0x426698['headers']={'Authorization':util[_0xc1c7('0x63')](_0xc1c7('0x66'),new Buffer(util[_0xc1c7('0x63')](_0xc1c7('0x67'),_0x378f7f[_0xc1c7('0x5a')],_0x378f7f[_0xc1c7('0x5b')]))[_0xc1c7('0x68')](_0xc1c7('0x69')))};break;case _0xc1c7('0x5c'):_0x426698[_0xc1c7('0x6a')]={'Authorization':util[_0xc1c7('0x63')](_0xc1c7('0x66'),new Buffer(util[_0xc1c7('0x63')]('%s/token:%s',_0x378f7f[_0xc1c7('0x5a')],_0x378f7f[_0xc1c7('0x5c')]))[_0xc1c7('0x68')]('base64'))};break;default:throw new db['Sequelize']['ValidationError'](_0xc1c7('0x6b'));}return rp(_0x426698);}})[_0xc1c7('0x28')](function(_0x51dfb2){if(_0x51dfb2){var _0x1f2940=[_0xc1c7('0x6c'),'description','group','assignee'];_[_0xc1c7('0x6d')](_0x51dfb2['ticket_fields'],function(_0x219d44){return _0x1f2940[_0xc1c7('0x6e')](_0x219d44[_0xc1c7('0x3f')]);});return{'count':_0x51dfb2['ticket_fields'][_0xc1c7('0x38')],'rows':_['map'](_0x51dfb2[_0xc1c7('0x65')],function(_0x16832c){return{'id':_0x16832c['id'],'name':_0x16832c['position']>0x7?_0x16832c[_0xc1c7('0x6f')]:_0x16832c[_0xc1c7('0x3f')],'custom':_0x16832c[_0xc1c7('0x70')]>0x7?!![]:![],'options':_0x16832c[_0xc1c7('0x71')]?_0x16832c[_0xc1c7('0x71')]:_0x16832c[_0xc1c7('0x72')]?_0x16832c[_0xc1c7('0x72')]:[]};})};}})[_0xc1c7('0x28')](respondWithResult(_0x1cd622,null))[_0xc1c7('0x48')](function(_0x3eba33){var _0x4bb9bc=_0x268de7[_0xc1c7('0x32')][_0xc1c7('0x73')]?0x1f4:_0x3eba33[_0xc1c7('0x74')]||0x1f4;logger[_0xc1c7('0x75')]('getFields,\x20%s,\x20%s,\x20%s',_0xc1c7('0x59'),_0x4bb9bc,JSON[_0xc1c7('0x76')](_0x3eba33));delete _0x3eba33['name'];if(_0x4bb9bc===0x191){_0x4bb9bc=0x190;}_0x1cd622['status'](_0x4bb9bc)[_0xc1c7('0x2b')](_0x268de7[_0xc1c7('0x32')][_0xc1c7('0x73')]?{'message':_0xc1c7('0x77'),'statusCode':_0x3eba33[_0xc1c7('0x74')]}:_0x3eba33);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 43d9357..26cf0bf 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 _0x63db=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util'];(function(_0x54496d,_0x5b8572){var _0x40e626=function(_0xb6475c){while(--_0xb6475c){_0x54496d['push'](_0x54496d['shift']());}};_0x40e626(++_0x5b8572);}(_0x63db,0x132));var _0xb63d=function(_0xa46aca,_0x10c140){_0xa46aca=_0xa46aca-0x0;var _0x4c21ea=_0x63db[_0xa46aca];return _0x4c21ea;};'use strict';var _=require(_0xb63d('0x0'));var util=require(_0xb63d('0x1'));var logger=require(_0xb63d('0x2'))(_0xb63d('0x3'));var moment=require(_0xb63d('0x4'));var BPromise=require(_0xb63d('0x5'));var rp=require(_0xb63d('0x6'));var fs=require('fs');var path=require(_0xb63d('0x7'));var rimraf=require(_0xb63d('0x8'));var config=require(_0xb63d('0x9'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xb63d('0xa')]=function(_0x247669,_0x54e891){return _0x247669[_0xb63d('0xb')](_0xb63d('0xc'),attributes,{'tableName':_0xb63d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8218=['moment','bluebird','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','lodash','util','../../config/logger','api'];(function(_0x26d478,_0x5b5a2c){var _0x2e47c8=function(_0x54ba33){while(--_0x54ba33){_0x26d478['push'](_0x26d478['shift']());}};_0x2e47c8(++_0x5b5a2c);}(_0x8218,0xf6));var _0x8821=function(_0x3abaac,_0xa8534d){_0x3abaac=_0x3abaac-0x0;var _0x475008=_0x8218[_0x3abaac];return _0x475008;};'use strict';var _=require(_0x8821('0x0'));var util=require(_0x8821('0x1'));var logger=require(_0x8821('0x2'))(_0x8821('0x3'));var moment=require(_0x8821('0x4'));var BPromise=require(_0x8821('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8821('0x6'));var attributes=require(_0x8821('0x7'));var integrations=require(_0x8821('0x8'));module['exports']=function(_0x31b3ea,_0x3eec7d){return _0x31b3ea['define'](_0x8821('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 25feb5d..e0d95c6 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 _0xbe64=['find','where','map','ShowZendeskAccount','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','model','then','info'];(function(_0x21e51e,_0x49a0ba){var _0x18b977=function(_0x146c35){while(--_0x146c35){_0x21e51e['push'](_0x21e51e['shift']());}};_0x18b977(++_0x49a0ba);}(_0xbe64,0x19d));var _0x4be6=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0xbe64[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0x4be6('0x0'));var util=require(_0x4be6('0x1'));var moment=require(_0x4be6('0x2'));var BPromise=require('bluebird');var rs=require(_0x4be6('0x3'));var fs=require('fs');var Redis=require(_0x4be6('0x4'));var db=require(_0x4be6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4be6('0x6'))(_0x4be6('0x7'));var config=require(_0x4be6('0x8'));var jayson=require(_0x4be6('0x9'));var client=jayson['client'][_0x4be6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cfe01,_0x27aad8,_0x324b99){return new BPromise(function(_0xc72990,_0xd871f5){return client[_0x4be6('0xb')](_0x5cfe01,_0x324b99)['then'](function(_0x3550c4){logger['info'](_0x4be6('0xc'),_0x27aad8,_0x4be6('0xd'));logger['debug'](_0x4be6('0xe'),_0x27aad8,'request\x20sent',JSON[_0x4be6('0xf')](_0x3550c4));if(_0x3550c4['error']){if(_0x3550c4['error']['code']===0x1f4){logger[_0x4be6('0x10')](_0x4be6('0xc'),_0x27aad8,_0x3550c4['error'][_0x4be6('0x11')]);return _0xd871f5(_0x3550c4[_0x4be6('0x10')][_0x4be6('0x11')]);}logger[_0x4be6('0x10')](_0x4be6('0xc'),_0x27aad8,_0x3550c4[_0x4be6('0x10')][_0x4be6('0x11')]);return _0xc72990(_0x3550c4[_0x4be6('0x10')][_0x4be6('0x11')]);}else{logger['info'](_0x4be6('0xc'),_0x27aad8,'request\x20sent');_0xc72990(_0x3550c4['result'][_0x4be6('0x11')]);}})[_0x4be6('0x12')](function(_0x1e8ece){logger[_0x4be6('0x10')](_0x4be6('0xc'),_0x27aad8,_0x1e8ece);_0xd871f5(_0x1e8ece);});});}exports[_0x4be6('0x13')]=function(_0xeeebd){var _0x4ade82=this;return new Promise(function(_0x452d8c,_0x5af211){return db[_0x4be6('0x14')][_0x4be6('0x15')]({'raw':_0xeeebd[_0x4be6('0x16')]?_0xeeebd['options'][_0x4be6('0x17')]===undefined?!![]:![]:!![],'where':_0xeeebd[_0x4be6('0x16')]?_0xeeebd[_0x4be6('0x16')]['where']||null:null,'attributes':_0xeeebd[_0x4be6('0x16')]?_0xeeebd[_0x4be6('0x16')][_0x4be6('0x18')]||null:null,'limit':_0xeeebd[_0x4be6('0x16')]?_0xeeebd['options']['limit']||null:null,'include':_0xeeebd['options']?_0xeeebd[_0x4be6('0x16')][_0x4be6('0x19')]?_['map'](_0xeeebd[_0x4be6('0x16')][_0x4be6('0x19')],function(_0x2124f0){return{'model':db[_0x2124f0[_0x4be6('0x1a')]],'as':_0x2124f0['as'],'attributes':_0x2124f0[_0x4be6('0x18')],'include':_0x2124f0[_0x4be6('0x19')]?_['map'](_0x2124f0[_0x4be6('0x19')],function(_0x2cfb8c){return{'model':db[_0x2cfb8c[_0x4be6('0x1a')]],'as':_0x2cfb8c['as'],'attributes':_0x2cfb8c['attributes'],'include':_0x2cfb8c[_0x4be6('0x19')]?_['map'](_0x2cfb8c['include'],function(_0xb71ea7){return{'model':db[_0xb71ea7[_0x4be6('0x1a')]],'as':_0xb71ea7['as'],'attributes':_0xb71ea7[_0x4be6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4be6('0x1b')](function(_0x1d42a5){logger[_0x4be6('0x1c')](_0x4be6('0x13'),_0xeeebd);logger['debug'](_0x4be6('0x13'),_0xeeebd,JSON[_0x4be6('0xf')](_0x1d42a5));_0x452d8c(_0x1d42a5);})[_0x4be6('0x12')](function(_0x28d3e1){logger[_0x4be6('0x10')](_0x4be6('0x13'),_0x28d3e1['message'],_0xeeebd);_0x5af211(_0x4ade82['error'](0x1f4,_0x28d3e1['message']));});});};exports['ShowZendeskAccount']=function(_0xbb8d0e){var _0x10b67a=this;return new Promise(function(_0x3e93b8,_0x3cabd7){return db[_0x4be6('0x14')][_0x4be6('0x1d')]({'raw':_0xbb8d0e['options']?_0xbb8d0e[_0x4be6('0x16')][_0x4be6('0x17')]===undefined?!![]:![]:!![],'where':_0xbb8d0e['options']?_0xbb8d0e[_0x4be6('0x16')][_0x4be6('0x1e')]||null:null,'attributes':_0xbb8d0e[_0x4be6('0x16')]?_0xbb8d0e['options'][_0x4be6('0x18')]||null:null,'include':_0xbb8d0e[_0x4be6('0x16')]?_0xbb8d0e[_0x4be6('0x16')]['include']?_['map'](_0xbb8d0e['options']['include'],function(_0x136f6b){return{'model':db[_0x136f6b[_0x4be6('0x1a')]],'as':_0x136f6b['as'],'attributes':_0x136f6b[_0x4be6('0x18')],'include':_0x136f6b['include']?_[_0x4be6('0x1f')](_0x136f6b[_0x4be6('0x19')],function(_0x3980e5){return{'model':db[_0x3980e5[_0x4be6('0x1a')]],'as':_0x3980e5['as'],'attributes':_0x3980e5[_0x4be6('0x18')],'include':_0x3980e5[_0x4be6('0x19')]?_[_0x4be6('0x1f')](_0x3980e5[_0x4be6('0x19')],function(_0xc67d07){return{'model':db[_0xc67d07[_0x4be6('0x1a')]],'as':_0xc67d07['as'],'attributes':_0xc67d07[_0x4be6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4be6('0x1b')](function(_0x27f4d6){logger[_0x4be6('0x1c')](_0x4be6('0x20'),_0xbb8d0e);logger[_0x4be6('0x21')](_0x4be6('0x20'),_0xbb8d0e,JSON[_0x4be6('0xf')](_0x27f4d6));_0x3e93b8(_0x27f4d6);})[_0x4be6('0x12')](function(_0x2c2f30){logger[_0x4be6('0x10')](_0x4be6('0x20'),_0x2c2f30[_0x4be6('0x11')],_0xbb8d0e);_0x3cabd7(_0x10b67a[_0x4be6('0x10')](0x1f4,_0x2c2f30['message']));});});}; \ No newline at end of file +var _0x6bb4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include','map','model','debug','find','ShowZendeskAccount','stringify','lodash','moment','randomstring'];(function(_0x1107cd,_0x15cf94){var _0x2f621e=function(_0x3b0f54){while(--_0x3b0f54){_0x1107cd['push'](_0x1107cd['shift']());}};_0x2f621e(++_0x15cf94);}(_0x6bb4,0x17e));var _0x46bb=function(_0x1b6964,_0x23297e){_0x1b6964=_0x1b6964-0x0;var _0x49d2af=_0x6bb4[_0x1b6964];return _0x49d2af;};'use strict';var _=require(_0x46bb('0x0'));var util=require('util');var moment=require(_0x46bb('0x1'));var BPromise=require('bluebird');var rs=require(_0x46bb('0x2'));var fs=require('fs');var Redis=require(_0x46bb('0x3'));var db=require(_0x46bb('0x4'))['db'];var utils=require(_0x46bb('0x5'));var logger=require(_0x46bb('0x6'))(_0x46bb('0x7'));var config=require(_0x46bb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46bb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d03ad,_0x12aacf,_0x4c0bac){return new BPromise(function(_0x722f57,_0x18616d){return client[_0x46bb('0xa')](_0x3d03ad,_0x4c0bac)[_0x46bb('0xb')](function(_0x382a0d){logger['info'](_0x46bb('0xc'),_0x12aacf,_0x46bb('0xd'));logger['debug'](_0x46bb('0xe'),_0x12aacf,_0x46bb('0xd'),JSON['stringify'](_0x382a0d));if(_0x382a0d[_0x46bb('0xf')]){if(_0x382a0d['error'][_0x46bb('0x10')]===0x1f4){logger[_0x46bb('0xf')](_0x46bb('0xc'),_0x12aacf,_0x382a0d[_0x46bb('0xf')]['message']);return _0x18616d(_0x382a0d[_0x46bb('0xf')][_0x46bb('0x11')]);}logger[_0x46bb('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x12aacf,_0x382a0d[_0x46bb('0xf')]['message']);return _0x722f57(_0x382a0d[_0x46bb('0xf')][_0x46bb('0x11')]);}else{logger[_0x46bb('0x12')](_0x46bb('0xc'),_0x12aacf,_0x46bb('0xd'));_0x722f57(_0x382a0d[_0x46bb('0x13')][_0x46bb('0x11')]);}})[_0x46bb('0x14')](function(_0x52218d){logger[_0x46bb('0xf')](_0x46bb('0xc'),_0x12aacf,_0x52218d);_0x18616d(_0x52218d);});});}exports[_0x46bb('0x15')]=function(_0x1add5f){var _0x2e9307=this;return new Promise(function(_0x1c7e7b,_0x19ae64){return db[_0x46bb('0x16')]['findAll']({'raw':_0x1add5f['options']?_0x1add5f[_0x46bb('0x17')][_0x46bb('0x18')]===undefined?!![]:![]:!![],'where':_0x1add5f[_0x46bb('0x17')]?_0x1add5f[_0x46bb('0x17')][_0x46bb('0x19')]||null:null,'attributes':_0x1add5f['options']?_0x1add5f['options'][_0x46bb('0x1a')]||null:null,'limit':_0x1add5f[_0x46bb('0x17')]?_0x1add5f[_0x46bb('0x17')][_0x46bb('0x1b')]||null:null,'include':_0x1add5f[_0x46bb('0x17')]?_0x1add5f[_0x46bb('0x17')][_0x46bb('0x1c')]?_[_0x46bb('0x1d')](_0x1add5f['options'][_0x46bb('0x1c')],function(_0x4a8053){return{'model':db[_0x4a8053[_0x46bb('0x1e')]],'as':_0x4a8053['as'],'attributes':_0x4a8053[_0x46bb('0x1a')],'include':_0x4a8053['include']?_['map'](_0x4a8053['include'],function(_0x1f494b){return{'model':db[_0x1f494b[_0x46bb('0x1e')]],'as':_0x1f494b['as'],'attributes':_0x1f494b[_0x46bb('0x1a')],'include':_0x1f494b[_0x46bb('0x1c')]?_[_0x46bb('0x1d')](_0x1f494b[_0x46bb('0x1c')],function(_0x454e84){return{'model':db[_0x454e84[_0x46bb('0x1e')]],'as':_0x454e84['as'],'attributes':_0x454e84['attributes']};}):[]};}):[]};}):[]:[]})[_0x46bb('0xb')](function(_0x264ad4){logger['info'](_0x46bb('0x15'),_0x1add5f);logger[_0x46bb('0x1f')](_0x46bb('0x15'),_0x1add5f,JSON['stringify'](_0x264ad4));_0x1c7e7b(_0x264ad4);})[_0x46bb('0x14')](function(_0x33a8db){logger['error'](_0x46bb('0x15'),_0x33a8db[_0x46bb('0x11')],_0x1add5f);_0x19ae64(_0x2e9307[_0x46bb('0xf')](0x1f4,_0x33a8db[_0x46bb('0x11')]));});});};exports['ShowZendeskAccount']=function(_0x3d5518){var _0x518ec8=this;return new Promise(function(_0x5e34c7,_0x21b400){return db[_0x46bb('0x16')][_0x46bb('0x20')]({'raw':_0x3d5518[_0x46bb('0x17')]?_0x3d5518['options'][_0x46bb('0x18')]===undefined?!![]:![]:!![],'where':_0x3d5518[_0x46bb('0x17')]?_0x3d5518['options'][_0x46bb('0x19')]||null:null,'attributes':_0x3d5518[_0x46bb('0x17')]?_0x3d5518[_0x46bb('0x17')][_0x46bb('0x1a')]||null:null,'include':_0x3d5518[_0x46bb('0x17')]?_0x3d5518[_0x46bb('0x17')]['include']?_['map'](_0x3d5518[_0x46bb('0x17')][_0x46bb('0x1c')],function(_0xf2ba5b){return{'model':db[_0xf2ba5b[_0x46bb('0x1e')]],'as':_0xf2ba5b['as'],'attributes':_0xf2ba5b[_0x46bb('0x1a')],'include':_0xf2ba5b['include']?_[_0x46bb('0x1d')](_0xf2ba5b[_0x46bb('0x1c')],function(_0x4d49ee){return{'model':db[_0x4d49ee[_0x46bb('0x1e')]],'as':_0x4d49ee['as'],'attributes':_0x4d49ee['attributes'],'include':_0x4d49ee['include']?_[_0x46bb('0x1d')](_0x4d49ee['include'],function(_0x4c6aa7){return{'model':db[_0x4c6aa7[_0x46bb('0x1e')]],'as':_0x4c6aa7['as'],'attributes':_0x4c6aa7[_0x46bb('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x124049){logger[_0x46bb('0x12')]('ShowZendeskAccount',_0x3d5518);logger[_0x46bb('0x1f')](_0x46bb('0x21'),_0x3d5518,JSON[_0x46bb('0x22')](_0x124049));_0x5e34c7(_0x124049);})[_0x46bb('0x14')](function(_0x15fe49){logger[_0x46bb('0xf')](_0x46bb('0x21'),_0x15fe49[_0x46bb('0x11')],_0x3d5518);_0x21b400(_0x518ec8[_0x46bb('0xf')](0x1f4,_0x15fe49[_0x46bb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 014c0d8..16b2904 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 _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x32fbbe,_0x663bd2){var _0x214b6f=function(_0x12b4cd){while(--_0x12b4cd){_0x32fbbe['push'](_0x32fbbe['shift']());}};_0x214b6f(++_0x663bd2);}(_0x750a,0x140));var _0xa750=function(_0x431fc9,_0x484199){_0x431fc9=_0x431fc9-0x0;var _0x5911ad=_0x750a[_0x431fc9];return _0x5911ad;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file +var _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x431362,_0x3a52cd){var _0x23caf7=function(_0x337cd7){while(--_0x337cd7){_0x431362['push'](_0x431362['shift']());}};_0x23caf7(++_0x3a52cd);}(_0xa571,0x107));var _0x1a57=function(_0x327fb0,_0x387a15){_0x327fb0=_0x327fb0-0x0;var _0x13b762=_0xa571[_0x327fb0];return _0x13b762;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index f8bafca..5ce7588 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 _0x61ff=['STRING'];(function(_0x39a68f,_0x5c93d8){var _0x15d685=function(_0x4f0e2c){while(--_0x4f0e2c){_0x39a68f['push'](_0x39a68f['shift']());}};_0x15d685(++_0x5c93d8);}(_0x61ff,0x127));var _0xf61f=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0x61ff[_0x121886];return _0x20ca01;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf61f('0x0')]},'description':{'type':Sequelize[_0xf61f('0x0')]}}; \ No newline at end of file +var _0x5d0c=['STRING'];(function(_0x21a2b3,_0x5d6564){var _0x4651a7=function(_0x285f59){while(--_0x285f59){_0x21a2b3['push'](_0x21a2b3['shift']());}};_0x4651a7(++_0x5d6564);}(_0x5d0c,0x64));var _0xc5d0=function(_0x1c6de2,_0x3ddc8b){_0x1c6de2=_0x1c6de2-0x0;var _0x15e6c8=_0x5d0c[_0x1c6de2];return _0x15e6c8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc5d0('0x0')]},'description':{'type':Sequelize[_0xc5d0('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 3207193..5398ae9 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 _0x5993=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','then','destroy','end','error','name','send','map','ZendeskConfiguration','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','update','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','setTags','body','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4dd2d3,_0x264f72){var _0x269be2=function(_0x2315bc){while(--_0x2315bc){_0x4dd2d3['push'](_0x4dd2d3['shift']());}};_0x269be2(++_0x264f72);}(_0x5993,0x8b));var _0x3599=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x5993[_0x3826ad];return _0x17b900;};'use strict';var emlformat=require(_0x3599('0x0'));var rimraf=require(_0x3599('0x1'));var zipdir=require(_0x3599('0x2'));var jsonpatch=require(_0x3599('0x3'));var rp=require('request-promise');var moment=require(_0x3599('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3599('0x5'));var path=require(_0x3599('0x6'));var sox=require('sox');var csv=require(_0x3599('0x7'));var ejs=require(_0x3599('0x8'));var fs=require('fs');var fs_extra=require(_0x3599('0x9'));var _=require(_0x3599('0xa'));var squel=require(_0x3599('0xb'));var crypto=require(_0x3599('0xc'));var jsforce=require(_0x3599('0xd'));var deskjs=require(_0x3599('0xe'));var toCsv=require(_0x3599('0x7'));var querystring=require(_0x3599('0xf'));var Papa=require(_0x3599('0x10'));var Redis=require(_0x3599('0x11'));var authService=require(_0x3599('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3599('0x13'));var hardwareService=require(_0x3599('0x14'));var logger=require('../../config/logger')(_0x3599('0x15'));var utils=require(_0x3599('0x16'));var config=require(_0x3599('0x17'));var licenseUtil=require(_0x3599('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11fd22,_0x289e39){_0x289e39=_0x289e39||0xcc;return function(_0x38b876){if(_0x38b876){return _0x11fd22[_0x3599('0x19')](_0x289e39);}return _0x11fd22[_0x3599('0x1a')](_0x289e39)['end']();};}function respondWithResult(_0x4f7b4d,_0x2ae98d){_0x2ae98d=_0x2ae98d||0xc8;return function(_0x349289){if(_0x349289){return _0x4f7b4d['status'](_0x2ae98d)[_0x3599('0x1b')](_0x349289);}};}function respondWithFilteredResult(_0xb3bc0c,_0x17ef92){return function(_0x50df30){if(_0x50df30){var _0x6de77a=typeof _0x17ef92[_0x3599('0x1c')]==='undefined'&&typeof _0x17ef92[_0x3599('0x1d')]===_0x3599('0x1e');var _0x178e69=_0x50df30[_0x3599('0x1f')];var _0x459f50=_0x6de77a?0x0:_0x17ef92[_0x3599('0x1c')];var _0x11ebbb=_0x6de77a?_0x50df30[_0x3599('0x1f')]:_0x17ef92['offset']+_0x17ef92[_0x3599('0x1d')];var _0x3b6430;if(_0x11ebbb>=_0x178e69){_0x11ebbb=_0x178e69;_0x3b6430=0xc8;}else{_0x3b6430=0xce;}_0xb3bc0c[_0x3599('0x1a')](_0x3b6430);return _0xb3bc0c[_0x3599('0x20')]('Content-Range',_0x459f50+'-'+_0x11ebbb+'/'+_0x178e69)[_0x3599('0x1b')](_0x50df30);}return null;};}function patchUpdates(_0x920d10){return function(_0x31852c){try{jsonpatch[_0x3599('0x21')](_0x31852c,_0x920d10,!![]);}catch(_0x1a4f9b){return BPromise['reject'](_0x1a4f9b);}return _0x31852c[_0x3599('0x22')]();};}function saveUpdates(_0x367290,_0x166c26){return function(_0x5e29bc){if(_0x5e29bc){return _0x5e29bc['update'](_0x367290)[_0x3599('0x23')](function(_0x114143){return _0x114143;});}return null;};}function removeEntity(_0x3ffe18,_0x24a5b0){return function(_0x177a3b){if(_0x177a3b){return _0x177a3b[_0x3599('0x24')]()[_0x3599('0x23')](function(){_0x3ffe18[_0x3599('0x1a')](0xcc)[_0x3599('0x25')]();});}};}function handleEntityNotFound(_0x5dad8c,_0x1c81c6){return function(_0x57567a){if(!_0x57567a){_0x5dad8c[_0x3599('0x19')](0x194);}return _0x57567a;};}function handleError(_0x2eb648,_0xe130f5){_0xe130f5=_0xe130f5||0x1f4;return function(_0x4eefc3){logger[_0x3599('0x26')](_0x4eefc3['stack']);if(_0x4eefc3['name']){delete _0x4eefc3[_0x3599('0x27')];}_0x2eb648[_0x3599('0x1a')](_0xe130f5)[_0x3599('0x28')](_0x4eefc3);};}exports['index']=function(_0x590099,_0x354018){var _0x3da7cb={},_0x5bf711={},_0x525bc8={'count':0x0,'rows':[]};var _0x107834=_[_0x3599('0x29')](db[_0x3599('0x2a')][_0x3599('0x2b')],function(_0x3c0408){return{'name':_0x3c0408['fieldName'],'type':_0x3c0408[_0x3599('0x2c')][_0x3599('0x2d')]};});_0x5bf711['model']=_['map'](_0x107834,_0x3599('0x27'));_0x5bf711['query']=_[_0x3599('0x2e')](_0x590099[_0x3599('0x2f')]);_0x5bf711[_0x3599('0x30')]=_[_0x3599('0x31')](_0x5bf711[_0x3599('0x32')],_0x5bf711[_0x3599('0x2f')]);_0x3da7cb['attributes']=_[_0x3599('0x31')](_0x5bf711[_0x3599('0x32')],qs['fields'](_0x590099[_0x3599('0x2f')][_0x3599('0x33')]));_0x3da7cb['attributes']=_0x3da7cb[_0x3599('0x34')][_0x3599('0x35')]?_0x3da7cb[_0x3599('0x34')]:_0x5bf711[_0x3599('0x32')];if(!_0x590099[_0x3599('0x2f')][_0x3599('0x36')](_0x3599('0x37'))){_0x3da7cb[_0x3599('0x1d')]=qs['limit'](_0x590099[_0x3599('0x2f')][_0x3599('0x1d')]);_0x3da7cb['offset']=qs[_0x3599('0x1c')](_0x590099[_0x3599('0x2f')][_0x3599('0x1c')]);}_0x3da7cb[_0x3599('0x38')]=qs[_0x3599('0x39')](_0x590099[_0x3599('0x2f')]['sort']);_0x3da7cb[_0x3599('0x3a')]=qs['filters'](_[_0x3599('0x3b')](_0x590099['query'],_0x5bf711[_0x3599('0x30')]),_0x107834);if(_0x590099[_0x3599('0x2f')][_0x3599('0x3c')]){_0x3da7cb['where']=_[_0x3599('0x3d')](_0x3da7cb['where'],{'$or':_[_0x3599('0x29')](_0x107834,function(_0x1df6f1){if(_0x1df6f1[_0x3599('0x2c')]!==_0x3599('0x3e')){var _0x425fbb={};_0x425fbb[_0x1df6f1[_0x3599('0x27')]]={'$like':'%'+_0x590099[_0x3599('0x2f')]['filter']+'%'};return _0x425fbb;}})});}_0x3da7cb=_[_0x3599('0x3d')]({},_0x3da7cb,_0x590099[_0x3599('0x3f')]);var _0xc2c071={'where':_0x3da7cb['where']};return db[_0x3599('0x2a')][_0x3599('0x1f')](_0xc2c071)[_0x3599('0x23')](function(_0x466afd){_0x525bc8[_0x3599('0x1f')]=_0x466afd;if(_0x590099['query'][_0x3599('0x40')]){_0x3da7cb[_0x3599('0x41')]=[{'all':!![]}];}return db[_0x3599('0x2a')]['findAll'](_0x3da7cb);})[_0x3599('0x23')](function(_0x33568b){_0x525bc8['rows']=_0x33568b;return _0x525bc8;})[_0x3599('0x23')](respondWithFilteredResult(_0x354018,_0x3da7cb))[_0x3599('0x42')](handleError(_0x354018,null));};exports['show']=function(_0x212be4,_0x4862bc){var _0x2bdff7={'raw':![],'where':{'id':_0x212be4[_0x3599('0x43')]['id']}},_0x3264bb={};_0x3264bb[_0x3599('0x32')]=_[_0x3599('0x2e')](db[_0x3599('0x2a')][_0x3599('0x2b')]);_0x3264bb['query']=_[_0x3599('0x2e')](_0x212be4[_0x3599('0x2f')]);_0x3264bb['filters']=_['intersection'](_0x3264bb['model'],_0x3264bb[_0x3599('0x2f')]);_0x2bdff7[_0x3599('0x34')]=_[_0x3599('0x31')](_0x3264bb[_0x3599('0x32')],qs[_0x3599('0x33')](_0x212be4[_0x3599('0x2f')][_0x3599('0x33')]));_0x2bdff7[_0x3599('0x34')]=_0x2bdff7[_0x3599('0x34')][_0x3599('0x35')]?_0x2bdff7['attributes']:_0x3264bb[_0x3599('0x32')];if(_0x212be4[_0x3599('0x2f')][_0x3599('0x40')]){_0x2bdff7['include']=[{'all':!![]}];}_0x2bdff7=_[_0x3599('0x3d')]({},_0x2bdff7,_0x212be4['options']);return db['ZendeskConfiguration'][_0x3599('0x44')](_0x2bdff7)[_0x3599('0x23')](handleEntityNotFound(_0x4862bc,null))[_0x3599('0x23')](respondWithResult(_0x4862bc,null))[_0x3599('0x42')](handleError(_0x4862bc,null));};exports['create']=function(_0x322ec6,_0x21e48f){return db[_0x3599('0x2a')][_0x3599('0x45')](_0x322ec6['body'],{})[_0x3599('0x23')](respondWithResult(_0x21e48f,0xc9))['catch'](handleError(_0x21e48f,null));};exports[_0x3599('0x46')]=function(_0x6b915a,_0x37109d){if(_0x6b915a['body']['id']){delete _0x6b915a['body']['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x6b915a[_0x3599('0x43')]['id']}})[_0x3599('0x23')](handleEntityNotFound(_0x37109d,null))[_0x3599('0x23')](saveUpdates(_0x6b915a['body'],null))[_0x3599('0x23')](respondWithResult(_0x37109d,null))['catch'](handleError(_0x37109d,null));};exports[_0x3599('0x24')]=function(_0x52d14,_0x5aeb62){return db['ZendeskConfiguration'][_0x3599('0x44')]({'where':{'id':_0x52d14[_0x3599('0x43')]['id']}})[_0x3599('0x23')](handleEntityNotFound(_0x5aeb62,null))[_0x3599('0x23')](removeEntity(_0x5aeb62,null))[_0x3599('0x42')](handleError(_0x5aeb62,null));};exports[_0x3599('0x47')]=function(_0x1b89d7,_0x193a14,_0x46e794){var _0x263eae={};var _0x49cf94={};var _0x49241a;var _0x2b54c0;return db[_0x3599('0x2a')][_0x3599('0x48')]({'where':{'id':_0x1b89d7[_0x3599('0x43')]['id']}})[_0x3599('0x23')](handleEntityNotFound(_0x193a14,null))[_0x3599('0x23')](function(_0x45c100){if(_0x45c100){_0x49241a=_0x45c100;_0x49cf94['model']=_[_0x3599('0x2e')](db[_0x3599('0x49')]['rawAttributes']);_0x49cf94[_0x3599('0x2f')]=_[_0x3599('0x2e')](_0x1b89d7[_0x3599('0x2f')]);_0x49cf94[_0x3599('0x30')]=_[_0x3599('0x31')](_0x49cf94[_0x3599('0x32')],_0x49cf94[_0x3599('0x2f')]);_0x263eae['attributes']=_[_0x3599('0x31')](_0x49cf94[_0x3599('0x32')],qs[_0x3599('0x33')](_0x1b89d7[_0x3599('0x2f')][_0x3599('0x33')]));_0x263eae['attributes']=_0x263eae[_0x3599('0x34')][_0x3599('0x35')]?_0x263eae[_0x3599('0x34')]:_0x49cf94[_0x3599('0x32')];_0x263eae[_0x3599('0x38')]=qs[_0x3599('0x39')](_0x1b89d7['query']['sort']);_0x263eae['where']=qs['filters'](_['pick'](_0x1b89d7[_0x3599('0x2f')],_0x49cf94[_0x3599('0x30')]));if(_0x1b89d7[_0x3599('0x2f')]['filter']){_0x263eae[_0x3599('0x3a')]=_[_0x3599('0x3d')](_0x263eae[_0x3599('0x3a')],{'$or':_['map'](_0x263eae[_0x3599('0x34')],function(_0x3a1686){var _0x12ffc0={};_0x12ffc0[_0x3a1686]={'$like':'%'+_0x1b89d7[_0x3599('0x2f')][_0x3599('0x3c')]+'%'};return _0x12ffc0;})});}_0x263eae=_['merge']({},_0x263eae,_0x1b89d7['options']);return _0x49241a[_0x3599('0x47')](_0x263eae);}})['then'](function(_0xf303c7){if(_0xf303c7){_0x2b54c0=_0xf303c7[_0x3599('0x35')];if(!_0x1b89d7[_0x3599('0x2f')]['hasOwnProperty'](_0x3599('0x37'))){_0x263eae['limit']=qs[_0x3599('0x1d')](_0x1b89d7[_0x3599('0x2f')][_0x3599('0x1d')]);_0x263eae[_0x3599('0x1c')]=qs[_0x3599('0x1c')](_0x1b89d7[_0x3599('0x2f')][_0x3599('0x1c')]);}return _0x49241a[_0x3599('0x47')](_0x263eae);}})['then'](function(_0x42d003){if(_0x42d003){return _0x42d003?{'count':_0x2b54c0,'rows':_0x42d003}:null;}})[_0x3599('0x23')](respondWithResult(_0x193a14,null))[_0x3599('0x42')](handleError(_0x193a14,null));};exports[_0x3599('0x4a')]=function(_0x59e035,_0x5ab698,_0x49059b){var _0xbc42ce={};var _0x3abbc7={};var _0x41380c;var _0x3eb2f7;return db[_0x3599('0x2a')][_0x3599('0x48')]({'where':{'id':_0x59e035[_0x3599('0x43')]['id']}})[_0x3599('0x23')](handleEntityNotFound(_0x5ab698,null))['then'](function(_0x205260){if(_0x205260){_0x41380c=_0x205260;_0x3abbc7[_0x3599('0x32')]=_[_0x3599('0x2e')](db[_0x3599('0x49')]['rawAttributes']);_0x3abbc7[_0x3599('0x2f')]=_[_0x3599('0x2e')](_0x59e035[_0x3599('0x2f')]);_0x3abbc7[_0x3599('0x30')]=_[_0x3599('0x31')](_0x3abbc7['model'],_0x3abbc7[_0x3599('0x2f')]);_0xbc42ce['attributes']=_[_0x3599('0x31')](_0x3abbc7[_0x3599('0x32')],qs[_0x3599('0x33')](_0x59e035['query'][_0x3599('0x33')]));_0xbc42ce[_0x3599('0x34')]=_0xbc42ce[_0x3599('0x34')][_0x3599('0x35')]?_0xbc42ce['attributes']:_0x3abbc7[_0x3599('0x32')];_0xbc42ce[_0x3599('0x38')]=qs[_0x3599('0x39')](_0x59e035[_0x3599('0x2f')][_0x3599('0x39')]);_0xbc42ce[_0x3599('0x3a')]=qs['filters'](_[_0x3599('0x3b')](_0x59e035['query'],_0x3abbc7[_0x3599('0x30')]));if(_0x59e035[_0x3599('0x2f')][_0x3599('0x3c')]){_0xbc42ce[_0x3599('0x3a')]=_['merge'](_0xbc42ce['where'],{'$or':_[_0x3599('0x29')](_0xbc42ce[_0x3599('0x34')],function(_0x30d225){var _0x3c45d7={};_0x3c45d7[_0x30d225]={'$like':'%'+_0x59e035[_0x3599('0x2f')][_0x3599('0x3c')]+'%'};return _0x3c45d7;})});}_0xbc42ce=_[_0x3599('0x3d')]({},_0xbc42ce,_0x59e035['options']);return _0x41380c[_0x3599('0x4a')](_0xbc42ce);}})[_0x3599('0x23')](function(_0x2f6a35){if(_0x2f6a35){_0x3eb2f7=_0x2f6a35[_0x3599('0x35')];if(!_0x59e035[_0x3599('0x2f')]['hasOwnProperty'](_0x3599('0x37'))){_0xbc42ce[_0x3599('0x1d')]=qs[_0x3599('0x1d')](_0x59e035[_0x3599('0x2f')][_0x3599('0x1d')]);_0xbc42ce['offset']=qs[_0x3599('0x1c')](_0x59e035[_0x3599('0x2f')]['offset']);}return _0x41380c[_0x3599('0x4a')](_0xbc42ce);}})[_0x3599('0x23')](function(_0x519eff){if(_0x519eff){return _0x519eff?{'count':_0x3eb2f7,'rows':_0x519eff}:null;}})['then'](respondWithResult(_0x5ab698,null))[_0x3599('0x42')](handleError(_0x5ab698,null));};exports[_0x3599('0x4b')]=function(_0x168179,_0x505969,_0x35b6f4){var _0x5f1d1c={};var _0x12aa45={};var _0xfe4f51;var _0x5b3032;return db[_0x3599('0x2a')][_0x3599('0x48')]({'where':{'id':_0x168179[_0x3599('0x43')]['id']}})[_0x3599('0x23')](handleEntityNotFound(_0x505969,null))['then'](function(_0x3d7802){if(_0x3d7802){_0xfe4f51=_0x3d7802;_0x12aa45[_0x3599('0x32')]=_[_0x3599('0x2e')](db[_0x3599('0x49')][_0x3599('0x2b')]);_0x12aa45[_0x3599('0x2f')]=_[_0x3599('0x2e')](_0x168179[_0x3599('0x2f')]);_0x12aa45['filters']=_[_0x3599('0x31')](_0x12aa45[_0x3599('0x32')],_0x12aa45['query']);_0x5f1d1c[_0x3599('0x34')]=_['intersection'](_0x12aa45['model'],qs[_0x3599('0x33')](_0x168179[_0x3599('0x2f')]['fields']));_0x5f1d1c[_0x3599('0x34')]=_0x5f1d1c[_0x3599('0x34')][_0x3599('0x35')]?_0x5f1d1c['attributes']:_0x12aa45['model'];_0x5f1d1c['order']=qs[_0x3599('0x39')](_0x168179[_0x3599('0x2f')][_0x3599('0x39')]);_0x5f1d1c[_0x3599('0x3a')]=qs[_0x3599('0x30')](_[_0x3599('0x3b')](_0x168179[_0x3599('0x2f')],_0x12aa45[_0x3599('0x30')]));if(_0x168179[_0x3599('0x2f')][_0x3599('0x3c')]){_0x5f1d1c['where']=_[_0x3599('0x3d')](_0x5f1d1c['where'],{'$or':_[_0x3599('0x29')](_0x5f1d1c[_0x3599('0x34')],function(_0x368656){var _0x2a11a2={};_0x2a11a2[_0x368656]={'$like':'%'+_0x168179[_0x3599('0x2f')][_0x3599('0x3c')]+'%'};return _0x2a11a2;})});}_0x5f1d1c=_[_0x3599('0x3d')]({},_0x5f1d1c,_0x168179[_0x3599('0x3f')]);return _0xfe4f51[_0x3599('0x4b')](_0x5f1d1c);}})[_0x3599('0x23')](function(_0x71abed){if(_0x71abed){_0x5b3032=_0x71abed['length'];if(!_0x168179[_0x3599('0x2f')][_0x3599('0x36')](_0x3599('0x37'))){_0x5f1d1c[_0x3599('0x1d')]=qs[_0x3599('0x1d')](_0x168179['query']['limit']);_0x5f1d1c['offset']=qs['offset'](_0x168179[_0x3599('0x2f')][_0x3599('0x1c')]);}return _0xfe4f51[_0x3599('0x4b')](_0x5f1d1c);}})['then'](function(_0x1aca91){if(_0x1aca91){return _0x1aca91?{'count':_0x5b3032,'rows':_0x1aca91}:null;}})['then'](respondWithResult(_0x505969,null))['catch'](handleError(_0x505969,null));};exports[_0x3599('0x4c')]=function(_0x4311e2,_0x5bfe54,_0x1348e2){var _0x3e8b74={};var _0x37f01d={};var _0x3a5d7e;var _0x47c9ed;return db[_0x3599('0x2a')][_0x3599('0x48')]({'where':{'id':_0x4311e2[_0x3599('0x43')]['id']}})[_0x3599('0x23')](handleEntityNotFound(_0x5bfe54,null))[_0x3599('0x23')](function(_0x897375){if(_0x897375){_0x3a5d7e=_0x897375;_0x37f01d[_0x3599('0x32')]=_[_0x3599('0x2e')](db['Tag'][_0x3599('0x2b')]);_0x37f01d[_0x3599('0x2f')]=_[_0x3599('0x2e')](_0x4311e2[_0x3599('0x2f')]);_0x37f01d[_0x3599('0x30')]=_['intersection'](_0x37f01d[_0x3599('0x32')],_0x37f01d['query']);_0x3e8b74[_0x3599('0x34')]=_[_0x3599('0x31')](_0x37f01d['model'],qs[_0x3599('0x33')](_0x4311e2[_0x3599('0x2f')][_0x3599('0x33')]));_0x3e8b74[_0x3599('0x34')]=_0x3e8b74[_0x3599('0x34')]['length']?_0x3e8b74['attributes']:_0x37f01d[_0x3599('0x32')];_0x3e8b74['order']=qs[_0x3599('0x39')](_0x4311e2['query']['sort']);_0x3e8b74[_0x3599('0x3a')]=qs[_0x3599('0x30')](_[_0x3599('0x3b')](_0x4311e2[_0x3599('0x2f')],_0x37f01d[_0x3599('0x30')]));if(_0x4311e2[_0x3599('0x2f')]['filter']){_0x3e8b74['where']=_['merge'](_0x3e8b74['where'],{'$or':_[_0x3599('0x29')](_0x3e8b74[_0x3599('0x34')],function(_0x5added){var _0x4720ad={};_0x4720ad[_0x5added]={'$like':'%'+_0x4311e2[_0x3599('0x2f')][_0x3599('0x3c')]+'%'};return _0x4720ad;})});}_0x3e8b74=_['merge']({},_0x3e8b74,_0x4311e2['options']);return _0x3a5d7e[_0x3599('0x4c')](_0x3e8b74);}})[_0x3599('0x23')](function(_0x437356){if(_0x437356){_0x47c9ed=_0x437356[_0x3599('0x35')];if(!_0x4311e2[_0x3599('0x2f')][_0x3599('0x36')](_0x3599('0x37'))){_0x3e8b74[_0x3599('0x1d')]=qs[_0x3599('0x1d')](_0x4311e2[_0x3599('0x2f')][_0x3599('0x1d')]);_0x3e8b74['offset']=qs[_0x3599('0x1c')](_0x4311e2[_0x3599('0x2f')][_0x3599('0x1c')]);}return _0x3a5d7e['getTags'](_0x3e8b74);}})['then'](function(_0x3cd8c9){if(_0x3cd8c9){return _0x3cd8c9?{'count':_0x47c9ed,'rows':_0x3cd8c9}:null;}})[_0x3599('0x23')](respondWithResult(_0x5bfe54,null))[_0x3599('0x42')](handleError(_0x5bfe54,null));};exports[_0x3599('0x4d')]=function(_0x389e5e,_0x31c4a8,_0x55d94e){if(_0x389e5e[_0x3599('0x4e')]['id']){delete _0x389e5e[_0x3599('0x4e')]['id'];}return db[_0x3599('0x2a')][_0x3599('0x48')]({'where':{'id':_0x389e5e[_0x3599('0x43')]['id']}})[_0x3599('0x23')](handleEntityNotFound(_0x31c4a8,null))[_0x3599('0x23')](function(_0x22fad9){if(_0x22fad9){return _0x22fad9[_0x3599('0x4d')](_0x389e5e[_0x3599('0x4e')][_0x3599('0x4f')]||[]);}return null;})[_0x3599('0x23')](respondWithResult(_0x31c4a8,null))['catch'](handleError(_0x31c4a8,null));}; \ No newline at end of file +var _0x175e=['offset','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','count','includeAll','include','catch','params','keys','find','create','update','body','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','limit','undefined'];(function(_0x5e81c5,_0xe6522f){var _0x38dcd0=function(_0x593065){while(--_0x593065){_0x5e81c5['push'](_0x5e81c5['shift']());}};_0x38dcd0(++_0xe6522f);}(_0x175e,0x129));var _0xe175=function(_0x156374,_0x12e5dd){_0x156374=_0x156374-0x0;var _0x4d709e=_0x175e[_0x156374];return _0x4d709e;};'use strict';var emlformat=require(_0xe175('0x0'));var rimraf=require(_0xe175('0x1'));var zipdir=require(_0xe175('0x2'));var jsonpatch=require(_0xe175('0x3'));var rp=require(_0xe175('0x4'));var moment=require(_0xe175('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe175('0x6'));var path=require('path');var sox=require(_0xe175('0x7'));var csv=require(_0xe175('0x8'));var ejs=require(_0xe175('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe175('0xa'));var squel=require(_0xe175('0xb'));var crypto=require(_0xe175('0xc'));var jsforce=require(_0xe175('0xd'));var deskjs=require(_0xe175('0xe'));var toCsv=require(_0xe175('0x8'));var querystring=require(_0xe175('0xf'));var Papa=require(_0xe175('0x10'));var Redis=require(_0xe175('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe175('0x12'));var as=require(_0xe175('0x13'));var hardwareService=require(_0xe175('0x14'));var logger=require(_0xe175('0x15'))(_0xe175('0x16'));var utils=require(_0xe175('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe175('0x18'));var db=require(_0xe175('0x19'))['db'];function respondWithStatusCode(_0x28a394,_0x5738e7){_0x5738e7=_0x5738e7||0xcc;return function(_0x228de0){if(_0x228de0){return _0x28a394['sendStatus'](_0x5738e7);}return _0x28a394[_0xe175('0x1a')](_0x5738e7)[_0xe175('0x1b')]();};}function respondWithResult(_0x432e2a,_0x2c019e){_0x2c019e=_0x2c019e||0xc8;return function(_0x2e18dc){if(_0x2e18dc){return _0x432e2a[_0xe175('0x1a')](_0x2c019e)[_0xe175('0x1c')](_0x2e18dc);}};}function respondWithFilteredResult(_0x386478,_0x17380c){return function(_0x2cfeff){if(_0x2cfeff){var _0x41d55d=typeof _0x17380c['offset']==='undefined'&&typeof _0x17380c[_0xe175('0x1d')]===_0xe175('0x1e');var _0x4dc392=_0x2cfeff['count'];var _0x2ff658=_0x41d55d?0x0:_0x17380c['offset'];var _0x4d8629=_0x41d55d?_0x2cfeff['count']:_0x17380c[_0xe175('0x1f')]+_0x17380c[_0xe175('0x1d')];var _0x3d48f6;if(_0x4d8629>=_0x4dc392){_0x4d8629=_0x4dc392;_0x3d48f6=0xc8;}else{_0x3d48f6=0xce;}_0x386478[_0xe175('0x1a')](_0x3d48f6);return _0x386478[_0xe175('0x20')](_0xe175('0x21'),_0x2ff658+'-'+_0x4d8629+'/'+_0x4dc392)[_0xe175('0x1c')](_0x2cfeff);}return null;};}function patchUpdates(_0x9340cc){return function(_0x356812){try{jsonpatch['apply'](_0x356812,_0x9340cc,!![]);}catch(_0x295c90){return BPromise[_0xe175('0x22')](_0x295c90);}return _0x356812[_0xe175('0x23')]();};}function saveUpdates(_0x2f2814,_0x438080){return function(_0x3fe5fe){if(_0x3fe5fe){return _0x3fe5fe['update'](_0x2f2814)[_0xe175('0x24')](function(_0x5b1864){return _0x5b1864;});}return null;};}function removeEntity(_0x28566e,_0x1537c7){return function(_0x26e30e){if(_0x26e30e){return _0x26e30e[_0xe175('0x25')]()[_0xe175('0x24')](function(){_0x28566e[_0xe175('0x1a')](0xcc)[_0xe175('0x1b')]();});}};}function handleEntityNotFound(_0x2af7ae,_0x1f5d6a){return function(_0x2ffac8){if(!_0x2ffac8){_0x2af7ae[_0xe175('0x26')](0x194);}return _0x2ffac8;};}function handleError(_0x11d447,_0x186b63){_0x186b63=_0x186b63||0x1f4;return function(_0x3fb0f5){logger['error'](_0x3fb0f5[_0xe175('0x27')]);if(_0x3fb0f5['name']){delete _0x3fb0f5[_0xe175('0x28')];}_0x11d447['status'](_0x186b63)[_0xe175('0x29')](_0x3fb0f5);};}exports[_0xe175('0x2a')]=function(_0x4f99a3,_0x496448){var _0x1ea694={},_0x3cec06={},_0x20ff5f={'count':0x0,'rows':[]};var _0x10e594=_[_0xe175('0x2b')](db[_0xe175('0x2c')][_0xe175('0x2d')],function(_0x5ba6a1){return{'name':_0x5ba6a1[_0xe175('0x2e')],'type':_0x5ba6a1[_0xe175('0x2f')]['key']};});_0x3cec06[_0xe175('0x30')]=_[_0xe175('0x2b')](_0x10e594,_0xe175('0x28'));_0x3cec06['query']=_['keys'](_0x4f99a3[_0xe175('0x31')]);_0x3cec06[_0xe175('0x32')]=_[_0xe175('0x33')](_0x3cec06[_0xe175('0x30')],_0x3cec06[_0xe175('0x31')]);_0x1ea694[_0xe175('0x34')]=_[_0xe175('0x33')](_0x3cec06[_0xe175('0x30')],qs[_0xe175('0x35')](_0x4f99a3[_0xe175('0x31')]['fields']));_0x1ea694[_0xe175('0x34')]=_0x1ea694['attributes'][_0xe175('0x36')]?_0x1ea694[_0xe175('0x34')]:_0x3cec06[_0xe175('0x30')];if(!_0x4f99a3[_0xe175('0x31')][_0xe175('0x37')](_0xe175('0x38'))){_0x1ea694['limit']=qs[_0xe175('0x1d')](_0x4f99a3[_0xe175('0x31')]['limit']);_0x1ea694[_0xe175('0x1f')]=qs[_0xe175('0x1f')](_0x4f99a3['query']['offset']);}_0x1ea694['order']=qs[_0xe175('0x39')](_0x4f99a3['query'][_0xe175('0x39')]);_0x1ea694['where']=qs[_0xe175('0x32')](_[_0xe175('0x3a')](_0x4f99a3['query'],_0x3cec06[_0xe175('0x32')]),_0x10e594);if(_0x4f99a3[_0xe175('0x31')][_0xe175('0x3b')]){_0x1ea694[_0xe175('0x3c')]=_[_0xe175('0x3d')](_0x1ea694['where'],{'$or':_[_0xe175('0x2b')](_0x10e594,function(_0x282011){if(_0x282011[_0xe175('0x2f')]!=='VIRTUAL'){var _0x47e043={};_0x47e043[_0x282011[_0xe175('0x28')]]={'$like':'%'+_0x4f99a3['query'][_0xe175('0x3b')]+'%'};return _0x47e043;}})});}_0x1ea694=_[_0xe175('0x3d')]({},_0x1ea694,_0x4f99a3[_0xe175('0x3e')]);var _0x5568d9={'where':_0x1ea694['where']};return db['ZendeskConfiguration']['count'](_0x5568d9)[_0xe175('0x24')](function(_0x5e620b){_0x20ff5f[_0xe175('0x3f')]=_0x5e620b;if(_0x4f99a3['query'][_0xe175('0x40')]){_0x1ea694[_0xe175('0x41')]=[{'all':!![]}];}return db[_0xe175('0x2c')]['findAll'](_0x1ea694);})[_0xe175('0x24')](function(_0x198ec1){_0x20ff5f['rows']=_0x198ec1;return _0x20ff5f;})[_0xe175('0x24')](respondWithFilteredResult(_0x496448,_0x1ea694))[_0xe175('0x42')](handleError(_0x496448,null));};exports['show']=function(_0x4ebbb5,_0x53b6dd){var _0x49507e={'raw':![],'where':{'id':_0x4ebbb5[_0xe175('0x43')]['id']}},_0x1e8957={};_0x1e8957[_0xe175('0x30')]=_['keys'](db[_0xe175('0x2c')][_0xe175('0x2d')]);_0x1e8957[_0xe175('0x31')]=_[_0xe175('0x44')](_0x4ebbb5[_0xe175('0x31')]);_0x1e8957[_0xe175('0x32')]=_['intersection'](_0x1e8957['model'],_0x1e8957['query']);_0x49507e[_0xe175('0x34')]=_[_0xe175('0x33')](_0x1e8957[_0xe175('0x30')],qs[_0xe175('0x35')](_0x4ebbb5[_0xe175('0x31')][_0xe175('0x35')]));_0x49507e[_0xe175('0x34')]=_0x49507e['attributes'][_0xe175('0x36')]?_0x49507e[_0xe175('0x34')]:_0x1e8957[_0xe175('0x30')];if(_0x4ebbb5[_0xe175('0x31')][_0xe175('0x40')]){_0x49507e['include']=[{'all':!![]}];}_0x49507e=_[_0xe175('0x3d')]({},_0x49507e,_0x4ebbb5['options']);return db[_0xe175('0x2c')][_0xe175('0x45')](_0x49507e)[_0xe175('0x24')](handleEntityNotFound(_0x53b6dd,null))[_0xe175('0x24')](respondWithResult(_0x53b6dd,null))[_0xe175('0x42')](handleError(_0x53b6dd,null));};exports[_0xe175('0x46')]=function(_0x10d08a,_0x46315c){return db[_0xe175('0x2c')][_0xe175('0x46')](_0x10d08a['body'],{})['then'](respondWithResult(_0x46315c,0xc9))[_0xe175('0x42')](handleError(_0x46315c,null));};exports[_0xe175('0x47')]=function(_0x21759b,_0x1753cd){if(_0x21759b[_0xe175('0x48')]['id']){delete _0x21759b[_0xe175('0x48')]['id'];}return db[_0xe175('0x2c')][_0xe175('0x45')]({'where':{'id':_0x21759b[_0xe175('0x43')]['id']}})[_0xe175('0x24')](handleEntityNotFound(_0x1753cd,null))[_0xe175('0x24')](saveUpdates(_0x21759b[_0xe175('0x48')],null))['then'](respondWithResult(_0x1753cd,null))['catch'](handleError(_0x1753cd,null));};exports[_0xe175('0x25')]=function(_0x5bdcf8,_0x428d01){return db['ZendeskConfiguration'][_0xe175('0x45')]({'where':{'id':_0x5bdcf8[_0xe175('0x43')]['id']}})[_0xe175('0x24')](handleEntityNotFound(_0x428d01,null))[_0xe175('0x24')](removeEntity(_0x428d01,null))[_0xe175('0x42')](handleError(_0x428d01,null));};exports[_0xe175('0x49')]=function(_0x590963,_0x23e74e,_0x2ad0cb){var _0x53b54f={};var _0xee3a8a={};var _0x5f5353;var _0x2e0a4c;return db[_0xe175('0x2c')][_0xe175('0x4a')]({'where':{'id':_0x590963[_0xe175('0x43')]['id']}})[_0xe175('0x24')](handleEntityNotFound(_0x23e74e,null))[_0xe175('0x24')](function(_0x15b81f){if(_0x15b81f){_0x5f5353=_0x15b81f;_0xee3a8a['model']=_[_0xe175('0x44')](db[_0xe175('0x4b')][_0xe175('0x2d')]);_0xee3a8a[_0xe175('0x31')]=_['keys'](_0x590963[_0xe175('0x31')]);_0xee3a8a[_0xe175('0x32')]=_[_0xe175('0x33')](_0xee3a8a[_0xe175('0x30')],_0xee3a8a['query']);_0x53b54f[_0xe175('0x34')]=_['intersection'](_0xee3a8a[_0xe175('0x30')],qs[_0xe175('0x35')](_0x590963[_0xe175('0x31')][_0xe175('0x35')]));_0x53b54f[_0xe175('0x34')]=_0x53b54f[_0xe175('0x34')]['length']?_0x53b54f[_0xe175('0x34')]:_0xee3a8a[_0xe175('0x30')];_0x53b54f[_0xe175('0x4c')]=qs[_0xe175('0x39')](_0x590963['query'][_0xe175('0x39')]);_0x53b54f[_0xe175('0x3c')]=qs['filters'](_['pick'](_0x590963['query'],_0xee3a8a[_0xe175('0x32')]));if(_0x590963[_0xe175('0x31')][_0xe175('0x3b')]){_0x53b54f[_0xe175('0x3c')]=_[_0xe175('0x3d')](_0x53b54f['where'],{'$or':_[_0xe175('0x2b')](_0x53b54f[_0xe175('0x34')],function(_0x4d3186){var _0x18b03f={};_0x18b03f[_0x4d3186]={'$like':'%'+_0x590963[_0xe175('0x31')][_0xe175('0x3b')]+'%'};return _0x18b03f;})});}_0x53b54f=_[_0xe175('0x3d')]({},_0x53b54f,_0x590963[_0xe175('0x3e')]);return _0x5f5353[_0xe175('0x49')](_0x53b54f);}})[_0xe175('0x24')](function(_0x19116b){if(_0x19116b){_0x2e0a4c=_0x19116b[_0xe175('0x36')];if(!_0x590963[_0xe175('0x31')][_0xe175('0x37')](_0xe175('0x38'))){_0x53b54f[_0xe175('0x1d')]=qs[_0xe175('0x1d')](_0x590963['query'][_0xe175('0x1d')]);_0x53b54f['offset']=qs['offset'](_0x590963['query'][_0xe175('0x1f')]);}return _0x5f5353[_0xe175('0x49')](_0x53b54f);}})[_0xe175('0x24')](function(_0x550d60){if(_0x550d60){return _0x550d60?{'count':_0x2e0a4c,'rows':_0x550d60}:null;}})['then'](respondWithResult(_0x23e74e,null))[_0xe175('0x42')](handleError(_0x23e74e,null));};exports[_0xe175('0x4d')]=function(_0x2c1ddb,_0x2c8a31,_0x26b877){var _0x5a57c5={};var _0x6473d8={};var _0x3d0b02;var _0x5dd638;return db['ZendeskConfiguration'][_0xe175('0x4a')]({'where':{'id':_0x2c1ddb['params']['id']}})[_0xe175('0x24')](handleEntityNotFound(_0x2c8a31,null))[_0xe175('0x24')](function(_0x444232){if(_0x444232){_0x3d0b02=_0x444232;_0x6473d8[_0xe175('0x30')]=_[_0xe175('0x44')](db['ZendeskField'][_0xe175('0x2d')]);_0x6473d8[_0xe175('0x31')]=_[_0xe175('0x44')](_0x2c1ddb['query']);_0x6473d8[_0xe175('0x32')]=_[_0xe175('0x33')](_0x6473d8[_0xe175('0x30')],_0x6473d8[_0xe175('0x31')]);_0x5a57c5['attributes']=_[_0xe175('0x33')](_0x6473d8['model'],qs['fields'](_0x2c1ddb[_0xe175('0x31')][_0xe175('0x35')]));_0x5a57c5[_0xe175('0x34')]=_0x5a57c5['attributes']['length']?_0x5a57c5['attributes']:_0x6473d8['model'];_0x5a57c5[_0xe175('0x4c')]=qs[_0xe175('0x39')](_0x2c1ddb[_0xe175('0x31')]['sort']);_0x5a57c5['where']=qs[_0xe175('0x32')](_[_0xe175('0x3a')](_0x2c1ddb[_0xe175('0x31')],_0x6473d8[_0xe175('0x32')]));if(_0x2c1ddb[_0xe175('0x31')]['filter']){_0x5a57c5[_0xe175('0x3c')]=_[_0xe175('0x3d')](_0x5a57c5['where'],{'$or':_[_0xe175('0x2b')](_0x5a57c5[_0xe175('0x34')],function(_0x45d628){var _0x5c6e01={};_0x5c6e01[_0x45d628]={'$like':'%'+_0x2c1ddb[_0xe175('0x31')]['filter']+'%'};return _0x5c6e01;})});}_0x5a57c5=_[_0xe175('0x3d')]({},_0x5a57c5,_0x2c1ddb[_0xe175('0x3e')]);return _0x3d0b02[_0xe175('0x4d')](_0x5a57c5);}})[_0xe175('0x24')](function(_0x4e6da9){if(_0x4e6da9){_0x5dd638=_0x4e6da9[_0xe175('0x36')];if(!_0x2c1ddb[_0xe175('0x31')][_0xe175('0x37')](_0xe175('0x38'))){_0x5a57c5[_0xe175('0x1d')]=qs[_0xe175('0x1d')](_0x2c1ddb[_0xe175('0x31')][_0xe175('0x1d')]);_0x5a57c5[_0xe175('0x1f')]=qs['offset'](_0x2c1ddb[_0xe175('0x31')]['offset']);}return _0x3d0b02['getSubjects'](_0x5a57c5);}})['then'](function(_0x285570){if(_0x285570){return _0x285570?{'count':_0x5dd638,'rows':_0x285570}:null;}})[_0xe175('0x24')](respondWithResult(_0x2c8a31,null))[_0xe175('0x42')](handleError(_0x2c8a31,null));};exports[_0xe175('0x4e')]=function(_0xddd043,_0xe67184,_0x143ebe){var _0x56d04a={};var _0x55e879={};var _0x17ce4b;var _0x382144;return db['ZendeskConfiguration'][_0xe175('0x4a')]({'where':{'id':_0xddd043[_0xe175('0x43')]['id']}})[_0xe175('0x24')](handleEntityNotFound(_0xe67184,null))[_0xe175('0x24')](function(_0x32439b){if(_0x32439b){_0x17ce4b=_0x32439b;_0x55e879[_0xe175('0x30')]=_[_0xe175('0x44')](db[_0xe175('0x4b')][_0xe175('0x2d')]);_0x55e879[_0xe175('0x31')]=_[_0xe175('0x44')](_0xddd043[_0xe175('0x31')]);_0x55e879[_0xe175('0x32')]=_['intersection'](_0x55e879[_0xe175('0x30')],_0x55e879['query']);_0x56d04a[_0xe175('0x34')]=_[_0xe175('0x33')](_0x55e879[_0xe175('0x30')],qs['fields'](_0xddd043[_0xe175('0x31')][_0xe175('0x35')]));_0x56d04a[_0xe175('0x34')]=_0x56d04a[_0xe175('0x34')]['length']?_0x56d04a[_0xe175('0x34')]:_0x55e879[_0xe175('0x30')];_0x56d04a['order']=qs['sort'](_0xddd043[_0xe175('0x31')][_0xe175('0x39')]);_0x56d04a[_0xe175('0x3c')]=qs[_0xe175('0x32')](_['pick'](_0xddd043[_0xe175('0x31')],_0x55e879[_0xe175('0x32')]));if(_0xddd043['query'][_0xe175('0x3b')]){_0x56d04a[_0xe175('0x3c')]=_['merge'](_0x56d04a[_0xe175('0x3c')],{'$or':_['map'](_0x56d04a[_0xe175('0x34')],function(_0x270101){var _0x2f48a5={};_0x2f48a5[_0x270101]={'$like':'%'+_0xddd043[_0xe175('0x31')][_0xe175('0x3b')]+'%'};return _0x2f48a5;})});}_0x56d04a=_[_0xe175('0x3d')]({},_0x56d04a,_0xddd043[_0xe175('0x3e')]);return _0x17ce4b[_0xe175('0x4e')](_0x56d04a);}})[_0xe175('0x24')](function(_0x1ea4a1){if(_0x1ea4a1){_0x382144=_0x1ea4a1[_0xe175('0x36')];if(!_0xddd043[_0xe175('0x31')][_0xe175('0x37')](_0xe175('0x38'))){_0x56d04a['limit']=qs[_0xe175('0x1d')](_0xddd043[_0xe175('0x31')][_0xe175('0x1d')]);_0x56d04a[_0xe175('0x1f')]=qs[_0xe175('0x1f')](_0xddd043['query'][_0xe175('0x1f')]);}return _0x17ce4b[_0xe175('0x4e')](_0x56d04a);}})[_0xe175('0x24')](function(_0x43c3a6){if(_0x43c3a6){return _0x43c3a6?{'count':_0x382144,'rows':_0x43c3a6}:null;}})[_0xe175('0x24')](respondWithResult(_0xe67184,null))[_0xe175('0x42')](handleError(_0xe67184,null));};exports[_0xe175('0x4f')]=function(_0x223e24,_0x6b46c8,_0x457b9d){var _0x27dc1d={};var _0x202aa9={};var _0x439925;var _0x29c537;return db[_0xe175('0x2c')][_0xe175('0x4a')]({'where':{'id':_0x223e24['params']['id']}})['then'](handleEntityNotFound(_0x6b46c8,null))[_0xe175('0x24')](function(_0x406f93){if(_0x406f93){_0x439925=_0x406f93;_0x202aa9[_0xe175('0x30')]=_[_0xe175('0x44')](db['Tag']['rawAttributes']);_0x202aa9['query']=_[_0xe175('0x44')](_0x223e24['query']);_0x202aa9[_0xe175('0x32')]=_[_0xe175('0x33')](_0x202aa9[_0xe175('0x30')],_0x202aa9[_0xe175('0x31')]);_0x27dc1d[_0xe175('0x34')]=_['intersection'](_0x202aa9[_0xe175('0x30')],qs[_0xe175('0x35')](_0x223e24[_0xe175('0x31')][_0xe175('0x35')]));_0x27dc1d[_0xe175('0x34')]=_0x27dc1d[_0xe175('0x34')][_0xe175('0x36')]?_0x27dc1d[_0xe175('0x34')]:_0x202aa9[_0xe175('0x30')];_0x27dc1d[_0xe175('0x4c')]=qs[_0xe175('0x39')](_0x223e24[_0xe175('0x31')][_0xe175('0x39')]);_0x27dc1d[_0xe175('0x3c')]=qs['filters'](_['pick'](_0x223e24[_0xe175('0x31')],_0x202aa9[_0xe175('0x32')]));if(_0x223e24[_0xe175('0x31')]['filter']){_0x27dc1d[_0xe175('0x3c')]=_[_0xe175('0x3d')](_0x27dc1d['where'],{'$or':_[_0xe175('0x2b')](_0x27dc1d[_0xe175('0x34')],function(_0x551371){var _0x3c514b={};_0x3c514b[_0x551371]={'$like':'%'+_0x223e24[_0xe175('0x31')]['filter']+'%'};return _0x3c514b;})});}_0x27dc1d=_[_0xe175('0x3d')]({},_0x27dc1d,_0x223e24[_0xe175('0x3e')]);return _0x439925[_0xe175('0x4f')](_0x27dc1d);}})['then'](function(_0x28fc08){if(_0x28fc08){_0x29c537=_0x28fc08['length'];if(!_0x223e24[_0xe175('0x31')][_0xe175('0x37')]('nolimit')){_0x27dc1d['limit']=qs['limit'](_0x223e24[_0xe175('0x31')]['limit']);_0x27dc1d['offset']=qs[_0xe175('0x1f')](_0x223e24['query'][_0xe175('0x1f')]);}return _0x439925['getTags'](_0x27dc1d);}})[_0xe175('0x24')](function(_0x589e57){if(_0x589e57){return _0x589e57?{'count':_0x29c537,'rows':_0x589e57}:null;}})[_0xe175('0x24')](respondWithResult(_0x6b46c8,null))['catch'](handleError(_0x6b46c8,null));};exports[_0xe175('0x50')]=function(_0x47567d,_0x100a99,_0x142b50){if(_0x47567d[_0xe175('0x48')]['id']){delete _0x47567d[_0xe175('0x48')]['id'];}return db['ZendeskConfiguration'][_0xe175('0x4a')]({'where':{'id':_0x47567d[_0xe175('0x43')]['id']}})[_0xe175('0x24')](handleEntityNotFound(_0x100a99,null))[_0xe175('0x24')](function(_0x2b8a26){if(_0x2b8a26){return _0x2b8a26['setTags'](_0x47567d['body'][_0xe175('0x51')]||[]);}return null;})['then'](respondWithResult(_0x100a99,null))[_0xe175('0x42')](handleError(_0x100a99,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 9debbe9..f0aaf87 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 _0x1c7c=['./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0xe69bf1,_0x487cbc){var _0x1259d1=function(_0x5e610d){while(--_0x5e610d){_0xe69bf1['push'](_0xe69bf1['shift']());}};_0x1259d1(++_0x487cbc);}(_0x1c7c,0x164));var _0xc1c7=function(_0x1e4e41,_0x18b504){_0x1e4e41=_0x1e4e41-0x0;var _0x49e0ac=_0x1c7c[_0x1e4e41];return _0x49e0ac;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var logger=require(_0xc1c7('0x2'))(_0xc1c7('0x3'));var moment=require('moment');var BPromise=require(_0xc1c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1c7('0x5'));var rimraf=require(_0xc1c7('0x6'));var config=require(_0xc1c7('0x7'));var attributes=require(_0xc1c7('0x8'));module[_0xc1c7('0x9')]=function(_0x364dde,_0x1f3e21){return _0x364dde[_0xc1c7('0xa')](_0xc1c7('0xb'),attributes,{'tableName':_0xc1c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefda=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment','request-promise','path','rimraf'];(function(_0x259472,_0x44ac34){var _0x3933a4=function(_0x4c02fa){while(--_0x4c02fa){_0x259472['push'](_0x259472['shift']());}};_0x3933a4(++_0x44ac34);}(_0xefda,0x96));var _0xaefd=function(_0x1811a7,_0x7cf939){_0x1811a7=_0x1811a7-0x0;var _0x4fb76f=_0xefda[_0x1811a7];return _0x4fb76f;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index b33337c..4a177e5 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 _0x0f47=['stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','catch','lodash','util','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0x0f47,0x195));var _0x70f4=function(_0x3349ed,_0x4fe6f8){_0x3349ed=_0x3349ed-0x0;var _0x2f5c54=_0x0f47[_0x3349ed];return _0x2f5c54;};'use strict';var _=require(_0x70f4('0x0'));var util=require(_0x70f4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70f4('0x2'));var db=require(_0x70f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x70f4('0x4'));var config=require('../../config/environment');var jayson=require(_0x70f4('0x5'));var client=jayson[_0x70f4('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbe9057,_0x5fac48,_0xa36660){return new BPromise(function(_0x2ef66d,_0x32603e){return client[_0x70f4('0x7')](_0xbe9057,_0xa36660)[_0x70f4('0x8')](function(_0x4a5615){logger[_0x70f4('0x9')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5fac48,_0x70f4('0xa'));logger[_0x70f4('0xb')](_0x70f4('0xc'),_0x5fac48,_0x70f4('0xa'),JSON[_0x70f4('0xd')](_0x4a5615));if(_0x4a5615[_0x70f4('0xe')]){if(_0x4a5615['error'][_0x70f4('0xf')]===0x1f4){logger[_0x70f4('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5fac48,_0x4a5615[_0x70f4('0xe')][_0x70f4('0x10')]);return _0x32603e(_0x4a5615[_0x70f4('0xe')][_0x70f4('0x10')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5fac48,_0x4a5615[_0x70f4('0xe')]['message']);return _0x2ef66d(_0x4a5615[_0x70f4('0xe')]['message']);}else{logger[_0x70f4('0x9')](_0x70f4('0x11'),_0x5fac48,'request\x20sent');_0x2ef66d(_0x4a5615['result']['message']);}})[_0x70f4('0x12')](function(_0x2241a6){logger[_0x70f4('0xe')](_0x70f4('0x11'),_0x5fac48,_0x2241a6);_0x32603e(_0x2241a6);});});} \ No newline at end of file +var _0xd843=['debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xd843,0x85));var _0x3d84=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0xd843[_0x2867d8];return _0x3b8176;};'use strict';var _=require(_0x3d84('0x0'));var util=require('util');var moment=require(_0x3d84('0x1'));var BPromise=require(_0x3d84('0x2'));var rs=require(_0x3d84('0x3'));var fs=require('fs');var Redis=require(_0x3d84('0x4'));var db=require(_0x3d84('0x5'))['db'];var utils=require(_0x3d84('0x6'));var logger=require('../../config/logger')(_0x3d84('0x7'));var config=require('../../config/environment');var jayson=require(_0x3d84('0x8'));var client=jayson[_0x3d84('0x9')][_0x3d84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7b7e,_0x4763b7,_0x2ea09b){return new BPromise(function(_0x13aacc,_0x20a73e){return client['request'](_0x3f7b7e,_0x2ea09b)[_0x3d84('0xb')](function(_0x5dec41){logger[_0x3d84('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4763b7,_0x3d84('0xd'));logger[_0x3d84('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4763b7,_0x3d84('0xd'),JSON[_0x3d84('0xf')](_0x5dec41));if(_0x5dec41[_0x3d84('0x10')]){if(_0x5dec41['error'][_0x3d84('0x11')]===0x1f4){logger[_0x3d84('0x10')](_0x3d84('0x12'),_0x4763b7,_0x5dec41['error'][_0x3d84('0x13')]);return _0x20a73e(_0x5dec41[_0x3d84('0x10')][_0x3d84('0x13')]);}logger[_0x3d84('0x10')](_0x3d84('0x12'),_0x4763b7,_0x5dec41[_0x3d84('0x10')][_0x3d84('0x13')]);return _0x13aacc(_0x5dec41['error'][_0x3d84('0x13')]);}else{logger[_0x3d84('0xc')](_0x3d84('0x12'),_0x4763b7,_0x3d84('0xd'));_0x13aacc(_0x5dec41[_0x3d84('0x14')][_0x3d84('0x13')]);}})['catch'](function(_0x52a74c){logger[_0x3d84('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4763b7,_0x52a74c);_0x20a73e(_0x52a74c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 667513f..d29a143 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 _0xac17=['get','/:id','post','put','update','delete','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x5c41c7,_0x38f4b0){var _0x3ddb61=function(_0x3676d){while(--_0x3676d){_0x5c41c7['push'](_0x5c41c7['shift']());}};_0x3ddb61(++_0x38f4b0);}(_0xac17,0x8e));var _0x7ac1=function(_0x1dfbf0,_0x25aa11){_0x1dfbf0=_0x1dfbf0-0x0;var _0x248732=_0xac17[_0x1dfbf0];return _0x248732;};'use strict';var multer=require(_0x7ac1('0x0'));var util=require(_0x7ac1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7ac1('0x2'));var router=express['Router']();var fs_extra=require(_0x7ac1('0x3'));var auth=require(_0x7ac1('0x4'));var interaction=require(_0x7ac1('0x5'));var config=require(_0x7ac1('0x6'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x7ac1('0x7')](),controller['index']);router[_0x7ac1('0x8')](_0x7ac1('0x9'),auth[_0x7ac1('0x7')](),controller['show']);router[_0x7ac1('0xa')]('/',auth[_0x7ac1('0x7')](),controller['create']);router[_0x7ac1('0xb')](_0x7ac1('0x9'),auth[_0x7ac1('0x7')](),controller[_0x7ac1('0xc')]);router[_0x7ac1('0xd')](_0x7ac1('0x9'),auth[_0x7ac1('0x7')](),controller['destroy']);module[_0x7ac1('0xe')]=router; \ No newline at end of file +var _0x0f1a=['multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','get','show','create','/:id','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f1a,0x96));var _0xa0f1=function(_0x18ae4b,_0x3fccea){_0x18ae4b=_0x18ae4b-0x0;var _0x409b8b=_0x0f1a[_0x18ae4b];return _0x409b8b;};'use strict';var multer=require(_0xa0f1('0x0'));var util=require('util');var path=require(_0xa0f1('0x1'));var timeout=require(_0xa0f1('0x2'));var express=require(_0xa0f1('0x3'));var router=express[_0xa0f1('0x4')]();var fs_extra=require(_0xa0f1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa0f1('0x6'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xa0f1('0x7')](),controller[_0xa0f1('0x8')]);router[_0xa0f1('0x9')]('/:id',auth[_0xa0f1('0x7')](),controller[_0xa0f1('0xa')]);router['post']('/',auth[_0xa0f1('0x7')](),controller[_0xa0f1('0xb')]);router['put'](_0xa0f1('0xc'),auth[_0xa0f1('0x7')](),controller['update']);router['delete']('/:id',auth[_0xa0f1('0x7')](),controller[_0xa0f1('0xd')]);module[_0xa0f1('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 4ca4a2f..685dd7c 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 _0xa615=['picklist','string','STRING','variable','sequelize','ENUM','customVariable','keyValue'];(function(_0x24d7eb,_0x4e160a){var _0x46550b=function(_0x5b7f42){while(--_0x5b7f42){_0x24d7eb['push'](_0x24d7eb['shift']());}};_0x46550b(++_0x4e160a);}(_0xa615,0x13c));var _0x5a61=function(_0x472e6e,_0x1c2239){_0x472e6e=_0x472e6e-0x0;var _0x490a4f=_0xa615[_0x472e6e];return _0x490a4f;};'use strict';var Sequelize=require(_0x5a61('0x0'));module['exports']={'type':{'type':Sequelize[_0x5a61('0x1')]('string','variable',_0x5a61('0x2'),_0x5a61('0x3'),_0x5a61('0x4')),'defaultValue':_0x5a61('0x5')},'content':{'type':Sequelize[_0x5a61('0x6')]},'key':{'type':Sequelize[_0x5a61('0x6')]},'keyType':{'type':Sequelize[_0x5a61('0x1')](_0x5a61('0x5'),_0x5a61('0x7'),_0x5a61('0x2'))},'keyContent':{'type':Sequelize[_0x5a61('0x6')]},'idField':{'type':Sequelize[_0x5a61('0x6')]},'nameField':{'type':Sequelize[_0x5a61('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdbf3=['BOOLEAN','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x5425e6,_0x87026e){var _0x1516f8=function(_0x4ce1d1){while(--_0x4ce1d1){_0x5425e6['push'](_0x5425e6['shift']());}};_0x1516f8(++_0x87026e);}(_0xdbf3,0x184));var _0x3dbf=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xdbf3[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require('sequelize');module[_0x3dbf('0x0')]={'type':{'type':Sequelize[_0x3dbf('0x1')](_0x3dbf('0x2'),_0x3dbf('0x3'),'customVariable',_0x3dbf('0x4'),_0x3dbf('0x5')),'defaultValue':_0x3dbf('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3dbf('0x6')]},'keyType':{'type':Sequelize[_0x3dbf('0x1')](_0x3dbf('0x2'),'variable',_0x3dbf('0x7'))},'keyContent':{'type':Sequelize[_0x3dbf('0x6')]},'idField':{'type':Sequelize[_0x3dbf('0x6')]},'nameField':{'type':Sequelize[_0x3dbf('0x6')]},'customField':{'type':Sequelize[_0x3dbf('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 47719ba..9be4e15 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 _0xf8b1=['options','includeAll','include','findAll','rows','catch','fields','length','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x1fcb25,_0x137d02){var _0x5e3ff2=function(_0x396a36){while(--_0x396a36){_0x1fcb25['push'](_0x1fcb25['shift']());}};_0x5e3ff2(++_0x137d02);}(_0xf8b1,0x1c8));var _0x1f8b=function(_0x41044d,_0x557434){_0x41044d=_0x41044d-0x0;var _0x314486=_0xf8b1[_0x41044d];return _0x314486;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f8b('0x0'));var zipdir=require(_0x1f8b('0x1'));var jsonpatch=require(_0x1f8b('0x2'));var rp=require(_0x1f8b('0x3'));var moment=require('moment');var BPromise=require(_0x1f8b('0x4'));var Mustache=require(_0x1f8b('0x5'));var util=require(_0x1f8b('0x6'));var path=require(_0x1f8b('0x7'));var sox=require(_0x1f8b('0x8'));var csv=require(_0x1f8b('0x9'));var ejs=require(_0x1f8b('0xa'));var fs=require('fs');var fs_extra=require(_0x1f8b('0xb'));var _=require(_0x1f8b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1f8b('0xd'));var deskjs=require(_0x1f8b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1f8b('0xf'));var Papa=require(_0x1f8b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f8b('0x11'));var logger=require(_0x1f8b('0x12'))(_0x1f8b('0x13'));var utils=require(_0x1f8b('0x14'));var config=require(_0x1f8b('0x15'));var licenseUtil=require(_0x1f8b('0x16'));var db=require(_0x1f8b('0x17'))['db'];function respondWithStatusCode(_0xb144ef,_0x266e5a){_0x266e5a=_0x266e5a||0xcc;return function(_0xc34bd0){if(_0xc34bd0){return _0xb144ef['sendStatus'](_0x266e5a);}return _0xb144ef[_0x1f8b('0x18')](_0x266e5a)[_0x1f8b('0x19')]();};}function respondWithResult(_0x54850c,_0x170167){_0x170167=_0x170167||0xc8;return function(_0x91eb02){if(_0x91eb02){return _0x54850c[_0x1f8b('0x18')](_0x170167)['json'](_0x91eb02);}};}function respondWithFilteredResult(_0x6c788,_0x5bebcf){return function(_0x3d0edb){if(_0x3d0edb){var _0x57f744=typeof _0x5bebcf['offset']===_0x1f8b('0x1a')&&typeof _0x5bebcf[_0x1f8b('0x1b')]==='undefined';var _0x561e98=_0x3d0edb[_0x1f8b('0x1c')];var _0x48c084=_0x57f744?0x0:_0x5bebcf['offset'];var _0x2d73c8=_0x57f744?_0x3d0edb['count']:_0x5bebcf[_0x1f8b('0x1d')]+_0x5bebcf[_0x1f8b('0x1b')];var _0x2f8a2d;if(_0x2d73c8>=_0x561e98){_0x2d73c8=_0x561e98;_0x2f8a2d=0xc8;}else{_0x2f8a2d=0xce;}_0x6c788[_0x1f8b('0x18')](_0x2f8a2d);return _0x6c788[_0x1f8b('0x1e')](_0x1f8b('0x1f'),_0x48c084+'-'+_0x2d73c8+'/'+_0x561e98)['json'](_0x3d0edb);}return null;};}function patchUpdates(_0x4592fd){return function(_0x30c389){try{jsonpatch[_0x1f8b('0x20')](_0x30c389,_0x4592fd,!![]);}catch(_0x3a30b4){return BPromise[_0x1f8b('0x21')](_0x3a30b4);}return _0x30c389[_0x1f8b('0x22')]();};}function saveUpdates(_0x314222,_0x177800){return function(_0x145c9b){if(_0x145c9b){return _0x145c9b[_0x1f8b('0x23')](_0x314222)[_0x1f8b('0x24')](function(_0x55b1d0){return _0x55b1d0;});}return null;};}function removeEntity(_0x57ada5,_0x4bb6e4){return function(_0x27aeb6){if(_0x27aeb6){return _0x27aeb6[_0x1f8b('0x25')]()[_0x1f8b('0x24')](function(){_0x57ada5['status'](0xcc)[_0x1f8b('0x19')]();});}};}function handleEntityNotFound(_0x37c405,_0x1ecbaa){return function(_0x26fd2f){if(!_0x26fd2f){_0x37c405['sendStatus'](0x194);}return _0x26fd2f;};}function handleError(_0x3bc8cb,_0x540f1b){_0x540f1b=_0x540f1b||0x1f4;return function(_0x531b4d){logger[_0x1f8b('0x26')](_0x531b4d[_0x1f8b('0x27')]);if(_0x531b4d['name']){delete _0x531b4d[_0x1f8b('0x28')];}_0x3bc8cb[_0x1f8b('0x18')](_0x540f1b)[_0x1f8b('0x29')](_0x531b4d);};}exports[_0x1f8b('0x2a')]=function(_0x3c69e3,_0x54cca3){var _0x4b90d4={},_0x180863={},_0x5255aa={'count':0x0,'rows':[]};var _0x1d7db7=_[_0x1f8b('0x2b')](db[_0x1f8b('0x2c')][_0x1f8b('0x2d')],function(_0x123baa){return{'name':_0x123baa['fieldName'],'type':_0x123baa[_0x1f8b('0x2e')][_0x1f8b('0x2f')]};});_0x180863[_0x1f8b('0x30')]=_[_0x1f8b('0x2b')](_0x1d7db7,_0x1f8b('0x28'));_0x180863[_0x1f8b('0x31')]=_['keys'](_0x3c69e3[_0x1f8b('0x31')]);_0x180863[_0x1f8b('0x32')]=_['intersection'](_0x180863[_0x1f8b('0x30')],_0x180863[_0x1f8b('0x31')]);_0x4b90d4[_0x1f8b('0x33')]=_[_0x1f8b('0x34')](_0x180863[_0x1f8b('0x30')],qs['fields'](_0x3c69e3[_0x1f8b('0x31')]['fields']));_0x4b90d4[_0x1f8b('0x33')]=_0x4b90d4[_0x1f8b('0x33')]['length']?_0x4b90d4[_0x1f8b('0x33')]:_0x180863[_0x1f8b('0x30')];if(!_0x3c69e3[_0x1f8b('0x31')][_0x1f8b('0x35')](_0x1f8b('0x36'))){_0x4b90d4[_0x1f8b('0x1b')]=qs[_0x1f8b('0x1b')](_0x3c69e3[_0x1f8b('0x31')][_0x1f8b('0x1b')]);_0x4b90d4[_0x1f8b('0x1d')]=qs[_0x1f8b('0x1d')](_0x3c69e3[_0x1f8b('0x31')][_0x1f8b('0x1d')]);}_0x4b90d4[_0x1f8b('0x37')]=qs[_0x1f8b('0x38')](_0x3c69e3[_0x1f8b('0x31')][_0x1f8b('0x38')]);_0x4b90d4[_0x1f8b('0x39')]=qs[_0x1f8b('0x32')](_[_0x1f8b('0x3a')](_0x3c69e3[_0x1f8b('0x31')],_0x180863['filters']),_0x1d7db7);if(_0x3c69e3[_0x1f8b('0x31')][_0x1f8b('0x3b')]){_0x4b90d4[_0x1f8b('0x39')]=_[_0x1f8b('0x3c')](_0x4b90d4[_0x1f8b('0x39')],{'$or':_['map'](_0x1d7db7,function(_0x9b8aa5){if(_0x9b8aa5[_0x1f8b('0x2e')]!==_0x1f8b('0x3d')){var _0x2844e5={};_0x2844e5[_0x9b8aa5[_0x1f8b('0x28')]]={'$like':'%'+_0x3c69e3[_0x1f8b('0x31')][_0x1f8b('0x3b')]+'%'};return _0x2844e5;}})});}_0x4b90d4=_[_0x1f8b('0x3c')]({},_0x4b90d4,_0x3c69e3[_0x1f8b('0x3e')]);var _0x4d3f47={'where':_0x4b90d4['where']};return db['ZendeskField']['count'](_0x4d3f47)['then'](function(_0x225eb4){_0x5255aa[_0x1f8b('0x1c')]=_0x225eb4;if(_0x3c69e3[_0x1f8b('0x31')][_0x1f8b('0x3f')]){_0x4b90d4[_0x1f8b('0x40')]=[{'all':!![]}];}return db[_0x1f8b('0x2c')][_0x1f8b('0x41')](_0x4b90d4);})[_0x1f8b('0x24')](function(_0x4f2dfb){_0x5255aa[_0x1f8b('0x42')]=_0x4f2dfb;return _0x5255aa;})[_0x1f8b('0x24')](respondWithFilteredResult(_0x54cca3,_0x4b90d4))[_0x1f8b('0x43')](handleError(_0x54cca3,null));};exports['show']=function(_0x46255f,_0x1b113b){var _0x5a3cc9={'raw':!![],'where':{'id':_0x46255f['params']['id']}},_0x1b9337={};_0x1b9337[_0x1f8b('0x30')]=_['keys'](db[_0x1f8b('0x2c')][_0x1f8b('0x2d')]);_0x1b9337[_0x1f8b('0x31')]=_['keys'](_0x46255f[_0x1f8b('0x31')]);_0x1b9337[_0x1f8b('0x32')]=_[_0x1f8b('0x34')](_0x1b9337[_0x1f8b('0x30')],_0x1b9337[_0x1f8b('0x31')]);_0x5a3cc9['attributes']=_[_0x1f8b('0x34')](_0x1b9337['model'],qs[_0x1f8b('0x44')](_0x46255f[_0x1f8b('0x31')][_0x1f8b('0x44')]));_0x5a3cc9[_0x1f8b('0x33')]=_0x5a3cc9[_0x1f8b('0x33')][_0x1f8b('0x45')]?_0x5a3cc9['attributes']:_0x1b9337[_0x1f8b('0x30')];if(_0x46255f[_0x1f8b('0x31')][_0x1f8b('0x3f')]){_0x5a3cc9[_0x1f8b('0x40')]=[{'all':!![]}];}_0x5a3cc9=_[_0x1f8b('0x3c')]({},_0x5a3cc9,_0x46255f[_0x1f8b('0x3e')]);return db[_0x1f8b('0x2c')]['find'](_0x5a3cc9)[_0x1f8b('0x24')](handleEntityNotFound(_0x1b113b,null))[_0x1f8b('0x24')](respondWithResult(_0x1b113b,null))[_0x1f8b('0x43')](handleError(_0x1b113b,null));};exports[_0x1f8b('0x46')]=function(_0x1a4c97,_0x4668bd){return db[_0x1f8b('0x2c')][_0x1f8b('0x46')](_0x1a4c97[_0x1f8b('0x47')],{})[_0x1f8b('0x24')](respondWithResult(_0x4668bd,0xc9))[_0x1f8b('0x43')](handleError(_0x4668bd,null));};exports[_0x1f8b('0x23')]=function(_0x42cc7b,_0x367a5c){if(_0x42cc7b[_0x1f8b('0x47')]['id']){delete _0x42cc7b['body']['id'];}return db[_0x1f8b('0x2c')][_0x1f8b('0x48')]({'where':{'id':_0x42cc7b[_0x1f8b('0x49')]['id']}})[_0x1f8b('0x24')](handleEntityNotFound(_0x367a5c,null))[_0x1f8b('0x24')](saveUpdates(_0x42cc7b[_0x1f8b('0x47')],null))[_0x1f8b('0x24')](respondWithResult(_0x367a5c,null))[_0x1f8b('0x43')](handleError(_0x367a5c,null));};exports[_0x1f8b('0x25')]=function(_0x5821b8,_0x38bc18){return db[_0x1f8b('0x2c')][_0x1f8b('0x48')]({'where':{'id':_0x5821b8[_0x1f8b('0x49')]['id']}})[_0x1f8b('0x24')](handleEntityNotFound(_0x38bc18,null))[_0x1f8b('0x24')](removeEntity(_0x38bc18,null))[_0x1f8b('0x43')](handleError(_0x38bc18,null));}; \ No newline at end of file +var _0x119c=['options','count','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','map','ZendeskField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x142691,_0x281ee4){var _0x7ff861=function(_0x19f6a3){while(--_0x19f6a3){_0x142691['push'](_0x142691['shift']());}};_0x7ff861(++_0x281ee4);}(_0x119c,0xa5));var _0xc119=function(_0x1c9cfb,_0x4efc3b){_0x1c9cfb=_0x1c9cfb-0x0;var _0x32436a=_0x119c[_0x1c9cfb];return _0x32436a;};'use strict';var emlformat=require(_0xc119('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc119('0x1'));var jsonpatch=require(_0xc119('0x2'));var rp=require(_0xc119('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc119('0x4'));var util=require(_0xc119('0x5'));var path=require(_0xc119('0x6'));var sox=require(_0xc119('0x7'));var csv=require(_0xc119('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc119('0x9'));var squel=require('squel');var crypto=require(_0xc119('0xa'));var jsforce=require(_0xc119('0xb'));var deskjs=require(_0xc119('0xc'));var toCsv=require(_0xc119('0x8'));var querystring=require(_0xc119('0xd'));var Papa=require(_0xc119('0xe'));var Redis=require(_0xc119('0xf'));var authService=require(_0xc119('0x10'));var qs=require(_0xc119('0x11'));var as=require(_0xc119('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc119('0x13'))(_0xc119('0x14'));var utils=require('../../config/utils');var config=require(_0xc119('0x15'));var licenseUtil=require(_0xc119('0x16'));var db=require(_0xc119('0x17'))['db'];function respondWithStatusCode(_0x159f1e,_0x3e7f97){_0x3e7f97=_0x3e7f97||0xcc;return function(_0x155b67){if(_0x155b67){return _0x159f1e[_0xc119('0x18')](_0x3e7f97);}return _0x159f1e[_0xc119('0x19')](_0x3e7f97)['end']();};}function respondWithResult(_0x4f342d,_0xbdcfaa){_0xbdcfaa=_0xbdcfaa||0xc8;return function(_0x29ede4){if(_0x29ede4){return _0x4f342d['status'](_0xbdcfaa)[_0xc119('0x1a')](_0x29ede4);}};}function respondWithFilteredResult(_0x230fb2,_0x4d5e43){return function(_0x5caa63){if(_0x5caa63){var _0x2ab3b2=typeof _0x4d5e43[_0xc119('0x1b')]===_0xc119('0x1c')&&typeof _0x4d5e43['limit']===_0xc119('0x1c');var _0x465d02=_0x5caa63['count'];var _0x3aa2c0=_0x2ab3b2?0x0:_0x4d5e43['offset'];var _0x2b9b86=_0x2ab3b2?_0x5caa63['count']:_0x4d5e43[_0xc119('0x1b')]+_0x4d5e43[_0xc119('0x1d')];var _0x3a0f32;if(_0x2b9b86>=_0x465d02){_0x2b9b86=_0x465d02;_0x3a0f32=0xc8;}else{_0x3a0f32=0xce;}_0x230fb2[_0xc119('0x19')](_0x3a0f32);return _0x230fb2[_0xc119('0x1e')](_0xc119('0x1f'),_0x3aa2c0+'-'+_0x2b9b86+'/'+_0x465d02)['json'](_0x5caa63);}return null;};}function patchUpdates(_0x3a992e){return function(_0x45cb8b){try{jsonpatch[_0xc119('0x20')](_0x45cb8b,_0x3a992e,!![]);}catch(_0x312cf2){return BPromise[_0xc119('0x21')](_0x312cf2);}return _0x45cb8b['save']();};}function saveUpdates(_0x4012f8,_0xd28f74){return function(_0x30db1a){if(_0x30db1a){return _0x30db1a[_0xc119('0x22')](_0x4012f8)[_0xc119('0x23')](function(_0x5b9fec){return _0x5b9fec;});}return null;};}function removeEntity(_0x102d79,_0x55dafe){return function(_0x11e037){if(_0x11e037){return _0x11e037[_0xc119('0x24')]()[_0xc119('0x23')](function(){_0x102d79[_0xc119('0x19')](0xcc)[_0xc119('0x25')]();});}};}function handleEntityNotFound(_0x5a9eb5,_0x2bdbee){return function(_0x3bef77){if(!_0x3bef77){_0x5a9eb5[_0xc119('0x18')](0x194);}return _0x3bef77;};}function handleError(_0x3179e7,_0x2cedd2){_0x2cedd2=_0x2cedd2||0x1f4;return function(_0x282000){logger[_0xc119('0x26')](_0x282000['stack']);if(_0x282000[_0xc119('0x27')]){delete _0x282000[_0xc119('0x27')];}_0x3179e7[_0xc119('0x19')](_0x2cedd2)[_0xc119('0x28')](_0x282000);};}exports['index']=function(_0x376a2e,_0x91a68){var _0x7c63e3={},_0x2a8383={},_0x50bfbd={'count':0x0,'rows':[]};var _0x5599e2=_[_0xc119('0x29')](db[_0xc119('0x2a')]['rawAttributes'],function(_0x46dd4d){return{'name':_0x46dd4d[_0xc119('0x2b')],'type':_0x46dd4d[_0xc119('0x2c')][_0xc119('0x2d')]};});_0x2a8383[_0xc119('0x2e')]=_[_0xc119('0x29')](_0x5599e2,'name');_0x2a8383[_0xc119('0x2f')]=_[_0xc119('0x30')](_0x376a2e['query']);_0x2a8383[_0xc119('0x31')]=_[_0xc119('0x32')](_0x2a8383['model'],_0x2a8383[_0xc119('0x2f')]);_0x7c63e3['attributes']=_[_0xc119('0x32')](_0x2a8383['model'],qs[_0xc119('0x33')](_0x376a2e[_0xc119('0x2f')]['fields']));_0x7c63e3[_0xc119('0x34')]=_0x7c63e3[_0xc119('0x34')][_0xc119('0x35')]?_0x7c63e3['attributes']:_0x2a8383['model'];if(!_0x376a2e[_0xc119('0x2f')][_0xc119('0x36')](_0xc119('0x37'))){_0x7c63e3[_0xc119('0x1d')]=qs['limit'](_0x376a2e[_0xc119('0x2f')][_0xc119('0x1d')]);_0x7c63e3[_0xc119('0x1b')]=qs[_0xc119('0x1b')](_0x376a2e['query'][_0xc119('0x1b')]);}_0x7c63e3[_0xc119('0x38')]=qs[_0xc119('0x39')](_0x376a2e[_0xc119('0x2f')]['sort']);_0x7c63e3[_0xc119('0x3a')]=qs[_0xc119('0x31')](_[_0xc119('0x3b')](_0x376a2e[_0xc119('0x2f')],_0x2a8383[_0xc119('0x31')]),_0x5599e2);if(_0x376a2e[_0xc119('0x2f')][_0xc119('0x3c')]){_0x7c63e3[_0xc119('0x3a')]=_[_0xc119('0x3d')](_0x7c63e3[_0xc119('0x3a')],{'$or':_[_0xc119('0x29')](_0x5599e2,function(_0x2bc09d){if(_0x2bc09d[_0xc119('0x2c')]!==_0xc119('0x3e')){var _0x2cb705={};_0x2cb705[_0x2bc09d[_0xc119('0x27')]]={'$like':'%'+_0x376a2e[_0xc119('0x2f')][_0xc119('0x3c')]+'%'};return _0x2cb705;}})});}_0x7c63e3=_[_0xc119('0x3d')]({},_0x7c63e3,_0x376a2e[_0xc119('0x3f')]);var _0xc2c5e3={'where':_0x7c63e3[_0xc119('0x3a')]};return db[_0xc119('0x2a')][_0xc119('0x40')](_0xc2c5e3)['then'](function(_0x42ab92){_0x50bfbd[_0xc119('0x40')]=_0x42ab92;if(_0x376a2e['query'][_0xc119('0x41')]){_0x7c63e3[_0xc119('0x42')]=[{'all':!![]}];}return db[_0xc119('0x2a')][_0xc119('0x43')](_0x7c63e3);})[_0xc119('0x23')](function(_0x540509){_0x50bfbd[_0xc119('0x44')]=_0x540509;return _0x50bfbd;})[_0xc119('0x23')](respondWithFilteredResult(_0x91a68,_0x7c63e3))[_0xc119('0x45')](handleError(_0x91a68,null));};exports[_0xc119('0x46')]=function(_0x4578a1,_0x2d9610){var _0x22b260={'raw':!![],'where':{'id':_0x4578a1['params']['id']}},_0x1e2ad1={};_0x1e2ad1[_0xc119('0x2e')]=_[_0xc119('0x30')](db[_0xc119('0x2a')][_0xc119('0x47')]);_0x1e2ad1['query']=_[_0xc119('0x30')](_0x4578a1['query']);_0x1e2ad1[_0xc119('0x31')]=_['intersection'](_0x1e2ad1[_0xc119('0x2e')],_0x1e2ad1['query']);_0x22b260['attributes']=_[_0xc119('0x32')](_0x1e2ad1['model'],qs['fields'](_0x4578a1[_0xc119('0x2f')]['fields']));_0x22b260['attributes']=_0x22b260[_0xc119('0x34')][_0xc119('0x35')]?_0x22b260[_0xc119('0x34')]:_0x1e2ad1[_0xc119('0x2e')];if(_0x4578a1[_0xc119('0x2f')][_0xc119('0x41')]){_0x22b260[_0xc119('0x42')]=[{'all':!![]}];}_0x22b260=_[_0xc119('0x3d')]({},_0x22b260,_0x4578a1[_0xc119('0x3f')]);return db['ZendeskField'][_0xc119('0x48')](_0x22b260)[_0xc119('0x23')](handleEntityNotFound(_0x2d9610,null))['then'](respondWithResult(_0x2d9610,null))[_0xc119('0x45')](handleError(_0x2d9610,null));};exports['create']=function(_0x259fe7,_0x2737c4){return db['ZendeskField'][_0xc119('0x49')](_0x259fe7['body'],{})['then'](respondWithResult(_0x2737c4,0xc9))[_0xc119('0x45')](handleError(_0x2737c4,null));};exports[_0xc119('0x22')]=function(_0x46a968,_0x44c897){if(_0x46a968[_0xc119('0x4a')]['id']){delete _0x46a968[_0xc119('0x4a')]['id'];}return db['ZendeskField'][_0xc119('0x48')]({'where':{'id':_0x46a968[_0xc119('0x4b')]['id']}})['then'](handleEntityNotFound(_0x44c897,null))[_0xc119('0x23')](saveUpdates(_0x46a968[_0xc119('0x4a')],null))[_0xc119('0x23')](respondWithResult(_0x44c897,null))[_0xc119('0x45')](handleError(_0x44c897,null));};exports[_0xc119('0x24')]=function(_0x3b20f8,_0x1c7469){return db['ZendeskField'][_0xc119('0x48')]({'where':{'id':_0x3b20f8[_0xc119('0x4b')]['id']}})[_0xc119('0x23')](handleEntityNotFound(_0x1c7469,null))['then'](removeEntity(_0x1c7469,null))[_0xc119('0x45')](handleError(_0x1c7469,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 1a4f5b6..43e3eef 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 _0x0c8c=['api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0xaef44,_0x2c72bf){var _0x42f107=function(_0x3b40f5){while(--_0x3b40f5){_0xaef44['push'](_0xaef44['shift']());}};_0x42f107(++_0x2c72bf);}(_0x0c8c,0x138));var _0xc0c8=function(_0x2c306a,_0x51fc9e){_0x2c306a=_0x2c306a-0x0;var _0x1aeeac=_0x0c8c[_0x2c306a];return _0x1aeeac;};'use strict';var _=require(_0xc0c8('0x0'));var util=require(_0xc0c8('0x1'));var logger=require(_0xc0c8('0x2'))(_0xc0c8('0x3'));var moment=require(_0xc0c8('0x4'));var BPromise=require(_0xc0c8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0c8('0x6'));var rimraf=require(_0xc0c8('0x7'));var config=require(_0xc0c8('0x8'));var attributes=require(_0xc0c8('0x9'));module['exports']=function(_0x491500,_0x2a5d0d){return _0x491500[_0xc0c8('0xa')]('ZendeskField',attributes,{'tableName':_0xc0c8('0xb'),'paranoid':![],'indexes':[{'name':_0xc0c8('0xc'),'fields':[_0xc0c8('0xd'),_0xc0c8('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e30=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x2e30,0x149));var _0x02e3=function(_0x4ed115,_0x2ecbe5){_0x4ed115=_0x4ed115-0x0;var _0x583291=_0x2e30[_0x4ed115];return _0x583291;};'use strict';var _=require(_0x02e3('0x0'));var util=require(_0x02e3('0x1'));var logger=require(_0x02e3('0x2'))('api');var moment=require(_0x02e3('0x3'));var BPromise=require(_0x02e3('0x4'));var rp=require(_0x02e3('0x5'));var fs=require('fs');var path=require(_0x02e3('0x6'));var rimraf=require(_0x02e3('0x7'));var config=require('../../config/environment');var attributes=require(_0x02e3('0x8'));module[_0x02e3('0x9')]=function(_0x282be3,_0xa1ad98){return _0x282be3[_0x02e3('0xa')](_0x02e3('0xb'),attributes,{'tableName':_0x02e3('0xc'),'paranoid':![],'indexes':[{'name':_0x02e3('0xd'),'fields':[_0x02e3('0xe'),'FieldId'],'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 c4934f5..f5b97d6 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 _0xbe37=['request\x20sent','debug','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','ZendeskField,\x20%s,\x20%s'];(function(_0x434a95,_0x46a29f){var _0x5f2c0b=function(_0x5b29d4){while(--_0x5b29d4){_0x434a95['push'](_0x434a95['shift']());}};_0x5f2c0b(++_0x46a29f);}(_0xbe37,0xcf));var _0x7be3=function(_0x104ba6,_0x52558e){_0x104ba6=_0x104ba6-0x0;var _0x4d7c92=_0xbe37[_0x104ba6];return _0x4d7c92;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7be3('0x0'));var BPromise=require(_0x7be3('0x1'));var rs=require(_0x7be3('0x2'));var fs=require('fs');var Redis=require(_0x7be3('0x3'));var db=require(_0x7be3('0x4'))['db'];var utils=require(_0x7be3('0x5'));var logger=require(_0x7be3('0x6'))('rpc');var config=require(_0x7be3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7be3('0x8')][_0x7be3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20277b,_0xca36d4,_0x261c78){return new BPromise(function(_0xb64d42,_0x151452){return client[_0x7be3('0xa')](_0x20277b,_0x261c78)[_0x7be3('0xb')](function(_0x1a5d98){logger['info'](_0x7be3('0xc'),_0xca36d4,_0x7be3('0xd'));logger[_0x7be3('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0xca36d4,_0x7be3('0xd'),JSON[_0x7be3('0xf')](_0x1a5d98));if(_0x1a5d98[_0x7be3('0x10')]){if(_0x1a5d98[_0x7be3('0x10')][_0x7be3('0x11')]===0x1f4){logger['error'](_0x7be3('0xc'),_0xca36d4,_0x1a5d98[_0x7be3('0x10')][_0x7be3('0x12')]);return _0x151452(_0x1a5d98[_0x7be3('0x10')][_0x7be3('0x12')]);}logger['error'](_0x7be3('0xc'),_0xca36d4,_0x1a5d98[_0x7be3('0x10')][_0x7be3('0x12')]);return _0xb64d42(_0x1a5d98[_0x7be3('0x10')][_0x7be3('0x12')]);}else{logger[_0x7be3('0x13')]('ZendeskField,\x20%s,\x20%s',_0xca36d4,_0x7be3('0xd'));_0xb64d42(_0x1a5d98[_0x7be3('0x14')][_0x7be3('0x12')]);}})[_0x7be3('0x15')](function(_0x285d0a){logger[_0x7be3('0x10')](_0x7be3('0xc'),_0xca36d4,_0x285d0a);_0x151452(_0x285d0a);});});} \ No newline at end of file +var _0x2c36=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message'];(function(_0x51503e,_0x3cd8aa){var _0xd6a8e1=function(_0x5d6e56){while(--_0x5d6e56){_0x51503e['push'](_0x51503e['shift']());}};_0xd6a8e1(++_0x3cd8aa);}(_0x2c36,0x16a));var _0x62c3=function(_0x4b9dc9,_0x14b3a2){_0x4b9dc9=_0x4b9dc9-0x0;var _0x57b302=_0x2c36[_0x4b9dc9];return _0x57b302;};'use strict';var _=require(_0x62c3('0x0'));var util=require(_0x62c3('0x1'));var moment=require(_0x62c3('0x2'));var BPromise=require(_0x62c3('0x3'));var rs=require(_0x62c3('0x4'));var fs=require('fs');var Redis=require(_0x62c3('0x5'));var db=require(_0x62c3('0x6'))['db'];var utils=require(_0x62c3('0x7'));var logger=require(_0x62c3('0x8'))(_0x62c3('0x9'));var config=require(_0x62c3('0xa'));var jayson=require(_0x62c3('0xb'));var client=jayson[_0x62c3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26e306,_0x571efb,_0x483907){return new BPromise(function(_0x767663,_0x2026c5){return client['request'](_0x26e306,_0x483907)[_0x62c3('0xd')](function(_0x4c5096){logger[_0x62c3('0xe')]('ZendeskField,\x20%s,\x20%s',_0x571efb,_0x62c3('0xf'));logger['debug'](_0x62c3('0x10'),_0x571efb,_0x62c3('0xf'),JSON[_0x62c3('0x11')](_0x4c5096));if(_0x4c5096[_0x62c3('0x12')]){if(_0x4c5096[_0x62c3('0x12')][_0x62c3('0x13')]===0x1f4){logger[_0x62c3('0x12')](_0x62c3('0x14'),_0x571efb,_0x4c5096['error'][_0x62c3('0x15')]);return _0x2026c5(_0x4c5096[_0x62c3('0x12')][_0x62c3('0x15')]);}logger[_0x62c3('0x12')](_0x62c3('0x14'),_0x571efb,_0x4c5096[_0x62c3('0x12')][_0x62c3('0x15')]);return _0x767663(_0x4c5096['error'][_0x62c3('0x15')]);}else{logger[_0x62c3('0xe')](_0x62c3('0x14'),_0x571efb,_0x62c3('0xf'));_0x767663(_0x4c5096[_0x62c3('0x16')][_0x62c3('0x15')]);}})[_0x62c3('0x17')](function(_0x35ee3c){logger[_0x62c3('0x12')](_0x62c3('0x14'),_0x571efb,_0x35ee3c);_0x2026c5(_0x35ee3c);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 67445da..d81ac61 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 _0x1b20=['destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','put','update'];(function(_0x1dc424,_0x518355){var _0xe18ac5=function(_0x500d8e){while(--_0x500d8e){_0x1dc424['push'](_0x1dc424['shift']());}};_0xe18ac5(++_0x518355);}(_0x1b20,0x66));var _0x01b2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1b20[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x01b2('0x0'));var path=require(_0x01b2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01b2('0x2')]();var fs_extra=require(_0x01b2('0x3'));var auth=require(_0x01b2('0x4'));var interaction=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var controller=require(_0x01b2('0x7'));router[_0x01b2('0x8')]('/',auth[_0x01b2('0x9')](),controller[_0x01b2('0xa')]);router[_0x01b2('0x8')](_0x01b2('0xb'),auth[_0x01b2('0x9')](),controller['show']);router[_0x01b2('0x8')]('/:id/configurations',auth[_0x01b2('0x9')](),controller[_0x01b2('0xc')]);router[_0x01b2('0x8')](_0x01b2('0xd'),auth[_0x01b2('0x9')](),controller[_0x01b2('0xe')]);router[_0x01b2('0xf')]('/',auth[_0x01b2('0x9')](),controller['create']);router[_0x01b2('0xf')]('/:id/configurations',auth[_0x01b2('0x9')](),controller['addConfiguration']);router[_0x01b2('0x10')](_0x01b2('0xb'),auth[_0x01b2('0x9')](),controller[_0x01b2('0x11')]);router['delete'](_0x01b2('0xb'),auth[_0x01b2('0x9')](),controller[_0x01b2('0x12')]);module[_0x01b2('0x13')]=router; \ No newline at end of file +var _0xec82=['getFields','post','addConfiguration','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','get','/:id','show','getConfigurations'];(function(_0x7daada,_0x51672f){var _0xf72520=function(_0x59b2bb){while(--_0x59b2bb){_0x7daada['push'](_0x7daada['shift']());}};_0xf72520(++_0x51672f);}(_0xec82,0x6f));var _0x2ec8=function(_0x4d3500,_0x2e3e50){_0x4d3500=_0x4d3500-0x0;var _0x57fcc1=_0xec82[_0x4d3500];return _0x57fcc1;};'use strict';var multer=require(_0x2ec8('0x0'));var util=require('util');var path=require(_0x2ec8('0x1'));var timeout=require(_0x2ec8('0x2'));var express=require(_0x2ec8('0x3'));var router=express[_0x2ec8('0x4')]();var fs_extra=require(_0x2ec8('0x5'));var auth=require(_0x2ec8('0x6'));var interaction=require(_0x2ec8('0x7'));var config=require(_0x2ec8('0x8'));var controller=require(_0x2ec8('0x9'));router['get']('/',auth[_0x2ec8('0xa')](),controller['index']);router[_0x2ec8('0xb')](_0x2ec8('0xc'),auth[_0x2ec8('0xa')](),controller[_0x2ec8('0xd')]);router[_0x2ec8('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x2ec8('0xe')]);router[_0x2ec8('0xb')]('/:id/fields',auth[_0x2ec8('0xa')](),controller[_0x2ec8('0xf')]);router['post']('/',auth[_0x2ec8('0xa')](),controller['create']);router[_0x2ec8('0x10')]('/:id/configurations',auth[_0x2ec8('0xa')](),controller[_0x2ec8('0x11')]);router[_0x2ec8('0x12')]('/:id',auth[_0x2ec8('0xa')](),controller[_0x2ec8('0x13')]);router['delete'](_0x2ec8('0xc'),auth['isAuthenticated'](),controller[_0x2ec8('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ed025e5..e80e0fa 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 _0xb903=['exports','STRING','sequelize'];(function(_0x171945,_0xd87274){var _0x2d73e6=function(_0xb1bdc9){while(--_0xb1bdc9){_0x171945['push'](_0x171945['shift']());}};_0x2d73e6(++_0xd87274);}(_0xb903,0x185));var _0x3b90=function(_0x55dd82,_0x5320b9){_0x55dd82=_0x55dd82-0x0;var _0x15162f=_0xb903[_0x55dd82];return _0x15162f;};'use strict';var Sequelize=require(_0x3b90('0x0'));module[_0x3b90('0x1')]={'name':{'type':Sequelize[_0x3b90('0x2')]},'description':{'type':Sequelize[_0x3b90('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x3b90('0x2')]},'clientId':{'type':Sequelize[_0x3b90('0x2')]},'clientSecret':{'type':Sequelize[_0x3b90('0x2')]},'serverUrl':{'type':Sequelize[_0x3b90('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x3b90('0x2')]},'refreshToken':{'type':Sequelize[_0x3b90('0x2')]}}; \ No newline at end of file +var _0x750a=['exports','STRING'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x750a,0x140));var _0xa750=function(_0x40612d,_0x15508a){_0x40612d=_0x40612d-0x0;var _0x4258f2=_0x750a[_0x40612d];return _0x4258f2;};'use strict';var Sequelize=require('sequelize');module[_0xa750('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa750('0x1')]},'zone':{'type':Sequelize[_0xa750('0x1')]},'clientId':{'type':Sequelize[_0xa750('0x1')]},'clientSecret':{'type':Sequelize[_0xa750('0x1')]},'serverUrl':{'type':Sequelize[_0xa750('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xa750('0x1')]},'refreshToken':{'type':Sequelize[_0xa750('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5bdd7a2..2b53a76 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 _0x39df=['includes','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ZohoAccount','findAll','rows','catch','params','includeAll','include','find','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Zoho-oauthtoken\x20','response','error','message','Description','WhoId','Call_Duration','Call_Result','Call_Type'];(function(_0x5d6dec,_0x4ebf92){var _0x1acd16=function(_0x4f7648){while(--_0x4f7648){_0x5d6dec['push'](_0x5d6dec['shift']());}};_0x1acd16(++_0x4ebf92);}(_0x39df,0x194));var _0xf39d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x39df[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xf39d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf39d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf39d('0x2'));var moment=require(_0xf39d('0x3'));var BPromise=require(_0xf39d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf39d('0x5'));var sox=require(_0xf39d('0x6'));var csv=require('to-csv');var ejs=require(_0xf39d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf39d('0x8'));var squel=require('squel');var crypto=require(_0xf39d('0x9'));var jsforce=require(_0xf39d('0xa'));var deskjs=require(_0xf39d('0xb'));var toCsv=require(_0xf39d('0xc'));var querystring=require(_0xf39d('0xd'));var Papa=require(_0xf39d('0xe'));var Redis=require(_0xf39d('0xf'));var authService=require(_0xf39d('0x10'));var qs=require(_0xf39d('0x11'));var as=require(_0xf39d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf39d('0x13'));var utils=require(_0xf39d('0x14'));var config=require(_0xf39d('0x15'));var licenseUtil=require(_0xf39d('0x16'));var db=require(_0xf39d('0x17'))['db'];var integrations=require(_0xf39d('0x18'));function respondWithStatusCode(_0x13b6c3,_0x3a87f5){_0x3a87f5=_0x3a87f5||0xcc;return function(_0x1f5c1d){if(_0x1f5c1d){return _0x13b6c3[_0xf39d('0x19')](_0x3a87f5);}return _0x13b6c3[_0xf39d('0x1a')](_0x3a87f5)[_0xf39d('0x1b')]();};}function respondWithResult(_0x2a0a97,_0x49e8a4){_0x49e8a4=_0x49e8a4||0xc8;return function(_0x2fc5f0){if(_0x2fc5f0){return _0x2a0a97[_0xf39d('0x1a')](_0x49e8a4)[_0xf39d('0x1c')](_0x2fc5f0);}};}function respondWithFilteredResult(_0x33eb36,_0x47f579){return function(_0x2d4719){if(_0x2d4719){var _0xbb564f=typeof _0x47f579[_0xf39d('0x1d')]===_0xf39d('0x1e')&&typeof _0x47f579['limit']===_0xf39d('0x1e');var _0x560bc1=_0x2d4719['count'];var _0x3f79d8=_0xbb564f?0x0:_0x47f579['offset'];var _0xf1d1a9=_0xbb564f?_0x2d4719[_0xf39d('0x1f')]:_0x47f579[_0xf39d('0x1d')]+_0x47f579['limit'];var _0x336116;if(_0xf1d1a9>=_0x560bc1){_0xf1d1a9=_0x560bc1;_0x336116=0xc8;}else{_0x336116=0xce;}_0x33eb36[_0xf39d('0x1a')](_0x336116);return _0x33eb36[_0xf39d('0x20')](_0xf39d('0x21'),_0x3f79d8+'-'+_0xf1d1a9+'/'+_0x560bc1)['json'](_0x2d4719);}return null;};}function patchUpdates(_0x1eb491){return function(_0x2022c9){try{jsonpatch['apply'](_0x2022c9,_0x1eb491,!![]);}catch(_0x2add9c){return BPromise[_0xf39d('0x22')](_0x2add9c);}return _0x2022c9[_0xf39d('0x23')]();};}function saveUpdates(_0x4f67a1,_0x1e47ea){return function(_0x36e56b){if(_0x36e56b){return _0x36e56b[_0xf39d('0x24')](_0x4f67a1)[_0xf39d('0x25')](function(_0x28b133){return _0x28b133;});}return null;};}function removeEntity(_0x2e4b65,_0x4ae62b){return function(_0x4f757d){if(_0x4f757d){return _0x4f757d[_0xf39d('0x26')]()[_0xf39d('0x25')](function(){_0x2e4b65[_0xf39d('0x1a')](0xcc)[_0xf39d('0x1b')]();});}};}function handleEntityNotFound(_0x445f30,_0x5773d4){return function(_0x36fb28){if(!_0x36fb28){_0x445f30[_0xf39d('0x19')](0x194);}return _0x36fb28;};}function handleError(_0x24f5b9,_0x2545a0){_0x2545a0=_0x2545a0||0x1f4;return function(_0x49ed08){logger['error'](_0x49ed08[_0xf39d('0x27')]);if(_0x49ed08[_0xf39d('0x28')]){delete _0x49ed08['name'];}_0x24f5b9[_0xf39d('0x1a')](_0x2545a0)['send'](_0x49ed08);};}exports[_0xf39d('0x29')]=function(_0x2faaac,_0xe26c38){var _0x1a2340={},_0x48b368={},_0x1c8dbe={'count':0x0,'rows':[]};var _0x5f56e7=_[_0xf39d('0x2a')](db['ZohoAccount'][_0xf39d('0x2b')],function(_0x3e1ab5){return{'name':_0x3e1ab5[_0xf39d('0x2c')],'type':_0x3e1ab5['type'][_0xf39d('0x2d')]};});_0x48b368[_0xf39d('0x2e')]=_['map'](_0x5f56e7,_0xf39d('0x28'));_0x48b368[_0xf39d('0x2f')]=_[_0xf39d('0x30')](_0x2faaac['query']);_0x48b368[_0xf39d('0x31')]=_[_0xf39d('0x32')](_0x48b368['model'],_0x48b368[_0xf39d('0x2f')]);_0x1a2340['attributes']=_[_0xf39d('0x32')](_0x48b368['model'],qs[_0xf39d('0x33')](_0x2faaac['query'][_0xf39d('0x33')]));_0x1a2340[_0xf39d('0x34')]=_0x1a2340['attributes'][_0xf39d('0x35')]?_0x1a2340[_0xf39d('0x34')]:_0x48b368[_0xf39d('0x2e')];if(!_0x2faaac['query']['hasOwnProperty'](_0xf39d('0x36'))){_0x1a2340['limit']=qs[_0xf39d('0x37')](_0x2faaac[_0xf39d('0x2f')][_0xf39d('0x37')]);_0x1a2340['offset']=qs[_0xf39d('0x1d')](_0x2faaac[_0xf39d('0x2f')][_0xf39d('0x1d')]);}_0x1a2340[_0xf39d('0x38')]=qs['sort'](_0x2faaac['query'][_0xf39d('0x39')]);_0x1a2340[_0xf39d('0x3a')]=qs['filters'](_[_0xf39d('0x3b')](_0x2faaac[_0xf39d('0x2f')],_0x48b368['filters']),_0x5f56e7);if(_0x2faaac[_0xf39d('0x2f')][_0xf39d('0x3c')]){_0x1a2340[_0xf39d('0x3a')]=_[_0xf39d('0x3d')](_0x1a2340[_0xf39d('0x3a')],{'$or':_['map'](_0x5f56e7,function(_0x5907eb){if(_0x5907eb[_0xf39d('0x3e')]!==_0xf39d('0x3f')){var _0x31f826={};_0x31f826[_0x5907eb['name']]={'$like':'%'+_0x2faaac[_0xf39d('0x2f')][_0xf39d('0x3c')]+'%'};return _0x31f826;}})});}_0x1a2340=_[_0xf39d('0x3d')]({},_0x1a2340,_0x2faaac[_0xf39d('0x40')]);var _0x810f99={'where':_0x1a2340[_0xf39d('0x3a')]};return db[_0xf39d('0x41')][_0xf39d('0x1f')](_0x810f99)[_0xf39d('0x25')](function(_0x444c85){_0x1c8dbe['count']=_0x444c85;if(_0x2faaac[_0xf39d('0x2f')]['includeAll']){_0x1a2340['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xf39d('0x42')](_0x1a2340);})[_0xf39d('0x25')](function(_0x15d7d9){_0x1c8dbe[_0xf39d('0x43')]=_0x15d7d9;return _0x1c8dbe;})[_0xf39d('0x25')](respondWithFilteredResult(_0xe26c38,_0x1a2340))[_0xf39d('0x44')](handleError(_0xe26c38,null));};exports['show']=function(_0x433e7f,_0x500358){var _0x5cb5dd={'raw':![],'where':{'id':_0x433e7f[_0xf39d('0x45')]['id']}},_0x2e3172={};_0x2e3172[_0xf39d('0x2e')]=_[_0xf39d('0x30')](db[_0xf39d('0x41')][_0xf39d('0x2b')]);_0x2e3172[_0xf39d('0x2f')]=_[_0xf39d('0x30')](_0x433e7f[_0xf39d('0x2f')]);_0x2e3172[_0xf39d('0x31')]=_[_0xf39d('0x32')](_0x2e3172[_0xf39d('0x2e')],_0x2e3172[_0xf39d('0x2f')]);_0x5cb5dd['attributes']=_['intersection'](_0x2e3172[_0xf39d('0x2e')],qs[_0xf39d('0x33')](_0x433e7f['query'][_0xf39d('0x33')]));_0x5cb5dd['attributes']=_0x5cb5dd[_0xf39d('0x34')][_0xf39d('0x35')]?_0x5cb5dd[_0xf39d('0x34')]:_0x2e3172[_0xf39d('0x2e')];if(_0x433e7f['query'][_0xf39d('0x46')]){_0x5cb5dd[_0xf39d('0x47')]=[{'all':!![]}];}_0x5cb5dd=_['merge']({},_0x5cb5dd,_0x433e7f[_0xf39d('0x40')]);return db[_0xf39d('0x41')][_0xf39d('0x48')](_0x5cb5dd)[_0xf39d('0x25')](handleEntityNotFound(_0x500358,null))[_0xf39d('0x25')](respondWithResult(_0x500358,null))['catch'](handleError(_0x500358,null));};exports[_0xf39d('0x49')]=function(_0x5551c9,_0x404e80){return db[_0xf39d('0x41')]['create'](_0x5551c9[_0xf39d('0x4a')],{})['then'](respondWithResult(_0x404e80,0xc9))[_0xf39d('0x44')](handleError(_0x404e80,null));};exports['update']=function(_0x149608,_0x4a1efb){if(_0x149608[_0xf39d('0x4a')]['id']){delete _0x149608[_0xf39d('0x4a')]['id'];}return db[_0xf39d('0x41')][_0xf39d('0x48')]({'where':{'id':_0x149608[_0xf39d('0x45')]['id']}})[_0xf39d('0x25')](handleEntityNotFound(_0x4a1efb,null))[_0xf39d('0x25')](saveUpdates(_0x149608[_0xf39d('0x4a')],null))[_0xf39d('0x25')](respondWithResult(_0x4a1efb,null))[_0xf39d('0x44')](handleError(_0x4a1efb,null));};exports[_0xf39d('0x26')]=function(_0x1d62fe,_0x31edfa){return db[_0xf39d('0x41')][_0xf39d('0x48')]({'where':{'id':_0x1d62fe[_0xf39d('0x45')]['id']}})['then'](handleEntityNotFound(_0x31edfa,null))[_0xf39d('0x25')](removeEntity(_0x31edfa,null))[_0xf39d('0x44')](handleError(_0x31edfa,null));};exports[_0xf39d('0x4b')]=function(_0x28a778,_0x425ea8,_0x5065bb){var _0x3e8443={};var _0x31baad={};var _0x86cadd;var _0x4b4c10;return db[_0xf39d('0x41')][_0xf39d('0x4c')]({'where':{'id':_0x28a778[_0xf39d('0x45')]['id']}})[_0xf39d('0x25')](handleEntityNotFound(_0x425ea8,null))[_0xf39d('0x25')](function(_0x45f61b){if(_0x45f61b){_0x86cadd=_0x45f61b;_0x31baad[_0xf39d('0x2e')]=_['keys'](db[_0xf39d('0x4d')][_0xf39d('0x2b')]);_0x31baad[_0xf39d('0x2f')]=_['keys'](_0x28a778['query']);_0x31baad[_0xf39d('0x31')]=_[_0xf39d('0x32')](_0x31baad[_0xf39d('0x2e')],_0x31baad[_0xf39d('0x2f')]);_0x3e8443[_0xf39d('0x34')]=_[_0xf39d('0x32')](_0x31baad[_0xf39d('0x2e')],qs['fields'](_0x28a778['query'][_0xf39d('0x33')]));_0x3e8443[_0xf39d('0x34')]=_0x3e8443[_0xf39d('0x34')][_0xf39d('0x35')]?_0x3e8443[_0xf39d('0x34')]:_0x31baad[_0xf39d('0x2e')];_0x3e8443[_0xf39d('0x38')]=qs[_0xf39d('0x39')](_0x28a778[_0xf39d('0x2f')]['sort']);_0x3e8443[_0xf39d('0x3a')]=qs['filters'](_['pick'](_0x28a778[_0xf39d('0x2f')],_0x31baad['filters']));if(_0x28a778[_0xf39d('0x2f')][_0xf39d('0x3c')]){_0x3e8443['where']=_[_0xf39d('0x3d')](_0x3e8443[_0xf39d('0x3a')],{'$or':_['map'](_0x3e8443[_0xf39d('0x34')],function(_0x57f12d){var _0x77da2c={};_0x77da2c[_0x57f12d]={'$like':'%'+_0x28a778[_0xf39d('0x2f')][_0xf39d('0x3c')]+'%'};return _0x77da2c;})});}_0x3e8443=_[_0xf39d('0x3d')]({},_0x3e8443,_0x28a778[_0xf39d('0x40')]);return _0x86cadd[_0xf39d('0x4b')](_0x3e8443);}})[_0xf39d('0x25')](function(_0x28e956){if(_0x28e956){_0x4b4c10=_0x28e956[_0xf39d('0x35')];if(!_0x28a778[_0xf39d('0x2f')][_0xf39d('0x4e')](_0xf39d('0x36'))){_0x3e8443[_0xf39d('0x37')]=qs['limit'](_0x28a778[_0xf39d('0x2f')][_0xf39d('0x37')]);_0x3e8443['offset']=qs['offset'](_0x28a778[_0xf39d('0x2f')][_0xf39d('0x1d')]);}return _0x86cadd[_0xf39d('0x4b')](_0x3e8443);}})[_0xf39d('0x25')](function(_0x5bc04){if(_0x5bc04){return _0x5bc04?{'count':_0x4b4c10,'rows':_0x5bc04}:null;}})[_0xf39d('0x25')](respondWithResult(_0x425ea8,null))[_0xf39d('0x44')](handleError(_0x425ea8,null));};exports[_0xf39d('0x4f')]=function(_0x1796a6,_0x54346c,_0xdfd20c){if(_0x1796a6['body']['id']){delete _0x1796a6['body']['id'];}return db['ZohoAccount'][_0xf39d('0x4c')]({'where':{'id':_0x1796a6[_0xf39d('0x45')]['id']}})[_0xf39d('0x25')](handleEntityNotFound(_0x54346c,null))[_0xf39d('0x25')](function(_0x5b918e){if(_0x5b918e){_0x1796a6[_0xf39d('0x4a')][_0xf39d('0x50')]=_0x5b918e['id'];_0x1796a6[_0xf39d('0x4a')]['Subjects']=integrations['getSubjects'](_0x1796a6[_0xf39d('0x4a')][_0xf39d('0x51')],_0x1796a6[_0xf39d('0x4a')][_0xf39d('0x3e')]);_0x1796a6[_0xf39d('0x4a')][_0xf39d('0x52')]=integrations[_0xf39d('0x53')](_0x1796a6['body']['channel'],_0x1796a6[_0xf39d('0x4a')][_0xf39d('0x3e')]);return db['ZohoConfiguration'][_0xf39d('0x49')](_0x1796a6['body'],{'include':[{'model':db[_0xf39d('0x54')],'as':_0xf39d('0x55')},{'model':db[_0xf39d('0x54')],'as':'Descriptions'}]});}return null;})[_0xf39d('0x25')](respondWithResult(_0x54346c,null))[_0xf39d('0x44')](handleError(_0x54346c,null));};function getAccessToken(_0xb3162d){return new Promise(function(_0x45422f,_0x2ec01b){var _0x24b66d;switch(_0xb3162d[_0xf39d('0x56')]){case'US':_0x24b66d=_0xf39d('0x57');break;case'AU':_0x24b66d=_0xf39d('0x58');break;case'EU':_0x24b66d=_0xf39d('0x59');break;case'IN':_0x24b66d=_0xf39d('0x5a');break;case'CN':_0x24b66d=_0xf39d('0x5b');break;default:_0x24b66d='https://accounts.zoho.eu';break;}var _0x1e7fbb={'method':_0xf39d('0x5c'),'uri':_0x24b66d+_0xf39d('0x5d'),'qs':{'refresh_token':_0xb3162d['refreshToken'],'client_id':_0xb3162d[_0xf39d('0x5e')],'client_secret':_0xb3162d['clientSecret'],'grant_type':_0xf39d('0x5f')},'json':!![]};return rp(_0x1e7fbb)[_0xf39d('0x25')](function(_0x4b966d){if(_0x4b966d[_0xf39d('0x60')]){_0x45422f(_0x4b966d[_0xf39d('0x60')]);}else{_0x2ec01b(_0xf39d('0x61'));}})['catch'](function(_0x2760ae){_0x2ec01b(_0x2760ae);});});}exports[_0xf39d('0x62')]=function(_0x58ee56,_0x35b990,_0x2f6416){var _0x43e8f5,_0x48a242,_0x4e5bdf,_0x1d304d,_0x1782a3;return db[_0xf39d('0x41')][_0xf39d('0x4c')]({'where':{'id':_0x58ee56[_0xf39d('0x45')]['id']},'attributes':['id',_0xf39d('0x63'),_0xf39d('0x56'),_0xf39d('0x5e'),_0xf39d('0x64'),_0xf39d('0x65'),_0xf39d('0x66'),_0xf39d('0x67')]})[_0xf39d('0x25')](handleEntityNotFound(_0x35b990,null))[_0xf39d('0x25')](function(_0x4969c0){_0x1782a3=_0x4969c0;_0x43e8f5=_0x1782a3[_0xf39d('0x63')];_0x48a242=_0x43e8f5===_0xf39d('0x68')?'eu':_0xf39d('0x69');_0x4e5bdf=_0x1782a3['serverUrl'];var _0x340b16=_0x4e5bdf[_0xf39d('0x6a')](-0x1);if(_0x340b16==='/'||_0x340b16==='\x5c'||_0x340b16===':'){_0x4e5bdf=_0x4e5bdf[_0xf39d('0x6b')](0x0,_0x4e5bdf[_0xf39d('0x6c')](_0x340b16));}if(!_0x1782a3['refreshToken']){throw new Error(_0xf39d('0x6d'));}return getAccessToken(_0x1782a3);})['then'](function(_0x14e529){if(_0x14e529){return rp({'method':_0xf39d('0x6e'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x48a242),'qs':{'module':'Calls'},'headers':{'Authorization':_0xf39d('0x6f')+_0x14e529},'json':!![]});}})[_0xf39d('0x25')](function(_0x28c867){if(_0x28c867){if(_0x28c867[_0xf39d('0x70')]&&_0x28c867[_0xf39d('0x70')][_0xf39d('0x71')]){throw new Error(_0x28c867[_0xf39d('0x70')][_0xf39d('0x71')][_0xf39d('0x72')]);}var _0x4a8b5c=[];var _0x3bac6f=[];var _0x224731=['Owner','Subject',_0xf39d('0x73'),_0xf39d('0x74'),_0xf39d('0x75'),_0xf39d('0x76'),'Call_Start_Time',_0xf39d('0x77')];_0x3bac6f=_['remove'](_0x28c867['fields'],function(_0x535df7){return _0x224731[_0xf39d('0x78')](_0x535df7['api_name']);});for(var _0x145c60=0x0;_0x145c60<_0x3bac6f['length'];_0x145c60++){if(_0x3bac6f[_0x145c60]['system_mandatory']===![]){_0x4a8b5c[_0xf39d('0x79')]({'id':_0x3bac6f[_0x145c60]['id'],'name':_0x3bac6f[_0x145c60][_0xf39d('0x7a')],'custom':_0x3bac6f[_0x145c60][_0xf39d('0x7b')],'options':_0x3bac6f[_0x145c60][_0xf39d('0x7c')]===_0xf39d('0x7d')&&_0x3bac6f[_0x145c60][_0xf39d('0x7e')][_0xf39d('0x35')]>-0x1?_[_0xf39d('0x2a')](_0x3bac6f[_0x145c60][_0xf39d('0x7e')],function(_0x24ec43){return{'name':_0x24ec43,'value':_0x24ec43};}):[]});}}return{'count':_0x4a8b5c[_0xf39d('0x35')],'rows':_0x4a8b5c};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x35b990,null))[_0xf39d('0x44')](function(_0xff8df6){var _0x5ed94f=_0x58ee56[_0xf39d('0x2f')]['test']?0x1f4:_0xff8df6[_0xf39d('0x7f')]||0x1f4;logger[_0xf39d('0x71')](_0xf39d('0x80'),'getFields',_0x5ed94f,JSON[_0xf39d('0x81')](_0xff8df6));delete _0xff8df6[_0xf39d('0x28')];if(_0x5ed94f===0x191){_0x5ed94f=0x190;}_0x35b990[_0xf39d('0x1a')](_0x5ed94f)['send'](_0x58ee56[_0xf39d('0x2f')]['test']?{'message':_0xf39d('0x82'),'statusCode':_0xff8df6[_0xf39d('0x7f')]}:_0xff8df6);});}; \ No newline at end of file +var _0x4f8f=['Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientSecret','serverUrl','code','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','pick_list_values','test','statusCode','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','Content-Range','reject','save','then','status','error','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','ZohoAccount','includeAll','rows','catch','show','include','create','body','update','params','destroy','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel'];(function(_0x584768,_0xc86cfa){var _0x13f82b=function(_0x570f4e){while(--_0x570f4e){_0x584768['push'](_0x584768['shift']());}};_0x13f82b(++_0xc86cfa);}(_0x4f8f,0x1a8));var _0xf4f8=function(_0x22c5a8,_0x47cfd7){_0x22c5a8=_0x22c5a8-0x0;var _0x2bee21=_0x4f8f[_0x22c5a8];return _0x2bee21;};'use strict';var emlformat=require(_0xf4f8('0x0'));var rimraf=require(_0xf4f8('0x1'));var zipdir=require(_0xf4f8('0x2'));var jsonpatch=require(_0xf4f8('0x3'));var rp=require(_0xf4f8('0x4'));var moment=require(_0xf4f8('0x5'));var BPromise=require(_0xf4f8('0x6'));var Mustache=require(_0xf4f8('0x7'));var util=require(_0xf4f8('0x8'));var path=require(_0xf4f8('0x9'));var sox=require(_0xf4f8('0xa'));var csv=require(_0xf4f8('0xb'));var ejs=require(_0xf4f8('0xc'));var fs=require('fs');var fs_extra=require(_0xf4f8('0xd'));var _=require(_0xf4f8('0xe'));var squel=require(_0xf4f8('0xf'));var crypto=require(_0xf4f8('0x10'));var jsforce=require(_0xf4f8('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xf4f8('0xb'));var querystring=require('querystring');var Papa=require(_0xf4f8('0x12'));var Redis=require(_0xf4f8('0x13'));var authService=require(_0xf4f8('0x14'));var qs=require(_0xf4f8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4f8('0x16'));var logger=require(_0xf4f8('0x17'))(_0xf4f8('0x18'));var utils=require(_0xf4f8('0x19'));var config=require(_0xf4f8('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4f8('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x598caa,_0x4db533){_0x4db533=_0x4db533||0xcc;return function(_0x594d98){if(_0x594d98){return _0x598caa[_0xf4f8('0x1c')](_0x4db533);}return _0x598caa['status'](_0x4db533)[_0xf4f8('0x1d')]();};}function respondWithResult(_0x5138fe,_0x4292ec){_0x4292ec=_0x4292ec||0xc8;return function(_0xa63bfc){if(_0xa63bfc){return _0x5138fe['status'](_0x4292ec)[_0xf4f8('0x1e')](_0xa63bfc);}};}function respondWithFilteredResult(_0x5cef99,_0x3ba30c){return function(_0x168c8e){if(_0x168c8e){var _0x15e188=typeof _0x3ba30c['offset']===_0xf4f8('0x1f')&&typeof _0x3ba30c[_0xf4f8('0x20')]==='undefined';var _0x3b951a=_0x168c8e[_0xf4f8('0x21')];var _0x3d508f=_0x15e188?0x0:_0x3ba30c['offset'];var _0x47fb5f=_0x15e188?_0x168c8e[_0xf4f8('0x21')]:_0x3ba30c[_0xf4f8('0x22')]+_0x3ba30c['limit'];var _0x29803e;if(_0x47fb5f>=_0x3b951a){_0x47fb5f=_0x3b951a;_0x29803e=0xc8;}else{_0x29803e=0xce;}_0x5cef99['status'](_0x29803e);return _0x5cef99['set'](_0xf4f8('0x23'),_0x3d508f+'-'+_0x47fb5f+'/'+_0x3b951a)['json'](_0x168c8e);}return null;};}function patchUpdates(_0x418604){return function(_0x2d259b){try{jsonpatch['apply'](_0x2d259b,_0x418604,!![]);}catch(_0x1a23f3){return BPromise[_0xf4f8('0x24')](_0x1a23f3);}return _0x2d259b[_0xf4f8('0x25')]();};}function saveUpdates(_0x42329b,_0x27ca2c){return function(_0x48d6e9){if(_0x48d6e9){return _0x48d6e9['update'](_0x42329b)[_0xf4f8('0x26')](function(_0x5eb35d){return _0x5eb35d;});}return null;};}function removeEntity(_0x47c58f,_0x309885){return function(_0x313188){if(_0x313188){return _0x313188['destroy']()[_0xf4f8('0x26')](function(){_0x47c58f[_0xf4f8('0x27')](0xcc)[_0xf4f8('0x1d')]();});}};}function handleEntityNotFound(_0x3f9111,_0x35e96e){return function(_0x43ba84){if(!_0x43ba84){_0x3f9111[_0xf4f8('0x1c')](0x194);}return _0x43ba84;};}function handleError(_0x6d01ab,_0x1e57cd){_0x1e57cd=_0x1e57cd||0x1f4;return function(_0x546ba4){logger[_0xf4f8('0x28')](_0x546ba4['stack']);if(_0x546ba4[_0xf4f8('0x29')]){delete _0x546ba4[_0xf4f8('0x29')];}_0x6d01ab[_0xf4f8('0x27')](_0x1e57cd)[_0xf4f8('0x2a')](_0x546ba4);};}exports[_0xf4f8('0x2b')]=function(_0x528829,_0x41bc0b){var _0x2be61c={},_0x478477={},_0x277edb={'count':0x0,'rows':[]};var _0x36a013=_['map'](db['ZohoAccount'][_0xf4f8('0x2c')],function(_0x198435){return{'name':_0x198435[_0xf4f8('0x2d')],'type':_0x198435['type']['key']};});_0x478477[_0xf4f8('0x2e')]=_[_0xf4f8('0x2f')](_0x36a013,_0xf4f8('0x29'));_0x478477[_0xf4f8('0x30')]=_[_0xf4f8('0x31')](_0x528829[_0xf4f8('0x30')]);_0x478477[_0xf4f8('0x32')]=_[_0xf4f8('0x33')](_0x478477[_0xf4f8('0x2e')],_0x478477[_0xf4f8('0x30')]);_0x2be61c[_0xf4f8('0x34')]=_[_0xf4f8('0x33')](_0x478477[_0xf4f8('0x2e')],qs[_0xf4f8('0x35')](_0x528829[_0xf4f8('0x30')]['fields']));_0x2be61c[_0xf4f8('0x34')]=_0x2be61c[_0xf4f8('0x34')][_0xf4f8('0x36')]?_0x2be61c[_0xf4f8('0x34')]:_0x478477[_0xf4f8('0x2e')];if(!_0x528829[_0xf4f8('0x30')][_0xf4f8('0x37')](_0xf4f8('0x38'))){_0x2be61c[_0xf4f8('0x20')]=qs[_0xf4f8('0x20')](_0x528829['query'][_0xf4f8('0x20')]);_0x2be61c[_0xf4f8('0x22')]=qs['offset'](_0x528829[_0xf4f8('0x30')][_0xf4f8('0x22')]);}_0x2be61c[_0xf4f8('0x39')]=qs[_0xf4f8('0x3a')](_0x528829[_0xf4f8('0x30')][_0xf4f8('0x3a')]);_0x2be61c[_0xf4f8('0x3b')]=qs[_0xf4f8('0x32')](_[_0xf4f8('0x3c')](_0x528829[_0xf4f8('0x30')],_0x478477['filters']),_0x36a013);if(_0x528829[_0xf4f8('0x30')][_0xf4f8('0x3d')]){_0x2be61c[_0xf4f8('0x3b')]=_[_0xf4f8('0x3e')](_0x2be61c[_0xf4f8('0x3b')],{'$or':_['map'](_0x36a013,function(_0xaad80e){if(_0xaad80e[_0xf4f8('0x3f')]!=='VIRTUAL'){var _0x2759d3={};_0x2759d3[_0xaad80e['name']]={'$like':'%'+_0x528829[_0xf4f8('0x30')][_0xf4f8('0x3d')]+'%'};return _0x2759d3;}})});}_0x2be61c=_[_0xf4f8('0x3e')]({},_0x2be61c,_0x528829[_0xf4f8('0x40')]);var _0x3a8f5b={'where':_0x2be61c['where']};return db[_0xf4f8('0x41')][_0xf4f8('0x21')](_0x3a8f5b)[_0xf4f8('0x26')](function(_0x51bbfb){_0x277edb['count']=_0x51bbfb;if(_0x528829[_0xf4f8('0x30')][_0xf4f8('0x42')]){_0x2be61c['include']=[{'all':!![]}];}return db[_0xf4f8('0x41')]['findAll'](_0x2be61c);})[_0xf4f8('0x26')](function(_0xd02081){_0x277edb[_0xf4f8('0x43')]=_0xd02081;return _0x277edb;})[_0xf4f8('0x26')](respondWithFilteredResult(_0x41bc0b,_0x2be61c))[_0xf4f8('0x44')](handleError(_0x41bc0b,null));};exports[_0xf4f8('0x45')]=function(_0x1fa896,_0x5bbc49){var _0x2f4619={'raw':![],'where':{'id':_0x1fa896['params']['id']}},_0x5e84e3={};_0x5e84e3[_0xf4f8('0x2e')]=_[_0xf4f8('0x31')](db['ZohoAccount'][_0xf4f8('0x2c')]);_0x5e84e3['query']=_[_0xf4f8('0x31')](_0x1fa896[_0xf4f8('0x30')]);_0x5e84e3[_0xf4f8('0x32')]=_[_0xf4f8('0x33')](_0x5e84e3['model'],_0x5e84e3['query']);_0x2f4619['attributes']=_[_0xf4f8('0x33')](_0x5e84e3[_0xf4f8('0x2e')],qs['fields'](_0x1fa896[_0xf4f8('0x30')][_0xf4f8('0x35')]));_0x2f4619[_0xf4f8('0x34')]=_0x2f4619[_0xf4f8('0x34')][_0xf4f8('0x36')]?_0x2f4619[_0xf4f8('0x34')]:_0x5e84e3[_0xf4f8('0x2e')];if(_0x1fa896[_0xf4f8('0x30')][_0xf4f8('0x42')]){_0x2f4619[_0xf4f8('0x46')]=[{'all':!![]}];}_0x2f4619=_[_0xf4f8('0x3e')]({},_0x2f4619,_0x1fa896[_0xf4f8('0x40')]);return db[_0xf4f8('0x41')]['find'](_0x2f4619)[_0xf4f8('0x26')](handleEntityNotFound(_0x5bbc49,null))[_0xf4f8('0x26')](respondWithResult(_0x5bbc49,null))[_0xf4f8('0x44')](handleError(_0x5bbc49,null));};exports['create']=function(_0x10e5c9,_0x432765){return db['ZohoAccount'][_0xf4f8('0x47')](_0x10e5c9[_0xf4f8('0x48')],{})[_0xf4f8('0x26')](respondWithResult(_0x432765,0xc9))[_0xf4f8('0x44')](handleError(_0x432765,null));};exports[_0xf4f8('0x49')]=function(_0x34cb33,_0x43638a){if(_0x34cb33[_0xf4f8('0x48')]['id']){delete _0x34cb33[_0xf4f8('0x48')]['id'];}return db[_0xf4f8('0x41')]['find']({'where':{'id':_0x34cb33[_0xf4f8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x43638a,null))[_0xf4f8('0x26')](saveUpdates(_0x34cb33['body'],null))[_0xf4f8('0x26')](respondWithResult(_0x43638a,null))[_0xf4f8('0x44')](handleError(_0x43638a,null));};exports[_0xf4f8('0x4b')]=function(_0x8d9707,_0x2a3d96){return db['ZohoAccount']['find']({'where':{'id':_0x8d9707['params']['id']}})[_0xf4f8('0x26')](handleEntityNotFound(_0x2a3d96,null))[_0xf4f8('0x26')](removeEntity(_0x2a3d96,null))[_0xf4f8('0x44')](handleError(_0x2a3d96,null));};exports[_0xf4f8('0x4c')]=function(_0x12a6bc,_0x1f3644,_0x2a54f9){var _0x41cf63={};var _0x5d188c={};var _0x2e98b9;var _0x33f1f1;return db[_0xf4f8('0x41')]['findOne']({'where':{'id':_0x12a6bc[_0xf4f8('0x4a')]['id']}})[_0xf4f8('0x26')](handleEntityNotFound(_0x1f3644,null))[_0xf4f8('0x26')](function(_0x17f46c){if(_0x17f46c){_0x2e98b9=_0x17f46c;_0x5d188c[_0xf4f8('0x2e')]=_['keys'](db[_0xf4f8('0x4d')][_0xf4f8('0x2c')]);_0x5d188c[_0xf4f8('0x30')]=_[_0xf4f8('0x31')](_0x12a6bc[_0xf4f8('0x30')]);_0x5d188c[_0xf4f8('0x32')]=_['intersection'](_0x5d188c['model'],_0x5d188c[_0xf4f8('0x30')]);_0x41cf63[_0xf4f8('0x34')]=_['intersection'](_0x5d188c[_0xf4f8('0x2e')],qs['fields'](_0x12a6bc[_0xf4f8('0x30')][_0xf4f8('0x35')]));_0x41cf63[_0xf4f8('0x34')]=_0x41cf63['attributes'][_0xf4f8('0x36')]?_0x41cf63[_0xf4f8('0x34')]:_0x5d188c[_0xf4f8('0x2e')];_0x41cf63[_0xf4f8('0x39')]=qs[_0xf4f8('0x3a')](_0x12a6bc[_0xf4f8('0x30')]['sort']);_0x41cf63[_0xf4f8('0x3b')]=qs[_0xf4f8('0x32')](_['pick'](_0x12a6bc[_0xf4f8('0x30')],_0x5d188c[_0xf4f8('0x32')]));if(_0x12a6bc['query'][_0xf4f8('0x3d')]){_0x41cf63['where']=_['merge'](_0x41cf63[_0xf4f8('0x3b')],{'$or':_[_0xf4f8('0x2f')](_0x41cf63['attributes'],function(_0x45fe75){var _0x3f5bf7={};_0x3f5bf7[_0x45fe75]={'$like':'%'+_0x12a6bc[_0xf4f8('0x30')][_0xf4f8('0x3d')]+'%'};return _0x3f5bf7;})});}_0x41cf63=_[_0xf4f8('0x3e')]({},_0x41cf63,_0x12a6bc['options']);return _0x2e98b9[_0xf4f8('0x4c')](_0x41cf63);}})[_0xf4f8('0x26')](function(_0x2d5c09){if(_0x2d5c09){_0x33f1f1=_0x2d5c09[_0xf4f8('0x36')];if(!_0x12a6bc[_0xf4f8('0x30')][_0xf4f8('0x37')](_0xf4f8('0x38'))){_0x41cf63['limit']=qs[_0xf4f8('0x20')](_0x12a6bc[_0xf4f8('0x30')][_0xf4f8('0x20')]);_0x41cf63['offset']=qs[_0xf4f8('0x22')](_0x12a6bc[_0xf4f8('0x30')]['offset']);}return _0x2e98b9[_0xf4f8('0x4c')](_0x41cf63);}})[_0xf4f8('0x26')](function(_0x9569e3){if(_0x9569e3){return _0x9569e3?{'count':_0x33f1f1,'rows':_0x9569e3}:null;}})[_0xf4f8('0x26')](respondWithResult(_0x1f3644,null))[_0xf4f8('0x44')](handleError(_0x1f3644,null));};exports[_0xf4f8('0x4e')]=function(_0x3481f2,_0x3f2c2d,_0xb29c05){if(_0x3481f2[_0xf4f8('0x48')]['id']){delete _0x3481f2[_0xf4f8('0x48')]['id'];}return db[_0xf4f8('0x41')][_0xf4f8('0x4f')]({'where':{'id':_0x3481f2[_0xf4f8('0x4a')]['id']}})[_0xf4f8('0x26')](handleEntityNotFound(_0x3f2c2d,null))[_0xf4f8('0x26')](function(_0x14edfe){if(_0x14edfe){_0x3481f2[_0xf4f8('0x48')][_0xf4f8('0x50')]=_0x14edfe['id'];_0x3481f2['body'][_0xf4f8('0x51')]=integrations[_0xf4f8('0x52')](_0x3481f2[_0xf4f8('0x48')][_0xf4f8('0x53')],_0x3481f2[_0xf4f8('0x48')][_0xf4f8('0x3f')]);_0x3481f2['body'][_0xf4f8('0x54')]=integrations[_0xf4f8('0x55')](_0x3481f2[_0xf4f8('0x48')][_0xf4f8('0x53')],_0x3481f2[_0xf4f8('0x48')][_0xf4f8('0x3f')]);return db[_0xf4f8('0x4d')][_0xf4f8('0x47')](_0x3481f2[_0xf4f8('0x48')],{'include':[{'model':db[_0xf4f8('0x56')],'as':'Subjects'},{'model':db[_0xf4f8('0x56')],'as':_0xf4f8('0x54')}]});}return null;})[_0xf4f8('0x26')](respondWithResult(_0x3f2c2d,null))[_0xf4f8('0x44')](handleError(_0x3f2c2d,null));};function getAccessToken(_0x3ce6fc){return new Promise(function(_0x4bc644,_0x50a189){var _0xb57580;switch(_0x3ce6fc[_0xf4f8('0x57')]){case'US':_0xb57580='https://accounts.zoho.com';break;case'AU':_0xb57580=_0xf4f8('0x58');break;case'EU':_0xb57580='https://accounts.zoho.eu';break;case'IN':_0xb57580='https://accounts.zoho.in';break;case'CN':_0xb57580=_0xf4f8('0x59');break;default:_0xb57580=_0xf4f8('0x5a');break;}var _0x5c5cd9={'method':_0xf4f8('0x5b'),'uri':_0xb57580+_0xf4f8('0x5c'),'qs':{'refresh_token':_0x3ce6fc[_0xf4f8('0x5d')],'client_id':_0x3ce6fc[_0xf4f8('0x5e')],'client_secret':_0x3ce6fc['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5c5cd9)[_0xf4f8('0x26')](function(_0x3ce2f8){if(_0x3ce2f8[_0xf4f8('0x5f')]){_0x4bc644(_0x3ce2f8[_0xf4f8('0x5f')]);}else{_0x50a189(_0xf4f8('0x60'));}})[_0xf4f8('0x44')](function(_0xd89891){_0x50a189(_0xd89891);});});}exports['getFields']=function(_0x517dd5,_0x27fe0e,_0x2b12ce){var _0x299f4e,_0xb36023,_0x1bb2bd,_0x1f3fed,_0x4a63db;return db[_0xf4f8('0x41')][_0xf4f8('0x4f')]({'where':{'id':_0x517dd5[_0xf4f8('0x4a')]['id']},'attributes':['id',_0xf4f8('0x61'),_0xf4f8('0x57'),_0xf4f8('0x5e'),_0xf4f8('0x62'),_0xf4f8('0x63'),_0xf4f8('0x64'),_0xf4f8('0x5d')]})[_0xf4f8('0x26')](handleEntityNotFound(_0x27fe0e,null))[_0xf4f8('0x26')](function(_0x407ce1){_0x4a63db=_0x407ce1;_0x299f4e=_0x4a63db[_0xf4f8('0x61')];_0xb36023=_0x299f4e===_0xf4f8('0x65')?'eu':_0xf4f8('0x66');_0x1bb2bd=_0x4a63db[_0xf4f8('0x63')];var _0x30038f=_0x1bb2bd[_0xf4f8('0x67')](-0x1);if(_0x30038f==='/'||_0x30038f==='\x5c'||_0x30038f===':'){_0x1bb2bd=_0x1bb2bd['substring'](0x0,_0x1bb2bd[_0xf4f8('0x68')](_0x30038f));}if(!_0x4a63db[_0xf4f8('0x5d')]){throw new Error(_0xf4f8('0x69'));}return getAccessToken(_0x4a63db);})['then'](function(_0x248d05){if(_0x248d05){return rp({'method':_0xf4f8('0x6a'),'uri':util['format'](_0xf4f8('0x6b'),_0xb36023),'qs':{'module':'Calls'},'headers':{'Authorization':_0xf4f8('0x6c')+_0x248d05},'json':!![]});}})['then'](function(_0x540c38){if(_0x540c38){if(_0x540c38['response']&&_0x540c38['response'][_0xf4f8('0x28')]){throw new Error(_0x540c38['response'][_0xf4f8('0x28')]['message']);}var _0x839313=[];var _0x3a1473=[];var _0x57086d=['Owner',_0xf4f8('0x6d'),_0xf4f8('0x6e'),_0xf4f8('0x6f'),_0xf4f8('0x70'),_0xf4f8('0x71'),_0xf4f8('0x72'),_0xf4f8('0x73')];_0x3a1473=_[_0xf4f8('0x74')](_0x540c38[_0xf4f8('0x35')],function(_0x10ee7d){return _0x57086d[_0xf4f8('0x75')](_0x10ee7d[_0xf4f8('0x76')]);});for(var _0x533d2a=0x0;_0x533d2a<_0x3a1473['length'];_0x533d2a++){if(_0x3a1473[_0x533d2a]['system_mandatory']===![]){_0x839313[_0xf4f8('0x77')]({'id':_0x3a1473[_0x533d2a]['id'],'name':_0x3a1473[_0x533d2a][_0xf4f8('0x78')],'custom':_0x3a1473[_0x533d2a][_0xf4f8('0x79')],'options':_0x3a1473[_0x533d2a]['data_type']==='picklist'&&_0x3a1473[_0x533d2a]['pick_list_values'][_0xf4f8('0x36')]>-0x1?_[_0xf4f8('0x2f')](_0x3a1473[_0x533d2a][_0xf4f8('0x7a')],function(_0x2e56e3){return{'name':_0x2e56e3,'value':_0x2e56e3};}):[]});}}return{'count':_0x839313['length'],'rows':_0x839313};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x27fe0e,null))['catch'](function(_0x33e8b5){var _0x4f05ca=_0x517dd5['query'][_0xf4f8('0x7b')]?0x1f4:_0x33e8b5[_0xf4f8('0x7c')]||0x1f4;logger[_0xf4f8('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xf4f8('0x7d'),_0x4f05ca,JSON[_0xf4f8('0x7e')](_0x33e8b5));delete _0x33e8b5[_0xf4f8('0x29')];if(_0x4f05ca===0x191){_0x4f05ca=0x190;}_0x27fe0e[_0xf4f8('0x27')](_0x4f05ca)['send'](_0x517dd5['query'][_0xf4f8('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x33e8b5[_0xf4f8('0x7c')]}:_0x33e8b5);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c0947ef..18174c6 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 _0x9650=['lodash','util','api','moment','request-promise','path','../../config/environment','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x9650,0x1ce));var _0x0965=function(_0x4ed4f9,_0x48aeca){_0x4ed4f9=_0x4ed4f9-0x0;var _0x3e55bd=_0x9650[_0x4ed4f9];return _0x3e55bd;};'use strict';var _=require(_0x0965('0x0'));var util=require(_0x0965('0x1'));var logger=require('../../config/logger')(_0x0965('0x2'));var moment=require(_0x0965('0x3'));var BPromise=require('bluebird');var rp=require(_0x0965('0x4'));var fs=require('fs');var path=require(_0x0965('0x5'));var rimraf=require('rimraf');var config=require(_0x0965('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x0965('0x7'));module['exports']=function(_0x207f24,_0x3b3840){return _0x207f24[_0x0965('0x8')](_0x0965('0x9'),attributes,{'tableName':_0x0965('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ebaa7,_0x320e2c,_0x27d5c9){if(_0x4ebaa7[_0x0965('0xb')](_0x0965('0xc'))||_0x4ebaa7['changed'](_0x0965('0xd'))||_0x4ebaa7[_0x0965('0xb')](_0x0965('0xe'))||_0x4ebaa7[_0x0965('0xb')](_0x0965('0xf'))||_0x4ebaa7[_0x0965('0xb')]('code')||_0x4ebaa7[_0x0965('0xb')](_0x0965('0x10'))){var _0x48881b,_0x13a419;_0x48881b=_0x4ebaa7[_0x0965('0xd')];var _0x302fe7=_0x48881b[_0x0965('0x11')](-0x1);if(_0x302fe7==='/'||_0x302fe7==='\x5c'||_0x302fe7===':'){_0x48881b=_0x48881b[_0x0965('0x12')](0x0,_0x48881b[_0x0965('0x13')](_0x302fe7));}switch(_0x4ebaa7[_0x0965('0xc')]){case'US':_0x13a419=_0x0965('0x14');break;case'AU':_0x13a419=_0x0965('0x15');break;case'IN':_0x13a419=_0x0965('0x16');break;case'CN':_0x13a419=_0x0965('0x17');break;default:_0x13a419=_0x0965('0x18');break;}var _0x68ef11={'method':_0x0965('0x19'),'uri':_0x13a419+_0x0965('0x1a'),'form':{'grant_type':_0x0965('0x1b'),'client_id':_0x4ebaa7[_0x0965('0xe')],'client_secret':_0x4ebaa7[_0x0965('0xf')],'redirect_uri':_0x4ebaa7[_0x0965('0xd')],'code':_0x4ebaa7[_0x0965('0x1c')]},'headers':{'Content-Type':_0x0965('0x1d')}};return rp(_0x68ef11)[_0x0965('0x1e')](function(_0x37e4ac){var _0x2b8b17=JSON[_0x0965('0x1f')](_0x37e4ac);if(_0x2b8b17[_0x0965('0x20')]){_0x4ebaa7[_0x0965('0x21')]=_0x2b8b17[_0x0965('0x20')];logger[_0x0965('0x22')](util[_0x0965('0x23')](_0x0965('0x24'),_0x4ebaa7['name'],_0x4ebaa7['id']));}else{logger[_0x0965('0x25')](util['format'](_0x0965('0x26'),_0x4ebaa7[_0x0965('0x27')],_0x4ebaa7['id']),util[_0x0965('0x28')](_0x2b8b17,{'showHidden':![],'depth':null}));}return _0x27d5c9(null,_0x320e2c);})[_0x0965('0x29')](function(_0x415a55){logger[_0x0965('0x25')](util[_0x0965('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4ebaa7['name'],_0x4ebaa7['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x27d5c9(_0x415a55);});}else{return _0x27d5c9(null,_0x320e2c);}},'beforeUpdate':function(_0x2ddeb4,_0x1207de,_0x2612c3){if(_0x2ddeb4[_0x0965('0xb')]('zone')||_0x2ddeb4['changed']('serverUrl')||_0x2ddeb4[_0x0965('0xb')](_0x0965('0xe'))||_0x2ddeb4[_0x0965('0xb')](_0x0965('0xf'))||_0x2ddeb4[_0x0965('0xb')](_0x0965('0x1c'))||_0x2ddeb4['changed'](_0x0965('0x10'))){var _0x51b8a9,_0x17a1ad;_0x51b8a9=_0x2ddeb4['serverUrl'];var _0x4659fe=_0x51b8a9[_0x0965('0x11')](-0x1);if(_0x4659fe==='/'||_0x4659fe==='\x5c'||_0x4659fe===':'){_0x51b8a9=_0x51b8a9[_0x0965('0x12')](0x0,_0x51b8a9[_0x0965('0x13')](_0x4659fe));}switch(_0x2ddeb4[_0x0965('0xc')]){case'US':_0x17a1ad=_0x0965('0x14');break;case'AU':_0x17a1ad=_0x0965('0x15');break;case'IN':_0x17a1ad=_0x0965('0x16');break;case'CN':_0x17a1ad=_0x0965('0x17');break;default:_0x17a1ad=_0x0965('0x18');break;}var _0x18d6b8={'method':_0x0965('0x19'),'uri':_0x17a1ad+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x2ddeb4[_0x0965('0xe')],'client_secret':_0x2ddeb4[_0x0965('0xf')],'redirect_uri':_0x2ddeb4[_0x0965('0xd')],'code':_0x2ddeb4[_0x0965('0x1c')]},'headers':{'Content-Type':_0x0965('0x1d')}};return rp(_0x18d6b8)[_0x0965('0x1e')](function(_0x3a3283){var _0x5e2e33=JSON[_0x0965('0x1f')](_0x3a3283);if(_0x5e2e33[_0x0965('0x20')]){_0x2ddeb4[_0x0965('0x21')]=_0x5e2e33[_0x0965('0x20')];logger['info'](util[_0x0965('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2ddeb4[_0x0965('0x27')],_0x2ddeb4['id']));}else{logger[_0x0965('0x25')](util[_0x0965('0x23')](_0x0965('0x26'),_0x2ddeb4[_0x0965('0x27')],_0x2ddeb4['id']),util[_0x0965('0x28')](_0x5e2e33,{'showHidden':![],'depth':null}));}return _0x2612c3(null,_0x1207de);})[_0x0965('0x29')](function(_0x4f707e){logger[_0x0965('0x25')](util[_0x0965('0x23')](_0x0965('0x26'),_0x2ddeb4[_0x0965('0x27')],_0x2ddeb4['id']),util[_0x0965('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x2612c3(_0x4f707e);});}else{return _0x2612c3(null,_0x1207de);}}}});}; \ No newline at end of file +var _0xbe33=['format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','authorization_code','application/x-www-form-urlencoded','then','lodash','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','clientId','clientSecret','host','serverUrl','slice','substring','lastIndexOf','zone','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','code','parse','refresh_token','refreshToken','info'];(function(_0x1719a1,_0x60fad4){var _0x445390=function(_0x3fb147){while(--_0x3fb147){_0x1719a1['push'](_0x1719a1['shift']());}};_0x445390(++_0x60fad4);}(_0xbe33,0xaa));var _0x3be3=function(_0x2a960f,_0x5aab73){_0x2a960f=_0x2a960f-0x0;var _0x5027df=_0xbe33[_0x2a960f];return _0x5027df;};'use strict';var _=require(_0x3be3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3be3('0x1'));var BPromise=require(_0x3be3('0x2'));var rp=require(_0x3be3('0x3'));var fs=require('fs');var path=require(_0x3be3('0x4'));var rimraf=require('rimraf');var config=require(_0x3be3('0x5'));var attributes=require(_0x3be3('0x6'));var integrations=require(_0x3be3('0x7'));module[_0x3be3('0x8')]=function(_0x44bfa7,_0x40ef83){return _0x44bfa7[_0x3be3('0x9')](_0x3be3('0xa'),attributes,{'tableName':_0x3be3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x379be6,_0x6e1e2f,_0x10180){if(_0x379be6[_0x3be3('0xc')]('zone')||_0x379be6[_0x3be3('0xc')]('serverUrl')||_0x379be6['changed'](_0x3be3('0xd'))||_0x379be6[_0x3be3('0xc')](_0x3be3('0xe'))||_0x379be6[_0x3be3('0xc')]('code')||_0x379be6['changed'](_0x3be3('0xf'))){var _0x246298,_0x2df57b;_0x246298=_0x379be6[_0x3be3('0x10')];var _0x5e70ea=_0x246298[_0x3be3('0x11')](-0x1);if(_0x5e70ea==='/'||_0x5e70ea==='\x5c'||_0x5e70ea===':'){_0x246298=_0x246298[_0x3be3('0x12')](0x0,_0x246298[_0x3be3('0x13')](_0x5e70ea));}switch(_0x379be6[_0x3be3('0x14')]){case'US':_0x2df57b='https://accounts.zoho.com';break;case'AU':_0x2df57b='https://accounts.zoho.com.au';break;case'IN':_0x2df57b=_0x3be3('0x15');break;case'CN':_0x2df57b=_0x3be3('0x16');break;default:_0x2df57b=_0x3be3('0x17');break;}var _0xb2cb3f={'method':'POST','uri':_0x2df57b+_0x3be3('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x379be6['clientId'],'client_secret':_0x379be6[_0x3be3('0xe')],'redirect_uri':_0x379be6[_0x3be3('0x10')],'code':_0x379be6[_0x3be3('0x19')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0xb2cb3f)['then'](function(_0x4e83a2){var _0x4f63fc=JSON[_0x3be3('0x1a')](_0x4e83a2);if(_0x4f63fc[_0x3be3('0x1b')]){_0x379be6[_0x3be3('0x1c')]=_0x4f63fc[_0x3be3('0x1b')];logger[_0x3be3('0x1d')](util[_0x3be3('0x1e')](_0x3be3('0x1f'),_0x379be6[_0x3be3('0x20')],_0x379be6['id']));}else{logger[_0x3be3('0x21')](util['format'](_0x3be3('0x22'),_0x379be6[_0x3be3('0x20')],_0x379be6['id']),util['inspect'](_0x4f63fc,{'showHidden':![],'depth':null}));}return _0x10180(null,_0x6e1e2f);})[_0x3be3('0x23')](function(_0x4a740b){logger[_0x3be3('0x21')](util['format'](_0x3be3('0x22'),_0x379be6[_0x3be3('0x20')],_0x379be6['id']),util[_0x3be3('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x10180(_0x4a740b);});}else{return _0x10180(null,_0x6e1e2f);}},'beforeUpdate':function(_0x45fe35,_0x193af4,_0x2bc02b){if(_0x45fe35[_0x3be3('0xc')](_0x3be3('0x14'))||_0x45fe35['changed']('serverUrl')||_0x45fe35[_0x3be3('0xc')](_0x3be3('0xd'))||_0x45fe35[_0x3be3('0xc')]('clientSecret')||_0x45fe35[_0x3be3('0xc')]('code')||_0x45fe35[_0x3be3('0xc')](_0x3be3('0xf'))){var _0x4a9021,_0x1581ff;_0x4a9021=_0x45fe35[_0x3be3('0x10')];var _0x38067e=_0x4a9021[_0x3be3('0x11')](-0x1);if(_0x38067e==='/'||_0x38067e==='\x5c'||_0x38067e===':'){_0x4a9021=_0x4a9021[_0x3be3('0x12')](0x0,_0x4a9021['lastIndexOf'](_0x38067e));}switch(_0x45fe35[_0x3be3('0x14')]){case'US':_0x1581ff='https://accounts.zoho.com';break;case'AU':_0x1581ff='https://accounts.zoho.com.au';break;case'IN':_0x1581ff=_0x3be3('0x15');break;case'CN':_0x1581ff='https://accounts.zoho.com.cn';break;default:_0x1581ff=_0x3be3('0x17');break;}var _0x448e18={'method':'POST','uri':_0x1581ff+_0x3be3('0x18'),'form':{'grant_type':_0x3be3('0x25'),'client_id':_0x45fe35[_0x3be3('0xd')],'client_secret':_0x45fe35[_0x3be3('0xe')],'redirect_uri':_0x45fe35[_0x3be3('0x10')],'code':_0x45fe35[_0x3be3('0x19')]},'headers':{'Content-Type':_0x3be3('0x26')}};return rp(_0x448e18)[_0x3be3('0x27')](function(_0xbe6925){var _0x1cd9fa=JSON[_0x3be3('0x1a')](_0xbe6925);if(_0x1cd9fa[_0x3be3('0x1b')]){_0x45fe35['refreshToken']=_0x1cd9fa[_0x3be3('0x1b')];logger[_0x3be3('0x1d')](util[_0x3be3('0x1e')](_0x3be3('0x1f'),_0x45fe35[_0x3be3('0x20')],_0x45fe35['id']));}else{logger[_0x3be3('0x21')](util[_0x3be3('0x1e')](_0x3be3('0x22'),_0x45fe35['name'],_0x45fe35['id']),util['inspect'](_0x1cd9fa,{'showHidden':![],'depth':null}));}return _0x2bc02b(null,_0x193af4);})['catch'](function(_0x5e9a19){logger[_0x3be3('0x21')](util[_0x3be3('0x1e')](_0x3be3('0x22'),_0x45fe35[_0x3be3('0x20')],_0x45fe35['id']),util[_0x3be3('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2bc02b(_0x5e9a19);});}else{return _0x2bc02b(null,_0x193af4);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 4b78335..25e10a9 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 _0x3cd0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZohoAccount','ZohoAccount','find','where','lodash','bluebird'];(function(_0x360ef8,_0x13279f){var _0x294d8b=function(_0x13d696){while(--_0x13d696){_0x360ef8['push'](_0x360ef8['shift']());}};_0x294d8b(++_0x13279f);}(_0x3cd0,0x8a));var _0x03cd=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x3cd0[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x03cd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x03cd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03cd('0x2'));var db=require(_0x03cd('0x3'))['db'];var utils=require(_0x03cd('0x4'));var logger=require(_0x03cd('0x5'))(_0x03cd('0x6'));var config=require('../../config/environment');var jayson=require(_0x03cd('0x7'));var client=jayson[_0x03cd('0x8')][_0x03cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ff934,_0x606150,_0x5dd6eb){return new BPromise(function(_0x67112,_0x5875af){return client[_0x03cd('0xa')](_0x1ff934,_0x5dd6eb)[_0x03cd('0xb')](function(_0x152209){logger[_0x03cd('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x606150,_0x03cd('0xd'));logger[_0x03cd('0xe')](_0x03cd('0xf'),_0x606150,_0x03cd('0xd'),JSON[_0x03cd('0x10')](_0x152209));if(_0x152209[_0x03cd('0x11')]){if(_0x152209['error']['code']===0x1f4){logger[_0x03cd('0x11')](_0x03cd('0x12'),_0x606150,_0x152209[_0x03cd('0x11')][_0x03cd('0x13')]);return _0x5875af(_0x152209['error'][_0x03cd('0x13')]);}logger[_0x03cd('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x606150,_0x152209['error']['message']);return _0x67112(_0x152209[_0x03cd('0x11')][_0x03cd('0x13')]);}else{logger[_0x03cd('0xc')](_0x03cd('0x12'),_0x606150,'request\x20sent');_0x67112(_0x152209[_0x03cd('0x14')][_0x03cd('0x13')]);}})[_0x03cd('0x15')](function(_0x459533){logger[_0x03cd('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x606150,_0x459533);_0x5875af(_0x459533);});});}exports[_0x03cd('0x16')]=function(_0x27de4f){var _0x44e477=this;return new Promise(function(_0x12b3ea,_0x21049d){return db['ZohoAccount'][_0x03cd('0x17')]({'raw':_0x27de4f[_0x03cd('0x18')]?_0x27de4f[_0x03cd('0x18')][_0x03cd('0x19')]===undefined?!![]:![]:!![],'where':_0x27de4f['options']?_0x27de4f[_0x03cd('0x18')]['where']||null:null,'attributes':_0x27de4f[_0x03cd('0x18')]?_0x27de4f[_0x03cd('0x18')][_0x03cd('0x1a')]||null:null,'limit':_0x27de4f['options']?_0x27de4f['options'][_0x03cd('0x1b')]||null:null,'include':_0x27de4f[_0x03cd('0x18')]?_0x27de4f['options'][_0x03cd('0x1c')]?_[_0x03cd('0x1d')](_0x27de4f['options'][_0x03cd('0x1c')],function(_0x514c11){return{'model':db[_0x514c11['model']],'as':_0x514c11['as'],'attributes':_0x514c11[_0x03cd('0x1a')],'include':_0x514c11[_0x03cd('0x1c')]?_[_0x03cd('0x1d')](_0x514c11[_0x03cd('0x1c')],function(_0x5173e9){return{'model':db[_0x5173e9[_0x03cd('0x1e')]],'as':_0x5173e9['as'],'attributes':_0x5173e9['attributes'],'include':_0x5173e9['include']?_[_0x03cd('0x1d')](_0x5173e9[_0x03cd('0x1c')],function(_0x3203b1){return{'model':db[_0x3203b1['model']],'as':_0x3203b1['as'],'attributes':_0x3203b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x03cd('0xb')](function(_0x4f7fb5){logger[_0x03cd('0xc')](_0x03cd('0x16'),_0x27de4f);logger['debug'](_0x03cd('0x16'),_0x27de4f,JSON[_0x03cd('0x10')](_0x4f7fb5));_0x12b3ea(_0x4f7fb5);})[_0x03cd('0x15')](function(_0x12ec99){logger[_0x03cd('0x11')]('GetZohoAccount',_0x12ec99[_0x03cd('0x13')],_0x27de4f);_0x21049d(_0x44e477[_0x03cd('0x11')](0x1f4,_0x12ec99[_0x03cd('0x13')]));});});};exports[_0x03cd('0x1f')]=function(_0x4e43c2){var _0x1a3b3e=this;return new Promise(function(_0x1e2eff,_0x2b9e23){return db[_0x03cd('0x20')][_0x03cd('0x21')]({'raw':_0x4e43c2[_0x03cd('0x18')]?_0x4e43c2[_0x03cd('0x18')][_0x03cd('0x19')]===undefined?!![]:![]:!![],'where':_0x4e43c2[_0x03cd('0x18')]?_0x4e43c2[_0x03cd('0x18')][_0x03cd('0x22')]||null:null,'attributes':_0x4e43c2[_0x03cd('0x18')]?_0x4e43c2[_0x03cd('0x18')]['attributes']||null:null,'include':_0x4e43c2['options']?_0x4e43c2[_0x03cd('0x18')]['include']?_[_0x03cd('0x1d')](_0x4e43c2[_0x03cd('0x18')]['include'],function(_0x4e5d63){return{'model':db[_0x4e5d63[_0x03cd('0x1e')]],'as':_0x4e5d63['as'],'attributes':_0x4e5d63[_0x03cd('0x1a')],'include':_0x4e5d63[_0x03cd('0x1c')]?_[_0x03cd('0x1d')](_0x4e5d63['include'],function(_0x3ad6f1){return{'model':db[_0x3ad6f1[_0x03cd('0x1e')]],'as':_0x3ad6f1['as'],'attributes':_0x3ad6f1[_0x03cd('0x1a')],'include':_0x3ad6f1[_0x03cd('0x1c')]?_[_0x03cd('0x1d')](_0x3ad6f1[_0x03cd('0x1c')],function(_0x533751){return{'model':db[_0x533751[_0x03cd('0x1e')]],'as':_0x533751['as'],'attributes':_0x533751[_0x03cd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x03cd('0xb')](function(_0x53a7ea){logger[_0x03cd('0xc')](_0x03cd('0x1f'),_0x4e43c2);logger[_0x03cd('0xe')](_0x03cd('0x1f'),_0x4e43c2,JSON[_0x03cd('0x10')](_0x53a7ea));_0x1e2eff(_0x53a7ea);})[_0x03cd('0x15')](function(_0x3396d0){logger['error'](_0x03cd('0x1f'),_0x3396d0[_0x03cd('0x13')],_0x4e43c2);_0x2b9e23(_0x1a3b3e['error'](0x1f4,_0x3396d0[_0x03cd('0x13')]));});});}; \ No newline at end of file +var _0x1b0e=['error','code','message','result','catch','GetZohoAccount','findAll','options','raw','where','attributes','include','model','map','stringify','ZohoAccount','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s'];(function(_0xd38e15,_0x171ce9){var _0x570367=function(_0x2d03db){while(--_0x2d03db){_0xd38e15['push'](_0xd38e15['shift']());}};_0x570367(++_0x171ce9);}(_0x1b0e,0x132));var _0xe1b0=function(_0x351d57,_0x9c7f76){_0x351d57=_0x351d57-0x0;var _0x53f8e5=_0x1b0e[_0x351d57];return _0x53f8e5;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e806,_0x36f5cd,_0x1eef2a){return new BPromise(function(_0x5aacc2,_0x123268){return client[_0xe1b0('0xb')](_0x52e806,_0x1eef2a)[_0xe1b0('0xc')](function(_0x400eee){logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));logger[_0xe1b0('0x10')](_0xe1b0('0x11'),_0x36f5cd,_0xe1b0('0xf'),JSON['stringify'](_0x400eee));if(_0x400eee[_0xe1b0('0x12')]){if(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x13')]===0x1f4){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x123268(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);}logger['error'](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x5aacc2(_0x400eee['error']['message']);}else{logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));_0x5aacc2(_0x400eee[_0xe1b0('0x15')][_0xe1b0('0x14')]);}})[_0xe1b0('0x16')](function(_0x5dfd78){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x5dfd78);_0x123268(_0x5dfd78);});});}exports[_0xe1b0('0x17')]=function(_0x2928b6){var _0x349f90=this;return new Promise(function(_0x5c195f,_0x5b300e){return db['ZohoAccount'][_0xe1b0('0x18')]({'raw':_0x2928b6['options']?_0x2928b6[_0xe1b0('0x19')][_0xe1b0('0x1a')]===undefined?!![]:![]:!![],'where':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6['options'][_0xe1b0('0x1b')]||null:null,'attributes':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6['options'][_0xe1b0('0x1c')]||null:null,'limit':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6[_0xe1b0('0x19')]['limit']||null:null,'include':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6['options']['include']?_['map'](_0x2928b6['options'][_0xe1b0('0x1d')],function(_0x4a387d){return{'model':db[_0x4a387d[_0xe1b0('0x1e')]],'as':_0x4a387d['as'],'attributes':_0x4a387d[_0xe1b0('0x1c')],'include':_0x4a387d[_0xe1b0('0x1d')]?_['map'](_0x4a387d[_0xe1b0('0x1d')],function(_0x3ef159){return{'model':db[_0x3ef159['model']],'as':_0x3ef159['as'],'attributes':_0x3ef159[_0xe1b0('0x1c')],'include':_0x3ef159[_0xe1b0('0x1d')]?_[_0xe1b0('0x1f')](_0x3ef159[_0xe1b0('0x1d')],function(_0x11e4b2){return{'model':db[_0x11e4b2['model']],'as':_0x11e4b2['as'],'attributes':_0x11e4b2[_0xe1b0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe1b0('0xc')](function(_0x1a30d0){logger[_0xe1b0('0xd')](_0xe1b0('0x17'),_0x2928b6);logger[_0xe1b0('0x10')](_0xe1b0('0x17'),_0x2928b6,JSON[_0xe1b0('0x20')](_0x1a30d0));_0x5c195f(_0x1a30d0);})['catch'](function(_0x2f7b35){logger[_0xe1b0('0x12')]('GetZohoAccount',_0x2f7b35[_0xe1b0('0x14')],_0x2928b6);_0x5b300e(_0x349f90[_0xe1b0('0x12')](0x1f4,_0x2f7b35['message']));});});};exports['ShowZohoAccount']=function(_0x5cc8e3){var _0x9c4710=this;return new Promise(function(_0x3f2f25,_0xae9a36){return db[_0xe1b0('0x21')][_0xe1b0('0x22')]({'raw':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3['options']['raw']===undefined?!![]:![]:!![],'where':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3[_0xe1b0('0x19')][_0xe1b0('0x1b')]||null:null,'attributes':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3[_0xe1b0('0x19')][_0xe1b0('0x1c')]||null:null,'include':_0x5cc8e3[_0xe1b0('0x19')]?_0x5cc8e3[_0xe1b0('0x19')][_0xe1b0('0x1d')]?_[_0xe1b0('0x1f')](_0x5cc8e3['options']['include'],function(_0x58b897){return{'model':db[_0x58b897[_0xe1b0('0x1e')]],'as':_0x58b897['as'],'attributes':_0x58b897['attributes'],'include':_0x58b897[_0xe1b0('0x1d')]?_[_0xe1b0('0x1f')](_0x58b897[_0xe1b0('0x1d')],function(_0x3c414b){return{'model':db[_0x3c414b[_0xe1b0('0x1e')]],'as':_0x3c414b['as'],'attributes':_0x3c414b[_0xe1b0('0x1c')],'include':_0x3c414b[_0xe1b0('0x1d')]?_['map'](_0x3c414b['include'],function(_0x49df4d){return{'model':db[_0x49df4d[_0xe1b0('0x1e')]],'as':_0x49df4d['as'],'attributes':_0x49df4d['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1b0('0xc')](function(_0x518202){logger['info']('ShowZohoAccount',_0x5cc8e3);logger[_0xe1b0('0x10')](_0xe1b0('0x23'),_0x5cc8e3,JSON[_0xe1b0('0x20')](_0x518202));_0x3f2f25(_0x518202);})[_0xe1b0('0x16')](function(_0x15fd34){logger[_0xe1b0('0x12')]('ShowZohoAccount',_0x15fd34['message'],_0x5cc8e3);_0xae9a36(_0x9c4710[_0xe1b0('0x12')](0x1f4,_0x15fd34[_0xe1b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 999d4ff..404a573 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 _0x6c0f=['/:id/descriptions','getDescriptions','post','delete','destroy','exports','util','express','Router','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x3059aa,_0x400a77){var _0x4cca35=function(_0x44eac8){while(--_0x44eac8){_0x3059aa['push'](_0x3059aa['shift']());}};_0x4cca35(++_0x400a77);}(_0x6c0f,0x15a));var _0xf6c0=function(_0x326954,_0xc37954){_0x326954=_0x326954-0x0;var _0x516d22=_0x6c0f[_0x326954];return _0x516d22;};'use strict';var multer=require('multer');var util=require(_0xf6c0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf6c0('0x1'));var router=express[_0xf6c0('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf6c0('0x3'));var config=require('../../config/environment');var controller=require(_0xf6c0('0x4'));router[_0xf6c0('0x5')]('/',auth[_0xf6c0('0x6')](),controller[_0xf6c0('0x7')]);router[_0xf6c0('0x5')](_0xf6c0('0x8'),auth[_0xf6c0('0x6')](),controller[_0xf6c0('0x9')]);router[_0xf6c0('0x5')](_0xf6c0('0xa'),auth[_0xf6c0('0x6')](),controller[_0xf6c0('0xb')]);router[_0xf6c0('0x5')](_0xf6c0('0xc'),auth[_0xf6c0('0x6')](),controller[_0xf6c0('0xd')]);router[_0xf6c0('0x5')](_0xf6c0('0xe'),auth[_0xf6c0('0x6')](),controller[_0xf6c0('0xf')]);router[_0xf6c0('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf6c0('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xf6c0('0x11')](_0xf6c0('0x8'),auth[_0xf6c0('0x6')](),controller[_0xf6c0('0x12')]);module[_0xf6c0('0x13')]=router; \ No newline at end of file +var _0xe0e9=['/:id/descriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects'];(function(_0x6f2544,_0x45133b){var _0x2e9ed9=function(_0x2dd7cc){while(--_0x2dd7cc){_0x6f2544['push'](_0x6f2544['shift']());}};_0x2e9ed9(++_0x45133b);}(_0xe0e9,0x10f));var _0x9e0e=function(_0x1955b0,_0x9be1e8){_0x1955b0=_0x1955b0-0x0;var _0x2ac7c1=_0xe0e9[_0x1955b0];return _0x2ac7c1;};'use strict';var multer=require(_0x9e0e('0x0'));var util=require(_0x9e0e('0x1'));var path=require(_0x9e0e('0x2'));var timeout=require(_0x9e0e('0x3'));var express=require(_0x9e0e('0x4'));var router=express[_0x9e0e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9e0e('0x6'));var interaction=require(_0x9e0e('0x7'));var config=require(_0x9e0e('0x8'));var controller=require(_0x9e0e('0x9'));router[_0x9e0e('0xa')]('/',auth[_0x9e0e('0xb')](),controller[_0x9e0e('0xc')]);router[_0x9e0e('0xa')](_0x9e0e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9e0e('0xa')](_0x9e0e('0xe'),auth[_0x9e0e('0xb')](),controller[_0x9e0e('0xf')]);router[_0x9e0e('0xa')](_0x9e0e('0x10'),auth[_0x9e0e('0xb')](),controller['getSubjects']);router[_0x9e0e('0xa')](_0x9e0e('0x11'),auth[_0x9e0e('0xb')](),controller['getDescriptions']);router[_0x9e0e('0x12')]('/',auth[_0x9e0e('0xb')](),controller[_0x9e0e('0x13')]);router[_0x9e0e('0x14')](_0x9e0e('0xd'),auth[_0x9e0e('0xb')](),controller[_0x9e0e('0x15')]);router['delete'](_0x9e0e('0xd'),auth[_0x9e0e('0xb')](),controller[_0x9e0e('0x16')]);module[_0x9e0e('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 8c8a763..f0bd290 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 _0x1a96=['nothing','lead','contact_lead','sequelize','exports','STRING','ENUM','contact'];(function(_0x3c9842,_0x2eff1a){var _0x3695f4=function(_0x298e3e){while(--_0x298e3e){_0x3c9842['push'](_0x3c9842['shift']());}};_0x3695f4(++_0x2eff1a);}(_0x1a96,0x1a3));var _0x61a9=function(_0x5dfc75,_0xf0bb64){_0x5dfc75=_0x5dfc75-0x0;var _0x163ec0=_0x1a96[_0x5dfc75];return _0x163ec0;};'use strict';var Sequelize=require(_0x61a9('0x0'));module[_0x61a9('0x1')]={'name':{'type':Sequelize[_0x61a9('0x2')]},'moduleCreate':{'type':Sequelize[_0x61a9('0x3')]('lead',_0x61a9('0x4'),_0x61a9('0x5')),'defaultValue':_0x61a9('0x6')},'moduleSearch':{'type':Sequelize['ENUM'](_0x61a9('0x7'),_0x61a9('0x4'),_0x61a9('0x6')),'defaultValue':_0x61a9('0x7')},'description':{'type':Sequelize[_0x61a9('0x2')]}}; \ No newline at end of file +var _0x3792=['contact','nothing','contact_lead','STRING','ENUM','lead'];(function(_0x2ceb40,_0x1d7314){var _0xde9c59=function(_0x135630){while(--_0x135630){_0x2ceb40['push'](_0x2ceb40['shift']());}};_0xde9c59(++_0x1d7314);}(_0x3792,0x9f));var _0x2379=function(_0x338291,_0x283970){_0x338291=_0x338291-0x0;var _0xb0cba7=_0x3792[_0x338291];return _0xb0cba7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2379('0x0')]},'moduleCreate':{'type':Sequelize[_0x2379('0x1')](_0x2379('0x2'),_0x2379('0x3'),_0x2379('0x4')),'defaultValue':_0x2379('0x2')},'moduleSearch':{'type':Sequelize[_0x2379('0x1')](_0x2379('0x5'),_0x2379('0x3'),_0x2379('0x2')),'defaultValue':_0x2379('0x5')},'description':{'type':Sequelize[_0x2379('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index a18aea3..54a3f51 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 _0x23b5=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x403e23,_0x5eabf0){var _0x2d7882=function(_0xf566a7){while(--_0xf566a7){_0x403e23['push'](_0x403e23['shift']());}};_0x2d7882(++_0x5eabf0);}(_0x23b5,0x151));var _0x523b=function(_0x27c24e,_0x5db1c7){_0x27c24e=_0x27c24e-0x0;var _0x39004a=_0x23b5[_0x27c24e];return _0x39004a;};'use strict';var emlformat=require(_0x523b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x523b('0x1'));var jsonpatch=require(_0x523b('0x2'));var rp=require('request-promise');var moment=require(_0x523b('0x3'));var BPromise=require(_0x523b('0x4'));var Mustache=require(_0x523b('0x5'));var util=require(_0x523b('0x6'));var path=require(_0x523b('0x7'));var sox=require(_0x523b('0x8'));var csv=require('to-csv');var ejs=require(_0x523b('0x9'));var fs=require('fs');var fs_extra=require(_0x523b('0xa'));var _=require(_0x523b('0xb'));var squel=require(_0x523b('0xc'));var crypto=require(_0x523b('0xd'));var jsforce=require(_0x523b('0xe'));var deskjs=require(_0x523b('0xf'));var toCsv=require(_0x523b('0x10'));var querystring=require(_0x523b('0x11'));var Papa=require(_0x523b('0x12'));var Redis=require(_0x523b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x523b('0x14'));var as=require(_0x523b('0x15'));var hardwareService=require(_0x523b('0x16'));var logger=require(_0x523b('0x17'))(_0x523b('0x18'));var utils=require(_0x523b('0x19'));var config=require(_0x523b('0x1a'));var licenseUtil=require(_0x523b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f1285,_0x1ea17d){_0x1ea17d=_0x1ea17d||0xcc;return function(_0x430540){if(_0x430540){return _0x3f1285['sendStatus'](_0x1ea17d);}return _0x3f1285[_0x523b('0x1c')](_0x1ea17d)[_0x523b('0x1d')]();};}function respondWithResult(_0xa0d2a5,_0x4e0dc7){_0x4e0dc7=_0x4e0dc7||0xc8;return function(_0x2293f3){if(_0x2293f3){return _0xa0d2a5[_0x523b('0x1c')](_0x4e0dc7)[_0x523b('0x1e')](_0x2293f3);}};}function respondWithFilteredResult(_0x257e2b,_0x5efc01){return function(_0x56c01a){if(_0x56c01a){var _0x108780=typeof _0x5efc01[_0x523b('0x1f')]===_0x523b('0x20')&&typeof _0x5efc01['limit']==='undefined';var _0x9b9174=_0x56c01a[_0x523b('0x21')];var _0x49020c=_0x108780?0x0:_0x5efc01['offset'];var _0x24e999=_0x108780?_0x56c01a[_0x523b('0x21')]:_0x5efc01[_0x523b('0x1f')]+_0x5efc01['limit'];var _0x4cf23b;if(_0x24e999>=_0x9b9174){_0x24e999=_0x9b9174;_0x4cf23b=0xc8;}else{_0x4cf23b=0xce;}_0x257e2b[_0x523b('0x1c')](_0x4cf23b);return _0x257e2b[_0x523b('0x22')](_0x523b('0x23'),_0x49020c+'-'+_0x24e999+'/'+_0x9b9174)[_0x523b('0x1e')](_0x56c01a);}return null;};}function patchUpdates(_0x268785){return function(_0x206b2d){try{jsonpatch[_0x523b('0x24')](_0x206b2d,_0x268785,!![]);}catch(_0x3ec7ea){return BPromise[_0x523b('0x25')](_0x3ec7ea);}return _0x206b2d['save']();};}function saveUpdates(_0x3503fb,_0x4288bf){return function(_0x30333f){if(_0x30333f){return _0x30333f[_0x523b('0x26')](_0x3503fb)['then'](function(_0xd9cdb8){return _0xd9cdb8;});}return null;};}function removeEntity(_0x42556c,_0x3004ad){return function(_0x22d5e2){if(_0x22d5e2){return _0x22d5e2[_0x523b('0x27')]()[_0x523b('0x28')](function(){_0x42556c[_0x523b('0x1c')](0xcc)[_0x523b('0x1d')]();});}};}function handleEntityNotFound(_0x41d52a,_0x9c3af2){return function(_0x1520c3){if(!_0x1520c3){_0x41d52a[_0x523b('0x29')](0x194);}return _0x1520c3;};}function handleError(_0x2196c8,_0x330738){_0x330738=_0x330738||0x1f4;return function(_0x46f569){logger[_0x523b('0x2a')](_0x46f569[_0x523b('0x2b')]);if(_0x46f569[_0x523b('0x2c')]){delete _0x46f569[_0x523b('0x2c')];}_0x2196c8[_0x523b('0x1c')](_0x330738)[_0x523b('0x2d')](_0x46f569);};}exports[_0x523b('0x2e')]=function(_0x552afa,_0x2be41c){var _0x379a50={},_0x2fcd63={},_0x149e23={'count':0x0,'rows':[]};var _0x10491d=_[_0x523b('0x2f')](db[_0x523b('0x30')][_0x523b('0x31')],function(_0x361662){return{'name':_0x361662[_0x523b('0x32')],'type':_0x361662[_0x523b('0x33')][_0x523b('0x34')]};});_0x2fcd63[_0x523b('0x35')]=_[_0x523b('0x2f')](_0x10491d,_0x523b('0x2c'));_0x2fcd63[_0x523b('0x36')]=_[_0x523b('0x37')](_0x552afa[_0x523b('0x36')]);_0x2fcd63[_0x523b('0x38')]=_[_0x523b('0x39')](_0x2fcd63[_0x523b('0x35')],_0x2fcd63[_0x523b('0x36')]);_0x379a50['attributes']=_[_0x523b('0x39')](_0x2fcd63[_0x523b('0x35')],qs['fields'](_0x552afa[_0x523b('0x36')][_0x523b('0x3a')]));_0x379a50[_0x523b('0x3b')]=_0x379a50[_0x523b('0x3b')][_0x523b('0x3c')]?_0x379a50[_0x523b('0x3b')]:_0x2fcd63[_0x523b('0x35')];if(!_0x552afa[_0x523b('0x36')][_0x523b('0x3d')](_0x523b('0x3e'))){_0x379a50['limit']=qs[_0x523b('0x3f')](_0x552afa[_0x523b('0x36')][_0x523b('0x3f')]);_0x379a50[_0x523b('0x1f')]=qs['offset'](_0x552afa[_0x523b('0x36')][_0x523b('0x1f')]);}_0x379a50[_0x523b('0x40')]=qs[_0x523b('0x41')](_0x552afa[_0x523b('0x36')][_0x523b('0x41')]);_0x379a50['where']=qs[_0x523b('0x38')](_[_0x523b('0x42')](_0x552afa['query'],_0x2fcd63[_0x523b('0x38')]),_0x10491d);if(_0x552afa[_0x523b('0x36')]['filter']){_0x379a50[_0x523b('0x43')]=_[_0x523b('0x44')](_0x379a50[_0x523b('0x43')],{'$or':_[_0x523b('0x2f')](_0x10491d,function(_0x529a0c){if(_0x529a0c[_0x523b('0x33')]!==_0x523b('0x45')){var _0x44ed28={};_0x44ed28[_0x529a0c[_0x523b('0x2c')]]={'$like':'%'+_0x552afa[_0x523b('0x36')][_0x523b('0x46')]+'%'};return _0x44ed28;}})});}_0x379a50=_[_0x523b('0x44')]({},_0x379a50,_0x552afa[_0x523b('0x47')]);var _0x3e89a7={'where':_0x379a50[_0x523b('0x43')]};return db[_0x523b('0x30')][_0x523b('0x21')](_0x3e89a7)[_0x523b('0x28')](function(_0x83a720){_0x149e23[_0x523b('0x21')]=_0x83a720;if(_0x552afa[_0x523b('0x36')][_0x523b('0x48')]){_0x379a50[_0x523b('0x49')]=[{'all':!![]}];}return db[_0x523b('0x30')][_0x523b('0x4a')](_0x379a50);})[_0x523b('0x28')](function(_0x27e2e1){_0x149e23[_0x523b('0x4b')]=_0x27e2e1;return _0x149e23;})[_0x523b('0x28')](respondWithFilteredResult(_0x2be41c,_0x379a50))[_0x523b('0x4c')](handleError(_0x2be41c,null));};exports[_0x523b('0x4d')]=function(_0xc624a2,_0x2d54e1){var _0x48eddb={'raw':![],'where':{'id':_0xc624a2[_0x523b('0x4e')]['id']}},_0x4de5ab={};_0x4de5ab[_0x523b('0x35')]=_[_0x523b('0x37')](db[_0x523b('0x30')]['rawAttributes']);_0x4de5ab[_0x523b('0x36')]=_[_0x523b('0x37')](_0xc624a2[_0x523b('0x36')]);_0x4de5ab['filters']=_[_0x523b('0x39')](_0x4de5ab[_0x523b('0x35')],_0x4de5ab[_0x523b('0x36')]);_0x48eddb[_0x523b('0x3b')]=_[_0x523b('0x39')](_0x4de5ab[_0x523b('0x35')],qs['fields'](_0xc624a2['query'][_0x523b('0x3a')]));_0x48eddb[_0x523b('0x3b')]=_0x48eddb[_0x523b('0x3b')]['length']?_0x48eddb[_0x523b('0x3b')]:_0x4de5ab[_0x523b('0x35')];if(_0xc624a2[_0x523b('0x36')][_0x523b('0x48')]){_0x48eddb[_0x523b('0x49')]=[{'all':!![]}];}_0x48eddb=_[_0x523b('0x44')]({},_0x48eddb,_0xc624a2['options']);return db[_0x523b('0x30')]['find'](_0x48eddb)[_0x523b('0x28')](handleEntityNotFound(_0x2d54e1,null))['then'](respondWithResult(_0x2d54e1,null))[_0x523b('0x4c')](handleError(_0x2d54e1,null));};exports['create']=function(_0x440731,_0x11d303){return db[_0x523b('0x30')][_0x523b('0x4f')](_0x440731[_0x523b('0x50')],{})[_0x523b('0x28')](respondWithResult(_0x11d303,0xc9))[_0x523b('0x4c')](handleError(_0x11d303,null));};exports[_0x523b('0x26')]=function(_0x4b12d9,_0x1cacd3){if(_0x4b12d9['body']['id']){delete _0x4b12d9['body']['id'];}return db['ZohoConfiguration'][_0x523b('0x51')]({'where':{'id':_0x4b12d9[_0x523b('0x4e')]['id']}})[_0x523b('0x28')](handleEntityNotFound(_0x1cacd3,null))[_0x523b('0x28')](saveUpdates(_0x4b12d9['body'],null))['then'](respondWithResult(_0x1cacd3,null))[_0x523b('0x4c')](handleError(_0x1cacd3,null));};exports[_0x523b('0x27')]=function(_0x458e4e,_0x2445e1){return db[_0x523b('0x30')][_0x523b('0x51')]({'where':{'id':_0x458e4e[_0x523b('0x4e')]['id']}})[_0x523b('0x28')](handleEntityNotFound(_0x2445e1,null))[_0x523b('0x28')](removeEntity(_0x2445e1,null))[_0x523b('0x4c')](handleError(_0x2445e1,null));};exports[_0x523b('0x52')]=function(_0x256d94,_0x4ba008,_0x48594d){var _0x520127={};var _0x450e7e={};var _0x39a9b8;var _0x209a33;return db['ZohoConfiguration'][_0x523b('0x53')]({'where':{'id':_0x256d94[_0x523b('0x4e')]['id']}})[_0x523b('0x28')](handleEntityNotFound(_0x4ba008,null))[_0x523b('0x28')](function(_0x3587d7){if(_0x3587d7){_0x39a9b8=_0x3587d7;_0x450e7e[_0x523b('0x35')]=_[_0x523b('0x37')](db[_0x523b('0x54')]['rawAttributes']);_0x450e7e[_0x523b('0x36')]=_[_0x523b('0x37')](_0x256d94[_0x523b('0x36')]);_0x450e7e[_0x523b('0x38')]=_[_0x523b('0x39')](_0x450e7e[_0x523b('0x35')],_0x450e7e[_0x523b('0x36')]);_0x520127[_0x523b('0x3b')]=_[_0x523b('0x39')](_0x450e7e[_0x523b('0x35')],qs[_0x523b('0x3a')](_0x256d94[_0x523b('0x36')][_0x523b('0x3a')]));_0x520127['attributes']=_0x520127['attributes']['length']?_0x520127[_0x523b('0x3b')]:_0x450e7e[_0x523b('0x35')];_0x520127[_0x523b('0x40')]=qs['sort'](_0x256d94[_0x523b('0x36')][_0x523b('0x41')]);_0x520127['where']=qs['filters'](_[_0x523b('0x42')](_0x256d94[_0x523b('0x36')],_0x450e7e['filters']));if(_0x256d94[_0x523b('0x36')]['filter']){_0x520127['where']=_[_0x523b('0x44')](_0x520127[_0x523b('0x43')],{'$or':_[_0x523b('0x2f')](_0x520127[_0x523b('0x3b')],function(_0x1eaf16){var _0xfc2dcc={};_0xfc2dcc[_0x1eaf16]={'$like':'%'+_0x256d94['query'][_0x523b('0x46')]+'%'};return _0xfc2dcc;})});}_0x520127=_[_0x523b('0x44')]({},_0x520127,_0x256d94[_0x523b('0x47')]);return _0x39a9b8[_0x523b('0x52')](_0x520127);}})[_0x523b('0x28')](function(_0x25eaf4){if(_0x25eaf4){_0x209a33=_0x25eaf4[_0x523b('0x3c')];if(!_0x256d94[_0x523b('0x36')]['hasOwnProperty'](_0x523b('0x3e'))){_0x520127[_0x523b('0x3f')]=qs[_0x523b('0x3f')](_0x256d94[_0x523b('0x36')][_0x523b('0x3f')]);_0x520127[_0x523b('0x1f')]=qs[_0x523b('0x1f')](_0x256d94[_0x523b('0x36')][_0x523b('0x1f')]);}return _0x39a9b8['getFields'](_0x520127);}})[_0x523b('0x28')](function(_0x11807a){if(_0x11807a){return _0x11807a?{'count':_0x209a33,'rows':_0x11807a}:null;}})[_0x523b('0x28')](respondWithResult(_0x4ba008,null))[_0x523b('0x4c')](handleError(_0x4ba008,null));};exports[_0x523b('0x55')]=function(_0x2dad3d,_0x5ebfe5,_0x433d91){var _0x4d991c={};var _0x5e6f13={};var _0x383711;var _0x4a90ac;return db['ZohoConfiguration'][_0x523b('0x53')]({'where':{'id':_0x2dad3d['params']['id']}})[_0x523b('0x28')](handleEntityNotFound(_0x5ebfe5,null))[_0x523b('0x28')](function(_0x90637d){if(_0x90637d){_0x383711=_0x90637d;_0x5e6f13[_0x523b('0x35')]=_[_0x523b('0x37')](db[_0x523b('0x54')][_0x523b('0x31')]);_0x5e6f13[_0x523b('0x36')]=_['keys'](_0x2dad3d[_0x523b('0x36')]);_0x5e6f13['filters']=_[_0x523b('0x39')](_0x5e6f13[_0x523b('0x35')],_0x5e6f13[_0x523b('0x36')]);_0x4d991c[_0x523b('0x3b')]=_[_0x523b('0x39')](_0x5e6f13[_0x523b('0x35')],qs['fields'](_0x2dad3d[_0x523b('0x36')][_0x523b('0x3a')]));_0x4d991c[_0x523b('0x3b')]=_0x4d991c[_0x523b('0x3b')]['length']?_0x4d991c[_0x523b('0x3b')]:_0x5e6f13[_0x523b('0x35')];_0x4d991c['order']=qs[_0x523b('0x41')](_0x2dad3d['query'][_0x523b('0x41')]);_0x4d991c[_0x523b('0x43')]=qs['filters'](_['pick'](_0x2dad3d[_0x523b('0x36')],_0x5e6f13['filters']));if(_0x2dad3d['query']['filter']){_0x4d991c[_0x523b('0x43')]=_[_0x523b('0x44')](_0x4d991c[_0x523b('0x43')],{'$or':_['map'](_0x4d991c[_0x523b('0x3b')],function(_0x54af7a){var _0x39e350={};_0x39e350[_0x54af7a]={'$like':'%'+_0x2dad3d[_0x523b('0x36')]['filter']+'%'};return _0x39e350;})});}_0x4d991c=_[_0x523b('0x44')]({},_0x4d991c,_0x2dad3d[_0x523b('0x47')]);return _0x383711[_0x523b('0x55')](_0x4d991c);}})[_0x523b('0x28')](function(_0x54f0da){if(_0x54f0da){_0x4a90ac=_0x54f0da[_0x523b('0x3c')];if(!_0x2dad3d[_0x523b('0x36')][_0x523b('0x3d')](_0x523b('0x3e'))){_0x4d991c[_0x523b('0x3f')]=qs[_0x523b('0x3f')](_0x2dad3d[_0x523b('0x36')][_0x523b('0x3f')]);_0x4d991c[_0x523b('0x1f')]=qs[_0x523b('0x1f')](_0x2dad3d[_0x523b('0x36')][_0x523b('0x1f')]);}return _0x383711[_0x523b('0x55')](_0x4d991c);}})[_0x523b('0x28')](function(_0x18506e){if(_0x18506e){return _0x18506e?{'count':_0x4a90ac,'rows':_0x18506e}:null;}})[_0x523b('0x28')](respondWithResult(_0x5ebfe5,null))[_0x523b('0x4c')](handleError(_0x5ebfe5,null));};exports['getDescriptions']=function(_0x1f1423,_0x19f878,_0x91b891){var _0x26ea66={};var _0x241277={};var _0x5cf30c;var _0x5651bf;return db['ZohoConfiguration'][_0x523b('0x53')]({'where':{'id':_0x1f1423['params']['id']}})[_0x523b('0x28')](handleEntityNotFound(_0x19f878,null))[_0x523b('0x28')](function(_0x3eba14){if(_0x3eba14){_0x5cf30c=_0x3eba14;_0x241277[_0x523b('0x35')]=_['keys'](db[_0x523b('0x54')][_0x523b('0x31')]);_0x241277['query']=_[_0x523b('0x37')](_0x1f1423[_0x523b('0x36')]);_0x241277[_0x523b('0x38')]=_[_0x523b('0x39')](_0x241277['model'],_0x241277[_0x523b('0x36')]);_0x26ea66[_0x523b('0x3b')]=_[_0x523b('0x39')](_0x241277['model'],qs['fields'](_0x1f1423[_0x523b('0x36')][_0x523b('0x3a')]));_0x26ea66['attributes']=_0x26ea66[_0x523b('0x3b')][_0x523b('0x3c')]?_0x26ea66[_0x523b('0x3b')]:_0x241277[_0x523b('0x35')];_0x26ea66[_0x523b('0x40')]=qs['sort'](_0x1f1423[_0x523b('0x36')]['sort']);_0x26ea66[_0x523b('0x43')]=qs['filters'](_['pick'](_0x1f1423[_0x523b('0x36')],_0x241277[_0x523b('0x38')]));if(_0x1f1423['query'][_0x523b('0x46')]){_0x26ea66[_0x523b('0x43')]=_['merge'](_0x26ea66[_0x523b('0x43')],{'$or':_[_0x523b('0x2f')](_0x26ea66[_0x523b('0x3b')],function(_0x8da9f){var _0x16b3c6={};_0x16b3c6[_0x8da9f]={'$like':'%'+_0x1f1423['query'][_0x523b('0x46')]+'%'};return _0x16b3c6;})});}_0x26ea66=_[_0x523b('0x44')]({},_0x26ea66,_0x1f1423[_0x523b('0x47')]);return _0x5cf30c[_0x523b('0x56')](_0x26ea66);}})['then'](function(_0x5a93c4){if(_0x5a93c4){_0x5651bf=_0x5a93c4[_0x523b('0x3c')];if(!_0x1f1423[_0x523b('0x36')][_0x523b('0x3d')]('nolimit')){_0x26ea66[_0x523b('0x3f')]=qs[_0x523b('0x3f')](_0x1f1423[_0x523b('0x36')][_0x523b('0x3f')]);_0x26ea66[_0x523b('0x1f')]=qs[_0x523b('0x1f')](_0x1f1423[_0x523b('0x36')]['offset']);}return _0x5cf30c[_0x523b('0x56')](_0x26ea66);}})[_0x523b('0x28')](function(_0x4557fa){if(_0x4557fa){return _0x4557fa?{'count':_0x5651bf,'rows':_0x4557fa}:null;}})[_0x523b('0x28')](respondWithResult(_0x19f878,null))[_0x523b('0x4c')](handleError(_0x19f878,null));}; \ No newline at end of file +var _0xe316=['end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZohoConfiguration','includeAll','findAll','rows','catch','show','params','include','find','create','body','findOne','ZohoField','order','getFields','getSubjects','length','getDescriptions','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0xe316,0x8c));var _0x6e31=function(_0x179535,_0x494780){_0x179535=_0x179535-0x0;var _0x11ef66=_0xe316[_0x179535];return _0x11ef66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e31('0x0'));var zipdir=require(_0x6e31('0x1'));var jsonpatch=require(_0x6e31('0x2'));var rp=require(_0x6e31('0x3'));var moment=require(_0x6e31('0x4'));var BPromise=require(_0x6e31('0x5'));var Mustache=require(_0x6e31('0x6'));var util=require(_0x6e31('0x7'));var path=require(_0x6e31('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6e31('0x9'));var fs=require('fs');var fs_extra=require(_0x6e31('0xa'));var _=require(_0x6e31('0xb'));var squel=require(_0x6e31('0xc'));var crypto=require(_0x6e31('0xd'));var jsforce=require(_0x6e31('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6e31('0xf'));var querystring=require(_0x6e31('0x10'));var Papa=require(_0x6e31('0x11'));var Redis=require('ioredis');var authService=require(_0x6e31('0x12'));var qs=require(_0x6e31('0x13'));var as=require(_0x6e31('0x14'));var hardwareService=require(_0x6e31('0x15'));var logger=require(_0x6e31('0x16'))(_0x6e31('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6e31('0x18'));var db=require(_0x6e31('0x19'))['db'];function respondWithStatusCode(_0x41295e,_0x265fe3){_0x265fe3=_0x265fe3||0xcc;return function(_0x18bb94){if(_0x18bb94){return _0x41295e[_0x6e31('0x1a')](_0x265fe3);}return _0x41295e[_0x6e31('0x1b')](_0x265fe3)[_0x6e31('0x1c')]();};}function respondWithResult(_0x3a34f3,_0x529ab2){_0x529ab2=_0x529ab2||0xc8;return function(_0x568616){if(_0x568616){return _0x3a34f3[_0x6e31('0x1b')](_0x529ab2)['json'](_0x568616);}};}function respondWithFilteredResult(_0x7c4fdf,_0x16351c){return function(_0x3b644d){if(_0x3b644d){var _0x54064a=typeof _0x16351c[_0x6e31('0x1d')]==='undefined'&&typeof _0x16351c[_0x6e31('0x1e')]===_0x6e31('0x1f');var _0xd989b7=_0x3b644d[_0x6e31('0x20')];var _0x58309e=_0x54064a?0x0:_0x16351c[_0x6e31('0x1d')];var _0x4f639c=_0x54064a?_0x3b644d['count']:_0x16351c[_0x6e31('0x1d')]+_0x16351c[_0x6e31('0x1e')];var _0x26d185;if(_0x4f639c>=_0xd989b7){_0x4f639c=_0xd989b7;_0x26d185=0xc8;}else{_0x26d185=0xce;}_0x7c4fdf[_0x6e31('0x1b')](_0x26d185);return _0x7c4fdf[_0x6e31('0x21')](_0x6e31('0x22'),_0x58309e+'-'+_0x4f639c+'/'+_0xd989b7)[_0x6e31('0x23')](_0x3b644d);}return null;};}function patchUpdates(_0x36265a){return function(_0x2bf787){try{jsonpatch[_0x6e31('0x24')](_0x2bf787,_0x36265a,!![]);}catch(_0x3ca689){return BPromise['reject'](_0x3ca689);}return _0x2bf787[_0x6e31('0x25')]();};}function saveUpdates(_0x3b4f32,_0x1b8cfa){return function(_0x45e1e3){if(_0x45e1e3){return _0x45e1e3[_0x6e31('0x26')](_0x3b4f32)[_0x6e31('0x27')](function(_0x2668b3){return _0x2668b3;});}return null;};}function removeEntity(_0x22ee7b,_0x2368f8){return function(_0x423ffa){if(_0x423ffa){return _0x423ffa[_0x6e31('0x28')]()[_0x6e31('0x27')](function(){_0x22ee7b[_0x6e31('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x806444,_0x170131){return function(_0x29edad){if(!_0x29edad){_0x806444[_0x6e31('0x1a')](0x194);}return _0x29edad;};}function handleError(_0x1826a6,_0x27e7a2){_0x27e7a2=_0x27e7a2||0x1f4;return function(_0x3202f5){logger[_0x6e31('0x29')](_0x3202f5[_0x6e31('0x2a')]);if(_0x3202f5['name']){delete _0x3202f5[_0x6e31('0x2b')];}_0x1826a6[_0x6e31('0x1b')](_0x27e7a2)[_0x6e31('0x2c')](_0x3202f5);};}exports[_0x6e31('0x2d')]=function(_0xde903c,_0x4f53fa){var _0xe3f9d1={},_0x432ea3={},_0x7f002f={'count':0x0,'rows':[]};var _0x5e1e29=_[_0x6e31('0x2e')](db['ZohoConfiguration'][_0x6e31('0x2f')],function(_0x3c31ad){return{'name':_0x3c31ad[_0x6e31('0x30')],'type':_0x3c31ad['type'][_0x6e31('0x31')]};});_0x432ea3[_0x6e31('0x32')]=_[_0x6e31('0x2e')](_0x5e1e29,_0x6e31('0x2b'));_0x432ea3[_0x6e31('0x33')]=_[_0x6e31('0x34')](_0xde903c['query']);_0x432ea3['filters']=_[_0x6e31('0x35')](_0x432ea3['model'],_0x432ea3['query']);_0xe3f9d1['attributes']=_[_0x6e31('0x35')](_0x432ea3[_0x6e31('0x32')],qs['fields'](_0xde903c[_0x6e31('0x33')][_0x6e31('0x36')]));_0xe3f9d1['attributes']=_0xe3f9d1['attributes']['length']?_0xe3f9d1[_0x6e31('0x37')]:_0x432ea3[_0x6e31('0x32')];if(!_0xde903c[_0x6e31('0x33')][_0x6e31('0x38')]('nolimit')){_0xe3f9d1[_0x6e31('0x1e')]=qs[_0x6e31('0x1e')](_0xde903c[_0x6e31('0x33')][_0x6e31('0x1e')]);_0xe3f9d1[_0x6e31('0x1d')]=qs[_0x6e31('0x1d')](_0xde903c[_0x6e31('0x33')][_0x6e31('0x1d')]);}_0xe3f9d1['order']=qs[_0x6e31('0x39')](_0xde903c['query'][_0x6e31('0x39')]);_0xe3f9d1[_0x6e31('0x3a')]=qs[_0x6e31('0x3b')](_[_0x6e31('0x3c')](_0xde903c[_0x6e31('0x33')],_0x432ea3[_0x6e31('0x3b')]),_0x5e1e29);if(_0xde903c['query'][_0x6e31('0x3d')]){_0xe3f9d1['where']=_[_0x6e31('0x3e')](_0xe3f9d1[_0x6e31('0x3a')],{'$or':_[_0x6e31('0x2e')](_0x5e1e29,function(_0x5dbd0b){if(_0x5dbd0b['type']!==_0x6e31('0x3f')){var _0x1bafee={};_0x1bafee[_0x5dbd0b[_0x6e31('0x2b')]]={'$like':'%'+_0xde903c['query']['filter']+'%'};return _0x1bafee;}})});}_0xe3f9d1=_['merge']({},_0xe3f9d1,_0xde903c[_0x6e31('0x40')]);var _0x40f829={'where':_0xe3f9d1[_0x6e31('0x3a')]};return db[_0x6e31('0x41')]['count'](_0x40f829)[_0x6e31('0x27')](function(_0x2a56b8){_0x7f002f[_0x6e31('0x20')]=_0x2a56b8;if(_0xde903c[_0x6e31('0x33')][_0x6e31('0x42')]){_0xe3f9d1['include']=[{'all':!![]}];}return db[_0x6e31('0x41')][_0x6e31('0x43')](_0xe3f9d1);})[_0x6e31('0x27')](function(_0x59e76d){_0x7f002f[_0x6e31('0x44')]=_0x59e76d;return _0x7f002f;})[_0x6e31('0x27')](respondWithFilteredResult(_0x4f53fa,_0xe3f9d1))[_0x6e31('0x45')](handleError(_0x4f53fa,null));};exports[_0x6e31('0x46')]=function(_0x5829a4,_0x27c45f){var _0x277b4a={'raw':![],'where':{'id':_0x5829a4[_0x6e31('0x47')]['id']}},_0x5469cb={};_0x5469cb[_0x6e31('0x32')]=_[_0x6e31('0x34')](db[_0x6e31('0x41')]['rawAttributes']);_0x5469cb[_0x6e31('0x33')]=_[_0x6e31('0x34')](_0x5829a4[_0x6e31('0x33')]);_0x5469cb[_0x6e31('0x3b')]=_[_0x6e31('0x35')](_0x5469cb[_0x6e31('0x32')],_0x5469cb[_0x6e31('0x33')]);_0x277b4a[_0x6e31('0x37')]=_['intersection'](_0x5469cb['model'],qs['fields'](_0x5829a4[_0x6e31('0x33')][_0x6e31('0x36')]));_0x277b4a['attributes']=_0x277b4a['attributes']['length']?_0x277b4a[_0x6e31('0x37')]:_0x5469cb[_0x6e31('0x32')];if(_0x5829a4[_0x6e31('0x33')][_0x6e31('0x42')]){_0x277b4a[_0x6e31('0x48')]=[{'all':!![]}];}_0x277b4a=_[_0x6e31('0x3e')]({},_0x277b4a,_0x5829a4['options']);return db[_0x6e31('0x41')][_0x6e31('0x49')](_0x277b4a)[_0x6e31('0x27')](handleEntityNotFound(_0x27c45f,null))['then'](respondWithResult(_0x27c45f,null))[_0x6e31('0x45')](handleError(_0x27c45f,null));};exports['create']=function(_0x2e3065,_0x65b938){return db['ZohoConfiguration'][_0x6e31('0x4a')](_0x2e3065[_0x6e31('0x4b')],{})['then'](respondWithResult(_0x65b938,0xc9))[_0x6e31('0x45')](handleError(_0x65b938,null));};exports[_0x6e31('0x26')]=function(_0x119c8f,_0x148a52){if(_0x119c8f[_0x6e31('0x4b')]['id']){delete _0x119c8f[_0x6e31('0x4b')]['id'];}return db[_0x6e31('0x41')][_0x6e31('0x49')]({'where':{'id':_0x119c8f[_0x6e31('0x47')]['id']}})['then'](handleEntityNotFound(_0x148a52,null))[_0x6e31('0x27')](saveUpdates(_0x119c8f['body'],null))[_0x6e31('0x27')](respondWithResult(_0x148a52,null))['catch'](handleError(_0x148a52,null));};exports[_0x6e31('0x28')]=function(_0x5739aa,_0x2f5725){return db[_0x6e31('0x41')][_0x6e31('0x49')]({'where':{'id':_0x5739aa[_0x6e31('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f5725,null))[_0x6e31('0x27')](removeEntity(_0x2f5725,null))[_0x6e31('0x45')](handleError(_0x2f5725,null));};exports['getFields']=function(_0x540c96,_0x27c472,_0x4c51b8){var _0x7a8294={};var _0x2a9855={};var _0x2ec0f4;var _0x2a9690;return db[_0x6e31('0x41')][_0x6e31('0x4c')]({'where':{'id':_0x540c96[_0x6e31('0x47')]['id']}})['then'](handleEntityNotFound(_0x27c472,null))[_0x6e31('0x27')](function(_0x44d2be){if(_0x44d2be){_0x2ec0f4=_0x44d2be;_0x2a9855[_0x6e31('0x32')]=_[_0x6e31('0x34')](db[_0x6e31('0x4d')]['rawAttributes']);_0x2a9855['query']=_[_0x6e31('0x34')](_0x540c96['query']);_0x2a9855['filters']=_['intersection'](_0x2a9855['model'],_0x2a9855[_0x6e31('0x33')]);_0x7a8294['attributes']=_[_0x6e31('0x35')](_0x2a9855[_0x6e31('0x32')],qs[_0x6e31('0x36')](_0x540c96[_0x6e31('0x33')][_0x6e31('0x36')]));_0x7a8294[_0x6e31('0x37')]=_0x7a8294['attributes']['length']?_0x7a8294[_0x6e31('0x37')]:_0x2a9855['model'];_0x7a8294[_0x6e31('0x4e')]=qs[_0x6e31('0x39')](_0x540c96['query']['sort']);_0x7a8294[_0x6e31('0x3a')]=qs[_0x6e31('0x3b')](_[_0x6e31('0x3c')](_0x540c96[_0x6e31('0x33')],_0x2a9855[_0x6e31('0x3b')]));if(_0x540c96[_0x6e31('0x33')]['filter']){_0x7a8294[_0x6e31('0x3a')]=_[_0x6e31('0x3e')](_0x7a8294['where'],{'$or':_['map'](_0x7a8294[_0x6e31('0x37')],function(_0x949b9c){var _0x469860={};_0x469860[_0x949b9c]={'$like':'%'+_0x540c96[_0x6e31('0x33')][_0x6e31('0x3d')]+'%'};return _0x469860;})});}_0x7a8294=_[_0x6e31('0x3e')]({},_0x7a8294,_0x540c96[_0x6e31('0x40')]);return _0x2ec0f4['getFields'](_0x7a8294);}})[_0x6e31('0x27')](function(_0x5ca922){if(_0x5ca922){_0x2a9690=_0x5ca922['length'];if(!_0x540c96[_0x6e31('0x33')][_0x6e31('0x38')]('nolimit')){_0x7a8294['limit']=qs[_0x6e31('0x1e')](_0x540c96[_0x6e31('0x33')][_0x6e31('0x1e')]);_0x7a8294['offset']=qs[_0x6e31('0x1d')](_0x540c96[_0x6e31('0x33')][_0x6e31('0x1d')]);}return _0x2ec0f4[_0x6e31('0x4f')](_0x7a8294);}})['then'](function(_0x52b981){if(_0x52b981){return _0x52b981?{'count':_0x2a9690,'rows':_0x52b981}:null;}})[_0x6e31('0x27')](respondWithResult(_0x27c472,null))[_0x6e31('0x45')](handleError(_0x27c472,null));};exports[_0x6e31('0x50')]=function(_0x3f748b,_0x54c7f5,_0x98aaf1){var _0x32ee87={};var _0x1cd8f9={};var _0x27afac;var _0x2b954e;return db[_0x6e31('0x41')][_0x6e31('0x4c')]({'where':{'id':_0x3f748b['params']['id']}})[_0x6e31('0x27')](handleEntityNotFound(_0x54c7f5,null))[_0x6e31('0x27')](function(_0x2ce97f){if(_0x2ce97f){_0x27afac=_0x2ce97f;_0x1cd8f9[_0x6e31('0x32')]=_[_0x6e31('0x34')](db[_0x6e31('0x4d')][_0x6e31('0x2f')]);_0x1cd8f9[_0x6e31('0x33')]=_[_0x6e31('0x34')](_0x3f748b[_0x6e31('0x33')]);_0x1cd8f9[_0x6e31('0x3b')]=_[_0x6e31('0x35')](_0x1cd8f9[_0x6e31('0x32')],_0x1cd8f9[_0x6e31('0x33')]);_0x32ee87[_0x6e31('0x37')]=_[_0x6e31('0x35')](_0x1cd8f9[_0x6e31('0x32')],qs[_0x6e31('0x36')](_0x3f748b[_0x6e31('0x33')][_0x6e31('0x36')]));_0x32ee87[_0x6e31('0x37')]=_0x32ee87[_0x6e31('0x37')][_0x6e31('0x51')]?_0x32ee87[_0x6e31('0x37')]:_0x1cd8f9[_0x6e31('0x32')];_0x32ee87[_0x6e31('0x4e')]=qs[_0x6e31('0x39')](_0x3f748b[_0x6e31('0x33')][_0x6e31('0x39')]);_0x32ee87['where']=qs['filters'](_[_0x6e31('0x3c')](_0x3f748b['query'],_0x1cd8f9[_0x6e31('0x3b')]));if(_0x3f748b[_0x6e31('0x33')][_0x6e31('0x3d')]){_0x32ee87['where']=_['merge'](_0x32ee87['where'],{'$or':_['map'](_0x32ee87[_0x6e31('0x37')],function(_0x255a74){var _0x3809c5={};_0x3809c5[_0x255a74]={'$like':'%'+_0x3f748b[_0x6e31('0x33')][_0x6e31('0x3d')]+'%'};return _0x3809c5;})});}_0x32ee87=_[_0x6e31('0x3e')]({},_0x32ee87,_0x3f748b[_0x6e31('0x40')]);return _0x27afac[_0x6e31('0x50')](_0x32ee87);}})[_0x6e31('0x27')](function(_0x3c82d0){if(_0x3c82d0){_0x2b954e=_0x3c82d0[_0x6e31('0x51')];if(!_0x3f748b[_0x6e31('0x33')][_0x6e31('0x38')]('nolimit')){_0x32ee87[_0x6e31('0x1e')]=qs[_0x6e31('0x1e')](_0x3f748b['query'][_0x6e31('0x1e')]);_0x32ee87[_0x6e31('0x1d')]=qs['offset'](_0x3f748b['query']['offset']);}return _0x27afac[_0x6e31('0x50')](_0x32ee87);}})[_0x6e31('0x27')](function(_0x560bea){if(_0x560bea){return _0x560bea?{'count':_0x2b954e,'rows':_0x560bea}:null;}})['then'](respondWithResult(_0x54c7f5,null))[_0x6e31('0x45')](handleError(_0x54c7f5,null));};exports['getDescriptions']=function(_0x359b54,_0x309cbf,_0x1d6d56){var _0x26cd53={};var _0x145769={};var _0x2e3da4;var _0x4c0eb2;return db[_0x6e31('0x41')][_0x6e31('0x4c')]({'where':{'id':_0x359b54['params']['id']}})['then'](handleEntityNotFound(_0x309cbf,null))[_0x6e31('0x27')](function(_0x3611fb){if(_0x3611fb){_0x2e3da4=_0x3611fb;_0x145769[_0x6e31('0x32')]=_[_0x6e31('0x34')](db[_0x6e31('0x4d')][_0x6e31('0x2f')]);_0x145769[_0x6e31('0x33')]=_[_0x6e31('0x34')](_0x359b54[_0x6e31('0x33')]);_0x145769[_0x6e31('0x3b')]=_['intersection'](_0x145769[_0x6e31('0x32')],_0x145769[_0x6e31('0x33')]);_0x26cd53[_0x6e31('0x37')]=_[_0x6e31('0x35')](_0x145769[_0x6e31('0x32')],qs[_0x6e31('0x36')](_0x359b54[_0x6e31('0x33')]['fields']));_0x26cd53['attributes']=_0x26cd53[_0x6e31('0x37')][_0x6e31('0x51')]?_0x26cd53[_0x6e31('0x37')]:_0x145769['model'];_0x26cd53[_0x6e31('0x4e')]=qs[_0x6e31('0x39')](_0x359b54[_0x6e31('0x33')][_0x6e31('0x39')]);_0x26cd53[_0x6e31('0x3a')]=qs[_0x6e31('0x3b')](_['pick'](_0x359b54[_0x6e31('0x33')],_0x145769[_0x6e31('0x3b')]));if(_0x359b54['query']['filter']){_0x26cd53['where']=_['merge'](_0x26cd53[_0x6e31('0x3a')],{'$or':_[_0x6e31('0x2e')](_0x26cd53[_0x6e31('0x37')],function(_0x1490c9){var _0x44038a={};_0x44038a[_0x1490c9]={'$like':'%'+_0x359b54['query'][_0x6e31('0x3d')]+'%'};return _0x44038a;})});}_0x26cd53=_[_0x6e31('0x3e')]({},_0x26cd53,_0x359b54['options']);return _0x2e3da4[_0x6e31('0x52')](_0x26cd53);}})['then'](function(_0x104a3e){if(_0x104a3e){_0x4c0eb2=_0x104a3e[_0x6e31('0x51')];if(!_0x359b54[_0x6e31('0x33')]['hasOwnProperty'](_0x6e31('0x53'))){_0x26cd53['limit']=qs[_0x6e31('0x1e')](_0x359b54['query'][_0x6e31('0x1e')]);_0x26cd53[_0x6e31('0x1d')]=qs[_0x6e31('0x1d')](_0x359b54[_0x6e31('0x33')][_0x6e31('0x1d')]);}return _0x2e3da4[_0x6e31('0x52')](_0x26cd53);}})[_0x6e31('0x27')](function(_0x383a9c){if(_0x383a9c){return _0x383a9c?{'count':_0x4c0eb2,'rows':_0x383a9c}:null;}})[_0x6e31('0x27')](respondWithResult(_0x309cbf,null))[_0x6e31('0x45')](handleError(_0x309cbf,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ff9f63d..0d77019 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 _0xa263=['request-promise','path','rimraf','exports','define','int_zoho_configurations','lodash','../../config/logger','moment'];(function(_0x127840,_0x2d5f79){var _0x1d87d1=function(_0x28daa9){while(--_0x28daa9){_0x127840['push'](_0x127840['shift']());}};_0x1d87d1(++_0x2d5f79);}(_0xa263,0x1d1));var _0x3a26=function(_0x52f4f1,_0xd5673a){_0x52f4f1=_0x52f4f1-0x0;var _0x5340e3=_0xa263[_0x52f4f1];return _0x5340e3;};'use strict';var _=require(_0x3a26('0x0'));var util=require('util');var logger=require(_0x3a26('0x1'))('api');var moment=require(_0x3a26('0x2'));var BPromise=require('bluebird');var rp=require(_0x3a26('0x3'));var fs=require('fs');var path=require(_0x3a26('0x4'));var rimraf=require(_0x3a26('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x3a26('0x6')]=function(_0xb64b67,_0xc632d){return _0xb64b67[_0x3a26('0x7')]('ZohoConfiguration',attributes,{'tableName':_0x3a26('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x238a=['../../config/environment','ZohoConfiguration','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x238a,0x82));var _0xa238=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0x238a[_0x5d07ff];return _0x5226ad;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa238('0x0'))(_0xa238('0x1'));var moment=require('moment');var BPromise=require(_0xa238('0x2'));var rp=require(_0xa238('0x3'));var fs=require('fs');var path=require(_0xa238('0x4'));var rimraf=require(_0xa238('0x5'));var config=require(_0xa238('0x6'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x519114,_0x471664){return _0x519114['define'](_0xa238('0x7'),attributes,{'tableName':'int_zoho_configurations','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 d9c5082..43cd2f2 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 _0xbd8e=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x5b6ee2,_0xa89fdc){var _0x1b403d=function(_0x3326af){while(--_0x3326af){_0x5b6ee2['push'](_0x5b6ee2['shift']());}};_0x1b403d(++_0xa89fdc);}(_0xbd8e,0x1f4));var _0xebd8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbd8e[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var moment=require(_0xebd8('0x2'));var BPromise=require(_0xebd8('0x3'));var rs=require(_0xebd8('0x4'));var fs=require('fs');var Redis=require(_0xebd8('0x5'));var db=require(_0xebd8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xebd8('0x7'))(_0xebd8('0x8'));var config=require('../../config/environment');var jayson=require(_0xebd8('0x9'));var client=jayson[_0xebd8('0xa')][_0xebd8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x818ae4,_0x3fec87,_0x56da77){return new BPromise(function(_0x56da5f,_0x3ada67){return client[_0xebd8('0xc')](_0x818ae4,_0x56da77)[_0xebd8('0xd')](function(_0x3eaaad){logger[_0xebd8('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x3fec87,_0xebd8('0xf'));logger[_0xebd8('0x10')](_0xebd8('0x11'),_0x3fec87,_0xebd8('0xf'),JSON[_0xebd8('0x12')](_0x3eaaad));if(_0x3eaaad[_0xebd8('0x13')]){if(_0x3eaaad[_0xebd8('0x13')][_0xebd8('0x14')]===0x1f4){logger['error'](_0xebd8('0x15'),_0x3fec87,_0x3eaaad[_0xebd8('0x13')][_0xebd8('0x16')]);return _0x3ada67(_0x3eaaad[_0xebd8('0x13')][_0xebd8('0x16')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3fec87,_0x3eaaad[_0xebd8('0x13')][_0xebd8('0x16')]);return _0x56da5f(_0x3eaaad[_0xebd8('0x13')][_0xebd8('0x16')]);}else{logger[_0xebd8('0xe')](_0xebd8('0x15'),_0x3fec87,_0xebd8('0xf'));_0x56da5f(_0x3eaaad[_0xebd8('0x17')][_0xebd8('0x16')]);}})[_0xebd8('0x18')](function(_0x4901d9){logger[_0xebd8('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x3fec87,_0x4901d9);_0x3ada67(_0x4901d9);});});} \ No newline at end of file +var _0x9a25=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x393761,_0x39b5b3){var _0x4dbda0=function(_0x523089){while(--_0x523089){_0x393761['push'](_0x393761['shift']());}};_0x4dbda0(++_0x39b5b3);}(_0x9a25,0x101));var _0x59a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9a25[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x59a2('0x0'));var util=require('util');var moment=require(_0x59a2('0x1'));var BPromise=require(_0x59a2('0x2'));var rs=require(_0x59a2('0x3'));var fs=require('fs');var Redis=require(_0x59a2('0x4'));var db=require(_0x59a2('0x5'))['db'];var utils=require(_0x59a2('0x6'));var logger=require(_0x59a2('0x7'))(_0x59a2('0x8'));var config=require(_0x59a2('0x9'));var jayson=require(_0x59a2('0xa'));var client=jayson[_0x59a2('0xb')][_0x59a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ebfac,_0x29b86c,_0x85d4ee){return new BPromise(function(_0x5d9f5b,_0x2f7c36){return client['request'](_0x3ebfac,_0x85d4ee)[_0x59a2('0xd')](function(_0x51b953){logger[_0x59a2('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x29b86c,_0x59a2('0xf'));logger['debug'](_0x59a2('0x10'),_0x29b86c,_0x59a2('0xf'),JSON[_0x59a2('0x11')](_0x51b953));if(_0x51b953[_0x59a2('0x12')]){if(_0x51b953[_0x59a2('0x12')][_0x59a2('0x13')]===0x1f4){logger[_0x59a2('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x29b86c,_0x51b953['error']['message']);return _0x2f7c36(_0x51b953[_0x59a2('0x12')]['message']);}logger[_0x59a2('0x12')](_0x59a2('0x14'),_0x29b86c,_0x51b953[_0x59a2('0x12')][_0x59a2('0x15')]);return _0x5d9f5b(_0x51b953[_0x59a2('0x12')]['message']);}else{logger[_0x59a2('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x29b86c,'request\x20sent');_0x5d9f5b(_0x51b953[_0x59a2('0x16')][_0x59a2('0x15')]);}})[_0x59a2('0x17')](function(_0x52b2de){logger[_0x59a2('0x12')](_0x59a2('0x14'),_0x29b86c,_0x52b2de);_0x2f7c36(_0x52b2de);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 59c34b1..7d51818 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 _0x17ae=['destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','show','post','put','/:id','update','delete'];(function(_0x4d770d,_0x5af4ce){var _0x11dc7a=function(_0x27d3f7){while(--_0x27d3f7){_0x4d770d['push'](_0x4d770d['shift']());}};_0x11dc7a(++_0x5af4ce);}(_0x17ae,0x1b1));var _0xe17a=function(_0x1a78ad,_0x5d5dd7){_0x1a78ad=_0x1a78ad-0x0;var _0xe0af9c=_0x17ae[_0x1a78ad];return _0xe0af9c;};'use strict';var multer=require('multer');var util=require(_0xe17a('0x0'));var path=require(_0xe17a('0x1'));var timeout=require('connect-timeout');var express=require(_0xe17a('0x2'));var router=express[_0xe17a('0x3')]();var fs_extra=require(_0xe17a('0x4'));var auth=require(_0xe17a('0x5'));var interaction=require(_0xe17a('0x6'));var config=require(_0xe17a('0x7'));var controller=require(_0xe17a('0x8'));router['get']('/',auth[_0xe17a('0x9')](),controller[_0xe17a('0xa')]);router['get']('/:id',auth[_0xe17a('0x9')](),controller[_0xe17a('0xb')]);router[_0xe17a('0xc')]('/',auth[_0xe17a('0x9')](),controller['create']);router[_0xe17a('0xd')](_0xe17a('0xe'),auth['isAuthenticated'](),controller[_0xe17a('0xf')]);router[_0xe17a('0x10')](_0xe17a('0xe'),auth[_0xe17a('0x9')](),controller[_0xe17a('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2632=['index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get'];(function(_0x5124ca,_0x55e58e){var _0x1dbb17=function(_0x504f66){while(--_0x504f66){_0x5124ca['push'](_0x5124ca['shift']());}};_0x1dbb17(++_0x55e58e);}(_0x2632,0x1d6));var _0x2263=function(_0x562462,_0x26b265){_0x562462=_0x562462-0x0;var _0x2f0bb9=_0x2632[_0x562462];return _0x2f0bb9;};'use strict';var multer=require(_0x2263('0x0'));var util=require(_0x2263('0x1'));var path=require(_0x2263('0x2'));var timeout=require(_0x2263('0x3'));var express=require('express');var router=express[_0x2263('0x4')]();var fs_extra=require(_0x2263('0x5'));var auth=require(_0x2263('0x6'));var interaction=require(_0x2263('0x7'));var config=require('../../config/environment');var controller=require(_0x2263('0x8'));router[_0x2263('0x9')]('/',auth['isAuthenticated'](),controller[_0x2263('0xa')]);router[_0x2263('0x9')](_0x2263('0xb'),auth[_0x2263('0xc')](),controller['show']);router[_0x2263('0xd')]('/',auth['isAuthenticated'](),controller[_0x2263('0xe')]);router[_0x2263('0xf')](_0x2263('0xb'),auth[_0x2263('0xc')](),controller[_0x2263('0x10')]);router[_0x2263('0x11')](_0x2263('0xb'),auth[_0x2263('0xc')](),controller[_0x2263('0x12')]);module[_0x2263('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 0290702..380ce2b 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 _0x80a9=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x47a80f,_0x352798){var _0x1770f6=function(_0x549590){while(--_0x549590){_0x47a80f['push'](_0x47a80f['shift']());}};_0x1770f6(++_0x352798);}(_0x80a9,0x8e));var _0x980a=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x80a9[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0x980a('0x0'));module[_0x980a('0x1')]={'type':{'type':Sequelize[_0x980a('0x2')](_0x980a('0x3'),_0x980a('0x4'),_0x980a('0x5'),_0x980a('0x6'),'picklist'),'defaultValue':_0x980a('0x3')},'content':{'type':Sequelize[_0x980a('0x7')]},'key':{'type':Sequelize[_0x980a('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x980a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x980a('0x7')]},'nameField':{'type':Sequelize[_0x980a('0x7')]},'customField':{'type':Sequelize[_0x980a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x980a('0x7')]}}; \ No newline at end of file +var _0xcb0b=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x2a7f34,_0x296433){var _0x186dcd=function(_0x3d1d75){while(--_0x3d1d75){_0x2a7f34['push'](_0x2a7f34['shift']());}};_0x186dcd(++_0x296433);}(_0xcb0b,0xe2));var _0xbcb0=function(_0x26dbaa,_0xa94cde){_0x26dbaa=_0x26dbaa-0x0;var _0x28adc6=_0xcb0b[_0x26dbaa];return _0x28adc6;};'use strict';var Sequelize=require(_0xbcb0('0x0'));module['exports']={'type':{'type':Sequelize[_0xbcb0('0x1')](_0xbcb0('0x2'),_0xbcb0('0x3'),_0xbcb0('0x4'),_0xbcb0('0x5'),_0xbcb0('0x6')),'defaultValue':_0xbcb0('0x2')},'content':{'type':Sequelize[_0xbcb0('0x7')]},'key':{'type':Sequelize[_0xbcb0('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xbcb0('0x2'),_0xbcb0('0x3'),_0xbcb0('0x4'))},'keyContent':{'type':Sequelize[_0xbcb0('0x7')]},'idField':{'type':Sequelize[_0xbcb0('0x7')]},'nameField':{'type':Sequelize[_0xbcb0('0x7')]},'customField':{'type':Sequelize[_0xbcb0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbcb0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 73c1d64..05f690d 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 _0x3a9e=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','update','then','error','stack','name','send','index','ZohoField','rawAttributes','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0x3a9e,0x162));var _0xe3a9=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x3a9e[_0x3e7804];return _0x56efda;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe3a9('0x0'));var jsonpatch=require(_0xe3a9('0x1'));var rp=require(_0xe3a9('0x2'));var moment=require(_0xe3a9('0x3'));var BPromise=require(_0xe3a9('0x4'));var Mustache=require(_0xe3a9('0x5'));var util=require(_0xe3a9('0x6'));var path=require(_0xe3a9('0x7'));var sox=require('sox');var csv=require(_0xe3a9('0x8'));var ejs=require(_0xe3a9('0x9'));var fs=require('fs');var fs_extra=require(_0xe3a9('0xa'));var _=require(_0xe3a9('0xb'));var squel=require(_0xe3a9('0xc'));var crypto=require(_0xe3a9('0xd'));var jsforce=require(_0xe3a9('0xe'));var deskjs=require(_0xe3a9('0xf'));var toCsv=require(_0xe3a9('0x8'));var querystring=require(_0xe3a9('0x10'));var Papa=require(_0xe3a9('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe3a9('0x12'));var as=require(_0xe3a9('0x13'));var hardwareService=require(_0xe3a9('0x14'));var logger=require(_0xe3a9('0x15'))(_0xe3a9('0x16'));var utils=require('../../config/utils');var config=require(_0xe3a9('0x17'));var licenseUtil=require(_0xe3a9('0x18'));var db=require(_0xe3a9('0x19'))['db'];function respondWithStatusCode(_0x44c5cd,_0x47c921){_0x47c921=_0x47c921||0xcc;return function(_0x8c556a){if(_0x8c556a){return _0x44c5cd[_0xe3a9('0x1a')](_0x47c921);}return _0x44c5cd[_0xe3a9('0x1b')](_0x47c921)[_0xe3a9('0x1c')]();};}function respondWithResult(_0x55be4c,_0x3a6bdf){_0x3a6bdf=_0x3a6bdf||0xc8;return function(_0x35e893){if(_0x35e893){return _0x55be4c[_0xe3a9('0x1b')](_0x3a6bdf)['json'](_0x35e893);}};}function respondWithFilteredResult(_0xca42d4,_0x594e1f){return function(_0x43f7d1){if(_0x43f7d1){var _0x1cf895=typeof _0x594e1f[_0xe3a9('0x1d')]===_0xe3a9('0x1e')&&typeof _0x594e1f[_0xe3a9('0x1f')]==='undefined';var _0x4730e6=_0x43f7d1['count'];var _0x12722b=_0x1cf895?0x0:_0x594e1f['offset'];var _0x4eac84=_0x1cf895?_0x43f7d1[_0xe3a9('0x20')]:_0x594e1f['offset']+_0x594e1f['limit'];var _0x3e9bd9;if(_0x4eac84>=_0x4730e6){_0x4eac84=_0x4730e6;_0x3e9bd9=0xc8;}else{_0x3e9bd9=0xce;}_0xca42d4['status'](_0x3e9bd9);return _0xca42d4['set']('Content-Range',_0x12722b+'-'+_0x4eac84+'/'+_0x4730e6)[_0xe3a9('0x21')](_0x43f7d1);}return null;};}function patchUpdates(_0x53557c){return function(_0x57087f){try{jsonpatch[_0xe3a9('0x22')](_0x57087f,_0x53557c,!![]);}catch(_0x366427){return BPromise[_0xe3a9('0x23')](_0x366427);}return _0x57087f['save']();};}function saveUpdates(_0x4a4189,_0x517d4e){return function(_0x1a85cf){if(_0x1a85cf){return _0x1a85cf[_0xe3a9('0x24')](_0x4a4189)[_0xe3a9('0x25')](function(_0x7a48e4){return _0x7a48e4;});}return null;};}function removeEntity(_0x43a95a,_0x20a764){return function(_0x32f7c4){if(_0x32f7c4){return _0x32f7c4['destroy']()['then'](function(){_0x43a95a[_0xe3a9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x117435,_0x503c3d){return function(_0x532e97){if(!_0x532e97){_0x117435[_0xe3a9('0x1a')](0x194);}return _0x532e97;};}function handleError(_0x1e96ca,_0x5a5a87){_0x5a5a87=_0x5a5a87||0x1f4;return function(_0x1f10a6){logger[_0xe3a9('0x26')](_0x1f10a6[_0xe3a9('0x27')]);if(_0x1f10a6[_0xe3a9('0x28')]){delete _0x1f10a6['name'];}_0x1e96ca[_0xe3a9('0x1b')](_0x5a5a87)[_0xe3a9('0x29')](_0x1f10a6);};}exports[_0xe3a9('0x2a')]=function(_0x4d56f5,_0x49295b){var _0x34937d={},_0x4012bf={},_0x1c0553={'count':0x0,'rows':[]};var _0x33e053=_['map'](db[_0xe3a9('0x2b')][_0xe3a9('0x2c')],function(_0x4e9fa7){return{'name':_0x4e9fa7['fieldName'],'type':_0x4e9fa7[_0xe3a9('0x2d')][_0xe3a9('0x2e')]};});_0x4012bf['model']=_[_0xe3a9('0x2f')](_0x33e053,'name');_0x4012bf[_0xe3a9('0x30')]=_[_0xe3a9('0x31')](_0x4d56f5[_0xe3a9('0x30')]);_0x4012bf[_0xe3a9('0x32')]=_['intersection'](_0x4012bf[_0xe3a9('0x33')],_0x4012bf[_0xe3a9('0x30')]);_0x34937d[_0xe3a9('0x34')]=_[_0xe3a9('0x35')](_0x4012bf[_0xe3a9('0x33')],qs[_0xe3a9('0x36')](_0x4d56f5[_0xe3a9('0x30')][_0xe3a9('0x36')]));_0x34937d[_0xe3a9('0x34')]=_0x34937d[_0xe3a9('0x34')][_0xe3a9('0x37')]?_0x34937d[_0xe3a9('0x34')]:_0x4012bf[_0xe3a9('0x33')];if(!_0x4d56f5[_0xe3a9('0x30')][_0xe3a9('0x38')](_0xe3a9('0x39'))){_0x34937d[_0xe3a9('0x1f')]=qs['limit'](_0x4d56f5[_0xe3a9('0x30')][_0xe3a9('0x1f')]);_0x34937d['offset']=qs[_0xe3a9('0x1d')](_0x4d56f5[_0xe3a9('0x30')]['offset']);}_0x34937d['order']=qs['sort'](_0x4d56f5[_0xe3a9('0x30')][_0xe3a9('0x3a')]);_0x34937d[_0xe3a9('0x3b')]=qs[_0xe3a9('0x32')](_[_0xe3a9('0x3c')](_0x4d56f5[_0xe3a9('0x30')],_0x4012bf[_0xe3a9('0x32')]),_0x33e053);if(_0x4d56f5[_0xe3a9('0x30')]['filter']){_0x34937d[_0xe3a9('0x3b')]=_[_0xe3a9('0x3d')](_0x34937d[_0xe3a9('0x3b')],{'$or':_[_0xe3a9('0x2f')](_0x33e053,function(_0xef8c2b){if(_0xef8c2b[_0xe3a9('0x2d')]!==_0xe3a9('0x3e')){var _0x1f1b82={};_0x1f1b82[_0xef8c2b[_0xe3a9('0x28')]]={'$like':'%'+_0x4d56f5[_0xe3a9('0x30')][_0xe3a9('0x3f')]+'%'};return _0x1f1b82;}})});}_0x34937d=_[_0xe3a9('0x3d')]({},_0x34937d,_0x4d56f5[_0xe3a9('0x40')]);var _0x150930={'where':_0x34937d[_0xe3a9('0x3b')]};return db[_0xe3a9('0x2b')][_0xe3a9('0x20')](_0x150930)[_0xe3a9('0x25')](function(_0x5c6e3a){_0x1c0553[_0xe3a9('0x20')]=_0x5c6e3a;if(_0x4d56f5[_0xe3a9('0x30')]['includeAll']){_0x34937d[_0xe3a9('0x41')]=[{'all':!![]}];}return db[_0xe3a9('0x2b')][_0xe3a9('0x42')](_0x34937d);})['then'](function(_0x7981a5){_0x1c0553[_0xe3a9('0x43')]=_0x7981a5;return _0x1c0553;})[_0xe3a9('0x25')](respondWithFilteredResult(_0x49295b,_0x34937d))[_0xe3a9('0x44')](handleError(_0x49295b,null));};exports[_0xe3a9('0x45')]=function(_0x3339e7,_0x4ebd81){var _0xfadcc8={'raw':!![],'where':{'id':_0x3339e7[_0xe3a9('0x46')]['id']}},_0x4865ba={};_0x4865ba[_0xe3a9('0x33')]=_[_0xe3a9('0x31')](db['ZohoField'][_0xe3a9('0x2c')]);_0x4865ba['query']=_[_0xe3a9('0x31')](_0x3339e7['query']);_0x4865ba[_0xe3a9('0x32')]=_[_0xe3a9('0x35')](_0x4865ba[_0xe3a9('0x33')],_0x4865ba['query']);_0xfadcc8['attributes']=_[_0xe3a9('0x35')](_0x4865ba['model'],qs[_0xe3a9('0x36')](_0x3339e7[_0xe3a9('0x30')]['fields']));_0xfadcc8[_0xe3a9('0x34')]=_0xfadcc8[_0xe3a9('0x34')][_0xe3a9('0x37')]?_0xfadcc8['attributes']:_0x4865ba[_0xe3a9('0x33')];if(_0x3339e7['query'][_0xe3a9('0x47')]){_0xfadcc8[_0xe3a9('0x41')]=[{'all':!![]}];}_0xfadcc8=_[_0xe3a9('0x3d')]({},_0xfadcc8,_0x3339e7[_0xe3a9('0x40')]);return db[_0xe3a9('0x2b')][_0xe3a9('0x48')](_0xfadcc8)[_0xe3a9('0x25')](handleEntityNotFound(_0x4ebd81,null))[_0xe3a9('0x25')](respondWithResult(_0x4ebd81,null))[_0xe3a9('0x44')](handleError(_0x4ebd81,null));};exports[_0xe3a9('0x49')]=function(_0x308c1d,_0x2d8403){return db[_0xe3a9('0x2b')][_0xe3a9('0x49')](_0x308c1d[_0xe3a9('0x4a')],{})['then'](respondWithResult(_0x2d8403,0xc9))['catch'](handleError(_0x2d8403,null));};exports[_0xe3a9('0x24')]=function(_0x55c69a,_0x2f7775){if(_0x55c69a['body']['id']){delete _0x55c69a['body']['id'];}return db[_0xe3a9('0x2b')][_0xe3a9('0x48')]({'where':{'id':_0x55c69a[_0xe3a9('0x46')]['id']}})[_0xe3a9('0x25')](handleEntityNotFound(_0x2f7775,null))['then'](saveUpdates(_0x55c69a['body'],null))[_0xe3a9('0x25')](respondWithResult(_0x2f7775,null))[_0xe3a9('0x44')](handleError(_0x2f7775,null));};exports['destroy']=function(_0x29d804,_0x461b8c){return db['ZohoField'][_0xe3a9('0x48')]({'where':{'id':_0x29d804[_0xe3a9('0x46')]['id']}})[_0xe3a9('0x25')](handleEntityNotFound(_0x461b8c,null))[_0xe3a9('0x25')](removeEntity(_0x461b8c,null))[_0xe3a9('0x44')](handleError(_0x461b8c,null));}; \ No newline at end of file +var _0xaedd=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','limit','undefined','offset','apply','reject','save','destroy','then','sendStatus','error','name','send','index','map','ZohoField','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','create','body','update','catch','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1d5392,_0x5b562f){var _0x4cbeaa=function(_0x3c7de5){while(--_0x3c7de5){_0x1d5392['push'](_0x1d5392['shift']());}};_0x4cbeaa(++_0x5b562f);}(_0xaedd,0x1b0));var _0xdaed=function(_0x5c3d4f,_0x6c5b84){_0x5c3d4f=_0x5c3d4f-0x0;var _0x45a6da=_0xaedd[_0x5c3d4f];return _0x45a6da;};'use strict';var emlformat=require(_0xdaed('0x0'));var rimraf=require(_0xdaed('0x1'));var zipdir=require(_0xdaed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdaed('0x3'));var moment=require(_0xdaed('0x4'));var BPromise=require(_0xdaed('0x5'));var Mustache=require(_0xdaed('0x6'));var util=require(_0xdaed('0x7'));var path=require(_0xdaed('0x8'));var sox=require(_0xdaed('0x9'));var csv=require(_0xdaed('0xa'));var ejs=require(_0xdaed('0xb'));var fs=require('fs');var fs_extra=require(_0xdaed('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdaed('0xd'));var deskjs=require(_0xdaed('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdaed('0xf'));var Papa=require(_0xdaed('0x10'));var Redis=require(_0xdaed('0x11'));var authService=require(_0xdaed('0x12'));var qs=require(_0xdaed('0x13'));var as=require(_0xdaed('0x14'));var hardwareService=require(_0xdaed('0x15'));var logger=require('../../config/logger')(_0xdaed('0x16'));var utils=require(_0xdaed('0x17'));var config=require(_0xdaed('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdaed('0x19'))['db'];function respondWithStatusCode(_0x4cd228,_0xebcd9f){_0xebcd9f=_0xebcd9f||0xcc;return function(_0x1cbeac){if(_0x1cbeac){return _0x4cd228['sendStatus'](_0xebcd9f);}return _0x4cd228['status'](_0xebcd9f)[_0xdaed('0x1a')]();};}function respondWithResult(_0x4f5d55,_0x585f54){_0x585f54=_0x585f54||0xc8;return function(_0xe4c5e4){if(_0xe4c5e4){return _0x4f5d55[_0xdaed('0x1b')](_0x585f54)[_0xdaed('0x1c')](_0xe4c5e4);}};}function respondWithFilteredResult(_0x312838,_0x4f4c10){return function(_0x3c8b89){if(_0x3c8b89){var _0x137535=typeof _0x4f4c10['offset']==='undefined'&&typeof _0x4f4c10[_0xdaed('0x1d')]===_0xdaed('0x1e');var _0x22556c=_0x3c8b89['count'];var _0x535aba=_0x137535?0x0:_0x4f4c10[_0xdaed('0x1f')];var _0x50930e=_0x137535?_0x3c8b89['count']:_0x4f4c10[_0xdaed('0x1f')]+_0x4f4c10[_0xdaed('0x1d')];var _0xebbdbd;if(_0x50930e>=_0x22556c){_0x50930e=_0x22556c;_0xebbdbd=0xc8;}else{_0xebbdbd=0xce;}_0x312838['status'](_0xebbdbd);return _0x312838['set']('Content-Range',_0x535aba+'-'+_0x50930e+'/'+_0x22556c)[_0xdaed('0x1c')](_0x3c8b89);}return null;};}function patchUpdates(_0x46e348){return function(_0x30bc6e){try{jsonpatch[_0xdaed('0x20')](_0x30bc6e,_0x46e348,!![]);}catch(_0x4abc4a){return BPromise[_0xdaed('0x21')](_0x4abc4a);}return _0x30bc6e[_0xdaed('0x22')]();};}function saveUpdates(_0x374e14,_0x221ffa){return function(_0x2ed395){if(_0x2ed395){return _0x2ed395['update'](_0x374e14)['then'](function(_0xd0a402){return _0xd0a402;});}return null;};}function removeEntity(_0x153059,_0x2d0517){return function(_0xd4e691){if(_0xd4e691){return _0xd4e691[_0xdaed('0x23')]()[_0xdaed('0x24')](function(){_0x153059[_0xdaed('0x1b')](0xcc)[_0xdaed('0x1a')]();});}};}function handleEntityNotFound(_0x5dfca9,_0x2a2116){return function(_0x5173a8){if(!_0x5173a8){_0x5dfca9[_0xdaed('0x25')](0x194);}return _0x5173a8;};}function handleError(_0x3c025f,_0x4f07fc){_0x4f07fc=_0x4f07fc||0x1f4;return function(_0x112107){logger[_0xdaed('0x26')](_0x112107['stack']);if(_0x112107[_0xdaed('0x27')]){delete _0x112107[_0xdaed('0x27')];}_0x3c025f[_0xdaed('0x1b')](_0x4f07fc)[_0xdaed('0x28')](_0x112107);};}exports[_0xdaed('0x29')]=function(_0x5f3aa0,_0x164c3d){var _0x2c3571={},_0x107880={},_0x42e950={'count':0x0,'rows':[]};var _0x265911=_[_0xdaed('0x2a')](db[_0xdaed('0x2b')]['rawAttributes'],function(_0x241fa5){return{'name':_0x241fa5[_0xdaed('0x2c')],'type':_0x241fa5[_0xdaed('0x2d')][_0xdaed('0x2e')]};});_0x107880[_0xdaed('0x2f')]=_[_0xdaed('0x2a')](_0x265911,_0xdaed('0x27'));_0x107880[_0xdaed('0x30')]=_[_0xdaed('0x31')](_0x5f3aa0[_0xdaed('0x30')]);_0x107880[_0xdaed('0x32')]=_['intersection'](_0x107880[_0xdaed('0x2f')],_0x107880[_0xdaed('0x30')]);_0x2c3571[_0xdaed('0x33')]=_[_0xdaed('0x34')](_0x107880[_0xdaed('0x2f')],qs[_0xdaed('0x35')](_0x5f3aa0[_0xdaed('0x30')][_0xdaed('0x35')]));_0x2c3571[_0xdaed('0x33')]=_0x2c3571['attributes'][_0xdaed('0x36')]?_0x2c3571[_0xdaed('0x33')]:_0x107880['model'];if(!_0x5f3aa0[_0xdaed('0x30')][_0xdaed('0x37')](_0xdaed('0x38'))){_0x2c3571[_0xdaed('0x1d')]=qs[_0xdaed('0x1d')](_0x5f3aa0[_0xdaed('0x30')]['limit']);_0x2c3571[_0xdaed('0x1f')]=qs[_0xdaed('0x1f')](_0x5f3aa0[_0xdaed('0x30')][_0xdaed('0x1f')]);}_0x2c3571['order']=qs[_0xdaed('0x39')](_0x5f3aa0[_0xdaed('0x30')][_0xdaed('0x39')]);_0x2c3571[_0xdaed('0x3a')]=qs[_0xdaed('0x32')](_[_0xdaed('0x3b')](_0x5f3aa0[_0xdaed('0x30')],_0x107880[_0xdaed('0x32')]),_0x265911);if(_0x5f3aa0[_0xdaed('0x30')]['filter']){_0x2c3571[_0xdaed('0x3a')]=_[_0xdaed('0x3c')](_0x2c3571[_0xdaed('0x3a')],{'$or':_[_0xdaed('0x2a')](_0x265911,function(_0x42613d){if(_0x42613d[_0xdaed('0x2d')]!==_0xdaed('0x3d')){var _0xd205f3={};_0xd205f3[_0x42613d[_0xdaed('0x27')]]={'$like':'%'+_0x5f3aa0[_0xdaed('0x30')][_0xdaed('0x3e')]+'%'};return _0xd205f3;}})});}_0x2c3571=_[_0xdaed('0x3c')]({},_0x2c3571,_0x5f3aa0[_0xdaed('0x3f')]);var _0x325de8={'where':_0x2c3571[_0xdaed('0x3a')]};return db[_0xdaed('0x2b')][_0xdaed('0x40')](_0x325de8)[_0xdaed('0x24')](function(_0x21cfcf){_0x42e950[_0xdaed('0x40')]=_0x21cfcf;if(_0x5f3aa0[_0xdaed('0x30')][_0xdaed('0x41')]){_0x2c3571[_0xdaed('0x42')]=[{'all':!![]}];}return db[_0xdaed('0x2b')][_0xdaed('0x43')](_0x2c3571);})[_0xdaed('0x24')](function(_0x5e83d7){_0x42e950[_0xdaed('0x44')]=_0x5e83d7;return _0x42e950;})[_0xdaed('0x24')](respondWithFilteredResult(_0x164c3d,_0x2c3571))['catch'](handleError(_0x164c3d,null));};exports['show']=function(_0x2f9d4b,_0x3e3fb0){var _0x3d1050={'raw':!![],'where':{'id':_0x2f9d4b[_0xdaed('0x45')]['id']}},_0x25e90e={};_0x25e90e['model']=_[_0xdaed('0x31')](db[_0xdaed('0x2b')]['rawAttributes']);_0x25e90e[_0xdaed('0x30')]=_[_0xdaed('0x31')](_0x2f9d4b['query']);_0x25e90e[_0xdaed('0x32')]=_[_0xdaed('0x34')](_0x25e90e['model'],_0x25e90e[_0xdaed('0x30')]);_0x3d1050[_0xdaed('0x33')]=_[_0xdaed('0x34')](_0x25e90e[_0xdaed('0x2f')],qs[_0xdaed('0x35')](_0x2f9d4b[_0xdaed('0x30')][_0xdaed('0x35')]));_0x3d1050[_0xdaed('0x33')]=_0x3d1050[_0xdaed('0x33')][_0xdaed('0x36')]?_0x3d1050[_0xdaed('0x33')]:_0x25e90e[_0xdaed('0x2f')];if(_0x2f9d4b['query'][_0xdaed('0x41')]){_0x3d1050[_0xdaed('0x42')]=[{'all':!![]}];}_0x3d1050=_[_0xdaed('0x3c')]({},_0x3d1050,_0x2f9d4b[_0xdaed('0x3f')]);return db[_0xdaed('0x2b')]['find'](_0x3d1050)['then'](handleEntityNotFound(_0x3e3fb0,null))[_0xdaed('0x24')](respondWithResult(_0x3e3fb0,null))['catch'](handleError(_0x3e3fb0,null));};exports[_0xdaed('0x46')]=function(_0x132cf7,_0x3f9f06){return db[_0xdaed('0x2b')][_0xdaed('0x46')](_0x132cf7[_0xdaed('0x47')],{})[_0xdaed('0x24')](respondWithResult(_0x3f9f06,0xc9))['catch'](handleError(_0x3f9f06,null));};exports[_0xdaed('0x48')]=function(_0x3ac8e2,_0x5458ae){if(_0x3ac8e2[_0xdaed('0x47')]['id']){delete _0x3ac8e2[_0xdaed('0x47')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x3ac8e2[_0xdaed('0x45')]['id']}})[_0xdaed('0x24')](handleEntityNotFound(_0x5458ae,null))[_0xdaed('0x24')](saveUpdates(_0x3ac8e2['body'],null))[_0xdaed('0x24')](respondWithResult(_0x5458ae,null))[_0xdaed('0x49')](handleError(_0x5458ae,null));};exports[_0xdaed('0x23')]=function(_0x90d3e,_0x5718be){return db[_0xdaed('0x2b')][_0xdaed('0x4a')]({'where':{'id':_0x90d3e['params']['id']}})[_0xdaed('0x24')](handleEntityNotFound(_0x5718be,null))[_0xdaed('0x24')](removeEntity(_0x5718be,null))[_0xdaed('0x49')](handleError(_0x5718be,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 9d8e275..67e3c37 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 _0x2542=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x143ce6,_0x46e089){var _0x33ed64=function(_0x5a6856){while(--_0x5a6856){_0x143ce6['push'](_0x143ce6['shift']());}};_0x33ed64(++_0x46e089);}(_0x2542,0x169));var _0x2254=function(_0x1338d4,_0x2b8342){_0x1338d4=_0x1338d4-0x0;var _0x5521a1=_0x2542[_0x1338d4];return _0x5521a1;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xe'),_0x2254('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x53aaa7,_0x544a3b){var _0x48acc7=function(_0xfc5be7){while(--_0xfc5be7){_0x53aaa7['push'](_0x53aaa7['shift']());}};_0x48acc7(++_0x544a3b);}(_0x4975,0x86));var _0x5497=function(_0x359974,_0x1263e2){_0x359974=_0x359974-0x0;var _0x35766a=_0x4975[_0x359974];return _0x35766a;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['idField',_0x5497('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 3e071ff..71463a9 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 _0x046a=['debug','ZohoField,\x20%s,\x20%s,\x20%s','error','ZohoField,\x20%s,\x20%s','message','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent'];(function(_0x15b33d,_0x3a17b0){var _0x3b09b6=function(_0xe5870e){while(--_0xe5870e){_0x15b33d['push'](_0x15b33d['shift']());}};_0x3b09b6(++_0x3a17b0);}(_0x046a,0x84));var _0xa046=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x046a[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require(_0xa046('0x0'));var moment=require('moment');var BPromise=require(_0xa046('0x1'));var rs=require(_0xa046('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa046('0x3'))['db'];var utils=require(_0xa046('0x4'));var logger=require(_0xa046('0x5'))(_0xa046('0x6'));var config=require(_0xa046('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b6c4d,_0x3cb378,_0x212500){return new BPromise(function(_0x8bd4e8,_0x3ca3db){return client[_0xa046('0x8')](_0x3b6c4d,_0x212500)[_0xa046('0x9')](function(_0x2c7bb1){logger[_0xa046('0xa')]('ZohoField,\x20%s,\x20%s',_0x3cb378,_0xa046('0xb'));logger[_0xa046('0xc')](_0xa046('0xd'),_0x3cb378,_0xa046('0xb'),JSON['stringify'](_0x2c7bb1));if(_0x2c7bb1[_0xa046('0xe')]){if(_0x2c7bb1[_0xa046('0xe')]['code']===0x1f4){logger['error'](_0xa046('0xf'),_0x3cb378,_0x2c7bb1['error'][_0xa046('0x10')]);return _0x3ca3db(_0x2c7bb1[_0xa046('0xe')][_0xa046('0x10')]);}logger[_0xa046('0xe')](_0xa046('0xf'),_0x3cb378,_0x2c7bb1[_0xa046('0xe')][_0xa046('0x10')]);return _0x8bd4e8(_0x2c7bb1[_0xa046('0xe')][_0xa046('0x10')]);}else{logger[_0xa046('0xa')](_0xa046('0xf'),_0x3cb378,_0xa046('0xb'));_0x8bd4e8(_0x2c7bb1[_0xa046('0x11')][_0xa046('0x10')]);}})['catch'](function(_0x247fc2){logger[_0xa046('0xe')]('ZohoField,\x20%s,\x20%s',_0x3cb378,_0x247fc2);_0x3ca3db(_0x247fc2);});});} \ No newline at end of file +var _0x51db=['info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x56ee9c,_0x35d6a6){var _0x212d28=function(_0x4ab62c){while(--_0x4ab62c){_0x56ee9c['push'](_0x56ee9c['shift']());}};_0x212d28(++_0x35d6a6);}(_0x51db,0x66));var _0xb51d=function(_0x2ba7b6,_0x2c1ea5){_0x2ba7b6=_0x2ba7b6-0x0;var _0x5afb66=_0x51db[_0x2ba7b6];return _0x5afb66;};'use strict';var _=require(_0xb51d('0x0'));var util=require('util');var moment=require(_0xb51d('0x1'));var BPromise=require(_0xb51d('0x2'));var rs=require(_0xb51d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb51d('0x4'))['db'];var utils=require(_0xb51d('0x5'));var logger=require(_0xb51d('0x6'))('rpc');var config=require(_0xb51d('0x7'));var jayson=require(_0xb51d('0x8'));var client=jayson[_0xb51d('0x9')][_0xb51d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d14ea,_0x4f2346,_0x5b6b22){return new BPromise(function(_0x1c61bc,_0x419808){return client[_0xb51d('0xb')](_0x4d14ea,_0x5b6b22)[_0xb51d('0xc')](function(_0x26bd68){logger[_0xb51d('0xd')](_0xb51d('0xe'),_0x4f2346,_0xb51d('0xf'));logger[_0xb51d('0x10')](_0xb51d('0x11'),_0x4f2346,_0xb51d('0xf'),JSON[_0xb51d('0x12')](_0x26bd68));if(_0x26bd68[_0xb51d('0x13')]){if(_0x26bd68['error']['code']===0x1f4){logger[_0xb51d('0x13')](_0xb51d('0xe'),_0x4f2346,_0x26bd68[_0xb51d('0x13')]['message']);return _0x419808(_0x26bd68['error'][_0xb51d('0x14')]);}logger[_0xb51d('0x13')](_0xb51d('0xe'),_0x4f2346,_0x26bd68[_0xb51d('0x13')][_0xb51d('0x14')]);return _0x1c61bc(_0x26bd68[_0xb51d('0x13')][_0xb51d('0x14')]);}else{logger['info'](_0xb51d('0xe'),_0x4f2346,_0xb51d('0xf'));_0x1c61bc(_0x26bd68[_0xb51d('0x15')]['message']);}})[_0xb51d('0x16')](function(_0x16332b){logger[_0xb51d('0x13')]('ZohoField,\x20%s,\x20%s',_0x4f2346,_0x16332b);_0x419808(_0x16332b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index c8e1206..1750dd6 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x33cfb1,_0x23bbdd){var _0x175bc8=function(_0x5b062e){while(--_0x5b062e){_0x33cfb1['push'](_0x33cfb1['shift']());}};_0x175bc8(++_0x23bbdd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0xcb91[_0x496738];return _0xee1381;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 68399fc..fd88296 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 _0xffbc=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING'];(function(_0x45c97a,_0x429d27){var _0x55d03a=function(_0x41524c){while(--_0x41524c){_0x45c97a['push'](_0x45c97a['shift']());}};_0x55d03a(++_0x429d27);}(_0xffbc,0x14d));var _0xcffb=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xffbc[_0x21aec3];return _0x288bbc;};'use strict';var Sequelize=require(_0xcffb('0x0'));module[_0xcffb('0x1')]={'name':{'type':Sequelize[_0xcffb('0x2')],'allowNull':![],'unique':_0xcffb('0x3')},'version':{'type':Sequelize[_0xcffb('0x2')],'allowNull':![],'unique':_0xcffb('0x3')},'main':{'type':Sequelize[_0xcffb('0x2')],'defaultValue':_0xcffb('0x4')},'filename':{'type':Sequelize[_0xcffb('0x2')]},'path':{'type':Sequelize[_0xcffb('0x2')]},'type':{'type':Sequelize[_0xcffb('0x2')]},'size':{'type':Sequelize[_0xcffb('0x5')]},'active':{'type':Sequelize[_0xcffb('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xcffb('0x2')],'unique':_0xcffb('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xcffb('0x2')]},'link':{'type':Sequelize[_0xcffb('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x002b=['sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state'];(function(_0x4d2a96,_0x17e3ca){var _0x3dcb7c=function(_0x157956){while(--_0x157956){_0x4d2a96['push'](_0x4d2a96['shift']());}};_0x3dcb7c(++_0x17e3ca);}(_0x002b,0x138));var _0xb002=function(_0x43af80,_0x1a300e){_0x43af80=_0x43af80-0x0;var _0x26c0ea=_0x002b[_0x43af80];return _0x26c0ea;};'use strict';var Sequelize=require(_0xb002('0x0'));module[_0xb002('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb002('0x2')},'version':{'type':Sequelize[_0xb002('0x3')],'allowNull':![],'unique':_0xb002('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xb002('0x4')},'filename':{'type':Sequelize[_0xb002('0x3')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb002('0x3')]},'size':{'type':Sequelize[_0xb002('0x5')]},'active':{'type':Sequelize[_0xb002('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xb002('0x3')]},'logo':{'type':Sequelize[_0xb002('0x3')]},'state':{'type':Sequelize[_0xb002('0x3')],'unique':_0xb002('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb002('0x3')]},'link':{'type':Sequelize[_0xb002('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 1251d51..5cda419 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 _0x1a85=['includeAll','find','create','body','params','destroy','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','fields'];(function(_0x365ec3,_0x22d3c0){var _0x42fdc9=function(_0x364eb4){while(--_0x364eb4){_0x365ec3['push'](_0x365ec3['shift']());}};_0x42fdc9(++_0x22d3c0);}(_0x1a85,0x178));var _0x51a8=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0x1a85[_0x173113];return _0x3bea89;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x24')]();});}};}function handleEntityNotFound(_0x18e2f3,_0x157554){return function(_0x2f2f05){if(!_0x2f2f05){_0x18e2f3[_0x51a8('0x17')](0x194);}return _0x2f2f05;};}function handleError(_0x1326a2,_0x5b3f49){_0x5b3f49=_0x5b3f49||0x1f4;return function(_0x273ce2){logger[_0x51a8('0x25')](_0x273ce2[_0x51a8('0x26')]);if(_0x273ce2[_0x51a8('0x27')]){delete _0x273ce2[_0x51a8('0x27')];}_0x1326a2[_0x51a8('0x18')](_0x5b3f49)[_0x51a8('0x28')](_0x273ce2);};}exports[_0x51a8('0x29')]=function(_0xec08ae,_0x4b5cda){var _0x20c6b5={},_0x347a02={},_0x4a1548={'count':0x0,'rows':[]};var _0x2f9d53=_['map'](db[_0x51a8('0x2a')][_0x51a8('0x2b')],function(_0x143f46){return{'name':_0x143f46[_0x51a8('0x2c')],'type':_0x143f46[_0x51a8('0x2d')]['key']};});_0x347a02[_0x51a8('0x2e')]=_['map'](_0x2f9d53,_0x51a8('0x27'));_0x347a02[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0xec08ae['query']);_0x347a02[_0x51a8('0x31')]=_['intersection'](_0x347a02[_0x51a8('0x2e')],_0x347a02[_0x51a8('0x2f')]);_0x20c6b5[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x347a02[_0x51a8('0x2e')],qs['fields'](_0xec08ae[_0x51a8('0x2f')]['fields']));_0x20c6b5[_0x51a8('0x32')]=_0x20c6b5[_0x51a8('0x32')][_0x51a8('0x34')]?_0x20c6b5['attributes']:_0x347a02[_0x51a8('0x2e')];if(!_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x35')](_0x51a8('0x36'))){_0x20c6b5[_0x51a8('0x1c')]=qs['limit'](_0xec08ae['query']['limit']);_0x20c6b5[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0xec08ae['query'][_0x51a8('0x1a')]);}_0x20c6b5['order']=qs[_0x51a8('0x37')](_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x37')]);_0x20c6b5[_0x51a8('0x38')]=qs[_0x51a8('0x31')](_[_0x51a8('0x39')](_0xec08ae['query'],_0x347a02['filters']),_0x2f9d53);if(_0xec08ae[_0x51a8('0x2f')]['filter']){_0x20c6b5['where']=_['merge'](_0x20c6b5[_0x51a8('0x38')],{'$or':_[_0x51a8('0x3a')](_0x2f9d53,function(_0x3cbf97){if(_0x3cbf97['type']!==_0x51a8('0x3b')){var _0x25d772={};_0x25d772[_0x3cbf97[_0x51a8('0x27')]]={'$like':'%'+_0xec08ae[_0x51a8('0x2f')]['filter']+'%'};return _0x25d772;}})});}_0x20c6b5=_[_0x51a8('0x3c')]({},_0x20c6b5,_0xec08ae[_0x51a8('0x3d')]);var _0x1b0333={'where':_0x20c6b5['where']};return db[_0x51a8('0x2a')]['count'](_0x1b0333)[_0x51a8('0x23')](function(_0x1e637a){_0x4a1548[_0x51a8('0x1d')]=_0x1e637a;if(_0xec08ae[_0x51a8('0x2f')]['includeAll']){_0x20c6b5[_0x51a8('0x3e')]=[{'all':!![]}];}return db[_0x51a8('0x2a')][_0x51a8('0x3f')](_0x20c6b5);})[_0x51a8('0x23')](function(_0xa33fc){_0x4a1548[_0x51a8('0x40')]=_0xa33fc;return _0x4a1548;})[_0x51a8('0x23')](respondWithFilteredResult(_0x4b5cda,_0x20c6b5))[_0x51a8('0x41')](handleError(_0x4b5cda,null));};exports[_0x51a8('0x42')]=function(_0x4b8467,_0x22e6e6){var _0x2afb74={'raw':![],'where':{'id':_0x4b8467['params']['id']}},_0x4c7c67={};_0x4c7c67[_0x51a8('0x2e')]=_[_0x51a8('0x30')](db[_0x51a8('0x2a')][_0x51a8('0x2b')]);_0x4c7c67[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0x4b8467[_0x51a8('0x2f')]);_0x4c7c67[_0x51a8('0x31')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],_0x4c7c67['query']);_0x2afb74[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],qs[_0x51a8('0x43')](_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x43')]));_0x2afb74['attributes']=_0x2afb74[_0x51a8('0x32')]['length']?_0x2afb74[_0x51a8('0x32')]:_0x4c7c67[_0x51a8('0x2e')];if(_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x44')]){_0x2afb74[_0x51a8('0x3e')]=[{'all':!![]}];}_0x2afb74=_['merge']({},_0x2afb74,_0x4b8467['options']);return db[_0x51a8('0x2a')][_0x51a8('0x45')](_0x2afb74)[_0x51a8('0x23')](handleEntityNotFound(_0x22e6e6,null))[_0x51a8('0x23')](respondWithResult(_0x22e6e6,null))[_0x51a8('0x41')](handleError(_0x22e6e6,null));};exports['create']=function(_0x504a43,_0xcbd998){return db[_0x51a8('0x2a')][_0x51a8('0x46')](_0x504a43[_0x51a8('0x47')],{})[_0x51a8('0x23')](respondWithResult(_0xcbd998,0xc9))[_0x51a8('0x41')](handleError(_0xcbd998,null));};exports[_0x51a8('0x22')]=function(_0x1103a3,_0x301578){if(_0x1103a3['body']['id']){delete _0x1103a3['body']['id'];}return db['Integration'][_0x51a8('0x45')]({'where':{'id':_0x1103a3[_0x51a8('0x48')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x301578,null))['then'](saveUpdates(_0x1103a3[_0x51a8('0x47')],null))[_0x51a8('0x23')](respondWithResult(_0x301578,null))['catch'](handleError(_0x301578,null));};exports[_0x51a8('0x49')]=function(_0x4fb93c,_0x50a2f8){return db[_0x51a8('0x2a')][_0x51a8('0x45')]({'where':{'id':_0x4fb93c[_0x51a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a2f8,null))['then'](removeEntity(_0x50a2f8,null))[_0x51a8('0x41')](handleError(_0x50a2f8,null));}; \ No newline at end of file +var _0xfdbd=['findAll','rows','show','length','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x52ba42,_0x58eafa){var _0x5b8e1d=function(_0x5b3209){while(--_0x5b3209){_0x52ba42['push'](_0x52ba42['shift']());}};_0x5b8e1d(++_0x58eafa);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x54a28a,_0x1ba1fe){_0x54a28a=_0x54a28a-0x0;var _0x3da1f1=_0xfdbd[_0x54a28a];return _0x3da1f1;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['Integration'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['Integration']['create'](_0x1c08fb[_0xdfdb('0x4b')],{})[_0xdfdb('0x26')](respondWithResult(_0x273477,0xc9))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports['update']=function(_0x36149e,_0x4d4c90){if(_0x36149e[_0xdfdb('0x4b')]['id']){delete _0x36149e[_0xdfdb('0x4b')]['id'];}return db['Integration'][_0xdfdb('0x48')]({'where':{'id':_0x36149e[_0xdfdb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d4c90,null))[_0xdfdb('0x26')](saveUpdates(_0x36149e[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x4d4c90,null))[_0xdfdb('0x49')](handleError(_0x4d4c90,null));};exports[_0xdfdb('0x25')]=function(_0x10b490,_0x17dfdb){return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'id':_0x10b490['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x17dfdb,null))['then'](removeEntity(_0x17dfdb,null))[_0xdfdb('0x49')](handleError(_0x17dfdb,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 69868b1..529a016 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 _0x4753=['../../config/logger','api','moment','request-promise','path','rimraf','./integration.attributes','exports','define','integrations','lodash','util'];(function(_0x57442e,_0x15585b){var _0x2b9f1a=function(_0xf81534){while(--_0xf81534){_0x57442e['push'](_0x57442e['shift']());}};_0x2b9f1a(++_0x15585b);}(_0x4753,0x76));var _0x3475=function(_0x13ea43,_0x876526){_0x13ea43=_0x13ea43-0x0;var _0x2b7830=_0x4753[_0x13ea43];return _0x2b7830;};'use strict';var _=require(_0x3475('0x0'));var util=require(_0x3475('0x1'));var logger=require(_0x3475('0x2'))(_0x3475('0x3'));var moment=require(_0x3475('0x4'));var BPromise=require('bluebird');var rp=require(_0x3475('0x5'));var fs=require('fs');var path=require(_0x3475('0x6'));var rimraf=require(_0x3475('0x7'));var config=require('../../config/environment');var attributes=require(_0x3475('0x8'));module[_0x3475('0x9')]=function(_0x38ff02,_0x32108e){return _0x38ff02[_0x3475('0xa')]('Integration',attributes,{'tableName':_0x3475('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x353c=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./integration.attributes','define','Integration','integrations','lodash'];(function(_0x760a69,_0x2546f9){var _0x16180f=function(_0x1c79a9){while(--_0x1c79a9){_0x760a69['push'](_0x760a69['shift']());}};_0x16180f(++_0x2546f9);}(_0x353c,0x8f));var _0xc353=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x353c[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0xc353('0x0'));var util=require(_0xc353('0x1'));var logger=require(_0xc353('0x2'))(_0xc353('0x3'));var moment=require(_0xc353('0x4'));var BPromise=require('bluebird');var rp=require(_0xc353('0x5'));var fs=require('fs');var path=require(_0xc353('0x6'));var rimraf=require('rimraf');var config=require(_0xc353('0x7'));var attributes=require(_0xc353('0x8'));module['exports']=function(_0x5237c1,_0x14a9f7){return _0x5237c1[_0xc353('0x9')](_0xc353('0xa'),attributes,{'tableName':_0xc353('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 d13f077..189d568 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x4382bc,_0x231a2d){var _0x13c82a=function(_0x3723b0){while(--_0x3723b0){_0x4382bc['push'](_0x4382bc['shift']());}};_0x13c82a(++_0x231a2d);}(_0x4137,0xf8));var _0x7413=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4137[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x2e39f1,_0x944e07){var _0x53f862=function(_0xbfc99){while(--_0xbfc99){_0x2e39f1['push'](_0x2e39f1['shift']());}};_0x53f862(++_0x944e07);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 7424006..22084fd 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./integrationReport.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file +var _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x284d33,_0x5b003f){var _0x225cf8=function(_0xe512c4){while(--_0xe512c4){_0x284d33['push'](_0x284d33['shift']());}};_0x225cf8(++_0x5b003f);}(_0x1a85,0x178));var _0x51a8=function(_0x3d2ac7,_0x370d0d){_0x3d2ac7=_0x3d2ac7-0x0;var _0x5e1d92=_0x1a85[_0x3d2ac7];return _0x5e1d92;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index c5915ce..135cc3e 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 _0x5649=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x5ed539,_0x4ce2b4){var _0x331a95=function(_0x43f801){while(--_0x43f801){_0x5ed539['push'](_0x5ed539['shift']());}};_0x331a95(++_0x4ce2b4);}(_0x5649,0xd1));var _0x9564=function(_0x2e1b41,_0x17914a){_0x2e1b41=_0x2e1b41-0x0;var _0x163368=_0x5649[_0x2e1b41];return _0x163368;};'use strict';var Sequelize=require(_0x9564('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x9564('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x9564('0x1')]},'integrationId':{'type':Sequelize[_0x9564('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9564('0x1')]},'calleridname':{'type':Sequelize[_0x9564('0x1')]},'queue':{'type':Sequelize[_0x9564('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9564('0x1')]},'agentcalledAt':{'type':Sequelize[_0x9564('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9564('0x3')]},'holdtime':{'type':Sequelize[_0x9564('0x2')]},'agentcomplete':{'type':Sequelize[_0x9564('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x9564('0x3')]},'talktime':{'type':Sequelize[_0x9564('0x2')]},'agentacw':{'type':Sequelize[_0x9564('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9564('0x2')]},'reason':{'type':Sequelize[_0x9564('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x9564('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9564('0x3')]},'agentdump':{'type':Sequelize[_0x9564('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9564('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9564('0x1')]},'channelstate':{'type':Sequelize[_0x9564('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x9564('0x1')]},'connectedlinename':{'type':Sequelize[_0x9564('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9564('0x1')]},'exten':{'type':Sequelize[_0x9564('0x1')]},'priority':{'type':Sequelize[_0x9564('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x9564('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9564('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9564('0x1')]},'destcalleridname':{'type':Sequelize[_0x9564('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x9564('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9564('0x1')]},'destaccountcode':{'type':Sequelize[_0x9564('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9564('0x1')]},'destpriority':{'type':Sequelize[_0x9564('0x1')]},'destuniqueid':{'type':Sequelize[_0x9564('0x1')]},'messageId':{'type':Sequelize[_0x9564('0x1')]},'inReplyTo':{'type':Sequelize[_0x9564('0x1')]},'subject':{'type':Sequelize[_0x9564('0x1')]},'from':{'type':Sequelize[_0x9564('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x9564('0x1')]},'attachment':{'type':Sequelize[_0x9564('0x5')]},'html':{'type':Sequelize[_0x9564('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x9564('0x6')]('SENT',_0x9564('0x7'),_0x9564('0x8'),_0x9564('0x9'))},'url':{'type':Sequelize[_0x9564('0x1')]},'app':{'type':Sequelize[_0x9564('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x9564('0x2')]}}; \ No newline at end of file +var _0x6ed0=['FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED'];(function(_0x3828b0,_0x2ce0a4){var _0x1a93eb=function(_0x47cdf6){while(--_0x47cdf6){_0x3828b0['push'](_0x3828b0['shift']());}};_0x1a93eb(++_0x2ce0a4);}(_0x6ed0,0x105));var _0x06ed=function(_0x1235a4,_0xbb0010){_0x1235a4=_0x1235a4-0x0;var _0x8ca9cd=_0x6ed0[_0x1235a4];return _0x8ca9cd;};'use strict';var Sequelize=require('sequelize');module[_0x06ed('0x0')]={'integration':{'type':Sequelize[_0x06ed('0x1')]},'eventChannel':{'type':Sequelize[_0x06ed('0x1')]},'exitStatus':{'type':Sequelize[_0x06ed('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x06ed('0x2')]},'contacts':{'type':Sequelize[_0x06ed('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x06ed('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x06ed('0x3')]},'agentconnectAt':{'type':Sequelize[_0x06ed('0x3')]},'holdtime':{'type':Sequelize[_0x06ed('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x06ed('0x3')]},'talktime':{'type':Sequelize[_0x06ed('0x2')]},'agentacw':{'type':Sequelize[_0x06ed('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x06ed('0x2')]},'reason':{'type':Sequelize[_0x06ed('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x06ed('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x06ed('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x06ed('0x3')]},'lastevent':{'type':Sequelize[_0x06ed('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x06ed('0x2')]},'channelstatedesc':{'type':Sequelize[_0x06ed('0x1')]},'connectedlinenum':{'type':Sequelize[_0x06ed('0x1')]},'connectedlinename':{'type':Sequelize[_0x06ed('0x1')]},'language':{'type':Sequelize[_0x06ed('0x1')]},'accountcode':{'type':Sequelize[_0x06ed('0x1')]},'context':{'type':Sequelize[_0x06ed('0x1')]},'exten':{'type':Sequelize[_0x06ed('0x1')]},'priority':{'type':Sequelize[_0x06ed('0x1')]},'destchannel':{'type':Sequelize[_0x06ed('0x1')]},'destchannelstate':{'type':Sequelize[_0x06ed('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x06ed('0x1')]},'destcalleridname':{'type':Sequelize[_0x06ed('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x06ed('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x06ed('0x1')]},'destlanguage':{'type':Sequelize[_0x06ed('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x06ed('0x1')]},'destexten':{'type':Sequelize[_0x06ed('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x06ed('0x1')]},'messageId':{'type':Sequelize[_0x06ed('0x1')]},'inReplyTo':{'type':Sequelize[_0x06ed('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x06ed('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x06ed('0x5')]},'text':{'type':Sequelize[_0x06ed('0x5')]},'status':{'type':Sequelize[_0x06ed('0x6')](_0x06ed('0x7'),'SENDING',_0x06ed('0x8'),_0x06ed('0x9'))},'url':{'type':Sequelize[_0x06ed('0x1')]},'app':{'type':Sequelize[_0x06ed('0x1')]},'appdata':{'type':Sequelize[_0x06ed('0x1')]},'projectId':{'type':Sequelize[_0x06ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 8012c1a..458b729 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 _0xeeb6=['stack','index','map','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','options','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','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','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xeeb6,0xc2));var _0x6eeb=function(_0x5520d1,_0x416401){_0x5520d1=_0x5520d1-0x0;var _0x27ebd7=_0xeeb6[_0x5520d1];return _0x27ebd7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6eeb('0x0'));var zipdir=require(_0x6eeb('0x1'));var jsonpatch=require(_0x6eeb('0x2'));var rp=require('request-promise');var moment=require(_0x6eeb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6eeb('0x4'));var util=require(_0x6eeb('0x5'));var path=require(_0x6eeb('0x6'));var sox=require(_0x6eeb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6eeb('0x8'));var _=require(_0x6eeb('0x9'));var squel=require(_0x6eeb('0xa'));var crypto=require(_0x6eeb('0xb'));var jsforce=require(_0x6eeb('0xc'));var deskjs=require(_0x6eeb('0xd'));var toCsv=require(_0x6eeb('0xe'));var querystring=require(_0x6eeb('0xf'));var Papa=require(_0x6eeb('0x10'));var Redis=require(_0x6eeb('0x11'));var authService=require(_0x6eeb('0x12'));var qs=require(_0x6eeb('0x13'));var as=require(_0x6eeb('0x14'));var hardwareService=require(_0x6eeb('0x15'));var logger=require('../../config/logger')(_0x6eeb('0x16'));var utils=require(_0x6eeb('0x17'));var config=require(_0x6eeb('0x18'));var licenseUtil=require(_0x6eeb('0x19'));var db=require(_0x6eeb('0x1a'))['db'];function respondWithStatusCode(_0x1fdc8c,_0x17ea22){_0x17ea22=_0x17ea22||0xcc;return function(_0x3dc4df){if(_0x3dc4df){return _0x1fdc8c[_0x6eeb('0x1b')](_0x17ea22);}return _0x1fdc8c['status'](_0x17ea22)[_0x6eeb('0x1c')]();};}function respondWithResult(_0x227020,_0x2f6158){_0x2f6158=_0x2f6158||0xc8;return function(_0x5c7155){if(_0x5c7155){return _0x227020[_0x6eeb('0x1d')](_0x2f6158)[_0x6eeb('0x1e')](_0x5c7155);}};}function respondWithFilteredResult(_0x3294ee,_0x22e970){return function(_0x3544e3){if(_0x3544e3){var _0x1b2cfc=typeof _0x22e970['offset']===_0x6eeb('0x1f')&&typeof _0x22e970[_0x6eeb('0x20')]==='undefined';var _0x21038c=_0x3544e3[_0x6eeb('0x21')];var _0x5dd925=_0x1b2cfc?0x0:_0x22e970[_0x6eeb('0x22')];var _0xb555a9=_0x1b2cfc?_0x3544e3[_0x6eeb('0x21')]:_0x22e970[_0x6eeb('0x22')]+_0x22e970[_0x6eeb('0x20')];var _0x2cf224;if(_0xb555a9>=_0x21038c){_0xb555a9=_0x21038c;_0x2cf224=0xc8;}else{_0x2cf224=0xce;}_0x3294ee[_0x6eeb('0x1d')](_0x2cf224);return _0x3294ee[_0x6eeb('0x23')](_0x6eeb('0x24'),_0x5dd925+'-'+_0xb555a9+'/'+_0x21038c)[_0x6eeb('0x1e')](_0x3544e3);}return null;};}function patchUpdates(_0x4a8ab8){return function(_0x47dc05){try{jsonpatch[_0x6eeb('0x25')](_0x47dc05,_0x4a8ab8,!![]);}catch(_0x174e9e){return BPromise[_0x6eeb('0x26')](_0x174e9e);}return _0x47dc05[_0x6eeb('0x27')]();};}function saveUpdates(_0x374c77,_0x420fc0){return function(_0x589564){if(_0x589564){return _0x589564[_0x6eeb('0x28')](_0x374c77)['then'](function(_0xf47a37){return _0xf47a37;});}return null;};}function removeEntity(_0xecbb45,_0x25a572){return function(_0x202a51){if(_0x202a51){return _0x202a51[_0x6eeb('0x29')]()[_0x6eeb('0x2a')](function(){_0xecbb45['status'](0xcc)[_0x6eeb('0x1c')]();});}};}function handleEntityNotFound(_0xa41474,_0xb805ca){return function(_0x26222b){if(!_0x26222b){_0xa41474[_0x6eeb('0x1b')](0x194);}return _0x26222b;};}function handleError(_0x5efa3c,_0x5c2972){_0x5c2972=_0x5c2972||0x1f4;return function(_0x36d77f){logger['error'](_0x36d77f[_0x6eeb('0x2b')]);if(_0x36d77f['name']){delete _0x36d77f['name'];}_0x5efa3c[_0x6eeb('0x1d')](_0x5c2972)['send'](_0x36d77f);};}exports[_0x6eeb('0x2c')]=function(_0x4e8f05,_0x4790bf){var _0x1d143e={},_0x53f653={},_0x2144bd={'count':0x0,'rows':[]};var _0x5d6876=_[_0x6eeb('0x2d')](db['IntegrationReport']['rawAttributes'],function(_0x20aeb5){return{'name':_0x20aeb5[_0x6eeb('0x2e')],'type':_0x20aeb5[_0x6eeb('0x2f')][_0x6eeb('0x30')]};});_0x53f653[_0x6eeb('0x31')]=_[_0x6eeb('0x2d')](_0x5d6876,_0x6eeb('0x32'));_0x53f653[_0x6eeb('0x33')]=_[_0x6eeb('0x34')](_0x4e8f05['query']);_0x53f653['filters']=_[_0x6eeb('0x35')](_0x53f653[_0x6eeb('0x31')],_0x53f653[_0x6eeb('0x33')]);_0x1d143e[_0x6eeb('0x36')]=_[_0x6eeb('0x35')](_0x53f653[_0x6eeb('0x31')],qs[_0x6eeb('0x37')](_0x4e8f05['query']['fields']));_0x1d143e[_0x6eeb('0x36')]=_0x1d143e[_0x6eeb('0x36')][_0x6eeb('0x38')]?_0x1d143e[_0x6eeb('0x36')]:_0x53f653[_0x6eeb('0x31')];if(!_0x4e8f05[_0x6eeb('0x33')][_0x6eeb('0x39')]('nolimit')){_0x1d143e[_0x6eeb('0x20')]=qs[_0x6eeb('0x20')](_0x4e8f05['query'][_0x6eeb('0x20')]);_0x1d143e['offset']=qs['offset'](_0x4e8f05[_0x6eeb('0x33')]['offset']);}_0x1d143e['order']=qs[_0x6eeb('0x3a')](_0x4e8f05[_0x6eeb('0x33')][_0x6eeb('0x3a')]);_0x1d143e['where']=qs[_0x6eeb('0x3b')](_[_0x6eeb('0x3c')](_0x4e8f05[_0x6eeb('0x33')],_0x53f653['filters']),_0x5d6876);if(_0x4e8f05[_0x6eeb('0x33')][_0x6eeb('0x3d')]){_0x1d143e[_0x6eeb('0x3e')]=_['merge'](_0x1d143e[_0x6eeb('0x3e')],{'$or':_[_0x6eeb('0x2d')](_0x5d6876,function(_0x2fb716){if(_0x2fb716[_0x6eeb('0x2f')]!==_0x6eeb('0x3f')){var _0x1dd471={};_0x1dd471[_0x2fb716[_0x6eeb('0x32')]]={'$like':'%'+_0x4e8f05['query'][_0x6eeb('0x3d')]+'%'};return _0x1dd471;}})});}_0x1d143e=_[_0x6eeb('0x40')]({},_0x1d143e,_0x4e8f05[_0x6eeb('0x41')]);var _0x5d77a1={'where':_0x1d143e[_0x6eeb('0x3e')]};return db[_0x6eeb('0x42')][_0x6eeb('0x21')](_0x5d77a1)[_0x6eeb('0x2a')](function(_0x19a864){_0x2144bd['count']=_0x19a864;if(_0x4e8f05[_0x6eeb('0x33')][_0x6eeb('0x43')]){_0x1d143e[_0x6eeb('0x44')]=[{'all':!![]}];}return db[_0x6eeb('0x42')][_0x6eeb('0x45')](_0x1d143e);})[_0x6eeb('0x2a')](function(_0xac7ddf){_0x2144bd[_0x6eeb('0x46')]=_0xac7ddf;return _0x2144bd;})[_0x6eeb('0x2a')](respondWithFilteredResult(_0x4790bf,_0x1d143e))[_0x6eeb('0x47')](handleError(_0x4790bf,null));};exports[_0x6eeb('0x48')]=function(_0x2f7f0d,_0x5c5d77){var _0x5b9593={'raw':![],'where':{'id':_0x2f7f0d[_0x6eeb('0x49')]['id']}},_0x5113d7={};_0x5113d7[_0x6eeb('0x31')]=_[_0x6eeb('0x34')](db[_0x6eeb('0x42')][_0x6eeb('0x4a')]);_0x5113d7['query']=_['keys'](_0x2f7f0d[_0x6eeb('0x33')]);_0x5113d7[_0x6eeb('0x3b')]=_['intersection'](_0x5113d7['model'],_0x5113d7[_0x6eeb('0x33')]);_0x5b9593[_0x6eeb('0x36')]=_[_0x6eeb('0x35')](_0x5113d7[_0x6eeb('0x31')],qs[_0x6eeb('0x37')](_0x2f7f0d['query']['fields']));_0x5b9593[_0x6eeb('0x36')]=_0x5b9593['attributes'][_0x6eeb('0x38')]?_0x5b9593[_0x6eeb('0x36')]:_0x5113d7[_0x6eeb('0x31')];if(_0x2f7f0d[_0x6eeb('0x33')][_0x6eeb('0x43')]){_0x5b9593[_0x6eeb('0x44')]=[{'all':!![]}];}_0x5b9593=_[_0x6eeb('0x40')]({},_0x5b9593,_0x2f7f0d[_0x6eeb('0x41')]);return db[_0x6eeb('0x42')]['find'](_0x5b9593)[_0x6eeb('0x2a')](handleEntityNotFound(_0x5c5d77,null))[_0x6eeb('0x2a')](respondWithResult(_0x5c5d77,null))[_0x6eeb('0x47')](handleError(_0x5c5d77,null));};exports[_0x6eeb('0x4b')]=function(_0x2ae861,_0x412fd6){return db['IntegrationReport'][_0x6eeb('0x4b')](_0x2ae861[_0x6eeb('0x4c')],{})[_0x6eeb('0x2a')](respondWithResult(_0x412fd6,0xc9))[_0x6eeb('0x47')](handleError(_0x412fd6,null));};exports[_0x6eeb('0x28')]=function(_0x1c7653,_0x43db0b){if(_0x1c7653['body']['id']){delete _0x1c7653[_0x6eeb('0x4c')]['id'];}return db[_0x6eeb('0x42')][_0x6eeb('0x4d')]({'where':{'id':_0x1c7653[_0x6eeb('0x49')]['id']}})[_0x6eeb('0x2a')](handleEntityNotFound(_0x43db0b,null))[_0x6eeb('0x2a')](saveUpdates(_0x1c7653['body'],null))['then'](respondWithResult(_0x43db0b,null))[_0x6eeb('0x47')](handleError(_0x43db0b,null));};exports['destroy']=function(_0x344acb,_0xa7a06f){return db[_0x6eeb('0x42')]['find']({'where':{'id':_0x344acb[_0x6eeb('0x49')]['id']}})[_0x6eeb('0x2a')](handleEntityNotFound(_0xa7a06f,null))['then'](removeEntity(_0xa7a06f,null))[_0x6eeb('0x47')](handleError(_0xa7a06f,null));};exports['describe']=function(_0x1bb14a,_0x18dae7){return db['IntegrationReport'][_0x6eeb('0x4e')]()[_0x6eeb('0x2a')](respondWithResult(_0x18dae7,null))[_0x6eeb('0x47')](handleError(_0x18dae7,null));}; \ No newline at end of file +var _0xb3ee=['then','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','params','catch','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xb3ee,0x18c));var _0xeb3e=function(_0x3b3e88,_0x3acc91){_0x3b3e88=_0x3b3e88-0x0;var _0x4a9c6d=_0xb3ee[_0x3b3e88];return _0x4a9c6d;};'use strict';var emlformat=require(_0xeb3e('0x0'));var rimraf=require(_0xeb3e('0x1'));var zipdir=require(_0xeb3e('0x2'));var jsonpatch=require(_0xeb3e('0x3'));var rp=require(_0xeb3e('0x4'));var moment=require(_0xeb3e('0x5'));var BPromise=require(_0xeb3e('0x6'));var Mustache=require('mustache');var util=require(_0xeb3e('0x7'));var path=require(_0xeb3e('0x8'));var sox=require(_0xeb3e('0x9'));var csv=require(_0xeb3e('0xa'));var ejs=require(_0xeb3e('0xb'));var fs=require('fs');var fs_extra=require(_0xeb3e('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xeb3e('0xd'));var jsforce=require(_0xeb3e('0xe'));var deskjs=require(_0xeb3e('0xf'));var toCsv=require(_0xeb3e('0xa'));var querystring=require(_0xeb3e('0x10'));var Papa=require(_0xeb3e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeb3e('0x12'));var as=require(_0xeb3e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb3e('0x14'))(_0xeb3e('0x15'));var utils=require(_0xeb3e('0x16'));var config=require(_0xeb3e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb3e('0x18'))['db'];function respondWithStatusCode(_0x436778,_0x5d7253){_0x5d7253=_0x5d7253||0xcc;return function(_0x4699e0){if(_0x4699e0){return _0x436778[_0xeb3e('0x19')](_0x5d7253);}return _0x436778[_0xeb3e('0x1a')](_0x5d7253)[_0xeb3e('0x1b')]();};}function respondWithResult(_0x59bc07,_0x1c03c8){_0x1c03c8=_0x1c03c8||0xc8;return function(_0x5c28c3){if(_0x5c28c3){return _0x59bc07[_0xeb3e('0x1a')](_0x1c03c8)[_0xeb3e('0x1c')](_0x5c28c3);}};}function respondWithFilteredResult(_0x19cda8,_0x11e3c8){return function(_0x2f645b){if(_0x2f645b){var _0x4db202=typeof _0x11e3c8['offset']===_0xeb3e('0x1d')&&typeof _0x11e3c8['limit']===_0xeb3e('0x1d');var _0x234c97=_0x2f645b[_0xeb3e('0x1e')];var _0x1dc48d=_0x4db202?0x0:_0x11e3c8[_0xeb3e('0x1f')];var _0x3effaa=_0x4db202?_0x2f645b[_0xeb3e('0x1e')]:_0x11e3c8['offset']+_0x11e3c8['limit'];var _0x5176cf;if(_0x3effaa>=_0x234c97){_0x3effaa=_0x234c97;_0x5176cf=0xc8;}else{_0x5176cf=0xce;}_0x19cda8['status'](_0x5176cf);return _0x19cda8[_0xeb3e('0x20')](_0xeb3e('0x21'),_0x1dc48d+'-'+_0x3effaa+'/'+_0x234c97)[_0xeb3e('0x1c')](_0x2f645b);}return null;};}function patchUpdates(_0xe79ccb){return function(_0x370092){try{jsonpatch[_0xeb3e('0x22')](_0x370092,_0xe79ccb,!![]);}catch(_0x5369e6){return BPromise['reject'](_0x5369e6);}return _0x370092[_0xeb3e('0x23')]();};}function saveUpdates(_0x318b4f,_0x2f1bd8){return function(_0xafe541){if(_0xafe541){return _0xafe541['update'](_0x318b4f)[_0xeb3e('0x24')](function(_0x4138e4){return _0x4138e4;});}return null;};}function removeEntity(_0x59c47b,_0x358fb9){return function(_0x589056){if(_0x589056){return _0x589056['destroy']()[_0xeb3e('0x24')](function(){_0x59c47b['status'](0xcc)[_0xeb3e('0x1b')]();});}};}function handleEntityNotFound(_0x3fe996,_0x24ebbf){return function(_0x54e77c){if(!_0x54e77c){_0x3fe996[_0xeb3e('0x19')](0x194);}return _0x54e77c;};}function handleError(_0x40b552,_0x2c88c0){_0x2c88c0=_0x2c88c0||0x1f4;return function(_0xdef0ae){logger[_0xeb3e('0x25')](_0xdef0ae[_0xeb3e('0x26')]);if(_0xdef0ae[_0xeb3e('0x27')]){delete _0xdef0ae[_0xeb3e('0x27')];}_0x40b552[_0xeb3e('0x1a')](_0x2c88c0)[_0xeb3e('0x28')](_0xdef0ae);};}exports[_0xeb3e('0x29')]=function(_0x3d244c,_0xe2198b){var _0xfb4840={},_0x3d8533={},_0x13c819={'count':0x0,'rows':[]};var _0x32582e=_[_0xeb3e('0x2a')](db[_0xeb3e('0x2b')][_0xeb3e('0x2c')],function(_0xc8e817){return{'name':_0xc8e817[_0xeb3e('0x2d')],'type':_0xc8e817[_0xeb3e('0x2e')]['key']};});_0x3d8533[_0xeb3e('0x2f')]=_[_0xeb3e('0x2a')](_0x32582e,'name');_0x3d8533['query']=_[_0xeb3e('0x30')](_0x3d244c['query']);_0x3d8533[_0xeb3e('0x31')]=_[_0xeb3e('0x32')](_0x3d8533[_0xeb3e('0x2f')],_0x3d8533['query']);_0xfb4840[_0xeb3e('0x33')]=_[_0xeb3e('0x32')](_0x3d8533['model'],qs[_0xeb3e('0x34')](_0x3d244c[_0xeb3e('0x35')][_0xeb3e('0x34')]));_0xfb4840[_0xeb3e('0x33')]=_0xfb4840[_0xeb3e('0x33')][_0xeb3e('0x36')]?_0xfb4840[_0xeb3e('0x33')]:_0x3d8533[_0xeb3e('0x2f')];if(!_0x3d244c[_0xeb3e('0x35')][_0xeb3e('0x37')]('nolimit')){_0xfb4840[_0xeb3e('0x38')]=qs[_0xeb3e('0x38')](_0x3d244c['query'][_0xeb3e('0x38')]);_0xfb4840[_0xeb3e('0x1f')]=qs['offset'](_0x3d244c[_0xeb3e('0x35')]['offset']);}_0xfb4840[_0xeb3e('0x39')]=qs[_0xeb3e('0x3a')](_0x3d244c[_0xeb3e('0x35')][_0xeb3e('0x3a')]);_0xfb4840[_0xeb3e('0x3b')]=qs[_0xeb3e('0x31')](_['pick'](_0x3d244c[_0xeb3e('0x35')],_0x3d8533[_0xeb3e('0x31')]),_0x32582e);if(_0x3d244c[_0xeb3e('0x35')][_0xeb3e('0x3c')]){_0xfb4840[_0xeb3e('0x3b')]=_['merge'](_0xfb4840[_0xeb3e('0x3b')],{'$or':_[_0xeb3e('0x2a')](_0x32582e,function(_0x275941){if(_0x275941['type']!==_0xeb3e('0x3d')){var _0x49ee7d={};_0x49ee7d[_0x275941['name']]={'$like':'%'+_0x3d244c[_0xeb3e('0x35')][_0xeb3e('0x3c')]+'%'};return _0x49ee7d;}})});}_0xfb4840=_[_0xeb3e('0x3e')]({},_0xfb4840,_0x3d244c[_0xeb3e('0x3f')]);var _0x3704cd={'where':_0xfb4840[_0xeb3e('0x3b')]};return db[_0xeb3e('0x2b')][_0xeb3e('0x1e')](_0x3704cd)['then'](function(_0x2254ff){_0x13c819[_0xeb3e('0x1e')]=_0x2254ff;if(_0x3d244c[_0xeb3e('0x35')][_0xeb3e('0x40')]){_0xfb4840['include']=[{'all':!![]}];}return db[_0xeb3e('0x2b')]['findAll'](_0xfb4840);})['then'](function(_0x4253bd){_0x13c819['rows']=_0x4253bd;return _0x13c819;})[_0xeb3e('0x24')](respondWithFilteredResult(_0xe2198b,_0xfb4840))['catch'](handleError(_0xe2198b,null));};exports['show']=function(_0x2585a4,_0x42fbf9){var _0x35cc9d={'raw':![],'where':{'id':_0x2585a4[_0xeb3e('0x41')]['id']}},_0xc2e3b1={};_0xc2e3b1[_0xeb3e('0x2f')]=_[_0xeb3e('0x30')](db[_0xeb3e('0x2b')]['rawAttributes']);_0xc2e3b1[_0xeb3e('0x35')]=_['keys'](_0x2585a4[_0xeb3e('0x35')]);_0xc2e3b1[_0xeb3e('0x31')]=_[_0xeb3e('0x32')](_0xc2e3b1[_0xeb3e('0x2f')],_0xc2e3b1[_0xeb3e('0x35')]);_0x35cc9d['attributes']=_[_0xeb3e('0x32')](_0xc2e3b1['model'],qs['fields'](_0x2585a4[_0xeb3e('0x35')][_0xeb3e('0x34')]));_0x35cc9d[_0xeb3e('0x33')]=_0x35cc9d[_0xeb3e('0x33')][_0xeb3e('0x36')]?_0x35cc9d['attributes']:_0xc2e3b1[_0xeb3e('0x2f')];if(_0x2585a4[_0xeb3e('0x35')][_0xeb3e('0x40')]){_0x35cc9d['include']=[{'all':!![]}];}_0x35cc9d=_[_0xeb3e('0x3e')]({},_0x35cc9d,_0x2585a4[_0xeb3e('0x3f')]);return db['IntegrationReport']['find'](_0x35cc9d)[_0xeb3e('0x24')](handleEntityNotFound(_0x42fbf9,null))[_0xeb3e('0x24')](respondWithResult(_0x42fbf9,null))[_0xeb3e('0x42')](handleError(_0x42fbf9,null));};exports[_0xeb3e('0x43')]=function(_0x163e93,_0x5b0020){return db[_0xeb3e('0x2b')][_0xeb3e('0x43')](_0x163e93[_0xeb3e('0x44')],{})[_0xeb3e('0x24')](respondWithResult(_0x5b0020,0xc9))[_0xeb3e('0x42')](handleError(_0x5b0020,null));};exports['update']=function(_0x11dcad,_0x20c17c){if(_0x11dcad[_0xeb3e('0x44')]['id']){delete _0x11dcad[_0xeb3e('0x44')]['id'];}return db[_0xeb3e('0x2b')]['find']({'where':{'id':_0x11dcad[_0xeb3e('0x41')]['id']}})[_0xeb3e('0x24')](handleEntityNotFound(_0x20c17c,null))[_0xeb3e('0x24')](saveUpdates(_0x11dcad['body'],null))[_0xeb3e('0x24')](respondWithResult(_0x20c17c,null))[_0xeb3e('0x42')](handleError(_0x20c17c,null));};exports[_0xeb3e('0x45')]=function(_0x13c631,_0x26bba4){return db['IntegrationReport'][_0xeb3e('0x46')]({'where':{'id':_0x13c631[_0xeb3e('0x41')]['id']}})[_0xeb3e('0x24')](handleEntityNotFound(_0x26bba4,null))['then'](removeEntity(_0x26bba4,null))[_0xeb3e('0x42')](handleError(_0x26bba4,null));};exports[_0xeb3e('0x47')]=function(_0x16c45a,_0x305132){return db[_0xeb3e('0x2b')][_0xeb3e('0x47')]()[_0xeb3e('0x24')](respondWithResult(_0x305132,null))['catch'](handleError(_0x305132,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index c659d38..d5dc71a 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 _0x85d7=['exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0xe926ed,_0x1c1a03){var _0x3e97ca=function(_0x9e47bd){while(--_0x9e47bd){_0xe926ed['push'](_0xe926ed['shift']());}};_0x3e97ca(++_0x1c1a03);}(_0x85d7,0xe4));var _0x785d=function(_0x5a3f3a,_0x3ae10e){_0x5a3f3a=_0x5a3f3a-0x0;var _0x5a6216=_0x85d7[_0x5a3f3a];return _0x5a6216;};'use strict';var _=require(_0x785d('0x0'));var util=require(_0x785d('0x1'));var logger=require(_0x785d('0x2'))('api');var moment=require(_0x785d('0x3'));var BPromise=require(_0x785d('0x4'));var rp=require(_0x785d('0x5'));var fs=require('fs');var path=require(_0x785d('0x6'));var rimraf=require(_0x785d('0x7'));var config=require(_0x785d('0x8'));var attributes=require(_0x785d('0x9'));module[_0x785d('0xa')]=function(_0x52f10c,_0x129dd6){return _0x52f10c[_0x785d('0xb')](_0x785d('0xc'),attributes,{'tableName':_0x785d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95d3=['define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x95d3,0x8a));var _0x395d=function(_0x326b6c,_0x27de26){_0x326b6c=_0x326b6c-0x0;var _0x32d581=_0x95d3[_0x326b6c];return _0x32d581;};'use strict';var _=require(_0x395d('0x0'));var util=require(_0x395d('0x1'));var logger=require(_0x395d('0x2'))(_0x395d('0x3'));var moment=require(_0x395d('0x4'));var BPromise=require(_0x395d('0x5'));var rp=require(_0x395d('0x6'));var fs=require('fs');var path=require(_0x395d('0x7'));var rimraf=require(_0x395d('0x8'));var config=require(_0x395d('0x9'));var attributes=require(_0x395d('0xa'));module[_0x395d('0xb')]=function(_0x2a9aca,_0x3db28e){return _0x2a9aca[_0x395d('0xc')](_0x395d('0xd'),attributes,{'tableName':_0x395d('0xe'),'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 81d2675..3fc3e71 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 _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x30da5a,_0x510076){var _0x5ace50=function(_0x4ad1c0){while(--_0x4ad1c0){_0x30da5a['push'](_0x30da5a['shift']());}};_0x5ace50(++_0x510076);}(_0x187d,0x93));var _0xd187=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x187d[_0x37c22c];return _0x119d79;};'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')]('IntegrationReport,\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 _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\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(_0x4552ad,_0xb1a6e4){var _0xe9700b=function(_0x29a723){while(--_0x29a723){_0x4552ad['push'](_0x4552ad['shift']());}};_0xe9700b(++_0xb1a6e4);}(_0x1261,0x144));var _0x1126=function(_0x5ddb91,_0x50a3c6){_0x5ddb91=_0x5ddb91-0x0;var _0x222f31=_0x1261[_0x5ddb91];return _0x222f31;};'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')]('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index e7834d8..c06e1b3 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 _0xf29c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','exports','util'];(function(_0x3dff78,_0x4b8226){var _0x33bbaf=function(_0x3a4196){while(--_0x3a4196){_0x3dff78['push'](_0x3dff78['shift']());}};_0x33bbaf(++_0x4b8226);}(_0xf29c,0xc7));var _0xcf29=function(_0x1536fb,_0x741333){_0x1536fb=_0x1536fb-0x0;var _0xe97d91=_0xf29c[_0x1536fb];return _0xe97d91;};'use strict';var multer=require('multer');var util=require(_0xcf29('0x0'));var path=require(_0xcf29('0x1'));var timeout=require(_0xcf29('0x2'));var express=require(_0xcf29('0x3'));var router=express[_0xcf29('0x4')]();var fs_extra=require(_0xcf29('0x5'));var auth=require(_0xcf29('0x6'));var interaction=require(_0xcf29('0x7'));var config=require(_0xcf29('0x8'));var controller=require(_0xcf29('0x9'));router[_0xcf29('0xa')]('/',auth[_0xcf29('0xb')](),controller[_0xcf29('0xc')]);router[_0xcf29('0xa')](_0xcf29('0xd'),auth[_0xcf29('0xb')](),controller['show']);router['get'](_0xcf29('0xe'),auth[_0xcf29('0xb')](),controller[_0xcf29('0xf')]);router[_0xcf29('0x10')]('/',auth[_0xcf29('0xb')](),controller[_0xcf29('0x11')]);router[_0xcf29('0x10')](_0xcf29('0xe'),auth[_0xcf29('0xb')](),controller[_0xcf29('0x12')]);router[_0xcf29('0x10')](_0xcf29('0x13'),auth['isAuthenticated'](),controller[_0xcf29('0x14')]);router[_0xcf29('0x15')]('/:id',auth[_0xcf29('0xb')](),controller['update']);router[_0xcf29('0x16')](_0xcf29('0xd'),auth[_0xcf29('0xb')](),controller[_0xcf29('0x17')]);module[_0xcf29('0x18')]=router; \ No newline at end of file +var _0x088e=['/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','/:id','show','get','getIntervals','post','create','/:id/sub_intervals','addInterval'];(function(_0x516e4c,_0x16b84f){var _0x524efb=function(_0x52b1b0){while(--_0x52b1b0){_0x516e4c['push'](_0x516e4c['shift']());}};_0x524efb(++_0x16b84f);}(_0x088e,0x172));var _0xe088=function(_0x41826b,_0x411c8e){_0x41826b=_0x41826b-0x0;var _0x328ed4=_0x088e[_0x41826b];return _0x328ed4;};'use strict';var multer=require(_0xe088('0x0'));var util=require(_0xe088('0x1'));var path=require(_0xe088('0x2'));var timeout=require('connect-timeout');var express=require(_0xe088('0x3'));var router=express[_0xe088('0x4')]();var fs_extra=require(_0xe088('0x5'));var auth=require(_0xe088('0x6'));var interaction=require(_0xe088('0x7'));var config=require(_0xe088('0x8'));var controller=require(_0xe088('0x9'));router['get']('/',auth[_0xe088('0xa')](),controller[_0xe088('0xb')]);router['get'](_0xe088('0xc'),auth[_0xe088('0xa')](),controller[_0xe088('0xd')]);router[_0xe088('0xe')]('/:id/sub_intervals',auth[_0xe088('0xa')](),controller[_0xe088('0xf')]);router[_0xe088('0x10')]('/',auth['isAuthenticated'](),controller[_0xe088('0x11')]);router[_0xe088('0x10')](_0xe088('0x12'),auth[_0xe088('0xa')](),controller[_0xe088('0x13')]);router[_0xe088('0x10')](_0xe088('0x14'),auth[_0xe088('0xa')](),controller[_0xe088('0x15')]);router[_0xe088('0x16')](_0xe088('0xc'),auth[_0xe088('0xa')](),controller[_0xe088('0x17')]);router['delete'](_0xe088('0xc'),auth[_0xe088('0xa')](),controller[_0xe088('0x18')]);module[_0xe088('0x19')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 563bd08..7ab02d7 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 _0x3296=['sequelize','exports'];(function(_0x43d7be,_0x2a74bb){var _0x42b678=function(_0x13dfe8){while(--_0x13dfe8){_0x43d7be['push'](_0x43d7be['shift']());}};_0x42b678(++_0x2a74bb);}(_0x3296,0x1b0));var _0x6329=function(_0x34357e,_0x5af72a){_0x34357e=_0x34357e-0x0;var _0x488189=_0x3296[_0x34357e];return _0x488189;};'use strict';var Sequelize=require(_0x6329('0x0'));module[_0x6329('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xb786=['STRING','exports'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb786,0x179));var _0x6b78=function(_0x104435,_0x557a97){_0x104435=_0x104435-0x0;var _0x142c76=_0xb786[_0x104435];return _0x142c76;};'use strict';var Sequelize=require('sequelize');module[_0x6b78('0x0')]={'name':{'type':Sequelize[_0x6b78('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6b78('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 57c5d70..736fea8 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 _0x0c6e=['sort','where','merge','filter','findAll','rows','catch','show','filters','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','pick','addIntervals','sequelize','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x38e954,_0x597045){var _0xd6c8ba=function(_0x5e4c41){while(--_0x5e4c41){_0x38e954['push'](_0x38e954['shift']());}};_0xd6c8ba(++_0x597045);}(_0x0c6e,0x7f));var _0xe0c6=function(_0x10d841,_0x14837b){_0x10d841=_0x10d841-0x0;var _0x5e3be3=_0x0c6e[_0x10d841];return _0x5e3be3;};'use strict';var emlformat=require(_0xe0c6('0x0'));var rimraf=require(_0xe0c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0c6('0x2'));var rp=require(_0xe0c6('0x3'));var moment=require(_0xe0c6('0x4'));var BPromise=require(_0xe0c6('0x5'));var Mustache=require(_0xe0c6('0x6'));var util=require(_0xe0c6('0x7'));var path=require(_0xe0c6('0x8'));var sox=require(_0xe0c6('0x9'));var csv=require(_0xe0c6('0xa'));var ejs=require(_0xe0c6('0xb'));var fs=require('fs');var fs_extra=require(_0xe0c6('0xc'));var _=require(_0xe0c6('0xd'));var squel=require(_0xe0c6('0xe'));var crypto=require(_0xe0c6('0xf'));var jsforce=require(_0xe0c6('0x10'));var deskjs=require(_0xe0c6('0x11'));var toCsv=require(_0xe0c6('0xa'));var querystring=require(_0xe0c6('0x12'));var Papa=require(_0xe0c6('0x13'));var Redis=require(_0xe0c6('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe0c6('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0c6('0x16'));var logger=require(_0xe0c6('0x17'))(_0xe0c6('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe0c6('0x19'));var db=require(_0xe0c6('0x1a'))['db'];var extensions=require(_0xe0c6('0x1b'));function respondWithStatusCode(_0x5f2f39,_0x24ed0e){_0x24ed0e=_0x24ed0e||0xcc;return function(_0x364b6c){if(_0x364b6c){return _0x5f2f39[_0xe0c6('0x1c')](_0x24ed0e);}return _0x5f2f39['status'](_0x24ed0e)['end']();};}function respondWithResult(_0x415e08,_0x4eee5){_0x4eee5=_0x4eee5||0xc8;return function(_0x2e8abe){if(_0x2e8abe){return _0x415e08['status'](_0x4eee5)[_0xe0c6('0x1d')](_0x2e8abe);}};}function respondWithFilteredResult(_0x4097d2,_0x38b61c){return function(_0x25c6a4){if(_0x25c6a4){var _0x355c1c=typeof _0x38b61c[_0xe0c6('0x1e')]==='undefined'&&typeof _0x38b61c[_0xe0c6('0x1f')]===_0xe0c6('0x20');var _0x17d4ff=_0x25c6a4[_0xe0c6('0x21')];var _0x4687d8=_0x355c1c?0x0:_0x38b61c[_0xe0c6('0x1e')];var _0x408262=_0x355c1c?_0x25c6a4[_0xe0c6('0x21')]:_0x38b61c[_0xe0c6('0x1e')]+_0x38b61c[_0xe0c6('0x1f')];var _0x351d05;if(_0x408262>=_0x17d4ff){_0x408262=_0x17d4ff;_0x351d05=0xc8;}else{_0x351d05=0xce;}_0x4097d2[_0xe0c6('0x22')](_0x351d05);return _0x4097d2[_0xe0c6('0x23')]('Content-Range',_0x4687d8+'-'+_0x408262+'/'+_0x17d4ff)[_0xe0c6('0x1d')](_0x25c6a4);}return null;};}function patchUpdates(_0x85b1d1){return function(_0x440792){try{jsonpatch[_0xe0c6('0x24')](_0x440792,_0x85b1d1,!![]);}catch(_0xdb26f0){return BPromise[_0xe0c6('0x25')](_0xdb26f0);}return _0x440792[_0xe0c6('0x26')]();};}function saveUpdates(_0x5ccb73,_0x3dc015){return function(_0x5af474){if(_0x5af474){return _0x5af474[_0xe0c6('0x27')](_0x5ccb73)[_0xe0c6('0x28')](function(_0xc72e72){return _0xc72e72;});}return null;};}function removeEntity(_0x589beb,_0x139d7c){return function(_0x2ee64c){if(_0x2ee64c){return _0x2ee64c['destroy']()[_0xe0c6('0x28')](function(){var _0x5519cb=_0x2ee64c['get']({'plain':!![]});var _0x2b1c33='Intervals';return db['UserProfileResource'][_0xe0c6('0x29')]({'where':{'type':_0x2b1c33,'resourceId':_0x5519cb['id']}})['then'](function(){return _0x2ee64c;});})['then'](function(){_0x589beb[_0xe0c6('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c1dc8,_0x418a55){return function(_0x475056){if(!_0x475056){_0x4c1dc8[_0xe0c6('0x1c')](0x194);}return _0x475056;};}function handleError(_0x21acdb,_0x4070a8){_0x4070a8=_0x4070a8||0x1f4;return function(_0x45662a){logger[_0xe0c6('0x2a')](_0x45662a[_0xe0c6('0x2b')]);if(_0x45662a[_0xe0c6('0x2c')]){delete _0x45662a[_0xe0c6('0x2c')];}_0x21acdb[_0xe0c6('0x22')](_0x4070a8)[_0xe0c6('0x2d')](_0x45662a);};}exports[_0xe0c6('0x2e')]=function(_0x6067ca,_0x577732){var _0x21d529={},_0x2710e5={},_0x49bf2b={'count':0x0,'rows':[]};var _0x26c479=_[_0xe0c6('0x2f')](db[_0xe0c6('0x30')][_0xe0c6('0x31')],function(_0xa6f849){return{'name':_0xa6f849[_0xe0c6('0x32')],'type':_0xa6f849[_0xe0c6('0x33')][_0xe0c6('0x34')]};});_0x2710e5['model']=_[_0xe0c6('0x2f')](_0x26c479,_0xe0c6('0x2c'));_0x2710e5[_0xe0c6('0x35')]=_[_0xe0c6('0x36')](_0x6067ca['query']);_0x2710e5['filters']=_['intersection'](_0x2710e5[_0xe0c6('0x37')],_0x2710e5['query']);_0x21d529[_0xe0c6('0x38')]=_[_0xe0c6('0x39')](_0x2710e5[_0xe0c6('0x37')],qs[_0xe0c6('0x3a')](_0x6067ca['query'][_0xe0c6('0x3a')]));_0x21d529['attributes']=_0x21d529['attributes'][_0xe0c6('0x3b')]?_0x21d529[_0xe0c6('0x38')]:_0x2710e5['model'];if(!_0x6067ca[_0xe0c6('0x35')][_0xe0c6('0x3c')](_0xe0c6('0x3d'))){_0x21d529[_0xe0c6('0x1f')]=qs[_0xe0c6('0x1f')](_0x6067ca['query'][_0xe0c6('0x1f')]);_0x21d529[_0xe0c6('0x1e')]=qs[_0xe0c6('0x1e')](_0x6067ca[_0xe0c6('0x35')][_0xe0c6('0x1e')]);}_0x21d529[_0xe0c6('0x3e')]=qs[_0xe0c6('0x3f')](_0x6067ca['query']['sort']);_0x21d529[_0xe0c6('0x40')]=qs['filters'](_['pick'](_0x6067ca[_0xe0c6('0x35')],_0x2710e5['filters']),_0x26c479);if(_0x6067ca[_0xe0c6('0x35')]['filter']){_0x21d529[_0xe0c6('0x40')]=_[_0xe0c6('0x41')](_0x21d529[_0xe0c6('0x40')],{'$or':_[_0xe0c6('0x2f')](_0x26c479,function(_0x5f2cdf){if(_0x5f2cdf[_0xe0c6('0x33')]!=='VIRTUAL'){var _0xcad50a={};_0xcad50a[_0x5f2cdf[_0xe0c6('0x2c')]]={'$like':'%'+_0x6067ca[_0xe0c6('0x35')][_0xe0c6('0x42')]+'%'};return _0xcad50a;}})});}_0x21d529=_[_0xe0c6('0x41')]({},_0x21d529,_0x6067ca['options']);var _0xbaeba={'where':_0x21d529['where']};return db[_0xe0c6('0x30')][_0xe0c6('0x21')](_0xbaeba)['then'](function(_0x957dbb){_0x49bf2b['count']=_0x957dbb;if(_0x6067ca['query']['includeAll']){_0x21d529['include']=[{'all':!![]}];}return db[_0xe0c6('0x30')][_0xe0c6('0x43')](_0x21d529);})[_0xe0c6('0x28')](function(_0x204159){_0x49bf2b[_0xe0c6('0x44')]=_0x204159;return _0x49bf2b;})['then'](respondWithFilteredResult(_0x577732,_0x21d529))[_0xe0c6('0x45')](handleError(_0x577732,null));};exports[_0xe0c6('0x46')]=function(_0x3d56cc,_0x29abe7){var _0x460237={'raw':!![],'where':{'id':_0x3d56cc['params']['id']}},_0x283926={};_0x283926['model']=_[_0xe0c6('0x36')](db[_0xe0c6('0x30')][_0xe0c6('0x31')]);_0x283926[_0xe0c6('0x35')]=_[_0xe0c6('0x36')](_0x3d56cc[_0xe0c6('0x35')]);_0x283926[_0xe0c6('0x47')]=_[_0xe0c6('0x39')](_0x283926[_0xe0c6('0x37')],_0x283926[_0xe0c6('0x35')]);_0x460237[_0xe0c6('0x38')]=_[_0xe0c6('0x39')](_0x283926['model'],qs[_0xe0c6('0x3a')](_0x3d56cc[_0xe0c6('0x35')][_0xe0c6('0x3a')]));_0x460237[_0xe0c6('0x38')]=_0x460237[_0xe0c6('0x38')][_0xe0c6('0x3b')]?_0x460237[_0xe0c6('0x38')]:_0x283926[_0xe0c6('0x37')];if(_0x3d56cc[_0xe0c6('0x35')][_0xe0c6('0x48')]){_0x460237[_0xe0c6('0x49')]=[{'all':!![]}];}_0x460237=_[_0xe0c6('0x41')]({},_0x460237,_0x3d56cc[_0xe0c6('0x4a')]);return db['Interval'][_0xe0c6('0x4b')](_0x460237)[_0xe0c6('0x28')](handleEntityNotFound(_0x29abe7,null))[_0xe0c6('0x28')](respondWithResult(_0x29abe7,null))['catch'](handleError(_0x29abe7,null));};exports[_0xe0c6('0x4c')]=function(_0x28d14c,_0x4e06bc){return db['Interval'][_0xe0c6('0x4c')](_0x28d14c[_0xe0c6('0x4d')],{})['then'](function(_0x175c0a){var _0x1dcd0e=_0x28d14c[_0xe0c6('0x4e')][_0xe0c6('0x4f')]({'plain':!![]});if(!_0x1dcd0e)throw new Error(_0xe0c6('0x50'));if(_0x1dcd0e[_0xe0c6('0x51')]===_0xe0c6('0x4e')){var _0x252ad9=_0x175c0a[_0xe0c6('0x4f')]({'plain':!![]});var _0x1e8067=_0xe0c6('0x52');return db[_0xe0c6('0x53')]['find']({'where':{'name':_0x1e8067,'userProfileId':_0x1dcd0e['userProfileId']},'raw':!![]})[_0xe0c6('0x28')](function(_0x5cfdaa){if(_0x5cfdaa&&_0x5cfdaa['autoAssociation']===0x0){return db[_0xe0c6('0x54')][_0xe0c6('0x4c')]({'name':_0x252ad9['name'],'resourceId':_0x252ad9['id'],'type':_0x5cfdaa['name'],'sectionId':_0x5cfdaa['id']},{})[_0xe0c6('0x28')](function(){return _0x175c0a;});}else{return _0x175c0a;}})[_0xe0c6('0x45')](function(_0x21b368){logger[_0xe0c6('0x2a')](_0xe0c6('0x55'),_0x21b368);throw _0x21b368;});}return _0x175c0a;})[_0xe0c6('0x28')](respondWithResult(_0x4e06bc,0xc9))[_0xe0c6('0x45')](handleError(_0x4e06bc,null));};exports['update']=function(_0x5584b0,_0x75f195){if(_0x5584b0[_0xe0c6('0x4d')]['id']){delete _0x5584b0[_0xe0c6('0x4d')]['id'];}return db[_0xe0c6('0x30')][_0xe0c6('0x4b')]({'where':{'id':_0x5584b0[_0xe0c6('0x56')]['id']}})[_0xe0c6('0x28')](handleEntityNotFound(_0x75f195,null))[_0xe0c6('0x28')](saveUpdates(_0x5584b0['body'],null))[_0xe0c6('0x28')](respondWithResult(_0x75f195,null))[_0xe0c6('0x45')](handleError(_0x75f195,null));};exports['destroy']=function(_0x47df29,_0x32de2d){return db[_0xe0c6('0x30')][_0xe0c6('0x4b')]({'where':{'id':_0x47df29[_0xe0c6('0x56')]['id']}})[_0xe0c6('0x28')](handleEntityNotFound(_0x32de2d,null))[_0xe0c6('0x28')](removeEntity(_0x32de2d,null))['catch'](handleError(_0x32de2d,null));};exports[_0xe0c6('0x57')]=function(_0x518de8,_0x40a3be,_0x4ea71e){if(_0x518de8[_0xe0c6('0x4d')]['id']){delete _0x518de8[_0xe0c6('0x4d')]['id'];}return db['Interval'][_0xe0c6('0x4b')]({'where':{'id':_0x518de8[_0xe0c6('0x56')]['id']}})[_0xe0c6('0x28')](handleEntityNotFound(_0x40a3be,null))[_0xe0c6('0x28')](function(_0x24fdd2){if(_0x24fdd2){_0x518de8[_0xe0c6('0x4d')][_0xe0c6('0x58')]=_0x24fdd2['id'];return db[_0xe0c6('0x30')][_0xe0c6('0x4c')](_0x518de8[_0xe0c6('0x4d')]);}})[_0xe0c6('0x28')](respondWithResult(_0x40a3be,null))[_0xe0c6('0x45')](handleError(_0x40a3be,null));};exports[_0xe0c6('0x59')]=function(_0x4eb52b,_0x4a3534,_0x4e6351){var _0xfb772={};var _0x343823={};var _0x22c82b;var _0x1536fa;return db['Interval'][_0xe0c6('0x5a')]({'where':{'id':_0x4eb52b[_0xe0c6('0x56')]['id']}})['then'](handleEntityNotFound(_0x4a3534,null))['then'](function(_0xab666a){if(_0xab666a){_0x22c82b=_0xab666a;_0x343823[_0xe0c6('0x37')]=_[_0xe0c6('0x36')](db[_0xe0c6('0x30')][_0xe0c6('0x31')]);_0x343823[_0xe0c6('0x35')]=_[_0xe0c6('0x36')](_0x4eb52b[_0xe0c6('0x35')]);_0x343823[_0xe0c6('0x47')]=_[_0xe0c6('0x39')](_0x343823[_0xe0c6('0x37')],_0x343823[_0xe0c6('0x35')]);_0xfb772['attributes']=_[_0xe0c6('0x39')](_0x343823[_0xe0c6('0x37')],qs[_0xe0c6('0x3a')](_0x4eb52b[_0xe0c6('0x35')][_0xe0c6('0x3a')]));_0xfb772['attributes']=_0xfb772[_0xe0c6('0x38')][_0xe0c6('0x3b')]?_0xfb772[_0xe0c6('0x38')]:_0x343823[_0xe0c6('0x37')];_0xfb772['order']=qs[_0xe0c6('0x3f')](_0x4eb52b[_0xe0c6('0x35')]['sort']);_0xfb772[_0xe0c6('0x40')]=qs[_0xe0c6('0x47')](_[_0xe0c6('0x5b')](_0x4eb52b['query'],_0x343823['filters']));if(_0x4eb52b[_0xe0c6('0x35')][_0xe0c6('0x42')]){_0xfb772[_0xe0c6('0x40')]=_[_0xe0c6('0x41')](_0xfb772[_0xe0c6('0x40')],{'$or':_[_0xe0c6('0x2f')](_0xfb772['attributes'],function(_0x264bf0){var _0x292bb1={};_0x292bb1[_0x264bf0]={'$like':'%'+_0x4eb52b[_0xe0c6('0x35')]['filter']+'%'};return _0x292bb1;})});}_0xfb772=_[_0xe0c6('0x41')]({},_0xfb772,_0x4eb52b[_0xe0c6('0x4a')]);return _0x22c82b['getIntervals'](_0xfb772);}})[_0xe0c6('0x28')](function(_0x24736a){if(_0x24736a){_0x1536fa=_0x24736a[_0xe0c6('0x3b')];if(!_0x4eb52b[_0xe0c6('0x35')][_0xe0c6('0x3c')](_0xe0c6('0x3d'))){_0xfb772[_0xe0c6('0x1f')]=qs[_0xe0c6('0x1f')](_0x4eb52b['query'][_0xe0c6('0x1f')]);_0xfb772['offset']=qs['offset'](_0x4eb52b['query'][_0xe0c6('0x1e')]);}return _0x22c82b[_0xe0c6('0x59')](_0xfb772);}})[_0xe0c6('0x28')](function(_0x3ff9be){if(_0x3ff9be){return _0x3ff9be?{'count':_0x1536fa,'rows':_0x3ff9be}:null;}})[_0xe0c6('0x28')](respondWithResult(_0x4a3534,null))[_0xe0c6('0x45')](handleError(_0x4a3534,null));};exports[_0xe0c6('0x5c')]=function(_0x1b8541,_0x4a98a1,_0x34bda8){return db[_0xe0c6('0x30')][_0xe0c6('0x5a')]({'where':{'id':_0x1b8541[_0xe0c6('0x56')]['id']}})[_0xe0c6('0x28')](handleEntityNotFound(_0x4a98a1,null))[_0xe0c6('0x28')](function(_0x59427f){if(_0x59427f){return db[_0xe0c6('0x5d')]['transaction'](function(_0x221895){return db['Interval'][_0xe0c6('0x29')]({'where':{'IntervalId':_0x1b8541[_0xe0c6('0x56')]['id']},'transaction':_0x221895})[_0xe0c6('0x28')](function(_0xd18997){var _0x1f1a06=_[_0xe0c6('0x2f')](_0x1b8541[_0xe0c6('0x4d')],function(_0x11e2e9){delete _0x11e2e9['id'];_0x11e2e9[_0xe0c6('0x58')]=_0x1b8541[_0xe0c6('0x56')]['id'];return _0x11e2e9;});return db['Interval'][_0xe0c6('0x5e')](_0x1f1a06,{'transaction':_0x221895});});})[_0xe0c6('0x28')](function(){return db[_0xe0c6('0x30')][_0xe0c6('0x43')]({'where':{'IntervalId':_0x1b8541[_0xe0c6('0x56')]['id']}});});}})[_0xe0c6('0x28')](respondWithResult(_0x4a98a1,null))[_0xe0c6('0x45')](handleError(_0x4a98a1,null));}; \ No newline at end of file +var _0x481a=['count','set','Content-Range','json','reject','save','update','destroy','then','get','Intervals','UserProfileResource','sendStatus','error','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit'];(function(_0xbdddd3,_0x1135ef){var _0x337d9a=function(_0x48c825){while(--_0x48c825){_0xbdddd3['push'](_0xbdddd3['shift']());}};_0x337d9a(++_0x1135ef);}(_0x481a,0x9b));var _0xa481=function(_0x48cccb,_0x388a7b){_0x48cccb=_0x48cccb-0x0;var _0x289d40=_0x481a[_0x48cccb];return _0x289d40;};'use strict';var emlformat=require(_0xa481('0x0'));var rimraf=require(_0xa481('0x1'));var zipdir=require(_0xa481('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa481('0x3'));var moment=require(_0xa481('0x4'));var BPromise=require(_0xa481('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa481('0x6'));var sox=require(_0xa481('0x7'));var csv=require(_0xa481('0x8'));var ejs=require(_0xa481('0x9'));var fs=require('fs');var fs_extra=require(_0xa481('0xa'));var _=require(_0xa481('0xb'));var squel=require('squel');var crypto=require(_0xa481('0xc'));var jsforce=require(_0xa481('0xd'));var deskjs=require(_0xa481('0xe'));var toCsv=require(_0xa481('0x8'));var querystring=require('querystring');var Papa=require(_0xa481('0xf'));var Redis=require(_0xa481('0x10'));var authService=require(_0xa481('0x11'));var qs=require(_0xa481('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa481('0x13'));var logger=require(_0xa481('0x14'))(_0xa481('0x15'));var utils=require(_0xa481('0x16'));var config=require(_0xa481('0x17'));var licenseUtil=require(_0xa481('0x18'));var db=require(_0xa481('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x22274f,_0x2e8b7f){_0x2e8b7f=_0x2e8b7f||0xcc;return function(_0x4907d8){if(_0x4907d8){return _0x22274f['sendStatus'](_0x2e8b7f);}return _0x22274f[_0xa481('0x1a')](_0x2e8b7f)[_0xa481('0x1b')]();};}function respondWithResult(_0x4d42fe,_0x146276){_0x146276=_0x146276||0xc8;return function(_0x5df19b){if(_0x5df19b){return _0x4d42fe[_0xa481('0x1a')](_0x146276)['json'](_0x5df19b);}};}function respondWithFilteredResult(_0x1d7474,_0x775c87){return function(_0x5ba128){if(_0x5ba128){var _0x3dbc90=typeof _0x775c87[_0xa481('0x1c')]===_0xa481('0x1d')&&typeof _0x775c87[_0xa481('0x1e')]===_0xa481('0x1d');var _0x370199=_0x5ba128[_0xa481('0x1f')];var _0x5b67b7=_0x3dbc90?0x0:_0x775c87[_0xa481('0x1c')];var _0x1b9c9a=_0x3dbc90?_0x5ba128[_0xa481('0x1f')]:_0x775c87[_0xa481('0x1c')]+_0x775c87[_0xa481('0x1e')];var _0x53e015;if(_0x1b9c9a>=_0x370199){_0x1b9c9a=_0x370199;_0x53e015=0xc8;}else{_0x53e015=0xce;}_0x1d7474[_0xa481('0x1a')](_0x53e015);return _0x1d7474[_0xa481('0x20')](_0xa481('0x21'),_0x5b67b7+'-'+_0x1b9c9a+'/'+_0x370199)[_0xa481('0x22')](_0x5ba128);}return null;};}function patchUpdates(_0x25d258){return function(_0x57e6ce){try{jsonpatch['apply'](_0x57e6ce,_0x25d258,!![]);}catch(_0x1b83be){return BPromise[_0xa481('0x23')](_0x1b83be);}return _0x57e6ce[_0xa481('0x24')]();};}function saveUpdates(_0xd15622,_0x5379de){return function(_0x244d9f){if(_0x244d9f){return _0x244d9f[_0xa481('0x25')](_0xd15622)['then'](function(_0x1b214b){return _0x1b214b;});}return null;};}function removeEntity(_0x5f07b3,_0x556d33){return function(_0x3e53ee){if(_0x3e53ee){return _0x3e53ee[_0xa481('0x26')]()[_0xa481('0x27')](function(){var _0x8e258c=_0x3e53ee[_0xa481('0x28')]({'plain':!![]});var _0x101455=_0xa481('0x29');return db[_0xa481('0x2a')][_0xa481('0x26')]({'where':{'type':_0x101455,'resourceId':_0x8e258c['id']}})[_0xa481('0x27')](function(){return _0x3e53ee;});})[_0xa481('0x27')](function(){_0x5f07b3['status'](0xcc)[_0xa481('0x1b')]();});}};}function handleEntityNotFound(_0x1b48af,_0x43b63e){return function(_0x2e3247){if(!_0x2e3247){_0x1b48af[_0xa481('0x2b')](0x194);}return _0x2e3247;};}function handleError(_0x1d263c,_0x4d3a03){_0x4d3a03=_0x4d3a03||0x1f4;return function(_0x244391){logger[_0xa481('0x2c')](_0x244391['stack']);if(_0x244391[_0xa481('0x2d')]){delete _0x244391[_0xa481('0x2d')];}_0x1d263c[_0xa481('0x1a')](_0x4d3a03)['send'](_0x244391);};}exports[_0xa481('0x2e')]=function(_0x429372,_0x5e40e3){var _0x50bbb5={},_0x3473a0={},_0x2c4a67={'count':0x0,'rows':[]};var _0x40ec85=_[_0xa481('0x2f')](db[_0xa481('0x30')][_0xa481('0x31')],function(_0x299da9){return{'name':_0x299da9[_0xa481('0x32')],'type':_0x299da9[_0xa481('0x33')][_0xa481('0x34')]};});_0x3473a0[_0xa481('0x35')]=_[_0xa481('0x2f')](_0x40ec85,_0xa481('0x2d'));_0x3473a0[_0xa481('0x36')]=_['keys'](_0x429372[_0xa481('0x36')]);_0x3473a0[_0xa481('0x37')]=_[_0xa481('0x38')](_0x3473a0[_0xa481('0x35')],_0x3473a0[_0xa481('0x36')]);_0x50bbb5[_0xa481('0x39')]=_[_0xa481('0x38')](_0x3473a0[_0xa481('0x35')],qs[_0xa481('0x3a')](_0x429372[_0xa481('0x36')][_0xa481('0x3a')]));_0x50bbb5[_0xa481('0x39')]=_0x50bbb5['attributes'][_0xa481('0x3b')]?_0x50bbb5[_0xa481('0x39')]:_0x3473a0[_0xa481('0x35')];if(!_0x429372['query'][_0xa481('0x3c')](_0xa481('0x3d'))){_0x50bbb5['limit']=qs['limit'](_0x429372['query'][_0xa481('0x1e')]);_0x50bbb5[_0xa481('0x1c')]=qs['offset'](_0x429372['query'][_0xa481('0x1c')]);}_0x50bbb5['order']=qs[_0xa481('0x3e')](_0x429372[_0xa481('0x36')][_0xa481('0x3e')]);_0x50bbb5[_0xa481('0x3f')]=qs[_0xa481('0x37')](_[_0xa481('0x40')](_0x429372['query'],_0x3473a0['filters']),_0x40ec85);if(_0x429372[_0xa481('0x36')][_0xa481('0x41')]){_0x50bbb5[_0xa481('0x3f')]=_[_0xa481('0x42')](_0x50bbb5['where'],{'$or':_[_0xa481('0x2f')](_0x40ec85,function(_0x1ba98e){if(_0x1ba98e[_0xa481('0x33')]!=='VIRTUAL'){var _0x382ece={};_0x382ece[_0x1ba98e[_0xa481('0x2d')]]={'$like':'%'+_0x429372[_0xa481('0x36')][_0xa481('0x41')]+'%'};return _0x382ece;}})});}_0x50bbb5=_['merge']({},_0x50bbb5,_0x429372[_0xa481('0x43')]);var _0x4cbd19={'where':_0x50bbb5[_0xa481('0x3f')]};return db[_0xa481('0x30')][_0xa481('0x1f')](_0x4cbd19)['then'](function(_0x2b918e){_0x2c4a67[_0xa481('0x1f')]=_0x2b918e;if(_0x429372['query'][_0xa481('0x44')]){_0x50bbb5[_0xa481('0x45')]=[{'all':!![]}];}return db['Interval'][_0xa481('0x46')](_0x50bbb5);})['then'](function(_0xfcace2){_0x2c4a67[_0xa481('0x47')]=_0xfcace2;return _0x2c4a67;})[_0xa481('0x27')](respondWithFilteredResult(_0x5e40e3,_0x50bbb5))[_0xa481('0x48')](handleError(_0x5e40e3,null));};exports['show']=function(_0x21c248,_0x3fd547){var _0x3a9457={'raw':!![],'where':{'id':_0x21c248['params']['id']}},_0x31983c={};_0x31983c['model']=_['keys'](db[_0xa481('0x30')][_0xa481('0x31')]);_0x31983c[_0xa481('0x36')]=_[_0xa481('0x49')](_0x21c248[_0xa481('0x36')]);_0x31983c[_0xa481('0x37')]=_['intersection'](_0x31983c[_0xa481('0x35')],_0x31983c[_0xa481('0x36')]);_0x3a9457['attributes']=_[_0xa481('0x38')](_0x31983c[_0xa481('0x35')],qs['fields'](_0x21c248['query'][_0xa481('0x3a')]));_0x3a9457[_0xa481('0x39')]=_0x3a9457[_0xa481('0x39')]['length']?_0x3a9457['attributes']:_0x31983c['model'];if(_0x21c248['query'][_0xa481('0x44')]){_0x3a9457[_0xa481('0x45')]=[{'all':!![]}];}_0x3a9457=_[_0xa481('0x42')]({},_0x3a9457,_0x21c248[_0xa481('0x43')]);return db[_0xa481('0x30')]['find'](_0x3a9457)[_0xa481('0x27')](handleEntityNotFound(_0x3fd547,null))[_0xa481('0x27')](respondWithResult(_0x3fd547,null))[_0xa481('0x48')](handleError(_0x3fd547,null));};exports[_0xa481('0x4a')]=function(_0x35c336,_0x53c282){return db[_0xa481('0x30')][_0xa481('0x4a')](_0x35c336[_0xa481('0x4b')],{})[_0xa481('0x27')](function(_0x209f3b){var _0x1b9015=_0x35c336[_0xa481('0x4c')][_0xa481('0x28')]({'plain':!![]});if(!_0x1b9015)throw new Error(_0xa481('0x4d'));if(_0x1b9015[_0xa481('0x4e')]==='user'){var _0x316eef=_0x209f3b[_0xa481('0x28')]({'plain':!![]});var _0x7d7ead=_0xa481('0x29');return db[_0xa481('0x4f')][_0xa481('0x50')]({'where':{'name':_0x7d7ead,'userProfileId':_0x1b9015[_0xa481('0x51')]},'raw':!![]})[_0xa481('0x27')](function(_0x482bde){if(_0x482bde&&_0x482bde[_0xa481('0x52')]===0x0){return db[_0xa481('0x2a')][_0xa481('0x4a')]({'name':_0x316eef['name'],'resourceId':_0x316eef['id'],'type':_0x482bde[_0xa481('0x2d')],'sectionId':_0x482bde['id']},{})[_0xa481('0x27')](function(){return _0x209f3b;});}else{return _0x209f3b;}})[_0xa481('0x48')](function(_0x91c21e){logger[_0xa481('0x2c')](_0xa481('0x53'),_0x91c21e);throw _0x91c21e;});}return _0x209f3b;})['then'](respondWithResult(_0x53c282,0xc9))[_0xa481('0x48')](handleError(_0x53c282,null));};exports[_0xa481('0x25')]=function(_0x2a89c4,_0x3feeff){if(_0x2a89c4[_0xa481('0x4b')]['id']){delete _0x2a89c4[_0xa481('0x4b')]['id'];}return db['Interval'][_0xa481('0x50')]({'where':{'id':_0x2a89c4[_0xa481('0x54')]['id']}})[_0xa481('0x27')](handleEntityNotFound(_0x3feeff,null))['then'](saveUpdates(_0x2a89c4['body'],null))[_0xa481('0x27')](respondWithResult(_0x3feeff,null))['catch'](handleError(_0x3feeff,null));};exports[_0xa481('0x26')]=function(_0x21b657,_0x325f99){return db[_0xa481('0x30')][_0xa481('0x50')]({'where':{'id':_0x21b657[_0xa481('0x54')]['id']}})[_0xa481('0x27')](handleEntityNotFound(_0x325f99,null))[_0xa481('0x27')](removeEntity(_0x325f99,null))[_0xa481('0x48')](handleError(_0x325f99,null));};exports[_0xa481('0x55')]=function(_0x38db24,_0x59e51b,_0x46e4c3){if(_0x38db24[_0xa481('0x4b')]['id']){delete _0x38db24[_0xa481('0x4b')]['id'];}return db[_0xa481('0x30')][_0xa481('0x50')]({'where':{'id':_0x38db24[_0xa481('0x54')]['id']}})['then'](handleEntityNotFound(_0x59e51b,null))[_0xa481('0x27')](function(_0x1b11f3){if(_0x1b11f3){_0x38db24[_0xa481('0x4b')][_0xa481('0x56')]=_0x1b11f3['id'];return db[_0xa481('0x30')][_0xa481('0x4a')](_0x38db24[_0xa481('0x4b')]);}})['then'](respondWithResult(_0x59e51b,null))[_0xa481('0x48')](handleError(_0x59e51b,null));};exports[_0xa481('0x57')]=function(_0x433248,_0x4c4bb9,_0x2bd1db){var _0x4263b9={};var _0x6c54c3={};var _0x29909a;var _0x4ae12c;return db[_0xa481('0x30')][_0xa481('0x58')]({'where':{'id':_0x433248[_0xa481('0x54')]['id']}})[_0xa481('0x27')](handleEntityNotFound(_0x4c4bb9,null))[_0xa481('0x27')](function(_0x44ea01){if(_0x44ea01){_0x29909a=_0x44ea01;_0x6c54c3[_0xa481('0x35')]=_[_0xa481('0x49')](db[_0xa481('0x30')][_0xa481('0x31')]);_0x6c54c3[_0xa481('0x36')]=_[_0xa481('0x49')](_0x433248[_0xa481('0x36')]);_0x6c54c3[_0xa481('0x37')]=_[_0xa481('0x38')](_0x6c54c3[_0xa481('0x35')],_0x6c54c3['query']);_0x4263b9[_0xa481('0x39')]=_['intersection'](_0x6c54c3[_0xa481('0x35')],qs['fields'](_0x433248[_0xa481('0x36')][_0xa481('0x3a')]));_0x4263b9[_0xa481('0x39')]=_0x4263b9[_0xa481('0x39')][_0xa481('0x3b')]?_0x4263b9[_0xa481('0x39')]:_0x6c54c3[_0xa481('0x35')];_0x4263b9['order']=qs[_0xa481('0x3e')](_0x433248[_0xa481('0x36')][_0xa481('0x3e')]);_0x4263b9[_0xa481('0x3f')]=qs[_0xa481('0x37')](_[_0xa481('0x40')](_0x433248[_0xa481('0x36')],_0x6c54c3['filters']));if(_0x433248[_0xa481('0x36')][_0xa481('0x41')]){_0x4263b9[_0xa481('0x3f')]=_[_0xa481('0x42')](_0x4263b9[_0xa481('0x3f')],{'$or':_[_0xa481('0x2f')](_0x4263b9[_0xa481('0x39')],function(_0x3e65bd){var _0x3fc50b={};_0x3fc50b[_0x3e65bd]={'$like':'%'+_0x433248[_0xa481('0x36')]['filter']+'%'};return _0x3fc50b;})});}_0x4263b9=_[_0xa481('0x42')]({},_0x4263b9,_0x433248['options']);return _0x29909a[_0xa481('0x57')](_0x4263b9);}})['then'](function(_0x2ad1b1){if(_0x2ad1b1){_0x4ae12c=_0x2ad1b1[_0xa481('0x3b')];if(!_0x433248[_0xa481('0x36')]['hasOwnProperty'](_0xa481('0x3d'))){_0x4263b9['limit']=qs['limit'](_0x433248[_0xa481('0x36')][_0xa481('0x1e')]);_0x4263b9[_0xa481('0x1c')]=qs[_0xa481('0x1c')](_0x433248[_0xa481('0x36')]['offset']);}return _0x29909a['getIntervals'](_0x4263b9);}})[_0xa481('0x27')](function(_0x2e3802){if(_0x2e3802){return _0x2e3802?{'count':_0x4ae12c,'rows':_0x2e3802}:null;}})[_0xa481('0x27')](respondWithResult(_0x4c4bb9,null))['catch'](handleError(_0x4c4bb9,null));};exports[_0xa481('0x59')]=function(_0x3c5809,_0x3e64cc,_0x1911bc){return db['Interval']['findOne']({'where':{'id':_0x3c5809[_0xa481('0x54')]['id']}})[_0xa481('0x27')](handleEntityNotFound(_0x3e64cc,null))[_0xa481('0x27')](function(_0x19d00d){if(_0x19d00d){return db[_0xa481('0x5a')][_0xa481('0x5b')](function(_0x1011b2){return db[_0xa481('0x30')]['destroy']({'where':{'IntervalId':_0x3c5809[_0xa481('0x54')]['id']},'transaction':_0x1011b2})[_0xa481('0x27')](function(_0x2e5ee8){var _0x150494=_[_0xa481('0x2f')](_0x3c5809[_0xa481('0x4b')],function(_0x5341b4){delete _0x5341b4['id'];_0x5341b4['IntervalId']=_0x3c5809[_0xa481('0x54')]['id'];return _0x5341b4;});return db['Interval'][_0xa481('0x5c')](_0x150494,{'transaction':_0x1011b2});});})[_0xa481('0x27')](function(){return db['Interval'][_0xa481('0x46')]({'where':{'IntervalId':_0x3c5809[_0xa481('0x54')]['id']}});});}})['then'](respondWithResult(_0x3e64cc,null))[_0xa481('0x48')](handleError(_0x3e64cc,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index f4aa063..a192b18 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 _0x0ecf=['all','map','ifTime','reduce','exports','tools_intervals','rewrite','string','interval','getIntervals','then'];(function(_0x13f6ab,_0x40a309){var _0x441830=function(_0x50a7f9){while(--_0x50a7f9){_0x13f6ab['push'](_0x13f6ab['shift']());}};_0x441830(++_0x40a309);}(_0x0ecf,0x122));var _0xf0ec=function(_0x1993a9,_0x537562){_0x1993a9=_0x1993a9-0x0;var _0x4710fd=_0x0ecf[_0x1993a9];return _0x4710fd;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')['iftime'];module[_0xf0ec('0x0')]=function(_0x52ca46){return _0x52ca46['define']('Interval',attributes,{'tableName':_0xf0ec('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x374690){extensions['rewrite'](_0x52ca46,_0x374690);},'afterBulkCreate':function(_0x4946de,_0x1a74b7,_0x40f663){_0x40f663();extensions['rewrite'](_0x52ca46,_0x4946de[0x0]);},'afterUpdate':function(_0x3dc86e){extensions[_0xf0ec('0x2')](_0x52ca46,_0x3dc86e);},'afterDestroy':function(_0x1917b9){extensions[_0xf0ec('0x2')](_0x52ca46,_0x1917b9);}},'instanceMethods':{'ifTime':function(_0x12327c=undefined,_0x248a3c=new Date()){if(typeof this['interval']===_0xf0ec('0x3')){return iftime(this[_0xf0ec('0x4')],_0x12327c,_0x248a3c);}else{return this[_0xf0ec('0x5')]()[_0xf0ec('0x6')](function(_0x26d726){return Promise[_0xf0ec('0x7')](_0x26d726[_0xf0ec('0x8')](function(_0x5a9447){return _0x5a9447[_0xf0ec('0x9')](_0x12327c,_0x248a3c);}));})[_0xf0ec('0x6')](function(_0x579e28){return _0x579e28[_0xf0ec('0xa')](function(_0x4d1016,_0x3029dc){return _0x4d1016||_0x3029dc;},![]);});}}}});}; \ No newline at end of file +var _0xd747=['ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','define','Interval','tools_intervals','rewrite','interval','then','all','map'];(function(_0x4bf15a,_0x3066c5){var _0x205ba7=function(_0x509e23){while(--_0x509e23){_0x4bf15a['push'](_0x4bf15a['shift']());}};_0x205ba7(++_0x3066c5);}(_0xd747,0x13a));var _0x7d74=function(_0x4e409a,_0x1945a6){_0x4e409a=_0x4e409a-0x0;var _0x58bd54=_0xd747[_0x4e409a];return _0x58bd54;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x7d74('0x0'));var iftime=require(_0x7d74('0x1'))[_0x7d74('0x2')];module['exports']=function(_0x57287f){return _0x57287f[_0x7d74('0x3')](_0x7d74('0x4'),attributes,{'tableName':_0x7d74('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x572eb8){extensions[_0x7d74('0x6')](_0x57287f,_0x572eb8);},'afterBulkCreate':function(_0x1594b1,_0x118c07,_0x569a47){_0x569a47();extensions['rewrite'](_0x57287f,_0x1594b1[0x0]);},'afterUpdate':function(_0x1d3286){extensions['rewrite'](_0x57287f,_0x1d3286);},'afterDestroy':function(_0x473365){extensions[_0x7d74('0x6')](_0x57287f,_0x473365);}},'instanceMethods':{'ifTime':function(_0x48d639=undefined,_0x41e67c=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x7d74('0x7')],_0x48d639,_0x41e67c);}else{return this['getIntervals']()[_0x7d74('0x8')](function(_0x5deb10){return Promise[_0x7d74('0x9')](_0x5deb10[_0x7d74('0xa')](function(_0x10c958){return _0x10c958[_0x7d74('0xb')](_0x48d639,_0x41e67c);}));})[_0x7d74('0x8')](function(_0xd9d408){return _0xd9d408[_0x7d74('0xc')](function(_0x306ede,_0x512ba1){return _0x306ede||_0x512ba1;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5b2be7a..468b56e 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 _0x4f1e=['info','debug','stringify','message','error','ShowInterval','find','where','catch','then','all','ifTime','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','reduce','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','limit','include','attributes','model','map'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x4f1e,0x10a));var _0xe4f1=function(_0x20c240,_0x5c6b19){_0x20c240=_0x20c240-0x0;var _0x16dc99=_0x4f1e[_0x20c240];return _0x16dc99;};'use strict';var _=require('lodash');var util=require(_0xe4f1('0x0'));var db=require(_0xe4f1('0x1'))['db'];var iftime=require(_0xe4f1('0x2'))[_0xe4f1('0x3')];var logger=require(_0xe4f1('0x4'))(_0xe4f1('0x5'));exports[_0xe4f1('0x6')]=function(_0x351211){var _0x7c1dda=this;return new Promise(function(_0x5b4b2b,_0x155999){return db[_0xe4f1('0x7')][_0xe4f1('0x8')]({'raw':_0x351211[_0xe4f1('0x9')]?_0x351211[_0xe4f1('0x9')][_0xe4f1('0xa')]===undefined?!![]:![]:!![],'where':_0x351211[_0xe4f1('0x9')]?_0x351211[_0xe4f1('0x9')]['where']||null:null,'attributes':_0x351211[_0xe4f1('0x9')]?_0x351211[_0xe4f1('0x9')]['attributes']||null:null,'limit':_0x351211['options']?_0x351211['options'][_0xe4f1('0xb')]||null:null,'include':_0x351211[_0xe4f1('0x9')]?_0x351211[_0xe4f1('0x9')]['include']?_['map'](_0x351211[_0xe4f1('0x9')][_0xe4f1('0xc')],function(_0x465662){return{'model':db[_0x465662['model']],'as':_0x465662['as'],'attributes':_0x465662[_0xe4f1('0xd')],'include':_0x465662[_0xe4f1('0xc')]?_['map'](_0x465662[_0xe4f1('0xc')],function(_0x4548ad){return{'model':db[_0x4548ad[_0xe4f1('0xe')]],'as':_0x4548ad['as'],'attributes':_0x4548ad[_0xe4f1('0xd')],'include':_0x4548ad['include']?_[_0xe4f1('0xf')](_0x4548ad[_0xe4f1('0xc')],function(_0x401860){return{'model':db[_0x401860[_0xe4f1('0xe')]],'as':_0x401860['as'],'attributes':_0x401860['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x56cfad){logger[_0xe4f1('0x10')](_0xe4f1('0x6'),_0x351211);logger[_0xe4f1('0x11')]('GetInterval',_0x351211,JSON[_0xe4f1('0x12')](_0x56cfad));_0x5b4b2b(_0x56cfad);})['catch'](function(_0x1eb381){logger['error']('GetInterval',_0x1eb381[_0xe4f1('0x13')],_0x351211);_0x155999(_0x7c1dda[_0xe4f1('0x14')](0x1f4,_0x1eb381[_0xe4f1('0x13')]));});});};exports[_0xe4f1('0x15')]=function(_0x5df6e3){var _0x39ec5c=this;return new Promise(function(_0x2abaff,_0x9a1c28){return db[_0xe4f1('0x7')][_0xe4f1('0x16')]({'raw':_0x5df6e3[_0xe4f1('0x9')]?_0x5df6e3[_0xe4f1('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x5df6e3[_0xe4f1('0x9')]?_0x5df6e3[_0xe4f1('0x9')][_0xe4f1('0x17')]||null:null,'attributes':_0x5df6e3[_0xe4f1('0x9')]?_0x5df6e3['options']['attributes']||null:null,'include':_0x5df6e3[_0xe4f1('0x9')]?_0x5df6e3[_0xe4f1('0x9')]['include']?_['map'](_0x5df6e3['options'][_0xe4f1('0xc')],function(_0x9c576f){return{'model':db[_0x9c576f[_0xe4f1('0xe')]],'as':_0x9c576f['as'],'attributes':_0x9c576f[_0xe4f1('0xd')],'include':_0x9c576f[_0xe4f1('0xc')]?_[_0xe4f1('0xf')](_0x9c576f[_0xe4f1('0xc')],function(_0x24aefe){return{'model':db[_0x24aefe[_0xe4f1('0xe')]],'as':_0x24aefe['as'],'attributes':_0x24aefe[_0xe4f1('0xd')],'include':_0x24aefe['include']?_[_0xe4f1('0xf')](_0x24aefe[_0xe4f1('0xc')],function(_0x47b91d){return{'model':db[_0x47b91d[_0xe4f1('0xe')]],'as':_0x47b91d['as'],'attributes':_0x47b91d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59f578){logger[_0xe4f1('0x10')](_0xe4f1('0x15'),_0x5df6e3);logger[_0xe4f1('0x11')](_0xe4f1('0x15'),_0x5df6e3,JSON[_0xe4f1('0x12')](_0x59f578));_0x2abaff(_0x59f578);})[_0xe4f1('0x18')](function(_0x45b9f8){logger[_0xe4f1('0x14')](_0xe4f1('0x15'),_0x45b9f8[_0xe4f1('0x13')],_0x5df6e3);_0x9a1c28(_0x39ec5c['error'](0x1f4,_0x45b9f8[_0xe4f1('0x13')]));});});};function checkArrayOfIntervals(_0xce8a62,_0x4980b6){var _0x372cef=[];return db[_0xe4f1('0x7')][_0xe4f1('0x8')]({'where':{'id':_0xce8a62}})[_0xe4f1('0x19')](function(_0x371a52){_0x372cef=_0x371a52;return Promise[_0xe4f1('0x1a')](_0x372cef[_0xe4f1('0xf')](function(_0x28a1df){return _0x28a1df[_0xe4f1('0x1b')](_0x4980b6);}));})['then'](function(_0x241a47){var _0x34e9e0=_0x241a47['reduce'](function(_0x49697e,_0x1fbde4){return _0x49697e||_0x1fbde4;},![]);logger[_0xe4f1('0x10')](util['format'](_0xe4f1('0x1c'),_0x372cef[_0xe4f1('0xf')](function(_0x328528){return _0x328528['name'];})[_0xe4f1('0x1d')](',\x20'),_0x372cef[_0xe4f1('0xf')](function(_0xb26f9f){return _0xb26f9f['id'];})[_0xe4f1('0x1d')](',\x20')));return _0x34e9e0;});}function checkSingleInterval(_0x541274,_0x4772ea){return db['Interval'][_0xe4f1('0x1e')](_0x541274)[_0xe4f1('0x19')](function(_0x247b95){if(_0x247b95){logger[_0xe4f1('0x10')](util[_0xe4f1('0x1f')](_0xe4f1('0x20'),_0x247b95[_0xe4f1('0x21')],_0x247b95['id']));return _0x247b95[_0xe4f1('0x1b')](_0x4772ea);}});}exports[_0xe4f1('0x22')]=function(_0x1388c1){var _0x226a17=_0x1388c1[_0xe4f1('0x23')];var _0x2bfc1b=Array[_0xe4f1('0x24')](_0x1388c1['intervals'])?_0x1388c1[_0xe4f1('0x25')]:typeof _0x1388c1[_0xe4f1('0x25')]===_0xe4f1('0x26')?[_0x1388c1[_0xe4f1('0x25')]]:[];var _0x179e6c=_0x1388c1[_0xe4f1('0x27')]||undefined;var _0x23edff=![];if(_0x2bfc1b[_0xe4f1('0x28')]){logger[_0xe4f1('0x10')](util[_0xe4f1('0x1f')](_0xe4f1('0x29'),_0x2bfc1b['join'](';\x20')));}if(_0x179e6c){logger[_0xe4f1('0x10')](util['format'](_0xe4f1('0x2a'),_0x179e6c));}logger[_0xe4f1('0x11')](_0xe4f1('0x2b'),_0x23edff);logger[_0xe4f1('0x2c')](_0xe4f1('0x22'),_0x1388c1);return Promise[_0xe4f1('0x2d')]()['then'](function(){if(Array[_0xe4f1('0x24')](_0x226a17)){return checkArrayOfIntervals(_0x226a17,_0x179e6c);}else if(_0x226a17){return checkSingleInterval(_0x226a17,_0x179e6c);}})[_0xe4f1('0x19')](function(_0x3de823){var _0x5bfa43=_0x2bfc1b[_0xe4f1('0x2e')](function(_0x32b0dc,_0x1e16eb){return _0x32b0dc||iftime(_0x1e16eb,_0x179e6c);},![]);_0x23edff=_0x3de823||_0x5bfa43;return _0x23edff;})['catch'](function(_0x197925){logger[_0xe4f1('0x14')](_0xe4f1('0x22'),_0x1388c1,_0x197925);throw this[_0xe4f1('0x14')](0x1f4,_0x197925[_0xe4f1('0x13')]);});}; \ No newline at end of file +var _0x0986=['ShowInterval','raw','where','debug','stringify','error','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','Interval','findAll','options','attributes','limit','model','include','map','then','info','GetInterval','catch','message'];(function(_0x443560,_0x535b96){var _0x4a147c=function(_0x1a2789){while(--_0x1a2789){_0x443560['push'](_0x443560['shift']());}};_0x4a147c(++_0x535b96);}(_0x0986,0x191));var _0x6098=function(_0x120a6d,_0x389203){_0x120a6d=_0x120a6d-0x0;var _0x2d5f97=_0x0986[_0x120a6d];return _0x2d5f97;};'use strict';var _=require(_0x6098('0x0'));var util=require(_0x6098('0x1'));var db=require(_0x6098('0x2'))['db'];var iftime=require(_0x6098('0x3'))[_0x6098('0x4')];var logger=require('../../config/logger')(_0x6098('0x5'));exports['GetInterval']=function(_0x23939f){var _0x3801f0=this;return new Promise(function(_0x426991,_0x3e4a39){return db[_0x6098('0x6')][_0x6098('0x7')]({'raw':_0x23939f['options']?_0x23939f[_0x6098('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x23939f[_0x6098('0x8')]?_0x23939f[_0x6098('0x8')]['where']||null:null,'attributes':_0x23939f[_0x6098('0x8')]?_0x23939f[_0x6098('0x8')][_0x6098('0x9')]||null:null,'limit':_0x23939f[_0x6098('0x8')]?_0x23939f[_0x6098('0x8')][_0x6098('0xa')]||null:null,'include':_0x23939f[_0x6098('0x8')]?_0x23939f[_0x6098('0x8')]['include']?_['map'](_0x23939f[_0x6098('0x8')]['include'],function(_0x37ce8a){return{'model':db[_0x37ce8a[_0x6098('0xb')]],'as':_0x37ce8a['as'],'attributes':_0x37ce8a[_0x6098('0x9')],'include':_0x37ce8a[_0x6098('0xc')]?_[_0x6098('0xd')](_0x37ce8a['include'],function(_0x48cb3a){return{'model':db[_0x48cb3a[_0x6098('0xb')]],'as':_0x48cb3a['as'],'attributes':_0x48cb3a[_0x6098('0x9')],'include':_0x48cb3a['include']?_['map'](_0x48cb3a[_0x6098('0xc')],function(_0x4fa67d){return{'model':db[_0x4fa67d[_0x6098('0xb')]],'as':_0x4fa67d['as'],'attributes':_0x4fa67d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6098('0xe')](function(_0x527f6d){logger[_0x6098('0xf')](_0x6098('0x10'),_0x23939f);logger['debug'](_0x6098('0x10'),_0x23939f,JSON['stringify'](_0x527f6d));_0x426991(_0x527f6d);})[_0x6098('0x11')](function(_0x36e162){logger['error'](_0x6098('0x10'),_0x36e162[_0x6098('0x12')],_0x23939f);_0x3e4a39(_0x3801f0['error'](0x1f4,_0x36e162['message']));});});};exports[_0x6098('0x13')]=function(_0x58a3c0){var _0x129539=this;return new Promise(function(_0x46583a,_0x3b3f9b){return db[_0x6098('0x6')]['find']({'raw':_0x58a3c0['options']?_0x58a3c0['options'][_0x6098('0x14')]===undefined?!![]:![]:!![],'where':_0x58a3c0[_0x6098('0x8')]?_0x58a3c0[_0x6098('0x8')][_0x6098('0x15')]||null:null,'attributes':_0x58a3c0[_0x6098('0x8')]?_0x58a3c0[_0x6098('0x8')][_0x6098('0x9')]||null:null,'include':_0x58a3c0[_0x6098('0x8')]?_0x58a3c0[_0x6098('0x8')]['include']?_[_0x6098('0xd')](_0x58a3c0[_0x6098('0x8')][_0x6098('0xc')],function(_0x37626c){return{'model':db[_0x37626c[_0x6098('0xb')]],'as':_0x37626c['as'],'attributes':_0x37626c[_0x6098('0x9')],'include':_0x37626c[_0x6098('0xc')]?_[_0x6098('0xd')](_0x37626c['include'],function(_0x52547f){return{'model':db[_0x52547f[_0x6098('0xb')]],'as':_0x52547f['as'],'attributes':_0x52547f[_0x6098('0x9')],'include':_0x52547f['include']?_[_0x6098('0xd')](_0x52547f['include'],function(_0xdeb0ca){return{'model':db[_0xdeb0ca[_0x6098('0xb')]],'as':_0xdeb0ca['as'],'attributes':_0xdeb0ca[_0x6098('0x9')]};}):[]};}):[]};}):[]:[]})[_0x6098('0xe')](function(_0x401607){logger[_0x6098('0xf')]('ShowInterval',_0x58a3c0);logger[_0x6098('0x16')](_0x6098('0x13'),_0x58a3c0,JSON[_0x6098('0x17')](_0x401607));_0x46583a(_0x401607);})[_0x6098('0x11')](function(_0x722cda){logger[_0x6098('0x18')](_0x6098('0x13'),_0x722cda[_0x6098('0x12')],_0x58a3c0);_0x3b3f9b(_0x129539[_0x6098('0x18')](0x1f4,_0x722cda['message']));});});};function checkArrayOfIntervals(_0xee2f98,_0x598643){var _0x16924e=[];return db[_0x6098('0x6')][_0x6098('0x7')]({'where':{'id':_0xee2f98}})[_0x6098('0xe')](function(_0x1cfceb){_0x16924e=_0x1cfceb;return Promise['all'](_0x16924e[_0x6098('0xd')](function(_0x199fce){return _0x199fce['ifTime'](_0x598643);}));})[_0x6098('0xe')](function(_0x37424a){var _0x59f734=_0x37424a[_0x6098('0x19')](function(_0x4786b5,_0x11527f){return _0x4786b5||_0x11527f;},![]);logger[_0x6098('0xf')](util['format'](_0x6098('0x1a'),_0x16924e['map'](function(_0x1f66a1){return _0x1f66a1[_0x6098('0x1b')];})[_0x6098('0x1c')](',\x20'),_0x16924e[_0x6098('0xd')](function(_0x4a8b2f){return _0x4a8b2f['id'];})[_0x6098('0x1c')](',\x20')));return _0x59f734;});}function checkSingleInterval(_0xd1c25b,_0x434e34){return db[_0x6098('0x6')]['findById'](_0xd1c25b)[_0x6098('0xe')](function(_0x3c6d60){if(_0x3c6d60){logger[_0x6098('0xf')](util[_0x6098('0x1d')](_0x6098('0x1e'),_0x3c6d60[_0x6098('0x1b')],_0x3c6d60['id']));return _0x3c6d60[_0x6098('0x1f')](_0x434e34);}});}exports['IntervalIftime']=function(_0x4b7979){var _0x27d250=_0x4b7979['intervalIds'];var _0x3da0e7=Array[_0x6098('0x20')](_0x4b7979['intervals'])?_0x4b7979[_0x6098('0x21')]:typeof _0x4b7979[_0x6098('0x21')]===_0x6098('0x22')?[_0x4b7979[_0x6098('0x21')]]:[];var _0x472d58=_0x4b7979[_0x6098('0x23')]||undefined;var _0x5335bf=![];if(_0x3da0e7[_0x6098('0x24')]){logger[_0x6098('0xf')](util[_0x6098('0x1d')](_0x6098('0x25'),_0x3da0e7['join'](';\x20')));}if(_0x472d58){logger[_0x6098('0xf')](util[_0x6098('0x1d')](_0x6098('0x26'),_0x472d58));}logger[_0x6098('0x16')](_0x6098('0x27'),_0x5335bf);logger[_0x6098('0x28')](_0x6098('0x29'),_0x4b7979);return Promise['resolve']()[_0x6098('0xe')](function(){if(Array[_0x6098('0x20')](_0x27d250)){return checkArrayOfIntervals(_0x27d250,_0x472d58);}else if(_0x27d250){return checkSingleInterval(_0x27d250,_0x472d58);}})[_0x6098('0xe')](function(_0x85a1d1){var _0x3588dc=_0x3da0e7[_0x6098('0x19')](function(_0x5abb08,_0x23eef0){return _0x5abb08||iftime(_0x23eef0,_0x472d58);},![]);_0x5335bf=_0x85a1d1||_0x3588dc;return _0x5335bf;})['catch'](function(_0x2a8b81){logger[_0x6098('0x18')]('IntervalIftime',_0x4b7979,_0x2a8b81);throw this[_0x6098('0x18')](0x1f4,_0x2a8b81[_0x6098('0x12')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 423ccc2..5d9bd23 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(_0x5c4abd,_0x19b28c){var _0x212f89=function(_0x401aca){while(--_0x401aca){_0x5c4abd['push'](_0x5c4abd['shift']());}};_0x212f89(++_0x19b28c);}(_0x2ef3,0xba));var _0x32ef=function(_0x48ea81,_0x2d9bcd){_0x48ea81=_0x48ea81-0x0;var _0x361299=_0x2ef3[_0x48ea81];return _0x361299;};'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(_0x183903,_0x2b47c2){var _0x58d0b4=function(_0x5269cd){while(--_0x5269cd){_0x183903['push'](_0x183903['shift']());}};_0x58d0b4(++_0x2b47c2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x52cb4a,_0x217996){_0x52cb4a=_0x52cb4a-0x0;var _0x2d84e7=_0x5f2f[_0x52cb4a];return _0x2d84e7;};'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 6f30498..6c77e0e 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 _0xd8ee=['x-forwarded-for','connection','socket','remoteAddress','body','bluebird','https','api','3eAmWpBVP0','summary','Report','fields','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','track.xcallymotion.com','POST','stringify','request','utf8','data','end','statusCode','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','headers'];(function(_0x5c38bf,_0xb70dfa){var _0x5a8a3b=function(_0x1fb3e2){while(--_0x1fb3e2){_0x5c38bf['push'](_0x5c38bf['shift']());}};_0x5a8a3b(++_0xb70dfa);}(_0xd8ee,0x12d));var _0xed8e=function(_0x2e8d02,_0x1aea36){_0x2e8d02=_0x2e8d02-0x0;var _0x462edc=_0xd8ee[_0x2e8d02];return _0x462edc;};'use strict';var BPromise=require(_0xed8e('0x0'));var https=require(_0xed8e('0x1'));var logger=require('../../config/logger')(_0xed8e('0x2'));var USERNAME='support';var PASSWORD=_0xed8e('0x3');function openIssue(_0x832bfb,_0x4d730c){var _0x487961={'fields':{'project':{'key':_0x832bfb['key']||'MOTGUI'},'summary':(_0x832bfb[_0xed8e('0x4')]||_0xed8e('0x5'))+'\x20from\x20'+_0x832bfb['ip'],'description':_0x832bfb['description']||JSON['stringify'](_0x832bfb),'issuetype':{'name':_0x832bfb['issuetype']||'Bug'}}};_0x487961[_0xed8e('0x6')]['customfield_11500']=_0x832bfb[_0xed8e('0x7')];_0x487961[_0xed8e('0x6')][_0xed8e('0x8')]=_0x832bfb[_0xed8e('0x9')];_0x487961[_0xed8e('0x6')][_0xed8e('0xa')]=_0x832bfb[_0xed8e('0xb')];_0x487961[_0xed8e('0x6')]['customfield_11503']=_0x832bfb[_0xed8e('0xc')];_0x487961['fields'][_0xed8e('0xd')]=_0x832bfb[_0xed8e('0xe')];_0x487961[_0xed8e('0x6')]['customfield_10102']=_0x832bfb['ip'];var _0x3b5607={'host':_0xed8e('0xf'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xed8e('0x10'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x58e24f=JSON[_0xed8e('0x11')](_0x487961);var _0x4123ab=https[_0xed8e('0x12')](_0x3b5607,function(_0x1e7e05){_0x1e7e05['setEncoding'](_0xed8e('0x13'));var _0x1ab3ee='';_0x1e7e05['on'](_0xed8e('0x14'),function(_0x18be25){_0x1ab3ee+=_0x18be25;});_0x1e7e05['on'](_0xed8e('0x15'),function(){if(_0x4d730c){return _0x4d730c['status'](_0x1e7e05[_0xed8e('0x16')])[_0xed8e('0x17')](JSON[_0xed8e('0x18')](_0x1ab3ee));}});});_0x4123ab['on'](_0xed8e('0x19'),function(_0x4d63a3){if(_0x4d730c){return _0x4d730c[_0xed8e('0x1a')](0x1f4)['json']({'errors':[{'message':_0xed8e('0x1b'),'type':_0xed8e('0x1c')}]});}});_0x4123ab['write'](_0x58e24f);_0x4123ab[_0xed8e('0x15')]();}exports[_0xed8e('0x1d')]=openIssue;exports[_0xed8e('0x1e')]=function(_0x1551fc,_0x3b40f0){_0x1551fc['body']['ip']=_0x1551fc[_0xed8e('0x1f')][_0xed8e('0x20')]||_0x1551fc[_0xed8e('0x21')]['remoteAddress']||_0x1551fc[_0xed8e('0x22')][_0xed8e('0x23')]||_0x1551fc[_0xed8e('0x21')][_0xed8e('0x22')][_0xed8e('0x23')];return openIssue(_0x1551fc[_0xed8e('0x24')],_0x3b40f0);}; \ No newline at end of file +var _0x367c=['summary','\x20from\x20','stringify','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','request','data','end','status','json','parse','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','api','support','key','MOTGUI'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x367c,0x142));var _0xc367=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x367c[_0x47e549];return _0x251374;};'use strict';var BPromise=require(_0xc367('0x0'));var https=require(_0xc367('0x1'));var logger=require('../../config/logger')(_0xc367('0x2'));var USERNAME=_0xc367('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x34a6ce,_0x16a0c7){var _0x3c762d={'fields':{'project':{'key':_0x34a6ce[_0xc367('0x4')]||_0xc367('0x5')},'summary':(_0x34a6ce[_0xc367('0x6')]||'Report')+_0xc367('0x7')+_0x34a6ce['ip'],'description':_0x34a6ce['description']||JSON[_0xc367('0x8')](_0x34a6ce),'issuetype':{'name':_0x34a6ce['issuetype']||'Bug'}}};_0x3c762d[_0xc367('0x9')][_0xc367('0xa')]=_0x34a6ce[_0xc367('0xb')];_0x3c762d['fields'][_0xc367('0xc')]=_0x34a6ce[_0xc367('0xd')];_0x3c762d['fields'][_0xc367('0xe')]=_0x34a6ce[_0xc367('0xf')];_0x3c762d[_0xc367('0x9')][_0xc367('0x10')]=_0x34a6ce[_0xc367('0x11')];_0x3c762d[_0xc367('0x9')]['customfield_11504']=_0x34a6ce[_0xc367('0x12')];_0x3c762d[_0xc367('0x9')][_0xc367('0x13')]=_0x34a6ce['ip'];var _0x5b3c6b={'host':_0xc367('0x14'),'port':0x1bb,'path':_0xc367('0x15'),'method':_0xc367('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xc367('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xc367('0x18')]('base64')}};var _0x467a7f=JSON[_0xc367('0x8')](_0x3c762d);var _0x6ed038=https[_0xc367('0x19')](_0x5b3c6b,function(_0x180af5){_0x180af5['setEncoding']('utf8');var _0x22b01b='';_0x180af5['on'](_0xc367('0x1a'),function(_0x2ca1e9){_0x22b01b+=_0x2ca1e9;});_0x180af5['on'](_0xc367('0x1b'),function(){if(_0x16a0c7){return _0x16a0c7[_0xc367('0x1c')](_0x180af5['statusCode'])[_0xc367('0x1d')](JSON[_0xc367('0x1e')](_0x22b01b));}});});_0x6ed038['on']('error',function(_0x25dfc7){if(_0x16a0c7){return _0x16a0c7['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xc367('0x1f')}]});}});_0x6ed038[_0xc367('0x20')](_0x467a7f);_0x6ed038[_0xc367('0x1b')]();}exports[_0xc367('0x21')]=openIssue;exports[_0xc367('0x22')]=function(_0x1d8ba9,_0x4cc305){_0x1d8ba9[_0xc367('0x23')]['ip']=_0x1d8ba9[_0xc367('0x24')][_0xc367('0x25')]||_0x1d8ba9['connection'][_0xc367('0x26')]||_0x1d8ba9[_0xc367('0x27')][_0xc367('0x26')]||_0x1d8ba9[_0xc367('0x28')]['socket'][_0xc367('0x26')];return openIssue(_0x1d8ba9[_0xc367('0x23')],_0x4cc305);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 35cfedb..cb6aace 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 _0xb43b=['../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x122a26,_0x41450c){var _0x4adcd8=function(_0x51c17b){while(--_0x51c17b){_0x122a26['push'](_0x122a26['shift']());}};_0x4adcd8(++_0x41450c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2a7e2,_0x4815df){_0x2a7e2=_0x2a7e2-0x0;var _0x4bf9ca=_0xb43b[_0x2a7e2];return _0x4bf9ca;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0x10')]('/',auth['isAuthenticated'](),controller[_0xbb43('0x11')]);router[_0xbb43('0x12')](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller[_0xbb43('0x13')]);router[_0xbb43('0x14')]('/:id',auth[_0xbb43('0xb')](),controller[_0xbb43('0x15')]);module['exports']=router; \ No newline at end of file +var _0xf4eb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','Router','../../components/interaction/service','../../config/environment'];(function(_0x3b78b7,_0x81e446){var _0x3d4c20=function(_0x50e1e0){while(--_0x50e1e0){_0x3b78b7['push'](_0x3b78b7['shift']());}};_0x3d4c20(++_0x81e446);}(_0xf4eb,0xec));var _0xbf4e=function(_0x146475,_0x194f6b){_0x146475=_0x146475-0x0;var _0x2d0a6b=_0xf4eb[_0x146475];return _0x2d0a6b;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/describe',auth[_0xbf4e('0x6')](),controller['describe']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router[_0xbf4e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['delete'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['destroy']);module[_0xbf4e('0xe')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 6c06e00..ecf89b9 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(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7a54,0x106));var _0x47a5=function(_0x45744d,_0x1a07ad){_0x45744d=_0x45744d-0x0;var _0x580905=_0x7a54[_0x45744d];return _0x580905;};'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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x5213f1,_0x203b1e){_0x5213f1=_0x5213f1-0x0;var _0x8e6807=_0x7a54[_0x5213f1];return _0x8e6807;};'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 b52691f..246f5d3 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 _0x6c32=['offset','limit','undefined','count','set','apply','update','then','destroy','error','send','index','map','fieldName','type','name','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0xbd1abd,_0x323cd8){var _0x106d27=function(_0x16142b){while(--_0x16142b){_0xbd1abd['push'](_0xbd1abd['shift']());}};_0x106d27(++_0x323cd8);}(_0x6c32,0xb5));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x26c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x26c3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26c3('0x2'));var moment=require('moment');var BPromise=require(_0x26c3('0x3'));var Mustache=require(_0x26c3('0x4'));var util=require('util');var path=require('path');var sox=require(_0x26c3('0x5'));var csv=require(_0x26c3('0x6'));var ejs=require(_0x26c3('0x7'));var fs=require('fs');var fs_extra=require(_0x26c3('0x8'));var _=require(_0x26c3('0x9'));var squel=require(_0x26c3('0xa'));var crypto=require(_0x26c3('0xb'));var jsforce=require(_0x26c3('0xc'));var deskjs=require(_0x26c3('0xd'));var toCsv=require(_0x26c3('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x26c3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x26c3('0xf'));var as=require(_0x26c3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26c3('0x11'))(_0x26c3('0x12'));var utils=require(_0x26c3('0x13'));var config=require(_0x26c3('0x14'));var licenseUtil=require(_0x26c3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41a6c2,_0x3be1d4){_0x3be1d4=_0x3be1d4||0xcc;return function(_0x3e00f4){if(_0x3e00f4){return _0x41a6c2[_0x26c3('0x16')](_0x3be1d4);}return _0x41a6c2[_0x26c3('0x17')](_0x3be1d4)[_0x26c3('0x18')]();};}function respondWithResult(_0x1a8ea5,_0x278214){_0x278214=_0x278214||0xc8;return function(_0x5443cd){if(_0x5443cd){return _0x1a8ea5['status'](_0x278214)[_0x26c3('0x19')](_0x5443cd);}};}function respondWithFilteredResult(_0xd612e7,_0xd2f9a7){return function(_0x2e8f6b){if(_0x2e8f6b){var _0xad4e1e=typeof _0xd2f9a7[_0x26c3('0x1a')]==='undefined'&&typeof _0xd2f9a7[_0x26c3('0x1b')]===_0x26c3('0x1c');var _0x4db301=_0x2e8f6b[_0x26c3('0x1d')];var _0x4de336=_0xad4e1e?0x0:_0xd2f9a7[_0x26c3('0x1a')];var _0x570b03=_0xad4e1e?_0x2e8f6b[_0x26c3('0x1d')]:_0xd2f9a7[_0x26c3('0x1a')]+_0xd2f9a7[_0x26c3('0x1b')];var _0x26ae49;if(_0x570b03>=_0x4db301){_0x570b03=_0x4db301;_0x26ae49=0xc8;}else{_0x26ae49=0xce;}_0xd612e7['status'](_0x26ae49);return _0xd612e7[_0x26c3('0x1e')]('Content-Range',_0x4de336+'-'+_0x570b03+'/'+_0x4db301)[_0x26c3('0x19')](_0x2e8f6b);}return null;};}function patchUpdates(_0x48ea4a){return function(_0x1c77e6){try{jsonpatch[_0x26c3('0x1f')](_0x1c77e6,_0x48ea4a,!![]);}catch(_0x8819f2){return BPromise['reject'](_0x8819f2);}return _0x1c77e6['save']();};}function saveUpdates(_0x524ac1,_0x25f771){return function(_0xba4076){if(_0xba4076){return _0xba4076[_0x26c3('0x20')](_0x524ac1)[_0x26c3('0x21')](function(_0x3db905){return _0x3db905;});}return null;};}function removeEntity(_0x582b5e,_0x39c6fb){return function(_0x4a5220){if(_0x4a5220){return _0x4a5220[_0x26c3('0x22')]()[_0x26c3('0x21')](function(){_0x582b5e[_0x26c3('0x17')](0xcc)[_0x26c3('0x18')]();});}};}function handleEntityNotFound(_0x3aa515,_0x37373c){return function(_0xf8aee0){if(!_0xf8aee0){_0x3aa515[_0x26c3('0x16')](0x194);}return _0xf8aee0;};}function handleError(_0xd14177,_0x3ab3d6){_0x3ab3d6=_0x3ab3d6||0x1f4;return function(_0x15380c){logger[_0x26c3('0x23')](_0x15380c['stack']);if(_0x15380c['name']){delete _0x15380c['name'];}_0xd14177[_0x26c3('0x17')](_0x3ab3d6)[_0x26c3('0x24')](_0x15380c);};}exports[_0x26c3('0x25')]=function(_0xa1cf3d,_0x31d3f4){var _0x48f0dd={},_0x3aa957={},_0x3ef628={'count':0x0,'rows':[]};var _0x150d1c=_[_0x26c3('0x26')](db['JscriptyAnswerReport']['rawAttributes'],function(_0xc900d2){return{'name':_0xc900d2[_0x26c3('0x27')],'type':_0xc900d2[_0x26c3('0x28')]['key']};});_0x3aa957['model']=_[_0x26c3('0x26')](_0x150d1c,_0x26c3('0x29'));_0x3aa957[_0x26c3('0x2a')]=_['keys'](_0xa1cf3d[_0x26c3('0x2a')]);_0x3aa957['filters']=_[_0x26c3('0x2b')](_0x3aa957['model'],_0x3aa957[_0x26c3('0x2a')]);_0x48f0dd['attributes']=_['intersection'](_0x3aa957[_0x26c3('0x2c')],qs[_0x26c3('0x2d')](_0xa1cf3d[_0x26c3('0x2a')][_0x26c3('0x2d')]));_0x48f0dd[_0x26c3('0x2e')]=_0x48f0dd[_0x26c3('0x2e')][_0x26c3('0x2f')]?_0x48f0dd['attributes']:_0x3aa957['model'];if(!_0xa1cf3d[_0x26c3('0x2a')][_0x26c3('0x30')]('nolimit')){_0x48f0dd[_0x26c3('0x1b')]=qs[_0x26c3('0x1b')](_0xa1cf3d[_0x26c3('0x2a')][_0x26c3('0x1b')]);_0x48f0dd['offset']=qs['offset'](_0xa1cf3d['query'][_0x26c3('0x1a')]);}_0x48f0dd[_0x26c3('0x31')]=qs[_0x26c3('0x32')](_0xa1cf3d[_0x26c3('0x2a')][_0x26c3('0x32')]);_0x48f0dd[_0x26c3('0x33')]=qs[_0x26c3('0x34')](_[_0x26c3('0x35')](_0xa1cf3d[_0x26c3('0x2a')],_0x3aa957[_0x26c3('0x34')]),_0x150d1c);if(_0xa1cf3d[_0x26c3('0x2a')][_0x26c3('0x36')]){_0x48f0dd[_0x26c3('0x33')]=_[_0x26c3('0x37')](_0x48f0dd[_0x26c3('0x33')],{'$or':_[_0x26c3('0x26')](_0x150d1c,function(_0x3de84e){if(_0x3de84e['type']!==_0x26c3('0x38')){var _0x304766={};_0x304766[_0x3de84e[_0x26c3('0x29')]]={'$like':'%'+_0xa1cf3d[_0x26c3('0x2a')]['filter']+'%'};return _0x304766;}})});}_0x48f0dd=_[_0x26c3('0x37')]({},_0x48f0dd,_0xa1cf3d[_0x26c3('0x39')]);var _0x36e291={'where':_0x48f0dd[_0x26c3('0x33')]};return db[_0x26c3('0x3a')][_0x26c3('0x1d')](_0x36e291)[_0x26c3('0x21')](function(_0x1f2a3d){_0x3ef628[_0x26c3('0x1d')]=_0x1f2a3d;if(_0xa1cf3d['query'][_0x26c3('0x3b')]){_0x48f0dd[_0x26c3('0x3c')]=[{'all':!![]}];}return db[_0x26c3('0x3a')][_0x26c3('0x3d')](_0x48f0dd);})[_0x26c3('0x21')](function(_0x5e5b7f){_0x3ef628[_0x26c3('0x3e')]=_0x5e5b7f;return _0x3ef628;})['then'](respondWithFilteredResult(_0x31d3f4,_0x48f0dd))[_0x26c3('0x3f')](handleError(_0x31d3f4,null));};exports['show']=function(_0x25f5ed,_0x2d69ac){var _0x26d8cf={'raw':!![],'where':{'id':_0x25f5ed[_0x26c3('0x40')]['id']}},_0x46f552={};_0x46f552[_0x26c3('0x2c')]=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x46f552[_0x26c3('0x2a')]=_['keys'](_0x25f5ed[_0x26c3('0x2a')]);_0x46f552['filters']=_[_0x26c3('0x2b')](_0x46f552[_0x26c3('0x2c')],_0x46f552[_0x26c3('0x2a')]);_0x26d8cf['attributes']=_[_0x26c3('0x2b')](_0x46f552['model'],qs[_0x26c3('0x2d')](_0x25f5ed[_0x26c3('0x2a')][_0x26c3('0x2d')]));_0x26d8cf[_0x26c3('0x2e')]=_0x26d8cf[_0x26c3('0x2e')][_0x26c3('0x2f')]?_0x26d8cf[_0x26c3('0x2e')]:_0x46f552[_0x26c3('0x2c')];if(_0x25f5ed[_0x26c3('0x2a')][_0x26c3('0x3b')]){_0x26d8cf[_0x26c3('0x3c')]=[{'all':!![]}];}_0x26d8cf=_[_0x26c3('0x37')]({},_0x26d8cf,_0x25f5ed[_0x26c3('0x39')]);return db[_0x26c3('0x3a')][_0x26c3('0x41')](_0x26d8cf)[_0x26c3('0x21')](handleEntityNotFound(_0x2d69ac,null))[_0x26c3('0x21')](respondWithResult(_0x2d69ac,null))[_0x26c3('0x3f')](handleError(_0x2d69ac,null));};exports[_0x26c3('0x42')]=function(_0x1bb4ac,_0x41ba28){return db[_0x26c3('0x3a')][_0x26c3('0x42')](_0x1bb4ac[_0x26c3('0x43')],{})[_0x26c3('0x21')](respondWithResult(_0x41ba28,0xc9))[_0x26c3('0x3f')](handleError(_0x41ba28,null));};exports[_0x26c3('0x20')]=function(_0x18349e,_0x22e31a){if(_0x18349e[_0x26c3('0x43')]['id']){delete _0x18349e[_0x26c3('0x43')]['id'];}return db[_0x26c3('0x3a')][_0x26c3('0x41')]({'where':{'id':_0x18349e['params']['id']}})[_0x26c3('0x21')](handleEntityNotFound(_0x22e31a,null))[_0x26c3('0x21')](saveUpdates(_0x18349e[_0x26c3('0x43')],null))['then'](respondWithResult(_0x22e31a,null))[_0x26c3('0x3f')](handleError(_0x22e31a,null));};exports[_0x26c3('0x22')]=function(_0x4262be,_0x6f844){return db['JscriptyAnswerReport'][_0x26c3('0x41')]({'where':{'id':_0x4262be[_0x26c3('0x40')]['id']}})[_0x26c3('0x21')](handleEntityNotFound(_0x6f844,null))[_0x26c3('0x21')](removeEntity(_0x6f844,null))[_0x26c3('0x3f')](handleError(_0x6f844,null));};exports[_0x26c3('0x44')]=function(_0x15a716,_0x4d6865){return db['JscriptyAnswerReport'][_0x26c3('0x44')]()[_0x26c3('0x21')](respondWithResult(_0x4d6865,null))['catch'](handleError(_0x4d6865,null));}; \ No newline at end of file +var _0x3c94=['then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','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','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x51dfdf,_0x13365c){var _0x2dba3d=function(_0x415a0d){while(--_0x415a0d){_0x51dfdf['push'](_0x51dfdf['shift']());}};_0x2dba3d(++_0x13365c);}(_0x3c94,0xcd));var _0x43c9=function(_0x593fa0,_0x23b388){_0x593fa0=_0x593fa0-0x0;var _0x452eee=_0x3c94[_0x593fa0];return _0x452eee;};'use strict';var emlformat=require(_0x43c9('0x0'));var rimraf=require(_0x43c9('0x1'));var zipdir=require(_0x43c9('0x2'));var jsonpatch=require(_0x43c9('0x3'));var rp=require(_0x43c9('0x4'));var moment=require(_0x43c9('0x5'));var BPromise=require(_0x43c9('0x6'));var Mustache=require(_0x43c9('0x7'));var util=require(_0x43c9('0x8'));var path=require(_0x43c9('0x9'));var sox=require(_0x43c9('0xa'));var csv=require(_0x43c9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43c9('0xc'));var _=require(_0x43c9('0xd'));var squel=require(_0x43c9('0xe'));var crypto=require(_0x43c9('0xf'));var jsforce=require(_0x43c9('0x10'));var deskjs=require(_0x43c9('0x11'));var toCsv=require(_0x43c9('0xb'));var querystring=require(_0x43c9('0x12'));var Papa=require(_0x43c9('0x13'));var Redis=require('ioredis');var authService=require(_0x43c9('0x14'));var qs=require(_0x43c9('0x15'));var as=require(_0x43c9('0x16'));var hardwareService=require(_0x43c9('0x17'));var logger=require(_0x43c9('0x18'))(_0x43c9('0x19'));var utils=require(_0x43c9('0x1a'));var config=require(_0x43c9('0x1b'));var licenseUtil=require(_0x43c9('0x1c'));var db=require(_0x43c9('0x1d'))['db'];function respondWithStatusCode(_0x62bb3b,_0x31faa1){_0x31faa1=_0x31faa1||0xcc;return function(_0x11fe24){if(_0x11fe24){return _0x62bb3b[_0x43c9('0x1e')](_0x31faa1);}return _0x62bb3b[_0x43c9('0x1f')](_0x31faa1)[_0x43c9('0x20')]();};}function respondWithResult(_0x275b2b,_0x569fa9){_0x569fa9=_0x569fa9||0xc8;return function(_0x37932f){if(_0x37932f){return _0x275b2b[_0x43c9('0x1f')](_0x569fa9)[_0x43c9('0x21')](_0x37932f);}};}function respondWithFilteredResult(_0xe02707,_0x3f908d){return function(_0x5cc1fa){if(_0x5cc1fa){var _0x549d3f=typeof _0x3f908d[_0x43c9('0x22')]===_0x43c9('0x23')&&typeof _0x3f908d[_0x43c9('0x24')]===_0x43c9('0x23');var _0x501856=_0x5cc1fa[_0x43c9('0x25')];var _0x1da149=_0x549d3f?0x0:_0x3f908d[_0x43c9('0x22')];var _0x22bf3d=_0x549d3f?_0x5cc1fa[_0x43c9('0x25')]:_0x3f908d[_0x43c9('0x22')]+_0x3f908d[_0x43c9('0x24')];var _0x1e3996;if(_0x22bf3d>=_0x501856){_0x22bf3d=_0x501856;_0x1e3996=0xc8;}else{_0x1e3996=0xce;}_0xe02707[_0x43c9('0x1f')](_0x1e3996);return _0xe02707[_0x43c9('0x26')](_0x43c9('0x27'),_0x1da149+'-'+_0x22bf3d+'/'+_0x501856)['json'](_0x5cc1fa);}return null;};}function patchUpdates(_0x39c6f1){return function(_0x772b71){try{jsonpatch[_0x43c9('0x28')](_0x772b71,_0x39c6f1,!![]);}catch(_0x4c2d7c){return BPromise[_0x43c9('0x29')](_0x4c2d7c);}return _0x772b71[_0x43c9('0x2a')]();};}function saveUpdates(_0x2ef8d9,_0x5705c6){return function(_0x28290a){if(_0x28290a){return _0x28290a[_0x43c9('0x2b')](_0x2ef8d9)[_0x43c9('0x2c')](function(_0x4d58d7){return _0x4d58d7;});}return null;};}function removeEntity(_0x4963d2,_0x2a40f4){return function(_0x3fd641){if(_0x3fd641){return _0x3fd641[_0x43c9('0x2d')]()['then'](function(){_0x4963d2[_0x43c9('0x1f')](0xcc)[_0x43c9('0x20')]();});}};}function handleEntityNotFound(_0x1e676a,_0x16fee9){return function(_0x2c69af){if(!_0x2c69af){_0x1e676a['sendStatus'](0x194);}return _0x2c69af;};}function handleError(_0x386078,_0x3b5c47){_0x3b5c47=_0x3b5c47||0x1f4;return function(_0x3910af){logger[_0x43c9('0x2e')](_0x3910af[_0x43c9('0x2f')]);if(_0x3910af[_0x43c9('0x30')]){delete _0x3910af[_0x43c9('0x30')];}_0x386078[_0x43c9('0x1f')](_0x3b5c47)[_0x43c9('0x31')](_0x3910af);};}exports[_0x43c9('0x32')]=function(_0x4eb970,_0x11e3c3){var _0x2cbfd7={},_0x15028c={},_0x519e2c={'count':0x0,'rows':[]};var _0x2c0ccc=_[_0x43c9('0x33')](db['JscriptyAnswerReport'][_0x43c9('0x34')],function(_0x497719){return{'name':_0x497719[_0x43c9('0x35')],'type':_0x497719[_0x43c9('0x36')][_0x43c9('0x37')]};});_0x15028c[_0x43c9('0x38')]=_['map'](_0x2c0ccc,_0x43c9('0x30'));_0x15028c[_0x43c9('0x39')]=_[_0x43c9('0x3a')](_0x4eb970['query']);_0x15028c[_0x43c9('0x3b')]=_['intersection'](_0x15028c[_0x43c9('0x38')],_0x15028c[_0x43c9('0x39')]);_0x2cbfd7[_0x43c9('0x3c')]=_[_0x43c9('0x3d')](_0x15028c['model'],qs[_0x43c9('0x3e')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x3e')]));_0x2cbfd7[_0x43c9('0x3c')]=_0x2cbfd7['attributes'][_0x43c9('0x3f')]?_0x2cbfd7[_0x43c9('0x3c')]:_0x15028c[_0x43c9('0x38')];if(!_0x4eb970[_0x43c9('0x39')][_0x43c9('0x40')](_0x43c9('0x41'))){_0x2cbfd7[_0x43c9('0x24')]=qs[_0x43c9('0x24')](_0x4eb970['query'][_0x43c9('0x24')]);_0x2cbfd7[_0x43c9('0x22')]=qs[_0x43c9('0x22')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x22')]);}_0x2cbfd7[_0x43c9('0x42')]=qs[_0x43c9('0x43')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x43')]);_0x2cbfd7['where']=qs[_0x43c9('0x3b')](_['pick'](_0x4eb970[_0x43c9('0x39')],_0x15028c[_0x43c9('0x3b')]),_0x2c0ccc);if(_0x4eb970[_0x43c9('0x39')][_0x43c9('0x44')]){_0x2cbfd7[_0x43c9('0x45')]=_[_0x43c9('0x46')](_0x2cbfd7[_0x43c9('0x45')],{'$or':_[_0x43c9('0x33')](_0x2c0ccc,function(_0x518bd3){if(_0x518bd3['type']!==_0x43c9('0x47')){var _0x2d63bd={};_0x2d63bd[_0x518bd3['name']]={'$like':'%'+_0x4eb970[_0x43c9('0x39')][_0x43c9('0x44')]+'%'};return _0x2d63bd;}})});}_0x2cbfd7=_[_0x43c9('0x46')]({},_0x2cbfd7,_0x4eb970['options']);var _0xb01a6e={'where':_0x2cbfd7[_0x43c9('0x45')]};return db[_0x43c9('0x48')][_0x43c9('0x25')](_0xb01a6e)[_0x43c9('0x2c')](function(_0x39601e){_0x519e2c[_0x43c9('0x25')]=_0x39601e;if(_0x4eb970[_0x43c9('0x39')][_0x43c9('0x49')]){_0x2cbfd7[_0x43c9('0x4a')]=[{'all':!![]}];}return db[_0x43c9('0x48')][_0x43c9('0x4b')](_0x2cbfd7);})['then'](function(_0x2d5dd5){_0x519e2c[_0x43c9('0x4c')]=_0x2d5dd5;return _0x519e2c;})[_0x43c9('0x2c')](respondWithFilteredResult(_0x11e3c3,_0x2cbfd7))[_0x43c9('0x4d')](handleError(_0x11e3c3,null));};exports['show']=function(_0xff891d,_0x66cac9){var _0x5ce14f={'raw':!![],'where':{'id':_0xff891d[_0x43c9('0x4e')]['id']}},_0x2a8f7d={};_0x2a8f7d[_0x43c9('0x38')]=_[_0x43c9('0x3a')](db[_0x43c9('0x48')][_0x43c9('0x34')]);_0x2a8f7d[_0x43c9('0x39')]=_[_0x43c9('0x3a')](_0xff891d[_0x43c9('0x39')]);_0x2a8f7d['filters']=_[_0x43c9('0x3d')](_0x2a8f7d['model'],_0x2a8f7d[_0x43c9('0x39')]);_0x5ce14f[_0x43c9('0x3c')]=_[_0x43c9('0x3d')](_0x2a8f7d[_0x43c9('0x38')],qs['fields'](_0xff891d[_0x43c9('0x39')][_0x43c9('0x3e')]));_0x5ce14f['attributes']=_0x5ce14f[_0x43c9('0x3c')][_0x43c9('0x3f')]?_0x5ce14f['attributes']:_0x2a8f7d[_0x43c9('0x38')];if(_0xff891d[_0x43c9('0x39')][_0x43c9('0x49')]){_0x5ce14f['include']=[{'all':!![]}];}_0x5ce14f=_[_0x43c9('0x46')]({},_0x5ce14f,_0xff891d['options']);return db['JscriptyAnswerReport'][_0x43c9('0x4f')](_0x5ce14f)[_0x43c9('0x2c')](handleEntityNotFound(_0x66cac9,null))[_0x43c9('0x2c')](respondWithResult(_0x66cac9,null))[_0x43c9('0x4d')](handleError(_0x66cac9,null));};exports[_0x43c9('0x50')]=function(_0x28fe5d,_0x1f966e){return db[_0x43c9('0x48')][_0x43c9('0x50')](_0x28fe5d[_0x43c9('0x51')],{})[_0x43c9('0x2c')](respondWithResult(_0x1f966e,0xc9))[_0x43c9('0x4d')](handleError(_0x1f966e,null));};exports[_0x43c9('0x2b')]=function(_0x5082e9,_0xc57086){if(_0x5082e9[_0x43c9('0x51')]['id']){delete _0x5082e9['body']['id'];}return db[_0x43c9('0x48')][_0x43c9('0x4f')]({'where':{'id':_0x5082e9[_0x43c9('0x4e')]['id']}})[_0x43c9('0x2c')](handleEntityNotFound(_0xc57086,null))[_0x43c9('0x2c')](saveUpdates(_0x5082e9[_0x43c9('0x51')],null))[_0x43c9('0x2c')](respondWithResult(_0xc57086,null))[_0x43c9('0x4d')](handleError(_0xc57086,null));};exports[_0x43c9('0x2d')]=function(_0x508b62,_0x27db89){return db[_0x43c9('0x48')][_0x43c9('0x4f')]({'where':{'id':_0x508b62[_0x43c9('0x4e')]['id']}})[_0x43c9('0x2c')](handleEntityNotFound(_0x27db89,null))[_0x43c9('0x2c')](removeEntity(_0x27db89,null))['catch'](handleError(_0x27db89,null));};exports[_0x43c9('0x52')]=function(_0x1bc3b5,_0x3aff2e){return db[_0x43c9('0x48')][_0x43c9('0x52')]()[_0x43c9('0x2c')](respondWithResult(_0x3aff2e,null))[_0x43c9('0x4d')](handleError(_0x3aff2e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index b7d47bb..3ac78f3 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 _0x78d6=['exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x43ff85,_0x1afd3b){var _0x4842eb=function(_0x2b8703){while(--_0x2b8703){_0x43ff85['push'](_0x43ff85['shift']());}};_0x4842eb(++_0x1afd3b);}(_0x78d6,0x122));var _0x678d=function(_0x443461,_0x18a5f3){_0x443461=_0x443461-0x0;var _0x1c7c6a=_0x78d6[_0x443461];return _0x1c7c6a;};'use strict';var _=require(_0x678d('0x0'));var util=require(_0x678d('0x1'));var logger=require(_0x678d('0x2'))(_0x678d('0x3'));var moment=require('moment');var BPromise=require(_0x678d('0x4'));var rp=require(_0x678d('0x5'));var fs=require('fs');var path=require(_0x678d('0x6'));var rimraf=require(_0x678d('0x7'));var config=require(_0x678d('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x678d('0x9')]=function(_0x1d97c3,_0x5d25c9){return _0x1d97c3[_0x678d('0xa')](_0x678d('0xb'),attributes,{'tableName':_0x678d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b68=['rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x32966b,_0x2e8b06){var _0xa91d0d=function(_0x1b0322){while(--_0x1b0322){_0x32966b['push'](_0x32966b['shift']());}};_0xa91d0d(++_0x2e8b06);}(_0x1b68,0xe4));var _0x81b6=function(_0xc641d4,_0x54b55b){_0xc641d4=_0xc641d4-0x0;var _0x4688a8=_0x1b68[_0xc641d4];return _0x4688a8;};'use strict';var _=require(_0x81b6('0x0'));var util=require('util');var logger=require(_0x81b6('0x1'))('api');var moment=require(_0x81b6('0x2'));var BPromise=require(_0x81b6('0x3'));var rp=require(_0x81b6('0x4'));var fs=require('fs');var path=require(_0x81b6('0x5'));var rimraf=require(_0x81b6('0x6'));var config=require(_0x81b6('0x7'));var attributes=require(_0x81b6('0x8'));module[_0x81b6('0x9')]=function(_0x2e19af,_0x53c7c0){return _0x2e19af[_0x81b6('0xa')](_0x81b6('0xb'),attributes,{'tableName':_0x81b6('0xc'),'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 f9161e3..a837c55 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 _0x5c41=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0x5c41,0x14b));var _0x15c4=function(_0x2c5d22,_0x85f6e7){_0x2c5d22=_0x2c5d22-0x0;var _0x30f9b5=_0x5c41[_0x2c5d22];return _0x30f9b5;};'use strict';var _=require('lodash');var util=require(_0x15c4('0x0'));var moment=require('moment');var BPromise=require(_0x15c4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15c4('0x2'));var db=require(_0x15c4('0x3'))['db'];var utils=require(_0x15c4('0x4'));var logger=require('../../config/logger')(_0x15c4('0x5'));var config=require('../../config/environment');var jayson=require(_0x15c4('0x6'));var client=jayson['client'][_0x15c4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x563982,_0x2773c3,_0x48b745){return new BPromise(function(_0x5d48c8,_0x67b6d6){return client[_0x15c4('0x8')](_0x563982,_0x48b745)[_0x15c4('0x9')](function(_0x3261da){logger[_0x15c4('0xa')](_0x15c4('0xb'),_0x2773c3,_0x15c4('0xc'));logger[_0x15c4('0xd')](_0x15c4('0xe'),_0x2773c3,_0x15c4('0xc'),JSON['stringify'](_0x3261da));if(_0x3261da['error']){if(_0x3261da[_0x15c4('0xf')]['code']===0x1f4){logger[_0x15c4('0xf')](_0x15c4('0xb'),_0x2773c3,_0x3261da[_0x15c4('0xf')][_0x15c4('0x10')]);return _0x67b6d6(_0x3261da[_0x15c4('0xf')]['message']);}logger['error'](_0x15c4('0xb'),_0x2773c3,_0x3261da[_0x15c4('0xf')][_0x15c4('0x10')]);return _0x5d48c8(_0x3261da[_0x15c4('0xf')][_0x15c4('0x10')]);}else{logger[_0x15c4('0xa')](_0x15c4('0xb'),_0x2773c3,_0x15c4('0xc'));_0x5d48c8(_0x3261da[_0x15c4('0x11')][_0x15c4('0x10')]);}})[_0x15c4('0x12')](function(_0x3b8d7c){logger[_0x15c4('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2773c3,_0x3b8d7c);_0x67b6d6(_0x3b8d7c);});});} \ No newline at end of file +var _0xf79e=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x36afce,_0x304587){var _0x3159f5=function(_0x1e4043){while(--_0x1e4043){_0x36afce['push'](_0x36afce['shift']());}};_0x3159f5(++_0x304587);}(_0xf79e,0x1ad));var _0xef79=function(_0x302650,_0x2238a5){_0x302650=_0x302650-0x0;var _0xfd6ab=_0xf79e[_0x302650];return _0xfd6ab;};'use strict';var _=require(_0xef79('0x0'));var util=require(_0xef79('0x1'));var moment=require(_0xef79('0x2'));var BPromise=require(_0xef79('0x3'));var rs=require(_0xef79('0x4'));var fs=require('fs');var Redis=require(_0xef79('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xef79('0x6'))(_0xef79('0x7'));var config=require(_0xef79('0x8'));var jayson=require(_0xef79('0x9'));var client=jayson['client'][_0xef79('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d85c2,_0x4cc9c0,_0x3433dc){return new BPromise(function(_0x37a786,_0xb7d73){return client['request'](_0x5d85c2,_0x3433dc)[_0xef79('0xb')](function(_0x5ee07b){logger['info'](_0xef79('0xc'),_0x4cc9c0,_0xef79('0xd'));logger['debug'](_0xef79('0xe'),_0x4cc9c0,_0xef79('0xd'),JSON[_0xef79('0xf')](_0x5ee07b));if(_0x5ee07b[_0xef79('0x10')]){if(_0x5ee07b[_0xef79('0x10')][_0xef79('0x11')]===0x1f4){logger[_0xef79('0x10')](_0xef79('0xc'),_0x4cc9c0,_0x5ee07b['error'][_0xef79('0x12')]);return _0xb7d73(_0x5ee07b[_0xef79('0x10')][_0xef79('0x12')]);}logger[_0xef79('0x10')](_0xef79('0xc'),_0x4cc9c0,_0x5ee07b[_0xef79('0x10')]['message']);return _0x37a786(_0x5ee07b[_0xef79('0x10')][_0xef79('0x12')]);}else{logger[_0xef79('0x13')](_0xef79('0xc'),_0x4cc9c0,'request\x20sent');_0x37a786(_0x5ee07b['result'][_0xef79('0x12')]);}})[_0xef79('0x14')](function(_0x1a603d){logger[_0xef79('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4cc9c0,_0x1a603d);_0xb7d73(_0x1a603d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d21b85e..3ce7756 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 _0xe9c2=['./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','clone','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x45d76a,_0x4ff681){var _0xa4caa9=function(_0xaa28de){while(--_0xaa28de){_0x45d76a['push'](_0x45d76a['shift']());}};_0xa4caa9(++_0x4ff681);}(_0xe9c2,0x107));var _0x2e9c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe9c2[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2e9c('0x0'));var util=require(_0x2e9c('0x1'));var path=require(_0x2e9c('0x2'));var timeout=require('connect-timeout');var express=require(_0x2e9c('0x3'));var router=express['Router']();var fs_extra=require(_0x2e9c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2e9c('0x5'));var config=require(_0x2e9c('0x6'));var controller=require(_0x2e9c('0x7'));router[_0x2e9c('0x8')]('/',auth[_0x2e9c('0x9')](),controller[_0x2e9c('0xa')]);router[_0x2e9c('0x8')]('/:id',auth[_0x2e9c('0x9')](),controller[_0x2e9c('0xb')]);router[_0x2e9c('0x8')](_0x2e9c('0xc'),auth[_0x2e9c('0x9')](),controller[_0x2e9c('0xd')]);router[_0x2e9c('0x8')](_0x2e9c('0xe'),auth[_0x2e9c('0x9')](),controller[_0x2e9c('0xf')]);router['get'](_0x2e9c('0x10'),auth[_0x2e9c('0x9')](),timeout('30s'),controller[_0x2e9c('0x11')]);router[_0x2e9c('0x12')]('/',auth['isAuthenticated'](),controller[_0x2e9c('0x13')]);router[_0x2e9c('0x12')]('/:id/clone',auth[_0x2e9c('0x9')](),controller[_0x2e9c('0x14')]);router[_0x2e9c('0x15')](_0x2e9c('0x16'),auth['isAuthenticated'](),controller[_0x2e9c('0x17')]);router[_0x2e9c('0x18')](_0x2e9c('0x16'),auth[_0x2e9c('0x9')](),controller[_0x2e9c('0x19')]);module[_0x2e9c('0x1a')]=router; \ No newline at end of file +var _0x38a6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','getSummary','create','/:id/clone','clone','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x26a388,_0x3a7182){var _0x10743a=function(_0x4d4aa2){while(--_0x4d4aa2){_0x26a388['push'](_0x26a388['shift']());}};_0x10743a(++_0x3a7182);}(_0x38a6,0xca));var _0x638a=function(_0x454f8e,_0x293a4d){_0x454f8e=_0x454f8e-0x0;var _0x5cdfd2=_0x38a6[_0x454f8e];return _0x5cdfd2;};'use strict';var multer=require(_0x638a('0x0'));var util=require(_0x638a('0x1'));var path=require('path');var timeout=require(_0x638a('0x2'));var express=require(_0x638a('0x3'));var router=express[_0x638a('0x4')]();var fs_extra=require(_0x638a('0x5'));var auth=require(_0x638a('0x6'));var interaction=require(_0x638a('0x7'));var config=require(_0x638a('0x8'));var controller=require(_0x638a('0x9'));router[_0x638a('0xa')]('/',auth[_0x638a('0xb')](),controller[_0x638a('0xc')]);router['get'](_0x638a('0xd'),auth['isAuthenticated'](),controller[_0x638a('0xe')]);router['get'](_0x638a('0xf'),auth[_0x638a('0xb')](),controller['getSessions']);router[_0x638a('0xa')](_0x638a('0x10'),auth[_0x638a('0xb')](),controller[_0x638a('0x11')]);router[_0x638a('0xa')](_0x638a('0x12'),auth[_0x638a('0xb')](),timeout('30s'),controller[_0x638a('0x13')]);router['post']('/',auth[_0x638a('0xb')](),controller[_0x638a('0x14')]);router['post'](_0x638a('0x15'),auth['isAuthenticated'](),controller[_0x638a('0x16')]);router['put'](_0x638a('0xd'),auth[_0x638a('0xb')](),controller[_0x638a('0x17')]);router[_0x638a('0x18')](_0x638a('0xd'),auth[_0x638a('0xb')](),controller[_0x638a('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 7acfc9d..0ebd88f 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 _0x8387=['sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x35fc3e,_0x5466ef){var _0x224766=function(_0x44e954){while(--_0x44e954){_0x35fc3e['push'](_0x35fc3e['shift']());}};_0x224766(++_0x5466ef);}(_0x8387,0xa0));var _0x7838=function(_0x33ac64,_0x40b2b0){_0x33ac64=_0x33ac64-0x0;var _0x2e3161=_0x8387[_0x33ac64];return _0x2e3161;};'use strict';var Sequelize=require(_0x7838('0x0'));var _=require(_0x7838('0x1'));var util=require(_0x7838('0x2'));module[_0x7838('0x3')]={'name':{'type':Sequelize[_0x7838('0x4')],'unique':_0x7838('0x5')},'description':{'type':Sequelize[_0x7838('0x4')]},'formData':{'type':Sequelize[_0x7838('0x6')](_0x7838('0x7')),'set':function(_0x1aaf41){if(_[_0x7838('0x8')](_0x1aaf41)){this[_0x7838('0x9')]('formData',JSON[_0x7838('0xa')](_0x1aaf41));}else if(_[_0x7838('0xb')](_0x1aaf41)){this['setDataValue']('formData',_0x1aaf41);}else{this[_0x7838('0x9')](_0x7838('0xc'),util[_0x7838('0xd')](_0x7838('0xe'),this['getDataValue'](_0x7838('0x5'))||'',this[_0x7838('0xf')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x36e0=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','sequelize','lodash','util','exports','STRING','name','TEXT','stringify','setDataValue','formData'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0x36e0,0x9f));var _0x036e=function(_0x5ee060,_0x5120d2){_0x5ee060=_0x5ee060-0x0;var _0x5b8fee=_0x36e0[_0x5ee060];return _0x5b8fee;};'use strict';var Sequelize=require(_0x036e('0x0'));var _=require(_0x036e('0x1'));var util=require(_0x036e('0x2'));module[_0x036e('0x3')]={'name':{'type':Sequelize[_0x036e('0x4')],'unique':_0x036e('0x5')},'description':{'type':Sequelize[_0x036e('0x4')]},'formData':{'type':Sequelize[_0x036e('0x6')]('long'),'set':function(_0x5e08a6){if(_['isObjectLike'](_0x5e08a6)){this['setDataValue']('formData',JSON[_0x036e('0x7')](_0x5e08a6));}else if(_['isString'](_0x5e08a6)){this[_0x036e('0x8')]('formData',_0x5e08a6);}else{this[_0x036e('0x8')](_0x036e('0x9'),util[_0x036e('0xa')](_0x036e('0xb'),this[_0x036e('0xc')](_0x036e('0x5'))||'',this[_0x036e('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 90fd88c..41cc43d 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 _0xbcff=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','include','catch','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','update','params','findOne','JscriptySessionReport','pick','ProjectId','options','findAll','rows','getAnswers','JscriptyAnswerReport','includeAll','number','fromCharCode','toString','indexOf','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','Projects','UserProfileResource','sendStatus','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','model'];(function(_0x4bb741,_0x4f7731){var _0x2abf7f=function(_0x47e5d5){while(--_0x47e5d5){_0x4bb741['push'](_0x4bb741['shift']());}};_0x2abf7f(++_0x4f7731);}(_0xbcff,0x12e));var _0xfbcf=function(_0x2bf6de,_0x26d883){_0x2bf6de=_0x2bf6de-0x0;var _0x3e6fe3=_0xbcff[_0x2bf6de];return _0x3e6fe3;};'use strict';var emlformat=require(_0xfbcf('0x0'));var rimraf=require(_0xfbcf('0x1'));var zipdir=require(_0xfbcf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbcf('0x3'));var moment=require(_0xfbcf('0x4'));var BPromise=require(_0xfbcf('0x5'));var Mustache=require('mustache');var util=require(_0xfbcf('0x6'));var path=require(_0xfbcf('0x7'));var sox=require(_0xfbcf('0x8'));var csv=require('to-csv');var ejs=require(_0xfbcf('0x9'));var fs=require('fs');var fs_extra=require(_0xfbcf('0xa'));var _=require('lodash');var squel=require(_0xfbcf('0xb'));var crypto=require(_0xfbcf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfbcf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfbcf('0xe'));var Papa=require(_0xfbcf('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfbcf('0x10'));var as=require(_0xfbcf('0x11'));var hardwareService=require(_0xfbcf('0x12'));var logger=require(_0xfbcf('0x13'))('api');var utils=require(_0xfbcf('0x14'));var config=require(_0xfbcf('0x15'));var licenseUtil=require(_0xfbcf('0x16'));var db=require(_0xfbcf('0x17'))['db'];function respondWithStatusCode(_0x223575,_0x195064){_0x195064=_0x195064||0xcc;return function(_0x1c7e87){if(_0x1c7e87){return _0x223575['sendStatus'](_0x195064);}return _0x223575[_0xfbcf('0x18')](_0x195064)['end']();};}function respondWithResult(_0x2de93a,_0x24e3aa){_0x24e3aa=_0x24e3aa||0xc8;return function(_0x29a27f){if(_0x29a27f){return _0x2de93a[_0xfbcf('0x18')](_0x24e3aa)[_0xfbcf('0x19')](_0x29a27f);}};}function respondWithFilteredResult(_0x7b75d7,_0x2cecc1){return function(_0x402fa4){if(_0x402fa4){var _0x27f2f1=typeof _0x2cecc1['offset']===_0xfbcf('0x1a')&&typeof _0x2cecc1[_0xfbcf('0x1b')]===_0xfbcf('0x1a');var _0x24013b=_0x402fa4[_0xfbcf('0x1c')];var _0x2994db=_0x27f2f1?0x0:_0x2cecc1[_0xfbcf('0x1d')];var _0x3b029c=_0x27f2f1?_0x402fa4[_0xfbcf('0x1c')]:_0x2cecc1[_0xfbcf('0x1d')]+_0x2cecc1[_0xfbcf('0x1b')];var _0x4b3485;if(_0x3b029c>=_0x24013b){_0x3b029c=_0x24013b;_0x4b3485=0xc8;}else{_0x4b3485=0xce;}_0x7b75d7[_0xfbcf('0x18')](_0x4b3485);return _0x7b75d7[_0xfbcf('0x1e')]('Content-Range',_0x2994db+'-'+_0x3b029c+'/'+_0x24013b)[_0xfbcf('0x19')](_0x402fa4);}return null;};}function patchUpdates(_0x1fbbef){return function(_0x4b3586){try{jsonpatch[_0xfbcf('0x1f')](_0x4b3586,_0x1fbbef,!![]);}catch(_0x221057){return BPromise[_0xfbcf('0x20')](_0x221057);}return _0x4b3586[_0xfbcf('0x21')]();};}function saveUpdates(_0x5b2c76,_0x1faf5d){return function(_0x141f67){if(_0x141f67){return _0x141f67['update'](_0x5b2c76)[_0xfbcf('0x22')](function(_0x3c070a){return _0x3c070a;});}return null;};}function removeEntity(_0x5cc845,_0x409ac5){return function(_0x1f4a15){if(_0x1f4a15){return _0x1f4a15[_0xfbcf('0x23')]()[_0xfbcf('0x22')](function(){var _0x19c85a=_0x1f4a15['get']({'plain':!![]});var _0x186d99=_0xfbcf('0x24');return db[_0xfbcf('0x25')]['destroy']({'where':{'type':_0x186d99,'resourceId':_0x19c85a['id']}})['then'](function(){return _0x1f4a15;});})[_0xfbcf('0x22')](function(){_0x5cc845[_0xfbcf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43a263,_0xe3054b){return function(_0x5da572){if(!_0x5da572){_0x43a263[_0xfbcf('0x26')](0x194);}return _0x5da572;};}function handleError(_0x40b8f0,_0x1ff412){_0x1ff412=_0x1ff412||0x1f4;return function(_0x4db905){logger['error'](_0x4db905[_0xfbcf('0x27')]);if(_0x4db905[_0xfbcf('0x28')]){delete _0x4db905[_0xfbcf('0x28')];}_0x40b8f0[_0xfbcf('0x18')](_0x1ff412)[_0xfbcf('0x29')](_0x4db905);};}exports[_0xfbcf('0x2a')]=function(_0xac9282,_0x5815c0){var _0xe119bd={},_0x24fefa={},_0x57b176={'count':0x0,'rows':[]};var _0x152b1b=_[_0xfbcf('0x2b')](db[_0xfbcf('0x2c')][_0xfbcf('0x2d')],function(_0x55b87f){return{'name':_0x55b87f[_0xfbcf('0x2e')],'type':_0x55b87f[_0xfbcf('0x2f')]['key']};});_0x24fefa[_0xfbcf('0x30')]=_[_0xfbcf('0x2b')](_0x152b1b,_0xfbcf('0x28'));_0x24fefa[_0xfbcf('0x31')]=_[_0xfbcf('0x32')](_0xac9282[_0xfbcf('0x31')]);_0x24fefa[_0xfbcf('0x33')]=_[_0xfbcf('0x34')](_0x24fefa[_0xfbcf('0x30')],_0x24fefa['query']);_0xe119bd[_0xfbcf('0x35')]=_['intersection'](_0x24fefa[_0xfbcf('0x30')],qs[_0xfbcf('0x36')](_0xac9282[_0xfbcf('0x31')][_0xfbcf('0x36')]));_0xe119bd['attributes']=_0xe119bd[_0xfbcf('0x35')]['length']?_0xe119bd[_0xfbcf('0x35')]:_0x24fefa[_0xfbcf('0x30')];if(!_0xac9282[_0xfbcf('0x31')][_0xfbcf('0x37')](_0xfbcf('0x38'))){_0xe119bd[_0xfbcf('0x1b')]=qs[_0xfbcf('0x1b')](_0xac9282[_0xfbcf('0x31')][_0xfbcf('0x1b')]);_0xe119bd[_0xfbcf('0x1d')]=qs[_0xfbcf('0x1d')](_0xac9282['query'][_0xfbcf('0x1d')]);}_0xe119bd[_0xfbcf('0x39')]=qs[_0xfbcf('0x3a')](_0xac9282[_0xfbcf('0x31')]['sort']);_0xe119bd[_0xfbcf('0x3b')]=qs[_0xfbcf('0x33')](_['pick'](_0xac9282[_0xfbcf('0x31')],_0x24fefa['filters']),_0x152b1b);if(_0xac9282['query'][_0xfbcf('0x3c')]){_0xe119bd[_0xfbcf('0x3b')]=_['merge'](_0xe119bd[_0xfbcf('0x3b')],{'$or':_['map'](_0x152b1b,function(_0x1875eb){if(_0x1875eb[_0xfbcf('0x2f')]!==_0xfbcf('0x3d')){var _0x32b63d={};_0x32b63d[_0x1875eb[_0xfbcf('0x28')]]={'$like':'%'+_0xac9282[_0xfbcf('0x31')][_0xfbcf('0x3c')]+'%'};return _0x32b63d;}})});}_0xe119bd=_[_0xfbcf('0x3e')]({},_0xe119bd,_0xac9282['options']);var _0x3a0c6c={'where':_0xe119bd['where']};return db[_0xfbcf('0x2c')][_0xfbcf('0x1c')](_0x3a0c6c)['then'](function(_0x1421aa){_0x57b176[_0xfbcf('0x1c')]=_0x1421aa;if(_0xac9282[_0xfbcf('0x31')]['includeAll']){_0xe119bd[_0xfbcf('0x3f')]=[{'all':!![]}];}return db[_0xfbcf('0x2c')]['findAll'](_0xe119bd);})['then'](function(_0x5b947e){_0x57b176['rows']=_0x5b947e;return _0x57b176;})[_0xfbcf('0x22')](respondWithFilteredResult(_0x5815c0,_0xe119bd))[_0xfbcf('0x40')](handleError(_0x5815c0,null));};exports['show']=function(_0x19eeb0,_0x2b155e){var _0x1f8fff={'raw':![],'where':{'id':_0x19eeb0['params']['id']}},_0x69fab2={};_0x69fab2['model']=_[_0xfbcf('0x32')](db[_0xfbcf('0x2c')][_0xfbcf('0x2d')]);_0x69fab2[_0xfbcf('0x31')]=_[_0xfbcf('0x32')](_0x19eeb0[_0xfbcf('0x31')]);_0x69fab2['filters']=_['intersection'](_0x69fab2[_0xfbcf('0x30')],_0x69fab2['query']);_0x1f8fff[_0xfbcf('0x35')]=_[_0xfbcf('0x34')](_0x69fab2[_0xfbcf('0x30')],qs[_0xfbcf('0x36')](_0x19eeb0[_0xfbcf('0x31')]['fields']));_0x1f8fff[_0xfbcf('0x35')]=_0x1f8fff[_0xfbcf('0x35')][_0xfbcf('0x41')]?_0x1f8fff[_0xfbcf('0x35')]:_0x69fab2['model'];if(_0x19eeb0[_0xfbcf('0x31')]['includeAll']){_0x1f8fff[_0xfbcf('0x3f')]=[{'all':!![]}];}_0x1f8fff=_[_0xfbcf('0x3e')]({},_0x1f8fff,_0x19eeb0['options']);return db[_0xfbcf('0x2c')][_0xfbcf('0x42')](_0x1f8fff)[_0xfbcf('0x22')](handleEntityNotFound(_0x2b155e,null))[_0xfbcf('0x22')](respondWithResult(_0x2b155e,null))['catch'](handleError(_0x2b155e,null));};exports[_0xfbcf('0x43')]=function(_0x12814b,_0x4725bc){return db[_0xfbcf('0x2c')]['create'](_0x12814b[_0xfbcf('0x44')],{})[_0xfbcf('0x22')](function(_0x22892c){var _0x226deb=_0x12814b[_0xfbcf('0x45')][_0xfbcf('0x46')]({'plain':!![]});if(!_0x226deb)throw new Error(_0xfbcf('0x47'));if(_0x226deb[_0xfbcf('0x48')]==='user'){var _0x51d8b3=_0x22892c[_0xfbcf('0x46')]({'plain':!![]});var _0x3a9a39=_0xfbcf('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x3a9a39,'userProfileId':_0x226deb[_0xfbcf('0x49')]},'raw':!![]})['then'](function(_0x4c1b1c){if(_0x4c1b1c&&_0x4c1b1c[_0xfbcf('0x4a')]===0x0){return db[_0xfbcf('0x25')]['create']({'name':_0x51d8b3['name'],'resourceId':_0x51d8b3['id'],'type':_0x4c1b1c[_0xfbcf('0x28')],'sectionId':_0x4c1b1c['id']},{})[_0xfbcf('0x22')](function(){return _0x22892c;});}else{return _0x22892c;}})[_0xfbcf('0x40')](function(_0x5092c0){logger[_0xfbcf('0x4b')](_0xfbcf('0x4c'),_0x5092c0);throw _0x5092c0;});}return _0x22892c;})[_0xfbcf('0x22')](respondWithResult(_0x4725bc,0xc9))['catch'](handleError(_0x4725bc,null));};exports[_0xfbcf('0x4d')]=function(_0x38d7cb,_0x1381bf){var _0x28fd74={'where':{'id':_0x38d7cb['params']['id']}},_0x52b58c={};_0x52b58c['model']=_[_0xfbcf('0x32')](db['JscriptyProject'][_0xfbcf('0x2d')]);_0x28fd74[_0xfbcf('0x35')]=_[_0xfbcf('0x34')](_0x52b58c['model'],qs[_0xfbcf('0x36')](_0x38d7cb[_0xfbcf('0x31')][_0xfbcf('0x36')]));_0x28fd74[_0xfbcf('0x35')]=_0x28fd74[_0xfbcf('0x35')][_0xfbcf('0x41')]?_0x28fd74[_0xfbcf('0x35')]:_0x52b58c['model'];if(_0x38d7cb[_0xfbcf('0x31')]['includeAll']){_0x28fd74[_0xfbcf('0x3f')]=[{'all':!![]}];}_0x28fd74=_[_0xfbcf('0x3e')]({},_0x28fd74,_0x38d7cb['options']);return db[_0xfbcf('0x2c')]['find'](_0x28fd74)[_0xfbcf('0x22')](handleEntityNotFound(_0x1381bf,null))[_0xfbcf('0x22')](function(_0xaa26e9){if(_0xaa26e9){var _0x1a3cc7=_0xaa26e9[_0xfbcf('0x46')]({'plain':!![]});_0x1a3cc7=qs[_0xfbcf('0x4e')](_0x1a3cc7,['id',_0xfbcf('0x4f'),_0xfbcf('0x50')]);_0x38d7cb[_0xfbcf('0x44')]=_['omit'](_0x38d7cb['body'],['id','createdAt','updatedAt']);return db[_0xfbcf('0x2c')][_0xfbcf('0x43')](_[_0xfbcf('0x3e')](_0x1a3cc7,_0x38d7cb[_0xfbcf('0x44')]),{'include':_0x38d7cb[_0xfbcf('0x31')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x123cb0){var _0x5b12f5=_0x38d7cb[_0xfbcf('0x45')][_0xfbcf('0x46')]({'plain':!![]});if(!_0x5b12f5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b12f5[_0xfbcf('0x48')]==='user'){var _0x59f9a9=_0x123cb0[_0xfbcf('0x46')]({'plain':!![]});var _0x3d3138=_0xfbcf('0x24');return db[_0xfbcf('0x51')][_0xfbcf('0x42')]({'where':{'name':_0x3d3138,'userProfileId':_0x5b12f5['userProfileId']},'raw':!![]})[_0xfbcf('0x22')](function(_0x507958){if(_0x507958&&_0x507958['autoAssociation']===0x0){return db[_0xfbcf('0x25')][_0xfbcf('0x43')]({'name':_0x59f9a9[_0xfbcf('0x28')],'resourceId':_0x59f9a9['id'],'type':_0x507958[_0xfbcf('0x28')],'sectionId':_0x507958['id']},{})[_0xfbcf('0x22')](function(){return _0x123cb0;});}else{return _0x123cb0;}})['catch'](function(_0x2783f1){logger[_0xfbcf('0x4b')](_0xfbcf('0x4c'),_0x2783f1);throw _0x2783f1;});}return _0x123cb0;});}})[_0xfbcf('0x22')](respondWithResult(_0x1381bf,0xc9))[_0xfbcf('0x40')](handleError(_0x1381bf,null));};exports[_0xfbcf('0x52')]=function(_0x2d5715,_0x29fc2c){if(_0x2d5715[_0xfbcf('0x44')]['id']){delete _0x2d5715[_0xfbcf('0x44')]['id'];}return db[_0xfbcf('0x2c')][_0xfbcf('0x42')]({'where':{'id':_0x2d5715[_0xfbcf('0x53')]['id']}})[_0xfbcf('0x22')](handleEntityNotFound(_0x29fc2c,null))['then'](saveUpdates(_0x2d5715['body'],null))[_0xfbcf('0x22')](respondWithResult(_0x29fc2c,null))[_0xfbcf('0x40')](handleError(_0x29fc2c,null));};exports[_0xfbcf('0x23')]=function(_0x47049d,_0xa03afc){return db[_0xfbcf('0x2c')]['find']({'where':{'id':_0x47049d[_0xfbcf('0x53')]['id']}})[_0xfbcf('0x22')](handleEntityNotFound(_0xa03afc,null))[_0xfbcf('0x22')](removeEntity(_0xa03afc,null))[_0xfbcf('0x40')](handleError(_0xa03afc,null));};exports['getSessions']=function(_0x29a3a8,_0x5577de,_0x2e63e2){var _0x2f7404={'raw':!![],'where':{}};var _0x5a922c={};var _0x352b63={'count':0x0,'rows':[]};return db[_0xfbcf('0x2c')][_0xfbcf('0x54')]({'where':{'id':_0x29a3a8[_0xfbcf('0x53')]['id']}})['then'](handleEntityNotFound(_0x5577de,null))[_0xfbcf('0x22')](function(_0x4f4a8e){if(_0x4f4a8e){_0x5a922c[_0xfbcf('0x30')]=_['keys'](db[_0xfbcf('0x55')][_0xfbcf('0x2d')]);_0x5a922c[_0xfbcf('0x31')]=_[_0xfbcf('0x32')](_0x29a3a8[_0xfbcf('0x31')]);_0x5a922c[_0xfbcf('0x33')]=_[_0xfbcf('0x34')](_0x5a922c['model'],_0x5a922c[_0xfbcf('0x31')]);_0x2f7404[_0xfbcf('0x35')]=_[_0xfbcf('0x34')](_0x5a922c[_0xfbcf('0x30')],qs[_0xfbcf('0x36')](_0x29a3a8[_0xfbcf('0x31')][_0xfbcf('0x36')]));_0x2f7404['attributes']=_0x2f7404[_0xfbcf('0x35')][_0xfbcf('0x41')]?_0x2f7404[_0xfbcf('0x35')]:_0x5a922c[_0xfbcf('0x30')];if(!_0x29a3a8['query'][_0xfbcf('0x37')]('nolimit')){_0x2f7404[_0xfbcf('0x1b')]=qs[_0xfbcf('0x1b')](_0x29a3a8[_0xfbcf('0x31')][_0xfbcf('0x1b')]);_0x2f7404[_0xfbcf('0x1d')]=qs[_0xfbcf('0x1d')](_0x29a3a8[_0xfbcf('0x31')][_0xfbcf('0x1d')]);}_0x2f7404['order']=qs[_0xfbcf('0x3a')](_0x29a3a8[_0xfbcf('0x31')][_0xfbcf('0x3a')]);_0x2f7404[_0xfbcf('0x3b')]=qs[_0xfbcf('0x33')](_[_0xfbcf('0x56')](_0x29a3a8[_0xfbcf('0x31')],_0x5a922c['filters']));_0x2f7404[_0xfbcf('0x3b')][_0xfbcf('0x57')]=_0x4f4a8e['id'];if(_0x29a3a8['query'][_0xfbcf('0x3c')]){_0x2f7404[_0xfbcf('0x3b')]=_[_0xfbcf('0x3e')](_0x2f7404[_0xfbcf('0x3b')],{'$or':_[_0xfbcf('0x2b')](_0x2f7404['attributes'],function(_0x388195){var _0x5d11e1={};_0x5d11e1[_0x388195]={'$like':'%'+_0x29a3a8[_0xfbcf('0x31')][_0xfbcf('0x3c')]+'%'};return _0x5d11e1;})});}_0x2f7404=_[_0xfbcf('0x3e')]({},_0x2f7404,_0x29a3a8[_0xfbcf('0x58')]);return db[_0xfbcf('0x55')][_0xfbcf('0x1c')]({'where':_0x2f7404[_0xfbcf('0x3b')]})['then'](function(_0xe0d507){_0x352b63[_0xfbcf('0x1c')]=_0xe0d507;if(_0x29a3a8[_0xfbcf('0x31')]['includeAll']){_0x2f7404['include']=[{'all':!![]}];}return db[_0xfbcf('0x55')][_0xfbcf('0x59')](_0x2f7404);})[_0xfbcf('0x22')](function(_0x409ce9){_0x352b63[_0xfbcf('0x5a')]=_0x409ce9;return _0x352b63;});}})[_0xfbcf('0x22')](respondWithFilteredResult(_0x5577de,_0x2f7404))['catch'](handleError(_0x5577de,null));};exports[_0xfbcf('0x5b')]=function(_0x52ce65,_0x27f562,_0x14674b){var _0x16f528={'raw':!![],'where':{}};var _0x18db30={};var _0x3b6aed={'count':0x0,'rows':[]};return db[_0xfbcf('0x2c')][_0xfbcf('0x54')]({'where':{'id':_0x52ce65['params']['id']}})['then'](handleEntityNotFound(_0x27f562,null))[_0xfbcf('0x22')](function(_0x50bbbf){if(_0x50bbbf){_0x18db30[_0xfbcf('0x30')]=_[_0xfbcf('0x32')](db[_0xfbcf('0x5c')][_0xfbcf('0x2d')]);_0x18db30[_0xfbcf('0x31')]=_[_0xfbcf('0x32')](_0x52ce65[_0xfbcf('0x31')]);_0x18db30[_0xfbcf('0x33')]=_[_0xfbcf('0x34')](_0x18db30[_0xfbcf('0x30')],_0x18db30[_0xfbcf('0x31')]);_0x16f528['attributes']=_[_0xfbcf('0x34')](_0x18db30['model'],qs['fields'](_0x52ce65[_0xfbcf('0x31')][_0xfbcf('0x36')]));_0x16f528[_0xfbcf('0x35')]=_0x16f528[_0xfbcf('0x35')]['length']?_0x16f528['attributes']:_0x18db30[_0xfbcf('0x30')];if(!_0x52ce65['query'][_0xfbcf('0x37')](_0xfbcf('0x38'))){_0x16f528[_0xfbcf('0x1b')]=qs[_0xfbcf('0x1b')](_0x52ce65['query'][_0xfbcf('0x1b')]);_0x16f528['offset']=qs[_0xfbcf('0x1d')](_0x52ce65[_0xfbcf('0x31')]['offset']);}_0x16f528[_0xfbcf('0x39')]=qs[_0xfbcf('0x3a')](_0x52ce65['query'][_0xfbcf('0x3a')]);_0x16f528['where']=qs['filters'](_[_0xfbcf('0x56')](_0x52ce65[_0xfbcf('0x31')],_0x18db30[_0xfbcf('0x33')]));_0x16f528[_0xfbcf('0x3b')][_0xfbcf('0x57')]=_0x50bbbf['id'];if(_0x52ce65['query'][_0xfbcf('0x3c')]){_0x16f528[_0xfbcf('0x3b')]=_['merge'](_0x16f528[_0xfbcf('0x3b')],{'$or':_[_0xfbcf('0x2b')](_0x16f528['attributes'],function(_0x9d8a11){var _0x5a1c28={};_0x5a1c28[_0x9d8a11]={'$like':'%'+_0x52ce65[_0xfbcf('0x31')][_0xfbcf('0x3c')]+'%'};return _0x5a1c28;})});}_0x16f528=_['merge']({},_0x16f528,_0x52ce65[_0xfbcf('0x58')]);return db[_0xfbcf('0x5c')]['count']({'where':_0x16f528[_0xfbcf('0x3b')]})[_0xfbcf('0x22')](function(_0x413755){_0x3b6aed[_0xfbcf('0x1c')]=_0x413755;if(_0x52ce65[_0xfbcf('0x31')][_0xfbcf('0x5d')]){_0x16f528[_0xfbcf('0x3f')]=[{'all':!![]}];}return db[_0xfbcf('0x5c')][_0xfbcf('0x59')](_0x16f528);})[_0xfbcf('0x22')](function(_0x3081f4){_0x3b6aed['rows']=_0x3081f4;return _0x3b6aed;});}})[_0xfbcf('0x22')](respondWithFilteredResult(_0x27f562,_0x16f528))['catch'](handleError(_0x27f562,null));};function char(_0x4f1196){return _0xfbcf('0x5e')===typeof _0x4f1196?String[_0xfbcf('0x5f')][_0xfbcf('0x1f')](null,arguments):_0x4f1196;}function needsEncapsulation(_0x55b99e){return!!_0x55b99e&&(_0x55b99e[_0xfbcf('0x60')]()[_0xfbcf('0x61')](char(0xd))>=0x0||_0x55b99e['toString']()[_0xfbcf('0x61')](char(0xa))>=0x0||_0x55b99e[_0xfbcf('0x60')]()['indexOf'](char(0x2c))>=0x0||_0x55b99e[_0xfbcf('0x60')]()[_0xfbcf('0x61')](char(0x22))>=0x0);}function encapsulate(_0x4ab089){var _0x4ef041=char(0x22),_0x2f8672='\x5c'+char(0x22),_0x43e285=_0x4ab089[_0xfbcf('0x60')]()['replace'](new RegExp(_0x4ef041,'g'),_0x2f8672);return _0x4ef041+_0x43e285+_0x4ef041;}exports['getSummary']=function(_0x55d313,_0x2a8cc9,_0x1cfa29){var _0x58f1c2,_0x44e160;var _0x19f6a2={'where':{'ProjectId':_0x55d313[_0xfbcf('0x53')]['id']}};if(_0x55d313[_0xfbcf('0x31')][_0xfbcf('0x62')]){_0x19f6a2['where'][_0xfbcf('0x63')]=JSON[_0xfbcf('0x64')](_0x55d313[_0xfbcf('0x31')]['startTime']);}return db[_0xfbcf('0x55')][_0xfbcf('0x59')](_0x19f6a2)['then'](handleEntityNotFound(_0x2a8cc9,null))['then'](function(_0x2ca0d8){if(_0x2ca0d8){_0x58f1c2=_0x2ca0d8;return db[_0xfbcf('0x65')][_0xfbcf('0x59')]({'where':{'SessionId':{'$in':_['map'](_0x58f1c2,'id')},'ProjectId':_0x55d313[_0xfbcf('0x53')]['id']},'order':'-createdAt'});}})[_0xfbcf('0x22')](handleEntityNotFound(_0x2a8cc9,null))[_0xfbcf('0x22')](function(_0x515386){if(_0x515386){_0x44e160=_0x515386;var _0x437cad={};for(var _0x76bff9=0x0,_0x31005f=_0x44e160[_0xfbcf('0x41')];_0x76bff9<_0x31005f;_0x76bff9++){if(!_0x437cad[_0xfbcf('0x37')](_0x44e160[_0x76bff9]['questionId'])){_0x437cad[_0x44e160[_0x76bff9][_0xfbcf('0x66')]]=needsEncapsulation(_0x44e160[_0x76bff9][_0xfbcf('0x67')])?encapsulate(_0x44e160[_0x76bff9][_0xfbcf('0x67')]):_0x44e160[_0x76bff9][_0xfbcf('0x67')];}}var _0x5704f4=[],_0xb6d07f={};for(var _0x57fc98=0x0,_0x39920c=_0x58f1c2[_0xfbcf('0x41')];_0x57fc98<_0x39920c;_0x57fc98++){_0xb6d07f={'ProjectId':_0x55d313[_0xfbcf('0x53')]['id'],'SessionId':_0x58f1c2[_0x57fc98]['id'],'StartTime':moment(_0x58f1c2[_0x57fc98][_0xfbcf('0x63')])[_0xfbcf('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x211ddb=0x0,_0x57c6ea=_0x44e160[_0xfbcf('0x41')];_0x211ddb<_0x57c6ea;_0x211ddb++){if(_0x44e160[_0x211ddb][_0xfbcf('0x69')]==_0x58f1c2[_0x57fc98]['id']&&_0x437cad[_0xfbcf('0x37')](_0x44e160[_0x211ddb]['questionId'])){_0xb6d07f[_0x437cad[_0x44e160[_0x211ddb][_0xfbcf('0x66')]]]=_0x44e160[_0x211ddb][_0xfbcf('0x6a')];}}for(var _0x742461 in _0x437cad){if(!_0xb6d07f['hasOwnProperty'](_0x437cad[_0x742461])){_0xb6d07f[_0x437cad[_0x742461]]=null;}}_0x5704f4[_0xfbcf('0x6b')](_0xb6d07f);}return _0x5704f4;}})[_0xfbcf('0x22')](function(_0x1f661f){if(!_[_0xfbcf('0x6c')](_0x1f661f)){var _0x11ce77=toCsv(_0x1f661f);var _0xfafac8=Date[_0xfbcf('0x6d')]();fs[_0xfbcf('0x6e')](util[_0xfbcf('0x68')](_0xfbcf('0x6f'),_0x55d313[_0xfbcf('0x53')]['id'],_0xfafac8),_0x11ce77);_0x2a8cc9[_0xfbcf('0x70')](_0xfbcf('0x71'),_0xfbcf('0x72')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x55d313[_0xfbcf('0x53')]['id'],_0xfafac8));_0x2a8cc9[_0xfbcf('0x70')](_0xfbcf('0x73'),'text/csv');return _0x2a8cc9[_0xfbcf('0x74')](util[_0xfbcf('0x68')](_0xfbcf('0x6f'),_0x55d313['params']['id'],_0xfafac8));}else{return _0x2a8cc9[_0xfbcf('0x26')](0xcc);}})[_0xfbcf('0x40')](handleError(_0x2a8cc9,null));}; \ No newline at end of file +var _0xb2ed=['-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','hasOwnProperty','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','then','destroy','Projects','UserProfileResource','end','error','name','index','JscriptyProject','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','update','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','findAll','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xb2ed,0x86));var _0xdb2e=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0xb2ed[_0x10291b];return _0x1d5fbe;};'use strict';var emlformat=require(_0xdb2e('0x0'));var rimraf=require(_0xdb2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb2e('0x2'));var rp=require(_0xdb2e('0x3'));var moment=require(_0xdb2e('0x4'));var BPromise=require(_0xdb2e('0x5'));var Mustache=require(_0xdb2e('0x6'));var util=require(_0xdb2e('0x7'));var path=require(_0xdb2e('0x8'));var sox=require(_0xdb2e('0x9'));var csv=require('to-csv');var ejs=require(_0xdb2e('0xa'));var fs=require('fs');var fs_extra=require(_0xdb2e('0xb'));var _=require(_0xdb2e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdb2e('0xd'));var deskjs=require(_0xdb2e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdb2e('0xf'));var Papa=require(_0xdb2e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb2e('0x11'));var as=require(_0xdb2e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdb2e('0x13'));var config=require(_0xdb2e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb2e('0x15'))['db'];function respondWithStatusCode(_0x1e9a74,_0x378dee){_0x378dee=_0x378dee||0xcc;return function(_0x347b29){if(_0x347b29){return _0x1e9a74[_0xdb2e('0x16')](_0x378dee);}return _0x1e9a74[_0xdb2e('0x17')](_0x378dee)['end']();};}function respondWithResult(_0x55919b,_0x43b76f){_0x43b76f=_0x43b76f||0xc8;return function(_0xfab440){if(_0xfab440){return _0x55919b[_0xdb2e('0x17')](_0x43b76f)['json'](_0xfab440);}};}function respondWithFilteredResult(_0xbd96e5,_0x2838f4){return function(_0x322910){if(_0x322910){var _0x38a7dc=typeof _0x2838f4[_0xdb2e('0x18')]===_0xdb2e('0x19')&&typeof _0x2838f4[_0xdb2e('0x1a')]===_0xdb2e('0x19');var _0x448ce7=_0x322910[_0xdb2e('0x1b')];var _0x1d4ffd=_0x38a7dc?0x0:_0x2838f4['offset'];var _0x4451e5=_0x38a7dc?_0x322910[_0xdb2e('0x1b')]:_0x2838f4['offset']+_0x2838f4[_0xdb2e('0x1a')];var _0x51e414;if(_0x4451e5>=_0x448ce7){_0x4451e5=_0x448ce7;_0x51e414=0xc8;}else{_0x51e414=0xce;}_0xbd96e5[_0xdb2e('0x17')](_0x51e414);return _0xbd96e5['set']('Content-Range',_0x1d4ffd+'-'+_0x4451e5+'/'+_0x448ce7)[_0xdb2e('0x1c')](_0x322910);}return null;};}function patchUpdates(_0x5ea956){return function(_0x5efb8e){try{jsonpatch[_0xdb2e('0x1d')](_0x5efb8e,_0x5ea956,!![]);}catch(_0x43f826){return BPromise[_0xdb2e('0x1e')](_0x43f826);}return _0x5efb8e[_0xdb2e('0x1f')]();};}function saveUpdates(_0x5c54e0,_0x423555){return function(_0x4c0852){if(_0x4c0852){return _0x4c0852['update'](_0x5c54e0)[_0xdb2e('0x20')](function(_0x4a1840){return _0x4a1840;});}return null;};}function removeEntity(_0x13175f,_0x1564cd){return function(_0x5f1633){if(_0x5f1633){return _0x5f1633[_0xdb2e('0x21')]()['then'](function(){var _0x2c00f1=_0x5f1633['get']({'plain':!![]});var _0x5e381e=_0xdb2e('0x22');return db[_0xdb2e('0x23')]['destroy']({'where':{'type':_0x5e381e,'resourceId':_0x2c00f1['id']}})[_0xdb2e('0x20')](function(){return _0x5f1633;});})[_0xdb2e('0x20')](function(){_0x13175f[_0xdb2e('0x17')](0xcc)[_0xdb2e('0x24')]();});}};}function handleEntityNotFound(_0x68185f,_0x34aca3){return function(_0x28ab99){if(!_0x28ab99){_0x68185f['sendStatus'](0x194);}return _0x28ab99;};}function handleError(_0x6833fa,_0x44e63e){_0x44e63e=_0x44e63e||0x1f4;return function(_0x4e5102){logger[_0xdb2e('0x25')](_0x4e5102['stack']);if(_0x4e5102[_0xdb2e('0x26')]){delete _0x4e5102[_0xdb2e('0x26')];}_0x6833fa[_0xdb2e('0x17')](_0x44e63e)['send'](_0x4e5102);};}exports[_0xdb2e('0x27')]=function(_0x164224,_0x330265){var _0x2668bf={},_0x31a001={},_0x4eccc4={'count':0x0,'rows':[]};var _0xa115de=_['map'](db[_0xdb2e('0x28')][_0xdb2e('0x29')],function(_0x56d322){return{'name':_0x56d322['fieldName'],'type':_0x56d322['type'][_0xdb2e('0x2a')]};});_0x31a001[_0xdb2e('0x2b')]=_[_0xdb2e('0x2c')](_0xa115de,_0xdb2e('0x26'));_0x31a001['query']=_[_0xdb2e('0x2d')](_0x164224[_0xdb2e('0x2e')]);_0x31a001[_0xdb2e('0x2f')]=_[_0xdb2e('0x30')](_0x31a001[_0xdb2e('0x2b')],_0x31a001[_0xdb2e('0x2e')]);_0x2668bf[_0xdb2e('0x31')]=_['intersection'](_0x31a001[_0xdb2e('0x2b')],qs[_0xdb2e('0x32')](_0x164224[_0xdb2e('0x2e')][_0xdb2e('0x32')]));_0x2668bf[_0xdb2e('0x31')]=_0x2668bf['attributes'][_0xdb2e('0x33')]?_0x2668bf[_0xdb2e('0x31')]:_0x31a001[_0xdb2e('0x2b')];if(!_0x164224[_0xdb2e('0x2e')]['hasOwnProperty']('nolimit')){_0x2668bf['limit']=qs[_0xdb2e('0x1a')](_0x164224[_0xdb2e('0x2e')]['limit']);_0x2668bf['offset']=qs[_0xdb2e('0x18')](_0x164224[_0xdb2e('0x2e')][_0xdb2e('0x18')]);}_0x2668bf[_0xdb2e('0x34')]=qs[_0xdb2e('0x35')](_0x164224['query'][_0xdb2e('0x35')]);_0x2668bf['where']=qs[_0xdb2e('0x2f')](_[_0xdb2e('0x36')](_0x164224[_0xdb2e('0x2e')],_0x31a001['filters']),_0xa115de);if(_0x164224['query'][_0xdb2e('0x37')]){_0x2668bf[_0xdb2e('0x38')]=_['merge'](_0x2668bf[_0xdb2e('0x38')],{'$or':_[_0xdb2e('0x2c')](_0xa115de,function(_0x49577f){if(_0x49577f[_0xdb2e('0x39')]!==_0xdb2e('0x3a')){var _0x2d911b={};_0x2d911b[_0x49577f[_0xdb2e('0x26')]]={'$like':'%'+_0x164224[_0xdb2e('0x2e')][_0xdb2e('0x37')]+'%'};return _0x2d911b;}})});}_0x2668bf=_[_0xdb2e('0x3b')]({},_0x2668bf,_0x164224[_0xdb2e('0x3c')]);var _0x43452c={'where':_0x2668bf[_0xdb2e('0x38')]};return db[_0xdb2e('0x28')]['count'](_0x43452c)[_0xdb2e('0x20')](function(_0xcde4c7){_0x4eccc4[_0xdb2e('0x1b')]=_0xcde4c7;if(_0x164224[_0xdb2e('0x2e')][_0xdb2e('0x3d')]){_0x2668bf['include']=[{'all':!![]}];}return db[_0xdb2e('0x28')]['findAll'](_0x2668bf);})[_0xdb2e('0x20')](function(_0x29f6a7){_0x4eccc4[_0xdb2e('0x3e')]=_0x29f6a7;return _0x4eccc4;})[_0xdb2e('0x20')](respondWithFilteredResult(_0x330265,_0x2668bf))[_0xdb2e('0x3f')](handleError(_0x330265,null));};exports[_0xdb2e('0x40')]=function(_0x1944a0,_0xef00eb){var _0x30c565={'raw':![],'where':{'id':_0x1944a0[_0xdb2e('0x41')]['id']}},_0x2bb5d5={};_0x2bb5d5[_0xdb2e('0x2b')]=_['keys'](db[_0xdb2e('0x28')][_0xdb2e('0x29')]);_0x2bb5d5[_0xdb2e('0x2e')]=_[_0xdb2e('0x2d')](_0x1944a0[_0xdb2e('0x2e')]);_0x2bb5d5[_0xdb2e('0x2f')]=_[_0xdb2e('0x30')](_0x2bb5d5[_0xdb2e('0x2b')],_0x2bb5d5[_0xdb2e('0x2e')]);_0x30c565[_0xdb2e('0x31')]=_[_0xdb2e('0x30')](_0x2bb5d5[_0xdb2e('0x2b')],qs[_0xdb2e('0x32')](_0x1944a0[_0xdb2e('0x2e')][_0xdb2e('0x32')]));_0x30c565[_0xdb2e('0x31')]=_0x30c565[_0xdb2e('0x31')][_0xdb2e('0x33')]?_0x30c565[_0xdb2e('0x31')]:_0x2bb5d5['model'];if(_0x1944a0[_0xdb2e('0x2e')][_0xdb2e('0x3d')]){_0x30c565[_0xdb2e('0x42')]=[{'all':!![]}];}_0x30c565=_[_0xdb2e('0x3b')]({},_0x30c565,_0x1944a0[_0xdb2e('0x3c')]);return db['JscriptyProject']['find'](_0x30c565)[_0xdb2e('0x20')](handleEntityNotFound(_0xef00eb,null))[_0xdb2e('0x20')](respondWithResult(_0xef00eb,null))[_0xdb2e('0x3f')](handleError(_0xef00eb,null));};exports[_0xdb2e('0x43')]=function(_0x1f95d7,_0x447ec1){return db['JscriptyProject'][_0xdb2e('0x43')](_0x1f95d7[_0xdb2e('0x44')],{})[_0xdb2e('0x20')](function(_0xef5c65){var _0x36180d=_0x1f95d7['user'][_0xdb2e('0x45')]({'plain':!![]});if(!_0x36180d)throw new Error(_0xdb2e('0x46'));if(_0x36180d[_0xdb2e('0x47')]==='user'){var _0x4a3b32=_0xef5c65[_0xdb2e('0x45')]({'plain':!![]});var _0x1e052e='Projects';return db['UserProfileSection'][_0xdb2e('0x48')]({'where':{'name':_0x1e052e,'userProfileId':_0x36180d[_0xdb2e('0x49')]},'raw':!![]})['then'](function(_0x112416){if(_0x112416&&_0x112416[_0xdb2e('0x4a')]===0x0){return db[_0xdb2e('0x23')][_0xdb2e('0x43')]({'name':_0x4a3b32[_0xdb2e('0x26')],'resourceId':_0x4a3b32['id'],'type':_0x112416[_0xdb2e('0x26')],'sectionId':_0x112416['id']},{})[_0xdb2e('0x20')](function(){return _0xef5c65;});}else{return _0xef5c65;}})[_0xdb2e('0x3f')](function(_0x4f26c7){logger[_0xdb2e('0x25')](_0xdb2e('0x4b'),_0x4f26c7);throw _0x4f26c7;});}return _0xef5c65;})[_0xdb2e('0x20')](respondWithResult(_0x447ec1,0xc9))[_0xdb2e('0x3f')](handleError(_0x447ec1,null));};exports[_0xdb2e('0x4c')]=function(_0x32b4ba,_0x594884){var _0x1b8c55={'where':{'id':_0x32b4ba[_0xdb2e('0x41')]['id']}},_0xcce786={};_0xcce786['model']=_[_0xdb2e('0x2d')](db[_0xdb2e('0x28')][_0xdb2e('0x29')]);_0x1b8c55['attributes']=_[_0xdb2e('0x30')](_0xcce786[_0xdb2e('0x2b')],qs['fields'](_0x32b4ba[_0xdb2e('0x2e')]['fields']));_0x1b8c55[_0xdb2e('0x31')]=_0x1b8c55[_0xdb2e('0x31')]['length']?_0x1b8c55[_0xdb2e('0x31')]:_0xcce786[_0xdb2e('0x2b')];if(_0x32b4ba[_0xdb2e('0x2e')][_0xdb2e('0x3d')]){_0x1b8c55[_0xdb2e('0x42')]=[{'all':!![]}];}_0x1b8c55=_[_0xdb2e('0x3b')]({},_0x1b8c55,_0x32b4ba[_0xdb2e('0x3c')]);return db[_0xdb2e('0x28')][_0xdb2e('0x48')](_0x1b8c55)['then'](handleEntityNotFound(_0x594884,null))[_0xdb2e('0x20')](function(_0x44ba8b){if(_0x44ba8b){var _0x2ee3d8=_0x44ba8b[_0xdb2e('0x45')]({'plain':!![]});_0x2ee3d8=qs[_0xdb2e('0x4d')](_0x2ee3d8,['id',_0xdb2e('0x4e'),_0xdb2e('0x4f')]);_0x32b4ba[_0xdb2e('0x44')]=_[_0xdb2e('0x4d')](_0x32b4ba[_0xdb2e('0x44')],['id',_0xdb2e('0x4e'),_0xdb2e('0x4f')]);return db['JscriptyProject']['create'](_[_0xdb2e('0x3b')](_0x2ee3d8,_0x32b4ba[_0xdb2e('0x44')]),{'include':_0x32b4ba[_0xdb2e('0x2e')][_0xdb2e('0x3d')]?[{'all':!![]}]:undefined})[_0xdb2e('0x20')](function(_0x277a76){var _0xe46d67=_0x32b4ba['user'][_0xdb2e('0x45')]({'plain':!![]});if(!_0xe46d67)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe46d67['role']===_0xdb2e('0x50')){var _0x7e1db=_0x277a76['get']({'plain':!![]});var _0x228433='Projects';return db['UserProfileSection'][_0xdb2e('0x48')]({'where':{'name':_0x228433,'userProfileId':_0xe46d67[_0xdb2e('0x49')]},'raw':!![]})['then'](function(_0x533a53){if(_0x533a53&&_0x533a53[_0xdb2e('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x7e1db[_0xdb2e('0x26')],'resourceId':_0x7e1db['id'],'type':_0x533a53[_0xdb2e('0x26')],'sectionId':_0x533a53['id']},{})[_0xdb2e('0x20')](function(){return _0x277a76;});}else{return _0x277a76;}})['catch'](function(_0x5df8af){logger['error'](_0xdb2e('0x4b'),_0x5df8af);throw _0x5df8af;});}return _0x277a76;});}})[_0xdb2e('0x20')](respondWithResult(_0x594884,0xc9))[_0xdb2e('0x3f')](handleError(_0x594884,null));};exports[_0xdb2e('0x51')]=function(_0x587d67,_0x2e2048){if(_0x587d67[_0xdb2e('0x44')]['id']){delete _0x587d67['body']['id'];}return db['JscriptyProject'][_0xdb2e('0x48')]({'where':{'id':_0x587d67[_0xdb2e('0x41')]['id']}})[_0xdb2e('0x20')](handleEntityNotFound(_0x2e2048,null))[_0xdb2e('0x20')](saveUpdates(_0x587d67['body'],null))['then'](respondWithResult(_0x2e2048,null))[_0xdb2e('0x3f')](handleError(_0x2e2048,null));};exports[_0xdb2e('0x21')]=function(_0x4fc905,_0xc8641b){return db[_0xdb2e('0x28')]['find']({'where':{'id':_0x4fc905[_0xdb2e('0x41')]['id']}})[_0xdb2e('0x20')](handleEntityNotFound(_0xc8641b,null))[_0xdb2e('0x20')](removeEntity(_0xc8641b,null))['catch'](handleError(_0xc8641b,null));};exports[_0xdb2e('0x52')]=function(_0x1af0c3,_0xb75ff0,_0x388062){var _0x101afa={'raw':!![],'where':{}};var _0x39ceb7={};var _0xa24b5={'count':0x0,'rows':[]};return db[_0xdb2e('0x28')][_0xdb2e('0x53')]({'where':{'id':_0x1af0c3['params']['id']}})[_0xdb2e('0x20')](handleEntityNotFound(_0xb75ff0,null))[_0xdb2e('0x20')](function(_0x27c969){if(_0x27c969){_0x39ceb7[_0xdb2e('0x2b')]=_['keys'](db[_0xdb2e('0x54')][_0xdb2e('0x29')]);_0x39ceb7[_0xdb2e('0x2e')]=_[_0xdb2e('0x2d')](_0x1af0c3[_0xdb2e('0x2e')]);_0x39ceb7['filters']=_[_0xdb2e('0x30')](_0x39ceb7[_0xdb2e('0x2b')],_0x39ceb7[_0xdb2e('0x2e')]);_0x101afa['attributes']=_[_0xdb2e('0x30')](_0x39ceb7[_0xdb2e('0x2b')],qs[_0xdb2e('0x32')](_0x1af0c3[_0xdb2e('0x2e')][_0xdb2e('0x32')]));_0x101afa['attributes']=_0x101afa['attributes'][_0xdb2e('0x33')]?_0x101afa[_0xdb2e('0x31')]:_0x39ceb7[_0xdb2e('0x2b')];if(!_0x1af0c3['query']['hasOwnProperty'](_0xdb2e('0x55'))){_0x101afa['limit']=qs[_0xdb2e('0x1a')](_0x1af0c3[_0xdb2e('0x2e')][_0xdb2e('0x1a')]);_0x101afa['offset']=qs['offset'](_0x1af0c3[_0xdb2e('0x2e')][_0xdb2e('0x18')]);}_0x101afa[_0xdb2e('0x34')]=qs[_0xdb2e('0x35')](_0x1af0c3[_0xdb2e('0x2e')]['sort']);_0x101afa[_0xdb2e('0x38')]=qs['filters'](_[_0xdb2e('0x36')](_0x1af0c3['query'],_0x39ceb7[_0xdb2e('0x2f')]));_0x101afa[_0xdb2e('0x38')][_0xdb2e('0x56')]=_0x27c969['id'];if(_0x1af0c3[_0xdb2e('0x2e')][_0xdb2e('0x37')]){_0x101afa[_0xdb2e('0x38')]=_[_0xdb2e('0x3b')](_0x101afa[_0xdb2e('0x38')],{'$or':_[_0xdb2e('0x2c')](_0x101afa['attributes'],function(_0x105681){var _0x180221={};_0x180221[_0x105681]={'$like':'%'+_0x1af0c3[_0xdb2e('0x2e')][_0xdb2e('0x37')]+'%'};return _0x180221;})});}_0x101afa=_[_0xdb2e('0x3b')]({},_0x101afa,_0x1af0c3['options']);return db[_0xdb2e('0x54')][_0xdb2e('0x1b')]({'where':_0x101afa[_0xdb2e('0x38')]})['then'](function(_0x1fe8fb){_0xa24b5[_0xdb2e('0x1b')]=_0x1fe8fb;if(_0x1af0c3[_0xdb2e('0x2e')][_0xdb2e('0x3d')]){_0x101afa[_0xdb2e('0x42')]=[{'all':!![]}];}return db[_0xdb2e('0x54')][_0xdb2e('0x57')](_0x101afa);})[_0xdb2e('0x20')](function(_0x58464b){_0xa24b5[_0xdb2e('0x3e')]=_0x58464b;return _0xa24b5;});}})[_0xdb2e('0x20')](respondWithFilteredResult(_0xb75ff0,_0x101afa))['catch'](handleError(_0xb75ff0,null));};exports['getAnswers']=function(_0x5a66c9,_0x3c6138,_0x2ace1){var _0x1b487b={'raw':!![],'where':{}};var _0x30f7b1={};var _0x56dacd={'count':0x0,'rows':[]};return db[_0xdb2e('0x28')][_0xdb2e('0x53')]({'where':{'id':_0x5a66c9[_0xdb2e('0x41')]['id']}})[_0xdb2e('0x20')](handleEntityNotFound(_0x3c6138,null))['then'](function(_0x43e290){if(_0x43e290){_0x30f7b1[_0xdb2e('0x2b')]=_[_0xdb2e('0x2d')](db[_0xdb2e('0x58')][_0xdb2e('0x29')]);_0x30f7b1['query']=_[_0xdb2e('0x2d')](_0x5a66c9['query']);_0x30f7b1['filters']=_[_0xdb2e('0x30')](_0x30f7b1[_0xdb2e('0x2b')],_0x30f7b1[_0xdb2e('0x2e')]);_0x1b487b['attributes']=_[_0xdb2e('0x30')](_0x30f7b1['model'],qs[_0xdb2e('0x32')](_0x5a66c9[_0xdb2e('0x2e')][_0xdb2e('0x32')]));_0x1b487b['attributes']=_0x1b487b['attributes']['length']?_0x1b487b[_0xdb2e('0x31')]:_0x30f7b1[_0xdb2e('0x2b')];if(!_0x5a66c9[_0xdb2e('0x2e')]['hasOwnProperty'](_0xdb2e('0x55'))){_0x1b487b['limit']=qs[_0xdb2e('0x1a')](_0x5a66c9['query'][_0xdb2e('0x1a')]);_0x1b487b[_0xdb2e('0x18')]=qs['offset'](_0x5a66c9[_0xdb2e('0x2e')][_0xdb2e('0x18')]);}_0x1b487b[_0xdb2e('0x34')]=qs[_0xdb2e('0x35')](_0x5a66c9[_0xdb2e('0x2e')]['sort']);_0x1b487b[_0xdb2e('0x38')]=qs['filters'](_['pick'](_0x5a66c9[_0xdb2e('0x2e')],_0x30f7b1['filters']));_0x1b487b[_0xdb2e('0x38')][_0xdb2e('0x56')]=_0x43e290['id'];if(_0x5a66c9['query'][_0xdb2e('0x37')]){_0x1b487b[_0xdb2e('0x38')]=_['merge'](_0x1b487b[_0xdb2e('0x38')],{'$or':_[_0xdb2e('0x2c')](_0x1b487b['attributes'],function(_0x9043d0){var _0x4cfb42={};_0x4cfb42[_0x9043d0]={'$like':'%'+_0x5a66c9[_0xdb2e('0x2e')]['filter']+'%'};return _0x4cfb42;})});}_0x1b487b=_['merge']({},_0x1b487b,_0x5a66c9[_0xdb2e('0x3c')]);return db[_0xdb2e('0x58')][_0xdb2e('0x1b')]({'where':_0x1b487b[_0xdb2e('0x38')]})[_0xdb2e('0x20')](function(_0x11e3fd){_0x56dacd['count']=_0x11e3fd;if(_0x5a66c9[_0xdb2e('0x2e')][_0xdb2e('0x3d')]){_0x1b487b[_0xdb2e('0x42')]=[{'all':!![]}];}return db[_0xdb2e('0x58')][_0xdb2e('0x57')](_0x1b487b);})[_0xdb2e('0x20')](function(_0x36be55){_0x56dacd[_0xdb2e('0x3e')]=_0x36be55;return _0x56dacd;});}})[_0xdb2e('0x20')](respondWithFilteredResult(_0x3c6138,_0x1b487b))[_0xdb2e('0x3f')](handleError(_0x3c6138,null));};function char(_0x5c922e){return _0xdb2e('0x59')===typeof _0x5c922e?String[_0xdb2e('0x5a')][_0xdb2e('0x1d')](null,arguments):_0x5c922e;}function needsEncapsulation(_0x226e06){return!!_0x226e06&&(_0x226e06[_0xdb2e('0x5b')]()[_0xdb2e('0x5c')](char(0xd))>=0x0||_0x226e06[_0xdb2e('0x5b')]()[_0xdb2e('0x5c')](char(0xa))>=0x0||_0x226e06[_0xdb2e('0x5b')]()[_0xdb2e('0x5c')](char(0x2c))>=0x0||_0x226e06[_0xdb2e('0x5b')]()[_0xdb2e('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x526209){var _0x660174=char(0x22),_0x5babbc='\x5c'+char(0x22),_0x4e05e3=_0x526209[_0xdb2e('0x5b')]()[_0xdb2e('0x5d')](new RegExp(_0x660174,'g'),_0x5babbc);return _0x660174+_0x4e05e3+_0x660174;}exports[_0xdb2e('0x5e')]=function(_0x3bf4a2,_0x459c8c,_0x2fc7d4){var _0x50c687,_0x44e7db;var _0x52a8d9={'where':{'ProjectId':_0x3bf4a2[_0xdb2e('0x41')]['id']}};if(_0x3bf4a2[_0xdb2e('0x2e')][_0xdb2e('0x5f')]){_0x52a8d9['where'][_0xdb2e('0x60')]=JSON[_0xdb2e('0x61')](_0x3bf4a2[_0xdb2e('0x2e')][_0xdb2e('0x5f')]);}return db['JscriptySessionReport'][_0xdb2e('0x57')](_0x52a8d9)[_0xdb2e('0x20')](handleEntityNotFound(_0x459c8c,null))[_0xdb2e('0x20')](function(_0x429620){if(_0x429620){_0x50c687=_0x429620;return db['JscriptyQuestionReport'][_0xdb2e('0x57')]({'where':{'SessionId':{'$in':_['map'](_0x50c687,'id')},'ProjectId':_0x3bf4a2[_0xdb2e('0x41')]['id']},'order':_0xdb2e('0x62')});}})[_0xdb2e('0x20')](handleEntityNotFound(_0x459c8c,null))[_0xdb2e('0x20')](function(_0x1d1ac5){if(_0x1d1ac5){_0x44e7db=_0x1d1ac5;var _0x235aa4={};for(var _0x29527b=0x0,_0x2a0ff3=_0x44e7db[_0xdb2e('0x33')];_0x29527b<_0x2a0ff3;_0x29527b++){if(!_0x235aa4['hasOwnProperty'](_0x44e7db[_0x29527b][_0xdb2e('0x63')])){_0x235aa4[_0x44e7db[_0x29527b][_0xdb2e('0x63')]]=needsEncapsulation(_0x44e7db[_0x29527b]['question'])?encapsulate(_0x44e7db[_0x29527b][_0xdb2e('0x64')]):_0x44e7db[_0x29527b][_0xdb2e('0x64')];}}var _0x33b211=[],_0x298191={};for(var _0x19a0ee=0x0,_0x19c374=_0x50c687[_0xdb2e('0x33')];_0x19a0ee<_0x19c374;_0x19a0ee++){_0x298191={'ProjectId':_0x3bf4a2[_0xdb2e('0x41')]['id'],'SessionId':_0x50c687[_0x19a0ee]['id'],'StartTime':moment(_0x50c687[_0x19a0ee]['starttime'])[_0xdb2e('0x65')](_0xdb2e('0x66'))};for(var _0x3543a6=0x0,_0x14d1c2=_0x44e7db['length'];_0x3543a6<_0x14d1c2;_0x3543a6++){if(_0x44e7db[_0x3543a6][_0xdb2e('0x67')]==_0x50c687[_0x19a0ee]['id']&&_0x235aa4[_0xdb2e('0x68')](_0x44e7db[_0x3543a6][_0xdb2e('0x63')])){_0x298191[_0x235aa4[_0x44e7db[_0x3543a6][_0xdb2e('0x63')]]]=_0x44e7db[_0x3543a6][_0xdb2e('0x69')];}}for(var _0x59b06a in _0x235aa4){if(!_0x298191[_0xdb2e('0x68')](_0x235aa4[_0x59b06a])){_0x298191[_0x235aa4[_0x59b06a]]=null;}}_0x33b211[_0xdb2e('0x6a')](_0x298191);}return _0x33b211;}})[_0xdb2e('0x20')](function(_0x180007){if(!_[_0xdb2e('0x6b')](_0x180007)){var _0x543589=toCsv(_0x180007);var _0x1b65f2=Date[_0xdb2e('0x6c')]();fs[_0xdb2e('0x6d')](util['format'](_0xdb2e('0x6e'),_0x3bf4a2[_0xdb2e('0x41')]['id'],_0x1b65f2),_0x543589);_0x459c8c[_0xdb2e('0x6f')](_0xdb2e('0x70'),_0xdb2e('0x71')+util[_0xdb2e('0x65')](_0xdb2e('0x72'),_0x3bf4a2[_0xdb2e('0x41')]['id'],_0x1b65f2));_0x459c8c['setHeader']('Content-type','text/csv');return _0x459c8c[_0xdb2e('0x73')](util[_0xdb2e('0x65')](_0xdb2e('0x6e'),_0x3bf4a2[_0xdb2e('0x41')]['id'],_0x1b65f2));}else{return _0x459c8c[_0xdb2e('0x16')](0xcc);}})['catch'](handleError(_0x459c8c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 95f98f4..98c22eb 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 _0x15cb=['exports','define','JscriptyProject','jscripty_projects','util','api','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes'];(function(_0x238129,_0x470629){var _0x4dbd36=function(_0x33cd35){while(--_0x33cd35){_0x238129['push'](_0x238129['shift']());}};_0x4dbd36(++_0x470629);}(_0x15cb,0x16f));var _0xb15c=function(_0x1da318,_0x4b3828){_0x1da318=_0x1da318-0x0;var _0x447285=_0x15cb[_0x1da318];return _0x447285;};'use strict';var _=require('lodash');var util=require(_0xb15c('0x0'));var logger=require('../../config/logger')(_0xb15c('0x1'));var moment=require('moment');var BPromise=require(_0xb15c('0x2'));var rp=require(_0xb15c('0x3'));var fs=require('fs');var path=require(_0xb15c('0x4'));var rimraf=require(_0xb15c('0x5'));var config=require('../../config/environment');var attributes=require(_0xb15c('0x6'));module[_0xb15c('0x7')]=function(_0x50ea76,_0x5a1b40){return _0x50ea76[_0xb15c('0x8')](_0xb15c('0x9'),attributes,{'tableName':_0xb15c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f75=['JscriptyProject','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define'];(function(_0x5d0237,_0x4412ac){var _0x2d2c4b=function(_0x1bd723){while(--_0x1bd723){_0x5d0237['push'](_0x5d0237['shift']());}};_0x2d2c4b(++_0x4412ac);}(_0x1f75,0x12c));var _0x51f7=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x1f75[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x51f7('0x0'));var util=require(_0x51f7('0x1'));var logger=require(_0x51f7('0x2'))('api');var moment=require(_0x51f7('0x3'));var BPromise=require(_0x51f7('0x4'));var rp=require(_0x51f7('0x5'));var fs=require('fs');var path=require(_0x51f7('0x6'));var rimraf=require(_0x51f7('0x7'));var config=require(_0x51f7('0x8'));var attributes=require(_0x51f7('0x9'));module[_0x51f7('0xa')]=function(_0x292480,_0x22fc29){return _0x292480[_0x51f7('0xb')](_0x51f7('0xc'),attributes,{'tableName':'jscripty_projects','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 206aa3e..6b02813 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xac4a,0x13f));var _0xaac4=function(_0x372f83,_0x1118fa){_0x372f83=_0x372f83-0x0;var _0x49941b=_0xac4a[_0x372f83];return _0x49941b;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x56ee10,_0x2e35f7){var _0x149d60=function(_0x283e21){while(--_0x283e21){_0x56ee10['push'](_0x56ee10['shift']());}};_0x149d60(++_0x2e35f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7007095..db135f6 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 _0x967b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0xd4eb96,_0x577b89){var _0x20382a=function(_0x1a337f){while(--_0x1a337f){_0xd4eb96['push'](_0xd4eb96['shift']());}};_0x20382a(++_0x577b89);}(_0x967b,0x1af));var _0xb967=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x967b[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0xb967('0x0'));var util=require(_0xb967('0x1'));var path=require(_0xb967('0x2'));var timeout=require(_0xb967('0x3'));var express=require(_0xb967('0x4'));var router=express['Router']();var fs_extra=require(_0xb967('0x5'));var auth=require(_0xb967('0x6'));var interaction=require(_0xb967('0x7'));var config=require(_0xb967('0x8'));var controller=require(_0xb967('0x9'));router['get']('/',auth[_0xb967('0xa')](),controller['index']);router[_0xb967('0xb')](_0xb967('0xc'),auth[_0xb967('0xa')](),controller[_0xb967('0xd')]);router[_0xb967('0xb')](_0xb967('0xe'),auth['isAuthenticated'](),controller[_0xb967('0xf')]);router[_0xb967('0x10')]('/',auth[_0xb967('0xa')](),controller[_0xb967('0x11')]);router[_0xb967('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb967('0x13')]);router[_0xb967('0x14')](_0xb967('0xe'),auth[_0xb967('0xa')](),controller[_0xb967('0x15')]);module[_0xb967('0x16')]=router; \ No newline at end of file +var _0x305f=['Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x21068f,_0x50b30e){var _0x21e9f2=function(_0x7aee7){while(--_0x7aee7){_0x21068f['push'](_0x21068f['shift']());}};_0x21e9f2(++_0x50b30e);}(_0x305f,0x79));var _0xf305=function(_0x487921,_0x135bcb){_0x487921=_0x487921-0x0;var _0x20ef38=_0x305f[_0x487921];return _0x20ef38;};'use strict';var multer=require(_0xf305('0x0'));var util=require(_0xf305('0x1'));var path=require(_0xf305('0x2'));var timeout=require(_0xf305('0x3'));var express=require(_0xf305('0x4'));var router=express[_0xf305('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf305('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf305('0x7'));var controller=require(_0xf305('0x8'));router[_0xf305('0x9')]('/',auth[_0xf305('0xa')](),controller[_0xf305('0xb')]);router[_0xf305('0x9')]('/describe',auth[_0xf305('0xa')](),controller[_0xf305('0xc')]);router[_0xf305('0x9')]('/:id',auth[_0xf305('0xa')](),controller[_0xf305('0xd')]);router[_0xf305('0xe')]('/',auth[_0xf305('0xa')](),controller['create']);router[_0xf305('0xf')](_0xf305('0x10'),auth['isAuthenticated'](),controller[_0xf305('0x11')]);router[_0xf305('0x12')](_0xf305('0x10'),auth[_0xf305('0xa')](),controller[_0xf305('0x13')]);module[_0xf305('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 6cd5b77..2249f84 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(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7a54,0x106));var _0x47a5=function(_0x398001,_0x4b0934){_0x398001=_0x398001-0x0;var _0x431571=_0x7a54[_0x398001];return _0x431571;};'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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x47211d,_0x17e1b1){_0x47211d=_0x47211d-0x0;var _0x441836=_0x7a54[_0x47211d];return _0x441836;};'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 fa4b106..7446446 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 _0x9331=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','count','then','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','zip-dir','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','reject','save','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x5cff18,_0x5615f5){var _0x33027d=function(_0x1328aa){while(--_0x1328aa){_0x5cff18['push'](_0x5cff18['shift']());}};_0x33027d(++_0x5615f5);}(_0x9331,0x13c));var _0x1933=function(_0x5e4ffa,_0x56154d){_0x5e4ffa=_0x5e4ffa-0x0;var _0x43a656=_0x9331[_0x5e4ffa];return _0x43a656;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1933('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1933('0x1'));var util=require(_0x1933('0x2'));var path=require('path');var sox=require(_0x1933('0x3'));var csv=require(_0x1933('0x4'));var ejs=require(_0x1933('0x5'));var fs=require('fs');var fs_extra=require(_0x1933('0x6'));var _=require(_0x1933('0x7'));var squel=require('squel');var crypto=require(_0x1933('0x8'));var jsforce=require(_0x1933('0x9'));var deskjs=require(_0x1933('0xa'));var toCsv=require(_0x1933('0x4'));var querystring=require(_0x1933('0xb'));var Papa=require(_0x1933('0xc'));var Redis=require(_0x1933('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1933('0xe'));var hardwareService=require(_0x1933('0xf'));var logger=require(_0x1933('0x10'))('api');var utils=require(_0x1933('0x11'));var config=require(_0x1933('0x12'));var licenseUtil=require(_0x1933('0x13'));var db=require(_0x1933('0x14'))['db'];function respondWithStatusCode(_0x402842,_0x2227ac){_0x2227ac=_0x2227ac||0xcc;return function(_0x581da8){if(_0x581da8){return _0x402842[_0x1933('0x15')](_0x2227ac);}return _0x402842[_0x1933('0x16')](_0x2227ac)[_0x1933('0x17')]();};}function respondWithResult(_0x2bf27,_0x7cb54c){_0x7cb54c=_0x7cb54c||0xc8;return function(_0x515d31){if(_0x515d31){return _0x2bf27[_0x1933('0x16')](_0x7cb54c)['json'](_0x515d31);}};}function respondWithFilteredResult(_0x51d678,_0x35d2dd){return function(_0x27abba){if(_0x27abba){var _0x10abef=typeof _0x35d2dd['offset']===_0x1933('0x18')&&typeof _0x35d2dd[_0x1933('0x19')]==='undefined';var _0x3bfbe7=_0x27abba['count'];var _0x2c841c=_0x10abef?0x0:_0x35d2dd[_0x1933('0x1a')];var _0x3dedc5=_0x10abef?_0x27abba['count']:_0x35d2dd[_0x1933('0x1a')]+_0x35d2dd['limit'];var _0x1a9338;if(_0x3dedc5>=_0x3bfbe7){_0x3dedc5=_0x3bfbe7;_0x1a9338=0xc8;}else{_0x1a9338=0xce;}_0x51d678[_0x1933('0x16')](_0x1a9338);return _0x51d678[_0x1933('0x1b')](_0x1933('0x1c'),_0x2c841c+'-'+_0x3dedc5+'/'+_0x3bfbe7)[_0x1933('0x1d')](_0x27abba);}return null;};}function patchUpdates(_0x2a7498){return function(_0x22b8c1){try{jsonpatch['apply'](_0x22b8c1,_0x2a7498,!![]);}catch(_0x3c014e){return BPromise[_0x1933('0x1e')](_0x3c014e);}return _0x22b8c1[_0x1933('0x1f')]();};}function saveUpdates(_0x109ef7,_0x1d5000){return function(_0x38b88d){if(_0x38b88d){return _0x38b88d['update'](_0x109ef7)['then'](function(_0x3bf79d){return _0x3bf79d;});}return null;};}function removeEntity(_0x536ef2,_0x29d2f1){return function(_0x26fd3e){if(_0x26fd3e){return _0x26fd3e['destroy']()['then'](function(){_0x536ef2['status'](0xcc)[_0x1933('0x17')]();});}};}function handleEntityNotFound(_0x52ae32,_0x3d54be){return function(_0x25c6b3){if(!_0x25c6b3){_0x52ae32[_0x1933('0x15')](0x194);}return _0x25c6b3;};}function handleError(_0x26c980,_0x27874f){_0x27874f=_0x27874f||0x1f4;return function(_0x6061d4){logger[_0x1933('0x20')](_0x6061d4[_0x1933('0x21')]);if(_0x6061d4['name']){delete _0x6061d4[_0x1933('0x22')];}_0x26c980['status'](_0x27874f)['send'](_0x6061d4);};}exports[_0x1933('0x23')]=function(_0x3c9fcd,_0x44146f){var _0x2873c7={},_0x9ce0fa={},_0x324f17={'count':0x0,'rows':[]};var _0x320183=_[_0x1933('0x24')](db[_0x1933('0x25')][_0x1933('0x26')],function(_0x5f22c8){return{'name':_0x5f22c8[_0x1933('0x27')],'type':_0x5f22c8[_0x1933('0x28')][_0x1933('0x29')]};});_0x9ce0fa[_0x1933('0x2a')]=_[_0x1933('0x24')](_0x320183,_0x1933('0x22'));_0x9ce0fa[_0x1933('0x2b')]=_[_0x1933('0x2c')](_0x3c9fcd['query']);_0x9ce0fa[_0x1933('0x2d')]=_[_0x1933('0x2e')](_0x9ce0fa[_0x1933('0x2a')],_0x9ce0fa[_0x1933('0x2b')]);_0x2873c7[_0x1933('0x2f')]=_[_0x1933('0x2e')](_0x9ce0fa['model'],qs[_0x1933('0x30')](_0x3c9fcd[_0x1933('0x2b')][_0x1933('0x30')]));_0x2873c7[_0x1933('0x2f')]=_0x2873c7[_0x1933('0x2f')][_0x1933('0x31')]?_0x2873c7['attributes']:_0x9ce0fa[_0x1933('0x2a')];if(!_0x3c9fcd[_0x1933('0x2b')][_0x1933('0x32')](_0x1933('0x33'))){_0x2873c7[_0x1933('0x19')]=qs[_0x1933('0x19')](_0x3c9fcd['query'][_0x1933('0x19')]);_0x2873c7[_0x1933('0x1a')]=qs['offset'](_0x3c9fcd['query'][_0x1933('0x1a')]);}_0x2873c7[_0x1933('0x34')]=qs[_0x1933('0x35')](_0x3c9fcd[_0x1933('0x2b')][_0x1933('0x35')]);_0x2873c7['where']=qs['filters'](_['pick'](_0x3c9fcd[_0x1933('0x2b')],_0x9ce0fa[_0x1933('0x2d')]),_0x320183);if(_0x3c9fcd[_0x1933('0x2b')][_0x1933('0x36')]){_0x2873c7['where']=_[_0x1933('0x37')](_0x2873c7[_0x1933('0x38')],{'$or':_[_0x1933('0x24')](_0x320183,function(_0x175fc4){if(_0x175fc4['type']!==_0x1933('0x39')){var _0x33d960={};_0x33d960[_0x175fc4[_0x1933('0x22')]]={'$like':'%'+_0x3c9fcd['query']['filter']+'%'};return _0x33d960;}})});}_0x2873c7=_['merge']({},_0x2873c7,_0x3c9fcd[_0x1933('0x3a')]);var _0x2e56cd={'where':_0x2873c7['where']};return db[_0x1933('0x25')][_0x1933('0x3b')](_0x2e56cd)[_0x1933('0x3c')](function(_0x15fd6c){_0x324f17[_0x1933('0x3b')]=_0x15fd6c;if(_0x3c9fcd[_0x1933('0x2b')][_0x1933('0x3d')]){_0x2873c7[_0x1933('0x3e')]=[{'all':!![]}];}return db[_0x1933('0x25')][_0x1933('0x3f')](_0x2873c7);})[_0x1933('0x3c')](function(_0x547ada){_0x324f17['rows']=_0x547ada;return _0x324f17;})['then'](respondWithFilteredResult(_0x44146f,_0x2873c7))[_0x1933('0x40')](handleError(_0x44146f,null));};exports[_0x1933('0x41')]=function(_0x8e59b4,_0x5176ee){var _0x36621={'raw':!![],'where':{'id':_0x8e59b4[_0x1933('0x42')]['id']}},_0x44e79f={};_0x44e79f['model']=_[_0x1933('0x2c')](db['JscriptyQuestionReport'][_0x1933('0x26')]);_0x44e79f[_0x1933('0x2b')]=_['keys'](_0x8e59b4[_0x1933('0x2b')]);_0x44e79f['filters']=_[_0x1933('0x2e')](_0x44e79f[_0x1933('0x2a')],_0x44e79f['query']);_0x36621[_0x1933('0x2f')]=_[_0x1933('0x2e')](_0x44e79f['model'],qs[_0x1933('0x30')](_0x8e59b4['query'][_0x1933('0x30')]));_0x36621['attributes']=_0x36621['attributes']['length']?_0x36621['attributes']:_0x44e79f[_0x1933('0x2a')];if(_0x8e59b4['query'][_0x1933('0x3d')]){_0x36621[_0x1933('0x3e')]=[{'all':!![]}];}_0x36621=_[_0x1933('0x37')]({},_0x36621,_0x8e59b4[_0x1933('0x3a')]);return db[_0x1933('0x25')][_0x1933('0x43')](_0x36621)[_0x1933('0x3c')](handleEntityNotFound(_0x5176ee,null))['then'](respondWithResult(_0x5176ee,null))[_0x1933('0x40')](handleError(_0x5176ee,null));};exports[_0x1933('0x44')]=function(_0x2bc262,_0x4d9b0b){return db[_0x1933('0x25')]['create'](_0x2bc262[_0x1933('0x45')],{})['then'](respondWithResult(_0x4d9b0b,0xc9))[_0x1933('0x40')](handleError(_0x4d9b0b,null));};exports['update']=function(_0x1b72b2,_0x4aa7b3){if(_0x1b72b2[_0x1933('0x45')]['id']){delete _0x1b72b2[_0x1933('0x45')]['id'];}return db[_0x1933('0x25')][_0x1933('0x43')]({'where':{'id':_0x1b72b2[_0x1933('0x42')]['id']}})[_0x1933('0x3c')](handleEntityNotFound(_0x4aa7b3,null))[_0x1933('0x3c')](saveUpdates(_0x1b72b2[_0x1933('0x45')],null))[_0x1933('0x3c')](respondWithResult(_0x4aa7b3,null))[_0x1933('0x40')](handleError(_0x4aa7b3,null));};exports[_0x1933('0x46')]=function(_0x5e45e5,_0x1802c7){return db[_0x1933('0x25')][_0x1933('0x43')]({'where':{'id':_0x5e45e5['params']['id']}})[_0x1933('0x3c')](handleEntityNotFound(_0x1802c7,null))[_0x1933('0x3c')](removeEntity(_0x1802c7,null))['catch'](handleError(_0x1802c7,null));};exports[_0x1933('0x47')]=function(_0x9155e8,_0xb765e6){return db['JscriptyQuestionReport']['describe']()[_0x1933('0x3c')](respondWithResult(_0xb765e6,null))[_0x1933('0x40')](handleError(_0xb765e6,null));}; \ No newline at end of file +var _0xc537=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','JscriptyQuestionReport','rawAttributes','fieldName','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x23f0bd,_0x580b18){var _0x322ca4=function(_0x1ebb72){while(--_0x1ebb72){_0x23f0bd['push'](_0x23f0bd['shift']());}};_0x322ca4(++_0x580b18);}(_0xc537,0x165));var _0x7c53=function(_0x3efa82,_0x184ce9){_0x3efa82=_0x3efa82-0x0;var _0x1de7b1=_0xc537[_0x3efa82];return _0x1de7b1;};'use strict';var emlformat=require(_0x7c53('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c53('0x1'));var jsonpatch=require(_0x7c53('0x2'));var rp=require(_0x7c53('0x3'));var moment=require('moment');var BPromise=require(_0x7c53('0x4'));var Mustache=require('mustache');var util=require(_0x7c53('0x5'));var path=require(_0x7c53('0x6'));var sox=require(_0x7c53('0x7'));var csv=require(_0x7c53('0x8'));var ejs=require(_0x7c53('0x9'));var fs=require('fs');var fs_extra=require(_0x7c53('0xa'));var _=require(_0x7c53('0xb'));var squel=require('squel');var crypto=require(_0x7c53('0xc'));var jsforce=require(_0x7c53('0xd'));var deskjs=require(_0x7c53('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7c53('0xf'));var Papa=require(_0x7c53('0x10'));var Redis=require(_0x7c53('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7c53('0x12'));var hardwareService=require(_0x7c53('0x13'));var logger=require(_0x7c53('0x14'))(_0x7c53('0x15'));var utils=require(_0x7c53('0x16'));var config=require(_0x7c53('0x17'));var licenseUtil=require(_0x7c53('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d46fd,_0x33f2fe){_0x33f2fe=_0x33f2fe||0xcc;return function(_0x2addc1){if(_0x2addc1){return _0x5d46fd[_0x7c53('0x19')](_0x33f2fe);}return _0x5d46fd['status'](_0x33f2fe)[_0x7c53('0x1a')]();};}function respondWithResult(_0x48fe05,_0x351b5b){_0x351b5b=_0x351b5b||0xc8;return function(_0x4c345d){if(_0x4c345d){return _0x48fe05['status'](_0x351b5b)['json'](_0x4c345d);}};}function respondWithFilteredResult(_0x4f2bf4,_0x4057fe){return function(_0x7c32d8){if(_0x7c32d8){var _0x1c12e1=typeof _0x4057fe['offset']===_0x7c53('0x1b')&&typeof _0x4057fe[_0x7c53('0x1c')]==='undefined';var _0x1a99f7=_0x7c32d8[_0x7c53('0x1d')];var _0x92a28d=_0x1c12e1?0x0:_0x4057fe['offset'];var _0x1dcebd=_0x1c12e1?_0x7c32d8[_0x7c53('0x1d')]:_0x4057fe[_0x7c53('0x1e')]+_0x4057fe[_0x7c53('0x1c')];var _0x334c0a;if(_0x1dcebd>=_0x1a99f7){_0x1dcebd=_0x1a99f7;_0x334c0a=0xc8;}else{_0x334c0a=0xce;}_0x4f2bf4[_0x7c53('0x1f')](_0x334c0a);return _0x4f2bf4[_0x7c53('0x20')](_0x7c53('0x21'),_0x92a28d+'-'+_0x1dcebd+'/'+_0x1a99f7)[_0x7c53('0x22')](_0x7c32d8);}return null;};}function patchUpdates(_0x1a9caa){return function(_0x694c67){try{jsonpatch[_0x7c53('0x23')](_0x694c67,_0x1a9caa,!![]);}catch(_0x1e4193){return BPromise[_0x7c53('0x24')](_0x1e4193);}return _0x694c67[_0x7c53('0x25')]();};}function saveUpdates(_0x56bba0,_0x491acc){return function(_0x431598){if(_0x431598){return _0x431598[_0x7c53('0x26')](_0x56bba0)['then'](function(_0x4f39ff){return _0x4f39ff;});}return null;};}function removeEntity(_0x71f69d,_0x3f5181){return function(_0x1a5629){if(_0x1a5629){return _0x1a5629[_0x7c53('0x27')]()['then'](function(){_0x71f69d[_0x7c53('0x1f')](0xcc)[_0x7c53('0x1a')]();});}};}function handleEntityNotFound(_0x18568d,_0x19df09){return function(_0x26a69d){if(!_0x26a69d){_0x18568d[_0x7c53('0x19')](0x194);}return _0x26a69d;};}function handleError(_0x57c613,_0x23668d){_0x23668d=_0x23668d||0x1f4;return function(_0x3be410){logger['error'](_0x3be410[_0x7c53('0x28')]);if(_0x3be410[_0x7c53('0x29')]){delete _0x3be410[_0x7c53('0x29')];}_0x57c613['status'](_0x23668d)['send'](_0x3be410);};}exports[_0x7c53('0x2a')]=function(_0x5b246a,_0x54794c){var _0xb5e5ac={},_0x582251={},_0x2a1f79={'count':0x0,'rows':[]};var _0x52ef10=_['map'](db[_0x7c53('0x2b')][_0x7c53('0x2c')],function(_0x3ef633){return{'name':_0x3ef633[_0x7c53('0x2d')],'type':_0x3ef633['type']['key']};});_0x582251['model']=_['map'](_0x52ef10,_0x7c53('0x29'));_0x582251[_0x7c53('0x2e')]=_['keys'](_0x5b246a[_0x7c53('0x2e')]);_0x582251[_0x7c53('0x2f')]=_['intersection'](_0x582251[_0x7c53('0x30')],_0x582251['query']);_0xb5e5ac[_0x7c53('0x31')]=_[_0x7c53('0x32')](_0x582251[_0x7c53('0x30')],qs[_0x7c53('0x33')](_0x5b246a[_0x7c53('0x2e')]['fields']));_0xb5e5ac[_0x7c53('0x31')]=_0xb5e5ac[_0x7c53('0x31')][_0x7c53('0x34')]?_0xb5e5ac[_0x7c53('0x31')]:_0x582251['model'];if(!_0x5b246a['query']['hasOwnProperty'](_0x7c53('0x35'))){_0xb5e5ac[_0x7c53('0x1c')]=qs['limit'](_0x5b246a[_0x7c53('0x2e')][_0x7c53('0x1c')]);_0xb5e5ac[_0x7c53('0x1e')]=qs['offset'](_0x5b246a['query'][_0x7c53('0x1e')]);}_0xb5e5ac[_0x7c53('0x36')]=qs[_0x7c53('0x37')](_0x5b246a[_0x7c53('0x2e')][_0x7c53('0x37')]);_0xb5e5ac[_0x7c53('0x38')]=qs[_0x7c53('0x2f')](_[_0x7c53('0x39')](_0x5b246a[_0x7c53('0x2e')],_0x582251[_0x7c53('0x2f')]),_0x52ef10);if(_0x5b246a[_0x7c53('0x2e')][_0x7c53('0x3a')]){_0xb5e5ac[_0x7c53('0x38')]=_[_0x7c53('0x3b')](_0xb5e5ac['where'],{'$or':_['map'](_0x52ef10,function(_0x5ee8b5){if(_0x5ee8b5[_0x7c53('0x3c')]!==_0x7c53('0x3d')){var _0x4926c7={};_0x4926c7[_0x5ee8b5[_0x7c53('0x29')]]={'$like':'%'+_0x5b246a['query'][_0x7c53('0x3a')]+'%'};return _0x4926c7;}})});}_0xb5e5ac=_[_0x7c53('0x3b')]({},_0xb5e5ac,_0x5b246a[_0x7c53('0x3e')]);var _0x5a156c={'where':_0xb5e5ac[_0x7c53('0x38')]};return db[_0x7c53('0x2b')][_0x7c53('0x1d')](_0x5a156c)[_0x7c53('0x3f')](function(_0x1f0891){_0x2a1f79[_0x7c53('0x1d')]=_0x1f0891;if(_0x5b246a[_0x7c53('0x2e')][_0x7c53('0x40')]){_0xb5e5ac[_0x7c53('0x41')]=[{'all':!![]}];}return db[_0x7c53('0x2b')][_0x7c53('0x42')](_0xb5e5ac);})[_0x7c53('0x3f')](function(_0x146716){_0x2a1f79['rows']=_0x146716;return _0x2a1f79;})[_0x7c53('0x3f')](respondWithFilteredResult(_0x54794c,_0xb5e5ac))[_0x7c53('0x43')](handleError(_0x54794c,null));};exports[_0x7c53('0x44')]=function(_0x32a613,_0x250860){var _0x1ef725={'raw':!![],'where':{'id':_0x32a613[_0x7c53('0x45')]['id']}},_0x36c34c={};_0x36c34c[_0x7c53('0x30')]=_[_0x7c53('0x46')](db[_0x7c53('0x2b')]['rawAttributes']);_0x36c34c[_0x7c53('0x2e')]=_['keys'](_0x32a613[_0x7c53('0x2e')]);_0x36c34c[_0x7c53('0x2f')]=_['intersection'](_0x36c34c[_0x7c53('0x30')],_0x36c34c[_0x7c53('0x2e')]);_0x1ef725[_0x7c53('0x31')]=_[_0x7c53('0x32')](_0x36c34c[_0x7c53('0x30')],qs[_0x7c53('0x33')](_0x32a613[_0x7c53('0x2e')][_0x7c53('0x33')]));_0x1ef725[_0x7c53('0x31')]=_0x1ef725[_0x7c53('0x31')][_0x7c53('0x34')]?_0x1ef725[_0x7c53('0x31')]:_0x36c34c[_0x7c53('0x30')];if(_0x32a613[_0x7c53('0x2e')][_0x7c53('0x40')]){_0x1ef725[_0x7c53('0x41')]=[{'all':!![]}];}_0x1ef725=_[_0x7c53('0x3b')]({},_0x1ef725,_0x32a613[_0x7c53('0x3e')]);return db[_0x7c53('0x2b')][_0x7c53('0x47')](_0x1ef725)[_0x7c53('0x3f')](handleEntityNotFound(_0x250860,null))['then'](respondWithResult(_0x250860,null))['catch'](handleError(_0x250860,null));};exports[_0x7c53('0x48')]=function(_0x51c333,_0x3548d0){return db[_0x7c53('0x2b')][_0x7c53('0x48')](_0x51c333['body'],{})[_0x7c53('0x3f')](respondWithResult(_0x3548d0,0xc9))[_0x7c53('0x43')](handleError(_0x3548d0,null));};exports[_0x7c53('0x26')]=function(_0x16b72a,_0x5a3a3c){if(_0x16b72a[_0x7c53('0x49')]['id']){delete _0x16b72a[_0x7c53('0x49')]['id'];}return db[_0x7c53('0x2b')][_0x7c53('0x47')]({'where':{'id':_0x16b72a[_0x7c53('0x45')]['id']}})[_0x7c53('0x3f')](handleEntityNotFound(_0x5a3a3c,null))['then'](saveUpdates(_0x16b72a['body'],null))['then'](respondWithResult(_0x5a3a3c,null))[_0x7c53('0x43')](handleError(_0x5a3a3c,null));};exports[_0x7c53('0x27')]=function(_0x3ed531,_0x3c3cb4){return db[_0x7c53('0x2b')][_0x7c53('0x47')]({'where':{'id':_0x3ed531[_0x7c53('0x45')]['id']}})[_0x7c53('0x3f')](handleEntityNotFound(_0x3c3cb4,null))['then'](removeEntity(_0x3c3cb4,null))['catch'](handleError(_0x3c3cb4,null));};exports[_0x7c53('0x4a')]=function(_0x563213,_0xb28670){return db[_0x7c53('0x2b')]['describe']()['then'](respondWithResult(_0xb28670,null))[_0x7c53('0x43')](handleError(_0xb28670,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 05280bb..f6d5f11 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 _0x340a=['../../config/environment','exports','define','JscriptyQuestionReport','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1b852e,_0x185f0d){var _0x2fd5cf=function(_0x1dc638){while(--_0x1dc638){_0x1b852e['push'](_0x1b852e['shift']());}};_0x2fd5cf(++_0x185f0d);}(_0x340a,0x190));var _0xa340=function(_0x145486,_0x28b58b){_0x145486=_0x145486-0x0;var _0x548605=_0x340a[_0x145486];return _0x548605;};'use strict';var _=require(_0xa340('0x0'));var util=require('util');var logger=require(_0xa340('0x1'))(_0xa340('0x2'));var moment=require('moment');var BPromise=require(_0xa340('0x3'));var rp=require(_0xa340('0x4'));var fs=require('fs');var path=require(_0xa340('0x5'));var rimraf=require(_0xa340('0x6'));var config=require(_0xa340('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xa340('0x8')]=function(_0x5f1593,_0x3b6b65){return _0x5f1593[_0xa340('0x9')](_0xa340('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce1d=['util','../../config/logger','api','moment','bluebird','./jscriptyQuestionReport.attributes','define','lodash'];(function(_0x274615,_0x93ca66){var _0x4df2fb=function(_0x2b71ee){while(--_0x2b71ee){_0x274615['push'](_0x274615['shift']());}};_0x4df2fb(++_0x93ca66);}(_0xce1d,0x10f));var _0xdce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdce1('0x0'));var util=require(_0xdce1('0x1'));var logger=require(_0xdce1('0x2'))(_0xdce1('0x3'));var moment=require(_0xdce1('0x4'));var BPromise=require(_0xdce1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdce1('0x6'));module['exports']=function(_0x3db475,_0x51efe0){return _0x3db475[_0xdce1('0x7')]('JscriptyQuestionReport',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 566ef2f..5ff226e 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 _0xa70a=['error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x47cf60,_0x1b1f54){var _0x359c39=function(_0x3a2fde){while(--_0x3a2fde){_0x47cf60['push'](_0x47cf60['shift']());}};_0x359c39(++_0x1b1f54);}(_0xa70a,0xd6));var _0xaa70=function(_0x473111,_0x48a88a){_0x473111=_0x473111-0x0;var _0x240226=_0xa70a[_0x473111];return _0x240226;};'use strict';var _=require('lodash');var util=require(_0xaa70('0x0'));var moment=require(_0xaa70('0x1'));var BPromise=require('bluebird');var rs=require(_0xaa70('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa70('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa70('0x4'))('rpc');var config=require(_0xaa70('0x5'));var jayson=require(_0xaa70('0x6'));var client=jayson['client'][_0xaa70('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21bb43,_0x2a4dcf,_0x3c10aa){return new BPromise(function(_0x4c42f7,_0x588a91){return client[_0xaa70('0x8')](_0x21bb43,_0x3c10aa)[_0xaa70('0x9')](function(_0x63ad45){logger[_0xaa70('0xa')](_0xaa70('0xb'),_0x2a4dcf,_0xaa70('0xc'));logger['debug'](_0xaa70('0xd'),_0x2a4dcf,'request\x20sent',JSON['stringify'](_0x63ad45));if(_0x63ad45[_0xaa70('0xe')]){if(_0x63ad45[_0xaa70('0xe')][_0xaa70('0xf')]===0x1f4){logger[_0xaa70('0xe')](_0xaa70('0xb'),_0x2a4dcf,_0x63ad45[_0xaa70('0xe')][_0xaa70('0x10')]);return _0x588a91(_0x63ad45[_0xaa70('0xe')][_0xaa70('0x10')]);}logger[_0xaa70('0xe')](_0xaa70('0xb'),_0x2a4dcf,_0x63ad45[_0xaa70('0xe')][_0xaa70('0x10')]);return _0x4c42f7(_0x63ad45[_0xaa70('0xe')][_0xaa70('0x10')]);}else{logger[_0xaa70('0xa')](_0xaa70('0xb'),_0x2a4dcf,'request\x20sent');_0x4c42f7(_0x63ad45[_0xaa70('0x11')][_0xaa70('0x10')]);}})[_0xaa70('0x12')](function(_0xd011a5){logger[_0xaa70('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2a4dcf,_0xd011a5);_0x588a91(_0xd011a5);});});} \ No newline at end of file +var _0x0205=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x184b1d,_0x1dea81){var _0x36ae4e=function(_0x30c64e){while(--_0x30c64e){_0x184b1d['push'](_0x184b1d['shift']());}};_0x36ae4e(++_0x1dea81);}(_0x0205,0xb7));var _0x5020=function(_0x50371b,_0x17370c){_0x50371b=_0x50371b-0x0;var _0x131702=_0x0205[_0x50371b];return _0x131702;};'use strict';var _=require(_0x5020('0x0'));var util=require(_0x5020('0x1'));var moment=require('moment');var BPromise=require(_0x5020('0x2'));var rs=require(_0x5020('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5020('0x4'))['db'];var utils=require(_0x5020('0x5'));var logger=require(_0x5020('0x6'))(_0x5020('0x7'));var config=require(_0x5020('0x8'));var jayson=require(_0x5020('0x9'));var client=jayson[_0x5020('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23ff1c,_0x3e2751,_0x3ed6d3){return new BPromise(function(_0x2b321b,_0x4ac3d6){return client[_0x5020('0xb')](_0x23ff1c,_0x3ed6d3)[_0x5020('0xc')](function(_0x2697f6){logger[_0x5020('0xd')](_0x5020('0xe'),_0x3e2751,'request\x20sent');logger[_0x5020('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3e2751,_0x5020('0x10'),JSON['stringify'](_0x2697f6));if(_0x2697f6[_0x5020('0x11')]){if(_0x2697f6[_0x5020('0x11')]['code']===0x1f4){logger[_0x5020('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3e2751,_0x2697f6[_0x5020('0x11')]['message']);return _0x4ac3d6(_0x2697f6['error'][_0x5020('0x12')]);}logger[_0x5020('0x11')](_0x5020('0xe'),_0x3e2751,_0x2697f6['error'][_0x5020('0x12')]);return _0x2b321b(_0x2697f6[_0x5020('0x11')]['message']);}else{logger[_0x5020('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3e2751,_0x5020('0x10'));_0x2b321b(_0x2697f6[_0x5020('0x13')]['message']);}})[_0x5020('0x14')](function(_0x5cb84a){logger[_0x5020('0x11')](_0x5020('0xe'),_0x3e2751,_0x5cb84a);_0x4ac3d6(_0x5cb84a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e37d45b..528ee31 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 _0x3318=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','show','/:id/questions','getQuestions','post','create','put','/:id','update'];(function(_0xa46b01,_0xcf8db5){var _0x4a023d=function(_0x4b622d){while(--_0x4b622d){_0xa46b01['push'](_0xa46b01['shift']());}};_0x4a023d(++_0xcf8db5);}(_0x3318,0x191));var _0x8331=function(_0x19fab3,_0x2379c7){_0x19fab3=_0x19fab3-0x0;var _0x3ed5f7=_0x3318[_0x19fab3];return _0x3ed5f7;};'use strict';var multer=require(_0x8331('0x0'));var util=require('util');var path=require(_0x8331('0x1'));var timeout=require(_0x8331('0x2'));var express=require(_0x8331('0x3'));var router=express[_0x8331('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8331('0x5'));var config=require('../../config/environment');var controller=require(_0x8331('0x6'));router[_0x8331('0x7')]('/',auth[_0x8331('0x8')](),controller['index']);router[_0x8331('0x7')](_0x8331('0x9'),auth[_0x8331('0x8')](),controller[_0x8331('0xa')]);router[_0x8331('0x7')]('/:id',auth[_0x8331('0x8')](),controller[_0x8331('0xb')]);router['get'](_0x8331('0xc'),auth['isAuthenticated'](),controller[_0x8331('0xd')]);router[_0x8331('0xe')]('/',auth[_0x8331('0x8')](),controller[_0x8331('0xf')]);router[_0x8331('0x10')](_0x8331('0x11'),auth[_0x8331('0x8')](),controller[_0x8331('0x12')]);router['delete'](_0x8331('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x8331('0x13')]=router; \ No newline at end of file +var _0xef7d=['put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','/:id/questions','getQuestions','post'];(function(_0x2d3eab,_0x3d2b7f){var _0x4f101e=function(_0x81c038){while(--_0x81c038){_0x2d3eab['push'](_0x2d3eab['shift']());}};_0x4f101e(++_0x3d2b7f);}(_0xef7d,0x158));var _0xdef7=function(_0x3eac77,_0x3153c1){_0x3eac77=_0x3eac77-0x0;var _0x180cf2=_0xef7d[_0x3eac77];return _0x180cf2;};'use strict';var multer=require(_0xdef7('0x0'));var util=require(_0xdef7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdef7('0x2'));var router=express[_0xdef7('0x3')]();var fs_extra=require(_0xdef7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdef7('0x5'));var config=require(_0xdef7('0x6'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0xdef7('0x7')](),controller[_0xdef7('0x8')]);router[_0xdef7('0x9')](_0xdef7('0xa'),auth[_0xdef7('0x7')](),controller['describe']);router['get'](_0xdef7('0xb'),auth[_0xdef7('0x7')](),controller[_0xdef7('0xc')]);router[_0xdef7('0x9')](_0xdef7('0xd'),auth['isAuthenticated'](),controller[_0xdef7('0xe')]);router[_0xdef7('0xf')]('/',auth[_0xdef7('0x7')](),controller['create']);router[_0xdef7('0x10')](_0xdef7('0xb'),auth[_0xdef7('0x7')](),controller[_0xdef7('0x11')]);router['delete'](_0xdef7('0xb'),auth['isAuthenticated'](),controller[_0xdef7('0x12')]);module[_0xdef7('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index d76c0bf..06c6113 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 _0x4af7=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','format','STRING'];(function(_0x488982,_0x324e07){var _0xa4cad6=function(_0x48492f){while(--_0x48492f){_0x488982['push'](_0x488982['shift']());}};_0xa4cad6(++_0x324e07);}(_0x4af7,0x191));var _0x74af=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x4af7[_0x368587];return _0x42d33c;};'use strict';var moment=require(_0x74af('0x0'));var Sequelize=require(_0x74af('0x1'));module[_0x74af('0x2')]={'starttime':{'type':Sequelize[_0x74af('0x3')],'set':function(_0xdf4474){this[_0x74af('0x4')]('starttime',_0xdf4474);this[_0x74af('0x4')]('endtime',moment()[_0x74af('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x74af('0x3')]},'membername':{'type':Sequelize[_0x74af('0x6')]},'projectname':{'type':Sequelize[_0x74af('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x74af('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x74af('0x6')]},'completed':{'type':Sequelize[_0x74af('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x9c46=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','starttime'];(function(_0x17ad39,_0x4c230a){var _0x6e67bf=function(_0x2089a8){while(--_0x2089a8){_0x17ad39['push'](_0x17ad39['shift']());}};_0x6e67bf(++_0x4c230a);}(_0x9c46,0x1e1));var _0x69c4=function(_0x3bb99f,_0x2fdc66){_0x3bb99f=_0x3bb99f-0x0;var _0x1bec1a=_0x9c46[_0x3bb99f];return _0x1bec1a;};'use strict';var moment=require(_0x69c4('0x0'));var Sequelize=require(_0x69c4('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x69c4('0x2')],'set':function(_0x588358){this[_0x69c4('0x3')](_0x69c4('0x4'),_0x588358);this[_0x69c4('0x3')]('endtime',moment()[_0x69c4('0x5')](_0x69c4('0x6')));}},'endtime':{'type':Sequelize[_0x69c4('0x2')]},'membername':{'type':Sequelize[_0x69c4('0x7')]},'projectname':{'type':Sequelize[_0x69c4('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x69c4('0x7')]},'calleridname':{'type':Sequelize[_0x69c4('0x7')]},'calleridnum':{'type':Sequelize[_0x69c4('0x7')]},'completed':{'type':Sequelize[_0x69c4('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index e0e4562..62243e4 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 _0x0e68=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','length','include','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','rows','eml-format','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x2d9e49,_0x75ba2a){var _0x5dc7e5=function(_0xae4325){while(--_0xae4325){_0x2d9e49['push'](_0x2d9e49['shift']());}};_0x5dc7e5(++_0x75ba2a);}(_0x0e68,0xdd));var _0x80e6=function(_0xc88ea8,_0x4a15ef){_0xc88ea8=_0xc88ea8-0x0;var _0x83abcc=_0x0e68[_0xc88ea8];return _0x83abcc;};'use strict';var emlformat=require(_0x80e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x80e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x80e6('0x2'));var Mustache=require(_0x80e6('0x3'));var util=require(_0x80e6('0x4'));var path=require('path');var sox=require(_0x80e6('0x5'));var csv=require(_0x80e6('0x6'));var ejs=require(_0x80e6('0x7'));var fs=require('fs');var fs_extra=require(_0x80e6('0x8'));var _=require(_0x80e6('0x9'));var squel=require(_0x80e6('0xa'));var crypto=require(_0x80e6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x80e6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x80e6('0xd'));var Papa=require(_0x80e6('0xe'));var Redis=require(_0x80e6('0xf'));var authService=require(_0x80e6('0x10'));var qs=require(_0x80e6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80e6('0x12'));var logger=require(_0x80e6('0x13'))(_0x80e6('0x14'));var utils=require(_0x80e6('0x15'));var config=require(_0x80e6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x80e6('0x17'))['db'];function respondWithStatusCode(_0x1b559a,_0x2eaaa2){_0x2eaaa2=_0x2eaaa2||0xcc;return function(_0x253e22){if(_0x253e22){return _0x1b559a[_0x80e6('0x18')](_0x2eaaa2);}return _0x1b559a[_0x80e6('0x19')](_0x2eaaa2)[_0x80e6('0x1a')]();};}function respondWithResult(_0x13e7c5,_0x239bda){_0x239bda=_0x239bda||0xc8;return function(_0x6a9512){if(_0x6a9512){return _0x13e7c5[_0x80e6('0x19')](_0x239bda)[_0x80e6('0x1b')](_0x6a9512);}};}function respondWithFilteredResult(_0x56c5c2,_0x4f5e18){return function(_0x3f8586){if(_0x3f8586){var _0x260d06=typeof _0x4f5e18[_0x80e6('0x1c')]===_0x80e6('0x1d')&&typeof _0x4f5e18[_0x80e6('0x1e')]===_0x80e6('0x1d');var _0x363eba=_0x3f8586[_0x80e6('0x1f')];var _0x4619a2=_0x260d06?0x0:_0x4f5e18[_0x80e6('0x1c')];var _0x1c178a=_0x260d06?_0x3f8586['count']:_0x4f5e18[_0x80e6('0x1c')]+_0x4f5e18[_0x80e6('0x1e')];var _0x40b09f;if(_0x1c178a>=_0x363eba){_0x1c178a=_0x363eba;_0x40b09f=0xc8;}else{_0x40b09f=0xce;}_0x56c5c2[_0x80e6('0x19')](_0x40b09f);return _0x56c5c2[_0x80e6('0x20')](_0x80e6('0x21'),_0x4619a2+'-'+_0x1c178a+'/'+_0x363eba)[_0x80e6('0x1b')](_0x3f8586);}return null;};}function patchUpdates(_0x31d7b6){return function(_0x34547b){try{jsonpatch[_0x80e6('0x22')](_0x34547b,_0x31d7b6,!![]);}catch(_0x1fc309){return BPromise[_0x80e6('0x23')](_0x1fc309);}return _0x34547b[_0x80e6('0x24')]();};}function saveUpdates(_0x3818f8,_0x46dedc){return function(_0x3990fd){if(_0x3990fd){return _0x3990fd['update'](_0x3818f8)[_0x80e6('0x25')](function(_0x83835f){return _0x83835f;});}return null;};}function removeEntity(_0x5f254e,_0x5ac458){return function(_0x1fd9d0){if(_0x1fd9d0){return _0x1fd9d0[_0x80e6('0x26')]()['then'](function(){_0x5f254e[_0x80e6('0x19')](0xcc)[_0x80e6('0x1a')]();});}};}function handleEntityNotFound(_0x467d89,_0x184c4b){return function(_0x57c951){if(!_0x57c951){_0x467d89[_0x80e6('0x18')](0x194);}return _0x57c951;};}function handleError(_0x29b752,_0xc9d87b){_0xc9d87b=_0xc9d87b||0x1f4;return function(_0x49beb8){logger[_0x80e6('0x27')](_0x49beb8[_0x80e6('0x28')]);if(_0x49beb8[_0x80e6('0x29')]){delete _0x49beb8['name'];}_0x29b752[_0x80e6('0x19')](_0xc9d87b)['send'](_0x49beb8);};}exports[_0x80e6('0x2a')]=function(_0xd2f7c4,_0xce976c){var _0x4cdf6a={},_0xb4cfcd={},_0x34b8e4={'count':0x0,'rows':[]};var _0x309107=_[_0x80e6('0x2b')](db[_0x80e6('0x2c')][_0x80e6('0x2d')],function(_0x18ba28){return{'name':_0x18ba28[_0x80e6('0x2e')],'type':_0x18ba28['type']['key']};});_0xb4cfcd[_0x80e6('0x2f')]=_[_0x80e6('0x2b')](_0x309107,_0x80e6('0x29'));_0xb4cfcd[_0x80e6('0x30')]=_[_0x80e6('0x31')](_0xd2f7c4[_0x80e6('0x30')]);_0xb4cfcd[_0x80e6('0x32')]=_['intersection'](_0xb4cfcd[_0x80e6('0x2f')],_0xb4cfcd[_0x80e6('0x30')]);_0x4cdf6a[_0x80e6('0x33')]=_[_0x80e6('0x34')](_0xb4cfcd[_0x80e6('0x2f')],qs[_0x80e6('0x35')](_0xd2f7c4[_0x80e6('0x30')]['fields']));_0x4cdf6a[_0x80e6('0x33')]=_0x4cdf6a[_0x80e6('0x33')]['length']?_0x4cdf6a[_0x80e6('0x33')]:_0xb4cfcd[_0x80e6('0x2f')];if(!_0xd2f7c4[_0x80e6('0x30')][_0x80e6('0x36')](_0x80e6('0x37'))){_0x4cdf6a[_0x80e6('0x1e')]=qs[_0x80e6('0x1e')](_0xd2f7c4[_0x80e6('0x30')][_0x80e6('0x1e')]);_0x4cdf6a['offset']=qs['offset'](_0xd2f7c4[_0x80e6('0x30')][_0x80e6('0x1c')]);}_0x4cdf6a[_0x80e6('0x38')]=qs[_0x80e6('0x39')](_0xd2f7c4[_0x80e6('0x30')]['sort']);_0x4cdf6a[_0x80e6('0x3a')]=qs[_0x80e6('0x32')](_[_0x80e6('0x3b')](_0xd2f7c4[_0x80e6('0x30')],_0xb4cfcd[_0x80e6('0x32')]),_0x309107);if(_0xd2f7c4[_0x80e6('0x30')][_0x80e6('0x3c')]){_0x4cdf6a['where']=_[_0x80e6('0x3d')](_0x4cdf6a['where'],{'$or':_[_0x80e6('0x2b')](_0x309107,function(_0x4cf0fd){if(_0x4cf0fd['type']!==_0x80e6('0x3e')){var _0x1ef768={};_0x1ef768[_0x4cf0fd[_0x80e6('0x29')]]={'$like':'%'+_0xd2f7c4[_0x80e6('0x30')][_0x80e6('0x3c')]+'%'};return _0x1ef768;}})});}_0x4cdf6a=_[_0x80e6('0x3d')]({},_0x4cdf6a,_0xd2f7c4[_0x80e6('0x3f')]);var _0x26931b={'where':_0x4cdf6a[_0x80e6('0x3a')]};return db[_0x80e6('0x2c')][_0x80e6('0x1f')](_0x26931b)[_0x80e6('0x25')](function(_0x2b258c){_0x34b8e4[_0x80e6('0x1f')]=_0x2b258c;if(_0xd2f7c4[_0x80e6('0x30')][_0x80e6('0x40')]){_0x4cdf6a['include']=[{'all':!![]}];}return db[_0x80e6('0x2c')][_0x80e6('0x41')](_0x4cdf6a);})[_0x80e6('0x25')](function(_0x279762){_0x34b8e4['rows']=_0x279762;return _0x34b8e4;})[_0x80e6('0x25')](respondWithFilteredResult(_0xce976c,_0x4cdf6a))[_0x80e6('0x42')](handleError(_0xce976c,null));};exports['show']=function(_0xa69526,_0x1fb995){var _0x5031cf={'raw':!![],'where':{'id':_0xa69526[_0x80e6('0x43')]['id']}},_0x481f8d={};_0x481f8d['model']=_[_0x80e6('0x31')](db[_0x80e6('0x2c')][_0x80e6('0x2d')]);_0x481f8d[_0x80e6('0x30')]=_[_0x80e6('0x31')](_0xa69526[_0x80e6('0x30')]);_0x481f8d['filters']=_['intersection'](_0x481f8d['model'],_0x481f8d['query']);_0x5031cf[_0x80e6('0x33')]=_[_0x80e6('0x34')](_0x481f8d[_0x80e6('0x2f')],qs[_0x80e6('0x35')](_0xa69526[_0x80e6('0x30')][_0x80e6('0x35')]));_0x5031cf[_0x80e6('0x33')]=_0x5031cf[_0x80e6('0x33')][_0x80e6('0x44')]?_0x5031cf[_0x80e6('0x33')]:_0x481f8d[_0x80e6('0x2f')];if(_0xa69526['query'][_0x80e6('0x40')]){_0x5031cf[_0x80e6('0x45')]=[{'all':!![]}];}_0x5031cf=_[_0x80e6('0x3d')]({},_0x5031cf,_0xa69526['options']);return db[_0x80e6('0x2c')][_0x80e6('0x46')](_0x5031cf)[_0x80e6('0x25')](handleEntityNotFound(_0x1fb995,null))[_0x80e6('0x25')](respondWithResult(_0x1fb995,null))[_0x80e6('0x42')](handleError(_0x1fb995,null));};exports[_0x80e6('0x47')]=function(_0x2b1899,_0x355fd5){return db[_0x80e6('0x2c')][_0x80e6('0x47')](_0x2b1899[_0x80e6('0x48')],{})[_0x80e6('0x25')](respondWithResult(_0x355fd5,0xc9))[_0x80e6('0x42')](handleError(_0x355fd5,null));};exports['update']=function(_0x4a4e81,_0x3c69b8){if(_0x4a4e81[_0x80e6('0x48')]['id']){delete _0x4a4e81[_0x80e6('0x48')]['id'];}return db[_0x80e6('0x2c')][_0x80e6('0x46')]({'where':{'id':_0x4a4e81['params']['id']}})[_0x80e6('0x25')](handleEntityNotFound(_0x3c69b8,null))['then'](saveUpdates(_0x4a4e81[_0x80e6('0x48')],null))[_0x80e6('0x25')](respondWithResult(_0x3c69b8,null))[_0x80e6('0x42')](handleError(_0x3c69b8,null));};exports[_0x80e6('0x26')]=function(_0x23370e,_0x1cb72b){return db[_0x80e6('0x2c')]['find']({'where':{'id':_0x23370e[_0x80e6('0x43')]['id']}})[_0x80e6('0x25')](handleEntityNotFound(_0x1cb72b,null))[_0x80e6('0x25')](removeEntity(_0x1cb72b,null))[_0x80e6('0x42')](handleError(_0x1cb72b,null));};exports[_0x80e6('0x49')]=function(_0x34a137,_0xd39265){return db['JscriptySessionReport'][_0x80e6('0x49')]()[_0x80e6('0x25')](respondWithResult(_0xd39265,null))[_0x80e6('0x42')](handleError(_0xd39265,null));};exports[_0x80e6('0x4a')]=function(_0x3041d3,_0x377527,_0x400326){var _0x52e02e={'raw':!![],'where':{}};var _0x3b30f8={};var _0x5d791a={'count':0x0,'rows':[]};return db[_0x80e6('0x2c')][_0x80e6('0x4b')]({'where':{'id':_0x3041d3['params']['id']}})[_0x80e6('0x25')](handleEntityNotFound(_0x377527,null))['then'](function(_0x3e1fa8){if(_0x3e1fa8){_0x3b30f8[_0x80e6('0x2f')]=_[_0x80e6('0x31')](db[_0x80e6('0x4c')][_0x80e6('0x2d')]);_0x3b30f8['query']=_['keys'](_0x3041d3[_0x80e6('0x30')]);_0x3b30f8[_0x80e6('0x32')]=_[_0x80e6('0x34')](_0x3b30f8[_0x80e6('0x2f')],_0x3b30f8[_0x80e6('0x30')]);_0x52e02e[_0x80e6('0x33')]=_[_0x80e6('0x34')](_0x3b30f8['model'],qs[_0x80e6('0x35')](_0x3041d3[_0x80e6('0x30')]['fields']));_0x52e02e[_0x80e6('0x33')]=_0x52e02e['attributes'][_0x80e6('0x44')]?_0x52e02e[_0x80e6('0x33')]:_0x3b30f8[_0x80e6('0x2f')];if(!_0x3041d3[_0x80e6('0x30')][_0x80e6('0x36')](_0x80e6('0x37'))){_0x52e02e['limit']=qs[_0x80e6('0x1e')](_0x3041d3['query']['limit']);_0x52e02e['offset']=qs['offset'](_0x3041d3[_0x80e6('0x30')]['offset']);}_0x52e02e[_0x80e6('0x38')]=qs['sort'](_0x3041d3[_0x80e6('0x30')][_0x80e6('0x39')]);_0x52e02e[_0x80e6('0x3a')]=qs[_0x80e6('0x32')](_[_0x80e6('0x3b')](_0x3041d3[_0x80e6('0x30')],_0x3b30f8[_0x80e6('0x32')]));_0x52e02e['where']['SessionId']=_0x3e1fa8['id'];if(_0x3041d3[_0x80e6('0x30')][_0x80e6('0x3c')]){_0x52e02e[_0x80e6('0x3a')]=_[_0x80e6('0x3d')](_0x52e02e[_0x80e6('0x3a')],{'$or':_[_0x80e6('0x2b')](_0x52e02e['attributes'],function(_0x13a4f9){var _0x49c844={};_0x49c844[_0x13a4f9]={'$like':'%'+_0x3041d3[_0x80e6('0x30')][_0x80e6('0x3c')]+'%'};return _0x49c844;})});}_0x52e02e=_[_0x80e6('0x3d')]({},_0x52e02e,_0x3041d3['options']);return db[_0x80e6('0x4c')][_0x80e6('0x1f')]({'where':_0x52e02e[_0x80e6('0x3a')]})[_0x80e6('0x25')](function(_0x5e289d){_0x5d791a[_0x80e6('0x1f')]=_0x5e289d;if(_0x3041d3[_0x80e6('0x30')][_0x80e6('0x40')]){_0x52e02e[_0x80e6('0x45')]=[{'all':!![]}];}return db[_0x80e6('0x4c')][_0x80e6('0x41')](_0x52e02e);})['then'](function(_0x358648){_0x5d791a[_0x80e6('0x4d')]=_0x358648;return _0x5d791a;});}})[_0x80e6('0x25')](respondWithFilteredResult(_0x377527,_0x52e02e))[_0x80e6('0x42')](handleError(_0x377527,null));}; \ No newline at end of file +var _0xaa67=['map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','create','body','describe','getQuestions','JscriptyQuestionReport','SessionId','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index'];(function(_0x132f1a,_0x180495){var _0x430109=function(_0x7be982){while(--_0x7be982){_0x132f1a['push'](_0x132f1a['shift']());}};_0x430109(++_0x180495);}(_0xaa67,0xc1));var _0x7aa6=function(_0x19de55,_0x49ea1f){_0x19de55=_0x19de55-0x0;var _0x32a2cf=_0xaa67[_0x19de55];return _0x32a2cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7aa6('0x0'));var zipdir=require(_0x7aa6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7aa6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7aa6('0x3'));var util=require(_0x7aa6('0x4'));var path=require(_0x7aa6('0x5'));var sox=require(_0x7aa6('0x6'));var csv=require(_0x7aa6('0x7'));var ejs=require(_0x7aa6('0x8'));var fs=require('fs');var fs_extra=require(_0x7aa6('0x9'));var _=require(_0x7aa6('0xa'));var squel=require(_0x7aa6('0xb'));var crypto=require(_0x7aa6('0xc'));var jsforce=require(_0x7aa6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7aa6('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7aa6('0xe'));var qs=require(_0x7aa6('0xf'));var as=require(_0x7aa6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7aa6('0x11'))(_0x7aa6('0x12'));var utils=require(_0x7aa6('0x13'));var config=require(_0x7aa6('0x14'));var licenseUtil=require(_0x7aa6('0x15'));var db=require(_0x7aa6('0x16'))['db'];function respondWithStatusCode(_0x49ba61,_0x203b66){_0x203b66=_0x203b66||0xcc;return function(_0x4f0ff9){if(_0x4f0ff9){return _0x49ba61['sendStatus'](_0x203b66);}return _0x49ba61[_0x7aa6('0x17')](_0x203b66)[_0x7aa6('0x18')]();};}function respondWithResult(_0x1fc165,_0x5f57f8){_0x5f57f8=_0x5f57f8||0xc8;return function(_0x2481ff){if(_0x2481ff){return _0x1fc165[_0x7aa6('0x17')](_0x5f57f8)[_0x7aa6('0x19')](_0x2481ff);}};}function respondWithFilteredResult(_0x13fc92,_0x11119e){return function(_0x30173d){if(_0x30173d){var _0x54539b=typeof _0x11119e[_0x7aa6('0x1a')]===_0x7aa6('0x1b')&&typeof _0x11119e[_0x7aa6('0x1c')]==='undefined';var _0x193f7d=_0x30173d[_0x7aa6('0x1d')];var _0x188bcb=_0x54539b?0x0:_0x11119e[_0x7aa6('0x1a')];var _0x37dab7=_0x54539b?_0x30173d[_0x7aa6('0x1d')]:_0x11119e['offset']+_0x11119e[_0x7aa6('0x1c')];var _0x248e0f;if(_0x37dab7>=_0x193f7d){_0x37dab7=_0x193f7d;_0x248e0f=0xc8;}else{_0x248e0f=0xce;}_0x13fc92[_0x7aa6('0x17')](_0x248e0f);return _0x13fc92[_0x7aa6('0x1e')]('Content-Range',_0x188bcb+'-'+_0x37dab7+'/'+_0x193f7d)['json'](_0x30173d);}return null;};}function patchUpdates(_0x2bab4b){return function(_0x2e965c){try{jsonpatch[_0x7aa6('0x1f')](_0x2e965c,_0x2bab4b,!![]);}catch(_0x567250){return BPromise[_0x7aa6('0x20')](_0x567250);}return _0x2e965c[_0x7aa6('0x21')]();};}function saveUpdates(_0x235b76,_0x2d325d){return function(_0x413df3){if(_0x413df3){return _0x413df3[_0x7aa6('0x22')](_0x235b76)[_0x7aa6('0x23')](function(_0x279d2b){return _0x279d2b;});}return null;};}function removeEntity(_0x4bad29,_0x43c92e){return function(_0x1ca309){if(_0x1ca309){return _0x1ca309[_0x7aa6('0x24')]()[_0x7aa6('0x23')](function(){_0x4bad29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf826ec,_0x4c1506){return function(_0x560303){if(!_0x560303){_0xf826ec['sendStatus'](0x194);}return _0x560303;};}function handleError(_0x234e7c,_0xeedf2b){_0xeedf2b=_0xeedf2b||0x1f4;return function(_0x19cf7a){logger[_0x7aa6('0x25')](_0x19cf7a['stack']);if(_0x19cf7a[_0x7aa6('0x26')]){delete _0x19cf7a[_0x7aa6('0x26')];}_0x234e7c['status'](_0xeedf2b)[_0x7aa6('0x27')](_0x19cf7a);};}exports[_0x7aa6('0x28')]=function(_0x4d264c,_0x95ccac){var _0x3552b1={},_0x29a820={},_0x245635={'count':0x0,'rows':[]};var _0x208f63=_[_0x7aa6('0x29')](db[_0x7aa6('0x2a')][_0x7aa6('0x2b')],function(_0x559ea0){return{'name':_0x559ea0[_0x7aa6('0x2c')],'type':_0x559ea0[_0x7aa6('0x2d')][_0x7aa6('0x2e')]};});_0x29a820[_0x7aa6('0x2f')]=_[_0x7aa6('0x29')](_0x208f63,_0x7aa6('0x26'));_0x29a820[_0x7aa6('0x30')]=_[_0x7aa6('0x31')](_0x4d264c[_0x7aa6('0x30')]);_0x29a820[_0x7aa6('0x32')]=_[_0x7aa6('0x33')](_0x29a820[_0x7aa6('0x2f')],_0x29a820[_0x7aa6('0x30')]);_0x3552b1['attributes']=_['intersection'](_0x29a820[_0x7aa6('0x2f')],qs[_0x7aa6('0x34')](_0x4d264c['query'][_0x7aa6('0x34')]));_0x3552b1['attributes']=_0x3552b1[_0x7aa6('0x35')][_0x7aa6('0x36')]?_0x3552b1[_0x7aa6('0x35')]:_0x29a820[_0x7aa6('0x2f')];if(!_0x4d264c[_0x7aa6('0x30')][_0x7aa6('0x37')](_0x7aa6('0x38'))){_0x3552b1['limit']=qs[_0x7aa6('0x1c')](_0x4d264c[_0x7aa6('0x30')][_0x7aa6('0x1c')]);_0x3552b1['offset']=qs[_0x7aa6('0x1a')](_0x4d264c['query']['offset']);}_0x3552b1[_0x7aa6('0x39')]=qs['sort'](_0x4d264c[_0x7aa6('0x30')][_0x7aa6('0x3a')]);_0x3552b1[_0x7aa6('0x3b')]=qs[_0x7aa6('0x32')](_[_0x7aa6('0x3c')](_0x4d264c[_0x7aa6('0x30')],_0x29a820['filters']),_0x208f63);if(_0x4d264c[_0x7aa6('0x30')][_0x7aa6('0x3d')]){_0x3552b1[_0x7aa6('0x3b')]=_[_0x7aa6('0x3e')](_0x3552b1[_0x7aa6('0x3b')],{'$or':_[_0x7aa6('0x29')](_0x208f63,function(_0x13d5b2){if(_0x13d5b2[_0x7aa6('0x2d')]!==_0x7aa6('0x3f')){var _0x3720e7={};_0x3720e7[_0x13d5b2[_0x7aa6('0x26')]]={'$like':'%'+_0x4d264c[_0x7aa6('0x30')][_0x7aa6('0x3d')]+'%'};return _0x3720e7;}})});}_0x3552b1=_[_0x7aa6('0x3e')]({},_0x3552b1,_0x4d264c['options']);var _0x564c4={'where':_0x3552b1['where']};return db[_0x7aa6('0x2a')][_0x7aa6('0x1d')](_0x564c4)['then'](function(_0x2e8e8e){_0x245635[_0x7aa6('0x1d')]=_0x2e8e8e;if(_0x4d264c[_0x7aa6('0x30')][_0x7aa6('0x40')]){_0x3552b1['include']=[{'all':!![]}];}return db[_0x7aa6('0x2a')][_0x7aa6('0x41')](_0x3552b1);})[_0x7aa6('0x23')](function(_0x5edfa1){_0x245635[_0x7aa6('0x42')]=_0x5edfa1;return _0x245635;})['then'](respondWithFilteredResult(_0x95ccac,_0x3552b1))[_0x7aa6('0x43')](handleError(_0x95ccac,null));};exports[_0x7aa6('0x44')]=function(_0x25204c,_0x5ec75a){var _0x4bc669={'raw':!![],'where':{'id':_0x25204c[_0x7aa6('0x45')]['id']}},_0xecd258={};_0xecd258[_0x7aa6('0x2f')]=_['keys'](db[_0x7aa6('0x2a')][_0x7aa6('0x2b')]);_0xecd258[_0x7aa6('0x30')]=_[_0x7aa6('0x31')](_0x25204c[_0x7aa6('0x30')]);_0xecd258[_0x7aa6('0x32')]=_[_0x7aa6('0x33')](_0xecd258[_0x7aa6('0x2f')],_0xecd258['query']);_0x4bc669[_0x7aa6('0x35')]=_[_0x7aa6('0x33')](_0xecd258[_0x7aa6('0x2f')],qs[_0x7aa6('0x34')](_0x25204c[_0x7aa6('0x30')][_0x7aa6('0x34')]));_0x4bc669[_0x7aa6('0x35')]=_0x4bc669[_0x7aa6('0x35')][_0x7aa6('0x36')]?_0x4bc669['attributes']:_0xecd258[_0x7aa6('0x2f')];if(_0x25204c[_0x7aa6('0x30')][_0x7aa6('0x40')]){_0x4bc669[_0x7aa6('0x46')]=[{'all':!![]}];}_0x4bc669=_[_0x7aa6('0x3e')]({},_0x4bc669,_0x25204c[_0x7aa6('0x47')]);return db[_0x7aa6('0x2a')]['find'](_0x4bc669)[_0x7aa6('0x23')](handleEntityNotFound(_0x5ec75a,null))[_0x7aa6('0x23')](respondWithResult(_0x5ec75a,null))[_0x7aa6('0x43')](handleError(_0x5ec75a,null));};exports[_0x7aa6('0x48')]=function(_0x523cfc,_0x35124b){return db[_0x7aa6('0x2a')][_0x7aa6('0x48')](_0x523cfc[_0x7aa6('0x49')],{})[_0x7aa6('0x23')](respondWithResult(_0x35124b,0xc9))[_0x7aa6('0x43')](handleError(_0x35124b,null));};exports[_0x7aa6('0x22')]=function(_0x1dd754,_0x444311){if(_0x1dd754[_0x7aa6('0x49')]['id']){delete _0x1dd754['body']['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x1dd754['params']['id']}})[_0x7aa6('0x23')](handleEntityNotFound(_0x444311,null))[_0x7aa6('0x23')](saveUpdates(_0x1dd754[_0x7aa6('0x49')],null))[_0x7aa6('0x23')](respondWithResult(_0x444311,null))['catch'](handleError(_0x444311,null));};exports[_0x7aa6('0x24')]=function(_0x2fa32d,_0x4c31af){return db[_0x7aa6('0x2a')]['find']({'where':{'id':_0x2fa32d['params']['id']}})[_0x7aa6('0x23')](handleEntityNotFound(_0x4c31af,null))['then'](removeEntity(_0x4c31af,null))[_0x7aa6('0x43')](handleError(_0x4c31af,null));};exports[_0x7aa6('0x4a')]=function(_0x1afee0,_0x5c6d17){return db['JscriptySessionReport'][_0x7aa6('0x4a')]()['then'](respondWithResult(_0x5c6d17,null))[_0x7aa6('0x43')](handleError(_0x5c6d17,null));};exports[_0x7aa6('0x4b')]=function(_0x40f187,_0x2d5b14,_0x57d8ae){var _0x9e293={'raw':!![],'where':{}};var _0x24b17d={};var _0x25a210={'count':0x0,'rows':[]};return db[_0x7aa6('0x2a')]['findOne']({'where':{'id':_0x40f187[_0x7aa6('0x45')]['id']}})[_0x7aa6('0x23')](handleEntityNotFound(_0x2d5b14,null))[_0x7aa6('0x23')](function(_0x387683){if(_0x387683){_0x24b17d[_0x7aa6('0x2f')]=_[_0x7aa6('0x31')](db[_0x7aa6('0x4c')]['rawAttributes']);_0x24b17d[_0x7aa6('0x30')]=_[_0x7aa6('0x31')](_0x40f187['query']);_0x24b17d[_0x7aa6('0x32')]=_['intersection'](_0x24b17d['model'],_0x24b17d[_0x7aa6('0x30')]);_0x9e293['attributes']=_[_0x7aa6('0x33')](_0x24b17d[_0x7aa6('0x2f')],qs[_0x7aa6('0x34')](_0x40f187[_0x7aa6('0x30')][_0x7aa6('0x34')]));_0x9e293[_0x7aa6('0x35')]=_0x9e293[_0x7aa6('0x35')][_0x7aa6('0x36')]?_0x9e293[_0x7aa6('0x35')]:_0x24b17d[_0x7aa6('0x2f')];if(!_0x40f187['query']['hasOwnProperty'](_0x7aa6('0x38'))){_0x9e293[_0x7aa6('0x1c')]=qs['limit'](_0x40f187[_0x7aa6('0x30')][_0x7aa6('0x1c')]);_0x9e293['offset']=qs[_0x7aa6('0x1a')](_0x40f187[_0x7aa6('0x30')][_0x7aa6('0x1a')]);}_0x9e293[_0x7aa6('0x39')]=qs[_0x7aa6('0x3a')](_0x40f187[_0x7aa6('0x30')]['sort']);_0x9e293[_0x7aa6('0x3b')]=qs['filters'](_['pick'](_0x40f187[_0x7aa6('0x30')],_0x24b17d[_0x7aa6('0x32')]));_0x9e293['where'][_0x7aa6('0x4d')]=_0x387683['id'];if(_0x40f187[_0x7aa6('0x30')][_0x7aa6('0x3d')]){_0x9e293[_0x7aa6('0x3b')]=_[_0x7aa6('0x3e')](_0x9e293['where'],{'$or':_[_0x7aa6('0x29')](_0x9e293[_0x7aa6('0x35')],function(_0x14b535){var _0x4302c9={};_0x4302c9[_0x14b535]={'$like':'%'+_0x40f187[_0x7aa6('0x30')][_0x7aa6('0x3d')]+'%'};return _0x4302c9;})});}_0x9e293=_[_0x7aa6('0x3e')]({},_0x9e293,_0x40f187[_0x7aa6('0x47')]);return db[_0x7aa6('0x4c')]['count']({'where':_0x9e293[_0x7aa6('0x3b')]})[_0x7aa6('0x23')](function(_0x43ec79){_0x25a210[_0x7aa6('0x1d')]=_0x43ec79;if(_0x40f187[_0x7aa6('0x30')]['includeAll']){_0x9e293[_0x7aa6('0x46')]=[{'all':!![]}];}return db[_0x7aa6('0x4c')]['findAll'](_0x9e293);})[_0x7aa6('0x23')](function(_0xfe8eb9){_0x25a210[_0x7aa6('0x42')]=_0xfe8eb9;return _0x25a210;});}})[_0x7aa6('0x23')](respondWithFilteredResult(_0x2d5b14,_0x9e293))['catch'](handleError(_0x2d5b14,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 1330e01..1db54b0 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 _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x885a,0x180));var _0xa885=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x885a[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x351ab6,_0x36cdb3){var _0x39e96b=function(_0x5020c2){while(--_0x5020c2){_0x351ab6['push'](_0x351ab6['shift']());}};_0x39e96b(++_0x36cdb3);}(_0xb138,0x1dd));var _0x8b13=function(_0x35d134,_0x3263db){_0x35d134=_0x35d134-0x0;var _0xeeebe3=_0xb138[_0x35d134];return _0xeeebe3;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('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 d505a47..e0d3dc0 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 _0xd117=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','code','error','message'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xd117,0x182));var _0x7d11=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xd117[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});} \ No newline at end of file +var _0x0424=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0424,0x159));var _0x4042=function(_0x4001ad,_0x1e22dd){_0x4001ad=_0x4001ad-0x0;var _0x4c7ec2=_0x0424[_0x4001ad];return _0x4c7ec2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 6f5305e..c4df481 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 _0x6458=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x6458,0x1ed));var _0x8645=function(_0x479746,_0x574758){_0x479746=_0x479746-0x0;var _0x36d2aa=_0x6458[_0x479746];return _0x36d2aa;};'use strict';var multer=require(_0x8645('0x0'));var util=require(_0x8645('0x1'));var path=require(_0x8645('0x2'));var timeout=require('connect-timeout');var express=require(_0x8645('0x3'));var router=express[_0x8645('0x4')]();var fs_extra=require(_0x8645('0x5'));var auth=require(_0x8645('0x6'));var interaction=require(_0x8645('0x7'));var config=require('../../config/environment');var controller=require(_0x8645('0x8'));router[_0x8645('0x9')]('/',controller[_0x8645('0xa')]);router['put'](_0x8645('0xb'),auth[_0x8645('0xc')](),controller[_0x8645('0xd')]);router['get'](_0x8645('0xe'),auth[_0x8645('0xc')](),controller[_0x8645('0xf')]);module[_0x8645('0x10')]=router; \ No newline at end of file +var _0xb251=['../../components/interaction/service','../../config/environment','get','index','put','isAuthenticated','/download_log_file','downloadLogFile','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xb251,0xe9));var _0x1b25=function(_0xe9f06e,_0x2f14a1){_0xe9f06e=_0xe9f06e-0x0;var _0x123b91=_0xb251[_0xe9f06e];return _0x123b91;};'use strict';var multer=require(_0x1b25('0x0'));var util=require('util');var path=require(_0x1b25('0x1'));var timeout=require(_0x1b25('0x2'));var express=require('express');var router=express[_0x1b25('0x3')]();var fs_extra=require(_0x1b25('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1b25('0x5'));var config=require(_0x1b25('0x6'));var controller=require('./license.controller');router[_0x1b25('0x7')]('/',controller[_0x1b25('0x8')]);router[_0x1b25('0x9')]('/:id',auth[_0x1b25('0xa')](),controller['update']);router['get'](_0x1b25('0xb'),auth[_0x1b25('0xa')](),controller[_0x1b25('0xc')]);module[_0x1b25('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 62cdd81..586c29f 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 _0x7797=['TEXT','STRING','INTEGER','exports'];(function(_0x2488a2,_0x50f57a){var _0x58e303=function(_0x46ddf1){while(--_0x46ddf1){_0x2488a2['push'](_0x2488a2['shift']());}};_0x58e303(++_0x50f57a);}(_0x7797,0xc7));var _0x7779=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x7797[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require('sequelize');module[_0x7779('0x0')]={'license':{'type':Sequelize[_0x7779('0x1')]},'data1':{'type':Sequelize[_0x7779('0x2')]},'data2':{'type':Sequelize[_0x7779('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x7779('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x394a=['TEXT','STRING','sequelize','exports'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x394a,0x82));var _0xa394=function(_0x31309f,_0x10cbd8){_0x31309f=_0x31309f-0x0;var _0x4c8698=_0x394a[_0x31309f];return _0x4c8698;};'use strict';var Sequelize=require(_0xa394('0x0'));module[_0xa394('0x1')]={'license':{'type':Sequelize[_0xa394('0x2')]},'data1':{'type':Sequelize[_0xa394('0x3')]},'data2':{'type':Sequelize[_0xa394('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index d3d0bc2..df46a37 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 _0x7c2c=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','update','then','destroy','sendStatus','error','stack','name','send','../../config/license/util','index','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','body','License','params','get','checkLicense','key','demo','catch','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x2643c2,_0x5d500a){var _0xdbb38=function(_0x214deb){while(--_0x214deb){_0x2643c2['push'](_0x2643c2['shift']());}};_0xdbb38(++_0x5d500a);}(_0x7c2c,0x1a6));var _0xc7c2=function(_0x5e5e9e,_0x37e7b3){_0x5e5e9e=_0x5e5e9e-0x0;var _0x4bfbf7=_0x7c2c[_0x5e5e9e];return _0x4bfbf7;};'use strict';var emlformat=require(_0xc7c2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc7c2('0x1'));var jsonpatch=require(_0xc7c2('0x2'));var rp=require(_0xc7c2('0x3'));var moment=require(_0xc7c2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc7c2('0x5'));var util=require(_0xc7c2('0x6'));var path=require(_0xc7c2('0x7'));var sox=require(_0xc7c2('0x8'));var csv=require(_0xc7c2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc7c2('0xa'));var _=require('lodash');var squel=require(_0xc7c2('0xb'));var crypto=require('crypto');var jsforce=require(_0xc7c2('0xc'));var deskjs=require(_0xc7c2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc7c2('0xe'));var Papa=require(_0xc7c2('0xf'));var Redis=require(_0xc7c2('0x10'));var authService=require(_0xc7c2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc7c2('0x12'));var hardwareService=require(_0xc7c2('0x13'));var logger=require(_0xc7c2('0x14'))(_0xc7c2('0x15'));var utils=require(_0xc7c2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc7c2('0x17'))['db'];function respondWithStatusCode(_0x24d94e,_0x3f22c4){_0x3f22c4=_0x3f22c4||0xcc;return function(_0x198ad6){if(_0x198ad6){return _0x24d94e['sendStatus'](_0x3f22c4);}return _0x24d94e[_0xc7c2('0x18')](_0x3f22c4)[_0xc7c2('0x19')]();};}function respondWithResult(_0x34c10f,_0x3cc97b){_0x3cc97b=_0x3cc97b||0xc8;return function(_0x431f60){if(_0x431f60){return _0x34c10f['status'](_0x3cc97b)[_0xc7c2('0x1a')](_0x431f60);}};}function respondWithFilteredResult(_0x23cf89,_0x30f3a1){return function(_0x8c77e1){if(_0x8c77e1){var _0x1ea104=typeof _0x30f3a1[_0xc7c2('0x1b')]===_0xc7c2('0x1c')&&typeof _0x30f3a1[_0xc7c2('0x1d')]==='undefined';var _0x4b87df=_0x8c77e1[_0xc7c2('0x1e')];var _0x11a5dd=_0x1ea104?0x0:_0x30f3a1[_0xc7c2('0x1b')];var _0x2feaf9=_0x1ea104?_0x8c77e1[_0xc7c2('0x1e')]:_0x30f3a1[_0xc7c2('0x1b')]+_0x30f3a1[_0xc7c2('0x1d')];var _0x178181;if(_0x2feaf9>=_0x4b87df){_0x2feaf9=_0x4b87df;_0x178181=0xc8;}else{_0x178181=0xce;}_0x23cf89[_0xc7c2('0x18')](_0x178181);return _0x23cf89['set']('Content-Range',_0x11a5dd+'-'+_0x2feaf9+'/'+_0x4b87df)[_0xc7c2('0x1a')](_0x8c77e1);}return null;};}function patchUpdates(_0x199656){return function(_0x13c3fe){try{jsonpatch[_0xc7c2('0x1f')](_0x13c3fe,_0x199656,!![]);}catch(_0x184ab7){return BPromise['reject'](_0x184ab7);}return _0x13c3fe['save']();};}function saveUpdates(_0x3544b2,_0x2376b1){return function(_0x5cb7a7){if(_0x5cb7a7){return _0x5cb7a7[_0xc7c2('0x20')](_0x3544b2)[_0xc7c2('0x21')](function(_0x292a1b){return _0x292a1b;});}return null;};}function removeEntity(_0x5dafd3,_0x3a6332){return function(_0xf3496f){if(_0xf3496f){return _0xf3496f[_0xc7c2('0x22')]()[_0xc7c2('0x21')](function(){_0x5dafd3[_0xc7c2('0x18')](0xcc)[_0xc7c2('0x19')]();});}};}function handleEntityNotFound(_0x518958,_0x26166d){return function(_0x1dbf41){if(!_0x1dbf41){_0x518958[_0xc7c2('0x23')](0x194);}return _0x1dbf41;};}function handleError(_0x2b3003,_0x142858){_0x142858=_0x142858||0x1f4;return function(_0x24e7a8){logger[_0xc7c2('0x24')](_0x24e7a8[_0xc7c2('0x25')]);if(_0x24e7a8[_0xc7c2('0x26')]){delete _0x24e7a8[_0xc7c2('0x26')];}_0x2b3003[_0xc7c2('0x18')](_0x142858)[_0xc7c2('0x27')](_0x24e7a8);};}var utilLicense=require(_0xc7c2('0x28'));exports[_0xc7c2('0x29')]=function(_0x39a030,_0x40f6e2){var _0x13d634={'raw':!![],'where':{'id':0x1}},_0x3979b9={};_0x3979b9['model']=_[_0xc7c2('0x2a')](db['License'][_0xc7c2('0x2b')]);_0x3979b9[_0xc7c2('0x2c')]=_['keys'](_0x39a030[_0xc7c2('0x2c')]);_0x3979b9[_0xc7c2('0x2d')]=_[_0xc7c2('0x2e')](_0x3979b9[_0xc7c2('0x2f')],_0x3979b9[_0xc7c2('0x2c')]);_0x13d634[_0xc7c2('0x30')]=_[_0xc7c2('0x2e')](_0x3979b9[_0xc7c2('0x2f')],qs[_0xc7c2('0x31')](_0x39a030['query'][_0xc7c2('0x31')]));_0x13d634['attributes']=_0x13d634[_0xc7c2('0x30')][_0xc7c2('0x32')]?_0x13d634[_0xc7c2('0x30')]:_0x3979b9[_0xc7c2('0x2f')];_0x13d634=_[_0xc7c2('0x33')]({},_0x13d634,_0x39a030[_0xc7c2('0x34')]);return utilLicense[_0xc7c2('0x35')](_0x13d634)[_0xc7c2('0x21')](respondWithResult(_0x40f6e2,null))['catch'](handleError(_0x40f6e2,null));};exports[_0xc7c2('0x20')]=function(_0x1761f8,_0x69288a){if(_0x1761f8[_0xc7c2('0x36')]['id']){delete _0x1761f8[_0xc7c2('0x36')]['id'];}return db[_0xc7c2('0x37')]['find']({'where':{'id':_0x1761f8[_0xc7c2('0x38')]['id']}})[_0xc7c2('0x21')](handleEntityNotFound(_0x69288a,null))[_0xc7c2('0x21')](function(_0x5240db){var _0x2d29d3=_0x5240db[_0xc7c2('0x39')]({'plain':!![]});return utilLicense[_0xc7c2('0x3a')](_0x2d29d3,_0x1761f8[_0xc7c2('0x36')][_0xc7c2('0x3b')]);})[_0xc7c2('0x21')](function(_0x598f38){if(!_0x598f38[_0xc7c2('0x3c')]){return saveUpdates(_0x1761f8['body'],null);}return _0x598f38;})[_0xc7c2('0x21')](respondWithResult(_0x69288a,null))[_0xc7c2('0x3d')](handleError(_0x69288a,null));};exports['downloadLogFile']=function(_0x11d8a9,_0x258207){var _0x4fbff0=_0xc7c2('0x3e');var _0x5900e2=path[_0xc7c2('0x3f')](_0xc7c2('0x40'),_0xc7c2('0x41'),_0xc7c2('0x42'),_0x4fbff0);_0x258207['setHeader'](_0xc7c2('0x43'),_0xc7c2('0x44')+_0x4fbff0);_0x258207[_0xc7c2('0x45')](_0xc7c2('0x46'),_0xc7c2('0x47'));_0x258207[_0xc7c2('0x48')](_0x5900e2);}; \ No newline at end of file +var _0x8803=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','catch','body','params','get','key','demo','downloadLogFile','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xb61f3e,_0x4f0eee){var _0x5a288c=function(_0x57eb33){while(--_0x57eb33){_0xb61f3e['push'](_0xb61f3e['shift']());}};_0x5a288c(++_0x4f0eee);}(_0x8803,0x111));var _0x3880=function(_0x1431c4,_0x56f261){_0x1431c4=_0x1431c4-0x0;var _0x2f21e6=_0x8803[_0x1431c4];return _0x2f21e6;};'use strict';var emlformat=require(_0x3880('0x0'));var rimraf=require(_0x3880('0x1'));var zipdir=require(_0x3880('0x2'));var jsonpatch=require(_0x3880('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3880('0x4'));var util=require(_0x3880('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x3880('0x6'));var ejs=require(_0x3880('0x7'));var fs=require('fs');var fs_extra=require(_0x3880('0x8'));var _=require(_0x3880('0x9'));var squel=require(_0x3880('0xa'));var crypto=require(_0x3880('0xb'));var jsforce=require(_0x3880('0xc'));var deskjs=require(_0x3880('0xd'));var toCsv=require(_0x3880('0x6'));var querystring=require('querystring');var Papa=require(_0x3880('0xe'));var Redis=require(_0x3880('0xf'));var authService=require(_0x3880('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3880('0x11'));var logger=require('../../config/logger')(_0x3880('0x12'));var utils=require(_0x3880('0x13'));var config=require(_0x3880('0x14'));var licenseUtil=require(_0x3880('0x15'));var db=require(_0x3880('0x16'))['db'];function respondWithStatusCode(_0x2051b8,_0x13e451){_0x13e451=_0x13e451||0xcc;return function(_0x475dc9){if(_0x475dc9){return _0x2051b8['sendStatus'](_0x13e451);}return _0x2051b8['status'](_0x13e451)[_0x3880('0x17')]();};}function respondWithResult(_0x2fc319,_0x5292cd){_0x5292cd=_0x5292cd||0xc8;return function(_0x4b0be1){if(_0x4b0be1){return _0x2fc319[_0x3880('0x18')](_0x5292cd)[_0x3880('0x19')](_0x4b0be1);}};}function respondWithFilteredResult(_0x167f99,_0x5b1848){return function(_0x3813bf){if(_0x3813bf){var _0x7b496a=typeof _0x5b1848[_0x3880('0x1a')]===_0x3880('0x1b')&&typeof _0x5b1848[_0x3880('0x1c')]===_0x3880('0x1b');var _0x2f143e=_0x3813bf[_0x3880('0x1d')];var _0x1e9161=_0x7b496a?0x0:_0x5b1848['offset'];var _0x440227=_0x7b496a?_0x3813bf[_0x3880('0x1d')]:_0x5b1848[_0x3880('0x1a')]+_0x5b1848['limit'];var _0x145015;if(_0x440227>=_0x2f143e){_0x440227=_0x2f143e;_0x145015=0xc8;}else{_0x145015=0xce;}_0x167f99[_0x3880('0x18')](_0x145015);return _0x167f99[_0x3880('0x1e')]('Content-Range',_0x1e9161+'-'+_0x440227+'/'+_0x2f143e)['json'](_0x3813bf);}return null;};}function patchUpdates(_0xb2cc96){return function(_0x20cd5f){try{jsonpatch[_0x3880('0x1f')](_0x20cd5f,_0xb2cc96,!![]);}catch(_0x4502d0){return BPromise[_0x3880('0x20')](_0x4502d0);}return _0x20cd5f[_0x3880('0x21')]();};}function saveUpdates(_0x5671db,_0x494ecb){return function(_0xfb3e86){if(_0xfb3e86){return _0xfb3e86[_0x3880('0x22')](_0x5671db)[_0x3880('0x23')](function(_0x364286){return _0x364286;});}return null;};}function removeEntity(_0x214f4f,_0x172f0e){return function(_0x306e4a){if(_0x306e4a){return _0x306e4a[_0x3880('0x24')]()[_0x3880('0x23')](function(){_0x214f4f[_0x3880('0x18')](0xcc)[_0x3880('0x17')]();});}};}function handleEntityNotFound(_0x107b4f,_0x21cfe4){return function(_0x5424cf){if(!_0x5424cf){_0x107b4f[_0x3880('0x25')](0x194);}return _0x5424cf;};}function handleError(_0x403770,_0x2be481){_0x2be481=_0x2be481||0x1f4;return function(_0x1089b1){logger[_0x3880('0x26')](_0x1089b1[_0x3880('0x27')]);if(_0x1089b1[_0x3880('0x28')]){delete _0x1089b1[_0x3880('0x28')];}_0x403770[_0x3880('0x18')](_0x2be481)[_0x3880('0x29')](_0x1089b1);};}var utilLicense=require('../../config/license/util');exports[_0x3880('0x2a')]=function(_0x4a5405,_0x329aa4){var _0x2f7903={'raw':!![],'where':{'id':0x1}},_0xa3ea99={};_0xa3ea99['model']=_[_0x3880('0x2b')](db[_0x3880('0x2c')][_0x3880('0x2d')]);_0xa3ea99[_0x3880('0x2e')]=_[_0x3880('0x2b')](_0x4a5405['query']);_0xa3ea99[_0x3880('0x2f')]=_[_0x3880('0x30')](_0xa3ea99[_0x3880('0x31')],_0xa3ea99[_0x3880('0x2e')]);_0x2f7903[_0x3880('0x32')]=_['intersection'](_0xa3ea99[_0x3880('0x31')],qs[_0x3880('0x33')](_0x4a5405[_0x3880('0x2e')][_0x3880('0x33')]));_0x2f7903[_0x3880('0x32')]=_0x2f7903['attributes'][_0x3880('0x34')]?_0x2f7903['attributes']:_0xa3ea99[_0x3880('0x31')];_0x2f7903=_[_0x3880('0x35')]({},_0x2f7903,_0x4a5405[_0x3880('0x36')]);return utilLicense[_0x3880('0x37')](_0x2f7903)[_0x3880('0x23')](respondWithResult(_0x329aa4,null))[_0x3880('0x38')](handleError(_0x329aa4,null));};exports[_0x3880('0x22')]=function(_0x5f4630,_0x3a53ee){if(_0x5f4630[_0x3880('0x39')]['id']){delete _0x5f4630[_0x3880('0x39')]['id'];}return db[_0x3880('0x2c')]['find']({'where':{'id':_0x5f4630[_0x3880('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3a53ee,null))['then'](function(_0x1525c7){var _0x339667=_0x1525c7[_0x3880('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x339667,_0x5f4630['body'][_0x3880('0x3c')]);})[_0x3880('0x23')](function(_0x49c427){if(!_0x49c427[_0x3880('0x3d')]){return saveUpdates(_0x5f4630['body'],null);}return _0x49c427;})[_0x3880('0x23')](respondWithResult(_0x3a53ee,null))[_0x3880('0x38')](handleError(_0x3a53ee,null));};exports[_0x3880('0x3e')]=function(_0x24edbd,_0x326ea3){var _0x1d5e33='license-info.log';var _0x44963d=path['join'](_0x3880('0x3f'),_0x3880('0x40'),_0x3880('0x41'),_0x1d5e33);_0x326ea3['setHeader'](_0x3880('0x42'),_0x3880('0x43')+_0x1d5e33);_0x326ea3['set'](_0x3880('0x44'),_0x3880('0x45'));_0x326ea3[_0x3880('0x46')](_0x44963d);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 2f0770f..85c934d 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 _0x75d5=['exports','define','License','license','lodash','util','../../config/logger','moment','bluebird','rimraf','./license.attributes'];(function(_0x42a898,_0x50044d){var _0x52fe47=function(_0x6cced6){while(--_0x6cced6){_0x42a898['push'](_0x42a898['shift']());}};_0x52fe47(++_0x50044d);}(_0x75d5,0xb4));var _0x575d=function(_0x438ea8,_0xb646e7){_0x438ea8=_0x438ea8-0x0;var _0xf02ad1=_0x75d5[_0x438ea8];return _0xf02ad1;};'use strict';var _=require(_0x575d('0x0'));var util=require(_0x575d('0x1'));var logger=require(_0x575d('0x2'))('api');var moment=require(_0x575d('0x3'));var BPromise=require(_0x575d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x575d('0x5'));var config=require('../../config/environment');var attributes=require(_0x575d('0x6'));module[_0x575d('0x7')]=function(_0x508d99,_0x1466f6){return _0x508d99[_0x575d('0x8')](_0x575d('0x9'),attributes,{'tableName':_0x575d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93bb=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','License','lodash','util','../../config/logger'];(function(_0x309cb3,_0x5c3a74){var _0x470563=function(_0x1de418){while(--_0x1de418){_0x309cb3['push'](_0x309cb3['shift']());}};_0x470563(++_0x5c3a74);}(_0x93bb,0x135));var _0xb93b=function(_0x49406f,_0x2f4c3f){_0x49406f=_0x49406f-0x0;var _0x160eaa=_0x93bb[_0x49406f];return _0x160eaa;};'use strict';var _=require(_0xb93b('0x0'));var util=require(_0xb93b('0x1'));var logger=require(_0xb93b('0x2'))(_0xb93b('0x3'));var moment=require(_0xb93b('0x4'));var BPromise=require(_0xb93b('0x5'));var rp=require(_0xb93b('0x6'));var fs=require('fs');var path=require(_0xb93b('0x7'));var rimraf=require(_0xb93b('0x8'));var config=require(_0xb93b('0x9'));var attributes=require('./license.attributes');module[_0xb93b('0xa')]=function(_0x1ec4dd,_0x4e89c7){return _0x1ec4dd[_0xb93b('0xb')](_0xb93b('0xc'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 4c1470a..e5128f0 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 _0xbc7d=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','License,\x20%s,\x20%s','message'];(function(_0x591717,_0x10f1ce){var _0x21858f=function(_0x49a5fe){while(--_0x49a5fe){_0x591717['push'](_0x591717['shift']());}};_0x21858f(++_0x10f1ce);}(_0xbc7d,0x178));var _0xdbc7=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0xbc7d[_0x120bc2];return _0x454a41;};'use strict';var _=require(_0xdbc7('0x0'));var util=require(_0xdbc7('0x1'));var moment=require(_0xdbc7('0x2'));var BPromise=require(_0xdbc7('0x3'));var rs=require(_0xdbc7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbc7('0x5'))['db'];var utils=require(_0xdbc7('0x6'));var logger=require(_0xdbc7('0x7'))('rpc');var config=require(_0xdbc7('0x8'));var jayson=require(_0xdbc7('0x9'));var client=jayson['client'][_0xdbc7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3da133,_0x5725e6,_0x3dbced){return new BPromise(function(_0x98e582,_0x3bf79c){return client['request'](_0x3da133,_0x3dbced)[_0xdbc7('0xb')](function(_0x33d78c){logger[_0xdbc7('0xc')]('License,\x20%s,\x20%s',_0x5725e6,'request\x20sent');logger['debug'](_0xdbc7('0xd'),_0x5725e6,_0xdbc7('0xe'),JSON[_0xdbc7('0xf')](_0x33d78c));if(_0x33d78c[_0xdbc7('0x10')]){if(_0x33d78c[_0xdbc7('0x10')][_0xdbc7('0x11')]===0x1f4){logger['error'](_0xdbc7('0x12'),_0x5725e6,_0x33d78c[_0xdbc7('0x10')][_0xdbc7('0x13')]);return _0x3bf79c(_0x33d78c['error'][_0xdbc7('0x13')]);}logger[_0xdbc7('0x10')](_0xdbc7('0x12'),_0x5725e6,_0x33d78c['error'][_0xdbc7('0x13')]);return _0x98e582(_0x33d78c[_0xdbc7('0x10')][_0xdbc7('0x13')]);}else{logger['info'](_0xdbc7('0x12'),_0x5725e6,_0xdbc7('0xe'));_0x98e582(_0x33d78c[_0xdbc7('0x14')][_0xdbc7('0x13')]);}})[_0xdbc7('0x15')](function(_0x5182d1){logger['error'](_0xdbc7('0x12'),_0x5725e6,_0x5182d1);_0x3bf79c(_0x5182d1);});});} \ No newline at end of file +var _0xe911=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xe911,0x1b3));var _0x1e91=function(_0x2c9d13,_0x5bccfe){_0x2c9d13=_0x2c9d13-0x0;var _0x5db186=_0xe911[_0x2c9d13];return _0x5db186;};'use strict';var _=require(_0x1e91('0x0'));var util=require(_0x1e91('0x1'));var moment=require(_0x1e91('0x2'));var BPromise=require(_0x1e91('0x3'));var rs=require(_0x1e91('0x4'));var fs=require('fs');var Redis=require(_0x1e91('0x5'));var db=require(_0x1e91('0x6'))['db'];var utils=require(_0x1e91('0x7'));var logger=require('../../config/logger')(_0x1e91('0x8'));var config=require(_0x1e91('0x9'));var jayson=require(_0x1e91('0xa'));var client=jayson[_0x1e91('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x372963,_0x2d8939,_0xc1acff){return new BPromise(function(_0x36fbe8,_0x5a114c){return client[_0x1e91('0xc')](_0x372963,_0xc1acff)[_0x1e91('0xd')](function(_0x12982a){logger['info'](_0x1e91('0xe'),_0x2d8939,'request\x20sent');logger['debug'](_0x1e91('0xf'),_0x2d8939,_0x1e91('0x10'),JSON[_0x1e91('0x11')](_0x12982a));if(_0x12982a[_0x1e91('0x12')]){if(_0x12982a[_0x1e91('0x12')][_0x1e91('0x13')]===0x1f4){logger['error'](_0x1e91('0xe'),_0x2d8939,_0x12982a[_0x1e91('0x12')][_0x1e91('0x14')]);return _0x5a114c(_0x12982a[_0x1e91('0x12')][_0x1e91('0x14')]);}logger['error']('License,\x20%s,\x20%s',_0x2d8939,_0x12982a[_0x1e91('0x12')][_0x1e91('0x14')]);return _0x36fbe8(_0x12982a[_0x1e91('0x12')][_0x1e91('0x14')]);}else{logger[_0x1e91('0x15')](_0x1e91('0xe'),_0x2d8939,_0x1e91('0x10'));_0x36fbe8(_0x12982a[_0x1e91('0x16')][_0x1e91('0x14')]);}})[_0x1e91('0x17')](function(_0x5e734a){logger[_0x1e91('0x12')](_0x1e91('0xe'),_0x2d8939,_0x5e734a);_0x5a114c(_0x5e734a);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c281d86..9fb8381 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 _0x22e0=['../../components/interaction/service','../../config/environment','./mailAccount.controller','index','get','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','addInteraction','/:id/send','send','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x263a03,_0x42ffb1){var _0x56bc49=function(_0x518b5c){while(--_0x518b5c){_0x263a03['push'](_0x263a03['shift']());}};_0x56bc49(++_0x42ffb1);}(_0x22e0,0x16b));var _0x022e=function(_0x2cbf1b,_0x2fefeb){_0x2cbf1b=_0x2cbf1b-0x0;var _0x1fd625=_0x22e0[_0x2cbf1b];return _0x1fd625;};'use strict';var multer=require(_0x022e('0x0'));var util=require('util');var path=require(_0x022e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x022e('0x2')]();var fs_extra=require(_0x022e('0x3'));var auth=require(_0x022e('0x4'));var interaction=require(_0x022e('0x5'));var config=require(_0x022e('0x6'));var controller=require(_0x022e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x022e('0x8')]);router[_0x022e('0x9')]('/describe',auth[_0x022e('0xa')](),controller['describe']);router[_0x022e('0x9')]('/:id',auth[_0x022e('0xa')](),controller[_0x022e('0xb')]);router['get'](_0x022e('0xc'),auth[_0x022e('0xa')](),controller[_0x022e('0xd')]);router['get'](_0x022e('0xe'),auth[_0x022e('0xa')](),controller[_0x022e('0xf')]);router[_0x022e('0x9')](_0x022e('0x10'),auth[_0x022e('0xa')](),controller[_0x022e('0x11')]);router[_0x022e('0x9')](_0x022e('0x12'),auth['isAuthenticated'](),controller['getSmtp']);router[_0x022e('0x9')](_0x022e('0x13'),auth[_0x022e('0xa')](),controller[_0x022e('0x14')]);router[_0x022e('0x9')](_0x022e('0x15'),auth[_0x022e('0xa')](),controller[_0x022e('0x16')]);router[_0x022e('0x9')](_0x022e('0x17'),auth[_0x022e('0xa')](),controller[_0x022e('0x18')]);router[_0x022e('0x9')]('/:id/verify',auth[_0x022e('0xa')](),controller[_0x022e('0x19')]);router[_0x022e('0x9')](_0x022e('0x1a'),auth['isAuthenticated'](),controller[_0x022e('0x1b')]);router[_0x022e('0x1c')]('/:id/dispositions',auth[_0x022e('0xa')](),controller['addDisposition']);router[_0x022e('0x1c')](_0x022e('0xe'),auth[_0x022e('0xa')](),controller[_0x022e('0x1d')]);router['post']('/',auth[_0x022e('0xa')](),controller[_0x022e('0x1e')]);router[_0x022e('0x1c')](_0x022e('0x10'),auth[_0x022e('0xa')](),controller[_0x022e('0x1f')]);router[_0x022e('0x1c')](_0x022e('0x12'),auth['isAuthenticated'](),controller['addSmtp']);router['post'](_0x022e('0x13'),auth[_0x022e('0xa')](),controller[_0x022e('0x20')]);router[_0x022e('0x1c')](_0x022e('0x15'),auth[_0x022e('0xa')](),controller['addApplications']);router[_0x022e('0x1c')](_0x022e('0x21'),auth[_0x022e('0xa')](),controller[_0x022e('0x22')]);router[_0x022e('0x1c')]('/:id/users',auth[_0x022e('0xa')](),controller[_0x022e('0x23')]);router[_0x022e('0x24')](_0x022e('0x25'),auth[_0x022e('0xa')](),controller[_0x022e('0x26')]);router[_0x022e('0x27')](_0x022e('0xc'),auth['isAuthenticated'](),controller[_0x022e('0x28')]);router[_0x022e('0x27')](_0x022e('0xe'),auth[_0x022e('0xa')](),controller[_0x022e('0x29')]);router[_0x022e('0x27')](_0x022e('0x10'),auth['isAuthenticated'](),controller[_0x022e('0x2a')]);router[_0x022e('0x27')](_0x022e('0x12'),auth[_0x022e('0xa')](),controller[_0x022e('0x2b')]);router[_0x022e('0x27')](_0x022e('0x25'),auth[_0x022e('0xa')](),controller[_0x022e('0x2c')]);router['delete'](_0x022e('0x1a'),auth[_0x022e('0xa')](),controller[_0x022e('0x2d')]);module['exports']=router; \ No newline at end of file +var _0x27ee=['Router','fs-extra','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','/:id/messages','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/interactions','addApplications','/:id/send','send','put','removeDispositions','delete','removeAnswers','destroy','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x27ee,0x164));var _0xe27e=function(_0x595f66,_0x5ca005){_0x595f66=_0x595f66-0x0;var _0x36d121=_0x27ee[_0x595f66];return _0x36d121;};'use strict';var multer=require(_0xe27e('0x0'));var util=require(_0xe27e('0x1'));var path=require('path');var timeout=require(_0xe27e('0x2'));var express=require(_0xe27e('0x3'));var router=express[_0xe27e('0x4')]();var fs_extra=require(_0xe27e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe27e('0x6'));var controller=require(_0xe27e('0x7'));router[_0xe27e('0x8')]('/',auth[_0xe27e('0x9')](),controller[_0xe27e('0xa')]);router['get'](_0xe27e('0xb'),auth[_0xe27e('0x9')](),controller[_0xe27e('0xc')]);router[_0xe27e('0x8')](_0xe27e('0xd'),auth[_0xe27e('0x9')](),controller['show']);router[_0xe27e('0x8')](_0xe27e('0xe'),auth[_0xe27e('0x9')](),controller[_0xe27e('0xf')]);router[_0xe27e('0x8')](_0xe27e('0x10'),auth['isAuthenticated'](),controller[_0xe27e('0x11')]);router[_0xe27e('0x8')](_0xe27e('0x12'),auth[_0xe27e('0x9')](),controller[_0xe27e('0x13')]);router[_0xe27e('0x8')](_0xe27e('0x14'),auth[_0xe27e('0x9')](),controller[_0xe27e('0x15')]);router[_0xe27e('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xe27e('0x16')]);router[_0xe27e('0x8')](_0xe27e('0x17'),auth[_0xe27e('0x9')](),controller['getApplications']);router[_0xe27e('0x8')](_0xe27e('0x18'),auth[_0xe27e('0x9')](),controller['getMessages']);router[_0xe27e('0x8')]('/:id/verify',auth[_0xe27e('0x9')](),controller[_0xe27e('0x19')]);router['get'](_0xe27e('0x1a'),auth['isAuthenticated'](),controller[_0xe27e('0x1b')]);router[_0xe27e('0x1c')](_0xe27e('0xe'),auth['isAuthenticated'](),controller[_0xe27e('0x1d')]);router[_0xe27e('0x1c')](_0xe27e('0x10'),auth[_0xe27e('0x9')](),controller[_0xe27e('0x1e')]);router[_0xe27e('0x1c')]('/',auth[_0xe27e('0x9')](),controller[_0xe27e('0x1f')]);router['post'](_0xe27e('0x12'),auth[_0xe27e('0x9')](),controller[_0xe27e('0x20')]);router[_0xe27e('0x1c')](_0xe27e('0x14'),auth[_0xe27e('0x9')](),controller[_0xe27e('0x21')]);router[_0xe27e('0x1c')](_0xe27e('0x22'),auth[_0xe27e('0x9')](),controller['addInteraction']);router[_0xe27e('0x1c')](_0xe27e('0x17'),auth[_0xe27e('0x9')](),controller[_0xe27e('0x23')]);router[_0xe27e('0x1c')](_0xe27e('0x24'),auth[_0xe27e('0x9')](),controller[_0xe27e('0x25')]);router[_0xe27e('0x1c')](_0xe27e('0x1a'),auth[_0xe27e('0x9')](),controller['addAgents']);router[_0xe27e('0x26')](_0xe27e('0xd'),auth[_0xe27e('0x9')](),controller['update']);router['delete'](_0xe27e('0xe'),auth[_0xe27e('0x9')](),controller[_0xe27e('0x27')]);router[_0xe27e('0x28')]('/:id/canned_answers',auth[_0xe27e('0x9')](),controller[_0xe27e('0x29')]);router[_0xe27e('0x28')]('/:id/in_servers',auth[_0xe27e('0x9')](),controller['removeImap']);router[_0xe27e('0x28')]('/:id/out_servers',auth[_0xe27e('0x9')](),controller['removeSmtp']);router[_0xe27e('0x28')](_0xe27e('0xd'),auth[_0xe27e('0x9')](),controller[_0xe27e('0x2a')]);router[_0xe27e('0x28')](_0xe27e('0x1a'),auth['isAuthenticated'](),controller[_0xe27e('0x2b')]);module[_0xe27e('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index ce28101..f8a2677 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 _0x7768=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','provider','custom','getDataValue','sequelize','exports'];(function(_0x1ae5c5,_0x338257){var _0x25af36=function(_0x1f008b){while(--_0x1f008b){_0x1ae5c5['push'](_0x1ae5c5['shift']());}};_0x25af36(++_0x338257);}(_0x7768,0x7c));var _0x8776=function(_0x7d6107,_0x1bbd69){_0x7d6107=_0x7d6107-0x0;var _0xb656d8=_0x7768[_0x7d6107];return _0xb656d8;};'use strict';var Sequelize=require(_0x8776('0x0'));module[_0x8776('0x1')]={'description':{'type':Sequelize[_0x8776('0x2')]},'name':{'type':Sequelize[_0x8776('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x8776('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x8776('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x8776('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x8776('0x4')]},'markAsUnread':{'type':Sequelize[_0x8776('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8776('0x2')],'allowNull':![],'defaultValue':_0x8776('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x8776('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8776('0x4')],'defaultValue':function(){return _0x8776('0x7');}},'notificationSound':{'type':Sequelize[_0x8776('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8776('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8776('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8776('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8776('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8776('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8776('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x8776('0x3')],'defaultValue':![],'comment':_0x8776('0xa'),'set':function(_0x3bb8e9){if(!_0x3bb8e9)this[_0x8776('0xb')](_0x8776('0xc'),null);this['setDataValue'](_0x8776('0xd'),_0x3bb8e9);}},'provider':{'type':Sequelize[_0x8776('0xe')](_0x8776('0xf'),'hotmail',_0x8776('0x10'),_0x8776('0x11')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x8776('0x12')))return _0x8776('0x13');return this[_0x8776('0x14')]('provider');},'set':function(_0x290c20){if(_0x290c20===_0x8776('0x13'))_0x290c20=null;return this[_0x8776('0xb')](_0x8776('0x12'),_0x290c20);}}}; \ No newline at end of file +var _0x02f7=['mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x20f0e4,_0x32b6b6){var _0x457421=function(_0xce6044){while(--_0xce6044){_0x20f0e4['push'](_0x20f0e4['shift']());}};_0x457421(++_0x32b6b6);}(_0x02f7,0xce));var _0x702f=function(_0x908eb6,_0x59199b){_0x908eb6=_0x908eb6-0x0;var _0x511a09=_0x02f7[_0x908eb6];return _0x511a09;};'use strict';var Sequelize=require(_0x702f('0x0'));module[_0x702f('0x1')]={'description':{'type':Sequelize[_0x702f('0x2')]},'name':{'type':Sequelize[_0x702f('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x702f('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x702f('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x702f('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x702f('0x5')},'fontSize':{'type':Sequelize[_0x702f('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x702f('0x4')],'defaultValue':function(){return _0x702f('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x702f('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x702f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x702f('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x702f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x702f('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x702f('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x702f('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x702f('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1fad3b){if(!_0x1fad3b)this[_0x702f('0x9')](_0x702f('0xa'),null);this[_0x702f('0x9')]('mandatoryDisposition',_0x1fad3b);}},'provider':{'type':Sequelize[_0x702f('0xb')](_0x702f('0xc'),_0x702f('0xd'),_0x702f('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x702f('0xf')](_0x702f('0x10')))return _0x702f('0x11');return this[_0x702f('0xf')]('provider');},'set':function(_0x25918c){if(_0x25918c===_0x702f('0x11'))_0x25918c=null;return this['setDataValue'](_0x702f('0x10'),_0x25918c);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index adbcdba..4cf631c 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 _0xa805=['root','basename','getSmtpOptions','List\x20not\x20found','defaults','messageId','subject','attach','out','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','getAgents','bluebird','util','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','MailAccounts','UserProfileResource','destroy','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','secure','service','authentication','host','Imap','Smtp','port','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','MailAccount','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','body','provider','MailAccountId','Disposition','create','findOne','length','hasOwnProperty','findAll','removeDispositions','CannedAnswer','removeAnswers','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','ids','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','true','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa805,0xde));var _0x5a80=function(_0x2ea4ae,_0x518776){_0x2ea4ae=_0x2ea4ae-0x0;var _0x2c4b84=_0xa805[_0x2ea4ae];return _0x2c4b84;};'use strict';var moment=require('moment');var BPromise=require(_0x5a80('0x0'));var util=require(_0x5a80('0x1'));var path=require('path');var _=require(_0x5a80('0x2'));var juice=require(_0x5a80('0x3'));var Redis=require('ioredis');var qs=require(_0x5a80('0x4'));var logger=require(_0x5a80('0x5'))(_0x5a80('0x6'));var config=require(_0x5a80('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x5a80('0x8')],{'host':_0x5a80('0x9'),'port':0x18eb});var socket=require(_0x5a80('0xa'))(new Redis(config[_0x5a80('0x8')]));require(_0x5a80('0xb'))[_0x5a80('0xc')](socket);var jayson=require(_0x5a80('0xd'));var client=jayson[_0x5a80('0xe')]['http']({'port':0x232b});function respondWithRpcPromise(_0xb0b676,_0x580ece,_0x1ffc56,_0x142dcf){return new BPromise(function(_0x2c9f98,_0x50a7a7){var _0x120fc2=_0x142dcf||client;return _0x120fc2[_0x5a80('0xf')](_0xb0b676,_0x1ffc56)['then'](function(_0x34c661){logger[_0x5a80('0x10')](_0x5a80('0x11'),_0x580ece,_0x5a80('0x12'));logger[_0x5a80('0x13')](_0x5a80('0x14'),_0x580ece,_0x5a80('0x12'),JSON[_0x5a80('0x15')](_0x34c661));if(_0x34c661[_0x5a80('0x16')]){if(_0x34c661[_0x5a80('0x16')][_0x5a80('0x17')]===0x1f4){logger['error'](_0x5a80('0x11'),_0x580ece,_0x34c661[_0x5a80('0x16')][_0x5a80('0x18')]);return _0x50a7a7(_0x34c661[_0x5a80('0x16')]['message']);}logger['error'](_0x5a80('0x11'),_0x580ece,_0x34c661[_0x5a80('0x16')][_0x5a80('0x18')]);return _0x2c9f98(_0x34c661[_0x5a80('0x16')][_0x5a80('0x18')]);}else{logger[_0x5a80('0x10')](_0x5a80('0x11'),_0x580ece,_0x5a80('0x12'));_0x2c9f98(_0x34c661[_0x5a80('0x19')]['message']);}})['catch'](function(_0x4c9ce2){logger[_0x5a80('0x16')](_0x5a80('0x11'),_0x580ece,_0x4c9ce2);_0x50a7a7(_0x4c9ce2);});});}function respondWithStatusCode(_0x436cce,_0xdd6e0){_0xdd6e0=_0xdd6e0||0xcc;return function(_0x315e2f){if(_0x315e2f){return _0x436cce[_0x5a80('0x1a')](_0xdd6e0);}return _0x436cce[_0x5a80('0x1b')](_0xdd6e0)[_0x5a80('0x1c')]();};}function respondWithResult(_0x2b6c56,_0x5d3290){_0x5d3290=_0x5d3290||0xc8;return function(_0x468b8b){if(_0x468b8b){return _0x2b6c56['status'](_0x5d3290)[_0x5a80('0x1d')](_0x468b8b);}};}function respondWithFilteredResult(_0x378662,_0x3f130c){return function(_0x52a58b){if(_0x52a58b){var _0x44ac20=typeof _0x3f130c[_0x5a80('0x1e')]===_0x5a80('0x1f')&&typeof _0x3f130c[_0x5a80('0x20')]===_0x5a80('0x1f');var _0x12b0bd=_0x52a58b[_0x5a80('0x21')];var _0x57eb1e=_0x44ac20?0x0:_0x3f130c[_0x5a80('0x1e')];var _0x131291=_0x44ac20?_0x52a58b[_0x5a80('0x21')]:_0x3f130c[_0x5a80('0x1e')]+_0x3f130c['limit'];var _0xc4d8c7;if(_0x131291>=_0x12b0bd){_0x131291=_0x12b0bd;_0xc4d8c7=0xc8;}else{_0xc4d8c7=0xce;}_0x378662['status'](_0xc4d8c7);return _0x378662[_0x5a80('0x22')](_0x5a80('0x23'),_0x57eb1e+'-'+_0x131291+'/'+_0x12b0bd)['json'](_0x52a58b);}return null;};}function saveUpdates(_0x3b96a0){return function(_0x31a7c4){if(_0x31a7c4){return _0x31a7c4[_0x5a80('0x24')](_0x3b96a0)[_0x5a80('0x25')](function(_0x2644a5){return _0x2644a5;});}return null;};}function removeEntity(_0x5de62b){return function(_0x15f32b){if(_0x15f32b){return _0x15f32b['destroy']()[_0x5a80('0x25')](function(){var _0x520cdd=_0x15f32b['get']({'plain':!![]});var _0x517e0d=_0x5a80('0x26');return db[_0x5a80('0x27')][_0x5a80('0x28')]({'where':{'type':_0x517e0d,'resourceId':_0x520cdd['id']}})[_0x5a80('0x25')](function(){return _0x15f32b;});})[_0x5a80('0x25')](function(){_0x5de62b[_0x5a80('0x1b')](0xcc)[_0x5a80('0x1c')]();});}};}function handleEntityNotFound(_0x5c2020){return function(_0x169fcd){if(!_0x169fcd){_0x5c2020[_0x5a80('0x1a')](0x194);}return _0x169fcd;};}function handleError(_0x308219,_0x95431){_0x95431=_0x95431||0x1f4;return function(_0xe3365){logger[_0x5a80('0x16')](_0xe3365[_0x5a80('0x29')]);if(_0xe3365[_0x5a80('0x2a')]){delete _0xe3365['name'];}_0x308219[_0x5a80('0x1b')](_0x95431)[_0x5a80('0x2b')](_0xe3365);};}function getImapHost(_0x4e24fc){switch(_0x4e24fc){case _0x5a80('0x2c'):return _0x5a80('0x2d');case _0x5a80('0x2e'):return'imap.mail.yahoo.com';case _0x5a80('0x2f'):return'imap-mail.outlook.com';case _0x5a80('0x30'):return _0x5a80('0x31');}throw new Error(_0x5a80('0x32'),_0x4e24fc);}function getSmtpHost(_0x8b58a5){switch(_0x8b58a5){case _0x5a80('0x2c'):return _0x5a80('0x33');case _0x5a80('0x2e'):return _0x5a80('0x34');case'hotmail':return _0x5a80('0x35');case _0x5a80('0x30'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x8b58a5);}function getAuthenticationOptions(_0x394a7d,_0x1a7f25){var _0x1c25cd={};var _0x2469ad={};if(_0x394a7d){_0x1c25cd[_0x5a80('0x36')]=_0x2469ad[_0x5a80('0x36')]=_0x1a7f25[_0x5a80('0x37')];_0x1c25cd[_0x5a80('0x38')]=_0x2469ad[_0x5a80('0x39')]=_0x1a7f25[_0x5a80('0x38')];if(_0x1a7f25['modernAuthentication']){_0x1c25cd[_0x5a80('0x3a')]=_0x2469ad[_0x5a80('0x3a')]=!![];_0x1c25cd[_0x5a80('0x3b')]=_0x2469ad[_0x5a80('0x3b')]=_0x1a7f25['CloudProviderId'];_0x1c25cd[_0x5a80('0x38')]=_0x2469ad[_0x5a80('0x39')]=null;}else{_0x1c25cd[_0x5a80('0x3b')]=_0x2469ad[_0x5a80('0x3b')]=null;}_0x1c25cd['host']=getImapHost(_0x394a7d);_0x1c25cd['port']=0x3e1;_0x2469ad['host']=getSmtpHost(_0x394a7d);_0x2469ad['port']=0x24b;_0x2469ad[_0x5a80('0x3c')]=![];_0x1c25cd['service']=_0x2469ad[_0x5a80('0x3d')]=null;}else{if(_0x1a7f25[_0x5a80('0x3e')]){_0x1c25cd[_0x5a80('0x36')]=_0x2469ad['user']=_0x1a7f25['username'];_0x1c25cd[_0x5a80('0x38')]=_0x2469ad[_0x5a80('0x39')]=_0x1a7f25['password'];}else{_0x1c25cd['authentication']=_0x2469ad[_0x5a80('0x3e')]=![];_0x1c25cd[_0x5a80('0x36')]=_0x2469ad['user']=null;_0x1c25cd[_0x5a80('0x38')]=_0x2469ad[_0x5a80('0x39')]=null;}_0x1c25cd[_0x5a80('0x3f')]=_0x1a7f25['Imap'][_0x5a80('0x3f')];_0x1c25cd['port']=_0x1a7f25[_0x5a80('0x40')]['port'];_0x2469ad['host']=_0x1a7f25[_0x5a80('0x41')][_0x5a80('0x3f')];_0x2469ad[_0x5a80('0x42')]=_0x1a7f25[_0x5a80('0x41')][_0x5a80('0x42')];}return{'Imap':_0x1c25cd,'Smtp':_0x2469ad};}exports[_0x5a80('0x43')]=function(_0x1c5030,_0x51aad4){var _0x1fe6b1={'include':[{'model':db[_0x5a80('0x44')],'as':_0x5a80('0x40')},{'model':db[_0x5a80('0x45')],'as':'Smtp'},{'model':db[_0x5a80('0x46')],'as':_0x5a80('0x47')}]},_0x42958b={},_0x2be81f={'count':0x0,'rows':[]};var _0x599ce8=_[_0x5a80('0x48')](db['MailAccount']['rawAttributes'],function(_0x5a001e){return{'name':_0x5a001e[_0x5a80('0x49')],'type':_0x5a001e[_0x5a80('0x4a')][_0x5a80('0x4b')]};});_0x42958b[_0x5a80('0x4c')]=_['map'](_0x599ce8,_0x5a80('0x2a'));_0x42958b[_0x5a80('0x4d')]=_['keys'](_0x1c5030[_0x5a80('0x4d')]);_0x42958b[_0x5a80('0x4e')]=_[_0x5a80('0x4f')](_0x42958b[_0x5a80('0x4c')],_0x42958b['query']);_0x1fe6b1[_0x5a80('0x50')]=_['intersection'](_0x42958b[_0x5a80('0x4c')],qs[_0x5a80('0x51')](_0x1c5030['query'][_0x5a80('0x51')]));_0x1fe6b1[_0x5a80('0x50')]=_0x1fe6b1[_0x5a80('0x50')]['length']?_0x1fe6b1['attributes']:_0x42958b[_0x5a80('0x4c')];if(!_0x1c5030['query']['hasOwnProperty'](_0x5a80('0x52'))){_0x1fe6b1['limit']=qs['limit'](_0x1c5030[_0x5a80('0x4d')]['limit']);_0x1fe6b1[_0x5a80('0x1e')]=qs[_0x5a80('0x1e')](_0x1c5030[_0x5a80('0x4d')][_0x5a80('0x1e')]);}_0x1fe6b1[_0x5a80('0x53')]=qs['sort'](_0x1c5030[_0x5a80('0x4d')][_0x5a80('0x54')]);_0x1fe6b1['where']=qs[_0x5a80('0x4e')](_[_0x5a80('0x55')](_0x1c5030['query'],_0x42958b[_0x5a80('0x4e')]),_0x599ce8);if(_0x1c5030[_0x5a80('0x4d')][_0x5a80('0x56')]){_0x1fe6b1[_0x5a80('0x57')]=_[_0x5a80('0x58')](_0x1fe6b1[_0x5a80('0x57')],{'$or':_[_0x5a80('0x48')](_0x599ce8,function(_0x481b92){if(_0x481b92[_0x5a80('0x4a')]!=='VIRTUAL'){var _0x144c84={};_0x144c84[_0x481b92[_0x5a80('0x2a')]]={'$like':'%'+_0x1c5030[_0x5a80('0x4d')][_0x5a80('0x56')]+'%'};return _0x144c84;}})});}_0x1fe6b1=_[_0x5a80('0x58')]({},_0x1fe6b1,_0x1c5030[_0x5a80('0x59')]);var _0x499720={'where':_0x1fe6b1['where']};return db[_0x5a80('0x5a')]['count'](_0x499720)['then'](function(_0x3fa047){_0x2be81f[_0x5a80('0x21')]=_0x3fa047;if(_0x1c5030['query'][_0x5a80('0x5b')]){_0x1fe6b1[_0x5a80('0x5c')]=[{'all':!![]}];}return db[_0x5a80('0x5a')]['findAll'](_0x1fe6b1);})[_0x5a80('0x25')](function(_0x36709b){_0x2be81f[_0x5a80('0x5d')]=_0x36709b;return _0x2be81f;})[_0x5a80('0x25')](respondWithFilteredResult(_0x51aad4,_0x1fe6b1))[_0x5a80('0x5e')](handleError(_0x51aad4,null));};exports[_0x5a80('0x5f')]=function(_0x3867dd,_0x236fc8){var _0x584cf4={'raw':![],'where':{'id':_0x3867dd[_0x5a80('0x60')]['id']},'include':[{'model':db[_0x5a80('0x44')],'as':_0x5a80('0x40')},{'model':db[_0x5a80('0x45')],'as':_0x5a80('0x41')},{'model':db[_0x5a80('0x46')],'as':_0x5a80('0x47')}]},_0x1cf164={};_0x1cf164['model']=_[_0x5a80('0x61')](db[_0x5a80('0x5a')][_0x5a80('0x62')]);_0x1cf164['query']=_['keys'](_0x3867dd[_0x5a80('0x4d')]);_0x1cf164[_0x5a80('0x4e')]=_[_0x5a80('0x4f')](_0x1cf164[_0x5a80('0x4c')],_0x1cf164['query']);_0x584cf4[_0x5a80('0x50')]=_['intersection'](_0x1cf164['model'],qs[_0x5a80('0x51')](_0x3867dd[_0x5a80('0x4d')][_0x5a80('0x51')]));_0x584cf4[_0x5a80('0x50')]=_0x584cf4[_0x5a80('0x50')]['length']?_0x584cf4[_0x5a80('0x50')]:_0x1cf164[_0x5a80('0x4c')];if(_0x3867dd[_0x5a80('0x4d')]['includeAll']){_0x584cf4[_0x5a80('0x5c')]=[{'all':!![]}];}_0x584cf4=_[_0x5a80('0x58')]({},_0x584cf4,_0x3867dd[_0x5a80('0x59')]);return db['MailAccount'][_0x5a80('0x63')](_0x584cf4)['then'](handleEntityNotFound(_0x236fc8,null))[_0x5a80('0x25')](respondWithResult(_0x236fc8,null))['catch'](handleError(_0x236fc8,null));};exports[_0x5a80('0x24')]=function(_0x4c9334,_0x209e61){if(_0x4c9334[_0x5a80('0x64')]['id']){delete _0x4c9334[_0x5a80('0x64')]['id'];}var _0x6d44ef=_0x4c9334[_0x5a80('0x64')][_0x5a80('0x65')]==='custom'?null:_0x4c9334[_0x5a80('0x64')][_0x5a80('0x65')];var _0x15e850=_0x4c9334['body'][_0x5a80('0x40')]||{};var _0x3b12af=_0x4c9334[_0x5a80('0x64')][_0x5a80('0x41')]||{};if(_0x6d44ef){_0x15e850[_0x5a80('0x3f')]=getImapHost(_0x6d44ef);_0x15e850['port']=0x3e1;_0x3b12af['host']=getSmtpHost(_0x6d44ef);_0x3b12af[_0x5a80('0x42')]=0x24b;_0x3b12af['secure']=![];}if(_0x3b12af[_0x5a80('0x3a')]){_0x3b12af[_0x5a80('0x3c')]=![];}else{_0x3b12af[_0x5a80('0x3b')]=null;}if(!_0x15e850[_0x5a80('0x3a')])_0x15e850[_0x5a80('0x3b')]=null;_0x4c9334[_0x5a80('0x64')][_0x5a80('0x40')]=_0x15e850;_0x4c9334[_0x5a80('0x64')]['Smtp']=_0x3b12af;return db[_0x5a80('0x5a')][_0x5a80('0x63')]({'where':{'id':_0x4c9334[_0x5a80('0x60')]['id']},'include':[{'model':db[_0x5a80('0x44')],'as':_0x5a80('0x40')},{'model':db[_0x5a80('0x45')],'as':_0x5a80('0x41')},{'model':db[_0x5a80('0x46')],'as':_0x5a80('0x47')}]})[_0x5a80('0x25')](handleEntityNotFound(_0x209e61,null))[_0x5a80('0x25')](function(_0x4a379a){if(!_0x4a379a)throw new Error('Mail\x20Account\x20not\x20found');if(_0x4a379a[_0x5a80('0x3d')])delete _0x4c9334[_0x5a80('0x64')]['Imap'];return _0x4a379a;})[_0x5a80('0x25')](saveUpdates(_0x4c9334[_0x5a80('0x64')],null))[_0x5a80('0x25')](function(_0x3ec60e){if(!_0x4c9334[_0x5a80('0x64')][_0x5a80('0x40')])return _0x3ec60e;return db[_0x5a80('0x44')]['update'](_0x4c9334[_0x5a80('0x64')]['Imap'],{'where':{'MailAccountId':_0x3ec60e['id']}})['then'](function(){return _0x3ec60e;});})['then'](function(_0x29ad8c){if(!_0x4c9334[_0x5a80('0x64')][_0x5a80('0x41')])return _0x29ad8c;return db[_0x5a80('0x45')]['update'](_0x4c9334[_0x5a80('0x64')]['Smtp'],{'where':{'MailAccountId':_0x29ad8c['id']}})[_0x5a80('0x25')](function(){return _0x29ad8c;});})[_0x5a80('0x25')](respondWithResult(_0x209e61,null))[_0x5a80('0x5e')](handleError(_0x209e61,null));};exports['describe']=function(_0x48342d,_0x48a7af){return db[_0x5a80('0x5a')]['describe']()['then'](respondWithResult(_0x48a7af,null))[_0x5a80('0x5e')](handleError(_0x48a7af,null));};exports['addDisposition']=function(_0xacc334,_0x14c612){if(_0xacc334[_0x5a80('0x64')]['id']){delete _0xacc334['body']['id'];}return db[_0x5a80('0x5a')][_0x5a80('0x63')]({'where':{'id':_0xacc334[_0x5a80('0x60')]['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x14c612,null))['then'](function(_0x17148c){if(_0x17148c){_0xacc334[_0x5a80('0x64')][_0x5a80('0x66')]=_0x17148c['id'];return db[_0x5a80('0x67')][_0x5a80('0x68')](_0xacc334['body']);}})[_0x5a80('0x25')](respondWithResult(_0x14c612,null))[_0x5a80('0x5e')](handleError(_0x14c612,null));};exports['getDispositions']=function(_0x55cf06,_0x4d82d6){var _0x552128={'raw':![],'where':{}};var _0x5b20d0={};var _0x497d6c={'count':0x0,'rows':[]};return db[_0x5a80('0x5a')][_0x5a80('0x69')]({'where':{'id':_0x55cf06['params']['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x4d82d6,null))[_0x5a80('0x25')](function(_0x1d5c35){if(_0x1d5c35){_0x5b20d0[_0x5a80('0x4c')]=_[_0x5a80('0x61')](db[_0x5a80('0x67')][_0x5a80('0x62')]);_0x5b20d0[_0x5a80('0x4d')]=_['keys'](_0x55cf06[_0x5a80('0x4d')]);_0x5b20d0['filters']=_[_0x5a80('0x4f')](_0x5b20d0[_0x5a80('0x4c')],_0x5b20d0[_0x5a80('0x4d')]);_0x552128[_0x5a80('0x50')]=_[_0x5a80('0x4f')](_0x5b20d0[_0x5a80('0x4c')],qs['fields'](_0x55cf06[_0x5a80('0x4d')][_0x5a80('0x51')]));_0x552128[_0x5a80('0x50')]=_0x552128[_0x5a80('0x50')][_0x5a80('0x6a')]?_0x552128[_0x5a80('0x50')]:_0x5b20d0[_0x5a80('0x4c')];if(!_0x55cf06[_0x5a80('0x4d')][_0x5a80('0x6b')]('nolimit')){_0x552128[_0x5a80('0x20')]=qs[_0x5a80('0x20')](_0x55cf06['query'][_0x5a80('0x20')]);_0x552128['offset']=qs['offset'](_0x55cf06[_0x5a80('0x4d')][_0x5a80('0x1e')]);}_0x552128[_0x5a80('0x53')]=qs[_0x5a80('0x54')](_0x55cf06[_0x5a80('0x4d')][_0x5a80('0x54')]);_0x552128[_0x5a80('0x57')]=qs[_0x5a80('0x4e')](_[_0x5a80('0x55')](_0x55cf06[_0x5a80('0x4d')],_0x5b20d0[_0x5a80('0x4e')]));_0x552128[_0x5a80('0x57')][_0x5a80('0x66')]=_0x1d5c35['id'];if(_0x55cf06[_0x5a80('0x4d')][_0x5a80('0x56')]){_0x552128[_0x5a80('0x57')]=_[_0x5a80('0x58')](_0x552128[_0x5a80('0x57')],{'$or':_[_0x5a80('0x48')](_0x552128[_0x5a80('0x50')],function(_0x1fbe97){var _0x22fbf5={};_0x22fbf5[_0x1fbe97]={'$like':'%'+_0x55cf06[_0x5a80('0x4d')][_0x5a80('0x56')]+'%'};return _0x22fbf5;})});}_0x552128=_['merge']({},_0x552128,_0x55cf06[_0x5a80('0x59')]);return db[_0x5a80('0x67')][_0x5a80('0x21')]({'where':_0x552128['where']})[_0x5a80('0x25')](function(_0x10b0f2){_0x497d6c[_0x5a80('0x21')]=_0x10b0f2;if(_0x55cf06[_0x5a80('0x4d')][_0x5a80('0x5b')]){_0x552128[_0x5a80('0x5c')]=[{'all':!![]}];}return db[_0x5a80('0x67')][_0x5a80('0x6c')](_0x552128);})[_0x5a80('0x25')](function(_0x1a96c8){_0x497d6c[_0x5a80('0x5d')]=_0x1a96c8;return _0x497d6c;});}})[_0x5a80('0x25')](respondWithFilteredResult(_0x4d82d6,_0x552128))['catch'](handleError(_0x4d82d6,null));};exports[_0x5a80('0x6d')]=function(_0x4de180,_0x3ad3a8){return db['MailAccount'][_0x5a80('0x63')]({'where':{'id':_0x4de180[_0x5a80('0x60')]['id']}})['then'](handleEntityNotFound(_0x3ad3a8,null))['then'](function(_0x564439){if(_0x564439){return _0x564439['removeDispositions'](_0x4de180[_0x5a80('0x4d')]['ids']);}})[_0x5a80('0x25')](respondWithStatusCode(_0x3ad3a8,null))[_0x5a80('0x5e')](handleError(_0x3ad3a8,null));};exports['addAnswer']=function(_0xe24c68,_0x4ce5ca){if(_0xe24c68[_0x5a80('0x64')]['id']){delete _0xe24c68[_0x5a80('0x64')]['id'];}return db['MailAccount'][_0x5a80('0x63')]({'where':{'id':_0xe24c68[_0x5a80('0x60')]['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x4ce5ca,null))[_0x5a80('0x25')](function(_0x5604c3){if(_0x5604c3){_0xe24c68[_0x5a80('0x64')][_0x5a80('0x66')]=_0x5604c3['id'];return db[_0x5a80('0x6e')][_0x5a80('0x68')](_0xe24c68[_0x5a80('0x64')]);}})[_0x5a80('0x25')](respondWithResult(_0x4ce5ca,null))[_0x5a80('0x5e')](handleError(_0x4ce5ca,null));};exports['getAnswers']=function(_0x1476f0,_0x3cb5f2){var _0x19e5bb={'raw':![],'where':{}};var _0x501d3b={};var _0x5c89d7={'count':0x0,'rows':[]};return db[_0x5a80('0x5a')][_0x5a80('0x69')]({'where':{'id':_0x1476f0[_0x5a80('0x60')]['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x3cb5f2,null))[_0x5a80('0x25')](function(_0x2d76f0){if(_0x2d76f0){_0x501d3b[_0x5a80('0x4c')]=_[_0x5a80('0x61')](db['CannedAnswer']['rawAttributes']);_0x501d3b[_0x5a80('0x4d')]=_[_0x5a80('0x61')](_0x1476f0[_0x5a80('0x4d')]);_0x501d3b[_0x5a80('0x4e')]=_[_0x5a80('0x4f')](_0x501d3b[_0x5a80('0x4c')],_0x501d3b[_0x5a80('0x4d')]);_0x19e5bb[_0x5a80('0x50')]=_[_0x5a80('0x4f')](_0x501d3b['model'],qs['fields'](_0x1476f0[_0x5a80('0x4d')][_0x5a80('0x51')]));_0x19e5bb['attributes']=_0x19e5bb[_0x5a80('0x50')][_0x5a80('0x6a')]?_0x19e5bb['attributes']:_0x501d3b['model'];if(!_0x1476f0[_0x5a80('0x4d')][_0x5a80('0x6b')](_0x5a80('0x52'))){_0x19e5bb[_0x5a80('0x20')]=qs['limit'](_0x1476f0[_0x5a80('0x4d')]['limit']);_0x19e5bb[_0x5a80('0x1e')]=qs[_0x5a80('0x1e')](_0x1476f0[_0x5a80('0x4d')][_0x5a80('0x1e')]);}_0x19e5bb[_0x5a80('0x53')]=qs[_0x5a80('0x54')](_0x1476f0[_0x5a80('0x4d')][_0x5a80('0x54')]);_0x19e5bb[_0x5a80('0x57')]=qs[_0x5a80('0x4e')](_[_0x5a80('0x55')](_0x1476f0[_0x5a80('0x4d')],_0x501d3b[_0x5a80('0x4e')]));_0x19e5bb['where'][_0x5a80('0x66')]=_0x2d76f0['id'];if(_0x1476f0[_0x5a80('0x4d')][_0x5a80('0x56')]){_0x19e5bb[_0x5a80('0x57')]=_['merge'](_0x19e5bb['where'],{'$or':_[_0x5a80('0x48')](_0x19e5bb[_0x5a80('0x50')],function(_0x20eaaf){var _0x5a1345={};_0x5a1345[_0x20eaaf]={'$like':'%'+_0x1476f0[_0x5a80('0x4d')][_0x5a80('0x56')]+'%'};return _0x5a1345;})});}_0x19e5bb=_[_0x5a80('0x58')]({},_0x19e5bb,_0x1476f0[_0x5a80('0x59')]);return db[_0x5a80('0x6e')][_0x5a80('0x21')]({'where':_0x19e5bb[_0x5a80('0x57')]})['then'](function(_0x54f5dc){_0x5c89d7['count']=_0x54f5dc;if(_0x1476f0['query'][_0x5a80('0x5b')]){_0x19e5bb[_0x5a80('0x5c')]=[{'all':!![]}];}return db[_0x5a80('0x6e')][_0x5a80('0x6c')](_0x19e5bb);})[_0x5a80('0x25')](function(_0x473430){_0x5c89d7[_0x5a80('0x5d')]=_0x473430;return _0x5c89d7;});}})[_0x5a80('0x25')](respondWithFilteredResult(_0x3cb5f2,_0x19e5bb))['catch'](handleError(_0x3cb5f2,null));};exports[_0x5a80('0x6f')]=function(_0x5bf169,_0x2ae8d3){return db[_0x5a80('0x5a')][_0x5a80('0x63')]({'where':{'id':_0x5bf169['params']['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x2ae8d3,null))[_0x5a80('0x25')](function(_0x4942f7){if(_0x4942f7){return _0x4942f7[_0x5a80('0x6f')](_0x5bf169['query']['ids']);}})[_0x5a80('0x25')](respondWithStatusCode(_0x2ae8d3,null))[_0x5a80('0x5e')](handleError(_0x2ae8d3,null));};exports[_0x5a80('0x68')]=function(_0x3e8655,_0x472651){var _0x4162aa={'name':_0x3e8655[_0x5a80('0x64')][_0x5a80('0x2a')],'key':_0x3e8655[_0x5a80('0x64')][_0x5a80('0x4b')],'provider':_0x3e8655[_0x5a80('0x64')][_0x5a80('0x65')]===_0x5a80('0x70')?null:_0x3e8655[_0x5a80('0x64')][_0x5a80('0x65')],'email':_0x3e8655[_0x5a80('0x64')][_0x5a80('0x71')],'ListId':_0x3e8655['body'][_0x5a80('0x72')],'active':!_[_0x5a80('0x73')](_0x3e8655[_0x5a80('0x64')][_0x5a80('0x74')])?_0x3e8655[_0x5a80('0x64')]['active']:!![],'description':_0x3e8655[_0x5a80('0x64')][_0x5a80('0x75')]||null};var _0x2515fc=getAuthenticationOptions(_0x4162aa[_0x5a80('0x65')],_0x3e8655[_0x5a80('0x64')]);_0x4162aa[_0x5a80('0x40')]=_0x2515fc[_0x5a80('0x40')];_0x4162aa[_0x5a80('0x41')]=_0x2515fc['Smtp'];return db[_0x5a80('0x5a')][_0x5a80('0x68')](_0x4162aa,{'include':[{'model':db[_0x5a80('0x45')],'as':'Smtp'},{'model':db[_0x5a80('0x44')],'as':_0x5a80('0x40')}]})['then'](function(_0x4397c9){var _0x5296b0=_0x3e8655['user']['get']({'plain':!![]});if(!_0x5296b0)throw new Error(_0x5a80('0x76'));if(_0x5296b0[_0x5a80('0x77')]==='user'){var _0x3d35c7=_0x4397c9[_0x5a80('0x78')]({'plain':!![]});return db[_0x5a80('0x79')][_0x5a80('0x63')]({'where':{'name':'MailAccounts','userProfileId':_0x5296b0[_0x5a80('0x7a')]},'raw':!![]})['then'](function(_0x509084){if(_0x509084&&_0x509084[_0x5a80('0x7b')]===0x0){return db['UserProfileResource']['create']({'name':_0x3d35c7[_0x5a80('0x2a')],'resourceId':_0x3d35c7['id'],'type':_0x509084[_0x5a80('0x2a')],'sectionId':_0x509084['id']},{})[_0x5a80('0x25')](function(){return _0x4397c9;});}else{return _0x4397c9;}})[_0x5a80('0x5e')](function(_0x2e9f49){logger[_0x5a80('0x16')](_0x5a80('0x7c'),_0x2e9f49);throw _0x2e9f49;});}return _0x4397c9;})[_0x5a80('0x25')](respondWithResult(_0x472651,0xc9))['catch'](handleError(_0x472651,null));};exports[_0x5a80('0x7d')]=function(_0x96a3d5,_0x519d72){return db[_0x5a80('0x5a')][_0x5a80('0x69')]({'where':{'id':_0x96a3d5['params']['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x519d72,null))['then'](function(_0x45942c){if(_0x45942c){return _0x45942c[_0x5a80('0x7d')]();}return null;})[_0x5a80('0x25')](respondWithResult(_0x519d72,null))[_0x5a80('0x5e')](handleError(_0x519d72,null));};exports[_0x5a80('0x7e')]=function(_0x324fc0,_0x5ea4bf){if(_0x324fc0[_0x5a80('0x64')]['id']){delete _0x324fc0[_0x5a80('0x64')]['id'];}return db['MailAccount'][_0x5a80('0x63')]({'where':{'id':_0x324fc0[_0x5a80('0x60')]['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x5ea4bf,null))[_0x5a80('0x25')](function(_0x1c6046){if(_0x1c6046){_0x324fc0[_0x5a80('0x64')]['MailAccountId']=_0x1c6046['id'];return db[_0x5a80('0x44')][_0x5a80('0x68')](_0x324fc0['body']);}})[_0x5a80('0x25')](respondWithResult(_0x5ea4bf,null))[_0x5a80('0x5e')](handleError(_0x5ea4bf,null));};exports[_0x5a80('0x7f')]=function(_0x5282d8,_0x2733a6){return db[_0x5a80('0x5a')][_0x5a80('0x69')]({'where':{'id':_0x5282d8[_0x5a80('0x60')]['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x2733a6,null))[_0x5a80('0x25')](function(_0xa32eeb){if(_0xa32eeb){return _0xa32eeb[_0x5a80('0x80')](null);}return null;})[_0x5a80('0x25')](respondWithStatusCode(_0x2733a6,null))[_0x5a80('0x5e')](handleError(_0x2733a6,null));};exports[_0x5a80('0x81')]=function(_0x3697cc,_0x22e78d){return db['MailAccount']['findOne']({'where':{'id':_0x3697cc[_0x5a80('0x60')]['id']}})['then'](handleEntityNotFound(_0x22e78d,null))['then'](function(_0x423e18){if(_0x423e18){return _0x423e18[_0x5a80('0x81')]();}return null;})[_0x5a80('0x25')](respondWithResult(_0x22e78d,null))[_0x5a80('0x5e')](handleError(_0x22e78d,null));};exports['addSmtp']=function(_0xfa76e0,_0x4241e0){if(_0xfa76e0[_0x5a80('0x64')]['id']){delete _0xfa76e0[_0x5a80('0x64')]['id'];}return db[_0x5a80('0x5a')][_0x5a80('0x63')]({'where':{'id':_0xfa76e0[_0x5a80('0x60')]['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x4241e0,null))[_0x5a80('0x25')](function(_0x28020a){if(_0x28020a){_0xfa76e0[_0x5a80('0x64')][_0x5a80('0x66')]=_0x28020a['id'];return db[_0x5a80('0x45')][_0x5a80('0x68')](_0xfa76e0['body']);}})[_0x5a80('0x25')](respondWithResult(_0x4241e0,null))['catch'](handleError(_0x4241e0,null));};exports[_0x5a80('0x82')]=function(_0x284426,_0x208728){return db[_0x5a80('0x5a')][_0x5a80('0x69')]({'where':{'id':_0x284426['params']['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x208728,null))[_0x5a80('0x25')](function(_0x75743b){if(_0x75743b){return _0x75743b[_0x5a80('0x83')](null);}return null;})[_0x5a80('0x25')](respondWithStatusCode(_0x208728,null))['catch'](handleError(_0x208728,null));};exports[_0x5a80('0x84')]=function(_0x2f2ede,_0x9aab1b){return db[_0x5a80('0x85')]['find']({'where':{'id':_0x2f2ede[_0x5a80('0x60')]['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x9aab1b,null))['then'](function(_0x41bce4){if(_0x41bce4){return _0x41bce4['addInteraction'](_0x2f2ede[_0x5a80('0x64')][_0x5a80('0x86')],_[_0x5a80('0x87')](_0x2f2ede[_0x5a80('0x64')],[_0x5a80('0x86'),'id'])||{});}})[_0x5a80('0x25')](respondWithResult(_0x9aab1b,null))[_0x5a80('0x5e')](handleError(_0x9aab1b,null));};exports[_0x5a80('0x88')]=function(_0x18b0a2,_0x45e183){var _0x2bee56={'raw':![],'where':{}};var _0x466cd4={};var _0x4073b4={'count':0x0,'rows':[]};return db[_0x5a80('0x5a')]['findOne']({'where':{'id':_0x18b0a2[_0x5a80('0x60')]['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x45e183,null))[_0x5a80('0x25')](function(_0x5df69e){if(_0x5df69e){_0x466cd4['model']=_[_0x5a80('0x61')](db['MailInteraction'][_0x5a80('0x62')]);_0x466cd4['query']=_[_0x5a80('0x61')](_0x18b0a2[_0x5a80('0x4d')]);_0x466cd4[_0x5a80('0x4e')]=_[_0x5a80('0x4f')](_0x466cd4[_0x5a80('0x4c')],_0x466cd4['query']);_0x2bee56['attributes']=_['intersection'](_0x466cd4[_0x5a80('0x4c')],qs['fields'](_0x18b0a2[_0x5a80('0x4d')][_0x5a80('0x51')]));_0x2bee56[_0x5a80('0x50')]=_0x2bee56[_0x5a80('0x50')][_0x5a80('0x6a')]?_0x2bee56[_0x5a80('0x50')]:_0x466cd4[_0x5a80('0x4c')];if(!_0x18b0a2[_0x5a80('0x4d')]['hasOwnProperty']('nolimit')){_0x2bee56['limit']=qs[_0x5a80('0x20')](_0x18b0a2[_0x5a80('0x4d')][_0x5a80('0x20')]);_0x2bee56[_0x5a80('0x1e')]=qs[_0x5a80('0x1e')](_0x18b0a2['query'][_0x5a80('0x1e')]);}_0x2bee56[_0x5a80('0x53')]=qs[_0x5a80('0x54')](_0x18b0a2[_0x5a80('0x4d')][_0x5a80('0x54')]);_0x2bee56[_0x5a80('0x57')]=qs[_0x5a80('0x4e')](_['pick'](_0x18b0a2['query'],_0x466cd4[_0x5a80('0x4e')]));_0x2bee56['where'][_0x5a80('0x66')]=_0x5df69e['id'];if(_0x18b0a2['query'][_0x5a80('0x56')]){_0x2bee56['where']=_[_0x5a80('0x58')](_0x2bee56[_0x5a80('0x57')],{'$or':_[_0x5a80('0x48')](_0x2bee56[_0x5a80('0x50')],function(_0x16b3a3){var _0x5aa53c={};_0x5aa53c[_0x16b3a3]={'$like':'%'+_0x18b0a2['query'][_0x5a80('0x56')]+'%'};return _0x5aa53c;})});}_0x2bee56=_[_0x5a80('0x58')]({},_0x2bee56,_0x18b0a2[_0x5a80('0x59')]);return db[_0x5a80('0x85')]['count']({'where':_0x2bee56[_0x5a80('0x57')]})['then'](function(_0x57021f){_0x4073b4[_0x5a80('0x21')]=_0x57021f;if(_0x18b0a2[_0x5a80('0x4d')][_0x5a80('0x5b')]){_0x2bee56[_0x5a80('0x5c')]=[{'model':db[_0x5a80('0x89')],'as':_0x5a80('0x8a'),'required':![]},{'model':db['User'],'as':_0x5a80('0x8b'),'attributes':[_0x5a80('0x2a'),_0x5a80('0x8c'),_0x5a80('0x8d')],'required':![]},{'model':db[_0x5a80('0x8e')],'as':_0x5a80('0x8f'),'attributes':['id',_0x5a80('0x2a'),_0x5a80('0x90')],'where':_0x18b0a2['query']['tag']?{'id':_0x18b0a2[_0x5a80('0x4d')][_0x5a80('0x91')]}:undefined,'required':_0x18b0a2[_0x5a80('0x4d')][_0x5a80('0x91')]?!![]:![]}];}return db[_0x5a80('0x85')]['findAll'](_0x2bee56);})[_0x5a80('0x25')](function(_0x15aeb1){_0x4073b4[_0x5a80('0x5d')]=_0x15aeb1;return _0x4073b4;});}})['then'](respondWithFilteredResult(_0x45e183,_0x2bee56))[_0x5a80('0x5e')](handleError(_0x45e183,null));};exports[_0x5a80('0x92')]=function addApplications(_0x39e366,_0x48e9f6){var _0x3e60cc=_0x39e366[_0x5a80('0x60')]['id'];var _0x4eeedc=_0x39e366[_0x5a80('0x64')];var _0x376a34=0xc8;var _0x3cd2de=null;return db[_0x5a80('0x93')][_0x5a80('0x94')]({'isolationLevel':db[_0x5a80('0x93')]['Transaction'][_0x5a80('0x95')][_0x5a80('0x96')]},function(_0x133bf7){return db[_0x5a80('0x5a')][_0x5a80('0x69')]({'where':{'id':_0x3e60cc},'transaction':_0x133bf7})[_0x5a80('0x25')](function(_0xa36be4){if(_0xa36be4){return db['MailApplication'][_0x5a80('0x28')]({'where':{'MailAccountId':_0x3e60cc},'transaction':_0x133bf7})[_0x5a80('0x25')](function(){var _0x1a9e0f=_[_0x5a80('0x48')](_0x4eeedc,function(_0x43a577){_0x43a577[_0x5a80('0x66')]=_0x3e60cc;return _0x43a577;});return db['MailApplication'][_0x5a80('0x97')](_0x1a9e0f,{'transaction':_0x133bf7});});}else{_0x376a34=0x194;_0x3cd2de=[];}});})[_0x5a80('0x25')](function(){if(_0x376a34!==0x194){return db[_0x5a80('0x98')][_0x5a80('0x99')]({'where':{'MailAccountId':_0x3e60cc},'order':_0x5a80('0x9a')})[_0x5a80('0x25')](function(_0xd196d9){_0x3cd2de=_0xd196d9;});}})['catch'](function(_0x396863){_0x376a34=0x1f4;logger['error'](_0x396863[_0x5a80('0x29')]);if(_0x396863[_0x5a80('0x2a')]){delete _0x396863[_0x5a80('0x2a')];}_0x3cd2de=_0x396863;})[_0x5a80('0x9b')](function(){if(_0x3cd2de===null){_0x48e9f6[_0x5a80('0x1a')](_0x376a34);}else{if(_0x376a34===0x1f4){_0x48e9f6[_0x5a80('0x1b')](_0x376a34)[_0x5a80('0x2b')](_0x3cd2de);}else{_0x48e9f6[_0x5a80('0x1b')](_0x376a34)[_0x5a80('0x1d')](_0x3cd2de);}}});};exports[_0x5a80('0x9c')]=function(_0x47df6b,_0x4f8aed){var _0xda4126={};var _0x2db10a={};var _0x55404e;var _0x4d13ce;return db['MailAccount']['findOne']({'where':{'id':_0x47df6b['params']['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x4f8aed,null))[_0x5a80('0x25')](function(_0xa8aaac){if(_0xa8aaac){_0x55404e=_0xa8aaac;_0x2db10a[_0x5a80('0x4c')]=_['keys'](db[_0x5a80('0x98')][_0x5a80('0x62')]);_0x2db10a[_0x5a80('0x4d')]=_['keys'](_0x47df6b[_0x5a80('0x4d')]);_0x2db10a['filters']=_[_0x5a80('0x4f')](_0x2db10a[_0x5a80('0x4c')],_0x2db10a['query']);_0xda4126[_0x5a80('0x50')]=_[_0x5a80('0x4f')](_0x2db10a['model'],qs[_0x5a80('0x51')](_0x47df6b['query']['fields']));_0xda4126[_0x5a80('0x50')]=_0xda4126[_0x5a80('0x50')][_0x5a80('0x6a')]?_0xda4126[_0x5a80('0x50')]:_0x2db10a[_0x5a80('0x4c')];_0xda4126[_0x5a80('0x53')]=qs[_0x5a80('0x54')](_0x47df6b['query']['sort']);_0xda4126[_0x5a80('0x57')]=qs[_0x5a80('0x4e')](_[_0x5a80('0x55')](_0x47df6b[_0x5a80('0x4d')],_0x2db10a['filters']));if(_0x47df6b[_0x5a80('0x4d')][_0x5a80('0x56')]){_0xda4126[_0x5a80('0x57')]=_[_0x5a80('0x58')](_0xda4126[_0x5a80('0x57')],{'$or':_[_0x5a80('0x48')](_0xda4126[_0x5a80('0x50')],function(_0x21b8b1){var _0x934a19={};_0x934a19[_0x21b8b1]={'$like':'%'+_0x47df6b[_0x5a80('0x4d')][_0x5a80('0x56')]+'%'};return _0x934a19;})});}_0xda4126=_[_0x5a80('0x58')]({},_0xda4126,_0x47df6b[_0x5a80('0x59')]);return _0x55404e['getApplications'](_0xda4126);}})[_0x5a80('0x25')](function(_0x604364){if(_0x604364){_0x4d13ce=_0x604364[_0x5a80('0x6a')];if(!_0x47df6b[_0x5a80('0x4d')]['hasOwnProperty']('nolimit')){_0xda4126[_0x5a80('0x20')]=qs[_0x5a80('0x20')](_0x47df6b['query'][_0x5a80('0x20')]);_0xda4126['offset']=qs[_0x5a80('0x1e')](_0x47df6b[_0x5a80('0x4d')][_0x5a80('0x1e')]);}return _0x55404e[_0x5a80('0x9c')](_0xda4126);}})['then'](function(_0x32656a){if(_0x32656a){return _0x32656a?{'count':_0x4d13ce,'rows':_0x32656a}:null;}})['then'](respondWithResult(_0x4f8aed,null))['catch'](handleError(_0x4f8aed,null));};exports[_0x5a80('0x9d')]=function(_0x495974,_0x317fae){var _0x13ce5e={'raw':!![],'where':{}};var _0xd73421={};var _0x20863f={'count':0x0,'rows':[]};return db[_0x5a80('0x5a')][_0x5a80('0x69')]({'where':{'id':_0x495974['params']['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x317fae,null))[_0x5a80('0x25')](function(_0x298258){if(_0x298258){_0xd73421[_0x5a80('0x4c')]=_[_0x5a80('0x61')](db[_0x5a80('0x9e')]['rawAttributes']);_0xd73421['query']=_[_0x5a80('0x61')](_0x495974[_0x5a80('0x4d')]);_0xd73421[_0x5a80('0x4e')]=_[_0x5a80('0x4f')](_0xd73421[_0x5a80('0x4c')],_0xd73421[_0x5a80('0x4d')]);_0x13ce5e['attributes']=_[_0x5a80('0x4f')](_0xd73421[_0x5a80('0x4c')],qs[_0x5a80('0x51')](_0x495974[_0x5a80('0x4d')][_0x5a80('0x51')]));_0x13ce5e['attributes']=_0x13ce5e[_0x5a80('0x50')][_0x5a80('0x6a')]?_0x13ce5e[_0x5a80('0x50')]:_0xd73421[_0x5a80('0x4c')];if(!_0x495974[_0x5a80('0x4d')][_0x5a80('0x6b')](_0x5a80('0x52'))){_0x13ce5e[_0x5a80('0x20')]=qs['limit'](_0x495974['query'][_0x5a80('0x20')]);_0x13ce5e[_0x5a80('0x1e')]=qs['offset'](_0x495974[_0x5a80('0x4d')][_0x5a80('0x1e')]);}_0x13ce5e[_0x5a80('0x53')]=qs[_0x5a80('0x54')](_0x495974[_0x5a80('0x4d')]['sort']);_0x13ce5e[_0x5a80('0x57')]=qs['filters'](_['pick'](_0x495974[_0x5a80('0x4d')],_0xd73421[_0x5a80('0x4e')]));_0x13ce5e[_0x5a80('0x57')][_0x5a80('0x66')]=_0x298258['id'];if(_0x495974[_0x5a80('0x4d')][_0x5a80('0x56')]){_0x13ce5e[_0x5a80('0x57')]=_[_0x5a80('0x58')](_0x13ce5e[_0x5a80('0x57')],{'$or':_[_0x5a80('0x48')](_0x13ce5e[_0x5a80('0x50')],function(_0x4f85ec){var _0x39d851={};_0x39d851[_0x4f85ec]={'$like':'%'+_0x495974[_0x5a80('0x4d')][_0x5a80('0x56')]+'%'};return _0x39d851;})});}if(_0x495974[_0x5a80('0x4d')]['$gte']){var _0x5ab480=_0x495974[_0x5a80('0x4d')][_0x5a80('0x9f')][_0x5a80('0xa0')](',');var _0x587f7a={};_0x587f7a[_0x5ab480[0x0]]={'$gte':moment(_0x5ab480[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x13ce5e['where']=_['merge'](_0x13ce5e[_0x5a80('0x57')],_0x587f7a);}_0x13ce5e=_[_0x5a80('0x58')]({},_0x13ce5e,_0x495974[_0x5a80('0x59')]);return db[_0x5a80('0x9e')][_0x5a80('0x21')]({'where':_0x13ce5e[_0x5a80('0x57')]})[_0x5a80('0x25')](function(_0x3cb5d4){_0x20863f[_0x5a80('0x21')]=_0x3cb5d4;if(_0x495974['query'][_0x5a80('0x5b')]){_0x13ce5e['include']=[{'all':!![]}];}return db['MailMessage'][_0x5a80('0x6c')](_0x13ce5e);})['then'](function(_0x35d787){if(_0x495974['query']['inlineCss']===_0x5a80('0xa1')){for(var _0x138f56=0x0;_0x138f56<_0x35d787[_0x5a80('0x6a')];_0x138f56++){_0x35d787[_0x138f56][_0x5a80('0x64')]=juice(_0x35d787[_0x138f56][_0x5a80('0x64')]);}}_0x20863f[_0x5a80('0x5d')]=_0x35d787;return _0x20863f;});}})[_0x5a80('0x25')](respondWithFilteredResult(_0x317fae,_0x13ce5e))['catch'](handleError(_0x317fae,null));};exports[_0x5a80('0x2b')]=function(_0x2c833f,_0x5aeee5){var _0x2648d6,_0x42fab0={},_0x44d026;if(_0x2c833f[_0x5a80('0x64')]['to']){_0x44d026=_0x2c833f['body']['to']['split'](',')[0x0];}return db[_0x5a80('0x5a')][_0x5a80('0x63')]({'where':{'id':_0x2c833f['params']['id']},'include':[{'model':db['CmList'],'as':_0x5a80('0xa2'),'include':[{'model':db[_0x5a80('0x89')],'as':_0x5a80('0xa3'),'where':{'email':_0x44d026},'limit':0x1,'order':[[_0x5a80('0xa4'),_0x5a80('0xa5')]]}]},{'model':db[_0x5a80('0x45')],'as':_0x5a80('0x41'),'raw':!![],'include':[{'model':db[_0x5a80('0xa6')],'as':_0x5a80('0xa6'),'raw':!![]}]}]})[_0x5a80('0x25')](handleEntityNotFound(_0x5aeee5,null))['then'](function(_0x28aefa){if(!_0x28aefa)return;_0x2648d6=_0x28aefa;if(!_0x28aefa['Smtp'])throw new Error(_0x5a80('0xa7'));if(_['isNil'](_0x2c833f['body'][_0x5a80('0xa8')])){_0x2c833f[_0x5a80('0x64')][_0x5a80('0xa8')]=util['format'](_0x5a80('0xa9'),_0x28aefa['name'],_0x28aefa[_0x5a80('0x71')]||_0x28aefa[_0x5a80('0x41')][_0x5a80('0x36')]);}if(_0x2c833f[_0x5a80('0x64')][_0x5a80('0xaa')]&&_0x2c833f[_0x5a80('0x64')][_0x5a80('0xaa')][_0x5a80('0x6a')]){for(var _0x185ee7=0x0;_0x185ee7<_0x2c833f[_0x5a80('0x64')][_0x5a80('0xaa')][_0x5a80('0x6a')];_0x185ee7+=0x1){_0x2c833f[_0x5a80('0x64')][_0x5a80('0xaa')][_0x185ee7]={'filename':_0x2c833f[_0x5a80('0x64')][_0x5a80('0xaa')][_0x185ee7][_0x5a80('0x2a')],'path':path[_0x5a80('0xab')](config[_0x5a80('0xac')],'server/files/attachments',_0x2c833f[_0x5a80('0x64')][_0x5a80('0xaa')][_0x185ee7][_0x5a80('0xad')])};}}var _0x3b24cd=_0x28aefa[_0x5a80('0xae')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x3b24cd,'message':_0x2c833f[_0x5a80('0x64')]});})[_0x5a80('0x25')](function(_0x3f3a68){if(!_0x3f3a68)return;_0x42fab0=_0x3f3a68;if(!_0x2648d6[_0x5a80('0xa2')])throw new Error(_0x5a80('0xaf'));if(_0x2648d6[_0x5a80('0xa2')][_0x5a80('0xa3')]['length'])return _0x2648d6[_0x5a80('0xa2')]['Contacts'][0x0];return db['CmContact']['create'](_[_0x5a80('0xb0')](_0x2c833f[_0x5a80('0x64')],{'firstName':_0x2c833f['body']['to'],'email':_0x2c833f[_0x5a80('0x64')]['to'],'phone':_0x2c833f[_0x5a80('0x64')]['to'],'ListId':_0x2648d6[_0x5a80('0x72')]}));})[_0x5a80('0x25')](function(_0x2f4d09){if(!_0x2f4d09)return;var _0x123981={'UserId':_0x2c833f[_0x5a80('0x36')]['id'],'ContactId':_0x2f4d09['id'],'MailAccountId':_0x2648d6['id'],'inReplyTo':_0x42fab0[_0x5a80('0xb1')],'to':_0x2c833f[_0x5a80('0x64')][_0x5a80('0xa8')],'cc':_0x2c833f['body']['cc'],'subject':_0x2c833f['body'][_0x5a80('0xb2')],'attach':_0x2c833f[_0x5a80('0x64')][_0x5a80('0xb3')],'firstMsgDirection':_0x5a80('0xb4'),'lastMsgAt':moment()[_0x5a80('0xb5')](_0x5a80('0xb6')),'lastMsgDirection':_0x5a80('0xb4'),'Messages':[_[_0x5a80('0x58')](_0x2c833f[_0x5a80('0x64')],{'messageId':_0x42fab0[_0x5a80('0xb1')],'sentAt':moment()[_0x5a80('0xb5')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x2648d6['id'],'UserId':_0x2c833f[_0x5a80('0x36')]['id'],'ContactId':_0x2f4d09['id']})]};if(_0x2c833f[_0x5a80('0x64')][_0x5a80('0xb7')]){_0x123981=_[_0x5a80('0x58')](_0x123981,_0x2c833f[_0x5a80('0x64')]['Interaction']);}return db[_0x5a80('0x85')]['create'](_0x123981,{'include':[{'model':db[_0x5a80('0x9e')],'as':_0x5a80('0xb8')}]});})[_0x5a80('0x25')](respondWithResult(_0x5aeee5,null))['catch'](handleError(_0x5aeee5,null));};exports['verifySmtp']=function(_0xa5057c,_0x555c7c){return db[_0x5a80('0x5a')][_0x5a80('0x63')]({'where':{'id':_0xa5057c[_0x5a80('0x60')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x5a80('0x41'),'raw':!![],'include':[{'model':db[_0x5a80('0xa6')],'as':_0x5a80('0xa6'),'raw':!![]}]}]})[_0x5a80('0x25')](handleEntityNotFound(_0x555c7c,null))[_0x5a80('0x25')](function(_0x5680ea){if(!_0x5680ea[_0x5a80('0x41')])return;var _0x29a5f8=_0x5680ea[_0x5a80('0xae')]();return respondWithRpcPromise(_0x5a80('0xb9'),_0x5a80('0xba'),{'account':_0x29a5f8});})[_0x5a80('0x25')](respondWithResult(_0x555c7c,null))[_0x5a80('0x5e')](handleError(_0x555c7c,null));};exports[_0x5a80('0x28')]=function(_0x2dab54,_0x5162f5){return db['MailAccount'][_0x5a80('0x63')]({'where':{'id':_0x2dab54[_0x5a80('0x60')]['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x5162f5,null))[_0x5a80('0x25')](function(_0x249841){if(_0x249841&&_0x249841[_0x5a80('0x3d')]){throw new db[(_0x5a80('0xbb'))][(_0x5a80('0xbc'))](_0x5a80('0xbd'));}return _0x249841;})[_0x5a80('0x25')](removeEntity(_0x5162f5,null))[_0x5a80('0x5e')](handleError(_0x5162f5,null));};exports['addAgents']=function(_0x5672aa,_0x493aa7){return db[_0x5a80('0x5a')][_0x5a80('0x63')]({'where':{'id':_0x5672aa[_0x5a80('0x60')]['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x493aa7,null))[_0x5a80('0x25')](function(_0x2823c9){if(_0x2823c9){return _0x2823c9['addAgents'](_0x5672aa[_0x5a80('0x64')][_0x5a80('0x86')],_[_0x5a80('0x87')](_0x5672aa[_0x5a80('0x64')],[_0x5a80('0x86'),'id'])||{})['spread'](function(_0x5a2cd9){for(var _0x3e87d6=0x0;_0x3e87d6<_0x5672aa[_0x5a80('0x64')][_0x5a80('0x86')][_0x5a80('0x6a')];_0x3e87d6+=0x1){socket[_0x5a80('0xbe')](_0x5a80('0xbf'),{'UserId':Number(_0x5672aa[_0x5a80('0x64')]['ids'][_0x3e87d6]),'MailAccountId':Number(_0x5672aa['params']['id'])});}return _0x5a2cd9;});}})[_0x5a80('0x25')](respondWithResult(_0x493aa7,null))['catch'](handleError(_0x493aa7,null));};exports[_0x5a80('0xc0')]=function(_0x2d6fb9,_0x45e04e){return db[_0x5a80('0x5a')][_0x5a80('0x63')]({'where':{'id':_0x2d6fb9['params']['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x45e04e,null))[_0x5a80('0x25')](function(_0x440789){if(_0x440789){return _0x440789[_0x5a80('0xc0')](_0x2d6fb9['query'][_0x5a80('0x86')])['then'](function(){if(_[_0x5a80('0xc1')](_0x2d6fb9[_0x5a80('0x4d')]['ids'])){for(var _0x4b5f3b=0x0;_0x4b5f3b<_0x2d6fb9[_0x5a80('0x4d')]['ids'][_0x5a80('0x6a')];_0x4b5f3b+=0x1){socket[_0x5a80('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x2d6fb9[_0x5a80('0x4d')][_0x5a80('0x86')][_0x4b5f3b]),'MailAccountId':Number(_0x2d6fb9[_0x5a80('0x60')]['id'])});}}else{socket['emit'](_0x5a80('0xc2'),{'UserId':Number(_0x2d6fb9[_0x5a80('0x4d')][_0x5a80('0x86')]),'MailAccountId':Number(_0x2d6fb9[_0x5a80('0x60')]['id'])});}});}})[_0x5a80('0x25')](respondWithStatusCode(_0x45e04e,null))[_0x5a80('0x5e')](handleError(_0x45e04e,null));};exports['getAgents']=function(_0x4c274f,_0x31aa0f){var _0x140ee9={};var _0x787e22={};var _0x3d2cc7;var _0x3c3470;return db[_0x5a80('0x5a')]['findOne']({'where':{'id':_0x4c274f['params']['id']}})[_0x5a80('0x25')](handleEntityNotFound(_0x31aa0f,null))[_0x5a80('0x25')](function(_0xfef65a){if(_0xfef65a){_0x3d2cc7=_0xfef65a;_0x787e22[_0x5a80('0x4c')]=_[_0x5a80('0x61')](db[_0x5a80('0xc3')][_0x5a80('0x62')]);_0x787e22[_0x5a80('0x4d')]=_[_0x5a80('0x61')](_0x4c274f['query']);_0x787e22['filters']=_[_0x5a80('0x4f')](_0x787e22[_0x5a80('0x4c')],_0x787e22[_0x5a80('0x4d')]);_0x140ee9[_0x5a80('0x50')]=_[_0x5a80('0x4f')](_0x787e22['model'],qs[_0x5a80('0x51')](_0x4c274f[_0x5a80('0x4d')]['fields']));_0x140ee9[_0x5a80('0x50')]=_0x140ee9[_0x5a80('0x50')][_0x5a80('0x6a')]?_0x140ee9[_0x5a80('0x50')]:_0x787e22[_0x5a80('0x4c')];_0x140ee9[_0x5a80('0x53')]=qs['sort'](_0x4c274f['query'][_0x5a80('0x54')]);_0x140ee9[_0x5a80('0x57')]=qs[_0x5a80('0x4e')](_[_0x5a80('0x55')](_0x4c274f[_0x5a80('0x4d')],_0x787e22[_0x5a80('0x4e')]));if(_0x4c274f['query']['filter']){_0x140ee9[_0x5a80('0x57')]=_[_0x5a80('0x58')](_0x140ee9[_0x5a80('0x57')],{'$or':_[_0x5a80('0x48')](_0x140ee9[_0x5a80('0x50')],function(_0x2512aa){var _0x181674={};_0x181674[_0x2512aa]={'$like':'%'+_0x4c274f[_0x5a80('0x4d')][_0x5a80('0x56')]+'%'};return _0x181674;})});}_0x140ee9=_[_0x5a80('0x58')]({},_0x140ee9,_0x4c274f[_0x5a80('0x59')]);return _0x3d2cc7[_0x5a80('0xc4')](_0x140ee9);}})[_0x5a80('0x25')](function(_0x10a4fe){if(_0x10a4fe){_0x3c3470=_0x10a4fe['length'];if(!_0x4c274f[_0x5a80('0x4d')][_0x5a80('0x6b')](_0x5a80('0x52'))){_0x140ee9['limit']=qs[_0x5a80('0x20')](_0x4c274f['query'][_0x5a80('0x20')]);_0x140ee9[_0x5a80('0x1e')]=qs['offset'](_0x4c274f[_0x5a80('0x4d')][_0x5a80('0x1e')]);}return _0x3d2cc7[_0x5a80('0xc4')](_0x140ee9);}})['then'](function(_0x3f1a82){if(_0x3f1a82){return _0x3f1a82?{'count':_0x3c3470,'rows':_0x3f1a82}:null;}})[_0x5a80('0x25')](respondWithResult(_0x31aa0f,null))['catch'](handleError(_0x31aa0f,null));}; \ No newline at end of file +var _0x62fd=['MailAccount,\x20%s,\x20%s','message','info','result','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','end','sendStatus','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','authentication','host','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','find','catch','body','provider','custom','secure','params','service','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','map','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','getAgents','moment','bluebird','lodash','juice','ioredis','api','../../config/environment','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x380a93,_0x63d51d){var _0x2be539=function(_0x8ff520){while(--_0x8ff520){_0x380a93['push'](_0x380a93['shift']());}};_0x2be539(++_0x63d51d);}(_0x62fd,0x16f));var _0xd62f=function(_0x230e86,_0x576839){_0x230e86=_0x230e86-0x0;var _0x5c6f7a=_0x62fd[_0x230e86];return _0x5c6f7a;};'use strict';var moment=require(_0xd62f('0x0'));var BPromise=require(_0xd62f('0x1'));var util=require('util');var path=require('path');var _=require(_0xd62f('0x2'));var juice=require(_0xd62f('0x3'));var Redis=require(_0xd62f('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd62f('0x5'));var config=require(_0xd62f('0x6'));var db=require('../../mysqldb')['db'];config[_0xd62f('0x7')]=_['defaults'](config[_0xd62f('0x7')],{'host':_0xd62f('0x8'),'port':0x18eb});var socket=require(_0xd62f('0x9'))(new Redis(config[_0xd62f('0x7')]));require(_0xd62f('0xa'))[_0xd62f('0xb')](socket);var jayson=require(_0xd62f('0xc'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x2b10d2,_0x4e7caa,_0x22453b,_0x154504){return new BPromise(function(_0x4c8904,_0x8c6eab){var _0x3d4899=_0x154504||client;return _0x3d4899['request'](_0x2b10d2,_0x22453b)[_0xd62f('0xd')](function(_0x43d88e){logger['info']('MailAccount,\x20%s,\x20%s',_0x4e7caa,_0xd62f('0xe'));logger[_0xd62f('0xf')](_0xd62f('0x10'),_0x4e7caa,_0xd62f('0xe'),JSON[_0xd62f('0x11')](_0x43d88e));if(_0x43d88e[_0xd62f('0x12')]){if(_0x43d88e['error']['code']===0x1f4){logger[_0xd62f('0x12')](_0xd62f('0x13'),_0x4e7caa,_0x43d88e[_0xd62f('0x12')][_0xd62f('0x14')]);return _0x8c6eab(_0x43d88e[_0xd62f('0x12')][_0xd62f('0x14')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x4e7caa,_0x43d88e[_0xd62f('0x12')][_0xd62f('0x14')]);return _0x4c8904(_0x43d88e[_0xd62f('0x12')][_0xd62f('0x14')]);}else{logger[_0xd62f('0x15')](_0xd62f('0x13'),_0x4e7caa,'request\x20sent');_0x4c8904(_0x43d88e[_0xd62f('0x16')][_0xd62f('0x14')]);}})['catch'](function(_0x7f6fd6){logger[_0xd62f('0x12')](_0xd62f('0x13'),_0x4e7caa,_0x7f6fd6);_0x8c6eab(_0x7f6fd6);});});}function respondWithStatusCode(_0x21ae66,_0x77255e){_0x77255e=_0x77255e||0xcc;return function(_0x226f1e){if(_0x226f1e){return _0x21ae66['sendStatus'](_0x77255e);}return _0x21ae66[_0xd62f('0x17')](_0x77255e)['end']();};}function respondWithResult(_0x507277,_0x23c083){_0x23c083=_0x23c083||0xc8;return function(_0x4c5ca4){if(_0x4c5ca4){return _0x507277[_0xd62f('0x17')](_0x23c083)[_0xd62f('0x18')](_0x4c5ca4);}};}function respondWithFilteredResult(_0x3a712b,_0x4a91f0){return function(_0x3d5816){if(_0x3d5816){var _0x12dd76=typeof _0x4a91f0['offset']===_0xd62f('0x19')&&typeof _0x4a91f0[_0xd62f('0x1a')]===_0xd62f('0x19');var _0x1e35c8=_0x3d5816[_0xd62f('0x1b')];var _0x24fe5c=_0x12dd76?0x0:_0x4a91f0['offset'];var _0x14b36c=_0x12dd76?_0x3d5816['count']:_0x4a91f0[_0xd62f('0x1c')]+_0x4a91f0[_0xd62f('0x1a')];var _0x4c24f4;if(_0x14b36c>=_0x1e35c8){_0x14b36c=_0x1e35c8;_0x4c24f4=0xc8;}else{_0x4c24f4=0xce;}_0x3a712b[_0xd62f('0x17')](_0x4c24f4);return _0x3a712b[_0xd62f('0x1d')](_0xd62f('0x1e'),_0x24fe5c+'-'+_0x14b36c+'/'+_0x1e35c8)[_0xd62f('0x18')](_0x3d5816);}return null;};}function saveUpdates(_0x456f7f){return function(_0xf5e60d){if(_0xf5e60d){return _0xf5e60d[_0xd62f('0x1f')](_0x456f7f)['then'](function(_0x3f7278){return _0x3f7278;});}return null;};}function removeEntity(_0x8cfec7){return function(_0x2b736f){if(_0x2b736f){return _0x2b736f[_0xd62f('0x20')]()[_0xd62f('0xd')](function(){var _0x2ac6bb=_0x2b736f[_0xd62f('0x21')]({'plain':!![]});var _0x5a7108=_0xd62f('0x22');return db[_0xd62f('0x23')]['destroy']({'where':{'type':_0x5a7108,'resourceId':_0x2ac6bb['id']}})['then'](function(){return _0x2b736f;});})[_0xd62f('0xd')](function(){_0x8cfec7[_0xd62f('0x17')](0xcc)[_0xd62f('0x24')]();});}};}function handleEntityNotFound(_0x2d4572){return function(_0x254162){if(!_0x254162){_0x2d4572[_0xd62f('0x25')](0x194);}return _0x254162;};}function handleError(_0x68b1de,_0x53301d){_0x53301d=_0x53301d||0x1f4;return function(_0x5def91){logger['error'](_0x5def91['stack']);if(_0x5def91[_0xd62f('0x26')]){delete _0x5def91[_0xd62f('0x26')];}_0x68b1de['status'](_0x53301d)[_0xd62f('0x27')](_0x5def91);};}function getImapHost(_0x5677ea){switch(_0x5677ea){case _0xd62f('0x28'):return _0xd62f('0x29');case _0xd62f('0x2a'):return _0xd62f('0x2b');case _0xd62f('0x2c'):return _0xd62f('0x2d');case _0xd62f('0x2e'):return _0xd62f('0x2f');}throw new Error(_0xd62f('0x30'),_0x5677ea);}function getSmtpHost(_0x1a5eb6){switch(_0x1a5eb6){case _0xd62f('0x28'):return _0xd62f('0x31');case _0xd62f('0x2a'):return'smtp.mail.yahoo.com';case'hotmail':return _0xd62f('0x32');case _0xd62f('0x2e'):return _0xd62f('0x33');}throw new Error(_0xd62f('0x30'),_0x1a5eb6);}function getAuthenticationOptions(_0xabd4ed,_0x2989f2){var _0x5c736b={};var _0x1f2ceb={};if(_0xabd4ed){_0x5c736b['user']=_0x1f2ceb[_0xd62f('0x34')]=_0x2989f2[_0xd62f('0x35')];_0x5c736b[_0xd62f('0x36')]=_0x1f2ceb[_0xd62f('0x37')]=_0x2989f2[_0xd62f('0x36')];if(_0x2989f2[_0xd62f('0x38')]){_0x5c736b[_0xd62f('0x38')]=_0x1f2ceb[_0xd62f('0x38')]=!![];_0x5c736b[_0xd62f('0x39')]=_0x1f2ceb[_0xd62f('0x39')]=_0x2989f2['CloudProviderId'];_0x5c736b[_0xd62f('0x36')]=_0x1f2ceb[_0xd62f('0x37')]=null;}else{_0x5c736b['CloudProviderId']=_0x1f2ceb[_0xd62f('0x39')]=null;}_0x5c736b['host']=getImapHost(_0xabd4ed);_0x5c736b[_0xd62f('0x3a')]=0x3e1;_0x1f2ceb['host']=getSmtpHost(_0xabd4ed);_0x1f2ceb[_0xd62f('0x3a')]=0x24b;_0x1f2ceb['secure']=![];_0x5c736b['service']=_0x1f2ceb['service']=null;}else{if(_0x2989f2[_0xd62f('0x3b')]){_0x5c736b['user']=_0x1f2ceb[_0xd62f('0x34')]=_0x2989f2['username'];_0x5c736b[_0xd62f('0x36')]=_0x1f2ceb['pass']=_0x2989f2['password'];}else{_0x5c736b[_0xd62f('0x3b')]=_0x1f2ceb[_0xd62f('0x3b')]=![];_0x5c736b[_0xd62f('0x34')]=_0x1f2ceb[_0xd62f('0x34')]=null;_0x5c736b[_0xd62f('0x36')]=_0x1f2ceb[_0xd62f('0x37')]=null;}_0x5c736b[_0xd62f('0x3c')]=_0x2989f2[_0xd62f('0x3d')][_0xd62f('0x3c')];_0x5c736b[_0xd62f('0x3a')]=_0x2989f2[_0xd62f('0x3d')]['port'];_0x1f2ceb[_0xd62f('0x3c')]=_0x2989f2[_0xd62f('0x3e')][_0xd62f('0x3c')];_0x1f2ceb[_0xd62f('0x3a')]=_0x2989f2[_0xd62f('0x3e')]['port'];}return{'Imap':_0x5c736b,'Smtp':_0x1f2ceb};}exports[_0xd62f('0x3f')]=function(_0x47100c,_0x356a35){var _0x454d64={'include':[{'model':db[_0xd62f('0x40')],'as':_0xd62f('0x3d')},{'model':db[_0xd62f('0x41')],'as':'Smtp'},{'model':db[_0xd62f('0x42')],'as':_0xd62f('0x43')}]},_0x5dd9f9={},_0x3ad92c={'count':0x0,'rows':[]};var _0x4bce45=_['map'](db[_0xd62f('0x44')][_0xd62f('0x45')],function(_0x5c91b5){return{'name':_0x5c91b5[_0xd62f('0x46')],'type':_0x5c91b5[_0xd62f('0x47')][_0xd62f('0x48')]};});_0x5dd9f9['model']=_['map'](_0x4bce45,_0xd62f('0x26'));_0x5dd9f9[_0xd62f('0x49')]=_[_0xd62f('0x4a')](_0x47100c[_0xd62f('0x49')]);_0x5dd9f9[_0xd62f('0x4b')]=_[_0xd62f('0x4c')](_0x5dd9f9[_0xd62f('0x4d')],_0x5dd9f9[_0xd62f('0x49')]);_0x454d64[_0xd62f('0x4e')]=_[_0xd62f('0x4c')](_0x5dd9f9[_0xd62f('0x4d')],qs['fields'](_0x47100c[_0xd62f('0x49')][_0xd62f('0x4f')]));_0x454d64[_0xd62f('0x4e')]=_0x454d64[_0xd62f('0x4e')][_0xd62f('0x50')]?_0x454d64[_0xd62f('0x4e')]:_0x5dd9f9[_0xd62f('0x4d')];if(!_0x47100c[_0xd62f('0x49')]['hasOwnProperty'](_0xd62f('0x51'))){_0x454d64[_0xd62f('0x1a')]=qs[_0xd62f('0x1a')](_0x47100c[_0xd62f('0x49')][_0xd62f('0x1a')]);_0x454d64['offset']=qs[_0xd62f('0x1c')](_0x47100c[_0xd62f('0x49')][_0xd62f('0x1c')]);}_0x454d64[_0xd62f('0x52')]=qs['sort'](_0x47100c[_0xd62f('0x49')][_0xd62f('0x53')]);_0x454d64[_0xd62f('0x54')]=qs[_0xd62f('0x4b')](_['pick'](_0x47100c[_0xd62f('0x49')],_0x5dd9f9[_0xd62f('0x4b')]),_0x4bce45);if(_0x47100c[_0xd62f('0x49')][_0xd62f('0x55')]){_0x454d64[_0xd62f('0x54')]=_[_0xd62f('0x56')](_0x454d64['where'],{'$or':_['map'](_0x4bce45,function(_0x2c4b6d){if(_0x2c4b6d[_0xd62f('0x47')]!==_0xd62f('0x57')){var _0x3a5ac9={};_0x3a5ac9[_0x2c4b6d[_0xd62f('0x26')]]={'$like':'%'+_0x47100c[_0xd62f('0x49')]['filter']+'%'};return _0x3a5ac9;}})});}_0x454d64=_['merge']({},_0x454d64,_0x47100c[_0xd62f('0x58')]);var _0x2ff02d={'where':_0x454d64[_0xd62f('0x54')]};return db['MailAccount']['count'](_0x2ff02d)[_0xd62f('0xd')](function(_0x24a7dd){_0x3ad92c[_0xd62f('0x1b')]=_0x24a7dd;if(_0x47100c['query'][_0xd62f('0x59')]){_0x454d64[_0xd62f('0x5a')]=[{'all':!![]}];}return db[_0xd62f('0x44')]['findAll'](_0x454d64);})[_0xd62f('0xd')](function(_0xc13582){_0x3ad92c['rows']=_0xc13582;return _0x3ad92c;})[_0xd62f('0xd')](respondWithFilteredResult(_0x356a35,_0x454d64))['catch'](handleError(_0x356a35,null));};exports[_0xd62f('0x5b')]=function(_0x2977d7,_0x139373){var _0x96823={'raw':![],'where':{'id':_0x2977d7['params']['id']},'include':[{'model':db[_0xd62f('0x40')],'as':_0xd62f('0x3d')},{'model':db[_0xd62f('0x41')],'as':_0xd62f('0x3e')},{'model':db['Pause'],'as':_0xd62f('0x43')}]},_0x543569={};_0x543569[_0xd62f('0x4d')]=_[_0xd62f('0x4a')](db[_0xd62f('0x44')][_0xd62f('0x45')]);_0x543569[_0xd62f('0x49')]=_[_0xd62f('0x4a')](_0x2977d7[_0xd62f('0x49')]);_0x543569[_0xd62f('0x4b')]=_[_0xd62f('0x4c')](_0x543569[_0xd62f('0x4d')],_0x543569['query']);_0x96823['attributes']=_[_0xd62f('0x4c')](_0x543569[_0xd62f('0x4d')],qs[_0xd62f('0x4f')](_0x2977d7[_0xd62f('0x49')]['fields']));_0x96823['attributes']=_0x96823[_0xd62f('0x4e')]['length']?_0x96823[_0xd62f('0x4e')]:_0x543569[_0xd62f('0x4d')];if(_0x2977d7['query'][_0xd62f('0x59')]){_0x96823[_0xd62f('0x5a')]=[{'all':!![]}];}_0x96823=_[_0xd62f('0x56')]({},_0x96823,_0x2977d7[_0xd62f('0x58')]);return db[_0xd62f('0x44')][_0xd62f('0x5c')](_0x96823)[_0xd62f('0xd')](handleEntityNotFound(_0x139373,null))['then'](respondWithResult(_0x139373,null))[_0xd62f('0x5d')](handleError(_0x139373,null));};exports[_0xd62f('0x1f')]=function(_0x29d755,_0x2b99f7){if(_0x29d755[_0xd62f('0x5e')]['id']){delete _0x29d755['body']['id'];}var _0x20a166=_0x29d755['body'][_0xd62f('0x5f')]===_0xd62f('0x60')?null:_0x29d755[_0xd62f('0x5e')][_0xd62f('0x5f')];var _0xa61eb7=_0x29d755[_0xd62f('0x5e')]['Imap']||{};var _0xf4c799=_0x29d755[_0xd62f('0x5e')]['Smtp']||{};if(_0x20a166){_0xa61eb7['host']=getImapHost(_0x20a166);_0xa61eb7[_0xd62f('0x3a')]=0x3e1;_0xf4c799['host']=getSmtpHost(_0x20a166);_0xf4c799[_0xd62f('0x3a')]=0x24b;_0xf4c799[_0xd62f('0x61')]=![];}if(_0xf4c799['modernAuthentication']){_0xf4c799[_0xd62f('0x61')]=![];}else{_0xf4c799[_0xd62f('0x39')]=null;}if(!_0xa61eb7[_0xd62f('0x38')])_0xa61eb7['CloudProviderId']=null;_0x29d755[_0xd62f('0x5e')]['Imap']=_0xa61eb7;_0x29d755['body'][_0xd62f('0x3e')]=_0xf4c799;return db[_0xd62f('0x44')]['find']({'where':{'id':_0x29d755[_0xd62f('0x62')]['id']},'include':[{'model':db[_0xd62f('0x40')],'as':_0xd62f('0x3d')},{'model':db['MailServerOut'],'as':_0xd62f('0x3e')},{'model':db[_0xd62f('0x42')],'as':_0xd62f('0x43')}]})[_0xd62f('0xd')](handleEntityNotFound(_0x2b99f7,null))[_0xd62f('0xd')](function(_0x38dba2){if(!_0x38dba2)throw new Error('Mail\x20Account\x20not\x20found');if(_0x38dba2[_0xd62f('0x63')])delete _0x29d755[_0xd62f('0x5e')][_0xd62f('0x3d')];return _0x38dba2;})[_0xd62f('0xd')](saveUpdates(_0x29d755['body'],null))['then'](function(_0x4990a0){if(!_0x29d755[_0xd62f('0x5e')][_0xd62f('0x3d')])return _0x4990a0;return db['MailServerIn'][_0xd62f('0x1f')](_0x29d755[_0xd62f('0x5e')][_0xd62f('0x3d')],{'where':{'MailAccountId':_0x4990a0['id']}})[_0xd62f('0xd')](function(){return _0x4990a0;});})[_0xd62f('0xd')](function(_0x862385){if(!_0x29d755['body'][_0xd62f('0x3e')])return _0x862385;return db[_0xd62f('0x41')][_0xd62f('0x1f')](_0x29d755[_0xd62f('0x5e')][_0xd62f('0x3e')],{'where':{'MailAccountId':_0x862385['id']}})[_0xd62f('0xd')](function(){return _0x862385;});})[_0xd62f('0xd')](respondWithResult(_0x2b99f7,null))[_0xd62f('0x5d')](handleError(_0x2b99f7,null));};exports['describe']=function(_0x2652c6,_0x31125a){return db[_0xd62f('0x44')]['describe']()['then'](respondWithResult(_0x31125a,null))['catch'](handleError(_0x31125a,null));};exports[_0xd62f('0x64')]=function(_0x4fa8a4,_0x412919){if(_0x4fa8a4[_0xd62f('0x5e')]['id']){delete _0x4fa8a4['body']['id'];}return db[_0xd62f('0x44')][_0xd62f('0x5c')]({'where':{'id':_0x4fa8a4[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x412919,null))['then'](function(_0x5bf825){if(_0x5bf825){_0x4fa8a4['body'][_0xd62f('0x65')]=_0x5bf825['id'];return db[_0xd62f('0x66')][_0xd62f('0x67')](_0x4fa8a4[_0xd62f('0x5e')]);}})['then'](respondWithResult(_0x412919,null))['catch'](handleError(_0x412919,null));};exports[_0xd62f('0x68')]=function(_0xa7f10e,_0xc7491b){var _0x5085b6={'raw':![],'where':{}};var _0x3fca26={};var _0x309613={'count':0x0,'rows':[]};return db[_0xd62f('0x44')][_0xd62f('0x69')]({'where':{'id':_0xa7f10e['params']['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0xc7491b,null))[_0xd62f('0xd')](function(_0x2b902d){if(_0x2b902d){_0x3fca26['model']=_[_0xd62f('0x4a')](db[_0xd62f('0x66')][_0xd62f('0x45')]);_0x3fca26[_0xd62f('0x49')]=_[_0xd62f('0x4a')](_0xa7f10e[_0xd62f('0x49')]);_0x3fca26[_0xd62f('0x4b')]=_[_0xd62f('0x4c')](_0x3fca26[_0xd62f('0x4d')],_0x3fca26[_0xd62f('0x49')]);_0x5085b6[_0xd62f('0x4e')]=_[_0xd62f('0x4c')](_0x3fca26[_0xd62f('0x4d')],qs[_0xd62f('0x4f')](_0xa7f10e[_0xd62f('0x49')][_0xd62f('0x4f')]));_0x5085b6['attributes']=_0x5085b6['attributes'][_0xd62f('0x50')]?_0x5085b6[_0xd62f('0x4e')]:_0x3fca26[_0xd62f('0x4d')];if(!_0xa7f10e['query'][_0xd62f('0x6a')](_0xd62f('0x51'))){_0x5085b6[_0xd62f('0x1a')]=qs['limit'](_0xa7f10e['query']['limit']);_0x5085b6['offset']=qs[_0xd62f('0x1c')](_0xa7f10e['query'][_0xd62f('0x1c')]);}_0x5085b6['order']=qs[_0xd62f('0x53')](_0xa7f10e[_0xd62f('0x49')][_0xd62f('0x53')]);_0x5085b6[_0xd62f('0x54')]=qs['filters'](_['pick'](_0xa7f10e[_0xd62f('0x49')],_0x3fca26[_0xd62f('0x4b')]));_0x5085b6['where']['MailAccountId']=_0x2b902d['id'];if(_0xa7f10e[_0xd62f('0x49')][_0xd62f('0x55')]){_0x5085b6[_0xd62f('0x54')]=_[_0xd62f('0x56')](_0x5085b6[_0xd62f('0x54')],{'$or':_['map'](_0x5085b6['attributes'],function(_0x4aee18){var _0x1a7763={};_0x1a7763[_0x4aee18]={'$like':'%'+_0xa7f10e[_0xd62f('0x49')][_0xd62f('0x55')]+'%'};return _0x1a7763;})});}_0x5085b6=_[_0xd62f('0x56')]({},_0x5085b6,_0xa7f10e[_0xd62f('0x58')]);return db[_0xd62f('0x66')][_0xd62f('0x1b')]({'where':_0x5085b6[_0xd62f('0x54')]})[_0xd62f('0xd')](function(_0x29f0c9){_0x309613[_0xd62f('0x1b')]=_0x29f0c9;if(_0xa7f10e['query']['includeAll']){_0x5085b6[_0xd62f('0x5a')]=[{'all':!![]}];}return db[_0xd62f('0x66')][_0xd62f('0x6b')](_0x5085b6);})[_0xd62f('0xd')](function(_0x23ae47){_0x309613[_0xd62f('0x6c')]=_0x23ae47;return _0x309613;});}})[_0xd62f('0xd')](respondWithFilteredResult(_0xc7491b,_0x5085b6))[_0xd62f('0x5d')](handleError(_0xc7491b,null));};exports[_0xd62f('0x6d')]=function(_0x1e6670,_0x146182){return db[_0xd62f('0x44')][_0xd62f('0x5c')]({'where':{'id':_0x1e6670[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x146182,null))[_0xd62f('0xd')](function(_0x3f6ab9){if(_0x3f6ab9){return _0x3f6ab9['removeDispositions'](_0x1e6670[_0xd62f('0x49')][_0xd62f('0x6e')]);}})['then'](respondWithStatusCode(_0x146182,null))['catch'](handleError(_0x146182,null));};exports[_0xd62f('0x6f')]=function(_0x3bf343,_0x52a424){if(_0x3bf343[_0xd62f('0x5e')]['id']){delete _0x3bf343[_0xd62f('0x5e')]['id'];}return db[_0xd62f('0x44')]['find']({'where':{'id':_0x3bf343[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x52a424,null))[_0xd62f('0xd')](function(_0x316f73){if(_0x316f73){_0x3bf343[_0xd62f('0x5e')][_0xd62f('0x65')]=_0x316f73['id'];return db[_0xd62f('0x70')]['create'](_0x3bf343[_0xd62f('0x5e')]);}})[_0xd62f('0xd')](respondWithResult(_0x52a424,null))[_0xd62f('0x5d')](handleError(_0x52a424,null));};exports[_0xd62f('0x71')]=function(_0x57afb4,_0x3c64cb){var _0x13b3c5={'raw':![],'where':{}};var _0x1e90c9={};var _0x431e27={'count':0x0,'rows':[]};return db[_0xd62f('0x44')][_0xd62f('0x69')]({'where':{'id':_0x57afb4[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x3c64cb,null))[_0xd62f('0xd')](function(_0x379a5c){if(_0x379a5c){_0x1e90c9['model']=_[_0xd62f('0x4a')](db[_0xd62f('0x70')][_0xd62f('0x45')]);_0x1e90c9[_0xd62f('0x49')]=_['keys'](_0x57afb4[_0xd62f('0x49')]);_0x1e90c9['filters']=_[_0xd62f('0x4c')](_0x1e90c9[_0xd62f('0x4d')],_0x1e90c9[_0xd62f('0x49')]);_0x13b3c5[_0xd62f('0x4e')]=_[_0xd62f('0x4c')](_0x1e90c9[_0xd62f('0x4d')],qs[_0xd62f('0x4f')](_0x57afb4['query'][_0xd62f('0x4f')]));_0x13b3c5[_0xd62f('0x4e')]=_0x13b3c5[_0xd62f('0x4e')][_0xd62f('0x50')]?_0x13b3c5[_0xd62f('0x4e')]:_0x1e90c9['model'];if(!_0x57afb4['query'][_0xd62f('0x6a')]('nolimit')){_0x13b3c5[_0xd62f('0x1a')]=qs[_0xd62f('0x1a')](_0x57afb4['query'][_0xd62f('0x1a')]);_0x13b3c5[_0xd62f('0x1c')]=qs[_0xd62f('0x1c')](_0x57afb4['query'][_0xd62f('0x1c')]);}_0x13b3c5[_0xd62f('0x52')]=qs['sort'](_0x57afb4['query'][_0xd62f('0x53')]);_0x13b3c5[_0xd62f('0x54')]=qs['filters'](_[_0xd62f('0x72')](_0x57afb4[_0xd62f('0x49')],_0x1e90c9[_0xd62f('0x4b')]));_0x13b3c5[_0xd62f('0x54')][_0xd62f('0x65')]=_0x379a5c['id'];if(_0x57afb4[_0xd62f('0x49')]['filter']){_0x13b3c5['where']=_[_0xd62f('0x56')](_0x13b3c5[_0xd62f('0x54')],{'$or':_['map'](_0x13b3c5[_0xd62f('0x4e')],function(_0x36ee75){var _0x2ab410={};_0x2ab410[_0x36ee75]={'$like':'%'+_0x57afb4[_0xd62f('0x49')][_0xd62f('0x55')]+'%'};return _0x2ab410;})});}_0x13b3c5=_[_0xd62f('0x56')]({},_0x13b3c5,_0x57afb4[_0xd62f('0x58')]);return db[_0xd62f('0x70')][_0xd62f('0x1b')]({'where':_0x13b3c5[_0xd62f('0x54')]})[_0xd62f('0xd')](function(_0x37631a){_0x431e27[_0xd62f('0x1b')]=_0x37631a;if(_0x57afb4[_0xd62f('0x49')][_0xd62f('0x59')]){_0x13b3c5[_0xd62f('0x5a')]=[{'all':!![]}];}return db[_0xd62f('0x70')]['findAll'](_0x13b3c5);})[_0xd62f('0xd')](function(_0x9befe9){_0x431e27[_0xd62f('0x6c')]=_0x9befe9;return _0x431e27;});}})[_0xd62f('0xd')](respondWithFilteredResult(_0x3c64cb,_0x13b3c5))[_0xd62f('0x5d')](handleError(_0x3c64cb,null));};exports['removeAnswers']=function(_0x5cae44,_0xc6b84){return db[_0xd62f('0x44')][_0xd62f('0x5c')]({'where':{'id':_0x5cae44[_0xd62f('0x62')]['id']}})['then'](handleEntityNotFound(_0xc6b84,null))[_0xd62f('0xd')](function(_0x4bde6a){if(_0x4bde6a){return _0x4bde6a[_0xd62f('0x73')](_0x5cae44[_0xd62f('0x49')][_0xd62f('0x6e')]);}})[_0xd62f('0xd')](respondWithStatusCode(_0xc6b84,null))[_0xd62f('0x5d')](handleError(_0xc6b84,null));};exports[_0xd62f('0x67')]=function(_0x3c2fb4,_0x492b17){var _0x208432={'name':_0x3c2fb4['body'][_0xd62f('0x26')],'key':_0x3c2fb4[_0xd62f('0x5e')][_0xd62f('0x48')],'provider':_0x3c2fb4[_0xd62f('0x5e')]['provider']==='custom'?null:_0x3c2fb4[_0xd62f('0x5e')][_0xd62f('0x5f')],'email':_0x3c2fb4[_0xd62f('0x5e')][_0xd62f('0x74')],'ListId':_0x3c2fb4['body'][_0xd62f('0x75')],'active':!_[_0xd62f('0x76')](_0x3c2fb4['body'][_0xd62f('0x77')])?_0x3c2fb4['body'][_0xd62f('0x77')]:!![],'description':_0x3c2fb4[_0xd62f('0x5e')][_0xd62f('0x78')]||null};var _0x3e7245=getAuthenticationOptions(_0x208432[_0xd62f('0x5f')],_0x3c2fb4[_0xd62f('0x5e')]);_0x208432[_0xd62f('0x3d')]=_0x3e7245[_0xd62f('0x3d')];_0x208432[_0xd62f('0x3e')]=_0x3e7245[_0xd62f('0x3e')];return db[_0xd62f('0x44')]['create'](_0x208432,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xd62f('0x40')],'as':_0xd62f('0x3d')}]})[_0xd62f('0xd')](function(_0x1e9cd3){var _0x3a6ca1=_0x3c2fb4[_0xd62f('0x34')][_0xd62f('0x21')]({'plain':!![]});if(!_0x3a6ca1)throw new Error(_0xd62f('0x79'));if(_0x3a6ca1[_0xd62f('0x7a')]===_0xd62f('0x34')){var _0x359d66=_0x1e9cd3['get']({'plain':!![]});return db['UserProfileSection'][_0xd62f('0x5c')]({'where':{'name':_0xd62f('0x22'),'userProfileId':_0x3a6ca1[_0xd62f('0x7b')]},'raw':!![]})[_0xd62f('0xd')](function(_0x532547){if(_0x532547&&_0x532547[_0xd62f('0x7c')]===0x0){return db[_0xd62f('0x23')][_0xd62f('0x67')]({'name':_0x359d66['name'],'resourceId':_0x359d66['id'],'type':_0x532547['name'],'sectionId':_0x532547['id']},{})['then'](function(){return _0x1e9cd3;});}else{return _0x1e9cd3;}})[_0xd62f('0x5d')](function(_0x1eb5ea){logger[_0xd62f('0x12')](_0xd62f('0x7d'),_0x1eb5ea);throw _0x1eb5ea;});}return _0x1e9cd3;})[_0xd62f('0xd')](respondWithResult(_0x492b17,0xc9))[_0xd62f('0x5d')](handleError(_0x492b17,null));};exports[_0xd62f('0x7e')]=function(_0x3368ca,_0x758346){return db[_0xd62f('0x44')][_0xd62f('0x69')]({'where':{'id':_0x3368ca[_0xd62f('0x62')]['id']}})['then'](handleEntityNotFound(_0x758346,null))[_0xd62f('0xd')](function(_0x4233c2){if(_0x4233c2){return _0x4233c2[_0xd62f('0x7e')]();}return null;})[_0xd62f('0xd')](respondWithResult(_0x758346,null))[_0xd62f('0x5d')](handleError(_0x758346,null));};exports['addImap']=function(_0x5bd834,_0x2dadbb){if(_0x5bd834[_0xd62f('0x5e')]['id']){delete _0x5bd834[_0xd62f('0x5e')]['id'];}return db[_0xd62f('0x44')][_0xd62f('0x5c')]({'where':{'id':_0x5bd834[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x2dadbb,null))['then'](function(_0x313c63){if(_0x313c63){_0x5bd834[_0xd62f('0x5e')][_0xd62f('0x65')]=_0x313c63['id'];return db['MailServerIn'][_0xd62f('0x67')](_0x5bd834[_0xd62f('0x5e')]);}})['then'](respondWithResult(_0x2dadbb,null))[_0xd62f('0x5d')](handleError(_0x2dadbb,null));};exports['removeImap']=function(_0x34c0c2,_0x518c3a){return db[_0xd62f('0x44')][_0xd62f('0x69')]({'where':{'id':_0x34c0c2[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x518c3a,null))[_0xd62f('0xd')](function(_0x54c2e2){if(_0x54c2e2){return _0x54c2e2[_0xd62f('0x7f')](null);}return null;})[_0xd62f('0xd')](respondWithStatusCode(_0x518c3a,null))[_0xd62f('0x5d')](handleError(_0x518c3a,null));};exports[_0xd62f('0x80')]=function(_0x2a0cdd,_0x385acc){return db[_0xd62f('0x44')][_0xd62f('0x69')]({'where':{'id':_0x2a0cdd['params']['id']}})['then'](handleEntityNotFound(_0x385acc,null))[_0xd62f('0xd')](function(_0x206525){if(_0x206525){return _0x206525['getSmtp']();}return null;})[_0xd62f('0xd')](respondWithResult(_0x385acc,null))[_0xd62f('0x5d')](handleError(_0x385acc,null));};exports[_0xd62f('0x81')]=function(_0x5aab34,_0x1940f5){if(_0x5aab34[_0xd62f('0x5e')]['id']){delete _0x5aab34[_0xd62f('0x5e')]['id'];}return db[_0xd62f('0x44')]['find']({'where':{'id':_0x5aab34[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x1940f5,null))[_0xd62f('0xd')](function(_0x345258){if(_0x345258){_0x5aab34['body'][_0xd62f('0x65')]=_0x345258['id'];return db[_0xd62f('0x41')]['create'](_0x5aab34[_0xd62f('0x5e')]);}})[_0xd62f('0xd')](respondWithResult(_0x1940f5,null))[_0xd62f('0x5d')](handleError(_0x1940f5,null));};exports[_0xd62f('0x82')]=function(_0x3114ad,_0x54262d){return db[_0xd62f('0x44')]['findOne']({'where':{'id':_0x3114ad[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x54262d,null))[_0xd62f('0xd')](function(_0x2b5b78){if(_0x2b5b78){return _0x2b5b78['setSmtp'](null);}return null;})[_0xd62f('0xd')](respondWithStatusCode(_0x54262d,null))['catch'](handleError(_0x54262d,null));};exports['addInteraction']=function(_0x3dfa72,_0x4f1d43){return db[_0xd62f('0x83')][_0xd62f('0x5c')]({'where':{'id':_0x3dfa72[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x4f1d43,null))[_0xd62f('0xd')](function(_0xc0ffa1){if(_0xc0ffa1){return _0xc0ffa1[_0xd62f('0x84')](_0x3dfa72[_0xd62f('0x5e')][_0xd62f('0x6e')],_[_0xd62f('0x85')](_0x3dfa72[_0xd62f('0x5e')],[_0xd62f('0x6e'),'id'])||{});}})[_0xd62f('0xd')](respondWithResult(_0x4f1d43,null))[_0xd62f('0x5d')](handleError(_0x4f1d43,null));};exports[_0xd62f('0x86')]=function(_0x1d32d4,_0x1a0bc5){var _0x2e4631={'raw':![],'where':{}};var _0xfeea50={};var _0xe55bc4={'count':0x0,'rows':[]};return db[_0xd62f('0x44')]['findOne']({'where':{'id':_0x1d32d4[_0xd62f('0x62')]['id']}})['then'](handleEntityNotFound(_0x1a0bc5,null))[_0xd62f('0xd')](function(_0x4c56ff){if(_0x4c56ff){_0xfeea50[_0xd62f('0x4d')]=_[_0xd62f('0x4a')](db[_0xd62f('0x83')]['rawAttributes']);_0xfeea50[_0xd62f('0x49')]=_['keys'](_0x1d32d4[_0xd62f('0x49')]);_0xfeea50[_0xd62f('0x4b')]=_['intersection'](_0xfeea50['model'],_0xfeea50[_0xd62f('0x49')]);_0x2e4631['attributes']=_[_0xd62f('0x4c')](_0xfeea50['model'],qs['fields'](_0x1d32d4[_0xd62f('0x49')][_0xd62f('0x4f')]));_0x2e4631[_0xd62f('0x4e')]=_0x2e4631[_0xd62f('0x4e')][_0xd62f('0x50')]?_0x2e4631[_0xd62f('0x4e')]:_0xfeea50[_0xd62f('0x4d')];if(!_0x1d32d4[_0xd62f('0x49')]['hasOwnProperty'](_0xd62f('0x51'))){_0x2e4631['limit']=qs['limit'](_0x1d32d4[_0xd62f('0x49')][_0xd62f('0x1a')]);_0x2e4631[_0xd62f('0x1c')]=qs['offset'](_0x1d32d4[_0xd62f('0x49')][_0xd62f('0x1c')]);}_0x2e4631['order']=qs['sort'](_0x1d32d4[_0xd62f('0x49')][_0xd62f('0x53')]);_0x2e4631[_0xd62f('0x54')]=qs[_0xd62f('0x4b')](_[_0xd62f('0x72')](_0x1d32d4['query'],_0xfeea50[_0xd62f('0x4b')]));_0x2e4631[_0xd62f('0x54')][_0xd62f('0x65')]=_0x4c56ff['id'];if(_0x1d32d4[_0xd62f('0x49')][_0xd62f('0x55')]){_0x2e4631[_0xd62f('0x54')]=_[_0xd62f('0x56')](_0x2e4631['where'],{'$or':_['map'](_0x2e4631[_0xd62f('0x4e')],function(_0x31b3a6){var _0x10630f={};_0x10630f[_0x31b3a6]={'$like':'%'+_0x1d32d4['query']['filter']+'%'};return _0x10630f;})});}_0x2e4631=_['merge']({},_0x2e4631,_0x1d32d4[_0xd62f('0x58')]);return db[_0xd62f('0x83')]['count']({'where':_0x2e4631[_0xd62f('0x54')]})[_0xd62f('0xd')](function(_0x23c290){_0xe55bc4[_0xd62f('0x1b')]=_0x23c290;if(_0x1d32d4['query'][_0xd62f('0x59')]){_0x2e4631[_0xd62f('0x5a')]=[{'model':db[_0xd62f('0x87')],'as':_0xd62f('0x88'),'required':![]},{'model':db[_0xd62f('0x89')],'as':_0xd62f('0x8a'),'attributes':[_0xd62f('0x26'),'fullname',_0xd62f('0x8b')],'required':![]},{'model':db[_0xd62f('0x8c')],'as':'Tags','attributes':['id',_0xd62f('0x26'),_0xd62f('0x8d')],'where':_0x1d32d4[_0xd62f('0x49')]['tag']?{'id':_0x1d32d4['query']['tag']}:undefined,'required':_0x1d32d4[_0xd62f('0x49')][_0xd62f('0x8e')]?!![]:![]}];}return db[_0xd62f('0x83')]['findAll'](_0x2e4631);})[_0xd62f('0xd')](function(_0x1e8f77){_0xe55bc4[_0xd62f('0x6c')]=_0x1e8f77;return _0xe55bc4;});}})['then'](respondWithFilteredResult(_0x1a0bc5,_0x2e4631))[_0xd62f('0x5d')](handleError(_0x1a0bc5,null));};exports[_0xd62f('0x8f')]=function addApplications(_0x55a15b,_0x47d809){var _0x14ab21=_0x55a15b[_0xd62f('0x62')]['id'];var _0x4f6a7a=_0x55a15b[_0xd62f('0x5e')];var _0x407966=0xc8;var _0x27d818=null;return db[_0xd62f('0x90')][_0xd62f('0x91')]({'isolationLevel':db[_0xd62f('0x90')]['Transaction'][_0xd62f('0x92')][_0xd62f('0x93')]},function(_0x4b15a3){return db[_0xd62f('0x44')][_0xd62f('0x69')]({'where':{'id':_0x14ab21},'transaction':_0x4b15a3})[_0xd62f('0xd')](function(_0x4e1572){if(_0x4e1572){return db['MailApplication'][_0xd62f('0x20')]({'where':{'MailAccountId':_0x14ab21},'transaction':_0x4b15a3})[_0xd62f('0xd')](function(){var _0x3481e8=_[_0xd62f('0x94')](_0x4f6a7a,function(_0x368c71){_0x368c71['MailAccountId']=_0x14ab21;return _0x368c71;});return db[_0xd62f('0x95')][_0xd62f('0x96')](_0x3481e8,{'transaction':_0x4b15a3});});}else{_0x407966=0x194;_0x27d818=[];}});})['then'](function(){if(_0x407966!==0x194){return db[_0xd62f('0x95')]['findAndCountAll']({'where':{'MailAccountId':_0x14ab21},'order':_0xd62f('0x97')})[_0xd62f('0xd')](function(_0x5c0606){_0x27d818=_0x5c0606;});}})[_0xd62f('0x5d')](function(_0x4d2733){_0x407966=0x1f4;logger[_0xd62f('0x12')](_0x4d2733['stack']);if(_0x4d2733[_0xd62f('0x26')]){delete _0x4d2733['name'];}_0x27d818=_0x4d2733;})[_0xd62f('0x98')](function(){if(_0x27d818===null){_0x47d809[_0xd62f('0x25')](_0x407966);}else{if(_0x407966===0x1f4){_0x47d809[_0xd62f('0x17')](_0x407966)[_0xd62f('0x27')](_0x27d818);}else{_0x47d809[_0xd62f('0x17')](_0x407966)[_0xd62f('0x18')](_0x27d818);}}});};exports[_0xd62f('0x99')]=function(_0x1e588e,_0x2ce661){var _0x9c74cc={};var _0x48e120={};var _0x8708b8;var _0x4d9e3a;return db[_0xd62f('0x44')]['findOne']({'where':{'id':_0x1e588e['params']['id']}})['then'](handleEntityNotFound(_0x2ce661,null))[_0xd62f('0xd')](function(_0xf10442){if(_0xf10442){_0x8708b8=_0xf10442;_0x48e120[_0xd62f('0x4d')]=_[_0xd62f('0x4a')](db[_0xd62f('0x95')]['rawAttributes']);_0x48e120[_0xd62f('0x49')]=_[_0xd62f('0x4a')](_0x1e588e[_0xd62f('0x49')]);_0x48e120[_0xd62f('0x4b')]=_['intersection'](_0x48e120['model'],_0x48e120['query']);_0x9c74cc[_0xd62f('0x4e')]=_['intersection'](_0x48e120[_0xd62f('0x4d')],qs['fields'](_0x1e588e[_0xd62f('0x49')][_0xd62f('0x4f')]));_0x9c74cc[_0xd62f('0x4e')]=_0x9c74cc['attributes'][_0xd62f('0x50')]?_0x9c74cc[_0xd62f('0x4e')]:_0x48e120[_0xd62f('0x4d')];_0x9c74cc[_0xd62f('0x52')]=qs[_0xd62f('0x53')](_0x1e588e['query']['sort']);_0x9c74cc[_0xd62f('0x54')]=qs[_0xd62f('0x4b')](_[_0xd62f('0x72')](_0x1e588e[_0xd62f('0x49')],_0x48e120[_0xd62f('0x4b')]));if(_0x1e588e[_0xd62f('0x49')]['filter']){_0x9c74cc[_0xd62f('0x54')]=_[_0xd62f('0x56')](_0x9c74cc[_0xd62f('0x54')],{'$or':_[_0xd62f('0x94')](_0x9c74cc[_0xd62f('0x4e')],function(_0x30a7cc){var _0x5f5263={};_0x5f5263[_0x30a7cc]={'$like':'%'+_0x1e588e[_0xd62f('0x49')]['filter']+'%'};return _0x5f5263;})});}_0x9c74cc=_[_0xd62f('0x56')]({},_0x9c74cc,_0x1e588e[_0xd62f('0x58')]);return _0x8708b8['getApplications'](_0x9c74cc);}})[_0xd62f('0xd')](function(_0x35918b){if(_0x35918b){_0x4d9e3a=_0x35918b[_0xd62f('0x50')];if(!_0x1e588e[_0xd62f('0x49')][_0xd62f('0x6a')]('nolimit')){_0x9c74cc[_0xd62f('0x1a')]=qs['limit'](_0x1e588e['query'][_0xd62f('0x1a')]);_0x9c74cc[_0xd62f('0x1c')]=qs[_0xd62f('0x1c')](_0x1e588e['query'][_0xd62f('0x1c')]);}return _0x8708b8[_0xd62f('0x99')](_0x9c74cc);}})[_0xd62f('0xd')](function(_0x3c69de){if(_0x3c69de){return _0x3c69de?{'count':_0x4d9e3a,'rows':_0x3c69de}:null;}})[_0xd62f('0xd')](respondWithResult(_0x2ce661,null))[_0xd62f('0x5d')](handleError(_0x2ce661,null));};exports[_0xd62f('0x9a')]=function(_0x327e3c,_0x548355){var _0x503b00={'raw':!![],'where':{}};var _0x4f5c36={};var _0x422557={'count':0x0,'rows':[]};return db['MailAccount'][_0xd62f('0x69')]({'where':{'id':_0x327e3c[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x548355,null))[_0xd62f('0xd')](function(_0x31e3f0){if(_0x31e3f0){_0x4f5c36[_0xd62f('0x4d')]=_['keys'](db['MailMessage']['rawAttributes']);_0x4f5c36['query']=_[_0xd62f('0x4a')](_0x327e3c[_0xd62f('0x49')]);_0x4f5c36[_0xd62f('0x4b')]=_['intersection'](_0x4f5c36[_0xd62f('0x4d')],_0x4f5c36['query']);_0x503b00[_0xd62f('0x4e')]=_[_0xd62f('0x4c')](_0x4f5c36['model'],qs[_0xd62f('0x4f')](_0x327e3c[_0xd62f('0x49')]['fields']));_0x503b00[_0xd62f('0x4e')]=_0x503b00[_0xd62f('0x4e')][_0xd62f('0x50')]?_0x503b00[_0xd62f('0x4e')]:_0x4f5c36[_0xd62f('0x4d')];if(!_0x327e3c[_0xd62f('0x49')][_0xd62f('0x6a')](_0xd62f('0x51'))){_0x503b00['limit']=qs[_0xd62f('0x1a')](_0x327e3c[_0xd62f('0x49')][_0xd62f('0x1a')]);_0x503b00[_0xd62f('0x1c')]=qs[_0xd62f('0x1c')](_0x327e3c[_0xd62f('0x49')][_0xd62f('0x1c')]);}_0x503b00[_0xd62f('0x52')]=qs[_0xd62f('0x53')](_0x327e3c[_0xd62f('0x49')][_0xd62f('0x53')]);_0x503b00[_0xd62f('0x54')]=qs[_0xd62f('0x4b')](_[_0xd62f('0x72')](_0x327e3c['query'],_0x4f5c36['filters']));_0x503b00[_0xd62f('0x54')][_0xd62f('0x65')]=_0x31e3f0['id'];if(_0x327e3c['query'][_0xd62f('0x55')]){_0x503b00['where']=_['merge'](_0x503b00['where'],{'$or':_['map'](_0x503b00['attributes'],function(_0x47e2ea){var _0x5984f8={};_0x5984f8[_0x47e2ea]={'$like':'%'+_0x327e3c[_0xd62f('0x49')][_0xd62f('0x55')]+'%'};return _0x5984f8;})});}if(_0x327e3c[_0xd62f('0x49')][_0xd62f('0x9b')]){var _0x41bd00=_0x327e3c[_0xd62f('0x49')][_0xd62f('0x9b')][_0xd62f('0x9c')](',');var _0x38fcd1={};_0x38fcd1[_0x41bd00[0x0]]={'$gte':moment(_0x41bd00[0x1])[_0xd62f('0x9d')](_0xd62f('0x9e'))};_0x503b00['where']=_[_0xd62f('0x56')](_0x503b00['where'],_0x38fcd1);}_0x503b00=_[_0xd62f('0x56')]({},_0x503b00,_0x327e3c[_0xd62f('0x58')]);return db[_0xd62f('0x9f')]['count']({'where':_0x503b00[_0xd62f('0x54')]})['then'](function(_0x2d77f1){_0x422557['count']=_0x2d77f1;if(_0x327e3c['query'][_0xd62f('0x59')]){_0x503b00[_0xd62f('0x5a')]=[{'all':!![]}];}return db[_0xd62f('0x9f')][_0xd62f('0x6b')](_0x503b00);})[_0xd62f('0xd')](function(_0x2fa980){if(_0x327e3c[_0xd62f('0x49')][_0xd62f('0xa0')]===_0xd62f('0xa1')){for(var _0x17e745=0x0;_0x17e745<_0x2fa980[_0xd62f('0x50')];_0x17e745++){_0x2fa980[_0x17e745][_0xd62f('0x5e')]=juice(_0x2fa980[_0x17e745][_0xd62f('0x5e')]);}}_0x422557[_0xd62f('0x6c')]=_0x2fa980;return _0x422557;});}})[_0xd62f('0xd')](respondWithFilteredResult(_0x548355,_0x503b00))['catch'](handleError(_0x548355,null));};exports[_0xd62f('0x27')]=function(_0x57e9e5,_0x3a9237){var _0x48241b,_0x5c9b7e={},_0x269492;if(_0x57e9e5[_0xd62f('0x5e')]['to']){_0x269492=_0x57e9e5[_0xd62f('0x5e')]['to'][_0xd62f('0x9c')](',')[0x0];}return db['MailAccount'][_0xd62f('0x5c')]({'where':{'id':_0x57e9e5['params']['id']},'include':[{'model':db[_0xd62f('0xa2')],'as':_0xd62f('0xa3'),'include':[{'model':db[_0xd62f('0x87')],'as':_0xd62f('0xa4'),'where':{'email':_0x269492},'limit':0x1,'order':[[_0xd62f('0xa5'),_0xd62f('0xa6')]]}]},{'model':db[_0xd62f('0x41')],'as':_0xd62f('0x3e'),'raw':!![],'include':[{'model':db[_0xd62f('0xa7')],'as':_0xd62f('0xa7'),'raw':!![]}]}]})[_0xd62f('0xd')](handleEntityNotFound(_0x3a9237,null))[_0xd62f('0xd')](function(_0x201097){if(!_0x201097)return;_0x48241b=_0x201097;if(!_0x201097['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xd62f('0x76')](_0x57e9e5[_0xd62f('0x5e')][_0xd62f('0xa8')])){_0x57e9e5[_0xd62f('0x5e')][_0xd62f('0xa8')]=util[_0xd62f('0x9d')]('%s\x20<%s>',_0x201097[_0xd62f('0x26')],_0x201097[_0xd62f('0x74')]||_0x201097[_0xd62f('0x3e')][_0xd62f('0x34')]);}if(_0x57e9e5[_0xd62f('0x5e')]['attachments']&&_0x57e9e5[_0xd62f('0x5e')][_0xd62f('0xa9')]['length']){for(var _0x55290e=0x0;_0x55290e<_0x57e9e5[_0xd62f('0x5e')][_0xd62f('0xa9')][_0xd62f('0x50')];_0x55290e+=0x1){_0x57e9e5[_0xd62f('0x5e')][_0xd62f('0xa9')][_0x55290e]={'filename':_0x57e9e5[_0xd62f('0x5e')]['attachments'][_0x55290e]['name'],'path':path[_0xd62f('0xaa')](config[_0xd62f('0xab')],_0xd62f('0xac'),_0x57e9e5['body'][_0xd62f('0xa9')][_0x55290e]['basename'])};}}var _0x206297=_0x201097[_0xd62f('0xad')]();return respondWithRpcPromise(_0xd62f('0xae'),_0xd62f('0xaf'),{'account':_0x206297,'message':_0x57e9e5[_0xd62f('0x5e')]});})[_0xd62f('0xd')](function(_0x5228d0){if(!_0x5228d0)return;_0x5c9b7e=_0x5228d0;if(!_0x48241b[_0xd62f('0xa3')])throw new Error(_0xd62f('0xb0'));if(_0x48241b['List'][_0xd62f('0xa4')][_0xd62f('0x50')])return _0x48241b['List'][_0xd62f('0xa4')][0x0];return db[_0xd62f('0x87')][_0xd62f('0x67')](_[_0xd62f('0xb1')](_0x57e9e5[_0xd62f('0x5e')],{'firstName':_0x57e9e5['body']['to'],'email':_0x57e9e5[_0xd62f('0x5e')]['to'],'phone':_0x57e9e5['body']['to'],'ListId':_0x48241b[_0xd62f('0x75')]}));})[_0xd62f('0xd')](function(_0x112ec1){if(!_0x112ec1)return;var _0x57d6b4={'UserId':_0x57e9e5[_0xd62f('0x34')]['id'],'ContactId':_0x112ec1['id'],'MailAccountId':_0x48241b['id'],'inReplyTo':_0x5c9b7e[_0xd62f('0xb2')],'to':_0x57e9e5[_0xd62f('0x5e')][_0xd62f('0xa8')],'cc':_0x57e9e5[_0xd62f('0x5e')]['cc'],'subject':_0x57e9e5[_0xd62f('0x5e')][_0xd62f('0xb3')],'attach':_0x57e9e5[_0xd62f('0x5e')][_0xd62f('0xb4')],'firstMsgDirection':_0xd62f('0xb5'),'lastMsgAt':moment()[_0xd62f('0x9d')](_0xd62f('0x9e')),'lastMsgDirection':_0xd62f('0xb5'),'Messages':[_[_0xd62f('0x56')](_0x57e9e5[_0xd62f('0x5e')],{'messageId':_0x5c9b7e['messageId'],'sentAt':moment()['format'](_0xd62f('0x9e')),'read':!![],'MailAccountId':_0x48241b['id'],'UserId':_0x57e9e5[_0xd62f('0x34')]['id'],'ContactId':_0x112ec1['id']})]};if(_0x57e9e5['body'][_0xd62f('0xb6')]){_0x57d6b4=_[_0xd62f('0x56')](_0x57d6b4,_0x57e9e5[_0xd62f('0x5e')]['Interaction']);}return db[_0xd62f('0x83')][_0xd62f('0x67')](_0x57d6b4,{'include':[{'model':db[_0xd62f('0x9f')],'as':'Messages'}]});})[_0xd62f('0xd')](respondWithResult(_0x3a9237,null))['catch'](handleError(_0x3a9237,null));};exports[_0xd62f('0xb7')]=function(_0x9ab20e,_0xffb0f7){return db[_0xd62f('0x44')]['find']({'where':{'id':_0x9ab20e[_0xd62f('0x62')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xd62f('0x3e'),'raw':!![],'include':[{'model':db[_0xd62f('0xa7')],'as':_0xd62f('0xa7'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0xffb0f7,null))['then'](function(_0x508037){if(!_0x508037[_0xd62f('0x3e')])return;var _0x275179=_0x508037[_0xd62f('0xad')]();return respondWithRpcPromise(_0xd62f('0xb8'),_0xd62f('0xb7'),{'account':_0x275179});})[_0xd62f('0xd')](respondWithResult(_0xffb0f7,null))[_0xd62f('0x5d')](handleError(_0xffb0f7,null));};exports['destroy']=function(_0x3022d0,_0x1b4798){return db['MailAccount'][_0xd62f('0x5c')]({'where':{'id':_0x3022d0[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x1b4798,null))[_0xd62f('0xd')](function(_0x34c3bf){if(_0x34c3bf&&_0x34c3bf[_0xd62f('0x63')]){throw new db['Sequelize'][(_0xd62f('0xb9'))](_0xd62f('0xba'));}return _0x34c3bf;})[_0xd62f('0xd')](removeEntity(_0x1b4798,null))['catch'](handleError(_0x1b4798,null));};exports['addAgents']=function(_0x551a97,_0x1ec46f){return db[_0xd62f('0x44')][_0xd62f('0x5c')]({'where':{'id':_0x551a97[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0x1ec46f,null))[_0xd62f('0xd')](function(_0x42f8f8){if(_0x42f8f8){return _0x42f8f8[_0xd62f('0xbb')](_0x551a97[_0xd62f('0x5e')][_0xd62f('0x6e')],_[_0xd62f('0x85')](_0x551a97[_0xd62f('0x5e')],[_0xd62f('0x6e'),'id'])||{})[_0xd62f('0xbc')](function(_0x113b4b){for(var _0x241d24=0x0;_0x241d24<_0x551a97[_0xd62f('0x5e')][_0xd62f('0x6e')][_0xd62f('0x50')];_0x241d24+=0x1){socket[_0xd62f('0xbd')]('userMailAccount:save',{'UserId':Number(_0x551a97[_0xd62f('0x5e')]['ids'][_0x241d24]),'MailAccountId':Number(_0x551a97['params']['id'])});}return _0x113b4b;});}})[_0xd62f('0xd')](respondWithResult(_0x1ec46f,null))[_0xd62f('0x5d')](handleError(_0x1ec46f,null));};exports[_0xd62f('0xbe')]=function(_0x5dd921,_0x51dc1f){return db[_0xd62f('0x44')][_0xd62f('0x5c')]({'where':{'id':_0x5dd921['params']['id']}})['then'](handleEntityNotFound(_0x51dc1f,null))[_0xd62f('0xd')](function(_0x35db46){if(_0x35db46){return _0x35db46[_0xd62f('0xbe')](_0x5dd921['query'][_0xd62f('0x6e')])[_0xd62f('0xd')](function(){if(_[_0xd62f('0xbf')](_0x5dd921['query'][_0xd62f('0x6e')])){for(var _0xdd39cb=0x0;_0xdd39cb<_0x5dd921[_0xd62f('0x49')][_0xd62f('0x6e')][_0xd62f('0x50')];_0xdd39cb+=0x1){socket[_0xd62f('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x5dd921['query'][_0xd62f('0x6e')][_0xdd39cb]),'MailAccountId':Number(_0x5dd921[_0xd62f('0x62')]['id'])});}}else{socket[_0xd62f('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x5dd921[_0xd62f('0x49')][_0xd62f('0x6e')]),'MailAccountId':Number(_0x5dd921[_0xd62f('0x62')]['id'])});}});}})[_0xd62f('0xd')](respondWithStatusCode(_0x51dc1f,null))['catch'](handleError(_0x51dc1f,null));};exports['getAgents']=function(_0x53c849,_0xd328ac){var _0x26b1e0={};var _0x49140e={};var _0x39a670;var _0xd573b;return db[_0xd62f('0x44')][_0xd62f('0x69')]({'where':{'id':_0x53c849[_0xd62f('0x62')]['id']}})[_0xd62f('0xd')](handleEntityNotFound(_0xd328ac,null))[_0xd62f('0xd')](function(_0x43269c){if(_0x43269c){_0x39a670=_0x43269c;_0x49140e[_0xd62f('0x4d')]=_['keys'](db[_0xd62f('0x89')][_0xd62f('0x45')]);_0x49140e[_0xd62f('0x49')]=_[_0xd62f('0x4a')](_0x53c849[_0xd62f('0x49')]);_0x49140e[_0xd62f('0x4b')]=_[_0xd62f('0x4c')](_0x49140e[_0xd62f('0x4d')],_0x49140e[_0xd62f('0x49')]);_0x26b1e0[_0xd62f('0x4e')]=_['intersection'](_0x49140e[_0xd62f('0x4d')],qs[_0xd62f('0x4f')](_0x53c849[_0xd62f('0x49')]['fields']));_0x26b1e0[_0xd62f('0x4e')]=_0x26b1e0[_0xd62f('0x4e')][_0xd62f('0x50')]?_0x26b1e0['attributes']:_0x49140e['model'];_0x26b1e0[_0xd62f('0x52')]=qs[_0xd62f('0x53')](_0x53c849[_0xd62f('0x49')][_0xd62f('0x53')]);_0x26b1e0['where']=qs['filters'](_['pick'](_0x53c849[_0xd62f('0x49')],_0x49140e[_0xd62f('0x4b')]));if(_0x53c849[_0xd62f('0x49')][_0xd62f('0x55')]){_0x26b1e0[_0xd62f('0x54')]=_[_0xd62f('0x56')](_0x26b1e0[_0xd62f('0x54')],{'$or':_[_0xd62f('0x94')](_0x26b1e0[_0xd62f('0x4e')],function(_0x55a23e){var _0x40b476={};_0x40b476[_0x55a23e]={'$like':'%'+_0x53c849[_0xd62f('0x49')][_0xd62f('0x55')]+'%'};return _0x40b476;})});}_0x26b1e0=_['merge']({},_0x26b1e0,_0x53c849['options']);return _0x39a670[_0xd62f('0xc0')](_0x26b1e0);}})[_0xd62f('0xd')](function(_0x587435){if(_0x587435){_0xd573b=_0x587435['length'];if(!_0x53c849[_0xd62f('0x49')][_0xd62f('0x6a')](_0xd62f('0x51'))){_0x26b1e0['limit']=qs[_0xd62f('0x1a')](_0x53c849[_0xd62f('0x49')][_0xd62f('0x1a')]);_0x26b1e0[_0xd62f('0x1c')]=qs[_0xd62f('0x1c')](_0x53c849['query']['offset']);}return _0x39a670[_0xd62f('0xc0')](_0x26b1e0);}})[_0xd62f('0xd')](function(_0x3774f7){if(_0x3774f7){return _0x3774f7?{'count':_0xd573b,'rows':_0x3774f7}:null;}})[_0xd62f('0xd')](respondWithResult(_0xd328ac,null))[_0xd62f('0x5d')](handleError(_0xd328ac,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 01fdc8a..5876b73 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 _0x980f=['events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x459905,_0xd47450){var _0x1a2709=function(_0x3d43c5){while(--_0x3d43c5){_0x459905['push'](_0x459905['shift']());}};_0x1a2709(++_0xd47450);}(_0x980f,0xe6));var _0xf980=function(_0x69062,_0x231f82){_0x69062=_0x69062-0x0;var _0x3dabab=_0x980f[_0x69062];return _0x3dabab;};'use strict';var EventEmitter=require(_0xf980('0x0'));var MailAccount=require(_0xf980('0x1'))['db'][_0xf980('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xf980('0x3')](0x0);var events={'afterCreate':_0xf980('0x4'),'afterUpdate':'update','afterDestroy':_0xf980('0x5')};function emitEvent(_0x26bb38){return function(_0x4865a7,_0x2a9289,_0x236228){MailAccountEvents[_0xf980('0x6')](_0x26bb38+':'+_0x4865a7['id'],_0x4865a7);MailAccountEvents[_0xf980('0x6')](_0x26bb38,_0x4865a7);_0x236228(null);};}for(var e in events){if(events[_0xf980('0x7')](e)){var event=events[e];MailAccount[_0xf980('0x8')](e,emitEvent(event));}}module[_0xf980('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xa647=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x9ff1c0,_0x207afc){var _0x3e6c23=function(_0x11ad15){while(--_0x11ad15){_0x9ff1c0['push'](_0x9ff1c0['shift']());}};_0x3e6c23(++_0x207afc);}(_0xa647,0x81));var _0x7a64=function(_0x4b0ae8,_0xed1343){_0x4b0ae8=_0x4b0ae8-0x0;var _0x1ed46e=_0xa647[_0x4b0ae8];return _0x1ed46e;};'use strict';var EventEmitter=require(_0x7a64('0x0'));var MailAccount=require(_0x7a64('0x1'))['db'][_0x7a64('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7a64('0x3')](0x0);var events={'afterCreate':_0x7a64('0x4'),'afterUpdate':_0x7a64('0x5'),'afterDestroy':_0x7a64('0x6')};function emitEvent(_0x30b8b7){return function(_0x1c7a04,_0x2e1029,_0x46b8b0){MailAccountEvents[_0x7a64('0x7')](_0x30b8b7+':'+_0x1c7a04['id'],_0x1c7a04);MailAccountEvents['emit'](_0x30b8b7,_0x1c7a04);_0x46b8b0(null);};}for(var e in events){if(events[_0x7a64('0x8')](e)){var event=events[e];MailAccount[_0x7a64('0x9')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 02cc8ef..2a744b1 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 _0xcdc0=['port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','service','provider','host','Smtp'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xcdc0,0x68));var _0x0cdc=function(_0x2fc478,_0x4a7f28){_0x2fc478=_0x2fc478-0x0;var _0xd20f03=_0xcdc0[_0x2fc478];return _0xd20f03;};'use strict';var attributes=require(_0x0cdc('0x0'));module[_0x0cdc('0x1')]=function(_0x31f34e){return _0x31f34e[_0x0cdc('0x2')](_0x0cdc('0x3'),attributes,{'tableName':_0x0cdc('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x8f781b=this;var _0x5b3558={'id':_0x8f781b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x8f781b['provider']!==_0x0cdc('0x5')){_0x5b3558[_0x0cdc('0x6')]=_0x8f781b[_0x0cdc('0x7')];}else{_0x5b3558[_0x0cdc('0x8')]=_0x8f781b[_0x0cdc('0x9')][_0x0cdc('0x8')];_0x5b3558[_0x0cdc('0xa')]=_0x8f781b['Smtp'][_0x0cdc('0xa')];_0x5b3558[_0x0cdc('0xb')]=_0x8f781b[_0x0cdc('0x9')][_0x0cdc('0xb')];}if(_0x8f781b[_0x0cdc('0x9')]['authentication']){if(_0x8f781b['Smtp'][_0x0cdc('0xc')]){if(!_0x8f781b['Smtp'][_0x0cdc('0xd')])throw new Error(_0x0cdc('0xe'));_0x5b3558[_0x0cdc('0xf')]={'type':_0x0cdc('0x10'),'user':_0x8f781b[_0x0cdc('0x9')][_0x0cdc('0x11')],'accessToken':_0x8f781b[_0x0cdc('0x9')][_0x0cdc('0xd')][_0x0cdc('0x12')]};}else{_0x5b3558[_0x0cdc('0xf')]={'user':_0x8f781b[_0x0cdc('0x9')][_0x0cdc('0x11')],'pass':_0x8f781b[_0x0cdc('0x9')]['pass']};}}return _0x5b3558;}}});}; \ No newline at end of file +var _0xbfb5=['./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','service','host','Smtp','port','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','data5','auth','user','pass'];(function(_0x5033df,_0xcfaa7d){var _0x9d4ae2=function(_0x184fdb){while(--_0x184fdb){_0x5033df['push'](_0x5033df['shift']());}};_0x9d4ae2(++_0xcfaa7d);}(_0xbfb5,0x132));var _0x5bfb=function(_0xbeab29,_0x4c315b){_0xbeab29=_0xbeab29-0x0;var _0x34067d=_0xbfb5[_0xbeab29];return _0x34067d;};'use strict';var attributes=require(_0x5bfb('0x0'));module[_0x5bfb('0x1')]=function(_0x1dadd5){return _0x1dadd5[_0x5bfb('0x2')](_0x5bfb('0x3'),attributes,{'tableName':_0x5bfb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x308f08=this;var _0x1a2758={'id':_0x308f08['id'],'tls':{'rejectUnauthorized':![]}};if(_0x308f08[_0x5bfb('0x5')]!=='custom'){_0x1a2758[_0x5bfb('0x6')]=_0x308f08[_0x5bfb('0x5')];}else{_0x1a2758[_0x5bfb('0x7')]=_0x308f08[_0x5bfb('0x8')]['host'];_0x1a2758[_0x5bfb('0x9')]=_0x308f08[_0x5bfb('0x8')]['port'];_0x1a2758['secure']=_0x308f08[_0x5bfb('0x8')]['secure'];}if(_0x308f08['Smtp']['authentication']){if(_0x308f08['Smtp'][_0x5bfb('0xa')]){if(!_0x308f08['Smtp'][_0x5bfb('0xb')])throw new Error(_0x5bfb('0xc'));_0x1a2758['auth']={'type':'OAuth2','user':_0x308f08[_0x5bfb('0x8')]['user'],'accessToken':_0x308f08[_0x5bfb('0x8')][_0x5bfb('0xb')][_0x5bfb('0xd')]};}else{_0x1a2758[_0x5bfb('0xe')]={'user':_0x308f08[_0x5bfb('0x8')][_0x5bfb('0xf')],'pass':_0x308f08['Smtp'][_0x5bfb('0x10')]};}}return _0x1a2758;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 2ff60f4..23f80dc 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 _0xba34=['MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','getSmtpOptions','list','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','from','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailAccount','MailAccount','find','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC'];(function(_0x1c6355,_0x5d1571){var _0x422fb1=function(_0x4fafaa){while(--_0x4fafaa){_0x1c6355['push'](_0x1c6355['shift']());}};_0x422fb1(++_0x5d1571);}(_0xba34,0x119));var _0x4ba3=function(_0x52267a,_0xb1301b){_0x52267a=_0x52267a-0x0;var _0x378d6b=_0xba34[_0x52267a];return _0x378d6b;};'use strict';var _=require(_0x4ba3('0x0'));var moment=require(_0x4ba3('0x1'));var BPromise=require(_0x4ba3('0x2'));var rs=require(_0x4ba3('0x3'));var Redis=require(_0x4ba3('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x4ba3('0x5'));var jayson=require(_0x4ba3('0x6'));var client=jayson[_0x4ba3('0x7')][_0x4ba3('0x8')]({'port':0x232c});config[_0x4ba3('0x9')]=_[_0x4ba3('0xa')](config[_0x4ba3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ba3('0xb'))(new Redis(config[_0x4ba3('0x9')]));require(_0x4ba3('0xc'))[_0x4ba3('0xd')](socket);function respondWithRpcPromise(_0x380d60,_0xcf1ec3,_0x292f58){return new BPromise(function(_0x3f653c,_0x2ed106){return client[_0x4ba3('0xe')](_0x380d60,_0x292f58)[_0x4ba3('0xf')](function(_0x51edab){logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0xcf1ec3,'request\x20sent');logger[_0x4ba3('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'),JSON['stringify'](_0x51edab));if(_0x51edab[_0x4ba3('0x14')]){if(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x15')]===0x1f4){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x2ed106(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);return _0x3f653c(_0x51edab[_0x4ba3('0x14')][_0x4ba3('0x16')]);}else{logger[_0x4ba3('0x10')]('MailAccount,\x20%s,\x20%s',_0xcf1ec3,_0x4ba3('0x13'));_0x3f653c(_0x51edab[_0x4ba3('0x17')][_0x4ba3('0x16')]);}})[_0x4ba3('0x18')](function(_0x556290){logger[_0x4ba3('0x14')](_0x4ba3('0x11'),_0xcf1ec3,_0x556290);_0x2ed106(_0x556290);});});}exports[_0x4ba3('0x19')]=function(_0x1e2ce5){var _0x184332=this;return new Promise(function(_0x125944,_0x4b2791){return db['MailAccount'][_0x4ba3('0x1a')]({'raw':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1e')]||null:null,'limit':_0x1e2ce5[_0x4ba3('0x1b')]?_0x1e2ce5['options'][_0x4ba3('0x1f')]||null:null,'include':_0x1e2ce5['options']?_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x1e2ce5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')],'include':_0x252f37['include']?_[_0x4ba3('0x21')](_0x252f37[_0x4ba3('0x20')],function(_0x44d78c){return{'model':db[_0x44d78c['model']],'as':_0x44d78c['as'],'attributes':_0x44d78c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x34ecb4){logger[_0x4ba3('0x10')]('GetMailAccount',_0x1e2ce5);logger['debug'](_0x4ba3('0x19'),_0x1e2ce5,JSON[_0x4ba3('0x23')](_0x34ecb4));_0x125944(_0x34ecb4);})[_0x4ba3('0x18')](function(_0x19f039){logger[_0x4ba3('0x14')](_0x4ba3('0x19'),_0x19f039['message'],_0x1e2ce5);_0x4b2791(_0x184332[_0x4ba3('0x14')](0x1f4,_0x19f039[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x24')]=function(_0xbf95b3){var _0x2a6757=this;return new Promise(function(_0x1a7a2c,_0x457236){return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'raw':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3['options']['raw']===undefined?!![]:![]:!![],'where':_0xbf95b3['options']?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'include':_0xbf95b3[_0x4ba3('0x1b')]?_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xbf95b3[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')],'include':_0x188f8c[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x188f8c[_0x4ba3('0x20')],function(_0xf892e1){return{'model':db[_0xf892e1[_0x4ba3('0x22')]],'as':_0xf892e1['as'],'attributes':_0xf892e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xf')](function(_0x3cf56c){if(_0xbf95b3[_0x4ba3('0x1b')]['smtp']===!![])_0x3cf56c[_0x4ba3('0x27')](_0x4ba3('0x28'),_0x3cf56c['getSmtpOptions']());logger[_0x4ba3('0x10')]('ShowMailAccount',_0xbf95b3);logger['debug'](_0x4ba3('0x24'),_0xbf95b3,JSON[_0x4ba3('0x23')](_0x3cf56c));_0x1a7a2c(_0x3cf56c);})[_0x4ba3('0x18')](function(_0x2b14e1){logger[_0x4ba3('0x14')]('ShowMailAccount',_0x2b14e1[_0x4ba3('0x16')],_0xbf95b3);_0x457236(_0x2a6757[_0x4ba3('0x14')](0x1f4,_0x2b14e1[_0x4ba3('0x16')]));});});};exports[_0x4ba3('0x29')]=function(_0xab7983){var _0x2acc92=this;return new Promise(function(_0x349af4,_0x2577be){var _0x553475={'body':_0xab7983[_0x4ba3('0x2a')],'channel':_0x4ba3('0x2b')};var _0x3cb07f=_[_0x4ba3('0x2c')](_[_0x4ba3('0x2d')](db[_0x4ba3('0x2e')][_0x4ba3('0x2f')]),[_0x4ba3('0x30'),_0x4ba3('0x31'),_0x4ba3('0x32'),_0x4ba3('0x33')]);var _0x1c58d2=![];if(_0xab7983[_0x4ba3('0x2a')]['id']){delete _0xab7983[_0x4ba3('0x2a')]['id'];}if(_['isNil'](_0xab7983['body']['from'])){return _0x2577be(_0x2acc92['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x4ba3('0x34')](_0xab7983['body'][_0x4ba3('0x2a')])||_0xab7983['body'][_0x4ba3('0x2a')]===''){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x35')));}if(_[_0x4ba3('0x34')](_0xab7983[_0x4ba3('0x2a')]['mapKey'])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3cb07f));}if(!_[_0x4ba3('0x36')](_0x3cb07f,_0xab7983['body'][_0x4ba3('0x37')])){return _0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x4ba3('0x38')+_0x3cb07f));}var _0x261a5e={};_0x261a5e[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')]['from'];return db[_0x4ba3('0x25')][_0x4ba3('0x26')]({'where':{'id':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x3a')],'as':_0x4ba3('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x261a5e,'limit':0x1,'order':[[_0x4ba3('0x31'),_0x4ba3('0x3c')]]}]},{'model':db[_0x4ba3('0x3d')],'as':'Applications'},{'model':db[_0x4ba3('0x3e')],'as':_0x4ba3('0x3f'),'include':[{'model':db[_0x4ba3('0x40')],'as':'CloudProvider'}]}]})['then'](function(_0x34dc04){if(_0x34dc04&&_0x34dc04['List']){var _0x439acf=_0x34dc04[_0x4ba3('0x41')]({'plain':!![]});_0x553475[_0x4ba3('0x39')]=_[_0x4ba3('0x42')](_0x439acf,[_0x4ba3('0x43'),_0x4ba3('0x3b')]);_0x553475['account'][_0x4ba3('0x28')]=_0x34dc04[_0x4ba3('0x44')]();_0x553475['applications']=_0x439acf[_0x4ba3('0x43')];_0x553475[_0x4ba3('0x45')]=_0x439acf[_0x4ba3('0x3b')];_0x553475[_0x4ba3('0x46')]=_[_0x4ba3('0x47')](_0x553475['applications'],[_0x4ba3('0x48')],[_0x4ba3('0x49')]);if(_0x553475['account']&&_0x553475[_0x4ba3('0x39')][_0x4ba3('0x4a')]){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4b')]({'id':0x0,'priority':_0x553475[_0x4ba3('0x46')][_0x4ba3('0x4c')]+0x1,'app':_0x4ba3('0x4d'),'appdata':_0x4ba3('0x4a'),'interval':_0x4ba3('0x4e')});}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')]){delete _0x553475[_0x4ba3('0x39')][_0x4ba3('0x43')];}if(_0x553475[_0x4ba3('0x39')][_0x4ba3('0x3b')]){delete _0x553475['account']['List'];}if(_0x439acf['List'][_0x4ba3('0x4f')][_0x4ba3('0x4c')]){return _0x439acf[_0x4ba3('0x3b')][_0x4ba3('0x4f')][0x0];}var _0x40af1d=_['defaults'](_0xab7983[_0x4ba3('0x2a')],{'firstName':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')],'ListId':_0x439acf[_0x4ba3('0x33')]});_0x40af1d[_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x37')]]=_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x50')];return db[_0x4ba3('0x2e')][_0x4ba3('0x51')](_0x40af1d);}else{throw new Error(_0x4ba3('0x52'));}})[_0x4ba3('0xf')](function(_0x317b9f){_0x553475[_0x4ba3('0x53')]=_0x317b9f;if(_0x317b9f){if(!_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x54')]){_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x54')]=rs[_0x4ba3('0x55')]()+'\x20'+_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['from'];}var _0x8ea419={'ContactId':_0x317b9f['id'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'inReplyTo':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'to':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'lastMsgAt':moment()[_0x4ba3('0x58')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x4ba3('0x59')][_0x4ba3('0x26')]({'where':{'closed':![],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id']},'include':[{'model':db[_0x4ba3('0x5a')],'as':_0x4ba3('0x5b'),'attributes':[_0x4ba3('0x54')],'where':{'messageId':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x5c')]}}]})[_0x4ba3('0xf')](function(_0x1afc5e){if(_0x1afc5e){return[_0x1afc5e,![]];}return db['MailInteraction'][_0x4ba3('0x51')](_0x8ea419)[_0x4ba3('0xf')](function(_0x55c03c){return[_0x55c03c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4ba3('0x5d')](function(_0x296bf6,_0x5c7c2f){if(_0x296bf6){_0x1c58d2=_0x5c7c2f;if(!_0x5c7c2f){return _0x296bf6[_0x4ba3('0x5e')]({'inReplyTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['messageId'],'to':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x50')],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x56')],'attach':_0x296bf6[_0x4ba3('0x57')]?_0x296bf6[_0x4ba3('0x57')]:_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x57')],'substatus':null,'substatusAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgAt':moment()[_0x4ba3('0x58')](_0x4ba3('0x5f')),'lastMsgDirection':'in'});}else{return _0x296bf6;}}})[_0x4ba3('0xf')](function(_0x424477){_0x553475['interaction']=_0x424477['get']({'plain':!![]});_0x553475[_0x4ba3('0x60')]['created']=_0x1c58d2;return db[_0x4ba3('0x5a')][_0x4ba3('0x51')]({'body':_0xab7983[_0x4ba3('0x2a')]['body'],'MailAccountId':_0xab7983[_0x4ba3('0x39')]['id'],'MailInteractionId':_0x424477['id'],'direction':'in','ContactId':_0x553475[_0x4ba3('0x53')]['id'],'messageId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x54')],'from':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x50')],'to':_0xab7983['body'][_0x4ba3('0x16')]['to'],'cc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')]['cc'],'subject':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x56')],'attach':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x57')],'Attachments':_0xab7983['body'][_0x4ba3('0x16')][_0x4ba3('0x61')],'originTo':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x62')],'originCc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x63')],'bcc':_0xab7983[_0x4ba3('0x2a')][_0x4ba3('0x16')][_0x4ba3('0x64')],'ChatWebsiteId':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x65')]||null,'originChannel':_0xab7983[_0x4ba3('0x2a')]['message'][_0x4ba3('0x66')]||_0x4ba3('0x67'),'ChatOfflineMessageId':_0xab7983['body']['message'][_0x4ba3('0x68')]||null},{'include':[{'model':db[_0x4ba3('0x69')],'as':_0x4ba3('0x6a')}]});})[_0x4ba3('0xf')](function(_0x37b966){_0x553475[_0x4ba3('0x16')]=_0x37b966;if(_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]){return db['User'][_0x4ba3('0x26')]({'attributes':['id','name'],'where':{'id':_0x553475[_0x4ba3('0x60')][_0x4ba3('0x6b')]}})[_0x4ba3('0xf')](function(_0x3c3638){if(_0x3c3638){_0x553475[_0x4ba3('0x46')][_0x4ba3('0x6c')]({'id':0x0,'priority':0x0,'app':_0x4ba3('0x6d'),'appdata':_0x3c3638[_0x4ba3('0x6e')]+','+(_0x553475['account'][_0x4ba3('0x6f')]||0xa),'interval':_0x4ba3('0x4e')});}return respondWithRpcPromise(_0x4ba3('0x70'),'startRouting',_0x553475);});}return respondWithRpcPromise(_0x4ba3('0x70'),_0x4ba3('0x71'),_0x553475);})[_0x4ba3('0xf')](function(_0x39d428){_0x349af4(_0x39d428);})[_0x4ba3('0x18')](function(_0x2569bc){_0x2577be(_0x2acc92[_0x4ba3('0x14')](0x1f4,_0x2569bc['message']));});});}; \ No newline at end of file +var _0xc2c7=['defaults','./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','raw','options','where','attributes','include','map','model','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','updatedAt','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','account','CmList','List','DESC','MailApplication','Smtp','CloudProvider','get','omit','Applications','applications','orderBy','asc','autoclose','push','close','Contacts','length','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','Attachment','Attachments','User','name','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x1dd53e,_0x2f40ce){var _0x1d34e2=function(_0x71bd8f){while(--_0x71bd8f){_0x1dd53e['push'](_0x1dd53e['shift']());}};_0x1d34e2(++_0x2f40ce);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3a2899,_0x3165f8){_0x3a2899=_0x3a2899-0x0;var _0x1895bb=_0xc2c7[_0x3a2899];return _0x1895bb;};'use strict';var _=require('lodash');var moment=require(_0x7c2c('0x0'));var BPromise=require(_0x7c2c('0x1'));var rs=require(_0x7c2c('0x2'));var Redis=require(_0x7c2c('0x3'));var db=require(_0x7c2c('0x4'))['db'];var logger=require(_0x7c2c('0x5'))(_0x7c2c('0x6'));var config=require(_0x7c2c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c2c('0x8')]({'port':0x232c});config[_0x7c2c('0x9')]=_[_0x7c2c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c2c('0x9')]));require(_0x7c2c('0xb'))[_0x7c2c('0xc')](socket);function respondWithRpcPromise(_0x3b780b,_0x279cff,_0x57b107){return new BPromise(function(_0x3093d2,_0x307bec){return client[_0x7c2c('0xd')](_0x3b780b,_0x57b107)[_0x7c2c('0xe')](function(_0x2587ec){logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x279cff,_0x7c2c('0x11'));logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x279cff,_0x7c2c('0x11'),JSON[_0x7c2c('0x14')](_0x2587ec));if(_0x2587ec[_0x7c2c('0x15')]){if(_0x2587ec[_0x7c2c('0x15')][_0x7c2c('0x16')]===0x1f4){logger[_0x7c2c('0x15')]('MailAccount,\x20%s,\x20%s',_0x279cff,_0x2587ec['error'][_0x7c2c('0x17')]);return _0x307bec(_0x2587ec[_0x7c2c('0x15')][_0x7c2c('0x17')]);}logger['error'](_0x7c2c('0x10'),_0x279cff,_0x2587ec[_0x7c2c('0x15')]['message']);return _0x3093d2(_0x2587ec[_0x7c2c('0x15')]['message']);}else{logger[_0x7c2c('0xf')]('MailAccount,\x20%s,\x20%s',_0x279cff,_0x7c2c('0x11'));_0x3093d2(_0x2587ec[_0x7c2c('0x18')][_0x7c2c('0x17')]);}})[_0x7c2c('0x19')](function(_0x17df4a){logger[_0x7c2c('0x15')](_0x7c2c('0x10'),_0x279cff,_0x17df4a);_0x307bec(_0x17df4a);});});}exports[_0x7c2c('0x1a')]=function(_0x2d356e){var _0x39c5f3=this;return new Promise(function(_0x40eaef,_0x2381b4){return db['MailAccount'][_0x7c2c('0x1b')]({'raw':_0x2d356e['options']?_0x2d356e['options'][_0x7c2c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e[_0x7c2c('0x1d')][_0x7c2c('0x1e')]||null:null,'attributes':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e[_0x7c2c('0x1d')][_0x7c2c('0x1f')]||null:null,'limit':_0x2d356e['options']?_0x2d356e[_0x7c2c('0x1d')]['limit']||null:null,'include':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e['options'][_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x2d356e[_0x7c2c('0x1d')]['include'],function(_0x4d6ec7){return{'model':db[_0x4d6ec7[_0x7c2c('0x22')]],'as':_0x4d6ec7['as'],'attributes':_0x4d6ec7[_0x7c2c('0x1f')],'include':_0x4d6ec7[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x4d6ec7[_0x7c2c('0x20')],function(_0xa8e145){return{'model':db[_0xa8e145[_0x7c2c('0x22')]],'as':_0xa8e145['as'],'attributes':_0xa8e145['attributes'],'include':_0xa8e145[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0xa8e145[_0x7c2c('0x20')],function(_0x22d03f){return{'model':db[_0x22d03f[_0x7c2c('0x22')]],'as':_0x22d03f['as'],'attributes':_0x22d03f[_0x7c2c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xe')](function(_0x26f472){logger[_0x7c2c('0xf')]('GetMailAccount',_0x2d356e);logger[_0x7c2c('0x12')](_0x7c2c('0x1a'),_0x2d356e,JSON[_0x7c2c('0x14')](_0x26f472));_0x40eaef(_0x26f472);})[_0x7c2c('0x19')](function(_0x53ad23){logger[_0x7c2c('0x15')](_0x7c2c('0x1a'),_0x53ad23[_0x7c2c('0x17')],_0x2d356e);_0x2381b4(_0x39c5f3[_0x7c2c('0x15')](0x1f4,_0x53ad23[_0x7c2c('0x17')]));});});};exports[_0x7c2c('0x23')]=function(_0x463ef7){var _0x57af44=this;return new Promise(function(_0x1969f4,_0x1acf75){return db[_0x7c2c('0x24')][_0x7c2c('0x25')]({'raw':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options']['raw']===undefined?!![]:![]:!![],'where':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options']['where']||null:null,'attributes':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x1f')]||null:null,'include':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options'][_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x20')],function(_0x204968){return{'model':db[_0x204968[_0x7c2c('0x22')]],'as':_0x204968['as'],'attributes':_0x204968[_0x7c2c('0x1f')],'include':_0x204968[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x204968[_0x7c2c('0x20')],function(_0x3230a1){return{'model':db[_0x3230a1[_0x7c2c('0x22')]],'as':_0x3230a1['as'],'attributes':_0x3230a1[_0x7c2c('0x1f')],'include':_0x3230a1['include']?_['map'](_0x3230a1[_0x7c2c('0x20')],function(_0x4acc5d){return{'model':db[_0x4acc5d['model']],'as':_0x4acc5d['as'],'attributes':_0x4acc5d['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xe')](function(_0xc77f11){if(_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x26')]===!![])_0xc77f11[_0x7c2c('0x27')](_0x7c2c('0x28'),_0xc77f11[_0x7c2c('0x29')]());logger[_0x7c2c('0xf')](_0x7c2c('0x23'),_0x463ef7);logger[_0x7c2c('0x12')](_0x7c2c('0x23'),_0x463ef7,JSON['stringify'](_0xc77f11));_0x1969f4(_0xc77f11);})['catch'](function(_0x3920b6){logger[_0x7c2c('0x15')](_0x7c2c('0x23'),_0x3920b6[_0x7c2c('0x17')],_0x463ef7);_0x1acf75(_0x57af44['error'](0x1f4,_0x3920b6[_0x7c2c('0x17')]));});});};exports[_0x7c2c('0x2a')]=function(_0x93e2a8){var _0x45fddf=this;return new Promise(function(_0x18e288,_0x8b0dc9){var _0x12c9cd={'body':_0x93e2a8[_0x7c2c('0x2b')],'channel':_0x7c2c('0x2c')};var _0x4e1f79=_[_0x7c2c('0x2d')](_['keys'](db[_0x7c2c('0x2e')][_0x7c2c('0x2f')]),['createdAt',_0x7c2c('0x30'),'CompanyId',_0x7c2c('0x31')]);var _0x33b2be=![];if(_0x93e2a8[_0x7c2c('0x2b')]['id']){delete _0x93e2a8[_0x7c2c('0x2b')]['id'];}if(_['isNil'](_0x93e2a8[_0x7c2c('0x2b')]['from'])){return _0x8b0dc9(_0x45fddf['error'](0x1f4,_0x7c2c('0x32')));}if(_[_0x7c2c('0x33')](_0x93e2a8[_0x7c2c('0x2b')]['body'])||_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x2b')]===''){return _0x8b0dc9(_0x45fddf['error'](0x1f4,_0x7c2c('0x34')));}if(_['isNil'](_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')])){return _0x8b0dc9(_0x45fddf['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1f79));}if(!_[_0x7c2c('0x36')](_0x4e1f79,_0x93e2a8[_0x7c2c('0x2b')]['mapKey'])){return _0x8b0dc9(_0x45fddf[_0x7c2c('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1f79));}var _0x51e3b7={};_0x51e3b7[_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')]]=_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x37')];return db[_0x7c2c('0x24')][_0x7c2c('0x25')]({'where':{'id':_0x93e2a8[_0x7c2c('0x38')]['id']},'include':[{'model':db[_0x7c2c('0x39')],'as':_0x7c2c('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x51e3b7,'limit':0x1,'order':[[_0x7c2c('0x30'),_0x7c2c('0x3b')]]}]},{'model':db[_0x7c2c('0x3c')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x7c2c('0x3d'),'include':[{'model':db[_0x7c2c('0x3e')],'as':_0x7c2c('0x3e')}]}]})[_0x7c2c('0xe')](function(_0x5f3de8){if(_0x5f3de8&&_0x5f3de8['List']){var _0x587667=_0x5f3de8[_0x7c2c('0x3f')]({'plain':!![]});_0x12c9cd[_0x7c2c('0x38')]=_[_0x7c2c('0x40')](_0x587667,[_0x7c2c('0x41'),_0x7c2c('0x3a')]);_0x12c9cd['account'][_0x7c2c('0x28')]=_0x5f3de8[_0x7c2c('0x29')]();_0x12c9cd['applications']=_0x587667[_0x7c2c('0x41')];_0x12c9cd['list']=_0x587667[_0x7c2c('0x3a')];_0x12c9cd[_0x7c2c('0x42')]=_[_0x7c2c('0x43')](_0x12c9cd['applications'],['priority'],[_0x7c2c('0x44')]);if(_0x12c9cd['account']&&_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x45')]){_0x12c9cd['applications'][_0x7c2c('0x46')]({'id':0x0,'priority':_0x12c9cd[_0x7c2c('0x42')]['length']+0x1,'app':_0x7c2c('0x47'),'appdata':_0x7c2c('0x45'),'interval':'*,*,*,*'});}if(_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x41')]){delete _0x12c9cd[_0x7c2c('0x38')]['Applications'];}if(_0x12c9cd[_0x7c2c('0x38')]['List']){delete _0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x3a')];}if(_0x587667['List'][_0x7c2c('0x48')][_0x7c2c('0x49')]){return _0x587667[_0x7c2c('0x3a')][_0x7c2c('0x48')][0x0];}var _0x481b9e=_[_0x7c2c('0xa')](_0x93e2a8[_0x7c2c('0x2b')],{'firstName':_0x93e2a8['body'][_0x7c2c('0x37')],'ListId':_0x587667['ListId']});_0x481b9e[_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')]]=_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x37')];return db[_0x7c2c('0x2e')]['create'](_0x481b9e);}else{throw new Error(_0x7c2c('0x4a'));}})[_0x7c2c('0xe')](function(_0x4c4661){_0x12c9cd['contact']=_0x4c4661;if(_0x4c4661){if(!_0x93e2a8['body'][_0x7c2c('0x17')]['messageId']){_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x4b')]=rs[_0x7c2c('0x4c')]()+'\x20'+_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x37')];}var _0x1ee34d={'ContactId':_0x4c4661['id'],'MailAccountId':_0x93e2a8[_0x7c2c('0x38')]['id'],'inReplyTo':_0x93e2a8[_0x7c2c('0x2b')]['message']['messageId'],'to':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x37')],'cc':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x4d')],'attach':_0x93e2a8[_0x7c2c('0x2b')]['message']['attach'],'lastMsgAt':moment()[_0x7c2c('0x4e')](_0x7c2c('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x7c2c('0x25')]({'where':{'closed':![],'MailAccountId':_0x93e2a8['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x7c2c('0x50'),'attributes':[_0x7c2c('0x4b')],'where':{'messageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x51')]}}]})[_0x7c2c('0xe')](function(_0x2d4459){if(_0x2d4459){return[_0x2d4459,![]];}return db[_0x7c2c('0x52')][_0x7c2c('0x53')](_0x1ee34d)[_0x7c2c('0xe')](function(_0xd01d59){return[_0xd01d59,!![]];});});}else{throw new Error(_0x7c2c('0x54'));}})[_0x7c2c('0x55')](function(_0x3d44f8,_0x559005){if(_0x3d44f8){_0x33b2be=_0x559005;if(!_0x559005){return _0x3d44f8[_0x7c2c('0x56')]({'inReplyTo':_0x93e2a8['body']['message']['messageId'],'to':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x37')],'cc':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['subject'],'attach':_0x3d44f8[_0x7c2c('0x57')]?_0x3d44f8[_0x7c2c('0x57')]:_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x57')],'substatus':null,'substatusAt':moment()[_0x7c2c('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x7c2c('0x4e')](_0x7c2c('0x4f')),'lastMsgDirection':'in'});}else{return _0x3d44f8;}}})['then'](function(_0x39d319){_0x12c9cd[_0x7c2c('0x58')]=_0x39d319['get']({'plain':!![]});_0x12c9cd[_0x7c2c('0x58')][_0x7c2c('0x59')]=_0x33b2be;return db['MailMessage']['create']({'body':_0x93e2a8[_0x7c2c('0x2b')]['body'],'MailAccountId':_0x93e2a8[_0x7c2c('0x38')]['id'],'MailInteractionId':_0x39d319['id'],'direction':'in','ContactId':_0x12c9cd['contact']['id'],'messageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['messageId'],'from':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x37')],'to':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['to'],'cc':_0x93e2a8['body'][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x4d')],'attach':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x57')],'Attachments':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x5a')],'originTo':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x5b')],'originCc':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x5c')],'bcc':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x5d')],'ChatWebsiteId':_0x93e2a8['body']['message'][_0x7c2c('0x5e')]||null,'originChannel':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['originChannel']||_0x7c2c('0x5f'),'ChatOfflineMessageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x7c2c('0x60')],'as':_0x7c2c('0x61')}]});})[_0x7c2c('0xe')](function(_0x8f8b42){_0x12c9cd['message']=_0x8f8b42;if(_0x12c9cd[_0x7c2c('0x58')]['UserId']){return db[_0x7c2c('0x62')]['find']({'attributes':['id',_0x7c2c('0x63')],'where':{'id':_0x12c9cd[_0x7c2c('0x58')][_0x7c2c('0x64')]}})[_0x7c2c('0xe')](function(_0x43eb9d){if(_0x43eb9d){_0x12c9cd[_0x7c2c('0x42')][_0x7c2c('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x43eb9d[_0x7c2c('0x63')]+','+(_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x66')]||0xa),'interval':_0x7c2c('0x67')});}return respondWithRpcPromise(_0x7c2c('0x68'),_0x7c2c('0x69'),_0x12c9cd);});}return respondWithRpcPromise(_0x7c2c('0x68'),_0x7c2c('0x69'),_0x12c9cd);})['then'](function(_0x2d75b8){_0x18e288(_0x2d75b8);})[_0x7c2c('0x19')](function(_0x2391a7){_0x8b0dc9(_0x45fddf[_0x7c2c('0x15')](0x1f4,_0x2391a7[_0x7c2c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index da672c3..10e5195 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 _0x940d=['update','removeListener','register','length','./mailAccount.events','save','remove'];(function(_0x3b19d9,_0x559068){var _0x38709e=function(_0x19ee44){while(--_0x19ee44){_0x3b19d9['push'](_0x3b19d9['shift']());}};_0x38709e(++_0x559068);}(_0x940d,0x74));var _0xd940=function(_0x2d49dc,_0x3f7af0){_0x2d49dc=_0x2d49dc-0x0;var _0x193c97=_0x940d[_0x2d49dc];return _0x193c97;};'use strict';var MailAccountEvents=require(_0xd940('0x0'));var events=[_0xd940('0x1'),_0xd940('0x2'),_0xd940('0x3')];function createListener(_0x143ced,_0x120a59){return function(_0xeac95b){_0x120a59['emit'](_0x143ced,_0xeac95b);};}function removeListener(_0x935e80,_0x59933d){return function(){MailAccountEvents[_0xd940('0x4')](_0x935e80,_0x59933d);};}exports[_0xd940('0x5')]=function(_0x1ceddc){for(var _0x1f9885=0x0,_0x39b040=events[_0xd940('0x6')];_0x1f9885<_0x39b040;_0x1f9885++){var _0x5602b4=events[_0x1f9885];var _0x18c4c9=createListener('mailAccount:'+_0x5602b4,_0x1ceddc);MailAccountEvents['on'](_0x5602b4,_0x18c4c9);}}; \ No newline at end of file +var _0xae7e=['removeListener','register','length','mailAccount:','./mailAccount.events','update','emit'];(function(_0x55b1f5,_0x450e6d){var _0x1557d4=function(_0x114154){while(--_0x114154){_0x55b1f5['push'](_0x55b1f5['shift']());}};_0x1557d4(++_0x450e6d);}(_0xae7e,0xf2));var _0xeae7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xae7e[_0x2dafbe];return _0x58a45a;};'use strict';var MailAccountEvents=require(_0xeae7('0x0'));var events=['save','remove',_0xeae7('0x1')];function createListener(_0x327b11,_0x1bbcc2){return function(_0x3a5e4c){_0x1bbcc2[_0xeae7('0x2')](_0x327b11,_0x3a5e4c);};}function removeListener(_0x5dc961,_0x8dc0dc){return function(){MailAccountEvents[_0xeae7('0x3')](_0x5dc961,_0x8dc0dc);};}exports[_0xeae7('0x4')]=function(_0x1ebeae){for(var _0x327af6=0x0,_0x1c3532=events[_0xeae7('0x5')];_0x327af6<_0x1c3532;_0x327af6++){var _0x35d2f5=events[_0x327af6];var _0x50e1d6=createListener(_0xeae7('0x6')+_0x35d2f5,_0x1ebeae);MailAccountEvents['on'](_0x35d2f5,_0x50e1d6);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f7ea534..3a55049 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 _0xe743=['express','fs-extra','../../components/auth/service','../../config/environment','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe743,0xdd));var _0x3e74=function(_0x8ee0b2,_0x15c7b0){_0x8ee0b2=_0x8ee0b2-0x0;var _0x2348a3=_0xe743[_0x8ee0b2];return _0x2348a3;};'use strict';var multer=require(_0x3e74('0x0'));var util=require(_0x3e74('0x1'));var path=require(_0x3e74('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e74('0x3'));var router=express['Router']();var fs_extra=require(_0x3e74('0x4'));var auth=require(_0x3e74('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3e74('0x6'));var controller=require('./mailApplication.controller');router['get'](_0x3e74('0x7'),auth[_0x3e74('0x8')](),controller[_0x3e74('0x9')]);router['put'](_0x3e74('0x7'),auth[_0x3e74('0x8')](),controller[_0x3e74('0xa')]);router[_0x3e74('0xb')](_0x3e74('0x7'),auth['isAuthenticated'](),controller[_0x3e74('0xc')]);module[_0x3e74('0xd')]=router; \ No newline at end of file +var _0x3d88=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x550b95,_0x2125d4){var _0x5966f4=function(_0x31c55d){while(--_0x31c55d){_0x550b95['push'](_0x550b95['shift']());}};_0x5966f4(++_0x2125d4);}(_0x3d88,0x1c3));var _0x83d8=function(_0x55813d,_0x5da263){_0x55813d=_0x55813d-0x0;var _0x37fa23=_0x3d88[_0x55813d];return _0x37fa23;};'use strict';var multer=require(_0x83d8('0x0'));var util=require(_0x83d8('0x1'));var path=require(_0x83d8('0x2'));var timeout=require(_0x83d8('0x3'));var express=require(_0x83d8('0x4'));var router=express[_0x83d8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x83d8('0x6'));var interaction=require(_0x83d8('0x7'));var config=require(_0x83d8('0x8'));var controller=require(_0x83d8('0x9'));router[_0x83d8('0xa')](_0x83d8('0xb'),auth[_0x83d8('0xc')](),controller[_0x83d8('0xd')]);router[_0x83d8('0xe')](_0x83d8('0xb'),auth[_0x83d8('0xc')](),controller[_0x83d8('0xf')]);router[_0x83d8('0x10')](_0x83d8('0xb'),auth[_0x83d8('0xc')](),controller[_0x83d8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index aedcf0d..8c7e6b0 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 _0xd0eb=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x7e8949,_0x2efbf6){var _0x37cd0d=function(_0x38577e){while(--_0x38577e){_0x7e8949['push'](_0x7e8949['shift']());}};_0x37cd0d(++_0x2efbf6);}(_0xd0eb,0xb9));var _0xbd0e=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0xd0eb[_0x52666e];return _0x515330;};'use strict';var Sequelize=require(_0xbd0e('0x0'));module[_0xbd0e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd0e('0x2')},'appdata':{'type':Sequelize[_0xbd0e('0x3')]()},'description':{'type':Sequelize[_0xbd0e('0x4')]},'interval':{'type':Sequelize[_0xbd0e('0x4')],'defaultValue':_0xbd0e('0x5')}}; \ No newline at end of file +var _0xc704=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0xc704,0x119));var _0x4c70=function(_0x3ffb29,_0x22d414){_0x3ffb29=_0x3ffb29-0x0;var _0x2e0d40=_0xc704[_0x3ffb29];return _0x2e0d40;};'use strict';var Sequelize=require('sequelize');module[_0x4c70('0x0')]={'priority':{'type':Sequelize[_0x4c70('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4c70('0x2')],'allowNull':![],'defaultValue':_0x4c70('0x3')},'appdata':{'type':Sequelize[_0x4c70('0x4')]()},'description':{'type':Sequelize[_0x4c70('0x2')]},'interval':{'type':Sequelize[_0x4c70('0x2')],'defaultValue':_0x4c70('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b042866..c45d076 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(_0x50d1bd,_0x102e6c){var _0x1f5d89=function(_0x41b75d){while(--_0x41b75d){_0x50d1bd['push'](_0x50d1bd['shift']());}};_0x1f5d89(++_0x102e6c);}(_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 _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x1001b7,_0x478139){var _0x19634a=function(_0x47c1bb){while(--_0x47c1bb){_0x1001b7['push'](_0x1001b7['shift']());}};_0x19634a(++_0x478139);}(_0xac4a,0x13f));var _0xaac4=function(_0x552688,_0x4065f4){_0x552688=_0x552688-0x0;var _0x1675cc=_0xac4a[_0x552688];return _0x1675cc;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7045dda..f70cedc 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 _0xc1fd=['api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x27e7e2,_0x3ddb8a){var _0x55431f=function(_0xb012a2){while(--_0xb012a2){_0x27e7e2['push'](_0x27e7e2['shift']());}};_0x55431f(++_0x3ddb8a);}(_0xc1fd,0xa2));var _0xdc1f=function(_0x2fa4e7,_0x283c91){_0x2fa4e7=_0x2fa4e7-0x0;var _0x40677e=_0xc1fd[_0x2fa4e7];return _0x40677e;};'use strict';var _=require(_0xdc1f('0x0'));var util=require(_0xdc1f('0x1'));var logger=require(_0xdc1f('0x2'))(_0xdc1f('0x3'));var moment=require(_0xdc1f('0x4'));var BPromise=require('bluebird');var rp=require(_0xdc1f('0x5'));var fs=require('fs');var path=require(_0xdc1f('0x6'));var rimraf=require(_0xdc1f('0x7'));var config=require(_0xdc1f('0x8'));var attributes=require(_0xdc1f('0x9'));module[_0xdc1f('0xa')]=function(_0x32b7e3,_0x4f108e){return _0x32b7e3[_0xdc1f('0xb')](_0xdc1f('0xc'),attributes,{'tableName':_0xdc1f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdc1f('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7832=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x229557,_0x399a2b){var _0x380d87=function(_0x2fea87){while(--_0x2fea87){_0x229557['push'](_0x229557['shift']());}};_0x380d87(++_0x399a2b);}(_0x7832,0x196));var _0x2783=function(_0x2bf233,_0x252446){_0x2bf233=_0x2bf233-0x0;var _0x481b86=_0x7832[_0x2bf233];return _0x481b86;};'use strict';var _=require(_0x2783('0x0'));var util=require('util');var logger=require(_0x2783('0x1'))('api');var moment=require(_0x2783('0x2'));var BPromise=require(_0x2783('0x3'));var rp=require(_0x2783('0x4'));var fs=require('fs');var path=require(_0x2783('0x5'));var rimraf=require(_0x2783('0x6'));var config=require(_0x2783('0x7'));var attributes=require('./mailApplication.attributes');module[_0x2783('0x8')]=function(_0x3fe90a,_0x14e680){return _0x3fe90a[_0x2783('0x9')](_0x2783('0xa'),attributes,{'tableName':_0x2783('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2783('0xc'),'collate':_0x2783('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index d586c43..5483816 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 _0x071f=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailApplication','update','body','options','raw','where','UpdateMailApplication','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then','info','MailApplication,\x20%s,\x20%s'];(function(_0x2e0ad7,_0x261374){var _0x1adcd6=function(_0x18e992){while(--_0x18e992){_0x2e0ad7['push'](_0x2e0ad7['shift']());}};_0x1adcd6(++_0x261374);}(_0x071f,0xab));var _0xf071=function(_0x38876e,_0x30e148){_0x38876e=_0x38876e-0x0;var _0x20559e=_0x071f[_0x38876e];return _0x20559e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf071('0x0'));var BPromise=require('bluebird');var rs=require(_0xf071('0x1'));var fs=require('fs');var Redis=require(_0xf071('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf071('0x3'));var logger=require(_0xf071('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf071('0x5')][_0xf071('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x584379,_0x5519d7,_0x5b4453){return new BPromise(function(_0x56f379,_0x49f51e){return client[_0xf071('0x7')](_0x584379,_0x5b4453)[_0xf071('0x8')](function(_0x394496){logger[_0xf071('0x9')](_0xf071('0xa'),_0x5519d7,_0xf071('0xb'));logger[_0xf071('0xc')](_0xf071('0xd'),_0x5519d7,_0xf071('0xb'),JSON[_0xf071('0xe')](_0x394496));if(_0x394496[_0xf071('0xf')]){if(_0x394496[_0xf071('0xf')][_0xf071('0x10')]===0x1f4){logger['error'](_0xf071('0xa'),_0x5519d7,_0x394496[_0xf071('0xf')][_0xf071('0x11')]);return _0x49f51e(_0x394496['error'][_0xf071('0x11')]);}logger[_0xf071('0xf')](_0xf071('0xa'),_0x5519d7,_0x394496[_0xf071('0xf')][_0xf071('0x11')]);return _0x56f379(_0x394496[_0xf071('0xf')][_0xf071('0x11')]);}else{logger[_0xf071('0x9')](_0xf071('0xa'),_0x5519d7,_0xf071('0xb'));_0x56f379(_0x394496['result'][_0xf071('0x11')]);}})[_0xf071('0x12')](function(_0x311bde){logger[_0xf071('0xf')](_0xf071('0xa'),_0x5519d7,_0x311bde);_0x49f51e(_0x311bde);});});}exports['UpdateMailApplication']=function(_0x3974d0){var _0x1df10d=this;return new Promise(function(_0x537896,_0x4c370c){return db[_0xf071('0x13')][_0xf071('0x14')](_0x3974d0[_0xf071('0x15')],{'raw':_0x3974d0[_0xf071('0x16')]?_0x3974d0[_0xf071('0x16')][_0xf071('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3974d0['options']?_0x3974d0[_0xf071('0x16')][_0xf071('0x18')]||null:null,'attributes':_0x3974d0[_0xf071('0x16')]?_0x3974d0[_0xf071('0x16')]['attributes']||null:null,'limit':_0x3974d0[_0xf071('0x16')]?_0x3974d0[_0xf071('0x16')]['limit']||null:null})[_0xf071('0x8')](function(_0x426b39){logger[_0xf071('0x9')](_0xf071('0x19'),_0x3974d0);logger[_0xf071('0xc')](_0xf071('0x19'),_0x3974d0,JSON[_0xf071('0xe')](_0x426b39));_0x537896(_0x426b39);})[_0xf071('0x12')](function(_0x15e463){logger['error']('UpdateMailApplication',_0x15e463[_0xf071('0x11')],_0x3974d0);_0x4c370c(_0x1df10d[_0xf071('0xf')](0x1f4,_0x15e463['message']));});});}; \ No newline at end of file +var _0xbee1=['then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','info','result','message','catch','UpdateMailApplication','update','body','options','raw','where','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5a2946,_0x4fceef){var _0x5c05ad=function(_0x50aba9){while(--_0x50aba9){_0x5a2946['push'](_0x5a2946['shift']());}};_0x5c05ad(++_0x4fceef);}(_0xbee1,0xb3));var _0x1bee=function(_0x4d46c4,_0x807bf2){_0x4d46c4=_0x4d46c4-0x0;var _0x40ce25=_0xbee1[_0x4d46c4];return _0x40ce25;};'use strict';var _=require(_0x1bee('0x0'));var util=require(_0x1bee('0x1'));var moment=require(_0x1bee('0x2'));var BPromise=require(_0x1bee('0x3'));var rs=require(_0x1bee('0x4'));var fs=require('fs');var Redis=require(_0x1bee('0x5'));var db=require(_0x1bee('0x6'))['db'];var utils=require(_0x1bee('0x7'));var logger=require(_0x1bee('0x8'))(_0x1bee('0x9'));var config=require(_0x1bee('0xa'));var jayson=require(_0x1bee('0xb'));var client=jayson[_0x1bee('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b8cbf,_0x57f5fa,_0x4fb6c3){return new BPromise(function(_0x997008,_0x3bea69){return client['request'](_0x2b8cbf,_0x4fb6c3)[_0x1bee('0xd')](function(_0x7ded2c){logger['info'](_0x1bee('0xe'),_0x57f5fa,_0x1bee('0xf'));logger[_0x1bee('0x10')](_0x1bee('0x11'),_0x57f5fa,_0x1bee('0xf'),JSON['stringify'](_0x7ded2c));if(_0x7ded2c[_0x1bee('0x12')]){if(_0x7ded2c[_0x1bee('0x12')][_0x1bee('0x13')]===0x1f4){logger[_0x1bee('0x12')](_0x1bee('0xe'),_0x57f5fa,_0x7ded2c[_0x1bee('0x12')]['message']);return _0x3bea69(_0x7ded2c[_0x1bee('0x12')]['message']);}logger[_0x1bee('0x12')](_0x1bee('0xe'),_0x57f5fa,_0x7ded2c[_0x1bee('0x12')]['message']);return _0x997008(_0x7ded2c[_0x1bee('0x12')]['message']);}else{logger[_0x1bee('0x14')](_0x1bee('0xe'),_0x57f5fa,_0x1bee('0xf'));_0x997008(_0x7ded2c[_0x1bee('0x15')][_0x1bee('0x16')]);}})[_0x1bee('0x17')](function(_0x457b18){logger[_0x1bee('0x12')](_0x1bee('0xe'),_0x57f5fa,_0x457b18);_0x3bea69(_0x457b18);});});}exports[_0x1bee('0x18')]=function(_0x3e9773){var _0x2f207b=this;return new Promise(function(_0x128fab,_0x4e0754){return db['MailApplication'][_0x1bee('0x19')](_0x3e9773[_0x1bee('0x1a')],{'raw':_0x3e9773[_0x1bee('0x1b')]?_0x3e9773[_0x1bee('0x1b')][_0x1bee('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e9773[_0x1bee('0x1b')]?_0x3e9773[_0x1bee('0x1b')][_0x1bee('0x1d')]||null:null,'attributes':_0x3e9773['options']?_0x3e9773[_0x1bee('0x1b')][_0x1bee('0x1e')]||null:null,'limit':_0x3e9773['options']?_0x3e9773[_0x1bee('0x1b')]['limit']||null:null})[_0x1bee('0xd')](function(_0x5a7e45){logger[_0x1bee('0x14')]('UpdateMailApplication',_0x3e9773);logger[_0x1bee('0x10')]('UpdateMailApplication',_0x3e9773,JSON[_0x1bee('0x1f')](_0x5a7e45));_0x128fab(_0x5a7e45);})[_0x1bee('0x17')](function(_0x582791){logger['error']('UpdateMailApplication',_0x582791[_0x1bee('0x16')],_0x3e9773);_0x4e0754(_0x2f207b[_0x1bee('0x12')](0x1f4,_0x582791[_0x1bee('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 259fb04..1bc1cf4 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 _0x2aaf=['../../components/interaction/service','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','download','post','/:id/tags','mail','mailinteraction:addtags','put','tracked','mailinteraction:update','update','delete','/:id','destroy','removeTags','exports','express'];(function(_0x3390b8,_0x51d9f6){var _0x665271=function(_0x280a84){while(--_0x280a84){_0x3390b8['push'](_0x3390b8['shift']());}};_0x665271(++_0x51d9f6);}(_0x2aaf,0x113));var _0xf2aa=function(_0x3266b2,_0x597104){_0x3266b2=_0x3266b2-0x0;var _0x1c3bfc=_0x2aaf[_0x3266b2];return _0x1c3bfc;};'use strict';var express=require(_0xf2aa('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf2aa('0x1'));var controller=require('./mailInteraction.controller');router[_0xf2aa('0x2')]('/',auth[_0xf2aa('0x3')](),controller[_0xf2aa('0x4')]);router['get'](_0xf2aa('0x5'),auth['isAuthenticated'](),controller['describe']);router[_0xf2aa('0x2')]('/:id',auth[_0xf2aa('0x3')](),controller[_0xf2aa('0x6')]);router[_0xf2aa('0x2')](_0xf2aa('0x7'),auth[_0xf2aa('0x3')](),controller[_0xf2aa('0x8')]);router[_0xf2aa('0x2')]('/:id/download',auth[_0xf2aa('0x3')](),controller[_0xf2aa('0x9')]);router[_0xf2aa('0xa')]('/',auth[_0xf2aa('0x3')](),controller['create']);router[_0xf2aa('0xa')]('/:id/messages',auth[_0xf2aa('0x3')](),controller['addMessage']);router[_0xf2aa('0xa')](_0xf2aa('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0xf2aa('0xc'),_0xf2aa('0xd')),controller['addTags']);router[_0xf2aa('0xe')]('/:id',auth[_0xf2aa('0x3')](),interaction[_0xf2aa('0xf')](_0xf2aa('0xc'),_0xf2aa('0x10')),controller[_0xf2aa('0x11')]);router[_0xf2aa('0x12')](_0xf2aa('0x13'),auth[_0xf2aa('0x3')](),interaction['tracked'](_0xf2aa('0xc'),'mailinteraction:destroy'),controller[_0xf2aa('0x14')]);router['delete'](_0xf2aa('0xb'),auth[_0xf2aa('0x3')](),controller[_0xf2aa('0x15')]);module[_0xf2aa('0x16')]=router; \ No newline at end of file +var _0x1fd2=['isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','exports','Router','../../components/auth/service','./mailInteraction.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fd2,0x184));var _0x21fd=function(_0x193d23,_0x363b57){_0x193d23=_0x193d23-0x0;var _0x1fba37=_0x1fd2[_0x193d23];return _0x1fba37;};'use strict';var express=require('express');var router=express[_0x21fd('0x0')]();var auth=require(_0x21fd('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x21fd('0x2'));router[_0x21fd('0x3')]('/',auth[_0x21fd('0x4')](),controller[_0x21fd('0x5')]);router['get'](_0x21fd('0x6'),auth[_0x21fd('0x4')](),controller['describe']);router['get'](_0x21fd('0x7'),auth[_0x21fd('0x4')](),controller[_0x21fd('0x8')]);router['get'](_0x21fd('0x9'),auth[_0x21fd('0x4')](),controller[_0x21fd('0xa')]);router[_0x21fd('0x3')](_0x21fd('0xb'),auth[_0x21fd('0x4')](),controller[_0x21fd('0xc')]);router['post']('/',auth[_0x21fd('0x4')](),controller[_0x21fd('0xd')]);router[_0x21fd('0xe')]('/:id/messages',auth[_0x21fd('0x4')](),controller[_0x21fd('0xf')]);router[_0x21fd('0xe')](_0x21fd('0x10'),auth[_0x21fd('0x4')](),interaction[_0x21fd('0x11')](_0x21fd('0x12'),_0x21fd('0x13')),controller[_0x21fd('0x14')]);router[_0x21fd('0x15')](_0x21fd('0x7'),auth[_0x21fd('0x4')](),interaction[_0x21fd('0x11')](_0x21fd('0x12'),_0x21fd('0x16')),controller['update']);router[_0x21fd('0x17')](_0x21fd('0x7'),auth[_0x21fd('0x4')](),interaction[_0x21fd('0x11')](_0x21fd('0x12'),_0x21fd('0x18')),controller[_0x21fd('0x19')]);router['delete'](_0x21fd('0x10'),auth['isAuthenticated'](),controller[_0x21fd('0x1a')]);module[_0x21fd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index debaeb6..54c41de 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 _0xcb20=['out','iconv','exports','BOOLEAN','STRING','long','DATE','ENUM'];(function(_0x438ac4,_0x24a400){var _0x2f7f40=function(_0x2aff04){while(--_0x2aff04){_0x438ac4['push'](_0x438ac4['shift']());}};_0x2f7f40(++_0x24a400);}(_0xcb20,0x129));var _0x0cb2=function(_0x328f79,_0x1cc7b7){_0x328f79=_0x328f79-0x0;var _0x4bceff=_0xcb20[_0x328f79];return _0x4bceff;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x0cb2('0x0'));module[_0x0cb2('0x1')]={'closed':{'type':Sequelize[_0x0cb2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0cb2('0x3')]},'secondDisposition':{'type':Sequelize[_0x0cb2('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0cb2('0x3')]},'note':{'type':Sequelize[_0x0cb2('0x3')]},'inReplyTo':{'type':Sequelize[_0x0cb2('0x3')](0x1fe)},'to':{'type':Sequelize[_0x0cb2('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x0cb2('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x0cb2('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x0cb2('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x0cb2('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x0cb2('0x6')]('in',_0x0cb2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0cb2('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x0cb2('0x6')]('in',_0x0cb2('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0cb2('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa2d7=['BOOLEAN','sequelize','iconv','exports','STRING','TEXT','long','DATE','out'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0xa2d7,0x1ba));var _0x7a2d=function(_0x4a4230,_0x42dbb2){_0x4a4230=_0x4a4230-0x0;var _0x4c3062=_0xa2d7[_0x4a4230];return _0x4c3062;};'use strict';var Sequelize=require(_0x7a2d('0x0'));var iconv=require(_0x7a2d('0x1'));module[_0x7a2d('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7a2d('0x3')]},'secondDisposition':{'type':Sequelize[_0x7a2d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7a2d('0x3')]},'note':{'type':Sequelize[_0x7a2d('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x7a2d('0x3')]},'cc':{'type':Sequelize[_0x7a2d('0x4')](_0x7a2d('0x5'))},'subject':{'type':Sequelize[_0x7a2d('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7a2d('0x6')]},'substatus':{'type':Sequelize[_0x7a2d('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x7a2d('0x6')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7a2d('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7a2d('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 252ca94..acb7ab9 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 _0x6477=['redis','localhost','socket.io-emitter','./mailInteraction.socket','status','json','undefined','limit','count','offset','set','update','then','end','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','catch','show','params','keys','filters','model','attributes','intersection','fields','length','includeAll','include','find','create','body','destroy','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','where','pick','MailInteractionId','filter','$gte','split','format','merge','options','inlineCss','true','rows','addTags','spread','Tag','color','mailInteractionTags:save','removeTags','download','toString','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','push','Attachments','Messages','from','bcc','subject','createdAt','sort','get','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','eml-format','zip-dir','bluebird','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x6477,0xd7));var _0x7647=function(_0x46b832,_0x454e18){_0x46b832=_0x46b832-0x0;var _0x42b328=_0x6477[_0x46b832];return _0x42b328;};'use strict';var emlformat=require(_0x7647('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7647('0x1'));var moment=require('moment');var BPromise=require(_0x7647('0x2'));var util=require(_0x7647('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x7647('0x4'));var juice=require(_0x7647('0x5'));var Redis=require(_0x7647('0x6'));var interaction=require(_0x7647('0x7'));var qs=require(_0x7647('0x8'));var logger=require(_0x7647('0x9'))(_0x7647('0xa'));var config=require(_0x7647('0xb'));var db=require(_0x7647('0xc'))['db'];var htmlEntities=require(_0x7647('0xd'));config['redis']=_[_0x7647('0xe')](config[_0x7647('0xf')],{'host':_0x7647('0x10'),'port':0x18eb});var socket=require(_0x7647('0x11'))(new Redis(config[_0x7647('0xf')]));require(_0x7647('0x12'))['register'](socket);function respondWithStatusCode(_0x134f95,_0x27a771){_0x27a771=_0x27a771||0xcc;return function(_0x59528c){if(_0x59528c){return _0x134f95['sendStatus'](_0x27a771);}return _0x134f95['status'](_0x27a771)['end']();};}function respondWithResult(_0x1d3d3e,_0x1f526b){_0x1f526b=_0x1f526b||0xc8;return function(_0x50a667){if(_0x50a667){return _0x1d3d3e[_0x7647('0x13')](_0x1f526b)[_0x7647('0x14')](_0x50a667);}};}function respondWithFilteredResult(_0x49f097,_0x15ab03){return function(_0x13a50b){if(_0x13a50b){var _0x192383=typeof _0x15ab03['offset']===_0x7647('0x15')&&typeof _0x15ab03[_0x7647('0x16')]===_0x7647('0x15');var _0x13c354=_0x13a50b[_0x7647('0x17')];var _0x420aa2=_0x192383?0x0:_0x15ab03[_0x7647('0x18')];var _0x13167a=_0x192383?_0x13a50b[_0x7647('0x17')]:_0x15ab03[_0x7647('0x18')]+_0x15ab03[_0x7647('0x16')];var _0x5ad5b9;if(_0x13167a>=_0x13c354){_0x13167a=_0x13c354;_0x5ad5b9=0xc8;}else{_0x5ad5b9=0xce;}_0x49f097[_0x7647('0x13')](_0x5ad5b9);return _0x49f097[_0x7647('0x19')]('Content-Range',_0x420aa2+'-'+_0x13167a+'/'+_0x13c354)['json'](_0x13a50b);}return null;};}function saveUpdates(_0x3285f3){return function(_0x36932f){if(_0x36932f){return _0x36932f[_0x7647('0x1a')](_0x3285f3)[_0x7647('0x1b')](function(_0x4298b8){return _0x4298b8;});}return null;};}function removeEntity(_0x505af8){return function(_0xabd6cb){if(_0xabd6cb){return _0xabd6cb['destroy']()['then'](function(){_0x505af8[_0x7647('0x13')](0xcc)[_0x7647('0x1c')]();});}};}function handleEntityNotFound(_0x39b547){return function(_0x567893){if(!_0x567893){_0x39b547['sendStatus'](0x194);}return _0x567893;};}function handleError(_0xfe1c28,_0x3da956){_0x3da956=_0x3da956||0x1f4;return function(_0x501a03){logger['error'](_0x501a03['stack']);if(_0x501a03[_0x7647('0x1d')]){delete _0x501a03[_0x7647('0x1d')];}_0xfe1c28[_0x7647('0x13')](_0x3da956)[_0x7647('0x1e')](_0x501a03);};}exports[_0x7647('0x1f')]=function(_0xad519d,_0x3c17d1){var _0x5221e8={};var _0x284264=_[_0x7647('0x20')](db[_0x7647('0x21')][_0x7647('0x22')],function(_0x4b2930){return{'name':_0x4b2930[_0x7647('0x23')],'type':_0x4b2930[_0x7647('0x24')][_0x7647('0x25')]};});_0x5221e8=qs[_0x7647('0x26')](_0x284264,_0xad519d);return interaction[_0x7647('0x27')](_0x7647('0x28'),_0xad519d[_0x7647('0x29')],_0xad519d[_0x7647('0x2a')],_0x5221e8,_0x284264)['then'](respondWithFilteredResult(_0x3c17d1,_0x5221e8))[_0x7647('0x2b')](handleError(_0x3c17d1,null));};exports[_0x7647('0x2c')]=function(_0x2e9965,_0x44fd5b){var _0x293919={'raw':![],'where':{'id':_0x2e9965[_0x7647('0x2d')]['id']}},_0x50e443={};_0x50e443['model']=_[_0x7647('0x2e')](db[_0x7647('0x21')][_0x7647('0x22')]);_0x50e443['query']=_[_0x7647('0x2e')](_0x2e9965[_0x7647('0x29')]);_0x50e443[_0x7647('0x2f')]=_['intersection'](_0x50e443[_0x7647('0x30')],_0x50e443[_0x7647('0x29')]);_0x293919[_0x7647('0x31')]=_[_0x7647('0x32')](_0x50e443['model'],qs[_0x7647('0x33')](_0x2e9965['query'][_0x7647('0x33')]));_0x293919['attributes']=_0x293919['attributes'][_0x7647('0x34')]?_0x293919['attributes']:_0x50e443['model'];if(_0x2e9965[_0x7647('0x29')][_0x7647('0x35')]){_0x293919[_0x7647('0x36')]=[{'all':!![]}];}_0x293919=_['merge']({},_0x293919,_0x2e9965['options']);return db[_0x7647('0x21')][_0x7647('0x37')](_0x293919)['then'](handleEntityNotFound(_0x44fd5b,null))[_0x7647('0x1b')](respondWithResult(_0x44fd5b,null))['catch'](handleError(_0x44fd5b,null));};exports['create']=function(_0x2c7837,_0x106db5){return db[_0x7647('0x21')][_0x7647('0x38')](_0x2c7837[_0x7647('0x39')],{})['then'](respondWithResult(_0x106db5,0xc9))[_0x7647('0x2b')](handleError(_0x106db5,null));};exports['update']=function(_0x5bd48b,_0x3e275f){if(_0x5bd48b[_0x7647('0x39')]['id']){delete _0x5bd48b[_0x7647('0x39')]['id'];}return db[_0x7647('0x21')][_0x7647('0x37')]({'where':{'id':_0x5bd48b['params']['id']}})[_0x7647('0x1b')](handleEntityNotFound(_0x3e275f,null))[_0x7647('0x1b')](saveUpdates(_0x5bd48b[_0x7647('0x39')],null))[_0x7647('0x1b')](respondWithResult(_0x3e275f,null))['catch'](handleError(_0x3e275f,null));};exports[_0x7647('0x3a')]=function(_0x4fe1b9,_0x10dc05){return db[_0x7647('0x21')][_0x7647('0x37')]({'where':{'id':_0x4fe1b9[_0x7647('0x2d')]['id']}})[_0x7647('0x1b')](handleEntityNotFound(_0x10dc05,null))[_0x7647('0x1b')](removeEntity(_0x10dc05,null))[_0x7647('0x2b')](handleError(_0x10dc05,null));};exports['describe']=function(_0x46ac93,_0xc7c6a1){return db['MailInteraction']['describe']()[_0x7647('0x1b')](respondWithResult(_0xc7c6a1,null))[_0x7647('0x2b')](handleError(_0xc7c6a1,null));};exports[_0x7647('0x3b')]=function(_0x2223fe,_0x139887){return db[_0x7647('0x3c')]['find']({'where':{'id':_0x2223fe[_0x7647('0x2d')]['id']}})['then'](handleEntityNotFound(_0x139887,null))[_0x7647('0x1b')](function(_0x61a516){if(_0x61a516){return _0x61a516[_0x7647('0x3b')](_0x2223fe['body'][_0x7647('0x3d')],_[_0x7647('0x3e')](_0x2223fe[_0x7647('0x39')],[_0x7647('0x3d'),'id'])||{});}})[_0x7647('0x1b')](respondWithResult(_0x139887,null))[_0x7647('0x2b')](handleError(_0x139887,null));};exports[_0x7647('0x3f')]=function(_0x4f25ad,_0x40b762){var _0x11ab55={'raw':![],'where':{}};var _0x3adeda={};var _0x3d79fb={'count':0x0,'rows':[]};return db[_0x7647('0x21')][_0x7647('0x40')]({'where':{'id':_0x4f25ad[_0x7647('0x2d')]['id']}})[_0x7647('0x1b')](handleEntityNotFound(_0x40b762,null))[_0x7647('0x1b')](function(_0x3d21b1){if(_0x3d21b1){_0x3adeda[_0x7647('0x30')]=_[_0x7647('0x2e')](db['MailMessage'][_0x7647('0x22')]);_0x3adeda[_0x7647('0x29')]=_['keys'](_0x4f25ad[_0x7647('0x29')]);_0x3adeda['filters']=_[_0x7647('0x32')](_0x3adeda[_0x7647('0x30')],_0x3adeda[_0x7647('0x29')]);_0x11ab55[_0x7647('0x31')]=_['intersection'](_0x3adeda['model'],qs[_0x7647('0x33')](_0x4f25ad[_0x7647('0x29')][_0x7647('0x33')]));_0x11ab55[_0x7647('0x31')]=_0x11ab55[_0x7647('0x31')][_0x7647('0x34')]?_0x11ab55[_0x7647('0x31')]:_0x3adeda[_0x7647('0x30')];if(!_0x4f25ad[_0x7647('0x29')][_0x7647('0x41')](_0x7647('0x42'))){_0x11ab55[_0x7647('0x16')]=qs[_0x7647('0x16')](_0x4f25ad['query']['limit']);_0x11ab55[_0x7647('0x18')]=qs[_0x7647('0x18')](_0x4f25ad[_0x7647('0x29')][_0x7647('0x18')]);}_0x11ab55[_0x7647('0x43')]=qs['sort'](_0x4f25ad[_0x7647('0x29')]['sort']);_0x11ab55[_0x7647('0x44')]=qs[_0x7647('0x2f')](_[_0x7647('0x45')](_0x4f25ad[_0x7647('0x29')],_0x3adeda[_0x7647('0x2f')]));_0x11ab55[_0x7647('0x44')][_0x7647('0x46')]=_0x3d21b1['id'];if(_0x4f25ad['query'][_0x7647('0x47')]){_0x11ab55['where']=_['merge'](_0x11ab55[_0x7647('0x44')],{'$or':_['map'](_0x11ab55[_0x7647('0x31')],function(_0x5eaf37){var _0x123d5b={};_0x123d5b[_0x5eaf37]={'$like':'%'+_0x4f25ad[_0x7647('0x29')][_0x7647('0x47')]+'%'};return _0x123d5b;})});}if(_0x4f25ad[_0x7647('0x29')][_0x7647('0x48')]){var _0x2725fd=_0x4f25ad[_0x7647('0x29')][_0x7647('0x48')][_0x7647('0x49')](',');var _0x2b7873={};_0x2b7873[_0x2725fd[0x0]]={'$gte':moment(_0x2725fd[0x1])[_0x7647('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x11ab55['where']=_[_0x7647('0x4b')](_0x11ab55[_0x7647('0x44')],_0x2b7873);}_0x11ab55=_[_0x7647('0x4b')]({},_0x11ab55,_0x4f25ad[_0x7647('0x4c')]);return db[_0x7647('0x3c')][_0x7647('0x17')]({'where':_0x11ab55[_0x7647('0x44')]})['then'](function(_0xd53b25){_0x3d79fb['count']=_0xd53b25;if(_0x4f25ad['query'][_0x7647('0x35')]){_0x11ab55[_0x7647('0x36')]=[{'all':!![]}];}return db[_0x7647('0x3c')]['findAll'](_0x11ab55);})[_0x7647('0x1b')](function(_0x41aee1){if(_0x4f25ad[_0x7647('0x29')][_0x7647('0x4d')]===_0x7647('0x4e')){for(var _0x16dd52=0x0;_0x16dd52<_0x41aee1['length'];_0x16dd52++){_0x41aee1[_0x16dd52][_0x7647('0x39')]=juice(_0x41aee1[_0x16dd52][_0x7647('0x39')]);}}_0x3d79fb[_0x7647('0x4f')]=_0x41aee1;return _0x3d79fb;});}})[_0x7647('0x1b')](respondWithFilteredResult(_0x40b762,_0x11ab55))[_0x7647('0x2b')](handleError(_0x40b762,null));};exports[_0x7647('0x50')]=function(_0x52bdaa,_0x4c9d7d){return db[_0x7647('0x21')][_0x7647('0x37')]({'where':{'id':_0x52bdaa[_0x7647('0x2d')]['id']}})[_0x7647('0x1b')](handleEntityNotFound(_0x4c9d7d,null))[_0x7647('0x1b')](function(_0x23fb0f){if(_0x23fb0f){return _0x23fb0f['setTags'](_0x52bdaa[_0x7647('0x39')][_0x7647('0x3d')],_[_0x7647('0x3e')](_0x52bdaa[_0x7647('0x39')],[_0x7647('0x3d'),'id'])||{})[_0x7647('0x51')](function(){return db[_0x7647('0x52')][_0x7647('0x27')]({'attributes':['id',_0x7647('0x1d'),_0x7647('0x53')],'where':{'id':_0x52bdaa[_0x7647('0x39')][_0x7647('0x3d')]}});})['then'](function(_0x3cf617){socket['emit'](_0x7647('0x54'),{'id':Number(_0x52bdaa[_0x7647('0x2d')]['id']),'tags':_0x3cf617||[]});return{'id':Number(_0x52bdaa['params']['id']),'tags':_0x3cf617||[]};});}})[_0x7647('0x1b')](respondWithResult(_0x4c9d7d,null))[_0x7647('0x2b')](handleError(_0x4c9d7d,null));};exports[_0x7647('0x55')]=function(_0x4c858e,_0x4e265f){return db[_0x7647('0x21')][_0x7647('0x37')]({'where':{'id':_0x4c858e[_0x7647('0x2d')]['id']}})[_0x7647('0x1b')](handleEntityNotFound(_0x4e265f,null))[_0x7647('0x1b')](function(_0x19bcdd){if(_0x19bcdd){return _0x19bcdd[_0x7647('0x55')](_0x4c858e[_0x7647('0x29')][_0x7647('0x3d')]);}})['then'](respondWithStatusCode(_0x4e265f,null))[_0x7647('0x2b')](handleError(_0x4e265f,null));};exports[_0x7647('0x56')]=function(_0x47ee5f,_0x1510dc){var _0x29048b=moment()['unix']()[_0x7647('0x57')]();var _0x4d55e7=path['join'](config['root'],_0x7647('0x58'),_0x7647('0x59'),_0x7647('0x5a'));var _0x2f76eb=path[_0x7647('0x5b')](config[_0x7647('0x5c')],'server','files',_0x7647('0x5d'));var _0x2f9524=path[_0x7647('0x5b')](_0x4d55e7,_0x29048b);var _0x19d53f=util[_0x7647('0x4a')](_0x7647('0x5e'),_0x47ee5f[_0x7647('0x2d')]['id'],_0x29048b);var _0x29832d=path[_0x7647('0x5b')](_0x4d55e7,_0x19d53f);var _0x4b17bf=[];if(_0x47ee5f[_0x7647('0x29')][_0x7647('0x5d')]){_0x4b17bf[_0x7647('0x5f')]({'model':db['Attachment'],'as':_0x7647('0x60'),'raw':!![]});}var _0x1406a9=[{'model':db['MailMessage'],'as':_0x7647('0x61'),'attributes':['id',_0x7647('0x39'),_0x7647('0x62'),'to','cc',_0x7647('0x63'),_0x7647('0x64'),_0x7647('0x65')],'where':{'secret':![]},'order':qs[_0x7647('0x66')]('id'),'include':_0x4b17bf}];return db[_0x7647('0x21')][_0x7647('0x37')]({'where':{'id':_0x47ee5f['params']['id']},'include':_0x1406a9})['then'](handleEntityNotFound(_0x1510dc,null))[_0x7647('0x1b')](function(_0x579c69){if(_0x579c69&&_0x579c69['Messages']){var _0x571ae6=_0x579c69[_0x7647('0x67')]({'plain':!![]});fs[_0x7647('0x68')](_0x2f9524);return BPromise[_0x7647('0x69')](_0x571ae6[_0x7647('0x61')],function(_0x5eba3f,_0x48a969){var _0x1aff37={'from':_0x5eba3f[_0x7647('0x62')],'to':_0x5eba3f['to']||_0x7647('0x6a'),'subject':_0x5eba3f['subject'],'html':htmlEntities['decode'](_0x5eba3f[_0x7647('0x39')]),'headers':{'Date':moment(_0x5eba3f[_0x7647('0x65')])[_0x7647('0x4a')](_0x7647('0x6b'))},'attachments':[]};if(_0x5eba3f['cc']){_0x1aff37[_0x7647('0x6c')]['Cc']=_0x5eba3f['cc'];}if(_0x5eba3f[_0x7647('0x63')]){_0x1aff37[_0x7647('0x6c')]['Bcc']=_0x5eba3f[_0x7647('0x63')];}return new BPromise(function(_0x306c9c,_0x41c84a){if(_0x5eba3f[_0x7647('0x60')]){for(var _0x1d0d17=0x0;_0x1d0d17<_0x5eba3f[_0x7647('0x60')][_0x7647('0x34')];_0x1d0d17++){var _0x435454=_0x5eba3f[_0x7647('0x60')][_0x1d0d17];var _0x2d2e3d=path['join'](_0x2f76eb,_0x435454[_0x7647('0x6d')]);if(fs[_0x7647('0x6e')](_0x2d2e3d)){_0x1aff37['attachments'][_0x7647('0x5f')]({'name':_0x435454[_0x7647('0x1d')],'contentType':_0x435454['type'],'data':fs[_0x7647('0x6f')](_0x2d2e3d)});}}}emlformat[_0x7647('0x70')](_0x1aff37,function(_0x595a13,_0x128721){if(_0x595a13)return _0x41c84a(_0x595a13);fs[_0x7647('0x71')](path[_0x7647('0x5b')](_0x2f9524,util[_0x7647('0x4a')](_0x7647('0x72'),_0x48a969)),_0x128721);return _0x306c9c(_0x128721);});});})[_0x7647('0x1b')](function(){return new BPromise(function(_0x2a8ba5,_0x2cad9d){zipdir(_0x2f9524,{'saveTo':_0x29832d},function(_0x4fa47f,_0x2f7a7e){if(_0x4fa47f)return _0x2cad9d(_0x4fa47f);return _0x2a8ba5(_0x2f7a7e);});})[_0x7647('0x1b')](function(){return new BPromise(function(_0x43b5f5,_0x11cbcb){rimraf(_0x2f9524,function(_0x5593ed){if(_0x5593ed)_0x11cbcb(_0x5593ed);return _0x43b5f5();});});})[_0x7647('0x1b')](function(){return _0x1510dc['download'](_0x29832d,_0x19d53f,function(_0x37f6ef){if(!_0x37f6ef)fs['unlinkSync'](_0x29832d);});});});}else{return _0x1510dc['sendStatus'](0xc8);}})[_0x7647('0x2b')](handleError(_0x1510dc,null));}; \ No newline at end of file +var _0xfdef=['message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','catch','show','model','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','update','body','find','params','describe','addMessage','MailMessage','ids','omit','findOne','keys','hasOwnProperty','order','sort','where','MailInteractionId','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','rows','addTags','Tag','emit','mailInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','push','Attachment','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0xfdef,0xee));var _0xffde=function(_0x107ffe,_0x26df15){_0x107ffe=_0x107ffe-0x0;var _0x4b2ec2=_0xfdef[_0x107ffe];return _0x4b2ec2;};'use strict';var emlformat=require(_0xffde('0x0'));var rimraf=require(_0xffde('0x1'));var zipdir=require(_0xffde('0x2'));var moment=require(_0xffde('0x3'));var BPromise=require('bluebird');var util=require(_0xffde('0x4'));var path=require(_0xffde('0x5'));var fs=require('fs');var _=require(_0xffde('0x6'));var juice=require(_0xffde('0x7'));var Redis=require(_0xffde('0x8'));var interaction=require(_0xffde('0x9'));var qs=require(_0xffde('0xa'));var logger=require(_0xffde('0xb'))(_0xffde('0xc'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xffde('0xd'));config['redis']=_[_0xffde('0xe')](config[_0xffde('0xf')],{'host':_0xffde('0x10'),'port':0x18eb});var socket=require(_0xffde('0x11'))(new Redis(config[_0xffde('0xf')]));require(_0xffde('0x12'))[_0xffde('0x13')](socket);function respondWithStatusCode(_0xae6f22,_0x126f88){_0x126f88=_0x126f88||0xcc;return function(_0x1f45fb){if(_0x1f45fb){return _0xae6f22[_0xffde('0x14')](_0x126f88);}return _0xae6f22[_0xffde('0x15')](_0x126f88)[_0xffde('0x16')]();};}function respondWithResult(_0xf07658,_0x2ad81f){_0x2ad81f=_0x2ad81f||0xc8;return function(_0x28a99b){if(_0x28a99b){return _0xf07658[_0xffde('0x15')](_0x2ad81f)[_0xffde('0x17')](_0x28a99b);}};}function respondWithFilteredResult(_0x5f0cfc,_0x486b1b){return function(_0x133448){if(_0x133448){var _0x4cf7bd=typeof _0x486b1b[_0xffde('0x18')]===_0xffde('0x19')&&typeof _0x486b1b[_0xffde('0x1a')]===_0xffde('0x19');var _0x3cfe13=_0x133448['count'];var _0x5a6f7b=_0x4cf7bd?0x0:_0x486b1b[_0xffde('0x18')];var _0xdbd245=_0x4cf7bd?_0x133448[_0xffde('0x1b')]:_0x486b1b[_0xffde('0x18')]+_0x486b1b[_0xffde('0x1a')];var _0x382fcd;if(_0xdbd245>=_0x3cfe13){_0xdbd245=_0x3cfe13;_0x382fcd=0xc8;}else{_0x382fcd=0xce;}_0x5f0cfc[_0xffde('0x15')](_0x382fcd);return _0x5f0cfc[_0xffde('0x1c')](_0xffde('0x1d'),_0x5a6f7b+'-'+_0xdbd245+'/'+_0x3cfe13)[_0xffde('0x17')](_0x133448);}return null;};}function saveUpdates(_0x3cf4d7){return function(_0xce657e){if(_0xce657e){return _0xce657e['update'](_0x3cf4d7)['then'](function(_0x10c83a){return _0x10c83a;});}return null;};}function removeEntity(_0x532f1a){return function(_0x3cba89){if(_0x3cba89){return _0x3cba89[_0xffde('0x1e')]()[_0xffde('0x1f')](function(){_0x532f1a['status'](0xcc)[_0xffde('0x16')]();});}};}function handleEntityNotFound(_0x1bdd91){return function(_0x2e5eb7){if(!_0x2e5eb7){_0x1bdd91[_0xffde('0x14')](0x194);}return _0x2e5eb7;};}function handleError(_0x3d18c5,_0x4363c3){_0x4363c3=_0x4363c3||0x1f4;return function(_0x289cf0){logger[_0xffde('0x20')](_0x289cf0[_0xffde('0x21')]);if(_0x289cf0['name']){delete _0x289cf0[_0xffde('0x22')];}_0x3d18c5[_0xffde('0x15')](_0x4363c3)[_0xffde('0x23')](_0x289cf0);};}exports[_0xffde('0x24')]=function(_0x23a952,_0x45792b){var _0x845b9e={};var _0x474fa9=_[_0xffde('0x25')](db[_0xffde('0x26')][_0xffde('0x27')],function(_0x489106){return{'name':_0x489106[_0xffde('0x28')],'type':_0x489106[_0xffde('0x29')][_0xffde('0x2a')]};});_0x845b9e=qs[_0xffde('0x2b')](_0x474fa9,_0x23a952);return interaction[_0xffde('0x2c')](_0xffde('0x2d'),_0x23a952[_0xffde('0x2e')],_0x23a952[_0xffde('0x2f')],_0x845b9e,_0x474fa9)[_0xffde('0x1f')](respondWithFilteredResult(_0x45792b,_0x845b9e))[_0xffde('0x30')](handleError(_0x45792b,null));};exports[_0xffde('0x31')]=function(_0x3e29a4,_0x4199b4){var _0x5993f5={'raw':![],'where':{'id':_0x3e29a4['params']['id']}},_0x597a89={};_0x597a89[_0xffde('0x32')]=_['keys'](db[_0xffde('0x26')][_0xffde('0x27')]);_0x597a89['query']=_['keys'](_0x3e29a4['query']);_0x597a89[_0xffde('0x33')]=_[_0xffde('0x34')](_0x597a89['model'],_0x597a89[_0xffde('0x2e')]);_0x5993f5[_0xffde('0x35')]=_[_0xffde('0x34')](_0x597a89[_0xffde('0x32')],qs[_0xffde('0x36')](_0x3e29a4[_0xffde('0x2e')][_0xffde('0x36')]));_0x5993f5[_0xffde('0x35')]=_0x5993f5[_0xffde('0x35')][_0xffde('0x37')]?_0x5993f5[_0xffde('0x35')]:_0x597a89[_0xffde('0x32')];if(_0x3e29a4[_0xffde('0x2e')][_0xffde('0x38')]){_0x5993f5[_0xffde('0x39')]=[{'all':!![]}];}_0x5993f5=_[_0xffde('0x3a')]({},_0x5993f5,_0x3e29a4[_0xffde('0x3b')]);return db[_0xffde('0x26')]['find'](_0x5993f5)['then'](handleEntityNotFound(_0x4199b4,null))[_0xffde('0x1f')](respondWithResult(_0x4199b4,null))['catch'](handleError(_0x4199b4,null));};exports[_0xffde('0x3c')]=function(_0x132d55,_0x4604f3){return db[_0xffde('0x26')][_0xffde('0x3c')](_0x132d55['body'],{})[_0xffde('0x1f')](respondWithResult(_0x4604f3,0xc9))[_0xffde('0x30')](handleError(_0x4604f3,null));};exports[_0xffde('0x3d')]=function(_0x3e63c6,_0xd19335){if(_0x3e63c6[_0xffde('0x3e')]['id']){delete _0x3e63c6['body']['id'];}return db[_0xffde('0x26')][_0xffde('0x3f')]({'where':{'id':_0x3e63c6[_0xffde('0x40')]['id']}})[_0xffde('0x1f')](handleEntityNotFound(_0xd19335,null))[_0xffde('0x1f')](saveUpdates(_0x3e63c6[_0xffde('0x3e')],null))['then'](respondWithResult(_0xd19335,null))[_0xffde('0x30')](handleError(_0xd19335,null));};exports[_0xffde('0x1e')]=function(_0x39386d,_0x39907f){return db[_0xffde('0x26')][_0xffde('0x3f')]({'where':{'id':_0x39386d[_0xffde('0x40')]['id']}})['then'](handleEntityNotFound(_0x39907f,null))[_0xffde('0x1f')](removeEntity(_0x39907f,null))[_0xffde('0x30')](handleError(_0x39907f,null));};exports[_0xffde('0x41')]=function(_0x56945b,_0x46f31f){return db[_0xffde('0x26')][_0xffde('0x41')]()[_0xffde('0x1f')](respondWithResult(_0x46f31f,null))[_0xffde('0x30')](handleError(_0x46f31f,null));};exports[_0xffde('0x42')]=function(_0x9fdba9,_0x39107d){return db[_0xffde('0x43')][_0xffde('0x3f')]({'where':{'id':_0x9fdba9['params']['id']}})[_0xffde('0x1f')](handleEntityNotFound(_0x39107d,null))['then'](function(_0x5eed26){if(_0x5eed26){return _0x5eed26[_0xffde('0x42')](_0x9fdba9[_0xffde('0x3e')][_0xffde('0x44')],_[_0xffde('0x45')](_0x9fdba9[_0xffde('0x3e')],[_0xffde('0x44'),'id'])||{});}})[_0xffde('0x1f')](respondWithResult(_0x39107d,null))[_0xffde('0x30')](handleError(_0x39107d,null));};exports['getMessages']=function(_0x29efc6,_0x59ae6d){var _0x269b7b={'raw':![],'where':{}};var _0x56a2e3={};var _0x42605a={'count':0x0,'rows':[]};return db[_0xffde('0x26')][_0xffde('0x46')]({'where':{'id':_0x29efc6[_0xffde('0x40')]['id']}})[_0xffde('0x1f')](handleEntityNotFound(_0x59ae6d,null))[_0xffde('0x1f')](function(_0x2f7ab5){if(_0x2f7ab5){_0x56a2e3[_0xffde('0x32')]=_[_0xffde('0x47')](db[_0xffde('0x43')]['rawAttributes']);_0x56a2e3['query']=_['keys'](_0x29efc6['query']);_0x56a2e3[_0xffde('0x33')]=_['intersection'](_0x56a2e3[_0xffde('0x32')],_0x56a2e3[_0xffde('0x2e')]);_0x269b7b['attributes']=_[_0xffde('0x34')](_0x56a2e3[_0xffde('0x32')],qs['fields'](_0x29efc6[_0xffde('0x2e')][_0xffde('0x36')]));_0x269b7b[_0xffde('0x35')]=_0x269b7b[_0xffde('0x35')]['length']?_0x269b7b[_0xffde('0x35')]:_0x56a2e3['model'];if(!_0x29efc6['query'][_0xffde('0x48')]('nolimit')){_0x269b7b[_0xffde('0x1a')]=qs['limit'](_0x29efc6[_0xffde('0x2e')][_0xffde('0x1a')]);_0x269b7b[_0xffde('0x18')]=qs['offset'](_0x29efc6[_0xffde('0x2e')][_0xffde('0x18')]);}_0x269b7b[_0xffde('0x49')]=qs[_0xffde('0x4a')](_0x29efc6[_0xffde('0x2e')][_0xffde('0x4a')]);_0x269b7b[_0xffde('0x4b')]=qs[_0xffde('0x33')](_['pick'](_0x29efc6[_0xffde('0x2e')],_0x56a2e3['filters']));_0x269b7b[_0xffde('0x4b')][_0xffde('0x4c')]=_0x2f7ab5['id'];if(_0x29efc6[_0xffde('0x2e')][_0xffde('0x4d')]){_0x269b7b[_0xffde('0x4b')]=_[_0xffde('0x3a')](_0x269b7b[_0xffde('0x4b')],{'$or':_[_0xffde('0x25')](_0x269b7b['attributes'],function(_0x1cbc7a){var _0x32759f={};_0x32759f[_0x1cbc7a]={'$like':'%'+_0x29efc6[_0xffde('0x2e')][_0xffde('0x4d')]+'%'};return _0x32759f;})});}if(_0x29efc6[_0xffde('0x2e')]['$gte']){var _0x79957e=_0x29efc6[_0xffde('0x2e')]['$gte'][_0xffde('0x4e')](',');var _0x4c939f={};_0x4c939f[_0x79957e[0x0]]={'$gte':moment(_0x79957e[0x1])[_0xffde('0x4f')](_0xffde('0x50'))};_0x269b7b[_0xffde('0x4b')]=_[_0xffde('0x3a')](_0x269b7b['where'],_0x4c939f);}_0x269b7b=_[_0xffde('0x3a')]({},_0x269b7b,_0x29efc6[_0xffde('0x3b')]);return db['MailMessage']['count']({'where':_0x269b7b['where']})[_0xffde('0x1f')](function(_0x1a2d6b){_0x42605a[_0xffde('0x1b')]=_0x1a2d6b;if(_0x29efc6[_0xffde('0x2e')]['includeAll']){_0x269b7b['include']=[{'all':!![]}];}return db[_0xffde('0x43')][_0xffde('0x2c')](_0x269b7b);})[_0xffde('0x1f')](function(_0x3206a8){if(_0x29efc6[_0xffde('0x2e')][_0xffde('0x51')]==='true'){for(var _0x3a98be=0x0;_0x3a98be<_0x3206a8[_0xffde('0x37')];_0x3a98be++){_0x3206a8[_0x3a98be][_0xffde('0x3e')]=juice(_0x3206a8[_0x3a98be]['body']);}}_0x42605a[_0xffde('0x52')]=_0x3206a8;return _0x42605a;});}})[_0xffde('0x1f')](respondWithFilteredResult(_0x59ae6d,_0x269b7b))[_0xffde('0x30')](handleError(_0x59ae6d,null));};exports[_0xffde('0x53')]=function(_0x5bc209,_0x3ac2f6){return db['MailInteraction'][_0xffde('0x3f')]({'where':{'id':_0x5bc209[_0xffde('0x40')]['id']}})[_0xffde('0x1f')](handleEntityNotFound(_0x3ac2f6,null))['then'](function(_0xec4bf4){if(_0xec4bf4){return _0xec4bf4['setTags'](_0x5bc209[_0xffde('0x3e')][_0xffde('0x44')],_['omit'](_0x5bc209['body'],['ids','id'])||{})['spread'](function(){return db[_0xffde('0x54')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x5bc209[_0xffde('0x3e')][_0xffde('0x44')]}});})[_0xffde('0x1f')](function(_0x233db9){socket[_0xffde('0x55')](_0xffde('0x56'),{'id':Number(_0x5bc209['params']['id']),'tags':_0x233db9||[]});return{'id':Number(_0x5bc209[_0xffde('0x40')]['id']),'tags':_0x233db9||[]};});}})[_0xffde('0x1f')](respondWithResult(_0x3ac2f6,null))[_0xffde('0x30')](handleError(_0x3ac2f6,null));};exports[_0xffde('0x57')]=function(_0x236bd9,_0x105a2d){return db[_0xffde('0x26')][_0xffde('0x3f')]({'where':{'id':_0x236bd9[_0xffde('0x40')]['id']}})[_0xffde('0x1f')](handleEntityNotFound(_0x105a2d,null))[_0xffde('0x1f')](function(_0x558468){if(_0x558468){return _0x558468[_0xffde('0x57')](_0x236bd9[_0xffde('0x2e')][_0xffde('0x44')]);}})['then'](respondWithStatusCode(_0x105a2d,null))[_0xffde('0x30')](handleError(_0x105a2d,null));};exports[_0xffde('0x58')]=function(_0x22ae19,_0xba4ac7){var _0x4c9b84=moment()['unix']()[_0xffde('0x59')]();var _0x1bd341=path[_0xffde('0x5a')](config[_0xffde('0x5b')],_0xffde('0x5c'),_0xffde('0x5d'),_0xffde('0x5e'));var _0x29ffc7=path[_0xffde('0x5a')](config['root'],_0xffde('0x5c'),_0xffde('0x5d'),_0xffde('0x5f'));var _0x5cdee5=path['join'](_0x1bd341,_0x4c9b84);var _0x1a1adc=util['format']('transcript-%d-%s.zip',_0x22ae19[_0xffde('0x40')]['id'],_0x4c9b84);var _0x214bf8=path[_0xffde('0x5a')](_0x1bd341,_0x1a1adc);var _0x222e79=[];if(_0x22ae19[_0xffde('0x2e')][_0xffde('0x5f')]){_0x222e79[_0xffde('0x60')]({'model':db[_0xffde('0x61')],'as':'Attachments','raw':!![]});}var _0x5a248c=[{'model':db['MailMessage'],'as':_0xffde('0x62'),'attributes':['id','body',_0xffde('0x63'),'to','cc',_0xffde('0x64'),_0xffde('0x65'),_0xffde('0x66')],'where':{'secret':![]},'order':qs[_0xffde('0x4a')]('id'),'include':_0x222e79}];return db['MailInteraction'][_0xffde('0x3f')]({'where':{'id':_0x22ae19['params']['id']},'include':_0x5a248c})[_0xffde('0x1f')](handleEntityNotFound(_0xba4ac7,null))['then'](function(_0x52a79d){if(_0x52a79d&&_0x52a79d[_0xffde('0x62')]){var _0x3b8432=_0x52a79d[_0xffde('0x67')]({'plain':!![]});fs[_0xffde('0x68')](_0x5cdee5);return BPromise[_0xffde('0x69')](_0x3b8432['Messages'],function(_0x3bf2fd,_0x3cf67c){var _0xd7a216={'from':_0x3bf2fd[_0xffde('0x63')],'to':_0x3bf2fd['to']||_0xffde('0x6a'),'subject':_0x3bf2fd[_0xffde('0x65')],'html':htmlEntities['decode'](_0x3bf2fd[_0xffde('0x3e')]),'headers':{'Date':moment(_0x3bf2fd['createdAt'])[_0xffde('0x4f')](_0xffde('0x6b'))},'attachments':[]};if(_0x3bf2fd['cc']){_0xd7a216[_0xffde('0x6c')]['Cc']=_0x3bf2fd['cc'];}if(_0x3bf2fd['bcc']){_0xd7a216[_0xffde('0x6c')][_0xffde('0x6d')]=_0x3bf2fd['bcc'];}return new BPromise(function(_0x18d840,_0x12206d){if(_0x3bf2fd[_0xffde('0x6e')]){for(var _0x60dbc6=0x0;_0x60dbc6<_0x3bf2fd['Attachments'][_0xffde('0x37')];_0x60dbc6++){var _0x3c7790=_0x3bf2fd[_0xffde('0x6e')][_0x60dbc6];var _0x2eac88=path[_0xffde('0x5a')](_0x29ffc7,_0x3c7790[_0xffde('0x6f')]);if(fs[_0xffde('0x70')](_0x2eac88)){_0xd7a216[_0xffde('0x5f')]['push']({'name':_0x3c7790[_0xffde('0x22')],'contentType':_0x3c7790[_0xffde('0x29')],'data':fs[_0xffde('0x71')](_0x2eac88)});}}}emlformat[_0xffde('0x72')](_0xd7a216,function(_0x37cc9b,_0x47bff3){if(_0x37cc9b)return _0x12206d(_0x37cc9b);fs[_0xffde('0x73')](path[_0xffde('0x5a')](_0x5cdee5,util['format'](_0xffde('0x74'),_0x3cf67c)),_0x47bff3);return _0x18d840(_0x47bff3);});});})[_0xffde('0x1f')](function(){return new BPromise(function(_0x112b8d,_0x1fa057){zipdir(_0x5cdee5,{'saveTo':_0x214bf8},function(_0x35c5d1,_0x4c8f9a){if(_0x35c5d1)return _0x1fa057(_0x35c5d1);return _0x112b8d(_0x4c8f9a);});})[_0xffde('0x1f')](function(){return new BPromise(function(_0x4aea2d,_0x4fee0d){rimraf(_0x5cdee5,function(_0x42582c){if(_0x42582c)_0x4fee0d(_0x42582c);return _0x4aea2d();});});})['then'](function(){return _0xba4ac7[_0xffde('0x58')](_0x214bf8,_0x1a1adc,function(_0x3897b3){if(!_0x3897b3)fs[_0xffde('0x75')](_0x214bf8);});});});}else{return _0xba4ac7['sendStatus'](0xc8);}})[_0xffde('0x30')](handleError(_0xba4ac7,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b69100b..fb95c88 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 _0x4559=['../../mysqldb','MailInteraction','MailMessage','save','update','remove','then','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x4718c4,_0x1a0cff){var _0x42784f=function(_0x530a1c){while(--_0x530a1c){_0x4718c4['push'](_0x4718c4['shift']());}};_0x42784f(++_0x1a0cff);}(_0x4559,0x16f));var _0x9455=function(_0xd73d53,_0x598443){_0xd73d53=_0xd73d53-0x0;var _0x560148=_0x4559[_0xd73d53];return _0x560148;};'use strict';var EventEmitter=require(_0x9455('0x0'));var MailInteraction=require(_0x9455('0x1'))['db'][_0x9455('0x2')];var MailMessage=require(_0x9455('0x1'))['db'][_0x9455('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9455('0x4'),'afterUpdate':_0x9455('0x5'),'afterDestroy':_0x9455('0x6')};function emitEvent(_0x544ff9){return function(_0x353714,_0x52e06f,_0x469148){_0x353714['getUsers']({'attributes':['id'],'raw':!![]})[_0x9455('0x7')](function(_0x2027f3){_0x353714['setDataValue'](_0x9455('0x8'),_0x2027f3['map'](function(_0x508a1a){return{'id':_0x508a1a['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x353714['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9455('0x7')](function(_0x462b53){_0x353714['setDataValue'](_0x9455('0x9'),_0x462b53[_0x9455('0xa')]);MailInteractionEvents[_0x9455('0xb')](_0x544ff9+':'+_0x353714['id'],_0x353714);MailInteractionEvents[_0x9455('0xb')](_0x544ff9,_0x353714);_0x469148(null);})[_0x9455('0xc')](_0x469148(null));};}for(var e in events){if(events[_0x9455('0xd')](e)){var event=events[e];MailInteraction[_0x9455('0xe')](e,emitEvent(event));}}module[_0x9455('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x3db3=['setDataValue','Users','map','then','length','emit','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x58ab89,_0xf01b2d){var _0xb93c04=function(_0x29e1b2){while(--_0x29e1b2){_0x58ab89['push'](_0x58ab89['shift']());}};_0xb93c04(++_0xf01b2d);}(_0x3db3,0x6e));var _0x33db=function(_0x5009cf,_0x3fa951){_0x5009cf=_0x5009cf-0x0;var _0x2ec6a4=_0x3db3[_0x5009cf];return _0x2ec6a4;};'use strict';var EventEmitter=require(_0x33db('0x0'));var MailInteraction=require(_0x33db('0x1'))['db'][_0x33db('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x33db('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x33db('0x4')](0x0);var events={'afterCreate':_0x33db('0x5'),'afterUpdate':_0x33db('0x6'),'afterDestroy':_0x33db('0x7')};function emitEvent(_0x32eedc){return function(_0x1d4123,_0x2f61d3,_0x23d9bd){_0x1d4123[_0x33db('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x366792){_0x1d4123[_0x33db('0x9')](_0x33db('0xa'),_0x366792[_0x33db('0xb')](function(_0x309567){return{'id':_0x309567['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x1d4123['id'],'direction':'in','read':![]},'raw':!![]});})[_0x33db('0xc')](function(_0x48ce41){_0x1d4123[_0x33db('0x9')]('unreadMessages',_0x48ce41[_0x33db('0xd')]);MailInteractionEvents['emit'](_0x32eedc+':'+_0x1d4123['id'],_0x1d4123);MailInteractionEvents[_0x33db('0xe')](_0x32eedc,_0x1d4123);_0x23d9bd(null);})['catch'](_0x23d9bd(null));};}for(var e in events){if(events[_0x33db('0xf')](e)){var event=events[e];MailInteraction[_0x33db('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index b78e95f..310dc53 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 _0xbd03=['bluebird','request-promise','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','substatusAt','models','update','then','catch','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x5488f3,_0x326225){var _0x2f79a7=function(_0x215f44){while(--_0x215f44){_0x5488f3['push'](_0x5488f3['shift']());}};_0x2f79a7(++_0x326225);}(_0xbd03,0x87));var _0x3bd0=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xbd03[_0x515afd];return _0x536d53;};'use strict';var _=require(_0x3bd0('0x0'));var util=require(_0x3bd0('0x1'));var logger=require(_0x3bd0('0x2'))(_0x3bd0('0x3'));var moment=require(_0x3bd0('0x4'));var BPromise=require(_0x3bd0('0x5'));var rp=require(_0x3bd0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3bd0('0x7'));var config=require(_0x3bd0('0x8'));var attributes=require('./mailInteraction.attributes');module[_0x3bd0('0x9')]=function(_0x2a0c1e,_0x412b36){return _0x2a0c1e[_0x3bd0('0xa')](_0x3bd0('0xb'),attributes,{'tableName':_0x3bd0('0xc'),'paranoid':![],'indexes':[{'name':_0x3bd0('0xd'),'fields':[_0x3bd0('0xe'),'to'],'type':_0x3bd0('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47f0d5,_0x58c968,_0x1c81fc){if(_0x47f0d5[_0x3bd0('0x10')]){_0x47f0d5['substatusAt']=moment()[_0x3bd0('0x11')](_0x3bd0('0x12'));}if(_0x47f0d5[_0x3bd0('0x13')]){_0x47f0d5['closedAt']=moment()[_0x3bd0('0x11')](_0x3bd0('0x12'));}_0x1c81fc(null,_0x58c968);},'beforeUpdate':function(_0x5db01a,_0x970e0e,_0xdd285a){if(_0x5db01a['changed'](_0x3bd0('0x10'))){_0x5db01a['substatusAt']=_0x5db01a['substatus']?moment()[_0x3bd0('0x11')](_0x3bd0('0x12')):null;}if(_0x5db01a[_0x3bd0('0x14')](_0x3bd0('0x13'))){_0x5db01a[_0x3bd0('0x15')]=moment()[_0x3bd0('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x5db01a['substatus']=null;_0x5db01a[_0x3bd0('0x16')]=null;}_0xdd285a(null,_0x5db01a);},'afterUpdate':function(_0x24e0c9,_0x4b1079,_0x57d8c7){var _0x401630=_0x2a0c1e[_0x3bd0('0x17')];var _0x49b5e0=_0x24e0c9['get']({'plain':!![]});if(_0x49b5e0[_0x3bd0('0x13')]){return _0x401630['MailMessage'][_0x3bd0('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x49b5e0['id']}})[_0x3bd0('0x19')](function(){_0x57d8c7();})[_0x3bd0('0x1a')](function(_0x129ce3){_0x57d8c7(_0x129ce3);});}else{_0x57d8c7();}}},'charset':_0x3bd0('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8528=['substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','substatus','MailMessage','update','catch','lodash','util','api','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','subject'];(function(_0x2ba5fe,_0x35e39e){var _0x32046c=function(_0x954698){while(--_0x954698){_0x2ba5fe['push'](_0x2ba5fe['shift']());}};_0x32046c(++_0x35e39e);}(_0x8528,0x1ed));var _0x8852=function(_0x413661,_0x517100){_0x413661=_0x413661-0x0;var _0x30abdf=_0x8528[_0x413661];return _0x30abdf;};'use strict';var _=require(_0x8852('0x0'));var util=require(_0x8852('0x1'));var logger=require('../../config/logger')(_0x8852('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8852('0x3'));var fs=require('fs');var path=require(_0x8852('0x4'));var rimraf=require(_0x8852('0x5'));var config=require(_0x8852('0x6'));var attributes=require(_0x8852('0x7'));module[_0x8852('0x8')]=function(_0x1a9980,_0x37f459){return _0x1a9980['define'](_0x8852('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x8852('0xa'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x283462,_0x549867,_0x264798){if(_0x283462['substatus']){_0x283462[_0x8852('0xb')]=moment()['format'](_0x8852('0xc'));}if(_0x283462[_0x8852('0xd')]){_0x283462[_0x8852('0xe')]=moment()[_0x8852('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x264798(null,_0x549867);},'beforeUpdate':function(_0x22f72c,_0x3077bc,_0x57c633){if(_0x22f72c[_0x8852('0x10')](_0x8852('0x11'))){_0x22f72c['substatusAt']=_0x22f72c[_0x8852('0x11')]?moment()[_0x8852('0xf')](_0x8852('0xc')):null;}if(_0x22f72c[_0x8852('0x10')](_0x8852('0xd'))){_0x22f72c['closedAt']=moment()[_0x8852('0xf')](_0x8852('0xc'));_0x22f72c[_0x8852('0x11')]=null;_0x22f72c[_0x8852('0xb')]=null;}_0x57c633(null,_0x22f72c);},'afterUpdate':function(_0x468ea8,_0x1e9447,_0x51fdad){var _0x442a0a=_0x1a9980['models'];var _0x2c2f78=_0x468ea8['get']({'plain':!![]});if(_0x2c2f78[_0x8852('0xd')]){return _0x442a0a[_0x8852('0x12')][_0x8852('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x2c2f78['id']}})['then'](function(){_0x51fdad();})[_0x8852('0x14')](function(_0x58dbcc){_0x51fdad(_0x58dbcc);});}else{_0x51fdad();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 576cf26..e261334 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 _0xd9cb=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','info','request\x20sent','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','debug','AddTagsToMailInteraction','find','then','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/logger'];(function(_0x2adb0c,_0x22b3c6){var _0x21b9d4=function(_0x406167){while(--_0x406167){_0x2adb0c['push'](_0x2adb0c['shift']());}};_0x21b9d4(++_0x22b3c6);}(_0xd9cb,0x1be));var _0xbd9c=function(_0x2b3906,_0x2f2e4d){_0x2b3906=_0x2b3906-0x0;var _0x140825=_0xd9cb[_0x2b3906];return _0x140825;};'use strict';var _=require(_0xbd9c('0x0'));var util=require('util');var moment=require(_0xbd9c('0x1'));var BPromise=require(_0xbd9c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd9c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbd9c('0x4'))(_0xbd9c('0x5'));var config=require(_0xbd9c('0x6'));var jayson=require(_0xbd9c('0x7'));var client=jayson[_0xbd9c('0x8')][_0xbd9c('0x9')]({'port':0x232a});config[_0xbd9c('0xa')]=_[_0xbd9c('0xb')](config['redis'],{'host':_0xbd9c('0xc'),'port':0x18eb});var socket=require(_0xbd9c('0xd'))(new Redis(config[_0xbd9c('0xa')]));require(_0xbd9c('0xe'))[_0xbd9c('0xf')](socket);function respondWithRpcPromise(_0x3784bf,_0x25fcc7,_0x17a391){return new BPromise(function(_0x191ba2,_0xdf5194){return client['request'](_0x3784bf,_0x17a391)['then'](function(_0x99941f){logger[_0xbd9c('0x10')]('MailInteraction,\x20%s,\x20%s',_0x25fcc7,_0xbd9c('0x11'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x25fcc7,'request\x20sent',JSON[_0xbd9c('0x12')](_0x99941f));if(_0x99941f['error']){if(_0x99941f['error']['code']===0x1f4){logger[_0xbd9c('0x13')](_0xbd9c('0x14'),_0x25fcc7,_0x99941f['error']['message']);return _0xdf5194(_0x99941f[_0xbd9c('0x13')][_0xbd9c('0x15')]);}logger[_0xbd9c('0x13')]('MailInteraction,\x20%s,\x20%s',_0x25fcc7,_0x99941f[_0xbd9c('0x13')][_0xbd9c('0x15')]);return _0x191ba2(_0x99941f[_0xbd9c('0x13')][_0xbd9c('0x15')]);}else{logger[_0xbd9c('0x10')](_0xbd9c('0x14'),_0x25fcc7,_0xbd9c('0x11'));_0x191ba2(_0x99941f[_0xbd9c('0x16')][_0xbd9c('0x15')]);}})[_0xbd9c('0x17')](function(_0x28c6a3){logger[_0xbd9c('0x13')](_0xbd9c('0x14'),_0x25fcc7,_0x28c6a3);_0xdf5194(_0x28c6a3);});});}exports['UpdateMailInteraction']=function(_0x10bc92){var _0x43fb3a=this;return new Promise(function(_0x4f8c3b,_0x30574f){return db[_0xbd9c('0x18')][_0xbd9c('0x19')](_0x10bc92[_0xbd9c('0x1a')],{'raw':_0x10bc92[_0xbd9c('0x1b')]?_0x10bc92[_0xbd9c('0x1b')][_0xbd9c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10bc92[_0xbd9c('0x1b')]?_0x10bc92[_0xbd9c('0x1b')][_0xbd9c('0x1d')]||null:null,'attributes':_0x10bc92[_0xbd9c('0x1b')]?_0x10bc92[_0xbd9c('0x1b')][_0xbd9c('0x1e')]||null:null,'limit':_0x10bc92[_0xbd9c('0x1b')]?_0x10bc92[_0xbd9c('0x1b')][_0xbd9c('0x1f')]||null:null})['then'](function(_0x5891b5){logger[_0xbd9c('0x10')](_0xbd9c('0x20'),_0x10bc92);logger[_0xbd9c('0x21')](_0xbd9c('0x20'),_0x10bc92,JSON['stringify'](_0x5891b5));_0x4f8c3b(_0x5891b5);})[_0xbd9c('0x17')](function(_0x37cff0){logger[_0xbd9c('0x13')](_0xbd9c('0x20'),_0x37cff0[_0xbd9c('0x15')],_0x10bc92);_0x30574f(_0x43fb3a[_0xbd9c('0x13')](0x1f4,_0x37cff0['message']));});});};exports[_0xbd9c('0x22')]=function(_0x8a9b3c){return new Promise(function(_0x20d1b1,_0x3344e9){return db[_0xbd9c('0x18')][_0xbd9c('0x23')]({'where':_0x8a9b3c[_0xbd9c('0x1b')]?_0x8a9b3c[_0xbd9c('0x1b')][_0xbd9c('0x1d')]||null:null})[_0xbd9c('0x24')](function(_0x5ebffe){if(_0x5ebffe){return _0x5ebffe['addTags'](_0x8a9b3c[_0xbd9c('0x1a')][_0xbd9c('0x25')],_[_0xbd9c('0x26')](_0x8a9b3c[_0xbd9c('0x1a')],[_0xbd9c('0x25'),'id'])||{});}})[_0xbd9c('0x27')](function(_0x4bc6f7){logger[_0xbd9c('0x10')](_0xbd9c('0x28'),_0x8a9b3c);logger[_0xbd9c('0x21')]('AddTags',_0x8a9b3c,JSON[_0xbd9c('0x12')](_0x4bc6f7));_0x20d1b1(_0x4bc6f7);})[_0xbd9c('0x17')](function(_0x3f462f){logger['error'](_0xbd9c('0x28'),_0x3f462f[_0xbd9c('0x15')],_0x8a9b3c);_0x3344e9(_this['error'](0x1f4,_0x3f462f[_0xbd9c('0x15')]));});});}; \ No newline at end of file +var _0x7769=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','then','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','info','request\x20sent','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','find','addTags','ids','AddTags','lodash','util'];(function(_0x874b20,_0x273f88){var _0x1df30a=function(_0x112f00){while(--_0x112f00){_0x874b20['push'](_0x874b20['shift']());}};_0x1df30a(++_0x273f88);}(_0x7769,0x15e));var _0x9776=function(_0x3ab5af,_0x2036b2){_0x3ab5af=_0x3ab5af-0x0;var _0x253a11=_0x7769[_0x3ab5af];return _0x253a11;};'use strict';var _=require(_0x9776('0x0'));var util=require(_0x9776('0x1'));var moment=require(_0x9776('0x2'));var BPromise=require(_0x9776('0x3'));var rs=require(_0x9776('0x4'));var fs=require('fs');var Redis=require(_0x9776('0x5'));var db=require(_0x9776('0x6'))['db'];var utils=require(_0x9776('0x7'));var logger=require(_0x9776('0x8'))(_0x9776('0x9'));var config=require(_0x9776('0xa'));var jayson=require(_0x9776('0xb'));var client=jayson[_0x9776('0xc')][_0x9776('0xd')]({'port':0x232a});config[_0x9776('0xe')]=_[_0x9776('0xf')](config[_0x9776('0xe')],{'host':_0x9776('0x10'),'port':0x18eb});var socket=require(_0x9776('0x11'))(new Redis(config['redis']));require(_0x9776('0x12'))[_0x9776('0x13')](socket);function respondWithRpcPromise(_0x16ce7f,_0xbfc7bf,_0x2e4ec4){return new BPromise(function(_0x269cbb,_0x1d9a5e){return client['request'](_0x16ce7f,_0x2e4ec4)[_0x9776('0x14')](function(_0x5f1a68){logger['info']('MailInteraction,\x20%s,\x20%s',_0xbfc7bf,'request\x20sent');logger[_0x9776('0x15')](_0x9776('0x16'),_0xbfc7bf,'request\x20sent',JSON[_0x9776('0x17')](_0x5f1a68));if(_0x5f1a68[_0x9776('0x18')]){if(_0x5f1a68[_0x9776('0x18')][_0x9776('0x19')]===0x1f4){logger[_0x9776('0x18')](_0x9776('0x1a'),_0xbfc7bf,_0x5f1a68[_0x9776('0x18')]['message']);return _0x1d9a5e(_0x5f1a68[_0x9776('0x18')][_0x9776('0x1b')]);}logger[_0x9776('0x18')](_0x9776('0x1a'),_0xbfc7bf,_0x5f1a68['error'][_0x9776('0x1b')]);return _0x269cbb(_0x5f1a68[_0x9776('0x18')][_0x9776('0x1b')]);}else{logger[_0x9776('0x1c')]('MailInteraction,\x20%s,\x20%s',_0xbfc7bf,_0x9776('0x1d'));_0x269cbb(_0x5f1a68[_0x9776('0x1e')][_0x9776('0x1b')]);}})[_0x9776('0x1f')](function(_0x4b1203){logger[_0x9776('0x18')](_0x9776('0x1a'),_0xbfc7bf,_0x4b1203);_0x1d9a5e(_0x4b1203);});});}exports[_0x9776('0x20')]=function(_0x10a80a){var _0x544863=this;return new Promise(function(_0x1d91a3,_0x3419de){return db[_0x9776('0x21')]['update'](_0x10a80a[_0x9776('0x22')],{'raw':_0x10a80a[_0x9776('0x23')]?_0x10a80a[_0x9776('0x23')][_0x9776('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10a80a[_0x9776('0x23')]?_0x10a80a[_0x9776('0x23')][_0x9776('0x25')]||null:null,'attributes':_0x10a80a[_0x9776('0x23')]?_0x10a80a['options'][_0x9776('0x26')]||null:null,'limit':_0x10a80a[_0x9776('0x23')]?_0x10a80a[_0x9776('0x23')][_0x9776('0x27')]||null:null})[_0x9776('0x14')](function(_0x105403){logger[_0x9776('0x1c')]('UpdateMailInteraction',_0x10a80a);logger[_0x9776('0x15')](_0x9776('0x20'),_0x10a80a,JSON[_0x9776('0x17')](_0x105403));_0x1d91a3(_0x105403);})[_0x9776('0x1f')](function(_0x5630d1){logger['error'](_0x9776('0x20'),_0x5630d1[_0x9776('0x1b')],_0x10a80a);_0x3419de(_0x544863[_0x9776('0x18')](0x1f4,_0x5630d1[_0x9776('0x1b')]));});});};exports['AddTagsToMailInteraction']=function(_0x46a93b){return new Promise(function(_0x11e9c8,_0x1a7f8c){return db[_0x9776('0x21')][_0x9776('0x28')]({'where':_0x46a93b[_0x9776('0x23')]?_0x46a93b['options'][_0x9776('0x25')]||null:null})[_0x9776('0x14')](function(_0x4686ec){if(_0x4686ec){return _0x4686ec[_0x9776('0x29')](_0x46a93b[_0x9776('0x22')]['ids'],_['omit'](_0x46a93b[_0x9776('0x22')],[_0x9776('0x2a'),'id'])||{});}})['spread'](function(_0x1addeb){logger['info'](_0x9776('0x2b'),_0x46a93b);logger['debug'](_0x9776('0x2b'),_0x46a93b,JSON[_0x9776('0x17')](_0x1addeb));_0x11e9c8(_0x1addeb);})[_0x9776('0x1f')](function(_0x2f03dc){logger[_0x9776('0x18')](_0x9776('0x2b'),_0x2f03dc[_0x9776('0x1b')],_0x46a93b);_0x1a7f8c(_this['error'](0x1f4,_0x2f03dc[_0x9776('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d283a96..f48aed9 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 _0x7ab6=['update','removeListener','register','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0xf34895,_0x21fb70){var _0x143f44=function(_0x2e7730){while(--_0x2e7730){_0xf34895['push'](_0xf34895['shift']());}};_0x143f44(++_0x21fb70);}(_0x7ab6,0x82));var _0x67ab=function(_0x526acc,_0x128d58){_0x526acc=_0x526acc-0x0;var _0x294267=_0x7ab6[_0x526acc];return _0x294267;};'use strict';var MailInteractionEvents=require(_0x67ab('0x0'));var events=[_0x67ab('0x1'),_0x67ab('0x2'),_0x67ab('0x3')];function createListener(_0x518323,_0x33ac21){return function(_0x26aa2e){_0x33ac21['emit'](_0x518323,_0x26aa2e);};}function removeListener(_0x2ab6bf,_0x3e690c){return function(){MailInteractionEvents[_0x67ab('0x4')](_0x2ab6bf,_0x3e690c);};}exports[_0x67ab('0x5')]=function(_0x981fc3){for(var _0x2f194a=0x0,_0x3560dc=events['length'];_0x2f194a<_0x3560dc;_0x2f194a++){var _0x527827=events[_0x2f194a];var _0xee6e7a=createListener(_0x67ab('0x6')+_0x527827,_0x981fc3);MailInteractionEvents['on'](_0x527827,_0xee6e7a);}}; \ No newline at end of file +var _0x794f=['save','remove','update','emit','mailInteraction:','./mailInteraction.events'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0x794f,0xa7));var _0xf794=function(_0x4ec1de,_0x4bcd8d){_0x4ec1de=_0x4ec1de-0x0;var _0x278289=_0x794f[_0x4ec1de];return _0x278289;};'use strict';var MailInteractionEvents=require(_0xf794('0x0'));var events=[_0xf794('0x1'),_0xf794('0x2'),_0xf794('0x3')];function createListener(_0x51a018,_0x5b0a4f){return function(_0x4f9f8c){_0x5b0a4f[_0xf794('0x4')](_0x51a018,_0x4f9f8c);};}function removeListener(_0x3b768b,_0x11165a){return function(){MailInteractionEvents['removeListener'](_0x3b768b,_0x11165a);};}exports['register']=function(_0x36427b){for(var _0x3a47a1=0x0,_0x3db054=events['length'];_0x3a47a1<_0x3db054;_0x3a47a1++){var _0x4e81f6=events[_0x3a47a1];var _0x569c6c=createListener(_0xf794('0x5')+_0x4e81f6,_0x36427b);MailInteractionEvents['on'](_0x4e81f6,_0x569c6c);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index af0915b..43de0fd 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 _0xda3f=['create','put','/:id/accept','/:id/reject','destroy','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create'];(function(_0x1eff30,_0x44b983){var _0x41fd1b=function(_0x536f14){while(--_0x536f14){_0x1eff30['push'](_0x1eff30['shift']());}};_0x41fd1b(++_0x44b983);}(_0xda3f,0xec));var _0xfda3=function(_0xe6e3a3,_0x8da8e){_0xe6e3a3=_0xe6e3a3-0x0;var _0xe32f3a=_0xda3f[_0xe6e3a3];return _0xe32f3a;};'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('./mailMessage.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('0xd')]('/',auth['isAuthenticated'](),interaction[_0xfda3('0xe')](_0xfda3('0xf'),_0xfda3('0x10')),controller[_0xfda3('0x11')]);router[_0xfda3('0x12')]('/:id',auth[_0xfda3('0x6')](),controller['update']);router[_0xfda3('0x12')](_0xfda3('0x13'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xfda3('0x14'),auth[_0xfda3('0x6')](),controller['reject']);router['delete']('/:id',auth[_0xfda3('0x6')](),controller[_0xfda3('0x15')]);module[_0xfda3('0x16')]=router; \ No newline at end of file +var _0xb974=['delete','destroy','exports','multer','util','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','get','describe','/:id','show','post','mail','mailmessage:create','put','/:id/accept','accept','/:id/reject','reject'];(function(_0x37dba2,_0x27fe5e){var _0x52b28c=function(_0x49e39f){while(--_0x49e39f){_0x37dba2['push'](_0x37dba2['shift']());}};_0x52b28c(++_0x27fe5e);}(_0xb974,0xb3));var _0x4b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb974[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4b97('0x0'));var util=require(_0x4b97('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4b97('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b97('0x3'));var config=require(_0x4b97('0x4'));var controller=require(_0x4b97('0x5'));router['get']('/',auth[_0x4b97('0x6')](),controller['index']);router[_0x4b97('0x7')]('/describe',auth[_0x4b97('0x6')](),controller[_0x4b97('0x8')]);router[_0x4b97('0x7')](_0x4b97('0x9'),auth['isAuthenticated'](),controller[_0x4b97('0xa')]);router[_0x4b97('0x7')]('/:id/download',auth[_0x4b97('0x6')](),controller['download']);router[_0x4b97('0xb')]('/',auth[_0x4b97('0x6')](),interaction['tracked'](_0x4b97('0xc'),_0x4b97('0xd')),controller['create']);router[_0x4b97('0xe')](_0x4b97('0x9'),auth[_0x4b97('0x6')](),controller['update']);router['put'](_0x4b97('0xf'),auth[_0x4b97('0x6')](),controller[_0x4b97('0x10')]);router[_0x4b97('0xe')](_0x4b97('0x11'),auth[_0x4b97('0x6')](),controller[_0x4b97('0x12')]);router[_0x4b97('0x13')]('/:id',auth[_0x4b97('0x6')](),controller[_0x4b97('0x14')]);module[_0x4b97('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index bb257ed..baa4328 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 _0xfadf=['lodash','TEXT','long','medium','BOOLEAN','ENUM','out','DATE','INTEGER','Email'];(function(_0x300b26,_0x3a9b67){var _0x5cb1ae=function(_0x2b8e7f){while(--_0x2b8e7f){_0x300b26['push'](_0x300b26['shift']());}};_0x5cb1ae(++_0x3a9b67);}(_0xfadf,0x12c));var _0xffad=function(_0x1a039,_0x257de3){_0x1a039=_0x1a039-0x0;var _0x244c26=_0xfadf[_0x1a039];return _0x244c26;};'use strict';var Sequelize=require('sequelize');var _=require(_0xffad('0x0'));module['exports']={'body':{'type':Sequelize[_0xffad('0x1')](_0xffad('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xffad('0x1')](_0xffad('0x3'))},'read':{'type':Sequelize[_0xffad('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xffad('0x5')]('in',_0xffad('0x6')),'defaultValue':_0xffad('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xffad('0x1')](_0xffad('0x2'))},'cc':{'type':Sequelize[_0xffad('0x1')](_0xffad('0x2'))},'bcc':{'type':Sequelize[_0xffad('0x1')](_0xffad('0x2'))},'subject':{'type':Sequelize[_0xffad('0x1')]},'sentAt':{'type':Sequelize[_0xffad('0x7')]},'attach':{'type':Sequelize[_0xffad('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xffad('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xffad('0x7')]},'originTo':{'type':Sequelize[_0xffad('0x1')](_0xffad('0x2'))},'originCc':{'type':Sequelize[_0xffad('0x1')](_0xffad('0x2'))},'originChannel':{'type':Sequelize['ENUM'](_0xffad('0x9'),'Chat'),'defaultValue':_0xffad('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0x742d=['Email','Chat','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM','STRING'];(function(_0x1ab734,_0x5f0aed){var _0x26cd6b=function(_0x52280c){while(--_0x52280c){_0x1ab734['push'](_0x1ab734['shift']());}};_0x26cd6b(++_0x5f0aed);}(_0x742d,0x66));var _0xd742=function(_0x2236dc,_0x43c7f9){_0x2236dc=_0x2236dc-0x0;var _0x20583f=_0x742d[_0x2236dc];return _0x20583f;};'use strict';var Sequelize=require(_0xd742('0x0'));var _=require(_0xd742('0x1'));module[_0xd742('0x2')]={'body':{'type':Sequelize[_0xd742('0x3')](_0xd742('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xd742('0x3')]('medium')},'read':{'type':Sequelize[_0xd742('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd742('0x6')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd742('0x7')](0x1fe)},'from':{'type':Sequelize[_0xd742('0x7')]},'to':{'type':Sequelize[_0xd742('0x3')](_0xd742('0x4'))},'cc':{'type':Sequelize[_0xd742('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xd742('0x4'))},'subject':{'type':Sequelize[_0xd742('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xd742('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xd742('0x3')](_0xd742('0x4'))},'originCc':{'type':Sequelize[_0xd742('0x3')](_0xd742('0x4'))},'originChannel':{'type':Sequelize[_0xd742('0x6')](_0xd742('0x8'),_0xd742('0x9')),'defaultValue':_0xd742('0x8'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index fba249c..e1b4401 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 _0x7d2c=['internal','interface','SIP/%s','download','unix','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','headers','Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','status','json','offset','undefined','limit','set','Content-Range','update','then','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','count','includeAll','include','findAll','params','keys','catch','body','find','destroy','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','updatedAt','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','sendMail','messageId','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','MailInteraction','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','email','manual','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','QueryTypes'];(function(_0x48f313,_0x413184){var _0x4a54e0=function(_0x1c3d81){while(--_0x1c3d81){_0x48f313['push'](_0x48f313['shift']());}};_0x4a54e0(++_0x413184);}(_0x7d2c,0x1e4));var _0xc7d2=function(_0x22d471,_0x28ee97){_0x22d471=_0x22d471-0x0;var _0x177e7a=_0x7d2c[_0x22d471];return _0x177e7a;};'use strict';var emlformat=require(_0xc7d2('0x0'));var moment=require(_0xc7d2('0x1'));var BPromise=require(_0xc7d2('0x2'));var util=require('util');var path=require(_0xc7d2('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc7d2('0x4'));var htmlToText=require(_0xc7d2('0x5'));var qs=require(_0xc7d2('0x6'));var logger=require(_0xc7d2('0x7'))(_0xc7d2('0x8'));var interaction_log=require(_0xc7d2('0x7'))(_0xc7d2('0x9'));var config=require(_0xc7d2('0xa'));var db=require(_0xc7d2('0xb'))['db'];config[_0xc7d2('0xc')]=_[_0xc7d2('0xd')](config[_0xc7d2('0xc')],{'host':_0xc7d2('0xe'),'port':0x18eb});var socket=require(_0xc7d2('0xf'))(new Redis(config['redis']));var htmlEntities=require(_0xc7d2('0x10'));require('./mailMessage.socket')[_0xc7d2('0x11')](socket);var jayson=require(_0xc7d2('0x12'));var client=jayson[_0xc7d2('0x13')][_0xc7d2('0x14')]({'port':0x232c});var client9003=jayson[_0xc7d2('0x13')][_0xc7d2('0x14')]({'port':0x232b});var client9002=jayson[_0xc7d2('0x13')][_0xc7d2('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x4750f8,_0x650ed4,_0x94e978,_0x273d6a){return new BPromise(function(_0xe286f0,_0xcad923){var _0x10b4d8=_0x273d6a||client;return _0x10b4d8['request'](_0x4750f8,_0x94e978)['then'](function(_0x47a058){logger['info'](_0xc7d2('0x15'),_0x650ed4,'request\x20sent');logger[_0xc7d2('0x16')](_0xc7d2('0x17'),_0x650ed4,_0xc7d2('0x18'),JSON[_0xc7d2('0x19')](_0x47a058));if(_0x47a058['error']){if(_0x47a058[_0xc7d2('0x1a')][_0xc7d2('0x1b')]===0x1f4){logger[_0xc7d2('0x1a')](_0xc7d2('0x15'),_0x650ed4,_0x47a058[_0xc7d2('0x1a')][_0xc7d2('0x1c')]);return _0xcad923(_0x47a058[_0xc7d2('0x1a')][_0xc7d2('0x1c')]);}logger[_0xc7d2('0x1a')](_0xc7d2('0x15'),_0x650ed4,_0x47a058['error'][_0xc7d2('0x1c')]);return _0xe286f0(_0x47a058['error'][_0xc7d2('0x1c')]);}else{logger['info'](_0xc7d2('0x15'),_0x650ed4,'request\x20sent');_0xe286f0(_0x47a058['result']['message']);}})['catch'](function(_0x41bead){logger[_0xc7d2('0x1a')]('MailMessage,\x20%s,\x20%s',_0x650ed4,_0x41bead);_0xcad923(_0x41bead);});});}function respondWithResult(_0x153480,_0x402d0f){_0x402d0f=_0x402d0f||0xc8;return function(_0xd09f1a){if(_0xd09f1a){return _0x153480[_0xc7d2('0x1d')](_0x402d0f)[_0xc7d2('0x1e')](_0xd09f1a);}};}function respondWithFilteredResult(_0x5b0d2e,_0x5f1a8e){return function(_0xa9efb7){if(_0xa9efb7){var _0x180738=typeof _0x5f1a8e[_0xc7d2('0x1f')]===_0xc7d2('0x20')&&typeof _0x5f1a8e['limit']===_0xc7d2('0x20');var _0xeef58e=_0xa9efb7['count'];var _0x5c0fc5=_0x180738?0x0:_0x5f1a8e[_0xc7d2('0x1f')];var _0x2b923e=_0x180738?_0xa9efb7['count']:_0x5f1a8e[_0xc7d2('0x1f')]+_0x5f1a8e[_0xc7d2('0x21')];var _0x56c932;if(_0x2b923e>=_0xeef58e){_0x2b923e=_0xeef58e;_0x56c932=0xc8;}else{_0x56c932=0xce;}_0x5b0d2e[_0xc7d2('0x1d')](_0x56c932);return _0x5b0d2e[_0xc7d2('0x22')](_0xc7d2('0x23'),_0x5c0fc5+'-'+_0x2b923e+'/'+_0xeef58e)[_0xc7d2('0x1e')](_0xa9efb7);}return null;};}function saveUpdates(_0x42bea2){return function(_0xbd205c){if(_0xbd205c){return _0xbd205c[_0xc7d2('0x24')](_0x42bea2)[_0xc7d2('0x25')](function(_0x195167){return _0x195167;});}return null;};}function removeEntity(_0x4a38cc){return function(_0x464353){if(_0x464353){return _0x464353['destroy']()['then'](function(){_0x4a38cc[_0xc7d2('0x1d')](0xcc)[_0xc7d2('0x26')]();});}};}function handleEntityNotFound(_0x62529c){return function(_0x1679e7){if(!_0x1679e7){_0x62529c[_0xc7d2('0x27')](0x194);}return _0x1679e7;};}function handleError(_0xd4625c,_0x5b69ad){_0x5b69ad=_0x5b69ad||0x1f4;return function(_0x2f0860){logger[_0xc7d2('0x1a')](_0x2f0860[_0xc7d2('0x28')]);if(_0x2f0860[_0xc7d2('0x29')]){delete _0x2f0860['name'];}_0xd4625c['status'](_0x5b69ad)[_0xc7d2('0x2a')](_0x2f0860);};}exports[_0xc7d2('0x2b')]=function(_0x204bee,_0x40c827){var _0x34e942={},_0x2714aa={},_0x3a9200={'count':0x0,'rows':[]};var _0x59236e=_[_0xc7d2('0x2c')](db[_0xc7d2('0x2d')][_0xc7d2('0x2e')],function(_0x4b4bd0){return{'name':_0x4b4bd0['fieldName'],'type':_0x4b4bd0[_0xc7d2('0x2f')][_0xc7d2('0x30')]};});_0x2714aa[_0xc7d2('0x31')]=_[_0xc7d2('0x2c')](_0x59236e,_0xc7d2('0x29'));_0x2714aa[_0xc7d2('0x32')]=_['keys'](_0x204bee['query']);_0x2714aa[_0xc7d2('0x33')]=_['intersection'](_0x2714aa['model'],_0x2714aa[_0xc7d2('0x32')]);_0x34e942[_0xc7d2('0x34')]=_[_0xc7d2('0x35')](_0x2714aa[_0xc7d2('0x31')],qs['fields'](_0x204bee[_0xc7d2('0x32')][_0xc7d2('0x36')]));_0x34e942[_0xc7d2('0x34')]=_0x34e942[_0xc7d2('0x34')][_0xc7d2('0x37')]?_0x34e942[_0xc7d2('0x34')]:_0x2714aa[_0xc7d2('0x31')];if(!_0x204bee[_0xc7d2('0x32')][_0xc7d2('0x38')](_0xc7d2('0x39'))){_0x34e942[_0xc7d2('0x21')]=qs[_0xc7d2('0x21')](_0x204bee[_0xc7d2('0x32')]['limit']);_0x34e942[_0xc7d2('0x1f')]=qs[_0xc7d2('0x1f')](_0x204bee[_0xc7d2('0x32')][_0xc7d2('0x1f')]);}_0x34e942['order']=qs['sort'](_0x204bee['query'][_0xc7d2('0x3a')]);_0x34e942[_0xc7d2('0x3b')]=qs['filters'](_['pick'](_0x204bee[_0xc7d2('0x32')],_0x2714aa[_0xc7d2('0x33')]),_0x59236e);if(_0x204bee[_0xc7d2('0x32')][_0xc7d2('0x3c')]){_0x34e942[_0xc7d2('0x3b')]=_[_0xc7d2('0x3d')](_0x34e942[_0xc7d2('0x3b')],{'$or':_[_0xc7d2('0x2c')](_0x59236e,function(_0x32d46d){if(_0x32d46d[_0xc7d2('0x2f')]!=='VIRTUAL'){var _0x11a27e={};_0x11a27e[_0x32d46d[_0xc7d2('0x29')]]={'$like':'%'+_0x204bee['query'][_0xc7d2('0x3c')]+'%'};return _0x11a27e;}})});}_0x34e942=_['merge']({},_0x34e942,_0x204bee['options']);var _0x3aaa6a={'where':_0x34e942[_0xc7d2('0x3b')]};return db[_0xc7d2('0x2d')]['count'](_0x3aaa6a)[_0xc7d2('0x25')](function(_0x53ebf7){_0x3a9200[_0xc7d2('0x3e')]=_0x53ebf7;if(_0x204bee[_0xc7d2('0x32')][_0xc7d2('0x3f')]){_0x34e942[_0xc7d2('0x40')]=[{'all':!![]}];}return db[_0xc7d2('0x2d')][_0xc7d2('0x41')](_0x34e942);})[_0xc7d2('0x25')](function(_0x1b59ed){_0x3a9200['rows']=_0x1b59ed;return _0x3a9200;})[_0xc7d2('0x25')](respondWithFilteredResult(_0x40c827,_0x34e942))['catch'](handleError(_0x40c827,null));};exports['show']=function(_0xd335e9,_0x30f8df){var _0x359b36={'raw':!![],'where':{'id':_0xd335e9[_0xc7d2('0x42')]['id']}},_0x1f2f0f={};_0x1f2f0f[_0xc7d2('0x31')]=_[_0xc7d2('0x43')](db['MailMessage'][_0xc7d2('0x2e')]);_0x1f2f0f[_0xc7d2('0x32')]=_['keys'](_0xd335e9[_0xc7d2('0x32')]);_0x1f2f0f[_0xc7d2('0x33')]=_['intersection'](_0x1f2f0f[_0xc7d2('0x31')],_0x1f2f0f[_0xc7d2('0x32')]);_0x359b36[_0xc7d2('0x34')]=_['intersection'](_0x1f2f0f[_0xc7d2('0x31')],qs[_0xc7d2('0x36')](_0xd335e9[_0xc7d2('0x32')]['fields']));_0x359b36[_0xc7d2('0x34')]=_0x359b36[_0xc7d2('0x34')]['length']?_0x359b36['attributes']:_0x1f2f0f[_0xc7d2('0x31')];if(_0xd335e9['query'][_0xc7d2('0x3f')]){_0x359b36[_0xc7d2('0x40')]=[{'all':!![]}];}_0x359b36=_[_0xc7d2('0x3d')]({},_0x359b36,_0xd335e9['options']);return db[_0xc7d2('0x2d')]['find'](_0x359b36)['then'](handleEntityNotFound(_0x30f8df,null))[_0xc7d2('0x25')](respondWithResult(_0x30f8df,null))[_0xc7d2('0x44')](handleError(_0x30f8df,null));};exports[_0xc7d2('0x24')]=function(_0x50fde6,_0x164d72){if(_0x50fde6[_0xc7d2('0x45')]['id']){delete _0x50fde6[_0xc7d2('0x45')]['id'];}return db[_0xc7d2('0x2d')][_0xc7d2('0x46')]({'where':{'id':_0x50fde6['params']['id']}})['then'](handleEntityNotFound(_0x164d72,null))[_0xc7d2('0x25')](saveUpdates(_0x50fde6[_0xc7d2('0x45')],null))[_0xc7d2('0x25')](respondWithResult(_0x164d72,null))['catch'](handleError(_0x164d72,null));};exports[_0xc7d2('0x47')]=function(_0x460e37,_0x32e040){return db[_0xc7d2('0x2d')][_0xc7d2('0x46')]({'where':{'id':_0x460e37['params']['id']}})[_0xc7d2('0x25')](handleEntityNotFound(_0x32e040,null))['then'](removeEntity(_0x32e040,null))[_0xc7d2('0x44')](handleError(_0x32e040,null));};exports[_0xc7d2('0x48')]=function(_0x12cdb4,_0x4d7996){return db[_0xc7d2('0x2d')][_0xc7d2('0x48')]()[_0xc7d2('0x25')](respondWithResult(_0x4d7996,null))[_0xc7d2('0x44')](handleError(_0x4d7996,null));};exports['create']=function(_0x1e5ebd,_0x4b0d5d){return db[_0xc7d2('0x2d')][_0xc7d2('0x49')](_0x1e5ebd[_0xc7d2('0x45')])[_0xc7d2('0x25')](function(_0x5c9b3a){if(_0x5c9b3a){if(_0x5c9b3a[_0xc7d2('0x4a')]===_0xc7d2('0x4b')&&!_0x5c9b3a[_0xc7d2('0x4c')]){var _0x1f4a95,_0x2139e2,_0x4dce39;if(_0x1e5ebd['body']['to']){_0x2139e2=_0x1e5ebd[_0xc7d2('0x45')]['to'][_0xc7d2('0x4d')](',')[0x0];}return db[_0xc7d2('0x4e')]['findOne']({'where':{'id':_0x5c9b3a[_0xc7d2('0x4f')]},'include':[{'model':db[_0xc7d2('0x50')],'as':_0xc7d2('0x51'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x2139e2},'limit':0x1,'order':[[_0xc7d2('0x52'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xc7d2('0x53'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc7d2('0x54'),'raw':!![]}]}]})[_0xc7d2('0x25')](function(_0x3f6941){_0x1f4a95=_0x3f6941;if(!_0x1f4a95||!_0x1f4a95['Smtp'])return;var _0x31c857=_0x1f4a95['getSmtpOptions']();if(_0x1e5ebd[_0xc7d2('0x45')][_0xc7d2('0x55')]&&_0x1e5ebd[_0xc7d2('0x45')][_0xc7d2('0x55')]['length']){for(var _0x5c4875=0x0;_0x5c4875<_0x1e5ebd[_0xc7d2('0x45')][_0xc7d2('0x55')][_0xc7d2('0x37')];_0x5c4875+=0x1){_0x1e5ebd[_0xc7d2('0x45')][_0xc7d2('0x55')][_0x5c4875]={'filename':_0x1e5ebd[_0xc7d2('0x45')][_0xc7d2('0x55')][_0x5c4875][_0xc7d2('0x29')],'path':path[_0xc7d2('0x56')](config[_0xc7d2('0x57')],_0xc7d2('0x58'),_0x1e5ebd[_0xc7d2('0x45')][_0xc7d2('0x55')][_0x5c4875][_0xc7d2('0x59')])};}}_0x4dce39={'account':_0x31c857,'message':_0x1e5ebd['body']};return;})[_0xc7d2('0x25')](function(){if(_0x1f4a95[_0xc7d2('0x51')]){if(_0x1f4a95['List'][_0xc7d2('0x5a')][_0xc7d2('0x37')]){return _0x1f4a95['List'][_0xc7d2('0x5a')][0x0];}else{return db['CmContact'][_0xc7d2('0x49')](_[_0xc7d2('0xd')](_0x1e5ebd['body'],{'firstName':_0x1e5ebd[_0xc7d2('0x45')]['to'],'email':_0x1e5ebd['body']['to'],'phone':_0x1e5ebd[_0xc7d2('0x45')]['to'],'ListId':_0x1f4a95[_0xc7d2('0x5b')]}));}}else{throw new Error(_0xc7d2('0x5c'));}})[_0xc7d2('0x25')](function(){if(_0x4dce39){return respondWithRpcPromise('SendMail',_0xc7d2('0x5d'),_0x4dce39,client9003)['then'](function(_0x4de20e){return _0x5c9b3a[_0xc7d2('0x24')]({'read':!![],'messageId':_0x4de20e[_0xc7d2('0x5e')],'sentAt':moment()[_0xc7d2('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xc7d2('0x44')](function(_0x3199df){logger['error']('%s',JSON[_0xc7d2('0x19')](_0x3199df));return _0x5c9b3a;});}return _0x5c9b3a;});}return _0x5c9b3a;}})['then'](respondWithResult(_0x4b0d5d,0xc9))[_0xc7d2('0x44')](handleError(_0x4b0d5d,null));};exports[_0xc7d2('0x60')]=function(_0x3f27c6,_0x341914){var _0x8e15e3={'agent':{},'channel':_0xc7d2('0x61')};if(_0x3f27c6['body']['id']){delete _0x3f27c6[_0xc7d2('0x45')]['id'];}_0x3f27c6[_0xc7d2('0x45')][_0xc7d2('0x62')]=!![];_0x3f27c6[_0xc7d2('0x45')][_0xc7d2('0x63')]=moment()[_0xc7d2('0x5f')](_0xc7d2('0x64'));_0x3f27c6[_0xc7d2('0x45')]['UserId']=_0x3f27c6[_0xc7d2('0x45')]['UserId']||_0x3f27c6['user']['id'];_0x8e15e3[_0xc7d2('0x65')]['id']=_0x3f27c6[_0xc7d2('0x45')][_0xc7d2('0x66')];return db['MailMessage'][_0xc7d2('0x46')]({'where':{'id':_0x3f27c6[_0xc7d2('0x42')]['id'],'UserId':null}})[_0xc7d2('0x25')](handleEntityNotFound(_0x341914,null))[_0xc7d2('0x25')](saveUpdates(_0x3f27c6[_0xc7d2('0x45')],null))[_0xc7d2('0x25')](function(_0xa8f58f){if(_0xa8f58f){_0x8e15e3[_0xc7d2('0x1c')]=_0xa8f58f[_0xc7d2('0x67')]({'plain':!![]});return db[_0xc7d2('0x68')][_0xc7d2('0x46')]({'where':{'id':_0xa8f58f['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x341914,null))[_0xc7d2('0x25')](function(_0x3dba91){if(_0x3dba91){return _0x3dba91[_0xc7d2('0x24')]({'UserId':_0x3f27c6[_0xc7d2('0x45')][_0xc7d2('0x66')],'read1stAt':_[_0xc7d2('0x69')](_0x3dba91[_0xc7d2('0x6a')])?moment()[_0xc7d2('0x5f')](_0xc7d2('0x64')):undefined});}return null;})[_0xc7d2('0x25')](function(_0x35914d){if(_0x35914d){_0x8e15e3['interaction']=_0x35914d[_0xc7d2('0x67')]({'plain':!![]});interaction_log['info'](_0xc7d2('0x6b'),_0x3f27c6[_0xc7d2('0x6c')]['id'],_0x3f27c6['user'][_0xc7d2('0x29')],_0x3f27c6[_0xc7d2('0x6c')]['role'],_0x8e15e3[_0xc7d2('0x6d')]['id'],_0x3f27c6[_0xc7d2('0x45')]?JSON[_0xc7d2('0x19')](_0x3f27c6['body']):_0xc7d2('0x6e'));return respondWithRpcPromise(_0xc7d2('0x6f'),'acceptMessage',_0x8e15e3);}return null;})['then'](function(_0x49b2ed){var _0x5a7b14=_0xc7d2('0x70')+_0x49b2ed[_0xc7d2('0x1c')][_0xc7d2('0x71')];return db[_0xc7d2('0x72')][_0xc7d2('0x32')](_0x5a7b14,{'type':db['Sequelize']['QueryTypes'][_0xc7d2('0x73')],'raw':!![]})[_0xc7d2('0x25')](function(_0x7ce103){return _0x7ce103;});})[_0xc7d2('0x25')](function(_0x253d33){if(_0x253d33){_0x8e15e3[_0xc7d2('0x1c')][_0xc7d2('0x74')]=_0x253d33[0x0];if(!_0x3f27c6['body']['UserId'])return;return db[_0xc7d2('0x75')][_0xc7d2('0x46')]({'where':{'id':_0x3f27c6[_0xc7d2('0x45')][_0xc7d2('0x66')],'role':_0xc7d2('0x65')},'attributes':['id',_0xc7d2('0x29'),_0xc7d2('0x76'),_0xc7d2('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x160b02){if(!_0x160b02)return null;_0x8e15e3[_0xc7d2('0x1c')][_0xc7d2('0x65')]=_0x160b02;return _0x8e15e3;})[_0xc7d2('0x25')](function(_0x17bc79){if(_0x17bc79){if(_0x3f27c6['body'][_0xc7d2('0x78')]){_0x8e15e3[_0xc7d2('0x1c')]['interface']=util[_0xc7d2('0x5f')]('SIP/%s',_0x3f27c6[_0xc7d2('0x6c')][_0xc7d2('0x29')]);_0x8e15e3['message'][_0xc7d2('0x79')]=_0x8e15e3[_0xc7d2('0x79')];_0x8e15e3[_0xc7d2('0x1c')][_0xc7d2('0x7a')]=_0x8e15e3[_0xc7d2('0x79')];_0x8e15e3[_0xc7d2('0x1c')][_0xc7d2('0x7b')]=_0xc7d2('0x60');_0x8e15e3[_0xc7d2('0x1c')][_0xc7d2('0x45')]=htmlToText[_0xc7d2('0x7c')](_0x8e15e3[_0xc7d2('0x1c')]['body']);return respondWithRpcPromise(_0xc7d2('0x7d'),_0xc7d2('0x7d'),{'event':_0xc7d2('0x7e'),'message':_0x8e15e3[_0xc7d2('0x1c')]},client9002)['then'](function(){return _0x8e15e3;});}return _0x8e15e3;}return null;})[_0xc7d2('0x25')](respondWithResult(_0x341914,null))[_0xc7d2('0x44')](handleError(_0x341914,null));};exports[_0xc7d2('0x7f')]=function(_0x173440,_0x40ca00){var _0x352280={'agent':{},'channel':_0xc7d2('0x61')};if(_0x173440[_0xc7d2('0x45')]['id']){delete _0x173440[_0xc7d2('0x45')]['id'];}_0x173440[_0xc7d2('0x45')][_0xc7d2('0x66')]=_0x173440[_0xc7d2('0x45')][_0xc7d2('0x66')]||_0x173440[_0xc7d2('0x6c')]['id'];_0x352280[_0xc7d2('0x65')]['id']=_0x173440[_0xc7d2('0x45')][_0xc7d2('0x66')];return db[_0xc7d2('0x2d')]['find']({'where':{'id':_0x173440[_0xc7d2('0x42')]['id'],'UserId':null}})[_0xc7d2('0x25')](handleEntityNotFound(_0x40ca00,null))[_0xc7d2('0x25')](function(_0xa461de){if(_0xa461de){_0x352280[_0xc7d2('0x1c')]=_0xa461de[_0xc7d2('0x67')]({'plain':!![]});return db[_0xc7d2('0x68')][_0xc7d2('0x46')]({'where':{'id':_0xa461de['MailInteractionId']}});}return null;})[_0xc7d2('0x25')](handleEntityNotFound(_0x40ca00,null))[_0xc7d2('0x25')](function(_0x3c06b7){if(_0x3c06b7){_0x352280[_0xc7d2('0x6d')]=_0x3c06b7[_0xc7d2('0x67')]({'plain':!![]});interaction_log['info'](_0xc7d2('0x80'),_0x173440[_0xc7d2('0x6c')]['id'],_0x173440['user'][_0xc7d2('0x29')],_0x173440[_0xc7d2('0x6c')][_0xc7d2('0x81')],_0x352280[_0xc7d2('0x6d')]['id'],_0x173440[_0xc7d2('0x45')]?JSON[_0xc7d2('0x19')](_0x173440[_0xc7d2('0x45')]):_0xc7d2('0x6e'));return respondWithRpcPromise('RejectMessage',_0xc7d2('0x82'),_0x352280);}return null;})[_0xc7d2('0x25')](function(_0x4d5c0b){var _0x6cb92e=_0xc7d2('0x70')+_0x4d5c0b['message'][_0xc7d2('0x71')];return db[_0xc7d2('0x72')][_0xc7d2('0x32')](_0x6cb92e,{'type':db['Sequelize'][_0xc7d2('0x83')][_0xc7d2('0x73')],'raw':!![]})[_0xc7d2('0x25')](function(_0x2519c0){return _0x2519c0;});})[_0xc7d2('0x25')](function(_0x321bd3){if(_0x321bd3){_0x352280[_0xc7d2('0x1c')][_0xc7d2('0x74')]=_0x321bd3[0x0];if(!_0x173440[_0xc7d2('0x45')][_0xc7d2('0x66')])return;return db['User']['find']({'where':{'id':_0x173440[_0xc7d2('0x45')][_0xc7d2('0x66')],'role':_0xc7d2('0x65')},'attributes':['id',_0xc7d2('0x29'),'fullname','email',_0xc7d2('0x84')],'raw':!![]});}return null;})[_0xc7d2('0x25')](function(_0x6a9ca4){if(!_0x6a9ca4)return null;_0x352280[_0xc7d2('0x1c')][_0xc7d2('0x65')]=_0x6a9ca4;return _0x352280;})[_0xc7d2('0x25')](function(_0x82232d){if(_0x82232d){_0x82232d[_0xc7d2('0x1c')][_0xc7d2('0x85')]=util[_0xc7d2('0x5f')](_0xc7d2('0x86'),_0x173440[_0xc7d2('0x6c')]['name']);_0x82232d[_0xc7d2('0x1c')][_0xc7d2('0x79')]=_0x352280[_0xc7d2('0x79')];_0x82232d['message']['motionChannel']=_0x352280[_0xc7d2('0x79')];_0x82232d[_0xc7d2('0x1c')]['event']='reject';_0x82232d[_0xc7d2('0x1c')][_0xc7d2('0x45')]=htmlToText[_0xc7d2('0x7c')](_0x352280[_0xc7d2('0x1c')]['body']);respondWithRpcPromise(_0xc7d2('0x7d'),_0xc7d2('0x7d'),{'event':'rejectmessage','message':_0x82232d['message']},client9002);return _0x352280;}return null;})[_0xc7d2('0x25')](respondWithResult(_0x40ca00,null))['catch'](handleError(_0x40ca00,null));};exports[_0xc7d2('0x87')]=function(_0x221daa,_0x325d8e){var _0x394236=moment()[_0xc7d2('0x88')]()['toString']();var _0x28cb9b=path[_0xc7d2('0x56')](config[_0xc7d2('0x57')],_0xc7d2('0x89'),_0xc7d2('0x8a'),_0xc7d2('0x8b'));var _0x27196f=path[_0xc7d2('0x56')](config['root'],_0xc7d2('0x89'),'files',_0xc7d2('0x55'));var _0x291d50=util['format'](_0xc7d2('0x8c'),_0x394236);return db[_0xc7d2('0x2d')][_0xc7d2('0x46')]({'where':{'id':_0x221daa[_0xc7d2('0x42')]['id']},'attributes':['id','body',_0xc7d2('0x8d'),'to','cc',_0xc7d2('0x8e'),_0xc7d2('0x8f'),_0xc7d2('0x90')],'include':_0x221daa[_0xc7d2('0x32')]['attachments']?[{'model':db[_0xc7d2('0x91')],'as':_0xc7d2('0x92')}]:undefined})[_0xc7d2('0x25')](handleEntityNotFound(_0x325d8e,null))[_0xc7d2('0x25')](function(_0x6f5c3b){if(_0x6f5c3b){var _0x292431=_0x6f5c3b;var _0x116ad9={'from':_0x292431[_0xc7d2('0x8d')],'to':_0x292431['to'],'subject':_0x292431[_0xc7d2('0x8f')],'html':htmlEntities['decode'](_0x292431[_0xc7d2('0x45')]),'headers':{'Date':moment(_0x292431[_0xc7d2('0x90')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x6f5c3b['cc']){_0x116ad9[_0xc7d2('0x93')]['Cc']=_0x6f5c3b['cc'];}if(_0x6f5c3b['bcc']){_0x116ad9[_0xc7d2('0x93')][_0xc7d2('0x94')]=_0x6f5c3b[_0xc7d2('0x8e')];}return new BPromise(function(_0x23a637,_0x6de86c){if(_0x6f5c3b[_0xc7d2('0x92')]){for(var _0x56be35=0x0;_0x56be35<_0x6f5c3b[_0xc7d2('0x92')][_0xc7d2('0x37')];_0x56be35++){var _0x5e70e8=_0x6f5c3b['Attachments'][_0x56be35];var _0x3e11a0=path[_0xc7d2('0x56')](_0x27196f,_0x5e70e8['basename']);if(fs[_0xc7d2('0x95')](_0x3e11a0)){_0x116ad9['attachments'][_0xc7d2('0x96')]({'name':_0x5e70e8[_0xc7d2('0x29')],'contentType':_0x5e70e8[_0xc7d2('0x2f')],'data':fs[_0xc7d2('0x97')](_0x3e11a0)});}}}emlformat['build'](_0x116ad9,function(_0xdf7423,_0x2621f6){if(_0xdf7423)return _0x6de86c(_0xdf7423);fs[_0xc7d2('0x98')](path[_0xc7d2('0x56')](_0x28cb9b,_0x291d50),_0x2621f6);return _0x23a637(_0x2621f6);});});}})[_0xc7d2('0x25')](function(_0x27fb2b){if(_0x27fb2b){return _0x325d8e[_0xc7d2('0x87')](path[_0xc7d2('0x56')](_0x28cb9b,_0x291d50),_0x291d50,function(_0x5b198a){if(!_0x5b198a)fs[_0xc7d2('0x99')](path[_0xc7d2('0x56')](_0x28cb9b,_0x291d50));});}})[_0xc7d2('0x44')](handleError(_0x325d8e,null));}; \ No newline at end of file +var _0x6916=['intersection','fields','length','nolimit','limit','order','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','show','params','include','find','body','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','CmContact','defaults','ListId','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','format','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','rejectMessage','interface','rejectmessage','unix','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','push','build','download','eml-format','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','catch','status','json','offset','undefined','count','update','destroy','sendStatus','stack','name','index','MailMessage','rawAttributes','fieldName','model','map','query','keys','filters','attributes'];(function(_0x18ee20,_0x36eff5){var _0x267bd6=function(_0x566e6a){while(--_0x566e6a){_0x18ee20['push'](_0x18ee20['shift']());}};_0x267bd6(++_0x36eff5);}(_0x6916,0x101));var _0x6691=function(_0x5cccb1,_0x5acf56){_0x5cccb1=_0x5cccb1-0x0;var _0xa6083b=_0x6916[_0x5cccb1];return _0xa6083b;};'use strict';var emlformat=require(_0x6691('0x0'));var moment=require('moment');var BPromise=require(_0x6691('0x1'));var util=require(_0x6691('0x2'));var path=require(_0x6691('0x3'));var fs=require('fs');var _=require(_0x6691('0x4'));var Redis=require('ioredis');var htmlToText=require(_0x6691('0x5'));var qs=require(_0x6691('0x6'));var logger=require(_0x6691('0x7'))(_0x6691('0x8'));var interaction_log=require(_0x6691('0x7'))(_0x6691('0x9'));var config=require(_0x6691('0xa'));var db=require(_0x6691('0xb'))['db'];config['redis']=_['defaults'](config[_0x6691('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6691('0xd'))(new Redis(config[_0x6691('0xc')]));var htmlEntities=require('html-entities');require(_0x6691('0xe'))['register'](socket);var jayson=require(_0x6691('0xf'));var client=jayson[_0x6691('0x10')][_0x6691('0x11')]({'port':0x232c});var client9003=jayson['client'][_0x6691('0x11')]({'port':0x232b});var client9002=jayson[_0x6691('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b40b1,_0x31aba9,_0x166c11,_0x1a40d6){return new BPromise(function(_0x46036c,_0x333433){var _0x303fc6=_0x1a40d6||client;return _0x303fc6[_0x6691('0x12')](_0x5b40b1,_0x166c11)[_0x6691('0x13')](function(_0x4e08e3){logger[_0x6691('0x14')]('MailMessage,\x20%s,\x20%s',_0x31aba9,_0x6691('0x15'));logger[_0x6691('0x16')](_0x6691('0x17'),_0x31aba9,_0x6691('0x15'),JSON[_0x6691('0x18')](_0x4e08e3));if(_0x4e08e3[_0x6691('0x19')]){if(_0x4e08e3[_0x6691('0x19')]['code']===0x1f4){logger['error'](_0x6691('0x1a'),_0x31aba9,_0x4e08e3[_0x6691('0x19')][_0x6691('0x1b')]);return _0x333433(_0x4e08e3[_0x6691('0x19')][_0x6691('0x1b')]);}logger[_0x6691('0x19')](_0x6691('0x1a'),_0x31aba9,_0x4e08e3[_0x6691('0x19')]['message']);return _0x46036c(_0x4e08e3['error'][_0x6691('0x1b')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x31aba9,_0x6691('0x15'));_0x46036c(_0x4e08e3['result'][_0x6691('0x1b')]);}})[_0x6691('0x1c')](function(_0xa316d0){logger[_0x6691('0x19')](_0x6691('0x1a'),_0x31aba9,_0xa316d0);_0x333433(_0xa316d0);});});}function respondWithResult(_0x21e27f,_0x199ecc){_0x199ecc=_0x199ecc||0xc8;return function(_0x218e34){if(_0x218e34){return _0x21e27f[_0x6691('0x1d')](_0x199ecc)[_0x6691('0x1e')](_0x218e34);}};}function respondWithFilteredResult(_0x10cd08,_0x2f8e1e){return function(_0x383bf2){if(_0x383bf2){var _0x53d5d2=typeof _0x2f8e1e[_0x6691('0x1f')]===_0x6691('0x20')&&typeof _0x2f8e1e['limit']===_0x6691('0x20');var _0x479e22=_0x383bf2[_0x6691('0x21')];var _0x3142e6=_0x53d5d2?0x0:_0x2f8e1e[_0x6691('0x1f')];var _0x3bc171=_0x53d5d2?_0x383bf2['count']:_0x2f8e1e[_0x6691('0x1f')]+_0x2f8e1e['limit'];var _0x29445e;if(_0x3bc171>=_0x479e22){_0x3bc171=_0x479e22;_0x29445e=0xc8;}else{_0x29445e=0xce;}_0x10cd08[_0x6691('0x1d')](_0x29445e);return _0x10cd08['set']('Content-Range',_0x3142e6+'-'+_0x3bc171+'/'+_0x479e22)[_0x6691('0x1e')](_0x383bf2);}return null;};}function saveUpdates(_0x4ad582){return function(_0x4d8a54){if(_0x4d8a54){return _0x4d8a54[_0x6691('0x22')](_0x4ad582)['then'](function(_0x133114){return _0x133114;});}return null;};}function removeEntity(_0x50bc93){return function(_0x306efb){if(_0x306efb){return _0x306efb[_0x6691('0x23')]()[_0x6691('0x13')](function(){_0x50bc93['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x515459){return function(_0x1541dc){if(!_0x1541dc){_0x515459[_0x6691('0x24')](0x194);}return _0x1541dc;};}function handleError(_0x3a85a8,_0x317012){_0x317012=_0x317012||0x1f4;return function(_0x40c390){logger[_0x6691('0x19')](_0x40c390[_0x6691('0x25')]);if(_0x40c390['name']){delete _0x40c390[_0x6691('0x26')];}_0x3a85a8[_0x6691('0x1d')](_0x317012)['send'](_0x40c390);};}exports[_0x6691('0x27')]=function(_0x194dfd,_0x93d1ec){var _0x76eafe={},_0x1d9dd2={},_0x472a09={'count':0x0,'rows':[]};var _0x2225a5=_['map'](db[_0x6691('0x28')][_0x6691('0x29')],function(_0xe22094){return{'name':_0xe22094[_0x6691('0x2a')],'type':_0xe22094['type']['key']};});_0x1d9dd2[_0x6691('0x2b')]=_[_0x6691('0x2c')](_0x2225a5,_0x6691('0x26'));_0x1d9dd2[_0x6691('0x2d')]=_[_0x6691('0x2e')](_0x194dfd[_0x6691('0x2d')]);_0x1d9dd2[_0x6691('0x2f')]=_['intersection'](_0x1d9dd2[_0x6691('0x2b')],_0x1d9dd2[_0x6691('0x2d')]);_0x76eafe[_0x6691('0x30')]=_[_0x6691('0x31')](_0x1d9dd2[_0x6691('0x2b')],qs[_0x6691('0x32')](_0x194dfd[_0x6691('0x2d')][_0x6691('0x32')]));_0x76eafe['attributes']=_0x76eafe[_0x6691('0x30')][_0x6691('0x33')]?_0x76eafe[_0x6691('0x30')]:_0x1d9dd2['model'];if(!_0x194dfd[_0x6691('0x2d')]['hasOwnProperty'](_0x6691('0x34'))){_0x76eafe['limit']=qs[_0x6691('0x35')](_0x194dfd['query']['limit']);_0x76eafe[_0x6691('0x1f')]=qs[_0x6691('0x1f')](_0x194dfd[_0x6691('0x2d')][_0x6691('0x1f')]);}_0x76eafe[_0x6691('0x36')]=qs['sort'](_0x194dfd[_0x6691('0x2d')]['sort']);_0x76eafe[_0x6691('0x37')]=qs[_0x6691('0x2f')](_[_0x6691('0x38')](_0x194dfd[_0x6691('0x2d')],_0x1d9dd2[_0x6691('0x2f')]),_0x2225a5);if(_0x194dfd[_0x6691('0x2d')][_0x6691('0x39')]){_0x76eafe['where']=_[_0x6691('0x3a')](_0x76eafe['where'],{'$or':_[_0x6691('0x2c')](_0x2225a5,function(_0xcf5a81){if(_0xcf5a81[_0x6691('0x3b')]!==_0x6691('0x3c')){var _0x434483={};_0x434483[_0xcf5a81['name']]={'$like':'%'+_0x194dfd[_0x6691('0x2d')]['filter']+'%'};return _0x434483;}})});}_0x76eafe=_['merge']({},_0x76eafe,_0x194dfd[_0x6691('0x3d')]);var _0x122c10={'where':_0x76eafe[_0x6691('0x37')]};return db['MailMessage'][_0x6691('0x21')](_0x122c10)['then'](function(_0x368850){_0x472a09[_0x6691('0x21')]=_0x368850;if(_0x194dfd[_0x6691('0x2d')]['includeAll']){_0x76eafe['include']=[{'all':!![]}];}return db[_0x6691('0x28')][_0x6691('0x3e')](_0x76eafe);})[_0x6691('0x13')](function(_0x1b369c){_0x472a09[_0x6691('0x3f')]=_0x1b369c;return _0x472a09;})[_0x6691('0x13')](respondWithFilteredResult(_0x93d1ec,_0x76eafe))['catch'](handleError(_0x93d1ec,null));};exports[_0x6691('0x40')]=function(_0x5bc8ae,_0x54afc1){var _0x56a3cb={'raw':!![],'where':{'id':_0x5bc8ae[_0x6691('0x41')]['id']}},_0x2db874={};_0x2db874[_0x6691('0x2b')]=_[_0x6691('0x2e')](db[_0x6691('0x28')][_0x6691('0x29')]);_0x2db874[_0x6691('0x2d')]=_[_0x6691('0x2e')](_0x5bc8ae['query']);_0x2db874[_0x6691('0x2f')]=_[_0x6691('0x31')](_0x2db874[_0x6691('0x2b')],_0x2db874['query']);_0x56a3cb['attributes']=_[_0x6691('0x31')](_0x2db874['model'],qs[_0x6691('0x32')](_0x5bc8ae[_0x6691('0x2d')][_0x6691('0x32')]));_0x56a3cb[_0x6691('0x30')]=_0x56a3cb['attributes']['length']?_0x56a3cb[_0x6691('0x30')]:_0x2db874['model'];if(_0x5bc8ae[_0x6691('0x2d')]['includeAll']){_0x56a3cb[_0x6691('0x42')]=[{'all':!![]}];}_0x56a3cb=_[_0x6691('0x3a')]({},_0x56a3cb,_0x5bc8ae['options']);return db[_0x6691('0x28')][_0x6691('0x43')](_0x56a3cb)['then'](handleEntityNotFound(_0x54afc1,null))['then'](respondWithResult(_0x54afc1,null))[_0x6691('0x1c')](handleError(_0x54afc1,null));};exports[_0x6691('0x22')]=function(_0x494b0d,_0x57d3c5){if(_0x494b0d[_0x6691('0x44')]['id']){delete _0x494b0d[_0x6691('0x44')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x494b0d[_0x6691('0x41')]['id']}})[_0x6691('0x13')](handleEntityNotFound(_0x57d3c5,null))[_0x6691('0x13')](saveUpdates(_0x494b0d['body'],null))[_0x6691('0x13')](respondWithResult(_0x57d3c5,null))[_0x6691('0x1c')](handleError(_0x57d3c5,null));};exports[_0x6691('0x23')]=function(_0x30e831,_0x3df887){return db['MailMessage'][_0x6691('0x43')]({'where':{'id':_0x30e831[_0x6691('0x41')]['id']}})[_0x6691('0x13')](handleEntityNotFound(_0x3df887,null))[_0x6691('0x13')](removeEntity(_0x3df887,null))[_0x6691('0x1c')](handleError(_0x3df887,null));};exports['describe']=function(_0x5f2864,_0x1714a8){return db[_0x6691('0x28')]['describe']()['then'](respondWithResult(_0x1714a8,null))['catch'](handleError(_0x1714a8,null));};exports[_0x6691('0x45')]=function(_0x1dab74,_0x44aeb6){return db['MailMessage'][_0x6691('0x45')](_0x1dab74[_0x6691('0x44')])[_0x6691('0x13')](function(_0xc120a4){if(_0xc120a4){if(_0xc120a4[_0x6691('0x46')]===_0x6691('0x47')&&!_0xc120a4[_0x6691('0x48')]){var _0xfa79cd,_0x1b4a57,_0x3480f9;if(_0x1dab74[_0x6691('0x44')]['to']){_0x1b4a57=_0x1dab74[_0x6691('0x44')]['to'][_0x6691('0x49')](',')[0x0];}return db[_0x6691('0x4a')][_0x6691('0x4b')]({'where':{'id':_0xc120a4[_0x6691('0x4c')]},'include':[{'model':db[_0x6691('0x4d')],'as':_0x6691('0x4e'),'include':[{'model':db['CmContact'],'as':_0x6691('0x4f'),'where':{'email':_0x1b4a57},'limit':0x1,'order':[[_0x6691('0x50'),_0x6691('0x51')]]}]},{'model':db['MailServerOut'],'as':_0x6691('0x52'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6691('0x53'),'raw':!![]}]}]})[_0x6691('0x13')](function(_0x285a8b){_0xfa79cd=_0x285a8b;if(!_0xfa79cd||!_0xfa79cd[_0x6691('0x52')])return;var _0x26baba=_0xfa79cd[_0x6691('0x54')]();if(_0x1dab74['body'][_0x6691('0x55')]&&_0x1dab74['body'][_0x6691('0x55')][_0x6691('0x33')]){for(var _0x535da6=0x0;_0x535da6<_0x1dab74['body'][_0x6691('0x55')][_0x6691('0x33')];_0x535da6+=0x1){_0x1dab74[_0x6691('0x44')][_0x6691('0x55')][_0x535da6]={'filename':_0x1dab74[_0x6691('0x44')][_0x6691('0x55')][_0x535da6][_0x6691('0x26')],'path':path[_0x6691('0x56')](config[_0x6691('0x57')],_0x6691('0x58'),_0x1dab74[_0x6691('0x44')][_0x6691('0x55')][_0x535da6][_0x6691('0x59')])};}}_0x3480f9={'account':_0x26baba,'message':_0x1dab74[_0x6691('0x44')]};return;})[_0x6691('0x13')](function(){if(_0xfa79cd['List']){if(_0xfa79cd['List'][_0x6691('0x4f')]['length']){return _0xfa79cd['List']['Contacts'][0x0];}else{return db[_0x6691('0x5a')][_0x6691('0x45')](_[_0x6691('0x5b')](_0x1dab74[_0x6691('0x44')],{'firstName':_0x1dab74[_0x6691('0x44')]['to'],'email':_0x1dab74['body']['to'],'phone':_0x1dab74[_0x6691('0x44')]['to'],'ListId':_0xfa79cd[_0x6691('0x5c')]}));}}else{throw new Error(_0x6691('0x5d'));}})[_0x6691('0x13')](function(){if(_0x3480f9){return respondWithRpcPromise(_0x6691('0x5e'),'sendMail',_0x3480f9,client9003)[_0x6691('0x13')](function(_0x2e5a5f){return _0xc120a4[_0x6691('0x22')]({'read':!![],'messageId':_0x2e5a5f[_0x6691('0x5f')],'sentAt':moment()['format'](_0x6691('0x60'))});})[_0x6691('0x1c')](function(_0x8d3369){logger[_0x6691('0x19')]('%s',JSON[_0x6691('0x18')](_0x8d3369));return _0xc120a4;});}return _0xc120a4;});}return _0xc120a4;}})[_0x6691('0x13')](respondWithResult(_0x44aeb6,0xc9))['catch'](handleError(_0x44aeb6,null));};exports[_0x6691('0x61')]=function(_0x4ebb8d,_0x593d30){var _0x31a21e={'agent':{},'channel':_0x6691('0x62')};if(_0x4ebb8d['body']['id']){delete _0x4ebb8d[_0x6691('0x44')]['id'];}_0x4ebb8d['body'][_0x6691('0x63')]=!![];_0x4ebb8d['body']['readAt']=moment()[_0x6691('0x64')](_0x6691('0x60'));_0x4ebb8d[_0x6691('0x44')][_0x6691('0x65')]=_0x4ebb8d[_0x6691('0x44')][_0x6691('0x65')]||_0x4ebb8d['user']['id'];_0x31a21e['agent']['id']=_0x4ebb8d[_0x6691('0x44')][_0x6691('0x65')];return db[_0x6691('0x28')]['find']({'where':{'id':_0x4ebb8d[_0x6691('0x41')]['id'],'UserId':null}})[_0x6691('0x13')](handleEntityNotFound(_0x593d30,null))[_0x6691('0x13')](saveUpdates(_0x4ebb8d['body'],null))[_0x6691('0x13')](function(_0x558f7c){if(_0x558f7c){_0x31a21e[_0x6691('0x1b')]=_0x558f7c[_0x6691('0x66')]({'plain':!![]});return db[_0x6691('0x67')][_0x6691('0x43')]({'where':{'id':_0x558f7c[_0x6691('0x68')]}});}return null;})[_0x6691('0x13')](handleEntityNotFound(_0x593d30,null))[_0x6691('0x13')](function(_0x4c8f40){if(_0x4c8f40){return _0x4c8f40['update']({'UserId':_0x4ebb8d['body'][_0x6691('0x65')],'read1stAt':_['isNil'](_0x4c8f40[_0x6691('0x69')])?moment()['format'](_0x6691('0x60')):undefined});}return null;})[_0x6691('0x13')](function(_0x1f2486){if(_0x1f2486){_0x31a21e[_0x6691('0x6a')]=_0x1f2486[_0x6691('0x66')]({'plain':!![]});interaction_log['info'](_0x6691('0x6b'),_0x4ebb8d[_0x6691('0x6c')]['id'],_0x4ebb8d[_0x6691('0x6c')]['name'],_0x4ebb8d[_0x6691('0x6c')][_0x6691('0x6d')],_0x31a21e['interaction']['id'],_0x4ebb8d['body']?JSON[_0x6691('0x18')](_0x4ebb8d[_0x6691('0x44')]):_0x6691('0x6e'));return respondWithRpcPromise(_0x6691('0x6f'),_0x6691('0x70'),_0x31a21e);}return null;})[_0x6691('0x13')](function(_0x1c9c12){var _0x15bf4a=_0x6691('0x71')+_0x1c9c12[_0x6691('0x1b')][_0x6691('0x72')];return db[_0x6691('0x73')]['query'](_0x15bf4a,{'type':db[_0x6691('0x74')][_0x6691('0x75')][_0x6691('0x76')],'raw':!![]})['then'](function(_0x2bc618){return _0x2bc618;});})['then'](function(_0x468ce4){if(_0x468ce4){_0x31a21e[_0x6691('0x1b')][_0x6691('0x77')]=_0x468ce4[0x0];if(!_0x4ebb8d[_0x6691('0x44')]['UserId'])return;return db[_0x6691('0x78')][_0x6691('0x43')]({'where':{'id':_0x4ebb8d[_0x6691('0x44')][_0x6691('0x65')],'role':_0x6691('0x79')},'attributes':['id',_0x6691('0x26'),_0x6691('0x7a'),_0x6691('0x7b'),_0x6691('0x7c')],'raw':!![]});}return null;})[_0x6691('0x13')](function(_0x443640){if(!_0x443640)return null;_0x31a21e[_0x6691('0x1b')][_0x6691('0x79')]=_0x443640;return _0x31a21e;})[_0x6691('0x13')](function(_0x21069c){if(_0x21069c){if(_0x4ebb8d[_0x6691('0x44')]['manual']){_0x31a21e['message']['interface']=util['format'](_0x6691('0x7d'),_0x4ebb8d['user'][_0x6691('0x26')]);_0x31a21e[_0x6691('0x1b')][_0x6691('0x7e')]=_0x31a21e[_0x6691('0x7e')];_0x31a21e['message'][_0x6691('0x7f')]=_0x31a21e['channel'];_0x31a21e[_0x6691('0x1b')][_0x6691('0x80')]='accept';_0x31a21e['message']['body']=htmlToText[_0x6691('0x81')](_0x31a21e['message'][_0x6691('0x44')]);return respondWithRpcPromise(_0x6691('0x82'),'EventManager',{'event':_0x6691('0x83'),'message':_0x31a21e[_0x6691('0x1b')]},client9002)['then'](function(){return _0x31a21e;});}return _0x31a21e;}return null;})['then'](respondWithResult(_0x593d30,null))[_0x6691('0x1c')](handleError(_0x593d30,null));};exports[_0x6691('0x84')]=function(_0x14f8c1,_0x28cadf){var _0x54b85e={'agent':{},'channel':_0x6691('0x62')};if(_0x14f8c1['body']['id']){delete _0x14f8c1[_0x6691('0x44')]['id'];}_0x14f8c1[_0x6691('0x44')][_0x6691('0x65')]=_0x14f8c1[_0x6691('0x44')][_0x6691('0x65')]||_0x14f8c1['user']['id'];_0x54b85e['agent']['id']=_0x14f8c1[_0x6691('0x44')][_0x6691('0x65')];return db['MailMessage'][_0x6691('0x43')]({'where':{'id':_0x14f8c1[_0x6691('0x41')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x28cadf,null))[_0x6691('0x13')](function(_0x1e1179){if(_0x1e1179){_0x54b85e[_0x6691('0x1b')]=_0x1e1179[_0x6691('0x66')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x1e1179['MailInteractionId']}});}return null;})[_0x6691('0x13')](handleEntityNotFound(_0x28cadf,null))[_0x6691('0x13')](function(_0x532e68){if(_0x532e68){_0x54b85e[_0x6691('0x6a')]=_0x532e68[_0x6691('0x66')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x14f8c1[_0x6691('0x6c')]['id'],_0x14f8c1[_0x6691('0x6c')][_0x6691('0x26')],_0x14f8c1[_0x6691('0x6c')][_0x6691('0x6d')],_0x54b85e[_0x6691('0x6a')]['id'],_0x14f8c1[_0x6691('0x44')]?JSON['stringify'](_0x14f8c1['body']):_0x6691('0x6e'));return respondWithRpcPromise('RejectMessage',_0x6691('0x85'),_0x54b85e);}return null;})['then'](function(_0x5b6ddc){var _0x1cbd69=_0x6691('0x71')+_0x5b6ddc[_0x6691('0x1b')][_0x6691('0x72')];return db[_0x6691('0x73')][_0x6691('0x2d')](_0x1cbd69,{'type':db[_0x6691('0x74')][_0x6691('0x75')][_0x6691('0x76')],'raw':!![]})['then'](function(_0x12d231){return _0x12d231;});})[_0x6691('0x13')](function(_0x28aff2){if(_0x28aff2){_0x54b85e[_0x6691('0x1b')][_0x6691('0x77')]=_0x28aff2[0x0];if(!_0x14f8c1[_0x6691('0x44')]['UserId'])return;return db['User'][_0x6691('0x43')]({'where':{'id':_0x14f8c1[_0x6691('0x44')][_0x6691('0x65')],'role':_0x6691('0x79')},'attributes':['id','name',_0x6691('0x7a'),_0x6691('0x7b'),_0x6691('0x7c')],'raw':!![]});}return null;})['then'](function(_0x46320a){if(!_0x46320a)return null;_0x54b85e[_0x6691('0x1b')][_0x6691('0x79')]=_0x46320a;return _0x54b85e;})[_0x6691('0x13')](function(_0x32bba9){if(_0x32bba9){_0x32bba9[_0x6691('0x1b')][_0x6691('0x86')]=util['format'](_0x6691('0x7d'),_0x14f8c1[_0x6691('0x6c')][_0x6691('0x26')]);_0x32bba9[_0x6691('0x1b')][_0x6691('0x7e')]=_0x54b85e[_0x6691('0x7e')];_0x32bba9['message'][_0x6691('0x7f')]=_0x54b85e['channel'];_0x32bba9['message'][_0x6691('0x80')]='reject';_0x32bba9[_0x6691('0x1b')][_0x6691('0x44')]=htmlToText[_0x6691('0x81')](_0x54b85e[_0x6691('0x1b')]['body']);respondWithRpcPromise(_0x6691('0x82'),_0x6691('0x82'),{'event':_0x6691('0x87'),'message':_0x32bba9[_0x6691('0x1b')]},client9002);return _0x54b85e;}return null;})['then'](respondWithResult(_0x28cadf,null))[_0x6691('0x1c')](handleError(_0x28cadf,null));};exports['download']=function(_0x5b2446,_0x3a1428){var _0x2cd7cb=moment()[_0x6691('0x88')]()['toString']();var _0x3dbe15=path[_0x6691('0x56')](config['root'],_0x6691('0x89'),'files','tmp');var _0x386b5f=path[_0x6691('0x56')](config['root'],'server',_0x6691('0x8a'),_0x6691('0x55'));var _0x23fdf7=util[_0x6691('0x64')](_0x6691('0x8b'),_0x2cd7cb);return db['MailMessage'][_0x6691('0x43')]({'where':{'id':_0x5b2446[_0x6691('0x41')]['id']},'attributes':['id',_0x6691('0x44'),_0x6691('0x8c'),'to','cc',_0x6691('0x8d'),_0x6691('0x8e'),_0x6691('0x8f')],'include':_0x5b2446[_0x6691('0x2d')][_0x6691('0x55')]?[{'model':db[_0x6691('0x90')],'as':'Attachments'}]:undefined})[_0x6691('0x13')](handleEntityNotFound(_0x3a1428,null))['then'](function(_0x5a7e4f){if(_0x5a7e4f){var _0x41a384=_0x5a7e4f;var _0x384758={'from':_0x41a384['from'],'to':_0x41a384['to'],'subject':_0x41a384[_0x6691('0x8e')],'html':htmlEntities[_0x6691('0x91')](_0x41a384[_0x6691('0x44')]),'headers':{'Date':moment(_0x41a384[_0x6691('0x8f')])[_0x6691('0x64')](_0x6691('0x92'))},'attachments':[]};if(_0x5a7e4f['cc']){_0x384758[_0x6691('0x93')]['Cc']=_0x5a7e4f['cc'];}if(_0x5a7e4f[_0x6691('0x8d')]){_0x384758[_0x6691('0x93')][_0x6691('0x94')]=_0x5a7e4f[_0x6691('0x8d')];}return new BPromise(function(_0x2bd89f,_0x5b559b){if(_0x5a7e4f[_0x6691('0x95')]){for(var _0x296fa2=0x0;_0x296fa2<_0x5a7e4f[_0x6691('0x95')][_0x6691('0x33')];_0x296fa2++){var _0x10ae7a=_0x5a7e4f[_0x6691('0x95')][_0x296fa2];var _0x52251f=path[_0x6691('0x56')](_0x386b5f,_0x10ae7a[_0x6691('0x59')]);if(fs['existsSync'](_0x52251f)){_0x384758[_0x6691('0x55')][_0x6691('0x96')]({'name':_0x10ae7a['name'],'contentType':_0x10ae7a[_0x6691('0x3b')],'data':fs['readFileSync'](_0x52251f)});}}}emlformat[_0x6691('0x97')](_0x384758,function(_0x2d7793,_0x9a70){if(_0x2d7793)return _0x5b559b(_0x2d7793);fs['writeFileSync'](path['join'](_0x3dbe15,_0x23fdf7),_0x9a70);return _0x2bd89f(_0x9a70);});});}})[_0x6691('0x13')](function(_0x2ed6fb){if(_0x2ed6fb){return _0x3a1428[_0x6691('0x98')](path[_0x6691('0x56')](_0x3dbe15,_0x23fdf7),_0x23fdf7,function(_0x5e5330){if(!_0x5e5330)fs['unlinkSync'](path[_0x6691('0x56')](_0x3dbe15,_0x23fdf7));});}})['catch'](handleError(_0x3a1428,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index b1b8ad6..dcafc38 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 _0xf92d=['../../mysqldb','MailMessage','save','emit','hasOwnProperty','hook'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xf92d,0xa8));var _0xdf92=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf92d[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xdf92('0x0'))['db'][_0xdf92('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdf92('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x126582){return function(_0x3e0835,_0x127b04,_0x533e46){MailMessageEvents[_0xdf92('0x3')](_0x126582+':'+_0x3e0835['id'],_0x3e0835);MailMessageEvents['emit'](_0x126582,_0x3e0835);_0x533e46(null);};}for(var e in events){if(events[_0xdf92('0x4')](e)){var event=events[e];MailMessage[_0xdf92('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x80f6=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x36d343,_0x1dc768){var _0x473820=function(_0x1b43df){while(--_0x1b43df){_0x36d343['push'](_0x36d343['shift']());}};_0x473820(++_0x1dc768);}(_0x80f6,0x132));var _0x680f=function(_0x41a24d,_0x5f20ad){_0x41a24d=_0x41a24d-0x0;var _0x3478ac=_0x80f6[_0x41a24d];return _0x3478ac;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x680f('0x0'))['db'][_0x680f('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x680f('0x2')](0x0);var events={'afterCreate':_0x680f('0x3'),'afterUpdate':_0x680f('0x4'),'afterDestroy':_0x680f('0x5')};function emitEvent(_0x19ef44){return function(_0x2ed5c3,_0x5a8e17,_0x5f4d7f){MailMessageEvents['emit'](_0x19ef44+':'+_0x2ed5c3['id'],_0x2ed5c3);MailMessageEvents[_0x680f('0x6')](_0x19ef44,_0x2ed5c3);_0x5f4d7f(null);};}for(var e in events){if(events[_0x680f('0x7')](e)){var event=events[e];MailMessage[_0x680f('0x8')](e,emitEvent(event));}}module[_0x680f('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 8141a3e..9e6c624 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 _0xc4dd=['FULLTEXT','body','plainBody','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject'];(function(_0x1615c4,_0x32cb62){var _0x561ffc=function(_0x53aeec){while(--_0x53aeec){_0x1615c4['push'](_0x1615c4['shift']());}};_0x561ffc(++_0x32cb62);}(_0xc4dd,0x1c3));var _0xdc4d=function(_0x1a2bd7,_0x45f1b2){_0x1a2bd7=_0x1a2bd7-0x0;var _0x3dd4c7=_0xc4dd[_0x1a2bd7];return _0x3dd4c7;};'use strict';var _=require('lodash');var util=require(_0xdc4d('0x0'));var logger=require(_0xdc4d('0x1'))(_0xdc4d('0x2'));var moment=require(_0xdc4d('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc4d('0x4'));var htmlToText=require(_0xdc4d('0x5'));var fs=require('fs');var path=require(_0xdc4d('0x6'));var rimraf=require(_0xdc4d('0x7'));var config=require(_0xdc4d('0x8'));var attributes=require(_0xdc4d('0x9'));module[_0xdc4d('0xa')]=function(_0x2894a6,_0x587149){return _0x2894a6[_0xdc4d('0xb')](_0xdc4d('0xc'),attributes,{'tableName':_0xdc4d('0xd'),'paranoid':![],'indexes':[{'name':_0xdc4d('0xe'),'fields':[_0xdc4d('0xe')]},{'name':_0xdc4d('0xf'),'fields':['plainBody',_0xdc4d('0x10')],'type':_0xdc4d('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x200d66,_0x2a3bdb,_0x4ef113){if(_0x200d66[_0xdc4d('0x12')]){_0x200d66[_0xdc4d('0x13')]=htmlToText[_0xdc4d('0x14')](_0x200d66[_0xdc4d('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4ef113(null,_0x2a3bdb);},'afterCreate':function(_0xf3966f,_0xb1e5b2,_0x5878b5){var _0x4c5c82=_0x2894a6[_0xdc4d('0x15')];var _0x4cbe90=_0xf3966f['get']({'plain':!![]});if(_0x4cbe90[_0xdc4d('0x16')][_0xdc4d('0x17')]()==='in'||_0x4cbe90['direction'][_0xdc4d('0x17')]()===_0xdc4d('0x18')&&!_0x4cbe90[_0xdc4d('0x19')]&&!_[_0xdc4d('0x1a')](_0x4cbe90[_0xdc4d('0x1b')])){_0x4c5c82[_0xdc4d('0x1c')][_0xdc4d('0x1d')]({'where':{'id':_0x4cbe90[_0xdc4d('0x1e')]}})[_0xdc4d('0x1f')](function(_0x1472cd){if(_0x1472cd){_0x1472cd[_0xdc4d('0x20')]({'lastMsgAt':_0x4cbe90['createdAt'],'lastMsgDirection':_0x4cbe90[_0xdc4d('0x16')][_0xdc4d('0x17')]()});}})['catch'](function(_0x40d4d7){console[_0xdc4d('0x21')](_0x40d4d7);});}_0x5878b5();}},'charset':_0xdc4d('0x22'),'collate':_0xdc4d('0x23')});}; \ No newline at end of file +var _0x54d8=['mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','isNil','UserId','findOne','MailInteractionId','then','update','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define'];(function(_0x349444,_0x5cacba){var _0x4efe6a=function(_0x117034){while(--_0x117034){_0x349444['push'](_0x349444['shift']());}};_0x4efe6a(++_0x5cacba);}(_0x54d8,0xfc));var _0x854d=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x54d8[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x854d('0x0'));var util=require(_0x854d('0x1'));var logger=require('../../config/logger')(_0x854d('0x2'));var moment=require(_0x854d('0x3'));var BPromise=require(_0x854d('0x4'));var rp=require(_0x854d('0x5'));var htmlToText=require(_0x854d('0x6'));var fs=require('fs');var path=require(_0x854d('0x7'));var rimraf=require(_0x854d('0x8'));var config=require(_0x854d('0x9'));var attributes=require('./mailMessage.attributes');module[_0x854d('0xa')]=function(_0x94e79d,_0x289725){return _0x94e79d[_0x854d('0xb')]('MailMessage',attributes,{'tableName':_0x854d('0xc'),'paranoid':![],'indexes':[{'name':_0x854d('0xd'),'fields':[_0x854d('0xd')]},{'name':_0x854d('0xe'),'fields':[_0x854d('0xf'),_0x854d('0x10')],'type':_0x854d('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1cbdf3,_0xb08d40,_0x78ea01){if(_0x1cbdf3[_0x854d('0x12')]){_0x1cbdf3[_0x854d('0xf')]=htmlToText['fromString'](_0x1cbdf3[_0x854d('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x78ea01(null,_0xb08d40);},'afterCreate':function(_0x290e69,_0x37a4cf,_0x5e9fbb){var _0x714256=_0x94e79d[_0x854d('0x13')];var _0x254b9c=_0x290e69[_0x854d('0x14')]({'plain':!![]});if(_0x254b9c[_0x854d('0x15')][_0x854d('0x16')]()==='in'||_0x254b9c[_0x854d('0x15')][_0x854d('0x16')]()===_0x854d('0x17')&&!_0x254b9c['secret']&&!_[_0x854d('0x18')](_0x254b9c[_0x854d('0x19')])){_0x714256['MailInteraction'][_0x854d('0x1a')]({'where':{'id':_0x254b9c[_0x854d('0x1b')]}})[_0x854d('0x1c')](function(_0x5528f6){if(_0x5528f6){_0x5528f6[_0x854d('0x1d')]({'lastMsgAt':_0x254b9c['createdAt'],'lastMsgDirection':_0x254b9c['direction'][_0x854d('0x16')]()});}})[_0x854d('0x1e')](function(_0x40ec99){console[_0x854d('0x1f')](_0x40ec99);});}_0x5e9fbb();}},'charset':'utf8mb4','collate':_0x854d('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 7e5826e..8aa51d9 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 _0x1eba=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','then','info','request\x20sent','debug','error','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0x1eba[_0x12ddb2];return _0x10b6dd;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});config[_0xa1eb('0xc')]=_[_0xa1eb('0xd')](config[_0xa1eb('0xc')],{'host':_0xa1eb('0xe'),'port':0x18eb});var socket=require(_0xa1eb('0xf'))(new Redis(config['redis']));require(_0xa1eb('0x10'))['register'](socket);function respondWithRpcPromise(_0x219802,_0x54cdad,_0x3f53ff){return new BPromise(function(_0x5d7101,_0x41a7bc){return client['request'](_0x219802,_0x3f53ff)[_0xa1eb('0x11')](function(_0x325d13){logger[_0xa1eb('0x12')]('MailMessage,\x20%s,\x20%s',_0x54cdad,_0xa1eb('0x13'));logger[_0xa1eb('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x54cdad,_0xa1eb('0x13'),JSON['stringify'](_0x325d13));if(_0x325d13['error']){if(_0x325d13[_0xa1eb('0x15')]['code']===0x1f4){logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x325d13[_0xa1eb('0x15')][_0xa1eb('0x17')]);return _0x41a7bc(_0x325d13[_0xa1eb('0x15')][_0xa1eb('0x17')]);}logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x325d13[_0xa1eb('0x15')]['message']);return _0x5d7101(_0x325d13[_0xa1eb('0x15')]['message']);}else{logger[_0xa1eb('0x12')](_0xa1eb('0x16'),_0x54cdad,_0xa1eb('0x13'));_0x5d7101(_0x325d13[_0xa1eb('0x18')]['message']);}})[_0xa1eb('0x19')](function(_0x22cd44){logger[_0xa1eb('0x15')](_0xa1eb('0x16'),_0x54cdad,_0x22cd44);_0x41a7bc(_0x22cd44);});});}exports[_0xa1eb('0x1a')]=function(_0x3b8607){var _0x2143e6=this;return new Promise(function(_0x166f7f,_0x4fc14a){return db[_0xa1eb('0x1b')]['create'](_0x3b8607[_0xa1eb('0x1c')],{'raw':_0x3b8607[_0xa1eb('0x1d')]?_0x3b8607[_0xa1eb('0x1d')][_0xa1eb('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x539634){logger[_0xa1eb('0x12')](_0xa1eb('0x1a'),_0x3b8607);logger['debug'](_0xa1eb('0x1a'),_0x3b8607,JSON[_0xa1eb('0x1f')](_0x539634));_0x166f7f(_0x539634);})[_0xa1eb('0x19')](function(_0xa6b20c){logger[_0xa1eb('0x15')](_0xa1eb('0x1a'),_0xa6b20c[_0xa1eb('0x17')],_0x3b8607);_0x4fc14a(_0x2143e6[_0xa1eb('0x15')](0x1f4,_0xa6b20c[_0xa1eb('0x17')]));});});}; \ No newline at end of file +var _0x5204=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailMessage','body','options','CreateMailMessage','lodash'];(function(_0x574d86,_0x1075f1){var _0xc034b0=function(_0x4eb1ae){while(--_0x4eb1ae){_0x574d86['push'](_0x574d86['shift']());}};_0xc034b0(++_0x1075f1);}(_0x5204,0xdf));var _0x4520=function(_0x36de10,_0xfe25e8){_0x36de10=_0x36de10-0x0;var _0x58100f=_0x5204[_0x36de10];return _0x58100f;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});config[_0x4520('0xb')]=_[_0x4520('0xc')](config[_0x4520('0xb')],{'host':_0x4520('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4520('0xb')]));require('./mailMessage.socket')[_0x4520('0xe')](socket);function respondWithRpcPromise(_0x37a617,_0x1a5324,_0x30ca43){return new BPromise(function(_0x4d767b,_0x297f8d){return client[_0x4520('0xf')](_0x37a617,_0x30ca43)[_0x4520('0x10')](function(_0x2a2a2f){logger[_0x4520('0x11')](_0x4520('0x12'),_0x1a5324,_0x4520('0x13'));logger[_0x4520('0x14')](_0x4520('0x15'),_0x1a5324,_0x4520('0x13'),JSON[_0x4520('0x16')](_0x2a2a2f));if(_0x2a2a2f[_0x4520('0x17')]){if(_0x2a2a2f[_0x4520('0x17')][_0x4520('0x18')]===0x1f4){logger[_0x4520('0x17')](_0x4520('0x12'),_0x1a5324,_0x2a2a2f['error'][_0x4520('0x19')]);return _0x297f8d(_0x2a2a2f[_0x4520('0x17')][_0x4520('0x19')]);}logger[_0x4520('0x17')](_0x4520('0x12'),_0x1a5324,_0x2a2a2f['error'][_0x4520('0x19')]);return _0x4d767b(_0x2a2a2f[_0x4520('0x17')][_0x4520('0x19')]);}else{logger[_0x4520('0x11')](_0x4520('0x12'),_0x1a5324,_0x4520('0x13'));_0x4d767b(_0x2a2a2f[_0x4520('0x1a')][_0x4520('0x19')]);}})[_0x4520('0x1b')](function(_0x11eaea){logger[_0x4520('0x17')](_0x4520('0x12'),_0x1a5324,_0x11eaea);_0x297f8d(_0x11eaea);});});}exports['CreateMailMessage']=function(_0xc016a3){var _0x52ca8c=this;return new Promise(function(_0x5ceff6,_0x4c46c5){return db[_0x4520('0x1c')]['create'](_0xc016a3[_0x4520('0x1d')],{'raw':_0xc016a3[_0x4520('0x1e')]?_0xc016a3[_0x4520('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x4520('0x10')](function(_0x4000d4){logger[_0x4520('0x11')]('CreateMailMessage',_0xc016a3);logger[_0x4520('0x14')](_0x4520('0x1f'),_0xc016a3,JSON[_0x4520('0x16')](_0x4000d4));_0x5ceff6(_0x4000d4);})[_0x4520('0x1b')](function(_0x2a8528){logger['error'](_0x4520('0x1f'),_0x2a8528[_0x4520('0x19')],_0xc016a3);_0x4c46c5(_0x52ca8c[_0x4520('0x17')](0x1f4,_0x2a8528[_0x4520('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 0cb8f6d..5040e12 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 _0xbefb=['update','emit','length','mailMessage:','./mailMessage.events','save'];(function(_0x2b6e01,_0x2451b8){var _0x18e81c=function(_0x5f2897){while(--_0x5f2897){_0x2b6e01['push'](_0x2b6e01['shift']());}};_0x18e81c(++_0x2451b8);}(_0xbefb,0x13c));var _0xbbef=function(_0x2652dd,_0x103985){_0x2652dd=_0x2652dd-0x0;var _0x5ca280=_0xbefb[_0x2652dd];return _0x5ca280;};'use strict';var MailMessageEvents=require(_0xbbef('0x0'));var events=[_0xbbef('0x1'),'remove',_0xbbef('0x2')];function createListener(_0x3f59a4,_0x47a056){return function(_0x46a197){_0x47a056[_0xbbef('0x3')](_0x3f59a4,_0x46a197);};}function removeListener(_0x4768c6,_0x53a983){return function(){MailMessageEvents['removeListener'](_0x4768c6,_0x53a983);};}exports['register']=function(_0xa1dfa8){for(var _0x4ed4dd=0x0,_0x3bbb5f=events[_0xbbef('0x4')];_0x4ed4dd<_0x3bbb5f;_0x4ed4dd++){var _0x14254c=events[_0x4ed4dd];var _0x4b86ca=createListener(_0xbbef('0x5')+_0x14254c,_0xa1dfa8);MailMessageEvents['on'](_0x14254c,_0x4b86ca);}}; \ No newline at end of file +var _0xb2ef=['save','remove','removeListener','register','length','./mailMessage.events'];(function(_0x27c39b,_0x1ef9ca){var _0x3745b6=function(_0x16569b){while(--_0x16569b){_0x27c39b['push'](_0x27c39b['shift']());}};_0x3745b6(++_0x1ef9ca);}(_0xb2ef,0xa7));var _0xfb2e=function(_0xdec863,_0x6f9998){_0xdec863=_0xdec863-0x0;var _0x204e10=_0xb2ef[_0xdec863];return _0x204e10;};'use strict';var MailMessageEvents=require(_0xfb2e('0x0'));var events=[_0xfb2e('0x1'),_0xfb2e('0x2'),'update'];function createListener(_0x1e4d1c,_0x291359){return function(_0x282426){_0x291359['emit'](_0x1e4d1c,_0x282426);};}function removeListener(_0xb829cc,_0x1716cd){return function(){MailMessageEvents[_0xfb2e('0x3')](_0xb829cc,_0x1716cd);};}exports[_0xfb2e('0x4')]=function(_0x3069a){for(var _0x2a1c23=0x0,_0x1fb22e=events[_0xfb2e('0x5')];_0x2a1c23<_0x1fb22e;_0x2a1c23++){var _0x1d0a05=events[_0x2a1c23];var _0x46c641=createListener('mailMessage:'+_0x1d0a05,_0x3069a);MailMessageEvents['on'](_0x1d0a05,_0x46c641);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e9a4cec..032c314 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 _0x1518=['show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','destroy','removeTeams','/:id/users','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x126feb,_0x28bf3d){var _0x3e55c5=function(_0x1bb472){while(--_0x1bb472){_0x126feb['push'](_0x126feb['shift']());}};_0x3e55c5(++_0x28bf3d);}(_0x1518,0x17a));var _0x8151=function(_0xc5b122,_0x3e672a){_0xc5b122=_0xc5b122-0x0;var _0x4ed8e1=_0x1518[_0xc5b122];return _0x4ed8e1;};'use strict';var multer=require(_0x8151('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8151('0x1'));var router=express[_0x8151('0x2')]();var fs_extra=require(_0x8151('0x3'));var auth=require(_0x8151('0x4'));var interaction=require(_0x8151('0x5'));var config=require(_0x8151('0x6'));var controller=require(_0x8151('0x7'));router[_0x8151('0x8')]('/',auth[_0x8151('0x9')](),controller[_0x8151('0xa')]);router[_0x8151('0x8')](_0x8151('0xb'),auth[_0x8151('0x9')](),controller[_0x8151('0xc')]);router[_0x8151('0x8')](_0x8151('0xd'),auth['isAuthenticated'](),controller[_0x8151('0xe')]);router['get'](_0x8151('0xf'),auth['isAuthenticated'](),controller[_0x8151('0x10')]);router['get'](_0x8151('0x11'),auth[_0x8151('0x9')](),controller[_0x8151('0x12')]);router[_0x8151('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x8151('0x13')]);router['post']('/',auth[_0x8151('0x9')](),controller['create']);router[_0x8151('0x14')](_0x8151('0x11'),auth['isAuthenticated'](),controller[_0x8151('0x15')]);router[_0x8151('0x14')]('/:id/users',auth[_0x8151('0x9')](),controller[_0x8151('0x16')]);router[_0x8151('0x17')](_0x8151('0xd'),auth[_0x8151('0x9')](),controller['update']);router[_0x8151('0x18')](_0x8151('0xd'),auth[_0x8151('0x9')](),controller[_0x8151('0x19')]);router[_0x8151('0x18')](_0x8151('0x11'),auth['isAuthenticated'](),controller[_0x8151('0x1a')]);router[_0x8151('0x18')](_0x8151('0x1b'),auth[_0x8151('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x630c=['update','delete','destroy','/:id/teams','removeTeams','exports','multer','connect-timeout','express','Router','../../components/interaction/service','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/members','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x630c,0x180));var _0xc630=function(_0xfff4c2,_0x2f5322){_0xfff4c2=_0xfff4c2-0x0;var _0xd02727=_0x630c[_0xfff4c2];return _0xd02727;};'use strict';var multer=require(_0xc630('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc630('0x1'));var express=require(_0xc630('0x2'));var router=express[_0xc630('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc630('0x4'));var config=require('../../config/environment');var controller=require(_0xc630('0x5'));router[_0xc630('0x6')]('/',auth['isAuthenticated'](),controller[_0xc630('0x7')]);router[_0xc630('0x6')](_0xc630('0x8'),auth[_0xc630('0x9')](),controller[_0xc630('0xa')]);router[_0xc630('0x6')]('/:id',auth[_0xc630('0x9')](),controller[_0xc630('0xb')]);router['get'](_0xc630('0xc'),auth[_0xc630('0x9')](),controller['getMembers']);router[_0xc630('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc630('0xd')]);router[_0xc630('0x6')](_0xc630('0xe'),auth[_0xc630('0x9')](),controller[_0xc630('0xf')]);router[_0xc630('0x10')]('/',auth[_0xc630('0x9')](),controller['create']);router[_0xc630('0x10')]('/:id/teams',auth[_0xc630('0x9')](),controller[_0xc630('0x11')]);router[_0xc630('0x10')](_0xc630('0xe'),auth[_0xc630('0x9')](),controller[_0xc630('0x12')]);router[_0xc630('0x13')](_0xc630('0x14'),auth[_0xc630('0x9')](),controller[_0xc630('0x15')]);router[_0xc630('0x16')](_0xc630('0x14'),auth[_0xc630('0x9')](),controller[_0xc630('0x17')]);router[_0xc630('0x16')](_0xc630('0x18'),auth[_0xc630('0x9')](),controller[_0xc630('0x19')]);router[_0xc630('0x16')](_0xc630('0xe'),auth[_0xc630('0x9')](),controller['removeAgents']);module[_0xc630('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 32868fd..83ab023 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 _0x7191=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x1481fe,_0x497588){var _0x2281c1=function(_0x131759){while(--_0x131759){_0x1481fe['push'](_0x1481fe['shift']());}};_0x2281c1(++_0x497588);}(_0x7191,0x138));var _0x1719=function(_0x3f953b,_0x3b4ce3){_0x3f953b=_0x3f953b-0x0;var _0x38b672=_0x7191[_0x3f953b];return _0x38b672;};'use strict';var Sequelize=require(_0x1719('0x0'));module[_0x1719('0x1')]={'name':{'type':Sequelize[_0x1719('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1719('0x2')]},'timeout':{'type':Sequelize[_0x1719('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1719('0x4')](_0x1719('0x5'),_0x1719('0x6'),_0x1719('0x7'))}}; \ No newline at end of file +var _0xb70b=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb70b,0x10f));var _0xbb70=function(_0x3c4c6e,_0x59ff43){_0x3c4c6e=_0x3c4c6e-0x0;var _0x1d0ab7=_0xb70b[_0x3c4c6e];return _0x1d0ab7;};'use strict';var Sequelize=require(_0xbb70('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xbb70('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbb70('0x2')]},'timeout':{'type':Sequelize[_0xbb70('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb70('0x4')](_0xbb70('0x5'),_0xbb70('0x6'),_0xbb70('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9249bbf..2337f51 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 _0x5dd5=['all','union','compact','value','emit','addAgents','omit','removeAgents','isArray','userMailQueue:remove','getAgents','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','MailQueues','UserProfileResource','error','stack','name','index','map','MailQueue','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','rawAttributes','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserMailQueue','length','nolimit','MailQueueId','findAll','User','findAndCountAll','UserId','updatedAt','createdAt','rows','format','%s/%s','SIP','mailPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','each','forEach','userMailQueue:save','removeTeams','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5dd5,0x1a0));var _0x55dd=function(_0xd40043,_0x5f3ab1){_0xd40043=_0xd40043-0x0;var _0x26ec18=_0x5dd5[_0xd40043];return _0x26ec18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55dd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x55dd('0x1'));var moment=require(_0x55dd('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x55dd('0x3'));var util=require(_0x55dd('0x4'));var path=require('path');var sox=require(_0x55dd('0x5'));var csv=require(_0x55dd('0x6'));var ejs=require(_0x55dd('0x7'));var fs=require('fs');var fs_extra=require(_0x55dd('0x8'));var _=require(_0x55dd('0x9'));var squel=require(_0x55dd('0xa'));var crypto=require(_0x55dd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x55dd('0xc'));var toCsv=require(_0x55dd('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x55dd('0xd'));var qs=require(_0x55dd('0xe'));var as=require(_0x55dd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55dd('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x55dd('0x11'))['db'];config[_0x55dd('0x12')]=_[_0x55dd('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x55dd('0x14'))(new Redis(config[_0x55dd('0x12')]));require(_0x55dd('0x15'))[_0x55dd('0x16')](socket);function respondWithStatusCode(_0x175341,_0x5b18bf){_0x5b18bf=_0x5b18bf||0xcc;return function(_0x5434d1){if(_0x5434d1){return _0x175341[_0x55dd('0x17')](_0x5b18bf);}return _0x175341[_0x55dd('0x18')](_0x5b18bf)[_0x55dd('0x19')]();};}function respondWithResult(_0x48e062,_0x5b4ba6){_0x5b4ba6=_0x5b4ba6||0xc8;return function(_0x24ad1c){if(_0x24ad1c){return _0x48e062[_0x55dd('0x18')](_0x5b4ba6)[_0x55dd('0x1a')](_0x24ad1c);}};}function respondWithFilteredResult(_0x10effc,_0x1435a1){return function(_0x1b075f){if(_0x1b075f){var _0x1a2fe7=typeof _0x1435a1['offset']==='undefined'&&typeof _0x1435a1[_0x55dd('0x1b')]===_0x55dd('0x1c');var _0xd2096a=_0x1b075f[_0x55dd('0x1d')];var _0x11a18c=_0x1a2fe7?0x0:_0x1435a1['offset'];var _0x3d5fd5=_0x1a2fe7?_0x1b075f[_0x55dd('0x1d')]:_0x1435a1[_0x55dd('0x1e')]+_0x1435a1[_0x55dd('0x1b')];var _0x4d2343;if(_0x3d5fd5>=_0xd2096a){_0x3d5fd5=_0xd2096a;_0x4d2343=0xc8;}else{_0x4d2343=0xce;}_0x10effc[_0x55dd('0x18')](_0x4d2343);return _0x10effc['set'](_0x55dd('0x1f'),_0x11a18c+'-'+_0x3d5fd5+'/'+_0xd2096a)['json'](_0x1b075f);}return null;};}function patchUpdates(_0xe16a09){return function(_0x1ac8ca){try{jsonpatch['apply'](_0x1ac8ca,_0xe16a09,!![]);}catch(_0x4cc020){return BPromise[_0x55dd('0x20')](_0x4cc020);}return _0x1ac8ca[_0x55dd('0x21')]();};}function saveUpdates(_0x4f7872,_0x5b0006){return function(_0x28ea00){if(_0x28ea00){return _0x28ea00[_0x55dd('0x22')](_0x4f7872)[_0x55dd('0x23')](function(_0x572829){return _0x572829;});}return null;};}function removeEntity(_0x3699b4,_0x6961c8){return function(_0x92b1fd){if(_0x92b1fd){return _0x92b1fd['destroy']()[_0x55dd('0x23')](function(){var _0x6c75f6=_0x92b1fd['get']({'plain':!![]});var _0x37be1f=_0x55dd('0x24');return db[_0x55dd('0x25')]['destroy']({'where':{'type':_0x37be1f,'resourceId':_0x6c75f6['id']}})[_0x55dd('0x23')](function(){return _0x92b1fd;});})[_0x55dd('0x23')](function(){_0x3699b4['status'](0xcc)[_0x55dd('0x19')]();});}};}function handleEntityNotFound(_0x2567e2,_0x52988a){return function(_0x2e629e){if(!_0x2e629e){_0x2567e2['sendStatus'](0x194);}return _0x2e629e;};}function handleError(_0x6a9565,_0x42200f){_0x42200f=_0x42200f||0x1f4;return function(_0x5cd2ff){logger[_0x55dd('0x26')](_0x5cd2ff[_0x55dd('0x27')]);if(_0x5cd2ff['name']){delete _0x5cd2ff[_0x55dd('0x28')];}_0x6a9565['status'](_0x42200f)['send'](_0x5cd2ff);};}exports[_0x55dd('0x29')]=function(_0x5b11d1,_0x21a8fb){var _0x48f9e8={},_0x296b3c={},_0x33a34a={'count':0x0,'rows':[]};var _0x426dc9=_[_0x55dd('0x2a')](db[_0x55dd('0x2b')]['rawAttributes'],function(_0xd4febe){return{'name':_0xd4febe[_0x55dd('0x2c')],'type':_0xd4febe[_0x55dd('0x2d')][_0x55dd('0x2e')]};});_0x296b3c['model']=_[_0x55dd('0x2a')](_0x426dc9,_0x55dd('0x28'));_0x296b3c['query']=_[_0x55dd('0x2f')](_0x5b11d1[_0x55dd('0x30')]);_0x296b3c[_0x55dd('0x31')]=_['intersection'](_0x296b3c[_0x55dd('0x32')],_0x296b3c[_0x55dd('0x30')]);_0x48f9e8[_0x55dd('0x33')]=_[_0x55dd('0x34')](_0x296b3c[_0x55dd('0x32')],qs['fields'](_0x5b11d1[_0x55dd('0x30')][_0x55dd('0x35')]));_0x48f9e8[_0x55dd('0x33')]=_0x48f9e8[_0x55dd('0x33')]['length']?_0x48f9e8[_0x55dd('0x33')]:_0x296b3c['model'];if(!_0x5b11d1[_0x55dd('0x30')][_0x55dd('0x36')]('nolimit')){_0x48f9e8[_0x55dd('0x1b')]=qs[_0x55dd('0x1b')](_0x5b11d1[_0x55dd('0x30')][_0x55dd('0x1b')]);_0x48f9e8[_0x55dd('0x1e')]=qs['offset'](_0x5b11d1[_0x55dd('0x30')]['offset']);}_0x48f9e8[_0x55dd('0x37')]=qs[_0x55dd('0x38')](_0x5b11d1[_0x55dd('0x30')]['sort']);_0x48f9e8[_0x55dd('0x39')]=qs['filters'](_[_0x55dd('0x3a')](_0x5b11d1[_0x55dd('0x30')],_0x296b3c[_0x55dd('0x31')]),_0x426dc9);if(_0x5b11d1[_0x55dd('0x30')]['filter']){_0x48f9e8['where']=_[_0x55dd('0x3b')](_0x48f9e8['where'],{'$or':_[_0x55dd('0x2a')](_0x426dc9,function(_0x5621ea){if(_0x5621ea[_0x55dd('0x2d')]!==_0x55dd('0x3c')){var _0x1beb70={};_0x1beb70[_0x5621ea['name']]={'$like':'%'+_0x5b11d1[_0x55dd('0x30')][_0x55dd('0x3d')]+'%'};return _0x1beb70;}})});}_0x48f9e8=_['merge']({},_0x48f9e8,_0x5b11d1[_0x55dd('0x3e')]);var _0x1191a1={'where':_0x48f9e8[_0x55dd('0x39')]};return db[_0x55dd('0x2b')][_0x55dd('0x1d')](_0x1191a1)['then'](function(_0x3ada78){_0x33a34a['count']=_0x3ada78;if(_0x5b11d1[_0x55dd('0x30')][_0x55dd('0x3f')]){_0x48f9e8[_0x55dd('0x40')]=[{'all':!![]}];}return db[_0x55dd('0x2b')]['findAll'](_0x48f9e8);})[_0x55dd('0x23')](function(_0x1f3066){_0x33a34a['rows']=_0x1f3066;return _0x33a34a;})[_0x55dd('0x23')](respondWithFilteredResult(_0x21a8fb,_0x48f9e8))[_0x55dd('0x41')](handleError(_0x21a8fb,null));};exports[_0x55dd('0x42')]=function(_0x57b3ce,_0xf1bd30){var _0x311edf={'raw':!![],'where':{'id':_0x57b3ce[_0x55dd('0x43')]['id']}},_0x484adc={};_0x484adc[_0x55dd('0x32')]=_['keys'](db['MailQueue'][_0x55dd('0x44')]);_0x484adc['query']=_['keys'](_0x57b3ce[_0x55dd('0x30')]);_0x484adc[_0x55dd('0x31')]=_[_0x55dd('0x34')](_0x484adc[_0x55dd('0x32')],_0x484adc[_0x55dd('0x30')]);_0x311edf[_0x55dd('0x33')]=_[_0x55dd('0x34')](_0x484adc[_0x55dd('0x32')],qs['fields'](_0x57b3ce[_0x55dd('0x30')][_0x55dd('0x35')]));_0x311edf[_0x55dd('0x33')]=_0x311edf[_0x55dd('0x33')]['length']?_0x311edf[_0x55dd('0x33')]:_0x484adc['model'];if(_0x57b3ce[_0x55dd('0x30')][_0x55dd('0x3f')]){_0x311edf[_0x55dd('0x40')]=[{'all':!![]}];}_0x311edf=_['merge']({},_0x311edf,_0x57b3ce[_0x55dd('0x3e')]);return db[_0x55dd('0x2b')]['find'](_0x311edf)['then'](handleEntityNotFound(_0xf1bd30,null))['then'](respondWithResult(_0xf1bd30,null))[_0x55dd('0x41')](handleError(_0xf1bd30,null));};exports[_0x55dd('0x45')]=function(_0x2cdb06,_0x2a8a03){return db[_0x55dd('0x2b')][_0x55dd('0x45')](_0x2cdb06['body'],{})[_0x55dd('0x23')](function(_0x1e3fee){var _0x26ed5a=_0x2cdb06[_0x55dd('0x46')][_0x55dd('0x47')]({'plain':!![]});if(!_0x26ed5a)throw new Error(_0x55dd('0x48'));if(_0x26ed5a['role']===_0x55dd('0x46')){var _0x5d0d87=_0x1e3fee[_0x55dd('0x47')]({'plain':!![]});var _0x31c227=_0x55dd('0x24');return db[_0x55dd('0x49')][_0x55dd('0x4a')]({'where':{'name':_0x31c227,'userProfileId':_0x26ed5a[_0x55dd('0x4b')]},'raw':!![]})['then'](function(_0x4bcde9){if(_0x4bcde9&&_0x4bcde9[_0x55dd('0x4c')]===0x0){return db[_0x55dd('0x25')][_0x55dd('0x45')]({'name':_0x5d0d87[_0x55dd('0x28')],'resourceId':_0x5d0d87['id'],'type':_0x4bcde9['name'],'sectionId':_0x4bcde9['id']},{})[_0x55dd('0x23')](function(){return _0x1e3fee;});}else{return _0x1e3fee;}})[_0x55dd('0x41')](function(_0x2102a4){logger[_0x55dd('0x26')](_0x55dd('0x4d'),_0x2102a4);throw _0x2102a4;});}return _0x1e3fee;})[_0x55dd('0x23')](respondWithResult(_0x2a8a03,0xc9))[_0x55dd('0x41')](handleError(_0x2a8a03,null));};exports[_0x55dd('0x22')]=function(_0x28af52,_0x5ac39c){if(_0x28af52[_0x55dd('0x4e')]['id']){delete _0x28af52['body']['id'];}return db[_0x55dd('0x2b')][_0x55dd('0x4a')]({'where':{'id':_0x28af52[_0x55dd('0x43')]['id']}})[_0x55dd('0x23')](handleEntityNotFound(_0x5ac39c,null))[_0x55dd('0x23')](saveUpdates(_0x28af52[_0x55dd('0x4e')],null))['then'](respondWithResult(_0x5ac39c,null))['catch'](handleError(_0x5ac39c,null));};exports[_0x55dd('0x4f')]=function(_0x1d48f6,_0x2b4bf4){return db['MailQueue'][_0x55dd('0x4a')]({'where':{'id':_0x1d48f6[_0x55dd('0x43')]['id']}})[_0x55dd('0x23')](handleEntityNotFound(_0x2b4bf4,null))[_0x55dd('0x23')](removeEntity(_0x2b4bf4,null))['catch'](handleError(_0x2b4bf4,null));};exports[_0x55dd('0x50')]=function(_0x34267b,_0x50622e){return db[_0x55dd('0x2b')][_0x55dd('0x50')]()[_0x55dd('0x23')](respondWithResult(_0x50622e,null))[_0x55dd('0x41')](handleError(_0x50622e,null));};exports[_0x55dd('0x51')]=function(_0x494588,_0x277e7e,_0x37c71c){var _0x2a3dc5={'raw':!![],'where':{}},_0x48c780={},_0x1b44f1;return db[_0x55dd('0x2b')][_0x55dd('0x52')]({'where':{'id':_0x494588[_0x55dd('0x43')]['id']}})[_0x55dd('0x23')](handleEntityNotFound(_0x277e7e,null))[_0x55dd('0x23')](function(_0x57ea51){if(_0x57ea51){_0x1b44f1=_0x57ea51['get']({'plain':!![]});_0x48c780[_0x55dd('0x32')]=_[_0x55dd('0x2f')](db[_0x55dd('0x53')]['rawAttributes']);_0x48c780[_0x55dd('0x30')]=_[_0x55dd('0x2f')](_0x494588[_0x55dd('0x30')]);_0x48c780[_0x55dd('0x31')]=_['intersection'](_0x48c780[_0x55dd('0x32')],_0x48c780['query']);_0x2a3dc5[_0x55dd('0x33')]=_['intersection'](_0x48c780[_0x55dd('0x32')],qs['fields'](_0x494588['query']['fields']));_0x2a3dc5[_0x55dd('0x33')]=_0x2a3dc5[_0x55dd('0x33')][_0x55dd('0x54')]?_0x2a3dc5[_0x55dd('0x33')]:_0x48c780[_0x55dd('0x32')];if(!_0x494588['query'][_0x55dd('0x36')](_0x55dd('0x55'))){_0x2a3dc5['limit']=qs[_0x55dd('0x1b')](_0x494588[_0x55dd('0x30')][_0x55dd('0x1b')]);_0x2a3dc5[_0x55dd('0x1e')]=qs[_0x55dd('0x1e')](_0x494588[_0x55dd('0x30')][_0x55dd('0x1e')]);}_0x2a3dc5[_0x55dd('0x37')]=qs[_0x55dd('0x38')](_0x494588[_0x55dd('0x30')][_0x55dd('0x38')]);_0x2a3dc5[_0x55dd('0x39')]=qs[_0x55dd('0x31')](_[_0x55dd('0x3a')](_0x494588[_0x55dd('0x30')],_0x48c780[_0x55dd('0x31')]));_0x2a3dc5[_0x55dd('0x39')][_0x55dd('0x56')]=_0x57ea51['id'];if(_0x494588['query'][_0x55dd('0x3d')]){_0x2a3dc5['where']=_[_0x55dd('0x3b')](_0x2a3dc5['where'],{'$or':_[_0x55dd('0x2a')](_0x2a3dc5[_0x55dd('0x33')],function(_0x35db33){var _0x1f62f3={};_0x1f62f3[_0x35db33]={'$like':'%'+_0x494588[_0x55dd('0x30')][_0x55dd('0x3d')]+'%'};return _0x1f62f3;})});}_0x2a3dc5=_[_0x55dd('0x3b')]({},_0x2a3dc5,_0x494588['options']);return db['UserMailQueue'][_0x55dd('0x57')](_0x2a3dc5);}})['then'](function(_0x5d9eb5){if(_0x5d9eb5){return db[_0x55dd('0x58')][_0x55dd('0x59')]({'where':{'id':_[_0x55dd('0x2a')](_0x5d9eb5,_0x55dd('0x5a')),'role':'agent'},'attributes':['id',_0x55dd('0x28'),'mailPause',_0x55dd('0x5b'),_0x55dd('0x5c')]});}})['then'](function(_0x34d927){if(_0x34d927){return{'count':_0x34d927[_0x55dd('0x1d')],'rows':_['map'](_0x34d927[_0x55dd('0x5d')],function(_0x549b55){return{'membername':_0x549b55['name'],'UserId':_0x549b55['id'],'queue_name':_0x1b44f1[_0x55dd('0x28')],'MailQueueId':_0x1b44f1['id'],'interface':util[_0x55dd('0x5e')](_0x55dd('0x5f'),_0x55dd('0x60'),_0x549b55['name']),'penalty':0x0,'paused':_0x549b55[_0x55dd('0x61')],'createdAt':_0x549b55[_0x55dd('0x5c')],'updatedAt':_0x549b55[_0x55dd('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x277e7e,_0x2a3dc5))[_0x55dd('0x41')](handleError(_0x277e7e,null));};exports[_0x55dd('0x62')]=function(_0x16d16d,_0x5a4268,_0x4cabf2){var _0x523361={};var _0x281536={};var _0x231319;var _0x24d359;return db[_0x55dd('0x2b')]['findOne']({'where':{'id':_0x16d16d[_0x55dd('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a4268,null))[_0x55dd('0x23')](function(_0x10f5cf){if(_0x10f5cf){_0x231319=_0x10f5cf;_0x281536[_0x55dd('0x32')]=_['keys'](db[_0x55dd('0x63')][_0x55dd('0x44')]);_0x281536['query']=_[_0x55dd('0x2f')](_0x16d16d['query']);_0x281536[_0x55dd('0x31')]=_[_0x55dd('0x34')](_0x281536['model'],_0x281536[_0x55dd('0x30')]);_0x523361[_0x55dd('0x33')]=_[_0x55dd('0x34')](_0x281536[_0x55dd('0x32')],qs['fields'](_0x16d16d[_0x55dd('0x30')]['fields']));_0x523361[_0x55dd('0x33')]=_0x523361[_0x55dd('0x33')][_0x55dd('0x54')]?_0x523361[_0x55dd('0x33')]:_0x281536[_0x55dd('0x32')];_0x523361[_0x55dd('0x37')]=qs[_0x55dd('0x38')](_0x16d16d[_0x55dd('0x30')][_0x55dd('0x38')]);_0x523361['where']=qs['filters'](_[_0x55dd('0x3a')](_0x16d16d[_0x55dd('0x30')],_0x281536[_0x55dd('0x31')]));if(_0x16d16d[_0x55dd('0x30')][_0x55dd('0x3d')]){_0x523361[_0x55dd('0x39')]=_[_0x55dd('0x3b')](_0x523361[_0x55dd('0x39')],{'$or':_['map'](_0x523361[_0x55dd('0x33')],function(_0x529aaa){var _0x55d56b={};_0x55d56b[_0x529aaa]={'$like':'%'+_0x16d16d[_0x55dd('0x30')][_0x55dd('0x3d')]+'%'};return _0x55d56b;})});}_0x523361=_[_0x55dd('0x3b')]({},_0x523361,_0x16d16d[_0x55dd('0x3e')]);return _0x231319['getTeams'](_0x523361);}})['then'](function(_0x2e6c92){if(_0x2e6c92){_0x24d359=_0x2e6c92[_0x55dd('0x54')];if(!_0x16d16d[_0x55dd('0x30')][_0x55dd('0x36')](_0x55dd('0x55'))){_0x523361[_0x55dd('0x1b')]=qs[_0x55dd('0x1b')](_0x16d16d[_0x55dd('0x30')][_0x55dd('0x1b')]);_0x523361['offset']=qs[_0x55dd('0x1e')](_0x16d16d[_0x55dd('0x30')]['offset']);}return _0x231319[_0x55dd('0x62')](_0x523361);}})[_0x55dd('0x23')](function(_0x5c5706){if(_0x5c5706){return _0x5c5706?{'count':_0x24d359,'rows':_0x5c5706}:null;}})['then'](respondWithResult(_0x5a4268,null))[_0x55dd('0x41')](handleError(_0x5a4268,null));};exports[_0x55dd('0x64')]=function(_0x2b3567,_0x5afb20,_0x58c6ba){var _0x22edb3=_0x2b3567[_0x55dd('0x4e')][_0x55dd('0x65')];return db[_0x55dd('0x63')][_0x55dd('0x57')]({'where':{'id':_0x22edb3},'attributes':['id'],'include':[{'model':db[_0x55dd('0x58')],'as':_0x55dd('0x66'),'attributes':['id',_0x55dd('0x28'),_0x55dd('0x67'),_0x55dd('0x68'),'interface'],'raw':!![]}]})[_0x55dd('0x23')](function(_0x406f66){if(_0x406f66){var _0x458a7e=_[_0x55dd('0x69')](_0x406f66,function(_0x565b43){var _0x5bd65c=_0x565b43[_0x55dd('0x47')]({'plain':!![]});return _0x5bd65c[_0x55dd('0x66')];});return db[_0x55dd('0x2b')][_0x55dd('0x4a')]({'where':{'id':_0x2b3567[_0x55dd('0x43')]['id']}})[_0x55dd('0x23')](function(_0x422dc5){return db['sequelize']['transaction'](function(_0x381d4b){return _0x422dc5[_0x55dd('0x64')](_0x22edb3,{'transaction':_0x381d4b})[_0x55dd('0x23')](function(){return BPromise[_0x55dd('0x6a')](_0x458a7e,function(_0x21ee77){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x21ee77['id'],'MailQueueId':_0x2b3567['params']['id']},'transaction':_0x381d4b});});})[_0x55dd('0x23')](function(){_0x458a7e[_0x55dd('0x6b')](function(_0x5ef9cc){socket['emit'](_0x55dd('0x6c'),{'UserId':_0x5ef9cc['id'],'MailQueueId':_0x422dc5['id']});});});});});}})[_0x55dd('0x23')](respondWithStatusCode(_0x5afb20,null))[_0x55dd('0x41')](handleError(_0x5afb20,null));};exports[_0x55dd('0x6d')]=function(_0x2061cf,_0x1399c7,_0x419818){return db[_0x55dd('0x63')]['findAll']({'where':{'id':_0x2061cf[_0x55dd('0x30')][_0x55dd('0x65')]},'attributes':['id'],'include':[{'model':db[_0x55dd('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x55dd('0x23')](handleEntityNotFound(_0x1399c7,null))[_0x55dd('0x23')](function(_0x373f33){var _0x297ba2=_[_0x55dd('0x2a')](_0x373f33,'id');var _0x536c3b=[];var _0x2de7e3=[];var _0x5451b8=squel[_0x55dd('0x6e')]();_0x5451b8['field'](_0x55dd('0x6f'))[_0x55dd('0x70')](_0x55dd('0x71'),'tq')[_0x55dd('0x72')](_0x55dd('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x55dd('0x39')]('MailQueueId\x20=\x20?',_0x2061cf[_0x55dd('0x43')]['id']);for(var _0x38c350=0x0;_0x38c350<_0x373f33[_0x55dd('0x54')];_0x38c350+=0x1){let _0x4099fe=_0x373f33[_0x38c350];for(var _0x37de21=0x0;_0x37de21<_0x4099fe[_0x55dd('0x66')][_0x55dd('0x54')];_0x37de21+=0x1){let _0x492153=_0x4099fe[_0x55dd('0x66')][_0x37de21];var _0x38022f=_0x5451b8['clone']();_0x38022f[_0x55dd('0x39')](_0x55dd('0x74'),_0x492153['id']);_0x2de7e3['push'](db[_0x55dd('0x75')][_0x55dd('0x30')](_0x38022f[_0x55dd('0x76')](),{'type':db[_0x55dd('0x75')][_0x55dd('0x77')][_0x55dd('0x78')]})[_0x55dd('0x23')](function(_0x3e117a){if(_0x3e117a[_0x55dd('0x54')]===0x1){return _0x492153['id'];}else{var _0x29968c=_[_0x55dd('0x79')](_['map'](_0x3e117a,_0x55dd('0x7a')),function(_0x405669){return _[_0x55dd('0x7b')](_0x297ba2,_0x405669);});if(_0x29968c){return _0x492153['id'];}}}));}}return BPromise[_0x55dd('0x7c')](_0x2de7e3)[_0x55dd('0x23')](function(_0x4dd97d){_0x536c3b=_(_0x536c3b)[_0x55dd('0x7d')](_0x4dd97d)[_0x55dd('0x7e')]()[_0x55dd('0x7f')]();return db[_0x55dd('0x2b')]['find']({'where':{'id':_0x2061cf[_0x55dd('0x43')]['id']}})[_0x55dd('0x23')](function(_0x464c30){return db[_0x55dd('0x75')]['transaction'](function(_0x56bd67){return _0x464c30['removeTeams'](_0x2061cf['query'][_0x55dd('0x65')],{'transaction':_0x56bd67})[_0x55dd('0x23')](function(){if(!_['isEmpty'](_0x536c3b)){return _0x464c30['removeAgents'](_0x536c3b,{'transaction':_0x56bd67});}})[_0x55dd('0x23')](function(){_0x536c3b['forEach'](function(_0x16a416){socket[_0x55dd('0x80')]('userMailQueue:remove',{'UserId':_0x16a416,'MailQueueId':_0x464c30['id']});});});});});});})[_0x55dd('0x23')](respondWithStatusCode(_0x1399c7,null))[_0x55dd('0x41')](handleError(_0x1399c7,null));};exports['addAgents']=function(_0x415c98,_0x17548e,_0x41292d){return db[_0x55dd('0x2b')][_0x55dd('0x4a')]({'where':{'id':_0x415c98[_0x55dd('0x43')]['id']}})[_0x55dd('0x23')](handleEntityNotFound(_0x17548e,null))[_0x55dd('0x23')](function(_0x3a6cde){if(_0x3a6cde){return _0x3a6cde[_0x55dd('0x81')](_0x415c98['body'][_0x55dd('0x65')],_[_0x55dd('0x82')](_0x415c98[_0x55dd('0x4e')],[_0x55dd('0x65'),'id'])||{})['spread'](function(_0x2e4d82){for(var _0x4e0cea=0x0;_0x4e0cea<_0x415c98['body'][_0x55dd('0x65')][_0x55dd('0x54')];_0x4e0cea+=0x1){socket[_0x55dd('0x80')](_0x55dd('0x6c'),{'UserId':Number(_0x415c98[_0x55dd('0x4e')][_0x55dd('0x65')][_0x4e0cea]),'MailQueueId':Number(_0x415c98['params']['id'])});}return _0x2e4d82;});}})['then'](respondWithResult(_0x17548e,null))[_0x55dd('0x41')](handleError(_0x17548e,null));};exports[_0x55dd('0x83')]=function(_0x4b48a9,_0x19c587,_0x2467f7){return db[_0x55dd('0x2b')]['find']({'where':{'id':_0x4b48a9[_0x55dd('0x43')]['id']}})['then'](handleEntityNotFound(_0x19c587,null))[_0x55dd('0x23')](function(_0xa612ea){if(_0xa612ea){return _0xa612ea[_0x55dd('0x83')](_0x4b48a9[_0x55dd('0x30')][_0x55dd('0x65')])[_0x55dd('0x23')](function(){if(_[_0x55dd('0x84')](_0x4b48a9['query'][_0x55dd('0x65')])){for(var _0x1cbd53=0x0;_0x1cbd53<_0x4b48a9[_0x55dd('0x30')][_0x55dd('0x65')][_0x55dd('0x54')];_0x1cbd53+=0x1){socket[_0x55dd('0x80')](_0x55dd('0x85'),{'UserId':Number(_0x4b48a9[_0x55dd('0x30')][_0x55dd('0x65')][_0x1cbd53]),'MailQueueId':Number(_0x4b48a9[_0x55dd('0x43')]['id'])});}}else{socket[_0x55dd('0x80')](_0x55dd('0x85'),{'UserId':Number(_0x4b48a9[_0x55dd('0x30')][_0x55dd('0x65')]),'MailQueueId':Number(_0x4b48a9[_0x55dd('0x43')]['id'])});}});}})[_0x55dd('0x23')](respondWithStatusCode(_0x19c587,null))[_0x55dd('0x41')](handleError(_0x19c587,null));};exports[_0x55dd('0x86')]=function(_0x5272b5,_0x27cd0e,_0x55e2c0){var _0x3e8e2b={};var _0x5e8aed={};var _0xcde700;var _0x36101e;return db[_0x55dd('0x2b')][_0x55dd('0x52')]({'where':{'id':_0x5272b5['params']['id']}})[_0x55dd('0x23')](handleEntityNotFound(_0x27cd0e,null))[_0x55dd('0x23')](function(_0x1f8d9f){if(_0x1f8d9f){_0xcde700=_0x1f8d9f;_0x5e8aed['model']=_[_0x55dd('0x2f')](db[_0x55dd('0x58')]['rawAttributes']);_0x5e8aed['query']=_['keys'](_0x5272b5['query']);_0x5e8aed[_0x55dd('0x31')]=_['intersection'](_0x5e8aed[_0x55dd('0x32')],_0x5e8aed['query']);_0x3e8e2b[_0x55dd('0x33')]=_[_0x55dd('0x34')](_0x5e8aed[_0x55dd('0x32')],qs['fields'](_0x5272b5[_0x55dd('0x30')][_0x55dd('0x35')]));_0x3e8e2b[_0x55dd('0x33')]=_0x3e8e2b[_0x55dd('0x33')][_0x55dd('0x54')]?_0x3e8e2b['attributes']:_0x5e8aed[_0x55dd('0x32')];_0x3e8e2b['order']=qs[_0x55dd('0x38')](_0x5272b5['query'][_0x55dd('0x38')]);_0x3e8e2b[_0x55dd('0x39')]=qs[_0x55dd('0x31')](_[_0x55dd('0x3a')](_0x5272b5[_0x55dd('0x30')],_0x5e8aed[_0x55dd('0x31')]));if(_0x5272b5[_0x55dd('0x30')]['filter']){_0x3e8e2b[_0x55dd('0x39')]=_[_0x55dd('0x3b')](_0x3e8e2b[_0x55dd('0x39')],{'$or':_['map'](_0x3e8e2b[_0x55dd('0x33')],function(_0xbeafdb){var _0x589532={};_0x589532[_0xbeafdb]={'$like':'%'+_0x5272b5[_0x55dd('0x30')][_0x55dd('0x3d')]+'%'};return _0x589532;})});}_0x3e8e2b=_['merge']({},_0x3e8e2b,_0x5272b5[_0x55dd('0x3e')]);return _0xcde700[_0x55dd('0x86')](_0x3e8e2b);}})[_0x55dd('0x23')](function(_0x4adcc4){if(_0x4adcc4){_0x36101e=_0x4adcc4[_0x55dd('0x54')];if(!_0x5272b5['query'][_0x55dd('0x36')](_0x55dd('0x55'))){_0x3e8e2b[_0x55dd('0x1b')]=qs[_0x55dd('0x1b')](_0x5272b5['query'][_0x55dd('0x1b')]);_0x3e8e2b[_0x55dd('0x1e')]=qs['offset'](_0x5272b5[_0x55dd('0x30')][_0x55dd('0x1e')]);}return _0xcde700[_0x55dd('0x86')](_0x3e8e2b);}})[_0x55dd('0x23')](function(_0xc5eb3a){if(_0xc5eb3a){return _0xc5eb3a?{'count':_0x36101e,'rows':_0xc5eb3a}:null;}})[_0x55dd('0x23')](respondWithResult(_0x27cd0e,null))[_0x55dd('0x41')](handleError(_0x27cd0e,null));}; \ No newline at end of file +var _0x55c7=['SELECT','every','all','compact','transaction','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','nolimit','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes'];(function(_0x5b28f5,_0x398db7){var _0x4e41d3=function(_0x2e5aef){while(--_0x2e5aef){_0x5b28f5['push'](_0x5b28f5['shift']());}};_0x4e41d3(++_0x398db7);}(_0x55c7,0x127));var _0x755c=function(_0x2447ac,_0x5c4dee){_0x2447ac=_0x2447ac-0x0;var _0xe89aab=_0x55c7[_0x2447ac];return _0xe89aab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x755c('0x0'));var zipdir=require(_0x755c('0x1'));var jsonpatch=require(_0x755c('0x2'));var rp=require(_0x755c('0x3'));var moment=require(_0x755c('0x4'));var BPromise=require(_0x755c('0x5'));var Mustache=require('mustache');var util=require(_0x755c('0x6'));var path=require('path');var sox=require(_0x755c('0x7'));var csv=require('to-csv');var ejs=require(_0x755c('0x8'));var fs=require('fs');var fs_extra=require(_0x755c('0x9'));var _=require(_0x755c('0xa'));var squel=require('squel');var crypto=require(_0x755c('0xb'));var jsforce=require(_0x755c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x755c('0xd'));var Papa=require('papaparse');var Redis=require(_0x755c('0xe'));var authService=require(_0x755c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x755c('0x10'));var hardwareService=require(_0x755c('0x11'));var logger=require(_0x755c('0x12'))('api');var utils=require(_0x755c('0x13'));var config=require(_0x755c('0x14'));var licenseUtil=require(_0x755c('0x15'));var db=require(_0x755c('0x16'))['db'];config[_0x755c('0x17')]=_['defaults'](config[_0x755c('0x17')],{'host':_0x755c('0x18'),'port':0x18eb});var socket=require(_0x755c('0x19'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x755c('0x1a')](socket);function respondWithStatusCode(_0x21644a,_0x143357){_0x143357=_0x143357||0xcc;return function(_0x19a439){if(_0x19a439){return _0x21644a[_0x755c('0x1b')](_0x143357);}return _0x21644a[_0x755c('0x1c')](_0x143357)[_0x755c('0x1d')]();};}function respondWithResult(_0x53f154,_0x5f4bcc){_0x5f4bcc=_0x5f4bcc||0xc8;return function(_0x1ffcaf){if(_0x1ffcaf){return _0x53f154['status'](_0x5f4bcc)[_0x755c('0x1e')](_0x1ffcaf);}};}function respondWithFilteredResult(_0x4069f9,_0x5dd7fa){return function(_0x38aee4){if(_0x38aee4){var _0x3f6195=typeof _0x5dd7fa[_0x755c('0x1f')]===_0x755c('0x20')&&typeof _0x5dd7fa[_0x755c('0x21')]===_0x755c('0x20');var _0x47a2f7=_0x38aee4[_0x755c('0x22')];var _0x356f82=_0x3f6195?0x0:_0x5dd7fa[_0x755c('0x1f')];var _0x565e8f=_0x3f6195?_0x38aee4[_0x755c('0x22')]:_0x5dd7fa[_0x755c('0x1f')]+_0x5dd7fa[_0x755c('0x21')];var _0x5aa7ab;if(_0x565e8f>=_0x47a2f7){_0x565e8f=_0x47a2f7;_0x5aa7ab=0xc8;}else{_0x5aa7ab=0xce;}_0x4069f9['status'](_0x5aa7ab);return _0x4069f9['set'](_0x755c('0x23'),_0x356f82+'-'+_0x565e8f+'/'+_0x47a2f7)[_0x755c('0x1e')](_0x38aee4);}return null;};}function patchUpdates(_0x40b832){return function(_0x5a74e0){try{jsonpatch['apply'](_0x5a74e0,_0x40b832,!![]);}catch(_0x2b413b){return BPromise[_0x755c('0x24')](_0x2b413b);}return _0x5a74e0['save']();};}function saveUpdates(_0x3d65e9,_0x50ce22){return function(_0xe3cee7){if(_0xe3cee7){return _0xe3cee7[_0x755c('0x25')](_0x3d65e9)[_0x755c('0x26')](function(_0x267fea){return _0x267fea;});}return null;};}function removeEntity(_0x85826d,_0x1af4a1){return function(_0x42aab1){if(_0x42aab1){return _0x42aab1['destroy']()[_0x755c('0x26')](function(){var _0x58118a=_0x42aab1[_0x755c('0x27')]({'plain':!![]});var _0x16ad1a='MailQueues';return db[_0x755c('0x28')]['destroy']({'where':{'type':_0x16ad1a,'resourceId':_0x58118a['id']}})[_0x755c('0x26')](function(){return _0x42aab1;});})['then'](function(){_0x85826d[_0x755c('0x1c')](0xcc)[_0x755c('0x1d')]();});}};}function handleEntityNotFound(_0x25d79a,_0x1196cd){return function(_0x4b3946){if(!_0x4b3946){_0x25d79a[_0x755c('0x1b')](0x194);}return _0x4b3946;};}function handleError(_0xcf8367,_0x1562cb){_0x1562cb=_0x1562cb||0x1f4;return function(_0x5ccf22){logger[_0x755c('0x29')](_0x5ccf22[_0x755c('0x2a')]);if(_0x5ccf22[_0x755c('0x2b')]){delete _0x5ccf22[_0x755c('0x2b')];}_0xcf8367[_0x755c('0x1c')](_0x1562cb)[_0x755c('0x2c')](_0x5ccf22);};}exports[_0x755c('0x2d')]=function(_0x4a63fd,_0x381712){var _0x429c76={},_0x460a09={},_0x570310={'count':0x0,'rows':[]};var _0x7320b3=_[_0x755c('0x2e')](db[_0x755c('0x2f')]['rawAttributes'],function(_0x4f2eeb){return{'name':_0x4f2eeb[_0x755c('0x30')],'type':_0x4f2eeb[_0x755c('0x31')][_0x755c('0x32')]};});_0x460a09['model']=_['map'](_0x7320b3,'name');_0x460a09[_0x755c('0x33')]=_['keys'](_0x4a63fd[_0x755c('0x33')]);_0x460a09[_0x755c('0x34')]=_[_0x755c('0x35')](_0x460a09[_0x755c('0x36')],_0x460a09[_0x755c('0x33')]);_0x429c76[_0x755c('0x37')]=_[_0x755c('0x35')](_0x460a09['model'],qs[_0x755c('0x38')](_0x4a63fd[_0x755c('0x33')]['fields']));_0x429c76['attributes']=_0x429c76[_0x755c('0x37')][_0x755c('0x39')]?_0x429c76['attributes']:_0x460a09[_0x755c('0x36')];if(!_0x4a63fd[_0x755c('0x33')]['hasOwnProperty']('nolimit')){_0x429c76[_0x755c('0x21')]=qs['limit'](_0x4a63fd[_0x755c('0x33')][_0x755c('0x21')]);_0x429c76[_0x755c('0x1f')]=qs[_0x755c('0x1f')](_0x4a63fd[_0x755c('0x33')][_0x755c('0x1f')]);}_0x429c76[_0x755c('0x3a')]=qs['sort'](_0x4a63fd[_0x755c('0x33')][_0x755c('0x3b')]);_0x429c76[_0x755c('0x3c')]=qs[_0x755c('0x34')](_[_0x755c('0x3d')](_0x4a63fd[_0x755c('0x33')],_0x460a09[_0x755c('0x34')]),_0x7320b3);if(_0x4a63fd['query'][_0x755c('0x3e')]){_0x429c76[_0x755c('0x3c')]=_[_0x755c('0x3f')](_0x429c76[_0x755c('0x3c')],{'$or':_['map'](_0x7320b3,function(_0x321391){if(_0x321391[_0x755c('0x31')]!==_0x755c('0x40')){var _0x9aabd0={};_0x9aabd0[_0x321391['name']]={'$like':'%'+_0x4a63fd[_0x755c('0x33')][_0x755c('0x3e')]+'%'};return _0x9aabd0;}})});}_0x429c76=_[_0x755c('0x3f')]({},_0x429c76,_0x4a63fd['options']);var _0x44ba82={'where':_0x429c76[_0x755c('0x3c')]};return db[_0x755c('0x2f')][_0x755c('0x22')](_0x44ba82)[_0x755c('0x26')](function(_0x340c1f){_0x570310[_0x755c('0x22')]=_0x340c1f;if(_0x4a63fd[_0x755c('0x33')][_0x755c('0x41')]){_0x429c76[_0x755c('0x42')]=[{'all':!![]}];}return db[_0x755c('0x2f')][_0x755c('0x43')](_0x429c76);})['then'](function(_0x4a9113){_0x570310[_0x755c('0x44')]=_0x4a9113;return _0x570310;})[_0x755c('0x26')](respondWithFilteredResult(_0x381712,_0x429c76))[_0x755c('0x45')](handleError(_0x381712,null));};exports[_0x755c('0x46')]=function(_0x227c5f,_0x37b025){var _0x2dfb37={'raw':!![],'where':{'id':_0x227c5f['params']['id']}},_0x50b6e3={};_0x50b6e3['model']=_['keys'](db['MailQueue'][_0x755c('0x47')]);_0x50b6e3[_0x755c('0x33')]=_[_0x755c('0x48')](_0x227c5f['query']);_0x50b6e3[_0x755c('0x34')]=_['intersection'](_0x50b6e3[_0x755c('0x36')],_0x50b6e3[_0x755c('0x33')]);_0x2dfb37[_0x755c('0x37')]=_[_0x755c('0x35')](_0x50b6e3[_0x755c('0x36')],qs['fields'](_0x227c5f[_0x755c('0x33')][_0x755c('0x38')]));_0x2dfb37[_0x755c('0x37')]=_0x2dfb37[_0x755c('0x37')][_0x755c('0x39')]?_0x2dfb37[_0x755c('0x37')]:_0x50b6e3[_0x755c('0x36')];if(_0x227c5f['query']['includeAll']){_0x2dfb37[_0x755c('0x42')]=[{'all':!![]}];}_0x2dfb37=_['merge']({},_0x2dfb37,_0x227c5f[_0x755c('0x49')]);return db['MailQueue'][_0x755c('0x4a')](_0x2dfb37)[_0x755c('0x26')](handleEntityNotFound(_0x37b025,null))['then'](respondWithResult(_0x37b025,null))[_0x755c('0x45')](handleError(_0x37b025,null));};exports[_0x755c('0x4b')]=function(_0x3a06bc,_0x4e132b){return db[_0x755c('0x2f')][_0x755c('0x4b')](_0x3a06bc['body'],{})[_0x755c('0x26')](function(_0x4c971a){var _0x5e22c7=_0x3a06bc[_0x755c('0x4c')][_0x755c('0x27')]({'plain':!![]});if(!_0x5e22c7)throw new Error(_0x755c('0x4d'));if(_0x5e22c7[_0x755c('0x4e')]===_0x755c('0x4c')){var _0x28389a=_0x4c971a['get']({'plain':!![]});var _0x41cd4d=_0x755c('0x4f');return db[_0x755c('0x50')]['find']({'where':{'name':_0x41cd4d,'userProfileId':_0x5e22c7['userProfileId']},'raw':!![]})[_0x755c('0x26')](function(_0x52beac){if(_0x52beac&&_0x52beac[_0x755c('0x51')]===0x0){return db[_0x755c('0x28')][_0x755c('0x4b')]({'name':_0x28389a[_0x755c('0x2b')],'resourceId':_0x28389a['id'],'type':_0x52beac[_0x755c('0x2b')],'sectionId':_0x52beac['id']},{})[_0x755c('0x26')](function(){return _0x4c971a;});}else{return _0x4c971a;}})['catch'](function(_0x4ae033){logger[_0x755c('0x29')](_0x755c('0x52'),_0x4ae033);throw _0x4ae033;});}return _0x4c971a;})[_0x755c('0x26')](respondWithResult(_0x4e132b,0xc9))[_0x755c('0x45')](handleError(_0x4e132b,null));};exports['update']=function(_0x5ad2e5,_0xed69dc){if(_0x5ad2e5['body']['id']){delete _0x5ad2e5['body']['id'];}return db[_0x755c('0x2f')][_0x755c('0x4a')]({'where':{'id':_0x5ad2e5[_0x755c('0x53')]['id']}})[_0x755c('0x26')](handleEntityNotFound(_0xed69dc,null))[_0x755c('0x26')](saveUpdates(_0x5ad2e5[_0x755c('0x54')],null))['then'](respondWithResult(_0xed69dc,null))['catch'](handleError(_0xed69dc,null));};exports['destroy']=function(_0xe2affb,_0x26b9a2){return db[_0x755c('0x2f')][_0x755c('0x4a')]({'where':{'id':_0xe2affb[_0x755c('0x53')]['id']}})['then'](handleEntityNotFound(_0x26b9a2,null))[_0x755c('0x26')](removeEntity(_0x26b9a2,null))[_0x755c('0x45')](handleError(_0x26b9a2,null));};exports[_0x755c('0x55')]=function(_0x18ceb8,_0x53d7ff){return db[_0x755c('0x2f')][_0x755c('0x55')]()[_0x755c('0x26')](respondWithResult(_0x53d7ff,null))[_0x755c('0x45')](handleError(_0x53d7ff,null));};exports[_0x755c('0x56')]=function(_0x294352,_0x370920,_0x1321c4){var _0x23ce87={'raw':!![],'where':{}},_0x535229={},_0xfa6261;return db['MailQueue'][_0x755c('0x57')]({'where':{'id':_0x294352[_0x755c('0x53')]['id']}})['then'](handleEntityNotFound(_0x370920,null))[_0x755c('0x26')](function(_0x2cae22){if(_0x2cae22){_0xfa6261=_0x2cae22[_0x755c('0x27')]({'plain':!![]});_0x535229['model']=_['keys'](db[_0x755c('0x58')][_0x755c('0x47')]);_0x535229[_0x755c('0x33')]=_[_0x755c('0x48')](_0x294352[_0x755c('0x33')]);_0x535229[_0x755c('0x34')]=_['intersection'](_0x535229[_0x755c('0x36')],_0x535229[_0x755c('0x33')]);_0x23ce87[_0x755c('0x37')]=_[_0x755c('0x35')](_0x535229[_0x755c('0x36')],qs[_0x755c('0x38')](_0x294352['query'][_0x755c('0x38')]));_0x23ce87[_0x755c('0x37')]=_0x23ce87[_0x755c('0x37')][_0x755c('0x39')]?_0x23ce87['attributes']:_0x535229[_0x755c('0x36')];if(!_0x294352[_0x755c('0x33')][_0x755c('0x59')]('nolimit')){_0x23ce87[_0x755c('0x21')]=qs['limit'](_0x294352['query']['limit']);_0x23ce87[_0x755c('0x1f')]=qs[_0x755c('0x1f')](_0x294352[_0x755c('0x33')][_0x755c('0x1f')]);}_0x23ce87['order']=qs[_0x755c('0x3b')](_0x294352['query'][_0x755c('0x3b')]);_0x23ce87[_0x755c('0x3c')]=qs[_0x755c('0x34')](_[_0x755c('0x3d')](_0x294352[_0x755c('0x33')],_0x535229[_0x755c('0x34')]));_0x23ce87[_0x755c('0x3c')][_0x755c('0x5a')]=_0x2cae22['id'];if(_0x294352['query'][_0x755c('0x3e')]){_0x23ce87[_0x755c('0x3c')]=_[_0x755c('0x3f')](_0x23ce87[_0x755c('0x3c')],{'$or':_[_0x755c('0x2e')](_0x23ce87[_0x755c('0x37')],function(_0x5cf510){var _0x3e2047={};_0x3e2047[_0x5cf510]={'$like':'%'+_0x294352[_0x755c('0x33')][_0x755c('0x3e')]+'%'};return _0x3e2047;})});}_0x23ce87=_[_0x755c('0x3f')]({},_0x23ce87,_0x294352[_0x755c('0x49')]);return db[_0x755c('0x58')]['findAll'](_0x23ce87);}})['then'](function(_0x2ec5a0){if(_0x2ec5a0){return db[_0x755c('0x5b')][_0x755c('0x5c')]({'where':{'id':_['map'](_0x2ec5a0,_0x755c('0x5d')),'role':_0x755c('0x5e')},'attributes':['id',_0x755c('0x2b'),_0x755c('0x5f'),_0x755c('0x60'),_0x755c('0x61')]});}})[_0x755c('0x26')](function(_0x4eed24){if(_0x4eed24){return{'count':_0x4eed24[_0x755c('0x22')],'rows':_['map'](_0x4eed24['rows'],function(_0x3d4ebc){return{'membername':_0x3d4ebc['name'],'UserId':_0x3d4ebc['id'],'queue_name':_0xfa6261['name'],'MailQueueId':_0xfa6261['id'],'interface':util[_0x755c('0x62')]('%s/%s',_0x755c('0x63'),_0x3d4ebc[_0x755c('0x2b')]),'penalty':0x0,'paused':_0x3d4ebc[_0x755c('0x5f')],'createdAt':_0x3d4ebc['createdAt'],'updatedAt':_0x3d4ebc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x370920,_0x23ce87))[_0x755c('0x45')](handleError(_0x370920,null));};exports[_0x755c('0x64')]=function(_0x3c3ec2,_0x5579f5,_0x2e1521){var _0x455dfb={};var _0x71512d={};var _0x5b290e;var _0x4f30ff;return db[_0x755c('0x2f')][_0x755c('0x57')]({'where':{'id':_0x3c3ec2[_0x755c('0x53')]['id']}})[_0x755c('0x26')](handleEntityNotFound(_0x5579f5,null))[_0x755c('0x26')](function(_0x55c0af){if(_0x55c0af){_0x5b290e=_0x55c0af;_0x71512d[_0x755c('0x36')]=_[_0x755c('0x48')](db[_0x755c('0x65')][_0x755c('0x47')]);_0x71512d['query']=_[_0x755c('0x48')](_0x3c3ec2['query']);_0x71512d[_0x755c('0x34')]=_[_0x755c('0x35')](_0x71512d[_0x755c('0x36')],_0x71512d[_0x755c('0x33')]);_0x455dfb['attributes']=_[_0x755c('0x35')](_0x71512d[_0x755c('0x36')],qs[_0x755c('0x38')](_0x3c3ec2[_0x755c('0x33')]['fields']));_0x455dfb[_0x755c('0x37')]=_0x455dfb[_0x755c('0x37')][_0x755c('0x39')]?_0x455dfb[_0x755c('0x37')]:_0x71512d[_0x755c('0x36')];_0x455dfb[_0x755c('0x3a')]=qs[_0x755c('0x3b')](_0x3c3ec2['query'][_0x755c('0x3b')]);_0x455dfb[_0x755c('0x3c')]=qs['filters'](_[_0x755c('0x3d')](_0x3c3ec2[_0x755c('0x33')],_0x71512d[_0x755c('0x34')]));if(_0x3c3ec2[_0x755c('0x33')][_0x755c('0x3e')]){_0x455dfb[_0x755c('0x3c')]=_[_0x755c('0x3f')](_0x455dfb[_0x755c('0x3c')],{'$or':_['map'](_0x455dfb[_0x755c('0x37')],function(_0x54377c){var _0x3e5198={};_0x3e5198[_0x54377c]={'$like':'%'+_0x3c3ec2[_0x755c('0x33')]['filter']+'%'};return _0x3e5198;})});}_0x455dfb=_[_0x755c('0x3f')]({},_0x455dfb,_0x3c3ec2['options']);return _0x5b290e[_0x755c('0x64')](_0x455dfb);}})[_0x755c('0x26')](function(_0x5e4f63){if(_0x5e4f63){_0x4f30ff=_0x5e4f63[_0x755c('0x39')];if(!_0x3c3ec2[_0x755c('0x33')]['hasOwnProperty'](_0x755c('0x66'))){_0x455dfb[_0x755c('0x21')]=qs[_0x755c('0x21')](_0x3c3ec2[_0x755c('0x33')][_0x755c('0x21')]);_0x455dfb['offset']=qs[_0x755c('0x1f')](_0x3c3ec2[_0x755c('0x33')][_0x755c('0x1f')]);}return _0x5b290e[_0x755c('0x64')](_0x455dfb);}})['then'](function(_0x5b1c1c){if(_0x5b1c1c){return _0x5b1c1c?{'count':_0x4f30ff,'rows':_0x5b1c1c}:null;}})[_0x755c('0x26')](respondWithResult(_0x5579f5,null))[_0x755c('0x45')](handleError(_0x5579f5,null));};exports[_0x755c('0x67')]=function(_0x1ad953,_0x162f55,_0x25be5c){var _0x6ba2eb=_0x1ad953[_0x755c('0x54')][_0x755c('0x68')];return db[_0x755c('0x65')][_0x755c('0x43')]({'where':{'id':_0x6ba2eb},'attributes':['id'],'include':[{'model':db[_0x755c('0x5b')],'as':_0x755c('0x69'),'attributes':['id','name','online',_0x755c('0x6a'),_0x755c('0x6b')],'raw':!![]}]})[_0x755c('0x26')](function(_0x131942){if(_0x131942){var _0x287988=_[_0x755c('0x6c')](_0x131942,function(_0x1d8a6e){var _0xf91721=_0x1d8a6e['get']({'plain':!![]});return _0xf91721[_0x755c('0x69')];});return db[_0x755c('0x2f')][_0x755c('0x4a')]({'where':{'id':_0x1ad953['params']['id']}})['then'](function(_0x13c999){return db[_0x755c('0x6d')]['transaction'](function(_0x4dea5a){return _0x13c999[_0x755c('0x67')](_0x6ba2eb,{'transaction':_0x4dea5a})[_0x755c('0x26')](function(){return BPromise[_0x755c('0x6e')](_0x287988,function(_0x4ce7f2){return db[_0x755c('0x58')][_0x755c('0x6f')]({'where':{'UserId':_0x4ce7f2['id'],'MailQueueId':_0x1ad953['params']['id']},'transaction':_0x4dea5a});});})['then'](function(){_0x287988[_0x755c('0x70')](function(_0x18ef6a){socket[_0x755c('0x71')](_0x755c('0x72'),{'UserId':_0x18ef6a['id'],'MailQueueId':_0x13c999['id']});});});});});}})[_0x755c('0x26')](respondWithStatusCode(_0x162f55,null))['catch'](handleError(_0x162f55,null));};exports['removeTeams']=function(_0x305f59,_0x54a66c,_0x11c1df){return db['Team'][_0x755c('0x43')]({'where':{'id':_0x305f59['query'][_0x755c('0x68')]},'attributes':['id'],'include':[{'model':db[_0x755c('0x5b')],'as':_0x755c('0x69'),'attributes':['id'],'raw':!![]}]})[_0x755c('0x26')](handleEntityNotFound(_0x54a66c,null))[_0x755c('0x26')](function(_0x1f0e05){var _0x42cf1a=_['map'](_0x1f0e05,'id');var _0x4baba2=[];var _0x46ec60=[];var _0x5170fc=squel[_0x755c('0x73')]();_0x5170fc['field'](_0x755c('0x74'))[_0x755c('0x75')](_0x755c('0x76'),'tq')[_0x755c('0x77')](_0x755c('0x78'),'ut',_0x755c('0x79'))[_0x755c('0x3c')](_0x755c('0x7a'),_0x305f59['params']['id']);for(var _0x22bb12=0x0;_0x22bb12<_0x1f0e05[_0x755c('0x39')];_0x22bb12+=0x1){let _0x37ee59=_0x1f0e05[_0x22bb12];for(var _0x3c8f61=0x0;_0x3c8f61<_0x37ee59['Agents']['length'];_0x3c8f61+=0x1){let _0x2c3e0d=_0x37ee59[_0x755c('0x69')][_0x3c8f61];var _0x2c6f46=_0x5170fc[_0x755c('0x7b')]();_0x2c6f46[_0x755c('0x3c')](_0x755c('0x7c'),_0x2c3e0d['id']);_0x46ec60[_0x755c('0x7d')](db[_0x755c('0x6d')][_0x755c('0x33')](_0x2c6f46[_0x755c('0x7e')](),{'type':db[_0x755c('0x6d')][_0x755c('0x7f')][_0x755c('0x80')]})['then'](function(_0x5cc609){if(_0x5cc609[_0x755c('0x39')]===0x1){return _0x2c3e0d['id'];}else{var _0xf0e944=_[_0x755c('0x81')](_[_0x755c('0x2e')](_0x5cc609,'TeamId'),function(_0x564c4f){return _['includes'](_0x42cf1a,_0x564c4f);});if(_0xf0e944){return _0x2c3e0d['id'];}}}));}}return BPromise[_0x755c('0x82')](_0x46ec60)[_0x755c('0x26')](function(_0x386968){_0x4baba2=_(_0x4baba2)['union'](_0x386968)[_0x755c('0x83')]()['value']();return db[_0x755c('0x2f')][_0x755c('0x4a')]({'where':{'id':_0x305f59['params']['id']}})[_0x755c('0x26')](function(_0x3ef43a){return db[_0x755c('0x6d')][_0x755c('0x84')](function(_0x203d02){return _0x3ef43a[_0x755c('0x85')](_0x305f59[_0x755c('0x33')][_0x755c('0x68')],{'transaction':_0x203d02})[_0x755c('0x26')](function(){if(!_[_0x755c('0x86')](_0x4baba2)){return _0x3ef43a[_0x755c('0x87')](_0x4baba2,{'transaction':_0x203d02});}})[_0x755c('0x26')](function(){_0x4baba2['forEach'](function(_0x39c7c5){socket[_0x755c('0x71')](_0x755c('0x88'),{'UserId':_0x39c7c5,'MailQueueId':_0x3ef43a['id']});});});});});});})['then'](respondWithStatusCode(_0x54a66c,null))[_0x755c('0x45')](handleError(_0x54a66c,null));};exports[_0x755c('0x89')]=function(_0x2de437,_0x4b26c4,_0x239a92){return db[_0x755c('0x2f')][_0x755c('0x4a')]({'where':{'id':_0x2de437[_0x755c('0x53')]['id']}})['then'](handleEntityNotFound(_0x4b26c4,null))[_0x755c('0x26')](function(_0x3366ba){if(_0x3366ba){return _0x3366ba[_0x755c('0x89')](_0x2de437[_0x755c('0x54')]['ids'],_[_0x755c('0x8a')](_0x2de437[_0x755c('0x54')],[_0x755c('0x68'),'id'])||{})[_0x755c('0x8b')](function(_0x154097){for(var _0x250f43=0x0;_0x250f43<_0x2de437[_0x755c('0x54')][_0x755c('0x68')][_0x755c('0x39')];_0x250f43+=0x1){socket[_0x755c('0x71')]('userMailQueue:save',{'UserId':Number(_0x2de437[_0x755c('0x54')][_0x755c('0x68')][_0x250f43]),'MailQueueId':Number(_0x2de437['params']['id'])});}return _0x154097;});}})[_0x755c('0x26')](respondWithResult(_0x4b26c4,null))['catch'](handleError(_0x4b26c4,null));};exports['removeAgents']=function(_0x2160f1,_0x1fcb49,_0x191940){return db[_0x755c('0x2f')]['find']({'where':{'id':_0x2160f1[_0x755c('0x53')]['id']}})[_0x755c('0x26')](handleEntityNotFound(_0x1fcb49,null))['then'](function(_0x52a4aa){if(_0x52a4aa){return _0x52a4aa[_0x755c('0x87')](_0x2160f1[_0x755c('0x33')]['ids'])[_0x755c('0x26')](function(){if(_['isArray'](_0x2160f1['query']['ids'])){for(var _0x356f6e=0x0;_0x356f6e<_0x2160f1['query']['ids'][_0x755c('0x39')];_0x356f6e+=0x1){socket[_0x755c('0x71')](_0x755c('0x88'),{'UserId':Number(_0x2160f1['query'][_0x755c('0x68')][_0x356f6e]),'MailQueueId':Number(_0x2160f1['params']['id'])});}}else{socket['emit'](_0x755c('0x88'),{'UserId':Number(_0x2160f1[_0x755c('0x33')]['ids']),'MailQueueId':Number(_0x2160f1[_0x755c('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x1fcb49,null))[_0x755c('0x45')](handleError(_0x1fcb49,null));};exports[_0x755c('0x8c')]=function(_0xc183ad,_0x34dda0,_0x53af11){var _0x32e06e={};var _0x168bea={};var _0x364759;var _0xa87a6f;return db[_0x755c('0x2f')]['findOne']({'where':{'id':_0xc183ad[_0x755c('0x53')]['id']}})[_0x755c('0x26')](handleEntityNotFound(_0x34dda0,null))['then'](function(_0x3b8b14){if(_0x3b8b14){_0x364759=_0x3b8b14;_0x168bea[_0x755c('0x36')]=_['keys'](db[_0x755c('0x5b')][_0x755c('0x47')]);_0x168bea[_0x755c('0x33')]=_['keys'](_0xc183ad[_0x755c('0x33')]);_0x168bea[_0x755c('0x34')]=_[_0x755c('0x35')](_0x168bea[_0x755c('0x36')],_0x168bea[_0x755c('0x33')]);_0x32e06e[_0x755c('0x37')]=_['intersection'](_0x168bea['model'],qs['fields'](_0xc183ad[_0x755c('0x33')]['fields']));_0x32e06e[_0x755c('0x37')]=_0x32e06e[_0x755c('0x37')][_0x755c('0x39')]?_0x32e06e[_0x755c('0x37')]:_0x168bea[_0x755c('0x36')];_0x32e06e[_0x755c('0x3a')]=qs[_0x755c('0x3b')](_0xc183ad[_0x755c('0x33')][_0x755c('0x3b')]);_0x32e06e[_0x755c('0x3c')]=qs[_0x755c('0x34')](_['pick'](_0xc183ad[_0x755c('0x33')],_0x168bea[_0x755c('0x34')]));if(_0xc183ad[_0x755c('0x33')]['filter']){_0x32e06e[_0x755c('0x3c')]=_[_0x755c('0x3f')](_0x32e06e[_0x755c('0x3c')],{'$or':_[_0x755c('0x2e')](_0x32e06e[_0x755c('0x37')],function(_0x195c8c){var _0x30ae1b={};_0x30ae1b[_0x195c8c]={'$like':'%'+_0xc183ad[_0x755c('0x33')][_0x755c('0x3e')]+'%'};return _0x30ae1b;})});}_0x32e06e=_[_0x755c('0x3f')]({},_0x32e06e,_0xc183ad['options']);return _0x364759[_0x755c('0x8c')](_0x32e06e);}})['then'](function(_0x2301de){if(_0x2301de){_0xa87a6f=_0x2301de[_0x755c('0x39')];if(!_0xc183ad['query'][_0x755c('0x59')](_0x755c('0x66'))){_0x32e06e[_0x755c('0x21')]=qs[_0x755c('0x21')](_0xc183ad[_0x755c('0x33')][_0x755c('0x21')]);_0x32e06e['offset']=qs[_0x755c('0x1f')](_0xc183ad[_0x755c('0x33')][_0x755c('0x1f')]);}return _0x364759[_0x755c('0x8c')](_0x32e06e);}})['then'](function(_0x1d614c){if(_0x1d614c){return _0x1d614c?{'count':_0xa87a6f,'rows':_0x1d614c}:null;}})[_0x755c('0x26')](respondWithResult(_0x34dda0,null))[_0x755c('0x45')](handleError(_0x34dda0,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 70d84c6..32f0d28 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 _0x48a2=['update','remove','emit','hook','events','../../mysqldb','MailQueue','save'];(function(_0x58d5d4,_0x4f05a3){var _0x596a07=function(_0x34a6c6){while(--_0x34a6c6){_0x58d5d4['push'](_0x58d5d4['shift']());}};_0x596a07(++_0x4f05a3);}(_0x48a2,0x1ec));var _0x248a=function(_0x845fcc,_0x518cfb){_0x845fcc=_0x845fcc-0x0;var _0x3a0e79=_0x48a2[_0x845fcc];return _0x3a0e79;};'use strict';var EventEmitter=require(_0x248a('0x0'));var MailQueue=require(_0x248a('0x1'))['db'][_0x248a('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x248a('0x3'),'afterUpdate':_0x248a('0x4'),'afterDestroy':_0x248a('0x5')};function emitEvent(_0x4c7c34){return function(_0x23b124,_0x320f2a,_0x4ee0a9){MailQueueEvents[_0x248a('0x6')](_0x4c7c34+':'+_0x23b124['id'],_0x23b124);MailQueueEvents['emit'](_0x4c7c34,_0x23b124);_0x4ee0a9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x248a('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x9ad7=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hook'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x9ad7,0x69));var _0x79ad=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x9ad7[_0x3305de];return _0x3b5a84;};'use strict';var EventEmitter=require(_0x79ad('0x0'));var MailQueue=require(_0x79ad('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x79ad('0x2')](0x0);var events={'afterCreate':_0x79ad('0x3'),'afterUpdate':_0x79ad('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51320e){return function(_0x556f51,_0x55f3f2,_0x2ae7b4){MailQueueEvents[_0x79ad('0x5')](_0x51320e+':'+_0x556f51['id'],_0x556f51);MailQueueEvents[_0x79ad('0x5')](_0x51320e,_0x556f51);_0x2ae7b4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x79ad('0x6')](e,emitEvent(event));}}module[_0x79ad('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6712a07..5c1f88b 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 _0xd417=['MailQueue','mail_queues','util','api','moment','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xd417,0x7b));var _0x7d41=function(_0x1a7df0,_0x3c30fa){_0x1a7df0=_0x1a7df0-0x0;var _0x2f1eb0=_0xd417[_0x1a7df0];return _0x2f1eb0;};'use strict';var _=require('lodash');var util=require(_0x7d41('0x0'));var logger=require('../../config/logger')(_0x7d41('0x1'));var moment=require(_0x7d41('0x2'));var BPromise=require('bluebird');var rp=require(_0x7d41('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d41('0x4'));var config=require(_0x7d41('0x5'));var attributes=require(_0x7d41('0x6'));module[_0x7d41('0x7')]=function(_0x4fd13f,_0x5294fe){return _0x4fd13f[_0x7d41('0x8')](_0x7d41('0x9'),attributes,{'tableName':_0x7d41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ac5=['define','MailQueue','mail_queues','lodash','util','bluebird','request-promise','path','rimraf','./mailQueue.attributes'];(function(_0x3cde46,_0x37d394){var _0x46752a=function(_0x35a8fd){while(--_0x35a8fd){_0x3cde46['push'](_0x3cde46['shift']());}};_0x46752a(++_0x37d394);}(_0x0ac5,0x12f));var _0x50ac=function(_0x24b3ed,_0x42463f){_0x24b3ed=_0x24b3ed-0x0;var _0x2d2ba=_0x0ac5[_0x24b3ed];return _0x2d2ba;};'use strict';var _=require(_0x50ac('0x0'));var util=require(_0x50ac('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x50ac('0x2'));var rp=require(_0x50ac('0x3'));var fs=require('fs');var path=require(_0x50ac('0x4'));var rimraf=require(_0x50ac('0x5'));var config=require('../../config/environment');var attributes=require(_0x50ac('0x6'));module['exports']=function(_0x6e5255,_0x50f479){return _0x6e5255[_0x50ac('0x7')](_0x50ac('0x8'),attributes,{'tableName':_0x50ac('0x9'),'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 1c8ce07..e2ec679 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 _0x3f7e=['raw','where','attributes','include','map','model','GetMailQueue','stringify','ShowMailQueue','MailQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','findAll','options'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0x3f7e,0x1c3));var _0xe3f7=function(_0x13d052,_0x43480d){_0x13d052=_0x13d052-0x0;var _0x584650=_0x3f7e[_0x13d052];return _0x584650;};'use strict';var _=require(_0xe3f7('0x0'));var util=require('util');var moment=require(_0xe3f7('0x1'));var BPromise=require(_0xe3f7('0x2'));var rs=require(_0xe3f7('0x3'));var fs=require('fs');var Redis=require(_0xe3f7('0x4'));var db=require(_0xe3f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3f7('0x6'))('rpc');var config=require(_0xe3f7('0x7'));var jayson=require(_0xe3f7('0x8'));var client=jayson[_0xe3f7('0x9')][_0xe3f7('0xa')]({'port':0x232a});config[_0xe3f7('0xb')]=_[_0xe3f7('0xc')](config[_0xe3f7('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe3f7('0xd'))[_0xe3f7('0xe')](socket);function respondWithRpcPromise(_0x1190ad,_0x31f878,_0x51a513){return new BPromise(function(_0x2bb1bf,_0x37060a){return client[_0xe3f7('0xf')](_0x1190ad,_0x51a513)[_0xe3f7('0x10')](function(_0x2d3bf4){logger['info'](_0xe3f7('0x11'),_0x31f878,_0xe3f7('0x12'));logger[_0xe3f7('0x13')](_0xe3f7('0x14'),_0x31f878,_0xe3f7('0x12'),JSON['stringify'](_0x2d3bf4));if(_0x2d3bf4[_0xe3f7('0x15')]){if(_0x2d3bf4['error'][_0xe3f7('0x16')]===0x1f4){logger[_0xe3f7('0x15')](_0xe3f7('0x11'),_0x31f878,_0x2d3bf4[_0xe3f7('0x15')][_0xe3f7('0x17')]);return _0x37060a(_0x2d3bf4[_0xe3f7('0x15')][_0xe3f7('0x17')]);}logger[_0xe3f7('0x15')]('MailQueue,\x20%s,\x20%s',_0x31f878,_0x2d3bf4[_0xe3f7('0x15')][_0xe3f7('0x17')]);return _0x2bb1bf(_0x2d3bf4[_0xe3f7('0x15')][_0xe3f7('0x17')]);}else{logger[_0xe3f7('0x18')]('MailQueue,\x20%s,\x20%s',_0x31f878,_0xe3f7('0x12'));_0x2bb1bf(_0x2d3bf4[_0xe3f7('0x19')][_0xe3f7('0x17')]);}})[_0xe3f7('0x1a')](function(_0x2a08bf){logger[_0xe3f7('0x15')]('MailQueue,\x20%s,\x20%s',_0x31f878,_0x2a08bf);_0x37060a(_0x2a08bf);});});}exports['GetMailQueue']=function(_0x481ed8){var _0x55a200=this;return new Promise(function(_0x247d28,_0x288264){return db['MailQueue'][_0xe3f7('0x1b')]({'raw':_0x481ed8[_0xe3f7('0x1c')]?_0x481ed8[_0xe3f7('0x1c')][_0xe3f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x481ed8[_0xe3f7('0x1c')]?_0x481ed8[_0xe3f7('0x1c')][_0xe3f7('0x1e')]||null:null,'attributes':_0x481ed8[_0xe3f7('0x1c')]?_0x481ed8['options'][_0xe3f7('0x1f')]||null:null,'limit':_0x481ed8[_0xe3f7('0x1c')]?_0x481ed8['options']['limit']||null:null,'include':_0x481ed8[_0xe3f7('0x1c')]?_0x481ed8[_0xe3f7('0x1c')][_0xe3f7('0x20')]?_[_0xe3f7('0x21')](_0x481ed8[_0xe3f7('0x1c')]['include'],function(_0x426d48){return{'model':db[_0x426d48[_0xe3f7('0x22')]],'as':_0x426d48['as'],'attributes':_0x426d48[_0xe3f7('0x1f')],'include':_0x426d48[_0xe3f7('0x20')]?_[_0xe3f7('0x21')](_0x426d48['include'],function(_0x303b61){return{'model':db[_0x303b61[_0xe3f7('0x22')]],'as':_0x303b61['as'],'attributes':_0x303b61['attributes'],'include':_0x303b61['include']?_[_0xe3f7('0x21')](_0x303b61[_0xe3f7('0x20')],function(_0xd8fd65){return{'model':db[_0xd8fd65[_0xe3f7('0x22')]],'as':_0xd8fd65['as'],'attributes':_0xd8fd65[_0xe3f7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x417253){logger['info'](_0xe3f7('0x23'),_0x481ed8);logger[_0xe3f7('0x13')](_0xe3f7('0x23'),_0x481ed8,JSON[_0xe3f7('0x24')](_0x417253));_0x247d28(_0x417253);})[_0xe3f7('0x1a')](function(_0xf47857){logger[_0xe3f7('0x15')]('GetMailQueue',_0xf47857[_0xe3f7('0x17')],_0x481ed8);_0x288264(_0x55a200[_0xe3f7('0x15')](0x1f4,_0xf47857[_0xe3f7('0x17')]));});});};exports[_0xe3f7('0x25')]=function(_0x454477){var _0x2e8011=this;return new Promise(function(_0x1f3bf1,_0x4b91c8){return db[_0xe3f7('0x26')][_0xe3f7('0x27')]({'raw':_0x454477[_0xe3f7('0x1c')]?_0x454477[_0xe3f7('0x1c')][_0xe3f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x454477[_0xe3f7('0x1c')]?_0x454477[_0xe3f7('0x1c')]['where']||null:null,'attributes':_0x454477[_0xe3f7('0x1c')]?_0x454477[_0xe3f7('0x1c')][_0xe3f7('0x1f')]||null:null,'include':_0x454477[_0xe3f7('0x1c')]?_0x454477[_0xe3f7('0x1c')][_0xe3f7('0x20')]?_[_0xe3f7('0x21')](_0x454477[_0xe3f7('0x1c')]['include'],function(_0x2bd87a){return{'model':db[_0x2bd87a[_0xe3f7('0x22')]],'as':_0x2bd87a['as'],'attributes':_0x2bd87a[_0xe3f7('0x1f')],'include':_0x2bd87a[_0xe3f7('0x20')]?_['map'](_0x2bd87a['include'],function(_0x2b7565){return{'model':db[_0x2b7565[_0xe3f7('0x22')]],'as':_0x2b7565['as'],'attributes':_0x2b7565[_0xe3f7('0x1f')],'include':_0x2b7565[_0xe3f7('0x20')]?_[_0xe3f7('0x21')](_0x2b7565['include'],function(_0x2363f5){return{'model':db[_0x2363f5[_0xe3f7('0x22')]],'as':_0x2363f5['as'],'attributes':_0x2363f5[_0xe3f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe3f7('0x10')](function(_0x4d9f1c){logger[_0xe3f7('0x18')]('ShowMailQueue',_0x454477);logger[_0xe3f7('0x13')](_0xe3f7('0x25'),_0x454477,JSON[_0xe3f7('0x24')](_0x4d9f1c));_0x1f3bf1(_0x4d9f1c);})['catch'](function(_0x30de8b){logger[_0xe3f7('0x15')](_0xe3f7('0x25'),_0x30de8b[_0xe3f7('0x17')],_0x454477);_0x4b91c8(_0x2e8011['error'](0x1f4,_0x30de8b[_0xe3f7('0x17')]));});});}; \ No newline at end of file +var _0xcc6b=['stringify','error','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x4590d0,_0x4d7c81){var _0x2c777d=function(_0x56aba6){while(--_0x56aba6){_0x4590d0['push'](_0x4590d0['shift']());}};_0x2c777d(++_0x4d7c81);}(_0xcc6b,0xe3));var _0xbcc6=function(_0x55e75c,_0x51cb2d){_0x55e75c=_0x55e75c-0x0;var _0x24f4bd=_0xcc6b[_0x55e75c];return _0x24f4bd;};'use strict';var _=require('lodash');var util=require(_0xbcc6('0x0'));var moment=require(_0xbcc6('0x1'));var BPromise=require(_0xbcc6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcc6('0x3'))['db'];var utils=require(_0xbcc6('0x4'));var logger=require(_0xbcc6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbcc6('0x6')][_0xbcc6('0x7')]({'port':0x232a});config[_0xbcc6('0x8')]=_['defaults'](config[_0xbcc6('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xbcc6('0x9'))(new Redis(config[_0xbcc6('0x8')]));require(_0xbcc6('0xa'))[_0xbcc6('0xb')](socket);function respondWithRpcPromise(_0x421d1c,_0x5bc132,_0x387b19){return new BPromise(function(_0x3221a2,_0xf63e6b){return client[_0xbcc6('0xc')](_0x421d1c,_0x387b19)[_0xbcc6('0xd')](function(_0x18684c){logger[_0xbcc6('0xe')]('MailQueue,\x20%s,\x20%s',_0x5bc132,_0xbcc6('0xf'));logger[_0xbcc6('0x10')](_0xbcc6('0x11'),_0x5bc132,_0xbcc6('0xf'),JSON[_0xbcc6('0x12')](_0x18684c));if(_0x18684c[_0xbcc6('0x13')]){if(_0x18684c[_0xbcc6('0x13')]['code']===0x1f4){logger[_0xbcc6('0x13')](_0xbcc6('0x14'),_0x5bc132,_0x18684c[_0xbcc6('0x13')][_0xbcc6('0x15')]);return _0xf63e6b(_0x18684c[_0xbcc6('0x13')][_0xbcc6('0x15')]);}logger['error'](_0xbcc6('0x14'),_0x5bc132,_0x18684c[_0xbcc6('0x13')][_0xbcc6('0x15')]);return _0x3221a2(_0x18684c[_0xbcc6('0x13')][_0xbcc6('0x15')]);}else{logger[_0xbcc6('0xe')](_0xbcc6('0x14'),_0x5bc132,'request\x20sent');_0x3221a2(_0x18684c[_0xbcc6('0x16')][_0xbcc6('0x15')]);}})[_0xbcc6('0x17')](function(_0x3b797b){logger['error']('MailQueue,\x20%s,\x20%s',_0x5bc132,_0x3b797b);_0xf63e6b(_0x3b797b);});});}exports[_0xbcc6('0x18')]=function(_0x9a4930){var _0x746779=this;return new Promise(function(_0x56ca5e,_0x5901f9){return db[_0xbcc6('0x19')]['findAll']({'raw':_0x9a4930[_0xbcc6('0x1a')]?_0x9a4930['options'][_0xbcc6('0x1b')]===undefined?!![]:![]:!![],'where':_0x9a4930[_0xbcc6('0x1a')]?_0x9a4930['options'][_0xbcc6('0x1c')]||null:null,'attributes':_0x9a4930[_0xbcc6('0x1a')]?_0x9a4930[_0xbcc6('0x1a')][_0xbcc6('0x1d')]||null:null,'limit':_0x9a4930['options']?_0x9a4930[_0xbcc6('0x1a')][_0xbcc6('0x1e')]||null:null,'include':_0x9a4930[_0xbcc6('0x1a')]?_0x9a4930[_0xbcc6('0x1a')][_0xbcc6('0x1f')]?_[_0xbcc6('0x20')](_0x9a4930[_0xbcc6('0x1a')]['include'],function(_0x315f8c){return{'model':db[_0x315f8c['model']],'as':_0x315f8c['as'],'attributes':_0x315f8c['attributes'],'include':_0x315f8c[_0xbcc6('0x1f')]?_['map'](_0x315f8c['include'],function(_0x1cbe05){return{'model':db[_0x1cbe05[_0xbcc6('0x21')]],'as':_0x1cbe05['as'],'attributes':_0x1cbe05[_0xbcc6('0x1d')],'include':_0x1cbe05[_0xbcc6('0x1f')]?_[_0xbcc6('0x20')](_0x1cbe05[_0xbcc6('0x1f')],function(_0xeae77f){return{'model':db[_0xeae77f['model']],'as':_0xeae77f['as'],'attributes':_0xeae77f['attributes']};}):[]};}):[]};}):[]:[]})[_0xbcc6('0xd')](function(_0x28f7d0){logger[_0xbcc6('0xe')](_0xbcc6('0x18'),_0x9a4930);logger['debug'](_0xbcc6('0x18'),_0x9a4930,JSON[_0xbcc6('0x12')](_0x28f7d0));_0x56ca5e(_0x28f7d0);})['catch'](function(_0x16d2e8){logger[_0xbcc6('0x13')](_0xbcc6('0x18'),_0x16d2e8[_0xbcc6('0x15')],_0x9a4930);_0x5901f9(_0x746779[_0xbcc6('0x13')](0x1f4,_0x16d2e8[_0xbcc6('0x15')]));});});};exports[_0xbcc6('0x22')]=function(_0x3c500a){var _0x3f147b=this;return new Promise(function(_0x37d735,_0xb2923c){return db[_0xbcc6('0x19')]['find']({'raw':_0x3c500a[_0xbcc6('0x1a')]?_0x3c500a[_0xbcc6('0x1a')][_0xbcc6('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c500a[_0xbcc6('0x1a')]?_0x3c500a[_0xbcc6('0x1a')][_0xbcc6('0x1c')]||null:null,'attributes':_0x3c500a['options']?_0x3c500a['options'][_0xbcc6('0x1d')]||null:null,'include':_0x3c500a[_0xbcc6('0x1a')]?_0x3c500a[_0xbcc6('0x1a')][_0xbcc6('0x1f')]?_['map'](_0x3c500a[_0xbcc6('0x1a')][_0xbcc6('0x1f')],function(_0x49e65f){return{'model':db[_0x49e65f[_0xbcc6('0x21')]],'as':_0x49e65f['as'],'attributes':_0x49e65f[_0xbcc6('0x1d')],'include':_0x49e65f[_0xbcc6('0x1f')]?_[_0xbcc6('0x20')](_0x49e65f[_0xbcc6('0x1f')],function(_0x2d6b87){return{'model':db[_0x2d6b87[_0xbcc6('0x21')]],'as':_0x2d6b87['as'],'attributes':_0x2d6b87[_0xbcc6('0x1d')],'include':_0x2d6b87[_0xbcc6('0x1f')]?_[_0xbcc6('0x20')](_0x2d6b87[_0xbcc6('0x1f')],function(_0x190c17){return{'model':db[_0x190c17[_0xbcc6('0x21')]],'as':_0x190c17['as'],'attributes':_0x190c17[_0xbcc6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbcc6('0xd')](function(_0x543aeb){logger[_0xbcc6('0xe')](_0xbcc6('0x22'),_0x3c500a);logger[_0xbcc6('0x10')](_0xbcc6('0x22'),_0x3c500a,JSON[_0xbcc6('0x12')](_0x543aeb));_0x37d735(_0x543aeb);})['catch'](function(_0x4d3d26){logger[_0xbcc6('0x13')]('ShowMailQueue',_0x4d3d26[_0xbcc6('0x15')],_0x3c500a);_0xb2923c(_0x3f147b['error'](0x1f4,_0x4d3d26[_0xbcc6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 2dfc0ae..02b546a 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 _0xa4b5=['./mailQueue.events','save','remove','update','emit','removeListener','register','mailQueue:'];(function(_0x333dd8,_0x385563){var _0x15ac7b=function(_0x52d37d){while(--_0x52d37d){_0x333dd8['push'](_0x333dd8['shift']());}};_0x15ac7b(++_0x385563);}(_0xa4b5,0x100));var _0x5a4b=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xa4b5[_0x40bffc];return _0x3007e9;};'use strict';var MailQueueEvents=require(_0x5a4b('0x0'));var events=[_0x5a4b('0x1'),_0x5a4b('0x2'),_0x5a4b('0x3')];function createListener(_0x13652c,_0x4f3971){return function(_0x390f51){_0x4f3971[_0x5a4b('0x4')](_0x13652c,_0x390f51);};}function removeListener(_0x4fdab8,_0x353ae5){return function(){MailQueueEvents[_0x5a4b('0x5')](_0x4fdab8,_0x353ae5);};}exports[_0x5a4b('0x6')]=function(_0x3d3a3b){for(var _0x58c222=0x0,_0x152f55=events['length'];_0x58c222<_0x152f55;_0x58c222++){var _0x41c0c0=events[_0x58c222];var _0x5e1405=createListener(_0x5a4b('0x7')+_0x41c0c0,_0x3d3a3b);MailQueueEvents['on'](_0x41c0c0,_0x5e1405);}}; \ No newline at end of file +var _0x0c87=['update','emit','removeListener','register','length','./mailQueue.events','save','remove'];(function(_0x3663e6,_0x2bba42){var _0x26887c=function(_0x40c519){while(--_0x40c519){_0x3663e6['push'](_0x3663e6['shift']());}};_0x26887c(++_0x2bba42);}(_0x0c87,0x1d5));var _0x70c8=function(_0x535e1e,_0x2b3930){_0x535e1e=_0x535e1e-0x0;var _0x5161d2=_0x0c87[_0x535e1e];return _0x5161d2;};'use strict';var MailQueueEvents=require(_0x70c8('0x0'));var events=[_0x70c8('0x1'),_0x70c8('0x2'),_0x70c8('0x3')];function createListener(_0x10c46c,_0x367b10){return function(_0x410dcb){_0x367b10[_0x70c8('0x4')](_0x10c46c,_0x410dcb);};}function removeListener(_0x35c5e1,_0x4a4753){return function(){MailQueueEvents[_0x70c8('0x5')](_0x35c5e1,_0x4a4753);};}exports[_0x70c8('0x6')]=function(_0x5e7ae5){for(var _0xc8fed5=0x0,_0x308372=events[_0x70c8('0x7')];_0xc8fed5<_0x308372;_0xc8fed5++){var _0x162501=events[_0xc8fed5];var _0x440f68=createListener('mailQueue:'+_0x162501,_0x5e7ae5);MailQueueEvents['on'](_0x162501,_0x440f68);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 84fc294..17c7a07 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 _0x20a3=['show','post','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','/describe','isAuthenticated'];(function(_0x5dee2a,_0x47d02a){var _0x31e98e=function(_0x48b1e9){while(--_0x48b1e9){_0x5dee2a['push'](_0x5dee2a['shift']());}};_0x31e98e(++_0x47d02a);}(_0x20a3,0xc2));var _0x320a=function(_0x520a70,_0x458656){_0x520a70=_0x520a70-0x0;var _0x547e6d=_0x20a3[_0x520a70];return _0x547e6d;};'use strict';var multer=require(_0x320a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x320a('0x1'));var express=require(_0x320a('0x2'));var router=express[_0x320a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x320a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x320a('0x5'));var controller=require(_0x320a('0x6'));router[_0x320a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x320a('0x8'),auth[_0x320a('0x9')](),controller['describe']);router[_0x320a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x320a('0xa')]);router[_0x320a('0xb')]('/',auth[_0x320a('0x9')](),controller['create']);router['put'](_0x320a('0xc'),auth[_0x320a('0x9')](),controller[_0x320a('0xd')]);router[_0x320a('0xe')](_0x320a('0xc'),auth[_0x320a('0x9')](),controller[_0x320a('0xf')]);module[_0x320a('0x10')]=router; \ No newline at end of file +var _0x138e=['show','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x415a89,_0x2ef8a6){var _0x3f3c1e=function(_0x1c8876){while(--_0x1c8876){_0x415a89['push'](_0x415a89['shift']());}};_0x3f3c1e(++_0x2ef8a6);}(_0x138e,0x195));var _0xe138=function(_0x1dd080,_0x361b67){_0x1dd080=_0x1dd080-0x0;var _0x3eeb8b=_0x138e[_0x1dd080];return _0x3eeb8b;};'use strict';var multer=require(_0xe138('0x0'));var util=require('util');var path=require(_0xe138('0x1'));var timeout=require(_0xe138('0x2'));var express=require(_0xe138('0x3'));var router=express[_0xe138('0x4')]();var fs_extra=require(_0xe138('0x5'));var auth=require(_0xe138('0x6'));var interaction=require(_0xe138('0x7'));var config=require(_0xe138('0x8'));var controller=require(_0xe138('0x9'));router[_0xe138('0xa')]('/',auth[_0xe138('0xb')](),controller[_0xe138('0xc')]);router['get']('/describe',auth[_0xe138('0xb')](),controller[_0xe138('0xd')]);router[_0xe138('0xa')](_0xe138('0xe'),auth[_0xe138('0xb')](),controller[_0xe138('0xf')]);router['post']('/',auth[_0xe138('0xb')](),controller[_0xe138('0x10')]);router[_0xe138('0x11')](_0xe138('0xe'),auth[_0xe138('0xb')](),controller['update']);router[_0xe138('0x12')](_0xe138('0xe'),auth[_0xe138('0xb')](),controller[_0xe138('0x13')]);module[_0xe138('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 f0d2aa2..3cbcd0a 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 _0xa703=['moment','exports','STRING','DATE'];(function(_0x3497fb,_0x2b54fa){var _0x59cd7c=function(_0x4c67ac){while(--_0x4c67ac){_0x3497fb['push'](_0x3497fb['shift']());}};_0x59cd7c(++_0x2b54fa);}(_0xa703,0x194));var _0x3a70=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa703[_0x298ed3];return _0x5aad28;};'use strict';var moment=require(_0x3a70('0x0'));var Sequelize=require('sequelize');module[_0x3a70('0x1')]={'uniqueid':{'type':Sequelize[_0x3a70('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3a70('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3a70('0x3')]},'exitAt':{'type':Sequelize[_0x3a70('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb6a9=['moment','sequelize','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6a9,0xc4));var _0x9b6a=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xb6a9[_0x29b609];return _0x54c952;};'use strict';var moment=require(_0x9b6a('0x0'));var Sequelize=require(_0x9b6a('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9b6a('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9b6a('0x3')]},'leaveAt':{'type':Sequelize[_0x9b6a('0x3')]},'acceptAt':{'type':Sequelize[_0x9b6a('0x3')]},'exitAt':{'type':Sequelize[_0x9b6a('0x3')]},'reason':{'type':Sequelize[_0x9b6a('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 446f3f4..680d5dd 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 _0x77e6=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','catch','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','end','stack','name','send','index','map','MailQueueReport'];(function(_0x36681d,_0x2e500c){var _0x15a342=function(_0x229248){while(--_0x229248){_0x36681d['push'](_0x36681d['shift']());}};_0x15a342(++_0x2e500c);}(_0x77e6,0x1a6));var _0x677e=function(_0xe9376a,_0x221172){_0xe9376a=_0xe9376a-0x0;var _0x21e589=_0x77e6[_0xe9376a];return _0x21e589;};'use strict';var emlformat=require(_0x677e('0x0'));var rimraf=require(_0x677e('0x1'));var zipdir=require(_0x677e('0x2'));var jsonpatch=require(_0x677e('0x3'));var rp=require(_0x677e('0x4'));var moment=require(_0x677e('0x5'));var BPromise=require(_0x677e('0x6'));var Mustache=require(_0x677e('0x7'));var util=require('util');var path=require(_0x677e('0x8'));var sox=require(_0x677e('0x9'));var csv=require('to-csv');var ejs=require(_0x677e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x677e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x677e('0xc'));var deskjs=require(_0x677e('0xd'));var toCsv=require(_0x677e('0xe'));var querystring=require(_0x677e('0xf'));var Papa=require('papaparse');var Redis=require(_0x677e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x677e('0x11'));var as=require(_0x677e('0x12'));var hardwareService=require(_0x677e('0x13'));var logger=require(_0x677e('0x14'))(_0x677e('0x15'));var utils=require(_0x677e('0x16'));var config=require(_0x677e('0x17'));var licenseUtil=require(_0x677e('0x18'));var db=require(_0x677e('0x19'))['db'];function respondWithStatusCode(_0x46a67e,_0x366490){_0x366490=_0x366490||0xcc;return function(_0x2a5f95){if(_0x2a5f95){return _0x46a67e[_0x677e('0x1a')](_0x366490);}return _0x46a67e[_0x677e('0x1b')](_0x366490)['end']();};}function respondWithResult(_0x512631,_0x5c7351){_0x5c7351=_0x5c7351||0xc8;return function(_0x213a50){if(_0x213a50){return _0x512631[_0x677e('0x1b')](_0x5c7351)[_0x677e('0x1c')](_0x213a50);}};}function respondWithFilteredResult(_0x36e976,_0x4daa04){return function(_0x42d0c3){if(_0x42d0c3){var _0x24c9eb=typeof _0x4daa04[_0x677e('0x1d')]===_0x677e('0x1e')&&typeof _0x4daa04[_0x677e('0x1f')]===_0x677e('0x1e');var _0xe4d960=_0x42d0c3['count'];var _0x1c5124=_0x24c9eb?0x0:_0x4daa04[_0x677e('0x1d')];var _0x385b06=_0x24c9eb?_0x42d0c3[_0x677e('0x20')]:_0x4daa04[_0x677e('0x1d')]+_0x4daa04[_0x677e('0x1f')];var _0x52f65d;if(_0x385b06>=_0xe4d960){_0x385b06=_0xe4d960;_0x52f65d=0xc8;}else{_0x52f65d=0xce;}_0x36e976[_0x677e('0x1b')](_0x52f65d);return _0x36e976['set'](_0x677e('0x21'),_0x1c5124+'-'+_0x385b06+'/'+_0xe4d960)[_0x677e('0x1c')](_0x42d0c3);}return null;};}function patchUpdates(_0x26e9c5){return function(_0x593aed){try{jsonpatch[_0x677e('0x22')](_0x593aed,_0x26e9c5,!![]);}catch(_0x1a6122){return BPromise[_0x677e('0x23')](_0x1a6122);}return _0x593aed[_0x677e('0x24')]();};}function saveUpdates(_0x295964,_0x8732e0){return function(_0x3a7895){if(_0x3a7895){return _0x3a7895['update'](_0x295964)['then'](function(_0x52d915){return _0x52d915;});}return null;};}function removeEntity(_0x357466,_0x154fce){return function(_0x31a1e4){if(_0x31a1e4){return _0x31a1e4[_0x677e('0x25')]()[_0x677e('0x26')](function(){_0x357466[_0x677e('0x1b')](0xcc)[_0x677e('0x27')]();});}};}function handleEntityNotFound(_0x42f2b8,_0x2c51d3){return function(_0x3f0646){if(!_0x3f0646){_0x42f2b8['sendStatus'](0x194);}return _0x3f0646;};}function handleError(_0x5f0ba2,_0x3d3370){_0x3d3370=_0x3d3370||0x1f4;return function(_0x184f68){logger['error'](_0x184f68[_0x677e('0x28')]);if(_0x184f68[_0x677e('0x29')]){delete _0x184f68[_0x677e('0x29')];}_0x5f0ba2[_0x677e('0x1b')](_0x3d3370)[_0x677e('0x2a')](_0x184f68);};}exports[_0x677e('0x2b')]=function(_0x56ad40,_0xcd4646){var _0x2a6033={},_0xeca8e2={},_0x1e2694={'count':0x0,'rows':[]};var _0x22e44c=_[_0x677e('0x2c')](db[_0x677e('0x2d')][_0x677e('0x2e')],function(_0x9d49b5){return{'name':_0x9d49b5['fieldName'],'type':_0x9d49b5[_0x677e('0x2f')][_0x677e('0x30')]};});_0xeca8e2[_0x677e('0x31')]=_[_0x677e('0x2c')](_0x22e44c,_0x677e('0x29'));_0xeca8e2[_0x677e('0x32')]=_[_0x677e('0x33')](_0x56ad40[_0x677e('0x32')]);_0xeca8e2[_0x677e('0x34')]=_[_0x677e('0x35')](_0xeca8e2['model'],_0xeca8e2[_0x677e('0x32')]);_0x2a6033[_0x677e('0x36')]=_[_0x677e('0x35')](_0xeca8e2[_0x677e('0x31')],qs[_0x677e('0x37')](_0x56ad40[_0x677e('0x32')]['fields']));_0x2a6033[_0x677e('0x36')]=_0x2a6033[_0x677e('0x36')][_0x677e('0x38')]?_0x2a6033['attributes']:_0xeca8e2[_0x677e('0x31')];if(!_0x56ad40[_0x677e('0x32')][_0x677e('0x39')](_0x677e('0x3a'))){_0x2a6033[_0x677e('0x1f')]=qs['limit'](_0x56ad40[_0x677e('0x32')][_0x677e('0x1f')]);_0x2a6033[_0x677e('0x1d')]=qs[_0x677e('0x1d')](_0x56ad40['query'][_0x677e('0x1d')]);}_0x2a6033[_0x677e('0x3b')]=qs[_0x677e('0x3c')](_0x56ad40['query']['sort']);_0x2a6033[_0x677e('0x3d')]=qs[_0x677e('0x34')](_['pick'](_0x56ad40[_0x677e('0x32')],_0xeca8e2[_0x677e('0x34')]),_0x22e44c);if(_0x56ad40['query']['filter']){_0x2a6033[_0x677e('0x3d')]=_[_0x677e('0x3e')](_0x2a6033['where'],{'$or':_['map'](_0x22e44c,function(_0x42ce2c){if(_0x42ce2c[_0x677e('0x2f')]!==_0x677e('0x3f')){var _0x5bb080={};_0x5bb080[_0x42ce2c[_0x677e('0x29')]]={'$like':'%'+_0x56ad40[_0x677e('0x32')][_0x677e('0x40')]+'%'};return _0x5bb080;}})});}_0x2a6033=_[_0x677e('0x3e')]({},_0x2a6033,_0x56ad40[_0x677e('0x41')]);var _0x4b34fa={'where':_0x2a6033['where']};return db[_0x677e('0x2d')][_0x677e('0x20')](_0x4b34fa)[_0x677e('0x26')](function(_0x1db5b4){_0x1e2694[_0x677e('0x20')]=_0x1db5b4;if(_0x56ad40[_0x677e('0x32')][_0x677e('0x42')]){_0x2a6033[_0x677e('0x43')]=[{'all':!![]}];}return db[_0x677e('0x2d')][_0x677e('0x44')](_0x2a6033);})['then'](function(_0x56eb30){_0x1e2694[_0x677e('0x45')]=_0x56eb30;return _0x1e2694;})[_0x677e('0x26')](respondWithFilteredResult(_0xcd4646,_0x2a6033))['catch'](handleError(_0xcd4646,null));};exports[_0x677e('0x46')]=function(_0x511125,_0x16362e){var _0x29b9c0={'raw':!![],'where':{'id':_0x511125[_0x677e('0x47')]['id']}},_0x283aaa={};_0x283aaa[_0x677e('0x31')]=_[_0x677e('0x33')](db['MailQueueReport'][_0x677e('0x2e')]);_0x283aaa[_0x677e('0x32')]=_[_0x677e('0x33')](_0x511125[_0x677e('0x32')]);_0x283aaa[_0x677e('0x34')]=_[_0x677e('0x35')](_0x283aaa['model'],_0x283aaa[_0x677e('0x32')]);_0x29b9c0['attributes']=_[_0x677e('0x35')](_0x283aaa[_0x677e('0x31')],qs[_0x677e('0x37')](_0x511125[_0x677e('0x32')][_0x677e('0x37')]));_0x29b9c0[_0x677e('0x36')]=_0x29b9c0[_0x677e('0x36')][_0x677e('0x38')]?_0x29b9c0[_0x677e('0x36')]:_0x283aaa[_0x677e('0x31')];if(_0x511125['query'][_0x677e('0x42')]){_0x29b9c0['include']=[{'all':!![]}];}_0x29b9c0=_['merge']({},_0x29b9c0,_0x511125[_0x677e('0x41')]);return db[_0x677e('0x2d')][_0x677e('0x48')](_0x29b9c0)[_0x677e('0x26')](handleEntityNotFound(_0x16362e,null))[_0x677e('0x26')](respondWithResult(_0x16362e,null))['catch'](handleError(_0x16362e,null));};exports[_0x677e('0x49')]=function(_0x136b77,_0x3cb653){return db[_0x677e('0x2d')][_0x677e('0x49')](_0x136b77['body'],{})[_0x677e('0x26')](respondWithResult(_0x3cb653,0xc9))[_0x677e('0x4a')](handleError(_0x3cb653,null));};exports[_0x677e('0x4b')]=function(_0x496627,_0x30ed5c){if(_0x496627['body']['id']){delete _0x496627[_0x677e('0x4c')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x496627[_0x677e('0x47')]['id']}})[_0x677e('0x26')](handleEntityNotFound(_0x30ed5c,null))[_0x677e('0x26')](saveUpdates(_0x496627[_0x677e('0x4c')],null))['then'](respondWithResult(_0x30ed5c,null))[_0x677e('0x4a')](handleError(_0x30ed5c,null));};exports[_0x677e('0x25')]=function(_0x51b2b8,_0x5e93e9){return db[_0x677e('0x2d')][_0x677e('0x48')]({'where':{'id':_0x51b2b8[_0x677e('0x47')]['id']}})[_0x677e('0x26')](handleEntityNotFound(_0x5e93e9,null))['then'](removeEntity(_0x5e93e9,null))[_0x677e('0x4a')](handleError(_0x5e93e9,null));};exports['describe']=function(_0x5404a1,_0x3bb4d8){return db['MailQueueReport'][_0x677e('0x4d')]()[_0x677e('0x26')](respondWithResult(_0x3bb4d8,null))[_0x677e('0x4a')](handleError(_0x3bb4d8,null));}; \ No newline at end of file +var _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','MailQueueReport','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x4641f7,_0x1a6fde){var _0x5a2996=function(_0x4f5080){while(--_0x4f5080){_0x4641f7['push'](_0x4641f7['shift']());}};_0x5a2996(++_0x1a6fde);}(_0xef0f,0x168));var _0xfef0=function(_0x561323,_0x3b1833){_0x561323=_0x561323-0x0;var _0x52f93b=_0xef0f[_0x561323];return _0x52f93b;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['MailQueueReport']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':!![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index a21a713..63ba8ef 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 _0xfdc8=['bluebird','request-promise','rimraf','exports','MailQueueReport','uniqueid','util','api','moment'];(function(_0x128f59,_0x2fa715){var _0x33615a=function(_0x2cef6a){while(--_0x2cef6a){_0x128f59['push'](_0x128f59['shift']());}};_0x33615a(++_0x2fa715);}(_0xfdc8,0xf0));var _0x8fdc=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0xfdc8[_0x1faaa1];return _0x994ec;};'use strict';var _=require('lodash');var util=require(_0x8fdc('0x0'));var logger=require('../../config/logger')(_0x8fdc('0x1'));var moment=require(_0x8fdc('0x2'));var BPromise=require(_0x8fdc('0x3'));var rp=require(_0x8fdc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8fdc('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x8fdc('0x6')]=function(_0x4cd22d,_0x1c595e){return _0x4cd22d['define'](_0x8fdc('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x8fdc('0x8'),'fields':[_0x8fdc('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa892=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0xa892,0x11e));var _0x2a89=function(_0x3b4ce3,_0x5d7ac7){_0x3b4ce3=_0x3b4ce3-0x0;var _0x420c68=_0xa892[_0x3b4ce3];return _0x420c68;};'use strict';var _=require(_0x2a89('0x0'));var util=require(_0x2a89('0x1'));var logger=require(_0x2a89('0x2'))('api');var moment=require(_0x2a89('0x3'));var BPromise=require(_0x2a89('0x4'));var rp=require(_0x2a89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a89('0x6'));var config=require(_0x2a89('0x7'));var attributes=require(_0x2a89('0x8'));module[_0x2a89('0x9')]=function(_0x28d8b5,_0x22974e){return _0x28d8b5[_0x2a89('0xa')](_0x2a89('0xb'),attributes,{'tableName':_0x2a89('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2a89('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 54ef2d7..a748f1a 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0xb85fd5,_0x3362ae){var _0x34228e=function(_0x1e62fa){while(--_0x1e62fa){_0xb85fd5['push'](_0xb85fd5['shift']());}};_0x34228e(++_0x3362ae);}(_0x2ef3,0xba));var _0x32ef=function(_0x4a1d82,_0x57c73f){_0x4a1d82=_0x4a1d82-0x0;var _0x93a74=_0x2ef3[_0x4a1d82];return _0x93a74;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +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(_0x52b408,_0x22fe7e){var _0x403deb=function(_0x13defa){while(--_0x13defa){_0x52b408['push'](_0x52b408['shift']());}};_0x403deb(++_0x22fe7e);}(_0xdb28,0x106));var _0x8db2=function(_0x2d3d17,_0x4bae0a){_0x2d3d17=_0x2d3d17-0x0;var _0x2f7bc1=_0xdb28[_0x2d3d17];return _0x2f7bc1;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 718f5aa..9a7351a 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3d94e6,_0x145c78){var _0xbe7523=function(_0x3b4157){while(--_0x3b4157){_0x3d94e6['push'](_0x3d94e6['shift']());}};_0xbe7523(++_0x145c78);}(_0x70e0,0x17b));var _0x070e=function(_0x177e90,_0x3e1213){_0x177e90=_0x177e90-0x0;var _0x487b15=_0x70e0[_0x177e90];return _0x487b15;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x215041,_0x26fc7a){var _0x33c6d6=function(_0x477dd8){while(--_0x477dd8){_0x215041['push'](_0x215041['shift']());}};_0x33c6d6(++_0x26fc7a);}(_0xe706,0xa3));var _0x6e70=function(_0x437ea9,_0x55c4cd){_0x437ea9=_0x437ea9-0x0;var _0x5c04b4=_0xe706[_0x437ea9];return _0x5c04b4;};'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 3ec4d37..e7c69e6 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 _0xb896=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x5cdae6,_0x50e1fc){var _0x18e71d=function(_0x31948e){while(--_0x31948e){_0x5cdae6['push'](_0x5cdae6['shift']());}};_0x18e71d(++_0x50e1fc);}(_0xb896,0x1a3));var _0x6b89=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xb896[_0x31b5a5];return _0x364cc9;};'use strict';var Sequelize=require(_0x6b89('0x0'));module[_0x6b89('0x1')]={'description':{'type':Sequelize[_0x6b89('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x6b89('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6b89('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6b89('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x6b89('0x2')],'defaultValue':_0x6b89('0x5')},'connTimeout':{'type':Sequelize[_0x6b89('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x6b89('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x6b89('0x2')]},'modernAuthentication':{'type':Sequelize[_0x6b89('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4c84=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x4c84,0x124));var _0x44c8=function(_0x573b93,_0x2c1bd5){_0x573b93=_0x573b93-0x0;var _0x4a9135=_0x4c84[_0x573b93];return _0x4a9135;};'use strict';var Sequelize=require('sequelize');module[_0x44c8('0x0')]={'description':{'type':Sequelize[_0x44c8('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x44c8('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x44c8('0x1')]},'password':{'type':Sequelize[_0x44c8('0x1')]},'port':{'type':Sequelize[_0x44c8('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x44c8('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x44c8('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index b065685..2fb997e 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 _0x70a9=['../../config/environment','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x269d01,_0x44a52d){var _0x23e31f=function(_0x5ef8ec){while(--_0x5ef8ec){_0x269d01['push'](_0x269d01['shift']());}};_0x23e31f(++_0x44a52d);}(_0x70a9,0x106));var _0x970a=function(_0xacb340,_0x28f075){_0xacb340=_0xacb340-0x0;var _0x596a5d=_0x70a9[_0xacb340];return _0x596a5d;};'use strict';var _=require('lodash');var util=require(_0x970a('0x0'));var logger=require(_0x970a('0x1'))(_0x970a('0x2'));var moment=require(_0x970a('0x3'));var BPromise=require(_0x970a('0x4'));var rp=require(_0x970a('0x5'));var fs=require('fs');var path=require(_0x970a('0x6'));var rimraf=require(_0x970a('0x7'));var config=require(_0x970a('0x8'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x2e67d5,_0x3f412d){return _0x2e67d5['define']('MailServerIn',attributes,{'tableName':_0x970a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb769=['../../config/environment','define','MailServerIn','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1602fd,_0x847115){var _0x1eaf42=function(_0x2e09f1){while(--_0x2e09f1){_0x1602fd['push'](_0x1602fd['shift']());}};_0x1eaf42(++_0x847115);}(_0xb769,0x160));var _0x9b76=function(_0x1318a4,_0x23f028){_0x1318a4=_0x1318a4-0x0;var _0x10c1b3=_0xb769[_0x1318a4];return _0x10c1b3;};'use strict';var _=require('lodash');var util=require(_0x9b76('0x0'));var logger=require(_0x9b76('0x1'))(_0x9b76('0x2'));var moment=require(_0x9b76('0x3'));var BPromise=require(_0x9b76('0x4'));var rp=require(_0x9b76('0x5'));var fs=require('fs');var path=require(_0x9b76('0x6'));var rimraf=require(_0x9b76('0x7'));var config=require(_0x9b76('0x8'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x98134a,_0x2d8727){return _0x98134a[_0x9b76('0x9')](_0x9b76('0xa'),attributes,{'tableName':_0x9b76('0xb'),'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 8f46176..9b843e6 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 _0x5dea=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment','bluebird'];(function(_0x2b5c54,_0xd1be91){var _0x443e70=function(_0xf8d3ef){while(--_0xf8d3ef){_0x2b5c54['push'](_0x2b5c54['shift']());}};_0x443e70(++_0xd1be91);}(_0x5dea,0x1bc));var _0xa5de=function(_0x1e175a,_0x5dc995){_0x1e175a=_0x1e175a-0x0;var _0x255f45=_0x5dea[_0x1e175a];return _0x255f45;};'use strict';var _=require(_0xa5de('0x0'));var util=require(_0xa5de('0x1'));var moment=require(_0xa5de('0x2'));var BPromise=require(_0xa5de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5de('0x5'))(_0xa5de('0x6'));var config=require(_0xa5de('0x7'));var jayson=require(_0xa5de('0x8'));var client=jayson['client'][_0xa5de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52ab35,_0x37f97d,_0x39579f){return new BPromise(function(_0x49eb0a,_0x44f1a8){return client[_0xa5de('0xa')](_0x52ab35,_0x39579f)[_0xa5de('0xb')](function(_0x119d05){logger[_0xa5de('0xc')]('MailServerIn,\x20%s,\x20%s',_0x37f97d,_0xa5de('0xd'));logger[_0xa5de('0xe')](_0xa5de('0xf'),_0x37f97d,_0xa5de('0xd'),JSON[_0xa5de('0x10')](_0x119d05));if(_0x119d05['error']){if(_0x119d05[_0xa5de('0x11')][_0xa5de('0x12')]===0x1f4){logger['error'](_0xa5de('0x13'),_0x37f97d,_0x119d05[_0xa5de('0x11')][_0xa5de('0x14')]);return _0x44f1a8(_0x119d05[_0xa5de('0x11')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x37f97d,_0x119d05['error'][_0xa5de('0x14')]);return _0x49eb0a(_0x119d05['error'][_0xa5de('0x14')]);}else{logger[_0xa5de('0xc')](_0xa5de('0x13'),_0x37f97d,_0xa5de('0xd'));_0x49eb0a(_0x119d05['result'][_0xa5de('0x14')]);}})[_0xa5de('0x15')](function(_0x1d4c54){logger[_0xa5de('0x11')]('MailServerIn,\x20%s,\x20%s',_0x37f97d,_0x1d4c54);_0x44f1a8(_0x1d4c54);});});}exports[_0xa5de('0x16')]=function(_0x4bf68a){var _0x4eccb9=this;return new Promise(function(_0x5302ca,_0x414d8c){return db[_0xa5de('0x17')][_0xa5de('0x18')]({'raw':_0x4bf68a['options']?_0x4bf68a[_0xa5de('0x19')][_0xa5de('0x1a')]===undefined?!![]:![]:!![],'where':_0x4bf68a[_0xa5de('0x19')]?_0x4bf68a[_0xa5de('0x19')]['where']||null:null,'attributes':_0x4bf68a[_0xa5de('0x19')]?_0x4bf68a['options'][_0xa5de('0x1b')]||null:null,'limit':_0x4bf68a['options']?_0x4bf68a[_0xa5de('0x19')][_0xa5de('0x1c')]||null:null,'include':_0x4bf68a[_0xa5de('0x19')]?_0x4bf68a[_0xa5de('0x19')][_0xa5de('0x1d')]?_[_0xa5de('0x1e')](_0x4bf68a[_0xa5de('0x19')][_0xa5de('0x1d')],function(_0x5587dc){return{'model':db[_0x5587dc['model']],'as':_0x5587dc['as'],'attributes':_0x5587dc[_0xa5de('0x1b')],'include':_0x5587dc['include']?_[_0xa5de('0x1e')](_0x5587dc[_0xa5de('0x1d')],function(_0x4bf21f){return{'model':db[_0x4bf21f['model']],'as':_0x4bf21f['as'],'attributes':_0x4bf21f[_0xa5de('0x1b')],'include':_0x4bf21f['include']?_[_0xa5de('0x1e')](_0x4bf21f['include'],function(_0x3754f0){return{'model':db[_0x3754f0[_0xa5de('0x1f')]],'as':_0x3754f0['as'],'attributes':_0x3754f0[_0xa5de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa5de('0xb')](function(_0xc13345){logger['info'](_0xa5de('0x16'),_0x4bf68a);logger[_0xa5de('0xe')](_0xa5de('0x16'),_0x4bf68a,JSON[_0xa5de('0x10')](_0xc13345));_0x5302ca(_0xc13345);})[_0xa5de('0x15')](function(_0x4611ae){logger[_0xa5de('0x11')](_0xa5de('0x16'),_0x4611ae[_0xa5de('0x14')],_0x4bf68a);_0x414d8c(_0x4eccb9[_0xa5de('0x11')](0x1f4,_0x4611ae['message']));});});}; \ No newline at end of file +var _0x81a5=['request','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetMailServerIn','findAll','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','client'];(function(_0x946c2e,_0x1561df){var _0xabe960=function(_0x1941aa){while(--_0x1941aa){_0x946c2e['push'](_0x946c2e['shift']());}};_0xabe960(++_0x1561df);}(_0x81a5,0x1c8));var _0x581a=function(_0x57ca7f,_0x2d666d){_0x57ca7f=_0x57ca7f-0x0;var _0x2e47ef=_0x81a5[_0x57ca7f];return _0x2e47ef;};'use strict';var _=require(_0x581a('0x0'));var util=require(_0x581a('0x1'));var moment=require(_0x581a('0x2'));var BPromise=require(_0x581a('0x3'));var rs=require(_0x581a('0x4'));var fs=require('fs');var Redis=require(_0x581a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x581a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x581a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdcb7c0,_0x3bcfe6,_0x148bc7){return new BPromise(function(_0x18dec1,_0x23ba13){return client[_0x581a('0x8')](_0xdcb7c0,_0x148bc7)[_0x581a('0x9')](function(_0x31b3ac){logger['info'](_0x581a('0xa'),_0x3bcfe6,'request\x20sent');logger[_0x581a('0xb')](_0x581a('0xc'),_0x3bcfe6,_0x581a('0xd'),JSON[_0x581a('0xe')](_0x31b3ac));if(_0x31b3ac['error']){if(_0x31b3ac[_0x581a('0xf')]['code']===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x3bcfe6,_0x31b3ac['error'][_0x581a('0x10')]);return _0x23ba13(_0x31b3ac[_0x581a('0xf')]['message']);}logger[_0x581a('0xf')](_0x581a('0xa'),_0x3bcfe6,_0x31b3ac[_0x581a('0xf')][_0x581a('0x10')]);return _0x18dec1(_0x31b3ac[_0x581a('0xf')][_0x581a('0x10')]);}else{logger[_0x581a('0x11')](_0x581a('0xa'),_0x3bcfe6,'request\x20sent');_0x18dec1(_0x31b3ac[_0x581a('0x12')][_0x581a('0x10')]);}})['catch'](function(_0x12cab1){logger[_0x581a('0xf')](_0x581a('0xa'),_0x3bcfe6,_0x12cab1);_0x23ba13(_0x12cab1);});});}exports[_0x581a('0x13')]=function(_0x5b0970){var _0x248ab7=this;return new Promise(function(_0x2fb5b7,_0x5350ef){return db['MailServerIn'][_0x581a('0x14')]({'raw':_0x5b0970[_0x581a('0x15')]?_0x5b0970[_0x581a('0x15')][_0x581a('0x16')]===undefined?!![]:![]:!![],'where':_0x5b0970[_0x581a('0x15')]?_0x5b0970[_0x581a('0x15')][_0x581a('0x17')]||null:null,'attributes':_0x5b0970[_0x581a('0x15')]?_0x5b0970['options'][_0x581a('0x18')]||null:null,'limit':_0x5b0970[_0x581a('0x15')]?_0x5b0970[_0x581a('0x15')]['limit']||null:null,'include':_0x5b0970['options']?_0x5b0970[_0x581a('0x15')][_0x581a('0x19')]?_[_0x581a('0x1a')](_0x5b0970[_0x581a('0x15')]['include'],function(_0x41a2c2){return{'model':db[_0x41a2c2[_0x581a('0x1b')]],'as':_0x41a2c2['as'],'attributes':_0x41a2c2['attributes'],'include':_0x41a2c2[_0x581a('0x19')]?_[_0x581a('0x1a')](_0x41a2c2[_0x581a('0x19')],function(_0x9f9947){return{'model':db[_0x9f9947[_0x581a('0x1b')]],'as':_0x9f9947['as'],'attributes':_0x9f9947['attributes'],'include':_0x9f9947['include']?_[_0x581a('0x1a')](_0x9f9947['include'],function(_0x49a681){return{'model':db[_0x49a681[_0x581a('0x1b')]],'as':_0x49a681['as'],'attributes':_0x49a681[_0x581a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x581a('0x9')](function(_0x4c9422){logger[_0x581a('0x11')](_0x581a('0x13'),_0x5b0970);logger[_0x581a('0xb')](_0x581a('0x13'),_0x5b0970,JSON['stringify'](_0x4c9422));_0x2fb5b7(_0x4c9422);})[_0x581a('0x1c')](function(_0x31b9c1){logger[_0x581a('0xf')](_0x581a('0x13'),_0x31b9c1[_0x581a('0x10')],_0x5b0970);_0x5350ef(_0x248ab7[_0x581a('0xf')](0x1f4,_0x31b9c1[_0x581a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 241fd69..8f5e7a8 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(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 _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(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 9e9c6ea..118034b 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 _0x0fd9=['BOOLEAN','exports','STRING'];(function(_0x657c56,_0x54ad28){var _0x513d30=function(_0x412fe6){while(--_0x412fe6){_0x657c56['push'](_0x657c56['shift']());}};_0x513d30(++_0x54ad28);}(_0x0fd9,0xa3));var _0x90fd=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x0fd9[_0x41c381];return _0x427981;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'description':{'type':Sequelize[_0x90fd('0x1')]},'host':{'type':Sequelize[_0x90fd('0x1')]},'user':{'type':Sequelize[_0x90fd('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x90fd('0x1')]},'authentication':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe820=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe820,0xd2));var _0x0e82=function(_0x11f963,_0x56d877){_0x11f963=_0x11f963-0x0;var _0x545e7f=_0xe820[_0x11f963];return _0x545e7f;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'description':{'type':Sequelize[_0x0e82('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x0e82('0x1')]},'port':{'type':Sequelize[_0x0e82('0x2')]},'secure':{'type':Sequelize[_0x0e82('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0e82('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index f64ced1..29dd267 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 _0x4656=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','merge','VIRTUAL','filter','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x425690,_0x23d922){var _0x42fc8c=function(_0x2c9bb0){while(--_0x2c9bb0){_0x425690['push'](_0x425690['shift']());}};_0x42fc8c(++_0x23d922);}(_0x4656,0x112));var _0x6465=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0x4656[_0x172948];return _0x4aeaa9;};'use strict';var emlformat=require(_0x6465('0x0'));var rimraf=require(_0x6465('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6465('0x2'));var rp=require(_0x6465('0x3'));var moment=require(_0x6465('0x4'));var BPromise=require(_0x6465('0x5'));var Mustache=require(_0x6465('0x6'));var util=require(_0x6465('0x7'));var path=require('path');var sox=require(_0x6465('0x8'));var csv=require('to-csv');var ejs=require(_0x6465('0x9'));var fs=require('fs');var fs_extra=require(_0x6465('0xa'));var _=require(_0x6465('0xb'));var squel=require(_0x6465('0xc'));var crypto=require(_0x6465('0xd'));var jsforce=require(_0x6465('0xe'));var deskjs=require(_0x6465('0xf'));var toCsv=require(_0x6465('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6465('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6465('0x12'));var hardwareService=require(_0x6465('0x13'));var logger=require(_0x6465('0x14'))(_0x6465('0x15'));var utils=require(_0x6465('0x16'));var config=require(_0x6465('0x17'));var licenseUtil=require(_0x6465('0x18'));var db=require(_0x6465('0x19'))['db'];function respondWithStatusCode(_0x2f81e0,_0x4a5c65){_0x4a5c65=_0x4a5c65||0xcc;return function(_0x224fb0){if(_0x224fb0){return _0x2f81e0[_0x6465('0x1a')](_0x4a5c65);}return _0x2f81e0[_0x6465('0x1b')](_0x4a5c65)[_0x6465('0x1c')]();};}function respondWithResult(_0x57b680,_0x236ead){_0x236ead=_0x236ead||0xc8;return function(_0x33d3c3){if(_0x33d3c3){return _0x57b680[_0x6465('0x1b')](_0x236ead)[_0x6465('0x1d')](_0x33d3c3);}};}function respondWithFilteredResult(_0x54aca6,_0x53c2d2){return function(_0x2217a7){if(_0x2217a7){var _0x4e2f23=typeof _0x53c2d2[_0x6465('0x1e')]===_0x6465('0x1f')&&typeof _0x53c2d2[_0x6465('0x20')]===_0x6465('0x1f');var _0x7cc584=_0x2217a7[_0x6465('0x21')];var _0x16633b=_0x4e2f23?0x0:_0x53c2d2['offset'];var _0x347043=_0x4e2f23?_0x2217a7[_0x6465('0x21')]:_0x53c2d2[_0x6465('0x1e')]+_0x53c2d2['limit'];var _0x417232;if(_0x347043>=_0x7cc584){_0x347043=_0x7cc584;_0x417232=0xc8;}else{_0x417232=0xce;}_0x54aca6['status'](_0x417232);return _0x54aca6[_0x6465('0x22')](_0x6465('0x23'),_0x16633b+'-'+_0x347043+'/'+_0x7cc584)['json'](_0x2217a7);}return null;};}function patchUpdates(_0x52952b){return function(_0x11d0a2){try{jsonpatch[_0x6465('0x24')](_0x11d0a2,_0x52952b,!![]);}catch(_0x49f5b3){return BPromise[_0x6465('0x25')](_0x49f5b3);}return _0x11d0a2[_0x6465('0x26')]();};}function saveUpdates(_0x567446,_0x30be8a){return function(_0x3d93e2){if(_0x3d93e2){return _0x3d93e2[_0x6465('0x27')](_0x567446)[_0x6465('0x28')](function(_0x5dfe66){return _0x5dfe66;});}return null;};}function removeEntity(_0x87bcfd,_0x460bb1){return function(_0xb6304e){if(_0xb6304e){return _0xb6304e['destroy']()[_0x6465('0x28')](function(){_0x87bcfd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb1fa,_0x2d40fa){return function(_0x205217){if(!_0x205217){_0x1eb1fa[_0x6465('0x1a')](0x194);}return _0x205217;};}function handleError(_0x581722,_0x3af899){_0x3af899=_0x3af899||0x1f4;return function(_0x1f8c9c){logger[_0x6465('0x29')](_0x1f8c9c[_0x6465('0x2a')]);if(_0x1f8c9c['name']){delete _0x1f8c9c[_0x6465('0x2b')];}_0x581722[_0x6465('0x1b')](_0x3af899)[_0x6465('0x2c')](_0x1f8c9c);};}exports[_0x6465('0x2d')]=function(_0x35d882,_0x432d4f){var _0xbba544={},_0x1abc09={},_0x125c65={'count':0x0,'rows':[]};var _0x15b3cb=_['map'](db['MailServerOut']['rawAttributes'],function(_0x5caac4){return{'name':_0x5caac4[_0x6465('0x2e')],'type':_0x5caac4['type'][_0x6465('0x2f')]};});_0x1abc09[_0x6465('0x30')]=_[_0x6465('0x31')](_0x15b3cb,_0x6465('0x2b'));_0x1abc09[_0x6465('0x32')]=_[_0x6465('0x33')](_0x35d882[_0x6465('0x32')]);_0x1abc09[_0x6465('0x34')]=_[_0x6465('0x35')](_0x1abc09[_0x6465('0x30')],_0x1abc09[_0x6465('0x32')]);_0xbba544[_0x6465('0x36')]=_[_0x6465('0x35')](_0x1abc09[_0x6465('0x30')],qs[_0x6465('0x37')](_0x35d882[_0x6465('0x32')][_0x6465('0x37')]));_0xbba544[_0x6465('0x36')]=_0xbba544[_0x6465('0x36')]['length']?_0xbba544['attributes']:_0x1abc09[_0x6465('0x30')];if(!_0x35d882[_0x6465('0x32')]['hasOwnProperty'](_0x6465('0x38'))){_0xbba544[_0x6465('0x20')]=qs['limit'](_0x35d882[_0x6465('0x32')][_0x6465('0x20')]);_0xbba544[_0x6465('0x1e')]=qs['offset'](_0x35d882[_0x6465('0x32')][_0x6465('0x1e')]);}_0xbba544['order']=qs[_0x6465('0x39')](_0x35d882[_0x6465('0x32')][_0x6465('0x39')]);_0xbba544[_0x6465('0x3a')]=qs[_0x6465('0x34')](_['pick'](_0x35d882[_0x6465('0x32')],_0x1abc09['filters']),_0x15b3cb);if(_0x35d882['query']['filter']){_0xbba544['where']=_[_0x6465('0x3b')](_0xbba544['where'],{'$or':_[_0x6465('0x31')](_0x15b3cb,function(_0x116163){if(_0x116163['type']!==_0x6465('0x3c')){var _0x42f9d1={};_0x42f9d1[_0x116163[_0x6465('0x2b')]]={'$like':'%'+_0x35d882[_0x6465('0x32')][_0x6465('0x3d')]+'%'};return _0x42f9d1;}})});}_0xbba544=_[_0x6465('0x3b')]({},_0xbba544,_0x35d882[_0x6465('0x3e')]);var _0x4cad76={'where':_0xbba544['where']};return db[_0x6465('0x3f')][_0x6465('0x21')](_0x4cad76)[_0x6465('0x28')](function(_0x5dc0c4){_0x125c65[_0x6465('0x21')]=_0x5dc0c4;if(_0x35d882[_0x6465('0x32')][_0x6465('0x40')]){_0xbba544[_0x6465('0x41')]=[{'all':!![]}];}return db[_0x6465('0x3f')][_0x6465('0x42')](_0xbba544);})[_0x6465('0x28')](function(_0x38de0d){_0x125c65[_0x6465('0x43')]=_0x38de0d;return _0x125c65;})[_0x6465('0x28')](respondWithFilteredResult(_0x432d4f,_0xbba544))[_0x6465('0x44')](handleError(_0x432d4f,null));};exports[_0x6465('0x45')]=function(_0x541a96,_0xbda8a3){var _0x44706f={'raw':!![],'where':{'id':_0x541a96[_0x6465('0x46')]['id']}},_0x50f22c={};_0x50f22c[_0x6465('0x30')]=_[_0x6465('0x33')](db[_0x6465('0x3f')][_0x6465('0x47')]);_0x50f22c[_0x6465('0x32')]=_[_0x6465('0x33')](_0x541a96[_0x6465('0x32')]);_0x50f22c[_0x6465('0x34')]=_['intersection'](_0x50f22c[_0x6465('0x30')],_0x50f22c[_0x6465('0x32')]);_0x44706f[_0x6465('0x36')]=_['intersection'](_0x50f22c[_0x6465('0x30')],qs[_0x6465('0x37')](_0x541a96[_0x6465('0x32')][_0x6465('0x37')]));_0x44706f[_0x6465('0x36')]=_0x44706f[_0x6465('0x36')]['length']?_0x44706f[_0x6465('0x36')]:_0x50f22c['model'];if(_0x541a96[_0x6465('0x32')][_0x6465('0x40')]){_0x44706f['include']=[{'all':!![]}];}_0x44706f=_[_0x6465('0x3b')]({},_0x44706f,_0x541a96[_0x6465('0x3e')]);return db[_0x6465('0x3f')]['find'](_0x44706f)['then'](handleEntityNotFound(_0xbda8a3,null))[_0x6465('0x28')](respondWithResult(_0xbda8a3,null))[_0x6465('0x44')](handleError(_0xbda8a3,null));};exports[_0x6465('0x48')]=function(_0x530666,_0x151aa7){return db['MailServerOut'][_0x6465('0x48')](_0x530666[_0x6465('0x49')],{})[_0x6465('0x28')](respondWithResult(_0x151aa7,0xc9))[_0x6465('0x44')](handleError(_0x151aa7,null));};exports['update']=function(_0x2e6c30,_0xd0bda){if(_0x2e6c30[_0x6465('0x49')]['id']){delete _0x2e6c30[_0x6465('0x49')]['id'];}return db[_0x6465('0x3f')][_0x6465('0x4a')]({'where':{'id':_0x2e6c30[_0x6465('0x46')]['id']}})[_0x6465('0x28')](handleEntityNotFound(_0xd0bda,null))[_0x6465('0x28')](saveUpdates(_0x2e6c30[_0x6465('0x49')],null))[_0x6465('0x28')](respondWithResult(_0xd0bda,null))[_0x6465('0x44')](handleError(_0xd0bda,null));};exports[_0x6465('0x4b')]=function(_0x3fac0f,_0x54a08e){return db['MailServerOut']['find']({'where':{'id':_0x3fac0f[_0x6465('0x46')]['id']}})[_0x6465('0x28')](handleEntityNotFound(_0x54a08e,null))[_0x6465('0x28')](removeEntity(_0x54a08e,null))[_0x6465('0x44')](handleError(_0x54a08e,null));}; \ No newline at end of file +var _0x5a48=['query','filters','intersection','attributes','fields','model','hasOwnProperty','order','sort','pick','merge','VIRTUAL','filter','options','where','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','name'];(function(_0x3beb56,_0x62b70b){var _0x52affb=function(_0x558b50){while(--_0x558b50){_0x3beb56['push'](_0x3beb56['shift']());}};_0x52affb(++_0x62b70b);}(_0x5a48,0x1d7));var _0x85a4=function(_0x2526e3,_0x5f22f8){_0x2526e3=_0x2526e3-0x0;var _0xcf6f48=_0x5a48[_0x2526e3];return _0xcf6f48;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85a4('0x0'));var jsonpatch=require(_0x85a4('0x1'));var rp=require(_0x85a4('0x2'));var moment=require(_0x85a4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x85a4('0x4'));var util=require(_0x85a4('0x5'));var path=require(_0x85a4('0x6'));var sox=require(_0x85a4('0x7'));var csv=require('to-csv');var ejs=require(_0x85a4('0x8'));var fs=require('fs');var fs_extra=require(_0x85a4('0x9'));var _=require(_0x85a4('0xa'));var squel=require(_0x85a4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x85a4('0xc'));var toCsv=require(_0x85a4('0xd'));var querystring=require(_0x85a4('0xe'));var Papa=require(_0x85a4('0xf'));var Redis=require(_0x85a4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x85a4('0x11'));var as=require(_0x85a4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85a4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x85a4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x85a4('0x15'))['db'];function respondWithStatusCode(_0x5c94d0,_0x2dbaac){_0x2dbaac=_0x2dbaac||0xcc;return function(_0x58ba11){if(_0x58ba11){return _0x5c94d0['sendStatus'](_0x2dbaac);}return _0x5c94d0[_0x85a4('0x16')](_0x2dbaac)[_0x85a4('0x17')]();};}function respondWithResult(_0xcd4cca,_0x15da29){_0x15da29=_0x15da29||0xc8;return function(_0x78585a){if(_0x78585a){return _0xcd4cca['status'](_0x15da29)[_0x85a4('0x18')](_0x78585a);}};}function respondWithFilteredResult(_0x30d96c,_0x56476c){return function(_0x53f1c7){if(_0x53f1c7){var _0x4522e5=typeof _0x56476c[_0x85a4('0x19')]===_0x85a4('0x1a')&&typeof _0x56476c[_0x85a4('0x1b')]===_0x85a4('0x1a');var _0x1b84ca=_0x53f1c7['count'];var _0x4dd63b=_0x4522e5?0x0:_0x56476c['offset'];var _0x5256a6=_0x4522e5?_0x53f1c7[_0x85a4('0x1c')]:_0x56476c['offset']+_0x56476c[_0x85a4('0x1b')];var _0x347e31;if(_0x5256a6>=_0x1b84ca){_0x5256a6=_0x1b84ca;_0x347e31=0xc8;}else{_0x347e31=0xce;}_0x30d96c['status'](_0x347e31);return _0x30d96c[_0x85a4('0x1d')](_0x85a4('0x1e'),_0x4dd63b+'-'+_0x5256a6+'/'+_0x1b84ca)['json'](_0x53f1c7);}return null;};}function patchUpdates(_0x55ba0d){return function(_0x3b53f4){try{jsonpatch['apply'](_0x3b53f4,_0x55ba0d,!![]);}catch(_0xf6acb1){return BPromise[_0x85a4('0x1f')](_0xf6acb1);}return _0x3b53f4[_0x85a4('0x20')]();};}function saveUpdates(_0x3796a0,_0x10e4db){return function(_0x4a20e7){if(_0x4a20e7){return _0x4a20e7[_0x85a4('0x21')](_0x3796a0)[_0x85a4('0x22')](function(_0x2d1037){return _0x2d1037;});}return null;};}function removeEntity(_0x6a50cd,_0x283460){return function(_0x42a784){if(_0x42a784){return _0x42a784[_0x85a4('0x23')]()['then'](function(){_0x6a50cd[_0x85a4('0x16')](0xcc)[_0x85a4('0x17')]();});}};}function handleEntityNotFound(_0x3e0319,_0x4e7dd2){return function(_0x537883){if(!_0x537883){_0x3e0319['sendStatus'](0x194);}return _0x537883;};}function handleError(_0x47629c,_0x567099){_0x567099=_0x567099||0x1f4;return function(_0x3d3fe7){logger[_0x85a4('0x24')](_0x3d3fe7[_0x85a4('0x25')]);if(_0x3d3fe7['name']){delete _0x3d3fe7['name'];}_0x47629c['status'](_0x567099)[_0x85a4('0x26')](_0x3d3fe7);};}exports[_0x85a4('0x27')]=function(_0x103b02,_0x151ab8){var _0x6d5060={},_0x511758={},_0x56df2e={'count':0x0,'rows':[]};var _0x53bf28=_[_0x85a4('0x28')](db[_0x85a4('0x29')][_0x85a4('0x2a')],function(_0x2f8a84){return{'name':_0x2f8a84[_0x85a4('0x2b')],'type':_0x2f8a84[_0x85a4('0x2c')][_0x85a4('0x2d')]};});_0x511758['model']=_['map'](_0x53bf28,_0x85a4('0x2e'));_0x511758['query']=_['keys'](_0x103b02[_0x85a4('0x2f')]);_0x511758[_0x85a4('0x30')]=_[_0x85a4('0x31')](_0x511758['model'],_0x511758[_0x85a4('0x2f')]);_0x6d5060[_0x85a4('0x32')]=_['intersection'](_0x511758['model'],qs[_0x85a4('0x33')](_0x103b02['query'][_0x85a4('0x33')]));_0x6d5060[_0x85a4('0x32')]=_0x6d5060[_0x85a4('0x32')]['length']?_0x6d5060[_0x85a4('0x32')]:_0x511758[_0x85a4('0x34')];if(!_0x103b02[_0x85a4('0x2f')][_0x85a4('0x35')]('nolimit')){_0x6d5060[_0x85a4('0x1b')]=qs[_0x85a4('0x1b')](_0x103b02[_0x85a4('0x2f')][_0x85a4('0x1b')]);_0x6d5060[_0x85a4('0x19')]=qs[_0x85a4('0x19')](_0x103b02[_0x85a4('0x2f')][_0x85a4('0x19')]);}_0x6d5060[_0x85a4('0x36')]=qs['sort'](_0x103b02[_0x85a4('0x2f')][_0x85a4('0x37')]);_0x6d5060['where']=qs[_0x85a4('0x30')](_[_0x85a4('0x38')](_0x103b02[_0x85a4('0x2f')],_0x511758[_0x85a4('0x30')]),_0x53bf28);if(_0x103b02[_0x85a4('0x2f')]['filter']){_0x6d5060['where']=_[_0x85a4('0x39')](_0x6d5060['where'],{'$or':_[_0x85a4('0x28')](_0x53bf28,function(_0x2d2445){if(_0x2d2445[_0x85a4('0x2c')]!==_0x85a4('0x3a')){var _0x1db191={};_0x1db191[_0x2d2445[_0x85a4('0x2e')]]={'$like':'%'+_0x103b02[_0x85a4('0x2f')][_0x85a4('0x3b')]+'%'};return _0x1db191;}})});}_0x6d5060=_[_0x85a4('0x39')]({},_0x6d5060,_0x103b02[_0x85a4('0x3c')]);var _0x1381ef={'where':_0x6d5060[_0x85a4('0x3d')]};return db['MailServerOut'][_0x85a4('0x1c')](_0x1381ef)[_0x85a4('0x22')](function(_0x5180d1){_0x56df2e['count']=_0x5180d1;if(_0x103b02[_0x85a4('0x2f')][_0x85a4('0x3e')]){_0x6d5060[_0x85a4('0x3f')]=[{'all':!![]}];}return db[_0x85a4('0x29')][_0x85a4('0x40')](_0x6d5060);})[_0x85a4('0x22')](function(_0xdcc29b){_0x56df2e[_0x85a4('0x41')]=_0xdcc29b;return _0x56df2e;})[_0x85a4('0x22')](respondWithFilteredResult(_0x151ab8,_0x6d5060))[_0x85a4('0x42')](handleError(_0x151ab8,null));};exports[_0x85a4('0x43')]=function(_0x4c879e,_0x36e00d){var _0x1f8af0={'raw':!![],'where':{'id':_0x4c879e[_0x85a4('0x44')]['id']}},_0x1d0e02={};_0x1d0e02[_0x85a4('0x34')]=_['keys'](db[_0x85a4('0x29')]['rawAttributes']);_0x1d0e02[_0x85a4('0x2f')]=_[_0x85a4('0x45')](_0x4c879e[_0x85a4('0x2f')]);_0x1d0e02['filters']=_[_0x85a4('0x31')](_0x1d0e02[_0x85a4('0x34')],_0x1d0e02['query']);_0x1f8af0[_0x85a4('0x32')]=_['intersection'](_0x1d0e02[_0x85a4('0x34')],qs[_0x85a4('0x33')](_0x4c879e[_0x85a4('0x2f')][_0x85a4('0x33')]));_0x1f8af0[_0x85a4('0x32')]=_0x1f8af0[_0x85a4('0x32')][_0x85a4('0x46')]?_0x1f8af0['attributes']:_0x1d0e02[_0x85a4('0x34')];if(_0x4c879e['query'][_0x85a4('0x3e')]){_0x1f8af0[_0x85a4('0x3f')]=[{'all':!![]}];}_0x1f8af0=_[_0x85a4('0x39')]({},_0x1f8af0,_0x4c879e[_0x85a4('0x3c')]);return db[_0x85a4('0x29')][_0x85a4('0x47')](_0x1f8af0)[_0x85a4('0x22')](handleEntityNotFound(_0x36e00d,null))[_0x85a4('0x22')](respondWithResult(_0x36e00d,null))[_0x85a4('0x42')](handleError(_0x36e00d,null));};exports[_0x85a4('0x48')]=function(_0x5a1c5a,_0x1f1aa8){return db[_0x85a4('0x29')][_0x85a4('0x48')](_0x5a1c5a[_0x85a4('0x49')],{})['then'](respondWithResult(_0x1f1aa8,0xc9))[_0x85a4('0x42')](handleError(_0x1f1aa8,null));};exports[_0x85a4('0x21')]=function(_0xff2b3,_0x472a20){if(_0xff2b3[_0x85a4('0x49')]['id']){delete _0xff2b3[_0x85a4('0x49')]['id'];}return db[_0x85a4('0x29')][_0x85a4('0x47')]({'where':{'id':_0xff2b3[_0x85a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x472a20,null))[_0x85a4('0x22')](saveUpdates(_0xff2b3['body'],null))[_0x85a4('0x22')](respondWithResult(_0x472a20,null))[_0x85a4('0x42')](handleError(_0x472a20,null));};exports[_0x85a4('0x23')]=function(_0x34336a,_0x53f2b){return db['MailServerOut']['find']({'where':{'id':_0x34336a[_0x85a4('0x44')]['id']}})[_0x85a4('0x22')](handleEntityNotFound(_0x53f2b,null))['then'](removeEntity(_0x53f2b,null))['catch'](handleError(_0x53f2b,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 079ae50..c0d5e44 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 _0xb2f3=['mail_servers_out','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x389b2c,_0x1ae10c){var _0x270ba3=function(_0x45e55d){while(--_0x45e55d){_0x389b2c['push'](_0x389b2c['shift']());}};_0x270ba3(++_0x1ae10c);}(_0xb2f3,0x1ae));var _0x3b2f=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xb2f3[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x3b2f('0x0'));var util=require('util');var logger=require(_0x3b2f('0x1'))('api');var moment=require(_0x3b2f('0x2'));var BPromise=require(_0x3b2f('0x3'));var rp=require(_0x3b2f('0x4'));var fs=require('fs');var path=require(_0x3b2f('0x5'));var rimraf=require(_0x3b2f('0x6'));var config=require(_0x3b2f('0x7'));var attributes=require(_0x3b2f('0x8'));module[_0x3b2f('0x9')]=function(_0x24ffbd,_0x57ef5c){return _0x24ffbd[_0x3b2f('0xa')](_0x3b2f('0xb'),attributes,{'tableName':_0x3b2f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3bb=['MailServerOut','mail_servers_out','lodash','util','bluebird','request-promise','rimraf','./mailServerOut.attributes','exports','define'];(function(_0x36992e,_0x40453f){var _0xec9216=function(_0x37f91b){while(--_0x37f91b){_0x36992e['push'](_0x36992e['shift']());}};_0xec9216(++_0x40453f);}(_0xd3bb,0x160));var _0xbd3b=function(_0x5aa49d,_0x2bfbcc){_0x5aa49d=_0x5aa49d-0x0;var _0x2cbf7f=_0xd3bb[_0x5aa49d];return _0x2cbf7f;};'use strict';var _=require(_0xbd3b('0x0'));var util=require(_0xbd3b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbd3b('0x2'));var rp=require(_0xbd3b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd3b('0x4'));var config=require('../../config/environment');var attributes=require(_0xbd3b('0x5'));module[_0xbd3b('0x6')]=function(_0x1396c1,_0xb3b71){return _0x1396c1[_0xbd3b('0x7')](_0xbd3b('0x8'),attributes,{'tableName':_0xbd3b('0x9'),'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 a7ac721..43a7095 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 _0x7a54=['info','MailServerOut,\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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x4d2e34,_0x50b987){_0x4d2e34=_0x4d2e34-0x0;var _0x449e40=_0x7a54[_0x4d2e34];return _0x449e40;};'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')]('MailServerOut,\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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x5456ce,_0x163292){var _0xf5bc1d=function(_0x3e03c3){while(--_0x3e03c3){_0x5456ce['push'](_0x5456ce['shift']());}};_0xf5bc1d(++_0x163292);}(_0xdb28,0x106));var _0x8db2=function(_0x20e9b5,_0x99c337){_0x20e9b5=_0x20e9b5-0x0;var _0x265531=_0xdb28[_0x20e9b5];return _0x265531;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 953ac0f..03dfc60 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 _0x63ac=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','delete','destroy','exports','multer','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x63ac,0x1d2));var _0xc63a=function(_0x31038b,_0x3ac1c9){_0x31038b=_0x31038b-0x0;var _0x1c9d3c=_0x63ac[_0x31038b];return _0x1c9d3c;};'use strict';var multer=require(_0xc63a('0x0'));var util=require(_0xc63a('0x1'));var path=require('path');var timeout=require(_0xc63a('0x2'));var express=require('express');var router=express[_0xc63a('0x3')]();var fs_extra=require(_0xc63a('0x4'));var auth=require(_0xc63a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc63a('0x6'));var controller=require('./mailSubstatus.controller');router[_0xc63a('0x7')]('/',auth[_0xc63a('0x8')](),controller[_0xc63a('0x9')]);router['get'](_0xc63a('0xa'),auth[_0xc63a('0x8')](),controller['describe']);router['get'](_0xc63a('0xb'),auth['isAuthenticated'](),controller[_0xc63a('0xc')]);router[_0xc63a('0xd')]('/',auth[_0xc63a('0x8')](),controller[_0xc63a('0xe')]);router['put'](_0xc63a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xc63a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc63a('0x10')]);module[_0xc63a('0x11')]=router; \ No newline at end of file +var _0x8a3c=['put','update','destroy','exports','path','express','Router','fs-extra','../../components/interaction/service','./mailSubstatus.controller','get','index','isAuthenticated','describe','/:id','post','create'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x8a3c,0xae));var _0xc8a3=function(_0x2fb3ef,_0x5a6000){_0x2fb3ef=_0x2fb3ef-0x0;var _0x46f9fc=_0x8a3c[_0x2fb3ef];return _0x46f9fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc8a3('0x0'));var timeout=require('connect-timeout');var express=require(_0xc8a3('0x1'));var router=express[_0xc8a3('0x2')]();var fs_extra=require(_0xc8a3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc8a3('0x4'));var config=require('../../config/environment');var controller=require(_0xc8a3('0x5'));router[_0xc8a3('0x6')]('/',auth['isAuthenticated'](),controller[_0xc8a3('0x7')]);router[_0xc8a3('0x6')]('/describe',auth[_0xc8a3('0x8')](),controller[_0xc8a3('0x9')]);router['get'](_0xc8a3('0xa'),auth[_0xc8a3('0x8')](),controller['show']);router[_0xc8a3('0xb')]('/',auth['isAuthenticated'](),controller[_0xc8a3('0xc')]);router[_0xc8a3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc8a3('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc8a3('0xf')]);module[_0xc8a3('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 2a743d7..15f9a85 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 _0x77a9=['sequelize','STRING'];(function(_0x5d431c,_0x340df3){var _0x5453b4=function(_0xbd077d){while(--_0xbd077d){_0x5d431c['push'](_0x5d431c['shift']());}};_0x5453b4(++_0x340df3);}(_0x77a9,0x19e));var _0x977a=function(_0x4b4ce3,_0x13d9ba){_0x4b4ce3=_0x4b4ce3-0x0;var _0x4044a3=_0x77a9[_0x4b4ce3];return _0x4044a3;};'use strict';var Sequelize=require(_0x977a('0x0'));module['exports']={'name':{'type':Sequelize[_0x977a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x977a('0x1')]}}; \ No newline at end of file +var _0xbff5=['sequelize','exports','STRING','name'];(function(_0x24d7c7,_0x21e5f4){var _0x2f34cf=function(_0x3718c3){while(--_0x3718c3){_0x24d7c7['push'](_0x24d7c7['shift']());}};_0x2f34cf(++_0x21e5f4);}(_0xbff5,0x1bc));var _0x5bff=function(_0x3a29f2,_0xc936ce){_0x3a29f2=_0x3a29f2-0x0;var _0x1ab071=_0xbff5[_0x3a29f2];return _0x1ab071;};'use strict';var Sequelize=require(_0x5bff('0x0'));module[_0x5bff('0x1')]={'name':{'type':Sequelize[_0x5bff('0x2')],'unique':_0x5bff('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5bff('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 72fa8cf..91bd3da 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 _0x9446=['filter','options','MailSubstatus','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','update','params','describe','eml-format','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL'];(function(_0xe96cf6,_0x666610){var _0x51da7f=function(_0x334a52){while(--_0x334a52){_0xe96cf6['push'](_0xe96cf6['shift']());}};_0x51da7f(++_0x666610);}(_0x9446,0x1b4));var _0x6944=function(_0x15c8a8,_0x28d0e6){_0x15c8a8=_0x15c8a8-0x0;var _0x4c4ef9=_0x9446[_0x15c8a8];return _0x4c4ef9;};'use strict';var emlformat=require(_0x6944('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6944('0x1'));var jsonpatch=require(_0x6944('0x2'));var rp=require(_0x6944('0x3'));var moment=require('moment');var BPromise=require(_0x6944('0x4'));var Mustache=require(_0x6944('0x5'));var util=require(_0x6944('0x6'));var path=require(_0x6944('0x7'));var sox=require(_0x6944('0x8'));var csv=require(_0x6944('0x9'));var ejs=require(_0x6944('0xa'));var fs=require('fs');var fs_extra=require(_0x6944('0xb'));var _=require(_0x6944('0xc'));var squel=require(_0x6944('0xd'));var crypto=require(_0x6944('0xe'));var jsforce=require(_0x6944('0xf'));var deskjs=require(_0x6944('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6944('0x11'));var Papa=require(_0x6944('0x12'));var Redis=require(_0x6944('0x13'));var authService=require(_0x6944('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x6944('0x15'));var hardwareService=require(_0x6944('0x16'));var logger=require(_0x6944('0x17'))(_0x6944('0x18'));var utils=require('../../config/utils');var config=require(_0x6944('0x19'));var licenseUtil=require(_0x6944('0x1a'));var db=require(_0x6944('0x1b'))['db'];function respondWithStatusCode(_0x53fbe5,_0x193f78){_0x193f78=_0x193f78||0xcc;return function(_0x509601){if(_0x509601){return _0x53fbe5[_0x6944('0x1c')](_0x193f78);}return _0x53fbe5[_0x6944('0x1d')](_0x193f78)[_0x6944('0x1e')]();};}function respondWithResult(_0x6d5cd8,_0x21a473){_0x21a473=_0x21a473||0xc8;return function(_0xd2bbff){if(_0xd2bbff){return _0x6d5cd8['status'](_0x21a473)[_0x6944('0x1f')](_0xd2bbff);}};}function respondWithFilteredResult(_0xf3a4fa,_0x29f915){return function(_0x5a7409){if(_0x5a7409){var _0x106026=typeof _0x29f915['offset']==='undefined'&&typeof _0x29f915[_0x6944('0x20')]===_0x6944('0x21');var _0x5686c2=_0x5a7409[_0x6944('0x22')];var _0x2770cb=_0x106026?0x0:_0x29f915[_0x6944('0x23')];var _0x1c5aa7=_0x106026?_0x5a7409[_0x6944('0x22')]:_0x29f915[_0x6944('0x23')]+_0x29f915[_0x6944('0x20')];var _0x3215c8;if(_0x1c5aa7>=_0x5686c2){_0x1c5aa7=_0x5686c2;_0x3215c8=0xc8;}else{_0x3215c8=0xce;}_0xf3a4fa[_0x6944('0x1d')](_0x3215c8);return _0xf3a4fa[_0x6944('0x24')](_0x6944('0x25'),_0x2770cb+'-'+_0x1c5aa7+'/'+_0x5686c2)[_0x6944('0x1f')](_0x5a7409);}return null;};}function patchUpdates(_0x2e5bae){return function(_0x4eccf0){try{jsonpatch[_0x6944('0x26')](_0x4eccf0,_0x2e5bae,!![]);}catch(_0x69caf5){return BPromise[_0x6944('0x27')](_0x69caf5);}return _0x4eccf0[_0x6944('0x28')]();};}function saveUpdates(_0x276d1c,_0x491555){return function(_0x1afe67){if(_0x1afe67){return _0x1afe67['update'](_0x276d1c)[_0x6944('0x29')](function(_0x85e437){return _0x85e437;});}return null;};}function removeEntity(_0x1fbe7b,_0x1ccafd){return function(_0x188100){if(_0x188100){return _0x188100[_0x6944('0x2a')]()[_0x6944('0x29')](function(){_0x1fbe7b['status'](0xcc)[_0x6944('0x1e')]();});}};}function handleEntityNotFound(_0x1f581b,_0x6038f8){return function(_0x6d51b0){if(!_0x6d51b0){_0x1f581b[_0x6944('0x1c')](0x194);}return _0x6d51b0;};}function handleError(_0x4a914b,_0x38a493){_0x38a493=_0x38a493||0x1f4;return function(_0x27d537){logger[_0x6944('0x2b')](_0x27d537[_0x6944('0x2c')]);if(_0x27d537['name']){delete _0x27d537[_0x6944('0x2d')];}_0x4a914b[_0x6944('0x1d')](_0x38a493)[_0x6944('0x2e')](_0x27d537);};}exports[_0x6944('0x2f')]=function(_0x51da74,_0x3f62eb){var _0x38a289={},_0x1b100f={},_0x1e87bc={'count':0x0,'rows':[]};var _0x17c72c=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x193d90){return{'name':_0x193d90[_0x6944('0x30')],'type':_0x193d90[_0x6944('0x31')][_0x6944('0x32')]};});_0x1b100f[_0x6944('0x33')]=_['map'](_0x17c72c,_0x6944('0x2d'));_0x1b100f[_0x6944('0x34')]=_[_0x6944('0x35')](_0x51da74[_0x6944('0x34')]);_0x1b100f[_0x6944('0x36')]=_[_0x6944('0x37')](_0x1b100f[_0x6944('0x33')],_0x1b100f[_0x6944('0x34')]);_0x38a289[_0x6944('0x38')]=_['intersection'](_0x1b100f[_0x6944('0x33')],qs[_0x6944('0x39')](_0x51da74[_0x6944('0x34')][_0x6944('0x39')]));_0x38a289['attributes']=_0x38a289[_0x6944('0x38')][_0x6944('0x3a')]?_0x38a289['attributes']:_0x1b100f[_0x6944('0x33')];if(!_0x51da74[_0x6944('0x34')][_0x6944('0x3b')](_0x6944('0x3c'))){_0x38a289['limit']=qs[_0x6944('0x20')](_0x51da74[_0x6944('0x34')][_0x6944('0x20')]);_0x38a289['offset']=qs['offset'](_0x51da74['query'][_0x6944('0x23')]);}_0x38a289[_0x6944('0x3d')]=qs[_0x6944('0x3e')](_0x51da74[_0x6944('0x34')][_0x6944('0x3e')]);_0x38a289['where']=qs[_0x6944('0x36')](_[_0x6944('0x3f')](_0x51da74['query'],_0x1b100f[_0x6944('0x36')]),_0x17c72c);if(_0x51da74['query']['filter']){_0x38a289[_0x6944('0x40')]=_[_0x6944('0x41')](_0x38a289[_0x6944('0x40')],{'$or':_[_0x6944('0x42')](_0x17c72c,function(_0x44df0b){if(_0x44df0b[_0x6944('0x31')]!==_0x6944('0x43')){var _0xc47de={};_0xc47de[_0x44df0b['name']]={'$like':'%'+_0x51da74[_0x6944('0x34')][_0x6944('0x44')]+'%'};return _0xc47de;}})});}_0x38a289=_[_0x6944('0x41')]({},_0x38a289,_0x51da74[_0x6944('0x45')]);var _0x2f1a6a={'where':_0x38a289[_0x6944('0x40')]};return db[_0x6944('0x46')]['count'](_0x2f1a6a)['then'](function(_0x150278){_0x1e87bc[_0x6944('0x22')]=_0x150278;if(_0x51da74['query'][_0x6944('0x47')]){_0x38a289['include']=[{'all':!![]}];}return db[_0x6944('0x46')][_0x6944('0x48')](_0x38a289);})[_0x6944('0x29')](function(_0x3bd502){_0x1e87bc[_0x6944('0x49')]=_0x3bd502;return _0x1e87bc;})[_0x6944('0x29')](respondWithFilteredResult(_0x3f62eb,_0x38a289))[_0x6944('0x4a')](handleError(_0x3f62eb,null));};exports[_0x6944('0x4b')]=function(_0x20fb67,_0x1f988f){var _0x2fc82c={'raw':!![],'where':{'id':_0x20fb67['params']['id']}},_0x7ac58b={};_0x7ac58b[_0x6944('0x33')]=_['keys'](db[_0x6944('0x46')][_0x6944('0x4c')]);_0x7ac58b[_0x6944('0x34')]=_[_0x6944('0x35')](_0x20fb67[_0x6944('0x34')]);_0x7ac58b[_0x6944('0x36')]=_[_0x6944('0x37')](_0x7ac58b[_0x6944('0x33')],_0x7ac58b[_0x6944('0x34')]);_0x2fc82c[_0x6944('0x38')]=_[_0x6944('0x37')](_0x7ac58b[_0x6944('0x33')],qs[_0x6944('0x39')](_0x20fb67[_0x6944('0x34')][_0x6944('0x39')]));_0x2fc82c[_0x6944('0x38')]=_0x2fc82c['attributes'][_0x6944('0x3a')]?_0x2fc82c[_0x6944('0x38')]:_0x7ac58b[_0x6944('0x33')];if(_0x20fb67[_0x6944('0x34')][_0x6944('0x47')]){_0x2fc82c[_0x6944('0x4d')]=[{'all':!![]}];}_0x2fc82c=_[_0x6944('0x41')]({},_0x2fc82c,_0x20fb67[_0x6944('0x45')]);return db['MailSubstatus'][_0x6944('0x4e')](_0x2fc82c)[_0x6944('0x29')](handleEntityNotFound(_0x1f988f,null))[_0x6944('0x29')](respondWithResult(_0x1f988f,null))[_0x6944('0x4a')](handleError(_0x1f988f,null));};exports['create']=function(_0x53d10e,_0x4b5bf6){return db[_0x6944('0x46')][_0x6944('0x4f')](_0x53d10e[_0x6944('0x50')],{})[_0x6944('0x29')](respondWithResult(_0x4b5bf6,0xc9))[_0x6944('0x4a')](handleError(_0x4b5bf6,null));};exports[_0x6944('0x51')]=function(_0x972149,_0x2b0ccd){if(_0x972149[_0x6944('0x50')]['id']){delete _0x972149[_0x6944('0x50')]['id'];}return db[_0x6944('0x46')]['find']({'where':{'id':_0x972149['params']['id']}})[_0x6944('0x29')](handleEntityNotFound(_0x2b0ccd,null))[_0x6944('0x29')](saveUpdates(_0x972149['body'],null))[_0x6944('0x29')](respondWithResult(_0x2b0ccd,null))[_0x6944('0x4a')](handleError(_0x2b0ccd,null));};exports[_0x6944('0x2a')]=function(_0x2e0863,_0x2e16a3){return db[_0x6944('0x46')][_0x6944('0x4e')]({'where':{'id':_0x2e0863[_0x6944('0x52')]['id']}})[_0x6944('0x29')](handleEntityNotFound(_0x2e16a3,null))[_0x6944('0x29')](removeEntity(_0x2e16a3,null))[_0x6944('0x4a')](handleError(_0x2e16a3,null));};exports[_0x6944('0x53')]=function(_0x2e2c04,_0x15f156){return db['MailSubstatus'][_0x6944('0x53')]()[_0x6944('0x29')](respondWithResult(_0x15f156,null))['catch'](handleError(_0x15f156,null));}; \ No newline at end of file +var _0x84d1=['end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','MailSubstatus','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x268bf5,_0x24b5c3){var _0x43ae40=function(_0x5deae7){while(--_0x5deae7){_0x268bf5['push'](_0x268bf5['shift']());}};_0x43ae40(++_0x24b5c3);}(_0x84d1,0x7b));var _0x184d=function(_0x1a9bdf,_0x43130a){_0x1a9bdf=_0x1a9bdf-0x0;var _0x61a042=_0x84d1[_0x1a9bdf];return _0x61a042;};'use strict';var emlformat=require(_0x184d('0x0'));var rimraf=require(_0x184d('0x1'));var zipdir=require(_0x184d('0x2'));var jsonpatch=require(_0x184d('0x3'));var rp=require(_0x184d('0x4'));var moment=require(_0x184d('0x5'));var BPromise=require(_0x184d('0x6'));var Mustache=require(_0x184d('0x7'));var util=require(_0x184d('0x8'));var path=require(_0x184d('0x9'));var sox=require(_0x184d('0xa'));var csv=require(_0x184d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x184d('0xc'));var _=require(_0x184d('0xd'));var squel=require(_0x184d('0xe'));var crypto=require(_0x184d('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x184d('0xb'));var querystring=require(_0x184d('0x10'));var Papa=require(_0x184d('0x11'));var Redis=require(_0x184d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x184d('0x13'));var as=require(_0x184d('0x14'));var hardwareService=require(_0x184d('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x184d('0x16'));var licenseUtil=require(_0x184d('0x17'));var db=require(_0x184d('0x18'))['db'];function respondWithStatusCode(_0x165cca,_0x4cd284){_0x4cd284=_0x4cd284||0xcc;return function(_0x3ac090){if(_0x3ac090){return _0x165cca[_0x184d('0x19')](_0x4cd284);}return _0x165cca[_0x184d('0x1a')](_0x4cd284)[_0x184d('0x1b')]();};}function respondWithResult(_0x3a1b16,_0xc4536c){_0xc4536c=_0xc4536c||0xc8;return function(_0x85027e){if(_0x85027e){return _0x3a1b16[_0x184d('0x1a')](_0xc4536c)[_0x184d('0x1c')](_0x85027e);}};}function respondWithFilteredResult(_0x18e4df,_0x5ac89f){return function(_0x400a57){if(_0x400a57){var _0x47b660=typeof _0x5ac89f[_0x184d('0x1d')]==='undefined'&&typeof _0x5ac89f[_0x184d('0x1e')]===_0x184d('0x1f');var _0x4cdf00=_0x400a57[_0x184d('0x20')];var _0x234e40=_0x47b660?0x0:_0x5ac89f[_0x184d('0x1d')];var _0x145889=_0x47b660?_0x400a57[_0x184d('0x20')]:_0x5ac89f[_0x184d('0x1d')]+_0x5ac89f['limit'];var _0x20a83d;if(_0x145889>=_0x4cdf00){_0x145889=_0x4cdf00;_0x20a83d=0xc8;}else{_0x20a83d=0xce;}_0x18e4df['status'](_0x20a83d);return _0x18e4df[_0x184d('0x21')](_0x184d('0x22'),_0x234e40+'-'+_0x145889+'/'+_0x4cdf00)['json'](_0x400a57);}return null;};}function patchUpdates(_0x2907e5){return function(_0x5f51f6){try{jsonpatch['apply'](_0x5f51f6,_0x2907e5,!![]);}catch(_0x2c8e30){return BPromise[_0x184d('0x23')](_0x2c8e30);}return _0x5f51f6[_0x184d('0x24')]();};}function saveUpdates(_0xce7e2f,_0x2fc358){return function(_0x49ee82){if(_0x49ee82){return _0x49ee82[_0x184d('0x25')](_0xce7e2f)[_0x184d('0x26')](function(_0x23ccf2){return _0x23ccf2;});}return null;};}function removeEntity(_0x182a1d,_0x5125e7){return function(_0x84fb6e){if(_0x84fb6e){return _0x84fb6e['destroy']()[_0x184d('0x26')](function(){_0x182a1d[_0x184d('0x1a')](0xcc)[_0x184d('0x1b')]();});}};}function handleEntityNotFound(_0x1b6cc4,_0x42cec7){return function(_0x47fa0f){if(!_0x47fa0f){_0x1b6cc4['sendStatus'](0x194);}return _0x47fa0f;};}function handleError(_0x775168,_0x4a4dfb){_0x4a4dfb=_0x4a4dfb||0x1f4;return function(_0x4e47cd){logger[_0x184d('0x27')](_0x4e47cd['stack']);if(_0x4e47cd[_0x184d('0x28')]){delete _0x4e47cd['name'];}_0x775168[_0x184d('0x1a')](_0x4a4dfb)[_0x184d('0x29')](_0x4e47cd);};}exports[_0x184d('0x2a')]=function(_0x35b150,_0x495050){var _0x19e9d2={},_0x4c9b87={},_0x49b517={'count':0x0,'rows':[]};var _0x4c5f53=_[_0x184d('0x2b')](db[_0x184d('0x2c')][_0x184d('0x2d')],function(_0x3cc214){return{'name':_0x3cc214['fieldName'],'type':_0x3cc214[_0x184d('0x2e')][_0x184d('0x2f')]};});_0x4c9b87[_0x184d('0x30')]=_[_0x184d('0x2b')](_0x4c5f53,'name');_0x4c9b87[_0x184d('0x31')]=_[_0x184d('0x32')](_0x35b150[_0x184d('0x31')]);_0x4c9b87['filters']=_[_0x184d('0x33')](_0x4c9b87[_0x184d('0x30')],_0x4c9b87[_0x184d('0x31')]);_0x19e9d2[_0x184d('0x34')]=_['intersection'](_0x4c9b87['model'],qs[_0x184d('0x35')](_0x35b150[_0x184d('0x31')][_0x184d('0x35')]));_0x19e9d2[_0x184d('0x34')]=_0x19e9d2[_0x184d('0x34')][_0x184d('0x36')]?_0x19e9d2[_0x184d('0x34')]:_0x4c9b87[_0x184d('0x30')];if(!_0x35b150[_0x184d('0x31')]['hasOwnProperty']('nolimit')){_0x19e9d2[_0x184d('0x1e')]=qs[_0x184d('0x1e')](_0x35b150[_0x184d('0x31')][_0x184d('0x1e')]);_0x19e9d2[_0x184d('0x1d')]=qs[_0x184d('0x1d')](_0x35b150[_0x184d('0x31')][_0x184d('0x1d')]);}_0x19e9d2[_0x184d('0x37')]=qs[_0x184d('0x38')](_0x35b150[_0x184d('0x31')][_0x184d('0x38')]);_0x19e9d2['where']=qs[_0x184d('0x39')](_[_0x184d('0x3a')](_0x35b150['query'],_0x4c9b87[_0x184d('0x39')]),_0x4c5f53);if(_0x35b150[_0x184d('0x31')][_0x184d('0x3b')]){_0x19e9d2[_0x184d('0x3c')]=_[_0x184d('0x3d')](_0x19e9d2[_0x184d('0x3c')],{'$or':_[_0x184d('0x2b')](_0x4c5f53,function(_0x355c77){if(_0x355c77[_0x184d('0x2e')]!==_0x184d('0x3e')){var _0x353077={};_0x353077[_0x355c77['name']]={'$like':'%'+_0x35b150[_0x184d('0x31')][_0x184d('0x3b')]+'%'};return _0x353077;}})});}_0x19e9d2=_[_0x184d('0x3d')]({},_0x19e9d2,_0x35b150['options']);var _0xaef392={'where':_0x19e9d2['where']};return db[_0x184d('0x2c')][_0x184d('0x20')](_0xaef392)[_0x184d('0x26')](function(_0x3b8467){_0x49b517['count']=_0x3b8467;if(_0x35b150[_0x184d('0x31')][_0x184d('0x3f')]){_0x19e9d2[_0x184d('0x40')]=[{'all':!![]}];}return db[_0x184d('0x2c')][_0x184d('0x41')](_0x19e9d2);})[_0x184d('0x26')](function(_0x4eaeb4){_0x49b517['rows']=_0x4eaeb4;return _0x49b517;})[_0x184d('0x26')](respondWithFilteredResult(_0x495050,_0x19e9d2))[_0x184d('0x42')](handleError(_0x495050,null));};exports[_0x184d('0x43')]=function(_0x405ef4,_0x2e2caa){var _0x330f66={'raw':!![],'where':{'id':_0x405ef4[_0x184d('0x44')]['id']}},_0x56143b={};_0x56143b[_0x184d('0x30')]=_[_0x184d('0x32')](db['MailSubstatus'][_0x184d('0x2d')]);_0x56143b['query']=_[_0x184d('0x32')](_0x405ef4['query']);_0x56143b[_0x184d('0x39')]=_[_0x184d('0x33')](_0x56143b['model'],_0x56143b[_0x184d('0x31')]);_0x330f66[_0x184d('0x34')]=_[_0x184d('0x33')](_0x56143b[_0x184d('0x30')],qs['fields'](_0x405ef4['query'][_0x184d('0x35')]));_0x330f66[_0x184d('0x34')]=_0x330f66['attributes'][_0x184d('0x36')]?_0x330f66['attributes']:_0x56143b[_0x184d('0x30')];if(_0x405ef4[_0x184d('0x31')]['includeAll']){_0x330f66[_0x184d('0x40')]=[{'all':!![]}];}_0x330f66=_[_0x184d('0x3d')]({},_0x330f66,_0x405ef4[_0x184d('0x45')]);return db[_0x184d('0x2c')][_0x184d('0x46')](_0x330f66)['then'](handleEntityNotFound(_0x2e2caa,null))[_0x184d('0x26')](respondWithResult(_0x2e2caa,null))[_0x184d('0x42')](handleError(_0x2e2caa,null));};exports[_0x184d('0x47')]=function(_0x29ed6c,_0x1f8f8a){return db[_0x184d('0x2c')]['create'](_0x29ed6c[_0x184d('0x48')],{})[_0x184d('0x26')](respondWithResult(_0x1f8f8a,0xc9))[_0x184d('0x42')](handleError(_0x1f8f8a,null));};exports[_0x184d('0x25')]=function(_0x577420,_0x16ca42){if(_0x577420['body']['id']){delete _0x577420['body']['id'];}return db[_0x184d('0x2c')][_0x184d('0x46')]({'where':{'id':_0x577420[_0x184d('0x44')]['id']}})[_0x184d('0x26')](handleEntityNotFound(_0x16ca42,null))[_0x184d('0x26')](saveUpdates(_0x577420['body'],null))[_0x184d('0x26')](respondWithResult(_0x16ca42,null))['catch'](handleError(_0x16ca42,null));};exports[_0x184d('0x49')]=function(_0x21d109,_0x3bd71d){return db[_0x184d('0x2c')][_0x184d('0x46')]({'where':{'id':_0x21d109['params']['id']}})[_0x184d('0x26')](handleEntityNotFound(_0x3bd71d,null))[_0x184d('0x26')](removeEntity(_0x3bd71d,null))[_0x184d('0x42')](handleError(_0x3bd71d,null));};exports['describe']=function(_0x4dcda0,_0x5192dc){return db['MailSubstatus'][_0x184d('0x4a')]()[_0x184d('0x26')](respondWithResult(_0x5192dc,null))[_0x184d('0x42')](handleError(_0x5192dc,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index d1db96a..f0636c8 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb1b=['exports','events','../../mysqldb','emit','hook'];(function(_0x590b71,_0xf2162b){var _0x4bbc59=function(_0x34fe71){while(--_0x34fe71){_0x590b71['push'](_0x590b71['shift']());}};_0x4bbc59(++_0xf2162b);}(_0xfb1b,0x9c));var _0xbfb1=function(_0x53079c,_0x35b753){_0x53079c=_0x53079c-0x0;var _0xbdab9d=_0xfb1b[_0x53079c];return _0xbdab9d;};'use strict';var EventEmitter=require(_0xbfb1('0x0'));var MailSubstatus=require(_0xbfb1('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x1d328f){return function(_0x5e3665,_0x413a63,_0x30bbfe){MailSubstatusEvents[_0xbfb1('0x2')](_0x1d328f+':'+_0x5e3665['id'],_0x5e3665);MailSubstatusEvents[_0xbfb1('0x2')](_0x1d328f,_0x5e3665);_0x30bbfe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xbfb1('0x3')](e,emitEvent(event));}}module[_0xbfb1('0x4')]=MailSubstatusEvents; \ No newline at end of file +var _0x0fd6=['MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x12f527,_0x34445e){var _0x238c44=function(_0x35989c){while(--_0x35989c){_0x12f527['push'](_0x12f527['shift']());}};_0x238c44(++_0x34445e);}(_0x0fd6,0x6f));var _0x60fd=function(_0x3d754d,_0x71aad){_0x3d754d=_0x3d754d-0x0;var _0x59f912=_0x0fd6[_0x3d754d];return _0x59f912;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x60fd('0x0'))['db'][_0x60fd('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x60fd('0x2')](0x0);var events={'afterUpdate':_0x60fd('0x3')};function emitEvent(_0x4832e8){return function(_0x589875,_0x343edb,_0x2f590b){MailSubstatusEvents[_0x60fd('0x4')](_0x4832e8+':'+_0x589875['id'],_0x589875);MailSubstatusEvents[_0x60fd('0x4')](_0x4832e8,_0x589875);_0x2f590b(null);};}for(var e in events){if(events[_0x60fd('0x5')](e)){var event=events[e];MailSubstatus[_0x60fd('0x6')](e,emitEvent(event));}}module[_0x60fd('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4a0485d..be5f29e 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 _0x6e32=['mail_substatuses','Condition','update','name','then','catch','./mailSubstatus.attributes','define','MailSubstatus'];(function(_0x52e3bd,_0x3d6880){var _0x470ded=function(_0x49bded){while(--_0x49bded){_0x52e3bd['push'](_0x52e3bd['shift']());}};_0x470ded(++_0x3d6880);}(_0x6e32,0x1e3));var _0x26e3=function(_0x4629ef,_0x4d644e){_0x4629ef=_0x4629ef-0x0;var _0x287a78=_0x6e32[_0x4629ef];return _0x287a78;};'use strict';var attributes=require(_0x26e3('0x0'));module['exports']=function(_0x2803dd){var _0x24e479=_0x2803dd['models'];return _0x2803dd[_0x26e3('0x1')](_0x26e3('0x2'),attributes,{'tableName':_0x26e3('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2b3012,_0x4c98e7,_0x124188){return _0x24e479[_0x26e3('0x4')][_0x26e3('0x5')]({'value':_0x2b3012['name']},{'where':{'field':'mailSubstatus','value':_0x2b3012['_previousDataValues'][_0x26e3('0x6')]}})[_0x26e3('0x7')](function(){_0x124188();})[_0x26e3('0x8')](function(_0x278441){_0x124188(_0x278441);});}}});}; \ No newline at end of file +var _0x0437=['MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','catch','./mailSubstatus.attributes','exports','define'];(function(_0xccf1a9,_0x310353){var _0x347968=function(_0x47b55a){while(--_0x47b55a){_0xccf1a9['push'](_0xccf1a9['shift']());}};_0x347968(++_0x310353);}(_0x0437,0xb1));var _0x7043=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x0437[_0x5d6456];return _0x4d66c1;};'use strict';var attributes=require(_0x7043('0x0'));module[_0x7043('0x1')]=function(_0x398f2f){var _0x22e652=_0x398f2f['models'];return _0x398f2f[_0x7043('0x2')](_0x7043('0x3'),attributes,{'tableName':_0x7043('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x27ad44,_0x354fd2,_0x36ccb0){return _0x22e652[_0x7043('0x5')][_0x7043('0x6')]({'value':_0x27ad44[_0x7043('0x7')]},{'where':{'field':_0x7043('0x8'),'value':_0x27ad44['_previousDataValues'][_0x7043('0x7')]}})['then'](function(){_0x36ccb0();})[_0x7043('0x9')](function(_0x213b5f){_0x36ccb0(_0x213b5f);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index f5b6968..9f7f094 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 _0x5e38=['../../config/environment','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x5e38,0x1b0));var _0x85e3=function(_0x39434e,_0xfba413){_0x39434e=_0x39434e-0x0;var _0x3c74e1=_0x5e38[_0x39434e];return _0x3c74e1;};'use strict';var _=require(_0x85e3('0x0'));var util=require(_0x85e3('0x1'));var moment=require(_0x85e3('0x2'));var BPromise=require('bluebird');var rs=require(_0x85e3('0x3'));var fs=require('fs');var Redis=require(_0x85e3('0x4'));var db=require(_0x85e3('0x5'))['db'];var utils=require(_0x85e3('0x6'));var logger=require(_0x85e3('0x7'))(_0x85e3('0x8'));var config=require(_0x85e3('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19f8fa,_0x3477f6,_0x5af176){return new BPromise(function(_0x4fda90,_0x2c40dd){return client[_0x85e3('0xa')](_0x19f8fa,_0x5af176)[_0x85e3('0xb')](function(_0x4aa760){logger[_0x85e3('0xc')](_0x85e3('0xd'),_0x3477f6,_0x85e3('0xe'));logger[_0x85e3('0xf')](_0x85e3('0x10'),_0x3477f6,_0x85e3('0xe'),JSON[_0x85e3('0x11')](_0x4aa760));if(_0x4aa760[_0x85e3('0x12')]){if(_0x4aa760['error'][_0x85e3('0x13')]===0x1f4){logger[_0x85e3('0x12')](_0x85e3('0xd'),_0x3477f6,_0x4aa760[_0x85e3('0x12')][_0x85e3('0x14')]);return _0x2c40dd(_0x4aa760[_0x85e3('0x12')][_0x85e3('0x14')]);}logger[_0x85e3('0x12')](_0x85e3('0xd'),_0x3477f6,_0x4aa760['error'][_0x85e3('0x14')]);return _0x4fda90(_0x4aa760['error'][_0x85e3('0x14')]);}else{logger[_0x85e3('0xc')](_0x85e3('0xd'),_0x3477f6,_0x85e3('0xe'));_0x4fda90(_0x4aa760['result'][_0x85e3('0x14')]);}})['catch'](function(_0x53860f){logger[_0x85e3('0x12')](_0x85e3('0xd'),_0x3477f6,_0x53860f);_0x2c40dd(_0x53860f);});});} \ No newline at end of file +var _0xadfd=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xadfd,0xf0));var _0xdadf=function(_0x544649,_0x2bcf90){_0x544649=_0x544649-0x0;var _0x10377c=_0xadfd[_0x544649];return _0x10377c;};'use strict';var _=require(_0xdadf('0x0'));var util=require(_0xdadf('0x1'));var moment=require(_0xdadf('0x2'));var BPromise=require(_0xdadf('0x3'));var rs=require(_0xdadf('0x4'));var fs=require('fs');var Redis=require(_0xdadf('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdadf('0x6'))(_0xdadf('0x7'));var config=require(_0xdadf('0x8'));var jayson=require(_0xdadf('0x9'));var client=jayson[_0xdadf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fabb6,_0x12f414,_0x5ab010){return new BPromise(function(_0x458303,_0x30ab93){return client[_0xdadf('0xb')](_0x3fabb6,_0x5ab010)[_0xdadf('0xc')](function(_0x229c56){logger[_0xdadf('0xd')](_0xdadf('0xe'),_0x12f414,_0xdadf('0xf'));logger[_0xdadf('0x10')](_0xdadf('0x11'),_0x12f414,_0xdadf('0xf'),JSON[_0xdadf('0x12')](_0x229c56));if(_0x229c56[_0xdadf('0x13')]){if(_0x229c56[_0xdadf('0x13')][_0xdadf('0x14')]===0x1f4){logger[_0xdadf('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x12f414,_0x229c56[_0xdadf('0x13')]['message']);return _0x30ab93(_0x229c56[_0xdadf('0x13')][_0xdadf('0x15')]);}logger[_0xdadf('0x13')](_0xdadf('0xe'),_0x12f414,_0x229c56[_0xdadf('0x13')][_0xdadf('0x15')]);return _0x458303(_0x229c56[_0xdadf('0x13')]['message']);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x12f414,_0xdadf('0xf'));_0x458303(_0x229c56[_0xdadf('0x16')]['message']);}})[_0xdadf('0x17')](function(_0x10b281){logger[_0xdadf('0x13')](_0xdadf('0xe'),_0x12f414,_0x10b281);_0x30ab93(_0x10b281);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index a732471..17c6998 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 _0xc3cc=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','update','delete','destroy','exports','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc3cc,0x1af));var _0xcc3c=function(_0x301b5a,_0xfb349a){_0x301b5a=_0x301b5a-0x0;var _0x18badb=_0xc3cc[_0x301b5a];return _0x18badb;};'use strict';var multer=require('multer');var util=require(_0xcc3c('0x0'));var path=require(_0xcc3c('0x1'));var timeout=require(_0xcc3c('0x2'));var express=require(_0xcc3c('0x3'));var router=express[_0xcc3c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcc3c('0x5'));var interaction=require(_0xcc3c('0x6'));var config=require(_0xcc3c('0x7'));var controller=require(_0xcc3c('0x8'));router[_0xcc3c('0x9')]('/',auth[_0xcc3c('0xa')](),controller['index']);router['get'](_0xcc3c('0xb'),auth['isAuthenticated'](),controller[_0xcc3c('0xc')]);router['get'](_0xcc3c('0xd'),auth[_0xcc3c('0xa')](),controller['show']);router['post']('/',auth[_0xcc3c('0xa')](),controller['create']);router['put'](_0xcc3c('0xd'),auth[_0xcc3c('0xa')](),controller[_0xcc3c('0xe')]);router[_0xcc3c('0xf')](_0xcc3c('0xd'),auth[_0xcc3c('0xa')](),controller[_0xcc3c('0x10')]);module[_0xcc3c('0x11')]=router; \ No newline at end of file +var _0x3c69=['get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','isAuthenticated','index','/describe'];(function(_0x669bd2,_0x25bf31){var _0x5561c4=function(_0x24614f){while(--_0x24614f){_0x669bd2['push'](_0x669bd2['shift']());}};_0x5561c4(++_0x25bf31);}(_0x3c69,0x196));var _0x93c6=function(_0x1a3619,_0x1b5358){_0x1a3619=_0x1a3619-0x0;var _0x438ae8=_0x3c69[_0x1a3619];return _0x438ae8;};'use strict';var multer=require(_0x93c6('0x0'));var util=require(_0x93c6('0x1'));var path=require(_0x93c6('0x2'));var timeout=require(_0x93c6('0x3'));var express=require(_0x93c6('0x4'));var router=express[_0x93c6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x93c6('0x6'));var interaction=require(_0x93c6('0x7'));var config=require('../../config/environment');var controller=require(_0x93c6('0x8'));router['get']('/',auth[_0x93c6('0x9')](),controller[_0x93c6('0xa')]);router['get'](_0x93c6('0xb'),auth[_0x93c6('0x9')](),controller['describe']);router[_0x93c6('0xc')](_0x93c6('0xd'),auth[_0x93c6('0x9')](),controller[_0x93c6('0xe')]);router[_0x93c6('0xf')]('/',auth[_0x93c6('0x9')](),controller[_0x93c6('0x10')]);router[_0x93c6('0x11')](_0x93c6('0xd'),auth[_0x93c6('0x9')](),controller[_0x93c6('0x12')]);router[_0x93c6('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x93c6('0x14')]);module[_0x93c6('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index cac594f..610bd45 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1aa60d,_0x43c572){var _0x4a170b=function(_0x2390c0){while(--_0x2390c0){_0x1aa60d['push'](_0x1aa60d['shift']());}};_0x4a170b(++_0x43c572);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0xcb91[_0x5db657];return _0x2d6e70;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0x54ef,0x112));var _0xf54e=function(_0x103d7d,_0x34fb17){_0x103d7d=_0x103d7d-0x0;var _0x486799=_0x54ef[_0x103d7d];return _0x486799;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index b3f33ec..7352919 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 _0xabb0=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','index','map','MailTransferReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','body','catch','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x492cbe,_0x106158){var _0x4fe6c8=function(_0x23a7c8){while(--_0x23a7c8){_0x492cbe['push'](_0x492cbe['shift']());}};_0x4fe6c8(++_0x106158);}(_0xabb0,0x1a7));var _0x0abb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabb0[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0abb('0x0'));var zipdir=require(_0x0abb('0x1'));var jsonpatch=require(_0x0abb('0x2'));var rp=require(_0x0abb('0x3'));var moment=require(_0x0abb('0x4'));var BPromise=require(_0x0abb('0x5'));var Mustache=require(_0x0abb('0x6'));var util=require(_0x0abb('0x7'));var path=require(_0x0abb('0x8'));var sox=require(_0x0abb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0abb('0xa'));var _=require(_0x0abb('0xb'));var squel=require(_0x0abb('0xc'));var crypto=require(_0x0abb('0xd'));var jsforce=require(_0x0abb('0xe'));var deskjs=require(_0x0abb('0xf'));var toCsv=require(_0x0abb('0x10'));var querystring=require('querystring');var Papa=require(_0x0abb('0x11'));var Redis=require(_0x0abb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0abb('0x13'));var as=require(_0x0abb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0abb('0x15'))('api');var utils=require(_0x0abb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0abb('0x17'));var db=require(_0x0abb('0x18'))['db'];function respondWithStatusCode(_0x2b48ba,_0x48d103){_0x48d103=_0x48d103||0xcc;return function(_0x49093b){if(_0x49093b){return _0x2b48ba[_0x0abb('0x19')](_0x48d103);}return _0x2b48ba[_0x0abb('0x1a')](_0x48d103)[_0x0abb('0x1b')]();};}function respondWithResult(_0x1b24f4,_0x323197){_0x323197=_0x323197||0xc8;return function(_0x207f05){if(_0x207f05){return _0x1b24f4['status'](_0x323197)[_0x0abb('0x1c')](_0x207f05);}};}function respondWithFilteredResult(_0x2cd33f,_0x5b7d1b){return function(_0x520b0b){if(_0x520b0b){var _0x493c83=typeof _0x5b7d1b[_0x0abb('0x1d')]===_0x0abb('0x1e')&&typeof _0x5b7d1b[_0x0abb('0x1f')]==='undefined';var _0x267a93=_0x520b0b[_0x0abb('0x20')];var _0x3a8d05=_0x493c83?0x0:_0x5b7d1b['offset'];var _0x35a904=_0x493c83?_0x520b0b['count']:_0x5b7d1b[_0x0abb('0x1d')]+_0x5b7d1b[_0x0abb('0x1f')];var _0x148385;if(_0x35a904>=_0x267a93){_0x35a904=_0x267a93;_0x148385=0xc8;}else{_0x148385=0xce;}_0x2cd33f[_0x0abb('0x1a')](_0x148385);return _0x2cd33f[_0x0abb('0x21')](_0x0abb('0x22'),_0x3a8d05+'-'+_0x35a904+'/'+_0x267a93)[_0x0abb('0x1c')](_0x520b0b);}return null;};}function patchUpdates(_0x4fa4f0){return function(_0x455acb){try{jsonpatch[_0x0abb('0x23')](_0x455acb,_0x4fa4f0,!![]);}catch(_0x4cdc06){return BPromise['reject'](_0x4cdc06);}return _0x455acb[_0x0abb('0x24')]();};}function saveUpdates(_0x22e751,_0x475bae){return function(_0x8d5779){if(_0x8d5779){return _0x8d5779['update'](_0x22e751)[_0x0abb('0x25')](function(_0x2712fc){return _0x2712fc;});}return null;};}function removeEntity(_0x198290,_0x29404d){return function(_0x27c767){if(_0x27c767){return _0x27c767[_0x0abb('0x26')]()['then'](function(){_0x198290[_0x0abb('0x1a')](0xcc)[_0x0abb('0x1b')]();});}};}function handleEntityNotFound(_0x2d0d24,_0x20b5e9){return function(_0x938a36){if(!_0x938a36){_0x2d0d24['sendStatus'](0x194);}return _0x938a36;};}function handleError(_0x390f71,_0x4f4aeb){_0x4f4aeb=_0x4f4aeb||0x1f4;return function(_0x2f2690){logger['error'](_0x2f2690[_0x0abb('0x27')]);if(_0x2f2690[_0x0abb('0x28')]){delete _0x2f2690[_0x0abb('0x28')];}_0x390f71[_0x0abb('0x1a')](_0x4f4aeb)['send'](_0x2f2690);};}exports[_0x0abb('0x29')]=function(_0x1e69c0,_0x246cff){var _0x464be9={},_0x2f483a={},_0x436a17={'count':0x0,'rows':[]};var _0x24b346=_[_0x0abb('0x2a')](db[_0x0abb('0x2b')]['rawAttributes'],function(_0x4d3202){return{'name':_0x4d3202[_0x0abb('0x2c')],'type':_0x4d3202[_0x0abb('0x2d')]['key']};});_0x2f483a[_0x0abb('0x2e')]=_[_0x0abb('0x2a')](_0x24b346,_0x0abb('0x28'));_0x2f483a[_0x0abb('0x2f')]=_[_0x0abb('0x30')](_0x1e69c0[_0x0abb('0x2f')]);_0x2f483a[_0x0abb('0x31')]=_[_0x0abb('0x32')](_0x2f483a[_0x0abb('0x2e')],_0x2f483a['query']);_0x464be9[_0x0abb('0x33')]=_[_0x0abb('0x32')](_0x2f483a[_0x0abb('0x2e')],qs[_0x0abb('0x34')](_0x1e69c0[_0x0abb('0x2f')]['fields']));_0x464be9[_0x0abb('0x33')]=_0x464be9[_0x0abb('0x33')][_0x0abb('0x35')]?_0x464be9['attributes']:_0x2f483a[_0x0abb('0x2e')];if(!_0x1e69c0[_0x0abb('0x2f')][_0x0abb('0x36')](_0x0abb('0x37'))){_0x464be9[_0x0abb('0x1f')]=qs['limit'](_0x1e69c0[_0x0abb('0x2f')][_0x0abb('0x1f')]);_0x464be9[_0x0abb('0x1d')]=qs['offset'](_0x1e69c0['query']['offset']);}_0x464be9[_0x0abb('0x38')]=qs['sort'](_0x1e69c0[_0x0abb('0x2f')][_0x0abb('0x39')]);_0x464be9[_0x0abb('0x3a')]=qs[_0x0abb('0x31')](_['pick'](_0x1e69c0[_0x0abb('0x2f')],_0x2f483a[_0x0abb('0x31')]),_0x24b346);if(_0x1e69c0[_0x0abb('0x2f')][_0x0abb('0x3b')]){_0x464be9[_0x0abb('0x3a')]=_['merge'](_0x464be9['where'],{'$or':_['map'](_0x24b346,function(_0x16ec37){if(_0x16ec37[_0x0abb('0x2d')]!==_0x0abb('0x3c')){var _0x51ea3f={};_0x51ea3f[_0x16ec37[_0x0abb('0x28')]]={'$like':'%'+_0x1e69c0['query'][_0x0abb('0x3b')]+'%'};return _0x51ea3f;}})});}_0x464be9=_[_0x0abb('0x3d')]({},_0x464be9,_0x1e69c0[_0x0abb('0x3e')]);var _0x139578={'where':_0x464be9['where']};return db[_0x0abb('0x2b')][_0x0abb('0x20')](_0x139578)[_0x0abb('0x25')](function(_0x3fba18){_0x436a17[_0x0abb('0x20')]=_0x3fba18;if(_0x1e69c0[_0x0abb('0x2f')][_0x0abb('0x3f')]){_0x464be9[_0x0abb('0x40')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x464be9);})[_0x0abb('0x25')](function(_0x4af895){_0x436a17[_0x0abb('0x41')]=_0x4af895;return _0x436a17;})['then'](respondWithFilteredResult(_0x246cff,_0x464be9))['catch'](handleError(_0x246cff,null));};exports[_0x0abb('0x42')]=function(_0x42b1d0,_0x5e9896){var _0x41b7f8={'raw':!![],'where':{'id':_0x42b1d0['params']['id']}},_0x334049={};_0x334049[_0x0abb('0x2e')]=_['keys'](db[_0x0abb('0x2b')]['rawAttributes']);_0x334049[_0x0abb('0x2f')]=_['keys'](_0x42b1d0[_0x0abb('0x2f')]);_0x334049[_0x0abb('0x31')]=_[_0x0abb('0x32')](_0x334049[_0x0abb('0x2e')],_0x334049[_0x0abb('0x2f')]);_0x41b7f8['attributes']=_[_0x0abb('0x32')](_0x334049[_0x0abb('0x2e')],qs[_0x0abb('0x34')](_0x42b1d0[_0x0abb('0x2f')][_0x0abb('0x34')]));_0x41b7f8[_0x0abb('0x33')]=_0x41b7f8[_0x0abb('0x33')][_0x0abb('0x35')]?_0x41b7f8[_0x0abb('0x33')]:_0x334049[_0x0abb('0x2e')];if(_0x42b1d0[_0x0abb('0x2f')][_0x0abb('0x3f')]){_0x41b7f8[_0x0abb('0x40')]=[{'all':!![]}];}_0x41b7f8=_[_0x0abb('0x3d')]({},_0x41b7f8,_0x42b1d0[_0x0abb('0x3e')]);return db[_0x0abb('0x2b')]['find'](_0x41b7f8)[_0x0abb('0x25')](handleEntityNotFound(_0x5e9896,null))[_0x0abb('0x25')](respondWithResult(_0x5e9896,null))['catch'](handleError(_0x5e9896,null));};exports['create']=function(_0x388f68,_0x4c7154){return db['MailTransferReport']['create'](_0x388f68[_0x0abb('0x43')],{})['then'](respondWithResult(_0x4c7154,0xc9))[_0x0abb('0x44')](handleError(_0x4c7154,null));};exports['update']=function(_0x1161da,_0x4015a0){if(_0x1161da['body']['id']){delete _0x1161da[_0x0abb('0x43')]['id'];}return db[_0x0abb('0x2b')][_0x0abb('0x45')]({'where':{'id':_0x1161da[_0x0abb('0x46')]['id']}})[_0x0abb('0x25')](handleEntityNotFound(_0x4015a0,null))['then'](saveUpdates(_0x1161da[_0x0abb('0x43')],null))[_0x0abb('0x25')](respondWithResult(_0x4015a0,null))['catch'](handleError(_0x4015a0,null));};exports['destroy']=function(_0x22675a,_0x46ded3){return db[_0x0abb('0x2b')][_0x0abb('0x45')]({'where':{'id':_0x22675a[_0x0abb('0x46')]['id']}})['then'](handleEntityNotFound(_0x46ded3,null))['then'](removeEntity(_0x46ded3,null))[_0x0abb('0x44')](handleError(_0x46ded3,null));};exports[_0x0abb('0x47')]=function(_0x2f6ab1,_0x3c9ba3){return db[_0x0abb('0x2b')][_0x0abb('0x47')]()['then'](respondWithResult(_0x3c9ba3,null))['catch'](handleError(_0x3c9ba3,null));}; \ No newline at end of file +var _0x893b=['describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body'];(function(_0xb11639,_0x9c8aa8){var _0x2f87de=function(_0x3a7905){while(--_0x3a7905){_0xb11639['push'](_0xb11639['shift']());}};_0x2f87de(++_0x9c8aa8);}(_0x893b,0xe8));var _0xb893=function(_0xeac4f4,_0x3a380e){_0xeac4f4=_0xeac4f4-0x0;var _0x47e37e=_0x893b[_0xeac4f4];return _0x47e37e;};'use strict';var emlformat=require(_0xb893('0x0'));var rimraf=require(_0xb893('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb893('0x2'));var moment=require(_0xb893('0x3'));var BPromise=require(_0xb893('0x4'));var Mustache=require(_0xb893('0x5'));var util=require(_0xb893('0x6'));var path=require('path');var sox=require(_0xb893('0x7'));var csv=require(_0xb893('0x8'));var ejs=require(_0xb893('0x9'));var fs=require('fs');var fs_extra=require(_0xb893('0xa'));var _=require(_0xb893('0xb'));var squel=require(_0xb893('0xc'));var crypto=require('crypto');var jsforce=require(_0xb893('0xd'));var deskjs=require(_0xb893('0xe'));var toCsv=require(_0xb893('0x8'));var querystring=require(_0xb893('0xf'));var Papa=require(_0xb893('0x10'));var Redis=require(_0xb893('0x11'));var authService=require(_0xb893('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb893('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb893('0x14'))(_0xb893('0x15'));var utils=require(_0xb893('0x16'));var config=require(_0xb893('0x17'));var licenseUtil=require(_0xb893('0x18'));var db=require(_0xb893('0x19'))['db'];function respondWithStatusCode(_0x555210,_0x1e68cf){_0x1e68cf=_0x1e68cf||0xcc;return function(_0x3fee21){if(_0x3fee21){return _0x555210['sendStatus'](_0x1e68cf);}return _0x555210[_0xb893('0x1a')](_0x1e68cf)['end']();};}function respondWithResult(_0x446506,_0x369562){_0x369562=_0x369562||0xc8;return function(_0x22edbd){if(_0x22edbd){return _0x446506[_0xb893('0x1a')](_0x369562)[_0xb893('0x1b')](_0x22edbd);}};}function respondWithFilteredResult(_0x5da1a4,_0x4df98a){return function(_0x1cc415){if(_0x1cc415){var _0x55426e=typeof _0x4df98a['offset']===_0xb893('0x1c')&&typeof _0x4df98a[_0xb893('0x1d')]===_0xb893('0x1c');var _0x5548fc=_0x1cc415[_0xb893('0x1e')];var _0xc32eea=_0x55426e?0x0:_0x4df98a['offset'];var _0x422089=_0x55426e?_0x1cc415['count']:_0x4df98a[_0xb893('0x1f')]+_0x4df98a[_0xb893('0x1d')];var _0xab7977;if(_0x422089>=_0x5548fc){_0x422089=_0x5548fc;_0xab7977=0xc8;}else{_0xab7977=0xce;}_0x5da1a4[_0xb893('0x1a')](_0xab7977);return _0x5da1a4['set'](_0xb893('0x20'),_0xc32eea+'-'+_0x422089+'/'+_0x5548fc)[_0xb893('0x1b')](_0x1cc415);}return null;};}function patchUpdates(_0x3cf937){return function(_0x2a66c7){try{jsonpatch[_0xb893('0x21')](_0x2a66c7,_0x3cf937,!![]);}catch(_0x5e42e5){return BPromise['reject'](_0x5e42e5);}return _0x2a66c7[_0xb893('0x22')]();};}function saveUpdates(_0x45fa95,_0x4a26ed){return function(_0x1e64ea){if(_0x1e64ea){return _0x1e64ea[_0xb893('0x23')](_0x45fa95)[_0xb893('0x24')](function(_0x2754d9){return _0x2754d9;});}return null;};}function removeEntity(_0x90bbf8,_0xcb2829){return function(_0x14fd97){if(_0x14fd97){return _0x14fd97[_0xb893('0x25')]()[_0xb893('0x24')](function(){_0x90bbf8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fc962,_0x582db6){return function(_0x5be361){if(!_0x5be361){_0x1fc962[_0xb893('0x26')](0x194);}return _0x5be361;};}function handleError(_0x2282de,_0x5c5df3){_0x5c5df3=_0x5c5df3||0x1f4;return function(_0x420a8f){logger[_0xb893('0x27')](_0x420a8f[_0xb893('0x28')]);if(_0x420a8f['name']){delete _0x420a8f['name'];}_0x2282de['status'](_0x5c5df3)[_0xb893('0x29')](_0x420a8f);};}exports[_0xb893('0x2a')]=function(_0x26101a,_0x424be3){var _0x14fd40={},_0xabc29={},_0x1d0e0f={'count':0x0,'rows':[]};var _0x59324e=_[_0xb893('0x2b')](db[_0xb893('0x2c')][_0xb893('0x2d')],function(_0x499188){return{'name':_0x499188[_0xb893('0x2e')],'type':_0x499188[_0xb893('0x2f')][_0xb893('0x30')]};});_0xabc29[_0xb893('0x31')]=_[_0xb893('0x2b')](_0x59324e,_0xb893('0x32'));_0xabc29[_0xb893('0x33')]=_[_0xb893('0x34')](_0x26101a[_0xb893('0x33')]);_0xabc29[_0xb893('0x35')]=_[_0xb893('0x36')](_0xabc29[_0xb893('0x31')],_0xabc29['query']);_0x14fd40[_0xb893('0x37')]=_['intersection'](_0xabc29[_0xb893('0x31')],qs[_0xb893('0x38')](_0x26101a[_0xb893('0x33')][_0xb893('0x38')]));_0x14fd40[_0xb893('0x37')]=_0x14fd40['attributes'][_0xb893('0x39')]?_0x14fd40[_0xb893('0x37')]:_0xabc29[_0xb893('0x31')];if(!_0x26101a[_0xb893('0x33')][_0xb893('0x3a')](_0xb893('0x3b'))){_0x14fd40[_0xb893('0x1d')]=qs['limit'](_0x26101a[_0xb893('0x33')][_0xb893('0x1d')]);_0x14fd40[_0xb893('0x1f')]=qs[_0xb893('0x1f')](_0x26101a[_0xb893('0x33')][_0xb893('0x1f')]);}_0x14fd40['order']=qs['sort'](_0x26101a[_0xb893('0x33')][_0xb893('0x3c')]);_0x14fd40[_0xb893('0x3d')]=qs[_0xb893('0x35')](_[_0xb893('0x3e')](_0x26101a[_0xb893('0x33')],_0xabc29['filters']),_0x59324e);if(_0x26101a[_0xb893('0x33')][_0xb893('0x3f')]){_0x14fd40[_0xb893('0x3d')]=_[_0xb893('0x40')](_0x14fd40['where'],{'$or':_[_0xb893('0x2b')](_0x59324e,function(_0x37438d){if(_0x37438d[_0xb893('0x2f')]!==_0xb893('0x41')){var _0x3639b2={};_0x3639b2[_0x37438d['name']]={'$like':'%'+_0x26101a[_0xb893('0x33')][_0xb893('0x3f')]+'%'};return _0x3639b2;}})});}_0x14fd40=_['merge']({},_0x14fd40,_0x26101a['options']);var _0x52cc39={'where':_0x14fd40['where']};return db['MailTransferReport'][_0xb893('0x1e')](_0x52cc39)[_0xb893('0x24')](function(_0x42c348){_0x1d0e0f[_0xb893('0x1e')]=_0x42c348;if(_0x26101a[_0xb893('0x33')][_0xb893('0x42')]){_0x14fd40[_0xb893('0x43')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x14fd40);})[_0xb893('0x24')](function(_0x2b23ff){_0x1d0e0f[_0xb893('0x44')]=_0x2b23ff;return _0x1d0e0f;})[_0xb893('0x24')](respondWithFilteredResult(_0x424be3,_0x14fd40))[_0xb893('0x45')](handleError(_0x424be3,null));};exports[_0xb893('0x46')]=function(_0x4517bb,_0x35d922){var _0x10575d={'raw':!![],'where':{'id':_0x4517bb[_0xb893('0x47')]['id']}},_0x4ce53e={};_0x4ce53e[_0xb893('0x31')]=_[_0xb893('0x34')](db[_0xb893('0x2c')][_0xb893('0x2d')]);_0x4ce53e[_0xb893('0x33')]=_[_0xb893('0x34')](_0x4517bb[_0xb893('0x33')]);_0x4ce53e['filters']=_[_0xb893('0x36')](_0x4ce53e['model'],_0x4ce53e[_0xb893('0x33')]);_0x10575d[_0xb893('0x37')]=_[_0xb893('0x36')](_0x4ce53e[_0xb893('0x31')],qs[_0xb893('0x38')](_0x4517bb[_0xb893('0x33')]['fields']));_0x10575d['attributes']=_0x10575d['attributes'][_0xb893('0x39')]?_0x10575d[_0xb893('0x37')]:_0x4ce53e[_0xb893('0x31')];if(_0x4517bb[_0xb893('0x33')][_0xb893('0x42')]){_0x10575d[_0xb893('0x43')]=[{'all':!![]}];}_0x10575d=_[_0xb893('0x40')]({},_0x10575d,_0x4517bb[_0xb893('0x48')]);return db[_0xb893('0x2c')][_0xb893('0x49')](_0x10575d)['then'](handleEntityNotFound(_0x35d922,null))[_0xb893('0x24')](respondWithResult(_0x35d922,null))[_0xb893('0x45')](handleError(_0x35d922,null));};exports[_0xb893('0x4a')]=function(_0x3665c2,_0x286c7a){return db[_0xb893('0x2c')][_0xb893('0x4a')](_0x3665c2[_0xb893('0x4b')],{})['then'](respondWithResult(_0x286c7a,0xc9))['catch'](handleError(_0x286c7a,null));};exports[_0xb893('0x23')]=function(_0x4752ad,_0x16fec5){if(_0x4752ad[_0xb893('0x4b')]['id']){delete _0x4752ad[_0xb893('0x4b')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x4752ad['params']['id']}})[_0xb893('0x24')](handleEntityNotFound(_0x16fec5,null))[_0xb893('0x24')](saveUpdates(_0x4752ad[_0xb893('0x4b')],null))[_0xb893('0x24')](respondWithResult(_0x16fec5,null))[_0xb893('0x45')](handleError(_0x16fec5,null));};exports[_0xb893('0x25')]=function(_0x565e05,_0x418dab){return db[_0xb893('0x2c')]['find']({'where':{'id':_0x565e05['params']['id']}})[_0xb893('0x24')](handleEntityNotFound(_0x418dab,null))[_0xb893('0x24')](removeEntity(_0x418dab,null))['catch'](handleError(_0x418dab,null));};exports[_0xb893('0x4c')]=function(_0x2bb323,_0x1d8e10){return db[_0xb893('0x2c')]['describe']()[_0xb893('0x24')](respondWithResult(_0x1d8e10,null))[_0xb893('0x45')](handleError(_0x1d8e10,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d3d5aa4..49f995d 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 _0xcba7=['MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define'];(function(_0x27853d,_0x47493a){var _0xd8865e=function(_0x5d6179){while(--_0x5d6179){_0x27853d['push'](_0x27853d['shift']());}};_0xd8865e(++_0x47493a);}(_0xcba7,0x199));var _0x7cba=function(_0x253d2b,_0x49a0fb){_0x253d2b=_0x253d2b-0x0;var _0x3ce8bd=_0xcba7[_0x253d2b];return _0x3ce8bd;};'use strict';var _=require(_0x7cba('0x0'));var util=require(_0x7cba('0x1'));var logger=require(_0x7cba('0x2'))(_0x7cba('0x3'));var moment=require('moment');var BPromise=require(_0x7cba('0x4'));var rp=require(_0x7cba('0x5'));var fs=require('fs');var path=require(_0x7cba('0x6'));var rimraf=require('rimraf');var config=require(_0x7cba('0x7'));var attributes=require(_0x7cba('0x8'));module[_0x7cba('0x9')]=function(_0x2b0112,_0x285928){return _0x2b0112[_0x7cba('0xa')](_0x7cba('0xb'),attributes,{'tableName':_0x7cba('0xc'),'paranoid':![],'indexes':[{'name':_0x7cba('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa2ae=['request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x2edd79,_0x3072cb){var _0x3fe95d=function(_0x1928ec){while(--_0x1928ec){_0x2edd79['push'](_0x2edd79['shift']());}};_0x3fe95d(++_0x3072cb);}(_0xa2ae,0x95));var _0xea2a=function(_0x381bff,_0x19d01f){_0x381bff=_0x381bff-0x0;var _0x201ab1=_0xa2ae[_0x381bff];return _0x201ab1;};'use strict';var _=require(_0xea2a('0x0'));var util=require(_0xea2a('0x1'));var logger=require('../../config/logger')(_0xea2a('0x2'));var moment=require(_0xea2a('0x3'));var BPromise=require(_0xea2a('0x4'));var rp=require(_0xea2a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea2a('0x6'));var config=require(_0xea2a('0x7'));var attributes=require(_0xea2a('0x8'));module[_0xea2a('0x9')]=function(_0x115f66,_0x40c61a){return _0x115f66[_0xea2a('0xa')](_0xea2a('0xb'),attributes,{'tableName':_0xea2a('0xc'),'paranoid':![],'indexes':[{'name':_0xea2a('0xd'),'fields':[_0xea2a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 606b226..5d8426b 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 _0xf0b6=['stringify','error','message','result','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x493199,_0x1c6ecd){var _0x5293ba=function(_0x1ce67e){while(--_0x1ce67e){_0x493199['push'](_0x493199['shift']());}};_0x5293ba(++_0x1c6ecd);}(_0xf0b6,0x180));var _0x6f0b=function(_0xb44bd1,_0x366952){_0xb44bd1=_0xb44bd1-0x0;var _0x58d530=_0xf0b6[_0xb44bd1];return _0x58d530;};'use strict';var _=require(_0x6f0b('0x0'));var util=require('util');var moment=require(_0x6f0b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f0b('0x2'))['db'];var utils=require(_0x6f0b('0x3'));var logger=require(_0x6f0b('0x4'))(_0x6f0b('0x5'));var config=require(_0x6f0b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6f0b('0x7')][_0x6f0b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e1337,_0x56b367,_0x2c9794){return new BPromise(function(_0x70bb28,_0x2ba42e){return client['request'](_0x2e1337,_0x2c9794)[_0x6f0b('0x9')](function(_0x5a2d03){logger[_0x6f0b('0xa')](_0x6f0b('0xb'),_0x56b367,_0x6f0b('0xc'));logger[_0x6f0b('0xd')](_0x6f0b('0xe'),_0x56b367,_0x6f0b('0xc'),JSON[_0x6f0b('0xf')](_0x5a2d03));if(_0x5a2d03[_0x6f0b('0x10')]){if(_0x5a2d03[_0x6f0b('0x10')]['code']===0x1f4){logger['error'](_0x6f0b('0xb'),_0x56b367,_0x5a2d03[_0x6f0b('0x10')][_0x6f0b('0x11')]);return _0x2ba42e(_0x5a2d03[_0x6f0b('0x10')][_0x6f0b('0x11')]);}logger[_0x6f0b('0x10')](_0x6f0b('0xb'),_0x56b367,_0x5a2d03[_0x6f0b('0x10')][_0x6f0b('0x11')]);return _0x70bb28(_0x5a2d03[_0x6f0b('0x10')][_0x6f0b('0x11')]);}else{logger['info'](_0x6f0b('0xb'),_0x56b367,_0x6f0b('0xc'));_0x70bb28(_0x5a2d03[_0x6f0b('0x12')]['message']);}})['catch'](function(_0x3074c4){logger[_0x6f0b('0x10')](_0x6f0b('0xb'),_0x56b367,_0x3074c4);_0x2ba42e(_0x3074c4);});});} \ No newline at end of file +var _0x5c80=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0xb251f1,_0x51cc0e){var _0x17cb3f=function(_0x4f03e1){while(--_0x4f03e1){_0xb251f1['push'](_0xb251f1['shift']());}};_0x17cb3f(++_0x51cc0e);}(_0x5c80,0x1a5));var _0x05c8=function(_0x3bf5c9,_0x32151d){_0x3bf5c9=_0x3bf5c9-0x0;var _0x28fe33=_0x5c80[_0x3bf5c9];return _0x28fe33;};'use strict';var _=require(_0x05c8('0x0'));var util=require(_0x05c8('0x1'));var moment=require(_0x05c8('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c8('0x3'));var fs=require('fs');var Redis=require(_0x05c8('0x4'));var db=require(_0x05c8('0x5'))['db'];var utils=require(_0x05c8('0x6'));var logger=require(_0x05c8('0x7'))(_0x05c8('0x8'));var config=require(_0x05c8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x05c8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c6906,_0x135d8f,_0x126c49){return new BPromise(function(_0x26cb00,_0x5ad701){return client[_0x05c8('0xb')](_0x5c6906,_0x126c49)[_0x05c8('0xc')](function(_0xfd7032){logger[_0x05c8('0xd')](_0x05c8('0xe'),_0x135d8f,_0x05c8('0xf'));logger[_0x05c8('0x10')](_0x05c8('0x11'),_0x135d8f,_0x05c8('0xf'),JSON[_0x05c8('0x12')](_0xfd7032));if(_0xfd7032[_0x05c8('0x13')]){if(_0xfd7032[_0x05c8('0x13')][_0x05c8('0x14')]===0x1f4){logger[_0x05c8('0x13')](_0x05c8('0xe'),_0x135d8f,_0xfd7032[_0x05c8('0x13')]['message']);return _0x5ad701(_0xfd7032[_0x05c8('0x13')]['message']);}logger['error'](_0x05c8('0xe'),_0x135d8f,_0xfd7032[_0x05c8('0x13')][_0x05c8('0x15')]);return _0x26cb00(_0xfd7032[_0x05c8('0x13')][_0x05c8('0x15')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x135d8f,_0x05c8('0xf'));_0x26cb00(_0xfd7032['result'][_0x05c8('0x15')]);}})[_0x05c8('0x16')](function(_0x18875a){logger[_0x05c8('0x13')](_0x05c8('0xe'),_0x135d8f,_0x18875a);_0x5ad701(_0x18875a);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 44ac8ad..d7d4956 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 _0x9bba=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','./memberReport.controller','get','isAuthenticated','index'];(function(_0x50d1d1,_0x89ac94){var _0x33465f=function(_0x170311){while(--_0x170311){_0x50d1d1['push'](_0x50d1d1['shift']());}};_0x33465f(++_0x89ac94);}(_0x9bba,0xab));var _0xa9bb=function(_0x2adb70,_0x5b1da4){_0x2adb70=_0x2adb70-0x0;var _0x4ff145=_0x9bba[_0x2adb70];return _0x4ff145;};'use strict';var multer=require(_0xa9bb('0x0'));var util=require('util');var path=require(_0xa9bb('0x1'));var timeout=require(_0xa9bb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa9bb('0x3'));var auth=require(_0xa9bb('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa9bb('0x5'));router[_0xa9bb('0x6')]('/',auth[_0xa9bb('0x7')](),controller[_0xa9bb('0x8')]);router[_0xa9bb('0x6')](_0xa9bb('0x9'),auth[_0xa9bb('0x7')](),controller[_0xa9bb('0xa')]);router[_0xa9bb('0x6')](_0xa9bb('0xb'),auth['isAuthenticated'](),controller[_0xa9bb('0xc')]);router[_0xa9bb('0xd')]('/',auth['isAuthenticated'](),controller[_0xa9bb('0xe')]);router[_0xa9bb('0xf')]('/:id',auth[_0xa9bb('0x7')](),controller[_0xa9bb('0x10')]);router[_0xa9bb('0x11')](_0xa9bb('0xb'),auth['isAuthenticated'](),controller[_0xa9bb('0x12')]);module[_0xa9bb('0x13')]=router; \ No newline at end of file +var _0x4c9f=['./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x16f88c,_0x2aad29){var _0x20ab2e=function(_0x438525){while(--_0x438525){_0x16f88c['push'](_0x16f88c['shift']());}};_0x20ab2e(++_0x2aad29);}(_0x4c9f,0xa1));var _0xf4c9=function(_0x5b22d6,_0x4f06cf){_0x5b22d6=_0x5b22d6-0x0;var _0x562183=_0x4c9f[_0x5b22d6];return _0x562183;};'use strict';var multer=require(_0xf4c9('0x0'));var util=require(_0xf4c9('0x1'));var path=require('path');var timeout=require(_0xf4c9('0x2'));var express=require('express');var router=express[_0xf4c9('0x3')]();var fs_extra=require(_0xf4c9('0x4'));var auth=require(_0xf4c9('0x5'));var interaction=require(_0xf4c9('0x6'));var config=require('../../config/environment');var controller=require(_0xf4c9('0x7'));router[_0xf4c9('0x8')]('/',auth[_0xf4c9('0x9')](),controller[_0xf4c9('0xa')]);router[_0xf4c9('0x8')](_0xf4c9('0xb'),auth[_0xf4c9('0x9')](),controller[_0xf4c9('0xc')]);router[_0xf4c9('0x8')](_0xf4c9('0xd'),auth[_0xf4c9('0x9')](),controller[_0xf4c9('0xe')]);router[_0xf4c9('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf4c9('0x10')]('/:id',auth[_0xf4c9('0x9')](),controller[_0xf4c9('0x11')]);router[_0xf4c9('0x12')](_0xf4c9('0xd'),auth[_0xf4c9('0x9')](),controller[_0xf4c9('0x13')]);module[_0xf4c9('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 0b9d875..5629635 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 _0x517f=['moment','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[queue]'];(function(_0x9f57ca,_0xede913){var _0x171560=function(_0x5e696c){while(--_0x5e696c){_0x9f57ca['push'](_0x9f57ca['shift']());}};_0x171560(++_0xede913);}(_0x517f,0x17a));var _0xf517=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x517f[_0x4e9d3c];return _0x2d0825;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf517('0x0'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf517('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0xf517('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xf517('0x3')]},'enterAt':{'type':Sequelize[_0xf517('0x4')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4cc93f){var _0x50d03e=moment(_0x4cc93f);var _0x399b6f=moment(this['getDataValue'](_0xf517('0x5')));var _0x56e8cf=_0x50d03e[_0xf517('0x6')](_0x399b6f,_0xf517('0x7'));this[_0xf517('0x8')](_0xf517('0x9'),_0x4cc93f);this[_0xf517('0x8')](_0xf517('0xa'),_0x56e8cf>=0x0?_0x56e8cf:null);}},'data1':{'type':Sequelize[_0xf517('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xf517('0x1')],'comment':_0xf517('0xb')},'data3':{'type':Sequelize[_0xf517('0x1')],'comment':_0xf517('0xc')},'data4':{'type':Sequelize[_0xf517('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xf517('0x1')],'comment':_0xf517('0xd')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xf517('0x3')]},'uniqueid':{'type':Sequelize[_0xf517('0x1')]}}; \ No newline at end of file +var _0xa76d=['DATE','getDataValue','enterAt','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x5d491a,_0x46fe1b){var _0x31b402=function(_0x14854e){while(--_0x14854e){_0x5d491a['push'](_0x5d491a['shift']());}};_0x31b402(++_0x46fe1b);}(_0xa76d,0xba));var _0xda76=function(_0x11aeac,_0x27613c){_0x11aeac=_0x11aeac-0x0;var _0x50868a=_0xa76d[_0x11aeac];return _0x50868a;};'use strict';var Sequelize=require(_0xda76('0x0'));var moment=require(_0xda76('0x1'));module[_0xda76('0x2')]={'channel':{'type':Sequelize[_0xda76('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xda76('0x3')],'defaultValue':_0xda76('0x4'),'comment':_0xda76('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xda76('0x6')]},'exitAt':{'type':Sequelize[_0xda76('0x6')],'set':function(_0xb3f1d2){var _0x3616cc=moment(_0xb3f1d2);var _0x59c30c=moment(this[_0xda76('0x7')](_0xda76('0x8')));var _0x23b66b=_0x3616cc['diff'](_0x59c30c,_0xda76('0x9'));this['setDataValue'](_0xda76('0xa'),_0xb3f1d2);this[_0xda76('0xb')](_0xda76('0xc'),_0x23b66b>=0x0?_0x23b66b:null);}},'data1':{'type':Sequelize[_0xda76('0x3')],'comment':_0xda76('0xd')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xda76('0x3')],'comment':_0xda76('0xe')},'data4':{'type':Sequelize[_0xda76('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xda76('0x3')]},'internal':{'type':Sequelize[_0xda76('0xf')]},'uniqueid':{'type':Sequelize[_0xda76('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1e7518a..5068e0c 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../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','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x55ca,0x126));var _0xa55c=function(_0x1e2372,_0x2ea876){_0x1e2372=_0x1e2372-0x0;var _0x4cd59b=_0x55ca[_0x1e2372];return _0x4cd59b;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x4cb8de,_0x5235ab){var _0x11c2b9=function(_0x54fca6){while(--_0x54fca6){_0x4cb8de['push'](_0x4cb8de['shift']());}};_0x11c2b9(++_0x5235ab);}(_0x008c,0x188));var _0xc008=function(_0x5bf601,_0x8fb76d){_0x5bf601=_0x5bf601-0x0;var _0x4ea9b6=_0x008c[_0x5bf601];return _0x4ea9b6;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 9addf85..4b6071a 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 _0xefaf=['util','../../config/logger','api','moment','request-promise','rimraf','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xefaf,0x8b));var _0xfefa=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xefaf[_0x1a7846];return _0x48049;};'use strict';var _=require(_0xfefa('0x0'));var util=require(_0xfefa('0x1'));var logger=require(_0xfefa('0x2'))(_0xfefa('0x3'));var moment=require(_0xfefa('0x4'));var BPromise=require('bluebird');var rp=require(_0xfefa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfefa('0x6'));var config=require('../../config/environment');var attributes=require(_0xfefa('0x7'));module['exports']=function(_0x31d1c6,_0x1c581e){return _0x31d1c6[_0xfefa('0x8')](_0xfefa('0x9'),attributes,{'tableName':_0xfefa('0xa'),'paranoid':![],'indexes':[{'name':_0xfefa('0xb'),'fields':[_0xfefa('0xc'),_0xfefa('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ad=['./memberReport.attributes','exports','report_member','membername_interface','membername','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x40ef08,_0x6d88f1){var _0x451bb6=function(_0x596c26){while(--_0x596c26){_0x40ef08['push'](_0x40ef08['shift']());}};_0x451bb6(++_0x6d88f1);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x19772a,_0x18b58f){_0x19772a=_0x19772a-0x0;var _0x38ef20=_0xb2ad[_0x19772a];return _0x38ef20;};'use strict';var _=require('lodash');var util=require(_0xdb2a('0x0'));var logger=require('../../config/logger')(_0xdb2a('0x1'));var moment=require(_0xdb2a('0x2'));var BPromise=require(_0xdb2a('0x3'));var rp=require(_0xdb2a('0x4'));var fs=require('fs');var path=require(_0xdb2a('0x5'));var rimraf=require('rimraf');var config=require(_0xdb2a('0x6'));var attributes=require(_0xdb2a('0x7'));module[_0xdb2a('0x8')]=function(_0x1f9551,_0x5c69b1){return _0x1f9551['define']('MemberReport',attributes,{'tableName':_0xdb2a('0x9'),'paranoid':![],'indexes':[{'name':_0xdb2a('0xa'),'fields':[_0xdb2a('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 4c93cb8..5b61aba 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 _0x14f5=['../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','model','map','stringify','CreateMemberReport','create','body','UpdateMemberReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x46a5df,_0x120ccf){var _0x15983c=function(_0x539602){while(--_0x539602){_0x46a5df['push'](_0x46a5df['shift']());}};_0x15983c(++_0x120ccf);}(_0x14f5,0xae));var _0x514f=function(_0x3db32b,_0x38ecdc){_0x3db32b=_0x3db32b-0x0;var _0x299e38=_0x14f5[_0x3db32b];return _0x299e38;};'use strict';var _=require('lodash');var util=require(_0x514f('0x0'));var moment=require('moment');var BPromise=require(_0x514f('0x1'));var rs=require(_0x514f('0x2'));var fs=require('fs');var Redis=require(_0x514f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x514f('0x4'));var logger=require(_0x514f('0x5'))('rpc');var config=require(_0x514f('0x6'));var jayson=require(_0x514f('0x7'));var client=jayson[_0x514f('0x8')][_0x514f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x463985,_0x43ec42,_0xdb9614){return new BPromise(function(_0x4a5497,_0x203b02){return client['request'](_0x463985,_0xdb9614)[_0x514f('0xa')](function(_0x1e3fa7){logger[_0x514f('0xb')](_0x514f('0xc'),_0x43ec42,_0x514f('0xd'));logger[_0x514f('0xe')](_0x514f('0xf'),_0x43ec42,'request\x20sent',JSON['stringify'](_0x1e3fa7));if(_0x1e3fa7['error']){if(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x11')]===0x1f4){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x203b02(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);return _0x4a5497(_0x1e3fa7[_0x514f('0x10')][_0x514f('0x12')]);}else{logger[_0x514f('0xb')]('MemberReport,\x20%s,\x20%s',_0x43ec42,_0x514f('0xd'));_0x4a5497(_0x1e3fa7[_0x514f('0x13')]['message']);}})[_0x514f('0x14')](function(_0x53851d){logger[_0x514f('0x10')](_0x514f('0xc'),_0x43ec42,_0x53851d);_0x203b02(_0x53851d);});});}exports[_0x514f('0x15')]=function(_0x5a5641){var _0x28e99a=this;return new Promise(function(_0x3673a4,_0x2cdd0d){return db[_0x514f('0x16')]['findAll']({'raw':_0x5a5641['options']?_0x5a5641[_0x514f('0x17')][_0x514f('0x18')]===undefined?!![]:![]:!![],'where':_0x5a5641[_0x514f('0x17')]?_0x5a5641['options'][_0x514f('0x19')]||null:null,'attributes':_0x5a5641[_0x514f('0x17')]?_0x5a5641['options'][_0x514f('0x1a')]||null:null,'limit':_0x5a5641[_0x514f('0x17')]?_0x5a5641['options'][_0x514f('0x1b')]||null:null,'include':_0x5a5641[_0x514f('0x17')]?_0x5a5641[_0x514f('0x17')][_0x514f('0x1c')]?_['map'](_0x5a5641['options']['include'],function(_0x5d80cb){return{'model':db[_0x5d80cb[_0x514f('0x1d')]],'as':_0x5d80cb['as'],'attributes':_0x5d80cb[_0x514f('0x1a')],'include':_0x5d80cb[_0x514f('0x1c')]?_[_0x514f('0x1e')](_0x5d80cb[_0x514f('0x1c')],function(_0x26df04){return{'model':db[_0x26df04[_0x514f('0x1d')]],'as':_0x26df04['as'],'attributes':_0x26df04[_0x514f('0x1a')],'include':_0x26df04[_0x514f('0x1c')]?_['map'](_0x26df04[_0x514f('0x1c')],function(_0x37b3db){return{'model':db[_0x37b3db[_0x514f('0x1d')]],'as':_0x37b3db['as'],'attributes':_0x37b3db[_0x514f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x514f('0xa')](function(_0x32f3e1){logger[_0x514f('0xb')](_0x514f('0x15'),_0x5a5641);logger[_0x514f('0xe')]('GetMemberReport',_0x5a5641,JSON[_0x514f('0x1f')](_0x32f3e1));_0x3673a4(_0x32f3e1);})['catch'](function(_0x2b43e0){logger['error'](_0x514f('0x15'),_0x2b43e0[_0x514f('0x12')],_0x5a5641);_0x2cdd0d(_0x28e99a[_0x514f('0x10')](0x1f4,_0x2b43e0[_0x514f('0x12')]));});});};exports[_0x514f('0x20')]=function(_0x5d9017){var _0x56e83e=this;return new Promise(function(_0x3e788b,_0x5d564b){return db[_0x514f('0x16')][_0x514f('0x21')](_0x5d9017[_0x514f('0x22')],{'raw':_0x5d9017[_0x514f('0x17')]?_0x5d9017[_0x514f('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5eee93){logger[_0x514f('0xb')](_0x514f('0x20'),_0x5d9017);logger[_0x514f('0xe')](_0x514f('0x20'),_0x5d9017,JSON[_0x514f('0x1f')](_0x5eee93));_0x3e788b(_0x5eee93);})[_0x514f('0x14')](function(_0x1cd65a){logger[_0x514f('0x10')](_0x514f('0x20'),_0x1cd65a[_0x514f('0x12')],_0x5d9017);_0x5d564b(_0x56e83e['error'](0x1f4,_0x1cd65a['message']));});});};exports['UpdateMemberReport']=function(_0x63d383){var _0x4e028b=this;return new Promise(function(_0x450d04,_0x50c120){return db[_0x514f('0x16')]['update'](_0x63d383['body'],{'raw':_0x63d383[_0x514f('0x17')]?_0x63d383['options'][_0x514f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63d383[_0x514f('0x17')]?_0x63d383[_0x514f('0x17')][_0x514f('0x19')]||null:null,'attributes':_0x63d383[_0x514f('0x17')]?_0x63d383['options'][_0x514f('0x1a')]||null:null,'limit':_0x63d383[_0x514f('0x17')]?_0x63d383[_0x514f('0x17')][_0x514f('0x1b')]||null:null})['then'](function(_0x196a2b){logger[_0x514f('0xb')](_0x514f('0x23'),_0x63d383);logger[_0x514f('0xe')]('UpdateMemberReport',_0x63d383,JSON[_0x514f('0x1f')](_0x196a2b));_0x450d04(_0x196a2b);})[_0x514f('0x14')](function(_0x420c77){logger[_0x514f('0x10')]('UpdateMemberReport',_0x420c77[_0x514f('0x12')],_0x63d383);_0x50c120(_0x4e028b['error'](0x1f4,_0x420c77[_0x514f('0x12')]));});});}; \ No newline at end of file +var _0x8085=['CreateMemberReport','MemberReport','body','UpdateMemberReport','update','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMemberReport','options','raw','where','attributes','limit','include','map','model','stringify','catch'];(function(_0x336e33,_0x527fa3){var _0x6c333a=function(_0x48dabd){while(--_0x48dabd){_0x336e33['push'](_0x336e33['shift']());}};_0x6c333a(++_0x527fa3);}(_0x8085,0x71));var _0x5808=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x8085[_0x547456];return _0xc1fd7b;};'use strict';var _=require(_0x5808('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5808('0x1'));var rs=require(_0x5808('0x2'));var fs=require('fs');var Redis=require(_0x5808('0x3'));var db=require(_0x5808('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5808('0x5'));var config=require(_0x5808('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5808('0x7')][_0x5808('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39458f,_0x2d204e,_0x2a9716){return new BPromise(function(_0x5b30b9,_0x30e63c){return client[_0x5808('0x9')](_0x39458f,_0x2a9716)[_0x5808('0xa')](function(_0x447811){logger[_0x5808('0xb')](_0x5808('0xc'),_0x2d204e,_0x5808('0xd'));logger[_0x5808('0xe')](_0x5808('0xf'),_0x2d204e,'request\x20sent',JSON['stringify'](_0x447811));if(_0x447811[_0x5808('0x10')]){if(_0x447811[_0x5808('0x10')][_0x5808('0x11')]===0x1f4){logger[_0x5808('0x10')](_0x5808('0xc'),_0x2d204e,_0x447811[_0x5808('0x10')][_0x5808('0x12')]);return _0x30e63c(_0x447811['error']['message']);}logger[_0x5808('0x10')](_0x5808('0xc'),_0x2d204e,_0x447811[_0x5808('0x10')][_0x5808('0x12')]);return _0x5b30b9(_0x447811[_0x5808('0x10')][_0x5808('0x12')]);}else{logger[_0x5808('0xb')](_0x5808('0xc'),_0x2d204e,_0x5808('0xd'));_0x5b30b9(_0x447811[_0x5808('0x13')][_0x5808('0x12')]);}})['catch'](function(_0x3342ae){logger['error'](_0x5808('0xc'),_0x2d204e,_0x3342ae);_0x30e63c(_0x3342ae);});});}exports[_0x5808('0x14')]=function(_0x3bf0ee){var _0x529a0d=this;return new Promise(function(_0x9e58d4,_0x37919b){return db['MemberReport']['findAll']({'raw':_0x3bf0ee[_0x5808('0x15')]?_0x3bf0ee['options'][_0x5808('0x16')]===undefined?!![]:![]:!![],'where':_0x3bf0ee[_0x5808('0x15')]?_0x3bf0ee[_0x5808('0x15')][_0x5808('0x17')]||null:null,'attributes':_0x3bf0ee['options']?_0x3bf0ee['options'][_0x5808('0x18')]||null:null,'limit':_0x3bf0ee[_0x5808('0x15')]?_0x3bf0ee[_0x5808('0x15')][_0x5808('0x19')]||null:null,'include':_0x3bf0ee[_0x5808('0x15')]?_0x3bf0ee[_0x5808('0x15')][_0x5808('0x1a')]?_[_0x5808('0x1b')](_0x3bf0ee[_0x5808('0x15')]['include'],function(_0x5b5175){return{'model':db[_0x5b5175[_0x5808('0x1c')]],'as':_0x5b5175['as'],'attributes':_0x5b5175[_0x5808('0x18')],'include':_0x5b5175['include']?_['map'](_0x5b5175[_0x5808('0x1a')],function(_0x467500){return{'model':db[_0x467500[_0x5808('0x1c')]],'as':_0x467500['as'],'attributes':_0x467500['attributes'],'include':_0x467500['include']?_[_0x5808('0x1b')](_0x467500[_0x5808('0x1a')],function(_0x27c991){return{'model':db[_0x27c991[_0x5808('0x1c')]],'as':_0x27c991['as'],'attributes':_0x27c991[_0x5808('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x398744){logger[_0x5808('0xb')](_0x5808('0x14'),_0x3bf0ee);logger[_0x5808('0xe')](_0x5808('0x14'),_0x3bf0ee,JSON[_0x5808('0x1d')](_0x398744));_0x9e58d4(_0x398744);})[_0x5808('0x1e')](function(_0x4ad6d8){logger['error'](_0x5808('0x14'),_0x4ad6d8[_0x5808('0x12')],_0x3bf0ee);_0x37919b(_0x529a0d[_0x5808('0x10')](0x1f4,_0x4ad6d8['message']));});});};exports[_0x5808('0x1f')]=function(_0x3438be){var _0x269810=this;return new Promise(function(_0x2247a0,_0xef83d2){return db[_0x5808('0x20')]['create'](_0x3438be[_0x5808('0x21')],{'raw':_0x3438be[_0x5808('0x15')]?_0x3438be[_0x5808('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x315bb1){logger['info'](_0x5808('0x1f'),_0x3438be);logger[_0x5808('0xe')]('CreateMemberReport',_0x3438be,JSON[_0x5808('0x1d')](_0x315bb1));_0x2247a0(_0x315bb1);})[_0x5808('0x1e')](function(_0x581be8){logger['error'](_0x5808('0x1f'),_0x581be8['message'],_0x3438be);_0xef83d2(_0x269810[_0x5808('0x10')](0x1f4,_0x581be8['message']));});});};exports[_0x5808('0x22')]=function(_0x334cd5){var _0x2b6fc8=this;return new Promise(function(_0x5e0696,_0x317aba){return db['MemberReport'][_0x5808('0x23')](_0x334cd5['body'],{'raw':_0x334cd5['options']?_0x334cd5[_0x5808('0x15')][_0x5808('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x334cd5[_0x5808('0x15')]?_0x334cd5['options']['where']||null:null,'attributes':_0x334cd5[_0x5808('0x15')]?_0x334cd5[_0x5808('0x15')]['attributes']||null:null,'limit':_0x334cd5[_0x5808('0x15')]?_0x334cd5[_0x5808('0x15')][_0x5808('0x19')]||null:null})['then'](function(_0x22b366){logger[_0x5808('0xb')](_0x5808('0x22'),_0x334cd5);logger['debug'](_0x5808('0x22'),_0x334cd5,JSON[_0x5808('0x1d')](_0x22b366));_0x5e0696(_0x22b366);})['catch'](function(_0x5d4dff){logger[_0x5808('0x10')]('UpdateMemberReport',_0x5d4dff[_0x5808('0x12')],_0x334cd5);_0x317aba(_0x2b6fc8[_0x5808('0x10')](0x1f4,_0x5d4dff[_0x5808('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2b5e200..3bfd44b 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 _0x2094=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0x2094,0x10d));var _0x4209=function(_0x2622d9,_0x58c453){_0x2622d9=_0x2622d9-0x0;var _0x108913=_0x2094[_0x2622d9];return _0x108913;};'use strict';var multer=require(_0x4209('0x0'));var util=require('util');var path=require(_0x4209('0x1'));var timeout=require(_0x4209('0x2'));var express=require(_0x4209('0x3'));var router=express[_0x4209('0x4')]();var fs_extra=require(_0x4209('0x5'));var auth=require(_0x4209('0x6'));var interaction=require(_0x4209('0x7'));var config=require(_0x4209('0x8'));var controller=require(_0x4209('0x9'));router[_0x4209('0xa')]('/',controller[_0x4209('0xb')]);module['exports']=router; \ No newline at end of file +var _0xbc00=['./migration.controller','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4b174b,_0xe526d0){var _0x52e473=function(_0x164953){while(--_0x164953){_0x4b174b['push'](_0x4b174b['shift']());}};_0x52e473(++_0xe526d0);}(_0xbc00,0x107));var _0x0bc0=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0xbc00[_0x41ee16];return _0x1f60de;};'use strict';var multer=require(_0x0bc0('0x0'));var util=require(_0x0bc0('0x1'));var path=require('path');var timeout=require(_0x0bc0('0x2'));var express=require('express');var router=express[_0x0bc0('0x3')]();var fs_extra=require(_0x0bc0('0x4'));var auth=require(_0x0bc0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0bc0('0x6'));var controller=require(_0x0bc0('0x7'));router['get']('/',controller['index']);module[_0x0bc0('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 5ad4b1d..a6eb9c0 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 _0xcd98=['sequelize','exports','STRING','version'];(function(_0x3bdbe9,_0x3a2901){var _0x26b09a=function(_0x994673){while(--_0x994673){_0x3bdbe9['push'](_0x3bdbe9['shift']());}};_0x26b09a(++_0x3a2901);}(_0xcd98,0xc8));var _0x8cd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd98[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8cd9('0x0'));module[_0x8cd9('0x1')]={'version':{'type':Sequelize[_0x8cd9('0x2')],'unique':_0x8cd9('0x3')}}; \ No newline at end of file +var _0x5886=['sequelize','exports','STRING','version'];(function(_0x412408,_0x4bb044){var _0x37df53=function(_0x1c38e9){while(--_0x1c38e9){_0x412408['push'](_0x412408['shift']());}};_0x37df53(++_0x4bb044);}(_0x5886,0x100));var _0x6588=function(_0x1cbf75,_0x3caff4){_0x1cbf75=_0x1cbf75-0x0;var _0x3456f7=_0x5886[_0x1cbf75];return _0x3456f7;};'use strict';var Sequelize=require(_0x6588('0x0'));module[_0x6588('0x1')]={'version':{'type':Sequelize[_0x6588('0x2')],'unique':_0x6588('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 083eae0..96902bd 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 _0x4faf=['filter','merge','VIRTUAL','options','includeAll','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','Migration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick'];(function(_0x4ac3a5,_0x67e43a){var _0x16da11=function(_0x1cb16e){while(--_0x1cb16e){_0x4ac3a5['push'](_0x4ac3a5['shift']());}};_0x16da11(++_0x67e43a);}(_0x4faf,0x1dc));var _0xf4fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4faf[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf4fa('0x0'));var rimraf=require(_0xf4fa('0x1'));var zipdir=require(_0xf4fa('0x2'));var jsonpatch=require(_0xf4fa('0x3'));var rp=require(_0xf4fa('0x4'));var moment=require('moment');var BPromise=require(_0xf4fa('0x5'));var Mustache=require('mustache');var util=require(_0xf4fa('0x6'));var path=require(_0xf4fa('0x7'));var sox=require(_0xf4fa('0x8'));var csv=require(_0xf4fa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4fa('0xa'));var _=require(_0xf4fa('0xb'));var squel=require(_0xf4fa('0xc'));var crypto=require('crypto');var jsforce=require(_0xf4fa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf4fa('0x9'));var querystring=require(_0xf4fa('0xe'));var Papa=require(_0xf4fa('0xf'));var Redis=require('ioredis');var authService=require(_0xf4fa('0x10'));var qs=require(_0xf4fa('0x11'));var as=require(_0xf4fa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4fa('0x13'))(_0xf4fa('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf4fa('0x15'))['db'];function respondWithStatusCode(_0x44e758,_0x22212b){_0x22212b=_0x22212b||0xcc;return function(_0x1bb5af){if(_0x1bb5af){return _0x44e758[_0xf4fa('0x16')](_0x22212b);}return _0x44e758[_0xf4fa('0x17')](_0x22212b)[_0xf4fa('0x18')]();};}function respondWithResult(_0x9accec,_0x233dda){_0x233dda=_0x233dda||0xc8;return function(_0x39d40a){if(_0x39d40a){return _0x9accec[_0xf4fa('0x17')](_0x233dda)[_0xf4fa('0x19')](_0x39d40a);}};}function respondWithFilteredResult(_0x31b0a8,_0x51190f){return function(_0x3aeb8e){if(_0x3aeb8e){var _0x3f53c1=typeof _0x51190f[_0xf4fa('0x1a')]==='undefined'&&typeof _0x51190f[_0xf4fa('0x1b')]===_0xf4fa('0x1c');var _0x39e86c=_0x3aeb8e[_0xf4fa('0x1d')];var _0x46d7b3=_0x3f53c1?0x0:_0x51190f[_0xf4fa('0x1a')];var _0x3c88f8=_0x3f53c1?_0x3aeb8e[_0xf4fa('0x1d')]:_0x51190f[_0xf4fa('0x1a')]+_0x51190f[_0xf4fa('0x1b')];var _0x3ebd4a;if(_0x3c88f8>=_0x39e86c){_0x3c88f8=_0x39e86c;_0x3ebd4a=0xc8;}else{_0x3ebd4a=0xce;}_0x31b0a8[_0xf4fa('0x17')](_0x3ebd4a);return _0x31b0a8[_0xf4fa('0x1e')](_0xf4fa('0x1f'),_0x46d7b3+'-'+_0x3c88f8+'/'+_0x39e86c)[_0xf4fa('0x19')](_0x3aeb8e);}return null;};}function patchUpdates(_0x218e66){return function(_0x2c67d9){try{jsonpatch[_0xf4fa('0x20')](_0x2c67d9,_0x218e66,!![]);}catch(_0x5849be){return BPromise[_0xf4fa('0x21')](_0x5849be);}return _0x2c67d9['save']();};}function saveUpdates(_0x2f4da9,_0x5d6474){return function(_0x515c09){if(_0x515c09){return _0x515c09[_0xf4fa('0x22')](_0x2f4da9)[_0xf4fa('0x23')](function(_0x326ab8){return _0x326ab8;});}return null;};}function removeEntity(_0x1d1e4c,_0xf0fc9e){return function(_0x486de9){if(_0x486de9){return _0x486de9[_0xf4fa('0x24')]()[_0xf4fa('0x23')](function(){_0x1d1e4c['status'](0xcc)[_0xf4fa('0x18')]();});}};}function handleEntityNotFound(_0x12d95e,_0x1aa198){return function(_0x5ed875){if(!_0x5ed875){_0x12d95e[_0xf4fa('0x16')](0x194);}return _0x5ed875;};}function handleError(_0x5ca18f,_0x53a80f){_0x53a80f=_0x53a80f||0x1f4;return function(_0x317532){logger[_0xf4fa('0x25')](_0x317532[_0xf4fa('0x26')]);if(_0x317532[_0xf4fa('0x27')]){delete _0x317532[_0xf4fa('0x27')];}_0x5ca18f['status'](_0x53a80f)[_0xf4fa('0x28')](_0x317532);};}exports[_0xf4fa('0x29')]=function(_0x5e5b2c,_0x25ba68){var _0x4eae18={},_0x1cb598={},_0x140dda={'count':0x0,'rows':[]};var _0x549b0c=_['map'](db[_0xf4fa('0x2a')][_0xf4fa('0x2b')],function(_0x25ec73){return{'name':_0x25ec73[_0xf4fa('0x2c')],'type':_0x25ec73[_0xf4fa('0x2d')][_0xf4fa('0x2e')]};});_0x1cb598[_0xf4fa('0x2f')]=_[_0xf4fa('0x30')](_0x549b0c,'name');_0x1cb598[_0xf4fa('0x31')]=_[_0xf4fa('0x32')](_0x5e5b2c['query']);_0x1cb598[_0xf4fa('0x33')]=_[_0xf4fa('0x34')](_0x1cb598[_0xf4fa('0x2f')],_0x1cb598['query']);_0x4eae18['attributes']=_['intersection'](_0x1cb598[_0xf4fa('0x2f')],qs[_0xf4fa('0x35')](_0x5e5b2c['query']['fields']));_0x4eae18['attributes']=_0x4eae18[_0xf4fa('0x36')]['length']?_0x4eae18[_0xf4fa('0x36')]:_0x1cb598[_0xf4fa('0x2f')];if(!_0x5e5b2c[_0xf4fa('0x31')][_0xf4fa('0x37')]('nolimit')){_0x4eae18['limit']=qs['limit'](_0x5e5b2c[_0xf4fa('0x31')][_0xf4fa('0x1b')]);_0x4eae18[_0xf4fa('0x1a')]=qs[_0xf4fa('0x1a')](_0x5e5b2c[_0xf4fa('0x31')][_0xf4fa('0x1a')]);}_0x4eae18[_0xf4fa('0x38')]=qs[_0xf4fa('0x39')](_0x5e5b2c[_0xf4fa('0x31')][_0xf4fa('0x39')]);_0x4eae18[_0xf4fa('0x3a')]=qs['filters'](_[_0xf4fa('0x3b')](_0x5e5b2c[_0xf4fa('0x31')],_0x1cb598[_0xf4fa('0x33')]),_0x549b0c);if(_0x5e5b2c[_0xf4fa('0x31')][_0xf4fa('0x3c')]){_0x4eae18[_0xf4fa('0x3a')]=_[_0xf4fa('0x3d')](_0x4eae18[_0xf4fa('0x3a')],{'$or':_[_0xf4fa('0x30')](_0x549b0c,function(_0x9b4ae0){if(_0x9b4ae0[_0xf4fa('0x2d')]!==_0xf4fa('0x3e')){var _0x6c3d10={};_0x6c3d10[_0x9b4ae0[_0xf4fa('0x27')]]={'$like':'%'+_0x5e5b2c[_0xf4fa('0x31')][_0xf4fa('0x3c')]+'%'};return _0x6c3d10;}})});}_0x4eae18=_[_0xf4fa('0x3d')]({},_0x4eae18,_0x5e5b2c[_0xf4fa('0x3f')]);var _0x2f866d={'where':_0x4eae18[_0xf4fa('0x3a')]};return db[_0xf4fa('0x2a')][_0xf4fa('0x1d')](_0x2f866d)[_0xf4fa('0x23')](function(_0x1e399c){_0x140dda[_0xf4fa('0x1d')]=_0x1e399c;if(_0x5e5b2c['query'][_0xf4fa('0x40')]){_0x4eae18['include']=[{'all':!![]}];}return db[_0xf4fa('0x2a')][_0xf4fa('0x41')](_0x4eae18);})['then'](function(_0x47b679){_0x140dda['rows']=_0x47b679;return _0x140dda;})['then'](respondWithFilteredResult(_0x25ba68,_0x4eae18))[_0xf4fa('0x42')](handleError(_0x25ba68,null));}; \ No newline at end of file +var _0x2131=['api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','index','map','Migration','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x11b4ab,_0x23e9f5){var _0xeb0f65=function(_0x3947c0){while(--_0x3947c0){_0x11b4ab['push'](_0x11b4ab['shift']());}};_0xeb0f65(++_0x23e9f5);}(_0x2131,0xee));var _0x1213=function(_0x3fc5e9,_0x21abe9){_0x3fc5e9=_0x3fc5e9-0x0;var _0x1bb03d=_0x2131[_0x3fc5e9];return _0x1bb03d;};'use strict';var emlformat=require(_0x1213('0x0'));var rimraf=require(_0x1213('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1213('0x2'));var rp=require(_0x1213('0x3'));var moment=require(_0x1213('0x4'));var BPromise=require(_0x1213('0x5'));var Mustache=require('mustache');var util=require(_0x1213('0x6'));var path=require('path');var sox=require(_0x1213('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1213('0x8'));var _=require(_0x1213('0x9'));var squel=require(_0x1213('0xa'));var crypto=require('crypto');var jsforce=require(_0x1213('0xb'));var deskjs=require(_0x1213('0xc'));var toCsv=require(_0x1213('0xd'));var querystring=require(_0x1213('0xe'));var Papa=require(_0x1213('0xf'));var Redis=require(_0x1213('0x10'));var authService=require(_0x1213('0x11'));var qs=require(_0x1213('0x12'));var as=require(_0x1213('0x13'));var hardwareService=require(_0x1213('0x14'));var logger=require(_0x1213('0x15'))(_0x1213('0x16'));var utils=require(_0x1213('0x17'));var config=require(_0x1213('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1213('0x19'))['db'];function respondWithStatusCode(_0x16c1a7,_0x4ed76f){_0x4ed76f=_0x4ed76f||0xcc;return function(_0x280a2e){if(_0x280a2e){return _0x16c1a7['sendStatus'](_0x4ed76f);}return _0x16c1a7[_0x1213('0x1a')](_0x4ed76f)[_0x1213('0x1b')]();};}function respondWithResult(_0x288236,_0x940da5){_0x940da5=_0x940da5||0xc8;return function(_0x217081){if(_0x217081){return _0x288236[_0x1213('0x1a')](_0x940da5)[_0x1213('0x1c')](_0x217081);}};}function respondWithFilteredResult(_0x49aeb0,_0x464dbe){return function(_0x1379c9){if(_0x1379c9){var _0x391b54=typeof _0x464dbe[_0x1213('0x1d')]===_0x1213('0x1e')&&typeof _0x464dbe['limit']===_0x1213('0x1e');var _0x11069f=_0x1379c9[_0x1213('0x1f')];var _0x35b1da=_0x391b54?0x0:_0x464dbe['offset'];var _0x1388ae=_0x391b54?_0x1379c9['count']:_0x464dbe['offset']+_0x464dbe[_0x1213('0x20')];var _0x3e4a0d;if(_0x1388ae>=_0x11069f){_0x1388ae=_0x11069f;_0x3e4a0d=0xc8;}else{_0x3e4a0d=0xce;}_0x49aeb0[_0x1213('0x1a')](_0x3e4a0d);return _0x49aeb0[_0x1213('0x21')]('Content-Range',_0x35b1da+'-'+_0x1388ae+'/'+_0x11069f)['json'](_0x1379c9);}return null;};}function patchUpdates(_0x28a167){return function(_0x2130ed){try{jsonpatch[_0x1213('0x22')](_0x2130ed,_0x28a167,!![]);}catch(_0x416a17){return BPromise['reject'](_0x416a17);}return _0x2130ed[_0x1213('0x23')]();};}function saveUpdates(_0x56fbce,_0x45a0e6){return function(_0x177be3){if(_0x177be3){return _0x177be3[_0x1213('0x24')](_0x56fbce)[_0x1213('0x25')](function(_0x3411a6){return _0x3411a6;});}return null;};}function removeEntity(_0x4485a8,_0x2109ed){return function(_0x47e0b1){if(_0x47e0b1){return _0x47e0b1['destroy']()['then'](function(){_0x4485a8[_0x1213('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3914e2,_0x4c1eff){return function(_0x1f466b){if(!_0x1f466b){_0x3914e2[_0x1213('0x26')](0x194);}return _0x1f466b;};}function handleError(_0x23b094,_0x169363){_0x169363=_0x169363||0x1f4;return function(_0x5df0d7){logger[_0x1213('0x27')](_0x5df0d7[_0x1213('0x28')]);if(_0x5df0d7[_0x1213('0x29')]){delete _0x5df0d7[_0x1213('0x29')];}_0x23b094[_0x1213('0x1a')](_0x169363)['send'](_0x5df0d7);};}exports[_0x1213('0x2a')]=function(_0x3e1784,_0x57e77b){var _0x36d792={},_0x1deb8a={},_0x3b7ab3={'count':0x0,'rows':[]};var _0x22a333=_[_0x1213('0x2b')](db[_0x1213('0x2c')][_0x1213('0x2d')],function(_0x4fa56b){return{'name':_0x4fa56b['fieldName'],'type':_0x4fa56b[_0x1213('0x2e')][_0x1213('0x2f')]};});_0x1deb8a['model']=_[_0x1213('0x2b')](_0x22a333,_0x1213('0x29'));_0x1deb8a[_0x1213('0x30')]=_[_0x1213('0x31')](_0x3e1784[_0x1213('0x30')]);_0x1deb8a['filters']=_['intersection'](_0x1deb8a[_0x1213('0x32')],_0x1deb8a[_0x1213('0x30')]);_0x36d792[_0x1213('0x33')]=_[_0x1213('0x34')](_0x1deb8a[_0x1213('0x32')],qs[_0x1213('0x35')](_0x3e1784['query'][_0x1213('0x35')]));_0x36d792[_0x1213('0x33')]=_0x36d792[_0x1213('0x33')]['length']?_0x36d792[_0x1213('0x33')]:_0x1deb8a[_0x1213('0x32')];if(!_0x3e1784[_0x1213('0x30')][_0x1213('0x36')]('nolimit')){_0x36d792[_0x1213('0x20')]=qs[_0x1213('0x20')](_0x3e1784[_0x1213('0x30')][_0x1213('0x20')]);_0x36d792[_0x1213('0x1d')]=qs[_0x1213('0x1d')](_0x3e1784['query'][_0x1213('0x1d')]);}_0x36d792[_0x1213('0x37')]=qs[_0x1213('0x38')](_0x3e1784['query'][_0x1213('0x38')]);_0x36d792[_0x1213('0x39')]=qs[_0x1213('0x3a')](_['pick'](_0x3e1784[_0x1213('0x30')],_0x1deb8a['filters']),_0x22a333);if(_0x3e1784[_0x1213('0x30')][_0x1213('0x3b')]){_0x36d792['where']=_['merge'](_0x36d792[_0x1213('0x39')],{'$or':_['map'](_0x22a333,function(_0x3a1435){if(_0x3a1435['type']!==_0x1213('0x3c')){var _0x122ca5={};_0x122ca5[_0x3a1435[_0x1213('0x29')]]={'$like':'%'+_0x3e1784[_0x1213('0x30')][_0x1213('0x3b')]+'%'};return _0x122ca5;}})});}_0x36d792=_[_0x1213('0x3d')]({},_0x36d792,_0x3e1784[_0x1213('0x3e')]);var _0x21686f={'where':_0x36d792[_0x1213('0x39')]};return db['Migration'][_0x1213('0x1f')](_0x21686f)[_0x1213('0x25')](function(_0x184ab5){_0x3b7ab3[_0x1213('0x1f')]=_0x184ab5;if(_0x3e1784[_0x1213('0x30')][_0x1213('0x3f')]){_0x36d792[_0x1213('0x40')]=[{'all':!![]}];}return db[_0x1213('0x2c')]['findAll'](_0x36d792);})[_0x1213('0x25')](function(_0x4dceb3){_0x3b7ab3['rows']=_0x4dceb3;return _0x3b7ab3;})[_0x1213('0x25')](respondWithFilteredResult(_0x57e77b,_0x36d792))['catch'](handleError(_0x57e77b,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 710624f..f59c922 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 _0xf957=['request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x153da6,_0xc9bfde){var _0xf01a0d=function(_0x409ed5){while(--_0x409ed5){_0x153da6['push'](_0x153da6['shift']());}};_0xf01a0d(++_0xc9bfde);}(_0xf957,0x8a));var _0x7f95=function(_0x2bc524,_0x3fec3c){_0x2bc524=_0x2bc524-0x0;var _0x5ef769=_0xf957[_0x2bc524];return _0x5ef769;};'use strict';var _=require(_0x7f95('0x0'));var util=require(_0x7f95('0x1'));var logger=require(_0x7f95('0x2'))(_0x7f95('0x3'));var moment=require(_0x7f95('0x4'));var BPromise=require(_0x7f95('0x5'));var rp=require(_0x7f95('0x6'));var fs=require('fs');var path=require(_0x7f95('0x7'));var rimraf=require(_0x7f95('0x8'));var config=require(_0x7f95('0x9'));var attributes=require(_0x7f95('0xa'));module[_0x7f95('0xb')]=function(_0x349fa1,_0x3da384){return _0x349fa1['define']('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xace1=['define','Migration','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes'];(function(_0x338b20,_0x37942c){var _0x5cd515=function(_0x5995b4){while(--_0x5995b4){_0x338b20['push'](_0x338b20['shift']());}};_0x5cd515(++_0x37942c);}(_0xace1,0xce));var _0x1ace=function(_0x816276,_0x5eac26){_0x816276=_0x816276-0x0;var _0x8173aa=_0xace1[_0x816276];return _0x8173aa;};'use strict';var _=require(_0x1ace('0x0'));var util=require(_0x1ace('0x1'));var logger=require('../../config/logger')(_0x1ace('0x2'));var moment=require(_0x1ace('0x3'));var BPromise=require(_0x1ace('0x4'));var rp=require(_0x1ace('0x5'));var fs=require('fs');var path=require(_0x1ace('0x6'));var rimraf=require(_0x1ace('0x7'));var config=require(_0x1ace('0x8'));var attributes=require(_0x1ace('0x9'));module['exports']=function(_0x39fe76,_0x2c7900){return _0x39fe76[_0x1ace('0xa')](_0x1ace('0xb'),attributes,{'tableName':'migrations','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 d189a7a..ec18cff 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 _0x98e5=['request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98e5,0x8a));var _0x598e=function(_0x4096d7,_0x4543dd){_0x4096d7=_0x4096d7-0x0;var _0x2a8cdc=_0x98e5[_0x4096d7];return _0x2a8cdc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x598e('0x0'));var rs=require(_0x598e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x598e('0x2'))['db'];var utils=require(_0x598e('0x3'));var logger=require('../../config/logger')(_0x598e('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x598e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4292c3,_0x1fc8b5,_0x10bf8e){return new BPromise(function(_0x3e0212,_0x9dc046){return client[_0x598e('0x6')](_0x4292c3,_0x10bf8e)[_0x598e('0x7')](function(_0x2550b9){logger[_0x598e('0x8')](_0x598e('0x9'),_0x1fc8b5,_0x598e('0xa'));logger['debug'](_0x598e('0xb'),_0x1fc8b5,_0x598e('0xa'),JSON['stringify'](_0x2550b9));if(_0x2550b9[_0x598e('0xc')]){if(_0x2550b9['error'][_0x598e('0xd')]===0x1f4){logger[_0x598e('0xc')](_0x598e('0x9'),_0x1fc8b5,_0x2550b9[_0x598e('0xc')][_0x598e('0xe')]);return _0x9dc046(_0x2550b9['error'][_0x598e('0xe')]);}logger['error'](_0x598e('0x9'),_0x1fc8b5,_0x2550b9[_0x598e('0xc')]['message']);return _0x3e0212(_0x2550b9[_0x598e('0xc')][_0x598e('0xe')]);}else{logger[_0x598e('0x8')](_0x598e('0x9'),_0x1fc8b5,_0x598e('0xa'));_0x3e0212(_0x2550b9[_0x598e('0xf')][_0x598e('0xe')]);}})['catch'](function(_0x9ba324){logger[_0x598e('0xc')](_0x598e('0x9'),_0x1fc8b5,_0x9ba324);_0x9dc046(_0x9ba324);});});} \ No newline at end of file +var _0x74b1=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s','info'];(function(_0x3552dd,_0x20fc3d){var _0xeb6062=function(_0x4e2762){while(--_0x4e2762){_0x3552dd['push'](_0x3552dd['shift']());}};_0xeb6062(++_0x20fc3d);}(_0x74b1,0xb5));var _0x174b=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0x74b1[_0x59eefb];return _0x1a49e8;};'use strict';var _=require(_0x174b('0x0'));var util=require(_0x174b('0x1'));var moment=require('moment');var BPromise=require(_0x174b('0x2'));var rs=require(_0x174b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x174b('0x4'))['db'];var utils=require(_0x174b('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x174b('0x6'));var client=jayson[_0x174b('0x7')][_0x174b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5127e6,_0x1858ab,_0x3dbdef){return new BPromise(function(_0x48edc5,_0x483ec9){return client[_0x174b('0x9')](_0x5127e6,_0x3dbdef)['then'](function(_0x907686){logger['info']('Migration,\x20%s,\x20%s',_0x1858ab,_0x174b('0xa'));logger[_0x174b('0xb')](_0x174b('0xc'),_0x1858ab,_0x174b('0xa'),JSON[_0x174b('0xd')](_0x907686));if(_0x907686[_0x174b('0xe')]){if(_0x907686[_0x174b('0xe')][_0x174b('0xf')]===0x1f4){logger[_0x174b('0xe')]('Migration,\x20%s,\x20%s',_0x1858ab,_0x907686[_0x174b('0xe')][_0x174b('0x10')]);return _0x483ec9(_0x907686[_0x174b('0xe')][_0x174b('0x10')]);}logger[_0x174b('0xe')](_0x174b('0x11'),_0x1858ab,_0x907686[_0x174b('0xe')][_0x174b('0x10')]);return _0x48edc5(_0x907686[_0x174b('0xe')]['message']);}else{logger[_0x174b('0x12')](_0x174b('0x11'),_0x1858ab,_0x174b('0xa'));_0x48edc5(_0x907686['result']['message']);}})[_0x174b('0x13')](function(_0x10995c){logger[_0x174b('0xe')](_0x174b('0x11'),_0x1858ab,_0x10995c);_0x483ec9(_0x10995c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 44db569..fd32a28 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 _0x0adf=['./network.controller','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x2f9a11,_0x3d8504){_0x2f9a11=_0x2f9a11-0x0;var _0x3536a8=_0x0adf[_0x2f9a11];return _0x3536a8;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var fs_extra=require(_0xf0ad('0x5'));var auth=require(_0xf0ad('0x6'));var interaction=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var controller=require(_0xf0ad('0x9'));router['get']('/',auth[_0xf0ad('0xa')](),controller['index']);router[_0xf0ad('0xb')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xe')]('/',auth[_0xf0ad('0xa')](),controller[_0xf0ad('0xf')]);router['put'](_0xf0ad('0xc'),auth['isAuthenticated'](),controller[_0xf0ad('0x10')]);router[_0xf0ad('0x11')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf11e=['create','put','exports','multer','path','connect-timeout','express','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','post'];(function(_0x2981f9,_0x45f91c){var _0x58e13c=function(_0x621425){while(--_0x621425){_0x2981f9['push'](_0x2981f9['shift']());}};_0x58e13c(++_0x45f91c);}(_0xf11e,0x11b));var _0xef11=function(_0x35b2e9,_0x4b8fb8){_0x35b2e9=_0x35b2e9-0x0;var _0x42e9fa=_0xf11e[_0x35b2e9];return _0x42e9fa;};'use strict';var multer=require(_0xef11('0x0'));var util=require('util');var path=require(_0xef11('0x1'));var timeout=require(_0xef11('0x2'));var express=require(_0xef11('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xef11('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xef11('0x5'));router[_0xef11('0x6')]('/',auth[_0xef11('0x7')](),controller[_0xef11('0x8')]);router[_0xef11('0x6')](_0xef11('0x9'),auth[_0xef11('0x7')](),controller['show']);router[_0xef11('0xa')]('/',auth[_0xef11('0x7')](),controller[_0xef11('0xb')]);router[_0xef11('0xc')](_0xef11('0x9'),auth[_0xef11('0x7')](),controller['update']);router['delete'](_0xef11('0x9'),auth[_0xef11('0x7')](),controller['destroy']);module[_0xef11('0xd')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 8dd0560..e3cadc8 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 _0x8288=['turn','STRING','sequelize','exports','ENUM','stun'];(function(_0x5e47d2,_0x6ad116){var _0x28d82d=function(_0x43d6b7){while(--_0x43d6b7){_0x5e47d2['push'](_0x5e47d2['shift']());}};_0x28d82d(++_0x6ad116);}(_0x8288,0x1e8));var _0x8828=function(_0x2ddae,_0x34c7a6){_0x2ddae=_0x2ddae-0x0;var _0x8edc67=_0x8288[_0x2ddae];return _0x8edc67;};'use strict';var Sequelize=require(_0x8828('0x0'));module[_0x8828('0x1')]={'type':{'type':Sequelize[_0x8828('0x2')]('localnet','externip',_0x8828('0x3'),_0x8828('0x4'))},'value':{'type':Sequelize[_0x8828('0x5')]},'username':{'type':Sequelize[_0x8828('0x5')]},'password':{'type':Sequelize[_0x8828('0x5')]}}; \ No newline at end of file +var _0x8eb6=['sequelize','exports','ENUM','externip','stun','turn','STRING'];(function(_0x35b4b0,_0x1912ac){var _0x29935d=function(_0x181eae){while(--_0x181eae){_0x35b4b0['push'](_0x35b4b0['shift']());}};_0x29935d(++_0x1912ac);}(_0x8eb6,0xb6));var _0x68eb=function(_0x53e003,_0x34f89a){_0x53e003=_0x53e003-0x0;var _0x5813be=_0x8eb6[_0x53e003];return _0x5813be;};'use strict';var Sequelize=require(_0x68eb('0x0'));module[_0x68eb('0x1')]={'type':{'type':Sequelize[_0x68eb('0x2')]('localnet',_0x68eb('0x3'),_0x68eb('0x4'),_0x68eb('0x5'))},'value':{'type':Sequelize[_0x68eb('0x6')]},'username':{'type':Sequelize[_0x68eb('0x6')]},'password':{'type':Sequelize[_0x68eb('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 54e630b..94e0443 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 _0xc8b9=['path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','map','Network','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','join','root','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','params','toUpperCase','STUN','server/files/templates/stun_multiple.ejs','render','Reload','readFileSync'];(function(_0x32800c,_0x1d8e18){var _0x672d72=function(_0x8de39f){while(--_0x8de39f){_0x32800c['push'](_0x32800c['shift']());}};_0x672d72(++_0x1d8e18);}(_0xc8b9,0xac));var _0x9c8b=function(_0x4306e3,_0x875fc9){_0x4306e3=_0x4306e3-0x0;var _0x3d7c4a=_0xc8b9[_0x4306e3];return _0x3d7c4a;};'use strict';var util=require('util');var path=require(_0x9c8b('0x0'));var ejs=require(_0x9c8b('0x1'));var fs=require('fs');var _=require('lodash');var qs=require(_0x9c8b('0x2'));var logger=require(_0x9c8b('0x3'))(_0x9c8b('0x4'));var config=require(_0x9c8b('0x5'));var db=require(_0x9c8b('0x6'))['db'];var jayson=require(_0x9c8b('0x7'));var client=jayson['client'][_0x9c8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ebe90,_0x347114,_0x7c0d83,_0x100cd4){return new Promise(function(_0x52f51d,_0x376369){var _0x5808ae=_0x100cd4||client;return _0x5808ae['request'](_0x5ebe90,_0x7c0d83)['then'](function(_0x2d1cf4){logger[_0x9c8b('0x9')](_0x9c8b('0xa'),_0x347114,'request\x20sent');logger[_0x9c8b('0xb')](_0x9c8b('0xc'),_0x347114,_0x9c8b('0xd'),JSON[_0x9c8b('0xe')](_0x2d1cf4));if(_0x2d1cf4[_0x9c8b('0xf')]){if(_0x2d1cf4[_0x9c8b('0xf')][_0x9c8b('0x10')]===0x1f4){logger['error'](_0x9c8b('0xa'),_0x347114,_0x2d1cf4[_0x9c8b('0xf')][_0x9c8b('0x11')]);return _0x376369(_0x2d1cf4['error'][_0x9c8b('0x11')]);}logger[_0x9c8b('0xf')](_0x9c8b('0xa'),_0x347114,_0x2d1cf4[_0x9c8b('0xf')]['message']);return _0x52f51d(_0x2d1cf4[_0x9c8b('0xf')][_0x9c8b('0x11')]);}else{logger[_0x9c8b('0x9')]('Network,\x20%s,\x20%s',_0x347114,_0x9c8b('0xd'));_0x52f51d(_0x2d1cf4[_0x9c8b('0x12')][_0x9c8b('0x11')]);}})[_0x9c8b('0x13')](function(_0x143e44){logger['error'](_0x9c8b('0xa'),_0x347114,_0x143e44);_0x376369(_0x143e44);});});}function respondWithResult(_0x3f61d4,_0x4fdaa1){_0x4fdaa1=_0x4fdaa1||0xc8;return function(_0x3631be){if(_0x3631be){return _0x3f61d4[_0x9c8b('0x14')](_0x4fdaa1)[_0x9c8b('0x15')](_0x3631be);}};}function respondWithFilteredResult(_0x489b2a,_0x5708a8){return function(_0x32c9f9){if(_0x32c9f9){var _0x1137b0=typeof _0x5708a8[_0x9c8b('0x16')]===_0x9c8b('0x17')&&typeof _0x5708a8[_0x9c8b('0x18')]===_0x9c8b('0x17');var _0x49a36=_0x32c9f9[_0x9c8b('0x19')];var _0x3db9bc=_0x1137b0?0x0:_0x5708a8[_0x9c8b('0x16')];var _0x25026f=_0x1137b0?_0x32c9f9[_0x9c8b('0x19')]:_0x5708a8[_0x9c8b('0x16')]+_0x5708a8['limit'];var _0xdbcaa0;if(_0x25026f>=_0x49a36){_0x25026f=_0x49a36;_0xdbcaa0=0xc8;}else{_0xdbcaa0=0xce;}_0x489b2a[_0x9c8b('0x14')](_0xdbcaa0);return _0x489b2a[_0x9c8b('0x1a')](_0x9c8b('0x1b'),_0x3db9bc+'-'+_0x25026f+'/'+_0x49a36)[_0x9c8b('0x15')](_0x32c9f9);}return null;};}function saveUpdates(_0x50430c){return function(_0x37315f){if(_0x37315f){return _0x37315f[_0x9c8b('0x1c')](_0x50430c)[_0x9c8b('0x1d')](function(_0x3aa883){return _0x3aa883;});}return null;};}function removeEntity(_0x15125f){return function(_0x3d8b14){if(_0x3d8b14){return _0x3d8b14[_0x9c8b('0x1e')]()[_0x9c8b('0x1d')](function(){_0x15125f[_0x9c8b('0x14')](0xcc)[_0x9c8b('0x1f')]();});}};}function handleEntityNotFound(_0x361492){return function(_0x908b6d){if(!_0x908b6d){_0x361492['sendStatus'](0x194);}return _0x908b6d;};}function handleError(_0x1ff94f,_0x5ddb76){_0x5ddb76=_0x5ddb76||0x1f4;return function(_0x38e7f5){logger[_0x9c8b('0xf')](_0x38e7f5[_0x9c8b('0x20')]);if(_0x38e7f5[_0x9c8b('0x21')]){delete _0x38e7f5['name'];}_0x1ff94f['status'](_0x5ddb76)[_0x9c8b('0x22')](_0x38e7f5);};}exports['index']=function(_0x5ec336,_0x170217){var _0x6523dd={},_0x56a7f2={},_0x5adf41={'count':0x0,'rows':[]};var _0x45a947=_[_0x9c8b('0x23')](db[_0x9c8b('0x24')][_0x9c8b('0x25')],function(_0xcdef4c){return{'name':_0xcdef4c[_0x9c8b('0x26')],'type':_0xcdef4c[_0x9c8b('0x27')][_0x9c8b('0x28')]};});_0x56a7f2['model']=_[_0x9c8b('0x23')](_0x45a947,_0x9c8b('0x21'));_0x56a7f2[_0x9c8b('0x29')]=_[_0x9c8b('0x2a')](_0x5ec336[_0x9c8b('0x29')]);_0x56a7f2[_0x9c8b('0x2b')]=_[_0x9c8b('0x2c')](_0x56a7f2[_0x9c8b('0x2d')],_0x56a7f2[_0x9c8b('0x29')]);_0x6523dd[_0x9c8b('0x2e')]=_[_0x9c8b('0x2c')](_0x56a7f2[_0x9c8b('0x2d')],qs[_0x9c8b('0x2f')](_0x5ec336[_0x9c8b('0x29')]['fields']));_0x6523dd['attributes']=_0x6523dd['attributes']['length']?_0x6523dd[_0x9c8b('0x2e')]:_0x56a7f2[_0x9c8b('0x2d')];if(!_0x5ec336[_0x9c8b('0x29')][_0x9c8b('0x30')](_0x9c8b('0x31'))){_0x6523dd[_0x9c8b('0x18')]=qs[_0x9c8b('0x18')](_0x5ec336[_0x9c8b('0x29')]['limit']);_0x6523dd[_0x9c8b('0x16')]=qs[_0x9c8b('0x16')](_0x5ec336[_0x9c8b('0x29')][_0x9c8b('0x16')]);}_0x6523dd[_0x9c8b('0x32')]=qs['sort'](_0x5ec336[_0x9c8b('0x29')][_0x9c8b('0x33')]);_0x6523dd[_0x9c8b('0x34')]=qs['filters'](_[_0x9c8b('0x35')](_0x5ec336['query'],_0x56a7f2[_0x9c8b('0x2b')]),_0x45a947);if(_0x5ec336[_0x9c8b('0x29')][_0x9c8b('0x36')]){_0x6523dd[_0x9c8b('0x34')]=_[_0x9c8b('0x37')](_0x6523dd[_0x9c8b('0x34')],{'$or':_[_0x9c8b('0x23')](_0x45a947,function(_0x75e8f8){if(_0x75e8f8['type']!==_0x9c8b('0x38')){var _0x5ef8ef={};_0x5ef8ef[_0x75e8f8['name']]={'$like':'%'+_0x5ec336[_0x9c8b('0x29')][_0x9c8b('0x36')]+'%'};return _0x5ef8ef;}})});}_0x6523dd=_[_0x9c8b('0x37')]({},_0x6523dd,_0x5ec336[_0x9c8b('0x39')]);var _0x2c6ee8={'where':_0x6523dd[_0x9c8b('0x34')]};return db['Network'][_0x9c8b('0x19')](_0x2c6ee8)['then'](function(_0x16ee4e){_0x5adf41[_0x9c8b('0x19')]=_0x16ee4e;if(_0x5ec336[_0x9c8b('0x29')][_0x9c8b('0x3a')]){_0x6523dd[_0x9c8b('0x3b')]=[{'all':!![]}];}return db[_0x9c8b('0x24')][_0x9c8b('0x3c')](_0x6523dd);})[_0x9c8b('0x1d')](function(_0x17cf87){_0x5adf41[_0x9c8b('0x3d')]=_0x17cf87;return _0x5adf41;})[_0x9c8b('0x1d')](respondWithFilteredResult(_0x170217,_0x6523dd))[_0x9c8b('0x13')](handleError(_0x170217,null));};exports[_0x9c8b('0x3e')]=function(_0x36817c,_0x17df93){var _0x168061={'raw':!![],'where':{'id':_0x36817c['params']['id']}},_0x2efa74={};_0x2efa74[_0x9c8b('0x2d')]=_[_0x9c8b('0x2a')](db[_0x9c8b('0x24')][_0x9c8b('0x25')]);_0x2efa74['query']=_['keys'](_0x36817c['query']);_0x2efa74[_0x9c8b('0x2b')]=_[_0x9c8b('0x2c')](_0x2efa74['model'],_0x2efa74[_0x9c8b('0x29')]);_0x168061['attributes']=_[_0x9c8b('0x2c')](_0x2efa74[_0x9c8b('0x2d')],qs[_0x9c8b('0x2f')](_0x36817c['query'][_0x9c8b('0x2f')]));_0x168061[_0x9c8b('0x2e')]=_0x168061[_0x9c8b('0x2e')]['length']?_0x168061[_0x9c8b('0x2e')]:_0x2efa74['model'];if(_0x36817c['query'][_0x9c8b('0x3a')]){_0x168061['include']=[{'all':!![]}];}_0x168061=_[_0x9c8b('0x37')]({},_0x168061,_0x36817c[_0x9c8b('0x39')]);return db['Network'][_0x9c8b('0x3f')](_0x168061)[_0x9c8b('0x1d')](handleEntityNotFound(_0x17df93,null))[_0x9c8b('0x1d')](respondWithResult(_0x17df93,null))[_0x9c8b('0x13')](handleError(_0x17df93,null));};exports[_0x9c8b('0x40')]=function(_0x4ac6ec,_0x8a18a){var _0x71e959;return db[_0x9c8b('0x24')][_0x9c8b('0x40')](_0x4ac6ec[_0x9c8b('0x41')],{'raw':!![]})[_0x9c8b('0x1d')](function(_0xe64129){_0x71e959=_0xe64129;return db[_0x9c8b('0x24')][_0x9c8b('0x3c')]({'where':{'type':_0x4ac6ec[_0x9c8b('0x41')]['type']},'raw':!![]});})['then'](function(_0xb29cc3){if(_0x71e959[_0x9c8b('0x27')]['toUpperCase']()=='STUN'){var _0x2c9a3a=fs['readFileSync'](path[_0x9c8b('0x42')](config[_0x9c8b('0x43')],'server/files/templates/stun_multiple.ejs'),_0x9c8b('0x44'));var _0x378ebc=ejs['render'](_0x2c9a3a,{'networks':_0xb29cc3||[]});fs[_0x9c8b('0x45')](_0x9c8b('0x46'),_0x378ebc);return respondWithRpcPromise('Reload',_0x9c8b('0x40'),{'module':_0x9c8b('0x47')});}else if(_0x71e959['type']['toUpperCase']()==_0x9c8b('0x48')){var _0x18aeb5=fs['readFileSync'](path[_0x9c8b('0x42')](config[_0x9c8b('0x43')],_0x9c8b('0x49')),_0x9c8b('0x44'));var _0x2937b4=ejs['render'](_0x18aeb5,{'networks':_0xb29cc3||[]});fs[_0x9c8b('0x45')](_0x9c8b('0x4a'),_0x2937b4);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else{var _0x494703=fs['readFileSync'](path[_0x9c8b('0x42')](config[_0x9c8b('0x43')],_0x9c8b('0x4b')),'utf8');var _0x4f3831=ejs['render'](_0x494703,{'networks':_0xb29cc3||[]});fs[_0x9c8b('0x45')](util[_0x9c8b('0x4c')](_0x9c8b('0x4d'),_0x4ac6ec[_0x9c8b('0x41')][_0x9c8b('0x27')]['toLowerCase']()),_0x4f3831);return respondWithRpcPromise('Reload','create',{'module':_0x9c8b('0x4e')});}})[_0x9c8b('0x1d')](function(){return _0x71e959;})[_0x9c8b('0x1d')](respondWithResult(_0x8a18a,0xc9))['catch'](handleError(_0x8a18a,null));};exports[_0x9c8b('0x1c')]=function(_0x26fc66,_0xca3052){var _0x1d9d75;return db[_0x9c8b('0x24')][_0x9c8b('0x3f')]({'where':{'id':_0x26fc66[_0x9c8b('0x4f')]['id']}})[_0x9c8b('0x1d')](handleEntityNotFound(_0xca3052,null))['then'](saveUpdates(_0x26fc66[_0x9c8b('0x41')],null))[_0x9c8b('0x1d')](function(_0x22491f){if(_0x22491f){_0x1d9d75=_0x22491f;return db[_0x9c8b('0x24')][_0x9c8b('0x3c')]({'where':{'type':_0x1d9d75['type']},'raw':!![]});}return null;})[_0x9c8b('0x1d')](function(_0x421850){if(_0x1d9d75['type'][_0x9c8b('0x50')]()==_0x9c8b('0x51')){var _0x55b847=fs['readFileSync'](path[_0x9c8b('0x42')](config[_0x9c8b('0x43')],_0x9c8b('0x52')),'utf8');var _0xc91ac5=ejs[_0x9c8b('0x53')](_0x55b847,{'networks':_0x421850||[]});fs[_0x9c8b('0x45')](_0x9c8b('0x46'),_0xc91ac5);return respondWithRpcPromise(_0x9c8b('0x54'),'update',{'module':_0x9c8b('0x47')});}else if(_0x1d9d75[_0x9c8b('0x27')]['toUpperCase']()==_0x9c8b('0x48')){var _0xbb8a7a=fs[_0x9c8b('0x55')](path[_0x9c8b('0x42')](config[_0x9c8b('0x43')],_0x9c8b('0x49')),_0x9c8b('0x44'));var _0x49d27c=ejs['render'](_0xbb8a7a,{'networks':_0x421850||[]});fs[_0x9c8b('0x45')]('/etc/asterisk/turn_xcally.conf',_0x49d27c);return respondWithRpcPromise(_0x9c8b('0x54'),'update',{'module':_0x9c8b('0x47')});}else{var _0x547880=fs[_0x9c8b('0x55')](path[_0x9c8b('0x42')](config[_0x9c8b('0x43')],_0x9c8b('0x4b')),'utf8');var _0x9b75fa=ejs[_0x9c8b('0x53')](_0x547880,{'networks':_0x421850||[]});fs['writeFileSync'](util[_0x9c8b('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x26fc66[_0x9c8b('0x41')][_0x9c8b('0x27')]['toLowerCase']()),_0x9b75fa);return respondWithRpcPromise(_0x9c8b('0x54'),_0x9c8b('0x1c'),{'module':'chan_sip.so'});}})[_0x9c8b('0x1d')](function(_0x2076d4){if(_0x2076d4){return _0x1d9d75;}return null;})[_0x9c8b('0x1d')](respondWithResult(_0xca3052,null))[_0x9c8b('0x13')](handleError(_0xca3052,null));};exports[_0x9c8b('0x1e')]=function(_0xde0d30,_0x532eff){var _0x39e409;return db[_0x9c8b('0x24')][_0x9c8b('0x3f')]({'where':{'id':_0xde0d30[_0x9c8b('0x4f')]['id']}})[_0x9c8b('0x1d')](function(_0x181252){_0x39e409=_0x181252;return _0x181252;})['then'](handleEntityNotFound(_0x532eff,null))['then'](removeEntity(_0x532eff,null))[_0x9c8b('0x1d')](function(){if(_0x39e409){return db[_0x9c8b('0x24')][_0x9c8b('0x3c')]({'where':{'type':_0x39e409[_0x9c8b('0x27')]},'raw':!![]});}})['then'](function(_0x2055a8){if(_0x39e409[_0x9c8b('0x27')][_0x9c8b('0x50')]()=='STUN'){var _0x75f9a=fs[_0x9c8b('0x55')](path[_0x9c8b('0x42')](config[_0x9c8b('0x43')],_0x9c8b('0x52')),_0x9c8b('0x44'));var _0x4e209b=ejs[_0x9c8b('0x53')](_0x75f9a,{'networks':_0x2055a8||[]});fs[_0x9c8b('0x45')](_0x9c8b('0x46'),_0x4e209b);return respondWithRpcPromise(_0x9c8b('0x54'),_0x9c8b('0x1e'),{'module':_0x9c8b('0x47')});}else if(_0x39e409[_0x9c8b('0x27')][_0x9c8b('0x50')]()=='TURN'){var _0xafab2f=fs[_0x9c8b('0x55')](path[_0x9c8b('0x42')](config[_0x9c8b('0x43')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x2b6352=ejs[_0x9c8b('0x53')](_0xafab2f,{'networks':_0x2055a8||[]});fs[_0x9c8b('0x45')](_0x9c8b('0x4a'),_0x2b6352);return respondWithRpcPromise(_0x9c8b('0x54'),_0x9c8b('0x1e'),{'module':_0x9c8b('0x47')});}else{var _0x32a411=fs[_0x9c8b('0x55')](path['join'](config['root'],_0x9c8b('0x4b')),_0x9c8b('0x44'));var _0x30220f=ejs[_0x9c8b('0x53')](_0x32a411,{'networks':_0x2055a8||[]});fs['writeFileSync'](util[_0x9c8b('0x4c')](_0x9c8b('0x4d'),_0x39e409[_0x9c8b('0x27')]['toLowerCase']()),_0x30220f);return respondWithRpcPromise('Reload',_0x9c8b('0x1e'),{'module':'chan_sip.so'});}})[_0x9c8b('0x13')](handleError(_0x532eff,null));}; \ No newline at end of file +var _0xdb48=['offset','undefined','count','set','Content-Range','update','destroy','end','sendStatus','index','map','rawAttributes','type','key','name','query','keys','filters','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','Network','findAll','rows','params','intersection','includeAll','include','find','create','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','join','server/files/templates/turn_multiple.ejs','utf8','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','res_stun_monitor.so','chan_sip.so','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','path','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status'];(function(_0x4e38b1,_0x309a5e){var _0x2c4e59=function(_0x457561){while(--_0x457561){_0x4e38b1['push'](_0x4e38b1['shift']());}};_0x2c4e59(++_0x309a5e);}(_0xdb48,0x130));var _0x8db4=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xdb48[_0xbe200f];return _0x192597;};'use strict';var util=require('util');var path=require(_0x8db4('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0x8db4('0x1'));var logger=require(_0x8db4('0x2'))('api');var config=require(_0x8db4('0x3'));var db=require(_0x8db4('0x4'))['db'];var jayson=require(_0x8db4('0x5'));var client=jayson[_0x8db4('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cb3c9,_0x334152,_0x503817,_0x950768){return new Promise(function(_0x1ea0ce,_0x239e2e){var _0x515c3f=_0x950768||client;return _0x515c3f[_0x8db4('0x7')](_0x3cb3c9,_0x503817)[_0x8db4('0x8')](function(_0x55416b){logger[_0x8db4('0x9')](_0x8db4('0xa'),_0x334152,_0x8db4('0xb'));logger[_0x8db4('0xc')](_0x8db4('0xd'),_0x334152,_0x8db4('0xb'),JSON[_0x8db4('0xe')](_0x55416b));if(_0x55416b['error']){if(_0x55416b[_0x8db4('0xf')][_0x8db4('0x10')]===0x1f4){logger[_0x8db4('0xf')](_0x8db4('0xa'),_0x334152,_0x55416b[_0x8db4('0xf')][_0x8db4('0x11')]);return _0x239e2e(_0x55416b[_0x8db4('0xf')]['message']);}logger[_0x8db4('0xf')](_0x8db4('0xa'),_0x334152,_0x55416b['error']['message']);return _0x1ea0ce(_0x55416b['error'][_0x8db4('0x11')]);}else{logger[_0x8db4('0x9')]('Network,\x20%s,\x20%s',_0x334152,_0x8db4('0xb'));_0x1ea0ce(_0x55416b['result'][_0x8db4('0x11')]);}})[_0x8db4('0x12')](function(_0x58548a){logger[_0x8db4('0xf')]('Network,\x20%s,\x20%s',_0x334152,_0x58548a);_0x239e2e(_0x58548a);});});}function respondWithResult(_0x2e5eaa,_0x343ecc){_0x343ecc=_0x343ecc||0xc8;return function(_0x25da1d){if(_0x25da1d){return _0x2e5eaa[_0x8db4('0x13')](_0x343ecc)['json'](_0x25da1d);}};}function respondWithFilteredResult(_0x4c2386,_0x4d5372){return function(_0x54421e){if(_0x54421e){var _0x348ee9=typeof _0x4d5372[_0x8db4('0x14')]===_0x8db4('0x15')&&typeof _0x4d5372['limit']===_0x8db4('0x15');var _0x562a7b=_0x54421e[_0x8db4('0x16')];var _0x3dc5cb=_0x348ee9?0x0:_0x4d5372[_0x8db4('0x14')];var _0x38cb87=_0x348ee9?_0x54421e['count']:_0x4d5372['offset']+_0x4d5372['limit'];var _0x5a058f;if(_0x38cb87>=_0x562a7b){_0x38cb87=_0x562a7b;_0x5a058f=0xc8;}else{_0x5a058f=0xce;}_0x4c2386[_0x8db4('0x13')](_0x5a058f);return _0x4c2386[_0x8db4('0x17')](_0x8db4('0x18'),_0x3dc5cb+'-'+_0x38cb87+'/'+_0x562a7b)['json'](_0x54421e);}return null;};}function saveUpdates(_0x1eb63f){return function(_0x3f6c8e){if(_0x3f6c8e){return _0x3f6c8e[_0x8db4('0x19')](_0x1eb63f)[_0x8db4('0x8')](function(_0x597e94){return _0x597e94;});}return null;};}function removeEntity(_0xbac9e0){return function(_0x31b809){if(_0x31b809){return _0x31b809[_0x8db4('0x1a')]()['then'](function(){_0xbac9e0[_0x8db4('0x13')](0xcc)[_0x8db4('0x1b')]();});}};}function handleEntityNotFound(_0x1de247){return function(_0xded735){if(!_0xded735){_0x1de247[_0x8db4('0x1c')](0x194);}return _0xded735;};}function handleError(_0x3ed75c,_0x330d2b){_0x330d2b=_0x330d2b||0x1f4;return function(_0x24abca){logger['error'](_0x24abca['stack']);if(_0x24abca['name']){delete _0x24abca['name'];}_0x3ed75c['status'](_0x330d2b)['send'](_0x24abca);};}exports[_0x8db4('0x1d')]=function(_0x9fb109,_0x223f93){var _0x3c2e25={},_0x17d21b={},_0x5e0509={'count':0x0,'rows':[]};var _0x518ce9=_[_0x8db4('0x1e')](db['Network'][_0x8db4('0x1f')],function(_0x1bb53a){return{'name':_0x1bb53a['fieldName'],'type':_0x1bb53a[_0x8db4('0x20')][_0x8db4('0x21')]};});_0x17d21b['model']=_['map'](_0x518ce9,_0x8db4('0x22'));_0x17d21b[_0x8db4('0x23')]=_[_0x8db4('0x24')](_0x9fb109[_0x8db4('0x23')]);_0x17d21b[_0x8db4('0x25')]=_['intersection'](_0x17d21b[_0x8db4('0x26')],_0x17d21b['query']);_0x3c2e25[_0x8db4('0x27')]=_['intersection'](_0x17d21b[_0x8db4('0x26')],qs[_0x8db4('0x28')](_0x9fb109[_0x8db4('0x23')][_0x8db4('0x28')]));_0x3c2e25[_0x8db4('0x27')]=_0x3c2e25[_0x8db4('0x27')][_0x8db4('0x29')]?_0x3c2e25[_0x8db4('0x27')]:_0x17d21b[_0x8db4('0x26')];if(!_0x9fb109[_0x8db4('0x23')]['hasOwnProperty'](_0x8db4('0x2a'))){_0x3c2e25['limit']=qs[_0x8db4('0x2b')](_0x9fb109[_0x8db4('0x23')][_0x8db4('0x2b')]);_0x3c2e25[_0x8db4('0x14')]=qs[_0x8db4('0x14')](_0x9fb109['query'][_0x8db4('0x14')]);}_0x3c2e25[_0x8db4('0x2c')]=qs[_0x8db4('0x2d')](_0x9fb109['query']['sort']);_0x3c2e25[_0x8db4('0x2e')]=qs[_0x8db4('0x25')](_[_0x8db4('0x2f')](_0x9fb109[_0x8db4('0x23')],_0x17d21b['filters']),_0x518ce9);if(_0x9fb109['query'][_0x8db4('0x30')]){_0x3c2e25[_0x8db4('0x2e')]=_[_0x8db4('0x31')](_0x3c2e25[_0x8db4('0x2e')],{'$or':_[_0x8db4('0x1e')](_0x518ce9,function(_0x392327){if(_0x392327['type']!==_0x8db4('0x32')){var _0x411119={};_0x411119[_0x392327['name']]={'$like':'%'+_0x9fb109['query'][_0x8db4('0x30')]+'%'};return _0x411119;}})});}_0x3c2e25=_['merge']({},_0x3c2e25,_0x9fb109['options']);var _0x11b848={'where':_0x3c2e25[_0x8db4('0x2e')]};return db[_0x8db4('0x33')][_0x8db4('0x16')](_0x11b848)[_0x8db4('0x8')](function(_0x5bfb0c){_0x5e0509[_0x8db4('0x16')]=_0x5bfb0c;if(_0x9fb109[_0x8db4('0x23')]['includeAll']){_0x3c2e25['include']=[{'all':!![]}];}return db['Network'][_0x8db4('0x34')](_0x3c2e25);})['then'](function(_0x238130){_0x5e0509[_0x8db4('0x35')]=_0x238130;return _0x5e0509;})['then'](respondWithFilteredResult(_0x223f93,_0x3c2e25))[_0x8db4('0x12')](handleError(_0x223f93,null));};exports['show']=function(_0x2818de,_0x1fbe3b){var _0x5ad927={'raw':!![],'where':{'id':_0x2818de[_0x8db4('0x36')]['id']}},_0x34e712={};_0x34e712[_0x8db4('0x26')]=_[_0x8db4('0x24')](db[_0x8db4('0x33')][_0x8db4('0x1f')]);_0x34e712[_0x8db4('0x23')]=_[_0x8db4('0x24')](_0x2818de[_0x8db4('0x23')]);_0x34e712['filters']=_[_0x8db4('0x37')](_0x34e712[_0x8db4('0x26')],_0x34e712[_0x8db4('0x23')]);_0x5ad927[_0x8db4('0x27')]=_['intersection'](_0x34e712[_0x8db4('0x26')],qs['fields'](_0x2818de[_0x8db4('0x23')][_0x8db4('0x28')]));_0x5ad927[_0x8db4('0x27')]=_0x5ad927[_0x8db4('0x27')]['length']?_0x5ad927['attributes']:_0x34e712[_0x8db4('0x26')];if(_0x2818de['query'][_0x8db4('0x38')]){_0x5ad927[_0x8db4('0x39')]=[{'all':!![]}];}_0x5ad927=_[_0x8db4('0x31')]({},_0x5ad927,_0x2818de['options']);return db[_0x8db4('0x33')][_0x8db4('0x3a')](_0x5ad927)[_0x8db4('0x8')](handleEntityNotFound(_0x1fbe3b,null))[_0x8db4('0x8')](respondWithResult(_0x1fbe3b,null))[_0x8db4('0x12')](handleError(_0x1fbe3b,null));};exports[_0x8db4('0x3b')]=function(_0x25fc32,_0x50aa80){var _0x1656c5;return db[_0x8db4('0x33')][_0x8db4('0x3b')](_0x25fc32[_0x8db4('0x3c')],{'raw':!![]})[_0x8db4('0x8')](function(_0x531cc1){_0x1656c5=_0x531cc1;return db['Network'][_0x8db4('0x34')]({'where':{'type':_0x25fc32['body'][_0x8db4('0x20')]},'raw':!![]});})[_0x8db4('0x8')](function(_0x3150b7){if(_0x1656c5[_0x8db4('0x20')][_0x8db4('0x3d')]()==_0x8db4('0x3e')){var _0x2bd883=fs[_0x8db4('0x3f')](path['join'](config[_0x8db4('0x40')],_0x8db4('0x41')),'utf8');var _0x34b440=ejs[_0x8db4('0x42')](_0x2bd883,{'networks':_0x3150b7||[]});fs[_0x8db4('0x43')](_0x8db4('0x44'),_0x34b440);return respondWithRpcPromise(_0x8db4('0x45'),_0x8db4('0x3b'),{'module':'res_stun_monitor.so'});}else if(_0x1656c5[_0x8db4('0x20')][_0x8db4('0x3d')]()==_0x8db4('0x46')){var _0x3f403b=fs[_0x8db4('0x3f')](path[_0x8db4('0x47')](config[_0x8db4('0x40')],_0x8db4('0x48')),_0x8db4('0x49'));var _0x4e972c=ejs[_0x8db4('0x42')](_0x3f403b,{'networks':_0x3150b7||[]});fs[_0x8db4('0x43')]('/etc/asterisk/turn_xcally.conf',_0x4e972c);return respondWithRpcPromise(_0x8db4('0x45'),_0x8db4('0x3b'),{'module':'res_stun_monitor.so'});}else{var _0x5b05ef=fs[_0x8db4('0x3f')](path['join'](config[_0x8db4('0x40')],'server/files/templates/network.ejs'),_0x8db4('0x49'));var _0x13e40c=ejs[_0x8db4('0x42')](_0x5b05ef,{'networks':_0x3150b7||[]});fs[_0x8db4('0x43')](util[_0x8db4('0x4a')](_0x8db4('0x4b'),_0x25fc32[_0x8db4('0x3c')][_0x8db4('0x20')][_0x8db4('0x4c')]()),_0x13e40c);return respondWithRpcPromise('Reload',_0x8db4('0x3b'),{'module':'chan_sip.so'});}})['then'](function(){return _0x1656c5;})[_0x8db4('0x8')](respondWithResult(_0x50aa80,0xc9))[_0x8db4('0x12')](handleError(_0x50aa80,null));};exports[_0x8db4('0x19')]=function(_0x3090c3,_0xa846f6){var _0x198752;return db[_0x8db4('0x33')]['find']({'where':{'id':_0x3090c3[_0x8db4('0x36')]['id']}})[_0x8db4('0x8')](handleEntityNotFound(_0xa846f6,null))[_0x8db4('0x8')](saveUpdates(_0x3090c3[_0x8db4('0x3c')],null))[_0x8db4('0x8')](function(_0x51a880){if(_0x51a880){_0x198752=_0x51a880;return db[_0x8db4('0x33')][_0x8db4('0x34')]({'where':{'type':_0x198752[_0x8db4('0x20')]},'raw':!![]});}return null;})['then'](function(_0x440860){if(_0x198752[_0x8db4('0x20')][_0x8db4('0x3d')]()==_0x8db4('0x3e')){var _0x59350f=fs[_0x8db4('0x3f')](path['join'](config[_0x8db4('0x40')],_0x8db4('0x41')),_0x8db4('0x49'));var _0x494652=ejs[_0x8db4('0x42')](_0x59350f,{'networks':_0x440860||[]});fs[_0x8db4('0x43')](_0x8db4('0x44'),_0x494652);return respondWithRpcPromise(_0x8db4('0x45'),_0x8db4('0x19'),{'module':_0x8db4('0x4d')});}else if(_0x198752[_0x8db4('0x20')][_0x8db4('0x3d')]()=='TURN'){var _0x346a94=fs['readFileSync'](path[_0x8db4('0x47')](config[_0x8db4('0x40')],'server/files/templates/turn_multiple.ejs'),_0x8db4('0x49'));var _0x53d682=ejs['render'](_0x346a94,{'networks':_0x440860||[]});fs[_0x8db4('0x43')]('/etc/asterisk/turn_xcally.conf',_0x53d682);return respondWithRpcPromise(_0x8db4('0x45'),_0x8db4('0x19'),{'module':_0x8db4('0x4d')});}else{var _0x2d1aca=fs[_0x8db4('0x3f')](path[_0x8db4('0x47')](config[_0x8db4('0x40')],'server/files/templates/network.ejs'),'utf8');var _0x572fad=ejs['render'](_0x2d1aca,{'networks':_0x440860||[]});fs[_0x8db4('0x43')](util[_0x8db4('0x4a')](_0x8db4('0x4b'),_0x3090c3[_0x8db4('0x3c')]['type'][_0x8db4('0x4c')]()),_0x572fad);return respondWithRpcPromise('Reload','update',{'module':_0x8db4('0x4e')});}})[_0x8db4('0x8')](function(_0x47a6a5){if(_0x47a6a5){return _0x198752;}return null;})[_0x8db4('0x8')](respondWithResult(_0xa846f6,null))['catch'](handleError(_0xa846f6,null));};exports[_0x8db4('0x1a')]=function(_0x459954,_0x4ba07e){var _0x2c148f;return db[_0x8db4('0x33')]['find']({'where':{'id':_0x459954[_0x8db4('0x36')]['id']}})[_0x8db4('0x8')](function(_0x5641b8){_0x2c148f=_0x5641b8;return _0x5641b8;})[_0x8db4('0x8')](handleEntityNotFound(_0x4ba07e,null))[_0x8db4('0x8')](removeEntity(_0x4ba07e,null))[_0x8db4('0x8')](function(){if(_0x2c148f){return db[_0x8db4('0x33')]['findAll']({'where':{'type':_0x2c148f[_0x8db4('0x20')]},'raw':!![]});}})['then'](function(_0x2730db){if(_0x2c148f[_0x8db4('0x20')]['toUpperCase']()==_0x8db4('0x3e')){var _0x42a01f=fs['readFileSync'](path[_0x8db4('0x47')](config[_0x8db4('0x40')],_0x8db4('0x41')),_0x8db4('0x49'));var _0x5d86f1=ejs[_0x8db4('0x42')](_0x42a01f,{'networks':_0x2730db||[]});fs[_0x8db4('0x43')](_0x8db4('0x44'),_0x5d86f1);return respondWithRpcPromise(_0x8db4('0x45'),_0x8db4('0x1a'),{'module':_0x8db4('0x4d')});}else if(_0x2c148f[_0x8db4('0x20')]['toUpperCase']()==_0x8db4('0x46')){var _0x22012a=fs[_0x8db4('0x3f')](path[_0x8db4('0x47')](config[_0x8db4('0x40')],'server/files/templates/turn_multiple.ejs'),_0x8db4('0x49'));var _0x2b5211=ejs[_0x8db4('0x42')](_0x22012a,{'networks':_0x2730db||[]});fs['writeFileSync'](_0x8db4('0x4f'),_0x2b5211);return respondWithRpcPromise(_0x8db4('0x45'),'destroy',{'module':_0x8db4('0x4d')});}else{var _0x37a452=fs[_0x8db4('0x3f')](path[_0x8db4('0x47')](config[_0x8db4('0x40')],_0x8db4('0x50')),_0x8db4('0x49'));var _0x48eb93=ejs[_0x8db4('0x42')](_0x37a452,{'networks':_0x2730db||[]});fs[_0x8db4('0x43')](util[_0x8db4('0x4a')](_0x8db4('0x4b'),_0x2c148f[_0x8db4('0x20')][_0x8db4('0x4c')]()),_0x48eb93);return respondWithRpcPromise(_0x8db4('0x45'),_0x8db4('0x1a'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x4ba07e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 3fd165c..e7ca49c 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 _0x1ba2=['./network.attributes','exports','Network','network','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x29e3f9,_0x54ade1){var _0x9a97b5=function(_0x33c33b){while(--_0x33c33b){_0x29e3f9['push'](_0x29e3f9['shift']());}};_0x9a97b5(++_0x54ade1);}(_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 logger=require(_0x21ba('0x1'))('api');var moment=require(_0x21ba('0x2'));var BPromise=require(_0x21ba('0x3'));var rp=require(_0x21ba('0x4'));var fs=require('fs');var path=require(_0x21ba('0x5'));var rimraf=require(_0x21ba('0x6'));var config=require('../../config/environment');var attributes=require(_0x21ba('0x7'));module[_0x21ba('0x8')]=function(_0x4a07e8,_0x10dae1){return _0x4a07e8['define'](_0x21ba('0x9'),attributes,{'tableName':_0x21ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2750=['rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x417c9c,_0x312b94){var _0x371627=function(_0x3e7bb6){while(--_0x3e7bb6){_0x417c9c['push'](_0x417c9c['shift']());}};_0x371627(++_0x312b94);}(_0x2750,0x13b));var _0x0275=function(_0x2132fb,_0x3cc3a0){_0x2132fb=_0x2132fb-0x0;var _0x4f42b5=_0x2750[_0x2132fb];return _0x4f42b5;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'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 76d260a..5e27c97 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x3022fc,_0x3eb998){_0x3022fc=_0x3022fc-0x0;var _0xfa2bb3=_0x7a54[_0x3022fc];return _0xfa2bb3;};'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(_0x290241,_0x88c443){var _0x42a315=function(_0x67427e){while(--_0x67427e){_0x290241['push'](_0x290241['shift']());}};_0x42a315(++_0x88c443);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 1610edb..70ae5de 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 _0x8759=['addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelAccount.controller','get','/describe','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create'];(function(_0x346149,_0x2bb5e7){var _0x4184d2=function(_0xb5a185){while(--_0xb5a185){_0x346149['push'](_0x346149['shift']());}};_0x4184d2(++_0x2bb5e7);}(_0x8759,0xc6));var _0x9875=function(_0xf048ea,_0x1ebcb3){_0xf048ea=_0xf048ea-0x0;var _0xfda7a1=_0x8759[_0xf048ea];return _0xfda7a1;};'use strict';var multer=require(_0x9875('0x0'));var util=require(_0x9875('0x1'));var path=require(_0x9875('0x2'));var timeout=require(_0x9875('0x3'));var express=require(_0x9875('0x4'));var router=express[_0x9875('0x5')]();var fs_extra=require(_0x9875('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9875('0x7'));var controller=require(_0x9875('0x8'));router[_0x9875('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9875('0x9')](_0x9875('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x9875('0x9')]('/:id',auth[_0x9875('0xb')](),controller['show']);router[_0x9875('0x9')](_0x9875('0xc'),auth[_0x9875('0xb')](),controller[_0x9875('0xd')]);router[_0x9875('0x9')](_0x9875('0xe'),auth[_0x9875('0xb')](),controller[_0x9875('0xf')]);router[_0x9875('0x9')](_0x9875('0x10'),auth[_0x9875('0xb')](),controller[_0x9875('0x11')]);router['get'](_0x9875('0x12'),auth[_0x9875('0xb')](),controller[_0x9875('0x13')]);router[_0x9875('0x9')](_0x9875('0x14'),auth[_0x9875('0xb')](),controller[_0x9875('0x15')]);router[_0x9875('0x16')]('/',auth[_0x9875('0xb')](),controller[_0x9875('0x17')]);router[_0x9875('0x16')]('/:id/dispositions',auth[_0x9875('0xb')](),controller[_0x9875('0x18')]);router[_0x9875('0x16')](_0x9875('0xe'),auth[_0x9875('0xb')](),controller['addAnswer']);router['post'](_0x9875('0x19'),controller[_0x9875('0x1a')]);router[_0x9875('0x16')](_0x9875('0x10'),auth['isAuthenticated'](),controller[_0x9875('0x1b')]);router[_0x9875('0x16')](_0x9875('0x14'),auth[_0x9875('0xb')](),controller[_0x9875('0x1c')]);router[_0x9875('0x16')](_0x9875('0x1d'),auth[_0x9875('0xb')](),controller['send']);router[_0x9875('0x1e')]('/:id',auth[_0x9875('0xb')](),controller[_0x9875('0x1f')]);router[_0x9875('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x9875('0x21')]);router[_0x9875('0x20')](_0x9875('0xc'),auth['isAuthenticated'](),controller[_0x9875('0x22')]);router[_0x9875('0x20')](_0x9875('0xe'),auth['isAuthenticated'](),controller[_0x9875('0x23')]);router[_0x9875('0x20')](_0x9875('0x14'),auth[_0x9875('0xb')](),controller[_0x9875('0x24')]);module['exports']=router; \ No newline at end of file +var _0x6c40=['post','create','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','send','put','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents'];(function(_0x5977e3,_0xd2684a){var _0x49f7d7=function(_0x3b64a3){while(--_0x3b64a3){_0x5977e3['push'](_0x5977e3['shift']());}};_0x49f7d7(++_0xd2684a);}(_0x6c40,0xd2));var _0x06c4=function(_0x1f1879,_0x387608){_0x1f1879=_0x1f1879-0x0;var _0x11c63b=_0x6c40[_0x1f1879];return _0x11c63b;};'use strict';var multer=require(_0x06c4('0x0'));var util=require('util');var path=require(_0x06c4('0x1'));var timeout=require(_0x06c4('0x2'));var express=require(_0x06c4('0x3'));var router=express[_0x06c4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x06c4('0x5'));var interaction=require(_0x06c4('0x6'));var config=require(_0x06c4('0x7'));var controller=require(_0x06c4('0x8'));router[_0x06c4('0x9')]('/',auth[_0x06c4('0xa')](),controller[_0x06c4('0xb')]);router[_0x06c4('0x9')](_0x06c4('0xc'),auth[_0x06c4('0xa')](),controller['describe']);router['get'](_0x06c4('0xd'),auth['isAuthenticated'](),controller[_0x06c4('0xe')]);router[_0x06c4('0x9')](_0x06c4('0xf'),auth[_0x06c4('0xa')](),controller[_0x06c4('0x10')]);router[_0x06c4('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x06c4('0x11')]);router['get'](_0x06c4('0x12'),auth[_0x06c4('0xa')](),controller[_0x06c4('0x13')]);router[_0x06c4('0x9')](_0x06c4('0x14'),auth[_0x06c4('0xa')](),controller[_0x06c4('0x15')]);router[_0x06c4('0x9')](_0x06c4('0x16'),auth[_0x06c4('0xa')](),controller[_0x06c4('0x17')]);router[_0x06c4('0x18')]('/',auth[_0x06c4('0xa')](),controller[_0x06c4('0x19')]);router['post'](_0x06c4('0xf'),auth[_0x06c4('0xa')](),controller['addDisposition']);router[_0x06c4('0x18')](_0x06c4('0x1a'),auth[_0x06c4('0xa')](),controller[_0x06c4('0x1b')]);router[_0x06c4('0x18')](_0x06c4('0x1c'),controller[_0x06c4('0x1d')]);router[_0x06c4('0x18')](_0x06c4('0x12'),auth['isAuthenticated'](),controller[_0x06c4('0x1e')]);router['post'](_0x06c4('0x16'),auth[_0x06c4('0xa')](),controller[_0x06c4('0x1f')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x06c4('0x20')]);router[_0x06c4('0x21')]('/:id',auth[_0x06c4('0xa')](),controller['update']);router[_0x06c4('0x22')](_0x06c4('0xd'),auth[_0x06c4('0xa')](),controller[_0x06c4('0x23')]);router[_0x06c4('0x22')](_0x06c4('0xf'),auth[_0x06c4('0xa')](),controller[_0x06c4('0x24')]);router[_0x06c4('0x22')]('/:id/canned_answers',auth[_0x06c4('0xa')](),controller['removeAnswers']);router[_0x06c4('0x22')](_0x06c4('0x16'),auth[_0x06c4('0xa')](),controller[_0x06c4('0x25')]);module[_0x06c4('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index f83e86d..bd5a01c 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 _0x7daf=['generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0xf576,_0x34355c){var _0x196daf=function(_0xd22dca){while(--_0xd22dca){_0xf576['push'](_0xf576['shift']());}};_0x196daf(++_0x34355c);}(_0x7daf,0x105));var _0xf7da=function(_0x13ce6d,_0x5984bf){_0x13ce6d=_0x13ce6d-0x0;var _0x397a06=_0x7daf[_0x13ce6d];return _0x397a06;};'use strict';var Sequelize=require(_0xf7da('0x0'));var rs=require(_0xf7da('0x1'));module[_0xf7da('0x2')]={'name':{'type':Sequelize[_0xf7da('0x3')],'unique':_0xf7da('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf7da('0x3')],'defaultValue':function(){return rs[_0xf7da('0x5')]();}},'replyUri':{'type':Sequelize[_0xf7da('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf7da('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf7da('0x6');}},'notificationSound':{'type':Sequelize[_0xf7da('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf7da('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf7da('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf7da('0x3')]},'queueTransfer':{'type':Sequelize[_0xf7da('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf7da('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xf7da('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf7da('0xa'),'set':function(_0x4cc53b){if(!_0x4cc53b)this[_0xf7da('0xb')](_0xf7da('0xc'),null);this['setDataValue'](_0xf7da('0xd'),_0x4cc53b);}}}; \ No newline at end of file +var _0x67f7=['STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x83476c,_0x1b9950){var _0x4d2bde=function(_0x259f69){while(--_0x259f69){_0x83476c['push'](_0x83476c['shift']());}};_0x4d2bde(++_0x1b9950);}(_0x67f7,0x177));var _0x767f=function(_0x72e2,_0x4be7bc){_0x72e2=_0x72e2-0x0;var _0xd25d4d=_0x67f7[_0x72e2];return _0xd25d4d;};'use strict';var Sequelize=require(_0x767f('0x0'));var rs=require(_0x767f('0x1'));module[_0x767f('0x2')]={'name':{'type':Sequelize[_0x767f('0x3')],'unique':_0x767f('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x767f('0x3')]},'token':{'type':Sequelize[_0x767f('0x3')],'defaultValue':function(){return rs[_0x767f('0x5')]();}},'replyUri':{'type':Sequelize[_0x767f('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x767f('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x767f('0x6')],'defaultValue':function(){return _0x767f('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x767f('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x767f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x767f('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x767f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x767f('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x767f('0x8')],'defaultValue':![],'comment':_0x767f('0xa'),'set':function(_0x287fbe){if(!_0x287fbe)this[_0x767f('0xb')](_0x767f('0xc'),null);this['setDataValue'](_0x767f('0xd'),_0x287fbe);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 9013249..d380835 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 _0xad53=['createdAt','updatedAt','difference','Sequelize','from\x20is\x20mandatory','isNil','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','from','CmList','List','DESC','OpenchannelApplication','Applications','list','orderBy','priority','asc','account','Contacts','defaults','ListId','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','push','applications','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','http','client','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','get','OpenchannelAccounts','UserProfileResource','destroy','end','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','intersection','includeAll','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','sort','options','include','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes'];(function(_0x45c61e,_0x59694d){var _0x19033c=function(_0x19fc2b){while(--_0x19fc2b){_0x45c61e['push'](_0x45c61e['shift']());}};_0x19033c(++_0x59694d);}(_0xad53,0x1ea));var _0x3ad5=function(_0x525634,_0xa0c55f){_0x525634=_0x525634-0x0;var _0x105f56=_0xad53[_0x525634];return _0x105f56;};'use strict';var emlformat=require(_0x3ad5('0x0'));var rimraf=require(_0x3ad5('0x1'));var zipdir=require(_0x3ad5('0x2'));var jsonpatch=require(_0x3ad5('0x3'));var rp=require(_0x3ad5('0x4'));var moment=require(_0x3ad5('0x5'));var BPromise=require(_0x3ad5('0x6'));var Mustache=require(_0x3ad5('0x7'));var util=require('util');var path=require(_0x3ad5('0x8'));var sox=require(_0x3ad5('0x9'));var csv=require(_0x3ad5('0xa'));var ejs=require(_0x3ad5('0xb'));var fs=require('fs');var fs_extra=require(_0x3ad5('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ad5('0xd'));var deskjs=require(_0x3ad5('0xe'));var toCsv=require(_0x3ad5('0xa'));var querystring=require(_0x3ad5('0xf'));var Papa=require(_0x3ad5('0x10'));var Redis=require(_0x3ad5('0x11'));var authService=require(_0x3ad5('0x12'));var qs=require(_0x3ad5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ad5('0x14'));var logger=require(_0x3ad5('0x15'))(_0x3ad5('0x16'));var utils=require(_0x3ad5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3ad5('0x18'));var db=require(_0x3ad5('0x19'))['db'];config[_0x3ad5('0x1a')]=_['defaults'](config[_0x3ad5('0x1a')],{'host':_0x3ad5('0x1b'),'port':0x18eb});var socket=require(_0x3ad5('0x1c'))(new Redis(config[_0x3ad5('0x1a')]));require(_0x3ad5('0x1d'))[_0x3ad5('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x3ad5('0x1f')]({'port':0x232c});var client9002=jayson[_0x3ad5('0x20')][_0x3ad5('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x70aec9,_0x1d5868,_0x365f38,_0x533ea1){return new BPromise(function(_0x56123a,_0x25be72){var _0x421d09=_0x533ea1||client;return _0x421d09['request'](_0x70aec9,_0x365f38)['then'](function(_0x445741){logger[_0x3ad5('0x21')](_0x3ad5('0x22'),_0x1d5868,_0x3ad5('0x23'));logger['debug'](_0x3ad5('0x24'),_0x1d5868,_0x3ad5('0x23'),JSON[_0x3ad5('0x25')](_0x445741));if(_0x445741[_0x3ad5('0x26')]){if(_0x445741[_0x3ad5('0x26')][_0x3ad5('0x27')]===0x1f4){logger[_0x3ad5('0x26')](_0x3ad5('0x22'),_0x1d5868,_0x445741[_0x3ad5('0x26')]['message']);return _0x25be72(_0x445741[_0x3ad5('0x26')]['message']);}logger[_0x3ad5('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x1d5868,_0x445741[_0x3ad5('0x26')][_0x3ad5('0x28')]);return _0x56123a(_0x445741[_0x3ad5('0x26')][_0x3ad5('0x28')]);}else{logger[_0x3ad5('0x21')](_0x3ad5('0x22'),_0x1d5868,'request\x20sent');_0x56123a(_0x445741[_0x3ad5('0x29')][_0x3ad5('0x28')]);}})['catch'](function(_0xaa80a){logger[_0x3ad5('0x26')](_0x3ad5('0x22'),_0x1d5868,_0xaa80a);_0x25be72(_0xaa80a);});});}function respondWithStatusCode(_0x494adf,_0x8ef5c){_0x8ef5c=_0x8ef5c||0xcc;return function(_0x429ea6){if(_0x429ea6){return _0x494adf[_0x3ad5('0x2a')](_0x8ef5c);}return _0x494adf['status'](_0x8ef5c)['end']();};}function respondWithResult(_0x578463,_0x33c53e){_0x33c53e=_0x33c53e||0xc8;return function(_0x4674f2){if(_0x4674f2){return _0x578463[_0x3ad5('0x2b')](_0x33c53e)['json'](_0x4674f2);}};}function respondWithFilteredResult(_0x1aa234,_0x1724fc){return function(_0x489de6){if(_0x489de6){var _0x4c66f7=typeof _0x1724fc[_0x3ad5('0x2c')]==='undefined'&&typeof _0x1724fc[_0x3ad5('0x2d')]===_0x3ad5('0x2e');var _0x3a0add=_0x489de6[_0x3ad5('0x2f')];var _0x1fb6f3=_0x4c66f7?0x0:_0x1724fc['offset'];var _0x5f53c9=_0x4c66f7?_0x489de6[_0x3ad5('0x2f')]:_0x1724fc[_0x3ad5('0x2c')]+_0x1724fc[_0x3ad5('0x2d')];var _0x2fdc65;if(_0x5f53c9>=_0x3a0add){_0x5f53c9=_0x3a0add;_0x2fdc65=0xc8;}else{_0x2fdc65=0xce;}_0x1aa234['status'](_0x2fdc65);return _0x1aa234[_0x3ad5('0x30')](_0x3ad5('0x31'),_0x1fb6f3+'-'+_0x5f53c9+'/'+_0x3a0add)[_0x3ad5('0x32')](_0x489de6);}return null;};}function patchUpdates(_0xcdced9){return function(_0x2df2f6){try{jsonpatch[_0x3ad5('0x33')](_0x2df2f6,_0xcdced9,!![]);}catch(_0x46379a){return BPromise[_0x3ad5('0x34')](_0x46379a);}return _0x2df2f6[_0x3ad5('0x35')]();};}function saveUpdates(_0x437bef,_0x53a00c){return function(_0xb356e8){if(_0xb356e8){return _0xb356e8[_0x3ad5('0x36')](_0x437bef)[_0x3ad5('0x37')](function(_0x38c1f3){return _0x38c1f3;});}return null;};}function removeEntity(_0xf7ae57,_0x41240f){return function(_0x396cdd){if(_0x396cdd){return _0x396cdd['destroy']()['then'](function(){var _0x3ca0a=_0x396cdd[_0x3ad5('0x38')]({'plain':!![]});var _0x5bdcee=_0x3ad5('0x39');return db[_0x3ad5('0x3a')][_0x3ad5('0x3b')]({'where':{'type':_0x5bdcee,'resourceId':_0x3ca0a['id']}})[_0x3ad5('0x37')](function(){return _0x396cdd;});})[_0x3ad5('0x37')](function(){_0xf7ae57[_0x3ad5('0x2b')](0xcc)[_0x3ad5('0x3c')]();});}};}function handleEntityNotFound(_0x2f8bea,_0x247f0c){return function(_0x256c59){if(!_0x256c59){_0x2f8bea[_0x3ad5('0x2a')](0x194);}return _0x256c59;};}function handleError(_0x456c27,_0x287849){_0x287849=_0x287849||0x1f4;return function(_0x5b2893){logger[_0x3ad5('0x26')](_0x5b2893['stack']);if(_0x5b2893[_0x3ad5('0x3d')]){delete _0x5b2893[_0x3ad5('0x3d')];}_0x456c27[_0x3ad5('0x2b')](_0x287849)[_0x3ad5('0x3e')](_0x5b2893);};}exports[_0x3ad5('0x3f')]=function(_0x34490e,_0x183dcb){var _0x4a462f={'include':[{'model':db[_0x3ad5('0x40')],'as':_0x3ad5('0x41')}]},_0x5847ac={},_0x23e76d={'count':0x0,'rows':[]};var _0x1a9b61=_[_0x3ad5('0x42')](db[_0x3ad5('0x43')][_0x3ad5('0x44')],function(_0x1525b9){return{'name':_0x1525b9[_0x3ad5('0x45')],'type':_0x1525b9[_0x3ad5('0x46')][_0x3ad5('0x47')]};});_0x5847ac[_0x3ad5('0x48')]=_[_0x3ad5('0x42')](_0x1a9b61,_0x3ad5('0x3d'));_0x5847ac[_0x3ad5('0x49')]=_[_0x3ad5('0x4a')](_0x34490e[_0x3ad5('0x49')]);_0x5847ac[_0x3ad5('0x4b')]=_['intersection'](_0x5847ac['model'],_0x5847ac[_0x3ad5('0x49')]);_0x4a462f[_0x3ad5('0x4c')]=_['intersection'](_0x5847ac[_0x3ad5('0x48')],qs['fields'](_0x34490e['query'][_0x3ad5('0x4d')]));_0x4a462f[_0x3ad5('0x4c')]=_0x4a462f[_0x3ad5('0x4c')][_0x3ad5('0x4e')]?_0x4a462f[_0x3ad5('0x4c')]:_0x5847ac[_0x3ad5('0x48')];if(!_0x34490e[_0x3ad5('0x49')]['hasOwnProperty'](_0x3ad5('0x4f'))){_0x4a462f[_0x3ad5('0x2d')]=qs[_0x3ad5('0x2d')](_0x34490e[_0x3ad5('0x49')][_0x3ad5('0x2d')]);_0x4a462f['offset']=qs[_0x3ad5('0x2c')](_0x34490e[_0x3ad5('0x49')][_0x3ad5('0x2c')]);}_0x4a462f[_0x3ad5('0x50')]=qs['sort'](_0x34490e['query']['sort']);_0x4a462f[_0x3ad5('0x51')]=qs[_0x3ad5('0x4b')](_[_0x3ad5('0x52')](_0x34490e[_0x3ad5('0x49')],_0x5847ac['filters']),_0x1a9b61);if(_0x34490e['query'][_0x3ad5('0x53')]){_0x4a462f[_0x3ad5('0x51')]=_[_0x3ad5('0x54')](_0x4a462f['where'],{'$or':_[_0x3ad5('0x42')](_0x1a9b61,function(_0x1771e2){if(_0x1771e2['type']!==_0x3ad5('0x55')){var _0x31f25c={};_0x31f25c[_0x1771e2[_0x3ad5('0x3d')]]={'$like':'%'+_0x34490e['query']['filter']+'%'};return _0x31f25c;}})});}_0x4a462f=_[_0x3ad5('0x54')]({},_0x4a462f,_0x34490e['options']);var _0x256c1d={'where':_0x4a462f['where']};return db[_0x3ad5('0x43')][_0x3ad5('0x2f')](_0x256c1d)['then'](function(_0x1e137c){_0x23e76d[_0x3ad5('0x2f')]=_0x1e137c;if(_0x34490e[_0x3ad5('0x49')]['includeAll']){_0x4a462f['include']=[{'all':!![]}];}return db[_0x3ad5('0x43')][_0x3ad5('0x56')](_0x4a462f);})[_0x3ad5('0x37')](function(_0x3cd138){_0x23e76d[_0x3ad5('0x57')]=_0x3cd138;return _0x23e76d;})['then'](respondWithFilteredResult(_0x183dcb,_0x4a462f))[_0x3ad5('0x58')](handleError(_0x183dcb,null));};exports[_0x3ad5('0x59')]=function(_0x5195fc,_0x43bf0e){var _0x5144c1={'raw':![],'where':{'id':_0x5195fc[_0x3ad5('0x5a')]['id']},'include':[{'model':db[_0x3ad5('0x40')],'as':_0x3ad5('0x41')}]},_0x311bf9={};_0x311bf9[_0x3ad5('0x48')]=_[_0x3ad5('0x4a')](db[_0x3ad5('0x43')][_0x3ad5('0x44')]);_0x311bf9[_0x3ad5('0x49')]=_[_0x3ad5('0x4a')](_0x5195fc['query']);_0x311bf9[_0x3ad5('0x4b')]=_[_0x3ad5('0x5b')](_0x311bf9['model'],_0x311bf9[_0x3ad5('0x49')]);_0x5144c1['attributes']=_[_0x3ad5('0x5b')](_0x311bf9['model'],qs[_0x3ad5('0x4d')](_0x5195fc[_0x3ad5('0x49')]['fields']));_0x5144c1[_0x3ad5('0x4c')]=_0x5144c1['attributes'][_0x3ad5('0x4e')]?_0x5144c1[_0x3ad5('0x4c')]:_0x311bf9[_0x3ad5('0x48')];if(_0x5195fc['query'][_0x3ad5('0x5c')]){_0x5144c1['include']=[{'all':!![]}];}_0x5144c1=_[_0x3ad5('0x54')]({},_0x5144c1,_0x5195fc['options']);return db[_0x3ad5('0x43')][_0x3ad5('0x5d')](_0x5144c1)[_0x3ad5('0x37')](handleEntityNotFound(_0x43bf0e,null))[_0x3ad5('0x37')](respondWithResult(_0x43bf0e,null))['catch'](handleError(_0x43bf0e,null));};exports['create']=function(_0x31c43d,_0x1124d9){return db[_0x3ad5('0x43')]['create'](_0x31c43d['body'],{})[_0x3ad5('0x37')](function(_0x1e59a3){var _0x2096ca=_0x31c43d[_0x3ad5('0x5e')]['get']({'plain':!![]});if(!_0x2096ca)throw new Error(_0x3ad5('0x5f'));if(_0x2096ca[_0x3ad5('0x60')]===_0x3ad5('0x5e')){var _0x3ff478=_0x1e59a3[_0x3ad5('0x38')]({'plain':!![]});var _0x141b4f='OpenchannelAccounts';return db['UserProfileSection'][_0x3ad5('0x5d')]({'where':{'name':_0x141b4f,'userProfileId':_0x2096ca[_0x3ad5('0x61')]},'raw':!![]})[_0x3ad5('0x37')](function(_0x5b0bf8){if(_0x5b0bf8&&_0x5b0bf8['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3ff478['name'],'resourceId':_0x3ff478['id'],'type':_0x5b0bf8['name'],'sectionId':_0x5b0bf8['id']},{})[_0x3ad5('0x37')](function(){return _0x1e59a3;});}else{return _0x1e59a3;}})['catch'](function(_0x39701f){logger['error'](_0x3ad5('0x62'),_0x39701f);throw _0x39701f;});}return _0x1e59a3;})[_0x3ad5('0x37')](respondWithResult(_0x1124d9,0xc9))[_0x3ad5('0x58')](handleError(_0x1124d9,null));};exports[_0x3ad5('0x36')]=function(_0x44a3dd,_0x1a16fc){if(_0x44a3dd['body']['id']){delete _0x44a3dd[_0x3ad5('0x63')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x44a3dd['params']['id']},'include':[{'model':db[_0x3ad5('0x40')],'as':_0x3ad5('0x41')}]})[_0x3ad5('0x37')](handleEntityNotFound(_0x1a16fc,null))[_0x3ad5('0x37')](saveUpdates(_0x44a3dd[_0x3ad5('0x63')],null))[_0x3ad5('0x37')](respondWithResult(_0x1a16fc,null))['catch'](handleError(_0x1a16fc,null));};exports[_0x3ad5('0x3b')]=function(_0x452749,_0x46e09a){return db[_0x3ad5('0x43')][_0x3ad5('0x5d')]({'where':{'id':_0x452749[_0x3ad5('0x5a')]['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x46e09a,null))[_0x3ad5('0x37')](removeEntity(_0x46e09a,null))['catch'](handleError(_0x46e09a,null));};exports[_0x3ad5('0x64')]=function(_0x49e9c7,_0x1ca152){return db[_0x3ad5('0x43')][_0x3ad5('0x64')]()[_0x3ad5('0x37')](respondWithResult(_0x1ca152,null))[_0x3ad5('0x58')](handleError(_0x1ca152,null));};exports[_0x3ad5('0x65')]=function(_0x23ea19,_0x1a216d,_0x5970aa){if(_0x23ea19['body']['id']){delete _0x23ea19[_0x3ad5('0x63')]['id'];}return db[_0x3ad5('0x43')]['find']({'where':{'id':_0x23ea19['params']['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x1a216d,null))[_0x3ad5('0x37')](function(_0x3084aa){if(_0x3084aa){_0x23ea19['body'][_0x3ad5('0x66')]=_0x3084aa['id'];return db[_0x3ad5('0x67')][_0x3ad5('0x68')](_0x23ea19['body']);}})['then'](respondWithResult(_0x1a216d,null))[_0x3ad5('0x58')](handleError(_0x1a216d,null));};exports[_0x3ad5('0x69')]=function(_0x451315,_0x45de70,_0x2b8489){var _0x4035aa={'raw':![],'where':{}};var _0x3cb5dc={};var _0x2d0670={'count':0x0,'rows':[]};return db[_0x3ad5('0x43')][_0x3ad5('0x6a')]({'where':{'id':_0x451315[_0x3ad5('0x5a')]['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x45de70,null))[_0x3ad5('0x37')](function(_0x473e66){if(_0x473e66){_0x3cb5dc[_0x3ad5('0x48')]=_[_0x3ad5('0x4a')](db['Disposition'][_0x3ad5('0x44')]);_0x3cb5dc[_0x3ad5('0x49')]=_['keys'](_0x451315[_0x3ad5('0x49')]);_0x3cb5dc[_0x3ad5('0x4b')]=_[_0x3ad5('0x5b')](_0x3cb5dc[_0x3ad5('0x48')],_0x3cb5dc[_0x3ad5('0x49')]);_0x4035aa['attributes']=_[_0x3ad5('0x5b')](_0x3cb5dc['model'],qs['fields'](_0x451315[_0x3ad5('0x49')]['fields']));_0x4035aa[_0x3ad5('0x4c')]=_0x4035aa['attributes'][_0x3ad5('0x4e')]?_0x4035aa[_0x3ad5('0x4c')]:_0x3cb5dc[_0x3ad5('0x48')];if(!_0x451315[_0x3ad5('0x49')][_0x3ad5('0x6b')]('nolimit')){_0x4035aa['limit']=qs[_0x3ad5('0x2d')](_0x451315[_0x3ad5('0x49')][_0x3ad5('0x2d')]);_0x4035aa[_0x3ad5('0x2c')]=qs['offset'](_0x451315[_0x3ad5('0x49')][_0x3ad5('0x2c')]);}_0x4035aa[_0x3ad5('0x50')]=qs[_0x3ad5('0x6c')](_0x451315[_0x3ad5('0x49')][_0x3ad5('0x6c')]);_0x4035aa[_0x3ad5('0x51')]=qs['filters'](_['pick'](_0x451315[_0x3ad5('0x49')],_0x3cb5dc['filters']));_0x4035aa['where']['OpenchannelAccountId']=_0x473e66['id'];if(_0x451315['query'][_0x3ad5('0x53')]){_0x4035aa[_0x3ad5('0x51')]=_[_0x3ad5('0x54')](_0x4035aa[_0x3ad5('0x51')],{'$or':_[_0x3ad5('0x42')](_0x4035aa[_0x3ad5('0x4c')],function(_0x254526){var _0x434839={};_0x434839[_0x254526]={'$like':'%'+_0x451315[_0x3ad5('0x49')]['filter']+'%'};return _0x434839;})});}_0x4035aa=_[_0x3ad5('0x54')]({},_0x4035aa,_0x451315[_0x3ad5('0x6d')]);return db[_0x3ad5('0x67')][_0x3ad5('0x2f')]({'where':_0x4035aa[_0x3ad5('0x51')]})[_0x3ad5('0x37')](function(_0x270241){_0x2d0670[_0x3ad5('0x2f')]=_0x270241;if(_0x451315[_0x3ad5('0x49')]['includeAll']){_0x4035aa[_0x3ad5('0x6e')]=[{'all':!![]}];}return db['Disposition'][_0x3ad5('0x56')](_0x4035aa);})[_0x3ad5('0x37')](function(_0x37f523){_0x2d0670[_0x3ad5('0x57')]=_0x37f523;return _0x2d0670;});}})[_0x3ad5('0x37')](respondWithFilteredResult(_0x45de70,_0x4035aa))['catch'](handleError(_0x45de70,null));};exports['removeDispositions']=function(_0x37f98c,_0x2c4d30,_0x4a9f7d){return db[_0x3ad5('0x43')]['find']({'where':{'id':_0x37f98c[_0x3ad5('0x5a')]['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x2c4d30,null))['then'](function(_0x1811ee){if(_0x1811ee){return _0x1811ee[_0x3ad5('0x6f')](_0x37f98c[_0x3ad5('0x49')]['ids']);}})[_0x3ad5('0x37')](respondWithStatusCode(_0x2c4d30,null))['catch'](handleError(_0x2c4d30,null));};exports[_0x3ad5('0x70')]=function(_0x2bea90,_0x33f432,_0x561bac){if(_0x2bea90['body']['id']){delete _0x2bea90[_0x3ad5('0x63')]['id'];}return db[_0x3ad5('0x43')]['find']({'where':{'id':_0x2bea90['params']['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x33f432,null))[_0x3ad5('0x37')](function(_0x1a3b93){if(_0x1a3b93){_0x2bea90['body']['OpenchannelAccountId']=_0x1a3b93['id'];return db['CannedAnswer'][_0x3ad5('0x68')](_0x2bea90[_0x3ad5('0x63')]);}})[_0x3ad5('0x37')](respondWithResult(_0x33f432,null))[_0x3ad5('0x58')](handleError(_0x33f432,null));};exports[_0x3ad5('0x71')]=function(_0x43c5e2,_0x393f92,_0xb8d399){var _0x4fbbfe={'raw':![],'where':{}};var _0x4f088a={};var _0x103e25={'count':0x0,'rows':[]};return db[_0x3ad5('0x43')][_0x3ad5('0x6a')]({'where':{'id':_0x43c5e2['params']['id']}})['then'](handleEntityNotFound(_0x393f92,null))[_0x3ad5('0x37')](function(_0x1fa7cb){if(_0x1fa7cb){_0x4f088a[_0x3ad5('0x48')]=_[_0x3ad5('0x4a')](db[_0x3ad5('0x72')][_0x3ad5('0x44')]);_0x4f088a[_0x3ad5('0x49')]=_[_0x3ad5('0x4a')](_0x43c5e2[_0x3ad5('0x49')]);_0x4f088a['filters']=_[_0x3ad5('0x5b')](_0x4f088a[_0x3ad5('0x48')],_0x4f088a[_0x3ad5('0x49')]);_0x4fbbfe[_0x3ad5('0x4c')]=_['intersection'](_0x4f088a['model'],qs[_0x3ad5('0x4d')](_0x43c5e2[_0x3ad5('0x49')]['fields']));_0x4fbbfe[_0x3ad5('0x4c')]=_0x4fbbfe['attributes'][_0x3ad5('0x4e')]?_0x4fbbfe[_0x3ad5('0x4c')]:_0x4f088a[_0x3ad5('0x48')];if(!_0x43c5e2[_0x3ad5('0x49')]['hasOwnProperty'](_0x3ad5('0x4f'))){_0x4fbbfe[_0x3ad5('0x2d')]=qs['limit'](_0x43c5e2['query']['limit']);_0x4fbbfe[_0x3ad5('0x2c')]=qs['offset'](_0x43c5e2[_0x3ad5('0x49')]['offset']);}_0x4fbbfe['order']=qs[_0x3ad5('0x6c')](_0x43c5e2['query'][_0x3ad5('0x6c')]);_0x4fbbfe[_0x3ad5('0x51')]=qs[_0x3ad5('0x4b')](_[_0x3ad5('0x52')](_0x43c5e2[_0x3ad5('0x49')],_0x4f088a[_0x3ad5('0x4b')]));_0x4fbbfe[_0x3ad5('0x51')][_0x3ad5('0x66')]=_0x1fa7cb['id'];if(_0x43c5e2['query'][_0x3ad5('0x53')]){_0x4fbbfe[_0x3ad5('0x51')]=_[_0x3ad5('0x54')](_0x4fbbfe[_0x3ad5('0x51')],{'$or':_[_0x3ad5('0x42')](_0x4fbbfe[_0x3ad5('0x4c')],function(_0x265a76){var _0x10f342={};_0x10f342[_0x265a76]={'$like':'%'+_0x43c5e2['query'][_0x3ad5('0x53')]+'%'};return _0x10f342;})});}_0x4fbbfe=_[_0x3ad5('0x54')]({},_0x4fbbfe,_0x43c5e2['options']);return db[_0x3ad5('0x72')][_0x3ad5('0x2f')]({'where':_0x4fbbfe['where']})[_0x3ad5('0x37')](function(_0x500ace){_0x103e25[_0x3ad5('0x2f')]=_0x500ace;if(_0x43c5e2[_0x3ad5('0x49')]['includeAll']){_0x4fbbfe[_0x3ad5('0x6e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3ad5('0x56')](_0x4fbbfe);})[_0x3ad5('0x37')](function(_0x1eaa59){_0x103e25[_0x3ad5('0x57')]=_0x1eaa59;return _0x103e25;});}})['then'](respondWithFilteredResult(_0x393f92,_0x4fbbfe))[_0x3ad5('0x58')](handleError(_0x393f92,null));};exports[_0x3ad5('0x73')]=function(_0x14df83,_0x5c0195,_0x29d2d9){return db['OpenchannelAccount'][_0x3ad5('0x5d')]({'where':{'id':_0x14df83['params']['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x5c0195,null))[_0x3ad5('0x37')](function(_0x2c06ac){if(_0x2c06ac){return _0x2c06ac[_0x3ad5('0x73')](_0x14df83['query'][_0x3ad5('0x74')]);}})[_0x3ad5('0x37')](respondWithStatusCode(_0x5c0195,null))[_0x3ad5('0x58')](handleError(_0x5c0195,null));};exports[_0x3ad5('0x75')]=function(_0x4009e7,_0x38fc64,_0x163572){var _0x1addf8={'body':_0x4009e7['body'],'channel':_0x3ad5('0x76')};var _0x34bdba=[];var _0x5323f3=[];var _0x3441cc={};var _0x1fff9b=![];return db[_0x3ad5('0x77')][_0x3ad5('0x64')]()[_0x3ad5('0x37')](function(_0x138d5b){if(!_0x138d5b){throw new db['Sequelize'][(_0x3ad5('0x78'))](_0x3ad5('0x79'));}_0x34bdba=_['difference'](_[_0x3ad5('0x4a')](_0x138d5b),[_0x3ad5('0x7a'),_0x3ad5('0x7b')]);_0x5323f3=_[_0x3ad5('0x7c')](_[_0x3ad5('0x4a')](_0x138d5b),[_0x3ad5('0x7a'),_0x3ad5('0x7b'),'CompanyId','ListId']);if(_0x4009e7['body']['id']){delete _0x4009e7[_0x3ad5('0x63')]['id'];}if(_['isNil'](_0x4009e7[_0x3ad5('0x63')]['from'])){throw new db[(_0x3ad5('0x7d'))]['ValidationError'](_0x3ad5('0x7e'));}if(_[_0x3ad5('0x7f')](_0x4009e7['body'][_0x3ad5('0x63')])||_0x4009e7[_0x3ad5('0x63')][_0x3ad5('0x63')]===''){throw new db['Sequelize'][(_0x3ad5('0x78'))](_0x3ad5('0x80'));}if(_[_0x3ad5('0x7f')](_0x4009e7['body'][_0x3ad5('0x81')])){throw new db['Sequelize']['ValidationError'](_0x3ad5('0x82')+_0x5323f3);}if(!_[_0x3ad5('0x83')](_0x5323f3,_0x4009e7[_0x3ad5('0x63')]['mapKey'])){throw new db[(_0x3ad5('0x7d'))][(_0x3ad5('0x78'))](_0x3ad5('0x84')+_0x5323f3);}_0x3441cc[_0x4009e7[_0x3ad5('0x63')]['mapKey']]=_0x4009e7[_0x3ad5('0x63')][_0x3ad5('0x85')];})['then'](function(){return db[_0x3ad5('0x43')][_0x3ad5('0x5d')]({'where':{'id':_0x4009e7[_0x3ad5('0x5a')]['id']},'include':[{'model':db[_0x3ad5('0x86')],'as':_0x3ad5('0x87'),'include':[{'model':db[_0x3ad5('0x77')],'as':'Contacts','where':_0x3441cc,'limit':0x1,'order':[[_0x3ad5('0x7b'),_0x3ad5('0x88')]]}]},{'model':db[_0x3ad5('0x89')],'as':'Applications'}]});})[_0x3ad5('0x37')](handleEntityNotFound(_0x38fc64,null))[_0x3ad5('0x37')](function(_0x3cefe8){if(_0x3cefe8&&_0x3cefe8[_0x3ad5('0x87')]){_0x1addf8['account']=_0x3cefe8;_0x1addf8['applications']=_0x3cefe8[_0x3ad5('0x8a')];_0x1addf8[_0x3ad5('0x8b')]=_0x3cefe8[_0x3ad5('0x87')];_0x1addf8['applications']=_[_0x3ad5('0x8c')](_0x1addf8['applications'],[_0x3ad5('0x8d')],[_0x3ad5('0x8e')]);if(_0x1addf8[_0x3ad5('0x8f')]['Applications']){delete _0x1addf8[_0x3ad5('0x8f')][_0x3ad5('0x8a')];}if(_0x1addf8['account']['List']&&_0x1addf8[_0x3ad5('0x8f')][_0x3ad5('0x87')]['Contacts'][_0x3ad5('0x4e')]){return _0x1addf8['account']['List'][_0x3ad5('0x90')][0x0];}var _0xa0f010=_[_0x3ad5('0x91')](_0x4009e7[_0x3ad5('0x63')],{'firstName':_0x4009e7[_0x3ad5('0x63')][_0x3ad5('0x85')],'ListId':_0x3cefe8[_0x3ad5('0x92')]});_0xa0f010[_0x4009e7[_0x3ad5('0x63')]['mapKey']]=_0x4009e7[_0x3ad5('0x63')][_0x3ad5('0x85')];return db[_0x3ad5('0x77')][_0x3ad5('0x68')](_0xa0f010,{'fields':_0x34bdba,'raw':!![]});}})[_0x3ad5('0x37')](handleEntityNotFound(_0x38fc64,null))[_0x3ad5('0x37')](function(_0x530ceb){_0x1addf8[_0x3ad5('0x93')]=_0x530ceb;if(_0x530ceb){var _0x5d74f9={'ContactId':_0x530ceb['id'],'OpenchannelAccountId':_0x4009e7[_0x3ad5('0x5a')]['id'],'from':(_0x530ceb[_0x3ad5('0x94')]||'')+'\x20'+(_0x530ceb['lastName']||'')};var _0x31197b={'OpenchannelAccountId':_0x4009e7[_0x3ad5('0x5a')]['id'],'closed':![]};if(_0x4009e7[_0x3ad5('0x63')][_0x3ad5('0x95')]){_0x31197b[_0x3ad5('0x95')]=_0x4009e7[_0x3ad5('0x63')]['threadId'];return db[_0x3ad5('0x96')][_0x3ad5('0x5d')]({'where':_0x31197b})[_0x3ad5('0x37')](function(_0xaa1588){if(_0xaa1588){return[_0xaa1588,![]];}_0x5d74f9[_0x3ad5('0x95')]=_0x4009e7[_0x3ad5('0x63')][_0x3ad5('0x95')];_0x5d74f9[_0x3ad5('0x97')]=_0x4009e7[_0x3ad5('0x63')][_0x3ad5('0x97')];return db['OpenchannelInteraction'][_0x3ad5('0x68')](_0x5d74f9)[_0x3ad5('0x37')](function(_0x72a03b){return[_0x72a03b,!![]];});});}else{_0x31197b[_0x3ad5('0x95')]=null;}_0x31197b[_0x3ad5('0x98')]=_0x530ceb['id'];return db[_0x3ad5('0x96')][_0x3ad5('0x5d')]({'where':_0x31197b})['then'](function(_0x280dd7){if(_0x280dd7){return[_0x280dd7,![]];}return db['OpenchannelInteraction'][_0x3ad5('0x68')](_0x5d74f9)[_0x3ad5('0x37')](function(_0x2edd15){return[_0x2edd15,!![]];});});}})[_0x3ad5('0x99')](function(_0x5428ab,_0x2b83b7){if(_0x5428ab){_0x1fff9b=_0x2b83b7;if(!_0x2b83b7){var _0x4234ae={'from':(_0x1addf8['contact'][_0x3ad5('0x94')]||'')+'\x20'+(_0x1addf8[_0x3ad5('0x93')][_0x3ad5('0x9a')]||'')};if(_0x4009e7[_0x3ad5('0x63')][_0x3ad5('0x95')]&&_0x4009e7[_0x3ad5('0x63')][_0x3ad5('0x9b')]&&_0x4009e7[_0x3ad5('0x63')]['threadId']!=_0x4009e7[_0x3ad5('0x63')]['messageId']){_0x4234ae[_0x3ad5('0x95')]=_0x4009e7[_0x3ad5('0x63')][_0x3ad5('0x9b')];}return _0x5428ab[_0x3ad5('0x36')](_0x4234ae);}else{return _0x5428ab;}}})[_0x3ad5('0x37')](function(_0x2682eb){_0x1addf8['interaction']=_0x2682eb[_0x3ad5('0x38')]({'plain':!![]});_0x1addf8[_0x3ad5('0x9c')][_0x3ad5('0x9d')]=_0x1fff9b;if(_0x1addf8['interaction'][_0x3ad5('0x9d')]){if(_0x1addf8['account'][_0x3ad5('0x9e')]){_0x1addf8['applications'][_0x3ad5('0x9f')]({'id':0x0,'priority':_0x1addf8[_0x3ad5('0xa0')][_0x3ad5('0x4e')]+0x1,'app':_0x3ad5('0xa1'),'appdata':_0x3ad5('0xa2'),'interval':_0x3ad5('0xa3')});}}return db[_0x3ad5('0xa4')][_0x3ad5('0x68')]({'body':_0x4009e7['body'][_0x3ad5('0x63')],'OpenchannelAccountId':_0x4009e7['params']['id'],'OpenchannelInteractionId':_0x2682eb['id'],'direction':'in','ContactId':_0x1addf8[_0x3ad5('0x93')]['id'],'AttachmentId':_0x4009e7[_0x3ad5('0x63')][_0x3ad5('0xa5')]});})[_0x3ad5('0x37')](function(_0x43a8e4){_0x1addf8[_0x3ad5('0x28')]=_0x43a8e4;if(_0x1addf8[_0x3ad5('0x9c')][_0x3ad5('0xa6')]){return db[_0x3ad5('0xa7')][_0x3ad5('0x5d')]({'attributes':['id',_0x3ad5('0x3d')],'where':{'id':_0x1addf8[_0x3ad5('0x9c')][_0x3ad5('0xa6')]}})[_0x3ad5('0x37')](function(_0x41a0e9){if(_0x41a0e9){_0x1addf8[_0x3ad5('0xa0')][_0x3ad5('0xa8')]({'id':0x0,'priority':0x0,'app':_0x3ad5('0xa9'),'appdata':_0x41a0e9[_0x3ad5('0x3d')]+','+(_0x1addf8[_0x3ad5('0x8f')]['waitForTheAssignedAgent']||0xa),'interval':_0x3ad5('0xa3')});_0x1addf8[_0x3ad5('0xaa')]=![];}return respondWithRpcPromise('Start','startRouting',_0x1addf8);});}return respondWithRpcPromise(_0x3ad5('0xab'),_0x3ad5('0xac'),_0x1addf8);})[_0x3ad5('0x37')](function(_0x3a0be4){respondWithRpcPromise(_0x3ad5('0xad'),'EventManager',{'event':'notify','message':_0x3a0be4},client9002);return _0x3a0be4;})[_0x3ad5('0x37')](respondWithResult(_0x38fc64,null))[_0x3ad5('0x58')](handleError(_0x38fc64,null));};exports[_0x3ad5('0xae')]=function(_0x1a8889,_0x512911){var _0x222dd7=_0x1a8889[_0x3ad5('0x5a')]['id'];var _0x529e6a=_0x1a8889[_0x3ad5('0x63')];var _0xcf8161=0xc8;var _0x4a772c=null;return db[_0x3ad5('0xaf')][_0x3ad5('0xb0')]({'isolationLevel':db['sequelize'][_0x3ad5('0xb1')]['ISOLATION_LEVELS'][_0x3ad5('0xb2')]},function(_0x2b10d8){return db[_0x3ad5('0x43')][_0x3ad5('0x6a')]({'where':{'id':_0x222dd7},'transaction':_0x2b10d8})[_0x3ad5('0x37')](function(_0x1fdbcb){if(_0x1fdbcb){return db[_0x3ad5('0x89')][_0x3ad5('0x3b')]({'where':{'OpenchannelAccountId':_0x222dd7},'transaction':_0x2b10d8})[_0x3ad5('0x37')](function(){var _0x32b6ad=_['map'](_0x529e6a,function(_0x45c228){_0x45c228['OpenchannelAccountId']=_0x222dd7;return _0x45c228;});return db[_0x3ad5('0x89')][_0x3ad5('0xb3')](_0x32b6ad,{'transaction':_0x2b10d8});});}else{_0xcf8161=0x194;_0x4a772c=[];}});})[_0x3ad5('0x37')](function(){if(_0xcf8161!==0x194){return db[_0x3ad5('0x89')][_0x3ad5('0xb4')]({'where':{'OpenchannelAccountId':_0x222dd7},'order':'priority'})[_0x3ad5('0x37')](function(_0x3a584d){_0x4a772c=_0x3a584d;});}})[_0x3ad5('0x58')](function(_0x3a7f1e){_0xcf8161=0x1f4;logger['error'](_0x3a7f1e[_0x3ad5('0xb5')]);if(_0x3a7f1e[_0x3ad5('0x3d')]){delete _0x3a7f1e[_0x3ad5('0x3d')];}_0x4a772c=_0x3a7f1e;})[_0x3ad5('0xb6')](function(){if(_0x4a772c===null){_0x512911[_0x3ad5('0x2a')](_0xcf8161);}else{if(_0xcf8161===0x1f4){_0x512911[_0x3ad5('0x2b')](_0xcf8161)['send'](_0x4a772c);}else{_0x512911[_0x3ad5('0x2b')](_0xcf8161)[_0x3ad5('0x32')](_0x4a772c);}}});};exports[_0x3ad5('0xb7')]=function(_0x353862,_0x3b47ac,_0x371e8a){var _0x9ac85f={};var _0x1bf211={};var _0x469056;var _0x239cc5;return db[_0x3ad5('0x43')][_0x3ad5('0x6a')]({'where':{'id':_0x353862[_0x3ad5('0x5a')]['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x3b47ac,null))[_0x3ad5('0x37')](function(_0x1c5f0c){if(_0x1c5f0c){_0x469056=_0x1c5f0c;_0x1bf211['model']=_[_0x3ad5('0x4a')](db[_0x3ad5('0x89')][_0x3ad5('0x44')]);_0x1bf211['query']=_['keys'](_0x353862[_0x3ad5('0x49')]);_0x1bf211['filters']=_['intersection'](_0x1bf211[_0x3ad5('0x48')],_0x1bf211['query']);_0x9ac85f[_0x3ad5('0x4c')]=_[_0x3ad5('0x5b')](_0x1bf211['model'],qs[_0x3ad5('0x4d')](_0x353862[_0x3ad5('0x49')][_0x3ad5('0x4d')]));_0x9ac85f[_0x3ad5('0x4c')]=_0x9ac85f[_0x3ad5('0x4c')][_0x3ad5('0x4e')]?_0x9ac85f[_0x3ad5('0x4c')]:_0x1bf211[_0x3ad5('0x48')];_0x9ac85f[_0x3ad5('0x50')]=qs[_0x3ad5('0x6c')](_0x353862[_0x3ad5('0x49')][_0x3ad5('0x6c')]);_0x9ac85f['where']=qs[_0x3ad5('0x4b')](_[_0x3ad5('0x52')](_0x353862['query'],_0x1bf211[_0x3ad5('0x4b')]));if(_0x353862['query']['filter']){_0x9ac85f[_0x3ad5('0x51')]=_[_0x3ad5('0x54')](_0x9ac85f[_0x3ad5('0x51')],{'$or':_['map'](_0x9ac85f[_0x3ad5('0x4c')],function(_0x589fce){var _0x273c52={};_0x273c52[_0x589fce]={'$like':'%'+_0x353862[_0x3ad5('0x49')][_0x3ad5('0x53')]+'%'};return _0x273c52;})});}_0x9ac85f=_[_0x3ad5('0x54')]({},_0x9ac85f,_0x353862['options']);return _0x469056[_0x3ad5('0xb7')](_0x9ac85f);}})[_0x3ad5('0x37')](function(_0x50b90f){if(_0x50b90f){_0x239cc5=_0x50b90f[_0x3ad5('0x4e')];if(!_0x353862[_0x3ad5('0x49')][_0x3ad5('0x6b')](_0x3ad5('0x4f'))){_0x9ac85f[_0x3ad5('0x2d')]=qs['limit'](_0x353862[_0x3ad5('0x49')][_0x3ad5('0x2d')]);_0x9ac85f[_0x3ad5('0x2c')]=qs[_0x3ad5('0x2c')](_0x353862['query'][_0x3ad5('0x2c')]);}return _0x469056['getApplications'](_0x9ac85f);}})[_0x3ad5('0x37')](function(_0x2a265f){if(_0x2a265f){return _0x2a265f?{'count':_0x239cc5,'rows':_0x2a265f}:null;}})['then'](respondWithResult(_0x3b47ac,null))[_0x3ad5('0x58')](handleError(_0x3b47ac,null));};exports[_0x3ad5('0xb8')]=function(_0x4c615b,_0x4166fc,_0x5a89fc){var _0x9bbd57={'raw':![],'where':{}};var _0x3a191b={};var _0x5b81d5={'count':0x0,'rows':[]};return db[_0x3ad5('0x43')]['findOne']({'where':{'id':_0x4c615b['params']['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x4166fc,null))[_0x3ad5('0x37')](function(_0x3acb30){if(_0x3acb30){_0x3a191b[_0x3ad5('0x48')]=_[_0x3ad5('0x4a')](db[_0x3ad5('0x96')][_0x3ad5('0x44')]);_0x3a191b['query']=_['keys'](_0x4c615b[_0x3ad5('0x49')]);_0x3a191b[_0x3ad5('0x4b')]=_[_0x3ad5('0x5b')](_0x3a191b['model'],_0x3a191b[_0x3ad5('0x49')]);_0x9bbd57['attributes']=_[_0x3ad5('0x5b')](_0x3a191b[_0x3ad5('0x48')],qs[_0x3ad5('0x4d')](_0x4c615b['query'][_0x3ad5('0x4d')]));_0x9bbd57['attributes']=_0x9bbd57[_0x3ad5('0x4c')][_0x3ad5('0x4e')]?_0x9bbd57['attributes']:_0x3a191b[_0x3ad5('0x48')];if(!_0x4c615b['query']['hasOwnProperty'](_0x3ad5('0x4f'))){_0x9bbd57[_0x3ad5('0x2d')]=qs[_0x3ad5('0x2d')](_0x4c615b[_0x3ad5('0x49')][_0x3ad5('0x2d')]);_0x9bbd57['offset']=qs[_0x3ad5('0x2c')](_0x4c615b['query'][_0x3ad5('0x2c')]);}_0x9bbd57[_0x3ad5('0x50')]=qs['sort'](_0x4c615b[_0x3ad5('0x49')][_0x3ad5('0x6c')]);_0x9bbd57[_0x3ad5('0x51')]=qs['filters'](_[_0x3ad5('0x52')](_0x4c615b[_0x3ad5('0x49')],_0x3a191b[_0x3ad5('0x4b')]));_0x9bbd57['where'][_0x3ad5('0x66')]=_0x3acb30['id'];if(_0x4c615b['query'][_0x3ad5('0x53')]){_0x9bbd57[_0x3ad5('0x51')]=_[_0x3ad5('0x54')](_0x9bbd57['where'],{'$or':_['map'](_0x9bbd57[_0x3ad5('0x4c')],function(_0x230122){var _0x1c659f={};_0x1c659f[_0x230122]={'$like':'%'+_0x4c615b[_0x3ad5('0x49')]['filter']+'%'};return _0x1c659f;})});}_0x9bbd57=_[_0x3ad5('0x54')]({},_0x9bbd57,_0x4c615b['options']);return db[_0x3ad5('0x96')][_0x3ad5('0x2f')]({'where':_0x9bbd57[_0x3ad5('0x51')]})[_0x3ad5('0x37')](function(_0x163b64){_0x5b81d5[_0x3ad5('0x2f')]=_0x163b64;if(_0x4c615b[_0x3ad5('0x49')][_0x3ad5('0x5c')]){_0x9bbd57['include']=[{'model':db[_0x3ad5('0x77')],'as':_0x3ad5('0xb9'),'required':![]},{'model':db[_0x3ad5('0xa7')],'as':_0x3ad5('0xba'),'attributes':[_0x3ad5('0x3d'),_0x3ad5('0xbb'),_0x3ad5('0xbc')],'required':![]},{'model':db[_0x3ad5('0xbd')],'as':_0x3ad5('0xbe'),'attributes':['id','name',_0x3ad5('0xbf')],'where':_0x4c615b['query'][_0x3ad5('0xc0')]?{'id':_0x4c615b[_0x3ad5('0x49')][_0x3ad5('0xc0')]}:undefined,'required':_0x4c615b[_0x3ad5('0x49')][_0x3ad5('0xc0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x3ad5('0x56')](_0x9bbd57);})[_0x3ad5('0x37')](function(_0x3a795c){_0x5b81d5[_0x3ad5('0x57')]=_0x3a795c;return _0x5b81d5;});}})['then'](respondWithFilteredResult(_0x4166fc,_0x9bbd57))[_0x3ad5('0x58')](handleError(_0x4166fc,null));};exports['addAgents']=function(_0x5af8a9,_0x5e24bb,_0xa12a15){return db[_0x3ad5('0x43')][_0x3ad5('0x5d')]({'where':{'id':_0x5af8a9['params']['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x5e24bb,null))[_0x3ad5('0x37')](function(_0x21622d){if(_0x21622d){return _0x21622d[_0x3ad5('0xc1')](_0x5af8a9['body'][_0x3ad5('0x74')],_[_0x3ad5('0xc2')](_0x5af8a9[_0x3ad5('0x63')],[_0x3ad5('0x74'),'id'])||{})['spread'](function(_0x4a6147){for(var _0x1c176e=0x0;_0x1c176e<_0x5af8a9['body'][_0x3ad5('0x74')]['length'];_0x1c176e+=0x1){socket[_0x3ad5('0xc3')](_0x3ad5('0xc4'),{'UserId':Number(_0x5af8a9[_0x3ad5('0x63')][_0x3ad5('0x74')][_0x1c176e]),'OpenchannelAccountId':Number(_0x5af8a9[_0x3ad5('0x5a')]['id'])});}return _0x4a6147;});}})[_0x3ad5('0x37')](respondWithResult(_0x5e24bb,null))[_0x3ad5('0x58')](handleError(_0x5e24bb,null));};exports[_0x3ad5('0xc5')]=function(_0x1526bc,_0x3237ad,_0x20ee05){return db[_0x3ad5('0x43')][_0x3ad5('0x5d')]({'where':{'id':_0x1526bc[_0x3ad5('0x5a')]['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x3237ad,null))['then'](function(_0x210a6b){if(_0x210a6b){return _0x210a6b['removeAgents'](_0x1526bc[_0x3ad5('0x49')][_0x3ad5('0x74')])[_0x3ad5('0x37')](function(){if(_[_0x3ad5('0xc6')](_0x1526bc[_0x3ad5('0x49')][_0x3ad5('0x74')])){for(var _0x36d14e=0x0;_0x36d14e<_0x1526bc[_0x3ad5('0x49')][_0x3ad5('0x74')]['length'];_0x36d14e+=0x1){socket[_0x3ad5('0xc3')](_0x3ad5('0xc7'),{'UserId':Number(_0x1526bc[_0x3ad5('0x49')][_0x3ad5('0x74')][_0x36d14e]),'OpenchannelAccountId':Number(_0x1526bc['params']['id'])});}}else{socket['emit'](_0x3ad5('0xc7'),{'UserId':Number(_0x1526bc['query'][_0x3ad5('0x74')]),'OpenchannelAccountId':Number(_0x1526bc[_0x3ad5('0x5a')]['id'])});}});}})[_0x3ad5('0x37')](respondWithStatusCode(_0x3237ad,null))[_0x3ad5('0x58')](handleError(_0x3237ad,null));};exports[_0x3ad5('0xc8')]=function(_0x532a1b,_0x3805eb,_0x13491c){var _0x390f33={};var _0x3566a6={};var _0x8af7b2;var _0x392ce2;return db[_0x3ad5('0x43')][_0x3ad5('0x6a')]({'where':{'id':_0x532a1b[_0x3ad5('0x5a')]['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x3805eb,null))[_0x3ad5('0x37')](function(_0x19f27f){if(_0x19f27f){_0x8af7b2=_0x19f27f;_0x3566a6[_0x3ad5('0x48')]=_[_0x3ad5('0x4a')](db[_0x3ad5('0xa7')]['rawAttributes']);_0x3566a6[_0x3ad5('0x49')]=_[_0x3ad5('0x4a')](_0x532a1b[_0x3ad5('0x49')]);_0x3566a6[_0x3ad5('0x4b')]=_[_0x3ad5('0x5b')](_0x3566a6[_0x3ad5('0x48')],_0x3566a6[_0x3ad5('0x49')]);_0x390f33[_0x3ad5('0x4c')]=_['intersection'](_0x3566a6[_0x3ad5('0x48')],qs[_0x3ad5('0x4d')](_0x532a1b[_0x3ad5('0x49')]['fields']));_0x390f33[_0x3ad5('0x4c')]=_0x390f33[_0x3ad5('0x4c')][_0x3ad5('0x4e')]?_0x390f33[_0x3ad5('0x4c')]:_0x3566a6['model'];_0x390f33[_0x3ad5('0x50')]=qs[_0x3ad5('0x6c')](_0x532a1b['query'][_0x3ad5('0x6c')]);_0x390f33[_0x3ad5('0x51')]=qs[_0x3ad5('0x4b')](_[_0x3ad5('0x52')](_0x532a1b[_0x3ad5('0x49')],_0x3566a6[_0x3ad5('0x4b')]));if(_0x532a1b[_0x3ad5('0x49')][_0x3ad5('0x53')]){_0x390f33[_0x3ad5('0x51')]=_[_0x3ad5('0x54')](_0x390f33[_0x3ad5('0x51')],{'$or':_[_0x3ad5('0x42')](_0x390f33['attributes'],function(_0x26c468){var _0x43df87={};_0x43df87[_0x26c468]={'$like':'%'+_0x532a1b[_0x3ad5('0x49')][_0x3ad5('0x53')]+'%'};return _0x43df87;})});}_0x390f33=_[_0x3ad5('0x54')]({},_0x390f33,_0x532a1b[_0x3ad5('0x6d')]);return _0x8af7b2['getAgents'](_0x390f33);}})[_0x3ad5('0x37')](function(_0x40dfd1){if(_0x40dfd1){_0x392ce2=_0x40dfd1[_0x3ad5('0x4e')];if(!_0x532a1b[_0x3ad5('0x49')][_0x3ad5('0x6b')](_0x3ad5('0x4f'))){_0x390f33[_0x3ad5('0x2d')]=qs[_0x3ad5('0x2d')](_0x532a1b['query'][_0x3ad5('0x2d')]);_0x390f33[_0x3ad5('0x2c')]=qs[_0x3ad5('0x2c')](_0x532a1b['query'][_0x3ad5('0x2c')]);}return _0x8af7b2[_0x3ad5('0xc8')](_0x390f33);}})[_0x3ad5('0x37')](function(_0x3ea5fb){if(_0x3ea5fb){return _0x3ea5fb?{'count':_0x392ce2,'rows':_0x3ea5fb}:null;}})['then'](respondWithResult(_0x3805eb,null))[_0x3ad5('0x58')](handleError(_0x3805eb,null));};exports[_0x3ad5('0x3e')]=function(_0x2a4c12,_0x6c525,_0x220579){var _0x15050a,_0x25d684,_0x1a40f2;if(_[_0x3ad5('0x7f')](_0x2a4c12[_0x3ad5('0x63')][_0x3ad5('0x63')])||_0x2a4c12[_0x3ad5('0x63')][_0x3ad5('0x63')]===''){throw new db[(_0x3ad5('0x7d'))][(_0x3ad5('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3ad5('0x7f')](_0x2a4c12[_0x3ad5('0x63')]['to'])){}_0x15050a=_0x2a4c12['body']['to'];return db['OpenchannelAccount'][_0x3ad5('0x6a')]({'where':{'id':_0x2a4c12[_0x3ad5('0x5a')]['id']}})[_0x3ad5('0x37')](handleEntityNotFound(_0x6c525,null))[_0x3ad5('0x37')](function(_0x4ea771){if(_0x4ea771){return db[_0x3ad5('0x43')][_0x3ad5('0x5d')]({'where':{'id':_0x4ea771['id']},'include':[{'model':db[_0x3ad5('0x86')],'as':_0x3ad5('0x87'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x4ea771['mapKey']]:_0x15050a},'limit':0x1,'order':[['updatedAt',_0x3ad5('0x88')]]}]}]})['then'](handleEntityNotFound(_0x6c525,null))[_0x3ad5('0x37')](function(_0x930b8f){if(_0x930b8f&&_0x930b8f[_0x3ad5('0x87')]){_0x25d684=_0x930b8f[_0x3ad5('0x38')]({'plain':!![]});if(_0x25d684[_0x3ad5('0x87')]&&_0x25d684[_0x3ad5('0x87')][_0x3ad5('0x90')][_0x3ad5('0x4e')]){return _0x25d684[_0x3ad5('0x87')]['Contacts'][0x0];}return db[_0x3ad5('0x77')]['create'](_['defaults'](_0x2a4c12[_0x3ad5('0x63')],{'firstName':_0x15050a,[_0x930b8f[_0x3ad5('0x81')]]:_0x15050a,'phone':_0x15050a,'ListId':_0x25d684[_0x3ad5('0x92')]}));}})[_0x3ad5('0x37')](handleEntityNotFound(_0x6c525,null))[_0x3ad5('0x37')](function(_0x237de1){if(_0x237de1){_0x1a40f2=_0x237de1;return db['OpenchannelInteraction'][_0x3ad5('0x5d')]({'where':{'ContactId':_0x1a40f2['id'],'closed':![],'OpenchannelAccountId':_0x25d684['id']}})[_0x3ad5('0x37')](function(_0x3affc7){if(_0x3affc7){return[_0x3affc7,![]];}return db[_0x3ad5('0x96')][_0x3ad5('0x68')]({'UserId':_0x2a4c12[_0x3ad5('0x5e')]['id'],'ContactId':_0x1a40f2['id'],'OpenchannelAccountId':_0x25d684['id'],'lastMsgDirection':_0x3ad5('0xc9'),'firstMsgDirection':'out','Messages':[_['merge'](_0x2a4c12[_0x3ad5('0x63')],{'read':![],'body':_0x2a4c12[_0x3ad5('0x63')]['body'],'OpenchannelAccountId':_0x25d684['id'],'UserId':_0x2a4c12['user']['id'],'ContactId':_0x1a40f2['id']})]},{'include':[{'model':db[_0x3ad5('0xa4')],'as':_0x3ad5('0xca')}]})[_0x3ad5('0x37')](function(_0x5b6314){return[_0x5b6314,!![]];});});}})[_0x3ad5('0x99')](function(_0x5daa4a,_0x4f2d78){if(_0x4f2d78){return _0x5daa4a;}return db[_0x3ad5('0xa4')][_0x3ad5('0x68')](_[_0x3ad5('0x54')](_0x2a4c12['body'],{'read':![],'body':_0x2a4c12[_0x3ad5('0x63')][_0x3ad5('0x63')],'OpenchannelAccountId':_0x25d684['id'],'OpenchannelInteractionId':_0x5daa4a['id'],'UserId':_0x2a4c12[_0x3ad5('0x5e')]['id'],'ContactId':_0x1a40f2['id']}))[_0x3ad5('0x37')](function(_0x55b66f){_0x5daa4a['dataValues'][_0x3ad5('0xca')]=[];_0x5daa4a[_0x3ad5('0xcb')][_0x3ad5('0xca')][_0x3ad5('0x9f')](_0x55b66f[_0x3ad5('0xcb')]);return _0x5daa4a;});});}})[_0x3ad5('0x37')](respondWithResult(_0x6c525,null))[_0x3ad5('0x58')](handleError(_0x6c525,null));}; \ No newline at end of file +var _0xf3dc=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','code','error','message','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','index','Pause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','name','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','find','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','order','map','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','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','stack','finally','send','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x539709,_0x2c9edd){_0x539709=_0x539709-0x0;var _0x73cc7e=_0xf3dc[_0x539709];return _0x73cc7e;};'use strict';var emlformat=require(_0xcf3d('0x0'));var rimraf=require(_0xcf3d('0x1'));var zipdir=require(_0xcf3d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf3d('0x3'));var moment=require(_0xcf3d('0x4'));var BPromise=require(_0xcf3d('0x5'));var Mustache=require(_0xcf3d('0x6'));var util=require(_0xcf3d('0x7'));var path=require(_0xcf3d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcf3d('0x9'));var jsforce=require(_0xcf3d('0xa'));var deskjs=require(_0xcf3d('0xb'));var toCsv=require(_0xcf3d('0xc'));var querystring=require(_0xcf3d('0xd'));var Papa=require(_0xcf3d('0xe'));var Redis=require(_0xcf3d('0xf'));var authService=require(_0xcf3d('0x10'));var qs=require(_0xcf3d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcf3d('0x12'));var utils=require('../../config/utils');var config=require(_0xcf3d('0x13'));var licenseUtil=require(_0xcf3d('0x14'));var db=require(_0xcf3d('0x15'))['db'];config[_0xcf3d('0x16')]=_[_0xcf3d('0x17')](config[_0xcf3d('0x16')],{'host':_0xcf3d('0x18'),'port':0x18eb});var socket=require(_0xcf3d('0x19'))(new Redis(config[_0xcf3d('0x16')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xcf3d('0x1a'));var client=jayson[_0xcf3d('0x1b')][_0xcf3d('0x1c')]({'port':0x232c});var client9002=jayson[_0xcf3d('0x1b')][_0xcf3d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2b401e,_0x196b1f,_0x71e44b,_0x410004){return new BPromise(function(_0x88c2de,_0x50c164){var _0x5e5f18=_0x410004||client;return _0x5e5f18[_0xcf3d('0x1d')](_0x2b401e,_0x71e44b)[_0xcf3d('0x1e')](function(_0x5e4351){logger[_0xcf3d('0x1f')](_0xcf3d('0x20'),_0x196b1f,_0xcf3d('0x21'));logger[_0xcf3d('0x22')](_0xcf3d('0x23'),_0x196b1f,'request\x20sent',JSON['stringify'](_0x5e4351));if(_0x5e4351['error']){if(_0x5e4351['error'][_0xcf3d('0x24')]===0x1f4){logger[_0xcf3d('0x25')](_0xcf3d('0x20'),_0x196b1f,_0x5e4351['error']['message']);return _0x50c164(_0x5e4351[_0xcf3d('0x25')][_0xcf3d('0x26')]);}logger[_0xcf3d('0x25')](_0xcf3d('0x20'),_0x196b1f,_0x5e4351['error'][_0xcf3d('0x26')]);return _0x88c2de(_0x5e4351[_0xcf3d('0x25')][_0xcf3d('0x26')]);}else{logger[_0xcf3d('0x1f')](_0xcf3d('0x20'),_0x196b1f,_0xcf3d('0x21'));_0x88c2de(_0x5e4351['result']['message']);}})['catch'](function(_0x2f49f0){logger[_0xcf3d('0x25')](_0xcf3d('0x20'),_0x196b1f,_0x2f49f0);_0x50c164(_0x2f49f0);});});}function respondWithStatusCode(_0x33c9c8,_0x23c287){_0x23c287=_0x23c287||0xcc;return function(_0x3ceb68){if(_0x3ceb68){return _0x33c9c8[_0xcf3d('0x27')](_0x23c287);}return _0x33c9c8[_0xcf3d('0x28')](_0x23c287)[_0xcf3d('0x29')]();};}function respondWithResult(_0xfe2b5a,_0x2a2d66){_0x2a2d66=_0x2a2d66||0xc8;return function(_0x2184de){if(_0x2184de){return _0xfe2b5a[_0xcf3d('0x28')](_0x2a2d66)[_0xcf3d('0x2a')](_0x2184de);}};}function respondWithFilteredResult(_0x33f41f,_0x5771a4){return function(_0x1b4fc7){if(_0x1b4fc7){var _0x45a224=typeof _0x5771a4['offset']===_0xcf3d('0x2b')&&typeof _0x5771a4[_0xcf3d('0x2c')]===_0xcf3d('0x2b');var _0xd410fc=_0x1b4fc7[_0xcf3d('0x2d')];var _0x2b6dc5=_0x45a224?0x0:_0x5771a4['offset'];var _0xd0d7de=_0x45a224?_0x1b4fc7['count']:_0x5771a4[_0xcf3d('0x2e')]+_0x5771a4[_0xcf3d('0x2c')];var _0x4fe8aa;if(_0xd0d7de>=_0xd410fc){_0xd0d7de=_0xd410fc;_0x4fe8aa=0xc8;}else{_0x4fe8aa=0xce;}_0x33f41f[_0xcf3d('0x28')](_0x4fe8aa);return _0x33f41f['set'](_0xcf3d('0x2f'),_0x2b6dc5+'-'+_0xd0d7de+'/'+_0xd410fc)[_0xcf3d('0x2a')](_0x1b4fc7);}return null;};}function patchUpdates(_0x4d6d56){return function(_0x4e4c54){try{jsonpatch[_0xcf3d('0x30')](_0x4e4c54,_0x4d6d56,!![]);}catch(_0x382b28){return BPromise[_0xcf3d('0x31')](_0x382b28);}return _0x4e4c54[_0xcf3d('0x32')]();};}function saveUpdates(_0x55e40b,_0xb13269){return function(_0x460cc3){if(_0x460cc3){return _0x460cc3[_0xcf3d('0x33')](_0x55e40b)[_0xcf3d('0x1e')](function(_0x51eac8){return _0x51eac8;});}return null;};}function removeEntity(_0x32b5a5,_0x1b0190){return function(_0x14bbec){if(_0x14bbec){return _0x14bbec[_0xcf3d('0x34')]()[_0xcf3d('0x1e')](function(){var _0x15520b=_0x14bbec['get']({'plain':!![]});var _0xf63cf8=_0xcf3d('0x35');return db[_0xcf3d('0x36')][_0xcf3d('0x34')]({'where':{'type':_0xf63cf8,'resourceId':_0x15520b['id']}})[_0xcf3d('0x1e')](function(){return _0x14bbec;});})[_0xcf3d('0x1e')](function(){_0x32b5a5[_0xcf3d('0x28')](0xcc)[_0xcf3d('0x29')]();});}};}function handleEntityNotFound(_0xbae80d,_0x58a4a6){return function(_0x30e7ea){if(!_0x30e7ea){_0xbae80d[_0xcf3d('0x27')](0x194);}return _0x30e7ea;};}function handleError(_0x93b711,_0x2991af){_0x2991af=_0x2991af||0x1f4;return function(_0x17d6bf){logger[_0xcf3d('0x25')](_0x17d6bf['stack']);if(_0x17d6bf['name']){delete _0x17d6bf['name'];}_0x93b711['status'](_0x2991af)['send'](_0x17d6bf);};}exports[_0xcf3d('0x37')]=function(_0x2c89ab,_0x1b6ac4){var _0x4edcec={'include':[{'model':db[_0xcf3d('0x38')],'as':'mandatoryDispositionPause'}]},_0x26697b={},_0x4470fa={'count':0x0,'rows':[]};var _0x10012d=_['map'](db[_0xcf3d('0x39')][_0xcf3d('0x3a')],function(_0x18cc94){return{'name':_0x18cc94[_0xcf3d('0x3b')],'type':_0x18cc94[_0xcf3d('0x3c')][_0xcf3d('0x3d')]};});_0x26697b[_0xcf3d('0x3e')]=_['map'](_0x10012d,_0xcf3d('0x3f'));_0x26697b['query']=_[_0xcf3d('0x40')](_0x2c89ab[_0xcf3d('0x41')]);_0x26697b[_0xcf3d('0x42')]=_['intersection'](_0x26697b[_0xcf3d('0x3e')],_0x26697b[_0xcf3d('0x41')]);_0x4edcec[_0xcf3d('0x43')]=_[_0xcf3d('0x44')](_0x26697b[_0xcf3d('0x3e')],qs[_0xcf3d('0x45')](_0x2c89ab['query'][_0xcf3d('0x45')]));_0x4edcec['attributes']=_0x4edcec[_0xcf3d('0x43')][_0xcf3d('0x46')]?_0x4edcec[_0xcf3d('0x43')]:_0x26697b[_0xcf3d('0x3e')];if(!_0x2c89ab[_0xcf3d('0x41')]['hasOwnProperty'](_0xcf3d('0x47'))){_0x4edcec[_0xcf3d('0x2c')]=qs[_0xcf3d('0x2c')](_0x2c89ab[_0xcf3d('0x41')][_0xcf3d('0x2c')]);_0x4edcec[_0xcf3d('0x2e')]=qs[_0xcf3d('0x2e')](_0x2c89ab['query'][_0xcf3d('0x2e')]);}_0x4edcec['order']=qs[_0xcf3d('0x48')](_0x2c89ab[_0xcf3d('0x41')]['sort']);_0x4edcec['where']=qs[_0xcf3d('0x42')](_[_0xcf3d('0x49')](_0x2c89ab[_0xcf3d('0x41')],_0x26697b[_0xcf3d('0x42')]),_0x10012d);if(_0x2c89ab[_0xcf3d('0x41')][_0xcf3d('0x4a')]){_0x4edcec[_0xcf3d('0x4b')]=_[_0xcf3d('0x4c')](_0x4edcec[_0xcf3d('0x4b')],{'$or':_['map'](_0x10012d,function(_0x22ad3e){if(_0x22ad3e[_0xcf3d('0x3c')]!==_0xcf3d('0x4d')){var _0x26835e={};_0x26835e[_0x22ad3e['name']]={'$like':'%'+_0x2c89ab[_0xcf3d('0x41')][_0xcf3d('0x4a')]+'%'};return _0x26835e;}})});}_0x4edcec=_[_0xcf3d('0x4c')]({},_0x4edcec,_0x2c89ab[_0xcf3d('0x4e')]);var _0x532c82={'where':_0x4edcec[_0xcf3d('0x4b')]};return db[_0xcf3d('0x39')][_0xcf3d('0x2d')](_0x532c82)[_0xcf3d('0x1e')](function(_0x240280){_0x4470fa['count']=_0x240280;if(_0x2c89ab[_0xcf3d('0x41')][_0xcf3d('0x4f')]){_0x4edcec[_0xcf3d('0x50')]=[{'all':!![]}];}return db[_0xcf3d('0x39')][_0xcf3d('0x51')](_0x4edcec);})['then'](function(_0x4198e6){_0x4470fa[_0xcf3d('0x52')]=_0x4198e6;return _0x4470fa;})[_0xcf3d('0x1e')](respondWithFilteredResult(_0x1b6ac4,_0x4edcec))['catch'](handleError(_0x1b6ac4,null));};exports[_0xcf3d('0x53')]=function(_0x422cc0,_0x518cb7){var _0x22399c={'raw':![],'where':{'id':_0x422cc0[_0xcf3d('0x54')]['id']},'include':[{'model':db[_0xcf3d('0x38')],'as':_0xcf3d('0x55')}]},_0x4ec3b1={};_0x4ec3b1['model']=_[_0xcf3d('0x40')](db[_0xcf3d('0x39')][_0xcf3d('0x3a')]);_0x4ec3b1[_0xcf3d('0x41')]=_[_0xcf3d('0x40')](_0x422cc0[_0xcf3d('0x41')]);_0x4ec3b1['filters']=_['intersection'](_0x4ec3b1[_0xcf3d('0x3e')],_0x4ec3b1[_0xcf3d('0x41')]);_0x22399c[_0xcf3d('0x43')]=_[_0xcf3d('0x44')](_0x4ec3b1['model'],qs['fields'](_0x422cc0[_0xcf3d('0x41')]['fields']));_0x22399c[_0xcf3d('0x43')]=_0x22399c[_0xcf3d('0x43')]['length']?_0x22399c[_0xcf3d('0x43')]:_0x4ec3b1['model'];if(_0x422cc0[_0xcf3d('0x41')]['includeAll']){_0x22399c['include']=[{'all':!![]}];}_0x22399c=_[_0xcf3d('0x4c')]({},_0x22399c,_0x422cc0[_0xcf3d('0x4e')]);return db['OpenchannelAccount'][_0xcf3d('0x56')](_0x22399c)[_0xcf3d('0x1e')](handleEntityNotFound(_0x518cb7,null))[_0xcf3d('0x1e')](respondWithResult(_0x518cb7,null))[_0xcf3d('0x57')](handleError(_0x518cb7,null));};exports['create']=function(_0x23f268,_0x40ec1b){return db[_0xcf3d('0x39')][_0xcf3d('0x58')](_0x23f268[_0xcf3d('0x59')],{})['then'](function(_0x206f17){var _0x571409=_0x23f268[_0xcf3d('0x5a')][_0xcf3d('0x5b')]({'plain':!![]});if(!_0x571409)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x571409['role']==='user'){var _0xbc8d82=_0x206f17[_0xcf3d('0x5b')]({'plain':!![]});var _0xcbfb0c=_0xcf3d('0x35');return db[_0xcf3d('0x5c')][_0xcf3d('0x56')]({'where':{'name':_0xcbfb0c,'userProfileId':_0x571409[_0xcf3d('0x5d')]},'raw':!![]})[_0xcf3d('0x1e')](function(_0x571cbb){if(_0x571cbb&&_0x571cbb[_0xcf3d('0x5e')]===0x0){return db['UserProfileResource'][_0xcf3d('0x58')]({'name':_0xbc8d82[_0xcf3d('0x3f')],'resourceId':_0xbc8d82['id'],'type':_0x571cbb[_0xcf3d('0x3f')],'sectionId':_0x571cbb['id']},{})[_0xcf3d('0x1e')](function(){return _0x206f17;});}else{return _0x206f17;}})['catch'](function(_0x1cd1db){logger['error'](_0xcf3d('0x5f'),_0x1cd1db);throw _0x1cd1db;});}return _0x206f17;})['then'](respondWithResult(_0x40ec1b,0xc9))[_0xcf3d('0x57')](handleError(_0x40ec1b,null));};exports[_0xcf3d('0x33')]=function(_0x3c3180,_0x319177){if(_0x3c3180['body']['id']){delete _0x3c3180[_0xcf3d('0x59')]['id'];}return db[_0xcf3d('0x39')][_0xcf3d('0x56')]({'where':{'id':_0x3c3180[_0xcf3d('0x54')]['id']},'include':[{'model':db[_0xcf3d('0x38')],'as':_0xcf3d('0x55')}]})[_0xcf3d('0x1e')](handleEntityNotFound(_0x319177,null))[_0xcf3d('0x1e')](saveUpdates(_0x3c3180[_0xcf3d('0x59')],null))[_0xcf3d('0x1e')](respondWithResult(_0x319177,null))[_0xcf3d('0x57')](handleError(_0x319177,null));};exports[_0xcf3d('0x34')]=function(_0x11c24c,_0x3775bd){return db['OpenchannelAccount'][_0xcf3d('0x56')]({'where':{'id':_0x11c24c[_0xcf3d('0x54')]['id']}})[_0xcf3d('0x1e')](handleEntityNotFound(_0x3775bd,null))['then'](removeEntity(_0x3775bd,null))[_0xcf3d('0x57')](handleError(_0x3775bd,null));};exports[_0xcf3d('0x60')]=function(_0x4ec9bd,_0x48ba09){return db[_0xcf3d('0x39')]['describe']()['then'](respondWithResult(_0x48ba09,null))[_0xcf3d('0x57')](handleError(_0x48ba09,null));};exports[_0xcf3d('0x61')]=function(_0x43a853,_0x207411,_0x3b3938){if(_0x43a853[_0xcf3d('0x59')]['id']){delete _0x43a853['body']['id'];}return db[_0xcf3d('0x39')]['find']({'where':{'id':_0x43a853[_0xcf3d('0x54')]['id']}})[_0xcf3d('0x1e')](handleEntityNotFound(_0x207411,null))[_0xcf3d('0x1e')](function(_0x14bfa7){if(_0x14bfa7){_0x43a853['body'][_0xcf3d('0x62')]=_0x14bfa7['id'];return db[_0xcf3d('0x63')][_0xcf3d('0x58')](_0x43a853['body']);}})[_0xcf3d('0x1e')](respondWithResult(_0x207411,null))[_0xcf3d('0x57')](handleError(_0x207411,null));};exports[_0xcf3d('0x64')]=function(_0x195523,_0x1e0a17,_0x21c33d){var _0xaf0b55={'raw':![],'where':{}};var _0xe6972={};var _0xe3703f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xcf3d('0x65')]({'where':{'id':_0x195523['params']['id']}})[_0xcf3d('0x1e')](handleEntityNotFound(_0x1e0a17,null))[_0xcf3d('0x1e')](function(_0x55ef6c){if(_0x55ef6c){_0xe6972[_0xcf3d('0x3e')]=_[_0xcf3d('0x40')](db['Disposition']['rawAttributes']);_0xe6972['query']=_['keys'](_0x195523[_0xcf3d('0x41')]);_0xe6972[_0xcf3d('0x42')]=_[_0xcf3d('0x44')](_0xe6972[_0xcf3d('0x3e')],_0xe6972['query']);_0xaf0b55[_0xcf3d('0x43')]=_[_0xcf3d('0x44')](_0xe6972[_0xcf3d('0x3e')],qs[_0xcf3d('0x45')](_0x195523[_0xcf3d('0x41')][_0xcf3d('0x45')]));_0xaf0b55[_0xcf3d('0x43')]=_0xaf0b55[_0xcf3d('0x43')]['length']?_0xaf0b55[_0xcf3d('0x43')]:_0xe6972[_0xcf3d('0x3e')];if(!_0x195523['query'][_0xcf3d('0x66')](_0xcf3d('0x47'))){_0xaf0b55['limit']=qs[_0xcf3d('0x2c')](_0x195523[_0xcf3d('0x41')][_0xcf3d('0x2c')]);_0xaf0b55['offset']=qs[_0xcf3d('0x2e')](_0x195523[_0xcf3d('0x41')][_0xcf3d('0x2e')]);}_0xaf0b55['order']=qs['sort'](_0x195523[_0xcf3d('0x41')]['sort']);_0xaf0b55[_0xcf3d('0x4b')]=qs[_0xcf3d('0x42')](_['pick'](_0x195523[_0xcf3d('0x41')],_0xe6972[_0xcf3d('0x42')]));_0xaf0b55[_0xcf3d('0x4b')]['OpenchannelAccountId']=_0x55ef6c['id'];if(_0x195523[_0xcf3d('0x41')]['filter']){_0xaf0b55[_0xcf3d('0x4b')]=_[_0xcf3d('0x4c')](_0xaf0b55[_0xcf3d('0x4b')],{'$or':_['map'](_0xaf0b55['attributes'],function(_0x5bf8c2){var _0x418ba2={};_0x418ba2[_0x5bf8c2]={'$like':'%'+_0x195523[_0xcf3d('0x41')][_0xcf3d('0x4a')]+'%'};return _0x418ba2;})});}_0xaf0b55=_[_0xcf3d('0x4c')]({},_0xaf0b55,_0x195523[_0xcf3d('0x4e')]);return db['Disposition'][_0xcf3d('0x2d')]({'where':_0xaf0b55[_0xcf3d('0x4b')]})['then'](function(_0x385f7f){_0xe3703f['count']=_0x385f7f;if(_0x195523[_0xcf3d('0x41')][_0xcf3d('0x4f')]){_0xaf0b55[_0xcf3d('0x50')]=[{'all':!![]}];}return db[_0xcf3d('0x63')][_0xcf3d('0x51')](_0xaf0b55);})[_0xcf3d('0x1e')](function(_0xe24493){_0xe3703f[_0xcf3d('0x52')]=_0xe24493;return _0xe3703f;});}})[_0xcf3d('0x1e')](respondWithFilteredResult(_0x1e0a17,_0xaf0b55))[_0xcf3d('0x57')](handleError(_0x1e0a17,null));};exports[_0xcf3d('0x67')]=function(_0x27b0cf,_0x1d3e13,_0x191399){return db[_0xcf3d('0x39')][_0xcf3d('0x56')]({'where':{'id':_0x27b0cf[_0xcf3d('0x54')]['id']}})[_0xcf3d('0x1e')](handleEntityNotFound(_0x1d3e13,null))[_0xcf3d('0x1e')](function(_0x3e7581){if(_0x3e7581){return _0x3e7581['removeDispositions'](_0x27b0cf[_0xcf3d('0x41')]['ids']);}})[_0xcf3d('0x1e')](respondWithStatusCode(_0x1d3e13,null))['catch'](handleError(_0x1d3e13,null));};exports[_0xcf3d('0x68')]=function(_0x38ed3a,_0x369bd3,_0x14f4fb){if(_0x38ed3a[_0xcf3d('0x59')]['id']){delete _0x38ed3a[_0xcf3d('0x59')]['id'];}return db[_0xcf3d('0x39')][_0xcf3d('0x56')]({'where':{'id':_0x38ed3a[_0xcf3d('0x54')]['id']}})[_0xcf3d('0x1e')](handleEntityNotFound(_0x369bd3,null))[_0xcf3d('0x1e')](function(_0x4974a1){if(_0x4974a1){_0x38ed3a[_0xcf3d('0x59')][_0xcf3d('0x62')]=_0x4974a1['id'];return db[_0xcf3d('0x69')][_0xcf3d('0x58')](_0x38ed3a[_0xcf3d('0x59')]);}})[_0xcf3d('0x1e')](respondWithResult(_0x369bd3,null))['catch'](handleError(_0x369bd3,null));};exports['getAnswers']=function(_0x115586,_0x16f92e,_0x402563){var _0x42fec4={'raw':![],'where':{}};var _0x5dc88c={};var _0xb75a54={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xcf3d('0x65')]({'where':{'id':_0x115586[_0xcf3d('0x54')]['id']}})[_0xcf3d('0x1e')](handleEntityNotFound(_0x16f92e,null))[_0xcf3d('0x1e')](function(_0x520bf7){if(_0x520bf7){_0x5dc88c['model']=_[_0xcf3d('0x40')](db['CannedAnswer'][_0xcf3d('0x3a')]);_0x5dc88c[_0xcf3d('0x41')]=_[_0xcf3d('0x40')](_0x115586[_0xcf3d('0x41')]);_0x5dc88c[_0xcf3d('0x42')]=_[_0xcf3d('0x44')](_0x5dc88c['model'],_0x5dc88c[_0xcf3d('0x41')]);_0x42fec4[_0xcf3d('0x43')]=_['intersection'](_0x5dc88c[_0xcf3d('0x3e')],qs['fields'](_0x115586[_0xcf3d('0x41')][_0xcf3d('0x45')]));_0x42fec4[_0xcf3d('0x43')]=_0x42fec4[_0xcf3d('0x43')][_0xcf3d('0x46')]?_0x42fec4['attributes']:_0x5dc88c[_0xcf3d('0x3e')];if(!_0x115586[_0xcf3d('0x41')][_0xcf3d('0x66')](_0xcf3d('0x47'))){_0x42fec4['limit']=qs[_0xcf3d('0x2c')](_0x115586['query'][_0xcf3d('0x2c')]);_0x42fec4[_0xcf3d('0x2e')]=qs[_0xcf3d('0x2e')](_0x115586[_0xcf3d('0x41')][_0xcf3d('0x2e')]);}_0x42fec4[_0xcf3d('0x6a')]=qs['sort'](_0x115586['query'][_0xcf3d('0x48')]);_0x42fec4[_0xcf3d('0x4b')]=qs[_0xcf3d('0x42')](_[_0xcf3d('0x49')](_0x115586['query'],_0x5dc88c['filters']));_0x42fec4[_0xcf3d('0x4b')]['OpenchannelAccountId']=_0x520bf7['id'];if(_0x115586[_0xcf3d('0x41')][_0xcf3d('0x4a')]){_0x42fec4['where']=_[_0xcf3d('0x4c')](_0x42fec4['where'],{'$or':_[_0xcf3d('0x6b')](_0x42fec4[_0xcf3d('0x43')],function(_0x42994f){var _0x5b2914={};_0x5b2914[_0x42994f]={'$like':'%'+_0x115586[_0xcf3d('0x41')][_0xcf3d('0x4a')]+'%'};return _0x5b2914;})});}_0x42fec4=_[_0xcf3d('0x4c')]({},_0x42fec4,_0x115586[_0xcf3d('0x4e')]);return db['CannedAnswer'][_0xcf3d('0x2d')]({'where':_0x42fec4[_0xcf3d('0x4b')]})[_0xcf3d('0x1e')](function(_0x1dc814){_0xb75a54[_0xcf3d('0x2d')]=_0x1dc814;if(_0x115586['query'][_0xcf3d('0x4f')]){_0x42fec4[_0xcf3d('0x50')]=[{'all':!![]}];}return db[_0xcf3d('0x69')][_0xcf3d('0x51')](_0x42fec4);})[_0xcf3d('0x1e')](function(_0x2bf8c0){_0xb75a54[_0xcf3d('0x52')]=_0x2bf8c0;return _0xb75a54;});}})[_0xcf3d('0x1e')](respondWithFilteredResult(_0x16f92e,_0x42fec4))[_0xcf3d('0x57')](handleError(_0x16f92e,null));};exports[_0xcf3d('0x6c')]=function(_0x2b007e,_0x14e8b8,_0xc0d38e){return db['OpenchannelAccount'][_0xcf3d('0x56')]({'where':{'id':_0x2b007e[_0xcf3d('0x54')]['id']}})[_0xcf3d('0x1e')](handleEntityNotFound(_0x14e8b8,null))['then'](function(_0x2b7c28){if(_0x2b7c28){return _0x2b7c28[_0xcf3d('0x6c')](_0x2b007e[_0xcf3d('0x41')][_0xcf3d('0x6d')]);}})[_0xcf3d('0x1e')](respondWithStatusCode(_0x14e8b8,null))[_0xcf3d('0x57')](handleError(_0x14e8b8,null));};exports['notify']=function(_0x54c663,_0x2d7984,_0x190415){var _0x127435={'body':_0x54c663['body'],'channel':_0xcf3d('0x6e')};var _0x286e1d=[];var _0x17f158=[];var _0x5b79c4={};var _0x43511f=![];return db[_0xcf3d('0x6f')][_0xcf3d('0x60')]()[_0xcf3d('0x1e')](function(_0x4f7b28){if(!_0x4f7b28){throw new db[(_0xcf3d('0x70'))][(_0xcf3d('0x71'))](_0xcf3d('0x72'));}_0x286e1d=_[_0xcf3d('0x73')](_['keys'](_0x4f7b28),[_0xcf3d('0x74'),_0xcf3d('0x75')]);_0x17f158=_['difference'](_[_0xcf3d('0x40')](_0x4f7b28),[_0xcf3d('0x74'),_0xcf3d('0x75'),_0xcf3d('0x76'),_0xcf3d('0x77')]);if(_0x54c663['body']['id']){delete _0x54c663[_0xcf3d('0x59')]['id'];}if(_[_0xcf3d('0x78')](_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x79')])){throw new db['Sequelize'][(_0xcf3d('0x71'))](_0xcf3d('0x7a'));}if(_[_0xcf3d('0x78')](_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x59')])||_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x59')]===''){throw new db[(_0xcf3d('0x70'))][(_0xcf3d('0x71'))](_0xcf3d('0x7b'));}if(_['isNil'](_0x54c663[_0xcf3d('0x59')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x17f158);}if(!_[_0xcf3d('0x7c')](_0x17f158,_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x7d')])){throw new db[(_0xcf3d('0x70'))]['ValidationError'](_0xcf3d('0x7e')+_0x17f158);}_0x5b79c4[_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x7d')]]=_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x79')];})['then'](function(){return db[_0xcf3d('0x39')]['find']({'where':{'id':_0x54c663[_0xcf3d('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0xcf3d('0x7f'),'include':[{'model':db[_0xcf3d('0x6f')],'as':_0xcf3d('0x80'),'where':_0x5b79c4,'limit':0x1,'order':[[_0xcf3d('0x75'),_0xcf3d('0x81')]]}]},{'model':db[_0xcf3d('0x82')],'as':_0xcf3d('0x83')}]});})[_0xcf3d('0x1e')](handleEntityNotFound(_0x2d7984,null))[_0xcf3d('0x1e')](function(_0x150c17){if(_0x150c17&&_0x150c17[_0xcf3d('0x7f')]){_0x127435[_0xcf3d('0x84')]=_0x150c17;_0x127435[_0xcf3d('0x85')]=_0x150c17[_0xcf3d('0x83')];_0x127435[_0xcf3d('0x86')]=_0x150c17['List'];_0x127435[_0xcf3d('0x85')]=_['orderBy'](_0x127435[_0xcf3d('0x85')],[_0xcf3d('0x87')],[_0xcf3d('0x88')]);if(_0x127435[_0xcf3d('0x84')][_0xcf3d('0x83')]){delete _0x127435[_0xcf3d('0x84')]['Applications'];}if(_0x127435[_0xcf3d('0x84')][_0xcf3d('0x7f')]&&_0x127435[_0xcf3d('0x84')]['List']['Contacts'][_0xcf3d('0x46')]){return _0x127435['account']['List']['Contacts'][0x0];}var _0x20f5ab=_[_0xcf3d('0x17')](_0x54c663[_0xcf3d('0x59')],{'firstName':_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x79')],'ListId':_0x150c17['ListId']});_0x20f5ab[_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x7d')]]=_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x79')];return db['CmContact'][_0xcf3d('0x58')](_0x20f5ab,{'fields':_0x286e1d,'raw':!![]});}})['then'](handleEntityNotFound(_0x2d7984,null))['then'](function(_0x4b6cb6){_0x127435['contact']=_0x4b6cb6;if(_0x4b6cb6){var _0x53fe05={'ContactId':_0x4b6cb6['id'],'OpenchannelAccountId':_0x54c663[_0xcf3d('0x54')]['id'],'from':(_0x4b6cb6[_0xcf3d('0x89')]||'')+'\x20'+(_0x4b6cb6[_0xcf3d('0x8a')]||'')};var _0x2a609f={'OpenchannelAccountId':_0x54c663['params']['id'],'closed':![]};if(_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x8b')]){_0x2a609f[_0xcf3d('0x8b')]=_0x54c663[_0xcf3d('0x59')]['threadId'];return db[_0xcf3d('0x8c')]['find']({'where':_0x2a609f})[_0xcf3d('0x1e')](function(_0x9242d1){if(_0x9242d1){return[_0x9242d1,![]];}_0x53fe05[_0xcf3d('0x8b')]=_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x8b')];_0x53fe05[_0xcf3d('0x8d')]=_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x8d')];return db[_0xcf3d('0x8c')][_0xcf3d('0x58')](_0x53fe05)[_0xcf3d('0x1e')](function(_0x477c64){return[_0x477c64,!![]];});});}else{_0x2a609f[_0xcf3d('0x8b')]=null;}_0x2a609f[_0xcf3d('0x8e')]=_0x4b6cb6['id'];return db[_0xcf3d('0x8c')]['find']({'where':_0x2a609f})['then'](function(_0x5abaf9){if(_0x5abaf9){return[_0x5abaf9,![]];}return db[_0xcf3d('0x8c')][_0xcf3d('0x58')](_0x53fe05)[_0xcf3d('0x1e')](function(_0x18abc9){return[_0x18abc9,!![]];});});}})[_0xcf3d('0x8f')](function(_0x57136f,_0x35ba08){if(_0x57136f){_0x43511f=_0x35ba08;if(!_0x35ba08){var _0x4ec96b={'from':(_0x127435[_0xcf3d('0x90')][_0xcf3d('0x89')]||'')+'\x20'+(_0x127435[_0xcf3d('0x90')][_0xcf3d('0x8a')]||'')};if(_0x54c663[_0xcf3d('0x59')]['threadId']&&_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x91')]&&_0x54c663[_0xcf3d('0x59')]['threadId']!=_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x91')]){_0x4ec96b[_0xcf3d('0x8b')]=_0x54c663[_0xcf3d('0x59')][_0xcf3d('0x91')];}return _0x57136f[_0xcf3d('0x33')](_0x4ec96b);}else{return _0x57136f;}}})['then'](function(_0x4044b1){_0x127435[_0xcf3d('0x92')]=_0x4044b1[_0xcf3d('0x5b')]({'plain':!![]});_0x127435['interaction'][_0xcf3d('0x93')]=_0x43511f;if(_0x127435['interaction'][_0xcf3d('0x93')]){if(_0x127435[_0xcf3d('0x84')]['autoclose']){_0x127435[_0xcf3d('0x85')]['push']({'id':0x0,'priority':_0x127435['applications'][_0xcf3d('0x46')]+0x1,'app':'close','appdata':_0xcf3d('0x94'),'interval':_0xcf3d('0x95')});}}return db[_0xcf3d('0x96')][_0xcf3d('0x58')]({'body':_0x54c663[_0xcf3d('0x59')]['body'],'OpenchannelAccountId':_0x54c663[_0xcf3d('0x54')]['id'],'OpenchannelInteractionId':_0x4044b1['id'],'direction':'in','ContactId':_0x127435[_0xcf3d('0x90')]['id'],'AttachmentId':_0x54c663['body'][_0xcf3d('0x97')]});})[_0xcf3d('0x1e')](function(_0x393ad8){_0x127435[_0xcf3d('0x26')]=_0x393ad8;if(_0x127435['interaction'][_0xcf3d('0x98')]){return db[_0xcf3d('0x99')]['find']({'attributes':['id',_0xcf3d('0x3f')],'where':{'id':_0x127435[_0xcf3d('0x92')][_0xcf3d('0x98')]}})[_0xcf3d('0x1e')](function(_0x803e46){if(_0x803e46){_0x127435['applications'][_0xcf3d('0x9a')]({'id':0x0,'priority':0x0,'app':_0xcf3d('0x9b'),'appdata':_0x803e46[_0xcf3d('0x3f')]+','+(_0x127435[_0xcf3d('0x84')][_0xcf3d('0x9c')]||0xa),'interval':_0xcf3d('0x95')});_0x127435[_0xcf3d('0x9d')]=![];}return respondWithRpcPromise(_0xcf3d('0x9e'),'startRouting',_0x127435);});}return respondWithRpcPromise(_0xcf3d('0x9e'),'startRouting',_0x127435);})[_0xcf3d('0x1e')](function(_0x5bada7){respondWithRpcPromise(_0xcf3d('0x9f'),_0xcf3d('0x9f'),{'event':'notify','message':_0x5bada7},client9002);return _0x5bada7;})[_0xcf3d('0x1e')](respondWithResult(_0x2d7984,null))[_0xcf3d('0x57')](handleError(_0x2d7984,null));};exports[_0xcf3d('0xa0')]=function(_0x19f0e7,_0x335e1a){var _0x5f0e45=_0x19f0e7[_0xcf3d('0x54')]['id'];var _0x487631=_0x19f0e7[_0xcf3d('0x59')];var _0x334f3d=0xc8;var _0x491d42=null;return db[_0xcf3d('0xa1')][_0xcf3d('0xa2')]({'isolationLevel':db[_0xcf3d('0xa1')][_0xcf3d('0xa3')]['ISOLATION_LEVELS'][_0xcf3d('0xa4')]},function(_0x59d003){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5f0e45},'transaction':_0x59d003})[_0xcf3d('0x1e')](function(_0x45cb02){if(_0x45cb02){return db[_0xcf3d('0x82')][_0xcf3d('0x34')]({'where':{'OpenchannelAccountId':_0x5f0e45},'transaction':_0x59d003})[_0xcf3d('0x1e')](function(){var _0x2d256e=_[_0xcf3d('0x6b')](_0x487631,function(_0x4513c2){_0x4513c2[_0xcf3d('0x62')]=_0x5f0e45;return _0x4513c2;});return db[_0xcf3d('0x82')][_0xcf3d('0xa5')](_0x2d256e,{'transaction':_0x59d003});});}else{_0x334f3d=0x194;_0x491d42=[];}});})[_0xcf3d('0x1e')](function(){if(_0x334f3d!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x5f0e45},'order':'priority'})[_0xcf3d('0x1e')](function(_0x3ef6fa){_0x491d42=_0x3ef6fa;});}})[_0xcf3d('0x57')](function(_0x4d404a){_0x334f3d=0x1f4;logger[_0xcf3d('0x25')](_0x4d404a[_0xcf3d('0xa6')]);if(_0x4d404a[_0xcf3d('0x3f')]){delete _0x4d404a[_0xcf3d('0x3f')];}_0x491d42=_0x4d404a;})[_0xcf3d('0xa7')](function(){if(_0x491d42===null){_0x335e1a[_0xcf3d('0x27')](_0x334f3d);}else{if(_0x334f3d===0x1f4){_0x335e1a[_0xcf3d('0x28')](_0x334f3d)[_0xcf3d('0xa8')](_0x491d42);}else{_0x335e1a[_0xcf3d('0x28')](_0x334f3d)['json'](_0x491d42);}}});};exports[_0xcf3d('0xa9')]=function(_0x19a312,_0x274f49,_0x2f0e23){var _0x5f7c00={};var _0x1b4bd9={};var _0xdfd690;var _0x50ffb0;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x19a312[_0xcf3d('0x54')]['id']}})[_0xcf3d('0x1e')](handleEntityNotFound(_0x274f49,null))[_0xcf3d('0x1e')](function(_0x557d22){if(_0x557d22){_0xdfd690=_0x557d22;_0x1b4bd9[_0xcf3d('0x3e')]=_[_0xcf3d('0x40')](db[_0xcf3d('0x82')][_0xcf3d('0x3a')]);_0x1b4bd9[_0xcf3d('0x41')]=_[_0xcf3d('0x40')](_0x19a312[_0xcf3d('0x41')]);_0x1b4bd9[_0xcf3d('0x42')]=_['intersection'](_0x1b4bd9['model'],_0x1b4bd9[_0xcf3d('0x41')]);_0x5f7c00[_0xcf3d('0x43')]=_[_0xcf3d('0x44')](_0x1b4bd9[_0xcf3d('0x3e')],qs[_0xcf3d('0x45')](_0x19a312[_0xcf3d('0x41')]['fields']));_0x5f7c00[_0xcf3d('0x43')]=_0x5f7c00[_0xcf3d('0x43')][_0xcf3d('0x46')]?_0x5f7c00['attributes']:_0x1b4bd9[_0xcf3d('0x3e')];_0x5f7c00[_0xcf3d('0x6a')]=qs[_0xcf3d('0x48')](_0x19a312[_0xcf3d('0x41')]['sort']);_0x5f7c00[_0xcf3d('0x4b')]=qs['filters'](_[_0xcf3d('0x49')](_0x19a312['query'],_0x1b4bd9[_0xcf3d('0x42')]));if(_0x19a312['query'][_0xcf3d('0x4a')]){_0x5f7c00['where']=_[_0xcf3d('0x4c')](_0x5f7c00[_0xcf3d('0x4b')],{'$or':_['map'](_0x5f7c00[_0xcf3d('0x43')],function(_0x1bb359){var _0x30cb31={};_0x30cb31[_0x1bb359]={'$like':'%'+_0x19a312[_0xcf3d('0x41')][_0xcf3d('0x4a')]+'%'};return _0x30cb31;})});}_0x5f7c00=_[_0xcf3d('0x4c')]({},_0x5f7c00,_0x19a312[_0xcf3d('0x4e')]);return _0xdfd690[_0xcf3d('0xa9')](_0x5f7c00);}})[_0xcf3d('0x1e')](function(_0x46b27b){if(_0x46b27b){_0x50ffb0=_0x46b27b[_0xcf3d('0x46')];if(!_0x19a312[_0xcf3d('0x41')]['hasOwnProperty'](_0xcf3d('0x47'))){_0x5f7c00[_0xcf3d('0x2c')]=qs[_0xcf3d('0x2c')](_0x19a312[_0xcf3d('0x41')]['limit']);_0x5f7c00[_0xcf3d('0x2e')]=qs[_0xcf3d('0x2e')](_0x19a312['query']['offset']);}return _0xdfd690['getApplications'](_0x5f7c00);}})[_0xcf3d('0x1e')](function(_0x92103d){if(_0x92103d){return _0x92103d?{'count':_0x50ffb0,'rows':_0x92103d}:null;}})[_0xcf3d('0x1e')](respondWithResult(_0x274f49,null))['catch'](handleError(_0x274f49,null));};exports[_0xcf3d('0xaa')]=function(_0x451c7c,_0x1d2f06,_0x8534e1){var _0x23a9ef={'raw':![],'where':{}};var _0x47df0c={};var _0x35eb02={'count':0x0,'rows':[]};return db[_0xcf3d('0x39')]['findOne']({'where':{'id':_0x451c7c[_0xcf3d('0x54')]['id']}})[_0xcf3d('0x1e')](handleEntityNotFound(_0x1d2f06,null))['then'](function(_0x8ee705){if(_0x8ee705){_0x47df0c['model']=_['keys'](db[_0xcf3d('0x8c')][_0xcf3d('0x3a')]);_0x47df0c['query']=_[_0xcf3d('0x40')](_0x451c7c[_0xcf3d('0x41')]);_0x47df0c['filters']=_[_0xcf3d('0x44')](_0x47df0c[_0xcf3d('0x3e')],_0x47df0c[_0xcf3d('0x41')]);_0x23a9ef[_0xcf3d('0x43')]=_[_0xcf3d('0x44')](_0x47df0c[_0xcf3d('0x3e')],qs[_0xcf3d('0x45')](_0x451c7c['query']['fields']));_0x23a9ef[_0xcf3d('0x43')]=_0x23a9ef[_0xcf3d('0x43')]['length']?_0x23a9ef[_0xcf3d('0x43')]:_0x47df0c[_0xcf3d('0x3e')];if(!_0x451c7c[_0xcf3d('0x41')][_0xcf3d('0x66')](_0xcf3d('0x47'))){_0x23a9ef[_0xcf3d('0x2c')]=qs[_0xcf3d('0x2c')](_0x451c7c[_0xcf3d('0x41')]['limit']);_0x23a9ef[_0xcf3d('0x2e')]=qs[_0xcf3d('0x2e')](_0x451c7c[_0xcf3d('0x41')][_0xcf3d('0x2e')]);}_0x23a9ef[_0xcf3d('0x6a')]=qs['sort'](_0x451c7c[_0xcf3d('0x41')][_0xcf3d('0x48')]);_0x23a9ef[_0xcf3d('0x4b')]=qs[_0xcf3d('0x42')](_[_0xcf3d('0x49')](_0x451c7c[_0xcf3d('0x41')],_0x47df0c['filters']));_0x23a9ef[_0xcf3d('0x4b')][_0xcf3d('0x62')]=_0x8ee705['id'];if(_0x451c7c[_0xcf3d('0x41')]['filter']){_0x23a9ef[_0xcf3d('0x4b')]=_['merge'](_0x23a9ef[_0xcf3d('0x4b')],{'$or':_[_0xcf3d('0x6b')](_0x23a9ef[_0xcf3d('0x43')],function(_0x2eb5c5){var _0x1f2efb={};_0x1f2efb[_0x2eb5c5]={'$like':'%'+_0x451c7c[_0xcf3d('0x41')][_0xcf3d('0x4a')]+'%'};return _0x1f2efb;})});}_0x23a9ef=_['merge']({},_0x23a9ef,_0x451c7c[_0xcf3d('0x4e')]);return db['OpenchannelInteraction'][_0xcf3d('0x2d')]({'where':_0x23a9ef[_0xcf3d('0x4b')]})['then'](function(_0xf30dd6){_0x35eb02[_0xcf3d('0x2d')]=_0xf30dd6;if(_0x451c7c[_0xcf3d('0x41')]['includeAll']){_0x23a9ef['include']=[{'model':db['CmContact'],'as':_0xcf3d('0xab'),'required':![]},{'model':db[_0xcf3d('0x99')],'as':_0xcf3d('0xac'),'attributes':['name','fullname',_0xcf3d('0xad')],'required':![]},{'model':db[_0xcf3d('0xae')],'as':_0xcf3d('0xaf'),'attributes':['id',_0xcf3d('0x3f'),_0xcf3d('0xb0')],'where':_0x451c7c[_0xcf3d('0x41')][_0xcf3d('0xb1')]?{'id':_0x451c7c[_0xcf3d('0x41')][_0xcf3d('0xb1')]}:undefined,'required':_0x451c7c[_0xcf3d('0x41')][_0xcf3d('0xb1')]?!![]:![]}];}return db[_0xcf3d('0x8c')]['findAll'](_0x23a9ef);})[_0xcf3d('0x1e')](function(_0x5f0e82){_0x35eb02[_0xcf3d('0x52')]=_0x5f0e82;return _0x35eb02;});}})[_0xcf3d('0x1e')](respondWithFilteredResult(_0x1d2f06,_0x23a9ef))[_0xcf3d('0x57')](handleError(_0x1d2f06,null));};exports[_0xcf3d('0xb2')]=function(_0x18f395,_0x18c0e4,_0x39907b){return db[_0xcf3d('0x39')][_0xcf3d('0x56')]({'where':{'id':_0x18f395[_0xcf3d('0x54')]['id']}})[_0xcf3d('0x1e')](handleEntityNotFound(_0x18c0e4,null))[_0xcf3d('0x1e')](function(_0x4f4004){if(_0x4f4004){return _0x4f4004[_0xcf3d('0xb2')](_0x18f395[_0xcf3d('0x59')][_0xcf3d('0x6d')],_[_0xcf3d('0xb3')](_0x18f395[_0xcf3d('0x59')],['ids','id'])||{})[_0xcf3d('0x8f')](function(_0x214e9e){for(var _0x31d6b0=0x0;_0x31d6b0<_0x18f395[_0xcf3d('0x59')][_0xcf3d('0x6d')][_0xcf3d('0x46')];_0x31d6b0+=0x1){socket['emit'](_0xcf3d('0xb4'),{'UserId':Number(_0x18f395[_0xcf3d('0x59')][_0xcf3d('0x6d')][_0x31d6b0]),'OpenchannelAccountId':Number(_0x18f395[_0xcf3d('0x54')]['id'])});}return _0x214e9e;});}})[_0xcf3d('0x1e')](respondWithResult(_0x18c0e4,null))['catch'](handleError(_0x18c0e4,null));};exports[_0xcf3d('0xb5')]=function(_0x30ebf2,_0x1136da,_0x2ced2e){return db[_0xcf3d('0x39')][_0xcf3d('0x56')]({'where':{'id':_0x30ebf2[_0xcf3d('0x54')]['id']}})['then'](handleEntityNotFound(_0x1136da,null))['then'](function(_0x1c5606){if(_0x1c5606){return _0x1c5606['removeAgents'](_0x30ebf2[_0xcf3d('0x41')][_0xcf3d('0x6d')])[_0xcf3d('0x1e')](function(){if(_['isArray'](_0x30ebf2[_0xcf3d('0x41')][_0xcf3d('0x6d')])){for(var _0x52e990=0x0;_0x52e990<_0x30ebf2[_0xcf3d('0x41')][_0xcf3d('0x6d')]['length'];_0x52e990+=0x1){socket[_0xcf3d('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x30ebf2[_0xcf3d('0x41')][_0xcf3d('0x6d')][_0x52e990]),'OpenchannelAccountId':Number(_0x30ebf2['params']['id'])});}}else{socket[_0xcf3d('0xb6')](_0xcf3d('0xb7'),{'UserId':Number(_0x30ebf2['query'][_0xcf3d('0x6d')]),'OpenchannelAccountId':Number(_0x30ebf2[_0xcf3d('0x54')]['id'])});}});}})[_0xcf3d('0x1e')](respondWithStatusCode(_0x1136da,null))[_0xcf3d('0x57')](handleError(_0x1136da,null));};exports[_0xcf3d('0xb8')]=function(_0x4f1fd2,_0x3ed13e,_0x5ccd1){var _0x50e7dd={};var _0x559dae={};var _0x25aed5;var _0x58f639;return db[_0xcf3d('0x39')][_0xcf3d('0x65')]({'where':{'id':_0x4f1fd2[_0xcf3d('0x54')]['id']}})['then'](handleEntityNotFound(_0x3ed13e,null))[_0xcf3d('0x1e')](function(_0x33ccce){if(_0x33ccce){_0x25aed5=_0x33ccce;_0x559dae['model']=_[_0xcf3d('0x40')](db[_0xcf3d('0x99')][_0xcf3d('0x3a')]);_0x559dae[_0xcf3d('0x41')]=_[_0xcf3d('0x40')](_0x4f1fd2['query']);_0x559dae['filters']=_['intersection'](_0x559dae[_0xcf3d('0x3e')],_0x559dae[_0xcf3d('0x41')]);_0x50e7dd[_0xcf3d('0x43')]=_[_0xcf3d('0x44')](_0x559dae['model'],qs['fields'](_0x4f1fd2[_0xcf3d('0x41')]['fields']));_0x50e7dd[_0xcf3d('0x43')]=_0x50e7dd[_0xcf3d('0x43')]['length']?_0x50e7dd[_0xcf3d('0x43')]:_0x559dae[_0xcf3d('0x3e')];_0x50e7dd['order']=qs['sort'](_0x4f1fd2[_0xcf3d('0x41')]['sort']);_0x50e7dd[_0xcf3d('0x4b')]=qs[_0xcf3d('0x42')](_['pick'](_0x4f1fd2[_0xcf3d('0x41')],_0x559dae[_0xcf3d('0x42')]));if(_0x4f1fd2[_0xcf3d('0x41')][_0xcf3d('0x4a')]){_0x50e7dd[_0xcf3d('0x4b')]=_[_0xcf3d('0x4c')](_0x50e7dd[_0xcf3d('0x4b')],{'$or':_[_0xcf3d('0x6b')](_0x50e7dd[_0xcf3d('0x43')],function(_0x213e95){var _0x555234={};_0x555234[_0x213e95]={'$like':'%'+_0x4f1fd2[_0xcf3d('0x41')]['filter']+'%'};return _0x555234;})});}_0x50e7dd=_[_0xcf3d('0x4c')]({},_0x50e7dd,_0x4f1fd2[_0xcf3d('0x4e')]);return _0x25aed5['getAgents'](_0x50e7dd);}})['then'](function(_0x20c80a){if(_0x20c80a){_0x58f639=_0x20c80a[_0xcf3d('0x46')];if(!_0x4f1fd2[_0xcf3d('0x41')][_0xcf3d('0x66')](_0xcf3d('0x47'))){_0x50e7dd[_0xcf3d('0x2c')]=qs['limit'](_0x4f1fd2['query'][_0xcf3d('0x2c')]);_0x50e7dd[_0xcf3d('0x2e')]=qs[_0xcf3d('0x2e')](_0x4f1fd2[_0xcf3d('0x41')][_0xcf3d('0x2e')]);}return _0x25aed5[_0xcf3d('0xb8')](_0x50e7dd);}})[_0xcf3d('0x1e')](function(_0x2bcf5d){if(_0x2bcf5d){return _0x2bcf5d?{'count':_0x58f639,'rows':_0x2bcf5d}:null;}})[_0xcf3d('0x1e')](respondWithResult(_0x3ed13e,null))[_0xcf3d('0x57')](handleError(_0x3ed13e,null));};exports[_0xcf3d('0xa8')]=function(_0x5e0e6d,_0x276b83,_0x303d6a){var _0x3cd21d,_0xb6a1d1,_0x2b06e8;if(_[_0xcf3d('0x78')](_0x5e0e6d['body']['body'])||_0x5e0e6d['body'][_0xcf3d('0x59')]===''){throw new db[(_0xcf3d('0x70'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcf3d('0x78')](_0x5e0e6d['body']['to'])){}_0x3cd21d=_0x5e0e6d['body']['to'];return db[_0xcf3d('0x39')][_0xcf3d('0x65')]({'where':{'id':_0x5e0e6d[_0xcf3d('0x54')]['id']}})['then'](handleEntityNotFound(_0x276b83,null))['then'](function(_0x426f07){if(_0x426f07){return db[_0xcf3d('0x39')]['find']({'where':{'id':_0x426f07['id']},'include':[{'model':db['CmList'],'as':_0xcf3d('0x7f'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x426f07[_0xcf3d('0x7d')]]:_0x3cd21d},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xcf3d('0x1e')](handleEntityNotFound(_0x276b83,null))[_0xcf3d('0x1e')](function(_0x50b02e){if(_0x50b02e&&_0x50b02e['List']){_0xb6a1d1=_0x50b02e[_0xcf3d('0x5b')]({'plain':!![]});if(_0xb6a1d1['List']&&_0xb6a1d1[_0xcf3d('0x7f')]['Contacts'][_0xcf3d('0x46')]){return _0xb6a1d1[_0xcf3d('0x7f')][_0xcf3d('0x80')][0x0];}return db[_0xcf3d('0x6f')][_0xcf3d('0x58')](_['defaults'](_0x5e0e6d['body'],{'firstName':_0x3cd21d,[_0x50b02e[_0xcf3d('0x7d')]]:_0x3cd21d,'phone':_0x3cd21d,'ListId':_0xb6a1d1[_0xcf3d('0x77')]}));}})[_0xcf3d('0x1e')](handleEntityNotFound(_0x276b83,null))[_0xcf3d('0x1e')](function(_0x33f15c){if(_0x33f15c){_0x2b06e8=_0x33f15c;return db[_0xcf3d('0x8c')][_0xcf3d('0x56')]({'where':{'ContactId':_0x2b06e8['id'],'closed':![],'OpenchannelAccountId':_0xb6a1d1['id']}})[_0xcf3d('0x1e')](function(_0xc16042){if(_0xc16042){return[_0xc16042,![]];}return db[_0xcf3d('0x8c')][_0xcf3d('0x58')]({'UserId':_0x5e0e6d['user']['id'],'ContactId':_0x2b06e8['id'],'OpenchannelAccountId':_0xb6a1d1['id'],'lastMsgDirection':_0xcf3d('0xb9'),'firstMsgDirection':_0xcf3d('0xb9'),'Messages':[_[_0xcf3d('0x4c')](_0x5e0e6d['body'],{'read':![],'body':_0x5e0e6d[_0xcf3d('0x59')][_0xcf3d('0x59')],'OpenchannelAccountId':_0xb6a1d1['id'],'UserId':_0x5e0e6d[_0xcf3d('0x5a')]['id'],'ContactId':_0x2b06e8['id']})]},{'include':[{'model':db[_0xcf3d('0x96')],'as':'Messages'}]})[_0xcf3d('0x1e')](function(_0x2514c9){return[_0x2514c9,!![]];});});}})['spread'](function(_0x1e31d0,_0x49b220){if(_0x49b220){return _0x1e31d0;}return db['OpenchannelMessage'][_0xcf3d('0x58')](_[_0xcf3d('0x4c')](_0x5e0e6d[_0xcf3d('0x59')],{'read':![],'body':_0x5e0e6d[_0xcf3d('0x59')][_0xcf3d('0x59')],'OpenchannelAccountId':_0xb6a1d1['id'],'OpenchannelInteractionId':_0x1e31d0['id'],'UserId':_0x5e0e6d[_0xcf3d('0x5a')]['id'],'ContactId':_0x2b06e8['id']}))[_0xcf3d('0x1e')](function(_0x28ab4a){_0x1e31d0[_0xcf3d('0xba')][_0xcf3d('0xbb')]=[];_0x1e31d0[_0xcf3d('0xba')]['Messages'][_0xcf3d('0xbc')](_0x28ab4a['dataValues']);return _0x1e31d0;});});}})[_0xcf3d('0x1e')](respondWithResult(_0x276b83,null))[_0xcf3d('0x57')](handleError(_0x276b83,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index a159139..0175812 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 _0x4522=['OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3b67dd,_0x39f951){var _0x247483=function(_0x1d4eff){while(--_0x1d4eff){_0x3b67dd['push'](_0x3b67dd['shift']());}};_0x247483(++_0x39f951);}(_0x4522,0x1a0));var _0x2452=function(_0x52893b,_0x12b7da){_0x52893b=_0x52893b-0x0;var _0x2c3bbc=_0x4522[_0x52893b];return _0x2c3bbc;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x2452('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x2452('0x1')](0x0);var events={'afterCreate':_0x2452('0x2'),'afterUpdate':'update','afterDestroy':_0x2452('0x3')};function emitEvent(_0x1fdf5b){return function(_0x35e30a,_0x2f21dc,_0x34ff44){OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b+':'+_0x35e30a['id'],_0x35e30a);OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b,_0x35e30a);_0x34ff44(null);};}for(var e in events){if(events[_0x2452('0x5')](e)){var event=events[e];OpenchannelAccount[_0x2452('0x6')](e,emitEvent(event));}}module[_0x2452('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x0713=['exports','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x3071('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3071('0x1')](0x0);var events={'afterCreate':_0x3071('0x2'),'afterUpdate':_0x3071('0x3'),'afterDestroy':_0x3071('0x4')};function emitEvent(_0x52b5fb){return function(_0x2c547f,_0x7b18a4,_0x33a70c){OpenchannelAccountEvents[_0x3071('0x5')](_0x52b5fb+':'+_0x2c547f['id'],_0x2c547f);OpenchannelAccountEvents[_0x3071('0x5')](_0x52b5fb,_0x2c547f);_0x33a70c(null);};}for(var e in events){if(events[_0x3071('0x6')](e)){var event=events[e];OpenchannelAccount[_0x3071('0x7')](e,emitEvent(event));}}module[_0x3071('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 7f2f66f..5415137 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(_0x550ec8,_0x403f08){var _0x2e2bc9=function(_0x283835){while(--_0x283835){_0x550ec8['push'](_0x550ec8['shift']());}};_0x2e2bc9(++_0x403f08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x44c904,_0x3000c4){var _0x1b198a=function(_0x57c017){while(--_0x57c017){_0x44c904['push'](_0x44c904['shift']());}};_0x1b198a(++_0x3000c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 8d0ed2c..51afd01 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa149=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','request\x20sent','debug','error','OpenchannelAccount,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0xe50a1b,_0xedfd90){var _0x379912=function(_0x2e4586){while(--_0x2e4586){_0xe50a1b['push'](_0xe50a1b['shift']());}};_0x379912(++_0xedfd90);}(_0xa149,0x18c));var _0x9a14=function(_0x24b3cc,_0x31fcce){_0x24b3cc=_0x24b3cc-0x0;var _0x3fd505=_0xa149[_0x24b3cc];return _0x3fd505;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var moment=require(_0x9a14('0x2'));var BPromise=require(_0x9a14('0x3'));var rs=require(_0x9a14('0x4'));var fs=require('fs');var Redis=require(_0x9a14('0x5'));var db=require(_0x9a14('0x6'))['db'];var utils=require(_0x9a14('0x7'));var logger=require(_0x9a14('0x8'))('rpc');var config=require(_0x9a14('0x9'));var jayson=require(_0x9a14('0xa'));var client=jayson['client'][_0x9a14('0xb')]({'port':0x232a});config[_0x9a14('0xc')]=_[_0x9a14('0xd')](config[_0x9a14('0xc')],{'host':_0x9a14('0xe'),'port':0x18eb});var socket=require(_0x9a14('0xf'))(new Redis(config['redis']));require(_0x9a14('0x10'))['register'](socket);function respondWithRpcPromise(_0x3d0481,_0x25afa7,_0x36c9ed){return new BPromise(function(_0x33bb89,_0x4155e5){return client[_0x9a14('0x11')](_0x3d0481,_0x36c9ed)['then'](function(_0x5d4ed8){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x25afa7,_0x9a14('0x12'));logger[_0x9a14('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x25afa7,_0x9a14('0x12'),JSON['stringify'](_0x5d4ed8));if(_0x5d4ed8[_0x9a14('0x14')]){if(_0x5d4ed8['error']['code']===0x1f4){logger[_0x9a14('0x14')](_0x9a14('0x15'),_0x25afa7,_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);return _0x4155e5(_0x5d4ed8['error'][_0x9a14('0x16')]);}logger[_0x9a14('0x14')](_0x9a14('0x15'),_0x25afa7,_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);return _0x33bb89(_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);}else{logger[_0x9a14('0x17')](_0x9a14('0x15'),_0x25afa7,_0x9a14('0x12'));_0x33bb89(_0x5d4ed8[_0x9a14('0x18')]['message']);}})['catch'](function(_0x589822){logger[_0x9a14('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x25afa7,_0x589822);_0x4155e5(_0x589822);});});} \ No newline at end of file +var _0x757a=['redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','info','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4f8974,_0x16b514){var _0x526e9b=function(_0x47d55d){while(--_0x47d55d){_0x4f8974['push'](_0x4f8974['shift']());}};_0x526e9b(++_0x16b514);}(_0x757a,0xde));var _0xa757=function(_0x5480b2,_0x46789f){_0x5480b2=_0x5480b2-0x0;var _0xd18796=_0x757a[_0x5480b2];return _0xd18796;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});config[_0xa757('0x9')]=_['defaults'](config[_0xa757('0x9')],{'host':_0xa757('0xa'),'port':0x18eb});var socket=require(_0xa757('0xb'))(new Redis(config[_0xa757('0x9')]));require(_0xa757('0xc'))['register'](socket);function respondWithRpcPromise(_0x89c630,_0x2ca96f,_0x32f0ec){return new BPromise(function(_0x3e2c9a,_0xb7610b){return client[_0xa757('0xd')](_0x89c630,_0x32f0ec)[_0xa757('0xe')](function(_0x483d77){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2ca96f,'request\x20sent');logger['debug'](_0xa757('0xf'),_0x2ca96f,'request\x20sent',JSON['stringify'](_0x483d77));if(_0x483d77[_0xa757('0x10')]){if(_0x483d77['error']['code']===0x1f4){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0xb7610b(_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);}logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0x3e2c9a(_0x483d77['error'][_0xa757('0x12')]);}else{logger[_0xa757('0x13')](_0xa757('0x11'),_0x2ca96f,'request\x20sent');_0x3e2c9a(_0x483d77['result'][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x1bd14c){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x1bd14c);_0xb7610b(_0x1bd14c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 271beab..bf7d211 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 _0xd1d4=['save','update','emit','removeListener','register','length','./openchannelAccount.events'];(function(_0x43c7f5,_0x723420){var _0x376840=function(_0x51e730){while(--_0x51e730){_0x43c7f5['push'](_0x43c7f5['shift']());}};_0x376840(++_0x723420);}(_0xd1d4,0xfb));var _0x4d1d=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xd1d4[_0xf71120];return _0xbe2fd3;};'use strict';var OpenchannelAccountEvents=require(_0x4d1d('0x0'));var events=[_0x4d1d('0x1'),'remove',_0x4d1d('0x2')];function createListener(_0x54f44c,_0x5ed209){return function(_0x2fdf2e){_0x5ed209[_0x4d1d('0x3')](_0x54f44c,_0x2fdf2e);};}function removeListener(_0x260e6a,_0x3bcfda){return function(){OpenchannelAccountEvents[_0x4d1d('0x4')](_0x260e6a,_0x3bcfda);};}exports[_0x4d1d('0x5')]=function(_0x30466a){for(var _0xb8a403=0x0,_0x1547d5=events[_0x4d1d('0x6')];_0xb8a403<_0x1547d5;_0xb8a403++){var _0x23f6c4=events[_0xb8a403];var _0x54da0f=createListener('openchannelAccount:'+_0x23f6c4,_0x30466a);OpenchannelAccountEvents['on'](_0x23f6c4,_0x54da0f);}}; \ No newline at end of file +var _0xb7fc=['removeListener','register','length','./openchannelAccount.events','update'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xb7fc,0x1e3));var _0xcb7f=function(_0x17049d,_0x345405){_0x17049d=_0x17049d-0x0;var _0xecc1dd=_0xb7fc[_0x17049d];return _0xecc1dd;};'use strict';var OpenchannelAccountEvents=require(_0xcb7f('0x0'));var events=['save','remove',_0xcb7f('0x1')];function createListener(_0x2f2354,_0x12656f){return function(_0x495101){_0x12656f['emit'](_0x2f2354,_0x495101);};}function removeListener(_0x23c877,_0x28247a){return function(){OpenchannelAccountEvents[_0xcb7f('0x2')](_0x23c877,_0x28247a);};}exports[_0xcb7f('0x3')]=function(_0x321b70){for(var _0x4001ef=0x0,_0x5059ca=events[_0xcb7f('0x4')];_0x4001ef<_0x5059ca;_0x4001ef++){var _0x31de8e=events[_0x4001ef];var _0x1f8ba3=createListener('openchannelAccount:'+_0x31de8e,_0x321b70);OpenchannelAccountEvents['on'](_0x31de8e,_0x1f8ba3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index c08a663..334b223 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 _0xfe27=['create','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0xfe27,0x16b));var _0x7fe2=function(_0x5cdf4b,_0x1122f7){_0x5cdf4b=_0x5cdf4b-0x0;var _0x3a1171=_0xfe27[_0x5cdf4b];return _0x3a1171;};'use strict';var multer=require(_0x7fe2('0x0'));var util=require(_0x7fe2('0x1'));var path=require(_0x7fe2('0x2'));var timeout=require(_0x7fe2('0x3'));var express=require(_0x7fe2('0x4'));var router=express[_0x7fe2('0x5')]();var fs_extra=require(_0x7fe2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7fe2('0x7'));var config=require(_0x7fe2('0x8'));var controller=require(_0x7fe2('0x9'));router[_0x7fe2('0xa')]('/',auth[_0x7fe2('0xb')](),controller[_0x7fe2('0xc')]);router[_0x7fe2('0xa')](_0x7fe2('0xd'),auth[_0x7fe2('0xb')](),controller[_0x7fe2('0xe')]);router['post']('/',auth[_0x7fe2('0xb')](),controller[_0x7fe2('0xf')]);router['put'](_0x7fe2('0xd'),auth[_0x7fe2('0xb')](),controller['update']);router['delete']('/:id',auth[_0x7fe2('0xb')](),controller[_0x7fe2('0x10')]);module[_0x7fe2('0x11')]=router; \ No newline at end of file +var _0x912f=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','put','update','delete','multer'];(function(_0x1c5dcf,_0x1440e4){var _0x19e10f=function(_0x2ca795){while(--_0x2ca795){_0x1c5dcf['push'](_0x1c5dcf['shift']());}};_0x19e10f(++_0x1440e4);}(_0x912f,0x10f));var _0xf912=function(_0x20c983,_0x10553d){_0x20c983=_0x20c983-0x0;var _0x4beb14=_0x912f[_0x20c983];return _0x4beb14;};'use strict';var multer=require(_0xf912('0x0'));var util=require(_0xf912('0x1'));var path=require('path');var timeout=require(_0xf912('0x2'));var express=require(_0xf912('0x3'));var router=express['Router']();var fs_extra=require(_0xf912('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf912('0x5'));var config=require(_0xf912('0x6'));var controller=require(_0xf912('0x7'));router['get']('/',auth[_0xf912('0x8')](),controller[_0xf912('0x9')]);router[_0xf912('0xa')](_0xf912('0xb'),auth[_0xf912('0x8')](),controller[_0xf912('0xc')]);router['post']('/',auth[_0xf912('0x8')](),controller['create']);router[_0xf912('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xf912('0xe')]);router[_0xf912('0xf')](_0xf912('0xb'),auth[_0xf912('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index d4158ed..75fd385 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 _0x884f=['noop','STRING','exports'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x884f,0x116));var _0xf884=function(_0x29aa84,_0x25a260){_0x29aa84=_0x29aa84-0x0;var _0x46cc12=_0x884f[_0x29aa84];return _0x46cc12;};'use strict';var Sequelize=require('sequelize');module[_0xf884('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf884('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf884('0x2')]},'interval':{'type':Sequelize[_0xf884('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6250=['sequelize','INTEGER','STRING','*,*,*,*'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x6250,0xe8));var _0x0625=function(_0x414b6c,_0x20631d){_0x414b6c=_0x414b6c-0x0;var _0x3fb5c7=_0x6250[_0x414b6c];return _0x3fb5c7;};'use strict';var Sequelize=require(_0x0625('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0625('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0625('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0625('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0625('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 60a5306..4b02f27 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 _0xec08=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','end','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','OpenchannelApplication','includeAll','include','findAll','then','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xec08,0xc5));var _0x8ec0=function(_0xa4380c,_0x4c2f56){_0xa4380c=_0xa4380c-0x0;var _0x22942a=_0xec08[_0xa4380c];return _0x22942a;};'use strict';var emlformat=require(_0x8ec0('0x0'));var rimraf=require(_0x8ec0('0x1'));var zipdir=require(_0x8ec0('0x2'));var jsonpatch=require(_0x8ec0('0x3'));var rp=require(_0x8ec0('0x4'));var moment=require(_0x8ec0('0x5'));var BPromise=require(_0x8ec0('0x6'));var Mustache=require(_0x8ec0('0x7'));var util=require(_0x8ec0('0x8'));var path=require(_0x8ec0('0x9'));var sox=require(_0x8ec0('0xa'));var csv=require('to-csv');var ejs=require(_0x8ec0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ec0('0xc'));var squel=require(_0x8ec0('0xd'));var crypto=require(_0x8ec0('0xe'));var jsforce=require(_0x8ec0('0xf'));var deskjs=require(_0x8ec0('0x10'));var toCsv=require(_0x8ec0('0x11'));var querystring=require(_0x8ec0('0x12'));var Papa=require(_0x8ec0('0x13'));var Redis=require('ioredis');var authService=require(_0x8ec0('0x14'));var qs=require(_0x8ec0('0x15'));var as=require(_0x8ec0('0x16'));var hardwareService=require(_0x8ec0('0x17'));var logger=require(_0x8ec0('0x18'))('api');var utils=require(_0x8ec0('0x19'));var config=require(_0x8ec0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ec0('0x1b'))['db'];function respondWithStatusCode(_0x47a2e9,_0x7816d){_0x7816d=_0x7816d||0xcc;return function(_0x530788){if(_0x530788){return _0x47a2e9[_0x8ec0('0x1c')](_0x7816d);}return _0x47a2e9[_0x8ec0('0x1d')](_0x7816d)['end']();};}function respondWithResult(_0xb9e680,_0x4836a6){_0x4836a6=_0x4836a6||0xc8;return function(_0x4acf24){if(_0x4acf24){return _0xb9e680[_0x8ec0('0x1d')](_0x4836a6)[_0x8ec0('0x1e')](_0x4acf24);}};}function respondWithFilteredResult(_0x569fc2,_0xb067fa){return function(_0x5f4362){if(_0x5f4362){var _0x5ad309=typeof _0xb067fa[_0x8ec0('0x1f')]===_0x8ec0('0x20')&&typeof _0xb067fa[_0x8ec0('0x21')]===_0x8ec0('0x20');var _0x32eeea=_0x5f4362[_0x8ec0('0x22')];var _0x36603c=_0x5ad309?0x0:_0xb067fa[_0x8ec0('0x1f')];var _0x5dba39=_0x5ad309?_0x5f4362['count']:_0xb067fa[_0x8ec0('0x1f')]+_0xb067fa[_0x8ec0('0x21')];var _0x52a2fd;if(_0x5dba39>=_0x32eeea){_0x5dba39=_0x32eeea;_0x52a2fd=0xc8;}else{_0x52a2fd=0xce;}_0x569fc2['status'](_0x52a2fd);return _0x569fc2['set'](_0x8ec0('0x23'),_0x36603c+'-'+_0x5dba39+'/'+_0x32eeea)[_0x8ec0('0x1e')](_0x5f4362);}return null;};}function patchUpdates(_0x296192){return function(_0x5a8f57){try{jsonpatch['apply'](_0x5a8f57,_0x296192,!![]);}catch(_0x58bdbd){return BPromise[_0x8ec0('0x24')](_0x58bdbd);}return _0x5a8f57['save']();};}function saveUpdates(_0x3878b8,_0x460a3d){return function(_0x8ab277){if(_0x8ab277){return _0x8ab277[_0x8ec0('0x25')](_0x3878b8)['then'](function(_0x489327){return _0x489327;});}return null;};}function removeEntity(_0x4a287f,_0x294713){return function(_0x2ba48a){if(_0x2ba48a){return _0x2ba48a['destroy']()['then'](function(){_0x4a287f[_0x8ec0('0x1d')](0xcc)[_0x8ec0('0x26')]();});}};}function handleEntityNotFound(_0x337606,_0x3b0dc8){return function(_0x36b715){if(!_0x36b715){_0x337606[_0x8ec0('0x1c')](0x194);}return _0x36b715;};}function handleError(_0x38a4aa,_0x596beb){_0x596beb=_0x596beb||0x1f4;return function(_0x81d8f8){logger['error'](_0x81d8f8[_0x8ec0('0x27')]);if(_0x81d8f8[_0x8ec0('0x28')]){delete _0x81d8f8[_0x8ec0('0x28')];}_0x38a4aa['status'](_0x596beb)[_0x8ec0('0x29')](_0x81d8f8);};}exports[_0x8ec0('0x2a')]=function(_0x2aa834,_0x4e8119){var _0x13d5c3={},_0x204b55={},_0x2fcbcd={'count':0x0,'rows':[]};var _0x50a644=_[_0x8ec0('0x2b')](db['OpenchannelApplication'][_0x8ec0('0x2c')],function(_0xc52d56){return{'name':_0xc52d56['fieldName'],'type':_0xc52d56[_0x8ec0('0x2d')][_0x8ec0('0x2e')]};});_0x204b55[_0x8ec0('0x2f')]=_['map'](_0x50a644,'name');_0x204b55['query']=_[_0x8ec0('0x30')](_0x2aa834[_0x8ec0('0x31')]);_0x204b55[_0x8ec0('0x32')]=_[_0x8ec0('0x33')](_0x204b55[_0x8ec0('0x2f')],_0x204b55[_0x8ec0('0x31')]);_0x13d5c3[_0x8ec0('0x34')]=_[_0x8ec0('0x33')](_0x204b55[_0x8ec0('0x2f')],qs[_0x8ec0('0x35')](_0x2aa834[_0x8ec0('0x31')][_0x8ec0('0x35')]));_0x13d5c3[_0x8ec0('0x34')]=_0x13d5c3['attributes'][_0x8ec0('0x36')]?_0x13d5c3['attributes']:_0x204b55[_0x8ec0('0x2f')];if(!_0x2aa834[_0x8ec0('0x31')][_0x8ec0('0x37')](_0x8ec0('0x38'))){_0x13d5c3['limit']=qs[_0x8ec0('0x21')](_0x2aa834[_0x8ec0('0x31')]['limit']);_0x13d5c3[_0x8ec0('0x1f')]=qs[_0x8ec0('0x1f')](_0x2aa834[_0x8ec0('0x31')]['offset']);}_0x13d5c3['order']=qs[_0x8ec0('0x39')](_0x2aa834[_0x8ec0('0x31')][_0x8ec0('0x39')]);_0x13d5c3[_0x8ec0('0x3a')]=qs[_0x8ec0('0x32')](_['pick'](_0x2aa834[_0x8ec0('0x31')],_0x204b55[_0x8ec0('0x32')]),_0x50a644);if(_0x2aa834[_0x8ec0('0x31')][_0x8ec0('0x3b')]){_0x13d5c3[_0x8ec0('0x3a')]=_[_0x8ec0('0x3c')](_0x13d5c3['where'],{'$or':_[_0x8ec0('0x2b')](_0x50a644,function(_0x1d74ac){if(_0x1d74ac['type']!=='VIRTUAL'){var _0x42bdb0={};_0x42bdb0[_0x1d74ac['name']]={'$like':'%'+_0x2aa834[_0x8ec0('0x31')][_0x8ec0('0x3b')]+'%'};return _0x42bdb0;}})});}_0x13d5c3=_['merge']({},_0x13d5c3,_0x2aa834[_0x8ec0('0x3d')]);var _0x37b60d={'where':_0x13d5c3['where']};return db[_0x8ec0('0x3e')][_0x8ec0('0x22')](_0x37b60d)['then'](function(_0x4cb08b){_0x2fcbcd[_0x8ec0('0x22')]=_0x4cb08b;if(_0x2aa834['query'][_0x8ec0('0x3f')]){_0x13d5c3[_0x8ec0('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x8ec0('0x41')](_0x13d5c3);})[_0x8ec0('0x42')](function(_0xbea29){_0x2fcbcd['rows']=_0xbea29;return _0x2fcbcd;})[_0x8ec0('0x42')](respondWithFilteredResult(_0x4e8119,_0x13d5c3))['catch'](handleError(_0x4e8119,null));};exports['show']=function(_0x441a1f,_0x3129ee){var _0x474e55={'raw':!![],'where':{'id':_0x441a1f[_0x8ec0('0x43')]['id']}},_0x1579fd={};_0x1579fd[_0x8ec0('0x2f')]=_[_0x8ec0('0x30')](db[_0x8ec0('0x3e')][_0x8ec0('0x2c')]);_0x1579fd[_0x8ec0('0x31')]=_[_0x8ec0('0x30')](_0x441a1f['query']);_0x1579fd[_0x8ec0('0x32')]=_[_0x8ec0('0x33')](_0x1579fd[_0x8ec0('0x2f')],_0x1579fd[_0x8ec0('0x31')]);_0x474e55['attributes']=_[_0x8ec0('0x33')](_0x1579fd[_0x8ec0('0x2f')],qs[_0x8ec0('0x35')](_0x441a1f[_0x8ec0('0x31')][_0x8ec0('0x35')]));_0x474e55[_0x8ec0('0x34')]=_0x474e55[_0x8ec0('0x34')][_0x8ec0('0x36')]?_0x474e55['attributes']:_0x1579fd['model'];if(_0x441a1f['query']['includeAll']){_0x474e55['include']=[{'all':!![]}];}_0x474e55=_['merge']({},_0x474e55,_0x441a1f['options']);return db[_0x8ec0('0x3e')][_0x8ec0('0x44')](_0x474e55)[_0x8ec0('0x42')](handleEntityNotFound(_0x3129ee,null))[_0x8ec0('0x42')](respondWithResult(_0x3129ee,null))[_0x8ec0('0x45')](handleError(_0x3129ee,null));};exports[_0x8ec0('0x46')]=function(_0x5cf3c8,_0x48228b){return db['OpenchannelApplication'][_0x8ec0('0x46')](_0x5cf3c8[_0x8ec0('0x47')],{})[_0x8ec0('0x42')](respondWithResult(_0x48228b,0xc9))[_0x8ec0('0x45')](handleError(_0x48228b,null));};exports[_0x8ec0('0x25')]=function(_0x2e002d,_0x3ca290){if(_0x2e002d[_0x8ec0('0x47')]['id']){delete _0x2e002d[_0x8ec0('0x47')]['id'];}return db[_0x8ec0('0x3e')][_0x8ec0('0x44')]({'where':{'id':_0x2e002d[_0x8ec0('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ca290,null))['then'](saveUpdates(_0x2e002d['body'],null))['then'](respondWithResult(_0x3ca290,null))[_0x8ec0('0x45')](handleError(_0x3ca290,null));};exports[_0x8ec0('0x48')]=function(_0x5c9730,_0x58791e){return db[_0x8ec0('0x3e')]['find']({'where':{'id':_0x5c9730['params']['id']}})[_0x8ec0('0x42')](handleEntityNotFound(_0x58791e,null))['then'](removeEntity(_0x58791e,null))['catch'](handleError(_0x58791e,null));}; \ No newline at end of file +var _0x9b9f=['destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','OpenchannelApplication','findAll','rows','params','find','catch','create','body','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then'];(function(_0x32cd6c,_0x459c61){var _0x14f324=function(_0x1bed11){while(--_0x1bed11){_0x32cd6c['push'](_0x32cd6c['shift']());}};_0x14f324(++_0x459c61);}(_0x9b9f,0x71));var _0xf9b9=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x9b9f[_0xea35d1];return _0x1d7a7c;};'use strict';var emlformat=require(_0xf9b9('0x0'));var rimraf=require(_0xf9b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf9b9('0x2'));var moment=require('moment');var BPromise=require(_0xf9b9('0x3'));var Mustache=require(_0xf9b9('0x4'));var util=require(_0xf9b9('0x5'));var path=require(_0xf9b9('0x6'));var sox=require(_0xf9b9('0x7'));var csv=require(_0xf9b9('0x8'));var ejs=require(_0xf9b9('0x9'));var fs=require('fs');var fs_extra=require(_0xf9b9('0xa'));var _=require('lodash');var squel=require(_0xf9b9('0xb'));var crypto=require(_0xf9b9('0xc'));var jsforce=require(_0xf9b9('0xd'));var deskjs=require(_0xf9b9('0xe'));var toCsv=require(_0xf9b9('0x8'));var querystring=require(_0xf9b9('0xf'));var Papa=require('papaparse');var Redis=require(_0xf9b9('0x10'));var authService=require(_0xf9b9('0x11'));var qs=require(_0xf9b9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9b9('0x13'));var logger=require(_0xf9b9('0x14'))('api');var utils=require(_0xf9b9('0x15'));var config=require(_0xf9b9('0x16'));var licenseUtil=require(_0xf9b9('0x17'));var db=require(_0xf9b9('0x18'))['db'];function respondWithStatusCode(_0x1b79bf,_0x56282a){_0x56282a=_0x56282a||0xcc;return function(_0x3f4be7){if(_0x3f4be7){return _0x1b79bf[_0xf9b9('0x19')](_0x56282a);}return _0x1b79bf[_0xf9b9('0x1a')](_0x56282a)[_0xf9b9('0x1b')]();};}function respondWithResult(_0x281017,_0xee12d4){_0xee12d4=_0xee12d4||0xc8;return function(_0x4748b9){if(_0x4748b9){return _0x281017[_0xf9b9('0x1a')](_0xee12d4)['json'](_0x4748b9);}};}function respondWithFilteredResult(_0x2ee2b1,_0x608c93){return function(_0x71ed55){if(_0x71ed55){var _0x73ccc9=typeof _0x608c93[_0xf9b9('0x1c')]===_0xf9b9('0x1d')&&typeof _0x608c93[_0xf9b9('0x1e')]===_0xf9b9('0x1d');var _0xc58756=_0x71ed55['count'];var _0xce1e86=_0x73ccc9?0x0:_0x608c93[_0xf9b9('0x1c')];var _0x26af9d=_0x73ccc9?_0x71ed55[_0xf9b9('0x1f')]:_0x608c93[_0xf9b9('0x1c')]+_0x608c93['limit'];var _0x3efdc;if(_0x26af9d>=_0xc58756){_0x26af9d=_0xc58756;_0x3efdc=0xc8;}else{_0x3efdc=0xce;}_0x2ee2b1[_0xf9b9('0x1a')](_0x3efdc);return _0x2ee2b1['set'](_0xf9b9('0x20'),_0xce1e86+'-'+_0x26af9d+'/'+_0xc58756)[_0xf9b9('0x21')](_0x71ed55);}return null;};}function patchUpdates(_0x3824e2){return function(_0x42d509){try{jsonpatch[_0xf9b9('0x22')](_0x42d509,_0x3824e2,!![]);}catch(_0x21e11c){return BPromise[_0xf9b9('0x23')](_0x21e11c);}return _0x42d509[_0xf9b9('0x24')]();};}function saveUpdates(_0x37cf88,_0x42ca68){return function(_0x92aeb7){if(_0x92aeb7){return _0x92aeb7[_0xf9b9('0x25')](_0x37cf88)[_0xf9b9('0x26')](function(_0x32f9b0){return _0x32f9b0;});}return null;};}function removeEntity(_0x163c85,_0x54a398){return function(_0x1e2fc6){if(_0x1e2fc6){return _0x1e2fc6[_0xf9b9('0x27')]()[_0xf9b9('0x26')](function(){_0x163c85[_0xf9b9('0x1a')](0xcc)[_0xf9b9('0x1b')]();});}};}function handleEntityNotFound(_0x3dfef6,_0x2ecfb0){return function(_0x3d0edb){if(!_0x3d0edb){_0x3dfef6['sendStatus'](0x194);}return _0x3d0edb;};}function handleError(_0x39917c,_0x4cafcc){_0x4cafcc=_0x4cafcc||0x1f4;return function(_0x51f2a2){logger['error'](_0x51f2a2[_0xf9b9('0x28')]);if(_0x51f2a2[_0xf9b9('0x29')]){delete _0x51f2a2[_0xf9b9('0x29')];}_0x39917c['status'](_0x4cafcc)[_0xf9b9('0x2a')](_0x51f2a2);};}exports[_0xf9b9('0x2b')]=function(_0x484e4b,_0x48556f){var _0x3f698f={},_0x260976={},_0x5cded7={'count':0x0,'rows':[]};var _0x358188=_[_0xf9b9('0x2c')](db['OpenchannelApplication'][_0xf9b9('0x2d')],function(_0x221704){return{'name':_0x221704[_0xf9b9('0x2e')],'type':_0x221704[_0xf9b9('0x2f')][_0xf9b9('0x30')]};});_0x260976[_0xf9b9('0x31')]=_[_0xf9b9('0x2c')](_0x358188,_0xf9b9('0x29'));_0x260976[_0xf9b9('0x32')]=_[_0xf9b9('0x33')](_0x484e4b[_0xf9b9('0x32')]);_0x260976[_0xf9b9('0x34')]=_[_0xf9b9('0x35')](_0x260976[_0xf9b9('0x31')],_0x260976[_0xf9b9('0x32')]);_0x3f698f['attributes']=_[_0xf9b9('0x35')](_0x260976[_0xf9b9('0x31')],qs[_0xf9b9('0x36')](_0x484e4b[_0xf9b9('0x32')]['fields']));_0x3f698f[_0xf9b9('0x37')]=_0x3f698f[_0xf9b9('0x37')][_0xf9b9('0x38')]?_0x3f698f[_0xf9b9('0x37')]:_0x260976[_0xf9b9('0x31')];if(!_0x484e4b[_0xf9b9('0x32')][_0xf9b9('0x39')]('nolimit')){_0x3f698f[_0xf9b9('0x1e')]=qs['limit'](_0x484e4b[_0xf9b9('0x32')][_0xf9b9('0x1e')]);_0x3f698f['offset']=qs[_0xf9b9('0x1c')](_0x484e4b['query']['offset']);}_0x3f698f[_0xf9b9('0x3a')]=qs['sort'](_0x484e4b[_0xf9b9('0x32')][_0xf9b9('0x3b')]);_0x3f698f[_0xf9b9('0x3c')]=qs[_0xf9b9('0x34')](_[_0xf9b9('0x3d')](_0x484e4b[_0xf9b9('0x32')],_0x260976[_0xf9b9('0x34')]),_0x358188);if(_0x484e4b[_0xf9b9('0x32')]['filter']){_0x3f698f[_0xf9b9('0x3c')]=_[_0xf9b9('0x3e')](_0x3f698f[_0xf9b9('0x3c')],{'$or':_[_0xf9b9('0x2c')](_0x358188,function(_0x36aa5e){if(_0x36aa5e['type']!==_0xf9b9('0x3f')){var _0x1cabc6={};_0x1cabc6[_0x36aa5e[_0xf9b9('0x29')]]={'$like':'%'+_0x484e4b[_0xf9b9('0x32')][_0xf9b9('0x40')]+'%'};return _0x1cabc6;}})});}_0x3f698f=_[_0xf9b9('0x3e')]({},_0x3f698f,_0x484e4b[_0xf9b9('0x41')]);var _0x37f7d4={'where':_0x3f698f[_0xf9b9('0x3c')]};return db['OpenchannelApplication'][_0xf9b9('0x1f')](_0x37f7d4)[_0xf9b9('0x26')](function(_0xf072fa){_0x5cded7[_0xf9b9('0x1f')]=_0xf072fa;if(_0x484e4b['query'][_0xf9b9('0x42')]){_0x3f698f[_0xf9b9('0x43')]=[{'all':!![]}];}return db[_0xf9b9('0x44')][_0xf9b9('0x45')](_0x3f698f);})[_0xf9b9('0x26')](function(_0x5ecc79){_0x5cded7[_0xf9b9('0x46')]=_0x5ecc79;return _0x5cded7;})[_0xf9b9('0x26')](respondWithFilteredResult(_0x48556f,_0x3f698f))['catch'](handleError(_0x48556f,null));};exports['show']=function(_0x1d15f7,_0x364fec){var _0xffc9fb={'raw':!![],'where':{'id':_0x1d15f7[_0xf9b9('0x47')]['id']}},_0x4b22e5={};_0x4b22e5[_0xf9b9('0x31')]=_[_0xf9b9('0x33')](db[_0xf9b9('0x44')][_0xf9b9('0x2d')]);_0x4b22e5['query']=_['keys'](_0x1d15f7[_0xf9b9('0x32')]);_0x4b22e5[_0xf9b9('0x34')]=_[_0xf9b9('0x35')](_0x4b22e5[_0xf9b9('0x31')],_0x4b22e5[_0xf9b9('0x32')]);_0xffc9fb[_0xf9b9('0x37')]=_[_0xf9b9('0x35')](_0x4b22e5[_0xf9b9('0x31')],qs[_0xf9b9('0x36')](_0x1d15f7[_0xf9b9('0x32')][_0xf9b9('0x36')]));_0xffc9fb[_0xf9b9('0x37')]=_0xffc9fb[_0xf9b9('0x37')][_0xf9b9('0x38')]?_0xffc9fb[_0xf9b9('0x37')]:_0x4b22e5[_0xf9b9('0x31')];if(_0x1d15f7['query'][_0xf9b9('0x42')]){_0xffc9fb[_0xf9b9('0x43')]=[{'all':!![]}];}_0xffc9fb=_['merge']({},_0xffc9fb,_0x1d15f7[_0xf9b9('0x41')]);return db[_0xf9b9('0x44')][_0xf9b9('0x48')](_0xffc9fb)[_0xf9b9('0x26')](handleEntityNotFound(_0x364fec,null))[_0xf9b9('0x26')](respondWithResult(_0x364fec,null))[_0xf9b9('0x49')](handleError(_0x364fec,null));};exports[_0xf9b9('0x4a')]=function(_0x2e2220,_0x4ac9f0){return db[_0xf9b9('0x44')]['create'](_0x2e2220[_0xf9b9('0x4b')],{})['then'](respondWithResult(_0x4ac9f0,0xc9))[_0xf9b9('0x49')](handleError(_0x4ac9f0,null));};exports[_0xf9b9('0x25')]=function(_0x336a96,_0x15614a){if(_0x336a96['body']['id']){delete _0x336a96['body']['id'];}return db[_0xf9b9('0x44')][_0xf9b9('0x48')]({'where':{'id':_0x336a96[_0xf9b9('0x47')]['id']}})['then'](handleEntityNotFound(_0x15614a,null))[_0xf9b9('0x26')](saveUpdates(_0x336a96[_0xf9b9('0x4b')],null))[_0xf9b9('0x26')](respondWithResult(_0x15614a,null))[_0xf9b9('0x49')](handleError(_0x15614a,null));};exports['destroy']=function(_0x2a7fa7,_0x3a8251){return db[_0xf9b9('0x44')][_0xf9b9('0x48')]({'where':{'id':_0x2a7fa7[_0xf9b9('0x47')]['id']}})[_0xf9b9('0x26')](handleEntityNotFound(_0x3a8251,null))[_0xf9b9('0x26')](removeEntity(_0x3a8251,null))[_0xf9b9('0x49')](handleError(_0x3a8251,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 2b8f391..c4beacb 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 _0x8161=['../../config/logger','api','moment','bluebird','request-promise','path','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci'];(function(_0x807399,_0x96e6cd){var _0x9ccc45=function(_0x11316d){while(--_0x11316d){_0x807399['push'](_0x807399['shift']());}};_0x9ccc45(++_0x96e6cd);}(_0x8161,0x108));var _0x1816=function(_0x39e92e,_0x15ae86){_0x39e92e=_0x39e92e-0x0;var _0x1f455d=_0x8161[_0x39e92e];return _0x1f455d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1816('0x0'))(_0x1816('0x1'));var moment=require(_0x1816('0x2'));var BPromise=require(_0x1816('0x3'));var rp=require(_0x1816('0x4'));var fs=require('fs');var path=require(_0x1816('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1816('0x6'));module['exports']=function(_0x3f6fc1,_0x581022){return _0x3f6fc1[_0x1816('0x7')](_0x1816('0x8'),attributes,{'tableName':_0x1816('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1816('0xa')});}; \ No newline at end of file +var _0xc3c2=['exports','define','OpenchannelApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x4b0eed,_0x5195a3){var _0x5b11e5=function(_0x198c9f){while(--_0x198c9f){_0x4b0eed['push'](_0x4b0eed['shift']());}};_0x5b11e5(++_0x5195a3);}(_0xc3c2,0x122));var _0x2c3c=function(_0x35ed80,_0x296c06){_0x35ed80=_0x35ed80-0x0;var _0x32cace=_0xc3c2[_0x35ed80];return _0x32cace;};'use strict';var _=require(_0x2c3c('0x0'));var util=require(_0x2c3c('0x1'));var logger=require(_0x2c3c('0x2'))('api');var moment=require(_0x2c3c('0x3'));var BPromise=require(_0x2c3c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c3c('0x5'));var rimraf=require(_0x2c3c('0x6'));var config=require(_0x2c3c('0x7'));var attributes=require(_0x2c3c('0x8'));module[_0x2c3c('0x9')]=function(_0x5ab032,_0x1b6b40){return _0x5ab032[_0x2c3c('0xa')](_0x2c3c('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2c3c('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0a6c87c..5790815 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 _0xc53f=['then','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelApplication,\x20%s,\x20%s','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xc53f,0x114));var _0xfc53=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xc53f[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0xfc53('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfc53('0x1'));var rs=require(_0xfc53('0x2'));var fs=require('fs');var Redis=require(_0xfc53('0x3'));var db=require(_0xfc53('0x4'))['db'];var utils=require(_0xfc53('0x5'));var logger=require(_0xfc53('0x6'))('rpc');var config=require(_0xfc53('0x7'));var jayson=require(_0xfc53('0x8'));var client=jayson[_0xfc53('0x9')][_0xfc53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54aaab,_0x227133,_0x800838){return new BPromise(function(_0x30207d,_0x5cc64c){return client[_0xfc53('0xb')](_0x54aaab,_0x800838)[_0xfc53('0xc')](function(_0x4cd95c){logger[_0xfc53('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x227133,'request\x20sent');logger[_0xfc53('0xe')](_0xfc53('0xf'),_0x227133,_0xfc53('0x10'),JSON[_0xfc53('0x11')](_0x4cd95c));if(_0x4cd95c['error']){if(_0x4cd95c[_0xfc53('0x12')][_0xfc53('0x13')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x227133,_0x4cd95c[_0xfc53('0x12')][_0xfc53('0x14')]);return _0x5cc64c(_0x4cd95c[_0xfc53('0x12')][_0xfc53('0x14')]);}logger['error'](_0xfc53('0x15'),_0x227133,_0x4cd95c[_0xfc53('0x12')][_0xfc53('0x14')]);return _0x30207d(_0x4cd95c['error'][_0xfc53('0x14')]);}else{logger[_0xfc53('0xd')](_0xfc53('0x15'),_0x227133,'request\x20sent');_0x30207d(_0x4cd95c[_0xfc53('0x16')][_0xfc53('0x14')]);}})[_0xfc53('0x17')](function(_0x10071b){logger[_0xfc53('0x12')](_0xfc53('0x15'),_0x227133,_0x10071b);_0x5cc64c(_0x10071b);});});}exports[_0xfc53('0x18')]=function(_0x502f73){var _0x58a7f1=this;return new Promise(function(_0x4f5bf9,_0x31cb4d){return db[_0xfc53('0x19')][_0xfc53('0x1a')](_0x502f73[_0xfc53('0x1b')],{'raw':_0x502f73[_0xfc53('0x1c')]?_0x502f73[_0xfc53('0x1c')][_0xfc53('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502f73[_0xfc53('0x1c')]?_0x502f73['options'][_0xfc53('0x1e')]||null:null,'attributes':_0x502f73[_0xfc53('0x1c')]?_0x502f73[_0xfc53('0x1c')]['attributes']||null:null,'limit':_0x502f73['options']?_0x502f73[_0xfc53('0x1c')][_0xfc53('0x1f')]||null:null})[_0xfc53('0xc')](function(_0x114141){logger[_0xfc53('0xd')](_0xfc53('0x18'),_0x502f73);logger[_0xfc53('0xe')](_0xfc53('0x18'),_0x502f73,JSON[_0xfc53('0x11')](_0x114141));_0x4f5bf9(_0x114141);})[_0xfc53('0x17')](function(_0x20cade){logger[_0xfc53('0x12')](_0xfc53('0x18'),_0x20cade[_0xfc53('0x14')],_0x502f73);_0x31cb4d(_0x58a7f1[_0xfc53('0x12')](0x1f4,_0x20cade[_0xfc53('0x14')]));});});}; \ No newline at end of file +var _0xcd56=['info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','attributes','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x386948,_0x2aeb80){var _0x53506b=function(_0x5a4e40){while(--_0x5a4e40){_0x386948['push'](_0x386948['shift']());}};_0x53506b(++_0x2aeb80);}(_0xcd56,0xbe));var _0x6cd5=function(_0x4b6147,_0x1779ad){_0x4b6147=_0x4b6147-0x0;var _0x2cd409=_0xcd56[_0x4b6147];return _0x2cd409;};'use strict';var _=require(_0x6cd5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6cd5('0x1'));var rs=require(_0x6cd5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6cd5('0x3'))['db'];var utils=require(_0x6cd5('0x4'));var logger=require('../../config/logger')(_0x6cd5('0x5'));var config=require(_0x6cd5('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6cd5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d0ea3,_0x55b7d5,_0x5f0c8a){return new BPromise(function(_0x58de06,_0x2cfdc3){return client[_0x6cd5('0x8')](_0x2d0ea3,_0x5f0c8a)[_0x6cd5('0x9')](function(_0x370f07){logger[_0x6cd5('0xa')](_0x6cd5('0xb'),_0x55b7d5,_0x6cd5('0xc'));logger[_0x6cd5('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x55b7d5,'request\x20sent',JSON['stringify'](_0x370f07));if(_0x370f07[_0x6cd5('0xe')]){if(_0x370f07['error']['code']===0x1f4){logger[_0x6cd5('0xe')](_0x6cd5('0xb'),_0x55b7d5,_0x370f07[_0x6cd5('0xe')]['message']);return _0x2cfdc3(_0x370f07[_0x6cd5('0xe')][_0x6cd5('0xf')]);}logger[_0x6cd5('0xe')](_0x6cd5('0xb'),_0x55b7d5,_0x370f07[_0x6cd5('0xe')][_0x6cd5('0xf')]);return _0x58de06(_0x370f07[_0x6cd5('0xe')][_0x6cd5('0xf')]);}else{logger['info'](_0x6cd5('0xb'),_0x55b7d5,'request\x20sent');_0x58de06(_0x370f07[_0x6cd5('0x10')][_0x6cd5('0xf')]);}})['catch'](function(_0x548af0){logger[_0x6cd5('0xe')](_0x6cd5('0xb'),_0x55b7d5,_0x548af0);_0x2cfdc3(_0x548af0);});});}exports[_0x6cd5('0x11')]=function(_0x31b9d7){var _0x4d1fa1=this;return new Promise(function(_0x308d92,_0x46294f){return db[_0x6cd5('0x12')][_0x6cd5('0x13')](_0x31b9d7[_0x6cd5('0x14')],{'raw':_0x31b9d7[_0x6cd5('0x15')]?_0x31b9d7[_0x6cd5('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31b9d7['options']?_0x31b9d7['options'][_0x6cd5('0x16')]||null:null,'attributes':_0x31b9d7['options']?_0x31b9d7[_0x6cd5('0x15')][_0x6cd5('0x17')]||null:null,'limit':_0x31b9d7[_0x6cd5('0x15')]?_0x31b9d7[_0x6cd5('0x15')]['limit']||null:null})[_0x6cd5('0x9')](function(_0x59c261){logger[_0x6cd5('0xa')](_0x6cd5('0x11'),_0x31b9d7);logger[_0x6cd5('0xd')]('UpdateOpenchannelApplication',_0x31b9d7,JSON[_0x6cd5('0x18')](_0x59c261));_0x308d92(_0x59c261);})['catch'](function(_0x3872fc){logger[_0x6cd5('0xe')](_0x6cd5('0x11'),_0x3872fc[_0x6cd5('0xf')],_0x31b9d7);_0x46294f(_0x4d1fa1['error'](0x1f4,_0x3872fc[_0x6cd5('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index f8fa065..69fc371 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 _0xc58e=['get','isAuthenticated','/describe','show','/:id/messages','download','post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','put','/:id','tracked','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','express','Router','fs-extra','./openchannelInteraction.controller'];(function(_0x4e2065,_0xfae0b1){var _0x35a581=function(_0x5913d7){while(--_0x5913d7){_0x4e2065['push'](_0x4e2065['shift']());}};_0x35a581(++_0xfae0b1);}(_0xc58e,0xd2));var _0xec58=function(_0x1ce807,_0xe56287){_0x1ce807=_0x1ce807-0x0;var _0xd4c776=_0xc58e[_0x1ce807];return _0xd4c776;};'use strict';var multer=require(_0xec58('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec58('0x1'));var express=require(_0xec58('0x2'));var router=express[_0xec58('0x3')]();var fs_extra=require(_0xec58('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xec58('0x5'));router[_0xec58('0x6')]('/',auth[_0xec58('0x7')](),controller['index']);router[_0xec58('0x6')](_0xec58('0x8'),auth[_0xec58('0x7')](),controller['describe']);router[_0xec58('0x6')]('/:id',auth[_0xec58('0x7')](),controller[_0xec58('0x9')]);router[_0xec58('0x6')](_0xec58('0xa'),auth[_0xec58('0x7')](),controller['getMessages']);router[_0xec58('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0xec58('0xb')]);router[_0xec58('0xc')]('/',auth[_0xec58('0x7')](),controller[_0xec58('0xd')]);router[_0xec58('0xc')](_0xec58('0xa'),auth['isAuthenticated'](),controller[_0xec58('0xe')]);router['post'](_0xec58('0xf'),auth[_0xec58('0x7')](),interaction['tracked'](_0xec58('0x10'),_0xec58('0x11')),controller['addTags']);router[_0xec58('0x12')](_0xec58('0x13'),auth['isAuthenticated'](),interaction[_0xec58('0x14')](_0xec58('0x10'),_0xec58('0x15')),controller['update']);router[_0xec58('0x16')](_0xec58('0x13'),auth[_0xec58('0x7')](),interaction[_0xec58('0x14')](_0xec58('0x10'),_0xec58('0x17')),controller[_0xec58('0x18')]);router['delete'](_0xec58('0xf'),auth[_0xec58('0x7')](),controller[_0xec58('0x19')]);module[_0xec58('0x1a')]=router; \ No newline at end of file +var _0xb447=['get','index','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','destroy','removeTags','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller'];(function(_0x23afb5,_0x437dac){var _0x5833e2=function(_0x306d01){while(--_0x306d01){_0x23afb5['push'](_0x23afb5['shift']());}};_0x5833e2(++_0x437dac);}(_0xb447,0x12e));var _0x7b44=function(_0x27d40f,_0x5e5832){_0x27d40f=_0x27d40f-0x0;var _0x444788=_0xb447[_0x27d40f];return _0x444788;};'use strict';var multer=require(_0x7b44('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7b44('0x1'));var express=require(_0x7b44('0x2'));var router=express['Router']();var fs_extra=require(_0x7b44('0x3'));var auth=require(_0x7b44('0x4'));var interaction=require(_0x7b44('0x5'));var config=require(_0x7b44('0x6'));var controller=require(_0x7b44('0x7'));router[_0x7b44('0x8')]('/',auth['isAuthenticated'](),controller[_0x7b44('0x9')]);router[_0x7b44('0x8')]('/describe',auth[_0x7b44('0xa')](),controller[_0x7b44('0xb')]);router[_0x7b44('0x8')](_0x7b44('0xc'),auth['isAuthenticated'](),controller[_0x7b44('0xd')]);router[_0x7b44('0x8')](_0x7b44('0xe'),auth[_0x7b44('0xa')](),controller[_0x7b44('0xf')]);router['get'](_0x7b44('0x10'),auth[_0x7b44('0xa')](),controller[_0x7b44('0x11')]);router[_0x7b44('0x12')]('/',auth[_0x7b44('0xa')](),controller[_0x7b44('0x13')]);router['post'](_0x7b44('0xe'),auth[_0x7b44('0xa')](),controller[_0x7b44('0x14')]);router[_0x7b44('0x12')]('/:id/tags',auth[_0x7b44('0xa')](),interaction[_0x7b44('0x15')](_0x7b44('0x16'),_0x7b44('0x17')),controller[_0x7b44('0x18')]);router[_0x7b44('0x19')]('/:id',auth[_0x7b44('0xa')](),interaction[_0x7b44('0x15')](_0x7b44('0x16'),_0x7b44('0x1a')),controller['update']);router[_0x7b44('0x1b')](_0x7b44('0xc'),auth[_0x7b44('0xa')](),interaction[_0x7b44('0x15')]('openchannel','openchannelinteraction:destroy'),controller[_0x7b44('0x1c')]);router[_0x7b44('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7b44('0x1d')]);module[_0x7b44('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9ea9db4..a3ca7ca 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 _0xf197=['BOOLEAN','STRING','ENUM','out','sequelize','exports'];(function(_0x4bfe3a,_0x16a392){var _0x5c3bf4=function(_0x194612){while(--_0x194612){_0x4bfe3a['push'](_0x4bfe3a['shift']());}};_0x5c3bf4(++_0x16a392);}(_0xf197,0x130));var _0x7f19=function(_0x2e3649,_0x57ecc1){_0x2e3649=_0x2e3649-0x0;var _0x1f8a34=_0xf197[_0x2e3649];return _0x1f8a34;};'use strict';var Sequelize=require(_0x7f19('0x0'));module[_0x7f19('0x1')]={'closed':{'type':Sequelize[_0x7f19('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7f19('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x7f19('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7f19('0x4')]('in',_0x7f19('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7f19('0x4')]('in',_0x7f19('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7f19('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x7f19('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x21a3=['sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0xf2f344,_0x509cdc){var _0x3e99f8=function(_0x121308){while(--_0x121308){_0xf2f344['push'](_0xf2f344['shift']());}};_0x3e99f8(++_0x509cdc);}(_0x21a3,0x66));var _0x321a=function(_0x1afedc,_0x17ee2f){_0x1afedc=_0x1afedc-0x0;var _0x3520db=_0x21a3[_0x1afedc];return _0x3520db;};'use strict';var Sequelize=require(_0x321a('0x0'));module['exports']={'closed':{'type':Sequelize[_0x321a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x321a('0x2')]},'disposition':{'type':Sequelize[_0x321a('0x3')]},'secondDisposition':{'type':Sequelize[_0x321a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x321a('0x3')]},'note':{'type':Sequelize[_0x321a('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x321a('0x3')]},'lastMsgAt':{'type':Sequelize[_0x321a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x321a('0x4')]('in',_0x321a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x321a('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x321a('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x321a('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index a1e77a2..d6ec831 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 _0x5d0a=['OpenchannelInteractionId','map','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','fullname','push','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','read','OpenchannelAccount','Account','User','get','mkdirSync','Openchannel','Owner','N.A.','createdAt','toString','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','value','renderFile','views','download','unlinkSync','zip-dir','util','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','json','offset','limit','count','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','OpenchannelInteraction','key','findAll','openchannel','query','catch','show','type','from','params','rawAttributes','keys','filters','model','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2e9343,_0x2e4cc1){var _0x23bd78=function(_0x271a97){while(--_0x271a97){_0x2e9343['push'](_0x2e9343['shift']());}};_0x23bd78(++_0x2e4cc1);}(_0x5d0a,0x1bb));var _0xa5d0=function(_0x48888f,_0xed3a96){_0x48888f=_0x48888f-0x0;var _0x11eb87=_0x5d0a[_0x48888f];return _0x11eb87;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xa5d0('0x0'));var moment=require('moment');var util=require(_0xa5d0('0x1'));var path=require('path');var ejs=require(_0xa5d0('0x2'));var fs=require('fs');var _=require(_0xa5d0('0x3'));var Redis=require(_0xa5d0('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0xa5d0('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0xa5d0('0x6'))(_0xa5d0('0x7'));var config=require(_0xa5d0('0x8'));var db=require(_0xa5d0('0x9'))['db'];config['redis']=_[_0xa5d0('0xa')](config[_0xa5d0('0xb')],{'host':_0xa5d0('0xc'),'port':0x18eb});var socket=require(_0xa5d0('0xd'))(new Redis(config[_0xa5d0('0xb')]));require(_0xa5d0('0xe'))[_0xa5d0('0xf')](socket);function respondWithStatusCode(_0x4e597b,_0x2a9c8c){_0x2a9c8c=_0x2a9c8c||0xcc;return function(_0x4157ad){if(_0x4157ad){return _0x4e597b['sendStatus'](_0x2a9c8c);}return _0x4e597b[_0xa5d0('0x10')](_0x2a9c8c)['end']();};}function respondWithResult(_0x443ec0,_0x3b6fd6){_0x3b6fd6=_0x3b6fd6||0xc8;return function(_0x1bee60){if(_0x1bee60){return _0x443ec0[_0xa5d0('0x10')](_0x3b6fd6)[_0xa5d0('0x11')](_0x1bee60);}};}function respondWithFilteredResult(_0x3c0cd2,_0x4f83fb){return function(_0x1d31b0){if(_0x1d31b0){var _0x4ddd40=typeof _0x4f83fb[_0xa5d0('0x12')]==='undefined'&&typeof _0x4f83fb[_0xa5d0('0x13')]==='undefined';var _0x577bfc=_0x1d31b0[_0xa5d0('0x14')];var _0x336c6b=_0x4ddd40?0x0:_0x4f83fb[_0xa5d0('0x12')];var _0xc893cb=_0x4ddd40?_0x1d31b0[_0xa5d0('0x14')]:_0x4f83fb[_0xa5d0('0x12')]+_0x4f83fb[_0xa5d0('0x13')];var _0x551800;if(_0xc893cb>=_0x577bfc){_0xc893cb=_0x577bfc;_0x551800=0xc8;}else{_0x551800=0xce;}_0x3c0cd2[_0xa5d0('0x10')](_0x551800);return _0x3c0cd2['set'](_0xa5d0('0x15'),_0x336c6b+'-'+_0xc893cb+'/'+_0x577bfc)[_0xa5d0('0x11')](_0x1d31b0);}return null;};}function saveUpdates(_0x1f3227){return function(_0x46f3d9){if(_0x46f3d9){return _0x46f3d9[_0xa5d0('0x16')](_0x1f3227)[_0xa5d0('0x17')](function(_0x3b335d){return _0x3b335d;});}return null;};}function removeEntity(_0x426459){return function(_0x930504){if(_0x930504){return _0x930504[_0xa5d0('0x18')]()['then'](function(){_0x426459['status'](0xcc)[_0xa5d0('0x19')]();});}};}function handleEntityNotFound(_0x1aef50){return function(_0x2bfff8){if(!_0x2bfff8){_0x1aef50[_0xa5d0('0x1a')](0x194);}return _0x2bfff8;};}function handleError(_0x52d0ce,_0x3bfdd9){_0x3bfdd9=_0x3bfdd9||0x1f4;return function(_0xc0223d){logger[_0xa5d0('0x1b')](_0xc0223d[_0xa5d0('0x1c')]);if(_0xc0223d[_0xa5d0('0x1d')]){delete _0xc0223d['name'];}_0x52d0ce[_0xa5d0('0x10')](_0x3bfdd9)[_0xa5d0('0x1e')](_0xc0223d);};}exports[_0xa5d0('0x1f')]=function(_0x35d8c1,_0x3689c1){var _0x4e6cfa={};var _0x41a6cd=_['map'](db[_0xa5d0('0x20')]['rawAttributes'],function(_0x4bf74a){return{'name':_0x4bf74a['fieldName'],'type':_0x4bf74a['type'][_0xa5d0('0x21')]};});_0x4e6cfa=qs['getOptions'](_0x41a6cd,_0x35d8c1);return interaction[_0xa5d0('0x22')](_0xa5d0('0x23'),_0x35d8c1[_0xa5d0('0x24')],_0x35d8c1['user'],_0x4e6cfa,_0x41a6cd)['then'](respondWithFilteredResult(_0x3689c1,_0x4e6cfa))[_0xa5d0('0x25')](handleError(_0x3689c1,null));};exports[_0xa5d0('0x26')]=function(_0x3a04a4,_0x3dbb94){var _0x2cb6f8={};if(_0x3a04a4['query'][_0xa5d0('0x27')]&&_0x3a04a4[_0xa5d0('0x24')][_0xa5d0('0x27')]==='from'){_0x2cb6f8[_0xa5d0('0x28')]=_0x3a04a4['params']['id'];}else{_0x2cb6f8['id']=_0x3a04a4[_0xa5d0('0x29')]['id'];}var _0xf5751b={'raw':![],'where':_0x2cb6f8},_0x548e7e={};_0x548e7e['model']=_['keys'](db['OpenchannelInteraction'][_0xa5d0('0x2a')]);_0x548e7e[_0xa5d0('0x24')]=_[_0xa5d0('0x2b')](_0x3a04a4[_0xa5d0('0x24')]);_0x548e7e[_0xa5d0('0x2c')]=_['intersection'](_0x548e7e[_0xa5d0('0x2d')],_0x548e7e[_0xa5d0('0x24')]);_0xf5751b[_0xa5d0('0x2e')]=_[_0xa5d0('0x2f')](_0x548e7e[_0xa5d0('0x2d')],qs[_0xa5d0('0x30')](_0x3a04a4[_0xa5d0('0x24')][_0xa5d0('0x30')]));_0xf5751b['attributes']=_0xf5751b['attributes'][_0xa5d0('0x31')]?_0xf5751b['attributes']:_0x548e7e[_0xa5d0('0x2d')];if(_0x3a04a4[_0xa5d0('0x24')][_0xa5d0('0x32')]){_0xf5751b['include']=[{'all':!![]}];}_0xf5751b=_[_0xa5d0('0x33')]({},_0xf5751b,_0x3a04a4[_0xa5d0('0x34')]);return db['OpenchannelInteraction'][_0xa5d0('0x35')](_0xf5751b)[_0xa5d0('0x17')](handleEntityNotFound(_0x3dbb94,null))[_0xa5d0('0x17')](respondWithResult(_0x3dbb94,null))[_0xa5d0('0x25')](handleError(_0x3dbb94,null));};exports[_0xa5d0('0x36')]=function(_0x1ad4c5,_0x24771a){return db[_0xa5d0('0x20')][_0xa5d0('0x36')](_0x1ad4c5[_0xa5d0('0x37')],{})[_0xa5d0('0x17')](respondWithResult(_0x24771a,0xc9))[_0xa5d0('0x25')](handleError(_0x24771a,null));};exports['update']=function(_0x1901f8,_0x5eb745){if(_0x1901f8['body']['id']){delete _0x1901f8[_0xa5d0('0x37')]['id'];}return db[_0xa5d0('0x20')][_0xa5d0('0x35')]({'where':{'id':_0x1901f8[_0xa5d0('0x29')]['id']}})[_0xa5d0('0x17')](handleEntityNotFound(_0x5eb745,null))[_0xa5d0('0x17')](saveUpdates(_0x1901f8[_0xa5d0('0x37')],null))[_0xa5d0('0x17')](respondWithResult(_0x5eb745,null))['catch'](handleError(_0x5eb745,null));};exports['destroy']=function(_0x383957,_0x1395d6){return db[_0xa5d0('0x20')][_0xa5d0('0x35')]({'where':{'id':_0x383957[_0xa5d0('0x29')]['id']}})[_0xa5d0('0x17')](handleEntityNotFound(_0x1395d6,null))[_0xa5d0('0x17')](removeEntity(_0x1395d6,null))['catch'](handleError(_0x1395d6,null));};exports[_0xa5d0('0x38')]=function(_0x191608,_0x98e5f){return db[_0xa5d0('0x20')]['describe']()[_0xa5d0('0x17')](respondWithResult(_0x98e5f,null))[_0xa5d0('0x25')](handleError(_0x98e5f,null));};exports['addMessage']=function(_0x17992c,_0x39b980){return db[_0xa5d0('0x39')][_0xa5d0('0x35')]({'where':{'id':_0x17992c[_0xa5d0('0x29')]['id']}})[_0xa5d0('0x17')](handleEntityNotFound(_0x39b980,null))[_0xa5d0('0x17')](function(_0x41bce4){if(_0x41bce4){return _0x41bce4[_0xa5d0('0x3a')](_0x17992c[_0xa5d0('0x37')][_0xa5d0('0x3b')],_[_0xa5d0('0x3c')](_0x17992c[_0xa5d0('0x37')],[_0xa5d0('0x3b'),'id'])||{});}})[_0xa5d0('0x17')](respondWithResult(_0x39b980,null))['catch'](handleError(_0x39b980,null));};exports[_0xa5d0('0x3d')]=function(_0x3910b9,_0x235c97){var _0x2ccf48={'raw':![],'where':{}};var _0x35909e={};var _0x323921={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xa5d0('0x3e')]({'where':{'id':_0x3910b9[_0xa5d0('0x29')]['id']}})[_0xa5d0('0x17')](handleEntityNotFound(_0x235c97,null))[_0xa5d0('0x17')](function(_0x4d6033){if(_0x4d6033){_0x35909e[_0xa5d0('0x2d')]=_[_0xa5d0('0x2b')](db[_0xa5d0('0x39')]['rawAttributes']);_0x35909e[_0xa5d0('0x24')]=_[_0xa5d0('0x2b')](_0x3910b9[_0xa5d0('0x24')]);_0x35909e['filters']=_[_0xa5d0('0x2f')](_0x35909e['model'],_0x35909e[_0xa5d0('0x24')]);_0x2ccf48[_0xa5d0('0x2e')]=_[_0xa5d0('0x2f')](_0x35909e[_0xa5d0('0x2d')],qs[_0xa5d0('0x30')](_0x3910b9[_0xa5d0('0x24')]['fields']));_0x2ccf48['attributes']=_0x2ccf48[_0xa5d0('0x2e')][_0xa5d0('0x31')]?_0x2ccf48[_0xa5d0('0x2e')]:_0x35909e[_0xa5d0('0x2d')];if(!_0x3910b9['query'][_0xa5d0('0x3f')](_0xa5d0('0x40'))){_0x2ccf48[_0xa5d0('0x13')]=qs['limit'](_0x3910b9[_0xa5d0('0x24')][_0xa5d0('0x13')]);_0x2ccf48['offset']=qs[_0xa5d0('0x12')](_0x3910b9['query'][_0xa5d0('0x12')]);}_0x2ccf48[_0xa5d0('0x41')]=qs[_0xa5d0('0x42')](_0x3910b9[_0xa5d0('0x24')][_0xa5d0('0x42')]);_0x2ccf48[_0xa5d0('0x43')]=qs['filters'](_[_0xa5d0('0x44')](_0x3910b9[_0xa5d0('0x24')],_0x35909e['filters']));_0x2ccf48[_0xa5d0('0x43')][_0xa5d0('0x45')]=_0x4d6033['id'];if(_0x3910b9['query']['filter']){_0x2ccf48[_0xa5d0('0x43')]=_[_0xa5d0('0x33')](_0x2ccf48['where'],{'$or':_[_0xa5d0('0x46')](_0x2ccf48['attributes'],function(_0x29330d){var _0x25cdbc={};_0x25cdbc[_0x29330d]={'$like':'%'+_0x3910b9[_0xa5d0('0x24')][_0xa5d0('0x47')]+'%'};return _0x25cdbc;})});}if(_0x3910b9[_0xa5d0('0x24')][_0xa5d0('0x48')]){var _0x308182=_0x3910b9['query'][_0xa5d0('0x48')]['split'](',');var _0x2c9526={};_0x2c9526[_0x308182[0x0]]={'$gte':moment(_0x308182[0x1])[_0xa5d0('0x49')](_0xa5d0('0x4a'))};_0x2ccf48[_0xa5d0('0x43')]=_['merge'](_0x2ccf48['where'],_0x2c9526);}_0x2ccf48=_[_0xa5d0('0x33')]({},_0x2ccf48,_0x3910b9[_0xa5d0('0x34')]);return db[_0xa5d0('0x39')][_0xa5d0('0x14')]({'where':_0x2ccf48['where']})[_0xa5d0('0x17')](function(_0x33633c){_0x323921['count']=_0x33633c;if(_0x3910b9[_0xa5d0('0x24')][_0xa5d0('0x32')]){_0x2ccf48['include']=[{'all':!![]}];}return db[_0xa5d0('0x39')][_0xa5d0('0x22')](_0x2ccf48);})[_0xa5d0('0x17')](function(_0x215186){_0x323921[_0xa5d0('0x4b')]=_0x215186;return _0x323921;});}})[_0xa5d0('0x17')](respondWithFilteredResult(_0x235c97,_0x2ccf48))[_0xa5d0('0x25')](handleError(_0x235c97,null));};exports[_0xa5d0('0x4c')]=function(_0x905439,_0x2b42c5){return db[_0xa5d0('0x20')][_0xa5d0('0x35')]({'where':{'id':_0x905439[_0xa5d0('0x29')]['id']}})[_0xa5d0('0x17')](handleEntityNotFound(_0x2b42c5,null))[_0xa5d0('0x17')](function(_0x204c8e){if(_0x204c8e){return _0x204c8e[_0xa5d0('0x4d')](_0x905439['body'][_0xa5d0('0x3b')],_[_0xa5d0('0x3c')](_0x905439[_0xa5d0('0x37')],['ids','id'])||{})['spread'](function(){return db[_0xa5d0('0x4e')][_0xa5d0('0x22')]({'attributes':['id',_0xa5d0('0x1d'),_0xa5d0('0x4f')],'where':{'id':_0x905439['body'][_0xa5d0('0x3b')]}});})[_0xa5d0('0x17')](function(_0x7a3c1d){socket[_0xa5d0('0x50')](_0xa5d0('0x51'),{'id':Number(_0x905439[_0xa5d0('0x29')]['id']),'tags':_0x7a3c1d||[]});return{'id':Number(_0x905439[_0xa5d0('0x29')]['id']),'tags':_0x7a3c1d||[]};});}})[_0xa5d0('0x17')](respondWithResult(_0x2b42c5,null))[_0xa5d0('0x25')](handleError(_0x2b42c5,null));};exports[_0xa5d0('0x52')]=function(_0x4b4822,_0x57cb75){return db[_0xa5d0('0x20')]['find']({'where':{'id':_0x4b4822[_0xa5d0('0x29')]['id']}})[_0xa5d0('0x17')](handleEntityNotFound(_0x57cb75,null))['then'](function(_0x5973bf){if(_0x5973bf){return _0x5973bf['removeTags'](_0x4b4822['query'][_0xa5d0('0x3b')]);}})[_0xa5d0('0x17')](respondWithStatusCode(_0x57cb75,null))[_0xa5d0('0x25')](handleError(_0x57cb75,null));};exports['download']=function(_0x25c44b,_0x5a189f){var _0x18819d=moment()[_0xa5d0('0x53')]()['toString']();var _0x313234=path[_0xa5d0('0x54')](config[_0xa5d0('0x55')],_0xa5d0('0x56'),'files',_0xa5d0('0x57'));var _0x7e1dd4=path['join'](config[_0xa5d0('0x55')],_0xa5d0('0x56'),_0xa5d0('0x58'),_0xa5d0('0x59'));var _0x3114d=path['join'](_0x313234,_0x18819d);var _0xe8b80b=util['format'](_0xa5d0('0x5a'),_0x25c44b[_0xa5d0('0x29')]['id'],_0x18819d);var _0x4c25bd=path[_0xa5d0('0x54')](_0x313234,_0xe8b80b);var _0x4c3607=[];_0x4c3607['push']({'model':db['User'],'as':'User','attributes':['id',_0xa5d0('0x5b')],'raw':!![]});_0x4c3607[_0xa5d0('0x5c')]({'model':db[_0xa5d0('0x5d')],'as':_0xa5d0('0x5e'),'attributes':['id',_0xa5d0('0x5f'),_0xa5d0('0x60')],'raw':!![]});if(_0x25c44b['query'][_0xa5d0('0x59')]){_0x4c3607[_0xa5d0('0x5c')]({'model':db[_0xa5d0('0x61')],'as':_0xa5d0('0x61'),'raw':!![]});}var _0x12af83=[{'model':db[_0xa5d0('0x39')],'as':_0xa5d0('0x62'),'attributes':['id','body','createdAt',_0xa5d0('0x63'),'secret',_0xa5d0('0x64')],'include':_0x4c3607}];_0x12af83[_0xa5d0('0x5c')]({'model':db[_0xa5d0('0x65')],'as':_0xa5d0('0x66'),'attributes':['id',_0xa5d0('0x1d')]});_0x12af83[_0xa5d0('0x5c')]({'model':db[_0xa5d0('0x67')],'as':'Owner','attributes':['id','fullname']});return db['OpenchannelInteraction'][_0xa5d0('0x35')]({'where':{'id':_0x25c44b[_0xa5d0('0x29')]['id']},'include':_0x12af83})[_0xa5d0('0x17')](handleEntityNotFound(_0x5a189f,null))[_0xa5d0('0x17')](function(_0x207b38){if(_0x207b38){var _0x34c9a0=_0x207b38[_0xa5d0('0x68')]({'plain':!![]});fs[_0xa5d0('0x69')](_0x3114d);var _0x5e4664={'channel':_0xa5d0('0x6a'),'account':_0x34c9a0[_0xa5d0('0x66')]['name'],'agent':_0x34c9a0[_0xa5d0('0x6b')]?_0x34c9a0[_0xa5d0('0x6b')][_0xa5d0('0x5b')]:_0xa5d0('0x6c'),'createdAt':moment(_0x34c9a0[_0xa5d0('0x6d')])[_0xa5d0('0x49')](_0xa5d0('0x4a'))[_0xa5d0('0x6e')](),'closedAt':_0x34c9a0['closed']?moment(_0x34c9a0[_0xa5d0('0x6f')])['format'](_0xa5d0('0x4a'))[_0xa5d0('0x6e')]():'','disposition':_0x34c9a0[_0xa5d0('0x70')],'visibility':_0x34c9a0[_0xa5d0('0x71')]?_0xa5d0('0x72'):_0xa5d0('0x73'),'messages':_(_0x34c9a0[_0xa5d0('0x62')])[_0xa5d0('0x47')]({'secret':![]})[_0xa5d0('0x46')](function(_0x11fd86){if(_0x11fd86[_0xa5d0('0x61')]){var _0x36a05a=path[_0xa5d0('0x54')](_0x7e1dd4,_0x11fd86[_0xa5d0('0x61')]['basename']);if(fs[_0xa5d0('0x74')](_0x36a05a)){fs[_0xa5d0('0x75')](_0x36a05a)[_0xa5d0('0x76')](fs[_0xa5d0('0x77')](path[_0xa5d0('0x54')](_0x3114d,_0x11fd86['Attachment'][_0xa5d0('0x78')])));}}return{'date':moment(_0x11fd86[_0xa5d0('0x6d')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa5d0('0x6e')](),'sender':_0x11fd86[_0xa5d0('0x63')]===_0xa5d0('0x79')?_0x11fd86['User']?_0x11fd86[_0xa5d0('0x67')][_0xa5d0('0x5b')]:_0xa5d0('0x7a'):_0x11fd86[_0xa5d0('0x5e')][_0xa5d0('0x5f')]+(_0x11fd86['Contact'][_0xa5d0('0x60')]?'\x20'+_0x11fd86['Contact'][_0xa5d0('0x60')]:''),'body':_0x11fd86[_0xa5d0('0x61')]?_0x11fd86[_0xa5d0('0x61')][_0xa5d0('0x78')]:_0x11fd86[_0xa5d0('0x37')],'direction':_0x11fd86[_0xa5d0('0x63')]===_0xa5d0('0x79')?'A':'C','secret':_0x11fd86['secret'],'read':_0x11fd86[_0xa5d0('0x64')],'attachment':_0x11fd86[_0xa5d0('0x61')]};})[_0xa5d0('0x7b')]()};return ejs[_0xa5d0('0x7c')](path[_0xa5d0('0x54')](config[_0xa5d0('0x55')],_0xa5d0('0x56'),_0xa5d0('0x7d'),'downloadInteraction.ejs'),{'interaction':_0x5e4664})[_0xa5d0('0x17')](function(_0x1ff3e0){var _0x341cc8=path[_0xa5d0('0x54')](_0x3114d,'transcript-'+_0x34c9a0['id']+'-'+_0x18819d+'.pdf');var _0x37f498={'path':_0x341cc8,'channel':_0xa5d0('0x6a'),'interactionId':_0x34c9a0['id']};return pdf['createPdfFromHTML'](_0x1ff3e0,_0x37f498);})[_0xa5d0('0x17')](function(){return new Promise(function(_0x1fd2a2,_0x10712a){zipdir(_0x3114d,{'saveTo':_0x4c25bd},function(_0x16fbd3,_0x3d58df){if(_0x16fbd3)return _0x10712a(_0x16fbd3);return _0x1fd2a2(_0x3d58df);});})[_0xa5d0('0x17')](function(){return new Promise(function(_0x493a0d,_0x19dbe9){rimraf(_0x3114d,function(_0x444410){if(_0x444410)_0x19dbe9(_0x444410);return _0x493a0d();});});})[_0xa5d0('0x17')](function(){return _0x5a189f[_0xa5d0('0x7e')](_0x4c25bd,_0xe8b80b,function(_0x410598){if(_0x410598){logger[_0xa5d0('0x1b')]('Unable\x20to\x20delete\x20zip\x20file',_0x410598);}else{fs[_0xa5d0('0x7f')](_0x4c25bd);}});});});}else{return _0x5a189f[_0xa5d0('0x1a')](0xc8);}})['catch'](handleError(_0x5a189f,null));}; \ No newline at end of file +var _0xa5e0=['model','includeAll','include','options','find','create','body','destroy','addMessage','ids','getMessages','OpenchannelMessage','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','OpenchannelInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','Contact','firstName','lastName','Attachment','direction','secret','read','OpenchannelAccount','fullname','mkdirSync','Openchannel','Account','Owner','N.A.','createdAt','toString','closed','closedAt','disposition','threadId','basename','createReadStream','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','type','findAll','catch','show','query','from','params','keys','intersection','attributes','fields'];(function(_0x44665c,_0x4f57c4){var _0x1a8e4a=function(_0x2a940b){while(--_0x2a940b){_0x44665c['push'](_0x44665c['shift']());}};_0x1a8e4a(++_0x4f57c4);}(_0xa5e0,0xcc));var _0x0a5e=function(_0xd21187,_0x212619){_0xd21187=_0xd21187-0x0;var _0x1cf652=_0xa5e0[_0xd21187];return _0x1cf652;};'use strict';var rimraf=require(_0x0a5e('0x0'));var zipdir=require(_0x0a5e('0x1'));var moment=require('moment');var util=require(_0x0a5e('0x2'));var path=require(_0x0a5e('0x3'));var ejs=require(_0x0a5e('0x4'));var fs=require('fs');var _=require(_0x0a5e('0x5'));var Redis=require(_0x0a5e('0x6'));var interaction=require(_0x0a5e('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x0a5e('0x8'));var logger=require(_0x0a5e('0x9'))(_0x0a5e('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0a5e('0xb')]=_[_0x0a5e('0xc')](config[_0x0a5e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a5e('0xd'))(new Redis(config[_0x0a5e('0xb')]));require(_0x0a5e('0xe'))[_0x0a5e('0xf')](socket);function respondWithStatusCode(_0xda487d,_0x232f9a){_0x232f9a=_0x232f9a||0xcc;return function(_0x5ab870){if(_0x5ab870){return _0xda487d[_0x0a5e('0x10')](_0x232f9a);}return _0xda487d[_0x0a5e('0x11')](_0x232f9a)[_0x0a5e('0x12')]();};}function respondWithResult(_0x482300,_0x3740c3){_0x3740c3=_0x3740c3||0xc8;return function(_0x48c116){if(_0x48c116){return _0x482300['status'](_0x3740c3)[_0x0a5e('0x13')](_0x48c116);}};}function respondWithFilteredResult(_0xde3db6,_0x12f2c7){return function(_0x566457){if(_0x566457){var _0xd350f2=typeof _0x12f2c7[_0x0a5e('0x14')]===_0x0a5e('0x15')&&typeof _0x12f2c7[_0x0a5e('0x16')]==='undefined';var _0x5bef2d=_0x566457[_0x0a5e('0x17')];var _0x218f9b=_0xd350f2?0x0:_0x12f2c7['offset'];var _0x579ada=_0xd350f2?_0x566457['count']:_0x12f2c7['offset']+_0x12f2c7['limit'];var _0x18b0ba;if(_0x579ada>=_0x5bef2d){_0x579ada=_0x5bef2d;_0x18b0ba=0xc8;}else{_0x18b0ba=0xce;}_0xde3db6['status'](_0x18b0ba);return _0xde3db6['set'](_0x0a5e('0x18'),_0x218f9b+'-'+_0x579ada+'/'+_0x5bef2d)[_0x0a5e('0x13')](_0x566457);}return null;};}function saveUpdates(_0x382605){return function(_0x2eb18f){if(_0x2eb18f){return _0x2eb18f[_0x0a5e('0x19')](_0x382605)[_0x0a5e('0x1a')](function(_0x2b8c97){return _0x2b8c97;});}return null;};}function removeEntity(_0x5e54df){return function(_0x146204){if(_0x146204){return _0x146204['destroy']()['then'](function(){_0x5e54df[_0x0a5e('0x11')](0xcc)[_0x0a5e('0x12')]();});}};}function handleEntityNotFound(_0x43ab78){return function(_0x5d8caf){if(!_0x5d8caf){_0x43ab78[_0x0a5e('0x10')](0x194);}return _0x5d8caf;};}function handleError(_0x435a38,_0x211e34){_0x211e34=_0x211e34||0x1f4;return function(_0x511faf){logger[_0x0a5e('0x1b')](_0x511faf[_0x0a5e('0x1c')]);if(_0x511faf[_0x0a5e('0x1d')]){delete _0x511faf[_0x0a5e('0x1d')];}_0x435a38[_0x0a5e('0x11')](_0x211e34)[_0x0a5e('0x1e')](_0x511faf);};}exports[_0x0a5e('0x1f')]=function(_0x22ae3d,_0x302e8d){var _0xa9d082={};var _0x160c7e=_[_0x0a5e('0x20')](db[_0x0a5e('0x21')][_0x0a5e('0x22')],function(_0x25de1d){return{'name':_0x25de1d['fieldName'],'type':_0x25de1d[_0x0a5e('0x23')]['key']};});_0xa9d082=qs['getOptions'](_0x160c7e,_0x22ae3d);return interaction[_0x0a5e('0x24')]('openchannel',_0x22ae3d['query'],_0x22ae3d['user'],_0xa9d082,_0x160c7e)[_0x0a5e('0x1a')](respondWithFilteredResult(_0x302e8d,_0xa9d082))[_0x0a5e('0x25')](handleError(_0x302e8d,null));};exports[_0x0a5e('0x26')]=function(_0x183448,_0x36be6c){var _0x27e5c3={};if(_0x183448[_0x0a5e('0x27')][_0x0a5e('0x23')]&&_0x183448[_0x0a5e('0x27')][_0x0a5e('0x23')]===_0x0a5e('0x28')){_0x27e5c3[_0x0a5e('0x28')]=_0x183448['params']['id'];}else{_0x27e5c3['id']=_0x183448[_0x0a5e('0x29')]['id'];}var _0x10d3e9={'raw':![],'where':_0x27e5c3},_0x4ddaae={};_0x4ddaae['model']=_['keys'](db[_0x0a5e('0x21')][_0x0a5e('0x22')]);_0x4ddaae[_0x0a5e('0x27')]=_[_0x0a5e('0x2a')](_0x183448['query']);_0x4ddaae['filters']=_[_0x0a5e('0x2b')](_0x4ddaae['model'],_0x4ddaae[_0x0a5e('0x27')]);_0x10d3e9[_0x0a5e('0x2c')]=_[_0x0a5e('0x2b')](_0x4ddaae['model'],qs[_0x0a5e('0x2d')](_0x183448[_0x0a5e('0x27')][_0x0a5e('0x2d')]));_0x10d3e9[_0x0a5e('0x2c')]=_0x10d3e9[_0x0a5e('0x2c')]['length']?_0x10d3e9[_0x0a5e('0x2c')]:_0x4ddaae[_0x0a5e('0x2e')];if(_0x183448[_0x0a5e('0x27')][_0x0a5e('0x2f')]){_0x10d3e9[_0x0a5e('0x30')]=[{'all':!![]}];}_0x10d3e9=_['merge']({},_0x10d3e9,_0x183448[_0x0a5e('0x31')]);return db[_0x0a5e('0x21')][_0x0a5e('0x32')](_0x10d3e9)[_0x0a5e('0x1a')](handleEntityNotFound(_0x36be6c,null))[_0x0a5e('0x1a')](respondWithResult(_0x36be6c,null))[_0x0a5e('0x25')](handleError(_0x36be6c,null));};exports[_0x0a5e('0x33')]=function(_0x53682c,_0x27e85f){return db[_0x0a5e('0x21')][_0x0a5e('0x33')](_0x53682c[_0x0a5e('0x34')],{})[_0x0a5e('0x1a')](respondWithResult(_0x27e85f,0xc9))[_0x0a5e('0x25')](handleError(_0x27e85f,null));};exports[_0x0a5e('0x19')]=function(_0x4d4942,_0x40d16e){if(_0x4d4942[_0x0a5e('0x34')]['id']){delete _0x4d4942[_0x0a5e('0x34')]['id'];}return db[_0x0a5e('0x21')][_0x0a5e('0x32')]({'where':{'id':_0x4d4942[_0x0a5e('0x29')]['id']}})[_0x0a5e('0x1a')](handleEntityNotFound(_0x40d16e,null))[_0x0a5e('0x1a')](saveUpdates(_0x4d4942[_0x0a5e('0x34')],null))[_0x0a5e('0x1a')](respondWithResult(_0x40d16e,null))['catch'](handleError(_0x40d16e,null));};exports[_0x0a5e('0x35')]=function(_0x2489b8,_0x2f2a97){return db[_0x0a5e('0x21')][_0x0a5e('0x32')]({'where':{'id':_0x2489b8[_0x0a5e('0x29')]['id']}})['then'](handleEntityNotFound(_0x2f2a97,null))[_0x0a5e('0x1a')](removeEntity(_0x2f2a97,null))[_0x0a5e('0x25')](handleError(_0x2f2a97,null));};exports['describe']=function(_0x54af53,_0x4e9a37){return db[_0x0a5e('0x21')]['describe']()['then'](respondWithResult(_0x4e9a37,null))[_0x0a5e('0x25')](handleError(_0x4e9a37,null));};exports[_0x0a5e('0x36')]=function(_0x388d70,_0x173e26){return db['OpenchannelMessage']['find']({'where':{'id':_0x388d70[_0x0a5e('0x29')]['id']}})['then'](handleEntityNotFound(_0x173e26,null))[_0x0a5e('0x1a')](function(_0xb5f598){if(_0xb5f598){return _0xb5f598[_0x0a5e('0x36')](_0x388d70[_0x0a5e('0x34')][_0x0a5e('0x37')],_['omit'](_0x388d70[_0x0a5e('0x34')],[_0x0a5e('0x37'),'id'])||{});}})[_0x0a5e('0x1a')](respondWithResult(_0x173e26,null))[_0x0a5e('0x25')](handleError(_0x173e26,null));};exports[_0x0a5e('0x38')]=function(_0x1dea35,_0x376a84){var _0x365963={'raw':![],'where':{}};var _0x4b5de3={};var _0x1a782d={'count':0x0,'rows':[]};return db[_0x0a5e('0x21')]['findOne']({'where':{'id':_0x1dea35[_0x0a5e('0x29')]['id']}})[_0x0a5e('0x1a')](handleEntityNotFound(_0x376a84,null))[_0x0a5e('0x1a')](function(_0x1f8177){if(_0x1f8177){_0x4b5de3[_0x0a5e('0x2e')]=_['keys'](db[_0x0a5e('0x39')][_0x0a5e('0x22')]);_0x4b5de3[_0x0a5e('0x27')]=_['keys'](_0x1dea35[_0x0a5e('0x27')]);_0x4b5de3['filters']=_['intersection'](_0x4b5de3[_0x0a5e('0x2e')],_0x4b5de3[_0x0a5e('0x27')]);_0x365963[_0x0a5e('0x2c')]=_['intersection'](_0x4b5de3[_0x0a5e('0x2e')],qs[_0x0a5e('0x2d')](_0x1dea35[_0x0a5e('0x27')][_0x0a5e('0x2d')]));_0x365963[_0x0a5e('0x2c')]=_0x365963['attributes'][_0x0a5e('0x3a')]?_0x365963['attributes']:_0x4b5de3[_0x0a5e('0x2e')];if(!_0x1dea35[_0x0a5e('0x27')][_0x0a5e('0x3b')](_0x0a5e('0x3c'))){_0x365963[_0x0a5e('0x16')]=qs[_0x0a5e('0x16')](_0x1dea35['query']['limit']);_0x365963[_0x0a5e('0x14')]=qs[_0x0a5e('0x14')](_0x1dea35[_0x0a5e('0x27')][_0x0a5e('0x14')]);}_0x365963[_0x0a5e('0x3d')]=qs[_0x0a5e('0x3e')](_0x1dea35[_0x0a5e('0x27')][_0x0a5e('0x3e')]);_0x365963[_0x0a5e('0x3f')]=qs[_0x0a5e('0x40')](_[_0x0a5e('0x41')](_0x1dea35[_0x0a5e('0x27')],_0x4b5de3[_0x0a5e('0x40')]));_0x365963[_0x0a5e('0x3f')][_0x0a5e('0x42')]=_0x1f8177['id'];if(_0x1dea35[_0x0a5e('0x27')][_0x0a5e('0x43')]){_0x365963['where']=_[_0x0a5e('0x44')](_0x365963[_0x0a5e('0x3f')],{'$or':_[_0x0a5e('0x20')](_0x365963[_0x0a5e('0x2c')],function(_0x183938){var _0x407215={};_0x407215[_0x183938]={'$like':'%'+_0x1dea35[_0x0a5e('0x27')]['filter']+'%'};return _0x407215;})});}if(_0x1dea35[_0x0a5e('0x27')][_0x0a5e('0x45')]){var _0x1027df=_0x1dea35[_0x0a5e('0x27')][_0x0a5e('0x45')][_0x0a5e('0x46')](',');var _0x42466f={};_0x42466f[_0x1027df[0x0]]={'$gte':moment(_0x1027df[0x1])[_0x0a5e('0x47')](_0x0a5e('0x48'))};_0x365963[_0x0a5e('0x3f')]=_[_0x0a5e('0x44')](_0x365963[_0x0a5e('0x3f')],_0x42466f);}_0x365963=_[_0x0a5e('0x44')]({},_0x365963,_0x1dea35[_0x0a5e('0x31')]);return db[_0x0a5e('0x39')][_0x0a5e('0x17')]({'where':_0x365963[_0x0a5e('0x3f')]})['then'](function(_0x398ef6){_0x1a782d['count']=_0x398ef6;if(_0x1dea35[_0x0a5e('0x27')][_0x0a5e('0x2f')]){_0x365963[_0x0a5e('0x30')]=[{'all':!![]}];}return db[_0x0a5e('0x39')][_0x0a5e('0x24')](_0x365963);})[_0x0a5e('0x1a')](function(_0x374b50){_0x1a782d[_0x0a5e('0x49')]=_0x374b50;return _0x1a782d;});}})[_0x0a5e('0x1a')](respondWithFilteredResult(_0x376a84,_0x365963))[_0x0a5e('0x25')](handleError(_0x376a84,null));};exports[_0x0a5e('0x4a')]=function(_0x3ec6a6,_0x16df97){return db[_0x0a5e('0x21')]['find']({'where':{'id':_0x3ec6a6['params']['id']}})[_0x0a5e('0x1a')](handleEntityNotFound(_0x16df97,null))[_0x0a5e('0x1a')](function(_0x314d60){if(_0x314d60){return _0x314d60['setTags'](_0x3ec6a6[_0x0a5e('0x34')][_0x0a5e('0x37')],_['omit'](_0x3ec6a6[_0x0a5e('0x34')],['ids','id'])||{})[_0x0a5e('0x4b')](function(){return db[_0x0a5e('0x4c')][_0x0a5e('0x24')]({'attributes':['id',_0x0a5e('0x1d'),_0x0a5e('0x4d')],'where':{'id':_0x3ec6a6[_0x0a5e('0x34')]['ids']}});})[_0x0a5e('0x1a')](function(_0xc043b2){socket[_0x0a5e('0x4e')](_0x0a5e('0x4f'),{'id':Number(_0x3ec6a6['params']['id']),'tags':_0xc043b2||[]});return{'id':Number(_0x3ec6a6[_0x0a5e('0x29')]['id']),'tags':_0xc043b2||[]};});}})[_0x0a5e('0x1a')](respondWithResult(_0x16df97,null))[_0x0a5e('0x25')](handleError(_0x16df97,null));};exports[_0x0a5e('0x50')]=function(_0x58137d,_0x1a8a12){return db['OpenchannelInteraction'][_0x0a5e('0x32')]({'where':{'id':_0x58137d[_0x0a5e('0x29')]['id']}})['then'](handleEntityNotFound(_0x1a8a12,null))[_0x0a5e('0x1a')](function(_0x275e35){if(_0x275e35){return _0x275e35[_0x0a5e('0x50')](_0x58137d[_0x0a5e('0x27')][_0x0a5e('0x37')]);}})[_0x0a5e('0x1a')](respondWithStatusCode(_0x1a8a12,null))['catch'](handleError(_0x1a8a12,null));};exports[_0x0a5e('0x51')]=function(_0x48a801,_0x27a057){var _0x4b72b3=moment()['unix']()['toString']();var _0x283198=path[_0x0a5e('0x52')](config[_0x0a5e('0x53')],_0x0a5e('0x54'),_0x0a5e('0x55'),_0x0a5e('0x56'));var _0x2d8260=path['join'](config[_0x0a5e('0x53')],_0x0a5e('0x54'),'files',_0x0a5e('0x57'));var _0x5604ca=path[_0x0a5e('0x52')](_0x283198,_0x4b72b3);var _0x5b8139=util[_0x0a5e('0x47')](_0x0a5e('0x58'),_0x48a801['params']['id'],_0x4b72b3);var _0x3ce859=path[_0x0a5e('0x52')](_0x283198,_0x5b8139);var _0x5d4597=[];_0x5d4597[_0x0a5e('0x59')]({'model':db[_0x0a5e('0x5a')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5d4597[_0x0a5e('0x59')]({'model':db['CmContact'],'as':_0x0a5e('0x5b'),'attributes':['id',_0x0a5e('0x5c'),_0x0a5e('0x5d')],'raw':!![]});if(_0x48a801['query'][_0x0a5e('0x57')]){_0x5d4597['push']({'model':db[_0x0a5e('0x5e')],'as':_0x0a5e('0x5e'),'raw':!![]});}var _0x42eb72=[{'model':db[_0x0a5e('0x39')],'as':'Messages','attributes':['id',_0x0a5e('0x34'),'createdAt',_0x0a5e('0x5f'),_0x0a5e('0x60'),_0x0a5e('0x61')],'include':_0x5d4597}];_0x42eb72['push']({'model':db[_0x0a5e('0x62')],'as':'Account','attributes':['id',_0x0a5e('0x1d')]});_0x42eb72['push']({'model':db[_0x0a5e('0x5a')],'as':'Owner','attributes':['id',_0x0a5e('0x63')]});return db[_0x0a5e('0x21')]['find']({'where':{'id':_0x48a801['params']['id']},'include':_0x42eb72})[_0x0a5e('0x1a')](handleEntityNotFound(_0x27a057,null))['then'](function(_0x1e031a){if(_0x1e031a){var _0x3c02c1=_0x1e031a['get']({'plain':!![]});fs[_0x0a5e('0x64')](_0x5604ca);var _0x39482f={'channel':_0x0a5e('0x65'),'account':_0x3c02c1[_0x0a5e('0x66')]['name'],'agent':_0x3c02c1[_0x0a5e('0x67')]?_0x3c02c1['Owner'][_0x0a5e('0x63')]:_0x0a5e('0x68'),'createdAt':moment(_0x3c02c1[_0x0a5e('0x69')])[_0x0a5e('0x47')](_0x0a5e('0x48'))[_0x0a5e('0x6a')](),'closedAt':_0x3c02c1[_0x0a5e('0x6b')]?moment(_0x3c02c1[_0x0a5e('0x6c')])['format'](_0x0a5e('0x48'))[_0x0a5e('0x6a')]():'','disposition':_0x3c02c1[_0x0a5e('0x6d')],'visibility':_0x3c02c1[_0x0a5e('0x6e')]?'Public':'Private','messages':_(_0x3c02c1['Messages'])['filter']({'secret':![]})[_0x0a5e('0x20')](function(_0x49d232){if(_0x49d232['Attachment']){var _0x5a0d3a=path['join'](_0x2d8260,_0x49d232[_0x0a5e('0x5e')][_0x0a5e('0x6f')]);if(fs['existsSync'](_0x5a0d3a)){fs[_0x0a5e('0x70')](_0x5a0d3a)['pipe'](fs[_0x0a5e('0x71')](path[_0x0a5e('0x52')](_0x5604ca,_0x49d232[_0x0a5e('0x5e')][_0x0a5e('0x6f')])));}}return{'date':moment(_0x49d232[_0x0a5e('0x69')])[_0x0a5e('0x47')](_0x0a5e('0x48'))[_0x0a5e('0x6a')](),'sender':_0x49d232[_0x0a5e('0x5f')]===_0x0a5e('0x72')?_0x49d232[_0x0a5e('0x5a')]?_0x49d232[_0x0a5e('0x5a')][_0x0a5e('0x63')]:_0x0a5e('0x73'):_0x49d232[_0x0a5e('0x5b')][_0x0a5e('0x5c')]+(_0x49d232[_0x0a5e('0x5b')]['lastName']?'\x20'+_0x49d232[_0x0a5e('0x5b')][_0x0a5e('0x5d')]:''),'body':_0x49d232[_0x0a5e('0x5e')]?_0x49d232[_0x0a5e('0x5e')][_0x0a5e('0x6f')]:_0x49d232[_0x0a5e('0x34')],'direction':_0x49d232[_0x0a5e('0x5f')]==='out'?'A':'C','secret':_0x49d232[_0x0a5e('0x60')],'read':_0x49d232[_0x0a5e('0x61')],'attachment':_0x49d232[_0x0a5e('0x5e')]};})[_0x0a5e('0x74')]()};return ejs[_0x0a5e('0x75')](path[_0x0a5e('0x52')](config[_0x0a5e('0x53')],_0x0a5e('0x54'),_0x0a5e('0x76'),_0x0a5e('0x77')),{'interaction':_0x39482f})['then'](function(_0x5c8b3f){var _0x2a4bff=path[_0x0a5e('0x52')](_0x5604ca,_0x0a5e('0x78')+_0x3c02c1['id']+'-'+_0x4b72b3+_0x0a5e('0x79'));var _0x3fe118={'path':_0x2a4bff,'channel':_0x0a5e('0x65'),'interactionId':_0x3c02c1['id']};return pdf[_0x0a5e('0x7a')](_0x5c8b3f,_0x3fe118);})[_0x0a5e('0x1a')](function(){return new Promise(function(_0x5219e6,_0x2e09b8){zipdir(_0x5604ca,{'saveTo':_0x3ce859},function(_0x372222,_0x3b3103){if(_0x372222)return _0x2e09b8(_0x372222);return _0x5219e6(_0x3b3103);});})[_0x0a5e('0x1a')](function(){return new Promise(function(_0x28a2d7,_0x34ed68){rimraf(_0x5604ca,function(_0x4013dd){if(_0x4013dd)_0x34ed68(_0x4013dd);return _0x28a2d7();});});})[_0x0a5e('0x1a')](function(){return _0x27a057[_0x0a5e('0x51')](_0x3ce859,_0x5b8139,function(_0x134bef){if(_0x134bef){logger[_0x0a5e('0x1b')](_0x0a5e('0x7b'),_0x134bef);}else{fs[_0x0a5e('0x7c')](_0x3ce859);}});});});}else{return _0x27a057['sendStatus'](0xc8);}})[_0x0a5e('0x25')](handleError(_0x27a057,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f4a6b80..b5d2cc8 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 _0x441a=['update','getUsers','setDataValue','Users','map','then','emit','catch','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save'];(function(_0x370338,_0x4178ec){var _0x2e10df=function(_0x109471){while(--_0x109471){_0x370338['push'](_0x370338['shift']());}};_0x2e10df(++_0x4178ec);}(_0x441a,0x180));var _0xa441=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x441a[_0x1a36a5];return _0x746243;};'use strict';var EventEmitter=require(_0xa441('0x0'));var OpenchannelInteraction=require(_0xa441('0x1'))['db'][_0xa441('0x2')];var OpenchannelMessage=require(_0xa441('0x1'))['db'][_0xa441('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xa441('0x4')](0x0);var events={'afterCreate':_0xa441('0x5'),'afterUpdate':_0xa441('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4ca681){return function(_0x4e829c,_0x573ff0,_0x93c0d1){_0x4e829c[_0xa441('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x25d732){_0x4e829c[_0xa441('0x8')](_0xa441('0x9'),_0x25d732[_0xa441('0xa')](function(_0x279ebe){return{'id':_0x279ebe['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4e829c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa441('0xb')](function(_0x5a1fd7){_0x4e829c['setDataValue']('unreadMessages',_0x5a1fd7['length']);OpenchannelInteractionEvents[_0xa441('0xc')](_0x4ca681+':'+_0x4e829c['id'],_0x4e829c);OpenchannelInteractionEvents[_0xa441('0xc')](_0x4ca681,_0x4e829c);_0x93c0d1(null);})[_0xa441('0xd')](_0x93c0d1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xa441('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xa8b8=['../../mysqldb','OpenchannelMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events'];(function(_0x905b03,_0x537812){var _0x24f81b=function(_0x209bb9){while(--_0x209bb9){_0x905b03['push'](_0x905b03['shift']());}};_0x24f81b(++_0x537812);}(_0xa8b8,0x175));var _0x8a8b=function(_0x1513c6,_0x18b296){_0x1513c6=_0x1513c6-0x0;var _0x2c4021=_0xa8b8[_0x1513c6];return _0x2c4021;};'use strict';var EventEmitter=require(_0x8a8b('0x0'));var OpenchannelInteraction=require(_0x8a8b('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8a8b('0x1'))['db'][_0x8a8b('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a8b('0x3'),'afterUpdate':'update','afterDestroy':_0x8a8b('0x4')};function emitEvent(_0x120070){return function(_0x4516f9,_0x54c6b6,_0x428aec){_0x4516f9[_0x8a8b('0x5')]({'attributes':['id'],'raw':!![]})[_0x8a8b('0x6')](function(_0x259fd4){_0x4516f9[_0x8a8b('0x7')](_0x8a8b('0x8'),_0x259fd4[_0x8a8b('0x9')](function(_0x1d857a){return{'id':_0x1d857a['id']};}));return OpenchannelMessage[_0x8a8b('0xa')]({'where':{'OpenchannelInteractionId':_0x4516f9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8a8b('0x6')](function(_0x30bf3d){_0x4516f9['setDataValue'](_0x8a8b('0xb'),_0x30bf3d[_0x8a8b('0xc')]);OpenchannelInteractionEvents['emit'](_0x120070+':'+_0x4516f9['id'],_0x4516f9);OpenchannelInteractionEvents[_0x8a8b('0xd')](_0x120070,_0x4516f9);_0x428aec(null);})[_0x8a8b('0xe')](_0x428aec(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x8a8b('0xf')](e,emitEvent(event));}}module[_0x8a8b('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index dc5f660..7ef88fe 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 _0xa5aa=['bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0xf4adc3,_0x4e0b2e){_0xf4adc3=_0xf4adc3-0x0;var _0x3f297d=_0xa5aa[_0xf4adc3];return _0x3f297d;};'use strict';var _=require(_0xaa5a('0x0'));var util=require(_0xaa5a('0x1'));var logger=require('../../config/logger')(_0xaa5a('0x2'));var moment=require(_0xaa5a('0x3'));var BPromise=require(_0xaa5a('0x4'));var rp=require(_0xaa5a('0x5'));var fs=require('fs');var path=require(_0xaa5a('0x6'));var rimraf=require(_0xaa5a('0x7'));var config=require('../../config/environment');var attributes=require(_0xaa5a('0x8'));module[_0xaa5a('0x9')]=function(_0x46c8cc,_0x561d19){return _0x46c8cc['define'](_0xaa5a('0xa'),attributes,{'tableName':_0xaa5a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaa5a('0xc'),'hooks':{'beforeUpdate':function(_0x1c4893,_0x195acb,_0x5d1b4b){if(_0x1c4893[_0xaa5a('0xd')](_0xaa5a('0xe'))){_0x1c4893[_0xaa5a('0xf')]=moment()[_0xaa5a('0x10')](_0xaa5a('0x11'));}_0x5d1b4b(null,_0x1c4893);}}});}; \ No newline at end of file +var _0x27d1=['OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','lodash','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x27d1,0x1f4));var _0x127d=function(_0x148286,_0x49771b){_0x148286=_0x148286-0x0;var _0x2cb949=_0x27d1[_0x148286];return _0x2cb949;};'use strict';var _=require(_0x127d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x127d('0x1'));var moment=require(_0x127d('0x2'));var BPromise=require(_0x127d('0x3'));var rp=require(_0x127d('0x4'));var fs=require('fs');var path=require(_0x127d('0x5'));var rimraf=require(_0x127d('0x6'));var config=require('../../config/environment');var attributes=require(_0x127d('0x7'));module[_0x127d('0x8')]=function(_0x35cbb8,_0x5b9b0d){return _0x35cbb8[_0x127d('0x9')](_0x127d('0xa'),attributes,{'tableName':_0x127d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x127d('0xc'),'collate':_0x127d('0xd'),'hooks':{'beforeUpdate':function(_0x1673cd,_0x140d4a,_0x20d02c){if(_0x1673cd[_0x127d('0xe')]('closed')){_0x1673cd[_0x127d('0xf')]=moment()[_0x127d('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x20d02c(null,_0x1673cd);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 079bac1..c1bd559 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 _0x9c65=['body','options','where','attributes','limit','AddTagsToOpenchannelInteraction','find','then','addTags','ids','omit','spread','AddTags','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update'];(function(_0x1840c9,_0x27225f){var _0x1ae015=function(_0xbc618f){while(--_0xbc618f){_0x1840c9['push'](_0x1840c9['shift']());}};_0x1ae015(++_0x27225f);}(_0x9c65,0xfd));var _0x59c6=function(_0x480186,_0x502738){_0x480186=_0x480186-0x0;var _0x1bb53=_0x9c65[_0x480186];return _0x1bb53;};'use strict';var _=require('lodash');var util=require(_0x59c6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x59c6('0x1'));var fs=require('fs');var Redis=require(_0x59c6('0x2'));var db=require(_0x59c6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x59c6('0x4'))('rpc');var config=require(_0x59c6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x59c6('0x6')][_0x59c6('0x7')]({'port':0x232a});config[_0x59c6('0x8')]=_[_0x59c6('0x9')](config[_0x59c6('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x59c6('0xa'))(new Redis(config[_0x59c6('0x8')]));require('./openchannelInteraction.socket')[_0x59c6('0xb')](socket);function respondWithRpcPromise(_0x47bd52,_0x3c021f,_0x21a6a0){return new BPromise(function(_0x587ca2,_0x19e4f7){return client[_0x59c6('0xc')](_0x47bd52,_0x21a6a0)['then'](function(_0x1e8d7a){logger[_0x59c6('0xd')](_0x59c6('0xe'),_0x3c021f,'request\x20sent');logger[_0x59c6('0xf')](_0x59c6('0x10'),_0x3c021f,_0x59c6('0x11'),JSON[_0x59c6('0x12')](_0x1e8d7a));if(_0x1e8d7a[_0x59c6('0x13')]){if(_0x1e8d7a['error'][_0x59c6('0x14')]===0x1f4){logger[_0x59c6('0x13')](_0x59c6('0xe'),_0x3c021f,_0x1e8d7a[_0x59c6('0x13')][_0x59c6('0x15')]);return _0x19e4f7(_0x1e8d7a['error'][_0x59c6('0x15')]);}logger['error'](_0x59c6('0xe'),_0x3c021f,_0x1e8d7a[_0x59c6('0x13')]['message']);return _0x587ca2(_0x1e8d7a[_0x59c6('0x13')]['message']);}else{logger['info'](_0x59c6('0xe'),_0x3c021f,'request\x20sent');_0x587ca2(_0x1e8d7a[_0x59c6('0x16')][_0x59c6('0x15')]);}})[_0x59c6('0x17')](function(_0x3d8218){logger[_0x59c6('0x13')](_0x59c6('0xe'),_0x3c021f,_0x3d8218);_0x19e4f7(_0x3d8218);});});}exports[_0x59c6('0x18')]=function(_0x2bbd7f){var _0x1a08a3=this;return new Promise(function(_0x52a1a2,_0x470531){return db[_0x59c6('0x19')][_0x59c6('0x1a')](_0x2bbd7f[_0x59c6('0x1b')],{'raw':_0x2bbd7f['options']?_0x2bbd7f[_0x59c6('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bbd7f[_0x59c6('0x1c')]?_0x2bbd7f['options'][_0x59c6('0x1d')]||null:null,'attributes':_0x2bbd7f['options']?_0x2bbd7f[_0x59c6('0x1c')][_0x59c6('0x1e')]||null:null,'limit':_0x2bbd7f[_0x59c6('0x1c')]?_0x2bbd7f[_0x59c6('0x1c')][_0x59c6('0x1f')]||null:null})['then'](function(_0x109135){logger[_0x59c6('0xd')](_0x59c6('0x18'),_0x2bbd7f);logger[_0x59c6('0xf')](_0x59c6('0x18'),_0x2bbd7f,JSON[_0x59c6('0x12')](_0x109135));_0x52a1a2(_0x109135);})[_0x59c6('0x17')](function(_0x496f3e){logger[_0x59c6('0x13')](_0x59c6('0x18'),_0x496f3e['message'],_0x2bbd7f);_0x470531(_0x1a08a3['error'](0x1f4,_0x496f3e['message']));});});};exports[_0x59c6('0x20')]=function(_0x4926ea){return new Promise(function(_0x5eff96,_0x4dcdcf){return db[_0x59c6('0x19')][_0x59c6('0x21')]({'where':_0x4926ea[_0x59c6('0x1c')]?_0x4926ea[_0x59c6('0x1c')][_0x59c6('0x1d')]||null:null})[_0x59c6('0x22')](function(_0x20355c){if(_0x20355c){return _0x20355c[_0x59c6('0x23')](_0x4926ea['body'][_0x59c6('0x24')],_[_0x59c6('0x25')](_0x4926ea[_0x59c6('0x1b')],[_0x59c6('0x24'),'id'])||{});}})[_0x59c6('0x26')](function(_0x1e24a9){logger[_0x59c6('0xd')](_0x59c6('0x27'),_0x4926ea);logger[_0x59c6('0xf')](_0x59c6('0x27'),_0x4926ea,JSON[_0x59c6('0x12')](_0x1e24a9));_0x5eff96(_0x1e24a9);})[_0x59c6('0x17')](function(_0x4e954d){logger['error'](_0x59c6('0x27'),_0x4e954d['message'],_0x4926ea);_0x4dcdcf(_this[_0x59c6('0x13')](0x1f4,_0x4e954d['message']));});});}; \ No newline at end of file +var _0x53c1=['client','http','redis','defaults','socket.io-emitter','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','options','where','attributes','addTags','body','ids','AddTags','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2392f3,_0x240b0b){var _0x1307cb=function(_0x2bead1){while(--_0x2bead1){_0x2392f3['push'](_0x2392f3['shift']());}};_0x1307cb(++_0x240b0b);}(_0x53c1,0x14b));var _0x153c=function(_0x13ce5e,_0x5df2a1){_0x13ce5e=_0x13ce5e-0x0;var _0x35821a=_0x53c1[_0x13ce5e];return _0x35821a;};'use strict';var _=require(_0x153c('0x0'));var util=require(_0x153c('0x1'));var moment=require(_0x153c('0x2'));var BPromise=require(_0x153c('0x3'));var rs=require(_0x153c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x153c('0x5'))['db'];var utils=require(_0x153c('0x6'));var logger=require(_0x153c('0x7'))(_0x153c('0x8'));var config=require(_0x153c('0x9'));var jayson=require(_0x153c('0xa'));var client=jayson[_0x153c('0xb')][_0x153c('0xc')]({'port':0x232a});config[_0x153c('0xd')]=_[_0x153c('0xe')](config[_0x153c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x153c('0xf'))(new Redis(config[_0x153c('0xd')]));require('./openchannelInteraction.socket')[_0x153c('0x10')](socket);function respondWithRpcPromise(_0x4d23c6,_0x2d8f3c,_0x5cc311){return new BPromise(function(_0x22283e,_0x4011c1){return client['request'](_0x4d23c6,_0x5cc311)[_0x153c('0x11')](function(_0x3c0db8){logger[_0x153c('0x12')](_0x153c('0x13'),_0x2d8f3c,'request\x20sent');logger[_0x153c('0x14')](_0x153c('0x15'),_0x2d8f3c,_0x153c('0x16'),JSON[_0x153c('0x17')](_0x3c0db8));if(_0x3c0db8[_0x153c('0x18')]){if(_0x3c0db8[_0x153c('0x18')][_0x153c('0x19')]===0x1f4){logger[_0x153c('0x18')](_0x153c('0x13'),_0x2d8f3c,_0x3c0db8['error']['message']);return _0x4011c1(_0x3c0db8[_0x153c('0x18')]['message']);}logger['error'](_0x153c('0x13'),_0x2d8f3c,_0x3c0db8['error'][_0x153c('0x1a')]);return _0x22283e(_0x3c0db8['error'][_0x153c('0x1a')]);}else{logger[_0x153c('0x12')](_0x153c('0x13'),_0x2d8f3c,_0x153c('0x16'));_0x22283e(_0x3c0db8[_0x153c('0x1b')][_0x153c('0x1a')]);}})['catch'](function(_0x12a375){logger[_0x153c('0x18')](_0x153c('0x13'),_0x2d8f3c,_0x12a375);_0x4011c1(_0x12a375);});});}exports[_0x153c('0x1c')]=function(_0x39cb30){var _0x58aa0c=this;return new Promise(function(_0x32d46b,_0x48888f){return db[_0x153c('0x1d')]['update'](_0x39cb30['body'],{'raw':_0x39cb30[_0x153c('0x1e')]?_0x39cb30['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39cb30[_0x153c('0x1e')]?_0x39cb30[_0x153c('0x1e')][_0x153c('0x1f')]||null:null,'attributes':_0x39cb30['options']?_0x39cb30['options'][_0x153c('0x20')]||null:null,'limit':_0x39cb30[_0x153c('0x1e')]?_0x39cb30[_0x153c('0x1e')]['limit']||null:null})[_0x153c('0x11')](function(_0x455dd4){logger[_0x153c('0x12')](_0x153c('0x1c'),_0x39cb30);logger[_0x153c('0x14')](_0x153c('0x1c'),_0x39cb30,JSON[_0x153c('0x17')](_0x455dd4));_0x32d46b(_0x455dd4);})['catch'](function(_0x127774){logger['error']('UpdateOpenchannelInteraction',_0x127774[_0x153c('0x1a')],_0x39cb30);_0x48888f(_0x58aa0c[_0x153c('0x18')](0x1f4,_0x127774[_0x153c('0x1a')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0xae922a){return new Promise(function(_0x4f8efd,_0x3b3311){return db[_0x153c('0x1d')]['find']({'where':_0xae922a[_0x153c('0x1e')]?_0xae922a[_0x153c('0x1e')]['where']||null:null})[_0x153c('0x11')](function(_0x497f56){if(_0x497f56){return _0x497f56[_0x153c('0x21')](_0xae922a[_0x153c('0x22')]['ids'],_['omit'](_0xae922a[_0x153c('0x22')],[_0x153c('0x23'),'id'])||{});}})['spread'](function(_0x282199){logger['info'](_0x153c('0x24'),_0xae922a);logger[_0x153c('0x14')](_0x153c('0x24'),_0xae922a,JSON['stringify'](_0x282199));_0x4f8efd(_0x282199);})[_0x153c('0x25')](function(_0x4c79df){logger[_0x153c('0x18')](_0x153c('0x24'),_0x4c79df['message'],_0xae922a);_0x3b3311(_this[_0x153c('0x18')](0x1f4,_0x4c79df[_0x153c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 56bdd17..afbb7a2 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 _0x33c2=['emit','removeListener','openchannelInteraction:','./openchannelInteraction.events','remove','update'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x33c2,0xc9));var _0x233c=function(_0x2d92d0,_0x512de7){_0x2d92d0=_0x2d92d0-0x0;var _0x5752e4=_0x33c2[_0x2d92d0];return _0x5752e4;};'use strict';var OpenchannelInteractionEvents=require(_0x233c('0x0'));var events=['save',_0x233c('0x1'),_0x233c('0x2')];function createListener(_0x3bde7b,_0x3f0d17){return function(_0x44fb76){_0x3f0d17[_0x233c('0x3')](_0x3bde7b,_0x44fb76);};}function removeListener(_0x133444,_0x2f3909){return function(){OpenchannelInteractionEvents[_0x233c('0x4')](_0x133444,_0x2f3909);};}exports['register']=function(_0x1044d0){for(var _0x37717a=0x0,_0x59cac2=events['length'];_0x37717a<_0x59cac2;_0x37717a++){var _0x5554a7=events[_0x37717a];var _0x395beb=createListener(_0x233c('0x5')+_0x5554a7,_0x1044d0);OpenchannelInteractionEvents['on'](_0x5554a7,_0x395beb);}}; \ No newline at end of file +var _0xc724=['./openchannelInteraction.events','remove','update','emit','removeListener','length','openchannelInteraction:'];(function(_0x404a3a,_0x2c5d3d){var _0x493a55=function(_0x5b9d84){while(--_0x5b9d84){_0x404a3a['push'](_0x404a3a['shift']());}};_0x493a55(++_0x2c5d3d);}(_0xc724,0x19d));var _0x4c72=function(_0x1494f0,_0x40284f){_0x1494f0=_0x1494f0-0x0;var _0x50d077=_0xc724[_0x1494f0];return _0x50d077;};'use strict';var OpenchannelInteractionEvents=require(_0x4c72('0x0'));var events=['save',_0x4c72('0x1'),_0x4c72('0x2')];function createListener(_0x25d30c,_0x3970e4){return function(_0x4b3f63){_0x3970e4[_0x4c72('0x3')](_0x25d30c,_0x4b3f63);};}function removeListener(_0x38d058,_0x4fdf9f){return function(){OpenchannelInteractionEvents[_0x4c72('0x4')](_0x38d058,_0x4fdf9f);};}exports['register']=function(_0x1b2e15){for(var _0xa14a08=0x0,_0x50fe39=events[_0x4c72('0x5')];_0xa14a08<_0x50fe39;_0xa14a08++){var _0x347330=events[_0xa14a08];var _0x14e8ac=createListener(_0x4c72('0x6')+_0x347330,_0x1b2e15);OpenchannelInteractionEvents['on'](_0x347330,_0x14e8ac);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e24498f..32670fe 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(_0x4e4863,_0x4e2f26){var _0x424ff4=function(_0x4d8302){while(--_0x4d8302){_0x4e4863['push'](_0x4e4863['shift']());}};_0x424ff4(++_0x4e2f26);}(_0xe706,0xa3));var _0x6e70=function(_0x1443be,_0x31b17d){_0x1443be=_0x1443be-0x0;var _0x38823d=_0xe706[_0x1443be];return _0x38823d;};'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 _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(_0x45387f,_0x4b9892){var _0x138890=function(_0x275185){while(--_0x275185){_0x45387f['push'](_0x45387f['shift']());}};_0x138890(++_0x4b9892);}(_0xe706,0xa3));var _0x6e70=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0xe706[_0x1b8b95];return _0x3657ae;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 52a71a5..5390a23 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 _0xd4dc=['ENUM','out','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x27a24f,_0x424641){var _0x5228e6=function(_0x2e821d){while(--_0x2e821d){_0x27a24f['push'](_0x27a24f['shift']());}};_0x5228e6(++_0x424641);}(_0xd4dc,0xff));var _0xcd4d=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xd4dc[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require(_0xcd4d('0x0'));module['exports']={'body':{'type':Sequelize[_0xcd4d('0x1')](_0xcd4d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd4d('0x4')]('in',_0xcd4d('0x5')),'defaultValue':_0xcd4d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xcd4d('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x585e=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x20073b,_0x9c031e){var _0x428d14=function(_0x1c6d8b){while(--_0x1c6d8b){_0x20073b['push'](_0x20073b['shift']());}};_0x428d14(++_0x9c031e);}(_0x585e,0x1c2));var _0xe585=function(_0x8d3c1e,_0x1d8a8b){_0x8d3c1e=_0x8d3c1e-0x0;var _0x3752d4=_0x585e[_0x8d3c1e];return _0x3752d4;};'use strict';var Sequelize=require(_0xe585('0x0'));module[_0xe585('0x1')]={'body':{'type':Sequelize[_0xe585('0x2')](_0xe585('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe585('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe585('0x5')),'defaultValue':_0xe585('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xe585('0x6')]},'providerResponse':{'type':Sequelize[_0xe585('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index c05e8fd..ff406b1 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 _0x6fb5=['RejectMessage','ContactId','QueryTypes','rejectmessage','eml-format','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','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','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','status','Content-Range','reject','save','update','destroy','name','index','map','OpenchannelMessage','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','count','includeAll','include','show','params','options','find','create','body','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','OpenchannelInteraction','read1stAt','interaction','[OPENCHANNELMESSAGE: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','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x1bfe44,_0x4e410e){var _0x1103cb=function(_0x1e850e){while(--_0x1e850e){_0x1bfe44['push'](_0x1bfe44['shift']());}};_0x1103cb(++_0x4e410e);}(_0x6fb5,0x10c));var _0x56fb=function(_0x283d0e,_0x23804d){_0x283d0e=_0x283d0e-0x0;var _0x148fb6=_0x6fb5[_0x283d0e];return _0x148fb6;};'use strict';var emlformat=require(_0x56fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56fb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x56fb('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x56fb('0x3'));var path=require(_0x56fb('0x4'));var sox=require(_0x56fb('0x5'));var csv=require(_0x56fb('0x6'));var ejs=require(_0x56fb('0x7'));var fs=require('fs');var fs_extra=require(_0x56fb('0x8'));var _=require(_0x56fb('0x9'));var squel=require(_0x56fb('0xa'));var crypto=require(_0x56fb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x56fb('0xc'));var toCsv=require(_0x56fb('0x6'));var querystring=require(_0x56fb('0xd'));var Papa=require(_0x56fb('0xe'));var Redis=require(_0x56fb('0xf'));var authService=require(_0x56fb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x56fb('0x11'));var hardwareService=require(_0x56fb('0x12'));var logger=require(_0x56fb('0x13'))('api');var utils=require(_0x56fb('0x14'));var config=require(_0x56fb('0x15'));var licenseUtil=require(_0x56fb('0x16'));var db=require(_0x56fb('0x17'))['db'];config[_0x56fb('0x18')]=_[_0x56fb('0x19')](config[_0x56fb('0x18')],{'host':_0x56fb('0x1a'),'port':0x18eb});var socket=require(_0x56fb('0x1b'))(new Redis(config[_0x56fb('0x18')]));require(_0x56fb('0x1c'))[_0x56fb('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x56fb('0x1e')][_0x56fb('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x464eca,_0x17bdc8,_0x5e8ae7,_0x371f6f){return new BPromise(function(_0x4e208e,_0x13498b){var _0x5d2591=_0x371f6f||client;return _0x5d2591[_0x56fb('0x20')](_0x464eca,_0x5e8ae7)[_0x56fb('0x21')](function(_0x17cdf1){logger[_0x56fb('0x22')](_0x56fb('0x23'),_0x17bdc8,_0x56fb('0x24'));logger[_0x56fb('0x25')](_0x56fb('0x26'),_0x17bdc8,'request\x20sent',JSON['stringify'](_0x17cdf1));if(_0x17cdf1['error']){if(_0x17cdf1[_0x56fb('0x27')][_0x56fb('0x28')]===0x1f4){logger[_0x56fb('0x27')](_0x56fb('0x23'),_0x17bdc8,_0x17cdf1[_0x56fb('0x27')][_0x56fb('0x29')]);return _0x13498b(_0x17cdf1[_0x56fb('0x27')]['message']);}logger[_0x56fb('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x17bdc8,_0x17cdf1[_0x56fb('0x27')]['message']);return _0x4e208e(_0x17cdf1[_0x56fb('0x27')][_0x56fb('0x29')]);}else{logger[_0x56fb('0x22')](_0x56fb('0x23'),_0x17bdc8,_0x56fb('0x24'));_0x4e208e(_0x17cdf1[_0x56fb('0x2a')]['message']);}})[_0x56fb('0x2b')](function(_0x52242b){logger[_0x56fb('0x27')](_0x56fb('0x23'),_0x17bdc8,_0x52242b);_0x13498b(_0x52242b);});});}function respondWithStatusCode(_0x2463e2,_0x1b4fe9){_0x1b4fe9=_0x1b4fe9||0xcc;return function(_0x3ddcdc){if(_0x3ddcdc){return _0x2463e2[_0x56fb('0x2c')](_0x1b4fe9);}return _0x2463e2['status'](_0x1b4fe9)[_0x56fb('0x2d')]();};}function respondWithResult(_0x57bf1e,_0x3028ea){_0x3028ea=_0x3028ea||0xc8;return function(_0x18a0b5){if(_0x18a0b5){return _0x57bf1e['status'](_0x3028ea)[_0x56fb('0x2e')](_0x18a0b5);}};}function respondWithFilteredResult(_0x1e230c,_0x423d1a){return function(_0x2ab0cc){if(_0x2ab0cc){var _0xa3aa56=typeof _0x423d1a[_0x56fb('0x2f')]===_0x56fb('0x30')&&typeof _0x423d1a[_0x56fb('0x31')]===_0x56fb('0x30');var _0xc8ba3b=_0x2ab0cc['count'];var _0x40ef6a=_0xa3aa56?0x0:_0x423d1a[_0x56fb('0x2f')];var _0x547b3d=_0xa3aa56?_0x2ab0cc['count']:_0x423d1a[_0x56fb('0x2f')]+_0x423d1a['limit'];var _0x4b0d6c;if(_0x547b3d>=_0xc8ba3b){_0x547b3d=_0xc8ba3b;_0x4b0d6c=0xc8;}else{_0x4b0d6c=0xce;}_0x1e230c[_0x56fb('0x32')](_0x4b0d6c);return _0x1e230c['set'](_0x56fb('0x33'),_0x40ef6a+'-'+_0x547b3d+'/'+_0xc8ba3b)[_0x56fb('0x2e')](_0x2ab0cc);}return null;};}function patchUpdates(_0x14e407){return function(_0x5e4e56){try{jsonpatch['apply'](_0x5e4e56,_0x14e407,!![]);}catch(_0x893f7d){return BPromise[_0x56fb('0x34')](_0x893f7d);}return _0x5e4e56[_0x56fb('0x35')]();};}function saveUpdates(_0x45cba1,_0x9fc4b1){return function(_0x919acc){if(_0x919acc){return _0x919acc[_0x56fb('0x36')](_0x45cba1)[_0x56fb('0x21')](function(_0x22dba3){return _0x22dba3;});}return null;};}function removeEntity(_0x2e074e,_0x18d807){return function(_0x21e94e){if(_0x21e94e){return _0x21e94e[_0x56fb('0x37')]()[_0x56fb('0x21')](function(){_0x2e074e[_0x56fb('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x373912,_0x2d479b){return function(_0x4f74be){if(!_0x4f74be){_0x373912[_0x56fb('0x2c')](0x194);}return _0x4f74be;};}function handleError(_0x27d7a2,_0x1de6bb){_0x1de6bb=_0x1de6bb||0x1f4;return function(_0x628847){logger[_0x56fb('0x27')](_0x628847['stack']);if(_0x628847[_0x56fb('0x38')]){delete _0x628847[_0x56fb('0x38')];}_0x27d7a2[_0x56fb('0x32')](_0x1de6bb)['send'](_0x628847);};}exports[_0x56fb('0x39')]=function(_0x59626b,_0x2c9d92){var _0x2cdd66={},_0xe2bc5a={},_0x405b16={'count':0x0,'rows':[]};var _0x4e371e=_[_0x56fb('0x3a')](db[_0x56fb('0x3b')]['rawAttributes'],function(_0x3f5a9d){return{'name':_0x3f5a9d['fieldName'],'type':_0x3f5a9d[_0x56fb('0x3c')][_0x56fb('0x3d')]};});_0xe2bc5a[_0x56fb('0x3e')]=_[_0x56fb('0x3a')](_0x4e371e,_0x56fb('0x38'));_0xe2bc5a[_0x56fb('0x3f')]=_[_0x56fb('0x40')](_0x59626b[_0x56fb('0x3f')]);_0xe2bc5a[_0x56fb('0x41')]=_[_0x56fb('0x42')](_0xe2bc5a[_0x56fb('0x3e')],_0xe2bc5a['query']);_0x2cdd66[_0x56fb('0x43')]=_['intersection'](_0xe2bc5a[_0x56fb('0x3e')],qs[_0x56fb('0x44')](_0x59626b['query'][_0x56fb('0x44')]));_0x2cdd66[_0x56fb('0x43')]=_0x2cdd66[_0x56fb('0x43')][_0x56fb('0x45')]?_0x2cdd66[_0x56fb('0x43')]:_0xe2bc5a['model'];if(!_0x59626b[_0x56fb('0x3f')][_0x56fb('0x46')](_0x56fb('0x47'))){_0x2cdd66[_0x56fb('0x31')]=qs[_0x56fb('0x31')](_0x59626b[_0x56fb('0x3f')][_0x56fb('0x31')]);_0x2cdd66['offset']=qs[_0x56fb('0x2f')](_0x59626b[_0x56fb('0x3f')][_0x56fb('0x2f')]);}_0x2cdd66[_0x56fb('0x48')]=qs[_0x56fb('0x49')](_0x59626b[_0x56fb('0x3f')][_0x56fb('0x49')]);_0x2cdd66['where']=qs['filters'](_[_0x56fb('0x4a')](_0x59626b['query'],_0xe2bc5a[_0x56fb('0x41')]),_0x4e371e);if(_0x59626b[_0x56fb('0x3f')][_0x56fb('0x4b')]){_0x2cdd66['where']=_[_0x56fb('0x4c')](_0x2cdd66[_0x56fb('0x4d')],{'$or':_[_0x56fb('0x3a')](_0x4e371e,function(_0x65593){if(_0x65593[_0x56fb('0x3c')]!==_0x56fb('0x4e')){var _0x10823e={};_0x10823e[_0x65593[_0x56fb('0x38')]]={'$like':'%'+_0x59626b[_0x56fb('0x3f')][_0x56fb('0x4b')]+'%'};return _0x10823e;}})});}_0x2cdd66=_[_0x56fb('0x4c')]({},_0x2cdd66,_0x59626b['options']);var _0x2bcfbf={'where':_0x2cdd66[_0x56fb('0x4d')]};return db[_0x56fb('0x3b')][_0x56fb('0x4f')](_0x2bcfbf)['then'](function(_0x34e7bc){_0x405b16[_0x56fb('0x4f')]=_0x34e7bc;if(_0x59626b[_0x56fb('0x3f')][_0x56fb('0x50')]){_0x2cdd66[_0x56fb('0x51')]=[{'all':!![]}];}return db[_0x56fb('0x3b')]['findAll'](_0x2cdd66);})[_0x56fb('0x21')](function(_0x10d924){_0x405b16['rows']=_0x10d924;return _0x405b16;})['then'](respondWithFilteredResult(_0x2c9d92,_0x2cdd66))[_0x56fb('0x2b')](handleError(_0x2c9d92,null));};exports[_0x56fb('0x52')]=function(_0x29f48b,_0x1ad384){var _0x18fba4={'raw':!![],'where':{'id':_0x29f48b[_0x56fb('0x53')]['id']}},_0x929a43={};_0x929a43[_0x56fb('0x3e')]=_['keys'](db[_0x56fb('0x3b')]['rawAttributes']);_0x929a43[_0x56fb('0x3f')]=_[_0x56fb('0x40')](_0x29f48b[_0x56fb('0x3f')]);_0x929a43[_0x56fb('0x41')]=_[_0x56fb('0x42')](_0x929a43[_0x56fb('0x3e')],_0x929a43['query']);_0x18fba4[_0x56fb('0x43')]=_['intersection'](_0x929a43[_0x56fb('0x3e')],qs[_0x56fb('0x44')](_0x29f48b[_0x56fb('0x3f')][_0x56fb('0x44')]));_0x18fba4[_0x56fb('0x43')]=_0x18fba4['attributes']['length']?_0x18fba4[_0x56fb('0x43')]:_0x929a43[_0x56fb('0x3e')];if(_0x29f48b['query'][_0x56fb('0x50')]){_0x18fba4['include']=[{'all':!![]}];}_0x18fba4=_[_0x56fb('0x4c')]({},_0x18fba4,_0x29f48b[_0x56fb('0x54')]);return db[_0x56fb('0x3b')][_0x56fb('0x55')](_0x18fba4)[_0x56fb('0x21')](handleEntityNotFound(_0x1ad384,null))['then'](respondWithResult(_0x1ad384,null))[_0x56fb('0x2b')](handleError(_0x1ad384,null));};exports[_0x56fb('0x56')]=function(_0x34f6f7,_0x57318d){return db[_0x56fb('0x3b')][_0x56fb('0x56')](_0x34f6f7[_0x56fb('0x57')],{})['then'](respondWithResult(_0x57318d,0xc9))['catch'](handleError(_0x57318d,null));};exports['update']=function(_0x1b3a8,_0x4b724d){if(_0x1b3a8[_0x56fb('0x57')]['id']){delete _0x1b3a8[_0x56fb('0x57')]['id'];}return db[_0x56fb('0x3b')]['find']({'where':{'id':_0x1b3a8[_0x56fb('0x53')]['id']}})[_0x56fb('0x21')](handleEntityNotFound(_0x4b724d,null))[_0x56fb('0x21')](saveUpdates(_0x1b3a8[_0x56fb('0x57')],null))['then'](respondWithResult(_0x4b724d,null))[_0x56fb('0x2b')](handleError(_0x4b724d,null));};exports[_0x56fb('0x37')]=function(_0x448f83,_0x497102){return db[_0x56fb('0x3b')][_0x56fb('0x55')]({'where':{'id':_0x448f83['params']['id']}})['then'](handleEntityNotFound(_0x497102,null))['then'](removeEntity(_0x497102,null))['catch'](handleError(_0x497102,null));};exports[_0x56fb('0x58')]=function(_0x1237ba,_0x39fdd2){return db['OpenchannelMessage']['describe']()['then'](respondWithResult(_0x39fdd2,null))[_0x56fb('0x2b')](handleError(_0x39fdd2,null));};var interaction_log=require('../../config/logger')(_0x56fb('0x59'));exports[_0x56fb('0x5a')]=function(_0x19ef5a,_0x1d293f,_0x225813){var _0x42338e={'agent':{},'channel':'openchannel'};if(_0x19ef5a['body']['id']){delete _0x19ef5a['body']['id'];}_0x19ef5a[_0x56fb('0x57')][_0x56fb('0x5b')]=!![];_0x19ef5a['body'][_0x56fb('0x5c')]=moment()[_0x56fb('0x5d')](_0x56fb('0x5e'));_0x19ef5a[_0x56fb('0x57')]['UserId']=_0x19ef5a[_0x56fb('0x57')]['UserId']||_0x19ef5a[_0x56fb('0x5f')]['id'];_0x42338e[_0x56fb('0x60')]['id']=_0x19ef5a[_0x56fb('0x57')][_0x56fb('0x61')];return db['OpenchannelMessage'][_0x56fb('0x55')]({'where':{'id':_0x19ef5a[_0x56fb('0x53')]['id'],'UserId':null}})[_0x56fb('0x21')](handleEntityNotFound(_0x1d293f,null))[_0x56fb('0x21')](saveUpdates(_0x19ef5a[_0x56fb('0x57')],null))[_0x56fb('0x21')](function(_0x5bb130){if(_0x5bb130){_0x42338e[_0x56fb('0x29')]=_0x5bb130[_0x56fb('0x62')]({'plain':!![]});return db[_0x56fb('0x63')]['find']({'where':{'id':_0x5bb130['OpenchannelInteractionId']}});}return null;})[_0x56fb('0x21')](handleEntityNotFound(_0x1d293f,null))[_0x56fb('0x21')](function(_0x1b4fb2){if(_0x1b4fb2){return _0x1b4fb2[_0x56fb('0x36')]({'UserId':_0x19ef5a['body'][_0x56fb('0x61')],'read1stAt':_['isNil'](_0x1b4fb2[_0x56fb('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x56fb('0x21')](function(_0x443679){if(_0x443679){_0x42338e[_0x56fb('0x65')]=_0x443679[_0x56fb('0x62')]({'plain':!![]});interaction_log[_0x56fb('0x22')](_0x56fb('0x66'),_0x19ef5a[_0x56fb('0x5f')]['id'],_0x19ef5a[_0x56fb('0x5f')][_0x56fb('0x38')],_0x19ef5a[_0x56fb('0x5f')][_0x56fb('0x67')],_0x42338e[_0x56fb('0x65')]['id'],_0x19ef5a['body']?JSON[_0x56fb('0x68')](_0x19ef5a[_0x56fb('0x57')]):_0x56fb('0x69'));return respondWithRpcPromise(_0x56fb('0x6a'),_0x56fb('0x6b'),_0x42338e);}return null;})['then'](function(_0x44ec44){var _0x490850=_0x56fb('0x6c')+_0x44ec44[_0x56fb('0x29')]['ContactId'];return db[_0x56fb('0x6d')]['query'](_0x490850,{'type':db[_0x56fb('0x6e')]['QueryTypes'][_0x56fb('0x6f')],'raw':!![]})[_0x56fb('0x21')](function(_0xcb7861){return _0xcb7861;});})['then'](function(_0x4e62d8){if(_0x4e62d8){_0x42338e[_0x56fb('0x29')][_0x56fb('0x70')]=_0x4e62d8[0x0];if(!_0x19ef5a['body'][_0x56fb('0x61')])return;return db[_0x56fb('0x71')][_0x56fb('0x55')]({'where':{'id':_0x19ef5a[_0x56fb('0x57')][_0x56fb('0x61')],'role':_0x56fb('0x60')},'attributes':['id','name',_0x56fb('0x72'),_0x56fb('0x73'),_0x56fb('0x74')],'raw':!![]});}return null;})[_0x56fb('0x21')](function(_0x5dde89){if(!_0x5dde89)return null;_0x42338e[_0x56fb('0x29')][_0x56fb('0x60')]=_0x5dde89;return _0x42338e;})[_0x56fb('0x21')](function(_0x2dda84){if(_0x2dda84){if(_0x19ef5a[_0x56fb('0x57')][_0x56fb('0x75')]){_0x42338e['message'][_0x56fb('0x76')]=util['format'](_0x56fb('0x77'),_0x19ef5a[_0x56fb('0x5f')][_0x56fb('0x38')]);_0x42338e[_0x56fb('0x29')][_0x56fb('0x78')]=_0x42338e['channel'];_0x42338e[_0x56fb('0x29')][_0x56fb('0x79')]=_0x42338e['channel'];_0x42338e['message'][_0x56fb('0x7a')]='accept';return respondWithRpcPromise(_0x56fb('0x7b'),_0x56fb('0x7b'),{'event':_0x56fb('0x7c'),'message':_0x42338e[_0x56fb('0x29')]},client9002)[_0x56fb('0x21')](function(){return _0x42338e;});}return _0x42338e;}return null;})[_0x56fb('0x21')](respondWithResult(_0x1d293f,null))['catch'](handleError(_0x1d293f,null));};var interaction_log=require(_0x56fb('0x13'))('openchannel-interactions');exports[_0x56fb('0x34')]=function(_0x4a8f47,_0x22dc9e,_0x162d17){var _0x30ec67={'agent':{},'channel':_0x56fb('0x7d')};if(_0x4a8f47[_0x56fb('0x57')]['id']){delete _0x4a8f47['body']['id'];}_0x4a8f47['body'][_0x56fb('0x61')]=_0x4a8f47[_0x56fb('0x57')][_0x56fb('0x61')]||_0x4a8f47[_0x56fb('0x5f')]['id'];_0x30ec67[_0x56fb('0x60')]['id']=_0x4a8f47[_0x56fb('0x57')]['UserId'];return db[_0x56fb('0x3b')]['find']({'where':{'id':_0x4a8f47['params']['id'],'UserId':null}})[_0x56fb('0x21')](handleEntityNotFound(_0x22dc9e,null))['then'](function(_0x498e41){if(_0x498e41){_0x30ec67['message']=_0x498e41[_0x56fb('0x62')]({'plain':!![]});return db[_0x56fb('0x63')][_0x56fb('0x55')]({'where':{'id':_0x498e41[_0x56fb('0x7e')]}});}return null;})[_0x56fb('0x21')](handleEntityNotFound(_0x22dc9e,null))['then'](function(_0x453f9c){if(_0x453f9c){_0x30ec67[_0x56fb('0x65')]=_0x453f9c['get']({'plain':!![]});interaction_log[_0x56fb('0x22')](_0x56fb('0x7f'),_0x4a8f47['user']['id'],_0x4a8f47[_0x56fb('0x5f')][_0x56fb('0x38')],_0x4a8f47[_0x56fb('0x5f')][_0x56fb('0x67')],_0x30ec67[_0x56fb('0x65')]['id'],_0x4a8f47[_0x56fb('0x57')]?JSON[_0x56fb('0x68')](_0x4a8f47['body']):'null');return respondWithRpcPromise(_0x56fb('0x80'),'rejectMessage',_0x30ec67);}return null;})[_0x56fb('0x21')](function(_0x49344c){var _0x5f04cc='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x49344c[_0x56fb('0x29')][_0x56fb('0x81')];return db[_0x56fb('0x6d')]['query'](_0x5f04cc,{'type':db[_0x56fb('0x6e')][_0x56fb('0x82')]['SELECT'],'raw':!![]})[_0x56fb('0x21')](function(_0x35b754){return _0x35b754;});})[_0x56fb('0x21')](function(_0x61ab07){if(_0x61ab07){_0x30ec67[_0x56fb('0x29')]['contact']=_0x61ab07[0x0];if(!_0x4a8f47[_0x56fb('0x57')][_0x56fb('0x61')])return;return db[_0x56fb('0x71')][_0x56fb('0x55')]({'where':{'id':_0x4a8f47[_0x56fb('0x57')]['UserId'],'role':'agent'},'attributes':['id',_0x56fb('0x38'),'fullname',_0x56fb('0x73'),_0x56fb('0x74')],'raw':!![]});}return null;})['then'](function(_0x481d43){if(!_0x481d43)return null;_0x30ec67['message'][_0x56fb('0x60')]=_0x481d43;return _0x30ec67;})[_0x56fb('0x21')](function(_0x7cea78){if(_0x7cea78){_0x7cea78['message'][_0x56fb('0x76')]=util[_0x56fb('0x5d')](_0x56fb('0x77'),_0x4a8f47[_0x56fb('0x5f')][_0x56fb('0x38')]);_0x7cea78[_0x56fb('0x29')][_0x56fb('0x78')]=_0x30ec67[_0x56fb('0x78')];_0x7cea78[_0x56fb('0x29')][_0x56fb('0x79')]=_0x30ec67[_0x56fb('0x78')];_0x7cea78[_0x56fb('0x29')][_0x56fb('0x7a')]=_0x56fb('0x34');respondWithRpcPromise(_0x56fb('0x7b'),_0x56fb('0x7b'),{'event':_0x56fb('0x83'),'message':_0x7cea78[_0x56fb('0x29')]},client9002);return _0x30ec67;}return null;})['then'](respondWithResult(_0x22dc9e,null))[_0x56fb('0x2b')](handleError(_0x22dc9e,null));}; \ No newline at end of file +var _0xf62d=['params','keys','filters','create','body','find','describe','../../config/logger','openchannel-interactions','accept','openchannel','readAt','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','stringify','rejectMessage','sequelize','email','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','http','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xf62d,0x1c0));var _0xdf62=function(_0x5c2438,_0x1753c2){_0x5c2438=_0x5c2438-0x0;var _0x75cfae=_0xf62d[_0x5c2438];return _0x75cfae;};'use strict';var emlformat=require(_0xdf62('0x0'));var rimraf=require(_0xdf62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf62('0x2'));var rp=require(_0xdf62('0x3'));var moment=require(_0xdf62('0x4'));var BPromise=require(_0xdf62('0x5'));var Mustache=require(_0xdf62('0x6'));var util=require(_0xdf62('0x7'));var path=require(_0xdf62('0x8'));var sox=require(_0xdf62('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf62('0xa'));var squel=require('squel');var crypto=require(_0xdf62('0xb'));var jsforce=require(_0xdf62('0xc'));var deskjs=require(_0xdf62('0xd'));var toCsv=require(_0xdf62('0xe'));var querystring=require(_0xdf62('0xf'));var Papa=require(_0xdf62('0x10'));var Redis=require(_0xdf62('0x11'));var authService=require(_0xdf62('0x12'));var qs=require(_0xdf62('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf62('0x14'));var logger=require('../../config/logger')(_0xdf62('0x15'));var utils=require('../../config/utils');var config=require(_0xdf62('0x16'));var licenseUtil=require(_0xdf62('0x17'));var db=require(_0xdf62('0x18'))['db'];config[_0xdf62('0x19')]=_[_0xdf62('0x1a')](config[_0xdf62('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf62('0x1b'))(new Redis(config[_0xdf62('0x19')]));require(_0xdf62('0x1c'))[_0xdf62('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xdf62('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xdf62('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1fcee7,_0x1ba2a8,_0x13387c,_0x55d43e){return new BPromise(function(_0x47cb3a,_0x159ff1){var _0x1089ea=_0x55d43e||client;return _0x1089ea['request'](_0x1fcee7,_0x13387c)['then'](function(_0x35880d){logger[_0xdf62('0x1f')](_0xdf62('0x20'),_0x1ba2a8,_0xdf62('0x21'));logger[_0xdf62('0x22')](_0xdf62('0x23'),_0x1ba2a8,_0xdf62('0x21'),JSON['stringify'](_0x35880d));if(_0x35880d[_0xdf62('0x24')]){if(_0x35880d['error'][_0xdf62('0x25')]===0x1f4){logger[_0xdf62('0x24')](_0xdf62('0x20'),_0x1ba2a8,_0x35880d[_0xdf62('0x24')][_0xdf62('0x26')]);return _0x159ff1(_0x35880d['error'][_0xdf62('0x26')]);}logger[_0xdf62('0x24')](_0xdf62('0x20'),_0x1ba2a8,_0x35880d[_0xdf62('0x24')][_0xdf62('0x26')]);return _0x47cb3a(_0x35880d[_0xdf62('0x24')]['message']);}else{logger[_0xdf62('0x1f')](_0xdf62('0x20'),_0x1ba2a8,_0xdf62('0x21'));_0x47cb3a(_0x35880d['result']['message']);}})[_0xdf62('0x27')](function(_0x1e735f){logger[_0xdf62('0x24')](_0xdf62('0x20'),_0x1ba2a8,_0x1e735f);_0x159ff1(_0x1e735f);});});}function respondWithStatusCode(_0x38245e,_0x2bc8bc){_0x2bc8bc=_0x2bc8bc||0xcc;return function(_0x48ab6a){if(_0x48ab6a){return _0x38245e[_0xdf62('0x28')](_0x2bc8bc);}return _0x38245e[_0xdf62('0x29')](_0x2bc8bc)[_0xdf62('0x2a')]();};}function respondWithResult(_0x3f3507,_0x5dc487){_0x5dc487=_0x5dc487||0xc8;return function(_0x315b4a){if(_0x315b4a){return _0x3f3507[_0xdf62('0x29')](_0x5dc487)[_0xdf62('0x2b')](_0x315b4a);}};}function respondWithFilteredResult(_0x3ade38,_0x4c4273){return function(_0x5be757){if(_0x5be757){var _0x50c05b=typeof _0x4c4273['offset']===_0xdf62('0x2c')&&typeof _0x4c4273['limit']===_0xdf62('0x2c');var _0x109302=_0x5be757[_0xdf62('0x2d')];var _0x38ece2=_0x50c05b?0x0:_0x4c4273['offset'];var _0x5e0c95=_0x50c05b?_0x5be757[_0xdf62('0x2d')]:_0x4c4273[_0xdf62('0x2e')]+_0x4c4273[_0xdf62('0x2f')];var _0x1edeeb;if(_0x5e0c95>=_0x109302){_0x5e0c95=_0x109302;_0x1edeeb=0xc8;}else{_0x1edeeb=0xce;}_0x3ade38['status'](_0x1edeeb);return _0x3ade38[_0xdf62('0x30')](_0xdf62('0x31'),_0x38ece2+'-'+_0x5e0c95+'/'+_0x109302)[_0xdf62('0x2b')](_0x5be757);}return null;};}function patchUpdates(_0x4295c6){return function(_0x434429){try{jsonpatch[_0xdf62('0x32')](_0x434429,_0x4295c6,!![]);}catch(_0x4ba9f7){return BPromise[_0xdf62('0x33')](_0x4ba9f7);}return _0x434429[_0xdf62('0x34')]();};}function saveUpdates(_0x1a85a5,_0x87fd7c){return function(_0x3cd8c3){if(_0x3cd8c3){return _0x3cd8c3[_0xdf62('0x35')](_0x1a85a5)[_0xdf62('0x36')](function(_0x23cd16){return _0x23cd16;});}return null;};}function removeEntity(_0x5886c9,_0xb3d724){return function(_0x1dabda){if(_0x1dabda){return _0x1dabda[_0xdf62('0x37')]()['then'](function(){_0x5886c9[_0xdf62('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c8a4b,_0x4c0547){return function(_0x2a0783){if(!_0x2a0783){_0x5c8a4b[_0xdf62('0x28')](0x194);}return _0x2a0783;};}function handleError(_0x373a07,_0x29b63c){_0x29b63c=_0x29b63c||0x1f4;return function(_0x48aae0){logger['error'](_0x48aae0['stack']);if(_0x48aae0[_0xdf62('0x38')]){delete _0x48aae0[_0xdf62('0x38')];}_0x373a07[_0xdf62('0x29')](_0x29b63c)[_0xdf62('0x39')](_0x48aae0);};}exports[_0xdf62('0x3a')]=function(_0x5d8daa,_0x386912){var _0x258f0f={},_0x32169d={},_0x168423={'count':0x0,'rows':[]};var _0x1d9529=_[_0xdf62('0x3b')](db[_0xdf62('0x3c')][_0xdf62('0x3d')],function(_0x35d9fe){return{'name':_0x35d9fe[_0xdf62('0x3e')],'type':_0x35d9fe[_0xdf62('0x3f')][_0xdf62('0x40')]};});_0x32169d[_0xdf62('0x41')]=_[_0xdf62('0x3b')](_0x1d9529,_0xdf62('0x38'));_0x32169d[_0xdf62('0x42')]=_['keys'](_0x5d8daa[_0xdf62('0x42')]);_0x32169d['filters']=_[_0xdf62('0x43')](_0x32169d['model'],_0x32169d['query']);_0x258f0f[_0xdf62('0x44')]=_[_0xdf62('0x43')](_0x32169d[_0xdf62('0x41')],qs[_0xdf62('0x45')](_0x5d8daa[_0xdf62('0x42')][_0xdf62('0x45')]));_0x258f0f['attributes']=_0x258f0f['attributes'][_0xdf62('0x46')]?_0x258f0f['attributes']:_0x32169d[_0xdf62('0x41')];if(!_0x5d8daa[_0xdf62('0x42')][_0xdf62('0x47')]('nolimit')){_0x258f0f[_0xdf62('0x2f')]=qs[_0xdf62('0x2f')](_0x5d8daa[_0xdf62('0x42')]['limit']);_0x258f0f[_0xdf62('0x2e')]=qs['offset'](_0x5d8daa[_0xdf62('0x42')][_0xdf62('0x2e')]);}_0x258f0f[_0xdf62('0x48')]=qs[_0xdf62('0x49')](_0x5d8daa['query'][_0xdf62('0x49')]);_0x258f0f[_0xdf62('0x4a')]=qs['filters'](_[_0xdf62('0x4b')](_0x5d8daa[_0xdf62('0x42')],_0x32169d['filters']),_0x1d9529);if(_0x5d8daa['query'][_0xdf62('0x4c')]){_0x258f0f['where']=_[_0xdf62('0x4d')](_0x258f0f[_0xdf62('0x4a')],{'$or':_[_0xdf62('0x3b')](_0x1d9529,function(_0x52ede5){if(_0x52ede5[_0xdf62('0x3f')]!==_0xdf62('0x4e')){var _0x177eb1={};_0x177eb1[_0x52ede5['name']]={'$like':'%'+_0x5d8daa['query'][_0xdf62('0x4c')]+'%'};return _0x177eb1;}})});}_0x258f0f=_['merge']({},_0x258f0f,_0x5d8daa[_0xdf62('0x4f')]);var _0x469a38={'where':_0x258f0f[_0xdf62('0x4a')]};return db[_0xdf62('0x3c')]['count'](_0x469a38)[_0xdf62('0x36')](function(_0x373908){_0x168423[_0xdf62('0x2d')]=_0x373908;if(_0x5d8daa[_0xdf62('0x42')][_0xdf62('0x50')]){_0x258f0f[_0xdf62('0x51')]=[{'all':!![]}];}return db[_0xdf62('0x3c')]['findAll'](_0x258f0f);})[_0xdf62('0x36')](function(_0x2647f1){_0x168423[_0xdf62('0x52')]=_0x2647f1;return _0x168423;})['then'](respondWithFilteredResult(_0x386912,_0x258f0f))['catch'](handleError(_0x386912,null));};exports[_0xdf62('0x53')]=function(_0x24d781,_0x21e262){var _0x3db1ce={'raw':!![],'where':{'id':_0x24d781[_0xdf62('0x54')]['id']}},_0x38cc8f={};_0x38cc8f[_0xdf62('0x41')]=_[_0xdf62('0x55')](db[_0xdf62('0x3c')][_0xdf62('0x3d')]);_0x38cc8f['query']=_[_0xdf62('0x55')](_0x24d781[_0xdf62('0x42')]);_0x38cc8f[_0xdf62('0x56')]=_[_0xdf62('0x43')](_0x38cc8f[_0xdf62('0x41')],_0x38cc8f[_0xdf62('0x42')]);_0x3db1ce[_0xdf62('0x44')]=_['intersection'](_0x38cc8f[_0xdf62('0x41')],qs[_0xdf62('0x45')](_0x24d781[_0xdf62('0x42')][_0xdf62('0x45')]));_0x3db1ce[_0xdf62('0x44')]=_0x3db1ce[_0xdf62('0x44')][_0xdf62('0x46')]?_0x3db1ce['attributes']:_0x38cc8f[_0xdf62('0x41')];if(_0x24d781['query']['includeAll']){_0x3db1ce[_0xdf62('0x51')]=[{'all':!![]}];}_0x3db1ce=_['merge']({},_0x3db1ce,_0x24d781[_0xdf62('0x4f')]);return db[_0xdf62('0x3c')]['find'](_0x3db1ce)[_0xdf62('0x36')](handleEntityNotFound(_0x21e262,null))[_0xdf62('0x36')](respondWithResult(_0x21e262,null))[_0xdf62('0x27')](handleError(_0x21e262,null));};exports[_0xdf62('0x57')]=function(_0x13cdfc,_0x2ea8e9){return db['OpenchannelMessage'][_0xdf62('0x57')](_0x13cdfc['body'],{})['then'](respondWithResult(_0x2ea8e9,0xc9))[_0xdf62('0x27')](handleError(_0x2ea8e9,null));};exports[_0xdf62('0x35')]=function(_0x2cdcd7,_0x3f8972){if(_0x2cdcd7[_0xdf62('0x58')]['id']){delete _0x2cdcd7['body']['id'];}return db['OpenchannelMessage'][_0xdf62('0x59')]({'where':{'id':_0x2cdcd7[_0xdf62('0x54')]['id']}})[_0xdf62('0x36')](handleEntityNotFound(_0x3f8972,null))['then'](saveUpdates(_0x2cdcd7[_0xdf62('0x58')],null))[_0xdf62('0x36')](respondWithResult(_0x3f8972,null))['catch'](handleError(_0x3f8972,null));};exports[_0xdf62('0x37')]=function(_0x178891,_0x2bb94c){return db[_0xdf62('0x3c')][_0xdf62('0x59')]({'where':{'id':_0x178891['params']['id']}})['then'](handleEntityNotFound(_0x2bb94c,null))[_0xdf62('0x36')](removeEntity(_0x2bb94c,null))[_0xdf62('0x27')](handleError(_0x2bb94c,null));};exports[_0xdf62('0x5a')]=function(_0x1a1ffc,_0x37be10){return db[_0xdf62('0x3c')][_0xdf62('0x5a')]()[_0xdf62('0x36')](respondWithResult(_0x37be10,null))[_0xdf62('0x27')](handleError(_0x37be10,null));};var interaction_log=require(_0xdf62('0x5b'))(_0xdf62('0x5c'));exports[_0xdf62('0x5d')]=function(_0x1314a7,_0x35d124,_0x9b232c){var _0x483414={'agent':{},'channel':_0xdf62('0x5e')};if(_0x1314a7[_0xdf62('0x58')]['id']){delete _0x1314a7[_0xdf62('0x58')]['id'];}_0x1314a7[_0xdf62('0x58')]['read']=!![];_0x1314a7[_0xdf62('0x58')][_0xdf62('0x5f')]=moment()[_0xdf62('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x1314a7[_0xdf62('0x58')]['UserId']=_0x1314a7[_0xdf62('0x58')][_0xdf62('0x61')]||_0x1314a7[_0xdf62('0x62')]['id'];_0x483414[_0xdf62('0x63')]['id']=_0x1314a7[_0xdf62('0x58')][_0xdf62('0x61')];return db[_0xdf62('0x3c')][_0xdf62('0x59')]({'where':{'id':_0x1314a7['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x35d124,null))['then'](saveUpdates(_0x1314a7[_0xdf62('0x58')],null))[_0xdf62('0x36')](function(_0x320a3b){if(_0x320a3b){_0x483414[_0xdf62('0x26')]=_0x320a3b[_0xdf62('0x64')]({'plain':!![]});return db[_0xdf62('0x65')][_0xdf62('0x59')]({'where':{'id':_0x320a3b[_0xdf62('0x66')]}});}return null;})[_0xdf62('0x36')](handleEntityNotFound(_0x35d124,null))[_0xdf62('0x36')](function(_0x497b49){if(_0x497b49){return _0x497b49[_0xdf62('0x35')]({'UserId':_0x1314a7['body'][_0xdf62('0x61')],'read1stAt':_[_0xdf62('0x67')](_0x497b49[_0xdf62('0x68')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdf62('0x36')](function(_0x350e12){if(_0x350e12){_0x483414[_0xdf62('0x69')]=_0x350e12[_0xdf62('0x64')]({'plain':!![]});interaction_log[_0xdf62('0x1f')](_0xdf62('0x6a'),_0x1314a7[_0xdf62('0x62')]['id'],_0x1314a7['user'][_0xdf62('0x38')],_0x1314a7[_0xdf62('0x62')][_0xdf62('0x6b')],_0x483414['interaction']['id'],_0x1314a7['body']?JSON['stringify'](_0x1314a7['body']):_0xdf62('0x6c'));return respondWithRpcPromise(_0xdf62('0x6d'),_0xdf62('0x6e'),_0x483414);}return null;})[_0xdf62('0x36')](function(_0x4f7f07){var _0x555545=_0xdf62('0x6f')+_0x4f7f07['message'][_0xdf62('0x70')];return db['sequelize']['query'](_0x555545,{'type':db[_0xdf62('0x71')][_0xdf62('0x72')][_0xdf62('0x73')],'raw':!![]})[_0xdf62('0x36')](function(_0x44ba65){return _0x44ba65;});})[_0xdf62('0x36')](function(_0x1275d0){if(_0x1275d0){_0x483414['message'][_0xdf62('0x74')]=_0x1275d0[0x0];if(!_0x1314a7['body'][_0xdf62('0x61')])return;return db[_0xdf62('0x75')][_0xdf62('0x59')]({'where':{'id':_0x1314a7['body']['UserId'],'role':_0xdf62('0x63')},'attributes':['id','name',_0xdf62('0x76'),'email',_0xdf62('0x77')],'raw':!![]});}return null;})[_0xdf62('0x36')](function(_0x565f50){if(!_0x565f50)return null;_0x483414[_0xdf62('0x26')][_0xdf62('0x63')]=_0x565f50;return _0x483414;})[_0xdf62('0x36')](function(_0x1049cd){if(_0x1049cd){if(_0x1314a7[_0xdf62('0x58')][_0xdf62('0x78')]){_0x483414[_0xdf62('0x26')][_0xdf62('0x79')]=util[_0xdf62('0x60')](_0xdf62('0x7a'),_0x1314a7[_0xdf62('0x62')][_0xdf62('0x38')]);_0x483414[_0xdf62('0x26')]['channel']=_0x483414[_0xdf62('0x7b')];_0x483414[_0xdf62('0x26')][_0xdf62('0x7c')]=_0x483414[_0xdf62('0x7b')];_0x483414[_0xdf62('0x26')][_0xdf62('0x7d')]='accept';return respondWithRpcPromise(_0xdf62('0x7e'),_0xdf62('0x7e'),{'event':_0xdf62('0x7f'),'message':_0x483414[_0xdf62('0x26')]},client9002)[_0xdf62('0x36')](function(){return _0x483414;});}return _0x483414;}return null;})[_0xdf62('0x36')](respondWithResult(_0x35d124,null))[_0xdf62('0x27')](handleError(_0x35d124,null));};var interaction_log=require(_0xdf62('0x5b'))('openchannel-interactions');exports[_0xdf62('0x33')]=function(_0x552b15,_0xbb4260,_0x4a3a06){var _0x451895={'agent':{},'channel':'openchannel'};if(_0x552b15[_0xdf62('0x58')]['id']){delete _0x552b15[_0xdf62('0x58')]['id'];}_0x552b15[_0xdf62('0x58')]['UserId']=_0x552b15[_0xdf62('0x58')][_0xdf62('0x61')]||_0x552b15[_0xdf62('0x62')]['id'];_0x451895[_0xdf62('0x63')]['id']=_0x552b15[_0xdf62('0x58')][_0xdf62('0x61')];return db[_0xdf62('0x3c')][_0xdf62('0x59')]({'where':{'id':_0x552b15[_0xdf62('0x54')]['id'],'UserId':null}})[_0xdf62('0x36')](handleEntityNotFound(_0xbb4260,null))[_0xdf62('0x36')](function(_0x427c84){if(_0x427c84){_0x451895[_0xdf62('0x26')]=_0x427c84[_0xdf62('0x64')]({'plain':!![]});return db[_0xdf62('0x65')][_0xdf62('0x59')]({'where':{'id':_0x427c84['OpenchannelInteractionId']}});}return null;})[_0xdf62('0x36')](handleEntityNotFound(_0xbb4260,null))[_0xdf62('0x36')](function(_0x104fc8){if(_0x104fc8){_0x451895[_0xdf62('0x69')]=_0x104fc8[_0xdf62('0x64')]({'plain':!![]});interaction_log[_0xdf62('0x1f')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x552b15['user']['id'],_0x552b15[_0xdf62('0x62')][_0xdf62('0x38')],_0x552b15['user'][_0xdf62('0x6b')],_0x451895['interaction']['id'],_0x552b15[_0xdf62('0x58')]?JSON[_0xdf62('0x80')](_0x552b15[_0xdf62('0x58')]):_0xdf62('0x6c'));return respondWithRpcPromise('RejectMessage',_0xdf62('0x81'),_0x451895);}return null;})[_0xdf62('0x36')](function(_0x4645b4){var _0x3e32ba='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4645b4[_0xdf62('0x26')][_0xdf62('0x70')];return db[_0xdf62('0x82')]['query'](_0x3e32ba,{'type':db['Sequelize'][_0xdf62('0x72')][_0xdf62('0x73')],'raw':!![]})['then'](function(_0x1061b0){return _0x1061b0;});})[_0xdf62('0x36')](function(_0x2207f9){if(_0x2207f9){_0x451895['message']['contact']=_0x2207f9[0x0];if(!_0x552b15[_0xdf62('0x58')]['UserId'])return;return db[_0xdf62('0x75')][_0xdf62('0x59')]({'where':{'id':_0x552b15['body'][_0xdf62('0x61')],'role':_0xdf62('0x63')},'attributes':['id',_0xdf62('0x38'),'fullname',_0xdf62('0x83'),'internal'],'raw':!![]});}return null;})[_0xdf62('0x36')](function(_0x2723f6){if(!_0x2723f6)return null;_0x451895[_0xdf62('0x26')][_0xdf62('0x63')]=_0x2723f6;return _0x451895;})[_0xdf62('0x36')](function(_0x37dbb9){if(_0x37dbb9){_0x37dbb9['message'][_0xdf62('0x79')]=util['format'](_0xdf62('0x7a'),_0x552b15['user']['name']);_0x37dbb9[_0xdf62('0x26')]['channel']=_0x451895[_0xdf62('0x7b')];_0x37dbb9[_0xdf62('0x26')][_0xdf62('0x7c')]=_0x451895[_0xdf62('0x7b')];_0x37dbb9[_0xdf62('0x26')][_0xdf62('0x7d')]=_0xdf62('0x33');respondWithRpcPromise(_0xdf62('0x7e'),'EventManager',{'event':_0xdf62('0x84'),'message':_0x37dbb9[_0xdf62('0x26')]},client9002);return _0x451895;}return null;})[_0xdf62('0x36')](respondWithResult(_0xbb4260,null))[_0xdf62('0x27')](handleError(_0xbb4260,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 5c87576..fcae72f 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 _0xdfec=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit'];(function(_0x8d95a3,_0x735f63){var _0x1acf63=function(_0x329f34){while(--_0x329f34){_0x8d95a3['push'](_0x8d95a3['shift']());}};_0x1acf63(++_0x735f63);}(_0xdfec,0x85));var _0xcdfe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdfec[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xcdfe('0x0'));var OpenchannelMessage=require(_0xcdfe('0x1'))['db'][_0xcdfe('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcdfe('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcdfe('0x4'),'afterDestroy':_0xcdfe('0x5')};function emitEvent(_0x178036){return function(_0x43a705,_0x1b7f28,_0x5fb7b7){OpenchannelMessageEvents[_0xcdfe('0x6')](_0x178036+':'+_0x43a705['id'],_0x43a705);OpenchannelMessageEvents[_0xcdfe('0x6')](_0x178036,_0x43a705);_0x5fb7b7(null);};}for(var e in events){if(events[_0xcdfe('0x7')](e)){var event=events[e];OpenchannelMessage[_0xcdfe('0x8')](e,emitEvent(event));}}module[_0xcdfe('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xb81c=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x3c91f2,_0x114c77){var _0x3c8bd7=function(_0x1e6130){while(--_0x1e6130){_0x3c91f2['push'](_0x3c91f2['shift']());}};_0x3c8bd7(++_0x114c77);}(_0xb81c,0xb6));var _0xcb81=function(_0x14716d,_0x156723){_0x14716d=_0x14716d-0x0;var _0x1a4062=_0xb81c[_0x14716d];return _0x1a4062;};'use strict';var EventEmitter=require(_0xcb81('0x0'));var OpenchannelMessage=require(_0xcb81('0x1'))['db'][_0xcb81('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcb81('0x3')](0x0);var events={'afterCreate':_0xcb81('0x4'),'afterUpdate':_0xcb81('0x5'),'afterDestroy':_0xcb81('0x6')};function emitEvent(_0x45a048){return function(_0x5515d5,_0x4465cf,_0x44010f){OpenchannelMessageEvents['emit'](_0x45a048+':'+_0x5515d5['id'],_0x5515d5);OpenchannelMessageEvents[_0xcb81('0x7')](_0x45a048,_0x5515d5);_0x44010f(null);};}for(var e in events){if(events[_0xcb81('0x8')](e)){var event=events[e];OpenchannelMessage[_0xcb81('0x9')](e,emitEvent(event));}}module[_0xcb81('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index dd7c8ac..eda9421 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 _0x57d3=['Interactions','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','toLowerCase','direction','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','out','describe','find'];(function(_0x25c13f,_0x3defec){var _0x5c9031=function(_0x517001){while(--_0x517001){_0x25c13f['push'](_0x25c13f['shift']());}};_0x5c9031(++_0x3defec);}(_0x57d3,0x7b));var _0x357d=function(_0x4fa552,_0x564136){_0x4fa552=_0x4fa552-0x0;var _0x140bcb=_0x57d3[_0x4fa552];return _0x140bcb;};'use strict';var _=require(_0x357d('0x0'));var util=require(_0x357d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x357d('0x2'));var BPromise=require(_0x357d('0x3'));var rp=require(_0x357d('0x4'));var fs=require('fs');var path=require(_0x357d('0x5'));var rimraf=require(_0x357d('0x6'));var config=require('../../config/environment');var attributes=require(_0x357d('0x7'));module[_0x357d('0x8')]=function(_0x2b220b,_0x234c12){return _0x2b220b[_0x357d('0x9')](_0x357d('0xa'),attributes,{'tableName':_0x357d('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x357d('0xc')],'type':_0x357d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x85d96f,_0xd0e63f,_0x17370f){var _0x5af91b=_0x2b220b[_0x357d('0xe')];var _0x2b0eb9=_0x85d96f['get']({'plain':!![]});if(_0x2b0eb9['direction'][_0x357d('0xf')]()==='in'||_0x2b0eb9[_0x357d('0x10')]['toLowerCase']()==='out'&&!_0x2b0eb9[_0x357d('0x11')]&&!_[_0x357d('0x12')](_0x2b0eb9[_0x357d('0x13')])){_0x5af91b[_0x357d('0x14')]['findOne']({'where':{'id':_0x2b0eb9[_0x357d('0x15')]}})[_0x357d('0x16')](function(_0x5efc07){if(_0x5efc07){_0x5efc07[_0x357d('0x17')]({'lastMsgAt':_0x2b0eb9[_0x357d('0x18')],'lastMsgDirection':_0x2b0eb9[_0x357d('0x10')][_0x357d('0xf')]()});}})[_0x357d('0x19')](function(_0x496207){console[_0x357d('0x1a')](_0x496207);});}if(_0x2b0eb9[_0x357d('0x10')]===_0x357d('0x1b')&&!_0x2b0eb9[_0x357d('0x11')]){var _0x1647e7;_0x5af91b['CmContact'][_0x357d('0x1c')]()[_0x357d('0x16')](function(_0x57c4e0){return _0x5af91b['OpenchannelAccount'][_0x357d('0x1d')]({'where':{'id':_0x2b0eb9['OpenchannelAccountId']},'include':[{'model':_0x5af91b[_0x357d('0x14')],'as':_0x357d('0x1e'),'where':{'id':_0x2b0eb9['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x5af91b['CmContact'],'as':'Contact','attributes':_['keys'](_0x57c4e0)}]}]});})['then'](function(_0x12206b){_0x1647e7=_0x12206b[_0x357d('0x1f')]({'plain':!![]});if(_0x1647e7&&_0x1647e7[_0x357d('0x20')]){logger[_0x357d('0x21')](_0x357d('0x22'),_0x357d('0x23'),util[_0x357d('0x24')](_0x357d('0x25'),_0x2b0eb9['id'],_0x1647e7[_0x357d('0x20')]));if(_0x1647e7[_0x357d('0x1e')]&&_0x1647e7[_0x357d('0x1e')][_0x357d('0x26')]){_0x2b0eb9[_0x357d('0x27')]=_[_0x357d('0x28')](_0x1647e7[_0x357d('0x1e')][0x0],_0x357d('0x29'));_0x2b0eb9[_0x357d('0x29')]=_0x1647e7[_0x357d('0x1e')][0x0][_0x357d('0x29')];}var _0xd0e63f={'method':_0x357d('0x2a'),'uri':encodeURI(_0x1647e7[_0x357d('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xd0e63f[_0x357d('0x2b')]){case _0x357d('0x2c'):_0xd0e63f['qs']=_0x2b0eb9;break;case'POST':_0xd0e63f[_0x357d('0xc')]=_0x2b0eb9;break;}return rp(_0xd0e63f)[_0x357d('0x16')](function(_0x552c25){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x357d('0x23'),util[_0x357d('0x24')](_0x357d('0x2d'),_0x2b0eb9['id'],_0x1647e7[_0x357d('0x20')]));if(_0x552c25[_0x357d('0xc')][_0x357d('0x2e')]&&_0x552c25[_0x357d('0xc')]['threadId']!=_0x2b0eb9['Interaction']['threadId']){return _0x5af91b[_0x357d('0x14')][_0x357d('0x17')]({'threadId':_0x552c25[_0x357d('0xc')][_0x357d('0x2e')]},{'where':{'id':_0x2b0eb9[_0x357d('0x27')]['id']}});}else{return;}})[_0x357d('0x16')](function(){return _0x85d96f[_0x357d('0x17')]({'read':!![]});})['catch'](function(_0x32be8c){logger[_0x357d('0x1a')](_0x357d('0x22'),'afterCreate',util[_0x357d('0x2f')](_0x32be8c,{'showHidden':![],'depth':null}));_0x17370f();});}else{_0x17370f();}})[_0x357d('0x30')](function(){_0x17370f();});}else{_0x17370f();}}},'charset':_0x357d('0x31'),'collate':_0x357d('0x32')});}; \ No newline at end of file +var _0xe022=['OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','method','GET','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelInteraction','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Contact','replyUri','info'];(function(_0x13599f,_0x3e927d){var _0x4604d3=function(_0x3b422c){while(--_0x3b422c){_0x13599f['push'](_0x13599f['shift']());}};_0x4604d3(++_0x3e927d);}(_0xe022,0x71));var _0x2e02=function(_0x1b437b,_0x51862a){_0x1b437b=_0x1b437b-0x0;var _0x402b65=_0xe022[_0x1b437b];return _0x402b65;};'use strict';var _=require(_0x2e02('0x0'));var util=require(_0x2e02('0x1'));var logger=require('../../config/logger')(_0x2e02('0x2'));var moment=require(_0x2e02('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e02('0x4'));var rimraf=require(_0x2e02('0x5'));var config=require(_0x2e02('0x6'));var attributes=require(_0x2e02('0x7'));module[_0x2e02('0x8')]=function(_0x304d97,_0x386f12){return _0x304d97[_0x2e02('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x2e02('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x2e02('0xb')],'type':_0x2e02('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ad5a1,_0x467329,_0xc660b6){var _0x42c914=_0x304d97[_0x2e02('0xd')];var _0x5271a9=_0x2ad5a1[_0x2e02('0xe')]({'plain':!![]});if(_0x5271a9[_0x2e02('0xf')][_0x2e02('0x10')]()==='in'||_0x5271a9['direction']['toLowerCase']()===_0x2e02('0x11')&&!_0x5271a9[_0x2e02('0x12')]&&!_[_0x2e02('0x13')](_0x5271a9[_0x2e02('0x14')])){_0x42c914['OpenchannelInteraction'][_0x2e02('0x15')]({'where':{'id':_0x5271a9[_0x2e02('0x16')]}})[_0x2e02('0x17')](function(_0x35e9df){if(_0x35e9df){_0x35e9df[_0x2e02('0x18')]({'lastMsgAt':_0x5271a9[_0x2e02('0x19')],'lastMsgDirection':_0x5271a9[_0x2e02('0xf')][_0x2e02('0x10')]()});}})['catch'](function(_0x5dbe0c){console[_0x2e02('0x1a')](_0x5dbe0c);});}if(_0x5271a9[_0x2e02('0xf')]===_0x2e02('0x11')&&!_0x5271a9[_0x2e02('0x12')]){var _0x4b963d;_0x42c914[_0x2e02('0x1b')]['describe']()[_0x2e02('0x17')](function(_0x418867){return _0x42c914[_0x2e02('0x1c')][_0x2e02('0x1d')]({'where':{'id':_0x5271a9[_0x2e02('0x1e')]},'include':[{'model':_0x42c914['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x5271a9[_0x2e02('0x16')]},'limit':0x1,'include':[{'model':_0x42c914[_0x2e02('0x1b')],'as':_0x2e02('0x1f'),'attributes':_['keys'](_0x418867)}]}]});})[_0x2e02('0x17')](function(_0x24adfd){_0x4b963d=_0x24adfd[_0x2e02('0xe')]({'plain':!![]});if(_0x4b963d&&_0x4b963d[_0x2e02('0x20')]){logger[_0x2e02('0x21')](_0x2e02('0x22'),_0x2e02('0x23'),util['format'](_0x2e02('0x24'),_0x5271a9['id'],_0x4b963d['replyUri']));if(_0x4b963d[_0x2e02('0x25')]&&_0x4b963d[_0x2e02('0x25')][_0x2e02('0x26')]){_0x5271a9[_0x2e02('0x27')]=_['omit'](_0x4b963d[_0x2e02('0x25')][0x0],_0x2e02('0x1f'));_0x5271a9[_0x2e02('0x1f')]=_0x4b963d['Interactions'][0x0][_0x2e02('0x1f')];}var _0x467329={'method':'POST','uri':encodeURI(_0x4b963d[_0x2e02('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x467329[_0x2e02('0x28')]){case _0x2e02('0x29'):_0x467329['qs']=_0x5271a9;break;case'POST':_0x467329[_0x2e02('0xb')]=_0x5271a9;break;}return rp(_0x467329)['then'](function(_0x4fdde9){logger[_0x2e02('0x21')](_0x2e02('0x22'),_0x2e02('0x23'),util[_0x2e02('0x2a')](_0x2e02('0x2b'),_0x5271a9['id'],_0x4b963d['replyUri']));if(_0x4fdde9['body'][_0x2e02('0x2c')]&&_0x4fdde9[_0x2e02('0xb')]['threadId']!=_0x5271a9[_0x2e02('0x27')][_0x2e02('0x2c')]){return _0x42c914[_0x2e02('0x2d')][_0x2e02('0x18')]({'threadId':_0x4fdde9[_0x2e02('0xb')][_0x2e02('0x2c')]},{'where':{'id':_0x5271a9['Interaction']['id']}});}else{return;}})['then'](function(){return _0x2ad5a1[_0x2e02('0x18')]({'read':!![]});})['catch'](function(_0x356f93){logger[_0x2e02('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x2e02('0x23'),util[_0x2e02('0x2e')](_0x356f93,{'showHidden':![],'depth':null}));_0xc660b6();});}else{_0xc660b6();}})['finally'](function(){_0xc660b6();});}else{_0xc660b6();}}},'charset':_0x2e02('0x2f'),'collate':_0x2e02('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index c6be070..30469e6 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3f712a,_0x3d7abe){var _0x5d3c53=function(_0x504536){while(--_0x504536){_0x3f712a['push'](_0x3f712a['shift']());}};_0x5d3c53(++_0x3d7abe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3d5b33,_0x874481){_0x3d5b33=_0x3d5b33-0x0;var _0x13c9a3=_0x5f2f[_0x3d5b33];return _0x13c9a3;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x40121d,_0x13bbdd){var _0x47e2cc=function(_0x574309){while(--_0x574309){_0x40121d['push'](_0x40121d['shift']());}};_0x47e2cc(++_0x13bbdd);}(_0x1261,0x144));var _0x1126=function(_0x58da8a,_0x1fb6ff){_0x58da8a=_0x58da8a-0x0;var _0x5294b9=_0x1261[_0x58da8a];return _0x5294b9;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 2acb15b..efe0e2a 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 _0x494e=['removeListener','register','length','openchannelMessage:','./openchannelMessage.events','remove','emit'];(function(_0x52ff97,_0x4b7001){var _0x4ed8ef=function(_0x48bc5e){while(--_0x48bc5e){_0x52ff97['push'](_0x52ff97['shift']());}};_0x4ed8ef(++_0x4b7001);}(_0x494e,0xd6));var _0xe494=function(_0x50f84b,_0x3f4d2){_0x50f84b=_0x50f84b-0x0;var _0x5162a0=_0x494e[_0x50f84b];return _0x5162a0;};'use strict';var OpenchannelMessageEvents=require(_0xe494('0x0'));var events=['save',_0xe494('0x1'),'update'];function createListener(_0x5ed9d8,_0x356559){return function(_0x34f605){_0x356559[_0xe494('0x2')](_0x5ed9d8,_0x34f605);};}function removeListener(_0x243300,_0x28a0a3){return function(){OpenchannelMessageEvents[_0xe494('0x3')](_0x243300,_0x28a0a3);};}exports[_0xe494('0x4')]=function(_0x56d964){for(var _0x47b89f=0x0,_0x16773d=events[_0xe494('0x5')];_0x47b89f<_0x16773d;_0x47b89f++){var _0x7c1e3e=events[_0x47b89f];var _0x1c477d=createListener(_0xe494('0x6')+_0x7c1e3e,_0x56d964);OpenchannelMessageEvents['on'](_0x7c1e3e,_0x1c477d);}}; \ No newline at end of file +var _0x2fa9=['save','emit','register','length','./openchannelMessage.events'];(function(_0x5a9ba0,_0x1294f7){var _0x558880=function(_0xe0e11){while(--_0xe0e11){_0x5a9ba0['push'](_0x5a9ba0['shift']());}};_0x558880(++_0x1294f7);}(_0x2fa9,0x1e9));var _0x92fa=function(_0x239ede,_0x488e0c){_0x239ede=_0x239ede-0x0;var _0x4ea5ef=_0x2fa9[_0x239ede];return _0x4ea5ef;};'use strict';var OpenchannelMessageEvents=require(_0x92fa('0x0'));var events=[_0x92fa('0x1'),'remove','update'];function createListener(_0x123f1f,_0x2c4883){return function(_0x2c8a3c){_0x2c4883[_0x92fa('0x2')](_0x123f1f,_0x2c8a3c);};}function removeListener(_0x15e8e2,_0x429e5f){return function(){OpenchannelMessageEvents['removeListener'](_0x15e8e2,_0x429e5f);};}exports[_0x92fa('0x3')]=function(_0x58e34e){for(var _0x15c898=0x0,_0x4f13a7=events[_0x92fa('0x4')];_0x15c898<_0x4f13a7;_0x15c898++){var _0x901ff5=events[_0x15c898];var _0x53eb3c=createListener('openchannelMessage:'+_0x901ff5,_0x58e34e);OpenchannelMessageEvents['on'](_0x901ff5,_0x53eb3c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index d6463ea..4a4f12d 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 _0xa2e2=['destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','/:id','update','delete'];(function(_0x590a94,_0x61e61){var _0x865e8=function(_0x4670c0){while(--_0x4670c0){_0x590a94['push'](_0x590a94['shift']());}};_0x865e8(++_0x61e61);}(_0xa2e2,0x197));var _0x2a2e=function(_0x4f22fe,_0x23f451){_0x4f22fe=_0x4f22fe-0x0;var _0x12adca=_0xa2e2[_0x4f22fe];return _0x12adca;};'use strict';var multer=require(_0x2a2e('0x0'));var util=require(_0x2a2e('0x1'));var path=require(_0x2a2e('0x2'));var timeout=require('connect-timeout');var express=require(_0x2a2e('0x3'));var router=express[_0x2a2e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2a2e('0x5'));var interaction=require(_0x2a2e('0x6'));var config=require(_0x2a2e('0x7'));var controller=require(_0x2a2e('0x8'));router[_0x2a2e('0x9')]('/',auth[_0x2a2e('0xa')](),controller[_0x2a2e('0xb')]);router['get'](_0x2a2e('0xc'),auth[_0x2a2e('0xa')](),controller['describe']);router['get']('/:id',auth[_0x2a2e('0xa')](),controller[_0x2a2e('0xd')]);router['get'](_0x2a2e('0xe'),auth[_0x2a2e('0xa')](),controller[_0x2a2e('0xf')]);router[_0x2a2e('0x9')](_0x2a2e('0x10'),auth[_0x2a2e('0xa')](),controller[_0x2a2e('0x11')]);router[_0x2a2e('0x9')](_0x2a2e('0x12'),auth[_0x2a2e('0xa')](),controller[_0x2a2e('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2a2e('0x14')]);router[_0x2a2e('0x15')](_0x2a2e('0x10'),auth[_0x2a2e('0xa')](),controller[_0x2a2e('0x16')]);router[_0x2a2e('0x15')]('/:id/users',auth[_0x2a2e('0xa')](),controller[_0x2a2e('0x17')]);router['put'](_0x2a2e('0x18'),auth[_0x2a2e('0xa')](),controller[_0x2a2e('0x19')]);router[_0x2a2e('0x1a')](_0x2a2e('0x18'),auth['isAuthenticated'](),controller[_0x2a2e('0x1b')]);router[_0x2a2e('0x1a')](_0x2a2e('0x10'),auth[_0x2a2e('0xa')](),controller[_0x2a2e('0x1c')]);router[_0x2a2e('0x1a')](_0x2a2e('0x12'),auth[_0x2a2e('0xa')](),controller[_0x2a2e('0x1d')]);module[_0x2a2e('0x1e')]=router; \ No newline at end of file +var _0xb98f=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x111311,_0x1e2f69){var _0x4cef39=function(_0x382ab2){while(--_0x382ab2){_0x111311['push'](_0x111311['shift']());}};_0x4cef39(++_0x1e2f69);}(_0xb98f,0x13d));var _0xfb98=function(_0x378743,_0x579006){_0x378743=_0x378743-0x0;var _0x4b88d7=_0xb98f[_0x378743];return _0x4b88d7;};'use strict';var multer=require(_0xfb98('0x0'));var util=require(_0xfb98('0x1'));var path=require(_0xfb98('0x2'));var timeout=require(_0xfb98('0x3'));var express=require(_0xfb98('0x4'));var router=express['Router']();var fs_extra=require(_0xfb98('0x5'));var auth=require(_0xfb98('0x6'));var interaction=require(_0xfb98('0x7'));var config=require(_0xfb98('0x8'));var controller=require(_0xfb98('0x9'));router[_0xfb98('0xa')]('/',auth[_0xfb98('0xb')](),controller[_0xfb98('0xc')]);router['get'](_0xfb98('0xd'),auth[_0xfb98('0xb')](),controller[_0xfb98('0xe')]);router['get'](_0xfb98('0xf'),auth[_0xfb98('0xb')](),controller[_0xfb98('0x10')]);router[_0xfb98('0xa')]('/:id/members',auth[_0xfb98('0xb')](),controller['getMembers']);router[_0xfb98('0xa')](_0xfb98('0x11'),auth[_0xfb98('0xb')](),controller[_0xfb98('0x12')]);router[_0xfb98('0xa')](_0xfb98('0x13'),auth[_0xfb98('0xb')](),controller['getAgents']);router['post']('/',auth[_0xfb98('0xb')](),controller[_0xfb98('0x14')]);router[_0xfb98('0x15')](_0xfb98('0x11'),auth[_0xfb98('0xb')](),controller[_0xfb98('0x16')]);router[_0xfb98('0x15')](_0xfb98('0x13'),auth[_0xfb98('0xb')](),controller[_0xfb98('0x17')]);router['put'](_0xfb98('0xf'),auth['isAuthenticated'](),controller[_0xfb98('0x18')]);router[_0xfb98('0x19')](_0xfb98('0xf'),auth[_0xfb98('0xb')](),controller['destroy']);router[_0xfb98('0x19')](_0xfb98('0x11'),auth[_0xfb98('0xb')](),controller[_0xfb98('0x1a')]);router[_0xfb98('0x19')](_0xfb98('0x13'),auth[_0xfb98('0xb')](),controller[_0xfb98('0x1b')]);module[_0xfb98('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 8d766af..50738ba 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 _0xe893=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x23cf3d,_0x2195b7){var _0x220fab=function(_0x19dbcb){while(--_0x19dbcb){_0x23cf3d['push'](_0x23cf3d['shift']());}};_0x220fab(++_0x2195b7);}(_0xe893,0x1f2));var _0x3e89=function(_0x5a7fbc,_0xa081de){_0x5a7fbc=_0x5a7fbc-0x0;var _0xcba0fc=_0xe893[_0x5a7fbc];return _0xcba0fc;};'use strict';var Sequelize=require(_0x3e89('0x0'));module[_0x3e89('0x1')]={'name':{'type':Sequelize[_0x3e89('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3e89('0x2')]},'timeout':{'type':Sequelize[_0x3e89('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3e89('0x4')](_0x3e89('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x1e1b=['beepall','roundrobin','sequelize','STRING','INTEGER','ENUM'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x1e1b,0x68));var _0xb1e1=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x1e1b[_0x912d27];return _0x31b918;};'use strict';var Sequelize=require(_0xb1e1('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1e1('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb1e1('0x1')]},'timeout':{'type':Sequelize[_0xb1e1('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb1e1('0x3')]('rrmemory',_0xb1e1('0x4'),_0xb1e1('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 82a7162..13fbd51 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 _0x3471=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','map','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','merge','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','transaction','each','findOrCreate','emit','removeTeams','select','field','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','getAgents','eml-format'];(function(_0x4c5613,_0x1d756a){var _0x3382c1=function(_0x3753a0){while(--_0x3753a0){_0x4c5613['push'](_0x4c5613['shift']());}};_0x3382c1(++_0x1d756a);}(_0x3471,0x11f));var _0x1347=function(_0x5d41fb,_0x3ff1ff){_0x5d41fb=_0x5d41fb-0x0;var _0x1f2090=_0x3471[_0x5d41fb];return _0x1f2090;};'use strict';var emlformat=require(_0x1347('0x0'));var rimraf=require(_0x1347('0x1'));var zipdir=require(_0x1347('0x2'));var jsonpatch=require(_0x1347('0x3'));var rp=require(_0x1347('0x4'));var moment=require('moment');var BPromise=require(_0x1347('0x5'));var Mustache=require(_0x1347('0x6'));var util=require(_0x1347('0x7'));var path=require(_0x1347('0x8'));var sox=require(_0x1347('0x9'));var csv=require(_0x1347('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1347('0xb'));var _=require(_0x1347('0xc'));var squel=require(_0x1347('0xd'));var crypto=require(_0x1347('0xe'));var jsforce=require(_0x1347('0xf'));var deskjs=require(_0x1347('0x10'));var toCsv=require(_0x1347('0xa'));var querystring=require(_0x1347('0x11'));var Papa=require(_0x1347('0x12'));var Redis=require(_0x1347('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1347('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1347('0x15'));var logger=require(_0x1347('0x16'))(_0x1347('0x17'));var utils=require(_0x1347('0x18'));var config=require(_0x1347('0x19'));var licenseUtil=require(_0x1347('0x1a'));var db=require(_0x1347('0x1b'))['db'];config['redis']=_[_0x1347('0x1c')](config['redis'],{'host':_0x1347('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1347('0x1e')]));require(_0x1347('0x1f'))[_0x1347('0x20')](socket);function respondWithStatusCode(_0x22f872,_0xb57d29){_0xb57d29=_0xb57d29||0xcc;return function(_0x2456a2){if(_0x2456a2){return _0x22f872[_0x1347('0x21')](_0xb57d29);}return _0x22f872[_0x1347('0x22')](_0xb57d29)[_0x1347('0x23')]();};}function respondWithResult(_0xd89745,_0x29491e){_0x29491e=_0x29491e||0xc8;return function(_0x2eb342){if(_0x2eb342){return _0xd89745[_0x1347('0x22')](_0x29491e)[_0x1347('0x24')](_0x2eb342);}};}function respondWithFilteredResult(_0x13d369,_0x2fb209){return function(_0x5c4c69){if(_0x5c4c69){var _0x1ec1e0=typeof _0x2fb209[_0x1347('0x25')]===_0x1347('0x26')&&typeof _0x2fb209[_0x1347('0x27')]===_0x1347('0x26');var _0x489eb1=_0x5c4c69[_0x1347('0x28')];var _0x1e1f2a=_0x1ec1e0?0x0:_0x2fb209[_0x1347('0x25')];var _0x4787dd=_0x1ec1e0?_0x5c4c69[_0x1347('0x28')]:_0x2fb209['offset']+_0x2fb209[_0x1347('0x27')];var _0x5ca3c2;if(_0x4787dd>=_0x489eb1){_0x4787dd=_0x489eb1;_0x5ca3c2=0xc8;}else{_0x5ca3c2=0xce;}_0x13d369[_0x1347('0x22')](_0x5ca3c2);return _0x13d369[_0x1347('0x29')]('Content-Range',_0x1e1f2a+'-'+_0x4787dd+'/'+_0x489eb1)[_0x1347('0x24')](_0x5c4c69);}return null;};}function patchUpdates(_0x3ae81d){return function(_0x2ba1c4){try{jsonpatch[_0x1347('0x2a')](_0x2ba1c4,_0x3ae81d,!![]);}catch(_0x27611c){return BPromise['reject'](_0x27611c);}return _0x2ba1c4[_0x1347('0x2b')]();};}function saveUpdates(_0x1ece25,_0x530f9b){return function(_0x47ed35){if(_0x47ed35){return _0x47ed35['update'](_0x1ece25)[_0x1347('0x2c')](function(_0x4445cb){return _0x4445cb;});}return null;};}function removeEntity(_0x5bcfbf,_0x1ed41f){return function(_0x43a6f1){if(_0x43a6f1){return _0x43a6f1[_0x1347('0x2d')]()[_0x1347('0x2c')](function(){var _0x2ea0b4=_0x43a6f1[_0x1347('0x2e')]({'plain':!![]});var _0x541cd8=_0x1347('0x2f');return db[_0x1347('0x30')][_0x1347('0x2d')]({'where':{'type':_0x541cd8,'resourceId':_0x2ea0b4['id']}})[_0x1347('0x2c')](function(){return _0x43a6f1;});})[_0x1347('0x2c')](function(){_0x5bcfbf['status'](0xcc)[_0x1347('0x23')]();});}};}function handleEntityNotFound(_0x4ea035,_0x30cc0e){return function(_0x1b4fdd){if(!_0x1b4fdd){_0x4ea035[_0x1347('0x21')](0x194);}return _0x1b4fdd;};}function handleError(_0x3cf7d9,_0x5927ed){_0x5927ed=_0x5927ed||0x1f4;return function(_0x34245a){logger[_0x1347('0x31')](_0x34245a[_0x1347('0x32')]);if(_0x34245a[_0x1347('0x33')]){delete _0x34245a['name'];}_0x3cf7d9[_0x1347('0x22')](_0x5927ed)[_0x1347('0x34')](_0x34245a);};}exports[_0x1347('0x35')]=function(_0x4ed6a7,_0x30905){var _0x22e95d={},_0x50d98d={},_0x5df2a2={'count':0x0,'rows':[]};var _0x480060=_['map'](db[_0x1347('0x36')][_0x1347('0x37')],function(_0x5502bc){return{'name':_0x5502bc[_0x1347('0x38')],'type':_0x5502bc['type']['key']};});_0x50d98d[_0x1347('0x39')]=_['map'](_0x480060,'name');_0x50d98d[_0x1347('0x3a')]=_[_0x1347('0x3b')](_0x4ed6a7[_0x1347('0x3a')]);_0x50d98d[_0x1347('0x3c')]=_[_0x1347('0x3d')](_0x50d98d['model'],_0x50d98d['query']);_0x22e95d[_0x1347('0x3e')]=_['intersection'](_0x50d98d[_0x1347('0x39')],qs[_0x1347('0x3f')](_0x4ed6a7[_0x1347('0x3a')][_0x1347('0x3f')]));_0x22e95d[_0x1347('0x3e')]=_0x22e95d[_0x1347('0x3e')]['length']?_0x22e95d[_0x1347('0x3e')]:_0x50d98d[_0x1347('0x39')];if(!_0x4ed6a7[_0x1347('0x3a')]['hasOwnProperty'](_0x1347('0x40'))){_0x22e95d[_0x1347('0x27')]=qs[_0x1347('0x27')](_0x4ed6a7[_0x1347('0x3a')][_0x1347('0x27')]);_0x22e95d[_0x1347('0x25')]=qs[_0x1347('0x25')](_0x4ed6a7[_0x1347('0x3a')]['offset']);}_0x22e95d[_0x1347('0x41')]=qs[_0x1347('0x42')](_0x4ed6a7[_0x1347('0x3a')]['sort']);_0x22e95d['where']=qs[_0x1347('0x3c')](_[_0x1347('0x43')](_0x4ed6a7[_0x1347('0x3a')],_0x50d98d[_0x1347('0x3c')]),_0x480060);if(_0x4ed6a7[_0x1347('0x3a')][_0x1347('0x44')]){_0x22e95d[_0x1347('0x45')]=_['merge'](_0x22e95d[_0x1347('0x45')],{'$or':_[_0x1347('0x46')](_0x480060,function(_0x7ba83d){if(_0x7ba83d['type']!==_0x1347('0x47')){var _0x5eddb9={};_0x5eddb9[_0x7ba83d['name']]={'$like':'%'+_0x4ed6a7[_0x1347('0x3a')][_0x1347('0x44')]+'%'};return _0x5eddb9;}})});}_0x22e95d=_['merge']({},_0x22e95d,_0x4ed6a7[_0x1347('0x48')]);var _0x498787={'where':_0x22e95d[_0x1347('0x45')]};return db[_0x1347('0x36')][_0x1347('0x28')](_0x498787)[_0x1347('0x2c')](function(_0x1c0cdd){_0x5df2a2['count']=_0x1c0cdd;if(_0x4ed6a7[_0x1347('0x3a')]['includeAll']){_0x22e95d['include']=[{'all':!![]}];}return db[_0x1347('0x36')][_0x1347('0x49')](_0x22e95d);})[_0x1347('0x2c')](function(_0x3e673c){_0x5df2a2[_0x1347('0x4a')]=_0x3e673c;return _0x5df2a2;})[_0x1347('0x2c')](respondWithFilteredResult(_0x30905,_0x22e95d))[_0x1347('0x4b')](handleError(_0x30905,null));};exports[_0x1347('0x4c')]=function(_0x2f05df,_0x837022){var _0x16e54d={'raw':!![],'where':{'id':_0x2f05df[_0x1347('0x4d')]['id']}},_0x54bafb={};_0x54bafb[_0x1347('0x39')]=_[_0x1347('0x3b')](db[_0x1347('0x36')][_0x1347('0x37')]);_0x54bafb[_0x1347('0x3a')]=_[_0x1347('0x3b')](_0x2f05df[_0x1347('0x3a')]);_0x54bafb[_0x1347('0x3c')]=_[_0x1347('0x3d')](_0x54bafb['model'],_0x54bafb['query']);_0x16e54d[_0x1347('0x3e')]=_[_0x1347('0x3d')](_0x54bafb['model'],qs[_0x1347('0x3f')](_0x2f05df['query']['fields']));_0x16e54d[_0x1347('0x3e')]=_0x16e54d['attributes']['length']?_0x16e54d['attributes']:_0x54bafb[_0x1347('0x39')];if(_0x2f05df[_0x1347('0x3a')][_0x1347('0x4e')]){_0x16e54d[_0x1347('0x4f')]=[{'all':!![]}];}_0x16e54d=_[_0x1347('0x50')]({},_0x16e54d,_0x2f05df[_0x1347('0x48')]);return db[_0x1347('0x36')][_0x1347('0x51')](_0x16e54d)[_0x1347('0x2c')](handleEntityNotFound(_0x837022,null))[_0x1347('0x2c')](respondWithResult(_0x837022,null))[_0x1347('0x4b')](handleError(_0x837022,null));};exports['create']=function(_0x2a9e16,_0x167c9a){return db[_0x1347('0x36')][_0x1347('0x52')](_0x2a9e16[_0x1347('0x53')],{})[_0x1347('0x2c')](function(_0x159920){var _0x4f232b=_0x2a9e16[_0x1347('0x54')][_0x1347('0x2e')]({'plain':!![]});if(!_0x4f232b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f232b[_0x1347('0x55')]===_0x1347('0x54')){var _0x155ccc=_0x159920[_0x1347('0x2e')]({'plain':!![]});var _0x3dd9a8=_0x1347('0x2f');return db[_0x1347('0x56')]['find']({'where':{'name':_0x3dd9a8,'userProfileId':_0x4f232b['userProfileId']},'raw':!![]})[_0x1347('0x2c')](function(_0x45b327){if(_0x45b327&&_0x45b327[_0x1347('0x57')]===0x0){return db[_0x1347('0x30')][_0x1347('0x52')]({'name':_0x155ccc['name'],'resourceId':_0x155ccc['id'],'type':_0x45b327['name'],'sectionId':_0x45b327['id']},{})[_0x1347('0x2c')](function(){return _0x159920;});}else{return _0x159920;}})['catch'](function(_0x5eaa07){logger[_0x1347('0x31')](_0x1347('0x58'),_0x5eaa07);throw _0x5eaa07;});}return _0x159920;})['then'](respondWithResult(_0x167c9a,0xc9))[_0x1347('0x4b')](handleError(_0x167c9a,null));};exports['update']=function(_0xa7bbc2,_0x1dbdb9){if(_0xa7bbc2[_0x1347('0x53')]['id']){delete _0xa7bbc2[_0x1347('0x53')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0xa7bbc2[_0x1347('0x4d')]['id']}})[_0x1347('0x2c')](handleEntityNotFound(_0x1dbdb9,null))[_0x1347('0x2c')](saveUpdates(_0xa7bbc2[_0x1347('0x53')],null))[_0x1347('0x2c')](respondWithResult(_0x1dbdb9,null))[_0x1347('0x4b')](handleError(_0x1dbdb9,null));};exports[_0x1347('0x2d')]=function(_0x1a2a8a,_0x9a8756){return db[_0x1347('0x36')]['find']({'where':{'id':_0x1a2a8a['params']['id']}})[_0x1347('0x2c')](handleEntityNotFound(_0x9a8756,null))['then'](removeEntity(_0x9a8756,null))[_0x1347('0x4b')](handleError(_0x9a8756,null));};exports[_0x1347('0x59')]=function(_0x2047d9,_0x2d5c39){return db['OpenchannelQueue'][_0x1347('0x59')]()['then'](respondWithResult(_0x2d5c39,null))[_0x1347('0x4b')](handleError(_0x2d5c39,null));};exports[_0x1347('0x5a')]=function(_0x3fa242,_0x6f9b58,_0x41e253){var _0x125949={'raw':!![],'where':{}},_0x6afd77={},_0x4d23ae;return db[_0x1347('0x36')][_0x1347('0x5b')]({'where':{'id':_0x3fa242['params']['id']}})[_0x1347('0x2c')](handleEntityNotFound(_0x6f9b58,null))[_0x1347('0x2c')](function(_0x4cdcc4){if(_0x4cdcc4){_0x4d23ae=_0x4cdcc4[_0x1347('0x2e')]({'plain':!![]});_0x6afd77[_0x1347('0x39')]=_[_0x1347('0x3b')](db[_0x1347('0x5c')]['rawAttributes']);_0x6afd77[_0x1347('0x3a')]=_[_0x1347('0x3b')](_0x3fa242[_0x1347('0x3a')]);_0x6afd77['filters']=_['intersection'](_0x6afd77[_0x1347('0x39')],_0x6afd77[_0x1347('0x3a')]);_0x125949[_0x1347('0x3e')]=_[_0x1347('0x3d')](_0x6afd77[_0x1347('0x39')],qs[_0x1347('0x3f')](_0x3fa242['query'][_0x1347('0x3f')]));_0x125949[_0x1347('0x3e')]=_0x125949[_0x1347('0x3e')][_0x1347('0x5d')]?_0x125949['attributes']:_0x6afd77[_0x1347('0x39')];if(!_0x3fa242[_0x1347('0x3a')][_0x1347('0x5e')](_0x1347('0x40'))){_0x125949[_0x1347('0x27')]=qs[_0x1347('0x27')](_0x3fa242[_0x1347('0x3a')][_0x1347('0x27')]);_0x125949[_0x1347('0x25')]=qs[_0x1347('0x25')](_0x3fa242[_0x1347('0x3a')][_0x1347('0x25')]);}_0x125949[_0x1347('0x41')]=qs['sort'](_0x3fa242[_0x1347('0x3a')][_0x1347('0x42')]);_0x125949[_0x1347('0x45')]=qs['filters'](_[_0x1347('0x43')](_0x3fa242[_0x1347('0x3a')],_0x6afd77['filters']));_0x125949[_0x1347('0x45')][_0x1347('0x5f')]=_0x4cdcc4['id'];if(_0x3fa242[_0x1347('0x3a')][_0x1347('0x44')]){_0x125949[_0x1347('0x45')]=_[_0x1347('0x50')](_0x125949[_0x1347('0x45')],{'$or':_[_0x1347('0x46')](_0x125949['attributes'],function(_0x702b8e){var _0x2f1738={};_0x2f1738[_0x702b8e]={'$like':'%'+_0x3fa242[_0x1347('0x3a')]['filter']+'%'};return _0x2f1738;})});}_0x125949=_[_0x1347('0x50')]({},_0x125949,_0x3fa242[_0x1347('0x48')]);return db[_0x1347('0x5c')][_0x1347('0x49')](_0x125949);}})['then'](function(_0x32dee6){if(_0x32dee6){return db['User'][_0x1347('0x60')]({'where':{'id':_[_0x1347('0x46')](_0x32dee6,_0x1347('0x61')),'role':_0x1347('0x62')},'attributes':['id',_0x1347('0x33'),_0x1347('0x63'),_0x1347('0x64'),_0x1347('0x65')]});}})[_0x1347('0x2c')](function(_0x243025){if(_0x243025){return{'count':_0x243025[_0x1347('0x28')],'rows':_['map'](_0x243025[_0x1347('0x4a')],function(_0x1b2d79){return{'membername':_0x1b2d79[_0x1347('0x33')],'UserId':_0x1b2d79['id'],'queue_name':_0x4d23ae[_0x1347('0x33')],'OpenchannelQueueId':_0x4d23ae['id'],'interface':util[_0x1347('0x66')](_0x1347('0x67'),'SIP',_0x1b2d79[_0x1347('0x33')]),'penalty':0x0,'paused':_0x1b2d79['openchannelPause'],'createdAt':_0x1b2d79[_0x1347('0x65')],'updatedAt':_0x1b2d79[_0x1347('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1347('0x2c')](respondWithFilteredResult(_0x6f9b58,_0x125949))[_0x1347('0x4b')](handleError(_0x6f9b58,null));};exports[_0x1347('0x68')]=function(_0x31ed54,_0x2c1fb9,_0x20488a){var _0x2df0ff={};var _0x248b79={};var _0x4b0f29;var _0x10153a;return db[_0x1347('0x36')][_0x1347('0x5b')]({'where':{'id':_0x31ed54[_0x1347('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c1fb9,null))[_0x1347('0x2c')](function(_0x1de494){if(_0x1de494){_0x4b0f29=_0x1de494;_0x248b79[_0x1347('0x39')]=_[_0x1347('0x3b')](db[_0x1347('0x69')]['rawAttributes']);_0x248b79[_0x1347('0x3a')]=_['keys'](_0x31ed54[_0x1347('0x3a')]);_0x248b79[_0x1347('0x3c')]=_[_0x1347('0x3d')](_0x248b79[_0x1347('0x39')],_0x248b79['query']);_0x2df0ff[_0x1347('0x3e')]=_[_0x1347('0x3d')](_0x248b79[_0x1347('0x39')],qs[_0x1347('0x3f')](_0x31ed54[_0x1347('0x3a')][_0x1347('0x3f')]));_0x2df0ff[_0x1347('0x3e')]=_0x2df0ff[_0x1347('0x3e')][_0x1347('0x5d')]?_0x2df0ff[_0x1347('0x3e')]:_0x248b79[_0x1347('0x39')];_0x2df0ff[_0x1347('0x41')]=qs[_0x1347('0x42')](_0x31ed54['query'][_0x1347('0x42')]);_0x2df0ff[_0x1347('0x45')]=qs[_0x1347('0x3c')](_['pick'](_0x31ed54['query'],_0x248b79['filters']));if(_0x31ed54[_0x1347('0x3a')]['filter']){_0x2df0ff['where']=_[_0x1347('0x50')](_0x2df0ff[_0x1347('0x45')],{'$or':_['map'](_0x2df0ff[_0x1347('0x3e')],function(_0x3fb8e){var _0x1f9184={};_0x1f9184[_0x3fb8e]={'$like':'%'+_0x31ed54['query'][_0x1347('0x44')]+'%'};return _0x1f9184;})});}_0x2df0ff=_[_0x1347('0x50')]({},_0x2df0ff,_0x31ed54[_0x1347('0x48')]);return _0x4b0f29['getTeams'](_0x2df0ff);}})[_0x1347('0x2c')](function(_0x27e37a){if(_0x27e37a){_0x10153a=_0x27e37a['length'];if(!_0x31ed54[_0x1347('0x3a')]['hasOwnProperty'](_0x1347('0x40'))){_0x2df0ff[_0x1347('0x27')]=qs[_0x1347('0x27')](_0x31ed54[_0x1347('0x3a')]['limit']);_0x2df0ff[_0x1347('0x25')]=qs[_0x1347('0x25')](_0x31ed54[_0x1347('0x3a')][_0x1347('0x25')]);}return _0x4b0f29[_0x1347('0x68')](_0x2df0ff);}})[_0x1347('0x2c')](function(_0x49ff46){if(_0x49ff46){return _0x49ff46?{'count':_0x10153a,'rows':_0x49ff46}:null;}})[_0x1347('0x2c')](respondWithResult(_0x2c1fb9,null))[_0x1347('0x4b')](handleError(_0x2c1fb9,null));};exports[_0x1347('0x6a')]=function(_0x50c755,_0x4bb932,_0x4535fe){var _0xd2d3ad=_0x50c755[_0x1347('0x53')][_0x1347('0x6b')];return db[_0x1347('0x69')][_0x1347('0x49')]({'where':{'id':_0xd2d3ad},'attributes':['id'],'include':[{'model':db[_0x1347('0x6c')],'as':_0x1347('0x6d'),'attributes':['id','name',_0x1347('0x6e'),'voicePause',_0x1347('0x6f')],'raw':!![]}]})[_0x1347('0x2c')](function(_0x1101cf){if(_0x1101cf){var _0x4967b0=_[_0x1347('0x70')](_0x1101cf,function(_0x30f2ea){var _0x23401b=_0x30f2ea[_0x1347('0x2e')]({'plain':!![]});return _0x23401b[_0x1347('0x6d')];});return db[_0x1347('0x36')][_0x1347('0x51')]({'where':{'id':_0x50c755[_0x1347('0x4d')]['id']}})['then'](function(_0x37958d){return db['sequelize'][_0x1347('0x71')](function(_0x281017){return _0x37958d['addTeams'](_0xd2d3ad,{'transaction':_0x281017})[_0x1347('0x2c')](function(){return BPromise[_0x1347('0x72')](_0x4967b0,function(_0x971980){return db['UserOpenchannelQueue'][_0x1347('0x73')]({'where':{'UserId':_0x971980['id'],'OpenchannelQueueId':_0x50c755['params']['id']},'transaction':_0x281017});});})[_0x1347('0x2c')](function(){_0x4967b0['forEach'](function(_0x5502df){socket[_0x1347('0x74')]('userOpenchannelQueue:save',{'UserId':_0x5502df['id'],'OpenchannelQueueId':_0x37958d['id']});});});});});}})[_0x1347('0x2c')](respondWithStatusCode(_0x4bb932,null))[_0x1347('0x4b')](handleError(_0x4bb932,null));};exports[_0x1347('0x75')]=function(_0x7b390a,_0x114915,_0x204877){return db[_0x1347('0x69')][_0x1347('0x49')]({'where':{'id':_0x7b390a[_0x1347('0x3a')][_0x1347('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1347('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x1347('0x2c')](handleEntityNotFound(_0x114915,null))[_0x1347('0x2c')](function(_0x4c077d){var _0xecbea7=_[_0x1347('0x46')](_0x4c077d,'id');var _0x1a9ecc=[];var _0x4abe88=[];var _0x557914=squel[_0x1347('0x76')]();_0x557914[_0x1347('0x77')]('tq.TeamId')['from'](_0x1347('0x78'),'tq')[_0x1347('0x79')]('user_has_teams','ut',_0x1347('0x7a'))['where'](_0x1347('0x7b'),_0x7b390a['params']['id']);for(var _0x15889e=0x0;_0x15889e<_0x4c077d[_0x1347('0x5d')];_0x15889e+=0x1){let _0x1ffb25=_0x4c077d[_0x15889e];for(var _0x1e1cad=0x0;_0x1e1cad<_0x1ffb25['Agents'][_0x1347('0x5d')];_0x1e1cad+=0x1){let _0x2a76a7=_0x1ffb25['Agents'][_0x1e1cad];var _0x5d5be0=_0x557914[_0x1347('0x7c')]();_0x5d5be0[_0x1347('0x45')](_0x1347('0x7d'),_0x2a76a7['id']);_0x4abe88[_0x1347('0x7e')](db[_0x1347('0x7f')][_0x1347('0x3a')](_0x5d5be0[_0x1347('0x80')](),{'type':db[_0x1347('0x7f')][_0x1347('0x81')][_0x1347('0x82')]})[_0x1347('0x2c')](function(_0x1a8a0a){if(_0x1a8a0a[_0x1347('0x5d')]===0x1){return _0x2a76a7['id'];}else{var _0xd0b82d=_[_0x1347('0x83')](_[_0x1347('0x46')](_0x1a8a0a,'TeamId'),function(_0x53cf8f){return _[_0x1347('0x84')](_0xecbea7,_0x53cf8f);});if(_0xd0b82d){return _0x2a76a7['id'];}}}));}}return BPromise[_0x1347('0x85')](_0x4abe88)[_0x1347('0x2c')](function(_0x53ed34){_0x1a9ecc=_(_0x1a9ecc)[_0x1347('0x86')](_0x53ed34)['compact']()[_0x1347('0x87')]();return db[_0x1347('0x36')][_0x1347('0x51')]({'where':{'id':_0x7b390a['params']['id']}})[_0x1347('0x2c')](function(_0x5ac42a){return db[_0x1347('0x7f')][_0x1347('0x71')](function(_0x1dd777){return _0x5ac42a[_0x1347('0x75')](_0x7b390a['query'][_0x1347('0x6b')],{'transaction':_0x1dd777})['then'](function(){if(!_[_0x1347('0x88')](_0x1a9ecc)){return _0x5ac42a[_0x1347('0x89')](_0x1a9ecc,{'transaction':_0x1dd777});}})[_0x1347('0x2c')](function(){_0x1a9ecc['forEach'](function(_0x465172){socket[_0x1347('0x74')](_0x1347('0x8a'),{'UserId':_0x465172,'OpenchannelQueueId':_0x5ac42a['id']});});});});});});})[_0x1347('0x2c')](respondWithStatusCode(_0x114915,null))[_0x1347('0x4b')](handleError(_0x114915,null));};exports[_0x1347('0x8b')]=function(_0x291fe2,_0x259298,_0x40f500){return db['OpenchannelQueue'][_0x1347('0x51')]({'where':{'id':_0x291fe2[_0x1347('0x4d')]['id']}})['then'](handleEntityNotFound(_0x259298,null))[_0x1347('0x2c')](function(_0x31541a){if(_0x31541a){return _0x31541a[_0x1347('0x8b')](_0x291fe2['body'][_0x1347('0x6b')],_[_0x1347('0x8c')](_0x291fe2['body'],[_0x1347('0x6b'),'id'])||{})[_0x1347('0x8d')](function(_0x12e219){for(var _0x214122=0x0;_0x214122<_0x291fe2[_0x1347('0x53')]['ids'][_0x1347('0x5d')];_0x214122+=0x1){socket[_0x1347('0x74')](_0x1347('0x8e'),{'UserId':Number(_0x291fe2[_0x1347('0x53')]['ids'][_0x214122]),'OpenchannelQueueId':Number(_0x291fe2[_0x1347('0x4d')]['id'])});}return _0x12e219;});}})[_0x1347('0x2c')](respondWithResult(_0x259298,null))[_0x1347('0x4b')](handleError(_0x259298,null));};exports[_0x1347('0x89')]=function(_0x10fd9c,_0x5f4c57,_0x2e5ada){return db[_0x1347('0x36')][_0x1347('0x51')]({'where':{'id':_0x10fd9c[_0x1347('0x4d')]['id']}})[_0x1347('0x2c')](handleEntityNotFound(_0x5f4c57,null))['then'](function(_0x50ef8f){if(_0x50ef8f){return _0x50ef8f[_0x1347('0x89')](_0x10fd9c[_0x1347('0x3a')][_0x1347('0x6b')])[_0x1347('0x2c')](function(){if(_['isArray'](_0x10fd9c[_0x1347('0x3a')][_0x1347('0x6b')])){for(var _0x35fded=0x0;_0x35fded<_0x10fd9c['query'][_0x1347('0x6b')][_0x1347('0x5d')];_0x35fded+=0x1){socket[_0x1347('0x74')](_0x1347('0x8a'),{'UserId':Number(_0x10fd9c['query'][_0x1347('0x6b')][_0x35fded]),'OpenchannelQueueId':Number(_0x10fd9c[_0x1347('0x4d')]['id'])});}}else{socket[_0x1347('0x74')]('userOpenchannelQueue:remove',{'UserId':Number(_0x10fd9c[_0x1347('0x3a')][_0x1347('0x6b')]),'OpenchannelQueueId':Number(_0x10fd9c['params']['id'])});}});}})[_0x1347('0x2c')](respondWithStatusCode(_0x5f4c57,null))['catch'](handleError(_0x5f4c57,null));};exports[_0x1347('0x8f')]=function(_0xa09bc0,_0x5640a0,_0xfbf0c2){var _0x5ef878={};var _0x3cb2ff={};var _0x347daf;var _0x2b1944;return db['OpenchannelQueue'][_0x1347('0x5b')]({'where':{'id':_0xa09bc0[_0x1347('0x4d')]['id']}})[_0x1347('0x2c')](handleEntityNotFound(_0x5640a0,null))[_0x1347('0x2c')](function(_0x3183e0){if(_0x3183e0){_0x347daf=_0x3183e0;_0x3cb2ff[_0x1347('0x39')]=_[_0x1347('0x3b')](db[_0x1347('0x6c')]['rawAttributes']);_0x3cb2ff[_0x1347('0x3a')]=_['keys'](_0xa09bc0[_0x1347('0x3a')]);_0x3cb2ff[_0x1347('0x3c')]=_['intersection'](_0x3cb2ff[_0x1347('0x39')],_0x3cb2ff['query']);_0x5ef878['attributes']=_[_0x1347('0x3d')](_0x3cb2ff[_0x1347('0x39')],qs[_0x1347('0x3f')](_0xa09bc0['query'][_0x1347('0x3f')]));_0x5ef878[_0x1347('0x3e')]=_0x5ef878[_0x1347('0x3e')][_0x1347('0x5d')]?_0x5ef878['attributes']:_0x3cb2ff['model'];_0x5ef878['order']=qs[_0x1347('0x42')](_0xa09bc0[_0x1347('0x3a')][_0x1347('0x42')]);_0x5ef878[_0x1347('0x45')]=qs['filters'](_[_0x1347('0x43')](_0xa09bc0[_0x1347('0x3a')],_0x3cb2ff[_0x1347('0x3c')]));if(_0xa09bc0[_0x1347('0x3a')][_0x1347('0x44')]){_0x5ef878[_0x1347('0x45')]=_[_0x1347('0x50')](_0x5ef878[_0x1347('0x45')],{'$or':_[_0x1347('0x46')](_0x5ef878[_0x1347('0x3e')],function(_0x2cc302){var _0x132d95={};_0x132d95[_0x2cc302]={'$like':'%'+_0xa09bc0['query'][_0x1347('0x44')]+'%'};return _0x132d95;})});}_0x5ef878=_[_0x1347('0x50')]({},_0x5ef878,_0xa09bc0[_0x1347('0x48')]);return _0x347daf[_0x1347('0x8f')](_0x5ef878);}})[_0x1347('0x2c')](function(_0x3d57d3){if(_0x3d57d3){_0x2b1944=_0x3d57d3[_0x1347('0x5d')];if(!_0xa09bc0[_0x1347('0x3a')][_0x1347('0x5e')](_0x1347('0x40'))){_0x5ef878['limit']=qs['limit'](_0xa09bc0[_0x1347('0x3a')][_0x1347('0x27')]);_0x5ef878[_0x1347('0x25')]=qs[_0x1347('0x25')](_0xa09bc0[_0x1347('0x3a')][_0x1347('0x25')]);}return _0x347daf[_0x1347('0x8f')](_0x5ef878);}})['then'](function(_0x48b3aa){if(_0x48b3aa){return _0x48b3aa?{'count':_0x2b1944,'rows':_0x48b3aa}:null;}})[_0x1347('0x2c')](respondWithResult(_0x5640a0,null))[_0x1347('0x4b')](handleError(_0x5640a0,null));}; \ No newline at end of file +var _0xdca2=['includes','all','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','getAgents','eml-format','rimraf','fast-json-patch','request-promise','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','order','pick','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','updatedAt','createdAt','openchannelPause','getTeams','Team','addTeams','ids','voicePause','interface','flatMap','Agents','find','sequelize','transaction','each','findOrCreate','forEach','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','clone','push','QueryTypes','SELECT','every','TeamId'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0xdca2,0x118));var _0x2dca=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xdca2[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require(_0x2dca('0x0'));var rimraf=require(_0x2dca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dca('0x2'));var rp=require(_0x2dca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2dca('0x4'));var csv=require('to-csv');var ejs=require(_0x2dca('0x5'));var fs=require('fs');var fs_extra=require(_0x2dca('0x6'));var _=require(_0x2dca('0x7'));var squel=require('squel');var crypto=require(_0x2dca('0x8'));var jsforce=require(_0x2dca('0x9'));var deskjs=require(_0x2dca('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2dca('0xb'));var Redis=require(_0x2dca('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x2dca('0xd'));var as=require(_0x2dca('0xe'));var hardwareService=require(_0x2dca('0xf'));var logger=require(_0x2dca('0x10'))(_0x2dca('0x11'));var utils=require(_0x2dca('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2dca('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2dca('0x14')](config[_0x2dca('0x15')],{'host':_0x2dca('0x16'),'port':0x18eb});var socket=require(_0x2dca('0x17'))(new Redis(config['redis']));require(_0x2dca('0x18'))[_0x2dca('0x19')](socket);function respondWithStatusCode(_0x1a5e5b,_0x27852c){_0x27852c=_0x27852c||0xcc;return function(_0x4661c7){if(_0x4661c7){return _0x1a5e5b['sendStatus'](_0x27852c);}return _0x1a5e5b[_0x2dca('0x1a')](_0x27852c)[_0x2dca('0x1b')]();};}function respondWithResult(_0x3e71e8,_0x2fb075){_0x2fb075=_0x2fb075||0xc8;return function(_0x55afbd){if(_0x55afbd){return _0x3e71e8['status'](_0x2fb075)[_0x2dca('0x1c')](_0x55afbd);}};}function respondWithFilteredResult(_0x1efeb6,_0x5387c9){return function(_0x115a8d){if(_0x115a8d){var _0x5171e1=typeof _0x5387c9[_0x2dca('0x1d')]===_0x2dca('0x1e')&&typeof _0x5387c9[_0x2dca('0x1f')]==='undefined';var _0x1555d3=_0x115a8d[_0x2dca('0x20')];var _0x39b902=_0x5171e1?0x0:_0x5387c9[_0x2dca('0x1d')];var _0x47ca01=_0x5171e1?_0x115a8d[_0x2dca('0x20')]:_0x5387c9[_0x2dca('0x1d')]+_0x5387c9[_0x2dca('0x1f')];var _0x184697;if(_0x47ca01>=_0x1555d3){_0x47ca01=_0x1555d3;_0x184697=0xc8;}else{_0x184697=0xce;}_0x1efeb6[_0x2dca('0x1a')](_0x184697);return _0x1efeb6[_0x2dca('0x21')](_0x2dca('0x22'),_0x39b902+'-'+_0x47ca01+'/'+_0x1555d3)[_0x2dca('0x1c')](_0x115a8d);}return null;};}function patchUpdates(_0x241922){return function(_0x738662){try{jsonpatch[_0x2dca('0x23')](_0x738662,_0x241922,!![]);}catch(_0x14ed87){return BPromise['reject'](_0x14ed87);}return _0x738662[_0x2dca('0x24')]();};}function saveUpdates(_0x233aec,_0x401629){return function(_0x27e3df){if(_0x27e3df){return _0x27e3df[_0x2dca('0x25')](_0x233aec)[_0x2dca('0x26')](function(_0x3e422a){return _0x3e422a;});}return null;};}function removeEntity(_0x1a69f8,_0x55f704){return function(_0x55c0de){if(_0x55c0de){return _0x55c0de[_0x2dca('0x27')]()[_0x2dca('0x26')](function(){var _0x34662c=_0x55c0de[_0x2dca('0x28')]({'plain':!![]});var _0x30affc='OpenchannelQueues';return db[_0x2dca('0x29')]['destroy']({'where':{'type':_0x30affc,'resourceId':_0x34662c['id']}})[_0x2dca('0x26')](function(){return _0x55c0de;});})[_0x2dca('0x26')](function(){_0x1a69f8[_0x2dca('0x1a')](0xcc)[_0x2dca('0x1b')]();});}};}function handleEntityNotFound(_0x5600ce,_0x4ac379){return function(_0x152b82){if(!_0x152b82){_0x5600ce[_0x2dca('0x2a')](0x194);}return _0x152b82;};}function handleError(_0x428db9,_0xd7fa0c){_0xd7fa0c=_0xd7fa0c||0x1f4;return function(_0x3a1601){logger[_0x2dca('0x2b')](_0x3a1601[_0x2dca('0x2c')]);if(_0x3a1601[_0x2dca('0x2d')]){delete _0x3a1601[_0x2dca('0x2d')];}_0x428db9[_0x2dca('0x1a')](_0xd7fa0c)['send'](_0x3a1601);};}exports[_0x2dca('0x2e')]=function(_0x43aeba,_0x22767c){var _0x198d0d={},_0x5bfaa0={},_0x46bbf9={'count':0x0,'rows':[]};var _0x1968df=_[_0x2dca('0x2f')](db[_0x2dca('0x30')][_0x2dca('0x31')],function(_0x4f52a6){return{'name':_0x4f52a6[_0x2dca('0x32')],'type':_0x4f52a6[_0x2dca('0x33')][_0x2dca('0x34')]};});_0x5bfaa0[_0x2dca('0x35')]=_['map'](_0x1968df,_0x2dca('0x2d'));_0x5bfaa0[_0x2dca('0x36')]=_[_0x2dca('0x37')](_0x43aeba[_0x2dca('0x36')]);_0x5bfaa0[_0x2dca('0x38')]=_[_0x2dca('0x39')](_0x5bfaa0[_0x2dca('0x35')],_0x5bfaa0[_0x2dca('0x36')]);_0x198d0d[_0x2dca('0x3a')]=_['intersection'](_0x5bfaa0[_0x2dca('0x35')],qs[_0x2dca('0x3b')](_0x43aeba[_0x2dca('0x36')][_0x2dca('0x3b')]));_0x198d0d[_0x2dca('0x3a')]=_0x198d0d[_0x2dca('0x3a')]['length']?_0x198d0d[_0x2dca('0x3a')]:_0x5bfaa0[_0x2dca('0x35')];if(!_0x43aeba[_0x2dca('0x36')][_0x2dca('0x3c')](_0x2dca('0x3d'))){_0x198d0d['limit']=qs['limit'](_0x43aeba[_0x2dca('0x36')][_0x2dca('0x1f')]);_0x198d0d[_0x2dca('0x1d')]=qs['offset'](_0x43aeba[_0x2dca('0x36')][_0x2dca('0x1d')]);}_0x198d0d['order']=qs[_0x2dca('0x3e')](_0x43aeba[_0x2dca('0x36')][_0x2dca('0x3e')]);_0x198d0d[_0x2dca('0x3f')]=qs['filters'](_['pick'](_0x43aeba[_0x2dca('0x36')],_0x5bfaa0[_0x2dca('0x38')]),_0x1968df);if(_0x43aeba['query'][_0x2dca('0x40')]){_0x198d0d['where']=_[_0x2dca('0x41')](_0x198d0d[_0x2dca('0x3f')],{'$or':_[_0x2dca('0x2f')](_0x1968df,function(_0x1a36f3){if(_0x1a36f3[_0x2dca('0x33')]!=='VIRTUAL'){var _0x4afc2e={};_0x4afc2e[_0x1a36f3[_0x2dca('0x2d')]]={'$like':'%'+_0x43aeba[_0x2dca('0x36')][_0x2dca('0x40')]+'%'};return _0x4afc2e;}})});}_0x198d0d=_[_0x2dca('0x41')]({},_0x198d0d,_0x43aeba[_0x2dca('0x42')]);var _0x4fab39={'where':_0x198d0d[_0x2dca('0x3f')]};return db[_0x2dca('0x30')][_0x2dca('0x20')](_0x4fab39)['then'](function(_0x228d64){_0x46bbf9[_0x2dca('0x20')]=_0x228d64;if(_0x43aeba[_0x2dca('0x36')][_0x2dca('0x43')]){_0x198d0d[_0x2dca('0x44')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x198d0d);})[_0x2dca('0x26')](function(_0x56fe3e){_0x46bbf9[_0x2dca('0x45')]=_0x56fe3e;return _0x46bbf9;})[_0x2dca('0x26')](respondWithFilteredResult(_0x22767c,_0x198d0d))[_0x2dca('0x46')](handleError(_0x22767c,null));};exports[_0x2dca('0x47')]=function(_0x3c630a,_0x2f3692){var _0x5bea88={'raw':!![],'where':{'id':_0x3c630a[_0x2dca('0x48')]['id']}},_0xc3d4a9={};_0xc3d4a9['model']=_[_0x2dca('0x37')](db[_0x2dca('0x30')][_0x2dca('0x31')]);_0xc3d4a9[_0x2dca('0x36')]=_['keys'](_0x3c630a[_0x2dca('0x36')]);_0xc3d4a9[_0x2dca('0x38')]=_[_0x2dca('0x39')](_0xc3d4a9[_0x2dca('0x35')],_0xc3d4a9['query']);_0x5bea88['attributes']=_[_0x2dca('0x39')](_0xc3d4a9[_0x2dca('0x35')],qs[_0x2dca('0x3b')](_0x3c630a[_0x2dca('0x36')][_0x2dca('0x3b')]));_0x5bea88[_0x2dca('0x3a')]=_0x5bea88[_0x2dca('0x3a')][_0x2dca('0x49')]?_0x5bea88[_0x2dca('0x3a')]:_0xc3d4a9['model'];if(_0x3c630a[_0x2dca('0x36')][_0x2dca('0x43')]){_0x5bea88[_0x2dca('0x44')]=[{'all':!![]}];}_0x5bea88=_[_0x2dca('0x41')]({},_0x5bea88,_0x3c630a[_0x2dca('0x42')]);return db['OpenchannelQueue']['find'](_0x5bea88)[_0x2dca('0x26')](handleEntityNotFound(_0x2f3692,null))[_0x2dca('0x26')](respondWithResult(_0x2f3692,null))['catch'](handleError(_0x2f3692,null));};exports[_0x2dca('0x4a')]=function(_0x52d80e,_0x4047f0){return db[_0x2dca('0x30')]['create'](_0x52d80e[_0x2dca('0x4b')],{})[_0x2dca('0x26')](function(_0x3a0474){var _0x164ada=_0x52d80e[_0x2dca('0x4c')][_0x2dca('0x28')]({'plain':!![]});if(!_0x164ada)throw new Error(_0x2dca('0x4d'));if(_0x164ada[_0x2dca('0x4e')]==='user'){var _0x137e3b=_0x3a0474[_0x2dca('0x28')]({'plain':!![]});var _0x55bc06=_0x2dca('0x4f');return db[_0x2dca('0x50')]['find']({'where':{'name':_0x55bc06,'userProfileId':_0x164ada[_0x2dca('0x51')]},'raw':!![]})[_0x2dca('0x26')](function(_0xb899b8){if(_0xb899b8&&_0xb899b8['autoAssociation']===0x0){return db[_0x2dca('0x29')][_0x2dca('0x4a')]({'name':_0x137e3b[_0x2dca('0x2d')],'resourceId':_0x137e3b['id'],'type':_0xb899b8[_0x2dca('0x2d')],'sectionId':_0xb899b8['id']},{})[_0x2dca('0x26')](function(){return _0x3a0474;});}else{return _0x3a0474;}})[_0x2dca('0x46')](function(_0x1a4914){logger[_0x2dca('0x2b')](_0x2dca('0x52'),_0x1a4914);throw _0x1a4914;});}return _0x3a0474;})[_0x2dca('0x26')](respondWithResult(_0x4047f0,0xc9))[_0x2dca('0x46')](handleError(_0x4047f0,null));};exports['update']=function(_0xc2f408,_0x40d318){if(_0xc2f408[_0x2dca('0x4b')]['id']){delete _0xc2f408['body']['id'];}return db[_0x2dca('0x30')]['find']({'where':{'id':_0xc2f408[_0x2dca('0x48')]['id']}})[_0x2dca('0x26')](handleEntityNotFound(_0x40d318,null))[_0x2dca('0x26')](saveUpdates(_0xc2f408[_0x2dca('0x4b')],null))[_0x2dca('0x26')](respondWithResult(_0x40d318,null))[_0x2dca('0x46')](handleError(_0x40d318,null));};exports[_0x2dca('0x27')]=function(_0x55f062,_0x3fa624){return db[_0x2dca('0x30')]['find']({'where':{'id':_0x55f062['params']['id']}})[_0x2dca('0x26')](handleEntityNotFound(_0x3fa624,null))['then'](removeEntity(_0x3fa624,null))['catch'](handleError(_0x3fa624,null));};exports['describe']=function(_0x13896c,_0xadf6ed){return db[_0x2dca('0x30')][_0x2dca('0x53')]()[_0x2dca('0x26')](respondWithResult(_0xadf6ed,null))[_0x2dca('0x46')](handleError(_0xadf6ed,null));};exports[_0x2dca('0x54')]=function(_0x2db1a3,_0x5a17c8,_0xc11d68){var _0x47da52={'raw':!![],'where':{}},_0x34e63d={},_0x583b8e;return db['OpenchannelQueue'][_0x2dca('0x55')]({'where':{'id':_0x2db1a3[_0x2dca('0x48')]['id']}})[_0x2dca('0x26')](handleEntityNotFound(_0x5a17c8,null))[_0x2dca('0x26')](function(_0x1844f4){if(_0x1844f4){_0x583b8e=_0x1844f4['get']({'plain':!![]});_0x34e63d[_0x2dca('0x35')]=_[_0x2dca('0x37')](db[_0x2dca('0x56')][_0x2dca('0x31')]);_0x34e63d['query']=_[_0x2dca('0x37')](_0x2db1a3[_0x2dca('0x36')]);_0x34e63d[_0x2dca('0x38')]=_['intersection'](_0x34e63d[_0x2dca('0x35')],_0x34e63d['query']);_0x47da52[_0x2dca('0x3a')]=_[_0x2dca('0x39')](_0x34e63d[_0x2dca('0x35')],qs[_0x2dca('0x3b')](_0x2db1a3[_0x2dca('0x36')]['fields']));_0x47da52[_0x2dca('0x3a')]=_0x47da52[_0x2dca('0x3a')][_0x2dca('0x49')]?_0x47da52[_0x2dca('0x3a')]:_0x34e63d[_0x2dca('0x35')];if(!_0x2db1a3[_0x2dca('0x36')][_0x2dca('0x3c')](_0x2dca('0x3d'))){_0x47da52[_0x2dca('0x1f')]=qs['limit'](_0x2db1a3[_0x2dca('0x36')][_0x2dca('0x1f')]);_0x47da52['offset']=qs[_0x2dca('0x1d')](_0x2db1a3['query']['offset']);}_0x47da52[_0x2dca('0x57')]=qs['sort'](_0x2db1a3[_0x2dca('0x36')][_0x2dca('0x3e')]);_0x47da52[_0x2dca('0x3f')]=qs['filters'](_[_0x2dca('0x58')](_0x2db1a3[_0x2dca('0x36')],_0x34e63d[_0x2dca('0x38')]));_0x47da52[_0x2dca('0x3f')][_0x2dca('0x59')]=_0x1844f4['id'];if(_0x2db1a3[_0x2dca('0x36')][_0x2dca('0x40')]){_0x47da52[_0x2dca('0x3f')]=_[_0x2dca('0x41')](_0x47da52[_0x2dca('0x3f')],{'$or':_['map'](_0x47da52[_0x2dca('0x3a')],function(_0x51c040){var _0xe847a7={};_0xe847a7[_0x51c040]={'$like':'%'+_0x2db1a3['query'][_0x2dca('0x40')]+'%'};return _0xe847a7;})});}_0x47da52=_[_0x2dca('0x41')]({},_0x47da52,_0x2db1a3[_0x2dca('0x42')]);return db['UserOpenchannelQueue'][_0x2dca('0x5a')](_0x47da52);}})[_0x2dca('0x26')](function(_0x51c10a){if(_0x51c10a){return db[_0x2dca('0x5b')][_0x2dca('0x5c')]({'where':{'id':_[_0x2dca('0x2f')](_0x51c10a,_0x2dca('0x5d')),'role':'agent'},'attributes':['id',_0x2dca('0x2d'),'openchannelPause',_0x2dca('0x5e'),_0x2dca('0x5f')]});}})[_0x2dca('0x26')](function(_0x2138bb){if(_0x2138bb){return{'count':_0x2138bb['count'],'rows':_[_0x2dca('0x2f')](_0x2138bb['rows'],function(_0xbd6c0c){return{'membername':_0xbd6c0c[_0x2dca('0x2d')],'UserId':_0xbd6c0c['id'],'queue_name':_0x583b8e[_0x2dca('0x2d')],'OpenchannelQueueId':_0x583b8e['id'],'interface':util['format']('%s/%s','SIP',_0xbd6c0c[_0x2dca('0x2d')]),'penalty':0x0,'paused':_0xbd6c0c[_0x2dca('0x60')],'createdAt':_0xbd6c0c[_0x2dca('0x5f')],'updatedAt':_0xbd6c0c[_0x2dca('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2dca('0x26')](respondWithFilteredResult(_0x5a17c8,_0x47da52))[_0x2dca('0x46')](handleError(_0x5a17c8,null));};exports[_0x2dca('0x61')]=function(_0xdbd676,_0x1554f1,_0x4aa5c9){var _0x437f5a={};var _0x109d93={};var _0x2ac9a5;var _0x24ea2e;return db[_0x2dca('0x30')][_0x2dca('0x55')]({'where':{'id':_0xdbd676[_0x2dca('0x48')]['id']}})['then'](handleEntityNotFound(_0x1554f1,null))['then'](function(_0xcdaa00){if(_0xcdaa00){_0x2ac9a5=_0xcdaa00;_0x109d93[_0x2dca('0x35')]=_[_0x2dca('0x37')](db[_0x2dca('0x62')][_0x2dca('0x31')]);_0x109d93['query']=_['keys'](_0xdbd676[_0x2dca('0x36')]);_0x109d93['filters']=_['intersection'](_0x109d93[_0x2dca('0x35')],_0x109d93[_0x2dca('0x36')]);_0x437f5a[_0x2dca('0x3a')]=_['intersection'](_0x109d93[_0x2dca('0x35')],qs['fields'](_0xdbd676[_0x2dca('0x36')][_0x2dca('0x3b')]));_0x437f5a[_0x2dca('0x3a')]=_0x437f5a[_0x2dca('0x3a')]['length']?_0x437f5a[_0x2dca('0x3a')]:_0x109d93['model'];_0x437f5a[_0x2dca('0x57')]=qs[_0x2dca('0x3e')](_0xdbd676['query']['sort']);_0x437f5a[_0x2dca('0x3f')]=qs['filters'](_[_0x2dca('0x58')](_0xdbd676[_0x2dca('0x36')],_0x109d93[_0x2dca('0x38')]));if(_0xdbd676[_0x2dca('0x36')][_0x2dca('0x40')]){_0x437f5a[_0x2dca('0x3f')]=_[_0x2dca('0x41')](_0x437f5a[_0x2dca('0x3f')],{'$or':_[_0x2dca('0x2f')](_0x437f5a[_0x2dca('0x3a')],function(_0x42df59){var _0x36667f={};_0x36667f[_0x42df59]={'$like':'%'+_0xdbd676[_0x2dca('0x36')][_0x2dca('0x40')]+'%'};return _0x36667f;})});}_0x437f5a=_[_0x2dca('0x41')]({},_0x437f5a,_0xdbd676[_0x2dca('0x42')]);return _0x2ac9a5[_0x2dca('0x61')](_0x437f5a);}})['then'](function(_0x26cd37){if(_0x26cd37){_0x24ea2e=_0x26cd37[_0x2dca('0x49')];if(!_0xdbd676['query'][_0x2dca('0x3c')]('nolimit')){_0x437f5a[_0x2dca('0x1f')]=qs[_0x2dca('0x1f')](_0xdbd676['query']['limit']);_0x437f5a[_0x2dca('0x1d')]=qs[_0x2dca('0x1d')](_0xdbd676[_0x2dca('0x36')][_0x2dca('0x1d')]);}return _0x2ac9a5[_0x2dca('0x61')](_0x437f5a);}})[_0x2dca('0x26')](function(_0x24b7d0){if(_0x24b7d0){return _0x24b7d0?{'count':_0x24ea2e,'rows':_0x24b7d0}:null;}})[_0x2dca('0x26')](respondWithResult(_0x1554f1,null))[_0x2dca('0x46')](handleError(_0x1554f1,null));};exports[_0x2dca('0x63')]=function(_0x39a398,_0xa44be,_0x2769cd){var _0x38f714=_0x39a398['body'][_0x2dca('0x64')];return db[_0x2dca('0x62')][_0x2dca('0x5a')]({'where':{'id':_0x38f714},'attributes':['id'],'include':[{'model':db[_0x2dca('0x5b')],'as':'Agents','attributes':['id','name','online',_0x2dca('0x65'),_0x2dca('0x66')],'raw':!![]}]})[_0x2dca('0x26')](function(_0x45fc66){if(_0x45fc66){var _0x4dc6fd=_[_0x2dca('0x67')](_0x45fc66,function(_0x145be6){var _0x1a06b9=_0x145be6[_0x2dca('0x28')]({'plain':!![]});return _0x1a06b9[_0x2dca('0x68')];});return db[_0x2dca('0x30')][_0x2dca('0x69')]({'where':{'id':_0x39a398[_0x2dca('0x48')]['id']}})[_0x2dca('0x26')](function(_0x270a7f){return db[_0x2dca('0x6a')][_0x2dca('0x6b')](function(_0x393222){return _0x270a7f[_0x2dca('0x63')](_0x38f714,{'transaction':_0x393222})['then'](function(){return BPromise[_0x2dca('0x6c')](_0x4dc6fd,function(_0x2a9321){return db[_0x2dca('0x56')][_0x2dca('0x6d')]({'where':{'UserId':_0x2a9321['id'],'OpenchannelQueueId':_0x39a398['params']['id']},'transaction':_0x393222});});})[_0x2dca('0x26')](function(){_0x4dc6fd[_0x2dca('0x6e')](function(_0x3b1eff){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x3b1eff['id'],'OpenchannelQueueId':_0x270a7f['id']});});});});});}})[_0x2dca('0x26')](respondWithStatusCode(_0xa44be,null))[_0x2dca('0x46')](handleError(_0xa44be,null));};exports['removeTeams']=function(_0x41eb68,_0xedd556,_0x55626d){return db[_0x2dca('0x62')]['findAll']({'where':{'id':_0x41eb68[_0x2dca('0x36')][_0x2dca('0x64')]},'attributes':['id'],'include':[{'model':db[_0x2dca('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2dca('0x26')](handleEntityNotFound(_0xedd556,null))[_0x2dca('0x26')](function(_0x5b5388){var _0x1d3f79=_[_0x2dca('0x2f')](_0x5b5388,'id');var _0x5ad294=[];var _0x7923fd=[];var _0x534be9=squel['select']();_0x534be9[_0x2dca('0x6f')](_0x2dca('0x70'))[_0x2dca('0x71')](_0x2dca('0x72'),'tq')['join'](_0x2dca('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('OpenchannelQueueId\x20=\x20?',_0x41eb68[_0x2dca('0x48')]['id']);for(var _0x265eb6=0x0;_0x265eb6<_0x5b5388[_0x2dca('0x49')];_0x265eb6+=0x1){let _0x7ae072=_0x5b5388[_0x265eb6];for(var _0x1c8829=0x0;_0x1c8829<_0x7ae072[_0x2dca('0x68')][_0x2dca('0x49')];_0x1c8829+=0x1){let _0x24b42e=_0x7ae072['Agents'][_0x1c8829];var _0x36b936=_0x534be9[_0x2dca('0x74')]();_0x36b936[_0x2dca('0x3f')]('ut.UserId\x20=\x20?',_0x24b42e['id']);_0x7923fd[_0x2dca('0x75')](db['sequelize'][_0x2dca('0x36')](_0x36b936['toString'](),{'type':db[_0x2dca('0x6a')][_0x2dca('0x76')][_0x2dca('0x77')]})['then'](function(_0x162c9d){if(_0x162c9d[_0x2dca('0x49')]===0x1){return _0x24b42e['id'];}else{var _0x92d734=_[_0x2dca('0x78')](_['map'](_0x162c9d,_0x2dca('0x79')),function(_0x4c73b8){return _[_0x2dca('0x7a')](_0x1d3f79,_0x4c73b8);});if(_0x92d734){return _0x24b42e['id'];}}}));}}return BPromise[_0x2dca('0x7b')](_0x7923fd)[_0x2dca('0x26')](function(_0x1b2e5b){_0x5ad294=_(_0x5ad294)['union'](_0x1b2e5b)['compact']()[_0x2dca('0x7c')]();return db[_0x2dca('0x30')][_0x2dca('0x69')]({'where':{'id':_0x41eb68[_0x2dca('0x48')]['id']}})[_0x2dca('0x26')](function(_0x1c2e09){return db['sequelize']['transaction'](function(_0x108204){return _0x1c2e09['removeTeams'](_0x41eb68[_0x2dca('0x36')]['ids'],{'transaction':_0x108204})[_0x2dca('0x26')](function(){if(!_[_0x2dca('0x7d')](_0x5ad294)){return _0x1c2e09[_0x2dca('0x7e')](_0x5ad294,{'transaction':_0x108204});}})[_0x2dca('0x26')](function(){_0x5ad294[_0x2dca('0x6e')](function(_0xf90aaf){socket[_0x2dca('0x7f')](_0x2dca('0x80'),{'UserId':_0xf90aaf,'OpenchannelQueueId':_0x1c2e09['id']});});});});});});})[_0x2dca('0x26')](respondWithStatusCode(_0xedd556,null))['catch'](handleError(_0xedd556,null));};exports[_0x2dca('0x81')]=function(_0x4e6e40,_0x4a1ce9,_0x5a17af){return db[_0x2dca('0x30')][_0x2dca('0x69')]({'where':{'id':_0x4e6e40[_0x2dca('0x48')]['id']}})[_0x2dca('0x26')](handleEntityNotFound(_0x4a1ce9,null))[_0x2dca('0x26')](function(_0x53c11f){if(_0x53c11f){return _0x53c11f[_0x2dca('0x81')](_0x4e6e40[_0x2dca('0x4b')]['ids'],_[_0x2dca('0x82')](_0x4e6e40[_0x2dca('0x4b')],[_0x2dca('0x64'),'id'])||{})[_0x2dca('0x83')](function(_0x423b60){for(var _0x3f94eb=0x0;_0x3f94eb<_0x4e6e40[_0x2dca('0x4b')]['ids'][_0x2dca('0x49')];_0x3f94eb+=0x1){socket[_0x2dca('0x7f')](_0x2dca('0x84'),{'UserId':Number(_0x4e6e40[_0x2dca('0x4b')]['ids'][_0x3f94eb]),'OpenchannelQueueId':Number(_0x4e6e40[_0x2dca('0x48')]['id'])});}return _0x423b60;});}})[_0x2dca('0x26')](respondWithResult(_0x4a1ce9,null))[_0x2dca('0x46')](handleError(_0x4a1ce9,null));};exports[_0x2dca('0x7e')]=function(_0x47340f,_0x280a9f,_0x354121){return db[_0x2dca('0x30')][_0x2dca('0x69')]({'where':{'id':_0x47340f[_0x2dca('0x48')]['id']}})['then'](handleEntityNotFound(_0x280a9f,null))['then'](function(_0x4c3901){if(_0x4c3901){return _0x4c3901['removeAgents'](_0x47340f[_0x2dca('0x36')][_0x2dca('0x64')])[_0x2dca('0x26')](function(){if(_['isArray'](_0x47340f['query'][_0x2dca('0x64')])){for(var _0x366523=0x0;_0x366523<_0x47340f['query'][_0x2dca('0x64')]['length'];_0x366523+=0x1){socket[_0x2dca('0x7f')](_0x2dca('0x80'),{'UserId':Number(_0x47340f[_0x2dca('0x36')][_0x2dca('0x64')][_0x366523]),'OpenchannelQueueId':Number(_0x47340f[_0x2dca('0x48')]['id'])});}}else{socket[_0x2dca('0x7f')](_0x2dca('0x80'),{'UserId':Number(_0x47340f[_0x2dca('0x36')]['ids']),'OpenchannelQueueId':Number(_0x47340f[_0x2dca('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x280a9f,null))[_0x2dca('0x46')](handleError(_0x280a9f,null));};exports[_0x2dca('0x85')]=function(_0x43eea4,_0x52910a,_0x549936){var _0x59ae40={};var _0x56ca8b={};var _0x31b94f;var _0x4740a1;return db[_0x2dca('0x30')][_0x2dca('0x55')]({'where':{'id':_0x43eea4[_0x2dca('0x48')]['id']}})[_0x2dca('0x26')](handleEntityNotFound(_0x52910a,null))[_0x2dca('0x26')](function(_0x4a08fe){if(_0x4a08fe){_0x31b94f=_0x4a08fe;_0x56ca8b['model']=_[_0x2dca('0x37')](db[_0x2dca('0x5b')][_0x2dca('0x31')]);_0x56ca8b[_0x2dca('0x36')]=_['keys'](_0x43eea4['query']);_0x56ca8b[_0x2dca('0x38')]=_[_0x2dca('0x39')](_0x56ca8b['model'],_0x56ca8b['query']);_0x59ae40[_0x2dca('0x3a')]=_[_0x2dca('0x39')](_0x56ca8b[_0x2dca('0x35')],qs[_0x2dca('0x3b')](_0x43eea4[_0x2dca('0x36')][_0x2dca('0x3b')]));_0x59ae40[_0x2dca('0x3a')]=_0x59ae40[_0x2dca('0x3a')][_0x2dca('0x49')]?_0x59ae40[_0x2dca('0x3a')]:_0x56ca8b[_0x2dca('0x35')];_0x59ae40[_0x2dca('0x57')]=qs[_0x2dca('0x3e')](_0x43eea4[_0x2dca('0x36')][_0x2dca('0x3e')]);_0x59ae40[_0x2dca('0x3f')]=qs[_0x2dca('0x38')](_[_0x2dca('0x58')](_0x43eea4[_0x2dca('0x36')],_0x56ca8b[_0x2dca('0x38')]));if(_0x43eea4[_0x2dca('0x36')][_0x2dca('0x40')]){_0x59ae40[_0x2dca('0x3f')]=_['merge'](_0x59ae40[_0x2dca('0x3f')],{'$or':_[_0x2dca('0x2f')](_0x59ae40[_0x2dca('0x3a')],function(_0x37bdc6){var _0x32ead5={};_0x32ead5[_0x37bdc6]={'$like':'%'+_0x43eea4[_0x2dca('0x36')]['filter']+'%'};return _0x32ead5;})});}_0x59ae40=_['merge']({},_0x59ae40,_0x43eea4[_0x2dca('0x42')]);return _0x31b94f['getAgents'](_0x59ae40);}})[_0x2dca('0x26')](function(_0x788659){if(_0x788659){_0x4740a1=_0x788659[_0x2dca('0x49')];if(!_0x43eea4['query'][_0x2dca('0x3c')](_0x2dca('0x3d'))){_0x59ae40['limit']=qs['limit'](_0x43eea4[_0x2dca('0x36')][_0x2dca('0x1f')]);_0x59ae40[_0x2dca('0x1d')]=qs[_0x2dca('0x1d')](_0x43eea4[_0x2dca('0x36')][_0x2dca('0x1d')]);}return _0x31b94f[_0x2dca('0x85')](_0x59ae40);}})['then'](function(_0xa1195a){if(_0xa1195a){return _0xa1195a?{'count':_0x4740a1,'rows':_0xa1195a}:null;}})[_0x2dca('0x26')](respondWithResult(_0x52910a,null))[_0x2dca('0x46')](handleError(_0x52910a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index b4e5eb2..6d8651a 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 _0x04e3=['exports','events','../../mysqldb','update','emit','hasOwnProperty','hook'];(function(_0xf86b21,_0x28de07){var _0x11fb21=function(_0x57d3b1){while(--_0x57d3b1){_0xf86b21['push'](_0xf86b21['shift']());}};_0x11fb21(++_0x28de07);}(_0x04e3,0x1c8));var _0x304e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x04e3[_0xa1e3e3];return _0xc980e9;};'use strict';var EventEmitter=require(_0x304e('0x0'));var OpenchannelQueue=require(_0x304e('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x304e('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1a0f05){return function(_0x374a83,_0xf11729,_0x370262){OpenchannelQueueEvents[_0x304e('0x3')](_0x1a0f05+':'+_0x374a83['id'],_0x374a83);OpenchannelQueueEvents[_0x304e('0x3')](_0x1a0f05,_0x374a83);_0x370262(null);};}for(var e in events){if(events[_0x304e('0x4')](e)){var event=events[e];OpenchannelQueue[_0x304e('0x5')](e,emitEvent(event));}}module[_0x304e('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x3b57=['update','remove','emit','hasOwnProperty','exports','OpenchannelQueue','setMaxListeners','save'];(function(_0x501774,_0x5a76a0){var _0x6712cd=function(_0xf39c08){while(--_0xf39c08){_0x501774['push'](_0x501774['shift']());}};_0x6712cd(++_0x5a76a0);}(_0x3b57,0x1bd));var _0x73b5=function(_0x21001b,_0x3ff1a8){_0x21001b=_0x21001b-0x0;var _0x665a00=_0x3b57[_0x21001b];return _0x665a00;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x73b5('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x73b5('0x1')](0x0);var events={'afterCreate':_0x73b5('0x2'),'afterUpdate':_0x73b5('0x3'),'afterDestroy':_0x73b5('0x4')};function emitEvent(_0xe26da3){return function(_0x581c45,_0xbc245c,_0x19e39f){OpenchannelQueueEvents['emit'](_0xe26da3+':'+_0x581c45['id'],_0x581c45);OpenchannelQueueEvents[_0x73b5('0x5')](_0xe26da3,_0x581c45);_0x19e39f(null);};}for(var e in events){if(events[_0x73b5('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x73b5('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 68ab412..3a94804 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 _0xe34c=['./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x34674f,_0x53e61b){var _0x10b210=function(_0x34703c){while(--_0x34703c){_0x34674f['push'](_0x34674f['shift']());}};_0x10b210(++_0x53e61b);}(_0xe34c,0x186));var _0xce34=function(_0x3aadab,_0xb66723){_0x3aadab=_0x3aadab-0x0;var _0x25d062=_0xe34c[_0x3aadab];return _0x25d062;};'use strict';var _=require(_0xce34('0x0'));var util=require('util');var logger=require(_0xce34('0x1'))(_0xce34('0x2'));var moment=require(_0xce34('0x3'));var BPromise=require(_0xce34('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xce34('0x5'));var attributes=require(_0xce34('0x6'));module[_0xce34('0x7')]=function(_0x2aae9b,_0x3856d0){return _0x2aae9b[_0xce34('0x8')](_0xce34('0x9'),attributes,{'tableName':_0xce34('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ef1=['lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue'];(function(_0x161aba,_0x310c96){var _0x14ce2b=function(_0x55a7cf){while(--_0x55a7cf){_0x161aba['push'](_0x161aba['shift']());}};_0x14ce2b(++_0x310c96);}(_0x4ef1,0x1b0));var _0x14ef=function(_0x3ab14c,_0x4093a1){_0x3ab14c=_0x3ab14c-0x0;var _0x423753=_0x4ef1[_0x3ab14c];return _0x423753;};'use strict';var _=require(_0x14ef('0x0'));var util=require(_0x14ef('0x1'));var logger=require(_0x14ef('0x2'))('api');var moment=require('moment');var BPromise=require(_0x14ef('0x3'));var rp=require(_0x14ef('0x4'));var fs=require('fs');var path=require(_0x14ef('0x5'));var rimraf=require('rimraf');var config=require(_0x14ef('0x6'));var attributes=require(_0x14ef('0x7'));module['exports']=function(_0x8868b8,_0x23a4a0){return _0x8868b8['define'](_0x14ef('0x8'),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 41fbd19..bb580b6 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 _0xd964=['message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowOpenchannelQueue','info','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x59114f,_0x31cf70){var _0x31d907=function(_0x2d5ec3){while(--_0x2d5ec3){_0x59114f['push'](_0x59114f['shift']());}};_0x31d907(++_0x31cf70);}(_0xd964,0x178));var _0x4d96=function(_0x54c446,_0x34cbfa){_0x54c446=_0x54c446-0x0;var _0x374eeb=_0xd964[_0x54c446];return _0x374eeb;};'use strict';var _=require(_0x4d96('0x0'));var util=require(_0x4d96('0x1'));var moment=require('moment');var BPromise=require(_0x4d96('0x2'));var rs=require(_0x4d96('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d96('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d96('0x5'));var config=require(_0x4d96('0x6'));var jayson=require(_0x4d96('0x7'));var client=jayson[_0x4d96('0x8')][_0x4d96('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4d96('0xa')],{'host':_0x4d96('0xb'),'port':0x18eb});var socket=require(_0x4d96('0xc'))(new Redis(config[_0x4d96('0xa')]));require('./openchannelQueue.socket')[_0x4d96('0xd')](socket);function respondWithRpcPromise(_0xeb08c8,_0x5d82c1,_0x57ca3a){return new BPromise(function(_0x99838f,_0x5e47dc){return client['request'](_0xeb08c8,_0x57ca3a)[_0x4d96('0xe')](function(_0x28fccf){logger['info'](_0x4d96('0xf'),_0x5d82c1,'request\x20sent');logger['debug'](_0x4d96('0x10'),_0x5d82c1,_0x4d96('0x11'),JSON[_0x4d96('0x12')](_0x28fccf));if(_0x28fccf[_0x4d96('0x13')]){if(_0x28fccf[_0x4d96('0x13')]['code']===0x1f4){logger[_0x4d96('0x13')](_0x4d96('0xf'),_0x5d82c1,_0x28fccf[_0x4d96('0x13')][_0x4d96('0x14')]);return _0x5e47dc(_0x28fccf['error'][_0x4d96('0x14')]);}logger['error'](_0x4d96('0xf'),_0x5d82c1,_0x28fccf[_0x4d96('0x13')]['message']);return _0x99838f(_0x28fccf['error'][_0x4d96('0x14')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x5d82c1,_0x4d96('0x11'));_0x99838f(_0x28fccf['result'][_0x4d96('0x14')]);}})[_0x4d96('0x15')](function(_0x2306b4){logger[_0x4d96('0x13')](_0x4d96('0xf'),_0x5d82c1,_0x2306b4);_0x5e47dc(_0x2306b4);});});}exports[_0x4d96('0x16')]=function(_0x27f531){var _0x25f3a9=this;return new Promise(function(_0x52d01f,_0x5d4618){return db[_0x4d96('0x17')][_0x4d96('0x18')]({'raw':_0x27f531[_0x4d96('0x19')]?_0x27f531[_0x4d96('0x19')][_0x4d96('0x1a')]===undefined?!![]:![]:!![],'where':_0x27f531['options']?_0x27f531[_0x4d96('0x19')][_0x4d96('0x1b')]||null:null,'attributes':_0x27f531[_0x4d96('0x19')]?_0x27f531[_0x4d96('0x19')][_0x4d96('0x1c')]||null:null,'limit':_0x27f531[_0x4d96('0x19')]?_0x27f531[_0x4d96('0x19')][_0x4d96('0x1d')]||null:null,'include':_0x27f531['options']?_0x27f531[_0x4d96('0x19')][_0x4d96('0x1e')]?_['map'](_0x27f531[_0x4d96('0x19')][_0x4d96('0x1e')],function(_0x52c0bf){return{'model':db[_0x52c0bf[_0x4d96('0x1f')]],'as':_0x52c0bf['as'],'attributes':_0x52c0bf['attributes'],'include':_0x52c0bf[_0x4d96('0x1e')]?_[_0x4d96('0x20')](_0x52c0bf['include'],function(_0x5906e4){return{'model':db[_0x5906e4[_0x4d96('0x1f')]],'as':_0x5906e4['as'],'attributes':_0x5906e4[_0x4d96('0x1c')],'include':_0x5906e4[_0x4d96('0x1e')]?_['map'](_0x5906e4['include'],function(_0x43fba0){return{'model':db[_0x43fba0[_0x4d96('0x1f')]],'as':_0x43fba0['as'],'attributes':_0x43fba0['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d96('0xe')](function(_0x5ee459){logger['info']('GetOpenchannelQueue',_0x27f531);logger[_0x4d96('0x21')]('GetOpenchannelQueue',_0x27f531,JSON['stringify'](_0x5ee459));_0x52d01f(_0x5ee459);})[_0x4d96('0x15')](function(_0x5e3fdb){logger[_0x4d96('0x13')]('GetOpenchannelQueue',_0x5e3fdb[_0x4d96('0x14')],_0x27f531);_0x5d4618(_0x25f3a9[_0x4d96('0x13')](0x1f4,_0x5e3fdb[_0x4d96('0x14')]));});});};exports[_0x4d96('0x22')]=function(_0x49d321){var _0x42e00c=this;return new Promise(function(_0x4f0b83,_0xa1707d){return db[_0x4d96('0x17')]['find']({'raw':_0x49d321[_0x4d96('0x19')]?_0x49d321[_0x4d96('0x19')][_0x4d96('0x1a')]===undefined?!![]:![]:!![],'where':_0x49d321[_0x4d96('0x19')]?_0x49d321['options'][_0x4d96('0x1b')]||null:null,'attributes':_0x49d321['options']?_0x49d321[_0x4d96('0x19')][_0x4d96('0x1c')]||null:null,'include':_0x49d321[_0x4d96('0x19')]?_0x49d321[_0x4d96('0x19')]['include']?_[_0x4d96('0x20')](_0x49d321[_0x4d96('0x19')][_0x4d96('0x1e')],function(_0x84fe87){return{'model':db[_0x84fe87[_0x4d96('0x1f')]],'as':_0x84fe87['as'],'attributes':_0x84fe87[_0x4d96('0x1c')],'include':_0x84fe87[_0x4d96('0x1e')]?_[_0x4d96('0x20')](_0x84fe87['include'],function(_0x1c078a){return{'model':db[_0x1c078a[_0x4d96('0x1f')]],'as':_0x1c078a['as'],'attributes':_0x1c078a[_0x4d96('0x1c')],'include':_0x1c078a[_0x4d96('0x1e')]?_['map'](_0x1c078a[_0x4d96('0x1e')],function(_0x1b316d){return{'model':db[_0x1b316d[_0x4d96('0x1f')]],'as':_0x1b316d['as'],'attributes':_0x1b316d[_0x4d96('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b1751){logger[_0x4d96('0x23')](_0x4d96('0x22'),_0x49d321);logger['debug'](_0x4d96('0x22'),_0x49d321,JSON[_0x4d96('0x12')](_0x3b1751));_0x4f0b83(_0x3b1751);})[_0x4d96('0x15')](function(_0x7a126a){logger[_0x4d96('0x13')](_0x4d96('0x22'),_0x7a126a[_0x4d96('0x14')],_0x49d321);_0xa1707d(_0x42e00c['error'](0x1f4,_0x7a126a[_0x4d96('0x14')]));});});}; \ No newline at end of file +var _0xd1ff=['where','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','map','include','attributes','model','ShowOpenchannelQueue','find'];(function(_0x2298e9,_0x79b171){var _0x2371f8=function(_0x3d6b4b){while(--_0x3d6b4b){_0x2298e9['push'](_0x2298e9['shift']());}};_0x2371f8(++_0x79b171);}(_0xd1ff,0xc0));var _0xfd1f=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xd1ff[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require('lodash');var util=require(_0xfd1f('0x0'));var moment=require(_0xfd1f('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd1f('0x2'));var fs=require('fs');var Redis=require(_0xfd1f('0x3'));var db=require(_0xfd1f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd1f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd1f('0x6'));var client=jayson['client'][_0xfd1f('0x7')]({'port':0x232a});config[_0xfd1f('0x8')]=_['defaults'](config['redis'],{'host':_0xfd1f('0x9'),'port':0x18eb});var socket=require(_0xfd1f('0xa'))(new Redis(config[_0xfd1f('0x8')]));require(_0xfd1f('0xb'))['register'](socket);function respondWithRpcPromise(_0x3ad3cc,_0x31f7d5,_0x8c3364){return new BPromise(function(_0x32c99e,_0x53daba){return client[_0xfd1f('0xc')](_0x3ad3cc,_0x8c3364)['then'](function(_0x1c06c6){logger['info'](_0xfd1f('0xd'),_0x31f7d5,_0xfd1f('0xe'));logger[_0xfd1f('0xf')](_0xfd1f('0x10'),_0x31f7d5,_0xfd1f('0xe'),JSON[_0xfd1f('0x11')](_0x1c06c6));if(_0x1c06c6[_0xfd1f('0x12')]){if(_0x1c06c6[_0xfd1f('0x12')][_0xfd1f('0x13')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x31f7d5,_0x1c06c6[_0xfd1f('0x12')][_0xfd1f('0x14')]);return _0x53daba(_0x1c06c6['error'][_0xfd1f('0x14')]);}logger[_0xfd1f('0x12')](_0xfd1f('0xd'),_0x31f7d5,_0x1c06c6['error'][_0xfd1f('0x14')]);return _0x32c99e(_0x1c06c6['error']['message']);}else{logger[_0xfd1f('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x31f7d5,'request\x20sent');_0x32c99e(_0x1c06c6[_0xfd1f('0x16')][_0xfd1f('0x14')]);}})[_0xfd1f('0x17')](function(_0x4507ac){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x31f7d5,_0x4507ac);_0x53daba(_0x4507ac);});});}exports[_0xfd1f('0x18')]=function(_0x931477){var _0x3628ac=this;return new Promise(function(_0x178709,_0x443a51){return db[_0xfd1f('0x19')][_0xfd1f('0x1a')]({'raw':_0x931477[_0xfd1f('0x1b')]?_0x931477[_0xfd1f('0x1b')][_0xfd1f('0x1c')]===undefined?!![]:![]:!![],'where':_0x931477[_0xfd1f('0x1b')]?_0x931477['options']['where']||null:null,'attributes':_0x931477['options']?_0x931477[_0xfd1f('0x1b')]['attributes']||null:null,'limit':_0x931477['options']?_0x931477[_0xfd1f('0x1b')][_0xfd1f('0x1d')]||null:null,'include':_0x931477[_0xfd1f('0x1b')]?_0x931477[_0xfd1f('0x1b')]['include']?_[_0xfd1f('0x1e')](_0x931477[_0xfd1f('0x1b')][_0xfd1f('0x1f')],function(_0x3e3bd5){return{'model':db[_0x3e3bd5['model']],'as':_0x3e3bd5['as'],'attributes':_0x3e3bd5[_0xfd1f('0x20')],'include':_0x3e3bd5['include']?_[_0xfd1f('0x1e')](_0x3e3bd5[_0xfd1f('0x1f')],function(_0xd4d0ea){return{'model':db[_0xd4d0ea[_0xfd1f('0x21')]],'as':_0xd4d0ea['as'],'attributes':_0xd4d0ea['attributes'],'include':_0xd4d0ea[_0xfd1f('0x1f')]?_[_0xfd1f('0x1e')](_0xd4d0ea[_0xfd1f('0x1f')],function(_0x431120){return{'model':db[_0x431120[_0xfd1f('0x21')]],'as':_0x431120['as'],'attributes':_0x431120[_0xfd1f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17f509){logger[_0xfd1f('0x15')](_0xfd1f('0x18'),_0x931477);logger[_0xfd1f('0xf')](_0xfd1f('0x18'),_0x931477,JSON[_0xfd1f('0x11')](_0x17f509));_0x178709(_0x17f509);})[_0xfd1f('0x17')](function(_0x18d8cb){logger[_0xfd1f('0x12')](_0xfd1f('0x18'),_0x18d8cb[_0xfd1f('0x14')],_0x931477);_0x443a51(_0x3628ac[_0xfd1f('0x12')](0x1f4,_0x18d8cb[_0xfd1f('0x14')]));});});};exports[_0xfd1f('0x22')]=function(_0x951f36){var _0x5cd70a=this;return new Promise(function(_0x27aeac,_0xaaccd2){return db[_0xfd1f('0x19')][_0xfd1f('0x23')]({'raw':_0x951f36[_0xfd1f('0x1b')]?_0x951f36[_0xfd1f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x951f36['options']?_0x951f36[_0xfd1f('0x1b')][_0xfd1f('0x24')]||null:null,'attributes':_0x951f36[_0xfd1f('0x1b')]?_0x951f36[_0xfd1f('0x1b')]['attributes']||null:null,'include':_0x951f36['options']?_0x951f36[_0xfd1f('0x1b')]['include']?_[_0xfd1f('0x1e')](_0x951f36['options'][_0xfd1f('0x1f')],function(_0x30f373){return{'model':db[_0x30f373[_0xfd1f('0x21')]],'as':_0x30f373['as'],'attributes':_0x30f373['attributes'],'include':_0x30f373[_0xfd1f('0x1f')]?_[_0xfd1f('0x1e')](_0x30f373[_0xfd1f('0x1f')],function(_0x4071a7){return{'model':db[_0x4071a7[_0xfd1f('0x21')]],'as':_0x4071a7['as'],'attributes':_0x4071a7[_0xfd1f('0x20')],'include':_0x4071a7[_0xfd1f('0x1f')]?_[_0xfd1f('0x1e')](_0x4071a7['include'],function(_0x4a75a1){return{'model':db[_0x4a75a1[_0xfd1f('0x21')]],'as':_0x4a75a1['as'],'attributes':_0x4a75a1[_0xfd1f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfd1f('0x25')](function(_0x1f9701){logger[_0xfd1f('0x15')](_0xfd1f('0x22'),_0x951f36);logger[_0xfd1f('0xf')](_0xfd1f('0x22'),_0x951f36,JSON[_0xfd1f('0x11')](_0x1f9701));_0x27aeac(_0x1f9701);})[_0xfd1f('0x17')](function(_0x3d5106){logger[_0xfd1f('0x12')](_0xfd1f('0x22'),_0x3d5106['message'],_0x951f36);_0xaaccd2(_0x5cd70a[_0xfd1f('0x12')](0x1f4,_0x3d5106['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 59fa51d..f0ade56 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 _0xe1d2=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x28fe68,_0x39c43c){var _0x114d35=function(_0x25c68a){while(--_0x25c68a){_0x28fe68['push'](_0x28fe68['shift']());}};_0x114d35(++_0x39c43c);}(_0xe1d2,0xef));var _0x2e1d=function(_0x59d271,_0x2b11f1){_0x59d271=_0x59d271-0x0;var _0x173c27=_0xe1d2[_0x59d271];return _0x173c27;};'use strict';var OpenchannelQueueEvents=require(_0x2e1d('0x0'));var events=[_0x2e1d('0x1'),_0x2e1d('0x2'),_0x2e1d('0x3')];function createListener(_0x4673d2,_0x57d453){return function(_0x547525){_0x57d453[_0x2e1d('0x4')](_0x4673d2,_0x547525);};}function removeListener(_0x1ad18d,_0x2a543f){return function(){OpenchannelQueueEvents[_0x2e1d('0x5')](_0x1ad18d,_0x2a543f);};}exports[_0x2e1d('0x6')]=function(_0x3b9e4b){for(var _0x151cb5=0x0,_0x5f2902=events[_0x2e1d('0x7')];_0x151cb5<_0x5f2902;_0x151cb5++){var _0x419e18=events[_0x151cb5];var _0x185cff=createListener(_0x2e1d('0x8')+_0x419e18,_0x3b9e4b);OpenchannelQueueEvents['on'](_0x419e18,_0x185cff);}}; \ No newline at end of file +var _0xb9ca=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','update'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xb9ca,0x1e4));var _0xab9c=function(_0x2083fe,_0x12799f){_0x2083fe=_0x2083fe-0x0;var _0x33d6cd=_0xb9ca[_0x2083fe];return _0x33d6cd;};'use strict';var OpenchannelQueueEvents=require(_0xab9c('0x0'));var events=['save','remove',_0xab9c('0x1')];function createListener(_0x592614,_0x141916){return function(_0x3836fd){_0x141916['emit'](_0x592614,_0x3836fd);};}function removeListener(_0x1dcf3d,_0xa48cd4){return function(){OpenchannelQueueEvents[_0xab9c('0x2')](_0x1dcf3d,_0xa48cd4);};}exports[_0xab9c('0x3')]=function(_0x332f1a){for(var _0x5eb3bd=0x0,_0x452fc9=events[_0xab9c('0x4')];_0x5eb3bd<_0x452fc9;_0x5eb3bd++){var _0x5e5936=events[_0x5eb3bd];var _0x234678=createListener(_0xab9c('0x5')+_0x5e5936,_0x332f1a);OpenchannelQueueEvents['on'](_0x5e5936,_0x234678);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 20348c5..84444fc 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 _0x3c50=['connect-timeout','fs-extra','get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c50,0xc1));var _0x03c5=function(_0x269fc9,_0x56a4a7){_0x269fc9=_0x269fc9-0x0;var _0x3e1767=_0x3c50[_0x269fc9];return _0x3e1767;};'use strict';var multer=require('multer');var util=require(_0x03c5('0x0'));var path=require(_0x03c5('0x1'));var timeout=require(_0x03c5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x03c5('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0x03c5('0x4')]('/',auth['isAuthenticated'](),controller[_0x03c5('0x5')]);router[_0x03c5('0x4')]('/describe',auth[_0x03c5('0x6')](),controller[_0x03c5('0x7')]);router['get'](_0x03c5('0x8'),auth[_0x03c5('0x6')](),controller['show']);router[_0x03c5('0x9')]('/',auth[_0x03c5('0x6')](),controller[_0x03c5('0xa')]);router[_0x03c5('0xb')](_0x03c5('0x8'),auth[_0x03c5('0x6')](),controller[_0x03c5('0xc')]);router[_0x03c5('0xd')](_0x03c5('0x8'),auth[_0x03c5('0x6')](),controller[_0x03c5('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1e6c=['fs-extra','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','util','express','Router'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x1e6c,0xd4));var _0xc1e6=function(_0x29cd9e,_0x5146e1){_0x29cd9e=_0x29cd9e-0x0;var _0x53a4d3=_0x1e6c[_0x29cd9e];return _0x53a4d3;};'use strict';var multer=require(_0xc1e6('0x0'));var util=require(_0xc1e6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc1e6('0x2'));var router=express[_0xc1e6('0x3')]();var fs_extra=require(_0xc1e6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc1e6('0x5'));router[_0xc1e6('0x6')]('/',auth[_0xc1e6('0x7')](),controller[_0xc1e6('0x8')]);router[_0xc1e6('0x6')](_0xc1e6('0x9'),auth[_0xc1e6('0x7')](),controller[_0xc1e6('0xa')]);router[_0xc1e6('0x6')](_0xc1e6('0xb'),auth['isAuthenticated'](),controller[_0xc1e6('0xc')]);router[_0xc1e6('0xd')]('/',auth[_0xc1e6('0x7')](),controller[_0xc1e6('0xe')]);router[_0xc1e6('0xf')]('/:id',auth[_0xc1e6('0x7')](),controller['update']);router[_0xc1e6('0x10')](_0xc1e6('0xb'),auth[_0xc1e6('0x7')](),controller[_0xc1e6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 9231768..5581879 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 _0x351f=['sequelize','exports','STRING','DATE','moment'];(function(_0x46ea96,_0x2ada2a){var _0x23be1a=function(_0x41fe97){while(--_0x41fe97){_0x46ea96['push'](_0x46ea96['shift']());}};_0x23be1a(++_0x2ada2a);}(_0x351f,0xd6));var _0xf351=function(_0x31cf87,_0xd2156f){_0x31cf87=_0x31cf87-0x0;var _0x510a20=_0x351f[_0x31cf87];return _0x510a20;};'use strict';var moment=require(_0xf351('0x0'));var Sequelize=require(_0xf351('0x1'));module[_0xf351('0x2')]={'uniqueid':{'type':Sequelize[_0xf351('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf351('0x4')]},'leaveAt':{'type':Sequelize[_0xf351('0x4')]},'acceptAt':{'type':Sequelize[_0xf351('0x4')]},'exitAt':{'type':Sequelize[_0xf351('0x4')]},'reason':{'type':Sequelize[_0xf351('0x3')]}}; \ No newline at end of file +var _0xc46b=['moment','exports','STRING','DATE'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xc46b,0x14c));var _0xbc46=function(_0x11d478,_0x5f0872){_0x11d478=_0x11d478-0x0;var _0x4bae1b=_0xc46b[_0x11d478];return _0x4bae1b;};'use strict';var moment=require(_0xbc46('0x0'));var Sequelize=require('sequelize');module[_0xbc46('0x1')]={'uniqueid':{'type':Sequelize[_0xbc46('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbc46('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbc46('0x3')]},'exitAt':{'type':Sequelize[_0xbc46('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 fa84bf8..fef0808 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 _0x30f8=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','end','error','stack','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x30f8,0x11f));var _0x830f=function(_0x5241e1,_0x175a1c){_0x5241e1=_0x5241e1-0x0;var _0x2e45b6=_0x30f8[_0x5241e1];return _0x2e45b6;};'use strict';var emlformat=require(_0x830f('0x0'));var rimraf=require(_0x830f('0x1'));var zipdir=require(_0x830f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x830f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x830f('0x4'));var util=require(_0x830f('0x5'));var path=require(_0x830f('0x6'));var sox=require('sox');var csv=require(_0x830f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x830f('0x8'));var crypto=require(_0x830f('0x9'));var jsforce=require(_0x830f('0xa'));var deskjs=require(_0x830f('0xb'));var toCsv=require(_0x830f('0x7'));var querystring=require(_0x830f('0xc'));var Papa=require(_0x830f('0xd'));var Redis=require(_0x830f('0xe'));var authService=require(_0x830f('0xf'));var qs=require(_0x830f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x830f('0x11'));var logger=require(_0x830f('0x12'))(_0x830f('0x13'));var utils=require(_0x830f('0x14'));var config=require(_0x830f('0x15'));var licenseUtil=require(_0x830f('0x16'));var db=require(_0x830f('0x17'))['db'];function respondWithStatusCode(_0x42a5a8,_0x2e3418){_0x2e3418=_0x2e3418||0xcc;return function(_0x4cefc1){if(_0x4cefc1){return _0x42a5a8[_0x830f('0x18')](_0x2e3418);}return _0x42a5a8[_0x830f('0x19')](_0x2e3418)['end']();};}function respondWithResult(_0x51b081,_0x3a63b5){_0x3a63b5=_0x3a63b5||0xc8;return function(_0x165979){if(_0x165979){return _0x51b081[_0x830f('0x19')](_0x3a63b5)['json'](_0x165979);}};}function respondWithFilteredResult(_0x55b4d1,_0x218b22){return function(_0xb49b33){if(_0xb49b33){var _0x485992=typeof _0x218b22[_0x830f('0x1a')]===_0x830f('0x1b')&&typeof _0x218b22[_0x830f('0x1c')]==='undefined';var _0x5765ec=_0xb49b33['count'];var _0x2c3b73=_0x485992?0x0:_0x218b22[_0x830f('0x1a')];var _0x37c2de=_0x485992?_0xb49b33[_0x830f('0x1d')]:_0x218b22[_0x830f('0x1a')]+_0x218b22[_0x830f('0x1c')];var _0x473c6c;if(_0x37c2de>=_0x5765ec){_0x37c2de=_0x5765ec;_0x473c6c=0xc8;}else{_0x473c6c=0xce;}_0x55b4d1[_0x830f('0x19')](_0x473c6c);return _0x55b4d1[_0x830f('0x1e')](_0x830f('0x1f'),_0x2c3b73+'-'+_0x37c2de+'/'+_0x5765ec)[_0x830f('0x20')](_0xb49b33);}return null;};}function patchUpdates(_0x1d63c5){return function(_0x3ae6b5){try{jsonpatch[_0x830f('0x21')](_0x3ae6b5,_0x1d63c5,!![]);}catch(_0x2d6c72){return BPromise[_0x830f('0x22')](_0x2d6c72);}return _0x3ae6b5[_0x830f('0x23')]();};}function saveUpdates(_0x2c7fa7,_0x447741){return function(_0x34b7dd){if(_0x34b7dd){return _0x34b7dd['update'](_0x2c7fa7)['then'](function(_0x7bf9ee){return _0x7bf9ee;});}return null;};}function removeEntity(_0x3e22ac,_0x575947){return function(_0x45f060){if(_0x45f060){return _0x45f060[_0x830f('0x24')]()[_0x830f('0x25')](function(){_0x3e22ac[_0x830f('0x19')](0xcc)[_0x830f('0x26')]();});}};}function handleEntityNotFound(_0x645aa3,_0x294390){return function(_0x2407c8){if(!_0x2407c8){_0x645aa3['sendStatus'](0x194);}return _0x2407c8;};}function handleError(_0x1c8153,_0x38a6ae){_0x38a6ae=_0x38a6ae||0x1f4;return function(_0x38d844){logger[_0x830f('0x27')](_0x38d844[_0x830f('0x28')]);if(_0x38d844[_0x830f('0x29')]){delete _0x38d844[_0x830f('0x29')];}_0x1c8153[_0x830f('0x19')](_0x38a6ae)['send'](_0x38d844);};}exports[_0x830f('0x2a')]=function(_0xbe9aba,_0x43cdc1){var _0xbe6626={},_0x298881={},_0xd2bd4a={'count':0x0,'rows':[]};var _0x12a529=_[_0x830f('0x2b')](db['OpenchannelQueueReport'][_0x830f('0x2c')],function(_0x5bceb6){return{'name':_0x5bceb6['fieldName'],'type':_0x5bceb6[_0x830f('0x2d')][_0x830f('0x2e')]};});_0x298881['model']=_[_0x830f('0x2b')](_0x12a529,_0x830f('0x29'));_0x298881[_0x830f('0x2f')]=_[_0x830f('0x30')](_0xbe9aba[_0x830f('0x2f')]);_0x298881[_0x830f('0x31')]=_[_0x830f('0x32')](_0x298881[_0x830f('0x33')],_0x298881[_0x830f('0x2f')]);_0xbe6626['attributes']=_[_0x830f('0x32')](_0x298881[_0x830f('0x33')],qs[_0x830f('0x34')](_0xbe9aba[_0x830f('0x2f')][_0x830f('0x34')]));_0xbe6626[_0x830f('0x35')]=_0xbe6626['attributes'][_0x830f('0x36')]?_0xbe6626['attributes']:_0x298881[_0x830f('0x33')];if(!_0xbe9aba[_0x830f('0x2f')][_0x830f('0x37')](_0x830f('0x38'))){_0xbe6626[_0x830f('0x1c')]=qs[_0x830f('0x1c')](_0xbe9aba[_0x830f('0x2f')][_0x830f('0x1c')]);_0xbe6626['offset']=qs[_0x830f('0x1a')](_0xbe9aba['query'][_0x830f('0x1a')]);}_0xbe6626[_0x830f('0x39')]=qs[_0x830f('0x3a')](_0xbe9aba[_0x830f('0x2f')][_0x830f('0x3a')]);_0xbe6626['where']=qs['filters'](_['pick'](_0xbe9aba[_0x830f('0x2f')],_0x298881['filters']),_0x12a529);if(_0xbe9aba[_0x830f('0x2f')][_0x830f('0x3b')]){_0xbe6626[_0x830f('0x3c')]=_[_0x830f('0x3d')](_0xbe6626[_0x830f('0x3c')],{'$or':_[_0x830f('0x2b')](_0x12a529,function(_0x59bd96){if(_0x59bd96[_0x830f('0x2d')]!==_0x830f('0x3e')){var _0x5351b9={};_0x5351b9[_0x59bd96[_0x830f('0x29')]]={'$like':'%'+_0xbe9aba[_0x830f('0x2f')][_0x830f('0x3b')]+'%'};return _0x5351b9;}})});}_0xbe6626=_['merge']({},_0xbe6626,_0xbe9aba[_0x830f('0x3f')]);var _0x2af68c={'where':_0xbe6626[_0x830f('0x3c')]};return db[_0x830f('0x40')][_0x830f('0x1d')](_0x2af68c)['then'](function(_0x517e3b){_0xd2bd4a[_0x830f('0x1d')]=_0x517e3b;if(_0xbe9aba['query'][_0x830f('0x41')]){_0xbe6626[_0x830f('0x42')]=[{'all':!![]}];}return db[_0x830f('0x40')][_0x830f('0x43')](_0xbe6626);})[_0x830f('0x25')](function(_0x4d101b){_0xd2bd4a[_0x830f('0x44')]=_0x4d101b;return _0xd2bd4a;})['then'](respondWithFilteredResult(_0x43cdc1,_0xbe6626))[_0x830f('0x45')](handleError(_0x43cdc1,null));};exports[_0x830f('0x46')]=function(_0x1c05f6,_0x1f58e0){var _0x1976aa={'raw':!![],'where':{'id':_0x1c05f6[_0x830f('0x47')]['id']}},_0x4cbeee={};_0x4cbeee[_0x830f('0x33')]=_[_0x830f('0x30')](db[_0x830f('0x40')][_0x830f('0x2c')]);_0x4cbeee[_0x830f('0x2f')]=_['keys'](_0x1c05f6[_0x830f('0x2f')]);_0x4cbeee['filters']=_['intersection'](_0x4cbeee[_0x830f('0x33')],_0x4cbeee[_0x830f('0x2f')]);_0x1976aa['attributes']=_[_0x830f('0x32')](_0x4cbeee['model'],qs['fields'](_0x1c05f6[_0x830f('0x2f')]['fields']));_0x1976aa['attributes']=_0x1976aa['attributes']['length']?_0x1976aa[_0x830f('0x35')]:_0x4cbeee[_0x830f('0x33')];if(_0x1c05f6[_0x830f('0x2f')]['includeAll']){_0x1976aa[_0x830f('0x42')]=[{'all':!![]}];}_0x1976aa=_[_0x830f('0x3d')]({},_0x1976aa,_0x1c05f6[_0x830f('0x3f')]);return db['OpenchannelQueueReport']['find'](_0x1976aa)[_0x830f('0x25')](handleEntityNotFound(_0x1f58e0,null))[_0x830f('0x25')](respondWithResult(_0x1f58e0,null))[_0x830f('0x45')](handleError(_0x1f58e0,null));};exports[_0x830f('0x48')]=function(_0x1702da,_0x1f5e68){return db[_0x830f('0x40')]['create'](_0x1702da[_0x830f('0x49')],{})[_0x830f('0x25')](respondWithResult(_0x1f5e68,0xc9))[_0x830f('0x45')](handleError(_0x1f5e68,null));};exports['update']=function(_0x16b906,_0x1e9522){if(_0x16b906['body']['id']){delete _0x16b906[_0x830f('0x49')]['id'];}return db[_0x830f('0x40')][_0x830f('0x4a')]({'where':{'id':_0x16b906[_0x830f('0x47')]['id']}})[_0x830f('0x25')](handleEntityNotFound(_0x1e9522,null))[_0x830f('0x25')](saveUpdates(_0x16b906[_0x830f('0x49')],null))['then'](respondWithResult(_0x1e9522,null))[_0x830f('0x45')](handleError(_0x1e9522,null));};exports[_0x830f('0x24')]=function(_0x125351,_0x2cfb1d){return db[_0x830f('0x40')][_0x830f('0x4a')]({'where':{'id':_0x125351['params']['id']}})[_0x830f('0x25')](handleEntityNotFound(_0x2cfb1d,null))['then'](removeEntity(_0x2cfb1d,null))[_0x830f('0x45')](handleError(_0x2cfb1d,null));};exports['describe']=function(_0x30ee6c,_0x2cca0e){return db[_0x830f('0x40')][_0x830f('0x4b')]()[_0x830f('0x25')](respondWithResult(_0x2cca0e,null))[_0x830f('0x45')](handleError(_0x2cca0e,null));}; \ No newline at end of file +var _0x2b19=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','keys','options','find','create','body','params','destroy','describe','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b19,0x133));var _0x92b1=function(_0x536dab,_0x2adec2){_0x536dab=_0x536dab-0x0;var _0xa97fdb=_0x2b19[_0x536dab];return _0xa97fdb;};'use strict';var emlformat=require(_0x92b1('0x0'));var rimraf=require(_0x92b1('0x1'));var zipdir=require(_0x92b1('0x2'));var jsonpatch=require(_0x92b1('0x3'));var rp=require(_0x92b1('0x4'));var moment=require('moment');var BPromise=require(_0x92b1('0x5'));var Mustache=require(_0x92b1('0x6'));var util=require(_0x92b1('0x7'));var path=require('path');var sox=require(_0x92b1('0x8'));var csv=require(_0x92b1('0x9'));var ejs=require(_0x92b1('0xa'));var fs=require('fs');var fs_extra=require(_0x92b1('0xb'));var _=require(_0x92b1('0xc'));var squel=require(_0x92b1('0xd'));var crypto=require(_0x92b1('0xe'));var jsforce=require(_0x92b1('0xf'));var deskjs=require(_0x92b1('0x10'));var toCsv=require(_0x92b1('0x9'));var querystring=require(_0x92b1('0x11'));var Papa=require(_0x92b1('0x12'));var Redis=require('ioredis');var authService=require(_0x92b1('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x92b1('0x14'))(_0x92b1('0x15'));var utils=require(_0x92b1('0x16'));var config=require(_0x92b1('0x17'));var licenseUtil=require(_0x92b1('0x18'));var db=require(_0x92b1('0x19'))['db'];function respondWithStatusCode(_0x5dff2f,_0x4ad72a){_0x4ad72a=_0x4ad72a||0xcc;return function(_0x556d36){if(_0x556d36){return _0x5dff2f[_0x92b1('0x1a')](_0x4ad72a);}return _0x5dff2f[_0x92b1('0x1b')](_0x4ad72a)[_0x92b1('0x1c')]();};}function respondWithResult(_0x4c9221,_0x2a0c91){_0x2a0c91=_0x2a0c91||0xc8;return function(_0x228619){if(_0x228619){return _0x4c9221['status'](_0x2a0c91)[_0x92b1('0x1d')](_0x228619);}};}function respondWithFilteredResult(_0x68f8a2,_0x4e44eb){return function(_0x2f8107){if(_0x2f8107){var _0x306365=typeof _0x4e44eb[_0x92b1('0x1e')]===_0x92b1('0x1f')&&typeof _0x4e44eb['limit']===_0x92b1('0x1f');var _0x502028=_0x2f8107['count'];var _0x41da2e=_0x306365?0x0:_0x4e44eb['offset'];var _0x32d566=_0x306365?_0x2f8107[_0x92b1('0x20')]:_0x4e44eb['offset']+_0x4e44eb[_0x92b1('0x21')];var _0x310abd;if(_0x32d566>=_0x502028){_0x32d566=_0x502028;_0x310abd=0xc8;}else{_0x310abd=0xce;}_0x68f8a2['status'](_0x310abd);return _0x68f8a2['set'](_0x92b1('0x22'),_0x41da2e+'-'+_0x32d566+'/'+_0x502028)[_0x92b1('0x1d')](_0x2f8107);}return null;};}function patchUpdates(_0xd2bafd){return function(_0x2d6ac3){try{jsonpatch[_0x92b1('0x23')](_0x2d6ac3,_0xd2bafd,!![]);}catch(_0x438010){return BPromise[_0x92b1('0x24')](_0x438010);}return _0x2d6ac3[_0x92b1('0x25')]();};}function saveUpdates(_0x25508e,_0x401740){return function(_0x1ffa16){if(_0x1ffa16){return _0x1ffa16[_0x92b1('0x26')](_0x25508e)[_0x92b1('0x27')](function(_0x4aa121){return _0x4aa121;});}return null;};}function removeEntity(_0x5c88ea,_0x5b371b){return function(_0x2bd7ca){if(_0x2bd7ca){return _0x2bd7ca['destroy']()[_0x92b1('0x27')](function(){_0x5c88ea[_0x92b1('0x1b')](0xcc)[_0x92b1('0x1c')]();});}};}function handleEntityNotFound(_0x55bd58,_0xd90d0a){return function(_0x489a72){if(!_0x489a72){_0x55bd58[_0x92b1('0x1a')](0x194);}return _0x489a72;};}function handleError(_0x54fe16,_0x148e0c){_0x148e0c=_0x148e0c||0x1f4;return function(_0x6aaa63){logger[_0x92b1('0x28')](_0x6aaa63[_0x92b1('0x29')]);if(_0x6aaa63['name']){delete _0x6aaa63[_0x92b1('0x2a')];}_0x54fe16['status'](_0x148e0c)[_0x92b1('0x2b')](_0x6aaa63);};}exports[_0x92b1('0x2c')]=function(_0x503c4f,_0x4462df){var _0x112b10={},_0x24d525={},_0x193a32={'count':0x0,'rows':[]};var _0x578201=_[_0x92b1('0x2d')](db[_0x92b1('0x2e')][_0x92b1('0x2f')],function(_0x2fab82){return{'name':_0x2fab82[_0x92b1('0x30')],'type':_0x2fab82['type'][_0x92b1('0x31')]};});_0x24d525['model']=_[_0x92b1('0x2d')](_0x578201,'name');_0x24d525[_0x92b1('0x32')]=_['keys'](_0x503c4f[_0x92b1('0x32')]);_0x24d525['filters']=_[_0x92b1('0x33')](_0x24d525[_0x92b1('0x34')],_0x24d525[_0x92b1('0x32')]);_0x112b10[_0x92b1('0x35')]=_[_0x92b1('0x33')](_0x24d525[_0x92b1('0x34')],qs[_0x92b1('0x36')](_0x503c4f['query'][_0x92b1('0x36')]));_0x112b10[_0x92b1('0x35')]=_0x112b10['attributes'][_0x92b1('0x37')]?_0x112b10[_0x92b1('0x35')]:_0x24d525[_0x92b1('0x34')];if(!_0x503c4f[_0x92b1('0x32')]['hasOwnProperty'](_0x92b1('0x38'))){_0x112b10[_0x92b1('0x21')]=qs[_0x92b1('0x21')](_0x503c4f[_0x92b1('0x32')][_0x92b1('0x21')]);_0x112b10['offset']=qs[_0x92b1('0x1e')](_0x503c4f[_0x92b1('0x32')][_0x92b1('0x1e')]);}_0x112b10[_0x92b1('0x39')]=qs[_0x92b1('0x3a')](_0x503c4f[_0x92b1('0x32')][_0x92b1('0x3a')]);_0x112b10[_0x92b1('0x3b')]=qs[_0x92b1('0x3c')](_[_0x92b1('0x3d')](_0x503c4f[_0x92b1('0x32')],_0x24d525[_0x92b1('0x3c')]),_0x578201);if(_0x503c4f[_0x92b1('0x32')][_0x92b1('0x3e')]){_0x112b10['where']=_[_0x92b1('0x3f')](_0x112b10[_0x92b1('0x3b')],{'$or':_[_0x92b1('0x2d')](_0x578201,function(_0x56de86){if(_0x56de86['type']!==_0x92b1('0x40')){var _0x2113db={};_0x2113db[_0x56de86['name']]={'$like':'%'+_0x503c4f['query'][_0x92b1('0x3e')]+'%'};return _0x2113db;}})});}_0x112b10=_[_0x92b1('0x3f')]({},_0x112b10,_0x503c4f['options']);var _0x1a273d={'where':_0x112b10['where']};return db['OpenchannelQueueReport'][_0x92b1('0x20')](_0x1a273d)['then'](function(_0x1dfbd1){_0x193a32['count']=_0x1dfbd1;if(_0x503c4f['query'][_0x92b1('0x41')]){_0x112b10[_0x92b1('0x42')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x92b1('0x43')](_0x112b10);})[_0x92b1('0x27')](function(_0x35db7d){_0x193a32['rows']=_0x35db7d;return _0x193a32;})[_0x92b1('0x27')](respondWithFilteredResult(_0x4462df,_0x112b10))[_0x92b1('0x44')](handleError(_0x4462df,null));};exports['show']=function(_0x4c0bce,_0x38eeab){var _0x575b13={'raw':!![],'where':{'id':_0x4c0bce['params']['id']}},_0x3d0f79={};_0x3d0f79[_0x92b1('0x34')]=_[_0x92b1('0x45')](db[_0x92b1('0x2e')][_0x92b1('0x2f')]);_0x3d0f79[_0x92b1('0x32')]=_[_0x92b1('0x45')](_0x4c0bce[_0x92b1('0x32')]);_0x3d0f79['filters']=_['intersection'](_0x3d0f79[_0x92b1('0x34')],_0x3d0f79[_0x92b1('0x32')]);_0x575b13['attributes']=_[_0x92b1('0x33')](_0x3d0f79[_0x92b1('0x34')],qs['fields'](_0x4c0bce['query'][_0x92b1('0x36')]));_0x575b13[_0x92b1('0x35')]=_0x575b13['attributes'][_0x92b1('0x37')]?_0x575b13[_0x92b1('0x35')]:_0x3d0f79[_0x92b1('0x34')];if(_0x4c0bce['query']['includeAll']){_0x575b13[_0x92b1('0x42')]=[{'all':!![]}];}_0x575b13=_[_0x92b1('0x3f')]({},_0x575b13,_0x4c0bce[_0x92b1('0x46')]);return db['OpenchannelQueueReport'][_0x92b1('0x47')](_0x575b13)[_0x92b1('0x27')](handleEntityNotFound(_0x38eeab,null))[_0x92b1('0x27')](respondWithResult(_0x38eeab,null))[_0x92b1('0x44')](handleError(_0x38eeab,null));};exports[_0x92b1('0x48')]=function(_0x1622d9,_0x4f78f5){return db['OpenchannelQueueReport'][_0x92b1('0x48')](_0x1622d9['body'],{})[_0x92b1('0x27')](respondWithResult(_0x4f78f5,0xc9))[_0x92b1('0x44')](handleError(_0x4f78f5,null));};exports[_0x92b1('0x26')]=function(_0x2b9a3e,_0x595b64){if(_0x2b9a3e[_0x92b1('0x49')]['id']){delete _0x2b9a3e[_0x92b1('0x49')]['id'];}return db[_0x92b1('0x2e')][_0x92b1('0x47')]({'where':{'id':_0x2b9a3e[_0x92b1('0x4a')]['id']}})[_0x92b1('0x27')](handleEntityNotFound(_0x595b64,null))[_0x92b1('0x27')](saveUpdates(_0x2b9a3e[_0x92b1('0x49')],null))[_0x92b1('0x27')](respondWithResult(_0x595b64,null))['catch'](handleError(_0x595b64,null));};exports[_0x92b1('0x4b')]=function(_0x173808,_0x5ae0b5){return db[_0x92b1('0x2e')][_0x92b1('0x47')]({'where':{'id':_0x173808[_0x92b1('0x4a')]['id']}})[_0x92b1('0x27')](handleEntityNotFound(_0x5ae0b5,null))[_0x92b1('0x27')](removeEntity(_0x5ae0b5,null))[_0x92b1('0x44')](handleError(_0x5ae0b5,null));};exports[_0x92b1('0x4c')]=function(_0x8c772f,_0x321713){return db[_0x92b1('0x2e')][_0x92b1('0x4c')]()['then'](respondWithResult(_0x321713,null))[_0x92b1('0x44')](handleError(_0x321713,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index dc90985..1287a07 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x3c25cd,_0x167fd0){var _0x2b4b0a=function(_0x336c26){while(--_0x336c26){_0x3c25cd['push'](_0x3c25cd['shift']());}};_0x2b4b0a(++_0x167fd0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'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':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x814b,0x1a2));var _0xb814=function(_0x13ed69,_0x229161){_0x13ed69=_0x13ed69-0x0;var _0x50c72e=_0x814b[_0x13ed69];return _0x50c72e;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 5d2df68..90536a3 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 _0x531a=['catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5c619e,_0x1bccdf){var _0x445cf8=function(_0x2eaa64){while(--_0x2eaa64){_0x5c619e['push'](_0x5c619e['shift']());}};_0x445cf8(++_0x1bccdf);}(_0x531a,0x100));var _0xa531=function(_0x1fb9d2,_0x57a208){_0x1fb9d2=_0x1fb9d2-0x0;var _0x4a8916=_0x531a[_0x1fb9d2];return _0x4a8916;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var moment=require(_0xa531('0x2'));var BPromise=require(_0xa531('0x3'));var rs=require(_0xa531('0x4'));var fs=require('fs');var Redis=require(_0xa531('0x5'));var db=require(_0xa531('0x6'))['db'];var utils=require(_0xa531('0x7'));var logger=require(_0xa531('0x8'))(_0xa531('0x9'));var config=require('../../config/environment');var jayson=require(_0xa531('0xa'));var client=jayson['client'][_0xa531('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4446b9,_0x3fd172,_0x286dc7){return new BPromise(function(_0x3b68a7,_0x5bd2f9){return client[_0xa531('0xc')](_0x4446b9,_0x286dc7)[_0xa531('0xd')](function(_0x4d07e4){logger[_0xa531('0xe')](_0xa531('0xf'),_0x3fd172,_0xa531('0x10'));logger[_0xa531('0x11')](_0xa531('0x12'),_0x3fd172,'request\x20sent',JSON[_0xa531('0x13')](_0x4d07e4));if(_0x4d07e4['error']){if(_0x4d07e4[_0xa531('0x14')][_0xa531('0x15')]===0x1f4){logger[_0xa531('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x5bd2f9(_0x4d07e4['error'][_0xa531('0x16')]);}logger[_0xa531('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x3b68a7(_0x4d07e4[_0xa531('0x14')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0xa531('0x10'));_0x3b68a7(_0x4d07e4[_0xa531('0x17')][_0xa531('0x16')]);}})[_0xa531('0x18')](function(_0x324076){logger[_0xa531('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0x324076);_0x5bd2f9(_0x324076);});});}exports[_0xa531('0x19')]=function(_0x5124a1){var _0x412b84=this;return new Promise(function(_0x146013,_0x4fb62e){return db['OpenchannelQueueReport'][_0xa531('0x1a')](_0x5124a1[_0xa531('0x1b')],{'raw':_0x5124a1[_0xa531('0x1c')]?_0x5124a1['options'][_0xa531('0x1d')]===undefined?!![]:![]:!![]})[_0xa531('0xd')](function(_0x4096f0){logger['info'](_0xa531('0x19'),_0x5124a1);logger[_0xa531('0x11')]('CreateOpenchannelQueueReport',_0x5124a1,JSON[_0xa531('0x13')](_0x4096f0));_0x146013(_0x4096f0);})[_0xa531('0x18')](function(_0x3a2016){logger[_0xa531('0x14')](_0xa531('0x19'),_0x3a2016[_0xa531('0x16')],_0x5124a1);_0x4fb62e(_0x412b84[_0xa531('0x14')](0x1f4,_0x3a2016[_0xa531('0x16')]));});});};exports[_0xa531('0x1e')]=function(_0x39f640){var _0x8e9ab3=this;return new Promise(function(_0x3ac4eb,_0x57f1b3){return db[_0xa531('0x1f')][_0xa531('0x20')](_0x39f640[_0xa531('0x1b')],{'raw':_0x39f640['options']?_0x39f640[_0xa531('0x1c')][_0xa531('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39f640['options']?_0x39f640['options'][_0xa531('0x21')]||null:null,'attributes':_0x39f640['options']?_0x39f640[_0xa531('0x1c')][_0xa531('0x22')]||null:null,'limit':_0x39f640['options']?_0x39f640[_0xa531('0x1c')]['limit']||null:null})[_0xa531('0xd')](function(_0x531b8c){logger['info']('UpdateOpenchannelQueueReport',_0x39f640);logger[_0xa531('0x11')](_0xa531('0x1e'),_0x39f640,JSON['stringify'](_0x531b8c));_0x3ac4eb(_0x531b8c);})['catch'](function(_0x380cec){logger['error'](_0xa531('0x1e'),_0x380cec[_0xa531('0x16')],_0x39f640);_0x57f1b3(_0x8e9ab3['error'](0x1f4,_0x380cec[_0xa531('0x16')]));});});}; \ No newline at end of file +var _0xe820=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','update','where','attributes','limit','info','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1de364,_0x5941f2){var _0x803583=function(_0x47c1ed){while(--_0x47c1ed){_0x1de364['push'](_0x1de364['shift']());}};_0x803583(++_0x5941f2);}(_0xe820,0xd2));var _0x0e82=function(_0x2f3060,_0x14d339){_0x2f3060=_0x2f3060-0x0;var _0x20596b=_0xe820[_0x2f3060];return _0x20596b;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var moment=require(_0x0e82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e82('0x2'));var db=require(_0x0e82('0x3'))['db'];var utils=require(_0x0e82('0x4'));var logger=require('../../config/logger')(_0x0e82('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e82('0x6'));var client=jayson[_0x0e82('0x7')][_0x0e82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x328b32,_0x2a0f9b,_0x55f277){return new BPromise(function(_0x10013b,_0x33c8a2){return client[_0x0e82('0x9')](_0x328b32,_0x55f277)[_0x0e82('0xa')](function(_0x3b7792){logger['info'](_0x0e82('0xb'),_0x2a0f9b,_0x0e82('0xc'));logger[_0x0e82('0xd')](_0x0e82('0xe'),_0x2a0f9b,_0x0e82('0xc'),JSON[_0x0e82('0xf')](_0x3b7792));if(_0x3b7792[_0x0e82('0x10')]){if(_0x3b7792['error'][_0x0e82('0x11')]===0x1f4){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x3b7792[_0x0e82('0x10')][_0x0e82('0x12')]);return _0x33c8a2(_0x3b7792[_0x0e82('0x10')]['message']);}logger[_0x0e82('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2a0f9b,_0x3b7792['error'][_0x0e82('0x12')]);return _0x10013b(_0x3b7792['error']['message']);}else{logger['info'](_0x0e82('0xb'),_0x2a0f9b,'request\x20sent');_0x10013b(_0x3b7792['result'][_0x0e82('0x12')]);}})['catch'](function(_0x319303){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x319303);_0x33c8a2(_0x319303);});});}exports[_0x0e82('0x13')]=function(_0x53622b){var _0x25ac21=this;return new Promise(function(_0x310aac,_0x3a3ddf){return db[_0x0e82('0x14')][_0x0e82('0x15')](_0x53622b[_0x0e82('0x16')],{'raw':_0x53622b[_0x0e82('0x17')]?_0x53622b[_0x0e82('0x17')][_0x0e82('0x18')]===undefined?!![]:![]:!![]})[_0x0e82('0xa')](function(_0x5903c){logger['info']('CreateOpenchannelQueueReport',_0x53622b);logger[_0x0e82('0xd')](_0x0e82('0x13'),_0x53622b,JSON[_0x0e82('0xf')](_0x5903c));_0x310aac(_0x5903c);})[_0x0e82('0x19')](function(_0xd48046){logger[_0x0e82('0x10')](_0x0e82('0x13'),_0xd48046[_0x0e82('0x12')],_0x53622b);_0x3a3ddf(_0x25ac21['error'](0x1f4,_0xd48046[_0x0e82('0x12')]));});});};exports[_0x0e82('0x1a')]=function(_0x3d6c28){var _0x24f883=this;return new Promise(function(_0x507f08,_0xee85dd){return db[_0x0e82('0x14')][_0x0e82('0x1b')](_0x3d6c28[_0x0e82('0x16')],{'raw':_0x3d6c28['options']?_0x3d6c28[_0x0e82('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d6c28['options']?_0x3d6c28[_0x0e82('0x17')][_0x0e82('0x1c')]||null:null,'attributes':_0x3d6c28['options']?_0x3d6c28[_0x0e82('0x17')][_0x0e82('0x1d')]||null:null,'limit':_0x3d6c28[_0x0e82('0x17')]?_0x3d6c28['options'][_0x0e82('0x1e')]||null:null})[_0x0e82('0xa')](function(_0x4ee65a){logger[_0x0e82('0x1f')]('UpdateOpenchannelQueueReport',_0x3d6c28);logger[_0x0e82('0xd')](_0x0e82('0x1a'),_0x3d6c28,JSON['stringify'](_0x4ee65a));_0x507f08(_0x4ee65a);})[_0x0e82('0x19')](function(_0x268af5){logger[_0x0e82('0x10')]('UpdateOpenchannelQueueReport',_0x268af5['message'],_0x3d6c28);_0xee85dd(_0x24f883[_0x0e82('0x10')](0x1f4,_0x268af5['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 5762b53..72bb467 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 _0x0bc3=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','destroy'];(function(_0x22d33e,_0x4cf89f){var _0x250b0d=function(_0x208239){while(--_0x208239){_0x22d33e['push'](_0x22d33e['shift']());}};_0x250b0d(++_0x4cf89f);}(_0x0bc3,0x1c9));var _0x30bc=function(_0x5e2cc3,_0x13d2a5){_0x5e2cc3=_0x5e2cc3-0x0;var _0x5870a6=_0x0bc3[_0x5e2cc3];return _0x5870a6;};'use strict';var multer=require(_0x30bc('0x0'));var util=require(_0x30bc('0x1'));var path=require('path');var timeout=require(_0x30bc('0x2'));var express=require(_0x30bc('0x3'));var router=express[_0x30bc('0x4')]();var fs_extra=require(_0x30bc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x30bc('0x6'));var controller=require(_0x30bc('0x7'));router[_0x30bc('0x8')]('/',auth[_0x30bc('0x9')](),controller[_0x30bc('0xa')]);router['get']('/describe',auth[_0x30bc('0x9')](),controller[_0x30bc('0xb')]);router['get'](_0x30bc('0xc'),auth[_0x30bc('0x9')](),controller[_0x30bc('0xd')]);router[_0x30bc('0xe')]('/',auth[_0x30bc('0x9')](),controller[_0x30bc('0xf')]);router[_0x30bc('0x10')](_0x30bc('0xc'),auth[_0x30bc('0x9')](),controller['update']);router['delete'](_0x30bc('0xc'),auth[_0x30bc('0x9')](),controller[_0x30bc('0x11')]);module[_0x30bc('0x12')]=router; \ No newline at end of file +var _0x8aea=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','update','delete','destroy'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x8aea,0x126));var _0xa8ae=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8aea[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xa8ae('0x0'));var util=require(_0xa8ae('0x1'));var path=require(_0xa8ae('0x2'));var timeout=require(_0xa8ae('0x3'));var express=require(_0xa8ae('0x4'));var router=express['Router']();var fs_extra=require(_0xa8ae('0x5'));var auth=require(_0xa8ae('0x6'));var interaction=require(_0xa8ae('0x7'));var config=require(_0xa8ae('0x8'));var controller=require(_0xa8ae('0x9'));router[_0xa8ae('0xa')]('/',auth[_0xa8ae('0xb')](),controller[_0xa8ae('0xc')]);router[_0xa8ae('0xa')](_0xa8ae('0xd'),auth[_0xa8ae('0xb')](),controller[_0xa8ae('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa8ae('0xf')]);router[_0xa8ae('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa8ae('0x11')]('/:id',auth[_0xa8ae('0xb')](),controller[_0xa8ae('0x12')]);router[_0xa8ae('0x13')]('/:id',auth[_0xa8ae('0xb')](),controller[_0xa8ae('0x14')]);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 3b1e1e4..d1f04b9 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x4c3e5f,_0xdebb1e){var _0xf4651f=function(_0x2b679d){while(--_0x2b679d){_0x4c3e5f['push'](_0x4c3e5f['shift']());}};_0xf4651f(++_0xdebb1e);}(_0xedd9,0xfc));var _0x9edd=function(_0x3b45df,_0x1a26f3){_0x3b45df=_0x3b45df-0x0;var _0x400580=_0xedd9[_0x3b45df];return _0x400580;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x144725,_0x2ad835){var _0x516c96=function(_0x16d03c){while(--_0x16d03c){_0x144725['push'](_0x144725['shift']());}};_0x516c96(++_0x2ad835);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index e48e6a1..c682509 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 _0x41da=['includeAll','findAll','catch','show','params','length','include','options','find','create','body','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','end','error','name','index','map','OpenchannelTransferReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then'];(function(_0x233dc0,_0x2866ad){var _0x1fc160=function(_0x51e38b){while(--_0x51e38b){_0x233dc0['push'](_0x233dc0['shift']());}};_0x1fc160(++_0x2866ad);}(_0x41da,0x1e8));var _0xa41d=function(_0x3f2720,_0x39be17){_0x3f2720=_0x3f2720-0x0;var _0xe90c23=_0x41da[_0x3f2720];return _0xe90c23;};'use strict';var emlformat=require(_0xa41d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa41d('0x1'));var moment=require(_0xa41d('0x2'));var BPromise=require(_0xa41d('0x3'));var Mustache=require(_0xa41d('0x4'));var util=require(_0xa41d('0x5'));var path=require(_0xa41d('0x6'));var sox=require(_0xa41d('0x7'));var csv=require(_0xa41d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa41d('0x9'));var crypto=require('crypto');var jsforce=require(_0xa41d('0xa'));var deskjs=require(_0xa41d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa41d('0xc'));var Papa=require('papaparse');var Redis=require(_0xa41d('0xd'));var authService=require(_0xa41d('0xe'));var qs=require(_0xa41d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa41d('0x10'))('api');var utils=require(_0xa41d('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa41d('0x12'))['db'];function respondWithStatusCode(_0x58e5d5,_0xedfbc7){_0xedfbc7=_0xedfbc7||0xcc;return function(_0xc8deb8){if(_0xc8deb8){return _0x58e5d5[_0xa41d('0x13')](_0xedfbc7);}return _0x58e5d5[_0xa41d('0x14')](_0xedfbc7)['end']();};}function respondWithResult(_0x2f0c87,_0x3a1738){_0x3a1738=_0x3a1738||0xc8;return function(_0x137974){if(_0x137974){return _0x2f0c87[_0xa41d('0x14')](_0x3a1738)['json'](_0x137974);}};}function respondWithFilteredResult(_0x3999d7,_0x4ec192){return function(_0x10fdd9){if(_0x10fdd9){var _0x4ab4fe=typeof _0x4ec192[_0xa41d('0x15')]===_0xa41d('0x16')&&typeof _0x4ec192[_0xa41d('0x17')]===_0xa41d('0x16');var _0x174fbd=_0x10fdd9[_0xa41d('0x18')];var _0x106d31=_0x4ab4fe?0x0:_0x4ec192[_0xa41d('0x15')];var _0x547d75=_0x4ab4fe?_0x10fdd9[_0xa41d('0x18')]:_0x4ec192['offset']+_0x4ec192[_0xa41d('0x17')];var _0x194261;if(_0x547d75>=_0x174fbd){_0x547d75=_0x174fbd;_0x194261=0xc8;}else{_0x194261=0xce;}_0x3999d7['status'](_0x194261);return _0x3999d7[_0xa41d('0x19')](_0xa41d('0x1a'),_0x106d31+'-'+_0x547d75+'/'+_0x174fbd)['json'](_0x10fdd9);}return null;};}function patchUpdates(_0x24c1ad){return function(_0x5b7a2a){try{jsonpatch[_0xa41d('0x1b')](_0x5b7a2a,_0x24c1ad,!![]);}catch(_0x1a258d){return BPromise[_0xa41d('0x1c')](_0x1a258d);}return _0x5b7a2a[_0xa41d('0x1d')]();};}function saveUpdates(_0x2afff8,_0x582df4){return function(_0x1ec48f){if(_0x1ec48f){return _0x1ec48f['update'](_0x2afff8)['then'](function(_0x1c78b){return _0x1c78b;});}return null;};}function removeEntity(_0x5f0fcb,_0x3459e3){return function(_0x2213ea){if(_0x2213ea){return _0x2213ea[_0xa41d('0x1e')]()['then'](function(){_0x5f0fcb['status'](0xcc)[_0xa41d('0x1f')]();});}};}function handleEntityNotFound(_0x43ae17,_0x28c72f){return function(_0x41e6e4){if(!_0x41e6e4){_0x43ae17['sendStatus'](0x194);}return _0x41e6e4;};}function handleError(_0x3ba00d,_0x2c820c){_0x2c820c=_0x2c820c||0x1f4;return function(_0x1723dd){logger[_0xa41d('0x20')](_0x1723dd['stack']);if(_0x1723dd[_0xa41d('0x21')]){delete _0x1723dd[_0xa41d('0x21')];}_0x3ba00d[_0xa41d('0x14')](_0x2c820c)['send'](_0x1723dd);};}exports[_0xa41d('0x22')]=function(_0x3a9b25,_0x3cd549){var _0x577626={},_0x52010a={},_0x66e441={'count':0x0,'rows':[]};var _0x179d07=_[_0xa41d('0x23')](db[_0xa41d('0x24')][_0xa41d('0x25')],function(_0x33d33b){return{'name':_0x33d33b['fieldName'],'type':_0x33d33b[_0xa41d('0x26')]['key']};});_0x52010a[_0xa41d('0x27')]=_[_0xa41d('0x23')](_0x179d07,'name');_0x52010a['query']=_[_0xa41d('0x28')](_0x3a9b25[_0xa41d('0x29')]);_0x52010a[_0xa41d('0x2a')]=_[_0xa41d('0x2b')](_0x52010a['model'],_0x52010a[_0xa41d('0x29')]);_0x577626[_0xa41d('0x2c')]=_[_0xa41d('0x2b')](_0x52010a[_0xa41d('0x27')],qs[_0xa41d('0x2d')](_0x3a9b25['query'][_0xa41d('0x2d')]));_0x577626[_0xa41d('0x2c')]=_0x577626[_0xa41d('0x2c')]['length']?_0x577626[_0xa41d('0x2c')]:_0x52010a['model'];if(!_0x3a9b25['query'][_0xa41d('0x2e')](_0xa41d('0x2f'))){_0x577626[_0xa41d('0x17')]=qs[_0xa41d('0x17')](_0x3a9b25[_0xa41d('0x29')][_0xa41d('0x17')]);_0x577626[_0xa41d('0x15')]=qs[_0xa41d('0x15')](_0x3a9b25[_0xa41d('0x29')]['offset']);}_0x577626[_0xa41d('0x30')]=qs[_0xa41d('0x31')](_0x3a9b25[_0xa41d('0x29')][_0xa41d('0x31')]);_0x577626[_0xa41d('0x32')]=qs[_0xa41d('0x2a')](_[_0xa41d('0x33')](_0x3a9b25[_0xa41d('0x29')],_0x52010a['filters']),_0x179d07);if(_0x3a9b25['query'][_0xa41d('0x34')]){_0x577626[_0xa41d('0x32')]=_[_0xa41d('0x35')](_0x577626[_0xa41d('0x32')],{'$or':_[_0xa41d('0x23')](_0x179d07,function(_0x545942){if(_0x545942['type']!==_0xa41d('0x36')){var _0x1ff188={};_0x1ff188[_0x545942[_0xa41d('0x21')]]={'$like':'%'+_0x3a9b25[_0xa41d('0x29')]['filter']+'%'};return _0x1ff188;}})});}_0x577626=_['merge']({},_0x577626,_0x3a9b25['options']);var _0xa63cc5={'where':_0x577626[_0xa41d('0x32')]};return db[_0xa41d('0x24')]['count'](_0xa63cc5)[_0xa41d('0x37')](function(_0x5ecb95){_0x66e441['count']=_0x5ecb95;if(_0x3a9b25['query'][_0xa41d('0x38')]){_0x577626['include']=[{'all':!![]}];}return db[_0xa41d('0x24')][_0xa41d('0x39')](_0x577626);})['then'](function(_0x1195c5){_0x66e441['rows']=_0x1195c5;return _0x66e441;})[_0xa41d('0x37')](respondWithFilteredResult(_0x3cd549,_0x577626))[_0xa41d('0x3a')](handleError(_0x3cd549,null));};exports[_0xa41d('0x3b')]=function(_0x44edbd,_0x354e96){var _0xed5b5d={'raw':!![],'where':{'id':_0x44edbd[_0xa41d('0x3c')]['id']}},_0x18a841={};_0x18a841[_0xa41d('0x27')]=_[_0xa41d('0x28')](db[_0xa41d('0x24')][_0xa41d('0x25')]);_0x18a841[_0xa41d('0x29')]=_[_0xa41d('0x28')](_0x44edbd['query']);_0x18a841['filters']=_['intersection'](_0x18a841[_0xa41d('0x27')],_0x18a841[_0xa41d('0x29')]);_0xed5b5d['attributes']=_[_0xa41d('0x2b')](_0x18a841[_0xa41d('0x27')],qs[_0xa41d('0x2d')](_0x44edbd[_0xa41d('0x29')][_0xa41d('0x2d')]));_0xed5b5d['attributes']=_0xed5b5d[_0xa41d('0x2c')][_0xa41d('0x3d')]?_0xed5b5d['attributes']:_0x18a841[_0xa41d('0x27')];if(_0x44edbd[_0xa41d('0x29')]['includeAll']){_0xed5b5d[_0xa41d('0x3e')]=[{'all':!![]}];}_0xed5b5d=_[_0xa41d('0x35')]({},_0xed5b5d,_0x44edbd[_0xa41d('0x3f')]);return db['OpenchannelTransferReport'][_0xa41d('0x40')](_0xed5b5d)[_0xa41d('0x37')](handleEntityNotFound(_0x354e96,null))[_0xa41d('0x37')](respondWithResult(_0x354e96,null))['catch'](handleError(_0x354e96,null));};exports[_0xa41d('0x41')]=function(_0x31cbf1,_0x3d1ada){return db[_0xa41d('0x24')][_0xa41d('0x41')](_0x31cbf1[_0xa41d('0x42')],{})['then'](respondWithResult(_0x3d1ada,0xc9))['catch'](handleError(_0x3d1ada,null));};exports['update']=function(_0xb774d,_0x275db6){if(_0xb774d[_0xa41d('0x42')]['id']){delete _0xb774d[_0xa41d('0x42')]['id'];}return db[_0xa41d('0x24')]['find']({'where':{'id':_0xb774d['params']['id']}})[_0xa41d('0x37')](handleEntityNotFound(_0x275db6,null))[_0xa41d('0x37')](saveUpdates(_0xb774d[_0xa41d('0x42')],null))['then'](respondWithResult(_0x275db6,null))[_0xa41d('0x3a')](handleError(_0x275db6,null));};exports[_0xa41d('0x1e')]=function(_0x15cec6,_0x19d2e1){return db[_0xa41d('0x24')]['find']({'where':{'id':_0x15cec6[_0xa41d('0x3c')]['id']}})[_0xa41d('0x37')](handleEntityNotFound(_0x19d2e1,null))[_0xa41d('0x37')](removeEntity(_0x19d2e1,null))[_0xa41d('0x3a')](handleError(_0x19d2e1,null));};exports[_0xa41d('0x43')]=function(_0x1ee80f,_0x42829a){return db[_0xa41d('0x24')][_0xa41d('0x43')]()[_0xa41d('0x37')](respondWithResult(_0x42829a,null))[_0xa41d('0x3a')](handleError(_0x42829a,null));}; \ No newline at end of file +var _0x3a6b=['end','offset','undefined','count','set','json','apply','reject','save','update','then','destroy','error','stack','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x93a28a,_0x506b38){var _0x17034e=function(_0x42a244){while(--_0x42a244){_0x93a28a['push'](_0x93a28a['shift']());}};_0x17034e(++_0x506b38);}(_0x3a6b,0xcb));var _0xb3a6=function(_0x226c96,_0x4ca425){_0x226c96=_0x226c96-0x0;var _0x531e12=_0x3a6b[_0x226c96];return _0x531e12;};'use strict';var emlformat=require(_0xb3a6('0x0'));var rimraf=require(_0xb3a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3a6('0x2'));var rp=require(_0xb3a6('0x3'));var moment=require(_0xb3a6('0x4'));var BPromise=require(_0xb3a6('0x5'));var Mustache=require(_0xb3a6('0x6'));var util=require('util');var path=require(_0xb3a6('0x7'));var sox=require(_0xb3a6('0x8'));var csv=require(_0xb3a6('0x9'));var ejs=require(_0xb3a6('0xa'));var fs=require('fs');var fs_extra=require(_0xb3a6('0xb'));var _=require(_0xb3a6('0xc'));var squel=require('squel');var crypto=require(_0xb3a6('0xd'));var jsforce=require(_0xb3a6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb3a6('0x9'));var querystring=require(_0xb3a6('0xf'));var Papa=require(_0xb3a6('0x10'));var Redis=require(_0xb3a6('0x11'));var authService=require(_0xb3a6('0x12'));var qs=require(_0xb3a6('0x13'));var as=require(_0xb3a6('0x14'));var hardwareService=require(_0xb3a6('0x15'));var logger=require(_0xb3a6('0x16'))(_0xb3a6('0x17'));var utils=require(_0xb3a6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb3a6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26bcab,_0x263b51){_0x263b51=_0x263b51||0xcc;return function(_0x270d78){if(_0x270d78){return _0x26bcab[_0xb3a6('0x1a')](_0x263b51);}return _0x26bcab[_0xb3a6('0x1b')](_0x263b51)[_0xb3a6('0x1c')]();};}function respondWithResult(_0x272787,_0x59578c){_0x59578c=_0x59578c||0xc8;return function(_0x51583a){if(_0x51583a){return _0x272787[_0xb3a6('0x1b')](_0x59578c)['json'](_0x51583a);}};}function respondWithFilteredResult(_0x520ebf,_0x374d3a){return function(_0x3baa0b){if(_0x3baa0b){var _0x3c281b=typeof _0x374d3a[_0xb3a6('0x1d')]==='undefined'&&typeof _0x374d3a['limit']===_0xb3a6('0x1e');var _0x30951f=_0x3baa0b[_0xb3a6('0x1f')];var _0x3c29a7=_0x3c281b?0x0:_0x374d3a['offset'];var _0xd5e8ff=_0x3c281b?_0x3baa0b[_0xb3a6('0x1f')]:_0x374d3a[_0xb3a6('0x1d')]+_0x374d3a['limit'];var _0x497a20;if(_0xd5e8ff>=_0x30951f){_0xd5e8ff=_0x30951f;_0x497a20=0xc8;}else{_0x497a20=0xce;}_0x520ebf[_0xb3a6('0x1b')](_0x497a20);return _0x520ebf[_0xb3a6('0x20')]('Content-Range',_0x3c29a7+'-'+_0xd5e8ff+'/'+_0x30951f)[_0xb3a6('0x21')](_0x3baa0b);}return null;};}function patchUpdates(_0xfcf87f){return function(_0x1710a0){try{jsonpatch[_0xb3a6('0x22')](_0x1710a0,_0xfcf87f,!![]);}catch(_0x34b3d3){return BPromise[_0xb3a6('0x23')](_0x34b3d3);}return _0x1710a0[_0xb3a6('0x24')]();};}function saveUpdates(_0x271f02,_0x44bee6){return function(_0x161920){if(_0x161920){return _0x161920[_0xb3a6('0x25')](_0x271f02)[_0xb3a6('0x26')](function(_0x914da){return _0x914da;});}return null;};}function removeEntity(_0x3c8aca,_0xc029f7){return function(_0x22180d){if(_0x22180d){return _0x22180d[_0xb3a6('0x27')]()['then'](function(){_0x3c8aca[_0xb3a6('0x1b')](0xcc)[_0xb3a6('0x1c')]();});}};}function handleEntityNotFound(_0x5bd6f1,_0x1601e6){return function(_0x104ca6){if(!_0x104ca6){_0x5bd6f1[_0xb3a6('0x1a')](0x194);}return _0x104ca6;};}function handleError(_0x333277,_0x5dcaaa){_0x5dcaaa=_0x5dcaaa||0x1f4;return function(_0x597db5){logger[_0xb3a6('0x28')](_0x597db5[_0xb3a6('0x29')]);if(_0x597db5['name']){delete _0x597db5['name'];}_0x333277[_0xb3a6('0x1b')](_0x5dcaaa)[_0xb3a6('0x2a')](_0x597db5);};}exports[_0xb3a6('0x2b')]=function(_0x1a1b45,_0x36821a){var _0x3e297a={},_0x1130ff={},_0xdce5ee={'count':0x0,'rows':[]};var _0x1beeab=_[_0xb3a6('0x2c')](db[_0xb3a6('0x2d')][_0xb3a6('0x2e')],function(_0x1c929c){return{'name':_0x1c929c[_0xb3a6('0x2f')],'type':_0x1c929c[_0xb3a6('0x30')]['key']};});_0x1130ff[_0xb3a6('0x31')]=_[_0xb3a6('0x2c')](_0x1beeab,'name');_0x1130ff['query']=_[_0xb3a6('0x32')](_0x1a1b45[_0xb3a6('0x33')]);_0x1130ff['filters']=_[_0xb3a6('0x34')](_0x1130ff[_0xb3a6('0x31')],_0x1130ff[_0xb3a6('0x33')]);_0x3e297a[_0xb3a6('0x35')]=_[_0xb3a6('0x34')](_0x1130ff[_0xb3a6('0x31')],qs[_0xb3a6('0x36')](_0x1a1b45['query'][_0xb3a6('0x36')]));_0x3e297a[_0xb3a6('0x35')]=_0x3e297a['attributes'][_0xb3a6('0x37')]?_0x3e297a[_0xb3a6('0x35')]:_0x1130ff['model'];if(!_0x1a1b45[_0xb3a6('0x33')][_0xb3a6('0x38')](_0xb3a6('0x39'))){_0x3e297a[_0xb3a6('0x3a')]=qs[_0xb3a6('0x3a')](_0x1a1b45[_0xb3a6('0x33')][_0xb3a6('0x3a')]);_0x3e297a[_0xb3a6('0x1d')]=qs[_0xb3a6('0x1d')](_0x1a1b45[_0xb3a6('0x33')]['offset']);}_0x3e297a[_0xb3a6('0x3b')]=qs[_0xb3a6('0x3c')](_0x1a1b45[_0xb3a6('0x33')][_0xb3a6('0x3c')]);_0x3e297a[_0xb3a6('0x3d')]=qs[_0xb3a6('0x3e')](_['pick'](_0x1a1b45[_0xb3a6('0x33')],_0x1130ff[_0xb3a6('0x3e')]),_0x1beeab);if(_0x1a1b45[_0xb3a6('0x33')][_0xb3a6('0x3f')]){_0x3e297a['where']=_[_0xb3a6('0x40')](_0x3e297a[_0xb3a6('0x3d')],{'$or':_[_0xb3a6('0x2c')](_0x1beeab,function(_0x107bb7){if(_0x107bb7[_0xb3a6('0x30')]!==_0xb3a6('0x41')){var _0x4d7997={};_0x4d7997[_0x107bb7['name']]={'$like':'%'+_0x1a1b45[_0xb3a6('0x33')][_0xb3a6('0x3f')]+'%'};return _0x4d7997;}})});}_0x3e297a=_[_0xb3a6('0x40')]({},_0x3e297a,_0x1a1b45[_0xb3a6('0x42')]);var _0x448d37={'where':_0x3e297a['where']};return db[_0xb3a6('0x2d')][_0xb3a6('0x1f')](_0x448d37)[_0xb3a6('0x26')](function(_0x57fb21){_0xdce5ee['count']=_0x57fb21;if(_0x1a1b45['query'][_0xb3a6('0x43')]){_0x3e297a['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xb3a6('0x44')](_0x3e297a);})[_0xb3a6('0x26')](function(_0x5be55d){_0xdce5ee['rows']=_0x5be55d;return _0xdce5ee;})['then'](respondWithFilteredResult(_0x36821a,_0x3e297a))[_0xb3a6('0x45')](handleError(_0x36821a,null));};exports[_0xb3a6('0x46')]=function(_0x499f90,_0xce529a){var _0x5f5100={'raw':!![],'where':{'id':_0x499f90[_0xb3a6('0x47')]['id']}},_0xb2b223={};_0xb2b223[_0xb3a6('0x31')]=_[_0xb3a6('0x32')](db[_0xb3a6('0x2d')]['rawAttributes']);_0xb2b223[_0xb3a6('0x33')]=_['keys'](_0x499f90['query']);_0xb2b223[_0xb3a6('0x3e')]=_['intersection'](_0xb2b223[_0xb3a6('0x31')],_0xb2b223['query']);_0x5f5100['attributes']=_['intersection'](_0xb2b223[_0xb3a6('0x31')],qs[_0xb3a6('0x36')](_0x499f90[_0xb3a6('0x33')][_0xb3a6('0x36')]));_0x5f5100[_0xb3a6('0x35')]=_0x5f5100[_0xb3a6('0x35')][_0xb3a6('0x37')]?_0x5f5100[_0xb3a6('0x35')]:_0xb2b223['model'];if(_0x499f90[_0xb3a6('0x33')]['includeAll']){_0x5f5100[_0xb3a6('0x48')]=[{'all':!![]}];}_0x5f5100=_['merge']({},_0x5f5100,_0x499f90[_0xb3a6('0x42')]);return db[_0xb3a6('0x2d')][_0xb3a6('0x49')](_0x5f5100)[_0xb3a6('0x26')](handleEntityNotFound(_0xce529a,null))[_0xb3a6('0x26')](respondWithResult(_0xce529a,null))[_0xb3a6('0x45')](handleError(_0xce529a,null));};exports['create']=function(_0xbbc14a,_0x423fd7){return db[_0xb3a6('0x2d')][_0xb3a6('0x4a')](_0xbbc14a[_0xb3a6('0x4b')],{})[_0xb3a6('0x26')](respondWithResult(_0x423fd7,0xc9))[_0xb3a6('0x45')](handleError(_0x423fd7,null));};exports[_0xb3a6('0x25')]=function(_0x125a07,_0x3c79e6){if(_0x125a07[_0xb3a6('0x4b')]['id']){delete _0x125a07['body']['id'];}return db['OpenchannelTransferReport'][_0xb3a6('0x49')]({'where':{'id':_0x125a07[_0xb3a6('0x47')]['id']}})[_0xb3a6('0x26')](handleEntityNotFound(_0x3c79e6,null))[_0xb3a6('0x26')](saveUpdates(_0x125a07[_0xb3a6('0x4b')],null))[_0xb3a6('0x26')](respondWithResult(_0x3c79e6,null))[_0xb3a6('0x45')](handleError(_0x3c79e6,null));};exports['destroy']=function(_0x50b673,_0x289eba){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x50b673[_0xb3a6('0x47')]['id']}})['then'](handleEntityNotFound(_0x289eba,null))['then'](removeEntity(_0x289eba,null))[_0xb3a6('0x45')](handleError(_0x289eba,null));};exports[_0xb3a6('0x4c')]=function(_0x25ca9a,_0x4df48d){return db[_0xb3a6('0x2d')][_0xb3a6('0x4c')]()[_0xb3a6('0x26')](respondWithResult(_0x4df48d,null))[_0xb3a6('0x45')](handleError(_0x4df48d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1c6d1a5..bcceef2 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 _0xab78=['lodash','util','api','moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x4fbc9f,_0x1ba070){var _0x205885=function(_0x1765d9){while(--_0x1765d9){_0x4fbc9f['push'](_0x4fbc9f['shift']());}};_0x205885(++_0x1ba070);}(_0xab78,0xea));var _0x8ab7=function(_0x30fc5d,_0x53b502){_0x30fc5d=_0x30fc5d-0x0;var _0x4d881a=_0xab78[_0x30fc5d];return _0x4d881a;};'use strict';var _=require(_0x8ab7('0x0'));var util=require(_0x8ab7('0x1'));var logger=require('../../config/logger')(_0x8ab7('0x2'));var moment=require(_0x8ab7('0x3'));var BPromise=require(_0x8ab7('0x4'));var rp=require(_0x8ab7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ab7('0x6'));var config=require('../../config/environment');var attributes=require(_0x8ab7('0x7'));module[_0x8ab7('0x8')]=function(_0x4c4c3c,_0x4c244f){return _0x4c4c3c[_0x8ab7('0x9')](_0x8ab7('0xa'),attributes,{'tableName':_0x8ab7('0xb'),'paranoid':![],'indexes':[{'name':_0x8ab7('0xc'),'fields':[_0x8ab7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa16a=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x116978,_0x20d795){var _0x48ebe1=function(_0x6ce5f6){while(--_0x6ce5f6){_0x116978['push'](_0x116978['shift']());}};_0x48ebe1(++_0x20d795);}(_0xa16a,0xed));var _0xaa16=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0xa16a[_0x263f4c];return _0x3a78d3;};'use strict';var _=require(_0xaa16('0x0'));var util=require(_0xaa16('0x1'));var logger=require(_0xaa16('0x2'))(_0xaa16('0x3'));var moment=require('moment');var BPromise=require(_0xaa16('0x4'));var rp=require(_0xaa16('0x5'));var fs=require('fs');var path=require(_0xaa16('0x6'));var rimraf=require('rimraf');var config=require(_0xaa16('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0xaa16('0x8')]=function(_0x2e852b,_0x5bb4e8){return _0x2e852b[_0xaa16('0x9')](_0xaa16('0xa'),attributes,{'tableName':_0xaa16('0xb'),'paranoid':![],'indexes':[{'name':_0xaa16('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 2ba0d7b..ab28be2 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 _0x7fbe=['request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3839f5,_0x98f186){var _0x4c86fe=function(_0x4855ca){while(--_0x4855ca){_0x3839f5['push'](_0x3839f5['shift']());}};_0x4c86fe(++_0x98f186);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xba1076,_0x130e38){_0xba1076=_0xba1076-0x0;var _0x4e9ea4=_0x7fbe[_0xba1076];return _0x4e9ea4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x1501=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x1dd49e,_0x176c7d){var _0x35c6ac=function(_0x17fcd4){while(--_0x17fcd4){_0x1dd49e['push'](_0x1dd49e['shift']());}};_0x35c6ac(++_0x176c7d);}(_0x1501,0x126));var _0x1150=function(_0x224a6b,_0x3e57fb){_0x224a6b=_0x224a6b-0x0;var _0x50e049=_0x1501[_0x224a6b];return _0x50e049;};'use strict';var _=require('lodash');var util=require(_0x1150('0x0'));var moment=require(_0x1150('0x1'));var BPromise=require(_0x1150('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1150('0x3'));var db=require(_0x1150('0x4'))['db'];var utils=require(_0x1150('0x5'));var logger=require(_0x1150('0x6'))('rpc');var config=require(_0x1150('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1150('0x8')][_0x1150('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc391,_0x131b49,_0x24340c){return new BPromise(function(_0x321d80,_0x2da67d){return client['request'](_0x2fc391,_0x24340c)['then'](function(_0x22d26c){logger[_0x1150('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x131b49,'request\x20sent');logger[_0x1150('0xb')](_0x1150('0xc'),_0x131b49,_0x1150('0xd'),JSON[_0x1150('0xe')](_0x22d26c));if(_0x22d26c['error']){if(_0x22d26c[_0x1150('0xf')][_0x1150('0x10')]===0x1f4){logger['error'](_0x1150('0x11'),_0x131b49,_0x22d26c['error'][_0x1150('0x12')]);return _0x2da67d(_0x22d26c[_0x1150('0xf')][_0x1150('0x12')]);}logger[_0x1150('0xf')](_0x1150('0x11'),_0x131b49,_0x22d26c[_0x1150('0xf')][_0x1150('0x12')]);return _0x321d80(_0x22d26c[_0x1150('0xf')]['message']);}else{logger['info'](_0x1150('0x11'),_0x131b49,_0x1150('0xd'));_0x321d80(_0x22d26c[_0x1150('0x13')][_0x1150('0x12')]);}})[_0x1150('0x14')](function(_0x1a8b62){logger[_0x1150('0xf')](_0x1150('0x11'),_0x131b49,_0x1a8b62);_0x2da67d(_0x1a8b62);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index da76029..e96eff2 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 _0x3d0a=['update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','show','create','/:id'];(function(_0x538ecb,_0xe7f7d3){var _0x3a7683=function(_0x67b81d){while(--_0x67b81d){_0x538ecb['push'](_0x538ecb['shift']());}};_0x3a7683(++_0xe7f7d3);}(_0x3d0a,0xa9));var _0xa3d0=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x3d0a[_0x485b5a];return _0xd2b34d;};'use strict';var multer=require(_0xa3d0('0x0'));var util=require('util');var path=require(_0xa3d0('0x1'));var timeout=require(_0xa3d0('0x2'));var express=require(_0xa3d0('0x3'));var router=express[_0xa3d0('0x4')]();var fs_extra=require(_0xa3d0('0x5'));var auth=require(_0xa3d0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./pause.controller');router['get']('/',auth[_0xa3d0('0x7')](),controller[_0xa3d0('0x8')]);router[_0xa3d0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa3d0('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa3d0('0xb')]);router['put'](_0xa3d0('0xc'),auth['isAuthenticated'](),controller[_0xa3d0('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x333c=['../../config/environment','isAuthenticated','index','get','/:id','post','create','put','delete','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x347191,_0x37dd7a){var _0x3c97fa=function(_0x3c42da){while(--_0x3c42da){_0x347191['push'](_0x347191['shift']());}};_0x3c97fa(++_0x37dd7a);}(_0x333c,0xbf));var _0xc333=function(_0x4d7006,_0x4d6719){_0x4d7006=_0x4d7006-0x0;var _0x83ed70=_0x333c[_0x4d7006];return _0x83ed70;};'use strict';var multer=require(_0xc333('0x0'));var util=require(_0xc333('0x1'));var path=require('path');var timeout=require(_0xc333('0x2'));var express=require(_0xc333('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc333('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc333('0x5'));var controller=require('./pause.controller');router['get']('/',auth[_0xc333('0x6')](),controller[_0xc333('0x7')]);router[_0xc333('0x8')](_0xc333('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc333('0xa')]('/',auth['isAuthenticated'](),controller[_0xc333('0xb')]);router[_0xc333('0xc')](_0xc333('0x9'),auth[_0xc333('0x6')](),controller['update']);router[_0xc333('0xd')](_0xc333('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 52419bb..37cb4f2 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 _0xb3a9=['sequelize','exports','STRING'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xb3a9,0x168));var _0x9b3a=function(_0x340fae,_0x4778b2){_0x340fae=_0x340fae-0x0;var _0x42e12a=_0xb3a9[_0x340fae];return _0x42e12a;};'use strict';var Sequelize=require(_0x9b3a('0x0'));module[_0x9b3a('0x1')]={'name':{'type':Sequelize[_0x9b3a('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9b3a('0x2')]}}; \ No newline at end of file +var _0xe236=['STRING','sequelize','exports'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xe236,0xc1));var _0x6e23=function(_0x1f4b18,_0x4e777c){_0x1f4b18=_0x1f4b18-0x0;var _0xde3957=_0xe236[_0x1f4b18];return _0xde3957;};'use strict';var Sequelize=require(_0x6e23('0x0'));module[_0x6e23('0x1')]={'name':{'type':Sequelize[_0x6e23('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6e23('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index dab616b..125d310 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 _0x697a=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','map','Pause','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x750d82,_0x31dc2b){var _0x4c1089=function(_0x385e9b){while(--_0x385e9b){_0x750d82['push'](_0x750d82['shift']());}};_0x4c1089(++_0x31dc2b);}(_0x697a,0x198));var _0xa697=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x697a[_0x3b231a];return _0x18d67a;};'use strict';var emlformat=require(_0xa697('0x0'));var rimraf=require(_0xa697('0x1'));var zipdir=require(_0xa697('0x2'));var jsonpatch=require(_0xa697('0x3'));var rp=require(_0xa697('0x4'));var moment=require('moment');var BPromise=require(_0xa697('0x5'));var Mustache=require('mustache');var util=require(_0xa697('0x6'));var path=require(_0xa697('0x7'));var sox=require(_0xa697('0x8'));var csv=require(_0xa697('0x9'));var ejs=require(_0xa697('0xa'));var fs=require('fs');var fs_extra=require(_0xa697('0xb'));var _=require(_0xa697('0xc'));var squel=require(_0xa697('0xd'));var crypto=require(_0xa697('0xe'));var jsforce=require(_0xa697('0xf'));var deskjs=require(_0xa697('0x10'));var toCsv=require(_0xa697('0x9'));var querystring=require('querystring');var Papa=require(_0xa697('0x11'));var Redis=require(_0xa697('0x12'));var authService=require(_0xa697('0x13'));var qs=require(_0xa697('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa697('0x15'))(_0xa697('0x16'));var utils=require(_0xa697('0x17'));var config=require(_0xa697('0x18'));var licenseUtil=require(_0xa697('0x19'));var db=require(_0xa697('0x1a'))['db'];function respondWithStatusCode(_0x1ee994,_0x1377c3){_0x1377c3=_0x1377c3||0xcc;return function(_0x5727d4){if(_0x5727d4){return _0x1ee994['sendStatus'](_0x1377c3);}return _0x1ee994[_0xa697('0x1b')](_0x1377c3)[_0xa697('0x1c')]();};}function respondWithResult(_0x3053b1,_0x3c94c0){_0x3c94c0=_0x3c94c0||0xc8;return function(_0x564fae){if(_0x564fae){return _0x3053b1['status'](_0x3c94c0)[_0xa697('0x1d')](_0x564fae);}};}function respondWithFilteredResult(_0x2a971c,_0x3ccf6c){return function(_0x158024){if(_0x158024){var _0x351276=typeof _0x3ccf6c[_0xa697('0x1e')]===_0xa697('0x1f')&&typeof _0x3ccf6c[_0xa697('0x20')]===_0xa697('0x1f');var _0x2622ae=_0x158024[_0xa697('0x21')];var _0x23738b=_0x351276?0x0:_0x3ccf6c['offset'];var _0x5a40b3=_0x351276?_0x158024[_0xa697('0x21')]:_0x3ccf6c[_0xa697('0x1e')]+_0x3ccf6c[_0xa697('0x20')];var _0xe750c1;if(_0x5a40b3>=_0x2622ae){_0x5a40b3=_0x2622ae;_0xe750c1=0xc8;}else{_0xe750c1=0xce;}_0x2a971c['status'](_0xe750c1);return _0x2a971c[_0xa697('0x22')](_0xa697('0x23'),_0x23738b+'-'+_0x5a40b3+'/'+_0x2622ae)[_0xa697('0x1d')](_0x158024);}return null;};}function patchUpdates(_0x318535){return function(_0x1e4329){try{jsonpatch[_0xa697('0x24')](_0x1e4329,_0x318535,!![]);}catch(_0xbe247a){return BPromise[_0xa697('0x25')](_0xbe247a);}return _0x1e4329[_0xa697('0x26')]();};}function saveUpdates(_0x31e979,_0x3c2fe9){return function(_0x34b510){if(_0x34b510){return _0x34b510['update'](_0x31e979)[_0xa697('0x27')](function(_0x4a89d5){return _0x4a89d5;});}return null;};}function removeEntity(_0x307063,_0x41583f){return function(_0x433c60){if(_0x433c60){return _0x433c60[_0xa697('0x28')]()[_0xa697('0x27')](function(){var _0x3d0521=_0x433c60['get']({'plain':!![]});var _0x90ff14='Pauses';return db[_0xa697('0x29')][_0xa697('0x28')]({'where':{'type':_0x90ff14,'resourceId':_0x3d0521['id']}})[_0xa697('0x27')](function(){return _0x433c60;});})[_0xa697('0x27')](function(){_0x307063['status'](0xcc)[_0xa697('0x1c')]();});}};}function handleEntityNotFound(_0xbbe08d,_0x1867a8){return function(_0x33c440){if(!_0x33c440){_0xbbe08d[_0xa697('0x2a')](0x194);}return _0x33c440;};}function handleError(_0x26e700,_0x1ab67b){_0x1ab67b=_0x1ab67b||0x1f4;return function(_0x9a33f8){logger[_0xa697('0x2b')](_0x9a33f8[_0xa697('0x2c')]);if(_0x9a33f8[_0xa697('0x2d')]){delete _0x9a33f8[_0xa697('0x2d')];}_0x26e700[_0xa697('0x1b')](_0x1ab67b)[_0xa697('0x2e')](_0x9a33f8);};}exports['index']=function(_0x413ab0,_0xa62eb5){var _0x4a6d53={},_0x147bcd={},_0x1ded7f={'count':0x0,'rows':[]};var _0x279aed=_[_0xa697('0x2f')](db[_0xa697('0x30')]['rawAttributes'],function(_0x500bff){return{'name':_0x500bff[_0xa697('0x31')],'type':_0x500bff[_0xa697('0x32')][_0xa697('0x33')]};});_0x147bcd[_0xa697('0x34')]=_[_0xa697('0x2f')](_0x279aed,_0xa697('0x2d'));_0x147bcd[_0xa697('0x35')]=_['keys'](_0x413ab0[_0xa697('0x35')]);_0x147bcd['filters']=_[_0xa697('0x36')](_0x147bcd[_0xa697('0x34')],_0x147bcd['query']);_0x4a6d53['attributes']=_[_0xa697('0x36')](_0x147bcd[_0xa697('0x34')],qs['fields'](_0x413ab0[_0xa697('0x35')][_0xa697('0x37')]));_0x4a6d53[_0xa697('0x38')]=_0x4a6d53['attributes'][_0xa697('0x39')]?_0x4a6d53[_0xa697('0x38')]:_0x147bcd[_0xa697('0x34')];if(!_0x413ab0['query'][_0xa697('0x3a')](_0xa697('0x3b'))){_0x4a6d53[_0xa697('0x20')]=qs[_0xa697('0x20')](_0x413ab0[_0xa697('0x35')][_0xa697('0x20')]);_0x4a6d53[_0xa697('0x1e')]=qs[_0xa697('0x1e')](_0x413ab0[_0xa697('0x35')][_0xa697('0x1e')]);}_0x4a6d53[_0xa697('0x3c')]=qs[_0xa697('0x3d')](_0x413ab0[_0xa697('0x35')][_0xa697('0x3d')]);_0x4a6d53[_0xa697('0x3e')]=qs[_0xa697('0x3f')](_[_0xa697('0x40')](_0x413ab0[_0xa697('0x35')],_0x147bcd[_0xa697('0x3f')]),_0x279aed);if(_0x413ab0['query'][_0xa697('0x41')]){_0x4a6d53[_0xa697('0x3e')]=_[_0xa697('0x42')](_0x4a6d53[_0xa697('0x3e')],{'$or':_[_0xa697('0x2f')](_0x279aed,function(_0x4434a7){if(_0x4434a7['type']!=='VIRTUAL'){var _0x4a8931={};_0x4a8931[_0x4434a7[_0xa697('0x2d')]]={'$like':'%'+_0x413ab0[_0xa697('0x35')]['filter']+'%'};return _0x4a8931;}})});}_0x4a6d53=_[_0xa697('0x42')]({},_0x4a6d53,_0x413ab0[_0xa697('0x43')]);var _0x994369={'where':_0x4a6d53['where']};return db[_0xa697('0x30')][_0xa697('0x21')](_0x994369)[_0xa697('0x27')](function(_0x397ed4){_0x1ded7f['count']=_0x397ed4;if(_0x413ab0[_0xa697('0x35')][_0xa697('0x44')]){_0x4a6d53['include']=[{'all':!![]}];}return db['Pause'][_0xa697('0x45')](_0x4a6d53);})[_0xa697('0x27')](function(_0x4f858c){_0x1ded7f[_0xa697('0x46')]=_0x4f858c;return _0x1ded7f;})[_0xa697('0x27')](respondWithFilteredResult(_0xa62eb5,_0x4a6d53))[_0xa697('0x47')](handleError(_0xa62eb5,null));};exports[_0xa697('0x48')]=function(_0x1a9c59,_0x5e62fb){var _0x160ed8={'raw':!![],'where':{'id':_0x1a9c59[_0xa697('0x49')]['id']}},_0x54cbdb={};_0x54cbdb['model']=_[_0xa697('0x4a')](db[_0xa697('0x30')][_0xa697('0x4b')]);_0x54cbdb[_0xa697('0x35')]=_[_0xa697('0x4a')](_0x1a9c59[_0xa697('0x35')]);_0x54cbdb[_0xa697('0x3f')]=_[_0xa697('0x36')](_0x54cbdb[_0xa697('0x34')],_0x54cbdb['query']);_0x160ed8[_0xa697('0x38')]=_[_0xa697('0x36')](_0x54cbdb['model'],qs[_0xa697('0x37')](_0x1a9c59['query'][_0xa697('0x37')]));_0x160ed8[_0xa697('0x38')]=_0x160ed8[_0xa697('0x38')]['length']?_0x160ed8['attributes']:_0x54cbdb['model'];if(_0x1a9c59[_0xa697('0x35')][_0xa697('0x44')]){_0x160ed8['include']=[{'all':!![]}];}_0x160ed8=_[_0xa697('0x42')]({},_0x160ed8,_0x1a9c59[_0xa697('0x43')]);return db[_0xa697('0x30')][_0xa697('0x4c')](_0x160ed8)[_0xa697('0x27')](handleEntityNotFound(_0x5e62fb,null))[_0xa697('0x27')](respondWithResult(_0x5e62fb,null))['catch'](handleError(_0x5e62fb,null));};exports[_0xa697('0x4d')]=function(_0x4a24b5,_0x51d0ee){return db[_0xa697('0x30')]['create'](_0x4a24b5[_0xa697('0x4e')],{})['then'](function(_0x5245db){var _0x365fe7=_0x4a24b5[_0xa697('0x4f')][_0xa697('0x50')]({'plain':!![]});if(!_0x365fe7)throw new Error(_0xa697('0x51'));if(_0x365fe7['role']===_0xa697('0x4f')){var _0x499872=_0x5245db[_0xa697('0x50')]({'plain':!![]});var _0x27c008='Pauses';return db[_0xa697('0x52')][_0xa697('0x4c')]({'where':{'name':_0x27c008,'userProfileId':_0x365fe7['userProfileId']},'raw':!![]})[_0xa697('0x27')](function(_0x52cfa9){if(_0x52cfa9&&_0x52cfa9['autoAssociation']===0x0){return db[_0xa697('0x29')][_0xa697('0x4d')]({'name':_0x499872[_0xa697('0x2d')],'resourceId':_0x499872['id'],'type':_0x52cfa9[_0xa697('0x2d')],'sectionId':_0x52cfa9['id']},{})['then'](function(){return _0x5245db;});}else{return _0x5245db;}})[_0xa697('0x47')](function(_0x10cdcd){logger['error'](_0xa697('0x53'),_0x10cdcd);throw _0x10cdcd;});}return _0x5245db;})['then'](respondWithResult(_0x51d0ee,0xc9))[_0xa697('0x47')](handleError(_0x51d0ee,null));};exports['update']=function(_0x20a1d5,_0x76bb06){if(_0x20a1d5[_0xa697('0x4e')]['id']){delete _0x20a1d5['body']['id'];}return db[_0xa697('0x30')][_0xa697('0x4c')]({'where':{'id':_0x20a1d5['params']['id']}})[_0xa697('0x27')](handleEntityNotFound(_0x76bb06,null))[_0xa697('0x27')](saveUpdates(_0x20a1d5[_0xa697('0x4e')],null))[_0xa697('0x27')](respondWithResult(_0x76bb06,null))['catch'](handleError(_0x76bb06,null));};exports[_0xa697('0x28')]=function(_0x25e566,_0x59fe1d){return db['Pause'][_0xa697('0x4c')]({'where':{'id':_0x25e566['params']['id']}})[_0xa697('0x27')](handleEntityNotFound(_0x59fe1d,null))[_0xa697('0x27')](removeEntity(_0x59fe1d,null))[_0xa697('0x47')](handleError(_0x59fe1d,null));}; \ No newline at end of file +var _0x1810=['rows','catch','show','params','keys','find','create','body','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','save','then','Pauses','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Pause','includeAll','include','findAll'];(function(_0x1df50c,_0x474d4e){var _0x285c83=function(_0x1c5d29){while(--_0x1c5d29){_0x1df50c['push'](_0x1df50c['shift']());}};_0x285c83(++_0x474d4e);}(_0x1810,0xab));var _0x0181=function(_0x3355,_0x9b2e0f){_0x3355=_0x3355-0x0;var _0x3fcab2=_0x1810[_0x3355];return _0x3fcab2;};'use strict';var emlformat=require(_0x0181('0x0'));var rimraf=require(_0x0181('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0181('0x2'));var rp=require(_0x0181('0x3'));var moment=require('moment');var BPromise=require(_0x0181('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0181('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0181('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0181('0x7'));var squel=require('squel');var crypto=require(_0x0181('0x8'));var jsforce=require(_0x0181('0x9'));var deskjs=require(_0x0181('0xa'));var toCsv=require(_0x0181('0xb'));var querystring=require(_0x0181('0xc'));var Papa=require(_0x0181('0xd'));var Redis=require(_0x0181('0xe'));var authService=require(_0x0181('0xf'));var qs=require(_0x0181('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0181('0x11'))('api');var utils=require(_0x0181('0x12'));var config=require(_0x0181('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0181('0x14'))['db'];function respondWithStatusCode(_0x2e978d,_0x2c833a){_0x2c833a=_0x2c833a||0xcc;return function(_0x3791f5){if(_0x3791f5){return _0x2e978d['sendStatus'](_0x2c833a);}return _0x2e978d[_0x0181('0x15')](_0x2c833a)[_0x0181('0x16')]();};}function respondWithResult(_0x5598eb,_0x252023){_0x252023=_0x252023||0xc8;return function(_0x3ba20e){if(_0x3ba20e){return _0x5598eb['status'](_0x252023)['json'](_0x3ba20e);}};}function respondWithFilteredResult(_0x48bc4c,_0x3599f6){return function(_0xea4b3a){if(_0xea4b3a){var _0x1df0f1=typeof _0x3599f6['offset']===_0x0181('0x17')&&typeof _0x3599f6[_0x0181('0x18')]==='undefined';var _0x4701a3=_0xea4b3a[_0x0181('0x19')];var _0x13d1fd=_0x1df0f1?0x0:_0x3599f6[_0x0181('0x1a')];var _0xc8eb6a=_0x1df0f1?_0xea4b3a[_0x0181('0x19')]:_0x3599f6[_0x0181('0x1a')]+_0x3599f6[_0x0181('0x18')];var _0x91676;if(_0xc8eb6a>=_0x4701a3){_0xc8eb6a=_0x4701a3;_0x91676=0xc8;}else{_0x91676=0xce;}_0x48bc4c[_0x0181('0x15')](_0x91676);return _0x48bc4c[_0x0181('0x1b')](_0x0181('0x1c'),_0x13d1fd+'-'+_0xc8eb6a+'/'+_0x4701a3)[_0x0181('0x1d')](_0xea4b3a);}return null;};}function patchUpdates(_0xd3b2){return function(_0x2f12ac){try{jsonpatch['apply'](_0x2f12ac,_0xd3b2,!![]);}catch(_0x5866ea){return BPromise['reject'](_0x5866ea);}return _0x2f12ac[_0x0181('0x1e')]();};}function saveUpdates(_0x3761bb,_0x24a988){return function(_0x1dc69c){if(_0x1dc69c){return _0x1dc69c['update'](_0x3761bb)[_0x0181('0x1f')](function(_0x53c859){return _0x53c859;});}return null;};}function removeEntity(_0x1360b2,_0x18eb2f){return function(_0x1825ef){if(_0x1825ef){return _0x1825ef['destroy']()[_0x0181('0x1f')](function(){var _0x59336f=_0x1825ef['get']({'plain':!![]});var _0x54f49b=_0x0181('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x54f49b,'resourceId':_0x59336f['id']}})[_0x0181('0x1f')](function(){return _0x1825ef;});})[_0x0181('0x1f')](function(){_0x1360b2[_0x0181('0x15')](0xcc)[_0x0181('0x16')]();});}};}function handleEntityNotFound(_0x5a3caf,_0x4902fb){return function(_0x1dda8f){if(!_0x1dda8f){_0x5a3caf[_0x0181('0x21')](0x194);}return _0x1dda8f;};}function handleError(_0x386d21,_0x41da7e){_0x41da7e=_0x41da7e||0x1f4;return function(_0x288722){logger[_0x0181('0x22')](_0x288722[_0x0181('0x23')]);if(_0x288722[_0x0181('0x24')]){delete _0x288722['name'];}_0x386d21[_0x0181('0x15')](_0x41da7e)[_0x0181('0x25')](_0x288722);};}exports[_0x0181('0x26')]=function(_0x4df65a,_0x3a0489){var _0x40c082={},_0x250533={},_0x57b9cd={'count':0x0,'rows':[]};var _0x23c4e9=_[_0x0181('0x27')](db['Pause'][_0x0181('0x28')],function(_0x323a08){return{'name':_0x323a08[_0x0181('0x29')],'type':_0x323a08[_0x0181('0x2a')][_0x0181('0x2b')]};});_0x250533[_0x0181('0x2c')]=_['map'](_0x23c4e9,_0x0181('0x24'));_0x250533[_0x0181('0x2d')]=_['keys'](_0x4df65a[_0x0181('0x2d')]);_0x250533['filters']=_['intersection'](_0x250533[_0x0181('0x2c')],_0x250533[_0x0181('0x2d')]);_0x40c082[_0x0181('0x2e')]=_[_0x0181('0x2f')](_0x250533['model'],qs[_0x0181('0x30')](_0x4df65a[_0x0181('0x2d')][_0x0181('0x30')]));_0x40c082['attributes']=_0x40c082[_0x0181('0x2e')][_0x0181('0x31')]?_0x40c082[_0x0181('0x2e')]:_0x250533['model'];if(!_0x4df65a['query']['hasOwnProperty'](_0x0181('0x32'))){_0x40c082[_0x0181('0x18')]=qs[_0x0181('0x18')](_0x4df65a[_0x0181('0x2d')]['limit']);_0x40c082[_0x0181('0x1a')]=qs[_0x0181('0x1a')](_0x4df65a['query'][_0x0181('0x1a')]);}_0x40c082[_0x0181('0x33')]=qs[_0x0181('0x34')](_0x4df65a[_0x0181('0x2d')]['sort']);_0x40c082[_0x0181('0x35')]=qs['filters'](_['pick'](_0x4df65a['query'],_0x250533[_0x0181('0x36')]),_0x23c4e9);if(_0x4df65a[_0x0181('0x2d')][_0x0181('0x37')]){_0x40c082[_0x0181('0x35')]=_[_0x0181('0x38')](_0x40c082['where'],{'$or':_[_0x0181('0x27')](_0x23c4e9,function(_0x533b21){if(_0x533b21['type']!==_0x0181('0x39')){var _0x589c27={};_0x589c27[_0x533b21['name']]={'$like':'%'+_0x4df65a[_0x0181('0x2d')][_0x0181('0x37')]+'%'};return _0x589c27;}})});}_0x40c082=_[_0x0181('0x38')]({},_0x40c082,_0x4df65a[_0x0181('0x3a')]);var _0x5ccd92={'where':_0x40c082['where']};return db[_0x0181('0x3b')][_0x0181('0x19')](_0x5ccd92)['then'](function(_0x2de2eb){_0x57b9cd[_0x0181('0x19')]=_0x2de2eb;if(_0x4df65a[_0x0181('0x2d')][_0x0181('0x3c')]){_0x40c082[_0x0181('0x3d')]=[{'all':!![]}];}return db[_0x0181('0x3b')][_0x0181('0x3e')](_0x40c082);})[_0x0181('0x1f')](function(_0x3a9884){_0x57b9cd[_0x0181('0x3f')]=_0x3a9884;return _0x57b9cd;})[_0x0181('0x1f')](respondWithFilteredResult(_0x3a0489,_0x40c082))[_0x0181('0x40')](handleError(_0x3a0489,null));};exports[_0x0181('0x41')]=function(_0x4e450f,_0x296033){var _0x4e5774={'raw':!![],'where':{'id':_0x4e450f[_0x0181('0x42')]['id']}},_0x448348={};_0x448348[_0x0181('0x2c')]=_['keys'](db[_0x0181('0x3b')][_0x0181('0x28')]);_0x448348[_0x0181('0x2d')]=_[_0x0181('0x43')](_0x4e450f[_0x0181('0x2d')]);_0x448348[_0x0181('0x36')]=_[_0x0181('0x2f')](_0x448348[_0x0181('0x2c')],_0x448348[_0x0181('0x2d')]);_0x4e5774[_0x0181('0x2e')]=_[_0x0181('0x2f')](_0x448348[_0x0181('0x2c')],qs[_0x0181('0x30')](_0x4e450f[_0x0181('0x2d')][_0x0181('0x30')]));_0x4e5774[_0x0181('0x2e')]=_0x4e5774[_0x0181('0x2e')][_0x0181('0x31')]?_0x4e5774[_0x0181('0x2e')]:_0x448348[_0x0181('0x2c')];if(_0x4e450f['query'][_0x0181('0x3c')]){_0x4e5774['include']=[{'all':!![]}];}_0x4e5774=_[_0x0181('0x38')]({},_0x4e5774,_0x4e450f[_0x0181('0x3a')]);return db[_0x0181('0x3b')][_0x0181('0x44')](_0x4e5774)['then'](handleEntityNotFound(_0x296033,null))[_0x0181('0x1f')](respondWithResult(_0x296033,null))['catch'](handleError(_0x296033,null));};exports[_0x0181('0x45')]=function(_0xc50874,_0x5817a9){return db[_0x0181('0x3b')][_0x0181('0x45')](_0xc50874[_0x0181('0x46')],{})[_0x0181('0x1f')](function(_0x502c56){var _0x1125b2=_0xc50874['user'][_0x0181('0x47')]({'plain':!![]});if(!_0x1125b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1125b2[_0x0181('0x48')]==='user'){var _0x5ab7a6=_0x502c56[_0x0181('0x47')]({'plain':!![]});var _0x1ee4df=_0x0181('0x20');return db[_0x0181('0x49')]['find']({'where':{'name':_0x1ee4df,'userProfileId':_0x1125b2[_0x0181('0x4a')]},'raw':!![]})[_0x0181('0x1f')](function(_0x2cb608){if(_0x2cb608&&_0x2cb608[_0x0181('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x5ab7a6['name'],'resourceId':_0x5ab7a6['id'],'type':_0x2cb608[_0x0181('0x24')],'sectionId':_0x2cb608['id']},{})['then'](function(){return _0x502c56;});}else{return _0x502c56;}})['catch'](function(_0x41632c){logger['error'](_0x0181('0x4c'),_0x41632c);throw _0x41632c;});}return _0x502c56;})[_0x0181('0x1f')](respondWithResult(_0x5817a9,0xc9))[_0x0181('0x40')](handleError(_0x5817a9,null));};exports['update']=function(_0x2f52f0,_0x4a328e){if(_0x2f52f0[_0x0181('0x46')]['id']){delete _0x2f52f0[_0x0181('0x46')]['id'];}return db['Pause']['find']({'where':{'id':_0x2f52f0[_0x0181('0x42')]['id']}})[_0x0181('0x1f')](handleEntityNotFound(_0x4a328e,null))[_0x0181('0x1f')](saveUpdates(_0x2f52f0[_0x0181('0x46')],null))[_0x0181('0x1f')](respondWithResult(_0x4a328e,null))['catch'](handleError(_0x4a328e,null));};exports[_0x0181('0x4d')]=function(_0x5b97ae,_0x2f2c94){return db[_0x0181('0x3b')]['find']({'where':{'id':_0x5b97ae[_0x0181('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f2c94,null))[_0x0181('0x1f')](removeEntity(_0x2f2c94,null))['catch'](handleError(_0x2f2c94,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 48ab3ff..d761f90 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_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':'tools_pauses','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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x546941,_0x3851ad){_0x546941=_0x546941-0x0;var _0x5a561c=_0x7fbe[_0x546941];return _0x5a561c;};'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 aaf0928..f4cf6a0 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 _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(_0x2d4f2a,_0x611dae){var _0xff7f3b=function(_0x438c0c){while(--_0x438c0c){_0x2d4f2a['push'](_0x2d4f2a['shift']());}};_0xff7f3b(++_0x611dae);}(_0x7a54,0x106));var _0x47a5=function(_0x42fa55,_0x5b038f){_0x42fa55=_0x42fa55-0x0;var _0x3e97fb=_0x7a54[_0x42fa55];return _0x3e97fb;};'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 +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(_0x59704c,_0x320050){var _0x20dcb9=function(_0x182400){while(--_0x182400){_0x59704c['push'](_0x59704c['shift']());}};_0x20dcb9(++_0x320050);}(_0xb10b,0x12a));var _0xbb10=function(_0x549d16,_0x4d069a){_0x549d16=_0x549d16-0x0;var _0x344ccc=_0xb10b[_0x549d16];return _0x344ccc;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index cf6fbc2..65b8e0b 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 _0x9b67=['../../components/auth/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9b67,0xf6));var _0x79b6=function(_0x36c2a8,_0x30905c){_0x36c2a8=_0x36c2a8-0x0;var _0x37533a=_0x9b67[_0x36c2a8];return _0x37533a;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var fs_extra=require(_0x79b6('0x5'));var auth=require(_0x79b6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b6('0x7'));router[_0x79b6('0x8')]('/',auth[_0x79b6('0x9')](),controller[_0x79b6('0xa')]);router[_0x79b6('0x8')](_0x79b6('0xb'),controller[_0x79b6('0xc')]);router['get'](_0x79b6('0xd'),auth[_0x79b6('0x9')](),controller[_0x79b6('0xe')]);router[_0x79b6('0x8')](_0x79b6('0xf'),auth['isAuthenticated'](),controller[_0x79b6('0x10')]);var upload=multer({'storage':multer[_0x79b6('0x11')]({'destination':function(_0x3f3b44,_0x301f13,_0x58a98b){_0x58a98b(null,path['join'](config[_0x79b6('0x12')],_0x79b6('0x13')));},'filename':function(_0x303cfb,_0x526727,_0xc05a77){_0x526727[_0x79b6('0x14')]=_0x526727[_0x79b6('0x14')][_0x79b6('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xc05a77(null,util[_0x79b6('0x16')](_0x79b6('0x17'),path[_0x79b6('0x18')](_0x526727[_0x79b6('0x14')],path[_0x79b6('0x19')](_0x526727[_0x79b6('0x14')])),Date[_0x79b6('0x1a')](),path[_0x79b6('0x19')](_0x526727[_0x79b6('0x14')])));}})});router['post']('/',upload[_0x79b6('0x1b')](_0x79b6('0x1c')),controller[_0x79b6('0x1d')]);router[_0x79b6('0x1e')](_0x79b6('0xb'),controller[_0x79b6('0x1f')]);router[_0x79b6('0x20')](_0x79b6('0xd'),auth[_0x79b6('0x9')](),controller[_0x79b6('0x21')]);router[_0x79b6('0x22')](_0x79b6('0xd'),auth[_0x79b6('0x9')](),controller['delete']);module[_0x79b6('0x23')]=router; \ No newline at end of file +var _0xfd28=['webhookPost','put','update','delete','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/:id','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','/webhook'];(function(_0x84ee9c,_0xc997e0){var _0xe8dd3e=function(_0x96a171){while(--_0x96a171){_0x84ee9c['push'](_0x84ee9c['shift']());}};_0xe8dd3e(++_0xc997e0);}(_0xfd28,0x148));var _0x8fd2=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0xfd28[_0x16e57d];return _0x40239c;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/webhook',controller['webhookGet']);router[_0x8fd2('0x7')](_0x8fd2('0xa'),auth[_0x8fd2('0x8')](),controller['show']);router[_0x8fd2('0x7')]('/:id/download',auth[_0x8fd2('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x8fd2('0xb')]({'destination':function(_0x4fdf0b,_0x1ca2a1,_0x5244ed){_0x5244ed(null,path[_0x8fd2('0xc')](config['root'],_0x8fd2('0xd')));},'filename':function(_0x207298,_0xfd78d,_0xa6d7ca){_0xfd78d[_0x8fd2('0xe')]=_0xfd78d[_0x8fd2('0xe')][_0x8fd2('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xa6d7ca(null,util[_0x8fd2('0x10')](_0x8fd2('0x11'),path[_0x8fd2('0x12')](_0xfd78d[_0x8fd2('0xe')],path[_0x8fd2('0x13')](_0xfd78d[_0x8fd2('0xe')])),Date[_0x8fd2('0x14')](),path[_0x8fd2('0x13')](_0xfd78d['originalname'])));}})});router[_0x8fd2('0x15')]('/',upload['single']('file'),controller['upload']);router[_0x8fd2('0x15')](_0x8fd2('0x16'),controller[_0x8fd2('0x17')]);router[_0x8fd2('0x18')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x19')]);router[_0x8fd2('0x1a')](_0x8fd2('0xa'),auth[_0x8fd2('0x8')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index f9fcee1..12398cb 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 _0x97c2=['STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97c2,0x6d));var _0x297c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x97c2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x297c('0x0'));module['exports']={'name':{'type':Sequelize[_0x297c('0x1')]},'type':{'type':Sequelize[_0x297c('0x2')]('html',_0x297c('0x3'))},'description':{'type':Sequelize[_0x297c('0x4')]},'version':{'type':Sequelize[_0x297c('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x297c('0x5')},'active':{'type':Sequelize[_0x297c('0x6')],'defaultValue':0x0,'comment':_0x297c('0x7')},'sidebar':{'type':Sequelize[_0x297c('0x2')](_0x297c('0x8'),_0x297c('0x9'),_0x297c('0xa'),'never'),'defaultValue':_0x297c('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x297c('0x1')]},'scriptPath':{'type':Sequelize[_0x297c('0x1')]}}; \ No newline at end of file +var _0xd304=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly'];(function(_0x4592f0,_0x498af2){var _0x582326=function(_0x330a16){while(--_0x330a16){_0x4592f0['push'](_0x4592f0['shift']());}};_0x582326(++_0x498af2);}(_0xd304,0x66));var _0x4d30=function(_0x38140e,_0x37d3be){_0x38140e=_0x38140e-0x0;var _0x3ca6d1=_0xd304[_0x38140e];return _0x3ca6d1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4d30('0x0')](_0x4d30('0x1'),_0x4d30('0x2'))},'description':{'type':Sequelize[_0x4d30('0x3')]},'version':{'type':Sequelize[_0x4d30('0x3')]},'path':{'type':Sequelize[_0x4d30('0x4')],'comment':_0x4d30('0x5')},'active':{'type':Sequelize[_0x4d30('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x4d30('0x0')](_0x4d30('0x7'),'agentOnly',_0x4d30('0x8'),_0x4d30('0x9')),'defaultValue':_0x4d30('0x8'),'comment':_0x4d30('0xa')},'icon':{'type':Sequelize[_0x4d30('0x4')]},'adminUrl':{'type':Sequelize[_0x4d30('0x4')]},'agentUrl':{'type':Sequelize[_0x4d30('0x4')]},'scriptName':{'type':Sequelize[_0x4d30('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 7b6993a..938306e 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 _0x33bd=['fieldName','type','key','query','keys','filters','intersection','attributes','model','length','nolimit','order','sort','pick','filter','merge','where','map','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','fields','find','catch','download','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','Plugins','UserProfileResource','error','name','send','Plugin'];(function(_0x51674a,_0x2ca337){var _0x4a1f4e=function(_0x5ad4a5){while(--_0x5ad4a5){_0x51674a['push'](_0x51674a['shift']());}};_0x4a1f4e(++_0x2ca337);}(_0x33bd,0x12d));var _0xd33b=function(_0x2ad5aa,_0x1d20a3){_0x2ad5aa=_0x2ad5aa-0x0;var _0x2a2ff1=_0x33bd[_0x2ad5aa];return _0x2a2ff1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd33b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd33b('0x1'));var rp=require('request-promise');var moment=require(_0xd33b('0x2'));var BPromise=require(_0xd33b('0x3'));var Mustache=require(_0xd33b('0x4'));var util=require(_0xd33b('0x5'));var path=require(_0xd33b('0x6'));var sox=require(_0xd33b('0x7'));var csv=require(_0xd33b('0x8'));var ejs=require(_0xd33b('0x9'));var fs=require('fs');var fs_extra=require(_0xd33b('0xa'));var _=require(_0xd33b('0xb'));var squel=require(_0xd33b('0xc'));var crypto=require('crypto');var jsforce=require(_0xd33b('0xd'));var deskjs=require(_0xd33b('0xe'));var toCsv=require(_0xd33b('0x8'));var querystring=require(_0xd33b('0xf'));var Papa=require(_0xd33b('0x10'));var extract=require(_0xd33b('0x11'));var rimraf=require(_0xd33b('0x0'));var archiver=require('archiver');var Redis=require(_0xd33b('0x12'));var authService=require(_0xd33b('0x13'));var qs=require(_0xd33b('0x14'));var as=require(_0xd33b('0x15'));var hardwareService=require(_0xd33b('0x16'));var logger=require(_0xd33b('0x17'))('api');var utils=require(_0xd33b('0x18'));var config=require(_0xd33b('0x19'));var licenseUtil=require(_0xd33b('0x1a'));var db=require(_0xd33b('0x1b'))['db'];config[_0xd33b('0x1c')]=_[_0xd33b('0x1d')](config[_0xd33b('0x1c')],{'host':_0xd33b('0x1e'),'port':0x18eb});var socket=require(_0xd33b('0x1f'))(new Redis(config[_0xd33b('0x1c')]));require(_0xd33b('0x20'))[_0xd33b('0x21')](socket);function respondWithStatusCode(_0x5d9fd7,_0xc20550){_0xc20550=_0xc20550||0xcc;return function(_0x58e433){if(_0x58e433){return _0x5d9fd7[_0xd33b('0x22')](_0xc20550);}return _0x5d9fd7[_0xd33b('0x23')](_0xc20550)[_0xd33b('0x24')]();};}function respondWithResult(_0x46baa7,_0x18e69d){_0x18e69d=_0x18e69d||0xc8;return function(_0x53297c){if(_0x53297c){return _0x46baa7[_0xd33b('0x23')](_0x18e69d)[_0xd33b('0x25')](_0x53297c);}};}function respondWithFilteredResult(_0x264116,_0x477397){return function(_0x2f0697){if(_0x2f0697){var _0x6c50b3=typeof _0x477397[_0xd33b('0x26')]===_0xd33b('0x27')&&typeof _0x477397[_0xd33b('0x28')]==='undefined';var _0x41ceac=_0x2f0697[_0xd33b('0x29')];var _0x278b64=_0x6c50b3?0x0:_0x477397[_0xd33b('0x26')];var _0x312fac=_0x6c50b3?_0x2f0697[_0xd33b('0x29')]:_0x477397[_0xd33b('0x26')]+_0x477397[_0xd33b('0x28')];var _0x47f164;if(_0x312fac>=_0x41ceac){_0x312fac=_0x41ceac;_0x47f164=0xc8;}else{_0x47f164=0xce;}_0x264116[_0xd33b('0x23')](_0x47f164);return _0x264116['set'](_0xd33b('0x2a'),_0x278b64+'-'+_0x312fac+'/'+_0x41ceac)[_0xd33b('0x25')](_0x2f0697);}return null;};}function patchUpdates(_0x1fdc56){return function(_0x35eb4d){try{jsonpatch[_0xd33b('0x2b')](_0x35eb4d,_0x1fdc56,!![]);}catch(_0x717a46){return BPromise['reject'](_0x717a46);}return _0x35eb4d[_0xd33b('0x2c')]();};}function saveUpdates(_0x47ddc1,_0x1b117e){return function(_0x2061f1){if(_0x2061f1){return _0x2061f1[_0xd33b('0x2d')](_0x47ddc1)[_0xd33b('0x2e')](function(_0x200573){return _0x200573;});}return null;};}function removeEntity(_0x50f17c,_0x1f31e6){return function(_0x1ce5df){if(_0x1ce5df){return _0x1ce5df[_0xd33b('0x2f')]()[_0xd33b('0x2e')](function(){var _0x50b87f=_0x1ce5df[_0xd33b('0x30')]({'plain':!![]});var _0x56570d=_0xd33b('0x31');return db[_0xd33b('0x32')][_0xd33b('0x2f')]({'where':{'type':_0x56570d,'resourceId':_0x50b87f['id']}})[_0xd33b('0x2e')](function(){return _0x1ce5df;});})[_0xd33b('0x2e')](function(){_0x50f17c[_0xd33b('0x23')](0xcc)[_0xd33b('0x24')]();});}};}function handleEntityNotFound(_0x26b9cc,_0x3796d9){return function(_0x5006fc){if(!_0x5006fc){_0x26b9cc[_0xd33b('0x22')](0x194);}return _0x5006fc;};}function handleError(_0x1d9a22,_0x404dbf){_0x404dbf=_0x404dbf||0x1f4;return function(_0x10780b){logger[_0xd33b('0x33')](_0x10780b['stack']);if(_0x10780b[_0xd33b('0x34')]){delete _0x10780b[_0xd33b('0x34')];}_0x1d9a22['status'](_0x404dbf)[_0xd33b('0x35')](_0x10780b);};}exports['index']=function(_0x2191b3,_0x1a33f2){var _0x560b08={},_0xd8f576={},_0x3fa39f={'count':0x0,'rows':[]};var _0x4d0f9f=_['map'](db[_0xd33b('0x36')]['rawAttributes'],function(_0x432357){return{'name':_0x432357[_0xd33b('0x37')],'type':_0x432357[_0xd33b('0x38')][_0xd33b('0x39')]};});_0xd8f576['model']=_['map'](_0x4d0f9f,_0xd33b('0x34'));_0xd8f576[_0xd33b('0x3a')]=_[_0xd33b('0x3b')](_0x2191b3['query']);_0xd8f576[_0xd33b('0x3c')]=_[_0xd33b('0x3d')](_0xd8f576['model'],_0xd8f576[_0xd33b('0x3a')]);_0x560b08[_0xd33b('0x3e')]=_[_0xd33b('0x3d')](_0xd8f576[_0xd33b('0x3f')],qs['fields'](_0x2191b3['query']['fields']));_0x560b08[_0xd33b('0x3e')]=_0x560b08[_0xd33b('0x3e')][_0xd33b('0x40')]?_0x560b08[_0xd33b('0x3e')]:_0xd8f576['model'];if(!_0x2191b3['query']['hasOwnProperty'](_0xd33b('0x41'))){_0x560b08[_0xd33b('0x28')]=qs[_0xd33b('0x28')](_0x2191b3[_0xd33b('0x3a')][_0xd33b('0x28')]);_0x560b08[_0xd33b('0x26')]=qs[_0xd33b('0x26')](_0x2191b3[_0xd33b('0x3a')][_0xd33b('0x26')]);}_0x560b08[_0xd33b('0x42')]=qs[_0xd33b('0x43')](_0x2191b3[_0xd33b('0x3a')][_0xd33b('0x43')]);_0x560b08['where']=qs['filters'](_[_0xd33b('0x44')](_0x2191b3[_0xd33b('0x3a')],_0xd8f576[_0xd33b('0x3c')]),_0x4d0f9f);if(_0x2191b3['query'][_0xd33b('0x45')]){_0x560b08['where']=_[_0xd33b('0x46')](_0x560b08[_0xd33b('0x47')],{'$or':_[_0xd33b('0x48')](_0x4d0f9f,function(_0x48a06e){if(_0x48a06e[_0xd33b('0x38')]!==_0xd33b('0x49')){var _0x5557f7={};_0x5557f7[_0x48a06e[_0xd33b('0x34')]]={'$like':'%'+_0x2191b3[_0xd33b('0x3a')][_0xd33b('0x45')]+'%'};return _0x5557f7;}})});}_0x560b08=_[_0xd33b('0x46')]({},_0x560b08,_0x2191b3[_0xd33b('0x4a')]);var _0x57e71f={'where':_0x560b08[_0xd33b('0x47')]};return db[_0xd33b('0x36')][_0xd33b('0x29')](_0x57e71f)[_0xd33b('0x2e')](function(_0x11f1f1){_0x3fa39f[_0xd33b('0x29')]=_0x11f1f1;if(_0x2191b3['query'][_0xd33b('0x4b')]){_0x560b08[_0xd33b('0x4c')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x560b08);})['then'](function(_0x500ea3){_0x3fa39f[_0xd33b('0x4d')]=_0x500ea3;return _0x3fa39f;})['then'](respondWithFilteredResult(_0x1a33f2,_0x560b08))['catch'](handleError(_0x1a33f2,null));};exports[_0xd33b('0x4e')]=function(_0x38aaff,_0x95f12c){var _0x3dbb13={'raw':!![],'where':{'id':_0x38aaff[_0xd33b('0x4f')]['id']}},_0x5aab51={};_0x5aab51[_0xd33b('0x3f')]=_['keys'](db[_0xd33b('0x36')][_0xd33b('0x50')]);_0x5aab51['query']=_[_0xd33b('0x3b')](_0x38aaff['query']);_0x5aab51['filters']=_[_0xd33b('0x3d')](_0x5aab51['model'],_0x5aab51['query']);_0x3dbb13[_0xd33b('0x3e')]=_['intersection'](_0x5aab51[_0xd33b('0x3f')],qs[_0xd33b('0x51')](_0x38aaff['query'][_0xd33b('0x51')]));_0x3dbb13[_0xd33b('0x3e')]=_0x3dbb13['attributes']['length']?_0x3dbb13[_0xd33b('0x3e')]:_0x5aab51[_0xd33b('0x3f')];if(_0x38aaff['query']['includeAll']){_0x3dbb13[_0xd33b('0x4c')]=[{'all':!![]}];}_0x3dbb13=_[_0xd33b('0x46')]({},_0x3dbb13,_0x38aaff[_0xd33b('0x4a')]);return db[_0xd33b('0x36')][_0xd33b('0x52')](_0x3dbb13)['then'](handleEntityNotFound(_0x95f12c,null))[_0xd33b('0x2e')](respondWithResult(_0x95f12c,null))[_0xd33b('0x53')](handleError(_0x95f12c,null));};exports[_0xd33b('0x54')]=function(_0x2e87ac,_0x44a04f,_0x2905cf){return db[_0xd33b('0x36')][_0xd33b('0x52')]({'where':{'id':_0x2e87ac[_0xd33b('0x4f')]['id']},'attributes':[_0xd33b('0x34'),_0xd33b('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0x44a04f,null))[_0xd33b('0x2e')](function(_0x3e8390){if(_0x3e8390){var _0xf776f0=path[_0xd33b('0x55')](config[_0xd33b('0x56')],_0xd33b('0x57'),util[_0xd33b('0x58')](_0xd33b('0x59'),path['basename'](_0x3e8390[_0xd33b('0x6')])));var _0x44b4a9=fs[_0xd33b('0x5a')](_0xf776f0);var _0x32ead3=archiver(_0xd33b('0x5b'),{'zlib':{'level':0x9}});_0x32ead3['on'](_0xd33b('0x5c'),function(_0x3107c0){if(_0x3107c0[_0xd33b('0x5d')]===_0xd33b('0x5e')){logger[_0xd33b('0x33')](_0x3107c0);}else{throw new db[(_0xd33b('0x5f'))][(_0xd33b('0x60'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x32ead3['on'](_0xd33b('0x33'),function(_0xca00fa){throw new db[(_0xd33b('0x5f'))][(_0xd33b('0x60'))](_0xd33b('0x61'));});_0x32ead3[_0xd33b('0x62')](_0x44b4a9);_0x32ead3[_0xd33b('0x63')](_0xd33b('0x64'),{'cwd':path[_0xd33b('0x55')](config[_0xd33b('0x56')],'server/files/plugins',path[_0xd33b('0x65')](_0x3e8390[_0xd33b('0x6')])),'ignore':[path[_0xd33b('0x55')](path[_0xd33b('0x66')](_0x3e8390[_0xd33b('0x6')]),_0xd33b('0x67')),path[_0xd33b('0x55')](path[_0xd33b('0x66')](_0x3e8390[_0xd33b('0x6')]),_0xd33b('0x68'))],'nodir':!![]})[_0xd33b('0x69')]();_0x44b4a9['on'](_0xd33b('0x6a'),function(){if(!fs[_0xd33b('0x6b')](_0xf776f0)){throw new db[(_0xd33b('0x5f'))][(_0xd33b('0x60'))](_0xd33b('0x6c'));}return _0x44a04f[_0xd33b('0x54')](_0xf776f0,util['format'](_0xd33b('0x59'),path['basename'](_0x3e8390[_0xd33b('0x6')])),function(_0x26776f){if(_0x26776f){throw new db[(_0xd33b('0x5f'))][(_0xd33b('0x60'))](_0xd33b('0x6d'));}fs[_0xd33b('0x6e')](_0xf776f0);logger[_0xd33b('0x6f')]('Download\x20completed');logger[_0xd33b('0x6f')](_0xd33b('0x70'));});});}return null;})['catch'](handleError(_0x44a04f,null));};exports['upload']=function(_0x3e5a20,_0xe0820d,_0x376a2a){var _0xdcc0b=path[_0xd33b('0x66')](_0x3e5a20[_0xd33b('0x71')][_0xd33b('0x72')],path[_0xd33b('0x73')](_0x3e5a20[_0xd33b('0x71')][_0xd33b('0x72')]));var _0x237641=path['join'](config['root'],'server/files/plugins',_0x3e5a20[_0xd33b('0x71')][_0xd33b('0x72')]);var _0x2454dc=path['join'](config['root'],_0xd33b('0x57'),_0xdcc0b);logger['info'](_0xd33b('0x74'),_0x237641);logger['info'](_0xd33b('0x75'),_0x2454dc);try{fs[_0xd33b('0x76')](_0x237641,parseInt('0777',0x8));extract(_0x237641,{'dir':_0x2454dc},function(_0x73b92e){if(_0x73b92e){logger[_0xd33b('0x33')](_0x73b92e);handleError(_0x73b92e,!![]);};var _0xa5c305=fs['readdirSync'](_0x2454dc);if(_0xa5c305['length']>0x1){removeReferences(_0x237641,_0x2454dc);logger['error'](_0xd33b('0x77'));return _0x376a2a(new Error(_0xd33b('0x77')));}var _0x11dace=fs[_0xd33b('0x78')](path[_0xd33b('0x55')](_0x2454dc,_0xa5c305[0x0]));if(_0x11dace[_0xd33b('0x79')]()){removeReferences(_0x237641,_0x2454dc);logger[_0xd33b('0x33')](_0xd33b('0x77'));return _0x376a2a(new Error(_0xd33b('0x77')));}if(_0x11dace[_0xd33b('0x7a')]()){var _0x190ce2=fs[_0xd33b('0x7b')](path[_0xd33b('0x55')](_0x2454dc,_0xa5c305[0x0]));if(_0x190ce2['length']===0x0){removeReferences(_0x237641,_0x2454dc);logger['error'](_0xd33b('0x77'));return _0x376a2a(new Error(_0xd33b('0x77')));}var _0x489158=_0x190ce2[_0xd33b('0x7c')](function(_0x4c7ef2){return _0x4c7ef2===_0xd33b('0x7d');});if(!_0x489158){return _0x376a2a(new Error('Plugin\x20manifest\x20missing'));}var _0xdf74c1=fs[_0xd33b('0x7e')](path['join'](_0x2454dc,_0xa5c305[0x0],_0xd33b('0x7d')));var _0x3ba77a=JSON[_0xd33b('0x7f')](_0xdf74c1);if('undefined'==typeof _0x3ba77a[_0xd33b('0x34')]){return _0x376a2a(new Error(_0xd33b('0x80')));}if(_0xd33b('0x27')==typeof _0x3ba77a[_0xd33b('0x38')]){return _0x376a2a(new Error(_0xd33b('0x81')));}if(_0xd33b('0x27')==typeof _0x3ba77a[_0xd33b('0x82')]){return _0x376a2a(new Error(_0xd33b('0x83')));}if('undefined'==typeof _0x3ba77a['parameters']){return _0x376a2a(new Error(_0xd33b('0x84')));}if(_0x3ba77a[_0xd33b('0x38')]===_0xd33b('0x85')){if('undefined'==typeof _0x3ba77a['parameters'][_0xd33b('0x86')]){return _0x376a2a(new Error(_0xd33b('0x87')));}if(_0xd33b('0x27')==typeof _0x3ba77a[_0xd33b('0x88')][_0xd33b('0x86')][_0xd33b('0x89')]&&'undefined'==typeof _0x3ba77a[_0xd33b('0x88')][_0xd33b('0x86')][_0xd33b('0x8a')]){return _0x376a2a(new Error(_0xd33b('0x8b')));}}else if(_0x3ba77a[_0xd33b('0x38')]===_0xd33b('0x8c')){if('undefined'==typeof _0x3ba77a[_0xd33b('0x88')][_0xd33b('0x8d')]){return _0x376a2a(new Error(_0xd33b('0x8e')));}if(_0xd33b('0x27')==typeof _0x3ba77a['parameters'][_0xd33b('0x8f')]){return _0x376a2a(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x376a2a(new Error(_0xd33b('0x90')));}var _0x1b3fc2=_0x3ba77a[_0xd33b('0x34')];var _0x545936=_0x3ba77a[_0xd33b('0x91')];var _0x174366=_0x3ba77a[_0xd33b('0x38')];var _0x2dd184=_0x3ba77a[_0xd33b('0x92')]?_0x3ba77a['sidebar']:_0xd33b('0x93');var _0x3a6a67=_0x3ba77a[_0xd33b('0x94')]?_0x3ba77a['icon']:_0xd33b('0x95');var _0x234190='';var _0x1ce8dd='';var _0xc19231='';var _0x17d86f='';var _0x67123=_0x3ba77a[_0xd33b('0x82')];if(_0x174366===_0xd33b('0x85')){if('undefined'!=typeof _0x3ba77a[_0xd33b('0x88')]['views'][_0xd33b('0x89')]){var _0x46478c=_0x3ba77a[_0xd33b('0x88')][_0xd33b('0x86')][_0xd33b('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xd33b('0x96')](_0x46478c)){_0x234190=path[_0xd33b('0x55')](_0xd33b('0x97'),_0xdcc0b,_0xa5c305[0x0],_0x46478c);}else{_0x234190=_0x46478c;}}else{logger[_0xd33b('0x6f')](_0xd33b('0x98'));}if(_0xd33b('0x27')!=typeof _0x3ba77a[_0xd33b('0x88')][_0xd33b('0x86')][_0xd33b('0x8a')]){var _0x110885=_0x3ba77a[_0xd33b('0x88')][_0xd33b('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x110885)){_0x1ce8dd=path[_0xd33b('0x55')](_0xd33b('0x97'),_0xdcc0b,_0xa5c305[0x0],_0x110885);}else{_0x1ce8dd=_0x110885;}}else{logger[_0xd33b('0x6f')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x174366===_0xd33b('0x8c')){_0xc19231=_0x3ba77a[_0xd33b('0x88')][_0xd33b('0x8d')];_0x17d86f=_0x3ba77a[_0xd33b('0x88')]['scriptPath'];if(_0xd33b('0x27')!=typeof _0x3ba77a[_0xd33b('0x88')][_0xd33b('0x86')]){if(_0xd33b('0x27')!=typeof _0x3ba77a[_0xd33b('0x88')]['views'][_0xd33b('0x89')]){var _0x46478c=_0x3ba77a['parameters'][_0xd33b('0x86')][_0xd33b('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x46478c)){_0x234190=path[_0xd33b('0x55')]('plugins',_0xdcc0b,_0xa5c305[0x0],_0x46478c);}else{_0x234190=_0x46478c;}}if(_0xd33b('0x27')!=typeof _0x3ba77a[_0xd33b('0x88')][_0xd33b('0x86')][_0xd33b('0x8a')]){var _0x110885=_0x3ba77a[_0xd33b('0x88')][_0xd33b('0x86')][_0xd33b('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xd33b('0x96')](_0x110885)){_0x1ce8dd=path[_0xd33b('0x55')](_0xd33b('0x97'),_0xdcc0b,_0xa5c305[0x0],_0x110885);}else{_0x1ce8dd=_0x110885;}}}}var _0x21b40f={'name':_0x1b3fc2,'description':_0x545936,'path':path[_0xd33b('0x55')](_0xdcc0b,_0xa5c305[0x0]),'type':_0x174366,'sidebar':_0x2dd184,'icon':_0x3a6a67,'adminUrl':_0x234190,'agentUrl':_0x1ce8dd,'scriptName':_0xc19231,'scriptPath':_0x17d86f,'version':_0x67123};removeReferences(_0x237641,null);return db['Plugin']['create'](_0x21b40f)[_0xd33b('0x2e')](function(_0x31edfa){var _0x2a1c0b={'role':_0x3e5a20[_0xd33b('0x99')][_0xd33b('0x9a')],'userProfileId':_0x3e5a20[_0xd33b('0x99')]['userProfileId']};if(!_0x2a1c0b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a1c0b[_0xd33b('0x9a')]==='user'){var _0x238fa1=_0x31edfa[_0xd33b('0x30')]({'plain':!![]});return db[_0xd33b('0x9b')][_0xd33b('0x52')]({'where':{'name':'Plugins','userProfileId':_0x2a1c0b[_0xd33b('0x9c')]},'raw':!![]})['then'](function(_0x4a2a99){if(_0x4a2a99&&_0x4a2a99[_0xd33b('0x9d')]===0x0){return db['UserProfileResource']['create']({'name':_0x238fa1[_0xd33b('0x34')],'resourceId':_0x238fa1['id'],'type':_0x4a2a99[_0xd33b('0x34')],'sectionId':_0x4a2a99['id']},{})[_0xd33b('0x2e')](function(){return _0x31edfa;});}else{return _0x31edfa;}})['catch'](function(_0x11f7f8){logger['error'](_0xd33b('0x9e'),_0x11f7f8);throw _0x11f7f8;});}return _0x31edfa;})[_0xd33b('0x2e')](respondWithResult(_0xe0820d,null))['catch'](handleError(_0xe0820d,null));}});}catch(_0x267028){_0xe0820d['status'](0x1f4)['send'](_0x267028);}};function removeReferences(_0x98730a,_0x26c528){try{if(_0x98730a){fs[_0xd33b('0x6e')](_0x98730a);logger['info'](_0xd33b('0x9f'));}if(_0x26c528){rimraf(_0x26c528,function(){});logger['info'](_0xd33b('0xa0'));}}catch(_0x18973d){logger[_0xd33b('0x33')](_0x18973d);}}exports['update']=function(_0x2c330d,_0x49cb02,_0x5c1d6b){return db[_0xd33b('0x36')][_0xd33b('0x52')]({'where':{'id':_0x2c330d[_0xd33b('0x4f')]['id']}})[_0xd33b('0x2e')](handleEntityNotFound(_0x49cb02,null))[_0xd33b('0x2e')](saveUpdates(_0x2c330d[_0xd33b('0x99')],null))[_0xd33b('0x2e')](respondWithResult(_0x49cb02,null))['catch'](handleError(_0x49cb02,null));};exports[_0xd33b('0xa1')]=function(_0x399385,_0x3a6698,_0x3d6976){return db[_0xd33b('0x36')][_0xd33b('0x52')]({'where':{'id':_0x399385[_0xd33b('0x4f')]['id']}})[_0xd33b('0x2e')](function(_0x15f6e1){if(_0x15f6e1){return _0x15f6e1['destroy']();}})[_0xd33b('0x2e')](function(_0x42be34){rimraf(path['join'](config[_0xd33b('0x56')],_0xd33b('0x57'),path[_0xd33b('0x65')](_0x42be34[_0xd33b('0x6')])),function(){});return _0x42be34;})[_0xd33b('0x2e')](handleEntityNotFound(_0x3a6698,null))['then'](respondWithStatusCode(_0x3a6698,null))[_0xd33b('0x53')](handleError(_0x3a6698,null));};exports[_0xd33b('0xa2')]=function(_0x2c7e4e,_0x2d32f8,_0xcb940){return BPromise[_0xd33b('0xa3')]()[_0xd33b('0x2e')](function(){if(!_0x2c7e4e[_0xd33b('0x3a')][_0xd33b('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2c7e4e[_0xd33b('0x3a')][_0xd33b('0xa4')]){throw new Error(_0xd33b('0xa5'));}var _0x5cd6c9=_0x2c7e4e[_0xd33b('0x3a')][_0xd33b('0xa6')]?_0x2c7e4e[_0xd33b('0x3a')][_0xd33b('0xa6')]+':'+_0x2c7e4e[_0xd33b('0x3a')]['port']:_0xd33b('0xa7')+_0x2c7e4e[_0xd33b('0x3a')][_0xd33b('0xa4')];var _0x5748f6=_0x2c7e4e[_0xd33b('0x3a')][_0xd33b('0x25')]?_0x2c7e4e['query']['json']:!![];var _0x437758=_0x2c7e4e[_0xd33b('0x3a')][_0xd33b('0xa8')]?_0x2c7e4e[_0xd33b('0x3a')]['encoding']:null;var _0x5dd405={'method':_0x2c7e4e[_0xd33b('0xa9')],'uri':util[_0xd33b('0x58')](_0xd33b('0xaa'),_0x5cd6c9,_0x2c7e4e[_0xd33b('0x3a')][_0xd33b('0x6')]),'json':_0x5748f6,'resolveWithFullResponse':!![],'encoding':_0x437758,'qs':_0x2c7e4e[_0xd33b('0x3a')]};if(_0x2c7e4e[_0xd33b('0xab')]){_0x5dd405[_0xd33b('0xab')]=_0x2c7e4e['headers'];if(_0x5dd405[_0xd33b('0xab')][_0xd33b('0xac')]){delete _0x5dd405[_0xd33b('0xab')]['content-length'];}}if(_0x5dd405[_0xd33b('0xab')]['content-type']){delete _0x5dd405[_0xd33b('0xab')][_0xd33b('0xad')];}return rp(_0x5dd405);})['then'](function(_0x3fca76){if(_0x3fca76){_0x2d32f8[_0xd33b('0xae')](_0x3fca76[_0xd33b('0xab')]);logger['info'](_0x3fca76[_0xd33b('0x99')]);if(_[_0xd33b('0xaf')](_0x2c7e4e['query']['path'],_0xd33b('0x54'))&&_0x3fca76[_0xd33b('0xb0')]==0x1f4){return _0x2d32f8[_0xd33b('0x22')](_0x3fca76[_0xd33b('0xb0')]);}else{return _0x2d32f8[_0xd33b('0x23')](_0x3fca76[_0xd33b('0xb0')])['send'](_0x3fca76[_0xd33b('0x99')]);}}else{return _0x2d32f8['sendStatus'](0xc8);}})['catch'](handleError(_0x2d32f8,null));};exports['webhookPost']=function(_0x4b24bd,_0x258c55,_0x66f990){return BPromise['resolve']()[_0xd33b('0x2e')](function(){if(!_0x4b24bd[_0xd33b('0x3a')][_0xd33b('0x6')]){throw new Error(_0xd33b('0xb1'));}if(!_0x4b24bd[_0xd33b('0x3a')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x26ed7e=_0x4b24bd[_0xd33b('0x3a')][_0xd33b('0xa6')]?_0x4b24bd['query'][_0xd33b('0xa6')]+':'+_0x4b24bd['query'][_0xd33b('0xa4')]:_0xd33b('0xa7')+_0x4b24bd[_0xd33b('0x3a')][_0xd33b('0xa4')];var _0x232e83=_0x4b24bd[_0xd33b('0x3a')][_0xd33b('0x25')]?_0x4b24bd[_0xd33b('0x3a')][_0xd33b('0x25')]:!![];var _0x3776ed=_0x4b24bd[_0xd33b('0x3a')]['encoding']?_0x4b24bd[_0xd33b('0x3a')][_0xd33b('0xa8')]:null;var _0x3903bb={'method':_0x4b24bd[_0xd33b('0xa9')],'uri':util[_0xd33b('0x58')](_0xd33b('0xaa'),_0x26ed7e,_0x4b24bd['query'][_0xd33b('0x6')]),'json':_0x232e83,'resolveWithFullResponse':!![],'encoding':_0x3776ed,'body':_0x4b24bd[_0xd33b('0x99')]};if(_0x4b24bd[_0xd33b('0xab')]){_0x3903bb[_0xd33b('0xab')]=_0x4b24bd['headers'];if(_0x3903bb['headers'][_0xd33b('0xac')]){delete _0x3903bb[_0xd33b('0xab')][_0xd33b('0xac')];}}if(_0x3903bb[_0xd33b('0xab')][_0xd33b('0xad')]){delete _0x3903bb[_0xd33b('0xab')][_0xd33b('0xad')];}return rp(_0x3903bb);})['then'](function(_0x3bab2e){if(_0x3bab2e){_0x258c55[_0xd33b('0xae')](_0x3bab2e[_0xd33b('0xab')]);logger['info'](_0x3bab2e['body']);return _0x258c55['status'](_0x3bab2e[_0xd33b('0xb0')])['send'](_0x3bab2e[_0xd33b('0x99')]);}else{return _0x258c55[_0xd33b('0x22')](0xc8);}})['catch'](handleError(_0x258c55,null));}; \ No newline at end of file +var _0x571b=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','Plugin','count','includeAll','include','rows','catch','show','attributes','find','params','root','server/files/plugins','format','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','**/*','dirname','join','node_modules/**/*','attachments/**/*','finalize','existsSync','download','%s.zip','unlinkSync','info','Temporary\x20file\x20removed','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','lstatSync','isFile','Invalid\x20plugin\x20structure','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','admin','views','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','test','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x571b,0x146));var _0xb571=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x571b[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0xb571('0x0'));var rimraf=require(_0xb571('0x1'));var zipdir=require(_0xb571('0x2'));var jsonpatch=require(_0xb571('0x3'));var rp=require('request-promise');var moment=require(_0xb571('0x4'));var BPromise=require(_0xb571('0x5'));var Mustache=require(_0xb571('0x6'));var util=require('util');var path=require(_0xb571('0x7'));var sox=require(_0xb571('0x8'));var csv=require(_0xb571('0x9'));var ejs=require(_0xb571('0xa'));var fs=require('fs');var fs_extra=require(_0xb571('0xb'));var _=require(_0xb571('0xc'));var squel=require(_0xb571('0xd'));var crypto=require(_0xb571('0xe'));var jsforce=require(_0xb571('0xf'));var deskjs=require(_0xb571('0x10'));var toCsv=require(_0xb571('0x9'));var querystring=require(_0xb571('0x11'));var Papa=require(_0xb571('0x12'));var extract=require(_0xb571('0x13'));var rimraf=require(_0xb571('0x1'));var archiver=require('archiver');var Redis=require(_0xb571('0x14'));var authService=require(_0xb571('0x15'));var qs=require(_0xb571('0x16'));var as=require(_0xb571('0x17'));var hardwareService=require(_0xb571('0x18'));var logger=require(_0xb571('0x19'))(_0xb571('0x1a'));var utils=require(_0xb571('0x1b'));var config=require(_0xb571('0x1c'));var licenseUtil=require(_0xb571('0x1d'));var db=require(_0xb571('0x1e'))['db'];config[_0xb571('0x1f')]=_[_0xb571('0x20')](config[_0xb571('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0xb571('0x21'))(new Redis(config[_0xb571('0x1f')]));require('./plugin.socket')[_0xb571('0x22')](socket);function respondWithStatusCode(_0x2b57e5,_0x583fce){_0x583fce=_0x583fce||0xcc;return function(_0x399fef){if(_0x399fef){return _0x2b57e5[_0xb571('0x23')](_0x583fce);}return _0x2b57e5[_0xb571('0x24')](_0x583fce)[_0xb571('0x25')]();};}function respondWithResult(_0x57829d,_0x488005){_0x488005=_0x488005||0xc8;return function(_0x4745ec){if(_0x4745ec){return _0x57829d[_0xb571('0x24')](_0x488005)[_0xb571('0x26')](_0x4745ec);}};}function respondWithFilteredResult(_0x5be5a6,_0x51394e){return function(_0x3ec0b2){if(_0x3ec0b2){var _0x11250c=typeof _0x51394e[_0xb571('0x27')]===_0xb571('0x28')&&typeof _0x51394e[_0xb571('0x29')]===_0xb571('0x28');var _0x3e3d91=_0x3ec0b2['count'];var _0x54b5f7=_0x11250c?0x0:_0x51394e['offset'];var _0x39da40=_0x11250c?_0x3ec0b2['count']:_0x51394e['offset']+_0x51394e[_0xb571('0x29')];var _0x21c88c;if(_0x39da40>=_0x3e3d91){_0x39da40=_0x3e3d91;_0x21c88c=0xc8;}else{_0x21c88c=0xce;}_0x5be5a6[_0xb571('0x24')](_0x21c88c);return _0x5be5a6[_0xb571('0x2a')]('Content-Range',_0x54b5f7+'-'+_0x39da40+'/'+_0x3e3d91)['json'](_0x3ec0b2);}return null;};}function patchUpdates(_0x1e7c64){return function(_0x2c0fc6){try{jsonpatch[_0xb571('0x2b')](_0x2c0fc6,_0x1e7c64,!![]);}catch(_0x14bb94){return BPromise[_0xb571('0x2c')](_0x14bb94);}return _0x2c0fc6[_0xb571('0x2d')]();};}function saveUpdates(_0x23cb6a,_0x2eb007){return function(_0x17d38b){if(_0x17d38b){return _0x17d38b[_0xb571('0x2e')](_0x23cb6a)['then'](function(_0x3a05d0){return _0x3a05d0;});}return null;};}function removeEntity(_0x4eb76b,_0x40d9fe){return function(_0xd39a59){if(_0xd39a59){return _0xd39a59[_0xb571('0x2f')]()[_0xb571('0x30')](function(){var _0x161476=_0xd39a59[_0xb571('0x31')]({'plain':!![]});var _0x4f9bed=_0xb571('0x32');return db[_0xb571('0x33')]['destroy']({'where':{'type':_0x4f9bed,'resourceId':_0x161476['id']}})[_0xb571('0x30')](function(){return _0xd39a59;});})[_0xb571('0x30')](function(){_0x4eb76b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x520fc4,_0x5b78f7){return function(_0x3dc82e){if(!_0x3dc82e){_0x520fc4[_0xb571('0x23')](0x194);}return _0x3dc82e;};}function handleError(_0x12a516,_0x5edfd3){_0x5edfd3=_0x5edfd3||0x1f4;return function(_0x14093e){logger[_0xb571('0x34')](_0x14093e[_0xb571('0x35')]);if(_0x14093e[_0xb571('0x36')]){delete _0x14093e[_0xb571('0x36')];}_0x12a516[_0xb571('0x24')](_0x5edfd3)[_0xb571('0x37')](_0x14093e);};}exports['index']=function(_0xa06b7c,_0x48b16b){var _0x446cb8={},_0x416fd2={},_0x1c7531={'count':0x0,'rows':[]};var _0x2d362e=_['map'](db['Plugin'][_0xb571('0x38')],function(_0x22f663){return{'name':_0x22f663[_0xb571('0x39')],'type':_0x22f663[_0xb571('0x3a')][_0xb571('0x3b')]};});_0x416fd2[_0xb571('0x3c')]=_[_0xb571('0x3d')](_0x2d362e,'name');_0x416fd2[_0xb571('0x3e')]=_[_0xb571('0x3f')](_0xa06b7c['query']);_0x416fd2['filters']=_[_0xb571('0x40')](_0x416fd2[_0xb571('0x3c')],_0x416fd2['query']);_0x446cb8['attributes']=_[_0xb571('0x40')](_0x416fd2[_0xb571('0x3c')],qs[_0xb571('0x41')](_0xa06b7c[_0xb571('0x3e')][_0xb571('0x41')]));_0x446cb8['attributes']=_0x446cb8['attributes'][_0xb571('0x42')]?_0x446cb8['attributes']:_0x416fd2['model'];if(!_0xa06b7c[_0xb571('0x3e')][_0xb571('0x43')]('nolimit')){_0x446cb8['limit']=qs[_0xb571('0x29')](_0xa06b7c[_0xb571('0x3e')]['limit']);_0x446cb8[_0xb571('0x27')]=qs[_0xb571('0x27')](_0xa06b7c[_0xb571('0x3e')][_0xb571('0x27')]);}_0x446cb8[_0xb571('0x44')]=qs[_0xb571('0x45')](_0xa06b7c[_0xb571('0x3e')][_0xb571('0x45')]);_0x446cb8[_0xb571('0x46')]=qs[_0xb571('0x47')](_[_0xb571('0x48')](_0xa06b7c['query'],_0x416fd2['filters']),_0x2d362e);if(_0xa06b7c[_0xb571('0x3e')][_0xb571('0x49')]){_0x446cb8[_0xb571('0x46')]=_['merge'](_0x446cb8[_0xb571('0x46')],{'$or':_[_0xb571('0x3d')](_0x2d362e,function(_0x2c45ce){if(_0x2c45ce['type']!=='VIRTUAL'){var _0xc78cbd={};_0xc78cbd[_0x2c45ce[_0xb571('0x36')]]={'$like':'%'+_0xa06b7c[_0xb571('0x3e')][_0xb571('0x49')]+'%'};return _0xc78cbd;}})});}_0x446cb8=_[_0xb571('0x4a')]({},_0x446cb8,_0xa06b7c[_0xb571('0x4b')]);var _0x2eb5c2={'where':_0x446cb8[_0xb571('0x46')]};return db[_0xb571('0x4c')][_0xb571('0x4d')](_0x2eb5c2)[_0xb571('0x30')](function(_0x24621e){_0x1c7531[_0xb571('0x4d')]=_0x24621e;if(_0xa06b7c[_0xb571('0x3e')][_0xb571('0x4e')]){_0x446cb8[_0xb571('0x4f')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x446cb8);})[_0xb571('0x30')](function(_0x4b9891){_0x1c7531[_0xb571('0x50')]=_0x4b9891;return _0x1c7531;})['then'](respondWithFilteredResult(_0x48b16b,_0x446cb8))[_0xb571('0x51')](handleError(_0x48b16b,null));};exports[_0xb571('0x52')]=function(_0x36c36d,_0x2e5d80){var _0x42e761={'raw':!![],'where':{'id':_0x36c36d['params']['id']}},_0x56003e={};_0x56003e[_0xb571('0x3c')]=_[_0xb571('0x3f')](db[_0xb571('0x4c')][_0xb571('0x38')]);_0x56003e['query']=_[_0xb571('0x3f')](_0x36c36d[_0xb571('0x3e')]);_0x56003e[_0xb571('0x47')]=_['intersection'](_0x56003e[_0xb571('0x3c')],_0x56003e['query']);_0x42e761[_0xb571('0x53')]=_['intersection'](_0x56003e['model'],qs['fields'](_0x36c36d[_0xb571('0x3e')][_0xb571('0x41')]));_0x42e761[_0xb571('0x53')]=_0x42e761[_0xb571('0x53')]['length']?_0x42e761['attributes']:_0x56003e[_0xb571('0x3c')];if(_0x36c36d[_0xb571('0x3e')][_0xb571('0x4e')]){_0x42e761[_0xb571('0x4f')]=[{'all':!![]}];}_0x42e761=_[_0xb571('0x4a')]({},_0x42e761,_0x36c36d['options']);return db[_0xb571('0x4c')][_0xb571('0x54')](_0x42e761)[_0xb571('0x30')](handleEntityNotFound(_0x2e5d80,null))[_0xb571('0x30')](respondWithResult(_0x2e5d80,null))[_0xb571('0x51')](handleError(_0x2e5d80,null));};exports['download']=function(_0x46b420,_0x19fa74,_0x169129){return db[_0xb571('0x4c')]['find']({'where':{'id':_0x46b420[_0xb571('0x55')]['id']},'attributes':[_0xb571('0x36'),_0xb571('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x19fa74,null))[_0xb571('0x30')](function(_0xaeb902){if(_0xaeb902){var _0x1f2cf4=path['join'](config[_0xb571('0x56')],_0xb571('0x57'),util[_0xb571('0x58')]('%s.zip',path[_0xb571('0x59')](_0xaeb902[_0xb571('0x7')])));var _0x283f0f=fs[_0xb571('0x5a')](_0x1f2cf4);var _0x3cb515=archiver(_0xb571('0x5b'),{'zlib':{'level':0x9}});_0x3cb515['on'](_0xb571('0x5c'),function(_0x22218d){if(_0x22218d[_0xb571('0x5d')]===_0xb571('0x5e')){logger['error'](_0x22218d);}else{throw new db[(_0xb571('0x5f'))]['Error'](_0xb571('0x60'));}});_0x3cb515['on'](_0xb571('0x34'),function(_0x38ff92){throw new db[(_0xb571('0x5f'))][(_0xb571('0x61'))](_0xb571('0x60'));});_0x3cb515[_0xb571('0x62')](_0x283f0f);_0x3cb515['glob'](_0xb571('0x63'),{'cwd':path['join'](config[_0xb571('0x56')],'server/files/plugins',path[_0xb571('0x64')](_0xaeb902['path'])),'ignore':[path[_0xb571('0x65')](path[_0xb571('0x59')](_0xaeb902[_0xb571('0x7')]),_0xb571('0x66')),path[_0xb571('0x65')](path['basename'](_0xaeb902[_0xb571('0x7')]),_0xb571('0x67'))],'nodir':!![]})[_0xb571('0x68')]();_0x283f0f['on']('close',function(){if(!fs[_0xb571('0x69')](_0x1f2cf4)){throw new db[(_0xb571('0x5f'))]['Error']('Plugin\x20not\x20found');}return _0x19fa74[_0xb571('0x6a')](_0x1f2cf4,util[_0xb571('0x58')](_0xb571('0x6b'),path['basename'](_0xaeb902[_0xb571('0x7')])),function(_0x2a8e65){if(_0x2a8e65){throw new db['Sequelize']['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb571('0x6c')](_0x1f2cf4);logger[_0xb571('0x6d')]('Download\x20completed');logger[_0xb571('0x6d')](_0xb571('0x6e'));});});}return null;})[_0xb571('0x51')](handleError(_0x19fa74,null));};exports['upload']=function(_0x138501,_0x50fca7,_0x3773b4){var _0x4d949e=path[_0xb571('0x59')](_0x138501['file'][_0xb571('0x6f')],path[_0xb571('0x70')](_0x138501[_0xb571('0x71')][_0xb571('0x6f')]));var _0x2b5c7d=path[_0xb571('0x65')](config['root'],_0xb571('0x57'),_0x138501[_0xb571('0x71')]['filename']);var _0x1c3a77=path[_0xb571('0x65')](config[_0xb571('0x56')],_0xb571('0x57'),_0x4d949e);logger[_0xb571('0x6d')](_0xb571('0x72'),_0x2b5c7d);logger[_0xb571('0x6d')]('Plugin\x20upload\x20destination:\x20%s',_0x1c3a77);try{fs[_0xb571('0x73')](_0x2b5c7d,parseInt(_0xb571('0x74'),0x8));extract(_0x2b5c7d,{'dir':_0x1c3a77},function(_0x506db9){if(_0x506db9){logger[_0xb571('0x34')](_0x506db9);handleError(_0x506db9,!![]);};var _0x11e12e=fs[_0xb571('0x75')](_0x1c3a77);if(_0x11e12e[_0xb571('0x42')]>0x1){removeReferences(_0x2b5c7d,_0x1c3a77);logger[_0xb571('0x34')]('Invalid\x20plugin\x20structure');return _0x3773b4(new Error('Invalid\x20plugin\x20structure'));}var _0x313a9a=fs[_0xb571('0x76')](path[_0xb571('0x65')](_0x1c3a77,_0x11e12e[0x0]));if(_0x313a9a[_0xb571('0x77')]()){removeReferences(_0x2b5c7d,_0x1c3a77);logger[_0xb571('0x34')](_0xb571('0x78'));return _0x3773b4(new Error(_0xb571('0x78')));}if(_0x313a9a['isDirectory']()){var _0x17b18e=fs[_0xb571('0x75')](path[_0xb571('0x65')](_0x1c3a77,_0x11e12e[0x0]));if(_0x17b18e[_0xb571('0x42')]===0x0){removeReferences(_0x2b5c7d,_0x1c3a77);logger['error'](_0xb571('0x78'));return _0x3773b4(new Error('Invalid\x20plugin\x20structure'));}var _0x541ffd=_0x17b18e[_0xb571('0x79')](function(_0x14739a){return _0x14739a===_0xb571('0x7a');});if(!_0x541ffd){return _0x3773b4(new Error(_0xb571('0x7b')));}var _0x56fa54=fs[_0xb571('0x7c')](path[_0xb571('0x65')](_0x1c3a77,_0x11e12e[0x0],'manifest.json'));var _0x307581=JSON[_0xb571('0x7d')](_0x56fa54);if(_0xb571('0x28')==typeof _0x307581['name']){return _0x3773b4(new Error(_0xb571('0x7e')));}if(_0xb571('0x28')==typeof _0x307581['type']){return _0x3773b4(new Error(_0xb571('0x7f')));}if(_0xb571('0x28')==typeof _0x307581[_0xb571('0x80')]){return _0x3773b4(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xb571('0x28')==typeof _0x307581[_0xb571('0x81')]){return _0x3773b4(new Error(_0xb571('0x82')));}if(_0x307581['type']===_0xb571('0x83')){if(_0xb571('0x28')==typeof _0x307581[_0xb571('0x81')]['views']){return _0x3773b4(new Error(_0xb571('0x84')));}if(_0xb571('0x28')==typeof _0x307581[_0xb571('0x81')]['views'][_0xb571('0x85')]&&_0xb571('0x28')==typeof _0x307581[_0xb571('0x81')][_0xb571('0x86')]['agent']){return _0x3773b4(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x307581['type']===_0xb571('0x87')){if(_0xb571('0x28')==typeof _0x307581[_0xb571('0x81')][_0xb571('0x88')]){return _0x3773b4(new Error(_0xb571('0x89')));}if(_0xb571('0x28')==typeof _0x307581[_0xb571('0x81')]['scriptPath']){return _0x3773b4(new Error(_0xb571('0x8a')));}}else{return _0x3773b4(new Error(_0xb571('0x8b')));}var _0x3f0296=_0x307581[_0xb571('0x36')];var _0x16825f=_0x307581[_0xb571('0x8c')];var _0x430761=_0x307581['type'];var _0xf7025e=_0x307581['sidebar']?_0x307581['sidebar']:_0xb571('0x8d');var _0x322575=_0x307581[_0xb571('0x8e')]?_0x307581[_0xb571('0x8e')]:_0xb571('0x8f');var _0x14ef57='';var _0x16e774='';var _0xd160d3='';var _0x570a82='';var _0x50a391=_0x307581[_0xb571('0x80')];if(_0x430761===_0xb571('0x83')){if(_0xb571('0x28')!=typeof _0x307581[_0xb571('0x81')]['views'][_0xb571('0x85')]){var _0x2d221e=_0x307581['parameters'][_0xb571('0x86')][_0xb571('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2d221e)){_0x14ef57=path[_0xb571('0x65')]('plugins',_0x4d949e,_0x11e12e[0x0],_0x2d221e);}else{_0x14ef57=_0x2d221e;}}else{logger[_0xb571('0x6d')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x307581[_0xb571('0x81')][_0xb571('0x86')][_0xb571('0x90')]){var _0x268035=_0x307581[_0xb571('0x81')][_0xb571('0x86')][_0xb571('0x90')];if(!/^(f|ht)tps?:\/\//i['test'](_0x268035)){_0x16e774=path[_0xb571('0x65')](_0xb571('0x91'),_0x4d949e,_0x11e12e[0x0],_0x268035);}else{_0x16e774=_0x268035;}}else{logger[_0xb571('0x6d')](_0xb571('0x92'));}}else if(_0x430761===_0xb571('0x87')){_0xd160d3=_0x307581[_0xb571('0x81')][_0xb571('0x88')];_0x570a82=_0x307581[_0xb571('0x81')][_0xb571('0x93')];if(_0xb571('0x28')!=typeof _0x307581[_0xb571('0x81')][_0xb571('0x86')]){if(_0xb571('0x28')!=typeof _0x307581[_0xb571('0x81')][_0xb571('0x86')][_0xb571('0x85')]){var _0x2d221e=_0x307581[_0xb571('0x81')][_0xb571('0x86')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xb571('0x94')](_0x2d221e)){_0x14ef57=path['join'](_0xb571('0x91'),_0x4d949e,_0x11e12e[0x0],_0x2d221e);}else{_0x14ef57=_0x2d221e;}}if(_0xb571('0x28')!=typeof _0x307581['parameters']['views'][_0xb571('0x90')]){var _0x268035=_0x307581[_0xb571('0x81')][_0xb571('0x86')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xb571('0x94')](_0x268035)){_0x16e774=path[_0xb571('0x65')](_0xb571('0x91'),_0x4d949e,_0x11e12e[0x0],_0x268035);}else{_0x16e774=_0x268035;}}}}var _0x2e7ff4={'name':_0x3f0296,'description':_0x16825f,'path':path[_0xb571('0x65')](_0x4d949e,_0x11e12e[0x0]),'type':_0x430761,'sidebar':_0xf7025e,'icon':_0x322575,'adminUrl':_0x14ef57,'agentUrl':_0x16e774,'scriptName':_0xd160d3,'scriptPath':_0x570a82,'version':_0x50a391};removeReferences(_0x2b5c7d,null);return db[_0xb571('0x4c')]['create'](_0x2e7ff4)[_0xb571('0x30')](function(_0x5ec763){var _0x301ea1={'role':_0x138501[_0xb571('0x95')][_0xb571('0x96')],'userProfileId':_0x138501[_0xb571('0x95')][_0xb571('0x97')]};if(!_0x301ea1)throw new Error(_0xb571('0x98'));if(_0x301ea1[_0xb571('0x96')]===_0xb571('0x99')){var _0x170a0d=_0x5ec763[_0xb571('0x31')]({'plain':!![]});return db[_0xb571('0x9a')]['find']({'where':{'name':_0xb571('0x32'),'userProfileId':_0x301ea1[_0xb571('0x97')]},'raw':!![]})[_0xb571('0x30')](function(_0x13aff3){if(_0x13aff3&&_0x13aff3['autoAssociation']===0x0){return db[_0xb571('0x33')][_0xb571('0x9b')]({'name':_0x170a0d['name'],'resourceId':_0x170a0d['id'],'type':_0x13aff3['name'],'sectionId':_0x13aff3['id']},{})[_0xb571('0x30')](function(){return _0x5ec763;});}else{return _0x5ec763;}})[_0xb571('0x51')](function(_0x2e009c){logger[_0xb571('0x34')](_0xb571('0x9c'),_0x2e009c);throw _0x2e009c;});}return _0x5ec763;})[_0xb571('0x30')](respondWithResult(_0x50fca7,null))[_0xb571('0x51')](handleError(_0x50fca7,null));}});}catch(_0xa9d10a){_0x50fca7['status'](0x1f4)[_0xb571('0x37')](_0xa9d10a);}};function removeReferences(_0x40087a,_0x40b0e9){try{if(_0x40087a){fs[_0xb571('0x6c')](_0x40087a);logger[_0xb571('0x6d')](_0xb571('0x9d'));}if(_0x40b0e9){rimraf(_0x40b0e9,function(){});logger[_0xb571('0x6d')](_0xb571('0x9e'));}}catch(_0x4a8d37){logger[_0xb571('0x34')](_0x4a8d37);}}exports[_0xb571('0x2e')]=function(_0x2273c9,_0x193657,_0x2a6d05){return db['Plugin'][_0xb571('0x54')]({'where':{'id':_0x2273c9[_0xb571('0x55')]['id']}})['then'](handleEntityNotFound(_0x193657,null))[_0xb571('0x30')](saveUpdates(_0x2273c9['body'],null))[_0xb571('0x30')](respondWithResult(_0x193657,null))[_0xb571('0x51')](handleError(_0x193657,null));};exports[_0xb571('0x9f')]=function(_0x3b8213,_0x2cf553,_0x48d1ee){return db[_0xb571('0x4c')][_0xb571('0x54')]({'where':{'id':_0x3b8213['params']['id']}})[_0xb571('0x30')](function(_0xd3ed21){if(_0xd3ed21){return _0xd3ed21[_0xb571('0x2f')]();}})[_0xb571('0x30')](function(_0x1f694f){rimraf(path[_0xb571('0x65')](config[_0xb571('0x56')],_0xb571('0x57'),path[_0xb571('0x64')](_0x1f694f[_0xb571('0x7')])),function(){});return _0x1f694f;})[_0xb571('0x30')](handleEntityNotFound(_0x2cf553,null))[_0xb571('0x30')](respondWithStatusCode(_0x2cf553,null))['catch'](handleError(_0x2cf553,null));};exports[_0xb571('0xa0')]=function(_0x48ef7f,_0x1819e3,_0xc1c298){return BPromise['resolve']()[_0xb571('0x30')](function(){if(!_0x48ef7f[_0xb571('0x3e')][_0xb571('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x48ef7f[_0xb571('0x3e')][_0xb571('0xa1')]){throw new Error(_0xb571('0xa2'));}var _0x1045ae=_0x48ef7f['query'][_0xb571('0xa3')]?_0x48ef7f[_0xb571('0x3e')]['hostname']+':'+_0x48ef7f[_0xb571('0x3e')][_0xb571('0xa1')]:_0xb571('0xa4')+_0x48ef7f[_0xb571('0x3e')][_0xb571('0xa1')];var _0x4e8ba9=_0x48ef7f[_0xb571('0x3e')][_0xb571('0x26')]?_0x48ef7f['query'][_0xb571('0x26')]:!![];var _0x403654=_0x48ef7f[_0xb571('0x3e')][_0xb571('0xa5')]?_0x48ef7f[_0xb571('0x3e')][_0xb571('0xa5')]:null;var _0x476879={'method':_0x48ef7f[_0xb571('0xa6')],'uri':util[_0xb571('0x58')]('%s%s',_0x1045ae,_0x48ef7f[_0xb571('0x3e')][_0xb571('0x7')]),'json':_0x4e8ba9,'resolveWithFullResponse':!![],'encoding':_0x403654,'qs':_0x48ef7f[_0xb571('0x3e')]};if(_0x48ef7f[_0xb571('0xa7')]){_0x476879[_0xb571('0xa7')]=_0x48ef7f['headers'];if(_0x476879['headers']['content-length']){delete _0x476879[_0xb571('0xa7')][_0xb571('0xa8')];}}if(_0x476879[_0xb571('0xa7')][_0xb571('0xa9')]){delete _0x476879['headers']['content-type'];}return rp(_0x476879);})[_0xb571('0x30')](function(_0x3adebf){if(_0x3adebf){_0x1819e3[_0xb571('0x2a')](_0x3adebf[_0xb571('0xa7')]);logger[_0xb571('0x6d')](_0x3adebf[_0xb571('0x95')]);if(_[_0xb571('0xaa')](_0x48ef7f[_0xb571('0x3e')][_0xb571('0x7')],_0xb571('0x6a'))&&_0x3adebf[_0xb571('0xab')]==0x1f4){return _0x1819e3['sendStatus'](_0x3adebf[_0xb571('0xab')]);}else{return _0x1819e3[_0xb571('0x24')](_0x3adebf['statusCode'])['send'](_0x3adebf[_0xb571('0x95')]);}}else{return _0x1819e3['sendStatus'](0xc8);}})[_0xb571('0x51')](handleError(_0x1819e3,null));};exports[_0xb571('0xac')]=function(_0x364e09,_0x2a54cd,_0x48c87a){return BPromise[_0xb571('0xad')]()['then'](function(){if(!_0x364e09['query'][_0xb571('0x7')]){throw new Error(_0xb571('0xae'));}if(!_0x364e09['query'][_0xb571('0xa1')]){throw new Error(_0xb571('0xa2'));}var _0x3001c5=_0x364e09[_0xb571('0x3e')][_0xb571('0xa3')]?_0x364e09[_0xb571('0x3e')][_0xb571('0xa3')]+':'+_0x364e09[_0xb571('0x3e')]['port']:_0xb571('0xa4')+_0x364e09[_0xb571('0x3e')][_0xb571('0xa1')];var _0xceabad=_0x364e09['query']['json']?_0x364e09[_0xb571('0x3e')][_0xb571('0x26')]:!![];var _0xfc145e=_0x364e09[_0xb571('0x3e')][_0xb571('0xa5')]?_0x364e09['query'][_0xb571('0xa5')]:null;var _0x3f54d4={'method':_0x364e09[_0xb571('0xa6')],'uri':util[_0xb571('0x58')](_0xb571('0xaf'),_0x3001c5,_0x364e09[_0xb571('0x3e')]['path']),'json':_0xceabad,'resolveWithFullResponse':!![],'encoding':_0xfc145e,'body':_0x364e09[_0xb571('0x95')]};if(_0x364e09[_0xb571('0xa7')]){_0x3f54d4[_0xb571('0xa7')]=_0x364e09[_0xb571('0xa7')];if(_0x3f54d4[_0xb571('0xa7')]['content-length']){delete _0x3f54d4[_0xb571('0xa7')][_0xb571('0xa8')];}}if(_0x3f54d4['headers']['content-type']){delete _0x3f54d4[_0xb571('0xa7')][_0xb571('0xa9')];}return rp(_0x3f54d4);})[_0xb571('0x30')](function(_0x40124d){if(_0x40124d){_0x2a54cd[_0xb571('0x2a')](_0x40124d[_0xb571('0xa7')]);logger[_0xb571('0x6d')](_0x40124d[_0xb571('0x95')]);return _0x2a54cd['status'](_0x40124d[_0xb571('0xab')])[_0xb571('0x37')](_0x40124d['body']);}else{return _0x2a54cd[_0xb571('0x23')](0xc8);}})['catch'](handleError(_0x2a54cd,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 4fde40d..ec5ec84 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 _0x6b4e=['emit','hasOwnProperty','hook','exports','../../mysqldb','remove'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x5904bb,_0x4de074){_0x5904bb=_0x5904bb-0x0;var _0x38d127=_0x6b4e[_0x5904bb];return _0x38d127;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xe6b4('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe6b4('0x1')};function emitEvent(_0x3be9b1){return function(_0x1aedc5,_0x344db1,_0x436fc0){PluginEvents[_0xe6b4('0x2')](_0x3be9b1+':'+_0x1aedc5['id'],_0x1aedc5);PluginEvents['emit'](_0x3be9b1,_0x1aedc5);_0x436fc0(null);};}for(var e in events){if(events[_0xe6b4('0x3')](e)){var event=events[e];Plugin[_0xe6b4('0x4')](e,emitEvent(event));}}module[_0xe6b4('0x5')]=PluginEvents; \ No newline at end of file +var _0x36f3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','Plugin'];(function(_0x48bbe3,_0x1f492f){var _0x332b64=function(_0x2c06fe){while(--_0x2c06fe){_0x48bbe3['push'](_0x48bbe3['shift']());}};_0x332b64(++_0x1f492f);}(_0x36f3,0xe6));var _0x336f=function(_0x34c99a,_0x27aa22){_0x34c99a=_0x34c99a-0x0;var _0x4da4d9=_0x36f3[_0x34c99a];return _0x4da4d9;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x336f('0x0'))['db'][_0x336f('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x336f('0x2')](0x0);var events={'afterCreate':_0x336f('0x3'),'afterUpdate':_0x336f('0x4'),'afterDestroy':_0x336f('0x5')};function emitEvent(_0xd7d95a){return function(_0x475ff4,_0xfe7edc,_0x590b2b){PluginEvents[_0x336f('0x6')](_0xd7d95a+':'+_0x475ff4['id'],_0x475ff4);PluginEvents[_0x336f('0x6')](_0xd7d95a,_0x475ff4);_0x590b2b(null);};}for(var e in events){if(events[_0x336f('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index a41dd78..8461fc7 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 _0xa92e=['exports','define','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4225eb,_0x2ea5ac){var _0x2ca938=function(_0x8a82a5){while(--_0x8a82a5){_0x4225eb['push'](_0x4225eb['shift']());}};_0x2ca938(++_0x2ea5ac);}(_0xa92e,0x1e5));var _0xea92=function(_0x451f4e,_0x118aa3){_0x451f4e=_0x451f4e-0x0;var _0x456fd6=_0xa92e[_0x451f4e];return _0x456fd6;};'use strict';var _=require(_0xea92('0x0'));var util=require('util');var logger=require(_0xea92('0x1'))(_0xea92('0x2'));var moment=require(_0xea92('0x3'));var BPromise=require(_0xea92('0x4'));var rp=require(_0xea92('0x5'));var fs=require('fs');var path=require(_0xea92('0x6'));var rimraf=require(_0xea92('0x7'));var config=require(_0xea92('0x8'));var attributes=require('./plugin.attributes');module[_0xea92('0x9')]=function(_0x786b1,_0x39ddce){return _0x786b1[_0xea92('0xa')](_0xea92('0xb'),attributes,{'tableName':_0xea92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa992=['bluebird','path','../../config/environment','exports','define','Plugin','plugins','lodash','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa992,0xc4));var _0x2a99=function(_0x14d780,_0x28cffc){_0x14d780=_0x14d780-0x0;var _0x59b8fe=_0xa992[_0x14d780];return _0x59b8fe;};'use strict';var _=require(_0x2a99('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2a99('0x1'));var BPromise=require(_0x2a99('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a99('0x3'));var rimraf=require('rimraf');var config=require(_0x2a99('0x4'));var attributes=require('./plugin.attributes');module[_0x2a99('0x5')]=function(_0x47fb49,_0x44f7a1){return _0x47fb49[_0x2a99('0x6')](_0x2a99('0x7'),attributes,{'tableName':_0x2a99('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 bf89763..0b69983 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 _0xe62e=['Plugin,\x20%s,\x20%s','message','result','CreatePlugin','Plugin','create','options','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0xe62e,0x1ac));var _0xee62=function(_0x12cfdb,_0x5bd754){_0x12cfdb=_0x12cfdb-0x0;var _0x211ad5=_0xe62e[_0x12cfdb];return _0x211ad5;};'use strict';var _=require(_0xee62('0x0'));var util=require(_0xee62('0x1'));var moment=require(_0xee62('0x2'));var BPromise=require(_0xee62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee62('0x4'));var db=require(_0xee62('0x5'))['db'];var utils=require(_0xee62('0x6'));var logger=require(_0xee62('0x7'))(_0xee62('0x8'));var config=require(_0xee62('0x9'));var jayson=require(_0xee62('0xa'));var client=jayson[_0xee62('0xb')][_0xee62('0xc')]({'port':0x232a});config[_0xee62('0xd')]=_['defaults'](config[_0xee62('0xd')],{'host':_0xee62('0xe'),'port':0x18eb});var socket=require(_0xee62('0xf'))(new Redis(config[_0xee62('0xd')]));require(_0xee62('0x10'))[_0xee62('0x11')](socket);function respondWithRpcPromise(_0x15be4d,_0x32336c,_0x220847){return new BPromise(function(_0x563e73,_0x5942e7){return client[_0xee62('0x12')](_0x15be4d,_0x220847)[_0xee62('0x13')](function(_0x42d56e){logger[_0xee62('0x14')]('Plugin,\x20%s,\x20%s',_0x32336c,_0xee62('0x15'));logger[_0xee62('0x16')](_0xee62('0x17'),_0x32336c,_0xee62('0x15'),JSON[_0xee62('0x18')](_0x42d56e));if(_0x42d56e[_0xee62('0x19')]){if(_0x42d56e[_0xee62('0x19')][_0xee62('0x1a')]===0x1f4){logger['error'](_0xee62('0x1b'),_0x32336c,_0x42d56e[_0xee62('0x19')][_0xee62('0x1c')]);return _0x5942e7(_0x42d56e['error']['message']);}logger['error'](_0xee62('0x1b'),_0x32336c,_0x42d56e['error']['message']);return _0x563e73(_0x42d56e['error'][_0xee62('0x1c')]);}else{logger[_0xee62('0x14')](_0xee62('0x1b'),_0x32336c,'request\x20sent');_0x563e73(_0x42d56e[_0xee62('0x1d')][_0xee62('0x1c')]);}})['catch'](function(_0xc83573){logger[_0xee62('0x19')](_0xee62('0x1b'),_0x32336c,_0xc83573);_0x5942e7(_0xc83573);});});}exports[_0xee62('0x1e')]=function(_0x485358){var _0x578f7f=this;return new Promise(function(_0x457f52,_0x41466b){return db[_0xee62('0x1f')][_0xee62('0x20')](_0x485358['body'],{'raw':_0x485358[_0xee62('0x21')]?_0x485358[_0xee62('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xee62('0x13')](function(_0x2f657e){logger[_0xee62('0x14')](_0xee62('0x1e'),_0x485358);logger[_0xee62('0x16')](_0xee62('0x1e'),_0x485358,JSON[_0xee62('0x18')](_0x2f657e));_0x457f52(_0x2f657e);})[_0xee62('0x22')](function(_0xbe797c){logger[_0xee62('0x19')]('CreatePlugin',_0xbe797c['message'],_0x485358);_0x41466b(_0x578f7f[_0xee62('0x19')](0x1f4,_0xbe797c[_0xee62('0x1c')]));});});}; \ No newline at end of file +var _0x6a47=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./plugin.socket','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','catch','Plugin','options','CreatePlugin','lodash','util','moment','bluebird','randomstring'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x6a47,0x112));var _0x76a4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6a47[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x76a4('0x0'));var util=require(_0x76a4('0x1'));var moment=require(_0x76a4('0x2'));var BPromise=require(_0x76a4('0x3'));var rs=require(_0x76a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76a4('0x5'))['db'];var utils=require(_0x76a4('0x6'));var logger=require('../../config/logger')(_0x76a4('0x7'));var config=require(_0x76a4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x76a4('0x9')][_0x76a4('0xa')]({'port':0x232a});config['redis']=_[_0x76a4('0xb')](config[_0x76a4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x76a4('0xd'))(new Redis(config[_0x76a4('0xc')]));require(_0x76a4('0xe'))['register'](socket);function respondWithRpcPromise(_0x28e872,_0x43922a,_0x258d2f){return new BPromise(function(_0x1d0f7d,_0x175907){return client[_0x76a4('0xf')](_0x28e872,_0x258d2f)[_0x76a4('0x10')](function(_0x257ed6){logger[_0x76a4('0x11')]('Plugin,\x20%s,\x20%s',_0x43922a,_0x76a4('0x12'));logger[_0x76a4('0x13')](_0x76a4('0x14'),_0x43922a,'request\x20sent',JSON[_0x76a4('0x15')](_0x257ed6));if(_0x257ed6[_0x76a4('0x16')]){if(_0x257ed6['error'][_0x76a4('0x17')]===0x1f4){logger[_0x76a4('0x16')]('Plugin,\x20%s,\x20%s',_0x43922a,_0x257ed6['error'][_0x76a4('0x18')]);return _0x175907(_0x257ed6[_0x76a4('0x16')]['message']);}logger[_0x76a4('0x16')](_0x76a4('0x19'),_0x43922a,_0x257ed6[_0x76a4('0x16')][_0x76a4('0x18')]);return _0x1d0f7d(_0x257ed6[_0x76a4('0x16')][_0x76a4('0x18')]);}else{logger[_0x76a4('0x11')](_0x76a4('0x19'),_0x43922a,'request\x20sent');_0x1d0f7d(_0x257ed6[_0x76a4('0x1a')]['message']);}})[_0x76a4('0x1b')](function(_0x53a2ec){logger['error'](_0x76a4('0x19'),_0x43922a,_0x53a2ec);_0x175907(_0x53a2ec);});});}exports['CreatePlugin']=function(_0x470067){var _0x2b8571=this;return new Promise(function(_0x2f417e,_0x30c770){return db[_0x76a4('0x1c')]['create'](_0x470067['body'],{'raw':_0x470067[_0x76a4('0x1d')]?_0x470067[_0x76a4('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x76a4('0x10')](function(_0x3eee72){logger[_0x76a4('0x11')](_0x76a4('0x1e'),_0x470067);logger[_0x76a4('0x13')](_0x76a4('0x1e'),_0x470067,JSON[_0x76a4('0x15')](_0x3eee72));_0x2f417e(_0x3eee72);})['catch'](function(_0x55a1e8){logger['error']('CreatePlugin',_0x55a1e8[_0x76a4('0x18')],_0x470067);_0x30c770(_0x2b8571[_0x76a4('0x16')](0x1f4,_0x55a1e8[_0x76a4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 325bcce..2ff71aa 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 _0x0266=['./plugin.events','save','remove','update','emit','removeListener','length','plugin:'];(function(_0x131c9b,_0x154062){var _0x367605=function(_0x2b0285){while(--_0x2b0285){_0x131c9b['push'](_0x131c9b['shift']());}};_0x367605(++_0x154062);}(_0x0266,0x1c0));var _0x6026=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x0266[_0x4e676e];return _0x336a3c;};'use strict';var PluginEvents=require(_0x6026('0x0'));var events=[_0x6026('0x1'),_0x6026('0x2'),_0x6026('0x3')];function createListener(_0x2842de,_0x4fd507){return function(_0x50dceb){_0x4fd507[_0x6026('0x4')](_0x2842de,_0x50dceb);};}function removeListener(_0x1a3d65,_0x374309){return function(){PluginEvents[_0x6026('0x5')](_0x1a3d65,_0x374309);};}exports['register']=function(_0x55eaf4){for(var _0x955b3a=0x0,_0x5362ad=events[_0x6026('0x6')];_0x955b3a<_0x5362ad;_0x955b3a++){var _0x3bcb90=events[_0x955b3a];var _0x345600=createListener(_0x6026('0x7')+_0x3bcb90,_0x55eaf4);PluginEvents['on'](_0x3bcb90,_0x345600);}}; \ No newline at end of file +var _0x083a=['save','emit','removeListener','register','plugin:','./plugin.events'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x083a,0x65));var _0xa083=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x083a[_0xd0b415];return _0x2bdf2c;};'use strict';var PluginEvents=require(_0xa083('0x0'));var events=[_0xa083('0x1'),'remove','update'];function createListener(_0x2fbdf9,_0x14e0a4){return function(_0x108036){_0x14e0a4[_0xa083('0x2')](_0x2fbdf9,_0x108036);};}function removeListener(_0x6cf22d,_0x1f2730){return function(){PluginEvents[_0xa083('0x3')](_0x6cf22d,_0x1f2730);};}exports[_0xa083('0x4')]=function(_0x446d29){for(var _0x38d143=0x0,_0xe3addd=events['length'];_0x38d143<_0xe3addd;_0x38d143++){var _0x315225=events[_0x38d143];var _0x2820e0=createListener(_0xa083('0x5')+_0x315225,_0x446d29);PluginEvents['on'](_0x315225,_0x2820e0);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a4ed0c4..fc0c6d7 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(_0x438385,_0x3d1635){var _0x5d0204=function(_0x499ff6){while(--_0x499ff6){_0x438385['push'](_0x438385['shift']());}};_0x5d0204(++_0x3d1635);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x133306,_0x2f9048){var _0x31f94c=function(_0x4fd9bc){while(--_0x4fd9bc){_0x133306['push'](_0x133306['shift']());}};_0x31f94c(++_0x2f9048);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 372be36..90c1b9a 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 _0xbdb7=['status','send','npm\x20install','info','index','list','then','express','motion2','length','catch','describe','params','body','join','../../files/plugins','script','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','stack','name'];(function(_0x43727e,_0x52df1b){var _0x3a2123=function(_0x4d3ea8){while(--_0x4d3ea8){_0x43727e['push'](_0x43727e['shift']());}};_0x3a2123(++_0x52df1b);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2a5dc1,_0xc58ca4){_0x2a5dc1=_0x2a5dc1-0x0;var _0x244d63=_0xbdb7[_0x2a5dc1];return _0x244d63;};'use strict';var _=require(_0x7bdb('0x0'));var pm2=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var path=require(_0x7bdb('0x4'));var exec=require(_0x7bdb('0x5'))[_0x7bdb('0x6')];var BPromise=require(_0x7bdb('0x7'));function handleEntityNotFound(_0x46c068,_0x47aec5){return function(_0x28542c){if(!_0x28542c){_0x46c068['sendStatus'](0x194);;}return _0x28542c;};}function respondWithResult(_0x4b5fff,_0xffdc86){_0xffdc86=_0xffdc86||0xc8;return function(_0x1e23a3){if(_0x1e23a3){return _0x4b5fff['status'](_0xffdc86)['json'](_0x1e23a3);}return null;};}function handleError(_0x468041,_0x11a877){_0x11a877=_0x11a877||0x1f4;return function(_0x530f81){logger['error'](_0x530f81[_0x7bdb('0x8')]);if(_0x530f81[_0x7bdb('0x9')]){delete _0x530f81[_0x7bdb('0x9')];}_0x468041[_0x7bdb('0xa')](_0x11a877)[_0x7bdb('0xb')](_0x530f81);};}function execChildProcess(){return new BPromise(function(_0x144ff7,_0x297724){exec(_0x7bdb('0xc'),function(_0x5462da,_0x4e5b8e,_0x52b9b9){logger[_0x7bdb('0xd')](_0x4e5b8e);logger[_0x7bdb('0xd')](_0x52b9b9);if(_0x5462da){logger['error'](_0x5462da);return _0x297724(_0x5462da);}return _0x144ff7(_0x4e5b8e);});});}exports[_0x7bdb('0xe')]=function(_0x53021d,_0x5898c1){return pm2[_0x7bdb('0xf')]()[_0x7bdb('0x10')](function(_0x4fd91a){if(_0x4fd91a){var _0x50eeca=_['reject'](_0x4fd91a,function(_0x4476ff){return _0x4476ff[_0x7bdb('0x9')]===_0x7bdb('0x11')||_0x4476ff[_0x7bdb('0x9')]===_0x7bdb('0x12');});return{'rows':_0x50eeca,'count':_0x50eeca[_0x7bdb('0x13')]};}return null;})[_0x7bdb('0x10')](respondWithResult(_0x5898c1,null))[_0x7bdb('0x14')](handleError(_0x5898c1,null));};exports['show']=function(_0x1c5750,_0x43f352){return pm2[_0x7bdb('0x15')](_0x1c5750[_0x7bdb('0x16')]['id'])['then'](respondWithResult(_0x43f352,null))[_0x7bdb('0x10')](handleEntityNotFound(_0x43f352,null))[_0x7bdb('0x14')](handleError(_0x43f352,null));};exports['create']=function(_0x3e5f8e,_0x31f78e){if(_0x3e5f8e[_0x7bdb('0x17')][_0x7bdb('0x9')]&&_0x3e5f8e[_0x7bdb('0x17')]['script']){var _0x49f353=path[_0x7bdb('0x18')](__dirname,_0x7bdb('0x19'),_0x3e5f8e['body'][_0x7bdb('0x1a')]);var _0x118ea1=process[_0x7bdb('0x1b')]();process[_0x7bdb('0x1c')](path[_0x7bdb('0x1d')](_0x49f353));return execChildProcess()['then'](function(_0x1d37ac){process[_0x7bdb('0x1c')](_0x118ea1);return pm2[_0x7bdb('0x1e')]({'name':_0x3e5f8e[_0x7bdb('0x17')]['name'],'script':_0x49f353});})['then'](function(_0x3c423f){pm2['dump']();return _0x3c423f[0x0];})['then'](respondWithResult(_0x31f78e,0xc9))['catch'](handleError(_0x31f78e,null));}else{return _0x31f78e[_0x7bdb('0xa')](0x1f4)['send']({'message':_0x7bdb('0x1f')});}};exports[_0x7bdb('0x20')]=function(_0x3ec129,_0x7c09cf){if(_0x3ec129[_0x7bdb('0x17')]['id']){delete _0x3ec129['body']['id'];}var _0x10e818={'online':_0x7bdb('0x21'),'stopped':_0x7bdb('0x22')};if(_0x10e818[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x17')][_0x7bdb('0xa')])){return pm2[_0x10e818[_0x3ec129[_0x7bdb('0x17')][_0x7bdb('0xa')]]](_0x3ec129[_0x7bdb('0x16')]['id'])[_0x7bdb('0x10')](respondWithResult(_0x7c09cf,0xc8))[_0x7bdb('0x14')](handleError(_0x7c09cf,null));}else{return _0x7c09cf[_0x7bdb('0xa')](0x1f4)['send']({'message':_0x7bdb('0x24')});}};exports[_0x7bdb('0x25')]=function(_0x8f7672,_0x9f5c1){if(_0x8f7672[_0x7bdb('0x17')]['id']){delete _0x8f7672['body']['id'];}if(_0x8f7672[_0x7bdb('0x16')]['id']){return pm2[_0x7bdb('0x26')](_0x8f7672[_0x7bdb('0x16')]['id'])[_0x7bdb('0x10')](function(_0x58c6b7){pm2['dump']();return _0x58c6b7[0x0];})['then'](respondWithResult(_0x9f5c1,null))[_0x7bdb('0x14')](handleError(_0x9f5c1,null));}else{return _0x9f5c1['status'](0x1f4)[_0x7bdb('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xbec5=['Unknown\x20id','lodash','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','create','body','join','../../files/plugins','script','cwd','dirname','chdir','start','dump','restart','hasOwnProperty','params','destroy'];(function(_0x35b4b0,_0x1912ac){var _0x29935d=function(_0x181eae){while(--_0x181eae){_0x35b4b0['push'](_0x35b4b0['shift']());}};_0x29935d(++_0x1912ac);}(_0xbec5,0xe5));var _0x5bec=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0xbec5[_0x403c8d];return _0x4ca60d;};'use strict';var _=require(_0x5bec('0x0'));var pm2=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var path=require(_0x5bec('0x3'));var exec=require(_0x5bec('0x4'))[_0x5bec('0x5')];var BPromise=require(_0x5bec('0x6'));function handleEntityNotFound(_0x4ee982,_0x1f8933){return function(_0x376cdb){if(!_0x376cdb){_0x4ee982[_0x5bec('0x7')](0x194);;}return _0x376cdb;};}function respondWithResult(_0x4aaac6,_0x3ed67a){_0x3ed67a=_0x3ed67a||0xc8;return function(_0x28a427){if(_0x28a427){return _0x4aaac6[_0x5bec('0x8')](_0x3ed67a)[_0x5bec('0x9')](_0x28a427);}return null;};}function handleError(_0x43d96e,_0x302aae){_0x302aae=_0x302aae||0x1f4;return function(_0x6406a1){logger[_0x5bec('0xa')](_0x6406a1['stack']);if(_0x6406a1[_0x5bec('0xb')]){delete _0x6406a1['name'];}_0x43d96e[_0x5bec('0x8')](_0x302aae)[_0x5bec('0xc')](_0x6406a1);};}function execChildProcess(){return new BPromise(function(_0x117162,_0x4a5482){exec(_0x5bec('0xd'),function(_0x18fa47,_0x16226b,_0x57ffc4){logger[_0x5bec('0xe')](_0x16226b);logger[_0x5bec('0xe')](_0x57ffc4);if(_0x18fa47){logger['error'](_0x18fa47);return _0x4a5482(_0x18fa47);}return _0x117162(_0x16226b);});});}exports[_0x5bec('0xf')]=function(_0xaa984d,_0x35393a){return pm2[_0x5bec('0x10')]()[_0x5bec('0x11')](function(_0xcd6d90){if(_0xcd6d90){var _0x24dcd6=_[_0x5bec('0x12')](_0xcd6d90,function(_0x259588){return _0x259588[_0x5bec('0xb')]===_0x5bec('0x13')||_0x259588[_0x5bec('0xb')]===_0x5bec('0x14');});return{'rows':_0x24dcd6,'count':_0x24dcd6['length']};}return null;})['then'](respondWithResult(_0x35393a,null))[_0x5bec('0x15')](handleError(_0x35393a,null));};exports[_0x5bec('0x16')]=function(_0x31ad9c,_0x1771e7){return pm2['describe'](_0x31ad9c['params']['id'])[_0x5bec('0x11')](respondWithResult(_0x1771e7,null))[_0x5bec('0x11')](handleEntityNotFound(_0x1771e7,null))['catch'](handleError(_0x1771e7,null));};exports[_0x5bec('0x17')]=function(_0xa7e223,_0x32a846){if(_0xa7e223[_0x5bec('0x18')]['name']&&_0xa7e223[_0x5bec('0x18')]['script']){var _0x191c0f=path[_0x5bec('0x19')](__dirname,_0x5bec('0x1a'),_0xa7e223[_0x5bec('0x18')][_0x5bec('0x1b')]);var _0x5e154e=process[_0x5bec('0x1c')]();process['chdir'](path[_0x5bec('0x1d')](_0x191c0f));return execChildProcess()[_0x5bec('0x11')](function(_0x5b2636){process[_0x5bec('0x1e')](_0x5e154e);return pm2[_0x5bec('0x1f')]({'name':_0xa7e223['body'][_0x5bec('0xb')],'script':_0x191c0f});})[_0x5bec('0x11')](function(_0x43d460){pm2[_0x5bec('0x20')]();return _0x43d460[0x0];})[_0x5bec('0x11')](respondWithResult(_0x32a846,0xc9))[_0x5bec('0x15')](handleError(_0x32a846,null));}else{return _0x32a846[_0x5bec('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x2961bd,_0x2cdd2f){if(_0x2961bd[_0x5bec('0x18')]['id']){delete _0x2961bd['body']['id'];}var _0x2b3b2c={'online':_0x5bec('0x21'),'stopped':'stop'};if(_0x2b3b2c[_0x5bec('0x22')](_0x2961bd[_0x5bec('0x18')]['status'])){return pm2[_0x2b3b2c[_0x2961bd['body'][_0x5bec('0x8')]]](_0x2961bd[_0x5bec('0x23')]['id'])[_0x5bec('0x11')](respondWithResult(_0x2cdd2f,0xc8))[_0x5bec('0x15')](handleError(_0x2cdd2f,null));}else{return _0x2cdd2f[_0x5bec('0x8')](0x1f4)[_0x5bec('0xc')]({'message':'Unknown\x20status'});}};exports[_0x5bec('0x24')]=function(_0x59b5b6,_0x45863b){if(_0x59b5b6[_0x5bec('0x18')]['id']){delete _0x59b5b6[_0x5bec('0x18')]['id'];}if(_0x59b5b6[_0x5bec('0x23')]['id']){return pm2['delete'](_0x59b5b6[_0x5bec('0x23')]['id'])[_0x5bec('0x11')](function(_0xfc7d41){pm2['dump']();return _0xfc7d41[0x0];})[_0x5bec('0x11')](respondWithResult(_0x45863b,null))['catch'](handleError(_0x45863b,null));}else{return _0x45863b[_0x5bec('0x8')](0x1f4)[_0x5bec('0xc')]({'message':_0x5bec('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e7baa2a..a54ce76 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 _0x6b83=['./realtime.controller','get','/agents','getAgents','/queues','isAuthenticated','getQueues','exports','express','../../components/auth/service'];(function(_0x2e769d,_0x9bd59b){var _0x3a5a02=function(_0x33f7f0){while(--_0x33f7f0){_0x2e769d['push'](_0x2e769d['shift']());}};_0x3a5a02(++_0x9bd59b);}(_0x6b83,0x1a2));var _0x36b8=function(_0x2c47c8,_0x36b835){_0x2c47c8=_0x2c47c8-0x0;var _0x8181c7=_0x6b83[_0x2c47c8];return _0x8181c7;};'use strict';var express=require(_0x36b8('0x0'));var router=express['Router']();var auth=require(_0x36b8('0x1'));var controller=require(_0x36b8('0x2'));router[_0x36b8('0x3')](_0x36b8('0x4'),auth['isAuthenticated'](),controller[_0x36b8('0x5')]);router[_0x36b8('0x3')](_0x36b8('0x6'),auth[_0x36b8('0x7')](),controller[_0x36b8('0x8')]);module[_0x36b8('0x9')]=router; \ No newline at end of file +var _0x42b0=['get','/agents','isAuthenticated','getQueues','exports'];(function(_0x420dcc,_0x46eb4a){var _0xfdf8aa=function(_0x208519){while(--_0x208519){_0x420dcc['push'](_0x420dcc['shift']());}};_0xfdf8aa(++_0x46eb4a);}(_0x42b0,0x1e0));var _0x042b=function(_0x58e19c,_0x17b34e){_0x58e19c=_0x58e19c-0x0;var _0x536652=_0x42b0[_0x58e19c];return _0x536652;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0x042b('0x0')](_0x042b('0x1'),auth[_0x042b('0x2')](),controller['getAgents']);router[_0x042b('0x0')]('/queues',auth[_0x042b('0x2')](),controller[_0x042b('0x3')]);module[_0x042b('0x4')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 8341ffe..f566b87 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 _0x24ca=['sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','online','getOptions','raw','push','sequelize','literal','FIELD(id,','Pause','forEach','where','user','Agents','extraQueryConditions','UserProfile','getResources','find','filterAgentAttributes','merge','getAgentStatus','includes','sortAgentsByStatus','split','pick','catch','getQueues','startCase','Queue','name','voice','dialActive','dialMethod','outbound','Queues','filter','assign','findAndCountAll','getRealtimeQueues','lodash','../../components/realtime/queues','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase'];(function(_0x507138,_0x589368){var _0x23603d=function(_0x3193e4){while(--_0x3193e4){_0x507138['push'](_0x507138['shift']());}};_0x23603d(++_0x589368);}(_0x24ca,0x8c));var _0xa24c=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x24ca[_0x4191af];return _0x27bebf;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var rta=require('../../components/realtime/agents');var rtq=require(_0xa24c('0x1'));var qs=require('../../components/parsers/qs');var utils=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];var APIBadRequestError=require(_0xa24c('0x4'))['APIBadRequestError'];var APIHandleError=require(_0xa24c('0x4'))[_0xa24c('0x5')];function respondWithFilteredResult(_0x4707f9,_0x5a37ae){return function(_0x5377ed){if(_0x5377ed){var _0x52147a=typeof _0x5a37ae[_0xa24c('0x6')]===_0xa24c('0x7')&&typeof _0x5a37ae[_0xa24c('0x8')]===_0xa24c('0x7');var _0x34288c=_0x5377ed[_0xa24c('0x9')];var _0x5bedc6=_0x52147a?0x0:_0x5a37ae[_0xa24c('0x6')];var _0x413b3d=_0x52147a?_0x5377ed[_0xa24c('0x9')]:_0x5a37ae['offset']+_0x5a37ae['limit'];var _0x1331f4;if(_0x413b3d>=_0x34288c){_0x413b3d=_0x34288c;_0x1331f4=0xc8;}else{_0x1331f4=0xce;}_0x4707f9[_0xa24c('0xa')](_0x1331f4);return _0x4707f9[_0xa24c('0xb')](_0xa24c('0xc'),_0x5bedc6+'-'+_0x413b3d+'/'+_0x34288c)[_0xa24c('0xd')](_0x5377ed);}return null;};}exports[_0xa24c('0xe')]=function(_0x566313,_0x5bb631){var _0x4907f6={'count':0x0,'rows':[]};var _0x2444b7={};var _0x23bd58;var _0x337c8a=utils[_0xa24c('0xf')]();var _0x4351a8;var _0x4971af;var _0x13076d=_0x566313['query']['globalQueueFilter'];var _0x588acf=_0x566313[_0xa24c('0x10')][_0xa24c('0x11')];var _0x3f762e=_0x566313[_0xa24c('0x10')][_0xa24c('0x12')];var _0x419f2e=_0x588acf===_0xa24c('0x13')||_0x588acf===_0xa24c('0x14')?!![]:![];var _0x14f0aa=[];var _0x117177;var _0x1970fc;Promise[_0xa24c('0x15')]()[_0xa24c('0x16')](function(){if(_0x566313[_0xa24c('0x10')]['channel']){if(!utils[_0xa24c('0x17')](_0x566313['query'][_0xa24c('0x18')])){throw new APIBadRequestError(util[_0xa24c('0x19')](_0xa24c('0x1a'),_0x566313[_0xa24c('0x10')][_0xa24c('0x18')]));}_0x23bd58=_0x566313[_0xa24c('0x10')][_0xa24c('0x18')][_0xa24c('0x1b')]();}if(!_0x566313[_0xa24c('0x10')][_0xa24c('0x1c')]||!_0x566313[_0xa24c('0x10')]['sort']['includes'](_0xa24c('0x1d'))){_0x566313[_0xa24c('0x10')][_0xa24c('0x1c')]=rta[_0xa24c('0x1e')](_0x566313[_0xa24c('0x10')][_0xa24c('0x1c')]);return;}var _0x16bd20=rta[_0xa24c('0x1f')](_0x566313[_0xa24c('0x10')]['sort']);_0x566313[_0xa24c('0x10')]['sort']=_0x16bd20[_0xa24c('0x20')][_0xa24c('0x21')](',');_0x117177=_0x16bd20[_0xa24c('0x22')];})[_0xa24c('0x16')](function(){if(!_0x13076d){return[];}return rta['getAgentIdsByQueues'](_0x13076d,_0x23bd58);})['then'](function(_0x4c86c6){_0x14f0aa=_0x4c86c6;return rta['getRealtimeAgents']();})[_0xa24c('0x16')](function(_0x39e0be){_0x4971af=_0x39e0be[_0xa24c('0x23')];if((!_0x588acf||_0x419f2e)&&!_0x117177){return _0x14f0aa;}if(_0x117177&&!_0x588acf){return rta[_0xa24c('0x24')](_0x4971af,_0x14f0aa,_0x117177);}else{return rta[_0xa24c('0x25')](_0x4971af,_0x14f0aa,_0x588acf);}})['then'](function(_0x5c8113){_0x14f0aa=_0x5c8113;var _0x33c208=![];if(_0x14f0aa[_0xa24c('0x26')]===0x0){if(_0x13076d||_0x588acf){_0x33c208=!![];}if(_0x419f2e){_0x33c208=![];}}if(_0x33c208){return _0x4907f6;}var _0x2eab62=_[_0xa24c('0x27')](db[_0xa24c('0x28')][_0xa24c('0x29')],function(_0xc0db8f){return{'name':_0xc0db8f[_0xa24c('0x2a')],'type':_0xc0db8f[_0xa24c('0x2b')][_0xa24c('0x2c')]};});_0x566313['query'][_0xa24c('0x2d')]=_0xa24c('0x2e');_0x566313['query'][_0xa24c('0x2f')]=!![];_0x2444b7=qs[_0xa24c('0x30')](_0x2eab62,_0x566313);_0x2444b7[_0xa24c('0x31')]=!![];var _0x1de2ef=[];if(_0x14f0aa[_0xa24c('0x26')]>0x0){_0x1de2ef[_0xa24c('0x32')]({'id':{'$in':_0x14f0aa}});if(_0x117177&&!_0x588acf){_0x1970fc=[db[_0xa24c('0x33')][_0xa24c('0x34')](_0xa24c('0x35')+_0x14f0aa+')')];_0x2444b7[_0xa24c('0x22')]=_0x1970fc;}}if(_0x419f2e){_0x337c8a['forEach'](function(_0x482002){var _0x52e39b=!![];if(_0x588acf===_0xa24c('0x14')&&_0x23bd58!==_0x482002){_0x52e39b=![];}_0x1de2ef['push']({[_0x482002+_0xa24c('0x36')]:_0x52e39b});});if(_0x3f762e){_0x1de2ef[_0xa24c('0x32')]({'pauseType':_0x3f762e});}}else if(_0x588acf){_0x337c8a[_0xa24c('0x37')](function(_0x4b8627){_0x1de2ef[_0xa24c('0x32')]({[_0x4b8627+_0xa24c('0x36')]:![]});});}_0x2444b7[_0xa24c('0x38')]=_['merge'](_0x2444b7[_0xa24c('0x38')],{'$and':_0x1de2ef});if(_0x566313[_0xa24c('0x39')]['role']===_0xa24c('0x39')){var _0x22fd0f={'params':{'id':_0x566313[_0xa24c('0x39')]['userProfileId']},'query':{'section':_0xa24c('0x3a'),'role':_0xa24c('0x2e'),'online':!![],'raw':!![],'ids':_0x14f0aa,'customSorting':_0x1970fc}};if(_0x419f2e){_0x22fd0f[_0xa24c('0x10')][_0xa24c('0x3b')]=_0x1de2ef;}_0x22fd0f[_0xa24c('0x10')]=Object['assign'](_0x22fd0f[_0xa24c('0x10')],_0x566313[_0xa24c('0x10')]);delete _0x22fd0f['query']['id'];return db[_0xa24c('0x3c')][_0xa24c('0x3d')](_0x22fd0f);}return db[_0xa24c('0x28')]['findAndCountAll'](_0x2444b7);})['then'](function(_0x1f7535){_0x4907f6[_0xa24c('0x9')]=_0x1f7535[_0xa24c('0x9')];_0x4351a8=_0x1f7535[_0xa24c('0x23')];return _0x4351a8[_0xa24c('0x27')](function(_0x3879c8){var _0x54ea40=_[_0xa24c('0x3e')](_0x4971af,['id',_0x3879c8['id']]);if(_0x54ea40){var _0x3835ea=rta[_0xa24c('0x3f')](_0x54ea40);_[_0xa24c('0x40')](_0x3879c8,_0x3835ea);}_0x3879c8['globalStatus']=rta[_0xa24c('0x41')](_0x3879c8);if(_0x3879c8[_0xa24c('0x1d')][_0xa24c('0x42')](_0xa24c('0x13'))){_0x337c8a[_0xa24c('0x37')](function(_0x7d16aa){if(_0x3879c8[_0x7d16aa+_0xa24c('0x36')]){_0x3879c8[_0x7d16aa+'Status']='pause';}});}return _0x3879c8;});})[_0xa24c('0x16')](function(_0x4dde63){if(!_0x117177||_0x1970fc){return _0x4dde63;}return rta[_0xa24c('0x43')](_0x4dde63,_0x117177);})['then'](function(_0x32e151){var _0x214627=null;if(_0x566313[_0xa24c('0x10')][_0xa24c('0x20')]){var _0x21328f=_0x566313[_0xa24c('0x10')][_0xa24c('0x20')][_0xa24c('0x44')](',');_0x214627=_0x32e151[_0xa24c('0x27')](function(_0x38791c){return _[_0xa24c('0x45')](_0x38791c,_0x21328f);});}_0x4907f6[_0xa24c('0x23')]=_0x214627||_0x32e151;return _0x4907f6;})[_0xa24c('0x16')](respondWithFilteredResult(_0x5bb631,_0x2444b7))[_0xa24c('0x46')](APIHandleError(_0x5bb631));};exports[_0xa24c('0x47')]=function(_0x2d0da8,_0x595cde){var _0x1ad4ee={'count':0x0,'rows':[]};var _0x257902={};var _0x12480e;var _0x5803ce;var _0x3fca65;Promise[_0xa24c('0x15')]()[_0xa24c('0x16')](function(){if(_0x2d0da8[_0xa24c('0x10')]['channel']){if(!utils[_0xa24c('0x17')](_0x2d0da8[_0xa24c('0x10')][_0xa24c('0x18')])){throw new APIBadRequestError(util[_0xa24c('0x19')](_0xa24c('0x1a'),_0x2d0da8[_0xa24c('0x10')][_0xa24c('0x18')]));}_0x12480e=_0x2d0da8[_0xa24c('0x10')][_0xa24c('0x18')][_0xa24c('0x1b')]();}var _0x2ed41f=_[_0xa24c('0x48')](_0x12480e)+_0xa24c('0x49');var _0x5da5f2=_[_0xa24c('0x27')](db[_0x2ed41f]['rawAttributes'],function(_0x70c67b){return{'name':_0x70c67b[_0xa24c('0x2a')],'type':_0x70c67b[_0xa24c('0x2b')][_0xa24c('0x2c')]};});if(!_0x2d0da8[_0xa24c('0x10')][_0xa24c('0x20')]){var _0x338877=['id',_0xa24c('0x4a')];if(_0x12480e===_0xa24c('0x4b')){_0x338877[_0xa24c('0x32')](_0xa24c('0x2b'));if(_0x2d0da8[_0xa24c('0x10')][_0xa24c('0x2b')]==='outbound'){_0x338877[_0xa24c('0x32')]([_0xa24c('0x4c'),_0xa24c('0x4d')]);}}_0x2d0da8[_0xa24c('0x10')]['fields']=_0x338877[_0xa24c('0x21')](',');}_0x257902=qs[_0xa24c('0x30')](_0x5da5f2,_0x2d0da8);if(_0x2d0da8[_0xa24c('0x39')]['role']==='user'){var _0x3f8e77={'params':{'id':_0x2d0da8[_0xa24c('0x39')]['userProfileId']},'query':{'section':_0x12480e===_0xa24c('0x4b')&&_0x2d0da8[_0xa24c('0x10')]['type']===_0xa24c('0x4e')?'QueueCampaigns':_['startCase'](_0x12480e)+_0xa24c('0x4f'),'type':_0x2d0da8['query'][_0xa24c('0x2b')],'nolimit':!![],'sort':_0xa24c('0x4a'),'filter':_0x2d0da8['query'][_0xa24c('0x50')]}};_0x3f8e77[_0xa24c('0x10')]=Object[_0xa24c('0x51')](_0x3f8e77[_0xa24c('0x10')],_0x2d0da8['query']);delete _0x3f8e77[_0xa24c('0x10')]['id'];return db['UserProfile'][_0xa24c('0x3d')](_0x3f8e77);}return db[_0x2ed41f][_0xa24c('0x52')](_0x257902);})['then'](function(_0x49ee3f){_0x1ad4ee[_0xa24c('0x9')]=_0x49ee3f[_0xa24c('0x9')];_0x5803ce=_0x49ee3f[_0xa24c('0x23')];return rtq[_0xa24c('0x53')](_0x2d0da8,_0x12480e);})[_0xa24c('0x16')](function(_0x5f2564){_0x3fca65=_0x5f2564[_0xa24c('0x23')];return rtq['initializeQueues'](_0x5803ce,_0x3fca65,_0x12480e,_0x2d0da8[_0xa24c('0x10')]['type']);})['then'](function(_0x583578){_0x1ad4ee[_0xa24c('0x23')]=_0x583578;return _0x1ad4ee;})['then'](respondWithFilteredResult(_0x595cde,_0x257902))['catch'](APIHandleError(_0x595cde));}; \ No newline at end of file +var _0xdc97=['util','../../components/realtime/agents','../../components/parsers/qs','../../mysqldb','../../errors/api','handleError','limit','undefined','count','offset','status','set','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','then','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','role','agent','online','getOptions','push','literal','FIELD(id,','order','forEach','*pause','Pause','where','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','User','findAndCountAll','map','find','filterAgentAttributes','merge','globalStatus','getAgentStatus','split','pick','catch','getQueues','startCase','Queue','type','key','name','voice','outbound','dialActive','dialMethod','join','Queues','getRealtimeQueues','initializeQueues','lodash'];(function(_0x40d925,_0x145b61){var _0x3f7ad5=function(_0x206545){while(--_0x206545){_0x40d925['push'](_0x40d925['shift']());}};_0x3f7ad5(++_0x145b61);}(_0xdc97,0x13b));var _0x7dc9=function(_0x4286e8,_0x144a43){_0x4286e8=_0x4286e8-0x0;var _0x494bc4=_0xdc97[_0x4286e8];return _0x494bc4;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var rta=require(_0x7dc9('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0x7dc9('0x3'));var utils=require('../../config/utils');var db=require(_0x7dc9('0x4'))['db'];var APIBadRequestError=require(_0x7dc9('0x5'))['APIBadRequestError'];var APIHandleError=require(_0x7dc9('0x5'))[_0x7dc9('0x6')];function respondWithFilteredResult(_0xb15a0b,_0x3ba3ca){return function(_0x589f02){if(_0x589f02){var _0x2636ef=typeof _0x3ba3ca['offset']==='undefined'&&typeof _0x3ba3ca[_0x7dc9('0x7')]===_0x7dc9('0x8');var _0x3318ea=_0x589f02[_0x7dc9('0x9')];var _0x3dd07e=_0x2636ef?0x0:_0x3ba3ca['offset'];var _0xb2fa2a=_0x2636ef?_0x589f02[_0x7dc9('0x9')]:_0x3ba3ca[_0x7dc9('0xa')]+_0x3ba3ca[_0x7dc9('0x7')];var _0x359c88;if(_0xb2fa2a>=_0x3318ea){_0xb2fa2a=_0x3318ea;_0x359c88=0xc8;}else{_0x359c88=0xce;}_0xb15a0b[_0x7dc9('0xb')](_0x359c88);return _0xb15a0b[_0x7dc9('0xc')]('Content-Range',_0x3dd07e+'-'+_0xb2fa2a+'/'+_0x3318ea)['json'](_0x589f02);}return null;};}exports['getAgents']=function(_0x599ef1,_0x94c75a){var _0x14e5db={'count':0x0,'rows':[]};var _0x5c6ca5={};var _0xbd06be;var _0x2f3acd=utils[_0x7dc9('0xd')]();var _0xf37bc7;var _0x31d43d;var _0x11af93=_0x599ef1['query'][_0x7dc9('0xe')];var _0x278191=_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x10')];var _0x11606f=_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x11')];var _0x389d36=_0x278191===_0x7dc9('0x12')||_0x278191==='*pause'?!![]:![];var _0x22577e=[];var _0x4afb47;var _0x1f5906;Promise[_0x7dc9('0x13')]()['then'](function(){if(_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x14')]){if(!utils[_0x7dc9('0x15')](_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x14')])){throw new APIBadRequestError(util[_0x7dc9('0x16')](_0x7dc9('0x17'),_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x14')]));}_0xbd06be=_0x599ef1[_0x7dc9('0xf')]['channel']['toLowerCase']();}if(!_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x18')]||!_0x599ef1['query'][_0x7dc9('0x18')][_0x7dc9('0x19')]('globalStatus')){_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x18')]=rta[_0x7dc9('0x1a')](_0x599ef1['query'][_0x7dc9('0x18')]);return;}var _0x1e3a8d=rta[_0x7dc9('0x1b')](_0x599ef1['query']['sort']);_0x599ef1['query'][_0x7dc9('0x18')]=_0x1e3a8d[_0x7dc9('0x1c')]['join'](',');_0x4afb47=_0x1e3a8d['order'];})[_0x7dc9('0x1d')](function(){if(!_0x11af93){return[];}return rta['getAgentIdsByQueues'](_0x11af93,_0xbd06be);})[_0x7dc9('0x1d')](function(_0x1c690b){_0x22577e=_0x1c690b;return rta[_0x7dc9('0x1e')]();})[_0x7dc9('0x1d')](function(_0xa2aaa9){_0x31d43d=_0xa2aaa9[_0x7dc9('0x1f')];if((!_0x278191||_0x389d36)&&!_0x4afb47){return _0x22577e;}if(_0x4afb47&&!_0x278191){return rta[_0x7dc9('0x20')](_0x31d43d,_0x22577e,_0x4afb47);}else{return rta[_0x7dc9('0x21')](_0x31d43d,_0x22577e,_0x278191);}})[_0x7dc9('0x1d')](function(_0x3c4379){_0x22577e=_0x3c4379;var _0x14083d=![];if(_0x22577e[_0x7dc9('0x22')]===0x0){if(_0x11af93||_0x278191){_0x14083d=!![];}if(_0x389d36){_0x14083d=![];}}if(_0x14083d){return _0x14e5db;}var _0x4bb716=_['map'](db['User']['rawAttributes'],function(_0x4a68f0){return{'name':_0x4a68f0['fieldName'],'type':_0x4a68f0['type']['key']};});_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x23')]=_0x7dc9('0x24');_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x25')]=!![];_0x5c6ca5=qs[_0x7dc9('0x26')](_0x4bb716,_0x599ef1);_0x5c6ca5['raw']=!![];var _0x5ce3e1=[];if(_0x22577e['length']>0x0){_0x5ce3e1[_0x7dc9('0x27')]({'id':{'$in':_0x22577e}});if(_0x4afb47&&!_0x278191){_0x1f5906=[db['sequelize'][_0x7dc9('0x28')](_0x7dc9('0x29')+_0x22577e+')')];_0x5c6ca5[_0x7dc9('0x2a')]=_0x1f5906;}}if(_0x389d36){_0x2f3acd[_0x7dc9('0x2b')](function(_0x109c66){var _0x165882=!![];if(_0x278191===_0x7dc9('0x2c')&&_0xbd06be!==_0x109c66){_0x165882=![];}_0x5ce3e1[_0x7dc9('0x27')]({[_0x109c66+'Pause']:_0x165882});});if(_0x11606f){_0x5ce3e1[_0x7dc9('0x27')]({'pauseType':_0x11606f});}}else if(_0x278191){_0x2f3acd['forEach'](function(_0x421e1a){_0x5ce3e1[_0x7dc9('0x27')]({[_0x421e1a+_0x7dc9('0x2d')]:![]});});}_0x5c6ca5[_0x7dc9('0x2e')]=_['merge'](_0x5c6ca5[_0x7dc9('0x2e')],{'$and':_0x5ce3e1});if(_0x599ef1['user'][_0x7dc9('0x23')]==='user'){var _0x590bed={'params':{'id':_0x599ef1[_0x7dc9('0x2f')][_0x7dc9('0x30')]},'query':{'section':_0x7dc9('0x31'),'role':_0x7dc9('0x24'),'online':!![],'raw':!![],'ids':_0x22577e,'customSorting':_0x1f5906}};if(_0x389d36){_0x590bed['query'][_0x7dc9('0x32')]=_0x5ce3e1;}_0x590bed[_0x7dc9('0xf')]=Object[_0x7dc9('0x33')](_0x590bed[_0x7dc9('0xf')],_0x599ef1[_0x7dc9('0xf')]);delete _0x590bed[_0x7dc9('0xf')]['id'];return db[_0x7dc9('0x34')][_0x7dc9('0x35')](_0x590bed);}return db[_0x7dc9('0x36')][_0x7dc9('0x37')](_0x5c6ca5);})[_0x7dc9('0x1d')](function(_0x3a8d80){_0x14e5db['count']=_0x3a8d80[_0x7dc9('0x9')];_0xf37bc7=_0x3a8d80[_0x7dc9('0x1f')];return _0xf37bc7[_0x7dc9('0x38')](function(_0xfd2612){var _0x4bcdce=_[_0x7dc9('0x39')](_0x31d43d,['id',_0xfd2612['id']]);if(_0x4bcdce){var _0x89db0e=rta[_0x7dc9('0x3a')](_0x4bcdce);_[_0x7dc9('0x3b')](_0xfd2612,_0x89db0e);}_0xfd2612[_0x7dc9('0x3c')]=rta[_0x7dc9('0x3d')](_0xfd2612);if(_0xfd2612['globalStatus']['includes'](_0x7dc9('0x12'))){_0x2f3acd[_0x7dc9('0x2b')](function(_0x495100){if(_0xfd2612[_0x495100+_0x7dc9('0x2d')]){_0xfd2612[_0x495100+'Status']=_0x7dc9('0x12');}});}return _0xfd2612;});})[_0x7dc9('0x1d')](function(_0x3bca9c){if(!_0x4afb47||_0x1f5906){return _0x3bca9c;}return rta['sortAgentsByStatus'](_0x3bca9c,_0x4afb47);})[_0x7dc9('0x1d')](function(_0x1df27f){var _0x1929b6=null;if(_0x599ef1[_0x7dc9('0xf')][_0x7dc9('0x1c')]){var _0x23499a=_0x599ef1[_0x7dc9('0xf')]['fields'][_0x7dc9('0x3e')](',');_0x1929b6=_0x1df27f['map'](function(_0x52d883){return _[_0x7dc9('0x3f')](_0x52d883,_0x23499a);});}_0x14e5db[_0x7dc9('0x1f')]=_0x1929b6||_0x1df27f;return _0x14e5db;})[_0x7dc9('0x1d')](respondWithFilteredResult(_0x94c75a,_0x5c6ca5))[_0x7dc9('0x40')](APIHandleError(_0x94c75a));};exports[_0x7dc9('0x41')]=function(_0x1bd3a7,_0x2ce57f){var _0x765fee={'count':0x0,'rows':[]};var _0x3b130f={};var _0x573b48;var _0x1c41ef;var _0x1971c7;Promise[_0x7dc9('0x13')]()[_0x7dc9('0x1d')](function(){if(_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x14')]){if(!utils['isValidChannel'](_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x14')])){throw new APIBadRequestError(util['format'](_0x7dc9('0x17'),_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x14')]));}_0x573b48=_0x1bd3a7['query'][_0x7dc9('0x14')]['toLowerCase']();}var _0x55826d=_[_0x7dc9('0x42')](_0x573b48)+_0x7dc9('0x43');var _0x36d591=_['map'](db[_0x55826d]['rawAttributes'],function(_0x415ebd){return{'name':_0x415ebd['fieldName'],'type':_0x415ebd[_0x7dc9('0x44')][_0x7dc9('0x45')]};});if(!_0x1bd3a7['query'][_0x7dc9('0x1c')]){var _0x1d6c0a=['id',_0x7dc9('0x46')];if(_0x573b48===_0x7dc9('0x47')){_0x1d6c0a[_0x7dc9('0x27')](_0x7dc9('0x44'));if(_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x44')]===_0x7dc9('0x48')){_0x1d6c0a[_0x7dc9('0x27')]([_0x7dc9('0x49'),_0x7dc9('0x4a')]);}}_0x1bd3a7[_0x7dc9('0xf')]['fields']=_0x1d6c0a[_0x7dc9('0x4b')](',');}_0x3b130f=qs['getOptions'](_0x36d591,_0x1bd3a7);if(_0x1bd3a7['user'][_0x7dc9('0x23')]===_0x7dc9('0x2f')){var _0x40e382={'params':{'id':_0x1bd3a7[_0x7dc9('0x2f')][_0x7dc9('0x30')]},'query':{'section':_0x573b48==='voice'&&_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x44')]===_0x7dc9('0x48')?'QueueCampaigns':_[_0x7dc9('0x42')](_0x573b48)+_0x7dc9('0x4c'),'type':_0x1bd3a7[_0x7dc9('0xf')][_0x7dc9('0x44')],'nolimit':!![],'sort':_0x7dc9('0x46'),'filter':_0x1bd3a7[_0x7dc9('0xf')]['filter']}};_0x40e382[_0x7dc9('0xf')]=Object[_0x7dc9('0x33')](_0x40e382[_0x7dc9('0xf')],_0x1bd3a7[_0x7dc9('0xf')]);delete _0x40e382[_0x7dc9('0xf')]['id'];return db[_0x7dc9('0x34')][_0x7dc9('0x35')](_0x40e382);}return db[_0x55826d][_0x7dc9('0x37')](_0x3b130f);})[_0x7dc9('0x1d')](function(_0x1de02f){_0x765fee[_0x7dc9('0x9')]=_0x1de02f[_0x7dc9('0x9')];_0x1c41ef=_0x1de02f['rows'];return rtq[_0x7dc9('0x4d')](_0x1bd3a7,_0x573b48);})[_0x7dc9('0x1d')](function(_0x38df9a){_0x1971c7=_0x38df9a[_0x7dc9('0x1f')];return rtq[_0x7dc9('0x4e')](_0x1c41ef,_0x1971c7,_0x573b48,_0x1bd3a7['query'][_0x7dc9('0x44')]);})[_0x7dc9('0x1d')](function(_0x2c1452){_0x765fee[_0x7dc9('0x1f')]=_0x2c1452;return _0x765fee;})[_0x7dc9('0x1d')](respondWithFilteredResult(_0x2ce57f,_0x3b130f))[_0x7dc9('0x40')](APIHandleError(_0x2ce57f));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 11a72bf..5d8e63d 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2eef8c,_0x15a03d){var _0x1bec99=function(_0x193a31){while(--_0x193a31){_0x2eef8c['push'](_0x2eef8c['shift']());}};_0x1bec99(++_0x15a03d);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x17a1e3,_0x31c5ac){var _0x4b5e0c=function(_0x558dc1){while(--_0x558dc1){_0x17a1e3['push'](_0x17a1e3['shift']());}};_0x4b5e0c(++_0x31c5ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index ab758d1..6c9ac5f 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 _0x1883=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x585f8c,_0x5241d9){var _0x3e898a=function(_0x2d738d){while(--_0x2d738d){_0x585f8c['push'](_0x585f8c['shift']());}};_0x3e898a(++_0x5241d9);}(_0x1883,0xab));var _0x3188=function(_0x50e318,_0x103521){_0x50e318=_0x50e318-0x0;var _0x209b0f=_0x1883[_0x50e318];return _0x209b0f;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'state':{'type':Sequelize[_0x3188('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3188('0x3')]},'scheduledat':{'type':Sequelize[_0x3188('0x4')]},'uniqueid':{'type':Sequelize[_0x3188('0x3')]},'starttime':{'type':Sequelize[_0x3188('0x4')]},'responsetime':{'type':Sequelize[_0x3188('0x4')]},'ringtime':{'type':Sequelize[_0x3188('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x3188('0x3')]},'campaigntype':{'type':Sequelize[_0x3188('0x3')]},'membername':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file +var _0x34f2=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x304730,_0x483b78){var _0xe27bbf=function(_0xec4003){while(--_0xec4003){_0x304730['push'](_0x304730['shift']());}};_0xe27bbf(++_0x483b78);}(_0x34f2,0x15a));var _0x234f=function(_0x23136d,_0x4feeed){_0x23136d=_0x23136d-0x0;var _0x12f2f8=_0x34f2[_0x23136d];return _0x12f2f8;};'use strict';var Sequelize=require(_0x234f('0x0'));module[_0x234f('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x234f('0x2')]},'scheduledat':{'type':Sequelize[_0x234f('0x3')]},'uniqueid':{'type':Sequelize[_0x234f('0x2')]},'starttime':{'type':Sequelize[_0x234f('0x3')]},'responsetime':{'type':Sequelize[_0x234f('0x3')]},'ringtime':{'type':Sequelize[_0x234f('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x234f('0x2')]},'campaigntype':{'type':Sequelize[_0x234f('0x2')]},'membername':{'type':Sequelize[_0x234f('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 341dab9..926099a 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 _0x7714=['lodash','util','../../config/logger','api','bluebird','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7714,0x183));var _0x4771=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x7714[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x4771('0x0'));var util=require(_0x4771('0x1'));var logger=require(_0x4771('0x2'))(_0x4771('0x3'));var moment=require('moment');var BPromise=require(_0x4771('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('./reportAgentPreview.attributes');module[_0x4771('0x5')]=function(_0x30238c,_0xd9ff8c){return _0x30238c[_0x4771('0x6')](_0x4771('0x7'),attributes,{'tableName':_0x4771('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8045=['rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1f22b1,_0x52d2a8){var _0x492440=function(_0x97a823){while(--_0x97a823){_0x1f22b1['push'](_0x1f22b1['shift']());}};_0x492440(++_0x52d2a8);}(_0x8045,0x73));var _0x5804=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x8045[_0x4bd06e];return _0x85ebb;};'use strict';var _=require(_0x5804('0x0'));var util=require(_0x5804('0x1'));var logger=require(_0x5804('0x2'))('api');var moment=require(_0x5804('0x3'));var BPromise=require('bluebird');var rp=require(_0x5804('0x4'));var fs=require('fs');var path=require(_0x5804('0x5'));var rimraf=require(_0x5804('0x6'));var config=require('../../config/environment');var attributes=require(_0x5804('0x7'));module[_0x5804('0x8')]=function(_0x2df657,_0x57acb2){return _0x2df657[_0x5804('0x9')](_0x5804('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 72ed40c..32a629b 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 _0xe361=['ReportAgentPreview','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview'];(function(_0x55ff98,_0x553e50){var _0x5b2d58=function(_0x44ec00){while(--_0x44ec00){_0x55ff98['push'](_0x55ff98['shift']());}};_0x5b2d58(++_0x553e50);}(_0xe361,0x7a));var _0x1e36=function(_0x461c18,_0x5605b9){_0x461c18=_0x461c18-0x0;var _0x35501c=_0xe361[_0x461c18];return _0x35501c;};'use strict';var _=require(_0x1e36('0x0'));var util=require(_0x1e36('0x1'));var moment=require(_0x1e36('0x2'));var BPromise=require(_0x1e36('0x3'));var rs=require(_0x1e36('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1e36('0x5'));var logger=require(_0x1e36('0x6'))(_0x1e36('0x7'));var config=require(_0x1e36('0x8'));var jayson=require(_0x1e36('0x9'));var client=jayson['client'][_0x1e36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b606c,_0xcfa9e5,_0x2ab92d){return new BPromise(function(_0x1821a7,_0x40a2a3){return client['request'](_0x4b606c,_0x2ab92d)['then'](function(_0x52ecc3){logger[_0x1e36('0xb')](_0x1e36('0xc'),_0xcfa9e5,_0x1e36('0xd'));logger[_0x1e36('0xe')](_0x1e36('0xf'),_0xcfa9e5,_0x1e36('0xd'),JSON[_0x1e36('0x10')](_0x52ecc3));if(_0x52ecc3[_0x1e36('0x11')]){if(_0x52ecc3[_0x1e36('0x11')][_0x1e36('0x12')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xcfa9e5,_0x52ecc3['error'][_0x1e36('0x13')]);return _0x40a2a3(_0x52ecc3[_0x1e36('0x11')][_0x1e36('0x13')]);}logger[_0x1e36('0x11')](_0x1e36('0xc'),_0xcfa9e5,_0x52ecc3[_0x1e36('0x11')]['message']);return _0x1821a7(_0x52ecc3[_0x1e36('0x11')][_0x1e36('0x13')]);}else{logger[_0x1e36('0xb')](_0x1e36('0xc'),_0xcfa9e5,_0x1e36('0xd'));_0x1821a7(_0x52ecc3[_0x1e36('0x14')][_0x1e36('0x13')]);}})[_0x1e36('0x15')](function(_0x47eed7){logger[_0x1e36('0x11')](_0x1e36('0xc'),_0xcfa9e5,_0x47eed7);_0x40a2a3(_0x47eed7);});});}exports[_0x1e36('0x16')]=function(_0x2f3ce1){var _0x5574b9=this;return new Promise(function(_0x43a970,_0x194529){return db[_0x1e36('0x17')][_0x1e36('0x18')](_0x2f3ce1[_0x1e36('0x19')],{'raw':_0x2f3ce1[_0x1e36('0x1a')]?_0x2f3ce1['options'][_0x1e36('0x1b')]===undefined?!![]:![]:!![]})[_0x1e36('0x1c')](function(_0x443deb){logger[_0x1e36('0xb')](_0x1e36('0x16'),_0x2f3ce1);logger[_0x1e36('0xe')]('CreateReportAgentPreview',_0x2f3ce1,JSON[_0x1e36('0x10')](_0x443deb));_0x43a970(_0x443deb);})[_0x1e36('0x15')](function(_0x446b42){logger[_0x1e36('0x11')](_0x1e36('0x16'),_0x446b42['message'],_0x2f3ce1);_0x194529(_0x5574b9['error'](0x1f4,_0x446b42['message']));});});}; \ No newline at end of file +var _0xc730=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','raw','lodash','util','moment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xc730,0xba));var _0x0c73=function(_0x1f2122,_0x193a1b){_0x1f2122=_0x1f2122-0x0;var _0x53bec4=_0xc730[_0x1f2122];return _0x53bec4;};'use strict';var _=require(_0x0c73('0x0'));var util=require(_0x0c73('0x1'));var moment=require(_0x0c73('0x2'));var BPromise=require(_0x0c73('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c73('0x4'))['db'];var utils=require(_0x0c73('0x5'));var logger=require(_0x0c73('0x6'))('rpc');var config=require(_0x0c73('0x7'));var jayson=require(_0x0c73('0x8'));var client=jayson['client'][_0x0c73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x448aa3,_0x20b311,_0x29053c){return new BPromise(function(_0x3e8c0c,_0x11a0b6){return client[_0x0c73('0xa')](_0x448aa3,_0x29053c)[_0x0c73('0xb')](function(_0x1494c9){logger[_0x0c73('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x20b311,_0x0c73('0xd'));logger[_0x0c73('0xe')](_0x0c73('0xf'),_0x20b311,_0x0c73('0xd'),JSON[_0x0c73('0x10')](_0x1494c9));if(_0x1494c9[_0x0c73('0x11')]){if(_0x1494c9[_0x0c73('0x11')][_0x0c73('0x12')]===0x1f4){logger[_0x0c73('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x20b311,_0x1494c9[_0x0c73('0x11')][_0x0c73('0x13')]);return _0x11a0b6(_0x1494c9['error'][_0x0c73('0x13')]);}logger[_0x0c73('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x20b311,_0x1494c9['error'][_0x0c73('0x13')]);return _0x3e8c0c(_0x1494c9[_0x0c73('0x11')][_0x0c73('0x13')]);}else{logger['info'](_0x0c73('0x14'),_0x20b311,_0x0c73('0xd'));_0x3e8c0c(_0x1494c9[_0x0c73('0x15')][_0x0c73('0x13')]);}})[_0x0c73('0x16')](function(_0x296b86){logger[_0x0c73('0x11')](_0x0c73('0x14'),_0x20b311,_0x296b86);_0x11a0b6(_0x296b86);});});}exports[_0x0c73('0x17')]=function(_0x46e740){var _0x2de653=this;return new Promise(function(_0x371105,_0x115896){return db[_0x0c73('0x18')][_0x0c73('0x19')](_0x46e740['body'],{'raw':_0x46e740['options']?_0x46e740['options'][_0x0c73('0x1a')]===undefined?!![]:![]:!![]})[_0x0c73('0xb')](function(_0x1cb2af){logger['info'](_0x0c73('0x17'),_0x46e740);logger['debug'](_0x0c73('0x17'),_0x46e740,JSON[_0x0c73('0x10')](_0x1cb2af));_0x371105(_0x1cb2af);})['catch'](function(_0x2c480d){logger[_0x0c73('0x11')](_0x0c73('0x17'),_0x2c480d[_0x0c73('0x13')],_0x46e740);_0x115896(_0x2de653[_0x0c73('0x11')](0x1f4,_0x2c480d[_0x0c73('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 80aafeb..8337096 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 _0x21e4=['util','path','Router','../../components/auth/service','./rpc.controller','get','voiceChannelMixMonitor','isAuthenticated','voiceQueues','/chat/queues','chatQueues','/mail/queues','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/agents','agents','put','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','/chat/queues/:id/notify','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','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer'];(function(_0x5d660b,_0x2b6023){var _0x29263a=function(_0x2320ff){while(--_0x2320ff){_0x5d660b['push'](_0x5d660b['shift']());}};_0x29263a(++_0x2b6023);}(_0x21e4,0x1a3));var _0x421e=function(_0x4db98c,_0x39cfbd){_0x4db98c=_0x4db98c-0x0;var _0x36fe95=_0x21e4[_0x4db98c];return _0x36fe95;};'use strict';var multer=require(_0x421e('0x0'));var util=require(_0x421e('0x1'));var path=require(_0x421e('0x2'));var express=require('express');var router=express[_0x421e('0x3')]();var auth=require(_0x421e('0x4'));var controller=require(_0x421e('0x5'));router[_0x421e('0x6')]('/voice/channels',auth['isAuthenticated'](),controller['voiceChannels']);router['get']('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x421e('0x7')]);router[_0x421e('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x421e('0x8')](),controller['voiceChannelStopMixMonitor']);router['get']('/voice/queues',auth['isAuthenticated'](),controller[_0x421e('0x9')]);router['get'](_0x421e('0xa'),auth[_0x421e('0x8')](),controller[_0x421e('0xb')]);router[_0x421e('0x6')](_0x421e('0xc'),auth[_0x421e('0x8')](),controller['mailQueues']);router[_0x421e('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller['mailAccounts']);router[_0x421e('0x6')](_0x421e('0xd'),auth['isAuthenticated'](),controller[_0x421e('0xe')]);router[_0x421e('0x6')](_0x421e('0xf'),auth[_0x421e('0x8')](),controller[_0x421e('0x10')]);router[_0x421e('0x6')](_0x421e('0x11'),auth[_0x421e('0x8')](),controller[_0x421e('0x12')]);router[_0x421e('0x6')](_0x421e('0x13'),auth[_0x421e('0x8')](),controller[_0x421e('0x14')]);router[_0x421e('0x6')](_0x421e('0x15'),auth[_0x421e('0x8')](),controller[_0x421e('0x16')]);router['get']('/voice/queues/channels',auth[_0x421e('0x8')](),controller[_0x421e('0x17')]);router[_0x421e('0x6')](_0x421e('0x18'),auth['isAuthenticated'](),controller[_0x421e('0x19')]);router[_0x421e('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x421e('0x8')](),controller[_0x421e('0x1a')]);router[_0x421e('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x421e('0x8')](),controller[_0x421e('0x1b')]);router[_0x421e('0x6')](_0x421e('0x1c'),auth[_0x421e('0x8')](),controller[_0x421e('0x1d')]);router['put'](_0x421e('0x1c'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0x421e('0x6')]('/outbound',auth[_0x421e('0x8')](),controller[_0x421e('0x1e')]);router[_0x421e('0x6')]('/outbound/channels',auth['isAuthenticated'](),controller['outboundChannels']);router['get'](_0x421e('0x1f'),auth[_0x421e('0x8')](),controller[_0x421e('0x20')]);router[_0x421e('0x21')]('/agents/:id/capacity',auth[_0x421e('0x8')](),controller['agentCapacity']);router[_0x421e('0x6')]('/telephones',auth[_0x421e('0x8')](),controller[_0x421e('0x22')]);router[_0x421e('0x6')](_0x421e('0x23'),auth[_0x421e('0x8')](),controller[_0x421e('0x24')]);router[_0x421e('0x6')](_0x421e('0x25'),auth[_0x421e('0x8')](),controller['campaigns']);router[_0x421e('0x6')](_0x421e('0x26'),auth[_0x421e('0x8')](),controller[_0x421e('0x27')]);router['get'](_0x421e('0x28'),auth[_0x421e('0x8')](),controller[_0x421e('0x29')]);router[_0x421e('0x6')](_0x421e('0x2a'),auth['isAuthenticated'](),controller[_0x421e('0x2b')]);router[_0x421e('0x6')]('/openchannel/queues/waitinginteractions',auth[_0x421e('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0x421e('0x6')](_0x421e('0x2c'),auth[_0x421e('0x8')](),controller[_0x421e('0x2d')]);router['get']('/sms/queues/waitinginteractions',auth[_0x421e('0x8')](),controller[_0x421e('0x2e')]);router['get'](_0x421e('0x2f'),auth[_0x421e('0x8')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0x421e('0x30'),auth[_0x421e('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x421e('0x31')](_0x421e('0x32'),auth[_0x421e('0x8')](),controller[_0x421e('0x33')]('mail'));router[_0x421e('0x6')](_0x421e('0x34'),auth[_0x421e('0x8')](),controller['showMailQueues']);router[_0x421e('0x31')](_0x421e('0x35'),auth[_0x421e('0x8')](),controller[_0x421e('0x33')](_0x421e('0x36')));router['get']('/chat/queues/:id',auth[_0x421e('0x8')](),controller[_0x421e('0x37')]);router[_0x421e('0x31')](_0x421e('0x38'),auth['isAuthenticated'](),controller[_0x421e('0x33')](_0x421e('0x39')));router['get'](_0x421e('0x3a'),auth[_0x421e('0x8')](),controller[_0x421e('0x3b')]);router[_0x421e('0x31')](_0x421e('0x3c'),auth[_0x421e('0x8')](),controller['queueNotify'](_0x421e('0x3d')));router[_0x421e('0x6')](_0x421e('0x3e'),auth[_0x421e('0x8')](),controller[_0x421e('0x3f')]);router[_0x421e('0x31')]('/sms/queues/:id/notify',auth[_0x421e('0x8')](),controller[_0x421e('0x33')]('sms'));router['post'](_0x421e('0x40'),auth['isAuthenticated'](),controller[_0x421e('0x33')]('whatsapp'));router['get'](_0x421e('0x41'),auth[_0x421e('0x8')](),controller['showSmsQueues']);router[_0x421e('0x6')](_0x421e('0x42'),auth[_0x421e('0x8')](),controller['showWhatsappQueues']);router['post'](_0x421e('0x43'),auth[_0x421e('0x8')](),controller[_0x421e('0x44')]);module[_0x421e('0x45')]=router; \ No newline at end of file +var _0x3969=['/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','/campaigns','faxAccounts','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions'];(function(_0x23cd80,_0x1693e6){var _0x2bd9bb=function(_0x2c42d3){while(--_0x2c42d3){_0x23cd80['push'](_0x23cd80['shift']());}};_0x2bd9bb(++_0x1693e6);}(_0x3969,0x1a6));var _0x9396=function(_0x24dd9c,_0xb63c6b){_0x24dd9c=_0x24dd9c-0x0;var _0x5b46ac=_0x3969[_0x24dd9c];return _0x5b46ac;};'use strict';var multer=require(_0x9396('0x0'));var util=require(_0x9396('0x1'));var path=require(_0x9396('0x2'));var express=require(_0x9396('0x3'));var router=express[_0x9396('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0x9396('0x5'));router[_0x9396('0x6')](_0x9396('0x7'),auth[_0x9396('0x8')](),controller[_0x9396('0x9')]);router[_0x9396('0x6')](_0x9396('0xa'),auth[_0x9396('0x8')](),controller['voiceChannelMixMonitor']);router['get'](_0x9396('0xb'),auth[_0x9396('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x9396('0x6')](_0x9396('0xc'),auth[_0x9396('0x8')](),controller[_0x9396('0xd')]);router['get'](_0x9396('0xe'),auth[_0x9396('0x8')](),controller[_0x9396('0xf')]);router[_0x9396('0x6')]('/mail/queues',auth[_0x9396('0x8')](),controller[_0x9396('0x10')]);router[_0x9396('0x6')](_0x9396('0x11'),auth[_0x9396('0x8')](),controller[_0x9396('0x12')]);router[_0x9396('0x6')](_0x9396('0x13'),auth[_0x9396('0x8')](),controller[_0x9396('0x14')]);router[_0x9396('0x6')](_0x9396('0x15'),auth[_0x9396('0x8')](),controller[_0x9396('0x16')]);router[_0x9396('0x6')](_0x9396('0x17'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x9396('0x6')](_0x9396('0x18'),auth['isAuthenticated'](),controller['faxQueues']);router['get'](_0x9396('0x19'),auth[_0x9396('0x8')](),controller[_0x9396('0x1a')]);router['get'](_0x9396('0x1b'),auth[_0x9396('0x8')](),controller[_0x9396('0x1c')]);router['get'](_0x9396('0x1d'),auth[_0x9396('0x8')](),controller['voiceQueuesChannel']);router[_0x9396('0x6')](_0x9396('0x1e'),auth['isAuthenticated'](),controller[_0x9396('0x1f')]);router[_0x9396('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x9396('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0x9396('0x6')](_0x9396('0x20'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x9396('0x21')](_0x9396('0x20'),auth[_0x9396('0x8')](),controller[_0x9396('0x22')]);router[_0x9396('0x6')](_0x9396('0x23'),auth['isAuthenticated'](),controller[_0x9396('0x24')]);router[_0x9396('0x6')](_0x9396('0x25'),auth[_0x9396('0x8')](),controller['outboundChannels']);router[_0x9396('0x6')](_0x9396('0x26'),auth[_0x9396('0x8')](),controller[_0x9396('0x27')]);router['put'](_0x9396('0x28'),auth[_0x9396('0x8')](),controller['agentCapacity']);router[_0x9396('0x6')](_0x9396('0x29'),auth[_0x9396('0x8')](),controller[_0x9396('0x2a')]);router[_0x9396('0x6')](_0x9396('0x2b'),auth['isAuthenticated'](),controller['trunks']);router[_0x9396('0x6')](_0x9396('0x2c'),auth[_0x9396('0x8')](),controller['campaigns']);router['get']('/fax/accounts',auth[_0x9396('0x8')](),controller[_0x9396('0x2d')]);router[_0x9396('0x6')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router['get'](_0x9396('0x2e'),auth[_0x9396('0x8')](),controller[_0x9396('0x2f')]);router['get'](_0x9396('0x30'),auth[_0x9396('0x8')](),controller[_0x9396('0x31')]);router['get'](_0x9396('0x32'),auth[_0x9396('0x8')](),controller[_0x9396('0x33')]);router[_0x9396('0x6')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get'](_0x9396('0x34'),auth['isAuthenticated'](),controller[_0x9396('0x35')]);router[_0x9396('0x6')](_0x9396('0x36'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x9396('0x37')](_0x9396('0x38'),auth[_0x9396('0x8')](),controller[_0x9396('0x39')]('mail'));router[_0x9396('0x6')](_0x9396('0x3a'),auth['isAuthenticated'](),controller[_0x9396('0x3b')]);router[_0x9396('0x37')](_0x9396('0x3c'),auth['isAuthenticated'](),controller[_0x9396('0x39')]('chat'));router['get'](_0x9396('0x3d'),auth[_0x9396('0x8')](),controller[_0x9396('0x3e')]);router[_0x9396('0x37')]('/fax/queues/:id/notify',auth[_0x9396('0x8')](),controller[_0x9396('0x39')](_0x9396('0x3f')));router['get'](_0x9396('0x40'),auth[_0x9396('0x8')](),controller[_0x9396('0x41')]);router['post'](_0x9396('0x42'),auth[_0x9396('0x8')](),controller[_0x9396('0x39')](_0x9396('0x43')));router[_0x9396('0x6')]('/openchannel/queues/:id',auth[_0x9396('0x8')](),controller[_0x9396('0x44')]);router[_0x9396('0x37')](_0x9396('0x45'),auth[_0x9396('0x8')](),controller[_0x9396('0x39')](_0x9396('0x46')));router[_0x9396('0x37')](_0x9396('0x47'),auth[_0x9396('0x8')](),controller[_0x9396('0x39')](_0x9396('0x48')));router['get'](_0x9396('0x49'),auth['isAuthenticated'](),controller[_0x9396('0x4a')]);router[_0x9396('0x6')](_0x9396('0x4b'),auth[_0x9396('0x8')](),controller['showWhatsappQueues']);router[_0x9396('0x37')](_0x9396('0x4c'),auth['isAuthenticated'](),controller[_0x9396('0x4d')]);module[_0x9396('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 83dd7ee..d6dfba4 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 _0xe672=['From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Website','Agent\x20not\x20found','update','agentTransferTimeout','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','message','result','catch','status','json','sendStatus','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','agentCapacity','user','interaction','hasOwnProperty','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','agent','internal','AgentCapacity','capacity','telephones','trunks','Trunks','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','chat','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId'];(function(_0x26f77a,_0xccf937){var _0x33b99a=function(_0x1e46f9){while(--_0x1e46f9){_0x26f77a['push'](_0x26f77a['shift']());}};_0x33b99a(++_0xccf937);}(_0xe672,0x105));var _0x2e67=function(_0x9f5b74,_0x228fd4){_0x9f5b74=_0x9f5b74-0x0;var _0x459dfe=_0xe672[_0x9f5b74];return _0x459dfe;};'use strict';var BPromise=require('bluebird');var moment=require(_0x2e67('0x0'));var _=require(_0x2e67('0x1'));var util=require(_0x2e67('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x2e67('0x3'))(_0x2e67('0x4'));var jayson=require(_0x2e67('0x5'));var amiClient=jayson[_0x2e67('0x6')][_0x2e67('0x7')]({'port':0x232a});var mailClient=jayson[_0x2e67('0x6')][_0x2e67('0x7')]({'port':0x232b});var routingClient=jayson[_0x2e67('0x6')][_0x2e67('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x4a3bad,_0x3f77fc,_0x274443){return new BPromise(function(_0x29472a,_0x32c3ae){var _0x592105=_0x274443?_0x274443:amiClient;return _0x592105[_0x2e67('0x8')](_0x4a3bad,_0x3f77fc)[_0x2e67('0x9')](function(_0xd9a4f){if(_0xd9a4f[_0x2e67('0xa')]){if(_0xd9a4f[_0x2e67('0xa')]['code']===0x1f4){return _0x32c3ae(_0xd9a4f[_0x2e67('0xa')][_0x2e67('0xb')]);}return _0x29472a(_0xd9a4f[_0x2e67('0xa')]['message']);}else{_0x29472a(_0xd9a4f[_0x2e67('0xc')]);}})[_0x2e67('0xd')](function(_0x2e67c8){_0x32c3ae(_0x2e67c8);});});}function respondWithResult(_0x4b30ec,_0x1a3a50){_0x1a3a50=_0x1a3a50||0xc8;return function(_0x3b1b5f){if(_0x3b1b5f){return _0x4b30ec[_0x2e67('0xe')](_0x1a3a50)[_0x2e67('0xf')](_0x3b1b5f);}return _0x4b30ec[_0x2e67('0x10')](0x194);};}function handleError(_0x59d7fa,_0x46cc44){_0x46cc44=_0x46cc44||0x1f4;return function(_0x218c90){logger[_0x2e67('0xa')](_0x218c90['stack']);if(_0x218c90[_0x2e67('0x11')]){delete _0x218c90[_0x2e67('0x11')];}_0x59d7fa['status'](_0x46cc44)[_0x2e67('0x12')](_0x218c90);};}function findById(_0x1a40fb){return function(_0x11167a){if(!_[_0x2e67('0x13')](_0x1a40fb)&&!_[_0x2e67('0x13')](_0x11167a)&&!_[_0x2e67('0x13')](_0x11167a['rows'])){return _[_0x2e67('0x14')](_0x11167a[_0x2e67('0x15')],function(_0x2c3a9d){return _0x2c3a9d['id']==_0x1a40fb;});}return null;};}exports[_0x2e67('0x16')]=function(_0x3cfa85,_0x32afdc){return respondWithRpcPromise(_0x2e67('0x17'),_0x3cfa85[_0x2e67('0x18')])[_0x2e67('0x9')](respondWithResult(_0x32afdc,null))[_0x2e67('0xd')](handleError(_0x32afdc,null));};exports[_0x2e67('0x19')]=function(_0x4ca032,_0x33bbbf){return respondWithRpcPromise(_0x2e67('0x1a'),_[_0x2e67('0x1b')](_0x4ca032['query'],_0x4ca032[_0x2e67('0x1c')]))[_0x2e67('0x9')](respondWithResult(_0x33bbbf,null))['catch'](handleError(_0x33bbbf,null));};exports['voiceChannelStopMixMonitor']=function(_0x452e96,_0xb8940d){return respondWithRpcPromise(_0x2e67('0x1d'),_['merge'](_0x452e96[_0x2e67('0x18')],_0x452e96['params']))[_0x2e67('0x9')](respondWithResult(_0xb8940d,null))[_0x2e67('0xd')](handleError(_0xb8940d,null));};exports['voiceQueues']=function(_0x2b9254,_0x1c7f39){return respondWithRpcPromise(_0x2e67('0x1e'),_0x2b9254[_0x2e67('0x18')])['then'](respondWithResult(_0x1c7f39,null))[_0x2e67('0xd')](handleError(_0x1c7f39,null));};exports['showVoiceQueues']=function(_0x201cd1,_0x419ea8){return respondWithRpcPromise(_0x2e67('0x1e'),_0x201cd1[_0x2e67('0x18')])[_0x2e67('0x9')](findById(_0x201cd1[_0x2e67('0x1c')]['id']))[_0x2e67('0x9')](respondWithResult(_0x419ea8,null))[_0x2e67('0xd')](handleError(_0x419ea8,null));};exports[_0x2e67('0x1f')]=function(_0xf0b9a0,_0x21173c){return respondWithRpcPromise(_0x2e67('0x20'),_[_0x2e67('0x1b')](_0xf0b9a0[_0x2e67('0x21')],_0xf0b9a0[_0x2e67('0x1c')]))['then'](respondWithResult(_0x21173c,null))[_0x2e67('0xd')](handleError(_0x21173c,null));};exports[_0x2e67('0x22')]=function(_0x59f68e,_0x1189c5){return respondWithRpcPromise(_0x2e67('0x23'),_[_0x2e67('0x1b')](_0x59f68e[_0x2e67('0x18')],_0x59f68e['params']))[_0x2e67('0x9')](respondWithResult(_0x1189c5,null))['catch'](handleError(_0x1189c5,null));};exports[_0x2e67('0x24')]=function(_0x7deca4,_0x3dc39c){return respondWithRpcPromise('VoiceQueuesChannels',_0x7deca4[_0x2e67('0x18')])[_0x2e67('0x9')](respondWithResult(_0x3dc39c,null))[_0x2e67('0xd')](handleError(_0x3dc39c,null));};exports['voiceQueuesChannel']=function(_0x45d846,_0x6f026c){return respondWithRpcPromise(_0x2e67('0x25'),_['merge'](_0x45d846['query'],_0x45d846[_0x2e67('0x1c')]))[_0x2e67('0x9')](respondWithResult(_0x6f026c,null))[_0x2e67('0xd')](handleError(_0x6f026c,null));};exports[_0x2e67('0x26')]=function(_0x36f39c,_0x52ff76){return respondWithRpcPromise(_0x2e67('0x27'),_['merge'](_0x36f39c[_0x2e67('0x18')],_0x36f39c[_0x2e67('0x1c')]))[_0x2e67('0x9')](respondWithResult(_0x52ff76,null))[_0x2e67('0xd')](handleError(_0x52ff76,null));};exports['voiceQueuesChannelRedirect']=function(_0x3408ce,_0x2a999e){return respondWithRpcPromise(_0x2e67('0x28'),_['merge'](_0x3408ce[_0x2e67('0x18')],_0x3408ce[_0x2e67('0x1c')]))[_0x2e67('0x9')](respondWithResult(_0x2a999e,null))[_0x2e67('0xd')](handleError(_0x2a999e,null));};exports[_0x2e67('0x29')]=function(_0x2796e9,_0x40d145){return respondWithRpcPromise(_0x2e67('0x2a'),_0x2796e9[_0x2e67('0x18')])[_0x2e67('0x9')](respondWithResult(_0x40d145,null))[_0x2e67('0xd')](handleError(_0x40d145,null));};exports['outboundChannels']=function(_0x3bb100,_0x34ad81){return respondWithRpcPromise(_0x2e67('0x2b'),_0x3bb100[_0x2e67('0x18')])[_0x2e67('0x9')](respondWithResult(_0x34ad81,null))[_0x2e67('0xd')](handleError(_0x34ad81,null));};exports[_0x2e67('0x2c')]=function(_0x3556cc,_0x5f2716){var _0x167f4e;return respondWithRpcPromise('Agents',_0x3556cc[_0x2e67('0x18')])['then'](function(_0x2816da){_0x167f4e=_0x2816da;return respondWithRpcPromise('Agents',_0x3556cc[_0x2e67('0x18')],routingClient);})[_0x2e67('0x9')](function(_0x4fbf04){return _[_0x2e67('0x1b')]({},_0x4fbf04,_0x167f4e);})[_0x2e67('0x9')](respondWithResult(_0x5f2716,null))[_0x2e67('0xd')](handleError(_0x5f2716,null));};exports[_0x2e67('0x2d')]=function(_0x43e49c,_0x346a62){if(_0x43e49c['body']&&_0x43e49c[_0x2e67('0x21')]['interaction']&&_0x43e49c[_0x2e67('0x2e')]&&_0x43e49c['user'][_0x2e67('0x11')]){for(var _0x4f3a7e in _0x43e49c['body']['interaction']){if(_0x43e49c['body'][_0x2e67('0x2f')][_0x2e67('0x30')](_0x4f3a7e)){db['MemberReport'][_0x2e67('0x31')]({'where':{'channel':_0x4f3a7e,'membername':_0x43e49c[_0x2e67('0x2e')][_0x2e67('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x43e49c[_0x2e67('0x21')][_0x2e67('0x2f')][_0x4f3a7e]&&_0x43e49c[_0x2e67('0x21')]['interaction'][_0x4f3a7e]['length']?{'$notIn':_0x43e49c[_0x2e67('0x21')][_0x2e67('0x2f')][_0x4f3a7e]}:{'$ne':null}}})[_0x2e67('0x9')](function(_0x59212a){var _0x13c088=moment()[_0x2e67('0x32')](_0x2e67('0x33'));for(var _0x25ee13=0x0,_0x326eb7=_0x59212a[_0x2e67('0x34')];_0x25ee13<_0x326eb7;_0x25ee13+=0x1){_0x59212a[_0x25ee13][_0x2e67('0x35')]({'exitAt':_0x13c088});}});for(var _0x5b4f89=0x0;_0x5b4f89<_0x43e49c[_0x2e67('0x21')][_0x2e67('0x2f')][_0x4f3a7e]['length'];_0x5b4f89+=0x1){db[_0x2e67('0x36')][_0x2e67('0x37')]({'where':{'channel':_0x4f3a7e,'membername':_0x43e49c[_0x2e67('0x2e')]['name'],'type':_0x2e67('0x38'),'uniqueid':_0x43e49c[_0x2e67('0x21')][_0x2e67('0x2f')][_0x4f3a7e][_0x5b4f89],'exitAt':null},'defaults':{'channel':_0x4f3a7e,'membername':_0x43e49c['user'][_0x2e67('0x11')],'interface':_[_0x2e67('0x13')](_0x43e49c[_0x2e67('0x2e')][_0x2e67('0x39')])?util[_0x2e67('0x32')]('SIP/%s',_0x43e49c['user'][_0x2e67('0x11')]):_0x43e49c['user'][_0x2e67('0x39')],'type':'INTERACTION','enterAt':moment()[_0x2e67('0x32')](_0x2e67('0x33')),'role':_0x2e67('0x3a'),'internal':_0x43e49c[_0x2e67('0x2e')][_0x2e67('0x3b')],'uniqueid':_0x43e49c['body']['interaction'][_0x4f3a7e][_0x5b4f89]}});}}}}return respondWithRpcPromise(_0x2e67('0x3c'),{'id':_0x43e49c[_0x2e67('0x1c')]['id'],'capacity':_0x43e49c['body'][_0x2e67('0x3d')]},routingClient)['then'](respondWithResult(_0x346a62,null))[_0x2e67('0xd')](handleError(_0x346a62,null));};exports[_0x2e67('0x3e')]=function(_0xeb689a,_0x192154){return respondWithRpcPromise('Telephones',_0xeb689a[_0x2e67('0x18')])[_0x2e67('0x9')](respondWithResult(_0x192154,null))['catch'](handleError(_0x192154,null));};exports[_0x2e67('0x3f')]=function(_0x1247ec,_0x3a934f){return respondWithRpcPromise(_0x2e67('0x40'),_0x1247ec['query'])['then'](respondWithResult(_0x3a934f,null))[_0x2e67('0xd')](handleError(_0x3a934f,null));};exports['campaigns']=function(_0x45f106,_0x2dafc9){return respondWithRpcPromise(_0x2e67('0x41'),_0x45f106[_0x2e67('0x18')])['then'](respondWithResult(_0x2dafc9,null))[_0x2e67('0xd')](handleError(_0x2dafc9,null));};exports['chatQueues']=function(_0x1103d6,_0xb6e371){return respondWithRpcPromise(_0x2e67('0x42'),_0x1103d6[_0x2e67('0x18')],routingClient)[_0x2e67('0x9')](respondWithResult(_0xb6e371,null))[_0x2e67('0xd')](handleError(_0xb6e371,null));};exports[_0x2e67('0x43')]=function(_0x566ce3,_0x1bbf9f){return respondWithRpcPromise('ChatQueues',_0x566ce3[_0x2e67('0x18')],routingClient)[_0x2e67('0x9')](findById(_0x566ce3[_0x2e67('0x1c')]['id']))[_0x2e67('0x9')](respondWithResult(_0x1bbf9f,null))['catch'](handleError(_0x1bbf9f,null));};exports[_0x2e67('0x44')]=function(_0x5059ee,_0x2a1a52){return respondWithRpcPromise(_0x2e67('0x45'),_0x5059ee[_0x2e67('0x18')],routingClient)[_0x2e67('0x9')](respondWithResult(_0x2a1a52,null))[_0x2e67('0xd')](handleError(_0x2a1a52,null));};exports[_0x2e67('0x46')]=function(_0x8447d7,_0x2b33ba){return respondWithRpcPromise(_0x2e67('0x45'),_0x8447d7[_0x2e67('0x18')],routingClient)['then'](findById(_0x8447d7[_0x2e67('0x1c')]['id']))[_0x2e67('0x9')](respondWithResult(_0x2b33ba,null))[_0x2e67('0xd')](handleError(_0x2b33ba,null));};exports[_0x2e67('0x47')]=function(_0x44f6a7,_0x5e6dd1){return respondWithRpcPromise('MailAccounts',_0x44f6a7[_0x2e67('0x18')],mailClient)[_0x2e67('0x9')](respondWithResult(_0x5e6dd1,null))[_0x2e67('0xd')](handleError(_0x5e6dd1,null));};exports[_0x2e67('0x48')]=function(_0x13b6af,_0x35078a){return respondWithRpcPromise(_0x2e67('0x49'),_0x13b6af['query'],routingClient)[_0x2e67('0x9')](respondWithResult(_0x35078a,null))[_0x2e67('0xd')](handleError(_0x35078a,null));};exports[_0x2e67('0x4a')]=function(_0x139d7a,_0x16a0c1){return respondWithRpcPromise(_0x2e67('0x49'),_0x139d7a[_0x2e67('0x18')],routingClient)[_0x2e67('0x9')](findById(_0x139d7a[_0x2e67('0x1c')]['id']))[_0x2e67('0x9')](respondWithResult(_0x16a0c1,null))[_0x2e67('0xd')](handleError(_0x16a0c1,null));};exports[_0x2e67('0x4b')]=function(_0x201203,_0xf6eebc){return respondWithRpcPromise(_0x2e67('0x4c'),_0x201203['query'],routingClient)[_0x2e67('0x9')](respondWithResult(_0xf6eebc,null))[_0x2e67('0xd')](handleError(_0xf6eebc,null));};exports[_0x2e67('0x4d')]=function(_0x4dc6b9,_0x18c765){return respondWithRpcPromise(_0x2e67('0x4c'),_0x4dc6b9[_0x2e67('0x18')],routingClient)[_0x2e67('0x9')](findById(_0x4dc6b9[_0x2e67('0x1c')]['id']))[_0x2e67('0x9')](respondWithResult(_0x18c765,null))[_0x2e67('0xd')](handleError(_0x18c765,null));};exports['whatsappQueues']=function(_0x54cee3,_0x3c93e1){return respondWithRpcPromise('WhatsappQueues',_0x54cee3[_0x2e67('0x18')],routingClient)[_0x2e67('0x9')](respondWithResult(_0x3c93e1,null))['catch'](handleError(_0x3c93e1,null));};exports[_0x2e67('0x4e')]=function(_0x2b61a2,_0x3cf871){return respondWithRpcPromise(_0x2e67('0x4f'),_0x2b61a2[_0x2e67('0x18')],routingClient)['then'](findById(_0x2b61a2[_0x2e67('0x1c')]['id']))['then'](respondWithResult(_0x3cf871,null))[_0x2e67('0xd')](handleError(_0x3cf871,null));};exports[_0x2e67('0x50')]=function(_0xc42cbe,_0x57c73a){return respondWithRpcPromise(_0x2e67('0x51'),_0xc42cbe['query'],routingClient)[_0x2e67('0x9')](respondWithResult(_0x57c73a,null))['catch'](handleError(_0x57c73a,null));};exports[_0x2e67('0x52')]=function(_0x59e07a,_0x33a67d){return respondWithRpcPromise(_0x2e67('0x51'),_0x59e07a[_0x2e67('0x18')],routingClient)[_0x2e67('0x9')](findById(_0x59e07a[_0x2e67('0x1c')]['id']))['then'](respondWithResult(_0x33a67d,null))['catch'](handleError(_0x33a67d,null));};exports[_0x2e67('0x53')]=function(_0xa1e01b,_0x5b0227){return respondWithRpcPromise(_0x2e67('0x54'),_0xa1e01b['query'])['then'](respondWithResult(_0x5b0227,null))['catch'](handleError(_0x5b0227,null));};exports[_0x2e67('0x55')]=function(_0x382df4,_0xc6d363){return respondWithRpcPromise(_0x2e67('0x56'),_0x382df4[_0x2e67('0x18')],routingClient)[_0x2e67('0x9')](respondWithResult(_0xc6d363,null))[_0x2e67('0xd')](handleError(_0xc6d363,null));};exports['mailQueuesWaitingInteractions']=function(_0x438c3d,_0x33d85a){return respondWithRpcPromise(_0x2e67('0x57'),_0x438c3d[_0x2e67('0x18')],routingClient)[_0x2e67('0x9')](respondWithResult(_0x33d85a,null))['catch'](handleError(_0x33d85a,null));};exports[_0x2e67('0x58')]=function(_0x1e3451,_0x180dfb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1e3451[_0x2e67('0x18')],routingClient)['then'](respondWithResult(_0x180dfb,null))['catch'](handleError(_0x180dfb,null));};exports[_0x2e67('0x59')]=function(_0x3cc115,_0xe8ca36){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3cc115[_0x2e67('0x18')],routingClient)[_0x2e67('0x9')](function(_0x1ca7cb){if(_0x3cc115['query']['type']!==undefined){var _0x16f88d=_(_0x1ca7cb[_0x2e67('0x15')])['filter']([_0x3cc115[_0x2e67('0x18')][_0x2e67('0x5a')],_0x3cc115[_0x2e67('0x1c')]['id']])[_0x2e67('0x5b')](_0x2e67('0x5c'))[_0x2e67('0x5d')]()[_0x2e67('0x5e')]();return _0x1ca7cb['rows'][_0x2e67('0x5f')](function(_0x4eac6a){return _0x16f88d['indexOf'](_0x4eac6a['queue_id'])>-0x1;});}else{return _0x1ca7cb[_0x2e67('0x15')][_0x2e67('0x5f')](function(_0x1dedc3){return _0x1dedc3[_0x2e67('0x5c')]===parseInt(_0x3cc115[_0x2e67('0x1c')]['id']);});}})[_0x2e67('0x9')](respondWithResult(_0xe8ca36,null))[_0x2e67('0xd')](handleError(_0xe8ca36,null));};exports['smsQueuesWaitingInteractions']=function(_0x196318,_0x5f17cf){return respondWithRpcPromise(_0x2e67('0x60'),_0x196318['query'],routingClient)[_0x2e67('0x9')](respondWithResult(_0x5f17cf,null))[_0x2e67('0xd')](handleError(_0x5f17cf,null));};exports[_0x2e67('0x61')]=function(_0x4c1f94,_0x49c2d6){return respondWithRpcPromise(_0x2e67('0x62'),_0x4c1f94[_0x2e67('0x18')],routingClient)['then'](respondWithResult(_0x49c2d6,null))[_0x2e67('0xd')](handleError(_0x49c2d6,null));};exports['faxQueuesWaitingInteractions']=function(_0x5cc372,_0x31ec88){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5cc372[_0x2e67('0x18')],routingClient)[_0x2e67('0x9')](respondWithResult(_0x31ec88,null))['catch'](handleError(_0x31ec88,null));};exports[_0x2e67('0x63')]=function(_0x1ef8ff){return function(_0x2458fa,_0x10bd45){var _0x41a9a0,_0x150dde;var _0x29f834=_['capitalize'](_0x1ef8ff);var _0x72b77e=_0x1ef8ff===_0x2e67('0x64')?'Website':_0x2e67('0x65');return db[_0x29f834+_0x2e67('0x66')][_0x2e67('0x67')]({'raw':!![],'where':{'id':_0x2458fa[_0x2e67('0x1c')]['id']}})[_0x2e67('0x9')](function(_0x40915a){if(_[_0x2e67('0x13')](_0x40915a)){throw new Error(_0x29f834+'\x20Queue\x20not\x20found');}_0x41a9a0=_0x40915a;return db[_0x29f834+_0x2e67('0x68')][_0x2e67('0x67')]({'where':{'id':_0x2458fa['body'][_0x2e67('0x69')]},'include':[{'model':db[_0x29f834+'Interaction'],'as':_0x2e67('0x6a')},{'model':db[_0x29f834+_0x72b77e],'as':_0x2e67('0x65')}]});})[_0x2e67('0x9')](function(_0x53a2e3){if(_[_0x2e67('0x13')](_0x53a2e3)){throw new Error(_0x29f834+_0x2e67('0x6b'));}_0x150dde=_0x53a2e3;return _0x53a2e3['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x2e67('0x9')](function(){var _0x3a283f={'uniqueid':_0x1ef8ff+'.'+_0x150dde['id']+'.'+_0x150dde['Interaction']['id'],'FromUserId':_0x2458fa[_0x2e67('0x2e')]['id'],'type':_0x2e67('0x6c')};_0x3a283f[_0x29f834+_0x2e67('0x6d')]=_0x150dde['id'];_0x3a283f[_0x29f834+_0x2e67('0x6e')]=_0x150dde[_0x2e67('0x6a')]['id'];_0x3a283f[_0x2e67('0x6f')+_0x29f834+_0x72b77e+'Id']=_0x150dde[_0x2e67('0x65')]['id'];_0x3a283f['To'+_0x29f834+_0x2e67('0x70')]=_0x41a9a0['id'];return db[_0x29f834+_0x2e67('0x71')][_0x2e67('0x72')](_0x3a283f);})['then'](function(){return respondWithRpcPromise(_0x2e67('0x73'),{'channel':_0x1ef8ff,'interaction':_0x150dde[_0x2e67('0x6a')],'message':_0x150dde,'account':_0x150dde[_0x2e67('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2e67('0x6c'),'appdata':_0x41a9a0[_0x2e67('0x11')]+','+(_0x150dde[_0x2e67('0x65')][_0x2e67('0x74')]||0x12c),'interval':_0x2e67('0x75')}]},routingClient);})[_0x2e67('0x9')](respondWithResult(_0x10bd45,null))[_0x2e67('0xd')](handleError(_0x10bd45,null));};};exports[_0x2e67('0x76')]=function(_0x3e2772,_0x3d29c5){var _0x136ff6,_0x5e6cb2;if(_[_0x2e67('0x13')](_0x3e2772[_0x2e67('0x21')][_0x2e67('0x77')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x25ba99=_0x3e2772[_0x2e67('0x21')]['channel'];var _0x8ef2a8=_['capitalize'](_0x25ba99);var _0x4811ce=_0x25ba99===_0x2e67('0x64')?_0x2e67('0x78'):_0x2e67('0x65');return db['User'][_0x2e67('0x67')]({'raw':!![],'where':{'id':_0x3e2772[_0x2e67('0x1c')]['id'],'role':_0x2e67('0x3a')}})[_0x2e67('0x9')](function(_0x5c16f4){if(_[_0x2e67('0x13')](_0x5c16f4)){throw new Error(_0x2e67('0x79'));}_0x136ff6=_0x5c16f4;return db[_0x8ef2a8+'Message']['findOne']({'where':{'id':_0x3e2772[_0x2e67('0x21')][_0x2e67('0x69')]},'include':[{'model':db[_0x8ef2a8+_0x2e67('0x6a')],'as':_0x2e67('0x6a')},{'model':db[_0x8ef2a8+_0x4811ce],'as':_0x2e67('0x65')}]});})[_0x2e67('0x9')](function(_0x535181){if(_[_0x2e67('0x13')](_0x535181)){throw new Error(_0x8ef2a8+'\x20Message\x20not\x20found');}_0x5e6cb2=_0x535181;return _0x535181[_0x2e67('0x7a')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2e67('0x9')](function(){var _0x3a4d23={'uniqueid':_0x25ba99+'.'+_0x5e6cb2['id']+'.'+_0x5e6cb2[_0x2e67('0x6a')]['id'],'FromUserId':_0x3e2772['user']['id'],'type':'agent','ToUserId':_0x136ff6['id']};_0x3a4d23[_0x8ef2a8+_0x2e67('0x6d')]=_0x5e6cb2['id'];_0x3a4d23[_0x8ef2a8+_0x2e67('0x6e')]=_0x5e6cb2[_0x2e67('0x6a')]['id'];_0x3a4d23['From'+_0x8ef2a8+_0x4811ce+'Id']=_0x5e6cb2['Account']['id'];return db[_0x8ef2a8+_0x2e67('0x71')][_0x2e67('0x72')](_0x3a4d23);})[_0x2e67('0x9')](function(){return respondWithRpcPromise(_0x2e67('0x73'),{'channel':_0x25ba99,'interaction':_0x5e6cb2['Interaction'],'message':_0x5e6cb2,'account':_0x5e6cb2[_0x2e67('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2e67('0x3a'),'appdata':_0x136ff6[_0x2e67('0x11')]+','+(_0x5e6cb2[_0x2e67('0x65')][_0x2e67('0x7b')]||0x12c),'interval':_0x2e67('0x75')}]},routingClient);})[_0x2e67('0x9')](respondWithResult(_0x3d29c5,null))['catch'](handleError(_0x3d29c5,null));}; \ No newline at end of file +var _0x82bb=['faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','update','Interaction','From','TransferReport','create','Start','queue','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','MessageId','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','json','name','send','isNil','rows','voiceChannels','catch','voiceChannelMixMonitor','merge','query','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','interface','format','SIP/%s','agent','internal','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x82bb,0xa9));var _0xb82b=function(_0x4d68b0,_0x454a7e){_0x4d68b0=_0x4d68b0-0x0;var _0x539a83=_0x82bb[_0x4d68b0];return _0x539a83;};'use strict';var BPromise=require(_0xb82b('0x0'));var moment=require(_0xb82b('0x1'));var _=require('lodash');var util=require(_0xb82b('0x2'));var db=require(_0xb82b('0x3'))['db'];var logger=require(_0xb82b('0x4'))(_0xb82b('0x5'));var jayson=require(_0xb82b('0x6'));var amiClient=jayson[_0xb82b('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0xb82b('0x7')][_0xb82b('0x8')]({'port':0x232b});var routingClient=jayson[_0xb82b('0x7')][_0xb82b('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x3e6ca7,_0x90b2,_0x255153){return new BPromise(function(_0x322068,_0x16b683){var _0x461cf1=_0x255153?_0x255153:amiClient;return _0x461cf1[_0xb82b('0x9')](_0x3e6ca7,_0x90b2)[_0xb82b('0xa')](function(_0x39181b){if(_0x39181b[_0xb82b('0xb')]){if(_0x39181b[_0xb82b('0xb')][_0xb82b('0xc')]===0x1f4){return _0x16b683(_0x39181b[_0xb82b('0xb')][_0xb82b('0xd')]);}return _0x322068(_0x39181b[_0xb82b('0xb')][_0xb82b('0xd')]);}else{_0x322068(_0x39181b[_0xb82b('0xe')]);}})['catch'](function(_0x14f518){_0x16b683(_0x14f518);});});}function respondWithResult(_0x486689,_0xa9ad96){_0xa9ad96=_0xa9ad96||0xc8;return function(_0x23427e){if(_0x23427e){return _0x486689['status'](_0xa9ad96)[_0xb82b('0xf')](_0x23427e);}return _0x486689['sendStatus'](0x194);};}function handleError(_0x220c4d,_0x337568){_0x337568=_0x337568||0x1f4;return function(_0x3ad17f){logger[_0xb82b('0xb')](_0x3ad17f['stack']);if(_0x3ad17f[_0xb82b('0x10')]){delete _0x3ad17f[_0xb82b('0x10')];}_0x220c4d['status'](_0x337568)[_0xb82b('0x11')](_0x3ad17f);};}function findById(_0x28b86e){return function(_0x554b1c){if(!_[_0xb82b('0x12')](_0x28b86e)&&!_[_0xb82b('0x12')](_0x554b1c)&&!_[_0xb82b('0x12')](_0x554b1c[_0xb82b('0x13')])){return _['find'](_0x554b1c[_0xb82b('0x13')],function(_0x3dd016){return _0x3dd016['id']==_0x28b86e;});}return null;};}exports[_0xb82b('0x14')]=function(_0x349462,_0x249d07){return respondWithRpcPromise('VoiceChannels',_0x349462['query'])['then'](respondWithResult(_0x249d07,null))[_0xb82b('0x15')](handleError(_0x249d07,null));};exports[_0xb82b('0x16')]=function(_0xa70895,_0x54784f){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xb82b('0x17')](_0xa70895[_0xb82b('0x18')],_0xa70895['params']))[_0xb82b('0xa')](respondWithResult(_0x54784f,null))[_0xb82b('0x15')](handleError(_0x54784f,null));};exports[_0xb82b('0x19')]=function(_0x53a623,_0x1ee637){return respondWithRpcPromise(_0xb82b('0x1a'),_['merge'](_0x53a623['query'],_0x53a623[_0xb82b('0x1b')]))[_0xb82b('0xa')](respondWithResult(_0x1ee637,null))['catch'](handleError(_0x1ee637,null));};exports[_0xb82b('0x1c')]=function(_0x149d3a,_0x35c046){return respondWithRpcPromise(_0xb82b('0x1d'),_0x149d3a[_0xb82b('0x18')])[_0xb82b('0xa')](respondWithResult(_0x35c046,null))[_0xb82b('0x15')](handleError(_0x35c046,null));};exports[_0xb82b('0x1e')]=function(_0x10987,_0x55c112){return respondWithRpcPromise(_0xb82b('0x1d'),_0x10987[_0xb82b('0x18')])[_0xb82b('0xa')](findById(_0x10987['params']['id']))['then'](respondWithResult(_0x55c112,null))['catch'](handleError(_0x55c112,null));};exports[_0xb82b('0x1f')]=function(_0x3c9d59,_0x425858){return respondWithRpcPromise(_0xb82b('0x20'),_[_0xb82b('0x17')](_0x3c9d59[_0xb82b('0x21')],_0x3c9d59[_0xb82b('0x1b')]))[_0xb82b('0xa')](respondWithResult(_0x425858,null))[_0xb82b('0x15')](handleError(_0x425858,null));};exports[_0xb82b('0x22')]=function(_0x4536fb,_0x12d5f4){return respondWithRpcPromise(_0xb82b('0x23'),_[_0xb82b('0x17')](_0x4536fb[_0xb82b('0x18')],_0x4536fb['params']))[_0xb82b('0xa')](respondWithResult(_0x12d5f4,null))[_0xb82b('0x15')](handleError(_0x12d5f4,null));};exports['voiceQueuesChannels']=function(_0x3ec116,_0x562b2c){return respondWithRpcPromise(_0xb82b('0x24'),_0x3ec116[_0xb82b('0x18')])[_0xb82b('0xa')](respondWithResult(_0x562b2c,null))[_0xb82b('0x15')](handleError(_0x562b2c,null));};exports[_0xb82b('0x25')]=function(_0x4e4888,_0x4f8296){return respondWithRpcPromise(_0xb82b('0x26'),_[_0xb82b('0x17')](_0x4e4888[_0xb82b('0x18')],_0x4e4888[_0xb82b('0x1b')]))['then'](respondWithResult(_0x4f8296,null))[_0xb82b('0x15')](handleError(_0x4f8296,null));};exports[_0xb82b('0x27')]=function(_0x234b2d,_0x64cc81){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xb82b('0x17')](_0x234b2d[_0xb82b('0x18')],_0x234b2d[_0xb82b('0x1b')]))[_0xb82b('0xa')](respondWithResult(_0x64cc81,null))['catch'](handleError(_0x64cc81,null));};exports[_0xb82b('0x28')]=function(_0x2ee84b,_0x2d7dc6){return respondWithRpcPromise(_0xb82b('0x29'),_[_0xb82b('0x17')](_0x2ee84b[_0xb82b('0x18')],_0x2ee84b[_0xb82b('0x1b')]))[_0xb82b('0xa')](respondWithResult(_0x2d7dc6,null))['catch'](handleError(_0x2d7dc6,null));};exports['outbound']=function(_0x57e304,_0x41472e){return respondWithRpcPromise('Outbound',_0x57e304[_0xb82b('0x18')])['then'](respondWithResult(_0x41472e,null))['catch'](handleError(_0x41472e,null));};exports[_0xb82b('0x2a')]=function(_0xa2573c,_0x568725){return respondWithRpcPromise('OutboundChannels',_0xa2573c[_0xb82b('0x18')])[_0xb82b('0xa')](respondWithResult(_0x568725,null))[_0xb82b('0x15')](handleError(_0x568725,null));};exports[_0xb82b('0x2b')]=function(_0x3eb5ff,_0x138ac1){var _0x4eea99;return respondWithRpcPromise(_0xb82b('0x2c'),_0x3eb5ff[_0xb82b('0x18')])[_0xb82b('0xa')](function(_0x544193){_0x4eea99=_0x544193;return respondWithRpcPromise(_0xb82b('0x2c'),_0x3eb5ff['query'],routingClient);})[_0xb82b('0xa')](function(_0x1b0e17){return _[_0xb82b('0x17')]({},_0x1b0e17,_0x4eea99);})[_0xb82b('0xa')](respondWithResult(_0x138ac1,null))['catch'](handleError(_0x138ac1,null));};exports[_0xb82b('0x2d')]=function(_0x6f18c4,_0xbebf7c){if(_0x6f18c4[_0xb82b('0x21')]&&_0x6f18c4[_0xb82b('0x21')][_0xb82b('0x2e')]&&_0x6f18c4['user']&&_0x6f18c4[_0xb82b('0x2f')][_0xb82b('0x10')]){for(var _0x444885 in _0x6f18c4[_0xb82b('0x21')][_0xb82b('0x2e')]){if(_0x6f18c4[_0xb82b('0x21')][_0xb82b('0x2e')][_0xb82b('0x30')](_0x444885)){db[_0xb82b('0x31')][_0xb82b('0x32')]({'where':{'channel':_0x444885,'membername':_0x6f18c4[_0xb82b('0x2f')]['name'],'type':_0xb82b('0x33'),'exitAt':null,'uniqueid':_0x6f18c4['body'][_0xb82b('0x2e')][_0x444885]&&_0x6f18c4['body']['interaction'][_0x444885]['length']?{'$notIn':_0x6f18c4[_0xb82b('0x21')][_0xb82b('0x2e')][_0x444885]}:{'$ne':null}}})[_0xb82b('0xa')](function(_0x41a4a2){var _0x22fb8f=moment()['format'](_0xb82b('0x34'));for(var _0x490b59=0x0,_0x39d7be=_0x41a4a2[_0xb82b('0x35')];_0x490b59<_0x39d7be;_0x490b59+=0x1){_0x41a4a2[_0x490b59][_0xb82b('0x36')]({'exitAt':_0x22fb8f});}});for(var _0x40f315=0x0;_0x40f315<_0x6f18c4[_0xb82b('0x21')]['interaction'][_0x444885]['length'];_0x40f315+=0x1){db[_0xb82b('0x31')]['findOrCreate']({'where':{'channel':_0x444885,'membername':_0x6f18c4['user'][_0xb82b('0x10')],'type':_0xb82b('0x33'),'uniqueid':_0x6f18c4[_0xb82b('0x21')][_0xb82b('0x2e')][_0x444885][_0x40f315],'exitAt':null},'defaults':{'channel':_0x444885,'membername':_0x6f18c4['user']['name'],'interface':_[_0xb82b('0x12')](_0x6f18c4[_0xb82b('0x2f')][_0xb82b('0x37')])?util[_0xb82b('0x38')](_0xb82b('0x39'),_0x6f18c4[_0xb82b('0x2f')][_0xb82b('0x10')]):_0x6f18c4[_0xb82b('0x2f')][_0xb82b('0x37')],'type':'INTERACTION','enterAt':moment()[_0xb82b('0x38')](_0xb82b('0x34')),'role':_0xb82b('0x3a'),'internal':_0x6f18c4[_0xb82b('0x2f')][_0xb82b('0x3b')],'uniqueid':_0x6f18c4['body'][_0xb82b('0x2e')][_0x444885][_0x40f315]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x6f18c4[_0xb82b('0x1b')]['id'],'capacity':_0x6f18c4[_0xb82b('0x21')][_0xb82b('0x3c')]},routingClient)[_0xb82b('0xa')](respondWithResult(_0xbebf7c,null))[_0xb82b('0x15')](handleError(_0xbebf7c,null));};exports[_0xb82b('0x3d')]=function(_0x3f59ab,_0x31866b){return respondWithRpcPromise(_0xb82b('0x3e'),_0x3f59ab['query'])[_0xb82b('0xa')](respondWithResult(_0x31866b,null))[_0xb82b('0x15')](handleError(_0x31866b,null));};exports[_0xb82b('0x3f')]=function(_0x2717db,_0x24661c){return respondWithRpcPromise('Trunks',_0x2717db['query'])['then'](respondWithResult(_0x24661c,null))[_0xb82b('0x15')](handleError(_0x24661c,null));};exports[_0xb82b('0x40')]=function(_0xa589d3,_0x4b7747){return respondWithRpcPromise(_0xb82b('0x41'),_0xa589d3[_0xb82b('0x18')])['then'](respondWithResult(_0x4b7747,null))['catch'](handleError(_0x4b7747,null));};exports[_0xb82b('0x42')]=function(_0x18fdc8,_0x1058fc){return respondWithRpcPromise(_0xb82b('0x43'),_0x18fdc8[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](respondWithResult(_0x1058fc,null))[_0xb82b('0x15')](handleError(_0x1058fc,null));};exports[_0xb82b('0x44')]=function(_0x2f9fb7,_0x5090c2){return respondWithRpcPromise(_0xb82b('0x43'),_0x2f9fb7[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](findById(_0x2f9fb7['params']['id']))[_0xb82b('0xa')](respondWithResult(_0x5090c2,null))[_0xb82b('0x15')](handleError(_0x5090c2,null));};exports['mailQueues']=function(_0x1e7480,_0x36e9ca){return respondWithRpcPromise('MailQueues',_0x1e7480['query'],routingClient)[_0xb82b('0xa')](respondWithResult(_0x36e9ca,null))['catch'](handleError(_0x36e9ca,null));};exports[_0xb82b('0x45')]=function(_0x6aa964,_0x3f0245){return respondWithRpcPromise(_0xb82b('0x46'),_0x6aa964[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](findById(_0x6aa964['params']['id']))['then'](respondWithResult(_0x3f0245,null))[_0xb82b('0x15')](handleError(_0x3f0245,null));};exports['mailAccounts']=function(_0x274683,_0x53aa92){return respondWithRpcPromise('MailAccounts',_0x274683['query'],mailClient)[_0xb82b('0xa')](respondWithResult(_0x53aa92,null))[_0xb82b('0x15')](handleError(_0x53aa92,null));};exports[_0xb82b('0x47')]=function(_0x3ee2e6,_0x43ccc5){return respondWithRpcPromise(_0xb82b('0x48'),_0x3ee2e6[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](respondWithResult(_0x43ccc5,null))[_0xb82b('0x15')](handleError(_0x43ccc5,null));};exports[_0xb82b('0x49')]=function(_0x1fcea9,_0x2982c4){return respondWithRpcPromise(_0xb82b('0x48'),_0x1fcea9[_0xb82b('0x18')],routingClient)['then'](findById(_0x1fcea9[_0xb82b('0x1b')]['id']))[_0xb82b('0xa')](respondWithResult(_0x2982c4,null))['catch'](handleError(_0x2982c4,null));};exports[_0xb82b('0x4a')]=function(_0x39abbb,_0x299583){return respondWithRpcPromise('SmsQueues',_0x39abbb['query'],routingClient)['then'](respondWithResult(_0x299583,null))[_0xb82b('0x15')](handleError(_0x299583,null));};exports['showSmsQueues']=function(_0x33ddde,_0x27d06a){return respondWithRpcPromise(_0xb82b('0x4b'),_0x33ddde[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](findById(_0x33ddde[_0xb82b('0x1b')]['id']))[_0xb82b('0xa')](respondWithResult(_0x27d06a,null))[_0xb82b('0x15')](handleError(_0x27d06a,null));};exports[_0xb82b('0x4c')]=function(_0x2ff3fb,_0x3c349e){return respondWithRpcPromise(_0xb82b('0x4d'),_0x2ff3fb[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](respondWithResult(_0x3c349e,null))[_0xb82b('0x15')](handleError(_0x3c349e,null));};exports[_0xb82b('0x4e')]=function(_0x1737a3,_0x4868c2){return respondWithRpcPromise(_0xb82b('0x4d'),_0x1737a3['query'],routingClient)[_0xb82b('0xa')](findById(_0x1737a3['params']['id']))[_0xb82b('0xa')](respondWithResult(_0x4868c2,null))[_0xb82b('0x15')](handleError(_0x4868c2,null));};exports['faxQueues']=function(_0x43312b,_0x58a6c7){return respondWithRpcPromise(_0xb82b('0x4f'),_0x43312b[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](respondWithResult(_0x58a6c7,null))[_0xb82b('0x15')](handleError(_0x58a6c7,null));};exports[_0xb82b('0x50')]=function(_0x36a3c6,_0x5178e7){return respondWithRpcPromise(_0xb82b('0x4f'),_0x36a3c6[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](findById(_0x36a3c6[_0xb82b('0x1b')]['id']))[_0xb82b('0xa')](respondWithResult(_0x5178e7,null))['catch'](handleError(_0x5178e7,null));};exports[_0xb82b('0x51')]=function(_0x30cfba,_0x3645c2){return respondWithRpcPromise(_0xb82b('0x52'),_0x30cfba[_0xb82b('0x18')])[_0xb82b('0xa')](respondWithResult(_0x3645c2,null))[_0xb82b('0x15')](handleError(_0x3645c2,null));};exports[_0xb82b('0x53')]=function(_0x2ee091,_0x14fb10){return respondWithRpcPromise(_0xb82b('0x54'),_0x2ee091[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](respondWithResult(_0x14fb10,null))['catch'](handleError(_0x14fb10,null));};exports[_0xb82b('0x55')]=function(_0x5d0027,_0x5098b6){return respondWithRpcPromise(_0xb82b('0x56'),_0x5d0027[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](respondWithResult(_0x5098b6,null))[_0xb82b('0x15')](handleError(_0x5098b6,null));};exports[_0xb82b('0x57')]=function(_0x9d6265,_0x52d882){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x9d6265[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](respondWithResult(_0x52d882,null))[_0xb82b('0x15')](handleError(_0x52d882,null));};exports[_0xb82b('0x58')]=function(_0x1a3188,_0x2f43ee){return respondWithRpcPromise(_0xb82b('0x59'),_0x1a3188[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](function(_0x57c828){if(_0x1a3188[_0xb82b('0x18')][_0xb82b('0x5a')]!==undefined){var _0x49d870=_(_0x57c828['rows'])[_0xb82b('0x5b')]([_0x1a3188[_0xb82b('0x18')][_0xb82b('0x5a')],_0x1a3188['params']['id']])[_0xb82b('0x5c')](_0xb82b('0x5d'))[_0xb82b('0x5e')]()[_0xb82b('0x5f')]();return _0x57c828['rows'][_0xb82b('0x5b')](function(_0x36a142){return _0x49d870[_0xb82b('0x60')](_0x36a142[_0xb82b('0x5d')])>-0x1;});}else{return _0x57c828['rows'][_0xb82b('0x5b')](function(_0x17abce){return _0x17abce[_0xb82b('0x5d')]===parseInt(_0x1a3188['params']['id']);});}})[_0xb82b('0xa')](respondWithResult(_0x2f43ee,null))['catch'](handleError(_0x2f43ee,null));};exports[_0xb82b('0x61')]=function(_0x4e2b7d,_0x58da83){return respondWithRpcPromise(_0xb82b('0x62'),_0x4e2b7d[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](respondWithResult(_0x58da83,null))[_0xb82b('0x15')](handleError(_0x58da83,null));};exports[_0xb82b('0x63')]=function(_0x3548b4,_0x3ed361){return respondWithRpcPromise(_0xb82b('0x64'),_0x3548b4['query'],routingClient)['then'](respondWithResult(_0x3ed361,null))[_0xb82b('0x15')](handleError(_0x3ed361,null));};exports[_0xb82b('0x65')]=function(_0xcf3be6,_0x203b59){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0xcf3be6[_0xb82b('0x18')],routingClient)[_0xb82b('0xa')](respondWithResult(_0x203b59,null))[_0xb82b('0x15')](handleError(_0x203b59,null));};exports[_0xb82b('0x66')]=function(_0x8b2079){return function(_0x45fd16,_0x28c813){var _0x4383bd,_0x4206b1;var _0x391e00=_[_0xb82b('0x67')](_0x8b2079);var _0x46c8a3=_0x8b2079===_0xb82b('0x68')?_0xb82b('0x69'):_0xb82b('0x6a');return db[_0x391e00+'Queue'][_0xb82b('0x6b')]({'raw':!![],'where':{'id':_0x45fd16['params']['id']}})[_0xb82b('0xa')](function(_0xa2a6ee){if(_['isNil'](_0xa2a6ee)){throw new Error(_0x391e00+_0xb82b('0x6c'));}_0x4383bd=_0xa2a6ee;return db[_0x391e00+_0xb82b('0x6d')]['findOne']({'where':{'id':_0x45fd16[_0xb82b('0x21')][_0xb82b('0x6e')]},'include':[{'model':db[_0x391e00+'Interaction'],'as':'Interaction'},{'model':db[_0x391e00+_0x46c8a3],'as':_0xb82b('0x6a')}]});})['then'](function(_0x10f270){if(_[_0xb82b('0x12')](_0x10f270)){throw new Error(_0x391e00+_0xb82b('0x6f'));}_0x4206b1=_0x10f270;return _0x10f270[_0xb82b('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb82b('0xa')](function(){var _0x40a535={'uniqueid':_0x8b2079+'.'+_0x4206b1['id']+'.'+_0x4206b1[_0xb82b('0x71')]['id'],'FromUserId':_0x45fd16[_0xb82b('0x2f')]['id'],'type':'queue'};_0x40a535[_0x391e00+'MessageId']=_0x4206b1['id'];_0x40a535[_0x391e00+'InteractionId']=_0x4206b1['Interaction']['id'];_0x40a535[_0xb82b('0x72')+_0x391e00+_0x46c8a3+'Id']=_0x4206b1[_0xb82b('0x6a')]['id'];_0x40a535['To'+_0x391e00+'QueueId']=_0x4383bd['id'];return db[_0x391e00+_0xb82b('0x73')][_0xb82b('0x74')](_0x40a535);})[_0xb82b('0xa')](function(){return respondWithRpcPromise(_0xb82b('0x75'),{'channel':_0x8b2079,'interaction':_0x4206b1[_0xb82b('0x71')],'message':_0x4206b1,'account':_0x4206b1[_0xb82b('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb82b('0x76'),'appdata':_0x4383bd[_0xb82b('0x10')]+','+(_0x4206b1[_0xb82b('0x6a')]['queueTransferTimeout']||0x12c),'interval':_0xb82b('0x77')}]},routingClient);})[_0xb82b('0xa')](respondWithResult(_0x28c813,null))[_0xb82b('0x15')](handleError(_0x28c813,null));};};exports['agentNotify']=function(_0x51d2d3,_0x48ac80){var _0xf13501,_0xe0dd65;if(_[_0xb82b('0x12')](_0x51d2d3[_0xb82b('0x21')][_0xb82b('0x78')])){throw new Error(_0xb82b('0x79'));}var _0x591be2=_0x51d2d3[_0xb82b('0x21')][_0xb82b('0x78')];var _0x2a2e5e=_[_0xb82b('0x67')](_0x591be2);var _0x5dbf71=_0x591be2==='chat'?_0xb82b('0x69'):_0xb82b('0x6a');return db['User']['findOne']({'raw':!![],'where':{'id':_0x51d2d3['params']['id'],'role':'agent'}})['then'](function(_0x318b0e){if(_[_0xb82b('0x12')](_0x318b0e)){throw new Error(_0xb82b('0x7a'));}_0xf13501=_0x318b0e;return db[_0x2a2e5e+_0xb82b('0x6d')]['findOne']({'where':{'id':_0x51d2d3[_0xb82b('0x21')][_0xb82b('0x6e')]},'include':[{'model':db[_0x2a2e5e+'Interaction'],'as':_0xb82b('0x71')},{'model':db[_0x2a2e5e+_0x5dbf71],'as':_0xb82b('0x6a')}]});})[_0xb82b('0xa')](function(_0x5a882a){if(_['isNil'](_0x5a882a)){throw new Error(_0x2a2e5e+_0xb82b('0x6f'));}_0xe0dd65=_0x5a882a;return _0x5a882a[_0xb82b('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb82b('0xa')](function(){var _0x33e904={'uniqueid':_0x591be2+'.'+_0xe0dd65['id']+'.'+_0xe0dd65[_0xb82b('0x71')]['id'],'FromUserId':_0x51d2d3[_0xb82b('0x2f')]['id'],'type':_0xb82b('0x3a'),'ToUserId':_0xf13501['id']};_0x33e904[_0x2a2e5e+_0xb82b('0x7b')]=_0xe0dd65['id'];_0x33e904[_0x2a2e5e+'InteractionId']=_0xe0dd65[_0xb82b('0x71')]['id'];_0x33e904['From'+_0x2a2e5e+_0x5dbf71+'Id']=_0xe0dd65[_0xb82b('0x6a')]['id'];return db[_0x2a2e5e+_0xb82b('0x73')][_0xb82b('0x74')](_0x33e904);})[_0xb82b('0xa')](function(){return respondWithRpcPromise(_0xb82b('0x75'),{'channel':_0x591be2,'interaction':_0xe0dd65[_0xb82b('0x71')],'message':_0xe0dd65,'account':_0xe0dd65[_0xb82b('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0xf13501[_0xb82b('0x10')]+','+(_0xe0dd65[_0xb82b('0x6a')][_0xb82b('0x7c')]||0x12c),'interval':_0xb82b('0x77')}]},routingClient);})[_0xb82b('0xa')](respondWithResult(_0x48ac80,null))['catch'](handleError(_0x48ac80,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index dac8a00..30f8b23 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 _0x8263=['../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id/run','run','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x820d7b,_0xa5564c){var _0x249af0=function(_0x5ce8fb){while(--_0x5ce8fb){_0x820d7b['push'](_0x820d7b['shift']());}};_0x249af0(++_0xa5564c);}(_0x8263,0x8c));var _0x3826=function(_0x495e14,_0x5086d6){_0x495e14=_0x495e14-0x0;var _0x5082f9=_0x8263[_0x495e14];return _0x5082f9;};'use strict';var multer=require(_0x3826('0x0'));var util=require(_0x3826('0x1'));var path=require('path');var timeout=require(_0x3826('0x2'));var express=require(_0x3826('0x3'));var router=express[_0x3826('0x4')]();var fs_extra=require(_0x3826('0x5'));var auth=require(_0x3826('0x6'));var interaction=require(_0x3826('0x7'));var config=require(_0x3826('0x8'));var controller=require(_0x3826('0x9'));router['get']('/',auth[_0x3826('0xa')](),controller[_0x3826('0xb')]);router[_0x3826('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x3826('0xd'),auth[_0x3826('0xa')](),controller[_0x3826('0xe')]);router['post']('/',auth[_0x3826('0xa')](),controller[_0x3826('0xf')]);router[_0x3826('0x10')](_0x3826('0x11'),auth[_0x3826('0xa')](),controller[_0x3826('0x12')]);router[_0x3826('0x13')](_0x3826('0x11'),auth[_0x3826('0xa')](),controller['destroy']);module[_0x3826('0x14')]=router; \ No newline at end of file +var _0x92bd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x384cf4,_0x36d5f4){var _0x2918c7=function(_0x1e0d35){while(--_0x1e0d35){_0x384cf4['push'](_0x384cf4['shift']());}};_0x2918c7(++_0x36d5f4);}(_0x92bd,0xec));var _0xd92b=function(_0x23ccea,_0x3fdcf0){_0x23ccea=_0x23ccea-0x0;var _0xc9cc1=_0x92bd[_0x23ccea];return _0xc9cc1;};'use strict';var multer=require(_0xd92b('0x0'));var util=require(_0xd92b('0x1'));var path=require(_0xd92b('0x2'));var timeout=require(_0xd92b('0x3'));var express=require('express');var router=express[_0xd92b('0x4')]();var fs_extra=require(_0xd92b('0x5'));var auth=require(_0xd92b('0x6'));var interaction=require(_0xd92b('0x7'));var config=require(_0xd92b('0x8'));var controller=require(_0xd92b('0x9'));router['get']('/',auth[_0xd92b('0xa')](),controller[_0xd92b('0xb')]);router[_0xd92b('0xc')](_0xd92b('0xd'),auth[_0xd92b('0xa')](),controller[_0xd92b('0xe')]);router[_0xd92b('0xc')]('/:id/run',auth[_0xd92b('0xa')](),controller['run']);router['post']('/',auth[_0xd92b('0xa')](),controller[_0xd92b('0xf')]);router[_0xd92b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd92b('0x11')]);router['delete'](_0xd92b('0xd'),auth[_0xd92b('0xa')](),controller[_0xd92b('0x12')]);module[_0xd92b('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ca67317..c178590 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 _0x2d6a=['sequelize','BOOLEAN','STRING','0\x200\x20*\x20*\x20*','DATE','years','quarters','months','weeks','minutes','days','ENUM','csv','pdf','default','custom','TEXT'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x2d6a,0x77));var _0xa2d6=function(_0x32b850,_0x4c6808){_0x32b850=_0x32b850-0x0;var _0x3ac269=_0x2d6a[_0x32b850];return _0x3ac269;};'use strict';var Sequelize=require(_0xa2d6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xa2d6('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa2d6('0x2')],'allowNull':![],'defaultValue':_0xa2d6('0x3')},'startAt':{'type':Sequelize[_0xa2d6('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xa2d6('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xa2d6('0x5'),_0xa2d6('0x6'),_0xa2d6('0x7'),_0xa2d6('0x8'),'days','hours',_0xa2d6('0x9')),'allowNull':![],'defaultValue':_0xa2d6('0xa')},'output':{'type':Sequelize[_0xa2d6('0xb')](_0xa2d6('0xc'),_0xa2d6('0xd'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xa2d6('0xb')]('custom',_0xa2d6('0xe')),'allowNull':![],'defaultValue':_0xa2d6('0xf')},'sendMail':{'type':Sequelize[_0xa2d6('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xa2d6('0x2')]},'cc':{'type':Sequelize[_0xa2d6('0x10')]},'bcc':{'type':Sequelize[_0xa2d6('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xd259=['days','hours','csv','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks'];(function(_0x3ddf4f,_0x48cdac){var _0x264048=function(_0x25f299){while(--_0x25f299){_0x3ddf4f['push'](_0x3ddf4f['shift']());}};_0x264048(++_0x48cdac);}(_0xd259,0x1ed));var _0x9d25=function(_0x5b9344,_0x205b26){_0x5b9344=_0x5b9344-0x0;var _0x37a8bd=_0xd259[_0x5b9344];return _0x37a8bd;};'use strict';var Sequelize=require(_0x9d25('0x0'));module[_0x9d25('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9d25('0x2')]},'active':{'type':Sequelize[_0x9d25('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9d25('0x2')],'allowNull':![],'defaultValue':_0x9d25('0x4')},'startAt':{'type':Sequelize[_0x9d25('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x9d25('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9d25('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9d25('0x7')]('years',_0x9d25('0x8'),_0x9d25('0x9'),_0x9d25('0xa'),_0x9d25('0xb'),_0x9d25('0xc'),'minutes'),'allowNull':![],'defaultValue':_0x9d25('0xb')},'output':{'type':Sequelize['ENUM'](_0x9d25('0xd'),'pdf',_0x9d25('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x9d25('0x7')](_0x9d25('0xf'),_0x9d25('0x10')),'allowNull':![],'defaultValue':_0x9d25('0xf')},'sendMail':{'type':Sequelize[_0x9d25('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x9d25('0x2')]},'cc':{'type':Sequelize[_0x9d25('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 6b22e43..4b7ea0d 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 _0x20e3=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','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','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','error','name','send','index','Schedule','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Scheduler','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x7d4dc8,_0x14d70e){var _0x20b216=function(_0x3575b0){while(--_0x3575b0){_0x7d4dc8['push'](_0x7d4dc8['shift']());}};_0x20b216(++_0x14d70e);}(_0x20e3,0x1a8));var _0x320e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x20e3[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x320e('0x0'));var rimraf=require(_0x320e('0x1'));var zipdir=require(_0x320e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x320e('0x3'));var moment=require(_0x320e('0x4'));var BPromise=require(_0x320e('0x5'));var Mustache=require(_0x320e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x320e('0x7'));var csv=require(_0x320e('0x8'));var ejs=require(_0x320e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x320e('0xa'));var squel=require(_0x320e('0xb'));var crypto=require(_0x320e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x320e('0xd'));var toCsv=require(_0x320e('0x8'));var querystring=require(_0x320e('0xe'));var Papa=require('papaparse');var Redis=require(_0x320e('0xf'));var authService=require(_0x320e('0x10'));var qs=require(_0x320e('0x11'));var as=require(_0x320e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x320e('0x13'))(_0x320e('0x14'));var utils=require(_0x320e('0x15'));var config=require(_0x320e('0x16'));var licenseUtil=require(_0x320e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37d12e,_0x4961ff){_0x4961ff=_0x4961ff||0xcc;return function(_0x3ec66f){if(_0x3ec66f){return _0x37d12e[_0x320e('0x18')](_0x4961ff);}return _0x37d12e[_0x320e('0x19')](_0x4961ff)[_0x320e('0x1a')]();};}function respondWithResult(_0x452bcd,_0xc55ebe){_0xc55ebe=_0xc55ebe||0xc8;return function(_0x4fe898){if(_0x4fe898){return _0x452bcd[_0x320e('0x19')](_0xc55ebe)[_0x320e('0x1b')](_0x4fe898);}};}function respondWithFilteredResult(_0x2a66a6,_0x197930){return function(_0x18ac9e){if(_0x18ac9e){var _0x11ae28=typeof _0x197930['offset']==='undefined'&&typeof _0x197930['limit']===_0x320e('0x1c');var _0xc08081=_0x18ac9e[_0x320e('0x1d')];var _0x27220b=_0x11ae28?0x0:_0x197930['offset'];var _0x222e82=_0x11ae28?_0x18ac9e[_0x320e('0x1d')]:_0x197930[_0x320e('0x1e')]+_0x197930[_0x320e('0x1f')];var _0x21ea9c;if(_0x222e82>=_0xc08081){_0x222e82=_0xc08081;_0x21ea9c=0xc8;}else{_0x21ea9c=0xce;}_0x2a66a6['status'](_0x21ea9c);return _0x2a66a6[_0x320e('0x20')](_0x320e('0x21'),_0x27220b+'-'+_0x222e82+'/'+_0xc08081)[_0x320e('0x1b')](_0x18ac9e);}return null;};}function patchUpdates(_0x1e36d5){return function(_0x5c7331){try{jsonpatch[_0x320e('0x22')](_0x5c7331,_0x1e36d5,!![]);}catch(_0x43bf9b){return BPromise[_0x320e('0x23')](_0x43bf9b);}return _0x5c7331['save']();};}function saveUpdates(_0x1bfa9a,_0x3f721b){return function(_0x455f12){if(_0x455f12){return _0x455f12['update'](_0x1bfa9a)[_0x320e('0x24')](function(_0x2e5cd1){return _0x2e5cd1;});}return null;};}function removeEntity(_0x81fc20,_0x30ef70){return function(_0x245e76){if(_0x245e76){return _0x245e76[_0x320e('0x25')]()[_0x320e('0x24')](function(){var _0x2f7459=_0x245e76[_0x320e('0x26')]({'plain':!![]});var _0x49d8f6='Scheduler';return db['UserProfileResource']['destroy']({'where':{'type':_0x49d8f6,'resourceId':_0x2f7459['id']}})[_0x320e('0x24')](function(){return _0x245e76;});})[_0x320e('0x24')](function(){_0x81fc20[_0x320e('0x19')](0xcc)[_0x320e('0x1a')]();});}};}function handleEntityNotFound(_0x9fff70,_0x2a3c12){return function(_0x18ecaf){if(!_0x18ecaf){_0x9fff70[_0x320e('0x18')](0x194);}return _0x18ecaf;};}function handleError(_0x5808c1,_0x53bdd4){_0x53bdd4=_0x53bdd4||0x1f4;return function(_0x590430){logger[_0x320e('0x27')](_0x590430['stack']);if(_0x590430[_0x320e('0x28')]){delete _0x590430[_0x320e('0x28')];}_0x5808c1[_0x320e('0x19')](_0x53bdd4)[_0x320e('0x29')](_0x590430);};}exports[_0x320e('0x2a')]=function(_0x52e01d,_0x26d3cf){var _0x17ced3={},_0x5df01e={},_0xca6f0b={'count':0x0,'rows':[]};var _0x114f17=_['map'](db[_0x320e('0x2b')]['rawAttributes'],function(_0x3e37ab){return{'name':_0x3e37ab[_0x320e('0x2c')],'type':_0x3e37ab['type'][_0x320e('0x2d')]};});_0x5df01e[_0x320e('0x2e')]=_[_0x320e('0x2f')](_0x114f17,_0x320e('0x28'));_0x5df01e[_0x320e('0x30')]=_[_0x320e('0x31')](_0x52e01d['query']);_0x5df01e[_0x320e('0x32')]=_[_0x320e('0x33')](_0x5df01e[_0x320e('0x2e')],_0x5df01e[_0x320e('0x30')]);_0x17ced3[_0x320e('0x34')]=_[_0x320e('0x33')](_0x5df01e[_0x320e('0x2e')],qs['fields'](_0x52e01d['query'][_0x320e('0x35')]));_0x17ced3[_0x320e('0x34')]=_0x17ced3[_0x320e('0x34')][_0x320e('0x36')]?_0x17ced3[_0x320e('0x34')]:_0x5df01e['model'];if(!_0x52e01d[_0x320e('0x30')]['hasOwnProperty'](_0x320e('0x37'))){_0x17ced3[_0x320e('0x1f')]=qs[_0x320e('0x1f')](_0x52e01d[_0x320e('0x30')][_0x320e('0x1f')]);_0x17ced3[_0x320e('0x1e')]=qs['offset'](_0x52e01d[_0x320e('0x30')]['offset']);}_0x17ced3[_0x320e('0x38')]=qs[_0x320e('0x39')](_0x52e01d[_0x320e('0x30')][_0x320e('0x39')]);_0x17ced3[_0x320e('0x3a')]=qs[_0x320e('0x32')](_[_0x320e('0x3b')](_0x52e01d['query'],_0x5df01e['filters']),_0x114f17);if(_0x52e01d[_0x320e('0x30')][_0x320e('0x3c')]){_0x17ced3[_0x320e('0x3a')]=_[_0x320e('0x3d')](_0x17ced3[_0x320e('0x3a')],{'$or':_[_0x320e('0x2f')](_0x114f17,function(_0x5188a7){if(_0x5188a7[_0x320e('0x3e')]!==_0x320e('0x3f')){var _0x2521e3={};_0x2521e3[_0x5188a7[_0x320e('0x28')]]={'$like':'%'+_0x52e01d[_0x320e('0x30')][_0x320e('0x3c')]+'%'};return _0x2521e3;}})});}_0x17ced3=_[_0x320e('0x3d')]({},_0x17ced3,_0x52e01d[_0x320e('0x40')]);var _0x44d616={'where':_0x17ced3[_0x320e('0x3a')]};return db[_0x320e('0x2b')][_0x320e('0x1d')](_0x44d616)[_0x320e('0x24')](function(_0x5f09f5){_0xca6f0b[_0x320e('0x1d')]=_0x5f09f5;if(_0x52e01d[_0x320e('0x30')]['includeAll']){_0x17ced3['include']=[{'all':!![]}];}return db['Schedule'][_0x320e('0x41')](_0x17ced3);})[_0x320e('0x24')](function(_0x3dee38){_0xca6f0b[_0x320e('0x42')]=_0x3dee38;return _0xca6f0b;})['then'](respondWithFilteredResult(_0x26d3cf,_0x17ced3))[_0x320e('0x43')](handleError(_0x26d3cf,null));};exports[_0x320e('0x44')]=function(_0x3b9df8,_0x56e007){var _0x52c4b8={'raw':![],'where':{'id':_0x3b9df8['params']['id']}},_0x245f94={};_0x245f94['model']=_[_0x320e('0x31')](db[_0x320e('0x2b')][_0x320e('0x45')]);_0x245f94[_0x320e('0x30')]=_[_0x320e('0x31')](_0x3b9df8['query']);_0x245f94[_0x320e('0x32')]=_[_0x320e('0x33')](_0x245f94[_0x320e('0x2e')],_0x245f94[_0x320e('0x30')]);_0x52c4b8[_0x320e('0x34')]=_['intersection'](_0x245f94[_0x320e('0x2e')],qs[_0x320e('0x35')](_0x3b9df8[_0x320e('0x30')][_0x320e('0x35')]));_0x52c4b8[_0x320e('0x34')]=_0x52c4b8[_0x320e('0x34')]['length']?_0x52c4b8[_0x320e('0x34')]:_0x245f94[_0x320e('0x2e')];if(_0x3b9df8['query']['includeAll']){_0x52c4b8[_0x320e('0x46')]=[{'all':!![]}];}_0x52c4b8=_[_0x320e('0x3d')]({},_0x52c4b8,_0x3b9df8[_0x320e('0x40')]);return db['Schedule'][_0x320e('0x47')](_0x52c4b8)[_0x320e('0x24')](handleEntityNotFound(_0x56e007,null))[_0x320e('0x24')](respondWithResult(_0x56e007,null))[_0x320e('0x43')](handleError(_0x56e007,null));};exports[_0x320e('0x48')]=function(_0x28c4fb,_0x458fe6){return db[_0x320e('0x2b')][_0x320e('0x48')](_0x28c4fb['body'],{})[_0x320e('0x24')](function(_0x5b93a4){var _0x238fed=_0x28c4fb[_0x320e('0x49')][_0x320e('0x26')]({'plain':!![]});if(!_0x238fed)throw new Error(_0x320e('0x4a'));if(_0x238fed['role']===_0x320e('0x49')){var _0x3dcc16=_0x5b93a4[_0x320e('0x26')]({'plain':!![]});var _0x33d26a=_0x320e('0x4b');return db[_0x320e('0x4c')]['find']({'where':{'name':_0x33d26a,'userProfileId':_0x238fed[_0x320e('0x4d')]},'raw':!![]})[_0x320e('0x24')](function(_0x102947){if(_0x102947&&_0x102947[_0x320e('0x4e')]===0x0){return db[_0x320e('0x4f')][_0x320e('0x48')]({'name':_0x3dcc16[_0x320e('0x28')],'resourceId':_0x3dcc16['id'],'type':_0x102947[_0x320e('0x28')],'sectionId':_0x102947['id']},{})[_0x320e('0x24')](function(){return _0x5b93a4;});}else{return _0x5b93a4;}})[_0x320e('0x43')](function(_0x220016){logger['error'](_0x320e('0x50'),_0x220016);throw _0x220016;});}return _0x5b93a4;})[_0x320e('0x24')](respondWithResult(_0x458fe6,0xc9))[_0x320e('0x43')](handleError(_0x458fe6,null));};exports['update']=function(_0x3bcecd,_0x1950ff){if(_0x3bcecd[_0x320e('0x51')]['id']){delete _0x3bcecd[_0x320e('0x51')]['id'];}return db['Schedule']['find']({'where':{'id':_0x3bcecd[_0x320e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1950ff,null))[_0x320e('0x24')](saveUpdates(_0x3bcecd[_0x320e('0x51')],null))[_0x320e('0x24')](respondWithResult(_0x1950ff,null))[_0x320e('0x43')](handleError(_0x1950ff,null));};exports[_0x320e('0x25')]=function(_0x34a25f,_0x39f547){return db[_0x320e('0x2b')][_0x320e('0x47')]({'where':{'id':_0x34a25f[_0x320e('0x52')]['id']}})[_0x320e('0x24')](handleEntityNotFound(_0x39f547,null))[_0x320e('0x24')](removeEntity(_0x39f547,null))[_0x320e('0x43')](handleError(_0x39f547,null));};exports[_0x320e('0x53')]=function(_0x42d4b5,_0x31ce99,_0x11d3e3){var _0x279db2=require('../../config/schedule');return db[_0x320e('0x2b')]['find']({'where':{'id':_0x42d4b5[_0x320e('0x52')]['id']},'raw':!![]})[_0x320e('0x24')](handleEntityNotFound(_0x31ce99,null))['then'](function(){_0x279db2[_0x320e('0x53')](_0x42d4b5['params']['id']);})[_0x320e('0x24')](respondWithStatusCode(_0x31ce99,null))[_0x320e('0x43')](handleError(_0x31ce99,null));}; \ No newline at end of file +var _0x664f=['Scheduler','error','name','send','map','Schedule','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','offset','sort','filter','merge','where','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','params','run','../../config/schedule','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','set','apply','reject','update','then','destroy','get'];(function(_0x35bfe5,_0x21005a){var _0x283cce=function(_0x1d99a5){while(--_0x1d99a5){_0x35bfe5['push'](_0x35bfe5['shift']());}};_0x283cce(++_0x21005a);}(_0x664f,0x1ce));var _0xf664=function(_0x3e3f94,_0x27528b){_0x3e3f94=_0x3e3f94-0x0;var _0x5548bb=_0x664f[_0x3e3f94];return _0x5548bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf664('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf664('0x1'));var rp=require(_0xf664('0x2'));var moment=require('moment');var BPromise=require(_0xf664('0x3'));var Mustache=require(_0xf664('0x4'));var util=require(_0xf664('0x5'));var path=require(_0xf664('0x6'));var sox=require(_0xf664('0x7'));var csv=require('to-csv');var ejs=require(_0xf664('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf664('0x9'));var squel=require('squel');var crypto=require(_0xf664('0xa'));var jsforce=require(_0xf664('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf664('0xc'));var querystring=require(_0xf664('0xd'));var Papa=require(_0xf664('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf664('0xf'));var as=require(_0xf664('0x10'));var hardwareService=require(_0xf664('0x11'));var logger=require(_0xf664('0x12'))(_0xf664('0x13'));var utils=require(_0xf664('0x14'));var config=require(_0xf664('0x15'));var licenseUtil=require(_0xf664('0x16'));var db=require(_0xf664('0x17'))['db'];function respondWithStatusCode(_0x2dc264,_0xec11e5){_0xec11e5=_0xec11e5||0xcc;return function(_0x3282d2){if(_0x3282d2){return _0x2dc264[_0xf664('0x18')](_0xec11e5);}return _0x2dc264[_0xf664('0x19')](_0xec11e5)[_0xf664('0x1a')]();};}function respondWithResult(_0x192830,_0x155508){_0x155508=_0x155508||0xc8;return function(_0x719558){if(_0x719558){return _0x192830[_0xf664('0x19')](_0x155508)[_0xf664('0x1b')](_0x719558);}};}function respondWithFilteredResult(_0x194718,_0x59c6c8){return function(_0xb1f843){if(_0xb1f843){var _0x2b75d9=typeof _0x59c6c8['offset']===_0xf664('0x1c')&&typeof _0x59c6c8['limit']===_0xf664('0x1c');var _0x1d27ce=_0xb1f843['count'];var _0x4bf8cd=_0x2b75d9?0x0:_0x59c6c8['offset'];var _0x5ae0d1=_0x2b75d9?_0xb1f843['count']:_0x59c6c8['offset']+_0x59c6c8['limit'];var _0x4b0aa4;if(_0x5ae0d1>=_0x1d27ce){_0x5ae0d1=_0x1d27ce;_0x4b0aa4=0xc8;}else{_0x4b0aa4=0xce;}_0x194718[_0xf664('0x19')](_0x4b0aa4);return _0x194718[_0xf664('0x1d')]('Content-Range',_0x4bf8cd+'-'+_0x5ae0d1+'/'+_0x1d27ce)[_0xf664('0x1b')](_0xb1f843);}return null;};}function patchUpdates(_0x23042c){return function(_0x12d078){try{jsonpatch[_0xf664('0x1e')](_0x12d078,_0x23042c,!![]);}catch(_0x58e16e){return BPromise[_0xf664('0x1f')](_0x58e16e);}return _0x12d078['save']();};}function saveUpdates(_0x47d4e0,_0x2bd032){return function(_0x691788){if(_0x691788){return _0x691788[_0xf664('0x20')](_0x47d4e0)[_0xf664('0x21')](function(_0x3d30fa){return _0x3d30fa;});}return null;};}function removeEntity(_0x4ffe57,_0x6b2a1a){return function(_0x1324d1){if(_0x1324d1){return _0x1324d1[_0xf664('0x22')]()[_0xf664('0x21')](function(){var _0x9d5ac6=_0x1324d1[_0xf664('0x23')]({'plain':!![]});var _0x50edcc=_0xf664('0x24');return db['UserProfileResource'][_0xf664('0x22')]({'where':{'type':_0x50edcc,'resourceId':_0x9d5ac6['id']}})[_0xf664('0x21')](function(){return _0x1324d1;});})[_0xf664('0x21')](function(){_0x4ffe57[_0xf664('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb453c0,_0x5c9332){return function(_0x5a9c8d){if(!_0x5a9c8d){_0xb453c0[_0xf664('0x18')](0x194);}return _0x5a9c8d;};}function handleError(_0x32c7b6,_0x41acad){_0x41acad=_0x41acad||0x1f4;return function(_0x2939c5){logger[_0xf664('0x25')](_0x2939c5['stack']);if(_0x2939c5[_0xf664('0x26')]){delete _0x2939c5[_0xf664('0x26')];}_0x32c7b6[_0xf664('0x19')](_0x41acad)[_0xf664('0x27')](_0x2939c5);};}exports['index']=function(_0x4a8070,_0x134ef1){var _0x6dc047={},_0xd2ce92={},_0xa1da4f={'count':0x0,'rows':[]};var _0x55e9b4=_[_0xf664('0x28')](db[_0xf664('0x29')][_0xf664('0x2a')],function(_0x343aa2){return{'name':_0x343aa2[_0xf664('0x2b')],'type':_0x343aa2['type'][_0xf664('0x2c')]};});_0xd2ce92[_0xf664('0x2d')]=_[_0xf664('0x28')](_0x55e9b4,_0xf664('0x26'));_0xd2ce92['query']=_[_0xf664('0x2e')](_0x4a8070['query']);_0xd2ce92[_0xf664('0x2f')]=_[_0xf664('0x30')](_0xd2ce92[_0xf664('0x2d')],_0xd2ce92[_0xf664('0x31')]);_0x6dc047[_0xf664('0x32')]=_[_0xf664('0x30')](_0xd2ce92['model'],qs[_0xf664('0x33')](_0x4a8070[_0xf664('0x31')][_0xf664('0x33')]));_0x6dc047[_0xf664('0x32')]=_0x6dc047[_0xf664('0x32')][_0xf664('0x34')]?_0x6dc047[_0xf664('0x32')]:_0xd2ce92[_0xf664('0x2d')];if(!_0x4a8070[_0xf664('0x31')][_0xf664('0x35')]('nolimit')){_0x6dc047[_0xf664('0x36')]=qs['limit'](_0x4a8070['query'][_0xf664('0x36')]);_0x6dc047[_0xf664('0x37')]=qs['offset'](_0x4a8070[_0xf664('0x31')][_0xf664('0x37')]);}_0x6dc047['order']=qs[_0xf664('0x38')](_0x4a8070[_0xf664('0x31')][_0xf664('0x38')]);_0x6dc047['where']=qs['filters'](_['pick'](_0x4a8070['query'],_0xd2ce92[_0xf664('0x2f')]),_0x55e9b4);if(_0x4a8070[_0xf664('0x31')][_0xf664('0x39')]){_0x6dc047['where']=_[_0xf664('0x3a')](_0x6dc047[_0xf664('0x3b')],{'$or':_[_0xf664('0x28')](_0x55e9b4,function(_0x710043){if(_0x710043[_0xf664('0x3c')]!==_0xf664('0x3d')){var _0xb47ee7={};_0xb47ee7[_0x710043[_0xf664('0x26')]]={'$like':'%'+_0x4a8070[_0xf664('0x31')][_0xf664('0x39')]+'%'};return _0xb47ee7;}})});}_0x6dc047=_[_0xf664('0x3a')]({},_0x6dc047,_0x4a8070[_0xf664('0x3e')]);var _0x40bc78={'where':_0x6dc047[_0xf664('0x3b')]};return db[_0xf664('0x29')][_0xf664('0x3f')](_0x40bc78)[_0xf664('0x21')](function(_0x3a59ac){_0xa1da4f[_0xf664('0x3f')]=_0x3a59ac;if(_0x4a8070[_0xf664('0x31')][_0xf664('0x40')]){_0x6dc047[_0xf664('0x41')]=[{'all':!![]}];}return db[_0xf664('0x29')][_0xf664('0x42')](_0x6dc047);})[_0xf664('0x21')](function(_0x595033){_0xa1da4f[_0xf664('0x43')]=_0x595033;return _0xa1da4f;})['then'](respondWithFilteredResult(_0x134ef1,_0x6dc047))[_0xf664('0x44')](handleError(_0x134ef1,null));};exports[_0xf664('0x45')]=function(_0x12bfe6,_0x5c943d){var _0x1baed8={'raw':![],'where':{'id':_0x12bfe6['params']['id']}},_0xb44c9c={};_0xb44c9c['model']=_[_0xf664('0x2e')](db[_0xf664('0x29')][_0xf664('0x2a')]);_0xb44c9c['query']=_['keys'](_0x12bfe6[_0xf664('0x31')]);_0xb44c9c[_0xf664('0x2f')]=_[_0xf664('0x30')](_0xb44c9c[_0xf664('0x2d')],_0xb44c9c['query']);_0x1baed8['attributes']=_[_0xf664('0x30')](_0xb44c9c[_0xf664('0x2d')],qs[_0xf664('0x33')](_0x12bfe6[_0xf664('0x31')][_0xf664('0x33')]));_0x1baed8[_0xf664('0x32')]=_0x1baed8[_0xf664('0x32')][_0xf664('0x34')]?_0x1baed8[_0xf664('0x32')]:_0xb44c9c[_0xf664('0x2d')];if(_0x12bfe6[_0xf664('0x31')][_0xf664('0x40')]){_0x1baed8[_0xf664('0x41')]=[{'all':!![]}];}_0x1baed8=_['merge']({},_0x1baed8,_0x12bfe6['options']);return db[_0xf664('0x29')]['find'](_0x1baed8)[_0xf664('0x21')](handleEntityNotFound(_0x5c943d,null))['then'](respondWithResult(_0x5c943d,null))['catch'](handleError(_0x5c943d,null));};exports[_0xf664('0x46')]=function(_0x146901,_0x569857){return db[_0xf664('0x29')][_0xf664('0x46')](_0x146901[_0xf664('0x47')],{})[_0xf664('0x21')](function(_0x468d42){var _0x5e1207=_0x146901[_0xf664('0x48')][_0xf664('0x23')]({'plain':!![]});if(!_0x5e1207)throw new Error(_0xf664('0x49'));if(_0x5e1207[_0xf664('0x4a')]===_0xf664('0x48')){var _0x38e0ce=_0x468d42[_0xf664('0x23')]({'plain':!![]});var _0x4bc905=_0xf664('0x24');return db[_0xf664('0x4b')][_0xf664('0x4c')]({'where':{'name':_0x4bc905,'userProfileId':_0x5e1207[_0xf664('0x4d')]},'raw':!![]})[_0xf664('0x21')](function(_0xebb13){if(_0xebb13&&_0xebb13[_0xf664('0x4e')]===0x0){return db[_0xf664('0x4f')][_0xf664('0x46')]({'name':_0x38e0ce[_0xf664('0x26')],'resourceId':_0x38e0ce['id'],'type':_0xebb13[_0xf664('0x26')],'sectionId':_0xebb13['id']},{})[_0xf664('0x21')](function(){return _0x468d42;});}else{return _0x468d42;}})['catch'](function(_0xa9ef81){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa9ef81);throw _0xa9ef81;});}return _0x468d42;})[_0xf664('0x21')](respondWithResult(_0x569857,0xc9))['catch'](handleError(_0x569857,null));};exports['update']=function(_0x652fd7,_0x33f021){if(_0x652fd7[_0xf664('0x47')]['id']){delete _0x652fd7[_0xf664('0x47')]['id'];}return db[_0xf664('0x29')][_0xf664('0x4c')]({'where':{'id':_0x652fd7[_0xf664('0x50')]['id']}})[_0xf664('0x21')](handleEntityNotFound(_0x33f021,null))[_0xf664('0x21')](saveUpdates(_0x652fd7[_0xf664('0x47')],null))[_0xf664('0x21')](respondWithResult(_0x33f021,null))[_0xf664('0x44')](handleError(_0x33f021,null));};exports[_0xf664('0x22')]=function(_0x1efc1d,_0x2a08e5){return db[_0xf664('0x29')]['find']({'where':{'id':_0x1efc1d[_0xf664('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a08e5,null))['then'](removeEntity(_0x2a08e5,null))[_0xf664('0x44')](handleError(_0x2a08e5,null));};exports[_0xf664('0x51')]=function(_0x18e874,_0x1ca5b5,_0x4fa33b){var _0xc4bd3c=require(_0xf664('0x52'));return db[_0xf664('0x29')][_0xf664('0x4c')]({'where':{'id':_0x18e874[_0xf664('0x50')]['id']},'raw':!![]})[_0xf664('0x21')](handleEntityNotFound(_0x1ca5b5,null))[_0xf664('0x21')](function(){_0xc4bd3c[_0xf664('0x51')](_0x18e874[_0xf664('0x50')]['id']);})[_0xf664('0x21')](respondWithStatusCode(_0x1ca5b5,null))[_0xf664('0x44')](handleError(_0x1ca5b5,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 9adb8d1..9ae1a35 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 _0xbacd=['exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x2324a6,_0x48a9ac){var _0x4d9915=function(_0x2ae1f4){while(--_0x2ae1f4){_0x2324a6['push'](_0x2324a6['shift']());}};_0x4d9915(++_0x48a9ac);}(_0xbacd,0x72));var _0xdbac=function(_0x530371,_0x29592b){_0x530371=_0x530371-0x0;var _0x53d0ff=_0xbacd[_0x530371];return _0x53d0ff;};'use strict';var _=require(_0xdbac('0x0'));var util=require(_0xdbac('0x1'));var logger=require(_0xdbac('0x2'))('api');var moment=require(_0xdbac('0x3'));var BPromise=require('bluebird');var rp=require(_0xdbac('0x4'));var fs=require('fs');var path=require(_0xdbac('0x5'));var rimraf=require(_0xdbac('0x6'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xdbac('0x7')]=function(_0x29b532,_0x460ef9){return _0x29b532[_0xdbac('0x8')](_0xdbac('0x9'),attributes,{'tableName':_0xdbac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ed1=['tools_schedules','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Schedule'];(function(_0x1adffc,_0x2d30cf){var _0x16f2cc=function(_0x219c3b){while(--_0x219c3b){_0x1adffc['push'](_0x1adffc['shift']());}};_0x16f2cc(++_0x2d30cf);}(_0x4ed1,0x1d5));var _0x14ed=function(_0x58c212,_0x53ab61){_0x58c212=_0x58c212-0x0;var _0x3600dd=_0x4ed1[_0x58c212];return _0x3600dd;};'use strict';var _=require(_0x14ed('0x0'));var util=require(_0x14ed('0x1'));var logger=require(_0x14ed('0x2'))(_0x14ed('0x3'));var moment=require(_0x14ed('0x4'));var BPromise=require('bluebird');var rp=require(_0x14ed('0x5'));var fs=require('fs');var path=require(_0x14ed('0x6'));var rimraf=require(_0x14ed('0x7'));var config=require(_0x14ed('0x8'));var attributes=require('./schedule.attributes');module[_0x14ed('0x9')]=function(_0x3c37c1,_0x427314){return _0x3c37c1[_0x14ed('0xa')](_0x14ed('0xb'),attributes,{'tableName':_0x14ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index ba7229a..284d7ab 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 _0xe851=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x306877,_0x52bebc){var _0x3df112=function(_0x274d4c){while(--_0x274d4c){_0x306877['push'](_0x306877['shift']());}};_0x3df112(++_0x52bebc);}(_0xe851,0xea));var _0x1e85=function(_0x5ab84d,_0x37334a){_0x5ab84d=_0x5ab84d-0x0;var _0x179bb8=_0xe851[_0x5ab84d];return _0x179bb8;};'use strict';var _=require(_0x1e85('0x0'));var util=require(_0x1e85('0x1'));var moment=require(_0x1e85('0x2'));var BPromise=require(_0x1e85('0x3'));var rs=require(_0x1e85('0x4'));var fs=require('fs');var Redis=require(_0x1e85('0x5'));var db=require(_0x1e85('0x6'))['db'];var utils=require(_0x1e85('0x7'));var logger=require(_0x1e85('0x8'))('rpc');var config=require(_0x1e85('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1e85('0xa')][_0x1e85('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e8f07,_0x38a709,_0xbb9bae){return new BPromise(function(_0x2649be,_0x59aa87){return client[_0x1e85('0xc')](_0x3e8f07,_0xbb9bae)[_0x1e85('0xd')](function(_0x441849){logger[_0x1e85('0xe')](_0x1e85('0xf'),_0x38a709,'request\x20sent');logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x38a709,_0x1e85('0x10'),JSON[_0x1e85('0x11')](_0x441849));if(_0x441849[_0x1e85('0x12')]){if(_0x441849[_0x1e85('0x12')]['code']===0x1f4){logger[_0x1e85('0x12')](_0x1e85('0xf'),_0x38a709,_0x441849[_0x1e85('0x12')][_0x1e85('0x13')]);return _0x59aa87(_0x441849['error'][_0x1e85('0x13')]);}logger[_0x1e85('0x12')](_0x1e85('0xf'),_0x38a709,_0x441849[_0x1e85('0x12')][_0x1e85('0x13')]);return _0x2649be(_0x441849[_0x1e85('0x12')]['message']);}else{logger[_0x1e85('0xe')](_0x1e85('0xf'),_0x38a709,_0x1e85('0x10'));_0x2649be(_0x441849['result']['message']);}})[_0x1e85('0x14')](function(_0x570bd7){logger['error'](_0x1e85('0xf'),_0x38a709,_0x570bd7);_0x59aa87(_0x570bd7);});});} \ No newline at end of file +var _0xedd8=['../../config/environment','client','request','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0xedd8,0x1e7));var _0x8edd=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0xedd8[_0x388b47];return _0x4859df;};'use strict';var _=require('lodash');var util=require(_0x8edd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8edd('0x1'));var fs=require('fs');var Redis=require(_0x8edd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8edd('0x3'));var logger=require(_0x8edd('0x4'))(_0x8edd('0x5'));var config=require(_0x8edd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8edd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2de079,_0x36b603,_0x30116f){return new BPromise(function(_0x13f9c9,_0x4137ec){return client[_0x8edd('0x8')](_0x2de079,_0x30116f)['then'](function(_0x332022){logger[_0x8edd('0x9')](_0x8edd('0xa'),_0x36b603,_0x8edd('0xb'));logger['debug'](_0x8edd('0xc'),_0x36b603,_0x8edd('0xb'),JSON[_0x8edd('0xd')](_0x332022));if(_0x332022[_0x8edd('0xe')]){if(_0x332022['error']['code']===0x1f4){logger[_0x8edd('0xe')](_0x8edd('0xa'),_0x36b603,_0x332022[_0x8edd('0xe')]['message']);return _0x4137ec(_0x332022[_0x8edd('0xe')][_0x8edd('0xf')]);}logger['error'](_0x8edd('0xa'),_0x36b603,_0x332022[_0x8edd('0xe')][_0x8edd('0xf')]);return _0x13f9c9(_0x332022[_0x8edd('0xe')]['message']);}else{logger[_0x8edd('0x9')](_0x8edd('0xa'),_0x36b603,_0x8edd('0xb'));_0x13f9c9(_0x332022[_0x8edd('0x10')][_0x8edd('0xf')]);}})['catch'](function(_0x41c9a0){logger[_0x8edd('0xe')]('Schedule,\x20%s,\x20%s',_0x36b603,_0x41c9a0);_0x4137ec(_0x41c9a0);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index cf33690..5d3c762 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 _0x2cd8=['show','/:id/download','download','post','put','update','delete','destroy','exports','multer','path','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x2c12d9,_0x3d8e88){var _0x1135ab=function(_0x4779eb){while(--_0x4779eb){_0x2c12d9['push'](_0x2c12d9['shift']());}};_0x1135ab(++_0x3d8e88);}(_0x2cd8,0x198));var _0x82cd=function(_0x1ac1b1,_0x366717){_0x1ac1b1=_0x1ac1b1-0x0;var _0x14aa10=_0x2cd8[_0x1ac1b1];return _0x14aa10;};'use strict';var multer=require(_0x82cd('0x0'));var util=require('util');var path=require(_0x82cd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x82cd('0x2'));var interaction=require(_0x82cd('0x3'));var config=require('../../config/environment');var controller=require(_0x82cd('0x4'));router[_0x82cd('0x5')]('/',auth[_0x82cd('0x6')](),controller[_0x82cd('0x7')]);router[_0x82cd('0x5')](_0x82cd('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x82cd('0x9'),auth['isAuthenticated'](),controller[_0x82cd('0xa')]);router[_0x82cd('0x5')](_0x82cd('0xb'),auth[_0x82cd('0x6')](),controller[_0x82cd('0xc')]);router[_0x82cd('0xd')]('/',auth[_0x82cd('0x6')](),controller['create']);router[_0x82cd('0xe')](_0x82cd('0x9'),auth[_0x82cd('0x6')](),controller[_0x82cd('0xf')]);router[_0x82cd('0x10')](_0x82cd('0x9'),auth[_0x82cd('0x6')](),controller[_0x82cd('0x11')]);module[_0x82cd('0x12')]=router; \ No newline at end of file +var _0x6a2f=['update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','show','download','put'];(function(_0x18f778,_0x346822){var _0x489d94=function(_0x3a0c12){while(--_0x3a0c12){_0x18f778['push'](_0x18f778['shift']());}};_0x489d94(++_0x346822);}(_0x6a2f,0x17e));var _0xf6a2=function(_0x4aa662,_0x1cc90c){_0x4aa662=_0x4aa662-0x0;var _0x336478=_0x6a2f[_0x4aa662];return _0x336478;};'use strict';var multer=require(_0xf6a2('0x0'));var util=require(_0xf6a2('0x1'));var path=require('path');var timeout=require(_0xf6a2('0x2'));var express=require(_0xf6a2('0x3'));var router=express[_0xf6a2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf6a2('0x5'));var interaction=require(_0xf6a2('0x6'));var config=require(_0xf6a2('0x7'));var controller=require(_0xf6a2('0x8'));router[_0xf6a2('0x9')]('/',auth[_0xf6a2('0xa')](),controller[_0xf6a2('0xb')]);router[_0xf6a2('0x9')](_0xf6a2('0xc'),auth[_0xf6a2('0xa')](),controller['describe']);router[_0xf6a2('0x9')](_0xf6a2('0xd'),auth[_0xf6a2('0xa')](),controller[_0xf6a2('0xe')]);router['get']('/:id/download',auth[_0xf6a2('0xa')](),controller[_0xf6a2('0xf')]);router['post']('/',auth[_0xf6a2('0xa')](),controller['create']);router[_0xf6a2('0x10')](_0xf6a2('0xd'),auth[_0xf6a2('0xa')](),controller[_0xf6a2('0x11')]);router[_0xf6a2('0x12')](_0xf6a2('0xd'),auth[_0xf6a2('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index cfa9838..12e9b11 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 _0x78f4=['duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','../../config/environment','exports','getDataValue','extname','value','STRING','INTEGER','setDataValue','startedAt','closedAt'];(function(_0x220333,_0x1a53cc){var _0x28bf16=function(_0x5468bb){while(--_0x5468bb){_0x220333['push'](_0x220333['shift']());}};_0x28bf16(++_0x1a53cc);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x478f('0x0'));var path=require(_0x478f('0x1'));var config=require(_0x478f('0x2'));module[_0x478f('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x478f('0x4')]('value')?path[_0x478f('0x5')](this[_0x478f('0x4')](_0x478f('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x478f('0x7')]},'value':{'type':Sequelize[_0x478f('0x7')],'set':function(_0x5c47cf){var _0x2483fc=_0x5c47cf['replace'](/\\/g,'/');this['setDataValue'](_0x478f('0x6'),_0x2483fc);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x478f('0x8')],'set':function(_0x2f345d){this[_0x478f('0x9')](_0x478f('0xa'),moment()['subtract'](_0x2f345d,'ms'));this['setDataValue'](_0x478f('0xb'),moment());this[_0x478f('0x9')](_0x478f('0xc'),_0x2f345d);}},'startedAt':{'type':Sequelize[_0x478f('0xd')],'get':function(){return moment(this[_0x478f('0x4')](_0x478f('0xa')))[_0x478f('0xe')](_0x478f('0xf'))['toString']();}},'closedAt':{'type':Sequelize[_0x478f('0xd')],'get':function(){return moment(this[_0x478f('0x4')](_0x478f('0xb')))[_0x478f('0xe')](_0x478f('0xf'))[_0x478f('0x10')]();}},'createdAt':{'type':Sequelize[_0x478f('0xd')],'get':function(){return moment(this[_0x478f('0x4')]('createdAt'))[_0x478f('0xe')](_0x478f('0xf'))[_0x478f('0x10')]();}},'updatedAt':{'type':Sequelize[_0x478f('0xd')],'get':function(){return moment(this['getDataValue'](_0x478f('0x11')))['format'](_0x478f('0xf'))[_0x478f('0x10')]();}}}; \ No newline at end of file +var _0x964b=['updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','extname','value','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','getDataValue','format','toString','MM-DD-YYYY\x20HH:mm','createdAt'];(function(_0x56f3cb,_0x39b0e3){var _0x1136a1=function(_0x578916){while(--_0x578916){_0x56f3cb['push'](_0x56f3cb['shift']());}};_0x1136a1(++_0x39b0e3);}(_0x964b,0x112));var _0xb964=function(_0x4f0863,_0x37d8b7){_0x4f0863=_0x4f0863-0x0;var _0x357a86=_0x964b[_0x4f0863];return _0x357a86;};'use strict';var Sequelize=require(_0xb964('0x0'));var moment=require(_0xb964('0x1'));var path=require('path');var config=require(_0xb964('0x2'));module[_0xb964('0x3')]={'format':{'type':Sequelize[_0xb964('0x4')],'get':function(){return this['getDataValue']('value')?path[_0xb964('0x5')](this['getDataValue'](_0xb964('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xb964('0x7')]},'channel':{'type':Sequelize[_0xb964('0x7')]},'value':{'type':Sequelize[_0xb964('0x7')],'set':function(_0x204c7d){var _0xde47d5=_0x204c7d[_0xb964('0x8')](/\\/g,'/');this['setDataValue']('value',_0xde47d5);}},'rating':{'type':Sequelize[_0xb964('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x55e697){this[_0xb964('0xa')](_0xb964('0xb'),moment()[_0xb964('0xc')](_0x55e697,'ms'));this[_0xb964('0xa')](_0xb964('0xd'),moment());this[_0xb964('0xa')]('duration',_0x55e697);}},'startedAt':{'type':Sequelize[_0xb964('0xe')],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0xb')))[_0xb964('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xb964('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xb964('0xd')))[_0xb964('0x10')](_0xb964('0x12'))[_0xb964('0x11')]();}},'createdAt':{'type':Sequelize[_0xb964('0xe')],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0x13')))['format'](_0xb964('0x12'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb964('0xf')](_0xb964('0x14')))[_0xb964('0x10')](_0xb964('0x12'))[_0xb964('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 590a280..2249f71 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 _0x2d17=['apply','then','error','name','index','map','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','count','includeAll','include','findAll','catch','show','find','create','body','update','duration','closedAt','value','params','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','filename','download','extname','unlink','Not\x20found','destroy','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range'];(function(_0x56bfda,_0x56c197){var _0x516161=function(_0x2bc91a){while(--_0x2bc91a){_0x56bfda['push'](_0x56bfda['shift']());}};_0x516161(++_0x56c197);}(_0x2d17,0x17e));var _0x72d1=function(_0x51846d,_0x458917){_0x51846d=_0x51846d-0x0;var _0x29ac71=_0x2d17[_0x51846d];return _0x29ac71;};'use strict';var emlformat=require(_0x72d1('0x0'));var rimraf=require(_0x72d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72d1('0x2'));var rp=require(_0x72d1('0x3'));var moment=require('moment');var BPromise=require(_0x72d1('0x4'));var Mustache=require(_0x72d1('0x5'));var util=require('util');var path=require(_0x72d1('0x6'));var sox=require('sox');var csv=require(_0x72d1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72d1('0x8'));var _=require(_0x72d1('0x9'));var squel=require('squel');var crypto=require(_0x72d1('0xa'));var jsforce=require(_0x72d1('0xb'));var deskjs=require(_0x72d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x72d1('0xd'));var Papa=require(_0x72d1('0xe'));var Redis=require(_0x72d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x72d1('0x10'));var as=require(_0x72d1('0x11'));var hardwareService=require(_0x72d1('0x12'));var logger=require(_0x72d1('0x13'))(_0x72d1('0x14'));var utils=require(_0x72d1('0x15'));var config=require(_0x72d1('0x16'));var licenseUtil=require(_0x72d1('0x17'));var db=require(_0x72d1('0x18'))['db'];function respondWithStatusCode(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xcc;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0x19')](_0x5ad4df);}return _0x2f5a78[_0x72d1('0x1a')](_0x5ad4df)[_0x72d1('0x1b')]();};}function respondWithResult(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0xc8;return function(_0x143718){if(_0x143718){return _0x22ac6f[_0x72d1('0x1a')](_0x685a27)[_0x72d1('0x1c')](_0x143718);}};}function respondWithFilteredResult(_0x3f190f,_0x21c85e){return function(_0x23a238){if(_0x23a238){var _0x8d458=typeof _0x21c85e['offset']===_0x72d1('0x1d')&&typeof _0x21c85e['limit']===_0x72d1('0x1d');var _0x2c9851=_0x23a238['count'];var _0x1061b7=_0x8d458?0x0:_0x21c85e[_0x72d1('0x1e')];var _0x1ca18d=_0x8d458?_0x23a238['count']:_0x21c85e['offset']+_0x21c85e[_0x72d1('0x1f')];var _0x10d464;if(_0x1ca18d>=_0x2c9851){_0x1ca18d=_0x2c9851;_0x10d464=0xc8;}else{_0x10d464=0xce;}_0x3f190f[_0x72d1('0x1a')](_0x10d464);return _0x3f190f[_0x72d1('0x20')](_0x72d1('0x21'),_0x1061b7+'-'+_0x1ca18d+'/'+_0x2c9851)[_0x72d1('0x1c')](_0x23a238);}return null;};}function patchUpdates(_0x1e2411){return function(_0x5c7982){try{jsonpatch[_0x72d1('0x22')](_0x5c7982,_0x1e2411,!![]);}catch(_0x56e8d3){return BPromise['reject'](_0x56e8d3);}return _0x5c7982['save']();};}function saveUpdates(_0x585243,_0x445985){return function(_0x374602){if(_0x374602){return _0x374602['update'](_0x585243)[_0x72d1('0x23')](function(_0x256dc1){return _0x256dc1;});}return null;};}function removeEntity(_0x492086,_0x1431ee){return function(_0x26fa35){if(_0x26fa35){return _0x26fa35['destroy']()['then'](function(){_0x492086[_0x72d1('0x1a')](0xcc)[_0x72d1('0x1b')]();});}};}function handleEntityNotFound(_0x2f661,_0x2f879f){return function(_0xdf6a69){if(!_0xdf6a69){_0x2f661[_0x72d1('0x19')](0x194);}return _0xdf6a69;};}function handleError(_0x163bec,_0x589f7c){_0x589f7c=_0x589f7c||0x1f4;return function(_0x57ec9e){logger[_0x72d1('0x24')](_0x57ec9e['stack']);if(_0x57ec9e[_0x72d1('0x25')]){delete _0x57ec9e[_0x72d1('0x25')];}_0x163bec[_0x72d1('0x1a')](_0x589f7c)['send'](_0x57ec9e);};}exports[_0x72d1('0x26')]=function(_0x4c4c41,_0x707cd0){var _0x20055f={},_0x32588f={},_0x2cc0c8={'count':0x0,'rows':[]};var _0x51242b=_[_0x72d1('0x27')](db['ScreenRecording'][_0x72d1('0x28')],function(_0x32dc5e){return{'name':_0x32dc5e['fieldName'],'type':_0x32dc5e[_0x72d1('0x29')][_0x72d1('0x2a')]};});_0x32588f[_0x72d1('0x2b')]=_[_0x72d1('0x2c')](_[_0x72d1('0x27')](_0x51242b,'name'),[_0x72d1('0x2d')]);_0x32588f[_0x72d1('0x2e')]=_[_0x72d1('0x2f')](_0x4c4c41['query']);_0x32588f[_0x72d1('0x30')]=_[_0x72d1('0x31')](_0x32588f['model'],_0x32588f[_0x72d1('0x2e')]);_0x20055f[_0x72d1('0x32')]=_[_0x72d1('0x31')](_0x32588f['model'],qs[_0x72d1('0x33')](_0x4c4c41['query'][_0x72d1('0x33')]));_0x20055f[_0x72d1('0x32')]=_0x20055f[_0x72d1('0x32')][_0x72d1('0x34')]?_0x20055f[_0x72d1('0x32')]:_0x32588f[_0x72d1('0x2b')];if(!_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x35')](_0x72d1('0x36'))){_0x20055f[_0x72d1('0x1f')]=qs[_0x72d1('0x1f')](_0x4c4c41['query'][_0x72d1('0x1f')]);_0x20055f[_0x72d1('0x1e')]=qs[_0x72d1('0x1e')](_0x4c4c41[_0x72d1('0x2e')]['offset']);}_0x20055f[_0x72d1('0x37')]=qs[_0x72d1('0x38')](_0x4c4c41[_0x72d1('0x2e')]['sort']);_0x20055f[_0x72d1('0x39')]=qs[_0x72d1('0x30')](_[_0x72d1('0x3a')](_0x4c4c41['query'],_0x32588f[_0x72d1('0x30')]),_0x51242b);if(_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x3b')]){_0x20055f['where']=_[_0x72d1('0x3c')](_0x20055f[_0x72d1('0x39')],{'$or':_[_0x72d1('0x27')](_0x51242b,function(_0x14cb3d){if(_0x14cb3d[_0x72d1('0x29')]!==_0x72d1('0x3d')){var _0xd7ec0f={};_0xd7ec0f[_0x14cb3d['name']]={'$like':'%'+_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x3b')]+'%'};return _0xd7ec0f;}})});}_0x20055f=_[_0x72d1('0x3c')]({},_0x20055f,_0x4c4c41[_0x72d1('0x3e')]);var _0x20fb2f={'where':_0x20055f[_0x72d1('0x39')]};return db[_0x72d1('0x3f')][_0x72d1('0x40')](_0x20fb2f)['then'](function(_0x44d5b2){_0x2cc0c8[_0x72d1('0x40')]=_0x44d5b2;if(_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x41')]){_0x20055f[_0x72d1('0x42')]=[{'all':!![]}];}return db[_0x72d1('0x3f')][_0x72d1('0x43')](_0x20055f);})[_0x72d1('0x23')](function(_0x5620f0){_0x2cc0c8['rows']=_0x5620f0;return _0x2cc0c8;})[_0x72d1('0x23')](respondWithFilteredResult(_0x707cd0,_0x20055f))[_0x72d1('0x44')](handleError(_0x707cd0,null));};exports[_0x72d1('0x45')]=function(_0x21d361,_0x5a6bc4){var _0x3fe286={'raw':![],'where':{'id':_0x21d361['params']['id']}},_0x3e80e0={};_0x3e80e0[_0x72d1('0x2b')]=_['keys'](db[_0x72d1('0x3f')][_0x72d1('0x28')]);_0x3e80e0['query']=_[_0x72d1('0x2f')](_0x21d361['query']);_0x3e80e0['filters']=_['intersection'](_0x3e80e0[_0x72d1('0x2b')],_0x3e80e0['query']);_0x3fe286[_0x72d1('0x32')]=_[_0x72d1('0x31')](_0x3e80e0[_0x72d1('0x2b')],qs['fields'](_0x21d361['query'][_0x72d1('0x33')]));_0x3fe286['attributes']=_0x3fe286['attributes'][_0x72d1('0x34')]?_0x3fe286[_0x72d1('0x32')]:_0x3e80e0[_0x72d1('0x2b')];if(_0x21d361['query']['includeAll']){_0x3fe286['include']=[{'all':!![]}];}_0x3fe286=_['merge']({},_0x3fe286,_0x21d361[_0x72d1('0x3e')]);return db[_0x72d1('0x3f')][_0x72d1('0x46')](_0x3fe286)[_0x72d1('0x23')](handleEntityNotFound(_0x5a6bc4,null))[_0x72d1('0x23')](respondWithResult(_0x5a6bc4,null))[_0x72d1('0x44')](handleError(_0x5a6bc4,null));};exports[_0x72d1('0x47')]=function(_0x5924c,_0x1e2c11){return db['ScreenRecording'][_0x72d1('0x47')](_0x5924c[_0x72d1('0x48')],{})[_0x72d1('0x23')](respondWithResult(_0x1e2c11,0xc9))['catch'](handleError(_0x1e2c11,null));};exports[_0x72d1('0x49')]=function(_0x29c88f,_0x12ad75){if(_0x29c88f['body']['id']){delete _0x29c88f[_0x72d1('0x48')]['id'];}delete _0x29c88f[_0x72d1('0x48')][_0x72d1('0x4a')];delete _0x29c88f[_0x72d1('0x48')]['createdAt'];delete _0x29c88f['body'][_0x72d1('0x4b')];delete _0x29c88f[_0x72d1('0x48')][_0x72d1('0x4c')];return db['ScreenRecording'][_0x72d1('0x46')]({'where':{'id':_0x29c88f[_0x72d1('0x4d')]['id']}})[_0x72d1('0x23')](handleEntityNotFound(_0x12ad75,null))[_0x72d1('0x23')](saveUpdates(_0x29c88f[_0x72d1('0x48')],null))[_0x72d1('0x23')](respondWithResult(_0x12ad75,null))[_0x72d1('0x44')](handleError(_0x12ad75,null));};exports[_0x72d1('0x4e')]=function(_0x12870c,_0x18f986){return db[_0x72d1('0x3f')]['describe']()[_0x72d1('0x23')](respondWithResult(_0x18f986,null))['catch'](handleError(_0x18f986,null));};exports['download']=function(_0x356196,_0x5f2bba,_0x3c880e){var _0x7e401b=require(_0x72d1('0x4f'));var _0x162248=![];var _0x473a7b={};if(_0x356196[_0x72d1('0x2e')][_0x72d1('0x29')]&&_0x356196[_0x72d1('0x2e')][_0x72d1('0x29')]===_0x72d1('0x50')){_0x473a7b[_0x72d1('0x50')]=_0x356196['params']['id'];}else{_0x473a7b['id']=_0x356196[_0x72d1('0x4d')]['id'];}return db[_0x72d1('0x3f')][_0x72d1('0x46')]({'where':_0x473a7b,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5f2bba,null))[_0x72d1('0x23')](function(_0x140f0b){if(_0x140f0b){var _0x16e9e7=path[_0x72d1('0x51')](config[_0x72d1('0x52')],'server/files/screen_recordings',_0x140f0b[_0x72d1('0x4c')]);var _0x48f4a7=util[_0x72d1('0x2d')](_0x72d1('0x53'),_0x16e9e7);if(fs[_0x72d1('0x54')](_0x48f4a7)){_0x162248=!![];return _0x7e401b[_0x72d1('0x55')](_0x48f4a7,_0x16e9e7,config[_0x72d1('0x56')][_0x72d1('0x57')])[_0x72d1('0x23')](function(){return _0x140f0b;});}return _0x140f0b;}})[_0x72d1('0x23')](function(_0x384f0a){if(_0x384f0a){var _0x3a2dfe=path[_0x72d1('0x51')](config[_0x72d1('0x52')],_0x72d1('0x58'),_0x384f0a[_0x72d1('0x4c')]);if(!fs[_0x72d1('0x54')](_0x3a2dfe)){throw new db[(_0x72d1('0x59'))][(_0x72d1('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x384f0a[_0x72d1('0x5b')]){return _0x5f2bba[_0x72d1('0x5c')](_0x3a2dfe,_0x384f0a[_0x72d1('0x5b')]+path[_0x72d1('0x5d')](_0x3a2dfe),function(){if(_0x162248){fs[_0x72d1('0x5e')](_0x3a2dfe);}});}else{return _0x5f2bba[_0x72d1('0x5c')](_0x3a2dfe,function(_0x4e2d85){if(_0x162248){fs[_0x72d1('0x5e')](_0x3a2dfe);}});}}})[_0x72d1('0x44')](function(_0xb05cd9){if(_0xb05cd9['message']==='ScreenRecording\x20not\x20found'){_0x5f2bba[_0x72d1('0x1a')](0x194)['send'](_0x72d1('0x5f'));}else{return handleError(_0x5f2bba,null);}});};exports[_0x72d1('0x60')]=function(_0x201810,_0x41525c){return db[_0x72d1('0x3f')][_0x72d1('0x46')]({'where':{'id':_0x201810[_0x72d1('0x4d')]['id']}})[_0x72d1('0x23')](function(_0x28e42b){if(_['isNil'](_0x28e42b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x28e42b;})[_0x72d1('0x23')](function(_0x1d44f0){var _0x1bd80b=path['join'](config[_0x72d1('0x52')],_0x72d1('0x58'),_0x1d44f0['value']);logger[_0x72d1('0x61')](_0x72d1('0x62'),_0x1bd80b);if(!_[_0x72d1('0x63')](_0x1d44f0[_0x72d1('0x4c')])&&fs[_0x72d1('0x54')](_0x1bd80b)){logger[_0x72d1('0x61')](_0x72d1('0x64')+_0x1bd80b+_0x72d1('0x65'));fs[_0x72d1('0x66')](_0x1bd80b);}_0x1bd80b=_0x1bd80b+_0x72d1('0x67');if(!_[_0x72d1('0x63')](_0x1d44f0[_0x72d1('0x4c')])&&fs['existsSync'](_0x1bd80b)){logger['info'](_0x72d1('0x64')+_0x1bd80b+_0x72d1('0x65'));fs[_0x72d1('0x66')](_0x1bd80b);}return _0x1d44f0;})[_0x72d1('0x23')](function(_0x2ae8c9){if(!_0x2ae8c9)throw new InternalError();return _0x2ae8c9[_0x72d1('0x60')]();})[_0x72d1('0x23')](function(){_0x41525c[_0x72d1('0x1a')](0xcc)['end']();})[_0x72d1('0x44')](handleError(_0x41525c,null));}; \ No newline at end of file +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(_0x3af54c,_0x436158){var _0x4bc816=function(_0x44381e){while(--_0x44381e){_0x3af54c['push'](_0x3af54c['shift']());}};_0x4bc816(++_0x436158);}(_0xabce,0x103));var _0xeabc=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xabce[_0xdc37a1];return _0x99b4fe;};'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 diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d29a6e4..a963ad0 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 _0x85b9=['ScreenRecording','interactionid','../../config/logger','api','moment','request-promise','path','rimraf','./screenRecording.attributes','define'];(function(_0x35f85b,_0x15328c){var _0x63cee7=function(_0x5671f9){while(--_0x5671f9){_0x35f85b['push'](_0x35f85b['shift']());}};_0x63cee7(++_0x15328c);}(_0x85b9,0x138));var _0x985b=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x85b9[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x985b('0x0'))(_0x985b('0x1'));var moment=require(_0x985b('0x2'));var BPromise=require('bluebird');var rp=require(_0x985b('0x3'));var fs=require('fs');var path=require(_0x985b('0x4'));var rimraf=require(_0x985b('0x5'));var config=require('../../config/environment');var attributes=require(_0x985b('0x6'));module['exports']=function(_0x408e1d,_0x46cc91){return _0x408e1d[_0x985b('0x7')](_0x985b('0x8'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x985b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x536a=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','ScreenRecording'];(function(_0x3e7b59,_0x14a4cd){var _0x4bd64a=function(_0x144656){while(--_0x144656){_0x3e7b59['push'](_0x3e7b59['shift']());}};_0x4bd64a(++_0x14a4cd);}(_0x536a,0x9c));var _0xa536=function(_0x3278fa,_0x56fd49){_0x3278fa=_0x3278fa-0x0;var _0x3bb702=_0x536a[_0x3278fa];return _0x3bb702;};'use strict';var _=require(_0xa536('0x0'));var util=require(_0xa536('0x1'));var logger=require(_0xa536('0x2'))(_0xa536('0x3'));var moment=require(_0xa536('0x4'));var BPromise=require(_0xa536('0x5'));var rp=require(_0xa536('0x6'));var fs=require('fs');var path=require(_0xa536('0x7'));var rimraf=require('rimraf');var config=require(_0xa536('0x8'));var attributes=require(_0xa536('0x9'));module[_0xa536('0xa')]=function(_0x17e73b,_0x5ec831){return _0x17e73b['define'](_0xa536('0xb'),attributes,{'tableName':_0xa536('0xc'),'paranoid':![],'indexes':[{'name':_0xa536('0xd'),'fields':[_0xa536('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index c498d9c..0e9ffd6 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 _0xcbdc=['request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x52e8d4,_0x45973d){var _0x25bae3=function(_0x2b8f7b){while(--_0x2b8f7b){_0x52e8d4['push'](_0x52e8d4['shift']());}};_0x25bae3(++_0x45973d);}(_0xcbdc,0x1c3));var _0xccbd=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcbdc[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xccbd('0x0'));var util=require(_0xccbd('0x1'));var moment=require(_0xccbd('0x2'));var BPromise=require('bluebird');var rs=require(_0xccbd('0x3'));var fs=require('fs');var Redis=require(_0xccbd('0x4'));var db=require(_0xccbd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xccbd('0x6'))('rpc');var config=require(_0xccbd('0x7'));var jayson=require(_0xccbd('0x8'));var client=jayson[_0xccbd('0x9')][_0xccbd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa29b40,_0x43c548,_0x3de2f2){return new BPromise(function(_0x1da18d,_0x44277b){return client[_0xccbd('0xb')](_0xa29b40,_0x3de2f2)[_0xccbd('0xc')](function(_0x398c1a){logger[_0xccbd('0xd')](_0xccbd('0xe'),_0x43c548,_0xccbd('0xf'));logger[_0xccbd('0x10')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x43c548,_0xccbd('0xf'),JSON['stringify'](_0x398c1a));if(_0x398c1a[_0xccbd('0x11')]){if(_0x398c1a[_0xccbd('0x11')][_0xccbd('0x12')]===0x1f4){logger['error'](_0xccbd('0xe'),_0x43c548,_0x398c1a[_0xccbd('0x11')][_0xccbd('0x13')]);return _0x44277b(_0x398c1a['error'][_0xccbd('0x13')]);}logger['error'](_0xccbd('0xe'),_0x43c548,_0x398c1a[_0xccbd('0x11')][_0xccbd('0x13')]);return _0x1da18d(_0x398c1a[_0xccbd('0x11')][_0xccbd('0x13')]);}else{logger[_0xccbd('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x43c548,_0xccbd('0xf'));_0x1da18d(_0x398c1a[_0xccbd('0x14')][_0xccbd('0x13')]);}})['catch'](function(_0x32daf7){logger[_0xccbd('0x11')](_0xccbd('0xe'),_0x43c548,_0x32daf7);_0x44277b(_0x32daf7);});});} \ No newline at end of file +var _0x6ae2=['stringify','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x3784c9,_0x3a48f4){var _0x4277d9=function(_0x3fbc14){while(--_0x3fbc14){_0x3784c9['push'](_0x3784c9['shift']());}};_0x4277d9(++_0x3a48f4);}(_0x6ae2,0x84));var _0x26ae=function(_0x4c7363,_0x40e092){_0x4c7363=_0x4c7363-0x0;var _0x4f2cf2=_0x6ae2[_0x4c7363];return _0x4f2cf2;};'use strict';var _=require('lodash');var util=require(_0x26ae('0x0'));var moment=require('moment');var BPromise=require(_0x26ae('0x1'));var rs=require(_0x26ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26ae('0x3'))['db'];var utils=require(_0x26ae('0x4'));var logger=require(_0x26ae('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x26ae('0x6')][_0x26ae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40d35f,_0x3e77dc,_0x318e37){return new BPromise(function(_0x3afc42,_0x31a333){return client[_0x26ae('0x8')](_0x40d35f,_0x318e37)[_0x26ae('0x9')](function(_0x37a4b7){logger[_0x26ae('0xa')](_0x26ae('0xb'),_0x3e77dc,_0x26ae('0xc'));logger[_0x26ae('0xd')](_0x26ae('0xe'),_0x3e77dc,'request\x20sent',JSON[_0x26ae('0xf')](_0x37a4b7));if(_0x37a4b7[_0x26ae('0x10')]){if(_0x37a4b7[_0x26ae('0x10')][_0x26ae('0x11')]===0x1f4){logger[_0x26ae('0x10')](_0x26ae('0xb'),_0x3e77dc,_0x37a4b7['error']['message']);return _0x31a333(_0x37a4b7[_0x26ae('0x10')][_0x26ae('0x12')]);}logger[_0x26ae('0x10')](_0x26ae('0xb'),_0x3e77dc,_0x37a4b7[_0x26ae('0x10')][_0x26ae('0x12')]);return _0x3afc42(_0x37a4b7[_0x26ae('0x10')][_0x26ae('0x12')]);}else{logger[_0x26ae('0xa')](_0x26ae('0xb'),_0x3e77dc,_0x26ae('0xc'));_0x3afc42(_0x37a4b7[_0x26ae('0x13')][_0x26ae('0x12')]);}})[_0x26ae('0x14')](function(_0x5dd413){logger[_0x26ae('0x10')](_0x26ae('0xb'),_0x3e77dc,_0x5dd413);_0x31a333(_0x5dd413);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index e138e03..817d744 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 _0x0fc0=['getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','join','logologin','preferred','addPreferred','favicon','/:id/favicon','addFavicon','update','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/now','getDate','show','/:id/logo'];(function(_0x180be5,_0x514d06){var _0x3023f3=function(_0x54dce6){while(--_0x54dce6){_0x180be5['push'](_0x180be5['shift']());}};_0x3023f3(++_0x514d06);}(_0x0fc0,0x148));var _0x00fc=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0fc0[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0x00fc('0x0'));var path=require(_0x00fc('0x1'));var timeout=require(_0x00fc('0x2'));var express=require(_0x00fc('0x3'));var router=express[_0x00fc('0x4')]();var fs_extra=require(_0x00fc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x00fc('0x6'));var config=require(_0x00fc('0x7'));var controller=require('./setting.controller');router['get']('/',auth[_0x00fc('0x8')](),controller['index']);router[_0x00fc('0x9')](_0x00fc('0xa'),controller[_0x00fc('0xb')]);router['get']('/:id',controller[_0x00fc('0xc')]);router[_0x00fc('0x9')](_0x00fc('0xd'),controller[_0x00fc('0xe')]);router[_0x00fc('0x9')](_0x00fc('0xf'),controller['getLogoLogin']);router[_0x00fc('0x9')](_0x00fc('0x10'),controller['gdpr']);router[_0x00fc('0x9')](_0x00fc('0x11'),controller['getPreferred']);router[_0x00fc('0x9')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0x00fc('0x12')]({'destination':function(_0x427d72,_0x557547,_0x4923e2){_0x4923e2(null,path['join'](config[_0x00fc('0x13')],_0x00fc('0x14')));},'filename':function(_0x214986,_0x7cc41e,_0x413ee7){_0x413ee7(null,util[_0x00fc('0x15')](_0x00fc('0x16'),_0x00fc('0x17'),path[_0x00fc('0x18')](_0x7cc41e[_0x00fc('0x19')])));}})});router[_0x00fc('0x1a')](_0x00fc('0xd'),upload[_0x00fc('0x1b')](_0x00fc('0x1c')),controller[_0x00fc('0x1d')]);var upload=multer({'storage':multer[_0x00fc('0x12')]({'destination':function(_0xa2fc0,_0x3f0ae6,_0x11497a){_0x11497a(null,path[_0x00fc('0x1e')](config[_0x00fc('0x13')],'server/files/images/logos/'));},'filename':function(_0x5c2ee4,_0x2319ec,_0x190dbf){_0x190dbf(null,util[_0x00fc('0x15')](_0x00fc('0x16'),_0x00fc('0x1f'),path[_0x00fc('0x18')](_0x2319ec[_0x00fc('0x19')])));}})});router['post'](_0x00fc('0xf'),upload['single'](_0x00fc('0x1c')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x00fc('0x12')]({'destination':function(_0x18cbb3,_0x514604,_0x919633){_0x919633(null,path['join'](config[_0x00fc('0x13')],_0x00fc('0x14')));},'filename':function(_0x1c6473,_0x3d74b1,_0x4bad90){_0x4bad90(null,util[_0x00fc('0x15')](_0x00fc('0x16'),_0x00fc('0x20'),path[_0x00fc('0x18')](_0x3d74b1['originalname'])));}})});router[_0x00fc('0x1a')]('/:id/preferred',upload['single'](_0x00fc('0x1c')),controller[_0x00fc('0x21')]);var upload=multer({'storage':multer[_0x00fc('0x12')]({'destination':function(_0x2e23cc,_0x33ffdd,_0x27f06f){_0x27f06f(null,path['join'](config['root'],_0x00fc('0x14')));},'filename':function(_0x444aaf,_0xf205c0,_0x3ee955){_0x3ee955(null,util['format']('%s%s',_0x00fc('0x22'),path[_0x00fc('0x18')](_0xf205c0[_0x00fc('0x19')])));}})});router[_0x00fc('0x1a')](_0x00fc('0x23'),upload[_0x00fc('0x1b')]('file'),controller[_0x00fc('0x24')]);router['put']('/:id',auth[_0x00fc('0x8')](),controller[_0x00fc('0x25')]);module['exports']=router; \ No newline at end of file +var _0x631c=['getPreferred','/:id/favicon','getFavicon','join','format','%s%s','extname','originalname','post','file','root','server/files/images/logos/','logologin','single','addFavicon','put','update','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','get','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred'];(function(_0x9e85f9,_0x246d23){var _0x3ade24=function(_0x1dff82){while(--_0x1dff82){_0x9e85f9['push'](_0x9e85f9['shift']());}};_0x3ade24(++_0x246d23);}(_0x631c,0x10d));var _0xc631=function(_0x3b4ecc,_0xc1eff5){_0x3b4ecc=_0x3b4ecc-0x0;var _0x36f1b2=_0x631c[_0x3b4ecc];return _0x36f1b2;};'use strict';var multer=require('multer');var util=require(_0xc631('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc631('0x1'));var router=express[_0xc631('0x2')]();var fs_extra=require(_0xc631('0x3'));var auth=require(_0xc631('0x4'));var interaction=require(_0xc631('0x5'));var config=require(_0xc631('0x6'));var controller=require(_0xc631('0x7'));router['get']('/',auth[_0xc631('0x8')](),controller['index']);router[_0xc631('0x9')]('/now',controller[_0xc631('0xa')]);router[_0xc631('0x9')](_0xc631('0xb'),controller['show']);router[_0xc631('0x9')](_0xc631('0xc'),controller[_0xc631('0xd')]);router['get'](_0xc631('0xe'),controller[_0xc631('0xf')]);router[_0xc631('0x9')](_0xc631('0x10'),controller[_0xc631('0x11')]);router['get'](_0xc631('0x12'),controller[_0xc631('0x13')]);router[_0xc631('0x9')](_0xc631('0x14'),controller[_0xc631('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x87d07d,_0x1ccf5b,_0x3e7720){_0x3e7720(null,path[_0xc631('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x4c3f15,_0x15b3db,_0x107ae0){_0x107ae0(null,util[_0xc631('0x17')](_0xc631('0x18'),'logo',path[_0xc631('0x19')](_0x15b3db[_0xc631('0x1a')])));}})});router[_0xc631('0x1b')](_0xc631('0xc'),upload['single'](_0xc631('0x1c')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12bc52,_0x9a424a,_0x15f737){_0x15f737(null,path[_0xc631('0x16')](config[_0xc631('0x1d')],_0xc631('0x1e')));},'filename':function(_0x3f66f5,_0x50b6a6,_0x307252){_0x307252(null,util[_0xc631('0x17')](_0xc631('0x18'),_0xc631('0x1f'),path['extname'](_0x50b6a6['originalname'])));}})});router['post'](_0xc631('0xe'),upload[_0xc631('0x20')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d8d4d,_0x3f3987,_0x3f9225){_0x3f9225(null,path[_0xc631('0x16')](config['root'],_0xc631('0x1e')));},'filename':function(_0xe77e6d,_0x162c0f,_0x126e89){_0x126e89(null,util[_0xc631('0x17')](_0xc631('0x18'),'preferred',path[_0xc631('0x19')](_0x162c0f['originalname'])));}})});router[_0xc631('0x1b')](_0xc631('0x12'),upload['single'](_0xc631('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x30dd2e,_0x49414f,_0x4b4806){_0x4b4806(null,path['join'](config[_0xc631('0x1d')],_0xc631('0x1e')));},'filename':function(_0x330c64,_0x3427a8,_0x2d6219){_0x2d6219(null,util['format'](_0xc631('0x18'),'favicon',path[_0xc631('0x19')](_0x3427a8['originalname'])));}})});router[_0xc631('0x1b')](_0xc631('0x14'),upload[_0xc631('0x20')]('file'),controller[_0xc631('0x21')]);router[_0xc631('0x22')](_0xc631('0xb'),auth[_0xc631('0x8')](),controller[_0xc631('0x23')]);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 fcba74d..6bd365b 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x112e8c,_0x5c67be){var _0x3151d9=function(_0x316bd8){while(--_0x316bd8){_0x112e8c['push'](_0x112e8c['shift']());}};_0x3151d9(++_0x5c67be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x257cb0,_0x4aa2c2){var _0xd8c2c6=function(_0x322d06){while(--_0x322d06){_0x257cb0['push'](_0x257cb0['shift']());}};_0xd8c2c6(++_0x4aa2c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b8b9d49..213406f 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 _0xf842=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','body','find','file','filename','logo','getLogo','server/files/images/logos','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','default_loginLogo.svg','custom','Sequelize','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x24b7fb,_0x52f73d){var _0x10a800=function(_0x497967){while(--_0x497967){_0x24b7fb['push'](_0x24b7fb['shift']());}};_0x10a800(++_0x52f73d);}(_0xf842,0x172));var _0x2f84=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xf842[_0x313c96];return _0x522f53;};'use strict';var emlformat=require(_0x2f84('0x0'));var rimraf=require(_0x2f84('0x1'));var zipdir=require(_0x2f84('0x2'));var jsonpatch=require(_0x2f84('0x3'));var rp=require('request-promise');var moment=require(_0x2f84('0x4'));var BPromise=require(_0x2f84('0x5'));var Mustache=require(_0x2f84('0x6'));var util=require(_0x2f84('0x7'));var path=require(_0x2f84('0x8'));var sox=require('sox');var csv=require(_0x2f84('0x9'));var ejs=require(_0x2f84('0xa'));var fs=require('fs');var fs_extra=require(_0x2f84('0xb'));var _=require('lodash');var squel=require(_0x2f84('0xc'));var crypto=require(_0x2f84('0xd'));var jsforce=require(_0x2f84('0xe'));var deskjs=require(_0x2f84('0xf'));var toCsv=require(_0x2f84('0x9'));var querystring=require(_0x2f84('0x10'));var Papa=require(_0x2f84('0x11'));var Redis=require(_0x2f84('0x12'));var authService=require(_0x2f84('0x13'));var qs=require(_0x2f84('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f84('0x15'));var logger=require('../../config/logger')(_0x2f84('0x16'));var utils=require(_0x2f84('0x17'));var config=require(_0x2f84('0x18'));var licenseUtil=require(_0x2f84('0x19'));var db=require(_0x2f84('0x1a'))['db'];var jayson=require(_0x2f84('0x1b'));var client=jayson[_0x2f84('0x1c')][_0x2f84('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3b3f6c,_0x20e0d0,_0x1143fa,_0x3c7728){return new BPromise(function(_0x4a07a5,_0x489f51){var _0x50d906=_0x3c7728||client;return _0x50d906[_0x2f84('0x1e')](_0x3b3f6c,_0x1143fa)[_0x2f84('0x1f')](function(_0x27cce2){logger['info'](_0x2f84('0x20'),_0x20e0d0,_0x2f84('0x21'));logger[_0x2f84('0x22')]('Setting,\x20%s,\x20%s,\x20%s',_0x20e0d0,_0x2f84('0x21'),JSON[_0x2f84('0x23')](_0x27cce2));if(_0x27cce2[_0x2f84('0x24')]){if(_0x27cce2[_0x2f84('0x24')]['code']===0x1f4){logger[_0x2f84('0x24')]('Setting,\x20%s,\x20%s',_0x20e0d0,_0x27cce2[_0x2f84('0x24')]['message']);return _0x489f51(_0x27cce2['error'][_0x2f84('0x25')]);}logger[_0x2f84('0x24')](_0x2f84('0x20'),_0x20e0d0,_0x27cce2[_0x2f84('0x24')][_0x2f84('0x25')]);return _0x4a07a5(_0x27cce2[_0x2f84('0x24')]['message']);}else{logger['info'](_0x2f84('0x20'),_0x20e0d0,_0x2f84('0x21'));_0x4a07a5(_0x27cce2[_0x2f84('0x26')][_0x2f84('0x25')]);}})[_0x2f84('0x27')](function(_0x206e88){logger['error'](_0x2f84('0x20'),_0x20e0d0,_0x206e88);_0x489f51(_0x206e88);});});}function respondWithStatusCode(_0x5f4740,_0x289efc){_0x289efc=_0x289efc||0xcc;return function(_0x50e8ff){if(_0x50e8ff){return _0x5f4740[_0x2f84('0x28')](_0x289efc);}return _0x5f4740[_0x2f84('0x29')](_0x289efc)[_0x2f84('0x2a')]();};}function respondWithResult(_0x5a48ff,_0x16ec4a){_0x16ec4a=_0x16ec4a||0xc8;return function(_0x2f74c7){if(_0x2f74c7){return _0x5a48ff[_0x2f84('0x29')](_0x16ec4a)[_0x2f84('0x2b')](_0x2f74c7);}};}function respondWithFilteredResult(_0x19a615,_0x3a04fa){return function(_0x5435df){if(_0x5435df){var _0x3f6e2d=typeof _0x3a04fa[_0x2f84('0x2c')]===_0x2f84('0x2d')&&typeof _0x3a04fa['limit']==='undefined';var _0x432f89=_0x5435df[_0x2f84('0x2e')];var _0x5e104a=_0x3f6e2d?0x0:_0x3a04fa[_0x2f84('0x2c')];var _0x1de657=_0x3f6e2d?_0x5435df['count']:_0x3a04fa[_0x2f84('0x2c')]+_0x3a04fa[_0x2f84('0x2f')];var _0x3674e7;if(_0x1de657>=_0x432f89){_0x1de657=_0x432f89;_0x3674e7=0xc8;}else{_0x3674e7=0xce;}_0x19a615[_0x2f84('0x29')](_0x3674e7);return _0x19a615[_0x2f84('0x30')](_0x2f84('0x31'),_0x5e104a+'-'+_0x1de657+'/'+_0x432f89)[_0x2f84('0x2b')](_0x5435df);}return null;};}function patchUpdates(_0x491238){return function(_0x2adfe0){try{jsonpatch[_0x2f84('0x32')](_0x2adfe0,_0x491238,!![]);}catch(_0x198905){return BPromise[_0x2f84('0x33')](_0x198905);}return _0x2adfe0[_0x2f84('0x34')]();};}function saveUpdates(_0x588963,_0x326698){return function(_0x542f4f){if(_0x542f4f){return _0x542f4f[_0x2f84('0x35')](_0x588963)['then'](function(_0x5a7cdb){return _0x5a7cdb;});}return null;};}function removeEntity(_0x4c0830,_0x343703){return function(_0x5db877){if(_0x5db877){return _0x5db877[_0x2f84('0x36')]()[_0x2f84('0x1f')](function(){_0x4c0830[_0x2f84('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a89f2,_0x14bc47){return function(_0x5d5f0b){if(!_0x5d5f0b){_0x5a89f2['sendStatus'](0x194);}return _0x5d5f0b;};}function handleError(_0x3fd622,_0x33dc1e){_0x33dc1e=_0x33dc1e||0x1f4;return function(_0x4ac4d0){logger[_0x2f84('0x24')](_0x4ac4d0[_0x2f84('0x37')]);if(_0x4ac4d0[_0x2f84('0x38')]){delete _0x4ac4d0[_0x2f84('0x38')];}_0x3fd622['status'](_0x33dc1e)[_0x2f84('0x39')](_0x4ac4d0);};}exports[_0x2f84('0x3a')]=function(_0x5b31e1,_0x43986b){var _0x57b524={},_0x57f3ed={},_0x238615={'count':0x0,'rows':[]};var _0x53ba30=_[_0x2f84('0x3b')](db[_0x2f84('0x3c')][_0x2f84('0x3d')],function(_0x4f51da){return{'name':_0x4f51da[_0x2f84('0x3e')],'type':_0x4f51da[_0x2f84('0x3f')][_0x2f84('0x40')]};});_0x57f3ed[_0x2f84('0x41')]=_[_0x2f84('0x3b')](_0x53ba30,_0x2f84('0x38'));_0x57f3ed[_0x2f84('0x42')]=_[_0x2f84('0x43')](_0x5b31e1[_0x2f84('0x42')]);_0x57f3ed[_0x2f84('0x44')]=_[_0x2f84('0x45')](_0x57f3ed[_0x2f84('0x41')],_0x57f3ed['query']);_0x57b524[_0x2f84('0x46')]=_[_0x2f84('0x45')](_0x57f3ed['model'],qs['fields'](_0x5b31e1[_0x2f84('0x42')][_0x2f84('0x47')]));_0x57b524[_0x2f84('0x46')]=_0x57b524[_0x2f84('0x46')][_0x2f84('0x48')]?_0x57b524['attributes']:_0x57f3ed[_0x2f84('0x41')];if(!_0x5b31e1[_0x2f84('0x42')][_0x2f84('0x49')]('nolimit')){_0x57b524[_0x2f84('0x2f')]=qs[_0x2f84('0x2f')](_0x5b31e1[_0x2f84('0x42')][_0x2f84('0x2f')]);_0x57b524['offset']=qs['offset'](_0x5b31e1[_0x2f84('0x42')][_0x2f84('0x2c')]);}_0x57b524['order']=qs[_0x2f84('0x4a')](_0x5b31e1[_0x2f84('0x42')]['sort']);_0x57b524['where']=qs[_0x2f84('0x44')](_['pick'](_0x5b31e1[_0x2f84('0x42')],_0x57f3ed[_0x2f84('0x44')]),_0x53ba30);if(_0x5b31e1[_0x2f84('0x42')][_0x2f84('0x4b')]){_0x57b524[_0x2f84('0x4c')]=_[_0x2f84('0x4d')](_0x57b524[_0x2f84('0x4c')],{'$or':_[_0x2f84('0x3b')](_0x53ba30,function(_0x5b6117){if(_0x5b6117['type']!==_0x2f84('0x4e')){var _0x19b79b={};_0x19b79b[_0x5b6117[_0x2f84('0x38')]]={'$like':'%'+_0x5b31e1[_0x2f84('0x42')][_0x2f84('0x4b')]+'%'};return _0x19b79b;}})});}_0x57b524=_[_0x2f84('0x4d')]({},_0x57b524,_0x5b31e1[_0x2f84('0x4f')]);var _0x40ed6a={'where':_0x57b524[_0x2f84('0x4c')]};return db['Setting'][_0x2f84('0x2e')](_0x40ed6a)[_0x2f84('0x1f')](function(_0x34afe2){_0x238615[_0x2f84('0x2e')]=_0x34afe2;if(_0x5b31e1[_0x2f84('0x42')]['includeAll']){_0x57b524[_0x2f84('0x50')]=[{'all':!![]}];}return db[_0x2f84('0x3c')][_0x2f84('0x51')](_0x57b524);})[_0x2f84('0x1f')](function(_0x4e5dba){_0x238615[_0x2f84('0x52')]=_0x4e5dba;return _0x238615;})[_0x2f84('0x1f')](respondWithFilteredResult(_0x43986b,_0x57b524))['catch'](handleError(_0x43986b,null));};exports[_0x2f84('0x53')]=function(_0x3d2fac,_0x261ae6){var _0x4a1b67={'raw':![],'where':{'id':_0x3d2fac[_0x2f84('0x54')]['id']}},_0x40a8e0={};_0x40a8e0[_0x2f84('0x41')]=_[_0x2f84('0x43')](db[_0x2f84('0x3c')][_0x2f84('0x3d')]);_0x40a8e0[_0x2f84('0x42')]=_['keys'](_0x3d2fac[_0x2f84('0x42')]);_0x40a8e0[_0x2f84('0x44')]=_[_0x2f84('0x45')](_0x40a8e0[_0x2f84('0x41')],_0x40a8e0[_0x2f84('0x42')]);_0x4a1b67[_0x2f84('0x46')]=_[_0x2f84('0x45')](_0x40a8e0[_0x2f84('0x41')],qs[_0x2f84('0x47')](_0x3d2fac['query'][_0x2f84('0x47')]));_0x4a1b67[_0x2f84('0x46')]=_0x4a1b67['attributes'][_0x2f84('0x48')]?_0x4a1b67[_0x2f84('0x46')]:_0x40a8e0[_0x2f84('0x41')];if(_0x3d2fac[_0x2f84('0x42')][_0x2f84('0x55')]){_0x4a1b67[_0x2f84('0x50')]=[{'all':!![]}];}_0x4a1b67=_[_0x2f84('0x4d')]({},_0x4a1b67,_0x3d2fac['options']);return db['Setting']['find'](_0x4a1b67)[_0x2f84('0x1f')](handleEntityNotFound(_0x261ae6,null))[_0x2f84('0x1f')](respondWithResult(_0x261ae6,null))[_0x2f84('0x27')](handleError(_0x261ae6,null));};exports[_0x2f84('0x35')]=function(_0x5cf802,_0x1d7fbc){if(_0x5cf802[_0x2f84('0x56')]['id']){delete _0x5cf802[_0x2f84('0x56')]['id'];}return db[_0x2f84('0x3c')][_0x2f84('0x57')]({'where':{'id':_0x5cf802[_0x2f84('0x54')]['id']}})[_0x2f84('0x1f')](handleEntityNotFound(_0x1d7fbc,null))[_0x2f84('0x1f')](saveUpdates(_0x5cf802[_0x2f84('0x56')],null))[_0x2f84('0x1f')](respondWithResult(_0x1d7fbc,null))[_0x2f84('0x27')](handleError(_0x1d7fbc,null));};exports['addLogo']=function(_0x3644a3,_0x2166f3,_0x1abf31){if(_0x3644a3[_0x2f84('0x58')]&&_0x3644a3[_0x2f84('0x58')][_0x2f84('0x59')]){_0x3644a3[_0x2f84('0x56')][_0x2f84('0x5a')]=_0x3644a3['file']['filename'];}return db['Setting'][_0x2f84('0x57')]({'where':{'id':_0x3644a3[_0x2f84('0x54')]['id']}})['then'](handleEntityNotFound(_0x2166f3,null))[_0x2f84('0x1f')](saveUpdates(_0x3644a3['body'],null))[_0x2f84('0x1f')](respondWithResult(_0x2166f3,null))[_0x2f84('0x27')](handleError(_0x2166f3,null));};exports['addLogoLogin']=function(_0x13236f,_0x277822,_0x2755c4){if(_0x13236f['file']&&_0x13236f['file']['filename']){_0x13236f[_0x2f84('0x56')]['loginLogo']=_0x13236f[_0x2f84('0x58')][_0x2f84('0x59')];}return db['Setting'][_0x2f84('0x57')]({'where':{'id':_0x13236f[_0x2f84('0x54')]['id']}})['then'](handleEntityNotFound(_0x277822,null))[_0x2f84('0x1f')](saveUpdates(_0x13236f[_0x2f84('0x56')],null))[_0x2f84('0x1f')](respondWithResult(_0x277822,null))[_0x2f84('0x27')](handleError(_0x277822,null));};var utilLicense=require('../../config/license/util');exports[_0x2f84('0x5b')]=function(_0x1c8582,_0x24b499,_0x475e6e){var _0x58c640=_0x2f84('0x5c');var _0xec2444={'custom':![]};return utilLicense['getLicense']()[_0x2f84('0x1f')](function(_0x1ec7e9){if(_0x1ec7e9){_0xec2444=_0x1ec7e9;}return db[_0x2f84('0x3c')][_0x2f84('0x57')]({'where':{'id':_0x1c8582[_0x2f84('0x54')]['id']},'attributes':[_0x2f84('0x5a'),_0x2f84('0x5d'),_0x2f84('0x5e'),_0x2f84('0x5f'),_0x2f84('0x60'),_0x2f84('0x61'),_0x2f84('0x62'),_0x2f84('0x63')],'raw':!![]});})[_0x2f84('0x1f')](handleEntityNotFound(_0x24b499,null))[_0x2f84('0x1f')](function(_0x6ad587){if(_0x6ad587){var _0x21e6a9=_0x6ad587['logo']&&fs[_0x2f84('0x64')](path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x58c640,_['toLower'](_0x6ad587[_0x2f84('0x5a')])))?path[_0x2f84('0x65')](config['root'],_0x58c640,_[_0x2f84('0x67')](_0x6ad587[_0x2f84('0x5a')])):path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x58c640,_[_0x2f84('0x67')](_0x2f84('0x68')));var _0x94e5da=_0x2f84('0x69')+_[_0x2f84('0x6a')](_0x2f84('0x5a'));if(_0x6ad587[_0x94e5da]||!_0xec2444['custom']){_0x21e6a9=path['join'](config['root'],_0x58c640,_['toLower'](_0x2f84('0x68')));}if(!fs[_0x2f84('0x64')](_0x21e6a9)){throw new db['Sequelize'][(_0x2f84('0x6b'))](_[_0x2f84('0x6a')](_0x2f84('0x5a'))+_0x2f84('0x6c'));}return _0x24b499[_0x2f84('0x6d')](_0x21e6a9);}})[_0x2f84('0x27')](handleError(_0x24b499,null));};var utilLicense=require(_0x2f84('0x19'));exports[_0x2f84('0x6e')]=function(_0xb52322,_0x211c06,_0x422964){var _0x49e2c9=_0x2f84('0x5c');var _0x37dbab={'custom':![]};return utilLicense[_0x2f84('0x6f')]()['then'](function(_0x2a89d8){if(_0x2a89d8){_0x37dbab=_0x2a89d8;}return db[_0x2f84('0x3c')][_0x2f84('0x57')]({'where':{'id':_0xb52322[_0x2f84('0x54')]['id']},'attributes':[_0x2f84('0x5a'),_0x2f84('0x5d'),_0x2f84('0x5e'),_0x2f84('0x5f'),_0x2f84('0x60'),_0x2f84('0x61'),'defaultPreferred',_0x2f84('0x63')],'raw':!![]});})[_0x2f84('0x1f')](handleEntityNotFound(_0x211c06,null))['then'](function(_0x4d25f8){if(_0x4d25f8){var _0x450f3c=_0x4d25f8[_0x2f84('0x5d')]&&fs[_0x2f84('0x64')](path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x49e2c9,_['toLower'](_0x4d25f8[_0x2f84('0x5d')])))?path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x49e2c9,_['toLower'](_0x4d25f8['loginLogo'])):path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x49e2c9,_[_0x2f84('0x67')](_0x2f84('0x70')));var _0x1dcabd=_0x2f84('0x69')+_[_0x2f84('0x6a')](_0x2f84('0x5d'));if(_0x4d25f8[_0x1dcabd]||!_0x37dbab[_0x2f84('0x71')]){_0x450f3c=path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x49e2c9,_[_0x2f84('0x67')](_0x2f84('0x70')));}if(!fs['existsSync'](_0x450f3c)){throw new db[(_0x2f84('0x72'))][(_0x2f84('0x6b'))](_['upperFirst']('loginLogo')+_0x2f84('0x6c'));}return _0x211c06['download'](_0x450f3c);}})['catch'](handleError(_0x211c06,null));};exports['gdpr']=function(_0x235788,_0x3566fe){return db[_0x2f84('0x3c')][_0x2f84('0x57')]({'where':{'id':_0x235788[_0x2f84('0x54')]['id']},'attributes':[_0x2f84('0x73')]})[_0x2f84('0x1f')](respondWithResult(_0x3566fe,null))[_0x2f84('0x27')](handleError(_0x3566fe,null));};exports['addPreferred']=function(_0x2ddce5,_0x5a9863,_0xa18235){if(_0x2ddce5[_0x2f84('0x58')]&&_0x2ddce5['file'][_0x2f84('0x59')]){_0x2ddce5[_0x2f84('0x56')][_0x2f84('0x5e')]=_0x2ddce5[_0x2f84('0x58')][_0x2f84('0x59')];}return db['Setting'][_0x2f84('0x57')]({'where':{'id':_0x2ddce5[_0x2f84('0x54')]['id']}})[_0x2f84('0x1f')](handleEntityNotFound(_0x5a9863,null))['then'](saveUpdates(_0x2ddce5[_0x2f84('0x56')],null))[_0x2f84('0x1f')](respondWithResult(_0x5a9863,null))[_0x2f84('0x27')](handleError(_0x5a9863,null));};var utilLicense=require('../../config/license/util');exports[_0x2f84('0x74')]=function(_0x3d4236,_0x41c96e,_0x1e70e9){var _0x3c2029=_0x2f84('0x5c');var _0xef5d05={'custom':![]};return utilLicense[_0x2f84('0x6f')]()[_0x2f84('0x1f')](function(_0x3bddb3){if(_0x3bddb3){_0xef5d05=_0x3bddb3;}return db['Setting'][_0x2f84('0x57')]({'where':{'id':_0x3d4236[_0x2f84('0x54')]['id']},'attributes':['logo',_0x2f84('0x5d'),_0x2f84('0x5e'),'favicon',_0x2f84('0x60'),_0x2f84('0x61'),_0x2f84('0x62'),_0x2f84('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x41c96e,null))['then'](function(_0x13e058){if(_0x13e058){var _0x150883=_0x13e058[_0x2f84('0x5e')]&&fs[_0x2f84('0x64')](path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x3c2029,_[_0x2f84('0x67')](_0x13e058[_0x2f84('0x5e')])))?path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x3c2029,_[_0x2f84('0x67')](_0x13e058[_0x2f84('0x5e')])):path['join'](config['root'],_0x3c2029,_['toLower'](_0x2f84('0x75')));var _0x2f5995=_0x2f84('0x69')+_[_0x2f84('0x6a')]('preferred');if(_0x13e058[_0x2f5995]||!_0xef5d05[_0x2f84('0x71')]||!_0xef5d05[_0x2f84('0x5e')]){_0x150883=path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x3c2029,_['toLower'](_0x2f84('0x75')));}if(!fs[_0x2f84('0x64')](_0x150883)){throw new db[(_0x2f84('0x72'))][(_0x2f84('0x6b'))](_[_0x2f84('0x6a')](_0x2f84('0x5e'))+'\x20not\x20found');}return _0x41c96e[_0x2f84('0x6d')](_0x150883);}})[_0x2f84('0x27')](handleError(_0x41c96e,null));};exports[_0x2f84('0x76')]=function(_0x2d6162,_0x12215f,_0x13aacd){if(_0x2d6162[_0x2f84('0x58')]&&_0x2d6162[_0x2f84('0x58')]['filename']){_0x2d6162[_0x2f84('0x56')]['favicon']=_0x2d6162[_0x2f84('0x58')][_0x2f84('0x59')];}return db[_0x2f84('0x3c')][_0x2f84('0x57')]({'where':{'id':_0x2d6162[_0x2f84('0x54')]['id']}})['then'](handleEntityNotFound(_0x12215f,null))[_0x2f84('0x1f')](saveUpdates(_0x2d6162[_0x2f84('0x56')],null))[_0x2f84('0x1f')](respondWithResult(_0x12215f,null))['catch'](handleError(_0x12215f,null));};var utilLicense=require(_0x2f84('0x19'));exports[_0x2f84('0x77')]=function(_0x3ec88e,_0x11e6fd,_0x5e5848){var _0x3e4dce='server/files/images/logos';var _0x3fe8db={'custom':![]};return utilLicense[_0x2f84('0x6f')]()[_0x2f84('0x1f')](function(_0x44da15){if(_0x44da15){_0x3fe8db=_0x44da15;}return db['Setting'][_0x2f84('0x57')]({'where':{'id':_0x3ec88e[_0x2f84('0x54')]['id']},'attributes':['logo','loginLogo',_0x2f84('0x5e'),_0x2f84('0x5f'),_0x2f84('0x60'),_0x2f84('0x61'),_0x2f84('0x62'),_0x2f84('0x63')],'raw':!![]});})[_0x2f84('0x1f')](handleEntityNotFound(_0x11e6fd,null))[_0x2f84('0x1f')](function(_0x557745){if(_0x557745){var _0x48b53c=_0x557745['favicon']&&fs[_0x2f84('0x64')](path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x3e4dce,_[_0x2f84('0x67')](_0x557745[_0x2f84('0x5f')])))?path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x3e4dce,_[_0x2f84('0x67')](_0x557745['favicon'])):path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x3e4dce,_[_0x2f84('0x67')](_0x2f84('0x78')));var _0x35ff54=_0x2f84('0x69')+_['upperFirst']('favicon');if(_0x557745[_0x35ff54]||!_0x3fe8db[_0x2f84('0x71')]){_0x48b53c=path[_0x2f84('0x65')](config[_0x2f84('0x66')],_0x3e4dce,_[_0x2f84('0x67')](_0x2f84('0x78')));}if(!fs[_0x2f84('0x64')](_0x48b53c)){throw new db[(_0x2f84('0x72'))][(_0x2f84('0x6b'))](_[_0x2f84('0x6a')](_0x2f84('0x5f'))+_0x2f84('0x6c'));}return _0x11e6fd[_0x2f84('0x6d')](_0x48b53c);}})[_0x2f84('0x27')](handleError(_0x11e6fd,null));};exports[_0x2f84('0x79')]=function(_0x2d1b15,_0x1f00d8){var _0x4ab15e={'offset':moment()[_0x2f84('0x7a')]()};_0x4ab15e['now']=moment()[_0x2f84('0x7a')](_0x4ab15e[_0x2f84('0x2c')])[_0x2f84('0x7b')](_0x2f84('0x7c'));return _0x1f00d8[_0x2f84('0x29')](0xc8)[_0x2f84('0x39')](_0x4ab15e);}; \ No newline at end of file +var _0xa26d=['join','root','toLower','default','upperFirst','custom','default_logo.svg','ValidationError','download','getLogoLogin','defaultFavicon','default_loginLogo.svg','Sequelize','gdpr','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','default_favicon.ico','getDate','now','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','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','type','query','keys','filters','attributes','intersection','fields','model','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Setting','includeAll','include','findAll','rows','show','length','find','body','params','file','filename','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','logo','existsSync'];(function(_0x281f40,_0xc703c2){var _0x2919c1=function(_0x333c13){while(--_0x333c13){_0x281f40['push'](_0x281f40['shift']());}};_0x2919c1(++_0xc703c2);}(_0xa26d,0x91));var _0xda26=function(_0x3f8084,_0xe1cb50){_0x3f8084=_0x3f8084-0x0;var _0x1a4c14=_0xa26d[_0x3f8084];return _0x1a4c14;};'use strict';var emlformat=require(_0xda26('0x0'));var rimraf=require(_0xda26('0x1'));var zipdir=require(_0xda26('0x2'));var jsonpatch=require(_0xda26('0x3'));var rp=require(_0xda26('0x4'));var moment=require(_0xda26('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xda26('0x6'));var util=require(_0xda26('0x7'));var path=require(_0xda26('0x8'));var sox=require(_0xda26('0x9'));var csv=require(_0xda26('0xa'));var ejs=require(_0xda26('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda26('0xc'));var squel=require(_0xda26('0xd'));var crypto=require(_0xda26('0xe'));var jsforce=require(_0xda26('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xda26('0xa'));var querystring=require(_0xda26('0x10'));var Papa=require(_0xda26('0x11'));var Redis=require(_0xda26('0x12'));var authService=require(_0xda26('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda26('0x14'));var logger=require(_0xda26('0x15'))('api');var utils=require(_0xda26('0x16'));var config=require(_0xda26('0x17'));var licenseUtil=require(_0xda26('0x18'));var db=require(_0xda26('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xda26('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f4f9c,_0x441621,_0x323aaf,_0x5e0a73){return new BPromise(function(_0x2e5002,_0x479469){var _0x508ae1=_0x5e0a73||client;return _0x508ae1[_0xda26('0x1b')](_0x1f4f9c,_0x323aaf)[_0xda26('0x1c')](function(_0x183a20){logger['info'](_0xda26('0x1d'),_0x441621,'request\x20sent');logger['debug'](_0xda26('0x1e'),_0x441621,_0xda26('0x1f'),JSON[_0xda26('0x20')](_0x183a20));if(_0x183a20[_0xda26('0x21')]){if(_0x183a20['error'][_0xda26('0x22')]===0x1f4){logger[_0xda26('0x21')](_0xda26('0x1d'),_0x441621,_0x183a20[_0xda26('0x21')][_0xda26('0x23')]);return _0x479469(_0x183a20[_0xda26('0x21')][_0xda26('0x23')]);}logger[_0xda26('0x21')]('Setting,\x20%s,\x20%s',_0x441621,_0x183a20[_0xda26('0x21')]['message']);return _0x2e5002(_0x183a20[_0xda26('0x21')][_0xda26('0x23')]);}else{logger[_0xda26('0x24')]('Setting,\x20%s,\x20%s',_0x441621,_0xda26('0x1f'));_0x2e5002(_0x183a20[_0xda26('0x25')][_0xda26('0x23')]);}})[_0xda26('0x26')](function(_0x44edef){logger[_0xda26('0x21')](_0xda26('0x1d'),_0x441621,_0x44edef);_0x479469(_0x44edef);});});}function respondWithStatusCode(_0x4eb6b9,_0x5555fc){_0x5555fc=_0x5555fc||0xcc;return function(_0x14855d){if(_0x14855d){return _0x4eb6b9[_0xda26('0x27')](_0x5555fc);}return _0x4eb6b9['status'](_0x5555fc)['end']();};}function respondWithResult(_0x4d83fe,_0x1b6ada){_0x1b6ada=_0x1b6ada||0xc8;return function(_0x42f6fe){if(_0x42f6fe){return _0x4d83fe[_0xda26('0x28')](_0x1b6ada)[_0xda26('0x29')](_0x42f6fe);}};}function respondWithFilteredResult(_0x285dca,_0x266529){return function(_0x223a55){if(_0x223a55){var _0x42a4f9=typeof _0x266529[_0xda26('0x2a')]===_0xda26('0x2b')&&typeof _0x266529[_0xda26('0x2c')]===_0xda26('0x2b');var _0x2c9782=_0x223a55[_0xda26('0x2d')];var _0xa60dd8=_0x42a4f9?0x0:_0x266529[_0xda26('0x2a')];var _0x2e2068=_0x42a4f9?_0x223a55[_0xda26('0x2d')]:_0x266529['offset']+_0x266529[_0xda26('0x2c')];var _0x1fc2be;if(_0x2e2068>=_0x2c9782){_0x2e2068=_0x2c9782;_0x1fc2be=0xc8;}else{_0x1fc2be=0xce;}_0x285dca[_0xda26('0x28')](_0x1fc2be);return _0x285dca[_0xda26('0x2e')](_0xda26('0x2f'),_0xa60dd8+'-'+_0x2e2068+'/'+_0x2c9782)[_0xda26('0x29')](_0x223a55);}return null;};}function patchUpdates(_0x217a2f){return function(_0x398e4b){try{jsonpatch[_0xda26('0x30')](_0x398e4b,_0x217a2f,!![]);}catch(_0x222189){return BPromise[_0xda26('0x31')](_0x222189);}return _0x398e4b[_0xda26('0x32')]();};}function saveUpdates(_0xfd3ee8,_0x3a3395){return function(_0x4ca7f3){if(_0x4ca7f3){return _0x4ca7f3[_0xda26('0x33')](_0xfd3ee8)[_0xda26('0x1c')](function(_0x31d52f){return _0x31d52f;});}return null;};}function removeEntity(_0x1f35ac,_0x17af11){return function(_0xd47abc){if(_0xd47abc){return _0xd47abc[_0xda26('0x34')]()['then'](function(){_0x1f35ac[_0xda26('0x28')](0xcc)[_0xda26('0x35')]();});}};}function handleEntityNotFound(_0x3e5ee8,_0x199e2a){return function(_0x16007d){if(!_0x16007d){_0x3e5ee8[_0xda26('0x27')](0x194);}return _0x16007d;};}function handleError(_0x45b156,_0x490dc2){_0x490dc2=_0x490dc2||0x1f4;return function(_0x39f4da){logger[_0xda26('0x21')](_0x39f4da[_0xda26('0x36')]);if(_0x39f4da[_0xda26('0x37')]){delete _0x39f4da[_0xda26('0x37')];}_0x45b156[_0xda26('0x28')](_0x490dc2)[_0xda26('0x38')](_0x39f4da);};}exports[_0xda26('0x39')]=function(_0x483a98,_0x57ac27){var _0x37e4b4={},_0x3ed11a={},_0x2926bd={'count':0x0,'rows':[]};var _0x26fa20=_[_0xda26('0x3a')](db['Setting'][_0xda26('0x3b')],function(_0x555223){return{'name':_0x555223['fieldName'],'type':_0x555223[_0xda26('0x3c')]['key']};});_0x3ed11a['model']=_[_0xda26('0x3a')](_0x26fa20,_0xda26('0x37'));_0x3ed11a[_0xda26('0x3d')]=_[_0xda26('0x3e')](_0x483a98[_0xda26('0x3d')]);_0x3ed11a[_0xda26('0x3f')]=_['intersection'](_0x3ed11a['model'],_0x3ed11a[_0xda26('0x3d')]);_0x37e4b4[_0xda26('0x40')]=_[_0xda26('0x41')](_0x3ed11a['model'],qs[_0xda26('0x42')](_0x483a98[_0xda26('0x3d')]['fields']));_0x37e4b4['attributes']=_0x37e4b4[_0xda26('0x40')]['length']?_0x37e4b4['attributes']:_0x3ed11a[_0xda26('0x43')];if(!_0x483a98['query'][_0xda26('0x44')](_0xda26('0x45'))){_0x37e4b4[_0xda26('0x2c')]=qs[_0xda26('0x2c')](_0x483a98[_0xda26('0x3d')][_0xda26('0x2c')]);_0x37e4b4['offset']=qs[_0xda26('0x2a')](_0x483a98['query']['offset']);}_0x37e4b4['order']=qs[_0xda26('0x46')](_0x483a98[_0xda26('0x3d')]['sort']);_0x37e4b4[_0xda26('0x47')]=qs[_0xda26('0x3f')](_['pick'](_0x483a98[_0xda26('0x3d')],_0x3ed11a[_0xda26('0x3f')]),_0x26fa20);if(_0x483a98[_0xda26('0x3d')][_0xda26('0x48')]){_0x37e4b4['where']=_[_0xda26('0x49')](_0x37e4b4[_0xda26('0x47')],{'$or':_[_0xda26('0x3a')](_0x26fa20,function(_0x348469){if(_0x348469['type']!==_0xda26('0x4a')){var _0x4c17e9={};_0x4c17e9[_0x348469[_0xda26('0x37')]]={'$like':'%'+_0x483a98[_0xda26('0x3d')][_0xda26('0x48')]+'%'};return _0x4c17e9;}})});}_0x37e4b4=_[_0xda26('0x49')]({},_0x37e4b4,_0x483a98[_0xda26('0x4b')]);var _0x547426={'where':_0x37e4b4[_0xda26('0x47')]};return db[_0xda26('0x4c')][_0xda26('0x2d')](_0x547426)[_0xda26('0x1c')](function(_0x324826){_0x2926bd['count']=_0x324826;if(_0x483a98[_0xda26('0x3d')][_0xda26('0x4d')]){_0x37e4b4[_0xda26('0x4e')]=[{'all':!![]}];}return db[_0xda26('0x4c')][_0xda26('0x4f')](_0x37e4b4);})[_0xda26('0x1c')](function(_0x377768){_0x2926bd[_0xda26('0x50')]=_0x377768;return _0x2926bd;})[_0xda26('0x1c')](respondWithFilteredResult(_0x57ac27,_0x37e4b4))[_0xda26('0x26')](handleError(_0x57ac27,null));};exports[_0xda26('0x51')]=function(_0x4a3a4d,_0x1bcc51){var _0x43fccb={'raw':![],'where':{'id':_0x4a3a4d['params']['id']}},_0x356375={};_0x356375[_0xda26('0x43')]=_[_0xda26('0x3e')](db[_0xda26('0x4c')]['rawAttributes']);_0x356375['query']=_[_0xda26('0x3e')](_0x4a3a4d[_0xda26('0x3d')]);_0x356375[_0xda26('0x3f')]=_['intersection'](_0x356375[_0xda26('0x43')],_0x356375[_0xda26('0x3d')]);_0x43fccb[_0xda26('0x40')]=_[_0xda26('0x41')](_0x356375['model'],qs[_0xda26('0x42')](_0x4a3a4d[_0xda26('0x3d')]['fields']));_0x43fccb[_0xda26('0x40')]=_0x43fccb[_0xda26('0x40')][_0xda26('0x52')]?_0x43fccb[_0xda26('0x40')]:_0x356375[_0xda26('0x43')];if(_0x4a3a4d[_0xda26('0x3d')][_0xda26('0x4d')]){_0x43fccb['include']=[{'all':!![]}];}_0x43fccb=_[_0xda26('0x49')]({},_0x43fccb,_0x4a3a4d[_0xda26('0x4b')]);return db[_0xda26('0x4c')][_0xda26('0x53')](_0x43fccb)[_0xda26('0x1c')](handleEntityNotFound(_0x1bcc51,null))['then'](respondWithResult(_0x1bcc51,null))[_0xda26('0x26')](handleError(_0x1bcc51,null));};exports[_0xda26('0x33')]=function(_0x59383c,_0x561f13){if(_0x59383c[_0xda26('0x54')]['id']){delete _0x59383c[_0xda26('0x54')]['id'];}return db[_0xda26('0x4c')][_0xda26('0x53')]({'where':{'id':_0x59383c[_0xda26('0x55')]['id']}})[_0xda26('0x1c')](handleEntityNotFound(_0x561f13,null))[_0xda26('0x1c')](saveUpdates(_0x59383c[_0xda26('0x54')],null))[_0xda26('0x1c')](respondWithResult(_0x561f13,null))[_0xda26('0x26')](handleError(_0x561f13,null));};exports['addLogo']=function(_0x2856d4,_0x4913f5,_0x272de4){if(_0x2856d4['file']&&_0x2856d4[_0xda26('0x56')][_0xda26('0x57')]){_0x2856d4['body']['logo']=_0x2856d4['file'][_0xda26('0x57')];}return db[_0xda26('0x4c')][_0xda26('0x53')]({'where':{'id':_0x2856d4['params']['id']}})[_0xda26('0x1c')](handleEntityNotFound(_0x4913f5,null))[_0xda26('0x1c')](saveUpdates(_0x2856d4[_0xda26('0x54')],null))[_0xda26('0x1c')](respondWithResult(_0x4913f5,null))[_0xda26('0x26')](handleError(_0x4913f5,null));};exports['addLogoLogin']=function(_0x573655,_0xd697c7,_0x94e7a3){if(_0x573655[_0xda26('0x56')]&&_0x573655[_0xda26('0x56')][_0xda26('0x57')]){_0x573655[_0xda26('0x54')][_0xda26('0x58')]=_0x573655[_0xda26('0x56')][_0xda26('0x57')];}return db['Setting'][_0xda26('0x53')]({'where':{'id':_0x573655[_0xda26('0x55')]['id']}})[_0xda26('0x1c')](handleEntityNotFound(_0xd697c7,null))[_0xda26('0x1c')](saveUpdates(_0x573655[_0xda26('0x54')],null))[_0xda26('0x1c')](respondWithResult(_0xd697c7,null))['catch'](handleError(_0xd697c7,null));};var utilLicense=require(_0xda26('0x18'));exports[_0xda26('0x59')]=function(_0x3d4668,_0x22c9e6,_0x363880){var _0x3442c2=_0xda26('0x5a');var _0x328779={'custom':![]};return utilLicense[_0xda26('0x5b')]()[_0xda26('0x1c')](function(_0x51e0){if(_0x51e0){_0x328779=_0x51e0;}return db[_0xda26('0x4c')][_0xda26('0x53')]({'where':{'id':_0x3d4668[_0xda26('0x55')]['id']},'attributes':['logo',_0xda26('0x58'),_0xda26('0x5c'),_0xda26('0x5d'),_0xda26('0x5e'),_0xda26('0x5f'),_0xda26('0x60'),'defaultFavicon'],'raw':!![]});})[_0xda26('0x1c')](handleEntityNotFound(_0x22c9e6,null))['then'](function(_0xda2f6e){if(_0xda2f6e){var _0x23d150=_0xda2f6e[_0xda26('0x61')]&&fs[_0xda26('0x62')](path[_0xda26('0x63')](config['root'],_0x3442c2,_['toLower'](_0xda2f6e[_0xda26('0x61')])))?path[_0xda26('0x63')](config[_0xda26('0x64')],_0x3442c2,_[_0xda26('0x65')](_0xda2f6e[_0xda26('0x61')])):path[_0xda26('0x63')](config[_0xda26('0x64')],_0x3442c2,_['toLower']('default_logo.svg'));var _0x31f63a=_0xda26('0x66')+_[_0xda26('0x67')](_0xda26('0x61'));if(_0xda2f6e[_0x31f63a]||!_0x328779[_0xda26('0x68')]){_0x23d150=path[_0xda26('0x63')](config[_0xda26('0x64')],_0x3442c2,_[_0xda26('0x65')](_0xda26('0x69')));}if(!fs[_0xda26('0x62')](_0x23d150)){throw new db['Sequelize'][(_0xda26('0x6a'))](_[_0xda26('0x67')](_0xda26('0x61'))+'\x20not\x20found');}return _0x22c9e6[_0xda26('0x6b')](_0x23d150);}})[_0xda26('0x26')](handleError(_0x22c9e6,null));};var utilLicense=require(_0xda26('0x18'));exports[_0xda26('0x6c')]=function(_0x2053f9,_0x4311d3,_0x4ccdaf){var _0x1c4348=_0xda26('0x5a');var _0x145d31={'custom':![]};return utilLicense[_0xda26('0x5b')]()['then'](function(_0x800946){if(_0x800946){_0x145d31=_0x800946;}return db[_0xda26('0x4c')][_0xda26('0x53')]({'where':{'id':_0x2053f9['params']['id']},'attributes':[_0xda26('0x61'),_0xda26('0x58'),_0xda26('0x5c'),_0xda26('0x5d'),_0xda26('0x5e'),_0xda26('0x5f'),_0xda26('0x60'),_0xda26('0x6d')],'raw':!![]});})[_0xda26('0x1c')](handleEntityNotFound(_0x4311d3,null))[_0xda26('0x1c')](function(_0x3e0134){if(_0x3e0134){var _0x5adb58=_0x3e0134[_0xda26('0x58')]&&fs[_0xda26('0x62')](path[_0xda26('0x63')](config['root'],_0x1c4348,_['toLower'](_0x3e0134[_0xda26('0x58')])))?path['join'](config['root'],_0x1c4348,_['toLower'](_0x3e0134[_0xda26('0x58')])):path[_0xda26('0x63')](config['root'],_0x1c4348,_[_0xda26('0x65')](_0xda26('0x6e')));var _0x19de78='default'+_[_0xda26('0x67')](_0xda26('0x58'));if(_0x3e0134[_0x19de78]||!_0x145d31[_0xda26('0x68')]){_0x5adb58=path[_0xda26('0x63')](config[_0xda26('0x64')],_0x1c4348,_[_0xda26('0x65')](_0xda26('0x6e')));}if(!fs[_0xda26('0x62')](_0x5adb58)){throw new db[(_0xda26('0x6f'))][(_0xda26('0x6a'))](_['upperFirst'](_0xda26('0x58'))+'\x20not\x20found');}return _0x4311d3[_0xda26('0x6b')](_0x5adb58);}})[_0xda26('0x26')](handleError(_0x4311d3,null));};exports[_0xda26('0x70')]=function(_0x12e1a9,_0x34c1a9){return db[_0xda26('0x4c')][_0xda26('0x53')]({'where':{'id':_0x12e1a9[_0xda26('0x55')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x34c1a9,null))[_0xda26('0x26')](handleError(_0x34c1a9,null));};exports['addPreferred']=function(_0x495fb6,_0x2c7879,_0x1a9544){if(_0x495fb6[_0xda26('0x56')]&&_0x495fb6[_0xda26('0x56')][_0xda26('0x57')]){_0x495fb6[_0xda26('0x54')][_0xda26('0x5c')]=_0x495fb6['file'][_0xda26('0x57')];}return db['Setting']['find']({'where':{'id':_0x495fb6[_0xda26('0x55')]['id']}})['then'](handleEntityNotFound(_0x2c7879,null))[_0xda26('0x1c')](saveUpdates(_0x495fb6[_0xda26('0x54')],null))[_0xda26('0x1c')](respondWithResult(_0x2c7879,null))[_0xda26('0x26')](handleError(_0x2c7879,null));};var utilLicense=require(_0xda26('0x18'));exports[_0xda26('0x71')]=function(_0x502606,_0x100457,_0x1bf7b5){var _0x5200ad=_0xda26('0x5a');var _0x5e45a8={'custom':![]};return utilLicense['getLicense']()[_0xda26('0x1c')](function(_0x31b7a3){if(_0x31b7a3){_0x5e45a8=_0x31b7a3;}return db[_0xda26('0x4c')]['find']({'where':{'id':_0x502606[_0xda26('0x55')]['id']},'attributes':[_0xda26('0x61'),_0xda26('0x58'),'preferred',_0xda26('0x5d'),'defaultLogo','defaultLoginLogo',_0xda26('0x60'),_0xda26('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x100457,null))[_0xda26('0x1c')](function(_0x20b72b){if(_0x20b72b){var _0x54f8c5=_0x20b72b[_0xda26('0x5c')]&&fs[_0xda26('0x62')](path[_0xda26('0x63')](config[_0xda26('0x64')],_0x5200ad,_['toLower'](_0x20b72b[_0xda26('0x5c')])))?path['join'](config[_0xda26('0x64')],_0x5200ad,_[_0xda26('0x65')](_0x20b72b[_0xda26('0x5c')])):path[_0xda26('0x63')](config[_0xda26('0x64')],_0x5200ad,_[_0xda26('0x65')](_0xda26('0x72')));var _0x28d7c9=_0xda26('0x66')+_[_0xda26('0x67')](_0xda26('0x5c'));if(_0x20b72b[_0x28d7c9]||!_0x5e45a8[_0xda26('0x68')]||!_0x5e45a8['preferred']){_0x54f8c5=path[_0xda26('0x63')](config[_0xda26('0x64')],_0x5200ad,_[_0xda26('0x65')](_0xda26('0x72')));}if(!fs['existsSync'](_0x54f8c5)){throw new db[(_0xda26('0x6f'))]['ValidationError'](_[_0xda26('0x67')](_0xda26('0x5c'))+_0xda26('0x73'));}return _0x100457[_0xda26('0x6b')](_0x54f8c5);}})[_0xda26('0x26')](handleError(_0x100457,null));};exports[_0xda26('0x74')]=function(_0x2f5074,_0x502af2,_0x243815){if(_0x2f5074[_0xda26('0x56')]&&_0x2f5074[_0xda26('0x56')][_0xda26('0x57')]){_0x2f5074['body'][_0xda26('0x5d')]=_0x2f5074['file'][_0xda26('0x57')];}return db[_0xda26('0x4c')]['find']({'where':{'id':_0x2f5074[_0xda26('0x55')]['id']}})[_0xda26('0x1c')](handleEntityNotFound(_0x502af2,null))[_0xda26('0x1c')](saveUpdates(_0x2f5074['body'],null))[_0xda26('0x1c')](respondWithResult(_0x502af2,null))['catch'](handleError(_0x502af2,null));};var utilLicense=require(_0xda26('0x18'));exports['getFavicon']=function(_0x17cbc4,_0x1437b2,_0xead50e){var _0x4dda56=_0xda26('0x5a');var _0x212778={'custom':![]};return utilLicense[_0xda26('0x5b')]()[_0xda26('0x1c')](function(_0x277257){if(_0x277257){_0x212778=_0x277257;}return db[_0xda26('0x4c')]['find']({'where':{'id':_0x17cbc4[_0xda26('0x55')]['id']},'attributes':['logo',_0xda26('0x58'),_0xda26('0x5c'),_0xda26('0x5d'),'defaultLogo',_0xda26('0x5f'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xda26('0x1c')](handleEntityNotFound(_0x1437b2,null))[_0xda26('0x1c')](function(_0x59f62d){if(_0x59f62d){var _0x37955b=_0x59f62d['favicon']&&fs[_0xda26('0x62')](path[_0xda26('0x63')](config['root'],_0x4dda56,_[_0xda26('0x65')](_0x59f62d[_0xda26('0x5d')])))?path[_0xda26('0x63')](config['root'],_0x4dda56,_[_0xda26('0x65')](_0x59f62d[_0xda26('0x5d')])):path[_0xda26('0x63')](config['root'],_0x4dda56,_[_0xda26('0x65')]('default_favicon.ico'));var _0x24b3d3=_0xda26('0x66')+_[_0xda26('0x67')](_0xda26('0x5d'));if(_0x59f62d[_0x24b3d3]||!_0x212778['custom']){_0x37955b=path[_0xda26('0x63')](config[_0xda26('0x64')],_0x4dda56,_[_0xda26('0x65')](_0xda26('0x75')));}if(!fs[_0xda26('0x62')](_0x37955b)){throw new db[(_0xda26('0x6f'))][(_0xda26('0x6a'))](_[_0xda26('0x67')](_0xda26('0x5d'))+'\x20not\x20found');}return _0x1437b2[_0xda26('0x6b')](_0x37955b);}})['catch'](handleError(_0x1437b2,null));};exports[_0xda26('0x76')]=function(_0x25a69d,_0x358960){var _0x340906={'offset':moment()['utcOffset']()};_0x340906[_0xda26('0x77')]=moment()['utcOffset'](_0x340906['offset'])[_0xda26('0x78')](_0xda26('0x79'));return _0x358960[_0xda26('0x28')](0xc8)['send'](_0x340906);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 9032e2a..fe892f2 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0x7217,0x19e));var _0x7721=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x7217[_0x2d8fc2];return _0x3a9e53;};'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 +var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x26a59e,_0x2dcb5f){var _0x4cec59=function(_0x2bec14){while(--_0x2bec14){_0x26a59e['push'](_0x26a59e['shift']());}};_0x4cec59(++_0x2dcb5f);}(_0x34e8,0x12c));var _0x834e=function(_0x413ae0,_0x280464){_0x413ae0=_0x413ae0-0x0;var _0x4ddfe3=_0x34e8[_0x413ae0];return _0x4ddfe3;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 12b5319..27457d2 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 _0xa0d5=['catch','ShowSetting','find','options','attributes','map','include','model','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result'];(function(_0x35e861,_0x3c50e8){var _0x3a60f6=function(_0x77c15d){while(--_0x77c15d){_0x35e861['push'](_0x35e861['shift']());}};_0x3a60f6(++_0x3c50e8);}(_0xa0d5,0x129));var _0x5a0d=function(_0x455afa,_0x235bfc){_0x455afa=_0x455afa-0x0;var _0x46ee43=_0xa0d5[_0x455afa];return _0x46ee43;};'use strict';var _=require(_0x5a0d('0x0'));var util=require('util');var moment=require(_0x5a0d('0x1'));var BPromise=require(_0x5a0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a0d('0x3'));var db=require(_0x5a0d('0x4'))['db'];var utils=require(_0x5a0d('0x5'));var logger=require(_0x5a0d('0x6'))(_0x5a0d('0x7'));var config=require(_0x5a0d('0x8'));var jayson=require(_0x5a0d('0x9'));var client=jayson[_0x5a0d('0xa')][_0x5a0d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53a2f6,_0xa76831,_0x439ff6){return new BPromise(function(_0x3038f4,_0xcfc9e0){return client[_0x5a0d('0xc')](_0x53a2f6,_0x439ff6)[_0x5a0d('0xd')](function(_0x33a2c8){logger[_0x5a0d('0xe')]('Setting,\x20%s,\x20%s',_0xa76831,_0x5a0d('0xf'));logger['debug'](_0x5a0d('0x10'),_0xa76831,_0x5a0d('0xf'),JSON[_0x5a0d('0x11')](_0x33a2c8));if(_0x33a2c8[_0x5a0d('0x12')]){if(_0x33a2c8[_0x5a0d('0x12')][_0x5a0d('0x13')]===0x1f4){logger[_0x5a0d('0x12')](_0x5a0d('0x14'),_0xa76831,_0x33a2c8['error'][_0x5a0d('0x15')]);return _0xcfc9e0(_0x33a2c8['error'][_0x5a0d('0x15')]);}logger[_0x5a0d('0x12')](_0x5a0d('0x14'),_0xa76831,_0x33a2c8[_0x5a0d('0x12')][_0x5a0d('0x15')]);return _0x3038f4(_0x33a2c8[_0x5a0d('0x12')][_0x5a0d('0x15')]);}else{logger[_0x5a0d('0xe')]('Setting,\x20%s,\x20%s',_0xa76831,_0x5a0d('0xf'));_0x3038f4(_0x33a2c8[_0x5a0d('0x16')]['message']);}})[_0x5a0d('0x17')](function(_0xae43d1){logger[_0x5a0d('0x12')](_0x5a0d('0x14'),_0xa76831,_0xae43d1);_0xcfc9e0(_0xae43d1);});});}exports[_0x5a0d('0x18')]=function(_0x173ce3){var _0x25a577=this;return new Promise(function(_0x2ea793,_0x23b313){return db['Setting'][_0x5a0d('0x19')]({'raw':_0x173ce3[_0x5a0d('0x1a')]?_0x173ce3[_0x5a0d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x173ce3['options']?_0x173ce3[_0x5a0d('0x1a')]['where']||null:null,'attributes':_0x173ce3[_0x5a0d('0x1a')]?_0x173ce3[_0x5a0d('0x1a')][_0x5a0d('0x1b')]||null:null,'include':_0x173ce3[_0x5a0d('0x1a')]?_0x173ce3[_0x5a0d('0x1a')]['include']?_[_0x5a0d('0x1c')](_0x173ce3[_0x5a0d('0x1a')][_0x5a0d('0x1d')],function(_0xc9fc32){return{'model':db[_0xc9fc32[_0x5a0d('0x1e')]],'as':_0xc9fc32['as'],'attributes':_0xc9fc32[_0x5a0d('0x1b')],'include':_0xc9fc32['include']?_[_0x5a0d('0x1c')](_0xc9fc32[_0x5a0d('0x1d')],function(_0x8f53ec){return{'model':db[_0x8f53ec[_0x5a0d('0x1e')]],'as':_0x8f53ec['as'],'attributes':_0x8f53ec['attributes'],'include':_0x8f53ec['include']?_['map'](_0x8f53ec[_0x5a0d('0x1d')],function(_0x3757c4){return{'model':db[_0x3757c4[_0x5a0d('0x1e')]],'as':_0x3757c4['as'],'attributes':_0x3757c4[_0x5a0d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5a0d('0xd')](function(_0x534f04){logger[_0x5a0d('0xe')](_0x5a0d('0x18'),_0x173ce3);logger[_0x5a0d('0x1f')]('ShowSetting',_0x173ce3,JSON[_0x5a0d('0x11')](_0x534f04));_0x2ea793(_0x534f04);})[_0x5a0d('0x17')](function(_0x2a5197){logger[_0x5a0d('0x12')](_0x5a0d('0x18'),_0x2a5197[_0x5a0d('0x15')],_0x173ce3);_0x23b313(_0x25a577['error'](0x1f4,_0x2a5197['message']));});});}; \ No newline at end of file +var _0x3b92=['stringify','error','Setting,\x20%s,\x20%s','message','result','ShowSetting','find','options','where','attributes','include','map','model','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x13aea5,_0x529e7a){var _0x1b4b7c=function(_0x525100){while(--_0x525100){_0x13aea5['push'](_0x13aea5['shift']());}};_0x1b4b7c(++_0x529e7a);}(_0x3b92,0x1ee));var _0x23b9=function(_0x4b4985,_0x270541){_0x4b4985=_0x4b4985-0x0;var _0x51a710=_0x3b92[_0x4b4985];return _0x51a710;};'use strict';var _=require('lodash');var util=require(_0x23b9('0x0'));var moment=require(_0x23b9('0x1'));var BPromise=require(_0x23b9('0x2'));var rs=require(_0x23b9('0x3'));var fs=require('fs');var Redis=require(_0x23b9('0x4'));var db=require(_0x23b9('0x5'))['db'];var utils=require(_0x23b9('0x6'));var logger=require(_0x23b9('0x7'))(_0x23b9('0x8'));var config=require(_0x23b9('0x9'));var jayson=require(_0x23b9('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18f243,_0x519396,_0x326d2a){return new BPromise(function(_0x26cd0e,_0x5be2d4){return client[_0x23b9('0xb')](_0x18f243,_0x326d2a)[_0x23b9('0xc')](function(_0x54fc98){logger[_0x23b9('0xd')]('Setting,\x20%s,\x20%s',_0x519396,_0x23b9('0xe'));logger['debug'](_0x23b9('0xf'),_0x519396,_0x23b9('0xe'),JSON[_0x23b9('0x10')](_0x54fc98));if(_0x54fc98[_0x23b9('0x11')]){if(_0x54fc98[_0x23b9('0x11')]['code']===0x1f4){logger[_0x23b9('0x11')](_0x23b9('0x12'),_0x519396,_0x54fc98[_0x23b9('0x11')][_0x23b9('0x13')]);return _0x5be2d4(_0x54fc98[_0x23b9('0x11')][_0x23b9('0x13')]);}logger['error']('Setting,\x20%s,\x20%s',_0x519396,_0x54fc98[_0x23b9('0x11')]['message']);return _0x26cd0e(_0x54fc98[_0x23b9('0x11')][_0x23b9('0x13')]);}else{logger[_0x23b9('0xd')](_0x23b9('0x12'),_0x519396,'request\x20sent');_0x26cd0e(_0x54fc98[_0x23b9('0x14')][_0x23b9('0x13')]);}})['catch'](function(_0x810a86){logger['error'](_0x23b9('0x12'),_0x519396,_0x810a86);_0x5be2d4(_0x810a86);});});}exports[_0x23b9('0x15')]=function(_0x44f015){var _0x5412cd=this;return new Promise(function(_0x5b3873,_0x852052){return db['Setting'][_0x23b9('0x16')]({'raw':_0x44f015[_0x23b9('0x17')]?_0x44f015['options']['raw']===undefined?!![]:![]:!![],'where':_0x44f015[_0x23b9('0x17')]?_0x44f015['options'][_0x23b9('0x18')]||null:null,'attributes':_0x44f015[_0x23b9('0x17')]?_0x44f015[_0x23b9('0x17')][_0x23b9('0x19')]||null:null,'include':_0x44f015[_0x23b9('0x17')]?_0x44f015['options'][_0x23b9('0x1a')]?_[_0x23b9('0x1b')](_0x44f015[_0x23b9('0x17')][_0x23b9('0x1a')],function(_0x23dcfb){return{'model':db[_0x23dcfb[_0x23b9('0x1c')]],'as':_0x23dcfb['as'],'attributes':_0x23dcfb[_0x23b9('0x19')],'include':_0x23dcfb[_0x23b9('0x1a')]?_[_0x23b9('0x1b')](_0x23dcfb[_0x23b9('0x1a')],function(_0x36b0fc){return{'model':db[_0x36b0fc['model']],'as':_0x36b0fc['as'],'attributes':_0x36b0fc[_0x23b9('0x19')],'include':_0x36b0fc[_0x23b9('0x1a')]?_[_0x23b9('0x1b')](_0x36b0fc[_0x23b9('0x1a')],function(_0x95edca){return{'model':db[_0x95edca[_0x23b9('0x1c')]],'as':_0x95edca['as'],'attributes':_0x95edca['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5812ba){logger[_0x23b9('0xd')](_0x23b9('0x15'),_0x44f015);logger['debug'](_0x23b9('0x15'),_0x44f015,JSON[_0x23b9('0x10')](_0x5812ba));_0x5b3873(_0x5812ba);})[_0x23b9('0x1d')](function(_0x3f72d9){logger[_0x23b9('0x11')]('ShowSetting',_0x3f72d9[_0x23b9('0x13')],_0x44f015);_0x852052(_0x5412cd[_0x23b9('0x11')](0x1f4,_0x3f72d9[_0x23b9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 226b67d..7371c2e 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 _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x4472ad,_0x2d9107){var _0x3912e1=function(_0x15f41b){while(--_0x15f41b){_0x4472ad['push'](_0x4472ad['shift']());}};_0x3912e1(++_0x2d9107);}(_0x6aa7,0x178));var _0x76aa=function(_0x106889,_0x47fda6){_0x106889=_0x106889-0x0;var _0x3bf3b5=_0x6aa7[_0x106889];return _0x3bf3b5;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file +var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x4b10e5,_0x4395d1){var _0x529f70=function(_0x1b2e3b){while(--_0x1b2e3b){_0x4b10e5['push'](_0x4b10e5['shift']());}};_0x529f70(++_0x4395d1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 932d6e7..305a115 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 _0xf1a8=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate','ENUM','twilio','connectel','clicksend','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x1cac0c,_0x292bb7){var _0x1a96f9=function(_0x5a979e){while(--_0x5a979e){_0x1cac0c['push'](_0x1cac0c['shift']());}};_0x1a96f9(++_0x292bb7);}(_0xf1a8,0x1ba));var _0x8f1a=function(_0x1025c0,_0x3f0c2f){_0x1025c0=_0x1025c0-0x0;var _0x1333ed=_0xf1a8[_0x1025c0];return _0x1333ed;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x8f1a('0x0'));module['exports']={'name':{'type':Sequelize[_0x8f1a('0x1')],'unique':_0x8f1a('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x8f1a('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x8f1a('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x8f1a('0x1')],'defaultValue':function(){return rs[_0x8f1a('0x3')]();}},'phone':{'type':Sequelize[_0x8f1a('0x1')]},'type':{'type':Sequelize[_0x8f1a('0x4')](_0x8f1a('0x5'),'skebby',_0x8f1a('0x6'),_0x8f1a('0x7'),'plivo','clickatell','bandwidth',_0x8f1a('0x8'),_0x8f1a('0x9'),_0x8f1a('0xa'))},'accountSid':{'type':Sequelize[_0x8f1a('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x8f1a('0x1')]},'password':{'type':Sequelize[_0x8f1a('0x1')]},'apiKey':{'type':Sequelize[_0x8f1a('0x1')]},'applicationId':{'type':Sequelize[_0x8f1a('0x1')]},'accountId':{'type':Sequelize[_0x8f1a('0x1')]},'senderString':{'type':Sequelize[_0x8f1a('0x1')]},'deliveryReport':{'type':Sequelize[_0x8f1a('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8f1a('0xc')],'defaultValue':function(){return _0x8f1a('0xd');}},'notificationSound':{'type':Sequelize[_0x8f1a('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8f1a('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8f1a('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8f1a('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8f1a('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8f1a('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8f1a('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8f1a('0xe')],'comment':_0x8f1a('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x8f1a('0xb')],'defaultValue':![],'comment':_0x8f1a('0x10'),'set':function(_0x5e6a7a){if(!_0x5e6a7a)this['setDataValue'](_0x8f1a('0x11'),null);this['setDataValue'](_0x8f1a('0x12'),_0x5e6a7a);}}}; \ No newline at end of file +var _0x6965=['clickatell','bandwidth','csc','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','name','generate','ENUM','skebby','clicksend','plivo'];(function(_0x2a296b,_0x27007d){var _0x4e4354=function(_0x33f7c7){while(--_0x33f7c7){_0x2a296b['push'](_0x2a296b['shift']());}};_0x4e4354(++_0x27007d);}(_0x6965,0xce));var _0x5696=function(_0x4d0e94,_0x4e89f3){_0x4d0e94=_0x4d0e94-0x0;var _0x188590=_0x6965[_0x4d0e94];return _0x188590;};'use strict';var Sequelize=require(_0x5696('0x0'));var rs=require(_0x5696('0x1'));module[_0x5696('0x2')]={'name':{'type':Sequelize[_0x5696('0x3')],'unique':_0x5696('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x5696('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x5696('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5696('0x5')]();}},'phone':{'type':Sequelize[_0x5696('0x3')]},'type':{'type':Sequelize[_0x5696('0x6')]('twilio',_0x5696('0x7'),'connectel',_0x5696('0x8'),_0x5696('0x9'),_0x5696('0xa'),_0x5696('0xb'),_0x5696('0xc'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x5696('0x3')]},'authId':{'type':Sequelize[_0x5696('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x5696('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x5696('0x3')]},'password':{'type':Sequelize[_0x5696('0x3')]},'apiKey':{'type':Sequelize[_0x5696('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x5696('0x3')]},'senderString':{'type':Sequelize[_0x5696('0x3')]},'deliveryReport':{'type':Sequelize[_0x5696('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5696('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5696('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5696('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5696('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5696('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5696('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5696('0xe')],'comment':_0x5696('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x5696('0xd')],'defaultValue':![],'comment':_0x5696('0x10'),'set':function(_0x397402){if(!_0x397402)this[_0x5696('0x11')]('mandatoryDispositionPauseId',null);this[_0x5696('0x11')]('mandatoryDisposition',_0x397402);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c5f3ad7..8f56789 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 _0x4dd5=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','request\x20sent','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','SmsAccounts','UserProfileResource','destroy','name','send','index','Pause','SmsAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','map','type','options','includeAll','findAll','show','params','mandatoryDispositionPause','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','autoAssociation','describe','Disposition','findOne','hasOwnProperty','pick','include','rows','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','nolimit','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','status_code','infobip','groupName','DELIVERED','intelepeer','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','userSmsAccount:save','removeAgents','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','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','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','info'];(function(_0x52b649,_0x548706){var _0x1e82a2=function(_0x5da202){while(--_0x5da202){_0x52b649['push'](_0x52b649['shift']());}};_0x1e82a2(++_0x548706);}(_0x4dd5,0x1a1));var _0x54dd=function(_0x2d8d65,_0x4db2c0){_0x2d8d65=_0x2d8d65-0x0;var _0x434585=_0x4dd5[_0x2d8d65];return _0x434585;};'use strict';var emlformat=require(_0x54dd('0x0'));var rimraf=require(_0x54dd('0x1'));var zipdir=require(_0x54dd('0x2'));var jsonpatch=require(_0x54dd('0x3'));var rp=require('request-promise');var moment=require(_0x54dd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x54dd('0x5'));var util=require(_0x54dd('0x6'));var path=require(_0x54dd('0x7'));var sox=require(_0x54dd('0x8'));var csv=require(_0x54dd('0x9'));var ejs=require(_0x54dd('0xa'));var fs=require('fs');var fs_extra=require(_0x54dd('0xb'));var _=require('lodash');var squel=require(_0x54dd('0xc'));var crypto=require(_0x54dd('0xd'));var jsforce=require(_0x54dd('0xe'));var deskjs=require(_0x54dd('0xf'));var toCsv=require(_0x54dd('0x9'));var querystring=require(_0x54dd('0x10'));var Papa=require(_0x54dd('0x11'));var Redis=require(_0x54dd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x54dd('0x13'));var as=require(_0x54dd('0x14'));var hardwareService=require(_0x54dd('0x15'));var logger=require(_0x54dd('0x16'))(_0x54dd('0x17'));var utils=require(_0x54dd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x54dd('0x19'));var db=require(_0x54dd('0x1a'))['db'];config[_0x54dd('0x1b')]=_[_0x54dd('0x1c')](config[_0x54dd('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x54dd('0x1d'))(new Redis(config[_0x54dd('0x1b')]));require(_0x54dd('0x1e'))[_0x54dd('0x1f')](socket);var jayson=require(_0x54dd('0x20'));var client=jayson['client'][_0x54dd('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x1987df,_0x3b99ce,_0x111580,_0x16173a){return new BPromise(function(_0x20bc63,_0x467242){var _0x54a20b=_0x16173a||client;return _0x54a20b[_0x54dd('0x22')](_0x1987df,_0x111580)[_0x54dd('0x23')](function(_0x5410c0){logger[_0x54dd('0x24')]('SmsAccount,\x20%s,\x20%s',_0x3b99ce,'request\x20sent');logger[_0x54dd('0x25')](_0x54dd('0x26'),_0x3b99ce,'request\x20sent',JSON[_0x54dd('0x27')](_0x5410c0));if(_0x5410c0[_0x54dd('0x28')]){if(_0x5410c0[_0x54dd('0x28')][_0x54dd('0x29')]===0x1f4){logger['error'](_0x54dd('0x2a'),_0x3b99ce,_0x5410c0[_0x54dd('0x28')]['message']);return _0x467242(_0x5410c0[_0x54dd('0x28')][_0x54dd('0x2b')]);}logger['error'](_0x54dd('0x2a'),_0x3b99ce,_0x5410c0[_0x54dd('0x28')][_0x54dd('0x2b')]);return _0x20bc63(_0x5410c0[_0x54dd('0x28')][_0x54dd('0x2b')]);}else{logger[_0x54dd('0x24')](_0x54dd('0x2a'),_0x3b99ce,_0x54dd('0x2c'));_0x20bc63(_0x5410c0['result'][_0x54dd('0x2b')]);}})['catch'](function(_0x5c5c20){logger['error'](_0x54dd('0x2a'),_0x3b99ce,_0x5c5c20);_0x467242(_0x5c5c20);});});}function respondWithStatusCode(_0x2e7285,_0x407796){_0x407796=_0x407796||0xcc;return function(_0x225ad){if(_0x225ad){return _0x2e7285[_0x54dd('0x2d')](_0x407796);}return _0x2e7285[_0x54dd('0x2e')](_0x407796)['end']();};}function respondWithResult(_0x2bc0cf,_0x11169b){_0x11169b=_0x11169b||0xc8;return function(_0x208040){if(_0x208040){return _0x2bc0cf['status'](_0x11169b)[_0x54dd('0x2f')](_0x208040);}};}function respondWithFilteredResult(_0x195241,_0x56f07d){return function(_0x475054){if(_0x475054){var _0xb5204e=typeof _0x56f07d[_0x54dd('0x30')]===_0x54dd('0x31')&&typeof _0x56f07d[_0x54dd('0x32')]===_0x54dd('0x31');var _0x413915=_0x475054[_0x54dd('0x33')];var _0x341c35=_0xb5204e?0x0:_0x56f07d['offset'];var _0x3b6bcd=_0xb5204e?_0x475054['count']:_0x56f07d['offset']+_0x56f07d[_0x54dd('0x32')];var _0x30f86f;if(_0x3b6bcd>=_0x413915){_0x3b6bcd=_0x413915;_0x30f86f=0xc8;}else{_0x30f86f=0xce;}_0x195241['status'](_0x30f86f);return _0x195241[_0x54dd('0x34')]('Content-Range',_0x341c35+'-'+_0x3b6bcd+'/'+_0x413915)[_0x54dd('0x2f')](_0x475054);}return null;};}function patchUpdates(_0x5740a1){return function(_0x175b3e){try{jsonpatch[_0x54dd('0x35')](_0x175b3e,_0x5740a1,!![]);}catch(_0x4f3fd3){return BPromise['reject'](_0x4f3fd3);}return _0x175b3e[_0x54dd('0x36')]();};}function saveUpdates(_0x413d77,_0x194019){return function(_0x883fa7){if(_0x883fa7){return _0x883fa7[_0x54dd('0x37')](_0x413d77)['then'](function(_0x324913){return _0x324913;});}return null;};}function removeEntity(_0x582ba5,_0x249a2d){return function(_0x58132a){if(_0x58132a){return _0x58132a['destroy']()[_0x54dd('0x23')](function(){var _0x8c6075=_0x58132a['get']({'plain':!![]});var _0x6bd984=_0x54dd('0x38');return db[_0x54dd('0x39')][_0x54dd('0x3a')]({'where':{'type':_0x6bd984,'resourceId':_0x8c6075['id']}})[_0x54dd('0x23')](function(){return _0x58132a;});})[_0x54dd('0x23')](function(){_0x582ba5[_0x54dd('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x488b02,_0x288ff6){return function(_0x487bdc){if(!_0x487bdc){_0x488b02['sendStatus'](0x194);}return _0x487bdc;};}function handleError(_0x3ba80e,_0x2cb029){_0x2cb029=_0x2cb029||0x1f4;return function(_0x3286cc){logger[_0x54dd('0x28')](_0x3286cc['stack']);if(_0x3286cc[_0x54dd('0x3b')]){delete _0x3286cc[_0x54dd('0x3b')];}_0x3ba80e[_0x54dd('0x2e')](_0x2cb029)[_0x54dd('0x3c')](_0x3286cc);};}exports[_0x54dd('0x3d')]=function(_0x58a065,_0xefb870){var _0x315a5e={'include':[{'model':db[_0x54dd('0x3e')],'as':'mandatoryDispositionPause'}]},_0x481451={},_0x4a694e={'count':0x0,'rows':[]};var _0x46aec2=_['map'](db[_0x54dd('0x3f')][_0x54dd('0x40')],function(_0x3dd31c){return{'name':_0x3dd31c['fieldName'],'type':_0x3dd31c['type'][_0x54dd('0x41')]};});_0x481451[_0x54dd('0x42')]=_['map'](_0x46aec2,'name');_0x481451[_0x54dd('0x43')]=_[_0x54dd('0x44')](_0x58a065[_0x54dd('0x43')]);_0x481451[_0x54dd('0x45')]=_[_0x54dd('0x46')](_0x481451[_0x54dd('0x42')],_0x481451[_0x54dd('0x43')]);_0x315a5e[_0x54dd('0x47')]=_[_0x54dd('0x46')](_0x481451['model'],qs[_0x54dd('0x48')](_0x58a065[_0x54dd('0x43')][_0x54dd('0x48')]));_0x315a5e[_0x54dd('0x47')]=_0x315a5e[_0x54dd('0x47')][_0x54dd('0x49')]?_0x315a5e[_0x54dd('0x47')]:_0x481451[_0x54dd('0x42')];if(!_0x58a065[_0x54dd('0x43')]['hasOwnProperty']('nolimit')){_0x315a5e['limit']=qs[_0x54dd('0x32')](_0x58a065[_0x54dd('0x43')][_0x54dd('0x32')]);_0x315a5e['offset']=qs[_0x54dd('0x30')](_0x58a065[_0x54dd('0x43')][_0x54dd('0x30')]);}_0x315a5e[_0x54dd('0x4a')]=qs[_0x54dd('0x4b')](_0x58a065[_0x54dd('0x43')][_0x54dd('0x4b')]);_0x315a5e[_0x54dd('0x4c')]=qs[_0x54dd('0x45')](_['pick'](_0x58a065[_0x54dd('0x43')],_0x481451[_0x54dd('0x45')]),_0x46aec2);if(_0x58a065[_0x54dd('0x43')][_0x54dd('0x4d')]){_0x315a5e['where']=_[_0x54dd('0x4e')](_0x315a5e[_0x54dd('0x4c')],{'$or':_[_0x54dd('0x4f')](_0x46aec2,function(_0x171cca){if(_0x171cca[_0x54dd('0x50')]!=='VIRTUAL'){var _0x3f6d1e={};_0x3f6d1e[_0x171cca[_0x54dd('0x3b')]]={'$like':'%'+_0x58a065[_0x54dd('0x43')][_0x54dd('0x4d')]+'%'};return _0x3f6d1e;}})});}_0x315a5e=_[_0x54dd('0x4e')]({},_0x315a5e,_0x58a065[_0x54dd('0x51')]);var _0x241341={'where':_0x315a5e[_0x54dd('0x4c')]};return db['SmsAccount'][_0x54dd('0x33')](_0x241341)['then'](function(_0x3a5e7b){_0x4a694e[_0x54dd('0x33')]=_0x3a5e7b;if(_0x58a065[_0x54dd('0x43')][_0x54dd('0x52')]){_0x315a5e['include']=[{'all':!![]}];}return db[_0x54dd('0x3f')][_0x54dd('0x53')](_0x315a5e);})[_0x54dd('0x23')](function(_0xd28c78){_0x4a694e['rows']=_0xd28c78;return _0x4a694e;})['then'](respondWithFilteredResult(_0xefb870,_0x315a5e))['catch'](handleError(_0xefb870,null));};exports[_0x54dd('0x54')]=function(_0xfaaf57,_0x2609f0){var _0x1a1cb3={'raw':![],'where':{'id':_0xfaaf57[_0x54dd('0x55')]['id']},'include':[{'model':db[_0x54dd('0x3e')],'as':_0x54dd('0x56')}]},_0x42dce8={};_0x42dce8[_0x54dd('0x42')]=_['keys'](db[_0x54dd('0x3f')][_0x54dd('0x40')]);_0x42dce8['query']=_[_0x54dd('0x44')](_0xfaaf57[_0x54dd('0x43')]);_0x42dce8[_0x54dd('0x45')]=_[_0x54dd('0x46')](_0x42dce8['model'],_0x42dce8[_0x54dd('0x43')]);_0x1a1cb3[_0x54dd('0x47')]=_['intersection'](_0x42dce8[_0x54dd('0x42')],qs[_0x54dd('0x48')](_0xfaaf57[_0x54dd('0x43')][_0x54dd('0x48')]));_0x1a1cb3[_0x54dd('0x47')]=_0x1a1cb3[_0x54dd('0x47')][_0x54dd('0x49')]?_0x1a1cb3['attributes']:_0x42dce8['model'];if(_0xfaaf57[_0x54dd('0x43')][_0x54dd('0x52')]){_0x1a1cb3['include']=[{'all':!![]}];}_0x1a1cb3=_[_0x54dd('0x4e')]({},_0x1a1cb3,_0xfaaf57[_0x54dd('0x51')]);return db[_0x54dd('0x3f')][_0x54dd('0x57')](_0x1a1cb3)[_0x54dd('0x23')](handleEntityNotFound(_0x2609f0,null))[_0x54dd('0x23')](respondWithResult(_0x2609f0,null))[_0x54dd('0x58')](handleError(_0x2609f0,null));};exports[_0x54dd('0x59')]=function(_0x14ae27,_0x1c7777){return db[_0x54dd('0x3f')][_0x54dd('0x59')](_0x14ae27[_0x54dd('0x5a')],{})[_0x54dd('0x23')](function(_0xf63a68){var _0x386743=_0x14ae27['user']['get']({'plain':!![]});if(!_0x386743)throw new Error(_0x54dd('0x5b'));if(_0x386743[_0x54dd('0x5c')]===_0x54dd('0x5d')){var _0x555cf4=_0xf63a68[_0x54dd('0x5e')]({'plain':!![]});var _0x104adf='SmsAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x104adf,'userProfileId':_0x386743['userProfileId']},'raw':!![]})[_0x54dd('0x23')](function(_0x137dd8){if(_0x137dd8&&_0x137dd8[_0x54dd('0x5f')]===0x0){return db['UserProfileResource'][_0x54dd('0x59')]({'name':_0x555cf4[_0x54dd('0x3b')],'resourceId':_0x555cf4['id'],'type':_0x137dd8[_0x54dd('0x3b')],'sectionId':_0x137dd8['id']},{})[_0x54dd('0x23')](function(){return _0xf63a68;});}else{return _0xf63a68;}})[_0x54dd('0x58')](function(_0x3fce53){logger[_0x54dd('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fce53);throw _0x3fce53;});}return _0xf63a68;})[_0x54dd('0x23')](respondWithResult(_0x1c7777,0xc9))[_0x54dd('0x58')](handleError(_0x1c7777,null));};exports[_0x54dd('0x37')]=function(_0x2273e2,_0x274faa){if(_0x2273e2[_0x54dd('0x5a')]['id']){delete _0x2273e2[_0x54dd('0x5a')]['id'];}return db['SmsAccount'][_0x54dd('0x57')]({'where':{'id':_0x2273e2[_0x54dd('0x55')]['id']},'include':[{'model':db[_0x54dd('0x3e')],'as':_0x54dd('0x56')}]})[_0x54dd('0x23')](handleEntityNotFound(_0x274faa,null))[_0x54dd('0x23')](saveUpdates(_0x2273e2['body'],null))['then'](respondWithResult(_0x274faa,null))[_0x54dd('0x58')](handleError(_0x274faa,null));};exports[_0x54dd('0x3a')]=function(_0x6fc771,_0x393578){return db[_0x54dd('0x3f')][_0x54dd('0x57')]({'where':{'id':_0x6fc771[_0x54dd('0x55')]['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x393578,null))[_0x54dd('0x23')](removeEntity(_0x393578,null))[_0x54dd('0x58')](handleError(_0x393578,null));};exports['describe']=function(_0x488252,_0x1000c9){return db[_0x54dd('0x3f')][_0x54dd('0x60')]()[_0x54dd('0x23')](respondWithResult(_0x1000c9,null))[_0x54dd('0x58')](handleError(_0x1000c9,null));};exports['addDisposition']=function(_0x32f1f9,_0x5cd6f6,_0x5528bb){if(_0x32f1f9[_0x54dd('0x5a')]['id']){delete _0x32f1f9[_0x54dd('0x5a')]['id'];}return db[_0x54dd('0x3f')][_0x54dd('0x57')]({'where':{'id':_0x32f1f9[_0x54dd('0x55')]['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x5cd6f6,null))[_0x54dd('0x23')](function(_0x27e23e){if(_0x27e23e){_0x32f1f9[_0x54dd('0x5a')]['SmsAccountId']=_0x27e23e['id'];return db[_0x54dd('0x61')]['create'](_0x32f1f9[_0x54dd('0x5a')]);}})[_0x54dd('0x23')](respondWithResult(_0x5cd6f6,null))['catch'](handleError(_0x5cd6f6,null));};exports['getDispositions']=function(_0x1d9f93,_0x337266,_0x28f711){var _0xceec0d={'raw':![],'where':{}};var _0x353ffd={};var _0x1e1da9={'count':0x0,'rows':[]};return db[_0x54dd('0x3f')][_0x54dd('0x62')]({'where':{'id':_0x1d9f93[_0x54dd('0x55')]['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x337266,null))['then'](function(_0x31d2f0){if(_0x31d2f0){_0x353ffd[_0x54dd('0x42')]=_[_0x54dd('0x44')](db['Disposition']['rawAttributes']);_0x353ffd[_0x54dd('0x43')]=_[_0x54dd('0x44')](_0x1d9f93[_0x54dd('0x43')]);_0x353ffd[_0x54dd('0x45')]=_[_0x54dd('0x46')](_0x353ffd[_0x54dd('0x42')],_0x353ffd[_0x54dd('0x43')]);_0xceec0d[_0x54dd('0x47')]=_[_0x54dd('0x46')](_0x353ffd[_0x54dd('0x42')],qs[_0x54dd('0x48')](_0x1d9f93[_0x54dd('0x43')][_0x54dd('0x48')]));_0xceec0d[_0x54dd('0x47')]=_0xceec0d['attributes'][_0x54dd('0x49')]?_0xceec0d[_0x54dd('0x47')]:_0x353ffd[_0x54dd('0x42')];if(!_0x1d9f93[_0x54dd('0x43')][_0x54dd('0x63')]('nolimit')){_0xceec0d['limit']=qs[_0x54dd('0x32')](_0x1d9f93['query'][_0x54dd('0x32')]);_0xceec0d[_0x54dd('0x30')]=qs['offset'](_0x1d9f93[_0x54dd('0x43')][_0x54dd('0x30')]);}_0xceec0d[_0x54dd('0x4a')]=qs[_0x54dd('0x4b')](_0x1d9f93[_0x54dd('0x43')][_0x54dd('0x4b')]);_0xceec0d['where']=qs['filters'](_[_0x54dd('0x64')](_0x1d9f93[_0x54dd('0x43')],_0x353ffd[_0x54dd('0x45')]));_0xceec0d[_0x54dd('0x4c')]['SmsAccountId']=_0x31d2f0['id'];if(_0x1d9f93[_0x54dd('0x43')][_0x54dd('0x4d')]){_0xceec0d[_0x54dd('0x4c')]=_[_0x54dd('0x4e')](_0xceec0d['where'],{'$or':_[_0x54dd('0x4f')](_0xceec0d['attributes'],function(_0x1b14bf){var _0x4d2df7={};_0x4d2df7[_0x1b14bf]={'$like':'%'+_0x1d9f93[_0x54dd('0x43')]['filter']+'%'};return _0x4d2df7;})});}_0xceec0d=_['merge']({},_0xceec0d,_0x1d9f93[_0x54dd('0x51')]);return db['Disposition'][_0x54dd('0x33')]({'where':_0xceec0d[_0x54dd('0x4c')]})[_0x54dd('0x23')](function(_0x28ed86){_0x1e1da9['count']=_0x28ed86;if(_0x1d9f93[_0x54dd('0x43')]['includeAll']){_0xceec0d[_0x54dd('0x65')]=[{'all':!![]}];}return db[_0x54dd('0x61')][_0x54dd('0x53')](_0xceec0d);})[_0x54dd('0x23')](function(_0xe30922){_0x1e1da9[_0x54dd('0x66')]=_0xe30922;return _0x1e1da9;});}})[_0x54dd('0x23')](respondWithFilteredResult(_0x337266,_0xceec0d))[_0x54dd('0x58')](handleError(_0x337266,null));};exports[_0x54dd('0x67')]=function(_0x22c248,_0x2dd3cf,_0x36f6d3){return db[_0x54dd('0x3f')]['find']({'where':{'id':_0x22c248['params']['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x2dd3cf,null))[_0x54dd('0x23')](function(_0x2d738c){if(_0x2d738c){return _0x2d738c[_0x54dd('0x67')](_0x22c248[_0x54dd('0x43')][_0x54dd('0x68')]);}})[_0x54dd('0x23')](respondWithStatusCode(_0x2dd3cf,null))['catch'](handleError(_0x2dd3cf,null));};exports[_0x54dd('0x69')]=function(_0x1668a6,_0x2cc62f,_0x21eec5){if(_0x1668a6[_0x54dd('0x5a')]['id']){delete _0x1668a6[_0x54dd('0x5a')]['id'];}return db['SmsAccount'][_0x54dd('0x57')]({'where':{'id':_0x1668a6[_0x54dd('0x55')]['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x2cc62f,null))[_0x54dd('0x23')](function(_0x1fba33){if(_0x1fba33){_0x1668a6[_0x54dd('0x5a')][_0x54dd('0x6a')]=_0x1fba33['id'];return db['CannedAnswer'][_0x54dd('0x59')](_0x1668a6[_0x54dd('0x5a')]);}})[_0x54dd('0x23')](respondWithResult(_0x2cc62f,null))['catch'](handleError(_0x2cc62f,null));};exports['getAnswers']=function(_0x4bb6f1,_0x2c26b3,_0x1d8b2b){var _0xba2790={'raw':![],'where':{}};var _0x5a7bf4={};var _0x4476e3={'count':0x0,'rows':[]};return db[_0x54dd('0x3f')][_0x54dd('0x62')]({'where':{'id':_0x4bb6f1[_0x54dd('0x55')]['id']}})['then'](handleEntityNotFound(_0x2c26b3,null))[_0x54dd('0x23')](function(_0x1cfb15){if(_0x1cfb15){_0x5a7bf4[_0x54dd('0x42')]=_[_0x54dd('0x44')](db[_0x54dd('0x6b')][_0x54dd('0x40')]);_0x5a7bf4[_0x54dd('0x43')]=_['keys'](_0x4bb6f1[_0x54dd('0x43')]);_0x5a7bf4[_0x54dd('0x45')]=_[_0x54dd('0x46')](_0x5a7bf4[_0x54dd('0x42')],_0x5a7bf4[_0x54dd('0x43')]);_0xba2790[_0x54dd('0x47')]=_['intersection'](_0x5a7bf4[_0x54dd('0x42')],qs['fields'](_0x4bb6f1[_0x54dd('0x43')]['fields']));_0xba2790[_0x54dd('0x47')]=_0xba2790[_0x54dd('0x47')][_0x54dd('0x49')]?_0xba2790[_0x54dd('0x47')]:_0x5a7bf4['model'];if(!_0x4bb6f1['query'][_0x54dd('0x63')](_0x54dd('0x6c'))){_0xba2790[_0x54dd('0x32')]=qs['limit'](_0x4bb6f1['query']['limit']);_0xba2790[_0x54dd('0x30')]=qs[_0x54dd('0x30')](_0x4bb6f1[_0x54dd('0x43')]['offset']);}_0xba2790['order']=qs[_0x54dd('0x4b')](_0x4bb6f1[_0x54dd('0x43')][_0x54dd('0x4b')]);_0xba2790['where']=qs[_0x54dd('0x45')](_[_0x54dd('0x64')](_0x4bb6f1[_0x54dd('0x43')],_0x5a7bf4['filters']));_0xba2790['where']['SmsAccountId']=_0x1cfb15['id'];if(_0x4bb6f1['query'][_0x54dd('0x4d')]){_0xba2790[_0x54dd('0x4c')]=_[_0x54dd('0x4e')](_0xba2790[_0x54dd('0x4c')],{'$or':_[_0x54dd('0x4f')](_0xba2790[_0x54dd('0x47')],function(_0xf0ec36){var _0x4d237d={};_0x4d237d[_0xf0ec36]={'$like':'%'+_0x4bb6f1['query']['filter']+'%'};return _0x4d237d;})});}_0xba2790=_[_0x54dd('0x4e')]({},_0xba2790,_0x4bb6f1['options']);return db[_0x54dd('0x6b')][_0x54dd('0x33')]({'where':_0xba2790[_0x54dd('0x4c')]})[_0x54dd('0x23')](function(_0x26c4a3){_0x4476e3[_0x54dd('0x33')]=_0x26c4a3;if(_0x4bb6f1[_0x54dd('0x43')]['includeAll']){_0xba2790[_0x54dd('0x65')]=[{'all':!![]}];}return db[_0x54dd('0x6b')]['findAll'](_0xba2790);})['then'](function(_0x5d862a){_0x4476e3['rows']=_0x5d862a;return _0x4476e3;});}})[_0x54dd('0x23')](respondWithFilteredResult(_0x2c26b3,_0xba2790))[_0x54dd('0x58')](handleError(_0x2c26b3,null));};exports[_0x54dd('0x6d')]=function(_0x48fd60,_0x5cbd28,_0x556e49){return db[_0x54dd('0x3f')][_0x54dd('0x57')]({'where':{'id':_0x48fd60['params']['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x5cbd28,null))[_0x54dd('0x23')](function(_0x294be0){if(_0x294be0){return _0x294be0[_0x54dd('0x6d')](_0x48fd60[_0x54dd('0x43')][_0x54dd('0x68')]);}})['then'](respondWithStatusCode(_0x5cbd28,null))[_0x54dd('0x58')](handleError(_0x5cbd28,null));};exports[_0x54dd('0x6e')]=function(_0x294853,_0x2c7e54,_0x14e185){var _0x17f948={'channel':_0x54dd('0x6f')};var _0x2c006f=[];var _0x196993=[];var _0xc37001={};return db['SmsAccount'][_0x54dd('0x57')]({'where':{'id':_0x294853[_0x54dd('0x55')]['id']},'include':[{'model':db[_0x54dd('0x70')],'as':_0x54dd('0x71')}]})['then'](handleEntityNotFound(_0x2c7e54,null))[_0x54dd('0x23')](function(_0x314d82){_0x17f948[_0x54dd('0x72')]=_0x314d82;_0x17f948[_0x54dd('0x73')]=_[_0x54dd('0x74')](_0x314d82[_0x54dd('0x71')],[_0x54dd('0x75')],[_0x54dd('0x76')]);if(_0x17f948['account'][_0x54dd('0x71')]){delete _0x17f948['account']['Applications'];}return db[_0x54dd('0x77')][_0x54dd('0x60')]();})[_0x54dd('0x23')](function(_0x4ddfd7){if(!_0x4ddfd7){throw new db[(_0x54dd('0x78'))][(_0x54dd('0x79'))](_0x54dd('0x7a'));}_0x2c006f=_['difference'](_[_0x54dd('0x44')](_0x4ddfd7),['createdAt',_0x54dd('0x7b')]);_0x196993=_[_0x54dd('0x7c')](_[_0x54dd('0x44')](_0x4ddfd7),['createdAt','updatedAt',_0x54dd('0x7d'),_0x54dd('0x7e')]);_0x17f948[_0x54dd('0x5a')]={'mapKey':_0x54dd('0x7f')};if(_0x17f948['account']['type']){switch(_0x17f948[_0x54dd('0x72')][_0x54dd('0x50')]){case _0x54dd('0x80'):_0x17f948[_0x54dd('0x5a')][_0x54dd('0x81')]=_0x294853['body']['From'];_0x17f948[_0x54dd('0x5a')][_0x54dd('0x5a')]=_0x294853['body']['Body'];_0x17f948['body'][_0x54dd('0x82')]=_0x294853[_0x54dd('0x5a')][_0x54dd('0x83')];break;case _0x54dd('0x84'):_0x17f948[_0x54dd('0x5a')]['from']='+'+_0x294853[_0x54dd('0x5a')][_0x54dd('0x85')];_0x17f948[_0x54dd('0x5a')][_0x54dd('0x5a')]=_0x294853['body'][_0x54dd('0x86')];break;case _0x54dd('0x87'):_0x17f948['body'][_0x54dd('0x81')]=_0x294853[_0x54dd('0x5a')][_0x54dd('0x81')];_0x17f948[_0x54dd('0x5a')]['body']=_0x294853[_0x54dd('0x5a')][_0x54dd('0x2b')];break;case _0x54dd('0x88'):_0x17f948[_0x54dd('0x5a')][_0x54dd('0x81')]=_0x294853[_0x54dd('0x5a')]['from'];_0x17f948['body']['body']=_0x294853[_0x54dd('0x5a')][_0x54dd('0x5a')];_0x17f948['body'][_0x54dd('0x82')]=_0x294853['body'][_0x54dd('0x89')];break;case _0x54dd('0x8a'):_0x17f948[_0x54dd('0x5a')][_0x54dd('0x81')]=_0x294853[_0x54dd('0x5a')]['From'];_0x17f948[_0x54dd('0x5a')][_0x54dd('0x5a')]=_0x294853[_0x54dd('0x5a')]['Text'];_0x17f948[_0x54dd('0x5a')]['messageId']=_0x294853['body']['MessageUUID'];break;case'infobip':_0x17f948[_0x54dd('0x5a')][_0x54dd('0x81')]='+'+_0x294853[_0x54dd('0x5a')][_0x54dd('0x8b')][0x0][_0x54dd('0x81')];_0x17f948[_0x54dd('0x5a')]['body']=_0x294853[_0x54dd('0x5a')][_0x54dd('0x8b')][0x0][_0x54dd('0x86')];_0x17f948['body'][_0x54dd('0x82')]=_0x294853[_0x54dd('0x5a')][_0x54dd('0x8b')][0x0][_0x54dd('0x82')];break;case _0x54dd('0x8c'):_0x17f948['body'][_0x54dd('0x81')]=_0x294853[_0x54dd('0x5a')][_0x54dd('0x8d')];_0x17f948[_0x54dd('0x5a')][_0x54dd('0x5a')]=_0x294853['body'][_0x54dd('0x8e')][_0x54dd('0x2b')];break;case _0x54dd('0x8f'):_0x17f948[_0x54dd('0x5a')][_0x54dd('0x81')]=_0x294853[_0x54dd('0x5a')][_0x54dd('0x90')];_0x17f948[_0x54dd('0x5a')][_0x54dd('0x5a')]=_0x294853[_0x54dd('0x5a')][_0x54dd('0x86')];_0x17f948[_0x54dd('0x5a')][_0x54dd('0x82')]=_0x294853[_0x54dd('0x5a')]['replyMessageId'];break;case _0x54dd('0x91'):_0x17f948[_0x54dd('0x5a')][_0x54dd('0x82')]=_0x294853[_0x54dd('0x5a')][0x0][_0x54dd('0x2b')]['id'];_0x17f948[_0x54dd('0x5a')][_0x54dd('0x81')]=_0x294853[_0x54dd('0x5a')][0x0][_0x54dd('0x2b')][_0x54dd('0x81')];_0x17f948['body'][_0x54dd('0x5a')]=_0x294853[_0x54dd('0x5a')][0x0]['message'][_0x54dd('0x86')];break;case'intelepeer':_0x17f948['body']['from']=_0x294853[_0x54dd('0x5a')]['from'];_0x17f948['body'][_0x54dd('0x5a')]=_0x294853[_0x54dd('0x5a')][_0x54dd('0x2b')];_0x17f948[_0x54dd('0x5a')]['messageId']=_0x294853[_0x54dd('0x5a')]['refid'];break;}}if(_0x17f948[_0x54dd('0x5a')]['id']){delete _0x17f948[_0x54dd('0x5a')]['id'];}if(_[_0x54dd('0x92')](_0x17f948[_0x54dd('0x5a')]['from'])){throw new db['Sequelize']['ValidationError'](_0x54dd('0x93'));}if(_[_0x54dd('0x92')](_0x17f948[_0x54dd('0x5a')][_0x54dd('0x5a')])||_0x17f948['body'][_0x54dd('0x5a')]===''){throw new db['Sequelize'][(_0x54dd('0x79'))](_0x54dd('0x94'));}if(_['isNil'](_0x17f948[_0x54dd('0x5a')][_0x54dd('0x95')])){throw new db['Sequelize'][(_0x54dd('0x79'))](_0x54dd('0x96')+_0x196993);}if(!_[_0x54dd('0x97')](_0x196993,_0x17f948['body'][_0x54dd('0x95')])){throw new db[(_0x54dd('0x78'))][(_0x54dd('0x79'))](_0x54dd('0x98')+_0x196993);}_0xc37001[_0x17f948[_0x54dd('0x5a')]['mapKey']]=_0x17f948[_0x54dd('0x5a')]['from'];return db[_0x54dd('0x99')][_0x54dd('0x57')]({'where':{'id':_0x17f948[_0x54dd('0x72')]['ListId']},'include':[{'model':db[_0x54dd('0x77')],'as':_0x54dd('0x9a'),'where':_0xc37001,'limit':0x1,'order':[['updatedAt',_0x54dd('0x9b')]]}]});})[_0x54dd('0x23')](handleEntityNotFound(_0x2c7e54,null))[_0x54dd('0x23')](function(_0x14403b){if(_0x14403b){_0x17f948[_0x54dd('0x9c')]=_[_0x54dd('0x9d')](_0x14403b,[_0x54dd('0x9a')]);if(_0x14403b['Contacts']['length']){return _0x14403b[_0x54dd('0x9a')][0x0];}var _0x3014e2=_[_0x54dd('0x1c')](_0x17f948[_0x54dd('0x5a')],{'firstName':_0x17f948[_0x54dd('0x5a')][_0x54dd('0x81')],'ListId':_0x14403b['id']});_0x3014e2[_0x17f948['body']['mapKey']]=_0x17f948[_0x54dd('0x5a')][_0x54dd('0x81')];return db[_0x54dd('0x77')]['create'](_0x3014e2,{'fields':_0x2c006f,'raw':!![]});}})['then'](handleEntityNotFound(_0x2c7e54,null))[_0x54dd('0x23')](function(_0x153eee){if(_0x153eee){_0x17f948[_0x54dd('0x9e')]=_0x153eee;var _0x36cee1={'ContactId':_0x153eee['id'],'phone':_0x17f948[_0x54dd('0x5a')][_0x54dd('0x81')],'SmsAccountId':_0x294853[_0x54dd('0x55')]['id']};var _0x5c0636={'ContactId':_0x153eee['id'],'SmsAccountId':_0x294853['params']['id'],'closed':![]};return db[_0x54dd('0x9f')][_0x54dd('0x57')]({'where':_0x5c0636})[_0x54dd('0x23')](function(_0x4d749b){if(_0x4d749b){return[_0x4d749b,![]];}return db[_0x54dd('0x9f')][_0x54dd('0x59')](_0x36cee1)['then'](function(_0x4ab355){return[_0x4ab355,!![]];});});}})[_0x54dd('0xa0')](function(_0x3181c8,_0x450414){_0x17f948['interaction']=_0x3181c8[_0x54dd('0x5e')]({'plain':!![]});_0x17f948[_0x54dd('0xa1')][_0x54dd('0xa2')]=![];if(_0x450414){if(_0x17f948[_0x54dd('0x72')][_0x54dd('0xa3')]){_0x17f948[_0x54dd('0x73')][_0x54dd('0xa4')]({'id':0x0,'priority':_0x17f948['applications'][_0x54dd('0x49')]+0x1,'app':_0x54dd('0xa5'),'appdata':_0x54dd('0xa6'),'interval':_0x54dd('0xa7')});}_0x17f948[_0x54dd('0xa1')][_0x54dd('0xa2')]=!![];}return db[_0x54dd('0xa8')][_0x54dd('0x59')]({'phone':_0x17f948[_0x54dd('0x5a')][_0x54dd('0x81')],'messageId':_0x17f948[_0x54dd('0x5a')][_0x54dd('0x82')],'body':_0x17f948['body'][_0x54dd('0x5a')],'SmsAccountId':_0x294853[_0x54dd('0x55')]['id'],'SmsInteractionId':_0x3181c8['id'],'direction':'in','ContactId':_0x3181c8[_0x54dd('0xa9')],'AttachmentId':_0x17f948['body'][_0x54dd('0xaa')]});})[_0x54dd('0x23')](function(_0x2ba895){_0x17f948[_0x54dd('0x2b')]=_0x2ba895;if(_0x17f948[_0x54dd('0xa1')][_0x54dd('0xab')]){return db[_0x54dd('0xac')]['find']({'attributes':['id',_0x54dd('0x3b')],'where':{'id':_0x17f948[_0x54dd('0xa1')][_0x54dd('0xab')]}})['then'](function(_0x5d9848){if(_0x5d9848){_0x17f948[_0x54dd('0x73')]['unshift']({'id':0x0,'priority':0x0,'app':_0x54dd('0xad'),'appdata':_0x5d9848['name']+','+(_0x17f948[_0x54dd('0x72')][_0x54dd('0xae')]||0xa),'interval':_0x54dd('0xa7')});}return respondWithRpcPromise(_0x54dd('0xaf'),_0x54dd('0xb0'),_0x17f948);});}return respondWithRpcPromise('Start','startRouting',_0x17f948);})[_0x54dd('0x23')](function(_0x5599dc){if(_0x5599dc){var _0x2e72da=0xc8;var _0x1be19e=_0x54dd('0xb1');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1be19e,_0x2e72da,_0x54dd('0xb2'));logger[_0x54dd('0x25')](_0x54dd('0xb3'),_0x1be19e,_0x2e72da,'entity\x20found',JSON[_0x54dd('0x27')](_0x5599dc));if(_0x17f948['account'][_0x54dd('0x50')]===_0x54dd('0x80')){return _0x2c7e54[_0x54dd('0x2e')](_0x2e72da)[_0x54dd('0x34')]('Content-Type',_0x54dd('0xb4'))[_0x54dd('0x3c')](_0x54dd('0xb5'));}else{return _0x2c7e54[_0x54dd('0x2e')](_0x2e72da)[_0x54dd('0x2f')](_0x5599dc);}}})[_0x54dd('0x58')](handleError(_0x2c7e54,null));};exports[_0x54dd('0xb6')]=function(_0x549184,_0xeaf32b){var _0x1fc951=_0x549184[_0x54dd('0x55')]['id'];var _0x6e8743=_0x549184['body'];var _0x2af136=0xc8;var _0x161f7b=null;return db[_0x54dd('0xb7')]['transaction']({'isolationLevel':db[_0x54dd('0xb7')][_0x54dd('0xb8')][_0x54dd('0xb9')][_0x54dd('0xba')]},function(_0x2c7f69){return db[_0x54dd('0x3f')][_0x54dd('0x62')]({'where':{'id':_0x1fc951},'transaction':_0x2c7f69})['then'](function(_0x5a5e9c){if(_0x5a5e9c){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x1fc951},'transaction':_0x2c7f69})[_0x54dd('0x23')](function(){var _0x45768b=_['map'](_0x6e8743,function(_0x2927fc){_0x2927fc[_0x54dd('0x6a')]=_0x1fc951;return _0x2927fc;});return db[_0x54dd('0x70')][_0x54dd('0xbb')](_0x45768b,{'transaction':_0x2c7f69});});}else{_0x2af136=0x194;_0x161f7b=[];}});})[_0x54dd('0x23')](function(){if(_0x2af136!==0x194){return db['SmsApplication'][_0x54dd('0xbc')]({'where':{'SmsAccountId':_0x1fc951},'order':_0x54dd('0x75')})['then'](function(_0x24eafc){_0x161f7b=_0x24eafc;});}})[_0x54dd('0x58')](function(_0x2ac3f7){_0x2af136=0x1f4;logger[_0x54dd('0x28')](_0x2ac3f7[_0x54dd('0xbd')]);if(_0x2ac3f7['name']){delete _0x2ac3f7['name'];}_0x161f7b=_0x2ac3f7;})[_0x54dd('0xbe')](function(){if(_0x161f7b===null){_0xeaf32b[_0x54dd('0x2d')](_0x2af136);}else{if(_0x2af136===0x1f4){_0xeaf32b[_0x54dd('0x2e')](_0x2af136)['send'](_0x161f7b);}else{_0xeaf32b[_0x54dd('0x2e')](_0x2af136)[_0x54dd('0x2f')](_0x161f7b);}}});};exports[_0x54dd('0xbf')]=function(_0x19e125,_0x3520f0,_0x133c5c){var _0x36fb0e={};var _0x44be23={};var _0x308e96;var _0x450fd0;return db['SmsAccount'][_0x54dd('0x62')]({'where':{'id':_0x19e125[_0x54dd('0x55')]['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x3520f0,null))['then'](function(_0x1eb7d6){if(_0x1eb7d6){_0x308e96=_0x1eb7d6;_0x44be23[_0x54dd('0x42')]=_[_0x54dd('0x44')](db[_0x54dd('0x70')][_0x54dd('0x40')]);_0x44be23['query']=_[_0x54dd('0x44')](_0x19e125[_0x54dd('0x43')]);_0x44be23[_0x54dd('0x45')]=_['intersection'](_0x44be23['model'],_0x44be23['query']);_0x36fb0e['attributes']=_[_0x54dd('0x46')](_0x44be23['model'],qs[_0x54dd('0x48')](_0x19e125[_0x54dd('0x43')]['fields']));_0x36fb0e[_0x54dd('0x47')]=_0x36fb0e[_0x54dd('0x47')]['length']?_0x36fb0e[_0x54dd('0x47')]:_0x44be23[_0x54dd('0x42')];_0x36fb0e['order']=qs[_0x54dd('0x4b')](_0x19e125['query']['sort']);_0x36fb0e[_0x54dd('0x4c')]=qs[_0x54dd('0x45')](_[_0x54dd('0x64')](_0x19e125[_0x54dd('0x43')],_0x44be23[_0x54dd('0x45')]));if(_0x19e125[_0x54dd('0x43')][_0x54dd('0x4d')]){_0x36fb0e[_0x54dd('0x4c')]=_[_0x54dd('0x4e')](_0x36fb0e['where'],{'$or':_[_0x54dd('0x4f')](_0x36fb0e[_0x54dd('0x47')],function(_0x16406b){var _0x2da826={};_0x2da826[_0x16406b]={'$like':'%'+_0x19e125[_0x54dd('0x43')]['filter']+'%'};return _0x2da826;})});}_0x36fb0e=_['merge']({},_0x36fb0e,_0x19e125['options']);return _0x308e96['getApplications'](_0x36fb0e);}})[_0x54dd('0x23')](function(_0x564895){if(_0x564895){_0x450fd0=_0x564895[_0x54dd('0x49')];if(!_0x19e125['query'][_0x54dd('0x63')]('nolimit')){_0x36fb0e[_0x54dd('0x32')]=qs[_0x54dd('0x32')](_0x19e125['query'][_0x54dd('0x32')]);_0x36fb0e[_0x54dd('0x30')]=qs['offset'](_0x19e125[_0x54dd('0x43')][_0x54dd('0x30')]);}return _0x308e96[_0x54dd('0xbf')](_0x36fb0e);}})[_0x54dd('0x23')](function(_0x327586){if(_0x327586){return _0x327586?{'count':_0x450fd0,'rows':_0x327586}:null;}})[_0x54dd('0x23')](respondWithResult(_0x3520f0,null))['catch'](handleError(_0x3520f0,null));};exports[_0x54dd('0xc0')]=function(_0xbf5669,_0x9db01d,_0x23df27){var _0xde2697={'raw':![],'where':{}};var _0x4f2a3d={};var _0x1fc038={'count':0x0,'rows':[]};return db[_0x54dd('0x3f')][_0x54dd('0x62')]({'where':{'id':_0xbf5669['params']['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x9db01d,null))[_0x54dd('0x23')](function(_0x5a2eb0){if(_0x5a2eb0){_0x4f2a3d[_0x54dd('0x42')]=_[_0x54dd('0x44')](db[_0x54dd('0x9f')][_0x54dd('0x40')]);_0x4f2a3d[_0x54dd('0x43')]=_[_0x54dd('0x44')](_0xbf5669['query']);_0x4f2a3d[_0x54dd('0x45')]=_[_0x54dd('0x46')](_0x4f2a3d[_0x54dd('0x42')],_0x4f2a3d['query']);_0xde2697['attributes']=_[_0x54dd('0x46')](_0x4f2a3d[_0x54dd('0x42')],qs['fields'](_0xbf5669[_0x54dd('0x43')][_0x54dd('0x48')]));_0xde2697[_0x54dd('0x47')]=_0xde2697['attributes'][_0x54dd('0x49')]?_0xde2697[_0x54dd('0x47')]:_0x4f2a3d['model'];if(!_0xbf5669['query'][_0x54dd('0x63')]('nolimit')){_0xde2697[_0x54dd('0x32')]=qs[_0x54dd('0x32')](_0xbf5669['query'][_0x54dd('0x32')]);_0xde2697[_0x54dd('0x30')]=qs['offset'](_0xbf5669[_0x54dd('0x43')][_0x54dd('0x30')]);}_0xde2697[_0x54dd('0x4a')]=qs[_0x54dd('0x4b')](_0xbf5669['query'][_0x54dd('0x4b')]);_0xde2697[_0x54dd('0x4c')]=qs['filters'](_[_0x54dd('0x64')](_0xbf5669[_0x54dd('0x43')],_0x4f2a3d[_0x54dd('0x45')]));_0xde2697[_0x54dd('0x4c')]['SmsAccountId']=_0x5a2eb0['id'];if(_0xbf5669[_0x54dd('0x43')]['filter']){_0xde2697[_0x54dd('0x4c')]=_[_0x54dd('0x4e')](_0xde2697[_0x54dd('0x4c')],{'$or':_[_0x54dd('0x4f')](_0xde2697['attributes'],function(_0x12d58d){var _0x4dd91c={};_0x4dd91c[_0x12d58d]={'$like':'%'+_0xbf5669[_0x54dd('0x43')]['filter']+'%'};return _0x4dd91c;})});}_0xde2697=_[_0x54dd('0x4e')]({},_0xde2697,_0xbf5669[_0x54dd('0x51')]);return db['SmsInteraction'][_0x54dd('0x33')]({'where':_0xde2697[_0x54dd('0x4c')]})[_0x54dd('0x23')](function(_0x3d4f10){_0x1fc038['count']=_0x3d4f10;if(_0xbf5669[_0x54dd('0x43')][_0x54dd('0x52')]){_0xde2697[_0x54dd('0x65')]=[{'model':db[_0x54dd('0x77')],'as':_0x54dd('0xc1'),'required':![]},{'model':db[_0x54dd('0xac')],'as':_0x54dd('0xc2'),'attributes':[_0x54dd('0x3b'),_0x54dd('0xc3'),_0x54dd('0xc4')],'required':![]},{'model':db['Tag'],'as':_0x54dd('0xc5'),'attributes':['id','name',_0x54dd('0xc6')],'where':_0xbf5669[_0x54dd('0x43')]['tag']?{'id':_0xbf5669['query'][_0x54dd('0xc7')]}:undefined,'required':_0xbf5669[_0x54dd('0x43')]['tag']?!![]:![]}];}return db[_0x54dd('0x9f')][_0x54dd('0x53')](_0xde2697);})[_0x54dd('0x23')](function(_0x1c194f){_0x1fc038[_0x54dd('0x66')]=_0x1c194f;return _0x1fc038;});}})['then'](respondWithFilteredResult(_0x9db01d,_0xde2697))[_0x54dd('0x58')](handleError(_0x9db01d,null));};exports[_0x54dd('0x3c')]=function(_0x4d85bb,_0x2daffa,_0x3ab0a3){var _0xd7e76d,_0x1a569b,_0xbd5d7e;if(_['isNil'](_0x4d85bb[_0x54dd('0x5a')][_0x54dd('0x5a')])||_0x4d85bb[_0x54dd('0x5a')][_0x54dd('0x5a')]===''){throw new db['Sequelize'][(_0x54dd('0x79'))](_0x54dd('0x94'));}if(_[_0x54dd('0x92')](_0x4d85bb['body']['to'])){throw new db[(_0x54dd('0x78'))]['ValidationError']('to\x20is\x20mandatory');}_0xd7e76d=_0x4d85bb[_0x54dd('0x5a')]['to'];return db[_0x54dd('0x3f')]['find']({'where':{'id':_0x4d85bb[_0x54dd('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x54dd('0xc8'),'include':[{'model':db[_0x54dd('0x77')],'as':_0x54dd('0x9a'),'where':{'mobile':_0xd7e76d},'limit':0x1,'order':[[_0x54dd('0x7b'),_0x54dd('0x9b')]]}]}]})[_0x54dd('0x23')](handleEntityNotFound(_0x2daffa,null))[_0x54dd('0x23')](function(_0x5e1ef0){if(_0x5e1ef0&&_0x5e1ef0[_0x54dd('0xc8')]){_0x1a569b=_0x5e1ef0[_0x54dd('0x5e')]({'plain':!![]});if(_0x1a569b[_0x54dd('0xc8')]&&_0x1a569b[_0x54dd('0xc8')][_0x54dd('0x9a')]['length']){return _0x1a569b[_0x54dd('0xc8')]['Contacts'][0x0];}return db[_0x54dd('0x77')][_0x54dd('0x59')](_['defaults'](_0x4d85bb[_0x54dd('0x5a')],{'firstName':_0xd7e76d,'mobile':_0xd7e76d,'phone':_0xd7e76d,'ListId':_0x1a569b['ListId']}));}})[_0x54dd('0x23')](handleEntityNotFound(_0x2daffa,null))[_0x54dd('0x23')](function(_0x511cac){if(_0x511cac){_0xbd5d7e=_0x511cac;return db[_0x54dd('0x9f')]['find']({'where':{'ContactId':_0xbd5d7e['id'],'closed':![],'SmsAccountId':_0x1a569b['id']}})['then'](function(_0x417619){if(_0x417619){return[_0x417619,![]];}return db[_0x54dd('0x9f')][_0x54dd('0x59')]({'UserId':_0x4d85bb[_0x54dd('0x5d')]['id'],'ContactId':_0xbd5d7e['id'],'SmsAccountId':_0x1a569b['id'],'phone':_0xd7e76d,'firstMsgDirection':_0x54dd('0xc9'),'Messages':[_[_0x54dd('0x4e')](_0x4d85bb[_0x54dd('0x5a')],{'read':![],'body':_0x4d85bb[_0x54dd('0x5a')][_0x54dd('0x5a')],'phone':_0xd7e76d,'SmsAccountId':_0x1a569b['id'],'UserId':_0x4d85bb[_0x54dd('0x5d')]['id'],'ContactId':_0xbd5d7e['id']})]},{'include':[{'model':db[_0x54dd('0xa8')],'as':_0x54dd('0xca')}]})[_0x54dd('0x23')](function(_0xf64cf4){return[_0xf64cf4,!![]];});});}})[_0x54dd('0xa0')](function(_0x5b2205,_0x2ca04e){if(_0x2ca04e){return _0x5b2205;}return db[_0x54dd('0xa8')][_0x54dd('0x59')](_['merge'](_0x4d85bb[_0x54dd('0x5a')],{'read':![],'body':_0x4d85bb[_0x54dd('0x5a')][_0x54dd('0x5a')],'phone':_0xd7e76d,'SmsAccountId':_0x1a569b['id'],'SmsInteractionId':_0x5b2205['id'],'UserId':_0x4d85bb[_0x54dd('0x5d')]['id'],'ContactId':_0xbd5d7e['id']}))[_0x54dd('0x23')](function(_0x2982dc){_0x5b2205[_0x54dd('0xcb')][_0x54dd('0xca')]=[];_0x5b2205[_0x54dd('0xcb')]['Messages']['push'](_0x2982dc[_0x54dd('0xcb')]);return _0x5b2205;});})[_0x54dd('0x23')](respondWithResult(_0x2daffa,null))[_0x54dd('0x58')](handleError(_0x2daffa,null));};exports[_0x54dd('0x2e')]=function(_0x38407d,_0x10f8a8,_0x343a2d){if(_0x38407d[_0x54dd('0x5a')]['id']){delete _0x38407d[_0x54dd('0x5a')]['id'];}var _0x22a0aa,_0x40a66b,_0x2e1088;return db[_0x54dd('0x3f')][_0x54dd('0x57')]({'where':{'id':_0x38407d[_0x54dd('0x55')]['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x10f8a8,null))[_0x54dd('0x23')](function(_0x43c7af){if(_0x43c7af){_0x2e1088=_0x43c7af;logger[_0x54dd('0x25')](_0x54dd('0x26'),_0x54dd('0x2e'),_0x54dd('0xcc'),_0x43c7af[_0x54dd('0x50')],util[_0x54dd('0xcd')](_0x38407d[_0x54dd('0x5a')],{'showHidden':![],'depth':null}));switch(_0x43c7af[_0x54dd('0x50')]){case _0x54dd('0x84'):if(_0x38407d[_0x54dd('0x5a')][_0x54dd('0xce')]&&_0x38407d[_0x54dd('0x5a')][_0x54dd('0x2e')]){_0x40a66b=_0x38407d['body'][_0x54dd('0x2e')];return db[_0x54dd('0xa8')][_0x54dd('0x57')]({'where':{'messageId':_0x38407d[_0x54dd('0x5a')]['skebby_dispatch_id']}});}break;case _0x54dd('0x87'):if(_0x38407d[_0x54dd('0x5a')][_0x54dd('0xcf')]&&_0x38407d[_0x54dd('0x5a')]['statusInt']){_0x40a66b=_0x38407d['body']['statusInt'];return db['SmsMessage'][_0x54dd('0x57')]({'where':{'messageId':_0x38407d[_0x54dd('0x5a')][_0x54dd('0xcf')]}});}break;case _0x54dd('0x88'):if(_0x38407d[_0x54dd('0x5a')]['message_id']&&_0x38407d[_0x54dd('0x5a')][_0x54dd('0xd0')]){_0x40a66b=_0x38407d['body'][_0x54dd('0xd0')];return db[_0x54dd('0xa8')][_0x54dd('0x57')]({'where':{'messageId':_0x38407d[_0x54dd('0x5a')][_0x54dd('0x89')]}});}break;case _0x54dd('0xd1'):var _0x2149a1=_0x38407d[_0x54dd('0x5a')][_0x54dd('0x8b')][0x0];if(_0x2149a1[_0x54dd('0x82')]&&_0x2149a1[_0x54dd('0x2e')][_0x54dd('0xd2')]===_0x54dd('0xd3')){_0x40a66b=_0x2149a1[_0x54dd('0x2e')][_0x54dd('0xd2')];return db[_0x54dd('0xa8')]['find']({'where':{'messageId':_0x2149a1[_0x54dd('0x82')]}});}break;case'clickatell':if(_0x38407d[_0x54dd('0x5a')][_0x54dd('0x82')]&&_0x38407d[_0x54dd('0x5a')][_0x54dd('0x2e')]){_0x40a66b=_0x38407d[_0x54dd('0x5a')][_0x54dd('0x2e')];return db[_0x54dd('0xa8')][_0x54dd('0x57')]({'where':{'messageId':_0x38407d[_0x54dd('0x5a')]['messageId']}});}break;case _0x54dd('0x91'):if(_0x38407d['body'][0x0][_0x54dd('0x2b')]['id']){_0x40a66b=_0x38407d[_0x54dd('0x5a')][0x0][_0x54dd('0x50')];return db[_0x54dd('0xa8')][_0x54dd('0x57')]({'where':{'messageId':_0x38407d[_0x54dd('0x5a')][0x0][_0x54dd('0x2b')]['id']}});}break;case _0x54dd('0xd4'):if(_0x38407d['body'][_0x54dd('0xd5')]&&_0x38407d[_0x54dd('0x5a')]['status']){_0x40a66b=_0x38407d[_0x54dd('0x5a')][_0x54dd('0x2e')];return db[_0x54dd('0xa8')][_0x54dd('0x57')]({'where':{'messageId':_0x38407d[_0x54dd('0x5a')][_0x54dd('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x10f8a8,null))[_0x54dd('0x23')](function(_0x1d4f08){if(_0x1d4f08){_0x22a0aa=_0x1d4f08;switch(_0x2e1088[_0x54dd('0x50')]){case _0x54dd('0x84'):if(_0x40a66b==='DELIVERED'){return _0x22a0aa[_0x54dd('0x37')]({'read':!![]});}else{logger[_0x54dd('0x28')](_0x54dd('0x26'),'status',_0x54dd('0x84'),util[_0x54dd('0xcd')](_0x38407d[_0x54dd('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x54dd('0x87'):if(_0x40a66b==='1'){return _0x22a0aa[_0x54dd('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x54dd('0x84'),util[_0x54dd('0xcd')](_0x38407d[_0x54dd('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x54dd('0x88'):if(!_0x38407d['body'][_0x54dd('0xd6')]&&_0x40a66b>=0xc8&&_0x40a66b<=0xce){return _0x22a0aa['update']({'read':!![]});}else{logger[_0x54dd('0x28')](_0x54dd('0x26'),_0x54dd('0x2e'),_0x54dd('0x88'),util[_0x54dd('0xcd')](_0x38407d[_0x54dd('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x54dd('0xd1'):var _0x133060=_0x38407d[_0x54dd('0x5a')][_0x54dd('0x8b')][0x0];if(_0x133060[_0x54dd('0x2e')][_0x54dd('0xd2')]==='DELIVERED'){return _0x22a0aa[_0x54dd('0x37')]({'read':!![]});}else{logger[_0x54dd('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x54dd('0x2e'),'infobip',util[_0x54dd('0xcd')](_0x38407d[_0x54dd('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x40a66b=='DELIVERED_TO_GATEWAY'||_0x40a66b==_0x54dd('0xd7')){return _0x22a0aa['update']({'read':!![]});}else{logger[_0x54dd('0x28')](_0x54dd('0x26'),'status',_0x54dd('0x8f'),util[_0x54dd('0xcd')](_0x38407d[_0x54dd('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x54dd('0x91'):if(_0x40a66b==_0x54dd('0xd8')){return _0x22a0aa[_0x54dd('0x37')]({'read':!![]});}else{logger[_0x54dd('0x28')](_0x54dd('0x26'),_0x54dd('0x2e'),_0x54dd('0x91'),util[_0x54dd('0xcd')](_0x38407d[_0x54dd('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x54dd('0xd4'):if(_0x40a66b===_0x54dd('0xd9')||_0x40a66b===_0x54dd('0xda')){return _0x22a0aa[_0x54dd('0x37')]({'read':!![]});}else{logger['error'](_0x54dd('0x26'),_0x54dd('0x2e'),'intelepeer',util[_0x54dd('0xcd')](_0x38407d[_0x54dd('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x22a0aa;}})[_0x54dd('0x23')](respondWithResult(_0x10f8a8,null))[_0x54dd('0x58')](handleError(_0x10f8a8,null));};exports['statusGet']=function(_0x2a56ca,_0x563282,_0x2cb5c1){var _0x3dab86,_0x3477ef,_0x2b0517;return db[_0x54dd('0x3f')][_0x54dd('0x57')]({'where':{'id':_0x2a56ca['params']['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x563282,null))[_0x54dd('0x23')](function(_0x369abc){if(_0x369abc){_0x2b0517=_0x369abc;logger[_0x54dd('0x25')](_0x54dd('0x26'),'status',_0x54dd('0xcc'),_0x369abc['type'],util[_0x54dd('0xcd')](_0x2a56ca['query'],{'showHidden':![],'depth':null}));switch(_0x369abc[_0x54dd('0x50')]){case _0x54dd('0x8c'):if(_0x2a56ca[_0x54dd('0x43')][_0x54dd('0xdb')]&&_0x2a56ca[_0x54dd('0x43')][_0x54dd('0xdc')]){_0x3477ef=_0x2a56ca['query']['state'];return db['SmsMessage']['find']({'where':{'messageId':_0x2a56ca['query'][_0x54dd('0xdb')]}});}break;}}})[_0x54dd('0x23')](handleEntityNotFound(_0x563282,null))['then'](function(_0x451159){if(_0x451159){_0x3dab86=_0x451159;switch(_0x2b0517['type']){case _0x54dd('0x8c'):if(_0x3477ef==='2'||_0x3477ef==='6'){return _0x3dab86[_0x54dd('0x37')]({'read':!![]});}else{logger[_0x54dd('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x54dd('0x2e'),'csc',util[_0x54dd('0xcd')](_0x2a56ca[_0x54dd('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x3dab86;}})[_0x54dd('0x23')](respondWithResult(_0x563282,null))['catch'](handleError(_0x563282,null));};exports[_0x54dd('0xdd')]=function(_0x8e1451,_0x155c5e,_0x4d24e0){return db[_0x54dd('0x3f')][_0x54dd('0x57')]({'where':{'id':_0x8e1451['params']['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x155c5e,null))[_0x54dd('0x23')](function(_0xe1c21c){if(_0xe1c21c){return _0xe1c21c['addAgents'](_0x8e1451[_0x54dd('0x5a')][_0x54dd('0x68')],_[_0x54dd('0x9d')](_0x8e1451[_0x54dd('0x5a')],['ids','id'])||{})['spread'](function(_0xeaad11){for(var _0x4c572d=0x0;_0x4c572d<_0x8e1451['body'][_0x54dd('0x68')]['length'];_0x4c572d+=0x1){socket['emit'](_0x54dd('0xde'),{'UserId':Number(_0x8e1451['body'][_0x54dd('0x68')][_0x4c572d]),'SmsAccountId':Number(_0x8e1451[_0x54dd('0x55')]['id'])});}return _0xeaad11;});}})[_0x54dd('0x23')](respondWithResult(_0x155c5e,null))[_0x54dd('0x58')](handleError(_0x155c5e,null));};exports[_0x54dd('0xdf')]=function(_0x3e113c,_0x471794,_0x35842a){return db[_0x54dd('0x3f')]['find']({'where':{'id':_0x3e113c[_0x54dd('0x55')]['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x471794,null))[_0x54dd('0x23')](function(_0x3b707f){if(_0x3b707f){return _0x3b707f[_0x54dd('0xdf')](_0x3e113c[_0x54dd('0x43')]['ids'])[_0x54dd('0x23')](function(){if(_['isArray'](_0x3e113c[_0x54dd('0x43')][_0x54dd('0x68')])){for(var _0x1fa3b9=0x0;_0x1fa3b9<_0x3e113c[_0x54dd('0x43')][_0x54dd('0x68')][_0x54dd('0x49')];_0x1fa3b9+=0x1){socket['emit'](_0x54dd('0xe0'),{'UserId':Number(_0x3e113c[_0x54dd('0x43')][_0x54dd('0x68')][_0x1fa3b9]),'SmsAccountId':Number(_0x3e113c[_0x54dd('0x55')]['id'])});}}else{socket[_0x54dd('0xe1')]('userSmsAccount:remove',{'UserId':Number(_0x3e113c[_0x54dd('0x43')][_0x54dd('0x68')]),'SmsAccountId':Number(_0x3e113c[_0x54dd('0x55')]['id'])});}});}})[_0x54dd('0x23')](respondWithStatusCode(_0x471794,null))[_0x54dd('0x58')](handleError(_0x471794,null));};exports[_0x54dd('0xe2')]=function(_0x2dfd60,_0x555ca7,_0x1e8be1){var _0x1936e7={};var _0x5b98bb={};var _0xf26672;var _0x119109;return db[_0x54dd('0x3f')][_0x54dd('0x62')]({'where':{'id':_0x2dfd60[_0x54dd('0x55')]['id']}})[_0x54dd('0x23')](handleEntityNotFound(_0x555ca7,null))[_0x54dd('0x23')](function(_0x41ca0d){if(_0x41ca0d){_0xf26672=_0x41ca0d;_0x5b98bb[_0x54dd('0x42')]=_['keys'](db['User'][_0x54dd('0x40')]);_0x5b98bb[_0x54dd('0x43')]=_[_0x54dd('0x44')](_0x2dfd60[_0x54dd('0x43')]);_0x5b98bb[_0x54dd('0x45')]=_[_0x54dd('0x46')](_0x5b98bb[_0x54dd('0x42')],_0x5b98bb[_0x54dd('0x43')]);_0x1936e7[_0x54dd('0x47')]=_[_0x54dd('0x46')](_0x5b98bb[_0x54dd('0x42')],qs['fields'](_0x2dfd60[_0x54dd('0x43')][_0x54dd('0x48')]));_0x1936e7[_0x54dd('0x47')]=_0x1936e7[_0x54dd('0x47')]['length']?_0x1936e7[_0x54dd('0x47')]:_0x5b98bb[_0x54dd('0x42')];_0x1936e7['order']=qs['sort'](_0x2dfd60['query'][_0x54dd('0x4b')]);_0x1936e7[_0x54dd('0x4c')]=qs['filters'](_[_0x54dd('0x64')](_0x2dfd60[_0x54dd('0x43')],_0x5b98bb['filters']));if(_0x2dfd60[_0x54dd('0x43')]['filter']){_0x1936e7[_0x54dd('0x4c')]=_[_0x54dd('0x4e')](_0x1936e7[_0x54dd('0x4c')],{'$or':_['map'](_0x1936e7[_0x54dd('0x47')],function(_0x2a4f78){var _0x5d836d={};_0x5d836d[_0x2a4f78]={'$like':'%'+_0x2dfd60['query']['filter']+'%'};return _0x5d836d;})});}_0x1936e7=_[_0x54dd('0x4e')]({},_0x1936e7,_0x2dfd60[_0x54dd('0x51')]);return _0xf26672[_0x54dd('0xe2')](_0x1936e7);}})[_0x54dd('0x23')](function(_0x1a382c){if(_0x1a382c){_0x119109=_0x1a382c['length'];if(!_0x2dfd60[_0x54dd('0x43')][_0x54dd('0x63')](_0x54dd('0x6c'))){_0x1936e7[_0x54dd('0x32')]=qs[_0x54dd('0x32')](_0x2dfd60[_0x54dd('0x43')]['limit']);_0x1936e7['offset']=qs['offset'](_0x2dfd60[_0x54dd('0x43')][_0x54dd('0x30')]);}return _0xf26672[_0x54dd('0xe2')](_0x1936e7);}})[_0x54dd('0x23')](function(_0x5cdb08){if(_0x5cdb08){return _0x5cdb08?{'count':_0x119109,'rows':_0x5cdb08}:null;}})[_0x54dd('0x23')](respondWithResult(_0x555ca7,null))[_0x54dd('0x58')](handleError(_0x555ca7,null));}; \ No newline at end of file +var _0x1413=['List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','offset','count','limit','set','json','apply','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','CannedAnswer','getAnswers','sort','ids','notify','sms','SmsApplication','Applications','priority','asc','account','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','messageId','MessageSid','from','text','connectel','clicksend','message_id','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','ValidationError','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','Contacts','DESC','omit','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','UserId','User','applications','unshift','waitForTheAssignedAgent','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','addApplications','transaction','sequelize','Transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','CmList'];(function(_0x4458b9,_0x31f37b){var _0x52a0ab=function(_0x3ddb37){while(--_0x3ddb37){_0x4458b9['push'](_0x4458b9['shift']());}};_0x52a0ab(++_0x31f37b);}(_0x1413,0x1e0));var _0x3141=function(_0x322605,_0xde7f0b){_0x322605=_0x322605-0x0;var _0x24f3b0=_0x1413[_0x322605];return _0x24f3b0;};'use strict';var emlformat=require(_0x3141('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3141('0x1'));var jsonpatch=require(_0x3141('0x2'));var rp=require(_0x3141('0x3'));var moment=require(_0x3141('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3141('0x5'));var util=require(_0x3141('0x6'));var path=require(_0x3141('0x7'));var sox=require(_0x3141('0x8'));var csv=require(_0x3141('0x9'));var ejs=require(_0x3141('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3141('0xb'));var squel=require(_0x3141('0xc'));var crypto=require(_0x3141('0xd'));var jsforce=require(_0x3141('0xe'));var deskjs=require(_0x3141('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3141('0x10'));var Papa=require('papaparse');var Redis=require(_0x3141('0x11'));var authService=require(_0x3141('0x12'));var qs=require(_0x3141('0x13'));var as=require(_0x3141('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3141('0x15'));var utils=require(_0x3141('0x16'));var config=require(_0x3141('0x17'));var licenseUtil=require(_0x3141('0x18'));var db=require(_0x3141('0x19'))['db'];config['redis']=_[_0x3141('0x1a')](config['redis'],{'host':_0x3141('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3141('0x1c')]));require('./smsAccount.socket')[_0x3141('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3141('0x1e')][_0x3141('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x1d57c4,_0x2fe4ba,_0x151d6d,_0x455eb7){return new BPromise(function(_0x2e7359,_0x43b472){var _0x21821d=_0x455eb7||client;return _0x21821d[_0x3141('0x20')](_0x1d57c4,_0x151d6d)[_0x3141('0x21')](function(_0x160fde){logger[_0x3141('0x22')](_0x3141('0x23'),_0x2fe4ba,_0x3141('0x24'));logger[_0x3141('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2fe4ba,_0x3141('0x24'),JSON[_0x3141('0x26')](_0x160fde));if(_0x160fde[_0x3141('0x27')]){if(_0x160fde[_0x3141('0x27')][_0x3141('0x28')]===0x1f4){logger[_0x3141('0x27')](_0x3141('0x23'),_0x2fe4ba,_0x160fde[_0x3141('0x27')][_0x3141('0x29')]);return _0x43b472(_0x160fde[_0x3141('0x27')][_0x3141('0x29')]);}logger[_0x3141('0x27')]('SmsAccount,\x20%s,\x20%s',_0x2fe4ba,_0x160fde[_0x3141('0x27')][_0x3141('0x29')]);return _0x2e7359(_0x160fde[_0x3141('0x27')][_0x3141('0x29')]);}else{logger[_0x3141('0x22')](_0x3141('0x23'),_0x2fe4ba,_0x3141('0x24'));_0x2e7359(_0x160fde['result'][_0x3141('0x29')]);}})[_0x3141('0x2a')](function(_0x1e3d00){logger[_0x3141('0x27')]('SmsAccount,\x20%s,\x20%s',_0x2fe4ba,_0x1e3d00);_0x43b472(_0x1e3d00);});});}function respondWithStatusCode(_0x49e6f4,_0x5128ba){_0x5128ba=_0x5128ba||0xcc;return function(_0x17a548){if(_0x17a548){return _0x49e6f4[_0x3141('0x2b')](_0x5128ba);}return _0x49e6f4[_0x3141('0x2c')](_0x5128ba)[_0x3141('0x2d')]();};}function respondWithResult(_0x4b9979,_0x4e1edc){_0x4e1edc=_0x4e1edc||0xc8;return function(_0x3f0220){if(_0x3f0220){return _0x4b9979[_0x3141('0x2c')](_0x4e1edc)['json'](_0x3f0220);}};}function respondWithFilteredResult(_0x5ce29f,_0x531c20){return function(_0x9d8304){if(_0x9d8304){var _0x392dca=typeof _0x531c20[_0x3141('0x2e')]==='undefined'&&typeof _0x531c20['limit']==='undefined';var _0x2b67b3=_0x9d8304[_0x3141('0x2f')];var _0x296137=_0x392dca?0x0:_0x531c20[_0x3141('0x2e')];var _0x49ae44=_0x392dca?_0x9d8304[_0x3141('0x2f')]:_0x531c20[_0x3141('0x2e')]+_0x531c20[_0x3141('0x30')];var _0x2c1790;if(_0x49ae44>=_0x2b67b3){_0x49ae44=_0x2b67b3;_0x2c1790=0xc8;}else{_0x2c1790=0xce;}_0x5ce29f['status'](_0x2c1790);return _0x5ce29f[_0x3141('0x31')]('Content-Range',_0x296137+'-'+_0x49ae44+'/'+_0x2b67b3)[_0x3141('0x32')](_0x9d8304);}return null;};}function patchUpdates(_0x5cf3ad){return function(_0x440dc4){try{jsonpatch[_0x3141('0x33')](_0x440dc4,_0x5cf3ad,!![]);}catch(_0x1e9718){return BPromise[_0x3141('0x34')](_0x1e9718);}return _0x440dc4['save']();};}function saveUpdates(_0xd9bb02,_0x25c819){return function(_0x120237){if(_0x120237){return _0x120237[_0x3141('0x35')](_0xd9bb02)[_0x3141('0x21')](function(_0x231d83){return _0x231d83;});}return null;};}function removeEntity(_0x2bc23e,_0x23c136){return function(_0x5e6b70){if(_0x5e6b70){return _0x5e6b70[_0x3141('0x36')]()[_0x3141('0x21')](function(){var _0x21f346=_0x5e6b70[_0x3141('0x37')]({'plain':!![]});var _0x162af2='SmsAccounts';return db[_0x3141('0x38')][_0x3141('0x36')]({'where':{'type':_0x162af2,'resourceId':_0x21f346['id']}})[_0x3141('0x21')](function(){return _0x5e6b70;});})['then'](function(){_0x2bc23e[_0x3141('0x2c')](0xcc)[_0x3141('0x2d')]();});}};}function handleEntityNotFound(_0x6534cc,_0x280148){return function(_0x94ab03){if(!_0x94ab03){_0x6534cc[_0x3141('0x2b')](0x194);}return _0x94ab03;};}function handleError(_0x2cf712,_0x1d9282){_0x1d9282=_0x1d9282||0x1f4;return function(_0x20dd48){logger[_0x3141('0x27')](_0x20dd48[_0x3141('0x39')]);if(_0x20dd48[_0x3141('0x3a')]){delete _0x20dd48[_0x3141('0x3a')];}_0x2cf712[_0x3141('0x2c')](_0x1d9282)[_0x3141('0x3b')](_0x20dd48);};}exports[_0x3141('0x3c')]=function(_0x518151,_0x4eb84b){var _0x65a763={'include':[{'model':db[_0x3141('0x3d')],'as':_0x3141('0x3e')}]},_0x4e3e08={},_0x1c7013={'count':0x0,'rows':[]};var _0x2571f2=_[_0x3141('0x3f')](db[_0x3141('0x40')][_0x3141('0x41')],function(_0x387f5b){return{'name':_0x387f5b[_0x3141('0x42')],'type':_0x387f5b[_0x3141('0x43')][_0x3141('0x44')]};});_0x4e3e08['model']=_[_0x3141('0x3f')](_0x2571f2,_0x3141('0x3a'));_0x4e3e08[_0x3141('0x45')]=_[_0x3141('0x46')](_0x518151[_0x3141('0x45')]);_0x4e3e08[_0x3141('0x47')]=_[_0x3141('0x48')](_0x4e3e08[_0x3141('0x49')],_0x4e3e08[_0x3141('0x45')]);_0x65a763['attributes']=_[_0x3141('0x48')](_0x4e3e08[_0x3141('0x49')],qs[_0x3141('0x4a')](_0x518151['query']['fields']));_0x65a763['attributes']=_0x65a763[_0x3141('0x4b')][_0x3141('0x4c')]?_0x65a763['attributes']:_0x4e3e08[_0x3141('0x49')];if(!_0x518151[_0x3141('0x45')][_0x3141('0x4d')](_0x3141('0x4e'))){_0x65a763[_0x3141('0x30')]=qs[_0x3141('0x30')](_0x518151[_0x3141('0x45')][_0x3141('0x30')]);_0x65a763[_0x3141('0x2e')]=qs[_0x3141('0x2e')](_0x518151[_0x3141('0x45')]['offset']);}_0x65a763[_0x3141('0x4f')]=qs['sort'](_0x518151['query']['sort']);_0x65a763[_0x3141('0x50')]=qs[_0x3141('0x47')](_[_0x3141('0x51')](_0x518151[_0x3141('0x45')],_0x4e3e08[_0x3141('0x47')]),_0x2571f2);if(_0x518151[_0x3141('0x45')]['filter']){_0x65a763['where']=_['merge'](_0x65a763[_0x3141('0x50')],{'$or':_[_0x3141('0x3f')](_0x2571f2,function(_0x39843e){if(_0x39843e['type']!==_0x3141('0x52')){var _0x2c5478={};_0x2c5478[_0x39843e[_0x3141('0x3a')]]={'$like':'%'+_0x518151[_0x3141('0x45')][_0x3141('0x53')]+'%'};return _0x2c5478;}})});}_0x65a763=_[_0x3141('0x54')]({},_0x65a763,_0x518151['options']);var _0x1b1ea3={'where':_0x65a763[_0x3141('0x50')]};return db['SmsAccount'][_0x3141('0x2f')](_0x1b1ea3)[_0x3141('0x21')](function(_0x3456ef){_0x1c7013['count']=_0x3456ef;if(_0x518151['query'][_0x3141('0x55')]){_0x65a763[_0x3141('0x56')]=[{'all':!![]}];}return db[_0x3141('0x40')][_0x3141('0x57')](_0x65a763);})[_0x3141('0x21')](function(_0x23ebcc){_0x1c7013[_0x3141('0x58')]=_0x23ebcc;return _0x1c7013;})[_0x3141('0x21')](respondWithFilteredResult(_0x4eb84b,_0x65a763))[_0x3141('0x2a')](handleError(_0x4eb84b,null));};exports[_0x3141('0x59')]=function(_0x32b077,_0x4785e0){var _0x4a7071={'raw':![],'where':{'id':_0x32b077['params']['id']},'include':[{'model':db[_0x3141('0x3d')],'as':_0x3141('0x3e')}]},_0x318f3a={};_0x318f3a[_0x3141('0x49')]=_[_0x3141('0x46')](db[_0x3141('0x40')][_0x3141('0x41')]);_0x318f3a['query']=_['keys'](_0x32b077[_0x3141('0x45')]);_0x318f3a['filters']=_[_0x3141('0x48')](_0x318f3a[_0x3141('0x49')],_0x318f3a[_0x3141('0x45')]);_0x4a7071[_0x3141('0x4b')]=_['intersection'](_0x318f3a[_0x3141('0x49')],qs[_0x3141('0x4a')](_0x32b077[_0x3141('0x45')][_0x3141('0x4a')]));_0x4a7071[_0x3141('0x4b')]=_0x4a7071[_0x3141('0x4b')]['length']?_0x4a7071[_0x3141('0x4b')]:_0x318f3a[_0x3141('0x49')];if(_0x32b077[_0x3141('0x45')]['includeAll']){_0x4a7071[_0x3141('0x56')]=[{'all':!![]}];}_0x4a7071=_[_0x3141('0x54')]({},_0x4a7071,_0x32b077[_0x3141('0x5a')]);return db[_0x3141('0x40')]['find'](_0x4a7071)[_0x3141('0x21')](handleEntityNotFound(_0x4785e0,null))[_0x3141('0x21')](respondWithResult(_0x4785e0,null))['catch'](handleError(_0x4785e0,null));};exports[_0x3141('0x5b')]=function(_0x203637,_0x3b576b){return db['SmsAccount']['create'](_0x203637[_0x3141('0x5c')],{})[_0x3141('0x21')](function(_0x34e3b2){var _0x5f5598=_0x203637[_0x3141('0x5d')]['get']({'plain':!![]});if(!_0x5f5598)throw new Error(_0x3141('0x5e'));if(_0x5f5598[_0x3141('0x5f')]===_0x3141('0x5d')){var _0x1f1737=_0x34e3b2[_0x3141('0x37')]({'plain':!![]});var _0x240592=_0x3141('0x60');return db[_0x3141('0x61')][_0x3141('0x62')]({'where':{'name':_0x240592,'userProfileId':_0x5f5598[_0x3141('0x63')]},'raw':!![]})['then'](function(_0x2a8ec7){if(_0x2a8ec7&&_0x2a8ec7[_0x3141('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x1f1737['name'],'resourceId':_0x1f1737['id'],'type':_0x2a8ec7['name'],'sectionId':_0x2a8ec7['id']},{})[_0x3141('0x21')](function(){return _0x34e3b2;});}else{return _0x34e3b2;}})[_0x3141('0x2a')](function(_0x2a6cd6){logger[_0x3141('0x27')](_0x3141('0x65'),_0x2a6cd6);throw _0x2a6cd6;});}return _0x34e3b2;})[_0x3141('0x21')](respondWithResult(_0x3b576b,0xc9))[_0x3141('0x2a')](handleError(_0x3b576b,null));};exports[_0x3141('0x35')]=function(_0x5bd78f,_0x2c1937){if(_0x5bd78f[_0x3141('0x5c')]['id']){delete _0x5bd78f[_0x3141('0x5c')]['id'];}return db[_0x3141('0x40')][_0x3141('0x62')]({'where':{'id':_0x5bd78f[_0x3141('0x66')]['id']},'include':[{'model':db[_0x3141('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2c1937,null))[_0x3141('0x21')](saveUpdates(_0x5bd78f[_0x3141('0x5c')],null))['then'](respondWithResult(_0x2c1937,null))[_0x3141('0x2a')](handleError(_0x2c1937,null));};exports['destroy']=function(_0x35ef8c,_0x81bec3){return db['SmsAccount'][_0x3141('0x62')]({'where':{'id':_0x35ef8c[_0x3141('0x66')]['id']}})['then'](handleEntityNotFound(_0x81bec3,null))[_0x3141('0x21')](removeEntity(_0x81bec3,null))[_0x3141('0x2a')](handleError(_0x81bec3,null));};exports[_0x3141('0x67')]=function(_0xadbc18,_0x409dfa){return db['SmsAccount'][_0x3141('0x67')]()[_0x3141('0x21')](respondWithResult(_0x409dfa,null))[_0x3141('0x2a')](handleError(_0x409dfa,null));};exports[_0x3141('0x68')]=function(_0x558ea2,_0x239b1f,_0x111f41){if(_0x558ea2['body']['id']){delete _0x558ea2['body']['id'];}return db[_0x3141('0x40')][_0x3141('0x62')]({'where':{'id':_0x558ea2[_0x3141('0x66')]['id']}})[_0x3141('0x21')](handleEntityNotFound(_0x239b1f,null))[_0x3141('0x21')](function(_0x50d627){if(_0x50d627){_0x558ea2['body'][_0x3141('0x69')]=_0x50d627['id'];return db[_0x3141('0x6a')][_0x3141('0x5b')](_0x558ea2[_0x3141('0x5c')]);}})[_0x3141('0x21')](respondWithResult(_0x239b1f,null))['catch'](handleError(_0x239b1f,null));};exports[_0x3141('0x6b')]=function(_0x2542c6,_0x1e4de2,_0x3c5dd4){var _0x43dcdd={'raw':![],'where':{}};var _0x1db0ba={};var _0x55fc66={'count':0x0,'rows':[]};return db[_0x3141('0x40')][_0x3141('0x6c')]({'where':{'id':_0x2542c6[_0x3141('0x66')]['id']}})[_0x3141('0x21')](handleEntityNotFound(_0x1e4de2,null))[_0x3141('0x21')](function(_0x1c481a){if(_0x1c481a){_0x1db0ba[_0x3141('0x49')]=_[_0x3141('0x46')](db[_0x3141('0x6a')][_0x3141('0x41')]);_0x1db0ba['query']=_[_0x3141('0x46')](_0x2542c6[_0x3141('0x45')]);_0x1db0ba[_0x3141('0x47')]=_['intersection'](_0x1db0ba[_0x3141('0x49')],_0x1db0ba['query']);_0x43dcdd[_0x3141('0x4b')]=_[_0x3141('0x48')](_0x1db0ba['model'],qs['fields'](_0x2542c6[_0x3141('0x45')][_0x3141('0x4a')]));_0x43dcdd[_0x3141('0x4b')]=_0x43dcdd[_0x3141('0x4b')][_0x3141('0x4c')]?_0x43dcdd[_0x3141('0x4b')]:_0x1db0ba[_0x3141('0x49')];if(!_0x2542c6[_0x3141('0x45')][_0x3141('0x4d')](_0x3141('0x4e'))){_0x43dcdd['limit']=qs['limit'](_0x2542c6[_0x3141('0x45')][_0x3141('0x30')]);_0x43dcdd[_0x3141('0x2e')]=qs[_0x3141('0x2e')](_0x2542c6[_0x3141('0x45')][_0x3141('0x2e')]);}_0x43dcdd[_0x3141('0x4f')]=qs['sort'](_0x2542c6['query']['sort']);_0x43dcdd[_0x3141('0x50')]=qs['filters'](_[_0x3141('0x51')](_0x2542c6[_0x3141('0x45')],_0x1db0ba[_0x3141('0x47')]));_0x43dcdd['where'][_0x3141('0x69')]=_0x1c481a['id'];if(_0x2542c6[_0x3141('0x45')][_0x3141('0x53')]){_0x43dcdd[_0x3141('0x50')]=_[_0x3141('0x54')](_0x43dcdd[_0x3141('0x50')],{'$or':_[_0x3141('0x3f')](_0x43dcdd[_0x3141('0x4b')],function(_0xc425ba){var _0x3740a1={};_0x3740a1[_0xc425ba]={'$like':'%'+_0x2542c6['query'][_0x3141('0x53')]+'%'};return _0x3740a1;})});}_0x43dcdd=_[_0x3141('0x54')]({},_0x43dcdd,_0x2542c6[_0x3141('0x5a')]);return db[_0x3141('0x6a')][_0x3141('0x2f')]({'where':_0x43dcdd[_0x3141('0x50')]})['then'](function(_0x5d4e3a){_0x55fc66['count']=_0x5d4e3a;if(_0x2542c6[_0x3141('0x45')][_0x3141('0x55')]){_0x43dcdd[_0x3141('0x56')]=[{'all':!![]}];}return db[_0x3141('0x6a')][_0x3141('0x57')](_0x43dcdd);})['then'](function(_0x48d610){_0x55fc66[_0x3141('0x58')]=_0x48d610;return _0x55fc66;});}})[_0x3141('0x21')](respondWithFilteredResult(_0x1e4de2,_0x43dcdd))['catch'](handleError(_0x1e4de2,null));};exports['removeDispositions']=function(_0x1105c7,_0x195da8,_0x2cbe8b){return db[_0x3141('0x40')][_0x3141('0x62')]({'where':{'id':_0x1105c7[_0x3141('0x66')]['id']}})[_0x3141('0x21')](handleEntityNotFound(_0x195da8,null))[_0x3141('0x21')](function(_0x42ba26){if(_0x42ba26){return _0x42ba26[_0x3141('0x6d')](_0x1105c7[_0x3141('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x195da8,null))[_0x3141('0x2a')](handleError(_0x195da8,null));};exports['addAnswer']=function(_0x5e47e6,_0x560ee5,_0x1339e2){if(_0x5e47e6[_0x3141('0x5c')]['id']){delete _0x5e47e6[_0x3141('0x5c')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x5e47e6[_0x3141('0x66')]['id']}})[_0x3141('0x21')](handleEntityNotFound(_0x560ee5,null))[_0x3141('0x21')](function(_0x25888c){if(_0x25888c){_0x5e47e6[_0x3141('0x5c')]['SmsAccountId']=_0x25888c['id'];return db[_0x3141('0x6e')]['create'](_0x5e47e6[_0x3141('0x5c')]);}})[_0x3141('0x21')](respondWithResult(_0x560ee5,null))[_0x3141('0x2a')](handleError(_0x560ee5,null));};exports[_0x3141('0x6f')]=function(_0x376b3a,_0x1425ed,_0x430b6a){var _0x1f4671={'raw':![],'where':{}};var _0x1bcdcb={};var _0x2ff893={'count':0x0,'rows':[]};return db[_0x3141('0x40')][_0x3141('0x6c')]({'where':{'id':_0x376b3a[_0x3141('0x66')]['id']}})['then'](handleEntityNotFound(_0x1425ed,null))[_0x3141('0x21')](function(_0x3582c3){if(_0x3582c3){_0x1bcdcb['model']=_[_0x3141('0x46')](db['CannedAnswer']['rawAttributes']);_0x1bcdcb['query']=_['keys'](_0x376b3a['query']);_0x1bcdcb['filters']=_['intersection'](_0x1bcdcb['model'],_0x1bcdcb[_0x3141('0x45')]);_0x1f4671['attributes']=_[_0x3141('0x48')](_0x1bcdcb[_0x3141('0x49')],qs[_0x3141('0x4a')](_0x376b3a[_0x3141('0x45')][_0x3141('0x4a')]));_0x1f4671[_0x3141('0x4b')]=_0x1f4671[_0x3141('0x4b')]['length']?_0x1f4671[_0x3141('0x4b')]:_0x1bcdcb['model'];if(!_0x376b3a[_0x3141('0x45')][_0x3141('0x4d')](_0x3141('0x4e'))){_0x1f4671[_0x3141('0x30')]=qs[_0x3141('0x30')](_0x376b3a[_0x3141('0x45')]['limit']);_0x1f4671[_0x3141('0x2e')]=qs[_0x3141('0x2e')](_0x376b3a[_0x3141('0x45')][_0x3141('0x2e')]);}_0x1f4671[_0x3141('0x4f')]=qs[_0x3141('0x70')](_0x376b3a[_0x3141('0x45')][_0x3141('0x70')]);_0x1f4671['where']=qs[_0x3141('0x47')](_['pick'](_0x376b3a[_0x3141('0x45')],_0x1bcdcb[_0x3141('0x47')]));_0x1f4671[_0x3141('0x50')]['SmsAccountId']=_0x3582c3['id'];if(_0x376b3a[_0x3141('0x45')][_0x3141('0x53')]){_0x1f4671['where']=_[_0x3141('0x54')](_0x1f4671[_0x3141('0x50')],{'$or':_[_0x3141('0x3f')](_0x1f4671[_0x3141('0x4b')],function(_0x36e3f6){var _0x5f21d5={};_0x5f21d5[_0x36e3f6]={'$like':'%'+_0x376b3a[_0x3141('0x45')][_0x3141('0x53')]+'%'};return _0x5f21d5;})});}_0x1f4671=_[_0x3141('0x54')]({},_0x1f4671,_0x376b3a[_0x3141('0x5a')]);return db[_0x3141('0x6e')][_0x3141('0x2f')]({'where':_0x1f4671['where']})['then'](function(_0x331348){_0x2ff893[_0x3141('0x2f')]=_0x331348;if(_0x376b3a['query'][_0x3141('0x55')]){_0x1f4671['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x3141('0x57')](_0x1f4671);})[_0x3141('0x21')](function(_0x5a634a){_0x2ff893[_0x3141('0x58')]=_0x5a634a;return _0x2ff893;});}})[_0x3141('0x21')](respondWithFilteredResult(_0x1425ed,_0x1f4671))['catch'](handleError(_0x1425ed,null));};exports['removeAnswers']=function(_0x3dc703,_0x410660,_0x5ade3a){return db[_0x3141('0x40')][_0x3141('0x62')]({'where':{'id':_0x3dc703[_0x3141('0x66')]['id']}})[_0x3141('0x21')](handleEntityNotFound(_0x410660,null))['then'](function(_0xc72afa){if(_0xc72afa){return _0xc72afa['removeAnswers'](_0x3dc703[_0x3141('0x45')][_0x3141('0x71')]);}})['then'](respondWithStatusCode(_0x410660,null))[_0x3141('0x2a')](handleError(_0x410660,null));};exports[_0x3141('0x72')]=function(_0x33c91b,_0x4aa3cd,_0x1825af){var _0xef99fd={'channel':_0x3141('0x73')};var _0x3de8ee=[];var _0xae78f1=[];var _0x1c9730={};return db['SmsAccount'][_0x3141('0x62')]({'where':{'id':_0x33c91b[_0x3141('0x66')]['id']},'include':[{'model':db[_0x3141('0x74')],'as':_0x3141('0x75')}]})[_0x3141('0x21')](handleEntityNotFound(_0x4aa3cd,null))[_0x3141('0x21')](function(_0x1b1da1){_0xef99fd['account']=_0x1b1da1;_0xef99fd['applications']=_['orderBy'](_0x1b1da1[_0x3141('0x75')],[_0x3141('0x76')],[_0x3141('0x77')]);if(_0xef99fd[_0x3141('0x78')]['Applications']){delete _0xef99fd[_0x3141('0x78')][_0x3141('0x75')];}return db[_0x3141('0x79')][_0x3141('0x67')]();})['then'](function(_0x3d776f){if(!_0x3d776f){throw new db[(_0x3141('0x7a'))]['ValidationError'](_0x3141('0x7b'));}_0x3de8ee=_[_0x3141('0x7c')](_[_0x3141('0x46')](_0x3d776f),[_0x3141('0x7d'),_0x3141('0x7e')]);_0xae78f1=_[_0x3141('0x7c')](_[_0x3141('0x46')](_0x3d776f),[_0x3141('0x7d'),'updatedAt',_0x3141('0x7f'),_0x3141('0x80')]);_0xef99fd[_0x3141('0x5c')]={'mapKey':_0x3141('0x81')};if(_0xef99fd[_0x3141('0x78')]['type']){switch(_0xef99fd['account']['type']){case _0x3141('0x82'):_0xef99fd[_0x3141('0x5c')]['from']=_0x33c91b['body'][_0x3141('0x83')];_0xef99fd[_0x3141('0x5c')][_0x3141('0x5c')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x84')];_0xef99fd[_0x3141('0x5c')][_0x3141('0x85')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x86')];break;case'skebby':_0xef99fd[_0x3141('0x5c')][_0x3141('0x87')]='+'+_0x33c91b['body']['sender'];_0xef99fd['body'][_0x3141('0x5c')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x88')];break;case _0x3141('0x89'):_0xef99fd['body'][_0x3141('0x87')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x87')];_0xef99fd[_0x3141('0x5c')][_0x3141('0x5c')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x29')];break;case _0x3141('0x8a'):_0xef99fd[_0x3141('0x5c')][_0x3141('0x87')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x87')];_0xef99fd[_0x3141('0x5c')]['body']=_0x33c91b[_0x3141('0x5c')][_0x3141('0x5c')];_0xef99fd['body']['messageId']=_0x33c91b[_0x3141('0x5c')][_0x3141('0x8b')];break;case'plivo':_0xef99fd[_0x3141('0x5c')][_0x3141('0x87')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x83')];_0xef99fd['body'][_0x3141('0x5c')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x8c')];_0xef99fd[_0x3141('0x5c')][_0x3141('0x85')]=_0x33c91b[_0x3141('0x5c')]['MessageUUID'];break;case _0x3141('0x8d'):_0xef99fd['body']['from']='+'+_0x33c91b[_0x3141('0x5c')][_0x3141('0x8e')][0x0][_0x3141('0x87')];_0xef99fd[_0x3141('0x5c')][_0x3141('0x5c')]=_0x33c91b['body'][_0x3141('0x8e')][0x0]['text'];_0xef99fd['body'][_0x3141('0x85')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x8e')][0x0][_0x3141('0x85')];break;case _0x3141('0x8f'):_0xef99fd[_0x3141('0x5c')]['from']=_0x33c91b[_0x3141('0x5c')][_0x3141('0x90')];_0xef99fd['body'][_0x3141('0x5c')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x91')][_0x3141('0x29')];break;case _0x3141('0x92'):_0xef99fd[_0x3141('0x5c')][_0x3141('0x87')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x93')];_0xef99fd[_0x3141('0x5c')][_0x3141('0x5c')]=_0x33c91b[_0x3141('0x5c')][_0x3141('0x88')];_0xef99fd[_0x3141('0x5c')][_0x3141('0x85')]=_0x33c91b[_0x3141('0x5c')]['replyMessageId'];break;case _0x3141('0x94'):_0xef99fd['body'][_0x3141('0x85')]=_0x33c91b[_0x3141('0x5c')][0x0][_0x3141('0x29')]['id'];_0xef99fd[_0x3141('0x5c')][_0x3141('0x87')]=_0x33c91b['body'][0x0]['message'][_0x3141('0x87')];_0xef99fd[_0x3141('0x5c')]['body']=_0x33c91b[_0x3141('0x5c')][0x0]['message'][_0x3141('0x88')];break;case _0x3141('0x95'):_0xef99fd['body']['from']=_0x33c91b['body']['from'];_0xef99fd[_0x3141('0x5c')]['body']=_0x33c91b[_0x3141('0x5c')][_0x3141('0x29')];_0xef99fd[_0x3141('0x5c')][_0x3141('0x85')]=_0x33c91b[_0x3141('0x5c')]['refid'];break;}}if(_0xef99fd['body']['id']){delete _0xef99fd['body']['id'];}if(_[_0x3141('0x96')](_0xef99fd[_0x3141('0x5c')]['from'])){throw new db[(_0x3141('0x7a'))]['ValidationError'](_0x3141('0x97'));}if(_['isNil'](_0xef99fd[_0x3141('0x5c')]['body'])||_0xef99fd[_0x3141('0x5c')][_0x3141('0x5c')]===''){throw new db[(_0x3141('0x7a'))][(_0x3141('0x98'))](_0x3141('0x99'));}if(_['isNil'](_0xef99fd[_0x3141('0x5c')][_0x3141('0x9a')])){throw new db[(_0x3141('0x7a'))][(_0x3141('0x98'))](_0x3141('0x9b')+_0xae78f1);}if(!_[_0x3141('0x9c')](_0xae78f1,_0xef99fd[_0x3141('0x5c')][_0x3141('0x9a')])){throw new db[(_0x3141('0x7a'))][(_0x3141('0x98'))](_0x3141('0x9d')+_0xae78f1);}_0x1c9730[_0xef99fd[_0x3141('0x5c')][_0x3141('0x9a')]]=_0xef99fd['body'][_0x3141('0x87')];return db['CmList'][_0x3141('0x62')]({'where':{'id':_0xef99fd[_0x3141('0x78')][_0x3141('0x80')]},'include':[{'model':db[_0x3141('0x79')],'as':_0x3141('0x9e'),'where':_0x1c9730,'limit':0x1,'order':[[_0x3141('0x7e'),_0x3141('0x9f')]]}]});})[_0x3141('0x21')](handleEntityNotFound(_0x4aa3cd,null))[_0x3141('0x21')](function(_0x509139){if(_0x509139){_0xef99fd['list']=_[_0x3141('0xa0')](_0x509139,['Contacts']);if(_0x509139['Contacts'][_0x3141('0x4c')]){return _0x509139['Contacts'][0x0];}var _0x3a7971=_[_0x3141('0x1a')](_0xef99fd[_0x3141('0x5c')],{'firstName':_0xef99fd[_0x3141('0x5c')]['from'],'ListId':_0x509139['id']});_0x3a7971[_0xef99fd[_0x3141('0x5c')][_0x3141('0x9a')]]=_0xef99fd[_0x3141('0x5c')][_0x3141('0x87')];return db[_0x3141('0x79')]['create'](_0x3a7971,{'fields':_0x3de8ee,'raw':!![]});}})['then'](handleEntityNotFound(_0x4aa3cd,null))[_0x3141('0x21')](function(_0x4bdd6d){if(_0x4bdd6d){_0xef99fd['contact']=_0x4bdd6d;var _0x2a6a76={'ContactId':_0x4bdd6d['id'],'phone':_0xef99fd[_0x3141('0x5c')][_0x3141('0x87')],'SmsAccountId':_0x33c91b[_0x3141('0x66')]['id']};var _0x1b228c={'ContactId':_0x4bdd6d['id'],'SmsAccountId':_0x33c91b[_0x3141('0x66')]['id'],'closed':![]};return db[_0x3141('0xa1')]['find']({'where':_0x1b228c})[_0x3141('0x21')](function(_0xd4fd81){if(_0xd4fd81){return[_0xd4fd81,![]];}return db['SmsInteraction'][_0x3141('0x5b')](_0x2a6a76)[_0x3141('0x21')](function(_0x659cb4){return[_0x659cb4,!![]];});});}})[_0x3141('0xa2')](function(_0xc9bb01,_0x2b4494){_0xef99fd['interaction']=_0xc9bb01['get']({'plain':!![]});_0xef99fd[_0x3141('0xa3')][_0x3141('0xa4')]=![];if(_0x2b4494){if(_0xef99fd[_0x3141('0x78')][_0x3141('0xa5')]){_0xef99fd['applications'][_0x3141('0xa6')]({'id':0x0,'priority':_0xef99fd['applications'][_0x3141('0x4c')]+0x1,'app':'close','appdata':_0x3141('0xa7'),'interval':_0x3141('0xa8')});}_0xef99fd[_0x3141('0xa3')][_0x3141('0xa4')]=!![];}return db['SmsMessage'][_0x3141('0x5b')]({'phone':_0xef99fd['body'][_0x3141('0x87')],'messageId':_0xef99fd[_0x3141('0x5c')][_0x3141('0x85')],'body':_0xef99fd[_0x3141('0x5c')][_0x3141('0x5c')],'SmsAccountId':_0x33c91b[_0x3141('0x66')]['id'],'SmsInteractionId':_0xc9bb01['id'],'direction':'in','ContactId':_0xc9bb01[_0x3141('0xa9')],'AttachmentId':_0xef99fd[_0x3141('0x5c')]['AttachmentId']});})[_0x3141('0x21')](function(_0x34ae08){_0xef99fd[_0x3141('0x29')]=_0x34ae08;if(_0xef99fd[_0x3141('0xa3')][_0x3141('0xaa')]){return db[_0x3141('0xab')][_0x3141('0x62')]({'attributes':['id','name'],'where':{'id':_0xef99fd[_0x3141('0xa3')][_0x3141('0xaa')]}})[_0x3141('0x21')](function(_0x4c26dd){if(_0x4c26dd){_0xef99fd[_0x3141('0xac')][_0x3141('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c26dd[_0x3141('0x3a')]+','+(_0xef99fd[_0x3141('0x78')][_0x3141('0xae')]||0xa),'interval':_0x3141('0xa8')});}return respondWithRpcPromise(_0x3141('0xaf'),_0x3141('0xb0'),_0xef99fd);});}return respondWithRpcPromise(_0x3141('0xaf'),_0x3141('0xb0'),_0xef99fd);})[_0x3141('0x21')](function(_0x6fae00){if(_0x6fae00){var _0x429365=0xc8;var _0x40aa11='receiveMessage';logger['info'](_0x3141('0xb1'),_0x40aa11,_0x429365,_0x3141('0xb2'));logger['debug'](_0x3141('0xb3'),_0x40aa11,_0x429365,_0x3141('0xb2'),JSON[_0x3141('0x26')](_0x6fae00));if(_0xef99fd[_0x3141('0x78')]['type']===_0x3141('0x82')){return _0x4aa3cd[_0x3141('0x2c')](_0x429365)[_0x3141('0x31')](_0x3141('0xb4'),'text/xml')[_0x3141('0x3b')]('\x0a');}else{return _0x4aa3cd[_0x3141('0x2c')](_0x429365)[_0x3141('0x32')](_0x6fae00);}}})[_0x3141('0x2a')](handleError(_0x4aa3cd,null));};exports[_0x3141('0xb5')]=function(_0x1530d9,_0x467742){var _0x2e3741=_0x1530d9[_0x3141('0x66')]['id'];var _0x359d48=_0x1530d9[_0x3141('0x5c')];var _0x3117ba=0xc8;var _0x4dc0d3=null;return db['sequelize'][_0x3141('0xb6')]({'isolationLevel':db[_0x3141('0xb7')][_0x3141('0xb8')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x68c330){return db[_0x3141('0x40')][_0x3141('0x6c')]({'where':{'id':_0x2e3741},'transaction':_0x68c330})[_0x3141('0x21')](function(_0x493a46){if(_0x493a46){return db[_0x3141('0x74')]['destroy']({'where':{'SmsAccountId':_0x2e3741},'transaction':_0x68c330})[_0x3141('0x21')](function(){var _0x3ccafb=_['map'](_0x359d48,function(_0x59ae5c){_0x59ae5c[_0x3141('0x69')]=_0x2e3741;return _0x59ae5c;});return db['SmsApplication'][_0x3141('0xb9')](_0x3ccafb,{'transaction':_0x68c330});});}else{_0x3117ba=0x194;_0x4dc0d3=[];}});})[_0x3141('0x21')](function(){if(_0x3117ba!==0x194){return db[_0x3141('0x74')][_0x3141('0xba')]({'where':{'SmsAccountId':_0x2e3741},'order':_0x3141('0x76')})[_0x3141('0x21')](function(_0x284630){_0x4dc0d3=_0x284630;});}})[_0x3141('0x2a')](function(_0x1ed820){_0x3117ba=0x1f4;logger[_0x3141('0x27')](_0x1ed820[_0x3141('0x39')]);if(_0x1ed820[_0x3141('0x3a')]){delete _0x1ed820[_0x3141('0x3a')];}_0x4dc0d3=_0x1ed820;})['finally'](function(){if(_0x4dc0d3===null){_0x467742['sendStatus'](_0x3117ba);}else{if(_0x3117ba===0x1f4){_0x467742['status'](_0x3117ba)[_0x3141('0x3b')](_0x4dc0d3);}else{_0x467742['status'](_0x3117ba)[_0x3141('0x32')](_0x4dc0d3);}}});};exports[_0x3141('0xbb')]=function(_0x4ca196,_0x56cc8f,_0x31db54){var _0x4be27d={};var _0x3df8ed={};var _0x293f17;var _0x2b4a6a;return db[_0x3141('0x40')]['findOne']({'where':{'id':_0x4ca196[_0x3141('0x66')]['id']}})['then'](handleEntityNotFound(_0x56cc8f,null))[_0x3141('0x21')](function(_0x17f0df){if(_0x17f0df){_0x293f17=_0x17f0df;_0x3df8ed['model']=_[_0x3141('0x46')](db[_0x3141('0x74')][_0x3141('0x41')]);_0x3df8ed[_0x3141('0x45')]=_[_0x3141('0x46')](_0x4ca196[_0x3141('0x45')]);_0x3df8ed[_0x3141('0x47')]=_[_0x3141('0x48')](_0x3df8ed['model'],_0x3df8ed[_0x3141('0x45')]);_0x4be27d[_0x3141('0x4b')]=_['intersection'](_0x3df8ed['model'],qs[_0x3141('0x4a')](_0x4ca196[_0x3141('0x45')][_0x3141('0x4a')]));_0x4be27d['attributes']=_0x4be27d[_0x3141('0x4b')][_0x3141('0x4c')]?_0x4be27d[_0x3141('0x4b')]:_0x3df8ed[_0x3141('0x49')];_0x4be27d[_0x3141('0x4f')]=qs[_0x3141('0x70')](_0x4ca196[_0x3141('0x45')][_0x3141('0x70')]);_0x4be27d[_0x3141('0x50')]=qs[_0x3141('0x47')](_[_0x3141('0x51')](_0x4ca196[_0x3141('0x45')],_0x3df8ed[_0x3141('0x47')]));if(_0x4ca196[_0x3141('0x45')][_0x3141('0x53')]){_0x4be27d[_0x3141('0x50')]=_['merge'](_0x4be27d[_0x3141('0x50')],{'$or':_['map'](_0x4be27d[_0x3141('0x4b')],function(_0x473952){var _0x8b91e3={};_0x8b91e3[_0x473952]={'$like':'%'+_0x4ca196['query']['filter']+'%'};return _0x8b91e3;})});}_0x4be27d=_[_0x3141('0x54')]({},_0x4be27d,_0x4ca196[_0x3141('0x5a')]);return _0x293f17[_0x3141('0xbb')](_0x4be27d);}})[_0x3141('0x21')](function(_0x10a16b){if(_0x10a16b){_0x2b4a6a=_0x10a16b['length'];if(!_0x4ca196[_0x3141('0x45')][_0x3141('0x4d')](_0x3141('0x4e'))){_0x4be27d[_0x3141('0x30')]=qs[_0x3141('0x30')](_0x4ca196[_0x3141('0x45')][_0x3141('0x30')]);_0x4be27d[_0x3141('0x2e')]=qs[_0x3141('0x2e')](_0x4ca196[_0x3141('0x45')][_0x3141('0x2e')]);}return _0x293f17[_0x3141('0xbb')](_0x4be27d);}})[_0x3141('0x21')](function(_0x56be6f){if(_0x56be6f){return _0x56be6f?{'count':_0x2b4a6a,'rows':_0x56be6f}:null;}})[_0x3141('0x21')](respondWithResult(_0x56cc8f,null))[_0x3141('0x2a')](handleError(_0x56cc8f,null));};exports[_0x3141('0xbc')]=function(_0x58a4a7,_0x2cd93a,_0x473e2a){var _0x5f448f={'raw':![],'where':{}};var _0x4bcfbc={};var _0x106b69={'count':0x0,'rows':[]};return db[_0x3141('0x40')][_0x3141('0x6c')]({'where':{'id':_0x58a4a7['params']['id']}})[_0x3141('0x21')](handleEntityNotFound(_0x2cd93a,null))[_0x3141('0x21')](function(_0x26e2c4){if(_0x26e2c4){_0x4bcfbc[_0x3141('0x49')]=_[_0x3141('0x46')](db[_0x3141('0xa1')][_0x3141('0x41')]);_0x4bcfbc[_0x3141('0x45')]=_[_0x3141('0x46')](_0x58a4a7[_0x3141('0x45')]);_0x4bcfbc[_0x3141('0x47')]=_[_0x3141('0x48')](_0x4bcfbc[_0x3141('0x49')],_0x4bcfbc['query']);_0x5f448f[_0x3141('0x4b')]=_[_0x3141('0x48')](_0x4bcfbc[_0x3141('0x49')],qs[_0x3141('0x4a')](_0x58a4a7['query'][_0x3141('0x4a')]));_0x5f448f[_0x3141('0x4b')]=_0x5f448f['attributes'][_0x3141('0x4c')]?_0x5f448f['attributes']:_0x4bcfbc[_0x3141('0x49')];if(!_0x58a4a7[_0x3141('0x45')]['hasOwnProperty'](_0x3141('0x4e'))){_0x5f448f[_0x3141('0x30')]=qs[_0x3141('0x30')](_0x58a4a7[_0x3141('0x45')][_0x3141('0x30')]);_0x5f448f[_0x3141('0x2e')]=qs['offset'](_0x58a4a7['query']['offset']);}_0x5f448f['order']=qs[_0x3141('0x70')](_0x58a4a7[_0x3141('0x45')][_0x3141('0x70')]);_0x5f448f[_0x3141('0x50')]=qs['filters'](_[_0x3141('0x51')](_0x58a4a7[_0x3141('0x45')],_0x4bcfbc[_0x3141('0x47')]));_0x5f448f['where']['SmsAccountId']=_0x26e2c4['id'];if(_0x58a4a7[_0x3141('0x45')][_0x3141('0x53')]){_0x5f448f[_0x3141('0x50')]=_['merge'](_0x5f448f[_0x3141('0x50')],{'$or':_['map'](_0x5f448f['attributes'],function(_0x2b7655){var _0x415c02={};_0x415c02[_0x2b7655]={'$like':'%'+_0x58a4a7[_0x3141('0x45')][_0x3141('0x53')]+'%'};return _0x415c02;})});}_0x5f448f=_[_0x3141('0x54')]({},_0x5f448f,_0x58a4a7[_0x3141('0x5a')]);return db[_0x3141('0xa1')][_0x3141('0x2f')]({'where':_0x5f448f[_0x3141('0x50')]})[_0x3141('0x21')](function(_0x5821e7){_0x106b69[_0x3141('0x2f')]=_0x5821e7;if(_0x58a4a7[_0x3141('0x45')][_0x3141('0x55')]){_0x5f448f[_0x3141('0x56')]=[{'model':db[_0x3141('0x79')],'as':_0x3141('0xbd'),'required':![]},{'model':db[_0x3141('0xab')],'as':_0x3141('0xbe'),'attributes':[_0x3141('0x3a'),_0x3141('0xbf'),_0x3141('0xc0')],'required':![]},{'model':db['Tag'],'as':_0x3141('0xc1'),'attributes':['id','name',_0x3141('0xc2')],'where':_0x58a4a7[_0x3141('0x45')][_0x3141('0xc3')]?{'id':_0x58a4a7['query'][_0x3141('0xc3')]}:undefined,'required':_0x58a4a7[_0x3141('0x45')]['tag']?!![]:![]}];}return db[_0x3141('0xa1')][_0x3141('0x57')](_0x5f448f);})[_0x3141('0x21')](function(_0x12a1bd){_0x106b69[_0x3141('0x58')]=_0x12a1bd;return _0x106b69;});}})[_0x3141('0x21')](respondWithFilteredResult(_0x2cd93a,_0x5f448f))[_0x3141('0x2a')](handleError(_0x2cd93a,null));};exports['send']=function(_0x24cac1,_0x1c93d3,_0x3319ba){var _0x1b21e1,_0x4569c0,_0x5926aa;if(_[_0x3141('0x96')](_0x24cac1[_0x3141('0x5c')][_0x3141('0x5c')])||_0x24cac1[_0x3141('0x5c')][_0x3141('0x5c')]===''){throw new db[(_0x3141('0x7a'))][(_0x3141('0x98'))](_0x3141('0x99'));}if(_[_0x3141('0x96')](_0x24cac1[_0x3141('0x5c')]['to'])){throw new db[(_0x3141('0x7a'))][(_0x3141('0x98'))](_0x3141('0xc4'));}_0x1b21e1=_0x24cac1['body']['to'];return db[_0x3141('0x40')][_0x3141('0x62')]({'where':{'id':_0x24cac1[_0x3141('0x66')]['id']},'include':[{'model':db[_0x3141('0xc5')],'as':'List','include':[{'model':db[_0x3141('0x79')],'as':'Contacts','where':{'mobile':_0x1b21e1},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x1c93d3,null))[_0x3141('0x21')](function(_0x482d6c){if(_0x482d6c&&_0x482d6c[_0x3141('0xc6')]){_0x4569c0=_0x482d6c[_0x3141('0x37')]({'plain':!![]});if(_0x4569c0[_0x3141('0xc6')]&&_0x4569c0['List'][_0x3141('0x9e')][_0x3141('0x4c')]){return _0x4569c0['List']['Contacts'][0x0];}return db[_0x3141('0x79')][_0x3141('0x5b')](_[_0x3141('0x1a')](_0x24cac1[_0x3141('0x5c')],{'firstName':_0x1b21e1,'mobile':_0x1b21e1,'phone':_0x1b21e1,'ListId':_0x4569c0[_0x3141('0x80')]}));}})[_0x3141('0x21')](handleEntityNotFound(_0x1c93d3,null))[_0x3141('0x21')](function(_0x439d0a){if(_0x439d0a){_0x5926aa=_0x439d0a;return db['SmsInteraction'][_0x3141('0x62')]({'where':{'ContactId':_0x5926aa['id'],'closed':![],'SmsAccountId':_0x4569c0['id']}})[_0x3141('0x21')](function(_0x1fc524){if(_0x1fc524){return[_0x1fc524,![]];}return db[_0x3141('0xa1')]['create']({'UserId':_0x24cac1[_0x3141('0x5d')]['id'],'ContactId':_0x5926aa['id'],'SmsAccountId':_0x4569c0['id'],'phone':_0x1b21e1,'firstMsgDirection':_0x3141('0xc7'),'Messages':[_[_0x3141('0x54')](_0x24cac1[_0x3141('0x5c')],{'read':![],'body':_0x24cac1[_0x3141('0x5c')][_0x3141('0x5c')],'phone':_0x1b21e1,'SmsAccountId':_0x4569c0['id'],'UserId':_0x24cac1['user']['id'],'ContactId':_0x5926aa['id']})]},{'include':[{'model':db[_0x3141('0xc8')],'as':_0x3141('0xc9')}]})[_0x3141('0x21')](function(_0x5808b6){return[_0x5808b6,!![]];});});}})[_0x3141('0xa2')](function(_0x128d08,_0x1221d7){if(_0x1221d7){return _0x128d08;}return db[_0x3141('0xc8')][_0x3141('0x5b')](_['merge'](_0x24cac1[_0x3141('0x5c')],{'read':![],'body':_0x24cac1[_0x3141('0x5c')][_0x3141('0x5c')],'phone':_0x1b21e1,'SmsAccountId':_0x4569c0['id'],'SmsInteractionId':_0x128d08['id'],'UserId':_0x24cac1['user']['id'],'ContactId':_0x5926aa['id']}))[_0x3141('0x21')](function(_0x3e123e){_0x128d08['dataValues'][_0x3141('0xc9')]=[];_0x128d08[_0x3141('0xca')][_0x3141('0xc9')][_0x3141('0xa6')](_0x3e123e[_0x3141('0xca')]);return _0x128d08;});})[_0x3141('0x21')](respondWithResult(_0x1c93d3,null))[_0x3141('0x2a')](handleError(_0x1c93d3,null));};exports[_0x3141('0x2c')]=function(_0x217c16,_0x3ef450,_0x1b11f3){if(_0x217c16[_0x3141('0x5c')]['id']){delete _0x217c16[_0x3141('0x5c')]['id'];}var _0x4a245b,_0x134830,_0x1a29c1;return db[_0x3141('0x40')][_0x3141('0x62')]({'where':{'id':_0x217c16[_0x3141('0x66')]['id']}})[_0x3141('0x21')](handleEntityNotFound(_0x3ef450,null))[_0x3141('0x21')](function(_0xd93d3c){if(_0xd93d3c){_0x1a29c1=_0xd93d3c;logger[_0x3141('0x25')](_0x3141('0xb1'),_0x3141('0x2c'),_0x3141('0xcb'),_0xd93d3c['type'],util[_0x3141('0xcc')](_0x217c16[_0x3141('0x5c')],{'showHidden':![],'depth':null}));switch(_0xd93d3c[_0x3141('0x43')]){case _0x3141('0xcd'):if(_0x217c16['body'][_0x3141('0xce')]&&_0x217c16[_0x3141('0x5c')][_0x3141('0x2c')]){_0x134830=_0x217c16['body'][_0x3141('0x2c')];return db[_0x3141('0xc8')][_0x3141('0x62')]({'where':{'messageId':_0x217c16[_0x3141('0x5c')]['skebby_dispatch_id']}});}break;case _0x3141('0x89'):if(_0x217c16['body']['requestid']&&_0x217c16['body']['statusInt']){_0x134830=_0x217c16[_0x3141('0x5c')]['statusInt'];return db['SmsMessage'][_0x3141('0x62')]({'where':{'messageId':_0x217c16[_0x3141('0x5c')][_0x3141('0xcf')]}});}break;case'clicksend':if(_0x217c16[_0x3141('0x5c')][_0x3141('0x8b')]&&_0x217c16['body'][_0x3141('0xd0')]){_0x134830=_0x217c16[_0x3141('0x5c')][_0x3141('0xd0')];return db[_0x3141('0xc8')]['find']({'where':{'messageId':_0x217c16['body'][_0x3141('0x8b')]}});}break;case _0x3141('0x8d'):var _0x2be5d5=_0x217c16[_0x3141('0x5c')]['results'][0x0];if(_0x2be5d5[_0x3141('0x85')]&&_0x2be5d5[_0x3141('0x2c')][_0x3141('0xd1')]===_0x3141('0xd2')){_0x134830=_0x2be5d5[_0x3141('0x2c')][_0x3141('0xd1')];return db[_0x3141('0xc8')][_0x3141('0x62')]({'where':{'messageId':_0x2be5d5['messageId']}});}break;case _0x3141('0x92'):if(_0x217c16['body'][_0x3141('0x85')]&&_0x217c16[_0x3141('0x5c')]['status']){_0x134830=_0x217c16[_0x3141('0x5c')][_0x3141('0x2c')];return db[_0x3141('0xc8')][_0x3141('0x62')]({'where':{'messageId':_0x217c16['body'][_0x3141('0x85')]}});}break;case'bandwidth':if(_0x217c16[_0x3141('0x5c')][0x0]['message']['id']){_0x134830=_0x217c16[_0x3141('0x5c')][0x0][_0x3141('0x43')];return db[_0x3141('0xc8')][_0x3141('0x62')]({'where':{'messageId':_0x217c16[_0x3141('0x5c')][0x0][_0x3141('0x29')]['id']}});}break;case _0x3141('0x95'):if(_0x217c16['body'][_0x3141('0xd3')]&&_0x217c16[_0x3141('0x5c')][_0x3141('0x2c')]){_0x134830=_0x217c16[_0x3141('0x5c')]['status'];return db[_0x3141('0xc8')][_0x3141('0x62')]({'where':{'messageId':_0x217c16[_0x3141('0x5c')][_0x3141('0xd3')]}});}break;}}})[_0x3141('0x21')](handleEntityNotFound(_0x3ef450,null))['then'](function(_0x4caa93){if(_0x4caa93){_0x4a245b=_0x4caa93;switch(_0x1a29c1['type']){case _0x3141('0xcd'):if(_0x134830===_0x3141('0xd2')){return _0x4a245b[_0x3141('0x35')]({'read':!![]});}else{logger[_0x3141('0x27')](_0x3141('0xb1'),'status',_0x3141('0xcd'),util[_0x3141('0xcc')](_0x217c16[_0x3141('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x134830==='1'){return _0x4a245b[_0x3141('0x35')]({'read':!![]});}else{logger[_0x3141('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3141('0x2c'),_0x3141('0xcd'),util[_0x3141('0xcc')](_0x217c16[_0x3141('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x3141('0x8a'):if(!_0x217c16[_0x3141('0x5c')][_0x3141('0xd4')]&&_0x134830>=0xc8&&_0x134830<=0xce){return _0x4a245b[_0x3141('0x35')]({'read':!![]});}else{logger[_0x3141('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3141('0x2c'),_0x3141('0x8a'),util['inspect'](_0x217c16['body'],{'showHidden':![],'depth':null}));}break;case _0x3141('0x8d'):var _0x8de5c1=_0x217c16[_0x3141('0x5c')][_0x3141('0x8e')][0x0];if(_0x8de5c1[_0x3141('0x2c')][_0x3141('0xd1')]===_0x3141('0xd2')){return _0x4a245b['update']({'read':!![]});}else{logger[_0x3141('0x27')](_0x3141('0xb1'),_0x3141('0x2c'),_0x3141('0x8d'),util[_0x3141('0xcc')](_0x217c16[_0x3141('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x3141('0x92'):if(_0x134830=='DELIVERED_TO_GATEWAY'||_0x134830==_0x3141('0xd5')){return _0x4a245b[_0x3141('0x35')]({'read':!![]});}else{logger['error'](_0x3141('0xb1'),_0x3141('0x2c'),_0x3141('0x92'),util[_0x3141('0xcc')](_0x217c16[_0x3141('0x5c')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x134830==_0x3141('0xd6')){return _0x4a245b[_0x3141('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3141('0x2c'),'bandwidth',util[_0x3141('0xcc')](_0x217c16[_0x3141('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x3141('0x95'):if(_0x134830==='DELIVRD'||_0x134830===_0x3141('0xd7')){return _0x4a245b[_0x3141('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x3141('0x95'),util[_0x3141('0xcc')](_0x217c16[_0x3141('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x4a245b;}})[_0x3141('0x21')](respondWithResult(_0x3ef450,null))[_0x3141('0x2a')](handleError(_0x3ef450,null));};exports[_0x3141('0xd8')]=function(_0x52696c,_0x994d2b,_0x522e4b){var _0xaefc47,_0x1d2c06,_0x3f714e;return db['SmsAccount'][_0x3141('0x62')]({'where':{'id':_0x52696c[_0x3141('0x66')]['id']}})[_0x3141('0x21')](handleEntityNotFound(_0x994d2b,null))[_0x3141('0x21')](function(_0xa10171){if(_0xa10171){_0x3f714e=_0xa10171;logger[_0x3141('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3141('0x2c'),_0x3141('0xcb'),_0xa10171['type'],util[_0x3141('0xcc')](_0x52696c[_0x3141('0x45')],{'showHidden':![],'depth':null}));switch(_0xa10171[_0x3141('0x43')]){case _0x3141('0x8f'):if(_0x52696c[_0x3141('0x45')]['message-id']&&_0x52696c[_0x3141('0x45')]['state']){_0x1d2c06=_0x52696c[_0x3141('0x45')][_0x3141('0xd9')];return db[_0x3141('0xc8')]['find']({'where':{'messageId':_0x52696c[_0x3141('0x45')][_0x3141('0xda')]}});}break;}}})[_0x3141('0x21')](handleEntityNotFound(_0x994d2b,null))[_0x3141('0x21')](function(_0x3d78a4){if(_0x3d78a4){_0xaefc47=_0x3d78a4;switch(_0x3f714e['type']){case _0x3141('0x8f'):if(_0x1d2c06==='2'||_0x1d2c06==='6'){return _0xaefc47[_0x3141('0x35')]({'read':!![]});}else{logger[_0x3141('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3141('0x2c'),_0x3141('0x8f'),util[_0x3141('0xcc')](_0x52696c['query'],{'showHidden':![],'depth':null}));};break;}return _0xaefc47;}})[_0x3141('0x21')](respondWithResult(_0x994d2b,null))[_0x3141('0x2a')](handleError(_0x994d2b,null));};exports[_0x3141('0xdb')]=function(_0xecf6e0,_0x119097,_0x4c4ae8){return db[_0x3141('0x40')][_0x3141('0x62')]({'where':{'id':_0xecf6e0[_0x3141('0x66')]['id']}})[_0x3141('0x21')](handleEntityNotFound(_0x119097,null))['then'](function(_0x40f0d6){if(_0x40f0d6){return _0x40f0d6['addAgents'](_0xecf6e0['body']['ids'],_[_0x3141('0xa0')](_0xecf6e0['body'],['ids','id'])||{})[_0x3141('0xa2')](function(_0x12c4e2){for(var _0x17ccd8=0x0;_0x17ccd8<_0xecf6e0[_0x3141('0x5c')]['ids'][_0x3141('0x4c')];_0x17ccd8+=0x1){socket[_0x3141('0xdc')](_0x3141('0xdd'),{'UserId':Number(_0xecf6e0['body'][_0x3141('0x71')][_0x17ccd8]),'SmsAccountId':Number(_0xecf6e0['params']['id'])});}return _0x12c4e2;});}})[_0x3141('0x21')](respondWithResult(_0x119097,null))['catch'](handleError(_0x119097,null));};exports[_0x3141('0xde')]=function(_0x2c2bf5,_0x1ccd58,_0x302c6e){return db[_0x3141('0x40')]['find']({'where':{'id':_0x2c2bf5[_0x3141('0x66')]['id']}})[_0x3141('0x21')](handleEntityNotFound(_0x1ccd58,null))['then'](function(_0x423adb){if(_0x423adb){return _0x423adb[_0x3141('0xde')](_0x2c2bf5[_0x3141('0x45')][_0x3141('0x71')])[_0x3141('0x21')](function(){if(_[_0x3141('0xdf')](_0x2c2bf5[_0x3141('0x45')][_0x3141('0x71')])){for(var _0x2bfcad=0x0;_0x2bfcad<_0x2c2bf5['query'][_0x3141('0x71')][_0x3141('0x4c')];_0x2bfcad+=0x1){socket['emit'](_0x3141('0xe0'),{'UserId':Number(_0x2c2bf5[_0x3141('0x45')][_0x3141('0x71')][_0x2bfcad]),'SmsAccountId':Number(_0x2c2bf5[_0x3141('0x66')]['id'])});}}else{socket[_0x3141('0xdc')](_0x3141('0xe0'),{'UserId':Number(_0x2c2bf5[_0x3141('0x45')]['ids']),'SmsAccountId':Number(_0x2c2bf5[_0x3141('0x66')]['id'])});}});}})[_0x3141('0x21')](respondWithStatusCode(_0x1ccd58,null))[_0x3141('0x2a')](handleError(_0x1ccd58,null));};exports[_0x3141('0xe1')]=function(_0x4dea6c,_0xe0aa81,_0x5adef5){var _0x5484c9={};var _0x22b8b4={};var _0x374ec7;var _0xd2222f;return db[_0x3141('0x40')][_0x3141('0x6c')]({'where':{'id':_0x4dea6c[_0x3141('0x66')]['id']}})['then'](handleEntityNotFound(_0xe0aa81,null))['then'](function(_0x2da814){if(_0x2da814){_0x374ec7=_0x2da814;_0x22b8b4['model']=_[_0x3141('0x46')](db['User'][_0x3141('0x41')]);_0x22b8b4[_0x3141('0x45')]=_[_0x3141('0x46')](_0x4dea6c[_0x3141('0x45')]);_0x22b8b4['filters']=_['intersection'](_0x22b8b4['model'],_0x22b8b4[_0x3141('0x45')]);_0x5484c9[_0x3141('0x4b')]=_['intersection'](_0x22b8b4['model'],qs[_0x3141('0x4a')](_0x4dea6c[_0x3141('0x45')][_0x3141('0x4a')]));_0x5484c9[_0x3141('0x4b')]=_0x5484c9['attributes'][_0x3141('0x4c')]?_0x5484c9[_0x3141('0x4b')]:_0x22b8b4['model'];_0x5484c9[_0x3141('0x4f')]=qs[_0x3141('0x70')](_0x4dea6c[_0x3141('0x45')][_0x3141('0x70')]);_0x5484c9[_0x3141('0x50')]=qs['filters'](_['pick'](_0x4dea6c[_0x3141('0x45')],_0x22b8b4[_0x3141('0x47')]));if(_0x4dea6c[_0x3141('0x45')][_0x3141('0x53')]){_0x5484c9[_0x3141('0x50')]=_[_0x3141('0x54')](_0x5484c9[_0x3141('0x50')],{'$or':_[_0x3141('0x3f')](_0x5484c9[_0x3141('0x4b')],function(_0x181935){var _0x26533d={};_0x26533d[_0x181935]={'$like':'%'+_0x4dea6c[_0x3141('0x45')]['filter']+'%'};return _0x26533d;})});}_0x5484c9=_[_0x3141('0x54')]({},_0x5484c9,_0x4dea6c[_0x3141('0x5a')]);return _0x374ec7[_0x3141('0xe1')](_0x5484c9);}})[_0x3141('0x21')](function(_0x3feb05){if(_0x3feb05){_0xd2222f=_0x3feb05[_0x3141('0x4c')];if(!_0x4dea6c[_0x3141('0x45')]['hasOwnProperty'](_0x3141('0x4e'))){_0x5484c9[_0x3141('0x30')]=qs[_0x3141('0x30')](_0x4dea6c[_0x3141('0x45')][_0x3141('0x30')]);_0x5484c9[_0x3141('0x2e')]=qs[_0x3141('0x2e')](_0x4dea6c[_0x3141('0x45')][_0x3141('0x2e')]);}return _0x374ec7['getAgents'](_0x5484c9);}})[_0x3141('0x21')](function(_0x4da0ac){if(_0x4da0ac){return _0x4da0ac?{'count':_0xd2222f,'rows':_0x4da0ac}:null;}})[_0x3141('0x21')](respondWithResult(_0xe0aa81,null))[_0x3141('0x2a')](handleError(_0xe0aa81,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 18ac413..3da98e3 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 _0x85c2=['exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x3cb70b,_0x50344c){var _0x3c98f4=function(_0x47ddcb){while(--_0x47ddcb){_0x3cb70b['push'](_0x3cb70b['shift']());}};_0x3c98f4(++_0x50344c);}(_0x85c2,0x189));var _0x285c=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x85c2[_0x1b4b23];return _0x2a325b;};'use strict';var EventEmitter=require(_0x285c('0x0'));var SmsAccount=require(_0x285c('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x285c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x285c('0x3'),'afterDestroy':_0x285c('0x4')};function emitEvent(_0x43e5ea){return function(_0x386da6,_0x3233d2,_0x244252){SmsAccountEvents[_0x285c('0x5')](_0x43e5ea+':'+_0x386da6['id'],_0x386da6);SmsAccountEvents[_0x285c('0x5')](_0x43e5ea,_0x386da6);_0x244252(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x285c('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x0d4e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','SmsAccount'];(function(_0x4941af,_0x10ae5c){var _0x3c68d2=function(_0xf4eacc){while(--_0xf4eacc){_0x4941af['push'](_0x4941af['shift']());}};_0x3c68d2(++_0x10ae5c);}(_0x0d4e,0xba));var _0xe0d4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0d4e[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0xe0d4('0x0'));var SmsAccount=require(_0xe0d4('0x1'))['db'][_0xe0d4('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe0d4('0x3')](0x0);var events={'afterCreate':_0xe0d4('0x4'),'afterUpdate':_0xe0d4('0x5'),'afterDestroy':_0xe0d4('0x6')};function emitEvent(_0x2d338c){return function(_0x3a3560,_0x4d4cfc,_0x25637b){SmsAccountEvents['emit'](_0x2d338c+':'+_0x3a3560['id'],_0x3a3560);SmsAccountEvents[_0xe0d4('0x7')](_0x2d338c,_0x3a3560);_0x25637b(null);};}for(var e in events){if(events[_0xe0d4('0x8')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 4c4c634..5e0f973 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 _0xd56a=['SmsAccount','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0xd56a,0x179));var _0xad56=function(_0x2714ad,_0x4c160c){_0x2714ad=_0x2714ad-0x0;var _0x3f6158=_0xd56a[_0x2714ad];return _0x3f6158;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xad56('0x0'));var rp=require(_0xad56('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad56('0x2'));var config=require(_0xad56('0x3'));var attributes=require(_0xad56('0x4'));module[_0xad56('0x5')]=function(_0x3cda88,_0x3ac3ce){return _0x3cda88[_0xad56('0x6')](_0xad56('0x7'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x303e=['sms_accounts','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x303e,0xf1));var _0xe303=function(_0x597e6b,_0x4ccf1b){_0x597e6b=_0x597e6b-0x0;var _0x3c0ffe=_0x303e[_0x597e6b];return _0x3c0ffe;};'use strict';var _=require(_0xe303('0x0'));var util=require('util');var logger=require(_0xe303('0x1'))(_0xe303('0x2'));var moment=require(_0xe303('0x3'));var BPromise=require('bluebird');var rp=require(_0xe303('0x4'));var fs=require('fs');var path=require(_0xe303('0x5'));var rimraf=require(_0xe303('0x6'));var config=require(_0xe303('0x7'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0xb2c0fa,_0x16c0fb){return _0xb2c0fa[_0xe303('0x8')]('SmsAccount',attributes,{'tableName':_0xe303('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 5ff7e30..4049da8 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 _0x133e=['map','model','attributes','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include'];(function(_0x2d5f4b,_0xd5fc56){var _0x59f5fc=function(_0x4b0ca5){while(--_0x4b0ca5){_0x2d5f4b['push'](_0x2d5f4b['shift']());}};_0x59f5fc(++_0xd5fc56);}(_0x133e,0x1a8));var _0xe133=function(_0x4706a6,_0x5a1c63){_0x4706a6=_0x4706a6-0x0;var _0x1bb705=_0x133e[_0x4706a6];return _0x1bb705;};'use strict';var _=require(_0xe133('0x0'));var util=require(_0xe133('0x1'));var moment=require(_0xe133('0x2'));var BPromise=require('bluebird');var rs=require(_0xe133('0x3'));var fs=require('fs');var Redis=require(_0xe133('0x4'));var db=require(_0xe133('0x5'))['db'];var utils=require(_0xe133('0x6'));var logger=require('../../config/logger')(_0xe133('0x7'));var config=require(_0xe133('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe133('0x9')][_0xe133('0xa')]({'port':0x232a});config[_0xe133('0xb')]=_['defaults'](config['redis'],{'host':_0xe133('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe133('0xb')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x137fce,_0x31288b,_0x10f144){return new BPromise(function(_0xbe7267,_0x55224e){return client[_0xe133('0xd')](_0x137fce,_0x10f144)[_0xe133('0xe')](function(_0x4246a0){logger[_0xe133('0xf')](_0xe133('0x10'),_0x31288b,_0xe133('0x11'));logger[_0xe133('0x12')](_0xe133('0x13'),_0x31288b,_0xe133('0x11'),JSON['stringify'](_0x4246a0));if(_0x4246a0['error']){if(_0x4246a0['error']['code']===0x1f4){logger[_0xe133('0x14')]('SmsAccount,\x20%s,\x20%s',_0x31288b,_0x4246a0['error'][_0xe133('0x15')]);return _0x55224e(_0x4246a0[_0xe133('0x14')]['message']);}logger[_0xe133('0x14')](_0xe133('0x10'),_0x31288b,_0x4246a0[_0xe133('0x14')][_0xe133('0x15')]);return _0xbe7267(_0x4246a0['error'][_0xe133('0x15')]);}else{logger[_0xe133('0xf')](_0xe133('0x10'),_0x31288b,_0xe133('0x11'));_0xbe7267(_0x4246a0[_0xe133('0x16')][_0xe133('0x15')]);}})[_0xe133('0x17')](function(_0x4ab96b){logger[_0xe133('0x14')](_0xe133('0x10'),_0x31288b,_0x4ab96b);_0x55224e(_0x4ab96b);});});}exports[_0xe133('0x18')]=function(_0x17fd55){var _0x2f0666=this;return new Promise(function(_0x1fae95,_0x178733){return db[_0xe133('0x19')][_0xe133('0x1a')]({'raw':_0x17fd55[_0xe133('0x1b')]?_0x17fd55[_0xe133('0x1b')][_0xe133('0x1c')]===undefined?!![]:![]:!![],'where':_0x17fd55[_0xe133('0x1b')]?_0x17fd55[_0xe133('0x1b')][_0xe133('0x1d')]||null:null,'attributes':_0x17fd55['options']?_0x17fd55[_0xe133('0x1b')]['attributes']||null:null,'include':_0x17fd55[_0xe133('0x1b')]?_0x17fd55[_0xe133('0x1b')][_0xe133('0x1e')]?_[_0xe133('0x1f')](_0x17fd55['options'][_0xe133('0x1e')],function(_0x2f1fa2){return{'model':db[_0x2f1fa2[_0xe133('0x20')]],'as':_0x2f1fa2['as'],'attributes':_0x2f1fa2[_0xe133('0x21')],'include':_0x2f1fa2['include']?_[_0xe133('0x1f')](_0x2f1fa2[_0xe133('0x1e')],function(_0x100b8b){return{'model':db[_0x100b8b[_0xe133('0x20')]],'as':_0x100b8b['as'],'attributes':_0x100b8b[_0xe133('0x21')],'include':_0x100b8b['include']?_['map'](_0x100b8b[_0xe133('0x1e')],function(_0x35d0cb){return{'model':db[_0x35d0cb['model']],'as':_0x35d0cb['as'],'attributes':_0x35d0cb[_0xe133('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe133('0xe')](function(_0x402e4b){logger[_0xe133('0xf')]('ShowSmsAccount',_0x17fd55);logger['debug'](_0xe133('0x18'),_0x17fd55,JSON[_0xe133('0x22')](_0x402e4b));_0x1fae95(_0x402e4b);})[_0xe133('0x17')](function(_0x187b37){logger[_0xe133('0x14')](_0xe133('0x18'),_0x187b37[_0xe133('0x15')],_0x17fd55);_0x178733(_0x2f0666[_0xe133('0x14')](0x1f4,_0x187b37[_0xe133('0x15')]));});});}; \ No newline at end of file +var _0x02e6=['lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSmsAccount','find','options','raw','where','attributes','include','model','map','catch'];(function(_0x497658,_0xd8c99b){var _0x318524=function(_0x1b9690){while(--_0x1b9690){_0x497658['push'](_0x497658['shift']());}};_0x318524(++_0xd8c99b);}(_0x02e6,0x120));var _0x602e=function(_0x4e10c3,_0x454e28){_0x4e10c3=_0x4e10c3-0x0;var _0x1e39c5=_0x02e6[_0x4e10c3];return _0x1e39c5;};'use strict';var _=require(_0x602e('0x0'));var util=require(_0x602e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x602e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x602e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x602e('0x4'))(_0x602e('0x5'));var config=require(_0x602e('0x6'));var jayson=require(_0x602e('0x7'));var client=jayson[_0x602e('0x8')][_0x602e('0x9')]({'port':0x232a});config[_0x602e('0xa')]=_[_0x602e('0xb')](config[_0x602e('0xa')],{'host':_0x602e('0xc'),'port':0x18eb});var socket=require(_0x602e('0xd'))(new Redis(config[_0x602e('0xa')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x12db2d,_0x335a0e,_0x43e27b){return new BPromise(function(_0x596563,_0x1cdace){return client[_0x602e('0xe')](_0x12db2d,_0x43e27b)[_0x602e('0xf')](function(_0x4d2538){logger[_0x602e('0x10')](_0x602e('0x11'),_0x335a0e,_0x602e('0x12'));logger[_0x602e('0x13')](_0x602e('0x14'),_0x335a0e,_0x602e('0x12'),JSON[_0x602e('0x15')](_0x4d2538));if(_0x4d2538[_0x602e('0x16')]){if(_0x4d2538[_0x602e('0x16')][_0x602e('0x17')]===0x1f4){logger[_0x602e('0x16')](_0x602e('0x11'),_0x335a0e,_0x4d2538[_0x602e('0x16')][_0x602e('0x18')]);return _0x1cdace(_0x4d2538[_0x602e('0x16')][_0x602e('0x18')]);}logger[_0x602e('0x16')](_0x602e('0x11'),_0x335a0e,_0x4d2538['error'][_0x602e('0x18')]);return _0x596563(_0x4d2538[_0x602e('0x16')][_0x602e('0x18')]);}else{logger[_0x602e('0x10')](_0x602e('0x11'),_0x335a0e,_0x602e('0x12'));_0x596563(_0x4d2538[_0x602e('0x19')]['message']);}})['catch'](function(_0x330a0d){logger[_0x602e('0x16')](_0x602e('0x11'),_0x335a0e,_0x330a0d);_0x1cdace(_0x330a0d);});});}exports[_0x602e('0x1a')]=function(_0x1639a1){var _0x13600c=this;return new Promise(function(_0x3b52eb,_0x424c6d){return db['SmsAccount'][_0x602e('0x1b')]({'raw':_0x1639a1[_0x602e('0x1c')]?_0x1639a1['options'][_0x602e('0x1d')]===undefined?!![]:![]:!![],'where':_0x1639a1[_0x602e('0x1c')]?_0x1639a1[_0x602e('0x1c')][_0x602e('0x1e')]||null:null,'attributes':_0x1639a1['options']?_0x1639a1[_0x602e('0x1c')][_0x602e('0x1f')]||null:null,'include':_0x1639a1[_0x602e('0x1c')]?_0x1639a1[_0x602e('0x1c')][_0x602e('0x20')]?_['map'](_0x1639a1['options'][_0x602e('0x20')],function(_0x24f787){return{'model':db[_0x24f787[_0x602e('0x21')]],'as':_0x24f787['as'],'attributes':_0x24f787[_0x602e('0x1f')],'include':_0x24f787[_0x602e('0x20')]?_[_0x602e('0x22')](_0x24f787[_0x602e('0x20')],function(_0x538a1d){return{'model':db[_0x538a1d[_0x602e('0x21')]],'as':_0x538a1d['as'],'attributes':_0x538a1d[_0x602e('0x1f')],'include':_0x538a1d['include']?_[_0x602e('0x22')](_0x538a1d[_0x602e('0x20')],function(_0x3db9df){return{'model':db[_0x3db9df['model']],'as':_0x3db9df['as'],'attributes':_0x3db9df[_0x602e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x602e('0xf')](function(_0x4e7e09){logger[_0x602e('0x10')](_0x602e('0x1a'),_0x1639a1);logger['debug'](_0x602e('0x1a'),_0x1639a1,JSON['stringify'](_0x4e7e09));_0x3b52eb(_0x4e7e09);})[_0x602e('0x23')](function(_0x2ec461){logger[_0x602e('0x16')](_0x602e('0x1a'),_0x2ec461[_0x602e('0x18')],_0x1639a1);_0x424c6d(_0x13600c[_0x602e('0x16')](0x1f4,_0x2ec461[_0x602e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 5945aef..850ecbe 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 5b34110..2749dd2 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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0x3e74,0x175));var _0x43e7=function(_0x1073d9,_0x230885){_0x1073d9=_0x1073d9-0x0;var _0xcb59f9=_0x3e74[_0x1073d9];return _0xcb59f9;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x4cc17e,_0xbff357){var _0x4ee2e9=function(_0x3633d8){while(--_0x3633d8){_0x4cc17e['push'](_0x4cc17e['shift']());}};_0x4ee2e9(++_0xbff357);}(_0x3e74,0x175));var _0x43e7=function(_0x2bf4,_0x872919){_0x2bf4=_0x2bf4-0x0;var _0x3d8d88=_0x3e74[_0x2bf4];return _0x3d8d88;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d6f65da..ebd94af 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 _0x6397=['STRING','noop','TEXT','*,*,*,*','INTEGER'];(function(_0x50fe84,_0x528bc2){var _0xf0b901=function(_0x2584c4){while(--_0x2584c4){_0x50fe84['push'](_0x50fe84['shift']());}};_0xf0b901(++_0x528bc2);}(_0x6397,0x126));var _0x7639=function(_0x6975d,_0x1da421){_0x6975d=_0x6975d-0x0;var _0x3a69e5=_0x6397[_0x6975d];return _0x3a69e5;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7639('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x7639('0x1')],'allowNull':![],'defaultValue':_0x7639('0x2')},'appdata':{'type':Sequelize[_0x7639('0x3')]()},'description':{'type':Sequelize[_0x7639('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7639('0x4')}}; \ No newline at end of file +var _0x8650=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0x8650,0xcf));var _0x0865=function(_0x111a98,_0x4f1904){_0x111a98=_0x111a98-0x0;var _0x44cb89=_0x8650[_0x111a98];return _0x44cb89;};'use strict';var Sequelize=require(_0x0865('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0865('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0865('0x2')],'allowNull':![],'defaultValue':_0x0865('0x3')},'appdata':{'type':Sequelize[_0x0865('0x4')]()},'description':{'type':Sequelize[_0x0865('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0865('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 7a25567..79143b5 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 _0x1eb0=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsApplication','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5c0cd0,_0x37d892){var _0x3b0bc2=function(_0x9282d7){while(--_0x9282d7){_0x5c0cd0['push'](_0x5c0cd0['shift']());}};_0x3b0bc2(++_0x37d892);}(_0x1eb0,0x83));var _0x01eb=function(_0x3dfdba,_0x3c8d8d){_0x3dfdba=_0x3dfdba-0x0;var _0x4538ff=_0x1eb0[_0x3dfdba];return _0x4538ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01eb('0x0'));var zipdir=require(_0x01eb('0x1'));var jsonpatch=require(_0x01eb('0x2'));var rp=require(_0x01eb('0x3'));var moment=require(_0x01eb('0x4'));var BPromise=require(_0x01eb('0x5'));var Mustache=require('mustache');var util=require(_0x01eb('0x6'));var path=require(_0x01eb('0x7'));var sox=require(_0x01eb('0x8'));var csv=require('to-csv');var ejs=require(_0x01eb('0x9'));var fs=require('fs');var fs_extra=require(_0x01eb('0xa'));var _=require(_0x01eb('0xb'));var squel=require(_0x01eb('0xc'));var crypto=require(_0x01eb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x01eb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x01eb('0xf'));var Papa=require(_0x01eb('0x10'));var Redis=require('ioredis');var authService=require(_0x01eb('0x11'));var qs=require(_0x01eb('0x12'));var as=require(_0x01eb('0x13'));var hardwareService=require(_0x01eb('0x14'));var logger=require(_0x01eb('0x15'))(_0x01eb('0x16'));var utils=require(_0x01eb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x01eb('0x18'));var db=require(_0x01eb('0x19'))['db'];function respondWithStatusCode(_0x1bff33,_0x18a23c){_0x18a23c=_0x18a23c||0xcc;return function(_0x579e91){if(_0x579e91){return _0x1bff33[_0x01eb('0x1a')](_0x18a23c);}return _0x1bff33[_0x01eb('0x1b')](_0x18a23c)[_0x01eb('0x1c')]();};}function respondWithResult(_0xd3b8ad,_0x319475){_0x319475=_0x319475||0xc8;return function(_0x248a0d){if(_0x248a0d){return _0xd3b8ad[_0x01eb('0x1b')](_0x319475)[_0x01eb('0x1d')](_0x248a0d);}};}function respondWithFilteredResult(_0x1b994e,_0x135fda){return function(_0x3f4e6f){if(_0x3f4e6f){var _0x2548f2=typeof _0x135fda['offset']==='undefined'&&typeof _0x135fda[_0x01eb('0x1e')]===_0x01eb('0x1f');var _0x1ec594=_0x3f4e6f['count'];var _0xae629b=_0x2548f2?0x0:_0x135fda[_0x01eb('0x20')];var _0x24e8b4=_0x2548f2?_0x3f4e6f[_0x01eb('0x21')]:_0x135fda[_0x01eb('0x20')]+_0x135fda[_0x01eb('0x1e')];var _0x27b70d;if(_0x24e8b4>=_0x1ec594){_0x24e8b4=_0x1ec594;_0x27b70d=0xc8;}else{_0x27b70d=0xce;}_0x1b994e[_0x01eb('0x1b')](_0x27b70d);return _0x1b994e[_0x01eb('0x22')](_0x01eb('0x23'),_0xae629b+'-'+_0x24e8b4+'/'+_0x1ec594)[_0x01eb('0x1d')](_0x3f4e6f);}return null;};}function patchUpdates(_0x45df14){return function(_0x2b5974){try{jsonpatch[_0x01eb('0x24')](_0x2b5974,_0x45df14,!![]);}catch(_0x4d77cd){return BPromise[_0x01eb('0x25')](_0x4d77cd);}return _0x2b5974[_0x01eb('0x26')]();};}function saveUpdates(_0x219c60,_0x1c6a0e){return function(_0x30c38a){if(_0x30c38a){return _0x30c38a[_0x01eb('0x27')](_0x219c60)[_0x01eb('0x28')](function(_0x492d7f){return _0x492d7f;});}return null;};}function removeEntity(_0x8b80f2,_0x533ab2){return function(_0x4564ef){if(_0x4564ef){return _0x4564ef[_0x01eb('0x29')]()['then'](function(){_0x8b80f2['status'](0xcc)[_0x01eb('0x1c')]();});}};}function handleEntityNotFound(_0x3366f4,_0x399b67){return function(_0x36c85e){if(!_0x36c85e){_0x3366f4['sendStatus'](0x194);}return _0x36c85e;};}function handleError(_0x3a619e,_0x1b990b){_0x1b990b=_0x1b990b||0x1f4;return function(_0x105648){logger['error'](_0x105648['stack']);if(_0x105648[_0x01eb('0x2a')]){delete _0x105648[_0x01eb('0x2a')];}_0x3a619e[_0x01eb('0x1b')](_0x1b990b)['send'](_0x105648);};}exports[_0x01eb('0x2b')]=function(_0x47e402,_0x30e707){var _0x66e057={},_0x6111={},_0x30d792={'count':0x0,'rows':[]};var _0x19ebee=_[_0x01eb('0x2c')](db['SmsApplication']['rawAttributes'],function(_0x2fb83a){return{'name':_0x2fb83a[_0x01eb('0x2d')],'type':_0x2fb83a['type'][_0x01eb('0x2e')]};});_0x6111[_0x01eb('0x2f')]=_['map'](_0x19ebee,_0x01eb('0x2a'));_0x6111['query']=_[_0x01eb('0x30')](_0x47e402[_0x01eb('0x31')]);_0x6111[_0x01eb('0x32')]=_[_0x01eb('0x33')](_0x6111[_0x01eb('0x2f')],_0x6111[_0x01eb('0x31')]);_0x66e057[_0x01eb('0x34')]=_[_0x01eb('0x33')](_0x6111[_0x01eb('0x2f')],qs[_0x01eb('0x35')](_0x47e402[_0x01eb('0x31')][_0x01eb('0x35')]));_0x66e057[_0x01eb('0x34')]=_0x66e057['attributes'][_0x01eb('0x36')]?_0x66e057['attributes']:_0x6111[_0x01eb('0x2f')];if(!_0x47e402[_0x01eb('0x31')][_0x01eb('0x37')]('nolimit')){_0x66e057[_0x01eb('0x1e')]=qs[_0x01eb('0x1e')](_0x47e402['query'][_0x01eb('0x1e')]);_0x66e057[_0x01eb('0x20')]=qs[_0x01eb('0x20')](_0x47e402[_0x01eb('0x31')][_0x01eb('0x20')]);}_0x66e057['order']=qs[_0x01eb('0x38')](_0x47e402['query'][_0x01eb('0x38')]);_0x66e057[_0x01eb('0x39')]=qs['filters'](_[_0x01eb('0x3a')](_0x47e402[_0x01eb('0x31')],_0x6111[_0x01eb('0x32')]),_0x19ebee);if(_0x47e402[_0x01eb('0x31')][_0x01eb('0x3b')]){_0x66e057[_0x01eb('0x39')]=_[_0x01eb('0x3c')](_0x66e057[_0x01eb('0x39')],{'$or':_[_0x01eb('0x2c')](_0x19ebee,function(_0x5aa87d){if(_0x5aa87d[_0x01eb('0x3d')]!==_0x01eb('0x3e')){var _0x3f8024={};_0x3f8024[_0x5aa87d[_0x01eb('0x2a')]]={'$like':'%'+_0x47e402['query']['filter']+'%'};return _0x3f8024;}})});}_0x66e057=_[_0x01eb('0x3c')]({},_0x66e057,_0x47e402[_0x01eb('0x3f')]);var _0x4f414b={'where':_0x66e057[_0x01eb('0x39')]};return db[_0x01eb('0x40')]['count'](_0x4f414b)[_0x01eb('0x28')](function(_0x5c559b){_0x30d792[_0x01eb('0x21')]=_0x5c559b;if(_0x47e402[_0x01eb('0x31')][_0x01eb('0x41')]){_0x66e057[_0x01eb('0x42')]=[{'all':!![]}];}return db[_0x01eb('0x40')][_0x01eb('0x43')](_0x66e057);})[_0x01eb('0x28')](function(_0x19e40c){_0x30d792[_0x01eb('0x44')]=_0x19e40c;return _0x30d792;})[_0x01eb('0x28')](respondWithFilteredResult(_0x30e707,_0x66e057))[_0x01eb('0x45')](handleError(_0x30e707,null));};exports[_0x01eb('0x46')]=function(_0x1c2a5f,_0x17c5d9){var _0x167a84={'raw':!![],'where':{'id':_0x1c2a5f['params']['id']}},_0x35e8c4={};_0x35e8c4[_0x01eb('0x2f')]=_[_0x01eb('0x30')](db['SmsApplication'][_0x01eb('0x47')]);_0x35e8c4[_0x01eb('0x31')]=_[_0x01eb('0x30')](_0x1c2a5f['query']);_0x35e8c4[_0x01eb('0x32')]=_[_0x01eb('0x33')](_0x35e8c4['model'],_0x35e8c4['query']);_0x167a84[_0x01eb('0x34')]=_['intersection'](_0x35e8c4[_0x01eb('0x2f')],qs[_0x01eb('0x35')](_0x1c2a5f[_0x01eb('0x31')][_0x01eb('0x35')]));_0x167a84[_0x01eb('0x34')]=_0x167a84[_0x01eb('0x34')][_0x01eb('0x36')]?_0x167a84[_0x01eb('0x34')]:_0x35e8c4[_0x01eb('0x2f')];if(_0x1c2a5f[_0x01eb('0x31')][_0x01eb('0x41')]){_0x167a84[_0x01eb('0x42')]=[{'all':!![]}];}_0x167a84=_[_0x01eb('0x3c')]({},_0x167a84,_0x1c2a5f[_0x01eb('0x3f')]);return db[_0x01eb('0x40')][_0x01eb('0x48')](_0x167a84)['then'](handleEntityNotFound(_0x17c5d9,null))[_0x01eb('0x28')](respondWithResult(_0x17c5d9,null))[_0x01eb('0x45')](handleError(_0x17c5d9,null));};exports[_0x01eb('0x49')]=function(_0x4e9298,_0x445603){return db[_0x01eb('0x40')]['create'](_0x4e9298[_0x01eb('0x4a')],{})[_0x01eb('0x28')](respondWithResult(_0x445603,0xc9))[_0x01eb('0x45')](handleError(_0x445603,null));};exports[_0x01eb('0x27')]=function(_0x1ae029,_0x21a88d){if(_0x1ae029['body']['id']){delete _0x1ae029[_0x01eb('0x4a')]['id'];}return db[_0x01eb('0x40')][_0x01eb('0x48')]({'where':{'id':_0x1ae029[_0x01eb('0x4b')]['id']}})[_0x01eb('0x28')](handleEntityNotFound(_0x21a88d,null))[_0x01eb('0x28')](saveUpdates(_0x1ae029['body'],null))['then'](respondWithResult(_0x21a88d,null))['catch'](handleError(_0x21a88d,null));};exports['destroy']=function(_0x5e0de3,_0x434185){return db[_0x01eb('0x40')][_0x01eb('0x48')]({'where':{'id':_0x5e0de3[_0x01eb('0x4b')]['id']}})[_0x01eb('0x28')](handleEntityNotFound(_0x434185,null))[_0x01eb('0x28')](removeEntity(_0x434185,null))[_0x01eb('0x45')](handleError(_0x434185,null));}; \ No newline at end of file +var _0xf3ca=['index','map','SmsApplication','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','findAll','then','rows','catch','show','params','rawAttributes','length','include','find','create','body','destroy','rimraf','fast-json-patch','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','end','error','stack','name','send'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xf3ca,0x14b));var _0xaf3c=function(_0x446f82,_0x4adf46){_0x446f82=_0x446f82-0x0;var _0x48a243=_0xf3ca[_0x446f82];return _0x48a243;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf3c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf3c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaf3c('0x2'));var Mustache=require('mustache');var util=require(_0xaf3c('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xaf3c('0x4'));var ejs=require(_0xaf3c('0x5'));var fs=require('fs');var fs_extra=require(_0xaf3c('0x6'));var _=require(_0xaf3c('0x7'));var squel=require(_0xaf3c('0x8'));var crypto=require(_0xaf3c('0x9'));var jsforce=require(_0xaf3c('0xa'));var deskjs=require(_0xaf3c('0xb'));var toCsv=require(_0xaf3c('0x4'));var querystring=require(_0xaf3c('0xc'));var Papa=require(_0xaf3c('0xd'));var Redis=require(_0xaf3c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaf3c('0xf'));var hardwareService=require(_0xaf3c('0x10'));var logger=require(_0xaf3c('0x11'))(_0xaf3c('0x12'));var utils=require(_0xaf3c('0x13'));var config=require(_0xaf3c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x430f34,_0x248e3e){_0x248e3e=_0x248e3e||0xcc;return function(_0xa3d536){if(_0xa3d536){return _0x430f34[_0xaf3c('0x15')](_0x248e3e);}return _0x430f34['status'](_0x248e3e)['end']();};}function respondWithResult(_0x4d1d31,_0x150548){_0x150548=_0x150548||0xc8;return function(_0x3d7b31){if(_0x3d7b31){return _0x4d1d31['status'](_0x150548)[_0xaf3c('0x16')](_0x3d7b31);}};}function respondWithFilteredResult(_0x45a94c,_0x2cf931){return function(_0x1c4f86){if(_0x1c4f86){var _0x886a8a=typeof _0x2cf931[_0xaf3c('0x17')]==='undefined'&&typeof _0x2cf931[_0xaf3c('0x18')]===_0xaf3c('0x19');var _0x591384=_0x1c4f86[_0xaf3c('0x1a')];var _0x5cd9eb=_0x886a8a?0x0:_0x2cf931[_0xaf3c('0x17')];var _0x26ca1d=_0x886a8a?_0x1c4f86['count']:_0x2cf931[_0xaf3c('0x17')]+_0x2cf931['limit'];var _0xe87374;if(_0x26ca1d>=_0x591384){_0x26ca1d=_0x591384;_0xe87374=0xc8;}else{_0xe87374=0xce;}_0x45a94c[_0xaf3c('0x1b')](_0xe87374);return _0x45a94c[_0xaf3c('0x1c')](_0xaf3c('0x1d'),_0x5cd9eb+'-'+_0x26ca1d+'/'+_0x591384)[_0xaf3c('0x16')](_0x1c4f86);}return null;};}function patchUpdates(_0x331e53){return function(_0x356355){try{jsonpatch[_0xaf3c('0x1e')](_0x356355,_0x331e53,!![]);}catch(_0x1098fb){return BPromise[_0xaf3c('0x1f')](_0x1098fb);}return _0x356355[_0xaf3c('0x20')]();};}function saveUpdates(_0x5ea363,_0x2b963d){return function(_0x136306){if(_0x136306){return _0x136306[_0xaf3c('0x21')](_0x5ea363)['then'](function(_0xd0b883){return _0xd0b883;});}return null;};}function removeEntity(_0x4def25,_0x58020e){return function(_0x391c39){if(_0x391c39){return _0x391c39['destroy']()['then'](function(){_0x4def25[_0xaf3c('0x1b')](0xcc)[_0xaf3c('0x22')]();});}};}function handleEntityNotFound(_0xc515f2,_0x2672fb){return function(_0x44d413){if(!_0x44d413){_0xc515f2[_0xaf3c('0x15')](0x194);}return _0x44d413;};}function handleError(_0x57a406,_0x5c6d27){_0x5c6d27=_0x5c6d27||0x1f4;return function(_0x1af43b){logger[_0xaf3c('0x23')](_0x1af43b[_0xaf3c('0x24')]);if(_0x1af43b['name']){delete _0x1af43b[_0xaf3c('0x25')];}_0x57a406[_0xaf3c('0x1b')](_0x5c6d27)[_0xaf3c('0x26')](_0x1af43b);};}exports[_0xaf3c('0x27')]=function(_0x58fe16,_0x758038){var _0x313f2f={},_0x4126c4={},_0x2f533c={'count':0x0,'rows':[]};var _0x4fe01e=_[_0xaf3c('0x28')](db[_0xaf3c('0x29')]['rawAttributes'],function(_0x31c06a){return{'name':_0x31c06a['fieldName'],'type':_0x31c06a[_0xaf3c('0x2a')][_0xaf3c('0x2b')]};});_0x4126c4[_0xaf3c('0x2c')]=_['map'](_0x4fe01e,_0xaf3c('0x25'));_0x4126c4[_0xaf3c('0x2d')]=_[_0xaf3c('0x2e')](_0x58fe16[_0xaf3c('0x2d')]);_0x4126c4['filters']=_['intersection'](_0x4126c4[_0xaf3c('0x2c')],_0x4126c4[_0xaf3c('0x2d')]);_0x313f2f[_0xaf3c('0x2f')]=_[_0xaf3c('0x30')](_0x4126c4[_0xaf3c('0x2c')],qs[_0xaf3c('0x31')](_0x58fe16[_0xaf3c('0x2d')][_0xaf3c('0x31')]));_0x313f2f[_0xaf3c('0x2f')]=_0x313f2f[_0xaf3c('0x2f')]['length']?_0x313f2f[_0xaf3c('0x2f')]:_0x4126c4[_0xaf3c('0x2c')];if(!_0x58fe16[_0xaf3c('0x2d')][_0xaf3c('0x32')](_0xaf3c('0x33'))){_0x313f2f['limit']=qs[_0xaf3c('0x18')](_0x58fe16[_0xaf3c('0x2d')][_0xaf3c('0x18')]);_0x313f2f[_0xaf3c('0x17')]=qs[_0xaf3c('0x17')](_0x58fe16[_0xaf3c('0x2d')][_0xaf3c('0x17')]);}_0x313f2f[_0xaf3c('0x34')]=qs['sort'](_0x58fe16[_0xaf3c('0x2d')][_0xaf3c('0x35')]);_0x313f2f[_0xaf3c('0x36')]=qs['filters'](_[_0xaf3c('0x37')](_0x58fe16[_0xaf3c('0x2d')],_0x4126c4[_0xaf3c('0x38')]),_0x4fe01e);if(_0x58fe16['query'][_0xaf3c('0x39')]){_0x313f2f[_0xaf3c('0x36')]=_[_0xaf3c('0x3a')](_0x313f2f[_0xaf3c('0x36')],{'$or':_[_0xaf3c('0x28')](_0x4fe01e,function(_0x2da16b){if(_0x2da16b[_0xaf3c('0x2a')]!=='VIRTUAL'){var _0x2ed32d={};_0x2ed32d[_0x2da16b['name']]={'$like':'%'+_0x58fe16[_0xaf3c('0x2d')][_0xaf3c('0x39')]+'%'};return _0x2ed32d;}})});}_0x313f2f=_[_0xaf3c('0x3a')]({},_0x313f2f,_0x58fe16[_0xaf3c('0x3b')]);var _0x206e5c={'where':_0x313f2f[_0xaf3c('0x36')]};return db['SmsApplication']['count'](_0x206e5c)['then'](function(_0x2115db){_0x2f533c[_0xaf3c('0x1a')]=_0x2115db;if(_0x58fe16['query'][_0xaf3c('0x3c')]){_0x313f2f['include']=[{'all':!![]}];}return db['SmsApplication'][_0xaf3c('0x3d')](_0x313f2f);})[_0xaf3c('0x3e')](function(_0x532290){_0x2f533c[_0xaf3c('0x3f')]=_0x532290;return _0x2f533c;})[_0xaf3c('0x3e')](respondWithFilteredResult(_0x758038,_0x313f2f))[_0xaf3c('0x40')](handleError(_0x758038,null));};exports[_0xaf3c('0x41')]=function(_0x4d000e,_0x5e7d86){var _0x8c517b={'raw':!![],'where':{'id':_0x4d000e[_0xaf3c('0x42')]['id']}},_0x35f4a4={};_0x35f4a4[_0xaf3c('0x2c')]=_[_0xaf3c('0x2e')](db[_0xaf3c('0x29')][_0xaf3c('0x43')]);_0x35f4a4[_0xaf3c('0x2d')]=_[_0xaf3c('0x2e')](_0x4d000e[_0xaf3c('0x2d')]);_0x35f4a4[_0xaf3c('0x38')]=_[_0xaf3c('0x30')](_0x35f4a4[_0xaf3c('0x2c')],_0x35f4a4['query']);_0x8c517b['attributes']=_[_0xaf3c('0x30')](_0x35f4a4[_0xaf3c('0x2c')],qs[_0xaf3c('0x31')](_0x4d000e['query'][_0xaf3c('0x31')]));_0x8c517b['attributes']=_0x8c517b[_0xaf3c('0x2f')][_0xaf3c('0x44')]?_0x8c517b[_0xaf3c('0x2f')]:_0x35f4a4[_0xaf3c('0x2c')];if(_0x4d000e[_0xaf3c('0x2d')][_0xaf3c('0x3c')]){_0x8c517b[_0xaf3c('0x45')]=[{'all':!![]}];}_0x8c517b=_[_0xaf3c('0x3a')]({},_0x8c517b,_0x4d000e[_0xaf3c('0x3b')]);return db[_0xaf3c('0x29')][_0xaf3c('0x46')](_0x8c517b)['then'](handleEntityNotFound(_0x5e7d86,null))['then'](respondWithResult(_0x5e7d86,null))[_0xaf3c('0x40')](handleError(_0x5e7d86,null));};exports[_0xaf3c('0x47')]=function(_0x551e5e,_0x535027){return db[_0xaf3c('0x29')][_0xaf3c('0x47')](_0x551e5e['body'],{})[_0xaf3c('0x3e')](respondWithResult(_0x535027,0xc9))['catch'](handleError(_0x535027,null));};exports[_0xaf3c('0x21')]=function(_0x4089d2,_0x553a36){if(_0x4089d2[_0xaf3c('0x48')]['id']){delete _0x4089d2[_0xaf3c('0x48')]['id'];}return db['SmsApplication'][_0xaf3c('0x46')]({'where':{'id':_0x4089d2['params']['id']}})[_0xaf3c('0x3e')](handleEntityNotFound(_0x553a36,null))[_0xaf3c('0x3e')](saveUpdates(_0x4089d2[_0xaf3c('0x48')],null))[_0xaf3c('0x3e')](respondWithResult(_0x553a36,null))[_0xaf3c('0x40')](handleError(_0x553a36,null));};exports[_0xaf3c('0x49')]=function(_0x44ce8e,_0x595151){return db['SmsApplication']['find']({'where':{'id':_0x44ce8e['params']['id']}})[_0xaf3c('0x3e')](handleEntityNotFound(_0x595151,null))[_0xaf3c('0x3e')](removeEntity(_0x595151,null))[_0xaf3c('0x40')](handleError(_0x595151,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 71f316e..cc06f15 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 _0x5482=['moment','request-promise','path','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x1bd893,_0x54ca01){var _0x1cbbe0=function(_0x736af4){while(--_0x736af4){_0x1bd893['push'](_0x1bd893['shift']());}};_0x1cbbe0(++_0x54ca01);}(_0x5482,0xf8));var _0x2548=function(_0x20c809,_0x26b566){_0x20c809=_0x20c809-0x0;var _0x1064a1=_0x5482[_0x20c809];return _0x1064a1;};'use strict';var _=require(_0x2548('0x0'));var util=require(_0x2548('0x1'));var logger=require(_0x2548('0x2'))(_0x2548('0x3'));var moment=require(_0x2548('0x4'));var BPromise=require('bluebird');var rp=require(_0x2548('0x5'));var fs=require('fs');var path=require(_0x2548('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x2548('0x7')]=function(_0x238ced,_0x3c6201){return _0x238ced[_0x2548('0x8')]('SmsApplication',attributes,{'tableName':_0x2548('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2548('0xa'),'collate':_0x2548('0xb')});}; \ No newline at end of file +var _0x3d9d=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x45c9f4,_0x2eec90){var _0x1f9be9=function(_0x1a5cbe){while(--_0x1a5cbe){_0x45c9f4['push'](_0x45c9f4['shift']());}};_0x1f9be9(++_0x2eec90);}(_0x3d9d,0xc4));var _0xd3d9=function(_0x559809,_0x4fd9b5){_0x559809=_0x559809-0x0;var _0x4b3651=_0x3d9d[_0x559809];return _0x4b3651;};'use strict';var _=require('lodash');var util=require(_0xd3d9('0x0'));var logger=require(_0xd3d9('0x1'))(_0xd3d9('0x2'));var moment=require('moment');var BPromise=require(_0xd3d9('0x3'));var rp=require(_0xd3d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3d9('0x5'));var config=require(_0xd3d9('0x6'));var attributes=require(_0xd3d9('0x7'));module['exports']=function(_0x3a89d3,_0x37370f){return _0x3a89d3['define'](_0xd3d9('0x8'),attributes,{'tableName':_0xd3d9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd3d9('0xa'),'collate':_0xd3d9('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index da9369f..f062da7 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 _0x6629=['info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x411c93,_0x16926f){var _0x1ddc50=function(_0x3876eb){while(--_0x3876eb){_0x411c93['push'](_0x411c93['shift']());}};_0x1ddc50(++_0x16926f);}(_0x6629,0x1c2));var _0x9662=function(_0x5d396d,_0x1dccb8){_0x5d396d=_0x5d396d-0x0;var _0x3a8c51=_0x6629[_0x5d396d];return _0x3a8c51;};'use strict';var _=require(_0x9662('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9662('0x1'));var rs=require(_0x9662('0x2'));var fs=require('fs');var Redis=require(_0x9662('0x3'));var db=require(_0x9662('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9662('0x5'))(_0x9662('0x6'));var config=require(_0x9662('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9662('0x8')][_0x9662('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x457681,_0x5ec533,_0x1a1809){return new BPromise(function(_0x58e45a,_0xa866f2){return client[_0x9662('0xa')](_0x457681,_0x1a1809)[_0x9662('0xb')](function(_0x11ae91){logger[_0x9662('0xc')](_0x9662('0xd'),_0x5ec533,_0x9662('0xe'));logger[_0x9662('0xf')](_0x9662('0x10'),_0x5ec533,_0x9662('0xe'),JSON[_0x9662('0x11')](_0x11ae91));if(_0x11ae91['error']){if(_0x11ae91[_0x9662('0x12')]['code']===0x1f4){logger[_0x9662('0x12')](_0x9662('0xd'),_0x5ec533,_0x11ae91['error'][_0x9662('0x13')]);return _0xa866f2(_0x11ae91[_0x9662('0x12')][_0x9662('0x13')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x5ec533,_0x11ae91[_0x9662('0x12')]['message']);return _0x58e45a(_0x11ae91[_0x9662('0x12')][_0x9662('0x13')]);}else{logger[_0x9662('0xc')]('SmsApplication,\x20%s,\x20%s',_0x5ec533,'request\x20sent');_0x58e45a(_0x11ae91['result'][_0x9662('0x13')]);}})[_0x9662('0x14')](function(_0x4930c5){logger[_0x9662('0x12')](_0x9662('0xd'),_0x5ec533,_0x4930c5);_0xa866f2(_0x4930c5);});});} \ No newline at end of file +var _0x1f75=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SmsApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1c2cd4,_0x556c08){var _0x213220=function(_0xe5b76b){while(--_0xe5b76b){_0x1c2cd4['push'](_0x1c2cd4['shift']());}};_0x213220(++_0x556c08);}(_0x1f75,0x13c));var _0x51f7=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x1f75[_0x20c9b2];return _0x2c6030;};'use strict';var _=require('lodash');var util=require(_0x51f7('0x0'));var moment=require(_0x51f7('0x1'));var BPromise=require(_0x51f7('0x2'));var rs=require(_0x51f7('0x3'));var fs=require('fs');var Redis=require(_0x51f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x51f7('0x5'));var logger=require(_0x51f7('0x6'))(_0x51f7('0x7'));var config=require(_0x51f7('0x8'));var jayson=require(_0x51f7('0x9'));var client=jayson[_0x51f7('0xa')][_0x51f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb4e621,_0x3d2a15,_0x47069a){return new BPromise(function(_0x20d374,_0x4158a6){return client['request'](_0xb4e621,_0x47069a)[_0x51f7('0xc')](function(_0x450767){logger['info'](_0x51f7('0xd'),_0x3d2a15,_0x51f7('0xe'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3d2a15,_0x51f7('0xe'),JSON[_0x51f7('0xf')](_0x450767));if(_0x450767['error']){if(_0x450767[_0x51f7('0x10')][_0x51f7('0x11')]===0x1f4){logger['error'](_0x51f7('0xd'),_0x3d2a15,_0x450767[_0x51f7('0x10')][_0x51f7('0x12')]);return _0x4158a6(_0x450767['error']['message']);}logger[_0x51f7('0x10')](_0x51f7('0xd'),_0x3d2a15,_0x450767[_0x51f7('0x10')][_0x51f7('0x12')]);return _0x20d374(_0x450767[_0x51f7('0x10')][_0x51f7('0x12')]);}else{logger['info'](_0x51f7('0xd'),_0x3d2a15,_0x51f7('0xe'));_0x20d374(_0x450767[_0x51f7('0x13')][_0x51f7('0x12')]);}})[_0x51f7('0x14')](function(_0x1b3532){logger[_0x51f7('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3d2a15,_0x1b3532);_0x4158a6(_0x1b3532);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3187594..e5ae561 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 _0xf4f4=['/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy'];(function(_0x41f8f5,_0x4088ad){var _0x1f7b35=function(_0x28a6ff){while(--_0x28a6ff){_0x41f8f5['push'](_0x41f8f5['shift']());}};_0x1f7b35(++_0x4088ad);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4e1c3c,_0x2a8084){_0x4e1c3c=_0x4e1c3c-0x0;var _0x1c7150=_0xf4f4[_0x4e1c3c];return _0x1c7150;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./smsInteraction.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0x8')]('/:id',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xd')]);router[_0x4f4f('0x8')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x8')](_0x4f4f('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x4f4f('0x11')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x12')]);router[_0x4f4f('0x11')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller['addMessage']);router[_0x4f4f('0x11')]('/:id/tags',auth[_0x4f4f('0x9')](),interaction[_0x4f4f('0x13')](_0x4f4f('0x14'),_0x4f4f('0x15')),controller['addTags']);router[_0x4f4f('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x4f4f('0x14'),_0x4f4f('0x17')),controller[_0x4f4f('0x18')]);router[_0x4f4f('0x19')](_0x4f4f('0x1a'),auth[_0x4f4f('0x9')](),interaction[_0x4f4f('0x13')](_0x4f4f('0x14'),_0x4f4f('0x1b')),controller[_0x4f4f('0x1c')]);router[_0x4f4f('0x19')](_0x4f4f('0x1d'),auth['isAuthenticated'](),controller[_0x4f4f('0x1e')]);module[_0x4f4f('0x1f')]=router; \ No newline at end of file +var _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0xf1440c,_0x2b1b87){var _0x40bee8=function(_0x259332){while(--_0x259332){_0xf1440c['push'](_0xf1440c['shift']());}};_0x40bee8(++_0x2b1b87);}(_0x7708,0x188));var _0x8770=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0x7708[_0x55fb83];return _0x59a87a;};'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('./smsInteraction.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['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('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 6699a07..b458a9e 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 _0x744c=['sequelize','moment','exports','BOOLEAN','STRING','ENUM','out','DATE'];(function(_0x271a42,_0x397913){var _0x32371f=function(_0x1d70c1){while(--_0x1d70c1){_0x271a42['push'](_0x271a42['shift']());}};_0x32371f(++_0x397913);}(_0x744c,0xa0));var _0xc744=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x744c[_0x2080a3];return _0x8d7d17;};'use strict';var Sequelize=require(_0xc744('0x0'));var moment=require(_0xc744('0x1'));module[_0xc744('0x2')]={'closed':{'type':Sequelize[_0xc744('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc744('0x4')]},'secondDisposition':{'type':Sequelize[_0xc744('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc744('0x4')]},'note':{'type':Sequelize[_0xc744('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xc744('0x5')]('in',_0xc744('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc744('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xc744('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd6d2=['sequelize','moment','BOOLEAN','DATE','STRING','out','ENUM'];(function(_0x14be21,_0x38b27b){var _0x12c882=function(_0x19cefe){while(--_0x19cefe){_0x14be21['push'](_0x14be21['shift']());}};_0x12c882(++_0x38b27b);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x505097,_0x12cdfa){_0x505097=_0x505097-0x0;var _0x17f3fe=_0xd6d2[_0x505097];return _0x17f3fe;};'use strict';var Sequelize=require(_0x2d6d('0x0'));var moment=require(_0x2d6d('0x1'));module['exports']={'closed':{'type':Sequelize[_0x2d6d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2d6d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2d6d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2d6d('0x4')]},'phone':{'type':Sequelize[_0x2d6d('0x4')]},'read1stAt':{'type':Sequelize[_0x2d6d('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x2d6d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2d6d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2d6d('0x6')]('in',_0x2d6d('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2d6d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 9299fef..3764030 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 _0xecc0=['addMessage','ids','omit','getMessages','hasOwnProperty','order','sort','where','SmsInteractionId','filter','$gte','format','rows','addTags','setTags','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Messages','secret','read','SmsAccount','Owner','mkdirSync','Sms','Account','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','direction','System','Contact','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','limit','count','offset','set','Content-Range','then','destroy','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','findAll','sms','query','params','model','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','describe','SmsMessage'];(function(_0x12cbc7,_0xad4d2c){var _0x15c4ed=function(_0x26864c){while(--_0x26864c){_0x12cbc7['push'](_0x12cbc7['shift']());}};_0x15c4ed(++_0xad4d2c);}(_0xecc0,0x121));var _0x0ecc=function(_0x37e38b,_0x1df22f){_0x37e38b=_0x37e38b-0x0;var _0x3a7e65=_0xecc0[_0x37e38b];return _0x3a7e65;};'use strict';var rimraf=require(_0x0ecc('0x0'));var zipdir=require(_0x0ecc('0x1'));var moment=require(_0x0ecc('0x2'));var BPromise=require(_0x0ecc('0x3'));var util=require(_0x0ecc('0x4'));var path=require(_0x0ecc('0x5'));var ejs=require(_0x0ecc('0x6'));var fs=require('fs');var _=require(_0x0ecc('0x7'));var Redis=require(_0x0ecc('0x8'));var interaction=require(_0x0ecc('0x9'));var qs=require(_0x0ecc('0xa'));var pdf=require(_0x0ecc('0xb'));var logger=require(_0x0ecc('0xc'))(_0x0ecc('0xd'));var config=require(_0x0ecc('0xe'));var db=require(_0x0ecc('0xf'))['db'];config[_0x0ecc('0x10')]=_[_0x0ecc('0x11')](config[_0x0ecc('0x10')],{'host':_0x0ecc('0x12'),'port':0x18eb});var socket=require(_0x0ecc('0x13'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x0ecc('0x14')](socket);function respondWithStatusCode(_0x4aab77,_0x1bd11c){_0x1bd11c=_0x1bd11c||0xcc;return function(_0x40716c){if(_0x40716c){return _0x4aab77['sendStatus'](_0x1bd11c);}return _0x4aab77[_0x0ecc('0x15')](_0x1bd11c)[_0x0ecc('0x16')]();};}function respondWithResult(_0x30e7a4,_0x28e427){_0x28e427=_0x28e427||0xc8;return function(_0x179507){if(_0x179507){return _0x30e7a4[_0x0ecc('0x15')](_0x28e427)[_0x0ecc('0x17')](_0x179507);}};}function respondWithFilteredResult(_0x2198ed,_0x178dd7){return function(_0x7733ef){if(_0x7733ef){var _0x231ab9=typeof _0x178dd7['offset']==='undefined'&&typeof _0x178dd7[_0x0ecc('0x18')]==='undefined';var _0x3871d2=_0x7733ef[_0x0ecc('0x19')];var _0x5da347=_0x231ab9?0x0:_0x178dd7['offset'];var _0x311213=_0x231ab9?_0x7733ef[_0x0ecc('0x19')]:_0x178dd7[_0x0ecc('0x1a')]+_0x178dd7[_0x0ecc('0x18')];var _0x95b07d;if(_0x311213>=_0x3871d2){_0x311213=_0x3871d2;_0x95b07d=0xc8;}else{_0x95b07d=0xce;}_0x2198ed[_0x0ecc('0x15')](_0x95b07d);return _0x2198ed[_0x0ecc('0x1b')](_0x0ecc('0x1c'),_0x5da347+'-'+_0x311213+'/'+_0x3871d2)['json'](_0x7733ef);}return null;};}function saveUpdates(_0x5d59ab){return function(_0x5e542c){if(_0x5e542c){return _0x5e542c['update'](_0x5d59ab)[_0x0ecc('0x1d')](function(_0x21b583){return _0x21b583;});}return null;};}function removeEntity(_0x4c13e1){return function(_0x3dd8f8){if(_0x3dd8f8){return _0x3dd8f8[_0x0ecc('0x1e')]()[_0x0ecc('0x1d')](function(){_0x4c13e1[_0x0ecc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35f7b4){return function(_0x17cd3a){if(!_0x17cd3a){_0x35f7b4['sendStatus'](0x194);}return _0x17cd3a;};}function handleError(_0x365e14,_0x18e824){_0x18e824=_0x18e824||0x1f4;return function(_0x594568){logger[_0x0ecc('0x1f')](_0x594568[_0x0ecc('0x20')]);if(_0x594568[_0x0ecc('0x21')]){delete _0x594568[_0x0ecc('0x21')];}_0x365e14[_0x0ecc('0x15')](_0x18e824)[_0x0ecc('0x22')](_0x594568);};}exports[_0x0ecc('0x23')]=function(_0x1ff966,_0x10e66a){var _0x1f1c0f={};var _0x1bb50d=_[_0x0ecc('0x24')](db[_0x0ecc('0x25')][_0x0ecc('0x26')],function(_0x4129c8){return{'name':_0x4129c8[_0x0ecc('0x27')],'type':_0x4129c8[_0x0ecc('0x28')]['key']};});_0x1f1c0f=qs['getOptions'](_0x1bb50d,_0x1ff966);return interaction[_0x0ecc('0x29')](_0x0ecc('0x2a'),_0x1ff966[_0x0ecc('0x2b')],_0x1ff966['user'],_0x1f1c0f,_0x1bb50d)[_0x0ecc('0x1d')](respondWithFilteredResult(_0x10e66a,_0x1f1c0f))['catch'](handleError(_0x10e66a,null));};exports['show']=function(_0x39aad4,_0x1d1d9c){var _0x4612e3={'raw':![],'where':{'id':_0x39aad4[_0x0ecc('0x2c')]['id']}},_0x382762={};_0x382762[_0x0ecc('0x2d')]=_[_0x0ecc('0x2e')](db[_0x0ecc('0x25')][_0x0ecc('0x26')]);_0x382762[_0x0ecc('0x2b')]=_[_0x0ecc('0x2e')](_0x39aad4[_0x0ecc('0x2b')]);_0x382762[_0x0ecc('0x2f')]=_['intersection'](_0x382762[_0x0ecc('0x2d')],_0x382762[_0x0ecc('0x2b')]);_0x4612e3[_0x0ecc('0x30')]=_[_0x0ecc('0x31')](_0x382762[_0x0ecc('0x2d')],qs['fields'](_0x39aad4[_0x0ecc('0x2b')][_0x0ecc('0x32')]));_0x4612e3[_0x0ecc('0x30')]=_0x4612e3['attributes'][_0x0ecc('0x33')]?_0x4612e3[_0x0ecc('0x30')]:_0x382762[_0x0ecc('0x2d')];if(_0x39aad4[_0x0ecc('0x2b')][_0x0ecc('0x34')]){_0x4612e3[_0x0ecc('0x35')]=[{'all':!![]}];}_0x4612e3=_[_0x0ecc('0x36')]({},_0x4612e3,_0x39aad4[_0x0ecc('0x37')]);return db[_0x0ecc('0x25')][_0x0ecc('0x38')](_0x4612e3)[_0x0ecc('0x1d')](handleEntityNotFound(_0x1d1d9c,null))['then'](respondWithResult(_0x1d1d9c,null))[_0x0ecc('0x39')](handleError(_0x1d1d9c,null));};exports[_0x0ecc('0x3a')]=function(_0x373281,_0x7bedfb){return db['SmsInteraction'][_0x0ecc('0x3a')](_0x373281[_0x0ecc('0x3b')],{})['then'](respondWithResult(_0x7bedfb,0xc9))[_0x0ecc('0x39')](handleError(_0x7bedfb,null));};exports['update']=function(_0x54954a,_0x5808d5){if(_0x54954a[_0x0ecc('0x3b')]['id']){delete _0x54954a[_0x0ecc('0x3b')]['id'];}return db[_0x0ecc('0x25')][_0x0ecc('0x38')]({'where':{'id':_0x54954a[_0x0ecc('0x2c')]['id']}})[_0x0ecc('0x1d')](handleEntityNotFound(_0x5808d5,null))[_0x0ecc('0x1d')](saveUpdates(_0x54954a[_0x0ecc('0x3b')],null))[_0x0ecc('0x1d')](respondWithResult(_0x5808d5,null))['catch'](handleError(_0x5808d5,null));};exports[_0x0ecc('0x1e')]=function(_0x29c325,_0x1446f2){return db['SmsInteraction'][_0x0ecc('0x38')]({'where':{'id':_0x29c325[_0x0ecc('0x2c')]['id']}})[_0x0ecc('0x1d')](handleEntityNotFound(_0x1446f2,null))['then'](removeEntity(_0x1446f2,null))[_0x0ecc('0x39')](handleError(_0x1446f2,null));};exports[_0x0ecc('0x3c')]=function(_0x13eb46,_0x513d30){return db[_0x0ecc('0x25')][_0x0ecc('0x3c')]()[_0x0ecc('0x1d')](respondWithResult(_0x513d30,null))[_0x0ecc('0x39')](handleError(_0x513d30,null));};exports['addMessage']=function(_0x90117e,_0x5c41e0){return db[_0x0ecc('0x3d')]['find']({'where':{'id':_0x90117e[_0x0ecc('0x2c')]['id']}})[_0x0ecc('0x1d')](handleEntityNotFound(_0x5c41e0,null))[_0x0ecc('0x1d')](function(_0x41912d){if(_0x41912d){return _0x41912d[_0x0ecc('0x3e')](_0x90117e['body'][_0x0ecc('0x3f')],_[_0x0ecc('0x40')](_0x90117e[_0x0ecc('0x3b')],[_0x0ecc('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x5c41e0,null))[_0x0ecc('0x39')](handleError(_0x5c41e0,null));};exports[_0x0ecc('0x41')]=function(_0x305b49,_0xc64487){var _0x5b3723={'raw':![],'where':{}};var _0xaf1337={};var _0x152c60={'count':0x0,'rows':[]};return db[_0x0ecc('0x25')]['findOne']({'where':{'id':_0x305b49[_0x0ecc('0x2c')]['id']}})[_0x0ecc('0x1d')](handleEntityNotFound(_0xc64487,null))[_0x0ecc('0x1d')](function(_0x5e352e){if(_0x5e352e){_0xaf1337[_0x0ecc('0x2d')]=_[_0x0ecc('0x2e')](db[_0x0ecc('0x3d')][_0x0ecc('0x26')]);_0xaf1337['query']=_[_0x0ecc('0x2e')](_0x305b49[_0x0ecc('0x2b')]);_0xaf1337[_0x0ecc('0x2f')]=_[_0x0ecc('0x31')](_0xaf1337[_0x0ecc('0x2d')],_0xaf1337['query']);_0x5b3723['attributes']=_[_0x0ecc('0x31')](_0xaf1337[_0x0ecc('0x2d')],qs[_0x0ecc('0x32')](_0x305b49[_0x0ecc('0x2b')][_0x0ecc('0x32')]));_0x5b3723[_0x0ecc('0x30')]=_0x5b3723[_0x0ecc('0x30')][_0x0ecc('0x33')]?_0x5b3723['attributes']:_0xaf1337['model'];if(!_0x305b49['query'][_0x0ecc('0x42')]('nolimit')){_0x5b3723['limit']=qs[_0x0ecc('0x18')](_0x305b49['query']['limit']);_0x5b3723[_0x0ecc('0x1a')]=qs[_0x0ecc('0x1a')](_0x305b49[_0x0ecc('0x2b')][_0x0ecc('0x1a')]);}_0x5b3723[_0x0ecc('0x43')]=qs['sort'](_0x305b49[_0x0ecc('0x2b')][_0x0ecc('0x44')]);_0x5b3723[_0x0ecc('0x45')]=qs[_0x0ecc('0x2f')](_['pick'](_0x305b49[_0x0ecc('0x2b')],_0xaf1337[_0x0ecc('0x2f')]));_0x5b3723[_0x0ecc('0x45')][_0x0ecc('0x46')]=_0x5e352e['id'];if(_0x305b49[_0x0ecc('0x2b')][_0x0ecc('0x47')]){_0x5b3723[_0x0ecc('0x45')]=_[_0x0ecc('0x36')](_0x5b3723[_0x0ecc('0x45')],{'$or':_['map'](_0x5b3723[_0x0ecc('0x30')],function(_0x5399ad){var _0x2ca8aa={};_0x2ca8aa[_0x5399ad]={'$like':'%'+_0x305b49[_0x0ecc('0x2b')][_0x0ecc('0x47')]+'%'};return _0x2ca8aa;})});}if(_0x305b49['query'][_0x0ecc('0x48')]){var _0x4e5be4=_0x305b49[_0x0ecc('0x2b')][_0x0ecc('0x48')]['split'](',');var _0x126505={};_0x126505[_0x4e5be4[0x0]]={'$gte':moment(_0x4e5be4[0x1])[_0x0ecc('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5b3723['where']=_[_0x0ecc('0x36')](_0x5b3723[_0x0ecc('0x45')],_0x126505);}_0x5b3723=_['merge']({},_0x5b3723,_0x305b49[_0x0ecc('0x37')]);return db[_0x0ecc('0x3d')][_0x0ecc('0x19')]({'where':_0x5b3723[_0x0ecc('0x45')]})[_0x0ecc('0x1d')](function(_0x42bf10){_0x152c60['count']=_0x42bf10;if(_0x305b49[_0x0ecc('0x2b')]['includeAll']){_0x5b3723[_0x0ecc('0x35')]=[{'all':!![]}];}return db[_0x0ecc('0x3d')][_0x0ecc('0x29')](_0x5b3723);})[_0x0ecc('0x1d')](function(_0x1b4c73){_0x152c60[_0x0ecc('0x4a')]=_0x1b4c73;return _0x152c60;});}})[_0x0ecc('0x1d')](respondWithFilteredResult(_0xc64487,_0x5b3723))[_0x0ecc('0x39')](handleError(_0xc64487,null));};exports[_0x0ecc('0x4b')]=function(_0x339781,_0x4231ed){return db[_0x0ecc('0x25')][_0x0ecc('0x38')]({'where':{'id':_0x339781[_0x0ecc('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4231ed,null))[_0x0ecc('0x1d')](function(_0x262104){if(_0x262104){return _0x262104[_0x0ecc('0x4c')](_0x339781['body'][_0x0ecc('0x3f')],_[_0x0ecc('0x40')](_0x339781[_0x0ecc('0x3b')],[_0x0ecc('0x3f'),'id'])||{})['spread'](function(){return db[_0x0ecc('0x4d')][_0x0ecc('0x29')]({'attributes':['id','name',_0x0ecc('0x4e')],'where':{'id':_0x339781[_0x0ecc('0x3b')][_0x0ecc('0x3f')]}});})[_0x0ecc('0x1d')](function(_0x55c3a4){socket['emit'](_0x0ecc('0x4f'),{'id':Number(_0x339781[_0x0ecc('0x2c')]['id']),'tags':_0x55c3a4||[]});return{'id':Number(_0x339781[_0x0ecc('0x2c')]['id']),'tags':_0x55c3a4||[]};});}})[_0x0ecc('0x1d')](respondWithResult(_0x4231ed,null))[_0x0ecc('0x39')](handleError(_0x4231ed,null));};exports['removeTags']=function(_0x5af78b,_0x4e35e7){return db['SmsInteraction'][_0x0ecc('0x38')]({'where':{'id':_0x5af78b[_0x0ecc('0x2c')]['id']}})[_0x0ecc('0x1d')](handleEntityNotFound(_0x4e35e7,null))[_0x0ecc('0x1d')](function(_0x3a5974){if(_0x3a5974){return _0x3a5974[_0x0ecc('0x50')](_0x5af78b['query'][_0x0ecc('0x3f')]);}})[_0x0ecc('0x1d')](respondWithStatusCode(_0x4e35e7,null))[_0x0ecc('0x39')](handleError(_0x4e35e7,null));};exports[_0x0ecc('0x51')]=function(_0x34a955,_0x3338fb){var _0x375492=moment()[_0x0ecc('0x52')]()[_0x0ecc('0x53')]();var _0x5d577b=path[_0x0ecc('0x54')](config[_0x0ecc('0x55')],_0x0ecc('0x56'),_0x0ecc('0x57'),_0x0ecc('0x58'));var _0x512871=path[_0x0ecc('0x54')](_0x5d577b,_0x375492);var _0x1b20ea=util[_0x0ecc('0x49')](_0x0ecc('0x59'),_0x34a955['params']['id'],_0x375492);var _0x1fee17=path[_0x0ecc('0x54')](_0x5d577b,_0x1b20ea);var _0x4d8fa8=[];_0x4d8fa8[_0x0ecc('0x5a')]({'model':db[_0x0ecc('0x5b')],'as':_0x0ecc('0x5b'),'attributes':['id',_0x0ecc('0x5c')],'raw':!![]});_0x4d8fa8[_0x0ecc('0x5a')]({'model':db[_0x0ecc('0x5d')],'as':'Contact','attributes':['id',_0x0ecc('0x5e'),_0x0ecc('0x5f')],'raw':!![]});var _0x289e7e=[{'model':db[_0x0ecc('0x3d')],'as':_0x0ecc('0x60'),'attributes':['id',_0x0ecc('0x3b'),'createdAt','direction',_0x0ecc('0x61'),_0x0ecc('0x62')],'include':_0x4d8fa8}];_0x289e7e[_0x0ecc('0x5a')]({'model':db[_0x0ecc('0x63')],'as':'Account','attributes':['id',_0x0ecc('0x21')]});_0x289e7e[_0x0ecc('0x5a')]({'model':db[_0x0ecc('0x5b')],'as':_0x0ecc('0x64'),'attributes':['id',_0x0ecc('0x5c')]});return db[_0x0ecc('0x25')][_0x0ecc('0x38')]({'where':{'id':_0x34a955[_0x0ecc('0x2c')]['id']},'include':_0x289e7e})['then'](handleEntityNotFound(_0x3338fb,null))[_0x0ecc('0x1d')](function(_0x132841){if(_0x132841){var _0x2f3593=_0x132841['get']({'plain':!![]});fs[_0x0ecc('0x65')](_0x512871);var _0x522893={'channel':_0x0ecc('0x66'),'account':_0x2f3593[_0x0ecc('0x67')][_0x0ecc('0x21')],'agent':_0x2f3593['Owner']?_0x2f3593['Owner']['fullname']:'N.A.','createdAt':moment(_0x2f3593[_0x0ecc('0x68')])['format'](_0x0ecc('0x69'))[_0x0ecc('0x53')](),'closedAt':_0x2f3593[_0x0ecc('0x6a')]?moment(_0x2f3593['closedAt'])['format'](_0x0ecc('0x69'))['toString']():'','disposition':_0x2f3593[_0x0ecc('0x6b')],'messages':_(_0x2f3593[_0x0ecc('0x60')])[_0x0ecc('0x47')]({'secret':![]})[_0x0ecc('0x24')](function(_0x43e551){return{'date':moment(_0x43e551['createdAt'])[_0x0ecc('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0ecc('0x53')](),'sender':_0x43e551[_0x0ecc('0x6c')]==='out'?_0x43e551[_0x0ecc('0x5b')]?_0x43e551[_0x0ecc('0x5b')]['fullname']:_0x0ecc('0x6d'):_0x43e551[_0x0ecc('0x6e')]['firstName']+(_0x43e551[_0x0ecc('0x6e')]['lastName']?'\x20'+_0x43e551[_0x0ecc('0x6e')]['lastName']:''),'body':_0x43e551[_0x0ecc('0x3b')],'direction':_0x43e551['direction']==='out'?'A':'C','secret':_0x43e551[_0x0ecc('0x61')],'read':_0x43e551[_0x0ecc('0x62')]};})['value']()};return ejs['renderFile'](path[_0x0ecc('0x54')](config[_0x0ecc('0x55')],_0x0ecc('0x56'),_0x0ecc('0x6f'),_0x0ecc('0x70')),{'interaction':_0x522893})[_0x0ecc('0x1d')](function(_0x376d10){var _0x283286=path['join'](_0x512871,'transcript-'+_0x2f3593['id']+'-'+_0x375492+_0x0ecc('0x71'));var _0x53edaa={'path':_0x283286,'channel':_0x0ecc('0x66'),'interactionId':_0x2f3593['id']};return pdf[_0x0ecc('0x72')](_0x376d10,_0x53edaa);})[_0x0ecc('0x1d')](function(){return new BPromise(function(_0x4a39ac,_0x10a6f2){zipdir(_0x512871,{'saveTo':_0x1fee17},function(_0x25c2bc,_0x146d62){if(_0x25c2bc)return _0x10a6f2(_0x25c2bc);return _0x4a39ac(_0x146d62);});})[_0x0ecc('0x1d')](function(){return new BPromise(function(_0x19200d,_0x12c8fe){rimraf(_0x512871,function(_0x48caa2){if(_0x48caa2)_0x12c8fe(_0x48caa2);return _0x19200d();});});})[_0x0ecc('0x1d')](function(){return _0x3338fb[_0x0ecc('0x51')](_0x1fee17,_0x1b20ea,function(_0x370c56){if(_0x370c56){console['log'](_0x0ecc('0x73'),_0x370c56);}else{fs[_0x0ecc('0x74')](_0x1fee17);}});});});}else{return _0x3338fb['sendStatus'](0xc8);}})['catch'](handleError(_0x3338fb,null));}; \ No newline at end of file +var _0x90a0=['register','sendStatus','status','json','offset','undefined','count','Content-Range','update','destroy','then','end','error','name','send','index','map','SmsInteraction','rawAttributes','type','sms','user','model','keys','query','filters','intersection','fields','attributes','length','includeAll','merge','options','find','catch','create','body','params','describe','addMessage','ids','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','limit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','join','root','files','tmp','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','secret','SmsAccount','Owner','get','mkdirSync','Sms','Account','N.A.','toString','closed','closedAt','direction','out','System','read','renderFile','server','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','rimraf','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket'];(function(_0x2d64a8,_0x2ab976){var _0xafe2e6=function(_0x578b4c){while(--_0x578b4c){_0x2d64a8['push'](_0x2d64a8['shift']());}};_0xafe2e6(++_0x2ab976);}(_0x90a0,0x15c));var _0x090a=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x90a0[_0x34eb31];return _0x254994;};'use strict';var rimraf=require(_0x090a('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x090a('0x1'));var util=require(_0x090a('0x2'));var path=require(_0x090a('0x3'));var ejs=require(_0x090a('0x4'));var fs=require('fs');var _=require(_0x090a('0x5'));var Redis=require('ioredis');var interaction=require(_0x090a('0x6'));var qs=require(_0x090a('0x7'));var pdf=require(_0x090a('0x8'));var logger=require(_0x090a('0x9'))(_0x090a('0xa'));var config=require(_0x090a('0xb'));var db=require(_0x090a('0xc'))['db'];config[_0x090a('0xd')]=_[_0x090a('0xe')](config[_0x090a('0xd')],{'host':_0x090a('0xf'),'port':0x18eb});var socket=require(_0x090a('0x10'))(new Redis(config[_0x090a('0xd')]));require(_0x090a('0x11'))[_0x090a('0x12')](socket);function respondWithStatusCode(_0x2e5088,_0x2d07ff){_0x2d07ff=_0x2d07ff||0xcc;return function(_0x47b57e){if(_0x47b57e){return _0x2e5088[_0x090a('0x13')](_0x2d07ff);}return _0x2e5088[_0x090a('0x14')](_0x2d07ff)['end']();};}function respondWithResult(_0x201e53,_0x4e9684){_0x4e9684=_0x4e9684||0xc8;return function(_0x553364){if(_0x553364){return _0x201e53[_0x090a('0x14')](_0x4e9684)[_0x090a('0x15')](_0x553364);}};}function respondWithFilteredResult(_0x318644,_0x10b672){return function(_0x260455){if(_0x260455){var _0x39df9a=typeof _0x10b672[_0x090a('0x16')]===_0x090a('0x17')&&typeof _0x10b672['limit']==='undefined';var _0x15e51c=_0x260455[_0x090a('0x18')];var _0x403688=_0x39df9a?0x0:_0x10b672[_0x090a('0x16')];var _0xf24b6d=_0x39df9a?_0x260455['count']:_0x10b672[_0x090a('0x16')]+_0x10b672['limit'];var _0x455e0b;if(_0xf24b6d>=_0x15e51c){_0xf24b6d=_0x15e51c;_0x455e0b=0xc8;}else{_0x455e0b=0xce;}_0x318644[_0x090a('0x14')](_0x455e0b);return _0x318644['set'](_0x090a('0x19'),_0x403688+'-'+_0xf24b6d+'/'+_0x15e51c)[_0x090a('0x15')](_0x260455);}return null;};}function saveUpdates(_0x5eca1e){return function(_0x19e350){if(_0x19e350){return _0x19e350[_0x090a('0x1a')](_0x5eca1e)['then'](function(_0x499997){return _0x499997;});}return null;};}function removeEntity(_0x48afa6){return function(_0x312109){if(_0x312109){return _0x312109[_0x090a('0x1b')]()[_0x090a('0x1c')](function(){_0x48afa6['status'](0xcc)[_0x090a('0x1d')]();});}};}function handleEntityNotFound(_0x2f7b87){return function(_0x225e14){if(!_0x225e14){_0x2f7b87[_0x090a('0x13')](0x194);}return _0x225e14;};}function handleError(_0x4050fc,_0x12e82e){_0x12e82e=_0x12e82e||0x1f4;return function(_0x3bcf0c){logger[_0x090a('0x1e')](_0x3bcf0c['stack']);if(_0x3bcf0c['name']){delete _0x3bcf0c[_0x090a('0x1f')];}_0x4050fc['status'](_0x12e82e)[_0x090a('0x20')](_0x3bcf0c);};}exports[_0x090a('0x21')]=function(_0x4a6a3b,_0x2b47c7){var _0x20c6d7={};var _0x3cdc06=_[_0x090a('0x22')](db[_0x090a('0x23')][_0x090a('0x24')],function(_0x32dc8f){return{'name':_0x32dc8f['fieldName'],'type':_0x32dc8f[_0x090a('0x25')]['key']};});_0x20c6d7=qs['getOptions'](_0x3cdc06,_0x4a6a3b);return interaction['findAll'](_0x090a('0x26'),_0x4a6a3b['query'],_0x4a6a3b[_0x090a('0x27')],_0x20c6d7,_0x3cdc06)[_0x090a('0x1c')](respondWithFilteredResult(_0x2b47c7,_0x20c6d7))['catch'](handleError(_0x2b47c7,null));};exports['show']=function(_0x15ada0,_0x3d133f){var _0xcec60a={'raw':![],'where':{'id':_0x15ada0['params']['id']}},_0x4603f1={};_0x4603f1[_0x090a('0x28')]=_[_0x090a('0x29')](db[_0x090a('0x23')][_0x090a('0x24')]);_0x4603f1['query']=_[_0x090a('0x29')](_0x15ada0[_0x090a('0x2a')]);_0x4603f1[_0x090a('0x2b')]=_[_0x090a('0x2c')](_0x4603f1[_0x090a('0x28')],_0x4603f1[_0x090a('0x2a')]);_0xcec60a['attributes']=_[_0x090a('0x2c')](_0x4603f1[_0x090a('0x28')],qs['fields'](_0x15ada0[_0x090a('0x2a')][_0x090a('0x2d')]));_0xcec60a['attributes']=_0xcec60a[_0x090a('0x2e')][_0x090a('0x2f')]?_0xcec60a[_0x090a('0x2e')]:_0x4603f1[_0x090a('0x28')];if(_0x15ada0[_0x090a('0x2a')][_0x090a('0x30')]){_0xcec60a['include']=[{'all':!![]}];}_0xcec60a=_[_0x090a('0x31')]({},_0xcec60a,_0x15ada0[_0x090a('0x32')]);return db['SmsInteraction'][_0x090a('0x33')](_0xcec60a)['then'](handleEntityNotFound(_0x3d133f,null))['then'](respondWithResult(_0x3d133f,null))[_0x090a('0x34')](handleError(_0x3d133f,null));};exports['create']=function(_0x5d2648,_0x4928de){return db[_0x090a('0x23')][_0x090a('0x35')](_0x5d2648['body'],{})[_0x090a('0x1c')](respondWithResult(_0x4928de,0xc9))[_0x090a('0x34')](handleError(_0x4928de,null));};exports[_0x090a('0x1a')]=function(_0x1c704f,_0x5963cc){if(_0x1c704f[_0x090a('0x36')]['id']){delete _0x1c704f['body']['id'];}return db[_0x090a('0x23')][_0x090a('0x33')]({'where':{'id':_0x1c704f['params']['id']}})[_0x090a('0x1c')](handleEntityNotFound(_0x5963cc,null))[_0x090a('0x1c')](saveUpdates(_0x1c704f['body'],null))[_0x090a('0x1c')](respondWithResult(_0x5963cc,null))['catch'](handleError(_0x5963cc,null));};exports[_0x090a('0x1b')]=function(_0x5cfc11,_0x216f62){return db[_0x090a('0x23')]['find']({'where':{'id':_0x5cfc11[_0x090a('0x37')]['id']}})['then'](handleEntityNotFound(_0x216f62,null))['then'](removeEntity(_0x216f62,null))[_0x090a('0x34')](handleError(_0x216f62,null));};exports[_0x090a('0x38')]=function(_0x5c2dcc,_0x401c02){return db[_0x090a('0x23')][_0x090a('0x38')]()[_0x090a('0x1c')](respondWithResult(_0x401c02,null))['catch'](handleError(_0x401c02,null));};exports[_0x090a('0x39')]=function(_0xa64d4d,_0x1ccdae){return db['SmsMessage'][_0x090a('0x33')]({'where':{'id':_0xa64d4d[_0x090a('0x37')]['id']}})[_0x090a('0x1c')](handleEntityNotFound(_0x1ccdae,null))['then'](function(_0x43ff07){if(_0x43ff07){return _0x43ff07[_0x090a('0x39')](_0xa64d4d[_0x090a('0x36')][_0x090a('0x3a')],_['omit'](_0xa64d4d[_0x090a('0x36')],['ids','id'])||{});}})[_0x090a('0x1c')](respondWithResult(_0x1ccdae,null))[_0x090a('0x34')](handleError(_0x1ccdae,null));};exports[_0x090a('0x3b')]=function(_0x2c3372,_0x2f51a7){var _0x4ce6d7={'raw':![],'where':{}};var _0x5c0d60={};var _0x3e9878={'count':0x0,'rows':[]};return db[_0x090a('0x23')][_0x090a('0x3c')]({'where':{'id':_0x2c3372[_0x090a('0x37')]['id']}})['then'](handleEntityNotFound(_0x2f51a7,null))['then'](function(_0x431881){if(_0x431881){_0x5c0d60['model']=_[_0x090a('0x29')](db[_0x090a('0x3d')][_0x090a('0x24')]);_0x5c0d60['query']=_[_0x090a('0x29')](_0x2c3372[_0x090a('0x2a')]);_0x5c0d60[_0x090a('0x2b')]=_[_0x090a('0x2c')](_0x5c0d60[_0x090a('0x28')],_0x5c0d60[_0x090a('0x2a')]);_0x4ce6d7['attributes']=_[_0x090a('0x2c')](_0x5c0d60[_0x090a('0x28')],qs[_0x090a('0x2d')](_0x2c3372['query'][_0x090a('0x2d')]));_0x4ce6d7[_0x090a('0x2e')]=_0x4ce6d7[_0x090a('0x2e')]['length']?_0x4ce6d7[_0x090a('0x2e')]:_0x5c0d60[_0x090a('0x28')];if(!_0x2c3372[_0x090a('0x2a')][_0x090a('0x3e')](_0x090a('0x3f'))){_0x4ce6d7[_0x090a('0x40')]=qs[_0x090a('0x40')](_0x2c3372[_0x090a('0x2a')][_0x090a('0x40')]);_0x4ce6d7['offset']=qs[_0x090a('0x16')](_0x2c3372[_0x090a('0x2a')][_0x090a('0x16')]);}_0x4ce6d7[_0x090a('0x41')]=qs[_0x090a('0x42')](_0x2c3372['query'][_0x090a('0x42')]);_0x4ce6d7[_0x090a('0x43')]=qs['filters'](_[_0x090a('0x44')](_0x2c3372[_0x090a('0x2a')],_0x5c0d60[_0x090a('0x2b')]));_0x4ce6d7['where'][_0x090a('0x45')]=_0x431881['id'];if(_0x2c3372[_0x090a('0x2a')][_0x090a('0x46')]){_0x4ce6d7['where']=_[_0x090a('0x31')](_0x4ce6d7[_0x090a('0x43')],{'$or':_[_0x090a('0x22')](_0x4ce6d7[_0x090a('0x2e')],function(_0x4245d9){var _0x29f462={};_0x29f462[_0x4245d9]={'$like':'%'+_0x2c3372[_0x090a('0x2a')]['filter']+'%'};return _0x29f462;})});}if(_0x2c3372['query'][_0x090a('0x47')]){var _0x35f353=_0x2c3372[_0x090a('0x2a')][_0x090a('0x47')][_0x090a('0x48')](',');var _0x29d2f4={};_0x29d2f4[_0x35f353[0x0]]={'$gte':moment(_0x35f353[0x1])[_0x090a('0x49')](_0x090a('0x4a'))};_0x4ce6d7['where']=_[_0x090a('0x31')](_0x4ce6d7[_0x090a('0x43')],_0x29d2f4);}_0x4ce6d7=_['merge']({},_0x4ce6d7,_0x2c3372[_0x090a('0x32')]);return db[_0x090a('0x3d')][_0x090a('0x18')]({'where':_0x4ce6d7[_0x090a('0x43')]})[_0x090a('0x1c')](function(_0x44be42){_0x3e9878['count']=_0x44be42;if(_0x2c3372[_0x090a('0x2a')][_0x090a('0x30')]){_0x4ce6d7[_0x090a('0x4b')]=[{'all':!![]}];}return db['SmsMessage'][_0x090a('0x4c')](_0x4ce6d7);})[_0x090a('0x1c')](function(_0x2341a5){_0x3e9878[_0x090a('0x4d')]=_0x2341a5;return _0x3e9878;});}})[_0x090a('0x1c')](respondWithFilteredResult(_0x2f51a7,_0x4ce6d7))['catch'](handleError(_0x2f51a7,null));};exports[_0x090a('0x4e')]=function(_0x200fa0,_0x5c8e05){return db[_0x090a('0x23')]['find']({'where':{'id':_0x200fa0[_0x090a('0x37')]['id']}})[_0x090a('0x1c')](handleEntityNotFound(_0x5c8e05,null))['then'](function(_0x27507a){if(_0x27507a){return _0x27507a[_0x090a('0x4f')](_0x200fa0[_0x090a('0x36')]['ids'],_['omit'](_0x200fa0[_0x090a('0x36')],[_0x090a('0x3a'),'id'])||{})['spread'](function(){return db[_0x090a('0x50')]['findAll']({'attributes':['id',_0x090a('0x1f'),_0x090a('0x51')],'where':{'id':_0x200fa0['body'][_0x090a('0x3a')]}});})['then'](function(_0x2cc54a){socket[_0x090a('0x52')](_0x090a('0x53'),{'id':Number(_0x200fa0[_0x090a('0x37')]['id']),'tags':_0x2cc54a||[]});return{'id':Number(_0x200fa0[_0x090a('0x37')]['id']),'tags':_0x2cc54a||[]};});}})[_0x090a('0x1c')](respondWithResult(_0x5c8e05,null))[_0x090a('0x34')](handleError(_0x5c8e05,null));};exports[_0x090a('0x54')]=function(_0x324d8b,_0x5dd256){return db[_0x090a('0x23')][_0x090a('0x33')]({'where':{'id':_0x324d8b[_0x090a('0x37')]['id']}})['then'](handleEntityNotFound(_0x5dd256,null))[_0x090a('0x1c')](function(_0x24e042){if(_0x24e042){return _0x24e042[_0x090a('0x54')](_0x324d8b['query'][_0x090a('0x3a')]);}})[_0x090a('0x1c')](respondWithStatusCode(_0x5dd256,null))[_0x090a('0x34')](handleError(_0x5dd256,null));};exports[_0x090a('0x55')]=function(_0xae6a6e,_0x290b8b){var _0x2ee1da=moment()[_0x090a('0x56')]()['toString']();var _0x592840=path[_0x090a('0x57')](config[_0x090a('0x58')],'server',_0x090a('0x59'),_0x090a('0x5a'));var _0x24fa5f=path['join'](_0x592840,_0x2ee1da);var _0x2c684e=util[_0x090a('0x49')]('transcript-%d-%s.zip',_0xae6a6e[_0x090a('0x37')]['id'],_0x2ee1da);var _0x375ec8=path[_0x090a('0x57')](_0x592840,_0x2c684e);var _0x539d97=[];_0x539d97[_0x090a('0x5b')]({'model':db['User'],'as':_0x090a('0x5c'),'attributes':['id',_0x090a('0x5d')],'raw':!![]});_0x539d97[_0x090a('0x5b')]({'model':db[_0x090a('0x5e')],'as':_0x090a('0x5f'),'attributes':['id',_0x090a('0x60'),_0x090a('0x61')],'raw':!![]});var _0x16e136=[{'model':db[_0x090a('0x3d')],'as':_0x090a('0x62'),'attributes':['id',_0x090a('0x36'),_0x090a('0x63'),'direction',_0x090a('0x64'),'read'],'include':_0x539d97}];_0x16e136[_0x090a('0x5b')]({'model':db[_0x090a('0x65')],'as':'Account','attributes':['id',_0x090a('0x1f')]});_0x16e136[_0x090a('0x5b')]({'model':db[_0x090a('0x5c')],'as':_0x090a('0x66'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x090a('0x33')]({'where':{'id':_0xae6a6e[_0x090a('0x37')]['id']},'include':_0x16e136})[_0x090a('0x1c')](handleEntityNotFound(_0x290b8b,null))[_0x090a('0x1c')](function(_0xc0d57e){if(_0xc0d57e){var _0x4cb1d8=_0xc0d57e[_0x090a('0x67')]({'plain':!![]});fs[_0x090a('0x68')](_0x24fa5f);var _0x9aface={'channel':_0x090a('0x69'),'account':_0x4cb1d8[_0x090a('0x6a')][_0x090a('0x1f')],'agent':_0x4cb1d8['Owner']?_0x4cb1d8['Owner'][_0x090a('0x5d')]:_0x090a('0x6b'),'createdAt':moment(_0x4cb1d8[_0x090a('0x63')])[_0x090a('0x49')](_0x090a('0x4a'))[_0x090a('0x6c')](),'closedAt':_0x4cb1d8[_0x090a('0x6d')]?moment(_0x4cb1d8[_0x090a('0x6e')])[_0x090a('0x49')](_0x090a('0x4a'))[_0x090a('0x6c')]():'','disposition':_0x4cb1d8['disposition'],'messages':_(_0x4cb1d8[_0x090a('0x62')])[_0x090a('0x46')]({'secret':![]})['map'](function(_0x5b4167){return{'date':moment(_0x5b4167[_0x090a('0x63')])[_0x090a('0x49')](_0x090a('0x4a'))[_0x090a('0x6c')](),'sender':_0x5b4167[_0x090a('0x6f')]===_0x090a('0x70')?_0x5b4167[_0x090a('0x5c')]?_0x5b4167[_0x090a('0x5c')][_0x090a('0x5d')]:_0x090a('0x71'):_0x5b4167['Contact'][_0x090a('0x60')]+(_0x5b4167[_0x090a('0x5f')][_0x090a('0x61')]?'\x20'+_0x5b4167[_0x090a('0x5f')][_0x090a('0x61')]:''),'body':_0x5b4167[_0x090a('0x36')],'direction':_0x5b4167[_0x090a('0x6f')]===_0x090a('0x70')?'A':'C','secret':_0x5b4167['secret'],'read':_0x5b4167[_0x090a('0x72')]};})['value']()};return ejs[_0x090a('0x73')](path[_0x090a('0x57')](config[_0x090a('0x58')],_0x090a('0x74'),_0x090a('0x75'),_0x090a('0x76')),{'interaction':_0x9aface})['then'](function(_0x3996bb){var _0xcf6e27=path[_0x090a('0x57')](_0x24fa5f,_0x090a('0x77')+_0x4cb1d8['id']+'-'+_0x2ee1da+'.pdf');var _0x2f0625={'path':_0xcf6e27,'channel':_0x090a('0x69'),'interactionId':_0x4cb1d8['id']};return pdf[_0x090a('0x78')](_0x3996bb,_0x2f0625);})['then'](function(){return new BPromise(function(_0x1f1350,_0x5b9911){zipdir(_0x24fa5f,{'saveTo':_0x375ec8},function(_0x588f69,_0x3dc82e){if(_0x588f69)return _0x5b9911(_0x588f69);return _0x1f1350(_0x3dc82e);});})[_0x090a('0x1c')](function(){return new BPromise(function(_0x195d00,_0x52904d){rimraf(_0x24fa5f,function(_0x380e0c){if(_0x380e0c)_0x52904d(_0x380e0c);return _0x195d00();});});})[_0x090a('0x1c')](function(){return _0x290b8b['download'](_0x375ec8,_0x2c684e,function(_0x1a13d8){if(_0x1a13d8){console['log'](_0x090a('0x79'),_0x1a13d8);}else{fs['unlinkSync'](_0x375ec8);}});});});}else{return _0x290b8b[_0x090a('0x13')](0xc8);}})[_0x090a('0x34')](handleError(_0x290b8b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 8350ed5..3d43bfc 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 _0x66fa=['remove','getUsers','then','setDataValue','map','findAll','emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x58a616,_0x345767){var _0x2d4d44=function(_0x4a9555){while(--_0x4a9555){_0x58a616['push'](_0x58a616['shift']());}};_0x2d4d44(++_0x345767);}(_0x66fa,0x117));var _0xa66f=function(_0x2bdfff,_0x3d576f){_0x2bdfff=_0x2bdfff-0x0;var _0x58f512=_0x66fa[_0x2bdfff];return _0x58f512;};'use strict';var EventEmitter=require(_0xa66f('0x0'));var SmsInteraction=require(_0xa66f('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xa66f('0x1'))['db'][_0xa66f('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa66f('0x3')](0x0);var events={'afterCreate':_0xa66f('0x4'),'afterUpdate':_0xa66f('0x5'),'afterDestroy':_0xa66f('0x6')};function emitEvent(_0x3f4904){return function(_0x5ebea5,_0x4fd9d0,_0x2239d3){_0x5ebea5[_0xa66f('0x7')]({'attributes':['id'],'raw':!![]})[_0xa66f('0x8')](function(_0x1d02fc){_0x5ebea5[_0xa66f('0x9')]('Users',_0x1d02fc[_0xa66f('0xa')](function(_0x4f6717){return{'id':_0x4f6717['id']};}));return SmsMessage[_0xa66f('0xb')]({'where':{'SmsInteractionId':_0x5ebea5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x101e10){_0x5ebea5['setDataValue']('unreadMessages',_0x101e10['length']);SmsInteractionEvents[_0xa66f('0xc')](_0x3f4904+':'+_0x5ebea5['id'],_0x5ebea5);SmsInteractionEvents[_0xa66f('0xc')](_0x3f4904,_0x5ebea5);_0x2239d3(null);})['catch'](_0x2239d3(null));};}for(var e in events){if(events[_0xa66f('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xa66f('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x5f66=['update','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x5c6ceb,_0x4ed099){var _0x28821b=function(_0x391add){while(--_0x391add){_0x5c6ceb['push'](_0x5c6ceb['shift']());}};_0x28821b(++_0x4ed099);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x65f6('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x65f6('0x0'))['db'][_0x65f6('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x65f6('0x2')](0x0);var events={'afterCreate':_0x65f6('0x3'),'afterUpdate':_0x65f6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c5029){return function(_0x5150c8,_0x1c9f5b,_0x22b017){_0x5150c8['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1c0e12){_0x5150c8[_0x65f6('0x5')](_0x65f6('0x6'),_0x1c0e12[_0x65f6('0x7')](function(_0xc44c70){return{'id':_0xc44c70['id']};}));return SmsMessage[_0x65f6('0x8')]({'where':{'SmsInteractionId':_0x5150c8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5123ee){_0x5150c8[_0x65f6('0x5')](_0x65f6('0x9'),_0x5123ee[_0x65f6('0xa')]);SmsInteractionEvents[_0x65f6('0xb')](_0x3c5029+':'+_0x5150c8['id'],_0x5150c8);SmsInteractionEvents['emit'](_0x3c5029,_0x5150c8);_0x22b017(null);})[_0x65f6('0xc')](_0x22b017(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x65f6('0xd')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 5179c9f..754e4f0 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 _0x2b28=['path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xdbf07e,_0x3cf953){var _0x3e372b=function(_0x47865d){while(--_0x47865d){_0xdbf07e['push'](_0xdbf07e['shift']());}};_0x3e372b(++_0x3cf953);}(_0x2b28,0x70));var _0x82b2=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x2b28[_0x3e2fcf];return _0x497db7;};'use strict';var _=require(_0x82b2('0x0'));var util=require(_0x82b2('0x1'));var logger=require(_0x82b2('0x2'))(_0x82b2('0x3'));var moment=require(_0x82b2('0x4'));var BPromise=require(_0x82b2('0x5'));var rp=require(_0x82b2('0x6'));var fs=require('fs');var path=require(_0x82b2('0x7'));var rimraf=require(_0x82b2('0x8'));var config=require(_0x82b2('0x9'));var attributes=require(_0x82b2('0xa'));module[_0x82b2('0xb')]=function(_0x54676b,_0x22b5d5){return _0x54676b['define'](_0x82b2('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ae2cf,_0x33e3c5,_0x2009f1){if(_0x3ae2cf[_0x82b2('0xd')](_0x82b2('0xe'))){_0x3ae2cf[_0x82b2('0xf')]=moment()[_0x82b2('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2009f1(null,_0x3ae2cf);}}});}; \ No newline at end of file +var _0x9892=['lodash','../../config/logger','moment','bluebird','path','rimraf','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x9892,0xdd));var _0x2989=function(_0x31c21b,_0x4b92c5){_0x31c21b=_0x31c21b-0x0;var _0x3fc53c=_0x9892[_0x31c21b];return _0x3fc53c;};'use strict';var _=require(_0x2989('0x0'));var util=require('util');var logger=require(_0x2989('0x1'))('api');var moment=require(_0x2989('0x2'));var BPromise=require(_0x2989('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2989('0x4'));var rimraf=require(_0x2989('0x5'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x1b424f,_0x456cd9){return _0x1b424f['define'](_0x2989('0x6'),attributes,{'tableName':_0x2989('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c266f,_0x1c1c60,_0x552644){if(_0x4c266f[_0x2989('0x8')](_0x2989('0x9'))){_0x4c266f[_0x2989('0xa')]=moment()[_0x2989('0xb')](_0x2989('0xc'));}_0x552644(null,_0x4c266f);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 41e4db2..1d39089 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 _0xd966=['options','raw','where','limit','then','catch','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateSmsInteraction','SmsInteraction','update','body'];(function(_0x2fa98b,_0xeeaf3e){var _0x33ab65=function(_0x13a6b8){while(--_0x13a6b8){_0x2fa98b['push'](_0x2fa98b['shift']());}};_0x33ab65(++_0xeeaf3e);}(_0xd966,0x16c));var _0x6d96=function(_0x31c6ca,_0x5b37b3){_0x31c6ca=_0x31c6ca-0x0;var _0x1b5088=_0xd966[_0x31c6ca];return _0x1b5088;};'use strict';var _=require(_0x6d96('0x0'));var util=require(_0x6d96('0x1'));var moment=require(_0x6d96('0x2'));var BPromise=require(_0x6d96('0x3'));var rs=require(_0x6d96('0x4'));var fs=require('fs');var Redis=require(_0x6d96('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d96('0x6'));var logger=require(_0x6d96('0x7'))(_0x6d96('0x8'));var config=require(_0x6d96('0x9'));var jayson=require(_0x6d96('0xa'));var client=jayson[_0x6d96('0xb')][_0x6d96('0xc')]({'port':0x232a});config[_0x6d96('0xd')]=_['defaults'](config[_0x6d96('0xd')],{'host':_0x6d96('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d96('0xd')]));require(_0x6d96('0xf'))[_0x6d96('0x10')](socket);function respondWithRpcPromise(_0x24d9c2,_0x236a2a,_0x14c784){return new BPromise(function(_0x24c358,_0x47b82d){return client[_0x6d96('0x11')](_0x24d9c2,_0x14c784)['then'](function(_0xe231c1){logger['info'](_0x6d96('0x12'),_0x236a2a,_0x6d96('0x13'));logger[_0x6d96('0x14')](_0x6d96('0x15'),_0x236a2a,'request\x20sent',JSON[_0x6d96('0x16')](_0xe231c1));if(_0xe231c1['error']){if(_0xe231c1[_0x6d96('0x17')][_0x6d96('0x18')]===0x1f4){logger[_0x6d96('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x236a2a,_0xe231c1[_0x6d96('0x17')][_0x6d96('0x19')]);return _0x47b82d(_0xe231c1['error']['message']);}logger[_0x6d96('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x236a2a,_0xe231c1[_0x6d96('0x17')]['message']);return _0x24c358(_0xe231c1[_0x6d96('0x17')][_0x6d96('0x19')]);}else{logger[_0x6d96('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x236a2a,_0x6d96('0x13'));_0x24c358(_0xe231c1[_0x6d96('0x1b')][_0x6d96('0x19')]);}})['catch'](function(_0x1b6ff4){logger['error'](_0x6d96('0x12'),_0x236a2a,_0x1b6ff4);_0x47b82d(_0x1b6ff4);});});}exports[_0x6d96('0x1c')]=function(_0x285102){var _0x9906e9=this;return new Promise(function(_0x5ad9b4,_0x5a9011){return db[_0x6d96('0x1d')][_0x6d96('0x1e')](_0x285102[_0x6d96('0x1f')],{'raw':_0x285102['options']?_0x285102[_0x6d96('0x20')][_0x6d96('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285102[_0x6d96('0x20')]?_0x285102[_0x6d96('0x20')][_0x6d96('0x22')]||null:null,'attributes':_0x285102[_0x6d96('0x20')]?_0x285102[_0x6d96('0x20')]['attributes']||null:null,'limit':_0x285102['options']?_0x285102[_0x6d96('0x20')][_0x6d96('0x23')]||null:null})[_0x6d96('0x24')](function(_0x299bde){logger[_0x6d96('0x1a')]('UpdateSmsInteraction',_0x285102);logger[_0x6d96('0x14')](_0x6d96('0x1c'),_0x285102,JSON['stringify'](_0x299bde));_0x5ad9b4(_0x299bde);})[_0x6d96('0x25')](function(_0x1b1a7d){logger[_0x6d96('0x17')](_0x6d96('0x1c'),_0x1b1a7d[_0x6d96('0x19')],_0x285102);_0x5a9011(_0x9906e9[_0x6d96('0x17')](0x1f4,_0x1b1a7d[_0x6d96('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x79d0c1){return new Promise(function(_0xe756d4,_0x578081){return db[_0x6d96('0x1d')][_0x6d96('0x26')]({'where':_0x79d0c1[_0x6d96('0x20')]?_0x79d0c1[_0x6d96('0x20')][_0x6d96('0x22')]||null:null})[_0x6d96('0x24')](function(_0x1f732c){if(_0x1f732c){return _0x1f732c[_0x6d96('0x27')](_0x79d0c1[_0x6d96('0x1f')]['ids'],_[_0x6d96('0x28')](_0x79d0c1['body'],[_0x6d96('0x29'),'id'])||{});}})[_0x6d96('0x2a')](function(_0x2f8d49){logger[_0x6d96('0x1a')](_0x6d96('0x2b'),_0x79d0c1);logger[_0x6d96('0x14')](_0x6d96('0x2b'),_0x79d0c1,JSON[_0x6d96('0x16')](_0x2f8d49));_0xe756d4(_0x2f8d49);})[_0x6d96('0x25')](function(_0x42a279){logger['error'](_0x6d96('0x2b'),_0x42a279[_0x6d96('0x19')],_0x79d0c1);_0x578081(_this[_0x6d96('0x17')](0x1f4,_0x42a279[_0x6d96('0x19')]));});});}; \ No newline at end of file +var _0x3de0=['options','raw','where','attributes','limit','debug','catch','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateSmsInteraction','SmsInteraction','update'];(function(_0x1ae378,_0x3e6911){var _0x5eaa5f=function(_0x5ec5d8){while(--_0x5ec5d8){_0x1ae378['push'](_0x1ae378['shift']());}};_0x5eaa5f(++_0x3e6911);}(_0x3de0,0x117));var _0x03de=function(_0x562e51,_0x526f36){_0x562e51=_0x562e51-0x0;var _0x3c2c33=_0x3de0[_0x562e51];return _0x3c2c33;};'use strict';var _=require(_0x03de('0x0'));var util=require(_0x03de('0x1'));var moment=require(_0x03de('0x2'));var BPromise=require(_0x03de('0x3'));var rs=require(_0x03de('0x4'));var fs=require('fs');var Redis=require(_0x03de('0x5'));var db=require(_0x03de('0x6'))['db'];var utils=require(_0x03de('0x7'));var logger=require(_0x03de('0x8'))(_0x03de('0x9'));var config=require('../../config/environment');var jayson=require(_0x03de('0xa'));var client=jayson['client'][_0x03de('0xb')]({'port':0x232a});config[_0x03de('0xc')]=_['defaults'](config[_0x03de('0xc')],{'host':_0x03de('0xd'),'port':0x18eb});var socket=require(_0x03de('0xe'))(new Redis(config[_0x03de('0xc')]));require(_0x03de('0xf'))['register'](socket);function respondWithRpcPromise(_0x1b8155,_0x3545cb,_0x38483a){return new BPromise(function(_0x4fd3e0,_0x54642c){return client[_0x03de('0x10')](_0x1b8155,_0x38483a)[_0x03de('0x11')](function(_0x28f31a){logger['info'](_0x03de('0x12'),_0x3545cb,_0x03de('0x13'));logger['debug'](_0x03de('0x14'),_0x3545cb,_0x03de('0x13'),JSON['stringify'](_0x28f31a));if(_0x28f31a[_0x03de('0x15')]){if(_0x28f31a[_0x03de('0x15')][_0x03de('0x16')]===0x1f4){logger[_0x03de('0x15')](_0x03de('0x12'),_0x3545cb,_0x28f31a['error'][_0x03de('0x17')]);return _0x54642c(_0x28f31a[_0x03de('0x15')][_0x03de('0x17')]);}logger[_0x03de('0x15')](_0x03de('0x12'),_0x3545cb,_0x28f31a[_0x03de('0x15')][_0x03de('0x17')]);return _0x4fd3e0(_0x28f31a[_0x03de('0x15')][_0x03de('0x17')]);}else{logger[_0x03de('0x18')](_0x03de('0x12'),_0x3545cb,'request\x20sent');_0x4fd3e0(_0x28f31a[_0x03de('0x19')][_0x03de('0x17')]);}})['catch'](function(_0xb0621){logger[_0x03de('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x3545cb,_0xb0621);_0x54642c(_0xb0621);});});}exports[_0x03de('0x1a')]=function(_0x557065){var _0x30103c=this;return new Promise(function(_0x211c4e,_0x4d2241){return db[_0x03de('0x1b')][_0x03de('0x1c')](_0x557065['body'],{'raw':_0x557065[_0x03de('0x1d')]?_0x557065[_0x03de('0x1d')][_0x03de('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x557065[_0x03de('0x1d')]?_0x557065[_0x03de('0x1d')][_0x03de('0x1f')]||null:null,'attributes':_0x557065[_0x03de('0x1d')]?_0x557065[_0x03de('0x1d')][_0x03de('0x20')]||null:null,'limit':_0x557065['options']?_0x557065[_0x03de('0x1d')][_0x03de('0x21')]||null:null})[_0x03de('0x11')](function(_0x380101){logger[_0x03de('0x18')](_0x03de('0x1a'),_0x557065);logger[_0x03de('0x22')](_0x03de('0x1a'),_0x557065,JSON['stringify'](_0x380101));_0x211c4e(_0x380101);})[_0x03de('0x23')](function(_0x839c2e){logger[_0x03de('0x15')](_0x03de('0x1a'),_0x839c2e[_0x03de('0x17')],_0x557065);_0x4d2241(_0x30103c[_0x03de('0x15')](0x1f4,_0x839c2e[_0x03de('0x17')]));});});};exports[_0x03de('0x24')]=function(_0xf89716){return new Promise(function(_0x15a7ae,_0x2b55d1){return db[_0x03de('0x1b')][_0x03de('0x25')]({'where':_0xf89716[_0x03de('0x1d')]?_0xf89716['options'][_0x03de('0x1f')]||null:null})[_0x03de('0x11')](function(_0x586ee6){if(_0x586ee6){return _0x586ee6[_0x03de('0x26')](_0xf89716[_0x03de('0x27')][_0x03de('0x28')],_[_0x03de('0x29')](_0xf89716[_0x03de('0x27')],[_0x03de('0x28'),'id'])||{});}})[_0x03de('0x2a')](function(_0xd36b2a){logger[_0x03de('0x18')](_0x03de('0x2b'),_0xf89716);logger[_0x03de('0x22')](_0x03de('0x2b'),_0xf89716,JSON['stringify'](_0xd36b2a));_0x15a7ae(_0xd36b2a);})[_0x03de('0x23')](function(_0x24ac28){logger[_0x03de('0x15')](_0x03de('0x2b'),_0x24ac28[_0x03de('0x17')],_0xf89716);_0x2b55d1(_this[_0x03de('0x15')](0x1f4,_0x24ac28[_0x03de('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 52962d4..7ef6f71 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 _0x059e=['update','removeListener','register','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x187efb,_0xcaa75){var _0x4d72f9=function(_0x2d9697){while(--_0x2d9697){_0x187efb['push'](_0x187efb['shift']());}};_0x4d72f9(++_0xcaa75);}(_0x059e,0x10e));var _0xe059=function(_0x342985,_0x5295f7){_0x342985=_0x342985-0x0;var _0x3feb6c=_0x059e[_0x342985];return _0x3feb6c;};'use strict';var SmsInteractionEvents=require(_0xe059('0x0'));var events=[_0xe059('0x1'),_0xe059('0x2'),_0xe059('0x3')];function createListener(_0x17d197,_0x34d908){return function(_0x2fbea3){_0x34d908['emit'](_0x17d197,_0x2fbea3);};}function removeListener(_0x259c75,_0x1417a9){return function(){SmsInteractionEvents[_0xe059('0x4')](_0x259c75,_0x1417a9);};}exports[_0xe059('0x5')]=function(_0x35d0ba){for(var _0x1302ce=0x0,_0xb6ed95=events['length'];_0x1302ce<_0xb6ed95;_0x1302ce++){var _0x4a6084=events[_0x1302ce];var _0x3dcc97=createListener(_0xe059('0x6')+_0x4a6084,_0x35d0ba);SmsInteractionEvents['on'](_0x4a6084,_0x3dcc97);}}; \ No newline at end of file +var _0x364a=['removeListener','register','length','smsInteraction:','./smsInteraction.events','remove','update','emit'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x364a,0x134));var _0xa364=function(_0x5936af,_0x2adc5d){_0x5936af=_0x5936af-0x0;var _0x34b1f7=_0x364a[_0x5936af];return _0x34b1f7;};'use strict';var SmsInteractionEvents=require(_0xa364('0x0'));var events=['save',_0xa364('0x1'),_0xa364('0x2')];function createListener(_0x4010e7,_0x29af21){return function(_0x277c05){_0x29af21[_0xa364('0x3')](_0x4010e7,_0x277c05);};}function removeListener(_0x532d79,_0x5f5d0d){return function(){SmsInteractionEvents[_0xa364('0x4')](_0x532d79,_0x5f5d0d);};}exports[_0xa364('0x5')]=function(_0x57d82a){for(var _0x5d8717=0x0,_0x21c46b=events[_0xa364('0x6')];_0x5d8717<_0x21c46b;_0x5d8717++){var _0x3edff2=events[_0x5d8717];var _0x2f17d3=createListener(_0xa364('0x7')+_0x3edff2,_0x57d82a);SmsInteractionEvents['on'](_0x3edff2,_0x2f17d3);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 68c1610..b17b0f0 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 _0x8bd6=['/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','show','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept'];(function(_0x14ae4c,_0x36a57c){var _0x938094=function(_0x1f5ebf){while(--_0x1f5ebf){_0x14ae4c['push'](_0x14ae4c['shift']());}};_0x938094(++_0x36a57c);}(_0x8bd6,0x144));var _0x68bd=function(_0x540665,_0x2b291d){_0x540665=_0x540665-0x0;var _0x470f2d=_0x8bd6[_0x540665];return _0x470f2d;};'use strict';var multer=require(_0x68bd('0x0'));var util=require(_0x68bd('0x1'));var path=require(_0x68bd('0x2'));var timeout=require(_0x68bd('0x3'));var express=require(_0x68bd('0x4'));var router=express[_0x68bd('0x5')]();var fs_extra=require(_0x68bd('0x6'));var auth=require(_0x68bd('0x7'));var interaction=require(_0x68bd('0x8'));var config=require(_0x68bd('0x9'));var controller=require(_0x68bd('0xa'));router[_0x68bd('0xb')]('/',auth[_0x68bd('0xc')](),controller[_0x68bd('0xd')]);router[_0x68bd('0xb')](_0x68bd('0xe'),auth[_0x68bd('0xc')](),controller[_0x68bd('0xf')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x68bd('0x10')]);router['post']('/',auth[_0x68bd('0xc')](),interaction[_0x68bd('0x11')](_0x68bd('0x12'),_0x68bd('0x13')),controller[_0x68bd('0x14')]);router['post'](_0x68bd('0x15'),controller[_0x68bd('0x16')]);router[_0x68bd('0x17')](_0x68bd('0x18'),auth[_0x68bd('0xc')](),controller[_0x68bd('0x19')]);router['put'](_0x68bd('0x1a'),auth[_0x68bd('0xc')](),controller[_0x68bd('0x1b')]);router['put'](_0x68bd('0x1c'),auth[_0x68bd('0xc')](),controller['reject']);router[_0x68bd('0x1d')](_0x68bd('0x18'),auth[_0x68bd('0xc')](),controller[_0x68bd('0x1e')]);module[_0x68bd('0x1f')]=router; \ No newline at end of file +var _0x4b17=['status','put','/:id/accept','/:id/reject','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','sms','create','/:id/status'];(function(_0x270b96,_0x564904){var _0x141615=function(_0x303f1b){while(--_0x303f1b){_0x270b96['push'](_0x270b96['shift']());}};_0x141615(++_0x564904);}(_0x4b17,0x10f));var _0x74b1=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x4b17[_0x3ec1da];return _0x472358;};'use strict';var multer=require(_0x74b1('0x0'));var util=require('util');var path=require(_0x74b1('0x1'));var timeout=require('connect-timeout');var express=require(_0x74b1('0x2'));var router=express[_0x74b1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x74b1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x74b1('0x5'));router[_0x74b1('0x6')]('/',auth[_0x74b1('0x7')](),controller[_0x74b1('0x8')]);router[_0x74b1('0x6')](_0x74b1('0x9'),auth[_0x74b1('0x7')](),controller['describe']);router[_0x74b1('0x6')](_0x74b1('0xa'),auth[_0x74b1('0x7')](),controller[_0x74b1('0xb')]);router[_0x74b1('0xc')]('/',auth['isAuthenticated'](),interaction[_0x74b1('0xd')](_0x74b1('0xe'),'smsmessage:create'),controller[_0x74b1('0xf')]);router[_0x74b1('0xc')](_0x74b1('0x10'),controller[_0x74b1('0x11')]);router['put'](_0x74b1('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x74b1('0x12')](_0x74b1('0x13'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x74b1('0x14'),auth['isAuthenticated'](),controller['reject']);router[_0x74b1('0x15')](_0x74b1('0xa'),auth[_0x74b1('0x7')](),controller[_0x74b1('0x16')]);module[_0x74b1('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 3e2cfb7..e01b936 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 _0x0a4b=['BOOLEAN','sequelize','TEXT','medium','STRING','DATE'];(function(_0x5b079c,_0x32397e){var _0x14dd1f=function(_0x56d126){while(--_0x56d126){_0x5b079c['push'](_0x5b079c['shift']());}};_0x14dd1f(++_0x32397e);}(_0x0a4b,0x6d));var _0xb0a4=function(_0xd7c37e,_0x2833ed){_0xd7c37e=_0xd7c37e-0x0;var _0x1909c6=_0x0a4b[_0xd7c37e];return _0x1909c6;};'use strict';var Sequelize=require(_0xb0a4('0x0'));module['exports']={'body':{'type':Sequelize[_0xb0a4('0x1')](_0xb0a4('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xb0a4('0x3')](0xbe)},'phone':{'type':Sequelize[_0xb0a4('0x3')]},'readAt':{'type':Sequelize[_0xb0a4('0x4')]},'secret':{'type':Sequelize[_0xb0a4('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb0a4('0x1')]}}; \ No newline at end of file +var _0x711a=['DATE','sequelize','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x43513e,_0x52bbe0){var _0x251554=function(_0x2139bd){while(--_0x2139bd){_0x43513e['push'](_0x43513e['shift']());}};_0x251554(++_0x52bbe0);}(_0x711a,0x14a));var _0xa711=function(_0x41c961,_0x1999bd){_0x41c961=_0x41c961-0x0;var _0x37ac00=_0x711a[_0x41c961];return _0x37ac00;};'use strict';var Sequelize=require(_0xa711('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xa711('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xa711('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa711('0x3')]('in',_0xa711('0x4')),'defaultValue':_0xa711('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa711('0x5')](0xbe)},'phone':{'type':Sequelize[_0xa711('0x5')]},'readAt':{'type':Sequelize[_0xa711('0x6')]},'secret':{'type':Sequelize[_0xa711('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa711('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 7ef0142..10a97a9 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 _0x10d6=['SELECT','contact','User','fullname','email','interface','motionChannel','event','accept','EventManager','acceptmessage','../../config/logger','sms','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','internal','channel','rejectmessage','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','groupName','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/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsMessage.socket','register','client','http','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','send','index','SmsMessage','rawAttributes','type','key','model','map','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','fields','options','create','body','find','describe','sms-interactions','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes'];(function(_0x4262e3,_0x2379a5){var _0x58e406=function(_0x591e0a){while(--_0x591e0a){_0x4262e3['push'](_0x4262e3['shift']());}};_0x58e406(++_0x2379a5);}(_0x10d6,0x145));var _0x610d=function(_0x49e731,_0x44411d){_0x49e731=_0x49e731-0x0;var _0x4aff5d=_0x10d6[_0x49e731];return _0x4aff5d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x610d('0x0'));var zipdir=require(_0x610d('0x1'));var jsonpatch=require(_0x610d('0x2'));var rp=require('request-promise');var moment=require(_0x610d('0x3'));var BPromise=require(_0x610d('0x4'));var Mustache=require(_0x610d('0x5'));var util=require(_0x610d('0x6'));var path=require(_0x610d('0x7'));var sox=require(_0x610d('0x8'));var csv=require(_0x610d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x610d('0xa'));var _=require(_0x610d('0xb'));var squel=require(_0x610d('0xc'));var crypto=require(_0x610d('0xd'));var jsforce=require(_0x610d('0xe'));var deskjs=require(_0x610d('0xf'));var toCsv=require(_0x610d('0x9'));var querystring=require(_0x610d('0x10'));var Papa=require(_0x610d('0x11'));var Redis=require(_0x610d('0x12'));var authService=require(_0x610d('0x13'));var qs=require(_0x610d('0x14'));var as=require(_0x610d('0x15'));var hardwareService=require(_0x610d('0x16'));var logger=require('../../config/logger')(_0x610d('0x17'));var utils=require(_0x610d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x610d('0x19'));var db=require(_0x610d('0x1a'))['db'];config['redis']=_[_0x610d('0x1b')](config[_0x610d('0x1c')],{'host':_0x610d('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x610d('0x1c')]));require(_0x610d('0x1e'))[_0x610d('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x610d('0x20')][_0x610d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1cafc9,_0x505dce,_0x1fd945,_0x48ae4e){return new BPromise(function(_0x13b023,_0x2d895a){var _0x1ad466=_0x48ae4e||client;return _0x1ad466['request'](_0x1cafc9,_0x1fd945)[_0x610d('0x22')](function(_0x4b6dc9){logger[_0x610d('0x23')]('SmsMessage,\x20%s,\x20%s',_0x505dce,_0x610d('0x24'));logger[_0x610d('0x25')](_0x610d('0x26'),_0x505dce,_0x610d('0x24'),JSON[_0x610d('0x27')](_0x4b6dc9));if(_0x4b6dc9[_0x610d('0x28')]){if(_0x4b6dc9[_0x610d('0x28')]['code']===0x1f4){logger[_0x610d('0x28')](_0x610d('0x29'),_0x505dce,_0x4b6dc9['error'][_0x610d('0x2a')]);return _0x2d895a(_0x4b6dc9[_0x610d('0x28')][_0x610d('0x2a')]);}logger['error'](_0x610d('0x29'),_0x505dce,_0x4b6dc9[_0x610d('0x28')]['message']);return _0x13b023(_0x4b6dc9['error'][_0x610d('0x2a')]);}else{logger[_0x610d('0x23')](_0x610d('0x29'),_0x505dce,_0x610d('0x24'));_0x13b023(_0x4b6dc9[_0x610d('0x2b')][_0x610d('0x2a')]);}})[_0x610d('0x2c')](function(_0x7e7c5a){logger[_0x610d('0x28')](_0x610d('0x29'),_0x505dce,_0x7e7c5a);_0x2d895a(_0x7e7c5a);});});}function respondWithStatusCode(_0x1d39ee,_0x2838d3){_0x2838d3=_0x2838d3||0xcc;return function(_0x5491c7){if(_0x5491c7){return _0x1d39ee[_0x610d('0x2d')](_0x2838d3);}return _0x1d39ee[_0x610d('0x2e')](_0x2838d3)[_0x610d('0x2f')]();};}function respondWithResult(_0x3cecbb,_0x249c91){_0x249c91=_0x249c91||0xc8;return function(_0x100797){if(_0x100797){return _0x3cecbb[_0x610d('0x2e')](_0x249c91)[_0x610d('0x30')](_0x100797);}};}function respondWithFilteredResult(_0x415c35,_0x16cf58){return function(_0x2a2ab2){if(_0x2a2ab2){var _0x59d345=typeof _0x16cf58[_0x610d('0x31')]===_0x610d('0x32')&&typeof _0x16cf58[_0x610d('0x33')]==='undefined';var _0x26a761=_0x2a2ab2[_0x610d('0x34')];var _0x226f0b=_0x59d345?0x0:_0x16cf58[_0x610d('0x31')];var _0x159c9c=_0x59d345?_0x2a2ab2[_0x610d('0x34')]:_0x16cf58[_0x610d('0x31')]+_0x16cf58['limit'];var _0x1a2c64;if(_0x159c9c>=_0x26a761){_0x159c9c=_0x26a761;_0x1a2c64=0xc8;}else{_0x1a2c64=0xce;}_0x415c35['status'](_0x1a2c64);return _0x415c35['set'](_0x610d('0x35'),_0x226f0b+'-'+_0x159c9c+'/'+_0x26a761)[_0x610d('0x30')](_0x2a2ab2);}return null;};}function patchUpdates(_0x44110c){return function(_0x4ad890){try{jsonpatch['apply'](_0x4ad890,_0x44110c,!![]);}catch(_0x27e512){return BPromise[_0x610d('0x36')](_0x27e512);}return _0x4ad890[_0x610d('0x37')]();};}function saveUpdates(_0x487776,_0x14cc4b){return function(_0x548b92){if(_0x548b92){return _0x548b92[_0x610d('0x38')](_0x487776)[_0x610d('0x22')](function(_0x43ed73){return _0x43ed73;});}return null;};}function removeEntity(_0x4ecc6a,_0x3a4ad5){return function(_0x506451){if(_0x506451){return _0x506451['destroy']()[_0x610d('0x22')](function(){_0x4ecc6a[_0x610d('0x2e')](0xcc)[_0x610d('0x2f')]();});}};}function handleEntityNotFound(_0x255dd3,_0x21d1bd){return function(_0x1eb331){if(!_0x1eb331){_0x255dd3[_0x610d('0x2d')](0x194);}return _0x1eb331;};}function handleError(_0x4a3c55,_0x5532aa){_0x5532aa=_0x5532aa||0x1f4;return function(_0x39a488){logger[_0x610d('0x28')](_0x39a488['stack']);if(_0x39a488['name']){delete _0x39a488['name'];}_0x4a3c55['status'](_0x5532aa)[_0x610d('0x39')](_0x39a488);};}exports[_0x610d('0x3a')]=function(_0x4349c2,_0x2024fd){var _0x122ca9={},_0x5d01e6={},_0x5ed8e6={'count':0x0,'rows':[]};var _0x1f31db=_['map'](db[_0x610d('0x3b')][_0x610d('0x3c')],function(_0x51bbc6){return{'name':_0x51bbc6['fieldName'],'type':_0x51bbc6[_0x610d('0x3d')][_0x610d('0x3e')]};});_0x5d01e6[_0x610d('0x3f')]=_[_0x610d('0x40')](_0x1f31db,_0x610d('0x41'));_0x5d01e6[_0x610d('0x42')]=_[_0x610d('0x43')](_0x4349c2[_0x610d('0x42')]);_0x5d01e6[_0x610d('0x44')]=_[_0x610d('0x45')](_0x5d01e6[_0x610d('0x3f')],_0x5d01e6[_0x610d('0x42')]);_0x122ca9[_0x610d('0x46')]=_[_0x610d('0x45')](_0x5d01e6[_0x610d('0x3f')],qs['fields'](_0x4349c2['query']['fields']));_0x122ca9['attributes']=_0x122ca9['attributes'][_0x610d('0x47')]?_0x122ca9[_0x610d('0x46')]:_0x5d01e6[_0x610d('0x3f')];if(!_0x4349c2['query'][_0x610d('0x48')](_0x610d('0x49'))){_0x122ca9[_0x610d('0x33')]=qs[_0x610d('0x33')](_0x4349c2[_0x610d('0x42')]['limit']);_0x122ca9[_0x610d('0x31')]=qs['offset'](_0x4349c2[_0x610d('0x42')]['offset']);}_0x122ca9[_0x610d('0x4a')]=qs[_0x610d('0x4b')](_0x4349c2[_0x610d('0x42')]['sort']);_0x122ca9[_0x610d('0x4c')]=qs['filters'](_[_0x610d('0x4d')](_0x4349c2[_0x610d('0x42')],_0x5d01e6[_0x610d('0x44')]),_0x1f31db);if(_0x4349c2[_0x610d('0x42')]['filter']){_0x122ca9['where']=_[_0x610d('0x4e')](_0x122ca9[_0x610d('0x4c')],{'$or':_['map'](_0x1f31db,function(_0xf692b){if(_0xf692b['type']!==_0x610d('0x4f')){var _0xbfd903={};_0xbfd903[_0xf692b[_0x610d('0x41')]]={'$like':'%'+_0x4349c2[_0x610d('0x42')][_0x610d('0x50')]+'%'};return _0xbfd903;}})});}_0x122ca9=_[_0x610d('0x4e')]({},_0x122ca9,_0x4349c2['options']);var _0x1b15bd={'where':_0x122ca9['where']};return db[_0x610d('0x3b')]['count'](_0x1b15bd)[_0x610d('0x22')](function(_0x3e6da3){_0x5ed8e6[_0x610d('0x34')]=_0x3e6da3;if(_0x4349c2[_0x610d('0x42')][_0x610d('0x51')]){_0x122ca9[_0x610d('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x610d('0x53')](_0x122ca9);})[_0x610d('0x22')](function(_0xf0302c){_0x5ed8e6[_0x610d('0x54')]=_0xf0302c;return _0x5ed8e6;})[_0x610d('0x22')](respondWithFilteredResult(_0x2024fd,_0x122ca9))[_0x610d('0x2c')](handleError(_0x2024fd,null));};exports['show']=function(_0x3107d7,_0x81dffc){var _0x5453e6={'raw':!![],'where':{'id':_0x3107d7[_0x610d('0x55')]['id']}},_0x2db31a={};_0x2db31a['model']=_[_0x610d('0x43')](db['SmsMessage'][_0x610d('0x3c')]);_0x2db31a[_0x610d('0x42')]=_[_0x610d('0x43')](_0x3107d7[_0x610d('0x42')]);_0x2db31a[_0x610d('0x44')]=_[_0x610d('0x45')](_0x2db31a[_0x610d('0x3f')],_0x2db31a[_0x610d('0x42')]);_0x5453e6['attributes']=_[_0x610d('0x45')](_0x2db31a[_0x610d('0x3f')],qs[_0x610d('0x56')](_0x3107d7[_0x610d('0x42')][_0x610d('0x56')]));_0x5453e6[_0x610d('0x46')]=_0x5453e6['attributes'][_0x610d('0x47')]?_0x5453e6[_0x610d('0x46')]:_0x2db31a[_0x610d('0x3f')];if(_0x3107d7[_0x610d('0x42')][_0x610d('0x51')]){_0x5453e6[_0x610d('0x52')]=[{'all':!![]}];}_0x5453e6=_['merge']({},_0x5453e6,_0x3107d7[_0x610d('0x57')]);return db[_0x610d('0x3b')]['find'](_0x5453e6)['then'](handleEntityNotFound(_0x81dffc,null))[_0x610d('0x22')](respondWithResult(_0x81dffc,null))[_0x610d('0x2c')](handleError(_0x81dffc,null));};exports['create']=function(_0x9d478c,_0x31b69a){return db[_0x610d('0x3b')][_0x610d('0x58')](_0x9d478c[_0x610d('0x59')],{})['then'](respondWithResult(_0x31b69a,0xc9))['catch'](handleError(_0x31b69a,null));};exports[_0x610d('0x38')]=function(_0x446bd4,_0x1df7be){if(_0x446bd4[_0x610d('0x59')]['id']){delete _0x446bd4[_0x610d('0x59')]['id'];}return db[_0x610d('0x3b')]['find']({'where':{'id':_0x446bd4[_0x610d('0x55')]['id']}})[_0x610d('0x22')](handleEntityNotFound(_0x1df7be,null))[_0x610d('0x22')](saveUpdates(_0x446bd4['body'],null))[_0x610d('0x22')](respondWithResult(_0x1df7be,null))['catch'](handleError(_0x1df7be,null));};exports['destroy']=function(_0x53ba3a,_0x521caf){return db[_0x610d('0x3b')][_0x610d('0x5a')]({'where':{'id':_0x53ba3a[_0x610d('0x55')]['id']}})['then'](handleEntityNotFound(_0x521caf,null))[_0x610d('0x22')](removeEntity(_0x521caf,null))['catch'](handleError(_0x521caf,null));};exports[_0x610d('0x5b')]=function(_0x1477aa,_0x53639c){return db[_0x610d('0x3b')][_0x610d('0x5b')]()[_0x610d('0x22')](respondWithResult(_0x53639c,null))[_0x610d('0x2c')](handleError(_0x53639c,null));};var interaction_log=require('../../config/logger')(_0x610d('0x5c'));exports['accept']=function(_0x32f7e5,_0x5b4790,_0x21573d){var _0x288591={'agent':{},'channel':'sms'};if(_0x32f7e5[_0x610d('0x59')]['id']){delete _0x32f7e5[_0x610d('0x59')]['id'];}_0x32f7e5[_0x610d('0x59')][_0x610d('0x5d')]=!![];_0x32f7e5['body']['readAt']=moment()[_0x610d('0x5e')](_0x610d('0x5f'));_0x32f7e5[_0x610d('0x59')][_0x610d('0x60')]=_0x32f7e5[_0x610d('0x59')][_0x610d('0x60')]||_0x32f7e5[_0x610d('0x61')]['id'];_0x288591[_0x610d('0x62')]['id']=_0x32f7e5[_0x610d('0x59')][_0x610d('0x60')];return db[_0x610d('0x3b')][_0x610d('0x5a')]({'where':{'id':_0x32f7e5[_0x610d('0x55')]['id'],'UserId':null}})[_0x610d('0x22')](handleEntityNotFound(_0x5b4790,null))[_0x610d('0x22')](saveUpdates(_0x32f7e5[_0x610d('0x59')],null))['then'](function(_0x20bd68){if(_0x20bd68){_0x288591[_0x610d('0x2a')]=_0x20bd68['get']({'plain':!![]});return db['SmsInteraction'][_0x610d('0x5a')]({'where':{'id':_0x20bd68['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5b4790,null))['then'](function(_0x42653e){if(_0x42653e){return _0x42653e[_0x610d('0x38')]({'UserId':_0x32f7e5[_0x610d('0x59')]['UserId'],'read1stAt':_[_0x610d('0x63')](_0x42653e['read1stAt'])?moment()['format'](_0x610d('0x5f')):undefined});}return null;})[_0x610d('0x22')](function(_0x16a9d0){if(_0x16a9d0){_0x288591[_0x610d('0x64')]=_0x16a9d0[_0x610d('0x65')]({'plain':!![]});interaction_log[_0x610d('0x23')](_0x610d('0x66'),_0x32f7e5[_0x610d('0x61')]['id'],_0x32f7e5[_0x610d('0x61')][_0x610d('0x41')],_0x32f7e5[_0x610d('0x61')]['role'],_0x288591[_0x610d('0x64')]['id'],_0x32f7e5[_0x610d('0x59')]?JSON[_0x610d('0x27')](_0x32f7e5[_0x610d('0x59')]):_0x610d('0x67'));return respondWithRpcPromise(_0x610d('0x68'),_0x610d('0x69'),_0x288591);}return null;})['then'](function(_0x5884b6){var _0x2f2532=_0x610d('0x6a')+_0x5884b6[_0x610d('0x2a')][_0x610d('0x6b')];return db['sequelize'][_0x610d('0x42')](_0x2f2532,{'type':db[_0x610d('0x6c')][_0x610d('0x6d')][_0x610d('0x6e')],'raw':!![]})[_0x610d('0x22')](function(_0x322616){return _0x322616;});})[_0x610d('0x22')](function(_0x51e000){if(_0x51e000){_0x288591['message'][_0x610d('0x6f')]=_0x51e000[0x0];if(!_0x32f7e5['body'][_0x610d('0x60')])return;return db[_0x610d('0x70')][_0x610d('0x5a')]({'where':{'id':_0x32f7e5[_0x610d('0x59')]['UserId'],'role':'agent'},'attributes':['id','name',_0x610d('0x71'),_0x610d('0x72'),'internal'],'raw':!![]});}return null;})[_0x610d('0x22')](function(_0x472f28){if(!_0x472f28)return null;_0x288591[_0x610d('0x2a')]['agent']=_0x472f28;return _0x288591;})[_0x610d('0x22')](function(_0xafaeeb){if(_0xafaeeb){if(_0x32f7e5[_0x610d('0x59')]['manual']){_0x288591[_0x610d('0x2a')][_0x610d('0x73')]=util[_0x610d('0x5e')]('SIP/%s',_0x32f7e5[_0x610d('0x61')]['name']);_0x288591[_0x610d('0x2a')]['channel']=_0x288591['channel'];_0x288591[_0x610d('0x2a')][_0x610d('0x74')]=_0x288591['channel'];_0x288591[_0x610d('0x2a')][_0x610d('0x75')]=_0x610d('0x76');return respondWithRpcPromise(_0x610d('0x77'),_0x610d('0x77'),{'event':_0x610d('0x78'),'message':_0x288591[_0x610d('0x2a')]},client9002)[_0x610d('0x22')](function(){return _0x288591;});}return _0x288591;}return null;})[_0x610d('0x22')](respondWithResult(_0x5b4790,null))[_0x610d('0x2c')](handleError(_0x5b4790,null));};var interaction_log=require(_0x610d('0x79'))(_0x610d('0x5c'));exports[_0x610d('0x36')]=function(_0x36e7c4,_0x3ac3b5,_0x25e3d8){var _0x57148d={'agent':{},'channel':_0x610d('0x7a')};if(_0x36e7c4[_0x610d('0x59')]['id']){delete _0x36e7c4[_0x610d('0x59')]['id'];}_0x36e7c4['body']['UserId']=_0x36e7c4['body'][_0x610d('0x60')]||_0x36e7c4[_0x610d('0x61')]['id'];_0x57148d[_0x610d('0x62')]['id']=_0x36e7c4[_0x610d('0x59')][_0x610d('0x60')];return db[_0x610d('0x3b')][_0x610d('0x5a')]({'where':{'id':_0x36e7c4['params']['id'],'UserId':null}})[_0x610d('0x22')](handleEntityNotFound(_0x3ac3b5,null))[_0x610d('0x22')](function(_0x229d54){if(_0x229d54){_0x57148d['message']=_0x229d54['get']({'plain':!![]});return db[_0x610d('0x7b')][_0x610d('0x5a')]({'where':{'id':_0x229d54[_0x610d('0x7c')]}});}return null;})[_0x610d('0x22')](handleEntityNotFound(_0x3ac3b5,null))[_0x610d('0x22')](function(_0x24a6b2){if(_0x24a6b2){_0x57148d[_0x610d('0x64')]=_0x24a6b2[_0x610d('0x65')]({'plain':!![]});interaction_log[_0x610d('0x23')](_0x610d('0x7d'),_0x36e7c4[_0x610d('0x61')]['id'],_0x36e7c4[_0x610d('0x61')][_0x610d('0x41')],_0x36e7c4[_0x610d('0x61')]['role'],_0x57148d[_0x610d('0x64')]['id'],_0x36e7c4[_0x610d('0x59')]?JSON['stringify'](_0x36e7c4[_0x610d('0x59')]):_0x610d('0x67'));return respondWithRpcPromise('RejectMessage',_0x610d('0x7e'),_0x57148d);}return null;})[_0x610d('0x22')](function(_0x1bb9d3){var _0x4fb844=_0x610d('0x6a')+_0x1bb9d3[_0x610d('0x2a')]['ContactId'];return db[_0x610d('0x7f')][_0x610d('0x42')](_0x4fb844,{'type':db[_0x610d('0x6c')][_0x610d('0x6d')][_0x610d('0x6e')],'raw':!![]})[_0x610d('0x22')](function(_0xd86d33){return _0xd86d33;});})[_0x610d('0x22')](function(_0x1b1eb9){if(_0x1b1eb9){_0x57148d[_0x610d('0x2a')][_0x610d('0x6f')]=_0x1b1eb9[0x0];if(!_0x36e7c4['body'][_0x610d('0x60')])return;return db['User'][_0x610d('0x5a')]({'where':{'id':_0x36e7c4[_0x610d('0x59')]['UserId'],'role':_0x610d('0x62')},'attributes':['id',_0x610d('0x41'),'fullname','email',_0x610d('0x80')],'raw':!![]});}return null;})[_0x610d('0x22')](function(_0x59ec18){if(!_0x59ec18)return null;_0x57148d[_0x610d('0x2a')]['agent']=_0x59ec18;return _0x57148d;})['then'](function(_0x10fac4){if(_0x10fac4){_0x10fac4[_0x610d('0x2a')][_0x610d('0x73')]=util[_0x610d('0x5e')]('SIP/%s',_0x36e7c4['user'][_0x610d('0x41')]);_0x10fac4['message']['channel']=_0x57148d[_0x610d('0x81')];_0x10fac4[_0x610d('0x2a')]['motionChannel']=_0x57148d[_0x610d('0x81')];_0x10fac4['message'][_0x610d('0x75')]='reject';respondWithRpcPromise(_0x610d('0x77'),_0x610d('0x77'),{'event':_0x610d('0x82'),'message':_0x10fac4[_0x610d('0x2a')]},client9002);return _0x57148d;}return null;})['then'](respondWithResult(_0x3ac3b5,null))[_0x610d('0x2c')](handleError(_0x3ac3b5,null));};exports[_0x610d('0x2e')]=function(_0x1f9511,_0x53bc7a,_0x426ca5){if(_0x1f9511[_0x610d('0x59')]['id']){delete _0x1f9511[_0x610d('0x59')]['id'];}var _0x38141e;return db[_0x610d('0x3b')][_0x610d('0x5a')]({'where':{'id':_0x1f9511[_0x610d('0x55')]['id']}})[_0x610d('0x22')](handleEntityNotFound(_0x53bc7a,null))[_0x610d('0x22')](function(_0x23ee8b){if(_0x23ee8b){_0x38141e=_0x23ee8b;return db['SmsAccount'][_0x610d('0x5a')]({'where':{'id':_0x23ee8b['SmsAccountId']}});}})[_0x610d('0x22')](handleEntityNotFound(_0x53bc7a,null))['then'](function(_0x4f8271){if(_0x4f8271){logger[_0x610d('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x610d('0x2e'),'received\x20delivery\x20report\x20from',_0x4f8271[_0x610d('0x3d')],util[_0x610d('0x83')](_0x1f9511['body'],{'showHidden':![],'depth':null}));switch(_0x4f8271[_0x610d('0x3d')]){case _0x610d('0x84'):if(_0x1f9511[_0x610d('0x59')][_0x610d('0x85')]&&_0x1f9511['body'][_0x610d('0x85')]===_0x38141e[_0x610d('0x86')]){return _0x38141e[_0x610d('0x38')]({'read':!![]});}else{logger['error'](_0x610d('0x87'),_0x610d('0x2e'),_0x610d('0x84'),util[_0x610d('0x83')](_0x1f9511[_0x610d('0x59')],{'showHidden':![],'depth':null}));}break;case _0x610d('0x88'):if(_0x1f9511[_0x610d('0x59')][_0x610d('0x89')]&&_0x1f9511[_0x610d('0x59')]['MessageUUID']===_0x38141e['messageId']&&_[_0x610d('0x8a')]([_0x610d('0x8b'),_0x610d('0x8c')],_0x1f9511[_0x610d('0x59')]['Status'])>=0x0){return _0x38141e[_0x610d('0x38')]({'read':!![]});}else{logger[_0x610d('0x28')](_0x610d('0x87'),_0x610d('0x2e'),_0x610d('0x8d'),util[_0x610d('0x83')](_0x1f9511[_0x610d('0x59')],{'showHidden':![],'depth':null}));}break;case _0x610d('0x8e'):var _0x4c1dcf=_0x1f9511[_0x610d('0x59')][_0x610d('0x8f')][0x0];if(_0x4c1dcf[_0x610d('0x2e')][_0x610d('0x90')]==='DELIVERED'){return _0x38141e['update']({'read':!![]});}else{logger[_0x610d('0x28')](_0x610d('0x87'),'status',_0x610d('0x8e'),util[_0x610d('0x83')](_0x1f9511['body'],{'showHidden':![],'depth':null}));}break;}return _0x38141e;}})[_0x610d('0x22')](respondWithResult(_0x53bc7a,null))[_0x610d('0x2c')](handleError(_0x53bc7a,null));}; \ No newline at end of file +var _0xce14=['stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','type','options','include','findAll','catch','show','keys','includeAll','find','create','update','body','params','describe','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','isNil','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','sms-interactions','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','QueryTypes','motionChannel','event','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','DELIVERED','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','then','info','SmsMessage,\x20%s,\x20%s','debug','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','destroy'];(function(_0x334981,_0x481e21){var _0x576ac1=function(_0x5f757){while(--_0x5f757){_0x334981['push'](_0x334981['shift']());}};_0x576ac1(++_0x481e21);}(_0xce14,0x17f));var _0x4ce1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xce14[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ce1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ce1('0x1'));var rp=require(_0x4ce1('0x2'));var moment=require('moment');var BPromise=require(_0x4ce1('0x3'));var Mustache=require(_0x4ce1('0x4'));var util=require(_0x4ce1('0x5'));var path=require(_0x4ce1('0x6'));var sox=require(_0x4ce1('0x7'));var csv=require('to-csv');var ejs=require(_0x4ce1('0x8'));var fs=require('fs');var fs_extra=require(_0x4ce1('0x9'));var _=require(_0x4ce1('0xa'));var squel=require(_0x4ce1('0xb'));var crypto=require('crypto');var jsforce=require(_0x4ce1('0xc'));var deskjs=require(_0x4ce1('0xd'));var toCsv=require(_0x4ce1('0xe'));var querystring=require('querystring');var Papa=require(_0x4ce1('0xf'));var Redis=require(_0x4ce1('0x10'));var authService=require(_0x4ce1('0x11'));var qs=require(_0x4ce1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ce1('0x13'));var logger=require(_0x4ce1('0x14'))(_0x4ce1('0x15'));var utils=require(_0x4ce1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4ce1('0x17'));var db=require(_0x4ce1('0x18'))['db'];config[_0x4ce1('0x19')]=_[_0x4ce1('0x1a')](config[_0x4ce1('0x19')],{'host':_0x4ce1('0x1b'),'port':0x18eb});var socket=require(_0x4ce1('0x1c'))(new Redis(config[_0x4ce1('0x19')]));require(_0x4ce1('0x1d'))[_0x4ce1('0x1e')](socket);var jayson=require(_0x4ce1('0x1f'));var client=jayson['client'][_0x4ce1('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x4ce1('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1bfd82,_0x1decc2,_0x35eebd,_0x5649a2){return new BPromise(function(_0x221306,_0x503b05){var _0x548452=_0x5649a2||client;return _0x548452['request'](_0x1bfd82,_0x35eebd)[_0x4ce1('0x21')](function(_0x34295c){logger[_0x4ce1('0x22')](_0x4ce1('0x23'),_0x1decc2,'request\x20sent');logger[_0x4ce1('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1decc2,'request\x20sent',JSON[_0x4ce1('0x25')](_0x34295c));if(_0x34295c[_0x4ce1('0x26')]){if(_0x34295c[_0x4ce1('0x26')][_0x4ce1('0x27')]===0x1f4){logger[_0x4ce1('0x26')](_0x4ce1('0x23'),_0x1decc2,_0x34295c[_0x4ce1('0x26')][_0x4ce1('0x28')]);return _0x503b05(_0x34295c['error'][_0x4ce1('0x28')]);}logger[_0x4ce1('0x26')]('SmsMessage,\x20%s,\x20%s',_0x1decc2,_0x34295c[_0x4ce1('0x26')][_0x4ce1('0x28')]);return _0x221306(_0x34295c['error'][_0x4ce1('0x28')]);}else{logger[_0x4ce1('0x22')]('SmsMessage,\x20%s,\x20%s',_0x1decc2,'request\x20sent');_0x221306(_0x34295c['result'][_0x4ce1('0x28')]);}})['catch'](function(_0x41f6ed){logger[_0x4ce1('0x26')]('SmsMessage,\x20%s,\x20%s',_0x1decc2,_0x41f6ed);_0x503b05(_0x41f6ed);});});}function respondWithStatusCode(_0x1a2242,_0x173c1c){_0x173c1c=_0x173c1c||0xcc;return function(_0x312486){if(_0x312486){return _0x1a2242[_0x4ce1('0x29')](_0x173c1c);}return _0x1a2242[_0x4ce1('0x2a')](_0x173c1c)[_0x4ce1('0x2b')]();};}function respondWithResult(_0x7eba6d,_0x1d5c0b){_0x1d5c0b=_0x1d5c0b||0xc8;return function(_0xe6e9c1){if(_0xe6e9c1){return _0x7eba6d[_0x4ce1('0x2a')](_0x1d5c0b)[_0x4ce1('0x2c')](_0xe6e9c1);}};}function respondWithFilteredResult(_0x1fda83,_0x4e895e){return function(_0x161fc7){if(_0x161fc7){var _0x1ceb1e=typeof _0x4e895e[_0x4ce1('0x2d')]===_0x4ce1('0x2e')&&typeof _0x4e895e[_0x4ce1('0x2f')]==='undefined';var _0x2a9bc3=_0x161fc7[_0x4ce1('0x30')];var _0x3241ca=_0x1ceb1e?0x0:_0x4e895e[_0x4ce1('0x2d')];var _0x28f1fb=_0x1ceb1e?_0x161fc7[_0x4ce1('0x30')]:_0x4e895e['offset']+_0x4e895e[_0x4ce1('0x2f')];var _0x2d4a23;if(_0x28f1fb>=_0x2a9bc3){_0x28f1fb=_0x2a9bc3;_0x2d4a23=0xc8;}else{_0x2d4a23=0xce;}_0x1fda83[_0x4ce1('0x2a')](_0x2d4a23);return _0x1fda83['set']('Content-Range',_0x3241ca+'-'+_0x28f1fb+'/'+_0x2a9bc3)[_0x4ce1('0x2c')](_0x161fc7);}return null;};}function patchUpdates(_0x266e08){return function(_0x44025d){try{jsonpatch[_0x4ce1('0x31')](_0x44025d,_0x266e08,!![]);}catch(_0x10fe0f){return BPromise[_0x4ce1('0x32')](_0x10fe0f);}return _0x44025d['save']();};}function saveUpdates(_0x5ea1ed,_0x40f9f6){return function(_0x9cb68c){if(_0x9cb68c){return _0x9cb68c['update'](_0x5ea1ed)[_0x4ce1('0x21')](function(_0xbb6f5e){return _0xbb6f5e;});}return null;};}function removeEntity(_0x246e15,_0x158ae0){return function(_0x41f42b){if(_0x41f42b){return _0x41f42b[_0x4ce1('0x33')]()[_0x4ce1('0x21')](function(){_0x246e15[_0x4ce1('0x2a')](0xcc)[_0x4ce1('0x2b')]();});}};}function handleEntityNotFound(_0x314592,_0x3ee75e){return function(_0x547c72){if(!_0x547c72){_0x314592[_0x4ce1('0x29')](0x194);}return _0x547c72;};}function handleError(_0x26fd6e,_0x835d08){_0x835d08=_0x835d08||0x1f4;return function(_0x4c9284){logger['error'](_0x4c9284[_0x4ce1('0x34')]);if(_0x4c9284['name']){delete _0x4c9284[_0x4ce1('0x35')];}_0x26fd6e[_0x4ce1('0x2a')](_0x835d08)[_0x4ce1('0x36')](_0x4c9284);};}exports[_0x4ce1('0x37')]=function(_0x13321e,_0x24ef5e){var _0x2a0ad6={},_0x5e7996={},_0x5db86f={'count':0x0,'rows':[]};var _0x42c070=_[_0x4ce1('0x38')](db[_0x4ce1('0x39')][_0x4ce1('0x3a')],function(_0x3a5dd5){return{'name':_0x3a5dd5[_0x4ce1('0x3b')],'type':_0x3a5dd5['type'][_0x4ce1('0x3c')]};});_0x5e7996[_0x4ce1('0x3d')]=_[_0x4ce1('0x38')](_0x42c070,_0x4ce1('0x35'));_0x5e7996[_0x4ce1('0x3e')]=_['keys'](_0x13321e[_0x4ce1('0x3e')]);_0x5e7996[_0x4ce1('0x3f')]=_[_0x4ce1('0x40')](_0x5e7996[_0x4ce1('0x3d')],_0x5e7996[_0x4ce1('0x3e')]);_0x2a0ad6[_0x4ce1('0x41')]=_[_0x4ce1('0x40')](_0x5e7996[_0x4ce1('0x3d')],qs['fields'](_0x13321e[_0x4ce1('0x3e')][_0x4ce1('0x42')]));_0x2a0ad6[_0x4ce1('0x41')]=_0x2a0ad6[_0x4ce1('0x41')][_0x4ce1('0x43')]?_0x2a0ad6[_0x4ce1('0x41')]:_0x5e7996[_0x4ce1('0x3d')];if(!_0x13321e[_0x4ce1('0x3e')]['hasOwnProperty'](_0x4ce1('0x44'))){_0x2a0ad6[_0x4ce1('0x2f')]=qs[_0x4ce1('0x2f')](_0x13321e[_0x4ce1('0x3e')][_0x4ce1('0x2f')]);_0x2a0ad6[_0x4ce1('0x2d')]=qs[_0x4ce1('0x2d')](_0x13321e[_0x4ce1('0x3e')][_0x4ce1('0x2d')]);}_0x2a0ad6['order']=qs[_0x4ce1('0x45')](_0x13321e[_0x4ce1('0x3e')][_0x4ce1('0x45')]);_0x2a0ad6['where']=qs[_0x4ce1('0x3f')](_[_0x4ce1('0x46')](_0x13321e[_0x4ce1('0x3e')],_0x5e7996[_0x4ce1('0x3f')]),_0x42c070);if(_0x13321e['query'][_0x4ce1('0x47')]){_0x2a0ad6[_0x4ce1('0x48')]=_[_0x4ce1('0x49')](_0x2a0ad6[_0x4ce1('0x48')],{'$or':_['map'](_0x42c070,function(_0x5ce7dd){if(_0x5ce7dd[_0x4ce1('0x4a')]!=='VIRTUAL'){var _0x3303c1={};_0x3303c1[_0x5ce7dd[_0x4ce1('0x35')]]={'$like':'%'+_0x13321e[_0x4ce1('0x3e')][_0x4ce1('0x47')]+'%'};return _0x3303c1;}})});}_0x2a0ad6=_[_0x4ce1('0x49')]({},_0x2a0ad6,_0x13321e[_0x4ce1('0x4b')]);var _0x4e8c05={'where':_0x2a0ad6[_0x4ce1('0x48')]};return db[_0x4ce1('0x39')]['count'](_0x4e8c05)[_0x4ce1('0x21')](function(_0x5ad6ba){_0x5db86f[_0x4ce1('0x30')]=_0x5ad6ba;if(_0x13321e[_0x4ce1('0x3e')]['includeAll']){_0x2a0ad6[_0x4ce1('0x4c')]=[{'all':!![]}];}return db['SmsMessage'][_0x4ce1('0x4d')](_0x2a0ad6);})[_0x4ce1('0x21')](function(_0xe7cecb){_0x5db86f['rows']=_0xe7cecb;return _0x5db86f;})[_0x4ce1('0x21')](respondWithFilteredResult(_0x24ef5e,_0x2a0ad6))[_0x4ce1('0x4e')](handleError(_0x24ef5e,null));};exports[_0x4ce1('0x4f')]=function(_0x42d312,_0xc3442b){var _0x2c86d5={'raw':!![],'where':{'id':_0x42d312['params']['id']}},_0x4a9c54={};_0x4a9c54[_0x4ce1('0x3d')]=_[_0x4ce1('0x50')](db[_0x4ce1('0x39')]['rawAttributes']);_0x4a9c54[_0x4ce1('0x3e')]=_[_0x4ce1('0x50')](_0x42d312[_0x4ce1('0x3e')]);_0x4a9c54['filters']=_[_0x4ce1('0x40')](_0x4a9c54[_0x4ce1('0x3d')],_0x4a9c54['query']);_0x2c86d5['attributes']=_[_0x4ce1('0x40')](_0x4a9c54[_0x4ce1('0x3d')],qs['fields'](_0x42d312[_0x4ce1('0x3e')][_0x4ce1('0x42')]));_0x2c86d5[_0x4ce1('0x41')]=_0x2c86d5[_0x4ce1('0x41')]['length']?_0x2c86d5[_0x4ce1('0x41')]:_0x4a9c54[_0x4ce1('0x3d')];if(_0x42d312[_0x4ce1('0x3e')][_0x4ce1('0x51')]){_0x2c86d5['include']=[{'all':!![]}];}_0x2c86d5=_['merge']({},_0x2c86d5,_0x42d312['options']);return db['SmsMessage'][_0x4ce1('0x52')](_0x2c86d5)[_0x4ce1('0x21')](handleEntityNotFound(_0xc3442b,null))[_0x4ce1('0x21')](respondWithResult(_0xc3442b,null))[_0x4ce1('0x4e')](handleError(_0xc3442b,null));};exports[_0x4ce1('0x53')]=function(_0x581803,_0x118b34){return db[_0x4ce1('0x39')]['create'](_0x581803['body'],{})[_0x4ce1('0x21')](respondWithResult(_0x118b34,0xc9))[_0x4ce1('0x4e')](handleError(_0x118b34,null));};exports[_0x4ce1('0x54')]=function(_0x1450e2,_0x3f766e){if(_0x1450e2[_0x4ce1('0x55')]['id']){delete _0x1450e2[_0x4ce1('0x55')]['id'];}return db[_0x4ce1('0x39')][_0x4ce1('0x52')]({'where':{'id':_0x1450e2[_0x4ce1('0x56')]['id']}})[_0x4ce1('0x21')](handleEntityNotFound(_0x3f766e,null))[_0x4ce1('0x21')](saveUpdates(_0x1450e2[_0x4ce1('0x55')],null))[_0x4ce1('0x21')](respondWithResult(_0x3f766e,null))[_0x4ce1('0x4e')](handleError(_0x3f766e,null));};exports[_0x4ce1('0x33')]=function(_0x1d109f,_0x3b04e1){return db['SmsMessage'][_0x4ce1('0x52')]({'where':{'id':_0x1d109f[_0x4ce1('0x56')]['id']}})[_0x4ce1('0x21')](handleEntityNotFound(_0x3b04e1,null))['then'](removeEntity(_0x3b04e1,null))[_0x4ce1('0x4e')](handleError(_0x3b04e1,null));};exports[_0x4ce1('0x57')]=function(_0x451741,_0x2f700c){return db[_0x4ce1('0x39')][_0x4ce1('0x57')]()[_0x4ce1('0x21')](respondWithResult(_0x2f700c,null))[_0x4ce1('0x4e')](handleError(_0x2f700c,null));};var interaction_log=require(_0x4ce1('0x14'))('sms-interactions');exports['accept']=function(_0x3966cc,_0x158457,_0x53f8c8){var _0x40883e={'agent':{},'channel':'sms'};if(_0x3966cc[_0x4ce1('0x55')]['id']){delete _0x3966cc[_0x4ce1('0x55')]['id'];}_0x3966cc[_0x4ce1('0x55')][_0x4ce1('0x58')]=!![];_0x3966cc[_0x4ce1('0x55')][_0x4ce1('0x59')]=moment()[_0x4ce1('0x5a')](_0x4ce1('0x5b'));_0x3966cc[_0x4ce1('0x55')][_0x4ce1('0x5c')]=_0x3966cc[_0x4ce1('0x55')][_0x4ce1('0x5c')]||_0x3966cc[_0x4ce1('0x5d')]['id'];_0x40883e[_0x4ce1('0x5e')]['id']=_0x3966cc[_0x4ce1('0x55')][_0x4ce1('0x5c')];return db[_0x4ce1('0x39')]['find']({'where':{'id':_0x3966cc[_0x4ce1('0x56')]['id'],'UserId':null}})[_0x4ce1('0x21')](handleEntityNotFound(_0x158457,null))[_0x4ce1('0x21')](saveUpdates(_0x3966cc[_0x4ce1('0x55')],null))[_0x4ce1('0x21')](function(_0x2bb4d5){if(_0x2bb4d5){_0x40883e[_0x4ce1('0x28')]=_0x2bb4d5[_0x4ce1('0x5f')]({'plain':!![]});return db[_0x4ce1('0x60')]['find']({'where':{'id':_0x2bb4d5['SmsInteractionId']}});}return null;})[_0x4ce1('0x21')](handleEntityNotFound(_0x158457,null))[_0x4ce1('0x21')](function(_0x40bde9){if(_0x40bde9){return _0x40bde9['update']({'UserId':_0x3966cc[_0x4ce1('0x55')]['UserId'],'read1stAt':_[_0x4ce1('0x61')](_0x40bde9['read1stAt'])?moment()[_0x4ce1('0x5a')](_0x4ce1('0x5b')):undefined});}return null;})['then'](function(_0x584d70){if(_0x584d70){_0x40883e[_0x4ce1('0x62')]=_0x584d70['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3966cc[_0x4ce1('0x5d')]['id'],_0x3966cc['user'][_0x4ce1('0x35')],_0x3966cc[_0x4ce1('0x5d')][_0x4ce1('0x63')],_0x40883e[_0x4ce1('0x62')]['id'],_0x3966cc[_0x4ce1('0x55')]?JSON[_0x4ce1('0x25')](_0x3966cc[_0x4ce1('0x55')]):_0x4ce1('0x64'));return respondWithRpcPromise('AcceptMessage',_0x4ce1('0x65'),_0x40883e);}return null;})[_0x4ce1('0x21')](function(_0xc7f61f){var _0x5b0d91=_0x4ce1('0x66')+_0xc7f61f['message'][_0x4ce1('0x67')];return db[_0x4ce1('0x68')][_0x4ce1('0x3e')](_0x5b0d91,{'type':db['Sequelize']['QueryTypes'][_0x4ce1('0x69')],'raw':!![]})['then'](function(_0x5e85a8){return _0x5e85a8;});})[_0x4ce1('0x21')](function(_0xbf63a3){if(_0xbf63a3){_0x40883e['message'][_0x4ce1('0x6a')]=_0xbf63a3[0x0];if(!_0x3966cc[_0x4ce1('0x55')][_0x4ce1('0x5c')])return;return db[_0x4ce1('0x6b')][_0x4ce1('0x52')]({'where':{'id':_0x3966cc[_0x4ce1('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0x4ce1('0x35'),_0x4ce1('0x6c'),_0x4ce1('0x6d'),_0x4ce1('0x6e')],'raw':!![]});}return null;})[_0x4ce1('0x21')](function(_0x2f9ff9){if(!_0x2f9ff9)return null;_0x40883e[_0x4ce1('0x28')][_0x4ce1('0x5e')]=_0x2f9ff9;return _0x40883e;})[_0x4ce1('0x21')](function(_0x3b5a45){if(_0x3b5a45){if(_0x3966cc[_0x4ce1('0x55')][_0x4ce1('0x6f')]){_0x40883e['message'][_0x4ce1('0x70')]=util[_0x4ce1('0x5a')](_0x4ce1('0x71'),_0x3966cc[_0x4ce1('0x5d')][_0x4ce1('0x35')]);_0x40883e[_0x4ce1('0x28')][_0x4ce1('0x72')]=_0x40883e[_0x4ce1('0x72')];_0x40883e[_0x4ce1('0x28')]['motionChannel']=_0x40883e[_0x4ce1('0x72')];_0x40883e[_0x4ce1('0x28')]['event']=_0x4ce1('0x73');return respondWithRpcPromise(_0x4ce1('0x74'),_0x4ce1('0x74'),{'event':_0x4ce1('0x75'),'message':_0x40883e[_0x4ce1('0x28')]},client9002)[_0x4ce1('0x21')](function(){return _0x40883e;});}return _0x40883e;}return null;})[_0x4ce1('0x21')](respondWithResult(_0x158457,null))[_0x4ce1('0x4e')](handleError(_0x158457,null));};var interaction_log=require(_0x4ce1('0x14'))(_0x4ce1('0x76'));exports['reject']=function(_0x23aeec,_0x336bbc,_0x4e1b31){var _0x9fff5d={'agent':{},'channel':'sms'};if(_0x23aeec[_0x4ce1('0x55')]['id']){delete _0x23aeec[_0x4ce1('0x55')]['id'];}_0x23aeec[_0x4ce1('0x55')][_0x4ce1('0x5c')]=_0x23aeec[_0x4ce1('0x55')]['UserId']||_0x23aeec[_0x4ce1('0x5d')]['id'];_0x9fff5d['agent']['id']=_0x23aeec[_0x4ce1('0x55')]['UserId'];return db['SmsMessage']['find']({'where':{'id':_0x23aeec[_0x4ce1('0x56')]['id'],'UserId':null}})[_0x4ce1('0x21')](handleEntityNotFound(_0x336bbc,null))[_0x4ce1('0x21')](function(_0x315045){if(_0x315045){_0x9fff5d[_0x4ce1('0x28')]=_0x315045['get']({'plain':!![]});return db[_0x4ce1('0x60')][_0x4ce1('0x52')]({'where':{'id':_0x315045[_0x4ce1('0x77')]}});}return null;})[_0x4ce1('0x21')](handleEntityNotFound(_0x336bbc,null))['then'](function(_0x1a6809){if(_0x1a6809){_0x9fff5d[_0x4ce1('0x62')]=_0x1a6809[_0x4ce1('0x5f')]({'plain':!![]});interaction_log[_0x4ce1('0x22')](_0x4ce1('0x78'),_0x23aeec['user']['id'],_0x23aeec[_0x4ce1('0x5d')][_0x4ce1('0x35')],_0x23aeec[_0x4ce1('0x5d')][_0x4ce1('0x63')],_0x9fff5d[_0x4ce1('0x62')]['id'],_0x23aeec['body']?JSON[_0x4ce1('0x25')](_0x23aeec[_0x4ce1('0x55')]):_0x4ce1('0x64'));return respondWithRpcPromise(_0x4ce1('0x79'),_0x4ce1('0x7a'),_0x9fff5d);}return null;})['then'](function(_0x4ea124){var _0x12b53e=_0x4ce1('0x66')+_0x4ea124[_0x4ce1('0x28')][_0x4ce1('0x67')];return db['sequelize']['query'](_0x12b53e,{'type':db[_0x4ce1('0x7b')][_0x4ce1('0x7c')][_0x4ce1('0x69')],'raw':!![]})['then'](function(_0x59bfbb){return _0x59bfbb;});})['then'](function(_0x1f21eb){if(_0x1f21eb){_0x9fff5d[_0x4ce1('0x28')]['contact']=_0x1f21eb[0x0];if(!_0x23aeec['body']['UserId'])return;return db[_0x4ce1('0x6b')]['find']({'where':{'id':_0x23aeec[_0x4ce1('0x55')][_0x4ce1('0x5c')],'role':'agent'},'attributes':['id',_0x4ce1('0x35'),_0x4ce1('0x6c'),'email',_0x4ce1('0x6e')],'raw':!![]});}return null;})[_0x4ce1('0x21')](function(_0x47170c){if(!_0x47170c)return null;_0x9fff5d['message'][_0x4ce1('0x5e')]=_0x47170c;return _0x9fff5d;})[_0x4ce1('0x21')](function(_0x20ef9c){if(_0x20ef9c){_0x20ef9c[_0x4ce1('0x28')][_0x4ce1('0x70')]=util[_0x4ce1('0x5a')](_0x4ce1('0x71'),_0x23aeec['user']['name']);_0x20ef9c[_0x4ce1('0x28')][_0x4ce1('0x72')]=_0x9fff5d[_0x4ce1('0x72')];_0x20ef9c[_0x4ce1('0x28')][_0x4ce1('0x7d')]=_0x9fff5d[_0x4ce1('0x72')];_0x20ef9c[_0x4ce1('0x28')][_0x4ce1('0x7e')]=_0x4ce1('0x32');respondWithRpcPromise('EventManager',_0x4ce1('0x74'),{'event':_0x4ce1('0x7f'),'message':_0x20ef9c['message']},client9002);return _0x9fff5d;}return null;})['then'](respondWithResult(_0x336bbc,null))[_0x4ce1('0x4e')](handleError(_0x336bbc,null));};exports[_0x4ce1('0x2a')]=function(_0x1d4118,_0x582efe,_0x2c9358){if(_0x1d4118[_0x4ce1('0x55')]['id']){delete _0x1d4118[_0x4ce1('0x55')]['id'];}var _0x5308d1;return db[_0x4ce1('0x39')][_0x4ce1('0x52')]({'where':{'id':_0x1d4118[_0x4ce1('0x56')]['id']}})['then'](handleEntityNotFound(_0x582efe,null))[_0x4ce1('0x21')](function(_0x5d3f07){if(_0x5d3f07){_0x5308d1=_0x5d3f07;return db[_0x4ce1('0x80')][_0x4ce1('0x52')]({'where':{'id':_0x5d3f07[_0x4ce1('0x81')]}});}})['then'](handleEntityNotFound(_0x582efe,null))[_0x4ce1('0x21')](function(_0x13280a){if(_0x13280a){logger[_0x4ce1('0x24')](_0x4ce1('0x82'),_0x4ce1('0x2a'),_0x4ce1('0x83'),_0x13280a[_0x4ce1('0x4a')],util['inspect'](_0x1d4118[_0x4ce1('0x55')],{'showHidden':![],'depth':null}));switch(_0x13280a[_0x4ce1('0x4a')]){case'twilio':if(_0x1d4118[_0x4ce1('0x55')]['MessageSid']&&_0x1d4118[_0x4ce1('0x55')]['MessageSid']===_0x5308d1[_0x4ce1('0x84')]){return _0x5308d1[_0x4ce1('0x54')]({'read':!![]});}else{logger['error'](_0x4ce1('0x85'),_0x4ce1('0x2a'),'twilio',util[_0x4ce1('0x86')](_0x1d4118['body'],{'showHidden':![],'depth':null}));}break;case _0x4ce1('0x87'):if(_0x1d4118[_0x4ce1('0x55')][_0x4ce1('0x88')]&&_0x1d4118[_0x4ce1('0x55')][_0x4ce1('0x88')]===_0x5308d1[_0x4ce1('0x84')]&&_[_0x4ce1('0x89')]([_0x4ce1('0x8a'),_0x4ce1('0x8b')],_0x1d4118[_0x4ce1('0x55')][_0x4ce1('0x8c')])>=0x0){return _0x5308d1[_0x4ce1('0x54')]({'read':!![]});}else{logger['error'](_0x4ce1('0x85'),'status',_0x4ce1('0x8d'),util[_0x4ce1('0x86')](_0x1d4118[_0x4ce1('0x55')],{'showHidden':![],'depth':null}));}break;case _0x4ce1('0x8e'):var _0x1d9764=_0x1d4118[_0x4ce1('0x55')][_0x4ce1('0x8f')][0x0];if(_0x1d9764[_0x4ce1('0x2a')]['groupName']===_0x4ce1('0x90')){return _0x5308d1[_0x4ce1('0x54')]({'read':!![]});}else{logger['error'](_0x4ce1('0x85'),_0x4ce1('0x2a'),_0x4ce1('0x8e'),util[_0x4ce1('0x86')](_0x1d4118[_0x4ce1('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x5308d1;}})[_0x4ce1('0x21')](respondWithResult(_0x582efe,null))[_0x4ce1('0x4e')](handleError(_0x582efe,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 10184b5..997830d 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 _0x5a99=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x5a99,0xef));var _0x95a9=function(_0x3198fe,_0xff7674){_0x3198fe=_0x3198fe-0x0;var _0x28e79e=_0x5a99[_0x3198fe];return _0x28e79e;};'use strict';var EventEmitter=require(_0x95a9('0x0'));var SmsMessage=require(_0x95a9('0x1'))['db'][_0x95a9('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x95a9('0x3')](0x0);var events={'afterCreate':_0x95a9('0x4'),'afterUpdate':'update','afterDestroy':_0x95a9('0x5')};function emitEvent(_0x168f37){return function(_0x139336,_0x24f18e,_0x11bb09){SmsMessageEvents['emit'](_0x168f37+':'+_0x139336['id'],_0x139336);SmsMessageEvents[_0x95a9('0x6')](_0x168f37,_0x139336);_0x11bb09(null);};}for(var e in events){if(events[_0x95a9('0x7')](e)){var event=events[e];SmsMessage[_0x95a9('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xcb1a=['SmsMessage','setMaxListeners','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x150651,_0x969943){var _0x43b827=function(_0x3f6c7a){while(--_0x3f6c7a){_0x150651['push'](_0x150651['shift']());}};_0x43b827(++_0x969943);}(_0xcb1a,0x17e));var _0xacb1=function(_0x109a1e,_0xce7566){_0x109a1e=_0x109a1e-0x0;var _0x53ea0c=_0xcb1a[_0x109a1e];return _0x53ea0c;};'use strict';var EventEmitter=require(_0xacb1('0x0'));var SmsMessage=require(_0xacb1('0x1'))['db'][_0xacb1('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xacb1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xacb1('0x4')};function emitEvent(_0x26d8ff){return function(_0x33eac5,_0x5d1234,_0x5de544){SmsMessageEvents['emit'](_0x26d8ff+':'+_0x33eac5['id'],_0x33eac5);SmsMessageEvents[_0xacb1('0x5')](_0x26d8ff,_0x33eac5);_0x5de544(null);};}for(var e in events){if(events[_0xacb1('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xacb1('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 229a184..933b320 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 _0x2518=['https://api.intelepeer.com/_rest/v4/app/sms/mdr','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','SmsAccount','SmsAccountId','type','twilio','authToken','accountSid','messages','create','phone','remote','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','username','smsMethod','login?username=','password','split','sms','POST','session_key','total_sent','deliveryReport','read','skebby','catch','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','timestamp','keys','sort','length','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','Basic\x20%s','toString','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message'];(function(_0xa42cd5,_0x3b3d58){var _0x63be04=function(_0x5b9b7c){while(--_0x5b9b7c){_0xa42cd5['push'](_0xa42cd5['shift']());}};_0x63be04(++_0x3b3d58);}(_0x2518,0xf3));var _0x8251=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2518[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x8251('0x0'));var logger=require(_0x8251('0x1'))(_0x8251('0x2'));var moment=require(_0x8251('0x3'));var BPromise=require(_0x8251('0x4'));var rp=require(_0x8251('0x5'));var fs=require('fs');var path=require(_0x8251('0x6'));var rimraf=require(_0x8251('0x7'));var config=require(_0x8251('0x8'));var attributes=require(_0x8251('0x9'));module[_0x8251('0xa')]=function(_0x15b060,_0x523d51){return _0x15b060[_0x8251('0xb')](_0x8251('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x8251('0xd'),'fields':[_0x8251('0xd')]},{'name':_0x8251('0xe'),'fields':[_0x8251('0xf')],'type':_0x8251('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12b22b,_0x3799a2,_0x831458){var _0x336a69=_0x15b060[_0x8251('0x11')];var _0x442073=_0x12b22b['get']({'plain':!![]});if(_0x442073[_0x8251('0x12')][_0x8251('0x13')]()==='in'||_0x442073[_0x8251('0x12')][_0x8251('0x13')]()===_0x8251('0x14')&&!_0x442073[_0x8251('0x15')]&&!_[_0x8251('0x16')](_0x442073[_0x8251('0x17')])&&!_[_0x8251('0x16')](_0x442073[_0x8251('0x18')])){_0x336a69[_0x8251('0x19')]['findOne']({'where':{'id':_0x442073['SmsInteractionId']}})[_0x8251('0x1a')](function(_0x491353){if(_0x491353){_0x491353[_0x8251('0x1b')]({'lastMsgAt':_0x442073[_0x8251('0x1c')],'lastMsgDirection':_0x442073['direction'][_0x8251('0x13')]()});}})['catch'](function(_0x437b2b){console['error'](_0x437b2b);});}if(_0x442073['direction']===_0x8251('0x14')&&!_0x442073[_0x8251('0x15')]){var _0x3379c4;_0x336a69[_0x8251('0x1d')]['find']({'where':{'id':_0x442073[_0x8251('0x1e')]},'raw':!![]})[_0x8251('0x1a')](function(_0x1e8dac){_0x3379c4=_0x1e8dac;if(_0x3379c4&&_0x3379c4[_0x8251('0x1f')]){switch(_0x3379c4[_0x8251('0x1f')]){case'twilio':var _0x405e63=require(_0x8251('0x20'));if(_0x3379c4['accountSid']&&_0x3379c4[_0x8251('0x21')]&&_0x3379c4['phone']){var _0x4c3701=new _0x405e63(_0x3379c4[_0x8251('0x22')],_0x3379c4[_0x8251('0x21')]);_0x4c3701[_0x8251('0x23')][_0x8251('0x24')]({'body':_0x442073[_0x8251('0xf')],'to':_0x442073[_0x8251('0x25')],'from':_0x3379c4['phone'],'statusCallback':_0x3379c4[_0x8251('0x26')]+'/api/sms/messages/'+_0x442073['id']+_0x8251('0x27')+_0x3379c4[_0x8251('0x28')]})[_0x8251('0x1a')](function(_0x2df796){if(_0x2df796['sid']){return _0x12b22b[_0x8251('0x1b')]({'messageId':_0x2df796[_0x8251('0x29')]});}})['catch'](function(_0x479c82){logger[_0x8251('0x2a')](_0x8251('0x2b'),'afterCreate','twilio',util[_0x8251('0x2c')](_0x479c82,{'showHidden':![],'depth':null}));});}else{logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),_0x8251('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x3719b9='https://api.skebby.it/API/v1.0/REST/';if(_0x3379c4[_0x8251('0x2e')]&&_0x3379c4['password']){var _0x3adca3={'recipient':[_0x442073['phone']],'message':_0x442073[_0x8251('0xf')],'message_type':_0x3379c4[_0x8251('0x2f')]};if(_0x3379c4[_0x8251('0x2f')]&&_0x3379c4[_0x8251('0x2f')]!=='SI'){_0x3adca3['sender']=_0x3379c4[_0x8251('0x25')];}var _0x35897f={'url':_0x3719b9+_0x8251('0x30')+_0x3379c4[_0x8251('0x2e')]+'&password='+_0x3379c4[_0x8251('0x31')],'method':'GET'};rp(_0x35897f)['then'](function(_0x2d3e68){var _0x5c465d=_0x2d3e68[_0x8251('0x32')](';');var _0x1d6d3e={'user_key':_0x5c465d[0x0],'session_key':_0x5c465d[0x1]};_0x35897f={'url':_0x3719b9+_0x8251('0x33'),'method':_0x8251('0x34'),'headers':{'user_key':_0x1d6d3e['user_key'],'Session_key':_0x1d6d3e[_0x8251('0x35')]},'json':!![],'body':_0x3adca3};return rp(_0x35897f);})[_0x8251('0x1a')](function(_0x1345b7){if(_0x1345b7[_0x8251('0x36')]>=0x1){var _0x45e99c={'messageId':_0x1345b7['internal_order_id']};if(_0x3379c4[_0x8251('0x2f')]!=='GP'||!_0x3379c4[_0x8251('0x37')]){_0x45e99c[_0x8251('0x38')]=!![];}return _0x12b22b[_0x8251('0x1b')](_0x45e99c);}else{return logger[_0x8251('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8251('0x39'),util[_0x8251('0x2c')](_0x1345b7,{'showHidden':![],'depth':null}));}})[_0x8251('0x3a')](function(_0x58dc20){return logger[_0x8251('0x2a')](_0x8251('0x2b'),'afterCreate',_0x8251('0x39'),util['inspect'](_0x58dc20,{'showHidden':![],'depth':null}));});}else{logger[_0x8251('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8251('0x2d'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x8251('0x3b'):if(_0x3379c4[_0x8251('0x21')]){var _0xa08318={'recipient':_0x442073[_0x8251('0x25')],'message':_0x442073[_0x8251('0xf')],'sender':_0x3379c4[_0x8251('0x3c')]||_0x3379c4[_0x8251('0x25')],'authorization':_0x3379c4[_0x8251('0x21')]};var _0x3799a2={'method':'POST','uri':_0x8251('0x3d'),'body':_0xa08318,'json':!![]};rp(_0x3799a2)[_0x8251('0x1a')](function(_0x13423b){var _0x4b4d3d={'messageId':_0x13423b['requestid']};if(!_0x3379c4['deliveryReport']){_0x4b4d3d[_0x8251('0x38')]=!![];}return _0x12b22b[_0x8251('0x1b')](_0x4b4d3d);})[_0x8251('0x3a')](function(_0x37cf88){logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),_0x8251('0x3b'),util[_0x8251('0x2c')](_0x37cf88,{'showHidden':![],'depth':null}));});}else{logger[_0x8251('0x2a')](_0x8251('0x2b'),'afterCreate','connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x3379c4[_0x8251('0x2e')]&&_0x3379c4[_0x8251('0x31')]){var _0xa08318={'messages':[{'source':_0x8251('0x3e'),'to':_0x442073[_0x8251('0x25')],'body':_0x442073[_0x8251('0xf')],'from':_0x3379c4[_0x8251('0x3c')]||_0x3379c4[_0x8251('0x25')]}]};var _0x559e34=util[_0x8251('0x3f')]('%s:%s',_0x3379c4[_0x8251('0x2e')],_0x3379c4[_0x8251('0x31')]);var _0x3799a2={'method':_0x8251('0x34'),'uri':_0x8251('0x40'),'body':_0xa08318,'headers':{'Authorization':util[_0x8251('0x3f')]('Basic\x20%s',new Buffer(_0x559e34)['toString'](_0x8251('0x41')))},'json':!![]};rp(_0x3799a2)[_0x8251('0x1a')](function(_0x349ad1){if(_0x349ad1[_0x8251('0x42')]>=0xc8&&_0x349ad1[_0x8251('0x42')]<=0xce){if(_0x349ad1[_0x8251('0x43')]&&_0x349ad1[_0x8251('0x43')][_0x8251('0x44')]>0x0){var _0x53f151=_[_0x8251('0x45')](_0x349ad1['data'][_0x8251('0x23')]);var _0x12619b={'messageId':_0x53f151[_0x8251('0x46')]};if(!_0x3379c4[_0x8251('0x37')]){_0x12619b['read']=!![];}return _0x12b22b[_0x8251('0x1b')](_0x12619b);}else{logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),_0x8251('0x47'),util[_0x8251('0x2c')](_0x349ad1,{'showHidden':![],'depth':null}));}}else{logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),_0x8251('0x47'),util[_0x8251('0x2c')](_0x349ad1,{'showHidden':![],'depth':null}));}})['catch'](function(_0x551cab){logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),'clickSend',util['inspect'](_0x551cab,{'showHidden':![],'depth':null}));});}else{logger[_0x8251('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8251('0x2d'),_0x8251('0x47'),_0x8251('0x48'));}break;case _0x8251('0x49'):if(_0x3379c4[_0x8251('0x4a')]&&_0x3379c4['authToken']){var _0xa08318={'dst':_0x442073[_0x8251('0x25')],'text':_0x442073[_0x8251('0xf')],'src':_0x3379c4[_0x8251('0x3c')]||_0x3379c4[_0x8251('0x25')],'url':_0x3379c4['remote']+_0x8251('0x4b')+_0x442073['id']+_0x8251('0x27')+_0x3379c4[_0x8251('0x28')]};var _0x559e34=util[_0x8251('0x3f')](_0x8251('0x4c'),_0x3379c4[_0x8251('0x4a')],_0x3379c4[_0x8251('0x21')]);var _0x3799a2={'method':_0x8251('0x34'),'uri':util[_0x8251('0x3f')](_0x8251('0x4d'),_0x3379c4[_0x8251('0x4a')]),'body':_0xa08318,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x559e34)['toString'](_0x8251('0x41')))},'json':!![]};rp(_0x3799a2)[_0x8251('0x1a')](function(_0x8a9688){var _0x20cfd7={'messageId':_0x8a9688[_0x8251('0x4e')][0x0]};return _0x12b22b[_0x8251('0x1b')](_0x20cfd7);})['catch'](function(_0x468fa6){logger[_0x8251('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8251('0x2d'),'plivo',util['inspect'](_0x468fa6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8251('0x2b'),_0x8251('0x2d'),_0x8251('0x49'),_0x8251('0x4f'));}break;case _0x8251('0x50'):if(_0x3379c4[_0x8251('0x2e')]&&_0x3379c4[_0x8251('0x31')]){if(_0x3379c4[_0x8251('0x51')]){var _0x23e815={'method':'POST','uri':_0x3379c4['baseUrl']+_0x8251('0x52'),'body':{'username':_0x3379c4[_0x8251('0x2e')],'password':_0x3379c4[_0x8251('0x31')]},'json':!![]};return rp(_0x23e815)[_0x8251('0x1a')](function(_0xc2f832){var _0x490029={'method':'POST','uri':_0x3379c4[_0x8251('0x51')]+_0x8251('0x53'),'body':{'messages':[{'from':_0x3379c4[_0x8251('0x25')],'destinations':[{'to':_0x442073[_0x8251('0x25')]}],'text':_0x442073[_0x8251('0xf')],'notifyUrl':_0x3379c4[_0x8251('0x26')]+_0x8251('0x4b')+_0x442073['id']+_0x8251('0x27')+_0x3379c4['token'],'notifyContentType':_0x8251('0x54'),'callbackData':_0x3379c4[_0x8251('0x25')]+';'+_0x442073[_0x8251('0xf')]}]},'headers':{'Authorization':_0x8251('0x55')+_0xc2f832['token']},'json':!![]};return rp(_0x490029)['then'](function(_0x446d0b){if(_0x446d0b[_0x8251('0x23')]){var _0x48c9e3={'messageId':_0x446d0b[_0x8251('0x23')][0x0]['messageId']};if(!_0x3379c4['deliveryReport']){_0x48c9e3[_0x8251('0x38')]=!![];}return _0x12b22b['update'](_0x48c9e3);}else{return logger[_0x8251('0x2a')](_0x8251('0x2b'),'afterCreate',_0x8251('0x50'),util['inspect'](_0x446d0b,{'showHidden':![],'depth':null}));}});})[_0x8251('0x3a')](function(_0x76437f){return logger['error'](_0x8251('0x2b'),_0x8251('0x2d'),_0x8251('0x50'),util[_0x8251('0x2c')](_0x76437f,{'showHidden':![],'depth':null}));});}else{logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),'infobip',_0x8251('0x56'));}}else{logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),_0x8251('0x50'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x8251('0x57'):var _0x123d98=require(_0x8251('0x58'));if(_0x3379c4[_0x8251('0x59')]){var _0x46bec5={};_0x46bec5[_0x8251('0x5a')]=_0x3379c4['username'];_0x46bec5['phone']=_0x442073[_0x8251('0x25')];_0x46bec5[_0x8251('0x5b')]=_0x3379c4['phone'];_0x46bec5[_0x8251('0x5c')]=_0x442073[_0x8251('0xf')];_0x46bec5[_0x8251('0x5d')]=+new Date();var _0x301a07='';var _0x1a84bc='';var _0x41bd05=Object[_0x8251('0x5e')](_0x46bec5);_0x41bd05[_0x8251('0x5f')]();for(var _0x3f3381=0x0;_0x3f3381<_0x41bd05[_0x8251('0x60')];_0x3f3381++){if(_0x301a07!=''){_0x301a07+='&';}_0x301a07+=_0x41bd05[_0x3f3381]+'='+encodeURIComponent(_0x46bec5[_0x41bd05[_0x3f3381]]);_0x1a84bc+=_0x46bec5[_0x41bd05[_0x3f3381]];}_0x1a84bc+=_0x3379c4[_0x8251('0x59')];_0x1a84bc=_0x123d98['createHash']('md5')[_0x8251('0x1b')](_0x1a84bc)['digest'](_0x8251('0x61'));if(_0x301a07!==''){_0x301a07+='&';}_0x301a07+='signature='+_0x1a84bc;var _0x35897f={'method':'GET','uri':_0x3379c4['baseUrl']+_0x8251('0x62')+_0x301a07,'json':!![]};return rp(_0x35897f)[_0x8251('0x1a')](function(_0x5c1b9c){var _0x499a5e=Object[_0x8251('0x5e')](_0x5c1b9c);if(_0x5c1b9c[_0x499a5e[0x0]][_0x8251('0x2a')]&&parseInt(_0x5c1b9c[_0x499a5e[0x0]][_0x8251('0x2a')])===0x0){var _0x3451c3={'messageId':_0x5c1b9c[_0x499a5e[0x0]][_0x8251('0x63')]};if(!_0x3379c4[_0x8251('0x37')]){_0x3451c3[_0x8251('0x38')]=!![];}return _0x12b22b[_0x8251('0x1b')](_0x3451c3);}else{return logger[_0x8251('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8251('0x2d'),_0x8251('0x57'),util['inspect'](_0x5c1b9c[_0x8251('0x2a')],{'showHidden':![],'depth':null}));}})[_0x8251('0x3a')](function(_0x2c71bd){return logger[_0x8251('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8251('0x2d'),_0x8251('0x57'),util[_0x8251('0x2c')](_0x2c71bd,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8251('0x2d'),_0x8251('0x57'),_0x8251('0x64'));}break;case _0x8251('0x65'):if(_0x3379c4[_0x8251('0x59')]){var _0x5e2037={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3379c4[_0x8251('0x59')]},'body':{'content':_0x442073[_0x8251('0xf')],'to':[_0x442073[_0x8251('0x25')]],'from':_0x3379c4['phone'],'binary':![],'clientMessageId':_0x8251('0x66'),'charset':'UTF-8'},'json':!![]};rp(_0x5e2037)[_0x8251('0x1a')](function(_0x43dbc3){if(!_0x43dbc3[_0x8251('0x2a')]){var _0x328c58={'messageId':_0x43dbc3[_0x8251('0x23')][0x0][_0x8251('0x67')]};if(!_0x3379c4['deliveryReport']){_0x328c58[_0x8251('0x38')]=!![];}return _0x12b22b['update'](_0x328c58);}else{return logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),_0x8251('0x65'),util[_0x8251('0x2c')](_0x43dbc3['error'],{'showHidden':![],'depth':null}));}})[_0x8251('0x3a')](function(_0x2ae52c){return logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),_0x8251('0x65'),util['inspect'](_0x2ae52c,{'showHidden':![],'depth':null}));});}else{logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),_0x8251('0x65'),_0x8251('0x64'));}break;case _0x8251('0x68'):if(_0x3379c4['username']&&_0x3379c4[_0x8251('0x31')]){var _0x559e34=util[_0x8251('0x3f')](_0x8251('0x4c'),_0x3379c4[_0x8251('0x2e')],_0x3379c4[_0x8251('0x31')]);var _0x3799a2={'method':_0x8251('0x34'),'uri':_0x8251('0x69')+_0x3379c4['accountId']+_0x8251('0x6a'),'body':{'to':[_0x442073['phone']],'text':_0x442073[_0x8251('0xf')],'from':_0x3379c4['phone'],'applicationId':_0x3379c4[_0x8251('0x6b')]},'headers':{'Authorization':util[_0x8251('0x3f')](_0x8251('0x6c'),new Buffer(_0x559e34)[_0x8251('0x6d')](_0x8251('0x41')))},'json':!![]};rp(_0x3799a2)[_0x8251('0x1a')](function(_0x3b62a3){if(_0x3b62a3['id']){var _0x50584b={'messageId':_0x3b62a3['id']};return _0x12b22b[_0x8251('0x1b')](_0x50584b);}else{logger[_0x8251('0x2a')](_0x8251('0x2b'),'afterCreate',_0x8251('0x68'),util[_0x8251('0x2c')](_0x3b62a3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x510ef8){logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),'bandwidth',util[_0x8251('0x2c')](_0x510ef8,{'showHidden':![],'depth':null}));});}else{logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),'bandwidth',_0x8251('0x48'));}break;case _0x8251('0x6e'):if(_0x3379c4[_0x8251('0x59')]){var _0x38741d={};var _0x35897f={'method':_0x8251('0x34'),'uri':_0x8251('0x6f'),'headers':{'Authorization':_0x8251('0x70')+_0x3379c4[_0x8251('0x59')],'Content-Type':_0x8251('0x54')},'body':{'from':_0x3379c4[_0x8251('0x25')],'to':_0x442073[_0x8251('0x25')],'text':_0x442073[_0x8251('0xf')]},'json':!![]};return rp(_0x35897f)[_0x8251('0x1a')](function(_0x410233){if(_0x410233['code']==0xca){_0x38741d[_0x8251('0x71')]=_0x410233;var _0x434294={'method':_0x8251('0x34'),'uri':_0x8251('0x72'),'headers':{'Authorization':_0x8251('0x70')+_0x3379c4[_0x8251('0x59')],'Content-Type':_0x8251('0x54')},'body':{'refid':_0x38741d[_0x8251('0x71')]['refid']},'json':!![]};return rp(_0x434294)[_0x8251('0x1a')](function(_0xce0cf7){_0x38741d['status']=_0xce0cf7;var _0x35e61f={'messageId':_0x38741d[_0x8251('0x71')]['refid'],'read':!![]};return _0x12b22b['update'](_0x35e61f);});}else{return logger[_0x8251('0x2a')](_0x8251('0x2b'),_0x8251('0x2d'),'intelepeer',util[_0x8251('0x2c')](_0x410233,{'showHidden':![],'depth':null}));}})[_0x8251('0x3a')](function(_0x49fa50){return logger['error'](_0x8251('0x2b'),_0x8251('0x2d'),_0x8251('0x6e'),util[_0x8251('0x2c')](_0x49fa50,{'showHidden':![],'depth':null}));});}else{return logger[_0x8251('0x2a')](_0x8251('0x2b'),'afterCreate','intelepeer',_0x8251('0x73'));}break;}}})[_0x8251('0x74')](function(){_0x831458();});}else{_0x831458();}}},'charset':_0x8251('0x75'),'collate':_0x8251('0x76')});}; \ No newline at end of file +var _0x653b=['SmsInteraction','findOne','then','update','catch','secret','SmsAccount','type','twilio','accountSid','phone','authToken','create','body','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','&password=','GET','sms','POST','user_key','total_sent','deliveryReport','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','queued_count','data','read','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','messages','infobip','Missing\x20parameters:\x20base_url','csc','crypto','timestamp','sort','length','apiKey','md5','digest','hex','signature=','/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','toLowerCase','direction','out','UserId','isNil','SmsInteractionId'];(function(_0x55f04d,_0x33454f){var _0x33e113=function(_0x419500){while(--_0x419500){_0x55f04d['push'](_0x55f04d['shift']());}};_0x33e113(++_0x33454f);}(_0x653b,0xd8));var _0xb653=function(_0x5c9274,_0x4e849b){_0x5c9274=_0x5c9274-0x0;var _0x1ef7d3=_0x653b[_0x5c9274];return _0x1ef7d3;};'use strict';var _=require(_0xb653('0x0'));var util=require('util');var logger=require(_0xb653('0x1'))(_0xb653('0x2'));var moment=require(_0xb653('0x3'));var BPromise=require(_0xb653('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb653('0x5'));var rimraf=require(_0xb653('0x6'));var config=require('../../config/environment');var attributes=require(_0xb653('0x7'));module['exports']=function(_0x6a1346,_0x3f50c0){return _0x6a1346[_0xb653('0x8')](_0xb653('0x9'),attributes,{'tableName':_0xb653('0xa'),'paranoid':![],'indexes':[{'name':_0xb653('0xb'),'fields':['messageId']},{'name':_0xb653('0xc'),'fields':['body'],'type':_0xb653('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e242f,_0x2ef22d,_0x4d2df9){var _0x46ae0d=_0x6a1346[_0xb653('0xe')];var _0x6676a5=_0x3e242f[_0xb653('0xf')]({'plain':!![]});if(_0x6676a5['direction'][_0xb653('0x10')]()==='in'||_0x6676a5[_0xb653('0x11')][_0xb653('0x10')]()===_0xb653('0x12')&&!_0x6676a5['secret']&&!_['isNil'](_0x6676a5[_0xb653('0x13')])&&!_[_0xb653('0x14')](_0x6676a5[_0xb653('0x15')])){_0x46ae0d[_0xb653('0x16')][_0xb653('0x17')]({'where':{'id':_0x6676a5[_0xb653('0x15')]}})[_0xb653('0x18')](function(_0x4cb081){if(_0x4cb081){_0x4cb081[_0xb653('0x19')]({'lastMsgAt':_0x6676a5['createdAt'],'lastMsgDirection':_0x6676a5['direction']['toLowerCase']()});}})[_0xb653('0x1a')](function(_0x331b02){console['error'](_0x331b02);});}if(_0x6676a5[_0xb653('0x11')]===_0xb653('0x12')&&!_0x6676a5[_0xb653('0x1b')]){var _0x32533d;_0x46ae0d[_0xb653('0x1c')]['find']({'where':{'id':_0x6676a5['SmsAccountId']},'raw':!![]})[_0xb653('0x18')](function(_0x9fb3e0){_0x32533d=_0x9fb3e0;if(_0x32533d&&_0x32533d[_0xb653('0x1d')]){switch(_0x32533d['type']){case _0xb653('0x1e'):var _0x4484aa=require(_0xb653('0x1e'));if(_0x32533d[_0xb653('0x1f')]&&_0x32533d['authToken']&&_0x32533d[_0xb653('0x20')]){var _0x41eb14=new _0x4484aa(_0x32533d['accountSid'],_0x32533d[_0xb653('0x21')]);_0x41eb14['messages'][_0xb653('0x22')]({'body':_0x6676a5[_0xb653('0x23')],'to':_0x6676a5[_0xb653('0x20')],'from':_0x32533d[_0xb653('0x20')],'statusCallback':_0x32533d['remote']+_0xb653('0x24')+_0x6676a5['id']+_0xb653('0x25')+_0x32533d[_0xb653('0x26')]})[_0xb653('0x18')](function(_0x5d3b37){if(_0x5d3b37[_0xb653('0x27')]){return _0x3e242f[_0xb653('0x19')]({'messageId':_0x5d3b37[_0xb653('0x27')]});}})[_0xb653('0x1a')](function(_0x21b773){logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x1e'),util[_0xb653('0x2b')](_0x21b773,{'showHidden':![],'depth':null}));});}else{logger[_0xb653('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb653('0x2a'),_0xb653('0x1e'),_0xb653('0x2c'));}break;case _0xb653('0x2d'):var _0x4eb16f='https://api.skebby.it/API/v1.0/REST/';if(_0x32533d[_0xb653('0x2e')]&&_0x32533d[_0xb653('0x2f')]){var _0x1d2887={'recipient':[_0x6676a5[_0xb653('0x20')]],'message':_0x6676a5[_0xb653('0x23')],'message_type':_0x32533d['smsMethod']};if(_0x32533d[_0xb653('0x30')]&&_0x32533d[_0xb653('0x30')]!=='SI'){_0x1d2887[_0xb653('0x31')]=_0x32533d['phone'];}var _0x48a5e0={'url':_0x4eb16f+'login?username='+_0x32533d[_0xb653('0x2e')]+_0xb653('0x32')+_0x32533d[_0xb653('0x2f')],'method':_0xb653('0x33')};rp(_0x48a5e0)[_0xb653('0x18')](function(_0x5578f1){var _0x211a77=_0x5578f1['split'](';');var _0x5e3f6f={'user_key':_0x211a77[0x0],'session_key':_0x211a77[0x1]};_0x48a5e0={'url':_0x4eb16f+_0xb653('0x34'),'method':_0xb653('0x35'),'headers':{'user_key':_0x5e3f6f[_0xb653('0x36')],'Session_key':_0x5e3f6f['session_key']},'json':!![],'body':_0x1d2887};return rp(_0x48a5e0);})[_0xb653('0x18')](function(_0x3f8288){if(_0x3f8288[_0xb653('0x37')]>=0x1){var _0x1d3a9b={'messageId':_0x3f8288['internal_order_id']};if(_0x32533d[_0xb653('0x30')]!=='GP'||!_0x32533d[_0xb653('0x38')]){_0x1d3a9b['read']=!![];}return _0x3e242f[_0xb653('0x19')](_0x1d3a9b);}else{return logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x2d'),util[_0xb653('0x2b')](_0x3f8288,{'showHidden':![],'depth':null}));}})[_0xb653('0x1a')](function(_0x519a7f){return logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x2d'),util[_0xb653('0x2b')](_0x519a7f,{'showHidden':![],'depth':null}));});}else{logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xb653('0x39'):if(_0x32533d[_0xb653('0x21')]){var _0x4af42d={'recipient':_0x6676a5[_0xb653('0x20')],'message':_0x6676a5[_0xb653('0x23')],'sender':_0x32533d[_0xb653('0x3a')]||_0x32533d[_0xb653('0x20')],'authorization':_0x32533d[_0xb653('0x21')]};var _0x2ef22d={'method':_0xb653('0x35'),'uri':_0xb653('0x3b'),'body':_0x4af42d,'json':!![]};rp(_0x2ef22d)[_0xb653('0x18')](function(_0x41b7c2){var _0xb300c2={'messageId':_0x41b7c2[_0xb653('0x3c')]};if(!_0x32533d[_0xb653('0x38')]){_0xb300c2['read']=!![];}return _0x3e242f[_0xb653('0x19')](_0xb300c2);})[_0xb653('0x1a')](function(_0x2b6042){logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x39'),util['inspect'](_0x2b6042,{'showHidden':![],'depth':null}));});}else{logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x39'),_0xb653('0x3d'));}break;case'clicksend':if(_0x32533d['username']&&_0x32533d[_0xb653('0x2f')]){var _0x4af42d={'messages':[{'source':_0xb653('0x3e'),'to':_0x6676a5[_0xb653('0x20')],'body':_0x6676a5[_0xb653('0x23')],'from':_0x32533d['senderString']||_0x32533d['phone']}]};var _0x1b9896=util[_0xb653('0x3f')](_0xb653('0x40'),_0x32533d['username'],_0x32533d[_0xb653('0x2f')]);var _0x2ef22d={'method':_0xb653('0x35'),'uri':_0xb653('0x41'),'body':_0x4af42d,'headers':{'Authorization':util[_0xb653('0x3f')](_0xb653('0x42'),new Buffer(_0x1b9896)[_0xb653('0x43')](_0xb653('0x44')))},'json':!![]};rp(_0x2ef22d)[_0xb653('0x18')](function(_0x3c0377){if(_0x3c0377[_0xb653('0x45')]>=0xc8&&_0x3c0377['http_code']<=0xce){if(_0x3c0377['data']&&_0x3c0377['data'][_0xb653('0x46')]>0x0){var _0x45050c=_['head'](_0x3c0377[_0xb653('0x47')]['messages']);var _0x21384f={'messageId':_0x45050c['message_id']};if(!_0x32533d['deliveryReport']){_0x21384f[_0xb653('0x48')]=!![];}return _0x3e242f[_0xb653('0x19')](_0x21384f);}else{logger[_0xb653('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb653('0x49'),util[_0xb653('0x2b')](_0x3c0377,{'showHidden':![],'depth':null}));}}else{logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),'clickSend',util[_0xb653('0x2b')](_0x3c0377,{'showHidden':![],'depth':null}));}})[_0xb653('0x1a')](function(_0x3ff97d){logger[_0xb653('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb653('0x2a'),_0xb653('0x49'),util[_0xb653('0x2b')](_0x3ff97d,{'showHidden':![],'depth':null}));});}else{logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x49'),_0xb653('0x4a'));}break;case _0xb653('0x4b'):if(_0x32533d['authId']&&_0x32533d[_0xb653('0x21')]){var _0x4af42d={'dst':_0x6676a5[_0xb653('0x20')],'text':_0x6676a5[_0xb653('0x23')],'src':_0x32533d[_0xb653('0x3a')]||_0x32533d[_0xb653('0x20')],'url':_0x32533d['remote']+_0xb653('0x24')+_0x6676a5['id']+_0xb653('0x25')+_0x32533d['token']};var _0x1b9896=util[_0xb653('0x3f')](_0xb653('0x40'),_0x32533d[_0xb653('0x4c')],_0x32533d[_0xb653('0x21')]);var _0x2ef22d={'method':_0xb653('0x35'),'uri':util[_0xb653('0x3f')](_0xb653('0x4d'),_0x32533d['authId']),'body':_0x4af42d,'headers':{'Authorization':util[_0xb653('0x3f')](_0xb653('0x42'),new Buffer(_0x1b9896)['toString'](_0xb653('0x44')))},'json':!![]};rp(_0x2ef22d)[_0xb653('0x18')](function(_0x423475){var _0x5cbe0d={'messageId':_0x423475[_0xb653('0x4e')][0x0]};return _0x3e242f[_0xb653('0x19')](_0x5cbe0d);})['catch'](function(_0x6b695a){logger[_0xb653('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb653('0x4b'),util[_0xb653('0x2b')](_0x6b695a,{'showHidden':![],'depth':null}));});}else{logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x4b'),_0xb653('0x4f'));}break;case'infobip':if(_0x32533d[_0xb653('0x2e')]&&_0x32533d[_0xb653('0x2f')]){if(_0x32533d[_0xb653('0x50')]){var _0x44f589={'method':_0xb653('0x35'),'uri':_0x32533d[_0xb653('0x50')]+_0xb653('0x51'),'body':{'username':_0x32533d['username'],'password':_0x32533d[_0xb653('0x2f')]},'json':!![]};return rp(_0x44f589)[_0xb653('0x18')](function(_0x1137cd){var _0x14c85e={'method':_0xb653('0x35'),'uri':_0x32533d[_0xb653('0x50')]+_0xb653('0x52'),'body':{'messages':[{'from':_0x32533d[_0xb653('0x20')],'destinations':[{'to':_0x6676a5[_0xb653('0x20')]}],'text':_0x6676a5[_0xb653('0x23')],'notifyUrl':_0x32533d[_0xb653('0x53')]+_0xb653('0x24')+_0x6676a5['id']+_0xb653('0x25')+_0x32533d[_0xb653('0x26')],'notifyContentType':'application/json','callbackData':_0x32533d[_0xb653('0x20')]+';'+_0x6676a5[_0xb653('0x23')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x1137cd[_0xb653('0x26')]},'json':!![]};return rp(_0x14c85e)['then'](function(_0x24c292){if(_0x24c292[_0xb653('0x54')]){var _0x47154f={'messageId':_0x24c292[_0xb653('0x54')][0x0][_0xb653('0xb')]};if(!_0x32533d[_0xb653('0x38')]){_0x47154f['read']=!![];}return _0x3e242f[_0xb653('0x19')](_0x47154f);}else{return logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x55'),util['inspect'](_0x24c292,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x13a7ec){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb653('0x2a'),_0xb653('0x55'),util['inspect'](_0x13a7ec,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb653('0x2a'),_0xb653('0x55'),_0xb653('0x56'));}}else{logger[_0xb653('0x28')](_0xb653('0x29'),'afterCreate','infobip',_0xb653('0x4a'));}break;case _0xb653('0x57'):var _0x109ebb=require(_0xb653('0x58'));if(_0x32533d['apiKey']){var _0x401eeb={};_0x401eeb['login']=_0x32533d[_0xb653('0x2e')];_0x401eeb['phone']=_0x6676a5[_0xb653('0x20')];_0x401eeb[_0xb653('0x31')]=_0x32533d[_0xb653('0x20')];_0x401eeb['text']=_0x6676a5[_0xb653('0x23')];_0x401eeb[_0xb653('0x59')]=+new Date();var _0x1c4232='';var _0x512708='';var _0xe05c2f=Object['keys'](_0x401eeb);_0xe05c2f[_0xb653('0x5a')]();for(var _0x1346a6=0x0;_0x1346a6<_0xe05c2f[_0xb653('0x5b')];_0x1346a6++){if(_0x1c4232!=''){_0x1c4232+='&';}_0x1c4232+=_0xe05c2f[_0x1346a6]+'='+encodeURIComponent(_0x401eeb[_0xe05c2f[_0x1346a6]]);_0x512708+=_0x401eeb[_0xe05c2f[_0x1346a6]];}_0x512708+=_0x32533d[_0xb653('0x5c')];_0x512708=_0x109ebb['createHash'](_0xb653('0x5d'))[_0xb653('0x19')](_0x512708)[_0xb653('0x5e')](_0xb653('0x5f'));if(_0x1c4232!==''){_0x1c4232+='&';}_0x1c4232+=_0xb653('0x60')+_0x512708;var _0x48a5e0={'method':_0xb653('0x33'),'uri':_0x32533d[_0xb653('0x50')]+_0xb653('0x61')+_0x1c4232,'json':!![]};return rp(_0x48a5e0)[_0xb653('0x18')](function(_0xab6878){var _0x2bae2b=Object[_0xb653('0x62')](_0xab6878);if(_0xab6878[_0x2bae2b[0x0]][_0xb653('0x28')]&&parseInt(_0xab6878[_0x2bae2b[0x0]]['error'])===0x0){var _0x98a909={'messageId':_0xab6878[_0x2bae2b[0x0]]['id_sms']};if(!_0x32533d[_0xb653('0x38')]){_0x98a909['read']=!![];}return _0x3e242f[_0xb653('0x19')](_0x98a909);}else{return logger[_0xb653('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb653('0x2a'),_0xb653('0x57'),util[_0xb653('0x2b')](_0xab6878['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x76b41e){return logger['error'](_0xb653('0x29'),'afterCreate','csc',util[_0xb653('0x2b')](_0x76b41e,{'showHidden':![],'depth':null}));});}else{logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x57'),_0xb653('0x63'));}break;case _0xb653('0x64'):if(_0x32533d[_0xb653('0x5c')]){var _0x5de0b9={'method':'POST','uri':_0xb653('0x65'),'headers':{'Authorization':_0x32533d[_0xb653('0x5c')]},'body':{'content':_0x6676a5[_0xb653('0x23')],'to':[_0x6676a5[_0xb653('0x20')]],'from':_0x32533d[_0xb653('0x20')],'binary':![],'clientMessageId':_0xb653('0x66'),'charset':'UTF-8'},'json':!![]};rp(_0x5de0b9)[_0xb653('0x18')](function(_0xfaa423){if(!_0xfaa423[_0xb653('0x28')]){var _0x49c65e={'messageId':_0xfaa423['messages'][0x0][_0xb653('0x67')]};if(!_0x32533d[_0xb653('0x38')]){_0x49c65e[_0xb653('0x48')]=!![];}return _0x3e242f['update'](_0x49c65e);}else{return logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x64'),util['inspect'](_0xfaa423['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x50a57b){return logger[_0xb653('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb653('0x2a'),_0xb653('0x64'),util['inspect'](_0x50a57b,{'showHidden':![],'depth':null}));});}else{logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x64'),'Missing\x20parameters:\x20apiKey');}break;case _0xb653('0x68'):if(_0x32533d['username']&&_0x32533d[_0xb653('0x2f')]){var _0x1b9896=util[_0xb653('0x3f')](_0xb653('0x40'),_0x32533d[_0xb653('0x2e')],_0x32533d[_0xb653('0x2f')]);var _0x2ef22d={'method':_0xb653('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x32533d[_0xb653('0x69')]+_0xb653('0x6a'),'body':{'to':[_0x6676a5[_0xb653('0x20')]],'text':_0x6676a5['body'],'from':_0x32533d['phone'],'applicationId':_0x32533d[_0xb653('0x6b')]},'headers':{'Authorization':util[_0xb653('0x3f')](_0xb653('0x42'),new Buffer(_0x1b9896)['toString'](_0xb653('0x44')))},'json':!![]};rp(_0x2ef22d)['then'](function(_0x248275){if(_0x248275['id']){var _0x55b837={'messageId':_0x248275['id']};return _0x3e242f['update'](_0x55b837);}else{logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x68'),util[_0xb653('0x2b')](_0x248275,{'showHidden':![],'depth':null}));}})[_0xb653('0x1a')](function(_0x5b5c04){logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x68'),util[_0xb653('0x2b')](_0x5b5c04,{'showHidden':![],'depth':null}));});}else{logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),'bandwidth',_0xb653('0x4a'));}break;case'intelepeer':if(_0x32533d[_0xb653('0x5c')]){var _0x516ce6={};var _0x48a5e0={'method':_0xb653('0x35'),'uri':_0xb653('0x6c'),'headers':{'Authorization':'Bearer\x20'+_0x32533d['apiKey'],'Content-Type':_0xb653('0x6d')},'body':{'from':_0x32533d[_0xb653('0x20')],'to':_0x6676a5[_0xb653('0x20')],'text':_0x6676a5['body']},'json':!![]};return rp(_0x48a5e0)[_0xb653('0x18')](function(_0x17330a){if(_0x17330a[_0xb653('0x6e')]==0xca){_0x516ce6[_0xb653('0x6f')]=_0x17330a;var _0x4d68c9={'method':'POST','uri':_0xb653('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x32533d['apiKey'],'Content-Type':_0xb653('0x6d')},'body':{'refid':_0x516ce6[_0xb653('0x6f')][_0xb653('0x71')]},'json':!![]};return rp(_0x4d68c9)[_0xb653('0x18')](function(_0x5b536f){_0x516ce6[_0xb653('0x72')]=_0x5b536f;var _0xed12de={'messageId':_0x516ce6[_0xb653('0x6f')][_0xb653('0x71')],'read':!![]};return _0x3e242f[_0xb653('0x19')](_0xed12de);});}else{return logger[_0xb653('0x28')](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x73'),util[_0xb653('0x2b')](_0x17330a,{'showHidden':![],'depth':null}));}})[_0xb653('0x1a')](function(_0xa6be0){return logger[_0xb653('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb653('0x2a'),_0xb653('0x73'),util[_0xb653('0x2b')](_0xa6be0,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xb653('0x29'),_0xb653('0x2a'),_0xb653('0x73'),'Token\x20not\x20received');}break;}}})[_0xb653('0x74')](function(){_0x4d2df9();});}else{_0x4d2df9();}}},'charset':_0xb653('0x75'),'collate':_0xb653('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2cd7e36..e1dc151 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 _0x3104=['body','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3104,0xa3));var _0x4310=function(_0x1b2d49,_0x3f86c0){_0x1b2d49=_0x1b2d49-0x0;var _0x20adf9=_0x3104[_0x1b2d49];return _0x20adf9;};'use strict';var _=require('lodash');var util=require(_0x4310('0x0'));var moment=require(_0x4310('0x1'));var BPromise=require(_0x4310('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4310('0x3'));var db=require(_0x4310('0x4'))['db'];var utils=require(_0x4310('0x5'));var logger=require(_0x4310('0x6'))('rpc');var config=require(_0x4310('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4310('0x8')][_0x4310('0x9')]({'port':0x232a});config[_0x4310('0xa')]=_[_0x4310('0xb')](config[_0x4310('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4310('0xc'))(new Redis(config[_0x4310('0xa')]));require(_0x4310('0xd'))['register'](socket);function respondWithRpcPromise(_0x50a97e,_0x5105bb,_0x11deab){return new BPromise(function(_0x3b79ed,_0x5d52af){return client['request'](_0x50a97e,_0x11deab)[_0x4310('0xe')](function(_0x3aeb3d){logger['info'](_0x4310('0xf'),_0x5105bb,_0x4310('0x10'));logger[_0x4310('0x11')](_0x4310('0x12'),_0x5105bb,_0x4310('0x10'),JSON[_0x4310('0x13')](_0x3aeb3d));if(_0x3aeb3d[_0x4310('0x14')]){if(_0x3aeb3d[_0x4310('0x14')][_0x4310('0x15')]===0x1f4){logger['error'](_0x4310('0xf'),_0x5105bb,_0x3aeb3d[_0x4310('0x14')][_0x4310('0x16')]);return _0x5d52af(_0x3aeb3d[_0x4310('0x14')]['message']);}logger[_0x4310('0x14')](_0x4310('0xf'),_0x5105bb,_0x3aeb3d['error']['message']);return _0x3b79ed(_0x3aeb3d[_0x4310('0x14')][_0x4310('0x16')]);}else{logger[_0x4310('0x17')](_0x4310('0xf'),_0x5105bb,_0x4310('0x10'));_0x3b79ed(_0x3aeb3d[_0x4310('0x18')][_0x4310('0x16')]);}})[_0x4310('0x19')](function(_0x389fc0){logger[_0x4310('0x14')]('SmsMessage,\x20%s,\x20%s',_0x5105bb,_0x389fc0);_0x5d52af(_0x389fc0);});});}exports[_0x4310('0x1a')]=function(_0xa5597d){var _0x7fff6=this;return new Promise(function(_0x1b9f07,_0x1b693e){return db[_0x4310('0x1b')][_0x4310('0x1c')](_0xa5597d[_0x4310('0x1d')],{'raw':_0xa5597d['options']?_0xa5597d[_0x4310('0x1e')][_0x4310('0x1f')]===undefined?!![]:![]:!![]})[_0x4310('0xe')](function(_0xaaa248){logger[_0x4310('0x17')]('CreateSmsMessage',_0xa5597d);logger['debug']('CreateSmsMessage',_0xa5597d,JSON['stringify'](_0xaaa248));_0x1b9f07(_0xaaa248);})[_0x4310('0x19')](function(_0x2ace2f){logger['error'](_0x4310('0x1a'),_0x2ace2f['message'],_0xa5597d);_0x1b693e(_0x7fff6[_0x4310('0x14')](0x1f4,_0x2ace2f[_0x4310('0x16')]));});});}; \ No newline at end of file +var _0xe02b=['../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','options','raw','then','debug','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1c6089,_0x3816e2){var _0x4d97c1=function(_0x3e631b){while(--_0x3e631b){_0x1c6089['push'](_0x1c6089['shift']());}};_0x4d97c1(++_0x3816e2);}(_0xe02b,0xa9));var _0xbe02=function(_0x208bc1,_0x8aed93){_0x208bc1=_0x208bc1-0x0;var _0x44037c=_0xe02b[_0x208bc1];return _0x44037c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbe02('0x0'));var BPromise=require(_0xbe02('0x1'));var rs=require(_0xbe02('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe02('0x3'))['db'];var utils=require(_0xbe02('0x4'));var logger=require(_0xbe02('0x5'))(_0xbe02('0x6'));var config=require(_0xbe02('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe02('0x8')]({'port':0x232a});config[_0xbe02('0x9')]=_[_0xbe02('0xa')](config[_0xbe02('0x9')],{'host':_0xbe02('0xb'),'port':0x18eb});var socket=require(_0xbe02('0xc'))(new Redis(config[_0xbe02('0x9')]));require(_0xbe02('0xd'))[_0xbe02('0xe')](socket);function respondWithRpcPromise(_0x1a5993,_0x3414c2,_0x2521f5){return new BPromise(function(_0x506765,_0x7480f3){return client['request'](_0x1a5993,_0x2521f5)['then'](function(_0x30e43f){logger[_0xbe02('0xf')]('SmsMessage,\x20%s,\x20%s',_0x3414c2,_0xbe02('0x10'));logger['debug'](_0xbe02('0x11'),_0x3414c2,_0xbe02('0x10'),JSON[_0xbe02('0x12')](_0x30e43f));if(_0x30e43f[_0xbe02('0x13')]){if(_0x30e43f[_0xbe02('0x13')]['code']===0x1f4){logger[_0xbe02('0x13')](_0xbe02('0x14'),_0x3414c2,_0x30e43f[_0xbe02('0x13')][_0xbe02('0x15')]);return _0x7480f3(_0x30e43f['error'][_0xbe02('0x15')]);}logger[_0xbe02('0x13')](_0xbe02('0x14'),_0x3414c2,_0x30e43f['error'][_0xbe02('0x15')]);return _0x506765(_0x30e43f[_0xbe02('0x13')][_0xbe02('0x15')]);}else{logger[_0xbe02('0xf')](_0xbe02('0x14'),_0x3414c2,_0xbe02('0x10'));_0x506765(_0x30e43f[_0xbe02('0x16')]['message']);}})[_0xbe02('0x17')](function(_0x2e5dcd){logger[_0xbe02('0x13')](_0xbe02('0x14'),_0x3414c2,_0x2e5dcd);_0x7480f3(_0x2e5dcd);});});}exports[_0xbe02('0x18')]=function(_0x5f079d){var _0x27741a=this;return new Promise(function(_0xa9eee6,_0x5b625b){return db['SmsMessage']['create'](_0x5f079d['body'],{'raw':_0x5f079d['options']?_0x5f079d[_0xbe02('0x19')][_0xbe02('0x1a')]===undefined?!![]:![]:!![]})[_0xbe02('0x1b')](function(_0x148c30){logger['info']('CreateSmsMessage',_0x5f079d);logger[_0xbe02('0x1c')](_0xbe02('0x18'),_0x5f079d,JSON[_0xbe02('0x12')](_0x148c30));_0xa9eee6(_0x148c30);})[_0xbe02('0x17')](function(_0x251dd0){logger[_0xbe02('0x13')](_0xbe02('0x18'),_0x251dd0[_0xbe02('0x15')],_0x5f079d);_0x5b625b(_0x27741a[_0xbe02('0x13')](0x1f4,_0x251dd0[_0xbe02('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ae590c9..99e6d6a 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 _0x9054=['smsMessage:','remove','update','emit','removeListener','length'];(function(_0x518576,_0x1790a1){var _0x1317a2=function(_0x2362c2){while(--_0x2362c2){_0x518576['push'](_0x518576['shift']());}};_0x1317a2(++_0x1790a1);}(_0x9054,0x1b1));var _0x4905=function(_0x50b7dd,_0x26ee78){_0x50b7dd=_0x50b7dd-0x0;var _0x433390=_0x9054[_0x50b7dd];return _0x433390;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x4905('0x0'),_0x4905('0x1')];function createListener(_0x358c8a,_0x148ba8){return function(_0x506164){_0x148ba8[_0x4905('0x2')](_0x358c8a,_0x506164);};}function removeListener(_0x288cd0,_0x9ea9d5){return function(){SmsMessageEvents[_0x4905('0x3')](_0x288cd0,_0x9ea9d5);};}exports['register']=function(_0xed1fb9){for(var _0x288179=0x0,_0x514a3b=events[_0x4905('0x4')];_0x288179<_0x514a3b;_0x288179++){var _0x197883=events[_0x288179];var _0x199ce8=createListener(_0x4905('0x5')+_0x197883,_0xed1fb9);SmsMessageEvents['on'](_0x197883,_0x199ce8);}}; \ No newline at end of file +var _0xd7b1=['remove','emit','register','smsMessage:','./smsMessage.events'];(function(_0x152136,_0x4f14f1){var _0x20df44=function(_0x362877){while(--_0x362877){_0x152136['push'](_0x152136['shift']());}};_0x20df44(++_0x4f14f1);}(_0xd7b1,0x10d));var _0x1d7b=function(_0x5a8756,_0xb886f4){_0x5a8756=_0x5a8756-0x0;var _0x73d83a=_0xd7b1[_0x5a8756];return _0x73d83a;};'use strict';var SmsMessageEvents=require(_0x1d7b('0x0'));var events=['save',_0x1d7b('0x1'),'update'];function createListener(_0x5e7927,_0x45bc97){return function(_0x11b19f){_0x45bc97[_0x1d7b('0x2')](_0x5e7927,_0x11b19f);};}function removeListener(_0x2b0622,_0xba8d5d){return function(){SmsMessageEvents['removeListener'](_0x2b0622,_0xba8d5d);};}exports[_0x1d7b('0x3')]=function(_0x322b1b){for(var _0x26934f=0x0,_0x5b01ef=events['length'];_0x26934f<_0x5b01ef;_0x26934f++){var _0x5e7a4c=events[_0x26934f];var _0x5850d0=createListener(_0x1d7b('0x4')+_0x5e7a4c,_0x322b1b);SmsMessageEvents['on'](_0x5e7a4c,_0x5850d0);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d305262..b82d0c8 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 _0x230c=['addAgents','put','update','delete','destroy','removeAgents','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','addTeams'];(function(_0x3ba57e,_0x2e6810){var _0x5d95cf=function(_0x8017a0){while(--_0x8017a0){_0x3ba57e['push'](_0x3ba57e['shift']());}};_0x5d95cf(++_0x2e6810);}(_0x230c,0x1e3));var _0xc230=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x230c[_0x209941];return _0x1e8729;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc230('0x0'));var timeout=require(_0xc230('0x1'));var express=require('express');var router=express[_0xc230('0x2')]();var fs_extra=require(_0xc230('0x3'));var auth=require(_0xc230('0x4'));var interaction=require(_0xc230('0x5'));var config=require(_0xc230('0x6'));var controller=require(_0xc230('0x7'));router[_0xc230('0x8')]('/',auth[_0xc230('0x9')](),controller[_0xc230('0xa')]);router['get'](_0xc230('0xb'),auth[_0xc230('0x9')](),controller[_0xc230('0xc')]);router[_0xc230('0x8')](_0xc230('0xd'),auth[_0xc230('0x9')](),controller[_0xc230('0xe')]);router[_0xc230('0x8')](_0xc230('0xf'),auth[_0xc230('0x9')](),controller['getMembers']);router['get'](_0xc230('0x10'),auth[_0xc230('0x9')](),controller[_0xc230('0x11')]);router[_0xc230('0x8')](_0xc230('0x12'),auth[_0xc230('0x9')](),controller['getAgents']);router['post']('/',auth[_0xc230('0x9')](),controller['create']);router[_0xc230('0x13')](_0xc230('0x10'),auth[_0xc230('0x9')](),controller[_0xc230('0x14')]);router['post'](_0xc230('0x12'),auth['isAuthenticated'](),controller[_0xc230('0x15')]);router[_0xc230('0x16')]('/:id',auth[_0xc230('0x9')](),controller[_0xc230('0x17')]);router[_0xc230('0x18')](_0xc230('0xd'),auth[_0xc230('0x9')](),controller[_0xc230('0x19')]);router[_0xc230('0x18')](_0xc230('0x10'),auth[_0xc230('0x9')](),controller['removeTeams']);router['delete'](_0xc230('0x12'),auth[_0xc230('0x9')](),controller[_0xc230('0x1a')]);module[_0xc230('0x1b')]=router; \ No newline at end of file +var _0xa115=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents'];(function(_0x4eff18,_0x5d7e11){var _0x32735f=function(_0x139ee0){while(--_0x139ee0){_0x4eff18['push'](_0x4eff18['shift']());}};_0x32735f(++_0x5d7e11);}(_0xa115,0x1f1));var _0x5a11=function(_0x1ad030,_0x7322fb){_0x1ad030=_0x1ad030-0x0;var _0x4366b1=_0xa115[_0x1ad030];return _0x4366b1;};'use strict';var multer=require(_0x5a11('0x0'));var util=require(_0x5a11('0x1'));var path=require(_0x5a11('0x2'));var timeout=require(_0x5a11('0x3'));var express=require(_0x5a11('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5a11('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5a11('0x6'));var controller=require(_0x5a11('0x7'));router['get']('/',auth[_0x5a11('0x8')](),controller[_0x5a11('0x9')]);router[_0x5a11('0xa')](_0x5a11('0xb'),auth[_0x5a11('0x8')](),controller[_0x5a11('0xc')]);router[_0x5a11('0xa')](_0x5a11('0xd'),auth[_0x5a11('0x8')](),controller[_0x5a11('0xe')]);router[_0x5a11('0xa')](_0x5a11('0xf'),auth[_0x5a11('0x8')](),controller[_0x5a11('0x10')]);router['get'](_0x5a11('0x11'),auth[_0x5a11('0x8')](),controller[_0x5a11('0x12')]);router['get'](_0x5a11('0x13'),auth[_0x5a11('0x8')](),controller[_0x5a11('0x14')]);router[_0x5a11('0x15')]('/',auth[_0x5a11('0x8')](),controller[_0x5a11('0x16')]);router[_0x5a11('0x15')](_0x5a11('0x11'),auth[_0x5a11('0x8')](),controller[_0x5a11('0x17')]);router[_0x5a11('0x15')](_0x5a11('0x13'),auth[_0x5a11('0x8')](),controller[_0x5a11('0x18')]);router['put'](_0x5a11('0xd'),auth[_0x5a11('0x8')](),controller[_0x5a11('0x19')]);router[_0x5a11('0x1a')]('/:id',auth[_0x5a11('0x8')](),controller[_0x5a11('0x1b')]);router[_0x5a11('0x1a')](_0x5a11('0x11'),auth[_0x5a11('0x8')](),controller[_0x5a11('0x1c')]);router[_0x5a11('0x1a')](_0x5a11('0x13'),auth[_0x5a11('0x8')](),controller[_0x5a11('0x1d')]);module[_0x5a11('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index b5f7660..f38ebf9 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 _0xe0e4=['INTEGER','ENUM','rrmemory','beepall','sequelize','STRING','name'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0xe0e4,0x15b));var _0x4e0e=function(_0x3c8ac2,_0x40a78e){_0x3c8ac2=_0x3c8ac2-0x0;var _0x5d8ff5=_0xe0e4[_0x3c8ac2];return _0x5d8ff5;};'use strict';var Sequelize=require(_0x4e0e('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e0e('0x1')],'unique':_0x4e0e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4e0e('0x1')]},'timeout':{'type':Sequelize[_0x4e0e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4e0e('0x4')](_0x4e0e('0x5'),_0x4e0e('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x2073=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x45e6fe,_0x2a4c91){var _0x25e7cb=function(_0x5c3f96){while(--_0x5c3f96){_0x45e6fe['push'](_0x45e6fe['shift']());}};_0x25e7cb(++_0x2a4c91);}(_0x2073,0x1dc));var _0x3207=function(_0x24502f,_0x134350){_0x24502f=_0x24502f-0x0;var _0x402fd9=_0x2073[_0x24502f];return _0x402fd9;};'use strict';var Sequelize=require('sequelize');module[_0x3207('0x0')]={'name':{'type':Sequelize[_0x3207('0x1')],'unique':_0x3207('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3207('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3207('0x4')](_0x3207('0x5'),_0x3207('0x6'),_0x3207('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 1130111..5f7c6d2 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 _0xc397=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','then','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','create','body','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','addTeams','Team','Agents','online','voicePause','interface','each','findOrCreate','forEach','emit','userSmsQueue:save','ids','select','tq.TeamId','from','join','user_has_teams','SmsQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end'];(function(_0x192772,_0x100b16){var _0x2b50bd=function(_0x3cbf90){while(--_0x3cbf90){_0x192772['push'](_0x192772['shift']());}};_0x2b50bd(++_0x100b16);}(_0xc397,0x18a));var _0x7c39=function(_0x4d6218,_0x2d60c4){_0x4d6218=_0x4d6218-0x0;var _0x142577=_0xc397[_0x4d6218];return _0x142577;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c39('0x0'));var zipdir=require(_0x7c39('0x1'));var jsonpatch=require(_0x7c39('0x2'));var rp=require(_0x7c39('0x3'));var moment=require(_0x7c39('0x4'));var BPromise=require(_0x7c39('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7c39('0x6'));var sox=require('sox');var csv=require(_0x7c39('0x7'));var ejs=require(_0x7c39('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7c39('0x9'));var crypto=require(_0x7c39('0xa'));var jsforce=require(_0x7c39('0xb'));var deskjs=require(_0x7c39('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7c39('0xd'));var Redis=require(_0x7c39('0xe'));var authService=require(_0x7c39('0xf'));var qs=require(_0x7c39('0x10'));var as=require(_0x7c39('0x11'));var hardwareService=require(_0x7c39('0x12'));var logger=require(_0x7c39('0x13'))(_0x7c39('0x14'));var utils=require(_0x7c39('0x15'));var config=require(_0x7c39('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c39('0x17'))['db'];config[_0x7c39('0x18')]=_[_0x7c39('0x19')](config[_0x7c39('0x18')],{'host':_0x7c39('0x1a'),'port':0x18eb});var socket=require(_0x7c39('0x1b'))(new Redis(config[_0x7c39('0x18')]));require(_0x7c39('0x1c'))['register'](socket);function respondWithStatusCode(_0x5a1ba5,_0x4ea838){_0x4ea838=_0x4ea838||0xcc;return function(_0x3e31b6){if(_0x3e31b6){return _0x5a1ba5[_0x7c39('0x1d')](_0x4ea838);}return _0x5a1ba5[_0x7c39('0x1e')](_0x4ea838)[_0x7c39('0x1f')]();};}function respondWithResult(_0x3769e9,_0x543a7d){_0x543a7d=_0x543a7d||0xc8;return function(_0x5bcdeb){if(_0x5bcdeb){return _0x3769e9['status'](_0x543a7d)[_0x7c39('0x20')](_0x5bcdeb);}};}function respondWithFilteredResult(_0x9bf6fd,_0x12267e){return function(_0x4c94f0){if(_0x4c94f0){var _0x30dbe1=typeof _0x12267e[_0x7c39('0x21')]==='undefined'&&typeof _0x12267e[_0x7c39('0x22')]===_0x7c39('0x23');var _0x473090=_0x4c94f0['count'];var _0x5714a1=_0x30dbe1?0x0:_0x12267e['offset'];var _0x425a5f=_0x30dbe1?_0x4c94f0[_0x7c39('0x24')]:_0x12267e[_0x7c39('0x21')]+_0x12267e[_0x7c39('0x22')];var _0x568dd1;if(_0x425a5f>=_0x473090){_0x425a5f=_0x473090;_0x568dd1=0xc8;}else{_0x568dd1=0xce;}_0x9bf6fd['status'](_0x568dd1);return _0x9bf6fd[_0x7c39('0x25')](_0x7c39('0x26'),_0x5714a1+'-'+_0x425a5f+'/'+_0x473090)['json'](_0x4c94f0);}return null;};}function patchUpdates(_0x5f2642){return function(_0x5d2f60){try{jsonpatch[_0x7c39('0x27')](_0x5d2f60,_0x5f2642,!![]);}catch(_0x59374f){return BPromise[_0x7c39('0x28')](_0x59374f);}return _0x5d2f60[_0x7c39('0x29')]();};}function saveUpdates(_0x2f288d,_0x413834){return function(_0xfff6ee){if(_0xfff6ee){return _0xfff6ee[_0x7c39('0x2a')](_0x2f288d)['then'](function(_0x5056d5){return _0x5056d5;});}return null;};}function removeEntity(_0x5ef58c,_0x2261c3){return function(_0x17c679){if(_0x17c679){return _0x17c679[_0x7c39('0x2b')]()['then'](function(){var _0x5b6b15=_0x17c679['get']({'plain':!![]});var _0x3bb2a5='SmsQueues';return db[_0x7c39('0x2c')][_0x7c39('0x2b')]({'where':{'type':_0x3bb2a5,'resourceId':_0x5b6b15['id']}})['then'](function(){return _0x17c679;});})[_0x7c39('0x2d')](function(){_0x5ef58c['status'](0xcc)[_0x7c39('0x1f')]();});}};}function handleEntityNotFound(_0x45c4ad,_0x3a99ee){return function(_0x477ebc){if(!_0x477ebc){_0x45c4ad[_0x7c39('0x1d')](0x194);}return _0x477ebc;};}function handleError(_0x376c52,_0x20ba2a){_0x20ba2a=_0x20ba2a||0x1f4;return function(_0x57fec5){logger[_0x7c39('0x2e')](_0x57fec5[_0x7c39('0x2f')]);if(_0x57fec5[_0x7c39('0x30')]){delete _0x57fec5[_0x7c39('0x30')];}_0x376c52['status'](_0x20ba2a)[_0x7c39('0x31')](_0x57fec5);};}exports[_0x7c39('0x32')]=function(_0x121d5a,_0x7db44b){var _0x2b881f={},_0x25d6ec={},_0x282d7f={'count':0x0,'rows':[]};var _0x2e3a43=_[_0x7c39('0x33')](db[_0x7c39('0x34')][_0x7c39('0x35')],function(_0xe5b32c){return{'name':_0xe5b32c[_0x7c39('0x36')],'type':_0xe5b32c[_0x7c39('0x37')][_0x7c39('0x38')]};});_0x25d6ec[_0x7c39('0x39')]=_['map'](_0x2e3a43,_0x7c39('0x30'));_0x25d6ec[_0x7c39('0x3a')]=_[_0x7c39('0x3b')](_0x121d5a[_0x7c39('0x3a')]);_0x25d6ec['filters']=_[_0x7c39('0x3c')](_0x25d6ec['model'],_0x25d6ec[_0x7c39('0x3a')]);_0x2b881f[_0x7c39('0x3d')]=_[_0x7c39('0x3c')](_0x25d6ec[_0x7c39('0x39')],qs['fields'](_0x121d5a[_0x7c39('0x3a')]['fields']));_0x2b881f[_0x7c39('0x3d')]=_0x2b881f[_0x7c39('0x3d')]['length']?_0x2b881f[_0x7c39('0x3d')]:_0x25d6ec['model'];if(!_0x121d5a[_0x7c39('0x3a')][_0x7c39('0x3e')](_0x7c39('0x3f'))){_0x2b881f['limit']=qs[_0x7c39('0x22')](_0x121d5a[_0x7c39('0x3a')][_0x7c39('0x22')]);_0x2b881f[_0x7c39('0x21')]=qs['offset'](_0x121d5a[_0x7c39('0x3a')]['offset']);}_0x2b881f[_0x7c39('0x40')]=qs[_0x7c39('0x41')](_0x121d5a[_0x7c39('0x3a')][_0x7c39('0x41')]);_0x2b881f[_0x7c39('0x42')]=qs[_0x7c39('0x43')](_[_0x7c39('0x44')](_0x121d5a[_0x7c39('0x3a')],_0x25d6ec['filters']),_0x2e3a43);if(_0x121d5a[_0x7c39('0x3a')][_0x7c39('0x45')]){_0x2b881f[_0x7c39('0x42')]=_[_0x7c39('0x46')](_0x2b881f[_0x7c39('0x42')],{'$or':_[_0x7c39('0x33')](_0x2e3a43,function(_0x4ce7f4){if(_0x4ce7f4[_0x7c39('0x37')]!==_0x7c39('0x47')){var _0x533a6b={};_0x533a6b[_0x4ce7f4[_0x7c39('0x30')]]={'$like':'%'+_0x121d5a['query'][_0x7c39('0x45')]+'%'};return _0x533a6b;}})});}_0x2b881f=_[_0x7c39('0x46')]({},_0x2b881f,_0x121d5a[_0x7c39('0x48')]);var _0x3317c1={'where':_0x2b881f[_0x7c39('0x42')]};return db[_0x7c39('0x34')]['count'](_0x3317c1)[_0x7c39('0x2d')](function(_0x326337){_0x282d7f[_0x7c39('0x24')]=_0x326337;if(_0x121d5a[_0x7c39('0x3a')][_0x7c39('0x49')]){_0x2b881f[_0x7c39('0x4a')]=[{'all':!![]}];}return db[_0x7c39('0x34')][_0x7c39('0x4b')](_0x2b881f);})[_0x7c39('0x2d')](function(_0x1d8ac4){_0x282d7f[_0x7c39('0x4c')]=_0x1d8ac4;return _0x282d7f;})['then'](respondWithFilteredResult(_0x7db44b,_0x2b881f))[_0x7c39('0x4d')](handleError(_0x7db44b,null));};exports[_0x7c39('0x4e')]=function(_0x3b9ec7,_0x2af464){var _0x3c6d86={'raw':!![],'where':{'id':_0x3b9ec7[_0x7c39('0x4f')]['id']}},_0x179590={};_0x179590[_0x7c39('0x39')]=_[_0x7c39('0x3b')](db[_0x7c39('0x34')][_0x7c39('0x35')]);_0x179590[_0x7c39('0x3a')]=_[_0x7c39('0x3b')](_0x3b9ec7[_0x7c39('0x3a')]);_0x179590[_0x7c39('0x43')]=_[_0x7c39('0x3c')](_0x179590[_0x7c39('0x39')],_0x179590[_0x7c39('0x3a')]);_0x3c6d86[_0x7c39('0x3d')]=_[_0x7c39('0x3c')](_0x179590['model'],qs[_0x7c39('0x50')](_0x3b9ec7[_0x7c39('0x3a')][_0x7c39('0x50')]));_0x3c6d86[_0x7c39('0x3d')]=_0x3c6d86['attributes'][_0x7c39('0x51')]?_0x3c6d86['attributes']:_0x179590[_0x7c39('0x39')];if(_0x3b9ec7['query'][_0x7c39('0x49')]){_0x3c6d86['include']=[{'all':!![]}];}_0x3c6d86=_[_0x7c39('0x46')]({},_0x3c6d86,_0x3b9ec7[_0x7c39('0x48')]);return db[_0x7c39('0x34')]['find'](_0x3c6d86)['then'](handleEntityNotFound(_0x2af464,null))[_0x7c39('0x2d')](respondWithResult(_0x2af464,null))[_0x7c39('0x4d')](handleError(_0x2af464,null));};exports[_0x7c39('0x52')]=function(_0x54965e,_0x5519b3){return db[_0x7c39('0x34')][_0x7c39('0x52')](_0x54965e[_0x7c39('0x53')],{})[_0x7c39('0x2d')](function(_0x2b2d32){var _0xc711ca=_0x54965e['user'][_0x7c39('0x54')]({'plain':!![]});if(!_0xc711ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc711ca['role']==='user'){var _0x147d91=_0x2b2d32[_0x7c39('0x54')]({'plain':!![]});var _0x48136f='SmsQueues';return db[_0x7c39('0x55')][_0x7c39('0x56')]({'where':{'name':_0x48136f,'userProfileId':_0xc711ca['userProfileId']},'raw':!![]})[_0x7c39('0x2d')](function(_0x41a36f){if(_0x41a36f&&_0x41a36f[_0x7c39('0x57')]===0x0){return db[_0x7c39('0x2c')][_0x7c39('0x52')]({'name':_0x147d91[_0x7c39('0x30')],'resourceId':_0x147d91['id'],'type':_0x41a36f[_0x7c39('0x30')],'sectionId':_0x41a36f['id']},{})[_0x7c39('0x2d')](function(){return _0x2b2d32;});}else{return _0x2b2d32;}})[_0x7c39('0x4d')](function(_0x22b63b){logger[_0x7c39('0x2e')](_0x7c39('0x58'),_0x22b63b);throw _0x22b63b;});}return _0x2b2d32;})[_0x7c39('0x2d')](respondWithResult(_0x5519b3,0xc9))['catch'](handleError(_0x5519b3,null));};exports[_0x7c39('0x2a')]=function(_0x3728dc,_0x45fa40){if(_0x3728dc[_0x7c39('0x53')]['id']){delete _0x3728dc[_0x7c39('0x53')]['id'];}return db[_0x7c39('0x34')][_0x7c39('0x56')]({'where':{'id':_0x3728dc[_0x7c39('0x4f')]['id']}})['then'](handleEntityNotFound(_0x45fa40,null))[_0x7c39('0x2d')](saveUpdates(_0x3728dc[_0x7c39('0x53')],null))['then'](respondWithResult(_0x45fa40,null))[_0x7c39('0x4d')](handleError(_0x45fa40,null));};exports['destroy']=function(_0x87eda1,_0x3f0b58){return db[_0x7c39('0x34')][_0x7c39('0x56')]({'where':{'id':_0x87eda1[_0x7c39('0x4f')]['id']}})[_0x7c39('0x2d')](handleEntityNotFound(_0x3f0b58,null))[_0x7c39('0x2d')](removeEntity(_0x3f0b58,null))[_0x7c39('0x4d')](handleError(_0x3f0b58,null));};exports[_0x7c39('0x59')]=function(_0x516cd1,_0x11306d){return db[_0x7c39('0x34')][_0x7c39('0x59')]()[_0x7c39('0x2d')](respondWithResult(_0x11306d,null))[_0x7c39('0x4d')](handleError(_0x11306d,null));};exports[_0x7c39('0x5a')]=function(_0x107da9,_0x433608,_0x3d9e09){var _0x1690b4={'raw':!![],'where':{}},_0x184e37={},_0x4f58ff;return db[_0x7c39('0x34')][_0x7c39('0x5b')]({'where':{'id':_0x107da9['params']['id']}})[_0x7c39('0x2d')](handleEntityNotFound(_0x433608,null))[_0x7c39('0x2d')](function(_0x13241d){if(_0x13241d){_0x4f58ff=_0x13241d[_0x7c39('0x54')]({'plain':!![]});_0x184e37[_0x7c39('0x39')]=_['keys'](db['UserSmsQueue']['rawAttributes']);_0x184e37[_0x7c39('0x3a')]=_[_0x7c39('0x3b')](_0x107da9[_0x7c39('0x3a')]);_0x184e37[_0x7c39('0x43')]=_['intersection'](_0x184e37['model'],_0x184e37[_0x7c39('0x3a')]);_0x1690b4['attributes']=_[_0x7c39('0x3c')](_0x184e37['model'],qs[_0x7c39('0x50')](_0x107da9[_0x7c39('0x3a')]['fields']));_0x1690b4[_0x7c39('0x3d')]=_0x1690b4[_0x7c39('0x3d')]['length']?_0x1690b4[_0x7c39('0x3d')]:_0x184e37[_0x7c39('0x39')];if(!_0x107da9[_0x7c39('0x3a')][_0x7c39('0x3e')]('nolimit')){_0x1690b4['limit']=qs[_0x7c39('0x22')](_0x107da9[_0x7c39('0x3a')][_0x7c39('0x22')]);_0x1690b4[_0x7c39('0x21')]=qs[_0x7c39('0x21')](_0x107da9[_0x7c39('0x3a')][_0x7c39('0x21')]);}_0x1690b4[_0x7c39('0x40')]=qs[_0x7c39('0x41')](_0x107da9[_0x7c39('0x3a')][_0x7c39('0x41')]);_0x1690b4['where']=qs[_0x7c39('0x43')](_[_0x7c39('0x44')](_0x107da9[_0x7c39('0x3a')],_0x184e37['filters']));_0x1690b4[_0x7c39('0x42')]['SmsQueueId']=_0x13241d['id'];if(_0x107da9[_0x7c39('0x3a')][_0x7c39('0x45')]){_0x1690b4[_0x7c39('0x42')]=_[_0x7c39('0x46')](_0x1690b4[_0x7c39('0x42')],{'$or':_[_0x7c39('0x33')](_0x1690b4[_0x7c39('0x3d')],function(_0x105bf3){var _0x450359={};_0x450359[_0x105bf3]={'$like':'%'+_0x107da9['query'][_0x7c39('0x45')]+'%'};return _0x450359;})});}_0x1690b4=_['merge']({},_0x1690b4,_0x107da9[_0x7c39('0x48')]);return db[_0x7c39('0x5c')][_0x7c39('0x4b')](_0x1690b4);}})['then'](function(_0x48f966){if(_0x48f966){return db[_0x7c39('0x5d')][_0x7c39('0x5e')]({'where':{'id':_[_0x7c39('0x33')](_0x48f966,_0x7c39('0x5f')),'role':_0x7c39('0x60')},'attributes':['id','name','smsPause',_0x7c39('0x61'),_0x7c39('0x62')]});}})[_0x7c39('0x2d')](function(_0x5b9d0f){if(_0x5b9d0f){return{'count':_0x5b9d0f[_0x7c39('0x24')],'rows':_[_0x7c39('0x33')](_0x5b9d0f[_0x7c39('0x4c')],function(_0x566826){return{'membername':_0x566826[_0x7c39('0x30')],'UserId':_0x566826['id'],'queue_name':_0x4f58ff['name'],'SmsQueueId':_0x4f58ff['id'],'interface':util[_0x7c39('0x63')](_0x7c39('0x64'),_0x7c39('0x65'),_0x566826[_0x7c39('0x30')]),'penalty':0x0,'paused':_0x566826[_0x7c39('0x66')],'createdAt':_0x566826[_0x7c39('0x62')],'updatedAt':_0x566826[_0x7c39('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7c39('0x2d')](respondWithFilteredResult(_0x433608,_0x1690b4))[_0x7c39('0x4d')](handleError(_0x433608,null));};exports[_0x7c39('0x67')]=function(_0x35233c,_0x3f72c9,_0x12de2f){var _0x33ba1c={};var _0x26e619={};var _0x41663f;var _0x5664d7;return db[_0x7c39('0x34')][_0x7c39('0x5b')]({'where':{'id':_0x35233c[_0x7c39('0x4f')]['id']}})[_0x7c39('0x2d')](handleEntityNotFound(_0x3f72c9,null))[_0x7c39('0x2d')](function(_0x4e1dd0){if(_0x4e1dd0){_0x41663f=_0x4e1dd0;_0x26e619[_0x7c39('0x39')]=_['keys'](db['Team'][_0x7c39('0x35')]);_0x26e619[_0x7c39('0x3a')]=_['keys'](_0x35233c['query']);_0x26e619['filters']=_[_0x7c39('0x3c')](_0x26e619['model'],_0x26e619['query']);_0x33ba1c[_0x7c39('0x3d')]=_[_0x7c39('0x3c')](_0x26e619[_0x7c39('0x39')],qs[_0x7c39('0x50')](_0x35233c[_0x7c39('0x3a')][_0x7c39('0x50')]));_0x33ba1c[_0x7c39('0x3d')]=_0x33ba1c['attributes'][_0x7c39('0x51')]?_0x33ba1c[_0x7c39('0x3d')]:_0x26e619[_0x7c39('0x39')];_0x33ba1c[_0x7c39('0x40')]=qs[_0x7c39('0x41')](_0x35233c['query'][_0x7c39('0x41')]);_0x33ba1c['where']=qs['filters'](_[_0x7c39('0x44')](_0x35233c[_0x7c39('0x3a')],_0x26e619['filters']));if(_0x35233c[_0x7c39('0x3a')][_0x7c39('0x45')]){_0x33ba1c['where']=_['merge'](_0x33ba1c[_0x7c39('0x42')],{'$or':_[_0x7c39('0x33')](_0x33ba1c[_0x7c39('0x3d')],function(_0x11212e){var _0x2261d4={};_0x2261d4[_0x11212e]={'$like':'%'+_0x35233c['query'][_0x7c39('0x45')]+'%'};return _0x2261d4;})});}_0x33ba1c=_[_0x7c39('0x46')]({},_0x33ba1c,_0x35233c[_0x7c39('0x48')]);return _0x41663f['getTeams'](_0x33ba1c);}})[_0x7c39('0x2d')](function(_0x29996d){if(_0x29996d){_0x5664d7=_0x29996d[_0x7c39('0x51')];if(!_0x35233c[_0x7c39('0x3a')][_0x7c39('0x3e')](_0x7c39('0x3f'))){_0x33ba1c[_0x7c39('0x22')]=qs[_0x7c39('0x22')](_0x35233c[_0x7c39('0x3a')]['limit']);_0x33ba1c[_0x7c39('0x21')]=qs[_0x7c39('0x21')](_0x35233c[_0x7c39('0x3a')]['offset']);}return _0x41663f[_0x7c39('0x67')](_0x33ba1c);}})['then'](function(_0x379f7a){if(_0x379f7a){return _0x379f7a?{'count':_0x5664d7,'rows':_0x379f7a}:null;}})[_0x7c39('0x2d')](respondWithResult(_0x3f72c9,null))['catch'](handleError(_0x3f72c9,null));};exports[_0x7c39('0x68')]=function(_0x40299a,_0x11ddc8,_0x2ca917){var _0x31d6de=_0x40299a[_0x7c39('0x53')]['ids'];return db[_0x7c39('0x69')][_0x7c39('0x4b')]({'where':{'id':_0x31d6de},'attributes':['id'],'include':[{'model':db[_0x7c39('0x5d')],'as':_0x7c39('0x6a'),'attributes':['id',_0x7c39('0x30'),_0x7c39('0x6b'),_0x7c39('0x6c'),_0x7c39('0x6d')],'raw':!![]}]})[_0x7c39('0x2d')](function(_0x1cde67){if(_0x1cde67){var _0x5c83d6=_['flatMap'](_0x1cde67,function(_0x52fd69){var _0x54ccf9=_0x52fd69['get']({'plain':!![]});return _0x54ccf9['Agents'];});return db['SmsQueue'][_0x7c39('0x56')]({'where':{'id':_0x40299a['params']['id']}})[_0x7c39('0x2d')](function(_0x3e2020){return db['sequelize']['transaction'](function(_0x5799da){return _0x3e2020[_0x7c39('0x68')](_0x31d6de,{'transaction':_0x5799da})[_0x7c39('0x2d')](function(){return BPromise[_0x7c39('0x6e')](_0x5c83d6,function(_0x46d1e9){return db[_0x7c39('0x5c')][_0x7c39('0x6f')]({'where':{'UserId':_0x46d1e9['id'],'SmsQueueId':_0x40299a[_0x7c39('0x4f')]['id']},'transaction':_0x5799da});});})[_0x7c39('0x2d')](function(){_0x5c83d6[_0x7c39('0x70')](function(_0x403cfa){socket[_0x7c39('0x71')](_0x7c39('0x72'),{'UserId':_0x403cfa['id'],'SmsQueueId':_0x3e2020['id']});});});});});}})[_0x7c39('0x2d')](respondWithStatusCode(_0x11ddc8,null))[_0x7c39('0x4d')](handleError(_0x11ddc8,null));};exports['removeTeams']=function(_0x4d1050,_0x4cf588,_0x1d8bb3){return db[_0x7c39('0x69')][_0x7c39('0x4b')]({'where':{'id':_0x4d1050[_0x7c39('0x3a')][_0x7c39('0x73')]},'attributes':['id'],'include':[{'model':db[_0x7c39('0x5d')],'as':_0x7c39('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x7c39('0x2d')](handleEntityNotFound(_0x4cf588,null))['then'](function(_0xf90261){var _0x4a4a4a=_[_0x7c39('0x33')](_0xf90261,'id');var _0x5e0deb=[];var _0x5e4275=[];var _0x480ae2=squel[_0x7c39('0x74')]();_0x480ae2['field'](_0x7c39('0x75'))[_0x7c39('0x76')]('team_has_sms_queues','tq')[_0x7c39('0x77')](_0x7c39('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7c39('0x42')](_0x7c39('0x79'),_0x4d1050[_0x7c39('0x4f')]['id']);for(var _0x5959c4=0x0;_0x5959c4<_0xf90261[_0x7c39('0x51')];_0x5959c4+=0x1){let _0x469984=_0xf90261[_0x5959c4];for(var _0x24bd33=0x0;_0x24bd33<_0x469984[_0x7c39('0x6a')][_0x7c39('0x51')];_0x24bd33+=0x1){let _0x38a751=_0x469984[_0x7c39('0x6a')][_0x24bd33];var _0x165758=_0x480ae2[_0x7c39('0x7a')]();_0x165758[_0x7c39('0x42')]('ut.UserId\x20=\x20?',_0x38a751['id']);_0x5e4275[_0x7c39('0x7b')](db['sequelize'][_0x7c39('0x3a')](_0x165758['toString'](),{'type':db[_0x7c39('0x7c')][_0x7c39('0x7d')][_0x7c39('0x7e')]})[_0x7c39('0x2d')](function(_0x522c8e){if(_0x522c8e[_0x7c39('0x51')]===0x1){return _0x38a751['id'];}else{var _0x4a608c=_[_0x7c39('0x7f')](_[_0x7c39('0x33')](_0x522c8e,_0x7c39('0x80')),function(_0x575a3a){return _[_0x7c39('0x81')](_0x4a4a4a,_0x575a3a);});if(_0x4a608c){return _0x38a751['id'];}}}));}}return BPromise[_0x7c39('0x82')](_0x5e4275)[_0x7c39('0x2d')](function(_0x45fbf0){_0x5e0deb=_(_0x5e0deb)[_0x7c39('0x83')](_0x45fbf0)[_0x7c39('0x84')]()[_0x7c39('0x85')]();return db[_0x7c39('0x34')][_0x7c39('0x56')]({'where':{'id':_0x4d1050[_0x7c39('0x4f')]['id']}})['then'](function(_0x54a84e){return db['sequelize']['transaction'](function(_0x3aeaa8){return _0x54a84e[_0x7c39('0x86')](_0x4d1050['query']['ids'],{'transaction':_0x3aeaa8})[_0x7c39('0x2d')](function(){if(!_[_0x7c39('0x87')](_0x5e0deb)){return _0x54a84e[_0x7c39('0x88')](_0x5e0deb,{'transaction':_0x3aeaa8});}})[_0x7c39('0x2d')](function(){_0x5e0deb['forEach'](function(_0x4948b8){socket[_0x7c39('0x71')]('userSmsQueue:remove',{'UserId':_0x4948b8,'SmsQueueId':_0x54a84e['id']});});});});});});})['then'](respondWithStatusCode(_0x4cf588,null))['catch'](handleError(_0x4cf588,null));};exports[_0x7c39('0x89')]=function(_0xae1b36,_0x2416e0,_0x1ebf49){return db[_0x7c39('0x34')][_0x7c39('0x56')]({'where':{'id':_0xae1b36[_0x7c39('0x4f')]['id']}})[_0x7c39('0x2d')](handleEntityNotFound(_0x2416e0,null))['then'](function(_0x13382b){if(_0x13382b){return _0x13382b[_0x7c39('0x89')](_0xae1b36[_0x7c39('0x53')][_0x7c39('0x73')],_[_0x7c39('0x8a')](_0xae1b36[_0x7c39('0x53')],[_0x7c39('0x73'),'id'])||{})[_0x7c39('0x8b')](function(_0x310653){for(var _0x1479cf=0x0;_0x1479cf<_0xae1b36[_0x7c39('0x53')][_0x7c39('0x73')][_0x7c39('0x51')];_0x1479cf+=0x1){socket['emit'](_0x7c39('0x72'),{'UserId':Number(_0xae1b36[_0x7c39('0x53')][_0x7c39('0x73')][_0x1479cf]),'SmsQueueId':Number(_0xae1b36[_0x7c39('0x4f')]['id'])});}return _0x310653;});}})['then'](respondWithResult(_0x2416e0,null))[_0x7c39('0x4d')](handleError(_0x2416e0,null));};exports['removeAgents']=function(_0x197845,_0x4312ae,_0x3c91b6){return db[_0x7c39('0x34')]['find']({'where':{'id':_0x197845[_0x7c39('0x4f')]['id']}})[_0x7c39('0x2d')](handleEntityNotFound(_0x4312ae,null))['then'](function(_0x4ac0ae){if(_0x4ac0ae){return _0x4ac0ae[_0x7c39('0x88')](_0x197845[_0x7c39('0x3a')][_0x7c39('0x73')])[_0x7c39('0x2d')](function(){if(_[_0x7c39('0x8c')](_0x197845[_0x7c39('0x3a')][_0x7c39('0x73')])){for(var _0x3b147a=0x0;_0x3b147a<_0x197845[_0x7c39('0x3a')][_0x7c39('0x73')][_0x7c39('0x51')];_0x3b147a+=0x1){socket[_0x7c39('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x197845[_0x7c39('0x3a')]['ids'][_0x3b147a]),'SmsQueueId':Number(_0x197845[_0x7c39('0x4f')]['id'])});}}else{socket[_0x7c39('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x197845[_0x7c39('0x3a')]['ids']),'SmsQueueId':Number(_0x197845[_0x7c39('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x4312ae,null))[_0x7c39('0x4d')](handleError(_0x4312ae,null));};exports[_0x7c39('0x8d')]=function(_0x195847,_0x2ecad8,_0x349c41){var _0x5feeb={};var _0x48452d={};var _0x4b4bef;var _0x26e775;return db['SmsQueue']['findOne']({'where':{'id':_0x195847[_0x7c39('0x4f')]['id']}})[_0x7c39('0x2d')](handleEntityNotFound(_0x2ecad8,null))[_0x7c39('0x2d')](function(_0x349946){if(_0x349946){_0x4b4bef=_0x349946;_0x48452d['model']=_[_0x7c39('0x3b')](db[_0x7c39('0x5d')][_0x7c39('0x35')]);_0x48452d[_0x7c39('0x3a')]=_[_0x7c39('0x3b')](_0x195847[_0x7c39('0x3a')]);_0x48452d[_0x7c39('0x43')]=_[_0x7c39('0x3c')](_0x48452d['model'],_0x48452d[_0x7c39('0x3a')]);_0x5feeb['attributes']=_[_0x7c39('0x3c')](_0x48452d[_0x7c39('0x39')],qs[_0x7c39('0x50')](_0x195847['query'][_0x7c39('0x50')]));_0x5feeb[_0x7c39('0x3d')]=_0x5feeb[_0x7c39('0x3d')][_0x7c39('0x51')]?_0x5feeb['attributes']:_0x48452d['model'];_0x5feeb[_0x7c39('0x40')]=qs[_0x7c39('0x41')](_0x195847[_0x7c39('0x3a')]['sort']);_0x5feeb[_0x7c39('0x42')]=qs[_0x7c39('0x43')](_[_0x7c39('0x44')](_0x195847['query'],_0x48452d[_0x7c39('0x43')]));if(_0x195847[_0x7c39('0x3a')]['filter']){_0x5feeb[_0x7c39('0x42')]=_[_0x7c39('0x46')](_0x5feeb[_0x7c39('0x42')],{'$or':_['map'](_0x5feeb[_0x7c39('0x3d')],function(_0x426947){var _0x5ba900={};_0x5ba900[_0x426947]={'$like':'%'+_0x195847[_0x7c39('0x3a')][_0x7c39('0x45')]+'%'};return _0x5ba900;})});}_0x5feeb=_[_0x7c39('0x46')]({},_0x5feeb,_0x195847['options']);return _0x4b4bef[_0x7c39('0x8d')](_0x5feeb);}})[_0x7c39('0x2d')](function(_0x86981){if(_0x86981){_0x26e775=_0x86981[_0x7c39('0x51')];if(!_0x195847[_0x7c39('0x3a')][_0x7c39('0x3e')](_0x7c39('0x3f'))){_0x5feeb[_0x7c39('0x22')]=qs['limit'](_0x195847[_0x7c39('0x3a')]['limit']);_0x5feeb['offset']=qs[_0x7c39('0x21')](_0x195847[_0x7c39('0x3a')][_0x7c39('0x21')]);}return _0x4b4bef[_0x7c39('0x8d')](_0x5feeb);}})[_0x7c39('0x2d')](function(_0x2f3c3d){if(_0x2f3c3d){return _0x2f3c3d?{'count':_0x26e775,'rows':_0x2f3c3d}:null;}})['then'](respondWithResult(_0x2ecad8,null))[_0x7c39('0x4d')](handleError(_0x2ecad8,null));}; \ No newline at end of file +var _0x2256=['key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueue','includeAll','include','findAll','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','describe','findOne','UserSmsQueue','nolimit','SmsQueueId','User','UserId','smsPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','addTeams','ids','Agents','online','interface','sequelize','transaction','each','findOrCreate','emit','removeTeams','Team','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./smsQueue.socket','register','status','end','undefined','limit','count','offset','set','apply','reject','update','then','get','SmsQueues','UserProfileResource','destroy','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x42db3e,_0x4e0e33){var _0x1c86e2=function(_0xf701de){while(--_0xf701de){_0x42db3e['push'](_0x42db3e['shift']());}};_0x1c86e2(++_0x4e0e33);}(_0x2256,0x166));var _0x6225=function(_0x1f9673,_0x19ed60){_0x1f9673=_0x1f9673-0x0;var _0x48f526=_0x2256[_0x1f9673];return _0x48f526;};'use strict';var emlformat=require(_0x6225('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6225('0x1'));var jsonpatch=require(_0x6225('0x2'));var rp=require(_0x6225('0x3'));var moment=require('moment');var BPromise=require(_0x6225('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6225('0x5'));var sox=require(_0x6225('0x6'));var csv=require(_0x6225('0x7'));var ejs=require(_0x6225('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6225('0x9'));var jsforce=require(_0x6225('0xa'));var deskjs=require(_0x6225('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6225('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6225('0xd'));var as=require(_0x6225('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6225('0xf'))(_0x6225('0x10'));var utils=require(_0x6225('0x11'));var config=require(_0x6225('0x12'));var licenseUtil=require(_0x6225('0x13'));var db=require('../../mysqldb')['db'];config[_0x6225('0x14')]=_[_0x6225('0x15')](config[_0x6225('0x14')],{'host':_0x6225('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6225('0x14')]));require(_0x6225('0x17'))[_0x6225('0x18')](socket);function respondWithStatusCode(_0x1795d3,_0x3d386f){_0x3d386f=_0x3d386f||0xcc;return function(_0x3214c0){if(_0x3214c0){return _0x1795d3['sendStatus'](_0x3d386f);}return _0x1795d3[_0x6225('0x19')](_0x3d386f)[_0x6225('0x1a')]();};}function respondWithResult(_0x230593,_0x33d11b){_0x33d11b=_0x33d11b||0xc8;return function(_0x2f1389){if(_0x2f1389){return _0x230593[_0x6225('0x19')](_0x33d11b)['json'](_0x2f1389);}};}function respondWithFilteredResult(_0x550882,_0x14875c){return function(_0x3a53ba){if(_0x3a53ba){var _0x1518a9=typeof _0x14875c['offset']===_0x6225('0x1b')&&typeof _0x14875c[_0x6225('0x1c')]===_0x6225('0x1b');var _0x1dae64=_0x3a53ba[_0x6225('0x1d')];var _0x17aebb=_0x1518a9?0x0:_0x14875c[_0x6225('0x1e')];var _0x47f831=_0x1518a9?_0x3a53ba[_0x6225('0x1d')]:_0x14875c[_0x6225('0x1e')]+_0x14875c['limit'];var _0x181cb0;if(_0x47f831>=_0x1dae64){_0x47f831=_0x1dae64;_0x181cb0=0xc8;}else{_0x181cb0=0xce;}_0x550882[_0x6225('0x19')](_0x181cb0);return _0x550882[_0x6225('0x1f')]('Content-Range',_0x17aebb+'-'+_0x47f831+'/'+_0x1dae64)['json'](_0x3a53ba);}return null;};}function patchUpdates(_0x1d214a){return function(_0x4b3760){try{jsonpatch[_0x6225('0x20')](_0x4b3760,_0x1d214a,!![]);}catch(_0x5069d6){return BPromise[_0x6225('0x21')](_0x5069d6);}return _0x4b3760['save']();};}function saveUpdates(_0x5a5137,_0x4d3eef){return function(_0x33d71a){if(_0x33d71a){return _0x33d71a[_0x6225('0x22')](_0x5a5137)[_0x6225('0x23')](function(_0x4568c1){return _0x4568c1;});}return null;};}function removeEntity(_0x382194,_0x47abf2){return function(_0x7a4001){if(_0x7a4001){return _0x7a4001['destroy']()[_0x6225('0x23')](function(){var _0x2e1c0e=_0x7a4001[_0x6225('0x24')]({'plain':!![]});var _0xcbaebd=_0x6225('0x25');return db[_0x6225('0x26')][_0x6225('0x27')]({'where':{'type':_0xcbaebd,'resourceId':_0x2e1c0e['id']}})['then'](function(){return _0x7a4001;});})[_0x6225('0x23')](function(){_0x382194[_0x6225('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3277d9,_0x28ea8c){return function(_0x558c10){if(!_0x558c10){_0x3277d9['sendStatus'](0x194);}return _0x558c10;};}function handleError(_0x308c93,_0x21b172){_0x21b172=_0x21b172||0x1f4;return function(_0x4a8a4b){logger['error'](_0x4a8a4b['stack']);if(_0x4a8a4b[_0x6225('0x28')]){delete _0x4a8a4b[_0x6225('0x28')];}_0x308c93[_0x6225('0x19')](_0x21b172)[_0x6225('0x29')](_0x4a8a4b);};}exports[_0x6225('0x2a')]=function(_0x37e035,_0x14db3c){var _0x48304e={},_0x88b929={},_0x1e5cf6={'count':0x0,'rows':[]};var _0x28d9a4=_[_0x6225('0x2b')](db['SmsQueue'][_0x6225('0x2c')],function(_0x51738c){return{'name':_0x51738c[_0x6225('0x2d')],'type':_0x51738c[_0x6225('0x2e')][_0x6225('0x2f')]};});_0x88b929[_0x6225('0x30')]=_[_0x6225('0x2b')](_0x28d9a4,_0x6225('0x28'));_0x88b929[_0x6225('0x31')]=_[_0x6225('0x32')](_0x37e035[_0x6225('0x31')]);_0x88b929[_0x6225('0x33')]=_[_0x6225('0x34')](_0x88b929['model'],_0x88b929[_0x6225('0x31')]);_0x48304e[_0x6225('0x35')]=_['intersection'](_0x88b929[_0x6225('0x30')],qs['fields'](_0x37e035['query'][_0x6225('0x36')]));_0x48304e[_0x6225('0x35')]=_0x48304e[_0x6225('0x35')]['length']?_0x48304e['attributes']:_0x88b929['model'];if(!_0x37e035[_0x6225('0x31')][_0x6225('0x37')]('nolimit')){_0x48304e[_0x6225('0x1c')]=qs[_0x6225('0x1c')](_0x37e035[_0x6225('0x31')][_0x6225('0x1c')]);_0x48304e[_0x6225('0x1e')]=qs[_0x6225('0x1e')](_0x37e035['query']['offset']);}_0x48304e[_0x6225('0x38')]=qs['sort'](_0x37e035['query'][_0x6225('0x39')]);_0x48304e[_0x6225('0x3a')]=qs[_0x6225('0x33')](_[_0x6225('0x3b')](_0x37e035[_0x6225('0x31')],_0x88b929[_0x6225('0x33')]),_0x28d9a4);if(_0x37e035[_0x6225('0x31')][_0x6225('0x3c')]){_0x48304e['where']=_[_0x6225('0x3d')](_0x48304e[_0x6225('0x3a')],{'$or':_[_0x6225('0x2b')](_0x28d9a4,function(_0xbbd262){if(_0xbbd262[_0x6225('0x2e')]!==_0x6225('0x3e')){var _0x20e4b7={};_0x20e4b7[_0xbbd262[_0x6225('0x28')]]={'$like':'%'+_0x37e035['query'][_0x6225('0x3c')]+'%'};return _0x20e4b7;}})});}_0x48304e=_[_0x6225('0x3d')]({},_0x48304e,_0x37e035[_0x6225('0x3f')]);var _0x3ad0db={'where':_0x48304e[_0x6225('0x3a')]};return db[_0x6225('0x40')][_0x6225('0x1d')](_0x3ad0db)[_0x6225('0x23')](function(_0x43d28e){_0x1e5cf6[_0x6225('0x1d')]=_0x43d28e;if(_0x37e035[_0x6225('0x31')][_0x6225('0x41')]){_0x48304e[_0x6225('0x42')]=[{'all':!![]}];}return db['SmsQueue'][_0x6225('0x43')](_0x48304e);})[_0x6225('0x23')](function(_0x5afd87){_0x1e5cf6['rows']=_0x5afd87;return _0x1e5cf6;})[_0x6225('0x23')](respondWithFilteredResult(_0x14db3c,_0x48304e))[_0x6225('0x44')](handleError(_0x14db3c,null));};exports[_0x6225('0x45')]=function(_0x4b4cc3,_0x5abc35){var _0x40e239={'raw':!![],'where':{'id':_0x4b4cc3[_0x6225('0x46')]['id']}},_0xd3d77={};_0xd3d77[_0x6225('0x30')]=_[_0x6225('0x32')](db[_0x6225('0x40')]['rawAttributes']);_0xd3d77[_0x6225('0x31')]=_[_0x6225('0x32')](_0x4b4cc3[_0x6225('0x31')]);_0xd3d77[_0x6225('0x33')]=_['intersection'](_0xd3d77[_0x6225('0x30')],_0xd3d77[_0x6225('0x31')]);_0x40e239[_0x6225('0x35')]=_[_0x6225('0x34')](_0xd3d77[_0x6225('0x30')],qs[_0x6225('0x36')](_0x4b4cc3[_0x6225('0x31')]['fields']));_0x40e239[_0x6225('0x35')]=_0x40e239[_0x6225('0x35')][_0x6225('0x47')]?_0x40e239[_0x6225('0x35')]:_0xd3d77[_0x6225('0x30')];if(_0x4b4cc3[_0x6225('0x31')][_0x6225('0x41')]){_0x40e239[_0x6225('0x42')]=[{'all':!![]}];}_0x40e239=_[_0x6225('0x3d')]({},_0x40e239,_0x4b4cc3[_0x6225('0x3f')]);return db['SmsQueue']['find'](_0x40e239)[_0x6225('0x23')](handleEntityNotFound(_0x5abc35,null))['then'](respondWithResult(_0x5abc35,null))['catch'](handleError(_0x5abc35,null));};exports[_0x6225('0x48')]=function(_0x763bd1,_0x152165){return db['SmsQueue'][_0x6225('0x48')](_0x763bd1[_0x6225('0x49')],{})[_0x6225('0x23')](function(_0x18bf48){var _0x54e213=_0x763bd1[_0x6225('0x4a')][_0x6225('0x24')]({'plain':!![]});if(!_0x54e213)throw new Error(_0x6225('0x4b'));if(_0x54e213['role']===_0x6225('0x4a')){var _0x568a52=_0x18bf48['get']({'plain':!![]});var _0x37ed42=_0x6225('0x25');return db[_0x6225('0x4c')][_0x6225('0x4d')]({'where':{'name':_0x37ed42,'userProfileId':_0x54e213[_0x6225('0x4e')]},'raw':!![]})[_0x6225('0x23')](function(_0x4a29c6){if(_0x4a29c6&&_0x4a29c6[_0x6225('0x4f')]===0x0){return db['UserProfileResource'][_0x6225('0x48')]({'name':_0x568a52[_0x6225('0x28')],'resourceId':_0x568a52['id'],'type':_0x4a29c6[_0x6225('0x28')],'sectionId':_0x4a29c6['id']},{})[_0x6225('0x23')](function(){return _0x18bf48;});}else{return _0x18bf48;}})['catch'](function(_0x3d6a8f){logger[_0x6225('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d6a8f);throw _0x3d6a8f;});}return _0x18bf48;})[_0x6225('0x23')](respondWithResult(_0x152165,0xc9))[_0x6225('0x44')](handleError(_0x152165,null));};exports[_0x6225('0x22')]=function(_0x8b2df3,_0x42d653){if(_0x8b2df3[_0x6225('0x49')]['id']){delete _0x8b2df3[_0x6225('0x49')]['id'];}return db[_0x6225('0x40')]['find']({'where':{'id':_0x8b2df3['params']['id']}})[_0x6225('0x23')](handleEntityNotFound(_0x42d653,null))[_0x6225('0x23')](saveUpdates(_0x8b2df3[_0x6225('0x49')],null))['then'](respondWithResult(_0x42d653,null))[_0x6225('0x44')](handleError(_0x42d653,null));};exports[_0x6225('0x27')]=function(_0x3071f9,_0x697b7d){return db[_0x6225('0x40')]['find']({'where':{'id':_0x3071f9['params']['id']}})[_0x6225('0x23')](handleEntityNotFound(_0x697b7d,null))[_0x6225('0x23')](removeEntity(_0x697b7d,null))['catch'](handleError(_0x697b7d,null));};exports[_0x6225('0x51')]=function(_0x315dee,_0xeb98a0){return db[_0x6225('0x40')][_0x6225('0x51')]()[_0x6225('0x23')](respondWithResult(_0xeb98a0,null))[_0x6225('0x44')](handleError(_0xeb98a0,null));};exports['getMembers']=function(_0x1d4ba2,_0x3e75c6,_0x54ae89){var _0x27882a={'raw':!![],'where':{}},_0x285bcc={},_0x17cfcc;return db[_0x6225('0x40')][_0x6225('0x52')]({'where':{'id':_0x1d4ba2[_0x6225('0x46')]['id']}})[_0x6225('0x23')](handleEntityNotFound(_0x3e75c6,null))[_0x6225('0x23')](function(_0x50b5b8){if(_0x50b5b8){_0x17cfcc=_0x50b5b8[_0x6225('0x24')]({'plain':!![]});_0x285bcc['model']=_['keys'](db[_0x6225('0x53')][_0x6225('0x2c')]);_0x285bcc['query']=_[_0x6225('0x32')](_0x1d4ba2[_0x6225('0x31')]);_0x285bcc['filters']=_[_0x6225('0x34')](_0x285bcc['model'],_0x285bcc['query']);_0x27882a[_0x6225('0x35')]=_[_0x6225('0x34')](_0x285bcc[_0x6225('0x30')],qs['fields'](_0x1d4ba2[_0x6225('0x31')]['fields']));_0x27882a[_0x6225('0x35')]=_0x27882a[_0x6225('0x35')][_0x6225('0x47')]?_0x27882a['attributes']:_0x285bcc['model'];if(!_0x1d4ba2[_0x6225('0x31')][_0x6225('0x37')](_0x6225('0x54'))){_0x27882a[_0x6225('0x1c')]=qs['limit'](_0x1d4ba2[_0x6225('0x31')][_0x6225('0x1c')]);_0x27882a[_0x6225('0x1e')]=qs[_0x6225('0x1e')](_0x1d4ba2[_0x6225('0x31')]['offset']);}_0x27882a[_0x6225('0x38')]=qs[_0x6225('0x39')](_0x1d4ba2[_0x6225('0x31')][_0x6225('0x39')]);_0x27882a[_0x6225('0x3a')]=qs['filters'](_['pick'](_0x1d4ba2[_0x6225('0x31')],_0x285bcc[_0x6225('0x33')]));_0x27882a['where'][_0x6225('0x55')]=_0x50b5b8['id'];if(_0x1d4ba2[_0x6225('0x31')][_0x6225('0x3c')]){_0x27882a[_0x6225('0x3a')]=_[_0x6225('0x3d')](_0x27882a[_0x6225('0x3a')],{'$or':_[_0x6225('0x2b')](_0x27882a[_0x6225('0x35')],function(_0x55b7fa){var _0x3dc077={};_0x3dc077[_0x55b7fa]={'$like':'%'+_0x1d4ba2[_0x6225('0x31')][_0x6225('0x3c')]+'%'};return _0x3dc077;})});}_0x27882a=_[_0x6225('0x3d')]({},_0x27882a,_0x1d4ba2[_0x6225('0x3f')]);return db[_0x6225('0x53')][_0x6225('0x43')](_0x27882a);}})[_0x6225('0x23')](function(_0x423701){if(_0x423701){return db[_0x6225('0x56')]['findAndCountAll']({'where':{'id':_[_0x6225('0x2b')](_0x423701,_0x6225('0x57')),'role':'agent'},'attributes':['id',_0x6225('0x28'),_0x6225('0x58'),_0x6225('0x59'),_0x6225('0x5a')]});}})['then'](function(_0x199e2c){if(_0x199e2c){return{'count':_0x199e2c['count'],'rows':_[_0x6225('0x2b')](_0x199e2c[_0x6225('0x5b')],function(_0x5a57c8){return{'membername':_0x5a57c8['name'],'UserId':_0x5a57c8['id'],'queue_name':_0x17cfcc[_0x6225('0x28')],'SmsQueueId':_0x17cfcc['id'],'interface':util[_0x6225('0x5c')](_0x6225('0x5d'),'SIP',_0x5a57c8[_0x6225('0x28')]),'penalty':0x0,'paused':_0x5a57c8[_0x6225('0x58')],'createdAt':_0x5a57c8['createdAt'],'updatedAt':_0x5a57c8[_0x6225('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3e75c6,_0x27882a))[_0x6225('0x44')](handleError(_0x3e75c6,null));};exports[_0x6225('0x5e')]=function(_0x16a0db,_0x14c8b2,_0x335ed8){var _0xddd86e={};var _0x156b09={};var _0x323b1b;var _0x11339c;return db[_0x6225('0x40')][_0x6225('0x52')]({'where':{'id':_0x16a0db[_0x6225('0x46')]['id']}})[_0x6225('0x23')](handleEntityNotFound(_0x14c8b2,null))[_0x6225('0x23')](function(_0x472a55){if(_0x472a55){_0x323b1b=_0x472a55;_0x156b09[_0x6225('0x30')]=_[_0x6225('0x32')](db['Team']['rawAttributes']);_0x156b09[_0x6225('0x31')]=_['keys'](_0x16a0db[_0x6225('0x31')]);_0x156b09[_0x6225('0x33')]=_['intersection'](_0x156b09[_0x6225('0x30')],_0x156b09['query']);_0xddd86e[_0x6225('0x35')]=_[_0x6225('0x34')](_0x156b09[_0x6225('0x30')],qs['fields'](_0x16a0db['query']['fields']));_0xddd86e['attributes']=_0xddd86e[_0x6225('0x35')][_0x6225('0x47')]?_0xddd86e[_0x6225('0x35')]:_0x156b09[_0x6225('0x30')];_0xddd86e['order']=qs[_0x6225('0x39')](_0x16a0db[_0x6225('0x31')][_0x6225('0x39')]);_0xddd86e[_0x6225('0x3a')]=qs[_0x6225('0x33')](_[_0x6225('0x3b')](_0x16a0db[_0x6225('0x31')],_0x156b09['filters']));if(_0x16a0db[_0x6225('0x31')][_0x6225('0x3c')]){_0xddd86e[_0x6225('0x3a')]=_['merge'](_0xddd86e['where'],{'$or':_[_0x6225('0x2b')](_0xddd86e[_0x6225('0x35')],function(_0x1c9f38){var _0x1f05fe={};_0x1f05fe[_0x1c9f38]={'$like':'%'+_0x16a0db[_0x6225('0x31')][_0x6225('0x3c')]+'%'};return _0x1f05fe;})});}_0xddd86e=_[_0x6225('0x3d')]({},_0xddd86e,_0x16a0db['options']);return _0x323b1b[_0x6225('0x5e')](_0xddd86e);}})[_0x6225('0x23')](function(_0x4019dc){if(_0x4019dc){_0x11339c=_0x4019dc['length'];if(!_0x16a0db[_0x6225('0x31')][_0x6225('0x37')]('nolimit')){_0xddd86e[_0x6225('0x1c')]=qs[_0x6225('0x1c')](_0x16a0db[_0x6225('0x31')][_0x6225('0x1c')]);_0xddd86e[_0x6225('0x1e')]=qs[_0x6225('0x1e')](_0x16a0db[_0x6225('0x31')][_0x6225('0x1e')]);}return _0x323b1b[_0x6225('0x5e')](_0xddd86e);}})[_0x6225('0x23')](function(_0x5e7025){if(_0x5e7025){return _0x5e7025?{'count':_0x11339c,'rows':_0x5e7025}:null;}})[_0x6225('0x23')](respondWithResult(_0x14c8b2,null))[_0x6225('0x44')](handleError(_0x14c8b2,null));};exports[_0x6225('0x5f')]=function(_0x45fa44,_0x440ccf,_0x3765e7){var _0x7a7d58=_0x45fa44[_0x6225('0x49')][_0x6225('0x60')];return db['Team'][_0x6225('0x43')]({'where':{'id':_0x7a7d58},'attributes':['id'],'include':[{'model':db[_0x6225('0x56')],'as':_0x6225('0x61'),'attributes':['id',_0x6225('0x28'),_0x6225('0x62'),'voicePause',_0x6225('0x63')],'raw':!![]}]})[_0x6225('0x23')](function(_0x729dd8){if(_0x729dd8){var _0x58d0bc=_['flatMap'](_0x729dd8,function(_0x2a9b38){var _0x546828=_0x2a9b38[_0x6225('0x24')]({'plain':!![]});return _0x546828['Agents'];});return db[_0x6225('0x40')][_0x6225('0x4d')]({'where':{'id':_0x45fa44['params']['id']}})[_0x6225('0x23')](function(_0x5d5525){return db[_0x6225('0x64')][_0x6225('0x65')](function(_0x10f09c){return _0x5d5525[_0x6225('0x5f')](_0x7a7d58,{'transaction':_0x10f09c})[_0x6225('0x23')](function(){return BPromise[_0x6225('0x66')](_0x58d0bc,function(_0x1e7a33){return db[_0x6225('0x53')][_0x6225('0x67')]({'where':{'UserId':_0x1e7a33['id'],'SmsQueueId':_0x45fa44['params']['id']},'transaction':_0x10f09c});});})[_0x6225('0x23')](function(){_0x58d0bc['forEach'](function(_0x2a4ce4){socket[_0x6225('0x68')]('userSmsQueue:save',{'UserId':_0x2a4ce4['id'],'SmsQueueId':_0x5d5525['id']});});});});});}})['then'](respondWithStatusCode(_0x440ccf,null))[_0x6225('0x44')](handleError(_0x440ccf,null));};exports[_0x6225('0x69')]=function(_0x4a575a,_0x1084cf,_0x35bdd8){return db[_0x6225('0x6a')][_0x6225('0x43')]({'where':{'id':_0x4a575a[_0x6225('0x31')][_0x6225('0x60')]},'attributes':['id'],'include':[{'model':db[_0x6225('0x56')],'as':_0x6225('0x61'),'attributes':['id'],'raw':!![]}]})[_0x6225('0x23')](handleEntityNotFound(_0x1084cf,null))[_0x6225('0x23')](function(_0x254bca){var _0x38b05a=_[_0x6225('0x2b')](_0x254bca,'id');var _0x116f72=[];var _0x555911=[];var _0x47d45f=squel[_0x6225('0x6b')]();_0x47d45f[_0x6225('0x6c')]('tq.TeamId')[_0x6225('0x6d')](_0x6225('0x6e'),'tq')[_0x6225('0x6f')](_0x6225('0x70'),'ut',_0x6225('0x71'))[_0x6225('0x3a')](_0x6225('0x72'),_0x4a575a[_0x6225('0x46')]['id']);for(var _0x4b3f06=0x0;_0x4b3f06<_0x254bca[_0x6225('0x47')];_0x4b3f06+=0x1){let _0x41e50c=_0x254bca[_0x4b3f06];for(var _0x4b4732=0x0;_0x4b4732<_0x41e50c[_0x6225('0x61')]['length'];_0x4b4732+=0x1){let _0xc40712=_0x41e50c[_0x6225('0x61')][_0x4b4732];var _0x26f14e=_0x47d45f[_0x6225('0x73')]();_0x26f14e[_0x6225('0x3a')](_0x6225('0x74'),_0xc40712['id']);_0x555911[_0x6225('0x75')](db[_0x6225('0x64')][_0x6225('0x31')](_0x26f14e[_0x6225('0x76')](),{'type':db[_0x6225('0x64')][_0x6225('0x77')][_0x6225('0x78')]})['then'](function(_0x1e2c7){if(_0x1e2c7['length']===0x1){return _0xc40712['id'];}else{var _0xd6a811=_['every'](_[_0x6225('0x2b')](_0x1e2c7,'TeamId'),function(_0x5aaf6a){return _[_0x6225('0x79')](_0x38b05a,_0x5aaf6a);});if(_0xd6a811){return _0xc40712['id'];}}}));}}return BPromise[_0x6225('0x7a')](_0x555911)[_0x6225('0x23')](function(_0x2022b0){_0x116f72=_(_0x116f72)[_0x6225('0x7b')](_0x2022b0)[_0x6225('0x7c')]()[_0x6225('0x7d')]();return db[_0x6225('0x40')][_0x6225('0x4d')]({'where':{'id':_0x4a575a[_0x6225('0x46')]['id']}})[_0x6225('0x23')](function(_0x10b07d){return db[_0x6225('0x64')][_0x6225('0x65')](function(_0x37ab2f){return _0x10b07d['removeTeams'](_0x4a575a[_0x6225('0x31')][_0x6225('0x60')],{'transaction':_0x37ab2f})['then'](function(){if(!_[_0x6225('0x7e')](_0x116f72)){return _0x10b07d['removeAgents'](_0x116f72,{'transaction':_0x37ab2f});}})[_0x6225('0x23')](function(){_0x116f72[_0x6225('0x7f')](function(_0x2ccbab){socket[_0x6225('0x68')](_0x6225('0x80'),{'UserId':_0x2ccbab,'SmsQueueId':_0x10b07d['id']});});});});});});})['then'](respondWithStatusCode(_0x1084cf,null))[_0x6225('0x44')](handleError(_0x1084cf,null));};exports[_0x6225('0x81')]=function(_0x2b9c85,_0x600e16,_0xe21787){return db['SmsQueue']['find']({'where':{'id':_0x2b9c85[_0x6225('0x46')]['id']}})[_0x6225('0x23')](handleEntityNotFound(_0x600e16,null))[_0x6225('0x23')](function(_0x2f37a5){if(_0x2f37a5){return _0x2f37a5['addAgents'](_0x2b9c85[_0x6225('0x49')][_0x6225('0x60')],_[_0x6225('0x82')](_0x2b9c85[_0x6225('0x49')],['ids','id'])||{})[_0x6225('0x83')](function(_0xfba5ab){for(var _0x455a3e=0x0;_0x455a3e<_0x2b9c85['body']['ids']['length'];_0x455a3e+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x2b9c85[_0x6225('0x49')]['ids'][_0x455a3e]),'SmsQueueId':Number(_0x2b9c85[_0x6225('0x46')]['id'])});}return _0xfba5ab;});}})[_0x6225('0x23')](respondWithResult(_0x600e16,null))[_0x6225('0x44')](handleError(_0x600e16,null));};exports[_0x6225('0x84')]=function(_0x1ccbf2,_0x27a483,_0xddd533){return db['SmsQueue'][_0x6225('0x4d')]({'where':{'id':_0x1ccbf2[_0x6225('0x46')]['id']}})[_0x6225('0x23')](handleEntityNotFound(_0x27a483,null))[_0x6225('0x23')](function(_0x5c840d){if(_0x5c840d){return _0x5c840d[_0x6225('0x84')](_0x1ccbf2[_0x6225('0x31')][_0x6225('0x60')])[_0x6225('0x23')](function(){if(_[_0x6225('0x85')](_0x1ccbf2[_0x6225('0x31')]['ids'])){for(var _0x2a62a2=0x0;_0x2a62a2<_0x1ccbf2['query'][_0x6225('0x60')][_0x6225('0x47')];_0x2a62a2+=0x1){socket[_0x6225('0x68')](_0x6225('0x80'),{'UserId':Number(_0x1ccbf2[_0x6225('0x31')]['ids'][_0x2a62a2]),'SmsQueueId':Number(_0x1ccbf2['params']['id'])});}}else{socket['emit'](_0x6225('0x80'),{'UserId':Number(_0x1ccbf2[_0x6225('0x31')][_0x6225('0x60')]),'SmsQueueId':Number(_0x1ccbf2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x27a483,null))[_0x6225('0x44')](handleError(_0x27a483,null));};exports[_0x6225('0x86')]=function(_0x355a2c,_0x9dfbff,_0x298bf3){var _0x1c4291={};var _0x3e9efe={};var _0x4bb385;var _0x365563;return db[_0x6225('0x40')][_0x6225('0x52')]({'where':{'id':_0x355a2c['params']['id']}})['then'](handleEntityNotFound(_0x9dfbff,null))[_0x6225('0x23')](function(_0x1c6fd8){if(_0x1c6fd8){_0x4bb385=_0x1c6fd8;_0x3e9efe['model']=_[_0x6225('0x32')](db[_0x6225('0x56')][_0x6225('0x2c')]);_0x3e9efe[_0x6225('0x31')]=_[_0x6225('0x32')](_0x355a2c[_0x6225('0x31')]);_0x3e9efe['filters']=_[_0x6225('0x34')](_0x3e9efe[_0x6225('0x30')],_0x3e9efe[_0x6225('0x31')]);_0x1c4291[_0x6225('0x35')]=_['intersection'](_0x3e9efe['model'],qs[_0x6225('0x36')](_0x355a2c[_0x6225('0x31')][_0x6225('0x36')]));_0x1c4291[_0x6225('0x35')]=_0x1c4291[_0x6225('0x35')][_0x6225('0x47')]?_0x1c4291[_0x6225('0x35')]:_0x3e9efe[_0x6225('0x30')];_0x1c4291[_0x6225('0x38')]=qs[_0x6225('0x39')](_0x355a2c[_0x6225('0x31')][_0x6225('0x39')]);_0x1c4291[_0x6225('0x3a')]=qs[_0x6225('0x33')](_['pick'](_0x355a2c[_0x6225('0x31')],_0x3e9efe[_0x6225('0x33')]));if(_0x355a2c[_0x6225('0x31')][_0x6225('0x3c')]){_0x1c4291[_0x6225('0x3a')]=_[_0x6225('0x3d')](_0x1c4291[_0x6225('0x3a')],{'$or':_[_0x6225('0x2b')](_0x1c4291[_0x6225('0x35')],function(_0x1b7e13){var _0xb3e92c={};_0xb3e92c[_0x1b7e13]={'$like':'%'+_0x355a2c[_0x6225('0x31')][_0x6225('0x3c')]+'%'};return _0xb3e92c;})});}_0x1c4291=_[_0x6225('0x3d')]({},_0x1c4291,_0x355a2c['options']);return _0x4bb385['getAgents'](_0x1c4291);}})[_0x6225('0x23')](function(_0x10adf0){if(_0x10adf0){_0x365563=_0x10adf0[_0x6225('0x47')];if(!_0x355a2c['query'][_0x6225('0x37')](_0x6225('0x54'))){_0x1c4291['limit']=qs[_0x6225('0x1c')](_0x355a2c['query'][_0x6225('0x1c')]);_0x1c4291['offset']=qs[_0x6225('0x1e')](_0x355a2c[_0x6225('0x31')][_0x6225('0x1e')]);}return _0x4bb385[_0x6225('0x86')](_0x1c4291);}})['then'](function(_0x49541a){if(_0x49541a){return _0x49541a?{'count':_0x365563,'rows':_0x49541a}:null;}})['then'](respondWithResult(_0x9dfbff,null))[_0x6225('0x44')](handleError(_0x9dfbff,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index d53d9dd..51c5ec9 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 _0x9999=['hasOwnProperty','hook','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x2d5558,_0x498a79){var _0x552ab=function(_0x5ec717){while(--_0x5ec717){_0x2d5558['push'](_0x2d5558['shift']());}};_0x552ab(++_0x498a79);}(_0x9999,0x17a));var _0x9999=function(_0x508324,_0xa24e2c){_0x508324=_0x508324-0x0;var _0x21fe78=_0x9999[_0x508324];return _0x21fe78;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x9999('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9999('0x1')](0x0);var events={'afterCreate':_0x9999('0x2'),'afterUpdate':_0x9999('0x3'),'afterDestroy':_0x9999('0x4')};function emitEvent(_0xbb83f3){return function(_0x159a01,_0x340aa8,_0x5b15ec){SmsQueueEvents[_0x9999('0x5')](_0xbb83f3+':'+_0x159a01['id'],_0x159a01);SmsQueueEvents[_0x9999('0x5')](_0xbb83f3,_0x159a01);_0x5b15ec(null);};}for(var e in events){if(events[_0x9999('0x6')](e)){var event=events[e];SmsQueue[_0x9999('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xcc21=['SmsQueue','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x86dbdc,_0x31693b){var _0x42c1fd=function(_0x1c9cd9){while(--_0x1c9cd9){_0x86dbdc['push'](_0x86dbdc['shift']());}};_0x42c1fd(++_0x31693b);}(_0xcc21,0x74));var _0x1cc2=function(_0x23a673,_0x31e4bc){_0x23a673=_0x23a673-0x0;var _0x2213b7=_0xcc21[_0x23a673];return _0x2213b7;};'use strict';var EventEmitter=require(_0x1cc2('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x1cc2('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1cc2('0x2')](0x0);var events={'afterCreate':_0x1cc2('0x3'),'afterUpdate':_0x1cc2('0x4'),'afterDestroy':_0x1cc2('0x5')};function emitEvent(_0x20ff53){return function(_0x55eddd,_0x11a35d,_0x182ea1){SmsQueueEvents[_0x1cc2('0x6')](_0x20ff53+':'+_0x55eddd['id'],_0x55eddd);SmsQueueEvents[_0x1cc2('0x6')](_0x20ff53,_0x55eddd);_0x182ea1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x1cc2('0x7')](e,emitEvent(event));}}module[_0x1cc2('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 3cbe35d..7e886f7 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 _0x42d4=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./smsQueue.attributes','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x42d4,0x148));var _0x442d=function(_0x1a2911,_0xeb3e04){_0x1a2911=_0x1a2911-0x0;var _0x2aef05=_0x42d4[_0x1a2911];return _0x2aef05;};'use strict';var _=require(_0x442d('0x0'));var util=require(_0x442d('0x1'));var logger=require(_0x442d('0x2'))(_0x442d('0x3'));var moment=require(_0x442d('0x4'));var BPromise=require(_0x442d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x442d('0x6'));var rimraf=require('rimraf');var config=require(_0x442d('0x7'));var attributes=require(_0x442d('0x8'));module[_0x442d('0x9')]=function(_0x58a33e,_0x1a291b){return _0x58a33e[_0x442d('0xa')](_0x442d('0xb'),attributes,{'tableName':_0x442d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19dd=['exports','define','SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x19dd,0x19a));var _0xd19d=function(_0x20ed45,_0x48ab79){_0x20ed45=_0x20ed45-0x0;var _0x520bfe=_0x19dd[_0x20ed45];return _0x520bfe;};'use strict';var _=require(_0xd19d('0x0'));var util=require(_0xd19d('0x1'));var logger=require('../../config/logger')(_0xd19d('0x2'));var moment=require(_0xd19d('0x3'));var BPromise=require(_0xd19d('0x4'));var rp=require(_0xd19d('0x5'));var fs=require('fs');var path=require(_0xd19d('0x6'));var rimraf=require(_0xd19d('0x7'));var config=require(_0xd19d('0x8'));var attributes=require(_0xd19d('0x9'));module[_0xd19d('0xa')]=function(_0x6be517,_0x22469){return _0x6be517[_0xd19d('0xb')](_0xd19d('0xc'),attributes,{'tableName':_0xd19d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 6a841e8..90abc60 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 _0x7b45=['socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueue','options','where','attributes','limit','include','map','model','GetSmsQueue','catch','find','raw','ShowSmsQueue','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x864be1,_0x141127){var _0x13c6d1=function(_0x41226a){while(--_0x41226a){_0x864be1['push'](_0x864be1['shift']());}};_0x13c6d1(++_0x141127);}(_0x7b45,0x14a));var _0x57b4=function(_0x28e829,_0x16ea6c){_0x28e829=_0x28e829-0x0;var _0x2e75b2=_0x7b45[_0x28e829];return _0x2e75b2;};'use strict';var _=require(_0x57b4('0x0'));var util=require(_0x57b4('0x1'));var moment=require(_0x57b4('0x2'));var BPromise=require(_0x57b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x57b4('0x4'))(_0x57b4('0x5'));var config=require(_0x57b4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x57b4('0x7')][_0x57b4('0x8')]({'port':0x232a});config[_0x57b4('0x9')]=_[_0x57b4('0xa')](config[_0x57b4('0x9')],{'host':_0x57b4('0xb'),'port':0x18eb});var socket=require(_0x57b4('0xc'))(new Redis(config[_0x57b4('0x9')]));require('./smsQueue.socket')[_0x57b4('0xd')](socket);function respondWithRpcPromise(_0x36df16,_0x46d0d8,_0x6d5bf2){return new BPromise(function(_0x3ba76b,_0x4268fd){return client[_0x57b4('0xe')](_0x36df16,_0x6d5bf2)[_0x57b4('0xf')](function(_0x5566e9){logger[_0x57b4('0x10')](_0x57b4('0x11'),_0x46d0d8,_0x57b4('0x12'));logger[_0x57b4('0x13')](_0x57b4('0x14'),_0x46d0d8,_0x57b4('0x12'),JSON[_0x57b4('0x15')](_0x5566e9));if(_0x5566e9[_0x57b4('0x16')]){if(_0x5566e9['error'][_0x57b4('0x17')]===0x1f4){logger[_0x57b4('0x16')]('SmsQueue,\x20%s,\x20%s',_0x46d0d8,_0x5566e9['error']['message']);return _0x4268fd(_0x5566e9[_0x57b4('0x16')][_0x57b4('0x18')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x46d0d8,_0x5566e9[_0x57b4('0x16')][_0x57b4('0x18')]);return _0x3ba76b(_0x5566e9[_0x57b4('0x16')][_0x57b4('0x18')]);}else{logger['info'](_0x57b4('0x11'),_0x46d0d8,_0x57b4('0x12'));_0x3ba76b(_0x5566e9['result'][_0x57b4('0x18')]);}})['catch'](function(_0x240c32){logger['error']('SmsQueue,\x20%s,\x20%s',_0x46d0d8,_0x240c32);_0x4268fd(_0x240c32);});});}exports['GetSmsQueue']=function(_0x325561){var _0x59399a=this;return new Promise(function(_0x186de,_0x2a327b){return db[_0x57b4('0x19')]['findAll']({'raw':_0x325561[_0x57b4('0x1a')]?_0x325561['options']['raw']===undefined?!![]:![]:!![],'where':_0x325561[_0x57b4('0x1a')]?_0x325561['options'][_0x57b4('0x1b')]||null:null,'attributes':_0x325561[_0x57b4('0x1a')]?_0x325561[_0x57b4('0x1a')][_0x57b4('0x1c')]||null:null,'limit':_0x325561[_0x57b4('0x1a')]?_0x325561[_0x57b4('0x1a')][_0x57b4('0x1d')]||null:null,'include':_0x325561['options']?_0x325561['options'][_0x57b4('0x1e')]?_[_0x57b4('0x1f')](_0x325561[_0x57b4('0x1a')]['include'],function(_0x1baf8f){return{'model':db[_0x1baf8f[_0x57b4('0x20')]],'as':_0x1baf8f['as'],'attributes':_0x1baf8f[_0x57b4('0x1c')],'include':_0x1baf8f[_0x57b4('0x1e')]?_['map'](_0x1baf8f[_0x57b4('0x1e')],function(_0x1c6898){return{'model':db[_0x1c6898[_0x57b4('0x20')]],'as':_0x1c6898['as'],'attributes':_0x1c6898[_0x57b4('0x1c')],'include':_0x1c6898[_0x57b4('0x1e')]?_[_0x57b4('0x1f')](_0x1c6898[_0x57b4('0x1e')],function(_0x480d0e){return{'model':db[_0x480d0e[_0x57b4('0x20')]],'as':_0x480d0e['as'],'attributes':_0x480d0e['attributes']};}):[]};}):[]};}):[]:[]})[_0x57b4('0xf')](function(_0x2692c5){logger[_0x57b4('0x10')](_0x57b4('0x21'),_0x325561);logger[_0x57b4('0x13')](_0x57b4('0x21'),_0x325561,JSON[_0x57b4('0x15')](_0x2692c5));_0x186de(_0x2692c5);})[_0x57b4('0x22')](function(_0xd03c03){logger['error'](_0x57b4('0x21'),_0xd03c03[_0x57b4('0x18')],_0x325561);_0x2a327b(_0x59399a['error'](0x1f4,_0xd03c03[_0x57b4('0x18')]));});});};exports['ShowSmsQueue']=function(_0x1f6ccb){var _0x243e31=this;return new Promise(function(_0x5c68dd,_0xabf2df){return db[_0x57b4('0x19')][_0x57b4('0x23')]({'raw':_0x1f6ccb[_0x57b4('0x1a')]?_0x1f6ccb[_0x57b4('0x1a')][_0x57b4('0x24')]===undefined?!![]:![]:!![],'where':_0x1f6ccb[_0x57b4('0x1a')]?_0x1f6ccb['options'][_0x57b4('0x1b')]||null:null,'attributes':_0x1f6ccb[_0x57b4('0x1a')]?_0x1f6ccb[_0x57b4('0x1a')][_0x57b4('0x1c')]||null:null,'include':_0x1f6ccb['options']?_0x1f6ccb[_0x57b4('0x1a')]['include']?_[_0x57b4('0x1f')](_0x1f6ccb[_0x57b4('0x1a')]['include'],function(_0x5ddc0f){return{'model':db[_0x5ddc0f['model']],'as':_0x5ddc0f['as'],'attributes':_0x5ddc0f[_0x57b4('0x1c')],'include':_0x5ddc0f['include']?_[_0x57b4('0x1f')](_0x5ddc0f['include'],function(_0x127723){return{'model':db[_0x127723[_0x57b4('0x20')]],'as':_0x127723['as'],'attributes':_0x127723[_0x57b4('0x1c')],'include':_0x127723[_0x57b4('0x1e')]?_['map'](_0x127723['include'],function(_0x90e0a9){return{'model':db[_0x90e0a9[_0x57b4('0x20')]],'as':_0x90e0a9['as'],'attributes':_0x90e0a9[_0x57b4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x57b4('0xf')](function(_0x2220c0){logger['info'](_0x57b4('0x25'),_0x1f6ccb);logger['debug']('ShowSmsQueue',_0x1f6ccb,JSON[_0x57b4('0x15')](_0x2220c0));_0x5c68dd(_0x2220c0);})[_0x57b4('0x22')](function(_0x7e5752){logger[_0x57b4('0x16')](_0x57b4('0x25'),_0x7e5752[_0x57b4('0x18')],_0x1f6ccb);_0xabf2df(_0x243e31[_0x57b4('0x16')](0x1f4,_0x7e5752[_0x57b4('0x18')]));});});}; \ No newline at end of file +var _0x2477=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetSmsQueue','findAll','options','raw','attributes','limit','map','include','model','ShowSmsQueue','SmsQueue'];(function(_0x21b536,_0x5f014d){var _0xcac097=function(_0x46d784){while(--_0x46d784){_0x21b536['push'](_0x21b536['shift']());}};_0xcac097(++_0x5f014d);}(_0x2477,0x138));var _0x7247=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x2477[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x7247('0x0'));var util=require(_0x7247('0x1'));var moment=require(_0x7247('0x2'));var BPromise=require(_0x7247('0x3'));var rs=require(_0x7247('0x4'));var fs=require('fs');var Redis=require(_0x7247('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7247('0x6'));var logger=require(_0x7247('0x7'))('rpc');var config=require(_0x7247('0x8'));var jayson=require(_0x7247('0x9'));var client=jayson[_0x7247('0xa')][_0x7247('0xb')]({'port':0x232a});config[_0x7247('0xc')]=_[_0x7247('0xd')](config[_0x7247('0xc')],{'host':_0x7247('0xe'),'port':0x18eb});var socket=require(_0x7247('0xf'))(new Redis(config['redis']));require(_0x7247('0x10'))[_0x7247('0x11')](socket);function respondWithRpcPromise(_0x31d291,_0x750b89,_0xf5184f){return new BPromise(function(_0x5f3352,_0x55c0ae){return client[_0x7247('0x12')](_0x31d291,_0xf5184f)['then'](function(_0x3780bc){logger['info'](_0x7247('0x13'),_0x750b89,_0x7247('0x14'));logger[_0x7247('0x15')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x750b89,_0x7247('0x14'),JSON[_0x7247('0x16')](_0x3780bc));if(_0x3780bc[_0x7247('0x17')]){if(_0x3780bc['error'][_0x7247('0x18')]===0x1f4){logger['error'](_0x7247('0x13'),_0x750b89,_0x3780bc[_0x7247('0x17')][_0x7247('0x19')]);return _0x55c0ae(_0x3780bc[_0x7247('0x17')][_0x7247('0x19')]);}logger[_0x7247('0x17')](_0x7247('0x13'),_0x750b89,_0x3780bc[_0x7247('0x17')][_0x7247('0x19')]);return _0x5f3352(_0x3780bc[_0x7247('0x17')]['message']);}else{logger[_0x7247('0x1a')](_0x7247('0x13'),_0x750b89,_0x7247('0x14'));_0x5f3352(_0x3780bc['result'][_0x7247('0x19')]);}})[_0x7247('0x1b')](function(_0x2eec1f){logger[_0x7247('0x17')](_0x7247('0x13'),_0x750b89,_0x2eec1f);_0x55c0ae(_0x2eec1f);});});}exports[_0x7247('0x1c')]=function(_0x529c4b){var _0x2023f9=this;return new Promise(function(_0x195cea,_0x52d38a){return db['SmsQueue'][_0x7247('0x1d')]({'raw':_0x529c4b['options']?_0x529c4b[_0x7247('0x1e')][_0x7247('0x1f')]===undefined?!![]:![]:!![],'where':_0x529c4b['options']?_0x529c4b[_0x7247('0x1e')]['where']||null:null,'attributes':_0x529c4b[_0x7247('0x1e')]?_0x529c4b[_0x7247('0x1e')][_0x7247('0x20')]||null:null,'limit':_0x529c4b[_0x7247('0x1e')]?_0x529c4b['options'][_0x7247('0x21')]||null:null,'include':_0x529c4b[_0x7247('0x1e')]?_0x529c4b['options']['include']?_[_0x7247('0x22')](_0x529c4b[_0x7247('0x1e')]['include'],function(_0x4e608f){return{'model':db[_0x4e608f['model']],'as':_0x4e608f['as'],'attributes':_0x4e608f[_0x7247('0x20')],'include':_0x4e608f[_0x7247('0x23')]?_[_0x7247('0x22')](_0x4e608f['include'],function(_0x48d822){return{'model':db[_0x48d822[_0x7247('0x24')]],'as':_0x48d822['as'],'attributes':_0x48d822[_0x7247('0x20')],'include':_0x48d822[_0x7247('0x23')]?_[_0x7247('0x22')](_0x48d822[_0x7247('0x23')],function(_0x490a89){return{'model':db[_0x490a89[_0x7247('0x24')]],'as':_0x490a89['as'],'attributes':_0x490a89[_0x7247('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2db7b2){logger['info']('GetSmsQueue',_0x529c4b);logger[_0x7247('0x15')](_0x7247('0x1c'),_0x529c4b,JSON[_0x7247('0x16')](_0x2db7b2));_0x195cea(_0x2db7b2);})['catch'](function(_0x2b2def){logger[_0x7247('0x17')](_0x7247('0x1c'),_0x2b2def[_0x7247('0x19')],_0x529c4b);_0x52d38a(_0x2023f9['error'](0x1f4,_0x2b2def[_0x7247('0x19')]));});});};exports[_0x7247('0x25')]=function(_0x3b2e29){var _0x1770fb=this;return new Promise(function(_0x2cc91b,_0x3f9a55){return db[_0x7247('0x26')]['find']({'raw':_0x3b2e29[_0x7247('0x1e')]?_0x3b2e29[_0x7247('0x1e')][_0x7247('0x1f')]===undefined?!![]:![]:!![],'where':_0x3b2e29[_0x7247('0x1e')]?_0x3b2e29['options']['where']||null:null,'attributes':_0x3b2e29[_0x7247('0x1e')]?_0x3b2e29[_0x7247('0x1e')][_0x7247('0x20')]||null:null,'include':_0x3b2e29[_0x7247('0x1e')]?_0x3b2e29[_0x7247('0x1e')]['include']?_[_0x7247('0x22')](_0x3b2e29[_0x7247('0x1e')][_0x7247('0x23')],function(_0x233665){return{'model':db[_0x233665[_0x7247('0x24')]],'as':_0x233665['as'],'attributes':_0x233665[_0x7247('0x20')],'include':_0x233665[_0x7247('0x23')]?_[_0x7247('0x22')](_0x233665['include'],function(_0xc27bdd){return{'model':db[_0xc27bdd[_0x7247('0x24')]],'as':_0xc27bdd['as'],'attributes':_0xc27bdd[_0x7247('0x20')],'include':_0xc27bdd[_0x7247('0x23')]?_[_0x7247('0x22')](_0xc27bdd[_0x7247('0x23')],function(_0x34d666){return{'model':db[_0x34d666[_0x7247('0x24')]],'as':_0x34d666['as'],'attributes':_0x34d666['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x300702){logger[_0x7247('0x1a')](_0x7247('0x25'),_0x3b2e29);logger['debug'](_0x7247('0x25'),_0x3b2e29,JSON[_0x7247('0x16')](_0x300702));_0x2cc91b(_0x300702);})[_0x7247('0x1b')](function(_0x16ee39){logger[_0x7247('0x17')]('ShowSmsQueue',_0x16ee39[_0x7247('0x19')],_0x3b2e29);_0x3f9a55(_0x1770fb['error'](0x1f4,_0x16ee39['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 4a571c6..f8a728b 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 _0x21e6=['length','smsQueue:','./smsQueue.events','save','remove','removeListener'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0x21e6,0x1e8));var _0x621e=function(_0x5bff0,_0x20716d){_0x5bff0=_0x5bff0-0x0;var _0x3ead2e=_0x21e6[_0x5bff0];return _0x3ead2e;};'use strict';var SmsQueueEvents=require(_0x621e('0x0'));var events=[_0x621e('0x1'),_0x621e('0x2'),'update'];function createListener(_0x2db819,_0x4d2334){return function(_0x5ea0a8){_0x4d2334['emit'](_0x2db819,_0x5ea0a8);};}function removeListener(_0x124f75,_0x20f99b){return function(){SmsQueueEvents[_0x621e('0x3')](_0x124f75,_0x20f99b);};}exports['register']=function(_0x15f56e){for(var _0x3da72b=0x0,_0x598392=events[_0x621e('0x4')];_0x3da72b<_0x598392;_0x3da72b++){var _0xfa8ffc=events[_0x3da72b];var _0x346daa=createListener(_0x621e('0x5')+_0xfa8ffc,_0x15f56e);SmsQueueEvents['on'](_0xfa8ffc,_0x346daa);}}; \ No newline at end of file +var _0xec53=['./smsQueue.events','save','remove','update','emit','length','smsQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec53,0x149));var _0x3ec5=function(_0x163150,_0x391977){_0x163150=_0x163150-0x0;var _0x42367c=_0xec53[_0x163150];return _0x42367c;};'use strict';var SmsQueueEvents=require(_0x3ec5('0x0'));var events=[_0x3ec5('0x1'),_0x3ec5('0x2'),_0x3ec5('0x3')];function createListener(_0x2433cd,_0x4c3d94){return function(_0x1aabed){_0x4c3d94[_0x3ec5('0x4')](_0x2433cd,_0x1aabed);};}function removeListener(_0x1a8375,_0x45b0c0){return function(){SmsQueueEvents['removeListener'](_0x1a8375,_0x45b0c0);};}exports['register']=function(_0x57fff3){for(var _0x12e4ab=0x0,_0xb4bb2d=events[_0x3ec5('0x5')];_0x12e4ab<_0xb4bb2d;_0x12e4ab++){var _0xb0a9f5=events[_0x12e4ab];var _0x31310e=createListener(_0x3ec5('0x6')+_0xb0a9f5,_0x57fff3);SmsQueueEvents['on'](_0xb0a9f5,_0x31310e);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6beb9a5..d57b254 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 _0x41d7=['/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsQueueReport.controller','get','index','/describe','describe','isAuthenticated','show','post','put'];(function(_0x35a211,_0x1a2f9e){var _0x328766=function(_0x240bd5){while(--_0x240bd5){_0x35a211['push'](_0x35a211['shift']());}};_0x328766(++_0x1a2f9e);}(_0x41d7,0x194));var _0x741d=function(_0x2bab49,_0x4a39bc){_0x2bab49=_0x2bab49-0x0;var _0x5103d9=_0x41d7[_0x2bab49];return _0x5103d9;};'use strict';var multer=require('multer');var util=require(_0x741d('0x0'));var path=require(_0x741d('0x1'));var timeout=require(_0x741d('0x2'));var express=require(_0x741d('0x3'));var router=express[_0x741d('0x4')]();var fs_extra=require(_0x741d('0x5'));var auth=require(_0x741d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x741d('0x7'));router[_0x741d('0x8')]('/',auth['isAuthenticated'](),controller[_0x741d('0x9')]);router[_0x741d('0x8')](_0x741d('0xa'),auth['isAuthenticated'](),controller[_0x741d('0xb')]);router[_0x741d('0x8')]('/:id',auth[_0x741d('0xc')](),controller[_0x741d('0xd')]);router[_0x741d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x741d('0xf')](_0x741d('0x10'),auth[_0x741d('0xc')](),controller['update']);router[_0x741d('0x11')](_0x741d('0x10'),auth['isAuthenticated'](),controller[_0x741d('0x12')]);module[_0x741d('0x13')]=router; \ No newline at end of file +var _0x0301=['show','create','put','/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','/describe','isAuthenticated'];(function(_0x1be5c9,_0x3a8353){var _0x2b58e8=function(_0x16c150){while(--_0x16c150){_0x1be5c9['push'](_0x1be5c9['shift']());}};_0x2b58e8(++_0x3a8353);}(_0x0301,0x79));var _0x1030=function(_0x597c16,_0x2292fe){_0x597c16=_0x597c16-0x0;var _0x30cc2c=_0x0301[_0x597c16];return _0x30cc2c;};'use strict';var multer=require(_0x1030('0x0'));var util=require(_0x1030('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1030('0x2'));var router=express[_0x1030('0x3')]();var fs_extra=require(_0x1030('0x4'));var auth=require(_0x1030('0x5'));var interaction=require(_0x1030('0x6'));var config=require(_0x1030('0x7'));var controller=require(_0x1030('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1030('0x9')](_0x1030('0xa'),auth[_0x1030('0xb')](),controller['describe']);router['get']('/:id',auth[_0x1030('0xb')](),controller[_0x1030('0xc')]);router['post']('/',auth[_0x1030('0xb')](),controller[_0x1030('0xd')]);router[_0x1030('0xe')](_0x1030('0xf'),auth[_0x1030('0xb')](),controller[_0x1030('0x10')]);router[_0x1030('0x11')](_0x1030('0xf'),auth[_0x1030('0xb')](),controller['destroy']);module[_0x1030('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 99df250..7225e7f 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 _0x827e=['DATE','moment','sequelize','STRING'];(function(_0x42a5a7,_0x5a7809){var _0x10709f=function(_0x26036e){while(--_0x26036e){_0x42a5a7['push'](_0x42a5a7['shift']());}};_0x10709f(++_0x5a7809);}(_0x827e,0x161));var _0xe827=function(_0x145b39,_0x3561dd){_0x145b39=_0x145b39-0x0;var _0x15c617=_0x827e[_0x145b39];return _0x15c617;};'use strict';var moment=require(_0xe827('0x0'));var Sequelize=require(_0xe827('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe827('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe827('0x2')]},'joinAt':{'type':Sequelize[_0xe827('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe827('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe827('0x2')]}}; \ No newline at end of file +var _0x0631=['STRING','moment','exports'];(function(_0x9101f1,_0x20044c){var _0x366025=function(_0x51a080){while(--_0x51a080){_0x9101f1['push'](_0x9101f1['shift']());}};_0x366025(++_0x20044c);}(_0x0631,0xcd));var _0x1063=function(_0x5b9d3a,_0x1f1842){_0x5b9d3a=_0x5b9d3a-0x0;var _0x383375=_0x0631[_0x5b9d3a];return _0x383375;};'use strict';var moment=require(_0x1063('0x0'));var Sequelize=require('sequelize');module[_0x1063('0x1')]={'uniqueid':{'type':Sequelize[_0x1063('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1063('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index f2de620..c16a0a4 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 _0x18ca=['sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','rimraf','fast-json-patch','moment','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x24b731,_0xe8ddf6){var _0x42e58f=function(_0xe394f4){while(--_0xe394f4){_0x24b731['push'](_0x24b731['shift']());}};_0x42e58f(++_0xe8ddf6);}(_0x18ca,0x13e));var _0xa18c=function(_0x304324,_0x27d3af){_0x304324=_0x304324-0x0;var _0x4a200d=_0x18ca[_0x304324];return _0x4a200d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa18c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa18c('0x1'));var rp=require('request-promise');var moment=require(_0xa18c('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa18c('0x3'));var ejs=require(_0xa18c('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa18c('0x5'));var squel=require(_0xa18c('0x6'));var crypto=require(_0xa18c('0x7'));var jsforce=require(_0xa18c('0x8'));var deskjs=require(_0xa18c('0x9'));var toCsv=require(_0xa18c('0x3'));var querystring=require(_0xa18c('0xa'));var Papa=require(_0xa18c('0xb'));var Redis=require(_0xa18c('0xc'));var authService=require(_0xa18c('0xd'));var qs=require(_0xa18c('0xe'));var as=require(_0xa18c('0xf'));var hardwareService=require(_0xa18c('0x10'));var logger=require(_0xa18c('0x11'))('api');var utils=require(_0xa18c('0x12'));var config=require(_0xa18c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa18c('0x14'))['db'];function respondWithStatusCode(_0x1d074b,_0x377484){_0x377484=_0x377484||0xcc;return function(_0x4c8f4d){if(_0x4c8f4d){return _0x1d074b[_0xa18c('0x15')](_0x377484);}return _0x1d074b[_0xa18c('0x16')](_0x377484)[_0xa18c('0x17')]();};}function respondWithResult(_0x403933,_0x38bf40){_0x38bf40=_0x38bf40||0xc8;return function(_0xfa6c1b){if(_0xfa6c1b){return _0x403933[_0xa18c('0x16')](_0x38bf40)[_0xa18c('0x18')](_0xfa6c1b);}};}function respondWithFilteredResult(_0x5c7f72,_0x24159e){return function(_0x307478){if(_0x307478){var _0x3ddb37=typeof _0x24159e[_0xa18c('0x19')]===_0xa18c('0x1a')&&typeof _0x24159e[_0xa18c('0x1b')]===_0xa18c('0x1a');var _0x231fb5=_0x307478[_0xa18c('0x1c')];var _0x1d4685=_0x3ddb37?0x0:_0x24159e[_0xa18c('0x19')];var _0x9199f8=_0x3ddb37?_0x307478[_0xa18c('0x1c')]:_0x24159e[_0xa18c('0x19')]+_0x24159e[_0xa18c('0x1b')];var _0x3c0c08;if(_0x9199f8>=_0x231fb5){_0x9199f8=_0x231fb5;_0x3c0c08=0xc8;}else{_0x3c0c08=0xce;}_0x5c7f72['status'](_0x3c0c08);return _0x5c7f72[_0xa18c('0x1d')](_0xa18c('0x1e'),_0x1d4685+'-'+_0x9199f8+'/'+_0x231fb5)[_0xa18c('0x18')](_0x307478);}return null;};}function patchUpdates(_0x4240b0){return function(_0xc3a62c){try{jsonpatch[_0xa18c('0x1f')](_0xc3a62c,_0x4240b0,!![]);}catch(_0x4c10df){return BPromise[_0xa18c('0x20')](_0x4c10df);}return _0xc3a62c[_0xa18c('0x21')]();};}function saveUpdates(_0x2c2884,_0x1c473a){return function(_0x335739){if(_0x335739){return _0x335739[_0xa18c('0x22')](_0x2c2884)[_0xa18c('0x23')](function(_0x1afb00){return _0x1afb00;});}return null;};}function removeEntity(_0x20c4de,_0x13a097){return function(_0x34c0df){if(_0x34c0df){return _0x34c0df[_0xa18c('0x24')]()['then'](function(){_0x20c4de[_0xa18c('0x16')](0xcc)[_0xa18c('0x17')]();});}};}function handleEntityNotFound(_0x59d7df,_0x4ace5e){return function(_0x4f5268){if(!_0x4f5268){_0x59d7df['sendStatus'](0x194);}return _0x4f5268;};}function handleError(_0x52d37b,_0x36a5dd){_0x36a5dd=_0x36a5dd||0x1f4;return function(_0x3e8fcc){logger[_0xa18c('0x25')](_0x3e8fcc['stack']);if(_0x3e8fcc[_0xa18c('0x26')]){delete _0x3e8fcc[_0xa18c('0x26')];}_0x52d37b['status'](_0x36a5dd)[_0xa18c('0x27')](_0x3e8fcc);};}exports[_0xa18c('0x28')]=function(_0x36ea64,_0x388356){var _0x96abd1={},_0x3df2da={},_0x10103c={'count':0x0,'rows':[]};var _0x5952e3=_[_0xa18c('0x29')](db[_0xa18c('0x2a')][_0xa18c('0x2b')],function(_0x4690e0){return{'name':_0x4690e0[_0xa18c('0x2c')],'type':_0x4690e0[_0xa18c('0x2d')]['key']};});_0x3df2da['model']=_['map'](_0x5952e3,_0xa18c('0x26'));_0x3df2da[_0xa18c('0x2e')]=_[_0xa18c('0x2f')](_0x36ea64[_0xa18c('0x2e')]);_0x3df2da[_0xa18c('0x30')]=_['intersection'](_0x3df2da[_0xa18c('0x31')],_0x3df2da[_0xa18c('0x2e')]);_0x96abd1[_0xa18c('0x32')]=_[_0xa18c('0x33')](_0x3df2da[_0xa18c('0x31')],qs['fields'](_0x36ea64['query'][_0xa18c('0x34')]));_0x96abd1['attributes']=_0x96abd1[_0xa18c('0x32')][_0xa18c('0x35')]?_0x96abd1[_0xa18c('0x32')]:_0x3df2da[_0xa18c('0x31')];if(!_0x36ea64[_0xa18c('0x2e')][_0xa18c('0x36')](_0xa18c('0x37'))){_0x96abd1[_0xa18c('0x1b')]=qs['limit'](_0x36ea64[_0xa18c('0x2e')][_0xa18c('0x1b')]);_0x96abd1[_0xa18c('0x19')]=qs[_0xa18c('0x19')](_0x36ea64[_0xa18c('0x2e')][_0xa18c('0x19')]);}_0x96abd1[_0xa18c('0x38')]=qs[_0xa18c('0x39')](_0x36ea64[_0xa18c('0x2e')][_0xa18c('0x39')]);_0x96abd1[_0xa18c('0x3a')]=qs[_0xa18c('0x30')](_[_0xa18c('0x3b')](_0x36ea64[_0xa18c('0x2e')],_0x3df2da[_0xa18c('0x30')]),_0x5952e3);if(_0x36ea64[_0xa18c('0x2e')][_0xa18c('0x3c')]){_0x96abd1[_0xa18c('0x3a')]=_['merge'](_0x96abd1['where'],{'$or':_[_0xa18c('0x29')](_0x5952e3,function(_0x4ffa77){if(_0x4ffa77[_0xa18c('0x2d')]!==_0xa18c('0x3d')){var _0x34e82f={};_0x34e82f[_0x4ffa77[_0xa18c('0x26')]]={'$like':'%'+_0x36ea64['query'][_0xa18c('0x3c')]+'%'};return _0x34e82f;}})});}_0x96abd1=_['merge']({},_0x96abd1,_0x36ea64[_0xa18c('0x3e')]);var _0x503fed={'where':_0x96abd1[_0xa18c('0x3a')]};return db['SmsQueueReport'][_0xa18c('0x1c')](_0x503fed)['then'](function(_0x594410){_0x10103c[_0xa18c('0x1c')]=_0x594410;if(_0x36ea64['query'][_0xa18c('0x3f')]){_0x96abd1[_0xa18c('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xa18c('0x41')](_0x96abd1);})[_0xa18c('0x23')](function(_0x2ed13c){_0x10103c[_0xa18c('0x42')]=_0x2ed13c;return _0x10103c;})[_0xa18c('0x23')](respondWithFilteredResult(_0x388356,_0x96abd1))[_0xa18c('0x43')](handleError(_0x388356,null));};exports[_0xa18c('0x44')]=function(_0x5cdfd4,_0x252261){var _0x15e7ab={'raw':!![],'where':{'id':_0x5cdfd4[_0xa18c('0x45')]['id']}},_0x3405b6={};_0x3405b6[_0xa18c('0x31')]=_[_0xa18c('0x2f')](db[_0xa18c('0x2a')][_0xa18c('0x2b')]);_0x3405b6[_0xa18c('0x2e')]=_[_0xa18c('0x2f')](_0x5cdfd4[_0xa18c('0x2e')]);_0x3405b6[_0xa18c('0x30')]=_[_0xa18c('0x33')](_0x3405b6['model'],_0x3405b6['query']);_0x15e7ab[_0xa18c('0x32')]=_['intersection'](_0x3405b6['model'],qs[_0xa18c('0x34')](_0x5cdfd4[_0xa18c('0x2e')][_0xa18c('0x34')]));_0x15e7ab[_0xa18c('0x32')]=_0x15e7ab[_0xa18c('0x32')][_0xa18c('0x35')]?_0x15e7ab[_0xa18c('0x32')]:_0x3405b6[_0xa18c('0x31')];if(_0x5cdfd4['query'][_0xa18c('0x3f')]){_0x15e7ab['include']=[{'all':!![]}];}_0x15e7ab=_[_0xa18c('0x46')]({},_0x15e7ab,_0x5cdfd4[_0xa18c('0x3e')]);return db[_0xa18c('0x2a')][_0xa18c('0x47')](_0x15e7ab)[_0xa18c('0x23')](handleEntityNotFound(_0x252261,null))[_0xa18c('0x23')](respondWithResult(_0x252261,null))[_0xa18c('0x43')](handleError(_0x252261,null));};exports[_0xa18c('0x48')]=function(_0x781d34,_0x2690c1){return db['SmsQueueReport'][_0xa18c('0x48')](_0x781d34[_0xa18c('0x49')],{})[_0xa18c('0x23')](respondWithResult(_0x2690c1,0xc9))[_0xa18c('0x43')](handleError(_0x2690c1,null));};exports[_0xa18c('0x22')]=function(_0x24b02c,_0x177a13){if(_0x24b02c[_0xa18c('0x49')]['id']){delete _0x24b02c['body']['id'];}return db['SmsQueueReport'][_0xa18c('0x47')]({'where':{'id':_0x24b02c[_0xa18c('0x45')]['id']}})[_0xa18c('0x23')](handleEntityNotFound(_0x177a13,null))[_0xa18c('0x23')](saveUpdates(_0x24b02c[_0xa18c('0x49')],null))[_0xa18c('0x23')](respondWithResult(_0x177a13,null))[_0xa18c('0x43')](handleError(_0x177a13,null));};exports[_0xa18c('0x24')]=function(_0xfba172,_0x49920c){return db[_0xa18c('0x2a')][_0xa18c('0x47')]({'where':{'id':_0xfba172['params']['id']}})[_0xa18c('0x23')](handleEntityNotFound(_0x49920c,null))[_0xa18c('0x23')](removeEntity(_0x49920c,null))[_0xa18c('0x43')](handleError(_0x49920c,null));};exports[_0xa18c('0x4a')]=function(_0x5523fb,_0x5144c0){return db[_0xa18c('0x2a')][_0xa18c('0x4a')]()[_0xa18c('0x23')](respondWithResult(_0x5144c0,null))['catch'](handleError(_0x5144c0,null));}; \ No newline at end of file +var _0x1195=['reject','save','update','then','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','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','count','set'];(function(_0x46617f,_0x40574f){var _0x23d2f3=function(_0x5084a0){while(--_0x5084a0){_0x46617f['push'](_0x46617f['shift']());}};_0x23d2f3(++_0x40574f);}(_0x1195,0xc0));var _0x5119=function(_0x51d111,_0x53ddbc){_0x51d111=_0x51d111-0x0;var _0xdaeb2e=_0x1195[_0x51d111];return _0xdaeb2e;};'use strict';var emlformat=require(_0x5119('0x0'));var rimraf=require(_0x5119('0x1'));var zipdir=require(_0x5119('0x2'));var jsonpatch=require(_0x5119('0x3'));var rp=require(_0x5119('0x4'));var moment=require(_0x5119('0x5'));var BPromise=require(_0x5119('0x6'));var Mustache=require(_0x5119('0x7'));var util=require(_0x5119('0x8'));var path=require(_0x5119('0x9'));var sox=require(_0x5119('0xa'));var csv=require(_0x5119('0xb'));var ejs=require(_0x5119('0xc'));var fs=require('fs');var fs_extra=require(_0x5119('0xd'));var _=require('lodash');var squel=require(_0x5119('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5119('0xb'));var querystring=require(_0x5119('0xf'));var Papa=require(_0x5119('0x10'));var Redis=require('ioredis');var authService=require(_0x5119('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5119('0x12'));var hardwareService=require(_0x5119('0x13'));var logger=require(_0x5119('0x14'))(_0x5119('0x15'));var utils=require(_0x5119('0x16'));var config=require(_0x5119('0x17'));var licenseUtil=require(_0x5119('0x18'));var db=require(_0x5119('0x19'))['db'];function respondWithStatusCode(_0x18a4aa,_0x4b124d){_0x4b124d=_0x4b124d||0xcc;return function(_0x491434){if(_0x491434){return _0x18a4aa[_0x5119('0x1a')](_0x4b124d);}return _0x18a4aa[_0x5119('0x1b')](_0x4b124d)[_0x5119('0x1c')]();};}function respondWithResult(_0x614a71,_0x514189){_0x514189=_0x514189||0xc8;return function(_0x43058b){if(_0x43058b){return _0x614a71[_0x5119('0x1b')](_0x514189)[_0x5119('0x1d')](_0x43058b);}};}function respondWithFilteredResult(_0x38d552,_0x8760db){return function(_0x1339aa){if(_0x1339aa){var _0x146756=typeof _0x8760db[_0x5119('0x1e')]==='undefined'&&typeof _0x8760db['limit']==='undefined';var _0x2b2153=_0x1339aa[_0x5119('0x1f')];var _0x3fbd82=_0x146756?0x0:_0x8760db[_0x5119('0x1e')];var _0x4a6cb4=_0x146756?_0x1339aa['count']:_0x8760db[_0x5119('0x1e')]+_0x8760db['limit'];var _0x2f8733;if(_0x4a6cb4>=_0x2b2153){_0x4a6cb4=_0x2b2153;_0x2f8733=0xc8;}else{_0x2f8733=0xce;}_0x38d552['status'](_0x2f8733);return _0x38d552[_0x5119('0x20')]('Content-Range',_0x3fbd82+'-'+_0x4a6cb4+'/'+_0x2b2153)[_0x5119('0x1d')](_0x1339aa);}return null;};}function patchUpdates(_0x1cc91b){return function(_0x39fb7f){try{jsonpatch['apply'](_0x39fb7f,_0x1cc91b,!![]);}catch(_0x511566){return BPromise[_0x5119('0x21')](_0x511566);}return _0x39fb7f[_0x5119('0x22')]();};}function saveUpdates(_0xe6330e,_0x2b5457){return function(_0x3b58f0){if(_0x3b58f0){return _0x3b58f0[_0x5119('0x23')](_0xe6330e)[_0x5119('0x24')](function(_0x350fc1){return _0x350fc1;});}return null;};}function removeEntity(_0x1c5e12,_0x1097ea){return function(_0x31d1cb){if(_0x31d1cb){return _0x31d1cb['destroy']()[_0x5119('0x24')](function(){_0x1c5e12[_0x5119('0x1b')](0xcc)[_0x5119('0x1c')]();});}};}function handleEntityNotFound(_0x5a3895,_0x5ad4c1){return function(_0x2f1cbe){if(!_0x2f1cbe){_0x5a3895[_0x5119('0x1a')](0x194);}return _0x2f1cbe;};}function handleError(_0x934128,_0x4307e3){_0x4307e3=_0x4307e3||0x1f4;return function(_0x41952a){logger[_0x5119('0x25')](_0x41952a[_0x5119('0x26')]);if(_0x41952a['name']){delete _0x41952a[_0x5119('0x27')];}_0x934128[_0x5119('0x1b')](_0x4307e3)['send'](_0x41952a);};}exports[_0x5119('0x28')]=function(_0x5360a6,_0x5183d4){var _0x374b0d={},_0x46557e={},_0x3bfadc={'count':0x0,'rows':[]};var _0x4b0fec=_[_0x5119('0x29')](db[_0x5119('0x2a')][_0x5119('0x2b')],function(_0x3ce5da){return{'name':_0x3ce5da[_0x5119('0x2c')],'type':_0x3ce5da[_0x5119('0x2d')]['key']};});_0x46557e[_0x5119('0x2e')]=_[_0x5119('0x29')](_0x4b0fec,'name');_0x46557e['query']=_[_0x5119('0x2f')](_0x5360a6[_0x5119('0x30')]);_0x46557e[_0x5119('0x31')]=_[_0x5119('0x32')](_0x46557e[_0x5119('0x2e')],_0x46557e['query']);_0x374b0d['attributes']=_[_0x5119('0x32')](_0x46557e['model'],qs['fields'](_0x5360a6['query'][_0x5119('0x33')]));_0x374b0d[_0x5119('0x34')]=_0x374b0d['attributes'][_0x5119('0x35')]?_0x374b0d[_0x5119('0x34')]:_0x46557e[_0x5119('0x2e')];if(!_0x5360a6[_0x5119('0x30')][_0x5119('0x36')](_0x5119('0x37'))){_0x374b0d[_0x5119('0x38')]=qs['limit'](_0x5360a6[_0x5119('0x30')][_0x5119('0x38')]);_0x374b0d[_0x5119('0x1e')]=qs[_0x5119('0x1e')](_0x5360a6[_0x5119('0x30')][_0x5119('0x1e')]);}_0x374b0d[_0x5119('0x39')]=qs[_0x5119('0x3a')](_0x5360a6['query'][_0x5119('0x3a')]);_0x374b0d[_0x5119('0x3b')]=qs[_0x5119('0x31')](_[_0x5119('0x3c')](_0x5360a6[_0x5119('0x30')],_0x46557e[_0x5119('0x31')]),_0x4b0fec);if(_0x5360a6[_0x5119('0x30')][_0x5119('0x3d')]){_0x374b0d[_0x5119('0x3b')]=_[_0x5119('0x3e')](_0x374b0d[_0x5119('0x3b')],{'$or':_['map'](_0x4b0fec,function(_0x19b40a){if(_0x19b40a[_0x5119('0x2d')]!==_0x5119('0x3f')){var _0x425a2a={};_0x425a2a[_0x19b40a[_0x5119('0x27')]]={'$like':'%'+_0x5360a6[_0x5119('0x30')]['filter']+'%'};return _0x425a2a;}})});}_0x374b0d=_[_0x5119('0x3e')]({},_0x374b0d,_0x5360a6[_0x5119('0x40')]);var _0x1ab76={'where':_0x374b0d[_0x5119('0x3b')]};return db[_0x5119('0x2a')][_0x5119('0x1f')](_0x1ab76)[_0x5119('0x24')](function(_0x37d482){_0x3bfadc[_0x5119('0x1f')]=_0x37d482;if(_0x5360a6['query'][_0x5119('0x41')]){_0x374b0d['include']=[{'all':!![]}];}return db[_0x5119('0x2a')]['findAll'](_0x374b0d);})[_0x5119('0x24')](function(_0x3c9b2b){_0x3bfadc[_0x5119('0x42')]=_0x3c9b2b;return _0x3bfadc;})[_0x5119('0x24')](respondWithFilteredResult(_0x5183d4,_0x374b0d))[_0x5119('0x43')](handleError(_0x5183d4,null));};exports[_0x5119('0x44')]=function(_0x3e713e,_0x269670){var _0x1b9231={'raw':!![],'where':{'id':_0x3e713e[_0x5119('0x45')]['id']}},_0x5a450f={};_0x5a450f[_0x5119('0x2e')]=_['keys'](db[_0x5119('0x2a')][_0x5119('0x2b')]);_0x5a450f[_0x5119('0x30')]=_[_0x5119('0x2f')](_0x3e713e[_0x5119('0x30')]);_0x5a450f['filters']=_[_0x5119('0x32')](_0x5a450f[_0x5119('0x2e')],_0x5a450f[_0x5119('0x30')]);_0x1b9231[_0x5119('0x34')]=_[_0x5119('0x32')](_0x5a450f[_0x5119('0x2e')],qs[_0x5119('0x33')](_0x3e713e['query']['fields']));_0x1b9231[_0x5119('0x34')]=_0x1b9231[_0x5119('0x34')][_0x5119('0x35')]?_0x1b9231[_0x5119('0x34')]:_0x5a450f[_0x5119('0x2e')];if(_0x3e713e[_0x5119('0x30')][_0x5119('0x41')]){_0x1b9231[_0x5119('0x46')]=[{'all':!![]}];}_0x1b9231=_[_0x5119('0x3e')]({},_0x1b9231,_0x3e713e['options']);return db[_0x5119('0x2a')][_0x5119('0x47')](_0x1b9231)['then'](handleEntityNotFound(_0x269670,null))['then'](respondWithResult(_0x269670,null))['catch'](handleError(_0x269670,null));};exports[_0x5119('0x48')]=function(_0x4f98ae,_0x12868a){return db[_0x5119('0x2a')][_0x5119('0x48')](_0x4f98ae[_0x5119('0x49')],{})[_0x5119('0x24')](respondWithResult(_0x12868a,0xc9))[_0x5119('0x43')](handleError(_0x12868a,null));};exports['update']=function(_0x1021a4,_0x3d2b6b){if(_0x1021a4[_0x5119('0x49')]['id']){delete _0x1021a4['body']['id'];}return db[_0x5119('0x2a')][_0x5119('0x47')]({'where':{'id':_0x1021a4['params']['id']}})[_0x5119('0x24')](handleEntityNotFound(_0x3d2b6b,null))[_0x5119('0x24')](saveUpdates(_0x1021a4[_0x5119('0x49')],null))['then'](respondWithResult(_0x3d2b6b,null))['catch'](handleError(_0x3d2b6b,null));};exports[_0x5119('0x4a')]=function(_0x52f05d,_0x146e79){return db[_0x5119('0x2a')][_0x5119('0x47')]({'where':{'id':_0x52f05d['params']['id']}})['then'](handleEntityNotFound(_0x146e79,null))['then'](removeEntity(_0x146e79,null))[_0x5119('0x43')](handleError(_0x146e79,null));};exports['describe']=function(_0x565d41,_0x596121){return db[_0x5119('0x2a')]['describe']()[_0x5119('0x24')](respondWithResult(_0x596121,null))[_0x5119('0x43')](handleError(_0x596121,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 4b4d108..7810eb2 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(_0x15781b,_0x4db9bb){var _0x20f955=function(_0x636ad0){while(--_0x636ad0){_0x15781b['push'](_0x15781b['shift']());}};_0x20f955(++_0x4db9bb);}(_0xe706,0xa3));var _0x6e70=function(_0x244a5f,_0x3652c3){_0x244a5f=_0x244a5f-0x0;var _0x115943=_0xe706[_0x244a5f];return _0x115943;};'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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x1ecab2,_0x2043bb){var _0x128890=function(_0x47fbda){while(--_0x47fbda){_0x1ecab2['push'](_0x1ecab2['shift']());}};_0x128890(++_0x2043bb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xcb91[_0x25701b];return _0x3a8a2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ae5f7bc..c160a6f 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 _0x4195=['../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','stringify','UpdateSmsQueueReport','update','body','where','limit','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x1d2771,_0x381a06){var _0x814139=function(_0x190738){while(--_0x190738){_0x1d2771['push'](_0x1d2771['shift']());}};_0x814139(++_0x381a06);}(_0x4195,0xb5));var _0x5419=function(_0x5cc655,_0x4b6145){_0x5cc655=_0x5cc655-0x0;var _0x244379=_0x4195[_0x5cc655];return _0x244379;};'use strict';var _=require(_0x5419('0x0'));var util=require(_0x5419('0x1'));var moment=require('moment');var BPromise=require(_0x5419('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5419('0x3'))['db'];var utils=require(_0x5419('0x4'));var logger=require(_0x5419('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5419('0x6'));var client=jayson['client'][_0x5419('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x574160,_0x43a840,_0x32fdda){return new BPromise(function(_0x24a843,_0x111ce7){return client[_0x5419('0x8')](_0x574160,_0x32fdda)[_0x5419('0x9')](function(_0x318197){logger[_0x5419('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x43a840,_0x5419('0xb'));logger[_0x5419('0xc')](_0x5419('0xd'),_0x43a840,_0x5419('0xb'),JSON['stringify'](_0x318197));if(_0x318197[_0x5419('0xe')]){if(_0x318197[_0x5419('0xe')][_0x5419('0xf')]===0x1f4){logger[_0x5419('0xe')](_0x5419('0x10'),_0x43a840,_0x318197[_0x5419('0xe')][_0x5419('0x11')]);return _0x111ce7(_0x318197[_0x5419('0xe')]['message']);}logger['error'](_0x5419('0x10'),_0x43a840,_0x318197[_0x5419('0xe')][_0x5419('0x11')]);return _0x24a843(_0x318197[_0x5419('0xe')]['message']);}else{logger[_0x5419('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x43a840,_0x5419('0xb'));_0x24a843(_0x318197[_0x5419('0x12')]['message']);}})[_0x5419('0x13')](function(_0x1eb6f0){logger[_0x5419('0xe')](_0x5419('0x10'),_0x43a840,_0x1eb6f0);_0x111ce7(_0x1eb6f0);});});}exports[_0x5419('0x14')]=function(_0x2f70d5){var _0x35a729=this;return new Promise(function(_0x40f8fa,_0x166e46){return db[_0x5419('0x15')][_0x5419('0x16')](_0x2f70d5['body'],{'raw':_0x2f70d5[_0x5419('0x17')]?_0x2f70d5[_0x5419('0x17')][_0x5419('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3e4166){logger[_0x5419('0xa')](_0x5419('0x14'),_0x2f70d5);logger[_0x5419('0xc')](_0x5419('0x14'),_0x2f70d5,JSON[_0x5419('0x19')](_0x3e4166));_0x40f8fa(_0x3e4166);})[_0x5419('0x13')](function(_0x533d76){logger[_0x5419('0xe')]('CreateSmsQueueReport',_0x533d76[_0x5419('0x11')],_0x2f70d5);_0x166e46(_0x35a729[_0x5419('0xe')](0x1f4,_0x533d76['message']));});});};exports[_0x5419('0x1a')]=function(_0x3c7217){var _0x2309d8=this;return new Promise(function(_0xcf176f,_0x1a0d00){return db['SmsQueueReport'][_0x5419('0x1b')](_0x3c7217[_0x5419('0x1c')],{'raw':_0x3c7217[_0x5419('0x17')]?_0x3c7217[_0x5419('0x17')][_0x5419('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c7217['options']?_0x3c7217[_0x5419('0x17')][_0x5419('0x1d')]||null:null,'attributes':_0x3c7217['options']?_0x3c7217['options']['attributes']||null:null,'limit':_0x3c7217[_0x5419('0x17')]?_0x3c7217[_0x5419('0x17')][_0x5419('0x1e')]||null:null})[_0x5419('0x9')](function(_0x1389ef){logger[_0x5419('0xa')](_0x5419('0x1a'),_0x3c7217);logger[_0x5419('0xc')](_0x5419('0x1a'),_0x3c7217,JSON[_0x5419('0x19')](_0x1389ef));_0xcf176f(_0x1389ef);})[_0x5419('0x13')](function(_0x16703c){logger['error'](_0x5419('0x1a'),_0x16703c['message'],_0x3c7217);_0x1a0d00(_0x2309d8[_0x5419('0xe')](0x1f4,_0x16703c[_0x5419('0x11')]));});});}; \ No newline at end of file +var _0x5939=['attributes','limit','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','SmsQueueReport','create','body','options','raw','info','CreateSmsQueueReport','UpdateSmsQueueReport','update','where'];(function(_0x3ad556,_0x554c1c){var _0xac7a13=function(_0xadc515){while(--_0xadc515){_0x3ad556['push'](_0x3ad556['shift']());}};_0xac7a13(++_0x554c1c);}(_0x5939,0x103));var _0x9593=function(_0x330fb3,_0x17775d){_0x330fb3=_0x330fb3-0x0;var _0x578ebe=_0x5939[_0x330fb3];return _0x578ebe;};'use strict';var _=require(_0x9593('0x0'));var util=require('util');var moment=require(_0x9593('0x1'));var BPromise=require('bluebird');var rs=require(_0x9593('0x2'));var fs=require('fs');var Redis=require(_0x9593('0x3'));var db=require(_0x9593('0x4'))['db'];var utils=require(_0x9593('0x5'));var logger=require(_0x9593('0x6'))(_0x9593('0x7'));var config=require(_0x9593('0x8'));var jayson=require(_0x9593('0x9'));var client=jayson['client'][_0x9593('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x498a30,_0x216eb5,_0x3b6686){return new BPromise(function(_0x38d8c3,_0x6fd3fb){return client['request'](_0x498a30,_0x3b6686)[_0x9593('0xb')](function(_0x5f3043){logger['info'](_0x9593('0xc'),_0x216eb5,_0x9593('0xd'));logger[_0x9593('0xe')](_0x9593('0xf'),_0x216eb5,_0x9593('0xd'),JSON['stringify'](_0x5f3043));if(_0x5f3043[_0x9593('0x10')]){if(_0x5f3043[_0x9593('0x10')][_0x9593('0x11')]===0x1f4){logger[_0x9593('0x10')](_0x9593('0xc'),_0x216eb5,_0x5f3043[_0x9593('0x10')]['message']);return _0x6fd3fb(_0x5f3043[_0x9593('0x10')]['message']);}logger['error'](_0x9593('0xc'),_0x216eb5,_0x5f3043[_0x9593('0x10')]['message']);return _0x38d8c3(_0x5f3043[_0x9593('0x10')][_0x9593('0x12')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x216eb5,_0x9593('0xd'));_0x38d8c3(_0x5f3043['result'][_0x9593('0x12')]);}})['catch'](function(_0xfde0ee){logger[_0x9593('0x10')](_0x9593('0xc'),_0x216eb5,_0xfde0ee);_0x6fd3fb(_0xfde0ee);});});}exports['CreateSmsQueueReport']=function(_0x2a7225){var _0x102d67=this;return new Promise(function(_0x1c1033,_0x10bc0d){return db[_0x9593('0x13')][_0x9593('0x14')](_0x2a7225[_0x9593('0x15')],{'raw':_0x2a7225[_0x9593('0x16')]?_0x2a7225[_0x9593('0x16')][_0x9593('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x66c5b4){logger[_0x9593('0x18')](_0x9593('0x19'),_0x2a7225);logger[_0x9593('0xe')]('CreateSmsQueueReport',_0x2a7225,JSON['stringify'](_0x66c5b4));_0x1c1033(_0x66c5b4);})['catch'](function(_0x27a5fc){logger[_0x9593('0x10')](_0x9593('0x19'),_0x27a5fc[_0x9593('0x12')],_0x2a7225);_0x10bc0d(_0x102d67[_0x9593('0x10')](0x1f4,_0x27a5fc[_0x9593('0x12')]));});});};exports[_0x9593('0x1a')]=function(_0x3e005c){var _0xe3bb7e=this;return new Promise(function(_0x9240be,_0x47bb5e){return db['SmsQueueReport'][_0x9593('0x1b')](_0x3e005c[_0x9593('0x15')],{'raw':_0x3e005c[_0x9593('0x16')]?_0x3e005c[_0x9593('0x16')][_0x9593('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e005c[_0x9593('0x16')]?_0x3e005c[_0x9593('0x16')][_0x9593('0x1c')]||null:null,'attributes':_0x3e005c[_0x9593('0x16')]?_0x3e005c['options'][_0x9593('0x1d')]||null:null,'limit':_0x3e005c['options']?_0x3e005c[_0x9593('0x16')][_0x9593('0x1e')]||null:null})[_0x9593('0xb')](function(_0x2b6d6d){logger[_0x9593('0x18')]('UpdateSmsQueueReport',_0x3e005c);logger['debug'](_0x9593('0x1a'),_0x3e005c,JSON[_0x9593('0x1f')](_0x2b6d6d));_0x9240be(_0x2b6d6d);})['catch'](function(_0x290a02){logger[_0x9593('0x10')](_0x9593('0x1a'),_0x290a02['message'],_0x3e005c);_0x47bb5e(_0xe3bb7e[_0x9593('0x10')](0x1f4,_0x290a02[_0x9593('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index fef4286..17ed51d 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 _0xa9b1=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a9b('0x0'));var timeout=require(_0x1a9b('0x1'));var express=require(_0x1a9b('0x2'));var router=express[_0x1a9b('0x3')]();var fs_extra=require(_0x1a9b('0x4'));var auth=require(_0x1a9b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x1a9b('0x6')]('/',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0x8')]);router[_0x1a9b('0x6')](_0x1a9b('0x9'),auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xa')]);router[_0x1a9b('0x6')](_0x1a9b('0xb'),auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xc')]);router[_0x1a9b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a9b('0xe')](_0x1a9b('0xb'),auth[_0x1a9b('0x7')](),controller['update']);router['delete']('/:id',auth[_0x1a9b('0x7')](),controller[_0x1a9b('0xf')]);module[_0x1a9b('0x10')]=router; \ No newline at end of file +var _0x8375=['/describe','/:id','show','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x8375,0xa8));var _0x5837=function(_0x26c00c,_0x51caf8){_0x26c00c=_0x26c00c-0x0;var _0x4efda1=_0x8375[_0x26c00c];return _0x4efda1;};'use strict';var multer=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var path=require(_0x5837('0x2'));var timeout=require('connect-timeout');var express=require(_0x5837('0x3'));var router=express[_0x5837('0x4')]();var fs_extra=require(_0x5837('0x5'));var auth=require(_0x5837('0x6'));var interaction=require(_0x5837('0x7'));var config=require(_0x5837('0x8'));var controller=require('./smsTransferReport.controller');router[_0x5837('0x9')]('/',auth[_0x5837('0xa')](),controller[_0x5837('0xb')]);router[_0x5837('0x9')](_0x5837('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x5837('0x9')](_0x5837('0xd'),auth['isAuthenticated'](),controller[_0x5837('0xe')]);router['post']('/',auth[_0x5837('0xa')](),controller[_0x5837('0xf')]);router[_0x5837('0x10')](_0x5837('0xd'),auth[_0x5837('0xa')](),controller[_0x5837('0x11')]);router['delete'](_0x5837('0xd'),auth[_0x5837('0xa')](),controller[_0x5837('0x12')]);module[_0x5837('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 191c855..a58d734 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x32f3f5,_0x3c1baf){_0x32f3f5=_0x32f3f5-0x0;var _0x51c954=_0xb43b[_0x32f3f5];return _0x51c954;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x18be08,_0x1329bc){var _0x5cdf81=function(_0x5ced79){while(--_0x5ced79){_0x18be08['push'](_0x18be08['shift']());}};_0x5cdf81(++_0x1329bc);}(_0x008c,0x188));var _0xc008=function(_0x32ca62,_0x18fe6a){_0x32ca62=_0x32ca62-0x0;var _0x175d88=_0x008c[_0x32ca62];return _0x175d88;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 98939fe..44659a9 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 _0xc35e=['order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','length','options','find','create','body','params','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','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','offset','undefined','limit','count','set','json','apply','update','destroy','then','end','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit'];(function(_0x132aeb,_0xf51c40){var _0x5348b2=function(_0x54c369){while(--_0x54c369){_0x132aeb['push'](_0x132aeb['shift']());}};_0x5348b2(++_0xf51c40);}(_0xc35e,0x1d6));var _0xec35=function(_0x422e1f,_0x27dae5){_0x422e1f=_0x422e1f-0x0;var _0x55f806=_0xc35e[_0x422e1f];return _0x55f806;};'use strict';var emlformat=require(_0xec35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec35('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec35('0x2'));var moment=require('moment');var BPromise=require(_0xec35('0x3'));var Mustache=require(_0xec35('0x4'));var util=require(_0xec35('0x5'));var path=require(_0xec35('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec35('0x7'));var _=require(_0xec35('0x8'));var squel=require(_0xec35('0x9'));var crypto=require(_0xec35('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xec35('0xb'));var toCsv=require(_0xec35('0xc'));var querystring=require(_0xec35('0xd'));var Papa=require(_0xec35('0xe'));var Redis=require(_0xec35('0xf'));var authService=require(_0xec35('0x10'));var qs=require(_0xec35('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec35('0x12'));var logger=require('../../config/logger')(_0xec35('0x13'));var utils=require(_0xec35('0x14'));var config=require(_0xec35('0x15'));var licenseUtil=require(_0xec35('0x16'));var db=require(_0xec35('0x17'))['db'];function respondWithStatusCode(_0x2d010b,_0x2383ee){_0x2383ee=_0x2383ee||0xcc;return function(_0x1c61c1){if(_0x1c61c1){return _0x2d010b[_0xec35('0x18')](_0x2383ee);}return _0x2d010b['status'](_0x2383ee)['end']();};}function respondWithResult(_0x59075b,_0x3b69b0){_0x3b69b0=_0x3b69b0||0xc8;return function(_0x5e9f83){if(_0x5e9f83){return _0x59075b[_0xec35('0x19')](_0x3b69b0)['json'](_0x5e9f83);}};}function respondWithFilteredResult(_0x40e465,_0x48b57d){return function(_0x27cf20){if(_0x27cf20){var _0x555ae6=typeof _0x48b57d[_0xec35('0x1a')]===_0xec35('0x1b')&&typeof _0x48b57d[_0xec35('0x1c')]===_0xec35('0x1b');var _0xf50d8f=_0x27cf20['count'];var _0x5a4671=_0x555ae6?0x0:_0x48b57d[_0xec35('0x1a')];var _0x2173ec=_0x555ae6?_0x27cf20[_0xec35('0x1d')]:_0x48b57d[_0xec35('0x1a')]+_0x48b57d[_0xec35('0x1c')];var _0x43c53b;if(_0x2173ec>=_0xf50d8f){_0x2173ec=_0xf50d8f;_0x43c53b=0xc8;}else{_0x43c53b=0xce;}_0x40e465[_0xec35('0x19')](_0x43c53b);return _0x40e465[_0xec35('0x1e')]('Content-Range',_0x5a4671+'-'+_0x2173ec+'/'+_0xf50d8f)[_0xec35('0x1f')](_0x27cf20);}return null;};}function patchUpdates(_0x2b9d5c){return function(_0x1a0db5){try{jsonpatch[_0xec35('0x20')](_0x1a0db5,_0x2b9d5c,!![]);}catch(_0x4f9b2b){return BPromise['reject'](_0x4f9b2b);}return _0x1a0db5['save']();};}function saveUpdates(_0xf22cd,_0x1c87f1){return function(_0x117867){if(_0x117867){return _0x117867[_0xec35('0x21')](_0xf22cd)['then'](function(_0x86c015){return _0x86c015;});}return null;};}function removeEntity(_0x418a29,_0x9e91f2){return function(_0x4f4b16){if(_0x4f4b16){return _0x4f4b16[_0xec35('0x22')]()[_0xec35('0x23')](function(){_0x418a29[_0xec35('0x19')](0xcc)[_0xec35('0x24')]();});}};}function handleEntityNotFound(_0x18a2d7,_0x4650f6){return function(_0x2b16ee){if(!_0x2b16ee){_0x18a2d7['sendStatus'](0x194);}return _0x2b16ee;};}function handleError(_0x1b01f2,_0x3e540d){_0x3e540d=_0x3e540d||0x1f4;return function(_0x176d4e){logger[_0xec35('0x25')](_0x176d4e[_0xec35('0x26')]);if(_0x176d4e['name']){delete _0x176d4e[_0xec35('0x27')];}_0x1b01f2[_0xec35('0x19')](_0x3e540d)['send'](_0x176d4e);};}exports[_0xec35('0x28')]=function(_0x1cb3fa,_0x48b42d){var _0x5093a0={},_0x1e0b5f={},_0x2f0d46={'count':0x0,'rows':[]};var _0x3c1286=_[_0xec35('0x29')](db[_0xec35('0x2a')][_0xec35('0x2b')],function(_0x335d15){return{'name':_0x335d15[_0xec35('0x2c')],'type':_0x335d15[_0xec35('0x2d')][_0xec35('0x2e')]};});_0x1e0b5f['model']=_[_0xec35('0x29')](_0x3c1286,_0xec35('0x27'));_0x1e0b5f['query']=_['keys'](_0x1cb3fa[_0xec35('0x2f')]);_0x1e0b5f[_0xec35('0x30')]=_[_0xec35('0x31')](_0x1e0b5f['model'],_0x1e0b5f[_0xec35('0x2f')]);_0x5093a0[_0xec35('0x32')]=_[_0xec35('0x31')](_0x1e0b5f[_0xec35('0x33')],qs[_0xec35('0x34')](_0x1cb3fa[_0xec35('0x2f')][_0xec35('0x34')]));_0x5093a0['attributes']=_0x5093a0[_0xec35('0x32')]['length']?_0x5093a0[_0xec35('0x32')]:_0x1e0b5f[_0xec35('0x33')];if(!_0x1cb3fa[_0xec35('0x2f')][_0xec35('0x35')](_0xec35('0x36'))){_0x5093a0[_0xec35('0x1c')]=qs[_0xec35('0x1c')](_0x1cb3fa[_0xec35('0x2f')]['limit']);_0x5093a0['offset']=qs[_0xec35('0x1a')](_0x1cb3fa['query'][_0xec35('0x1a')]);}_0x5093a0[_0xec35('0x37')]=qs[_0xec35('0x38')](_0x1cb3fa[_0xec35('0x2f')][_0xec35('0x38')]);_0x5093a0[_0xec35('0x39')]=qs[_0xec35('0x30')](_['pick'](_0x1cb3fa[_0xec35('0x2f')],_0x1e0b5f[_0xec35('0x30')]),_0x3c1286);if(_0x1cb3fa['query'][_0xec35('0x3a')]){_0x5093a0[_0xec35('0x39')]=_[_0xec35('0x3b')](_0x5093a0['where'],{'$or':_['map'](_0x3c1286,function(_0x2c5ff7){if(_0x2c5ff7[_0xec35('0x2d')]!==_0xec35('0x3c')){var _0x3254bf={};_0x3254bf[_0x2c5ff7['name']]={'$like':'%'+_0x1cb3fa[_0xec35('0x2f')][_0xec35('0x3a')]+'%'};return _0x3254bf;}})});}_0x5093a0=_[_0xec35('0x3b')]({},_0x5093a0,_0x1cb3fa['options']);var _0x509f25={'where':_0x5093a0[_0xec35('0x39')]};return db['SmsTransferReport'][_0xec35('0x1d')](_0x509f25)['then'](function(_0x2b4cf6){_0x2f0d46[_0xec35('0x1d')]=_0x2b4cf6;if(_0x1cb3fa[_0xec35('0x2f')][_0xec35('0x3d')]){_0x5093a0[_0xec35('0x3e')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xec35('0x3f')](_0x5093a0);})['then'](function(_0x44d600){_0x2f0d46[_0xec35('0x40')]=_0x44d600;return _0x2f0d46;})[_0xec35('0x23')](respondWithFilteredResult(_0x48b42d,_0x5093a0))[_0xec35('0x41')](handleError(_0x48b42d,null));};exports[_0xec35('0x42')]=function(_0x3b0f77,_0x35dfdc){var _0x32f92f={'raw':!![],'where':{'id':_0x3b0f77['params']['id']}},_0xdb7248={};_0xdb7248[_0xec35('0x33')]=_[_0xec35('0x43')](db[_0xec35('0x2a')][_0xec35('0x2b')]);_0xdb7248['query']=_[_0xec35('0x43')](_0x3b0f77['query']);_0xdb7248[_0xec35('0x30')]=_['intersection'](_0xdb7248[_0xec35('0x33')],_0xdb7248[_0xec35('0x2f')]);_0x32f92f['attributes']=_[_0xec35('0x31')](_0xdb7248['model'],qs['fields'](_0x3b0f77[_0xec35('0x2f')][_0xec35('0x34')]));_0x32f92f[_0xec35('0x32')]=_0x32f92f[_0xec35('0x32')][_0xec35('0x44')]?_0x32f92f['attributes']:_0xdb7248['model'];if(_0x3b0f77[_0xec35('0x2f')]['includeAll']){_0x32f92f[_0xec35('0x3e')]=[{'all':!![]}];}_0x32f92f=_[_0xec35('0x3b')]({},_0x32f92f,_0x3b0f77[_0xec35('0x45')]);return db[_0xec35('0x2a')][_0xec35('0x46')](_0x32f92f)[_0xec35('0x23')](handleEntityNotFound(_0x35dfdc,null))[_0xec35('0x23')](respondWithResult(_0x35dfdc,null))[_0xec35('0x41')](handleError(_0x35dfdc,null));};exports[_0xec35('0x47')]=function(_0x47a4ea,_0x245398){return db[_0xec35('0x2a')][_0xec35('0x47')](_0x47a4ea['body'],{})[_0xec35('0x23')](respondWithResult(_0x245398,0xc9))[_0xec35('0x41')](handleError(_0x245398,null));};exports[_0xec35('0x21')]=function(_0x4ed5d7,_0x4e2c68){if(_0x4ed5d7[_0xec35('0x48')]['id']){delete _0x4ed5d7['body']['id'];}return db[_0xec35('0x2a')]['find']({'where':{'id':_0x4ed5d7[_0xec35('0x49')]['id']}})[_0xec35('0x23')](handleEntityNotFound(_0x4e2c68,null))[_0xec35('0x23')](saveUpdates(_0x4ed5d7[_0xec35('0x48')],null))['then'](respondWithResult(_0x4e2c68,null))['catch'](handleError(_0x4e2c68,null));};exports[_0xec35('0x22')]=function(_0x365105,_0x26b999){return db['SmsTransferReport'][_0xec35('0x46')]({'where':{'id':_0x365105['params']['id']}})['then'](handleEntityNotFound(_0x26b999,null))[_0xec35('0x23')](removeEntity(_0x26b999,null))[_0xec35('0x41')](handleError(_0x26b999,null));};exports[_0xec35('0x4a')]=function(_0x388a34,_0x24715e){return db[_0xec35('0x2a')][_0xec35('0x4a')]()['then'](respondWithResult(_0x24715e,null))[_0xec35('0x41')](handleError(_0x24715e,null));}; \ No newline at end of file +var _0x1a0d=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','rows','catch','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','api','../../config/environment','end','status','offset','limit','undefined','count','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','SmsTransferReport','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x48666f,_0x25348a){var _0xcfad48=function(_0x49ed57){while(--_0x49ed57){_0x48666f['push'](_0x48666f['shift']());}};_0xcfad48(++_0x25348a);}(_0x1a0d,0x127));var _0xd1a0=function(_0x2e6edd,_0x3f09c8){_0x2e6edd=_0x2e6edd-0x0;var _0x16b7fc=_0x1a0d[_0x2e6edd];return _0x16b7fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd1a0('0x0'));var zipdir=require(_0xd1a0('0x1'));var jsonpatch=require(_0xd1a0('0x2'));var rp=require(_0xd1a0('0x3'));var moment=require(_0xd1a0('0x4'));var BPromise=require(_0xd1a0('0x5'));var Mustache=require(_0xd1a0('0x6'));var util=require('util');var path=require(_0xd1a0('0x7'));var sox=require('sox');var csv=require(_0xd1a0('0x8'));var ejs=require(_0xd1a0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1a0('0xa'));var squel=require(_0xd1a0('0xb'));var crypto=require(_0xd1a0('0xc'));var jsforce=require(_0xd1a0('0xd'));var deskjs=require(_0xd1a0('0xe'));var toCsv=require(_0xd1a0('0x8'));var querystring=require('querystring');var Papa=require(_0xd1a0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1a0('0x10'))(_0xd1a0('0x11'));var utils=require('../../config/utils');var config=require(_0xd1a0('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37c1bd,_0x1e76bd){_0x1e76bd=_0x1e76bd||0xcc;return function(_0x5a76ec){if(_0x5a76ec){return _0x37c1bd['sendStatus'](_0x1e76bd);}return _0x37c1bd['status'](_0x1e76bd)[_0xd1a0('0x13')]();};}function respondWithResult(_0x5cbda3,_0x577cbd){_0x577cbd=_0x577cbd||0xc8;return function(_0x1159e8){if(_0x1159e8){return _0x5cbda3[_0xd1a0('0x14')](_0x577cbd)['json'](_0x1159e8);}};}function respondWithFilteredResult(_0x3101a2,_0x34820f){return function(_0x2240fb){if(_0x2240fb){var _0xa17f91=typeof _0x34820f[_0xd1a0('0x15')]==='undefined'&&typeof _0x34820f[_0xd1a0('0x16')]===_0xd1a0('0x17');var _0x3fb325=_0x2240fb[_0xd1a0('0x18')];var _0x5678c7=_0xa17f91?0x0:_0x34820f['offset'];var _0x5765a4=_0xa17f91?_0x2240fb['count']:_0x34820f[_0xd1a0('0x15')]+_0x34820f[_0xd1a0('0x16')];var _0x2b743d;if(_0x5765a4>=_0x3fb325){_0x5765a4=_0x3fb325;_0x2b743d=0xc8;}else{_0x2b743d=0xce;}_0x3101a2[_0xd1a0('0x14')](_0x2b743d);return _0x3101a2['set']('Content-Range',_0x5678c7+'-'+_0x5765a4+'/'+_0x3fb325)[_0xd1a0('0x19')](_0x2240fb);}return null;};}function patchUpdates(_0x394708){return function(_0x363418){try{jsonpatch[_0xd1a0('0x1a')](_0x363418,_0x394708,!![]);}catch(_0x40834a){return BPromise[_0xd1a0('0x1b')](_0x40834a);}return _0x363418[_0xd1a0('0x1c')]();};}function saveUpdates(_0x20fd51,_0x45086c){return function(_0xcfb271){if(_0xcfb271){return _0xcfb271[_0xd1a0('0x1d')](_0x20fd51)[_0xd1a0('0x1e')](function(_0x31bbd6){return _0x31bbd6;});}return null;};}function removeEntity(_0x295b81,_0x1b3dd8){return function(_0x1c3dbc){if(_0x1c3dbc){return _0x1c3dbc[_0xd1a0('0x1f')]()['then'](function(){_0x295b81['status'](0xcc)[_0xd1a0('0x13')]();});}};}function handleEntityNotFound(_0x34cc75,_0x416f72){return function(_0x16c4cd){if(!_0x16c4cd){_0x34cc75[_0xd1a0('0x20')](0x194);}return _0x16c4cd;};}function handleError(_0x38ae50,_0x4eccd0){_0x4eccd0=_0x4eccd0||0x1f4;return function(_0x479095){logger[_0xd1a0('0x21')](_0x479095['stack']);if(_0x479095[_0xd1a0('0x22')]){delete _0x479095['name'];}_0x38ae50[_0xd1a0('0x14')](_0x4eccd0)[_0xd1a0('0x23')](_0x479095);};}exports['index']=function(_0x14f2a3,_0xecd3f5){var _0x32634f={},_0xaa5e48={},_0x214f67={'count':0x0,'rows':[]};var _0x425811=_['map'](db[_0xd1a0('0x24')]['rawAttributes'],function(_0x216adc){return{'name':_0x216adc[_0xd1a0('0x25')],'type':_0x216adc[_0xd1a0('0x26')][_0xd1a0('0x27')]};});_0xaa5e48[_0xd1a0('0x28')]=_[_0xd1a0('0x29')](_0x425811,_0xd1a0('0x22'));_0xaa5e48[_0xd1a0('0x2a')]=_[_0xd1a0('0x2b')](_0x14f2a3['query']);_0xaa5e48['filters']=_[_0xd1a0('0x2c')](_0xaa5e48[_0xd1a0('0x28')],_0xaa5e48['query']);_0x32634f[_0xd1a0('0x2d')]=_[_0xd1a0('0x2c')](_0xaa5e48[_0xd1a0('0x28')],qs[_0xd1a0('0x2e')](_0x14f2a3[_0xd1a0('0x2a')]['fields']));_0x32634f[_0xd1a0('0x2d')]=_0x32634f[_0xd1a0('0x2d')][_0xd1a0('0x2f')]?_0x32634f['attributes']:_0xaa5e48[_0xd1a0('0x28')];if(!_0x14f2a3[_0xd1a0('0x2a')][_0xd1a0('0x30')](_0xd1a0('0x31'))){_0x32634f[_0xd1a0('0x16')]=qs[_0xd1a0('0x16')](_0x14f2a3[_0xd1a0('0x2a')]['limit']);_0x32634f[_0xd1a0('0x15')]=qs['offset'](_0x14f2a3['query'][_0xd1a0('0x15')]);}_0x32634f[_0xd1a0('0x32')]=qs[_0xd1a0('0x33')](_0x14f2a3[_0xd1a0('0x2a')][_0xd1a0('0x33')]);_0x32634f['where']=qs[_0xd1a0('0x34')](_[_0xd1a0('0x35')](_0x14f2a3[_0xd1a0('0x2a')],_0xaa5e48[_0xd1a0('0x34')]),_0x425811);if(_0x14f2a3[_0xd1a0('0x2a')][_0xd1a0('0x36')]){_0x32634f[_0xd1a0('0x37')]=_['merge'](_0x32634f[_0xd1a0('0x37')],{'$or':_[_0xd1a0('0x29')](_0x425811,function(_0x4b245b){if(_0x4b245b[_0xd1a0('0x26')]!==_0xd1a0('0x38')){var _0x2985e8={};_0x2985e8[_0x4b245b['name']]={'$like':'%'+_0x14f2a3[_0xd1a0('0x2a')][_0xd1a0('0x36')]+'%'};return _0x2985e8;}})});}_0x32634f=_[_0xd1a0('0x39')]({},_0x32634f,_0x14f2a3[_0xd1a0('0x3a')]);var _0x32294a={'where':_0x32634f[_0xd1a0('0x37')]};return db[_0xd1a0('0x24')][_0xd1a0('0x18')](_0x32294a)[_0xd1a0('0x1e')](function(_0x4d1f2f){_0x214f67[_0xd1a0('0x18')]=_0x4d1f2f;if(_0x14f2a3['query']['includeAll']){_0x32634f[_0xd1a0('0x3b')]=[{'all':!![]}];}return db[_0xd1a0('0x24')]['findAll'](_0x32634f);})['then'](function(_0x27f0c1){_0x214f67[_0xd1a0('0x3c')]=_0x27f0c1;return _0x214f67;})[_0xd1a0('0x1e')](respondWithFilteredResult(_0xecd3f5,_0x32634f))[_0xd1a0('0x3d')](handleError(_0xecd3f5,null));};exports['show']=function(_0x3912cc,_0x576421){var _0x171d84={'raw':!![],'where':{'id':_0x3912cc['params']['id']}},_0x418bd5={};_0x418bd5[_0xd1a0('0x28')]=_[_0xd1a0('0x2b')](db[_0xd1a0('0x24')]['rawAttributes']);_0x418bd5[_0xd1a0('0x2a')]=_[_0xd1a0('0x2b')](_0x3912cc[_0xd1a0('0x2a')]);_0x418bd5[_0xd1a0('0x34')]=_[_0xd1a0('0x2c')](_0x418bd5[_0xd1a0('0x28')],_0x418bd5[_0xd1a0('0x2a')]);_0x171d84['attributes']=_[_0xd1a0('0x2c')](_0x418bd5[_0xd1a0('0x28')],qs[_0xd1a0('0x2e')](_0x3912cc[_0xd1a0('0x2a')]['fields']));_0x171d84['attributes']=_0x171d84[_0xd1a0('0x2d')][_0xd1a0('0x2f')]?_0x171d84[_0xd1a0('0x2d')]:_0x418bd5[_0xd1a0('0x28')];if(_0x3912cc['query'][_0xd1a0('0x3e')]){_0x171d84[_0xd1a0('0x3b')]=[{'all':!![]}];}_0x171d84=_['merge']({},_0x171d84,_0x3912cc[_0xd1a0('0x3a')]);return db[_0xd1a0('0x24')][_0xd1a0('0x3f')](_0x171d84)['then'](handleEntityNotFound(_0x576421,null))[_0xd1a0('0x1e')](respondWithResult(_0x576421,null))[_0xd1a0('0x3d')](handleError(_0x576421,null));};exports[_0xd1a0('0x40')]=function(_0x26dc08,_0x3e68a5){return db['SmsTransferReport'][_0xd1a0('0x40')](_0x26dc08[_0xd1a0('0x41')],{})[_0xd1a0('0x1e')](respondWithResult(_0x3e68a5,0xc9))[_0xd1a0('0x3d')](handleError(_0x3e68a5,null));};exports['update']=function(_0x25f36d,_0x47c95f){if(_0x25f36d[_0xd1a0('0x41')]['id']){delete _0x25f36d[_0xd1a0('0x41')]['id'];}return db['SmsTransferReport'][_0xd1a0('0x3f')]({'where':{'id':_0x25f36d[_0xd1a0('0x42')]['id']}})[_0xd1a0('0x1e')](handleEntityNotFound(_0x47c95f,null))[_0xd1a0('0x1e')](saveUpdates(_0x25f36d[_0xd1a0('0x41')],null))['then'](respondWithResult(_0x47c95f,null))[_0xd1a0('0x3d')](handleError(_0x47c95f,null));};exports[_0xd1a0('0x1f')]=function(_0x52c5dd,_0x591f08){return db[_0xd1a0('0x24')]['find']({'where':{'id':_0x52c5dd['params']['id']}})[_0xd1a0('0x1e')](handleEntityNotFound(_0x591f08,null))[_0xd1a0('0x1e')](removeEntity(_0x591f08,null))[_0xd1a0('0x3d')](handleError(_0x591f08,null));};exports[_0xd1a0('0x43')]=function(_0x2d6dae,_0x17e013){return db[_0xd1a0('0x24')]['describe']()[_0xd1a0('0x1e')](respondWithResult(_0x17e013,null))[_0xd1a0('0x3d')](handleError(_0x17e013,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 050a16b..9e3a526 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 _0x240e=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x196105,_0x41c93c){var _0x25c893=function(_0x4590a7){while(--_0x4590a7){_0x196105['push'](_0x196105['shift']());}};_0x25c893(++_0x41c93c);}(_0x240e,0x176));var _0xe240=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x240e[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0xe240('0x0'));var util=require(_0xe240('0x1'));var logger=require(_0xe240('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe240('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe240('0x4'));var rimraf=require(_0xe240('0x5'));var config=require('../../config/environment');var attributes=require(_0xe240('0x6'));module[_0xe240('0x7')]=function(_0x2b7d14,_0x5f2977){return _0x2b7d14[_0xe240('0x8')](_0xe240('0x9'),attributes,{'tableName':_0xe240('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe240('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x72b1=['path','rimraf','./smsTransferReport.attributes','exports','SmsTransferReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x72b1,0x16e));var _0x172b=function(_0x50577f,_0x2a73b7){_0x50577f=_0x50577f-0x0;var _0x5f2dc3=_0x72b1[_0x50577f];return _0x5f2dc3;};'use strict';var _=require(_0x172b('0x0'));var util=require('util');var logger=require(_0x172b('0x1'))(_0x172b('0x2'));var moment=require(_0x172b('0x3'));var BPromise=require(_0x172b('0x4'));var rp=require(_0x172b('0x5'));var fs=require('fs');var path=require(_0x172b('0x6'));var rimraf=require(_0x172b('0x7'));var config=require('../../config/environment');var attributes=require(_0x172b('0x8'));module[_0x172b('0x9')]=function(_0x475fd6,_0x222624){return _0x475fd6['define'](_0x172b('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x172b('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index b6417b4..471e362 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 _0x56a4=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x333b0d,_0xbf8c38){var _0x31f4d1=function(_0x3aede0){while(--_0x3aede0){_0x333b0d['push'](_0x333b0d['shift']());}};_0x31f4d1(++_0xbf8c38);}(_0x56a4,0x11b));var _0x456a=function(_0x15f9c6,_0x4a344e){_0x15f9c6=_0x15f9c6-0x0;var _0xe1874e=_0x56a4[_0x15f9c6];return _0xe1874e;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var moment=require('moment');var BPromise=require(_0x456a('0x2'));var rs=require(_0x456a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson['client'][_0x456a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52b38d,_0x497df4,_0x2b6329){return new BPromise(function(_0x20c8e0,_0x37f1b4){return client['request'](_0x52b38d,_0x2b6329)[_0x456a('0xa')](function(_0x595c4b){logger[_0x456a('0xb')](_0x456a('0xc'),_0x497df4,_0x456a('0xd'));logger[_0x456a('0xe')](_0x456a('0xf'),_0x497df4,_0x456a('0xd'),JSON[_0x456a('0x10')](_0x595c4b));if(_0x595c4b[_0x456a('0x11')]){if(_0x595c4b[_0x456a('0x11')][_0x456a('0x12')]===0x1f4){logger[_0x456a('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x497df4,_0x595c4b[_0x456a('0x11')]['message']);return _0x37f1b4(_0x595c4b['error'][_0x456a('0x13')]);}logger[_0x456a('0x11')](_0x456a('0xc'),_0x497df4,_0x595c4b[_0x456a('0x11')]['message']);return _0x20c8e0(_0x595c4b[_0x456a('0x11')][_0x456a('0x13')]);}else{logger[_0x456a('0xb')](_0x456a('0xc'),_0x497df4,_0x456a('0xd'));_0x20c8e0(_0x595c4b[_0x456a('0x14')]['message']);}})[_0x456a('0x15')](function(_0x42f7d8){logger[_0x456a('0x11')](_0x456a('0xc'),_0x497df4,_0x42f7d8);_0x37f1b4(_0x42f7d8);});});} \ No newline at end of file +var _0x90b5=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0x90b5,0x139));var _0x590b=function(_0x3557a5,_0x33a19b){_0x3557a5=_0x3557a5-0x0;var _0x21f8f6=_0x90b5[_0x3557a5];return _0x21f8f6;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var moment=require(_0x590b('0x1'));var BPromise=require(_0x590b('0x2'));var rs=require(_0x590b('0x3'));var fs=require('fs');var Redis=require(_0x590b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x590b('0x5'))(_0x590b('0x6'));var config=require('../../config/environment');var jayson=require(_0x590b('0x7'));var client=jayson[_0x590b('0x8')][_0x590b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e54fe,_0x30bc6e,_0x3663a0){return new BPromise(function(_0x3ec156,_0x9c408b){return client[_0x590b('0xa')](_0x5e54fe,_0x3663a0)[_0x590b('0xb')](function(_0x2103c0){logger[_0x590b('0xc')](_0x590b('0xd'),_0x30bc6e,'request\x20sent');logger[_0x590b('0xe')](_0x590b('0xf'),_0x30bc6e,'request\x20sent',JSON[_0x590b('0x10')](_0x2103c0));if(_0x2103c0['error']){if(_0x2103c0[_0x590b('0x11')][_0x590b('0x12')]===0x1f4){logger[_0x590b('0x11')](_0x590b('0xd'),_0x30bc6e,_0x2103c0['error'][_0x590b('0x13')]);return _0x9c408b(_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);}logger[_0x590b('0x11')](_0x590b('0xd'),_0x30bc6e,_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);return _0x3ec156(_0x2103c0[_0x590b('0x11')][_0x590b('0x13')]);}else{logger[_0x590b('0xc')](_0x590b('0xd'),_0x30bc6e,_0x590b('0x14'));_0x3ec156(_0x2103c0[_0x590b('0x15')][_0x590b('0x13')]);}})[_0x590b('0x16')](function(_0x4f2512){logger[_0x590b('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x30bc6e,_0x4f2512);_0x9c408b(_0x4f2512);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9f0ec1a..d954e11 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 _0x828b=['server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','create','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','root'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x828b,0x1b2));var _0xb828=function(_0x3284cd,_0x2e10a2){_0x3284cd=_0x3284cd-0x0;var _0xe92280=_0x828b[_0x3284cd];return _0xe92280;};'use strict';var multer=require(_0xb828('0x0'));var util=require(_0xb828('0x1'));var path=require(_0xb828('0x2'));var timeout=require('connect-timeout');var express=require(_0xb828('0x3'));var router=express[_0xb828('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb828('0x5'));var interaction=require(_0xb828('0x6'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xb828('0x7')]('/',auth[_0xb828('0x8')](),controller[_0xb828('0x9')]);router[_0xb828('0x7')](_0xb828('0xa'),auth['isAuthenticated'](),controller[_0xb828('0xb')]);router[_0xb828('0x7')](_0xb828('0xc'),auth['isAuthenticated'](),controller[_0xb828('0xd')]);var upload=multer({'storage':multer[_0xb828('0xe')]({'destination':function(_0x4918dc,_0x506a6c,_0xa4157){_0xa4157(null,path['join'](config[_0xb828('0xf')],_0xb828('0x10')));},'filename':function(_0x524fc4,_0xdc819c,_0x525a4f){_0xdc819c[_0xb828('0x11')]=_0xdc819c[_0xb828('0x11')][_0xb828('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x525a4f(null,util[_0xb828('0x13')](_0xb828('0x14'),path[_0xb828('0x15')](_0xdc819c[_0xb828('0x11')],path[_0xb828('0x16')](_0xdc819c['originalname'])),Date[_0xb828('0x17')](),path[_0xb828('0x16')](_0xdc819c['originalname'])));}})});router[_0xb828('0x18')]('/',upload[_0xb828('0x19')]('file'),controller[_0xb828('0x1a')]);router['put'](_0xb828('0xa'),auth['isAuthenticated'](),controller[_0xb828('0x1b')]);router[_0xb828('0x1c')](_0xb828('0xa'),auth[_0xb828('0x8')](),controller[_0xb828('0x1c')]);module[_0xb828('0x1d')]=router; \ No newline at end of file +var _0xe02e=['post','create','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xe02e,0x1c5));var _0xee02=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xe02e[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0xee02('0x0'));var util=require('util');var path=require(_0xee02('0x1'));var timeout=require(_0xee02('0x2'));var express=require(_0xee02('0x3'));var router=express[_0xee02('0x4')]();var fs_extra=require(_0xee02('0x5'));var auth=require(_0xee02('0x6'));var interaction=require(_0xee02('0x7'));var config=require('../../config/environment');var controller=require(_0xee02('0x8'));router[_0xee02('0x9')]('/',auth[_0xee02('0xa')](),controller[_0xee02('0xb')]);router[_0xee02('0x9')](_0xee02('0xc'),auth[_0xee02('0xa')](),controller[_0xee02('0xd')]);router['get'](_0xee02('0xe'),auth[_0xee02('0xa')](),controller[_0xee02('0xf')]);var upload=multer({'storage':multer[_0xee02('0x10')]({'destination':function(_0x33519a,_0x2ed933,_0x4fc41e){_0x4fc41e(null,path[_0xee02('0x11')](config[_0xee02('0x12')],_0xee02('0x13')));},'filename':function(_0x6dcf8,_0x1e6433,_0x412687){_0x1e6433[_0xee02('0x14')]=_0x1e6433['originalname'][_0xee02('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x412687(null,util[_0xee02('0x16')](_0xee02('0x17'),path[_0xee02('0x18')](_0x1e6433[_0xee02('0x14')],path['extname'](_0x1e6433[_0xee02('0x14')])),Date[_0xee02('0x19')](),path[_0xee02('0x1a')](_0x1e6433[_0xee02('0x14')])));}})});router[_0xee02('0x1b')]('/',upload['single']('file'),controller[_0xee02('0x1c')]);router['put']('/:id',auth[_0xee02('0xa')](),controller[_0xee02('0x1d')]);router[_0xee02('0x1e')]('/:id',auth[_0xee02('0xa')](),controller[_0xee02('0x1e')]);module[_0xee02('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index e25cdf4..706cfb4 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 _0x292d=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x292d,0x168));var _0xd292=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x292d[_0x459423];return _0x42ed14;};'use strict';var Sequelize=require(_0xd292('0x0'));module['exports']={'name':{'type':Sequelize[_0xd292('0x1')],'unique':_0xd292('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xd292('0x1')]},'original_format':{'type':Sequelize[_0xd292('0x1')]},'original_duration':{'type':Sequelize[_0xd292('0x3')]},'original_sampleCount':{'type':Sequelize[_0xd292('0x4')]},'original_channelCount':{'type':Sequelize[_0xd292('0x5')]},'original_bitRate':{'type':Sequelize[_0xd292('0x4')]},'original_sampleRate':{'type':Sequelize[_0xd292('0x5')]},'converted_format':{'type':Sequelize[_0xd292('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xd292('0x4')]},'converted_channelCount':{'type':Sequelize[_0xd292('0x5')]},'converted_bitRate':{'type':Sequelize[_0xd292('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xd292('0x5')]}}; \ No newline at end of file +var _0x1def=['BIGINT','INTEGER','FLOAT','sequelize','STRING'];(function(_0x54b824,_0x2c310d){var _0x52dda5=function(_0x4461b8){while(--_0x4461b8){_0x54b824['push'](_0x54b824['shift']());}};_0x52dda5(++_0x2c310d);}(_0x1def,0x17f));var _0xf1de=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x1def[_0x455c6c];return _0x488242;};'use strict';var Sequelize=require(_0xf1de('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xf1de('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xf1de('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xf1de('0x2')]},'original_channelCount':{'type':Sequelize[_0xf1de('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xf1de('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xf1de('0x2')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xf1de('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index cc00599..bb48eed 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 _0x2fd0=['originalname','filename','substring','wav','server/files/sounds/original','format','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','src','duration','sampleCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','chmodSync','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','send','delete','original_format','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','index','map','Sound','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','params','download','save_name','converted_format','join','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','%s.%s','create','basename','file','extname'];(function(_0x50d5ae,_0x22a349){var _0x1e8d74=function(_0xd256a9){while(--_0xd256a9){_0x50d5ae['push'](_0x50d5ae['shift']());}};_0x1e8d74(++_0x22a349);}(_0x2fd0,0x10a));var _0x02fd=function(_0x179314,_0x32d3a2){_0x179314=_0x179314-0x0;var _0x3556f7=_0x2fd0[_0x179314];return _0x3556f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x02fd('0x0'));var zipdir=require(_0x02fd('0x1'));var jsonpatch=require(_0x02fd('0x2'));var rp=require(_0x02fd('0x3'));var moment=require(_0x02fd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x02fd('0x5'));var util=require(_0x02fd('0x6'));var path=require('path');var sox=require(_0x02fd('0x7'));var csv=require(_0x02fd('0x8'));var ejs=require(_0x02fd('0x9'));var fs=require('fs');var fs_extra=require(_0x02fd('0xa'));var _=require(_0x02fd('0xb'));var squel=require('squel');var crypto=require(_0x02fd('0xc'));var jsforce=require(_0x02fd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x02fd('0xe'));var Redis=require(_0x02fd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x02fd('0x10'));var as=require(_0x02fd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x02fd('0x12'))(_0x02fd('0x13'));var utils=require('../../config/utils');var config=require(_0x02fd('0x14'));var licenseUtil=require(_0x02fd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a2978,_0x88ce70){_0x88ce70=_0x88ce70||0xcc;return function(_0x5a32c4){if(_0x5a32c4){return _0x3a2978[_0x02fd('0x16')](_0x88ce70);}return _0x3a2978[_0x02fd('0x17')](_0x88ce70)[_0x02fd('0x18')]();};}function respondWithResult(_0x4bff42,_0x30e812){_0x30e812=_0x30e812||0xc8;return function(_0x2a119b){if(_0x2a119b){return _0x4bff42[_0x02fd('0x17')](_0x30e812)[_0x02fd('0x19')](_0x2a119b);}};}function respondWithFilteredResult(_0x22be8d,_0x2ac43f){return function(_0x5395c7){if(_0x5395c7){var _0x3257fe=typeof _0x2ac43f[_0x02fd('0x1a')]===_0x02fd('0x1b')&&typeof _0x2ac43f['limit']==='undefined';var _0x471bef=_0x5395c7[_0x02fd('0x1c')];var _0x17516a=_0x3257fe?0x0:_0x2ac43f[_0x02fd('0x1a')];var _0x5da95b=_0x3257fe?_0x5395c7[_0x02fd('0x1c')]:_0x2ac43f[_0x02fd('0x1a')]+_0x2ac43f['limit'];var _0xfdd96e;if(_0x5da95b>=_0x471bef){_0x5da95b=_0x471bef;_0xfdd96e=0xc8;}else{_0xfdd96e=0xce;}_0x22be8d['status'](_0xfdd96e);return _0x22be8d[_0x02fd('0x1d')](_0x02fd('0x1e'),_0x17516a+'-'+_0x5da95b+'/'+_0x471bef)[_0x02fd('0x19')](_0x5395c7);}return null;};}function patchUpdates(_0x5ac1f1){return function(_0x6af34b){try{jsonpatch[_0x02fd('0x1f')](_0x6af34b,_0x5ac1f1,!![]);}catch(_0x3f3f2a){return BPromise['reject'](_0x3f3f2a);}return _0x6af34b[_0x02fd('0x20')]();};}function saveUpdates(_0x258c1c,_0x109116){return function(_0x87d808){if(_0x87d808){return _0x87d808[_0x02fd('0x21')](_0x258c1c)[_0x02fd('0x22')](function(_0x3ff200){return _0x3ff200;});}return null;};}function removeEntity(_0x744ac4,_0x489281){return function(_0x4b710b){if(_0x4b710b){return _0x4b710b[_0x02fd('0x23')]()[_0x02fd('0x22')](function(){var _0x25f073=_0x4b710b[_0x02fd('0x24')]({'plain':!![]});var _0x2712d2=_0x02fd('0x25');return db[_0x02fd('0x26')][_0x02fd('0x23')]({'where':{'type':_0x2712d2,'resourceId':_0x25f073['id']}})[_0x02fd('0x22')](function(){return _0x4b710b;});})[_0x02fd('0x22')](function(){_0x744ac4[_0x02fd('0x17')](0xcc)[_0x02fd('0x18')]();});}};}function handleEntityNotFound(_0x10e567,_0x4d05aa){return function(_0x5c7c08){if(!_0x5c7c08){_0x10e567[_0x02fd('0x16')](0x194);}return _0x5c7c08;};}function handleError(_0x16d2ef,_0x1bd633){_0x1bd633=_0x1bd633||0x1f4;return function(_0x3bffab){logger[_0x02fd('0x27')](_0x3bffab[_0x02fd('0x28')]);if(_0x3bffab[_0x02fd('0x29')]){delete _0x3bffab[_0x02fd('0x29')];}_0x16d2ef[_0x02fd('0x17')](_0x1bd633)['send'](_0x3bffab);};}exports[_0x02fd('0x2a')]=function(_0x202461,_0x58f32e){var _0x7e130b={},_0x5c32ee={},_0x4c85fa={'count':0x0,'rows':[]};var _0x5eb50a=_[_0x02fd('0x2b')](db[_0x02fd('0x2c')][_0x02fd('0x2d')],function(_0x40ab40){return{'name':_0x40ab40[_0x02fd('0x2e')],'type':_0x40ab40[_0x02fd('0x2f')]['key']};});_0x5c32ee[_0x02fd('0x30')]=_['map'](_0x5eb50a,_0x02fd('0x29'));_0x5c32ee[_0x02fd('0x31')]=_[_0x02fd('0x32')](_0x202461[_0x02fd('0x31')]);_0x5c32ee[_0x02fd('0x33')]=_[_0x02fd('0x34')](_0x5c32ee[_0x02fd('0x30')],_0x5c32ee['query']);_0x7e130b[_0x02fd('0x35')]=_[_0x02fd('0x34')](_0x5c32ee[_0x02fd('0x30')],qs['fields'](_0x202461[_0x02fd('0x31')][_0x02fd('0x36')]));_0x7e130b[_0x02fd('0x35')]=_0x7e130b[_0x02fd('0x35')][_0x02fd('0x37')]?_0x7e130b[_0x02fd('0x35')]:_0x5c32ee[_0x02fd('0x30')];if(!_0x202461[_0x02fd('0x31')]['hasOwnProperty']('nolimit')){_0x7e130b[_0x02fd('0x38')]=qs[_0x02fd('0x38')](_0x202461[_0x02fd('0x31')]['limit']);_0x7e130b[_0x02fd('0x1a')]=qs[_0x02fd('0x1a')](_0x202461[_0x02fd('0x31')]['offset']);}_0x7e130b[_0x02fd('0x39')]=qs[_0x02fd('0x3a')](_0x202461[_0x02fd('0x31')][_0x02fd('0x3a')]);_0x7e130b[_0x02fd('0x3b')]=qs[_0x02fd('0x33')](_[_0x02fd('0x3c')](_0x202461[_0x02fd('0x31')],_0x5c32ee[_0x02fd('0x33')]),_0x5eb50a);if(_0x202461[_0x02fd('0x31')][_0x02fd('0x3d')]){_0x7e130b[_0x02fd('0x3b')]=_[_0x02fd('0x3e')](_0x7e130b[_0x02fd('0x3b')],{'$or':_[_0x02fd('0x2b')](_0x5eb50a,function(_0x38f4fe){if(_0x38f4fe[_0x02fd('0x2f')]!=='VIRTUAL'){var _0x227c07={};_0x227c07[_0x38f4fe[_0x02fd('0x29')]]={'$like':'%'+_0x202461[_0x02fd('0x31')][_0x02fd('0x3d')]+'%'};return _0x227c07;}})});}_0x7e130b=_[_0x02fd('0x3e')]({},_0x7e130b,_0x202461[_0x02fd('0x3f')]);var _0x3b9f02={'where':_0x7e130b[_0x02fd('0x3b')]};return db[_0x02fd('0x2c')][_0x02fd('0x1c')](_0x3b9f02)[_0x02fd('0x22')](function(_0x2812b2){_0x4c85fa[_0x02fd('0x1c')]=_0x2812b2;if(_0x202461['query'][_0x02fd('0x40')]){_0x7e130b[_0x02fd('0x41')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x7e130b);})[_0x02fd('0x22')](function(_0x53d45b){_0x4c85fa['rows']=_0x53d45b;return _0x4c85fa;})['then'](respondWithFilteredResult(_0x58f32e,_0x7e130b))[_0x02fd('0x42')](handleError(_0x58f32e,null));};exports['show']=function(_0x11f8bb,_0x2dc5e6){var _0x343708={'raw':!![],'where':{'id':_0x11f8bb[_0x02fd('0x43')]['id']}},_0x8057a3={};_0x8057a3['model']=_[_0x02fd('0x32')](db['Sound'][_0x02fd('0x2d')]);_0x8057a3[_0x02fd('0x31')]=_[_0x02fd('0x32')](_0x11f8bb[_0x02fd('0x31')]);_0x8057a3['filters']=_[_0x02fd('0x34')](_0x8057a3[_0x02fd('0x30')],_0x8057a3[_0x02fd('0x31')]);_0x343708[_0x02fd('0x35')]=_['intersection'](_0x8057a3[_0x02fd('0x30')],qs[_0x02fd('0x36')](_0x11f8bb['query'][_0x02fd('0x36')]));_0x343708[_0x02fd('0x35')]=_0x343708[_0x02fd('0x35')][_0x02fd('0x37')]?_0x343708['attributes']:_0x8057a3['model'];if(_0x11f8bb['query']['includeAll']){_0x343708[_0x02fd('0x41')]=[{'all':!![]}];}_0x343708=_[_0x02fd('0x3e')]({},_0x343708,_0x11f8bb['options']);return db[_0x02fd('0x2c')]['find'](_0x343708)[_0x02fd('0x22')](handleEntityNotFound(_0x2dc5e6,null))[_0x02fd('0x22')](respondWithResult(_0x2dc5e6,null))['catch'](handleError(_0x2dc5e6,null));};exports[_0x02fd('0x44')]=function(_0x4c4da7,_0x557483,_0x465c15){return db[_0x02fd('0x2c')]['find']({'where':{'id':_0x4c4da7['params']['id']},'attributes':[_0x02fd('0x29'),_0x02fd('0x45'),_0x02fd('0x46')],'raw':!![]})[_0x02fd('0x22')](handleEntityNotFound(_0x557483,null))[_0x02fd('0x22')](function(_0x13b574){if(_0x13b574){if(!fs['existsSync'](path[_0x02fd('0x47')](config[_0x02fd('0x48')],'server/files/sounds/converted',_0x13b574[_0x02fd('0x45')]+'.'+_0x13b574[_0x02fd('0x46')]))){throw new db[(_0x02fd('0x49'))][(_0x02fd('0x4a'))](_0x02fd('0x4b'));}return _0x557483['download'](path['join'](config[_0x02fd('0x48')],_0x02fd('0x4c'),util['format'](_0x02fd('0x4d'),_0x13b574[_0x02fd('0x45')],_0x13b574[_0x02fd('0x46')])),util['format'](_0x02fd('0x4d'),_0x13b574[_0x02fd('0x29')],_0x13b574[_0x02fd('0x46')]));}return null;})[_0x02fd('0x42')](handleError(_0x557483,null));};exports[_0x02fd('0x4e')]=function(_0x5a8d0f,_0x4ab247,_0x3dd48e){var _0x280bb5={'name':path[_0x02fd('0x4f')](_0x5a8d0f[_0x02fd('0x50')]['originalname'],path[_0x02fd('0x51')](_0x5a8d0f[_0x02fd('0x50')][_0x02fd('0x52')])),'save_name':path['basename'](_0x5a8d0f[_0x02fd('0x50')][_0x02fd('0x53')],path[_0x02fd('0x51')](_0x5a8d0f['file'][_0x02fd('0x53')])),'original_format':path[_0x02fd('0x51')](_0x5a8d0f['file'][_0x02fd('0x52')])[_0x02fd('0x54')](0x1),'converted_format':_0x02fd('0x55')};var _0x352cfa=path[_0x02fd('0x47')](config['root'],_0x02fd('0x56'),_0x5a8d0f[_0x02fd('0x50')][_0x02fd('0x53')]);var _0x10709d=path['join'](config[_0x02fd('0x48')],_0x02fd('0x4c'),util[_0x02fd('0x57')]('%s.%s',path['basename'](_0x5a8d0f[_0x02fd('0x50')][_0x02fd('0x53')],path['extname'](_0x5a8d0f['file'][_0x02fd('0x53')])),_0x280bb5[_0x02fd('0x46')]));logger[_0x02fd('0x58')]('Sound\x20upload\x20filepath:\x20%s',_0x352cfa);logger['info'](_0x02fd('0x59'),_0x10709d);try{fs['chmodSync'](_0x352cfa,parseInt(_0x02fd('0x5a'),0x8));var _0x570274=sox[_0x02fd('0x5b')](_0x352cfa,_0x10709d,{'sampleRate':0x1f40,'format':_0x02fd('0x55'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x570274['on'](_0x02fd('0x27'),function(_0xeb9995){fs['unlinkSync'](_0x352cfa);_0x4ab247[_0x02fd('0x17')](0x1f4)['send'](_0xeb9995);});_0x570274['on'](_0x02fd('0x5c'),function(_0x46f721){_0x280bb5['original_duration']=isNaN(_0x46f721[_0x02fd('0x5d')])?null:_0x46f721[_0x02fd('0x5d')]*0x3e8;_0x280bb5['original_sampleCount']=isNaN(_0x46f721[_0x02fd('0x5e')])?null:_0x46f721[_0x02fd('0x5e')];_0x280bb5['original_channelCount']=isNaN(_0x46f721[_0x02fd('0x5f')])?null:_0x46f721['channelCount'];_0x280bb5[_0x02fd('0x60')]=isNaN(_0x46f721['bitRate'])?null:_0x46f721['bitRate'];_0x280bb5[_0x02fd('0x61')]=isNaN(_0x46f721['sampleRate'])?null:_0x46f721[_0x02fd('0x62')];});_0x570274['on'](_0x02fd('0x63'),function(_0x2fa986){_0x280bb5['converted_duration']=isNaN(_0x2fa986[_0x02fd('0x5d')])?null:_0x2fa986[_0x02fd('0x5d')]*0x3e8;_0x280bb5[_0x02fd('0x64')]=isNaN(_0x2fa986[_0x02fd('0x5e')])?null:_0x2fa986[_0x02fd('0x5e')];_0x280bb5[_0x02fd('0x65')]=isNaN(_0x2fa986[_0x02fd('0x5f')])?null:_0x2fa986[_0x02fd('0x5f')];_0x280bb5[_0x02fd('0x66')]=isNaN(_0x2fa986[_0x02fd('0x67')])?null:_0x2fa986[_0x02fd('0x67')];_0x280bb5[_0x02fd('0x68')]=isNaN(_0x2fa986[_0x02fd('0x62')])?null:_0x2fa986[_0x02fd('0x62')];});_0x570274['on'](_0x02fd('0x18'),function(){fs[_0x02fd('0x69')](_0x10709d,parseInt(_0x02fd('0x5a'),0x8));return db[_0x02fd('0x2c')]['create'](_0x280bb5)[_0x02fd('0x22')](function(_0x7c4008){var _0x1e07eb={'role':_0x5a8d0f[_0x02fd('0x6a')]['role'],'userProfileId':_0x5a8d0f[_0x02fd('0x6a')]['userProfileId']};if(!_0x1e07eb)throw new Error(_0x02fd('0x6b'));if(_0x1e07eb['role']===_0x02fd('0x6c')){var _0x2bc761=_0x7c4008['get']({'plain':!![]});return db[_0x02fd('0x6d')]['find']({'where':{'name':_0x02fd('0x25'),'userProfileId':_0x1e07eb[_0x02fd('0x6e')]},'raw':!![]})[_0x02fd('0x22')](function(_0x58902b){if(_0x58902b&&_0x58902b[_0x02fd('0x6f')]===0x0){return db['UserProfileResource'][_0x02fd('0x4e')]({'name':_0x2bc761[_0x02fd('0x29')],'resourceId':_0x2bc761['id'],'type':_0x58902b[_0x02fd('0x29')],'sectionId':_0x58902b['id']},{})[_0x02fd('0x22')](function(){return _0x7c4008;});}else{return _0x7c4008;}})['catch'](function(_0x5deef6){logger[_0x02fd('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5deef6);throw _0x5deef6;});}return _0x7c4008;})[_0x02fd('0x22')](respondWithResult(_0x4ab247,null))[_0x02fd('0x42')](handleError(_0x4ab247,null));});_0x570274['start']();}catch(_0x6732b2){_0x4ab247[_0x02fd('0x17')](0x1f4)[_0x02fd('0x70')](_0x6732b2);}};exports[_0x02fd('0x21')]=function(_0x57681d,_0x29e764,_0x4757be){return db[_0x02fd('0x2c')]['find']({'where':{'id':_0x57681d['params']['id']}})[_0x02fd('0x22')](handleEntityNotFound(_0x29e764,null))['then'](saveUpdates(_[_0x02fd('0x3c')](_0x57681d[_0x02fd('0x6a')],[_0x02fd('0x29'),'description']),null))[_0x02fd('0x22')](respondWithResult(_0x29e764,null))[_0x02fd('0x42')](handleError(_0x29e764,null));};exports[_0x02fd('0x71')]=function(_0x532fb0,_0x3e9e1a,_0x21c18e){return db[_0x02fd('0x2c')]['find']({'where':{'id':_0x532fb0[_0x02fd('0x43')]['id']}})[_0x02fd('0x22')](function(_0x3bb2f7){if(_0x3bb2f7){return _0x3bb2f7['destroy']();}})[_0x02fd('0x22')](function(_0x4e5164){var _0x4719ab=path[_0x02fd('0x47')](config[_0x02fd('0x48')],_0x02fd('0x56'),util[_0x02fd('0x57')]('%s.%s',_0x4e5164[_0x02fd('0x45')],_0x4e5164[_0x02fd('0x72')]));var _0x42068d=path['join'](config[_0x02fd('0x48')],_0x02fd('0x4c'),util['format']('%s.%s',_0x4e5164[_0x02fd('0x45')],_0x4e5164[_0x02fd('0x46')]));fs[_0x02fd('0x73')](_0x4719ab);fs[_0x02fd('0x73')](_0x42068d);return _0x4e5164;})[_0x02fd('0x22')](function(_0x1751c0){if(_0x1751c0){return _0x3e9e1a[_0x02fd('0x17')](0xcc)[_0x02fd('0x18')]();}})[_0x02fd('0x22')](handleEntityNotFound(_0x3e9e1a,null))[_0x02fd('0x42')](handleError(_0x3e9e1a,null));}; \ No newline at end of file +var _0x8c72=['originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','destroy','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','limit','update','then','Sounds','UserProfileResource','sendStatus','error','name','index','map','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','Sound','find','params','save_name','existsSync','join','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','download','root','format','%s.%s','create','basename','file'];(function(_0x580b2b,_0x38019b){var _0x288d3a=function(_0x5ded65){while(--_0x5ded65){_0x580b2b['push'](_0x580b2b['shift']());}};_0x288d3a(++_0x38019b);}(_0x8c72,0x11f));var _0x28c7=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x8c72[_0x9c2427];return _0x51984f;};'use strict';var emlformat=require(_0x28c7('0x0'));var rimraf=require(_0x28c7('0x1'));var zipdir=require(_0x28c7('0x2'));var jsonpatch=require(_0x28c7('0x3'));var rp=require('request-promise');var moment=require(_0x28c7('0x4'));var BPromise=require(_0x28c7('0x5'));var Mustache=require('mustache');var util=require(_0x28c7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x28c7('0x7'));var ejs=require(_0x28c7('0x8'));var fs=require('fs');var fs_extra=require(_0x28c7('0x9'));var _=require(_0x28c7('0xa'));var squel=require(_0x28c7('0xb'));var crypto=require(_0x28c7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x28c7('0xd'));var toCsv=require(_0x28c7('0x7'));var querystring=require(_0x28c7('0xe'));var Papa=require(_0x28c7('0xf'));var Redis=require(_0x28c7('0x10'));var authService=require(_0x28c7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x28c7('0x12'));var hardwareService=require(_0x28c7('0x13'));var logger=require('../../config/logger')(_0x28c7('0x14'));var utils=require(_0x28c7('0x15'));var config=require(_0x28c7('0x16'));var licenseUtil=require(_0x28c7('0x17'));var db=require(_0x28c7('0x18'))['db'];function respondWithStatusCode(_0x1647a0,_0x225294){_0x225294=_0x225294||0xcc;return function(_0x3b4df2){if(_0x3b4df2){return _0x1647a0['sendStatus'](_0x225294);}return _0x1647a0[_0x28c7('0x19')](_0x225294)[_0x28c7('0x1a')]();};}function respondWithResult(_0x400f89,_0x407447){_0x407447=_0x407447||0xc8;return function(_0x48da0c){if(_0x48da0c){return _0x400f89[_0x28c7('0x19')](_0x407447)[_0x28c7('0x1b')](_0x48da0c);}};}function respondWithFilteredResult(_0x522990,_0x2eabec){return function(_0x509212){if(_0x509212){var _0x24d406=typeof _0x2eabec['offset']===_0x28c7('0x1c')&&typeof _0x2eabec['limit']===_0x28c7('0x1c');var _0x3d1700=_0x509212['count'];var _0x33a396=_0x24d406?0x0:_0x2eabec[_0x28c7('0x1d')];var _0x3aac14=_0x24d406?_0x509212['count']:_0x2eabec[_0x28c7('0x1d')]+_0x2eabec[_0x28c7('0x1e')];var _0x300ecc;if(_0x3aac14>=_0x3d1700){_0x3aac14=_0x3d1700;_0x300ecc=0xc8;}else{_0x300ecc=0xce;}_0x522990['status'](_0x300ecc);return _0x522990['set']('Content-Range',_0x33a396+'-'+_0x3aac14+'/'+_0x3d1700)[_0x28c7('0x1b')](_0x509212);}return null;};}function patchUpdates(_0x3b7691){return function(_0x336b45){try{jsonpatch['apply'](_0x336b45,_0x3b7691,!![]);}catch(_0x16df03){return BPromise['reject'](_0x16df03);}return _0x336b45['save']();};}function saveUpdates(_0x46f071,_0x241abb){return function(_0x19f776){if(_0x19f776){return _0x19f776[_0x28c7('0x1f')](_0x46f071)['then'](function(_0x2668b8){return _0x2668b8;});}return null;};}function removeEntity(_0xce3171,_0x2b58ab){return function(_0x255b03){if(_0x255b03){return _0x255b03['destroy']()[_0x28c7('0x20')](function(){var _0x53065c=_0x255b03['get']({'plain':!![]});var _0x702921=_0x28c7('0x21');return db[_0x28c7('0x22')]['destroy']({'where':{'type':_0x702921,'resourceId':_0x53065c['id']}})[_0x28c7('0x20')](function(){return _0x255b03;});})[_0x28c7('0x20')](function(){_0xce3171[_0x28c7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x560c40,_0x397f28){return function(_0x3ba07d){if(!_0x3ba07d){_0x560c40[_0x28c7('0x23')](0x194);}return _0x3ba07d;};}function handleError(_0x24a1a7,_0x4051d6){_0x4051d6=_0x4051d6||0x1f4;return function(_0x396f41){logger[_0x28c7('0x24')](_0x396f41['stack']);if(_0x396f41[_0x28c7('0x25')]){delete _0x396f41[_0x28c7('0x25')];}_0x24a1a7['status'](_0x4051d6)['send'](_0x396f41);};}exports[_0x28c7('0x26')]=function(_0x4d9725,_0x26422d){var _0x4caf92={},_0x21bcf9={},_0x571ded={'count':0x0,'rows':[]};var _0x5d639e=_[_0x28c7('0x27')](db['Sound'][_0x28c7('0x28')],function(_0x8ee4d){return{'name':_0x8ee4d['fieldName'],'type':_0x8ee4d['type']['key']};});_0x21bcf9['model']=_[_0x28c7('0x27')](_0x5d639e,_0x28c7('0x25'));_0x21bcf9[_0x28c7('0x29')]=_[_0x28c7('0x2a')](_0x4d9725[_0x28c7('0x29')]);_0x21bcf9[_0x28c7('0x2b')]=_[_0x28c7('0x2c')](_0x21bcf9['model'],_0x21bcf9[_0x28c7('0x29')]);_0x4caf92['attributes']=_[_0x28c7('0x2c')](_0x21bcf9[_0x28c7('0x2d')],qs[_0x28c7('0x2e')](_0x4d9725[_0x28c7('0x29')]['fields']));_0x4caf92[_0x28c7('0x2f')]=_0x4caf92[_0x28c7('0x2f')][_0x28c7('0x30')]?_0x4caf92[_0x28c7('0x2f')]:_0x21bcf9['model'];if(!_0x4d9725[_0x28c7('0x29')][_0x28c7('0x31')]('nolimit')){_0x4caf92[_0x28c7('0x1e')]=qs[_0x28c7('0x1e')](_0x4d9725[_0x28c7('0x29')][_0x28c7('0x1e')]);_0x4caf92[_0x28c7('0x1d')]=qs[_0x28c7('0x1d')](_0x4d9725[_0x28c7('0x29')][_0x28c7('0x1d')]);}_0x4caf92[_0x28c7('0x32')]=qs['sort'](_0x4d9725[_0x28c7('0x29')]['sort']);_0x4caf92[_0x28c7('0x33')]=qs[_0x28c7('0x2b')](_[_0x28c7('0x34')](_0x4d9725['query'],_0x21bcf9['filters']),_0x5d639e);if(_0x4d9725[_0x28c7('0x29')][_0x28c7('0x35')]){_0x4caf92['where']=_[_0x28c7('0x36')](_0x4caf92[_0x28c7('0x33')],{'$or':_[_0x28c7('0x27')](_0x5d639e,function(_0x4b2f65){if(_0x4b2f65[_0x28c7('0x37')]!==_0x28c7('0x38')){var _0x2d22dd={};_0x2d22dd[_0x4b2f65[_0x28c7('0x25')]]={'$like':'%'+_0x4d9725[_0x28c7('0x29')]['filter']+'%'};return _0x2d22dd;}})});}_0x4caf92=_[_0x28c7('0x36')]({},_0x4caf92,_0x4d9725[_0x28c7('0x39')]);var _0x36d557={'where':_0x4caf92[_0x28c7('0x33')]};return db['Sound'][_0x28c7('0x3a')](_0x36d557)[_0x28c7('0x20')](function(_0x32404d){_0x571ded['count']=_0x32404d;if(_0x4d9725['query'][_0x28c7('0x3b')]){_0x4caf92[_0x28c7('0x3c')]=[{'all':!![]}];}return db['Sound'][_0x28c7('0x3d')](_0x4caf92);})[_0x28c7('0x20')](function(_0x449629){_0x571ded[_0x28c7('0x3e')]=_0x449629;return _0x571ded;})['then'](respondWithFilteredResult(_0x26422d,_0x4caf92))[_0x28c7('0x3f')](handleError(_0x26422d,null));};exports[_0x28c7('0x40')]=function(_0x14eac7,_0xd41148){var _0x2ab0d1={'raw':!![],'where':{'id':_0x14eac7['params']['id']}},_0x158c34={};_0x158c34[_0x28c7('0x2d')]=_['keys'](db[_0x28c7('0x41')][_0x28c7('0x28')]);_0x158c34[_0x28c7('0x29')]=_['keys'](_0x14eac7[_0x28c7('0x29')]);_0x158c34[_0x28c7('0x2b')]=_[_0x28c7('0x2c')](_0x158c34[_0x28c7('0x2d')],_0x158c34[_0x28c7('0x29')]);_0x2ab0d1[_0x28c7('0x2f')]=_['intersection'](_0x158c34[_0x28c7('0x2d')],qs['fields'](_0x14eac7['query']['fields']));_0x2ab0d1['attributes']=_0x2ab0d1['attributes'][_0x28c7('0x30')]?_0x2ab0d1[_0x28c7('0x2f')]:_0x158c34[_0x28c7('0x2d')];if(_0x14eac7['query'][_0x28c7('0x3b')]){_0x2ab0d1[_0x28c7('0x3c')]=[{'all':!![]}];}_0x2ab0d1=_[_0x28c7('0x36')]({},_0x2ab0d1,_0x14eac7[_0x28c7('0x39')]);return db[_0x28c7('0x41')]['find'](_0x2ab0d1)[_0x28c7('0x20')](handleEntityNotFound(_0xd41148,null))[_0x28c7('0x20')](respondWithResult(_0xd41148,null))[_0x28c7('0x3f')](handleError(_0xd41148,null));};exports['download']=function(_0x4adae9,_0x4e40bb,_0x1dcfb3){return db[_0x28c7('0x41')][_0x28c7('0x42')]({'where':{'id':_0x4adae9[_0x28c7('0x43')]['id']},'attributes':[_0x28c7('0x25'),_0x28c7('0x44'),'converted_format'],'raw':!![]})[_0x28c7('0x20')](handleEntityNotFound(_0x4e40bb,null))['then'](function(_0x2cf07b){if(_0x2cf07b){if(!fs[_0x28c7('0x45')](path[_0x28c7('0x46')](config['root'],_0x28c7('0x47'),_0x2cf07b[_0x28c7('0x44')]+'.'+_0x2cf07b[_0x28c7('0x48')]))){throw new db['Sequelize'][(_0x28c7('0x49'))](_0x28c7('0x4a'));}return _0x4e40bb[_0x28c7('0x4b')](path['join'](config[_0x28c7('0x4c')],_0x28c7('0x47'),util[_0x28c7('0x4d')]('%s.%s',_0x2cf07b['save_name'],_0x2cf07b['converted_format'])),util['format'](_0x28c7('0x4e'),_0x2cf07b[_0x28c7('0x25')],_0x2cf07b[_0x28c7('0x48')]));}return null;})[_0x28c7('0x3f')](handleError(_0x4e40bb,null));};exports[_0x28c7('0x4f')]=function(_0xc69d5,_0x494f5c,_0x4e6f65){var _0x4f4845={'name':path[_0x28c7('0x50')](_0xc69d5[_0x28c7('0x51')][_0x28c7('0x52')],path[_0x28c7('0x53')](_0xc69d5[_0x28c7('0x51')]['originalname'])),'save_name':path[_0x28c7('0x50')](_0xc69d5['file'][_0x28c7('0x54')],path[_0x28c7('0x53')](_0xc69d5[_0x28c7('0x51')][_0x28c7('0x54')])),'original_format':path[_0x28c7('0x53')](_0xc69d5['file']['originalname'])[_0x28c7('0x55')](0x1),'converted_format':_0x28c7('0x56')};var _0x53513e=path['join'](config[_0x28c7('0x4c')],_0x28c7('0x57'),_0xc69d5['file'][_0x28c7('0x54')]);var _0x5ea3ce=path['join'](config[_0x28c7('0x4c')],'server/files/sounds/converted',util[_0x28c7('0x4d')](_0x28c7('0x4e'),path[_0x28c7('0x50')](_0xc69d5[_0x28c7('0x51')][_0x28c7('0x54')],path[_0x28c7('0x53')](_0xc69d5[_0x28c7('0x51')]['filename'])),_0x4f4845['converted_format']));logger['info'](_0x28c7('0x58'),_0x53513e);logger[_0x28c7('0x59')](_0x28c7('0x5a'),_0x5ea3ce);try{fs[_0x28c7('0x5b')](_0x53513e,parseInt(_0x28c7('0x5c'),0x8));var _0x193be3=sox[_0x28c7('0x5d')](_0x53513e,_0x5ea3ce,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x193be3['on'](_0x28c7('0x24'),function(_0x5d2245){fs[_0x28c7('0x5e')](_0x53513e);_0x494f5c[_0x28c7('0x19')](0x1f4)[_0x28c7('0x5f')](_0x5d2245);});_0x193be3['on'](_0x28c7('0x60'),function(_0x2db4a9){_0x4f4845[_0x28c7('0x61')]=isNaN(_0x2db4a9['duration'])?null:_0x2db4a9[_0x28c7('0x62')]*0x3e8;_0x4f4845[_0x28c7('0x63')]=isNaN(_0x2db4a9[_0x28c7('0x64')])?null:_0x2db4a9['sampleCount'];_0x4f4845[_0x28c7('0x65')]=isNaN(_0x2db4a9[_0x28c7('0x66')])?null:_0x2db4a9[_0x28c7('0x66')];_0x4f4845[_0x28c7('0x67')]=isNaN(_0x2db4a9[_0x28c7('0x68')])?null:_0x2db4a9[_0x28c7('0x68')];_0x4f4845[_0x28c7('0x69')]=isNaN(_0x2db4a9[_0x28c7('0x6a')])?null:_0x2db4a9[_0x28c7('0x6a')];});_0x193be3['on']('dest',function(_0x2bfdd6){_0x4f4845['converted_duration']=isNaN(_0x2bfdd6[_0x28c7('0x62')])?null:_0x2bfdd6[_0x28c7('0x62')]*0x3e8;_0x4f4845['converted_sampleCount']=isNaN(_0x2bfdd6[_0x28c7('0x64')])?null:_0x2bfdd6[_0x28c7('0x64')];_0x4f4845[_0x28c7('0x6b')]=isNaN(_0x2bfdd6[_0x28c7('0x66')])?null:_0x2bfdd6[_0x28c7('0x66')];_0x4f4845[_0x28c7('0x6c')]=isNaN(_0x2bfdd6[_0x28c7('0x68')])?null:_0x2bfdd6[_0x28c7('0x68')];_0x4f4845[_0x28c7('0x6d')]=isNaN(_0x2bfdd6[_0x28c7('0x6a')])?null:_0x2bfdd6['sampleRate'];});_0x193be3['on'](_0x28c7('0x1a'),function(){fs[_0x28c7('0x5b')](_0x5ea3ce,parseInt(_0x28c7('0x5c'),0x8));return db['Sound'][_0x28c7('0x4f')](_0x4f4845)['then'](function(_0x2e349f){var _0x2870e3={'role':_0xc69d5[_0x28c7('0x6e')][_0x28c7('0x6f')],'userProfileId':_0xc69d5[_0x28c7('0x6e')][_0x28c7('0x70')]};if(!_0x2870e3)throw new Error(_0x28c7('0x71'));if(_0x2870e3[_0x28c7('0x6f')]===_0x28c7('0x72')){var _0x1d0a3f=_0x2e349f[_0x28c7('0x73')]({'plain':!![]});return db['UserProfileSection'][_0x28c7('0x42')]({'where':{'name':_0x28c7('0x21'),'userProfileId':_0x2870e3['userProfileId']},'raw':!![]})[_0x28c7('0x20')](function(_0x5149c9){if(_0x5149c9&&_0x5149c9[_0x28c7('0x74')]===0x0){return db[_0x28c7('0x22')][_0x28c7('0x4f')]({'name':_0x1d0a3f['name'],'resourceId':_0x1d0a3f['id'],'type':_0x5149c9[_0x28c7('0x25')],'sectionId':_0x5149c9['id']},{})[_0x28c7('0x20')](function(){return _0x2e349f;});}else{return _0x2e349f;}})[_0x28c7('0x3f')](function(_0xd30099){logger[_0x28c7('0x24')](_0x28c7('0x75'),_0xd30099);throw _0xd30099;});}return _0x2e349f;})[_0x28c7('0x20')](respondWithResult(_0x494f5c,null))[_0x28c7('0x3f')](handleError(_0x494f5c,null));});_0x193be3[_0x28c7('0x76')]();}catch(_0x27286f){_0x494f5c[_0x28c7('0x19')](0x1f4)[_0x28c7('0x5f')](_0x27286f);}};exports['update']=function(_0xc9f4ec,_0xa311df,_0x23622a){return db[_0x28c7('0x41')][_0x28c7('0x42')]({'where':{'id':_0xc9f4ec[_0x28c7('0x43')]['id']}})['then'](handleEntityNotFound(_0xa311df,null))[_0x28c7('0x20')](saveUpdates(_[_0x28c7('0x34')](_0xc9f4ec[_0x28c7('0x6e')],[_0x28c7('0x25'),_0x28c7('0x77')]),null))['then'](respondWithResult(_0xa311df,null))['catch'](handleError(_0xa311df,null));};exports[_0x28c7('0x78')]=function(_0x608fde,_0x528f81,_0x1bb2c){return db[_0x28c7('0x41')][_0x28c7('0x42')]({'where':{'id':_0x608fde[_0x28c7('0x43')]['id']}})[_0x28c7('0x20')](function(_0x198157){if(_0x198157){return _0x198157[_0x28c7('0x79')]();}})['then'](function(_0x569501){var _0x29c22d=path[_0x28c7('0x46')](config[_0x28c7('0x4c')],_0x28c7('0x57'),util['format'](_0x28c7('0x4e'),_0x569501[_0x28c7('0x44')],_0x569501[_0x28c7('0x7a')]));var _0x2c9a0d=path['join'](config['root'],_0x28c7('0x47'),util[_0x28c7('0x4d')](_0x28c7('0x4e'),_0x569501[_0x28c7('0x44')],_0x569501[_0x28c7('0x48')]));fs['unlinkSync'](_0x29c22d);fs[_0x28c7('0x5e')](_0x2c9a0d);return _0x569501;})[_0x28c7('0x20')](function(_0x107997){if(_0x107997){return _0x528f81[_0x28c7('0x19')](0xcc)[_0x28c7('0x1a')]();}})['then'](handleEntityNotFound(_0x528f81,null))[_0x28c7('0x3f')](handleError(_0x528f81,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 54f1217..e2c8f4c 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 _0x7508=['../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x50ceed,_0x48e031){var _0x1f04c7=function(_0x3a854a){while(--_0x3a854a){_0x50ceed['push'](_0x50ceed['shift']());}};_0x1f04c7(++_0x48e031);}(_0x7508,0x172));var _0x8750=function(_0x420e4c,_0x29aefd){_0x420e4c=_0x420e4c-0x0;var _0xe903fd=_0x7508[_0x420e4c];return _0xe903fd;};'use strict';var _=require(_0x8750('0x0'));var util=require(_0x8750('0x1'));var logger=require(_0x8750('0x2'))(_0x8750('0x3'));var moment=require(_0x8750('0x4'));var BPromise=require(_0x8750('0x5'));var rp=require(_0x8750('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8750('0x7'));var config=require(_0x8750('0x8'));var attributes=require(_0x8750('0x9'));module[_0x8750('0xa')]=function(_0x4ccbdb,_0x5e84b9){return _0x4ccbdb[_0x8750('0xb')](_0x8750('0xc'),attributes,{'tableName':_0x8750('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x006a=['exports','Sound','tools_sounds','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x1715dc,_0x13bc84){var _0xd14263=function(_0x4a8e4e){while(--_0x4a8e4e){_0x1715dc['push'](_0x1715dc['shift']());}};_0xd14263(++_0x13bc84);}(_0x006a,0x135));var _0xa006=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x006a[_0x16bb4b];return _0x8aeb84;};'use strict';var _=require('lodash');var util=require(_0xa006('0x0'));var logger=require(_0xa006('0x1'))('api');var moment=require(_0xa006('0x2'));var BPromise=require('bluebird');var rp=require(_0xa006('0x3'));var fs=require('fs');var path=require(_0xa006('0x4'));var rimraf=require('rimraf');var config=require(_0xa006('0x5'));var attributes=require('./sound.attributes');module[_0xa006('0x6')]=function(_0x5ba0ae,_0x44f0d0){return _0x5ba0ae['define'](_0xa006('0x7'),attributes,{'tableName':_0xa006('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 00e23bf..3715deb 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 _0xdf00=['request','then','info','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','where','attributes','include','map','model','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x313139,_0x50cbee){var _0x4fb243=function(_0x250ac2){while(--_0x250ac2){_0x313139['push'](_0x313139['shift']());}};_0x4fb243(++_0x50cbee);}(_0xdf00,0x16a));var _0x0df0=function(_0x5e0442,_0x2db825){_0x5e0442=_0x5e0442-0x0;var _0x49102e=_0xdf00[_0x5e0442];return _0x49102e;};'use strict';var _=require(_0x0df0('0x0'));var util=require('util');var moment=require(_0x0df0('0x1'));var BPromise=require(_0x0df0('0x2'));var rs=require(_0x0df0('0x3'));var fs=require('fs');var Redis=require(_0x0df0('0x4'));var db=require(_0x0df0('0x5'))['db'];var utils=require(_0x0df0('0x6'));var logger=require('../../config/logger')(_0x0df0('0x7'));var config=require(_0x0df0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0df0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a5f76,_0x350de1,_0x1ca152){return new BPromise(function(_0x3fe6be,_0x59890f){return client[_0x0df0('0xa')](_0x5a5f76,_0x1ca152)[_0x0df0('0xb')](function(_0x3d491f){logger[_0x0df0('0xc')]('Sound,\x20%s,\x20%s',_0x350de1,_0x0df0('0xd'));logger['debug'](_0x0df0('0xe'),_0x350de1,_0x0df0('0xd'),JSON[_0x0df0('0xf')](_0x3d491f));if(_0x3d491f['error']){if(_0x3d491f['error']['code']===0x1f4){logger[_0x0df0('0x10')](_0x0df0('0x11'),_0x350de1,_0x3d491f[_0x0df0('0x10')][_0x0df0('0x12')]);return _0x59890f(_0x3d491f[_0x0df0('0x10')][_0x0df0('0x12')]);}logger[_0x0df0('0x10')]('Sound,\x20%s,\x20%s',_0x350de1,_0x3d491f[_0x0df0('0x10')][_0x0df0('0x12')]);return _0x3fe6be(_0x3d491f['error'][_0x0df0('0x12')]);}else{logger[_0x0df0('0xc')](_0x0df0('0x11'),_0x350de1,_0x0df0('0xd'));_0x3fe6be(_0x3d491f[_0x0df0('0x13')]['message']);}})[_0x0df0('0x14')](function(_0x3d11e6){logger['error'](_0x0df0('0x11'),_0x350de1,_0x3d11e6);_0x59890f(_0x3d11e6);});});}exports[_0x0df0('0x15')]=function(_0x3e86e8){var _0x438a0e=this;return new Promise(function(_0x2a15f6,_0x2b74bb){return db[_0x0df0('0x16')][_0x0df0('0x17')]({'raw':_0x3e86e8['options']?_0x3e86e8[_0x0df0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3e86e8[_0x0df0('0x18')]?_0x3e86e8[_0x0df0('0x18')][_0x0df0('0x19')]||null:null,'attributes':_0x3e86e8[_0x0df0('0x18')]?_0x3e86e8[_0x0df0('0x18')][_0x0df0('0x1a')]||null:null,'include':_0x3e86e8[_0x0df0('0x18')]?_0x3e86e8[_0x0df0('0x18')][_0x0df0('0x1b')]?_[_0x0df0('0x1c')](_0x3e86e8[_0x0df0('0x18')]['include'],function(_0x378740){return{'model':db[_0x378740[_0x0df0('0x1d')]],'as':_0x378740['as'],'attributes':_0x378740[_0x0df0('0x1a')],'include':_0x378740['include']?_[_0x0df0('0x1c')](_0x378740[_0x0df0('0x1b')],function(_0x1f6879){return{'model':db[_0x1f6879['model']],'as':_0x1f6879['as'],'attributes':_0x1f6879[_0x0df0('0x1a')],'include':_0x1f6879[_0x0df0('0x1b')]?_['map'](_0x1f6879['include'],function(_0x44452c){return{'model':db[_0x44452c[_0x0df0('0x1d')]],'as':_0x44452c['as'],'attributes':_0x44452c[_0x0df0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0df0('0xb')](function(_0x52c1b6){logger[_0x0df0('0xc')]('ShowSound',_0x3e86e8);logger[_0x0df0('0x1e')](_0x0df0('0x15'),_0x3e86e8,JSON['stringify'](_0x52c1b6));_0x2a15f6(_0x52c1b6);})[_0x0df0('0x14')](function(_0x4fa6df){logger['error']('ShowSound',_0x4fa6df['message'],_0x3e86e8);_0x2b74bb(_0x438a0e['error'](0x1f4,_0x4fa6df['message']));});});}; \ No newline at end of file +var _0xa473=['catch','Sound','find','options','raw','attributes','map','include','model','ShowSound','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1d4d69,_0x20d187){var _0x33c78f=function(_0x25f36e){while(--_0x25f36e){_0x1d4d69['push'](_0x1d4d69['shift']());}};_0x33c78f(++_0x20d187);}(_0xa473,0x96));var _0x3a47=function(_0x411bd7,_0x33ebb1){_0x411bd7=_0x411bd7-0x0;var _0x17d857=_0xa473[_0x411bd7];return _0x17d857;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3a47('0x0'));var fs=require('fs');var Redis=require(_0x3a47('0x1'));var db=require(_0x3a47('0x2'))['db'];var utils=require(_0x3a47('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x3a47('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x3a47('0x5')][_0x3a47('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2a4ede,_0x33d74f,_0x1c45e2){return new BPromise(function(_0x53a5b6,_0x1b7d5f){return client[_0x3a47('0x7')](_0x2a4ede,_0x1c45e2)[_0x3a47('0x8')](function(_0x254005){logger[_0x3a47('0x9')](_0x3a47('0xa'),_0x33d74f,_0x3a47('0xb'));logger[_0x3a47('0xc')](_0x3a47('0xd'),_0x33d74f,'request\x20sent',JSON[_0x3a47('0xe')](_0x254005));if(_0x254005[_0x3a47('0xf')]){if(_0x254005[_0x3a47('0xf')]['code']===0x1f4){logger[_0x3a47('0xf')](_0x3a47('0xa'),_0x33d74f,_0x254005[_0x3a47('0xf')]['message']);return _0x1b7d5f(_0x254005[_0x3a47('0xf')][_0x3a47('0x10')]);}logger[_0x3a47('0xf')](_0x3a47('0xa'),_0x33d74f,_0x254005[_0x3a47('0xf')][_0x3a47('0x10')]);return _0x53a5b6(_0x254005[_0x3a47('0xf')][_0x3a47('0x10')]);}else{logger[_0x3a47('0x9')](_0x3a47('0xa'),_0x33d74f,'request\x20sent');_0x53a5b6(_0x254005[_0x3a47('0x11')]['message']);}})[_0x3a47('0x12')](function(_0x340228){logger[_0x3a47('0xf')](_0x3a47('0xa'),_0x33d74f,_0x340228);_0x1b7d5f(_0x340228);});});}exports['ShowSound']=function(_0x3a6a64){var _0x1dde75=this;return new Promise(function(_0x1c2a7b,_0x3689a7){return db[_0x3a47('0x13')][_0x3a47('0x14')]({'raw':_0x3a6a64['options']?_0x3a6a64[_0x3a47('0x15')][_0x3a47('0x16')]===undefined?!![]:![]:!![],'where':_0x3a6a64[_0x3a47('0x15')]?_0x3a6a64[_0x3a47('0x15')]['where']||null:null,'attributes':_0x3a6a64[_0x3a47('0x15')]?_0x3a6a64[_0x3a47('0x15')][_0x3a47('0x17')]||null:null,'include':_0x3a6a64[_0x3a47('0x15')]?_0x3a6a64['options']['include']?_[_0x3a47('0x18')](_0x3a6a64[_0x3a47('0x15')][_0x3a47('0x19')],function(_0x2489fd){return{'model':db[_0x2489fd[_0x3a47('0x1a')]],'as':_0x2489fd['as'],'attributes':_0x2489fd[_0x3a47('0x17')],'include':_0x2489fd[_0x3a47('0x19')]?_[_0x3a47('0x18')](_0x2489fd[_0x3a47('0x19')],function(_0x547c1e){return{'model':db[_0x547c1e['model']],'as':_0x547c1e['as'],'attributes':_0x547c1e[_0x3a47('0x17')],'include':_0x547c1e['include']?_[_0x3a47('0x18')](_0x547c1e[_0x3a47('0x19')],function(_0x3f7db0){return{'model':db[_0x3f7db0[_0x3a47('0x1a')]],'as':_0x3f7db0['as'],'attributes':_0x3f7db0[_0x3a47('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3a47('0x8')](function(_0x5b1ce9){logger['info']('ShowSound',_0x3a6a64);logger[_0x3a47('0xc')]('ShowSound',_0x3a6a64,JSON['stringify'](_0x5b1ce9));_0x1c2a7b(_0x5b1ce9);})[_0x3a47('0x12')](function(_0xe9a40e){logger[_0x3a47('0xf')](_0x3a47('0x1b'),_0xe9a40e[_0x3a47('0x10')],_0x3a6a64);_0x3689a7(_0x1dde75[_0x3a47('0xf')](0x1f4,_0xe9a40e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 760cfa8..4ed2053 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 _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x383623,_0x5f028e){var _0x211231=function(_0x11f1d2){while(--_0x11f1d2){_0x383623['push'](_0x383623['shift']());}};_0x211231(++_0x5f028e);}(_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('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0x8603,0x190));var _0x3860=function(_0x3dd0b9,_0x1d6c92){_0x3dd0b9=_0x3dd0b9-0x0;var _0x4c0351=_0x8603[_0x3dd0b9];return _0x4c0351;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index dc5006e..82e299f 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 _0x6fd0=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x385b71,_0x2ae587){var _0x72ac1d=function(_0x5308f0){while(--_0x5308f0){_0x385b71['push'](_0x385b71['shift']());}};_0x72ac1d(++_0x2ae587);}(_0x6fd0,0x16e));var _0x06fd=function(_0x982e5e,_0x40c085){_0x982e5e=_0x982e5e-0x0;var _0x56e710=_0x6fd0[_0x982e5e];return _0x56e710;};'use strict';var Sequelize=require(_0x06fd('0x0'));module[_0x06fd('0x1')]={'uniqueid':{'type':Sequelize[_0x06fd('0x2')]},'body':{'type':Sequelize[_0x06fd('0x3')](_0x06fd('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x06fd('0x5')]('in',_0x06fd('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x06fd('0x3')]}}; \ No newline at end of file +var _0x6d08=['sequelize','exports','TEXT','medium','out'];(function(_0x5868b8,_0x71a9f2){var _0x1ccbe3=function(_0x2273db){while(--_0x2273db){_0x5868b8['push'](_0x5868b8['shift']());}};_0x1ccbe3(++_0x71a9f2);}(_0x6d08,0x109));var _0x86d0=function(_0xd72ae6,_0x4fe479){_0xd72ae6=_0xd72ae6-0x0;var _0x2ca7f9=_0x6d08[_0xd72ae6];return _0x2ca7f9;};'use strict';var Sequelize=require(_0x86d0('0x0'));module[_0x86d0('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x86d0('0x2')](_0x86d0('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x86d0('0x4')),'defaultValue':_0x86d0('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x86d0('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 74c3b46..00a5860 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 _0x2de3=['to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x2de3,0x150));var _0x32de=function(_0x5ab13c,_0x170696){_0x5ab13c=_0x5ab13c-0x0;var _0x3b4961=_0x2de3[_0x5ab13c];return _0x3b4961;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32de('0x0'));var zipdir=require(_0x32de('0x1'));var jsonpatch=require(_0x32de('0x2'));var rp=require(_0x32de('0x3'));var moment=require(_0x32de('0x4'));var BPromise=require(_0x32de('0x5'));var Mustache=require(_0x32de('0x6'));var util=require('util');var path=require(_0x32de('0x7'));var sox=require(_0x32de('0x8'));var csv=require(_0x32de('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32de('0xa'));var squel=require(_0x32de('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32de('0xc'));var toCsv=require('to-csv');var querystring=require(_0x32de('0xd'));var Papa=require('papaparse');var Redis=require(_0x32de('0xe'));var authService=require(_0x32de('0xf'));var qs=require(_0x32de('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x32de('0x11'))(_0x32de('0x12'));var utils=require(_0x32de('0x13'));var config=require(_0x32de('0x14'));var licenseUtil=require(_0x32de('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34f2b4,_0x1c14f9){_0x1c14f9=_0x1c14f9||0xcc;return function(_0x408afa){if(_0x408afa){return _0x34f2b4[_0x32de('0x16')](_0x1c14f9);}return _0x34f2b4['status'](_0x1c14f9)['end']();};}function respondWithResult(_0x53fa3a,_0x86457a){_0x86457a=_0x86457a||0xc8;return function(_0x39df6b){if(_0x39df6b){return _0x53fa3a[_0x32de('0x17')](_0x86457a)[_0x32de('0x18')](_0x39df6b);}};}function respondWithFilteredResult(_0x31e0de,_0x5c868f){return function(_0x2e9233){if(_0x2e9233){var _0x9e2050=typeof _0x5c868f['offset']===_0x32de('0x19')&&typeof _0x5c868f[_0x32de('0x1a')]===_0x32de('0x19');var _0x539113=_0x2e9233[_0x32de('0x1b')];var _0x589b74=_0x9e2050?0x0:_0x5c868f[_0x32de('0x1c')];var _0x4be62e=_0x9e2050?_0x2e9233['count']:_0x5c868f['offset']+_0x5c868f[_0x32de('0x1a')];var _0x5665aa;if(_0x4be62e>=_0x539113){_0x4be62e=_0x539113;_0x5665aa=0xc8;}else{_0x5665aa=0xce;}_0x31e0de[_0x32de('0x17')](_0x5665aa);return _0x31e0de[_0x32de('0x1d')](_0x32de('0x1e'),_0x589b74+'-'+_0x4be62e+'/'+_0x539113)[_0x32de('0x18')](_0x2e9233);}return null;};}function patchUpdates(_0x2a8a9e){return function(_0x43724a){try{jsonpatch[_0x32de('0x1f')](_0x43724a,_0x2a8a9e,!![]);}catch(_0x58865a){return BPromise['reject'](_0x58865a);}return _0x43724a[_0x32de('0x20')]();};}function saveUpdates(_0x27104f,_0x27d589){return function(_0xf806c8){if(_0xf806c8){return _0xf806c8[_0x32de('0x21')](_0x27104f)[_0x32de('0x22')](function(_0x3b532d){return _0x3b532d;});}return null;};}function removeEntity(_0x557b56,_0x5b8c44){return function(_0x5a6339){if(_0x5a6339){return _0x5a6339[_0x32de('0x23')]()[_0x32de('0x22')](function(){_0x557b56[_0x32de('0x17')](0xcc)[_0x32de('0x24')]();});}};}function handleEntityNotFound(_0x22ed22,_0x437f1d){return function(_0x1df91d){if(!_0x1df91d){_0x22ed22['sendStatus'](0x194);}return _0x1df91d;};}function handleError(_0x1885aa,_0x3116a8){_0x3116a8=_0x3116a8||0x1f4;return function(_0x29d0ef){logger[_0x32de('0x25')](_0x29d0ef['stack']);if(_0x29d0ef[_0x32de('0x26')]){delete _0x29d0ef[_0x32de('0x26')];}_0x1885aa[_0x32de('0x17')](_0x3116a8)['send'](_0x29d0ef);};}exports[_0x32de('0x27')]=function(_0x125533,_0x8e1f84){var _0x55948b={},_0x3eac53={},_0x349d65={'count':0x0,'rows':[]};var _0x48cc58=_[_0x32de('0x28')](db[_0x32de('0x29')][_0x32de('0x2a')],function(_0x5a5a8d){return{'name':_0x5a5a8d[_0x32de('0x2b')],'type':_0x5a5a8d[_0x32de('0x2c')][_0x32de('0x2d')]};});_0x3eac53[_0x32de('0x2e')]=_[_0x32de('0x28')](_0x48cc58,_0x32de('0x26'));_0x3eac53[_0x32de('0x2f')]=_[_0x32de('0x30')](_0x125533['query']);_0x3eac53['filters']=_[_0x32de('0x31')](_0x3eac53[_0x32de('0x2e')],_0x3eac53[_0x32de('0x2f')]);_0x55948b[_0x32de('0x32')]=_['intersection'](_0x3eac53[_0x32de('0x2e')],qs[_0x32de('0x33')](_0x125533[_0x32de('0x2f')]['fields']));_0x55948b['attributes']=_0x55948b[_0x32de('0x32')][_0x32de('0x34')]?_0x55948b[_0x32de('0x32')]:_0x3eac53[_0x32de('0x2e')];if(!_0x125533[_0x32de('0x2f')]['hasOwnProperty'](_0x32de('0x35'))){_0x55948b[_0x32de('0x1a')]=qs[_0x32de('0x1a')](_0x125533[_0x32de('0x2f')][_0x32de('0x1a')]);_0x55948b[_0x32de('0x1c')]=qs[_0x32de('0x1c')](_0x125533[_0x32de('0x2f')][_0x32de('0x1c')]);}_0x55948b[_0x32de('0x36')]=qs[_0x32de('0x37')](_0x125533[_0x32de('0x2f')][_0x32de('0x37')]);_0x55948b[_0x32de('0x38')]=qs[_0x32de('0x39')](_['pick'](_0x125533[_0x32de('0x2f')],_0x3eac53[_0x32de('0x39')]),_0x48cc58);if(_0x125533['query'][_0x32de('0x3a')]){_0x55948b[_0x32de('0x38')]=_['merge'](_0x55948b[_0x32de('0x38')],{'$or':_['map'](_0x48cc58,function(_0x3f3093){if(_0x3f3093[_0x32de('0x2c')]!==_0x32de('0x3b')){var _0x46385d={};_0x46385d[_0x3f3093[_0x32de('0x26')]]={'$like':'%'+_0x125533[_0x32de('0x2f')]['filter']+'%'};return _0x46385d;}})});}_0x55948b=_[_0x32de('0x3c')]({},_0x55948b,_0x125533[_0x32de('0x3d')]);var _0x2a5699={'where':_0x55948b[_0x32de('0x38')]};return db[_0x32de('0x29')][_0x32de('0x1b')](_0x2a5699)[_0x32de('0x22')](function(_0x4173d8){_0x349d65[_0x32de('0x1b')]=_0x4173d8;if(_0x125533[_0x32de('0x2f')][_0x32de('0x3e')]){_0x55948b[_0x32de('0x3f')]=[{'all':!![]}];}return db[_0x32de('0x29')][_0x32de('0x40')](_0x55948b);})[_0x32de('0x22')](function(_0x36d0e2){_0x349d65[_0x32de('0x41')]=_0x36d0e2;return _0x349d65;})[_0x32de('0x22')](respondWithFilteredResult(_0x8e1f84,_0x55948b))[_0x32de('0x42')](handleError(_0x8e1f84,null));};exports['show']=function(_0x1e9ea1,_0x194825){var _0x11b5a4={'raw':!![],'where':{'id':_0x1e9ea1[_0x32de('0x43')]['id']}},_0x3ace34={};_0x3ace34[_0x32de('0x2e')]=_[_0x32de('0x30')](db['SquareMessage'][_0x32de('0x2a')]);_0x3ace34[_0x32de('0x2f')]=_['keys'](_0x1e9ea1['query']);_0x3ace34[_0x32de('0x39')]=_[_0x32de('0x31')](_0x3ace34['model'],_0x3ace34[_0x32de('0x2f')]);_0x11b5a4[_0x32de('0x32')]=_[_0x32de('0x31')](_0x3ace34[_0x32de('0x2e')],qs[_0x32de('0x33')](_0x1e9ea1[_0x32de('0x2f')]['fields']));_0x11b5a4[_0x32de('0x32')]=_0x11b5a4[_0x32de('0x32')][_0x32de('0x34')]?_0x11b5a4['attributes']:_0x3ace34[_0x32de('0x2e')];if(_0x1e9ea1[_0x32de('0x2f')][_0x32de('0x3e')]){_0x11b5a4[_0x32de('0x3f')]=[{'all':!![]}];}_0x11b5a4=_[_0x32de('0x3c')]({},_0x11b5a4,_0x1e9ea1[_0x32de('0x3d')]);return db['SquareMessage'][_0x32de('0x44')](_0x11b5a4)[_0x32de('0x22')](handleEntityNotFound(_0x194825,null))[_0x32de('0x22')](respondWithResult(_0x194825,null))['catch'](handleError(_0x194825,null));};exports['create']=function(_0x59deb4,_0x27b901){return db['SquareMessage']['create'](_0x59deb4['body'],{})[_0x32de('0x22')](respondWithResult(_0x27b901,0xc9))[_0x32de('0x42')](handleError(_0x27b901,null));};exports[_0x32de('0x21')]=function(_0x18d552,_0x432bc4){if(_0x18d552['body']['id']){delete _0x18d552['body']['id'];}return db['SquareMessage']['find']({'where':{'id':_0x18d552[_0x32de('0x43')]['id']}})[_0x32de('0x22')](handleEntityNotFound(_0x432bc4,null))[_0x32de('0x22')](saveUpdates(_0x18d552['body'],null))['then'](respondWithResult(_0x432bc4,null))[_0x32de('0x42')](handleError(_0x432bc4,null));};exports[_0x32de('0x23')]=function(_0x2e8e14,_0x5ac094){return db[_0x32de('0x29')][_0x32de('0x44')]({'where':{'id':_0x2e8e14['params']['id']}})[_0x32de('0x22')](handleEntityNotFound(_0x5ac094,null))[_0x32de('0x22')](removeEntity(_0x5ac094,null))[_0x32de('0x42')](handleError(_0x5ac094,null));}; \ No newline at end of file +var _0x151b=['stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','keys','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','intersection','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','error'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0x151b,0x149));var _0xb151=function(_0x48b737,_0x263312){_0x48b737=_0x48b737-0x0;var _0x32939b=_0x151b[_0x48b737];return _0x32939b;};'use strict';var emlformat=require(_0xb151('0x0'));var rimraf=require(_0xb151('0x1'));var zipdir=require(_0xb151('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb151('0x3'));var moment=require(_0xb151('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb151('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb151('0x6'));var csv=require(_0xb151('0x7'));var ejs=require(_0xb151('0x8'));var fs=require('fs');var fs_extra=require(_0xb151('0x9'));var _=require(_0xb151('0xa'));var squel=require(_0xb151('0xb'));var crypto=require(_0xb151('0xc'));var jsforce=require(_0xb151('0xd'));var deskjs=require(_0xb151('0xe'));var toCsv=require(_0xb151('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb151('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb151('0x10'));var as=require(_0xb151('0x11'));var hardwareService=require(_0xb151('0x12'));var logger=require('../../config/logger')(_0xb151('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb151('0x14'));var db=require(_0xb151('0x15'))['db'];function respondWithStatusCode(_0x530b06,_0x4ef560){_0x4ef560=_0x4ef560||0xcc;return function(_0x84454a){if(_0x84454a){return _0x530b06[_0xb151('0x16')](_0x4ef560);}return _0x530b06[_0xb151('0x17')](_0x4ef560)[_0xb151('0x18')]();};}function respondWithResult(_0x38b251,_0x1a9037){_0x1a9037=_0x1a9037||0xc8;return function(_0x2df155){if(_0x2df155){return _0x38b251[_0xb151('0x17')](_0x1a9037)[_0xb151('0x19')](_0x2df155);}};}function respondWithFilteredResult(_0x428611,_0x17185e){return function(_0x5a3f25){if(_0x5a3f25){var _0x553e08=typeof _0x17185e[_0xb151('0x1a')]==='undefined'&&typeof _0x17185e[_0xb151('0x1b')]==='undefined';var _0x2166b7=_0x5a3f25[_0xb151('0x1c')];var _0x165874=_0x553e08?0x0:_0x17185e[_0xb151('0x1a')];var _0x333579=_0x553e08?_0x5a3f25[_0xb151('0x1c')]:_0x17185e[_0xb151('0x1a')]+_0x17185e[_0xb151('0x1b')];var _0x1c8dfc;if(_0x333579>=_0x2166b7){_0x333579=_0x2166b7;_0x1c8dfc=0xc8;}else{_0x1c8dfc=0xce;}_0x428611[_0xb151('0x17')](_0x1c8dfc);return _0x428611['set'](_0xb151('0x1d'),_0x165874+'-'+_0x333579+'/'+_0x2166b7)[_0xb151('0x19')](_0x5a3f25);}return null;};}function patchUpdates(_0x556bee){return function(_0x28a4a2){try{jsonpatch[_0xb151('0x1e')](_0x28a4a2,_0x556bee,!![]);}catch(_0x333f80){return BPromise[_0xb151('0x1f')](_0x333f80);}return _0x28a4a2[_0xb151('0x20')]();};}function saveUpdates(_0x5841ce,_0x2a016a){return function(_0x1bc9cd){if(_0x1bc9cd){return _0x1bc9cd[_0xb151('0x21')](_0x5841ce)[_0xb151('0x22')](function(_0xe490a6){return _0xe490a6;});}return null;};}function removeEntity(_0x16053e,_0x3ce2e6){return function(_0x55d9ee){if(_0x55d9ee){return _0x55d9ee['destroy']()[_0xb151('0x22')](function(){_0x16053e[_0xb151('0x17')](0xcc)[_0xb151('0x18')]();});}};}function handleEntityNotFound(_0x195b50,_0x27f92b){return function(_0x1ab34f){if(!_0x1ab34f){_0x195b50[_0xb151('0x16')](0x194);}return _0x1ab34f;};}function handleError(_0x192333,_0x336271){_0x336271=_0x336271||0x1f4;return function(_0x12eebe){logger[_0xb151('0x23')](_0x12eebe[_0xb151('0x24')]);if(_0x12eebe[_0xb151('0x25')]){delete _0x12eebe['name'];}_0x192333[_0xb151('0x17')](_0x336271)[_0xb151('0x26')](_0x12eebe);};}exports[_0xb151('0x27')]=function(_0x4feb14,_0x1cad02){var _0x5abe78={},_0x1adc37={},_0x1bdd90={'count':0x0,'rows':[]};var _0x34b80b=_[_0xb151('0x28')](db[_0xb151('0x29')][_0xb151('0x2a')],function(_0x57f653){return{'name':_0x57f653[_0xb151('0x2b')],'type':_0x57f653['type'][_0xb151('0x2c')]};});_0x1adc37['model']=_[_0xb151('0x28')](_0x34b80b,_0xb151('0x25'));_0x1adc37['query']=_[_0xb151('0x2d')](_0x4feb14[_0xb151('0x2e')]);_0x1adc37[_0xb151('0x2f')]=_['intersection'](_0x1adc37['model'],_0x1adc37[_0xb151('0x2e')]);_0x5abe78[_0xb151('0x30')]=_['intersection'](_0x1adc37[_0xb151('0x31')],qs[_0xb151('0x32')](_0x4feb14[_0xb151('0x2e')]['fields']));_0x5abe78[_0xb151('0x30')]=_0x5abe78[_0xb151('0x30')][_0xb151('0x33')]?_0x5abe78[_0xb151('0x30')]:_0x1adc37[_0xb151('0x31')];if(!_0x4feb14['query'][_0xb151('0x34')](_0xb151('0x35'))){_0x5abe78[_0xb151('0x1b')]=qs[_0xb151('0x1b')](_0x4feb14[_0xb151('0x2e')]['limit']);_0x5abe78[_0xb151('0x1a')]=qs[_0xb151('0x1a')](_0x4feb14[_0xb151('0x2e')]['offset']);}_0x5abe78[_0xb151('0x36')]=qs[_0xb151('0x37')](_0x4feb14[_0xb151('0x2e')][_0xb151('0x37')]);_0x5abe78[_0xb151('0x38')]=qs['filters'](_[_0xb151('0x39')](_0x4feb14['query'],_0x1adc37[_0xb151('0x2f')]),_0x34b80b);if(_0x4feb14[_0xb151('0x2e')][_0xb151('0x3a')]){_0x5abe78[_0xb151('0x38')]=_[_0xb151('0x3b')](_0x5abe78[_0xb151('0x38')],{'$or':_['map'](_0x34b80b,function(_0x5d7dda){if(_0x5d7dda['type']!==_0xb151('0x3c')){var _0x381f76={};_0x381f76[_0x5d7dda['name']]={'$like':'%'+_0x4feb14[_0xb151('0x2e')][_0xb151('0x3a')]+'%'};return _0x381f76;}})});}_0x5abe78=_[_0xb151('0x3b')]({},_0x5abe78,_0x4feb14['options']);var _0x426abe={'where':_0x5abe78[_0xb151('0x38')]};return db[_0xb151('0x29')][_0xb151('0x1c')](_0x426abe)[_0xb151('0x22')](function(_0x312bc2){_0x1bdd90[_0xb151('0x1c')]=_0x312bc2;if(_0x4feb14['query'][_0xb151('0x3d')]){_0x5abe78[_0xb151('0x3e')]=[{'all':!![]}];}return db[_0xb151('0x29')][_0xb151('0x3f')](_0x5abe78);})[_0xb151('0x22')](function(_0x311c44){_0x1bdd90['rows']=_0x311c44;return _0x1bdd90;})[_0xb151('0x22')](respondWithFilteredResult(_0x1cad02,_0x5abe78))['catch'](handleError(_0x1cad02,null));};exports[_0xb151('0x40')]=function(_0x680f74,_0x1e46b3){var _0x35b919={'raw':!![],'where':{'id':_0x680f74[_0xb151('0x41')]['id']}},_0x3318c2={};_0x3318c2[_0xb151('0x31')]=_[_0xb151('0x2d')](db[_0xb151('0x29')][_0xb151('0x2a')]);_0x3318c2['query']=_[_0xb151('0x2d')](_0x680f74[_0xb151('0x2e')]);_0x3318c2[_0xb151('0x2f')]=_[_0xb151('0x42')](_0x3318c2[_0xb151('0x31')],_0x3318c2[_0xb151('0x2e')]);_0x35b919[_0xb151('0x30')]=_[_0xb151('0x42')](_0x3318c2[_0xb151('0x31')],qs['fields'](_0x680f74[_0xb151('0x2e')][_0xb151('0x32')]));_0x35b919[_0xb151('0x30')]=_0x35b919[_0xb151('0x30')][_0xb151('0x33')]?_0x35b919['attributes']:_0x3318c2[_0xb151('0x31')];if(_0x680f74['query']['includeAll']){_0x35b919[_0xb151('0x3e')]=[{'all':!![]}];}_0x35b919=_[_0xb151('0x3b')]({},_0x35b919,_0x680f74[_0xb151('0x43')]);return db['SquareMessage'][_0xb151('0x44')](_0x35b919)['then'](handleEntityNotFound(_0x1e46b3,null))['then'](respondWithResult(_0x1e46b3,null))[_0xb151('0x45')](handleError(_0x1e46b3,null));};exports[_0xb151('0x46')]=function(_0x1fabe2,_0x442d98){return db['SquareMessage']['create'](_0x1fabe2[_0xb151('0x47')],{})['then'](respondWithResult(_0x442d98,0xc9))[_0xb151('0x45')](handleError(_0x442d98,null));};exports[_0xb151('0x21')]=function(_0x70483,_0x468ea1){if(_0x70483[_0xb151('0x47')]['id']){delete _0x70483['body']['id'];}return db[_0xb151('0x29')][_0xb151('0x44')]({'where':{'id':_0x70483['params']['id']}})[_0xb151('0x22')](handleEntityNotFound(_0x468ea1,null))['then'](saveUpdates(_0x70483[_0xb151('0x47')],null))['then'](respondWithResult(_0x468ea1,null))[_0xb151('0x45')](handleError(_0x468ea1,null));};exports[_0xb151('0x48')]=function(_0x4ab60b,_0x473db4){return db[_0xb151('0x29')][_0xb151('0x44')]({'where':{'id':_0x4ab60b[_0xb151('0x41')]['id']}})[_0xb151('0x22')](handleEntityNotFound(_0x473db4,null))['then'](removeEntity(_0x473db4,null))['catch'](handleError(_0x473db4,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 01ee019..def9835 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 _0xab61=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x48efe6,_0x256f2a){var _0x39bff6=function(_0x542406){while(--_0x542406){_0x48efe6['push'](_0x48efe6['shift']());}};_0x39bff6(++_0x256f2a);}(_0xab61,0x134));var _0x1ab6=function(_0x2b2b38,_0x1f78d3){_0x2b2b38=_0x2b2b38-0x0;var _0xefbdbc=_0xab61[_0x2b2b38];return _0xefbdbc;};'use strict';var _=require(_0x1ab6('0x0'));var util=require('util');var logger=require(_0x1ab6('0x1'))(_0x1ab6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1ab6('0x3'));var fs=require('fs');var path=require(_0x1ab6('0x4'));var rimraf=require(_0x1ab6('0x5'));var config=require(_0x1ab6('0x6'));var attributes=require(_0x1ab6('0x7'));module[_0x1ab6('0x8')]=function(_0x2d387f,_0x2d5ac1){return _0x2d387f[_0x1ab6('0x9')](_0x1ab6('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda5a=['moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util'];(function(_0x48f827,_0x269e8d){var _0xc763f7=function(_0x19769a){while(--_0x19769a){_0x48f827['push'](_0x48f827['shift']());}};_0xc763f7(++_0x269e8d);}(_0xda5a,0x17f));var _0xada5=function(_0x458109,_0x33dc5b){_0x458109=_0x458109-0x0;var _0x1cc56c=_0xda5a[_0x458109];return _0x1cc56c;};'use strict';var _=require(_0xada5('0x0'));var util=require(_0xada5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xada5('0x2'));var BPromise=require(_0xada5('0x3'));var rp=require(_0xada5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xada5('0x5'));var config=require(_0xada5('0x6'));var attributes=require(_0xada5('0x7'));module['exports']=function(_0x25632a,_0xc8c324){return _0x25632a[_0xada5('0x8')](_0xada5('0x9'),attributes,{'tableName':_0xada5('0xa'),'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 9284b9f..97a6daa 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 _0x65ad=['SquareMessage,\x20%s,\x20%s','message','result','catch','SquareMessage','body','options','raw','CreateSquareMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3aaf69,_0x318ff9){var _0x4542c6=function(_0x5d1369){while(--_0x5d1369){_0x3aaf69['push'](_0x3aaf69['shift']());}};_0x4542c6(++_0x318ff9);}(_0x65ad,0xdb));var _0xd65a=function(_0x582661,_0x17e5cc){_0x582661=_0x582661-0x0;var _0x436fe8=_0x65ad[_0x582661];return _0x436fe8;};'use strict';var _=require(_0xd65a('0x0'));var util=require(_0xd65a('0x1'));var moment=require(_0xd65a('0x2'));var BPromise=require(_0xd65a('0x3'));var rs=require(_0xd65a('0x4'));var fs=require('fs');var Redis=require(_0xd65a('0x5'));var db=require(_0xd65a('0x6'))['db'];var utils=require(_0xd65a('0x7'));var logger=require(_0xd65a('0x8'))(_0xd65a('0x9'));var config=require(_0xd65a('0xa'));var jayson=require(_0xd65a('0xb'));var client=jayson[_0xd65a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d1b4d,_0x37d708,_0x518cb2){return new BPromise(function(_0x33da6d,_0x5e852e){return client[_0xd65a('0xd')](_0x4d1b4d,_0x518cb2)[_0xd65a('0xe')](function(_0x371cd6){logger['info']('SquareMessage,\x20%s,\x20%s',_0x37d708,_0xd65a('0xf'));logger[_0xd65a('0x10')](_0xd65a('0x11'),_0x37d708,_0xd65a('0xf'),JSON[_0xd65a('0x12')](_0x371cd6));if(_0x371cd6[_0xd65a('0x13')]){if(_0x371cd6['error'][_0xd65a('0x14')]===0x1f4){logger['error'](_0xd65a('0x15'),_0x37d708,_0x371cd6[_0xd65a('0x13')][_0xd65a('0x16')]);return _0x5e852e(_0x371cd6[_0xd65a('0x13')]['message']);}logger[_0xd65a('0x13')](_0xd65a('0x15'),_0x37d708,_0x371cd6['error'][_0xd65a('0x16')]);return _0x33da6d(_0x371cd6[_0xd65a('0x13')][_0xd65a('0x16')]);}else{logger['info'](_0xd65a('0x15'),_0x37d708,'request\x20sent');_0x33da6d(_0x371cd6[_0xd65a('0x17')][_0xd65a('0x16')]);}})[_0xd65a('0x18')](function(_0x425321){logger[_0xd65a('0x13')]('SquareMessage,\x20%s,\x20%s',_0x37d708,_0x425321);_0x5e852e(_0x425321);});});}exports['CreateSquareMessage']=function(_0x5c8e6f){var _0x350936=this;return new Promise(function(_0x87158a,_0x68abb){return db[_0xd65a('0x19')]['create'](_0x5c8e6f[_0xd65a('0x1a')],{'raw':_0x5c8e6f[_0xd65a('0x1b')]?_0x5c8e6f['options'][_0xd65a('0x1c')]===undefined?!![]:![]:!![]})[_0xd65a('0xe')](function(_0x2cdfb3){logger['info'](_0xd65a('0x1d'),_0x5c8e6f);logger['debug'](_0xd65a('0x1d'),_0x5c8e6f,JSON['stringify'](_0x2cdfb3));_0x87158a(_0x2cdfb3);})[_0xd65a('0x18')](function(_0x36cac7){logger['error']('CreateSquareMessage',_0x36cac7['message'],_0x5c8e6f);_0x68abb(_0x350936[_0xd65a('0x13')](0x1f4,_0x36cac7['message']));});});}; \ No newline at end of file +var _0x2eb7=['code','message','catch','CreateSquareMessage','SquareMessage','create','body','options','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55abb3,_0x5c2552){var _0x586b93=function(_0x5af402){while(--_0x5af402){_0x55abb3['push'](_0x55abb3['shift']());}};_0x586b93(++_0x5c2552);}(_0x2eb7,0x175));var _0x72eb=function(_0x4646e8,_0xc7e24e){_0x4646e8=_0x4646e8-0x0;var _0x16e2ae=_0x2eb7[_0x4646e8];return _0x16e2ae;};'use strict';var _=require(_0x72eb('0x0'));var util=require(_0x72eb('0x1'));var moment=require('moment');var BPromise=require(_0x72eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72eb('0x3'));var db=require(_0x72eb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x72eb('0x5'))(_0x72eb('0x6'));var config=require(_0x72eb('0x7'));var jayson=require(_0x72eb('0x8'));var client=jayson[_0x72eb('0x9')][_0x72eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2423fc,_0x5d9bfa,_0x220f1b){return new BPromise(function(_0x259cfc,_0x491ecf){return client[_0x72eb('0xb')](_0x2423fc,_0x220f1b)[_0x72eb('0xc')](function(_0x1c0f18){logger[_0x72eb('0xd')](_0x72eb('0xe'),_0x5d9bfa,_0x72eb('0xf'));logger['debug'](_0x72eb('0x10'),_0x5d9bfa,'request\x20sent',JSON[_0x72eb('0x11')](_0x1c0f18));if(_0x1c0f18[_0x72eb('0x12')]){if(_0x1c0f18[_0x72eb('0x12')][_0x72eb('0x13')]===0x1f4){logger[_0x72eb('0x12')](_0x72eb('0xe'),_0x5d9bfa,_0x1c0f18[_0x72eb('0x12')][_0x72eb('0x14')]);return _0x491ecf(_0x1c0f18['error'][_0x72eb('0x14')]);}logger[_0x72eb('0x12')]('SquareMessage,\x20%s,\x20%s',_0x5d9bfa,_0x1c0f18[_0x72eb('0x12')]['message']);return _0x259cfc(_0x1c0f18[_0x72eb('0x12')][_0x72eb('0x14')]);}else{logger['info'](_0x72eb('0xe'),_0x5d9bfa,_0x72eb('0xf'));_0x259cfc(_0x1c0f18['result'][_0x72eb('0x14')]);}})[_0x72eb('0x15')](function(_0x32e03f){logger[_0x72eb('0x12')]('SquareMessage,\x20%s,\x20%s',_0x5d9bfa,_0x32e03f);_0x491ecf(_0x32e03f);});});}exports[_0x72eb('0x16')]=function(_0x2941b0){var _0x1d84c5=this;return new Promise(function(_0x10d59c,_0xff1f1){return db[_0x72eb('0x17')][_0x72eb('0x18')](_0x2941b0[_0x72eb('0x19')],{'raw':_0x2941b0[_0x72eb('0x1a')]?_0x2941b0[_0x72eb('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x72eb('0xc')](function(_0x516d69){logger[_0x72eb('0xd')]('CreateSquareMessage',_0x2941b0);logger[_0x72eb('0x1b')](_0x72eb('0x16'),_0x2941b0,JSON[_0x72eb('0x11')](_0x516d69));_0x10d59c(_0x516d69);})[_0x72eb('0x15')](function(_0x4b69f0){logger[_0x72eb('0x12')]('CreateSquareMessage',_0x4b69f0[_0x72eb('0x14')],_0x2941b0);_0xff1f1(_0x1d84c5[_0x72eb('0x12')](0x1f4,_0x4b69f0[_0x72eb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 65b3a55..981963a 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 _0x04b7=['/:id/test','15s','test','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x244c29,_0x1ab93c){var _0x4845af=function(_0x476c49){while(--_0x476c49){_0x244c29['push'](_0x244c29['shift']());}};_0x4845af(++_0x1ab93c);}(_0x04b7,0x180));var _0x704b=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0x04b7[_0xd3b0ac];return _0x3d773e;};'use strict';var multer=require(_0x704b('0x0'));var util=require(_0x704b('0x1'));var path=require('path');var timeout=require(_0x704b('0x2'));var express=require(_0x704b('0x3'));var router=express[_0x704b('0x4')]();var fs_extra=require(_0x704b('0x5'));var auth=require(_0x704b('0x6'));var interaction=require(_0x704b('0x7'));var config=require(_0x704b('0x8'));var controller=require('./squareOdbc.controller');router[_0x704b('0x9')]('/',auth[_0x704b('0xa')](),controller['index']);router['get'](_0x704b('0xb'),auth[_0x704b('0xa')](),controller['show']);router[_0x704b('0x9')](_0x704b('0xc'),auth[_0x704b('0xa')](),timeout(_0x704b('0xd')),controller[_0x704b('0xe')]);router[_0x704b('0xf')]('/',auth[_0x704b('0xa')](),controller[_0x704b('0x10')]);router[_0x704b('0x11')](_0x704b('0xb'),auth[_0x704b('0xa')](),controller[_0x704b('0x12')]);router[_0x704b('0x13')](_0x704b('0xb'),auth[_0x704b('0xa')](),controller[_0x704b('0x14')]);module[_0x704b('0x15')]=router; \ No newline at end of file +var _0x2be9=['test','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','15s'];(function(_0x4a4c78,_0x13d5b7){var _0xd58f32=function(_0x32cc8e){while(--_0x32cc8e){_0x4a4c78['push'](_0x4a4c78['shift']());}};_0xd58f32(++_0x13d5b7);}(_0x2be9,0xa7));var _0x92be=function(_0x1aec28,_0x556b6f){_0x1aec28=_0x1aec28-0x0;var _0x2398c7=_0x2be9[_0x1aec28];return _0x2398c7;};'use strict';var multer=require(_0x92be('0x0'));var util=require(_0x92be('0x1'));var path=require(_0x92be('0x2'));var timeout=require(_0x92be('0x3'));var express=require(_0x92be('0x4'));var router=express[_0x92be('0x5')]();var fs_extra=require(_0x92be('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x92be('0x7'));var config=require(_0x92be('0x8'));var controller=require('./squareOdbc.controller');router[_0x92be('0x9')]('/',auth[_0x92be('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x92be('0xb')]);router[_0x92be('0x9')]('/:id/test',auth[_0x92be('0xa')](),timeout(_0x92be('0xc')),controller[_0x92be('0xd')]);router['post']('/',auth[_0x92be('0xa')](),controller[_0x92be('0xe')]);router[_0x92be('0xf')](_0x92be('0x10'),auth[_0x92be('0xa')](),controller['update']);router[_0x92be('0x11')](_0x92be('0x10'),auth['isAuthenticated'](),controller[_0x92be('0x12')]);module[_0x92be('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 147097b..8a12ab6 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 _0x091a=['STRING','sequelize','exports','name'];(function(_0x5e9689,_0x48e034){var _0x2fac94=function(_0x1e8f97){while(--_0x1e8f97){_0x5e9689['push'](_0x5e9689['shift']());}};_0x2fac94(++_0x48e034);}(_0x091a,0x105));var _0xa091=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x091a[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require(_0xa091('0x0'));module[_0xa091('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa091('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa091('0x3')]},'description':{'type':Sequelize[_0xa091('0x3')]}}; \ No newline at end of file +var _0x54aa=['exports','STRING','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54aa,0x123));var _0xa54a=function(_0x4880dc,_0x25b8ae){_0x4880dc=_0x4880dc-0x0;var _0x458ebf=_0x54aa[_0x4880dc];return _0x458ebf;};'use strict';var Sequelize=require(_0xa54a('0x0'));module[_0xa54a('0x1')]={'name':{'type':Sequelize[_0xa54a('0x2')],'unique':_0xa54a('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa54a('0x2')]},'description':{'type':Sequelize[_0xa54a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index ea1f7ba..043689c 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 _0xd5b7=['lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ODBC','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra'];(function(_0x2808e3,_0x56a6b1){var _0x4a58eb=function(_0x5b6694){while(--_0x5b6694){_0x2808e3['push'](_0x2808e3['shift']());}};_0x4a58eb(++_0x56a6b1);}(_0xd5b7,0x155));var _0x7d5b=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0xd5b7[_0x4e697a];return _0x88850c;};'use strict';var emlformat=require(_0x7d5b('0x0'));var rimraf=require(_0x7d5b('0x1'));var zipdir=require(_0x7d5b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d5b('0x3'));var moment=require(_0x7d5b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7d5b('0x5'));var util=require(_0x7d5b('0x6'));var path=require(_0x7d5b('0x7'));var sox=require(_0x7d5b('0x8'));var csv=require('to-csv');var ejs=require(_0x7d5b('0x9'));var fs=require('fs');var fs_extra=require(_0x7d5b('0xa'));var _=require(_0x7d5b('0xb'));var squel=require(_0x7d5b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d5b('0xd'));var toCsv=require(_0x7d5b('0xe'));var querystring=require(_0x7d5b('0xf'));var Papa=require(_0x7d5b('0x10'));var Redis=require(_0x7d5b('0x11'));var authService=require(_0x7d5b('0x12'));var qs=require(_0x7d5b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d5b('0x14'));var utils=require(_0x7d5b('0x15'));var config=require(_0x7d5b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d5b('0x17'))['db'];function respondWithStatusCode(_0x27e225,_0xbb8e10){_0xbb8e10=_0xbb8e10||0xcc;return function(_0x5c2ee3){if(_0x5c2ee3){return _0x27e225[_0x7d5b('0x18')](_0xbb8e10);}return _0x27e225[_0x7d5b('0x19')](_0xbb8e10)[_0x7d5b('0x1a')]();};}function respondWithResult(_0x29453a,_0x8c2af7){_0x8c2af7=_0x8c2af7||0xc8;return function(_0x22dbe0){if(_0x22dbe0){return _0x29453a[_0x7d5b('0x19')](_0x8c2af7)[_0x7d5b('0x1b')](_0x22dbe0);}};}function respondWithFilteredResult(_0x12a91e,_0x1eb723){return function(_0x40ef5a){if(_0x40ef5a){var _0x351901=typeof _0x1eb723[_0x7d5b('0x1c')]===_0x7d5b('0x1d')&&typeof _0x1eb723[_0x7d5b('0x1e')]===_0x7d5b('0x1d');var _0x1453c6=_0x40ef5a['count'];var _0x30b36a=_0x351901?0x0:_0x1eb723[_0x7d5b('0x1c')];var _0x3b16e0=_0x351901?_0x40ef5a[_0x7d5b('0x1f')]:_0x1eb723['offset']+_0x1eb723[_0x7d5b('0x1e')];var _0x4daf38;if(_0x3b16e0>=_0x1453c6){_0x3b16e0=_0x1453c6;_0x4daf38=0xc8;}else{_0x4daf38=0xce;}_0x12a91e[_0x7d5b('0x19')](_0x4daf38);return _0x12a91e['set'](_0x7d5b('0x20'),_0x30b36a+'-'+_0x3b16e0+'/'+_0x1453c6)[_0x7d5b('0x1b')](_0x40ef5a);}return null;};}function patchUpdates(_0x24db79){return function(_0x47bf97){try{jsonpatch[_0x7d5b('0x21')](_0x47bf97,_0x24db79,!![]);}catch(_0x421c6b){return BPromise[_0x7d5b('0x22')](_0x421c6b);}return _0x47bf97[_0x7d5b('0x23')]();};}function saveUpdates(_0x3bde54,_0x8f37fa){return function(_0x5628da){if(_0x5628da){return _0x5628da[_0x7d5b('0x24')](_0x3bde54)[_0x7d5b('0x25')](function(_0x54e08a){return _0x54e08a;});}return null;};}function removeEntity(_0x3db10a,_0x47770e){return function(_0x34b096){if(_0x34b096){return _0x34b096[_0x7d5b('0x26')]()['then'](function(){var _0x2fbe25=_0x34b096['get']({'plain':!![]});var _0x203df3='ODBC';return db[_0x7d5b('0x27')][_0x7d5b('0x26')]({'where':{'type':_0x203df3,'resourceId':_0x2fbe25['id']}})[_0x7d5b('0x25')](function(){return _0x34b096;});})[_0x7d5b('0x25')](function(){_0x3db10a[_0x7d5b('0x19')](0xcc)[_0x7d5b('0x1a')]();});}};}function handleEntityNotFound(_0x467b5c,_0x36d1ae){return function(_0xdf9d9){if(!_0xdf9d9){_0x467b5c[_0x7d5b('0x18')](0x194);}return _0xdf9d9;};}function handleError(_0x10bc9f,_0x31ccd4){_0x31ccd4=_0x31ccd4||0x1f4;return function(_0xe96403){logger[_0x7d5b('0x28')](_0xe96403[_0x7d5b('0x29')]);if(_0xe96403[_0x7d5b('0x2a')]){delete _0xe96403[_0x7d5b('0x2a')];}_0x10bc9f[_0x7d5b('0x19')](_0x31ccd4)['send'](_0xe96403);};}exports[_0x7d5b('0x2b')]=function(_0xbc59ab,_0xb5e723){var _0x1bcfd3={},_0x324e0c={},_0x381e57={'count':0x0,'rows':[]};var _0x1d2cc6=_[_0x7d5b('0x2c')](db[_0x7d5b('0x2d')][_0x7d5b('0x2e')],function(_0x22a2d1){return{'name':_0x22a2d1['fieldName'],'type':_0x22a2d1[_0x7d5b('0x2f')][_0x7d5b('0x30')]};});_0x324e0c['model']=_['map'](_0x1d2cc6,_0x7d5b('0x2a'));_0x324e0c[_0x7d5b('0x31')]=_[_0x7d5b('0x32')](_0xbc59ab[_0x7d5b('0x31')]);_0x324e0c[_0x7d5b('0x33')]=_[_0x7d5b('0x34')](_0x324e0c[_0x7d5b('0x35')],_0x324e0c[_0x7d5b('0x31')]);_0x1bcfd3['attributes']=_[_0x7d5b('0x34')](_0x324e0c[_0x7d5b('0x35')],qs[_0x7d5b('0x36')](_0xbc59ab['query'][_0x7d5b('0x36')]));_0x1bcfd3['attributes']=_0x1bcfd3[_0x7d5b('0x37')]['length']?_0x1bcfd3[_0x7d5b('0x37')]:_0x324e0c['model'];if(!_0xbc59ab['query'][_0x7d5b('0x38')](_0x7d5b('0x39'))){_0x1bcfd3[_0x7d5b('0x1e')]=qs[_0x7d5b('0x1e')](_0xbc59ab[_0x7d5b('0x31')][_0x7d5b('0x1e')]);_0x1bcfd3[_0x7d5b('0x1c')]=qs[_0x7d5b('0x1c')](_0xbc59ab[_0x7d5b('0x31')]['offset']);}_0x1bcfd3[_0x7d5b('0x3a')]=qs['sort'](_0xbc59ab['query']['sort']);_0x1bcfd3[_0x7d5b('0x3b')]=qs[_0x7d5b('0x33')](_[_0x7d5b('0x3c')](_0xbc59ab[_0x7d5b('0x31')],_0x324e0c[_0x7d5b('0x33')]),_0x1d2cc6);if(_0xbc59ab[_0x7d5b('0x31')][_0x7d5b('0x3d')]){_0x1bcfd3[_0x7d5b('0x3b')]=_[_0x7d5b('0x3e')](_0x1bcfd3[_0x7d5b('0x3b')],{'$or':_[_0x7d5b('0x2c')](_0x1d2cc6,function(_0x2169e1){if(_0x2169e1[_0x7d5b('0x2f')]!==_0x7d5b('0x3f')){var _0x2a4f15={};_0x2a4f15[_0x2169e1[_0x7d5b('0x2a')]]={'$like':'%'+_0xbc59ab[_0x7d5b('0x31')][_0x7d5b('0x3d')]+'%'};return _0x2a4f15;}})});}_0x1bcfd3=_['merge']({},_0x1bcfd3,_0xbc59ab[_0x7d5b('0x40')]);var _0x1e1dfc={'where':_0x1bcfd3[_0x7d5b('0x3b')]};return db[_0x7d5b('0x2d')][_0x7d5b('0x1f')](_0x1e1dfc)[_0x7d5b('0x25')](function(_0x5d851b){_0x381e57['count']=_0x5d851b;if(_0xbc59ab[_0x7d5b('0x31')][_0x7d5b('0x41')]){_0x1bcfd3[_0x7d5b('0x42')]=[{'all':!![]}];}return db[_0x7d5b('0x2d')][_0x7d5b('0x43')](_0x1bcfd3);})[_0x7d5b('0x25')](function(_0x5592dd){_0x381e57[_0x7d5b('0x44')]=_0x5592dd;return _0x381e57;})[_0x7d5b('0x25')](respondWithFilteredResult(_0xb5e723,_0x1bcfd3))[_0x7d5b('0x45')](handleError(_0xb5e723,null));};exports[_0x7d5b('0x46')]=function(_0xb86583,_0x1b8a85){var _0x43b1f0={'raw':!![],'where':{'id':_0xb86583['params']['id']}},_0x162c9a={};_0x162c9a[_0x7d5b('0x35')]=_['keys'](db[_0x7d5b('0x2d')][_0x7d5b('0x2e')]);_0x162c9a['query']=_['keys'](_0xb86583[_0x7d5b('0x31')]);_0x162c9a[_0x7d5b('0x33')]=_[_0x7d5b('0x34')](_0x162c9a[_0x7d5b('0x35')],_0x162c9a[_0x7d5b('0x31')]);_0x43b1f0[_0x7d5b('0x37')]=_[_0x7d5b('0x34')](_0x162c9a[_0x7d5b('0x35')],qs[_0x7d5b('0x36')](_0xb86583[_0x7d5b('0x31')][_0x7d5b('0x36')]));_0x43b1f0['attributes']=_0x43b1f0[_0x7d5b('0x37')][_0x7d5b('0x47')]?_0x43b1f0[_0x7d5b('0x37')]:_0x162c9a[_0x7d5b('0x35')];if(_0xb86583[_0x7d5b('0x31')][_0x7d5b('0x41')]){_0x43b1f0[_0x7d5b('0x42')]=[{'all':!![]}];}_0x43b1f0=_['merge']({},_0x43b1f0,_0xb86583[_0x7d5b('0x40')]);return db[_0x7d5b('0x2d')][_0x7d5b('0x48')](_0x43b1f0)[_0x7d5b('0x25')](handleEntityNotFound(_0x1b8a85,null))[_0x7d5b('0x25')](respondWithResult(_0x1b8a85,null))[_0x7d5b('0x45')](handleError(_0x1b8a85,null));};exports['create']=function(_0x2de907,_0x87d5ac){return db[_0x7d5b('0x2d')]['create'](_0x2de907[_0x7d5b('0x49')],{})['then'](function(_0x4d105c){var _0x16fe57=_0x2de907[_0x7d5b('0x4a')]['get']({'plain':!![]});if(!_0x16fe57)throw new Error(_0x7d5b('0x4b'));if(_0x16fe57['role']===_0x7d5b('0x4a')){var _0x372dd1=_0x4d105c['get']({'plain':!![]});var _0x14569d=_0x7d5b('0x4c');return db[_0x7d5b('0x4d')][_0x7d5b('0x48')]({'where':{'name':_0x14569d,'userProfileId':_0x16fe57[_0x7d5b('0x4e')]},'raw':!![]})[_0x7d5b('0x25')](function(_0x120fb1){if(_0x120fb1&&_0x120fb1[_0x7d5b('0x4f')]===0x0){return db['UserProfileResource'][_0x7d5b('0x50')]({'name':_0x372dd1['name'],'resourceId':_0x372dd1['id'],'type':_0x120fb1['name'],'sectionId':_0x120fb1['id']},{})[_0x7d5b('0x25')](function(){return _0x4d105c;});}else{return _0x4d105c;}})[_0x7d5b('0x45')](function(_0x1f23ab){logger[_0x7d5b('0x28')](_0x7d5b('0x51'),_0x1f23ab);throw _0x1f23ab;});}return _0x4d105c;})['then'](respondWithResult(_0x87d5ac,0xc9))[_0x7d5b('0x45')](handleError(_0x87d5ac,null));};exports[_0x7d5b('0x24')]=function(_0x543979,_0x2926b4){if(_0x543979[_0x7d5b('0x49')]['id']){delete _0x543979[_0x7d5b('0x49')]['id'];}return db[_0x7d5b('0x2d')]['find']({'where':{'id':_0x543979[_0x7d5b('0x52')]['id']}})[_0x7d5b('0x25')](handleEntityNotFound(_0x2926b4,null))['then'](saveUpdates(_0x543979['body'],null))[_0x7d5b('0x25')](respondWithResult(_0x2926b4,null))[_0x7d5b('0x45')](handleError(_0x2926b4,null));};exports[_0x7d5b('0x26')]=function(_0x22b72b,_0x10c587){return db[_0x7d5b('0x2d')][_0x7d5b('0x48')]({'where':{'id':_0x22b72b['params']['id']}})[_0x7d5b('0x25')](handleEntityNotFound(_0x10c587,null))[_0x7d5b('0x25')](removeEntity(_0x10c587,null))[_0x7d5b('0x45')](handleError(_0x10c587,null));};exports[_0x7d5b('0x53')]=function(_0x3e8ca4,_0x38e2d5,_0x2dbb1c){var _0x4dfe8e;return db[_0x7d5b('0x2d')][_0x7d5b('0x48')]({'where':{'id':_0x3e8ca4[_0x7d5b('0x52')]['id']},'attributes':['id',_0x7d5b('0x54')]})[_0x7d5b('0x25')](handleEntityNotFound(_0x38e2d5,null))[_0x7d5b('0x25')](function(_0x192af2){if(_0x192af2){var _0x17d4fb=require(_0x7d5b('0x55'))();_0x17d4fb[_0x7d5b('0x56')](_0x192af2[_0x7d5b('0x54')]);_0x17d4fb[_0x7d5b('0x57')]();return _0x192af2;}})['then'](respondWithResult(_0x38e2d5,null))['catch'](handleError(_0x38e2d5,null));}; \ No newline at end of file +var _0x891b=['status','json','undefined','limit','count','offset','set','Content-Range','destroy','then','get','ODBC','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','odbc','closeSync','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x20ba5e,_0x53352f){var _0x13861e=function(_0x257eaa){while(--_0x257eaa){_0x20ba5e['push'](_0x20ba5e['shift']());}};_0x13861e(++_0x53352f);}(_0x891b,0x8d));var _0xb891=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x891b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xb891('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb891('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb891('0x2'));var moment=require('moment');var BPromise=require(_0xb891('0x3'));var Mustache=require(_0xb891('0x4'));var util=require(_0xb891('0x5'));var path=require('path');var sox=require(_0xb891('0x6'));var csv=require(_0xb891('0x7'));var ejs=require(_0xb891('0x8'));var fs=require('fs');var fs_extra=require(_0xb891('0x9'));var _=require(_0xb891('0xa'));var squel=require(_0xb891('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb891('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb891('0xd'));var Papa=require(_0xb891('0xe'));var Redis=require(_0xb891('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb891('0x10'));var as=require(_0xb891('0x11'));var hardwareService=require(_0xb891('0x12'));var logger=require('../../config/logger')(_0xb891('0x13'));var utils=require(_0xb891('0x14'));var config=require(_0xb891('0x15'));var licenseUtil=require(_0xb891('0x16'));var db=require(_0xb891('0x17'))['db'];function respondWithStatusCode(_0x32f451,_0x5501bc){_0x5501bc=_0x5501bc||0xcc;return function(_0x1c1c71){if(_0x1c1c71){return _0x32f451[_0xb891('0x18')](_0x5501bc);}return _0x32f451[_0xb891('0x19')](_0x5501bc)['end']();};}function respondWithResult(_0xac19d1,_0x3a9d57){_0x3a9d57=_0x3a9d57||0xc8;return function(_0x4b9250){if(_0x4b9250){return _0xac19d1['status'](_0x3a9d57)[_0xb891('0x1a')](_0x4b9250);}};}function respondWithFilteredResult(_0x51cf47,_0x56f2aa){return function(_0x24c99e){if(_0x24c99e){var _0x31aecc=typeof _0x56f2aa['offset']===_0xb891('0x1b')&&typeof _0x56f2aa[_0xb891('0x1c')]==='undefined';var _0x4523f2=_0x24c99e[_0xb891('0x1d')];var _0x3d61e7=_0x31aecc?0x0:_0x56f2aa[_0xb891('0x1e')];var _0x51226e=_0x31aecc?_0x24c99e[_0xb891('0x1d')]:_0x56f2aa['offset']+_0x56f2aa[_0xb891('0x1c')];var _0x1fda67;if(_0x51226e>=_0x4523f2){_0x51226e=_0x4523f2;_0x1fda67=0xc8;}else{_0x1fda67=0xce;}_0x51cf47['status'](_0x1fda67);return _0x51cf47[_0xb891('0x1f')](_0xb891('0x20'),_0x3d61e7+'-'+_0x51226e+'/'+_0x4523f2)['json'](_0x24c99e);}return null;};}function patchUpdates(_0x18a7a1){return function(_0x2896c3){try{jsonpatch['apply'](_0x2896c3,_0x18a7a1,!![]);}catch(_0x58eddd){return BPromise['reject'](_0x58eddd);}return _0x2896c3['save']();};}function saveUpdates(_0x47bd96,_0x582c9b){return function(_0x4d0faf){if(_0x4d0faf){return _0x4d0faf['update'](_0x47bd96)['then'](function(_0xd4b89e){return _0xd4b89e;});}return null;};}function removeEntity(_0x4fdb05,_0x56793d){return function(_0x5d0a28){if(_0x5d0a28){return _0x5d0a28[_0xb891('0x21')]()[_0xb891('0x22')](function(){var _0x5ad1e4=_0x5d0a28[_0xb891('0x23')]({'plain':!![]});var _0x4748c=_0xb891('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x4748c,'resourceId':_0x5ad1e4['id']}})[_0xb891('0x22')](function(){return _0x5d0a28;});})[_0xb891('0x22')](function(){_0x4fdb05[_0xb891('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b177b,_0x3d237d){return function(_0x475f7d){if(!_0x475f7d){_0x1b177b['sendStatus'](0x194);}return _0x475f7d;};}function handleError(_0x2aa361,_0x31ba5a){_0x31ba5a=_0x31ba5a||0x1f4;return function(_0x22bc0f){logger[_0xb891('0x25')](_0x22bc0f[_0xb891('0x26')]);if(_0x22bc0f[_0xb891('0x27')]){delete _0x22bc0f[_0xb891('0x27')];}_0x2aa361[_0xb891('0x19')](_0x31ba5a)['send'](_0x22bc0f);};}exports[_0xb891('0x28')]=function(_0x142e10,_0x2f4adc){var _0x33436e={},_0x135768={},_0x3086dd={'count':0x0,'rows':[]};var _0x1943d2=_[_0xb891('0x29')](db[_0xb891('0x2a')][_0xb891('0x2b')],function(_0x5d858a){return{'name':_0x5d858a[_0xb891('0x2c')],'type':_0x5d858a[_0xb891('0x2d')]['key']};});_0x135768[_0xb891('0x2e')]=_['map'](_0x1943d2,_0xb891('0x27'));_0x135768[_0xb891('0x2f')]=_[_0xb891('0x30')](_0x142e10[_0xb891('0x2f')]);_0x135768[_0xb891('0x31')]=_['intersection'](_0x135768['model'],_0x135768['query']);_0x33436e['attributes']=_[_0xb891('0x32')](_0x135768['model'],qs[_0xb891('0x33')](_0x142e10[_0xb891('0x2f')][_0xb891('0x33')]));_0x33436e['attributes']=_0x33436e[_0xb891('0x34')][_0xb891('0x35')]?_0x33436e[_0xb891('0x34')]:_0x135768[_0xb891('0x2e')];if(!_0x142e10['query'][_0xb891('0x36')]('nolimit')){_0x33436e[_0xb891('0x1c')]=qs[_0xb891('0x1c')](_0x142e10[_0xb891('0x2f')][_0xb891('0x1c')]);_0x33436e[_0xb891('0x1e')]=qs['offset'](_0x142e10[_0xb891('0x2f')]['offset']);}_0x33436e['order']=qs['sort'](_0x142e10['query'][_0xb891('0x37')]);_0x33436e[_0xb891('0x38')]=qs[_0xb891('0x31')](_[_0xb891('0x39')](_0x142e10['query'],_0x135768[_0xb891('0x31')]),_0x1943d2);if(_0x142e10[_0xb891('0x2f')]['filter']){_0x33436e[_0xb891('0x38')]=_[_0xb891('0x3a')](_0x33436e[_0xb891('0x38')],{'$or':_[_0xb891('0x29')](_0x1943d2,function(_0x4c37dc){if(_0x4c37dc[_0xb891('0x2d')]!==_0xb891('0x3b')){var _0x9a4a26={};_0x9a4a26[_0x4c37dc['name']]={'$like':'%'+_0x142e10[_0xb891('0x2f')][_0xb891('0x3c')]+'%'};return _0x9a4a26;}})});}_0x33436e=_[_0xb891('0x3a')]({},_0x33436e,_0x142e10[_0xb891('0x3d')]);var _0x1955a6={'where':_0x33436e[_0xb891('0x38')]};return db[_0xb891('0x2a')][_0xb891('0x1d')](_0x1955a6)[_0xb891('0x22')](function(_0x1da450){_0x3086dd[_0xb891('0x1d')]=_0x1da450;if(_0x142e10[_0xb891('0x2f')][_0xb891('0x3e')]){_0x33436e[_0xb891('0x3f')]=[{'all':!![]}];}return db[_0xb891('0x2a')][_0xb891('0x40')](_0x33436e);})[_0xb891('0x22')](function(_0x404ac1){_0x3086dd['rows']=_0x404ac1;return _0x3086dd;})[_0xb891('0x22')](respondWithFilteredResult(_0x2f4adc,_0x33436e))[_0xb891('0x41')](handleError(_0x2f4adc,null));};exports[_0xb891('0x42')]=function(_0x284383,_0xd841a1){var _0x2765b9={'raw':!![],'where':{'id':_0x284383[_0xb891('0x43')]['id']}},_0x33e777={};_0x33e777['model']=_[_0xb891('0x30')](db[_0xb891('0x2a')]['rawAttributes']);_0x33e777['query']=_[_0xb891('0x30')](_0x284383['query']);_0x33e777[_0xb891('0x31')]=_[_0xb891('0x32')](_0x33e777['model'],_0x33e777[_0xb891('0x2f')]);_0x2765b9['attributes']=_['intersection'](_0x33e777[_0xb891('0x2e')],qs[_0xb891('0x33')](_0x284383['query'][_0xb891('0x33')]));_0x2765b9[_0xb891('0x34')]=_0x2765b9[_0xb891('0x34')]['length']?_0x2765b9[_0xb891('0x34')]:_0x33e777['model'];if(_0x284383['query'][_0xb891('0x3e')]){_0x2765b9[_0xb891('0x3f')]=[{'all':!![]}];}_0x2765b9=_[_0xb891('0x3a')]({},_0x2765b9,_0x284383[_0xb891('0x3d')]);return db[_0xb891('0x2a')][_0xb891('0x44')](_0x2765b9)['then'](handleEntityNotFound(_0xd841a1,null))['then'](respondWithResult(_0xd841a1,null))[_0xb891('0x41')](handleError(_0xd841a1,null));};exports[_0xb891('0x45')]=function(_0x2c1901,_0x45582f){return db[_0xb891('0x2a')]['create'](_0x2c1901[_0xb891('0x46')],{})[_0xb891('0x22')](function(_0x5ed963){var _0x12df73=_0x2c1901[_0xb891('0x47')][_0xb891('0x23')]({'plain':!![]});if(!_0x12df73)throw new Error(_0xb891('0x48'));if(_0x12df73[_0xb891('0x49')]==='user'){var _0x3a80f5=_0x5ed963[_0xb891('0x23')]({'plain':!![]});var _0x3e7a88=_0xb891('0x24');return db[_0xb891('0x4a')][_0xb891('0x44')]({'where':{'name':_0x3e7a88,'userProfileId':_0x12df73['userProfileId']},'raw':!![]})[_0xb891('0x22')](function(_0x32a1e4){if(_0x32a1e4&&_0x32a1e4[_0xb891('0x4b')]===0x0){return db[_0xb891('0x4c')][_0xb891('0x45')]({'name':_0x3a80f5[_0xb891('0x27')],'resourceId':_0x3a80f5['id'],'type':_0x32a1e4[_0xb891('0x27')],'sectionId':_0x32a1e4['id']},{})[_0xb891('0x22')](function(){return _0x5ed963;});}else{return _0x5ed963;}})[_0xb891('0x41')](function(_0x47e7d1){logger[_0xb891('0x25')](_0xb891('0x4d'),_0x47e7d1);throw _0x47e7d1;});}return _0x5ed963;})['then'](respondWithResult(_0x45582f,0xc9))[_0xb891('0x41')](handleError(_0x45582f,null));};exports[_0xb891('0x4e')]=function(_0x2695ad,_0x5638f1){if(_0x2695ad[_0xb891('0x46')]['id']){delete _0x2695ad[_0xb891('0x46')]['id'];}return db['SquareOdbc'][_0xb891('0x44')]({'where':{'id':_0x2695ad[_0xb891('0x43')]['id']}})[_0xb891('0x22')](handleEntityNotFound(_0x5638f1,null))['then'](saveUpdates(_0x2695ad[_0xb891('0x46')],null))[_0xb891('0x22')](respondWithResult(_0x5638f1,null))[_0xb891('0x41')](handleError(_0x5638f1,null));};exports[_0xb891('0x21')]=function(_0x58bc93,_0x4854c0){return db[_0xb891('0x2a')][_0xb891('0x44')]({'where':{'id':_0x58bc93['params']['id']}})[_0xb891('0x22')](handleEntityNotFound(_0x4854c0,null))[_0xb891('0x22')](removeEntity(_0x4854c0,null))[_0xb891('0x41')](handleError(_0x4854c0,null));};exports[_0xb891('0x4f')]=function(_0x4f0be5,_0xf0fc11,_0x936346){var _0x45e7c0;return db[_0xb891('0x2a')][_0xb891('0x44')]({'where':{'id':_0x4f0be5['params']['id']},'attributes':['id',_0xb891('0x50')]})[_0xb891('0x22')](handleEntityNotFound(_0xf0fc11,null))['then'](function(_0x5cc156){if(_0x5cc156){var _0x49cbc=require(_0xb891('0x51'))();_0x49cbc['openSync'](_0x5cc156[_0xb891('0x50')]);_0x49cbc[_0xb891('0x52')]();return _0x5cc156;}})[_0xb891('0x22')](respondWithResult(_0xf0fc11,null))[_0xb891('0x41')](handleError(_0xf0fc11,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 7ec8622..e30f37a 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 _0x21c6=['moment','bluebird','../../config/environment','exports','define','SquareOdbc','square_odbc','../../config/logger','api'];(function(_0x40a41b,_0x7325a2){var _0xc4f182=function(_0x37d769){while(--_0x37d769){_0x40a41b['push'](_0x40a41b['shift']());}};_0xc4f182(++_0x7325a2);}(_0x21c6,0x103));var _0x621c=function(_0xb72e13,_0xea518d){_0xb72e13=_0xb72e13-0x0;var _0x3b5685=_0x21c6[_0xb72e13];return _0x3b5685;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x621c('0x0'))(_0x621c('0x1'));var moment=require(_0x621c('0x2'));var BPromise=require(_0x621c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x621c('0x4'));var attributes=require('./squareOdbc.attributes');module[_0x621c('0x5')]=function(_0x1dbaee,_0x5a1667){return _0x1dbaee[_0x621c('0x6')](_0x621c('0x7'),attributes,{'tableName':_0x621c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb4c=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','SquareOdbc','square_odbc'];(function(_0x32e47c,_0xcac697){var _0x52eaf1=function(_0x305ac5){while(--_0x305ac5){_0x32e47c['push'](_0x32e47c['shift']());}};_0x52eaf1(++_0xcac697);}(_0xeb4c,0xbb));var _0xceb4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xeb4c[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xceb4('0x0'));var util=require(_0xceb4('0x1'));var logger=require(_0xceb4('0x2'))(_0xceb4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xceb4('0x4'));var fs=require('fs');var path=require(_0xceb4('0x5'));var rimraf=require(_0xceb4('0x6'));var config=require(_0xceb4('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xceb4('0x8')]=function(_0x52b9e9,_0x2956f9){return _0x52b9e9['define'](_0xceb4('0x9'),attributes,{'tableName':_0xceb4('0xa'),'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 2d51fa1..900503e 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 _0x2a9d=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','where','attributes','include','map','model','ShowSquareOdbc','lodash'];(function(_0x5daa41,_0x19f96f){var _0x246ab0=function(_0x145c01){while(--_0x145c01){_0x5daa41['push'](_0x5daa41['shift']());}};_0x246ab0(++_0x19f96f);}(_0x2a9d,0x1b1));var _0xd2a9=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x2a9d[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0xd2a9('0x0'));var util=require('util');var moment=require(_0xd2a9('0x1'));var BPromise=require('bluebird');var rs=require(_0xd2a9('0x2'));var fs=require('fs');var Redis=require(_0xd2a9('0x3'));var db=require(_0xd2a9('0x4'))['db'];var utils=require(_0xd2a9('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd2a9('0x6'));var client=jayson[_0xd2a9('0x7')][_0xd2a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x459743,_0xac261c,_0x5d004e){return new BPromise(function(_0x5ec40a,_0xc48bc8){return client[_0xd2a9('0x9')](_0x459743,_0x5d004e)[_0xd2a9('0xa')](function(_0x4f048d){logger[_0xd2a9('0xb')](_0xd2a9('0xc'),_0xac261c,'request\x20sent');logger[_0xd2a9('0xd')](_0xd2a9('0xe'),_0xac261c,_0xd2a9('0xf'),JSON[_0xd2a9('0x10')](_0x4f048d));if(_0x4f048d['error']){if(_0x4f048d[_0xd2a9('0x11')][_0xd2a9('0x12')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0xac261c,_0x4f048d[_0xd2a9('0x11')]['message']);return _0xc48bc8(_0x4f048d['error']['message']);}logger['error'](_0xd2a9('0xc'),_0xac261c,_0x4f048d['error'][_0xd2a9('0x13')]);return _0x5ec40a(_0x4f048d['error'][_0xd2a9('0x13')]);}else{logger[_0xd2a9('0xb')](_0xd2a9('0xc'),_0xac261c,'request\x20sent');_0x5ec40a(_0x4f048d[_0xd2a9('0x14')][_0xd2a9('0x13')]);}})[_0xd2a9('0x15')](function(_0x531908){logger[_0xd2a9('0x11')]('SquareOdbc,\x20%s,\x20%s',_0xac261c,_0x531908);_0xc48bc8(_0x531908);});});}exports['ShowSquareOdbc']=function(_0x2ba104){var _0x22941b=this;return new Promise(function(_0x559a66,_0x52a1cb){return db[_0xd2a9('0x16')][_0xd2a9('0x17')]({'raw':_0x2ba104[_0xd2a9('0x18')]?_0x2ba104[_0xd2a9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2ba104['options']?_0x2ba104['options'][_0xd2a9('0x19')]||null:null,'attributes':_0x2ba104['options']?_0x2ba104[_0xd2a9('0x18')][_0xd2a9('0x1a')]||null:null,'include':_0x2ba104['options']?_0x2ba104[_0xd2a9('0x18')][_0xd2a9('0x1b')]?_[_0xd2a9('0x1c')](_0x2ba104['options'][_0xd2a9('0x1b')],function(_0x491efc){return{'model':db[_0x491efc[_0xd2a9('0x1d')]],'as':_0x491efc['as'],'attributes':_0x491efc[_0xd2a9('0x1a')],'include':_0x491efc[_0xd2a9('0x1b')]?_[_0xd2a9('0x1c')](_0x491efc[_0xd2a9('0x1b')],function(_0x5fc247){return{'model':db[_0x5fc247['model']],'as':_0x5fc247['as'],'attributes':_0x5fc247[_0xd2a9('0x1a')],'include':_0x5fc247[_0xd2a9('0x1b')]?_[_0xd2a9('0x1c')](_0x5fc247[_0xd2a9('0x1b')],function(_0x15a3ef){return{'model':db[_0x15a3ef['model']],'as':_0x15a3ef['as'],'attributes':_0x15a3ef[_0xd2a9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd2a9('0xa')](function(_0x269f1b){logger[_0xd2a9('0xb')](_0xd2a9('0x1e'),_0x2ba104);logger[_0xd2a9('0xd')](_0xd2a9('0x1e'),_0x2ba104,JSON[_0xd2a9('0x10')](_0x269f1b));_0x559a66(_0x269f1b);})[_0xd2a9('0x15')](function(_0x3fb3b1){logger[_0xd2a9('0x11')]('ShowSquareOdbc',_0x3fb3b1['message'],_0x2ba104);_0x52a1cb(_0x22941b[_0xd2a9('0x11')](0x1f4,_0x3fb3b1['message']));});});}; \ No newline at end of file +var _0xf1e7=['request','then','info','request\x20sent','debug','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','ShowSquareOdbc','SquareOdbc','find','options','where','include','map','attributes','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0xf1e7,0x1a9));var _0x7f1e=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xf1e7[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x7f1e('0x0'));var util=require('util');var moment=require(_0x7f1e('0x1'));var BPromise=require(_0x7f1e('0x2'));var rs=require(_0x7f1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f1e('0x4'))['db'];var utils=require(_0x7f1e('0x5'));var logger=require(_0x7f1e('0x6'))(_0x7f1e('0x7'));var config=require('../../config/environment');var jayson=require(_0x7f1e('0x8'));var client=jayson['client'][_0x7f1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x222109,_0x50154e,_0x501546){return new BPromise(function(_0x271874,_0x532515){return client[_0x7f1e('0xa')](_0x222109,_0x501546)[_0x7f1e('0xb')](function(_0x3b1b1a){logger[_0x7f1e('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x50154e,_0x7f1e('0xd'));logger[_0x7f1e('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x50154e,_0x7f1e('0xd'),JSON['stringify'](_0x3b1b1a));if(_0x3b1b1a[_0x7f1e('0xf')]){if(_0x3b1b1a['error'][_0x7f1e('0x10')]===0x1f4){logger[_0x7f1e('0xf')](_0x7f1e('0x11'),_0x50154e,_0x3b1b1a['error'][_0x7f1e('0x12')]);return _0x532515(_0x3b1b1a[_0x7f1e('0xf')][_0x7f1e('0x12')]);}logger['error'](_0x7f1e('0x11'),_0x50154e,_0x3b1b1a['error']['message']);return _0x271874(_0x3b1b1a['error'][_0x7f1e('0x12')]);}else{logger['info'](_0x7f1e('0x11'),_0x50154e,'request\x20sent');_0x271874(_0x3b1b1a['result'][_0x7f1e('0x12')]);}})[_0x7f1e('0x13')](function(_0x2efa2a){logger[_0x7f1e('0xf')](_0x7f1e('0x11'),_0x50154e,_0x2efa2a);_0x532515(_0x2efa2a);});});}exports[_0x7f1e('0x14')]=function(_0x58fcac){var _0x562a09=this;return new Promise(function(_0x38c383,_0x3f795b){return db[_0x7f1e('0x15')][_0x7f1e('0x16')]({'raw':_0x58fcac['options']?_0x58fcac['options']['raw']===undefined?!![]:![]:!![],'where':_0x58fcac[_0x7f1e('0x17')]?_0x58fcac[_0x7f1e('0x17')][_0x7f1e('0x18')]||null:null,'attributes':_0x58fcac[_0x7f1e('0x17')]?_0x58fcac[_0x7f1e('0x17')]['attributes']||null:null,'include':_0x58fcac[_0x7f1e('0x17')]?_0x58fcac[_0x7f1e('0x17')][_0x7f1e('0x19')]?_[_0x7f1e('0x1a')](_0x58fcac['options']['include'],function(_0x201e88){return{'model':db[_0x201e88['model']],'as':_0x201e88['as'],'attributes':_0x201e88['attributes'],'include':_0x201e88[_0x7f1e('0x19')]?_['map'](_0x201e88[_0x7f1e('0x19')],function(_0xd12599){return{'model':db[_0xd12599['model']],'as':_0xd12599['as'],'attributes':_0xd12599[_0x7f1e('0x1b')],'include':_0xd12599[_0x7f1e('0x19')]?_[_0x7f1e('0x1a')](_0xd12599[_0x7f1e('0x19')],function(_0x507a71){return{'model':db[_0x507a71[_0x7f1e('0x1c')]],'as':_0x507a71['as'],'attributes':_0x507a71['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x297394){logger[_0x7f1e('0xc')](_0x7f1e('0x14'),_0x58fcac);logger[_0x7f1e('0xe')](_0x7f1e('0x14'),_0x58fcac,JSON['stringify'](_0x297394));_0x38c383(_0x297394);})['catch'](function(_0x5cdf90){logger[_0x7f1e('0xf')](_0x7f1e('0x14'),_0x5cdf90['message'],_0x58fcac);_0x3f795b(_0x562a09[_0x7f1e('0xf')](0x1f4,_0x5cdf90['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 3cf7d4b..9d6bef4 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 _0xb617=['exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','post','delete'];(function(_0x271820,_0x32e83c){var _0x5bce54=function(_0x259800){while(--_0x259800){_0x271820['push'](_0x271820['shift']());}};_0x5bce54(++_0x32e83c);}(_0xb617,0x15a));var _0x7b61=function(_0x1616b0,_0xa83df5){_0x1616b0=_0x1616b0-0x0;var _0xb47161=_0xb617[_0x1616b0];return _0xb47161;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b61('0x0'));var timeout=require('connect-timeout');var express=require(_0x7b61('0x1'));var router=express[_0x7b61('0x2')]();var fs_extra=require(_0x7b61('0x3'));var auth=require(_0x7b61('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7b61('0x5'));var controller=require(_0x7b61('0x6'));router['get']('/',auth[_0x7b61('0x7')](),controller[_0x7b61('0x8')]);router[_0x7b61('0x9')](_0x7b61('0xa'),auth[_0x7b61('0x7')](),controller[_0x7b61('0xb')]);router[_0x7b61('0xc')]('/',auth[_0x7b61('0x7')](),controller['create']);router['put'](_0x7b61('0xa'),auth[_0x7b61('0x7')](),controller['update']);router[_0x7b61('0xd')](_0x7b61('0xa'),auth[_0x7b61('0x7')](),controller['destroy']);module[_0x7b61('0xe')]=router; \ No newline at end of file +var _0xea0b=['put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2125a2,_0x5b88be){var _0x236324=function(_0x21ee60){while(--_0x21ee60){_0x2125a2['push'](_0x2125a2['shift']());}};_0x236324(++_0x5b88be);}(_0xea0b,0xca));var _0xbea0=function(_0x325fc5,_0x5f30a3){_0x325fc5=_0x325fc5-0x0;var _0x5cc2ef=_0xea0b[_0x325fc5];return _0x5cc2ef;};'use strict';var multer=require(_0xbea0('0x0'));var util=require(_0xbea0('0x1'));var path=require(_0xbea0('0x2'));var timeout=require('connect-timeout');var express=require(_0xbea0('0x3'));var router=express[_0xbea0('0x4')]();var fs_extra=require(_0xbea0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbea0('0x6'));var config=require(_0xbea0('0x7'));var controller=require(_0xbea0('0x8'));router[_0xbea0('0x9')]('/',auth[_0xbea0('0xa')](),controller[_0xbea0('0xb')]);router['get'](_0xbea0('0xc'),auth[_0xbea0('0xa')](),controller[_0xbea0('0xd')]);router['post']('/',auth[_0xbea0('0xa')](),controller['create']);router[_0xbea0('0xe')]('/:id',auth[_0xbea0('0xa')](),controller[_0xbea0('0xf')]);router[_0xbea0('0x10')](_0xbea0('0xc'),auth['isAuthenticated'](),controller[_0xbea0('0x11')]);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 88376e5..f59cc55 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 _0x9550=['TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING'];(function(_0x372e16,_0x164bd1){var _0x3f5ad9=function(_0x336e53){while(--_0x336e53){_0x372e16['push'](_0x372e16['shift']());}};_0x3f5ad9(++_0x164bd1);}(_0x9550,0x1cc));var _0x0955=function(_0x456fd7,_0x1bda12){_0x456fd7=_0x456fd7-0x0;var _0x4b5d92=_0x9550[_0x456fd7];return _0x4b5d92;};'use strict';var Sequelize=require('sequelize');module[_0x0955('0x0')]={'name':{'type':Sequelize[_0x0955('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0955('0x1')]},'notes':{'type':Sequelize[_0x0955('0x2')]},'preproduction':{'type':Sequelize[_0x0955('0x3')](_0x0955('0x4')),'get':function(){if(this[_0x0955('0x5')](_0x0955('0x6'))){return this[_0x0955('0x5')](_0x0955('0x6'))[_0x0955('0x7')](_0x0955('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x0955('0x4')),'get':function(){if(this['getDataValue']('production')){return this[_0x0955('0x5')](_0x0955('0x9'))[_0x0955('0x7')](_0x0955('0x8'));}}},'savedAt':{'type':Sequelize[_0x0955('0xa')]},'publishedAt':{'type':Sequelize[_0x0955('0xa')]}}; \ No newline at end of file +var _0xdb01=['DATE','sequelize','exports','STRING','name','TEXT','long','getDataValue','preproduction','toString','utf8','BLOB','production'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xdb01,0x16d));var _0x1db0=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xdb01[_0x5951e8];return _0x20a1f5;};'use strict';var Sequelize=require(_0x1db0('0x0'));module[_0x1db0('0x1')]={'name':{'type':Sequelize[_0x1db0('0x2')],'unique':_0x1db0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1db0('0x2')]},'notes':{'type':Sequelize[_0x1db0('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x1db0('0x5')),'get':function(){if(this[_0x1db0('0x6')](_0x1db0('0x7'))){return this[_0x1db0('0x6')](_0x1db0('0x7'))[_0x1db0('0x8')](_0x1db0('0x9'));}}},'production':{'type':Sequelize[_0x1db0('0xa')](_0x1db0('0x5')),'get':function(){if(this['getDataValue'](_0x1db0('0xb'))){return this[_0x1db0('0x6')](_0x1db0('0xb'))[_0x1db0('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x1db0('0xc')]},'publishedAt':{'type':Sequelize[_0x1db0('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index f569b09..bc99ffe 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 _0x49b4=['update','then','get','UserProfileResource','publish','agi','stringify','end','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','offset','undefined','limit','count','status','Content-Range','json'];(function(_0xbc5cfd,_0x1d8d18){var _0x3b8267=function(_0x290202){while(--_0x290202){_0xbc5cfd['push'](_0xbc5cfd['shift']());}};_0x3b8267(++_0x1d8d18);}(_0x49b4,0x100));var _0x449b=function(_0x5b1f6e,_0x56a38e){_0x5b1f6e=_0x5b1f6e-0x0;var _0x2a6a91=_0x49b4[_0x5b1f6e];return _0x2a6a91;};'use strict';var _=require(_0x449b('0x0'));var Redis=require('ioredis');var qs=require(_0x449b('0x1'));var logger=require(_0x449b('0x2'))('api');var config=require(_0x449b('0x3'));var db=require(_0x449b('0x4'))['db'];config[_0x449b('0x5')]=_[_0x449b('0x6')](config[_0x449b('0x5')],{'host':_0x449b('0x7'),'port':0x18eb});var socket=require(_0x449b('0x8'))(new Redis(config[_0x449b('0x5')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0xca77d8,_0x1585ef){_0x1585ef=_0x1585ef||0xc8;return function(_0x14fd97){if(_0x14fd97){return _0xca77d8['status'](_0x1585ef)['json'](_0x14fd97);}};}function respondWithFilteredResult(_0x381a73,_0x1e2822){return function(_0x3b5cfd){if(_0x3b5cfd){var _0x481582=typeof _0x1e2822[_0x449b('0x9')]===_0x449b('0xa')&&typeof _0x1e2822[_0x449b('0xb')]===_0x449b('0xa');var _0xf26d42=_0x3b5cfd['count'];var _0x588718=_0x481582?0x0:_0x1e2822['offset'];var _0x82b53b=_0x481582?_0x3b5cfd[_0x449b('0xc')]:_0x1e2822[_0x449b('0x9')]+_0x1e2822[_0x449b('0xb')];var _0x32576a;if(_0x82b53b>=_0xf26d42){_0x82b53b=_0xf26d42;_0x32576a=0xc8;}else{_0x32576a=0xce;}_0x381a73[_0x449b('0xd')](_0x32576a);return _0x381a73['set'](_0x449b('0xe'),_0x588718+'-'+_0x82b53b+'/'+_0xf26d42)[_0x449b('0xf')](_0x3b5cfd);}return null;};}function saveUpdates(_0x42d454){return function(_0x4b1ec4){if(_0x4b1ec4){return _0x4b1ec4[_0x449b('0x10')](_0x42d454)[_0x449b('0x11')](function(_0x125633){return _0x125633;});}return null;};}function removeEntity(_0xf8db7c){return function(_0x19fc9e){if(_0x19fc9e){return _0x19fc9e['destroy']()[_0x449b('0x11')](function(){var _0x3d3e57=_0x19fc9e[_0x449b('0x12')]({'plain':!![]});var _0x40c81a='SquareProjects';return db[_0x449b('0x13')]['destroy']({'where':{'type':_0x40c81a,'resourceId':_0x3d3e57['id']}})[_0x449b('0x11')](function(){return _0x19fc9e;});})[_0x449b('0x11')](function(){var _0x57098f=new Redis(config[_0x449b('0x5')]);_0x57098f[_0x449b('0x14')](_0x449b('0x15'),JSON[_0x449b('0x16')]({'id':_0x19fc9e['id'],'deleted':!![]}));})[_0x449b('0x11')](function(){_0xf8db7c[_0x449b('0xd')](0xcc)[_0x449b('0x17')]();});}};}function handleEntityNotFound(_0x4887b0){return function(_0x4d3249){if(!_0x4d3249){_0x4887b0['sendStatus'](0x194);}return _0x4d3249;};}function handleError(_0x36d0a2,_0x4139d6){_0x4139d6=_0x4139d6||0x1f4;return function(_0x42c099){logger[_0x449b('0x18')](_0x42c099[_0x449b('0x19')]);if(_0x42c099[_0x449b('0x1a')]){delete _0x42c099[_0x449b('0x1a')];}_0x36d0a2[_0x449b('0xd')](_0x4139d6)['send'](_0x42c099);};}exports[_0x449b('0x1b')]=function(_0x42c7d7,_0x51d0c3){var _0x53eb81={},_0x32c1a7={},_0x28256b={'count':0x0,'rows':[]};var _0x5931de=_[_0x449b('0x1c')](db[_0x449b('0x1d')][_0x449b('0x1e')],function(_0x42c616){return{'name':_0x42c616[_0x449b('0x1f')],'type':_0x42c616[_0x449b('0x20')][_0x449b('0x21')]};});_0x32c1a7['model']=_[_0x449b('0x1c')](_0x5931de,_0x449b('0x1a'));_0x32c1a7['query']=_[_0x449b('0x22')](_0x42c7d7[_0x449b('0x23')]);_0x32c1a7[_0x449b('0x24')]=_['intersection'](_0x32c1a7['model'],_0x32c1a7[_0x449b('0x23')]);_0x53eb81[_0x449b('0x25')]=_[_0x449b('0x26')](_0x32c1a7[_0x449b('0x27')],qs[_0x449b('0x28')](_0x42c7d7[_0x449b('0x23')]['fields']));_0x53eb81[_0x449b('0x25')]=_0x53eb81['attributes'][_0x449b('0x29')]?_0x53eb81[_0x449b('0x25')]:_0x32c1a7['model'];if(!_0x42c7d7[_0x449b('0x23')][_0x449b('0x2a')]('nolimit')){_0x53eb81['limit']=qs[_0x449b('0xb')](_0x42c7d7[_0x449b('0x23')][_0x449b('0xb')]);_0x53eb81[_0x449b('0x9')]=qs['offset'](_0x42c7d7[_0x449b('0x23')]['offset']);}_0x53eb81[_0x449b('0x2b')]=qs[_0x449b('0x2c')](_0x42c7d7['query'][_0x449b('0x2c')]);_0x53eb81[_0x449b('0x2d')]=qs[_0x449b('0x24')](_[_0x449b('0x2e')](_0x42c7d7[_0x449b('0x23')],_0x32c1a7[_0x449b('0x24')]),_0x5931de);if(_0x42c7d7['query'][_0x449b('0x2f')]){_0x53eb81[_0x449b('0x2d')]=_[_0x449b('0x30')](_0x53eb81[_0x449b('0x2d')],{'$or':_['map'](_0x5931de,function(_0x16f172){if(_0x16f172[_0x449b('0x20')]!=='VIRTUAL'){var _0x4eb960={};_0x4eb960[_0x16f172['name']]={'$like':'%'+_0x42c7d7[_0x449b('0x23')][_0x449b('0x2f')]+'%'};return _0x4eb960;}})});}_0x53eb81=_['merge']({},_0x53eb81,_0x42c7d7['options']);var _0x3ff4de={'where':_0x53eb81[_0x449b('0x2d')]};return db[_0x449b('0x1d')][_0x449b('0xc')](_0x3ff4de)[_0x449b('0x11')](function(_0x224f2b){_0x28256b[_0x449b('0xc')]=_0x224f2b;if(_0x42c7d7['query']['includeAll']){_0x53eb81[_0x449b('0x31')]=[{'all':!![]}];}return db['SquareProject'][_0x449b('0x32')](_0x53eb81);})['then'](function(_0x2764df){_0x28256b[_0x449b('0x33')]=_0x2764df;return _0x28256b;})[_0x449b('0x11')](respondWithFilteredResult(_0x51d0c3,_0x53eb81))[_0x449b('0x34')](handleError(_0x51d0c3,null));};exports[_0x449b('0x35')]=function(_0x75c712,_0x50d921){var _0x97060c={'raw':![],'where':{'id':_0x75c712[_0x449b('0x36')]['id']}},_0x2c9ee2={};_0x2c9ee2[_0x449b('0x27')]=_['keys'](db[_0x449b('0x1d')][_0x449b('0x1e')]);_0x2c9ee2['query']=_[_0x449b('0x22')](_0x75c712[_0x449b('0x23')]);_0x2c9ee2[_0x449b('0x24')]=_[_0x449b('0x26')](_0x2c9ee2[_0x449b('0x27')],_0x2c9ee2[_0x449b('0x23')]);_0x97060c[_0x449b('0x25')]=_[_0x449b('0x26')](_0x2c9ee2['model'],qs[_0x449b('0x28')](_0x75c712[_0x449b('0x23')][_0x449b('0x28')]));_0x97060c[_0x449b('0x25')]=_0x97060c[_0x449b('0x25')][_0x449b('0x29')]?_0x97060c['attributes']:_0x2c9ee2[_0x449b('0x27')];if(_0x75c712[_0x449b('0x23')]['includeAll']){_0x97060c[_0x449b('0x31')]=[{'all':!![]}];}_0x97060c=_[_0x449b('0x30')]({},_0x97060c,_0x75c712[_0x449b('0x37')]);return db[_0x449b('0x1d')][_0x449b('0x38')](_0x97060c)[_0x449b('0x11')](handleEntityNotFound(_0x50d921,null))[_0x449b('0x11')](respondWithResult(_0x50d921,null))[_0x449b('0x34')](handleError(_0x50d921,null));};exports[_0x449b('0x39')]=function(_0x26b21d,_0x3edd5f){return db[_0x449b('0x1d')]['create'](_0x26b21d[_0x449b('0x3a')],{})['then'](function(_0x1f7646){var _0x52de5b=_0x26b21d[_0x449b('0x3b')]['get']({'plain':!![]});if(!_0x52de5b)throw new Error(_0x449b('0x3c'));if(_0x52de5b[_0x449b('0x3d')]===_0x449b('0x3b')){var _0x4677ea=_0x1f7646[_0x449b('0x12')]({'plain':!![]});var _0x5a816a=_0x449b('0x3e');return db[_0x449b('0x3f')]['find']({'where':{'name':_0x5a816a,'userProfileId':_0x52de5b[_0x449b('0x40')]},'raw':!![]})['then'](function(_0x4a116c){if(_0x4a116c&&_0x4a116c[_0x449b('0x41')]===0x0){return db[_0x449b('0x13')][_0x449b('0x39')]({'name':_0x4677ea[_0x449b('0x1a')],'resourceId':_0x4677ea['id'],'type':_0x4a116c[_0x449b('0x1a')],'sectionId':_0x4a116c['id']},{})[_0x449b('0x11')](function(){return _0x1f7646;});}else{return _0x1f7646;}})[_0x449b('0x34')](function(_0x404a51){logger['error'](_0x449b('0x42'),_0x404a51);throw _0x404a51;});}return _0x1f7646;})[_0x449b('0x11')](respondWithResult(_0x3edd5f,0xc9))['catch'](handleError(_0x3edd5f,null));};exports['update']=function(_0x3c1cfe,_0x412c6f){if(_0x3c1cfe[_0x449b('0x3a')]['id']){delete _0x3c1cfe['body']['id'];}return db['SquareProject'][_0x449b('0x38')]({'where':{'id':_0x3c1cfe[_0x449b('0x36')]['id']}})['then'](handleEntityNotFound(_0x412c6f,null))[_0x449b('0x11')](saveUpdates(_0x3c1cfe[_0x449b('0x3a')],null))[_0x449b('0x11')](function(_0x246f5d){if(!_0x246f5d)return;var _0x261757=_0x246f5d[_0x449b('0x12')]({'plain':!![]});return _0x261757;})['then'](function(_0x39181a){var _0x59887e=new Redis(config[_0x449b('0x5')]);_0x59887e[_0x449b('0x14')]('agi',JSON[_0x449b('0x16')](_[_0x449b('0x2e')](_0x39181a,['id',_0x449b('0x1a'),_0x449b('0x43')])));return _0x39181a;})[_0x449b('0x11')](respondWithResult(_0x412c6f,null))[_0x449b('0x34')](handleError(_0x412c6f,null));};exports['destroy']=function(_0x55e2f1,_0x3a2612){return db['SquareProject'][_0x449b('0x38')]({'where':{'id':_0x55e2f1[_0x449b('0x36')]['id']}})['then'](handleEntityNotFound(_0x3a2612,null))['then'](removeEntity(_0x3a2612,null))[_0x449b('0x34')](handleError(_0x3a2612,null));}; \ No newline at end of file +var _0xce96=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','include','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','pick','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','SquareProjects','agi','stringify','end','sendStatus','error','stack','name','send','map','SquareProject','rawAttributes'];(function(_0x51bfdb,_0x57f7c5){var _0x258642=function(_0xd7dc68){while(--_0xd7dc68){_0x51bfdb['push'](_0x51bfdb['shift']());}};_0x258642(++_0x57f7c5);}(_0xce96,0x138));var _0x6ce9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xce96[_0x432682];return _0x463d05;};'use strict';var _=require(_0x6ce9('0x0'));var Redis=require(_0x6ce9('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x6ce9('0x2'))('api');var config=require(_0x6ce9('0x3'));var db=require(_0x6ce9('0x4'))['db'];config[_0x6ce9('0x5')]=_[_0x6ce9('0x6')](config[_0x6ce9('0x5')],{'host':_0x6ce9('0x7'),'port':0x18eb});var socket=require(_0x6ce9('0x8'))(new Redis(config['redis']));require(_0x6ce9('0x9'))['register'](socket);function respondWithResult(_0x303013,_0x5ca45f){_0x5ca45f=_0x5ca45f||0xc8;return function(_0x14fdc6){if(_0x14fdc6){return _0x303013[_0x6ce9('0xa')](_0x5ca45f)[_0x6ce9('0xb')](_0x14fdc6);}};}function respondWithFilteredResult(_0x45f8,_0x47e13e){return function(_0x1ba61f){if(_0x1ba61f){var _0x20f36d=typeof _0x47e13e[_0x6ce9('0xc')]==='undefined'&&typeof _0x47e13e['limit']===_0x6ce9('0xd');var _0x141e69=_0x1ba61f[_0x6ce9('0xe')];var _0x1633a7=_0x20f36d?0x0:_0x47e13e[_0x6ce9('0xc')];var _0x31a702=_0x20f36d?_0x1ba61f['count']:_0x47e13e[_0x6ce9('0xc')]+_0x47e13e[_0x6ce9('0xf')];var _0x1168cc;if(_0x31a702>=_0x141e69){_0x31a702=_0x141e69;_0x1168cc=0xc8;}else{_0x1168cc=0xce;}_0x45f8['status'](_0x1168cc);return _0x45f8[_0x6ce9('0x10')](_0x6ce9('0x11'),_0x1633a7+'-'+_0x31a702+'/'+_0x141e69)[_0x6ce9('0xb')](_0x1ba61f);}return null;};}function saveUpdates(_0x4be237){return function(_0x501a2f){if(_0x501a2f){return _0x501a2f[_0x6ce9('0x12')](_0x4be237)[_0x6ce9('0x13')](function(_0x5687b1){return _0x5687b1;});}return null;};}function removeEntity(_0x493faf){return function(_0x16ccb2){if(_0x16ccb2){return _0x16ccb2[_0x6ce9('0x14')]()[_0x6ce9('0x13')](function(){var _0x1fd4f1=_0x16ccb2['get']({'plain':!![]});var _0x1f5794=_0x6ce9('0x15');return db['UserProfileResource'][_0x6ce9('0x14')]({'where':{'type':_0x1f5794,'resourceId':_0x1fd4f1['id']}})['then'](function(){return _0x16ccb2;});})[_0x6ce9('0x13')](function(){var _0x54e4b0=new Redis(config[_0x6ce9('0x5')]);_0x54e4b0['publish'](_0x6ce9('0x16'),JSON[_0x6ce9('0x17')]({'id':_0x16ccb2['id'],'deleted':!![]}));})['then'](function(){_0x493faf[_0x6ce9('0xa')](0xcc)[_0x6ce9('0x18')]();});}};}function handleEntityNotFound(_0x45f02b){return function(_0x9ee391){if(!_0x9ee391){_0x45f02b[_0x6ce9('0x19')](0x194);}return _0x9ee391;};}function handleError(_0x3319eb,_0x5a0f5e){_0x5a0f5e=_0x5a0f5e||0x1f4;return function(_0xb7ddbe){logger[_0x6ce9('0x1a')](_0xb7ddbe[_0x6ce9('0x1b')]);if(_0xb7ddbe['name']){delete _0xb7ddbe[_0x6ce9('0x1c')];}_0x3319eb['status'](_0x5a0f5e)[_0x6ce9('0x1d')](_0xb7ddbe);};}exports['index']=function(_0x26ca98,_0x4ad3fd){var _0x26f5c7={},_0x275df3={},_0x1c8558={'count':0x0,'rows':[]};var _0x1d8cff=_[_0x6ce9('0x1e')](db[_0x6ce9('0x1f')][_0x6ce9('0x20')],function(_0x1f2c6f){return{'name':_0x1f2c6f[_0x6ce9('0x21')],'type':_0x1f2c6f[_0x6ce9('0x22')]['key']};});_0x275df3[_0x6ce9('0x23')]=_['map'](_0x1d8cff,_0x6ce9('0x1c'));_0x275df3[_0x6ce9('0x24')]=_[_0x6ce9('0x25')](_0x26ca98[_0x6ce9('0x24')]);_0x275df3[_0x6ce9('0x26')]=_[_0x6ce9('0x27')](_0x275df3[_0x6ce9('0x23')],_0x275df3[_0x6ce9('0x24')]);_0x26f5c7[_0x6ce9('0x28')]=_[_0x6ce9('0x27')](_0x275df3[_0x6ce9('0x23')],qs[_0x6ce9('0x29')](_0x26ca98[_0x6ce9('0x24')][_0x6ce9('0x29')]));_0x26f5c7[_0x6ce9('0x28')]=_0x26f5c7[_0x6ce9('0x28')][_0x6ce9('0x2a')]?_0x26f5c7[_0x6ce9('0x28')]:_0x275df3[_0x6ce9('0x23')];if(!_0x26ca98[_0x6ce9('0x24')][_0x6ce9('0x2b')]('nolimit')){_0x26f5c7[_0x6ce9('0xf')]=qs[_0x6ce9('0xf')](_0x26ca98[_0x6ce9('0x24')][_0x6ce9('0xf')]);_0x26f5c7['offset']=qs[_0x6ce9('0xc')](_0x26ca98[_0x6ce9('0x24')][_0x6ce9('0xc')]);}_0x26f5c7[_0x6ce9('0x2c')]=qs[_0x6ce9('0x2d')](_0x26ca98[_0x6ce9('0x24')]['sort']);_0x26f5c7[_0x6ce9('0x2e')]=qs[_0x6ce9('0x26')](_['pick'](_0x26ca98[_0x6ce9('0x24')],_0x275df3[_0x6ce9('0x26')]),_0x1d8cff);if(_0x26ca98[_0x6ce9('0x24')]['filter']){_0x26f5c7[_0x6ce9('0x2e')]=_[_0x6ce9('0x2f')](_0x26f5c7[_0x6ce9('0x2e')],{'$or':_[_0x6ce9('0x1e')](_0x1d8cff,function(_0x225843){if(_0x225843[_0x6ce9('0x22')]!=='VIRTUAL'){var _0x3a025c={};_0x3a025c[_0x225843[_0x6ce9('0x1c')]]={'$like':'%'+_0x26ca98[_0x6ce9('0x24')][_0x6ce9('0x30')]+'%'};return _0x3a025c;}})});}_0x26f5c7=_[_0x6ce9('0x2f')]({},_0x26f5c7,_0x26ca98[_0x6ce9('0x31')]);var _0x1adf31={'where':_0x26f5c7[_0x6ce9('0x2e')]};return db[_0x6ce9('0x1f')][_0x6ce9('0xe')](_0x1adf31)[_0x6ce9('0x13')](function(_0x2ade07){_0x1c8558[_0x6ce9('0xe')]=_0x2ade07;if(_0x26ca98[_0x6ce9('0x24')]['includeAll']){_0x26f5c7[_0x6ce9('0x32')]=[{'all':!![]}];}return db[_0x6ce9('0x1f')]['findAll'](_0x26f5c7);})['then'](function(_0x5c952c){_0x1c8558[_0x6ce9('0x33')]=_0x5c952c;return _0x1c8558;})['then'](respondWithFilteredResult(_0x4ad3fd,_0x26f5c7))[_0x6ce9('0x34')](handleError(_0x4ad3fd,null));};exports[_0x6ce9('0x35')]=function(_0x116c69,_0x29d127){var _0x3b39a8={'raw':![],'where':{'id':_0x116c69[_0x6ce9('0x36')]['id']}},_0x474705={};_0x474705[_0x6ce9('0x23')]=_['keys'](db[_0x6ce9('0x1f')][_0x6ce9('0x20')]);_0x474705[_0x6ce9('0x24')]=_['keys'](_0x116c69[_0x6ce9('0x24')]);_0x474705['filters']=_[_0x6ce9('0x27')](_0x474705[_0x6ce9('0x23')],_0x474705['query']);_0x3b39a8['attributes']=_[_0x6ce9('0x27')](_0x474705['model'],qs['fields'](_0x116c69[_0x6ce9('0x24')][_0x6ce9('0x29')]));_0x3b39a8[_0x6ce9('0x28')]=_0x3b39a8[_0x6ce9('0x28')][_0x6ce9('0x2a')]?_0x3b39a8[_0x6ce9('0x28')]:_0x474705[_0x6ce9('0x23')];if(_0x116c69[_0x6ce9('0x24')][_0x6ce9('0x37')]){_0x3b39a8[_0x6ce9('0x32')]=[{'all':!![]}];}_0x3b39a8=_['merge']({},_0x3b39a8,_0x116c69[_0x6ce9('0x31')]);return db[_0x6ce9('0x1f')][_0x6ce9('0x38')](_0x3b39a8)[_0x6ce9('0x13')](handleEntityNotFound(_0x29d127,null))[_0x6ce9('0x13')](respondWithResult(_0x29d127,null))['catch'](handleError(_0x29d127,null));};exports[_0x6ce9('0x39')]=function(_0x592124,_0x210003){return db[_0x6ce9('0x1f')][_0x6ce9('0x39')](_0x592124[_0x6ce9('0x3a')],{})['then'](function(_0x42f3f0){var _0x5986d1=_0x592124[_0x6ce9('0x3b')][_0x6ce9('0x3c')]({'plain':!![]});if(!_0x5986d1)throw new Error(_0x6ce9('0x3d'));if(_0x5986d1['role']===_0x6ce9('0x3b')){var _0x25a826=_0x42f3f0[_0x6ce9('0x3c')]({'plain':!![]});var _0x3bb472='SquareProjects';return db[_0x6ce9('0x3e')]['find']({'where':{'name':_0x3bb472,'userProfileId':_0x5986d1[_0x6ce9('0x3f')]},'raw':!![]})[_0x6ce9('0x13')](function(_0x91b686){if(_0x91b686&&_0x91b686[_0x6ce9('0x40')]===0x0){return db[_0x6ce9('0x41')][_0x6ce9('0x39')]({'name':_0x25a826[_0x6ce9('0x1c')],'resourceId':_0x25a826['id'],'type':_0x91b686['name'],'sectionId':_0x91b686['id']},{})[_0x6ce9('0x13')](function(){return _0x42f3f0;});}else{return _0x42f3f0;}})[_0x6ce9('0x34')](function(_0x435fdb){logger[_0x6ce9('0x1a')](_0x6ce9('0x42'),_0x435fdb);throw _0x435fdb;});}return _0x42f3f0;})[_0x6ce9('0x13')](respondWithResult(_0x210003,0xc9))[_0x6ce9('0x34')](handleError(_0x210003,null));};exports[_0x6ce9('0x12')]=function(_0x40845e,_0x3a7777){if(_0x40845e[_0x6ce9('0x3a')]['id']){delete _0x40845e[_0x6ce9('0x3a')]['id'];}return db['SquareProject'][_0x6ce9('0x38')]({'where':{'id':_0x40845e[_0x6ce9('0x36')]['id']}})[_0x6ce9('0x13')](handleEntityNotFound(_0x3a7777,null))[_0x6ce9('0x13')](saveUpdates(_0x40845e[_0x6ce9('0x3a')],null))[_0x6ce9('0x13')](function(_0x20b994){if(!_0x20b994)return;var _0x11479f=_0x20b994[_0x6ce9('0x3c')]({'plain':!![]});return _0x11479f;})[_0x6ce9('0x13')](function(_0xa511e9){var _0x53a301=new Redis(config[_0x6ce9('0x5')]);_0x53a301[_0x6ce9('0x43')](_0x6ce9('0x16'),JSON[_0x6ce9('0x17')](_[_0x6ce9('0x44')](_0xa511e9,['id','name','production'])));return _0xa511e9;})[_0x6ce9('0x13')](respondWithResult(_0x3a7777,null))[_0x6ce9('0x34')](handleError(_0x3a7777,null));};exports[_0x6ce9('0x14')]=function(_0x1672a7,_0x426a46){return db[_0x6ce9('0x1f')][_0x6ce9('0x38')]({'where':{'id':_0x1672a7[_0x6ce9('0x36')]['id']}})['then'](handleEntityNotFound(_0x426a46,null))[_0x6ce9('0x13')](removeEntity(_0x426a46,null))[_0x6ce9('0x34')](handleError(_0x426a46,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 86f195e..c7c3f19 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 _0x4d9a=['emit','exports','events','SquareProject','setMaxListeners','update','remove'];(function(_0x4bbee8,_0x24f3c0){var _0x34dac8=function(_0x5ba9a5){while(--_0x5ba9a5){_0x4bbee8['push'](_0x4bbee8['shift']());}};_0x34dac8(++_0x24f3c0);}(_0x4d9a,0x191));var _0xa4d9=function(_0x3ba5d2,_0x3c7b6e){_0x3ba5d2=_0x3ba5d2-0x0;var _0x23fceb=_0x4d9a[_0x3ba5d2];return _0x23fceb;};'use strict';var EventEmitter=require(_0xa4d9('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xa4d9('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa4d9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa4d9('0x3'),'afterDestroy':_0xa4d9('0x4')};function emitEvent(_0x48becd){return function(_0x5aba51,_0x2eaa30,_0x3e6ee9){SquareProjectEvents[_0xa4d9('0x5')](_0x48becd+':'+_0x5aba51['id'],_0x5aba51);SquareProjectEvents[_0xa4d9('0x5')](_0x48becd,_0x5aba51);_0x3e6ee9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xa4d9('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x3bbf=['hook','exports','events','SquareProject','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x3bbf,0xad));var _0xf3bb=function(_0x6916d1,_0xa92721){_0x6916d1=_0x6916d1-0x0;var _0x303fb4=_0x3bbf[_0x6916d1];return _0x303fb4;};'use strict';var EventEmitter=require(_0xf3bb('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xf3bb('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xf3bb('0x2')](0x0);var events={'afterCreate':_0xf3bb('0x3'),'afterUpdate':_0xf3bb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5b0d65){return function(_0x45f564,_0x1cf9c0,_0x3781ad){SquareProjectEvents[_0xf3bb('0x5')](_0x5b0d65+':'+_0x45f564['id'],_0x45f564);SquareProjectEvents[_0xf3bb('0x5')](_0x5b0d65,_0x45f564);_0x3781ad(null);};}for(var e in events){if(events[_0xf3bb('0x6')](e)){var event=events[e];SquareProject[_0xf3bb('0x7')](e,emitEvent(event));}}module[_0xf3bb('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 3d4d91e..60605d3 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 _0xe220=['production','publishedAt','lodash','util','api','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x486394,_0x13bea7){var _0x1421fb=function(_0x7ddafa){while(--_0x7ddafa){_0x486394['push'](_0x486394['shift']());}};_0x1421fb(++_0x13bea7);}(_0xe220,0x178));var _0x0e22=function(_0x493776,_0x410976){_0x493776=_0x493776-0x0;var _0x5bc5de=_0xe220[_0x493776];return _0x5bc5de;};'use strict';var _=require(_0x0e22('0x0'));var util=require(_0x0e22('0x1'));var logger=require('../../config/logger')(_0x0e22('0x2'));var moment=require('moment');var BPromise=require(_0x0e22('0x3'));var rp=require(_0x0e22('0x4'));var fs=require('fs');var path=require(_0x0e22('0x5'));var rimraf=require('rimraf');var config=require(_0x0e22('0x6'));var attributes=require(_0x0e22('0x7'));module['exports']=function(_0x1a7e7e,_0xb6b0a0){return _0x1a7e7e[_0x0e22('0x8')](_0x0e22('0x9'),attributes,{'tableName':_0x0e22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b442e,_0x299aff,_0x5a610c){if(_0x2b442e[_0x0e22('0xb')]('preproduction')){_0x2b442e[_0x0e22('0xc')]=moment()[_0x0e22('0xd')](_0x0e22('0xe'));}if(_0x2b442e['changed'](_0x0e22('0xf'))){_0x2b442e[_0x0e22('0x10')]=moment()[_0x0e22('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5a610c(null,_0x2b442e);}}});}; \ No newline at end of file +var _0x07c4=['path','rimraf','../../config/environment','exports','define','SquareProject','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','../../config/logger','moment','bluebird'];(function(_0x4e5a6a,_0x424a0e){var _0x3cb8b4=function(_0x36a79b){while(--_0x36a79b){_0x4e5a6a['push'](_0x4e5a6a['shift']());}};_0x3cb8b4(++_0x424a0e);}(_0x07c4,0x10b));var _0x407c=function(_0x30da69,_0x16f163){_0x30da69=_0x30da69-0x0;var _0x26ec9a=_0x07c4[_0x30da69];return _0x26ec9a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x407c('0x0'))('api');var moment=require(_0x407c('0x1'));var BPromise=require(_0x407c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x407c('0x3'));var rimraf=require(_0x407c('0x4'));var config=require(_0x407c('0x5'));var attributes=require('./squareProject.attributes');module[_0x407c('0x6')]=function(_0x45c4ce,_0x2cb5e5){return _0x45c4ce[_0x407c('0x7')](_0x407c('0x8'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xfeb118,_0x1498dc,_0x7fdb63){if(_0xfeb118['changed'](_0x407c('0x9'))){_0xfeb118[_0x407c('0xa')]=moment()['format'](_0x407c('0xb'));}if(_0xfeb118['changed'](_0x407c('0xc'))){_0xfeb118[_0x407c('0xd')]=moment()[_0x407c('0xe')](_0x407c('0xb'));}_0x7fdb63(null,_0xfeb118);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 9355325..21c3e4f 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 _0x3fb3=['then','info','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','../../mysqldb','../../config/logger','redis','defaults','localhost','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes','include','map','model'];(function(_0x5e1591,_0x597776){var _0x33d511=function(_0x416120){while(--_0x416120){_0x5e1591['push'](_0x5e1591['shift']());}};_0x33d511(++_0x597776);}(_0x3fb3,0x18f));var _0x33fb=function(_0x45e0ed,_0x107bae){_0x45e0ed=_0x45e0ed-0x0;var _0x5bf589=_0x3fb3[_0x45e0ed];return _0x5bf589;};'use strict';var _=require(_0x33fb('0x0'));var Redis=require('ioredis');var db=require(_0x33fb('0x1'))['db'];var logger=require(_0x33fb('0x2'))('rpc');var config=require('../../config/environment');config[_0x33fb('0x3')]=_[_0x33fb('0x4')](config[_0x33fb('0x3')],{'host':_0x33fb('0x5'),'port':0x18eb});var socket=require(_0x33fb('0x6'))(new Redis(config[_0x33fb('0x3')]));require('./squareProject.socket')[_0x33fb('0x7')](socket);exports[_0x33fb('0x8')]=function(_0x54b503){var _0x156339=this;return new Promise(function(_0x2ac82e,_0x43334d){return db[_0x33fb('0x9')][_0x33fb('0xa')]({'raw':_0x54b503[_0x33fb('0xb')]?_0x54b503['options'][_0x33fb('0xc')]===undefined?!![]:![]:!![],'where':_0x54b503[_0x33fb('0xb')]?_0x54b503[_0x33fb('0xb')]['where']||null:null,'attributes':_0x54b503[_0x33fb('0xb')]?_0x54b503[_0x33fb('0xb')][_0x33fb('0xd')]||null:null,'limit':_0x54b503['options']?_0x54b503[_0x33fb('0xb')]['limit']||null:null,'include':_0x54b503[_0x33fb('0xb')]?_0x54b503[_0x33fb('0xb')][_0x33fb('0xe')]?_[_0x33fb('0xf')](_0x54b503[_0x33fb('0xb')][_0x33fb('0xe')],function(_0x480b9e){return{'model':db[_0x480b9e[_0x33fb('0x10')]],'as':_0x480b9e['as'],'attributes':_0x480b9e[_0x33fb('0xd')],'include':_0x480b9e[_0x33fb('0xe')]?_[_0x33fb('0xf')](_0x480b9e[_0x33fb('0xe')],function(_0x2036f5){return{'model':db[_0x2036f5['model']],'as':_0x2036f5['as'],'attributes':_0x2036f5[_0x33fb('0xd')],'include':_0x2036f5[_0x33fb('0xe')]?_[_0x33fb('0xf')](_0x2036f5[_0x33fb('0xe')],function(_0x4e695b){return{'model':db[_0x4e695b[_0x33fb('0x10')]],'as':_0x4e695b['as'],'attributes':_0x4e695b[_0x33fb('0xd')]};}):[]};}):[]};}):[]:[]})[_0x33fb('0x11')](function(_0x1a7c99){logger[_0x33fb('0x12')](_0x33fb('0x8'),_0x54b503);logger[_0x33fb('0x13')](_0x33fb('0x8'),_0x54b503,JSON[_0x33fb('0x14')](_0x1a7c99));_0x2ac82e(_0x1a7c99);})[_0x33fb('0x15')](function(_0x248f55){logger[_0x33fb('0x16')](_0x33fb('0x8'),_0x248f55['message'],_0x54b503);_0x43334d(_0x156339['error'](0x1f4,_0x248f55[_0x33fb('0x17')]));});});};exports[_0x33fb('0x18')]=function(_0x4dd60f){var _0x2e2633=this;return new Promise(function(_0x2de9bf,_0x57406c){return db[_0x33fb('0x9')][_0x33fb('0x19')]({'raw':_0x4dd60f[_0x33fb('0xb')]?_0x4dd60f['options']['raw']===undefined?!![]:![]:!![],'where':_0x4dd60f[_0x33fb('0xb')]?_0x4dd60f[_0x33fb('0xb')]['where']||null:null,'attributes':_0x4dd60f['options']?_0x4dd60f['options']['attributes']||null:null,'include':_0x4dd60f[_0x33fb('0xb')]?_0x4dd60f[_0x33fb('0xb')]['include']?_[_0x33fb('0xf')](_0x4dd60f[_0x33fb('0xb')][_0x33fb('0xe')],function(_0x323b34){return{'model':db[_0x323b34[_0x33fb('0x10')]],'as':_0x323b34['as'],'attributes':_0x323b34[_0x33fb('0xd')],'include':_0x323b34[_0x33fb('0xe')]?_[_0x33fb('0xf')](_0x323b34[_0x33fb('0xe')],function(_0x109000){return{'model':db[_0x109000[_0x33fb('0x10')]],'as':_0x109000['as'],'attributes':_0x109000[_0x33fb('0xd')],'include':_0x109000[_0x33fb('0xe')]?_[_0x33fb('0xf')](_0x109000[_0x33fb('0xe')],function(_0x41759b){return{'model':db[_0x41759b[_0x33fb('0x10')]],'as':_0x41759b['as'],'attributes':_0x41759b[_0x33fb('0xd')]};}):[]};}):[]};}):[]:[]})[_0x33fb('0x11')](function(_0x3d762d){logger[_0x33fb('0x12')](_0x33fb('0x18'),_0x4dd60f);logger['debug'](_0x33fb('0x18'),_0x4dd60f,JSON[_0x33fb('0x14')](_0x3d762d));_0x2de9bf(_0x3d762d);})[_0x33fb('0x15')](function(_0x41d47f){logger[_0x33fb('0x16')](_0x33fb('0x18'),_0x41d47f[_0x33fb('0x17')],_0x4dd60f);_0x57406c(_0x2e2633[_0x33fb('0x16')](0x1f4,_0x41d47f['message']));});});}; \ No newline at end of file +var _0xb0af=['localhost','socket.io-emitter','./squareProject.socket','register','SquareProject','options','raw','where','attributes','limit','include','map','then','info','GetSquareProjects','debug','stringify','error','message','ShowSquareProject','model','catch','ioredis','rpc','redis','defaults'];(function(_0x51923e,_0x44e888){var _0x2db93=function(_0x538027){while(--_0x538027){_0x51923e['push'](_0x51923e['shift']());}};_0x2db93(++_0x44e888);}(_0xb0af,0xe6));var _0xfb0a=function(_0x1aacac,_0x1b13f2){_0x1aacac=_0x1aacac-0x0;var _0x5c9f1d=_0xb0af[_0x1aacac];return _0x5c9f1d;};'use strict';var _=require('lodash');var Redis=require(_0xfb0a('0x0'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xfb0a('0x1'));var config=require('../../config/environment');config[_0xfb0a('0x2')]=_[_0xfb0a('0x3')](config[_0xfb0a('0x2')],{'host':_0xfb0a('0x4'),'port':0x18eb});var socket=require(_0xfb0a('0x5'))(new Redis(config[_0xfb0a('0x2')]));require(_0xfb0a('0x6'))[_0xfb0a('0x7')](socket);exports['GetSquareProjects']=function(_0x2efe7a){var _0x58e078=this;return new Promise(function(_0x309b6c,_0x292cc7){return db[_0xfb0a('0x8')]['findAll']({'raw':_0x2efe7a[_0xfb0a('0x9')]?_0x2efe7a[_0xfb0a('0x9')][_0xfb0a('0xa')]===undefined?!![]:![]:!![],'where':_0x2efe7a[_0xfb0a('0x9')]?_0x2efe7a[_0xfb0a('0x9')][_0xfb0a('0xb')]||null:null,'attributes':_0x2efe7a[_0xfb0a('0x9')]?_0x2efe7a[_0xfb0a('0x9')][_0xfb0a('0xc')]||null:null,'limit':_0x2efe7a['options']?_0x2efe7a[_0xfb0a('0x9')][_0xfb0a('0xd')]||null:null,'include':_0x2efe7a['options']?_0x2efe7a[_0xfb0a('0x9')][_0xfb0a('0xe')]?_[_0xfb0a('0xf')](_0x2efe7a[_0xfb0a('0x9')][_0xfb0a('0xe')],function(_0x3b5b18){return{'model':db[_0x3b5b18['model']],'as':_0x3b5b18['as'],'attributes':_0x3b5b18[_0xfb0a('0xc')],'include':_0x3b5b18['include']?_[_0xfb0a('0xf')](_0x3b5b18[_0xfb0a('0xe')],function(_0x49a7b4){return{'model':db[_0x49a7b4['model']],'as':_0x49a7b4['as'],'attributes':_0x49a7b4[_0xfb0a('0xc')],'include':_0x49a7b4[_0xfb0a('0xe')]?_[_0xfb0a('0xf')](_0x49a7b4[_0xfb0a('0xe')],function(_0x19398a){return{'model':db[_0x19398a['model']],'as':_0x19398a['as'],'attributes':_0x19398a[_0xfb0a('0xc')]};}):[]};}):[]};}):[]:[]})[_0xfb0a('0x10')](function(_0x3bd693){logger[_0xfb0a('0x11')](_0xfb0a('0x12'),_0x2efe7a);logger[_0xfb0a('0x13')](_0xfb0a('0x12'),_0x2efe7a,JSON[_0xfb0a('0x14')](_0x3bd693));_0x309b6c(_0x3bd693);})['catch'](function(_0x183796){logger[_0xfb0a('0x15')](_0xfb0a('0x12'),_0x183796[_0xfb0a('0x16')],_0x2efe7a);_0x292cc7(_0x58e078[_0xfb0a('0x15')](0x1f4,_0x183796[_0xfb0a('0x16')]));});});};exports[_0xfb0a('0x17')]=function(_0x2a12c2){var _0x5e4458=this;return new Promise(function(_0x3d173c,_0x111d17){return db[_0xfb0a('0x8')]['find']({'raw':_0x2a12c2[_0xfb0a('0x9')]?_0x2a12c2['options'][_0xfb0a('0xa')]===undefined?!![]:![]:!![],'where':_0x2a12c2[_0xfb0a('0x9')]?_0x2a12c2[_0xfb0a('0x9')][_0xfb0a('0xb')]||null:null,'attributes':_0x2a12c2['options']?_0x2a12c2[_0xfb0a('0x9')][_0xfb0a('0xc')]||null:null,'include':_0x2a12c2[_0xfb0a('0x9')]?_0x2a12c2[_0xfb0a('0x9')][_0xfb0a('0xe')]?_[_0xfb0a('0xf')](_0x2a12c2[_0xfb0a('0x9')][_0xfb0a('0xe')],function(_0x111425){return{'model':db[_0x111425[_0xfb0a('0x18')]],'as':_0x111425['as'],'attributes':_0x111425[_0xfb0a('0xc')],'include':_0x111425['include']?_[_0xfb0a('0xf')](_0x111425[_0xfb0a('0xe')],function(_0x1115a9){return{'model':db[_0x1115a9[_0xfb0a('0x18')]],'as':_0x1115a9['as'],'attributes':_0x1115a9[_0xfb0a('0xc')],'include':_0x1115a9[_0xfb0a('0xe')]?_['map'](_0x1115a9[_0xfb0a('0xe')],function(_0x37954d){return{'model':db[_0x37954d[_0xfb0a('0x18')]],'as':_0x37954d['as'],'attributes':_0x37954d[_0xfb0a('0xc')]};}):[]};}):[]};}):[]:[]})[_0xfb0a('0x10')](function(_0x445081){logger[_0xfb0a('0x11')](_0xfb0a('0x17'),_0x2a12c2);logger['debug']('ShowSquareProject',_0x2a12c2,JSON['stringify'](_0x445081));_0x3d173c(_0x445081);})[_0xfb0a('0x19')](function(_0x3b777e){logger[_0xfb0a('0x15')](_0xfb0a('0x17'),_0x3b777e[_0xfb0a('0x16')],_0x2a12c2);_0x111d17(_0x5e4458['error'](0x1f4,_0x3b777e[_0xfb0a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index cd63ce6..aaf3ca0 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 _0x9d4e=['./squareProject.events','remove','update','emit','removeListener','length','squareProject:'];(function(_0x4fb302,_0x229efb){var _0x2d8adf=function(_0x2a5cb8){while(--_0x2a5cb8){_0x4fb302['push'](_0x4fb302['shift']());}};_0x2d8adf(++_0x229efb);}(_0x9d4e,0xa8));var _0xe9d4=function(_0x3a0f77,_0x39f605){_0x3a0f77=_0x3a0f77-0x0;var _0x54fd0c=_0x9d4e[_0x3a0f77];return _0x54fd0c;};'use strict';var SquareProjectEvents=require(_0xe9d4('0x0'));var events=['save',_0xe9d4('0x1'),_0xe9d4('0x2')];function createListener(_0x35d0d0,_0x50def3){return function(_0x1d9b0e){_0x50def3[_0xe9d4('0x3')](_0x35d0d0,_0x1d9b0e);};}function removeListener(_0x131897,_0x4d6f1e){return function(){SquareProjectEvents[_0xe9d4('0x4')](_0x131897,_0x4d6f1e);};}exports['register']=function(_0x62efa){for(var _0x1586ec=0x0,_0x3ade87=events[_0xe9d4('0x5')];_0x1586ec<_0x3ade87;_0x1586ec++){var _0xd0ebc7=events[_0x1586ec];var _0x2243fa=createListener(_0xe9d4('0x6')+_0xd0ebc7,_0x62efa);SquareProjectEvents['on'](_0xd0ebc7,_0x2243fa);}}; \ No newline at end of file +var _0xd1f7=['emit','register','remove','update'];(function(_0x5769f2,_0x3f6c65){var _0xa1d08b=function(_0x1324c1){while(--_0x1324c1){_0x5769f2['push'](_0x5769f2['shift']());}};_0xa1d08b(++_0x3f6c65);}(_0xd1f7,0x172));var _0x7d1f=function(_0x26ab0c,_0x1d1d76){_0x26ab0c=_0x26ab0c-0x0;var _0x39292c=_0xd1f7[_0x26ab0c];return _0x39292c;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x7d1f('0x0'),_0x7d1f('0x1')];function createListener(_0x3da0c8,_0x53383a){return function(_0x4e650a){_0x53383a[_0x7d1f('0x2')](_0x3da0c8,_0x4e650a);};}function removeListener(_0x713e32,_0x252fcb){return function(){SquareProjectEvents['removeListener'](_0x713e32,_0x252fcb);};}exports[_0x7d1f('0x3')]=function(_0x17eaa2){for(var _0x5b6c1d=0x0,_0x2bcf83=events['length'];_0x5b6c1d<_0x2bcf83;_0x5b6c1d++){var _0x3465e7=events[_0x5b6c1d];var _0x1bf3a6=createListener('squareProject:'+_0x3465e7,_0x17eaa2);SquareProjectEvents['on'](_0x3465e7,_0x1bf3a6);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 459ed7a..39b2bad 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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0xb5778d,_0x3aa2a4){var _0x1059bd=function(_0x4c2cac){while(--_0x4c2cac){_0xb5778d['push'](_0xb5778d['shift']());}};_0x1059bd(++_0x3aa2a4);}(_0x1cb9,0x14e));var _0x91cb=function(_0x32bdf6,_0x602ada){_0x32bdf6=_0x32bdf6-0x0;var _0x2aaa8e=_0x1cb9[_0x32bdf6];return _0x2aaa8e;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x28622f,_0x5d9df3){var _0x594205=function(_0x2f2de5){while(--_0x2f2de5){_0x28622f['push'](_0x28622f['shift']());}};_0x594205(++_0x5d9df3);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x5fc3[_0x3c81b5];return _0x5888c4;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index a42c49d..b9691d7 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 _0x326f=['getDataValue','sequelize','STRING','VIRTUAL'];(function(_0x125bc2,_0xc3fc77){var _0x4f20b7=function(_0x35c2d6){while(--_0x35c2d6){_0x125bc2['push'](_0x125bc2['shift']());}};_0x4f20b7(++_0xc3fc77);}(_0x326f,0xd1));var _0xf326=function(_0x1d3e6a,_0x12c709){_0x1d3e6a=_0x1d3e6a-0x0;var _0x476d29=_0x326f[_0x1d3e6a];return _0x476d29;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf326('0x1')]},'calleridname':{'type':Sequelize[_0xf326('0x1')]},'context':{'type':Sequelize[_0xf326('0x1')]},'extension':{'type':Sequelize[_0xf326('0x1')]},'priority':{'type':Sequelize[_0xf326('0x1')]},'accountcode':{'type':Sequelize[_0xf326('0x1')]},'dnid':{'type':Sequelize[_0xf326('0x1')]},'projectName':{'type':Sequelize[_0xf326('0x1')]},'saveName':{'type':Sequelize[_0xf326('0x1')]},'filename':{'type':Sequelize[_0xf326('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xf326('0x2')],'get':function(){var _0x3851eb='';var _0x165f95=this[_0xf326('0x3')]('savePath');if(_0x165f95){_0x3851eb=_0x165f95['substring'](_0x165f95['lastIndexOf']('.'));}return _0x3851eb;}}}; \ No newline at end of file +var _0xeda8=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xeda8,0x104));var _0x8eda=function(_0x289e40,_0xdde74a){_0x289e40=_0x289e40-0x0;var _0x669b5b=_0xeda8[_0x289e40];return _0x669b5b;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8eda('0x2')]},'calleridname':{'type':Sequelize[_0x8eda('0x2')]},'context':{'type':Sequelize[_0x8eda('0x2')]},'extension':{'type':Sequelize[_0x8eda('0x2')]},'priority':{'type':Sequelize[_0x8eda('0x2')]},'accountcode':{'type':Sequelize[_0x8eda('0x2')]},'dnid':{'type':Sequelize[_0x8eda('0x2')]},'projectName':{'type':Sequelize[_0x8eda('0x2')]},'saveName':{'type':Sequelize[_0x8eda('0x2')]},'filename':{'type':Sequelize[_0x8eda('0x2')]},'savePath':{'type':Sequelize[_0x8eda('0x2')]},'format':{'type':Sequelize[_0x8eda('0x3')],'get':function(){var _0x4e2ebb='';var _0x28b721=this[_0x8eda('0x4')](_0x8eda('0x5'));if(_0x28b721){_0x4e2ebb=_0x28b721[_0x8eda('0x6')](_0x28b721['lastIndexOf']('.'));}return _0x4e2ebb;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1d356e6..3edf249 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 _0x187f=['sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','end','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','SquareRecording','includeAll','findAll','rows','catch','show','params','find','create','body','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','download','extname','unlink','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','rimraf','bluebird','mustache','util','path'];(function(_0x7d869c,_0x396fca){var _0x141baa=function(_0x222fad){while(--_0x222fad){_0x7d869c['push'](_0x7d869c['shift']());}};_0x141baa(++_0x396fca);}(_0x187f,0x16f));var _0xf187=function(_0x8cc098,_0x435b51){_0x8cc098=_0x8cc098-0x0;var _0x4a9096=_0x187f[_0x8cc098];return _0x4a9096;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf187('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf187('0x1'));var Mustache=require(_0xf187('0x2'));var util=require(_0xf187('0x3'));var path=require(_0xf187('0x4'));var sox=require(_0xf187('0x5'));var csv=require('to-csv');var ejs=require(_0xf187('0x6'));var fs=require('fs');var fs_extra=require(_0xf187('0x7'));var _=require(_0xf187('0x8'));var squel=require(_0xf187('0x9'));var crypto=require('crypto');var jsforce=require(_0xf187('0xa'));var deskjs=require(_0xf187('0xb'));var toCsv=require(_0xf187('0xc'));var querystring=require(_0xf187('0xd'));var Papa=require(_0xf187('0xe'));var Redis=require(_0xf187('0xf'));var authService=require(_0xf187('0x10'));var qs=require(_0xf187('0x11'));var as=require(_0xf187('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf187('0x13'))('api');var utils=require(_0xf187('0x14'));var config=require(_0xf187('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf187('0x16'))['db'];function respondWithStatusCode(_0x3b9fcb,_0x1e3252){_0x1e3252=_0x1e3252||0xcc;return function(_0x3dbaef){if(_0x3dbaef){return _0x3b9fcb[_0xf187('0x17')](_0x1e3252);}return _0x3b9fcb[_0xf187('0x18')](_0x1e3252)['end']();};}function respondWithResult(_0x556198,_0x1fd5d9){_0x1fd5d9=_0x1fd5d9||0xc8;return function(_0x3aca34){if(_0x3aca34){return _0x556198[_0xf187('0x18')](_0x1fd5d9)[_0xf187('0x19')](_0x3aca34);}};}function respondWithFilteredResult(_0x3c17c2,_0x2d5cb3){return function(_0x19c905){if(_0x19c905){var _0x18cee6=typeof _0x2d5cb3[_0xf187('0x1a')]===_0xf187('0x1b')&&typeof _0x2d5cb3[_0xf187('0x1c')]===_0xf187('0x1b');var _0x2e9ea6=_0x19c905[_0xf187('0x1d')];var _0x565493=_0x18cee6?0x0:_0x2d5cb3['offset'];var _0x336a62=_0x18cee6?_0x19c905['count']:_0x2d5cb3['offset']+_0x2d5cb3[_0xf187('0x1c')];var _0x24e287;if(_0x336a62>=_0x2e9ea6){_0x336a62=_0x2e9ea6;_0x24e287=0xc8;}else{_0x24e287=0xce;}_0x3c17c2[_0xf187('0x18')](_0x24e287);return _0x3c17c2[_0xf187('0x1e')]('Content-Range',_0x565493+'-'+_0x336a62+'/'+_0x2e9ea6)[_0xf187('0x19')](_0x19c905);}return null;};}function patchUpdates(_0x2a5a0e){return function(_0x47072e){try{jsonpatch[_0xf187('0x1f')](_0x47072e,_0x2a5a0e,!![]);}catch(_0x4f75f8){return BPromise[_0xf187('0x20')](_0x4f75f8);}return _0x47072e['save']();};}function saveUpdates(_0x54588e,_0x52d640){return function(_0x42ae54){if(_0x42ae54){return _0x42ae54['update'](_0x54588e)[_0xf187('0x21')](function(_0xc0cd25){return _0xc0cd25;});}return null;};}function removeEntity(_0x181f14,_0x1ec8ba){return function(_0xf1c62a){if(_0xf1c62a){return _0xf1c62a[_0xf187('0x22')]()['then'](function(){_0x181f14[_0xf187('0x18')](0xcc)[_0xf187('0x23')]();});}};}function handleEntityNotFound(_0x2970cf,_0x5e5484){return function(_0x2f4828){if(!_0x2f4828){_0x2970cf[_0xf187('0x17')](0x194);}return _0x2f4828;};}function handleError(_0x125c8b,_0x630de){_0x630de=_0x630de||0x1f4;return function(_0x2503c9){logger['error'](_0x2503c9[_0xf187('0x24')]);if(_0x2503c9[_0xf187('0x25')]){delete _0x2503c9[_0xf187('0x25')];}_0x125c8b['status'](_0x630de)[_0xf187('0x26')](_0x2503c9);};}exports[_0xf187('0x27')]=function(_0x59503a,_0x557542){var _0x2d8f43={},_0x2f651f={},_0x14347f={'count':0x0,'rows':[]};var _0x2e51e4=_[_0xf187('0x28')](db['SquareRecording'][_0xf187('0x29')],function(_0x295698){return{'name':_0x295698['fieldName'],'type':_0x295698[_0xf187('0x2a')][_0xf187('0x2b')]};});_0x2f651f[_0xf187('0x2c')]=_[_0xf187('0x28')](_0x2e51e4,'name');_0x2f651f[_0xf187('0x2d')]=_[_0xf187('0x2e')](_0x59503a[_0xf187('0x2d')]);_0x2f651f[_0xf187('0x2f')]=_[_0xf187('0x30')](_0x2f651f[_0xf187('0x2c')],_0x2f651f[_0xf187('0x2d')]);_0x2d8f43[_0xf187('0x31')]=_['intersection'](_0x2f651f[_0xf187('0x2c')],qs['fields'](_0x59503a[_0xf187('0x2d')][_0xf187('0x32')]));_0x2d8f43['attributes']=_0x2d8f43['attributes'][_0xf187('0x33')]?_0x2d8f43[_0xf187('0x31')]:_0x2f651f[_0xf187('0x2c')];if(!_0x59503a[_0xf187('0x2d')][_0xf187('0x34')]('nolimit')){_0x2d8f43['limit']=qs[_0xf187('0x1c')](_0x59503a[_0xf187('0x2d')]['limit']);_0x2d8f43[_0xf187('0x1a')]=qs['offset'](_0x59503a[_0xf187('0x2d')]['offset']);}_0x2d8f43[_0xf187('0x35')]=qs[_0xf187('0x36')](_0x59503a[_0xf187('0x2d')][_0xf187('0x36')]);_0x2d8f43[_0xf187('0x37')]=qs[_0xf187('0x2f')](_['pick'](_0x59503a[_0xf187('0x2d')],_0x2f651f[_0xf187('0x2f')]),_0x2e51e4);if(_0x59503a['query'][_0xf187('0x38')]){_0x2d8f43[_0xf187('0x37')]=_['merge'](_0x2d8f43[_0xf187('0x37')],{'$or':_[_0xf187('0x28')](_0x2e51e4,function(_0x4cc81f){if(_0x4cc81f['type']!==_0xf187('0x39')){var _0x1e23d1={};_0x1e23d1[_0x4cc81f['name']]={'$like':'%'+_0x59503a[_0xf187('0x2d')][_0xf187('0x38')]+'%'};return _0x1e23d1;}})});}_0x2d8f43=_[_0xf187('0x3a')]({},_0x2d8f43,_0x59503a[_0xf187('0x3b')]);var _0x2579f0={'where':_0x2d8f43[_0xf187('0x37')]};return db[_0xf187('0x3c')]['count'](_0x2579f0)[_0xf187('0x21')](function(_0x1e8ac4){_0x14347f[_0xf187('0x1d')]=_0x1e8ac4;if(_0x59503a['query'][_0xf187('0x3d')]){_0x2d8f43['include']=[{'all':!![]}];}return db[_0xf187('0x3c')][_0xf187('0x3e')](_0x2d8f43);})[_0xf187('0x21')](function(_0x3391d1){_0x14347f[_0xf187('0x3f')]=_0x3391d1;return _0x14347f;})[_0xf187('0x21')](respondWithFilteredResult(_0x557542,_0x2d8f43))[_0xf187('0x40')](handleError(_0x557542,null));};exports[_0xf187('0x41')]=function(_0x8c4043,_0x3d1970){var _0x1b5de3={'raw':!![],'where':{'id':_0x8c4043[_0xf187('0x42')]['id']}},_0x555592={};_0x555592[_0xf187('0x2c')]=_[_0xf187('0x2e')](db[_0xf187('0x3c')][_0xf187('0x29')]);_0x555592[_0xf187('0x2d')]=_['keys'](_0x8c4043[_0xf187('0x2d')]);_0x555592[_0xf187('0x2f')]=_[_0xf187('0x30')](_0x555592['model'],_0x555592['query']);_0x1b5de3[_0xf187('0x31')]=_['intersection'](_0x555592[_0xf187('0x2c')],qs[_0xf187('0x32')](_0x8c4043[_0xf187('0x2d')][_0xf187('0x32')]));_0x1b5de3[_0xf187('0x31')]=_0x1b5de3['attributes'][_0xf187('0x33')]?_0x1b5de3[_0xf187('0x31')]:_0x555592['model'];if(_0x8c4043[_0xf187('0x2d')][_0xf187('0x3d')]){_0x1b5de3['include']=[{'all':!![]}];}_0x1b5de3=_[_0xf187('0x3a')]({},_0x1b5de3,_0x8c4043['options']);return db['SquareRecording'][_0xf187('0x43')](_0x1b5de3)[_0xf187('0x21')](handleEntityNotFound(_0x3d1970,null))[_0xf187('0x21')](respondWithResult(_0x3d1970,null))['catch'](handleError(_0x3d1970,null));};exports[_0xf187('0x44')]=function(_0x2bed29,_0xc87dee){return db[_0xf187('0x3c')][_0xf187('0x44')](_0x2bed29[_0xf187('0x45')],{})[_0xf187('0x21')](respondWithResult(_0xc87dee,0xc9))[_0xf187('0x40')](handleError(_0xc87dee,null));};exports['update']=function(_0x449fbe,_0x42175a){if(_0x449fbe[_0xf187('0x45')]['id']){delete _0x449fbe[_0xf187('0x45')]['id'];}return db[_0xf187('0x3c')][_0xf187('0x43')]({'where':{'id':_0x449fbe[_0xf187('0x42')]['id']}})['then'](handleEntityNotFound(_0x42175a,null))[_0xf187('0x21')](saveUpdates(_0x449fbe[_0xf187('0x45')],null))[_0xf187('0x21')](respondWithResult(_0x42175a,null))['catch'](handleError(_0x42175a,null));};exports['download']=function(_0x1a5fc3,_0x591c60,_0x4abe21){var _0x158f4e=require(_0xf187('0x46'));var _0x432eae=![];var _0x3849fd={};if(_0x1a5fc3['query'][_0xf187('0x2a')]&&_0x1a5fc3[_0xf187('0x2d')][_0xf187('0x2a')]===_0xf187('0x47')){_0x3849fd[_0xf187('0x47')]=_0x1a5fc3[_0xf187('0x42')]['id'];}else{_0x3849fd['id']=_0x1a5fc3[_0xf187('0x42')]['id'];}return db['SquareRecording']['find']({'where':_0x3849fd,'attributes':['id','savePath',_0xf187('0x48')],'raw':!![]})[_0xf187('0x21')](handleEntityNotFound(_0x591c60,null))[_0xf187('0x21')](function(_0x4f5e12){if(_0x4f5e12){var _0x181fca=_0x4f5e12[_0xf187('0x49')];var _0x4089f8=util[_0xf187('0x4a')](_0xf187('0x4b'),_0x181fca);if(fs[_0xf187('0x4c')](_0x4089f8)){_0x432eae=!![];return _0x158f4e[_0xf187('0x4d')](_0x4089f8,_0x181fca,config[_0xf187('0x4e')][_0xf187('0x4f')])['then'](function(){return _0x4f5e12;});}return _0x4f5e12;}})[_0xf187('0x21')](function(_0x363a4a){if(_0x363a4a){var _0xf09017=_0x363a4a[_0xf187('0x49')];if(!fs[_0xf187('0x4c')](_0xf09017)){throw new db[(_0xf187('0x50'))]['ValidationError'](_0xf187('0x51'));}if(_0x363a4a['filename']){return _0x591c60[_0xf187('0x52')](_0xf09017,_0x363a4a[_0xf187('0x48')]+path[_0xf187('0x53')](_0xf09017),function(){if(_0x432eae){fs[_0xf187('0x54')](_0xf09017);}});}else{return _0x591c60[_0xf187('0x52')](_0xf09017,function(_0x846be2){if(_0x432eae){fs['unlink'](_0xf09017);}});}}})['catch'](function(_0x4edf35){if(_0x4edf35['message']===_0xf187('0x51')){_0x591c60['status'](0x194)[_0xf187('0x26')]('Not\x20found');}else{return handleError(_0x591c60,null);}});};exports[_0xf187('0x22')]=function(_0x5857a4,_0x329587){return db[_0xf187('0x3c')][_0xf187('0x43')]({'where':{'id':_0x5857a4['params']['id']}})[_0xf187('0x21')](function(_0x21b888){if(_['isNil'](_0x21b888)){throw new ReferenceError(_0xf187('0x55'));}return _0x21b888;})[_0xf187('0x21')](function(_0x219f3d){var _0x55b387=_0x219f3d[_0xf187('0x49')];logger[_0xf187('0x56')](_0xf187('0x57'),_0x55b387);if(!_['isNil'](_0x219f3d[_0xf187('0x49')])&&fs[_0xf187('0x4c')](_0x55b387)){logger['info'](_0xf187('0x58')+_0x55b387+_0xf187('0x59'));fs[_0xf187('0x5a')](_0x55b387);}_0x55b387=_0x55b387+_0xf187('0x5b');if(!_[_0xf187('0x5c')](_0x219f3d['savePath'])&&fs[_0xf187('0x4c')](_0x55b387)){logger[_0xf187('0x56')](_0xf187('0x58')+_0x55b387+_0xf187('0x59'));fs[_0xf187('0x5a')](_0x55b387);}return _0x219f3d;})['then'](function(_0x549e52){if(!_0x549e52)throw new InternalError();return _0x549e52[_0xf187('0x22')]();})['then'](function(){_0x329587[_0xf187('0x18')](0xcc)[_0xf187('0x23')]();})['catch'](handleError(_0x329587,null));}; \ No newline at end of file +var _0xdeee=['params','rawAttributes','length','include','create','body','find','download','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','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','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareRecording','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0xdeee,0x1b6));var _0xedee=function(_0x123cea,_0x10b8cb){_0x123cea=_0x123cea-0x0;var _0xd09362=_0xdeee[_0x123cea];return _0xd09362;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedee('0x0'));var zipdir=require(_0xedee('0x1'));var jsonpatch=require(_0xedee('0x2'));var rp=require(_0xedee('0x3'));var moment=require('moment');var BPromise=require(_0xedee('0x4'));var Mustache=require(_0xedee('0x5'));var util=require(_0xedee('0x6'));var path=require(_0xedee('0x7'));var sox=require(_0xedee('0x8'));var csv=require(_0xedee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xedee('0xa'));var _=require(_0xedee('0xb'));var squel=require(_0xedee('0xc'));var crypto=require(_0xedee('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xedee('0xe'));var toCsv=require('to-csv');var querystring=require(_0xedee('0xf'));var Papa=require(_0xedee('0x10'));var Redis=require(_0xedee('0x11'));var authService=require(_0xedee('0x12'));var qs=require(_0xedee('0x13'));var as=require(_0xedee('0x14'));var hardwareService=require(_0xedee('0x15'));var logger=require(_0xedee('0x16'))(_0xedee('0x17'));var utils=require(_0xedee('0x18'));var config=require(_0xedee('0x19'));var licenseUtil=require(_0xedee('0x1a'));var db=require(_0xedee('0x1b'))['db'];function respondWithStatusCode(_0x12ff7f,_0x1d5c67){_0x1d5c67=_0x1d5c67||0xcc;return function(_0x4e6029){if(_0x4e6029){return _0x12ff7f[_0xedee('0x1c')](_0x1d5c67);}return _0x12ff7f[_0xedee('0x1d')](_0x1d5c67)[_0xedee('0x1e')]();};}function respondWithResult(_0x202e38,_0x5d8109){_0x5d8109=_0x5d8109||0xc8;return function(_0x26d748){if(_0x26d748){return _0x202e38[_0xedee('0x1d')](_0x5d8109)[_0xedee('0x1f')](_0x26d748);}};}function respondWithFilteredResult(_0x22fa7c,_0x2281b5){return function(_0x32d610){if(_0x32d610){var _0x429696=typeof _0x2281b5[_0xedee('0x20')]===_0xedee('0x21')&&typeof _0x2281b5['limit']==='undefined';var _0xe57f87=_0x32d610[_0xedee('0x22')];var _0x31f6ec=_0x429696?0x0:_0x2281b5['offset'];var _0x4d83e2=_0x429696?_0x32d610[_0xedee('0x22')]:_0x2281b5[_0xedee('0x20')]+_0x2281b5[_0xedee('0x23')];var _0x3899de;if(_0x4d83e2>=_0xe57f87){_0x4d83e2=_0xe57f87;_0x3899de=0xc8;}else{_0x3899de=0xce;}_0x22fa7c[_0xedee('0x1d')](_0x3899de);return _0x22fa7c['set'](_0xedee('0x24'),_0x31f6ec+'-'+_0x4d83e2+'/'+_0xe57f87)[_0xedee('0x1f')](_0x32d610);}return null;};}function patchUpdates(_0x54b741){return function(_0x3b529b){try{jsonpatch[_0xedee('0x25')](_0x3b529b,_0x54b741,!![]);}catch(_0x385d8c){return BPromise[_0xedee('0x26')](_0x385d8c);}return _0x3b529b[_0xedee('0x27')]();};}function saveUpdates(_0x4a72e7,_0x308d20){return function(_0x51e9b6){if(_0x51e9b6){return _0x51e9b6[_0xedee('0x28')](_0x4a72e7)[_0xedee('0x29')](function(_0x17fd3d){return _0x17fd3d;});}return null;};}function removeEntity(_0x4921d9,_0x304e04){return function(_0x3acbd6){if(_0x3acbd6){return _0x3acbd6[_0xedee('0x2a')]()['then'](function(){_0x4921d9[_0xedee('0x1d')](0xcc)[_0xedee('0x1e')]();});}};}function handleEntityNotFound(_0x43d786,_0x416950){return function(_0x1f473e){if(!_0x1f473e){_0x43d786[_0xedee('0x1c')](0x194);}return _0x1f473e;};}function handleError(_0x288efd,_0x173063){_0x173063=_0x173063||0x1f4;return function(_0x2dc06a){logger[_0xedee('0x2b')](_0x2dc06a[_0xedee('0x2c')]);if(_0x2dc06a[_0xedee('0x2d')]){delete _0x2dc06a[_0xedee('0x2d')];}_0x288efd[_0xedee('0x1d')](_0x173063)['send'](_0x2dc06a);};}exports[_0xedee('0x2e')]=function(_0x35d13b,_0x19baaf){var _0x5d13dd={},_0x52bee1={},_0x9d1445={'count':0x0,'rows':[]};var _0x2cc349=_[_0xedee('0x2f')](db[_0xedee('0x30')]['rawAttributes'],function(_0x12a1d2){return{'name':_0x12a1d2[_0xedee('0x31')],'type':_0x12a1d2[_0xedee('0x32')][_0xedee('0x33')]};});_0x52bee1[_0xedee('0x34')]=_['map'](_0x2cc349,_0xedee('0x2d'));_0x52bee1[_0xedee('0x35')]=_['keys'](_0x35d13b['query']);_0x52bee1[_0xedee('0x36')]=_['intersection'](_0x52bee1[_0xedee('0x34')],_0x52bee1['query']);_0x5d13dd[_0xedee('0x37')]=_[_0xedee('0x38')](_0x52bee1['model'],qs['fields'](_0x35d13b[_0xedee('0x35')][_0xedee('0x39')]));_0x5d13dd['attributes']=_0x5d13dd[_0xedee('0x37')]['length']?_0x5d13dd[_0xedee('0x37')]:_0x52bee1[_0xedee('0x34')];if(!_0x35d13b['query'][_0xedee('0x3a')]('nolimit')){_0x5d13dd[_0xedee('0x23')]=qs[_0xedee('0x23')](_0x35d13b[_0xedee('0x35')]['limit']);_0x5d13dd[_0xedee('0x20')]=qs[_0xedee('0x20')](_0x35d13b[_0xedee('0x35')]['offset']);}_0x5d13dd[_0xedee('0x3b')]=qs[_0xedee('0x3c')](_0x35d13b['query']['sort']);_0x5d13dd[_0xedee('0x3d')]=qs[_0xedee('0x36')](_[_0xedee('0x3e')](_0x35d13b[_0xedee('0x35')],_0x52bee1[_0xedee('0x36')]),_0x2cc349);if(_0x35d13b[_0xedee('0x35')][_0xedee('0x3f')]){_0x5d13dd['where']=_['merge'](_0x5d13dd[_0xedee('0x3d')],{'$or':_[_0xedee('0x2f')](_0x2cc349,function(_0x214e4e){if(_0x214e4e[_0xedee('0x32')]!==_0xedee('0x40')){var _0x589229={};_0x589229[_0x214e4e[_0xedee('0x2d')]]={'$like':'%'+_0x35d13b[_0xedee('0x35')][_0xedee('0x3f')]+'%'};return _0x589229;}})});}_0x5d13dd=_[_0xedee('0x41')]({},_0x5d13dd,_0x35d13b[_0xedee('0x42')]);var _0x1e553e={'where':_0x5d13dd[_0xedee('0x3d')]};return db[_0xedee('0x30')][_0xedee('0x22')](_0x1e553e)[_0xedee('0x29')](function(_0x366dfb){_0x9d1445[_0xedee('0x22')]=_0x366dfb;if(_0x35d13b[_0xedee('0x35')][_0xedee('0x43')]){_0x5d13dd['include']=[{'all':!![]}];}return db['SquareRecording'][_0xedee('0x44')](_0x5d13dd);})[_0xedee('0x29')](function(_0x13353c){_0x9d1445[_0xedee('0x45')]=_0x13353c;return _0x9d1445;})['then'](respondWithFilteredResult(_0x19baaf,_0x5d13dd))[_0xedee('0x46')](handleError(_0x19baaf,null));};exports[_0xedee('0x47')]=function(_0x34c3b5,_0x1a4198){var _0x4ac2ad={'raw':!![],'where':{'id':_0x34c3b5[_0xedee('0x48')]['id']}},_0x96f766={};_0x96f766[_0xedee('0x34')]=_['keys'](db[_0xedee('0x30')][_0xedee('0x49')]);_0x96f766[_0xedee('0x35')]=_['keys'](_0x34c3b5[_0xedee('0x35')]);_0x96f766['filters']=_['intersection'](_0x96f766['model'],_0x96f766[_0xedee('0x35')]);_0x4ac2ad[_0xedee('0x37')]=_[_0xedee('0x38')](_0x96f766['model'],qs[_0xedee('0x39')](_0x34c3b5[_0xedee('0x35')][_0xedee('0x39')]));_0x4ac2ad[_0xedee('0x37')]=_0x4ac2ad[_0xedee('0x37')][_0xedee('0x4a')]?_0x4ac2ad[_0xedee('0x37')]:_0x96f766['model'];if(_0x34c3b5[_0xedee('0x35')][_0xedee('0x43')]){_0x4ac2ad[_0xedee('0x4b')]=[{'all':!![]}];}_0x4ac2ad=_['merge']({},_0x4ac2ad,_0x34c3b5['options']);return db[_0xedee('0x30')]['find'](_0x4ac2ad)['then'](handleEntityNotFound(_0x1a4198,null))[_0xedee('0x29')](respondWithResult(_0x1a4198,null))[_0xedee('0x46')](handleError(_0x1a4198,null));};exports[_0xedee('0x4c')]=function(_0x42023f,_0x3b1921){return db[_0xedee('0x30')][_0xedee('0x4c')](_0x42023f[_0xedee('0x4d')],{})[_0xedee('0x29')](respondWithResult(_0x3b1921,0xc9))[_0xedee('0x46')](handleError(_0x3b1921,null));};exports['update']=function(_0x3580c3,_0x3d8c64){if(_0x3580c3[_0xedee('0x4d')]['id']){delete _0x3580c3[_0xedee('0x4d')]['id'];}return db[_0xedee('0x30')][_0xedee('0x4e')]({'where':{'id':_0x3580c3[_0xedee('0x48')]['id']}})[_0xedee('0x29')](handleEntityNotFound(_0x3d8c64,null))[_0xedee('0x29')](saveUpdates(_0x3580c3[_0xedee('0x4d')],null))[_0xedee('0x29')](respondWithResult(_0x3d8c64,null))[_0xedee('0x46')](handleError(_0x3d8c64,null));};exports[_0xedee('0x4f')]=function(_0x23bcc2,_0xd5b9b0,_0x2c2d1e){var _0x39ea45=require('../../components/encryptor');var _0x17ff6a=![];var _0x31519b={};if(_0x23bcc2[_0xedee('0x35')]['type']&&_0x23bcc2['query'][_0xedee('0x32')]===_0xedee('0x50')){_0x31519b[_0xedee('0x50')]=_0x23bcc2[_0xedee('0x48')]['id'];}else{_0x31519b['id']=_0x23bcc2[_0xedee('0x48')]['id'];}return db[_0xedee('0x30')][_0xedee('0x4e')]({'where':_0x31519b,'attributes':['id','savePath',_0xedee('0x51')],'raw':!![]})[_0xedee('0x29')](handleEntityNotFound(_0xd5b9b0,null))[_0xedee('0x29')](function(_0x3cc72a){if(_0x3cc72a){var _0x1cdb0f=_0x3cc72a[_0xedee('0x52')];var _0x1cdf34=util[_0xedee('0x53')](_0xedee('0x54'),_0x1cdb0f);if(fs[_0xedee('0x55')](_0x1cdf34)){_0x17ff6a=!![];return _0x39ea45[_0xedee('0x56')](_0x1cdf34,_0x1cdb0f,config['secrets'][_0xedee('0x57')])[_0xedee('0x29')](function(){return _0x3cc72a;});}return _0x3cc72a;}})[_0xedee('0x29')](function(_0x1f0863){if(_0x1f0863){var _0xbb2637=_0x1f0863[_0xedee('0x52')];if(!fs['existsSync'](_0xbb2637)){throw new db[(_0xedee('0x58'))]['ValidationError'](_0xedee('0x59'));}if(_0x1f0863[_0xedee('0x51')]){return _0xd5b9b0[_0xedee('0x4f')](_0xbb2637,_0x1f0863[_0xedee('0x51')]+path[_0xedee('0x5a')](_0xbb2637),function(){if(_0x17ff6a){fs['unlink'](_0xbb2637);}});}else{return _0xd5b9b0[_0xedee('0x4f')](_0xbb2637,function(_0x4d537a){if(_0x17ff6a){fs[_0xedee('0x5b')](_0xbb2637);}});}}})[_0xedee('0x46')](function(_0x5b600f){if(_0x5b600f['message']==='SquareRecording\x20not\x20found'){_0xd5b9b0['status'](0x194)[_0xedee('0x5c')](_0xedee('0x5d'));}else{return handleError(_0xd5b9b0,null);}});};exports['destroy']=function(_0x15c08f,_0x3c92a9){return db[_0xedee('0x30')][_0xedee('0x4e')]({'where':{'id':_0x15c08f[_0xedee('0x48')]['id']}})[_0xedee('0x29')](function(_0x20b5b2){if(_[_0xedee('0x5e')](_0x20b5b2)){throw new ReferenceError(_0xedee('0x5f'));}return _0x20b5b2;})['then'](function(_0x5e0503){var _0x210847=_0x5e0503['savePath'];logger[_0xedee('0x60')](_0xedee('0x61'),_0x210847);if(!_[_0xedee('0x5e')](_0x5e0503['savePath'])&&fs[_0xedee('0x55')](_0x210847)){logger[_0xedee('0x60')](_0xedee('0x62')+_0x210847+_0xedee('0x63'));fs[_0xedee('0x64')](_0x210847);}_0x210847=_0x210847+_0xedee('0x65');if(!_[_0xedee('0x5e')](_0x5e0503[_0xedee('0x52')])&&fs[_0xedee('0x55')](_0x210847)){logger[_0xedee('0x60')](_0xedee('0x62')+_0x210847+_0xedee('0x63'));fs[_0xedee('0x64')](_0x210847);}return _0x5e0503;})[_0xedee('0x29')](function(_0x1ba64d){if(!_0x1ba64d)throw new InternalError();return _0x1ba64d[_0xedee('0x2a')]();})[_0xedee('0x29')](function(){_0x3c92a9[_0xedee('0x1d')](0xcc)[_0xedee('0x1e')]();})[_0xedee('0x46')](handleError(_0x3c92a9,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 39484c8..ab93807 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 _0x4329=['./squareRecording.attributes','exports','SquareRecording','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x55f47b,_0x58b84b){var _0x163c2e=function(_0x1662b6){while(--_0x1662b6){_0x55f47b['push'](_0x55f47b['shift']());}};_0x163c2e(++_0x58b84b);}(_0x4329,0x13b));var _0x9432=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4329[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x9432('0x0'));var util=require(_0x9432('0x1'));var logger=require(_0x9432('0x2'))(_0x9432('0x3'));var moment=require(_0x9432('0x4'));var BPromise=require(_0x9432('0x5'));var rp=require(_0x9432('0x6'));var fs=require('fs');var path=require(_0x9432('0x7'));var rimraf=require(_0x9432('0x8'));var config=require(_0x9432('0x9'));var attributes=require(_0x9432('0xa'));module[_0x9432('0xb')]=function(_0x1ca7e0,_0x27edef){return _0x1ca7e0['define'](_0x9432('0xc'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeda7=['square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x2fce02,_0x587df7){var _0x566ef1=function(_0xdb61a3){while(--_0xdb61a3){_0x2fce02['push'](_0x2fce02['shift']());}};_0x566ef1(++_0x587df7);}(_0xeda7,0x196));var _0x7eda=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xeda7[_0x5c3ae9];return _0x3f5950;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var logger=require(_0x7eda('0x2'))(_0x7eda('0x3'));var moment=require(_0x7eda('0x4'));var BPromise=require(_0x7eda('0x5'));var rp=require(_0x7eda('0x6'));var fs=require('fs');var path=require(_0x7eda('0x7'));var rimraf=require(_0x7eda('0x8'));var config=require(_0x7eda('0x9'));var attributes=require(_0x7eda('0xa'));module[_0x7eda('0xb')]=function(_0x6ee7be,_0x328430){return _0x6ee7be[_0x7eda('0xc')](_0x7eda('0xd'),attributes,{'tableName':_0x7eda('0xe'),'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 06b3dd0..72b196c 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 _0xfb59=['debug','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x2d0953,_0x30bcf9){var _0x1e824a=function(_0x4ec9f1){while(--_0x4ec9f1){_0x2d0953['push'](_0x2d0953['shift']());}};_0x1e824a(++_0x30bcf9);}(_0xfb59,0x7e));var _0x9fb5=function(_0x30d2e4,_0x82891e){_0x30d2e4=_0x30d2e4-0x0;var _0x4ea9a1=_0xfb59[_0x30d2e4];return _0x4ea9a1;};'use strict';var _=require(_0x9fb5('0x0'));var util=require(_0x9fb5('0x1'));var moment=require('moment');var BPromise=require(_0x9fb5('0x2'));var rs=require(_0x9fb5('0x3'));var fs=require('fs');var Redis=require(_0x9fb5('0x4'));var db=require(_0x9fb5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fb5('0x6'))(_0x9fb5('0x7'));var config=require(_0x9fb5('0x8'));var jayson=require(_0x9fb5('0x9'));var client=jayson['client'][_0x9fb5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bfded,_0x418bf6,_0x47856d){return new BPromise(function(_0x470a76,_0x4221e4){return client['request'](_0x3bfded,_0x47856d)[_0x9fb5('0xb')](function(_0x39f1c7){logger[_0x9fb5('0xc')]('SquareRecording,\x20%s,\x20%s',_0x418bf6,_0x9fb5('0xd'));logger[_0x9fb5('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x418bf6,'request\x20sent',JSON[_0x9fb5('0xf')](_0x39f1c7));if(_0x39f1c7['error']){if(_0x39f1c7[_0x9fb5('0x10')][_0x9fb5('0x11')]===0x1f4){logger[_0x9fb5('0x10')](_0x9fb5('0x12'),_0x418bf6,_0x39f1c7[_0x9fb5('0x10')][_0x9fb5('0x13')]);return _0x4221e4(_0x39f1c7['error'][_0x9fb5('0x13')]);}logger[_0x9fb5('0x10')]('SquareRecording,\x20%s,\x20%s',_0x418bf6,_0x39f1c7[_0x9fb5('0x10')][_0x9fb5('0x13')]);return _0x470a76(_0x39f1c7[_0x9fb5('0x10')]['message']);}else{logger['info'](_0x9fb5('0x12'),_0x418bf6,_0x9fb5('0xd'));_0x470a76(_0x39f1c7[_0x9fb5('0x14')][_0x9fb5('0x13')]);}})[_0x9fb5('0x15')](function(_0xcdf0ea){logger[_0x9fb5('0x10')]('SquareRecording,\x20%s,\x20%s',_0x418bf6,_0xcdf0ea);_0x4221e4(_0xcdf0ea);});});}exports[_0x9fb5('0x16')]=function(_0x44e491){var _0x15d45c=this;return new Promise(function(_0xeedd,_0xf0c102){return db[_0x9fb5('0x17')][_0x9fb5('0x18')](_0x44e491[_0x9fb5('0x19')],{'raw':_0x44e491[_0x9fb5('0x1a')]?_0x44e491[_0x9fb5('0x1a')][_0x9fb5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x381dff){logger[_0x9fb5('0xc')](_0x9fb5('0x16'),_0x44e491);logger[_0x9fb5('0xe')](_0x9fb5('0x16'),_0x44e491,JSON[_0x9fb5('0xf')](_0x381dff));_0xeedd(_0x381dff);})[_0x9fb5('0x15')](function(_0x1d026b){logger[_0x9fb5('0x10')](_0x9fb5('0x16'),_0x1d026b[_0x9fb5('0x13')],_0x44e491);_0xf0c102(_0x15d45c['error'](0x1f4,_0x1d026b[_0x9fb5('0x13')]));});});}; \ No newline at end of file +var _0x0566=['error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x0566,0xc9));var _0x6056=function(_0x338a58,_0x2d5ac5){_0x338a58=_0x338a58-0x0;var _0x92bd1d=_0x0566[_0x338a58];return _0x92bd1d;};'use strict';var _=require(_0x6056('0x0'));var util=require('util');var moment=require(_0x6056('0x1'));var BPromise=require(_0x6056('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6056('0x3'))['db'];var utils=require(_0x6056('0x4'));var logger=require(_0x6056('0x5'))(_0x6056('0x6'));var config=require(_0x6056('0x7'));var jayson=require(_0x6056('0x8'));var client=jayson[_0x6056('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10ffbf,_0x49b14c,_0xa11b5f){return new BPromise(function(_0x51f396,_0x2c315a){return client['request'](_0x10ffbf,_0xa11b5f)[_0x6056('0xa')](function(_0x223664){logger[_0x6056('0xb')]('SquareRecording,\x20%s,\x20%s',_0x49b14c,_0x6056('0xc'));logger['debug'](_0x6056('0xd'),_0x49b14c,_0x6056('0xc'),JSON[_0x6056('0xe')](_0x223664));if(_0x223664[_0x6056('0xf')]){if(_0x223664[_0x6056('0xf')][_0x6056('0x10')]===0x1f4){logger[_0x6056('0xf')](_0x6056('0x11'),_0x49b14c,_0x223664[_0x6056('0xf')]['message']);return _0x2c315a(_0x223664[_0x6056('0xf')][_0x6056('0x12')]);}logger[_0x6056('0xf')](_0x6056('0x11'),_0x49b14c,_0x223664[_0x6056('0xf')][_0x6056('0x12')]);return _0x51f396(_0x223664[_0x6056('0xf')][_0x6056('0x12')]);}else{logger[_0x6056('0xb')](_0x6056('0x11'),_0x49b14c,_0x6056('0xc'));_0x51f396(_0x223664['result'][_0x6056('0x12')]);}})[_0x6056('0x13')](function(_0x50ea9d){logger[_0x6056('0xf')](_0x6056('0x11'),_0x49b14c,_0x50ea9d);_0x2c315a(_0x50ea9d);});});}exports[_0x6056('0x14')]=function(_0x25c8de){var _0x3a71cf=this;return new Promise(function(_0x1ac744,_0x55a5dc){return db[_0x6056('0x15')][_0x6056('0x16')](_0x25c8de[_0x6056('0x17')],{'raw':_0x25c8de['options']?_0x25c8de[_0x6056('0x18')][_0x6056('0x19')]===undefined?!![]:![]:!![]})[_0x6056('0xa')](function(_0x189d4f){logger[_0x6056('0xb')](_0x6056('0x14'),_0x25c8de);logger[_0x6056('0x1a')](_0x6056('0x14'),_0x25c8de,JSON['stringify'](_0x189d4f));_0x1ac744(_0x189d4f);})[_0x6056('0x13')](function(_0x4aa32b){logger[_0x6056('0xf')](_0x6056('0x14'),_0x4aa32b['message'],_0x25c8de);_0x55a5dc(_0x3a71cf[_0x6056('0xf')](0x1f4,_0x4aa32b[_0x6056('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index a06ac03..0294e3f 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 _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(_0x746739,_0x289561){var _0x4b7447=function(_0x3435f2){while(--_0x3435f2){_0x746739['push'](_0x746739['shift']());}};_0x4b7447(++_0x289561);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5b1053,_0x14c6e3){var _0xec3b3c=function(_0x333c79){while(--_0x333c79){_0x5b1053['push'](_0x5b1053['shift']());}};_0xec3b3c(++_0x14c6e3);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 8268aad..b406f0c 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 _0xaf7e=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x1a51bc,_0x1ba514){var _0x253a7f=function(_0x6b7778){while(--_0x6b7778){_0x1a51bc['push'](_0x1a51bc['shift']());}};_0x253a7f(++_0x1ba514);}(_0xaf7e,0x13f));var _0xeaf7=function(_0x4a7bf2,_0x4a0f46){_0x4a7bf2=_0x4a7bf2-0x0;var _0x2fc60f=_0xaf7e[_0x4a7bf2];return _0x2fc60f;};'use strict';var Sequelize=require(_0xeaf7('0x0'));module['exports']={'network':{'type':Sequelize[_0xeaf7('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xeaf7('0x1')]},'channel':{'type':Sequelize[_0xeaf7('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xeaf7('0x1')]},'uniqueid':{'type':Sequelize[_0xeaf7('0x1')]},'version':{'type':Sequelize[_0xeaf7('0x1')]},'callerid':{'type':Sequelize[_0xeaf7('0x1')]},'calleridname':{'type':Sequelize[_0xeaf7('0x1')]},'callingpres':{'type':Sequelize[_0xeaf7('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xeaf7('0x1')]},'callingtns':{'type':Sequelize[_0xeaf7('0x1')]},'dnid':{'type':Sequelize[_0xeaf7('0x1')]},'rdnis':{'type':Sequelize[_0xeaf7('0x1')]},'context':{'type':Sequelize[_0xeaf7('0x1')]},'extension':{'type':Sequelize[_0xeaf7('0x1')]},'priority':{'type':Sequelize[_0xeaf7('0x1')]},'enhanced':{'type':Sequelize[_0xeaf7('0x1')]},'accountcode':{'type':Sequelize[_0xeaf7('0x1')]},'threadid':{'type':Sequelize[_0xeaf7('0x1')]},'project_name':{'type':Sequelize[_0xeaf7('0x1')]},'joinAt':{'type':Sequelize[_0xeaf7('0x2')]},'leaveAt':{'type':Sequelize[_0xeaf7('0x2')]},'bot':{'type':Sequelize[_0xeaf7('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2402=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2402,0xd9));var _0x2240=function(_0x58c35b,_0x5ea2a1){_0x58c35b=_0x58c35b-0x0;var _0x11f572=_0x2402[_0x58c35b];return _0x11f572;};'use strict';var Sequelize=require(_0x2240('0x0'));module['exports']={'network':{'type':Sequelize[_0x2240('0x1')]},'network_script':{'type':Sequelize[_0x2240('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2240('0x1')]},'type':{'type':Sequelize[_0x2240('0x1')]},'uniqueid':{'type':Sequelize[_0x2240('0x1')]},'version':{'type':Sequelize[_0x2240('0x1')]},'callerid':{'type':Sequelize[_0x2240('0x1')]},'calleridname':{'type':Sequelize[_0x2240('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x2240('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x2240('0x1')]},'dnid':{'type':Sequelize[_0x2240('0x1')]},'rdnis':{'type':Sequelize[_0x2240('0x1')]},'context':{'type':Sequelize[_0x2240('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2240('0x1')]},'enhanced':{'type':Sequelize[_0x2240('0x1')]},'accountcode':{'type':Sequelize[_0x2240('0x1')]},'threadid':{'type':Sequelize[_0x2240('0x1')]},'project_name':{'type':Sequelize[_0x2240('0x1')]},'joinAt':{'type':Sequelize[_0x2240('0x2')]},'leaveAt':{'type':Sequelize[_0x2240('0x2')]},'bot':{'type':Sequelize[_0x2240('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 9be6177..9099082 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 _0xdfbe=['body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','apply','reject','destroy','then','sendStatus','error','stack','name','send','map','SquareReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','options','create'];(function(_0x11d635,_0x3c8e31){var _0x100e98=function(_0xb83582){while(--_0xb83582){_0x11d635['push'](_0x11d635['shift']());}};_0x100e98(++_0x3c8e31);}(_0xdfbe,0x176));var _0xedfb=function(_0x149bac,_0x4970ec){_0x149bac=_0x149bac-0x0;var _0x2a6412=_0xdfbe[_0x149bac];return _0x2a6412;};'use strict';var emlformat=require(_0xedfb('0x0'));var rimraf=require(_0xedfb('0x1'));var zipdir=require(_0xedfb('0x2'));var jsonpatch=require(_0xedfb('0x3'));var rp=require(_0xedfb('0x4'));var moment=require(_0xedfb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xedfb('0x6'));var util=require(_0xedfb('0x7'));var path=require('path');var sox=require(_0xedfb('0x8'));var csv=require('to-csv');var ejs=require(_0xedfb('0x9'));var fs=require('fs');var fs_extra=require(_0xedfb('0xa'));var _=require(_0xedfb('0xb'));var squel=require(_0xedfb('0xc'));var crypto=require(_0xedfb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xedfb('0xe'));var Papa=require('papaparse');var Redis=require(_0xedfb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xedfb('0x10'));var as=require(_0xedfb('0x11'));var hardwareService=require(_0xedfb('0x12'));var logger=require(_0xedfb('0x13'))(_0xedfb('0x14'));var utils=require(_0xedfb('0x15'));var config=require(_0xedfb('0x16'));var licenseUtil=require(_0xedfb('0x17'));var db=require(_0xedfb('0x18'))['db'];function respondWithStatusCode(_0x11bca7,_0x29cb33){_0x29cb33=_0x29cb33||0xcc;return function(_0x8a67f4){if(_0x8a67f4){return _0x11bca7['sendStatus'](_0x29cb33);}return _0x11bca7['status'](_0x29cb33)[_0xedfb('0x19')]();};}function respondWithResult(_0x193d70,_0x1cd01d){_0x1cd01d=_0x1cd01d||0xc8;return function(_0x554a1a){if(_0x554a1a){return _0x193d70[_0xedfb('0x1a')](_0x1cd01d)[_0xedfb('0x1b')](_0x554a1a);}};}function respondWithFilteredResult(_0x584fe6,_0x5f2d82){return function(_0x256301){if(_0x256301){var _0x3a2a56=typeof _0x5f2d82[_0xedfb('0x1c')]==='undefined'&&typeof _0x5f2d82[_0xedfb('0x1d')]==='undefined';var _0x4b62b6=_0x256301[_0xedfb('0x1e')];var _0x1985f6=_0x3a2a56?0x0:_0x5f2d82[_0xedfb('0x1c')];var _0x192d63=_0x3a2a56?_0x256301[_0xedfb('0x1e')]:_0x5f2d82['offset']+_0x5f2d82[_0xedfb('0x1d')];var _0x44a204;if(_0x192d63>=_0x4b62b6){_0x192d63=_0x4b62b6;_0x44a204=0xc8;}else{_0x44a204=0xce;}_0x584fe6['status'](_0x44a204);return _0x584fe6[_0xedfb('0x1f')]('Content-Range',_0x1985f6+'-'+_0x192d63+'/'+_0x4b62b6)[_0xedfb('0x1b')](_0x256301);}return null;};}function patchUpdates(_0xdd0da2){return function(_0x17768f){try{jsonpatch[_0xedfb('0x20')](_0x17768f,_0xdd0da2,!![]);}catch(_0x23d36c){return BPromise[_0xedfb('0x21')](_0x23d36c);}return _0x17768f['save']();};}function saveUpdates(_0x474fb1,_0x5782d6){return function(_0x12d0af){if(_0x12d0af){return _0x12d0af['update'](_0x474fb1)['then'](function(_0x171c3e){return _0x171c3e;});}return null;};}function removeEntity(_0x4a425b,_0xf9d004){return function(_0x5e4d04){if(_0x5e4d04){return _0x5e4d04[_0xedfb('0x22')]()[_0xedfb('0x23')](function(){_0x4a425b[_0xedfb('0x1a')](0xcc)[_0xedfb('0x19')]();});}};}function handleEntityNotFound(_0x1f5aa1,_0xf51381){return function(_0x8c2dbc){if(!_0x8c2dbc){_0x1f5aa1[_0xedfb('0x24')](0x194);}return _0x8c2dbc;};}function handleError(_0x11ddb1,_0x3c245f){_0x3c245f=_0x3c245f||0x1f4;return function(_0x79f03e){logger[_0xedfb('0x25')](_0x79f03e[_0xedfb('0x26')]);if(_0x79f03e[_0xedfb('0x27')]){delete _0x79f03e[_0xedfb('0x27')];}_0x11ddb1[_0xedfb('0x1a')](_0x3c245f)[_0xedfb('0x28')](_0x79f03e);};}exports['index']=function(_0x3e97a7,_0x36e6fe){var _0x4b8352={},_0x472f07={},_0x402595={'count':0x0,'rows':[]};var _0x35b3b=_[_0xedfb('0x29')](db[_0xedfb('0x2a')][_0xedfb('0x2b')],function(_0x19f7d9){return{'name':_0x19f7d9[_0xedfb('0x2c')],'type':_0x19f7d9['type'][_0xedfb('0x2d')]};});_0x472f07['model']=_['map'](_0x35b3b,'name');_0x472f07[_0xedfb('0x2e')]=_[_0xedfb('0x2f')](_0x3e97a7['query']);_0x472f07[_0xedfb('0x30')]=_[_0xedfb('0x31')](_0x472f07['model'],_0x472f07[_0xedfb('0x2e')]);_0x4b8352[_0xedfb('0x32')]=_[_0xedfb('0x31')](_0x472f07[_0xedfb('0x33')],qs[_0xedfb('0x34')](_0x3e97a7[_0xedfb('0x2e')][_0xedfb('0x34')]));_0x4b8352[_0xedfb('0x32')]=_0x4b8352['attributes'][_0xedfb('0x35')]?_0x4b8352['attributes']:_0x472f07['model'];if(!_0x3e97a7[_0xedfb('0x2e')][_0xedfb('0x36')](_0xedfb('0x37'))){_0x4b8352[_0xedfb('0x1d')]=qs[_0xedfb('0x1d')](_0x3e97a7[_0xedfb('0x2e')]['limit']);_0x4b8352[_0xedfb('0x1c')]=qs[_0xedfb('0x1c')](_0x3e97a7['query'][_0xedfb('0x1c')]);}_0x4b8352['order']=qs['sort'](_0x3e97a7['query'][_0xedfb('0x38')]);_0x4b8352['where']=qs[_0xedfb('0x30')](_['pick'](_0x3e97a7[_0xedfb('0x2e')],_0x472f07[_0xedfb('0x30')]),_0x35b3b);if(_0x3e97a7[_0xedfb('0x2e')][_0xedfb('0x39')]){_0x4b8352[_0xedfb('0x3a')]=_[_0xedfb('0x3b')](_0x4b8352[_0xedfb('0x3a')],{'$or':_[_0xedfb('0x29')](_0x35b3b,function(_0xd24c10){if(_0xd24c10[_0xedfb('0x3c')]!==_0xedfb('0x3d')){var _0x3a93dd={};_0x3a93dd[_0xd24c10['name']]={'$like':'%'+_0x3e97a7[_0xedfb('0x2e')]['filter']+'%'};return _0x3a93dd;}})});}_0x4b8352=_['merge']({},_0x4b8352,_0x3e97a7['options']);var _0x4f2ebe={'where':_0x4b8352[_0xedfb('0x3a')]};return db[_0xedfb('0x2a')][_0xedfb('0x1e')](_0x4f2ebe)[_0xedfb('0x23')](function(_0x15df71){_0x402595[_0xedfb('0x1e')]=_0x15df71;if(_0x3e97a7[_0xedfb('0x2e')][_0xedfb('0x3e')]){_0x4b8352[_0xedfb('0x3f')]=[{'all':!![]}];}return db[_0xedfb('0x2a')]['findAll'](_0x4b8352);})[_0xedfb('0x23')](function(_0x4039f2){_0x402595[_0xedfb('0x40')]=_0x4039f2;return _0x402595;})[_0xedfb('0x23')](respondWithFilteredResult(_0x36e6fe,_0x4b8352))[_0xedfb('0x41')](handleError(_0x36e6fe,null));};exports[_0xedfb('0x42')]=function(_0x32c368,_0x3fa24c){var _0x176896={'raw':!![],'where':{'id':_0x32c368[_0xedfb('0x43')]['id']}},_0x58723d={};_0x58723d[_0xedfb('0x33')]=_[_0xedfb('0x2f')](db[_0xedfb('0x2a')][_0xedfb('0x2b')]);_0x58723d[_0xedfb('0x2e')]=_[_0xedfb('0x2f')](_0x32c368[_0xedfb('0x2e')]);_0x58723d[_0xedfb('0x30')]=_[_0xedfb('0x31')](_0x58723d[_0xedfb('0x33')],_0x58723d[_0xedfb('0x2e')]);_0x176896[_0xedfb('0x32')]=_[_0xedfb('0x31')](_0x58723d[_0xedfb('0x33')],qs['fields'](_0x32c368[_0xedfb('0x2e')][_0xedfb('0x34')]));_0x176896[_0xedfb('0x32')]=_0x176896['attributes'][_0xedfb('0x35')]?_0x176896[_0xedfb('0x32')]:_0x58723d[_0xedfb('0x33')];if(_0x32c368[_0xedfb('0x2e')][_0xedfb('0x3e')]){_0x176896[_0xedfb('0x3f')]=[{'all':!![]}];}_0x176896=_[_0xedfb('0x3b')]({},_0x176896,_0x32c368[_0xedfb('0x44')]);return db[_0xedfb('0x2a')]['find'](_0x176896)[_0xedfb('0x23')](handleEntityNotFound(_0x3fa24c,null))[_0xedfb('0x23')](respondWithResult(_0x3fa24c,null))['catch'](handleError(_0x3fa24c,null));};exports[_0xedfb('0x45')]=function(_0x37b9a8,_0x5813a0){return db['SquareReport'][_0xedfb('0x45')](_0x37b9a8[_0xedfb('0x46')],{})[_0xedfb('0x23')](respondWithResult(_0x5813a0,0xc9))[_0xedfb('0x41')](handleError(_0x5813a0,null));};exports[_0xedfb('0x47')]=function(_0x2287e2,_0x5481a5){if(_0x2287e2[_0xedfb('0x46')]['id']){delete _0x2287e2[_0xedfb('0x46')]['id'];}return db['SquareReport'][_0xedfb('0x48')]({'where':{'id':_0x2287e2[_0xedfb('0x43')]['id']}})[_0xedfb('0x23')](handleEntityNotFound(_0x5481a5,null))[_0xedfb('0x23')](saveUpdates(_0x2287e2['body'],null))[_0xedfb('0x23')](respondWithResult(_0x5481a5,null))['catch'](handleError(_0x5481a5,null));};exports[_0xedfb('0x22')]=function(_0x5da872,_0x5daa8f){return db[_0xedfb('0x2a')][_0xedfb('0x48')]({'where':{'id':_0x5da872['params']['id']}})[_0xedfb('0x23')](handleEntityNotFound(_0x5daa8f,null))['then'](removeEntity(_0x5daa8f,null))[_0xedfb('0x41')](handleError(_0x5daa8f,null));};exports[_0xedfb('0x49')]=function(_0x45c558,_0x354579){return db[_0xedfb('0x2a')][_0xedfb('0x49')]()[_0xedfb('0x23')](respondWithResult(_0x354579,null))['catch'](handleError(_0x354579,null));}; \ No newline at end of file +var _0x4070=['bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','apply','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','keys','intersection','model','attributes','fields','query','hasOwnProperty','nolimit','offset','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','length','options','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x17d328,_0x28b1c4){var _0x54c5d7=function(_0x5b3d98){while(--_0x5b3d98){_0x17d328['push'](_0x17d328['shift']());}};_0x54c5d7(++_0x28b1c4);}(_0x4070,0x1a6));var _0x0407=function(_0x350796,_0x1bf21f){_0x350796=_0x350796-0x0;var _0x126f19=_0x4070[_0x350796];return _0x126f19;};'use strict';var emlformat=require(_0x0407('0x0'));var rimraf=require(_0x0407('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0407('0x2'));var rp=require(_0x0407('0x3'));var moment=require('moment');var BPromise=require(_0x0407('0x4'));var Mustache=require('mustache');var util=require(_0x0407('0x5'));var path=require(_0x0407('0x6'));var sox=require(_0x0407('0x7'));var csv=require('to-csv');var ejs=require(_0x0407('0x8'));var fs=require('fs');var fs_extra=require(_0x0407('0x9'));var _=require('lodash');var squel=require(_0x0407('0xa'));var crypto=require(_0x0407('0xb'));var jsforce=require(_0x0407('0xc'));var deskjs=require(_0x0407('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0407('0xe'));var Papa=require(_0x0407('0xf'));var Redis=require(_0x0407('0x10'));var authService=require(_0x0407('0x11'));var qs=require(_0x0407('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0407('0x13'));var utils=require(_0x0407('0x14'));var config=require(_0x0407('0x15'));var licenseUtil=require(_0x0407('0x16'));var db=require(_0x0407('0x17'))['db'];function respondWithStatusCode(_0x16aa5b,_0x38398f){_0x38398f=_0x38398f||0xcc;return function(_0x4d32de){if(_0x4d32de){return _0x16aa5b['sendStatus'](_0x38398f);}return _0x16aa5b[_0x0407('0x18')](_0x38398f)[_0x0407('0x19')]();};}function respondWithResult(_0x53a9ca,_0x2818c3){_0x2818c3=_0x2818c3||0xc8;return function(_0xd83370){if(_0xd83370){return _0x53a9ca[_0x0407('0x18')](_0x2818c3)[_0x0407('0x1a')](_0xd83370);}};}function respondWithFilteredResult(_0x57ab1a,_0x3c3425){return function(_0x334d01){if(_0x334d01){var _0x2f372a=typeof _0x3c3425['offset']==='undefined'&&typeof _0x3c3425[_0x0407('0x1b')]==='undefined';var _0x485988=_0x334d01[_0x0407('0x1c')];var _0x20f6f5=_0x2f372a?0x0:_0x3c3425['offset'];var _0x31ceee=_0x2f372a?_0x334d01['count']:_0x3c3425['offset']+_0x3c3425[_0x0407('0x1b')];var _0x43b22e;if(_0x31ceee>=_0x485988){_0x31ceee=_0x485988;_0x43b22e=0xc8;}else{_0x43b22e=0xce;}_0x57ab1a[_0x0407('0x18')](_0x43b22e);return _0x57ab1a['set']('Content-Range',_0x20f6f5+'-'+_0x31ceee+'/'+_0x485988)[_0x0407('0x1a')](_0x334d01);}return null;};}function patchUpdates(_0x236e34){return function(_0x4d589c){try{jsonpatch[_0x0407('0x1d')](_0x4d589c,_0x236e34,!![]);}catch(_0x562e26){return BPromise['reject'](_0x562e26);}return _0x4d589c['save']();};}function saveUpdates(_0xac5358,_0x22e5af){return function(_0x554ace){if(_0x554ace){return _0x554ace[_0x0407('0x1e')](_0xac5358)[_0x0407('0x1f')](function(_0x235202){return _0x235202;});}return null;};}function removeEntity(_0x20d55a,_0x3fa912){return function(_0x3a5486){if(_0x3a5486){return _0x3a5486['destroy']()[_0x0407('0x1f')](function(){_0x20d55a[_0x0407('0x18')](0xcc)[_0x0407('0x19')]();});}};}function handleEntityNotFound(_0x21efeb,_0x53a6e0){return function(_0x5ce396){if(!_0x5ce396){_0x21efeb['sendStatus'](0x194);}return _0x5ce396;};}function handleError(_0xfd1f76,_0x339234){_0x339234=_0x339234||0x1f4;return function(_0x498a09){logger[_0x0407('0x20')](_0x498a09[_0x0407('0x21')]);if(_0x498a09['name']){delete _0x498a09[_0x0407('0x22')];}_0xfd1f76[_0x0407('0x18')](_0x339234)[_0x0407('0x23')](_0x498a09);};}exports[_0x0407('0x24')]=function(_0x5c82de,_0x4384cf){var _0x4e4a73={},_0x16850a={},_0x4848cc={'count':0x0,'rows':[]};var _0x379a02=_[_0x0407('0x25')](db[_0x0407('0x26')][_0x0407('0x27')],function(_0x5d4f0b){return{'name':_0x5d4f0b[_0x0407('0x28')],'type':_0x5d4f0b[_0x0407('0x29')][_0x0407('0x2a')]};});_0x16850a['model']=_[_0x0407('0x25')](_0x379a02,_0x0407('0x22'));_0x16850a['query']=_[_0x0407('0x2b')](_0x5c82de['query']);_0x16850a['filters']=_[_0x0407('0x2c')](_0x16850a[_0x0407('0x2d')],_0x16850a['query']);_0x4e4a73[_0x0407('0x2e')]=_[_0x0407('0x2c')](_0x16850a[_0x0407('0x2d')],qs[_0x0407('0x2f')](_0x5c82de[_0x0407('0x30')]['fields']));_0x4e4a73[_0x0407('0x2e')]=_0x4e4a73[_0x0407('0x2e')]['length']?_0x4e4a73[_0x0407('0x2e')]:_0x16850a[_0x0407('0x2d')];if(!_0x5c82de['query'][_0x0407('0x31')](_0x0407('0x32'))){_0x4e4a73[_0x0407('0x1b')]=qs['limit'](_0x5c82de[_0x0407('0x30')][_0x0407('0x1b')]);_0x4e4a73['offset']=qs[_0x0407('0x33')](_0x5c82de[_0x0407('0x30')][_0x0407('0x33')]);}_0x4e4a73['order']=qs[_0x0407('0x34')](_0x5c82de[_0x0407('0x30')][_0x0407('0x34')]);_0x4e4a73[_0x0407('0x35')]=qs['filters'](_[_0x0407('0x36')](_0x5c82de[_0x0407('0x30')],_0x16850a[_0x0407('0x37')]),_0x379a02);if(_0x5c82de[_0x0407('0x30')][_0x0407('0x38')]){_0x4e4a73['where']=_[_0x0407('0x39')](_0x4e4a73[_0x0407('0x35')],{'$or':_['map'](_0x379a02,function(_0x567f1b){if(_0x567f1b[_0x0407('0x29')]!==_0x0407('0x3a')){var _0x4862be={};_0x4862be[_0x567f1b[_0x0407('0x22')]]={'$like':'%'+_0x5c82de[_0x0407('0x30')][_0x0407('0x38')]+'%'};return _0x4862be;}})});}_0x4e4a73=_[_0x0407('0x39')]({},_0x4e4a73,_0x5c82de['options']);var _0x44a52b={'where':_0x4e4a73[_0x0407('0x35')]};return db[_0x0407('0x26')][_0x0407('0x1c')](_0x44a52b)['then'](function(_0x1180d8){_0x4848cc[_0x0407('0x1c')]=_0x1180d8;if(_0x5c82de[_0x0407('0x30')][_0x0407('0x3b')]){_0x4e4a73[_0x0407('0x3c')]=[{'all':!![]}];}return db['SquareReport'][_0x0407('0x3d')](_0x4e4a73);})[_0x0407('0x1f')](function(_0x3409fb){_0x4848cc[_0x0407('0x3e')]=_0x3409fb;return _0x4848cc;})[_0x0407('0x1f')](respondWithFilteredResult(_0x4384cf,_0x4e4a73))['catch'](handleError(_0x4384cf,null));};exports['show']=function(_0x5bf535,_0x4dcc4c){var _0x48a084={'raw':!![],'where':{'id':_0x5bf535[_0x0407('0x3f')]['id']}},_0x10ae61={};_0x10ae61['model']=_['keys'](db[_0x0407('0x26')][_0x0407('0x27')]);_0x10ae61[_0x0407('0x30')]=_[_0x0407('0x2b')](_0x5bf535['query']);_0x10ae61['filters']=_[_0x0407('0x2c')](_0x10ae61[_0x0407('0x2d')],_0x10ae61[_0x0407('0x30')]);_0x48a084[_0x0407('0x2e')]=_[_0x0407('0x2c')](_0x10ae61['model'],qs[_0x0407('0x2f')](_0x5bf535[_0x0407('0x30')][_0x0407('0x2f')]));_0x48a084['attributes']=_0x48a084[_0x0407('0x2e')][_0x0407('0x40')]?_0x48a084[_0x0407('0x2e')]:_0x10ae61[_0x0407('0x2d')];if(_0x5bf535[_0x0407('0x30')][_0x0407('0x3b')]){_0x48a084[_0x0407('0x3c')]=[{'all':!![]}];}_0x48a084=_['merge']({},_0x48a084,_0x5bf535[_0x0407('0x41')]);return db[_0x0407('0x26')]['find'](_0x48a084)['then'](handleEntityNotFound(_0x4dcc4c,null))['then'](respondWithResult(_0x4dcc4c,null))[_0x0407('0x42')](handleError(_0x4dcc4c,null));};exports['create']=function(_0x9cb036,_0x2bf9bb){return db[_0x0407('0x26')][_0x0407('0x43')](_0x9cb036['body'],{})['then'](respondWithResult(_0x2bf9bb,0xc9))[_0x0407('0x42')](handleError(_0x2bf9bb,null));};exports[_0x0407('0x1e')]=function(_0x45f350,_0x4ad508){if(_0x45f350[_0x0407('0x44')]['id']){delete _0x45f350[_0x0407('0x44')]['id'];}return db[_0x0407('0x26')][_0x0407('0x45')]({'where':{'id':_0x45f350[_0x0407('0x3f')]['id']}})[_0x0407('0x1f')](handleEntityNotFound(_0x4ad508,null))[_0x0407('0x1f')](saveUpdates(_0x45f350[_0x0407('0x44')],null))['then'](respondWithResult(_0x4ad508,null))['catch'](handleError(_0x4ad508,null));};exports['destroy']=function(_0x300ea1,_0x2ae7e3){return db[_0x0407('0x26')][_0x0407('0x45')]({'where':{'id':_0x300ea1[_0x0407('0x3f')]['id']}})[_0x0407('0x1f')](handleEntityNotFound(_0x2ae7e3,null))[_0x0407('0x1f')](removeEntity(_0x2ae7e3,null))[_0x0407('0x42')](handleError(_0x2ae7e3,null));};exports[_0x0407('0x46')]=function(_0x133b90,_0x477b99){return db['SquareReport'][_0x0407('0x46')]()[_0x0407('0x1f')](respondWithResult(_0x477b99,null))['catch'](handleError(_0x477b99,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1010cef..12e8f00 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 _0xb4b5=['SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x489f9e,_0x9b6438){var _0xc3c5b3=function(_0x222150){while(--_0x222150){_0x489f9e['push'](_0x489f9e['shift']());}};_0xc3c5b3(++_0x9b6438);}(_0xb4b5,0x1e2));var _0x5b4b=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0xb4b5[_0x4bd950];return _0x5dc59a;};'use strict';var _=require(_0x5b4b('0x0'));var util=require('util');var logger=require(_0x5b4b('0x1'))(_0x5b4b('0x2'));var moment=require(_0x5b4b('0x3'));var BPromise=require(_0x5b4b('0x4'));var rp=require(_0x5b4b('0x5'));var fs=require('fs');var path=require(_0x5b4b('0x6'));var rimraf=require(_0x5b4b('0x7'));var config=require(_0x5b4b('0x8'));var attributes=require('./squareReport.attributes');module[_0x5b4b('0x9')]=function(_0x148481,_0x14cef6){return _0x148481[_0x5b4b('0xa')](_0x5b4b('0xb'),attributes,{'tableName':_0x5b4b('0xc'),'paranoid':![],'indexes':[{'name':_0x5b4b('0xd'),'fields':[_0x5b4b('0xe'),_0x5b4b('0xf')]},{'name':_0x5b4b('0x10'),'fields':[_0x5b4b('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfab1=['request-promise','path','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xfab1,0xca));var _0x1fab=function(_0x41ae4f,_0x20e57f){_0x41ae4f=_0x41ae4f-0x0;var _0x18a5a1=_0xfab1[_0x41ae4f];return _0x18a5a1;};'use strict';var _=require(_0x1fab('0x0'));var util=require(_0x1fab('0x1'));var logger=require(_0x1fab('0x2'))(_0x1fab('0x3'));var moment=require(_0x1fab('0x4'));var BPromise=require(_0x1fab('0x5'));var rp=require(_0x1fab('0x6'));var fs=require('fs');var path=require(_0x1fab('0x7'));var rimraf=require('rimraf');var config=require(_0x1fab('0x8'));var attributes=require(_0x1fab('0x9'));module[_0x1fab('0xa')]=function(_0x529bf3,_0x4a1816){return _0x529bf3['define'](_0x1fab('0xb'),attributes,{'tableName':_0x1fab('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1fab('0xd'),_0x1fab('0xe')]},{'name':_0x1fab('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 45a53b4..7a5024a 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 _0x2861=['moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','SquareReport','create','options','stringify','UpdateSquareReport','update','body','where','attributes','limit','util'];(function(_0x29320d,_0x26b1f1){var _0xd32419=function(_0x3f9036){while(--_0x3f9036){_0x29320d['push'](_0x29320d['shift']());}};_0xd32419(++_0x26b1f1);}(_0x2861,0x1ec));var _0x1286=function(_0xde639e,_0x508b44){_0xde639e=_0xde639e-0x0;var _0x105a83=_0x2861[_0xde639e];return _0x105a83;};'use strict';var _=require('lodash');var util=require(_0x1286('0x0'));var moment=require(_0x1286('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1286('0x2'))['db'];var utils=require(_0x1286('0x3'));var logger=require(_0x1286('0x4'))('rpc');var config=require(_0x1286('0x5'));var jayson=require(_0x1286('0x6'));var client=jayson[_0x1286('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ae716,_0xc2c9dc,_0x1269e5){return new BPromise(function(_0x2c1be7,_0x5cee76){return client[_0x1286('0x8')](_0x1ae716,_0x1269e5)[_0x1286('0x9')](function(_0x1a9a79){logger[_0x1286('0xa')](_0x1286('0xb'),_0xc2c9dc,_0x1286('0xc'));logger[_0x1286('0xd')](_0x1286('0xe'),_0xc2c9dc,_0x1286('0xc'),JSON['stringify'](_0x1a9a79));if(_0x1a9a79[_0x1286('0xf')]){if(_0x1a9a79[_0x1286('0xf')][_0x1286('0x10')]===0x1f4){logger['error'](_0x1286('0xb'),_0xc2c9dc,_0x1a9a79['error']['message']);return _0x5cee76(_0x1a9a79['error']['message']);}logger[_0x1286('0xf')]('SquareReport,\x20%s,\x20%s',_0xc2c9dc,_0x1a9a79[_0x1286('0xf')][_0x1286('0x11')]);return _0x2c1be7(_0x1a9a79[_0x1286('0xf')][_0x1286('0x11')]);}else{logger[_0x1286('0xa')](_0x1286('0xb'),_0xc2c9dc,_0x1286('0xc'));_0x2c1be7(_0x1a9a79['result'][_0x1286('0x11')]);}})[_0x1286('0x12')](function(_0x12eb00){logger['error'](_0x1286('0xb'),_0xc2c9dc,_0x12eb00);_0x5cee76(_0x12eb00);});});}exports['CreateSquareReport']=function(_0x19c879){var _0x130a76=this;return new Promise(function(_0x6b61e7,_0x4dc617){return db[_0x1286('0x13')][_0x1286('0x14')](_0x19c879['body'],{'raw':_0x19c879['options']?_0x19c879[_0x1286('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x1286('0x9')](function(_0x4b7cb4){logger[_0x1286('0xa')]('CreateSquareReport',_0x19c879);logger[_0x1286('0xd')]('CreateSquareReport',_0x19c879,JSON[_0x1286('0x16')](_0x4b7cb4));_0x6b61e7(_0x4b7cb4);})['catch'](function(_0x5955d8){logger['error']('CreateSquareReport',_0x5955d8[_0x1286('0x11')],_0x19c879);_0x4dc617(_0x130a76['error'](0x1f4,_0x5955d8['message']));});});};exports[_0x1286('0x17')]=function(_0x33925d){var _0x2e8deb=this;return new Promise(function(_0x3a4a2a,_0x19d5b5){return db['SquareReport'][_0x1286('0x18')](_0x33925d[_0x1286('0x19')],{'raw':_0x33925d[_0x1286('0x15')]?_0x33925d[_0x1286('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33925d[_0x1286('0x15')]?_0x33925d[_0x1286('0x15')][_0x1286('0x1a')]||null:null,'attributes':_0x33925d[_0x1286('0x15')]?_0x33925d[_0x1286('0x15')][_0x1286('0x1b')]||null:null,'limit':_0x33925d[_0x1286('0x15')]?_0x33925d['options'][_0x1286('0x1c')]||null:null})[_0x1286('0x9')](function(_0x49a57e){logger[_0x1286('0xa')]('UpdateSquareReport',_0x33925d);logger['debug']('UpdateSquareReport',_0x33925d,JSON[_0x1286('0x16')](_0x49a57e));_0x3a4a2a(_0x49a57e);})[_0x1286('0x12')](function(_0x1f8960){logger['error'](_0x1286('0x17'),_0x1f8960[_0x1286('0x11')],_0x33925d);_0x19d5b5(_0x2e8deb['error'](0x1f4,_0x1f8960[_0x1286('0x11')]));});});}; \ No newline at end of file +var _0xadb5=['http','request','then','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create','body','options','info','debug','UpdateSquareReport','update','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x24094e,_0x2163b5){var _0x59ec86=function(_0xaea391){while(--_0xaea391){_0x24094e['push'](_0x24094e['shift']());}};_0x59ec86(++_0x2163b5);}(_0xadb5,0x1d4));var _0x5adb=function(_0xcce9b7,_0x2b95ed){_0xcce9b7=_0xcce9b7-0x0;var _0x1faa2a=_0xadb5[_0xcce9b7];return _0x1faa2a;};'use strict';var _=require(_0x5adb('0x0'));var util=require(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rs=require(_0x5adb('0x4'));var fs=require('fs');var Redis=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];var utils=require(_0x5adb('0x7'));var logger=require(_0x5adb('0x8'))(_0x5adb('0x9'));var config=require(_0x5adb('0xa'));var jayson=require(_0x5adb('0xb'));var client=jayson[_0x5adb('0xc')][_0x5adb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x7e82e2,_0x13120a,_0x3d5efa){return new BPromise(function(_0x9b66fa,_0x1705b4){return client[_0x5adb('0xe')](_0x7e82e2,_0x3d5efa)[_0x5adb('0xf')](function(_0x2fe5e1){logger['info']('SquareReport,\x20%s,\x20%s',_0x13120a,_0x5adb('0x10'));logger['debug'](_0x5adb('0x11'),_0x13120a,_0x5adb('0x10'),JSON['stringify'](_0x2fe5e1));if(_0x2fe5e1['error']){if(_0x2fe5e1[_0x5adb('0x12')][_0x5adb('0x13')]===0x1f4){logger['error'](_0x5adb('0x14'),_0x13120a,_0x2fe5e1[_0x5adb('0x12')]['message']);return _0x1705b4(_0x2fe5e1[_0x5adb('0x12')][_0x5adb('0x15')]);}logger[_0x5adb('0x12')](_0x5adb('0x14'),_0x13120a,_0x2fe5e1['error'][_0x5adb('0x15')]);return _0x9b66fa(_0x2fe5e1[_0x5adb('0x12')]['message']);}else{logger['info'](_0x5adb('0x14'),_0x13120a,'request\x20sent');_0x9b66fa(_0x2fe5e1[_0x5adb('0x16')][_0x5adb('0x15')]);}})[_0x5adb('0x17')](function(_0xe9f7d2){logger[_0x5adb('0x12')](_0x5adb('0x14'),_0x13120a,_0xe9f7d2);_0x1705b4(_0xe9f7d2);});});}exports[_0x5adb('0x18')]=function(_0x3ef503){var _0x2278c4=this;return new Promise(function(_0x43e098,_0xbb30e){return db[_0x5adb('0x19')][_0x5adb('0x1a')](_0x3ef503[_0x5adb('0x1b')],{'raw':_0x3ef503[_0x5adb('0x1c')]?_0x3ef503[_0x5adb('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x5adb('0xf')](function(_0x261b80){logger[_0x5adb('0x1d')]('CreateSquareReport',_0x3ef503);logger[_0x5adb('0x1e')](_0x5adb('0x18'),_0x3ef503,JSON['stringify'](_0x261b80));_0x43e098(_0x261b80);})[_0x5adb('0x17')](function(_0xb3e245){logger[_0x5adb('0x12')]('CreateSquareReport',_0xb3e245['message'],_0x3ef503);_0xbb30e(_0x2278c4['error'](0x1f4,_0xb3e245[_0x5adb('0x15')]));});});};exports[_0x5adb('0x1f')]=function(_0x22d4f7){var _0x21a62f=this;return new Promise(function(_0x5b9891,_0x5ee493){return db[_0x5adb('0x19')][_0x5adb('0x20')](_0x22d4f7[_0x5adb('0x1b')],{'raw':_0x22d4f7[_0x5adb('0x1c')]?_0x22d4f7[_0x5adb('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22d4f7[_0x5adb('0x1c')]?_0x22d4f7[_0x5adb('0x1c')][_0x5adb('0x21')]||null:null,'attributes':_0x22d4f7[_0x5adb('0x1c')]?_0x22d4f7['options'][_0x5adb('0x22')]||null:null,'limit':_0x22d4f7[_0x5adb('0x1c')]?_0x22d4f7[_0x5adb('0x1c')][_0x5adb('0x23')]||null:null})[_0x5adb('0xf')](function(_0x4e507d){logger[_0x5adb('0x1d')](_0x5adb('0x1f'),_0x22d4f7);logger['debug'](_0x5adb('0x1f'),_0x22d4f7,JSON[_0x5adb('0x24')](_0x4e507d));_0x5b9891(_0x4e507d);})[_0x5adb('0x17')](function(_0x321fc9){logger[_0x5adb('0x12')]('UpdateSquareReport',_0x321fc9[_0x5adb('0x15')],_0x22d4f7);_0x5ee493(_0x21a62f['error'](0x1f4,_0x321fc9[_0x5adb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 32bf1b7..546cae4 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 _0x760c=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x197065,_0x2e79d0){var _0x3d9404=function(_0xf582a7){while(--_0xf582a7){_0x197065['push'](_0x197065['shift']());}};_0x3d9404(++_0x2e79d0);}(_0x760c,0x107));var _0xc760=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x760c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc760('0x0'));var util=require(_0xc760('0x1'));var path=require(_0xc760('0x2'));var timeout=require(_0xc760('0x3'));var express=require('express');var router=express[_0xc760('0x4')]();var fs_extra=require(_0xc760('0x5'));var auth=require(_0xc760('0x6'));var interaction=require(_0xc760('0x7'));var config=require(_0xc760('0x8'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0xc760('0x9')](),controller[_0xc760('0xa')]);router[_0xc760('0xb')](_0xc760('0xc'),auth[_0xc760('0x9')](),controller[_0xc760('0xd')]);router[_0xc760('0xb')](_0xc760('0xe'),auth[_0xc760('0x9')](),controller[_0xc760('0xf')]);router[_0xc760('0x10')]('/',auth[_0xc760('0x9')](),controller[_0xc760('0x11')]);router[_0xc760('0x12')](_0xc760('0xe'),auth[_0xc760('0x9')](),controller[_0xc760('0x13')]);router['delete'](_0xc760('0xe'),auth['isAuthenticated'](),controller[_0xc760('0x14')]);module[_0xc760('0x15')]=router; \ No newline at end of file +var _0x9a41=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','util'];(function(_0x25b022,_0x394a08){var _0x2e13a5=function(_0xe9495d){while(--_0xe9495d){_0x25b022['push'](_0x25b022['shift']());}};_0x2e13a5(++_0x394a08);}(_0x9a41,0xe6));var _0x19a4=function(_0x58d89e,_0x1f093b){_0x58d89e=_0x58d89e-0x0;var _0x53ac09=_0x9a41[_0x58d89e];return _0x53ac09;};'use strict';var multer=require('multer');var util=require(_0x19a4('0x0'));var path=require(_0x19a4('0x1'));var timeout=require('connect-timeout');var express=require(_0x19a4('0x2'));var router=express['Router']();var fs_extra=require(_0x19a4('0x3'));var auth=require(_0x19a4('0x4'));var interaction=require(_0x19a4('0x5'));var config=require(_0x19a4('0x6'));var controller=require(_0x19a4('0x7'));router[_0x19a4('0x8')]('/',auth[_0x19a4('0x9')](),controller[_0x19a4('0xa')]);router[_0x19a4('0x8')](_0x19a4('0xb'),auth[_0x19a4('0x9')](),controller[_0x19a4('0xc')]);router[_0x19a4('0x8')](_0x19a4('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x19a4('0xe')]('/',auth['isAuthenticated'](),controller[_0x19a4('0xf')]);router[_0x19a4('0x10')](_0x19a4('0xd'),auth['isAuthenticated'](),controller[_0x19a4('0x11')]);router[_0x19a4('0x12')]('/:id',auth[_0x19a4('0x9')](),controller[_0x19a4('0x13')]);module[_0x19a4('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 0f883b9..76f3e52 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 _0xa513=['TEXT','sequelize','exports','STRING'];(function(_0x5d12e6,_0x1471c0){var _0x1b1a06=function(_0x56a662){while(--_0x56a662){_0x5d12e6['push'](_0x5d12e6['shift']());}};_0x1b1a06(++_0x1471c0);}(_0xa513,0x185));var _0x3a51=function(_0x1ea427,_0x3d1b35){_0x1ea427=_0x1ea427-0x0;var _0x20980c=_0xa513[_0x1ea427];return _0x20980c;};'use strict';var Sequelize=require(_0x3a51('0x0'));module[_0x3a51('0x1')]={'uniqueid':{'type':Sequelize[_0x3a51('0x2')]},'node':{'type':Sequelize[_0x3a51('0x2')]},'application':{'type':Sequelize[_0x3a51('0x2')]},'data':{'type':Sequelize[_0x3a51('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3a51('0x2')]}}; \ No newline at end of file +var _0xf83f=['sequelize','exports','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf83f,0xf8));var _0xff83=function(_0x32867f,_0x46ad42){_0x32867f=_0x32867f-0x0;var _0x192435=_0xf83f[_0x32867f];return _0x192435;};'use strict';var Sequelize=require(_0xff83('0x0'));module[_0xff83('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xff83('0x2')]},'application':{'type':Sequelize[_0xff83('0x2')]},'data':{'type':Sequelize[_0xff83('0x3')]},'project_name':{'type':Sequelize[_0xff83('0x2')]},'callerid':{'type':Sequelize[_0xff83('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 414c912..bce8bfb 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 _0x6205=['create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','undefined','limit','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SquareDetailsReport','count','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x366e99,_0x15d82d){var _0x180bbe=function(_0x282498){while(--_0x282498){_0x366e99['push'](_0x366e99['shift']());}};_0x180bbe(++_0x15d82d);}(_0x6205,0xe2));var _0x5620=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x6205[_0x47aa64];return _0x549c7a;};'use strict';var emlformat=require(_0x5620('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5620('0x1'));var jsonpatch=require(_0x5620('0x2'));var rp=require(_0x5620('0x3'));var moment=require(_0x5620('0x4'));var BPromise=require(_0x5620('0x5'));var Mustache=require('mustache');var util=require(_0x5620('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5620('0x7'));var ejs=require(_0x5620('0x8'));var fs=require('fs');var fs_extra=require(_0x5620('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5620('0xa'));var jsforce=require(_0x5620('0xb'));var deskjs=require(_0x5620('0xc'));var toCsv=require(_0x5620('0x7'));var querystring=require(_0x5620('0xd'));var Papa=require(_0x5620('0xe'));var Redis=require(_0x5620('0xf'));var authService=require(_0x5620('0x10'));var qs=require(_0x5620('0x11'));var as=require(_0x5620('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5620('0x13'))(_0x5620('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5620('0x15'))['db'];function respondWithStatusCode(_0x3222c5,_0x5f9e19){_0x5f9e19=_0x5f9e19||0xcc;return function(_0x3f2d88){if(_0x3f2d88){return _0x3222c5[_0x5620('0x16')](_0x5f9e19);}return _0x3222c5['status'](_0x5f9e19)[_0x5620('0x17')]();};}function respondWithResult(_0xa3048e,_0x539194){_0x539194=_0x539194||0xc8;return function(_0x1d9df7){if(_0x1d9df7){return _0xa3048e[_0x5620('0x18')](_0x539194)['json'](_0x1d9df7);}};}function respondWithFilteredResult(_0x179698,_0x747f83){return function(_0x5260f2){if(_0x5260f2){var _0x2b0717=typeof _0x747f83['offset']===_0x5620('0x19')&&typeof _0x747f83[_0x5620('0x1a')]===_0x5620('0x19');var _0x5b3c6c=_0x5260f2['count'];var _0x29eaff=_0x2b0717?0x0:_0x747f83[_0x5620('0x1b')];var _0x229d35=_0x2b0717?_0x5260f2['count']:_0x747f83[_0x5620('0x1b')]+_0x747f83[_0x5620('0x1a')];var _0x58bc2c;if(_0x229d35>=_0x5b3c6c){_0x229d35=_0x5b3c6c;_0x58bc2c=0xc8;}else{_0x58bc2c=0xce;}_0x179698[_0x5620('0x18')](_0x58bc2c);return _0x179698[_0x5620('0x1c')](_0x5620('0x1d'),_0x29eaff+'-'+_0x229d35+'/'+_0x5b3c6c)[_0x5620('0x1e')](_0x5260f2);}return null;};}function patchUpdates(_0x4665de){return function(_0x924aaf){try{jsonpatch[_0x5620('0x1f')](_0x924aaf,_0x4665de,!![]);}catch(_0x38e76c){return BPromise[_0x5620('0x20')](_0x38e76c);}return _0x924aaf[_0x5620('0x21')]();};}function saveUpdates(_0x312ac3,_0xa142d4){return function(_0x1926c4){if(_0x1926c4){return _0x1926c4['update'](_0x312ac3)[_0x5620('0x22')](function(_0x2b548f){return _0x2b548f;});}return null;};}function removeEntity(_0x4fb9ed,_0x54fd4a){return function(_0x2fc551){if(_0x2fc551){return _0x2fc551[_0x5620('0x23')]()[_0x5620('0x22')](function(){_0x4fb9ed[_0x5620('0x18')](0xcc)[_0x5620('0x17')]();});}};}function handleEntityNotFound(_0x4cca17,_0x13377f){return function(_0x384906){if(!_0x384906){_0x4cca17['sendStatus'](0x194);}return _0x384906;};}function handleError(_0x2f331b,_0x29be60){_0x29be60=_0x29be60||0x1f4;return function(_0xf06b84){logger[_0x5620('0x24')](_0xf06b84[_0x5620('0x25')]);if(_0xf06b84[_0x5620('0x26')]){delete _0xf06b84[_0x5620('0x26')];}_0x2f331b['status'](_0x29be60)[_0x5620('0x27')](_0xf06b84);};}exports[_0x5620('0x28')]=function(_0x211f8c,_0x19f704){var _0x2299ee={},_0x5f3e60={},_0x513990={'count':0x0,'rows':[]};var _0xf470a3=_[_0x5620('0x29')](db['SquareDetailsReport']['rawAttributes'],function(_0x20e59b){return{'name':_0x20e59b[_0x5620('0x2a')],'type':_0x20e59b[_0x5620('0x2b')]['key']};});_0x5f3e60[_0x5620('0x2c')]=_[_0x5620('0x29')](_0xf470a3,_0x5620('0x26'));_0x5f3e60[_0x5620('0x2d')]=_[_0x5620('0x2e')](_0x211f8c[_0x5620('0x2d')]);_0x5f3e60[_0x5620('0x2f')]=_[_0x5620('0x30')](_0x5f3e60[_0x5620('0x2c')],_0x5f3e60[_0x5620('0x2d')]);_0x2299ee[_0x5620('0x31')]=_['intersection'](_0x5f3e60['model'],qs['fields'](_0x211f8c[_0x5620('0x2d')][_0x5620('0x32')]));_0x2299ee[_0x5620('0x31')]=_0x2299ee[_0x5620('0x31')][_0x5620('0x33')]?_0x2299ee[_0x5620('0x31')]:_0x5f3e60['model'];if(!_0x211f8c[_0x5620('0x2d')][_0x5620('0x34')](_0x5620('0x35'))){_0x2299ee[_0x5620('0x1a')]=qs[_0x5620('0x1a')](_0x211f8c[_0x5620('0x2d')][_0x5620('0x1a')]);_0x2299ee[_0x5620('0x1b')]=qs[_0x5620('0x1b')](_0x211f8c[_0x5620('0x2d')][_0x5620('0x1b')]);}_0x2299ee['order']=qs[_0x5620('0x36')](_0x211f8c['query'][_0x5620('0x36')]);_0x2299ee[_0x5620('0x37')]=qs[_0x5620('0x2f')](_['pick'](_0x211f8c[_0x5620('0x2d')],_0x5f3e60[_0x5620('0x2f')]),_0xf470a3);if(_0x211f8c['query'][_0x5620('0x38')]){_0x2299ee[_0x5620('0x37')]=_[_0x5620('0x39')](_0x2299ee[_0x5620('0x37')],{'$or':_[_0x5620('0x29')](_0xf470a3,function(_0x28c235){if(_0x28c235['type']!==_0x5620('0x3a')){var _0x1b6ecd={};_0x1b6ecd[_0x28c235[_0x5620('0x26')]]={'$like':'%'+_0x211f8c[_0x5620('0x2d')]['filter']+'%'};return _0x1b6ecd;}})});}_0x2299ee=_[_0x5620('0x39')]({},_0x2299ee,_0x211f8c[_0x5620('0x3b')]);var _0x390629={'where':_0x2299ee[_0x5620('0x37')]};return db[_0x5620('0x3c')][_0x5620('0x3d')](_0x390629)['then'](function(_0x120e24){_0x513990[_0x5620('0x3d')]=_0x120e24;if(_0x211f8c[_0x5620('0x2d')][_0x5620('0x3e')]){_0x2299ee['include']=[{'all':!![]}];}return db[_0x5620('0x3c')][_0x5620('0x3f')](_0x2299ee);})[_0x5620('0x22')](function(_0x2cb7b2){_0x513990[_0x5620('0x40')]=_0x2cb7b2;return _0x513990;})[_0x5620('0x22')](respondWithFilteredResult(_0x19f704,_0x2299ee))[_0x5620('0x41')](handleError(_0x19f704,null));};exports[_0x5620('0x42')]=function(_0x582edf,_0x3f535e){var _0xc38aac={'raw':!![],'where':{'id':_0x582edf[_0x5620('0x43')]['id']}},_0x17c6c1={};_0x17c6c1[_0x5620('0x2c')]=_['keys'](db[_0x5620('0x3c')]['rawAttributes']);_0x17c6c1['query']=_['keys'](_0x582edf[_0x5620('0x2d')]);_0x17c6c1[_0x5620('0x2f')]=_['intersection'](_0x17c6c1[_0x5620('0x2c')],_0x17c6c1[_0x5620('0x2d')]);_0xc38aac[_0x5620('0x31')]=_[_0x5620('0x30')](_0x17c6c1['model'],qs[_0x5620('0x32')](_0x582edf['query'][_0x5620('0x32')]));_0xc38aac[_0x5620('0x31')]=_0xc38aac[_0x5620('0x31')]['length']?_0xc38aac[_0x5620('0x31')]:_0x17c6c1[_0x5620('0x2c')];if(_0x582edf[_0x5620('0x2d')]['includeAll']){_0xc38aac[_0x5620('0x44')]=[{'all':!![]}];}_0xc38aac=_['merge']({},_0xc38aac,_0x582edf[_0x5620('0x3b')]);return db[_0x5620('0x3c')][_0x5620('0x45')](_0xc38aac)[_0x5620('0x22')](handleEntityNotFound(_0x3f535e,null))[_0x5620('0x22')](respondWithResult(_0x3f535e,null))['catch'](handleError(_0x3f535e,null));};exports['create']=function(_0x590e73,_0x3121a1){return db[_0x5620('0x3c')][_0x5620('0x46')](_0x590e73[_0x5620('0x47')],{})[_0x5620('0x22')](respondWithResult(_0x3121a1,0xc9))[_0x5620('0x41')](handleError(_0x3121a1,null));};exports[_0x5620('0x48')]=function(_0x350915,_0x1e508b){if(_0x350915[_0x5620('0x47')]['id']){delete _0x350915['body']['id'];}return db[_0x5620('0x3c')][_0x5620('0x45')]({'where':{'id':_0x350915['params']['id']}})['then'](handleEntityNotFound(_0x1e508b,null))['then'](saveUpdates(_0x350915[_0x5620('0x47')],null))[_0x5620('0x22')](respondWithResult(_0x1e508b,null))[_0x5620('0x41')](handleError(_0x1e508b,null));};exports['destroy']=function(_0xc9a67,_0x1bf2d0){return db[_0x5620('0x3c')][_0x5620('0x45')]({'where':{'id':_0xc9a67[_0x5620('0x43')]['id']}})[_0x5620('0x22')](handleEntityNotFound(_0x1bf2d0,null))[_0x5620('0x22')](removeEntity(_0x1bf2d0,null))[_0x5620('0x41')](handleError(_0x1bf2d0,null));};exports['describe']=function(_0x299790,_0x2e66bf){return db['SquareDetailsReport'][_0x5620('0x49')]()[_0x5620('0x22')](respondWithResult(_0x2e66bf,null))[_0x5620('0x41')](handleError(_0x2e66bf,null));}; \ No newline at end of file +var _0xc03c=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','error','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','rows','catch','includeAll','include','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','crypto','jsforce'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc03c,0x1a4));var _0xcc03=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xc03c[_0x4c445a];return _0x2f611c;};'use strict';var emlformat=require(_0xcc03('0x0'));var rimraf=require(_0xcc03('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc03('0x2'));var rp=require(_0xcc03('0x3'));var moment=require(_0xcc03('0x4'));var BPromise=require(_0xcc03('0x5'));var Mustache=require('mustache');var util=require(_0xcc03('0x6'));var path=require('path');var sox=require(_0xcc03('0x7'));var csv=require(_0xcc03('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc03('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcc03('0xa'));var jsforce=require(_0xcc03('0xb'));var deskjs=require(_0xcc03('0xc'));var toCsv=require(_0xcc03('0x8'));var querystring=require(_0xcc03('0xd'));var Papa=require(_0xcc03('0xe'));var Redis=require(_0xcc03('0xf'));var authService=require(_0xcc03('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcc03('0x11'));var hardwareService=require(_0xcc03('0x12'));var logger=require('../../config/logger')(_0xcc03('0x13'));var utils=require(_0xcc03('0x14'));var config=require(_0xcc03('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc03('0x16'))['db'];function respondWithStatusCode(_0x150dd5,_0x1ffae5){_0x1ffae5=_0x1ffae5||0xcc;return function(_0x102dcd){if(_0x102dcd){return _0x150dd5['sendStatus'](_0x1ffae5);}return _0x150dd5[_0xcc03('0x17')](_0x1ffae5)[_0xcc03('0x18')]();};}function respondWithResult(_0x50792e,_0x2d0043){_0x2d0043=_0x2d0043||0xc8;return function(_0x100d6d){if(_0x100d6d){return _0x50792e[_0xcc03('0x17')](_0x2d0043)[_0xcc03('0x19')](_0x100d6d);}};}function respondWithFilteredResult(_0x16a77a,_0x4d04f2){return function(_0x26755f){if(_0x26755f){var _0x4834a6=typeof _0x4d04f2[_0xcc03('0x1a')]===_0xcc03('0x1b')&&typeof _0x4d04f2[_0xcc03('0x1c')]==='undefined';var _0x14cd50=_0x26755f['count'];var _0x471ca1=_0x4834a6?0x0:_0x4d04f2['offset'];var _0x5f41ef=_0x4834a6?_0x26755f[_0xcc03('0x1d')]:_0x4d04f2[_0xcc03('0x1a')]+_0x4d04f2[_0xcc03('0x1c')];var _0x35a153;if(_0x5f41ef>=_0x14cd50){_0x5f41ef=_0x14cd50;_0x35a153=0xc8;}else{_0x35a153=0xce;}_0x16a77a[_0xcc03('0x17')](_0x35a153);return _0x16a77a[_0xcc03('0x1e')]('Content-Range',_0x471ca1+'-'+_0x5f41ef+'/'+_0x14cd50)[_0xcc03('0x19')](_0x26755f);}return null;};}function patchUpdates(_0x16948f){return function(_0x268e5f){try{jsonpatch['apply'](_0x268e5f,_0x16948f,!![]);}catch(_0x199f6a){return BPromise['reject'](_0x199f6a);}return _0x268e5f[_0xcc03('0x1f')]();};}function saveUpdates(_0x546431,_0x3141fa){return function(_0x2a5f76){if(_0x2a5f76){return _0x2a5f76[_0xcc03('0x20')](_0x546431)[_0xcc03('0x21')](function(_0x13fd8d){return _0x13fd8d;});}return null;};}function removeEntity(_0x3f4a65,_0x18f13b){return function(_0xe822ea){if(_0xe822ea){return _0xe822ea[_0xcc03('0x22')]()['then'](function(){_0x3f4a65[_0xcc03('0x17')](0xcc)[_0xcc03('0x18')]();});}};}function handleEntityNotFound(_0x3ceefe,_0x1780c3){return function(_0x9747a0){if(!_0x9747a0){_0x3ceefe['sendStatus'](0x194);}return _0x9747a0;};}function handleError(_0xd4dfd6,_0x2e0c63){_0x2e0c63=_0x2e0c63||0x1f4;return function(_0x296a71){logger[_0xcc03('0x23')](_0x296a71['stack']);if(_0x296a71['name']){delete _0x296a71['name'];}_0xd4dfd6[_0xcc03('0x17')](_0x2e0c63)[_0xcc03('0x24')](_0x296a71);};}exports[_0xcc03('0x25')]=function(_0x2e4449,_0x17131f){var _0x14d2ae={},_0x5a9ff9={},_0x861c56={'count':0x0,'rows':[]};var _0x2f9df2=_[_0xcc03('0x26')](db[_0xcc03('0x27')][_0xcc03('0x28')],function(_0x181ad1){return{'name':_0x181ad1[_0xcc03('0x29')],'type':_0x181ad1[_0xcc03('0x2a')][_0xcc03('0x2b')]};});_0x5a9ff9[_0xcc03('0x2c')]=_['map'](_0x2f9df2,_0xcc03('0x2d'));_0x5a9ff9[_0xcc03('0x2e')]=_[_0xcc03('0x2f')](_0x2e4449[_0xcc03('0x2e')]);_0x5a9ff9[_0xcc03('0x30')]=_[_0xcc03('0x31')](_0x5a9ff9[_0xcc03('0x2c')],_0x5a9ff9[_0xcc03('0x2e')]);_0x14d2ae[_0xcc03('0x32')]=_['intersection'](_0x5a9ff9[_0xcc03('0x2c')],qs[_0xcc03('0x33')](_0x2e4449['query'][_0xcc03('0x33')]));_0x14d2ae[_0xcc03('0x32')]=_0x14d2ae[_0xcc03('0x32')][_0xcc03('0x34')]?_0x14d2ae['attributes']:_0x5a9ff9['model'];if(!_0x2e4449['query'][_0xcc03('0x35')](_0xcc03('0x36'))){_0x14d2ae[_0xcc03('0x1c')]=qs[_0xcc03('0x1c')](_0x2e4449[_0xcc03('0x2e')][_0xcc03('0x1c')]);_0x14d2ae[_0xcc03('0x1a')]=qs[_0xcc03('0x1a')](_0x2e4449[_0xcc03('0x2e')][_0xcc03('0x1a')]);}_0x14d2ae[_0xcc03('0x37')]=qs['sort'](_0x2e4449[_0xcc03('0x2e')][_0xcc03('0x38')]);_0x14d2ae[_0xcc03('0x39')]=qs[_0xcc03('0x30')](_[_0xcc03('0x3a')](_0x2e4449[_0xcc03('0x2e')],_0x5a9ff9[_0xcc03('0x30')]),_0x2f9df2);if(_0x2e4449['query'][_0xcc03('0x3b')]){_0x14d2ae[_0xcc03('0x39')]=_[_0xcc03('0x3c')](_0x14d2ae[_0xcc03('0x39')],{'$or':_[_0xcc03('0x26')](_0x2f9df2,function(_0x2bac4e){if(_0x2bac4e[_0xcc03('0x2a')]!==_0xcc03('0x3d')){var _0x344928={};_0x344928[_0x2bac4e['name']]={'$like':'%'+_0x2e4449[_0xcc03('0x2e')][_0xcc03('0x3b')]+'%'};return _0x344928;}})});}_0x14d2ae=_[_0xcc03('0x3c')]({},_0x14d2ae,_0x2e4449['options']);var _0x58c228={'where':_0x14d2ae[_0xcc03('0x39')]};return db['SquareDetailsReport']['count'](_0x58c228)[_0xcc03('0x21')](function(_0x1f2474){_0x861c56[_0xcc03('0x1d')]=_0x1f2474;if(_0x2e4449[_0xcc03('0x2e')]['includeAll']){_0x14d2ae['include']=[{'all':!![]}];}return db[_0xcc03('0x27')]['findAll'](_0x14d2ae);})['then'](function(_0x4b3000){_0x861c56[_0xcc03('0x3e')]=_0x4b3000;return _0x861c56;})[_0xcc03('0x21')](respondWithFilteredResult(_0x17131f,_0x14d2ae))[_0xcc03('0x3f')](handleError(_0x17131f,null));};exports['show']=function(_0x285994,_0x240bbb){var _0x34c2d2={'raw':!![],'where':{'id':_0x285994['params']['id']}},_0x59dca7={};_0x59dca7[_0xcc03('0x2c')]=_[_0xcc03('0x2f')](db[_0xcc03('0x27')][_0xcc03('0x28')]);_0x59dca7[_0xcc03('0x2e')]=_[_0xcc03('0x2f')](_0x285994[_0xcc03('0x2e')]);_0x59dca7[_0xcc03('0x30')]=_[_0xcc03('0x31')](_0x59dca7[_0xcc03('0x2c')],_0x59dca7[_0xcc03('0x2e')]);_0x34c2d2[_0xcc03('0x32')]=_[_0xcc03('0x31')](_0x59dca7['model'],qs[_0xcc03('0x33')](_0x285994[_0xcc03('0x2e')][_0xcc03('0x33')]));_0x34c2d2['attributes']=_0x34c2d2['attributes'][_0xcc03('0x34')]?_0x34c2d2[_0xcc03('0x32')]:_0x59dca7[_0xcc03('0x2c')];if(_0x285994['query'][_0xcc03('0x40')]){_0x34c2d2[_0xcc03('0x41')]=[{'all':!![]}];}_0x34c2d2=_[_0xcc03('0x3c')]({},_0x34c2d2,_0x285994[_0xcc03('0x42')]);return db[_0xcc03('0x27')][_0xcc03('0x43')](_0x34c2d2)[_0xcc03('0x21')](handleEntityNotFound(_0x240bbb,null))[_0xcc03('0x21')](respondWithResult(_0x240bbb,null))['catch'](handleError(_0x240bbb,null));};exports[_0xcc03('0x44')]=function(_0x9d4711,_0x397236){return db[_0xcc03('0x27')][_0xcc03('0x44')](_0x9d4711[_0xcc03('0x45')],{})[_0xcc03('0x21')](respondWithResult(_0x397236,0xc9))[_0xcc03('0x3f')](handleError(_0x397236,null));};exports[_0xcc03('0x20')]=function(_0x4130f7,_0x5c3a04){if(_0x4130f7[_0xcc03('0x45')]['id']){delete _0x4130f7[_0xcc03('0x45')]['id'];}return db['SquareDetailsReport'][_0xcc03('0x43')]({'where':{'id':_0x4130f7['params']['id']}})['then'](handleEntityNotFound(_0x5c3a04,null))[_0xcc03('0x21')](saveUpdates(_0x4130f7[_0xcc03('0x45')],null))[_0xcc03('0x21')](respondWithResult(_0x5c3a04,null))[_0xcc03('0x3f')](handleError(_0x5c3a04,null));};exports[_0xcc03('0x22')]=function(_0x2cba51,_0x219d2f){return db[_0xcc03('0x27')][_0xcc03('0x43')]({'where':{'id':_0x2cba51[_0xcc03('0x46')]['id']}})['then'](handleEntityNotFound(_0x219d2f,null))['then'](removeEntity(_0x219d2f,null))[_0xcc03('0x3f')](handleError(_0x219d2f,null));};exports[_0xcc03('0x47')]=function(_0x145c64,_0x569df7){return db[_0xcc03('0x27')][_0xcc03('0x47')]()[_0xcc03('0x21')](respondWithResult(_0x569df7,null))[_0xcc03('0x3f')](handleError(_0x569df7,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 673f6af..7be1288 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 _0xf4cf=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','SquareDetailsReport','lodash'];(function(_0x4945e8,_0x597c5e){var _0x4300ca=function(_0x50c331){while(--_0x50c331){_0x4945e8['push'](_0x4945e8['shift']());}};_0x4300ca(++_0x597c5e);}(_0xf4cf,0x107));var _0xff4c=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xf4cf[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0xff4c('0x0'));var util=require(_0xff4c('0x1'));var logger=require(_0xff4c('0x2'))(_0xff4c('0x3'));var moment=require('moment');var BPromise=require(_0xff4c('0x4'));var rp=require(_0xff4c('0x5'));var fs=require('fs');var path=require(_0xff4c('0x6'));var rimraf=require(_0xff4c('0x7'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0xff4c('0x8')]=function(_0x56bf8c,_0x236217){return _0x56bf8c[_0xff4c('0x9')](_0xff4c('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89c7=['define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','rimraf','exports'];(function(_0x5de09d,_0x3b7c87){var _0x47ba8d=function(_0x244a99){while(--_0x244a99){_0x5de09d['push'](_0x5de09d['shift']());}};_0x47ba8d(++_0x3b7c87);}(_0x89c7,0x179));var _0x789c=function(_0x4bfb87,_0x2ed356){_0x4bfb87=_0x4bfb87-0x0;var _0x2b4e25=_0x89c7[_0x4bfb87];return _0x2b4e25;};'use strict';var _=require(_0x789c('0x0'));var util=require(_0x789c('0x1'));var logger=require(_0x789c('0x2'))(_0x789c('0x3'));var moment=require(_0x789c('0x4'));var BPromise=require('bluebird');var rp=require(_0x789c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x789c('0x6'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x789c('0x7')]=function(_0x4f6313,_0x55b2f8){return _0x4f6313[_0x789c('0x8')](_0x789c('0x9'),attributes,{'tableName':_0x789c('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 ac05071..bdc75b9 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 _0x0833=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','raw','then','CreateSquareDetailsReport','lodash','util','moment'];(function(_0x578bbb,_0x56ef4e){var _0x24b5d8=function(_0x3a7e29){while(--_0x3a7e29){_0x578bbb['push'](_0x578bbb['shift']());}};_0x24b5d8(++_0x56ef4e);}(_0x0833,0x1bd));var _0x3083=function(_0x2b27b6,_0x14be82){_0x2b27b6=_0x2b27b6-0x0;var _0x26dd27=_0x0833[_0x2b27b6];return _0x26dd27;};'use strict';var _=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var moment=require(_0x3083('0x2'));var BPromise=require(_0x3083('0x3'));var rs=require(_0x3083('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3083('0x5'))('rpc');var config=require(_0x3083('0x6'));var jayson=require(_0x3083('0x7'));var client=jayson[_0x3083('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9c3a,_0x1378a5,_0x529df1){return new BPromise(function(_0x5591b0,_0x4f51da){return client[_0x3083('0x9')](_0x2f9c3a,_0x529df1)['then'](function(_0x5cce3c){logger[_0x3083('0xa')](_0x3083('0xb'),_0x1378a5,_0x3083('0xc'));logger[_0x3083('0xd')](_0x3083('0xe'),_0x1378a5,_0x3083('0xc'),JSON[_0x3083('0xf')](_0x5cce3c));if(_0x5cce3c[_0x3083('0x10')]){if(_0x5cce3c[_0x3083('0x10')][_0x3083('0x11')]===0x1f4){logger[_0x3083('0x10')](_0x3083('0xb'),_0x1378a5,_0x5cce3c[_0x3083('0x10')][_0x3083('0x12')]);return _0x4f51da(_0x5cce3c[_0x3083('0x10')]['message']);}logger[_0x3083('0x10')](_0x3083('0xb'),_0x1378a5,_0x5cce3c['error'][_0x3083('0x12')]);return _0x5591b0(_0x5cce3c[_0x3083('0x10')]['message']);}else{logger[_0x3083('0xa')](_0x3083('0xb'),_0x1378a5,_0x3083('0xc'));_0x5591b0(_0x5cce3c[_0x3083('0x13')][_0x3083('0x12')]);}})[_0x3083('0x14')](function(_0xecb368){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1378a5,_0xecb368);_0x4f51da(_0xecb368);});});}exports['CreateSquareDetailsReport']=function(_0x424c59){var _0x57fdf7=this;return new Promise(function(_0x3bbfe3,_0x2cdeca){return db[_0x3083('0x15')][_0x3083('0x16')](_0x424c59[_0x3083('0x17')],{'raw':_0x424c59[_0x3083('0x18')]?_0x424c59[_0x3083('0x18')][_0x3083('0x19')]===undefined?!![]:![]:!![]})[_0x3083('0x1a')](function(_0x164988){logger[_0x3083('0xa')](_0x3083('0x1b'),_0x424c59);logger[_0x3083('0xd')](_0x3083('0x1b'),_0x424c59,JSON['stringify'](_0x164988));_0x3bbfe3(_0x164988);})['catch'](function(_0x4dc9ad){logger['error'](_0x3083('0x1b'),_0x4dc9ad[_0x3083('0x12')],_0x424c59);_0x2cdeca(_0x57fdf7[_0x3083('0x10')](0x1f4,_0x4dc9ad[_0x3083('0x12')]));});});}; \ No newline at end of file +var _0x5ba3=['../../config/utils','rpc','../../config/environment','jayson/promise','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','CreateSquareDetailsReport','create','body','options','raw','stringify','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x17dab8,_0x19d0ec){var _0x336fb5=function(_0x39dee4){while(--_0x39dee4){_0x17dab8['push'](_0x17dab8['shift']());}};_0x336fb5(++_0x19d0ec);}(_0x5ba3,0x140));var _0x35ba=function(_0x467c67,_0x34580c){_0x467c67=_0x467c67-0x0;var _0x46e3c9=_0x5ba3[_0x467c67];return _0x46e3c9;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var moment=require(_0x35ba('0x1'));var BPromise=require(_0x35ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ba('0x3'));var db=require(_0x35ba('0x4'))['db'];var utils=require(_0x35ba('0x5'));var logger=require('../../config/logger')(_0x35ba('0x6'));var config=require(_0x35ba('0x7'));var jayson=require(_0x35ba('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20cd5f,_0x3264d3,_0x380ffb){return new BPromise(function(_0x4c55f3,_0x22bed8){return client['request'](_0x20cd5f,_0x380ffb)[_0x35ba('0x9')](function(_0x366ddc){logger[_0x35ba('0xa')](_0x35ba('0xb'),_0x3264d3,'request\x20sent');logger[_0x35ba('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x3264d3,'request\x20sent',JSON['stringify'](_0x366ddc));if(_0x366ddc[_0x35ba('0xd')]){if(_0x366ddc[_0x35ba('0xd')][_0x35ba('0xe')]===0x1f4){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x22bed8(_0x366ddc[_0x35ba('0xd')]['message']);}logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x4c55f3(_0x366ddc['error'][_0x35ba('0xf')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x3264d3,_0x35ba('0x10'));_0x4c55f3(_0x366ddc[_0x35ba('0x11')]['message']);}})[_0x35ba('0x12')](function(_0x2b6b71){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x2b6b71);_0x22bed8(_0x2b6b71);});});}exports[_0x35ba('0x13')]=function(_0x374f91){var _0x4e96c6=this;return new Promise(function(_0x423666,_0x247440){return db['SquareDetailsReport'][_0x35ba('0x14')](_0x374f91[_0x35ba('0x15')],{'raw':_0x374f91[_0x35ba('0x16')]?_0x374f91[_0x35ba('0x16')][_0x35ba('0x17')]===undefined?!![]:![]:!![]})[_0x35ba('0x9')](function(_0x3f5e92){logger[_0x35ba('0xa')](_0x35ba('0x13'),_0x374f91);logger[_0x35ba('0xc')](_0x35ba('0x13'),_0x374f91,JSON[_0x35ba('0x18')](_0x3f5e92));_0x423666(_0x3f5e92);})['catch'](function(_0x2d3b2b){logger[_0x35ba('0xd')](_0x35ba('0x13'),_0x2d3b2b[_0x35ba('0xf')],_0x374f91);_0x247440(_0x4e96c6[_0x35ba('0xd')](0x1f4,_0x2d3b2b[_0x35ba('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 035f234..f158d03 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 _0x508a=['../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x508a,0xcd));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xa508('0x0'));var router=express[_0xa508('0x1')]();var auth=require(_0xa508('0x2'));var controller=require(_0xa508('0x3'));router[_0xa508('0x4')]('/',auth[_0xa508('0x5')](),controller['index']);router[_0xa508('0x4')](_0xa508('0x6'),auth[_0xa508('0x5')](),controller[_0xa508('0x7')]);module[_0xa508('0x8')]=router; \ No newline at end of file +var _0x7e79=['exports','../../components/auth/service','get','index','/process/:pid/kill','isAuthenticated','killProcess'];(function(_0x5b674c,_0xc560b){var _0x3da567=function(_0x495f29){while(--_0x495f29){_0x5b674c['push'](_0x5b674c['shift']());}};_0x3da567(++_0xc560b);}(_0x7e79,0xc5));var _0x97e7=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x7e79[_0x1cc8fe];return _0x230054;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x97e7('0x0'));var controller=require('./system.controller');router[_0x97e7('0x1')]('/',auth['isAuthenticated'](),controller[_0x97e7('0x2')]);router['get'](_0x97e7('0x3'),auth[_0x97e7('0x4')](),controller[_0x97e7('0x5')]);module[_0x97e7('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index fdc8d95..838e46e 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 _0xd485=['catch','format','params','pid','length','indexOf','kill','SIGINT','killProcess','systeminformation','exec','../../config/logger','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then','json'];(function(_0x5e8885,_0x4ff922){var _0x60a2ff=function(_0x1180ab){while(--_0x1180ab){_0x5e8885['push'](_0x5e8885['shift']());}};_0x60a2ff(++_0x4ff922);}(_0xd485,0x1c1));var _0x5d48=function(_0x9eab75,_0x57816c){_0x9eab75=_0x9eab75-0x0;var _0x934940=_0xd485[_0x9eab75];return _0x934940;};'use strict';var info=require(_0x5d48('0x0'));var exec=require('child_process')[_0x5d48('0x1')];var logger=require(_0x5d48('0x2'))('api');var util=require('util');var BPromise=require(_0x5d48('0x3'));var _=require(_0x5d48('0x4'));function handleError(_0x10f0ce,_0x1655f8,_0x2c6abf){_0x1655f8=_0x1655f8||0x1f4;return function(_0x291138){logger['error'](_0x5d48('0x5'),_0x2c6abf,_0x1655f8,util[_0x5d48('0x6')](_0x291138,{'showHidden':![],'depth':null}));delete _0x291138['name'];_0x10f0ce[_0x5d48('0x7')](_0x1655f8)[_0x5d48('0x8')](_0x291138);};}exports[_0x5d48('0x9')]=function(_0x30852d,_0x11a8df){return info[_0x5d48('0xa')]()[_0x5d48('0xb')](function(_0x4b7764){return _0x11a8df['status'](0xc8)[_0x5d48('0xc')](_0x4b7764);})[_0x5d48('0xd')](function(_0x2be1c2){return _0x11a8df[_0x5d48('0x7')](0x1f4)[_0x5d48('0xc')](_0x2be1c2);});};exports['killProcess']=function(_0x28c004,_0x4931b6){var _0x121db8=['components/import/cm'];return new BPromise(function(_0x204b2e,_0x2c0580){return exec(util[_0x5d48('0xe')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x28c004[_0x5d48('0xf')][_0x5d48('0x10')]),function(_0x341845,_0x1f9bc2,_0x18fb47){if(_0x341845){return _0x2c0580(_0x341845);}return _0x204b2e(_0x1f9bc2);});})[_0x5d48('0xb')](function(_0x6c1799){var _0x33e062=![];var _0x401011=_0x6c1799['split'](/\n/);for(var _0x5509f6=0x0,_0x41d0f1=_0x121db8[_0x5d48('0x11')];_0x5509f6<_0x41d0f1,_0x33e062===![];_0x5509f6+=0x1){if(_0x6c1799[_0x5d48('0x12')](_0x121db8[_0x5509f6])>=0x0){_0x33e062=!![];}}if(!_0x33e062){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x28c004[_0x5d48('0xf')]['pid']));}process[_0x5d48('0x13')](_0x28c004[_0x5d48('0xf')][_0x5d48('0x10')],_0x5d48('0x14'));return _0x4931b6[_0x5d48('0x7')](0xc8)[_0x5d48('0xc')]({'message':util[_0x5d48('0xe')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x28c004[_0x5d48('0xf')][_0x5d48('0x10')])});})[_0x5d48('0xd')](handleError(_0x4931b6,null,_0x5d48('0x15')));}; \ No newline at end of file +var _0x9137=['Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','error','name','status','then','json','components/import/cm','format','params','length','indexOf'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x9137,0x79));var _0x7913=function(_0x5dc7bb,_0x3c2edc){_0x5dc7bb=_0x5dc7bb-0x0;var _0x3569c3=_0x9137[_0x5dc7bb];return _0x3569c3;};'use strict';var info=require(_0x7913('0x0'));var exec=require(_0x7913('0x1'))[_0x7913('0x2')];var logger=require(_0x7913('0x3'))(_0x7913('0x4'));var util=require(_0x7913('0x5'));var BPromise=require(_0x7913('0x6'));var _=require('lodash');function handleError(_0xca3880,_0x268577,_0x205878){_0x268577=_0x268577||0x1f4;return function(_0x467492){logger[_0x7913('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x205878,_0x268577,util['inspect'](_0x467492,{'showHidden':![],'depth':null}));delete _0x467492[_0x7913('0x8')];_0xca3880[_0x7913('0x9')](_0x268577)['send'](_0x467492);};}exports['index']=function(_0x3490b0,_0x5c4455){return info['getAllData']()[_0x7913('0xa')](function(_0x19b280){return _0x5c4455[_0x7913('0x9')](0xc8)[_0x7913('0xb')](_0x19b280);})['catch'](function(_0x3fb94b){return _0x5c4455['status'](0x1f4)[_0x7913('0xb')](_0x3fb94b);});};exports['killProcess']=function(_0x294ba3,_0x3b82ef){var _0x25c4e2=[_0x7913('0xc')];return new BPromise(function(_0x2f06d4,_0xc332ae){return exec(util[_0x7913('0xd')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x294ba3[_0x7913('0xe')]['pid']),function(_0x4d44f6,_0x5e2e09,_0x43984f){if(_0x4d44f6){return _0xc332ae(_0x4d44f6);}return _0x2f06d4(_0x5e2e09);});})[_0x7913('0xa')](function(_0x12ab2b){var _0x1321ff=![];var _0xe03356=_0x12ab2b['split'](/\n/);for(var _0x37f983=0x0,_0x39c87b=_0x25c4e2[_0x7913('0xf')];_0x37f983<_0x39c87b,_0x1321ff===![];_0x37f983+=0x1){if(_0x12ab2b[_0x7913('0x10')](_0x25c4e2[_0x37f983])>=0x0){_0x1321ff=!![];}}if(!_0x1321ff){throw new Error(util[_0x7913('0xd')](_0x7913('0x11'),_0x294ba3[_0x7913('0xe')][_0x7913('0x12')]));}process[_0x7913('0x13')](_0x294ba3['params'][_0x7913('0x12')],_0x7913('0x14'));return _0x3b82ef[_0x7913('0x9')](0xc8)['json']({'message':util[_0x7913('0xd')](_0x7913('0x15'),_0x294ba3[_0x7913('0xe')]['pid'])});})[_0x7913('0x16')](handleError(_0x3b82ef,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 5a723be..72861f3 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 _0x930b=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./tag.controller','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x384b41,_0x523153){var _0x13583f=function(_0x5ddf34){while(--_0x5ddf34){_0x384b41['push'](_0x384b41['shift']());}};_0x13583f(++_0x523153);}(_0x930b,0xc1));var _0xb930=function(_0x2aadcc,_0x4db248){_0x2aadcc=_0x2aadcc-0x0;var _0x37dea7=_0x930b[_0x2aadcc];return _0x37dea7;};'use strict';var multer=require(_0xb930('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb930('0x1'));var express=require(_0xb930('0x2'));var router=express[_0xb930('0x3')]();var fs_extra=require(_0xb930('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb930('0x5'));var config=require('../../config/environment');var controller=require(_0xb930('0x6'));router[_0xb930('0x7')]('/',auth['isAuthenticated'](),controller[_0xb930('0x8')]);router['get'](_0xb930('0x9'),auth[_0xb930('0xa')](),controller[_0xb930('0xb')]);router[_0xb930('0xc')]('/',auth[_0xb930('0xa')](),controller[_0xb930('0xd')]);router[_0xb930('0xe')](_0xb930('0x9'),auth['isAuthenticated'](),controller[_0xb930('0xf')]);router[_0xb930('0x10')](_0xb930('0x9'),auth[_0xb930('0xa')](),controller[_0xb930('0x11')]);module[_0xb930('0x12')]=router; \ No newline at end of file +var _0xfa25=['post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show'];(function(_0x5f38dc,_0x4793eb){var _0x2c2228=function(_0x5403a7){while(--_0x5403a7){_0x5f38dc['push'](_0x5f38dc['shift']());}};_0x2c2228(++_0x4793eb);}(_0xfa25,0xd1));var _0x5fa2=function(_0x57db6d,_0x246461){_0x57db6d=_0x57db6d-0x0;var _0x4ac77e=_0xfa25[_0x57db6d];return _0x4ac77e;};'use strict';var multer=require('multer');var util=require(_0x5fa2('0x0'));var path=require(_0x5fa2('0x1'));var timeout=require(_0x5fa2('0x2'));var express=require(_0x5fa2('0x3'));var router=express[_0x5fa2('0x4')]();var fs_extra=require(_0x5fa2('0x5'));var auth=require(_0x5fa2('0x6'));var interaction=require(_0x5fa2('0x7'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x5fa2('0x8')]('/',auth[_0x5fa2('0x9')](),controller['index']);router['get'](_0x5fa2('0xa'),auth['isAuthenticated'](),controller[_0x5fa2('0xb')]);router[_0x5fa2('0xc')]('/',auth[_0x5fa2('0x9')](),controller['create']);router[_0x5fa2('0xd')](_0x5fa2('0xa'),auth[_0x5fa2('0x9')](),controller['update']);router[_0x5fa2('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5fa2('0xf')]);module[_0x5fa2('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 0d0cf96..626ac60 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 _0xe9e8=['name','#0091EA','sequelize','exports','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x7c8fee,_0x34f571){_0x7c8fee=_0x7c8fee-0x0;var _0x21eedc=_0xe9e8[_0x7c8fee];return _0x21eedc;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'name':{'type':Sequelize[_0x8e9e('0x2')],'unique':_0x8e9e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8e9e('0x2')],'defaultValue':_0x8e9e('0x4')},'description':{'type':Sequelize[_0x8e9e('0x2')]}}; \ No newline at end of file +var _0x0c1a=['exports','STRING','#0091EA','sequelize'];(function(_0x1211ca,_0x5c51c4){var _0xe206ad=function(_0x55e619){while(--_0x55e619){_0x1211ca['push'](_0x1211ca['shift']());}};_0xe206ad(++_0x5c51c4);}(_0x0c1a,0x127));var _0xa0c1=function(_0x32c3a7,_0x10c4ae){_0x32c3a7=_0x32c3a7-0x0;var _0xfbfc2b=_0x0c1a[_0x32c3a7];return _0xfbfc2b;};'use strict';var Sequelize=require(_0xa0c1('0x0'));module[_0xa0c1('0x1')]={'name':{'type':Sequelize[_0xa0c1('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xa0c1('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e5535f7..0666247 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 _0xb43b=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','keys','include','options','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','sendStatus','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields'];(function(_0x22b509,_0x28240b){var _0x14cedf=function(_0x4fdcb5){while(--_0x4fdcb5){_0x22b509['push'](_0x22b509['shift']());}};_0x14cedf(++_0x28240b);}(_0xb43b,0xbf));var _0xbb43=function(_0x391fac,_0x141dbe){_0x391fac=_0x391fac-0x0;var _0x2a522c=_0xb43b[_0x391fac];return _0x2a522c;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x1'));var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require(_0xbb43('0x9'));var csv=require(_0xbb43('0xa'));var ejs=require(_0xbb43('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb43('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb43('0xd'));var deskjs=require(_0xbb43('0xe'));var toCsv=require(_0xbb43('0xa'));var querystring=require(_0xbb43('0xf'));var Papa=require(_0xbb43('0x10'));var Redis=require('ioredis');var authService=require(_0xbb43('0x11'));var qs=require(_0xbb43('0x12'));var as=require(_0xbb43('0x13'));var hardwareService=require(_0xbb43('0x14'));var logger=require('../../config/logger')(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2867fb,_0x5d0ccc){_0x5d0ccc=_0x5d0ccc||0xcc;return function(_0x6be368){if(_0x6be368){return _0x2867fb['sendStatus'](_0x5d0ccc);}return _0x2867fb[_0xbb43('0x17')](_0x5d0ccc)[_0xbb43('0x18')]();};}function respondWithResult(_0x3ce968,_0x3327bc){_0x3327bc=_0x3327bc||0xc8;return function(_0x2e2517){if(_0x2e2517){return _0x3ce968['status'](_0x3327bc)[_0xbb43('0x19')](_0x2e2517);}};}function respondWithFilteredResult(_0x4ac25c,_0x199726){return function(_0x32425c){if(_0x32425c){var _0x15182b=typeof _0x199726[_0xbb43('0x1a')]===_0xbb43('0x1b')&&typeof _0x199726[_0xbb43('0x1c')]===_0xbb43('0x1b');var _0x209c9c=_0x32425c[_0xbb43('0x1d')];var _0x4c223b=_0x15182b?0x0:_0x199726[_0xbb43('0x1a')];var _0x4cb0b2=_0x15182b?_0x32425c[_0xbb43('0x1d')]:_0x199726['offset']+_0x199726[_0xbb43('0x1c')];var _0x5f4b4f;if(_0x4cb0b2>=_0x209c9c){_0x4cb0b2=_0x209c9c;_0x5f4b4f=0xc8;}else{_0x5f4b4f=0xce;}_0x4ac25c[_0xbb43('0x17')](_0x5f4b4f);return _0x4ac25c[_0xbb43('0x1e')]('Content-Range',_0x4c223b+'-'+_0x4cb0b2+'/'+_0x209c9c)[_0xbb43('0x19')](_0x32425c);}return null;};}function patchUpdates(_0x6cdc26){return function(_0x398ce5){try{jsonpatch[_0xbb43('0x1f')](_0x398ce5,_0x6cdc26,!![]);}catch(_0x22c5d1){return BPromise[_0xbb43('0x20')](_0x22c5d1);}return _0x398ce5[_0xbb43('0x21')]();};}function saveUpdates(_0x1e83cd,_0x3409d0){return function(_0x3cb6d1){if(_0x3cb6d1){return _0x3cb6d1[_0xbb43('0x22')](_0x1e83cd)[_0xbb43('0x23')](function(_0x36992f){return _0x36992f;});}return null;};}function removeEntity(_0x37beb0,_0x500af4){return function(_0x28b3e4){if(_0x28b3e4){return _0x28b3e4[_0xbb43('0x24')]()['then'](function(){var _0x464b4a=_0x28b3e4[_0xbb43('0x25')]({'plain':!![]});var _0x25279b='Tags';return db['UserProfileResource'][_0xbb43('0x24')]({'where':{'type':_0x25279b,'resourceId':_0x464b4a['id']}})[_0xbb43('0x23')](function(){return _0x28b3e4;});})['then'](function(){_0x37beb0['status'](0xcc)[_0xbb43('0x18')]();});}};}function handleEntityNotFound(_0xb9fe3b,_0x268fb5){return function(_0x4bb859){if(!_0x4bb859){_0xb9fe3b[_0xbb43('0x26')](0x194);}return _0x4bb859;};}function handleError(_0x426cec,_0x2dcc60){_0x2dcc60=_0x2dcc60||0x1f4;return function(_0x1a6e2b){logger['error'](_0x1a6e2b[_0xbb43('0x27')]);if(_0x1a6e2b[_0xbb43('0x28')]){delete _0x1a6e2b[_0xbb43('0x28')];}_0x426cec[_0xbb43('0x17')](_0x2dcc60)[_0xbb43('0x29')](_0x1a6e2b);};}exports[_0xbb43('0x2a')]=function(_0x2860d8,_0x48986d){var _0x3b2290={},_0x209244={},_0x3c46c6={'count':0x0,'rows':[]};var _0x5b8a7d=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')],function(_0x168374){return{'name':_0x168374[_0xbb43('0x2e')],'type':_0x168374[_0xbb43('0x2f')][_0xbb43('0x30')]};});_0x209244[_0xbb43('0x31')]=_[_0xbb43('0x2b')](_0x5b8a7d,'name');_0x209244['query']=_['keys'](_0x2860d8['query']);_0x209244[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x209244[_0xbb43('0x31')],_0x209244[_0xbb43('0x34')]);_0x3b2290[_0xbb43('0x35')]=_[_0xbb43('0x33')](_0x209244[_0xbb43('0x31')],qs[_0xbb43('0x36')](_0x2860d8['query'][_0xbb43('0x36')]));_0x3b2290[_0xbb43('0x35')]=_0x3b2290[_0xbb43('0x35')][_0xbb43('0x37')]?_0x3b2290['attributes']:_0x209244[_0xbb43('0x31')];if(!_0x2860d8[_0xbb43('0x34')][_0xbb43('0x38')](_0xbb43('0x39'))){_0x3b2290['limit']=qs[_0xbb43('0x1c')](_0x2860d8['query'][_0xbb43('0x1c')]);_0x3b2290[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x2860d8[_0xbb43('0x34')][_0xbb43('0x1a')]);}_0x3b2290[_0xbb43('0x3a')]=qs[_0xbb43('0x3b')](_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3b')]);_0x3b2290[_0xbb43('0x3c')]=qs[_0xbb43('0x32')](_[_0xbb43('0x3d')](_0x2860d8['query'],_0x209244[_0xbb43('0x32')]),_0x5b8a7d);if(_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3e')]){_0x3b2290[_0xbb43('0x3c')]=_[_0xbb43('0x3f')](_0x3b2290[_0xbb43('0x3c')],{'$or':_[_0xbb43('0x2b')](_0x5b8a7d,function(_0x3d7d56){if(_0x3d7d56[_0xbb43('0x2f')]!==_0xbb43('0x40')){var _0x1fe204={};_0x1fe204[_0x3d7d56[_0xbb43('0x28')]]={'$like':'%'+_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3e')]+'%'};return _0x1fe204;}})});}_0x3b2290=_[_0xbb43('0x3f')]({},_0x3b2290,_0x2860d8['options']);var _0x4807a3={'where':_0x3b2290[_0xbb43('0x3c')]};return db[_0xbb43('0x2c')][_0xbb43('0x1d')](_0x4807a3)[_0xbb43('0x23')](function(_0x4b32c9){_0x3c46c6['count']=_0x4b32c9;if(_0x2860d8[_0xbb43('0x34')][_0xbb43('0x41')]){_0x3b2290['include']=[{'all':!![]}];}return db['Tag'][_0xbb43('0x42')](_0x3b2290);})[_0xbb43('0x23')](function(_0x26aa10){_0x3c46c6[_0xbb43('0x43')]=_0x26aa10;return _0x3c46c6;})[_0xbb43('0x23')](respondWithFilteredResult(_0x48986d,_0x3b2290))['catch'](handleError(_0x48986d,null));};exports['show']=function(_0x2ea37b,_0x41fed6){var _0x3f48a1={'raw':!![],'where':{'id':_0x2ea37b[_0xbb43('0x44')]['id']}},_0x2d1256={};_0x2d1256[_0xbb43('0x31')]=_[_0xbb43('0x45')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x2d1256[_0xbb43('0x34')]=_['keys'](_0x2ea37b['query']);_0x2d1256[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x2d1256['model'],_0x2d1256[_0xbb43('0x34')]);_0x3f48a1[_0xbb43('0x35')]=_[_0xbb43('0x33')](_0x2d1256[_0xbb43('0x31')],qs[_0xbb43('0x36')](_0x2ea37b[_0xbb43('0x34')][_0xbb43('0x36')]));_0x3f48a1['attributes']=_0x3f48a1[_0xbb43('0x35')][_0xbb43('0x37')]?_0x3f48a1['attributes']:_0x2d1256[_0xbb43('0x31')];if(_0x2ea37b[_0xbb43('0x34')]['includeAll']){_0x3f48a1[_0xbb43('0x46')]=[{'all':!![]}];}_0x3f48a1=_[_0xbb43('0x3f')]({},_0x3f48a1,_0x2ea37b[_0xbb43('0x47')]);return db[_0xbb43('0x2c')][_0xbb43('0x48')](_0x3f48a1)[_0xbb43('0x23')](handleEntityNotFound(_0x41fed6,null))[_0xbb43('0x23')](respondWithResult(_0x41fed6,null))[_0xbb43('0x49')](handleError(_0x41fed6,null));};exports[_0xbb43('0x4a')]=function(_0x2f044f,_0x38cc4d){return db[_0xbb43('0x2c')]['create'](_0x2f044f[_0xbb43('0x4b')],{})[_0xbb43('0x23')](function(_0x50096a){var _0x7089bb=_0x2f044f['user'][_0xbb43('0x25')]({'plain':!![]});if(!_0x7089bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7089bb[_0xbb43('0x4c')]==='user'){var _0x21f78b=_0x50096a[_0xbb43('0x25')]({'plain':!![]});var _0x26586c='Tags';return db[_0xbb43('0x4d')][_0xbb43('0x48')]({'where':{'name':_0x26586c,'userProfileId':_0x7089bb[_0xbb43('0x4e')]},'raw':!![]})['then'](function(_0xd485c7){if(_0xd485c7&&_0xd485c7[_0xbb43('0x4f')]===0x0){return db['UserProfileResource'][_0xbb43('0x4a')]({'name':_0x21f78b['name'],'resourceId':_0x21f78b['id'],'type':_0xd485c7[_0xbb43('0x28')],'sectionId':_0xd485c7['id']},{})[_0xbb43('0x23')](function(){return _0x50096a;});}else{return _0x50096a;}})['catch'](function(_0x13731d){logger[_0xbb43('0x50')](_0xbb43('0x51'),_0x13731d);throw _0x13731d;});}return _0x50096a;})['then'](respondWithResult(_0x38cc4d,0xc9))[_0xbb43('0x49')](handleError(_0x38cc4d,null));};exports['update']=function(_0x3433ff,_0x451007){if(_0x3433ff[_0xbb43('0x4b')]['id']){delete _0x3433ff['body']['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x48')]({'where':{'id':_0x3433ff['params']['id']}})['then'](handleEntityNotFound(_0x451007,null))[_0xbb43('0x23')](saveUpdates(_0x3433ff[_0xbb43('0x4b')],null))['then'](respondWithResult(_0x451007,null))['catch'](handleError(_0x451007,null));};exports[_0xbb43('0x24')]=function(_0x51ca4f,_0x30908e){return db[_0xbb43('0x2c')][_0xbb43('0x48')]({'where':{'id':_0x51ca4f['params']['id']}})['then'](handleEntityNotFound(_0x30908e,null))['then'](removeEntity(_0x30908e,null))['catch'](handleError(_0x30908e,null));}; \ No newline at end of file +var _0xedd9=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','get','Tags','end','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','keys','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0xaa61fb,_0x50a711){var _0x58208a=function(_0x2b7acf){while(--_0x2b7acf){_0xaa61fb['push'](_0xaa61fb['shift']());}};_0x58208a(++_0x50a711);}(_0xedd9,0xfc));var _0x9edd=function(_0x108909,_0x9d6e){_0x108909=_0x108909-0x0;var _0x2b357f=_0xedd9[_0x108909];return _0x2b357f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){var _0xeaf55a=_0x339a0d[_0x9edd('0x22')]({'plain':!![]});var _0x2f9f86=_0x9edd('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f9f86,'resourceId':_0xeaf55a['id']}})[_0x9edd('0x21')](function(){return _0x339a0d;});})[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x24')]();});}};}function handleEntityNotFound(_0x3c2227,_0x4fe471){return function(_0x57a2cc){if(!_0x57a2cc){_0x3c2227[_0x9edd('0x18')](0x194);}return _0x57a2cc;};}function handleError(_0x257a26,_0x1c762c){_0x1c762c=_0x1c762c||0x1f4;return function(_0x52746a){logger[_0x9edd('0x25')](_0x52746a[_0x9edd('0x26')]);if(_0x52746a[_0x9edd('0x27')]){delete _0x52746a[_0x9edd('0x27')];}_0x257a26['status'](_0x1c762c)[_0x9edd('0x28')](_0x52746a);};}exports[_0x9edd('0x29')]=function(_0xbe87e1,_0x12c1bc){var _0xbbf08f={},_0x42e664={},_0x209aba={'count':0x0,'rows':[]};var _0x1fba7b=_[_0x9edd('0x2a')](db[_0x9edd('0x2b')][_0x9edd('0x2c')],function(_0x138002){return{'name':_0x138002[_0x9edd('0x2d')],'type':_0x138002[_0x9edd('0x2e')][_0x9edd('0x2f')]};});_0x42e664['model']=_[_0x9edd('0x2a')](_0x1fba7b,_0x9edd('0x27'));_0x42e664[_0x9edd('0x30')]=_['keys'](_0xbe87e1[_0x9edd('0x30')]);_0x42e664[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x42e664[_0x9edd('0x33')],_0x42e664[_0x9edd('0x30')]);_0xbbf08f[_0x9edd('0x34')]=_[_0x9edd('0x32')](_0x42e664[_0x9edd('0x33')],qs[_0x9edd('0x35')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x35')]));_0xbbf08f[_0x9edd('0x34')]=_0xbbf08f[_0x9edd('0x34')][_0x9edd('0x36')]?_0xbbf08f['attributes']:_0x42e664[_0x9edd('0x33')];if(!_0xbe87e1['query'][_0x9edd('0x37')](_0x9edd('0x38'))){_0xbbf08f[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0xbe87e1[_0x9edd('0x30')]['limit']);_0xbbf08f[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x1b')]);}_0xbbf08f[_0x9edd('0x39')]=qs[_0x9edd('0x3a')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x3a')]);_0xbbf08f[_0x9edd('0x3b')]=qs[_0x9edd('0x31')](_['pick'](_0xbe87e1[_0x9edd('0x30')],_0x42e664['filters']),_0x1fba7b);if(_0xbe87e1[_0x9edd('0x30')]['filter']){_0xbbf08f[_0x9edd('0x3b')]=_[_0x9edd('0x3c')](_0xbbf08f[_0x9edd('0x3b')],{'$or':_['map'](_0x1fba7b,function(_0x2e85aa){if(_0x2e85aa[_0x9edd('0x2e')]!==_0x9edd('0x3d')){var _0x48958a={};_0x48958a[_0x2e85aa[_0x9edd('0x27')]]={'$like':'%'+_0xbe87e1['query'][_0x9edd('0x3e')]+'%'};return _0x48958a;}})});}_0xbbf08f=_[_0x9edd('0x3c')]({},_0xbbf08f,_0xbe87e1['options']);var _0x315f52={'where':_0xbbf08f[_0x9edd('0x3b')]};return db[_0x9edd('0x2b')][_0x9edd('0x1e')](_0x315f52)['then'](function(_0x449f01){_0x209aba['count']=_0x449f01;if(_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x3f')]){_0xbbf08f['include']=[{'all':!![]}];}return db[_0x9edd('0x2b')]['findAll'](_0xbbf08f);})['then'](function(_0x369b69){_0x209aba[_0x9edd('0x40')]=_0x369b69;return _0x209aba;})[_0x9edd('0x21')](respondWithFilteredResult(_0x12c1bc,_0xbbf08f))[_0x9edd('0x41')](handleError(_0x12c1bc,null));};exports[_0x9edd('0x42')]=function(_0x4737ae,_0x3ff512){var _0x75efbe={'raw':!![],'where':{'id':_0x4737ae[_0x9edd('0x43')]['id']}},_0x18c149={};_0x18c149[_0x9edd('0x33')]=_[_0x9edd('0x44')](db[_0x9edd('0x2b')][_0x9edd('0x2c')]);_0x18c149[_0x9edd('0x30')]=_['keys'](_0x4737ae[_0x9edd('0x30')]);_0x18c149[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x18c149[_0x9edd('0x33')],_0x18c149[_0x9edd('0x30')]);_0x75efbe[_0x9edd('0x34')]=_[_0x9edd('0x32')](_0x18c149['model'],qs['fields'](_0x4737ae['query'][_0x9edd('0x35')]));_0x75efbe['attributes']=_0x75efbe[_0x9edd('0x34')][_0x9edd('0x36')]?_0x75efbe[_0x9edd('0x34')]:_0x18c149[_0x9edd('0x33')];if(_0x4737ae[_0x9edd('0x30')]['includeAll']){_0x75efbe[_0x9edd('0x45')]=[{'all':!![]}];}_0x75efbe=_[_0x9edd('0x3c')]({},_0x75efbe,_0x4737ae[_0x9edd('0x46')]);return db['Tag'][_0x9edd('0x47')](_0x75efbe)[_0x9edd('0x21')](handleEntityNotFound(_0x3ff512,null))[_0x9edd('0x21')](respondWithResult(_0x3ff512,null))[_0x9edd('0x41')](handleError(_0x3ff512,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){return db[_0x9edd('0x2b')][_0x9edd('0x48')](_0x35bdec['body'],{})[_0x9edd('0x21')](function(_0x8d8701){var _0x4bb324=_0x35bdec[_0x9edd('0x49')][_0x9edd('0x22')]({'plain':!![]});if(!_0x4bb324)throw new Error(_0x9edd('0x4a'));if(_0x4bb324['role']===_0x9edd('0x49')){var _0x151157=_0x8d8701[_0x9edd('0x22')]({'plain':!![]});var _0x28c7bd='Tags';return db[_0x9edd('0x4b')][_0x9edd('0x47')]({'where':{'name':_0x28c7bd,'userProfileId':_0x4bb324[_0x9edd('0x4c')]},'raw':!![]})['then'](function(_0x16951a){if(_0x16951a&&_0x16951a[_0x9edd('0x4d')]===0x0){return db['UserProfileResource'][_0x9edd('0x48')]({'name':_0x151157['name'],'resourceId':_0x151157['id'],'type':_0x16951a[_0x9edd('0x27')],'sectionId':_0x16951a['id']},{})[_0x9edd('0x21')](function(){return _0x8d8701;});}else{return _0x8d8701;}})[_0x9edd('0x41')](function(_0x3fcdf5){logger[_0x9edd('0x25')](_0x9edd('0x4e'),_0x3fcdf5);throw _0x3fcdf5;});}return _0x8d8701;})[_0x9edd('0x21')](respondWithResult(_0x4d4f33,0xc9))[_0x9edd('0x41')](handleError(_0x4d4f33,null));};exports[_0x9edd('0x4f')]=function(_0x25d9cc,_0x31272d){if(_0x25d9cc['body']['id']){delete _0x25d9cc[_0x9edd('0x50')]['id'];}return db[_0x9edd('0x2b')][_0x9edd('0x47')]({'where':{'id':_0x25d9cc['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x31272d,null))['then'](saveUpdates(_0x25d9cc['body'],null))['then'](respondWithResult(_0x31272d,null))[_0x9edd('0x41')](handleError(_0x31272d,null));};exports[_0x9edd('0x51')]=function(_0x366316,_0x35ddb3){return db['Tag']['find']({'where':{'id':_0x366316['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x35ddb3,null))[_0x9edd('0x21')](removeEntity(_0x35ddb3,null))[_0x9edd('0x41')](handleError(_0x35ddb3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2fede1b..308bf35 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 _0xb642=['../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','Tag','tools_tags','util'];(function(_0x492da9,_0x32a7f0){var _0x59c40d=function(_0x253faf){while(--_0x253faf){_0x492da9['push'](_0x492da9['shift']());}};_0x59c40d(++_0x32a7f0);}(_0xb642,0x15d));var _0x2b64=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xb642[_0x4709c0];return _0x13348b;};'use strict';var _=require('lodash');var util=require(_0x2b64('0x0'));var logger=require(_0x2b64('0x1'))('api');var moment=require(_0x2b64('0x2'));var BPromise=require(_0x2b64('0x3'));var rp=require(_0x2b64('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2b64('0x5'));var attributes=require('./tag.attributes');module[_0x2b64('0x6')]=function(_0x4331f0,_0x4dedfc){return _0x4331f0[_0x2b64('0x7')](_0x2b64('0x8'),attributes,{'tableName':_0x2b64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf51c=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf51c,0x145));var _0xcf51=function(_0x2d9259,_0x42a805){_0x2d9259=_0x2d9259-0x0;var _0xe4c0df=_0xf51c[_0x2d9259];return _0xe4c0df;};'use strict';var _=require(_0xcf51('0x0'));var util=require(_0xcf51('0x1'));var logger=require(_0xcf51('0x2'))(_0xcf51('0x3'));var moment=require(_0xcf51('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf51('0x5'));var rimraf=require(_0xcf51('0x6'));var config=require(_0xcf51('0x7'));var attributes=require(_0xcf51('0x8'));module[_0xcf51('0x9')]=function(_0x4a04ac,_0x3bd644){return _0x4a04ac[_0xcf51('0xa')](_0xcf51('0xb'),attributes,{'tableName':_0xcf51('0xc'),'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 1e2bff2..e535e32 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 _0xdd0c=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x48bfa8,_0x2ca87f){var _0x3d3068=function(_0x5a9d3b){while(--_0x5a9d3b){_0x48bfa8['push'](_0x48bfa8['shift']());}};_0x3d3068(++_0x2ca87f);}(_0xdd0c,0x165));var _0xcdd0=function(_0xc7e18e,_0x93b464){_0xc7e18e=_0xc7e18e-0x0;var _0x48ce58=_0xdd0c[_0xc7e18e];return _0x48ce58;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var moment=require(_0xcdd0('0x1'));var BPromise=require(_0xcdd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdd0('0x4'));var logger=require(_0xcdd0('0x5'))(_0xcdd0('0x6'));var config=require(_0xcdd0('0x7'));var jayson=require(_0xcdd0('0x8'));var client=jayson['client'][_0xcdd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f5d,_0x1fd3f6,_0x15c402){return new BPromise(function(_0x337496,_0x557a65){return client[_0xcdd0('0xa')](_0x1b6f5d,_0x15c402)['then'](function(_0x5db720){logger[_0xcdd0('0xb')](_0xcdd0('0xc'),_0x1fd3f6,_0xcdd0('0xd'));logger[_0xcdd0('0xe')](_0xcdd0('0xf'),_0x1fd3f6,_0xcdd0('0xd'),JSON[_0xcdd0('0x10')](_0x5db720));if(_0x5db720[_0xcdd0('0x11')]){if(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x557a65(_0x5db720['error'][_0xcdd0('0x13')]);}logger[_0xcdd0('0x11')]('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x337496(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);}else{logger[_0xcdd0('0xb')]('Tag,\x20%s,\x20%s',_0x1fd3f6,'request\x20sent');_0x337496(_0x5db720[_0xcdd0('0x14')][_0xcdd0('0x13')]);}})[_0xcdd0('0x15')](function(_0xf7af04){logger[_0xcdd0('0x11')](_0xcdd0('0xc'),_0x1fd3f6,_0xf7af04);_0x557a65(_0xf7af04);});});} \ No newline at end of file +var _0xeec6=['then','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0xeec6,0x1c2));var _0x6eec=function(_0x13b70f,_0x5c1116){_0x13b70f=_0x13b70f-0x0;var _0x51427c=_0xeec6[_0x13b70f];return _0x51427c;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('Tag,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 391a285..27dc04d 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 67cf3fa..0fd972d 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(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 _0xd8b0=['exports','sequelize'];(function(_0x1a62d9,_0x220f51){var _0x33a37c=function(_0x18ede9){while(--_0x18ede9){_0x1a62d9['push'](_0x1a62d9['shift']());}};_0x33a37c(++_0x220f51);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index ed25448..060bcac 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 _0x5f19=['upsert','SIP/%s','all','UserVoicePrefix','VoicePrefixId','spread','Fax','Whatsapp','emit','removeAgents','getAgents','order','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./team.socket','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','Team','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','TeamVoicePrefix','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','addQueues','body','isValidChannel','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Openchannel','through','penalty','defaults','TeamVoiceQueue','User','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5f19,0x1ce));var _0x95f1=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0x5f19[_0x237f8b];return _0x423f94;};'use strict';var emlformat=require(_0x95f1('0x0'));var rimraf=require(_0x95f1('0x1'));var zipdir=require(_0x95f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95f1('0x3'));var moment=require('moment');var BPromise=require(_0x95f1('0x4'));var Mustache=require(_0x95f1('0x5'));var util=require(_0x95f1('0x6'));var path=require(_0x95f1('0x7'));var sox=require(_0x95f1('0x8'));var csv=require(_0x95f1('0x9'));var ejs=require(_0x95f1('0xa'));var fs=require('fs');var fs_extra=require(_0x95f1('0xb'));var _=require('lodash');var squel=require(_0x95f1('0xc'));var crypto=require('crypto');var jsforce=require(_0x95f1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x95f1('0xe'));var Papa=require(_0x95f1('0xf'));var Redis=require(_0x95f1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x95f1('0x11'));var as=require(_0x95f1('0x12'));var hardwareService=require(_0x95f1('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x95f1('0x14'));var licenseUtil=require(_0x95f1('0x15'));var db=require(_0x95f1('0x16'))['db'];config[_0x95f1('0x17')]=_['defaults'](config[_0x95f1('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x95f1('0x18'))(new Redis(config[_0x95f1('0x17')]));require(_0x95f1('0x19'))['register'](socket);function respondWithStatusCode(_0x25b144,_0x36f9ca){_0x36f9ca=_0x36f9ca||0xcc;return function(_0x2bd462){if(_0x2bd462){return _0x25b144[_0x95f1('0x1a')](_0x36f9ca);}return _0x25b144['status'](_0x36f9ca)[_0x95f1('0x1b')]();};}function respondWithResult(_0x21634a,_0x35f309){_0x35f309=_0x35f309||0xc8;return function(_0x32b0a6){if(_0x32b0a6){return _0x21634a[_0x95f1('0x1c')](_0x35f309)['json'](_0x32b0a6);}};}function respondWithFilteredResult(_0x5e56c5,_0x35e4c3){return function(_0x7bb812){if(_0x7bb812){var _0x2bf8b4=typeof _0x35e4c3[_0x95f1('0x1d')]===_0x95f1('0x1e')&&typeof _0x35e4c3[_0x95f1('0x1f')]===_0x95f1('0x1e');var _0x3add56=_0x7bb812[_0x95f1('0x20')];var _0x5eabf3=_0x2bf8b4?0x0:_0x35e4c3['offset'];var _0x4d7c37=_0x2bf8b4?_0x7bb812[_0x95f1('0x20')]:_0x35e4c3['offset']+_0x35e4c3[_0x95f1('0x1f')];var _0x5f4a45;if(_0x4d7c37>=_0x3add56){_0x4d7c37=_0x3add56;_0x5f4a45=0xc8;}else{_0x5f4a45=0xce;}_0x5e56c5[_0x95f1('0x1c')](_0x5f4a45);return _0x5e56c5[_0x95f1('0x21')](_0x95f1('0x22'),_0x5eabf3+'-'+_0x4d7c37+'/'+_0x3add56)[_0x95f1('0x23')](_0x7bb812);}return null;};}function patchUpdates(_0x308372){return function(_0x23b303){try{jsonpatch['apply'](_0x23b303,_0x308372,!![]);}catch(_0x349c5f){return BPromise[_0x95f1('0x24')](_0x349c5f);}return _0x23b303[_0x95f1('0x25')]();};}function saveUpdates(_0x5c1524,_0x4bc8ce){return function(_0x3afcb9){if(_0x3afcb9){return _0x3afcb9[_0x95f1('0x26')](_0x5c1524)[_0x95f1('0x27')](function(_0x152f45){return _0x152f45;});}return null;};}function handleEntityNotFound(_0x4c7465,_0x276b27){return function(_0x5060a8){if(!_0x5060a8){_0x4c7465['sendStatus'](0x194);}return _0x5060a8;};}function handleError(_0x5bacf7,_0x22102e){_0x22102e=_0x22102e||0x1f4;return function(_0x334bba){logger[_0x95f1('0x28')](_0x334bba[_0x95f1('0x29')]);if(_0x334bba[_0x95f1('0x2a')]){delete _0x334bba['name'];}_0x5bacf7[_0x95f1('0x1c')](_0x22102e)[_0x95f1('0x2b')](_0x334bba);};}exports[_0x95f1('0x2c')]=function(_0x480ad2,_0x475b8a){var _0x4ea62c={},_0x5a55b4={},_0x455e06={'count':0x0,'rows':[]};var _0x2c3d1d=_[_0x95f1('0x2d')](db['Team']['rawAttributes'],function(_0x2ac589){return{'name':_0x2ac589[_0x95f1('0x2e')],'type':_0x2ac589['type'][_0x95f1('0x2f')]};});_0x5a55b4[_0x95f1('0x30')]=_[_0x95f1('0x2d')](_0x2c3d1d,_0x95f1('0x2a'));_0x5a55b4[_0x95f1('0x31')]=_[_0x95f1('0x32')](_0x480ad2[_0x95f1('0x31')]);_0x5a55b4[_0x95f1('0x33')]=_['intersection'](_0x5a55b4[_0x95f1('0x30')],_0x5a55b4[_0x95f1('0x31')]);_0x4ea62c['attributes']=_[_0x95f1('0x34')](_0x5a55b4[_0x95f1('0x30')],qs['fields'](_0x480ad2[_0x95f1('0x31')][_0x95f1('0x35')]));_0x4ea62c[_0x95f1('0x36')]=_0x4ea62c[_0x95f1('0x36')][_0x95f1('0x37')]?_0x4ea62c[_0x95f1('0x36')]:_0x5a55b4[_0x95f1('0x30')];if(!_0x480ad2['query'][_0x95f1('0x38')](_0x95f1('0x39'))){_0x4ea62c[_0x95f1('0x1f')]=qs[_0x95f1('0x1f')](_0x480ad2[_0x95f1('0x31')][_0x95f1('0x1f')]);_0x4ea62c[_0x95f1('0x1d')]=qs[_0x95f1('0x1d')](_0x480ad2[_0x95f1('0x31')][_0x95f1('0x1d')]);}_0x4ea62c['order']=qs[_0x95f1('0x3a')](_0x480ad2['query']['sort']);_0x4ea62c[_0x95f1('0x3b')]=qs['filters'](_[_0x95f1('0x3c')](_0x480ad2[_0x95f1('0x31')],_0x5a55b4[_0x95f1('0x33')]),_0x2c3d1d);if(_0x480ad2[_0x95f1('0x31')][_0x95f1('0x3d')]){_0x4ea62c['where']=_[_0x95f1('0x3e')](_0x4ea62c[_0x95f1('0x3b')],{'$or':_[_0x95f1('0x2d')](_0x2c3d1d,function(_0x577357){if(_0x577357[_0x95f1('0x3f')]!==_0x95f1('0x40')){var _0x27388c={};_0x27388c[_0x577357[_0x95f1('0x2a')]]={'$like':'%'+_0x480ad2['query'][_0x95f1('0x3d')]+'%'};return _0x27388c;}})});}_0x4ea62c=_[_0x95f1('0x3e')]({},_0x4ea62c,_0x480ad2['options']);var _0x5c5dab={'where':_0x4ea62c['where']};return db[_0x95f1('0x41')][_0x95f1('0x20')](_0x5c5dab)['then'](function(_0x445a63){_0x455e06['count']=_0x445a63;if(_0x480ad2[_0x95f1('0x31')][_0x95f1('0x42')]){_0x4ea62c[_0x95f1('0x43')]=[{'all':!![]}];}return db['Team'][_0x95f1('0x44')](_0x4ea62c);})[_0x95f1('0x27')](function(_0x1b4428){_0x455e06[_0x95f1('0x45')]=_0x1b4428;return _0x455e06;})[_0x95f1('0x27')](respondWithFilteredResult(_0x475b8a,_0x4ea62c))[_0x95f1('0x46')](handleError(_0x475b8a,null));};exports[_0x95f1('0x47')]=function(_0x50e5a2,_0x242b7a){var _0x89f6aa={'raw':![],'where':{'id':_0x50e5a2[_0x95f1('0x48')]['id']}},_0x44bd9e={};_0x44bd9e[_0x95f1('0x30')]=_[_0x95f1('0x32')](db[_0x95f1('0x41')][_0x95f1('0x49')]);_0x44bd9e[_0x95f1('0x31')]=_[_0x95f1('0x32')](_0x50e5a2['query']);_0x44bd9e[_0x95f1('0x33')]=_[_0x95f1('0x34')](_0x44bd9e['model'],_0x44bd9e['query']);_0x89f6aa[_0x95f1('0x36')]=_['intersection'](_0x44bd9e[_0x95f1('0x30')],qs['fields'](_0x50e5a2[_0x95f1('0x31')][_0x95f1('0x35')]));_0x89f6aa[_0x95f1('0x36')]=_0x89f6aa['attributes'][_0x95f1('0x37')]?_0x89f6aa[_0x95f1('0x36')]:_0x44bd9e['model'];if(_0x50e5a2[_0x95f1('0x31')][_0x95f1('0x42')]){_0x89f6aa['include']=[{'all':!![]}];}_0x89f6aa=_[_0x95f1('0x3e')]({},_0x89f6aa,_0x50e5a2[_0x95f1('0x4a')]);return db[_0x95f1('0x41')][_0x95f1('0x4b')](_0x89f6aa)[_0x95f1('0x27')](handleEntityNotFound(_0x242b7a,null))[_0x95f1('0x27')](respondWithResult(_0x242b7a,null))[_0x95f1('0x46')](handleError(_0x242b7a,null));};exports[_0x95f1('0x4c')]=function(_0x23757d,_0x14ae2c){return db[_0x95f1('0x41')][_0x95f1('0x4c')](_0x23757d['body'],{})[_0x95f1('0x27')](function(_0x2703c6){var _0x1abe0e=_0x23757d['user'][_0x95f1('0x4d')]({'plain':!![]});if(!_0x1abe0e)throw new Error(_0x95f1('0x4e'));if(_0x1abe0e[_0x95f1('0x4f')]===_0x95f1('0x50')){var _0x3b497c=_0x2703c6['get']({'plain':!![]});var _0x46e85a=_0x95f1('0x51');return db['UserProfileSection'][_0x95f1('0x4b')]({'where':{'name':_0x46e85a,'userProfileId':_0x1abe0e[_0x95f1('0x52')]},'raw':!![]})[_0x95f1('0x27')](function(_0x1cfed3){if(_0x1cfed3&&_0x1cfed3[_0x95f1('0x53')]===0x0){return db[_0x95f1('0x54')]['create']({'name':_0x3b497c['name'],'resourceId':_0x3b497c['id'],'type':_0x1cfed3[_0x95f1('0x2a')],'sectionId':_0x1cfed3['id']},{})[_0x95f1('0x27')](function(){return _0x2703c6;});}else{return _0x2703c6;}})[_0x95f1('0x46')](function(_0x5d09a1){logger[_0x95f1('0x28')](_0x95f1('0x55'),_0x5d09a1);throw _0x5d09a1;});}return _0x2703c6;})['then'](respondWithResult(_0x14ae2c,0xc9))['catch'](handleError(_0x14ae2c,null));};exports[_0x95f1('0x26')]=function(_0x30a9e6,_0xfd1a35){if(_0x30a9e6['body']['id']){delete _0x30a9e6['body']['id'];}return db[_0x95f1('0x41')]['find']({'where':{'id':_0x30a9e6[_0x95f1('0x48')]['id']}})[_0x95f1('0x27')](handleEntityNotFound(_0xfd1a35,null))[_0x95f1('0x27')](saveUpdates(_0x30a9e6['body'],null))[_0x95f1('0x27')](respondWithResult(_0xfd1a35,null))[_0x95f1('0x46')](handleError(_0xfd1a35,null));};exports[_0x95f1('0x56')]=function(_0x5ca346,_0x55d435){var _0x4afc24=_0x5ca346[_0x95f1('0x48')]['id'];var _0x2a54c6=[];return db['sequelize'][_0x95f1('0x57')](function(_0x388ff9){var _0x17c3bc=_0x95f1('0x58')+_0x4afc24;return db[_0x95f1('0x59')][_0x95f1('0x31')](_0x17c3bc,{'type':db[_0x95f1('0x5a')][_0x95f1('0x5b')][_0x95f1('0x5c')],'raw':!![],'transaction':_0x388ff9})[_0x95f1('0x27')](function(_0x3ddf2d){_0x2a54c6=_[_0x95f1('0x2d')](_0x3ddf2d,function(_0x7eea49){return Number(_0x7eea49[_0x95f1('0x5d')]);});})[_0x95f1('0x27')](function(){var _0xb1da2b=_0x95f1('0x5e')+_0x4afc24;return db[_0x95f1('0x59')][_0x95f1('0x31')](_0xb1da2b,{'type':db[_0x95f1('0x5a')][_0x95f1('0x5b')][_0x95f1('0x5c')],'raw':!![],'transaction':_0x388ff9});})[_0x95f1('0x27')](function(_0x5831ce){var _0x30ea2b=_[_0x95f1('0x2d')](_0x5831ce,function(_0x3cfc3f){return Number(_0x3cfc3f[_0x95f1('0x5f')]);});return db[_0x95f1('0x60')][_0x95f1('0x56')]({'where':{'UserId':{'$in':_0x2a54c6},'VoiceQueueId':{'$in':_0x30ea2b}},'transaction':_0x388ff9});})[_0x95f1('0x27')](function(){var _0x1efad7='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4afc24;return db[_0x95f1('0x59')]['query'](_0x1efad7,{'type':db[_0x95f1('0x5a')]['QueryTypes'][_0x95f1('0x5c')],'raw':!![],'transaction':_0x388ff9});})['then'](function(_0x10c003){var _0xfdcb06=_[_0x95f1('0x2d')](_0x10c003,function(_0x3241c2){return Number(_0x3241c2['MailQueueId']);});return db['UserMailQueue'][_0x95f1('0x56')]({'where':{'UserId':{'$in':_0x2a54c6},'MailQueueId':{'$in':_0xfdcb06}},'transaction':_0x388ff9});})[_0x95f1('0x27')](function(){var _0x25df79='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4afc24;return db[_0x95f1('0x59')]['query'](_0x25df79,{'type':db[_0x95f1('0x5a')][_0x95f1('0x5b')]['SELECT'],'raw':!![],'transaction':_0x388ff9});})[_0x95f1('0x27')](function(_0x4a040f){var _0x4fdcb1=_[_0x95f1('0x2d')](_0x4a040f,function(_0x2d766c){return Number(_0x2d766c['SmsQueueId']);});return db[_0x95f1('0x61')][_0x95f1('0x56')]({'where':{'UserId':{'$in':_0x2a54c6},'SmsQueueId':{'$in':_0x4fdcb1}},'transaction':_0x388ff9});})[_0x95f1('0x27')](function(){var _0x53241f=_0x95f1('0x62')+_0x4afc24;return db[_0x95f1('0x59')][_0x95f1('0x31')](_0x53241f,{'type':db[_0x95f1('0x5a')][_0x95f1('0x5b')]['SELECT'],'raw':!![],'transaction':_0x388ff9});})[_0x95f1('0x27')](function(_0x349b54){var _0x5f0152=_[_0x95f1('0x2d')](_0x349b54,function(_0x2e215e){return Number(_0x2e215e[_0x95f1('0x63')]);});return db[_0x95f1('0x64')][_0x95f1('0x56')]({'where':{'UserId':{'$in':_0x2a54c6},'ChatQueueId':{'$in':_0x5f0152}},'transaction':_0x388ff9});})[_0x95f1('0x27')](function(){var _0x129c28=_0x95f1('0x65')+_0x4afc24;return db['sequelize'][_0x95f1('0x31')](_0x129c28,{'type':db[_0x95f1('0x5a')][_0x95f1('0x5b')][_0x95f1('0x5c')],'raw':!![],'transaction':_0x388ff9});})[_0x95f1('0x27')](function(_0x4b01d){var _0x2fe672=_[_0x95f1('0x2d')](_0x4b01d,function(_0x3af605){return Number(_0x3af605[_0x95f1('0x66')]);});return db['UserFaxQueue'][_0x95f1('0x56')]({'where':{'UserId':{'$in':_0x2a54c6},'FaxQueueId':{'$in':_0x2fe672}},'transaction':_0x388ff9});})[_0x95f1('0x27')](function(){var _0x37a9c8=_0x95f1('0x67')+_0x4afc24;return db[_0x95f1('0x59')]['query'](_0x37a9c8,{'type':db[_0x95f1('0x5a')][_0x95f1('0x5b')][_0x95f1('0x5c')],'raw':!![],'transaction':_0x388ff9});})[_0x95f1('0x27')](function(_0x5d015a){var _0x5e39fb=_[_0x95f1('0x2d')](_0x5d015a,function(_0x4dba02){return Number(_0x4dba02[_0x95f1('0x68')]);});return db[_0x95f1('0x69')][_0x95f1('0x56')]({'where':{'UserId':{'$in':_0x2a54c6},'OpenchannelQueueId':{'$in':_0x5e39fb}},'transaction':_0x388ff9});})[_0x95f1('0x27')](function(){var _0x128ea2='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4afc24;return db[_0x95f1('0x59')][_0x95f1('0x31')](_0x128ea2,{'type':db[_0x95f1('0x5a')]['QueryTypes'][_0x95f1('0x5c')],'raw':!![],'transaction':_0x388ff9});})[_0x95f1('0x27')](function(_0x14f294){var _0x4da439=_[_0x95f1('0x2d')](_0x14f294,function(_0x21c44c){return Number(_0x21c44c['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x95f1('0x56')]({'where':{'UserId':{'$in':_0x2a54c6},'WhatsappQueueId':{'$in':_0x4da439}},'transaction':_0x388ff9});})[_0x95f1('0x27')](function(){return db[_0x95f1('0x6a')]['find']({'where':{'TeamId':_0x4afc24}});})[_0x95f1('0x27')](function(_0x41022a){if(_0x41022a===null){return;}return db['UserVoicePrefix'][_0x95f1('0x56')]({'where':{'UserId':{'$in':_0x2a54c6},'VoicePrefixId':_0x41022a['VoicePrefixId']},'transaction':_0x388ff9});})['then'](function(){return db[_0x95f1('0x41')]['destroy']({'where':{'id':_0x4afc24},'cascade':!![],'transaction':_0x388ff9});})[_0x95f1('0x27')](function(_0x5beda8){if(_0x5beda8===0x0){_0x55d435[_0x95f1('0x1a')](0x194);}else{return db[_0x95f1('0x54')]['destroy']({'where':{'type':'Teams','resourceId':_0x4afc24},'cascade':!![],'transaction':_0x388ff9})[_0x95f1('0x27')](function(){_0x55d435[_0x95f1('0x1c')](0xcc)['end']();});}})[_0x95f1('0x46')](function(_0x419a89){_0x55d435[_0x95f1('0x1c')](0x1f4)[_0x95f1('0x2b')](_0x419a89);});});};exports[_0x95f1('0x6b')]=function(_0x2dd689,_0x1de7d7,_0x2fc006){return db[_0x95f1('0x41')][_0x95f1('0x6c')]({'where':{'id':_0x2dd689[_0x95f1('0x48')]['id']}})[_0x95f1('0x27')](handleEntityNotFound(_0x1de7d7,null))['then'](function(_0x23984a){if(!_0x2dd689['query'][_0x95f1('0x6d')]||!utils['isValidChannel'](_0x2dd689[_0x95f1('0x31')][_0x95f1('0x6d')])){throw new db[(_0x95f1('0x5a'))][(_0x95f1('0x6e'))](_0x95f1('0x6f'));}var _0x30752c={};var _0x2dad20={};_0x2dad20[_0x95f1('0x30')]=_[_0x95f1('0x32')](db[_[_0x95f1('0x70')](_0x2dd689[_0x95f1('0x31')]['channel']['toLowerCase']())+'Queue'][_0x95f1('0x49')]);_0x2dad20[_0x95f1('0x31')]=_[_0x95f1('0x32')](_0x2dd689[_0x95f1('0x31')]);_0x2dad20[_0x95f1('0x33')]=_[_0x95f1('0x34')](_0x2dad20['model'],_0x2dad20['query']);_0x30752c[_0x95f1('0x36')]=_[_0x95f1('0x34')](_0x2dad20['model'],qs[_0x95f1('0x35')](_0x2dd689['query'][_0x95f1('0x35')]));_0x30752c[_0x95f1('0x36')]=_0x30752c[_0x95f1('0x36')][_0x95f1('0x37')]?_0x30752c[_0x95f1('0x36')]:_0x2dad20[_0x95f1('0x30')];_0x30752c[_0x95f1('0x1f')]=qs[_0x95f1('0x1f')](_0x2dd689[_0x95f1('0x31')]['limit']);_0x30752c[_0x95f1('0x1d')]=qs[_0x95f1('0x1d')](_0x2dd689[_0x95f1('0x31')][_0x95f1('0x1d')]);_0x30752c['order']=qs[_0x95f1('0x3a')](_0x2dd689[_0x95f1('0x31')][_0x95f1('0x3a')]);_0x30752c[_0x95f1('0x3b')]=qs[_0x95f1('0x33')](_['pick'](_0x2dd689[_0x95f1('0x31')],_0x2dad20['filters']));_0x30752c=_[_0x95f1('0x3e')]({},_0x30752c,_0x2dd689[_0x95f1('0x4a')]);return _0x23984a['get'+_['capitalize'](_0x2dd689[_0x95f1('0x31')][_0x95f1('0x6d')][_0x95f1('0x71')]())+'Queues'](_0x30752c);})[_0x95f1('0x27')](respondWithResult(_0x1de7d7,null))[_0x95f1('0x46')](handleError(_0x1de7d7,null));};exports[_0x95f1('0x72')]=function(_0x2b4d75,_0x4c97f8,_0x53da74){return db['Team']['findOne']({'where':{'id':_0x2b4d75[_0x95f1('0x48')]['id']}})['then'](function(_0x43673d){if(_0x43673d){if(!_0x2b4d75[_0x95f1('0x73')][_0x95f1('0x6d')]||!utils[_0x95f1('0x74')](_0x2b4d75[_0x95f1('0x73')][_0x95f1('0x6d')])){throw new db[(_0x95f1('0x5a'))]['ValidationError'](_0x95f1('0x6f'));}return _0x43673d[_0x95f1('0x75')+_[_0x95f1('0x70')](_0x2b4d75[_0x95f1('0x73')][_0x95f1('0x6d')][_0x95f1('0x71')]())+'Queues'](_0x2b4d75['body'][_0x95f1('0x76')]);}return null;})[_0x95f1('0x27')](handleEntityNotFound(_0x4c97f8,null))[_0x95f1('0x27')](respondWithStatusCode(_0x4c97f8,null))[_0x95f1('0x46')](handleError(_0x4c97f8,null));};exports[_0x95f1('0x77')]=function(_0x139c62,_0x33aa63,_0xfc9675){return db[_0x95f1('0x41')][_0x95f1('0x6c')]({'where':{'id':_0x139c62[_0x95f1('0x48')]['id']}})[_0x95f1('0x27')](function(_0x5e1bcc){if(_0x5e1bcc){if(!_0x139c62[_0x95f1('0x31')]['channel']||!utils[_0x95f1('0x74')](_0x139c62[_0x95f1('0x31')]['channel'])){throw new db[(_0x95f1('0x5a'))][(_0x95f1('0x6e'))](_0x95f1('0x6f'));}return _0x5e1bcc[_0x95f1('0x78')+_[_0x95f1('0x70')](_0x139c62[_0x95f1('0x31')][_0x95f1('0x6d')][_0x95f1('0x71')]())+'Queues'](_0x139c62[_0x95f1('0x31')][_0x95f1('0x76')]);}return null;})[_0x95f1('0x27')](handleEntityNotFound(_0x33aa63,null))['then'](respondWithStatusCode(_0x33aa63,null))[_0x95f1('0x46')](handleError(_0x33aa63,null));};exports[_0x95f1('0x79')]=function(_0x522842,_0x816f57){var _0x3549f5=_[_0x95f1('0x7a')](_0x522842['body'][_0x95f1('0x76')])?_0x522842[_0x95f1('0x73')]['ids']:[_0x522842['body'][_0x95f1('0x76')]];var _0x310e70=_0x522842[_0x95f1('0x48')]['id'];return db[_0x95f1('0x41')][_0x95f1('0x4b')]({'where':{'id':_0x310e70}})[_0x95f1('0x27')](handleEntityNotFound(_0x816f57,null))[_0x95f1('0x27')](function(_0x344945){if(_0x344945){var _0xb2eb91=[_0x95f1('0x7b'),_0x95f1('0x7c'),_0x95f1('0x7d'),'Sms','Fax',_0x95f1('0x7e'),'Whatsapp'];return db[_0x95f1('0x59')]['transaction'](function(_0x171b1b){var _0x2c5cf9=_[_0x95f1('0x2d')](_0xb2eb91,function(_0x2f42a6){var _0x2dd341={'attributes':['id',_0x95f1('0x2a')]};if(_0x2f42a6===_0x95f1('0x7b')){_0x2dd341[_0x95f1('0x7f')]={'attributes':[_0x95f1('0x80')]};}return _0x344945['get'+_0x2f42a6+'Queues'](_0x2dd341)[_0x95f1('0x27')](function(_0x352571){var _0x575d58=_['map'](_0x352571,function(_0x124e15){var _0x4193ab=_[_0x95f1('0x2d')](_0x3549f5,function(_0x53f64a){var _0x3cbda8={'where':{'UserId':_0x53f64a,[_0x2f42a6+'QueueId']:_0x124e15['id']},'transaction':_0x171b1b};if(_0x2f42a6===_0x95f1('0x7b')){_0x3cbda8[_0x95f1('0x81')]={'penalty':_0x124e15[_0x95f1('0x82')][_0x95f1('0x80')]};}return db[_0x95f1('0x83')+_0x2f42a6+'Queue']['findOrCreate'](_0x3cbda8)[_0x95f1('0x27')](function(){socket['emit'](_0x95f1('0x50')+_0x2f42a6+_0x95f1('0x84'),{'UserId':_0x53f64a,[_0x2f42a6+_0x95f1('0x85')]:_0x124e15['id']});if(_0x2f42a6!==_0x95f1('0x7b')){return;}return db[_0x95f1('0x83')][_0x95f1('0x44')]({'where':{'id':_0x3549f5,'online':0x1},'attributes':['id','name',_0x95f1('0x86'),_0x95f1('0x87'),_0x95f1('0x88')],'raw':!![]})[_0x95f1('0x27')](function(_0x3ba767){var _0x481d04=_['map'](_0x3ba767,function(_0x2bca86){return db[_0x95f1('0x89')][_0x95f1('0x8a')]({'membername':_0x2bca86[_0x95f1('0x2a')],'UserId':_0x2bca86['id'],'queue_name':_0x124e15['name'],'VoiceQueueId':_0x124e15['id'],'interface':_['isNil'](_0x2bca86[_0x95f1('0x88')])?util['format'](_0x95f1('0x8b'),_0x2bca86[_0x95f1('0x2a')]):_0x2bca86[_0x95f1('0x88')],'paused':_0x2bca86[_0x95f1('0x87')]||![],'penalty':_0x124e15[_0x95f1('0x82')][_0x95f1('0x80')]},{'transaction':_0x171b1b});});return Promise[_0x95f1('0x8c')](_0x481d04);});});});return Promise[_0x95f1('0x8c')](_0x4193ab);});return Promise['all'](_0x575d58);})[_0x95f1('0x27')](function(){return db['TeamVoicePrefix'][_0x95f1('0x6c')]({'where':{'teamId':_0x310e70}})[_0x95f1('0x27')](function(_0x11b1d9){if(_0x11b1d9){var _0x16b52d=_['map'](_0x3549f5,function(_0x548cf9){db[_0x95f1('0x8d')][_0x95f1('0x8a')]({'UserId':_0x548cf9,'VoicePrefixId':_0x11b1d9[_0x95f1('0x8e')]});});return Promise[_0x95f1('0x8c')](_0x16b52d);}});});});return Promise[_0x95f1('0x8c')](_0x2c5cf9)['then'](function(){return _0x344945[_0x95f1('0x79')](_0x3549f5,{'transaction':_0x171b1b})[_0x95f1('0x8f')](function(_0x435db9){return _0x435db9;});});});}})[_0x95f1('0x27')](respondWithResult(_0x816f57,null))['catch'](handleError(_0x816f57,null));};exports['removeAgents']=function(_0x4bf33b,_0x41ec91){var _0xdc861b=_[_0x95f1('0x7a')](_0x4bf33b[_0x95f1('0x31')][_0x95f1('0x76')])?_0x4bf33b[_0x95f1('0x31')][_0x95f1('0x76')]:[_0x4bf33b[_0x95f1('0x31')][_0x95f1('0x76')]];var _0x6e68a0=_0x4bf33b['params']['id'];return db[_0x95f1('0x41')]['find']({'where':{'id':_0x6e68a0}})[_0x95f1('0x27')](handleEntityNotFound(_0x41ec91,null))[_0x95f1('0x27')](function(_0x4b0ab8){if(_0x4b0ab8){var _0x5b4fd0=[_0x95f1('0x7b'),_0x95f1('0x7c'),_0x95f1('0x7d'),'Sms',_0x95f1('0x90'),_0x95f1('0x7e'),_0x95f1('0x91')];return db[_0x95f1('0x59')][_0x95f1('0x57')](function(_0x4173d5){var _0x1ab7e7=_[_0x95f1('0x2d')](_0x5b4fd0,function(_0x362812){var _0x41fe3a={'attributes':['id','name']};return _0x4b0ab8[_0x95f1('0x4d')+_0x362812+'Queues'](_0x41fe3a)[_0x95f1('0x27')](function(_0xbabf80){var _0x16d581=_[_0x95f1('0x2d')](_0xbabf80,function(_0x7d055e){return _0x7d055e['removeAgents'](_0xdc861b,{'transaction':_0x4173d5})[_0x95f1('0x27')](function(){var _0x56a18b=_[_0x95f1('0x2d')](_0xdc861b,function(_0x5946aa){socket[_0x95f1('0x92')](_0x95f1('0x50')+_0x362812+'Queue:remove',{'UserId':Number(_0x5946aa),[_0x362812+_0x95f1('0x85')]:_0x7d055e['id']});if(_0x362812!=='Voice'){return;}return db[_0x95f1('0x89')][_0x95f1('0x56')]({'where':{'VoiceQueueId':_0x7d055e['id'],'UserId':_0x5946aa},'transaction':_0x4173d5});});return Promise[_0x95f1('0x8c')](_0x56a18b);});});return Promise[_0x95f1('0x8c')](_0x16d581);});});return Promise['all'](_0x1ab7e7)[_0x95f1('0x27')](function(){return _0x4b0ab8[_0x95f1('0x93')](_0xdc861b,{'transaction':_0x4173d5});})[_0x95f1('0x27')](function(){return db['TeamVoicePrefix'][_0x95f1('0x6c')]({'where':{'teamId':_0x6e68a0}})[_0x95f1('0x27')](function(_0x17e7bf){if(_0x17e7bf){var _0x3dd8f1=_[_0x95f1('0x2d')](_0xdc861b,function(_0x54c185){db[_0x95f1('0x8d')]['destroy']({'where':{'UserId':_0x54c185,'VoicePrefixId':_0x17e7bf[_0x95f1('0x8e')]}});});return Promise[_0x95f1('0x8c')](_0x3dd8f1);}});});});}})[_0x95f1('0x27')](respondWithStatusCode(_0x41ec91,null))[_0x95f1('0x46')](handleError(_0x41ec91,null));};exports[_0x95f1('0x94')]=function(_0x289f58,_0x1f8af2,_0x4efe33){var _0x224291={};var _0xfd52cd={};var _0x4c1c2c;var _0x1de29c;return db[_0x95f1('0x41')]['findOne']({'where':{'id':_0x289f58[_0x95f1('0x48')]['id']}})[_0x95f1('0x27')](handleEntityNotFound(_0x1f8af2,null))[_0x95f1('0x27')](function(_0x366f84){if(_0x366f84){_0x4c1c2c=_0x366f84;_0xfd52cd[_0x95f1('0x30')]=_[_0x95f1('0x32')](db[_0x95f1('0x83')][_0x95f1('0x49')]);_0xfd52cd[_0x95f1('0x31')]=_[_0x95f1('0x32')](_0x289f58['query']);_0xfd52cd['filters']=_[_0x95f1('0x34')](_0xfd52cd['model'],_0xfd52cd[_0x95f1('0x31')]);_0x224291['attributes']=_[_0x95f1('0x34')](_0xfd52cd['model'],qs[_0x95f1('0x35')](_0x289f58[_0x95f1('0x31')][_0x95f1('0x35')]));_0x224291[_0x95f1('0x36')]=_0x224291[_0x95f1('0x36')][_0x95f1('0x37')]?_0x224291[_0x95f1('0x36')]:_0xfd52cd[_0x95f1('0x30')];_0x224291[_0x95f1('0x95')]=qs['sort'](_0x289f58[_0x95f1('0x31')][_0x95f1('0x3a')]);_0x224291[_0x95f1('0x3b')]=qs[_0x95f1('0x33')](_[_0x95f1('0x3c')](_0x289f58[_0x95f1('0x31')],_0xfd52cd['filters']));if(_0x289f58['query'][_0x95f1('0x3d')]){_0x224291[_0x95f1('0x3b')]=_[_0x95f1('0x3e')](_0x224291['where'],{'$or':_['map'](_0x224291[_0x95f1('0x36')],function(_0x45de1b){var _0x3958ee={};_0x3958ee[_0x45de1b]={'$like':'%'+_0x289f58[_0x95f1('0x31')][_0x95f1('0x3d')]+'%'};return _0x3958ee;})});}_0x224291=_[_0x95f1('0x3e')]({},_0x224291,_0x289f58[_0x95f1('0x4a')]);return _0x4c1c2c[_0x95f1('0x94')](_0x224291);}})['then'](function(_0x4128e5){if(_0x4128e5){_0x1de29c=_0x4128e5[_0x95f1('0x37')];if(!_0x289f58[_0x95f1('0x31')]['hasOwnProperty'](_0x95f1('0x39'))){_0x224291['limit']=qs['limit'](_0x289f58[_0x95f1('0x31')]['limit']);_0x224291[_0x95f1('0x1d')]=qs['offset'](_0x289f58[_0x95f1('0x31')][_0x95f1('0x1d')]);}return _0x4c1c2c[_0x95f1('0x94')](_0x224291);}})[_0x95f1('0x27')](function(_0x5f0397){if(_0x5f0397){return _0x5f0397?{'count':_0x1de29c,'rows':_0x5f0397}:null;}})['then'](respondWithResult(_0x1f8af2,null))[_0x95f1('0x46')](handleError(_0x1f8af2,null));}; \ No newline at end of file +var _0x713f=['../../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','./team.socket','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','Team','includeAll','findAll','rows','show','fields','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','sendStatus','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','addQueues','findOne','add','Queues','remove','ids','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','TeamVoiceQueue','Queue','findOrCreate','emit','Queue:save','QueueId','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','addAgents','removeAgents','Queue:remove','getAgents','User','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x399131,_0x2db855){var _0xce76e2=function(_0x175a64){while(--_0x175a64){_0x399131['push'](_0x399131['shift']());}};_0xce76e2(++_0x2db855);}(_0x713f,0x8d));var _0xf713=function(_0x3ed6c1,_0x2c211e){_0x3ed6c1=_0x3ed6c1-0x0;var _0x15f564=_0x713f[_0x3ed6c1];return _0x15f564;};'use strict';var emlformat=require(_0xf713('0x0'));var rimraf=require(_0xf713('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf713('0x2'));var rp=require(_0xf713('0x3'));var moment=require(_0xf713('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf713('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf713('0x6'));var csv=require(_0xf713('0x7'));var ejs=require(_0xf713('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf713('0x9'));var squel=require('squel');var crypto=require(_0xf713('0xa'));var jsforce=require(_0xf713('0xb'));var deskjs=require(_0xf713('0xc'));var toCsv=require(_0xf713('0x7'));var querystring=require(_0xf713('0xd'));var Papa=require(_0xf713('0xe'));var Redis=require('ioredis');var authService=require(_0xf713('0xf'));var qs=require(_0xf713('0x10'));var as=require(_0xf713('0x11'));var hardwareService=require(_0xf713('0x12'));var logger=require(_0xf713('0x13'))(_0xf713('0x14'));var utils=require(_0xf713('0x15'));var config=require(_0xf713('0x16'));var licenseUtil=require(_0xf713('0x17'));var db=require(_0xf713('0x18'))['db'];config[_0xf713('0x19')]=_[_0xf713('0x1a')](config[_0xf713('0x19')],{'host':_0xf713('0x1b'),'port':0x18eb});var socket=require(_0xf713('0x1c'))(new Redis(config['redis']));require(_0xf713('0x1d'))['register'](socket);function respondWithStatusCode(_0x548262,_0x428b02){_0x428b02=_0x428b02||0xcc;return function(_0x4902c9){if(_0x4902c9){return _0x548262['sendStatus'](_0x428b02);}return _0x548262[_0xf713('0x1e')](_0x428b02)[_0xf713('0x1f')]();};}function respondWithResult(_0x3e1b54,_0x2eba1f){_0x2eba1f=_0x2eba1f||0xc8;return function(_0x59202a){if(_0x59202a){return _0x3e1b54[_0xf713('0x1e')](_0x2eba1f)[_0xf713('0x20')](_0x59202a);}};}function respondWithFilteredResult(_0x26dd82,_0x2a377b){return function(_0x4b6722){if(_0x4b6722){var _0x298c92=typeof _0x2a377b['offset']===_0xf713('0x21')&&typeof _0x2a377b[_0xf713('0x22')]===_0xf713('0x21');var _0x58713b=_0x4b6722[_0xf713('0x23')];var _0x1f2c1d=_0x298c92?0x0:_0x2a377b[_0xf713('0x24')];var _0x3d66b7=_0x298c92?_0x4b6722[_0xf713('0x23')]:_0x2a377b[_0xf713('0x24')]+_0x2a377b[_0xf713('0x22')];var _0xd9a041;if(_0x3d66b7>=_0x58713b){_0x3d66b7=_0x58713b;_0xd9a041=0xc8;}else{_0xd9a041=0xce;}_0x26dd82[_0xf713('0x1e')](_0xd9a041);return _0x26dd82[_0xf713('0x25')](_0xf713('0x26'),_0x1f2c1d+'-'+_0x3d66b7+'/'+_0x58713b)[_0xf713('0x20')](_0x4b6722);}return null;};}function patchUpdates(_0x34bd63){return function(_0x317e50){try{jsonpatch[_0xf713('0x27')](_0x317e50,_0x34bd63,!![]);}catch(_0x139504){return BPromise[_0xf713('0x28')](_0x139504);}return _0x317e50[_0xf713('0x29')]();};}function saveUpdates(_0x1c731c,_0xf43c80){return function(_0x1a7dbe){if(_0x1a7dbe){return _0x1a7dbe[_0xf713('0x2a')](_0x1c731c)[_0xf713('0x2b')](function(_0x2a67d6){return _0x2a67d6;});}return null;};}function handleEntityNotFound(_0x3f5416,_0x231e97){return function(_0xaf37e1){if(!_0xaf37e1){_0x3f5416['sendStatus'](0x194);}return _0xaf37e1;};}function handleError(_0x374e8a,_0x104f62){_0x104f62=_0x104f62||0x1f4;return function(_0x5a60f9){logger[_0xf713('0x2c')](_0x5a60f9[_0xf713('0x2d')]);if(_0x5a60f9['name']){delete _0x5a60f9[_0xf713('0x2e')];}_0x374e8a['status'](_0x104f62)[_0xf713('0x2f')](_0x5a60f9);};}exports[_0xf713('0x30')]=function(_0x301a3c,_0x49dc67){var _0x5b4729={},_0x318243={},_0x37ad77={'count':0x0,'rows':[]};var _0x3da643=_[_0xf713('0x31')](db['Team'][_0xf713('0x32')],function(_0x56be76){return{'name':_0x56be76[_0xf713('0x33')],'type':_0x56be76['type'][_0xf713('0x34')]};});_0x318243[_0xf713('0x35')]=_[_0xf713('0x31')](_0x3da643,_0xf713('0x2e'));_0x318243['query']=_[_0xf713('0x36')](_0x301a3c['query']);_0x318243['filters']=_[_0xf713('0x37')](_0x318243[_0xf713('0x35')],_0x318243[_0xf713('0x38')]);_0x5b4729['attributes']=_[_0xf713('0x37')](_0x318243[_0xf713('0x35')],qs['fields'](_0x301a3c[_0xf713('0x38')]['fields']));_0x5b4729[_0xf713('0x39')]=_0x5b4729[_0xf713('0x39')][_0xf713('0x3a')]?_0x5b4729['attributes']:_0x318243[_0xf713('0x35')];if(!_0x301a3c[_0xf713('0x38')]['hasOwnProperty'](_0xf713('0x3b'))){_0x5b4729['limit']=qs[_0xf713('0x22')](_0x301a3c[_0xf713('0x38')]['limit']);_0x5b4729['offset']=qs[_0xf713('0x24')](_0x301a3c[_0xf713('0x38')][_0xf713('0x24')]);}_0x5b4729[_0xf713('0x3c')]=qs[_0xf713('0x3d')](_0x301a3c[_0xf713('0x38')]['sort']);_0x5b4729[_0xf713('0x3e')]=qs[_0xf713('0x3f')](_[_0xf713('0x40')](_0x301a3c['query'],_0x318243[_0xf713('0x3f')]),_0x3da643);if(_0x301a3c[_0xf713('0x38')]['filter']){_0x5b4729[_0xf713('0x3e')]=_[_0xf713('0x41')](_0x5b4729['where'],{'$or':_['map'](_0x3da643,function(_0x4302f9){if(_0x4302f9[_0xf713('0x42')]!==_0xf713('0x43')){var _0x37c84c={};_0x37c84c[_0x4302f9[_0xf713('0x2e')]]={'$like':'%'+_0x301a3c[_0xf713('0x38')][_0xf713('0x44')]+'%'};return _0x37c84c;}})});}_0x5b4729=_['merge']({},_0x5b4729,_0x301a3c[_0xf713('0x45')]);var _0x2c1b76={'where':_0x5b4729[_0xf713('0x3e')]};return db[_0xf713('0x46')][_0xf713('0x23')](_0x2c1b76)['then'](function(_0x3253b7){_0x37ad77[_0xf713('0x23')]=_0x3253b7;if(_0x301a3c[_0xf713('0x38')][_0xf713('0x47')]){_0x5b4729['include']=[{'all':!![]}];}return db[_0xf713('0x46')][_0xf713('0x48')](_0x5b4729);})[_0xf713('0x2b')](function(_0x5b3873){_0x37ad77[_0xf713('0x49')]=_0x5b3873;return _0x37ad77;})[_0xf713('0x2b')](respondWithFilteredResult(_0x49dc67,_0x5b4729))['catch'](handleError(_0x49dc67,null));};exports[_0xf713('0x4a')]=function(_0x4b62ef,_0x572e91){var _0x373621={'raw':![],'where':{'id':_0x4b62ef['params']['id']}},_0x51ade8={};_0x51ade8[_0xf713('0x35')]=_['keys'](db[_0xf713('0x46')][_0xf713('0x32')]);_0x51ade8['query']=_[_0xf713('0x36')](_0x4b62ef['query']);_0x51ade8['filters']=_['intersection'](_0x51ade8[_0xf713('0x35')],_0x51ade8[_0xf713('0x38')]);_0x373621['attributes']=_['intersection'](_0x51ade8[_0xf713('0x35')],qs[_0xf713('0x4b')](_0x4b62ef[_0xf713('0x38')][_0xf713('0x4b')]));_0x373621[_0xf713('0x39')]=_0x373621[_0xf713('0x39')]['length']?_0x373621['attributes']:_0x51ade8['model'];if(_0x4b62ef[_0xf713('0x38')][_0xf713('0x47')]){_0x373621[_0xf713('0x4c')]=[{'all':!![]}];}_0x373621=_[_0xf713('0x41')]({},_0x373621,_0x4b62ef[_0xf713('0x45')]);return db['Team'][_0xf713('0x4d')](_0x373621)[_0xf713('0x2b')](handleEntityNotFound(_0x572e91,null))[_0xf713('0x2b')](respondWithResult(_0x572e91,null))[_0xf713('0x4e')](handleError(_0x572e91,null));};exports['create']=function(_0x447e29,_0x5926cc){return db[_0xf713('0x46')][_0xf713('0x4f')](_0x447e29[_0xf713('0x50')],{})['then'](function(_0x5cee4b){var _0x3fa93a=_0x447e29[_0xf713('0x51')][_0xf713('0x52')]({'plain':!![]});if(!_0x3fa93a)throw new Error(_0xf713('0x53'));if(_0x3fa93a['role']===_0xf713('0x51')){var _0x11cc1d=_0x5cee4b['get']({'plain':!![]});var _0x9a003d=_0xf713('0x54');return db[_0xf713('0x55')]['find']({'where':{'name':_0x9a003d,'userProfileId':_0x3fa93a[_0xf713('0x56')]},'raw':!![]})[_0xf713('0x2b')](function(_0x3ae5dc){if(_0x3ae5dc&&_0x3ae5dc[_0xf713('0x57')]===0x0){return db[_0xf713('0x58')][_0xf713('0x4f')]({'name':_0x11cc1d[_0xf713('0x2e')],'resourceId':_0x11cc1d['id'],'type':_0x3ae5dc[_0xf713('0x2e')],'sectionId':_0x3ae5dc['id']},{})[_0xf713('0x2b')](function(){return _0x5cee4b;});}else{return _0x5cee4b;}})[_0xf713('0x4e')](function(_0x415614){logger[_0xf713('0x2c')](_0xf713('0x59'),_0x415614);throw _0x415614;});}return _0x5cee4b;})[_0xf713('0x2b')](respondWithResult(_0x5926cc,0xc9))['catch'](handleError(_0x5926cc,null));};exports['update']=function(_0x19adc8,_0x3bf074){if(_0x19adc8[_0xf713('0x50')]['id']){delete _0x19adc8[_0xf713('0x50')]['id'];}return db['Team'][_0xf713('0x4d')]({'where':{'id':_0x19adc8[_0xf713('0x5a')]['id']}})[_0xf713('0x2b')](handleEntityNotFound(_0x3bf074,null))['then'](saveUpdates(_0x19adc8[_0xf713('0x50')],null))['then'](respondWithResult(_0x3bf074,null))['catch'](handleError(_0x3bf074,null));};exports[_0xf713('0x5b')]=function(_0xfbdb7,_0x23d9fc){var _0x1c9725=_0xfbdb7[_0xf713('0x5a')]['id'];var _0x4a5dc1=[];return db[_0xf713('0x5c')][_0xf713('0x5d')](function(_0x341f80){var _0x4fa08b='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1c9725;return db[_0xf713('0x5c')][_0xf713('0x38')](_0x4fa08b,{'type':db[_0xf713('0x5e')][_0xf713('0x5f')][_0xf713('0x60')],'raw':!![],'transaction':_0x341f80})[_0xf713('0x2b')](function(_0x4ba455){_0x4a5dc1=_[_0xf713('0x31')](_0x4ba455,function(_0x53a5c2){return Number(_0x53a5c2[_0xf713('0x61')]);});})[_0xf713('0x2b')](function(){var _0x415a84=_0xf713('0x62')+_0x1c9725;return db[_0xf713('0x5c')][_0xf713('0x38')](_0x415a84,{'type':db[_0xf713('0x5e')]['QueryTypes'][_0xf713('0x60')],'raw':!![],'transaction':_0x341f80});})[_0xf713('0x2b')](function(_0x3dadf4){var _0x5f5761=_[_0xf713('0x31')](_0x3dadf4,function(_0x2c83f9){return Number(_0x2c83f9['VoiceQueueId']);});return db[_0xf713('0x63')][_0xf713('0x5b')]({'where':{'UserId':{'$in':_0x4a5dc1},'VoiceQueueId':{'$in':_0x5f5761}},'transaction':_0x341f80});})['then'](function(){var _0x34c1d9=_0xf713('0x64')+_0x1c9725;return db[_0xf713('0x5c')][_0xf713('0x38')](_0x34c1d9,{'type':db['Sequelize'][_0xf713('0x5f')][_0xf713('0x60')],'raw':!![],'transaction':_0x341f80});})['then'](function(_0x196e71){var _0xaadbdc=_[_0xf713('0x31')](_0x196e71,function(_0x6f0cb5){return Number(_0x6f0cb5['MailQueueId']);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x4a5dc1},'MailQueueId':{'$in':_0xaadbdc}},'transaction':_0x341f80});})[_0xf713('0x2b')](function(){var _0x5dc64b=_0xf713('0x65')+_0x1c9725;return db['sequelize'][_0xf713('0x38')](_0x5dc64b,{'type':db[_0xf713('0x5e')][_0xf713('0x5f')]['SELECT'],'raw':!![],'transaction':_0x341f80});})['then'](function(_0x2333d5){var _0x2c80c8=_[_0xf713('0x31')](_0x2333d5,function(_0x39bf51){return Number(_0x39bf51[_0xf713('0x66')]);});return db[_0xf713('0x67')][_0xf713('0x5b')]({'where':{'UserId':{'$in':_0x4a5dc1},'SmsQueueId':{'$in':_0x2c80c8}},'transaction':_0x341f80});})[_0xf713('0x2b')](function(){var _0x4d66b6='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1c9725;return db[_0xf713('0x5c')][_0xf713('0x38')](_0x4d66b6,{'type':db[_0xf713('0x5e')]['QueryTypes'][_0xf713('0x60')],'raw':!![],'transaction':_0x341f80});})[_0xf713('0x2b')](function(_0x589633){var _0x4d1e05=_[_0xf713('0x31')](_0x589633,function(_0x33a101){return Number(_0x33a101[_0xf713('0x68')]);});return db[_0xf713('0x69')]['destroy']({'where':{'UserId':{'$in':_0x4a5dc1},'ChatQueueId':{'$in':_0x4d1e05}},'transaction':_0x341f80});})['then'](function(){var _0x440c07='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1c9725;return db['sequelize']['query'](_0x440c07,{'type':db[_0xf713('0x5e')][_0xf713('0x5f')][_0xf713('0x60')],'raw':!![],'transaction':_0x341f80});})['then'](function(_0x5390a1){var _0x14f4a5=_[_0xf713('0x31')](_0x5390a1,function(_0x505855){return Number(_0x505855['FaxQueueId']);});return db['UserFaxQueue'][_0xf713('0x5b')]({'where':{'UserId':{'$in':_0x4a5dc1},'FaxQueueId':{'$in':_0x14f4a5}},'transaction':_0x341f80});})[_0xf713('0x2b')](function(){var _0xb92228=_0xf713('0x6a')+_0x1c9725;return db[_0xf713('0x5c')][_0xf713('0x38')](_0xb92228,{'type':db[_0xf713('0x5e')][_0xf713('0x5f')][_0xf713('0x60')],'raw':!![],'transaction':_0x341f80});})[_0xf713('0x2b')](function(_0x5cca99){var _0xb81ef0=_['map'](_0x5cca99,function(_0x342cc8){return Number(_0x342cc8[_0xf713('0x6b')]);});return db[_0xf713('0x6c')][_0xf713('0x5b')]({'where':{'UserId':{'$in':_0x4a5dc1},'OpenchannelQueueId':{'$in':_0xb81ef0}},'transaction':_0x341f80});})[_0xf713('0x2b')](function(){var _0x22f699=_0xf713('0x6d')+_0x1c9725;return db[_0xf713('0x5c')][_0xf713('0x38')](_0x22f699,{'type':db[_0xf713('0x5e')][_0xf713('0x5f')][_0xf713('0x60')],'raw':!![],'transaction':_0x341f80});})[_0xf713('0x2b')](function(_0x55fc57){var _0x34e952=_[_0xf713('0x31')](_0x55fc57,function(_0x27eca6){return Number(_0x27eca6[_0xf713('0x6e')]);});return db['UserWhatsappQueue'][_0xf713('0x5b')]({'where':{'UserId':{'$in':_0x4a5dc1},'WhatsappQueueId':{'$in':_0x34e952}},'transaction':_0x341f80});})[_0xf713('0x2b')](function(){return db[_0xf713('0x6f')]['find']({'where':{'TeamId':_0x1c9725}});})['then'](function(_0x2bedfd){if(_0x2bedfd===null){return;}return db[_0xf713('0x70')][_0xf713('0x5b')]({'where':{'UserId':{'$in':_0x4a5dc1},'VoicePrefixId':_0x2bedfd[_0xf713('0x71')]},'transaction':_0x341f80});})[_0xf713('0x2b')](function(){return db['Team'][_0xf713('0x5b')]({'where':{'id':_0x1c9725},'cascade':!![],'transaction':_0x341f80});})[_0xf713('0x2b')](function(_0x1cbddf){if(_0x1cbddf===0x0){_0x23d9fc[_0xf713('0x72')](0x194);}else{return db[_0xf713('0x58')][_0xf713('0x5b')]({'where':{'type':_0xf713('0x54'),'resourceId':_0x1c9725},'cascade':!![],'transaction':_0x341f80})[_0xf713('0x2b')](function(){_0x23d9fc[_0xf713('0x1e')](0xcc)['end']();});}})['catch'](function(_0x17dd3e){_0x23d9fc[_0xf713('0x1e')](0x1f4)['send'](_0x17dd3e);});});};exports['getQueues']=function(_0x10c5e8,_0x2fb1d7,_0xdd45c9){return db[_0xf713('0x46')]['findOne']({'where':{'id':_0x10c5e8[_0xf713('0x5a')]['id']}})[_0xf713('0x2b')](handleEntityNotFound(_0x2fb1d7,null))[_0xf713('0x2b')](function(_0x2c252a){if(!_0x10c5e8[_0xf713('0x38')]['channel']||!utils[_0xf713('0x73')](_0x10c5e8[_0xf713('0x38')][_0xf713('0x74')])){throw new db['Sequelize'][(_0xf713('0x75'))](_0xf713('0x76'));}var _0x145887={};var _0x14e2e4={};_0x14e2e4[_0xf713('0x35')]=_[_0xf713('0x36')](db[_[_0xf713('0x77')](_0x10c5e8['query'][_0xf713('0x74')]['toLowerCase']())+'Queue'][_0xf713('0x32')]);_0x14e2e4[_0xf713('0x38')]=_[_0xf713('0x36')](_0x10c5e8['query']);_0x14e2e4[_0xf713('0x3f')]=_[_0xf713('0x37')](_0x14e2e4[_0xf713('0x35')],_0x14e2e4[_0xf713('0x38')]);_0x145887[_0xf713('0x39')]=_[_0xf713('0x37')](_0x14e2e4[_0xf713('0x35')],qs['fields'](_0x10c5e8[_0xf713('0x38')][_0xf713('0x4b')]));_0x145887[_0xf713('0x39')]=_0x145887[_0xf713('0x39')][_0xf713('0x3a')]?_0x145887[_0xf713('0x39')]:_0x14e2e4['model'];_0x145887[_0xf713('0x22')]=qs[_0xf713('0x22')](_0x10c5e8[_0xf713('0x38')][_0xf713('0x22')]);_0x145887[_0xf713('0x24')]=qs[_0xf713('0x24')](_0x10c5e8[_0xf713('0x38')][_0xf713('0x24')]);_0x145887[_0xf713('0x3c')]=qs[_0xf713('0x3d')](_0x10c5e8[_0xf713('0x38')][_0xf713('0x3d')]);_0x145887[_0xf713('0x3e')]=qs['filters'](_[_0xf713('0x40')](_0x10c5e8[_0xf713('0x38')],_0x14e2e4['filters']));_0x145887=_['merge']({},_0x145887,_0x10c5e8[_0xf713('0x45')]);return _0x2c252a[_0xf713('0x52')+_[_0xf713('0x77')](_0x10c5e8[_0xf713('0x38')][_0xf713('0x74')][_0xf713('0x78')]())+'Queues'](_0x145887);})[_0xf713('0x2b')](respondWithResult(_0x2fb1d7,null))[_0xf713('0x4e')](handleError(_0x2fb1d7,null));};exports[_0xf713('0x79')]=function(_0x5aaeb2,_0x579b13,_0x1ed38e){return db['Team'][_0xf713('0x7a')]({'where':{'id':_0x5aaeb2[_0xf713('0x5a')]['id']}})[_0xf713('0x2b')](function(_0x4defa1){if(_0x4defa1){if(!_0x5aaeb2[_0xf713('0x50')]['channel']||!utils[_0xf713('0x73')](_0x5aaeb2[_0xf713('0x50')]['channel'])){throw new db['Sequelize'][(_0xf713('0x75'))](_0xf713('0x76'));}return _0x4defa1[_0xf713('0x7b')+_[_0xf713('0x77')](_0x5aaeb2[_0xf713('0x50')][_0xf713('0x74')][_0xf713('0x78')]())+_0xf713('0x7c')](_0x5aaeb2['body']['ids']);}return null;})[_0xf713('0x2b')](handleEntityNotFound(_0x579b13,null))[_0xf713('0x2b')](respondWithStatusCode(_0x579b13,null))['catch'](handleError(_0x579b13,null));};exports['removeQueues']=function(_0x50d3c6,_0x1fb43f,_0x4add30){return db[_0xf713('0x46')][_0xf713('0x7a')]({'where':{'id':_0x50d3c6['params']['id']}})['then'](function(_0x1edfee){if(_0x1edfee){if(!_0x50d3c6[_0xf713('0x38')]['channel']||!utils['isValidChannel'](_0x50d3c6['query'][_0xf713('0x74')])){throw new db['Sequelize'][(_0xf713('0x75'))]('Unknown\x20channel');}return _0x1edfee[_0xf713('0x7d')+_[_0xf713('0x77')](_0x50d3c6['query'][_0xf713('0x74')][_0xf713('0x78')]())+_0xf713('0x7c')](_0x50d3c6[_0xf713('0x38')][_0xf713('0x7e')]);}return null;})[_0xf713('0x2b')](handleEntityNotFound(_0x1fb43f,null))['then'](respondWithStatusCode(_0x1fb43f,null))[_0xf713('0x4e')](handleError(_0x1fb43f,null));};exports['addAgents']=function(_0x20a8a9,_0x3c3a01){var _0x3fe57c=_[_0xf713('0x7f')](_0x20a8a9[_0xf713('0x50')][_0xf713('0x7e')])?_0x20a8a9['body'][_0xf713('0x7e')]:[_0x20a8a9['body'][_0xf713('0x7e')]];var _0x3c6050=_0x20a8a9[_0xf713('0x5a')]['id'];return db[_0xf713('0x46')][_0xf713('0x4d')]({'where':{'id':_0x3c6050}})['then'](handleEntityNotFound(_0x3c3a01,null))[_0xf713('0x2b')](function(_0x1004c1){if(_0x1004c1){var _0x5013c4=[_0xf713('0x80'),_0xf713('0x81'),_0xf713('0x82'),_0xf713('0x83'),_0xf713('0x84'),_0xf713('0x85'),_0xf713('0x86')];return db[_0xf713('0x5c')][_0xf713('0x5d')](function(_0x214c62){var _0x232a0b=_[_0xf713('0x31')](_0x5013c4,function(_0x259421){var _0x2dd9d2={'attributes':['id',_0xf713('0x2e')]};if(_0x259421===_0xf713('0x80')){_0x2dd9d2[_0xf713('0x87')]={'attributes':[_0xf713('0x88')]};}return _0x1004c1[_0xf713('0x52')+_0x259421+_0xf713('0x7c')](_0x2dd9d2)[_0xf713('0x2b')](function(_0x5bc9c5){var _0xfea580=_['map'](_0x5bc9c5,function(_0x2c2d09){var _0x3047f9=_['map'](_0x3fe57c,function(_0x31e1ec){var _0x512228={'where':{'UserId':_0x31e1ec,[_0x259421+'QueueId']:_0x2c2d09['id']},'transaction':_0x214c62};if(_0x259421===_0xf713('0x80')){_0x512228[_0xf713('0x1a')]={'penalty':_0x2c2d09[_0xf713('0x89')][_0xf713('0x88')]};}return db['User'+_0x259421+_0xf713('0x8a')][_0xf713('0x8b')](_0x512228)[_0xf713('0x2b')](function(){socket[_0xf713('0x8c')](_0xf713('0x51')+_0x259421+_0xf713('0x8d'),{'UserId':_0x31e1ec,[_0x259421+_0xf713('0x8e')]:_0x2c2d09['id']});if(_0x259421!==_0xf713('0x80')){return;}return db['User']['findAll']({'where':{'id':_0x3fe57c,'online':0x1},'attributes':['id',_0xf713('0x2e'),'online',_0xf713('0x8f'),_0xf713('0x90')],'raw':!![]})[_0xf713('0x2b')](function(_0x1d670b){var _0x4abded=_[_0xf713('0x31')](_0x1d670b,function(_0x105bd1){return db[_0xf713('0x91')][_0xf713('0x92')]({'membername':_0x105bd1['name'],'UserId':_0x105bd1['id'],'queue_name':_0x2c2d09['name'],'VoiceQueueId':_0x2c2d09['id'],'interface':_[_0xf713('0x93')](_0x105bd1[_0xf713('0x90')])?util[_0xf713('0x94')](_0xf713('0x95'),_0x105bd1[_0xf713('0x2e')]):_0x105bd1[_0xf713('0x90')],'paused':_0x105bd1['voicePause']||![],'penalty':_0x2c2d09[_0xf713('0x89')][_0xf713('0x88')]},{'transaction':_0x214c62});});return Promise[_0xf713('0x96')](_0x4abded);});});});return Promise[_0xf713('0x96')](_0x3047f9);});return Promise[_0xf713('0x96')](_0xfea580);})[_0xf713('0x2b')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x3c6050}})['then'](function(_0x5386cc){if(_0x5386cc){var _0x490230=_[_0xf713('0x31')](_0x3fe57c,function(_0x24576a){db[_0xf713('0x70')]['upsert']({'UserId':_0x24576a,'VoicePrefixId':_0x5386cc[_0xf713('0x71')]});});return Promise[_0xf713('0x96')](_0x490230);}});});});return Promise['all'](_0x232a0b)[_0xf713('0x2b')](function(){return _0x1004c1[_0xf713('0x97')](_0x3fe57c,{'transaction':_0x214c62})['spread'](function(_0x464833){return _0x464833;});});});}})[_0xf713('0x2b')](respondWithResult(_0x3c3a01,null))[_0xf713('0x4e')](handleError(_0x3c3a01,null));};exports[_0xf713('0x98')]=function(_0x474429,_0x54670d){var _0x2a78a1=_[_0xf713('0x7f')](_0x474429[_0xf713('0x38')][_0xf713('0x7e')])?_0x474429[_0xf713('0x38')][_0xf713('0x7e')]:[_0x474429[_0xf713('0x38')][_0xf713('0x7e')]];var _0x421512=_0x474429[_0xf713('0x5a')]['id'];return db['Team'][_0xf713('0x4d')]({'where':{'id':_0x421512}})['then'](handleEntityNotFound(_0x54670d,null))[_0xf713('0x2b')](function(_0x39d4a4){if(_0x39d4a4){var _0x2c299b=[_0xf713('0x80'),_0xf713('0x81'),_0xf713('0x82'),_0xf713('0x83'),_0xf713('0x84'),_0xf713('0x85'),_0xf713('0x86')];return db[_0xf713('0x5c')]['transaction'](function(_0x57d98e){var _0x1e9c85=_[_0xf713('0x31')](_0x2c299b,function(_0xf2fc41){var _0x10ea0e={'attributes':['id','name']};return _0x39d4a4['get'+_0xf2fc41+_0xf713('0x7c')](_0x10ea0e)[_0xf713('0x2b')](function(_0x27d447){var _0x17c7ef=_[_0xf713('0x31')](_0x27d447,function(_0x5aab5b){return _0x5aab5b[_0xf713('0x98')](_0x2a78a1,{'transaction':_0x57d98e})[_0xf713('0x2b')](function(){var _0x4c2d68=_[_0xf713('0x31')](_0x2a78a1,function(_0x43e92d){socket[_0xf713('0x8c')]('user'+_0xf2fc41+_0xf713('0x99'),{'UserId':Number(_0x43e92d),[_0xf2fc41+_0xf713('0x8e')]:_0x5aab5b['id']});if(_0xf2fc41!=='Voice'){return;}return db['UserVoiceQueueRt'][_0xf713('0x5b')]({'where':{'VoiceQueueId':_0x5aab5b['id'],'UserId':_0x43e92d},'transaction':_0x57d98e});});return Promise['all'](_0x4c2d68);});});return Promise['all'](_0x17c7ef);});});return Promise[_0xf713('0x96')](_0x1e9c85)[_0xf713('0x2b')](function(){return _0x39d4a4[_0xf713('0x98')](_0x2a78a1,{'transaction':_0x57d98e});})[_0xf713('0x2b')](function(){return db[_0xf713('0x6f')][_0xf713('0x7a')]({'where':{'teamId':_0x421512}})[_0xf713('0x2b')](function(_0x20853e){if(_0x20853e){var _0xe7e303=_['map'](_0x2a78a1,function(_0x37f2c1){db[_0xf713('0x70')][_0xf713('0x5b')]({'where':{'UserId':_0x37f2c1,'VoicePrefixId':_0x20853e[_0xf713('0x71')]}});});return Promise['all'](_0xe7e303);}});});});}})['then'](respondWithStatusCode(_0x54670d,null))[_0xf713('0x4e')](handleError(_0x54670d,null));};exports[_0xf713('0x9a')]=function(_0x430aae,_0x117fed,_0x4e385c){var _0x43030a={};var _0x48b1a8={};var _0x2a8e2d;var _0x10f895;return db[_0xf713('0x46')][_0xf713('0x7a')]({'where':{'id':_0x430aae[_0xf713('0x5a')]['id']}})[_0xf713('0x2b')](handleEntityNotFound(_0x117fed,null))[_0xf713('0x2b')](function(_0xf5384){if(_0xf5384){_0x2a8e2d=_0xf5384;_0x48b1a8['model']=_[_0xf713('0x36')](db[_0xf713('0x9b')][_0xf713('0x32')]);_0x48b1a8[_0xf713('0x38')]=_[_0xf713('0x36')](_0x430aae['query']);_0x48b1a8[_0xf713('0x3f')]=_[_0xf713('0x37')](_0x48b1a8[_0xf713('0x35')],_0x48b1a8[_0xf713('0x38')]);_0x43030a['attributes']=_[_0xf713('0x37')](_0x48b1a8[_0xf713('0x35')],qs[_0xf713('0x4b')](_0x430aae['query']['fields']));_0x43030a[_0xf713('0x39')]=_0x43030a[_0xf713('0x39')][_0xf713('0x3a')]?_0x43030a[_0xf713('0x39')]:_0x48b1a8[_0xf713('0x35')];_0x43030a[_0xf713('0x3c')]=qs[_0xf713('0x3d')](_0x430aae[_0xf713('0x38')][_0xf713('0x3d')]);_0x43030a[_0xf713('0x3e')]=qs['filters'](_['pick'](_0x430aae[_0xf713('0x38')],_0x48b1a8[_0xf713('0x3f')]));if(_0x430aae[_0xf713('0x38')][_0xf713('0x44')]){_0x43030a[_0xf713('0x3e')]=_[_0xf713('0x41')](_0x43030a['where'],{'$or':_[_0xf713('0x31')](_0x43030a[_0xf713('0x39')],function(_0x172e33){var _0x56a080={};_0x56a080[_0x172e33]={'$like':'%'+_0x430aae['query'][_0xf713('0x44')]+'%'};return _0x56a080;})});}_0x43030a=_[_0xf713('0x41')]({},_0x43030a,_0x430aae[_0xf713('0x45')]);return _0x2a8e2d[_0xf713('0x9a')](_0x43030a);}})[_0xf713('0x2b')](function(_0x5dea1d){if(_0x5dea1d){_0x10f895=_0x5dea1d['length'];if(!_0x430aae[_0xf713('0x38')][_0xf713('0x9c')](_0xf713('0x3b'))){_0x43030a[_0xf713('0x22')]=qs[_0xf713('0x22')](_0x430aae[_0xf713('0x38')][_0xf713('0x22')]);_0x43030a[_0xf713('0x24')]=qs[_0xf713('0x24')](_0x430aae[_0xf713('0x38')][_0xf713('0x24')]);}return _0x2a8e2d[_0xf713('0x9a')](_0x43030a);}})[_0xf713('0x2b')](function(_0x5aed33){if(_0x5aed33){return _0x5aed33?{'count':_0x10f895,'rows':_0x5aed33}:null;}})[_0xf713('0x2b')](respondWithResult(_0x117fed,null))[_0xf713('0x4e')](handleError(_0x117fed,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 01cf824..e3a4dd9 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 _0x6216=['emit','exports','events','../../mysqldb','Team','save','update','remove'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x6216,0x1b2));var _0x6621=function(_0x883470,_0x47d6bf){_0x883470=_0x883470-0x0;var _0x433e7b=_0x6216[_0x883470];return _0x433e7b;};'use strict';var EventEmitter=require(_0x6621('0x0'));var Team=require(_0x6621('0x1'))['db'][_0x6621('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6621('0x3'),'afterUpdate':_0x6621('0x4'),'afterDestroy':_0x6621('0x5')};function emitEvent(_0x1123f2){return function(_0x21fe41,_0x3e1b33,_0x5350af){TeamEvents[_0x6621('0x6')](_0x1123f2+':'+_0x21fe41['id'],_0x21fe41);TeamEvents[_0x6621('0x6')](_0x1123f2,_0x21fe41);_0x5350af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x6621('0x7')]=TeamEvents; \ No newline at end of file +var _0xaa24=['../../mysqldb','Team','setMaxListeners','save','update','emit','hasOwnProperty','events'];(function(_0x10a080,_0x49a6d3){var _0x3d6d54=function(_0x27f349){while(--_0x27f349){_0x10a080['push'](_0x10a080['shift']());}};_0x3d6d54(++_0x49a6d3);}(_0xaa24,0xcf));var _0x4aa2=function(_0x3099ff,_0x5bab1b){_0x3099ff=_0x3099ff-0x0;var _0x229aba=_0xaa24[_0x3099ff];return _0x229aba;};'use strict';var EventEmitter=require(_0x4aa2('0x0'));var Team=require(_0x4aa2('0x1'))['db'][_0x4aa2('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x4aa2('0x3')](0x0);var events={'afterCreate':_0x4aa2('0x4'),'afterUpdate':_0x4aa2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x68bde6){return function(_0x3bd897,_0x17e498,_0x2633b4){TeamEvents[_0x4aa2('0x6')](_0x68bde6+':'+_0x3bd897['id'],_0x3bd897);TeamEvents[_0x4aa2('0x6')](_0x68bde6,_0x3bd897);_0x2633b4(null);};}for(var e in events){if(events[_0x4aa2('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 833ddf2..a34f586 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 _0x3037=['./team.attributes','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Mail','Openchannel','Sms','Whatsapp','resolve','all','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3037,0x1a8));var _0x7303=function(_0x3b7e06,_0x3b154a){_0x3b7e06=_0x3b7e06-0x0;var _0x4d354a=_0x3037[_0x3b7e06];return _0x4d354a;};'use strict';var _=require(_0x7303('0x0'));var attributes=require(_0x7303('0x1'));function getQueuesByChannel(_0x3b2abf,_0x1a283c){var _0x4d223f='get'+_0x1a283c+'Queues';return _0x3b2abf[_0x4d223f]()['then'](function(_0x3d2d74){return _[_0x7303('0x2')](_0x3d2d74,function(_0x45e661){_0x45e661[_0x7303('0x3')](_0x7303('0x4'),_0x1a283c);return _0x45e661;});})[_0x7303('0x5')](function(_0x173a63){throw _0x173a63;});}module[_0x7303('0x6')]=function(_0x33c13c){return _0x33c13c[_0x7303('0x7')](_0x7303('0x8'),attributes,{'tableName':_0x7303('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x592ff5=this;var _0x3ed58d=[_0x7303('0xa'),'Fax',_0x7303('0xb'),_0x7303('0xc'),_0x7303('0xd'),'Voice',_0x7303('0xe')];return Promise[_0x7303('0xf')]()['then'](function(){var _0xf4d288=_[_0x7303('0x2')](_0x3ed58d,function(_0x3e1ca4){return getQueuesByChannel(_0x592ff5,_0x3e1ca4);});return Promise[_0x7303('0x10')](_0xf4d288);})[_0x7303('0x5')](function(_0x2a7a65){throw _0x2a7a65;});}}});}; \ No newline at end of file +var _0x5eea=['./team.attributes','get','map','setDataValue','channel','catch','exports','Fax','Mail','Sms','Voice','resolve','all'];(function(_0x303b1b,_0x210aac){var _0x25ade1=function(_0x59f2fe){while(--_0x59f2fe){_0x303b1b['push'](_0x303b1b['shift']());}};_0x25ade1(++_0x210aac);}(_0x5eea,0x186));var _0xa5ee=function(_0x5ed3fe,_0x200072){_0x5ed3fe=_0x5ed3fe-0x0;var _0x2c30b3=_0x5eea[_0x5ed3fe];return _0x2c30b3;};'use strict';var _=require('lodash');var attributes=require(_0xa5ee('0x0'));function getQueuesByChannel(_0x12a80e,_0x179a2b){var _0x45a788=_0xa5ee('0x1')+_0x179a2b+'Queues';return _0x12a80e[_0x45a788]()['then'](function(_0x937971){return _[_0xa5ee('0x2')](_0x937971,function(_0x2b5b7d){_0x2b5b7d[_0xa5ee('0x3')](_0xa5ee('0x4'),_0x179a2b);return _0x2b5b7d;});})[_0xa5ee('0x5')](function(_0x36ea50){throw _0x36ea50;});}module[_0xa5ee('0x6')]=function(_0x3e558d){return _0x3e558d['define']('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x149d11=this;var _0x5b10e0=['Chat',_0xa5ee('0x7'),_0xa5ee('0x8'),'Openchannel',_0xa5ee('0x9'),_0xa5ee('0xa'),'Whatsapp'];return Promise[_0xa5ee('0xb')]()['then'](function(){var _0x3e777e=_[_0xa5ee('0x2')](_0x5b10e0,function(_0x370c97){return getQueuesByChannel(_0x149d11,_0x370c97);});return Promise[_0xa5ee('0xc')](_0x3e777e);})[_0xa5ee('0x5')](function(_0x587bb0){throw _0x587bb0;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 52e3e6a..e5e63de 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 _0x2e12=['then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request'];(function(_0x5c73ee,_0x5c99b1){var _0x70bb66=function(_0x52ee23){while(--_0x52ee23){_0x5c73ee['push'](_0x5c73ee['shift']());}};_0x70bb66(++_0x5c99b1);}(_0x2e12,0x1e9));var _0x22e1=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x2e12[_0x455c6c];return _0x488242;};'use strict';var _=require('lodash');var util=require(_0x22e1('0x0'));var moment=require(_0x22e1('0x1'));var BPromise=require(_0x22e1('0x2'));var rs=require(_0x22e1('0x3'));var fs=require('fs');var Redis=require(_0x22e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x22e1('0x5'));var logger=require('../../config/logger')(_0x22e1('0x6'));var config=require(_0x22e1('0x7'));var jayson=require(_0x22e1('0x8'));var client=jayson[_0x22e1('0x9')][_0x22e1('0xa')]({'port':0x232a});config[_0x22e1('0xb')]=_['defaults'](config['redis'],{'host':_0x22e1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x22e1('0xb')]));require('./team.socket')[_0x22e1('0xd')](socket);function respondWithRpcPromise(_0x2a73c5,_0x142f84,_0x2e7626){return new BPromise(function(_0x554974,_0x3f1e0b){return client[_0x22e1('0xe')](_0x2a73c5,_0x2e7626)[_0x22e1('0xf')](function(_0x5aa097){logger[_0x22e1('0x10')](_0x22e1('0x11'),_0x142f84,_0x22e1('0x12'));logger[_0x22e1('0x13')](_0x22e1('0x14'),_0x142f84,'request\x20sent',JSON[_0x22e1('0x15')](_0x5aa097));if(_0x5aa097[_0x22e1('0x16')]){if(_0x5aa097[_0x22e1('0x16')]['code']===0x1f4){logger[_0x22e1('0x16')](_0x22e1('0x11'),_0x142f84,_0x5aa097[_0x22e1('0x16')]['message']);return _0x3f1e0b(_0x5aa097[_0x22e1('0x16')][_0x22e1('0x17')]);}logger['error']('Team,\x20%s,\x20%s',_0x142f84,_0x5aa097[_0x22e1('0x16')][_0x22e1('0x17')]);return _0x554974(_0x5aa097[_0x22e1('0x16')][_0x22e1('0x17')]);}else{logger[_0x22e1('0x10')](_0x22e1('0x11'),_0x142f84,'request\x20sent');_0x554974(_0x5aa097['result'][_0x22e1('0x17')]);}})['catch'](function(_0x1f01fd){logger['error'](_0x22e1('0x11'),_0x142f84,_0x1f01fd);_0x3f1e0b(_0x1f01fd);});});} \ No newline at end of file +var _0x3e1e=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','randomstring'];(function(_0x2a74ab,_0x469323){var _0x450ac7=function(_0x2ada7a){while(--_0x2ada7a){_0x2a74ab['push'](_0x2a74ab['shift']());}};_0x450ac7(++_0x469323);}(_0x3e1e,0xef));var _0xe3e1=function(_0x517ec9,_0x261b83){_0x517ec9=_0x517ec9-0x0;var _0x5a9ad1=_0x3e1e[_0x517ec9];return _0x5a9ad1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe3e1('0x0'));var fs=require('fs');var Redis=require(_0xe3e1('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xe3e1('0x2'));var logger=require(_0xe3e1('0x3'))('rpc');var config=require(_0xe3e1('0x4'));var jayson=require(_0xe3e1('0x5'));var client=jayson[_0xe3e1('0x6')]['http']({'port':0x232a});config[_0xe3e1('0x7')]=_[_0xe3e1('0x8')](config[_0xe3e1('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xe3e1('0x9'))(new Redis(config[_0xe3e1('0x7')]));require(_0xe3e1('0xa'))[_0xe3e1('0xb')](socket);function respondWithRpcPromise(_0x3f21bd,_0x2214b7,_0x2d40b2){return new BPromise(function(_0x2026f2,_0x7f538b){return client[_0xe3e1('0xc')](_0x3f21bd,_0x2d40b2)['then'](function(_0x1b6857){logger[_0xe3e1('0xd')](_0xe3e1('0xe'),_0x2214b7,_0xe3e1('0xf'));logger[_0xe3e1('0x10')](_0xe3e1('0x11'),_0x2214b7,'request\x20sent',JSON[_0xe3e1('0x12')](_0x1b6857));if(_0x1b6857[_0xe3e1('0x13')]){if(_0x1b6857[_0xe3e1('0x13')][_0xe3e1('0x14')]===0x1f4){logger['error'](_0xe3e1('0xe'),_0x2214b7,_0x1b6857[_0xe3e1('0x13')][_0xe3e1('0x15')]);return _0x7f538b(_0x1b6857[_0xe3e1('0x13')][_0xe3e1('0x15')]);}logger[_0xe3e1('0x13')](_0xe3e1('0xe'),_0x2214b7,_0x1b6857[_0xe3e1('0x13')][_0xe3e1('0x15')]);return _0x2026f2(_0x1b6857[_0xe3e1('0x13')][_0xe3e1('0x15')]);}else{logger[_0xe3e1('0xd')]('Team,\x20%s,\x20%s',_0x2214b7,'request\x20sent');_0x2026f2(_0x1b6857[_0xe3e1('0x16')]['message']);}})[_0xe3e1('0x17')](function(_0x21432e){logger[_0xe3e1('0x13')](_0xe3e1('0xe'),_0x2214b7,_0x21432e);_0x7f538b(_0x21432e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 10e37df..4ba2d3c 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 _0x6f2f=['./team.events','save','removeListener','length','team:'];(function(_0x397dd0,_0x58a7a8){var _0x4188b2=function(_0x173bb7){while(--_0x173bb7){_0x397dd0['push'](_0x397dd0['shift']());}};_0x4188b2(++_0x58a7a8);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x6f2f[_0x4f9b18];return _0x29f20c;};'use strict';var TeamEvents=require(_0xf6f2('0x0'));var events=[_0xf6f2('0x1'),'remove','update'];function createListener(_0x5f4600,_0x4232e1){return function(_0x4a4431){_0x4232e1['emit'](_0x5f4600,_0x4a4431);};}function removeListener(_0xc69b60,_0x305bb){return function(){TeamEvents[_0xf6f2('0x2')](_0xc69b60,_0x305bb);};}exports['register']=function(_0x5c540a){for(var _0x1123bb=0x0,_0x1c94ad=events[_0xf6f2('0x3')];_0x1123bb<_0x1c94ad;_0x1123bb++){var _0x774922=events[_0x1123bb];var _0x15a71c=createListener(_0xf6f2('0x4')+_0x774922,_0x5c540a);TeamEvents['on'](_0x774922,_0x15a71c);}}; \ No newline at end of file +var _0x063e=['length','./team.events','save','remove','update','emit','removeListener','register'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x063e,0x111));var _0xe063=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x063e[_0x279d37];return _0x530173;};'use strict';var TeamEvents=require(_0xe063('0x0'));var events=[_0xe063('0x1'),_0xe063('0x2'),_0xe063('0x3')];function createListener(_0x2dc38f,_0x29be6d){return function(_0x31ff69){_0x29be6d[_0xe063('0x4')](_0x2dc38f,_0x31ff69);};}function removeListener(_0x3b58ec,_0x35a88b){return function(){TeamEvents[_0xe063('0x5')](_0x3b58ec,_0x35a88b);};}exports[_0xe063('0x6')]=function(_0x4cc570){for(var _0x5e99c3=0x0,_0x561d7b=events[_0xe063('0x7')];_0x5e99c3<_0x561d7b;_0x5e99c3++){var _0x661f34=events[_0x5e99c3];var _0x1c48ea=createListener('team:'+_0x661f34,_0x4cc570);TeamEvents['on'](_0x661f34,_0x1c48ea);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index fccb418..ed77d34 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a5c=['INTEGER','sequelize','exports'];(function(_0x5710be,_0x6f8d1b){var _0x1cc25a=function(_0x4ca9d3){while(--_0x4ca9d3){_0x5710be['push'](_0x5710be['shift']());}};_0x1cc25a(++_0x6f8d1b);}(_0x9a5c,0x184));var _0xc9a5=function(_0x34f1a2,_0x1f7b1c){_0x34f1a2=_0x34f1a2-0x0;var _0x2572b9=_0x9a5c[_0x34f1a2];return _0x2572b9;};'use strict';var Sequelize=require(_0xc9a5('0x0'));module[_0xc9a5('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xc9a5('0x2')]}}; \ No newline at end of file +var _0x90db=['exports','INTEGER'];(function(_0x514426,_0xc00f03){var _0x1b1ee0=function(_0x1a5b0c){while(--_0x1a5b0c){_0x514426['push'](_0x514426['shift']());}};_0x1b1ee0(++_0xc00f03);}(_0x90db,0x1c0));var _0xb90d=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x90db[_0x75f869];return _0x10af8b;};'use strict';var Sequelize=require('sequelize');module[_0xb90d('0x0')]={'TeamId':{'type':Sequelize[_0xb90d('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xb90d('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index dd4d01d..b3e2087 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c0d=['./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfefdd0,_0x4bec62){var _0x8c0725=function(_0x2d6703){while(--_0x2d6703){_0xfefdd0['push'](_0xfefdd0['shift']());}};_0x8c0725(++_0x4bec62);}(_0x3c0d,0xf6));var _0xd3c0=function(_0x28278f,_0x574b0d){_0x28278f=_0x28278f-0x0;var _0x3d9f74=_0x3c0d[_0x28278f];return _0x3d9f74;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd3c0('0x0'));var moment=require(_0xd3c0('0x1'));var BPromise=require(_0xd3c0('0x2'));var rp=require(_0xd3c0('0x3'));var fs=require('fs');var path=require(_0xd3c0('0x4'));var rimraf=require(_0xd3c0('0x5'));var config=require(_0xd3c0('0x6'));var attributes=require(_0xd3c0('0x7'));module[_0xd3c0('0x8')]=function(_0x4d5cf1,_0x36ce7f){return _0x4d5cf1['define'](_0xd3c0('0x9'),attributes,{'tableName':_0xd3c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cdc=['exports','define','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x529060,_0x416111){var _0x3dc46e=function(_0x502547){while(--_0x502547){_0x529060['push'](_0x529060['shift']());}};_0x3dc46e(++_0x416111);}(_0x7cdc,0x190));var _0xc7cd=function(_0x3b68c1,_0x12a2cd){_0x3b68c1=_0x3b68c1-0x0;var _0x33b919=_0x7cdc[_0x3b68c1];return _0x33b919;};'use strict';var _=require('lodash');var util=require(_0xc7cd('0x0'));var logger=require(_0xc7cd('0x1'))('api');var moment=require(_0xc7cd('0x2'));var BPromise=require(_0xc7cd('0x3'));var rp=require(_0xc7cd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7cd('0x5'));var config=require(_0xc7cd('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0xc7cd('0x7')]=function(_0x26603f,_0x18bb1b){return _0x26603f[_0xc7cd('0x8')](_0xc7cd('0x9'),attributes,{'tableName':_0xc7cd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 74c4c26..8678d17 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1d2dc6,_0x50b4d1){var _0x4027a5=function(_0x27fe98){while(--_0x27fe98){_0x1d2dc6['push'](_0x1d2dc6['shift']());}};_0x4027a5(++_0x50b4d1);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x18ee3f,_0x22ff1e){var _0x2b1737=function(_0x138ae3){while(--_0x138ae3){_0x18ee3f['push'](_0x18ee3f['shift']());}};_0x2b1737(++_0x22ff1e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xcb91[_0xd816e2];return _0x1f5924;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 7b2e5ac..856b97a 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 _0xf229=['INTEGER'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0xf229,0x17c));var _0x9f22=function(_0x5c58a2,_0x4c0c73){_0x5c58a2=_0x5c58a2-0x0;var _0x30a2d4=_0xf229[_0x5c58a2];return _0x30a2d4;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x9f22('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5e38=['sequelize','exports','INTEGER'];(function(_0x112cb1,_0x13a91a){var _0x134d19=function(_0x38dd89){while(--_0x38dd89){_0x112cb1['push'](_0x112cb1['shift']());}};_0x134d19(++_0x13a91a);}(_0x5e38,0x1b0));var _0x85e3=function(_0x24d66f,_0xc44166){_0x24d66f=_0x24d66f-0x0;var _0x201bf5=_0x5e38[_0x24d66f];return _0x201bf5;};'use strict';var Sequelize=require(_0x85e3('0x0'));module[_0x85e3('0x1')]={'penalty':{'type':Sequelize[_0x85e3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index d0463a9..239a620 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 _0x616c=['moment','bluebird','request-promise','path','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','util','../../config/logger'];(function(_0x50dd54,_0x31af22){var _0x5a8f89=function(_0x1afad1){while(--_0x1afad1){_0x50dd54['push'](_0x50dd54['shift']());}};_0x5a8f89(++_0x31af22);}(_0x616c,0x1b6));var _0xc616=function(_0x49c90f,_0x3da60e){_0x49c90f=_0x49c90f-0x0;var _0x48e99b=_0x616c[_0x49c90f];return _0x48e99b;};'use strict';var _=require('lodash');var util=require(_0xc616('0x0'));var logger=require(_0xc616('0x1'))('api');var moment=require(_0xc616('0x2'));var BPromise=require(_0xc616('0x3'));var rp=require(_0xc616('0x4'));var fs=require('fs');var path=require(_0xc616('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc616('0x6'));module[_0xc616('0x7')]=function(_0x1772f5,_0x15f809){return _0x1772f5[_0xc616('0x8')](_0xc616('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e19=['../../config/logger','api','moment','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','lodash','util'];(function(_0x4a1e37,_0x2eef28){var _0xeb1f8b=function(_0x5854e6){while(--_0x5854e6){_0x4a1e37['push'](_0x4a1e37['shift']());}};_0xeb1f8b(++_0x2eef28);}(_0x1e19,0x1c9));var _0x91e1=function(_0x1bd34a,_0x574c63){_0x1bd34a=_0x1bd34a-0x0;var _0x1ed08e=_0x1e19[_0x1bd34a];return _0x1ed08e;};'use strict';var _=require(_0x91e1('0x0'));var util=require(_0x91e1('0x1'));var logger=require(_0x91e1('0x2'))(_0x91e1('0x3'));var moment=require(_0x91e1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x91e1('0x5'));var attributes=require(_0x91e1('0x6'));module[_0x91e1('0x7')]=function(_0x45d13a,_0x38c2c0){return _0x45d13a['define'](_0x91e1('0x8'),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 8db4a25..360168c 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 _0xf1b6=['request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0xf1b6,0xd1));var _0x6f1b=function(_0x345daf,_0x5216df){_0x345daf=_0x345daf-0x0;var _0x5c31a5=_0xf1b6[_0x345daf];return _0x5c31a5;};'use strict';var _=require('lodash');var util=require(_0x6f1b('0x0'));var moment=require('moment');var BPromise=require(_0x6f1b('0x1'));var rs=require(_0x6f1b('0x2'));var fs=require('fs');var Redis=require(_0x6f1b('0x3'));var db=require(_0x6f1b('0x4'))['db'];var utils=require(_0x6f1b('0x5'));var logger=require('../../config/logger')(_0x6f1b('0x6'));var config=require(_0x6f1b('0x7'));var jayson=require(_0x6f1b('0x8'));var client=jayson[_0x6f1b('0x9')][_0x6f1b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dc0d4,_0x1449d6,_0x1aaacc){return new BPromise(function(_0x23945f,_0x56c5e5){return client[_0x6f1b('0xb')](_0x2dc0d4,_0x1aaacc)['then'](function(_0x400a4c){logger['info'](_0x6f1b('0xc'),_0x1449d6,_0x6f1b('0xd'));logger[_0x6f1b('0xe')](_0x6f1b('0xf'),_0x1449d6,_0x6f1b('0xd'),JSON[_0x6f1b('0x10')](_0x400a4c));if(_0x400a4c['error']){if(_0x400a4c[_0x6f1b('0x11')][_0x6f1b('0x12')]===0x1f4){logger['error'](_0x6f1b('0xc'),_0x1449d6,_0x400a4c[_0x6f1b('0x11')][_0x6f1b('0x13')]);return _0x56c5e5(_0x400a4c[_0x6f1b('0x11')][_0x6f1b('0x13')]);}logger[_0x6f1b('0x11')](_0x6f1b('0xc'),_0x1449d6,_0x400a4c[_0x6f1b('0x11')][_0x6f1b('0x13')]);return _0x23945f(_0x400a4c[_0x6f1b('0x11')]['message']);}else{logger[_0x6f1b('0x14')](_0x6f1b('0xc'),_0x1449d6,_0x6f1b('0xd'));_0x23945f(_0x400a4c['result'][_0x6f1b('0x13')]);}})[_0x6f1b('0x15')](function(_0x1acf0c){logger[_0x6f1b('0x11')](_0x6f1b('0xc'),_0x1449d6,_0x1acf0c);_0x56c5e5(_0x1acf0c);});});} \ No newline at end of file +var _0xca8d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca8d,0x172));var _0xdca8=function(_0x315d84,_0x3dacc3){_0x315d84=_0x315d84-0x0;var _0x560da1=_0xca8d[_0x315d84];return _0x560da1;};'use strict';var _=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var moment=require(_0xdca8('0x2'));var BPromise=require(_0xdca8('0x3'));var rs=require(_0xdca8('0x4'));var fs=require('fs');var Redis=require(_0xdca8('0x5'));var db=require(_0xdca8('0x6'))['db'];var utils=require(_0xdca8('0x7'));var logger=require(_0xdca8('0x8'))(_0xdca8('0x9'));var config=require(_0xdca8('0xa'));var jayson=require(_0xdca8('0xb'));var client=jayson['client'][_0xdca8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d18ba,_0x5e5d55,_0x2f034e){return new BPromise(function(_0x152d05,_0x50c8fe){return client[_0xdca8('0xd')](_0x1d18ba,_0x2f034e)[_0xdca8('0xe')](function(_0x21c234){logger['info'](_0xdca8('0xf'),_0x5e5d55,_0xdca8('0x10'));logger[_0xdca8('0x11')](_0xdca8('0x12'),_0x5e5d55,_0xdca8('0x10'),JSON[_0xdca8('0x13')](_0x21c234));if(_0x21c234[_0xdca8('0x14')]){if(_0x21c234[_0xdca8('0x14')][_0xdca8('0x15')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x5e5d55,_0x21c234[_0xdca8('0x14')][_0xdca8('0x16')]);return _0x50c8fe(_0x21c234[_0xdca8('0x14')][_0xdca8('0x16')]);}logger[_0xdca8('0x14')](_0xdca8('0xf'),_0x5e5d55,_0x21c234[_0xdca8('0x14')][_0xdca8('0x16')]);return _0x152d05(_0x21c234[_0xdca8('0x14')][_0xdca8('0x16')]);}else{logger[_0xdca8('0x17')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5e5d55,'request\x20sent');_0x152d05(_0x21c234[_0xdca8('0x18')]['message']);}})['catch'](function(_0x13c269){logger['error'](_0xdca8('0xf'),_0x5e5d55,_0x13c269);_0x50c8fe(_0x13c269);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 843828e..bcef610 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 _0xae24=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','post','isAuthenticated','create','put'];(function(_0x4acc5c,_0x397ff8){var _0x23ec04=function(_0x572e5d){while(--_0x572e5d){_0x4acc5c['push'](_0x4acc5c['shift']());}};_0x23ec04(++_0x397ff8);}(_0xae24,0x180));var _0x4ae2=function(_0x4c24f7,_0x1d473f){_0x4c24f7=_0x4c24f7-0x0;var _0x39e168=_0xae24[_0x4c24f7];return _0x39e168;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ae2('0x0'));var timeout=require(_0x4ae2('0x1'));var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require(_0x4ae2('0x4'));var auth=require(_0x4ae2('0x5'));var interaction=require(_0x4ae2('0x6'));var config=require(_0x4ae2('0x7'));var controller=require(_0x4ae2('0x8'));router[_0x4ae2('0x9')]('/',auth['isAuthenticated'](),controller[_0x4ae2('0xa')]);router[_0x4ae2('0x9')](_0x4ae2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4ae2('0xc')]('/',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0xe')]);router[_0x4ae2('0xf')](_0x4ae2('0xb'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x10')]);router[_0x4ae2('0x11')](_0x4ae2('0xb'),auth['isAuthenticated'](),controller[_0x4ae2('0x12')]);module[_0x4ae2('0x13')]=router; \ No newline at end of file +var _0x09d2=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x09d2,0x1d2));var _0x209d=function(_0x3c3603,_0xb16e87){_0x3c3603=_0x3c3603-0x0;var _0x588811=_0x09d2[_0x3c3603];return _0x588811;};'use strict';var multer=require(_0x209d('0x0'));var util=require(_0x209d('0x1'));var path=require(_0x209d('0x2'));var timeout=require(_0x209d('0x3'));var express=require(_0x209d('0x4'));var router=express[_0x209d('0x5')]();var fs_extra=require(_0x209d('0x6'));var auth=require(_0x209d('0x7'));var interaction=require(_0x209d('0x8'));var config=require(_0x209d('0x9'));var controller=require('./template.controller');router[_0x209d('0xa')]('/',auth[_0x209d('0xb')](),controller[_0x209d('0xc')]);router[_0x209d('0xa')](_0x209d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x209d('0xe')]('/',auth[_0x209d('0xb')](),controller[_0x209d('0xf')]);router['put'](_0x209d('0xd'),auth['isAuthenticated'](),controller[_0x209d('0x10')]);router[_0x209d('0x11')](_0x209d('0xd'),auth[_0x209d('0xb')](),controller[_0x209d('0x12')]);module[_0x209d('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 930a37e..8e94f1f 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 _0xd795=['STRING','exports'];(function(_0x285cd6,_0x3b4e2f){var _0x5cc352=function(_0x17e502){while(--_0x17e502){_0x285cd6['push'](_0x285cd6['shift']());}};_0x5cc352(++_0x3b4e2f);}(_0xd795,0xa3));var _0x5d79=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xd795[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require('sequelize');module[_0x5d79('0x0')]={'name':{'type':Sequelize[_0x5d79('0x1')]},'description':{'type':Sequelize[_0x5d79('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc003=['STRING','TEXT','sequelize','exports'];(function(_0x2e1d41,_0x37f8b0){var _0x82edaa=function(_0x4333f9){while(--_0x4333f9){_0x2e1d41['push'](_0x2e1d41['shift']());}};_0x82edaa(++_0x37f8b0);}(_0xc003,0xb6));var _0x3c00=function(_0x418162,_0x227127){_0x418162=_0x418162-0x0;var _0x101772=_0xc003[_0x418162];return _0x101772;};'use strict';var Sequelize=require(_0x3c00('0x0'));module[_0x3c00('0x1')]={'name':{'type':Sequelize[_0x3c00('0x2')]},'description':{'type':Sequelize[_0x3c00('0x2')]},'html':{'type':Sequelize[_0x3c00('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 930b210..801e267 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 _0x7484=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','Templates','UserProfileResource','destroy','send','index','map','rawAttributes','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Template','include','findAll','rows','show','params','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x5dd0dd,_0x547574){var _0x20a14c=function(_0x21e4d3){while(--_0x21e4d3){_0x5dd0dd['push'](_0x5dd0dd['shift']());}};_0x20a14c(++_0x547574);}(_0x7484,0xe0));var _0x4748=function(_0x52835d,_0x47b9b3){_0x52835d=_0x52835d-0x0;var _0x5724c0=_0x7484[_0x52835d];return _0x5724c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4748('0x0'));var zipdir=require(_0x4748('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4748('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4748('0x3'));var util=require(_0x4748('0x4'));var path=require(_0x4748('0x5'));var sox=require(_0x4748('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4748('0x7'));var _=require(_0x4748('0x8'));var squel=require(_0x4748('0x9'));var crypto=require('crypto');var jsforce=require(_0x4748('0xa'));var deskjs=require(_0x4748('0xb'));var toCsv=require(_0x4748('0xc'));var querystring=require('querystring');var Papa=require(_0x4748('0xd'));var Redis=require('ioredis');var authService=require(_0x4748('0xe'));var qs=require(_0x4748('0xf'));var as=require(_0x4748('0x10'));var hardwareService=require(_0x4748('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x4748('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x4748('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e11d2,_0x1fe360){_0x1fe360=_0x1fe360||0xcc;return function(_0x5b7241){if(_0x5b7241){return _0x4e11d2[_0x4748('0x14')](_0x1fe360);}return _0x4e11d2[_0x4748('0x15')](_0x1fe360)[_0x4748('0x16')]();};}function respondWithResult(_0x5c8d54,_0x55a30b){_0x55a30b=_0x55a30b||0xc8;return function(_0x1e6ebb){if(_0x1e6ebb){return _0x5c8d54['status'](_0x55a30b)[_0x4748('0x17')](_0x1e6ebb);}};}function respondWithFilteredResult(_0x32ff3e,_0x24d944){return function(_0x12edca){if(_0x12edca){var _0xc4685d=typeof _0x24d944[_0x4748('0x18')]===_0x4748('0x19')&&typeof _0x24d944[_0x4748('0x1a')]===_0x4748('0x19');var _0x284a76=_0x12edca[_0x4748('0x1b')];var _0x255c10=_0xc4685d?0x0:_0x24d944[_0x4748('0x18')];var _0x4fc8cf=_0xc4685d?_0x12edca[_0x4748('0x1b')]:_0x24d944['offset']+_0x24d944[_0x4748('0x1a')];var _0x3e5877;if(_0x4fc8cf>=_0x284a76){_0x4fc8cf=_0x284a76;_0x3e5877=0xc8;}else{_0x3e5877=0xce;}_0x32ff3e[_0x4748('0x15')](_0x3e5877);return _0x32ff3e[_0x4748('0x1c')](_0x4748('0x1d'),_0x255c10+'-'+_0x4fc8cf+'/'+_0x284a76)['json'](_0x12edca);}return null;};}function patchUpdates(_0x357b0b){return function(_0x3c535b){try{jsonpatch[_0x4748('0x1e')](_0x3c535b,_0x357b0b,!![]);}catch(_0x93c390){return BPromise[_0x4748('0x1f')](_0x93c390);}return _0x3c535b['save']();};}function saveUpdates(_0x1ea6a1,_0x462e8f){return function(_0x441375){if(_0x441375){return _0x441375[_0x4748('0x20')](_0x1ea6a1)[_0x4748('0x21')](function(_0x1a7f24){return _0x1a7f24;});}return null;};}function removeEntity(_0x4f0ddf,_0x26d712){return function(_0x2d5e3e){if(_0x2d5e3e){return _0x2d5e3e['destroy']()[_0x4748('0x21')](function(){var _0x19ee78=_0x2d5e3e['get']({'plain':!![]});var _0x1e1f20=_0x4748('0x22');return db[_0x4748('0x23')][_0x4748('0x24')]({'where':{'type':_0x1e1f20,'resourceId':_0x19ee78['id']}})[_0x4748('0x21')](function(){return _0x2d5e3e;});})['then'](function(){_0x4f0ddf[_0x4748('0x15')](0xcc)[_0x4748('0x16')]();});}};}function handleEntityNotFound(_0x1456e6,_0x218ee2){return function(_0x10e4f2){if(!_0x10e4f2){_0x1456e6[_0x4748('0x14')](0x194);}return _0x10e4f2;};}function handleError(_0x5805f8,_0x351f0c){_0x351f0c=_0x351f0c||0x1f4;return function(_0x4124fe){logger['error'](_0x4124fe['stack']);if(_0x4124fe['name']){delete _0x4124fe['name'];}_0x5805f8[_0x4748('0x15')](_0x351f0c)[_0x4748('0x25')](_0x4124fe);};}exports[_0x4748('0x26')]=function(_0xa01d43,_0x15fb6f){var _0x3fbb85={},_0x3cc2b8={},_0x255701={'count':0x0,'rows':[]};var _0x536339=_[_0x4748('0x27')](db['Template'][_0x4748('0x28')],function(_0x37ec64){return{'name':_0x37ec64['fieldName'],'type':_0x37ec64[_0x4748('0x29')][_0x4748('0x2a')]};});_0x3cc2b8[_0x4748('0x2b')]=_['map'](_0x536339,_0x4748('0x2c'));_0x3cc2b8[_0x4748('0x2d')]=_[_0x4748('0x2e')](_0xa01d43[_0x4748('0x2d')]);_0x3cc2b8[_0x4748('0x2f')]=_['intersection'](_0x3cc2b8[_0x4748('0x2b')],_0x3cc2b8[_0x4748('0x2d')]);_0x3fbb85[_0x4748('0x30')]=_[_0x4748('0x31')](_0x3cc2b8[_0x4748('0x2b')],qs[_0x4748('0x32')](_0xa01d43[_0x4748('0x2d')][_0x4748('0x32')]));_0x3fbb85[_0x4748('0x30')]=_0x3fbb85[_0x4748('0x30')][_0x4748('0x33')]?_0x3fbb85[_0x4748('0x30')]:_0x3cc2b8['model'];if(!_0xa01d43['query']['hasOwnProperty'](_0x4748('0x34'))){_0x3fbb85['limit']=qs[_0x4748('0x1a')](_0xa01d43[_0x4748('0x2d')][_0x4748('0x1a')]);_0x3fbb85[_0x4748('0x18')]=qs[_0x4748('0x18')](_0xa01d43[_0x4748('0x2d')][_0x4748('0x18')]);}_0x3fbb85[_0x4748('0x35')]=qs[_0x4748('0x36')](_0xa01d43[_0x4748('0x2d')][_0x4748('0x36')]);_0x3fbb85[_0x4748('0x37')]=qs[_0x4748('0x2f')](_[_0x4748('0x38')](_0xa01d43[_0x4748('0x2d')],_0x3cc2b8['filters']),_0x536339);if(_0xa01d43[_0x4748('0x2d')][_0x4748('0x39')]){_0x3fbb85[_0x4748('0x37')]=_['merge'](_0x3fbb85[_0x4748('0x37')],{'$or':_[_0x4748('0x27')](_0x536339,function(_0x24e5bd){if(_0x24e5bd[_0x4748('0x29')]!==_0x4748('0x3a')){var _0x50671d={};_0x50671d[_0x24e5bd[_0x4748('0x2c')]]={'$like':'%'+_0xa01d43[_0x4748('0x2d')][_0x4748('0x39')]+'%'};return _0x50671d;}})});}_0x3fbb85=_[_0x4748('0x3b')]({},_0x3fbb85,_0xa01d43[_0x4748('0x3c')]);var _0x453493={'where':_0x3fbb85['where']};return db[_0x4748('0x3d')][_0x4748('0x1b')](_0x453493)[_0x4748('0x21')](function(_0xa4c272){_0x255701[_0x4748('0x1b')]=_0xa4c272;if(_0xa01d43[_0x4748('0x2d')]['includeAll']){_0x3fbb85[_0x4748('0x3e')]=[{'all':!![]}];}return db[_0x4748('0x3d')][_0x4748('0x3f')](_0x3fbb85);})[_0x4748('0x21')](function(_0x3013ea){_0x255701[_0x4748('0x40')]=_0x3013ea;return _0x255701;})[_0x4748('0x21')](respondWithFilteredResult(_0x15fb6f,_0x3fbb85))['catch'](handleError(_0x15fb6f,null));};exports[_0x4748('0x41')]=function(_0x5eca5a,_0x616aae){var _0x532dbb={'raw':!![],'where':{'id':_0x5eca5a[_0x4748('0x42')]['id']}},_0x453e={};_0x453e[_0x4748('0x2b')]=_[_0x4748('0x2e')](db[_0x4748('0x3d')]['rawAttributes']);_0x453e[_0x4748('0x2d')]=_[_0x4748('0x2e')](_0x5eca5a[_0x4748('0x2d')]);_0x453e['filters']=_['intersection'](_0x453e[_0x4748('0x2b')],_0x453e[_0x4748('0x2d')]);_0x532dbb[_0x4748('0x30')]=_[_0x4748('0x31')](_0x453e[_0x4748('0x2b')],qs['fields'](_0x5eca5a[_0x4748('0x2d')][_0x4748('0x32')]));_0x532dbb[_0x4748('0x30')]=_0x532dbb[_0x4748('0x30')]['length']?_0x532dbb[_0x4748('0x30')]:_0x453e['model'];if(_0x5eca5a[_0x4748('0x2d')][_0x4748('0x43')]){_0x532dbb[_0x4748('0x3e')]=[{'all':!![]}];}_0x532dbb=_[_0x4748('0x3b')]({},_0x532dbb,_0x5eca5a['options']);return db[_0x4748('0x3d')][_0x4748('0x44')](_0x532dbb)[_0x4748('0x21')](handleEntityNotFound(_0x616aae,null))[_0x4748('0x21')](respondWithResult(_0x616aae,null))[_0x4748('0x45')](handleError(_0x616aae,null));};exports[_0x4748('0x46')]=function(_0x121661,_0x298b8f){return db[_0x4748('0x3d')][_0x4748('0x46')](_0x121661[_0x4748('0x47')],{})[_0x4748('0x21')](function(_0x56bc0e){var _0x355f74=_0x121661[_0x4748('0x48')][_0x4748('0x49')]({'plain':!![]});if(!_0x355f74)throw new Error(_0x4748('0x4a'));if(_0x355f74[_0x4748('0x4b')]===_0x4748('0x48')){var _0x377d5d=_0x56bc0e['get']({'plain':!![]});var _0x2f8008='Templates';return db[_0x4748('0x4c')][_0x4748('0x44')]({'where':{'name':_0x2f8008,'userProfileId':_0x355f74['userProfileId']},'raw':!![]})[_0x4748('0x21')](function(_0xc71832){if(_0xc71832&&_0xc71832[_0x4748('0x4d')]===0x0){return db[_0x4748('0x23')][_0x4748('0x46')]({'name':_0x377d5d[_0x4748('0x2c')],'resourceId':_0x377d5d['id'],'type':_0xc71832[_0x4748('0x2c')],'sectionId':_0xc71832['id']},{})[_0x4748('0x21')](function(){return _0x56bc0e;});}else{return _0x56bc0e;}})[_0x4748('0x45')](function(_0x1be14e){logger[_0x4748('0x4e')](_0x4748('0x4f'),_0x1be14e);throw _0x1be14e;});}return _0x56bc0e;})[_0x4748('0x21')](respondWithResult(_0x298b8f,0xc9))[_0x4748('0x45')](handleError(_0x298b8f,null));};exports[_0x4748('0x20')]=function(_0x44d4ee,_0xad9ce1){if(_0x44d4ee[_0x4748('0x47')]['id']){delete _0x44d4ee[_0x4748('0x47')]['id'];}return db['Template'][_0x4748('0x44')]({'where':{'id':_0x44d4ee['params']['id']}})[_0x4748('0x21')](handleEntityNotFound(_0xad9ce1,null))[_0x4748('0x21')](saveUpdates(_0x44d4ee[_0x4748('0x47')],null))[_0x4748('0x21')](respondWithResult(_0xad9ce1,null))[_0x4748('0x45')](handleError(_0xad9ce1,null));};exports[_0x4748('0x24')]=function(_0x2429cf,_0x59eb23){return db['Template'][_0x4748('0x44')]({'where':{'id':_0x2429cf[_0x4748('0x42')]['id']}})[_0x4748('0x21')](handleEntityNotFound(_0x59eb23,null))[_0x4748('0x21')](removeEntity(_0x59eb23,null))['catch'](handleError(_0x59eb23,null));}; \ No newline at end of file +var _0x3deb=['map','Template','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','role','find','userProfileId','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','sendStatus','name','send','index'];(function(_0x10db88,_0x8bf030){var _0x2dc5e6=function(_0x15fa0c){while(--_0x15fa0c){_0x10db88['push'](_0x10db88['shift']());}};_0x2dc5e6(++_0x8bf030);}(_0x3deb,0x1ab));var _0xb3de=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x3deb[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xb3de('0x0'));var rimraf=require(_0xb3de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3de('0x2'));var rp=require(_0xb3de('0x3'));var moment=require(_0xb3de('0x4'));var BPromise=require(_0xb3de('0x5'));var Mustache=require(_0xb3de('0x6'));var util=require('util');var path=require(_0xb3de('0x7'));var sox=require(_0xb3de('0x8'));var csv=require(_0xb3de('0x9'));var ejs=require(_0xb3de('0xa'));var fs=require('fs');var fs_extra=require(_0xb3de('0xb'));var _=require(_0xb3de('0xc'));var squel=require(_0xb3de('0xd'));var crypto=require(_0xb3de('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb3de('0xf'));var toCsv=require(_0xb3de('0x9'));var querystring=require(_0xb3de('0x10'));var Papa=require(_0xb3de('0x11'));var Redis=require(_0xb3de('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb3de('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3de('0x14'))(_0xb3de('0x15'));var utils=require(_0xb3de('0x16'));var config=require(_0xb3de('0x17'));var licenseUtil=require(_0xb3de('0x18'));var db=require(_0xb3de('0x19'))['db'];function respondWithStatusCode(_0x584d13,_0x508f5e){_0x508f5e=_0x508f5e||0xcc;return function(_0x8856){if(_0x8856){return _0x584d13['sendStatus'](_0x508f5e);}return _0x584d13[_0xb3de('0x1a')](_0x508f5e)[_0xb3de('0x1b')]();};}function respondWithResult(_0x5e7865,_0x179898){_0x179898=_0x179898||0xc8;return function(_0x4a1d7a){if(_0x4a1d7a){return _0x5e7865[_0xb3de('0x1a')](_0x179898)[_0xb3de('0x1c')](_0x4a1d7a);}};}function respondWithFilteredResult(_0x3322d2,_0x184ece){return function(_0x45ba75){if(_0x45ba75){var _0x29d56e=typeof _0x184ece['offset']===_0xb3de('0x1d')&&typeof _0x184ece[_0xb3de('0x1e')]==='undefined';var _0x523b1f=_0x45ba75[_0xb3de('0x1f')];var _0x4e3f91=_0x29d56e?0x0:_0x184ece[_0xb3de('0x20')];var _0x56c1cf=_0x29d56e?_0x45ba75[_0xb3de('0x1f')]:_0x184ece[_0xb3de('0x20')]+_0x184ece[_0xb3de('0x1e')];var _0x2e9098;if(_0x56c1cf>=_0x523b1f){_0x56c1cf=_0x523b1f;_0x2e9098=0xc8;}else{_0x2e9098=0xce;}_0x3322d2[_0xb3de('0x1a')](_0x2e9098);return _0x3322d2[_0xb3de('0x21')]('Content-Range',_0x4e3f91+'-'+_0x56c1cf+'/'+_0x523b1f)[_0xb3de('0x1c')](_0x45ba75);}return null;};}function patchUpdates(_0x195e22){return function(_0x2f7bbb){try{jsonpatch[_0xb3de('0x22')](_0x2f7bbb,_0x195e22,!![]);}catch(_0x3005d3){return BPromise[_0xb3de('0x23')](_0x3005d3);}return _0x2f7bbb[_0xb3de('0x24')]();};}function saveUpdates(_0x12307c,_0xc9a26b){return function(_0x15ec8){if(_0x15ec8){return _0x15ec8[_0xb3de('0x25')](_0x12307c)[_0xb3de('0x26')](function(_0x52d5b4){return _0x52d5b4;});}return null;};}function removeEntity(_0x4caf64,_0x47c5ea){return function(_0x5f2532){if(_0x5f2532){return _0x5f2532['destroy']()[_0xb3de('0x26')](function(){var _0x134c6f=_0x5f2532[_0xb3de('0x27')]({'plain':!![]});var _0x37725f=_0xb3de('0x28');return db[_0xb3de('0x29')][_0xb3de('0x2a')]({'where':{'type':_0x37725f,'resourceId':_0x134c6f['id']}})[_0xb3de('0x26')](function(){return _0x5f2532;});})[_0xb3de('0x26')](function(){_0x4caf64[_0xb3de('0x1a')](0xcc)[_0xb3de('0x1b')]();});}};}function handleEntityNotFound(_0x42c818,_0x1e3fe4){return function(_0x1cab57){if(!_0x1cab57){_0x42c818[_0xb3de('0x2b')](0x194);}return _0x1cab57;};}function handleError(_0x53c291,_0x1baf9b){_0x1baf9b=_0x1baf9b||0x1f4;return function(_0x587f16){logger['error'](_0x587f16['stack']);if(_0x587f16['name']){delete _0x587f16[_0xb3de('0x2c')];}_0x53c291[_0xb3de('0x1a')](_0x1baf9b)[_0xb3de('0x2d')](_0x587f16);};}exports[_0xb3de('0x2e')]=function(_0x8ea03a,_0x273f91){var _0x4c4962={},_0x5c11da={},_0x26f3e3={'count':0x0,'rows':[]};var _0x19488f=_[_0xb3de('0x2f')](db[_0xb3de('0x30')]['rawAttributes'],function(_0x492647){return{'name':_0x492647['fieldName'],'type':_0x492647[_0xb3de('0x31')]['key']};});_0x5c11da[_0xb3de('0x32')]=_[_0xb3de('0x2f')](_0x19488f,_0xb3de('0x2c'));_0x5c11da[_0xb3de('0x33')]=_[_0xb3de('0x34')](_0x8ea03a[_0xb3de('0x33')]);_0x5c11da[_0xb3de('0x35')]=_[_0xb3de('0x36')](_0x5c11da[_0xb3de('0x32')],_0x5c11da[_0xb3de('0x33')]);_0x4c4962[_0xb3de('0x37')]=_['intersection'](_0x5c11da[_0xb3de('0x32')],qs[_0xb3de('0x38')](_0x8ea03a[_0xb3de('0x33')][_0xb3de('0x38')]));_0x4c4962[_0xb3de('0x37')]=_0x4c4962[_0xb3de('0x37')][_0xb3de('0x39')]?_0x4c4962[_0xb3de('0x37')]:_0x5c11da[_0xb3de('0x32')];if(!_0x8ea03a[_0xb3de('0x33')][_0xb3de('0x3a')](_0xb3de('0x3b'))){_0x4c4962[_0xb3de('0x1e')]=qs[_0xb3de('0x1e')](_0x8ea03a[_0xb3de('0x33')]['limit']);_0x4c4962[_0xb3de('0x20')]=qs['offset'](_0x8ea03a['query'][_0xb3de('0x20')]);}_0x4c4962[_0xb3de('0x3c')]=qs['sort'](_0x8ea03a[_0xb3de('0x33')][_0xb3de('0x3d')]);_0x4c4962[_0xb3de('0x3e')]=qs[_0xb3de('0x35')](_[_0xb3de('0x3f')](_0x8ea03a['query'],_0x5c11da[_0xb3de('0x35')]),_0x19488f);if(_0x8ea03a[_0xb3de('0x33')][_0xb3de('0x40')]){_0x4c4962['where']=_[_0xb3de('0x41')](_0x4c4962['where'],{'$or':_[_0xb3de('0x2f')](_0x19488f,function(_0x4623be){if(_0x4623be[_0xb3de('0x31')]!=='VIRTUAL'){var _0x1d4b32={};_0x1d4b32[_0x4623be[_0xb3de('0x2c')]]={'$like':'%'+_0x8ea03a['query']['filter']+'%'};return _0x1d4b32;}})});}_0x4c4962=_['merge']({},_0x4c4962,_0x8ea03a[_0xb3de('0x42')]);var _0x4af548={'where':_0x4c4962[_0xb3de('0x3e')]};return db[_0xb3de('0x30')][_0xb3de('0x1f')](_0x4af548)[_0xb3de('0x26')](function(_0x332b37){_0x26f3e3['count']=_0x332b37;if(_0x8ea03a[_0xb3de('0x33')][_0xb3de('0x43')]){_0x4c4962[_0xb3de('0x44')]=[{'all':!![]}];}return db['Template'][_0xb3de('0x45')](_0x4c4962);})[_0xb3de('0x26')](function(_0xdfa55c){_0x26f3e3[_0xb3de('0x46')]=_0xdfa55c;return _0x26f3e3;})[_0xb3de('0x26')](respondWithFilteredResult(_0x273f91,_0x4c4962))[_0xb3de('0x47')](handleError(_0x273f91,null));};exports[_0xb3de('0x48')]=function(_0x11f27f,_0x5d04af){var _0x89a3a0={'raw':!![],'where':{'id':_0x11f27f[_0xb3de('0x49')]['id']}},_0x26b716={};_0x26b716['model']=_[_0xb3de('0x34')](db[_0xb3de('0x30')]['rawAttributes']);_0x26b716[_0xb3de('0x33')]=_[_0xb3de('0x34')](_0x11f27f['query']);_0x26b716[_0xb3de('0x35')]=_[_0xb3de('0x36')](_0x26b716['model'],_0x26b716[_0xb3de('0x33')]);_0x89a3a0['attributes']=_[_0xb3de('0x36')](_0x26b716[_0xb3de('0x32')],qs[_0xb3de('0x38')](_0x11f27f[_0xb3de('0x33')][_0xb3de('0x38')]));_0x89a3a0['attributes']=_0x89a3a0['attributes'][_0xb3de('0x39')]?_0x89a3a0[_0xb3de('0x37')]:_0x26b716['model'];if(_0x11f27f['query'][_0xb3de('0x43')]){_0x89a3a0['include']=[{'all':!![]}];}_0x89a3a0=_[_0xb3de('0x41')]({},_0x89a3a0,_0x11f27f[_0xb3de('0x42')]);return db[_0xb3de('0x30')]['find'](_0x89a3a0)[_0xb3de('0x26')](handleEntityNotFound(_0x5d04af,null))[_0xb3de('0x26')](respondWithResult(_0x5d04af,null))[_0xb3de('0x47')](handleError(_0x5d04af,null));};exports['create']=function(_0x286acb,_0x15cc62){return db[_0xb3de('0x30')][_0xb3de('0x4a')](_0x286acb['body'],{})['then'](function(_0x3166b5){var _0x1d26f8=_0x286acb['user'][_0xb3de('0x27')]({'plain':!![]});if(!_0x1d26f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d26f8[_0xb3de('0x4b')]==='user'){var _0x357249=_0x3166b5['get']({'plain':!![]});var _0x178d24=_0xb3de('0x28');return db['UserProfileSection'][_0xb3de('0x4c')]({'where':{'name':_0x178d24,'userProfileId':_0x1d26f8[_0xb3de('0x4d')]},'raw':!![]})['then'](function(_0x2b7d70){if(_0x2b7d70&&_0x2b7d70['autoAssociation']===0x0){return db[_0xb3de('0x29')][_0xb3de('0x4a')]({'name':_0x357249[_0xb3de('0x2c')],'resourceId':_0x357249['id'],'type':_0x2b7d70[_0xb3de('0x2c')],'sectionId':_0x2b7d70['id']},{})['then'](function(){return _0x3166b5;});}else{return _0x3166b5;}})['catch'](function(_0xf3381d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf3381d);throw _0xf3381d;});}return _0x3166b5;})[_0xb3de('0x26')](respondWithResult(_0x15cc62,0xc9))[_0xb3de('0x47')](handleError(_0x15cc62,null));};exports[_0xb3de('0x25')]=function(_0x12533a,_0x106fa9){if(_0x12533a[_0xb3de('0x4e')]['id']){delete _0x12533a[_0xb3de('0x4e')]['id'];}return db[_0xb3de('0x30')][_0xb3de('0x4c')]({'where':{'id':_0x12533a[_0xb3de('0x49')]['id']}})[_0xb3de('0x26')](handleEntityNotFound(_0x106fa9,null))[_0xb3de('0x26')](saveUpdates(_0x12533a[_0xb3de('0x4e')],null))['then'](respondWithResult(_0x106fa9,null))[_0xb3de('0x47')](handleError(_0x106fa9,null));};exports[_0xb3de('0x2a')]=function(_0x3716af,_0x4272c9){return db['Template']['find']({'where':{'id':_0x3716af['params']['id']}})[_0xb3de('0x26')](handleEntityNotFound(_0x4272c9,null))[_0xb3de('0x26')](removeEntity(_0x4272c9,null))[_0xb3de('0x47')](handleError(_0x4272c9,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 43fcd22..cd9a837 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 _0x0402=['tools_templates','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./template.attributes','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0402,0x11f));var _0x2040=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x0402[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x2040('0x0'));var util=require(_0x2040('0x1'));var logger=require(_0x2040('0x2'))(_0x2040('0x3'));var moment=require(_0x2040('0x4'));var BPromise=require(_0x2040('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2040('0x6'));var config=require(_0x2040('0x7'));var attributes=require(_0x2040('0x8'));module['exports']=function(_0x343713,_0x1ede3f){return _0x343713[_0x2040('0x9')]('Template',attributes,{'tableName':_0x2040('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc22a=['./template.attributes','exports','define','tools_templates','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x558830,_0x49de34){var _0x282003=function(_0x1c3afb){while(--_0x1c3afb){_0x558830['push'](_0x558830['shift']());}};_0x282003(++_0x49de34);}(_0xc22a,0x17d));var _0xac22=function(_0x356e53,_0xbe7720){_0x356e53=_0x356e53-0x0;var _0x22f02e=_0xc22a[_0x356e53];return _0x22f02e;};'use strict';var _=require('lodash');var util=require(_0xac22('0x0'));var logger=require(_0xac22('0x1'))(_0xac22('0x2'));var moment=require(_0xac22('0x3'));var BPromise=require(_0xac22('0x4'));var rp=require(_0xac22('0x5'));var fs=require('fs');var path=require(_0xac22('0x6'));var rimraf=require(_0xac22('0x7'));var config=require(_0xac22('0x8'));var attributes=require(_0xac22('0x9'));module[_0xac22('0xa')]=function(_0x806263,_0x22cbf7){return _0x806263[_0xac22('0xb')]('Template',attributes,{'tableName':_0xac22('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index e2e901d..93065f6 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 _0xa0ba=['error','code','message','result','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x363455,_0x135dbc){var _0x2f5176=function(_0x4334ad){while(--_0x4334ad){_0x363455['push'](_0x363455['shift']());}};_0x2f5176(++_0x135dbc);}(_0xa0ba,0x8f));var _0xaa0b=function(_0x526786,_0x105cbf){_0x526786=_0x526786-0x0;var _0x3a512d=_0xa0ba[_0x526786];return _0x3a512d;};'use strict';var _=require(_0xaa0b('0x0'));var util=require(_0xaa0b('0x1'));var moment=require(_0xaa0b('0x2'));var BPromise=require(_0xaa0b('0x3'));var rs=require(_0xaa0b('0x4'));var fs=require('fs');var Redis=require(_0xaa0b('0x5'));var db=require(_0xaa0b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaa0b('0x7'));var config=require('../../config/environment');var jayson=require(_0xaa0b('0x8'));var client=jayson['client'][_0xaa0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e3ccd,_0x2eb945,_0x322b23){return new BPromise(function(_0x33f441,_0x5b93c7){return client[_0xaa0b('0xa')](_0x1e3ccd,_0x322b23)[_0xaa0b('0xb')](function(_0x52bb82){logger[_0xaa0b('0xc')](_0xaa0b('0xd'),_0x2eb945,_0xaa0b('0xe'));logger[_0xaa0b('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x2eb945,_0xaa0b('0xe'),JSON[_0xaa0b('0x10')](_0x52bb82));if(_0x52bb82[_0xaa0b('0x11')]){if(_0x52bb82[_0xaa0b('0x11')][_0xaa0b('0x12')]===0x1f4){logger['error'](_0xaa0b('0xd'),_0x2eb945,_0x52bb82[_0xaa0b('0x11')][_0xaa0b('0x13')]);return _0x5b93c7(_0x52bb82[_0xaa0b('0x11')][_0xaa0b('0x13')]);}logger[_0xaa0b('0x11')](_0xaa0b('0xd'),_0x2eb945,_0x52bb82['error'][_0xaa0b('0x13')]);return _0x33f441(_0x52bb82['error'][_0xaa0b('0x13')]);}else{logger[_0xaa0b('0xc')](_0xaa0b('0xd'),_0x2eb945,_0xaa0b('0xe'));_0x33f441(_0x52bb82[_0xaa0b('0x14')][_0xaa0b('0x13')]);}})[_0xaa0b('0x15')](function(_0x105666){logger['error'](_0xaa0b('0xd'),_0x2eb945,_0x105666);_0x5b93c7(_0x105666);});});}exports[_0xaa0b('0x16')]=function(_0x439ccc){var _0x4611ff=this;return new Promise(function(_0x2f3d0b,_0x40b13c){return db[_0xaa0b('0x17')]['findAll']({'raw':_0x439ccc[_0xaa0b('0x18')]?_0x439ccc[_0xaa0b('0x18')][_0xaa0b('0x19')]===undefined?!![]:![]:!![],'where':_0x439ccc[_0xaa0b('0x18')]?_0x439ccc[_0xaa0b('0x18')][_0xaa0b('0x1a')]||null:null,'attributes':_0x439ccc[_0xaa0b('0x18')]?_0x439ccc['options'][_0xaa0b('0x1b')]||null:null,'limit':_0x439ccc['options']?_0x439ccc[_0xaa0b('0x18')][_0xaa0b('0x1c')]||null:null,'include':_0x439ccc[_0xaa0b('0x18')]?_0x439ccc[_0xaa0b('0x18')][_0xaa0b('0x1d')]?_[_0xaa0b('0x1e')](_0x439ccc[_0xaa0b('0x18')][_0xaa0b('0x1d')],function(_0x356939){return{'model':db[_0x356939[_0xaa0b('0x1f')]],'as':_0x356939['as'],'attributes':_0x356939[_0xaa0b('0x1b')],'include':_0x356939['include']?_[_0xaa0b('0x1e')](_0x356939['include'],function(_0x15ed43){return{'model':db[_0x15ed43[_0xaa0b('0x1f')]],'as':_0x15ed43['as'],'attributes':_0x15ed43[_0xaa0b('0x1b')],'include':_0x15ed43[_0xaa0b('0x1d')]?_[_0xaa0b('0x1e')](_0x15ed43['include'],function(_0x48f5cb){return{'model':db[_0x48f5cb[_0xaa0b('0x1f')]],'as':_0x48f5cb['as'],'attributes':_0x48f5cb[_0xaa0b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaa0b('0xb')](function(_0x267807){logger[_0xaa0b('0xc')](_0xaa0b('0x16'),_0x439ccc);logger['debug'](_0xaa0b('0x16'),_0x439ccc,JSON[_0xaa0b('0x10')](_0x267807));_0x2f3d0b(_0x267807);})['catch'](function(_0xdcaad3){logger[_0xaa0b('0x11')](_0xaa0b('0x16'),_0xdcaad3[_0xaa0b('0x13')],_0x439ccc);_0x40b13c(_0x4611ff['error'](0x1f4,_0xdcaad3[_0xaa0b('0x13')]));});});}; \ No newline at end of file +var _0xfa0b=['stringify','error','message','result','catch','Template','findAll','options','raw','where','attributes','include','map','model','then','GetTemplate','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Template,\x20%s,\x20%s','request\x20sent'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0xfa0b,0x1b1));var _0xbfa0=function(_0x100338,_0x5cdbcc){_0x100338=_0x100338-0x0;var _0x330d32=_0xfa0b[_0x100338];return _0x330d32;};'use strict';var _=require(_0xbfa0('0x0'));var util=require(_0xbfa0('0x1'));var moment=require(_0xbfa0('0x2'));var BPromise=require('bluebird');var rs=require(_0xbfa0('0x3'));var fs=require('fs');var Redis=require(_0xbfa0('0x4'));var db=require(_0xbfa0('0x5'))['db'];var utils=require(_0xbfa0('0x6'));var logger=require(_0xbfa0('0x7'))(_0xbfa0('0x8'));var config=require(_0xbfa0('0x9'));var jayson=require(_0xbfa0('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x253c02,_0x4e3933,_0x14fe83){return new BPromise(function(_0xf8d09d,_0x46d25e){return client[_0xbfa0('0xb')](_0x253c02,_0x14fe83)['then'](function(_0x4b3cc6){logger[_0xbfa0('0xc')](_0xbfa0('0xd'),_0x4e3933,_0xbfa0('0xe'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x4e3933,_0xbfa0('0xe'),JSON[_0xbfa0('0xf')](_0x4b3cc6));if(_0x4b3cc6[_0xbfa0('0x10')]){if(_0x4b3cc6[_0xbfa0('0x10')]['code']===0x1f4){logger[_0xbfa0('0x10')]('Template,\x20%s,\x20%s',_0x4e3933,_0x4b3cc6[_0xbfa0('0x10')][_0xbfa0('0x11')]);return _0x46d25e(_0x4b3cc6[_0xbfa0('0x10')][_0xbfa0('0x11')]);}logger['error'](_0xbfa0('0xd'),_0x4e3933,_0x4b3cc6[_0xbfa0('0x10')][_0xbfa0('0x11')]);return _0xf8d09d(_0x4b3cc6['error']['message']);}else{logger[_0xbfa0('0xc')](_0xbfa0('0xd'),_0x4e3933,_0xbfa0('0xe'));_0xf8d09d(_0x4b3cc6[_0xbfa0('0x12')]['message']);}})[_0xbfa0('0x13')](function(_0x17d64b){logger[_0xbfa0('0x10')](_0xbfa0('0xd'),_0x4e3933,_0x17d64b);_0x46d25e(_0x17d64b);});});}exports['GetTemplate']=function(_0xd9f706){var _0x3b06c5=this;return new Promise(function(_0x2f0ea1,_0x4080f4){return db[_0xbfa0('0x14')][_0xbfa0('0x15')]({'raw':_0xd9f706[_0xbfa0('0x16')]?_0xd9f706[_0xbfa0('0x16')][_0xbfa0('0x17')]===undefined?!![]:![]:!![],'where':_0xd9f706['options']?_0xd9f706[_0xbfa0('0x16')][_0xbfa0('0x18')]||null:null,'attributes':_0xd9f706[_0xbfa0('0x16')]?_0xd9f706[_0xbfa0('0x16')][_0xbfa0('0x19')]||null:null,'limit':_0xd9f706[_0xbfa0('0x16')]?_0xd9f706[_0xbfa0('0x16')]['limit']||null:null,'include':_0xd9f706[_0xbfa0('0x16')]?_0xd9f706[_0xbfa0('0x16')][_0xbfa0('0x1a')]?_[_0xbfa0('0x1b')](_0xd9f706[_0xbfa0('0x16')][_0xbfa0('0x1a')],function(_0x1a24e9){return{'model':db[_0x1a24e9[_0xbfa0('0x1c')]],'as':_0x1a24e9['as'],'attributes':_0x1a24e9[_0xbfa0('0x19')],'include':_0x1a24e9[_0xbfa0('0x1a')]?_[_0xbfa0('0x1b')](_0x1a24e9[_0xbfa0('0x1a')],function(_0x34d145){return{'model':db[_0x34d145['model']],'as':_0x34d145['as'],'attributes':_0x34d145[_0xbfa0('0x19')],'include':_0x34d145[_0xbfa0('0x1a')]?_[_0xbfa0('0x1b')](_0x34d145[_0xbfa0('0x1a')],function(_0x2b51d2){return{'model':db[_0x2b51d2[_0xbfa0('0x1c')]],'as':_0x2b51d2['as'],'attributes':_0x2b51d2['attributes']};}):[]};}):[]};}):[]:[]})[_0xbfa0('0x1d')](function(_0x55f8fc){logger[_0xbfa0('0xc')](_0xbfa0('0x1e'),_0xd9f706);logger[_0xbfa0('0x1f')](_0xbfa0('0x1e'),_0xd9f706,JSON['stringify'](_0x55f8fc));_0x2f0ea1(_0x55f8fc);})[_0xbfa0('0x13')](function(_0x4d13f5){logger[_0xbfa0('0x10')](_0xbfa0('0x1e'),_0x4d13f5['message'],_0xd9f706);_0x4080f4(_0x3b06c5['error'](0x1f4,_0x4d13f5[_0xbfa0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 5b85d86..a206444 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 _0x69d3=['/:id/any_conditions','getAnyConditions','getActions','post','create','addAllCondition','addAction','put','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/all_conditions'];(function(_0x33b3b3,_0x353a26){var _0x4b70aa=function(_0x80795a){while(--_0x80795a){_0x33b3b3['push'](_0x33b3b3['shift']());}};_0x4b70aa(++_0x353a26);}(_0x69d3,0xda));var _0x369d=function(_0x4647ec,_0x21ffe6){_0x4647ec=_0x4647ec-0x0;var _0xceeff9=_0x69d3[_0x4647ec];return _0xceeff9;};'use strict';var multer=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var path=require(_0x369d('0x2'));var timeout=require('connect-timeout');var express=require(_0x369d('0x3'));var router=express[_0x369d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x369d('0x5'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x369d('0x6')]('/',auth[_0x369d('0x7')](),controller[_0x369d('0x8')]);router[_0x369d('0x6')](_0x369d('0x9'),auth[_0x369d('0x7')](),controller[_0x369d('0xa')]);router[_0x369d('0x6')](_0x369d('0xb'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0x369d('0x6')](_0x369d('0xc'),auth[_0x369d('0x7')](),controller[_0x369d('0xd')]);router['get']('/:id/actions',auth[_0x369d('0x7')](),controller[_0x369d('0xe')]);router[_0x369d('0xf')]('/',auth[_0x369d('0x7')](),controller[_0x369d('0x10')]);router[_0x369d('0xf')]('/:id/all_conditions',auth[_0x369d('0x7')](),controller[_0x369d('0x11')]);router[_0x369d('0xf')](_0x369d('0xc'),auth[_0x369d('0x7')](),controller['addAnyCondition']);router['post']('/:id/actions',auth[_0x369d('0x7')](),controller[_0x369d('0x12')]);router[_0x369d('0x13')]('/:id',auth[_0x369d('0x7')](),controller[_0x369d('0x14')]);router[_0x369d('0x15')]('/:id',auth[_0x369d('0x7')](),controller[_0x369d('0x16')]);module['exports']=router; \ No newline at end of file +var _0x9afa=['get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/actions','getActions','post','/:id/any_conditions','addAnyCondition','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller'];(function(_0x28e85d,_0xe85d0e){var _0x69c7da=function(_0x206885){while(--_0x206885){_0x28e85d['push'](_0x28e85d['shift']());}};_0x69c7da(++_0xe85d0e);}(_0x9afa,0x1af));var _0xa9af=function(_0xbe79ba,_0x122818){_0xbe79ba=_0xbe79ba-0x0;var _0x441250=_0x9afa[_0xbe79ba];return _0x441250;};'use strict';var multer=require(_0xa9af('0x0'));var util=require(_0xa9af('0x1'));var path=require(_0xa9af('0x2'));var timeout=require(_0xa9af('0x3'));var express=require(_0xa9af('0x4'));var router=express[_0xa9af('0x5')]();var fs_extra=require(_0xa9af('0x6'));var auth=require(_0xa9af('0x7'));var interaction=require(_0xa9af('0x8'));var config=require(_0xa9af('0x9'));var controller=require(_0xa9af('0xa'));router[_0xa9af('0xb')]('/',auth[_0xa9af('0xc')](),controller[_0xa9af('0xd')]);router[_0xa9af('0xb')](_0xa9af('0xe'),auth[_0xa9af('0xc')](),controller[_0xa9af('0xf')]);router['get'](_0xa9af('0x10'),auth[_0xa9af('0xc')](),controller[_0xa9af('0x11')]);router['get']('/:id/any_conditions',auth[_0xa9af('0xc')](),controller['getAnyConditions']);router['get'](_0xa9af('0x12'),auth[_0xa9af('0xc')](),controller[_0xa9af('0x13')]);router['post']('/',auth[_0xa9af('0xc')](),controller['create']);router[_0xa9af('0x14')](_0xa9af('0x10'),auth[_0xa9af('0xc')](),controller['addAllCondition']);router['post'](_0xa9af('0x15'),auth[_0xa9af('0xc')](),controller[_0xa9af('0x16')]);router[_0xa9af('0x14')](_0xa9af('0x12'),auth[_0xa9af('0xc')](),controller['addAction']);router[_0xa9af('0x17')](_0xa9af('0xe'),auth[_0xa9af('0xc')](),controller[_0xa9af('0x18')]);router[_0xa9af('0x19')](_0xa9af('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 34ec529..83d9904 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 _0xb43b=['sequelize','STRING'];(function(_0x29ffae,_0x5403b8){var _0x46d97a=function(_0x272f3d){while(--_0x272f3d){_0x29ffae['push'](_0x29ffae['shift']());}};_0x46d97a(++_0x5403b8);}(_0xb43b,0x15a));var _0xbb43=function(_0x5a95fb,_0x17e347){_0x5a95fb=_0x5a95fb-0x0;var _0x535f9c=_0xb43b[_0x5a95fb];return _0x535f9c;};'use strict';var Sequelize=require(_0xbb43('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb43('0x1')]},'channel':{'type':Sequelize[_0xbb43('0x1')]},'description':{'type':Sequelize[_0xbb43('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2570=['STRING','sequelize'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2570,0x1d7));var _0x0257=function(_0x9b081c,_0x6968a9){_0x9b081c=_0x9b081c-0x0;var _0x5a5979=_0x2570[_0x9b081c];return _0x5a5979;};'use strict';var Sequelize=require(_0x0257('0x0'));module['exports']={'name':{'type':Sequelize[_0x0257('0x1')]},'channel':{'type':Sequelize[_0x0257('0x1')]},'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 af42ce8..2f8a61c 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 _0xd898=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','Trigger','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','Condition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','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','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x59a4d9,_0x4e2e42){var _0x402f8a=function(_0x2363ad){while(--_0x2363ad){_0x59a4d9['push'](_0x59a4d9['shift']());}};_0x402f8a(++_0x4e2e42);}(_0xd898,0x18c));var _0x8d89=function(_0x43c5fd,_0x246423){_0x43c5fd=_0x43c5fd-0x0;var _0x1e80fb=_0xd898[_0x43c5fd];return _0x1e80fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d89('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d89('0x1'));var rp=require(_0x8d89('0x2'));var moment=require(_0x8d89('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8d89('0x4'));var util=require(_0x8d89('0x5'));var path=require(_0x8d89('0x6'));var sox=require(_0x8d89('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d89('0x8'));var _=require(_0x8d89('0x9'));var squel=require(_0x8d89('0xa'));var crypto=require(_0x8d89('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8d89('0xc'));var toCsv=require(_0x8d89('0xd'));var querystring=require(_0x8d89('0xe'));var Papa=require(_0x8d89('0xf'));var Redis=require(_0x8d89('0x10'));var authService=require(_0x8d89('0x11'));var qs=require(_0x8d89('0x12'));var as=require(_0x8d89('0x13'));var hardwareService=require(_0x8d89('0x14'));var logger=require(_0x8d89('0x15'))('api');var utils=require(_0x8d89('0x16'));var config=require(_0x8d89('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d89('0x18'))['db'];function respondWithStatusCode(_0x5cbc6b,_0x3cc510){_0x3cc510=_0x3cc510||0xcc;return function(_0x50f41f){if(_0x50f41f){return _0x5cbc6b[_0x8d89('0x19')](_0x3cc510);}return _0x5cbc6b[_0x8d89('0x1a')](_0x3cc510)[_0x8d89('0x1b')]();};}function respondWithResult(_0x4003c1,_0x2f0728){_0x2f0728=_0x2f0728||0xc8;return function(_0x5417db){if(_0x5417db){return _0x4003c1[_0x8d89('0x1a')](_0x2f0728)[_0x8d89('0x1c')](_0x5417db);}};}function respondWithFilteredResult(_0x5b364e,_0x23c6db){return function(_0x56138c){if(_0x56138c){var _0x174a68=typeof _0x23c6db[_0x8d89('0x1d')]===_0x8d89('0x1e')&&typeof _0x23c6db[_0x8d89('0x1f')]===_0x8d89('0x1e');var _0x2dfc33=_0x56138c[_0x8d89('0x20')];var _0x180446=_0x174a68?0x0:_0x23c6db['offset'];var _0x422563=_0x174a68?_0x56138c[_0x8d89('0x20')]:_0x23c6db['offset']+_0x23c6db[_0x8d89('0x1f')];var _0x1d3cce;if(_0x422563>=_0x2dfc33){_0x422563=_0x2dfc33;_0x1d3cce=0xc8;}else{_0x1d3cce=0xce;}_0x5b364e[_0x8d89('0x1a')](_0x1d3cce);return _0x5b364e[_0x8d89('0x21')](_0x8d89('0x22'),_0x180446+'-'+_0x422563+'/'+_0x2dfc33)[_0x8d89('0x1c')](_0x56138c);}return null;};}function patchUpdates(_0xbcfdf){return function(_0x47fac2){try{jsonpatch[_0x8d89('0x23')](_0x47fac2,_0xbcfdf,!![]);}catch(_0x22b134){return BPromise[_0x8d89('0x24')](_0x22b134);}return _0x47fac2['save']();};}function saveUpdates(_0x3ead48,_0x5d34ce){return function(_0x2193f5){if(_0x2193f5){return _0x2193f5[_0x8d89('0x25')](_0x3ead48)[_0x8d89('0x26')](function(_0x2e45ae){return _0x2e45ae;});}return null;};}function removeEntity(_0x8d8955,_0x33a745){return function(_0x10a576){if(_0x10a576){return _0x10a576[_0x8d89('0x27')]()['then'](function(){var _0x1fca2f=_0x10a576[_0x8d89('0x28')]({'plain':!![]});var _0x402a3='Triggers';return db[_0x8d89('0x29')][_0x8d89('0x27')]({'where':{'type':_0x402a3,'resourceId':_0x1fca2f['id']}})[_0x8d89('0x26')](function(){return _0x10a576;});})[_0x8d89('0x26')](function(){_0x8d8955['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49a3f8,_0x14826d){return function(_0x22a232){if(!_0x22a232){_0x49a3f8['sendStatus'](0x194);}return _0x22a232;};}function handleError(_0x1288cf,_0x428a50){_0x428a50=_0x428a50||0x1f4;return function(_0x22f19f){logger[_0x8d89('0x2a')](_0x22f19f[_0x8d89('0x2b')]);if(_0x22f19f[_0x8d89('0x2c')]){delete _0x22f19f[_0x8d89('0x2c')];}_0x1288cf[_0x8d89('0x1a')](_0x428a50)[_0x8d89('0x2d')](_0x22f19f);};}exports[_0x8d89('0x2e')]=function(_0x397389,_0x1172e2){var _0x4a1988={},_0x4f645b={},_0x584a4b={'count':0x0,'rows':[]};var _0x587151=_[_0x8d89('0x2f')](db['Trigger'][_0x8d89('0x30')],function(_0x410f9f){return{'name':_0x410f9f[_0x8d89('0x31')],'type':_0x410f9f[_0x8d89('0x32')][_0x8d89('0x33')]};});_0x4f645b[_0x8d89('0x34')]=_[_0x8d89('0x2f')](_0x587151,_0x8d89('0x2c'));_0x4f645b[_0x8d89('0x35')]=_[_0x8d89('0x36')](_0x397389[_0x8d89('0x35')]);_0x4f645b[_0x8d89('0x37')]=_[_0x8d89('0x38')](_0x4f645b['model'],_0x4f645b['query']);_0x4a1988[_0x8d89('0x39')]=_[_0x8d89('0x38')](_0x4f645b[_0x8d89('0x34')],qs[_0x8d89('0x3a')](_0x397389['query'][_0x8d89('0x3a')]));_0x4a1988['attributes']=_0x4a1988[_0x8d89('0x39')][_0x8d89('0x3b')]?_0x4a1988['attributes']:_0x4f645b[_0x8d89('0x34')];if(!_0x397389[_0x8d89('0x35')][_0x8d89('0x3c')](_0x8d89('0x3d'))){_0x4a1988[_0x8d89('0x1f')]=qs[_0x8d89('0x1f')](_0x397389[_0x8d89('0x35')][_0x8d89('0x1f')]);_0x4a1988[_0x8d89('0x1d')]=qs[_0x8d89('0x1d')](_0x397389[_0x8d89('0x35')][_0x8d89('0x1d')]);}_0x4a1988[_0x8d89('0x3e')]=qs[_0x8d89('0x3f')](_0x397389[_0x8d89('0x35')]['sort']);_0x4a1988[_0x8d89('0x40')]=qs[_0x8d89('0x37')](_[_0x8d89('0x41')](_0x397389[_0x8d89('0x35')],_0x4f645b[_0x8d89('0x37')]),_0x587151);if(_0x397389[_0x8d89('0x35')][_0x8d89('0x42')]){_0x4a1988[_0x8d89('0x40')]=_[_0x8d89('0x43')](_0x4a1988[_0x8d89('0x40')],{'$or':_['map'](_0x587151,function(_0xf600c2){if(_0xf600c2[_0x8d89('0x32')]!==_0x8d89('0x44')){var _0x30844a={};_0x30844a[_0xf600c2[_0x8d89('0x2c')]]={'$like':'%'+_0x397389[_0x8d89('0x35')][_0x8d89('0x42')]+'%'};return _0x30844a;}})});}_0x4a1988=_[_0x8d89('0x43')]({},_0x4a1988,_0x397389['options']);var _0x13bbb1={'where':_0x4a1988[_0x8d89('0x40')]};return db['Trigger']['count'](_0x13bbb1)[_0x8d89('0x26')](function(_0x5aea43){_0x584a4b['count']=_0x5aea43;if(_0x397389['query']['includeAll']){_0x4a1988[_0x8d89('0x45')]=[{'all':!![]}];}return db['Trigger'][_0x8d89('0x46')](_0x4a1988);})[_0x8d89('0x26')](function(_0x4b7611){_0x584a4b['rows']=_0x4b7611;return _0x584a4b;})[_0x8d89('0x26')](respondWithFilteredResult(_0x1172e2,_0x4a1988))[_0x8d89('0x47')](handleError(_0x1172e2,null));};exports['show']=function(_0x74fb5c,_0x5c8313){var _0x5d03aa={'raw':![],'where':{'id':_0x74fb5c['params']['id']}},_0x221d22={};_0x221d22[_0x8d89('0x34')]=_[_0x8d89('0x36')](db[_0x8d89('0x48')][_0x8d89('0x30')]);_0x221d22[_0x8d89('0x35')]=_['keys'](_0x74fb5c['query']);_0x221d22[_0x8d89('0x37')]=_[_0x8d89('0x38')](_0x221d22[_0x8d89('0x34')],_0x221d22[_0x8d89('0x35')]);_0x5d03aa[_0x8d89('0x39')]=_[_0x8d89('0x38')](_0x221d22['model'],qs[_0x8d89('0x3a')](_0x74fb5c[_0x8d89('0x35')][_0x8d89('0x3a')]));_0x5d03aa['attributes']=_0x5d03aa[_0x8d89('0x39')][_0x8d89('0x3b')]?_0x5d03aa[_0x8d89('0x39')]:_0x221d22[_0x8d89('0x34')];if(_0x74fb5c[_0x8d89('0x35')]['includeAll']){_0x5d03aa[_0x8d89('0x45')]=[{'all':!![]}];}_0x5d03aa=_[_0x8d89('0x43')]({},_0x5d03aa,_0x74fb5c[_0x8d89('0x49')]);return db['Trigger'][_0x8d89('0x4a')](_0x5d03aa)[_0x8d89('0x26')](handleEntityNotFound(_0x5c8313,null))[_0x8d89('0x26')](respondWithResult(_0x5c8313,null))[_0x8d89('0x47')](handleError(_0x5c8313,null));};exports['create']=function(_0x203ed0,_0x307a3e){return db[_0x8d89('0x48')][_0x8d89('0x4b')](_0x203ed0[_0x8d89('0x4c')],{})[_0x8d89('0x26')](function(_0x336368){var _0xd54083=_0x203ed0['user']['get']({'plain':!![]});if(!_0xd54083)throw new Error(_0x8d89('0x4d'));if(_0xd54083['role']==='user'){var _0x21edbe=_0x336368[_0x8d89('0x28')]({'plain':!![]});var _0x3add89=_0x8d89('0x4e');return db['UserProfileSection'][_0x8d89('0x4a')]({'where':{'name':_0x3add89,'userProfileId':_0xd54083[_0x8d89('0x4f')]},'raw':!![]})[_0x8d89('0x26')](function(_0x2c9976){if(_0x2c9976&&_0x2c9976['autoAssociation']===0x0){return db['UserProfileResource'][_0x8d89('0x4b')]({'name':_0x21edbe[_0x8d89('0x2c')],'resourceId':_0x21edbe['id'],'type':_0x2c9976[_0x8d89('0x2c')],'sectionId':_0x2c9976['id']},{})[_0x8d89('0x26')](function(){return _0x336368;});}else{return _0x336368;}})['catch'](function(_0x4cd900){logger[_0x8d89('0x2a')](_0x8d89('0x50'),_0x4cd900);throw _0x4cd900;});}return _0x336368;})[_0x8d89('0x26')](respondWithResult(_0x307a3e,0xc9))[_0x8d89('0x47')](handleError(_0x307a3e,null));};exports[_0x8d89('0x25')]=function(_0x53a332,_0x63844){if(_0x53a332[_0x8d89('0x4c')]['id']){delete _0x53a332[_0x8d89('0x4c')]['id'];}return db[_0x8d89('0x48')][_0x8d89('0x4a')]({'where':{'id':_0x53a332[_0x8d89('0x51')]['id']}})['then'](handleEntityNotFound(_0x63844,null))[_0x8d89('0x26')](saveUpdates(_0x53a332[_0x8d89('0x4c')],null))[_0x8d89('0x26')](respondWithResult(_0x63844,null))[_0x8d89('0x47')](handleError(_0x63844,null));};exports[_0x8d89('0x27')]=function(_0x52cbbd,_0xacf2a0){return db[_0x8d89('0x48')][_0x8d89('0x4a')]({'where':{'id':_0x52cbbd[_0x8d89('0x51')]['id']}})[_0x8d89('0x26')](handleEntityNotFound(_0xacf2a0,null))['then'](removeEntity(_0xacf2a0,null))['catch'](handleError(_0xacf2a0,null));};exports[_0x8d89('0x52')]=function(_0x2f0c0e,_0x478c01,_0x7a316f){if(_0x2f0c0e[_0x8d89('0x4c')]['id']){delete _0x2f0c0e['body']['id'];}return db[_0x8d89('0x48')][_0x8d89('0x4a')]({'where':{'id':_0x2f0c0e[_0x8d89('0x51')]['id']}})[_0x8d89('0x26')](handleEntityNotFound(_0x478c01,null))[_0x8d89('0x26')](function(_0x38abb3){if(_0x38abb3){_0x2f0c0e[_0x8d89('0x4c')]['TriggerAllId']=_0x38abb3['id'];return db[_0x8d89('0x53')][_0x8d89('0x4b')](_0x2f0c0e['body']);}})[_0x8d89('0x26')](respondWithResult(_0x478c01,null))[_0x8d89('0x47')](handleError(_0x478c01,null));};exports['addAnyCondition']=function(_0x2dbb4f,_0x1641c8,_0x1c7715){if(_0x2dbb4f[_0x8d89('0x4c')]['id']){delete _0x2dbb4f[_0x8d89('0x4c')]['id'];}return db['Trigger'][_0x8d89('0x4a')]({'where':{'id':_0x2dbb4f[_0x8d89('0x51')]['id']}})[_0x8d89('0x26')](handleEntityNotFound(_0x1641c8,null))[_0x8d89('0x26')](function(_0x37e6d7){if(_0x37e6d7){_0x2dbb4f[_0x8d89('0x4c')]['TriggerAnyId']=_0x37e6d7['id'];return db[_0x8d89('0x53')][_0x8d89('0x4b')](_0x2dbb4f[_0x8d89('0x4c')]);}})[_0x8d89('0x26')](respondWithResult(_0x1641c8,null))[_0x8d89('0x47')](handleError(_0x1641c8,null));};exports[_0x8d89('0x54')]=function(_0x4c3cd1,_0x273a87,_0x4c8f3c){var _0x37339f={};var _0x8ac054={};var _0x5e0d7f;var _0x9d4444;return db[_0x8d89('0x48')][_0x8d89('0x55')]({'where':{'id':_0x4c3cd1[_0x8d89('0x51')]['id']}})[_0x8d89('0x26')](handleEntityNotFound(_0x273a87,null))[_0x8d89('0x26')](function(_0x4e1498){if(_0x4e1498){_0x5e0d7f=_0x4e1498;_0x8ac054[_0x8d89('0x34')]=_[_0x8d89('0x36')](db['Condition'][_0x8d89('0x30')]);_0x8ac054[_0x8d89('0x35')]=_[_0x8d89('0x36')](_0x4c3cd1[_0x8d89('0x35')]);_0x8ac054['filters']=_['intersection'](_0x8ac054[_0x8d89('0x34')],_0x8ac054[_0x8d89('0x35')]);_0x37339f['attributes']=_[_0x8d89('0x38')](_0x8ac054[_0x8d89('0x34')],qs['fields'](_0x4c3cd1[_0x8d89('0x35')]['fields']));_0x37339f[_0x8d89('0x39')]=_0x37339f[_0x8d89('0x39')][_0x8d89('0x3b')]?_0x37339f[_0x8d89('0x39')]:_0x8ac054[_0x8d89('0x34')];_0x37339f[_0x8d89('0x3e')]=qs['sort'](_0x4c3cd1[_0x8d89('0x35')][_0x8d89('0x3f')]);_0x37339f[_0x8d89('0x40')]=qs[_0x8d89('0x37')](_[_0x8d89('0x41')](_0x4c3cd1[_0x8d89('0x35')],_0x8ac054[_0x8d89('0x37')]));if(_0x4c3cd1[_0x8d89('0x35')][_0x8d89('0x42')]){_0x37339f[_0x8d89('0x40')]=_[_0x8d89('0x43')](_0x37339f[_0x8d89('0x40')],{'$or':_['map'](_0x37339f[_0x8d89('0x39')],function(_0x309707){var _0x58fce0={};_0x58fce0[_0x309707]={'$like':'%'+_0x4c3cd1[_0x8d89('0x35')][_0x8d89('0x42')]+'%'};return _0x58fce0;})});}_0x37339f=_[_0x8d89('0x43')]({},_0x37339f,_0x4c3cd1['options']);return _0x5e0d7f[_0x8d89('0x54')](_0x37339f);}})[_0x8d89('0x26')](function(_0x54351b){if(_0x54351b){_0x9d4444=_0x54351b[_0x8d89('0x3b')];if(!_0x4c3cd1[_0x8d89('0x35')][_0x8d89('0x3c')](_0x8d89('0x3d'))){_0x37339f[_0x8d89('0x1f')]=qs['limit'](_0x4c3cd1[_0x8d89('0x35')]['limit']);_0x37339f[_0x8d89('0x1d')]=qs[_0x8d89('0x1d')](_0x4c3cd1[_0x8d89('0x35')][_0x8d89('0x1d')]);}return _0x5e0d7f[_0x8d89('0x54')](_0x37339f);}})[_0x8d89('0x26')](function(_0x15a0d7){if(_0x15a0d7){return _0x15a0d7?{'count':_0x9d4444,'rows':_0x15a0d7}:null;}})['then'](respondWithResult(_0x273a87,null))[_0x8d89('0x47')](handleError(_0x273a87,null));};exports['getAnyConditions']=function(_0x3ff3e3,_0x254d9a,_0x386ddb){var _0x4913cc={};var _0x37373e={};var _0x6716f9;var _0x30097a;return db['Trigger'][_0x8d89('0x55')]({'where':{'id':_0x3ff3e3[_0x8d89('0x51')]['id']}})[_0x8d89('0x26')](handleEntityNotFound(_0x254d9a,null))[_0x8d89('0x26')](function(_0x15ca58){if(_0x15ca58){_0x6716f9=_0x15ca58;_0x37373e[_0x8d89('0x34')]=_[_0x8d89('0x36')](db[_0x8d89('0x53')][_0x8d89('0x30')]);_0x37373e['query']=_[_0x8d89('0x36')](_0x3ff3e3[_0x8d89('0x35')]);_0x37373e[_0x8d89('0x37')]=_[_0x8d89('0x38')](_0x37373e[_0x8d89('0x34')],_0x37373e[_0x8d89('0x35')]);_0x4913cc[_0x8d89('0x39')]=_[_0x8d89('0x38')](_0x37373e[_0x8d89('0x34')],qs[_0x8d89('0x3a')](_0x3ff3e3['query'][_0x8d89('0x3a')]));_0x4913cc[_0x8d89('0x39')]=_0x4913cc['attributes']['length']?_0x4913cc[_0x8d89('0x39')]:_0x37373e['model'];_0x4913cc['order']=qs[_0x8d89('0x3f')](_0x3ff3e3[_0x8d89('0x35')][_0x8d89('0x3f')]);_0x4913cc['where']=qs[_0x8d89('0x37')](_['pick'](_0x3ff3e3[_0x8d89('0x35')],_0x37373e[_0x8d89('0x37')]));if(_0x3ff3e3[_0x8d89('0x35')][_0x8d89('0x42')]){_0x4913cc[_0x8d89('0x40')]=_[_0x8d89('0x43')](_0x4913cc[_0x8d89('0x40')],{'$or':_['map'](_0x4913cc[_0x8d89('0x39')],function(_0x10c6da){var _0xc2f042={};_0xc2f042[_0x10c6da]={'$like':'%'+_0x3ff3e3[_0x8d89('0x35')][_0x8d89('0x42')]+'%'};return _0xc2f042;})});}_0x4913cc=_[_0x8d89('0x43')]({},_0x4913cc,_0x3ff3e3[_0x8d89('0x49')]);return _0x6716f9[_0x8d89('0x56')](_0x4913cc);}})['then'](function(_0x4c61c3){if(_0x4c61c3){_0x30097a=_0x4c61c3[_0x8d89('0x3b')];if(!_0x3ff3e3['query'][_0x8d89('0x3c')](_0x8d89('0x3d'))){_0x4913cc[_0x8d89('0x1f')]=qs[_0x8d89('0x1f')](_0x3ff3e3[_0x8d89('0x35')]['limit']);_0x4913cc['offset']=qs['offset'](_0x3ff3e3[_0x8d89('0x35')][_0x8d89('0x1d')]);}return _0x6716f9[_0x8d89('0x56')](_0x4913cc);}})[_0x8d89('0x26')](function(_0x20ae97){if(_0x20ae97){return _0x20ae97?{'count':_0x30097a,'rows':_0x20ae97}:null;}})[_0x8d89('0x26')](respondWithResult(_0x254d9a,null))[_0x8d89('0x47')](handleError(_0x254d9a,null));};exports[_0x8d89('0x57')]=function(_0x680f25,_0x480b1c,_0x318237){if(_0x680f25[_0x8d89('0x4c')]['id']){delete _0x680f25[_0x8d89('0x4c')]['id'];}return db[_0x8d89('0x48')][_0x8d89('0x4a')]({'where':{'id':_0x680f25['params']['id']}})['then'](handleEntityNotFound(_0x480b1c,null))[_0x8d89('0x26')](function(_0x597bc2){if(_0x597bc2){_0x680f25[_0x8d89('0x4c')][_0x8d89('0x58')]=_0x597bc2['id'];return db[_0x8d89('0x59')][_0x8d89('0x4b')](_0x680f25[_0x8d89('0x4c')]);}})[_0x8d89('0x26')](respondWithResult(_0x480b1c,null))[_0x8d89('0x47')](handleError(_0x480b1c,null));};exports[_0x8d89('0x5a')]=function(_0x3c5a11,_0x54bdce,_0x151aba){var _0x394a2d={};var _0x380442={};var _0x3f6523;var _0x58b2f3;return db[_0x8d89('0x48')][_0x8d89('0x55')]({'where':{'id':_0x3c5a11[_0x8d89('0x51')]['id']}})[_0x8d89('0x26')](handleEntityNotFound(_0x54bdce,null))[_0x8d89('0x26')](function(_0x1045bb){if(_0x1045bb){_0x3f6523=_0x1045bb;_0x380442[_0x8d89('0x34')]=_[_0x8d89('0x36')](db[_0x8d89('0x59')]['rawAttributes']);_0x380442[_0x8d89('0x35')]=_[_0x8d89('0x36')](_0x3c5a11[_0x8d89('0x35')]);_0x380442[_0x8d89('0x37')]=_[_0x8d89('0x38')](_0x380442[_0x8d89('0x34')],_0x380442[_0x8d89('0x35')]);_0x394a2d[_0x8d89('0x39')]=_[_0x8d89('0x38')](_0x380442[_0x8d89('0x34')],qs['fields'](_0x3c5a11[_0x8d89('0x35')][_0x8d89('0x3a')]));_0x394a2d[_0x8d89('0x39')]=_0x394a2d[_0x8d89('0x39')][_0x8d89('0x3b')]?_0x394a2d['attributes']:_0x380442[_0x8d89('0x34')];_0x394a2d[_0x8d89('0x3e')]=qs[_0x8d89('0x3f')](_0x3c5a11[_0x8d89('0x35')][_0x8d89('0x3f')]);_0x394a2d[_0x8d89('0x40')]=qs[_0x8d89('0x37')](_[_0x8d89('0x41')](_0x3c5a11['query'],_0x380442[_0x8d89('0x37')]));if(_0x3c5a11[_0x8d89('0x35')]['filter']){_0x394a2d[_0x8d89('0x40')]=_[_0x8d89('0x43')](_0x394a2d[_0x8d89('0x40')],{'$or':_[_0x8d89('0x2f')](_0x394a2d['attributes'],function(_0x50a3e8){var _0x1bf390={};_0x1bf390[_0x50a3e8]={'$like':'%'+_0x3c5a11[_0x8d89('0x35')][_0x8d89('0x42')]+'%'};return _0x1bf390;})});}_0x394a2d=_[_0x8d89('0x43')]({},_0x394a2d,_0x3c5a11['options']);return _0x3f6523[_0x8d89('0x5a')](_0x394a2d);}})[_0x8d89('0x26')](function(_0x31b100){if(_0x31b100){_0x58b2f3=_0x31b100['length'];if(!_0x3c5a11[_0x8d89('0x35')][_0x8d89('0x3c')]('nolimit')){_0x394a2d[_0x8d89('0x1f')]=qs['limit'](_0x3c5a11[_0x8d89('0x35')][_0x8d89('0x1f')]);_0x394a2d['offset']=qs[_0x8d89('0x1d')](_0x3c5a11['query'][_0x8d89('0x1d')]);}return _0x3f6523['getActions'](_0x394a2d);}})[_0x8d89('0x26')](function(_0xf7c793){if(_0xf7c793){return _0xf7c793?{'count':_0x58b2f3,'rows':_0xf7c793}:null;}})['then'](respondWithResult(_0x54bdce,null))['catch'](handleError(_0x54bdce,null));}; \ No newline at end of file +var _0x41a4=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','send','index','map','Trigger','rawAttributes','type','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','intersection','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x3f5d82,_0x271338){var _0x32a5ad=function(_0x266231){while(--_0x266231){_0x3f5d82['push'](_0x3f5d82['shift']());}};_0x32a5ad(++_0x271338);}(_0x41a4,0xf6));var _0x441a=function(_0xca95f4,_0x28e877){_0xca95f4=_0xca95f4-0x0;var _0x350f82=_0x41a4[_0xca95f4];return _0x350f82;};'use strict';var emlformat=require(_0x441a('0x0'));var rimraf=require(_0x441a('0x1'));var zipdir=require(_0x441a('0x2'));var jsonpatch=require(_0x441a('0x3'));var rp=require(_0x441a('0x4'));var moment=require('moment');var BPromise=require(_0x441a('0x5'));var Mustache=require(_0x441a('0x6'));var util=require(_0x441a('0x7'));var path=require(_0x441a('0x8'));var sox=require('sox');var csv=require(_0x441a('0x9'));var ejs=require(_0x441a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x441a('0xb'));var squel=require(_0x441a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x441a('0x9'));var querystring=require(_0x441a('0xd'));var Papa=require(_0x441a('0xe'));var Redis=require(_0x441a('0xf'));var authService=require(_0x441a('0x10'));var qs=require(_0x441a('0x11'));var as=require(_0x441a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x441a('0x13'));var utils=require(_0x441a('0x14'));var config=require(_0x441a('0x15'));var licenseUtil=require(_0x441a('0x16'));var db=require(_0x441a('0x17'))['db'];function respondWithStatusCode(_0x5d5e60,_0x167701){_0x167701=_0x167701||0xcc;return function(_0x5650b4){if(_0x5650b4){return _0x5d5e60[_0x441a('0x18')](_0x167701);}return _0x5d5e60[_0x441a('0x19')](_0x167701)[_0x441a('0x1a')]();};}function respondWithResult(_0x3a8eb1,_0x4d7cc6){_0x4d7cc6=_0x4d7cc6||0xc8;return function(_0x262267){if(_0x262267){return _0x3a8eb1[_0x441a('0x19')](_0x4d7cc6)[_0x441a('0x1b')](_0x262267);}};}function respondWithFilteredResult(_0x28e9a7,_0x5acfce){return function(_0x2ce333){if(_0x2ce333){var _0x26dfca=typeof _0x5acfce[_0x441a('0x1c')]===_0x441a('0x1d')&&typeof _0x5acfce[_0x441a('0x1e')]===_0x441a('0x1d');var _0x3df929=_0x2ce333[_0x441a('0x1f')];var _0x1ea3d2=_0x26dfca?0x0:_0x5acfce[_0x441a('0x1c')];var _0x37a7da=_0x26dfca?_0x2ce333[_0x441a('0x1f')]:_0x5acfce[_0x441a('0x1c')]+_0x5acfce['limit'];var _0x1047a6;if(_0x37a7da>=_0x3df929){_0x37a7da=_0x3df929;_0x1047a6=0xc8;}else{_0x1047a6=0xce;}_0x28e9a7['status'](_0x1047a6);return _0x28e9a7[_0x441a('0x20')](_0x441a('0x21'),_0x1ea3d2+'-'+_0x37a7da+'/'+_0x3df929)[_0x441a('0x1b')](_0x2ce333);}return null;};}function patchUpdates(_0x2be272){return function(_0x1b0955){try{jsonpatch[_0x441a('0x22')](_0x1b0955,_0x2be272,!![]);}catch(_0x84b37c){return BPromise['reject'](_0x84b37c);}return _0x1b0955[_0x441a('0x23')]();};}function saveUpdates(_0x5f5a06,_0x1b1d01){return function(_0x179c19){if(_0x179c19){return _0x179c19[_0x441a('0x24')](_0x5f5a06)[_0x441a('0x25')](function(_0x1d46b7){return _0x1d46b7;});}return null;};}function removeEntity(_0x5dd7aa,_0x360860){return function(_0x44d029){if(_0x44d029){return _0x44d029[_0x441a('0x26')]()[_0x441a('0x25')](function(){var _0x458a0b=_0x44d029[_0x441a('0x27')]({'plain':!![]});var _0x3b593a='Triggers';return db['UserProfileResource'][_0x441a('0x26')]({'where':{'type':_0x3b593a,'resourceId':_0x458a0b['id']}})[_0x441a('0x25')](function(){return _0x44d029;});})[_0x441a('0x25')](function(){_0x5dd7aa['status'](0xcc)[_0x441a('0x1a')]();});}};}function handleEntityNotFound(_0x1a9515,_0x146baa){return function(_0xe336c2){if(!_0xe336c2){_0x1a9515[_0x441a('0x18')](0x194);}return _0xe336c2;};}function handleError(_0x29c0e6,_0x302bfd){_0x302bfd=_0x302bfd||0x1f4;return function(_0x8f1379){logger[_0x441a('0x28')](_0x8f1379[_0x441a('0x29')]);if(_0x8f1379[_0x441a('0x2a')]){delete _0x8f1379['name'];}_0x29c0e6[_0x441a('0x19')](_0x302bfd)[_0x441a('0x2b')](_0x8f1379);};}exports[_0x441a('0x2c')]=function(_0x45e572,_0x7307b){var _0x51fe49={},_0x21b0c4={},_0x48a095={'count':0x0,'rows':[]};var _0x13422a=_[_0x441a('0x2d')](db[_0x441a('0x2e')][_0x441a('0x2f')],function(_0x44406b){return{'name':_0x44406b['fieldName'],'type':_0x44406b[_0x441a('0x30')]['key']};});_0x21b0c4[_0x441a('0x31')]=_[_0x441a('0x2d')](_0x13422a,_0x441a('0x2a'));_0x21b0c4['query']=_[_0x441a('0x32')](_0x45e572[_0x441a('0x33')]);_0x21b0c4[_0x441a('0x34')]=_['intersection'](_0x21b0c4[_0x441a('0x31')],_0x21b0c4[_0x441a('0x33')]);_0x51fe49['attributes']=_['intersection'](_0x21b0c4[_0x441a('0x31')],qs[_0x441a('0x35')](_0x45e572[_0x441a('0x33')][_0x441a('0x35')]));_0x51fe49[_0x441a('0x36')]=_0x51fe49[_0x441a('0x36')][_0x441a('0x37')]?_0x51fe49[_0x441a('0x36')]:_0x21b0c4['model'];if(!_0x45e572[_0x441a('0x33')][_0x441a('0x38')](_0x441a('0x39'))){_0x51fe49[_0x441a('0x1e')]=qs[_0x441a('0x1e')](_0x45e572[_0x441a('0x33')][_0x441a('0x1e')]);_0x51fe49[_0x441a('0x1c')]=qs[_0x441a('0x1c')](_0x45e572[_0x441a('0x33')][_0x441a('0x1c')]);}_0x51fe49[_0x441a('0x3a')]=qs[_0x441a('0x3b')](_0x45e572['query']['sort']);_0x51fe49['where']=qs[_0x441a('0x34')](_[_0x441a('0x3c')](_0x45e572['query'],_0x21b0c4[_0x441a('0x34')]),_0x13422a);if(_0x45e572[_0x441a('0x33')][_0x441a('0x3d')]){_0x51fe49['where']=_['merge'](_0x51fe49[_0x441a('0x3e')],{'$or':_[_0x441a('0x2d')](_0x13422a,function(_0x39b88b){if(_0x39b88b[_0x441a('0x30')]!=='VIRTUAL'){var _0x5aa824={};_0x5aa824[_0x39b88b[_0x441a('0x2a')]]={'$like':'%'+_0x45e572[_0x441a('0x33')][_0x441a('0x3d')]+'%'};return _0x5aa824;}})});}_0x51fe49=_[_0x441a('0x3f')]({},_0x51fe49,_0x45e572[_0x441a('0x40')]);var _0x502a19={'where':_0x51fe49[_0x441a('0x3e')]};return db[_0x441a('0x2e')]['count'](_0x502a19)[_0x441a('0x25')](function(_0x211790){_0x48a095[_0x441a('0x1f')]=_0x211790;if(_0x45e572[_0x441a('0x33')][_0x441a('0x41')]){_0x51fe49[_0x441a('0x42')]=[{'all':!![]}];}return db[_0x441a('0x2e')][_0x441a('0x43')](_0x51fe49);})[_0x441a('0x25')](function(_0x181cc5){_0x48a095[_0x441a('0x44')]=_0x181cc5;return _0x48a095;})[_0x441a('0x25')](respondWithFilteredResult(_0x7307b,_0x51fe49))[_0x441a('0x45')](handleError(_0x7307b,null));};exports[_0x441a('0x46')]=function(_0x3e592b,_0x2dd7b2){var _0x4c8abe={'raw':![],'where':{'id':_0x3e592b[_0x441a('0x47')]['id']}},_0x57ae7a={};_0x57ae7a['model']=_[_0x441a('0x32')](db[_0x441a('0x2e')]['rawAttributes']);_0x57ae7a['query']=_['keys'](_0x3e592b[_0x441a('0x33')]);_0x57ae7a[_0x441a('0x34')]=_['intersection'](_0x57ae7a[_0x441a('0x31')],_0x57ae7a[_0x441a('0x33')]);_0x4c8abe['attributes']=_['intersection'](_0x57ae7a[_0x441a('0x31')],qs['fields'](_0x3e592b[_0x441a('0x33')][_0x441a('0x35')]));_0x4c8abe[_0x441a('0x36')]=_0x4c8abe['attributes'][_0x441a('0x37')]?_0x4c8abe[_0x441a('0x36')]:_0x57ae7a[_0x441a('0x31')];if(_0x3e592b[_0x441a('0x33')][_0x441a('0x41')]){_0x4c8abe[_0x441a('0x42')]=[{'all':!![]}];}_0x4c8abe=_[_0x441a('0x3f')]({},_0x4c8abe,_0x3e592b['options']);return db[_0x441a('0x2e')][_0x441a('0x48')](_0x4c8abe)[_0x441a('0x25')](handleEntityNotFound(_0x2dd7b2,null))[_0x441a('0x25')](respondWithResult(_0x2dd7b2,null))[_0x441a('0x45')](handleError(_0x2dd7b2,null));};exports[_0x441a('0x49')]=function(_0x3b8356,_0x627fa2){return db[_0x441a('0x2e')][_0x441a('0x49')](_0x3b8356['body'],{})[_0x441a('0x25')](function(_0x441fcb){var _0x3cdc23=_0x3b8356['user'][_0x441a('0x27')]({'plain':!![]});if(!_0x3cdc23)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cdc23['role']==='user'){var _0x41a7ea=_0x441fcb[_0x441a('0x27')]({'plain':!![]});var _0x19cad4='Triggers';return db['UserProfileSection'][_0x441a('0x48')]({'where':{'name':_0x19cad4,'userProfileId':_0x3cdc23[_0x441a('0x4a')]},'raw':!![]})['then'](function(_0x17d80e){if(_0x17d80e&&_0x17d80e[_0x441a('0x4b')]===0x0){return db[_0x441a('0x4c')][_0x441a('0x49')]({'name':_0x41a7ea[_0x441a('0x2a')],'resourceId':_0x41a7ea['id'],'type':_0x17d80e['name'],'sectionId':_0x17d80e['id']},{})[_0x441a('0x25')](function(){return _0x441fcb;});}else{return _0x441fcb;}})[_0x441a('0x45')](function(_0x54299f){logger[_0x441a('0x28')](_0x441a('0x4d'),_0x54299f);throw _0x54299f;});}return _0x441fcb;})[_0x441a('0x25')](respondWithResult(_0x627fa2,0xc9))[_0x441a('0x45')](handleError(_0x627fa2,null));};exports[_0x441a('0x24')]=function(_0x2b14db,_0x493c5c){if(_0x2b14db[_0x441a('0x4e')]['id']){delete _0x2b14db[_0x441a('0x4e')]['id'];}return db[_0x441a('0x2e')][_0x441a('0x48')]({'where':{'id':_0x2b14db[_0x441a('0x47')]['id']}})[_0x441a('0x25')](handleEntityNotFound(_0x493c5c,null))['then'](saveUpdates(_0x2b14db[_0x441a('0x4e')],null))[_0x441a('0x25')](respondWithResult(_0x493c5c,null))['catch'](handleError(_0x493c5c,null));};exports[_0x441a('0x26')]=function(_0x4ca50b,_0x4657df){return db['Trigger'][_0x441a('0x48')]({'where':{'id':_0x4ca50b['params']['id']}})[_0x441a('0x25')](handleEntityNotFound(_0x4657df,null))[_0x441a('0x25')](removeEntity(_0x4657df,null))[_0x441a('0x45')](handleError(_0x4657df,null));};exports[_0x441a('0x4f')]=function(_0x21f81c,_0x29ffef,_0x5e437b){if(_0x21f81c['body']['id']){delete _0x21f81c[_0x441a('0x4e')]['id'];}return db['Trigger'][_0x441a('0x48')]({'where':{'id':_0x21f81c['params']['id']}})[_0x441a('0x25')](handleEntityNotFound(_0x29ffef,null))['then'](function(_0x3c6472){if(_0x3c6472){_0x21f81c['body'][_0x441a('0x50')]=_0x3c6472['id'];return db[_0x441a('0x51')][_0x441a('0x49')](_0x21f81c[_0x441a('0x4e')]);}})[_0x441a('0x25')](respondWithResult(_0x29ffef,null))[_0x441a('0x45')](handleError(_0x29ffef,null));};exports[_0x441a('0x52')]=function(_0x5d4534,_0xcccf24,_0x5add55){if(_0x5d4534[_0x441a('0x4e')]['id']){delete _0x5d4534['body']['id'];}return db[_0x441a('0x2e')][_0x441a('0x48')]({'where':{'id':_0x5d4534[_0x441a('0x47')]['id']}})[_0x441a('0x25')](handleEntityNotFound(_0xcccf24,null))[_0x441a('0x25')](function(_0x2bde2f){if(_0x2bde2f){_0x5d4534[_0x441a('0x4e')][_0x441a('0x53')]=_0x2bde2f['id'];return db['Condition'][_0x441a('0x49')](_0x5d4534['body']);}})[_0x441a('0x25')](respondWithResult(_0xcccf24,null))['catch'](handleError(_0xcccf24,null));};exports['getAllConditions']=function(_0xfc2b00,_0x838e58,_0x500ac7){var _0x38e047={};var _0x1667b3={};var _0x4a6476;var _0x5e5d7e;return db['Trigger']['findOne']({'where':{'id':_0xfc2b00[_0x441a('0x47')]['id']}})[_0x441a('0x25')](handleEntityNotFound(_0x838e58,null))[_0x441a('0x25')](function(_0xc43138){if(_0xc43138){_0x4a6476=_0xc43138;_0x1667b3[_0x441a('0x31')]=_[_0x441a('0x32')](db[_0x441a('0x51')][_0x441a('0x2f')]);_0x1667b3['query']=_[_0x441a('0x32')](_0xfc2b00[_0x441a('0x33')]);_0x1667b3['filters']=_[_0x441a('0x54')](_0x1667b3[_0x441a('0x31')],_0x1667b3['query']);_0x38e047[_0x441a('0x36')]=_['intersection'](_0x1667b3[_0x441a('0x31')],qs[_0x441a('0x35')](_0xfc2b00[_0x441a('0x33')]['fields']));_0x38e047[_0x441a('0x36')]=_0x38e047[_0x441a('0x36')][_0x441a('0x37')]?_0x38e047[_0x441a('0x36')]:_0x1667b3[_0x441a('0x31')];_0x38e047[_0x441a('0x3a')]=qs[_0x441a('0x3b')](_0xfc2b00[_0x441a('0x33')][_0x441a('0x3b')]);_0x38e047['where']=qs[_0x441a('0x34')](_['pick'](_0xfc2b00['query'],_0x1667b3['filters']));if(_0xfc2b00['query'][_0x441a('0x3d')]){_0x38e047[_0x441a('0x3e')]=_['merge'](_0x38e047[_0x441a('0x3e')],{'$or':_[_0x441a('0x2d')](_0x38e047[_0x441a('0x36')],function(_0x3e67f8){var _0x44a779={};_0x44a779[_0x3e67f8]={'$like':'%'+_0xfc2b00[_0x441a('0x33')][_0x441a('0x3d')]+'%'};return _0x44a779;})});}_0x38e047=_[_0x441a('0x3f')]({},_0x38e047,_0xfc2b00[_0x441a('0x40')]);return _0x4a6476[_0x441a('0x55')](_0x38e047);}})[_0x441a('0x25')](function(_0x4e30cd){if(_0x4e30cd){_0x5e5d7e=_0x4e30cd[_0x441a('0x37')];if(!_0xfc2b00[_0x441a('0x33')][_0x441a('0x38')](_0x441a('0x39'))){_0x38e047[_0x441a('0x1e')]=qs['limit'](_0xfc2b00[_0x441a('0x33')][_0x441a('0x1e')]);_0x38e047[_0x441a('0x1c')]=qs[_0x441a('0x1c')](_0xfc2b00['query'][_0x441a('0x1c')]);}return _0x4a6476[_0x441a('0x55')](_0x38e047);}})[_0x441a('0x25')](function(_0x48a039){if(_0x48a039){return _0x48a039?{'count':_0x5e5d7e,'rows':_0x48a039}:null;}})[_0x441a('0x25')](respondWithResult(_0x838e58,null))[_0x441a('0x45')](handleError(_0x838e58,null));};exports[_0x441a('0x56')]=function(_0x3dfa07,_0x1d8b38,_0x5557ad){var _0x58b430={};var _0xb5e8ec={};var _0x25bc6c;var _0x25056e;return db[_0x441a('0x2e')][_0x441a('0x57')]({'where':{'id':_0x3dfa07[_0x441a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d8b38,null))['then'](function(_0x48f7fb){if(_0x48f7fb){_0x25bc6c=_0x48f7fb;_0xb5e8ec[_0x441a('0x31')]=_['keys'](db[_0x441a('0x51')][_0x441a('0x2f')]);_0xb5e8ec[_0x441a('0x33')]=_[_0x441a('0x32')](_0x3dfa07[_0x441a('0x33')]);_0xb5e8ec[_0x441a('0x34')]=_[_0x441a('0x54')](_0xb5e8ec[_0x441a('0x31')],_0xb5e8ec[_0x441a('0x33')]);_0x58b430[_0x441a('0x36')]=_[_0x441a('0x54')](_0xb5e8ec[_0x441a('0x31')],qs[_0x441a('0x35')](_0x3dfa07['query'][_0x441a('0x35')]));_0x58b430[_0x441a('0x36')]=_0x58b430[_0x441a('0x36')]['length']?_0x58b430[_0x441a('0x36')]:_0xb5e8ec[_0x441a('0x31')];_0x58b430['order']=qs['sort'](_0x3dfa07[_0x441a('0x33')][_0x441a('0x3b')]);_0x58b430[_0x441a('0x3e')]=qs[_0x441a('0x34')](_[_0x441a('0x3c')](_0x3dfa07[_0x441a('0x33')],_0xb5e8ec[_0x441a('0x34')]));if(_0x3dfa07[_0x441a('0x33')][_0x441a('0x3d')]){_0x58b430['where']=_[_0x441a('0x3f')](_0x58b430[_0x441a('0x3e')],{'$or':_[_0x441a('0x2d')](_0x58b430[_0x441a('0x36')],function(_0x24e804){var _0x170483={};_0x170483[_0x24e804]={'$like':'%'+_0x3dfa07[_0x441a('0x33')][_0x441a('0x3d')]+'%'};return _0x170483;})});}_0x58b430=_['merge']({},_0x58b430,_0x3dfa07[_0x441a('0x40')]);return _0x25bc6c[_0x441a('0x56')](_0x58b430);}})[_0x441a('0x25')](function(_0x58c04e){if(_0x58c04e){_0x25056e=_0x58c04e[_0x441a('0x37')];if(!_0x3dfa07[_0x441a('0x33')][_0x441a('0x38')](_0x441a('0x39'))){_0x58b430['limit']=qs[_0x441a('0x1e')](_0x3dfa07[_0x441a('0x33')][_0x441a('0x1e')]);_0x58b430['offset']=qs['offset'](_0x3dfa07[_0x441a('0x33')]['offset']);}return _0x25bc6c[_0x441a('0x56')](_0x58b430);}})['then'](function(_0x10522f){if(_0x10522f){return _0x10522f?{'count':_0x25056e,'rows':_0x10522f}:null;}})[_0x441a('0x25')](respondWithResult(_0x1d8b38,null))[_0x441a('0x45')](handleError(_0x1d8b38,null));};exports[_0x441a('0x58')]=function(_0xec3d4,_0x153dd4,_0x340c93){if(_0xec3d4[_0x441a('0x4e')]['id']){delete _0xec3d4[_0x441a('0x4e')]['id'];}return db[_0x441a('0x2e')]['find']({'where':{'id':_0xec3d4[_0x441a('0x47')]['id']}})[_0x441a('0x25')](handleEntityNotFound(_0x153dd4,null))['then'](function(_0x49cd39){if(_0x49cd39){_0xec3d4[_0x441a('0x4e')][_0x441a('0x59')]=_0x49cd39['id'];return db['Action'][_0x441a('0x49')](_0xec3d4[_0x441a('0x4e')]);}})[_0x441a('0x25')](respondWithResult(_0x153dd4,null))[_0x441a('0x45')](handleError(_0x153dd4,null));};exports[_0x441a('0x5a')]=function(_0x499644,_0x21b854,_0x3731a7){var _0xaccd7d={};var _0x2a8d4a={};var _0x4697e8;var _0x4feb30;return db['Trigger']['findOne']({'where':{'id':_0x499644[_0x441a('0x47')]['id']}})[_0x441a('0x25')](handleEntityNotFound(_0x21b854,null))[_0x441a('0x25')](function(_0x2af134){if(_0x2af134){_0x4697e8=_0x2af134;_0x2a8d4a[_0x441a('0x31')]=_[_0x441a('0x32')](db['Action'][_0x441a('0x2f')]);_0x2a8d4a['query']=_[_0x441a('0x32')](_0x499644[_0x441a('0x33')]);_0x2a8d4a[_0x441a('0x34')]=_[_0x441a('0x54')](_0x2a8d4a[_0x441a('0x31')],_0x2a8d4a[_0x441a('0x33')]);_0xaccd7d[_0x441a('0x36')]=_['intersection'](_0x2a8d4a[_0x441a('0x31')],qs[_0x441a('0x35')](_0x499644['query']['fields']));_0xaccd7d[_0x441a('0x36')]=_0xaccd7d[_0x441a('0x36')]['length']?_0xaccd7d[_0x441a('0x36')]:_0x2a8d4a[_0x441a('0x31')];_0xaccd7d[_0x441a('0x3a')]=qs['sort'](_0x499644['query'][_0x441a('0x3b')]);_0xaccd7d['where']=qs['filters'](_[_0x441a('0x3c')](_0x499644[_0x441a('0x33')],_0x2a8d4a[_0x441a('0x34')]));if(_0x499644[_0x441a('0x33')][_0x441a('0x3d')]){_0xaccd7d[_0x441a('0x3e')]=_[_0x441a('0x3f')](_0xaccd7d[_0x441a('0x3e')],{'$or':_[_0x441a('0x2d')](_0xaccd7d[_0x441a('0x36')],function(_0x103bcc){var _0x42995f={};_0x42995f[_0x103bcc]={'$like':'%'+_0x499644['query'][_0x441a('0x3d')]+'%'};return _0x42995f;})});}_0xaccd7d=_['merge']({},_0xaccd7d,_0x499644[_0x441a('0x40')]);return _0x4697e8[_0x441a('0x5a')](_0xaccd7d);}})[_0x441a('0x25')](function(_0x2bac3c){if(_0x2bac3c){_0x4feb30=_0x2bac3c['length'];if(!_0x499644[_0x441a('0x33')][_0x441a('0x38')](_0x441a('0x39'))){_0xaccd7d[_0x441a('0x1e')]=qs[_0x441a('0x1e')](_0x499644[_0x441a('0x33')]['limit']);_0xaccd7d[_0x441a('0x1c')]=qs[_0x441a('0x1c')](_0x499644['query'][_0x441a('0x1c')]);}return _0x4697e8['getActions'](_0xaccd7d);}})[_0x441a('0x25')](function(_0xdce17a){if(_0xdce17a){return _0xdce17a?{'count':_0x4feb30,'rows':_0xdce17a}:null;}})[_0x441a('0x25')](respondWithResult(_0x21b854,null))[_0x441a('0x45')](handleError(_0x21b854,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index a0b73ab..feb1c5a 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 _0x535f=['./trigger.attributes','exports','define','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1c2995,_0x9e2edf){var _0x1acd48=function(_0x42e649){while(--_0x42e649){_0x1c2995['push'](_0x1c2995['shift']());}};_0x1acd48(++_0x9e2edf);}(_0x535f,0x111));var _0xf535=function(_0x46fe66,_0x4b0d58){_0x46fe66=_0x46fe66-0x0;var _0x4aff52=_0x535f[_0x46fe66];return _0x4aff52;};'use strict';var _=require('lodash');var util=require(_0xf535('0x0'));var logger=require(_0xf535('0x1'))('api');var moment=require(_0xf535('0x2'));var BPromise=require(_0xf535('0x3'));var rp=require(_0xf535('0x4'));var fs=require('fs');var path=require(_0xf535('0x5'));var rimraf=require('rimraf');var config=require(_0xf535('0x6'));var attributes=require(_0xf535('0x7'));module[_0xf535('0x8')]=function(_0x30936d,_0x41ca74){return _0x30936d[_0xf535('0x9')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb57=['path','rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','api','bluebird'];(function(_0x40d4e6,_0x44f185){var _0x1eda0f=function(_0x1f687d){while(--_0x1f687d){_0x40d4e6['push'](_0x40d4e6['shift']());}};_0x1eda0f(++_0x44f185);}(_0xcb57,0xa1));var _0x7cb5=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xcb57[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x7cb5('0x0'));var util=require(_0x7cb5('0x1'));var logger=require('../../config/logger')(_0x7cb5('0x2'));var moment=require('moment');var BPromise=require(_0x7cb5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cb5('0x4'));var rimraf=require(_0x7cb5('0x5'));var config=require('../../config/environment');var attributes=require(_0x7cb5('0x6'));module[_0x7cb5('0x7')]=function(_0x1aafb5,_0x4e036d){return _0x1aafb5[_0x7cb5('0x8')](_0x7cb5('0x9'),attributes,{'tableName':_0x7cb5('0xa'),'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 c58eb18..17c669d 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 _0xf97a=['GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','map','include','model','find','ShowTrigger','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x37128b,_0x4e6afd){var _0x186017=function(_0x4adc9f){while(--_0x4adc9f){_0x37128b['push'](_0x37128b['shift']());}};_0x186017(++_0x4e6afd);}(_0xf97a,0x148));var _0xaf97=function(_0x4174ba,_0x3125b8){_0x4174ba=_0x4174ba-0x0;var _0x135360=_0xf97a[_0x4174ba];return _0x135360;};'use strict';var _=require(_0xaf97('0x0'));var util=require(_0xaf97('0x1'));var moment=require('moment');var BPromise=require(_0xaf97('0x2'));var rs=require(_0xaf97('0x3'));var fs=require('fs');var Redis=require(_0xaf97('0x4'));var db=require(_0xaf97('0x5'))['db'];var utils=require(_0xaf97('0x6'));var logger=require(_0xaf97('0x7'))('rpc');var config=require(_0xaf97('0x8'));var jayson=require(_0xaf97('0x9'));var client=jayson['client'][_0xaf97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3130aa,_0x222b94,_0x1d734f){return new BPromise(function(_0x3f6ed4,_0xe94fd3){return client[_0xaf97('0xb')](_0x3130aa,_0x1d734f)[_0xaf97('0xc')](function(_0x478009){logger[_0xaf97('0xd')](_0xaf97('0xe'),_0x222b94,_0xaf97('0xf'));logger[_0xaf97('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0x222b94,_0xaf97('0xf'),JSON[_0xaf97('0x11')](_0x478009));if(_0x478009[_0xaf97('0x12')]){if(_0x478009['error'][_0xaf97('0x13')]===0x1f4){logger['error'](_0xaf97('0xe'),_0x222b94,_0x478009['error'][_0xaf97('0x14')]);return _0xe94fd3(_0x478009[_0xaf97('0x12')]['message']);}logger['error'](_0xaf97('0xe'),_0x222b94,_0x478009[_0xaf97('0x12')]['message']);return _0x3f6ed4(_0x478009[_0xaf97('0x12')][_0xaf97('0x14')]);}else{logger[_0xaf97('0xd')](_0xaf97('0xe'),_0x222b94,_0xaf97('0xf'));_0x3f6ed4(_0x478009['result'][_0xaf97('0x14')]);}})[_0xaf97('0x15')](function(_0x409f78){logger[_0xaf97('0x12')](_0xaf97('0xe'),_0x222b94,_0x409f78);_0xe94fd3(_0x409f78);});});}exports[_0xaf97('0x16')]=function(_0x2d3cdf){var _0x213856=this;return new Promise(function(_0x5dbe8f,_0x54af41){return db[_0xaf97('0x17')][_0xaf97('0x18')]({'raw':_0x2d3cdf[_0xaf97('0x19')]?_0x2d3cdf[_0xaf97('0x19')][_0xaf97('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d3cdf['options']?_0x2d3cdf[_0xaf97('0x19')][_0xaf97('0x1b')]||null:null,'attributes':_0x2d3cdf[_0xaf97('0x19')]?_0x2d3cdf['options'][_0xaf97('0x1c')]||null:null,'limit':_0x2d3cdf['options']?_0x2d3cdf['options'][_0xaf97('0x1d')]||null:null,'include':_0x2d3cdf['options']?_0x2d3cdf['options']['include']?_[_0xaf97('0x1e')](_0x2d3cdf[_0xaf97('0x19')]['include'],function(_0x4f6303){return{'model':db[_0x4f6303['model']],'as':_0x4f6303['as'],'attributes':_0x4f6303[_0xaf97('0x1c')],'include':_0x4f6303[_0xaf97('0x1f')]?_[_0xaf97('0x1e')](_0x4f6303['include'],function(_0x2e2c89){return{'model':db[_0x2e2c89[_0xaf97('0x20')]],'as':_0x2e2c89['as'],'attributes':_0x2e2c89[_0xaf97('0x1c')],'include':_0x2e2c89[_0xaf97('0x1f')]?_['map'](_0x2e2c89[_0xaf97('0x1f')],function(_0x5acc67){return{'model':db[_0x5acc67[_0xaf97('0x20')]],'as':_0x5acc67['as'],'attributes':_0x5acc67[_0xaf97('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaf97('0xc')](function(_0x5cc815){logger[_0xaf97('0xd')](_0xaf97('0x16'),_0x2d3cdf);logger[_0xaf97('0x10')](_0xaf97('0x16'),_0x2d3cdf,JSON[_0xaf97('0x11')](_0x5cc815));_0x5dbe8f(_0x5cc815);})[_0xaf97('0x15')](function(_0x5f0126){logger[_0xaf97('0x12')]('GetTrigger',_0x5f0126[_0xaf97('0x14')],_0x2d3cdf);_0x54af41(_0x213856[_0xaf97('0x12')](0x1f4,_0x5f0126['message']));});});};exports['ShowTrigger']=function(_0x51b61d){var _0x1e9785=this;return new Promise(function(_0x2dbebc,_0x279475){return db[_0xaf97('0x17')][_0xaf97('0x21')]({'raw':_0x51b61d[_0xaf97('0x19')]?_0x51b61d[_0xaf97('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x51b61d[_0xaf97('0x19')]?_0x51b61d[_0xaf97('0x19')][_0xaf97('0x1b')]||null:null,'attributes':_0x51b61d['options']?_0x51b61d[_0xaf97('0x19')][_0xaf97('0x1c')]||null:null,'include':_0x51b61d[_0xaf97('0x19')]?_0x51b61d['options'][_0xaf97('0x1f')]?_[_0xaf97('0x1e')](_0x51b61d[_0xaf97('0x19')][_0xaf97('0x1f')],function(_0x7bbaac){return{'model':db[_0x7bbaac[_0xaf97('0x20')]],'as':_0x7bbaac['as'],'attributes':_0x7bbaac[_0xaf97('0x1c')],'include':_0x7bbaac[_0xaf97('0x1f')]?_[_0xaf97('0x1e')](_0x7bbaac[_0xaf97('0x1f')],function(_0x45bbce){return{'model':db[_0x45bbce[_0xaf97('0x20')]],'as':_0x45bbce['as'],'attributes':_0x45bbce['attributes'],'include':_0x45bbce[_0xaf97('0x1f')]?_['map'](_0x45bbce['include'],function(_0x191c63){return{'model':db[_0x191c63[_0xaf97('0x20')]],'as':_0x191c63['as'],'attributes':_0x191c63[_0xaf97('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaf97('0xc')](function(_0xaca13){logger[_0xaf97('0xd')]('ShowTrigger',_0x51b61d);logger[_0xaf97('0x10')](_0xaf97('0x22'),_0x51b61d,JSON['stringify'](_0xaca13));_0x2dbebc(_0xaca13);})[_0xaf97('0x15')](function(_0x85d6dc){logger['error'](_0xaf97('0x22'),_0x85d6dc[_0xaf97('0x14')],_0x51b61d);_0x279475(_0x1e9785[_0xaf97('0x12')](0x1f4,_0x85d6dc[_0xaf97('0x14')]));});});}; \ No newline at end of file +var _0xc1eb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','debug','ShowTrigger','find','raw','lodash','moment'];(function(_0x512868,_0x5843b3){var _0x168a6e=function(_0x2498a0){while(--_0x2498a0){_0x512868['push'](_0x512868['shift']());}};_0x168a6e(++_0x5843b3);}(_0xc1eb,0xfa));var _0xbc1e=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xc1eb[_0x29d915];return _0x160f86;};'use strict';var _=require(_0xbc1e('0x0'));var util=require('util');var moment=require(_0xbc1e('0x1'));var BPromise=require(_0xbc1e('0x2'));var rs=require(_0xbc1e('0x3'));var fs=require('fs');var Redis=require(_0xbc1e('0x4'));var db=require(_0xbc1e('0x5'))['db'];var utils=require(_0xbc1e('0x6'));var logger=require('../../config/logger')(_0xbc1e('0x7'));var config=require(_0xbc1e('0x8'));var jayson=require(_0xbc1e('0x9'));var client=jayson[_0xbc1e('0xa')][_0xbc1e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x518873,_0x6b000c,_0x1f00bc){return new BPromise(function(_0x438ef9,_0x20531a){return client['request'](_0x518873,_0x1f00bc)[_0xbc1e('0xc')](function(_0x40f579){logger[_0xbc1e('0xd')](_0xbc1e('0xe'),_0x6b000c,_0xbc1e('0xf'));logger['debug'](_0xbc1e('0x10'),_0x6b000c,'request\x20sent',JSON[_0xbc1e('0x11')](_0x40f579));if(_0x40f579[_0xbc1e('0x12')]){if(_0x40f579[_0xbc1e('0x12')][_0xbc1e('0x13')]===0x1f4){logger[_0xbc1e('0x12')](_0xbc1e('0xe'),_0x6b000c,_0x40f579['error']['message']);return _0x20531a(_0x40f579['error'][_0xbc1e('0x14')]);}logger[_0xbc1e('0x12')]('Trigger,\x20%s,\x20%s',_0x6b000c,_0x40f579[_0xbc1e('0x12')][_0xbc1e('0x14')]);return _0x438ef9(_0x40f579[_0xbc1e('0x12')]['message']);}else{logger[_0xbc1e('0xd')](_0xbc1e('0xe'),_0x6b000c,_0xbc1e('0xf'));_0x438ef9(_0x40f579['result'][_0xbc1e('0x14')]);}})[_0xbc1e('0x15')](function(_0x3aad20){logger[_0xbc1e('0x12')](_0xbc1e('0xe'),_0x6b000c,_0x3aad20);_0x20531a(_0x3aad20);});});}exports[_0xbc1e('0x16')]=function(_0x3102fb){var _0x55e7e7=this;return new Promise(function(_0x3ca20e,_0x2fc951){return db[_0xbc1e('0x17')][_0xbc1e('0x18')]({'raw':_0x3102fb['options']?_0x3102fb['options']['raw']===undefined?!![]:![]:!![],'where':_0x3102fb[_0xbc1e('0x19')]?_0x3102fb[_0xbc1e('0x19')][_0xbc1e('0x1a')]||null:null,'attributes':_0x3102fb[_0xbc1e('0x19')]?_0x3102fb[_0xbc1e('0x19')][_0xbc1e('0x1b')]||null:null,'limit':_0x3102fb[_0xbc1e('0x19')]?_0x3102fb[_0xbc1e('0x19')][_0xbc1e('0x1c')]||null:null,'include':_0x3102fb[_0xbc1e('0x19')]?_0x3102fb[_0xbc1e('0x19')][_0xbc1e('0x1d')]?_['map'](_0x3102fb[_0xbc1e('0x19')][_0xbc1e('0x1d')],function(_0x3b74c0){return{'model':db[_0x3b74c0['model']],'as':_0x3b74c0['as'],'attributes':_0x3b74c0[_0xbc1e('0x1b')],'include':_0x3b74c0[_0xbc1e('0x1d')]?_[_0xbc1e('0x1e')](_0x3b74c0['include'],function(_0x5dede2){return{'model':db[_0x5dede2[_0xbc1e('0x1f')]],'as':_0x5dede2['as'],'attributes':_0x5dede2['attributes'],'include':_0x5dede2[_0xbc1e('0x1d')]?_[_0xbc1e('0x1e')](_0x5dede2[_0xbc1e('0x1d')],function(_0xf88087){return{'model':db[_0xf88087[_0xbc1e('0x1f')]],'as':_0xf88087['as'],'attributes':_0xf88087['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3355dd){logger['info'](_0xbc1e('0x16'),_0x3102fb);logger[_0xbc1e('0x20')](_0xbc1e('0x16'),_0x3102fb,JSON[_0xbc1e('0x11')](_0x3355dd));_0x3ca20e(_0x3355dd);})[_0xbc1e('0x15')](function(_0x17f725){logger['error'](_0xbc1e('0x16'),_0x17f725[_0xbc1e('0x14')],_0x3102fb);_0x2fc951(_0x55e7e7[_0xbc1e('0x12')](0x1f4,_0x17f725[_0xbc1e('0x14')]));});});};exports[_0xbc1e('0x21')]=function(_0xd02ebc){var _0x1063ca=this;return new Promise(function(_0x429e60,_0x41af4e){return db[_0xbc1e('0x17')][_0xbc1e('0x22')]({'raw':_0xd02ebc[_0xbc1e('0x19')]?_0xd02ebc[_0xbc1e('0x19')][_0xbc1e('0x23')]===undefined?!![]:![]:!![],'where':_0xd02ebc[_0xbc1e('0x19')]?_0xd02ebc[_0xbc1e('0x19')][_0xbc1e('0x1a')]||null:null,'attributes':_0xd02ebc[_0xbc1e('0x19')]?_0xd02ebc[_0xbc1e('0x19')][_0xbc1e('0x1b')]||null:null,'include':_0xd02ebc[_0xbc1e('0x19')]?_0xd02ebc['options']['include']?_[_0xbc1e('0x1e')](_0xd02ebc[_0xbc1e('0x19')]['include'],function(_0x20f443){return{'model':db[_0x20f443['model']],'as':_0x20f443['as'],'attributes':_0x20f443[_0xbc1e('0x1b')],'include':_0x20f443[_0xbc1e('0x1d')]?_[_0xbc1e('0x1e')](_0x20f443['include'],function(_0x1ed997){return{'model':db[_0x1ed997[_0xbc1e('0x1f')]],'as':_0x1ed997['as'],'attributes':_0x1ed997[_0xbc1e('0x1b')],'include':_0x1ed997[_0xbc1e('0x1d')]?_['map'](_0x1ed997[_0xbc1e('0x1d')],function(_0x401522){return{'model':db[_0x401522[_0xbc1e('0x1f')]],'as':_0x401522['as'],'attributes':_0x401522[_0xbc1e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbc1e('0xc')](function(_0xc1b623){logger[_0xbc1e('0xd')](_0xbc1e('0x21'),_0xd02ebc);logger['debug'](_0xbc1e('0x21'),_0xd02ebc,JSON[_0xbc1e('0x11')](_0xc1b623));_0x429e60(_0xc1b623);})[_0xbc1e('0x15')](function(_0x52013b){logger[_0xbc1e('0x12')]('ShowTrigger',_0x52013b[_0xbc1e('0x14')],_0xd02ebc);_0x41af4e(_0x1063ca['error'](0x1f4,_0x52013b[_0xbc1e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 379bdcc..62d35f1 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 _0xcf28=['../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','clone','create','put','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xcf28,0xb8));var _0x8cf2=function(_0x46d78a,_0x4946ae){_0x46d78a=_0x46d78a-0x0;var _0x129243=_0xcf28[_0x46d78a];return _0x129243;};'use strict';var multer=require('multer');var util=require(_0x8cf2('0x0'));var path=require('path');var timeout=require(_0x8cf2('0x1'));var express=require(_0x8cf2('0x2'));var router=express['Router']();var fs_extra=require(_0x8cf2('0x3'));var auth=require(_0x8cf2('0x4'));var interaction=require(_0x8cf2('0x5'));var config=require(_0x8cf2('0x6'));var controller=require(_0x8cf2('0x7'));router[_0x8cf2('0x8')]('/',auth[_0x8cf2('0x9')](),controller[_0x8cf2('0xa')]);router['get'](_0x8cf2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8cf2('0xc')]('/:id/clone',auth[_0x8cf2('0x9')](),controller[_0x8cf2('0xd')]);router[_0x8cf2('0xc')]('/',auth[_0x8cf2('0x9')](),controller[_0x8cf2('0xe')]);router[_0x8cf2('0xf')](_0x8cf2('0xb'),auth[_0x8cf2('0x9')](),controller[_0x8cf2('0x10')]);router[_0x8cf2('0x11')](_0x8cf2('0xb'),auth[_0x8cf2('0x9')](),controller[_0x8cf2('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4ef6=['delete','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone','clone','put','update'];(function(_0x504100,_0x4db59a){var _0x50755a=function(_0x4366a6){while(--_0x4366a6){_0x504100['push'](_0x504100['shift']());}};_0x50755a(++_0x4db59a);}(_0x4ef6,0x158));var _0x64ef=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0x4ef6[_0x50e40b];return _0x2608b7;};'use strict';var multer=require(_0x64ef('0x0'));var util=require(_0x64ef('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x64ef('0x2'));var router=express[_0x64ef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x64ef('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x64ef('0x5'));var controller=require(_0x64ef('0x6'));router[_0x64ef('0x7')]('/',auth[_0x64ef('0x8')](),controller[_0x64ef('0x9')]);router['get']('/:id',auth[_0x64ef('0x8')](),controller[_0x64ef('0xa')]);router[_0x64ef('0xb')](_0x64ef('0xc'),auth[_0x64ef('0x8')](),controller[_0x64ef('0xd')]);router['post']('/',auth[_0x64ef('0x8')](),controller['create']);router[_0x64ef('0xe')]('/:id',auth[_0x64ef('0x8')](),controller[_0x64ef('0xf')]);router[_0x64ef('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x64ef('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 6772a35..63bd109 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 _0x3528=['from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','rfc2833','yes','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','dynamic','nonat','update,nonat','sequelize','exports','STRING','friend','user','peer'];(function(_0x4ab5cb,_0x392d2f){var _0x5867f2=function(_0x2315ae){while(--_0x2315ae){_0x4ab5cb['push'](_0x4ab5cb['shift']());}};_0x5867f2(++_0x392d2f);}(_0x3528,0x11a));var _0x8352=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3528[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8352('0x0'));module[_0x8352('0x1')]={'name':{'type':Sequelize[_0x8352('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x8352('0x3'),_0x8352('0x4'),_0x8352('0x5')),'allowNull':![],'defaultValue':_0x8352('0x3')},'context':{'type':Sequelize[_0x8352('0x2')],'allowNull':![],'defaultValue':_0x8352('0x6')},'callingpres':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x8'),_0x8352('0x9'),_0x8352('0xa'),'ALLOWED',_0x8352('0xb'),_0x8352('0xc'),_0x8352('0xd'),_0x8352('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x8352('0x2')]},'md5secret':{'type':Sequelize[_0x8352('0x2')]},'remotesecret':{'type':Sequelize[_0x8352('0x2')]},'transport':{'type':Sequelize[_0x8352('0x2')],'defaultValue':'udp','set':function(_0x1e4a3a){this[_0x8352('0xf')](_0x8352('0x10'),_0x1e4a3a?_0x1e4a3a[_0x8352('0x11')](','):null);},'get':function(){return this[_0x8352('0x12')](_0x8352('0x10'))?this[_0x8352('0x12')](_0x8352('0x10'))[_0x8352('0x13')](','):null;},'comment':_0x8352('0x14')},'dtmfmode':{'type':Sequelize[_0x8352('0x7')]('rfc2833','info',_0x8352('0x15'),'inband','auto'),'defaultValue':_0x8352('0x16')},'directmedia':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x17'),'no','nonat',_0x8352('0x18'),_0x8352('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x8352('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8352('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x8352('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x4682cc){this[_0x8352('0xf')]('nat',_0x4682cc?_0x4682cc[_0x8352('0x11')](','):null);},'get':function(){return this[_0x8352('0x12')](_0x8352('0x1a'))?this[_0x8352('0x12')](_0x8352('0x1a'))[_0x8352('0x13')](','):null;},'comment':_0x8352('0x1b')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x8352('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x8352('0x2')]},'language':{'type':Sequelize[_0x8352('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8352('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8352('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x8352('0x2')],'allowNull':![],'defaultValue':_0x8352('0x1c'),'set':function(_0x1e4fa2){this['setDataValue'](_0x8352('0x1d'),_0x1e4fa2?_0x1e4fa2['join'](';'):_0x8352('0x1c'));},'get':function(){return this[_0x8352('0x12')](_0x8352('0x1d'))?this[_0x8352('0x12')](_0x8352('0x1d'))['split'](';'):null;},'comment':_0x8352('0x1e')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x8352('0x2')],'defaultValue':'port,invite','set':function(_0x2b5b9c){this['setDataValue']('insecure',_0x2b5b9c?_0x2b5b9c[_0x8352('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x8352('0x1f'))?this[_0x8352('0x12')](_0x8352('0x1f'))[_0x8352('0x13')](','):null;},'comment':_0x8352('0x20')},'trustrpid':{'type':Sequelize['ENUM'](_0x8352('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8352('0x7')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x17'),'no',_0x8352('0x21'))},'promiscredir':{'type':Sequelize[_0x8352('0x7')]('yes','no')},'useclientcode':{'type':Sequelize[_0x8352('0x7')]('yes','no')},'accountcode':{'type':Sequelize[_0x8352('0x22')](0xb)},'setvar':{'type':Sequelize[_0x8352('0x2')]},'callerid':{'type':Sequelize[_0x8352('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x8352('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x8352('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x8352('0x7')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x17'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x8352('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x8352('0x17'),'no',_0x8352('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8352('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8352('0x7')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x24'),_0x8352('0x25'),_0x8352('0x26'))},'session_expires':{'type':Sequelize[_0x8352('0x22')](0xb)},'session_minse':{'type':Sequelize[_0x8352('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x27'),'uas'),'defaultValue':_0x8352('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x8352('0x2')]},'regexten':{'type':Sequelize[_0x8352('0x2')]},'fromdomain':{'type':Sequelize[_0x8352('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x8352('0x22')](0x5)},'qualify':{'type':Sequelize[_0x8352('0x7')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x8352('0x2')]},'defaultuser':{'type':Sequelize[_0x8352('0x2')]},'rtptimeout':{'type':Sequelize[_0x8352('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8352('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8352('0x22')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x8352('0x17'),'no',_0x8352('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8352('0x2')]},'callbackextension':{'type':Sequelize[_0x8352('0x2')]},'timert1':{'type':Sequelize[_0x8352('0x22')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x8352('0x22')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x8352('0x2')]},'contactacl':{'type':Sequelize[_0x8352('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x8352('0x2')]},'use_q850_reason':{'type':Sequelize[_0x8352('0x2')]},'maxforwards':{'type':Sequelize[_0x8352('0x22')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x8352('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8352('0x7')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x8352('0x17'),'no')},'icesupport':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x8352('0x7')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x17'),'no',_0x8352('0x2a'),_0x8352('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x8352('0x22')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x8352('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x8352('0x2')]},'dtlscapath':{'type':Sequelize[_0x8352('0x2')]},'dtlssetup':{'type':Sequelize[_0x8352('0x7')]('active',_0x8352('0x2c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8352('0x2')]},'usereqphone':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8352('0x2')]},'recordofffeature':{'type':Sequelize[_0x8352('0x2')]},'call_limit':{'type':Sequelize[_0x8352('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x8352('0x2')]},'mohinterpret':{'type':Sequelize[_0x8352('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x8352('0x2')],'defaultValue':_0x8352('0x2d')},'canreinvite':{'type':Sequelize[_0x8352('0x7')](_0x8352('0x17'),'no',_0x8352('0x2e'),_0x8352('0x18'),_0x8352('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8352('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8352('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xdddb=['uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','exports','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','STRING','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','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]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','refuse','originate','uac'];(function(_0x3efdd8,_0x3728e3){var _0x395759=function(_0x4adae5){while(--_0x4adae5){_0x3efdd8['push'](_0x3efdd8['shift']());}};_0x395759(++_0x3728e3);}(_0xdddb,0x1a1));var _0xbddd=function(_0x4a1677,_0x9ece17){_0x4a1677=_0x4a1677-0x0;var _0x968a00=_0xdddb[_0x4a1677];return _0x968a00;};'use strict';var Sequelize=require('sequelize');module[_0xbddd('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbddd('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xbddd('0x2'),_0xbddd('0x3'),_0xbddd('0x4')),'allowNull':![],'defaultValue':_0xbddd('0x2')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbddd('0x5')},'callingpres':{'type':Sequelize[_0xbddd('0x6')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0xbddd('0x7'),_0xbddd('0x8'),_0xbddd('0x9'),_0xbddd('0xa'),_0xbddd('0xb'),_0xbddd('0xc'))},'deny':{'type':Sequelize[_0xbddd('0xd')]},'permit':{'type':Sequelize[_0xbddd('0xd')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xbddd('0xd')]},'transport':{'type':Sequelize[_0xbddd('0xd')],'defaultValue':_0xbddd('0xe'),'set':function(_0x320e64){this[_0xbddd('0xf')](_0xbddd('0x10'),_0x320e64?_0x320e64[_0xbddd('0x11')](','):null);},'get':function(){return this[_0xbddd('0x12')](_0xbddd('0x10'))?this[_0xbddd('0x12')](_0xbddd('0x10'))['split'](','):null;},'comment':_0xbddd('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0xbddd('0x14'),_0xbddd('0x15'),_0xbddd('0x16'),_0xbddd('0x17'),_0xbddd('0x18')),'defaultValue':_0xbddd('0x14')},'directmedia':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no',_0xbddd('0x1a'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xbddd('0xd')]},'directmediadeny':{'type':Sequelize[_0xbddd('0xd')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xbddd('0x1b'),'set':function(_0x4df065){this[_0xbddd('0xf')](_0xbddd('0x1c'),_0x4df065?_0x4df065[_0xbddd('0x11')](','):null);},'get':function(){return this[_0xbddd('0x12')](_0xbddd('0x1c'))?this[_0xbddd('0x12')](_0xbddd('0x1c'))[_0xbddd('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xbddd('0xd')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xbddd('0xd')]},'namedpickupgroup':{'type':Sequelize[_0xbddd('0xd')]},'language':{'type':Sequelize[_0xbddd('0xd')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xbddd('0xd')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xbddd('0xd')],'defaultValue':_0xbddd('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x12653a){this['setDataValue']('allow',_0x12653a?_0x12653a[_0xbddd('0x11')](';'):_0xbddd('0x1f'));},'get':function(){return this[_0xbddd('0x12')](_0xbddd('0x20'))?this[_0xbddd('0x12')](_0xbddd('0x20'))[_0xbddd('0x1d')](';'):null;},'comment':_0xbddd('0x21')},'autoframing':{'type':Sequelize[_0xbddd('0x6')]('yes','no')},'insecure':{'type':Sequelize[_0xbddd('0xd')],'defaultValue':'port,invite','set':function(_0x1784cf){this[_0xbddd('0xf')](_0xbddd('0x22'),_0x1784cf?_0x1784cf[_0xbddd('0x11')](','):null);},'get':function(){return this[_0xbddd('0x12')]('insecure')?this[_0xbddd('0x12')](_0xbddd('0x22'))[_0xbddd('0x1d')](','):null;},'comment':_0xbddd('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0xbddd('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xbddd('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no',_0xbddd('0x24'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xbddd('0xd')]},'callerid':{'type':Sequelize[_0xbddd('0xd')],'defaultValue':_0xbddd('0x25')},'amaflags':{'type':Sequelize[_0xbddd('0xd')]},'callcounter':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no'),'defaultValue':_0xbddd('0x19')},'busylevel':{'type':Sequelize[_0xbddd('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xbddd('0x6')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xbddd('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xbddd('0x6')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xbddd('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xbddd('0xd')]},'template':{'type':Sequelize[_0xbddd('0xd')]},'videosupport':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no')},'mailbox':{'type':Sequelize[_0xbddd('0xd')]},'session_timers':{'type':Sequelize[_0xbddd('0x6')]('accept',_0xbddd('0x27'),_0xbddd('0x28'))},'session_expires':{'type':Sequelize[_0xbddd('0x26')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x29'),_0xbddd('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xbddd('0xd')]},'regexten':{'type':Sequelize[_0xbddd('0xd')]},'fromdomain':{'type':Sequelize[_0xbddd('0xd')]},'fromuser':{'type':Sequelize[_0xbddd('0xd')]},'port':{'type':Sequelize[_0xbddd('0x26')](0x5)},'qualify':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no'),'defaultValue':_0xbddd('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xbddd('0xd')]},'defaultuser':{'type':Sequelize[_0xbddd('0xd')]},'rtptimeout':{'type':Sequelize[_0xbddd('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xbddd('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xbddd('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no',_0xbddd('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xbddd('0xd')]},'timert1':{'type':Sequelize[_0xbddd('0x26')](0xb)},'timerb':{'type':Sequelize[_0xbddd('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xbddd('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xbddd('0xd')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xbddd('0x6')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no')},'force_avp':{'type':Sequelize[_0xbddd('0x6')]('yes','no')},'icesupport':{'type':Sequelize[_0xbddd('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xbddd('0x2c'),_0xbddd('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xbddd('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xbddd('0xd')]},'dtlsprivatekey':{'type':Sequelize[_0xbddd('0xd')]},'dtlscipher':{'type':Sequelize[_0xbddd('0xd')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xbddd('0xd')]},'dtlssetup':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x2e'),_0xbddd('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xbddd('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xbddd('0xd')]},'call_limit':{'type':Sequelize[_0xbddd('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no')},'vmexten':{'type':Sequelize[_0xbddd('0xd')]},'mohinterpret':{'type':Sequelize[_0xbddd('0xd')]},'mohsuggest':{'type':Sequelize[_0xbddd('0xd')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbddd('0xd')]},'host':{'type':Sequelize[_0xbddd('0xd')],'defaultValue':_0xbddd('0x30')},'canreinvite':{'type':Sequelize[_0xbddd('0x6')](_0xbddd('0x19'),'no',_0xbddd('0x1a'),'update',_0xbddd('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xbddd('0xd')]},'otherFields':{'type':Sequelize[_0xbddd('0xd')]},'active':{'type':Sequelize[_0xbddd('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xbddd('0xd')],'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 a25b0fa..0e6a443 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 _0xf3cd=['length','limit','sort','where','filter','merge','options','Trunk','includeAll','include','findAll','show','find','clone','createdAt','updatedAt','omit','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','offset','count','json','reject','save','update','get','UserProfileResource','destroy','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x492ff0,_0x3bc2a1){var _0x5d95ef=function(_0x5677e7){while(--_0x5677e7){_0x492ff0['push'](_0x492ff0['shift']());}};_0x5d95ef(++_0x3bc2a1);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3b1e3f,_0xf8826b){_0x3b1e3f=_0x3b1e3f-0x0;var _0x3b1cd3=_0xf3cd[_0x3b1e3f];return _0x3b1cd3;};'use strict';var emlformat=require(_0xdf3c('0x0'));var rimraf=require(_0xdf3c('0x1'));var zipdir=require(_0xdf3c('0x2'));var jsonpatch=require(_0xdf3c('0x3'));var rp=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf3c('0x6'));var util=require(_0xdf3c('0x7'));var path=require(_0xdf3c('0x8'));var sox=require('sox');var csv=require(_0xdf3c('0x9'));var ejs=require(_0xdf3c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf3c('0xb'));var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdf3c('0x1a'));var client=jayson[_0xdf3c('0x1b')][_0xdf3c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17319c,_0x59e431,_0x2ae4ad,_0x461079){return new BPromise(function(_0x13ea5f,_0x5e0047){var _0x18aafa=_0x461079||client;return _0x18aafa[_0xdf3c('0x1d')](_0x17319c,_0x2ae4ad)[_0xdf3c('0x1e')](function(_0x4274fd){logger[_0xdf3c('0x1f')](_0xdf3c('0x20'),_0x59e431,_0xdf3c('0x21'));logger[_0xdf3c('0x22')](_0xdf3c('0x23'),_0x59e431,_0xdf3c('0x21'),JSON['stringify'](_0x4274fd));if(_0x4274fd[_0xdf3c('0x24')]){if(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x25')]===0x1f4){logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x5e0047(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);}logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x13ea5f(_0x4274fd['error']['message']);}else{logger[_0xdf3c('0x1f')]('Trunk,\x20%s,\x20%s',_0x59e431,_0xdf3c('0x21'));_0x13ea5f(_0x4274fd[_0xdf3c('0x27')][_0xdf3c('0x26')]);}})[_0xdf3c('0x28')](function(_0x33652f){logger[_0xdf3c('0x24')]('Trunk,\x20%s,\x20%s',_0x59e431,_0x33652f);_0x5e0047(_0x33652f);});});}function respondWithStatusCode(_0x22a164,_0x213d75){_0x213d75=_0x213d75||0xcc;return function(_0x13e3ca){if(_0x13e3ca){return _0x22a164[_0xdf3c('0x29')](_0x213d75);}return _0x22a164[_0xdf3c('0x2a')](_0x213d75)[_0xdf3c('0x2b')]();};}function respondWithResult(_0xef54cb,_0x155f54){_0x155f54=_0x155f54||0xc8;return function(_0x18cb46){if(_0x18cb46){return _0xef54cb[_0xdf3c('0x2a')](_0x155f54)['json'](_0x18cb46);}};}function respondWithFilteredResult(_0xd284d7,_0x153daa){return function(_0x4b57a4){if(_0x4b57a4){var _0xdc8962=typeof _0x153daa['offset']==='undefined'&&typeof _0x153daa['limit']===_0xdf3c('0x2c');var _0x186bba=_0x4b57a4['count'];var _0x5c3b5a=_0xdc8962?0x0:_0x153daa[_0xdf3c('0x2d')];var _0x1f2ce4=_0xdc8962?_0x4b57a4[_0xdf3c('0x2e')]:_0x153daa[_0xdf3c('0x2d')]+_0x153daa['limit'];var _0x43ce06;if(_0x1f2ce4>=_0x186bba){_0x1f2ce4=_0x186bba;_0x43ce06=0xc8;}else{_0x43ce06=0xce;}_0xd284d7[_0xdf3c('0x2a')](_0x43ce06);return _0xd284d7['set']('Content-Range',_0x5c3b5a+'-'+_0x1f2ce4+'/'+_0x186bba)[_0xdf3c('0x2f')](_0x4b57a4);}return null;};}function patchUpdates(_0x46f0e3){return function(_0x36937e){try{jsonpatch['apply'](_0x36937e,_0x46f0e3,!![]);}catch(_0x2355f6){return BPromise[_0xdf3c('0x30')](_0x2355f6);}return _0x36937e[_0xdf3c('0x31')]();};}function saveUpdates(_0x10099e,_0x575ae1){return function(_0xda0de0){if(_0xda0de0){return _0xda0de0[_0xdf3c('0x32')](_0x10099e)['then'](function(_0x40ae3d){return _0x40ae3d;});}return null;};}function removeEntity(_0x3daeda,_0x217a65){return function(_0x2287f){if(_0x2287f){return _0x2287f['destroy']()[_0xdf3c('0x1e')](function(){var _0x360d5c=_0x2287f[_0xdf3c('0x33')]({'plain':!![]});var _0x3b9ce8='Trunks';return db[_0xdf3c('0x34')][_0xdf3c('0x35')]({'where':{'type':_0x3b9ce8,'resourceId':_0x360d5c['id']}})['then'](function(){return _0x2287f;});})['then'](function(){_0x3daeda[_0xdf3c('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216115,_0x5e8130){return function(_0x57faba){if(!_0x57faba){_0x216115['sendStatus'](0x194);}return _0x57faba;};}function handleError(_0x44a478,_0x2ee9ad){_0x2ee9ad=_0x2ee9ad||0x1f4;return function(_0x1d0b8a){logger[_0xdf3c('0x24')](_0x1d0b8a['stack']);if(_0x1d0b8a['name']){delete _0x1d0b8a[_0xdf3c('0x36')];}_0x44a478['status'](_0x2ee9ad)[_0xdf3c('0x37')](_0x1d0b8a);};}exports[_0xdf3c('0x38')]=function(_0x3628ae,_0xcdd731){var _0x1004e9={},_0x1e0cf2={},_0x1c7335={'count':0x0,'rows':[]};var _0x809f3d=_[_0xdf3c('0x39')](db['Trunk'][_0xdf3c('0x3a')],function(_0x54e689){return{'name':_0x54e689['fieldName'],'type':_0x54e689[_0xdf3c('0x3b')]['key']};});_0x1e0cf2[_0xdf3c('0x3c')]=_['map'](_0x809f3d,_0xdf3c('0x36'));_0x1e0cf2[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x3628ae[_0xdf3c('0x3d')]);_0x1e0cf2[_0xdf3c('0x3f')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],_0x1e0cf2[_0xdf3c('0x3d')]);_0x1004e9[_0xdf3c('0x41')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x3628ae['query']['fields']));_0x1004e9[_0xdf3c('0x41')]=_0x1004e9['attributes'][_0xdf3c('0x43')]?_0x1004e9[_0xdf3c('0x41')]:_0x1e0cf2[_0xdf3c('0x3c')];if(!_0x3628ae[_0xdf3c('0x3d')]['hasOwnProperty']('nolimit')){_0x1004e9[_0xdf3c('0x44')]=qs[_0xdf3c('0x44')](_0x3628ae[_0xdf3c('0x3d')]['limit']);_0x1004e9[_0xdf3c('0x2d')]=qs[_0xdf3c('0x2d')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x2d')]);}_0x1004e9['order']=qs[_0xdf3c('0x45')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x45')]);_0x1004e9[_0xdf3c('0x46')]=qs[_0xdf3c('0x3f')](_['pick'](_0x3628ae[_0xdf3c('0x3d')],_0x1e0cf2[_0xdf3c('0x3f')]),_0x809f3d);if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]){_0x1004e9[_0xdf3c('0x46')]=_[_0xdf3c('0x48')](_0x1004e9['where'],{'$or':_['map'](_0x809f3d,function(_0x2c6c6d){if(_0x2c6c6d[_0xdf3c('0x3b')]!=='VIRTUAL'){var _0x5c9885={};_0x5c9885[_0x2c6c6d[_0xdf3c('0x36')]]={'$like':'%'+_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]+'%'};return _0x5c9885;}})});}_0x1004e9=_[_0xdf3c('0x48')]({},_0x1004e9,_0x3628ae[_0xdf3c('0x49')]);var _0x2dbf54={'where':_0x1004e9[_0xdf3c('0x46')]};return db[_0xdf3c('0x4a')][_0xdf3c('0x2e')](_0x2dbf54)['then'](function(_0x129c2a){_0x1c7335[_0xdf3c('0x2e')]=_0x129c2a;if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x1004e9[_0xdf3c('0x4c')]=[{'all':!![]}];}return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')](_0x1004e9);})['then'](function(_0x1751a8){_0x1c7335['rows']=_0x1751a8;return _0x1c7335;})[_0xdf3c('0x1e')](respondWithFilteredResult(_0xcdd731,_0x1004e9))['catch'](handleError(_0xcdd731,null));};exports[_0xdf3c('0x4e')]=function(_0x28144f,_0x2ec575){var _0x94c5b9={'raw':![],'where':{'id':_0x28144f['params']['id']}},_0x5eef94={};_0x5eef94['model']=_[_0xdf3c('0x3e')](db['Trunk'][_0xdf3c('0x3a')]);_0x5eef94[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x28144f[_0xdf3c('0x3d')]);_0x5eef94[_0xdf3c('0x3f')]=_['intersection'](_0x5eef94['model'],_0x5eef94[_0xdf3c('0x3d')]);_0x94c5b9[_0xdf3c('0x41')]=_['intersection'](_0x5eef94[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x94c5b9[_0xdf3c('0x41')]=_0x94c5b9[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x94c5b9['attributes']:_0x5eef94['model'];if(_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x94c5b9[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x94c5b9=_[_0xdf3c('0x48')]({},_0x94c5b9,_0x28144f[_0xdf3c('0x49')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x94c5b9)[_0xdf3c('0x1e')](handleEntityNotFound(_0x2ec575,null))[_0xdf3c('0x1e')](respondWithResult(_0x2ec575,null))[_0xdf3c('0x28')](handleError(_0x2ec575,null));};exports[_0xdf3c('0x50')]=function(_0x4cb28f,_0x1eebcf){var _0x47cb74={'where':{'id':_0x4cb28f['params']['id']}},_0x5e7247={};_0x5e7247['model']=_['keys'](db[_0xdf3c('0x4a')][_0xdf3c('0x3a')]);_0x47cb74['attributes']=_[_0xdf3c('0x40')](_0x5e7247[_0xdf3c('0x3c')],qs['fields'](_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x47cb74[_0xdf3c('0x41')]=_0x47cb74[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x47cb74[_0xdf3c('0x41')]:_0x5e7247[_0xdf3c('0x3c')];if(_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x47cb74[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x47cb74=_[_0xdf3c('0x48')]({},_0x47cb74,_0x4cb28f['options']);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x47cb74)[_0xdf3c('0x1e')](handleEntityNotFound(_0x1eebcf,null))['then'](function(_0x245c68){if(_0x245c68){var _0x3e327e=_0x245c68[_0xdf3c('0x33')]({'plain':!![]});_0x3e327e=qs['omit'](_0x3e327e,['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);_0x4cb28f['body']=_[_0xdf3c('0x53')](_0x4cb28f['body'],['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_[_0xdf3c('0x48')](_0x3e327e,_0x4cb28f[_0xdf3c('0x55')]),{'include':_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]?[{'all':!![]}]:undefined})[_0xdf3c('0x1e')](function(_0x330730){var _0x283be2=_0x4cb28f[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x283be2)throw new Error(_0xdf3c('0x57'));if(_0x283be2[_0xdf3c('0x58')]===_0xdf3c('0x56')){var _0xd7fb2d=_0x330730['get']({'plain':!![]});var _0x4dade5=_0xdf3c('0x59');return db[_0xdf3c('0x5a')][_0xdf3c('0x4f')]({'where':{'name':_0x4dade5,'userProfileId':_0x283be2['userProfileId']},'raw':!![]})[_0xdf3c('0x1e')](function(_0x5f2765){if(_0x5f2765&&_0x5f2765['autoAssociation']===0x0){return db[_0xdf3c('0x34')][_0xdf3c('0x54')]({'name':_0xd7fb2d[_0xdf3c('0x36')],'resourceId':_0xd7fb2d['id'],'type':_0x5f2765[_0xdf3c('0x36')],'sectionId':_0x5f2765['id']},{})[_0xdf3c('0x1e')](function(){return _0x330730;});}else{return _0x330730;}})[_0xdf3c('0x28')](function(_0x1a31d7){logger[_0xdf3c('0x24')](_0xdf3c('0x5b'),_0x1a31d7);throw _0x1a31d7;});}return _0x330730;});}})[_0xdf3c('0x1e')](respondWithResult(_0x1eebcf,0xc9))[_0xdf3c('0x28')](handleError(_0x1eebcf,null));};exports[_0xdf3c('0x54')]=function(_0x34000c,_0x4be79a,_0x3febac){var _0x2cb0f5;return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_0x34000c[_0xdf3c('0x55')],{'raw':!![]})['then'](function(_0x18bf4f){_0x2cb0f5=_0x18bf4f;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x1efa9c){var _0x50805c=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x5f')),'utf8');var _0xb867a1=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x19c851=ejs['render'](_0x50805c,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x19c851);if(_0x2cb0f5['registry']){var _0x52a2e1=ejs[_0xdf3c('0x64')](_0xb867a1,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x52a2e1);}})[_0xdf3c('0x1e')](function(){return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x54'),{'module':_0xdf3c('0x67')});})[_0xdf3c('0x1e')](function(){var _0x5e6606=_0x34000c[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x5e6606)throw new Error(_0xdf3c('0x57'));if(_0x5e6606['role']===_0xdf3c('0x56')){var _0x354ff4=_0x2cb0f5[_0xdf3c('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xdf3c('0x4f')]({'where':{'name':_0xdf3c('0x59'),'userProfileId':_0x5e6606[_0xdf3c('0x68')]},'raw':!![]})[_0xdf3c('0x1e')](function(_0xe01538){if(_0xe01538&&_0xe01538[_0xdf3c('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x354ff4['name'],'resourceId':_0x354ff4['id'],'type':_0xe01538['name'],'sectionId':_0xe01538['id']},{})['then'](function(){return _0x2cb0f5;});}else{return _0x2cb0f5;}})[_0xdf3c('0x28')](function(_0x3f43a0){logger[_0xdf3c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f43a0);throw _0x3f43a0;});}return _0x2cb0f5;})[_0xdf3c('0x1e')](respondWithResult(_0x4be79a,0xc9))[_0xdf3c('0x28')](handleError(_0x4be79a,null));};exports[_0xdf3c('0x32')]=function(_0x51e8c6,_0x591936,_0x233718){var _0x4e3517;return db[_0xdf3c('0x4a')]['find']({'where':{'id':_0x51e8c6[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x591936,null))[_0xdf3c('0x1e')](saveUpdates(_0x51e8c6[_0xdf3c('0x55')],null))['then'](function(_0x5148f6){if(_0x5148f6){_0x4e3517=_0x5148f6;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});}})[_0xdf3c('0x1e')](function(_0x12a7b0){if(_0x12a7b0){var _0x39d9f0=fs[_0xdf3c('0x5c')](path['join'](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x9c761a=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/registry.ejs'),_0xdf3c('0x61'));var _0x5c27cc=ejs[_0xdf3c('0x64')](_0x39d9f0,{'trunks':_0x12a7b0||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x5c27cc);var _0x53b0c3=ejs['render'](_0x9c761a,{'trunks':_0x12a7b0||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x53b0c3);return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x32'),{'module':_0xdf3c('0x67')});}return null;})[_0xdf3c('0x1e')](function(_0x5c8e5e){if(_0x5c8e5e){return _0x4e3517;}})[_0xdf3c('0x1e')](respondWithResult(_0x591936,null))['catch'](handleError(_0x591936,null));};exports[_0xdf3c('0x35')]=function(_0x389708,_0x2e5f82,_0x15a057){var _0x320452;return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')]({'where':{'id':_0x389708[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x2e5f82,null))[_0xdf3c('0x1e')](removeEntity(_0x2e5f82,null))[_0xdf3c('0x1e')](function(){return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x55fd73){var _0x118ab5=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x1c8fe4=fs['readFileSync'](path['join'](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x1aaf8b=ejs[_0xdf3c('0x64')](_0x118ab5,{'trunks':_0x55fd73});var _0x56fc77=ejs[_0xdf3c('0x64')](_0x1c8fe4,{'trunks':_0x55fd73});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x1aaf8b);fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x56fc77);return respondWithRpcPromise(_0xdf3c('0x66'),'destroy',{'module':_0xdf3c('0x67')});})[_0xdf3c('0x28')](handleError(_0x2e5f82,null));}; \ No newline at end of file +var _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x127005,_0x1a24e2){var _0x23dd1d=function(_0x1c8ad7){while(--_0x1c8ad7){_0x127005['push'](_0x127005['shift']());}};_0x23dd1d(++_0x1a24e2);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3936ee,_0x2bdb32){_0x3936ee=_0x3936ee-0x0;var _0x22f0c1=_0xd6d6[_0x3936ee];return _0x22f0c1;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 711ec77..cace8c8 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 _0xd8e1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trunk.attributes','exports','Trunk'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8e1,0xa8));var _0x1d8e=function(_0x2fc58b,_0x2920c){_0x2fc58b=_0x2fc58b-0x0;var _0x572c0d=_0xd8e1[_0x2fc58b];return _0x572c0d;};'use strict';var _=require(_0x1d8e('0x0'));var util=require(_0x1d8e('0x1'));var logger=require(_0x1d8e('0x2'))(_0x1d8e('0x3'));var moment=require(_0x1d8e('0x4'));var BPromise=require(_0x1d8e('0x5'));var rp=require(_0x1d8e('0x6'));var fs=require('fs');var path=require(_0x1d8e('0x7'));var rimraf=require('rimraf');var config=require(_0x1d8e('0x8'));var attributes=require(_0x1d8e('0x9'));module[_0x1d8e('0xa')]=function(_0x1a0c12,_0x522b97){return _0x1a0c12['define'](_0x1d8e('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde37=['tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Trunk'];(function(_0x2eadcb,_0xf6cdee){var _0x15f68a=function(_0x331234){while(--_0x331234){_0x2eadcb['push'](_0x2eadcb['shift']());}};_0x15f68a(++_0xf6cdee);}(_0xde37,0xf1));var _0x7de3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde37[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x7de3('0x0'));var logger=require(_0x7de3('0x1'))(_0x7de3('0x2'));var moment=require(_0x7de3('0x3'));var BPromise=require(_0x7de3('0x4'));var rp=require(_0x7de3('0x5'));var fs=require('fs');var path=require(_0x7de3('0x6'));var rimraf=require(_0x7de3('0x7'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0x7de3('0x8')]=function(_0x3427c6,_0x5baf0b){return _0x3427c6[_0x7de3('0x9')](_0x7de3('0xa'),attributes,{'tableName':_0x7de3('0xb'),'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 16b46f4..1156c87 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 _0x55f0=['stringify','error','Trunk,\x20%s,\x20%s','message','request\x20sent','result','Trunk','findAll','options','attributes','limit','include','map','model','catch','GetTrunk','ShowTrunk','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','debug'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x55f0,0x1f3));var _0x055f=function(_0x5018bd,_0x24b200){_0x5018bd=_0x5018bd-0x0;var _0x5cb7c7=_0x55f0[_0x5018bd];return _0x5cb7c7;};'use strict';var _=require(_0x055f('0x0'));var util=require(_0x055f('0x1'));var moment=require(_0x055f('0x2'));var BPromise=require(_0x055f('0x3'));var rs=require(_0x055f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x055f('0x6'));var config=require(_0x055f('0x7'));var jayson=require(_0x055f('0x8'));var client=jayson['client'][_0x055f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ae8b9,_0x280914,_0x5a87d6){return new BPromise(function(_0x3499bf,_0x3b7de9){return client['request'](_0x4ae8b9,_0x5a87d6)[_0x055f('0xa')](function(_0x4d86cc){logger[_0x055f('0xb')]('Trunk,\x20%s,\x20%s',_0x280914,'request\x20sent');logger[_0x055f('0xc')]('Trunk,\x20%s,\x20%s,\x20%s',_0x280914,'request\x20sent',JSON[_0x055f('0xd')](_0x4d86cc));if(_0x4d86cc[_0x055f('0xe')]){if(_0x4d86cc[_0x055f('0xe')]['code']===0x1f4){logger[_0x055f('0xe')](_0x055f('0xf'),_0x280914,_0x4d86cc['error'][_0x055f('0x10')]);return _0x3b7de9(_0x4d86cc[_0x055f('0xe')]['message']);}logger[_0x055f('0xe')](_0x055f('0xf'),_0x280914,_0x4d86cc[_0x055f('0xe')][_0x055f('0x10')]);return _0x3499bf(_0x4d86cc['error'][_0x055f('0x10')]);}else{logger[_0x055f('0xb')]('Trunk,\x20%s,\x20%s',_0x280914,_0x055f('0x11'));_0x3499bf(_0x4d86cc[_0x055f('0x12')][_0x055f('0x10')]);}})['catch'](function(_0x5eaa89){logger[_0x055f('0xe')](_0x055f('0xf'),_0x280914,_0x5eaa89);_0x3b7de9(_0x5eaa89);});});}exports['GetTrunk']=function(_0x3bf129){var _0x18b3eb=this;return new Promise(function(_0x356950,_0x2f60c2){return db[_0x055f('0x13')][_0x055f('0x14')]({'raw':_0x3bf129[_0x055f('0x15')]?_0x3bf129['options']['raw']===undefined?!![]:![]:!![],'where':_0x3bf129[_0x055f('0x15')]?_0x3bf129[_0x055f('0x15')]['where']||null:null,'attributes':_0x3bf129[_0x055f('0x15')]?_0x3bf129[_0x055f('0x15')][_0x055f('0x16')]||null:null,'limit':_0x3bf129[_0x055f('0x15')]?_0x3bf129[_0x055f('0x15')][_0x055f('0x17')]||null:null,'include':_0x3bf129[_0x055f('0x15')]?_0x3bf129[_0x055f('0x15')][_0x055f('0x18')]?_[_0x055f('0x19')](_0x3bf129[_0x055f('0x15')][_0x055f('0x18')],function(_0x2af786){return{'model':db[_0x2af786[_0x055f('0x1a')]],'as':_0x2af786['as'],'attributes':_0x2af786['attributes'],'include':_0x2af786[_0x055f('0x18')]?_[_0x055f('0x19')](_0x2af786[_0x055f('0x18')],function(_0x3bf8ec){return{'model':db[_0x3bf8ec[_0x055f('0x1a')]],'as':_0x3bf8ec['as'],'attributes':_0x3bf8ec[_0x055f('0x16')],'include':_0x3bf8ec['include']?_['map'](_0x3bf8ec[_0x055f('0x18')],function(_0x5e63ed){return{'model':db[_0x5e63ed[_0x055f('0x1a')]],'as':_0x5e63ed['as'],'attributes':_0x5e63ed[_0x055f('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27655e){logger[_0x055f('0xb')]('GetTrunk',_0x3bf129);logger['debug']('GetTrunk',_0x3bf129,JSON[_0x055f('0xd')](_0x27655e));_0x356950(_0x27655e);})[_0x055f('0x1b')](function(_0x46c0e5){logger[_0x055f('0xe')](_0x055f('0x1c'),_0x46c0e5[_0x055f('0x10')],_0x3bf129);_0x2f60c2(_0x18b3eb[_0x055f('0xe')](0x1f4,_0x46c0e5['message']));});});};exports[_0x055f('0x1d')]=function(_0x32cf1e){var _0x322521=this;return new Promise(function(_0x535827,_0x35fdbc){return db['Trunk'][_0x055f('0x1e')]({'raw':_0x32cf1e[_0x055f('0x15')]?_0x32cf1e['options'][_0x055f('0x1f')]===undefined?!![]:![]:!![],'where':_0x32cf1e['options']?_0x32cf1e[_0x055f('0x15')]['where']||null:null,'attributes':_0x32cf1e[_0x055f('0x15')]?_0x32cf1e[_0x055f('0x15')]['attributes']||null:null,'include':_0x32cf1e[_0x055f('0x15')]?_0x32cf1e[_0x055f('0x15')][_0x055f('0x18')]?_[_0x055f('0x19')](_0x32cf1e[_0x055f('0x15')][_0x055f('0x18')],function(_0x5362a8){return{'model':db[_0x5362a8[_0x055f('0x1a')]],'as':_0x5362a8['as'],'attributes':_0x5362a8[_0x055f('0x16')],'include':_0x5362a8[_0x055f('0x18')]?_[_0x055f('0x19')](_0x5362a8[_0x055f('0x18')],function(_0x54f1f2){return{'model':db[_0x54f1f2[_0x055f('0x1a')]],'as':_0x54f1f2['as'],'attributes':_0x54f1f2[_0x055f('0x16')],'include':_0x54f1f2[_0x055f('0x18')]?_[_0x055f('0x19')](_0x54f1f2[_0x055f('0x18')],function(_0x2fc047){return{'model':db[_0x2fc047[_0x055f('0x1a')]],'as':_0x2fc047['as'],'attributes':_0x2fc047[_0x055f('0x16')]};}):[]};}):[]};}):[]:[]})[_0x055f('0xa')](function(_0x20e7e8){logger[_0x055f('0xb')](_0x055f('0x1d'),_0x32cf1e);logger['debug'](_0x055f('0x1d'),_0x32cf1e,JSON['stringify'](_0x20e7e8));_0x535827(_0x20e7e8);})['catch'](function(_0x26eea8){logger['error'](_0x055f('0x1d'),_0x26eea8['message'],_0x32cf1e);_0x35fdbc(_0x322521[_0x055f('0xe')](0x1f4,_0x26eea8[_0x055f('0x10')]));});});}; \ No newline at end of file +var _0x109b=['util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetTrunk','Trunk','findAll','options','where','limit','include','attributes','model','map','then','stringify','catch','find','raw','lodash'];(function(_0x1b2710,_0x49ad58){var _0x4bfa2e=function(_0x12ab9b){while(--_0x12ab9b){_0x1b2710['push'](_0x1b2710['shift']());}};_0x4bfa2e(++_0x49ad58);}(_0x109b,0x1ac));var _0xb109=function(_0x11c228,_0x2e8bb2){_0x11c228=_0x11c228-0x0;var _0x171810=_0x109b[_0x11c228];return _0x171810;};'use strict';var _=require(_0xb109('0x0'));var util=require(_0xb109('0x1'));var moment=require(_0xb109('0x2'));var BPromise=require(_0xb109('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb109('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb109('0x5'))(_0xb109('0x6'));var config=require('../../config/environment');var jayson=require(_0xb109('0x7'));var client=jayson[_0xb109('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e3c12,_0xc98ada,_0x32b716){return new BPromise(function(_0x4bf925,_0xd4f418){return client[_0xb109('0x9')](_0x1e3c12,_0x32b716)['then'](function(_0x14cce7){logger[_0xb109('0xa')](_0xb109('0xb'),_0xc98ada,'request\x20sent');logger[_0xb109('0xc')](_0xb109('0xd'),_0xc98ada,_0xb109('0xe'),JSON['stringify'](_0x14cce7));if(_0x14cce7['error']){if(_0x14cce7[_0xb109('0xf')][_0xb109('0x10')]===0x1f4){logger[_0xb109('0xf')]('Trunk,\x20%s,\x20%s',_0xc98ada,_0x14cce7['error'][_0xb109('0x11')]);return _0xd4f418(_0x14cce7[_0xb109('0xf')]['message']);}logger['error'](_0xb109('0xb'),_0xc98ada,_0x14cce7[_0xb109('0xf')]['message']);return _0x4bf925(_0x14cce7[_0xb109('0xf')]['message']);}else{logger[_0xb109('0xa')](_0xb109('0xb'),_0xc98ada,_0xb109('0xe'));_0x4bf925(_0x14cce7['result'][_0xb109('0x11')]);}})['catch'](function(_0x7bff4){logger[_0xb109('0xf')](_0xb109('0xb'),_0xc98ada,_0x7bff4);_0xd4f418(_0x7bff4);});});}exports[_0xb109('0x12')]=function(_0x36987e){var _0x566959=this;return new Promise(function(_0x2bdd18,_0x40567b){return db[_0xb109('0x13')][_0xb109('0x14')]({'raw':_0x36987e[_0xb109('0x15')]?_0x36987e[_0xb109('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x36987e[_0xb109('0x15')]?_0x36987e['options'][_0xb109('0x16')]||null:null,'attributes':_0x36987e[_0xb109('0x15')]?_0x36987e[_0xb109('0x15')]['attributes']||null:null,'limit':_0x36987e['options']?_0x36987e['options'][_0xb109('0x17')]||null:null,'include':_0x36987e[_0xb109('0x15')]?_0x36987e['options'][_0xb109('0x18')]?_['map'](_0x36987e['options'][_0xb109('0x18')],function(_0x4828af){return{'model':db[_0x4828af['model']],'as':_0x4828af['as'],'attributes':_0x4828af[_0xb109('0x19')],'include':_0x4828af[_0xb109('0x18')]?_['map'](_0x4828af[_0xb109('0x18')],function(_0x2e78d2){return{'model':db[_0x2e78d2[_0xb109('0x1a')]],'as':_0x2e78d2['as'],'attributes':_0x2e78d2['attributes'],'include':_0x2e78d2[_0xb109('0x18')]?_[_0xb109('0x1b')](_0x2e78d2[_0xb109('0x18')],function(_0x101564){return{'model':db[_0x101564['model']],'as':_0x101564['as'],'attributes':_0x101564[_0xb109('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb109('0x1c')](function(_0x5b6ad5){logger[_0xb109('0xa')](_0xb109('0x12'),_0x36987e);logger[_0xb109('0xc')](_0xb109('0x12'),_0x36987e,JSON[_0xb109('0x1d')](_0x5b6ad5));_0x2bdd18(_0x5b6ad5);})[_0xb109('0x1e')](function(_0x3d39fa){logger['error'](_0xb109('0x12'),_0x3d39fa[_0xb109('0x11')],_0x36987e);_0x40567b(_0x566959[_0xb109('0xf')](0x1f4,_0x3d39fa[_0xb109('0x11')]));});});};exports['ShowTrunk']=function(_0x563b55){var _0x2921f5=this;return new Promise(function(_0x33643c,_0x594879){return db[_0xb109('0x13')][_0xb109('0x1f')]({'raw':_0x563b55[_0xb109('0x15')]?_0x563b55[_0xb109('0x15')][_0xb109('0x20')]===undefined?!![]:![]:!![],'where':_0x563b55['options']?_0x563b55[_0xb109('0x15')][_0xb109('0x16')]||null:null,'attributes':_0x563b55[_0xb109('0x15')]?_0x563b55[_0xb109('0x15')]['attributes']||null:null,'include':_0x563b55['options']?_0x563b55[_0xb109('0x15')][_0xb109('0x18')]?_['map'](_0x563b55[_0xb109('0x15')][_0xb109('0x18')],function(_0x4f231e){return{'model':db[_0x4f231e[_0xb109('0x1a')]],'as':_0x4f231e['as'],'attributes':_0x4f231e[_0xb109('0x19')],'include':_0x4f231e[_0xb109('0x18')]?_['map'](_0x4f231e['include'],function(_0x5e3f88){return{'model':db[_0x5e3f88['model']],'as':_0x5e3f88['as'],'attributes':_0x5e3f88['attributes'],'include':_0x5e3f88[_0xb109('0x18')]?_[_0xb109('0x1b')](_0x5e3f88[_0xb109('0x18')],function(_0x490941){return{'model':db[_0x490941[_0xb109('0x1a')]],'as':_0x490941['as'],'attributes':_0x490941[_0xb109('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb109('0x1c')](function(_0x551f8c){logger['info']('ShowTrunk',_0x563b55);logger['debug']('ShowTrunk',_0x563b55,JSON[_0xb109('0x1d')](_0x551f8c));_0x33643c(_0x551f8c);})[_0xb109('0x1e')](function(_0x5655c0){logger['error']('ShowTrunk',_0x5655c0[_0xb109('0x11')],_0x563b55);_0x594879(_0x2921f5['error'](0x1f4,_0x5655c0[_0xb109('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 6e95f93..1783c34 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f53=['exports','express','Router','./user-setting.controller','/:id','update'];(function(_0x287731,_0x332bb6){var _0x4e7c26=function(_0x27a2b4){while(--_0x27a2b4){_0x287731['push'](_0x287731['shift']());}};_0x4e7c26(++_0x332bb6);}(_0x0f53,0x73));var _0x30f5=function(_0x5b5192,_0xbf2653){_0x5b5192=_0x5b5192-0x0;var _0x3d8690=_0x0f53[_0x5b5192];return _0x3d8690;};'use strict';var express=require(_0x30f5('0x0'));var router=express[_0x30f5('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x30f5('0x2'));router['put'](_0x30f5('0x3'),auth['isAuthenticated'](),controller[_0x30f5('0x4')]);module[_0x30f5('0x5')]=router; \ No newline at end of file +var _0xd551=['isAuthenticated','exports','express','./user-setting.controller','put','/:id'];(function(_0x627c57,_0x3aeaec){var _0x56f29e=function(_0x23289d){while(--_0x23289d){_0x627c57['push'](_0x627c57['shift']());}};_0x56f29e(++_0x3aeaec);}(_0xd551,0x1ee));var _0x1d55=function(_0x3c3ed3,_0x510746){_0x3c3ed3=_0x3c3ed3-0x0;var _0x5231b1=_0xd551[_0x3c3ed3];return _0x5231b1;};'use strict';var express=require(_0x1d55('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x1d55('0x1'));router[_0x1d55('0x2')](_0x1d55('0x3'),auth[_0x1d55('0x4')](),controller['update']);module[_0x1d55('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index f58de71..24dbe64 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39dc=['INTEGER','sequelize','debug','exports','BOOLEAN','TEXT','DATE'];(function(_0x319b01,_0x440245){var _0x313eaa=function(_0x1238c3){while(--_0x1238c3){_0x319b01['push'](_0x319b01['shift']());}};_0x313eaa(++_0x440245);}(_0x39dc,0x6a));var _0xc39d=function(_0x26f267,_0x20568c){_0x26f267=_0x26f267-0x0;var _0xe65f33=_0x39dc[_0x26f267];return _0xe65f33;};'use strict';var Sequelize=require(_0xc39d('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error','warning','info',_0xc39d('0x1')];module[_0xc39d('0x2')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xc39d('0x3')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xc39d('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xc39d('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xc39d('0x6')],'unique':'UserId'}}; \ No newline at end of file +var _0xedca=['sequelize','error','warning','debug','ENUM','BOOLEAN','DATE','UserId'];(function(_0x1d9644,_0x371adf){var _0x23d6b6=function(_0x9e6091){while(--_0x9e6091){_0x1d9644['push'](_0x1d9644['shift']());}};_0x23d6b6(++_0x371adf);}(_0xedca,0xf8));var _0xaedc=function(_0x4813d7,_0x28c768){_0x4813d7=_0x4813d7-0x0;var _0xd71d5d=_0xedca[_0x4813d7];return _0xd71d5d;};'use strict';var Sequelize=require(_0xaedc('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xaedc('0x1'),_0xaedc('0x2'),'info',_0xaedc('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xaedc('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xaedc('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xaedc('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xaedc('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xaedc('0x7')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 7d23f02..60b47a8 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe739=['name','send','user','role','Unauthorized','params','UserSetting','find','lodash','../../config/logger','api','../../config/environment','./user-setting.socket','register','redis','defaults','localhost','status','json','update','then','error','stack'];(function(_0x5f26f4,_0x4f9bcf){var _0x385e31=function(_0x20d9d7){while(--_0x20d9d7){_0x5f26f4['push'](_0x5f26f4['shift']());}};_0x385e31(++_0x4f9bcf);}(_0xe739,0x105));var _0x9e73=function(_0x53a03e,_0x1dd3f2){_0x53a03e=_0x53a03e-0x0;var _0x4fb02c=_0xe739[_0x53a03e];return _0x4fb02c;};'use strict';var _=require(_0x9e73('0x0'));var Redis=require('ioredis');var logger=require(_0x9e73('0x1'))(_0x9e73('0x2'));var config=require(_0x9e73('0x3'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9e73('0x4'))[_0x9e73('0x5')](socket);config[_0x9e73('0x6')]=_[_0x9e73('0x7')](config['redis'],{'host':_0x9e73('0x8'),'port':0x18eb});function respondWithResult(_0x26cb5b,_0xb37872){_0xb37872=_0xb37872||0xc8;return function(_0x5e46e7){if(_0x5e46e7){return _0x26cb5b[_0x9e73('0x9')](_0xb37872)[_0x9e73('0xa')](_0x5e46e7);}};}function saveUpdates(_0x471872){return function(_0x274187){if(_0x274187){return _0x274187[_0x9e73('0xb')](_0x471872)[_0x9e73('0xc')](function(_0x52393d){return _0x52393d;});}return null;};}function handleEntityNotFound(_0x33ce2d){return function(_0x5f06cb){if(!_0x5f06cb){_0x33ce2d['sendStatus'](0x194);}return _0x5f06cb;};}function handleError(_0x145c76,_0x530e27){_0x530e27=_0x530e27||0x1f4;return function(_0x186b89){logger[_0x9e73('0xd')](_0x186b89[_0x9e73('0xe')]);if(_0x186b89['name']){delete _0x186b89[_0x9e73('0xf')];}_0x145c76[_0x9e73('0x9')](_0x530e27)[_0x9e73('0x10')](_0x186b89);};}exports[_0x9e73('0xb')]=function(_0x5c1c3b,_0x27c0ba){if(_0x5c1c3b[_0x9e73('0x11')][_0x9e73('0x12')]!=='admin')throw new Error(_0x9e73('0x13'));if(isNaN(Number(_0x5c1c3b[_0x9e73('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x9e73('0x15')][_0x9e73('0x16')]({'where':{'id':_0x5c1c3b[_0x9e73('0x14')]['id']}})['then'](handleEntityNotFound(_0x27c0ba,null))[_0x9e73('0xc')](saveUpdates(_0x5c1c3b['body'],null))[_0x9e73('0xc')](respondWithResult(_0x27c0ba,null))['catch'](handleError(_0x27c0ba,null));}; \ No newline at end of file +var _0xac65=['update','then','sendStatus','error','stack','name','send','user','role','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','localhost','status','json'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xac65,0x11d));var _0x5ac6=function(_0x25acf0,_0x2e1c5f){_0x25acf0=_0x25acf0-0x0;var _0x4edcc4=_0xac65[_0x25acf0];return _0x4edcc4;};'use strict';var _=require(_0x5ac6('0x0'));var Redis=require(_0x5ac6('0x1'));var logger=require(_0x5ac6('0x2'))('api');var config=require(_0x5ac6('0x3'));var db=require(_0x5ac6('0x4'))['db'];var socket=require(_0x5ac6('0x5'))(new Redis(config['redis']));require(_0x5ac6('0x6'))[_0x5ac6('0x7')](socket);config[_0x5ac6('0x8')]=_['defaults'](config[_0x5ac6('0x8')],{'host':_0x5ac6('0x9'),'port':0x18eb});function respondWithResult(_0x130661,_0x402f26){_0x402f26=_0x402f26||0xc8;return function(_0xa61e6f){if(_0xa61e6f){return _0x130661[_0x5ac6('0xa')](_0x402f26)[_0x5ac6('0xb')](_0xa61e6f);}};}function saveUpdates(_0x4609fb){return function(_0x1006ff){if(_0x1006ff){return _0x1006ff[_0x5ac6('0xc')](_0x4609fb)[_0x5ac6('0xd')](function(_0x3dfe45){return _0x3dfe45;});}return null;};}function handleEntityNotFound(_0x3c43c7){return function(_0x40a152){if(!_0x40a152){_0x3c43c7[_0x5ac6('0xe')](0x194);}return _0x40a152;};}function handleError(_0x2a2765,_0x4ad3cb){_0x4ad3cb=_0x4ad3cb||0x1f4;return function(_0x104d2c){logger[_0x5ac6('0xf')](_0x104d2c[_0x5ac6('0x10')]);if(_0x104d2c[_0x5ac6('0x11')]){delete _0x104d2c[_0x5ac6('0x11')];}_0x2a2765[_0x5ac6('0xa')](_0x4ad3cb)[_0x5ac6('0x12')](_0x104d2c);};}exports[_0x5ac6('0xc')]=function(_0x1c2e11,_0x5cd91e){if(_0x1c2e11[_0x5ac6('0x13')][_0x5ac6('0x14')]!==_0x5ac6('0x15'))throw new Error('Unauthorized');if(isNaN(Number(_0x1c2e11[_0x5ac6('0x16')]['id'])))throw new Error(_0x5ac6('0x17'));return db[_0x5ac6('0x18')][_0x5ac6('0x19')]({'where':{'id':_0x1c2e11[_0x5ac6('0x16')]['id']}})['then'](handleEntityNotFound(_0x5cd91e,null))[_0x5ac6('0xd')](saveUpdates(_0x1c2e11['body'],null))['then'](respondWithResult(_0x5cd91e,null))[_0x5ac6('0x1a')](handleError(_0x5cd91e,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 5033016..6208b4c 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03e9=['exports','../../mysqldb','UserSetting','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x299c19,_0x1a8658){var _0x12c954=function(_0x2ec2b0){while(--_0x2ec2b0){_0x299c19['push'](_0x299c19['shift']());}};_0x12c954(++_0x1a8658);}(_0x03e9,0xe2));var _0x903e=function(_0x511d3f,_0x43ed7c){_0x511d3f=_0x511d3f-0x0;var _0x303176=_0x03e9[_0x511d3f];return _0x303176;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x903e('0x0'))['db'][_0x903e('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x903e('0x2')](0x0);var events={'afterCreate':_0x903e('0x3'),'afterUpdate':_0x903e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a36b4){return function(_0x5344ec,_0x2f934a,_0x260fe5){UserSettingEvents['emit'](_0x2a36b4+':'+_0x5344ec['id'],_0x5344ec);UserSettingEvents[_0x903e('0x5')](_0x2a36b4,_0x5344ec);_0x260fe5(null);};}for(var e in events){if(events[_0x903e('0x6')](e)){var event=events[e];UserSetting[_0x903e('0x7')](e,emitEvent(event));}}module[_0x903e('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x1cac=['hook','events','../../mysqldb','UserSetting','setMaxListeners','remove','emit'];(function(_0x27b620,_0x278ba0){var _0x3e7580=function(_0x223ef6){while(--_0x223ef6){_0x27b620['push'](_0x27b620['shift']());}};_0x3e7580(++_0x278ba0);}(_0x1cac,0x86));var _0xc1ca=function(_0x58e8eb,_0x2ac0c7){_0x58e8eb=_0x58e8eb-0x0;var _0x168540=_0x1cac[_0x58e8eb];return _0x168540;};'use strict';var EventEmitter=require(_0xc1ca('0x0'));var UserSetting=require(_0xc1ca('0x1'))['db'][_0xc1ca('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xc1ca('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc1ca('0x4')};function emitEvent(_0x2eb510){return function(_0x31f6f6,_0x336bef,_0x499def){UserSettingEvents['emit'](_0x2eb510+':'+_0x31f6f6['id'],_0x31f6f6);UserSettingEvents[_0xc1ca('0x5')](_0x2eb510,_0x31f6f6);_0x499def(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xc1ca('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 1928dff..8cca4cc 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc584=['exports','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x4ac397,_0x1fc9ab){var _0x298df7=function(_0x3722fe){while(--_0x3722fe){_0x4ac397['push'](_0x4ac397['shift']());}};_0x298df7(++_0x1fc9ab);}(_0xc584,0xa8));var _0x4c58=function(_0x29631f,_0xdb767){_0x29631f=_0x29631f-0x0;var _0x486d87=_0xc584[_0x29631f];return _0x486d87;};'use strict';var attributes=require('./user-setting.attributes');module[_0x4c58('0x0')]=function(_0x1d0f9e){return _0x1d0f9e['define']('UserSetting',attributes,{'tableName':_0x4c58('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5502e6){if(!_0x5502e6[_0x4c58('0x2')])_0x5502e6[_0x4c58('0x3')]=null;else if(_0x5502e6[_0x4c58('0x3')]===null)_0x5502e6['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x44a3=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44a3,0x1a9));var _0x344a=function(_0x25f8e8,_0x519d8e){_0x25f8e8=_0x25f8e8-0x0;var _0x1df02c=_0x44a3[_0x25f8e8];return _0x1df02c;};'use strict';var attributes=require(_0x344a('0x0'));module[_0x344a('0x1')]=function(_0x3fa916){return _0x3fa916[_0x344a('0x2')](_0x344a('0x3'),attributes,{'tableName':_0x344a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3bb844){if(!_0x3bb844[_0x344a('0x5')])_0x3bb844['clientSideLoggingEnabledSince']=null;else if(_0x3bb844[_0x344a('0x6')]===null)_0x3bb844[_0x344a('0x6')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 14c8417..8b396d7 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5047=['user-setting:update:user-','register','length','user-setting:','./user-setting.events','save','remove','update','user-setting:update','emit'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x5047,0xe0));var _0x7504=function(_0x2dacca,_0x3b55a5){_0x2dacca=_0x2dacca-0x0;var _0x4e8745=_0x5047[_0x2dacca];return _0x4e8745;};'use strict';var UserSettingEvents=require(_0x7504('0x0'));var events=[_0x7504('0x1'),_0x7504('0x2'),_0x7504('0x3')];function createListener(_0x17582e,_0xac34e6){return function(_0x471a1d){_0xac34e6['emit'](_0x17582e,_0x471a1d);if(_0x17582e===_0x7504('0x4')){_0xac34e6[_0x7504('0x5')](_0x7504('0x6')+_0x471a1d['UserId'],_0x471a1d);}};}exports[_0x7504('0x7')]=function(_0x2088df){for(var _0x27e9c6=0x0,_0x3ca695=events[_0x7504('0x8')];_0x27e9c6<_0x3ca695;_0x27e9c6++){var _0xc165a5=events[_0x27e9c6];var _0x2c1591=createListener(_0x7504('0x9')+_0xc165a5,_0x2088df);UserSettingEvents['on'](_0xc165a5,_0x2c1591);}}; \ No newline at end of file +var _0x9327=['user-setting:update','user-setting:update:user-','UserId','register','user-setting:','update','emit'];(function(_0x585905,_0x16655c){var _0x1a5114=function(_0x4079f2){while(--_0x4079f2){_0x585905['push'](_0x585905['shift']());}};_0x1a5114(++_0x16655c);}(_0x9327,0x11d));var _0x7932=function(_0x5bfa34,_0x59dc3d){_0x5bfa34=_0x5bfa34-0x0;var _0x4ae9eb=_0x9327[_0x5bfa34];return _0x4ae9eb;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save','remove',_0x7932('0x0')];function createListener(_0x5a7a65,_0x517328){return function(_0x38c322){_0x517328[_0x7932('0x1')](_0x5a7a65,_0x38c322);if(_0x5a7a65===_0x7932('0x2')){_0x517328[_0x7932('0x1')](_0x7932('0x3')+_0x38c322[_0x7932('0x4')],_0x38c322);}};}exports[_0x7932('0x5')]=function(_0xfe22){for(var _0x381ed8=0x0,_0x6a99e7=events['length'];_0x381ed8<_0x6a99e7;_0x381ed8++){var _0x104dd0=events[_0x381ed8];var _0xcf72aa=createListener(_0x7932('0x6')+_0x104dd0,_0xfe22);UserSettingEvents['on'](_0x104dd0,_0xcf72aa);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 8ad9a48..0063f47 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 _0x4c68=['/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','/:id/agents','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','diskStorage','root','%s-%s','originalname','single','file','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/sms_accounts','addChatWebsites','/:id/whatsapp_accounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions'];(function(_0x2eb1d7,_0x45a3a2){var _0x5e49c8=function(_0x200a08){while(--_0x200a08){_0x2eb1d7['push'](_0x2eb1d7['shift']());}};_0x5e49c8(++_0x45a3a2);}(_0x4c68,0x198));var _0x84c6=function(_0x274f14,_0x27dd7f){_0x274f14=_0x274f14-0x0;var _0x13b97e=_0x4c68[_0x274f14];return _0x13b97e;};'use strict';var multer=require(_0x84c6('0x0'));var util=require(_0x84c6('0x1'));var path=require(_0x84c6('0x2'));var timeout=require(_0x84c6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x84c6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x84c6('0x5'));var config=require(_0x84c6('0x6'));var controller=require(_0x84c6('0x7'));router['get']('/',auth[_0x84c6('0x8')](),controller[_0x84c6('0x9')]);router[_0x84c6('0xa')](_0x84c6('0xb'),auth[_0x84c6('0x8')](),controller['describe']);router[_0x84c6('0xa')](_0x84c6('0xc'),auth['isAuthenticated'](),controller[_0x84c6('0xd')]);router[_0x84c6('0xa')](_0x84c6('0xe'),auth[_0x84c6('0x8')](),controller[_0x84c6('0xf')]);router['get'](_0x84c6('0x10'),auth['isAuthenticated'](),controller[_0x84c6('0x11')]);router['get'](_0x84c6('0x12'),controller[_0x84c6('0x13')]);router[_0x84c6('0xa')](_0x84c6('0x14'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x15')]);router['get'](_0x84c6('0x16'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x17')]);router['get'](_0x84c6('0x18'),auth[_0x84c6('0x8')](),controller['getQueues']);router[_0x84c6('0xa')](_0x84c6('0x19'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x1a')]);router[_0x84c6('0xa')](_0x84c6('0x1b'),auth['isAuthenticated'](),controller['getGroups']);router['get'](_0x84c6('0x1c'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x1d')]);router['get'](_0x84c6('0x1e'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x1f')]);router['get'](_0x84c6('0x20'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x21')]);router[_0x84c6('0xa')](_0x84c6('0x22'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x23')]);router[_0x84c6('0xa')](_0x84c6('0x24'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x25')]);router[_0x84c6('0xa')](_0x84c6('0x26'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x27')]);router[_0x84c6('0xa')](_0x84c6('0x28'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x29')]);router['get'](_0x84c6('0x2a'),auth['isAuthenticated'](),controller[_0x84c6('0x2b')]);router[_0x84c6('0xa')]('/:id/teams',auth[_0x84c6('0x8')](),controller[_0x84c6('0x2c')]);router[_0x84c6('0xa')](_0x84c6('0x2d'),auth[_0x84c6('0x8')](),controller['getLists']);router[_0x84c6('0xa')](_0x84c6('0x2e'),auth[_0x84c6('0x8')](),controller['getAgents']);router[_0x84c6('0xa')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x84c6('0x2f')]);router[_0x84c6('0xa')](_0x84c6('0x30'),auth[_0x84c6('0x8')](),controller['getFaxAccounts']);router[_0x84c6('0xa')]('/:id/mail_accounts',auth[_0x84c6('0x8')](),controller[_0x84c6('0x31')]);router[_0x84c6('0xa')](_0x84c6('0x32'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0x84c6('0xa')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x84c6('0x33')]);router[_0x84c6('0xa')](_0x84c6('0x34'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x35')]);router[_0x84c6('0xa')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x84c6('0x36')]);router[_0x84c6('0xa')]('/:id/scheduled_calls',auth[_0x84c6('0x8')](),controller[_0x84c6('0x37')]);router[_0x84c6('0xa')](_0x84c6('0x38'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x39')]);router[_0x84c6('0x3a')]('/:id/contacts',auth[_0x84c6('0x8')](),controller[_0x84c6('0x3b')]);router[_0x84c6('0x3a')]('/',auth[_0x84c6('0x8')](),controller[_0x84c6('0x3c')]);router[_0x84c6('0x3a')](_0x84c6('0x3d'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x3e')]);router[_0x84c6('0x3a')](_0x84c6('0x18'),auth[_0x84c6('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x84c6('0x3f')]({'destination':function(_0x1ab16b,_0x2fed78,_0x986d2){_0x986d2(null,path['join'](config[_0x84c6('0x40')],'server/files/images/'));},'filename':function(_0x42d21,_0x230908,_0x25b343){_0x25b343(null,util['format'](_0x84c6('0x41'),Date['now'](),_0x230908[_0x84c6('0x42')]));}})});router[_0x84c6('0x3a')](_0x84c6('0x12'),upload[_0x84c6('0x43')](_0x84c6('0x44')),controller['addAvatar']);router['post']('/:id/login',auth[_0x84c6('0x8')](),controller[_0x84c6('0x45')]);router[_0x84c6('0x3a')](_0x84c6('0x46'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x47')]);router[_0x84c6('0x3a')](_0x84c6('0x48'),auth[_0x84c6('0x8')](),controller['pause']);router[_0x84c6('0x3a')](_0x84c6('0x49'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x4a')]);router[_0x84c6('0x3a')](_0x84c6('0x4b'),auth[_0x84c6('0x8')](),controller['addTeams']);router[_0x84c6('0x3a')](_0x84c6('0x4c'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x84c6('0x3a')](_0x84c6('0x4d'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x4e')]);router['post'](_0x84c6('0x4f'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x50')]);router[_0x84c6('0x3a')](_0x84c6('0x51'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x52')]);router[_0x84c6('0x3a')](_0x84c6('0x53'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x54')]);router['post'](_0x84c6('0x55'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x56')]);router['post'](_0x84c6('0x30'),auth['isAuthenticated'](),controller[_0x84c6('0x57')]);router[_0x84c6('0x3a')](_0x84c6('0x58'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x59')]);router['post']('/:id/openchannel_accounts',auth[_0x84c6('0x8')](),controller['addOpenchannelAccounts']);router[_0x84c6('0x3a')](_0x84c6('0x5a'),auth[_0x84c6('0x8')](),controller['addSmsAccounts']);router[_0x84c6('0x3a')](_0x84c6('0x34'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x5b')]);router[_0x84c6('0x3a')](_0x84c6('0x5c'),auth[_0x84c6('0x8')](),controller['addWhatsappAccounts']);router['post']('/:id/api_key',auth[_0x84c6('0x8')](),controller[_0x84c6('0x5d')]);router[_0x84c6('0x5e')](_0x84c6('0x10'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x5f')]);router['put'](_0x84c6('0x60'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x61')]);router[_0x84c6('0x62')]('/:id/queues',auth['isAuthenticated'](),controller[_0x84c6('0x63')]);router[_0x84c6('0x62')](_0x84c6('0x4b'),auth[_0x84c6('0x8')](),controller['removeTeams']);router[_0x84c6('0x62')](_0x84c6('0x10'),auth['isAuthenticated'](),controller[_0x84c6('0x64')]);router[_0x84c6('0x62')](_0x84c6('0x4c'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x65')]);router[_0x84c6('0x62')](_0x84c6('0x4d'),auth[_0x84c6('0x8')](),controller['removeMailInteractions']);router[_0x84c6('0x62')](_0x84c6('0x4f'),auth[_0x84c6('0x8')](),controller['removeFaxInteractions']);router[_0x84c6('0x62')]('/:id/sms_interactions',auth[_0x84c6('0x8')](),controller['removeSmsInteractions']);router[_0x84c6('0x62')](_0x84c6('0x53'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x66')]);router['delete'](_0x84c6('0x55'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x67')]);router[_0x84c6('0x62')](_0x84c6('0x30'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x68')]);router[_0x84c6('0x62')]('/:id/mail_accounts',auth[_0x84c6('0x8')](),controller[_0x84c6('0x69')]);router[_0x84c6('0x62')](_0x84c6('0x32'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x6a')]);router[_0x84c6('0x62')](_0x84c6('0x5a'),auth['isAuthenticated'](),controller[_0x84c6('0x6b')]);router[_0x84c6('0x62')](_0x84c6('0x34'),auth[_0x84c6('0x8')](),controller[_0x84c6('0x6c')]);router[_0x84c6('0x62')](_0x84c6('0x5c'),auth['isAuthenticated'](),controller[_0x84c6('0x6d')]);router[_0x84c6('0x62')](_0x84c6('0x38'),auth['isAuthenticated'](),controller[_0x84c6('0x6e')]);module['exports']=router; \ No newline at end of file +var _0x97a8=['../../config/environment','./user.controller','/describe','isAuthenticated','describe','get','/whoami','whoami','/presence','getPresence','/:id','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/whatsapp_accounts','createApiKey','update','put','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1cc6b5,_0x30745c){var _0x133f64=function(_0x686e51){while(--_0x686e51){_0x1cc6b5['push'](_0x1cc6b5['shift']());}};_0x133f64(++_0x30745c);}(_0x97a8,0xe3));var _0x897a=function(_0x13ac75,_0x4716f2){_0x13ac75=_0x13ac75-0x0;var _0x1d8ab7=_0x97a8[_0x13ac75];return _0x1d8ab7;};'use strict';var multer=require('multer');var util=require(_0x897a('0x0'));var path=require(_0x897a('0x1'));var timeout=require(_0x897a('0x2'));var express=require(_0x897a('0x3'));var router=express[_0x897a('0x4')]();var fs_extra=require(_0x897a('0x5'));var auth=require(_0x897a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x897a('0x7'));var controller=require(_0x897a('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x897a('0x9'),auth[_0x897a('0xa')](),controller[_0x897a('0xb')]);router[_0x897a('0xc')](_0x897a('0xd'),auth['isAuthenticated'](),controller[_0x897a('0xe')]);router[_0x897a('0xc')](_0x897a('0xf'),auth[_0x897a('0xa')](),controller[_0x897a('0x10')]);router[_0x897a('0xc')](_0x897a('0x11'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/avatar',controller[_0x897a('0x12')]);router['get'](_0x897a('0x13'),auth[_0x897a('0xa')](),controller[_0x897a('0x14')]);router[_0x897a('0xc')]('/:id/contacts',auth[_0x897a('0xa')](),controller[_0x897a('0x15')]);router[_0x897a('0xc')](_0x897a('0x16'),auth['isAuthenticated'](),controller['getQueues']);router[_0x897a('0xc')](_0x897a('0x17'),auth['isAuthenticated'](),controller[_0x897a('0x18')]);router[_0x897a('0xc')](_0x897a('0x19'),auth[_0x897a('0xa')](),controller[_0x897a('0x1a')]);router[_0x897a('0xc')](_0x897a('0x1b'),auth[_0x897a('0xa')](),controller[_0x897a('0x1c')]);router[_0x897a('0xc')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x897a('0x1d')]);router[_0x897a('0xc')](_0x897a('0x1e'),auth[_0x897a('0xa')](),controller['getChatInteractions']);router[_0x897a('0xc')](_0x897a('0x1f'),auth[_0x897a('0xa')](),controller[_0x897a('0x20')]);router['get'](_0x897a('0x21'),auth[_0x897a('0xa')](),controller['getMailInteractions']);router[_0x897a('0xc')]('/:id/sms/interactions',auth[_0x897a('0xa')](),controller[_0x897a('0x22')]);router[_0x897a('0xc')](_0x897a('0x23'),auth[_0x897a('0xa')](),controller['getFaxInteractions']);router[_0x897a('0xc')](_0x897a('0x24'),auth[_0x897a('0xa')](),controller[_0x897a('0x25')]);router[_0x897a('0xc')](_0x897a('0x26'),auth[_0x897a('0xa')](),controller[_0x897a('0x27')]);router[_0x897a('0xc')](_0x897a('0x28'),auth[_0x897a('0xa')](),controller[_0x897a('0x29')]);router[_0x897a('0xc')]('/:id/agents',auth[_0x897a('0xa')](),controller[_0x897a('0x2a')]);router[_0x897a('0xc')](_0x897a('0x2b'),auth[_0x897a('0xa')](),controller[_0x897a('0x2c')]);router[_0x897a('0xc')](_0x897a('0x2d'),auth[_0x897a('0xa')](),controller[_0x897a('0x2e')]);router[_0x897a('0xc')](_0x897a('0x2f'),auth['isAuthenticated'](),controller[_0x897a('0x30')]);router['get'](_0x897a('0x31'),auth[_0x897a('0xa')](),controller[_0x897a('0x32')]);router[_0x897a('0xc')](_0x897a('0x33'),auth[_0x897a('0xa')](),controller['getSmsAccounts']);router[_0x897a('0xc')](_0x897a('0x34'),auth[_0x897a('0xa')](),controller[_0x897a('0x35')]);router[_0x897a('0xc')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x897a('0x36')]);router[_0x897a('0xc')](_0x897a('0x37'),auth['isAuthenticated'](),controller[_0x897a('0x38')]);router[_0x897a('0xc')](_0x897a('0x39'),auth['isAuthenticated'](),controller[_0x897a('0x3a')]);router[_0x897a('0x3b')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x897a('0x3c')]);router['post']('/',auth['isAuthenticated'](),controller[_0x897a('0x3d')]);router[_0x897a('0x3b')](_0x897a('0x3e'),auth[_0x897a('0xa')](),controller['bulkCreate']);router['post'](_0x897a('0x16'),auth[_0x897a('0xa')](),controller[_0x897a('0x3f')]);var upload=multer({'storage':multer[_0x897a('0x40')]({'destination':function(_0x388b76,_0x4c8583,_0x3d042b){_0x3d042b(null,path[_0x897a('0x41')](config['root'],_0x897a('0x42')));},'filename':function(_0x4d77a7,_0x11137e,_0x29628b){_0x29628b(null,util[_0x897a('0x43')](_0x897a('0x44'),Date[_0x897a('0x45')](),_0x11137e[_0x897a('0x46')]));}})});router['post'](_0x897a('0x47'),upload[_0x897a('0x48')](_0x897a('0x49')),controller['addAvatar']);router[_0x897a('0x3b')](_0x897a('0x4a'),auth['isAuthenticated'](),controller[_0x897a('0x4b')]);router['post'](_0x897a('0x4c'),auth['isAuthenticated'](),controller['logout']);router[_0x897a('0x3b')](_0x897a('0x4d'),auth[_0x897a('0xa')](),controller[_0x897a('0x4e')]);router[_0x897a('0x3b')](_0x897a('0x4f'),auth[_0x897a('0xa')](),controller['unpause']);router[_0x897a('0x3b')]('/:id/teams',auth[_0x897a('0xa')](),controller[_0x897a('0x50')]);router['post'](_0x897a('0x51'),auth[_0x897a('0xa')](),controller['addChatInteractions']);router[_0x897a('0x3b')](_0x897a('0x52'),auth[_0x897a('0xa')](),controller['addMailInteractions']);router['post'](_0x897a('0x53'),auth['isAuthenticated'](),controller[_0x897a('0x54')]);router[_0x897a('0x3b')](_0x897a('0x55'),auth[_0x897a('0xa')](),controller[_0x897a('0x56')]);router['post']('/:id/openchannel_interactions',auth[_0x897a('0xa')](),controller[_0x897a('0x57')]);router[_0x897a('0x3b')](_0x897a('0x58'),auth[_0x897a('0xa')](),controller[_0x897a('0x59')]);router['post'](_0x897a('0x2d'),auth[_0x897a('0xa')](),controller[_0x897a('0x5a')]);router[_0x897a('0x3b')](_0x897a('0x2f'),auth[_0x897a('0xa')](),controller[_0x897a('0x5b')]);router[_0x897a('0x3b')](_0x897a('0x31'),auth[_0x897a('0xa')](),controller[_0x897a('0x5c')]);router['post'](_0x897a('0x33'),auth[_0x897a('0xa')](),controller['addSmsAccounts']);router['post'](_0x897a('0x34'),auth[_0x897a('0xa')](),controller['addChatWebsites']);router['post'](_0x897a('0x5d'),auth[_0x897a('0xa')](),controller['addWhatsappAccounts']);router[_0x897a('0x3b')](_0x897a('0x39'),auth[_0x897a('0xa')](),controller[_0x897a('0x5e')]);router['put'](_0x897a('0x11'),auth['isAuthenticated'](),controller[_0x897a('0x5f')]);router[_0x897a('0x60')](_0x897a('0x61'),auth[_0x897a('0xa')](),controller['changePassword']);router[_0x897a('0x62')]('/:id/queues',auth[_0x897a('0xa')](),controller[_0x897a('0x63')]);router[_0x897a('0x62')]('/:id/teams',auth['isAuthenticated'](),controller[_0x897a('0x64')]);router[_0x897a('0x62')]('/:id',auth['isAuthenticated'](),controller[_0x897a('0x65')]);router[_0x897a('0x62')](_0x897a('0x51'),auth[_0x897a('0xa')](),controller[_0x897a('0x66')]);router['delete'](_0x897a('0x52'),auth[_0x897a('0xa')](),controller[_0x897a('0x67')]);router[_0x897a('0x62')](_0x897a('0x53'),auth['isAuthenticated'](),controller[_0x897a('0x68')]);router[_0x897a('0x62')](_0x897a('0x55'),auth['isAuthenticated'](),controller[_0x897a('0x69')]);router['delete'](_0x897a('0x6a'),auth['isAuthenticated'](),controller[_0x897a('0x6b')]);router[_0x897a('0x62')](_0x897a('0x58'),auth[_0x897a('0xa')](),controller[_0x897a('0x6c')]);router[_0x897a('0x62')](_0x897a('0x2d'),auth[_0x897a('0xa')](),controller[_0x897a('0x6d')]);router[_0x897a('0x62')](_0x897a('0x2f'),auth[_0x897a('0xa')](),controller[_0x897a('0x6e')]);router[_0x897a('0x62')](_0x897a('0x31'),auth[_0x897a('0xa')](),controller[_0x897a('0x6f')]);router['delete'](_0x897a('0x33'),auth[_0x897a('0xa')](),controller[_0x897a('0x70')]);router['delete'](_0x897a('0x34'),auth[_0x897a('0xa')](),controller[_0x897a('0x71')]);router['delete'](_0x897a('0x5d'),auth['isAuthenticated'](),controller[_0x897a('0x72')]);router[_0x897a('0x62')]('/:id/api_key',auth[_0x897a('0xa')](),controller[_0x897a('0x73')]);module[_0x897a('0x74')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d767078..f0dfa61 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 _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0xedd9=['rfc2833','info','shortinfo','inband','auto','yes','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','certificate','active','passive','actpass','nonat','update,nonat','DATE','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsverify','rtcp_mux','dtlsenable','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','getDataValue','fullname','BOOLEAN','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x3cf175,_0x45d82e){var _0x21ae9e=function(_0x97248){while(--_0x97248){_0x3cf175['push'](_0x3cf175['shift']());}};_0x21ae9e(++_0x45d82e);}(_0xedd9,0xfc));var _0x9edd=function(_0x51d19b,_0x3a7729){_0x51d19b=_0x51d19b-0x0;var _0x5829cf=_0xedd9[_0x51d19b];return _0x5829cf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var _=require(_0x9edd('0x2'));module[_0x9edd('0x3')]={'name':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e6d3a){this[_0x9edd('0x6')]('name',_0x3e6d3a);this[_0x9edd('0x6')](_0x9edd('0x7'),_0x3e6d3a);},'comment':_0x9edd('0x8')},'fullname':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'set':function(_0x5319f7){this[_0x9edd('0x6')]('fullname',_0x5319f7);this[_0x9edd('0x6')](_0x9edd('0x9'),util[_0x9edd('0xa')](_0x9edd('0xb'),_0x5319f7,this['getDataValue'](_0x9edd('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0xd'),'validate':{'isEmail':!![]},'set':function(_0x523026){if(_0x523026){this[_0x9edd('0x6')](_0x9edd('0xd'),_0x523026['toLowerCase']());}}},'role':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0xf'),_0x9edd('0x10'),_0x9edd('0x11'),_0x9edd('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':_0x9edd('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x9edd('0xc'),'set':function(_0x44fc7c){this[_0x9edd('0x6')](_0x9edd('0xc'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x14'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x9'),util['format'](_0x9edd('0xb'),this[_0x9edd('0x15')](_0x9edd('0x16')),_0x44fc7c));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9edd('0x4')]},'mobile':{'type':Sequelize[_0x9edd('0x4')]},'address':{'type':Sequelize[_0x9edd('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x9edd('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9edd('0x4')]},'online':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9edd('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9edd('0x19')},'ipaddr':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x9edd('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x1a'),'user',_0x9edd('0x1b')),'allowNull':!![],'defaultValue':_0x9edd('0x1a')},'context':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x9edd('0x1d'),_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x25'),'set':function(_0x5af178){this[_0x9edd('0x6')](_0x9edd('0x26'),_0x5af178?_0x5af178[_0x9edd('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x9edd('0x26'))?this[_0x9edd('0x15')](_0x9edd('0x26'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x29')},'dtmfmode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2a'),_0x9edd('0x2b'),_0x9edd('0x2c'),_0x9edd('0x2d'),_0x9edd('0x2e')),'allowNull':!![],'defaultValue':_0x9edd('0x2a')},'directmedia':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no','nonat',_0x9edd('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x6de835){this[_0x9edd('0x6')](_0x9edd('0x31'),_0x6de835?_0x6de835[_0x9edd('0x27')](','):null);},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x31'))?this[_0x9edd('0x15')](_0x9edd('0x31'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9edd('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9edd('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9edd('0x4')]},'disallow':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'defaultValue':_0x9edd('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9edd('0x34'),'set':function(_0xcbd0ef){this[_0x9edd('0x6')]('allow',_0xcbd0ef?_0xcbd0ef[_0x9edd('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x35'))?this['getDataValue'](_0x9edd('0x35'))[_0x9edd('0x28')](';'):null;},'comment':_0x9edd('0x36')},'autoframing':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'set':function(_0x5bbdf8){this[_0x9edd('0x6')](_0x9edd('0x37'),_0x5bbdf8?_0x5bbdf8['join'](','):null);},'get':function(){return this[_0x9edd('0x15')]('insecure')?this['getDataValue'](_0x9edd('0x37'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x38')},'trustrpid':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x3a')},'amaflags':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'busylevel':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no',_0x9edd('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x3c'),_0x9edd('0x3d'),_0x9edd('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9edd('0xe')]('uac',_0x9edd('0x3f')),'allowNull':!![],'defaultValue':_0x9edd('0x3f')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'keepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x9edd('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x41'),_0x9edd('0x42'),_0x9edd('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x44'),_0x9edd('0x30'),_0x9edd('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0,'set':function(_0x3e9a3e){this[_0x9edd('0x6')](_0x9edd('0x47'),_0x3e9a3e);var _0x5df1d7=this[_0x9edd('0x48')]({'plain':!![]});switch(_0x3e9a3e){case 0x0:case 0x1:var _0x507cce=_0x5df1d7[_0x9edd('0x26')]?_[_0x9edd('0x49')](_0x5df1d7[_0x9edd('0x26')])?_0x5df1d7['transport'][_0x9edd('0x27')]():_0x5df1d7['transport']:_0x9edd('0x25');if(_0x507cce===_0x9edd('0x4a')){_0x507cce='udp';}this[_0x9edd('0x6')]('transport',_0x507cce);this[_0x9edd('0x6')](_0x9edd('0x4b'),'no');this[_0x9edd('0x6')]('avpf',null);this[_0x9edd('0x6')](_0x9edd('0x4c'),null);this[_0x9edd('0x6')](_0x9edd('0x4d'),null);this[_0x9edd('0x6')]('dtlsenable',null);this['setDataValue'](_0x9edd('0x4e'),null);this[_0x9edd('0x6')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0x9edd('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x9edd('0x4f'),'no');break;case 0x2:this[_0x9edd('0x6')]('transport',_0x9edd('0x4a'));this[_0x9edd('0x6')](_0x9edd('0x4b'),'yes');this[_0x9edd('0x6')]('avpf',_0x9edd('0x2f'));this[_0x9edd('0x6')]('force_avp',_0x9edd('0x2f'));this[_0x9edd('0x6')]('icesupport',_0x9edd('0x2f'));this[_0x9edd('0x6')](_0x9edd('0x50'),_0x9edd('0x2f'));this['setDataValue'](_0x9edd('0x4e'),'no');this['setDataValue'](_0x9edd('0x51'),_0x9edd('0x43'));this[_0x9edd('0x6')]('dtlscertfile',_0x5df1d7[_0x9edd('0x52')]||_0x9edd('0x53'));this[_0x9edd('0x6')](_0x9edd('0x54'),_0x5df1d7[_0x9edd('0x54')]||_0x9edd('0x55'));this[_0x9edd('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x9edd('0x56')],'set':function(_0x3c7874){this[_0x9edd('0x6')](_0x9edd('0x57'),_0x3c7874?_0x3c7874[_0x9edd('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0x9edd('0x57'))?_[_0x9edd('0x58')](this[_0x9edd('0x15')]('permissions')[_0x9edd('0x28')](','),function(_0x29d70d){return parseInt(_0x29d70d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9edd('0x59')],'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x5a'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x1eabcd){if(typeof _0x1eabcd===_0x9edd('0x5b')){var _0xef1397=_0x1eabcd==='1'?!![]:_0x1eabcd==='0'?![]:_0x1eabcd==='true'?!![]:_0x1eabcd===_0x9edd('0x5c')?![]:![];this[_0x9edd('0x6')](_0x9edd('0x5d'),_0xef1397);}else{this[_0x9edd('0x6')](_0x9edd('0x5d'),_0x1eabcd);}}},'blocked':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x14fa8a){this['setDataValue'](_0x9edd('0x5e'),_0x14fa8a);if(_0x14fa8a===!![]){this[_0x9edd('0x6')]('blockedAt',moment());this[_0x9edd('0x6')](_0x9edd('0x5f'),0x0);}else{this['setDataValue'](_0x9edd('0x60'),null);}}},'blockedAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9edd('0x18')](0x5)[_0x9edd('0x61')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index a526035..8cb1a7c 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 _0x7a5a=['type','key','includes','getOptions','where','count','query','includeAll','userSetting','true','include','UserSetting','attributes','push','findAll','rows','openTabs','chat','dataValues','sms','mail','all','show','params','model','differenceBy','keys','password','salt','intersection','fields','length','merge','find','openchannel','fax','body','describe','addContacts','ids','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','permissions','101','102','103','113','104','105','107','108','109','100','114','115','create','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','userProfileId','UserProfileSection','Agents','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','isEmpty','changePassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','oldPassword','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','updatePasswordsHistory','addQueues','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','toLowerCase','penalty','QueueId','capitalize','Queue:save','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','removeQueues','channel','remove','Queues','emit','Queue:remove','addAvatar','userpic','file','filename','join','root','download','server/files/images/','getOpenTabs','whatsapp','CHAT','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tags','color','tag','getQueues','Queue','filters','order','sort','Unknown\x20role','nolimit','getVoiceQueuesRt','pick','options','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','resolve','logout','forEach','pause','online','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','upsert','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$gt','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','CmHopper','firstName','lastName','CmContact','Contact','getApiKey','retrieveApiKey','status','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','inbound','flatten','getAgents','lower','col','desc','asc','substring','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','busy','slice','select','field','InteractionId','ui.createdAt','user_has_','ui.UserId\x20=\x20?','toString','OpenTabs','moment','util','path','lodash','squel','jayson/promise','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','set','Content-Range','update','role','agent','userNotification:recalc:','destroy','get','Users','Telephones','filter','ignore','map','value','name','send','index','User','rawAttributes','fieldName'];(function(_0x2ca228,_0x3f8578){var _0x1e8602=function(_0x2b0157){while(--_0x2b0157){_0x2ca228['push'](_0x2ca228['shift']());}};_0x1e8602(++_0x3f8578);}(_0x7a5a,0x15a));var _0xa7a5=function(_0x22e184,_0x13f9c9){_0x22e184=_0x22e184-0x0;var _0x3e9c6e=_0x7a5a[_0x22e184];return _0x3e9c6e;};'use strict';var moment=require(_0xa7a5('0x0'));var util=require(_0xa7a5('0x1'));var path=require(_0xa7a5('0x2'));var fs=require('fs');var _=require(_0xa7a5('0x3'));var squel=require(_0xa7a5('0x4'));var jayson=require(_0xa7a5('0x5'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var contacts=require(_0xa7a5('0x6'));var qs=require(_0xa7a5('0x7'));var logger=require(_0xa7a5('0x8'))(_0xa7a5('0x9'));var utils=require(_0xa7a5('0xa'));var config=require(_0xa7a5('0xb'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0xa7a5('0xc'))[_0xa7a5('0xd')];var APINotFoundError=require(_0xa7a5('0xc'))[_0xa7a5('0xe')];var APIHandleError=require('../../errors/api')[_0xa7a5('0xf')];var db=require(_0xa7a5('0x10'))['db'];var socket=require(_0xa7a5('0x11'))(new Redis(config[_0xa7a5('0x12')]));require(_0xa7a5('0x13'))[_0xa7a5('0x14')](socket);config[_0xa7a5('0x12')]=_[_0xa7a5('0x15')](config[_0xa7a5('0x12')],{'host':_0xa7a5('0x16'),'port':0x18eb});var amiClient=jayson['client'][_0xa7a5('0x17')]({'port':0x232a});var values;function respondWithRpcPromise(_0x15c33f,_0x45abe0,_0xb7c6d3,_0x4cf730){return new Promise(function(_0x4c1000,_0x5a3052){var _0x3d3bd5=_0x4cf730||amiClient;return _0x3d3bd5[_0xa7a5('0x18')](_0x15c33f,_0xb7c6d3)[_0xa7a5('0x19')](function(_0x5c88c6){logger[_0xa7a5('0x1a')](_0xa7a5('0x1b'),_0x45abe0,_0xa7a5('0x1c'));logger['debug'](_0xa7a5('0x1d'),_0x45abe0,_0xa7a5('0x1c'),JSON[_0xa7a5('0x1e')](_0x5c88c6));if(_0x5c88c6['error']){if(_0x5c88c6[_0xa7a5('0x1f')][_0xa7a5('0x20')]===0x1f4){logger[_0xa7a5('0x1f')](_0xa7a5('0x1b'),_0x45abe0,_0x5c88c6[_0xa7a5('0x1f')][_0xa7a5('0x21')]);return _0x5a3052(_0x5c88c6['error'][_0xa7a5('0x21')]);}logger[_0xa7a5('0x1f')](_0xa7a5('0x1b'),_0x45abe0,_0x5c88c6[_0xa7a5('0x1f')][_0xa7a5('0x21')]);return _0x4c1000(_0x5c88c6[_0xa7a5('0x1f')][_0xa7a5('0x21')]);}else{logger[_0xa7a5('0x1a')](_0xa7a5('0x1b'),_0x45abe0,_0xa7a5('0x1c'));_0x4c1000(_0x5c88c6[_0xa7a5('0x22')][_0xa7a5('0x21')]);}})[_0xa7a5('0x23')](function(_0x107d18){logger[_0xa7a5('0x1f')](_0xa7a5('0x1b'),_0x45abe0,_0x107d18);_0x5a3052(_0x107d18);});});}function respondWithStatusCode(_0x44c2d5,_0xc83b72){_0xc83b72=_0xc83b72||0xcc;return function(_0x287421){if(_0x287421){return _0x44c2d5[_0xa7a5('0x24')](_0xc83b72);}return _0x44c2d5['status'](_0xc83b72)[_0xa7a5('0x25')]();};}function respondWithResult(_0xb881fd,_0x286cfd){_0x286cfd=_0x286cfd||0xc8;return function(_0x1a148c){if(_0x1a148c){return _0xb881fd['status'](_0x286cfd)[_0xa7a5('0x26')](_0x1a148c);}};}function respondWithFilteredResult(_0x3d430d,_0x25eacb){return function(_0x29bb3c){if(_0x29bb3c){var _0x3fe182=typeof _0x25eacb[_0xa7a5('0x27')]===_0xa7a5('0x28')&&typeof _0x25eacb['limit']===_0xa7a5('0x28');var _0x365523=_0x29bb3c['count'];var _0x566d7e=_0x3fe182?0x0:_0x25eacb[_0xa7a5('0x27')];var _0x2446a3=_0x3fe182?_0x29bb3c['count']:_0x25eacb['offset']+_0x25eacb[_0xa7a5('0x29')];var _0x3eebad;if(_0x2446a3>=_0x365523){_0x2446a3=_0x365523;_0x3eebad=0xc8;}else{_0x3eebad=0xce;}_0x3d430d['status'](_0x3eebad);return _0x3d430d[_0xa7a5('0x2a')](_0xa7a5('0x2b'),_0x566d7e+'-'+_0x2446a3+'/'+_0x365523)['json'](_0x29bb3c);}return null;};}function saveUpdates(_0x2e5c68){return function(_0x56c02a){if(_0x56c02a){return _0x56c02a[_0xa7a5('0x2c')](_0x2e5c68)[_0xa7a5('0x19')](function(_0x2ecb39){if(_0x2ecb39[_0xa7a5('0x2d')]===_0xa7a5('0x2e')){socket['emit'](_0xa7a5('0x2f')+_0x2ecb39['id'],_0x2ecb39);}return _0x2ecb39;});}return null;};}function removeEntity(_0x880401){return function(_0x2b3e21){if(_0x2b3e21){return _0x2b3e21[_0xa7a5('0x30')]()[_0xa7a5('0x19')](function(){var _0x5d2e68=_0x2b3e21[_0xa7a5('0x31')]({'plain':!![]});if(_0x5d2e68[_0xa7a5('0x2d')]==='admin')return;var _0x32eb9f=[{'name':_0xa7a5('0x32'),'value':'user','ignore':!![]},{'name':'Agents','value':_0xa7a5('0x2e'),'ignore':![]},{'name':_0xa7a5('0x33'),'value':'telephone','ignore':![]}];var _0x20ad69=_(_0x32eb9f)[_0xa7a5('0x34')](_0xa7a5('0x35'))[_0xa7a5('0x36')](_0xa7a5('0x37'))[_0xa7a5('0x37')]();if(_['includes'](_0x20ad69,_0x5d2e68[_0xa7a5('0x2d')])){return;}var _0x5745bf=_['find'](_0x32eb9f,[_0xa7a5('0x37'),_0x5d2e68['role']])[_0xa7a5('0x38')];return db['UserProfileResource']['destroy']({'where':{'type':_0x5745bf,'resourceId':_0x5d2e68['id']}})[_0xa7a5('0x19')](function(){return _0x2b3e21;});})[_0xa7a5('0x19')](function(){_0x880401['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e4a75){return function(_0x46101a){if(!_0x46101a){_0x3e4a75[_0xa7a5('0x24')](0x194);}return _0x46101a;};}function handleError(_0x34b6d0,_0x211e24){_0x211e24=_0x211e24||0x1f4;return function(_0x6ef113){logger['error'](_0x6ef113['stack']);if(_0x6ef113['name']){delete _0x6ef113[_0xa7a5('0x38')];}_0x34b6d0['status'](_0x211e24)[_0xa7a5('0x39')](_0x6ef113);};}exports[_0xa7a5('0x3a')]=function(_0x2f01a0,_0x210aa1){var _0x158b24={},_0xedecb6={'count':0x0,'rows':[]};var _0x19fbdc=_(db[_0xa7a5('0x3b')][_0xa7a5('0x3c')])['map'](function(_0x497689){return{'name':_0x497689[_0xa7a5('0x3d')],'type':_0x497689[_0xa7a5('0x3e')][_0xa7a5('0x3f')]};})['filter'](function(_0x11c319){return!_[_0xa7a5('0x40')](['password','salt'],_0x11c319[_0xa7a5('0x38')]);})[_0xa7a5('0x37')]();_0x158b24=qs[_0xa7a5('0x41')](_0x19fbdc,_0x2f01a0);var _0x24bf6c={'where':_0x158b24[_0xa7a5('0x42')]};return db[_0xa7a5('0x3b')][_0xa7a5('0x43')](_0x24bf6c)[_0xa7a5('0x19')](function(_0x3b6860){_0xedecb6['count']=_0x3b6860;if(_0x2f01a0[_0xa7a5('0x44')][_0xa7a5('0x45')]){_0x158b24['include']=[{'all':!![]}];}if(_0x2f01a0[_0xa7a5('0x44')][_0xa7a5('0x46')]===_0xa7a5('0x47')){_0x158b24[_0xa7a5('0x48')]=[{'model':db[_0xa7a5('0x49')],'as':_0xa7a5('0x46')}];}if(!_[_0xa7a5('0x40')](_0x158b24[_0xa7a5('0x4a')],'id')){_0x158b24[_0xa7a5('0x4a')][_0xa7a5('0x4b')]('id');}return db[_0xa7a5('0x3b')][_0xa7a5('0x4c')](_0x158b24);})[_0xa7a5('0x19')](function(_0x1987b2){_0xedecb6[_0xa7a5('0x4d')]=_0x1987b2;if(_0x2f01a0['query'][_0xa7a5('0x4e')]===_0xa7a5('0x47')){var _0x60bf1e=[];for(var _0x57aeb6=0x0;_0x57aeb6<_0xedecb6[_0xa7a5('0x4d')]['length'];_0x57aeb6++){_0x60bf1e[_0xa7a5('0x4b')](get_open_tabs(_0xa7a5('0x4f'),_0xedecb6[_0xa7a5('0x4d')][_0x57aeb6][_0xa7a5('0x50')]));_0x60bf1e['push'](get_open_tabs(_0xa7a5('0x51'),_0xedecb6['rows'][_0x57aeb6]['dataValues']));_0x60bf1e['push'](get_open_tabs('fax',_0xedecb6[_0xa7a5('0x4d')][_0x57aeb6][_0xa7a5('0x50')]));_0x60bf1e[_0xa7a5('0x4b')](get_open_tabs(_0xa7a5('0x52'),_0xedecb6[_0xa7a5('0x4d')][_0x57aeb6][_0xa7a5('0x50')]));_0x60bf1e[_0xa7a5('0x4b')](get_open_tabs('openchannel',_0xedecb6[_0xa7a5('0x4d')][_0x57aeb6][_0xa7a5('0x50')]));_0x60bf1e[_0xa7a5('0x4b')](get_open_tabs('whatsapp',_0xedecb6[_0xa7a5('0x4d')][_0x57aeb6][_0xa7a5('0x50')]));}return Promise[_0xa7a5('0x53')](_0x60bf1e)[_0xa7a5('0x19')](function(){return _0xedecb6;});}else{return _0xedecb6;}})[_0xa7a5('0x19')](respondWithFilteredResult(_0x210aa1,_0x158b24))[_0xa7a5('0x23')](handleError(_0x210aa1,null));};exports[_0xa7a5('0x54')]=function(_0xb7dc4c,_0x117d02){var _0x4be032={'raw':![],'where':{'id':_0xb7dc4c[_0xa7a5('0x55')]['id']}},_0x5e48f9={};_0x5e48f9[_0xa7a5('0x56')]=_[_0xa7a5('0x57')](_[_0xa7a5('0x58')](db[_0xa7a5('0x3b')]['rawAttributes']),[_0xa7a5('0x59'),_0xa7a5('0x5a')]);_0x5e48f9[_0xa7a5('0x44')]=_['keys'](_0xb7dc4c['query']);_0x5e48f9['filters']=_[_0xa7a5('0x5b')](_0x5e48f9[_0xa7a5('0x56')],_0x5e48f9[_0xa7a5('0x44')]);_0x4be032['attributes']=_[_0xa7a5('0x5b')](_0x5e48f9[_0xa7a5('0x56')],qs['fields'](_0xb7dc4c[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x4be032[_0xa7a5('0x4a')]=_0x4be032['attributes'][_0xa7a5('0x5d')]?_0x4be032[_0xa7a5('0x4a')]:_0x5e48f9[_0xa7a5('0x56')];if(_0xb7dc4c['query'][_0xa7a5('0x45')]){_0x4be032[_0xa7a5('0x48')]=[{'all':!![]}];}if(_0xb7dc4c[_0xa7a5('0x44')][_0xa7a5('0x46')]===_0xa7a5('0x47')){_0x4be032[_0xa7a5('0x48')]=[{'model':db[_0xa7a5('0x49')],'as':'userSetting'}];}_0x4be032=_[_0xa7a5('0x5e')]({},_0x4be032,_0xb7dc4c['options']);if(!_[_0xa7a5('0x40')](_0x4be032[_0xa7a5('0x4a')],'id')){_0x4be032[_0xa7a5('0x4a')][_0xa7a5('0x4b')]('id');}return db[_0xa7a5('0x3b')][_0xa7a5('0x5f')](_0x4be032)[_0xa7a5('0x19')](handleEntityNotFound(_0x117d02,null))['then'](function(_0x36a858){var _0xa51d95=[];values=_0x36a858;if(_0xb7dc4c[_0xa7a5('0x44')]['openTabs']===_0xa7a5('0x47')){_0xa51d95[_0xa7a5('0x4b')](get_open_tabs('chat',_0x36a858[_0xa7a5('0x50')]));_0xa51d95[_0xa7a5('0x4b')](get_open_tabs(_0xa7a5('0x51'),_0x36a858[_0xa7a5('0x50')]));_0xa51d95[_0xa7a5('0x4b')](get_open_tabs(_0xa7a5('0x60'),_0x36a858[_0xa7a5('0x50')]));_0xa51d95[_0xa7a5('0x4b')](get_open_tabs('whatsapp',_0x36a858[_0xa7a5('0x50')]));_0xa51d95[_0xa7a5('0x4b')](get_open_tabs(_0xa7a5('0x61'),_0x36a858[_0xa7a5('0x50')]));_0xa51d95[_0xa7a5('0x4b')](get_open_tabs(_0xa7a5('0x52'),_0x36a858[_0xa7a5('0x50')]));return Promise[_0xa7a5('0x53')](_0xa51d95);}else{return values;}})[_0xa7a5('0x19')](function(){return values;})[_0xa7a5('0x19')](respondWithResult(_0x117d02,null))[_0xa7a5('0x23')](handleError(_0x117d02,null));};exports['update']=function(_0x4babe5,_0x773e6a){if(_0x4babe5['body']['id']){delete _0x4babe5[_0xa7a5('0x62')]['id'];}delete _0x4babe5['body'][_0xa7a5('0x2d')];return db[_0xa7a5('0x3b')]['find']({'where':{'id':_0x4babe5[_0xa7a5('0x55')]['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0x773e6a,null))['then'](saveUpdates(_0x4babe5[_0xa7a5('0x62')],null))['then'](respondWithResult(_0x773e6a,null))['catch'](handleError(_0x773e6a,null));};exports['describe']=function(_0x1c6744,_0x2d9bad){return db[_0xa7a5('0x3b')][_0xa7a5('0x63')]()['then'](respondWithResult(_0x2d9bad,null))[_0xa7a5('0x23')](handleError(_0x2d9bad,null));};exports[_0xa7a5('0x64')]=function(_0x5b89c7,_0x549236){return db[_0xa7a5('0x3b')][_0xa7a5('0x5f')]({'where':{'id':_0x5b89c7[_0xa7a5('0x55')]['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0x549236,null))['then'](function(_0x4eb421){if(_0x4eb421){return _0x4eb421[_0xa7a5('0x64')](_0x5b89c7[_0xa7a5('0x62')][_0xa7a5('0x65')],_['omit'](_0x5b89c7[_0xa7a5('0x62')],[_0xa7a5('0x65'),'id'])||{});}})[_0xa7a5('0x19')](respondWithResult(_0x549236,null))['catch'](handleError(_0x549236,null));};function validateUser(_0x4d8530){return new Promise(function(_0xd68126,_0x265562){if(_0x4d8530[_0xa7a5('0x66')])return _0xd68126(_0x4d8530);return db[_0xa7a5('0x67')]['findById'](0x1)[_0xa7a5('0x19')](function(_0x26b31f){if(_0x26b31f[_0xa7a5('0x68')])authService[_0xa7a5('0x69')](_0x4d8530[_0xa7a5('0x59')]);db[_0xa7a5('0x3b')][_0xa7a5('0x6a')](_0xa7a5('0x66'))[_0xa7a5('0x19')](function(_0x9ed96d){if(_[_0xa7a5('0x6b')](_0x9ed96d)){_0x4d8530['internal']=_0x26b31f[_0xa7a5('0x6c')]||0x1;return;}if(_[_0xa7a5('0x6b')](_0x26b31f[_0xa7a5('0x6c')])||_0x26b31f['min_internal']===_0x9ed96d){_0x4d8530[_0xa7a5('0x66')]=_0x9ed96d+0x1;return;}if(_0x26b31f[_0xa7a5('0x6c')]>_0x9ed96d){_0x4d8530[_0xa7a5('0x66')]=_0x26b31f[_0xa7a5('0x6c')];return;}return db['sequelize'][_0xa7a5('0x44')](_0xa7a5('0x6d'),{'type':db[_0xa7a5('0x6e')][_0xa7a5('0x6f')][_0xa7a5('0x70')]})[_0xa7a5('0x19')](function(_0xe131a1){if(_0xe131a1&&_0xe131a1[_0xa7a5('0x5d')]){for(var _0x9a7ccb=0x0,_0x297698=_0xe131a1[_0xa7a5('0x5d')];_0x9a7ccb<_0x297698&&_[_0xa7a5('0x6b')](_0x4d8530[_0xa7a5('0x66')]);_0x9a7ccb++){if(_0x26b31f[_0xa7a5('0x6c')]<=_0xe131a1[_0x9a7ccb][_0xa7a5('0x71')]){_0x4d8530['internal']=_0xe131a1[_0x9a7ccb][_0xa7a5('0x71')];}else if(_0x26b31f[_0xa7a5('0x6c')]>_0xe131a1[_0x9a7ccb]['from']&&_0x26b31f[_0xa7a5('0x6c')]<=_0xe131a1[_0x9a7ccb]['to']){_0x4d8530[_0xa7a5('0x66')]=_0x26b31f[_0xa7a5('0x6c')];}}}if(_[_0xa7a5('0x6b')](_0x4d8530[_0xa7a5('0x66')])){_0x4d8530[_0xa7a5('0x66')]=_0x9ed96d+0x1;}return _0xd68126(_0x4d8530);});});})['catch'](function(_0x46a093){_0x265562(_0x46a093);});});}function updateUser(_0x16d19b){return new Promise(function(_0xb900ae,_0x31663c){try{if(_0x16d19b[_0xa7a5('0x72')]){_0x16d19b[_0xa7a5('0x73')]=_0x16d19b[_0xa7a5('0x66')];_0x16d19b[_0xa7a5('0x74')]={'mailbox':_0x16d19b[_0xa7a5('0x66')],'password':_0x16d19b[_0xa7a5('0x59')],'fullname':_0x16d19b[_0xa7a5('0x75')],'email':_0x16d19b['email']};}if(_0x16d19b[_0xa7a5('0x2d')]===_0xa7a5('0x2e')){if(!_0x16d19b[_0xa7a5('0x76')])_0x16d19b[_0xa7a5('0x76')]=[_0xa7a5('0x77'),_0xa7a5('0x78'),_0xa7a5('0x79'),_0xa7a5('0x7a'),'110',_0xa7a5('0x7b'),_0xa7a5('0x7c'),'106',_0xa7a5('0x7d'),_0xa7a5('0x7e'),_0xa7a5('0x7f'),_0xa7a5('0x80'),'111',_0xa7a5('0x81'),_0xa7a5('0x82')];}_0xb900ae(_0x16d19b);}catch(_0x1ecfba){_0x31663c(_0x1ecfba);}});}exports[_0xa7a5('0x83')]=function(_0x1ab705,_0x463cf6){if(_0x1ab705[_0xa7a5('0x84')]['role']===_0xa7a5('0x2e'))throw new Error('Unauthorized');if(_0x1ab705['body'][_0xa7a5('0x2d')]==='user'&&_0x1ab705[_0xa7a5('0x84')][_0xa7a5('0x2d')]!=='admin'){throw new Error(_0xa7a5('0x85'));}if(_0x1ab705[_0xa7a5('0x62')][_0xa7a5('0x2d')]==='admin'&&_0x1ab705[_0xa7a5('0x84')]['role']!==_0xa7a5('0x86')){throw new Error(_0xa7a5('0x87'));}return licenseUtil[_0xa7a5('0x88')]([_0x1ab705[_0xa7a5('0x62')]])[_0xa7a5('0x19')](function(){return validateUser(_0x1ab705[_0xa7a5('0x62')]);})[_0xa7a5('0x19')](function(_0x55ebdb){return updateUser(_0x55ebdb)[_0xa7a5('0x19')](function(_0x2b78ad){if(_0x2b78ad[_0xa7a5('0x2d')]===_0xa7a5('0x86')){_0x2b78ad['settingsEnabled']=_0x1ab705[_0xa7a5('0x84')]['settingsEnabled'];delete _0x2b78ad[_0xa7a5('0x89')];}return _0x2b78ad;});})[_0xa7a5('0x19')](function(_0x31b691){return db['User'][_0xa7a5('0x83')](_0x31b691,{'include':[{'model':db['VoiceMail'],'as':_0xa7a5('0x74')}]});})[_0xa7a5('0x19')](function(_0x5d13de){if(_0x1ab705[_0xa7a5('0x62')]['role']==='user')return _0x5d13de;if(_0x1ab705['user'][_0xa7a5('0x2d')]!=='user')return _0x5d13de;return db[_0xa7a5('0x8a')][_0xa7a5('0x5f')]({'where':{'name':_0x5d13de[_0xa7a5('0x2d')]==='agent'?_0xa7a5('0x8b'):'Telephones','userProfileId':_0x1ab705['user']['userProfileId']},'raw':!![]})[_0xa7a5('0x19')](function(_0x1aada0){if(!_0x1aada0||_0x1aada0[_0xa7a5('0x8c')]!=0x0)return _0x5d13de;return db[_0xa7a5('0x8d')][_0xa7a5('0x83')]({'name':_0x5d13de['name'],'resourceId':_0x5d13de['id'],'type':_0x1aada0[_0xa7a5('0x38')],'sectionId':_0x1aada0['id']},{})['then'](function(){return _0x5d13de;});})['catch'](function(_0x28d0df){logger[_0xa7a5('0x1f')](_0xa7a5('0x8e'),_0x28d0df);throw _0x28d0df;});})[_0xa7a5('0x19')](respondWithResult(_0x463cf6,0xc9))[_0xa7a5('0x23')](handleError(_0x463cf6,null));};exports[_0xa7a5('0x8f')]=function(_0x21a554,_0x547092){var _0x570347=_0x21a554[_0xa7a5('0x62')];var _0x85e110=[];if(_0x21a554[_0xa7a5('0x84')][_0xa7a5('0x2d')]===_0xa7a5('0x2e'))throw new Error(_0xa7a5('0x90'));if(_[_0xa7a5('0x91')](_0x570347,[_0xa7a5('0x2d'),_0xa7a5('0x84')])&&_0x21a554[_0xa7a5('0x84')]['role']!==_0xa7a5('0x86')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xa7a5('0x91')](_0x570347,['role',_0xa7a5('0x86')])&&_0x21a554[_0xa7a5('0x84')][_0xa7a5('0x2d')]!==_0xa7a5('0x86')){throw new Error(_0xa7a5('0x92'));}return licenseUtil[_0xa7a5('0x88')](_0x570347)[_0xa7a5('0x19')](function(){return validateUser(_0x570347[0x0]);})[_0xa7a5('0x19')](function(){for(var _0x58b208=0x1;_0x58b208<_0x570347['length'];_0x58b208++){var _0x43263e=_0x570347[_0x58b208-0x1][_0xa7a5('0x66')];if(!_0x570347[_0x58b208][_0xa7a5('0x66')])_0x570347[_0x58b208]['internal']=_0x43263e+0x1;_0x85e110[_0xa7a5('0x4b')](validateUser(_0x570347[_0x58b208]));}return Promise[_0xa7a5('0x53')](_0x85e110);})[_0xa7a5('0x19')](function(){_0x85e110=[];for(var _0x17028b=0x0;_0x17028b<_0x570347[_0xa7a5('0x5d')];_0x17028b++){_0x85e110[_0xa7a5('0x4b')](updateUser(_0x570347[_0x17028b]));}return Promise[_0xa7a5('0x53')](_0x85e110);})[_0xa7a5('0x19')](function(){_0x85e110=_0x570347[_0xa7a5('0x36')](function(_0x45832f){return db[_0xa7a5('0x3b')][_0xa7a5('0x83')](_0x45832f,{'include':[{'model':db[_0xa7a5('0x74')],'as':_0xa7a5('0x74')}]})['then'](function(_0x5ee5de){_0x45832f['id']=_0x5ee5de['id'];return _0x45832f;});});return Promise[_0xa7a5('0x53')](_0x85e110);})[_0xa7a5('0x19')](function(_0x1fe9dc){if(_0x21a554[_0xa7a5('0x62')][_0xa7a5('0x2d')]===_0xa7a5('0x84'))return _0x1fe9dc;if(_0x21a554[_0xa7a5('0x84')][_0xa7a5('0x2d')]!==_0xa7a5('0x84'))return _0x1fe9dc;var _0x11e63b=_['some'](_0x1fe9dc,function(_0x28acbb){return _0x28acbb[_0xa7a5('0x2d')]===_0xa7a5('0x2e')||_0x28acbb[_0xa7a5('0x2d')]===_0xa7a5('0x93');});if(!_0x11e63b)return _0x1fe9dc;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0xa7a5('0x8b'),_0xa7a5('0x33')]},'userProfileId':_0x21a554[_0xa7a5('0x84')][_0xa7a5('0x89')]},'raw':!![]})[_0xa7a5('0x19')](function(_0x7d6ba0){if(_[_0xa7a5('0x94')](_0x7d6ba0)||!_[_0xa7a5('0x91')](_0x7d6ba0,[_0xa7a5('0x8c'),0x0]))return _0x1fe9dc;_0x85e110=[];var _0x5e2f94=_(_0x7d6ba0)['map'](function(_0x22414f){if(_0x22414f[_0xa7a5('0x8c')]===0x1)return;return _0x22414f[_0xa7a5('0x38')]===_0xa7a5('0x8b')?_0xa7a5('0x2e'):_0xa7a5('0x93');})['compact']()[_0xa7a5('0x37')]();for(var _0x190d03=0x0;_0x190d03<_0x1fe9dc[_0xa7a5('0x5d')];_0x190d03++){if(!_[_0xa7a5('0x40')](_0x5e2f94,_0x1fe9dc[_0x190d03][_0xa7a5('0x2d')]))return;var _0x55aee1=_0x1fe9dc[_0x190d03][_0xa7a5('0x2d')]==='agent'?'Agents':_0xa7a5('0x33');_0x85e110[_0xa7a5('0x4b')](db[_0xa7a5('0x8d')][_0xa7a5('0x83')]({'name':_0x1fe9dc[_0x190d03][_0xa7a5('0x38')],'resourceId':_0x1fe9dc[_0x190d03]['id'],'type':_0x55aee1,'sectionId':_[_0xa7a5('0x5f')](_0x7d6ba0,[_0xa7a5('0x38'),_0x55aee1])['id']},{}));}return Promise['all'](_0x85e110);});})[_0xa7a5('0x19')](respondWithResult(_0x547092,0xc9))[_0xa7a5('0x23')](handleError(_0x547092,null));};exports[_0xa7a5('0x95')]=function(_0x3830fc,_0x6d93fe){if(_0x3830fc[_0xa7a5('0x62')]['id']){delete _0x3830fc[_0xa7a5('0x62')]['id'];}return db[_0xa7a5('0x3b')][_0xa7a5('0x5f')]({'where':{'id':_0x3830fc['params']['id']}})[_0xa7a5('0x19')](function(_0x18bc21){if(!_0x18bc21)return null;if(_0x18bc21['id']===_0x3830fc[_0xa7a5('0x84')]['id']){if(!_0x3830fc[_0xa7a5('0x62')]['oldPassword']||!_0x3830fc[_0xa7a5('0x62')]['newPassword']){throw new db[(_0xa7a5('0x96'))]['ValidationError'](_0xa7a5('0x97'));}if(!_0x18bc21[_0xa7a5('0x98')](_0x3830fc[_0xa7a5('0x62')]['oldPassword'])){throw new db[(_0xa7a5('0x96'))][(_0xa7a5('0x99'))]('Wrong\x20credentials');}if(_0x3830fc['body'][_0xa7a5('0x9a')]===_0x3830fc['body'][_0xa7a5('0x9b')]){throw new db[(_0xa7a5('0x96'))][(_0xa7a5('0x99'))](_0xa7a5('0x9c'));}}else if(_0x3830fc[_0xa7a5('0x84')][_0xa7a5('0x2d')]==='admin'){if(!_0x3830fc[_0xa7a5('0x62')][_0xa7a5('0x9b')]){throw new db[(_0xa7a5('0x96'))][(_0xa7a5('0x99'))](_0xa7a5('0x9d'));}}else if(_0x3830fc[_0xa7a5('0x84')][_0xa7a5('0x2d')]===_0xa7a5('0x84')){if(!_0x3830fc[_0xa7a5('0x62')]['newPassword']){throw new db['Sequelize'][(_0xa7a5('0x99'))](_0xa7a5('0x9d'));}if(_0x18bc21['role']!=='agent'){throw new db[(_0xa7a5('0x96'))][(_0xa7a5('0x99'))]('Unauthorized');}}else{throw new db[(_0xa7a5('0x96'))][(_0xa7a5('0x99'))]('Unauthorized');}return _0x18bc21;})[_0xa7a5('0x19')](handleEntityNotFound(_0x6d93fe,null))[_0xa7a5('0x19')](function(_0x41f8c6){return db['Setting'][_0xa7a5('0x9e')]({'attributes':['id',_0xa7a5('0x68'),'enforcePasswordHistory',_0xa7a5('0x9f')]})[_0xa7a5('0x19')](function(_0x5495fa){if(_0x5495fa[_0xa7a5('0x68')])authService['validatePasswordPattern'](_0x3830fc[_0xa7a5('0x62')][_0xa7a5('0x9b')]);if(!_0x5495fa[_0xa7a5('0xa0')]||!_0x41f8c6[_0xa7a5('0xa1')])return _0x41f8c6;authService['validatePasswordHistory'](_0x3830fc[_0xa7a5('0x62')]['newPassword'],_0x41f8c6['previousPasswords'],_0x5495fa['passwordHistoryLimit']);return _0x41f8c6;})[_0xa7a5('0x19')](saveUpdates({'password':_0x3830fc['body']['newPassword'],'passwordResetAt':_0x3830fc[_0xa7a5('0x84')]['id']==_0x3830fc[_0xa7a5('0x55')]['id']?moment():null,'previousPasswords':authService[_0xa7a5('0xa2')](_0x3830fc[_0xa7a5('0x62')][_0xa7a5('0x9b')],_0x41f8c6['previousPasswords'])},null));})[_0xa7a5('0x19')](respondWithResult(_0x6d93fe,null))[_0xa7a5('0x23')](handleError(_0x6d93fe,null));};exports[_0xa7a5('0xa3')]=function(_0x514184,_0x3ef096){var _0x536c08=_0x514184[_0xa7a5('0x62')]['channel'];return db[_0xa7a5('0x3b')][_0xa7a5('0x5f')]({'where':{'id':_0x514184[_0xa7a5('0x55')]['id']},'attributes':['id',_0xa7a5('0x38'),_0xa7a5('0x2d'),'online',_0xa7a5('0xa4'),_0xa7a5('0xa5'),_0xa7a5('0xa6')]})['then'](handleEntityNotFound(_0x3ef096,null))['then'](function(_0x200996){if(_0x200996){if(!utils[_0xa7a5('0xa7')](_0x536c08)){throw new db[(_0xa7a5('0x96'))]['ValidationError'](_0xa7a5('0xa8'));}return _0x200996['add'+_['capitalize'](_0x536c08[_0xa7a5('0xa9')]())+'Queues'](_0x514184[_0xa7a5('0x62')][_0xa7a5('0x65')],{'penalty':_0x514184['body'][_0xa7a5('0xaa')]||0x0})['spread'](function(_0x4a95d7){for(var _0x3c84d2=0x0;_0x3c84d2<_0x514184[_0xa7a5('0x62')][_0xa7a5('0x65')][_0xa7a5('0x5d')];_0x3c84d2+=0x1){var _0x4d9421={'UserId':Number(_0x514184[_0xa7a5('0x55')]['id'])};_0x4d9421[_['capitalize'](_0x536c08['toLowerCase']())+_0xa7a5('0xab')]=Number(_0x514184[_0xa7a5('0x62')][_0xa7a5('0x65')][_0x3c84d2]);socket['emit']('user'+_[_0xa7a5('0xac')](_0x536c08['toLowerCase']())+_0xa7a5('0xad'),_0x4d9421);}return _0x4a95d7;})[_0xa7a5('0x19')](function(){if(_0x536c08===_0xa7a5('0xae')){return db[_0xa7a5('0xaf')][_0xa7a5('0x4c')]({'where':{'id':_0x514184[_0xa7a5('0x62')][_0xa7a5('0x65')]||[]},'raw':!![],'attributes':['id',_0xa7a5('0x38')]});}})[_0xa7a5('0x19')](function(_0x1a9836){var _0x3baf7c=_0x200996['get']({'plain':!![]});var _0x273dde=[];if(_0x536c08===_0xa7a5('0xae')&&_0x3baf7c[_0xa7a5('0x2d')]===_0xa7a5('0x2e')&&_0x3baf7c['online']){for(let _0x1b8b26=0x0;_0x1b8b26<_0x1a9836[_0xa7a5('0x5d')];_0x1b8b26+=0x1){_0x273dde[_0xa7a5('0x4b')]({'membername':_0x3baf7c[_0xa7a5('0x38')],'UserId':_0x3baf7c['id'],'queue_name':_0x1a9836[_0x1b8b26][_0xa7a5('0x38')],'VoiceQueueId':_0x1a9836[_0x1b8b26]['id'],'interface':_[_0xa7a5('0x6b')](_0x3baf7c[_0xa7a5('0xa6')])?util[_0xa7a5('0xb0')](_0xa7a5('0xb1'),_0x3baf7c[_0xa7a5('0x38')]):_0x3baf7c[_0xa7a5('0xa6')],'paused':_0x3baf7c[_0xa7a5('0xa5')]||![],'penalty':_0x514184['body'][_0xa7a5('0xaa')]||0x0});}return Promise['all'](_0x273dde[_0xa7a5('0x36')](function(_0x3d2835){return db[_0xa7a5('0xb2')]['upsert'](_0x3d2835);}));}return _0x200996;});}})[_0xa7a5('0x19')](respondWithStatusCode(_0x3ef096,null))['catch'](handleError(_0x3ef096,null));};exports[_0xa7a5('0xb3')]=function(_0x601240,_0x35ff16){var _0x282fae,_0x5d977d;return db[_0xa7a5('0x3b')]['find']({'where':{'id':_0x601240[_0xa7a5('0x55')]['id']},'attributes':['id','name',_0xa7a5('0x2d')]})[_0xa7a5('0x19')](handleEntityNotFound(_0x35ff16,null))[_0xa7a5('0x19')](function(_0x18a89f){if(_0x18a89f){_0x282fae=_0x18a89f;if(!_0x601240['query'][_0xa7a5('0xb4')]||!utils['isValidChannel'](_0x601240[_0xa7a5('0x44')][_0xa7a5('0xb4')])){throw new db['Sequelize'][(_0xa7a5('0x99'))]('Unknown\x20channel');}return _0x18a89f[_0xa7a5('0xb5')+_[_0xa7a5('0xac')](_0x601240['query']['channel'][_0xa7a5('0xa9')]())+_0xa7a5('0xb6')](_0x601240[_0xa7a5('0x44')][_0xa7a5('0x65')]);}})[_0xa7a5('0x19')](function(_0x2a5dfe){if(_['isArray'](_0x601240[_0xa7a5('0x44')][_0xa7a5('0x65')])){for(var _0x5e7bc0=0x0;_0x5e7bc0<_0x601240[_0xa7a5('0x44')]['ids'][_0xa7a5('0x5d')];_0x5e7bc0+=0x1){_0x5d977d={'UserId':Number(_0x601240[_0xa7a5('0x55')]['id'])};_0x5d977d[_[_0xa7a5('0xac')](_0x601240[_0xa7a5('0x44')][_0xa7a5('0xb4')][_0xa7a5('0xa9')]())+_0xa7a5('0xab')]=Number(_0x601240[_0xa7a5('0x44')][_0xa7a5('0x65')][_0x5e7bc0]);socket[_0xa7a5('0xb7')](_0xa7a5('0x84')+_[_0xa7a5('0xac')](_0x601240[_0xa7a5('0x44')][_0xa7a5('0xb4')]['toLowerCase']())+_0xa7a5('0xb8'),_0x5d977d);}}else{_0x5d977d={'UserId':Number(_0x601240[_0xa7a5('0x55')]['id'])};_0x5d977d[_[_0xa7a5('0xac')](_0x601240[_0xa7a5('0x44')][_0xa7a5('0xb4')][_0xa7a5('0xa9')]())+_0xa7a5('0xab')]=Number(_0x601240[_0xa7a5('0x44')]['ids']);socket[_0xa7a5('0xb7')](_0xa7a5('0x84')+_[_0xa7a5('0xac')](_0x601240[_0xa7a5('0x44')]['channel'][_0xa7a5('0xa9')]())+_0xa7a5('0xb8'),_0x5d977d);}return _0x2a5dfe;})[_0xa7a5('0x19')](function(){if(_0x601240['query']['channel']===_0xa7a5('0xae')){return db[_0xa7a5('0xb2')][_0xa7a5('0x30')]({'where':{'UserId':_0x601240[_0xa7a5('0x55')]['id'],'VoiceQueueId':_0x601240[_0xa7a5('0x44')]['ids']},'individualHooks':!![]})[_0xa7a5('0x19')](function(){return _0x282fae;});}return _0x282fae;})['then'](respondWithStatusCode(_0x35ff16,null))[_0xa7a5('0x23')](handleError(_0x35ff16,null));};exports[_0xa7a5('0xb9')]=function(_0x1164af,_0xe289bd){_0x1164af[_0xa7a5('0x62')][_0xa7a5('0xba')]=_0x1164af[_0xa7a5('0xbb')][_0xa7a5('0xbc')];return db['User'][_0xa7a5('0x5f')]({'where':{'id':_0x1164af['params']['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0xe289bd,null))[_0xa7a5('0x19')](saveUpdates(_0x1164af[_0xa7a5('0x62')],null))[_0xa7a5('0x19')](respondWithResult(_0xe289bd,null))[_0xa7a5('0x23')](handleError(_0xe289bd,null));};exports['getAvatar']=function(_0x51a29c,_0x135a0c){var _0x58652e=path[_0xa7a5('0xbd')](config[_0xa7a5('0xbe')],'server/files/images/logos/default_profile.png');return db[_0xa7a5('0x3b')][_0xa7a5('0x5f')]({'where':{'id':_0x51a29c[_0xa7a5('0x55')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x135a0c,null))[_0xa7a5('0x19')](function(_0x1ac49d){if(_0x1ac49d){if(_[_0xa7a5('0x6b')](_0x1ac49d['userpic'])){return _0x135a0c[_0xa7a5('0xbf')](_0x58652e);}else{if(!fs['existsSync'](path[_0xa7a5('0xbd')](config[_0xa7a5('0xbe')],_0xa7a5('0xc0'),_0x1ac49d['userpic']))){return _0x135a0c[_0xa7a5('0xbf')](_0x58652e);}return _0x135a0c['download'](path[_0xa7a5('0xbd')](config[_0xa7a5('0xbe')],_0xa7a5('0xc0'),_0x1ac49d['userpic']));}}})[_0xa7a5('0x23')](handleError(_0x135a0c,null));};exports[_0xa7a5('0xc1')]=function(_0x31ca57,_0x251548){return db['User'][_0xa7a5('0x5f')]({'where':{'id':_0x31ca57['params']['id']},'attributes':['id']})[_0xa7a5('0x19')](handleEntityNotFound(_0x251548,null))[_0xa7a5('0x19')](function(_0x8e2256){var _0x481215=[];values=_0x8e2256['dataValues'];_0x481215[_0xa7a5('0x4b')](get_open_tabs(_0xa7a5('0x4f'),_0x8e2256[_0xa7a5('0x50')]));_0x481215[_0xa7a5('0x4b')](get_open_tabs(_0xa7a5('0x51'),_0x8e2256['dataValues']));_0x481215[_0xa7a5('0x4b')](get_open_tabs('openchannel',_0x8e2256[_0xa7a5('0x50')]));_0x481215['push'](get_open_tabs(_0xa7a5('0xc2'),_0x8e2256[_0xa7a5('0x50')]));_0x481215[_0xa7a5('0x4b')](get_open_tabs('fax',_0x8e2256['dataValues']));_0x481215[_0xa7a5('0x4b')](get_open_tabs(_0xa7a5('0x52'),_0x8e2256['dataValues']));return Promise[_0xa7a5('0x53')](_0x481215);})[_0xa7a5('0x19')](function(_0x5ae180){if(_0x5ae180){var _0x46c590=_[_0xa7a5('0x36')](values['ChatOpenTabs'],function(_0x545083){return{'channel':_0xa7a5('0xc3'),'id':_0x545083['id'],'createdAt':_0x545083[_0xa7a5('0xc4')]};});var _0xf81abf=_['map'](values['FaxOpenTabs'],function(_0x262534){return{'channel':'FAX','id':_0x262534['id'],'createdAt':_0x262534[_0xa7a5('0xc4')]};});var _0x29f8e2=_['map'](values[_0xa7a5('0xc5')],function(_0x466049){return{'channel':_0xa7a5('0xc6'),'id':_0x466049['id'],'createdAt':_0x466049[_0xa7a5('0xc4')]};});var _0x40cdfd=_['map'](values[_0xa7a5('0xc7')],function(_0x2ed341){return{'channel':'MAIL','id':_0x2ed341['id'],'createdAt':_0x2ed341[_0xa7a5('0xc4')]};});var _0x385585=_[_0xa7a5('0x36')](values[_0xa7a5('0xc8')],function(_0x53bbb6){return{'channel':'SMS','id':_0x53bbb6['id'],'createdAt':_0x53bbb6[_0xa7a5('0xc4')]};});var _0x17006=_[_0xa7a5('0x36')](values[_0xa7a5('0xc9')],function(_0x1580c5){return{'channel':_0xa7a5('0xca'),'id':_0x1580c5['id'],'createdAt':_0x1580c5[_0xa7a5('0xc4')]};});var _0x14b189=_[_0xa7a5('0xcb')](_0x46c590,_0xf81abf,_0x29f8e2,_0x40cdfd,_0x385585,_0x17006);var _0x152061={'count':_0x14b189[_0xa7a5('0x5d')],'rows':_0x14b189};return _0x152061;}else return null;})[_0xa7a5('0x19')](respondWithResult(_0x251548,null))[_0xa7a5('0x23')](handleError(_0x251548,null));};exports['getContacts']=function(_0x587ecc,_0x5d7a7f){var _0x321eda={};return db[_0xa7a5('0x3b')][_0xa7a5('0x9e')]({'where':{'id':_0x587ecc['params']['id']}})[_0xa7a5('0x19')](function(_0x577ada){if(!_0x577ada){throw new APINotFoundError(util[_0xa7a5('0xb0')](_0xa7a5('0xcc'),_0x587ecc['params']['id']));}return contacts['describe']();})[_0xa7a5('0x19')](function(_0x1a02e3){_0x587ecc[_0xa7a5('0x44')][_0xa7a5('0x3b')]=_0x587ecc['params']['id'];_0x321eda=qs[_0xa7a5('0x41')](_0x1a02e3,_0x587ecc);if(_0x587ecc[_0xa7a5('0x44')][_0xa7a5('0xcd')]('includeAll')){_0x321eda[_0xa7a5('0x48')]=[{'model':db[_0xa7a5('0xce')],'as':_0xa7a5('0xcf'),'required':![]},{'model':db['Tag'],'as':_0xa7a5('0xd0'),'attributes':['id',_0xa7a5('0x38'),_0xa7a5('0xd1')],'where':_0x587ecc[_0xa7a5('0x44')][_0xa7a5('0xd2')]?{'id':_0x587ecc[_0xa7a5('0x44')]['tag']}:undefined,'required':_0x587ecc[_0xa7a5('0x44')]['tag']?!![]:![]}];}return contacts[_0xa7a5('0x4c')](_0x587ecc[_0xa7a5('0x44')],_0x587ecc[_0xa7a5('0x84')],_0x321eda,_0x1a02e3);})[_0xa7a5('0x19')](respondWithFilteredResult(_0x5d7a7f,_0x321eda))[_0xa7a5('0x23')](APIHandleError(_0x5d7a7f));};exports[_0xa7a5('0xd3')]=function(_0xd8062d,_0xd04837){var _0x48959c;var _0x2db1a6={};var _0x507f07;return db[_0xa7a5('0x3b')][_0xa7a5('0x9e')]({'where':{'id':_0xd8062d[_0xa7a5('0x55')]['id']},'attributes':['id','name',_0xa7a5('0x2d')]})['then'](handleEntityNotFound(_0xd04837,null))[_0xa7a5('0x19')](function(_0x1b3030){if(!utils['isValidChannel'](_0xd8062d[_0xa7a5('0x44')]['channel'])){throw new db[(_0xa7a5('0x96'))][(_0xa7a5('0x99'))](_0xa7a5('0xa8'));}_0x48959c=_0x1b3030;var _0x358295={};_0x358295['model']=_[_0xa7a5('0x58')](db[_[_0xa7a5('0xac')](_0xd8062d['query'][_0xa7a5('0xb4')])+_0xa7a5('0xd4')]['rawAttributes']);_0x358295[_0xa7a5('0x44')]=_[_0xa7a5('0x58')](_0xd8062d[_0xa7a5('0x44')]);_0x358295[_0xa7a5('0xd5')]=_[_0xa7a5('0x5b')](_0x358295[_0xa7a5('0x56')],_0x358295[_0xa7a5('0x44')]);_0x2db1a6[_0xa7a5('0x4a')]=_[_0xa7a5('0x5b')](_0x358295[_0xa7a5('0x56')],qs[_0xa7a5('0x5c')](_0xd8062d[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x2db1a6['attributes']=_0x2db1a6[_0xa7a5('0x4a')][_0xa7a5('0x5d')]?_0x2db1a6[_0xa7a5('0x4a')]:_0x358295[_0xa7a5('0x56')];_0x2db1a6[_0xa7a5('0xd6')]=qs[_0xa7a5('0xd7')](_0xd8062d[_0xa7a5('0x44')][_0xa7a5('0xd7')]);_0x2db1a6[_0xa7a5('0x42')]=qs[_0xa7a5('0xd5')](_['pick'](_0xd8062d['query'],_0x358295[_0xa7a5('0xd5')]));if(_0xd8062d['query'][_0xa7a5('0x34')]){_0x2db1a6['where']=_[_0xa7a5('0x5e')](_0x2db1a6[_0xa7a5('0x42')],{'$or':_[_0xa7a5('0x36')](_0x2db1a6['attributes'],function(_0x58ba9a){var _0x506cb6={};_0x506cb6[_0x58ba9a]={'$like':'%'+_0xd8062d[_0xa7a5('0x44')][_0xa7a5('0x34')]+'%'};return _0x506cb6;})});}_0x2db1a6=_['merge']({},_0x2db1a6,_0xd8062d['options']);switch(_0x48959c[_0xa7a5('0x2d')]){case _0xa7a5('0x86'):return db[_[_0xa7a5('0xac')](_0xd8062d[_0xa7a5('0x44')][_0xa7a5('0xb4')])+_0xa7a5('0xd4')]['findAll'](_0x2db1a6);case _0xa7a5('0x84'):case _0xa7a5('0x2e'):return _0x48959c['get'+_[_0xa7a5('0xac')](_0xd8062d[_0xa7a5('0x44')][_0xa7a5('0xb4')])+_0xa7a5('0xb6')](_0x2db1a6);default:throw new db[(_0xa7a5('0x96'))][(_0xa7a5('0x99'))](_0xa7a5('0xd8'));}})['then'](function(_0x30e6ba){_0x507f07=_0x30e6ba[_0xa7a5('0x5d')];if(!_0xd8062d[_0xa7a5('0x44')][_0xa7a5('0xcd')](_0xa7a5('0xd9'))){_0x2db1a6[_0xa7a5('0x29')]=qs[_0xa7a5('0x29')](_0xd8062d[_0xa7a5('0x44')][_0xa7a5('0x29')]);_0x2db1a6[_0xa7a5('0x27')]=qs[_0xa7a5('0x27')](_0xd8062d['query'][_0xa7a5('0x27')]);}switch(_0x48959c['role']){case _0xa7a5('0x86'):return db[_[_0xa7a5('0xac')](_0xd8062d[_0xa7a5('0x44')][_0xa7a5('0xb4')])+_0xa7a5('0xd4')][_0xa7a5('0x4c')](_0x2db1a6);case _0xa7a5('0x84'):case'agent':return _0x48959c[_0xa7a5('0x31')+_[_0xa7a5('0xac')](_0xd8062d[_0xa7a5('0x44')][_0xa7a5('0xb4')])+_0xa7a5('0xb6')](_0x2db1a6);}})[_0xa7a5('0x19')](function(_0x203446){return{'count':_0x507f07,'rows':_0x203446};})[_0xa7a5('0x19')](respondWithResult(_0xd04837,null))[_0xa7a5('0x23')](handleError(_0xd04837,null));};exports[_0xa7a5('0xda')]=function(_0x58c765,_0x5c5077){var _0x23dae7={};var _0x3c8c7a={};var _0x2bef2d;var _0x2b295d;return db[_0xa7a5('0x3b')]['findOne']({'where':{'id':_0x58c765[_0xa7a5('0x55')]['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0x5c5077,null))['then'](function(_0x580362){if(_0x580362){_0x2bef2d=_0x580362;_0x3c8c7a[_0xa7a5('0x56')]=_[_0xa7a5('0x58')](db[_0xa7a5('0xb2')]['rawAttributes']);_0x3c8c7a[_0xa7a5('0x44')]=_['keys'](_0x58c765[_0xa7a5('0x44')]);_0x3c8c7a[_0xa7a5('0xd5')]=_[_0xa7a5('0x5b')](_0x3c8c7a[_0xa7a5('0x56')],_0x3c8c7a[_0xa7a5('0x44')]);_0x23dae7[_0xa7a5('0x4a')]=_['intersection'](_0x3c8c7a[_0xa7a5('0x56')],qs[_0xa7a5('0x5c')](_0x58c765[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x23dae7[_0xa7a5('0x4a')]=_0x23dae7[_0xa7a5('0x4a')]['length']?_0x23dae7[_0xa7a5('0x4a')]:_0x3c8c7a[_0xa7a5('0x56')];_0x23dae7['order']=qs[_0xa7a5('0xd7')](_0x58c765[_0xa7a5('0x44')][_0xa7a5('0xd7')]);_0x23dae7['where']=qs[_0xa7a5('0xd5')](_[_0xa7a5('0xdb')](_0x58c765[_0xa7a5('0x44')],_0x3c8c7a[_0xa7a5('0xd5')]));if(_0x58c765[_0xa7a5('0x44')][_0xa7a5('0x34')]){_0x23dae7[_0xa7a5('0x42')]=_[_0xa7a5('0x5e')](_0x23dae7[_0xa7a5('0x42')],{'$or':_[_0xa7a5('0x36')](_0x23dae7[_0xa7a5('0x4a')],function(_0x319cee){var _0x46cce5={};_0x46cce5[_0x319cee]={'$like':'%'+_0x58c765['query'][_0xa7a5('0x34')]+'%'};return _0x46cce5;})});}_0x23dae7=_['merge']({},_0x23dae7,_0x58c765[_0xa7a5('0xdc')]);return _0x2bef2d[_0xa7a5('0xda')](_0x23dae7);}})[_0xa7a5('0x19')](function(_0x4d55cb){if(_0x4d55cb){_0x2b295d=_0x4d55cb[_0xa7a5('0x5d')];if(!_0x58c765[_0xa7a5('0x44')][_0xa7a5('0xcd')](_0xa7a5('0xd9'))){_0x23dae7['limit']=qs[_0xa7a5('0x29')](_0x58c765[_0xa7a5('0x44')][_0xa7a5('0x29')]);_0x23dae7[_0xa7a5('0x27')]=qs['offset'](_0x58c765[_0xa7a5('0x44')][_0xa7a5('0x27')]);}return _0x2bef2d['getVoiceQueuesRt'](_0x23dae7);}})['then'](function(_0x5c97b4){if(_0x5c97b4){return _0x5c97b4?{'count':_0x2b295d,'rows':_0x5c97b4}:null;}})['then'](respondWithResult(_0x5c5077,null))[_0xa7a5('0x23')](handleError(_0x5c5077,null));};exports[_0xa7a5('0xdd')]=function(_0x53ba1c,_0x16892e){var _0x456830={};var _0x739a7={};var _0x1d7768;var _0x4c858c;return db['User'][_0xa7a5('0x9e')]({'where':{'id':_0x53ba1c[_0xa7a5('0x55')]['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0x16892e,null))['then'](function(_0x3478db){if(_0x3478db){_0x1d7768=_0x3478db;_0x739a7[_0xa7a5('0x56')]=_['keys'](db[_0xa7a5('0xde')][_0xa7a5('0x3c')]);_0x739a7['query']=_[_0xa7a5('0x58')](_0x53ba1c[_0xa7a5('0x44')]);_0x739a7[_0xa7a5('0xd5')]=_['intersection'](_0x739a7[_0xa7a5('0x56')],_0x739a7[_0xa7a5('0x44')]);_0x456830[_0xa7a5('0x4a')]=_[_0xa7a5('0x5b')](_0x739a7['model'],qs[_0xa7a5('0x5c')](_0x53ba1c[_0xa7a5('0x44')]['fields']));_0x456830['attributes']=_0x456830[_0xa7a5('0x4a')][_0xa7a5('0x5d')]?_0x456830[_0xa7a5('0x4a')]:_0x739a7[_0xa7a5('0x56')];_0x456830[_0xa7a5('0xd6')]=qs['sort'](_0x53ba1c[_0xa7a5('0x44')]['sort']);_0x456830['where']=qs[_0xa7a5('0xd5')](_[_0xa7a5('0xdb')](_0x53ba1c['query'],_0x739a7['filters']));if(_0x53ba1c[_0xa7a5('0x44')]['filter']){_0x456830[_0xa7a5('0x42')]=_[_0xa7a5('0x5e')](_0x456830[_0xa7a5('0x42')],{'$or':_['map'](_0x456830[_0xa7a5('0x4a')],function(_0x429367){var _0x4b485a={};_0x4b485a[_0x429367]={'$like':'%'+_0x53ba1c[_0xa7a5('0x44')][_0xa7a5('0x34')]+'%'};return _0x4b485a;})});}_0x456830=_[_0xa7a5('0x5e')]({},_0x456830,_0x53ba1c[_0xa7a5('0xdc')]);return _0x1d7768['getGroups'](_0x456830);}})['then'](function(_0x2e2c73){if(_0x2e2c73){_0x4c858c=_0x2e2c73[_0xa7a5('0x5d')];if(!_0x53ba1c[_0xa7a5('0x44')][_0xa7a5('0xcd')]('nolimit')){_0x456830['limit']=qs['limit'](_0x53ba1c[_0xa7a5('0x44')][_0xa7a5('0x29')]);_0x456830[_0xa7a5('0x27')]=qs[_0xa7a5('0x27')](_0x53ba1c['query'][_0xa7a5('0x27')]);}return _0x1d7768[_0xa7a5('0xdd')](_0x456830);}})[_0xa7a5('0x19')](function(_0x537346){if(_0x537346){return _0x537346?{'count':_0x4c858c,'rows':_0x537346}:null;}})[_0xa7a5('0x19')](respondWithResult(_0x16892e,null))[_0xa7a5('0x23')](handleError(_0x16892e,null));};exports[_0xa7a5('0xdf')]=function(_0x34a55e,_0x11e9d1){var _0x415ef0={'raw':!![],'where':{}};var _0x2ace98={};var _0x457e1c={'count':0x0,'rows':[]};return db[_0xa7a5('0x3b')][_0xa7a5('0x9e')]({'where':{'id':_0x34a55e[_0xa7a5('0x55')]['id']}})['then'](handleEntityNotFound(_0x11e9d1,null))[_0xa7a5('0x19')](function(_0x269451){if(_0x269451){_0x2ace98[_0xa7a5('0x56')]=_[_0xa7a5('0x58')](db[_0xa7a5('0xe0')][_0xa7a5('0x3c')]);_0x2ace98[_0xa7a5('0x44')]=_[_0xa7a5('0x58')](_0x34a55e[_0xa7a5('0x44')]);_0x2ace98[_0xa7a5('0xd5')]=_[_0xa7a5('0x5b')](_0x2ace98[_0xa7a5('0x56')],_0x2ace98[_0xa7a5('0x44')]);_0x415ef0[_0xa7a5('0x4a')]=_[_0xa7a5('0x5b')](_0x2ace98[_0xa7a5('0x56')],qs[_0xa7a5('0x5c')](_0x34a55e[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x415ef0[_0xa7a5('0x4a')]=_0x415ef0[_0xa7a5('0x4a')][_0xa7a5('0x5d')]?_0x415ef0[_0xa7a5('0x4a')]:_0x2ace98[_0xa7a5('0x56')];if(!_0x34a55e['query']['hasOwnProperty'](_0xa7a5('0xd9'))){_0x415ef0[_0xa7a5('0x29')]=qs[_0xa7a5('0x29')](_0x34a55e[_0xa7a5('0x44')][_0xa7a5('0x29')]);_0x415ef0[_0xa7a5('0x27')]=qs[_0xa7a5('0x27')](_0x34a55e[_0xa7a5('0x44')][_0xa7a5('0x27')]);}_0x415ef0[_0xa7a5('0xd6')]=qs['sort'](_0x34a55e[_0xa7a5('0x44')]['sort']);_0x415ef0[_0xa7a5('0x42')]=qs[_0xa7a5('0xd5')](_[_0xa7a5('0xdb')](_0x34a55e['query'],_0x2ace98[_0xa7a5('0xd5')]));_0x415ef0['where'][_0xa7a5('0xe1')]=_0x269451['id'];if(_0x34a55e[_0xa7a5('0x44')][_0xa7a5('0x34')]){_0x415ef0['where']=_[_0xa7a5('0x5e')](_0x415ef0[_0xa7a5('0x42')],{'$or':_[_0xa7a5('0x36')](_0x415ef0[_0xa7a5('0x4a')],function(_0xe5ec7b){var _0x3a3a5c={};_0x3a3a5c[_0xe5ec7b]={'$like':'%'+_0x34a55e[_0xa7a5('0x44')][_0xa7a5('0x34')]+'%'};return _0x3a3a5c;})});}_0x415ef0=_[_0xa7a5('0x5e')]({},_0x415ef0,_0x34a55e[_0xa7a5('0xdc')]);return db[_0xa7a5('0xe0')][_0xa7a5('0x43')]({'where':_0x415ef0[_0xa7a5('0x42')]})['then'](function(_0x26c814){_0x457e1c[_0xa7a5('0x43')]=_0x26c814;if(_0x34a55e[_0xa7a5('0x44')]['includeAll']){_0x415ef0[_0xa7a5('0x48')]=[{'all':!![]}];}return db[_0xa7a5('0xe0')][_0xa7a5('0x4c')](_0x415ef0);})[_0xa7a5('0x19')](function(_0x59118a){_0x457e1c[_0xa7a5('0x4d')]=_0x59118a;return _0x457e1c;});}})[_0xa7a5('0x19')](respondWithFilteredResult(_0x11e9d1,_0x415ef0))[_0xa7a5('0x23')](handleError(_0x11e9d1,null));};exports[_0xa7a5('0xe2')]=function(_0x2104bc,_0x16f919){var _0x5c5008={'raw':!![],'where':{}};var _0x16323a={};var _0x370002={'count':0x0,'rows':[]};return db[_0xa7a5('0x3b')]['findOne']({'where':{'id':_0x2104bc['params']['id']}})['then'](handleEntityNotFound(_0x16f919,null))[_0xa7a5('0x19')](function(_0x4e4043){if(_0x4e4043){_0x16323a['model']=_[_0xa7a5('0x58')](db['ScreenRecording'][_0xa7a5('0x3c')]);_0x16323a[_0xa7a5('0x44')]=_['keys'](_0x2104bc[_0xa7a5('0x44')]);_0x16323a[_0xa7a5('0xd5')]=_[_0xa7a5('0x5b')](_0x16323a[_0xa7a5('0x56')],_0x16323a[_0xa7a5('0x44')]);_0x5c5008['attributes']=_[_0xa7a5('0x5b')](_0x16323a[_0xa7a5('0x56')],qs[_0xa7a5('0x5c')](_0x2104bc[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x5c5008[_0xa7a5('0x4a')]=_0x5c5008[_0xa7a5('0x4a')][_0xa7a5('0x5d')]?_0x5c5008[_0xa7a5('0x4a')]:_0x16323a['model'];if(!_0x2104bc[_0xa7a5('0x44')][_0xa7a5('0xcd')](_0xa7a5('0xd9'))){_0x5c5008[_0xa7a5('0x29')]=qs[_0xa7a5('0x29')](_0x2104bc[_0xa7a5('0x44')][_0xa7a5('0x29')]);_0x5c5008[_0xa7a5('0x27')]=qs[_0xa7a5('0x27')](_0x2104bc['query'][_0xa7a5('0x27')]);}_0x5c5008[_0xa7a5('0xd6')]=qs['sort'](_0x2104bc['query'][_0xa7a5('0xd7')]);_0x5c5008[_0xa7a5('0x42')]=qs['filters'](_[_0xa7a5('0xdb')](_0x2104bc['query'],_0x16323a[_0xa7a5('0xd5')]));_0x5c5008[_0xa7a5('0x42')][_0xa7a5('0xe1')]=_0x4e4043['id'];if(_0x2104bc['query'][_0xa7a5('0x34')]){_0x5c5008['where']=_[_0xa7a5('0x5e')](_0x5c5008[_0xa7a5('0x42')],{'$or':_['map'](_0x5c5008[_0xa7a5('0x4a')],function(_0x5e5d6e){var _0x3e91be={};_0x3e91be[_0x5e5d6e]={'$like':'%'+_0x2104bc[_0xa7a5('0x44')][_0xa7a5('0x34')]+'%'};return _0x3e91be;})});}_0x5c5008=_[_0xa7a5('0x5e')]({},_0x5c5008,_0x2104bc[_0xa7a5('0xdc')]);return db[_0xa7a5('0xe3')]['count']({'where':_0x5c5008[_0xa7a5('0x42')]})[_0xa7a5('0x19')](function(_0x2f85f6){_0x370002[_0xa7a5('0x43')]=_0x2f85f6;if(_0x2104bc[_0xa7a5('0x44')][_0xa7a5('0x45')]){_0x5c5008[_0xa7a5('0x48')]=[{'all':!![]}];}return db[_0xa7a5('0xe3')]['findAll'](_0x5c5008);})['then'](function(_0xe8de12){_0x370002[_0xa7a5('0x4d')]=_0xe8de12;return _0x370002;});}})[_0xa7a5('0x19')](respondWithFilteredResult(_0x16f919,_0x5c5008))[_0xa7a5('0x23')](handleError(_0x16f919,null));};exports[_0xa7a5('0xe4')]=function(_0xb90bff,_0x32e235){var _0x402599={};var _0x51b7af={};var _0x392ab6;var _0x1778ce;return db[_0xa7a5('0x3b')][_0xa7a5('0x9e')]({'where':{'id':_0xb90bff[_0xa7a5('0x55')]['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0x32e235,null))['then'](function(_0x818cd7){if(_0x818cd7){_0x392ab6=_0x818cd7;_0x51b7af[_0xa7a5('0x56')]=_[_0xa7a5('0x58')](db['ChatInteraction'][_0xa7a5('0x3c')]);_0x51b7af[_0xa7a5('0x44')]=_['keys'](_0xb90bff[_0xa7a5('0x44')]);_0x51b7af['filters']=_[_0xa7a5('0x5b')](_0x51b7af['model'],_0x51b7af[_0xa7a5('0x44')]);_0x402599[_0xa7a5('0x4a')]=_[_0xa7a5('0x5b')](_0x51b7af['model'],qs[_0xa7a5('0x5c')](_0xb90bff[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x402599[_0xa7a5('0x4a')]=_0x402599[_0xa7a5('0x4a')][_0xa7a5('0x5d')]?_0x402599[_0xa7a5('0x4a')]:_0x51b7af[_0xa7a5('0x56')];_0x402599[_0xa7a5('0xd6')]=qs[_0xa7a5('0xd7')](_0xb90bff['query'][_0xa7a5('0xd7')]);_0x402599[_0xa7a5('0x42')]=qs[_0xa7a5('0xd5')](_[_0xa7a5('0xdb')](_0xb90bff[_0xa7a5('0x44')],_0x51b7af[_0xa7a5('0xd5')]));if(_0xb90bff[_0xa7a5('0x44')]['filter']){_0x402599[_0xa7a5('0x42')]=_['merge'](_0x402599['where'],{'$or':_[_0xa7a5('0x36')](_0x402599['attributes'],function(_0x302d63){var _0x388302={};_0x388302[_0x302d63]={'$like':'%'+_0xb90bff['query'][_0xa7a5('0x34')]+'%'};return _0x388302;})});}_0x402599=_[_0xa7a5('0x5e')]({},_0x402599,_0xb90bff[_0xa7a5('0xdc')]);return _0x392ab6[_0xa7a5('0xe4')](_0x402599);}})[_0xa7a5('0x19')](function(_0x58958e){if(_0x58958e){_0x1778ce=_0x58958e['length'];if(!_0xb90bff[_0xa7a5('0x44')]['hasOwnProperty'](_0xa7a5('0xd9'))){_0x402599[_0xa7a5('0x29')]=qs[_0xa7a5('0x29')](_0xb90bff['query'][_0xa7a5('0x29')]);_0x402599['offset']=qs[_0xa7a5('0x27')](_0xb90bff[_0xa7a5('0x44')][_0xa7a5('0x27')]);}return _0x392ab6['getChatInteractions'](_0x402599);}})[_0xa7a5('0x19')](function(_0x4c67e1){if(_0x4c67e1){return _0x4c67e1?{'count':_0x1778ce,'rows':_0x4c67e1}:null;}})[_0xa7a5('0x19')](respondWithResult(_0x32e235,null))['catch'](handleError(_0x32e235,null));};exports[_0xa7a5('0xe5')]=function(_0xd3b119,_0x6bb941){var _0x51b2e4={};var _0x5703bf={};var _0x1f4c4a;var _0x380dce;return db[_0xa7a5('0x3b')][_0xa7a5('0x9e')]({'where':{'id':_0xd3b119[_0xa7a5('0x55')]['id']}})['then'](handleEntityNotFound(_0x6bb941,null))[_0xa7a5('0x19')](function(_0x2eed9b){if(_0x2eed9b){_0x1f4c4a=_0x2eed9b;_0x5703bf[_0xa7a5('0x56')]=_[_0xa7a5('0x58')](db[_0xa7a5('0xe6')][_0xa7a5('0x3c')]);_0x5703bf['query']=_['keys'](_0xd3b119['query']);_0x5703bf[_0xa7a5('0xd5')]=_[_0xa7a5('0x5b')](_0x5703bf['model'],_0x5703bf['query']);_0x51b2e4[_0xa7a5('0x4a')]=_['intersection'](_0x5703bf['model'],qs[_0xa7a5('0x5c')](_0xd3b119[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x51b2e4[_0xa7a5('0x4a')]=_0x51b2e4[_0xa7a5('0x4a')]['length']?_0x51b2e4['attributes']:_0x5703bf['model'];_0x51b2e4[_0xa7a5('0xd6')]=qs[_0xa7a5('0xd7')](_0xd3b119[_0xa7a5('0x44')][_0xa7a5('0xd7')]);_0x51b2e4[_0xa7a5('0x42')]=qs[_0xa7a5('0xd5')](_[_0xa7a5('0xdb')](_0xd3b119[_0xa7a5('0x44')],_0x5703bf['filters']));if(_0xd3b119[_0xa7a5('0x44')][_0xa7a5('0x34')]){_0x51b2e4[_0xa7a5('0x42')]=_[_0xa7a5('0x5e')](_0x51b2e4[_0xa7a5('0x42')],{'$or':_['map'](_0x51b2e4[_0xa7a5('0x4a')],function(_0x14708b){var _0x189d81={};_0x189d81[_0x14708b]={'$like':'%'+_0xd3b119[_0xa7a5('0x44')][_0xa7a5('0x34')]+'%'};return _0x189d81;})});}_0x51b2e4=_[_0xa7a5('0x5e')]({},_0x51b2e4,_0xd3b119[_0xa7a5('0xdc')]);return _0x1f4c4a[_0xa7a5('0xe5')](_0x51b2e4);}})[_0xa7a5('0x19')](function(_0x1baa26){if(_0x1baa26){_0x380dce=_0x1baa26[_0xa7a5('0x5d')];if(!_0xd3b119['query'][_0xa7a5('0xcd')](_0xa7a5('0xd9'))){_0x51b2e4[_0xa7a5('0x29')]=qs[_0xa7a5('0x29')](_0xd3b119[_0xa7a5('0x44')][_0xa7a5('0x29')]);_0x51b2e4['offset']=qs[_0xa7a5('0x27')](_0xd3b119[_0xa7a5('0x44')]['offset']);}return _0x1f4c4a['getOpenchannelInteractions'](_0x51b2e4);}})['then'](function(_0x35bbab){if(_0x35bbab){return _0x35bbab?{'count':_0x380dce,'rows':_0x35bbab}:null;}})[_0xa7a5('0x19')](respondWithResult(_0x6bb941,null))['catch'](handleError(_0x6bb941,null));};exports[_0xa7a5('0xe7')]=function(_0x54f60f,_0x1bd4b9){var _0x3ea189={'raw':!![],'where':{}};var _0x65bbf3={};var _0x3476ca={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x54f60f['params']['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0x1bd4b9,null))[_0xa7a5('0x19')](function(_0x456b22){if(_0x456b22){_0x65bbf3[_0xa7a5('0x56')]=_[_0xa7a5('0x58')](db[_0xa7a5('0xe8')]['rawAttributes']);_0x65bbf3['query']=_[_0xa7a5('0x58')](_0x54f60f['query']);_0x65bbf3[_0xa7a5('0xd5')]=_['intersection'](_0x65bbf3[_0xa7a5('0x56')],_0x65bbf3[_0xa7a5('0x44')]);_0x3ea189[_0xa7a5('0x4a')]=_[_0xa7a5('0x5b')](_0x65bbf3[_0xa7a5('0x56')],qs[_0xa7a5('0x5c')](_0x54f60f[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x3ea189['attributes']=_0x3ea189['attributes'][_0xa7a5('0x5d')]?_0x3ea189['attributes']:_0x65bbf3[_0xa7a5('0x56')];if(!_0x54f60f[_0xa7a5('0x44')][_0xa7a5('0xcd')](_0xa7a5('0xd9'))){_0x3ea189[_0xa7a5('0x29')]=qs[_0xa7a5('0x29')](_0x54f60f[_0xa7a5('0x44')][_0xa7a5('0x29')]);_0x3ea189[_0xa7a5('0x27')]=qs[_0xa7a5('0x27')](_0x54f60f['query'][_0xa7a5('0x27')]);}_0x3ea189['order']=qs[_0xa7a5('0xd7')](_0x54f60f['query']['sort']);_0x3ea189[_0xa7a5('0x42')]=qs[_0xa7a5('0xd5')](_['pick'](_0x54f60f['query'],_0x65bbf3[_0xa7a5('0xd5')]));_0x3ea189['where']['UserId']=_0x456b22['id'];if(_0x54f60f[_0xa7a5('0x44')]['filter']){_0x3ea189[_0xa7a5('0x42')]=_[_0xa7a5('0x5e')](_0x3ea189[_0xa7a5('0x42')],{'$or':_[_0xa7a5('0x36')](_0x3ea189[_0xa7a5('0x4a')],function(_0xf39a41){var _0x3d3918={};_0x3d3918[_0xf39a41]={'$like':'%'+_0x54f60f[_0xa7a5('0x44')]['filter']+'%'};return _0x3d3918;})});}_0x3ea189=_['merge']({},_0x3ea189,_0x54f60f['options']);return db[_0xa7a5('0xe8')]['count']({'where':_0x3ea189[_0xa7a5('0x42')]})['then'](function(_0x18a48b){_0x3476ca['count']=_0x18a48b;if(_0x54f60f[_0xa7a5('0x44')][_0xa7a5('0x45')]){_0x3ea189[_0xa7a5('0x48')]=[{'all':!![]}];}return db[_0xa7a5('0xe8')]['findAll'](_0x3ea189);})['then'](function(_0x161533){_0x3476ca[_0xa7a5('0x4d')]=_0x161533;return _0x3476ca;});}})[_0xa7a5('0x19')](respondWithFilteredResult(_0x1bd4b9,_0x3ea189))[_0xa7a5('0x23')](handleError(_0x1bd4b9,null));};exports[_0xa7a5('0xe9')]=function(_0x4026fc,_0xf7aef6){var _0x1e5ab6={};var _0x45184b={};var _0x330acb;var _0x573602;return db[_0xa7a5('0x3b')][_0xa7a5('0x9e')]({'where':{'id':_0x4026fc['params']['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0xf7aef6,null))[_0xa7a5('0x19')](function(_0xd5cfbf){if(_0xd5cfbf){_0x330acb=_0xd5cfbf;_0x45184b['model']=_[_0xa7a5('0x58')](db['SmsInteraction'][_0xa7a5('0x3c')]);_0x45184b[_0xa7a5('0x44')]=_['keys'](_0x4026fc['query']);_0x45184b[_0xa7a5('0xd5')]=_[_0xa7a5('0x5b')](_0x45184b[_0xa7a5('0x56')],_0x45184b[_0xa7a5('0x44')]);_0x1e5ab6['attributes']=_[_0xa7a5('0x5b')](_0x45184b[_0xa7a5('0x56')],qs[_0xa7a5('0x5c')](_0x4026fc[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x1e5ab6[_0xa7a5('0x4a')]=_0x1e5ab6[_0xa7a5('0x4a')][_0xa7a5('0x5d')]?_0x1e5ab6[_0xa7a5('0x4a')]:_0x45184b['model'];_0x1e5ab6['order']=qs[_0xa7a5('0xd7')](_0x4026fc['query'][_0xa7a5('0xd7')]);_0x1e5ab6['where']=qs[_0xa7a5('0xd5')](_[_0xa7a5('0xdb')](_0x4026fc['query'],_0x45184b[_0xa7a5('0xd5')]));if(_0x4026fc[_0xa7a5('0x44')][_0xa7a5('0x34')]){_0x1e5ab6[_0xa7a5('0x42')]=_[_0xa7a5('0x5e')](_0x1e5ab6[_0xa7a5('0x42')],{'$or':_[_0xa7a5('0x36')](_0x1e5ab6[_0xa7a5('0x4a')],function(_0xf1e661){var _0x19c031={};_0x19c031[_0xf1e661]={'$like':'%'+_0x4026fc['query'][_0xa7a5('0x34')]+'%'};return _0x19c031;})});}_0x1e5ab6=_[_0xa7a5('0x5e')]({},_0x1e5ab6,_0x4026fc[_0xa7a5('0xdc')]);return _0x330acb[_0xa7a5('0xe9')](_0x1e5ab6);}})[_0xa7a5('0x19')](function(_0x48cae4){if(_0x48cae4){_0x573602=_0x48cae4[_0xa7a5('0x5d')];if(!_0x4026fc['query'][_0xa7a5('0xcd')](_0xa7a5('0xd9'))){_0x1e5ab6['limit']=qs[_0xa7a5('0x29')](_0x4026fc[_0xa7a5('0x44')][_0xa7a5('0x29')]);_0x1e5ab6[_0xa7a5('0x27')]=qs[_0xa7a5('0x27')](_0x4026fc['query'][_0xa7a5('0x27')]);}return _0x330acb[_0xa7a5('0xe9')](_0x1e5ab6);}})[_0xa7a5('0x19')](function(_0x3c514a){if(_0x3c514a){return _0x3c514a?{'count':_0x573602,'rows':_0x3c514a}:null;}})[_0xa7a5('0x19')](respondWithResult(_0xf7aef6,null))[_0xa7a5('0x23')](handleError(_0xf7aef6,null));};exports[_0xa7a5('0xea')]=function(_0x4c21a6,_0x3fddda){var _0x5d7d87={};var _0x2a9b6d={};var _0x5aca24;var _0x590bdd;return db[_0xa7a5('0x3b')]['findOne']({'where':{'id':_0x4c21a6[_0xa7a5('0x55')]['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0x3fddda,null))[_0xa7a5('0x19')](function(_0x562698){if(_0x562698){_0x5aca24=_0x562698;_0x2a9b6d['model']=_[_0xa7a5('0x58')](db[_0xa7a5('0xeb')][_0xa7a5('0x3c')]);_0x2a9b6d[_0xa7a5('0x44')]=_[_0xa7a5('0x58')](_0x4c21a6[_0xa7a5('0x44')]);_0x2a9b6d[_0xa7a5('0xd5')]=_['intersection'](_0x2a9b6d[_0xa7a5('0x56')],_0x2a9b6d['query']);_0x5d7d87[_0xa7a5('0x4a')]=_['intersection'](_0x2a9b6d['model'],qs[_0xa7a5('0x5c')](_0x4c21a6[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x5d7d87['attributes']=_0x5d7d87['attributes']['length']?_0x5d7d87[_0xa7a5('0x4a')]:_0x2a9b6d[_0xa7a5('0x56')];_0x5d7d87[_0xa7a5('0xd6')]=qs[_0xa7a5('0xd7')](_0x4c21a6[_0xa7a5('0x44')][_0xa7a5('0xd7')]);_0x5d7d87[_0xa7a5('0x42')]=qs[_0xa7a5('0xd5')](_[_0xa7a5('0xdb')](_0x4c21a6['query'],_0x2a9b6d[_0xa7a5('0xd5')]));if(_0x4c21a6[_0xa7a5('0x44')][_0xa7a5('0x34')]){_0x5d7d87[_0xa7a5('0x42')]=_[_0xa7a5('0x5e')](_0x5d7d87['where'],{'$or':_[_0xa7a5('0x36')](_0x5d7d87[_0xa7a5('0x4a')],function(_0x561bf0){var _0x33cc0b={};_0x33cc0b[_0x561bf0]={'$like':'%'+_0x4c21a6[_0xa7a5('0x44')][_0xa7a5('0x34')]+'%'};return _0x33cc0b;})});}_0x5d7d87=_[_0xa7a5('0x5e')]({},_0x5d7d87,_0x4c21a6[_0xa7a5('0xdc')]);return _0x5aca24[_0xa7a5('0xea')](_0x5d7d87);}})['then'](function(_0x599e29){if(_0x599e29){_0x590bdd=_0x599e29[_0xa7a5('0x5d')];if(!_0x4c21a6['query'][_0xa7a5('0xcd')](_0xa7a5('0xd9'))){_0x5d7d87['limit']=qs[_0xa7a5('0x29')](_0x4c21a6[_0xa7a5('0x44')][_0xa7a5('0x29')]);_0x5d7d87['offset']=qs[_0xa7a5('0x27')](_0x4c21a6[_0xa7a5('0x44')][_0xa7a5('0x27')]);}return _0x5aca24[_0xa7a5('0xea')](_0x5d7d87);}})[_0xa7a5('0x19')](function(_0x2dde16){if(_0x2dde16){return _0x2dde16?{'count':_0x590bdd,'rows':_0x2dde16}:null;}})[_0xa7a5('0x19')](respondWithResult(_0x3fddda,null))[_0xa7a5('0x23')](handleError(_0x3fddda,null));};exports[_0xa7a5('0xec')]=function(_0x69001,_0x18dfe6){var _0x431a21={};var _0x1708f8={};var _0x3a396f;var _0x302d99;return db['User'][_0xa7a5('0x9e')]({'where':{'id':_0x69001[_0xa7a5('0x55')]['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0x18dfe6,null))[_0xa7a5('0x19')](function(_0x5d54b4){if(_0x5d54b4){_0x3a396f=_0x5d54b4;_0x1708f8[_0xa7a5('0x56')]=_['keys'](db[_0xa7a5('0xed')][_0xa7a5('0x3c')]);_0x1708f8[_0xa7a5('0x44')]=_[_0xa7a5('0x58')](_0x69001[_0xa7a5('0x44')]);_0x1708f8['filters']=_[_0xa7a5('0x5b')](_0x1708f8[_0xa7a5('0x56')],_0x1708f8[_0xa7a5('0x44')]);_0x431a21['attributes']=_['intersection'](_0x1708f8[_0xa7a5('0x56')],qs[_0xa7a5('0x5c')](_0x69001[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x431a21[_0xa7a5('0x4a')]=_0x431a21[_0xa7a5('0x4a')]['length']?_0x431a21['attributes']:_0x1708f8[_0xa7a5('0x56')];_0x431a21[_0xa7a5('0xd6')]=qs[_0xa7a5('0xd7')](_0x69001[_0xa7a5('0x44')][_0xa7a5('0xd7')]);_0x431a21[_0xa7a5('0x42')]=qs[_0xa7a5('0xd5')](_[_0xa7a5('0xdb')](_0x69001[_0xa7a5('0x44')],_0x1708f8[_0xa7a5('0xd5')]));if(_0x69001[_0xa7a5('0x44')]['filter']){_0x431a21[_0xa7a5('0x42')]=_['merge'](_0x431a21[_0xa7a5('0x42')],{'$or':_[_0xa7a5('0x36')](_0x431a21[_0xa7a5('0x4a')],function(_0x5d4329){var _0x5c814f={};_0x5c814f[_0x5d4329]={'$like':'%'+_0x69001[_0xa7a5('0x44')][_0xa7a5('0x34')]+'%'};return _0x5c814f;})});}_0x431a21=_[_0xa7a5('0x5e')]({},_0x431a21,_0x69001[_0xa7a5('0xdc')]);return _0x3a396f[_0xa7a5('0xec')](_0x431a21);}})['then'](function(_0x414ae8){if(_0x414ae8){_0x302d99=_0x414ae8['length'];if(!_0x69001[_0xa7a5('0x44')][_0xa7a5('0xcd')]('nolimit')){_0x431a21[_0xa7a5('0x29')]=qs[_0xa7a5('0x29')](_0x69001[_0xa7a5('0x44')][_0xa7a5('0x29')]);_0x431a21[_0xa7a5('0x27')]=qs[_0xa7a5('0x27')](_0x69001['query'][_0xa7a5('0x27')]);}return _0x3a396f[_0xa7a5('0xec')](_0x431a21);}})[_0xa7a5('0x19')](function(_0x318fdc){if(_0x318fdc){return _0x318fdc?{'count':_0x302d99,'rows':_0x318fdc}:null;}})[_0xa7a5('0x19')](respondWithResult(_0x18dfe6,null))[_0xa7a5('0x23')](handleError(_0x18dfe6,null));};exports[_0xa7a5('0xee')]=function(_0x1cd82e,_0x5359e8,_0x210586){var _0x3583a0;var _0x21e9dd;var _0x246297;var _0x32d265=!_[_0xa7a5('0x6b')](_0x1cd82e[_0xa7a5('0x55')]['id'])?_0x1cd82e[_0xa7a5('0x55')]['id']:!_[_0xa7a5('0x6b')](_0x1cd82e['user']['id'])?_0x1cd82e[_0xa7a5('0x84')]['id']:null;return db[_0xa7a5('0x3b')][_0xa7a5('0x5f')]({'where':{'id':_0x32d265,'role':{'$or':[_0xa7a5('0x86'),_0xa7a5('0x84'),_0xa7a5('0x2e')]}},'attributes':['id',_0xa7a5('0x38'),_0xa7a5('0xef'),_0xa7a5('0xf0'),_0xa7a5('0x2d'),'internal',_0xa7a5('0xa4')]})[_0xa7a5('0x19')](function(_0x15a7ba){if(_0x15a7ba){if(_0x15a7ba[_0xa7a5('0x2d')]===_0xa7a5('0x2e')){_0x3583a0=_0x15a7ba;if(_0x1cd82e[_0xa7a5('0x62')][_0xa7a5('0xa6')]){_0x246297=util[_0xa7a5('0xb0')](_0xa7a5('0xf1'),_0x3583a0[_0x1cd82e['body']['interface']]);}else if(_0x1cd82e[_0xa7a5('0x62')][_0xa7a5('0xf2')]){_0x246297=util[_0xa7a5('0xb0')](_0xa7a5('0xb1'),_0x1cd82e[_0xa7a5('0x62')]['intrf']);}else{_0x246297=util[_0xa7a5('0xb0')](_0xa7a5('0xb1'),_0x3583a0['name']);}socket['to'](util[_0xa7a5('0xb0')]('user:%s',_0x3583a0[_0xa7a5('0x38')]))[_0xa7a5('0xb7')](_0xa7a5('0xf3'),{'user':{'id':_0x3583a0['id'],'name':_0x3583a0[_0xa7a5('0x38')]},'ip':_0x1cd82e[_0xa7a5('0xf4')][_0xa7a5('0xf5')]||_0x1cd82e[_0xa7a5('0xf6')][_0xa7a5('0xf7')]||_0x1cd82e[_0xa7a5('0xf8')][_0xa7a5('0xf7')]||_0x1cd82e[_0xa7a5('0xf6')][_0xa7a5('0xf8')][_0xa7a5('0xf7')]});return db[_0xa7a5('0xb2')][_0xa7a5('0x30')]({'where':{'membername':_0x3583a0['name']},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0xa7a5('0xf9'));}})[_0xa7a5('0x19')](function(){if(_0x3583a0){return _0x3583a0[_0xa7a5('0xfa')]({'raw':!![]});}})[_0xa7a5('0x19')](function(_0x495cc3){if(_0x3583a0){if(_0x495cc3){_0x21e9dd=_0x495cc3;if(_0x21e9dd[_0xa7a5('0x5d')]){var _0xf02b90=_0x21e9dd[_0xa7a5('0x36')](function(_0x33e572){var _0x2db763={'membername':_0x3583a0['name'],'UserId':_0x3583a0['id'],'queue_name':_0x33e572[_0xa7a5('0x38')],'VoiceQueueId':_0x33e572['id'],'interface':_0x246297,'paused':_0x3583a0[_0xa7a5('0xa4')]||![],'penalty':_0x33e572[_0xa7a5('0xfb')]||0x0};return db[_0xa7a5('0xb2')]['upsert'](_0x2db763);});return Promise[_0xa7a5('0x53')](_0xf02b90);}}}})[_0xa7a5('0x19')](function(){if(_0x3583a0){return db[_0xa7a5('0xfc')][_0xa7a5('0x4c')]({'where':{'membername':_0x3583a0[_0xa7a5('0x38')],'exitAt':null}});}})['then'](function(_0x21e900){if(_0x3583a0){var _0x2b2130=[];_0x21e900['forEach'](function(_0x46b97f){_0x2b2130['push'](_0x46b97f[_0xa7a5('0x2c')]({'exitAt':moment()['format'](_0xa7a5('0xfd'))}));});return Promise[_0xa7a5('0x53')](_0x2b2130);}})[_0xa7a5('0x19')](function(){if(_0x3583a0){var _0xde913d=[];var _0x595c71=[];var _0x2c9b04=utils['getChannels']();var _0x49c24e={'membername':_0x3583a0['name'],'interface':_0x246297,'enterAt':moment()[_0xa7a5('0xb0')](_0xa7a5('0xfd')),'role':_0x3583a0[_0xa7a5('0x2d')],'internal':_0x3583a0['internal']};_0x2c9b04['forEach'](function(_0x14606b){_0xde913d['push'](_[_0xa7a5('0x5e')]({'channel':_0x14606b,'type':_0xa7a5('0xfe'),'data1':_0x1cd82e[_0xa7a5('0x62')][_0xa7a5('0xff')],'data2':_0x246297},_0x49c24e));if(_0x3583a0[_0xa7a5('0xa4')]){_0x595c71['push'](_['merge']({'channel':_0x14606b,'type':_0xa7a5('0x100'),'data1':'LOGININPAUSE'},_0x49c24e));}});return db[_0xa7a5('0xfc')]['bulkCreate'](_0xde913d[_0xa7a5('0xcb')](_0x595c71),{'individualHooks':!![]});}})[_0xa7a5('0x19')](function(){if(_0x3583a0){return _0x3583a0['update']({'online':!![],'lastLoginAt':moment()[_0xa7a5('0xb0')](_0xa7a5('0xfd')),'voicePause':_0x3583a0[_0xa7a5('0xa4')]||![],'mailPause':_0x3583a0[_0xa7a5('0xa4')]||![],'chatPause':_0x3583a0[_0xa7a5('0xa4')]||![],'faxPause':_0x3583a0['loginInPause']||![],'smsPause':_0x3583a0['loginInPause']||![],'openchannelPause':_0x3583a0['loginInPause']||![],'whatsappPause':_0x3583a0[_0xa7a5('0xa4')]||![],'pauseType':_0x3583a0[_0xa7a5('0xa4')]?_0xa7a5('0x101'):null,'interface':_0x246297,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xa7a5('0x19')](function(_0x3bfbed){if(_0x1cd82e['isMiddleware']){return _0x210586();}else{return Promise[_0xa7a5('0x102')](_0x3bfbed)['then'](respondWithResult(_0x5359e8,null));}})[_0xa7a5('0x23')](handleError(_0x5359e8,null));};exports[_0xa7a5('0x103')]=function(_0x25df70,_0x2949e2){var _0x349199;return db[_0xa7a5('0x3b')]['find']({'where':{'id':_0x25df70['params']['id'],'role':_0xa7a5('0x2e')},'attributes':['id',_0xa7a5('0x38'),_0xa7a5('0x2d')]})['then'](handleEntityNotFound(_0x2949e2,null))[_0xa7a5('0x19')](function(_0x16c0a0){if(_0x16c0a0){_0x349199=_0x16c0a0;return db[_0xa7a5('0xb2')][_0xa7a5('0x30')]({'where':{'membername':_0x349199[_0xa7a5('0x38')]},'individualHooks':!![]});}})['then'](function(){return db[_0xa7a5('0xfc')][_0xa7a5('0x4c')]({'where':{'membername':_0x349199['name'],'exitAt':null}});})[_0xa7a5('0x19')](function(_0x1e409f){var _0x266556=[];_0x1e409f[_0xa7a5('0x104')](function(_0x208eeb){_0x266556[_0xa7a5('0x4b')](_0x208eeb[_0xa7a5('0x2c')]({'exitAt':moment()['format'](_0xa7a5('0xfd'))}));});return Promise[_0xa7a5('0x53')](_0x266556);})['then'](function(){return _0x349199[_0xa7a5('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa7a5('0x19')](respondWithResult(_0x2949e2,null))[_0xa7a5('0x23')](handleError(_0x2949e2,null));};exports[_0xa7a5('0x105')]=function(_0x11cfc9,_0x1b5787){var _0x276e2c;return db[_0xa7a5('0xb2')][_0xa7a5('0x2c')]({'paused':0x1},{'where':{'UserId':_0x11cfc9[_0xa7a5('0x55')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xa7a5('0x3b')]['find']({'where':{'id':_0x11cfc9[_0xa7a5('0x55')]['id'],'role':_0xa7a5('0x2e')},'attributes':['id','name',_0xa7a5('0x2d'),_0xa7a5('0x66'),'interface',_0xa7a5('0x106')]});})[_0xa7a5('0x19')](handleEntityNotFound(_0x1b5787,null))['then'](function(_0x5b4b96){if(_0x5b4b96){_0x276e2c=_0x5b4b96;return respondWithRpcPromise('QueuePause','pause',{'id':_0x276e2c['id'],'name':_0x276e2c[_0xa7a5('0x38')],'pause':!![]});}})[_0xa7a5('0x19')](function(){if(_0x276e2c){return db['MemberReport'][_0xa7a5('0x4c')]({'where':{'membername':_0x276e2c['name'],'type':_0xa7a5('0x100'),'exitAt':null}});}})[_0xa7a5('0x19')](function(_0x860e01){if(_0x860e01[_0xa7a5('0x5d')]){var _0x1c539a=moment()[_0xa7a5('0xb0')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x274c06=0x0,_0x5e5f77=_0x860e01[_0xa7a5('0x5d')];_0x274c06<_0x5e5f77;_0x274c06++){_0x860e01[_0x274c06][_0xa7a5('0x107')]({'exitAt':_0x1c539a});}}})[_0xa7a5('0x19')](function(){var _0x2675d4=[];var _0x799257=utils[_0xa7a5('0x108')]();_0x799257[_0xa7a5('0x104')](function(_0x12966d){_0x2675d4[_0xa7a5('0x4b')]({'channel':_0x12966d,'membername':_0x276e2c[_0xa7a5('0x38')],'interface':_['isNil'](_0x276e2c[_0xa7a5('0xa6')])?util[_0xa7a5('0xb0')]('SIP/%s',_0x276e2c['name']):_0x276e2c[_0xa7a5('0xa6')],'type':_0xa7a5('0x100'),'enterAt':moment()[_0xa7a5('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x11cfc9['body'][_0xa7a5('0x3e')]||_0xa7a5('0x109'),'role':_0x276e2c['role'],'internal':_0x276e2c[_0xa7a5('0x66')]});});return db['MemberReport'][_0xa7a5('0x8f')](_0x2675d4,{'individualHooks':!![]});})[_0xa7a5('0x19')](function(){return _0x276e2c[_0xa7a5('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x11cfc9[_0xa7a5('0x62')]['type']||_0xa7a5('0x109'),'lastPauseAt':moment()[_0xa7a5('0xb0')](_0xa7a5('0xfd'))});})[_0xa7a5('0x19')](respondWithResult(_0x1b5787,null))[_0xa7a5('0x23')](handleError(_0x1b5787,null));};exports[_0xa7a5('0x10a')]=function(_0x375b94,_0x4f76d5){if(_0x375b94[_0xa7a5('0x62')][_0xa7a5('0xb4')]&&!utils[_0xa7a5('0xa7')](_0x375b94[_0xa7a5('0x62')][_0xa7a5('0xb4')])){throw new APIBadRequestError(util[_0xa7a5('0xb0')](_0xa7a5('0x10b'),_0x375b94[_0xa7a5('0x62')][_0xa7a5('0xb4')]));}return db[_0xa7a5('0x3b')]['find']({'where':{'id':_0x375b94['params']['id']},'attributes':['id',_0xa7a5('0x38'),_0xa7a5('0x2d'),'internal',_0xa7a5('0xa6'),'online',_0xa7a5('0xa5'),_0xa7a5('0x10c'),_0xa7a5('0x10d'),'faxPause',_0xa7a5('0x10e'),_0xa7a5('0x10f'),_0xa7a5('0x110'),_0xa7a5('0x111'),_0xa7a5('0x112')]})[_0xa7a5('0x19')](function(_0x53220e){if(!_0x53220e){throw new APINotFoundError(util[_0xa7a5('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x375b94[_0xa7a5('0x55')]['id']));}return _0x53220e[_0xa7a5('0x10a')](_0x375b94[_0xa7a5('0x62')]['channel']);})[_0xa7a5('0x19')](respondWithResult(_0x4f76d5,null))[_0xa7a5('0x23')](APIHandleError(_0x4f76d5));};exports['getTeams']=function(_0x4e6719,_0x4cd727){var _0x33de5f={};var _0x3dffe6={};var _0x262161;var _0x29e7ca;return db[_0xa7a5('0x3b')][_0xa7a5('0x9e')]({'where':{'id':_0x4e6719[_0xa7a5('0x55')]['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0x4cd727,null))[_0xa7a5('0x19')](function(_0xb980dd){if(_0xb980dd){_0x262161=_0xb980dd;_0x3dffe6[_0xa7a5('0x56')]=_[_0xa7a5('0x58')](db[_0xa7a5('0x113')][_0xa7a5('0x3c')]);_0x3dffe6[_0xa7a5('0x44')]=_[_0xa7a5('0x58')](_0x4e6719['query']);_0x3dffe6[_0xa7a5('0xd5')]=_[_0xa7a5('0x5b')](_0x3dffe6[_0xa7a5('0x56')],_0x3dffe6[_0xa7a5('0x44')]);_0x33de5f[_0xa7a5('0x4a')]=_[_0xa7a5('0x5b')](_0x3dffe6['model'],qs[_0xa7a5('0x5c')](_0x4e6719[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x33de5f[_0xa7a5('0x4a')]=_0x33de5f['attributes'][_0xa7a5('0x5d')]?_0x33de5f[_0xa7a5('0x4a')]:_0x3dffe6[_0xa7a5('0x56')];_0x33de5f[_0xa7a5('0xd6')]=qs['sort'](_0x4e6719[_0xa7a5('0x44')][_0xa7a5('0xd7')]);_0x33de5f[_0xa7a5('0x42')]=qs[_0xa7a5('0xd5')](_[_0xa7a5('0xdb')](_0x4e6719[_0xa7a5('0x44')],_0x3dffe6[_0xa7a5('0xd5')]));if(_0x4e6719[_0xa7a5('0x44')][_0xa7a5('0x34')]){_0x33de5f['where']=_['merge'](_0x33de5f[_0xa7a5('0x42')],{'$or':_[_0xa7a5('0x36')](_0x33de5f[_0xa7a5('0x4a')],function(_0x5864b2){var _0x9cf767={};_0x9cf767[_0x5864b2]={'$like':'%'+_0x4e6719['query'][_0xa7a5('0x34')]+'%'};return _0x9cf767;})});}_0x33de5f=_['merge']({},_0x33de5f,_0x4e6719[_0xa7a5('0xdc')]);return _0x262161[_0xa7a5('0x114')](_0x33de5f);}})[_0xa7a5('0x19')](function(_0x3d608c){if(_0x3d608c){_0x29e7ca=_0x3d608c[_0xa7a5('0x5d')];if(!_0x4e6719[_0xa7a5('0x44')][_0xa7a5('0xcd')](_0xa7a5('0xd9'))){_0x33de5f[_0xa7a5('0x29')]=qs['limit'](_0x4e6719['query'][_0xa7a5('0x29')]);_0x33de5f[_0xa7a5('0x27')]=qs['offset'](_0x4e6719['query']['offset']);}return _0x262161[_0xa7a5('0x114')](_0x33de5f);}})[_0xa7a5('0x19')](function(_0x325c51){if(_0x325c51){return _0x325c51?{'count':_0x29e7ca,'rows':_0x325c51}:null;}})[_0xa7a5('0x19')](respondWithResult(_0x4cd727,null))[_0xa7a5('0x23')](handleError(_0x4cd727,null));};exports[_0xa7a5('0x115')]=function(_0x395d01,_0x144ea5){var _0x56e985=_0x395d01[_0xa7a5('0x55')]['id'];var _0x492398=_0x395d01[_0xa7a5('0x62')]?_0x395d01['body'][_0xa7a5('0x65')]:null;var _0x180501=[];return Promise[_0xa7a5('0x102')]()[_0xa7a5('0x19')](function(){if(!_0x492398)throw new APIBadRequestError(_0xa7a5('0x116'));})[_0xa7a5('0x19')](function(){return db[_0xa7a5('0x3b')]['findOne']({'where':{'id':_0x56e985}});})[_0xa7a5('0x19')](function(_0x517b11){if(!_0x517b11)throw new APINotFoundError(util[_0xa7a5('0xb0')](_0xa7a5('0xcc'),_0x395d01[_0xa7a5('0x55')]['id']));return db['sequelize'][_0xa7a5('0x117')](function(_0x4c0da0){return _0x517b11[_0xa7a5('0x115')](_0x492398,{'transaction':_0x4c0da0})[_0xa7a5('0x19')](function(){return db[_0xa7a5('0x113')][_0xa7a5('0x4c')]({'where':{'id':{'$in':_0x492398}}});})[_0xa7a5('0x19')](function(_0x2d8837){var _0xe2037f=_[_0xa7a5('0x36')](_0x2d8837,function(_0x3688e7){return _0x3688e7[_0xa7a5('0x118')]();});return Promise[_0xa7a5('0x53')](_0xe2037f);})[_0xa7a5('0x19')](function(_0x48381b){_0x180501=_[_0xa7a5('0x119')](_0x48381b);var _0x305cb7=_[_0xa7a5('0x36')](_0x180501,function(_0x1a3c0d){return _0x1a3c0d[_0xa7a5('0x11a')](_0x517b11['id'],{'transaction':_0x4c0da0});});return Promise[_0xa7a5('0x53')](_0x305cb7);})[_0xa7a5('0x19')](function(){if(!_0x517b11[_0xa7a5('0x106')])return;var _0x5ec0c=_[_0xa7a5('0x34')](_0x180501,function(_0x457dc2){return _0x457dc2[_0xa7a5('0x11b')](_0xa7a5('0xb4'))===_0xa7a5('0x11c');});var _0xd668b0=_['map'](_0x5ec0c,function(_0x5c3b5a){return db['UserVoiceQueueRt'][_0xa7a5('0x11d')]({'membername':_0x517b11[_0xa7a5('0x38')],'UserId':_0x517b11['id'],'queue_name':_0x5c3b5a[_0xa7a5('0x38')],'VoiceQueueId':_0x5c3b5a['id'],'interface':_['isNil'](_0x517b11[_0xa7a5('0xa6')])?util[_0xa7a5('0xb0')]('SIP/%s',_0x517b11[_0xa7a5('0x38')]):_0x517b11[_0xa7a5('0xa6')],'paused':_0x517b11[_0xa7a5('0xa5')]||![],'penalty':_0x517b11[_0xa7a5('0xaa')]},{'transaction':_0x4c0da0});});return Promise[_0xa7a5('0x53')](_0xd668b0);})[_0xa7a5('0x19')](function(){return db[_0xa7a5('0x11e')][_0xa7a5('0x4c')]({'where':{'teamId':{'$in':_0x492398}}});})['then'](function(_0x29d302){var _0x361d75=_[_0xa7a5('0x36')](_0x29d302,function(_0x58661c){return db[_0xa7a5('0x11f')]['create']({'UserId':_0x517b11['id'],'VoicePrefixId':_0x58661c[_0xa7a5('0x120')]},{'transaction':_0x4c0da0});});return Promise['all'](_0x361d75);});});})[_0xa7a5('0x19')](function(){for(var _0x5bd03=0x0;_0x5bd03<_0x180501[_0xa7a5('0x5d')];_0x5bd03++){var _0x4d0535=_0x180501[_0x5bd03][_0xa7a5('0x11b')](_0xa7a5('0xb4'));var _0x5decd6=_0x4d0535+_0xa7a5('0xab');socket['emit'](_0xa7a5('0x84')+_0x4d0535+_0xa7a5('0xad'),{'UserId':_0x56e985,['queueField']:_0x180501[_0x5bd03]['id']});}})[_0xa7a5('0x19')](respondWithStatusCode(_0x144ea5,null))[_0xa7a5('0x23')](APIHandleError(_0x144ea5));};exports[_0xa7a5('0x121')]=function(_0x17369d,_0x18ea1f){var _0x2ddeec=_0x17369d[_0xa7a5('0x55')]['id'];var _0x4747cd=null;if(_0x17369d[_0xa7a5('0x44')][_0xa7a5('0x65')]){_0x4747cd=_['isArray'](_0x17369d[_0xa7a5('0x44')]['ids'])?_0x17369d[_0xa7a5('0x44')]['ids']:[_0x17369d[_0xa7a5('0x44')]['ids']];}var _0x1fc516=[];return Promise[_0xa7a5('0x102')]()[_0xa7a5('0x19')](function(){if(!_0x4747cd)throw new APIBadRequestError(_0xa7a5('0x122'));})[_0xa7a5('0x19')](function(){return db[_0xa7a5('0x3b')][_0xa7a5('0x9e')]({'where':{'id':_0x2ddeec}});})['then'](function(_0x513a4e){if(!_0x513a4e)throw new APINotFoundError(util[_0xa7a5('0xb0')](_0xa7a5('0xcc'),_0x17369d[_0xa7a5('0x55')]['id']));return db['sequelize']['transaction'](function(_0x5ee858){return _0x513a4e[_0xa7a5('0x121')](_0x4747cd,{'transaction':_0x5ee858})['then'](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x4747cd}}});})['then'](function(_0x206d87){var _0x3517b8=_[_0xa7a5('0x36')](_0x206d87,function(_0x483684){return _0x483684[_0xa7a5('0x118')]();});return Promise[_0xa7a5('0x53')](_0x3517b8);})['then'](function(_0x261589){_0x1fc516=_[_0xa7a5('0x119')](_0x261589);var _0x2487ac=_[_0xa7a5('0x36')](_0x1fc516,function(_0x241add){return _0x241add[_0xa7a5('0x123')](_0x513a4e['id'],{'transaction':_0x5ee858});});return Promise[_0xa7a5('0x53')](_0x2487ac);})[_0xa7a5('0x19')](function(){if(!_0x513a4e['online'])return;var _0xf2351b=_[_0xa7a5('0x34')](_0x1fc516,function(_0x5cbbca){return _0x5cbbca[_0xa7a5('0x11b')](_0xa7a5('0xb4'))===_0xa7a5('0x11c');});var _0x378418=_['map'](_0xf2351b,function(_0x427921){return db[_0xa7a5('0xb2')][_0xa7a5('0x30')]({'where':{'VoiceQueueId':_0x427921['id'],'UserId':_0x513a4e['id']},'transaction':_0x5ee858});});return Promise['all'](_0x378418);})['then'](function(){return db[_0xa7a5('0x11e')]['findAll']({'where':{'teamId':{'$in':_0x4747cd}}});})[_0xa7a5('0x19')](function(_0x1cf94c){var _0x3352a0=_[_0xa7a5('0x36')](_0x1cf94c,function(_0x13d95f){return db[_0xa7a5('0x11f')][_0xa7a5('0x30')]({'where':{'UserId':_0x513a4e['id'],'VoicePrefixId':_0x13d95f['VoicePrefixId']}},{'transaction':_0x5ee858});});return Promise['all'](_0x3352a0);});});})['then'](function(){for(var _0x3e1c56=0x0;_0x3e1c56<_0x1fc516[_0xa7a5('0x5d')];_0x3e1c56++){var _0x27922c=_0x1fc516[_0x3e1c56]['getDataValue'](_0xa7a5('0xb4'));var _0x555338=_0x27922c+_0xa7a5('0xab');socket['emit'](_0xa7a5('0x84')+_0x27922c+'Queue:remove',{'UserId':_0x2ddeec,['queueField']:_0x1fc516[_0x3e1c56]['id']});}})[_0xa7a5('0x19')](respondWithStatusCode(_0x18ea1f,null))[_0xa7a5('0x23')](APIHandleError(_0x18ea1f));};exports['getLists']=function(_0x4d7c74,_0x440feb){var _0x295da1={};var _0x4e2b0c={};var _0xca737b;var _0x2972d6;return db[_0xa7a5('0x3b')][_0xa7a5('0x9e')]({'where':{'id':_0x4d7c74[_0xa7a5('0x55')]['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0x440feb,null))['then'](function(_0x133d5f){if(_0x133d5f){_0xca737b=_0x133d5f;_0x4e2b0c[_0xa7a5('0x56')]=_[_0xa7a5('0x58')](db[_0xa7a5('0xce')][_0xa7a5('0x3c')]);_0x4e2b0c['query']=_[_0xa7a5('0x58')](_0x4d7c74['query']);_0x4e2b0c[_0xa7a5('0xd5')]=_[_0xa7a5('0x5b')](_0x4e2b0c[_0xa7a5('0x56')],_0x4e2b0c[_0xa7a5('0x44')]);_0x295da1['attributes']=_['intersection'](_0x4e2b0c['model'],qs[_0xa7a5('0x5c')](_0x4d7c74[_0xa7a5('0x44')][_0xa7a5('0x5c')]));_0x295da1[_0xa7a5('0x4a')]=_0x295da1[_0xa7a5('0x4a')][_0xa7a5('0x5d')]?_0x295da1[_0xa7a5('0x4a')]:_0x4e2b0c[_0xa7a5('0x56')];_0x295da1['order']=qs[_0xa7a5('0xd7')](_0x4d7c74['query'][_0xa7a5('0xd7')]);_0x295da1[_0xa7a5('0x42')]=qs[_0xa7a5('0xd5')](_[_0xa7a5('0xdb')](_0x4d7c74[_0xa7a5('0x44')],_0x4e2b0c[_0xa7a5('0xd5')]));if(_0x4d7c74[_0xa7a5('0x44')][_0xa7a5('0x34')]){_0x295da1[_0xa7a5('0x42')]=_[_0xa7a5('0x5e')](_0x295da1[_0xa7a5('0x42')],{'$or':_[_0xa7a5('0x36')](_0x295da1[_0xa7a5('0x4a')],function(_0x113549){var _0x596995={};_0x596995[_0x113549]={'$like':'%'+_0x4d7c74[_0xa7a5('0x44')]['filter']+'%'};return _0x596995;})});}_0x295da1=_[_0xa7a5('0x5e')]({},_0x295da1,_0x4d7c74[_0xa7a5('0xdc')]);return _0xca737b[_0xa7a5('0x124')](_0x295da1);}})['then'](function(_0x4fdc09){if(_0x4fdc09){_0x2972d6=_0x4fdc09[_0xa7a5('0x5d')];if(!_0x4d7c74[_0xa7a5('0x44')][_0xa7a5('0xcd')](_0xa7a5('0xd9'))){_0x295da1[_0xa7a5('0x29')]=qs[_0xa7a5('0x29')](_0x4d7c74['query'][_0xa7a5('0x29')]);_0x295da1[_0xa7a5('0x27')]=qs[_0xa7a5('0x27')](_0x4d7c74[_0xa7a5('0x44')][_0xa7a5('0x27')]);}return _0xca737b[_0xa7a5('0x124')](_0x295da1);}})[_0xa7a5('0x19')](function(_0x4298c9){if(_0x4298c9){return _0x4298c9?{'count':_0x2972d6,'rows':_0x4298c9}:null;}})[_0xa7a5('0x19')](respondWithResult(_0x440feb,null))['catch'](handleError(_0x440feb,null));};exports['getAgents']=function(_0x588ca6,_0x486317){var _0x3361ca={};var _0x154900={};var _0x803822;return db[_0xa7a5('0x3b')]['findOne']({'where':{'id':_0x588ca6['params']['id']}})[_0xa7a5('0x19')](handleEntityNotFound(_0x486317,null))['then'](function(_0x1f0c57){if(_0x1f0c57){_0x803822=_0x1f0c57;_0x154900['model']=_[_0xa7a5('0x58')](db[_0xa7a5('0x3b')][_0xa7a5('0x3c')]);_0x154900[_0xa7a5('0x44')]=_['keys'](_0x588ca6[_0xa7a5('0x44')]);_0x154900[_0xa7a5('0xd5')]=_[_0xa7a5('0x5b')](_0x154900[_0xa7a5('0x56')],_0x154900[_0xa7a5('0x44')]);_0x3361ca[_0xa7a5('0x4a')]=_[_0xa7a5('0x5b')](_0x154900[_0xa7a5('0x56')],qs['fields'](_0x588ca6['query'][_0xa7a5('0x5c')]));_0x3361ca['attributes']=_0x3361ca[_0xa7a5('0x4a')][_0xa7a5('0x5d')]?_0x3361ca['attributes']:_0x154900['model'];_0x3361ca[_0xa7a5('0xd6')]=qs[_0xa7a5('0xd7')](_0x588ca6[_0xa7a5('0x44')]['sort']);_0x3361ca[_0xa7a5('0x42')]=qs[_0xa7a5('0xd5')](_[_0xa7a5('0xdb')](_0x588ca6[_0xa7a5('0x44')],_0x154900[_0xa7a5('0xd5')]));if(_0x588ca6[_0xa7a5('0x44')][_0xa7a5('0x34')]){_0x3361ca[_0xa7a5('0x42')]=_[_0xa7a5('0x5e')](_0x3361ca[_0xa7a5('0x42')],{'$or':_[_0xa7a5('0x36')](_0x3361ca[_0xa7a5('0x4a')],function(_0x1a41e4){var _0x16427b={};_0x16427b[_0x1a41e4]={'$like':'%'+_0x588ca6['query'][_0xa7a5('0x34')]+'%'};return _0x16427b;})});}_0x3361ca[_0xa7a5('0x56')]=db[_0xa7a5('0x3b')];_0x3361ca['as']=_0xa7a5('0x8b');_0x3361ca=_[_0xa7a5('0x5e')]({},_0x3361ca,_0x588ca6[_0xa7a5('0xdc')]);return _0x803822['getVoiceQueues']({'include':[_0x3361ca]});}})[_0xa7a5('0x19')](function(_0x3508f0){if(_0x3508f0){var _0x483c78={},_0x54722a=[];for(var _0x25cf9c=0x0;_0x25cf9c<_0x3508f0[_0xa7a5('0x5d')];_0x25cf9c+=0x1){for(var _0x2cb685=0x0,_0x267b82;_0x2cb685<_0x3508f0[_0x25cf9c][_0xa7a5('0x8b')][_0xa7a5('0x5d')];_0x2cb685+=0x1){_0x267b82=_0x3508f0[_0x25cf9c][_0xa7a5('0x8b')][_0x2cb685]['get']({'plain':!![]});_0x483c78[_0x267b82['id']]=_0x267b82;}}_0x483c78=_[_0xa7a5('0x125')](_0x483c78);for(var _0xa2d18a=qs['offset'](_0x588ca6[_0xa7a5('0x44')]['offset']);_0xa2d18a<_0x483c78[_0xa7a5('0x5d')]&&_0x54722a[_0xa7a5('0x5d')]=_0x5d236c){_0x27c160=_0x5d236c;_0x4e37b1=0xc8;}else{_0x4e37b1=0xce;}_0x3aec05['status'](_0x4e37b1);return _0x3aec05['set']('Content-Range',_0x4562cc+'-'+_0x27c160+'/'+_0x5d236c)[_0xdc88('0x20')](_0x2777d8);}return null;};}function saveUpdates(_0x142603){return function(_0x1cc5a9){if(_0x1cc5a9){return _0x1cc5a9['update'](_0x142603)['then'](function(_0x3bbb06){if(_0x3bbb06['role']==='agent'){socket[_0xdc88('0x25')](_0xdc88('0x26')+_0x3bbb06['id'],_0x3bbb06);}return _0x3bbb06;});}return null;};}function removeEntity(_0x1016a9){return function(_0x1045da){if(_0x1045da){return _0x1045da['destroy']()['then'](function(){var _0x1fe09d=_0x1045da['get']({'plain':!![]});if(_0x1fe09d[_0xdc88('0x27')]==='admin')return;var _0x5f0472=[{'name':_0xdc88('0x28'),'value':_0xdc88('0x29'),'ignore':!![]},{'name':_0xdc88('0x2a'),'value':_0xdc88('0x2b'),'ignore':![]},{'name':_0xdc88('0x2c'),'value':'telephone','ignore':![]}];var _0x4099a4=_(_0x5f0472)[_0xdc88('0x2d')]('ignore')[_0xdc88('0x2e')](_0xdc88('0x2f'))['value']();if(_[_0xdc88('0x30')](_0x4099a4,_0x1fe09d[_0xdc88('0x27')])){return;}var _0x24021e=_[_0xdc88('0x31')](_0x5f0472,['value',_0x1fe09d[_0xdc88('0x27')]])[_0xdc88('0x32')];return db[_0xdc88('0x33')][_0xdc88('0x34')]({'where':{'type':_0x24021e,'resourceId':_0x1fe09d['id']}})[_0xdc88('0x14')](function(){return _0x1045da;});})[_0xdc88('0x14')](function(){_0x1016a9[_0xdc88('0x1e')](0xcc)[_0xdc88('0x1f')]();});}};}function handleEntityNotFound(_0x2c702f){return function(_0xd4a9d0){if(!_0xd4a9d0){_0x2c702f[_0xdc88('0x35')](0x194);}return _0xd4a9d0;};}function handleError(_0x10c94e,_0x1f4632){_0x1f4632=_0x1f4632||0x1f4;return function(_0x4dca39){logger[_0xdc88('0x1a')](_0x4dca39[_0xdc88('0x36')]);if(_0x4dca39[_0xdc88('0x32')]){delete _0x4dca39['name'];}_0x10c94e[_0xdc88('0x1e')](_0x1f4632)[_0xdc88('0x37')](_0x4dca39);};}exports[_0xdc88('0x38')]=function(_0x1775b2,_0x334815){var _0x1f0cee={},_0x3a3e1b={'count':0x0,'rows':[]};var _0x3f8151=_(db[_0xdc88('0x39')][_0xdc88('0x3a')])[_0xdc88('0x2e')](function(_0x49dc8d){return{'name':_0x49dc8d[_0xdc88('0x3b')],'type':_0x49dc8d['type'][_0xdc88('0x3c')]};})['filter'](function(_0x3940eb){return!_['includes'](['password',_0xdc88('0x3d')],_0x3940eb[_0xdc88('0x32')]);})['value']();_0x1f0cee=qs['getOptions'](_0x3f8151,_0x1775b2);var _0x3ce4ba={'where':_0x1f0cee[_0xdc88('0x3e')]};return db[_0xdc88('0x39')]['count'](_0x3ce4ba)[_0xdc88('0x14')](function(_0x4f377b){_0x3a3e1b[_0xdc88('0x24')]=_0x4f377b;if(_0x1775b2[_0xdc88('0x3f')][_0xdc88('0x40')]){_0x1f0cee[_0xdc88('0x41')]=[{'all':!![]}];}if(_0x1775b2[_0xdc88('0x3f')]['userSetting']===_0xdc88('0x42')){_0x1f0cee[_0xdc88('0x41')]=[{'model':db[_0xdc88('0x43')],'as':'userSetting'}];}if(!_[_0xdc88('0x30')](_0x1f0cee['attributes'],'id')){_0x1f0cee['attributes'][_0xdc88('0x44')]('id');}return db['User'][_0xdc88('0x45')](_0x1f0cee);})[_0xdc88('0x14')](function(_0x5ebd69){_0x3a3e1b[_0xdc88('0x46')]=_0x5ebd69;if(_0x1775b2[_0xdc88('0x3f')][_0xdc88('0x47')]==='true'){var _0x3a786a=[];for(var _0x24f45c=0x0;_0x24f45c<_0x3a3e1b[_0xdc88('0x46')][_0xdc88('0x48')];_0x24f45c++){_0x3a786a[_0xdc88('0x44')](get_open_tabs('chat',_0x3a3e1b['rows'][_0x24f45c][_0xdc88('0x49')]));_0x3a786a[_0xdc88('0x44')](get_open_tabs(_0xdc88('0x4a'),_0x3a3e1b[_0xdc88('0x46')][_0x24f45c]['dataValues']));_0x3a786a[_0xdc88('0x44')](get_open_tabs(_0xdc88('0x4b'),_0x3a3e1b['rows'][_0x24f45c][_0xdc88('0x49')]));_0x3a786a[_0xdc88('0x44')](get_open_tabs('mail',_0x3a3e1b[_0xdc88('0x46')][_0x24f45c]['dataValues']));_0x3a786a[_0xdc88('0x44')](get_open_tabs(_0xdc88('0x4c'),_0x3a3e1b[_0xdc88('0x46')][_0x24f45c][_0xdc88('0x49')]));_0x3a786a[_0xdc88('0x44')](get_open_tabs(_0xdc88('0x4d'),_0x3a3e1b[_0xdc88('0x46')][_0x24f45c][_0xdc88('0x49')]));}return Promise[_0xdc88('0x4e')](_0x3a786a)[_0xdc88('0x14')](function(){return _0x3a3e1b;});}else{return _0x3a3e1b;}})[_0xdc88('0x14')](respondWithFilteredResult(_0x334815,_0x1f0cee))[_0xdc88('0x4f')](handleError(_0x334815,null));};exports[_0xdc88('0x50')]=function(_0x9850ff,_0x28d573){var _0x6843d2={'raw':![],'where':{'id':_0x9850ff[_0xdc88('0x51')]['id']}},_0x3637b4={};_0x3637b4['model']=_['differenceBy'](_[_0xdc88('0x52')](db[_0xdc88('0x39')][_0xdc88('0x3a')]),[_0xdc88('0x53'),_0xdc88('0x3d')]);_0x3637b4[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x9850ff[_0xdc88('0x3f')]);_0x3637b4['filters']=_[_0xdc88('0x54')](_0x3637b4[_0xdc88('0x55')],_0x3637b4[_0xdc88('0x3f')]);_0x6843d2['attributes']=_['intersection'](_0x3637b4[_0xdc88('0x55')],qs[_0xdc88('0x56')](_0x9850ff['query'][_0xdc88('0x56')]));_0x6843d2['attributes']=_0x6843d2['attributes'][_0xdc88('0x48')]?_0x6843d2[_0xdc88('0x57')]:_0x3637b4[_0xdc88('0x55')];if(_0x9850ff[_0xdc88('0x3f')][_0xdc88('0x40')]){_0x6843d2[_0xdc88('0x41')]=[{'all':!![]}];}if(_0x9850ff['query'][_0xdc88('0x58')]===_0xdc88('0x42')){_0x6843d2[_0xdc88('0x41')]=[{'model':db[_0xdc88('0x43')],'as':'userSetting'}];}_0x6843d2=_['merge']({},_0x6843d2,_0x9850ff[_0xdc88('0x59')]);if(!_[_0xdc88('0x30')](_0x6843d2[_0xdc88('0x57')],'id')){_0x6843d2['attributes'][_0xdc88('0x44')]('id');}return db[_0xdc88('0x39')][_0xdc88('0x31')](_0x6843d2)[_0xdc88('0x14')](handleEntityNotFound(_0x28d573,null))[_0xdc88('0x14')](function(_0x6c1624){var _0x44752f=[];values=_0x6c1624;if(_0x9850ff['query']['openTabs']===_0xdc88('0x42')){_0x44752f[_0xdc88('0x44')](get_open_tabs(_0xdc88('0x5a'),_0x6c1624[_0xdc88('0x49')]));_0x44752f[_0xdc88('0x44')](get_open_tabs(_0xdc88('0x4a'),_0x6c1624[_0xdc88('0x49')]));_0x44752f[_0xdc88('0x44')](get_open_tabs(_0xdc88('0x4c'),_0x6c1624['dataValues']));_0x44752f[_0xdc88('0x44')](get_open_tabs(_0xdc88('0x4d'),_0x6c1624['dataValues']));_0x44752f[_0xdc88('0x44')](get_open_tabs(_0xdc88('0x4b'),_0x6c1624[_0xdc88('0x49')]));_0x44752f[_0xdc88('0x44')](get_open_tabs(_0xdc88('0x5b'),_0x6c1624[_0xdc88('0x49')]));return Promise[_0xdc88('0x4e')](_0x44752f);}else{return values;}})[_0xdc88('0x14')](function(){return values;})['then'](respondWithResult(_0x28d573,null))['catch'](handleError(_0x28d573,null));};exports['update']=function(_0x1866e6,_0x5dbc5b){if(_0x1866e6[_0xdc88('0x5c')]['id']){delete _0x1866e6[_0xdc88('0x5c')]['id'];}delete _0x1866e6[_0xdc88('0x5c')][_0xdc88('0x27')];return db[_0xdc88('0x39')]['find']({'where':{'id':_0x1866e6[_0xdc88('0x51')]['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x5dbc5b,null))[_0xdc88('0x14')](saveUpdates(_0x1866e6['body'],null))[_0xdc88('0x14')](respondWithResult(_0x5dbc5b,null))[_0xdc88('0x4f')](handleError(_0x5dbc5b,null));};exports['describe']=function(_0x27e4ed,_0xc78229){return db['User'][_0xdc88('0x5d')]()['then'](respondWithResult(_0xc78229,null))[_0xdc88('0x4f')](handleError(_0xc78229,null));};exports[_0xdc88('0x5e')]=function(_0x1226ca,_0x413b41){return db['User'][_0xdc88('0x31')]({'where':{'id':_0x1226ca[_0xdc88('0x51')]['id']}})['then'](handleEntityNotFound(_0x413b41,null))[_0xdc88('0x14')](function(_0x1814c3){if(_0x1814c3){return _0x1814c3[_0xdc88('0x5e')](_0x1226ca['body'][_0xdc88('0x5f')],_[_0xdc88('0x60')](_0x1226ca[_0xdc88('0x5c')],[_0xdc88('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x413b41,null))[_0xdc88('0x4f')](handleError(_0x413b41,null));};function validateUser(_0x49992e){return new Promise(function(_0x710535,_0x59f120){if(_0x49992e[_0xdc88('0x61')])return _0x710535(_0x49992e);return db[_0xdc88('0x62')]['findById'](0x1)['then'](function(_0x28bc21){if(_0x28bc21[_0xdc88('0x63')])authService[_0xdc88('0x64')](_0x49992e[_0xdc88('0x53')]);db[_0xdc88('0x39')][_0xdc88('0x65')](_0xdc88('0x61'))['then'](function(_0xee655){if(_['isNil'](_0xee655)){_0x49992e[_0xdc88('0x61')]=_0x28bc21['min_internal']||0x1;return;}if(_[_0xdc88('0x66')](_0x28bc21[_0xdc88('0x67')])||_0x28bc21['min_internal']===_0xee655){_0x49992e[_0xdc88('0x61')]=_0xee655+0x1;return;}if(_0x28bc21[_0xdc88('0x67')]>_0xee655){_0x49992e[_0xdc88('0x61')]=_0x28bc21[_0xdc88('0x67')];return;}return db[_0xdc88('0x68')]['query'](_0xdc88('0x69'),{'type':db[_0xdc88('0x68')][_0xdc88('0x6a')][_0xdc88('0x6b')]})[_0xdc88('0x14')](function(_0x28323f){if(_0x28323f&&_0x28323f[_0xdc88('0x48')]){for(var _0x422b26=0x0,_0x33605f=_0x28323f[_0xdc88('0x48')];_0x422b26<_0x33605f&&_[_0xdc88('0x66')](_0x49992e[_0xdc88('0x61')]);_0x422b26++){if(_0x28bc21['min_internal']<=_0x28323f[_0x422b26][_0xdc88('0x6c')]){_0x49992e['internal']=_0x28323f[_0x422b26][_0xdc88('0x6c')];}else if(_0x28bc21[_0xdc88('0x67')]>_0x28323f[_0x422b26][_0xdc88('0x6c')]&&_0x28bc21[_0xdc88('0x67')]<=_0x28323f[_0x422b26]['to']){_0x49992e[_0xdc88('0x61')]=_0x28bc21[_0xdc88('0x67')];}}}if(_[_0xdc88('0x66')](_0x49992e[_0xdc88('0x61')])){_0x49992e[_0xdc88('0x61')]=_0xee655+0x1;}return _0x710535(_0x49992e);});});})['catch'](function(_0x9406fc){_0x59f120(_0x9406fc);});});}function updateUser(_0x35c454){return new Promise(function(_0x592022,_0x4f05f8){try{if(_0x35c454[_0xdc88('0x6d')]){_0x35c454[_0xdc88('0x6e')]=_0x35c454[_0xdc88('0x61')];_0x35c454[_0xdc88('0x6f')]={'mailbox':_0x35c454[_0xdc88('0x61')],'password':_0x35c454[_0xdc88('0x53')],'fullname':_0x35c454['fullname'],'email':_0x35c454[_0xdc88('0x70')]};}if(_0x35c454['role']===_0xdc88('0x2b')){if(!_0x35c454[_0xdc88('0x71')])_0x35c454[_0xdc88('0x71')]=['101','102',_0xdc88('0x72'),'113',_0xdc88('0x73'),_0xdc88('0x74'),'105',_0xdc88('0x75'),_0xdc88('0x76'),'108',_0xdc88('0x77'),'100',_0xdc88('0x78'),_0xdc88('0x79'),'115'];}_0x592022(_0x35c454);}catch(_0x49ea58){_0x4f05f8(_0x49ea58);}});}exports[_0xdc88('0x7a')]=function(_0x58326d,_0x3f59dc){if(_0x58326d['user'][_0xdc88('0x27')]===_0xdc88('0x2b'))throw new Error(_0xdc88('0x7b'));if(_0x58326d[_0xdc88('0x5c')][_0xdc88('0x27')]===_0xdc88('0x29')&&_0x58326d[_0xdc88('0x29')]['role']!==_0xdc88('0x7c')){throw new Error(_0xdc88('0x7d'));}if(_0x58326d[_0xdc88('0x5c')][_0xdc88('0x27')]===_0xdc88('0x7c')&&_0x58326d[_0xdc88('0x29')][_0xdc88('0x27')]!=='admin'){throw new Error(_0xdc88('0x7e'));}return licenseUtil[_0xdc88('0x7f')]([_0x58326d[_0xdc88('0x5c')]])['then'](function(){return validateUser(_0x58326d[_0xdc88('0x5c')]);})[_0xdc88('0x14')](function(_0x4f790d){return updateUser(_0x4f790d)[_0xdc88('0x14')](function(_0xde2c32){if(_0xde2c32['role']===_0xdc88('0x7c')){_0xde2c32['settingsEnabled']=_0x58326d['user'][_0xdc88('0x80')];delete _0xde2c32[_0xdc88('0x81')];}return _0xde2c32;});})[_0xdc88('0x14')](function(_0x1dbfb6){return db['User'][_0xdc88('0x7a')](_0x1dbfb6,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x4acfaf){if(_0x58326d[_0xdc88('0x5c')][_0xdc88('0x27')]===_0xdc88('0x29'))return _0x4acfaf;if(_0x58326d[_0xdc88('0x29')]['role']!=='user')return _0x4acfaf;return db[_0xdc88('0x82')]['find']({'where':{'name':_0x4acfaf[_0xdc88('0x27')]==='agent'?_0xdc88('0x2a'):_0xdc88('0x2c'),'userProfileId':_0x58326d[_0xdc88('0x29')]['userProfileId']},'raw':!![]})[_0xdc88('0x14')](function(_0x26670f){if(!_0x26670f||_0x26670f[_0xdc88('0x83')]!=0x0)return _0x4acfaf;return db[_0xdc88('0x33')][_0xdc88('0x7a')]({'name':_0x4acfaf[_0xdc88('0x32')],'resourceId':_0x4acfaf['id'],'type':_0x26670f[_0xdc88('0x32')],'sectionId':_0x26670f['id']},{})[_0xdc88('0x14')](function(){return _0x4acfaf;});})[_0xdc88('0x4f')](function(_0x3f533e){logger['error'](_0xdc88('0x84'),_0x3f533e);throw _0x3f533e;});})[_0xdc88('0x14')](respondWithResult(_0x3f59dc,0xc9))['catch'](handleError(_0x3f59dc,null));};exports['bulkCreate']=function(_0x1bfea8,_0x2634b0){var _0x48aa45=_0x1bfea8[_0xdc88('0x5c')];var _0x55b700=[];if(_0x1bfea8[_0xdc88('0x29')][_0xdc88('0x27')]==='agent')throw new Error(_0xdc88('0x7b'));if(_[_0xdc88('0x85')](_0x48aa45,[_0xdc88('0x27'),_0xdc88('0x29')])&&_0x1bfea8[_0xdc88('0x29')][_0xdc88('0x27')]!==_0xdc88('0x7c')){throw new Error(_0xdc88('0x7d'));}if(_['some'](_0x48aa45,[_0xdc88('0x27'),'admin'])&&_0x1bfea8[_0xdc88('0x29')][_0xdc88('0x27')]!==_0xdc88('0x7c')){throw new Error(_0xdc88('0x86'));}return licenseUtil[_0xdc88('0x7f')](_0x48aa45)[_0xdc88('0x14')](function(){return validateUser(_0x48aa45[0x0]);})[_0xdc88('0x14')](function(){for(var _0x3623c7=0x1;_0x3623c7<_0x48aa45[_0xdc88('0x48')];_0x3623c7++){var _0x48e1ba=_0x48aa45[_0x3623c7-0x1][_0xdc88('0x61')];if(!_0x48aa45[_0x3623c7][_0xdc88('0x61')])_0x48aa45[_0x3623c7][_0xdc88('0x61')]=_0x48e1ba+0x1;_0x55b700[_0xdc88('0x44')](validateUser(_0x48aa45[_0x3623c7]));}return Promise[_0xdc88('0x4e')](_0x55b700);})['then'](function(){_0x55b700=[];for(var _0x36e49f=0x0;_0x36e49f<_0x48aa45[_0xdc88('0x48')];_0x36e49f++){_0x55b700['push'](updateUser(_0x48aa45[_0x36e49f]));}return Promise['all'](_0x55b700);})['then'](function(){_0x55b700=_0x48aa45['map'](function(_0x285144){return db[_0xdc88('0x39')][_0xdc88('0x7a')](_0x285144,{'include':[{'model':db['VoiceMail'],'as':_0xdc88('0x6f')}]})[_0xdc88('0x14')](function(_0x2cbd78){_0x285144['id']=_0x2cbd78['id'];return _0x285144;});});return Promise[_0xdc88('0x4e')](_0x55b700);})[_0xdc88('0x14')](function(_0x3368ff){if(_0x1bfea8[_0xdc88('0x5c')][_0xdc88('0x27')]===_0xdc88('0x29'))return _0x3368ff;if(_0x1bfea8['user']['role']!=='user')return _0x3368ff;var _0x144358=_[_0xdc88('0x85')](_0x3368ff,function(_0x411545){return _0x411545[_0xdc88('0x27')]===_0xdc88('0x2b')||_0x411545[_0xdc88('0x27')]===_0xdc88('0x87');});if(!_0x144358)return _0x3368ff;return db[_0xdc88('0x82')][_0xdc88('0x45')]({'where':{'name':{'$or':['Agents',_0xdc88('0x2c')]},'userProfileId':_0x1bfea8[_0xdc88('0x29')][_0xdc88('0x81')]},'raw':!![]})[_0xdc88('0x14')](function(_0x21d07c){if(_[_0xdc88('0x88')](_0x21d07c)||!_[_0xdc88('0x85')](_0x21d07c,[_0xdc88('0x83'),0x0]))return _0x3368ff;_0x55b700=[];var _0x31c462=_(_0x21d07c)[_0xdc88('0x2e')](function(_0x1cf955){if(_0x1cf955['autoAssociation']===0x1)return;return _0x1cf955[_0xdc88('0x32')]==='Agents'?_0xdc88('0x2b'):'telephone';})['compact']()[_0xdc88('0x2f')]();for(var _0x5c4006=0x0;_0x5c4006<_0x3368ff[_0xdc88('0x48')];_0x5c4006++){if(!_[_0xdc88('0x30')](_0x31c462,_0x3368ff[_0x5c4006][_0xdc88('0x27')]))return;var _0x9c6d0=_0x3368ff[_0x5c4006]['role']===_0xdc88('0x2b')?_0xdc88('0x2a'):'Telephones';_0x55b700[_0xdc88('0x44')](db['UserProfileResource'][_0xdc88('0x7a')]({'name':_0x3368ff[_0x5c4006][_0xdc88('0x32')],'resourceId':_0x3368ff[_0x5c4006]['id'],'type':_0x9c6d0,'sectionId':_[_0xdc88('0x31')](_0x21d07c,['name',_0x9c6d0])['id']},{}));}return Promise[_0xdc88('0x4e')](_0x55b700);});})[_0xdc88('0x14')](respondWithResult(_0x2634b0,0xc9))[_0xdc88('0x4f')](handleError(_0x2634b0,null));};exports[_0xdc88('0x89')]=function(_0x1a228c,_0x4d5c8e){if(_0x1a228c['body']['id']){delete _0x1a228c['body']['id'];}return db[_0xdc88('0x39')][_0xdc88('0x31')]({'where':{'id':_0x1a228c['params']['id']}})['then'](function(_0x4c10ec){if(!_0x4c10ec)return null;if(_0x4c10ec['id']===_0x1a228c[_0xdc88('0x29')]['id']){if(!_0x1a228c[_0xdc88('0x5c')][_0xdc88('0x8a')]||!_0x1a228c[_0xdc88('0x5c')][_0xdc88('0x8b')]){throw new db[(_0xdc88('0x8c'))][(_0xdc88('0x8d'))](_0xdc88('0x8e'));}if(!_0x4c10ec[_0xdc88('0x8f')](_0x1a228c[_0xdc88('0x5c')][_0xdc88('0x8a')])){throw new db[(_0xdc88('0x8c'))][(_0xdc88('0x8d'))]('Wrong\x20credentials');}if(_0x1a228c['body']['oldPassword']===_0x1a228c[_0xdc88('0x5c')][_0xdc88('0x8b')]){throw new db[(_0xdc88('0x8c'))]['ValidationError'](_0xdc88('0x90'));}}else if(_0x1a228c['user'][_0xdc88('0x27')]===_0xdc88('0x7c')){if(!_0x1a228c[_0xdc88('0x5c')][_0xdc88('0x8b')]){throw new db[(_0xdc88('0x8c'))][(_0xdc88('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x1a228c[_0xdc88('0x29')][_0xdc88('0x27')]===_0xdc88('0x29')){if(!_0x1a228c['body'][_0xdc88('0x8b')]){throw new db[(_0xdc88('0x8c'))]['ValidationError'](_0xdc88('0x91'));}if(_0x4c10ec[_0xdc88('0x27')]!==_0xdc88('0x2b')){throw new db[(_0xdc88('0x8c'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0xdc88('0x8c'))]['ValidationError'](_0xdc88('0x7b'));}return _0x4c10ec;})[_0xdc88('0x14')](handleEntityNotFound(_0x4d5c8e,null))['then'](function(_0x4588f7){return db[_0xdc88('0x62')]['findOne']({'attributes':['id',_0xdc88('0x63'),_0xdc88('0x92'),_0xdc88('0x93')]})[_0xdc88('0x14')](function(_0x123dc5){if(_0x123dc5[_0xdc88('0x63')])authService['validatePasswordPattern'](_0x1a228c[_0xdc88('0x5c')]['newPassword']);if(!_0x123dc5['enforcePasswordHistory']||!_0x4588f7[_0xdc88('0x94')])return _0x4588f7;authService['validatePasswordHistory'](_0x1a228c['body']['newPassword'],_0x4588f7['previousPasswords'],_0x123dc5[_0xdc88('0x93')]);return _0x4588f7;})[_0xdc88('0x14')](saveUpdates({'password':_0x1a228c[_0xdc88('0x5c')][_0xdc88('0x8b')],'passwordResetAt':_0x1a228c[_0xdc88('0x29')]['id']==_0x1a228c['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x1a228c[_0xdc88('0x5c')][_0xdc88('0x8b')],_0x4588f7[_0xdc88('0x94')])},null));})['then'](respondWithResult(_0x4d5c8e,null))[_0xdc88('0x4f')](handleError(_0x4d5c8e,null));};exports[_0xdc88('0x95')]=function(_0xdab12f,_0x46775a){var _0x21703a=_0xdab12f[_0xdc88('0x5c')][_0xdc88('0x96')];return db[_0xdc88('0x39')][_0xdc88('0x31')]({'where':{'id':_0xdab12f[_0xdc88('0x51')]['id']},'attributes':['id',_0xdc88('0x32'),_0xdc88('0x27'),_0xdc88('0x97'),_0xdc88('0x98'),_0xdc88('0x99'),_0xdc88('0x9a')]})[_0xdc88('0x14')](handleEntityNotFound(_0x46775a,null))['then'](function(_0x2196b2){if(_0x2196b2){if(!utils[_0xdc88('0x9b')](_0x21703a)){throw new db[(_0xdc88('0x8c'))]['ValidationError']('Unknown\x20channel');}return _0x2196b2['add'+_[_0xdc88('0x9c')](_0x21703a[_0xdc88('0x9d')]())+_0xdc88('0x9e')](_0xdab12f[_0xdc88('0x5c')][_0xdc88('0x5f')],{'penalty':_0xdab12f[_0xdc88('0x5c')]['penalty']||0x0})['spread'](function(_0x1fc917){for(var _0x5f4438=0x0;_0x5f4438<_0xdab12f[_0xdc88('0x5c')]['ids']['length'];_0x5f4438+=0x1){var _0x5939e7={'UserId':Number(_0xdab12f['params']['id'])};_0x5939e7[_[_0xdc88('0x9c')](_0x21703a[_0xdc88('0x9d')]())+_0xdc88('0x9f')]=Number(_0xdab12f[_0xdc88('0x5c')]['ids'][_0x5f4438]);socket['emit']('user'+_['capitalize'](_0x21703a[_0xdc88('0x9d')]())+_0xdc88('0xa0'),_0x5939e7);}return _0x1fc917;})[_0xdc88('0x14')](function(){if(_0x21703a===_0xdc88('0xa1')){return db[_0xdc88('0xa2')]['findAll']({'where':{'id':_0xdab12f[_0xdc88('0x5c')][_0xdc88('0x5f')]||[]},'raw':!![],'attributes':['id',_0xdc88('0x32')]});}})[_0xdc88('0x14')](function(_0xed06d3){var _0x274521=_0x2196b2[_0xdc88('0xa3')]({'plain':!![]});var _0x5608ab=[];if(_0x21703a===_0xdc88('0xa1')&&_0x274521['role']===_0xdc88('0x2b')&&_0x274521['online']){for(let _0x45f2ed=0x0;_0x45f2ed<_0xed06d3['length'];_0x45f2ed+=0x1){_0x5608ab[_0xdc88('0x44')]({'membername':_0x274521[_0xdc88('0x32')],'UserId':_0x274521['id'],'queue_name':_0xed06d3[_0x45f2ed][_0xdc88('0x32')],'VoiceQueueId':_0xed06d3[_0x45f2ed]['id'],'interface':_[_0xdc88('0x66')](_0x274521[_0xdc88('0x9a')])?util[_0xdc88('0xa4')](_0xdc88('0xa5'),_0x274521[_0xdc88('0x32')]):_0x274521[_0xdc88('0x9a')],'paused':_0x274521['voicePause']||![],'penalty':_0xdab12f[_0xdc88('0x5c')]['penalty']||0x0});}return Promise[_0xdc88('0x4e')](_0x5608ab[_0xdc88('0x2e')](function(_0xa5abe3){return db[_0xdc88('0xa6')]['upsert'](_0xa5abe3);}));}return _0x2196b2;});}})[_0xdc88('0x14')](respondWithStatusCode(_0x46775a,null))[_0xdc88('0x4f')](handleError(_0x46775a,null));};exports[_0xdc88('0xa7')]=function(_0x589990,_0x3c9c95){var _0x24ec13,_0x5d48d0;return db[_0xdc88('0x39')][_0xdc88('0x31')]({'where':{'id':_0x589990['params']['id']},'attributes':['id','name',_0xdc88('0x27')]})[_0xdc88('0x14')](handleEntityNotFound(_0x3c9c95,null))[_0xdc88('0x14')](function(_0x54d4dd){if(_0x54d4dd){_0x24ec13=_0x54d4dd;if(!_0x589990[_0xdc88('0x3f')][_0xdc88('0x96')]||!utils['isValidChannel'](_0x589990[_0xdc88('0x3f')][_0xdc88('0x96')])){throw new db[(_0xdc88('0x8c'))]['ValidationError'](_0xdc88('0xa8'));}return _0x54d4dd[_0xdc88('0xa9')+_['capitalize'](_0x589990['query'][_0xdc88('0x96')][_0xdc88('0x9d')]())+'Queues'](_0x589990[_0xdc88('0x3f')]['ids']);}})['then'](function(_0x3d7183){if(_['isArray'](_0x589990[_0xdc88('0x3f')][_0xdc88('0x5f')])){for(var _0x1ac75e=0x0;_0x1ac75e<_0x589990[_0xdc88('0x3f')][_0xdc88('0x5f')]['length'];_0x1ac75e+=0x1){_0x5d48d0={'UserId':Number(_0x589990['params']['id'])};_0x5d48d0[_['capitalize'](_0x589990[_0xdc88('0x3f')]['channel']['toLowerCase']())+_0xdc88('0x9f')]=Number(_0x589990[_0xdc88('0x3f')][_0xdc88('0x5f')][_0x1ac75e]);socket[_0xdc88('0x25')](_0xdc88('0x29')+_[_0xdc88('0x9c')](_0x589990['query'][_0xdc88('0x96')][_0xdc88('0x9d')]())+_0xdc88('0xaa'),_0x5d48d0);}}else{_0x5d48d0={'UserId':Number(_0x589990['params']['id'])};_0x5d48d0[_[_0xdc88('0x9c')](_0x589990[_0xdc88('0x3f')][_0xdc88('0x96')][_0xdc88('0x9d')]())+'QueueId']=Number(_0x589990[_0xdc88('0x3f')][_0xdc88('0x5f')]);socket[_0xdc88('0x25')]('user'+_[_0xdc88('0x9c')](_0x589990['query'][_0xdc88('0x96')][_0xdc88('0x9d')]())+'Queue:remove',_0x5d48d0);}return _0x3d7183;})[_0xdc88('0x14')](function(){if(_0x589990[_0xdc88('0x3f')][_0xdc88('0x96')]==='voice'){return db[_0xdc88('0xa6')][_0xdc88('0x34')]({'where':{'UserId':_0x589990[_0xdc88('0x51')]['id'],'VoiceQueueId':_0x589990[_0xdc88('0x3f')][_0xdc88('0x5f')]},'individualHooks':!![]})[_0xdc88('0x14')](function(){return _0x24ec13;});}return _0x24ec13;})['then'](respondWithStatusCode(_0x3c9c95,null))['catch'](handleError(_0x3c9c95,null));};exports['addAvatar']=function(_0x535f1e,_0x3ce598){_0x535f1e[_0xdc88('0x5c')][_0xdc88('0xab')]=_0x535f1e['file'][_0xdc88('0xac')];return db[_0xdc88('0x39')][_0xdc88('0x31')]({'where':{'id':_0x535f1e[_0xdc88('0x51')]['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x3ce598,null))['then'](saveUpdates(_0x535f1e['body'],null))[_0xdc88('0x14')](respondWithResult(_0x3ce598,null))[_0xdc88('0x4f')](handleError(_0x3ce598,null));};exports[_0xdc88('0xad')]=function(_0x2643e0,_0x461ce7){var _0xeb20f=path[_0xdc88('0xae')](config[_0xdc88('0xaf')],_0xdc88('0xb0'));return db[_0xdc88('0x39')][_0xdc88('0x31')]({'where':{'id':_0x2643e0[_0xdc88('0x51')]['id']},'attributes':['id',_0xdc88('0xab')],'raw':!![]})[_0xdc88('0x14')](handleEntityNotFound(_0x461ce7,null))[_0xdc88('0x14')](function(_0x236cf7){if(_0x236cf7){if(_[_0xdc88('0x66')](_0x236cf7['userpic'])){return _0x461ce7[_0xdc88('0xb1')](_0xeb20f);}else{if(!fs[_0xdc88('0xb2')](path[_0xdc88('0xae')](config[_0xdc88('0xaf')],_0xdc88('0xb3'),_0x236cf7[_0xdc88('0xab')]))){return _0x461ce7[_0xdc88('0xb1')](_0xeb20f);}return _0x461ce7[_0xdc88('0xb1')](path['join'](config[_0xdc88('0xaf')],'server/files/images/',_0x236cf7[_0xdc88('0xab')]));}}})[_0xdc88('0x4f')](handleError(_0x461ce7,null));};exports[_0xdc88('0xb4')]=function(_0x5db0a7,_0x2f78d0){return db[_0xdc88('0x39')][_0xdc88('0x31')]({'where':{'id':_0x5db0a7['params']['id']},'attributes':['id']})[_0xdc88('0x14')](handleEntityNotFound(_0x2f78d0,null))[_0xdc88('0x14')](function(_0x1a5dfd){var _0x311c91=[];values=_0x1a5dfd[_0xdc88('0x49')];_0x311c91['push'](get_open_tabs(_0xdc88('0x5a'),_0x1a5dfd[_0xdc88('0x49')]));_0x311c91[_0xdc88('0x44')](get_open_tabs('sms',_0x1a5dfd[_0xdc88('0x49')]));_0x311c91[_0xdc88('0x44')](get_open_tabs(_0xdc88('0x4c'),_0x1a5dfd[_0xdc88('0x49')]));_0x311c91['push'](get_open_tabs('whatsapp',_0x1a5dfd['dataValues']));_0x311c91[_0xdc88('0x44')](get_open_tabs('fax',_0x1a5dfd[_0xdc88('0x49')]));_0x311c91['push'](get_open_tabs('mail',_0x1a5dfd['dataValues']));return Promise[_0xdc88('0x4e')](_0x311c91);})[_0xdc88('0x14')](function(_0x35c988){if(_0x35c988){var _0x1b303a=_['map'](values[_0xdc88('0xb5')],function(_0x43a5c9){return{'channel':_0xdc88('0xb6'),'id':_0x43a5c9['id'],'createdAt':_0x43a5c9[_0xdc88('0xb7')]};});var _0x34623b=_['map'](values[_0xdc88('0xb8')],function(_0x1c3254){return{'channel':'FAX','id':_0x1c3254['id'],'createdAt':_0x1c3254['createdAt']};});var _0x3152e6=_['map'](values[_0xdc88('0xb9')],function(_0x161dc9){return{'channel':_0xdc88('0xba'),'id':_0x161dc9['id'],'createdAt':_0x161dc9['createdAt']};});var _0x47d6de=_[_0xdc88('0x2e')](values[_0xdc88('0xbb')],function(_0x2ca6b7){return{'channel':_0xdc88('0xbc'),'id':_0x2ca6b7['id'],'createdAt':_0x2ca6b7['createdAt']};});var _0x153b42=_['map'](values[_0xdc88('0xbd')],function(_0x526d41){return{'channel':_0xdc88('0xbe'),'id':_0x526d41['id'],'createdAt':_0x526d41[_0xdc88('0xb7')]};});var _0x4976ca=_[_0xdc88('0x2e')](values[_0xdc88('0xbf')],function(_0x2252e2){return{'channel':'WHATSAPP','id':_0x2252e2['id'],'createdAt':_0x2252e2[_0xdc88('0xb7')]};});var _0x384743=_[_0xdc88('0xc0')](_0x1b303a,_0x34623b,_0x3152e6,_0x47d6de,_0x153b42,_0x4976ca);var _0x583a24={'count':_0x384743[_0xdc88('0x48')],'rows':_0x384743};return _0x583a24;}else return null;})['then'](respondWithResult(_0x2f78d0,null))[_0xdc88('0x4f')](handleError(_0x2f78d0,null));};exports[_0xdc88('0xc1')]=function(_0x51bf7d,_0x5a025b){var _0x237354={};return db['User']['findOne']({'where':{'id':_0x51bf7d[_0xdc88('0x51')]['id']}})['then'](function(_0x47fc00){if(!_0x47fc00){throw new APINotFoundError(util[_0xdc88('0xa4')](_0xdc88('0xc2'),_0x51bf7d[_0xdc88('0x51')]['id']));}return contacts[_0xdc88('0x5d')]();})['then'](function(_0x31847e){_0x51bf7d[_0xdc88('0x3f')][_0xdc88('0x39')]=_0x51bf7d[_0xdc88('0x51')]['id'];_0x237354=qs[_0xdc88('0xc3')](_0x31847e,_0x51bf7d);if(_0x51bf7d[_0xdc88('0x3f')][_0xdc88('0xc4')](_0xdc88('0x40'))){_0x237354[_0xdc88('0x41')]=[{'model':db[_0xdc88('0xc5')],'as':_0xdc88('0xc6'),'required':![]},{'model':db[_0xdc88('0xc7')],'as':'Tags','attributes':['id','name',_0xdc88('0xc8')],'where':_0x51bf7d[_0xdc88('0x3f')][_0xdc88('0xc9')]?{'id':_0x51bf7d[_0xdc88('0x3f')][_0xdc88('0xc9')]}:undefined,'required':_0x51bf7d['query'][_0xdc88('0xc9')]?!![]:![]}];}return contacts['findAll'](_0x51bf7d['query'],_0x51bf7d['user'],_0x237354,_0x31847e);})[_0xdc88('0x14')](respondWithFilteredResult(_0x5a025b,_0x237354))[_0xdc88('0x4f')](APIHandleError(_0x5a025b));};exports['getQueues']=function(_0x2ce302,_0x14ddbc){var _0x5eebcb;var _0x64e70a={};var _0x3273a3;return db[_0xdc88('0x39')][_0xdc88('0xca')]({'where':{'id':_0x2ce302[_0xdc88('0x51')]['id']},'attributes':['id',_0xdc88('0x32'),_0xdc88('0x27')]})['then'](handleEntityNotFound(_0x14ddbc,null))[_0xdc88('0x14')](function(_0x1ae41f){if(!utils[_0xdc88('0x9b')](_0x2ce302[_0xdc88('0x3f')][_0xdc88('0x96')])){throw new db[(_0xdc88('0x8c'))]['ValidationError'](_0xdc88('0xa8'));}_0x5eebcb=_0x1ae41f;var _0x8e2f03={};_0x8e2f03['model']=_[_0xdc88('0x52')](db[_['capitalize'](_0x2ce302[_0xdc88('0x3f')][_0xdc88('0x96')])+'Queue'][_0xdc88('0x3a')]);_0x8e2f03[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x2ce302[_0xdc88('0x3f')]);_0x8e2f03[_0xdc88('0xcb')]=_[_0xdc88('0x54')](_0x8e2f03[_0xdc88('0x55')],_0x8e2f03[_0xdc88('0x3f')]);_0x64e70a[_0xdc88('0x57')]=_['intersection'](_0x8e2f03[_0xdc88('0x55')],qs[_0xdc88('0x56')](_0x2ce302[_0xdc88('0x3f')]['fields']));_0x64e70a[_0xdc88('0x57')]=_0x64e70a[_0xdc88('0x57')]['length']?_0x64e70a['attributes']:_0x8e2f03[_0xdc88('0x55')];_0x64e70a['order']=qs['sort'](_0x2ce302[_0xdc88('0x3f')]['sort']);_0x64e70a[_0xdc88('0x3e')]=qs[_0xdc88('0xcb')](_['pick'](_0x2ce302['query'],_0x8e2f03['filters']));if(_0x2ce302[_0xdc88('0x3f')][_0xdc88('0x2d')]){_0x64e70a[_0xdc88('0x3e')]=_[_0xdc88('0xcc')](_0x64e70a['where'],{'$or':_[_0xdc88('0x2e')](_0x64e70a[_0xdc88('0x57')],function(_0x4f151e){var _0x115066={};_0x115066[_0x4f151e]={'$like':'%'+_0x2ce302['query'][_0xdc88('0x2d')]+'%'};return _0x115066;})});}_0x64e70a=_[_0xdc88('0xcc')]({},_0x64e70a,_0x2ce302[_0xdc88('0x59')]);switch(_0x5eebcb[_0xdc88('0x27')]){case _0xdc88('0x7c'):return db[_[_0xdc88('0x9c')](_0x2ce302[_0xdc88('0x3f')][_0xdc88('0x96')])+_0xdc88('0xcd')]['findAll'](_0x64e70a);case'user':case _0xdc88('0x2b'):return _0x5eebcb[_0xdc88('0xa3')+_[_0xdc88('0x9c')](_0x2ce302[_0xdc88('0x3f')][_0xdc88('0x96')])+_0xdc88('0x9e')](_0x64e70a);default:throw new db[(_0xdc88('0x8c'))][(_0xdc88('0x8d'))](_0xdc88('0xce'));}})[_0xdc88('0x14')](function(_0xd980bc){_0x3273a3=_0xd980bc[_0xdc88('0x48')];if(!_0x2ce302[_0xdc88('0x3f')][_0xdc88('0xc4')](_0xdc88('0xcf'))){_0x64e70a['limit']=qs[_0xdc88('0x23')](_0x2ce302[_0xdc88('0x3f')]['limit']);_0x64e70a['offset']=qs[_0xdc88('0x21')](_0x2ce302[_0xdc88('0x3f')][_0xdc88('0x21')]);}switch(_0x5eebcb['role']){case _0xdc88('0x7c'):return db[_[_0xdc88('0x9c')](_0x2ce302[_0xdc88('0x3f')]['channel'])+_0xdc88('0xcd')]['findAll'](_0x64e70a);case _0xdc88('0x29'):case _0xdc88('0x2b'):return _0x5eebcb[_0xdc88('0xa3')+_[_0xdc88('0x9c')](_0x2ce302['query'][_0xdc88('0x96')])+_0xdc88('0x9e')](_0x64e70a);}})['then'](function(_0x359f46){return{'count':_0x3273a3,'rows':_0x359f46};})['then'](respondWithResult(_0x14ddbc,null))[_0xdc88('0x4f')](handleError(_0x14ddbc,null));};exports[_0xdc88('0xd0')]=function(_0x49d7ce,_0x517254){var _0xbbe1a0={};var _0x3aee8e={};var _0x469324;var _0x1b3fba;return db[_0xdc88('0x39')][_0xdc88('0xca')]({'where':{'id':_0x49d7ce[_0xdc88('0x51')]['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x517254,null))[_0xdc88('0x14')](function(_0x650799){if(_0x650799){_0x469324=_0x650799;_0x3aee8e['model']=_[_0xdc88('0x52')](db[_0xdc88('0xa6')][_0xdc88('0x3a')]);_0x3aee8e[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x49d7ce[_0xdc88('0x3f')]);_0x3aee8e[_0xdc88('0xcb')]=_[_0xdc88('0x54')](_0x3aee8e[_0xdc88('0x55')],_0x3aee8e[_0xdc88('0x3f')]);_0xbbe1a0['attributes']=_[_0xdc88('0x54')](_0x3aee8e[_0xdc88('0x55')],qs[_0xdc88('0x56')](_0x49d7ce[_0xdc88('0x3f')][_0xdc88('0x56')]));_0xbbe1a0[_0xdc88('0x57')]=_0xbbe1a0[_0xdc88('0x57')][_0xdc88('0x48')]?_0xbbe1a0['attributes']:_0x3aee8e[_0xdc88('0x55')];_0xbbe1a0[_0xdc88('0xd1')]=qs['sort'](_0x49d7ce[_0xdc88('0x3f')]['sort']);_0xbbe1a0['where']=qs[_0xdc88('0xcb')](_[_0xdc88('0xd2')](_0x49d7ce[_0xdc88('0x3f')],_0x3aee8e[_0xdc88('0xcb')]));if(_0x49d7ce['query'][_0xdc88('0x2d')]){_0xbbe1a0[_0xdc88('0x3e')]=_[_0xdc88('0xcc')](_0xbbe1a0[_0xdc88('0x3e')],{'$or':_['map'](_0xbbe1a0['attributes'],function(_0x409303){var _0x2f242b={};_0x2f242b[_0x409303]={'$like':'%'+_0x49d7ce['query'][_0xdc88('0x2d')]+'%'};return _0x2f242b;})});}_0xbbe1a0=_[_0xdc88('0xcc')]({},_0xbbe1a0,_0x49d7ce[_0xdc88('0x59')]);return _0x469324[_0xdc88('0xd0')](_0xbbe1a0);}})[_0xdc88('0x14')](function(_0x5d7d1f){if(_0x5d7d1f){_0x1b3fba=_0x5d7d1f['length'];if(!_0x49d7ce[_0xdc88('0x3f')][_0xdc88('0xc4')](_0xdc88('0xcf'))){_0xbbe1a0[_0xdc88('0x23')]=qs[_0xdc88('0x23')](_0x49d7ce['query'][_0xdc88('0x23')]);_0xbbe1a0[_0xdc88('0x21')]=qs['offset'](_0x49d7ce['query'][_0xdc88('0x21')]);}return _0x469324['getVoiceQueuesRt'](_0xbbe1a0);}})[_0xdc88('0x14')](function(_0x2676c3){if(_0x2676c3){return _0x2676c3?{'count':_0x1b3fba,'rows':_0x2676c3}:null;}})[_0xdc88('0x14')](respondWithResult(_0x517254,null))[_0xdc88('0x4f')](handleError(_0x517254,null));};exports[_0xdc88('0xd3')]=function(_0x48c527,_0x397eba){var _0x1eec37={};var _0x132039={};var _0x1d2069;var _0x255e52;return db[_0xdc88('0x39')][_0xdc88('0xca')]({'where':{'id':_0x48c527[_0xdc88('0x51')]['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x397eba,null))[_0xdc88('0x14')](function(_0x33f472){if(_0x33f472){_0x1d2069=_0x33f472;_0x132039[_0xdc88('0x55')]=_[_0xdc88('0x52')](db[_0xdc88('0xd4')][_0xdc88('0x3a')]);_0x132039['query']=_[_0xdc88('0x52')](_0x48c527[_0xdc88('0x3f')]);_0x132039['filters']=_[_0xdc88('0x54')](_0x132039['model'],_0x132039[_0xdc88('0x3f')]);_0x1eec37[_0xdc88('0x57')]=_['intersection'](_0x132039[_0xdc88('0x55')],qs[_0xdc88('0x56')](_0x48c527[_0xdc88('0x3f')][_0xdc88('0x56')]));_0x1eec37['attributes']=_0x1eec37['attributes'][_0xdc88('0x48')]?_0x1eec37[_0xdc88('0x57')]:_0x132039[_0xdc88('0x55')];_0x1eec37[_0xdc88('0xd1')]=qs['sort'](_0x48c527['query'][_0xdc88('0xd5')]);_0x1eec37[_0xdc88('0x3e')]=qs[_0xdc88('0xcb')](_[_0xdc88('0xd2')](_0x48c527['query'],_0x132039[_0xdc88('0xcb')]));if(_0x48c527[_0xdc88('0x3f')][_0xdc88('0x2d')]){_0x1eec37[_0xdc88('0x3e')]=_[_0xdc88('0xcc')](_0x1eec37[_0xdc88('0x3e')],{'$or':_[_0xdc88('0x2e')](_0x1eec37[_0xdc88('0x57')],function(_0x586548){var _0xa0d190={};_0xa0d190[_0x586548]={'$like':'%'+_0x48c527[_0xdc88('0x3f')][_0xdc88('0x2d')]+'%'};return _0xa0d190;})});}_0x1eec37=_[_0xdc88('0xcc')]({},_0x1eec37,_0x48c527[_0xdc88('0x59')]);return _0x1d2069[_0xdc88('0xd3')](_0x1eec37);}})['then'](function(_0x1e2d7a){if(_0x1e2d7a){_0x255e52=_0x1e2d7a[_0xdc88('0x48')];if(!_0x48c527['query'][_0xdc88('0xc4')](_0xdc88('0xcf'))){_0x1eec37[_0xdc88('0x23')]=qs[_0xdc88('0x23')](_0x48c527[_0xdc88('0x3f')][_0xdc88('0x23')]);_0x1eec37[_0xdc88('0x21')]=qs[_0xdc88('0x21')](_0x48c527[_0xdc88('0x3f')][_0xdc88('0x21')]);}return _0x1d2069[_0xdc88('0xd3')](_0x1eec37);}})[_0xdc88('0x14')](function(_0x38d40a){if(_0x38d40a){return _0x38d40a?{'count':_0x255e52,'rows':_0x38d40a}:null;}})[_0xdc88('0x14')](respondWithResult(_0x397eba,null))[_0xdc88('0x4f')](handleError(_0x397eba,null));};exports[_0xdc88('0xd6')]=function(_0x1b06dc,_0x169020){var _0x536afb={'raw':!![],'where':{}};var _0x401110={};var _0x26d9fd={'count':0x0,'rows':[]};return db[_0xdc88('0x39')]['findOne']({'where':{'id':_0x1b06dc[_0xdc88('0x51')]['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x169020,null))[_0xdc88('0x14')](function(_0x924819){if(_0x924819){_0x401110['model']=_['keys'](db['VoiceRecording'][_0xdc88('0x3a')]);_0x401110[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x1b06dc['query']);_0x401110[_0xdc88('0xcb')]=_[_0xdc88('0x54')](_0x401110[_0xdc88('0x55')],_0x401110[_0xdc88('0x3f')]);_0x536afb[_0xdc88('0x57')]=_['intersection'](_0x401110[_0xdc88('0x55')],qs[_0xdc88('0x56')](_0x1b06dc[_0xdc88('0x3f')][_0xdc88('0x56')]));_0x536afb[_0xdc88('0x57')]=_0x536afb['attributes'][_0xdc88('0x48')]?_0x536afb[_0xdc88('0x57')]:_0x401110[_0xdc88('0x55')];if(!_0x1b06dc[_0xdc88('0x3f')][_0xdc88('0xc4')](_0xdc88('0xcf'))){_0x536afb[_0xdc88('0x23')]=qs[_0xdc88('0x23')](_0x1b06dc['query'][_0xdc88('0x23')]);_0x536afb['offset']=qs[_0xdc88('0x21')](_0x1b06dc[_0xdc88('0x3f')][_0xdc88('0x21')]);}_0x536afb[_0xdc88('0xd1')]=qs[_0xdc88('0xd5')](_0x1b06dc[_0xdc88('0x3f')][_0xdc88('0xd5')]);_0x536afb[_0xdc88('0x3e')]=qs[_0xdc88('0xcb')](_[_0xdc88('0xd2')](_0x1b06dc[_0xdc88('0x3f')],_0x401110[_0xdc88('0xcb')]));_0x536afb['where'][_0xdc88('0xd7')]=_0x924819['id'];if(_0x1b06dc[_0xdc88('0x3f')][_0xdc88('0x2d')]){_0x536afb[_0xdc88('0x3e')]=_[_0xdc88('0xcc')](_0x536afb[_0xdc88('0x3e')],{'$or':_[_0xdc88('0x2e')](_0x536afb['attributes'],function(_0x1e39d3){var _0x1c7508={};_0x1c7508[_0x1e39d3]={'$like':'%'+_0x1b06dc[_0xdc88('0x3f')][_0xdc88('0x2d')]+'%'};return _0x1c7508;})});}_0x536afb=_[_0xdc88('0xcc')]({},_0x536afb,_0x1b06dc[_0xdc88('0x59')]);return db[_0xdc88('0xd8')][_0xdc88('0x24')]({'where':_0x536afb[_0xdc88('0x3e')]})['then'](function(_0x368168){_0x26d9fd[_0xdc88('0x24')]=_0x368168;if(_0x1b06dc[_0xdc88('0x3f')][_0xdc88('0x40')]){_0x536afb[_0xdc88('0x41')]=[{'all':!![]}];}return db[_0xdc88('0xd8')][_0xdc88('0x45')](_0x536afb);})[_0xdc88('0x14')](function(_0x5717fb){_0x26d9fd[_0xdc88('0x46')]=_0x5717fb;return _0x26d9fd;});}})[_0xdc88('0x14')](respondWithFilteredResult(_0x169020,_0x536afb))[_0xdc88('0x4f')](handleError(_0x169020,null));};exports['getScreenRecordings']=function(_0x422a21,_0x5cd164){var _0x316640={'raw':!![],'where':{}};var _0x24fff8={};var _0x28f106={'count':0x0,'rows':[]};return db['User'][_0xdc88('0xca')]({'where':{'id':_0x422a21[_0xdc88('0x51')]['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x5cd164,null))[_0xdc88('0x14')](function(_0x1bfdf4){if(_0x1bfdf4){_0x24fff8[_0xdc88('0x55')]=_[_0xdc88('0x52')](db[_0xdc88('0xd9')]['rawAttributes']);_0x24fff8[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x422a21['query']);_0x24fff8[_0xdc88('0xcb')]=_[_0xdc88('0x54')](_0x24fff8['model'],_0x24fff8[_0xdc88('0x3f')]);_0x316640[_0xdc88('0x57')]=_[_0xdc88('0x54')](_0x24fff8[_0xdc88('0x55')],qs['fields'](_0x422a21[_0xdc88('0x3f')][_0xdc88('0x56')]));_0x316640[_0xdc88('0x57')]=_0x316640[_0xdc88('0x57')][_0xdc88('0x48')]?_0x316640[_0xdc88('0x57')]:_0x24fff8[_0xdc88('0x55')];if(!_0x422a21[_0xdc88('0x3f')][_0xdc88('0xc4')](_0xdc88('0xcf'))){_0x316640[_0xdc88('0x23')]=qs['limit'](_0x422a21[_0xdc88('0x3f')][_0xdc88('0x23')]);_0x316640[_0xdc88('0x21')]=qs['offset'](_0x422a21[_0xdc88('0x3f')][_0xdc88('0x21')]);}_0x316640['order']=qs[_0xdc88('0xd5')](_0x422a21['query'][_0xdc88('0xd5')]);_0x316640[_0xdc88('0x3e')]=qs['filters'](_[_0xdc88('0xd2')](_0x422a21[_0xdc88('0x3f')],_0x24fff8[_0xdc88('0xcb')]));_0x316640['where'][_0xdc88('0xd7')]=_0x1bfdf4['id'];if(_0x422a21[_0xdc88('0x3f')][_0xdc88('0x2d')]){_0x316640[_0xdc88('0x3e')]=_[_0xdc88('0xcc')](_0x316640[_0xdc88('0x3e')],{'$or':_[_0xdc88('0x2e')](_0x316640[_0xdc88('0x57')],function(_0x1714f4){var _0x154bc8={};_0x154bc8[_0x1714f4]={'$like':'%'+_0x422a21['query'][_0xdc88('0x2d')]+'%'};return _0x154bc8;})});}_0x316640=_[_0xdc88('0xcc')]({},_0x316640,_0x422a21[_0xdc88('0x59')]);return db[_0xdc88('0xd9')][_0xdc88('0x24')]({'where':_0x316640[_0xdc88('0x3e')]})[_0xdc88('0x14')](function(_0x52e1cb){_0x28f106['count']=_0x52e1cb;if(_0x422a21['query'][_0xdc88('0x40')]){_0x316640[_0xdc88('0x41')]=[{'all':!![]}];}return db[_0xdc88('0xd9')][_0xdc88('0x45')](_0x316640);})[_0xdc88('0x14')](function(_0x5de157){_0x28f106[_0xdc88('0x46')]=_0x5de157;return _0x28f106;});}})[_0xdc88('0x14')](respondWithFilteredResult(_0x5cd164,_0x316640))['catch'](handleError(_0x5cd164,null));};exports[_0xdc88('0xda')]=function(_0x1b3cd2,_0x5d681d){var _0x1718f1={};var _0x3e3e9e={};var _0x1d3a15;var _0x3da96d;return db['User'][_0xdc88('0xca')]({'where':{'id':_0x1b3cd2[_0xdc88('0x51')]['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x5d681d,null))[_0xdc88('0x14')](function(_0x1c90ce){if(_0x1c90ce){_0x1d3a15=_0x1c90ce;_0x3e3e9e[_0xdc88('0x55')]=_['keys'](db[_0xdc88('0xdb')]['rawAttributes']);_0x3e3e9e[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x1b3cd2['query']);_0x3e3e9e[_0xdc88('0xcb')]=_[_0xdc88('0x54')](_0x3e3e9e[_0xdc88('0x55')],_0x3e3e9e[_0xdc88('0x3f')]);_0x1718f1[_0xdc88('0x57')]=_[_0xdc88('0x54')](_0x3e3e9e[_0xdc88('0x55')],qs[_0xdc88('0x56')](_0x1b3cd2[_0xdc88('0x3f')][_0xdc88('0x56')]));_0x1718f1[_0xdc88('0x57')]=_0x1718f1[_0xdc88('0x57')][_0xdc88('0x48')]?_0x1718f1[_0xdc88('0x57')]:_0x3e3e9e[_0xdc88('0x55')];_0x1718f1[_0xdc88('0xd1')]=qs[_0xdc88('0xd5')](_0x1b3cd2['query'][_0xdc88('0xd5')]);_0x1718f1[_0xdc88('0x3e')]=qs['filters'](_[_0xdc88('0xd2')](_0x1b3cd2[_0xdc88('0x3f')],_0x3e3e9e[_0xdc88('0xcb')]));if(_0x1b3cd2['query'][_0xdc88('0x2d')]){_0x1718f1[_0xdc88('0x3e')]=_['merge'](_0x1718f1[_0xdc88('0x3e')],{'$or':_[_0xdc88('0x2e')](_0x1718f1[_0xdc88('0x57')],function(_0xe93443){var _0x21e07f={};_0x21e07f[_0xe93443]={'$like':'%'+_0x1b3cd2['query']['filter']+'%'};return _0x21e07f;})});}_0x1718f1=_[_0xdc88('0xcc')]({},_0x1718f1,_0x1b3cd2[_0xdc88('0x59')]);return _0x1d3a15[_0xdc88('0xda')](_0x1718f1);}})['then'](function(_0x2e01b6){if(_0x2e01b6){_0x3da96d=_0x2e01b6[_0xdc88('0x48')];if(!_0x1b3cd2['query'][_0xdc88('0xc4')]('nolimit')){_0x1718f1[_0xdc88('0x23')]=qs[_0xdc88('0x23')](_0x1b3cd2['query'][_0xdc88('0x23')]);_0x1718f1[_0xdc88('0x21')]=qs[_0xdc88('0x21')](_0x1b3cd2[_0xdc88('0x3f')][_0xdc88('0x21')]);}return _0x1d3a15[_0xdc88('0xda')](_0x1718f1);}})[_0xdc88('0x14')](function(_0x3383a9){if(_0x3383a9){return _0x3383a9?{'count':_0x3da96d,'rows':_0x3383a9}:null;}})['then'](respondWithResult(_0x5d681d,null))[_0xdc88('0x4f')](handleError(_0x5d681d,null));};exports[_0xdc88('0xdc')]=function(_0x5ede7c,_0x27d8e5){var _0x1d2cd8={};var _0xa6e423={};var _0x1bdda4;var _0x4a798a;return db[_0xdc88('0x39')]['findOne']({'where':{'id':_0x5ede7c[_0xdc88('0x51')]['id']}})['then'](handleEntityNotFound(_0x27d8e5,null))['then'](function(_0x1afa61){if(_0x1afa61){_0x1bdda4=_0x1afa61;_0xa6e423['model']=_['keys'](db['OpenchannelInteraction'][_0xdc88('0x3a')]);_0xa6e423[_0xdc88('0x3f')]=_['keys'](_0x5ede7c[_0xdc88('0x3f')]);_0xa6e423[_0xdc88('0xcb')]=_[_0xdc88('0x54')](_0xa6e423[_0xdc88('0x55')],_0xa6e423['query']);_0x1d2cd8['attributes']=_[_0xdc88('0x54')](_0xa6e423[_0xdc88('0x55')],qs[_0xdc88('0x56')](_0x5ede7c[_0xdc88('0x3f')][_0xdc88('0x56')]));_0x1d2cd8[_0xdc88('0x57')]=_0x1d2cd8[_0xdc88('0x57')][_0xdc88('0x48')]?_0x1d2cd8[_0xdc88('0x57')]:_0xa6e423[_0xdc88('0x55')];_0x1d2cd8[_0xdc88('0xd1')]=qs[_0xdc88('0xd5')](_0x5ede7c[_0xdc88('0x3f')]['sort']);_0x1d2cd8['where']=qs[_0xdc88('0xcb')](_[_0xdc88('0xd2')](_0x5ede7c[_0xdc88('0x3f')],_0xa6e423[_0xdc88('0xcb')]));if(_0x5ede7c[_0xdc88('0x3f')][_0xdc88('0x2d')]){_0x1d2cd8[_0xdc88('0x3e')]=_[_0xdc88('0xcc')](_0x1d2cd8[_0xdc88('0x3e')],{'$or':_[_0xdc88('0x2e')](_0x1d2cd8[_0xdc88('0x57')],function(_0x4cc91e){var _0x1fdac5={};_0x1fdac5[_0x4cc91e]={'$like':'%'+_0x5ede7c['query'][_0xdc88('0x2d')]+'%'};return _0x1fdac5;})});}_0x1d2cd8=_[_0xdc88('0xcc')]({},_0x1d2cd8,_0x5ede7c[_0xdc88('0x59')]);return _0x1bdda4[_0xdc88('0xdc')](_0x1d2cd8);}})[_0xdc88('0x14')](function(_0xa13b24){if(_0xa13b24){_0x4a798a=_0xa13b24[_0xdc88('0x48')];if(!_0x5ede7c['query'][_0xdc88('0xc4')](_0xdc88('0xcf'))){_0x1d2cd8[_0xdc88('0x23')]=qs['limit'](_0x5ede7c['query'][_0xdc88('0x23')]);_0x1d2cd8[_0xdc88('0x21')]=qs[_0xdc88('0x21')](_0x5ede7c[_0xdc88('0x3f')]['offset']);}return _0x1bdda4[_0xdc88('0xdc')](_0x1d2cd8);}})[_0xdc88('0x14')](function(_0xb04701){if(_0xb04701){return _0xb04701?{'count':_0x4a798a,'rows':_0xb04701}:null;}})['then'](respondWithResult(_0x27d8e5,null))[_0xdc88('0x4f')](handleError(_0x27d8e5,null));};exports[_0xdc88('0xdd')]=function(_0x227402,_0x295b9d){var _0x572af0={'raw':!![],'where':{}};var _0xcdf5e8={};var _0x52745b={'count':0x0,'rows':[]};return db[_0xdc88('0x39')][_0xdc88('0xca')]({'where':{'id':_0x227402[_0xdc88('0x51')]['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x295b9d,null))[_0xdc88('0x14')](function(_0x4c1286){if(_0x4c1286){_0xcdf5e8[_0xdc88('0x55')]=_[_0xdc88('0x52')](db[_0xdc88('0xde')][_0xdc88('0x3a')]);_0xcdf5e8[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x227402['query']);_0xcdf5e8[_0xdc88('0xcb')]=_[_0xdc88('0x54')](_0xcdf5e8[_0xdc88('0x55')],_0xcdf5e8[_0xdc88('0x3f')]);_0x572af0[_0xdc88('0x57')]=_[_0xdc88('0x54')](_0xcdf5e8['model'],qs['fields'](_0x227402['query'][_0xdc88('0x56')]));_0x572af0[_0xdc88('0x57')]=_0x572af0[_0xdc88('0x57')]['length']?_0x572af0[_0xdc88('0x57')]:_0xcdf5e8['model'];if(!_0x227402['query'][_0xdc88('0xc4')](_0xdc88('0xcf'))){_0x572af0[_0xdc88('0x23')]=qs[_0xdc88('0x23')](_0x227402[_0xdc88('0x3f')]['limit']);_0x572af0[_0xdc88('0x21')]=qs['offset'](_0x227402['query'][_0xdc88('0x21')]);}_0x572af0[_0xdc88('0xd1')]=qs[_0xdc88('0xd5')](_0x227402['query'][_0xdc88('0xd5')]);_0x572af0[_0xdc88('0x3e')]=qs[_0xdc88('0xcb')](_[_0xdc88('0xd2')](_0x227402[_0xdc88('0x3f')],_0xcdf5e8[_0xdc88('0xcb')]));_0x572af0[_0xdc88('0x3e')][_0xdc88('0xd7')]=_0x4c1286['id'];if(_0x227402[_0xdc88('0x3f')][_0xdc88('0x2d')]){_0x572af0[_0xdc88('0x3e')]=_[_0xdc88('0xcc')](_0x572af0[_0xdc88('0x3e')],{'$or':_['map'](_0x572af0['attributes'],function(_0x3633ee){var _0x5b7d47={};_0x5b7d47[_0x3633ee]={'$like':'%'+_0x227402[_0xdc88('0x3f')][_0xdc88('0x2d')]+'%'};return _0x5b7d47;})});}_0x572af0=_[_0xdc88('0xcc')]({},_0x572af0,_0x227402[_0xdc88('0x59')]);return db[_0xdc88('0xde')][_0xdc88('0x24')]({'where':_0x572af0[_0xdc88('0x3e')]})[_0xdc88('0x14')](function(_0x4475f1){_0x52745b[_0xdc88('0x24')]=_0x4475f1;if(_0x227402[_0xdc88('0x3f')][_0xdc88('0x40')]){_0x572af0[_0xdc88('0x41')]=[{'all':!![]}];}return db[_0xdc88('0xde')][_0xdc88('0x45')](_0x572af0);})[_0xdc88('0x14')](function(_0x378313){_0x52745b[_0xdc88('0x46')]=_0x378313;return _0x52745b;});}})[_0xdc88('0x14')](respondWithFilteredResult(_0x295b9d,_0x572af0))[_0xdc88('0x4f')](handleError(_0x295b9d,null));};exports[_0xdc88('0xdf')]=function(_0x49a39b,_0x40e833){var _0x1e2828={};var _0x52ccaa={};var _0x553a92;var _0x133996;return db[_0xdc88('0x39')][_0xdc88('0xca')]({'where':{'id':_0x49a39b['params']['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x40e833,null))[_0xdc88('0x14')](function(_0x944366){if(_0x944366){_0x553a92=_0x944366;_0x52ccaa['model']=_[_0xdc88('0x52')](db[_0xdc88('0xe0')][_0xdc88('0x3a')]);_0x52ccaa[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x49a39b[_0xdc88('0x3f')]);_0x52ccaa[_0xdc88('0xcb')]=_['intersection'](_0x52ccaa[_0xdc88('0x55')],_0x52ccaa['query']);_0x1e2828[_0xdc88('0x57')]=_[_0xdc88('0x54')](_0x52ccaa['model'],qs[_0xdc88('0x56')](_0x49a39b[_0xdc88('0x3f')][_0xdc88('0x56')]));_0x1e2828['attributes']=_0x1e2828[_0xdc88('0x57')][_0xdc88('0x48')]?_0x1e2828[_0xdc88('0x57')]:_0x52ccaa['model'];_0x1e2828[_0xdc88('0xd1')]=qs['sort'](_0x49a39b[_0xdc88('0x3f')][_0xdc88('0xd5')]);_0x1e2828[_0xdc88('0x3e')]=qs['filters'](_[_0xdc88('0xd2')](_0x49a39b[_0xdc88('0x3f')],_0x52ccaa[_0xdc88('0xcb')]));if(_0x49a39b['query']['filter']){_0x1e2828[_0xdc88('0x3e')]=_[_0xdc88('0xcc')](_0x1e2828[_0xdc88('0x3e')],{'$or':_[_0xdc88('0x2e')](_0x1e2828[_0xdc88('0x57')],function(_0x40818a){var _0x6e7d23={};_0x6e7d23[_0x40818a]={'$like':'%'+_0x49a39b[_0xdc88('0x3f')]['filter']+'%'};return _0x6e7d23;})});}_0x1e2828=_[_0xdc88('0xcc')]({},_0x1e2828,_0x49a39b['options']);return _0x553a92[_0xdc88('0xdf')](_0x1e2828);}})['then'](function(_0x206c4a){if(_0x206c4a){_0x133996=_0x206c4a['length'];if(!_0x49a39b[_0xdc88('0x3f')]['hasOwnProperty'](_0xdc88('0xcf'))){_0x1e2828[_0xdc88('0x23')]=qs[_0xdc88('0x23')](_0x49a39b[_0xdc88('0x3f')][_0xdc88('0x23')]);_0x1e2828[_0xdc88('0x21')]=qs[_0xdc88('0x21')](_0x49a39b[_0xdc88('0x3f')][_0xdc88('0x21')]);}return _0x553a92[_0xdc88('0xdf')](_0x1e2828);}})[_0xdc88('0x14')](function(_0x53592b){if(_0x53592b){return _0x53592b?{'count':_0x133996,'rows':_0x53592b}:null;}})[_0xdc88('0x14')](respondWithResult(_0x40e833,null))[_0xdc88('0x4f')](handleError(_0x40e833,null));};exports[_0xdc88('0xe1')]=function(_0x294d2a,_0x12ad42){var _0x14e651={};var _0x443bd4={};var _0x959c56;var _0x5a7f68;return db[_0xdc88('0x39')]['findOne']({'where':{'id':_0x294d2a['params']['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x12ad42,null))[_0xdc88('0x14')](function(_0x23d8a3){if(_0x23d8a3){_0x959c56=_0x23d8a3;_0x443bd4[_0xdc88('0x55')]=_[_0xdc88('0x52')](db[_0xdc88('0xe2')][_0xdc88('0x3a')]);_0x443bd4[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x294d2a['query']);_0x443bd4[_0xdc88('0xcb')]=_[_0xdc88('0x54')](_0x443bd4[_0xdc88('0x55')],_0x443bd4[_0xdc88('0x3f')]);_0x14e651['attributes']=_[_0xdc88('0x54')](_0x443bd4[_0xdc88('0x55')],qs[_0xdc88('0x56')](_0x294d2a[_0xdc88('0x3f')][_0xdc88('0x56')]));_0x14e651[_0xdc88('0x57')]=_0x14e651[_0xdc88('0x57')][_0xdc88('0x48')]?_0x14e651[_0xdc88('0x57')]:_0x443bd4[_0xdc88('0x55')];_0x14e651[_0xdc88('0xd1')]=qs[_0xdc88('0xd5')](_0x294d2a[_0xdc88('0x3f')][_0xdc88('0xd5')]);_0x14e651[_0xdc88('0x3e')]=qs[_0xdc88('0xcb')](_['pick'](_0x294d2a[_0xdc88('0x3f')],_0x443bd4[_0xdc88('0xcb')]));if(_0x294d2a['query'][_0xdc88('0x2d')]){_0x14e651[_0xdc88('0x3e')]=_['merge'](_0x14e651[_0xdc88('0x3e')],{'$or':_['map'](_0x14e651[_0xdc88('0x57')],function(_0x5e886a){var _0x393cf4={};_0x393cf4[_0x5e886a]={'$like':'%'+_0x294d2a[_0xdc88('0x3f')][_0xdc88('0x2d')]+'%'};return _0x393cf4;})});}_0x14e651=_[_0xdc88('0xcc')]({},_0x14e651,_0x294d2a[_0xdc88('0x59')]);return _0x959c56[_0xdc88('0xe1')](_0x14e651);}})[_0xdc88('0x14')](function(_0x38e382){if(_0x38e382){_0x5a7f68=_0x38e382[_0xdc88('0x48')];if(!_0x294d2a['query']['hasOwnProperty'](_0xdc88('0xcf'))){_0x14e651[_0xdc88('0x23')]=qs[_0xdc88('0x23')](_0x294d2a[_0xdc88('0x3f')]['limit']);_0x14e651[_0xdc88('0x21')]=qs[_0xdc88('0x21')](_0x294d2a[_0xdc88('0x3f')][_0xdc88('0x21')]);}return _0x959c56[_0xdc88('0xe1')](_0x14e651);}})[_0xdc88('0x14')](function(_0x24f465){if(_0x24f465){return _0x24f465?{'count':_0x5a7f68,'rows':_0x24f465}:null;}})[_0xdc88('0x14')](respondWithResult(_0x12ad42,null))[_0xdc88('0x4f')](handleError(_0x12ad42,null));};exports['getWhatsappInteractions']=function(_0x2fa2b8,_0x554302){var _0x170cca={};var _0x358278={};var _0x40fc37;var _0x3b49a4;return db[_0xdc88('0x39')][_0xdc88('0xca')]({'where':{'id':_0x2fa2b8[_0xdc88('0x51')]['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x554302,null))[_0xdc88('0x14')](function(_0x32f337){if(_0x32f337){_0x40fc37=_0x32f337;_0x358278['model']=_[_0xdc88('0x52')](db['WhatsappInteraction'][_0xdc88('0x3a')]);_0x358278[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x2fa2b8['query']);_0x358278[_0xdc88('0xcb')]=_[_0xdc88('0x54')](_0x358278[_0xdc88('0x55')],_0x358278[_0xdc88('0x3f')]);_0x170cca['attributes']=_[_0xdc88('0x54')](_0x358278[_0xdc88('0x55')],qs[_0xdc88('0x56')](_0x2fa2b8['query']['fields']));_0x170cca[_0xdc88('0x57')]=_0x170cca[_0xdc88('0x57')][_0xdc88('0x48')]?_0x170cca[_0xdc88('0x57')]:_0x358278[_0xdc88('0x55')];_0x170cca[_0xdc88('0xd1')]=qs[_0xdc88('0xd5')](_0x2fa2b8[_0xdc88('0x3f')][_0xdc88('0xd5')]);_0x170cca[_0xdc88('0x3e')]=qs[_0xdc88('0xcb')](_[_0xdc88('0xd2')](_0x2fa2b8[_0xdc88('0x3f')],_0x358278[_0xdc88('0xcb')]));if(_0x2fa2b8[_0xdc88('0x3f')][_0xdc88('0x2d')]){_0x170cca[_0xdc88('0x3e')]=_['merge'](_0x170cca['where'],{'$or':_[_0xdc88('0x2e')](_0x170cca[_0xdc88('0x57')],function(_0x14e7e0){var _0x459431={};_0x459431[_0x14e7e0]={'$like':'%'+_0x2fa2b8['query'][_0xdc88('0x2d')]+'%'};return _0x459431;})});}_0x170cca=_['merge']({},_0x170cca,_0x2fa2b8[_0xdc88('0x59')]);return _0x40fc37[_0xdc88('0xe3')](_0x170cca);}})[_0xdc88('0x14')](function(_0x4d6ffd){if(_0x4d6ffd){_0x3b49a4=_0x4d6ffd['length'];if(!_0x2fa2b8[_0xdc88('0x3f')][_0xdc88('0xc4')](_0xdc88('0xcf'))){_0x170cca['limit']=qs['limit'](_0x2fa2b8[_0xdc88('0x3f')]['limit']);_0x170cca['offset']=qs[_0xdc88('0x21')](_0x2fa2b8[_0xdc88('0x3f')][_0xdc88('0x21')]);}return _0x40fc37[_0xdc88('0xe3')](_0x170cca);}})[_0xdc88('0x14')](function(_0x1acb43){if(_0x1acb43){return _0x1acb43?{'count':_0x3b49a4,'rows':_0x1acb43}:null;}})[_0xdc88('0x14')](respondWithResult(_0x554302,null))[_0xdc88('0x4f')](handleError(_0x554302,null));};exports[_0xdc88('0xe4')]=function(_0xe1fd69,_0x4f4a6a,_0x16edb0){var _0x4b68fb;var _0x183e8d;var _0x5ca865;var _0xc88fbf=!_[_0xdc88('0x66')](_0xe1fd69[_0xdc88('0x51')]['id'])?_0xe1fd69['params']['id']:!_[_0xdc88('0x66')](_0xe1fd69[_0xdc88('0x29')]['id'])?_0xe1fd69[_0xdc88('0x29')]['id']:null;return db['User'][_0xdc88('0x31')]({'where':{'id':_0xc88fbf,'role':{'$or':[_0xdc88('0x7c'),_0xdc88('0x29'),'agent']}},'attributes':['id',_0xdc88('0x32'),_0xdc88('0xe5'),_0xdc88('0xe6'),_0xdc88('0x27'),_0xdc88('0x61'),'loginInPause']})[_0xdc88('0x14')](function(_0x4c2c44){if(_0x4c2c44){if(_0x4c2c44['role']===_0xdc88('0x2b')){_0x4b68fb=_0x4c2c44;if(_0xe1fd69[_0xdc88('0x5c')][_0xdc88('0x9a')]){_0x5ca865=util['format'](_0xdc88('0xe7'),_0x4b68fb[_0xe1fd69[_0xdc88('0x5c')][_0xdc88('0x9a')]]);}else if(_0xe1fd69[_0xdc88('0x5c')][_0xdc88('0xe8')]){_0x5ca865=util[_0xdc88('0xa4')](_0xdc88('0xa5'),_0xe1fd69[_0xdc88('0x5c')][_0xdc88('0xe8')]);}else{_0x5ca865=util[_0xdc88('0xa4')](_0xdc88('0xa5'),_0x4b68fb[_0xdc88('0x32')]);}socket['to'](util[_0xdc88('0xa4')]('user:%s',_0x4b68fb[_0xdc88('0x32')]))[_0xdc88('0x25')](_0xdc88('0xe9'),{'user':{'id':_0x4b68fb['id'],'name':_0x4b68fb['name']},'ip':_0xe1fd69['headers']['x-forwarded-for']||_0xe1fd69['connection'][_0xdc88('0xea')]||_0xe1fd69[_0xdc88('0xeb')][_0xdc88('0xea')]||_0xe1fd69[_0xdc88('0xec')]['socket'][_0xdc88('0xea')]});return db[_0xdc88('0xa6')][_0xdc88('0x34')]({'where':{'membername':_0x4b68fb[_0xdc88('0x32')]},'individualHooks':!![]});}}else{throw new db[(_0xdc88('0x8c'))][(_0xdc88('0x8d'))](_0xdc88('0xed'));}})[_0xdc88('0x14')](function(){if(_0x4b68fb){return _0x4b68fb[_0xdc88('0xee')]({'raw':!![]});}})[_0xdc88('0x14')](function(_0x4b2081){if(_0x4b68fb){if(_0x4b2081){_0x183e8d=_0x4b2081;if(_0x183e8d[_0xdc88('0x48')]){var _0x36ad61=_0x183e8d['map'](function(_0x4dbf04){var _0x9c1230={'membername':_0x4b68fb[_0xdc88('0x32')],'UserId':_0x4b68fb['id'],'queue_name':_0x4dbf04[_0xdc88('0x32')],'VoiceQueueId':_0x4dbf04['id'],'interface':_0x5ca865,'paused':_0x4b68fb[_0xdc88('0x98')]||![],'penalty':_0x4dbf04[_0xdc88('0xef')]||0x0};return db['UserVoiceQueueRt']['upsert'](_0x9c1230);});return Promise[_0xdc88('0x4e')](_0x36ad61);}}}})['then'](function(){if(_0x4b68fb){return db[_0xdc88('0xf0')][_0xdc88('0x45')]({'where':{'membername':_0x4b68fb[_0xdc88('0x32')],'exitAt':null}});}})[_0xdc88('0x14')](function(_0x1d70fd){if(_0x4b68fb){var _0x3cf129=[];_0x1d70fd[_0xdc88('0xf1')](function(_0x24d0b3){_0x3cf129[_0xdc88('0x44')](_0x24d0b3[_0xdc88('0xf2')]({'exitAt':moment()['format'](_0xdc88('0xf3'))}));});return Promise[_0xdc88('0x4e')](_0x3cf129);}})['then'](function(){if(_0x4b68fb){var _0x3ae677=[];var _0x1565ea=[];var _0x4182ca=utils[_0xdc88('0xf4')]();var _0x47cb87={'membername':_0x4b68fb['name'],'interface':_0x5ca865,'enterAt':moment()[_0xdc88('0xa4')](_0xdc88('0xf3')),'role':_0x4b68fb['role'],'internal':_0x4b68fb[_0xdc88('0x61')]};_0x4182ca[_0xdc88('0xf1')](function(_0x39f3a7){_0x3ae677[_0xdc88('0x44')](_['merge']({'channel':_0x39f3a7,'type':_0xdc88('0xf5'),'data1':_0xe1fd69[_0xdc88('0x5c')][_0xdc88('0xf6')],'data2':_0x5ca865},_0x47cb87));if(_0x4b68fb[_0xdc88('0x98')]){_0x1565ea[_0xdc88('0x44')](_[_0xdc88('0xcc')]({'channel':_0x39f3a7,'type':_0xdc88('0xf7'),'data1':'LOGININPAUSE'},_0x47cb87));}});return db[_0xdc88('0xf0')][_0xdc88('0xf8')](_0x3ae677[_0xdc88('0xc0')](_0x1565ea),{'individualHooks':!![]});}})['then'](function(){if(_0x4b68fb){return _0x4b68fb[_0xdc88('0xf2')]({'online':!![],'lastLoginAt':moment()['format'](_0xdc88('0xf3')),'voicePause':_0x4b68fb[_0xdc88('0x98')]||![],'mailPause':_0x4b68fb[_0xdc88('0x98')]||![],'chatPause':_0x4b68fb[_0xdc88('0x98')]||![],'faxPause':_0x4b68fb[_0xdc88('0x98')]||![],'smsPause':_0x4b68fb[_0xdc88('0x98')]||![],'openchannelPause':_0x4b68fb['loginInPause']||![],'whatsappPause':_0x4b68fb['loginInPause']||![],'pauseType':_0x4b68fb[_0xdc88('0x98')]?_0xdc88('0xf9'):null,'interface':_0x5ca865,'lastPauseAt':moment()[_0xdc88('0xa4')](_0xdc88('0xf3'))});}})[_0xdc88('0x14')](function(_0xb04fd2){if(_0xe1fd69[_0xdc88('0xfa')]){return _0x16edb0();}else{return Promise[_0xdc88('0xfb')](_0xb04fd2)[_0xdc88('0x14')](respondWithResult(_0x4f4a6a,null));}})['catch'](handleError(_0x4f4a6a,null));};exports[_0xdc88('0xfc')]=function(_0x55612e,_0x477881){var _0x3f5b80;return db[_0xdc88('0x39')][_0xdc88('0x31')]({'where':{'id':_0x55612e[_0xdc88('0x51')]['id'],'role':'agent'},'attributes':['id',_0xdc88('0x32'),'role']})[_0xdc88('0x14')](handleEntityNotFound(_0x477881,null))[_0xdc88('0x14')](function(_0x4977e4){if(_0x4977e4){_0x3f5b80=_0x4977e4;return db[_0xdc88('0xa6')]['destroy']({'where':{'membername':_0x3f5b80[_0xdc88('0x32')]},'individualHooks':!![]});}})[_0xdc88('0x14')](function(){return db['MemberReport'][_0xdc88('0x45')]({'where':{'membername':_0x3f5b80[_0xdc88('0x32')],'exitAt':null}});})[_0xdc88('0x14')](function(_0x42a78f){var _0x5688b0=[];_0x42a78f[_0xdc88('0xf1')](function(_0x581c3a){_0x5688b0['push'](_0x581c3a[_0xdc88('0xf2')]({'exitAt':moment()[_0xdc88('0xa4')](_0xdc88('0xf3'))}));});return Promise[_0xdc88('0x4e')](_0x5688b0);})[_0xdc88('0x14')](function(){return _0x3f5b80[_0xdc88('0xf2')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x477881,null))[_0xdc88('0x4f')](handleError(_0x477881,null));};exports[_0xdc88('0xfd')]=function(_0x3d2d55,_0x5d23f6){var _0x572422;return db[_0xdc88('0xa6')][_0xdc88('0xf2')]({'paused':0x1},{'where':{'UserId':_0x3d2d55['params']['id']},'individualHooks':!![]})[_0xdc88('0x14')](function(){return db['User'][_0xdc88('0x31')]({'where':{'id':_0x3d2d55[_0xdc88('0x51')]['id'],'role':'agent'},'attributes':['id',_0xdc88('0x32'),_0xdc88('0x27'),_0xdc88('0x61'),_0xdc88('0x9a'),_0xdc88('0x97')]});})[_0xdc88('0x14')](handleEntityNotFound(_0x5d23f6,null))[_0xdc88('0x14')](function(_0x1c1937){if(_0x1c1937){_0x572422=_0x1c1937;return respondWithRpcPromise(_0xdc88('0xfe'),_0xdc88('0xfd'),{'id':_0x572422['id'],'name':_0x572422[_0xdc88('0x32')],'pause':!![]});}})[_0xdc88('0x14')](function(){if(_0x572422){return db[_0xdc88('0xf0')][_0xdc88('0x45')]({'where':{'membername':_0x572422[_0xdc88('0x32')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x7b3911){if(_0x7b3911[_0xdc88('0x48')]){var _0x179225=moment()[_0xdc88('0xa4')](_0xdc88('0xf3'));for(var _0x4c7c04=0x0,_0x1e6109=_0x7b3911['length'];_0x4c7c04<_0x1e6109;_0x4c7c04++){_0x7b3911[_0x4c7c04]['updateAttributes']({'exitAt':_0x179225});}}})[_0xdc88('0x14')](function(){var _0x1a1bec=[];var _0x3c6585=utils[_0xdc88('0xf4')]();_0x3c6585['forEach'](function(_0x276a8b){_0x1a1bec['push']({'channel':_0x276a8b,'membername':_0x572422[_0xdc88('0x32')],'interface':_[_0xdc88('0x66')](_0x572422[_0xdc88('0x9a')])?util[_0xdc88('0xa4')](_0xdc88('0xa5'),_0x572422[_0xdc88('0x32')]):_0x572422[_0xdc88('0x9a')],'type':_0xdc88('0xf7'),'enterAt':moment()[_0xdc88('0xa4')](_0xdc88('0xf3')),'data1':_0x3d2d55[_0xdc88('0x5c')][_0xdc88('0xff')]||_0xdc88('0x100'),'role':_0x572422[_0xdc88('0x27')],'internal':_0x572422['internal']});});return db[_0xdc88('0xf0')][_0xdc88('0xf8')](_0x1a1bec,{'individualHooks':!![]});})[_0xdc88('0x14')](function(){return _0x572422[_0xdc88('0xf2')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3d2d55[_0xdc88('0x5c')]['type']||_0xdc88('0x100'),'lastPauseAt':moment()['format'](_0xdc88('0xf3'))});})['then'](respondWithResult(_0x5d23f6,null))[_0xdc88('0x4f')](handleError(_0x5d23f6,null));};exports[_0xdc88('0x101')]=function(_0x5189d6,_0x30721d){if(_0x5189d6[_0xdc88('0x5c')][_0xdc88('0x96')]&&!utils['isValidChannel'](_0x5189d6[_0xdc88('0x5c')][_0xdc88('0x96')])){throw new APIBadRequestError(util[_0xdc88('0xa4')](_0xdc88('0x102'),_0x5189d6[_0xdc88('0x5c')][_0xdc88('0x96')]));}return db[_0xdc88('0x39')][_0xdc88('0x31')]({'where':{'id':_0x5189d6['params']['id']},'attributes':['id',_0xdc88('0x32'),'role',_0xdc88('0x61'),_0xdc88('0x9a'),_0xdc88('0x97'),_0xdc88('0x99'),'mailPause',_0xdc88('0x103'),_0xdc88('0x104'),_0xdc88('0x105'),_0xdc88('0x106'),_0xdc88('0x107'),_0xdc88('0x108'),_0xdc88('0x109')]})[_0xdc88('0x14')](function(_0x4b8a79){if(!_0x4b8a79){throw new APINotFoundError(util[_0xdc88('0xa4')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5189d6['params']['id']));}return _0x4b8a79[_0xdc88('0x101')](_0x5189d6[_0xdc88('0x5c')][_0xdc88('0x96')]);})['then'](respondWithResult(_0x30721d,null))[_0xdc88('0x4f')](APIHandleError(_0x30721d));};exports[_0xdc88('0x10a')]=function(_0x56f76e,_0x49c5c1){var _0x51cb29={};var _0x1dbeb6={};var _0x262918;var _0x16c49d;return db[_0xdc88('0x39')][_0xdc88('0xca')]({'where':{'id':_0x56f76e[_0xdc88('0x51')]['id']}})['then'](handleEntityNotFound(_0x49c5c1,null))[_0xdc88('0x14')](function(_0x23d69d){if(_0x23d69d){_0x262918=_0x23d69d;_0x1dbeb6[_0xdc88('0x55')]=_[_0xdc88('0x52')](db[_0xdc88('0x10b')][_0xdc88('0x3a')]);_0x1dbeb6[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x56f76e[_0xdc88('0x3f')]);_0x1dbeb6[_0xdc88('0xcb')]=_['intersection'](_0x1dbeb6[_0xdc88('0x55')],_0x1dbeb6['query']);_0x51cb29['attributes']=_['intersection'](_0x1dbeb6[_0xdc88('0x55')],qs[_0xdc88('0x56')](_0x56f76e['query']['fields']));_0x51cb29[_0xdc88('0x57')]=_0x51cb29['attributes'][_0xdc88('0x48')]?_0x51cb29[_0xdc88('0x57')]:_0x1dbeb6['model'];_0x51cb29['order']=qs[_0xdc88('0xd5')](_0x56f76e[_0xdc88('0x3f')][_0xdc88('0xd5')]);_0x51cb29[_0xdc88('0x3e')]=qs['filters'](_[_0xdc88('0xd2')](_0x56f76e[_0xdc88('0x3f')],_0x1dbeb6[_0xdc88('0xcb')]));if(_0x56f76e[_0xdc88('0x3f')]['filter']){_0x51cb29['where']=_[_0xdc88('0xcc')](_0x51cb29['where'],{'$or':_[_0xdc88('0x2e')](_0x51cb29[_0xdc88('0x57')],function(_0x2b1f70){var _0x41a95e={};_0x41a95e[_0x2b1f70]={'$like':'%'+_0x56f76e[_0xdc88('0x3f')][_0xdc88('0x2d')]+'%'};return _0x41a95e;})});}_0x51cb29=_[_0xdc88('0xcc')]({},_0x51cb29,_0x56f76e[_0xdc88('0x59')]);return _0x262918[_0xdc88('0x10a')](_0x51cb29);}})[_0xdc88('0x14')](function(_0xdb48ed){if(_0xdb48ed){_0x16c49d=_0xdb48ed[_0xdc88('0x48')];if(!_0x56f76e['query']['hasOwnProperty'](_0xdc88('0xcf'))){_0x51cb29[_0xdc88('0x23')]=qs[_0xdc88('0x23')](_0x56f76e[_0xdc88('0x3f')][_0xdc88('0x23')]);_0x51cb29['offset']=qs[_0xdc88('0x21')](_0x56f76e[_0xdc88('0x3f')][_0xdc88('0x21')]);}return _0x262918[_0xdc88('0x10a')](_0x51cb29);}})[_0xdc88('0x14')](function(_0x38f531){if(_0x38f531){return _0x38f531?{'count':_0x16c49d,'rows':_0x38f531}:null;}})[_0xdc88('0x14')](respondWithResult(_0x49c5c1,null))[_0xdc88('0x4f')](handleError(_0x49c5c1,null));};exports[_0xdc88('0x10c')]=function(_0x463d7d,_0x250a64){var _0x326785=_0x463d7d[_0xdc88('0x51')]['id'];var _0x557bf3=_0x463d7d[_0xdc88('0x5c')]?_0x463d7d[_0xdc88('0x5c')][_0xdc88('0x5f')]:null;var _0x2fff0c=[];return Promise[_0xdc88('0xfb')]()['then'](function(){if(!_0x557bf3)throw new APIBadRequestError(_0xdc88('0x10d'));})[_0xdc88('0x14')](function(){return db[_0xdc88('0x39')][_0xdc88('0xca')]({'where':{'id':_0x326785}});})[_0xdc88('0x14')](function(_0x2658d2){if(!_0x2658d2)throw new APINotFoundError(util[_0xdc88('0xa4')]('User\x20with\x20id\x20%s\x20not\x20found',_0x463d7d['params']['id']));return db[_0xdc88('0x68')]['transaction'](function(_0x2991de){return _0x2658d2['addTeams'](_0x557bf3,{'transaction':_0x2991de})[_0xdc88('0x14')](function(){return db[_0xdc88('0x10b')][_0xdc88('0x45')]({'where':{'id':{'$in':_0x557bf3}}});})[_0xdc88('0x14')](function(_0x335046){var _0x56bbdb=_['map'](_0x335046,function(_0x21953b){return _0x21953b[_0xdc88('0x10e')]();});return Promise[_0xdc88('0x4e')](_0x56bbdb);})[_0xdc88('0x14')](function(_0x1a1c16){_0x2fff0c=_[_0xdc88('0x10f')](_0x1a1c16);var _0x496e3e=_[_0xdc88('0x2e')](_0x2fff0c,function(_0x5555d4){return _0x5555d4[_0xdc88('0x110')](_0x2658d2['id'],{'transaction':_0x2991de});});return Promise[_0xdc88('0x4e')](_0x496e3e);})['then'](function(){if(!_0x2658d2[_0xdc88('0x97')])return;var _0xa4a5d7=_['filter'](_0x2fff0c,function(_0x56e82c){return _0x56e82c['getDataValue'](_0xdc88('0x96'))==='Voice';});var _0x32aeea=_['map'](_0xa4a5d7,function(_0x1c5bfa){return db[_0xdc88('0xa6')][_0xdc88('0x111')]({'membername':_0x2658d2[_0xdc88('0x32')],'UserId':_0x2658d2['id'],'queue_name':_0x1c5bfa[_0xdc88('0x32')],'VoiceQueueId':_0x1c5bfa['id'],'interface':_[_0xdc88('0x66')](_0x2658d2[_0xdc88('0x9a')])?util[_0xdc88('0xa4')](_0xdc88('0xa5'),_0x2658d2[_0xdc88('0x32')]):_0x2658d2[_0xdc88('0x9a')],'paused':_0x2658d2[_0xdc88('0x99')]||![],'penalty':_0x2658d2[_0xdc88('0x112')]},{'transaction':_0x2991de});});return Promise['all'](_0x32aeea);})[_0xdc88('0x14')](function(){return db[_0xdc88('0x113')][_0xdc88('0x45')]({'where':{'teamId':{'$in':_0x557bf3}}});})[_0xdc88('0x14')](function(_0x26ad3c){var _0x24cb97=_[_0xdc88('0x2e')](_0x26ad3c,function(_0x109b64){return db[_0xdc88('0x114')]['create']({'UserId':_0x2658d2['id'],'VoicePrefixId':_0x109b64[_0xdc88('0x115')]},{'transaction':_0x2991de});});return Promise[_0xdc88('0x4e')](_0x24cb97);});});})[_0xdc88('0x14')](function(){for(var _0x5ae427=0x0;_0x5ae427<_0x2fff0c['length'];_0x5ae427++){var _0x1206e9=_0x2fff0c[_0x5ae427][_0xdc88('0x116')](_0xdc88('0x96'));var _0x126fdf=_0x1206e9+_0xdc88('0x9f');socket[_0xdc88('0x25')]('user'+_0x1206e9+'Queue:save',{'UserId':_0x326785,['queueField']:_0x2fff0c[_0x5ae427]['id']});}})['then'](respondWithStatusCode(_0x250a64,null))[_0xdc88('0x4f')](APIHandleError(_0x250a64));};exports['removeTeams']=function(_0x3c6588,_0x29fb3c){var _0x4a1088=_0x3c6588[_0xdc88('0x51')]['id'];var _0x1c17f2=null;if(_0x3c6588[_0xdc88('0x3f')][_0xdc88('0x5f')]){_0x1c17f2=_[_0xdc88('0x117')](_0x3c6588[_0xdc88('0x3f')]['ids'])?_0x3c6588[_0xdc88('0x3f')][_0xdc88('0x5f')]:[_0x3c6588['query']['ids']];}var _0x23c7a3=[];return Promise[_0xdc88('0xfb')]()['then'](function(){if(!_0x1c17f2)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xdc88('0x14')](function(){return db[_0xdc88('0x39')]['findOne']({'where':{'id':_0x4a1088}});})[_0xdc88('0x14')](function(_0x3b69b4){if(!_0x3b69b4)throw new APINotFoundError(util[_0xdc88('0xa4')](_0xdc88('0xc2'),_0x3c6588[_0xdc88('0x51')]['id']));return db[_0xdc88('0x68')][_0xdc88('0x118')](function(_0x286d2a){return _0x3b69b4[_0xdc88('0x119')](_0x1c17f2,{'transaction':_0x286d2a})[_0xdc88('0x14')](function(){return db[_0xdc88('0x10b')][_0xdc88('0x45')]({'where':{'id':{'$in':_0x1c17f2}}});})[_0xdc88('0x14')](function(_0x4346ab){var _0x41b4a9=_[_0xdc88('0x2e')](_0x4346ab,function(_0x19593d){return _0x19593d['getAssociatedQueues']();});return Promise[_0xdc88('0x4e')](_0x41b4a9);})[_0xdc88('0x14')](function(_0x1ac83c){_0x23c7a3=_[_0xdc88('0x10f')](_0x1ac83c);var _0x418bb4=_[_0xdc88('0x2e')](_0x23c7a3,function(_0x798167){return _0x798167[_0xdc88('0x11a')](_0x3b69b4['id'],{'transaction':_0x286d2a});});return Promise[_0xdc88('0x4e')](_0x418bb4);})[_0xdc88('0x14')](function(){if(!_0x3b69b4[_0xdc88('0x97')])return;var _0x101e71=_[_0xdc88('0x2d')](_0x23c7a3,function(_0x156d24){return _0x156d24[_0xdc88('0x116')](_0xdc88('0x96'))===_0xdc88('0x11b');});var _0x9f8cf8=_[_0xdc88('0x2e')](_0x101e71,function(_0x555988){return db[_0xdc88('0xa6')][_0xdc88('0x34')]({'where':{'VoiceQueueId':_0x555988['id'],'UserId':_0x3b69b4['id']},'transaction':_0x286d2a});});return Promise[_0xdc88('0x4e')](_0x9f8cf8);})[_0xdc88('0x14')](function(){return db[_0xdc88('0x113')][_0xdc88('0x45')]({'where':{'teamId':{'$in':_0x1c17f2}}});})['then'](function(_0x2ae4cd){var _0x1c8004=_[_0xdc88('0x2e')](_0x2ae4cd,function(_0x57ed1e){return db[_0xdc88('0x114')][_0xdc88('0x34')]({'where':{'UserId':_0x3b69b4['id'],'VoicePrefixId':_0x57ed1e[_0xdc88('0x115')]}},{'transaction':_0x286d2a});});return Promise[_0xdc88('0x4e')](_0x1c8004);});});})[_0xdc88('0x14')](function(){for(var _0x335c00=0x0;_0x335c00<_0x23c7a3[_0xdc88('0x48')];_0x335c00++){var _0xfba85e=_0x23c7a3[_0x335c00][_0xdc88('0x116')](_0xdc88('0x96'));var _0x86328e=_0xfba85e+'QueueId';socket[_0xdc88('0x25')](_0xdc88('0x29')+_0xfba85e+_0xdc88('0xaa'),{'UserId':_0x4a1088,['queueField']:_0x23c7a3[_0x335c00]['id']});}})[_0xdc88('0x14')](respondWithStatusCode(_0x29fb3c,null))[_0xdc88('0x4f')](APIHandleError(_0x29fb3c));};exports[_0xdc88('0x11c')]=function(_0x512f4c,_0x2f5181){var _0x122644={};var _0x35bced={};var _0x50c292;var _0x112f5b;return db['User'][_0xdc88('0xca')]({'where':{'id':_0x512f4c['params']['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x2f5181,null))[_0xdc88('0x14')](function(_0x28524a){if(_0x28524a){_0x50c292=_0x28524a;_0x35bced[_0xdc88('0x55')]=_[_0xdc88('0x52')](db[_0xdc88('0xc5')][_0xdc88('0x3a')]);_0x35bced[_0xdc88('0x3f')]=_[_0xdc88('0x52')](_0x512f4c['query']);_0x35bced[_0xdc88('0xcb')]=_[_0xdc88('0x54')](_0x35bced[_0xdc88('0x55')],_0x35bced[_0xdc88('0x3f')]);_0x122644[_0xdc88('0x57')]=_['intersection'](_0x35bced[_0xdc88('0x55')],qs['fields'](_0x512f4c[_0xdc88('0x3f')]['fields']));_0x122644[_0xdc88('0x57')]=_0x122644[_0xdc88('0x57')][_0xdc88('0x48')]?_0x122644[_0xdc88('0x57')]:_0x35bced['model'];_0x122644['order']=qs['sort'](_0x512f4c[_0xdc88('0x3f')]['sort']);_0x122644[_0xdc88('0x3e')]=qs[_0xdc88('0xcb')](_[_0xdc88('0xd2')](_0x512f4c[_0xdc88('0x3f')],_0x35bced[_0xdc88('0xcb')]));if(_0x512f4c[_0xdc88('0x3f')][_0xdc88('0x2d')]){_0x122644[_0xdc88('0x3e')]=_[_0xdc88('0xcc')](_0x122644[_0xdc88('0x3e')],{'$or':_[_0xdc88('0x2e')](_0x122644['attributes'],function(_0x5479c0){var _0x49530b={};_0x49530b[_0x5479c0]={'$like':'%'+_0x512f4c[_0xdc88('0x3f')][_0xdc88('0x2d')]+'%'};return _0x49530b;})});}_0x122644=_[_0xdc88('0xcc')]({},_0x122644,_0x512f4c[_0xdc88('0x59')]);return _0x50c292[_0xdc88('0x11c')](_0x122644);}})[_0xdc88('0x14')](function(_0x1939be){if(_0x1939be){_0x112f5b=_0x1939be[_0xdc88('0x48')];if(!_0x512f4c[_0xdc88('0x3f')][_0xdc88('0xc4')](_0xdc88('0xcf'))){_0x122644[_0xdc88('0x23')]=qs[_0xdc88('0x23')](_0x512f4c[_0xdc88('0x3f')][_0xdc88('0x23')]);_0x122644[_0xdc88('0x21')]=qs[_0xdc88('0x21')](_0x512f4c[_0xdc88('0x3f')][_0xdc88('0x21')]);}return _0x50c292[_0xdc88('0x11c')](_0x122644);}})[_0xdc88('0x14')](function(_0x2927b5){if(_0x2927b5){return _0x2927b5?{'count':_0x112f5b,'rows':_0x2927b5}:null;}})['then'](respondWithResult(_0x2f5181,null))['catch'](handleError(_0x2f5181,null));};exports[_0xdc88('0x11d')]=function(_0x4c4146,_0x77c604){var _0x289424={};var _0x53bb58={};var _0x1201a1;return db['User'][_0xdc88('0xca')]({'where':{'id':_0x4c4146['params']['id']}})[_0xdc88('0x14')](handleEntityNotFound(_0x77c604,null))[_0xdc88('0x14')](function(_0x304762){if(_0x304762){_0x1201a1=_0x304762;_0x53bb58[_0xdc88('0x55')]=_[_0xdc88('0x52')](db[_0xdc88('0x39')]['rawAttributes']);_0x53bb58[_0xdc88('0x3f')]=_['keys'](_0x4c4146['query']);_0x53bb58['filters']=_[_0xdc88('0x54')](_0x53bb58['model'],_0x53bb58[_0xdc88('0x3f')]);_0x289424[_0xdc88('0x57')]=_[_0xdc88('0x54')](_0x53bb58[_0xdc88('0x55')],qs['fields'](_0x4c4146[_0xdc88('0x3f')][_0xdc88('0x56')]));_0x289424[_0xdc88('0x57')]=_0x289424['attributes']['length']?_0x289424[_0xdc88('0x57')]:_0x53bb58[_0xdc88('0x55')];_0x289424['order']=qs[_0xdc88('0xd5')](_0x4c4146[_0xdc88('0x3f')][_0xdc88('0xd5')]);_0x289424[_0xdc88('0x3e')]=qs[_0xdc88('0xcb')](_[_0xdc88('0xd2')](_0x4c4146[_0xdc88('0x3f')],_0x53bb58[_0xdc88('0xcb')]));if(_0x4c4146[_0xdc88('0x3f')][_0xdc88('0x2d')]){_0x289424[_0xdc88('0x3e')]=_[_0xdc88('0xcc')](_0x289424[_0xdc88('0x3e')],{'$or':_['map'](_0x289424[_0xdc88('0x57')],function(_0x2ca139){var _0x53415d={};_0x53415d[_0x2ca139]={'$like':'%'+_0x4c4146[_0xdc88('0x3f')][_0xdc88('0x2d')]+'%'};return _0x53415d;})});}_0x289424[_0xdc88('0x55')]=db[_0xdc88('0x39')];_0x289424['as']=_0xdc88('0x2a');_0x289424=_['merge']({},_0x289424,_0x4c4146['options']);return _0x1201a1[_0xdc88('0xee')]({'include':[_0x289424]});}})[_0xdc88('0x14')](function(_0x1f9fb4){if(_0x1f9fb4){var _0xf9209c={},_0x5952cd=[];for(var _0x4961c4=0x0;_0x4961c4<_0x1f9fb4[_0xdc88('0x48')];_0x4961c4+=0x1){for(var _0x4cdc7f=0x0,_0x5db6cb;_0x4cdc7f<_0x1f9fb4[_0x4961c4]['Agents'][_0xdc88('0x48')];_0x4cdc7f+=0x1){_0x5db6cb=_0x1f9fb4[_0x4961c4][_0xdc88('0x2a')][_0x4cdc7f]['get']({'plain':!![]});_0xf9209c[_0x5db6cb['id']]=_0x5db6cb;}}_0xf9209c=_[_0xdc88('0x11e')](_0xf9209c);for(var _0x28a0e5=qs[_0xdc88('0x21')](_0x4c4146[_0xdc88('0x3f')][_0xdc88('0x21')]);_0x28a0e5<_0xf9209c[_0xdc88('0x48')]&&_0x5952cd[_0xdc88('0x48')]=_0xbc9678['agents']){throw new Error(_0x7ec7('0x48'));}})[_0x7ec7('0x1f')](function(){if(_0x573507){return db['UserVoiceQueueRt'][_0x7ec7('0x49')]({'where':{'membername':_0x573507[_0x7ec7('0x1b')]},'individualHooks':!![]});}})[_0x7ec7('0x1f')](function(){if(_0x573507){return _0x573507[_0x7ec7('0x4a')]({'raw':!![]});}})[_0x7ec7('0x1f')](function(_0x5529c4){if(_0x573507){if(_0x5529c4){var _0x119d60=[];_0x38fc0b=_0x5529c4;if(_0x38fc0b[_0x7ec7('0x28')]){for(var _0x5754a9=0x0;_0x5754a9<_0x38fc0b[_0x7ec7('0x28')];_0x5754a9++){_0x119d60[_0x7ec7('0x2c')](db[_0x7ec7('0x23')]['upsert']({'membername':_0x573507[_0x7ec7('0x1b')],'UserId':_0x573507['id'],'queue_name':_0x38fc0b[_0x5754a9][_0x7ec7('0x1b')],'VoiceQueueId':_0x38fc0b[_0x5754a9]['id'],'interface':_0x66636,'paused':_0x573507[_0x7ec7('0x45')]||![],'penalty':_0x38fc0b[_0x5754a9]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x7ec7('0x41')](_0x119d60);}}}})[_0x7ec7('0x1f')](function(){if(_0x573507){return db[_0x7ec7('0x25')][_0x7ec7('0x26')]({'where':{'membername':_0x573507[_0x7ec7('0x1b')],'exitAt':null}});}})[_0x7ec7('0x1f')](function(_0x2a7d40){if(_0x573507){if(_0x2a7d40&&_0x2a7d40[_0x7ec7('0x28')]){var _0x5823d3=[];_0x2a7d40[_0x7ec7('0x40')](function(_0x45d696){_0x5823d3[_0x7ec7('0x2c')](_0x45d696[_0x7ec7('0x24')]({'exitAt':moment()['format'](_0x7ec7('0x29'))}));});return BPromise[_0x7ec7('0x41')](_0x5823d3);}}})[_0x7ec7('0x1f')](function(){if(_0x573507){var _0x285fa0=[];var _0x5bc130=[];var _0x484838=utils[_0x7ec7('0x2b')]();var _0x5c0808={'membername':_0x573507['name'],'interface':_0x66636,'enterAt':moment()['format'](_0x7ec7('0x29')),'role':_0x573507[_0x7ec7('0x1c')],'internal':_0x573507[_0x7ec7('0x1d')]};_0x484838['forEach'](function(_0x2f5330){_0x285fa0[_0x7ec7('0x2c')](_['merge']({'channel':_0x2f5330,'type':_0x7ec7('0x4b'),'data1':_0x7ec7('0x4c'),'data2':_0x66636},_0x5c0808));if(_0x573507[_0x7ec7('0x45')]){_0x5bc130[_0x7ec7('0x2c')](_[_0x7ec7('0x4d')]({'channel':_0x2f5330,'type':_0x7ec7('0x27'),'data1':'LOGININPAUSE'},_0x5c0808));}});return db[_0x7ec7('0x25')][_0x7ec7('0x32')](_0x285fa0['concat'](_0x5bc130),{'individualHooks':!![]});}})['then'](function(){if(_0x573507){return _0x573507[_0x7ec7('0x24')]({'online':!![],'lastLoginAt':moment()[_0x7ec7('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x573507['loginInPause']||![],'mailPause':_0x573507['loginInPause']||![],'chatPause':_0x573507[_0x7ec7('0x45')]||![],'faxPause':_0x573507[_0x7ec7('0x45')]||![],'smsPause':_0x573507[_0x7ec7('0x45')]||![],'openchannelPause':_0x573507[_0x7ec7('0x45')]||![],'pauseType':_0x573507[_0x7ec7('0x45')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x7ec7('0x20')](_0x7ec7('0x29')),'interface':_0x66636});}})['then'](function(_0x5db7fb){_0x24c474(_0x5db7fb);})[_0x7ec7('0x19')](function(_0x3cf14c){_0x5266f8(_0x42d844[_0x7ec7('0x15')](0x1f4,_0x3cf14c['message']));});});}; \ No newline at end of file +var _0xcc36=['map','include','model','info','stringify','catch','error','message','ShowUser','find','raw','then','debug','PauseUser','where','name','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','role','bulkCreate','UnpauseUser','channel','isValidChannel','findOne','online','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','LogoutUser','UserVoiceQueueRt','destroy','push','LoginUser','phone','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','all','findAll','getChannels','merge','LOGIN','callysquare','concat','LOGININPAUSE','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./user.socket','GetUser','User','options','attributes','limit'];(function(_0x5de83e,_0x58dc33){var _0x20559a=function(_0x15af49){while(--_0x15af49){_0x5de83e['push'](_0x5de83e['shift']());}};_0x20559a(++_0x58dc33);}(_0xcc36,0x9f));var _0x6cc3=function(_0x435f85,_0x575941){_0x435f85=_0x435f85-0x0;var _0x355aa2=_0xcc36[_0x435f85];return _0x355aa2;};'use strict';var _=require('lodash');var util=require(_0x6cc3('0x0'));var moment=require(_0x6cc3('0x1'));var BPromise=require('bluebird');var Redis=require(_0x6cc3('0x2'));var db=require(_0x6cc3('0x3'))['db'];var utils=require(_0x6cc3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6cc3('0x5'));config['redis']=_[_0x6cc3('0x6')](config[_0x6cc3('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x6cc3('0x8'))(new Redis(config[_0x6cc3('0x7')]));require(_0x6cc3('0x9'))['register'](socket);exports[_0x6cc3('0xa')]=function(_0x4e6178){var _0x119fa4=this;return new Promise(function(_0x29160e,_0x4dde8f){return db[_0x6cc3('0xb')]['findAll']({'raw':_0x4e6178[_0x6cc3('0xc')]?_0x4e6178[_0x6cc3('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x4e6178[_0x6cc3('0xc')]?_0x4e6178[_0x6cc3('0xc')]['where']||null:null,'attributes':_0x4e6178[_0x6cc3('0xc')]?_0x4e6178[_0x6cc3('0xc')][_0x6cc3('0xd')]||null:null,'limit':_0x4e6178[_0x6cc3('0xc')]?_0x4e6178[_0x6cc3('0xc')][_0x6cc3('0xe')]||null:null,'include':_0x4e6178['options']?_0x4e6178[_0x6cc3('0xc')]['include']?_[_0x6cc3('0xf')](_0x4e6178['options'][_0x6cc3('0x10')],function(_0x4d21c7){return{'model':db[_0x4d21c7['model']],'as':_0x4d21c7['as'],'attributes':_0x4d21c7[_0x6cc3('0xd')],'include':_0x4d21c7['include']?_[_0x6cc3('0xf')](_0x4d21c7[_0x6cc3('0x10')],function(_0x46a852){return{'model':db[_0x46a852[_0x6cc3('0x11')]],'as':_0x46a852['as'],'attributes':_0x46a852[_0x6cc3('0xd')],'include':_0x46a852[_0x6cc3('0x10')]?_['map'](_0x46a852[_0x6cc3('0x10')],function(_0x592152){return{'model':db[_0x592152[_0x6cc3('0x11')]],'as':_0x592152['as'],'attributes':_0x592152[_0x6cc3('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14079e){logger[_0x6cc3('0x12')](_0x6cc3('0xa'),_0x4e6178);logger['debug']('GetUser',_0x4e6178,JSON[_0x6cc3('0x13')](_0x14079e));_0x29160e(_0x14079e);})[_0x6cc3('0x14')](function(_0x1bd0c8){logger[_0x6cc3('0x15')](_0x6cc3('0xa'),_0x1bd0c8[_0x6cc3('0x16')],_0x4e6178);_0x4dde8f(_0x119fa4[_0x6cc3('0x15')](0x1f4,_0x1bd0c8[_0x6cc3('0x16')]));});});};exports[_0x6cc3('0x17')]=function(_0x7f8b6c){var _0x49689e=this;return new Promise(function(_0x4a37dd,_0x101727){return db[_0x6cc3('0xb')][_0x6cc3('0x18')]({'raw':_0x7f8b6c['options']?_0x7f8b6c[_0x6cc3('0xc')][_0x6cc3('0x19')]===undefined?!![]:![]:!![],'where':_0x7f8b6c[_0x6cc3('0xc')]?_0x7f8b6c[_0x6cc3('0xc')]['where']||null:null,'attributes':_0x7f8b6c[_0x6cc3('0xc')]?_0x7f8b6c['options'][_0x6cc3('0xd')]||null:null,'include':_0x7f8b6c[_0x6cc3('0xc')]?_0x7f8b6c['options']['include']?_[_0x6cc3('0xf')](_0x7f8b6c[_0x6cc3('0xc')]['include'],function(_0x3731c7){return{'model':db[_0x3731c7['model']],'as':_0x3731c7['as'],'attributes':_0x3731c7[_0x6cc3('0xd')],'include':_0x3731c7[_0x6cc3('0x10')]?_[_0x6cc3('0xf')](_0x3731c7[_0x6cc3('0x10')],function(_0x3275b4){return{'model':db[_0x3275b4[_0x6cc3('0x11')]],'as':_0x3275b4['as'],'attributes':_0x3275b4[_0x6cc3('0xd')],'include':_0x3275b4[_0x6cc3('0x10')]?_[_0x6cc3('0xf')](_0x3275b4[_0x6cc3('0x10')],function(_0x1e5b66){return{'model':db[_0x1e5b66[_0x6cc3('0x11')]],'as':_0x1e5b66['as'],'attributes':_0x1e5b66['attributes']};}):[]};}):[]};}):[]:[]})[_0x6cc3('0x1a')](function(_0x293b1e){logger[_0x6cc3('0x12')](_0x6cc3('0x17'),_0x7f8b6c);logger[_0x6cc3('0x1b')](_0x6cc3('0x17'),_0x7f8b6c,JSON[_0x6cc3('0x13')](_0x293b1e));_0x4a37dd(_0x293b1e);})[_0x6cc3('0x14')](function(_0x3370c2){logger['error'](_0x6cc3('0x17'),_0x3370c2['message'],_0x7f8b6c);_0x101727(_0x49689e[_0x6cc3('0x15')](0x1f4,_0x3370c2['message']));});});};exports[_0x6cc3('0x1c')]=function(_0x35ed29){var _0x30e91c;return db[_0x6cc3('0xb')][_0x6cc3('0x18')]({'where':_0x35ed29[_0x6cc3('0xc')][_0x6cc3('0x1d')]||{},'attributes':['id',_0x6cc3('0x1e'),'role',_0x6cc3('0x1f'),_0x6cc3('0x20')]})[_0x6cc3('0x1a')](function(_0x34a0af){if(!_0x34a0af){throw new Error(util[_0x6cc3('0x21')](_0x6cc3('0x22'),_0x35ed29[_0x6cc3('0x23')]['id']));}_0x30e91c=_0x34a0af;return db['UserVoiceQueueRt'][_0x6cc3('0x24')]({'paused':0x1},{'where':{'UserId':_0x30e91c['id']},'individualHooks':!![]});})['then'](function(){return db[_0x6cc3('0x25')]['findAll']({'where':{'membername':_0x30e91c[_0x6cc3('0x1e')],'type':_0x6cc3('0x26'),'exitAt':null}});})['then'](function(_0x17a12f){if(_0x17a12f&&_0x17a12f[_0x6cc3('0x27')]){var _0x584d00=moment()[_0x6cc3('0x21')](_0x6cc3('0x28'));for(var _0x38cf00=0x0,_0x323cef=_0x17a12f[_0x6cc3('0x27')];_0x38cf00<_0x323cef;_0x38cf00++){_0x17a12f[_0x38cf00][_0x6cc3('0x29')]({'exitAt':_0x584d00});}}})[_0x6cc3('0x1a')](function(){var _0x428582=[];var _0x3f1673=utils['getChannels']();_0x3f1673[_0x6cc3('0x2a')](function(_0x303c62){_0x428582['push']({'channel':_0x303c62,'membername':_0x30e91c[_0x6cc3('0x1e')],'interface':_[_0x6cc3('0x2b')](_0x30e91c['interface'])?util[_0x6cc3('0x21')](_0x6cc3('0x2c'),_0x30e91c[_0x6cc3('0x1e')]):_0x30e91c[_0x6cc3('0x20')],'type':_0x6cc3('0x26'),'enterAt':moment()[_0x6cc3('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x35ed29[_0x6cc3('0x2d')][_0x6cc3('0x2e')]||_0x6cc3('0x2f'),'role':_0x30e91c[_0x6cc3('0x30')],'internal':_0x30e91c[_0x6cc3('0x1f')],'uniqueid':_0x35ed29[_0x6cc3('0x2d')]['uniqueid']||null});});return db['MemberReport'][_0x6cc3('0x31')](_0x428582,{'individualHooks':!![]});})[_0x6cc3('0x1a')](function(){return _0x30e91c['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x35ed29['body'][_0x6cc3('0x2e')]||_0x6cc3('0x2f'),'lastPauseAt':moment()[_0x6cc3('0x21')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x115d67){throw _0x115d67;});};exports[_0x6cc3('0x32')]=function(_0x4b1609){return Promise['resolve']()[_0x6cc3('0x1a')](function(){if(_0x4b1609[_0x6cc3('0x2d')][_0x6cc3('0x33')]&&!utils[_0x6cc3('0x34')](_0x4b1609[_0x6cc3('0x2d')]['channel'])){throw new Error(util[_0x6cc3('0x21')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4b1609['body']['channel']));}return db['User'][_0x6cc3('0x35')]({'where':_0x4b1609[_0x6cc3('0xc')][_0x6cc3('0x1d')]||{},'attributes':['id',_0x6cc3('0x1e'),_0x6cc3('0x30'),'internal',_0x6cc3('0x20'),_0x6cc3('0x36'),'voicePause',_0x6cc3('0x37'),_0x6cc3('0x38'),'faxPause',_0x6cc3('0x39'),_0x6cc3('0x3a'),_0x6cc3('0x3b'),_0x6cc3('0x3c'),_0x6cc3('0x3d')]});})['then'](function(_0x14d7ea){if(!_0x14d7ea){throw new Error(util['format'](_0x6cc3('0x22'),_0x4b1609[_0x6cc3('0x23')]['id']));}return _0x14d7ea[_0x6cc3('0x3e')](_0x4b1609[_0x6cc3('0x2d')][_0x6cc3('0x33')],_0x6cc3('0x3f'));})[_0x6cc3('0x14')](function(_0x6808bc){throw _0x6808bc;});};exports[_0x6cc3('0x40')]=function(_0xd4c968){var _0x3f5afb=this;return new Promise(function(_0x549084,_0x2be486){var _0x5ae2eb;return db[_0x6cc3('0xb')][_0x6cc3('0x35')]({'where':_0xd4c968[_0x6cc3('0xc')][_0x6cc3('0x1d')]||{},'attributes':['id','name']})[_0x6cc3('0x1a')](function(_0x3b634d){if(_0x3b634d){_0x5ae2eb=_0x3b634d;return db[_0x6cc3('0x41')][_0x6cc3('0x42')]({'where':{'membername':_0x5ae2eb[_0x6cc3('0x1e')]},'individualHooks':!![]});}})[_0x6cc3('0x1a')](function(){if(_0x5ae2eb){return db[_0x6cc3('0x25')]['findAll']({'where':{'membername':_0x5ae2eb['name'],'exitAt':null}});}})['then'](function(_0x5dd259){if(_0x5ae2eb){if(_0x5dd259&&_0x5dd259[_0x6cc3('0x27')]){var _0x4540a2=[];_0x5dd259[_0x6cc3('0x2a')](function(_0x41355e){_0x4540a2[_0x6cc3('0x43')](_0x41355e[_0x6cc3('0x24')]({'exitAt':moment()[_0x6cc3('0x21')](_0x6cc3('0x28'))}));});return BPromise['all'](_0x4540a2);}}})[_0x6cc3('0x1a')](function(){if(_0x5ae2eb){return _0x5ae2eb[_0x6cc3('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x6cc3('0x1a')](function(_0x1599b5){_0x549084(_0x1599b5);})[_0x6cc3('0x14')](function(_0x540072){_0x2be486(_0x3f5afb[_0x6cc3('0x15')](0x1f4,_0x540072[_0x6cc3('0x16')]));});});};exports[_0x6cc3('0x44')]=function(_0x202e70){var _0x1ec495=this;return new Promise(function(_0x3fa483,_0x488d3c){var _0x1d6fc2;var _0x369a3d;var _0x81d7e;var _0x5e5bc3;return db[_0x6cc3('0xb')][_0x6cc3('0x35')]({'where':_0x202e70[_0x6cc3('0xc')][_0x6cc3('0x1d')]||{},'attributes':['id',_0x6cc3('0x1e'),_0x6cc3('0x30'),'mobile',_0x6cc3('0x45'),_0x6cc3('0x1f'),_0x6cc3('0x46'),_0x6cc3('0x20')]})[_0x6cc3('0x1a')](function(_0x200667){if(_0x200667){_0x1d6fc2=_0x200667;_0x5e5bc3=_0x202e70[_0x6cc3('0x2d')][_0x6cc3('0x20')]?_0x202e70[_0x6cc3('0x2d')][_0x6cc3('0x20')]:util[_0x6cc3('0x21')](_0x6cc3('0x2c'),_0x1d6fc2[_0x6cc3('0x1e')]);return db['User']['count']({'where':{'role':_0x6cc3('0x47'),'online':!![],'id':{'$ne':_0x1d6fc2['id']}}});}})[_0x6cc3('0x1a')](function(_0x51118e){if(_0x51118e){_0x81d7e=_0x51118e;return require(_0x6cc3('0x48'))[_0x6cc3('0x49')]();}})[_0x6cc3('0x1a')](function(_0x531858){if(_0x531858&&_0x531858[_0x6cc3('0x4a')]&&_0x81d7e>=_0x531858[_0x6cc3('0x4a')]){throw new Error(_0x6cc3('0x4b'));}})[_0x6cc3('0x1a')](function(){if(_0x1d6fc2){return db[_0x6cc3('0x41')][_0x6cc3('0x42')]({'where':{'membername':_0x1d6fc2['name']},'individualHooks':!![]});}})[_0x6cc3('0x1a')](function(){if(_0x1d6fc2){return _0x1d6fc2[_0x6cc3('0x4c')]({'raw':!![]});}})['then'](function(_0x1ea925){if(_0x1d6fc2){if(_0x1ea925){var _0x340b67=[];_0x369a3d=_0x1ea925;if(_0x369a3d[_0x6cc3('0x27')]){for(var _0x4e526d=0x0;_0x4e526d<_0x369a3d['length'];_0x4e526d++){_0x340b67[_0x6cc3('0x43')](db[_0x6cc3('0x41')][_0x6cc3('0x4d')]({'membername':_0x1d6fc2[_0x6cc3('0x1e')],'UserId':_0x1d6fc2['id'],'queue_name':_0x369a3d[_0x4e526d]['name'],'VoiceQueueId':_0x369a3d[_0x4e526d]['id'],'interface':_0x5e5bc3,'paused':_0x1d6fc2[_0x6cc3('0x46')]||![],'penalty':_0x369a3d[_0x4e526d][_0x6cc3('0x4e')]||0x0}));}return BPromise[_0x6cc3('0x4f')](_0x340b67);}}}})[_0x6cc3('0x1a')](function(){if(_0x1d6fc2){return db['MemberReport'][_0x6cc3('0x50')]({'where':{'membername':_0x1d6fc2['name'],'exitAt':null}});}})[_0x6cc3('0x1a')](function(_0x32a71e){if(_0x1d6fc2){if(_0x32a71e&&_0x32a71e[_0x6cc3('0x27')]){var _0x581d83=[];_0x32a71e[_0x6cc3('0x2a')](function(_0x4676aa){_0x581d83[_0x6cc3('0x43')](_0x4676aa['update']({'exitAt':moment()['format'](_0x6cc3('0x28'))}));});return BPromise[_0x6cc3('0x4f')](_0x581d83);}}})[_0x6cc3('0x1a')](function(){if(_0x1d6fc2){var _0x1d63e6=[];var _0x32bd5e=[];var _0x29dce5=utils[_0x6cc3('0x51')]();var _0x196931={'membername':_0x1d6fc2[_0x6cc3('0x1e')],'interface':_0x5e5bc3,'enterAt':moment()['format'](_0x6cc3('0x28')),'role':_0x1d6fc2[_0x6cc3('0x30')],'internal':_0x1d6fc2[_0x6cc3('0x1f')]};_0x29dce5[_0x6cc3('0x2a')](function(_0xbf09f4){_0x1d63e6[_0x6cc3('0x43')](_[_0x6cc3('0x52')]({'channel':_0xbf09f4,'type':_0x6cc3('0x53'),'data1':_0x6cc3('0x54'),'data2':_0x5e5bc3},_0x196931));if(_0x1d6fc2[_0x6cc3('0x46')]){_0x32bd5e['push'](_['merge']({'channel':_0xbf09f4,'type':_0x6cc3('0x26'),'data1':'LOGININPAUSE'},_0x196931));}});return db[_0x6cc3('0x25')][_0x6cc3('0x31')](_0x1d63e6[_0x6cc3('0x55')](_0x32bd5e),{'individualHooks':!![]});}})['then'](function(){if(_0x1d6fc2){return _0x1d6fc2['update']({'online':!![],'lastLoginAt':moment()[_0x6cc3('0x21')](_0x6cc3('0x28')),'voicePause':_0x1d6fc2[_0x6cc3('0x46')]||![],'mailPause':_0x1d6fc2[_0x6cc3('0x46')]||![],'chatPause':_0x1d6fc2['loginInPause']||![],'faxPause':_0x1d6fc2[_0x6cc3('0x46')]||![],'smsPause':_0x1d6fc2[_0x6cc3('0x46')]||![],'openchannelPause':_0x1d6fc2[_0x6cc3('0x46')]||![],'pauseType':_0x1d6fc2[_0x6cc3('0x46')]?_0x6cc3('0x56'):null,'lastPauseAt':moment()[_0x6cc3('0x21')](_0x6cc3('0x28')),'interface':_0x5e5bc3});}})[_0x6cc3('0x1a')](function(_0x48ca77){_0x3fa483(_0x48ca77);})[_0x6cc3('0x14')](function(_0x20f236){_0x488d3c(_0x1ec495[_0x6cc3('0x15')](0x1f4,_0x20f236[_0x6cc3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index df6e4ae..86ef442 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 _0xef30=['user:','./user.events','save','remove','update','emit','removeListener','register','length'];(function(_0x29b1b7,_0x9947f){var _0x326e97=function(_0x591fa6){while(--_0x591fa6){_0x29b1b7['push'](_0x29b1b7['shift']());}};_0x326e97(++_0x9947f);}(_0xef30,0x1cc));var _0x0ef3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xef30[_0x19e35c];return _0x3e1fe8;};'use strict';var UserEvents=require(_0x0ef3('0x0'));var events=[_0x0ef3('0x1'),_0x0ef3('0x2'),_0x0ef3('0x3')];function createListener(_0x1a3efe,_0x597da8){return function(_0x3b308e){_0x597da8[_0x0ef3('0x4')](_0x1a3efe,_0x3b308e);};}function removeListener(_0x2d652d,_0x40fc58){return function(){UserEvents[_0x0ef3('0x5')](_0x2d652d,_0x40fc58);};}exports[_0x0ef3('0x6')]=function(_0x949835){for(var _0x2c896c=0x0,_0x2f9a28=events[_0x0ef3('0x7')];_0x2c896c<_0x2f9a28;_0x2c896c++){var _0x1ab4a6=events[_0x2c896c];var _0x1d0d58=createListener(_0x0ef3('0x8')+_0x1ab4a6,_0x949835);UserEvents['on'](_0x1ab4a6,_0x1d0d58);}}; \ No newline at end of file +var _0x7408=['removeListener','./user.events','save','remove','update','emit'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7408,0x1ed));var _0x8740=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x7408[_0x4ed4d2];return _0x15ae2e;};'use strict';var UserEvents=require(_0x8740('0x0'));var events=[_0x8740('0x1'),_0x8740('0x2'),_0x8740('0x3')];function createListener(_0x3c999b,_0x2ad599){return function(_0x3efdb4){_0x2ad599[_0x8740('0x4')](_0x3c999b,_0x3efdb4);};}function removeListener(_0x4cee53,_0x3ec7c6){return function(){UserEvents[_0x8740('0x5')](_0x4cee53,_0x3ec7c6);};}exports['register']=function(_0x7b6de3){for(var _0x3ac490=0x0,_0x56fc20=events['length'];_0x3ac490<_0x56fc20;_0x3ac490++){var _0x259e06=events[_0x3ac490];var _0x97fb56=createListener('user:'+_0x259e06,_0x7b6de3);UserEvents['on'](_0x259e06,_0x97fb56);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 9cc5d7a..4859bb7 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(_0x582b6e,_0x11286b){var _0x32adaf=function(_0x111e17){while(--_0x111e17){_0x582b6e['push'](_0x582b6e['shift']());}};_0x32adaf(++_0x11286b);}(_0xe706,0xa3));var _0x6e70=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0xe706[_0x3c51d4];return _0x53c45f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x35bca2,_0x4ce50d){var _0x295d7a=function(_0x226e4d){while(--_0x226e4d){_0x35bca2['push'](_0x35bca2['shift']());}};_0x295d7a(++_0x4ce50d);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9006424..e8f49b3 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaafc=['sequelize','exports','INTEGER'];(function(_0x24b89d,_0x18407d){var _0x296a2e=function(_0x223707){while(--_0x223707){_0x24b89d['push'](_0x24b89d['shift']());}};_0x296a2e(++_0x18407d);}(_0xaafc,0xff));var _0xcaaf=function(_0x410f95,_0x5d20d7){_0x410f95=_0x410f95-0x0;var _0x443b77=_0xaafc[_0x410f95];return _0x443b77;};'use strict';var Sequelize=require(_0xcaaf('0x0'));module[_0xcaaf('0x1')]={'penalty':{'type':Sequelize[_0xcaaf('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 709819e..21844b3 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 _0x3c97=['./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x5481d8,_0x4e8873){var _0x50273d=function(_0x438dd5){while(--_0x438dd5){_0x5481d8['push'](_0x5481d8['shift']());}};_0x50273d(++_0x4e8873);}(_0x3c97,0x102));var _0x73c9=function(_0x20304c,_0x3eec2c){_0x20304c=_0x20304c-0x0;var _0x413e22=_0x3c97[_0x20304c];return _0x413e22;};'use strict';var _=require(_0x73c9('0x0'));var util=require('util');var logger=require(_0x73c9('0x1'))(_0x73c9('0x2'));var moment=require(_0x73c9('0x3'));var BPromise=require(_0x73c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73c9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x73c9('0x6'));module[_0x73c9('0x7')]=function(_0xf6d836,_0x1ae4cb){return _0xf6d836[_0x73c9('0x8')](_0x73c9('0x9'),attributes,{'tableName':_0x73c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6a9=['user_has_chat_queues','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','define','UserChatQueue'];(function(_0x52cfa0,_0x2dff58){var _0x48a4fa=function(_0x2ddaa4){while(--_0x2ddaa4){_0x52cfa0['push'](_0x52cfa0['shift']());}};_0x48a4fa(++_0x2dff58);}(_0xb6a9,0x17b));var _0x9b6a=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb6a9[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x9b6a('0x0'));var util=require('util');var logger=require(_0x9b6a('0x1'))(_0x9b6a('0x2'));var moment=require('moment');var BPromise=require(_0x9b6a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9b6a('0x4'));var config=require(_0x9b6a('0x5'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x36bab5,_0x199038){return _0x36bab5[_0x9b6a('0x6')](_0x9b6a('0x7'),attributes,{'tableName':_0x9b6a('0x8'),'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 4203b6d..19e0fb0 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 _0x841b=['request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5da1d8,_0x37a4eb){var _0x53b1ad=function(_0x121446){while(--_0x121446){_0x5da1d8['push'](_0x5da1d8['shift']());}};_0x53b1ad(++_0x37a4eb);}(_0x841b,0xfd));var _0xb841=function(_0x3e57ef,_0x388fab){_0x3e57ef=_0x3e57ef-0x0;var _0x5ade66=_0x841b[_0x3e57ef];return _0x5ade66;};'use strict';var _=require(_0xb841('0x0'));var util=require(_0xb841('0x1'));var moment=require(_0xb841('0x2'));var BPromise=require(_0xb841('0x3'));var rs=require(_0xb841('0x4'));var fs=require('fs');var Redis=require(_0xb841('0x5'));var db=require(_0xb841('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb841('0x7'))('rpc');var config=require(_0xb841('0x8'));var jayson=require(_0xb841('0x9'));var client=jayson[_0xb841('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c2c45,_0x22d8ea,_0xe27373){return new BPromise(function(_0x5ac759,_0x294a78){return client[_0xb841('0xb')](_0x2c2c45,_0xe27373)[_0xb841('0xc')](function(_0x4214ca){logger[_0xb841('0xd')](_0xb841('0xe'),_0x22d8ea,'request\x20sent');logger[_0xb841('0xf')](_0xb841('0x10'),_0x22d8ea,_0xb841('0x11'),JSON[_0xb841('0x12')](_0x4214ca));if(_0x4214ca['error']){if(_0x4214ca[_0xb841('0x13')][_0xb841('0x14')]===0x1f4){logger[_0xb841('0x13')](_0xb841('0xe'),_0x22d8ea,_0x4214ca['error'][_0xb841('0x15')]);return _0x294a78(_0x4214ca[_0xb841('0x13')]['message']);}logger[_0xb841('0x13')](_0xb841('0xe'),_0x22d8ea,_0x4214ca[_0xb841('0x13')]['message']);return _0x5ac759(_0x4214ca['error'][_0xb841('0x15')]);}else{logger[_0xb841('0xd')](_0xb841('0xe'),_0x22d8ea,_0xb841('0x11'));_0x5ac759(_0x4214ca[_0xb841('0x16')][_0xb841('0x15')]);}})[_0xb841('0x17')](function(_0x3d0422){logger[_0xb841('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x22d8ea,_0x3d0422);_0x294a78(_0x3d0422);});});} \ No newline at end of file +var _0x6227=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x56cd75,_0x2c4f7f){var _0x73b83a=function(_0x48d2d2){while(--_0x48d2d2){_0x56cd75['push'](_0x56cd75['shift']());}};_0x73b83a(++_0x2c4f7f);}(_0x6227,0x13c));var _0x7622=function(_0x18c1db,_0x47ac35){_0x18c1db=_0x18c1db-0x0;var _0x7c8ef8=_0x6227[_0x18c1db];return _0x7c8ef8;};'use strict';var _=require(_0x7622('0x0'));var util=require(_0x7622('0x1'));var moment=require(_0x7622('0x2'));var BPromise=require(_0x7622('0x3'));var rs=require(_0x7622('0x4'));var fs=require('fs');var Redis=require(_0x7622('0x5'));var db=require(_0x7622('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7622('0x7'))(_0x7622('0x8'));var config=require(_0x7622('0x9'));var jayson=require(_0x7622('0xa'));var client=jayson['client'][_0x7622('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x84726d,_0x46fdc3,_0xaeda2a){return new BPromise(function(_0x51c2e3,_0x1343d9){return client[_0x7622('0xc')](_0x84726d,_0xaeda2a)[_0x7622('0xd')](function(_0x3060b3){logger[_0x7622('0xe')](_0x7622('0xf'),_0x46fdc3,'request\x20sent');logger[_0x7622('0x10')](_0x7622('0x11'),_0x46fdc3,_0x7622('0x12'),JSON[_0x7622('0x13')](_0x3060b3));if(_0x3060b3[_0x7622('0x14')]){if(_0x3060b3[_0x7622('0x14')][_0x7622('0x15')]===0x1f4){logger['error'](_0x7622('0xf'),_0x46fdc3,_0x3060b3[_0x7622('0x14')][_0x7622('0x16')]);return _0x1343d9(_0x3060b3['error'][_0x7622('0x16')]);}logger[_0x7622('0x14')](_0x7622('0xf'),_0x46fdc3,_0x3060b3[_0x7622('0x14')][_0x7622('0x16')]);return _0x51c2e3(_0x3060b3[_0x7622('0x14')][_0x7622('0x16')]);}else{logger[_0x7622('0xe')](_0x7622('0xf'),_0x46fdc3,'request\x20sent');_0x51c2e3(_0x3060b3['result'][_0x7622('0x16')]);}})[_0x7622('0x17')](function(_0x2755e0){logger[_0x7622('0x14')](_0x7622('0xf'),_0x46fdc3,_0x2755e0);_0x1343d9(_0x2755e0);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c5abbcf..a58b52a 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1e3885,_0x64212b){var _0x26e5a9=function(_0x1c826f){while(--_0x1c826f){_0x1e3885['push'](_0x1e3885['shift']());}};_0x26e5a9(++_0x64212b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x55de41,_0x29e5d1){var _0x1117e3=function(_0x2dad7f){while(--_0x2dad7f){_0x55de41['push'](_0x55de41['shift']());}};_0x1117e3(++_0x29e5d1);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 964c2d1..c0426df 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 _0x1b67=['sequelize','exports'];(function(_0x44ec2d,_0x2f8cf6){var _0x31a8d5=function(_0x1ef99c){while(--_0x1ef99c){_0x44ec2d['push'](_0x44ec2d['shift']());}};_0x31a8d5(++_0x2f8cf6);}(_0x1b67,0x10a));var _0x71b6=function(_0x121e69,_0x3a6ebb){_0x121e69=_0x121e69-0x0;var _0xeb7488=_0x1b67[_0x121e69];return _0xeb7488;};'use strict';var Sequelize=require(_0x71b6('0x0'));module[_0x71b6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe160=['exports','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe160,0x7b));var _0x0e16=function(_0x79214,_0x118be1){_0x79214=_0x79214-0x0;var _0x46443d=_0xe160[_0x79214];return _0x46443d;};'use strict';var Sequelize=require(_0x0e16('0x0'));module[_0x0e16('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8b834bb..5a80ab2 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 _0x510d=['define','UserFaxQueue','lodash','../../config/logger','api','moment','bluebird','rimraf','./userFaxQueue.attributes','exports'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x510d,0x192));var _0xd510=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x510d[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0xd510('0x0'));var util=require('util');var logger=require(_0xd510('0x1'))(_0xd510('0x2'));var moment=require(_0xd510('0x3'));var BPromise=require(_0xd510('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd510('0x5'));var config=require('../../config/environment');var attributes=require(_0xd510('0x6'));module[_0xd510('0x7')]=function(_0x4afebf,_0x34b74a){return _0x4afebf[_0xd510('0x8')](_0xd510('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaabd=['./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0xaabd,0xd7));var _0xdaab=function(_0x5ea710,_0x40a4f8){_0x5ea710=_0x5ea710-0x0;var _0x5397e2=_0xaabd[_0x5ea710];return _0x5397e2;};'use strict';var _=require(_0xdaab('0x0'));var util=require(_0xdaab('0x1'));var logger=require(_0xdaab('0x2'))(_0xdaab('0x3'));var moment=require(_0xdaab('0x4'));var BPromise=require(_0xdaab('0x5'));var rp=require(_0xdaab('0x6'));var fs=require('fs');var path=require(_0xdaab('0x7'));var rimraf=require(_0xdaab('0x8'));var config=require('../../config/environment');var attributes=require(_0xdaab('0x9'));module[_0xdaab('0xa')]=function(_0x6f5eea,_0x352a3c){return _0x6f5eea[_0xdaab('0xb')](_0xdaab('0xc'),attributes,{'tableName':_0xdaab('0xd'),'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 3acf1bd..8d4ceff 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 _0xc34a=['catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xc34a,0x12d));var _0xac34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc34a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac34('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xac34('0x1'));var fs=require('fs');var Redis=require(_0xac34('0x2'));var db=require(_0xac34('0x3'))['db'];var utils=require(_0xac34('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xac34('0x5'));var jayson=require(_0xac34('0x6'));var client=jayson['client'][_0xac34('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x392ea3,_0x47a7bb,_0xf2eceb){return new BPromise(function(_0x5520a1,_0x297c2e){return client[_0xac34('0x8')](_0x392ea3,_0xf2eceb)[_0xac34('0x9')](function(_0x40f120){logger[_0xac34('0xa')](_0xac34('0xb'),_0x47a7bb,_0xac34('0xc'));logger[_0xac34('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x47a7bb,'request\x20sent',JSON[_0xac34('0xe')](_0x40f120));if(_0x40f120[_0xac34('0xf')]){if(_0x40f120['error'][_0xac34('0x10')]===0x1f4){logger['error'](_0xac34('0xb'),_0x47a7bb,_0x40f120[_0xac34('0xf')]['message']);return _0x297c2e(_0x40f120[_0xac34('0xf')][_0xac34('0x11')]);}logger[_0xac34('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x47a7bb,_0x40f120[_0xac34('0xf')][_0xac34('0x11')]);return _0x5520a1(_0x40f120['error'][_0xac34('0x11')]);}else{logger[_0xac34('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x47a7bb,'request\x20sent');_0x5520a1(_0x40f120[_0xac34('0x12')][_0xac34('0x11')]);}})[_0xac34('0x13')](function(_0x451b0e){logger[_0xac34('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x47a7bb,_0x451b0e);_0x297c2e(_0x451b0e);});});} \ No newline at end of file +var _0x8b4a=['then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserFaxQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request'];(function(_0x4190bb,_0x19720f){var _0x3026e6=function(_0x1472d0){while(--_0x1472d0){_0x4190bb['push'](_0x4190bb['shift']());}};_0x3026e6(++_0x19720f);}(_0x8b4a,0x181));var _0xa8b4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8b4a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xa8b4('0x0'));var util=require(_0xa8b4('0x1'));var moment=require('moment');var BPromise=require(_0xa8b4('0x2'));var rs=require(_0xa8b4('0x3'));var fs=require('fs');var Redis=require(_0xa8b4('0x4'));var db=require(_0xa8b4('0x5'))['db'];var utils=require(_0xa8b4('0x6'));var logger=require(_0xa8b4('0x7'))('rpc');var config=require(_0xa8b4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8b4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bc5ad,_0x17124a,_0x48c30c){return new BPromise(function(_0x29b61e,_0x3e6f22){return client[_0xa8b4('0xa')](_0x4bc5ad,_0x48c30c)[_0xa8b4('0xb')](function(_0x4ef470){logger[_0xa8b4('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x17124a,_0xa8b4('0xd'));logger[_0xa8b4('0xe')](_0xa8b4('0xf'),_0x17124a,_0xa8b4('0xd'),JSON[_0xa8b4('0x10')](_0x4ef470));if(_0x4ef470[_0xa8b4('0x11')]){if(_0x4ef470[_0xa8b4('0x11')]['code']===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x17124a,_0x4ef470['error'][_0xa8b4('0x12')]);return _0x3e6f22(_0x4ef470[_0xa8b4('0x11')]['message']);}logger[_0xa8b4('0x11')](_0xa8b4('0x13'),_0x17124a,_0x4ef470[_0xa8b4('0x11')][_0xa8b4('0x12')]);return _0x29b61e(_0x4ef470['error']['message']);}else{logger[_0xa8b4('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x17124a,_0xa8b4('0xd'));_0x29b61e(_0x4ef470[_0xa8b4('0x14')][_0xa8b4('0x12')]);}})[_0xa8b4('0x15')](function(_0x54598a){logger[_0xa8b4('0x11')](_0xa8b4('0x13'),_0x17124a,_0x54598a);_0x3e6f22(_0x54598a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 7d61051..1778d18 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1e4725,_0x276d83){var _0x3b0685=function(_0x13d73c){while(--_0x13d73c){_0x1e4725['push'](_0x1e4725['shift']());}};_0x3b0685(++_0x276d83);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x28014d,_0x383e2f){_0x28014d=_0x28014d-0x0;var _0x2572cc=_0xcb91[_0x28014d];return _0x2572cc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5516c7,_0x3d46e4){var _0x314076=function(_0x3e3b38){while(--_0x3e3b38){_0x5516c7['push'](_0x5516c7['shift']());}};_0x314076(++_0x3d46e4);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 187b07b..3d2d71a 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 _0x160c=['sequelize','exports'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0x160c,0xde));var _0xc160=function(_0x3dfe48,_0x305e17){_0x3dfe48=_0x3dfe48-0x0;var _0x264db9=_0x160c[_0x3dfe48];return _0x264db9;};'use strict';var Sequelize=require(_0xc160('0x0'));module[_0xc160('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3cbc=['exports','sequelize'];(function(_0x4ccd32,_0x3b11c9){var _0x30b693=function(_0x1b816f){while(--_0x1b816f){_0x4ccd32['push'](_0x4ccd32['shift']());}};_0x30b693(++_0x3b11c9);}(_0x3cbc,0x151));var _0xc3cb=function(_0x39bce8,_0x53eb90){_0x39bce8=_0x39bce8-0x0;var _0x2490db=_0x3cbc[_0x39bce8];return _0x2490db;};'use strict';var Sequelize=require(_0xc3cb('0x0'));module[_0xc3cb('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 8aceb35..954b9d5 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 _0x00c4=['request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x424d04,_0x1297ea){var _0x5c526b=function(_0x1a110d){while(--_0x1a110d){_0x424d04['push'](_0x424d04['shift']());}};_0x5c526b(++_0x1297ea);}(_0x00c4,0x13f));var _0x400c=function(_0x4c2468,_0x59bc81){_0x4c2468=_0x4c2468-0x0;var _0x27626a=_0x00c4[_0x4c2468];return _0x27626a;};'use strict';var _=require(_0x400c('0x0'));var util=require(_0x400c('0x1'));var logger=require(_0x400c('0x2'))(_0x400c('0x3'));var moment=require(_0x400c('0x4'));var BPromise=require(_0x400c('0x5'));var rp=require(_0x400c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x400c('0x7'));var config=require(_0x400c('0x8'));var attributes=require(_0x400c('0x9'));module['exports']=function(_0x3bc034,_0x1b346b){return _0x3bc034[_0x400c('0xa')](_0x400c('0xb'),attributes,{'tableName':_0x400c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc141=['moment','request-promise','path','../../config/environment','./userMailQueue.attributes','user_has_mail_queues','util','../../config/logger','api'];(function(_0x403ff8,_0x1b1aee){var _0x4dfd81=function(_0x33589c){while(--_0x33589c){_0x403ff8['push'](_0x403ff8['shift']());}};_0x4dfd81(++_0x1b1aee);}(_0xc141,0x15c));var _0x1c14=function(_0x4e9559,_0x324346){_0x4e9559=_0x4e9559-0x0;var _0x13d630=_0xc141[_0x4e9559];return _0x13d630;};'use strict';var _=require('lodash');var util=require(_0x1c14('0x0'));var logger=require(_0x1c14('0x1'))(_0x1c14('0x2'));var moment=require(_0x1c14('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c14('0x4'));var fs=require('fs');var path=require(_0x1c14('0x5'));var rimraf=require('rimraf');var config=require(_0x1c14('0x6'));var attributes=require(_0x1c14('0x7'));module['exports']=function(_0x23e062,_0x568777){return _0x23e062['define']('UserMailQueue',attributes,{'tableName':_0x1c14('0x8'),'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 6702b67..0bdbf12 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7217,0x19e));var _0x7721=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7217[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x3b1286,_0x1d50ee){var _0x1053df=function(_0x489228){while(--_0x489228){_0x3b1286['push'](_0x3b1286['shift']());}};_0x1053df(++_0x1d50ee);}(_0x55ca,0x126));var _0xa55c=function(_0x5bf992,_0x533b26){_0x5bf992=_0x5bf992-0x0;var _0x288176=_0x55ca[_0x5bf992];return _0x288176;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index c584cdd..ad67f03 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 _0x251a=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x251a,0x78));var _0xa251=function(_0x51308d,_0x42cf02){_0x51308d=_0x51308d-0x0;var _0x37cde8=_0x251a[_0x51308d];return _0x37cde8;};'use strict';var multer=require(_0xa251('0x0'));var util=require('util');var path=require(_0xa251('0x1'));var timeout=require('connect-timeout');var express=require(_0xa251('0x2'));var router=express[_0xa251('0x3')]();var fs_extra=require(_0xa251('0x4'));var auth=require(_0xa251('0x5'));var interaction=require(_0xa251('0x6'));var config=require(_0xa251('0x7'));var controller=require(_0xa251('0x8'));router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0xa251('0x9')]=router; \ No newline at end of file +var _0x01a0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports'];(function(_0x58b44a,_0x1a7aa6){var _0xd6779d=function(_0x40d8f3){while(--_0x40d8f3){_0x58b44a['push'](_0x58b44a['shift']());}};_0xd6779d(++_0x1a7aa6);}(_0x01a0,0xa8));var _0x001a=function(_0x4f12a3,_0x2d296a){_0x4f12a3=_0x4f12a3-0x0;var _0x39d9c8=_0x01a0[_0x4f12a3];return _0x39d9c8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x001a('0x0'));var express=require(_0x001a('0x1'));var router=express[_0x001a('0x2')]();var fs_extra=require(_0x001a('0x3'));var auth=require(_0x001a('0x4'));var interaction=require(_0x001a('0x5'));var config=require(_0x001a('0x6'));var controller=require(_0x001a('0x7'));router[_0x001a('0x8')]('/',auth[_0x001a('0x9')](),controller[_0x001a('0xa')]);module[_0x001a('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 b8c16db..0a745c2 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 _0xe8dc=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x167a29,_0x54c7f4){var _0x22f5df=function(_0x2f1e69){while(--_0x2f1e69){_0x167a29['push'](_0x167a29['shift']());}};_0x22f5df(++_0x54c7f4);}(_0xe8dc,0xe2));var _0xce8d=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0xe8dc[_0x5d1044];return _0x3cd90e;};'use strict';var Sequelize=require(_0xce8d('0x0'));module[_0xce8d('0x1')]={'body':{'type':Sequelize[_0xce8d('0x2')]},'senderName':{'type':Sequelize[_0xce8d('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xce8d('0x4')]}}; \ No newline at end of file +var _0x82c5=['STRING','BOOLEAN','exports','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x82c5,0xee));var _0x582c=function(_0x7aaea2,_0x1f76e0){_0x7aaea2=_0x7aaea2-0x0;var _0x2b5a93=_0x82c5[_0x7aaea2];return _0x2b5a93;};'use strict';var Sequelize=require('sequelize');module[_0x582c('0x0')]={'body':{'type':Sequelize[_0x582c('0x1')]},'senderName':{'type':Sequelize[_0x582c('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x582c('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index c4204c7..2ad76ed 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 _0x94c0=['TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sortBy','join','UserNotification','forEach','emit','userNotification:send','text','Template','findOne','render','html','catch','User','union','ids','includes','queue','replace','Queue','push','flatten','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty'];(function(_0x13b8a1,_0x5b7fff){var _0x5c5d09=function(_0x477483){while(--_0x477483){_0x13b8a1['push'](_0x13b8a1['shift']());}};_0x5c5d09(++_0x5b7fff);}(_0x94c0,0x8d));var _0x094c=function(_0x3815b2,_0xdeaa84){_0x3815b2=_0x3815b2-0x0;var _0x2ebd79=_0x94c0[_0x3815b2];return _0x2ebd79;};'use strict';var emlformat=require(_0x094c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x094c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x094c('0x2'));var moment=require(_0x094c('0x3'));var BPromise=require(_0x094c('0x4'));var Mustache=require(_0x094c('0x5'));var util=require(_0x094c('0x6'));var path=require(_0x094c('0x7'));var sox=require('sox');var csv=require(_0x094c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x094c('0x9'));var _=require(_0x094c('0xa'));var squel=require(_0x094c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x094c('0xc'));var Redis=require(_0x094c('0xd'));var authService=require(_0x094c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x094c('0xf'));var hardwareService=require(_0x094c('0x10'));var logger=require('../../config/logger')(_0x094c('0x11'));var utils=require(_0x094c('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x094c('0x13'))['db'];config[_0x094c('0x14')]=_[_0x094c('0x15')](config['redis'],{'host':_0x094c('0x16'),'port':0x18eb});var socket=require(_0x094c('0x17'))(new Redis(config[_0x094c('0x14')]));require('./userNotification.socket')[_0x094c('0x18')](socket);function respondWithStatusCode(_0xd06ca2,_0x2a6b15){_0x2a6b15=_0x2a6b15||0xcc;return function(_0x131849){if(_0x131849){return _0xd06ca2[_0x094c('0x19')](_0x2a6b15);}return _0xd06ca2['status'](_0x2a6b15)[_0x094c('0x1a')]();};}function respondWithResult(_0x3ccd2a,_0x108cee){_0x108cee=_0x108cee||0xc8;return function(_0x3cb8b0){if(_0x3cb8b0){return _0x3ccd2a[_0x094c('0x1b')](_0x108cee)[_0x094c('0x1c')](_0x3cb8b0);}};}function respondWithFilteredResult(_0x3be8dd,_0x376e39){return function(_0x2a5af1){if(_0x2a5af1){var _0x5bfea3=typeof _0x376e39[_0x094c('0x1d')]===_0x094c('0x1e')&&typeof _0x376e39[_0x094c('0x1f')]===_0x094c('0x1e');var _0x38c7ac=_0x2a5af1[_0x094c('0x20')];var _0x59efca=_0x5bfea3?0x0:_0x376e39['offset'];var _0x33f653=_0x5bfea3?_0x2a5af1['count']:_0x376e39[_0x094c('0x1d')]+_0x376e39[_0x094c('0x1f')];var _0x51cf5b;if(_0x33f653>=_0x38c7ac){_0x33f653=_0x38c7ac;_0x51cf5b=0xc8;}else{_0x51cf5b=0xce;}_0x3be8dd[_0x094c('0x1b')](_0x51cf5b);return _0x3be8dd[_0x094c('0x21')](_0x094c('0x22'),_0x59efca+'-'+_0x33f653+'/'+_0x38c7ac)[_0x094c('0x1c')](_0x2a5af1);}return null;};}function patchUpdates(_0x49ad42){return function(_0x2bb814){try{jsonpatch[_0x094c('0x23')](_0x2bb814,_0x49ad42,!![]);}catch(_0x28b7cd){return BPromise[_0x094c('0x24')](_0x28b7cd);}return _0x2bb814[_0x094c('0x25')]();};}function saveUpdates(_0x57a2c0,_0x526fd9){return function(_0x308294){if(_0x308294){return _0x308294[_0x094c('0x26')](_0x57a2c0)[_0x094c('0x27')](function(_0x20584b){return _0x20584b;});}return null;};}function removeEntity(_0x550950,_0x2f70ad){return function(_0x51cbe1){if(_0x51cbe1){return _0x51cbe1[_0x094c('0x28')]()['then'](function(){_0x550950[_0x094c('0x1b')](0xcc)[_0x094c('0x1a')]();});}};}function handleEntityNotFound(_0xabf02e,_0x34d25c){return function(_0x598a42){if(!_0x598a42){_0xabf02e['sendStatus'](0x194);}return _0x598a42;};}function handleError(_0x2fac37,_0x306ff0){_0x306ff0=_0x306ff0||0x1f4;return function(_0x4a3304){logger[_0x094c('0x29')](_0x4a3304['stack']);if(_0x4a3304['name']){delete _0x4a3304[_0x094c('0x2a')];}_0x2fac37['status'](_0x306ff0)[_0x094c('0x2b')](_0x4a3304);};}exports[_0x094c('0x2c')]=function(_0xed6b56,_0x52413d,_0x36f124){if(!_0xed6b56[_0x094c('0x2d')]['hasOwnProperty']('text')&&!_0xed6b56['body'][_0x094c('0x2e')](_0x094c('0x2f'))){throw new db[(_0x094c('0x30'))][(_0x094c('0x31'))](_0x094c('0x32'));}else{if(_0xed6b56[_0x094c('0x2d')]['hasOwnProperty'](_0x094c('0x2f'))&&!_0xed6b56[_0x094c('0x2d')][_0x094c('0x2e')](_0x094c('0x33'))){throw new db[(_0x094c('0x30'))][(_0x094c('0x31'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xed6b56[_0x094c('0x2d')][_0x094c('0x2e')]('recipients')){throw new db[(_0x094c('0x30'))][(_0x094c('0x31'))](_0x094c('0x34'));}else{try{var _0x431421=JSON[_0x094c('0x35')](_0xed6b56[_0x094c('0x2d')][_0x094c('0x36')]);}catch(_0x108fa8){logger[_0x094c('0x29')](_0x108fa8);throw new db[(_0x094c('0x30'))][(_0x094c('0x31'))](_0x094c('0x37'));}var _0x34462f=[_0x094c('0x38'),_0x094c('0x39'),'mailqueue',_0x094c('0x3a'),_0x094c('0x3b'),_0x094c('0x3c'),'whatsappqueue','team',_0x094c('0x3d')];if(_[_0x094c('0x3e')](_0x431421,function(_0x35d58f){return!_['includes'](_0x34462f,_0x35d58f[_0x094c('0x3f')][_0x094c('0x40')]());})){throw new db[(_0x094c('0x30'))][(_0x094c('0x31'))](_0x094c('0x41'));}}}var _0x13eb74={};_0x13eb74[_0x094c('0x42')]=_0xed6b56[_0x094c('0x2d')][_0x094c('0x2e')](_0x094c('0x42'))?_0xed6b56[_0x094c('0x2d')][_0x094c('0x42')]:_0xed6b56[_0x094c('0x3d')][_0x094c('0x43')];_0x13eb74['recipientsDescription']=_[_0x094c('0x44')](_0xed6b56[_0x094c('0x2d')][_0x094c('0x45')])?null:_0xed6b56['body'][_0x094c('0x45')];_0x13eb74[_0x094c('0x46')]=_0xed6b56[_0x094c('0x2d')][_0x094c('0x46')]||![];_0x13eb74[_0x094c('0x47')]=_0xed6b56[_0x094c('0x3d')]['id'];return getContent(_0xed6b56[_0x094c('0x2d')])[_0x094c('0x27')](function(_0x3c3f69){_0x13eb74[_0x094c('0x2d')]=_0x3c3f69;return getRecipients(_0x431421);})[_0x094c('0x27')](function(_0x36f57c){_0x13eb74['recipientsId']=_[_0x094c('0x48')](_0x36f57c)[_0x094c('0x49')](',');return db['sequelize']['transaction'](function(_0x35ece2){return db[_0x094c('0x4a')]['create'](_0x13eb74,{'raw':!![],'transaction':_0x35ece2})[_0x094c('0x27')](function(_0x416783){var _0x2a21e1={'sender':_0x13eb74[_0x094c('0x42')],'description':_0x13eb74[_0x094c('0x45')],'content':_0x13eb74[_0x094c('0x2d')],'beep':_0x13eb74[_0x094c('0x46')]};_0x36f57c[_0x094c('0x4b')](function(_0x5ed171){_0x2a21e1['recipient']=_0x5ed171;socket[_0x094c('0x4c')](_0x094c('0x4d'),_0x2a21e1);});return _0x416783;});});})[_0x094c('0x27')](respondWithResult(_0x52413d,0xc9))['catch'](handleError(_0x52413d,null));};function getContent(_0x130e45){return new BPromise(function(_0x122646,_0x3d124f){if(_0x130e45['text']){_0x122646(_0x130e45[_0x094c('0x4e')]);return;}return db[_0x094c('0x4f')][_0x094c('0x50')]({'attributes':['html'],'where':{'id':_0x130e45[_0x094c('0x2f')]},'raw':!![]})[_0x094c('0x27')](function(_0x32cfdf){if(!_0x32cfdf)throw new db[(_0x094c('0x30'))][(_0x094c('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x515172=Mustache[_0x094c('0x51')](_0x32cfdf[_0x094c('0x52')],_0x130e45['view']);_0x122646(_0x515172);})[_0x094c('0x53')](function(_0x5c63e5){_0x3d124f(_0x5c63e5);});});}function getRecipients(_0x1b83a5){return new BPromise(function(_0x37b3d4,_0x1f3713){var _0x23aa01=[];var _0x1fea69=[];_0x1b83a5[_0x094c('0x4b')](function(_0x1c69fa){var _0x548f8b=_['startCase'](_0x1c69fa[_0x094c('0x3f')][_0x094c('0x40')]());if(_0x548f8b===_0x094c('0x54')){_0x23aa01=_[_0x094c('0x55')](_0x23aa01,_0x1c69fa[_0x094c('0x56')]);}else{if(_[_0x094c('0x57')](_0x548f8b,_0x094c('0x58')))_0x548f8b=_0x548f8b[_0x094c('0x59')](_0x094c('0x58'),_0x094c('0x5a'));_0x1c69fa[_0x094c('0x56')][_0x094c('0x4b')](function(_0x3909f9){_0x1fea69[_0x094c('0x5b')](getAgents(_0x548f8b,_0x3909f9));});}});return BPromise['all'](_0x1fea69)[_0x094c('0x27')](function(_0x3c06fd){_0x23aa01=_['union'](_0x23aa01,_[_0x094c('0x5c')](_0x3c06fd));_0x37b3d4(_0x23aa01);})[_0x094c('0x53')](function(_0xa81371){_0x1f3713(_0xa81371);});});}function getAgents(_0x156ec9,_0x17de52){return new BPromise(function(_0xe0c3d9,_0x2240a1){return db[_0x156ec9][_0x094c('0x50')]({'where':{'id':_0x17de52}})[_0x094c('0x27')](function(_0x482faf){return _0x482faf[_0x094c('0x5d')]({'attributes':['id'],'raw':!![]})[_0x094c('0x27')](function(_0x257508){var _0x2dfe1c=_['map'](_0x257508,'id');_0xe0c3d9(_0x2dfe1c);});})[_0x094c('0x53')](function(_0x291649){_0x2240a1(_0x291649);});});} \ No newline at end of file +var _0x661a=['sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','sendUserNotification','hasOwnProperty','text','body','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','chatqueue','faxqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sequelize','UserNotification','create','forEach','recipient','emit','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userNotification.socket'];(function(_0x2b4b3d,_0x3fef9b){var _0x5799c9=function(_0xfd6612){while(--_0xfd6612){_0x2b4b3d['push'](_0x2b4b3d['shift']());}};_0x5799c9(++_0x3fef9b);}(_0x661a,0x151));var _0xa661=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x661a[_0x41382c];return _0x4da35b;};'use strict';var emlformat=require(_0xa661('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa661('0x1'));var jsonpatch=require(_0xa661('0x2'));var rp=require('request-promise');var moment=require(_0xa661('0x3'));var BPromise=require(_0xa661('0x4'));var Mustache=require(_0xa661('0x5'));var util=require('util');var path=require(_0xa661('0x6'));var sox=require('sox');var csv=require(_0xa661('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa661('0x8'));var squel=require('squel');var crypto=require(_0xa661('0x9'));var jsforce=require(_0xa661('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa661('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa661('0xb'));var qs=require(_0xa661('0xc'));var as=require(_0xa661('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa661('0xe'))(_0xa661('0xf'));var utils=require(_0xa661('0x10'));var config=require(_0xa661('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa661('0x12')]=_[_0xa661('0x13')](config[_0xa661('0x12')],{'host':_0xa661('0x14'),'port':0x18eb});var socket=require(_0xa661('0x15'))(new Redis(config['redis']));require(_0xa661('0x16'))['register'](socket);function respondWithStatusCode(_0x2b1f28,_0x333472){_0x333472=_0x333472||0xcc;return function(_0x66375d){if(_0x66375d){return _0x2b1f28[_0xa661('0x17')](_0x333472);}return _0x2b1f28[_0xa661('0x18')](_0x333472)['end']();};}function respondWithResult(_0x4668c1,_0x37a30a){_0x37a30a=_0x37a30a||0xc8;return function(_0x4bd866){if(_0x4bd866){return _0x4668c1[_0xa661('0x18')](_0x37a30a)[_0xa661('0x19')](_0x4bd866);}};}function respondWithFilteredResult(_0x2d9016,_0x27066f){return function(_0x42489b){if(_0x42489b){var _0x43abad=typeof _0x27066f[_0xa661('0x1a')]==='undefined'&&typeof _0x27066f[_0xa661('0x1b')]==='undefined';var _0x4de973=_0x42489b[_0xa661('0x1c')];var _0xd367e8=_0x43abad?0x0:_0x27066f[_0xa661('0x1a')];var _0x12f43b=_0x43abad?_0x42489b['count']:_0x27066f[_0xa661('0x1a')]+_0x27066f[_0xa661('0x1b')];var _0x3dd58c;if(_0x12f43b>=_0x4de973){_0x12f43b=_0x4de973;_0x3dd58c=0xc8;}else{_0x3dd58c=0xce;}_0x2d9016['status'](_0x3dd58c);return _0x2d9016[_0xa661('0x1d')](_0xa661('0x1e'),_0xd367e8+'-'+_0x12f43b+'/'+_0x4de973)['json'](_0x42489b);}return null;};}function patchUpdates(_0x5a17c6){return function(_0x58d17c){try{jsonpatch[_0xa661('0x1f')](_0x58d17c,_0x5a17c6,!![]);}catch(_0x14ca92){return BPromise[_0xa661('0x20')](_0x14ca92);}return _0x58d17c[_0xa661('0x21')]();};}function saveUpdates(_0x3efc6c,_0x1d3a12){return function(_0x17f7bc){if(_0x17f7bc){return _0x17f7bc[_0xa661('0x22')](_0x3efc6c)[_0xa661('0x23')](function(_0x445cb3){return _0x445cb3;});}return null;};}function removeEntity(_0x243675,_0x2c6db6){return function(_0x3a6ca2){if(_0x3a6ca2){return _0x3a6ca2[_0xa661('0x24')]()[_0xa661('0x23')](function(){_0x243675[_0xa661('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23dc9b,_0x9141a){return function(_0x39efcf){if(!_0x39efcf){_0x23dc9b['sendStatus'](0x194);}return _0x39efcf;};}function handleError(_0x28c7f7,_0x53083b){_0x53083b=_0x53083b||0x1f4;return function(_0x285b95){logger[_0xa661('0x25')](_0x285b95[_0xa661('0x26')]);if(_0x285b95[_0xa661('0x27')]){delete _0x285b95['name'];}_0x28c7f7[_0xa661('0x18')](_0x53083b)['send'](_0x285b95);};}exports[_0xa661('0x28')]=function(_0x34b0ff,_0x314f3f,_0x5d9d22){if(!_0x34b0ff['body'][_0xa661('0x29')](_0xa661('0x2a'))&&!_0x34b0ff[_0xa661('0x2b')][_0xa661('0x29')](_0xa661('0x2c'))){throw new db[(_0xa661('0x2d'))][(_0xa661('0x2e'))](_0xa661('0x2f'));}else{if(_0x34b0ff[_0xa661('0x2b')][_0xa661('0x29')](_0xa661('0x2c'))&&!_0x34b0ff[_0xa661('0x2b')][_0xa661('0x29')](_0xa661('0x30'))){throw new db[(_0xa661('0x2d'))][(_0xa661('0x2e'))](_0xa661('0x31'));}if(!_0x34b0ff['body'][_0xa661('0x29')](_0xa661('0x32'))){throw new db[(_0xa661('0x2d'))]['ValidationError'](_0xa661('0x33'));}else{try{var _0x2f3a30=JSON[_0xa661('0x34')](_0x34b0ff[_0xa661('0x2b')][_0xa661('0x32')]);}catch(_0x524984){logger['error'](_0x524984);throw new db[(_0xa661('0x2d'))][(_0xa661('0x2e'))](_0xa661('0x35'));}var _0x5e9a1c=[_0xa661('0x36'),_0xa661('0x37'),'mailqueue','openchannelqueue',_0xa661('0x38'),'voicequeue',_0xa661('0x39'),_0xa661('0x3a'),_0xa661('0x3b')];if(_[_0xa661('0x3c')](_0x2f3a30,function(_0x44ac42){return!_[_0xa661('0x3d')](_0x5e9a1c,_0x44ac42[_0xa661('0x3e')][_0xa661('0x3f')]());})){throw new db['Sequelize']['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x46002e={};_0x46002e[_0xa661('0x40')]=_0x34b0ff[_0xa661('0x2b')][_0xa661('0x29')](_0xa661('0x40'))?_0x34b0ff[_0xa661('0x2b')]['senderName']:_0x34b0ff[_0xa661('0x3b')][_0xa661('0x41')];_0x46002e[_0xa661('0x42')]=_[_0xa661('0x43')](_0x34b0ff[_0xa661('0x2b')][_0xa661('0x42')])?null:_0x34b0ff[_0xa661('0x2b')][_0xa661('0x42')];_0x46002e[_0xa661('0x44')]=_0x34b0ff[_0xa661('0x2b')][_0xa661('0x44')]||![];_0x46002e[_0xa661('0x45')]=_0x34b0ff[_0xa661('0x3b')]['id'];return getContent(_0x34b0ff['body'])[_0xa661('0x23')](function(_0x4ca2b4){_0x46002e[_0xa661('0x2b')]=_0x4ca2b4;return getRecipients(_0x2f3a30);})[_0xa661('0x23')](function(_0x509444){_0x46002e[_0xa661('0x46')]=_['sortBy'](_0x509444)['join'](',');return db[_0xa661('0x47')]['transaction'](function(_0x5b115a){return db[_0xa661('0x48')][_0xa661('0x49')](_0x46002e,{'raw':!![],'transaction':_0x5b115a})['then'](function(_0xc27c2b){var _0xc0e190={'sender':_0x46002e[_0xa661('0x40')],'description':_0x46002e[_0xa661('0x42')],'content':_0x46002e[_0xa661('0x2b')],'beep':_0x46002e[_0xa661('0x44')]};_0x509444[_0xa661('0x4a')](function(_0x469601){_0xc0e190[_0xa661('0x4b')]=_0x469601;socket[_0xa661('0x4c')]('userNotification:send',_0xc0e190);});return _0xc27c2b;});});})[_0xa661('0x23')](respondWithResult(_0x314f3f,0xc9))[_0xa661('0x4d')](handleError(_0x314f3f,null));};function getContent(_0xec61a5){return new BPromise(function(_0x5aa9bb,_0x9b869){if(_0xec61a5[_0xa661('0x2a')]){_0x5aa9bb(_0xec61a5[_0xa661('0x2a')]);return;}return db['Template'][_0xa661('0x4e')]({'attributes':['html'],'where':{'id':_0xec61a5[_0xa661('0x2c')]},'raw':!![]})[_0xa661('0x23')](function(_0x242fd3){if(!_0x242fd3)throw new db[(_0xa661('0x2d'))][(_0xa661('0x2e'))](_0xa661('0x4f'));var _0x3b8d2b=Mustache[_0xa661('0x50')](_0x242fd3['html'],_0xec61a5[_0xa661('0x30')]);_0x5aa9bb(_0x3b8d2b);})[_0xa661('0x4d')](function(_0x315b51){_0x9b869(_0x315b51);});});}function getRecipients(_0x2b3dff){return new BPromise(function(_0x26813d,_0x4037b3){var _0x435517=[];var _0x37a40c=[];_0x2b3dff['forEach'](function(_0x49c45a){var _0x3c167e=_['startCase'](_0x49c45a[_0xa661('0x3e')][_0xa661('0x3f')]());if(_0x3c167e==='User'){_0x435517=_['union'](_0x435517,_0x49c45a[_0xa661('0x51')]);}else{if(_[_0xa661('0x3d')](_0x3c167e,_0xa661('0x52')))_0x3c167e=_0x3c167e[_0xa661('0x53')](_0xa661('0x52'),_0xa661('0x54'));_0x49c45a[_0xa661('0x51')][_0xa661('0x4a')](function(_0x17b4a8){_0x37a40c[_0xa661('0x55')](getAgents(_0x3c167e,_0x17b4a8));});}});return BPromise[_0xa661('0x56')](_0x37a40c)[_0xa661('0x23')](function(_0x37a05f){_0x435517=_['union'](_0x435517,_[_0xa661('0x57')](_0x37a05f));_0x26813d(_0x435517);})[_0xa661('0x4d')](function(_0x4a670e){_0x4037b3(_0x4a670e);});});}function getAgents(_0x55712a,_0x3a97c6){return new BPromise(function(_0x3e6734,_0x4c2c7d){return db[_0x55712a][_0xa661('0x4e')]({'where':{'id':_0x3a97c6}})[_0xa661('0x23')](function(_0x4726cb){return _0x4726cb[_0xa661('0x58')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2ec612){var _0x320327=_[_0xa661('0x59')](_0x2ec612,'id');_0x3e6734(_0x320327);});})[_0xa661('0x4d')](function(_0x3208dd){_0x4c2c7d(_0x3208dd);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e1ccfcb..a8b651c 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 _0x8503=['save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x8503,0x137));var _0x3850=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x8503[_0x32d457];return _0x338386;};'use strict';var EventEmitter=require(_0x3850('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3850('0x1'),'afterUpdate':_0x3850('0x2'),'afterDestroy':_0x3850('0x3')};function emitEvent(_0x4ccc68){return function(_0x38e99f,_0x4d9c75,_0x3060d3){UserNotificationEvents[_0x3850('0x4')](_0x4ccc68+':'+_0x38e99f['id'],_0x38e99f);UserNotificationEvents[_0x3850('0x4')](_0x4ccc68,_0x38e99f);_0x3060d3(null);};}for(var e in events){if(events[_0x3850('0x5')](e)){var event=events[e];UserNotification[_0x3850('0x6')](e,emitEvent(event));}}module[_0x3850('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x19e8=['hook','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x11fa6d,_0x2aba36){var _0x503048=function(_0x3b2336){while(--_0x3b2336){_0x11fa6d['push'](_0x11fa6d['shift']());}};_0x503048(++_0x2aba36);}(_0x19e8,0x172));var _0x819e=function(_0x43f029,_0x2b0e14){_0x43f029=_0x43f029-0x0;var _0x6f717=_0x19e8[_0x43f029];return _0x6f717;};'use strict';var EventEmitter=require(_0x819e('0x0'));var UserNotification=require(_0x819e('0x1'))['db'][_0x819e('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x819e('0x3')](0x0);var events={'afterCreate':_0x819e('0x4'),'afterUpdate':_0x819e('0x5'),'afterDestroy':_0x819e('0x6')};function emitEvent(_0xf47f19){return function(_0x34d050,_0xe018c2,_0x3ae52a){UserNotificationEvents['emit'](_0xf47f19+':'+_0x34d050['id'],_0x34d050);UserNotificationEvents['emit'](_0xf47f19,_0x34d050);_0x3ae52a(null);};}for(var e in events){if(events[_0x819e('0x7')](e)){var event=events[e];UserNotification[_0x819e('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 2153ec8..47ee871 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 _0xad5a=['./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x7f7d0d,_0x376ff8){var _0x218fb5=function(_0x14de1e){while(--_0x14de1e){_0x7f7d0d['push'](_0x7f7d0d['shift']());}};_0x218fb5(++_0x376ff8);}(_0xad5a,0x10a));var _0xaad5=function(_0x3d5ee2,_0x38df1f){_0x3d5ee2=_0x3d5ee2-0x0;var _0x2f457d=_0xad5a[_0x3d5ee2];return _0x2f457d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaad5('0x0'))(_0xaad5('0x1'));var moment=require(_0xaad5('0x2'));var BPromise=require(_0xaad5('0x3'));var rp=require(_0xaad5('0x4'));var fs=require('fs');var path=require(_0xaad5('0x5'));var rimraf=require('rimraf');var config=require(_0xaad5('0x6'));var attributes=require(_0xaad5('0x7'));module[_0xaad5('0x8')]=function(_0x3fbc3d,_0x13effd){return _0x3fbc3d[_0xaad5('0x9')](_0xaad5('0xa'),attributes,{'tableName':_0xaad5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaad5('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcd5c=['exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','./userNotification.attributes'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xcd5c,0x180));var _0xccd5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcd5c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xccd5('0x0'));var util=require(_0xccd5('0x1'));var logger=require('../../config/logger')(_0xccd5('0x2'));var moment=require(_0xccd5('0x3'));var BPromise=require(_0xccd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xccd5('0x5'));var rimraf=require(_0xccd5('0x6'));var config=require('../../config/environment');var attributes=require(_0xccd5('0x7'));module[_0xccd5('0x8')]=function(_0x1e8697,_0x15f485){return _0x1e8697[_0xccd5('0x9')](_0xccd5('0xa'),attributes,{'tableName':_0xccd5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xccd5('0xc'),'collate':_0xccd5('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 19f1c0e..305d178 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 _0x0b96=['UserNotification,\x20%s,\x20%s,\x20%s','error','UserNotification,\x20%s,\x20%s','message','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userNotification.socket','register','request','then','request\x20sent','debug'];(function(_0x3ab58d,_0x5f0154){var _0x278eff=function(_0x895412){while(--_0x895412){_0x3ab58d['push'](_0x3ab58d['shift']());}};_0x278eff(++_0x5f0154);}(_0x0b96,0xeb));var _0x60b9=function(_0x12e6e5,_0x39855b){_0x12e6e5=_0x12e6e5-0x0;var _0x4ef6ce=_0x0b96[_0x12e6e5];return _0x4ef6ce;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x60b9('0x0'));var fs=require('fs');var Redis=require(_0x60b9('0x1'));var db=require(_0x60b9('0x2'))['db'];var utils=require(_0x60b9('0x3'));var logger=require(_0x60b9('0x4'))(_0x60b9('0x5'));var config=require(_0x60b9('0x6'));var jayson=require(_0x60b9('0x7'));var client=jayson[_0x60b9('0x8')]['http']({'port':0x232a});config[_0x60b9('0x9')]=_[_0x60b9('0xa')](config[_0x60b9('0x9')],{'host':_0x60b9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x60b9('0x9')]));require(_0x60b9('0xc'))[_0x60b9('0xd')](socket);function respondWithRpcPromise(_0x1af214,_0x3abb70,_0x1fe9df){return new BPromise(function(_0x4acb50,_0x8d8200){return client[_0x60b9('0xe')](_0x1af214,_0x1fe9df)[_0x60b9('0xf')](function(_0x32e85a){logger['info']('UserNotification,\x20%s,\x20%s',_0x3abb70,_0x60b9('0x10'));logger[_0x60b9('0x11')](_0x60b9('0x12'),_0x3abb70,'request\x20sent',JSON['stringify'](_0x32e85a));if(_0x32e85a[_0x60b9('0x13')]){if(_0x32e85a[_0x60b9('0x13')]['code']===0x1f4){logger[_0x60b9('0x13')](_0x60b9('0x14'),_0x3abb70,_0x32e85a[_0x60b9('0x13')][_0x60b9('0x15')]);return _0x8d8200(_0x32e85a['error'][_0x60b9('0x15')]);}logger[_0x60b9('0x13')](_0x60b9('0x14'),_0x3abb70,_0x32e85a[_0x60b9('0x13')][_0x60b9('0x15')]);return _0x4acb50(_0x32e85a[_0x60b9('0x13')]['message']);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x3abb70,'request\x20sent');_0x4acb50(_0x32e85a['result'][_0x60b9('0x15')]);}})[_0x60b9('0x16')](function(_0x8f476c){logger[_0x60b9('0x13')](_0x60b9('0x14'),_0x3abb70,_0x8f476c);_0x8d8200(_0x8f476c);});});} \ No newline at end of file +var _0xf86c=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf86c,0x1cd));var _0xcf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf86('0x0'));var util=require(_0xcf86('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcf86('0x2'));var fs=require('fs');var Redis=require(_0xcf86('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf86('0x4'));var logger=require(_0xcf86('0x5'))(_0xcf86('0x6'));var config=require(_0xcf86('0x7'));var jayson=require(_0xcf86('0x8'));var client=jayson[_0xcf86('0x9')][_0xcf86('0xa')]({'port':0x232a});config[_0xcf86('0xb')]=_['defaults'](config[_0xcf86('0xb')],{'host':_0xcf86('0xc'),'port':0x18eb});var socket=require(_0xcf86('0xd'))(new Redis(config[_0xcf86('0xb')]));require(_0xcf86('0xe'))[_0xcf86('0xf')](socket);function respondWithRpcPromise(_0x5e95ca,_0x38c6f8,_0x480a54){return new BPromise(function(_0xeaf8f6,_0x52027c){return client['request'](_0x5e95ca,_0x480a54)[_0xcf86('0x10')](function(_0x23943d){logger[_0xcf86('0x11')](_0xcf86('0x12'),_0x38c6f8,'request\x20sent');logger[_0xcf86('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x38c6f8,'request\x20sent',JSON[_0xcf86('0x14')](_0x23943d));if(_0x23943d['error']){if(_0x23943d[_0xcf86('0x15')]['code']===0x1f4){logger['error'](_0xcf86('0x12'),_0x38c6f8,_0x23943d[_0xcf86('0x15')][_0xcf86('0x16')]);return _0x52027c(_0x23943d[_0xcf86('0x15')][_0xcf86('0x16')]);}logger[_0xcf86('0x15')](_0xcf86('0x12'),_0x38c6f8,_0x23943d[_0xcf86('0x15')][_0xcf86('0x16')]);return _0xeaf8f6(_0x23943d[_0xcf86('0x15')][_0xcf86('0x16')]);}else{logger[_0xcf86('0x11')]('UserNotification,\x20%s,\x20%s',_0x38c6f8,_0xcf86('0x17'));_0xeaf8f6(_0x23943d[_0xcf86('0x18')][_0xcf86('0x16')]);}})[_0xcf86('0x19')](function(_0x4f55cf){logger[_0xcf86('0x15')]('UserNotification,\x20%s,\x20%s',_0x38c6f8,_0x4f55cf);_0x52027c(_0x4f55cf);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 2afc78c..9420dc0 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 _0x7608=['removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7608,0x126));var _0x8760=function(_0x302888,_0x1f9501){_0x302888=_0x302888-0x0;var _0x1635a6=_0x7608[_0x302888];return _0x1635a6;};'use strict';var UserNotificationEvents=require(_0x8760('0x0'));var events=['save','remove','update'];function createListener(_0x48139b,_0x3d3d90){return function(_0x1c04d1){_0x3d3d90['emit'](_0x48139b,_0x1c04d1);};}function removeListener(_0x2bd011,_0x1cfc57){return function(){UserNotificationEvents[_0x8760('0x1')](_0x2bd011,_0x1cfc57);};}exports[_0x8760('0x2')]=function(_0x4a60e0){for(var _0x4563ce=0x0,_0x120c07=events[_0x8760('0x3')];_0x4563ce<_0x120c07;_0x4563ce++){var _0x1873bd=events[_0x4563ce];var _0x3497e8=createListener(_0x8760('0x4')+_0x1873bd,_0x4a60e0);UserNotificationEvents['on'](_0x1873bd,_0x3497e8);}}; \ No newline at end of file +var _0x606f=['update','emit','removeListener','register','length','userNotification:','./userNotification.events','remove'];(function(_0x8afa5e,_0x14ec22){var _0x2faa2c=function(_0x26ba3c){while(--_0x26ba3c){_0x8afa5e['push'](_0x8afa5e['shift']());}};_0x2faa2c(++_0x14ec22);}(_0x606f,0x14e));var _0xf606=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x606f[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0xf606('0x0'));var events=['save',_0xf606('0x1'),_0xf606('0x2')];function createListener(_0x2877b2,_0x4e6795){return function(_0x386ce8){_0x4e6795[_0xf606('0x3')](_0x2877b2,_0x386ce8);};}function removeListener(_0x3582e1,_0x12b8f6){return function(){UserNotificationEvents[_0xf606('0x4')](_0x3582e1,_0x12b8f6);};}exports[_0xf606('0x5')]=function(_0x31f7bc){for(var _0x19e640=0x0,_0x246a1a=events[_0xf606('0x6')];_0x19e640<_0x246a1a;_0x19e640++){var _0x5ba26b=events[_0x19e640];var _0x82ace9=createListener(_0xf606('0x7')+_0x5ba26b,_0x31f7bc);UserNotificationEvents['on'](_0x5ba26b,_0x82ace9);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 52ff4da..70dd37d 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(_0x4064b3,_0x40fd3a){var _0x407892=function(_0x48dc72){while(--_0x48dc72){_0x4064b3['push'](_0x4064b3['shift']());}};_0x407892(++_0x40fd3a);}(_0x70e0,0x17b));var _0x070e=function(_0x4dede6,_0x1a38a0){_0x4dede6=_0x4dede6-0x0;var _0x4b6e50=_0x70e0[_0x4dede6];return _0x4b6e50;};'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(_0x2a6098,_0x38ad54){var _0x5dbd26=function(_0x3e778c){while(--_0x3e778c){_0x2a6098['push'](_0x2a6098['shift']());}};_0x5dbd26(++_0x38ad54);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index d5543f3..f5342d5 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 _0xc261=['INTEGER','exports'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xc261,0x1b7));var _0x1c26=function(_0x3332a8,_0x3b802f){_0x3332a8=_0x3332a8-0x0;var _0x2b2b37=_0xc261[_0x3332a8];return _0x2b2b37;};'use strict';var Sequelize=require('sequelize');module[_0x1c26('0x0')]={'penalty':{'type':Sequelize[_0x1c26('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0799=['exports','sequelize'];(function(_0x13ded6,_0x3ea4b4){var _0x3fe732=function(_0xd5c512){while(--_0xd5c512){_0x13ded6['push'](_0x13ded6['shift']());}};_0x3fe732(++_0x3ea4b4);}(_0x0799,0x125));var _0x9079=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x0799[_0x5bd4f6];return _0x33a165;};'use strict';var Sequelize=require(_0x9079('0x0'));module[_0x9079('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 53ae8ce..1ddb02e 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 _0xa74c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash'];(function(_0x1ed06f,_0x4a2585){var _0x58e0f1=function(_0x19d06e){while(--_0x19d06e){_0x1ed06f['push'](_0x1ed06f['shift']());}};_0x58e0f1(++_0x4a2585);}(_0xa74c,0xd1));var _0xca74=function(_0xb3f12b,_0x40e1e8){_0xb3f12b=_0xb3f12b-0x0;var _0x50e42f=_0xa74c[_0xb3f12b];return _0x50e42f;};'use strict';var _=require(_0xca74('0x0'));var util=require(_0xca74('0x1'));var logger=require(_0xca74('0x2'))(_0xca74('0x3'));var moment=require(_0xca74('0x4'));var BPromise=require(_0xca74('0x5'));var rp=require(_0xca74('0x6'));var fs=require('fs');var path=require(_0xca74('0x7'));var rimraf=require(_0xca74('0x8'));var config=require(_0xca74('0x9'));var attributes=require(_0xca74('0xa'));module[_0xca74('0xb')]=function(_0x567bce,_0x5c0e2e){return _0x567bce[_0xca74('0xc')](_0xca74('0xd'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ad2=['../../config/logger','api','path','../../config/environment','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x3170b2,_0x4770ca){var _0xb9428b=function(_0xc420c1){while(--_0xc420c1){_0x3170b2['push'](_0x3170b2['shift']());}};_0xb9428b(++_0x4770ca);}(_0x0ad2,0x1df));var _0x20ad=function(_0x1bd5d8,_0x1657ac){_0x1bd5d8=_0x1bd5d8-0x0;var _0x2b36be=_0x0ad2[_0x1bd5d8];return _0x2b36be;};'use strict';var _=require(_0x20ad('0x0'));var util=require('util');var logger=require(_0x20ad('0x1'))(_0x20ad('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x20ad('0x3'));var rimraf=require('rimraf');var config=require(_0x20ad('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x59662c,_0x347cbc){return _0x59662c[_0x20ad('0x5')](_0x20ad('0x6'),attributes,{'tableName':_0x20ad('0x7'),'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 fa6566a..23cc4a8 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 _0xbd26=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0x54ff89,_0x96c75){var _0x1e4353=function(_0xb2800c){while(--_0xb2800c){_0x54ff89['push'](_0x54ff89['shift']());}};_0x1e4353(++_0x96c75);}(_0xbd26,0xce));var _0x6bd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd26[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6bd2('0x0'));var util=require(_0x6bd2('0x1'));var moment=require('moment');var BPromise=require(_0x6bd2('0x2'));var rs=require(_0x6bd2('0x3'));var fs=require('fs');var Redis=require(_0x6bd2('0x4'));var db=require(_0x6bd2('0x5'))['db'];var utils=require(_0x6bd2('0x6'));var logger=require(_0x6bd2('0x7'))(_0x6bd2('0x8'));var config=require('../../config/environment');var jayson=require(_0x6bd2('0x9'));var client=jayson[_0x6bd2('0xa')][_0x6bd2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d6d78,_0x491999,_0x5dceae){return new BPromise(function(_0x20cda3,_0x1ffde6){return client[_0x6bd2('0xc')](_0x1d6d78,_0x5dceae)[_0x6bd2('0xd')](function(_0x38ad98){logger[_0x6bd2('0xe')](_0x6bd2('0xf'),_0x491999,_0x6bd2('0x10'));logger[_0x6bd2('0x11')](_0x6bd2('0x12'),_0x491999,_0x6bd2('0x10'),JSON['stringify'](_0x38ad98));if(_0x38ad98['error']){if(_0x38ad98[_0x6bd2('0x13')][_0x6bd2('0x14')]===0x1f4){logger[_0x6bd2('0x13')](_0x6bd2('0xf'),_0x491999,_0x38ad98[_0x6bd2('0x13')]['message']);return _0x1ffde6(_0x38ad98[_0x6bd2('0x13')][_0x6bd2('0x15')]);}logger[_0x6bd2('0x13')](_0x6bd2('0xf'),_0x491999,_0x38ad98[_0x6bd2('0x13')][_0x6bd2('0x15')]);return _0x20cda3(_0x38ad98['error'][_0x6bd2('0x15')]);}else{logger[_0x6bd2('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x491999,_0x6bd2('0x10'));_0x20cda3(_0x38ad98['result'][_0x6bd2('0x15')]);}})[_0x6bd2('0x16')](function(_0x1fd496){logger[_0x6bd2('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x491999,_0x1fd496);_0x1ffde6(_0x1fd496);});});} \ No newline at end of file +var _0x5e67=['client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5e5bc2,_0x3626e2){var _0x43b897=function(_0x5ecb55){while(--_0x5ecb55){_0x5e5bc2['push'](_0x5e5bc2['shift']());}};_0x43b897(++_0x3626e2);}(_0x5e67,0x1db));var _0x75e6=function(_0x280dda,_0x327567){_0x280dda=_0x280dda-0x0;var _0x3a7704=_0x5e67[_0x280dda];return _0x3a7704;};'use strict';var _=require('lodash');var util=require(_0x75e6('0x0'));var moment=require('moment');var BPromise=require(_0x75e6('0x1'));var rs=require(_0x75e6('0x2'));var fs=require('fs');var Redis=require(_0x75e6('0x3'));var db=require(_0x75e6('0x4'))['db'];var utils=require(_0x75e6('0x5'));var logger=require(_0x75e6('0x6'))('rpc');var config=require(_0x75e6('0x7'));var jayson=require(_0x75e6('0x8'));var client=jayson[_0x75e6('0x9')][_0x75e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24e7d,_0x31f560,_0x4ecb85){return new BPromise(function(_0x12e28b,_0x42c5db){return client['request'](_0x24e7d,_0x4ecb85)[_0x75e6('0xb')](function(_0x45322d){logger[_0x75e6('0xc')](_0x75e6('0xd'),_0x31f560,_0x75e6('0xe'));logger[_0x75e6('0xf')](_0x75e6('0x10'),_0x31f560,_0x75e6('0xe'),JSON[_0x75e6('0x11')](_0x45322d));if(_0x45322d[_0x75e6('0x12')]){if(_0x45322d[_0x75e6('0x12')][_0x75e6('0x13')]===0x1f4){logger['error'](_0x75e6('0xd'),_0x31f560,_0x45322d['error'][_0x75e6('0x14')]);return _0x42c5db(_0x45322d[_0x75e6('0x12')]['message']);}logger['error'](_0x75e6('0xd'),_0x31f560,_0x45322d[_0x75e6('0x12')][_0x75e6('0x14')]);return _0x12e28b(_0x45322d[_0x75e6('0x12')][_0x75e6('0x14')]);}else{logger['info'](_0x75e6('0xd'),_0x31f560,_0x75e6('0xe'));_0x12e28b(_0x45322d[_0x75e6('0x15')][_0x75e6('0x14')]);}})['catch'](function(_0x307c4a){logger[_0x75e6('0x12')](_0x75e6('0xd'),_0x31f560,_0x307c4a);_0x42c5db(_0x307c4a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e51d331..c6e4722 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 _0xd218=['get','isAuthenticated','describe','/:id','show','getSections','post','clone','addSections','/:id/resources','addResources','put','delete','/:id/sections','removeSections','removeResources','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller'];(function(_0x1c04a3,_0x1d1bc){var _0x185c03=function(_0x1049d6){while(--_0x1049d6){_0x1c04a3['push'](_0x1c04a3['shift']());}};_0x185c03(++_0x1d1bc);}(_0xd218,0x11f));var _0x8d21=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xd218[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x8d21('0x0'));var util=require(_0x8d21('0x1'));var path=require(_0x8d21('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d21('0x3'));var router=express[_0x8d21('0x4')]();var fs_extra=require(_0x8d21('0x5'));var auth=require(_0x8d21('0x6'));var interaction=require(_0x8d21('0x7'));var config=require(_0x8d21('0x8'));var controller=require(_0x8d21('0x9'));router[_0x8d21('0xa')]('/',auth[_0x8d21('0xb')](),controller['index']);router['get']('/describe',auth[_0x8d21('0xb')](),controller[_0x8d21('0xc')]);router[_0x8d21('0xa')](_0x8d21('0xd'),auth['isAuthenticated'](),controller[_0x8d21('0xe')]);router['get']('/:id/sections',auth[_0x8d21('0xb')](),controller[_0x8d21('0xf')]);router[_0x8d21('0xa')]('/:id/resources',auth[_0x8d21('0xb')](),controller['getResources']);router[_0x8d21('0x10')]('/',auth[_0x8d21('0xb')](),controller['create']);router[_0x8d21('0x10')]('/:id/clone',auth[_0x8d21('0xb')](),controller[_0x8d21('0x11')]);router[_0x8d21('0x10')]('/:id/sections',auth['isAuthenticated'](),controller[_0x8d21('0x12')]);router[_0x8d21('0x10')](_0x8d21('0x13'),auth[_0x8d21('0xb')](),controller[_0x8d21('0x14')]);router[_0x8d21('0x15')]('/:id',auth[_0x8d21('0xb')](),controller['update']);router[_0x8d21('0x16')](_0x8d21('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x8d21('0x16')](_0x8d21('0x17'),auth['isAuthenticated'](),controller[_0x8d21('0x18')]);router[_0x8d21('0x16')]('/:id/resources',auth[_0x8d21('0xb')](),controller[_0x8d21('0x19')]);module[_0x8d21('0x1a')]=router; \ No newline at end of file +var _0x06c8=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','getResources','create','post','/:id/clone','clone','addSections','addResources','put','destroy','delete','removeSections','/:id/resources','removeResources','exports','connect-timeout'];(function(_0x46708d,_0x1f377a){var _0x4c3d9c=function(_0x47b929){while(--_0x47b929){_0x46708d['push'](_0x46708d['shift']());}};_0x4c3d9c(++_0x1f377a);}(_0x06c8,0x90));var _0x806c=function(_0x5c4d30,_0x2bc47a){_0x5c4d30=_0x5c4d30-0x0;var _0x120851=_0x06c8[_0x5c4d30];return _0x120851;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x806c('0x0'));var express=require(_0x806c('0x1'));var router=express[_0x806c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x806c('0x3'));var interaction=require(_0x806c('0x4'));var config=require(_0x806c('0x5'));var controller=require(_0x806c('0x6'));router[_0x806c('0x7')]('/',auth[_0x806c('0x8')](),controller[_0x806c('0x9')]);router['get']('/describe',auth[_0x806c('0x8')](),controller[_0x806c('0xa')]);router[_0x806c('0x7')](_0x806c('0xb'),auth['isAuthenticated'](),controller[_0x806c('0xc')]);router[_0x806c('0x7')](_0x806c('0xd'),auth[_0x806c('0x8')](),controller[_0x806c('0xe')]);router[_0x806c('0x7')]('/:id/resources',auth['isAuthenticated'](),controller[_0x806c('0xf')]);router['post']('/',auth[_0x806c('0x8')](),controller[_0x806c('0x10')]);router[_0x806c('0x11')](_0x806c('0x12'),auth[_0x806c('0x8')](),controller[_0x806c('0x13')]);router[_0x806c('0x11')](_0x806c('0xd'),auth[_0x806c('0x8')](),controller[_0x806c('0x14')]);router[_0x806c('0x11')]('/:id/resources',auth[_0x806c('0x8')](),controller[_0x806c('0x15')]);router[_0x806c('0x16')](_0x806c('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x806c('0xb'),auth[_0x806c('0x8')](),controller[_0x806c('0x17')]);router[_0x806c('0x18')](_0x806c('0xd'),auth[_0x806c('0x8')](),controller[_0x806c('0x19')]);router['delete'](_0x806c('0x1a'),auth[_0x806c('0x8')](),controller[_0x806c('0x1b')]);module[_0x806c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 47c4c79..38c3a5e 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 _0x4e9b=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions','getDataValue','split'];(function(_0x28888c,_0x426db0){var _0x176462=function(_0x593fb1){while(--_0x593fb1){_0x28888c['push'](_0x28888c['shift']());}};_0x176462(++_0x426db0);}(_0x4e9b,0x1e7));var _0xb4e9=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x4e9b[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require(_0xb4e9('0x0'));module[_0xb4e9('0x1')]={'name':{'type':Sequelize[_0xb4e9('0x2')],'allowNull':![],'unique':_0xb4e9('0x3')},'crudPermissions':{'type':Sequelize[_0xb4e9('0x2')],'set':function(_0x159cec){this[_0xb4e9('0x4')](_0xb4e9('0x5'),_0x159cec?_0x159cec['join'](''):[]);},'get':function(){return this[_0xb4e9('0x6')](_0xb4e9('0x5'))?this['getDataValue'](_0xb4e9('0x5'))[_0xb4e9('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb4e9('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb4e9('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb4e9('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb4e9('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb4e9('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb4e9('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb4e9('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb4e9('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb4e9('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaeb3=['crudPermissions','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING','setDataValue'];(function(_0xcef38e,_0x42902d){var _0x6019b8=function(_0xa3f9f9){while(--_0xa3f9f9){_0xcef38e['push'](_0xcef38e['shift']());}};_0x6019b8(++_0x42902d);}(_0xaeb3,0x1bd));var _0x3aeb=function(_0xe4e6c6,_0x45a683){_0xe4e6c6=_0xe4e6c6-0x0;var _0x175b25=_0xaeb3[_0xe4e6c6];return _0x175b25;};'use strict';var Sequelize=require(_0x3aeb('0x0'));module[_0x3aeb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3aeb('0x2')},'crudPermissions':{'type':Sequelize[_0x3aeb('0x3')],'set':function(_0x314452){this[_0x3aeb('0x4')](_0x3aeb('0x5'),_0x314452?_0x314452['join'](''):[]);},'get':function(){return this[_0x3aeb('0x6')](_0x3aeb('0x5'))?this[_0x3aeb('0x6')](_0x3aeb('0x5'))[_0x3aeb('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x3aeb('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x3aeb('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x3aeb('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x3aeb('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x3aeb('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3aeb('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x3aeb('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 60d3eef..9417417 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 _0xb790=['getResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','end','error','name','send','map','UserProfile','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','removeSections','ids','getSections','enabled','includes','sectionId','isEmpty','subsections','concat','push','findOne','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb790,0xe5));var _0x0b79=function(_0x10aa73,_0xc744f4){_0x10aa73=_0x10aa73-0x0;var _0x3496d9=_0xb790[_0x10aa73];return _0x3496d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b79('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b79('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0b79('0x2'));var path=require(_0x0b79('0x3'));var sox=require('sox');var csv=require(_0x0b79('0x4'));var ejs=require(_0x0b79('0x5'));var fs=require('fs');var fs_extra=require(_0x0b79('0x6'));var _=require(_0x0b79('0x7'));var squel=require(_0x0b79('0x8'));var crypto=require(_0x0b79('0x9'));var jsforce=require(_0x0b79('0xa'));var deskjs=require(_0x0b79('0xb'));var toCsv=require(_0x0b79('0x4'));var querystring=require(_0x0b79('0xc'));var Papa=require(_0x0b79('0xd'));var Redis=require(_0x0b79('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b79('0xf'));var hardwareService=require(_0x0b79('0x10'));var logger=require(_0x0b79('0x11'))(_0x0b79('0x12'));var utils=require(_0x0b79('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0b79('0x14'));var db=require(_0x0b79('0x15'))['db'];config['redis']=_[_0x0b79('0x16')](config[_0x0b79('0x17')],{'host':_0x0b79('0x18'),'port':0x18eb});var socket=require(_0x0b79('0x19'))(new Redis(config['redis']));require(_0x0b79('0x1a'))[_0x0b79('0x1b')](socket);function respondWithStatusCode(_0x162522,_0x39551a){_0x39551a=_0x39551a||0xcc;return function(_0x4cee3e){if(_0x4cee3e){return _0x162522[_0x0b79('0x1c')](_0x39551a);}return _0x162522[_0x0b79('0x1d')](_0x39551a)['end']();};}function respondWithResult(_0x1820fa,_0x23d5c3){_0x23d5c3=_0x23d5c3||0xc8;return function(_0x3f0e27){if(_0x3f0e27){return _0x1820fa[_0x0b79('0x1d')](_0x23d5c3)[_0x0b79('0x1e')](_0x3f0e27);}};}function respondWithFilteredResult(_0x37177d,_0x4f4754){return function(_0x316ebb){if(_0x316ebb){var _0x55bc36=typeof _0x4f4754['offset']==='undefined'&&typeof _0x4f4754[_0x0b79('0x1f')]===_0x0b79('0x20');var _0x23a663=_0x316ebb['count'];var _0x16261a=_0x55bc36?0x0:_0x4f4754['offset'];var _0x1c9b9e=_0x55bc36?_0x316ebb[_0x0b79('0x21')]:_0x4f4754[_0x0b79('0x22')]+_0x4f4754['limit'];var _0x4483db;if(_0x1c9b9e>=_0x23a663){_0x1c9b9e=_0x23a663;_0x4483db=0xc8;}else{_0x4483db=0xce;}_0x37177d[_0x0b79('0x1d')](_0x4483db);return _0x37177d[_0x0b79('0x23')]('Content-Range',_0x16261a+'-'+_0x1c9b9e+'/'+_0x23a663)[_0x0b79('0x1e')](_0x316ebb);}return null;};}function patchUpdates(_0x58901a){return function(_0x5bd229){try{jsonpatch[_0x0b79('0x24')](_0x5bd229,_0x58901a,!![]);}catch(_0x59cd0d){return BPromise[_0x0b79('0x25')](_0x59cd0d);}return _0x5bd229[_0x0b79('0x26')]();};}function saveUpdates(_0x3a04d3,_0x136734){return function(_0x48a2cb){if(_0x48a2cb){return _0x48a2cb[_0x0b79('0x27')](_0x3a04d3)[_0x0b79('0x28')](function(_0x409db2){return _0x409db2;});}return null;};}function removeEntity(_0x553ed1,_0x143ca2){return function(_0x316866){if(_0x316866){return _0x316866[_0x0b79('0x29')]()[_0x0b79('0x28')](function(){_0x553ed1[_0x0b79('0x1d')](0xcc)[_0x0b79('0x2a')]();});}};}function handleEntityNotFound(_0x376bf3,_0x2961ff){return function(_0x1cf7f7){if(!_0x1cf7f7){_0x376bf3['sendStatus'](0x194);}return _0x1cf7f7;};}function handleError(_0x5c9a6e,_0x18c9d1){_0x18c9d1=_0x18c9d1||0x1f4;return function(_0x43291a){logger[_0x0b79('0x2b')](_0x43291a['stack']);if(_0x43291a['name']){delete _0x43291a[_0x0b79('0x2c')];}_0x5c9a6e['status'](_0x18c9d1)[_0x0b79('0x2d')](_0x43291a);};}exports['index']=function(_0x1b72ec,_0x63c8f2){var _0x19971a={},_0x574513={},_0x45d438={'count':0x0,'rows':[]};var _0x4d74cc=_[_0x0b79('0x2e')](db[_0x0b79('0x2f')][_0x0b79('0x30')],function(_0x59f34f){return{'name':_0x59f34f['fieldName'],'type':_0x59f34f[_0x0b79('0x31')][_0x0b79('0x32')]};});_0x574513[_0x0b79('0x33')]=_[_0x0b79('0x2e')](_0x4d74cc,_0x0b79('0x2c'));_0x574513[_0x0b79('0x34')]=_[_0x0b79('0x35')](_0x1b72ec[_0x0b79('0x34')]);_0x574513[_0x0b79('0x36')]=_[_0x0b79('0x37')](_0x574513[_0x0b79('0x33')],_0x574513[_0x0b79('0x34')]);_0x19971a[_0x0b79('0x38')]=_[_0x0b79('0x37')](_0x574513[_0x0b79('0x33')],qs[_0x0b79('0x39')](_0x1b72ec['query']['fields']));_0x19971a[_0x0b79('0x38')]=_0x19971a[_0x0b79('0x38')][_0x0b79('0x3a')]?_0x19971a[_0x0b79('0x38')]:_0x574513[_0x0b79('0x33')];if(!_0x1b72ec[_0x0b79('0x34')][_0x0b79('0x3b')](_0x0b79('0x3c'))){_0x19971a[_0x0b79('0x1f')]=qs['limit'](_0x1b72ec[_0x0b79('0x34')][_0x0b79('0x1f')]);_0x19971a['offset']=qs[_0x0b79('0x22')](_0x1b72ec[_0x0b79('0x34')][_0x0b79('0x22')]);}_0x19971a[_0x0b79('0x3d')]=qs[_0x0b79('0x3e')](_0x1b72ec[_0x0b79('0x34')]['sort']);_0x19971a[_0x0b79('0x3f')]=qs[_0x0b79('0x36')](_[_0x0b79('0x40')](_0x1b72ec[_0x0b79('0x34')],_0x574513[_0x0b79('0x36')]),_0x4d74cc);if(_0x1b72ec['query'][_0x0b79('0x41')]){_0x19971a['where']=_[_0x0b79('0x42')](_0x19971a[_0x0b79('0x3f')],{'$or':_[_0x0b79('0x2e')](_0x4d74cc,function(_0x59e0a6){if(_0x59e0a6['type']!=='VIRTUAL'){var _0x34db3e={};_0x34db3e[_0x59e0a6['name']]={'$like':'%'+_0x1b72ec[_0x0b79('0x34')][_0x0b79('0x41')]+'%'};return _0x34db3e;}})});}_0x19971a=_[_0x0b79('0x42')]({},_0x19971a,_0x1b72ec[_0x0b79('0x43')]);var _0x33509e={'where':_0x19971a[_0x0b79('0x3f')]};return db[_0x0b79('0x2f')]['count'](_0x33509e)[_0x0b79('0x28')](function(_0x38a258){_0x45d438[_0x0b79('0x21')]=_0x38a258;if(_0x1b72ec[_0x0b79('0x34')][_0x0b79('0x44')]){_0x19971a['include']=[{'all':!![]}];}return db[_0x0b79('0x2f')][_0x0b79('0x45')](_0x19971a);})['then'](function(_0x1a8e38){_0x45d438[_0x0b79('0x46')]=_0x1a8e38;return _0x45d438;})['then'](respondWithFilteredResult(_0x63c8f2,_0x19971a))['catch'](handleError(_0x63c8f2,null));};exports[_0x0b79('0x47')]=function(_0x47c4ae,_0x3e94e7){var _0x280155={'raw':![],'where':{'id':_0x47c4ae[_0x0b79('0x48')]['id']}},_0x4b2e69={};_0x4b2e69[_0x0b79('0x33')]=_[_0x0b79('0x35')](db['UserProfile'][_0x0b79('0x30')]);_0x4b2e69[_0x0b79('0x34')]=_[_0x0b79('0x35')](_0x47c4ae[_0x0b79('0x34')]);_0x4b2e69[_0x0b79('0x36')]=_[_0x0b79('0x37')](_0x4b2e69[_0x0b79('0x33')],_0x4b2e69[_0x0b79('0x34')]);_0x280155[_0x0b79('0x38')]=_[_0x0b79('0x37')](_0x4b2e69[_0x0b79('0x33')],qs['fields'](_0x47c4ae['query'][_0x0b79('0x39')]));_0x280155[_0x0b79('0x38')]=_0x280155[_0x0b79('0x38')][_0x0b79('0x3a')]?_0x280155[_0x0b79('0x38')]:_0x4b2e69['model'];if(_0x47c4ae[_0x0b79('0x34')]['includeAll']){_0x280155[_0x0b79('0x49')]=[{'all':!![]}];}_0x280155=_[_0x0b79('0x42')]({},_0x280155,_0x47c4ae[_0x0b79('0x43')]);return db[_0x0b79('0x2f')][_0x0b79('0x4a')](_0x280155)[_0x0b79('0x28')](handleEntityNotFound(_0x3e94e7,null))[_0x0b79('0x28')](respondWithResult(_0x3e94e7,null))[_0x0b79('0x4b')](handleError(_0x3e94e7,null));};exports[_0x0b79('0x4c')]=function(_0x37b5df,_0x362aa4){return db[_0x0b79('0x2f')][_0x0b79('0x4c')](_0x37b5df[_0x0b79('0x4d')],{})[_0x0b79('0x28')](respondWithResult(_0x362aa4,0xc9))[_0x0b79('0x4b')](handleError(_0x362aa4,null));};exports['clone']=function(_0x7d5014,_0x55a884){var _0x374ad1={'where':{'id':_0x7d5014[_0x0b79('0x48')]['id']}},_0x37474b={};_0x37474b['model']=_[_0x0b79('0x35')](db[_0x0b79('0x2f')][_0x0b79('0x30')]);_0x374ad1[_0x0b79('0x38')]=_[_0x0b79('0x37')](_0x37474b[_0x0b79('0x33')],qs[_0x0b79('0x39')](_0x7d5014[_0x0b79('0x34')]['fields']));_0x374ad1[_0x0b79('0x38')]=_0x374ad1[_0x0b79('0x38')][_0x0b79('0x3a')]?_0x374ad1[_0x0b79('0x38')]:_0x37474b[_0x0b79('0x33')];if(_0x7d5014[_0x0b79('0x34')][_0x0b79('0x44')]){_0x374ad1[_0x0b79('0x49')]=[{'all':!![]}];}_0x374ad1=_[_0x0b79('0x42')]({},_0x374ad1,_0x7d5014['options']);return db[_0x0b79('0x2f')]['find'](_0x374ad1)[_0x0b79('0x28')](handleEntityNotFound(_0x55a884,null))[_0x0b79('0x28')](function(_0x51e3e8){if(_0x51e3e8){var _0x37788f=_0x51e3e8[_0x0b79('0x4e')]({'plain':!![]});_0x37788f=qs[_0x0b79('0x4f')](_0x37788f,['id',_0x0b79('0x50'),_0x0b79('0x51'),_0x0b79('0x52')]);_0x7d5014['body']=_['omit'](_0x7d5014[_0x0b79('0x4d')],['id',_0x0b79('0x50'),_0x0b79('0x51')]);return db[_0x0b79('0x53')][_0x0b79('0x54')](function(_0x3227f4){return db[_0x0b79('0x2f')][_0x0b79('0x4c')](_[_0x0b79('0x42')](_0x37788f,_0x7d5014[_0x0b79('0x4d')]),{'include':_0x7d5014['query'][_0x0b79('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x3227f4})[_0x0b79('0x28')](function(_0x34e30b){var _0xdbf162=_0x34e30b['get']({'plain':!![]});return db[_0x0b79('0x55')][_0x0b79('0x45')]({'where':{'userProfileId':_0x7d5014[_0x0b79('0x48')]['id']},'raw':!![]})[_0x0b79('0x28')](function(_0x1287dc){if(_0x1287dc){return BPromise[_0x0b79('0x56')](_0x1287dc,function(_0x2c7dc5){return new BPromise(function(_0xee6c18,_0x28c8e6){if(_0x2c7dc5[_0x0b79('0x57')]===null||_0x2c7dc5[_0x0b79('0x57')]===0x1)_0xee6c18(null);return db[_0x0b79('0x58')][_0x0b79('0x45')]({'where':{'sectionId':_0x2c7dc5['id']},'raw':!![]})[_0x0b79('0x28')](function(_0x25e1b5){var _0x4051b8=_['map'](_0x25e1b5,function(_0x5a9558){return qs['omit'](_0x5a9558,['id',_0x0b79('0x50'),_0x0b79('0x51'),'sectionId']);});_0xee6c18(_0x4051b8);})[_0x0b79('0x4b')](function(_0x4d7cf2){_0x28c8e6(_0x4d7cf2);});})['then'](function(_0x376a79){var _0x5f4d72=qs[_0x0b79('0x4f')](_0x2c7dc5,['id',_0x0b79('0x50'),_0x0b79('0x51')]);_0x5f4d72[_0x0b79('0x59')]=_0xdbf162['id'];if(_0x376a79)_0x5f4d72[_0x0b79('0x5a')]=_0x376a79;return _0x5f4d72;})[_0x0b79('0x28')](function(_0x50c10f){return db['UserProfileSection'][_0x0b79('0x4c')](_0x50c10f,{'include':[{'model':db[_0x0b79('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x3227f4});});})['then'](function(){return _0xdbf162;});}});});});}})['then'](respondWithResult(_0x55a884,0xc9))[_0x0b79('0x4b')](handleError(_0x55a884,null));};exports['update']=function(_0x1d581a,_0x1729f1){if(_0x1d581a[_0x0b79('0x4d')]['id']){delete _0x1d581a[_0x0b79('0x4d')]['id'];}return db[_0x0b79('0x2f')][_0x0b79('0x4a')]({'where':{'id':_0x1d581a[_0x0b79('0x48')]['id']}})[_0x0b79('0x28')](handleEntityNotFound(_0x1729f1,null))['then'](saveUpdates(_0x1d581a[_0x0b79('0x4d')],null))[_0x0b79('0x28')](respondWithResult(_0x1729f1,null))[_0x0b79('0x4b')](handleError(_0x1729f1,null));};exports[_0x0b79('0x29')]=function(_0x1b78e0,_0x151583){return db['UserProfile']['find']({'where':{'id':_0x1b78e0[_0x0b79('0x48')]['id']}})[_0x0b79('0x28')](handleEntityNotFound(_0x151583,null))['then'](removeEntity(_0x151583,null))[_0x0b79('0x4b')](handleError(_0x151583,null));};exports[_0x0b79('0x5b')]=function(_0x354aff,_0x19b9db){return db[_0x0b79('0x2f')][_0x0b79('0x5b')]()[_0x0b79('0x28')](respondWithResult(_0x19b9db,null))[_0x0b79('0x4b')](handleError(_0x19b9db,null));};exports[_0x0b79('0x5c')]=function(_0x27e62b,_0x54ed24){var _0x421969=_0x27e62b[_0x0b79('0x4d')];return db[_0x0b79('0x2f')][_0x0b79('0x4a')]({'where':{'id':_0x27e62b[_0x0b79('0x48')]['id']}})['then'](handleEntityNotFound(_0x54ed24,null))[_0x0b79('0x28')](function(_0x42d0ea){if(_0x42d0ea){return db['sequelize']['transaction'](function(_0x51f547){return db['UserProfileSection'][_0x0b79('0x29')]({'where':{'userProfileId':_0x27e62b[_0x0b79('0x48')]['id'],'sectionId':_['map'](_0x421969,function(_0x3c15f4){return _0x3c15f4['sectionId'];})},'transaction':_0x51f547})[_0x0b79('0x28')](function(){var _0x253f93=_[_0x0b79('0x2e')](_0x421969,function(_0xa5920f){_0xa5920f[_0x0b79('0x59')]=_0x27e62b[_0x0b79('0x48')]['id'];return _0xa5920f;});var _0x4da68d=[];return BPromise[_0x0b79('0x56')](_0x253f93,function(_0x15d331){return db[_0x0b79('0x55')]['create'](_0x15d331,{'include':[{'model':db[_0x0b79('0x58')],'as':_0x0b79('0x5a')}],'raw':!![],'transaction':_0x51f547})[_0x0b79('0x28')](function(_0x17c709){_0x4da68d['push'](_0x17c709[_0x0b79('0x4e')]({'plain':!![]}));});})[_0x0b79('0x28')](function(){return _0x4da68d;});});});}})['then'](function(_0x1dc908){return _0x1dc908;})[_0x0b79('0x28')](respondWithResult(_0x54ed24,null))[_0x0b79('0x4b')](handleError(_0x54ed24,null));};exports[_0x0b79('0x5d')]=function(_0x55599f,_0x296709){var _0x4ef156;return db['UserProfile'][_0x0b79('0x4a')]({'where':{'id':_0x55599f[_0x0b79('0x48')]['id']},'attributes':['id',_0x0b79('0x2c')]})[_0x0b79('0x28')](handleEntityNotFound(_0x296709,null))[_0x0b79('0x28')](function(_0xe27b79){if(_0xe27b79){_0x4ef156=_0xe27b79;return db[_0x0b79('0x55')][_0x0b79('0x29')]({'where':{'userProfileId':_0x55599f[_0x0b79('0x48')]['id'],'sectionId':_0x55599f[_0x0b79('0x34')][_0x0b79('0x5e')]}});}})[_0x0b79('0x28')](function(){return _0x4ef156;})[_0x0b79('0x28')](respondWithStatusCode(_0x296709,null))['catch'](handleError(_0x296709,null));};exports[_0x0b79('0x5f')]=function(_0x49fafc,_0x5ed42c){var _0xeebfe1=[];var _0x3ea0b7=[];return db['UserProfileSection'][_0x0b79('0x45')]({'where':{'userProfileId':_0x49fafc[_0x0b79('0x48')]['id']},'raw':!![]})['then'](function(_0x4d6cb7){_0xeebfe1=_[_0x0b79('0x41')](_0x4d6cb7,function(_0x54b005){return _0x54b005[_0x0b79('0x60')]===0x1||_[_0x0b79('0x61')]([0x3eb,0x709],_0x54b005[_0x0b79('0x62')]);});if(!_[_0x0b79('0x63')](_0xeebfe1)){return _['map'](_0xeebfe1,function(_0x15d4f0){return _0x15d4f0[_0x0b79('0x62')];});}else{return;}})[_0x0b79('0x28')](function(_0x541094){if(_0x541094)_0x3ea0b7=_0x541094;if(_[_0x0b79('0x61')](_0x3ea0b7,0x64)){var _0x198b98=_[_0x0b79('0x4a')](_0xeebfe1,{'sectionId':0x64});return hasDefaultDashboard(_0x198b98)[_0x0b79('0x28')](function(_0x5dfe66){return _[_0x0b79('0x2e')](_0xeebfe1,function(_0x11fbb5){if(_0x11fbb5[_0x0b79('0x62')]===0x64){_0x11fbb5[_0x0b79('0x64')]=_0x5dfe66;}return _0x11fbb5;});});}else{return;}})[_0x0b79('0x28')](function(_0x2e7040){if(_0x2e7040)_0xeebfe1=_0x2e7040;if(_[_0x0b79('0x61')](_0x3ea0b7,0x3eb)){var _0x59df89=_['find'](_0xeebfe1,{'sectionId':0x3eb});return getCustomDashboards(_0x59df89)[_0x0b79('0x28')](function(_0x29e71b){return _[_0x0b79('0x2e')](_0xeebfe1,function(_0x70b5cd){if(_0x59df89['enabled']){if(_0x70b5cd['sectionId']===0x3eb){_0x70b5cd[_0x0b79('0x64')]=_0x29e71b;}}else{if(_0x70b5cd['sectionId']===0x64){if(!_0x70b5cd['subsections']){_0x70b5cd[_0x0b79('0x64')]=[];}_0x70b5cd['subsections']=_0x70b5cd[_0x0b79('0x64')][_0x0b79('0x65')](_0x29e71b);}}return _0x70b5cd;});});}else{return;}})[_0x0b79('0x28')](function(_0x24f124){if(_0x24f124)_0xeebfe1=_0x24f124;if(_[_0x0b79('0x61')](_0x3ea0b7,0x709)){var _0x790464=_['find'](_0xeebfe1,{'sectionId':0x709});return getPlugins(_0x790464)['then'](function(_0x33e5a8){if(_0x790464['enabled']){return _[_0x0b79('0x2e')](_0xeebfe1,function(_0x22d02b){if(_0x22d02b[_0x0b79('0x62')]===0x709){_0x22d02b['subsections']=_0x33e5a8;}return _0x22d02b;});}else{var _0x2662d2={'sectionId':0x76c,'enabled':0x1,'subsections':_0x33e5a8};var _0x33172f=_['map'](_0xeebfe1);_0x33172f[_0x0b79('0x66')](_0x2662d2);return _0x33172f;}});}else{return;}})['then'](function(_0x3103a1){if(_0x3103a1)_0xeebfe1=_0x3103a1;return _[_0x0b79('0x41')](_0xeebfe1,[_0x0b79('0x60'),0x1]);})[_0x0b79('0x28')](respondWithResult(_0x5ed42c,null))[_0x0b79('0x4b')](handleError(_0x5ed42c,null));};function hasDefaultDashboard(_0x1e72e2){var _0x13cf70=[0x65];return new BPromise(function(_0x30e31,_0x534814){try{if(_0x1e72e2[_0x0b79('0x57')]){_0x30e31(_0x13cf70);}else{return db[_0x0b79('0x58')][_0x0b79('0x67')]({'where':{'sectionId':_0x1e72e2['id']},'raw':!![]})[_0x0b79('0x28')](function(_0x4acff1){_0x4acff1?_0x30e31(_0x13cf70):_0x30e31();});}}catch(_0x3f360e){_0x534814(_0x3f360e);}});}function getCustomDashboards(_0x9ecd86){var _0x100ae0=[];return new BPromise(function(_0x3effc6,_0x295c16){try{if(_0x9ecd86[_0x0b79('0x57')]){return db[_0x0b79('0x68')]['findAll']({'raw':!![]})['then'](function(_0x4c5956){_0x4c5956[_0x0b79('0x69')](function(_0x39b1a2){_0x100ae0['push'](_0x39b1a2['id']+0x1869f);});_0x3effc6(_0x100ae0);});}else{return db['UserProfileResource'][_0x0b79('0x45')]({'where':{'sectionId':_0x9ecd86['id']},'raw':!![]})['then'](function(_0x10f3af){_0x10f3af[_0x0b79('0x69')](function(_0x59a5bc){_0x100ae0[_0x0b79('0x66')](_0x59a5bc['resourceId']+0x1869f);});_0x3effc6(_0x100ae0);});}}catch(_0x12b003){_0x295c16(_0x12b003);}});}function getPlugins(_0x272e47){var _0x308c36=[];return new BPromise(function(_0x427131,_0x19da21){try{if(_0x272e47[_0x0b79('0x57')]){return db[_0x0b79('0x6a')][_0x0b79('0x45')]({'raw':!![]})[_0x0b79('0x28')](function(_0xc1e2cb){_0xc1e2cb[_0x0b79('0x69')](function(_0x14dfad){_0x308c36['push'](_0x14dfad['id']+0x15b38);});_0x427131(_0x308c36);});}else{return db['UserProfileResource'][_0x0b79('0x45')]({'where':{'sectionId':_0x272e47['id']},'raw':!![]})[_0x0b79('0x28')](function(_0x209cd4){_0x209cd4[_0x0b79('0x69')](function(_0x54ebb4){_0x308c36['push'](_0x54ebb4[_0x0b79('0x6b')]+0x15b38);});_0x427131(_0x308c36);});}}catch(_0x559f13){_0x19da21(_0x559f13);}});}exports['addResources']=function(_0x1ccf84,_0x4526ab){return db[_0x0b79('0x2f')]['find']({'where':{'id':_0x1ccf84['params']['id']}})[_0x0b79('0x28')](handleEntityNotFound(_0x4526ab,null))['then'](function(_0x1c3eb6){if(_0x1c3eb6){return db[_0x0b79('0x53')][_0x0b79('0x54')](function(_0x2d993d){return db[_0x0b79('0x55')]['findAll']({'where':{'userProfileId':_0x1ccf84[_0x0b79('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x0b79('0x28')](function(_0x452ac){if(_0x452ac){return db['UserProfileSection'][_0x0b79('0x29')]({'where':{'userProfileId':_0x1ccf84[_0x0b79('0x48')]['id'],'id':_[_0x0b79('0x2e')](_0x452ac,function(_0x54a8e5){return _0x54a8e5['id'];})},'transaction':_0x2d993d});}})['then'](function(_0x56cbbe){var _0x3238f5=_[_0x0b79('0x2e')](_0x1ccf84[_0x0b79('0x4d')],function(_0x4da7b3){_0x4da7b3['userProfileId']=_0x1ccf84[_0x0b79('0x48')]['id'];return _0x4da7b3;});return db['UserProfileSection'][_0x0b79('0x6c')](_0x3238f5,{'raw':!![],'transaction':_0x2d993d});})[_0x0b79('0x28')](function(_0x3bb67d){var _0x5de9c5=_[_0x0b79('0x41')](_['map'](_0x3bb67d,function(_0x4ae448){return _0x4ae448['get']({'plain':!![]});}),{'includeAll':![]});if(_0x5de9c5){return db[_0x0b79('0x55')][_0x0b79('0x45')]({'where':{'userProfileId':_0x1ccf84['params']['id'],'sectionId':_['map'](_0x5de9c5,function(_0x102750){return _0x102750[_0x0b79('0x62')];})},'attributes':['id',_0x0b79('0x62')],'raw':!![]})['then'](function(_0x9f58f1){var _0x5aa175=_[_0x0b79('0x2e')](_0x1ccf84[_0x0b79('0x4d')],function(_0x4439e5){_0x4439e5[_0x0b79('0x59')]=_0x1ccf84[_0x0b79('0x48')]['id'];return _0x4439e5;});return db[_0x0b79('0x58')]['bulkCreate'](_0x5aa175,{'raw':!![],'transaction':_0x2d993d});});}})[_0x0b79('0x4b')](handleError(_0x4526ab,null));});}})[_0x0b79('0x28')](function(_0xfb44ea){var _0x399b58=_[_0x0b79('0x2e')](_0xfb44ea,function(_0x138a91){return _0x138a91[_0x0b79('0x4e')]({'plain':!![]});});})['then'](respondWithResult(_0x4526ab,null))[_0x0b79('0x4b')](handleError(_0x4526ab,null));};exports[_0x0b79('0x6d')]=function(_0x5ed3b3,_0x3d3b5c,_0x309ab9){return db['UserProfile'][_0x0b79('0x4a')]({'where':{'id':_0x5ed3b3[_0x0b79('0x48')]['id']}})[_0x0b79('0x28')](handleEntityNotFound(_0x3d3b5c,null))[_0x0b79('0x28')](function(_0x42883f){if(_0x42883f){return _0x42883f[_0x0b79('0x6d')](_0x5ed3b3[_0x0b79('0x34')][_0x0b79('0x5e')]);}})[_0x0b79('0x28')](respondWithStatusCode(_0x3d3b5c,null))[_0x0b79('0x4b')](handleError(_0x3d3b5c,null));};exports[_0x0b79('0x6e')]=function(_0x4b81ae,_0xeae4fb){var _0xc40ff4={};if(!_0x4b81ae[_0x0b79('0x34')]['section'])throw new Error(_0x0b79('0x6f'));if(!_0x4b81ae[_0x0b79('0x34')]['hasOwnProperty']('nolimit')){_0xc40ff4[_0x0b79('0x1f')]=qs[_0x0b79('0x1f')](_0x4b81ae[_0x0b79('0x34')]['limit']);_0xc40ff4[_0x0b79('0x22')]=qs[_0x0b79('0x22')](_0x4b81ae[_0x0b79('0x34')][_0x0b79('0x22')]);}return db[_0x0b79('0x2f')][_0x0b79('0x4a')]({'where':{'id':_0x4b81ae[_0x0b79('0x48')]['id']}})[_0x0b79('0x28')](function(_0x123c70){if(!_0x123c70)throw new Error(_0x0b79('0x70')+_0x4b81ae[_0x0b79('0x48')]['id']);return db[_0x0b79('0x2f')][_0x0b79('0x6e')](_0x4b81ae);})[_0x0b79('0x28')](respondWithFilteredResult(_0xeae4fb,_0xc40ff4))[_0x0b79('0x4b')](handleError(_0xeae4fb,null));}; \ No newline at end of file +var _0x139a=['each','autoAssociation','UserProfileResource','sectionId','omit','Resources','find','describe','addSections','userProfileId','push','removeSections','destroy','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','error','stack','name','UserProfile','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','create','body','clone','options','get','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection'];(function(_0x191fbb,_0x5d4355){var _0x1b80d7=function(_0x4142e3){while(--_0x4142e3){_0x191fbb['push'](_0x191fbb['shift']());}};_0x1b80d7(++_0x5d4355);}(_0x139a,0xfb));var _0xa139=function(_0xf178ec,_0x2a1c3b){_0xf178ec=_0xf178ec-0x0;var _0xa7e3c3=_0x139a[_0xf178ec];return _0xa7e3c3;};'use strict';var emlformat=require(_0xa139('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa139('0x1'));var jsonpatch=require(_0xa139('0x2'));var rp=require(_0xa139('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa139('0x4'));var util=require(_0xa139('0x5'));var path=require('path');var sox=require(_0xa139('0x6'));var csv=require(_0xa139('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa139('0x8'));var crypto=require(_0xa139('0x9'));var jsforce=require(_0xa139('0xa'));var deskjs=require(_0xa139('0xb'));var toCsv=require(_0xa139('0x7'));var querystring=require(_0xa139('0xc'));var Papa=require(_0xa139('0xd'));var Redis=require(_0xa139('0xe'));var authService=require(_0xa139('0xf'));var qs=require(_0xa139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa139('0x11'));var utils=require(_0xa139('0x12'));var config=require(_0xa139('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa139('0x14'))['db'];config[_0xa139('0x15')]=_[_0xa139('0x16')](config[_0xa139('0x15')],{'host':_0xa139('0x17'),'port':0x18eb});var socket=require(_0xa139('0x18'))(new Redis(config['redis']));require(_0xa139('0x19'))[_0xa139('0x1a')](socket);function respondWithStatusCode(_0x5913cd,_0x16e368){_0x16e368=_0x16e368||0xcc;return function(_0x1cbcc1){if(_0x1cbcc1){return _0x5913cd[_0xa139('0x1b')](_0x16e368);}return _0x5913cd[_0xa139('0x1c')](_0x16e368)[_0xa139('0x1d')]();};}function respondWithResult(_0x16d730,_0x761aa6){_0x761aa6=_0x761aa6||0xc8;return function(_0x33e385){if(_0x33e385){return _0x16d730[_0xa139('0x1c')](_0x761aa6)[_0xa139('0x1e')](_0x33e385);}};}function respondWithFilteredResult(_0x5177d8,_0xdb3004){return function(_0x1fc479){if(_0x1fc479){var _0x5c4a2b=typeof _0xdb3004[_0xa139('0x1f')]===_0xa139('0x20')&&typeof _0xdb3004['limit']==='undefined';var _0x404465=_0x1fc479[_0xa139('0x21')];var _0xd51f53=_0x5c4a2b?0x0:_0xdb3004['offset'];var _0xd31d66=_0x5c4a2b?_0x1fc479[_0xa139('0x21')]:_0xdb3004[_0xa139('0x1f')]+_0xdb3004[_0xa139('0x22')];var _0x147771;if(_0xd31d66>=_0x404465){_0xd31d66=_0x404465;_0x147771=0xc8;}else{_0x147771=0xce;}_0x5177d8[_0xa139('0x1c')](_0x147771);return _0x5177d8['set'](_0xa139('0x23'),_0xd51f53+'-'+_0xd31d66+'/'+_0x404465)['json'](_0x1fc479);}return null;};}function patchUpdates(_0x40c0dd){return function(_0x16a4da){try{jsonpatch['apply'](_0x16a4da,_0x40c0dd,!![]);}catch(_0x153a82){return BPromise[_0xa139('0x24')](_0x153a82);}return _0x16a4da[_0xa139('0x25')]();};}function saveUpdates(_0x334181,_0x412742){return function(_0x80e830){if(_0x80e830){return _0x80e830[_0xa139('0x26')](_0x334181)[_0xa139('0x27')](function(_0x5e732a){return _0x5e732a;});}return null;};}function removeEntity(_0xbc9b1,_0x210f9a){return function(_0x513b98){if(_0x513b98){return _0x513b98['destroy']()['then'](function(){_0xbc9b1['status'](0xcc)[_0xa139('0x1d')]();});}};}function handleEntityNotFound(_0x5e4480,_0x18eb6b){return function(_0x3fa88a){if(!_0x3fa88a){_0x5e4480[_0xa139('0x1b')](0x194);}return _0x3fa88a;};}function handleError(_0x18eed4,_0x51173c){_0x51173c=_0x51173c||0x1f4;return function(_0xab441f){logger[_0xa139('0x28')](_0xab441f[_0xa139('0x29')]);if(_0xab441f[_0xa139('0x2a')]){delete _0xab441f[_0xa139('0x2a')];}_0x18eed4[_0xa139('0x1c')](_0x51173c)['send'](_0xab441f);};}exports['index']=function(_0x498909,_0x31045d){var _0x1f6e14={},_0x1e3f4a={},_0x27a420={'count':0x0,'rows':[]};var _0x4cb533=_['map'](db[_0xa139('0x2b')][_0xa139('0x2c')],function(_0x48b1c5){return{'name':_0x48b1c5[_0xa139('0x2d')],'type':_0x48b1c5[_0xa139('0x2e')][_0xa139('0x2f')]};});_0x1e3f4a['model']=_[_0xa139('0x30')](_0x4cb533,_0xa139('0x2a'));_0x1e3f4a['query']=_[_0xa139('0x31')](_0x498909[_0xa139('0x32')]);_0x1e3f4a[_0xa139('0x33')]=_[_0xa139('0x34')](_0x1e3f4a[_0xa139('0x35')],_0x1e3f4a['query']);_0x1f6e14[_0xa139('0x36')]=_[_0xa139('0x34')](_0x1e3f4a[_0xa139('0x35')],qs['fields'](_0x498909[_0xa139('0x32')][_0xa139('0x37')]));_0x1f6e14[_0xa139('0x36')]=_0x1f6e14['attributes'][_0xa139('0x38')]?_0x1f6e14[_0xa139('0x36')]:_0x1e3f4a['model'];if(!_0x498909['query'][_0xa139('0x39')](_0xa139('0x3a'))){_0x1f6e14[_0xa139('0x22')]=qs['limit'](_0x498909[_0xa139('0x32')][_0xa139('0x22')]);_0x1f6e14['offset']=qs[_0xa139('0x1f')](_0x498909[_0xa139('0x32')][_0xa139('0x1f')]);}_0x1f6e14[_0xa139('0x3b')]=qs[_0xa139('0x3c')](_0x498909[_0xa139('0x32')]['sort']);_0x1f6e14[_0xa139('0x3d')]=qs[_0xa139('0x33')](_['pick'](_0x498909[_0xa139('0x32')],_0x1e3f4a[_0xa139('0x33')]),_0x4cb533);if(_0x498909[_0xa139('0x32')][_0xa139('0x3e')]){_0x1f6e14[_0xa139('0x3d')]=_[_0xa139('0x3f')](_0x1f6e14[_0xa139('0x3d')],{'$or':_[_0xa139('0x30')](_0x4cb533,function(_0x32932a){if(_0x32932a[_0xa139('0x2e')]!=='VIRTUAL'){var _0x40e954={};_0x40e954[_0x32932a[_0xa139('0x2a')]]={'$like':'%'+_0x498909['query'][_0xa139('0x3e')]+'%'};return _0x40e954;}})});}_0x1f6e14=_[_0xa139('0x3f')]({},_0x1f6e14,_0x498909['options']);var _0x101de8={'where':_0x1f6e14['where']};return db[_0xa139('0x2b')][_0xa139('0x21')](_0x101de8)[_0xa139('0x27')](function(_0x2ee07a){_0x27a420[_0xa139('0x21')]=_0x2ee07a;if(_0x498909[_0xa139('0x32')][_0xa139('0x40')]){_0x1f6e14[_0xa139('0x41')]=[{'all':!![]}];}return db['UserProfile'][_0xa139('0x42')](_0x1f6e14);})['then'](function(_0x23d0b7){_0x27a420[_0xa139('0x43')]=_0x23d0b7;return _0x27a420;})[_0xa139('0x27')](respondWithFilteredResult(_0x31045d,_0x1f6e14))[_0xa139('0x44')](handleError(_0x31045d,null));};exports[_0xa139('0x45')]=function(_0x1cfcb2,_0x33aee7){var _0x21ac2d={'raw':![],'where':{'id':_0x1cfcb2[_0xa139('0x46')]['id']}},_0x2429f2={};_0x2429f2[_0xa139('0x35')]=_[_0xa139('0x31')](db[_0xa139('0x2b')][_0xa139('0x2c')]);_0x2429f2['query']=_[_0xa139('0x31')](_0x1cfcb2[_0xa139('0x32')]);_0x2429f2['filters']=_['intersection'](_0x2429f2['model'],_0x2429f2[_0xa139('0x32')]);_0x21ac2d['attributes']=_['intersection'](_0x2429f2['model'],qs['fields'](_0x1cfcb2[_0xa139('0x32')][_0xa139('0x37')]));_0x21ac2d[_0xa139('0x36')]=_0x21ac2d[_0xa139('0x36')][_0xa139('0x38')]?_0x21ac2d['attributes']:_0x2429f2[_0xa139('0x35')];if(_0x1cfcb2['query'][_0xa139('0x40')]){_0x21ac2d['include']=[{'all':!![]}];}_0x21ac2d=_['merge']({},_0x21ac2d,_0x1cfcb2['options']);return db[_0xa139('0x2b')]['find'](_0x21ac2d)[_0xa139('0x27')](handleEntityNotFound(_0x33aee7,null))[_0xa139('0x27')](respondWithResult(_0x33aee7,null))[_0xa139('0x44')](handleError(_0x33aee7,null));};exports[_0xa139('0x47')]=function(_0x551e4f,_0x171d2f){return db[_0xa139('0x2b')][_0xa139('0x47')](_0x551e4f[_0xa139('0x48')],{})['then'](respondWithResult(_0x171d2f,0xc9))[_0xa139('0x44')](handleError(_0x171d2f,null));};exports[_0xa139('0x49')]=function(_0x43d711,_0x719d41){var _0x394240={'where':{'id':_0x43d711[_0xa139('0x46')]['id']}},_0x1fe028={};_0x1fe028[_0xa139('0x35')]=_['keys'](db[_0xa139('0x2b')][_0xa139('0x2c')]);_0x394240['attributes']=_[_0xa139('0x34')](_0x1fe028['model'],qs[_0xa139('0x37')](_0x43d711[_0xa139('0x32')][_0xa139('0x37')]));_0x394240[_0xa139('0x36')]=_0x394240[_0xa139('0x36')][_0xa139('0x38')]?_0x394240[_0xa139('0x36')]:_0x1fe028[_0xa139('0x35')];if(_0x43d711[_0xa139('0x32')]['includeAll']){_0x394240['include']=[{'all':!![]}];}_0x394240=_[_0xa139('0x3f')]({},_0x394240,_0x43d711[_0xa139('0x4a')]);return db[_0xa139('0x2b')]['find'](_0x394240)[_0xa139('0x27')](handleEntityNotFound(_0x719d41,null))[_0xa139('0x27')](function(_0x97cf8a){if(_0x97cf8a){var _0x41cc65=_0x97cf8a[_0xa139('0x4b')]({'plain':!![]});_0x41cc65=qs['omit'](_0x41cc65,['id','createdAt',_0xa139('0x4c'),_0xa139('0x4d')]);_0x43d711[_0xa139('0x48')]=_['omit'](_0x43d711[_0xa139('0x48')],['id',_0xa139('0x4e'),_0xa139('0x4c')]);return db[_0xa139('0x4f')][_0xa139('0x50')](function(_0x384bf1){return db[_0xa139('0x2b')][_0xa139('0x47')](_[_0xa139('0x3f')](_0x41cc65,_0x43d711[_0xa139('0x48')]),{'include':_0x43d711[_0xa139('0x32')][_0xa139('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x384bf1})[_0xa139('0x27')](function(_0x1e98b8){var _0x304c26=_0x1e98b8[_0xa139('0x4b')]({'plain':!![]});return db[_0xa139('0x51')]['findAll']({'where':{'userProfileId':_0x43d711[_0xa139('0x46')]['id']},'raw':!![]})[_0xa139('0x27')](function(_0x4978bf){if(_0x4978bf){return BPromise[_0xa139('0x52')](_0x4978bf,function(_0x37efe4){return new BPromise(function(_0x12c624,_0x2ce130){if(_0x37efe4['autoAssociation']===null||_0x37efe4[_0xa139('0x53')]===0x1)_0x12c624(null);return db[_0xa139('0x54')][_0xa139('0x42')]({'where':{'sectionId':_0x37efe4['id']},'raw':!![]})['then'](function(_0xe71b14){var _0x442f1a=_[_0xa139('0x30')](_0xe71b14,function(_0x59bf4c){return qs['omit'](_0x59bf4c,['id',_0xa139('0x4e'),_0xa139('0x4c'),_0xa139('0x55')]);});_0x12c624(_0x442f1a);})[_0xa139('0x44')](function(_0xf7c78a){_0x2ce130(_0xf7c78a);});})[_0xa139('0x27')](function(_0x2470f6){var _0xc706a7=qs[_0xa139('0x56')](_0x37efe4,['id','createdAt',_0xa139('0x4c')]);_0xc706a7['userProfileId']=_0x304c26['id'];if(_0x2470f6)_0xc706a7[_0xa139('0x57')]=_0x2470f6;return _0xc706a7;})['then'](function(_0x5d2bf1){return db[_0xa139('0x51')]['create'](_0x5d2bf1,{'include':[{'model':db['UserProfileResource'],'as':_0xa139('0x57')}],'raw':!![],'transaction':_0x384bf1});});})['then'](function(){return _0x304c26;});}});});});}})['then'](respondWithResult(_0x719d41,0xc9))[_0xa139('0x44')](handleError(_0x719d41,null));};exports[_0xa139('0x26')]=function(_0x76bf61,_0x6be90a){if(_0x76bf61[_0xa139('0x48')]['id']){delete _0x76bf61[_0xa139('0x48')]['id'];}return db[_0xa139('0x2b')][_0xa139('0x58')]({'where':{'id':_0x76bf61[_0xa139('0x46')]['id']}})[_0xa139('0x27')](handleEntityNotFound(_0x6be90a,null))['then'](saveUpdates(_0x76bf61['body'],null))['then'](respondWithResult(_0x6be90a,null))['catch'](handleError(_0x6be90a,null));};exports['destroy']=function(_0x4ed0fd,_0x4693f0){return db[_0xa139('0x2b')][_0xa139('0x58')]({'where':{'id':_0x4ed0fd[_0xa139('0x46')]['id']}})[_0xa139('0x27')](handleEntityNotFound(_0x4693f0,null))['then'](removeEntity(_0x4693f0,null))['catch'](handleError(_0x4693f0,null));};exports[_0xa139('0x59')]=function(_0x11fd8d,_0x2634b9){return db[_0xa139('0x2b')][_0xa139('0x59')]()[_0xa139('0x27')](respondWithResult(_0x2634b9,null))[_0xa139('0x44')](handleError(_0x2634b9,null));};exports[_0xa139('0x5a')]=function(_0x2c0fb0,_0x2209c8){var _0xdd10be=_0x2c0fb0['body'];return db[_0xa139('0x2b')][_0xa139('0x58')]({'where':{'id':_0x2c0fb0['params']['id']}})['then'](handleEntityNotFound(_0x2209c8,null))[_0xa139('0x27')](function(_0xf069b7){if(_0xf069b7){return db['sequelize'][_0xa139('0x50')](function(_0x3b70c3){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2c0fb0[_0xa139('0x46')]['id'],'sectionId':_[_0xa139('0x30')](_0xdd10be,function(_0x2bdd4a){return _0x2bdd4a[_0xa139('0x55')];})},'transaction':_0x3b70c3})['then'](function(){var _0x236660=_['map'](_0xdd10be,function(_0x54590c){_0x54590c[_0xa139('0x5b')]=_0x2c0fb0[_0xa139('0x46')]['id'];return _0x54590c;});var _0x4f0141=[];return BPromise[_0xa139('0x52')](_0x236660,function(_0x2bb6f4){return db[_0xa139('0x51')][_0xa139('0x47')](_0x2bb6f4,{'include':[{'model':db[_0xa139('0x54')],'as':_0xa139('0x57')}],'raw':!![],'transaction':_0x3b70c3})[_0xa139('0x27')](function(_0x2e807c){_0x4f0141[_0xa139('0x5c')](_0x2e807c[_0xa139('0x4b')]({'plain':!![]}));});})[_0xa139('0x27')](function(){return _0x4f0141;});});});}})['then'](function(_0x7b85be){return _0x7b85be;})['then'](respondWithResult(_0x2209c8,null))['catch'](handleError(_0x2209c8,null));};exports[_0xa139('0x5d')]=function(_0x21fba9,_0x44fcff){var _0x3766b6;return db[_0xa139('0x2b')][_0xa139('0x58')]({'where':{'id':_0x21fba9[_0xa139('0x46')]['id']},'attributes':['id',_0xa139('0x2a')]})['then'](handleEntityNotFound(_0x44fcff,null))['then'](function(_0x478c18){if(_0x478c18){_0x3766b6=_0x478c18;return db['UserProfileSection'][_0xa139('0x5e')]({'where':{'userProfileId':_0x21fba9[_0xa139('0x46')]['id'],'sectionId':_0x21fba9['query'][_0xa139('0x5f')]}});}})['then'](function(){return _0x3766b6;})[_0xa139('0x27')](respondWithStatusCode(_0x44fcff,null))['catch'](handleError(_0x44fcff,null));};exports[_0xa139('0x60')]=function(_0x2e5c4e,_0x388f89){var _0x2f35ff=[];var _0x1e3831=[];return db[_0xa139('0x51')][_0xa139('0x42')]({'where':{'userProfileId':_0x2e5c4e[_0xa139('0x46')]['id']},'raw':!![]})[_0xa139('0x27')](function(_0x282966){_0x2f35ff=_[_0xa139('0x3e')](_0x282966,function(_0x576ef7){return _0x576ef7[_0xa139('0x61')]===0x1||_[_0xa139('0x62')]([0x3eb,0x709],_0x576ef7[_0xa139('0x55')]);});if(!_['isEmpty'](_0x2f35ff)){return _[_0xa139('0x30')](_0x2f35ff,function(_0x4d67fa){return _0x4d67fa[_0xa139('0x55')];});}else{return;}})[_0xa139('0x27')](function(_0x2486c9){if(_0x2486c9)_0x1e3831=_0x2486c9;if(_[_0xa139('0x62')](_0x1e3831,0x64)){var _0x3b92f2=_['find'](_0x2f35ff,{'sectionId':0x64});return hasDefaultDashboard(_0x3b92f2)[_0xa139('0x27')](function(_0x30e365){return _[_0xa139('0x30')](_0x2f35ff,function(_0x17846e){if(_0x17846e['sectionId']===0x64){_0x17846e[_0xa139('0x63')]=_0x30e365;}return _0x17846e;});});}else{return;}})[_0xa139('0x27')](function(_0x47af61){if(_0x47af61)_0x2f35ff=_0x47af61;if(_['includes'](_0x1e3831,0x3eb)){var _0x596b7d=_['find'](_0x2f35ff,{'sectionId':0x3eb});return getCustomDashboards(_0x596b7d)[_0xa139('0x27')](function(_0x3bba40){return _['map'](_0x2f35ff,function(_0x58643e){if(_0x596b7d[_0xa139('0x61')]){if(_0x58643e[_0xa139('0x55')]===0x3eb){_0x58643e[_0xa139('0x63')]=_0x3bba40;}}else{if(_0x58643e[_0xa139('0x55')]===0x64){if(!_0x58643e[_0xa139('0x63')]){_0x58643e['subsections']=[];}_0x58643e[_0xa139('0x63')]=_0x58643e[_0xa139('0x63')][_0xa139('0x64')](_0x3bba40);}}return _0x58643e;});});}else{return;}})[_0xa139('0x27')](function(_0xf4c0e8){if(_0xf4c0e8)_0x2f35ff=_0xf4c0e8;if(_[_0xa139('0x62')](_0x1e3831,0x709)){var _0x50bb22=_[_0xa139('0x58')](_0x2f35ff,{'sectionId':0x709});return getPlugins(_0x50bb22)[_0xa139('0x27')](function(_0x515b54){if(_0x50bb22[_0xa139('0x61')]){return _[_0xa139('0x30')](_0x2f35ff,function(_0x57bb3f){if(_0x57bb3f[_0xa139('0x55')]===0x709){_0x57bb3f[_0xa139('0x63')]=_0x515b54;}return _0x57bb3f;});}else{var _0x533c9a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x515b54};var _0x9e50f3=_[_0xa139('0x30')](_0x2f35ff);_0x9e50f3['push'](_0x533c9a);return _0x9e50f3;}});}else{return;}})[_0xa139('0x27')](function(_0x2fff57){if(_0x2fff57)_0x2f35ff=_0x2fff57;return _['filter'](_0x2f35ff,[_0xa139('0x61'),0x1]);})[_0xa139('0x27')](respondWithResult(_0x388f89,null))[_0xa139('0x44')](handleError(_0x388f89,null));};function hasDefaultDashboard(_0x57936c){var _0x5caf38=[0x65];return new BPromise(function(_0x4ec881,_0x52544b){try{if(_0x57936c[_0xa139('0x53')]){_0x4ec881(_0x5caf38);}else{return db['UserProfileResource'][_0xa139('0x65')]({'where':{'sectionId':_0x57936c['id']},'raw':!![]})[_0xa139('0x27')](function(_0x2f293d){_0x2f293d?_0x4ec881(_0x5caf38):_0x4ec881();});}}catch(_0x12ae53){_0x52544b(_0x12ae53);}});}function getCustomDashboards(_0x13cb9d){var _0x1cf5ac=[];return new BPromise(function(_0x381db8,_0x241a9c){try{if(_0x13cb9d[_0xa139('0x53')]){return db[_0xa139('0x66')][_0xa139('0x42')]({'raw':!![]})['then'](function(_0x21154c){_0x21154c[_0xa139('0x67')](function(_0x315054){_0x1cf5ac[_0xa139('0x5c')](_0x315054['id']+0x1869f);});_0x381db8(_0x1cf5ac);});}else{return db[_0xa139('0x54')][_0xa139('0x42')]({'where':{'sectionId':_0x13cb9d['id']},'raw':!![]})[_0xa139('0x27')](function(_0x1213ba){_0x1213ba[_0xa139('0x67')](function(_0x23b6fc){_0x1cf5ac[_0xa139('0x5c')](_0x23b6fc['resourceId']+0x1869f);});_0x381db8(_0x1cf5ac);});}}catch(_0x4fc735){_0x241a9c(_0x4fc735);}});}function getPlugins(_0x2951ce){var _0xa7914f=[];return new BPromise(function(_0x5878dd,_0x3ab84d){try{if(_0x2951ce['autoAssociation']){return db[_0xa139('0x68')][_0xa139('0x42')]({'raw':!![]})[_0xa139('0x27')](function(_0x3c07cf){_0x3c07cf[_0xa139('0x67')](function(_0x457157){_0xa7914f['push'](_0x457157['id']+0x15b38);});_0x5878dd(_0xa7914f);});}else{return db[_0xa139('0x54')][_0xa139('0x42')]({'where':{'sectionId':_0x2951ce['id']},'raw':!![]})[_0xa139('0x27')](function(_0x323dd1){_0x323dd1['forEach'](function(_0x10deac){_0xa7914f['push'](_0x10deac['resourceId']+0x15b38);});_0x5878dd(_0xa7914f);});}}catch(_0x564986){_0x3ab84d(_0x564986);}});}exports[_0xa139('0x69')]=function(_0x535f6f,_0x4b6b57){return db['UserProfile'][_0xa139('0x58')]({'where':{'id':_0x535f6f[_0xa139('0x46')]['id']}})[_0xa139('0x27')](handleEntityNotFound(_0x4b6b57,null))['then'](function(_0x2255fe){if(_0x2255fe){return db[_0xa139('0x4f')]['transaction'](function(_0x187400){return db[_0xa139('0x51')][_0xa139('0x42')]({'where':{'userProfileId':_0x535f6f[_0xa139('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0xa139('0x27')](function(_0x1b84b7){if(_0x1b84b7){return db[_0xa139('0x51')]['destroy']({'where':{'userProfileId':_0x535f6f[_0xa139('0x46')]['id'],'id':_[_0xa139('0x30')](_0x1b84b7,function(_0x1ebd4f){return _0x1ebd4f['id'];})},'transaction':_0x187400});}})[_0xa139('0x27')](function(_0x2f401f){var _0x443ef4=_[_0xa139('0x30')](_0x535f6f[_0xa139('0x48')],function(_0x471f97){_0x471f97['userProfileId']=_0x535f6f[_0xa139('0x46')]['id'];return _0x471f97;});return db['UserProfileSection']['bulkCreate'](_0x443ef4,{'raw':!![],'transaction':_0x187400});})[_0xa139('0x27')](function(_0x315645){var _0x3197bf=_['filter'](_[_0xa139('0x30')](_0x315645,function(_0x4191a8){return _0x4191a8[_0xa139('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x3197bf){return db[_0xa139('0x51')]['findAll']({'where':{'userProfileId':_0x535f6f[_0xa139('0x46')]['id'],'sectionId':_['map'](_0x3197bf,function(_0x915740){return _0x915740[_0xa139('0x55')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xa139('0x27')](function(_0x3bf560){var _0x3cd970=_[_0xa139('0x30')](_0x535f6f['body'],function(_0x550257){_0x550257[_0xa139('0x5b')]=_0x535f6f[_0xa139('0x46')]['id'];return _0x550257;});return db[_0xa139('0x54')][_0xa139('0x6a')](_0x3cd970,{'raw':!![],'transaction':_0x187400});});}})[_0xa139('0x44')](handleError(_0x4b6b57,null));});}})[_0xa139('0x27')](function(_0x4e25d5){var _0x10f46d=_[_0xa139('0x30')](_0x4e25d5,function(_0x5b4248){return _0x5b4248[_0xa139('0x4b')]({'plain':!![]});});})[_0xa139('0x27')](respondWithResult(_0x4b6b57,null))['catch'](handleError(_0x4b6b57,null));};exports[_0xa139('0x6b')]=function(_0x2769f0,_0x31f1e1,_0x14ba14){return db[_0xa139('0x2b')][_0xa139('0x58')]({'where':{'id':_0x2769f0['params']['id']}})[_0xa139('0x27')](handleEntityNotFound(_0x31f1e1,null))[_0xa139('0x27')](function(_0x4436df){if(_0x4436df){return _0x4436df[_0xa139('0x6b')](_0x2769f0[_0xa139('0x32')]['ids']);}})[_0xa139('0x27')](respondWithStatusCode(_0x31f1e1,null))[_0xa139('0x44')](handleError(_0x31f1e1,null));};exports[_0xa139('0x6c')]=function(_0x5d83c2,_0x33d554){var _0x2f0f4f={};if(!_0x5d83c2[_0xa139('0x32')][_0xa139('0x6d')])throw new Error(_0xa139('0x6e'));if(!_0x5d83c2[_0xa139('0x32')][_0xa139('0x39')](_0xa139('0x3a'))){_0x2f0f4f[_0xa139('0x22')]=qs[_0xa139('0x22')](_0x5d83c2[_0xa139('0x32')][_0xa139('0x22')]);_0x2f0f4f[_0xa139('0x1f')]=qs[_0xa139('0x1f')](_0x5d83c2['query'][_0xa139('0x1f')]);}return db[_0xa139('0x2b')][_0xa139('0x58')]({'where':{'id':_0x5d83c2[_0xa139('0x46')]['id']}})['then'](function(_0x7ffa6b){if(!_0x7ffa6b)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5d83c2['params']['id']);return db[_0xa139('0x2b')][_0xa139('0x6c')](_0x5d83c2);})['then'](respondWithFilteredResult(_0x33d554,_0x2f0f4f))[_0xa139('0x44')](handleError(_0x33d554,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 7048030..30af76d 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 _0x3c85=['remove','emit','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x524211,_0x5b2e50){var _0x123dfe=function(_0x83eebe){while(--_0x83eebe){_0x524211['push'](_0x524211['shift']());}};_0x123dfe(++_0x5b2e50);}(_0x3c85,0x1a0));var _0x53c8=function(_0x4b8408,_0x49ea22){_0x4b8408=_0x4b8408-0x0;var _0x34d205=_0x3c85[_0x4b8408];return _0x34d205;};'use strict';var EventEmitter=require(_0x53c8('0x0'));var UserProfile=require(_0x53c8('0x1'))['db'][_0x53c8('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x53c8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x53c8('0x4')};function emitEvent(_0xcc2f5f){return function(_0x44a11e,_0x4be799,_0x270365){UserProfileEvents[_0x53c8('0x5')](_0xcc2f5f+':'+_0x44a11e['id'],_0x44a11e);UserProfileEvents[_0x53c8('0x5')](_0xcc2f5f,_0x44a11e);_0x270365(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xef4d=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','UserProfile'];(function(_0x862d45,_0x35cfd4){var _0x9f744=function(_0x1a6b5d){while(--_0x1a6b5d){_0x862d45['push'](_0x862d45['shift']());}};_0x9f744(++_0x35cfd4);}(_0xef4d,0x165));var _0xdef4=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xef4d[_0x49ca18];return _0x145d54;};'use strict';var EventEmitter=require(_0xdef4('0x0'));var UserProfile=require(_0xdef4('0x1'))['db'][_0xdef4('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xdef4('0x3')](0x0);var events={'afterCreate':_0xdef4('0x4'),'afterUpdate':_0xdef4('0x5'),'afterDestroy':_0xdef4('0x6')};function emitEvent(_0x313693){return function(_0x71c4c5,_0x267244,_0x2f501c){UserProfileEvents[_0xdef4('0x7')](_0x313693+':'+_0x71c4c5['id'],_0x71c4c5);UserProfileEvents[_0xdef4('0x7')](_0x313693,_0x71c4c5);_0x2f501c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xdef4('0x8')](e,emitEvent(event));}}module[_0xdef4('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 c7196b8..4835cf3 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 _0xeac6=['ZohoAccount','CannedAnswer','Disposition','customdashboards','Dashboard','Pause','sounds','Sound','tags','Tag','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','query','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','pick','key','foreignKey','merge','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count','ids','order','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','rows','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','catch','map','name','resolve','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','ZendeskAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0xeac6,0x1e0));var _0x6eac=function(_0x1423af,_0xfb8fef){_0x1423af=_0x1423af-0x0;var _0x7890a3=_0xeac6[_0x1423af];return _0x7890a3;};'use strict';var _=require(_0x6eac('0x0'));var attributes=require(_0x6eac('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0x6eac('0x2'));module[_0x6eac('0x3')]=function(_0x13be03){var _0x2eb004=_0x13be03[_0x6eac('0x4')];function _0x3dd3f4(_0x497ecc,_0x4a6c5d){return new Promise(function(_0xa13117,_0x35a877){if(!_0x4a6c5d)return _0xa13117(null);var _0x57061b=_0x4a6c5d['filter']?{[_0x4a6c5d[_0x6eac('0x5')][_0x6eac('0x6')]]:_0x4a6c5d[_0x6eac('0x5')][_0x6eac('0x7')]}:undefined;return _0x2eb004[_0x497ecc][_0x6eac('0x8')]({'where':_0x57061b,'raw':!![]})[_0x6eac('0x9')](function(_0x58af1f){_0x4a6c5d[_0x6eac('0xa')]=_['map'](_0x58af1f,'id');_0xa13117(_0x4a6c5d);})[_0x6eac('0xb')](function(_0x4514ec){_0x35a877(_0x4514ec);});});}function _0x49c31d(_0x22e7bf,_0x3731c7){return new Promise(function(_0x221892,_0x4759cf){var _0x287b9d=_0x22e7bf[_0x6eac('0x5')]?{[_0x22e7bf[_0x6eac('0x5')][_0x6eac('0x6')]]:_0x22e7bf[_0x6eac('0x5')][_0x6eac('0x7')]}:undefined;return _0x2eb004[_0x22e7bf['model']][_0x6eac('0x8')]({'where':_0x287b9d,'raw':!![]})['then'](function(_0x5ba3ce){_0x3731c7[_0x6eac('0xa')]=_[_0x6eac('0xc')](_0x5ba3ce,function(_0x4b02c9){return _0x4b02c9[_0x6eac('0xd')];});_0x221892(_0x3731c7);})[_0x6eac('0xb')](function(_0x1ccf1d){_0x4759cf(_0x1ccf1d);});});}function _0xaa0b40(_0x2aa1d2,_0x1dd804,_0x45db1c){if(!_0x1dd804)return Promise[_0x6eac('0xe')](null);return new Promise(function(_0x175602,_0x21cd76){return _0x2eb004['UserProfileResource'][_0x6eac('0x8')]({'where':{'sectionId':_0x1dd804['id']},'raw':!![]})['then'](function(_0x5eede9){if(_0x2aa1d2[_0x6eac('0x6')]&&_0x2aa1d2[_0x6eac('0x6')]!=='id'){_0x1dd804[_0x6eac('0xa')]=_[_0x6eac('0xc')](_0x5eede9,function(_0x48a88c){return _0x48a88c[_0x2aa1d2[_0x6eac('0x6')]];});}else{if(_0x45db1c===_0x6eac('0xf')){_0x1dd804[_0x6eac('0xa')]=_[_0x6eac('0xc')](_0x5eede9,function(_0x351d61){return{'id':_0x351d61['resourceId'],'type':_0x351d61[_0x6eac('0x10')]};});}else{_0x1dd804[_0x6eac('0xa')]=_[_0x6eac('0xc')](_0x5eede9,function(_0x4028bb){return _0x4028bb[_0x6eac('0x11')];});}}_0x175602(_0x1dd804);})[_0x6eac('0xb')](function(_0x120c37){_0x21cd76(_0x120c37);});});}function _0x47b430(_0x6aaf08,_0x5e33de){var _0x568d2a={'parentSections':[]};switch(_0x6aaf08[_0x6eac('0x12')]()){case _0x6eac('0x13'):_0x568d2a['childModel']=_0x6eac('0x14');break;case _0x6eac('0x15'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x17');break;case _0x6eac('0x18'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x19');_0x568d2a['parentSections']=[{'name':_0x6eac('0x1a'),'field':_0x6eac('0xd'),'foreignKey':_0x6eac('0x1b')}];break;case _0x6eac('0x1c'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x1d');break;case _0x6eac('0x1e'):_0x568d2a['childModel']=_0x6eac('0x1f');_0x568d2a[_0x6eac('0x20')]=[{'name':_0x6eac('0x21'),'field':'id','foreignKey':_0x6eac('0x22')}];break;case _0x6eac('0x23'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x24');break;case _0x6eac('0x25'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x26');break;case _0x6eac('0x27'):_0x568d2a['childModel']='CmCustomField';break;case'chatqueues':_0x568d2a['childModel']='ChatQueue';break;case _0x6eac('0x28'):_0x568d2a['childModel']=_0x6eac('0x29');break;case _0x6eac('0x2a'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x2b');break;case _0x6eac('0x2c'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x2d');break;case'inboundroutes':case _0x6eac('0x2e'):case'outboundroutes':_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x2f');break;case _0x6eac('0x30'):_0x568d2a[_0x6eac('0x16')]='VoiceContext';break;case _0x6eac('0x31'):_0x568d2a['childModel']=_0x6eac('0x32');break;case _0x6eac('0x33'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x34');_0x568d2a[_0x6eac('0x20')]=[{'name':_0x6eac('0x35'),'field':'name','foreignKey':_0x6eac('0x36'),'model':'User','filter':{'field':_0x6eac('0x37'),'value':[_0x6eac('0x38')]}},{'name':_0x6eac('0x39'),'field':'name','foreignKey':_0x6eac('0x36'),'model':_0x6eac('0x3a'),'filter':{'field':_0x6eac('0x37'),'value':['telephone']}},{'name':_0x6eac('0x3b'),'field':_0x6eac('0xd'),'foreignKey':_0x6eac('0x3c'),'model':_0x6eac('0x3d'),'filter':{'field':_0x6eac('0x10'),'value':[_0x6eac('0x3e')]}},{'name':_0x6eac('0x3f'),'field':_0x6eac('0xd'),'foreignKey':_0x6eac('0x3c'),'model':_0x6eac('0x3d'),'filter':{'field':_0x6eac('0x10'),'value':[_0x6eac('0x40')]}}];break;case'musiconholds':_0x568d2a['childModel']=_0x6eac('0x41');break;case _0x6eac('0x42'):_0x568d2a['childModel']=_0x6eac('0x43');break;case'voiceprefixes':_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x44');break;case _0x6eac('0x45'):_0x568d2a['childModel']=_0x6eac('0x46');break;case _0x6eac('0x47'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x48');break;case _0x6eac('0x49'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x4a');break;case _0x6eac('0x4b'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x4c');break;case'openchannelqueues':_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x4d');break;case _0x6eac('0x4e'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x4f');break;case _0x6eac('0x50'):_0x568d2a[_0x6eac('0x16')]='SmsQueue';break;case'smsaccounts':_0x568d2a['childModel']=_0x6eac('0x51');break;case _0x6eac('0x52'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x53');break;case'whatsappaccounts':_0x568d2a['childModel']=_0x6eac('0x54');break;case _0x6eac('0x55'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x56');break;case _0x6eac('0x57'):case _0x6eac('0x58'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x3d');if(_0x5e33de){_0x568d2a[_0x6eac('0x20')]=[{'name':_0x6eac('0x3b')},{'name':_0x6eac('0x3f')}];}break;case _0x6eac('0x59'):case _0x6eac('0x5a'):case _0x6eac('0x5b'):_0x568d2a['childModel']=_0x6eac('0x3a');if(_0x5e33de){_0x568d2a['parentSections']=[{'name':_0x6eac('0x5c'),'filter':{'field':'role','value':[_0x6eac('0x5d'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x6eac('0x39')}];}break;case'zendeskaccounts':_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x5e');break;case'salesforceaccounts':_0x568d2a[_0x6eac('0x16')]='SalesforceAccount';break;case _0x6eac('0x5f'):_0x568d2a['childModel']=_0x6eac('0x60');break;case _0x6eac('0x61'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x62');break;case'deskaccounts':_0x568d2a[_0x6eac('0x16')]='DeskAccount';break;case'zohoaccounts':_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x63');break;case'vtigeraccounts':_0x568d2a['childModel']=_0x6eac('0x3a');break;case'cannedanswers':_0x568d2a['childModel']=_0x6eac('0x64');break;case'dispositions':_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x65');break;case _0x6eac('0x66'):_0x568d2a['childModel']=_0x6eac('0x67');break;case'intervals':_0x568d2a[_0x6eac('0x16')]='Interval';break;case'pauses':_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x68');break;case'scheduler':_0x568d2a[_0x6eac('0x16')]='Schedule';break;case _0x6eac('0x69'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x6a');break;case _0x6eac('0x6b'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x6c');break;case _0x6eac('0x6d'):_0x568d2a[_0x6eac('0x16')]='Template';break;case _0x6eac('0x6e'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x6f');break;case _0x6eac('0x70'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x71');break;case _0x6eac('0x72'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x73');break;case _0x6eac('0x74'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x75');break;case _0x6eac('0x76'):_0x568d2a[_0x6eac('0x16')]='AnalyticExtractedReport';_0x568d2a[_0x6eac('0x20')]=[{'name':_0x6eac('0x77'),'field':'id','foreignKey':_0x6eac('0x78')}];break;case _0x6eac('0x79'):_0x568d2a[_0x6eac('0x16')]=_0x6eac('0x7a');break;}return _0x568d2a;}function _0x489120(_0x4cc47c,_0x3094d8){var _0x3aea7e=_0x4cc47c[_0x6eac('0x7b')](0x0)[_0x6eac('0x7c')]()+_0x4cc47c[_0x6eac('0x7d')](0x1);var _0x217108={'type':_0x2eb004[_0x6eac('0x7e')][_0x6eac('0x7f')][_0x6eac('0x80')],'raw':!![]};return new Promise(function(_0xf94bc2,_0x5005c9){var _0x45606d=squel[_0x6eac('0x81')]()[_0x6eac('0x6')](_0x6eac('0x82')+_0x3aea7e+_0x6eac('0x83'),'id')['field']('ui.createdAt')[_0x6eac('0x84')](_0x6eac('0x85')+_0x4cc47c+'_interactions','ui')[_0x6eac('0x86')](_0x6eac('0x87'),_0x3094d8['id']);return _0x2eb004[_0x6eac('0x88')]['query'](_0x45606d[_0x6eac('0x89')](),_0x217108)[_0x6eac('0x9')](function(_0x379c52){_0x3094d8[_0x3aea7e+_0x6eac('0x8a')]=_0x379c52;_0xf94bc2(_0x379c52);})[_0x6eac('0xb')](function(_0x207616){_0x5005c9(_0x207616);});});}return _0x13be03[_0x6eac('0x8b')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x46c5fd){var _0xc8323e={'raw':_0x46c5fd[_0x6eac('0x8c')]['raw'],'where':{}};var _0x4b78e8={};var _0xf540d9={'count':0x0,'rows':[]};var _0x4f2ba3=_0x46c5fd[_0x6eac('0x8c')]['section'];var _0x22d40a=_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0x8d')]||![];var _0x55e72f=_0x47b430(_0x4f2ba3,_0x22d40a);if(!_0x55e72f[_0x6eac('0x16')])throw new Error(_0x6eac('0x8e')+_0x4f2ba3+'\x27');var _0x4b201f=[{'name':_0x4f2ba3}];if(!_[_0x6eac('0x8f')](_0x55e72f[_0x6eac('0x20')]))_0x4b201f=_0x55e72f[_0x6eac('0x20')];var _0x4c518d=[];for(var _0x3570ab=0x0;_0x3570ab<_0x4b201f[_0x6eac('0x90')];_0x3570ab++){_0x4c518d[_0x6eac('0x91')](_0x2eb004['UserProfileSection'][_0x6eac('0x92')]({'where':{'userProfileId':_0x46c5fd['params']['id'],'name':_0x4b201f[_0x3570ab][_0x6eac('0xd')]},'raw':!![]}));}return Promise[_0x6eac('0x93')](_0x4c518d)[_0x6eac('0x9')](function(_0x41e35c){var _0x1ac91c=_[_0x6eac('0x5')](_0x41e35c,function(_0x4e482f){return _0x4e482f?_0x4e482f:undefined;});var _0x2ceb11=_[_0x6eac('0x5')](_0x4b201f,[_0x6eac('0x94'),!![]]);var _0x25f41f=_[_0x6eac('0x8f')](_0x1ac91c)&&_[_0x6eac('0x8f')](_0x2ceb11)?null:_[_0x6eac('0x95')](_0x2ceb11,_0x1ac91c);if(!_0x25f41f)return null;var _0x37b884=[];for(var _0x2e39ab=0x0;_0x2e39ab<_0x25f41f[_0x6eac('0x90')];_0x2e39ab++){var _0xc82183=_[_0x6eac('0x92')](_0x4b201f,function(_0x255fd5){return _0x25f41f[_0x2e39ab]?_0x255fd5[_0x6eac('0xd')]===_0x25f41f[_0x2e39ab][_0x6eac('0xd')]:null;});if(_0xc82183){if(_0x25f41f[_0x2e39ab][_0x6eac('0x94')]){_0x37b884['push'](_0x3dd3f4(_0x55e72f[_0x6eac('0x16')],_0x25f41f[_0x2e39ab]));}else{if(!_0x25f41f[_0x2e39ab][_0x6eac('0x96')]){_0x37b884[_0x6eac('0x91')](_0xaa0b40(_0xc82183,_0x25f41f[_0x2e39ab],_0x55e72f['childModel']));}else{if(_0xc82183['model']){_0x37b884[_0x6eac('0x91')](_0x49c31d(_0xc82183,_0x25f41f[_0x2e39ab]));}}}}}return Promise[_0x6eac('0x93')](_0x37b884);})[_0x6eac('0x9')](function(_0x3a118e){var _0x4715e2=_0x3a118e;var _0x222302=null;if(_0x4715e2){_0x222302=_0x4715e2[_0x6eac('0x90')]===0x1?_0x4715e2[0x0]:null;}if(!_0x222302&&!_0x4715e2)return _0xf540d9;var _0x57eaf6=_0x2eb004[_0x55e72f[_0x6eac('0x16')]][_0x6eac('0x97')];_0x4b78e8[_0x6eac('0x98')]=_['keys'](_0x57eaf6);_0x4b78e8[_0x6eac('0x8c')]=_[_0x6eac('0x99')](_0x46c5fd['query']);_0x4b78e8[_0x6eac('0x9a')]=_[_0x6eac('0x9b')](_0x4b78e8[_0x6eac('0x98')],_0x4b78e8[_0x6eac('0x8c')]);_0xc8323e[_0x6eac('0x9c')]=_[_0x6eac('0x9b')](_0x4b78e8['model'],qs[_0x6eac('0x9d')](_0x46c5fd['query']['fields']));_0xc8323e['attributes']=_0xc8323e[_0x6eac('0x9c')][_0x6eac('0x90')]?_0xc8323e[_0x6eac('0x9c')]:_0x4b78e8[_0x6eac('0x98')];if(!_0x46c5fd[_0x6eac('0x8c')]['hasOwnProperty'](_0x6eac('0x9e'))){_0xc8323e[_0x6eac('0x9f')]=qs[_0x6eac('0x9f')](_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0x9f')]);_0xc8323e[_0x6eac('0xa0')]=qs[_0x6eac('0xa0')](_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0xa0')]);}_0xc8323e['order']=qs[_0x6eac('0xa1')](_0x46c5fd[_0x6eac('0x8c')]['sort']);_0xc8323e[_0x6eac('0x86')]=qs['filters'](_[_0x6eac('0xa2')](_0x46c5fd[_0x6eac('0x8c')],_0x4b78e8['filters']));if(_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0x5')]){_0xc8323e[_0x6eac('0x86')]=_['merge'](_0xc8323e['where'],{'$or':_[_0x6eac('0xc')](_0x57eaf6,function(_0x411533){if(_0x411533[_0x6eac('0x10')][_0x6eac('0xa3')]!=='VIRTUAL'){var _0x67c393={};_0x67c393[_0x411533['field']]={'$like':'%'+_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0x5')]+'%'};return _0x67c393;}})});}var _0x2d8a68=[];var _0x24eb2d=null;var _0x292924={};if(_0x222302){_0x24eb2d=_['find'](_0x4b201f,[_0x6eac('0xd'),_0x222302['name']]);if(_0x24eb2d['field']){_0x292924={};if(_0x55e72f[_0x6eac('0x16')]===_0x6eac('0xf')){_0x292924[_0x24eb2d[_0x6eac('0xa4')]]=_[_0x6eac('0xc')](_0x222302['associatedResources'],'id');}else{_0x292924[_0x24eb2d['foreignKey']]=_0x222302[_0x6eac('0xa')];}_0x2d8a68[_0x6eac('0x91')](_0x292924);}else{_0xc8323e[_0x6eac('0x86')]['id']=_0x222302['associatedResources'];}}else{for(var _0x11c241=0x0;_0x11c241<_0x4715e2[_0x6eac('0x90')];_0x11c241++){_0x24eb2d=_[_0x6eac('0x92')](_0x4b201f,[_0x6eac('0xd'),_0x4715e2[_0x11c241][_0x6eac('0xd')]]);if(_0x24eb2d[_0x6eac('0x6')]){_0x292924={};_0x292924[_0x24eb2d[_0x6eac('0xa4')]]=_0x4715e2[_0x11c241][_0x6eac('0xa')];_0x2d8a68[_0x6eac('0x91')](_0x292924);}else{if(!_0xc8323e[_0x6eac('0x86')]['id'])_0xc8323e[_0x6eac('0x86')]['id']=[];_0x4715e2[_0x11c241][_0x6eac('0xa')]['forEach'](function(_0x177a1a){_0xc8323e[_0x6eac('0x86')]['id'][_0x6eac('0x91')](_0x177a1a);});}}}if(!_[_0x6eac('0x8f')](_0x2d8a68)){_0xc8323e[_0x6eac('0x86')]=_[_0x6eac('0xa5')](_0xc8323e[_0x6eac('0x86')],{'$and':{'$or':_0x2d8a68}});}_0xc8323e=_[_0x6eac('0xa5')]({},_0xc8323e,_0x46c5fd[_0x6eac('0xa6')]);if(_0x222302&&!_0x222302[_0x6eac('0x96')]&&_0x55e72f[_0x6eac('0x16')]===_0x6eac('0xf')){if(_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0xa7')]){_0xc8323e[_0x6eac('0xa8')]=[{'all':!![]}];}return _0x2eb004[_0x55e72f['childModel']][_0x6eac('0x8')](_0xc8323e)[_0x6eac('0x9')](function(_0x3bca09){var _0x4bfab6=[];_0x3bca09[_0x6eac('0xa9')](function(_0xac94cc){var _0x4abae7;switch(_0xac94cc[_0x6eac('0xaa')]){case _0x6eac('0xab'):_0x4abae7=_[_0x6eac('0x92')](_0x222302[_0x6eac('0xa')],function(_0x71f50c){return _0x71f50c['id']===_0xac94cc[_0x6eac('0x78')]&&_0x71f50c['type']===_0x6eac('0xac');});break;case _0x6eac('0xad'):_0x4abae7=_['find'](_0x222302['associatedResources'],function(_0x318f48){return _0x318f48['id']===_0xac94cc[_0x6eac('0x78')]&&_0x318f48[_0x6eac('0x10')]===_0x6eac('0xae');});break;}if(_0x4abae7)_0x4bfab6[_0x6eac('0x91')](_0xac94cc);});_0xf540d9[_0x6eac('0xaf')]=_0x4bfab6[_0x6eac('0x90')];_0xf540d9['rows']=_0x4bfab6;return _0xf540d9;});}else{if(!_[_0x6eac('0x8f')](_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0xb0')])){_0xc8323e['where']['id']=_0xc8323e[_0x6eac('0x86')]['id']?_[_0x6eac('0x9b')](_0xc8323e[_0x6eac('0x86')]['id'],_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0xb0')]):_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0xb0')];if(_0x46c5fd['query']['customSorting']){_0xc8323e[_0x6eac('0xb1')]=_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0xb2')];}}if(_0x46c5fd['query'][_0x6eac('0xb3')]){_0xc8323e[_0x6eac('0x86')]=_[_0x6eac('0xa5')](_0xc8323e[_0x6eac('0x86')],{'$and':_0x46c5fd['query'][_0x6eac('0xb3')]});}return _0x2eb004[_0x55e72f[_0x6eac('0x16')]]['count']({'where':_0xc8323e[_0x6eac('0x86')]})[_0x6eac('0x9')](function(_0x18c28e){_0xf540d9[_0x6eac('0xaf')]=_0x18c28e;if(_0x46c5fd['query'][_0x6eac('0xa7')]){if(_0x55e72f[_0x6eac('0x16')]===_0x6eac('0x1f')){_0xc8323e[_0x6eac('0xa8')]=[{'model':_0x2eb004[_0x6eac('0x6c')],'as':_0x6eac('0xb4'),'attributes':['id',_0x6eac('0xd'),_0x6eac('0xb5')],'required':_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0xb6')]?!![]:![]},{'model':_0x2eb004['Tag'],'as':_0x6eac('0xb7'),'attributes':['id',_0x6eac('0xd'),'color'],'through':_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0xb6')]?{'attributes':[],'where':{'TagId':_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0xb6')]||undefined}}:{},'required':_0x46c5fd[_0x6eac('0x8c')]['tag']?!![]:![]}];}else{_0xc8323e[_0x6eac('0xa8')]=[{'all':!![]}];}}return _0x2eb004[_0x55e72f[_0x6eac('0x16')]]['findAll'](_0xc8323e);})['then'](function(_0x4fe698){_0xf540d9[_0x6eac('0xb8')]=_0x4fe698;if(_0x4f2ba3===_0x6eac('0x35')&&_0x46c5fd[_0x6eac('0x8c')][_0x6eac('0xb9')]===_0x6eac('0xba')){var _0x25f8ee=[];for(var _0x4a7613=0x0;_0x4a7613<_0xf540d9[_0x6eac('0xb8')][_0x6eac('0x90')];_0x4a7613++){_0x25f8ee[_0x6eac('0x91')](_0x489120(_0x6eac('0xbb'),_0xf540d9['rows'][_0x4a7613][_0x6eac('0xbc')]));_0x25f8ee[_0x6eac('0x91')](_0x489120(_0x6eac('0xbd'),_0xf540d9[_0x6eac('0xb8')][_0x4a7613]['dataValues']));_0x25f8ee['push'](_0x489120(_0x6eac('0xbe'),_0xf540d9[_0x6eac('0xb8')][_0x4a7613][_0x6eac('0xbc')]));_0x25f8ee[_0x6eac('0x91')](_0x489120(_0x6eac('0xbf'),_0xf540d9[_0x6eac('0xb8')][_0x4a7613][_0x6eac('0xbc')]));_0x25f8ee[_0x6eac('0x91')](_0x489120(_0x6eac('0xc0'),_0xf540d9['rows'][_0x4a7613]['dataValues']));_0x25f8ee['push'](_0x489120('whatsapp',_0xf540d9[_0x6eac('0xb8')][_0x4a7613]['dataValues']));}return Promise[_0x6eac('0x93')](_0x25f8ee)[_0x6eac('0x9')](function(){return _0xf540d9;});}return _0xf540d9;});}});}}});}; \ No newline at end of file +var _0xed0e=['tag','Tag','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','value','findAll','then','associatedResources','map','field','model','catch','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','parentSections','SquareProjects','name','projects','contacts','Lists','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','membername','User','role','telephone','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','QueueCampaigns','users','agents','telephones','Users','user','Agents','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Pause','scheduler','Schedule','sounds','tags','templates','triggers','trunks','variables','plugins','Plugin','extractedreports','Reports','metrics','charAt','toUpperCase','Sequelize','SELECT','select','ui.','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','all','ignore','find','autoAssociation','rawAttributes','keys','attributes','intersection','fields','limit','offset','order','sort','filters','pick','merge','VIRTUAL','foreignKey','forEach','includeAll','reportType','default','reportId','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','include','Tags','color'];(function(_0x57532c,_0x2c75cf){var _0x5cb9a6=function(_0x3a4dea){while(--_0x3a4dea){_0x57532c['push'](_0x57532c['shift']());}};_0x5cb9a6(++_0x2c75cf);}(_0xed0e,0xc2));var _0xeed0=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xed0e[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var attributes=require(_0xeed0('0x0'));var qs=require(_0xeed0('0x1'));var squel=require(_0xeed0('0x2'));module[_0xeed0('0x3')]=function(_0x2798a2){var _0x198f3a=_0x2798a2[_0xeed0('0x4')];function _0x3e0f3a(_0x8c091f,_0x4cb7ba){return new Promise(function(_0x5d61f7,_0x2e3240){if(!_0x4cb7ba)return _0x5d61f7(null);var _0xc5b240=_0x4cb7ba[_0xeed0('0x5')]?{[_0x4cb7ba['filter']['field']]:_0x4cb7ba[_0xeed0('0x5')][_0xeed0('0x6')]}:undefined;return _0x198f3a[_0x8c091f][_0xeed0('0x7')]({'where':_0xc5b240,'raw':!![]})[_0xeed0('0x8')](function(_0x5165fd){_0x4cb7ba[_0xeed0('0x9')]=_[_0xeed0('0xa')](_0x5165fd,'id');_0x5d61f7(_0x4cb7ba);})['catch'](function(_0x4dd644){_0x2e3240(_0x4dd644);});});}function _0xc44cc7(_0x16e37e,_0x1b9378){return new Promise(function(_0xef3bcf,_0x17956b){var _0x39b605=_0x16e37e[_0xeed0('0x5')]?{[_0x16e37e[_0xeed0('0x5')][_0xeed0('0xb')]]:_0x16e37e[_0xeed0('0x5')]['value']}:undefined;return _0x198f3a[_0x16e37e[_0xeed0('0xc')]][_0xeed0('0x7')]({'where':_0x39b605,'raw':!![]})[_0xeed0('0x8')](function(_0x3fe26e){_0x1b9378['associatedResources']=_[_0xeed0('0xa')](_0x3fe26e,function(_0x18bd25){return _0x18bd25['name'];});_0xef3bcf(_0x1b9378);})[_0xeed0('0xd')](function(_0x5e1fd7){_0x17956b(_0x5e1fd7);});});}function _0xaeb6ce(_0x5f1723,_0xe11489,_0x28655c){if(!_0xe11489)return Promise[_0xeed0('0xe')](null);return new Promise(function(_0x5c4da0,_0x4cc34b){return _0x198f3a[_0xeed0('0xf')]['findAll']({'where':{'sectionId':_0xe11489['id']},'raw':!![]})[_0xeed0('0x8')](function(_0xaf4b39){if(_0x5f1723[_0xeed0('0xb')]&&_0x5f1723[_0xeed0('0xb')]!=='id'){_0xe11489[_0xeed0('0x9')]=_[_0xeed0('0xa')](_0xaf4b39,function(_0x2c87ef){return _0x2c87ef[_0x5f1723[_0xeed0('0xb')]];});}else{if(_0x28655c===_0xeed0('0x10')){_0xe11489[_0xeed0('0x9')]=_[_0xeed0('0xa')](_0xaf4b39,function(_0x3fca1c){return{'id':_0x3fca1c['resourceId'],'type':_0x3fca1c[_0xeed0('0x11')]};});}else{_0xe11489[_0xeed0('0x9')]=_[_0xeed0('0xa')](_0xaf4b39,function(_0x55da07){return _0x55da07[_0xeed0('0x12')];});}}_0x5c4da0(_0xe11489);})['catch'](function(_0x1a9955){_0x4cc34b(_0x1a9955);});});}function _0x15d431(_0x52be2b,_0x4f0885){var _0x149f98={'parentSections':[]};switch(_0x52be2b[_0xeed0('0x13')]()){case _0xeed0('0x14'):_0x149f98[_0xeed0('0x15')]='SquareProject';break;case'odbc':_0x149f98['childModel']='SquareOdbc';break;case'squarerecordings':_0x149f98['childModel']='SquareRecording';_0x149f98[_0xeed0('0x16')]=[{'name':_0xeed0('0x17'),'field':_0xeed0('0x18'),'foreignKey':'projectName'}];break;case _0xeed0('0x19'):_0x149f98['childModel']='JscriptyProject';break;case _0xeed0('0x1a'):_0x149f98['childModel']='CmContact';_0x149f98['parentSections']=[{'name':_0xeed0('0x1b'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x149f98[_0xeed0('0x15')]='CmList';break;case'companies':_0x149f98[_0xeed0('0x15')]=_0xeed0('0x1c');break;case _0xeed0('0x1d'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x1e');break;case _0xeed0('0x1f'):_0x149f98['childModel']=_0xeed0('0x20');break;case _0xeed0('0x21'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x22');break;case'faxqueues':_0x149f98['childModel']=_0xeed0('0x23');break;case _0xeed0('0x24'):_0x149f98[_0xeed0('0x15')]='FaxAccount';break;case'inboundroutes':case _0xeed0('0x25'):case _0xeed0('0x26'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x27');break;case _0xeed0('0x28'):_0x149f98['childModel']='VoiceContext';break;case _0xeed0('0x29'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x2a');break;case _0xeed0('0x2b'):_0x149f98[_0xeed0('0x15')]='VoiceRecording';_0x149f98['parentSections']=[{'name':'Agents','field':_0xeed0('0x18'),'foreignKey':_0xeed0('0x2c'),'model':_0xeed0('0x2d'),'filter':{'field':_0xeed0('0x2e'),'value':['agent']}},{'name':'Telephones','field':_0xeed0('0x18'),'foreignKey':_0xeed0('0x2c'),'model':_0xeed0('0x2d'),'filter':{'field':_0xeed0('0x2e'),'value':[_0xeed0('0x2f')]}},{'name':'VoiceQueues','field':_0xeed0('0x18'),'foreignKey':_0xeed0('0x30'),'model':_0xeed0('0x31'),'filter':{'field':_0xeed0('0x11'),'value':[_0xeed0('0x32')]}},{'name':'QueueCampaigns','field':_0xeed0('0x18'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0xeed0('0x11'),'value':[_0xeed0('0x33')]}}];break;case _0xeed0('0x34'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x35');break;case'chanspies':_0x149f98['childModel']=_0xeed0('0x36');break;case _0xeed0('0x37'):_0x149f98[_0xeed0('0x15')]='VoicePrefix';break;case'ivrcampaigns':_0x149f98[_0xeed0('0x15')]='Campaign';break;case _0xeed0('0x38'):_0x149f98['childModel']=_0xeed0('0x39');break;case _0xeed0('0x3a'):_0x149f98[_0xeed0('0x15')]='MailAccount';break;case _0xeed0('0x3b'):_0x149f98['childModel']=_0xeed0('0x3c');break;case'openchannelqueues':_0x149f98[_0xeed0('0x15')]=_0xeed0('0x3d');break;case _0xeed0('0x3e'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x3f');break;case _0xeed0('0x40'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x41');break;case _0xeed0('0x42'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x43');break;case _0xeed0('0x44'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x45');break;case _0xeed0('0x46'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x47');break;case _0xeed0('0x48'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x49');break;case _0xeed0('0x4a'):case _0xeed0('0x4b'):_0x149f98['childModel']=_0xeed0('0x31');if(_0x4f0885){_0x149f98[_0xeed0('0x16')]=[{'name':_0xeed0('0x4c')},{'name':_0xeed0('0x4d')}];}break;case _0xeed0('0x4e'):case _0xeed0('0x4f'):case _0xeed0('0x50'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x2d');if(_0x4f0885){_0x149f98[_0xeed0('0x16')]=[{'name':_0xeed0('0x51'),'filter':{'field':_0xeed0('0x2e'),'value':['admin',_0xeed0('0x52')]},'ignore':!![]},{'name':_0xeed0('0x53')},{'name':_0xeed0('0x54')}];}break;case _0xeed0('0x55'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x56');break;case _0xeed0('0x57'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x58');break;case _0xeed0('0x59'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x5a');break;case'sugarcrmaccounts':_0x149f98[_0xeed0('0x15')]='SugarcrmAccount';break;case _0xeed0('0x5b'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x5c');break;case _0xeed0('0x5d'):_0x149f98['childModel']='ZohoAccount';break;case'vtigeraccounts':_0x149f98['childModel']='User';break;case _0xeed0('0x5e'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x5f');break;case _0xeed0('0x60'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x61');break;case _0xeed0('0x62'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x63');break;case _0xeed0('0x64'):_0x149f98[_0xeed0('0x15')]='Interval';break;case'pauses':_0x149f98[_0xeed0('0x15')]=_0xeed0('0x65');break;case _0xeed0('0x66'):_0x149f98['childModel']=_0xeed0('0x67');break;case _0xeed0('0x68'):_0x149f98[_0xeed0('0x15')]='Sound';break;case _0xeed0('0x69'):_0x149f98[_0xeed0('0x15')]='Tag';break;case _0xeed0('0x6a'):_0x149f98[_0xeed0('0x15')]='Template';break;case _0xeed0('0x6b'):_0x149f98['childModel']='Trigger';break;case _0xeed0('0x6c'):_0x149f98[_0xeed0('0x15')]='Trunk';break;case _0xeed0('0x6d'):_0x149f98['childModel']='Variable';break;case _0xeed0('0x6e'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x6f');break;case _0xeed0('0x70'):_0x149f98[_0xeed0('0x15')]=_0xeed0('0x10');_0x149f98[_0xeed0('0x16')]=[{'name':_0xeed0('0x71'),'field':'id','foreignKey':'reportId'}];break;case _0xeed0('0x72'):_0x149f98[_0xeed0('0x15')]='AnalyticMetric';break;}return _0x149f98;}function _0x42bcdf(_0x59e78e,_0x3fd34b){var _0x3a82ff=_0x59e78e[_0xeed0('0x73')](0x0)[_0xeed0('0x74')]()+_0x59e78e['slice'](0x1);var _0x2f466a={'type':_0x198f3a[_0xeed0('0x75')]['QueryTypes'][_0xeed0('0x76')],'raw':!![]};return new Promise(function(_0xbc506e,_0x4b30c2){var _0x312453=squel[_0xeed0('0x77')]()['field'](_0xeed0('0x78')+_0x3a82ff+'InteractionId','id')[_0xeed0('0xb')]('ui.createdAt')['from'](_0xeed0('0x79')+_0x59e78e+_0xeed0('0x7a'),'ui')[_0xeed0('0x7b')](_0xeed0('0x7c'),_0x3fd34b['id']);return _0x198f3a['sequelize'][_0xeed0('0x7d')](_0x312453[_0xeed0('0x7e')](),_0x2f466a)[_0xeed0('0x8')](function(_0x3631d1){_0x3fd34b[_0x3a82ff+_0xeed0('0x7f')]=_0x3631d1;_0xbc506e(_0x3631d1);})[_0xeed0('0xd')](function(_0x42cabf){_0x4b30c2(_0x42cabf);});});}return _0x2798a2[_0xeed0('0x80')](_0xeed0('0x81'),attributes,{'tableName':_0xeed0('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x298dfc){var _0x814b29={'raw':_0x298dfc[_0xeed0('0x7d')][_0xeed0('0x83')],'where':{}};var _0x2aa070={};var _0x28606f={'count':0x0,'rows':[]};var _0x5c7575=_0x298dfc[_0xeed0('0x7d')][_0xeed0('0x84')];var _0x5b21eb=_0x298dfc['query'][_0xeed0('0x85')]||![];var _0x1ef598=_0x15d431(_0x5c7575,_0x5b21eb);if(!_0x1ef598[_0xeed0('0x15')])throw new Error(_0xeed0('0x86')+_0x5c7575+'\x27');var _0x27ed2b=[{'name':_0x5c7575}];if(!_[_0xeed0('0x87')](_0x1ef598[_0xeed0('0x16')]))_0x27ed2b=_0x1ef598[_0xeed0('0x16')];var _0xb183a=[];for(var _0x13c439=0x0;_0x13c439<_0x27ed2b[_0xeed0('0x88')];_0x13c439++){_0xb183a[_0xeed0('0x89')](_0x198f3a[_0xeed0('0x8a')]['find']({'where':{'userProfileId':_0x298dfc[_0xeed0('0x8b')]['id'],'name':_0x27ed2b[_0x13c439][_0xeed0('0x18')]},'raw':!![]}));}return Promise[_0xeed0('0x8c')](_0xb183a)['then'](function(_0x3d6d8d){var _0x394988=_['filter'](_0x3d6d8d,function(_0x43b09f){return _0x43b09f?_0x43b09f:undefined;});var _0x2a104b=_['filter'](_0x27ed2b,[_0xeed0('0x8d'),!![]]);var _0x51d90e=_[_0xeed0('0x87')](_0x394988)&&_[_0xeed0('0x87')](_0x2a104b)?null:_['union'](_0x2a104b,_0x394988);if(!_0x51d90e)return null;var _0x1d6129=[];for(var _0x2bfc68=0x0;_0x2bfc68<_0x51d90e['length'];_0x2bfc68++){var _0x412e90=_[_0xeed0('0x8e')](_0x27ed2b,function(_0xebff6b){return _0x51d90e[_0x2bfc68]?_0xebff6b[_0xeed0('0x18')]===_0x51d90e[_0x2bfc68]['name']:null;});if(_0x412e90){if(_0x51d90e[_0x2bfc68][_0xeed0('0x8d')]){_0x1d6129[_0xeed0('0x89')](_0x3e0f3a(_0x1ef598[_0xeed0('0x15')],_0x51d90e[_0x2bfc68]));}else{if(!_0x51d90e[_0x2bfc68][_0xeed0('0x8f')]){_0x1d6129[_0xeed0('0x89')](_0xaeb6ce(_0x412e90,_0x51d90e[_0x2bfc68],_0x1ef598[_0xeed0('0x15')]));}else{if(_0x412e90[_0xeed0('0xc')]){_0x1d6129[_0xeed0('0x89')](_0xc44cc7(_0x412e90,_0x51d90e[_0x2bfc68]));}}}}}return Promise[_0xeed0('0x8c')](_0x1d6129);})['then'](function(_0x28921f){var _0x42278e=_0x28921f;var _0x5e1af1=null;if(_0x42278e){_0x5e1af1=_0x42278e[_0xeed0('0x88')]===0x1?_0x42278e[0x0]:null;}if(!_0x5e1af1&&!_0x42278e)return _0x28606f;var _0x351663=_0x198f3a[_0x1ef598[_0xeed0('0x15')]][_0xeed0('0x90')];_0x2aa070['model']=_[_0xeed0('0x91')](_0x351663);_0x2aa070[_0xeed0('0x7d')]=_['keys'](_0x298dfc['query']);_0x2aa070['filters']=_['intersection'](_0x2aa070[_0xeed0('0xc')],_0x2aa070[_0xeed0('0x7d')]);_0x814b29[_0xeed0('0x92')]=_[_0xeed0('0x93')](_0x2aa070['model'],qs[_0xeed0('0x94')](_0x298dfc[_0xeed0('0x7d')][_0xeed0('0x94')]));_0x814b29[_0xeed0('0x92')]=_0x814b29[_0xeed0('0x92')][_0xeed0('0x88')]?_0x814b29[_0xeed0('0x92')]:_0x2aa070['model'];if(!_0x298dfc[_0xeed0('0x7d')]['hasOwnProperty']('nolimit')){_0x814b29[_0xeed0('0x95')]=qs['limit'](_0x298dfc[_0xeed0('0x7d')][_0xeed0('0x95')]);_0x814b29[_0xeed0('0x96')]=qs['offset'](_0x298dfc[_0xeed0('0x7d')][_0xeed0('0x96')]);}_0x814b29[_0xeed0('0x97')]=qs[_0xeed0('0x98')](_0x298dfc['query']['sort']);_0x814b29['where']=qs[_0xeed0('0x99')](_[_0xeed0('0x9a')](_0x298dfc[_0xeed0('0x7d')],_0x2aa070[_0xeed0('0x99')]));if(_0x298dfc[_0xeed0('0x7d')][_0xeed0('0x5')]){_0x814b29[_0xeed0('0x7b')]=_[_0xeed0('0x9b')](_0x814b29[_0xeed0('0x7b')],{'$or':_[_0xeed0('0xa')](_0x351663,function(_0x1e1fe0){if(_0x1e1fe0[_0xeed0('0x11')]['key']!==_0xeed0('0x9c')){var _0x272e18={};_0x272e18[_0x1e1fe0[_0xeed0('0xb')]]={'$like':'%'+_0x298dfc[_0xeed0('0x7d')][_0xeed0('0x5')]+'%'};return _0x272e18;}})});}var _0x4b9c06=[];var _0x4cd565=null;var _0x5b2379={};if(_0x5e1af1){_0x4cd565=_[_0xeed0('0x8e')](_0x27ed2b,[_0xeed0('0x18'),_0x5e1af1['name']]);if(_0x4cd565[_0xeed0('0xb')]){_0x5b2379={};if(_0x1ef598[_0xeed0('0x15')]===_0xeed0('0x10')){_0x5b2379[_0x4cd565[_0xeed0('0x9d')]]=_[_0xeed0('0xa')](_0x5e1af1[_0xeed0('0x9')],'id');}else{_0x5b2379[_0x4cd565[_0xeed0('0x9d')]]=_0x5e1af1['associatedResources'];}_0x4b9c06['push'](_0x5b2379);}else{_0x814b29[_0xeed0('0x7b')]['id']=_0x5e1af1[_0xeed0('0x9')];}}else{for(var _0x3a87c8=0x0;_0x3a87c8<_0x42278e[_0xeed0('0x88')];_0x3a87c8++){_0x4cd565=_[_0xeed0('0x8e')](_0x27ed2b,[_0xeed0('0x18'),_0x42278e[_0x3a87c8][_0xeed0('0x18')]]);if(_0x4cd565[_0xeed0('0xb')]){_0x5b2379={};_0x5b2379[_0x4cd565[_0xeed0('0x9d')]]=_0x42278e[_0x3a87c8][_0xeed0('0x9')];_0x4b9c06[_0xeed0('0x89')](_0x5b2379);}else{if(!_0x814b29['where']['id'])_0x814b29[_0xeed0('0x7b')]['id']=[];_0x42278e[_0x3a87c8][_0xeed0('0x9')][_0xeed0('0x9e')](function(_0x122306){_0x814b29[_0xeed0('0x7b')]['id'][_0xeed0('0x89')](_0x122306);});}}}if(!_[_0xeed0('0x87')](_0x4b9c06)){_0x814b29['where']=_[_0xeed0('0x9b')](_0x814b29[_0xeed0('0x7b')],{'$and':{'$or':_0x4b9c06}});}_0x814b29=_['merge']({},_0x814b29,_0x298dfc['options']);if(_0x5e1af1&&!_0x5e1af1['autoAssociation']&&_0x1ef598[_0xeed0('0x15')]===_0xeed0('0x10')){if(_0x298dfc[_0xeed0('0x7d')][_0xeed0('0x9f')]){_0x814b29['include']=[{'all':!![]}];}return _0x198f3a[_0x1ef598[_0xeed0('0x15')]]['findAll'](_0x814b29)[_0xeed0('0x8')](function(_0xa94c51){var _0x212797=[];_0xa94c51[_0xeed0('0x9e')](function(_0x1353b9){var _0x2c3079;switch(_0x1353b9[_0xeed0('0xa0')]){case _0xeed0('0xa1'):_0x2c3079=_[_0xeed0('0x8e')](_0x5e1af1[_0xeed0('0x9')],function(_0x1e1372){return _0x1e1372['id']===_0x1353b9[_0xeed0('0xa2')]&&_0x1e1372[_0xeed0('0x11')]===_0xeed0('0xa3');});break;case _0xeed0('0xa4'):_0x2c3079=_[_0xeed0('0x8e')](_0x5e1af1[_0xeed0('0x9')],function(_0x577b60){return _0x577b60['id']===_0x1353b9[_0xeed0('0xa2')]&&_0x577b60[_0xeed0('0x11')]===_0xeed0('0xa5');});break;}if(_0x2c3079)_0x212797['push'](_0x1353b9);});_0x28606f['count']=_0x212797[_0xeed0('0x88')];_0x28606f[_0xeed0('0xa6')]=_0x212797;return _0x28606f;});}else{if(!_[_0xeed0('0x87')](_0x298dfc['query'][_0xeed0('0xa7')])){_0x814b29[_0xeed0('0x7b')]['id']=_0x814b29[_0xeed0('0x7b')]['id']?_['intersection'](_0x814b29[_0xeed0('0x7b')]['id'],_0x298dfc[_0xeed0('0x7d')][_0xeed0('0xa7')]):_0x298dfc[_0xeed0('0x7d')][_0xeed0('0xa7')];if(_0x298dfc[_0xeed0('0x7d')][_0xeed0('0xa8')]){_0x814b29[_0xeed0('0x97')]=_0x298dfc['query'][_0xeed0('0xa8')];}}if(_0x298dfc[_0xeed0('0x7d')][_0xeed0('0xa9')]){_0x814b29[_0xeed0('0x7b')]=_['merge'](_0x814b29[_0xeed0('0x7b')],{'$and':_0x298dfc[_0xeed0('0x7d')][_0xeed0('0xa9')]});}return _0x198f3a[_0x1ef598[_0xeed0('0x15')]][_0xeed0('0xaa')]({'where':_0x814b29[_0xeed0('0x7b')]})[_0xeed0('0x8')](function(_0x18dc43){_0x28606f['count']=_0x18dc43;if(_0x298dfc['query']['includeAll']){if(_0x1ef598[_0xeed0('0x15')]==='CmContact'){_0x814b29[_0xeed0('0xab')]=[{'model':_0x198f3a['Tag'],'as':_0xeed0('0xac'),'attributes':['id','name',_0xeed0('0xad')],'required':_0x298dfc[_0xeed0('0x7d')][_0xeed0('0xae')]?!![]:![]},{'model':_0x198f3a[_0xeed0('0xaf')],'as':'ThroughTags','attributes':['id',_0xeed0('0x18'),_0xeed0('0xad')],'through':_0x298dfc[_0xeed0('0x7d')][_0xeed0('0xae')]?{'attributes':[],'where':{'TagId':_0x298dfc[_0xeed0('0x7d')][_0xeed0('0xae')]||undefined}}:{},'required':_0x298dfc[_0xeed0('0x7d')][_0xeed0('0xae')]?!![]:![]}];}else{_0x814b29['include']=[{'all':!![]}];}}return _0x198f3a[_0x1ef598[_0xeed0('0x15')]]['findAll'](_0x814b29);})[_0xeed0('0x8')](function(_0x2e3f7f){_0x28606f[_0xeed0('0xa6')]=_0x2e3f7f;if(_0x5c7575===_0xeed0('0x53')&&_0x298dfc['query']['openTabs']===_0xeed0('0xb0')){var _0x6419=[];for(var _0x38b788=0x0;_0x38b788<_0x28606f['rows'][_0xeed0('0x88')];_0x38b788++){_0x6419[_0xeed0('0x89')](_0x42bcdf(_0xeed0('0xb1'),_0x28606f[_0xeed0('0xa6')][_0x38b788][_0xeed0('0xb2')]));_0x6419[_0xeed0('0x89')](_0x42bcdf(_0xeed0('0xb3'),_0x28606f[_0xeed0('0xa6')][_0x38b788][_0xeed0('0xb2')]));_0x6419[_0xeed0('0x89')](_0x42bcdf(_0xeed0('0xb4'),_0x28606f[_0xeed0('0xa6')][_0x38b788][_0xeed0('0xb2')]));_0x6419[_0xeed0('0x89')](_0x42bcdf(_0xeed0('0xb5'),_0x28606f['rows'][_0x38b788]['dataValues']));_0x6419[_0xeed0('0x89')](_0x42bcdf(_0xeed0('0xb6'),_0x28606f[_0xeed0('0xa6')][_0x38b788][_0xeed0('0xb2')]));_0x6419[_0xeed0('0x89')](_0x42bcdf(_0xeed0('0xb7'),_0x28606f['rows'][_0x38b788][_0xeed0('0xb2')]));}return Promise[_0xeed0('0x8c')](_0x6419)['then'](function(){return _0x28606f;});}return _0x28606f;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 771eded..c0a0f37 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 _0x00f0=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','UserProfile,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x00f0,0xec));var _0x000f=function(_0x219c8b,_0x10236a){_0x219c8b=_0x219c8b-0x0;var _0x5989f5=_0x00f0[_0x219c8b];return _0x5989f5;};'use strict';var _=require(_0x000f('0x0'));var util=require(_0x000f('0x1'));var moment=require(_0x000f('0x2'));var BPromise=require(_0x000f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x000f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x000f('0x5'))('rpc');var config=require(_0x000f('0x6'));var jayson=require(_0x000f('0x7'));var client=jayson['client'][_0x000f('0x8')]({'port':0x232a});config[_0x000f('0x9')]=_[_0x000f('0xa')](config[_0x000f('0x9')],{'host':_0x000f('0xb'),'port':0x18eb});var socket=require(_0x000f('0xc'))(new Redis(config[_0x000f('0x9')]));require(_0x000f('0xd'))[_0x000f('0xe')](socket);function respondWithRpcPromise(_0x278cd8,_0x190417,_0x504f65){return new BPromise(function(_0x59749b,_0x1a8ebf){return client[_0x000f('0xf')](_0x278cd8,_0x504f65)['then'](function(_0x2bac47){logger[_0x000f('0x10')]('UserProfile,\x20%s,\x20%s',_0x190417,'request\x20sent');logger[_0x000f('0x11')](_0x000f('0x12'),_0x190417,'request\x20sent',JSON['stringify'](_0x2bac47));if(_0x2bac47[_0x000f('0x13')]){if(_0x2bac47[_0x000f('0x13')][_0x000f('0x14')]===0x1f4){logger[_0x000f('0x13')]('UserProfile,\x20%s,\x20%s',_0x190417,_0x2bac47[_0x000f('0x13')]['message']);return _0x1a8ebf(_0x2bac47['error'][_0x000f('0x15')]);}logger['error'](_0x000f('0x16'),_0x190417,_0x2bac47[_0x000f('0x13')][_0x000f('0x15')]);return _0x59749b(_0x2bac47[_0x000f('0x13')][_0x000f('0x15')]);}else{logger[_0x000f('0x10')](_0x000f('0x16'),_0x190417,_0x000f('0x17'));_0x59749b(_0x2bac47[_0x000f('0x18')][_0x000f('0x15')]);}})[_0x000f('0x19')](function(_0x156342){logger[_0x000f('0x13')]('UserProfile,\x20%s,\x20%s',_0x190417,_0x156342);_0x1a8ebf(_0x156342);});});} \ No newline at end of file +var _0x543b=['stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s'];(function(_0x26f432,_0x3eec21){var _0x5d7b67=function(_0x5429ba){while(--_0x5429ba){_0x26f432['push'](_0x26f432['shift']());}};_0x5d7b67(++_0x3eec21);}(_0x543b,0x18d));var _0xb543=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x543b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb543('0x0'));var util=require(_0xb543('0x1'));var moment=require(_0xb543('0x2'));var BPromise=require('bluebird');var rs=require(_0xb543('0x3'));var fs=require('fs');var Redis=require(_0xb543('0x4'));var db=require(_0xb543('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb543('0x6'))(_0xb543('0x7'));var config=require(_0xb543('0x8'));var jayson=require(_0xb543('0x9'));var client=jayson[_0xb543('0xa')][_0xb543('0xb')]({'port':0x232a});config[_0xb543('0xc')]=_[_0xb543('0xd')](config[_0xb543('0xc')],{'host':_0xb543('0xe'),'port':0x18eb});var socket=require(_0xb543('0xf'))(new Redis(config[_0xb543('0xc')]));require('./userProfile.socket')[_0xb543('0x10')](socket);function respondWithRpcPromise(_0x48c727,_0x1f4cf0,_0x3a45e3){return new BPromise(function(_0x1e6d97,_0x1243fa){return client[_0xb543('0x11')](_0x48c727,_0x3a45e3)[_0xb543('0x12')](function(_0x5f4cef){logger[_0xb543('0x13')](_0xb543('0x14'),_0x1f4cf0,_0xb543('0x15'));logger['debug'](_0xb543('0x16'),_0x1f4cf0,_0xb543('0x15'),JSON[_0xb543('0x17')](_0x5f4cef));if(_0x5f4cef['error']){if(_0x5f4cef['error'][_0xb543('0x18')]===0x1f4){logger[_0xb543('0x19')](_0xb543('0x14'),_0x1f4cf0,_0x5f4cef[_0xb543('0x19')]['message']);return _0x1243fa(_0x5f4cef[_0xb543('0x19')][_0xb543('0x1a')]);}logger[_0xb543('0x19')](_0xb543('0x14'),_0x1f4cf0,_0x5f4cef['error'][_0xb543('0x1a')]);return _0x1e6d97(_0x5f4cef['error'][_0xb543('0x1a')]);}else{logger[_0xb543('0x13')](_0xb543('0x14'),_0x1f4cf0,_0xb543('0x15'));_0x1e6d97(_0x5f4cef['result'][_0xb543('0x1a')]);}})[_0xb543('0x1b')](function(_0x45cd55){logger['error']('UserProfile,\x20%s,\x20%s',_0x1f4cf0,_0x45cd55);_0x1243fa(_0x45cd55);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 8ebe61a..4036744 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 _0x79cd=['remove','update','emit','removeListener','length','userProfile:','./userProfile.events','save'];(function(_0xaa17ad,_0x3a930b){var _0xecf4a1=function(_0x49e7ca){while(--_0x49e7ca){_0xaa17ad['push'](_0xaa17ad['shift']());}};_0xecf4a1(++_0x3a930b);}(_0x79cd,0x1e6));var _0xd79c=function(_0x178067,_0x4cfe55){_0x178067=_0x178067-0x0;var _0x16d727=_0x79cd[_0x178067];return _0x16d727;};'use strict';var UserProfileEvents=require(_0xd79c('0x0'));var events=[_0xd79c('0x1'),_0xd79c('0x2'),_0xd79c('0x3')];function createListener(_0x376dc3,_0x5778f6){return function(_0x274a59){_0x5778f6[_0xd79c('0x4')](_0x376dc3,_0x274a59);};}function removeListener(_0x593051,_0x53c55b){return function(){UserProfileEvents[_0xd79c('0x5')](_0x593051,_0x53c55b);};}exports['register']=function(_0x2d5291){for(var _0x34013e=0x0,_0x215edf=events[_0xd79c('0x6')];_0x34013e<_0x215edf;_0x34013e++){var _0xd189a7=events[_0x34013e];var _0x432fd2=createListener(_0xd79c('0x7')+_0xd189a7,_0x2d5291);UserProfileEvents['on'](_0xd189a7,_0x432fd2);}}; \ No newline at end of file +var _0x9670=['removeListener','register','length','userProfile:','./userProfile.events','save','remove','update'];(function(_0xa7eb2e,_0x4dfa0d){var _0x119b6d=function(_0x3b3c8d){while(--_0x3b3c8d){_0xa7eb2e['push'](_0xa7eb2e['shift']());}};_0x119b6d(++_0x4dfa0d);}(_0x9670,0x74));var _0x0967=function(_0x4ee458,_0x4f966d){_0x4ee458=_0x4ee458-0x0;var _0x4df0c8=_0x9670[_0x4ee458];return _0x4df0c8;};'use strict';var UserProfileEvents=require(_0x0967('0x0'));var events=[_0x0967('0x1'),_0x0967('0x2'),_0x0967('0x3')];function createListener(_0x29bdab,_0x3bc102){return function(_0x2359c4){_0x3bc102['emit'](_0x29bdab,_0x2359c4);};}function removeListener(_0x25eb31,_0x1e95a3){return function(){UserProfileEvents[_0x0967('0x4')](_0x25eb31,_0x1e95a3);};}exports[_0x0967('0x5')]=function(_0x454b46){for(var _0x2b7b41=0x0,_0x3d201d=events[_0x0967('0x6')];_0x2b7b41<_0x3d201d;_0x2b7b41++){var _0x2e0cc4=events[_0x2b7b41];var _0x4bfde7=createListener(_0x0967('0x7')+_0x2e0cc4,_0x454b46);UserProfileEvents['on'](_0x2e0cc4,_0x4bfde7);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index bdab390..19954ae 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 _0x2ff5=['post','create','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x5ca57f,_0xeb3f8){var _0x251392=function(_0xc5d89f){while(--_0xc5d89f){_0x5ca57f['push'](_0x5ca57f['shift']());}};_0x251392(++_0xeb3f8);}(_0x2ff5,0x11d));var _0x52ff=function(_0x24d317,_0x155172){_0x24d317=_0x24d317-0x0;var _0x5dbd4c=_0x2ff5[_0x24d317];return _0x5dbd4c;};'use strict';var multer=require(_0x52ff('0x0'));var util=require('util');var path=require(_0x52ff('0x1'));var timeout=require(_0x52ff('0x2'));var express=require(_0x52ff('0x3'));var router=express['Router']();var fs_extra=require(_0x52ff('0x4'));var auth=require(_0x52ff('0x5'));var interaction=require(_0x52ff('0x6'));var config=require(_0x52ff('0x7'));var controller=require(_0x52ff('0x8'));router['get']('/',auth[_0x52ff('0x9')](),controller[_0x52ff('0xa')]);router[_0x52ff('0xb')](_0x52ff('0xc'),auth[_0x52ff('0x9')](),controller[_0x52ff('0xd')]);router[_0x52ff('0xb')](_0x52ff('0xe'),auth[_0x52ff('0x9')](),controller['show']);router[_0x52ff('0xf')]('/',auth[_0x52ff('0x9')](),controller[_0x52ff('0x10')]);router['put'](_0x52ff('0xe'),auth[_0x52ff('0x9')](),controller[_0x52ff('0x11')]);router[_0x52ff('0x12')](_0x52ff('0xe'),auth[_0x52ff('0x9')](),controller['destroy']);module[_0x52ff('0x13')]=router; \ No newline at end of file +var _0xf48c=['create','put','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','show','post'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xf48c,0x10e));var _0xcf48=function(_0x51e13d,_0x50ff11){_0x51e13d=_0x51e13d-0x0;var _0x1f14ec=_0xf48c[_0x51e13d];return _0x1f14ec;};'use strict';var multer=require(_0xcf48('0x0'));var util=require(_0xcf48('0x1'));var path=require(_0xcf48('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf48('0x3'));var router=express[_0xcf48('0x4')]();var fs_extra=require(_0xcf48('0x5'));var auth=require(_0xcf48('0x6'));var interaction=require(_0xcf48('0x7'));var config=require(_0xcf48('0x8'));var controller=require(_0xcf48('0x9'));router[_0xcf48('0xa')]('/',auth[_0xcf48('0xb')](),controller[_0xcf48('0xc')]);router['get'](_0xcf48('0xd'),auth[_0xcf48('0xb')](),controller['describe']);router['get']('/:id',auth[_0xcf48('0xb')](),controller[_0xcf48('0xe')]);router[_0xcf48('0xf')]('/',auth['isAuthenticated'](),controller[_0xcf48('0x10')]);router[_0xcf48('0x11')](_0xcf48('0x12'),auth[_0xcf48('0xb')](),controller['update']);router[_0xcf48('0x13')](_0xcf48('0x12'),auth['isAuthenticated'](),controller[_0xcf48('0x14')]);module[_0xcf48('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 955b7e4..16f6c65 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 _0x3d8b=['STRING','INTEGER','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3d8b,0x1ce));var _0xb3d8=function(_0x673d6a,_0x535715){_0x673d6a=_0x673d6a-0x0;var _0xc52b3d=_0x3d8b[_0x673d6a];return _0xc52b3d;};'use strict';var Sequelize=require(_0xb3d8('0x0'));module[_0xb3d8('0x1')]={'name':{'type':Sequelize[_0xb3d8('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb3d8('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x92d6=['exports','STRING','INTEGER','sequelize'];(function(_0x489430,_0x7fdf68){var _0xef4359=function(_0x532c8d){while(--_0x532c8d){_0x489430['push'](_0x489430['shift']());}};_0xef4359(++_0x7fdf68);}(_0x92d6,0xcf));var _0x692d=function(_0x1e77cf,_0x4dfc90){_0x1e77cf=_0x1e77cf-0x0;var _0x1b94b9=_0x92d6[_0x1e77cf];return _0x1b94b9;};'use strict';var Sequelize=require(_0x692d('0x0'));module[_0x692d('0x1')]={'name':{'type':Sequelize[_0x692d('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x692d('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x692d('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 abd014e..32d5f56 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 _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xacf4,0xe7));var _0x4acf=function(_0x14ec1f,_0x59ef2f){_0x14ec1f=_0x14ec1f-0x0;var _0x5cecb3=_0xacf4[_0x14ec1f];return _0x5cecb3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['UserProfileResource'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['UserProfileResource']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file +var _0x1261=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','UserProfileResource','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x204cdc,_0x454ef4){var _0x1dce7b=function(_0x22c6b1){while(--_0x22c6b1){_0x204cdc['push'](_0x204cdc['shift']());}};_0x1dce7b(++_0x454ef4);}(_0x1261,0x144));var _0x1126=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0x1261[_0x187d80];return _0x498a77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['UserProfileResource'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['UserProfileResource']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));};exports[_0x1126('0x45')]=function(_0x52a9a4,_0x3cb44c){return db[_0x1126('0x29')][_0x1126('0x45')]()[_0x1126('0x25')](respondWithResult(_0x3cb44c,null))['catch'](handleError(_0x3cb44c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d832c48..c059ccc 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 _0x2cc0=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','../../config/logger','api','moment'];(function(_0x2b7380,_0x45fe61){var _0x56636b=function(_0x290810){while(--_0x290810){_0x2b7380['push'](_0x2b7380['shift']());}};_0x56636b(++_0x45fe61);}(_0x2cc0,0xeb));var _0x02cc=function(_0x5a5082,_0x175f90){_0x5a5082=_0x5a5082-0x0;var _0x286f4e=_0x2cc0[_0x5a5082];return _0x286f4e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x02cc('0x0'))(_0x02cc('0x1'));var moment=require(_0x02cc('0x2'));var BPromise=require(_0x02cc('0x3'));var rp=require(_0x02cc('0x4'));var fs=require('fs');var path=require(_0x02cc('0x5'));var rimraf=require(_0x02cc('0x6'));var config=require(_0x02cc('0x7'));var attributes=require(_0x02cc('0x8'));module['exports']=function(_0x52893e,_0x1d93b7){return _0x52893e[_0x02cc('0x9')](_0x02cc('0xa'),attributes,{'tableName':_0x02cc('0xb'),'paranoid':![],'indexes':[{'name':_0x02cc('0xc'),'fields':['resourceId',_0x02cc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3250=['resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x3250,0x13d));var _0x0325=function(_0x19c4af,_0x1f15f8){_0x19c4af=_0x19c4af-0x0;var _0x3ef915=_0x3250[_0x19c4af];return _0x3ef915;};'use strict';var _=require(_0x0325('0x0'));var util=require(_0x0325('0x1'));var logger=require(_0x0325('0x2'))(_0x0325('0x3'));var moment=require(_0x0325('0x4'));var BPromise=require(_0x0325('0x5'));var rp=require(_0x0325('0x6'));var fs=require('fs');var path=require(_0x0325('0x7'));var rimraf=require(_0x0325('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x3da095,_0x1991ee){return _0x3da095[_0x0325('0x9')](_0x0325('0xa'),attributes,{'tableName':_0x0325('0xb'),'paranoid':![],'indexes':[{'name':_0x0325('0xc'),'fields':[_0x0325('0xd'),_0x0325('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 6751359..9b2b2c9 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 _0xace1=['request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x42cca5,_0xe4e6fa){var _0x3beb86=function(_0x5ecd5d){while(--_0x5ecd5d){_0x42cca5['push'](_0x42cca5['shift']());}};_0x3beb86(++_0xe4e6fa);}(_0xace1,0x15f));var _0x1ace=function(_0x753794,_0x562479){_0x753794=_0x753794-0x0;var _0x385ded=_0xace1[_0x753794];return _0x385ded;};'use strict';var _=require(_0x1ace('0x0'));var util=require(_0x1ace('0x1'));var moment=require(_0x1ace('0x2'));var BPromise=require(_0x1ace('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ace('0x4'));var db=require(_0x1ace('0x5'))['db'];var utils=require(_0x1ace('0x6'));var logger=require(_0x1ace('0x7'))(_0x1ace('0x8'));var config=require(_0x1ace('0x9'));var jayson=require(_0x1ace('0xa'));var client=jayson[_0x1ace('0xb')][_0x1ace('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x532512,_0x4f1656,_0x3830e8){return new BPromise(function(_0x449f2e,_0x42fece){return client[_0x1ace('0xd')](_0x532512,_0x3830e8)[_0x1ace('0xe')](function(_0x8e226e){logger[_0x1ace('0xf')](_0x1ace('0x10'),_0x4f1656,'request\x20sent');logger[_0x1ace('0x11')](_0x1ace('0x12'),_0x4f1656,_0x1ace('0x13'),JSON[_0x1ace('0x14')](_0x8e226e));if(_0x8e226e['error']){if(_0x8e226e[_0x1ace('0x15')][_0x1ace('0x16')]===0x1f4){logger[_0x1ace('0x15')](_0x1ace('0x10'),_0x4f1656,_0x8e226e['error'][_0x1ace('0x17')]);return _0x42fece(_0x8e226e[_0x1ace('0x15')]['message']);}logger['error'](_0x1ace('0x10'),_0x4f1656,_0x8e226e[_0x1ace('0x15')][_0x1ace('0x17')]);return _0x449f2e(_0x8e226e[_0x1ace('0x15')][_0x1ace('0x17')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x4f1656,'request\x20sent');_0x449f2e(_0x8e226e[_0x1ace('0x18')][_0x1ace('0x17')]);}})[_0x1ace('0x19')](function(_0x5be703){logger[_0x1ace('0x15')](_0x1ace('0x10'),_0x4f1656,_0x5be703);_0x42fece(_0x5be703);});});} \ No newline at end of file +var _0xad1b=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xad1b,0x1b0));var _0xbad1=function(_0x460e41,_0x4957d5){_0x460e41=_0x460e41-0x0;var _0xa00451=_0xad1b[_0x460e41];return _0xa00451;};'use strict';var _=require(_0xbad1('0x0'));var util=require(_0xbad1('0x1'));var moment=require(_0xbad1('0x2'));var BPromise=require(_0xbad1('0x3'));var rs=require(_0xbad1('0x4'));var fs=require('fs');var Redis=require(_0xbad1('0x5'));var db=require(_0xbad1('0x6'))['db'];var utils=require(_0xbad1('0x7'));var logger=require(_0xbad1('0x8'))(_0xbad1('0x9'));var config=require(_0xbad1('0xa'));var jayson=require(_0xbad1('0xb'));var client=jayson[_0xbad1('0xc')][_0xbad1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x105a91,_0x321c32,_0x32790e){return new BPromise(function(_0x9fc7b4,_0x5e4932){return client['request'](_0x105a91,_0x32790e)[_0xbad1('0xe')](function(_0x413873){logger['info'](_0xbad1('0xf'),_0x321c32,_0xbad1('0x10'));logger[_0xbad1('0x11')](_0xbad1('0x12'),_0x321c32,_0xbad1('0x10'),JSON[_0xbad1('0x13')](_0x413873));if(_0x413873[_0xbad1('0x14')]){if(_0x413873[_0xbad1('0x14')][_0xbad1('0x15')]===0x1f4){logger[_0xbad1('0x14')](_0xbad1('0xf'),_0x321c32,_0x413873[_0xbad1('0x14')][_0xbad1('0x16')]);return _0x5e4932(_0x413873[_0xbad1('0x14')][_0xbad1('0x16')]);}logger[_0xbad1('0x14')](_0xbad1('0xf'),_0x321c32,_0x413873[_0xbad1('0x14')]['message']);return _0x9fc7b4(_0x413873['error'][_0xbad1('0x16')]);}else{logger[_0xbad1('0x17')](_0xbad1('0xf'),_0x321c32,_0xbad1('0x10'));_0x9fc7b4(_0x413873['result']['message']);}})[_0xbad1('0x18')](function(_0x4614b3){logger[_0xbad1('0x14')](_0xbad1('0xf'),_0x321c32,_0x4614b3);_0x5e4932(_0x4614b3);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 12a6dbd..872115c 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 _0xf6a9=['show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe'];(function(_0x1df3c3,_0x1175f2){var _0x5ed389=function(_0x101f31){while(--_0x101f31){_0x1df3c3['push'](_0x1df3c3['shift']());}};_0x5ed389(++_0x1175f2);}(_0xf6a9,0x10c));var _0x9f6a=function(_0x1ded21,_0x19ca20){_0x1ded21=_0x1ded21-0x0;var _0x4685d4=_0xf6a9[_0x1ded21];return _0x4685d4;};'use strict';var multer=require(_0x9f6a('0x0'));var util=require('util');var path=require(_0x9f6a('0x1'));var timeout=require(_0x9f6a('0x2'));var express=require('express');var router=express[_0x9f6a('0x3')]();var fs_extra=require(_0x9f6a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f6a('0x5'));var config=require(_0x9f6a('0x6'));var controller=require(_0x9f6a('0x7'));router[_0x9f6a('0x8')]('/',auth[_0x9f6a('0x9')](),controller['index']);router[_0x9f6a('0x8')](_0x9f6a('0xa'),auth['isAuthenticated'](),controller[_0x9f6a('0xb')]);router[_0x9f6a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9f6a('0xc')]);router[_0x9f6a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9f6a('0xe')](_0x9f6a('0xf'),auth[_0x9f6a('0x9')](),controller[_0x9f6a('0x10')]);router[_0x9f6a('0x11')](_0x9f6a('0xf'),auth[_0x9f6a('0x9')](),controller[_0x9f6a('0x12')]);module[_0x9f6a('0x13')]=router; \ No newline at end of file +var _0x206d=['post','/:id','update','delete','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','show'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x206d,0x19d));var _0xd206=function(_0x574f61,_0x315e89){_0x574f61=_0x574f61-0x0;var _0x4d6670=_0x206d[_0x574f61];return _0x4d6670;};'use strict';var multer=require('multer');var util=require(_0xd206('0x0'));var path=require('path');var timeout=require(_0xd206('0x1'));var express=require(_0xd206('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd206('0x3'));var interaction=require(_0xd206('0x4'));var config=require(_0xd206('0x5'));var controller=require(_0xd206('0x6'));router[_0xd206('0x7')]('/',auth[_0xd206('0x8')](),controller[_0xd206('0x9')]);router[_0xd206('0x7')]('/describe',auth[_0xd206('0x8')](),controller[_0xd206('0xa')]);router[_0xd206('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd206('0xb')]);router[_0xd206('0xc')]('/',auth[_0xd206('0x8')](),controller['create']);router['put'](_0xd206('0xd'),auth[_0xd206('0x8')](),controller[_0xd206('0xe')]);router[_0xd206('0xf')](_0xd206('0xd'),auth[_0xd206('0x8')](),controller['destroy']);module[_0xd206('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 19026da..60ba977 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 _0x9c00=['STRING','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','INTEGER','BOOLEAN'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9c00,0x1a0));var _0x09c0=function(_0x25ff14,_0x384501){_0x25ff14=_0x25ff14-0x0;var _0x1eef4d=_0x9c00[_0x25ff14];return _0x1eef4d;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x09c0('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x09c0('0x4')],'set':function(_0x2c702c){this[_0x09c0('0x5')](_0x09c0('0x6'),_0x2c702c?_0x2c702c[_0x09c0('0x7')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x09c0('0x8')](_0x09c0('0x6'))[_0x09c0('0x9')](''):[];}}}; \ No newline at end of file +var _0x14a0=['INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x15cab6,_0x90491d){var _0xd694f8=function(_0x5898be){while(--_0x5898be){_0x15cab6['push'](_0x15cab6['shift']());}};_0xd694f8(++_0x90491d);}(_0x14a0,0x8e));var _0x014a=function(_0x3954b0,_0x57e367){_0x3954b0=_0x3954b0-0x0;var _0x21c3d1=_0x14a0[_0x3954b0];return _0x21c3d1;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'name':{'type':Sequelize[_0x014a('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x014a('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x014a('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x014a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x014a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x014a('0x1')],'set':function(_0x521a59){this['setDataValue'](_0x014a('0x4'),_0x521a59?_0x521a59[_0x014a('0x5')](''):[]);},'get':function(){return this[_0x014a('0x6')]('crudPermissions')?this['getDataValue'](_0x014a('0x4'))[_0x014a('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index adcad0b..37611d3 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 _0x8a96=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','rows','params','length','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x12551a,_0x5af080){var _0x6f8fc0=function(_0xe92756){while(--_0xe92756){_0x12551a['push'](_0x12551a['shift']());}};_0x6f8fc0(++_0x5af080);}(_0x8a96,0xcb));var _0x68a9=function(_0xf13ca6,_0x5735ea){_0xf13ca6=_0xf13ca6-0x0;var _0x4a4387=_0x8a96[_0xf13ca6];return _0x4a4387;};'use strict';var emlformat=require(_0x68a9('0x0'));var rimraf=require(_0x68a9('0x1'));var zipdir=require(_0x68a9('0x2'));var jsonpatch=require(_0x68a9('0x3'));var rp=require(_0x68a9('0x4'));var moment=require(_0x68a9('0x5'));var BPromise=require(_0x68a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x68a9('0x7'));var sox=require(_0x68a9('0x8'));var csv=require(_0x68a9('0x9'));var ejs=require(_0x68a9('0xa'));var fs=require('fs');var fs_extra=require(_0x68a9('0xb'));var _=require(_0x68a9('0xc'));var squel=require(_0x68a9('0xd'));var crypto=require('crypto');var jsforce=require(_0x68a9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x68a9('0x9'));var querystring=require(_0x68a9('0xf'));var Papa=require('papaparse');var Redis=require(_0x68a9('0x10'));var authService=require(_0x68a9('0x11'));var qs=require(_0x68a9('0x12'));var as=require(_0x68a9('0x13'));var hardwareService=require(_0x68a9('0x14'));var logger=require(_0x68a9('0x15'))(_0x68a9('0x16'));var utils=require(_0x68a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x68a9('0x18'));var db=require(_0x68a9('0x19'))['db'];function respondWithStatusCode(_0x58e7be,_0x329247){_0x329247=_0x329247||0xcc;return function(_0x327936){if(_0x327936){return _0x58e7be[_0x68a9('0x1a')](_0x329247);}return _0x58e7be[_0x68a9('0x1b')](_0x329247)[_0x68a9('0x1c')]();};}function respondWithResult(_0x65a01e,_0x386e14){_0x386e14=_0x386e14||0xc8;return function(_0x1390f9){if(_0x1390f9){return _0x65a01e[_0x68a9('0x1b')](_0x386e14)[_0x68a9('0x1d')](_0x1390f9);}};}function respondWithFilteredResult(_0x11c478,_0x5ce8c4){return function(_0x198c14){if(_0x198c14){var _0x19cf0e=typeof _0x5ce8c4[_0x68a9('0x1e')]===_0x68a9('0x1f')&&typeof _0x5ce8c4['limit']===_0x68a9('0x1f');var _0x521d06=_0x198c14[_0x68a9('0x20')];var _0x536bab=_0x19cf0e?0x0:_0x5ce8c4[_0x68a9('0x1e')];var _0x256d09=_0x19cf0e?_0x198c14[_0x68a9('0x20')]:_0x5ce8c4[_0x68a9('0x1e')]+_0x5ce8c4[_0x68a9('0x21')];var _0xc3e50c;if(_0x256d09>=_0x521d06){_0x256d09=_0x521d06;_0xc3e50c=0xc8;}else{_0xc3e50c=0xce;}_0x11c478[_0x68a9('0x1b')](_0xc3e50c);return _0x11c478[_0x68a9('0x22')](_0x68a9('0x23'),_0x536bab+'-'+_0x256d09+'/'+_0x521d06)['json'](_0x198c14);}return null;};}function patchUpdates(_0x4349de){return function(_0x4e5e1b){try{jsonpatch[_0x68a9('0x24')](_0x4e5e1b,_0x4349de,!![]);}catch(_0x3113ac){return BPromise[_0x68a9('0x25')](_0x3113ac);}return _0x4e5e1b[_0x68a9('0x26')]();};}function saveUpdates(_0x3b6be3,_0x2685c0){return function(_0x51e6f9){if(_0x51e6f9){return _0x51e6f9[_0x68a9('0x27')](_0x3b6be3)[_0x68a9('0x28')](function(_0x27b528){return _0x27b528;});}return null;};}function removeEntity(_0x23e39d,_0x7d7bb4){return function(_0x502251){if(_0x502251){return _0x502251[_0x68a9('0x29')]()[_0x68a9('0x28')](function(){_0x23e39d[_0x68a9('0x1b')](0xcc)[_0x68a9('0x1c')]();});}};}function handleEntityNotFound(_0x261f10,_0x6feae4){return function(_0x48fe2b){if(!_0x48fe2b){_0x261f10[_0x68a9('0x1a')](0x194);}return _0x48fe2b;};}function handleError(_0x46d3bb,_0x3b5d86){_0x3b5d86=_0x3b5d86||0x1f4;return function(_0x35d823){logger[_0x68a9('0x2a')](_0x35d823['stack']);if(_0x35d823['name']){delete _0x35d823[_0x68a9('0x2b')];}_0x46d3bb[_0x68a9('0x1b')](_0x3b5d86)[_0x68a9('0x2c')](_0x35d823);};}exports[_0x68a9('0x2d')]=function(_0x36ce79,_0x44add3){var _0x3997da={},_0x1a3c13={},_0x22ecbf={'count':0x0,'rows':[]};var _0x28c903=_[_0x68a9('0x2e')](db[_0x68a9('0x2f')][_0x68a9('0x30')],function(_0x285085){return{'name':_0x285085[_0x68a9('0x31')],'type':_0x285085['type'][_0x68a9('0x32')]};});_0x1a3c13[_0x68a9('0x33')]=_[_0x68a9('0x2e')](_0x28c903,_0x68a9('0x2b'));_0x1a3c13[_0x68a9('0x34')]=_[_0x68a9('0x35')](_0x36ce79[_0x68a9('0x34')]);_0x1a3c13[_0x68a9('0x36')]=_['intersection'](_0x1a3c13['model'],_0x1a3c13[_0x68a9('0x34')]);_0x3997da[_0x68a9('0x37')]=_[_0x68a9('0x38')](_0x1a3c13[_0x68a9('0x33')],qs[_0x68a9('0x39')](_0x36ce79['query'][_0x68a9('0x39')]));_0x3997da[_0x68a9('0x37')]=_0x3997da['attributes']['length']?_0x3997da['attributes']:_0x1a3c13[_0x68a9('0x33')];if(!_0x36ce79[_0x68a9('0x34')][_0x68a9('0x3a')](_0x68a9('0x3b'))){_0x3997da[_0x68a9('0x21')]=qs[_0x68a9('0x21')](_0x36ce79['query'][_0x68a9('0x21')]);_0x3997da[_0x68a9('0x1e')]=qs[_0x68a9('0x1e')](_0x36ce79[_0x68a9('0x34')]['offset']);}_0x3997da[_0x68a9('0x3c')]=qs[_0x68a9('0x3d')](_0x36ce79[_0x68a9('0x34')]['sort']);_0x3997da['where']=qs[_0x68a9('0x36')](_[_0x68a9('0x3e')](_0x36ce79['query'],_0x1a3c13[_0x68a9('0x36')]),_0x28c903);if(_0x36ce79['query']['filter']){_0x3997da[_0x68a9('0x3f')]=_[_0x68a9('0x40')](_0x3997da[_0x68a9('0x3f')],{'$or':_['map'](_0x28c903,function(_0xf27c3b){if(_0xf27c3b[_0x68a9('0x41')]!==_0x68a9('0x42')){var _0x39075b={};_0x39075b[_0xf27c3b[_0x68a9('0x2b')]]={'$like':'%'+_0x36ce79['query'][_0x68a9('0x43')]+'%'};return _0x39075b;}})});}_0x3997da=_[_0x68a9('0x40')]({},_0x3997da,_0x36ce79[_0x68a9('0x44')]);var _0x2f135a={'where':_0x3997da[_0x68a9('0x3f')]};return db[_0x68a9('0x2f')][_0x68a9('0x20')](_0x2f135a)[_0x68a9('0x28')](function(_0x7a00f1){_0x22ecbf[_0x68a9('0x20')]=_0x7a00f1;if(_0x36ce79[_0x68a9('0x34')]['includeAll']){_0x3997da['include']=[{'all':!![]}];}return db[_0x68a9('0x2f')]['findAll'](_0x3997da);})[_0x68a9('0x28')](function(_0x208107){_0x22ecbf[_0x68a9('0x45')]=_0x208107;return _0x22ecbf;})[_0x68a9('0x28')](respondWithFilteredResult(_0x44add3,_0x3997da))['catch'](handleError(_0x44add3,null));};exports['show']=function(_0x37aa89,_0xcd284d){var _0x3ac090={'raw':![],'where':{'id':_0x37aa89[_0x68a9('0x46')]['id']}},_0x25af70={};_0x25af70[_0x68a9('0x33')]=_[_0x68a9('0x35')](db[_0x68a9('0x2f')][_0x68a9('0x30')]);_0x25af70[_0x68a9('0x34')]=_[_0x68a9('0x35')](_0x37aa89[_0x68a9('0x34')]);_0x25af70[_0x68a9('0x36')]=_[_0x68a9('0x38')](_0x25af70['model'],_0x25af70[_0x68a9('0x34')]);_0x3ac090['attributes']=_[_0x68a9('0x38')](_0x25af70['model'],qs[_0x68a9('0x39')](_0x37aa89['query'][_0x68a9('0x39')]));_0x3ac090[_0x68a9('0x37')]=_0x3ac090['attributes'][_0x68a9('0x47')]?_0x3ac090[_0x68a9('0x37')]:_0x25af70[_0x68a9('0x33')];if(_0x37aa89[_0x68a9('0x34')]['includeAll']){_0x3ac090[_0x68a9('0x48')]=[{'all':!![]}];}_0x3ac090=_['merge']({},_0x3ac090,_0x37aa89[_0x68a9('0x44')]);return db[_0x68a9('0x2f')][_0x68a9('0x49')](_0x3ac090)['then'](handleEntityNotFound(_0xcd284d,null))[_0x68a9('0x28')](respondWithResult(_0xcd284d,null))[_0x68a9('0x4a')](handleError(_0xcd284d,null));};exports[_0x68a9('0x4b')]=function(_0x3921e1,_0x1642ed){return db[_0x68a9('0x2f')][_0x68a9('0x4b')](_0x3921e1[_0x68a9('0x4c')],{})[_0x68a9('0x28')](respondWithResult(_0x1642ed,0xc9))[_0x68a9('0x4a')](handleError(_0x1642ed,null));};exports[_0x68a9('0x27')]=function(_0x3d55a6,_0xe703af){if(_0x3d55a6[_0x68a9('0x4c')]['id']){delete _0x3d55a6[_0x68a9('0x4c')]['id'];}return db[_0x68a9('0x2f')]['find']({'where':{'id':_0x3d55a6['params']['id']}})[_0x68a9('0x28')](handleEntityNotFound(_0xe703af,null))[_0x68a9('0x28')](saveUpdates(_0x3d55a6[_0x68a9('0x4c')],null))[_0x68a9('0x28')](respondWithResult(_0xe703af,null))[_0x68a9('0x4a')](handleError(_0xe703af,null));};exports[_0x68a9('0x29')]=function(_0x642698,_0xb95ea){return db[_0x68a9('0x2f')][_0x68a9('0x49')]({'where':{'id':_0x642698[_0x68a9('0x46')]['id']}})[_0x68a9('0x28')](handleEntityNotFound(_0xb95ea,null))[_0x68a9('0x28')](removeEntity(_0xb95ea,null))['catch'](handleError(_0xb95ea,null));};exports[_0x68a9('0x4d')]=function(_0x10243e,_0x2cabb7){return db[_0x68a9('0x2f')][_0x68a9('0x4d')]()['then'](respondWithResult(_0x2cabb7,null))[_0x68a9('0x4a')](handleError(_0x2cabb7,null));}; \ No newline at end of file +var _0xb806=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','UserProfileSection','rawAttributes','fieldName','type','map','intersection','query','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','merge','find','catch','create','body','describe','eml-format','rimraf','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb806,0x168));var _0x6b80=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xb806[_0x44bcb0];return _0xfaf881;};'use strict';var emlformat=require(_0x6b80('0x0'));var rimraf=require(_0x6b80('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b80('0x2'));var BPromise=require(_0x6b80('0x3'));var Mustache=require('mustache');var util=require(_0x6b80('0x4'));var path=require('path');var sox=require(_0x6b80('0x5'));var csv=require('to-csv');var ejs=require(_0x6b80('0x6'));var fs=require('fs');var fs_extra=require(_0x6b80('0x7'));var _=require(_0x6b80('0x8'));var squel=require(_0x6b80('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6b80('0xa'));var toCsv=require(_0x6b80('0xb'));var querystring=require(_0x6b80('0xc'));var Papa=require(_0x6b80('0xd'));var Redis=require(_0x6b80('0xe'));var authService=require(_0x6b80('0xf'));var qs=require(_0x6b80('0x10'));var as=require(_0x6b80('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6b80('0x12'));var utils=require(_0x6b80('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b80('0x14'));var db=require(_0x6b80('0x15'))['db'];function respondWithStatusCode(_0x4be5f5,_0x4300ba){_0x4300ba=_0x4300ba||0xcc;return function(_0x5ed502){if(_0x5ed502){return _0x4be5f5[_0x6b80('0x16')](_0x4300ba);}return _0x4be5f5[_0x6b80('0x17')](_0x4300ba)[_0x6b80('0x18')]();};}function respondWithResult(_0x1a31c2,_0x32be61){_0x32be61=_0x32be61||0xc8;return function(_0x2dd8a1){if(_0x2dd8a1){return _0x1a31c2[_0x6b80('0x17')](_0x32be61)[_0x6b80('0x19')](_0x2dd8a1);}};}function respondWithFilteredResult(_0x339a27,_0x4f1220){return function(_0x374db0){if(_0x374db0){var _0x5a025d=typeof _0x4f1220[_0x6b80('0x1a')]===_0x6b80('0x1b')&&typeof _0x4f1220[_0x6b80('0x1c')]==='undefined';var _0x3ebf46=_0x374db0[_0x6b80('0x1d')];var _0x529e9d=_0x5a025d?0x0:_0x4f1220[_0x6b80('0x1a')];var _0x24a80f=_0x5a025d?_0x374db0[_0x6b80('0x1d')]:_0x4f1220[_0x6b80('0x1a')]+_0x4f1220[_0x6b80('0x1c')];var _0x23c76e;if(_0x24a80f>=_0x3ebf46){_0x24a80f=_0x3ebf46;_0x23c76e=0xc8;}else{_0x23c76e=0xce;}_0x339a27['status'](_0x23c76e);return _0x339a27[_0x6b80('0x1e')](_0x6b80('0x1f'),_0x529e9d+'-'+_0x24a80f+'/'+_0x3ebf46)[_0x6b80('0x19')](_0x374db0);}return null;};}function patchUpdates(_0x5eaf33){return function(_0x289c8c){try{jsonpatch['apply'](_0x289c8c,_0x5eaf33,!![]);}catch(_0x1c58a6){return BPromise[_0x6b80('0x20')](_0x1c58a6);}return _0x289c8c[_0x6b80('0x21')]();};}function saveUpdates(_0x3bfa70,_0xa27d3e){return function(_0x115c46){if(_0x115c46){return _0x115c46[_0x6b80('0x22')](_0x3bfa70)[_0x6b80('0x23')](function(_0x1d09c9){return _0x1d09c9;});}return null;};}function removeEntity(_0x4afd0e,_0x28b552){return function(_0x34ae90){if(_0x34ae90){return _0x34ae90[_0x6b80('0x24')]()[_0x6b80('0x23')](function(){_0x4afd0e['status'](0xcc)[_0x6b80('0x18')]();});}};}function handleEntityNotFound(_0x50e96b,_0x20bedc){return function(_0x310181){if(!_0x310181){_0x50e96b[_0x6b80('0x16')](0x194);}return _0x310181;};}function handleError(_0x2b18c1,_0x249749){_0x249749=_0x249749||0x1f4;return function(_0x2e4fb8){logger[_0x6b80('0x25')](_0x2e4fb8['stack']);if(_0x2e4fb8[_0x6b80('0x26')]){delete _0x2e4fb8[_0x6b80('0x26')];}_0x2b18c1['status'](_0x249749)[_0x6b80('0x27')](_0x2e4fb8);};}exports[_0x6b80('0x28')]=function(_0x7d6fb,_0x4979b8){var _0x42888d={},_0x7b7dd9={},_0x2f50d9={'count':0x0,'rows':[]};var _0x2ca1b2=_['map'](db[_0x6b80('0x29')][_0x6b80('0x2a')],function(_0x42a8b7){return{'name':_0x42a8b7[_0x6b80('0x2b')],'type':_0x42a8b7[_0x6b80('0x2c')]['key']};});_0x7b7dd9['model']=_[_0x6b80('0x2d')](_0x2ca1b2,_0x6b80('0x26'));_0x7b7dd9['query']=_['keys'](_0x7d6fb['query']);_0x7b7dd9['filters']=_[_0x6b80('0x2e')](_0x7b7dd9['model'],_0x7b7dd9[_0x6b80('0x2f')]);_0x42888d['attributes']=_[_0x6b80('0x2e')](_0x7b7dd9['model'],qs[_0x6b80('0x30')](_0x7d6fb[_0x6b80('0x2f')][_0x6b80('0x30')]));_0x42888d[_0x6b80('0x31')]=_0x42888d[_0x6b80('0x31')][_0x6b80('0x32')]?_0x42888d['attributes']:_0x7b7dd9[_0x6b80('0x33')];if(!_0x7d6fb['query'][_0x6b80('0x34')](_0x6b80('0x35'))){_0x42888d[_0x6b80('0x1c')]=qs['limit'](_0x7d6fb[_0x6b80('0x2f')][_0x6b80('0x1c')]);_0x42888d[_0x6b80('0x1a')]=qs[_0x6b80('0x1a')](_0x7d6fb[_0x6b80('0x2f')]['offset']);}_0x42888d[_0x6b80('0x36')]=qs[_0x6b80('0x37')](_0x7d6fb[_0x6b80('0x2f')][_0x6b80('0x37')]);_0x42888d['where']=qs['filters'](_[_0x6b80('0x38')](_0x7d6fb[_0x6b80('0x2f')],_0x7b7dd9[_0x6b80('0x39')]),_0x2ca1b2);if(_0x7d6fb[_0x6b80('0x2f')][_0x6b80('0x3a')]){_0x42888d[_0x6b80('0x3b')]=_['merge'](_0x42888d[_0x6b80('0x3b')],{'$or':_[_0x6b80('0x2d')](_0x2ca1b2,function(_0x2f40f5){if(_0x2f40f5['type']!==_0x6b80('0x3c')){var _0x275e18={};_0x275e18[_0x2f40f5[_0x6b80('0x26')]]={'$like':'%'+_0x7d6fb['query'][_0x6b80('0x3a')]+'%'};return _0x275e18;}})});}_0x42888d=_['merge']({},_0x42888d,_0x7d6fb[_0x6b80('0x3d')]);var _0x3d9c4d={'where':_0x42888d['where']};return db[_0x6b80('0x29')]['count'](_0x3d9c4d)[_0x6b80('0x23')](function(_0x1d99e2){_0x2f50d9[_0x6b80('0x1d')]=_0x1d99e2;if(_0x7d6fb[_0x6b80('0x2f')][_0x6b80('0x3e')]){_0x42888d['include']=[{'all':!![]}];}return db[_0x6b80('0x29')][_0x6b80('0x3f')](_0x42888d);})['then'](function(_0x100dcf){_0x2f50d9[_0x6b80('0x40')]=_0x100dcf;return _0x2f50d9;})[_0x6b80('0x23')](respondWithFilteredResult(_0x4979b8,_0x42888d))['catch'](handleError(_0x4979b8,null));};exports[_0x6b80('0x41')]=function(_0x16ec96,_0x1af324){var _0x1459e7={'raw':![],'where':{'id':_0x16ec96[_0x6b80('0x42')]['id']}},_0x100c3c={};_0x100c3c[_0x6b80('0x33')]=_['keys'](db[_0x6b80('0x29')]['rawAttributes']);_0x100c3c['query']=_[_0x6b80('0x43')](_0x16ec96['query']);_0x100c3c[_0x6b80('0x39')]=_[_0x6b80('0x2e')](_0x100c3c['model'],_0x100c3c['query']);_0x1459e7[_0x6b80('0x31')]=_[_0x6b80('0x2e')](_0x100c3c['model'],qs[_0x6b80('0x30')](_0x16ec96[_0x6b80('0x2f')][_0x6b80('0x30')]));_0x1459e7[_0x6b80('0x31')]=_0x1459e7[_0x6b80('0x31')]['length']?_0x1459e7['attributes']:_0x100c3c[_0x6b80('0x33')];if(_0x16ec96[_0x6b80('0x2f')][_0x6b80('0x3e')]){_0x1459e7[_0x6b80('0x44')]=[{'all':!![]}];}_0x1459e7=_[_0x6b80('0x45')]({},_0x1459e7,_0x16ec96[_0x6b80('0x3d')]);return db['UserProfileSection'][_0x6b80('0x46')](_0x1459e7)[_0x6b80('0x23')](handleEntityNotFound(_0x1af324,null))[_0x6b80('0x23')](respondWithResult(_0x1af324,null))[_0x6b80('0x47')](handleError(_0x1af324,null));};exports[_0x6b80('0x48')]=function(_0x2cc9ef,_0x3b45f1){return db[_0x6b80('0x29')][_0x6b80('0x48')](_0x2cc9ef['body'],{})[_0x6b80('0x23')](respondWithResult(_0x3b45f1,0xc9))['catch'](handleError(_0x3b45f1,null));};exports['update']=function(_0x9c23ff,_0x30855e){if(_0x9c23ff[_0x6b80('0x49')]['id']){delete _0x9c23ff[_0x6b80('0x49')]['id'];}return db[_0x6b80('0x29')]['find']({'where':{'id':_0x9c23ff['params']['id']}})[_0x6b80('0x23')](handleEntityNotFound(_0x30855e,null))[_0x6b80('0x23')](saveUpdates(_0x9c23ff[_0x6b80('0x49')],null))[_0x6b80('0x23')](respondWithResult(_0x30855e,null))[_0x6b80('0x47')](handleError(_0x30855e,null));};exports['destroy']=function(_0x1f9f51,_0x2d018f){return db[_0x6b80('0x29')]['find']({'where':{'id':_0x1f9f51['params']['id']}})['then'](handleEntityNotFound(_0x2d018f,null))['then'](removeEntity(_0x2d018f,null))['catch'](handleError(_0x2d018f,null));};exports[_0x6b80('0x4a')]=function(_0x5e8f70,_0x1a711f){return db[_0x6b80('0x29')]['describe']()[_0x6b80('0x23')](respondWithResult(_0x1a711f,null))[_0x6b80('0x47')](handleError(_0x1a711f,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index d8cb3f1..707e998 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 _0xccef=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','sectionId','util','../../config/logger','api','moment'];(function(_0x5b94b1,_0x394d69){var _0x5d5d1f=function(_0x5ce4ae){while(--_0x5ce4ae){_0x5b94b1['push'](_0x5b94b1['shift']());}};_0x5d5d1f(++_0x394d69);}(_0xccef,0x100));var _0xfcce=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xccef[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xfcce('0x0'));var logger=require(_0xfcce('0x1'))(_0xfcce('0x2'));var moment=require(_0xfcce('0x3'));var BPromise=require(_0xfcce('0x4'));var rp=require(_0xfcce('0x5'));var fs=require('fs');var path=require(_0xfcce('0x6'));var rimraf=require(_0xfcce('0x7'));var config=require(_0xfcce('0x8'));var attributes=require(_0xfcce('0x9'));module[_0xfcce('0xa')]=function(_0x1dc114,_0x477880){return _0x1dc114[_0xfcce('0xb')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xfcce('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9693=['path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','util','../../config/logger','api','request-promise'];(function(_0x577fd7,_0x197640){var _0x3a27d3=function(_0x46bb43){while(--_0x46bb43){_0x577fd7['push'](_0x577fd7['shift']());}};_0x3a27d3(++_0x197640);}(_0x9693,0x1d0));var _0x3969=function(_0x4e3761,_0x54e17d){_0x4e3761=_0x4e3761-0x0;var _0x4f0477=_0x9693[_0x4e3761];return _0x4f0477;};'use strict';var _=require('lodash');var util=require(_0x3969('0x0'));var logger=require(_0x3969('0x1'))(_0x3969('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3969('0x3'));var fs=require('fs');var path=require(_0x3969('0x4'));var rimraf=require('rimraf');var config=require(_0x3969('0x5'));var attributes=require(_0x3969('0x6'));module[_0x3969('0x7')]=function(_0x3b6deb,_0x3db35e){return _0x3b6deb[_0x3969('0x8')](_0x3969('0x9'),attributes,{'tableName':_0x3969('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x3969('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 308d189..6f9f2c6 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 _0xa6ff=['../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x26a5cf,_0x31be5f){var _0x4c5568=function(_0x2ef8ae){while(--_0x2ef8ae){_0x26a5cf['push'](_0x26a5cf['shift']());}};_0x4c5568(++_0x31be5f);}(_0xa6ff,0x10a));var _0xfa6f=function(_0x20d293,_0x22fe49){_0x20d293=_0x20d293-0x0;var _0x2708f5=_0xa6ff[_0x20d293];return _0x2708f5;};'use strict';var _=require(_0xfa6f('0x0'));var util=require(_0xfa6f('0x1'));var moment=require(_0xfa6f('0x2'));var BPromise=require(_0xfa6f('0x3'));var rs=require(_0xfa6f('0x4'));var fs=require('fs');var Redis=require(_0xfa6f('0x5'));var db=require(_0xfa6f('0x6'))['db'];var utils=require(_0xfa6f('0x7'));var logger=require(_0xfa6f('0x8'))('rpc');var config=require(_0xfa6f('0x9'));var jayson=require(_0xfa6f('0xa'));var client=jayson['client'][_0xfa6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc2485b,_0x42e61b,_0x7383a4){return new BPromise(function(_0x2f809e,_0x2823e0){return client[_0xfa6f('0xc')](_0xc2485b,_0x7383a4)[_0xfa6f('0xd')](function(_0x58f6a4){logger[_0xfa6f('0xe')](_0xfa6f('0xf'),_0x42e61b,_0xfa6f('0x10'));logger[_0xfa6f('0x11')](_0xfa6f('0x12'),_0x42e61b,'request\x20sent',JSON[_0xfa6f('0x13')](_0x58f6a4));if(_0x58f6a4['error']){if(_0x58f6a4[_0xfa6f('0x14')][_0xfa6f('0x15')]===0x1f4){logger[_0xfa6f('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x42e61b,_0x58f6a4[_0xfa6f('0x14')][_0xfa6f('0x16')]);return _0x2823e0(_0x58f6a4[_0xfa6f('0x14')][_0xfa6f('0x16')]);}logger[_0xfa6f('0x14')](_0xfa6f('0xf'),_0x42e61b,_0x58f6a4[_0xfa6f('0x14')]['message']);return _0x2f809e(_0x58f6a4[_0xfa6f('0x14')][_0xfa6f('0x16')]);}else{logger[_0xfa6f('0xe')](_0xfa6f('0xf'),_0x42e61b,'request\x20sent');_0x2f809e(_0x58f6a4[_0xfa6f('0x17')][_0xfa6f('0x16')]);}})[_0xfa6f('0x18')](function(_0x4bb69f){logger[_0xfa6f('0x14')](_0xfa6f('0xf'),_0x42e61b,_0x4bb69f);_0x2823e0(_0x4bb69f);});});} \ No newline at end of file +var _0x6029=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','util'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x6029,0x18f));var _0x9602=function(_0x3833af,_0x56290e){_0x3833af=_0x3833af-0x0;var _0x1ec57d=_0x6029[_0x3833af];return _0x1ec57d;};'use strict';var _=require('lodash');var util=require(_0x9602('0x0'));var moment=require(_0x9602('0x1'));var BPromise=require(_0x9602('0x2'));var rs=require(_0x9602('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9602('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9602('0x5'))('rpc');var config=require(_0x9602('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9602('0x7')][_0x9602('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e8d9d,_0x3bec3f,_0xf0b797){return new BPromise(function(_0x2f4c26,_0x9c9b38){return client[_0x9602('0x9')](_0x4e8d9d,_0xf0b797)['then'](function(_0xdad35){logger[_0x9602('0xa')](_0x9602('0xb'),_0x3bec3f,_0x9602('0xc'));logger[_0x9602('0xd')](_0x9602('0xe'),_0x3bec3f,_0x9602('0xc'),JSON['stringify'](_0xdad35));if(_0xdad35['error']){if(_0xdad35['error'][_0x9602('0xf')]===0x1f4){logger[_0x9602('0x10')](_0x9602('0xb'),_0x3bec3f,_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);return _0x9c9b38(_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);}logger[_0x9602('0x10')](_0x9602('0xb'),_0x3bec3f,_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);return _0x2f4c26(_0xdad35[_0x9602('0x10')][_0x9602('0x11')]);}else{logger[_0x9602('0xa')](_0x9602('0xb'),_0x3bec3f,_0x9602('0xc'));_0x2f4c26(_0xdad35[_0x9602('0x12')][_0x9602('0x11')]);}})[_0x9602('0x13')](function(_0x112dff){logger[_0x9602('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x3bec3f,_0x112dff);_0x9c9b38(_0x112dff);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b740dbf..1557b4a 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(_0x29bef7,_0x5127f0){var _0x1ba0c1=function(_0x90b156){while(--_0x90b156){_0x29bef7['push'](_0x29bef7['shift']());}};_0x1ba0c1(++_0x5127f0);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x45c5db,_0x25d142){var _0x61d312=function(_0x5a6c6a){while(--_0x5a6c6a){_0x45c5db['push'](_0x45c5db['shift']());}};_0x61d312(++_0x25d142);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index f6f5101..0fe2e8c 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 _0x459d=['INTEGER','sequelize','exports'];(function(_0x300c19,_0x709d87){var _0x52ccab=function(_0x27bf6e){while(--_0x27bf6e){_0x300c19['push'](_0x300c19['shift']());}};_0x52ccab(++_0x709d87);}(_0x459d,0xd9));var _0xd459=function(_0x7116d,_0x22d43d){_0x7116d=_0x7116d-0x0;var _0x177b37=_0x459d[_0x7116d];return _0x177b37;};'use strict';var Sequelize=require(_0xd459('0x0'));module[_0xd459('0x1')]={'penalty':{'type':Sequelize[_0xd459('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5949=['sequelize','exports'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0x5949,0x176));var _0x9594=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x5949[_0x4d79bc];return _0x4b4760;};'use strict';var Sequelize=require(_0x9594('0x0'));module[_0x9594('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 3edc15a..56712a2 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 _0x4137=['path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4811fb,_0x347444){var _0x5405b7=function(_0x5de543){while(--_0x5de543){_0x4811fb['push'](_0x4811fb['shift']());}};_0x5405b7(++_0x347444);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));module[_0x7413('0xb')]=function(_0x4fbade,_0xc808cd){return _0x4fbade[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':_0x7413('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82d8=['define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','bluebird','path','./userSmsQueue.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x82d8,0xff));var _0x882d=function(_0x1da016,_0x14fa53){_0x1da016=_0x1da016-0x0;var _0x5904dc=_0x82d8[_0x1da016];return _0x5904dc;};'use strict';var _=require(_0x882d('0x0'));var util=require('util');var logger=require(_0x882d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x882d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x882d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x882d('0x4'));module[_0x882d('0x5')]=function(_0x19f644,_0xa928f7){return _0x19f644[_0x882d('0x6')](_0x882d('0x7'),attributes,{'tableName':_0x882d('0x8'),'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 6a80f06..3604c06 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 _0xc629=['code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xef11df,_0x3b18f2){var _0x2c2f63=function(_0x5b88cd){while(--_0x5b88cd){_0xef11df['push'](_0xef11df['shift']());}};_0x2c2f63(++_0x3b18f2);}(_0xc629,0x1d1));var _0x9c62=function(_0x536527,_0x16f457){_0x536527=_0x536527-0x0;var _0x2ebf8a=_0xc629[_0x536527];return _0x2ebf8a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9c62('0x0'));var BPromise=require(_0x9c62('0x1'));var rs=require(_0x9c62('0x2'));var fs=require('fs');var Redis=require(_0x9c62('0x3'));var db=require(_0x9c62('0x4'))['db'];var utils=require(_0x9c62('0x5'));var logger=require(_0x9c62('0x6'))('rpc');var config=require(_0x9c62('0x7'));var jayson=require(_0x9c62('0x8'));var client=jayson[_0x9c62('0x9')][_0x9c62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30bfdf,_0x49be12,_0x1af1d8){return new BPromise(function(_0x426b3c,_0x6170cd){return client[_0x9c62('0xb')](_0x30bfdf,_0x1af1d8)[_0x9c62('0xc')](function(_0x24429b){logger[_0x9c62('0xd')](_0x9c62('0xe'),_0x49be12,_0x9c62('0xf'));logger[_0x9c62('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x49be12,_0x9c62('0xf'),JSON[_0x9c62('0x11')](_0x24429b));if(_0x24429b[_0x9c62('0x12')]){if(_0x24429b['error'][_0x9c62('0x13')]===0x1f4){logger[_0x9c62('0x12')](_0x9c62('0xe'),_0x49be12,_0x24429b[_0x9c62('0x12')][_0x9c62('0x14')]);return _0x6170cd(_0x24429b[_0x9c62('0x12')][_0x9c62('0x14')]);}logger[_0x9c62('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x49be12,_0x24429b[_0x9c62('0x12')][_0x9c62('0x14')]);return _0x426b3c(_0x24429b[_0x9c62('0x12')][_0x9c62('0x14')]);}else{logger[_0x9c62('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x49be12,_0x9c62('0xf'));_0x426b3c(_0x24429b[_0x9c62('0x15')][_0x9c62('0x14')]);}})['catch'](function(_0x560ba2){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x49be12,_0x560ba2);_0x6170cd(_0x560ba2);});});} \ No newline at end of file +var _0xf5d8=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x1238e9,_0x97a79e){var _0x509cc0=function(_0x362944){while(--_0x362944){_0x1238e9['push'](_0x1238e9['shift']());}};_0x509cc0(++_0x97a79e);}(_0xf5d8,0x91));var _0x8f5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8f5d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8f5d('0x1'));var rs=require(_0x8f5d('0x2'));var fs=require('fs');var Redis=require(_0x8f5d('0x3'));var db=require(_0x8f5d('0x4'))['db'];var utils=require(_0x8f5d('0x5'));var logger=require(_0x8f5d('0x6'))('rpc');var config=require(_0x8f5d('0x7'));var jayson=require(_0x8f5d('0x8'));var client=jayson[_0x8f5d('0x9')][_0x8f5d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c84ae,_0x122aba,_0x2f03a3){return new BPromise(function(_0xb6190a,_0x4dad6f){return client[_0x8f5d('0xb')](_0x5c84ae,_0x2f03a3)[_0x8f5d('0xc')](function(_0x471c43){logger[_0x8f5d('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x122aba,_0x8f5d('0xe'));logger[_0x8f5d('0xf')](_0x8f5d('0x10'),_0x122aba,_0x8f5d('0xe'),JSON[_0x8f5d('0x11')](_0x471c43));if(_0x471c43[_0x8f5d('0x12')]){if(_0x471c43['error'][_0x8f5d('0x13')]===0x1f4){logger[_0x8f5d('0x12')](_0x8f5d('0x14'),_0x122aba,_0x471c43['error']['message']);return _0x4dad6f(_0x471c43[_0x8f5d('0x12')]['message']);}logger[_0x8f5d('0x12')](_0x8f5d('0x14'),_0x122aba,_0x471c43[_0x8f5d('0x12')][_0x8f5d('0x15')]);return _0xb6190a(_0x471c43[_0x8f5d('0x12')][_0x8f5d('0x15')]);}else{logger[_0x8f5d('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x122aba,_0x8f5d('0xe'));_0xb6190a(_0x471c43[_0x8f5d('0x16')][_0x8f5d('0x15')]);}})['catch'](function(_0x23211a){logger['error'](_0x8f5d('0x14'),_0x122aba,_0x23211a);_0x4dad6f(_0x23211a);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 0cb017e..12e4af7 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1cf=['exports','INTEGER'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xb1cf,0xfe));var _0xfb1c=function(_0xab6a2b,_0x403a6b){_0xab6a2b=_0xab6a2b-0x0;var _0x33edba=_0xb1cf[_0xab6a2b];return _0x33edba;};'use strict';var Sequelize=require('sequelize');module[_0xfb1c('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xfb1c('0x1')]}}; \ No newline at end of file +var _0x8b9f=['exports','INTEGER'];(function(_0x207b09,_0x1adaf2){var _0x3787b7=function(_0xd5a111){while(--_0xd5a111){_0x207b09['push'](_0x207b09['shift']());}};_0x3787b7(++_0x1adaf2);}(_0x8b9f,0xd4));var _0xf8b9=function(_0xe0c566,_0x5497fd){_0xe0c566=_0xe0c566-0x0;var _0x221876=_0x8b9f[_0xe0c566];return _0x221876;};'use strict';var Sequelize=require('sequelize');module[_0xf8b9('0x0')]={'UserId':{'type':Sequelize[_0xf8b9('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xf8b9('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 5b2ae95..801f5a0 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x80b068,_0x10899b){var _0x1147ae=function(_0x25cce4){while(--_0x25cce4){_0x80b068['push'](_0x80b068['shift']());}};_0x1147ae(++_0x10899b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x55daac,_0x1b9c89){var _0x58c30a=function(_0x180771){while(--_0x180771){_0x55daac['push'](_0x55daac['shift']());}};_0x58c30a(++_0x1b9c89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index bc70496..c6d9390 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x21f54c,_0x48e7c6){var _0x36b319=function(_0x1bf812){while(--_0x1bf812){_0x21f54c['push'](_0x21f54c['shift']());}};_0x36b319(++_0x48e7c6);}(_0xedd9,0xfc));var _0x9edd=function(_0x27ca42,_0x1c09c8){_0x27ca42=_0x27ca42-0x0;var _0x5e610b=_0xedd9[_0x27ca42];return _0x5e610b;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x377743,_0x584cab){var _0x30ae30=function(_0x5dde9b){while(--_0x5dde9b){_0x377743['push'](_0x377743['shift']());}};_0x30ae30(++_0x584cab);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 883fee5..fe6b2ac 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 _0xadf6=['sequelize','exports','INTEGER'];(function(_0x56efbd,_0xb7ace8){var _0x333d91=function(_0x1f47d2){while(--_0x1f47d2){_0x56efbd['push'](_0x56efbd['shift']());}};_0x333d91(++_0xb7ace8);}(_0xadf6,0x78));var _0x6adf=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xadf6[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0x6adf('0x0'));module[_0x6adf('0x1')]={'penalty':{'type':Sequelize[_0x6adf('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f9d=['exports','INTEGER'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3f9d,0x10e));var _0xd3f9=function(_0x12ab97,_0x43a673){_0x12ab97=_0x12ab97-0x0;var _0x338e43=_0x3f9d[_0x12ab97];return _0x338e43;};'use strict';var Sequelize=require('sequelize');module[_0xd3f9('0x0')]={'penalty':{'type':Sequelize[_0xd3f9('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 94c6d1a..2ba890c 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 _0x57ec=['define','lodash','util','../../config/logger','api','bluebird','request-promise','path','./userVoiceQueue.attributes','exports'];(function(_0x29b02d,_0x3d35a9){var _0x120136=function(_0x4209d2){while(--_0x4209d2){_0x29b02d['push'](_0x29b02d['shift']());}};_0x120136(++_0x3d35a9);}(_0x57ec,0x173));var _0xc57e=function(_0x838813,_0x448f0f){_0x838813=_0x838813-0x0;var _0x2bd32d=_0x57ec[_0x838813];return _0x2bd32d;};'use strict';var _=require(_0xc57e('0x0'));var util=require(_0xc57e('0x1'));var logger=require(_0xc57e('0x2'))(_0xc57e('0x3'));var moment=require('moment');var BPromise=require(_0xc57e('0x4'));var rp=require(_0xc57e('0x5'));var fs=require('fs');var path=require(_0xc57e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc57e('0x7'));module[_0xc57e('0x8')]=function(_0x56d6e0,_0x4f28fb){return _0x56d6e0[_0xc57e('0x9')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x475c=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','bluebird','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0xf17d1d,_0x4a7c0f){var _0x276f2a=function(_0x1426b6){while(--_0x1426b6){_0xf17d1d['push'](_0xf17d1d['shift']());}};_0x276f2a(++_0x4a7c0f);}(_0x475c,0xb3));var _0xc475=function(_0x3051b4,_0x5e7072){_0x3051b4=_0x3051b4-0x0;var _0x48b87e=_0x475c[_0x3051b4];return _0x48b87e;};'use strict';var _=require(_0xc475('0x0'));var util=require(_0xc475('0x1'));var logger=require('../../config/logger')(_0xc475('0x2'));var moment=require('moment');var BPromise=require(_0xc475('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc475('0x4'));var config=require(_0xc475('0x5'));var attributes=require(_0xc475('0x6'));module[_0xc475('0x7')]=function(_0x5cd286,_0x312f0d){return _0x5cd286[_0xc475('0x8')](_0xc475('0x9'),attributes,{'tableName':_0xc475('0xa'),'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 9005085..94536a2 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 _0x87b5=['../../config/utils','../../config/logger','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x718f1f,_0x2e2338){var _0x48b289=function(_0x524e31){while(--_0x524e31){_0x718f1f['push'](_0x718f1f['shift']());}};_0x48b289(++_0x2e2338);}(_0x87b5,0x79));var _0x587b=function(_0x5c3b9e,_0x152e09){_0x5c3b9e=_0x5c3b9e-0x0;var _0x148527=_0x87b5[_0x5c3b9e];return _0x148527;};'use strict';var _=require('lodash');var util=require(_0x587b('0x0'));var moment=require(_0x587b('0x1'));var BPromise=require(_0x587b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x587b('0x3'));var db=require(_0x587b('0x4'))['db'];var utils=require(_0x587b('0x5'));var logger=require(_0x587b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x587b('0x7'));var client=jayson[_0x587b('0x8')][_0x587b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27b0d0,_0x1b2fdf,_0x4a8bb2){return new BPromise(function(_0x3fe391,_0x34a4ab){return client[_0x587b('0xa')](_0x27b0d0,_0x4a8bb2)['then'](function(_0x4c44d9){logger[_0x587b('0xb')](_0x587b('0xc'),_0x1b2fdf,_0x587b('0xd'));logger[_0x587b('0xe')](_0x587b('0xf'),_0x1b2fdf,_0x587b('0xd'),JSON[_0x587b('0x10')](_0x4c44d9));if(_0x4c44d9[_0x587b('0x11')]){if(_0x4c44d9[_0x587b('0x11')][_0x587b('0x12')]===0x1f4){logger[_0x587b('0x11')](_0x587b('0xc'),_0x1b2fdf,_0x4c44d9[_0x587b('0x11')]['message']);return _0x34a4ab(_0x4c44d9['error'][_0x587b('0x13')]);}logger[_0x587b('0x11')](_0x587b('0xc'),_0x1b2fdf,_0x4c44d9[_0x587b('0x11')][_0x587b('0x13')]);return _0x3fe391(_0x4c44d9[_0x587b('0x11')][_0x587b('0x13')]);}else{logger[_0x587b('0xb')](_0x587b('0xc'),_0x1b2fdf,_0x587b('0xd'));_0x3fe391(_0x4c44d9['result'][_0x587b('0x13')]);}})[_0x587b('0x14')](function(_0x53c85d){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x1b2fdf,_0x53c85d);_0x34a4ab(_0x53c85d);});});} \ No newline at end of file +var _0xd678=['UserVoiceQueue,\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','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd678,0x97));var _0x8d67=function(_0x23ca4d,_0x5c2a32){_0x23ca4d=_0x23ca4d-0x0;var _0x435432=_0xd678[_0x23ca4d];return _0x435432;};'use strict';var _=require(_0x8d67('0x0'));var util=require(_0x8d67('0x1'));var moment=require('moment');var BPromise=require(_0x8d67('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d67('0x3'))['db'];var utils=require(_0x8d67('0x4'));var logger=require(_0x8d67('0x5'))(_0x8d67('0x6'));var config=require(_0x8d67('0x7'));var jayson=require(_0x8d67('0x8'));var client=jayson[_0x8d67('0x9')][_0x8d67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x84939f,_0xee8cc3,_0x31905c){return new BPromise(function(_0x4bd382,_0x44f222){return client[_0x8d67('0xb')](_0x84939f,_0x31905c)[_0x8d67('0xc')](function(_0x51c70c){logger[_0x8d67('0xd')](_0x8d67('0xe'),_0xee8cc3,_0x8d67('0xf'));logger[_0x8d67('0x10')](_0x8d67('0x11'),_0xee8cc3,_0x8d67('0xf'),JSON[_0x8d67('0x12')](_0x51c70c));if(_0x51c70c[_0x8d67('0x13')]){if(_0x51c70c[_0x8d67('0x13')][_0x8d67('0x14')]===0x1f4){logger[_0x8d67('0x13')](_0x8d67('0xe'),_0xee8cc3,_0x51c70c[_0x8d67('0x13')][_0x8d67('0x15')]);return _0x44f222(_0x51c70c['error'][_0x8d67('0x15')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0xee8cc3,_0x51c70c['error'][_0x8d67('0x15')]);return _0x4bd382(_0x51c70c[_0x8d67('0x13')][_0x8d67('0x15')]);}else{logger[_0x8d67('0xd')](_0x8d67('0xe'),_0xee8cc3,'request\x20sent');_0x4bd382(_0x51c70c[_0x8d67('0x16')][_0x8d67('0x15')]);}})[_0x8d67('0x17')](function(_0x4a7447){logger[_0x8d67('0x13')](_0x8d67('0xe'),_0xee8cc3,_0x4a7447);_0x44f222(_0x4a7447);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 8846f02..0cad385 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x31e129,_0x47a670){var _0x12cd3c=function(_0x58c8aa){while(--_0x58c8aa){_0x31e129['push'](_0x31e129['shift']());}};_0x12cd3c(++_0x47a670);}(_0x70e0,0x17b));var _0x070e=function(_0x55390f,_0x308026){_0x55390f=_0x55390f-0x0;var _0x655b02=_0x70e0[_0x55390f];return _0x655b02;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5e6421,_0x3414bb){var _0x7e52fe=function(_0x16e6a6){while(--_0x16e6a6){_0x5e6421['push'](_0x5e6421['shift']());}};_0x7e52fe(++_0x3414bb);}(_0xe706,0xa3));var _0x6e70=function(_0x30aa48,_0x5cf0c9){_0x30aa48=_0x30aa48-0x0;var _0x35fc1f=_0xe706[_0x30aa48];return _0x35fc1f;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 0fbacef..a185ea5 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 _0x1894=['Required\x20by\x20Asterisk','STRING','queue_interface','INTEGER'];(function(_0x4e3882,_0x29c9eb){var _0x342f63=function(_0xd59c2c){while(--_0xd59c2c){_0x4e3882['push'](_0x4e3882['shift']());}};_0x342f63(++_0x29c9eb);}(_0x1894,0x1af));var _0x4189=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x1894[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4189('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4189('0x1')},'membername':{'type':Sequelize[_0x4189('0x2')],'allowNull':![],'comment':_0x4189('0x1')},'UserId':{'type':Sequelize[_0x4189('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4189('0x2')],'allowNull':![],'unique':_0x4189('0x3'),'comment':_0x4189('0x1')},'VoiceQueueId':{'type':Sequelize[_0x4189('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0x4189('0x2')],'allowNull':![],'unique':_0x4189('0x3'),'comment':_0x4189('0x1')},'penalty':{'type':Sequelize[_0x4189('0x0')](0xb),'defaultValue':0x0,'comment':_0x4189('0x1')},'paused':{'type':Sequelize[_0x4189('0x0')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xb5b5=['sequelize','exports','Required\x20by\x20Asterisk','STRING','queue_interface','INTEGER'];(function(_0x5d7af7,_0x56b083){var _0x13acac=function(_0x111dde){while(--_0x111dde){_0x5d7af7['push'](_0x5d7af7['shift']());}};_0x13acac(++_0x56b083);}(_0xb5b5,0x138));var _0x5b5b=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0xb5b5[_0x49a57c];return _0x4e0316;};'use strict';var Sequelize=require(_0x5b5b('0x0'));module[_0x5b5b('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5b5b('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5b5b('0x3')],'allowNull':![],'unique':_0x5b5b('0x4'),'comment':_0x5b5b('0x2')},'VoiceQueueId':{'type':Sequelize[_0x5b5b('0x5')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5b5b('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x5b5b('0x5')](0xb),'defaultValue':0x0,'comment':_0x5b5b('0x2')},'paused':{'type':Sequelize[_0x5b5b('0x5')](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 ffdf929..8c1cc21 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 _0x8d7c=['setMaxListeners','update','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4f68e5,_0x5590c9){var _0x48b672=function(_0x1705ff){while(--_0x1705ff){_0x4f68e5['push'](_0x4f68e5['shift']());}};_0x48b672(++_0x5590c9);}(_0x8d7c,0x180));var _0xc8d7=function(_0x5abccc,_0x304be1){_0x5abccc=_0x5abccc-0x0;var _0x1ac32d=_0x8d7c[_0x5abccc];return _0x1ac32d;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xc8d7('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc8d7('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc8d7('0x2'),'afterDestroy':_0xc8d7('0x3')};function emitEvent(_0x2e327c){return function(_0x5c08a0,_0x3505ec,_0x1261f8){UserVoiceQueueRtEvents['emit'](_0x2e327c+':'+_0x5c08a0['id'],_0x5c08a0);UserVoiceQueueRtEvents['emit'](_0x2e327c,_0x5c08a0);_0x1261f8(null);};}for(var e in events){if(events[_0xc8d7('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0xc8d7('0x5')](e,emitEvent(event));}}module[_0xc8d7('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xa19c=['UserVoiceQueueRt','setMaxListeners','save','remove','emit','exports'];(function(_0x53f463,_0x25e271){var _0x4f4cdd=function(_0x33254c){while(--_0x33254c){_0x53f463['push'](_0x53f463['shift']());}};_0x4f4cdd(++_0x25e271);}(_0xa19c,0x1a4));var _0xca19=function(_0x136183,_0xf2b213){_0x136183=_0x136183-0x0;var _0x3da1b7=_0xa19c[_0x136183];return _0x3da1b7;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xca19('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xca19('0x1')](0x0);var events={'afterCreate':_0xca19('0x2'),'afterUpdate':'update','afterDestroy':_0xca19('0x3')};function emitEvent(_0x5a0f20){return function(_0x8c2e7a,_0x2def68,_0x32c97d){UserVoiceQueueRtEvents[_0xca19('0x4')](_0x5a0f20+':'+_0x8c2e7a['id'],_0x8c2e7a);UserVoiceQueueRtEvents['emit'](_0x5a0f20,_0x8c2e7a);_0x32c97d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xca19('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 5e7d11b..9168918 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 _0xfc51=['bluebird','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports','user_has_voice_queues_rt','../../config/logger','api','moment'];(function(_0x55201b,_0x44333b){var _0x5739d4=function(_0x3324a3){while(--_0x3324a3){_0x55201b['push'](_0x55201b['shift']());}};_0x5739d4(++_0x44333b);}(_0xfc51,0x6b));var _0x1fc5=function(_0x445617,_0x4260d2){_0x445617=_0x445617-0x0;var _0x3e8c1d=_0xfc51[_0x445617];return _0x3e8c1d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1fc5('0x0'))(_0x1fc5('0x1'));var moment=require(_0x1fc5('0x2'));var BPromise=require(_0x1fc5('0x3'));var rp=require(_0x1fc5('0x4'));var fs=require('fs');var path=require(_0x1fc5('0x5'));var rimraf=require('rimraf');var config=require(_0x1fc5('0x6'));var attributes=require(_0x1fc5('0x7'));module[_0x1fc5('0x8')]=function(_0x444b70,_0x5ac000){return _0x444b70['define']('UserVoiceQueueRt',attributes,{'tableName':_0x1fc5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc001=['../../config/environment','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x39b03d,_0x3cb5f5){var _0x4f0516=function(_0xe2dbe0){while(--_0xe2dbe0){_0x39b03d['push'](_0x39b03d['shift']());}};_0x4f0516(++_0x3cb5f5);}(_0xc001,0x7d));var _0x1c00=function(_0xc2b4fb,_0x443531){_0xc2b4fb=_0xc2b4fb-0x0;var _0x3297ee=_0xc001[_0xc2b4fb];return _0x3297ee;};'use strict';var _=require(_0x1c00('0x0'));var util=require(_0x1c00('0x1'));var logger=require('../../config/logger')(_0x1c00('0x2'));var moment=require(_0x1c00('0x3'));var BPromise=require(_0x1c00('0x4'));var rp=require(_0x1c00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c00('0x6'));var config=require(_0x1c00('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x1ed8d8,_0x43ebd6){return _0x1ed8d8[_0x1c00('0x8')](_0x1c00('0x9'),attributes,{'tableName':_0x1c00('0xa'),'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 f9c428f..70f6769 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 _0xd50f=['stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','outboundQueuePauses','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','./userVoiceQueueRt.socket','register','request','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x2ab7df,_0x3c7182){var _0x29d004=function(_0x410c7d){while(--_0x410c7d){_0x2ab7df['push'](_0x2ab7df['shift']());}};_0x29d004(++_0x3c7182);}(_0xd50f,0xc1));var _0xfd50=function(_0x589402,_0x109743){_0x589402=_0x589402-0x0;var _0xc4be51=_0xd50f[_0x589402];return _0xc4be51;};'use strict';var _=require(_0xfd50('0x0'));var util=require(_0xfd50('0x1'));var moment=require('moment');var BPromise=require(_0xfd50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd50('0x3'));var db=require(_0xfd50('0x4'))['db'];var utils=require(_0xfd50('0x5'));var logger=require('../../config/logger')(_0xfd50('0x6'));var config=require(_0xfd50('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xfd50('0x8')]=_[_0xfd50('0x9')](config[_0xfd50('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfd50('0x8')]));require(_0xfd50('0xa'))[_0xfd50('0xb')](socket);function respondWithRpcPromise(_0x47a84f,_0x4bc6d0,_0x17cfe7){return new BPromise(function(_0x2363bc,_0x5b46d4){return client[_0xfd50('0xc')](_0x47a84f,_0x17cfe7)['then'](function(_0x27955d){logger[_0xfd50('0xd')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4bc6d0,_0xfd50('0xe'));logger[_0xfd50('0xf')](_0xfd50('0x10'),_0x4bc6d0,'request\x20sent',JSON[_0xfd50('0x11')](_0x27955d));if(_0x27955d['error']){if(_0x27955d['error']['code']===0x1f4){logger[_0xfd50('0x12')](_0xfd50('0x13'),_0x4bc6d0,_0x27955d[_0xfd50('0x12')][_0xfd50('0x14')]);return _0x5b46d4(_0x27955d[_0xfd50('0x12')][_0xfd50('0x14')]);}logger[_0xfd50('0x12')](_0xfd50('0x13'),_0x4bc6d0,_0x27955d[_0xfd50('0x12')][_0xfd50('0x14')]);return _0x2363bc(_0x27955d[_0xfd50('0x12')][_0xfd50('0x14')]);}else{logger[_0xfd50('0xd')](_0xfd50('0x13'),_0x4bc6d0,_0xfd50('0xe'));_0x2363bc(_0x27955d[_0xfd50('0x15')][_0xfd50('0x14')]);}})['catch'](function(_0x42db27){logger[_0xfd50('0x12')](_0xfd50('0x13'),_0x4bc6d0,_0x42db27);_0x5b46d4(_0x42db27);});});}exports[_0xfd50('0x16')]=function(_0x1ac3db){var _0x328126=this;return new Promise(function(_0x1c56da,_0x4ad61c){return db[_0xfd50('0x17')]['findAll']({'raw':_0x1ac3db[_0xfd50('0x18')]?_0x1ac3db[_0xfd50('0x18')][_0xfd50('0x19')]===undefined?!![]:![]:!![],'where':_0x1ac3db['options']?_0x1ac3db[_0xfd50('0x18')][_0xfd50('0x1a')]||null:null,'attributes':[[db[_0xfd50('0x1b')]['fn'](_0xfd50('0x1c'),db[_0xfd50('0x1b')]['fn']('IF',db[_0xfd50('0x1b')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xfd50('0x1d')]]})['then'](function(_0x509d1e){logger[_0xfd50('0xd')](_0xfd50('0x16'),_0x1ac3db);logger[_0xfd50('0xf')]('GetVoiceQueueRtPauses',_0x1ac3db,JSON[_0xfd50('0x11')](_0x509d1e));_0x1c56da(_0x509d1e);})['catch'](function(_0x486daf){logger[_0xfd50('0x12')](_0xfd50('0x16'),_0x486daf[_0xfd50('0x14')],_0x1ac3db);_0x4ad61c(_0x328126['error'](0x1f4,_0x486daf['message']));});});}; \ No newline at end of file +var _0x46db=['localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults'];(function(_0x180297,_0x56bb6d){var _0x1f7aae=function(_0x4b6929){while(--_0x4b6929){_0x180297['push'](_0x180297['shift']());}};_0x1f7aae(++_0x56bb6d);}(_0x46db,0xe9));var _0xb46d=function(_0x11154c,_0x3d1f2f){_0x11154c=_0x11154c-0x0;var _0x1952b8=_0x46db[_0x11154c];return _0x1952b8;};'use strict';var _=require('lodash');var util=require(_0xb46d('0x0'));var moment=require(_0xb46d('0x1'));var BPromise=require(_0xb46d('0x2'));var rs=require(_0xb46d('0x3'));var fs=require('fs');var Redis=require(_0xb46d('0x4'));var db=require(_0xb46d('0x5'))['db'];var utils=require(_0xb46d('0x6'));var logger=require('../../config/logger')(_0xb46d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb46d('0x8')][_0xb46d('0x9')]({'port':0x232a});config[_0xb46d('0xa')]=_[_0xb46d('0xb')](config[_0xb46d('0xa')],{'host':_0xb46d('0xc'),'port':0x18eb});var socket=require(_0xb46d('0xd'))(new Redis(config[_0xb46d('0xa')]));require(_0xb46d('0xe'))[_0xb46d('0xf')](socket);function respondWithRpcPromise(_0x369a62,_0x131967,_0x566eb0){return new BPromise(function(_0x3a2868,_0x3f6d9c){return client[_0xb46d('0x10')](_0x369a62,_0x566eb0)['then'](function(_0x5f583d){logger[_0xb46d('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x131967,_0xb46d('0x12'));logger[_0xb46d('0x13')](_0xb46d('0x14'),_0x131967,_0xb46d('0x12'),JSON['stringify'](_0x5f583d));if(_0x5f583d['error']){if(_0x5f583d[_0xb46d('0x15')][_0xb46d('0x16')]===0x1f4){logger['error'](_0xb46d('0x17'),_0x131967,_0x5f583d[_0xb46d('0x15')][_0xb46d('0x18')]);return _0x3f6d9c(_0x5f583d[_0xb46d('0x15')][_0xb46d('0x18')]);}logger[_0xb46d('0x15')](_0xb46d('0x17'),_0x131967,_0x5f583d['error']['message']);return _0x3a2868(_0x5f583d['error'][_0xb46d('0x18')]);}else{logger[_0xb46d('0x11')](_0xb46d('0x17'),_0x131967,'request\x20sent');_0x3a2868(_0x5f583d[_0xb46d('0x19')][_0xb46d('0x18')]);}})[_0xb46d('0x1a')](function(_0x9e74de){logger[_0xb46d('0x15')](_0xb46d('0x17'),_0x131967,_0x9e74de);_0x3f6d9c(_0x9e74de);});});}exports[_0xb46d('0x1b')]=function(_0x3153bb){var _0xf7cae2=this;return new Promise(function(_0x4b6988,_0x1c3836){return db['UserVoiceQueueRt']['findAll']({'raw':_0x3153bb['options']?_0x3153bb['options']['raw']===undefined?!![]:![]:!![],'where':_0x3153bb[_0xb46d('0x1c')]?_0x3153bb[_0xb46d('0x1c')][_0xb46d('0x1d')]||null:null,'attributes':[[db[_0xb46d('0x1e')]['fn']('COUNT',db[_0xb46d('0x1e')]['fn']('IF',db[_0xb46d('0x1e')][_0xb46d('0x1f')](_0xb46d('0x20')))),_0xb46d('0x21')]]})[_0xb46d('0x22')](function(_0x15ad4f){logger[_0xb46d('0x11')](_0xb46d('0x1b'),_0x3153bb);logger[_0xb46d('0x13')](_0xb46d('0x1b'),_0x3153bb,JSON['stringify'](_0x15ad4f));_0x4b6988(_0x15ad4f);})[_0xb46d('0x1a')](function(_0x5c62b8){logger[_0xb46d('0x15')](_0xb46d('0x1b'),_0x5c62b8[_0xb46d('0x18')],_0x3153bb);_0x1c3836(_0xf7cae2[_0xb46d('0x15')](0x1f4,_0x5c62b8[_0xb46d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 991ff35..7c340ad 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 _0x1dcc=['./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x1efdb7,_0x28bea7){_0x1efdb7=_0x1efdb7-0x0;var _0x5e9956=_0x1dcc[_0x1efdb7];return _0x5e9956;};'use strict';var UserVoiceQueueRtEvents=require(_0xc1dc('0x0'));var events=[_0xc1dc('0x1'),_0xc1dc('0x2'),_0xc1dc('0x3')];function createListener(_0x5c9880,_0x934769){return function(_0x4dece3){_0x934769[_0xc1dc('0x4')](_0x5c9880,_0x4dece3);};}function removeListener(_0x3eb139,_0x2a8ff9){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3eb139,_0x2a8ff9);};}exports['register']=function(_0x1e57ba){for(var _0x381ab6=0x0,_0x41b667=events['length'];_0x381ab6<_0x41b667;_0x381ab6++){var _0x3ef050=events[_0x381ab6];var _0x3deb94=createListener('userVoiceQueueRt:'+_0x3ef050,_0x1e57ba);UserVoiceQueueRtEvents['on'](_0x3ef050,_0x3deb94);}}; \ No newline at end of file +var _0x1298=['save','update','emit','register','length','userVoiceQueueRt:'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x1298,0x19e));var _0x8129=function(_0x18349c,_0x164be3){_0x18349c=_0x18349c-0x0;var _0x4ab5be=_0x1298[_0x18349c];return _0x4ab5be;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x8129('0x0'),'remove',_0x8129('0x1')];function createListener(_0x11c863,_0x5bdd76){return function(_0x3a133f){_0x5bdd76[_0x8129('0x2')](_0x11c863,_0x3a133f);};}function removeListener(_0x31d02a,_0x39e214){return function(){UserVoiceQueueRtEvents['removeListener'](_0x31d02a,_0x39e214);};}exports[_0x8129('0x3')]=function(_0x193d60){for(var _0x579301=0x0,_0x4f0a40=events[_0x8129('0x4')];_0x579301<_0x4f0a40;_0x579301++){var _0x2d07d5=events[_0x579301];var _0x3ff6e0=createListener(_0x8129('0x5')+_0x2d07d5,_0x193d60);UserVoiceQueueRtEvents['on'](_0x2d07d5,_0x3ff6e0);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index e1273cb..432926a 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x742d01,_0x36c502){var _0xa347e6=function(_0x3eabc2){while(--_0x3eabc2){_0x742d01['push'](_0x742d01['shift']());}};_0xa347e6(++_0x36c502);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x28e7ad,_0x304787){var _0x111aeb=function(_0x1df52b){while(--_0x1df52b){_0x28e7ad['push'](_0x28e7ad['shift']());}};_0x111aeb(++_0x304787);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 5d7fa2d..10e0703 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3194=['sequelize','exports','INTEGER'];(function(_0x1204b1,_0x47870b){var _0x2a1104=function(_0x53e090){while(--_0x53e090){_0x1204b1['push'](_0x1204b1['shift']());}};_0x2a1104(++_0x47870b);}(_0x3194,0x1bf));var _0x4319=function(_0x5a89a9,_0xcd2d0f){_0x5a89a9=_0x5a89a9-0x0;var _0x4c225f=_0x3194[_0x5a89a9];return _0x4c225f;};'use strict';var Sequelize=require(_0x4319('0x0'));module[_0x4319('0x1')]={'penalty':{'type':Sequelize[_0x4319('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0d64=['INTEGER','sequelize'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0x0d64,0x77));var _0x40d6=function(_0x51270b,_0x2dca10){_0x51270b=_0x51270b-0x0;var _0x18c0d7=_0x0d64[_0x51270b];return _0x18c0d7;};'use strict';var Sequelize=require(_0x40d6('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x40d6('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 2661a29..acd40ee 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 _0xffbc=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger'];(function(_0x5b0208,_0x58666d){var _0x5800b4=function(_0x21dfc5){while(--_0x21dfc5){_0x5b0208['push'](_0x5b0208['shift']());}};_0x5800b4(++_0x58666d);}(_0xffbc,0x14d));var _0xcffb=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xffbc[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0xcffb('0x0'));var util=require(_0xcffb('0x1'));var logger=require(_0xcffb('0x2'))(_0xcffb('0x3'));var moment=require(_0xcffb('0x4'));var BPromise=require(_0xcffb('0x5'));var rp=require(_0xcffb('0x6'));var fs=require('fs');var path=require(_0xcffb('0x7'));var rimraf=require(_0xcffb('0x8'));var config=require(_0xcffb('0x9'));var attributes=require(_0xcffb('0xa'));module[_0xcffb('0xb')]=function(_0x434d95,_0x483ca3){return _0x434d95['define'](_0xcffb('0xc'),attributes,{'tableName':_0xcffb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf3d=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4f0fa9,_0x2c5734){var _0x52ef8e=function(_0xb2518c){while(--_0xb2518c){_0x4f0fa9['push'](_0x4f0fa9['shift']());}};_0x52ef8e(++_0x2c5734);}(_0xbf3d,0xe2));var _0xdbf3=function(_0x39832a,_0x1c7063){_0x39832a=_0x39832a-0x0;var _0x2ae803=_0xbf3d[_0x39832a];return _0x2ae803;};'use strict';var _=require(_0xdbf3('0x0'));var util=require(_0xdbf3('0x1'));var logger=require(_0xdbf3('0x2'))(_0xdbf3('0x3'));var moment=require(_0xdbf3('0x4'));var BPromise=require(_0xdbf3('0x5'));var rp=require(_0xdbf3('0x6'));var fs=require('fs');var path=require(_0xdbf3('0x7'));var rimraf=require(_0xdbf3('0x8'));var config=require(_0xdbf3('0x9'));var attributes=require(_0xdbf3('0xa'));module[_0xdbf3('0xb')]=function(_0x468965,_0x27b36f){return _0x468965['define'](_0xdbf3('0xc'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 77f5f8c..70ef1ef 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 _0x8dbf=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird'];(function(_0x465d57,_0x42516e){var _0x4015b9=function(_0x1bcbe2){while(--_0x1bcbe2){_0x465d57['push'](_0x465d57['shift']());}};_0x4015b9(++_0x42516e);}(_0x8dbf,0x6b));var _0xf8db=function(_0x29d5ec,_0x4c1a5f){_0x29d5ec=_0x29d5ec-0x0;var _0x413d0a=_0x8dbf[_0x29d5ec];return _0x413d0a;};'use strict';var _=require(_0xf8db('0x0'));var util=require('util');var moment=require(_0xf8db('0x1'));var BPromise=require(_0xf8db('0x2'));var rs=require(_0xf8db('0x3'));var fs=require('fs');var Redis=require(_0xf8db('0x4'));var db=require(_0xf8db('0x5'))['db'];var utils=require(_0xf8db('0x6'));var logger=require('../../config/logger')(_0xf8db('0x7'));var config=require(_0xf8db('0x8'));var jayson=require(_0xf8db('0x9'));var client=jayson[_0xf8db('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x793d9d,_0x2e8438,_0x8f62c2){return new BPromise(function(_0xc97717,_0x4398c4){return client[_0xf8db('0xb')](_0x793d9d,_0x8f62c2)['then'](function(_0x1fc142){logger['info'](_0xf8db('0xc'),_0x2e8438,_0xf8db('0xd'));logger[_0xf8db('0xe')](_0xf8db('0xf'),_0x2e8438,'request\x20sent',JSON[_0xf8db('0x10')](_0x1fc142));if(_0x1fc142[_0xf8db('0x11')]){if(_0x1fc142[_0xf8db('0x11')]['code']===0x1f4){logger[_0xf8db('0x11')](_0xf8db('0xc'),_0x2e8438,_0x1fc142[_0xf8db('0x11')]['message']);return _0x4398c4(_0x1fc142[_0xf8db('0x11')][_0xf8db('0x12')]);}logger[_0xf8db('0x11')](_0xf8db('0xc'),_0x2e8438,_0x1fc142[_0xf8db('0x11')][_0xf8db('0x12')]);return _0xc97717(_0x1fc142[_0xf8db('0x11')]['message']);}else{logger[_0xf8db('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2e8438,'request\x20sent');_0xc97717(_0x1fc142[_0xf8db('0x14')][_0xf8db('0x12')]);}})[_0xf8db('0x15')](function(_0x307ca1){logger['error'](_0xf8db('0xc'),_0x2e8438,_0x307ca1);_0x4398c4(_0x307ca1);});});} \ No newline at end of file +var _0xcee9=['request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x3d383a,_0x4ecf63){var _0x935a86=function(_0x497795){while(--_0x497795){_0x3d383a['push'](_0x3d383a['shift']());}};_0x935a86(++_0x4ecf63);}(_0xcee9,0x69));var _0x9cee=function(_0x429d84,_0x51eefe){_0x429d84=_0x429d84-0x0;var _0x1f9c13=_0xcee9[_0x429d84];return _0x1f9c13;};'use strict';var _=require(_0x9cee('0x0'));var util=require(_0x9cee('0x1'));var moment=require(_0x9cee('0x2'));var BPromise=require('bluebird');var rs=require(_0x9cee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9cee('0x4'));var logger=require(_0x9cee('0x5'))(_0x9cee('0x6'));var config=require('../../config/environment');var jayson=require(_0x9cee('0x7'));var client=jayson['client'][_0x9cee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f3776,_0x209a32,_0xcfcfd){return new BPromise(function(_0x3ceb4f,_0x27b61a){return client[_0x9cee('0x9')](_0x5f3776,_0xcfcfd)['then'](function(_0x297c9b){logger['info'](_0x9cee('0xa'),_0x209a32,_0x9cee('0xb'));logger[_0x9cee('0xc')](_0x9cee('0xd'),_0x209a32,_0x9cee('0xb'),JSON['stringify'](_0x297c9b));if(_0x297c9b['error']){if(_0x297c9b[_0x9cee('0xe')][_0x9cee('0xf')]===0x1f4){logger[_0x9cee('0xe')](_0x9cee('0xa'),_0x209a32,_0x297c9b[_0x9cee('0xe')][_0x9cee('0x10')]);return _0x27b61a(_0x297c9b[_0x9cee('0xe')]['message']);}logger[_0x9cee('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x209a32,_0x297c9b['error']['message']);return _0x3ceb4f(_0x297c9b['error'][_0x9cee('0x10')]);}else{logger[_0x9cee('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x209a32,_0x9cee('0xb'));_0x3ceb4f(_0x297c9b[_0x9cee('0x12')][_0x9cee('0x10')]);}})['catch'](function(_0x2cceed){logger[_0x9cee('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x209a32,_0x2cceed);_0x27b61a(_0x2cceed);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e8446c4..cdf6c79 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 _0x4f99=['update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','post','create','/:id'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x4f99,0x157));var _0x94f9=function(_0x153beb,_0x3e1a58){_0x153beb=_0x153beb-0x0;var _0x5b61c6=_0x4f99[_0x153beb];return _0x5b61c6;};'use strict';var multer=require(_0x94f9('0x0'));var util=require(_0x94f9('0x1'));var path=require('path');var timeout=require(_0x94f9('0x2'));var express=require(_0x94f9('0x3'));var router=express[_0x94f9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x94f9('0x5'));var interaction=require(_0x94f9('0x6'));var config=require('../../config/environment');var controller=require(_0x94f9('0x7'));router[_0x94f9('0x8')]('/',auth[_0x94f9('0x9')](),controller[_0x94f9('0xa')]);router[_0x94f9('0x8')]('/:id',auth[_0x94f9('0x9')](),controller['show']);router[_0x94f9('0xb')]('/',auth['isAuthenticated'](),controller[_0x94f9('0xc')]);router['put'](_0x94f9('0xd'),auth[_0x94f9('0x9')](),controller[_0x94f9('0xe')]);router[_0x94f9('0xf')](_0x94f9('0xd'),auth[_0x94f9('0x9')](),controller[_0x94f9('0x10')]);module['exports']=router; \ No newline at end of file +var _0x54f3=['post','create','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./variable.controller','index','/:id','isAuthenticated','show'];(function(_0x545a9e,_0x3b567f){var _0x59e6f1=function(_0xb8f9b6){while(--_0xb8f9b6){_0x545a9e['push'](_0x545a9e['shift']());}};_0x59e6f1(++_0x3b567f);}(_0x54f3,0x120));var _0x354f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x54f3[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0x354f('0x0'));var path=require(_0x354f('0x1'));var timeout=require(_0x354f('0x2'));var express=require(_0x354f('0x3'));var router=express[_0x354f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x354f('0x5'));var config=require(_0x354f('0x6'));var controller=require(_0x354f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x354f('0x8')]);router['get'](_0x354f('0x9'),auth[_0x354f('0xa')](),controller[_0x354f('0xb')]);router[_0x354f('0xc')]('/',auth['isAuthenticated'](),controller[_0x354f('0xd')]);router['put'](_0x354f('0x9'),auth[_0x354f('0xa')](),controller['update']);router['delete'](_0x354f('0x9'),auth[_0x354f('0xa')](),controller['destroy']);module[_0x354f('0xe')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 3860600..3f2248a 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 _0xe5c9=['name','sequelize','exports','STRING'];(function(_0x41411b,_0x30aa78){var _0x20a9a4=function(_0x49be1a){while(--_0x49be1a){_0x41411b['push'](_0x41411b['shift']());}};_0x20a9a4(++_0x30aa78);}(_0xe5c9,0x139));var _0x9e5c=function(_0x30e7df,_0x3e0926){_0x30e7df=_0x30e7df-0x0;var _0x2cfe9f=_0xe5c9[_0x30e7df];return _0x2cfe9f;};'use strict';var Sequelize=require(_0x9e5c('0x0'));module[_0x9e5c('0x1')]={'name':{'type':Sequelize[_0x9e5c('0x2')],'unique':_0x9e5c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdbfe=['sequelize','exports','STRING','name'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0xdbfe,0x174));var _0xedbf=function(_0x52c5f6,_0x358c26){_0x52c5f6=_0x52c5f6-0x0;var _0xe1078a=_0xdbfe[_0x52c5f6];return _0xe1078a;};'use strict';var Sequelize=require(_0xedbf('0x0'));module[_0xedbf('0x1')]={'name':{'type':Sequelize[_0xedbf('0x2')],'unique':_0xedbf('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xedbf('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 1e4745e..2dd0f37 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 _0x5eb7=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','save','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','map','Variable','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','length','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x280820,_0xce9bc7){var _0x474787=function(_0x3d224e){while(--_0x3d224e){_0x280820['push'](_0x280820['shift']());}};_0x474787(++_0xce9bc7);}(_0x5eb7,0xa3));var _0x75eb=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0x5eb7[_0x3fc97b];return _0x3a0c82;};'use strict';var emlformat=require(_0x75eb('0x0'));var rimraf=require(_0x75eb('0x1'));var zipdir=require(_0x75eb('0x2'));var jsonpatch=require(_0x75eb('0x3'));var rp=require(_0x75eb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x75eb('0x5'));var util=require(_0x75eb('0x6'));var path=require(_0x75eb('0x7'));var sox=require(_0x75eb('0x8'));var csv=require(_0x75eb('0x9'));var ejs=require(_0x75eb('0xa'));var fs=require('fs');var fs_extra=require(_0x75eb('0xb'));var _=require('lodash');var squel=require(_0x75eb('0xc'));var crypto=require(_0x75eb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x75eb('0xe'));var toCsv=require(_0x75eb('0x9'));var querystring=require(_0x75eb('0xf'));var Papa=require(_0x75eb('0x10'));var Redis=require('ioredis');var authService=require(_0x75eb('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75eb('0x12'));var logger=require(_0x75eb('0x13'))('api');var utils=require(_0x75eb('0x14'));var config=require(_0x75eb('0x15'));var licenseUtil=require(_0x75eb('0x16'));var db=require(_0x75eb('0x17'))['db'];function respondWithStatusCode(_0x5aa51d,_0x43ba82){_0x43ba82=_0x43ba82||0xcc;return function(_0x5130ef){if(_0x5130ef){return _0x5aa51d['sendStatus'](_0x43ba82);}return _0x5aa51d[_0x75eb('0x18')](_0x43ba82)[_0x75eb('0x19')]();};}function respondWithResult(_0x231412,_0x2ed620){_0x2ed620=_0x2ed620||0xc8;return function(_0x21f7c5){if(_0x21f7c5){return _0x231412[_0x75eb('0x18')](_0x2ed620)[_0x75eb('0x1a')](_0x21f7c5);}};}function respondWithFilteredResult(_0x44e22d,_0x1d67c9){return function(_0x9577ac){if(_0x9577ac){var _0xe5384e=typeof _0x1d67c9['offset']==='undefined'&&typeof _0x1d67c9['limit']===_0x75eb('0x1b');var _0x4ccc2=_0x9577ac[_0x75eb('0x1c')];var _0x1421a4=_0xe5384e?0x0:_0x1d67c9[_0x75eb('0x1d')];var _0x5cecdb=_0xe5384e?_0x9577ac[_0x75eb('0x1c')]:_0x1d67c9[_0x75eb('0x1d')]+_0x1d67c9[_0x75eb('0x1e')];var _0x145513;if(_0x5cecdb>=_0x4ccc2){_0x5cecdb=_0x4ccc2;_0x145513=0xc8;}else{_0x145513=0xce;}_0x44e22d[_0x75eb('0x18')](_0x145513);return _0x44e22d[_0x75eb('0x1f')](_0x75eb('0x20'),_0x1421a4+'-'+_0x5cecdb+'/'+_0x4ccc2)[_0x75eb('0x1a')](_0x9577ac);}return null;};}function patchUpdates(_0x2b5e72){return function(_0x3c548a){try{jsonpatch['apply'](_0x3c548a,_0x2b5e72,!![]);}catch(_0x5f16ff){return BPromise['reject'](_0x5f16ff);}return _0x3c548a[_0x75eb('0x21')]();};}function saveUpdates(_0x3b71a1,_0x210538){return function(_0x15a9d1){if(_0x15a9d1){return _0x15a9d1['update'](_0x3b71a1)['then'](function(_0x498974){return _0x498974;});}return null;};}function removeEntity(_0x17b042,_0x1815f4){return function(_0x3f06f9){if(_0x3f06f9){return _0x3f06f9[_0x75eb('0x22')]()[_0x75eb('0x23')](function(){var _0x5737e8=_0x3f06f9[_0x75eb('0x24')]({'plain':!![]});var _0x39061d=_0x75eb('0x25');return db[_0x75eb('0x26')]['destroy']({'where':{'type':_0x39061d,'resourceId':_0x5737e8['id']}})['then'](function(){return _0x3f06f9;});})[_0x75eb('0x23')](function(){_0x17b042[_0x75eb('0x18')](0xcc)[_0x75eb('0x19')]();});}};}function handleEntityNotFound(_0x33d328,_0x511079){return function(_0x497948){if(!_0x497948){_0x33d328['sendStatus'](0x194);}return _0x497948;};}function handleError(_0x40afa,_0x227ac8){_0x227ac8=_0x227ac8||0x1f4;return function(_0x188394){logger[_0x75eb('0x27')](_0x188394[_0x75eb('0x28')]);if(_0x188394[_0x75eb('0x29')]){delete _0x188394[_0x75eb('0x29')];}_0x40afa[_0x75eb('0x18')](_0x227ac8)[_0x75eb('0x2a')](_0x188394);};}exports['index']=function(_0x58c93e,_0x143661){var _0xa778e={},_0x508fbc={},_0x42dd69={'count':0x0,'rows':[]};var _0x3a9545=_[_0x75eb('0x2b')](db[_0x75eb('0x2c')]['rawAttributes'],function(_0x1f2bc3){return{'name':_0x1f2bc3[_0x75eb('0x2d')],'type':_0x1f2bc3[_0x75eb('0x2e')]['key']};});_0x508fbc[_0x75eb('0x2f')]=_[_0x75eb('0x2b')](_0x3a9545,_0x75eb('0x29'));_0x508fbc[_0x75eb('0x30')]=_[_0x75eb('0x31')](_0x58c93e['query']);_0x508fbc[_0x75eb('0x32')]=_[_0x75eb('0x33')](_0x508fbc[_0x75eb('0x2f')],_0x508fbc[_0x75eb('0x30')]);_0xa778e[_0x75eb('0x34')]=_[_0x75eb('0x33')](_0x508fbc[_0x75eb('0x2f')],qs[_0x75eb('0x35')](_0x58c93e[_0x75eb('0x30')]['fields']));_0xa778e[_0x75eb('0x34')]=_0xa778e[_0x75eb('0x34')]['length']?_0xa778e['attributes']:_0x508fbc[_0x75eb('0x2f')];if(!_0x58c93e[_0x75eb('0x30')]['hasOwnProperty'](_0x75eb('0x36'))){_0xa778e[_0x75eb('0x1e')]=qs[_0x75eb('0x1e')](_0x58c93e[_0x75eb('0x30')][_0x75eb('0x1e')]);_0xa778e['offset']=qs[_0x75eb('0x1d')](_0x58c93e[_0x75eb('0x30')][_0x75eb('0x1d')]);}_0xa778e[_0x75eb('0x37')]=qs[_0x75eb('0x38')](_0x58c93e[_0x75eb('0x30')][_0x75eb('0x38')]);_0xa778e['where']=qs[_0x75eb('0x32')](_[_0x75eb('0x39')](_0x58c93e[_0x75eb('0x30')],_0x508fbc[_0x75eb('0x32')]),_0x3a9545);if(_0x58c93e[_0x75eb('0x30')][_0x75eb('0x3a')]){_0xa778e[_0x75eb('0x3b')]=_[_0x75eb('0x3c')](_0xa778e['where'],{'$or':_[_0x75eb('0x2b')](_0x3a9545,function(_0x54d56a){if(_0x54d56a[_0x75eb('0x2e')]!==_0x75eb('0x3d')){var _0x109bb8={};_0x109bb8[_0x54d56a[_0x75eb('0x29')]]={'$like':'%'+_0x58c93e[_0x75eb('0x30')][_0x75eb('0x3a')]+'%'};return _0x109bb8;}})});}_0xa778e=_[_0x75eb('0x3c')]({},_0xa778e,_0x58c93e[_0x75eb('0x3e')]);var _0x55744c={'where':_0xa778e[_0x75eb('0x3b')]};return db['Variable'][_0x75eb('0x1c')](_0x55744c)[_0x75eb('0x23')](function(_0xf23ae4){_0x42dd69[_0x75eb('0x1c')]=_0xf23ae4;if(_0x58c93e[_0x75eb('0x30')][_0x75eb('0x3f')]){_0xa778e['include']=[{'all':!![]}];}return db[_0x75eb('0x2c')]['findAll'](_0xa778e);})['then'](function(_0x27211f){_0x42dd69['rows']=_0x27211f;return _0x42dd69;})[_0x75eb('0x23')](respondWithFilteredResult(_0x143661,_0xa778e))[_0x75eb('0x40')](handleError(_0x143661,null));};exports[_0x75eb('0x41')]=function(_0xb2ce75,_0x14b0ad){var _0x319b04={'raw':!![],'where':{'id':_0xb2ce75[_0x75eb('0x42')]['id']}},_0x147309={};_0x147309[_0x75eb('0x2f')]=_[_0x75eb('0x31')](db[_0x75eb('0x2c')][_0x75eb('0x43')]);_0x147309[_0x75eb('0x30')]=_[_0x75eb('0x31')](_0xb2ce75[_0x75eb('0x30')]);_0x147309[_0x75eb('0x32')]=_[_0x75eb('0x33')](_0x147309['model'],_0x147309[_0x75eb('0x30')]);_0x319b04['attributes']=_[_0x75eb('0x33')](_0x147309[_0x75eb('0x2f')],qs[_0x75eb('0x35')](_0xb2ce75[_0x75eb('0x30')][_0x75eb('0x35')]));_0x319b04[_0x75eb('0x34')]=_0x319b04['attributes'][_0x75eb('0x44')]?_0x319b04[_0x75eb('0x34')]:_0x147309[_0x75eb('0x2f')];if(_0xb2ce75[_0x75eb('0x30')][_0x75eb('0x3f')]){_0x319b04[_0x75eb('0x45')]=[{'all':!![]}];}_0x319b04=_['merge']({},_0x319b04,_0xb2ce75[_0x75eb('0x3e')]);return db[_0x75eb('0x2c')][_0x75eb('0x46')](_0x319b04)[_0x75eb('0x23')](handleEntityNotFound(_0x14b0ad,null))[_0x75eb('0x23')](respondWithResult(_0x14b0ad,null))[_0x75eb('0x40')](handleError(_0x14b0ad,null));};exports['create']=function(_0x2d7a66,_0xedc81a){return db[_0x75eb('0x2c')]['create'](_0x2d7a66[_0x75eb('0x47')],{})[_0x75eb('0x23')](function(_0x5a822b){var _0xd80a43=_0x2d7a66[_0x75eb('0x48')][_0x75eb('0x24')]({'plain':!![]});if(!_0xd80a43)throw new Error(_0x75eb('0x49'));if(_0xd80a43[_0x75eb('0x4a')]===_0x75eb('0x48')){var _0x41fdfd=_0x5a822b[_0x75eb('0x24')]({'plain':!![]});var _0x4bb251=_0x75eb('0x25');return db[_0x75eb('0x4b')][_0x75eb('0x46')]({'where':{'name':_0x4bb251,'userProfileId':_0xd80a43[_0x75eb('0x4c')]},'raw':!![]})[_0x75eb('0x23')](function(_0x2d1017){if(_0x2d1017&&_0x2d1017[_0x75eb('0x4d')]===0x0){return db[_0x75eb('0x26')]['create']({'name':_0x41fdfd['name'],'resourceId':_0x41fdfd['id'],'type':_0x2d1017[_0x75eb('0x29')],'sectionId':_0x2d1017['id']},{})[_0x75eb('0x23')](function(){return _0x5a822b;});}else{return _0x5a822b;}})[_0x75eb('0x40')](function(_0x1db0dd){logger[_0x75eb('0x27')](_0x75eb('0x4e'),_0x1db0dd);throw _0x1db0dd;});}return _0x5a822b;})[_0x75eb('0x23')](respondWithResult(_0xedc81a,0xc9))[_0x75eb('0x40')](handleError(_0xedc81a,null));};exports[_0x75eb('0x4f')]=function(_0x8e6727,_0x50f391){if(_0x8e6727[_0x75eb('0x47')]['id']){delete _0x8e6727[_0x75eb('0x47')]['id'];}return db[_0x75eb('0x2c')]['find']({'where':{'id':_0x8e6727[_0x75eb('0x42')]['id']}})[_0x75eb('0x23')](handleEntityNotFound(_0x50f391,null))[_0x75eb('0x23')](saveUpdates(_0x8e6727[_0x75eb('0x47')],null))[_0x75eb('0x23')](respondWithResult(_0x50f391,null))[_0x75eb('0x40')](handleError(_0x50f391,null));};exports[_0x75eb('0x22')]=function(_0x609cdf,_0x206f68){return db[_0x75eb('0x2c')]['find']({'where':{'id':_0x609cdf[_0x75eb('0x42')]['id']}})[_0x75eb('0x23')](handleEntityNotFound(_0x206f68,null))[_0x75eb('0x23')](removeEntity(_0x206f68,null))['catch'](handleError(_0x206f68,null));}; \ No newline at end of file +var _0xb854=['crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel'];(function(_0x434d56,_0xe593d8){var _0x1c7a02=function(_0x3676c9){while(--_0x3676c9){_0x434d56['push'](_0x434d56['shift']());}};_0x1c7a02(++_0xe593d8);}(_0xb854,0x145));var _0x4b85=function(_0x254923,_0x6d56d7){_0x254923=_0x254923-0x0;var _0x5611a8=_0xb854[_0x254923];return _0x5611a8;};'use strict';var emlformat=require(_0x4b85('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4b85('0x1'));var rp=require(_0x4b85('0x2'));var moment=require(_0x4b85('0x3'));var BPromise=require(_0x4b85('0x4'));var Mustache=require(_0x4b85('0x5'));var util=require(_0x4b85('0x6'));var path=require(_0x4b85('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b85('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b85('0x9'));var squel=require(_0x4b85('0xa'));var crypto=require(_0x4b85('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b85('0xc'));var toCsv=require(_0x4b85('0xd'));var querystring=require(_0x4b85('0xe'));var Papa=require(_0x4b85('0xf'));var Redis=require('ioredis');var authService=require(_0x4b85('0x10'));var qs=require(_0x4b85('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b85('0x12'));var logger=require(_0x4b85('0x13'))(_0x4b85('0x14'));var utils=require(_0x4b85('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4b85('0x16'));var db=require(_0x4b85('0x17'))['db'];function respondWithStatusCode(_0x184a06,_0x1d2b73){_0x1d2b73=_0x1d2b73||0xcc;return function(_0x40b16e){if(_0x40b16e){return _0x184a06['sendStatus'](_0x1d2b73);}return _0x184a06[_0x4b85('0x18')](_0x1d2b73)[_0x4b85('0x19')]();};}function respondWithResult(_0x434463,_0x3ca57b){_0x3ca57b=_0x3ca57b||0xc8;return function(_0x468f7f){if(_0x468f7f){return _0x434463[_0x4b85('0x18')](_0x3ca57b)['json'](_0x468f7f);}};}function respondWithFilteredResult(_0x299fa3,_0x415f21){return function(_0x19893a){if(_0x19893a){var _0x5ad450=typeof _0x415f21[_0x4b85('0x1a')]==='undefined'&&typeof _0x415f21[_0x4b85('0x1b')]===_0x4b85('0x1c');var _0x53b41c=_0x19893a[_0x4b85('0x1d')];var _0x5e17f1=_0x5ad450?0x0:_0x415f21[_0x4b85('0x1a')];var _0x46bf96=_0x5ad450?_0x19893a['count']:_0x415f21[_0x4b85('0x1a')]+_0x415f21[_0x4b85('0x1b')];var _0x3d50e8;if(_0x46bf96>=_0x53b41c){_0x46bf96=_0x53b41c;_0x3d50e8=0xc8;}else{_0x3d50e8=0xce;}_0x299fa3[_0x4b85('0x18')](_0x3d50e8);return _0x299fa3[_0x4b85('0x1e')](_0x4b85('0x1f'),_0x5e17f1+'-'+_0x46bf96+'/'+_0x53b41c)[_0x4b85('0x20')](_0x19893a);}return null;};}function patchUpdates(_0x20cdad){return function(_0x923bab){try{jsonpatch[_0x4b85('0x21')](_0x923bab,_0x20cdad,!![]);}catch(_0x3a9220){return BPromise[_0x4b85('0x22')](_0x3a9220);}return _0x923bab[_0x4b85('0x23')]();};}function saveUpdates(_0x64eb87,_0x2370f4){return function(_0x24f43a){if(_0x24f43a){return _0x24f43a[_0x4b85('0x24')](_0x64eb87)[_0x4b85('0x25')](function(_0x1d4f85){return _0x1d4f85;});}return null;};}function removeEntity(_0x3aaa62,_0x57e8bf){return function(_0x14d05a){if(_0x14d05a){return _0x14d05a[_0x4b85('0x26')]()[_0x4b85('0x25')](function(){var _0x8940d5=_0x14d05a['get']({'plain':!![]});var _0x2ee9b8='Variables';return db[_0x4b85('0x27')]['destroy']({'where':{'type':_0x2ee9b8,'resourceId':_0x8940d5['id']}})[_0x4b85('0x25')](function(){return _0x14d05a;});})[_0x4b85('0x25')](function(){_0x3aaa62['status'](0xcc)[_0x4b85('0x19')]();});}};}function handleEntityNotFound(_0x2c29a0,_0x2e93c1){return function(_0x208ce3){if(!_0x208ce3){_0x2c29a0[_0x4b85('0x28')](0x194);}return _0x208ce3;};}function handleError(_0x20e5ed,_0x3d0e07){_0x3d0e07=_0x3d0e07||0x1f4;return function(_0x8e2f02){logger[_0x4b85('0x29')](_0x8e2f02[_0x4b85('0x2a')]);if(_0x8e2f02[_0x4b85('0x2b')]){delete _0x8e2f02[_0x4b85('0x2b')];}_0x20e5ed[_0x4b85('0x18')](_0x3d0e07)[_0x4b85('0x2c')](_0x8e2f02);};}exports[_0x4b85('0x2d')]=function(_0x6b4387,_0x2b62f9){var _0x3ecca7={},_0x133e42={},_0x51f8a8={'count':0x0,'rows':[]};var _0xb418b6=_[_0x4b85('0x2e')](db[_0x4b85('0x2f')][_0x4b85('0x30')],function(_0x314b31){return{'name':_0x314b31[_0x4b85('0x31')],'type':_0x314b31[_0x4b85('0x32')]['key']};});_0x133e42['model']=_[_0x4b85('0x2e')](_0xb418b6,_0x4b85('0x2b'));_0x133e42[_0x4b85('0x33')]=_[_0x4b85('0x34')](_0x6b4387[_0x4b85('0x33')]);_0x133e42[_0x4b85('0x35')]=_['intersection'](_0x133e42[_0x4b85('0x36')],_0x133e42['query']);_0x3ecca7[_0x4b85('0x37')]=_[_0x4b85('0x38')](_0x133e42[_0x4b85('0x36')],qs[_0x4b85('0x39')](_0x6b4387[_0x4b85('0x33')][_0x4b85('0x39')]));_0x3ecca7[_0x4b85('0x37')]=_0x3ecca7['attributes']['length']?_0x3ecca7['attributes']:_0x133e42[_0x4b85('0x36')];if(!_0x6b4387['query'][_0x4b85('0x3a')](_0x4b85('0x3b'))){_0x3ecca7[_0x4b85('0x1b')]=qs['limit'](_0x6b4387[_0x4b85('0x33')][_0x4b85('0x1b')]);_0x3ecca7['offset']=qs[_0x4b85('0x1a')](_0x6b4387['query'][_0x4b85('0x1a')]);}_0x3ecca7[_0x4b85('0x3c')]=qs[_0x4b85('0x3d')](_0x6b4387[_0x4b85('0x33')][_0x4b85('0x3d')]);_0x3ecca7['where']=qs[_0x4b85('0x35')](_[_0x4b85('0x3e')](_0x6b4387[_0x4b85('0x33')],_0x133e42[_0x4b85('0x35')]),_0xb418b6);if(_0x6b4387['query'][_0x4b85('0x3f')]){_0x3ecca7[_0x4b85('0x40')]=_[_0x4b85('0x41')](_0x3ecca7[_0x4b85('0x40')],{'$or':_[_0x4b85('0x2e')](_0xb418b6,function(_0x305020){if(_0x305020[_0x4b85('0x32')]!=='VIRTUAL'){var _0x31c92e={};_0x31c92e[_0x305020['name']]={'$like':'%'+_0x6b4387[_0x4b85('0x33')][_0x4b85('0x3f')]+'%'};return _0x31c92e;}})});}_0x3ecca7=_['merge']({},_0x3ecca7,_0x6b4387[_0x4b85('0x42')]);var _0xf9f057={'where':_0x3ecca7['where']};return db[_0x4b85('0x2f')]['count'](_0xf9f057)['then'](function(_0x1fe669){_0x51f8a8[_0x4b85('0x1d')]=_0x1fe669;if(_0x6b4387[_0x4b85('0x33')][_0x4b85('0x43')]){_0x3ecca7[_0x4b85('0x44')]=[{'all':!![]}];}return db['Variable'][_0x4b85('0x45')](_0x3ecca7);})['then'](function(_0x276a82){_0x51f8a8[_0x4b85('0x46')]=_0x276a82;return _0x51f8a8;})[_0x4b85('0x25')](respondWithFilteredResult(_0x2b62f9,_0x3ecca7))[_0x4b85('0x47')](handleError(_0x2b62f9,null));};exports[_0x4b85('0x48')]=function(_0x43d62e,_0x5cb325){var _0x2f5dfa={'raw':!![],'where':{'id':_0x43d62e[_0x4b85('0x49')]['id']}},_0xf81a09={};_0xf81a09[_0x4b85('0x36')]=_['keys'](db[_0x4b85('0x2f')][_0x4b85('0x30')]);_0xf81a09[_0x4b85('0x33')]=_[_0x4b85('0x34')](_0x43d62e['query']);_0xf81a09['filters']=_[_0x4b85('0x38')](_0xf81a09['model'],_0xf81a09[_0x4b85('0x33')]);_0x2f5dfa[_0x4b85('0x37')]=_[_0x4b85('0x38')](_0xf81a09[_0x4b85('0x36')],qs[_0x4b85('0x39')](_0x43d62e[_0x4b85('0x33')][_0x4b85('0x39')]));_0x2f5dfa['attributes']=_0x2f5dfa[_0x4b85('0x37')][_0x4b85('0x4a')]?_0x2f5dfa[_0x4b85('0x37')]:_0xf81a09['model'];if(_0x43d62e[_0x4b85('0x33')][_0x4b85('0x43')]){_0x2f5dfa[_0x4b85('0x44')]=[{'all':!![]}];}_0x2f5dfa=_[_0x4b85('0x41')]({},_0x2f5dfa,_0x43d62e[_0x4b85('0x42')]);return db[_0x4b85('0x2f')][_0x4b85('0x4b')](_0x2f5dfa)[_0x4b85('0x25')](handleEntityNotFound(_0x5cb325,null))[_0x4b85('0x25')](respondWithResult(_0x5cb325,null))['catch'](handleError(_0x5cb325,null));};exports[_0x4b85('0x4c')]=function(_0x4fe7fa,_0x15eb86){return db['Variable'][_0x4b85('0x4c')](_0x4fe7fa[_0x4b85('0x4d')],{})[_0x4b85('0x25')](function(_0x447388){var _0x3559f5=_0x4fe7fa['user'][_0x4b85('0x4e')]({'plain':!![]});if(!_0x3559f5)throw new Error(_0x4b85('0x4f'));if(_0x3559f5[_0x4b85('0x50')]===_0x4b85('0x51')){var _0x341844=_0x447388['get']({'plain':!![]});var _0x52f270='Variables';return db['UserProfileSection']['find']({'where':{'name':_0x52f270,'userProfileId':_0x3559f5[_0x4b85('0x52')]},'raw':!![]})[_0x4b85('0x25')](function(_0x5a3b48){if(_0x5a3b48&&_0x5a3b48['autoAssociation']===0x0){return db[_0x4b85('0x27')][_0x4b85('0x4c')]({'name':_0x341844[_0x4b85('0x2b')],'resourceId':_0x341844['id'],'type':_0x5a3b48[_0x4b85('0x2b')],'sectionId':_0x5a3b48['id']},{})[_0x4b85('0x25')](function(){return _0x447388;});}else{return _0x447388;}})[_0x4b85('0x47')](function(_0x5055fb){logger[_0x4b85('0x29')](_0x4b85('0x53'),_0x5055fb);throw _0x5055fb;});}return _0x447388;})[_0x4b85('0x25')](respondWithResult(_0x15eb86,0xc9))[_0x4b85('0x47')](handleError(_0x15eb86,null));};exports[_0x4b85('0x24')]=function(_0x19721e,_0x41e1c0){if(_0x19721e['body']['id']){delete _0x19721e[_0x4b85('0x4d')]['id'];}return db[_0x4b85('0x2f')][_0x4b85('0x4b')]({'where':{'id':_0x19721e['params']['id']}})[_0x4b85('0x25')](handleEntityNotFound(_0x41e1c0,null))[_0x4b85('0x25')](saveUpdates(_0x19721e[_0x4b85('0x4d')],null))[_0x4b85('0x25')](respondWithResult(_0x41e1c0,null))[_0x4b85('0x47')](handleError(_0x41e1c0,null));};exports[_0x4b85('0x26')]=function(_0x3c906c,_0x330038){return db[_0x4b85('0x2f')]['find']({'where':{'id':_0x3c906c[_0x4b85('0x49')]['id']}})['then'](handleEntityNotFound(_0x330038,null))['then'](removeEntity(_0x330038,null))[_0x4b85('0x47')](handleError(_0x330038,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index bd86f46..10a3706 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 _0xd4af=['define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x596053,_0x1a9efd){var _0x1fb180=function(_0x14ccdf){while(--_0x14ccdf){_0x596053['push'](_0x596053['shift']());}};_0x1fb180(++_0x1a9efd);}(_0xd4af,0xc6));var _0xfd4a=function(_0x155d62,_0x4073fa){_0x155d62=_0x155d62-0x0;var _0x1329ec=_0xd4af[_0x155d62];return _0x1329ec;};'use strict';var _=require(_0xfd4a('0x0'));var util=require(_0xfd4a('0x1'));var logger=require(_0xfd4a('0x2'))(_0xfd4a('0x3'));var moment=require(_0xfd4a('0x4'));var BPromise=require(_0xfd4a('0x5'));var rp=require(_0xfd4a('0x6'));var fs=require('fs');var path=require(_0xfd4a('0x7'));var rimraf=require(_0xfd4a('0x8'));var config=require(_0xfd4a('0x9'));var attributes=require(_0xfd4a('0xa'));module[_0xfd4a('0xb')]=function(_0x170765,_0x516694){return _0x170765[_0xfd4a('0xc')](_0xfd4a('0xd'),attributes,{'tableName':_0xfd4a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8df3=['api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','util','../../config/logger'];(function(_0x281a01,_0x476d4e){var _0x323f9b=function(_0x401e03){while(--_0x401e03){_0x281a01['push'](_0x281a01['shift']());}};_0x323f9b(++_0x476d4e);}(_0x8df3,0xc0));var _0x38df=function(_0x555920,_0x2ecf1a){_0x555920=_0x555920-0x0;var _0x5ed383=_0x8df3[_0x555920];return _0x5ed383;};'use strict';var _=require(_0x38df('0x0'));var util=require(_0x38df('0x1'));var logger=require(_0x38df('0x2'))(_0x38df('0x3'));var moment=require(_0x38df('0x4'));var BPromise=require(_0x38df('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38df('0x6'));var rimraf=require(_0x38df('0x7'));var config=require(_0x38df('0x8'));var attributes=require(_0x38df('0x9'));module[_0x38df('0xa')]=function(_0x59df37,_0x104502){return _0x59df37[_0x38df('0xb')]('Variable',attributes,{'tableName':_0x38df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index c2e28d1..3b87b97 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 _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x29851d,_0x1a7baf){var _0x4d142f=function(_0x531542){while(--_0x531542){_0x29851d['push'](_0x29851d['shift']());}};_0x4d142f(++_0x1a7baf);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1e84df,_0x2a2757){_0x1e84df=_0x1e84df-0x0;var _0x19aa11=_0x1cb9[_0x1e84df];return _0x19aa11;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ 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(_0x17b9f3,_0x12ad33){var _0x1e6b98=function(_0x27c647){while(--_0x27c647){_0x17b9f3['push'](_0x17b9f3['shift']());}};_0x1e6b98(++_0x12ad33);}(_0x814b,0x1a2));var _0xb814=function(_0x1b1948,_0x49f451){_0x1b1948=_0x1b1948-0x0;var _0x3cbd38=_0x814b[_0x1b1948];return _0x3cbd38;};'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 fb34483..514d824 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 _0x1f05=['fetch','reset','/pull','pull','/restart','/migrations','migrations','exports','./version.controller','get','index','isAuthenticated','canUpdate'];(function(_0xa93b70,_0x50ed0e){var _0x570b01=function(_0x555e1b){while(--_0x555e1b){_0xa93b70['push'](_0xa93b70['shift']());}};_0x570b01(++_0x50ed0e);}(_0x1f05,0x119));var _0x51f0=function(_0xac2d9c,_0x3f86de){_0xac2d9c=_0xac2d9c-0x0;var _0x54fdd6=_0x1f05[_0xac2d9c];return _0x54fdd6;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x51f0('0x0'));router[_0x51f0('0x1')]('/',controller[_0x51f0('0x2')]);router['get']('/fetch',auth[_0x51f0('0x3')](),auth[_0x51f0('0x4')](),controller[_0x51f0('0x5')]);router[_0x51f0('0x1')]('/reset',auth[_0x51f0('0x3')](),auth[_0x51f0('0x4')](),controller[_0x51f0('0x6')]);router[_0x51f0('0x1')](_0x51f0('0x7'),auth[_0x51f0('0x3')](),auth['canUpdate'](),controller[_0x51f0('0x8')]);router[_0x51f0('0x1')](_0x51f0('0x9'),auth[_0x51f0('0x3')](),controller['restart']);router['get'](_0x51f0('0xa'),controller[_0x51f0('0xb')]);module[_0x51f0('0xc')]=router; \ No newline at end of file +var _0xfda2=['/reset','isAuthenticated','reset','/pull','/restart','/migrations','migrations','exports','Router','./version.controller','get','/fetch','canUpdate'];(function(_0x561197,_0x2d7d64){var _0x191270=function(_0x32d6e2){while(--_0x32d6e2){_0x561197['push'](_0x561197['shift']());}};_0x191270(++_0x2d7d64);}(_0xfda2,0x1b5));var _0x2fda=function(_0x5e2429,_0x3a1f37){_0x5e2429=_0x5e2429-0x0;var _0x2cf573=_0xfda2[_0x5e2429];return _0x2cf573;};'use strict';var express=require('express');var router=express[_0x2fda('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x2fda('0x1'));router[_0x2fda('0x2')]('/',controller['index']);router[_0x2fda('0x2')](_0x2fda('0x3'),auth['isAuthenticated'](),auth[_0x2fda('0x4')](),controller['fetch']);router[_0x2fda('0x2')](_0x2fda('0x5'),auth[_0x2fda('0x6')](),auth[_0x2fda('0x4')](),controller[_0x2fda('0x7')]);router[_0x2fda('0x2')](_0x2fda('0x8'),auth[_0x2fda('0x6')](),auth['canUpdate'](),controller['pull']);router[_0x2fda('0x2')](_0x2fda('0x9'),auth[_0x2fda('0x6')](),controller['restart']);router[_0x2fda('0x2')](_0x2fda('0xa'),controller[_0x2fda('0xb')]);module[_0x2fda('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 67d2b0d..7ed9033 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 _0x9ea8=['compare-versions','exec','../../mysqldb','../../config/environment','update','simple-git','root','index','exports','query','latest','fetch','tags','version','2.0.0','status','json','origin','master','error','info','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','\x20to\x20','last','join','UniqueConstraintError','lodash','pkginfo'];(function(_0x4ac21d,_0x2cdb70){var _0x2ac74b=function(_0x4001f3){while(--_0x4001f3){_0x4ac21d['push'](_0x4ac21d['shift']());}};_0x2ac74b(++_0x2cdb70);}(_0x9ea8,0x91));var _0x89ea=function(_0x15a93a,_0x4822e4){_0x15a93a=_0x15a93a-0x0;var _0x592780=_0x9ea8[_0x15a93a];return _0x592780;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x89ea('0x0'));var pkginfo=require(_0x89ea('0x1'))(module,'version');var compareVersions=require(_0x89ea('0x2'));var exec=require('child_process')[_0x89ea('0x3')];var db=require(_0x89ea('0x4'))['db'];var config=require(_0x89ea('0x5'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x89ea('0x6'));var git=require(_0x89ea('0x7'))(config[_0x89ea('0x8')]);exports[_0x89ea('0x9')]=function(_0x37c349,_0x15e185){var _0x15dd74={'current':module[_0x89ea('0xa')]['version'],'phonebar':0x2};if(_0x37c349[_0x89ea('0xb')]&&_0x37c349[_0x89ea('0xb')][_0x89ea('0xc')]){return git[_0x89ea('0xd')]()[_0x89ea('0xe')](function(_0x2ad6d2,_0x365998){_0x15dd74['latest']=(_0x2ad6d2?module[_0x89ea('0xa')][_0x89ea('0xf')]:_0x365998[_0x89ea('0xc')])||_0x89ea('0x10');return _0x15e185[_0x89ea('0x11')](0xc8)[_0x89ea('0x12')](_0x15dd74);});}else{return _0x15e185['status'](0xc8)['json'](_0x15dd74);}};exports[_0x89ea('0xd')]=function(_0x3ecd3a,_0x1d9eda){return git[_0x89ea('0xd')]([_0x89ea('0x13'),_0x89ea('0x14')],function(_0x57f1be){if(_0x57f1be){logger[_0x89ea('0x15')](_0x57f1be);return _0x1d9eda['status'](0x1f4)[_0x89ea('0x12')](_0x57f1be);}logger[_0x89ea('0x16')]('git\x20fetch');return _0x1d9eda[_0x89ea('0x11')](0xc8)[_0x89ea('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x89ea('0x17')]=function(_0x32a5a2,_0x1750f3){return git[_0x89ea('0x17')]([_0x89ea('0x18'),_0x89ea('0x19')],function(_0x14f223){if(_0x14f223){logger['error'](_0x14f223);return _0x1750f3['status'](0x1f4)['json'](_0x14f223);}logger[_0x89ea('0x16')](_0x89ea('0x1a'));return _0x1750f3['status'](0xc8)[_0x89ea('0x12')]({'output':_0x89ea('0x1b')});});};exports[_0x89ea('0x1c')]=function(_0x9b859f,_0x4b587a){exec(_0x89ea('0x1d'),function(_0x169ce7,_0x405639,_0x177335){logger[_0x89ea('0x16')](_0x405639);logger[_0x89ea('0x16')](_0x177335);if(_0x169ce7){logger[_0x89ea('0x15')](_0x169ce7);return _0x4b587a[_0x89ea('0x11')](0x1f4)[_0x89ea('0x12')](_0x169ce7);}return _0x4b587a[_0x89ea('0x11')](0xc8)['json']({'output':_0x405639});});};exports['restart']=function(_0x389906,_0x34838e){return pm2['restart']('motion2')[_0x89ea('0x1e')](function(_0x2eb1c8){logger[_0x89ea('0x16')]('pm2\x20restart\x20motion\x20%s',_0x2eb1c8);return _0x34838e[_0x89ea('0x11')](0xc8)[_0x89ea('0x12')]({'output':_0x89ea('0x1f')});})[_0x89ea('0x20')](function(_0x181cd2){logger[_0x89ea('0x15')](_0x181cd2);return _0x34838e[_0x89ea('0x11')](0x1f4)[_0x89ea('0x12')](_0x181cd2);});};exports[_0x89ea('0x21')]=function(_0x3c4034,_0x5b7dea){var _0x36911e=fs[_0x89ea('0x22')](path['join'](config['root'],_0x89ea('0x23'),'migrations'));var _0x33ce77=[];for(var _0x1e690d=0x0;_0x1e690d<_0x36911e[_0x89ea('0x24')];_0x1e690d++){var _0x26504f=_0x36911e[_0x1e690d]['replace']('.js','');if(compareVersions(module[_0x89ea('0xa')][_0x89ea('0xf')],_0x26504f)===-0x1){_0x33ce77[_0x89ea('0x25')](_0x26504f);}}if(_0x33ce77[_0x89ea('0x24')]){var _0x6bbfec=_0x33ce77[_0x89ea('0x26')](compareVersions);var _0x1b9694=new Umzug({'storage':_0x89ea('0x27'),'storageOptions':{'model':db[_0x89ea('0x28')],'modelName':_0x89ea('0x28'),'columnName':_0x89ea('0xf')},'migrations':{'params':[db[_0x89ea('0x27')][_0x89ea('0x29')](),db[_0x89ea('0x27')]['constructor'],function(){throw new Error(_0x89ea('0x2a'));}],'path':path['join'](config['root'],'server',_0x89ea('0x21')),'pattern':/\.js$/}});_0x1b9694['up']({'migrations':_[_0x89ea('0x2b')](_0x6bbfec,function(_0x4e0a5b){return _0x4e0a5b+_0x89ea('0x2c');})})[_0x89ea('0x1e')](function(){return _0x5b7dea[_0x89ea('0x11')](0xc8)[_0x89ea('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x89ea('0xa')][_0x89ea('0xf')]+_0x89ea('0x2d')+_[_0x89ea('0x2e')](_0x6bbfec),'migrations':_[_0x89ea('0x2f')](_0x6bbfec)});})[_0x89ea('0x20')](function(_0x202754){if(_0x202754 instanceof db['sequelize'][_0x89ea('0x30')]){return _0x5b7dea[_0x89ea('0x11')](0xc8)[_0x89ea('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x5b7dea[_0x89ea('0x11')](0x1f4)[_0x89ea('0x12')](_0x202754);}});}else{return _0x5b7dea['status'](0xc8)[_0x89ea('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x7613=['replace','push','sort','sequelize','Migration','constructor','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','version','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','length'];(function(_0x4bd8b7,_0x345688){var _0x28dfcb=function(_0x533b0a){while(--_0x533b0a){_0x4bd8b7['push'](_0x4bd8b7['shift']());}};_0x28dfcb(++_0x345688);}(_0x7613,0x125));var _0x3761=function(_0x552f50,_0x3f6f0f){_0x552f50=_0x552f50-0x0;var _0x3b5f7a=_0x7613[_0x552f50];return _0x3b5f7a;};'use strict';var Umzug=require('umzug');var path=require(_0x3761('0x0'));var fs=require('fs');var _=require(_0x3761('0x1'));var pkginfo=require(_0x3761('0x2'))(module,'version');var compareVersions=require(_0x3761('0x3'));var exec=require('child_process')[_0x3761('0x4')];var db=require(_0x3761('0x5'))['db'];var config=require(_0x3761('0x6'));var pm2=require(_0x3761('0x7'));var logger=require(_0x3761('0x8'))(_0x3761('0x9'));var git=require(_0x3761('0xa'))(config[_0x3761('0xb')]);exports[_0x3761('0xc')]=function(_0x589606,_0xc40d53){var _0x3de6ad={'current':module[_0x3761('0xd')]['version'],'phonebar':0x2};if(_0x589606[_0x3761('0xe')]&&_0x589606['query'][_0x3761('0xf')]){return git[_0x3761('0x10')]()[_0x3761('0x11')](function(_0x515bd8,_0xcf2fa6){_0x3de6ad[_0x3761('0xf')]=(_0x515bd8?module[_0x3761('0xd')][_0x3761('0x12')]:_0xcf2fa6[_0x3761('0xf')])||_0x3761('0x13');return _0xc40d53[_0x3761('0x14')](0xc8)['json'](_0x3de6ad);});}else{return _0xc40d53[_0x3761('0x14')](0xc8)[_0x3761('0x15')](_0x3de6ad);}};exports[_0x3761('0x10')]=function(_0xdfc667,_0x535d06){return git[_0x3761('0x10')]([_0x3761('0x16'),_0x3761('0x17')],function(_0x316df1){if(_0x316df1){logger[_0x3761('0x18')](_0x316df1);return _0x535d06[_0x3761('0x14')](0x1f4)[_0x3761('0x15')](_0x316df1);}logger[_0x3761('0x19')](_0x3761('0x1a'));return _0x535d06[_0x3761('0x14')](0xc8)[_0x3761('0x15')]({'output':_0x3761('0x1b')});});};exports['reset']=function(_0x3c19d9,_0xed2b61){return git[_0x3761('0x1c')]([_0x3761('0x1d'),_0x3761('0x1e')],function(_0x377e6f){if(_0x377e6f){logger['error'](_0x377e6f);return _0xed2b61[_0x3761('0x14')](0x1f4)['json'](_0x377e6f);}logger[_0x3761('0x19')](_0x3761('0x1f'));return _0xed2b61[_0x3761('0x14')](0xc8)[_0x3761('0x15')]({'output':_0x3761('0x20')});});};exports[_0x3761('0x21')]=function(_0x380a17,_0x1f0350){exec('npm\x20install\x20--production',function(_0x3ae5bf,_0x5e9d0e,_0x3baa47){logger[_0x3761('0x19')](_0x5e9d0e);logger['info'](_0x3baa47);if(_0x3ae5bf){logger['error'](_0x3ae5bf);return _0x1f0350[_0x3761('0x14')](0x1f4)[_0x3761('0x15')](_0x3ae5bf);}return _0x1f0350[_0x3761('0x14')](0xc8)[_0x3761('0x15')]({'output':_0x5e9d0e});});};exports[_0x3761('0x22')]=function(_0x2ec297,_0x2625ee){return pm2[_0x3761('0x22')](_0x3761('0x23'))['then'](function(_0x26625e){logger['info'](_0x3761('0x24'),_0x26625e);return _0x2625ee['status'](0xc8)[_0x3761('0x15')]({'output':_0x3761('0x25')});})[_0x3761('0x26')](function(_0x644373){logger[_0x3761('0x18')](_0x644373);return _0x2625ee[_0x3761('0x14')](0x1f4)['json'](_0x644373);});};exports[_0x3761('0x27')]=function(_0x5458de,_0x5e8a3c){var _0x5b3640=fs['readdirSync'](path[_0x3761('0x28')](config[_0x3761('0xb')],_0x3761('0x29'),_0x3761('0x27')));var _0x27a320=[];for(var _0x154d6f=0x0;_0x154d6f<_0x5b3640[_0x3761('0x2a')];_0x154d6f++){var _0x3b3d3d=_0x5b3640[_0x154d6f][_0x3761('0x2b')]('.js','');if(compareVersions(module[_0x3761('0xd')][_0x3761('0x12')],_0x3b3d3d)===-0x1){_0x27a320[_0x3761('0x2c')](_0x3b3d3d);}}if(_0x27a320[_0x3761('0x2a')]){var _0x2b1584=_0x27a320[_0x3761('0x2d')](compareVersions);var _0x36e400=new Umzug({'storage':_0x3761('0x2e'),'storageOptions':{'model':db['Migration'],'modelName':_0x3761('0x2f'),'columnName':_0x3761('0x12')},'migrations':{'params':[db[_0x3761('0x2e')]['getQueryInterface'](),db[_0x3761('0x2e')][_0x3761('0x30')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x3761('0x28')](config[_0x3761('0xb')],'server',_0x3761('0x27')),'pattern':/\.js$/}});_0x36e400['up']({'migrations':_[_0x3761('0x31')](_0x2b1584,function(_0x1a5a39){return _0x1a5a39+_0x3761('0x32');})})[_0x3761('0x33')](function(){return _0x5e8a3c[_0x3761('0x14')](0xc8)[_0x3761('0x15')]({'output':_0x3761('0x34')+module[_0x3761('0xd')]['version']+_0x3761('0x35')+_[_0x3761('0x36')](_0x2b1584),'migrations':_['join'](_0x2b1584)});})[_0x3761('0x26')](function(_0x1194c9){if(_0x1194c9 instanceof db['sequelize']['UniqueConstraintError']){return _0x5e8a3c[_0x3761('0x14')](0xc8)['json']({'output':_0x3761('0x37')});}else{return _0x5e8a3c[_0x3761('0x14')](0x1f4)[_0x3761('0x15')](_0x1194c9);}});}else{return _0x5e8a3c[_0x3761('0x14')](0xc8)['json']({'output':_0x3761('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 14ba1dd..f0c969c 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 _0x1ce0=['/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x1ce0,0x12a));var _0x01ce=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x1ce0[_0x5c1345];return _0x1c070d;};'use strict';var multer=require(_0x01ce('0x0'));var util=require(_0x01ce('0x1'));var path=require(_0x01ce('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x01ce('0x3'));var auth=require(_0x01ce('0x4'));var interaction=require(_0x01ce('0x5'));var config=require(_0x01ce('0x6'));var controller=require(_0x01ce('0x7'));router[_0x01ce('0x8')]('/',auth['isAuthenticated'](),controller[_0x01ce('0x9')]);router[_0x01ce('0x8')](_0x01ce('0xa'),auth[_0x01ce('0xb')](),controller[_0x01ce('0xc')]);router['get'](_0x01ce('0xd'),auth[_0x01ce('0xb')](),controller[_0x01ce('0xe')]);router[_0x01ce('0xf')]('/',auth[_0x01ce('0xb')](),controller[_0x01ce('0x10')]);router[_0x01ce('0x11')](_0x01ce('0xd'),auth['isAuthenticated'](),controller[_0x01ce('0x12')]);router[_0x01ce('0x13')]('/:id',auth[_0x01ce('0xb')](),controller[_0x01ce('0x14')]);module[_0x01ce('0x15')]=router; \ No newline at end of file +var _0x54c0=['/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54c0,0xf9));var _0x054c=function(_0x56cac2,_0x2aa5ab){_0x56cac2=_0x56cac2-0x0;var _0x4702e1=_0x54c0[_0x56cac2];return _0x4702e1;};'use strict';var multer=require(_0x054c('0x0'));var util=require(_0x054c('0x1'));var path=require(_0x054c('0x2'));var timeout=require(_0x054c('0x3'));var express=require(_0x054c('0x4'));var router=express[_0x054c('0x5')]();var fs_extra=require(_0x054c('0x6'));var auth=require(_0x054c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x054c('0x8'));var controller=require(_0x054c('0x9'));router[_0x054c('0xa')]('/',auth[_0x054c('0xb')](),controller[_0x054c('0xc')]);router[_0x054c('0xa')](_0x054c('0xd'),auth[_0x054c('0xb')](),controller[_0x054c('0xe')]);router[_0x054c('0xa')](_0x054c('0xf'),auth[_0x054c('0xb')](),controller[_0x054c('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x054c('0x11')]);router[_0x054c('0x12')]('/:id',auth[_0x054c('0xb')](),controller[_0x054c('0x13')]);router['delete']('/:id',auth[_0x054c('0xb')](),controller[_0x054c('0x14')]);module[_0x054c('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index d9a25b7..9a1c2f7 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 _0x5f2f=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x11dd23,_0x5ee7cb){var _0x1e2f62=function(_0x313a68){while(--_0x313a68){_0x11dd23['push'](_0x11dd23['shift']());}};_0x1e2f62(++_0x5ee7cb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x520a18,_0x2e7d0a){_0x520a18=_0x520a18-0x0;var _0x5b0ba6=_0x5f2f[_0x520a18];return _0x5b0ba6;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'type':{'type':Sequelize[_0xf5f2('0x2')]},'uniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'calleridnum':{'type':Sequelize[_0xf5f2('0x2')]},'calleridname':{'type':Sequelize[_0xf5f2('0x2')]},'queue':{'type':Sequelize[_0xf5f2('0x2')]},'interface':{'type':Sequelize[_0xf5f2('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf5f2('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xf5f2('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xf5f2('0x3')]},'agentdumpAt':{'type':Sequelize[_0xf5f2('0x3')]},'holdtime':{'type':Sequelize[_0xf5f2('0x4')]},'agentcomplete':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf5f2('0x4')]},'agentacw':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf5f2('0x2')]},'lastevent':{'type':Sequelize[_0xf5f2('0x2')]},'channel':{'type':Sequelize[_0xf5f2('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf5f2('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf5f2('0x2')]},'accountcode':{'type':Sequelize[_0xf5f2('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf5f2('0x2')]},'priority':{'type':Sequelize[_0xf5f2('0x2')]},'destchannel':{'type':Sequelize[_0xf5f2('0x2')]},'destchannelstate':{'type':Sequelize[_0xf5f2('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xf5f2('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf5f2('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf5f2('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf5f2('0x2')]},'destlanguage':{'type':Sequelize[_0xf5f2('0x2')]},'destaccountcode':{'type':Sequelize[_0xf5f2('0x2')]},'destcontext':{'type':Sequelize[_0xf5f2('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xf5f2('0x2')]},'destuniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xf5f2('0x2')]},'transfer':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf5f2('0x2')],'comment':_0xf5f2('0x6')},'transferexten':{'type':Sequelize[_0xf5f2('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'agententerreason':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd4a2=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xd4a2,0x173));var _0x2d4a=function(_0x448362,_0x17ec4c){_0x448362=_0x448362-0x0;var _0x373808=_0xd4a2[_0x448362];return _0x373808;};'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 diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 75c6ec3..b29b993 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(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 b9ab7a7..49c29e0 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 _0x8ba0=['define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x251389,_0x2db893){var _0x5c397d=function(_0x30e70b){while(--_0x30e70b){_0x251389['push'](_0x251389['shift']());}};_0x5c397d(++_0x2db893);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x232a8f,_0x112d26){_0x232a8f=_0x232a8f-0x0;var _0x4e39c7=_0x8ba0[_0x232a8f];return _0x4e39c7;};'use strict';var _=require(_0x08ba('0x0'));var util=require(_0x08ba('0x1'));var logger=require(_0x08ba('0x2'))(_0x08ba('0x3'));var moment=require(_0x08ba('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x08ba('0x5'));var rimraf=require(_0x08ba('0x6'));var config=require(_0x08ba('0x7'));var attributes=require(_0x08ba('0x8'));module[_0x08ba('0x9')]=function(_0x161a9d,_0x5f29fa){return _0x161a9d[_0x08ba('0xa')](_0x08ba('0xb'),attributes,{'tableName':_0x08ba('0xc'),'paranoid':![],'indexes':[{'fields':[_0x08ba('0xd'),_0x08ba('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0e=['./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x37be36,_0x18fe03){var _0x47108e=function(_0x3f32b6){while(--_0x3f32b6){_0x37be36['push'](_0x37be36['shift']());}};_0x47108e(++_0x18fe03);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5bf70b,_0x4cfc61){_0x5bf70b=_0x5bf70b-0x0;var _0x1c9b40=_0x8d0e[_0x5bf70b];return _0x1c9b40;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe8d0('0xd'),_0xe8d0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1974011..270b331 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 _0x5ee9=['attributes','debug','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where'];(function(_0x2d084e,_0x2b6f0d){var _0x211751=function(_0x3aee79){while(--_0x3aee79){_0x2d084e['push'](_0x2d084e['shift']());}};_0x211751(++_0x2b6f0d);}(_0x5ee9,0x188));var _0x95ee=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5ee9[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x95ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95ee('0x1'));var db=require(_0x95ee('0x2'))['db'];var utils=require(_0x95ee('0x3'));var logger=require(_0x95ee('0x4'))(_0x95ee('0x5'));var config=require('../../config/environment');var jayson=require(_0x95ee('0x6'));var client=jayson[_0x95ee('0x7')][_0x95ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41eaa3,_0x4524ca,_0x1011de){return new BPromise(function(_0x447086,_0x69fd91){return client['request'](_0x41eaa3,_0x1011de)[_0x95ee('0x9')](function(_0x329bfb){logger[_0x95ee('0xa')](_0x95ee('0xb'),_0x4524ca,'request\x20sent');logger['debug'](_0x95ee('0xc'),_0x4524ca,_0x95ee('0xd'),JSON[_0x95ee('0xe')](_0x329bfb));if(_0x329bfb[_0x95ee('0xf')]){if(_0x329bfb['error'][_0x95ee('0x10')]===0x1f4){logger[_0x95ee('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x4524ca,_0x329bfb['error'][_0x95ee('0x11')]);return _0x69fd91(_0x329bfb['error'][_0x95ee('0x11')]);}logger[_0x95ee('0xf')](_0x95ee('0xb'),_0x4524ca,_0x329bfb[_0x95ee('0xf')][_0x95ee('0x11')]);return _0x447086(_0x329bfb[_0x95ee('0xf')]['message']);}else{logger[_0x95ee('0xa')](_0x95ee('0xb'),_0x4524ca,'request\x20sent');_0x447086(_0x329bfb['result'][_0x95ee('0x11')]);}})[_0x95ee('0x12')](function(_0x1e8604){logger[_0x95ee('0xf')](_0x95ee('0xb'),_0x4524ca,_0x1e8604);_0x69fd91(_0x1e8604);});});}exports[_0x95ee('0x13')]=function(_0x659ad9){var _0x5e723c=this;return new Promise(function(_0x27514a,_0x2ec21c){return db[_0x95ee('0x14')][_0x95ee('0x15')](_0x659ad9[_0x95ee('0x16')],{'raw':_0x659ad9[_0x95ee('0x17')]?_0x659ad9['options'][_0x95ee('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x51c2c1){logger['info'](_0x95ee('0x13'),_0x659ad9);logger['debug'](_0x95ee('0x13'),_0x659ad9,JSON[_0x95ee('0xe')](_0x51c2c1));_0x27514a(_0x51c2c1);})['catch'](function(_0x52ff12){logger[_0x95ee('0xf')](_0x95ee('0x13'),_0x52ff12[_0x95ee('0x11')],_0x659ad9);_0x2ec21c(_0x5e723c[_0x95ee('0xf')](0x1f4,_0x52ff12[_0x95ee('0x11')]));});});};exports[_0x95ee('0x19')]=function(_0x515145){var _0x4a9bf3=this;return new Promise(function(_0x57dc16,_0xb993e8){return db[_0x95ee('0x14')][_0x95ee('0x1a')](_0x515145[_0x95ee('0x16')],{'raw':_0x515145['options']?_0x515145[_0x95ee('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x515145[_0x95ee('0x17')]?_0x515145[_0x95ee('0x17')][_0x95ee('0x1b')]||null:null,'attributes':_0x515145['options']?_0x515145[_0x95ee('0x17')][_0x95ee('0x1c')]||null:null,'limit':_0x515145[_0x95ee('0x17')]?_0x515145[_0x95ee('0x17')]['limit']||null:null})[_0x95ee('0x9')](function(_0x5984d1){logger[_0x95ee('0xa')](_0x95ee('0x19'),_0x515145);logger[_0x95ee('0x1d')](_0x95ee('0x19'),_0x515145,JSON[_0x95ee('0xe')](_0x5984d1));_0x57dc16(_0x5984d1);})[_0x95ee('0x12')](function(_0x2059c1){logger[_0x95ee('0xf')](_0x95ee('0x19'),_0x2059c1['message'],_0x515145);_0xb993e8(_0x4a9bf3[_0x95ee('0xf')](0x1f4,_0x2059c1['message']));});});}; \ No newline at end of file +var _0xf4bd=['attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','body','where'];(function(_0x3cf23,_0x3576f6){var _0x559bda=function(_0x3219a2){while(--_0x3219a2){_0x3cf23['push'](_0x3cf23['shift']());}};_0x559bda(++_0x3576f6);}(_0xf4bd,0x79));var _0xdf4b=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xf4bd[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xdf4b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdf4b('0x1'));var rs=require(_0xdf4b('0x2'));var fs=require('fs');var Redis=require(_0xdf4b('0x3'));var db=require(_0xdf4b('0x4'))['db'];var utils=require(_0xdf4b('0x5'));var logger=require(_0xdf4b('0x6'))(_0xdf4b('0x7'));var config=require(_0xdf4b('0x8'));var jayson=require(_0xdf4b('0x9'));var client=jayson[_0xdf4b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388cb8,_0x43a29c,_0x313b35){return new BPromise(function(_0x2d791d,_0x5292a3){return client[_0xdf4b('0xb')](_0x388cb8,_0x313b35)[_0xdf4b('0xc')](function(_0x15bb75){logger[_0xdf4b('0xd')](_0xdf4b('0xe'),_0x43a29c,_0xdf4b('0xf'));logger[_0xdf4b('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x43a29c,_0xdf4b('0xf'),JSON[_0xdf4b('0x11')](_0x15bb75));if(_0x15bb75[_0xdf4b('0x12')]){if(_0x15bb75[_0xdf4b('0x12')]['code']===0x1f4){logger[_0xdf4b('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x43a29c,_0x15bb75[_0xdf4b('0x12')]['message']);return _0x5292a3(_0x15bb75[_0xdf4b('0x12')]['message']);}logger[_0xdf4b('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x43a29c,_0x15bb75[_0xdf4b('0x12')][_0xdf4b('0x13')]);return _0x2d791d(_0x15bb75['error'][_0xdf4b('0x13')]);}else{logger['info'](_0xdf4b('0xe'),_0x43a29c,_0xdf4b('0xf'));_0x2d791d(_0x15bb75[_0xdf4b('0x14')][_0xdf4b('0x13')]);}})[_0xdf4b('0x15')](function(_0xfbdb03){logger['error'](_0xdf4b('0xe'),_0x43a29c,_0xfbdb03);_0x5292a3(_0xfbdb03);});});}exports['CreateVoiceAgentReport']=function(_0x567a79){var _0x37ec76=this;return new Promise(function(_0x2bdf16,_0x425c18){return db['VoiceAgentReport']['create'](_0x567a79['body'],{'raw':_0x567a79[_0xdf4b('0x16')]?_0x567a79['options'][_0xdf4b('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4b6551){logger[_0xdf4b('0xd')](_0xdf4b('0x18'),_0x567a79);logger['debug'](_0xdf4b('0x18'),_0x567a79,JSON[_0xdf4b('0x11')](_0x4b6551));_0x2bdf16(_0x4b6551);})[_0xdf4b('0x15')](function(_0x2ef766){logger['error'](_0xdf4b('0x18'),_0x2ef766[_0xdf4b('0x13')],_0x567a79);_0x425c18(_0x37ec76[_0xdf4b('0x12')](0x1f4,_0x2ef766[_0xdf4b('0x13')]));});});};exports[_0xdf4b('0x19')]=function(_0x296f2f){var _0x15326e=this;return new Promise(function(_0x1a6cce,_0x5474e4){return db['VoiceAgentReport'][_0xdf4b('0x1a')](_0x296f2f[_0xdf4b('0x1b')],{'raw':_0x296f2f[_0xdf4b('0x16')]?_0x296f2f[_0xdf4b('0x16')][_0xdf4b('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x296f2f[_0xdf4b('0x16')]?_0x296f2f[_0xdf4b('0x16')][_0xdf4b('0x1c')]||null:null,'attributes':_0x296f2f[_0xdf4b('0x16')]?_0x296f2f[_0xdf4b('0x16')][_0xdf4b('0x1d')]||null:null,'limit':_0x296f2f[_0xdf4b('0x16')]?_0x296f2f['options']['limit']||null:null})[_0xdf4b('0xc')](function(_0x181523){logger[_0xdf4b('0xd')](_0xdf4b('0x19'),_0x296f2f);logger[_0xdf4b('0x10')](_0xdf4b('0x19'),_0x296f2f,JSON[_0xdf4b('0x11')](_0x181523));_0x1a6cce(_0x181523);})[_0xdf4b('0x15')](function(_0x24069f){logger[_0xdf4b('0x12')]('UpdateVoiceAgentReport',_0x24069f[_0xdf4b('0x13')],_0x296f2f);_0x5474e4(_0x15326e['error'](0x1f4,_0x24069f[_0xdf4b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 8e49e64..9e1cd16 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 _0xd6d6=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post'];(function(_0x3edd46,_0xa8bbd0){var _0x389871=function(_0x50a502){while(--_0x50a502){_0x3edd46['push'](_0x3edd46['shift']());}};_0x389871(++_0xa8bbd0);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x129e60,_0x675348){_0x129e60=_0x129e60-0x0;var _0x10e3f1=_0xd6d6[_0x129e60];return _0x10e3f1;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require(_0x6d6d('0x3'));var express=require('express');var router=express[_0x6d6d('0x4')]();var fs_extra=require(_0x6d6d('0x5'));var auth=require(_0x6d6d('0x6'));var interaction=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var controller=require(_0x6d6d('0x9'));router[_0x6d6d('0xa')]('/',auth['isAuthenticated'](),controller[_0x6d6d('0xb')]);router[_0x6d6d('0xa')](_0x6d6d('0xc'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0xe')]);router[_0x6d6d('0xa')](_0x6d6d('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x6d6d('0x10')]('/',auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x11')]);router[_0x6d6d('0x12')](_0x6d6d('0xf'),auth['isAuthenticated'](),controller[_0x6d6d('0x13')]);router[_0x6d6d('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x6d6d('0x15')]);module[_0x6d6d('0x16')]=router; \ No newline at end of file +var _0x885a=['describe','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe'];(function(_0x412faa,_0x6d5ea8){var _0x204402=function(_0x1ddbe0){while(--_0x1ddbe0){_0x412faa['push'](_0x412faa['shift']());}};_0x204402(++_0x6d5ea8);}(_0x885a,0x180));var _0xa885=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x885a[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require(_0xa885('0x0'));var path=require(_0xa885('0x1'));var timeout=require(_0xa885('0x2'));var express=require(_0xa885('0x3'));var router=express['Router']();var fs_extra=require(_0xa885('0x4'));var auth=require(_0xa885('0x5'));var interaction=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var controller=require(_0xa885('0x8'));router[_0xa885('0x9')]('/',auth['isAuthenticated'](),controller[_0xa885('0xa')]);router[_0xa885('0x9')](_0xa885('0xb'),auth['isAuthenticated'](),controller[_0xa885('0xc')]);router[_0xa885('0x9')](_0xa885('0xd'),auth['isAuthenticated'](),controller[_0xa885('0xe')]);router[_0xa885('0xf')]('/',auth[_0xa885('0x10')](),controller[_0xa885('0x11')]);router[_0xa885('0x12')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller['update']);router[_0xa885('0x13')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller[_0xa885('0x14')]);module[_0xa885('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index c5ee88c..6e708f2 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 _0x2854=['outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','inbound','internal','outbound','inbound-fax'];(function(_0x222fd2,_0x4c6270){var _0x1fb752=function(_0x20b4ff){while(--_0x20b4ff){_0x222fd2['push'](_0x222fd2['shift']());}};_0x1fb752(++_0x4c6270);}(_0x2854,0xaa));var _0x4285=function(_0xce9e2e,_0x17656f){_0xce9e2e=_0xce9e2e-0x0;var _0x406cda=_0x2854[_0xce9e2e];return _0x406cda;};'use strict';var Sequelize=require(_0x4285('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4285('0x1')]},'type':{'type':Sequelize['ENUM'](_0x4285('0x2'),_0x4285('0x3'),_0x4285('0x4'),_0x4285('0x5'),_0x4285('0x6'),_0x4285('0x7'))},'tag':{'type':Sequelize[_0x4285('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x4285('0x1')]},'callerid':{'type':Sequelize[_0x4285('0x1')]},'channel':{'type':Sequelize[_0x4285('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x4285('0x1')]},'lastdata':{'type':Sequelize[_0x4285('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x4285('0x9')]},'answertime':{'type':Sequelize[_0x4285('0x9')]},'endtime':{'type':Sequelize[_0x4285('0x9')]},'duration':{'type':Sequelize[_0x4285('0xa')]},'billableseconds':{'type':Sequelize[_0x4285('0xa')]},'mohtime':{'type':Sequelize[_0x4285('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4285('0x1')]},'amaflags':{'type':Sequelize[_0x4285('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x4285('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x4285('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x4285('0x1')]},'note':{'type':Sequelize[_0x4285('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x4285('0xa')]},'sipcallid':{'type':Sequelize[_0x4285('0x1')]}}; \ No newline at end of file +var _0x9fa2=['TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound','dialer'];(function(_0x5936ad,_0x199c60){var _0x26bed2=function(_0x1035c4){while(--_0x1035c4){_0x5936ad['push'](_0x5936ad['shift']());}};_0x26bed2(++_0x199c60);}(_0x9fa2,0x67));var _0x29fa=function(_0x289842,_0x2d9db4){_0x289842=_0x289842-0x0;var _0x16155a=_0x9fa2[_0x289842];return _0x16155a;};'use strict';var Sequelize=require(_0x29fa('0x0'));module[_0x29fa('0x1')]={'uniqueid':{'type':Sequelize[_0x29fa('0x2')]},'type':{'type':Sequelize[_0x29fa('0x3')](_0x29fa('0x4'),'internal',_0x29fa('0x5'),'inbound-fax','outbound-fax',_0x29fa('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x29fa('0x2')]},'source':{'type':Sequelize[_0x29fa('0x2')]},'destination':{'type':Sequelize[_0x29fa('0x2')]},'destinationcontext':{'type':Sequelize[_0x29fa('0x2')]},'callerid':{'type':Sequelize[_0x29fa('0x2')]},'channel':{'type':Sequelize[_0x29fa('0x2')]},'destinationchannel':{'type':Sequelize[_0x29fa('0x2')]},'lastapplication':{'type':Sequelize[_0x29fa('0x2')]},'lastdata':{'type':Sequelize[_0x29fa('0x7')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x29fa('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29fa('0x8')]},'duration':{'type':Sequelize[_0x29fa('0x9')]},'billableseconds':{'type':Sequelize[_0x29fa('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x29fa('0x2')]},'amaflags':{'type':Sequelize[_0x29fa('0x2')]},'userfield':{'type':Sequelize[_0x29fa('0x2')]},'userDisposition':{'type':Sequelize[_0x29fa('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x29fa('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x29fa('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x29fa('0x2')]},'routeid':{'type':Sequelize[_0x29fa('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index f25fb5d..d40e361 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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x14e8e5,_0x2be694){_0x14e8e5=_0x14e8e5-0x0;var _0x344a5b=_0x5f2f[_0x14e8e5];return _0x344a5b;};'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')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x30010d,_0x35983b){_0x30010d=_0x30010d-0x0;var _0x4756fc=_0x2032[_0x30010d];return _0x4756fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 6975ab8..76fbdcd 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 _0xee12=['VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xee12,0xc5));var _0x2ee1=function(_0x15a588,_0x4bb103){_0x15a588=_0x15a588-0x0;var _0x402ca4=_0xee12[_0x15a588];return _0x402ca4;};'use strict';var _=require(_0x2ee1('0x0'));var util=require(_0x2ee1('0x1'));var logger=require(_0x2ee1('0x2'))(_0x2ee1('0x3'));var moment=require(_0x2ee1('0x4'));var BPromise=require(_0x2ee1('0x5'));var rp=require(_0x2ee1('0x6'));var fs=require('fs');var path=require(_0x2ee1('0x7'));var rimraf=require(_0x2ee1('0x8'));var config=require(_0x2ee1('0x9'));var attributes=require(_0x2ee1('0xa'));module[_0x2ee1('0xb')]=function(_0x4d3f64,_0x2c4255){return _0x4d3f64[_0x2ee1('0xc')](_0x2ee1('0xd'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x2ee1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b5b=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','util','api','moment','bluebird','request-promise','path'];(function(_0x107c75,_0x26cf4d){var _0x34da1a=function(_0x3ee5e9){while(--_0x3ee5e9){_0x107c75['push'](_0x107c75['shift']());}};_0x34da1a(++_0x26cf4d);}(_0x8b5b,0x6a));var _0xb8b5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8b5b[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xb8b5('0x0'));var logger=require('../../config/logger')(_0xb8b5('0x1'));var moment=require(_0xb8b5('0x2'));var BPromise=require(_0xb8b5('0x3'));var rp=require(_0xb8b5('0x4'));var fs=require('fs');var path=require(_0xb8b5('0x5'));var rimraf=require(_0xb8b5('0x6'));var config=require(_0xb8b5('0x7'));var attributes=require(_0xb8b5('0x8'));module[_0xb8b5('0x9')]=function(_0x10c79e,_0x21cb7c){return _0x10c79e[_0xb8b5('0xa')](_0xb8b5('0xb'),attributes,{'tableName':_0xb8b5('0xc'),'paranoid':![],'indexes':[{'fields':[_0xb8b5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a0d6c03..3fdbdad 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 _0x5543=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','error','message','GetVoiceCallReport','VoiceCallReport','findAll','raw','options','where','attributes','limit','include','map','model','stringify','catch','create','CreateVoiceCallReport','UpdateVoiceCallReport','lodash','util'];(function(_0x39eab7,_0x122041){var _0x4d78df=function(_0x54eb1b){while(--_0x54eb1b){_0x39eab7['push'](_0x39eab7['shift']());}};_0x4d78df(++_0x122041);}(_0x5543,0x8a));var _0x3554=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x5543[_0x5b34c0];return _0x242bd3;};'use strict';var _=require(_0x3554('0x0'));var util=require(_0x3554('0x1'));var moment=require(_0x3554('0x2'));var BPromise=require(_0x3554('0x3'));var rs=require(_0x3554('0x4'));var fs=require('fs');var Redis=require(_0x3554('0x5'));var db=require(_0x3554('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3554('0x7'))(_0x3554('0x8'));var config=require(_0x3554('0x9'));var jayson=require(_0x3554('0xa'));var client=jayson[_0x3554('0xb')][_0x3554('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x230afa,_0x22f257,_0x35f2a8){return new BPromise(function(_0x5befbd,_0x323c0d){return client['request'](_0x230afa,_0x35f2a8)[_0x3554('0xd')](function(_0x5a1b38){logger[_0x3554('0xe')](_0x3554('0xf'),_0x22f257,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x22f257,_0x3554('0x10'),JSON['stringify'](_0x5a1b38));if(_0x5a1b38[_0x3554('0x11')]){if(_0x5a1b38[_0x3554('0x11')]['code']===0x1f4){logger['error'](_0x3554('0xf'),_0x22f257,_0x5a1b38['error'][_0x3554('0x12')]);return _0x323c0d(_0x5a1b38[_0x3554('0x11')][_0x3554('0x12')]);}logger[_0x3554('0x11')](_0x3554('0xf'),_0x22f257,_0x5a1b38[_0x3554('0x11')][_0x3554('0x12')]);return _0x5befbd(_0x5a1b38['error'][_0x3554('0x12')]);}else{logger[_0x3554('0xe')](_0x3554('0xf'),_0x22f257,'request\x20sent');_0x5befbd(_0x5a1b38['result']['message']);}})['catch'](function(_0xa75242){logger['error'](_0x3554('0xf'),_0x22f257,_0xa75242);_0x323c0d(_0xa75242);});});}exports[_0x3554('0x13')]=function(_0x2e5ab8){var _0x22b5c2=this;return new Promise(function(_0x2e416d,_0x521714){return db[_0x3554('0x14')][_0x3554('0x15')]({'raw':_0x2e5ab8['options']?_0x2e5ab8['options'][_0x3554('0x16')]===undefined?!![]:![]:!![],'where':_0x2e5ab8[_0x3554('0x17')]?_0x2e5ab8[_0x3554('0x17')][_0x3554('0x18')]||null:null,'attributes':_0x2e5ab8[_0x3554('0x17')]?_0x2e5ab8[_0x3554('0x17')][_0x3554('0x19')]||null:null,'limit':_0x2e5ab8[_0x3554('0x17')]?_0x2e5ab8[_0x3554('0x17')][_0x3554('0x1a')]||null:null,'include':_0x2e5ab8[_0x3554('0x17')]?_0x2e5ab8[_0x3554('0x17')][_0x3554('0x1b')]?_[_0x3554('0x1c')](_0x2e5ab8['options'][_0x3554('0x1b')],function(_0xb7244b){return{'model':db[_0xb7244b['model']],'as':_0xb7244b['as'],'attributes':_0xb7244b[_0x3554('0x19')],'include':_0xb7244b[_0x3554('0x1b')]?_['map'](_0xb7244b[_0x3554('0x1b')],function(_0x44a6be){return{'model':db[_0x44a6be[_0x3554('0x1d')]],'as':_0x44a6be['as'],'attributes':_0x44a6be['attributes'],'include':_0x44a6be[_0x3554('0x1b')]?_['map'](_0x44a6be[_0x3554('0x1b')],function(_0x5454f8){return{'model':db[_0x5454f8[_0x3554('0x1d')]],'as':_0x5454f8['as'],'attributes':_0x5454f8[_0x3554('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3554('0xd')](function(_0x250d47){logger[_0x3554('0xe')](_0x3554('0x13'),_0x2e5ab8);logger['debug'](_0x3554('0x13'),_0x2e5ab8,JSON[_0x3554('0x1e')](_0x250d47));_0x2e416d(_0x250d47);})[_0x3554('0x1f')](function(_0x4413ec){logger[_0x3554('0x11')](_0x3554('0x13'),_0x4413ec[_0x3554('0x12')],_0x2e5ab8);_0x521714(_0x22b5c2[_0x3554('0x11')](0x1f4,_0x4413ec[_0x3554('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x2b3f12){var _0x3041f3=this;return new Promise(function(_0x1db686,_0x5c9133){return db[_0x3554('0x14')][_0x3554('0x20')](_0x2b3f12['body'],{'raw':_0x2b3f12[_0x3554('0x17')]?_0x2b3f12[_0x3554('0x17')][_0x3554('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x2252e0){logger[_0x3554('0xe')](_0x3554('0x21'),_0x2b3f12);logger['debug'](_0x3554('0x21'),_0x2b3f12,JSON[_0x3554('0x1e')](_0x2252e0));_0x1db686(_0x2252e0);})[_0x3554('0x1f')](function(_0x3334e0){logger[_0x3554('0x11')](_0x3554('0x21'),_0x3334e0[_0x3554('0x12')],_0x2b3f12);_0x5c9133(_0x3041f3[_0x3554('0x11')](0x1f4,_0x3334e0[_0x3554('0x12')]));});});};exports[_0x3554('0x22')]=function(_0x671cfe){var _0x4b0966=this;return new Promise(function(_0x5bd54d,_0x465781){return db['VoiceCallReport']['update'](_0x671cfe['body'],{'raw':_0x671cfe[_0x3554('0x17')]?_0x671cfe[_0x3554('0x17')][_0x3554('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x671cfe['options']?_0x671cfe[_0x3554('0x17')][_0x3554('0x18')]||null:null,'attributes':_0x671cfe[_0x3554('0x17')]?_0x671cfe['options'][_0x3554('0x19')]||null:null,'limit':_0x671cfe[_0x3554('0x17')]?_0x671cfe[_0x3554('0x17')][_0x3554('0x1a')]||null:null})[_0x3554('0xd')](function(_0x3e22d0){logger[_0x3554('0xe')](_0x3554('0x22'),_0x671cfe);logger['debug']('UpdateVoiceCallReport',_0x671cfe,JSON[_0x3554('0x1e')](_0x3e22d0));_0x5bd54d(_0x3e22d0);})[_0x3554('0x1f')](function(_0x122cb1){logger[_0x3554('0x11')](_0x3554('0x22'),_0x122cb1[_0x3554('0x12')],_0x671cfe);_0x465781(_0x4b0966[_0x3554('0x11')](0x1f4,_0x122cb1[_0x3554('0x12')]));});});}; \ No newline at end of file +var _0x7d39=['http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','include','map','model','attributes','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x569f1b,_0x28f4ae){var _0x56981f=function(_0x32dd9a){while(--_0x32dd9a){_0x569f1b['push'](_0x569f1b['shift']());}};_0x56981f(++_0x28f4ae);}(_0x7d39,0xb4));var _0x97d3=function(_0x3b0d12,_0x581b78){_0x3b0d12=_0x3b0d12-0x0;var _0x44eb08=_0x7d39[_0x3b0d12];return _0x44eb08;};'use strict';var _=require('lodash');var util=require(_0x97d3('0x0'));var moment=require(_0x97d3('0x1'));var BPromise=require('bluebird');var rs=require(_0x97d3('0x2'));var fs=require('fs');var Redis=require(_0x97d3('0x3'));var db=require(_0x97d3('0x4'))['db'];var utils=require(_0x97d3('0x5'));var logger=require(_0x97d3('0x6'))(_0x97d3('0x7'));var config=require('../../config/environment');var jayson=require(_0x97d3('0x8'));var client=jayson[_0x97d3('0x9')][_0x97d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e1c92,_0x176746,_0x5d2c31){return new BPromise(function(_0x47603f,_0x493e9a){return client[_0x97d3('0xb')](_0x2e1c92,_0x5d2c31)[_0x97d3('0xc')](function(_0x50e1d8){logger[_0x97d3('0xd')](_0x97d3('0xe'),_0x176746,_0x97d3('0xf'));logger[_0x97d3('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x176746,_0x97d3('0xf'),JSON[_0x97d3('0x11')](_0x50e1d8));if(_0x50e1d8[_0x97d3('0x12')]){if(_0x50e1d8[_0x97d3('0x12')][_0x97d3('0x13')]===0x1f4){logger[_0x97d3('0x12')](_0x97d3('0xe'),_0x176746,_0x50e1d8[_0x97d3('0x12')][_0x97d3('0x14')]);return _0x493e9a(_0x50e1d8[_0x97d3('0x12')][_0x97d3('0x14')]);}logger['error'](_0x97d3('0xe'),_0x176746,_0x50e1d8[_0x97d3('0x12')]['message']);return _0x47603f(_0x50e1d8['error'][_0x97d3('0x14')]);}else{logger[_0x97d3('0xd')](_0x97d3('0xe'),_0x176746,_0x97d3('0xf'));_0x47603f(_0x50e1d8[_0x97d3('0x15')][_0x97d3('0x14')]);}})[_0x97d3('0x16')](function(_0x13482b){logger['error'](_0x97d3('0xe'),_0x176746,_0x13482b);_0x493e9a(_0x13482b);});});}exports[_0x97d3('0x17')]=function(_0x16a268){var _0x2910a4=this;return new Promise(function(_0x3aae26,_0x47e35f){return db[_0x97d3('0x18')][_0x97d3('0x19')]({'raw':_0x16a268[_0x97d3('0x1a')]?_0x16a268[_0x97d3('0x1a')][_0x97d3('0x1b')]===undefined?!![]:![]:!![],'where':_0x16a268[_0x97d3('0x1a')]?_0x16a268[_0x97d3('0x1a')]['where']||null:null,'attributes':_0x16a268['options']?_0x16a268['options']['attributes']||null:null,'limit':_0x16a268[_0x97d3('0x1a')]?_0x16a268[_0x97d3('0x1a')][_0x97d3('0x1c')]||null:null,'include':_0x16a268[_0x97d3('0x1a')]?_0x16a268[_0x97d3('0x1a')][_0x97d3('0x1d')]?_[_0x97d3('0x1e')](_0x16a268[_0x97d3('0x1a')][_0x97d3('0x1d')],function(_0x5a3029){return{'model':db[_0x5a3029[_0x97d3('0x1f')]],'as':_0x5a3029['as'],'attributes':_0x5a3029[_0x97d3('0x20')],'include':_0x5a3029[_0x97d3('0x1d')]?_[_0x97d3('0x1e')](_0x5a3029[_0x97d3('0x1d')],function(_0x1fd732){return{'model':db[_0x1fd732[_0x97d3('0x1f')]],'as':_0x1fd732['as'],'attributes':_0x1fd732[_0x97d3('0x20')],'include':_0x1fd732[_0x97d3('0x1d')]?_[_0x97d3('0x1e')](_0x1fd732[_0x97d3('0x1d')],function(_0xc5faa1){return{'model':db[_0xc5faa1[_0x97d3('0x1f')]],'as':_0xc5faa1['as'],'attributes':_0xc5faa1[_0x97d3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x97d3('0xc')](function(_0x117946){logger[_0x97d3('0xd')](_0x97d3('0x17'),_0x16a268);logger[_0x97d3('0x10')](_0x97d3('0x17'),_0x16a268,JSON[_0x97d3('0x11')](_0x117946));_0x3aae26(_0x117946);})[_0x97d3('0x16')](function(_0x136e35){logger['error'](_0x97d3('0x17'),_0x136e35[_0x97d3('0x14')],_0x16a268);_0x47e35f(_0x2910a4[_0x97d3('0x12')](0x1f4,_0x136e35[_0x97d3('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x1baa28){var _0x136117=this;return new Promise(function(_0x506744,_0x2b3b68){return db[_0x97d3('0x18')][_0x97d3('0x21')](_0x1baa28['body'],{'raw':_0x1baa28['options']?_0x1baa28[_0x97d3('0x1a')][_0x97d3('0x1b')]===undefined?!![]:![]:!![]})[_0x97d3('0xc')](function(_0xbb59bb){logger[_0x97d3('0xd')](_0x97d3('0x22'),_0x1baa28);logger[_0x97d3('0x10')](_0x97d3('0x22'),_0x1baa28,JSON['stringify'](_0xbb59bb));_0x506744(_0xbb59bb);})['catch'](function(_0x3c51ff){logger['error'](_0x97d3('0x22'),_0x3c51ff['message'],_0x1baa28);_0x2b3b68(_0x136117[_0x97d3('0x12')](0x1f4,_0x3c51ff[_0x97d3('0x14')]));});});};exports[_0x97d3('0x23')]=function(_0x390815){var _0x284a06=this;return new Promise(function(_0x43de2e,_0x30b167){return db[_0x97d3('0x18')][_0x97d3('0x24')](_0x390815['body'],{'raw':_0x390815['options']?_0x390815[_0x97d3('0x1a')][_0x97d3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x390815[_0x97d3('0x1a')]?_0x390815['options'][_0x97d3('0x25')]||null:null,'attributes':_0x390815['options']?_0x390815[_0x97d3('0x1a')][_0x97d3('0x20')]||null:null,'limit':_0x390815[_0x97d3('0x1a')]?_0x390815[_0x97d3('0x1a')][_0x97d3('0x1c')]||null:null})['then'](function(_0x4c0a7a){logger[_0x97d3('0xd')](_0x97d3('0x23'),_0x390815);logger[_0x97d3('0x10')]('UpdateVoiceCallReport',_0x390815,JSON['stringify'](_0x4c0a7a));_0x43de2e(_0x4c0a7a);})[_0x97d3('0x16')](function(_0x36ef5b){logger['error'](_0x97d3('0x23'),_0x36ef5b[_0x97d3('0x14')],_0x390815);_0x30b167(_0x284a06[_0x97d3('0x12')](0x1f4,_0x36ef5b[_0x97d3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index a1baab0..647c5c8 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 _0xf415=['index','get','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceChanSpy.controller','isAuthenticated'];(function(_0x1541d0,_0x3d2de8){var _0x3ff055=function(_0x3792bd){while(--_0x3792bd){_0x1541d0['push'](_0x1541d0['shift']());}};_0x3ff055(++_0x3d2de8);}(_0xf415,0x1ab));var _0x5f41=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0xf415[_0x34df4a];return _0x145c69;};'use strict';var multer=require(_0x5f41('0x0'));var util=require(_0x5f41('0x1'));var path=require(_0x5f41('0x2'));var timeout=require(_0x5f41('0x3'));var express=require(_0x5f41('0x4'));var router=express[_0x5f41('0x5')]();var fs_extra=require(_0x5f41('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5f41('0x7'));var controller=require(_0x5f41('0x8'));router['get']('/',auth[_0x5f41('0x9')](),controller[_0x5f41('0xa')]);router[_0x5f41('0xb')](_0x5f41('0xc'),auth[_0x5f41('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5f41('0xd')]);router[_0x5f41('0xe')]('/:id',auth[_0x5f41('0x9')](),controller[_0x5f41('0xf')]);router[_0x5f41('0x10')](_0x5f41('0xc'),auth['isAuthenticated'](),controller[_0x5f41('0x11')]);module[_0x5f41('0x12')]=router; \ No newline at end of file +var _0xd7c0=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer'];(function(_0x4dc0bc,_0x490bf0){var _0x470317=function(_0x324033){while(--_0x324033){_0x4dc0bc['push'](_0x4dc0bc['shift']());}};_0x470317(++_0x490bf0);}(_0xd7c0,0x1b4));var _0x0d7c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd7c0[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x0d7c('0x0'));var util=require(_0x0d7c('0x1'));var path=require(_0x0d7c('0x2'));var timeout=require(_0x0d7c('0x3'));var express=require(_0x0d7c('0x4'));var router=express['Router']();var fs_extra=require(_0x0d7c('0x5'));var auth=require(_0x0d7c('0x6'));var interaction=require(_0x0d7c('0x7'));var config=require('../../config/environment');var controller=require(_0x0d7c('0x8'));router[_0x0d7c('0x9')]('/',auth['isAuthenticated'](),controller[_0x0d7c('0xa')]);router[_0x0d7c('0x9')](_0x0d7c('0xb'),auth[_0x0d7c('0xc')](),controller[_0x0d7c('0xd')]);router[_0x0d7c('0xe')]('/',auth[_0x0d7c('0xc')](),controller[_0x0d7c('0xf')]);router[_0x0d7c('0x10')](_0x0d7c('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0d7c('0x11')](_0x0d7c('0xb'),auth[_0x0d7c('0xc')](),controller[_0x0d7c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index edbfa7c..031e1e7 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 _0x7507=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x5621e8,_0x257e0d){var _0x20d8a7=function(_0x34b36a){while(--_0x34b36a){_0x5621e8['push'](_0x5621e8['shift']());}};_0x20d8a7(++_0x257e0d);}(_0x7507,0x106));var _0x7750=function(_0x2bcf7b,_0x525d10){_0x2bcf7b=_0x2bcf7b-0x0;var _0x66511e=_0x7507[_0x2bcf7b];return _0x66511e;};'use strict';var Sequelize=require(_0x7750('0x0'));module[_0x7750('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x7750('0x2')],'unique':_0x7750('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x7750('0x2')],'set':function(_0x296272){this[_0x7750('0x4')](_0x7750('0x5'),_0x296272?_0x296272[_0x7750('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x7750('0x5'))?this[_0x7750('0x7')](_0x7750('0x5'))[_0x7750('0x8')](''):[];}},'auth':{'type':Sequelize[_0x7750('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x7750('0x2')]},'record':{'type':Sequelize[_0x7750('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x973f=['join','split','BOOLEAN','sequelize','STRING','name','setDataValue','options'];(function(_0x173380,_0x1a9df2){var _0x24f3a0=function(_0x523f12){while(--_0x523f12){_0x173380['push'](_0x173380['shift']());}};_0x24f3a0(++_0x1a9df2);}(_0x973f,0x9b));var _0xf973=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x973f[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require(_0xf973('0x0'));module['exports']={'name':{'type':Sequelize[_0xf973('0x1')]},'prefix':{'type':Sequelize[_0xf973('0x1')],'unique':_0xf973('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0xc12ca4){this[_0xf973('0x3')](_0xf973('0x4'),_0xc12ca4?_0xc12ca4[_0xf973('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xf973('0x4'))?this['getDataValue']('options')[_0xf973('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xf973('0x1')]},'record':{'type':Sequelize[_0xf973('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf973('0x1')]},'description':{'type':Sequelize[_0xf973('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a03f9ed..262d974 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 _0x7117=['rawAttributes','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','send','map','VoiceChanSpy','fieldName','key','model','name','filters','intersection','attributes','fields','query','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params'];(function(_0x5e8170,_0x1d9e9c){var _0x3ac9f8=function(_0x41b2fb){while(--_0x41b2fb){_0x5e8170['push'](_0x5e8170['shift']());}};_0x3ac9f8(++_0x1d9e9c);}(_0x7117,0x1ec));var _0x7711=function(_0x49b3a4,_0x403d60){_0x49b3a4=_0x49b3a4-0x0;var _0x20715b=_0x7117[_0x49b3a4];return _0x20715b;};'use strict';var emlformat=require(_0x7711('0x0'));var rimraf=require(_0x7711('0x1'));var zipdir=require(_0x7711('0x2'));var jsonpatch=require(_0x7711('0x3'));var rp=require('request-promise');var moment=require(_0x7711('0x4'));var BPromise=require(_0x7711('0x5'));var Mustache=require('mustache');var util=require(_0x7711('0x6'));var path=require('path');var sox=require(_0x7711('0x7'));var csv=require(_0x7711('0x8'));var ejs=require(_0x7711('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7711('0xa'));var deskjs=require(_0x7711('0xb'));var toCsv=require(_0x7711('0x8'));var querystring=require(_0x7711('0xc'));var Papa=require('papaparse');var Redis=require(_0x7711('0xd'));var authService=require(_0x7711('0xe'));var qs=require(_0x7711('0xf'));var as=require(_0x7711('0x10'));var hardwareService=require(_0x7711('0x11'));var logger=require('../../config/logger')(_0x7711('0x12'));var utils=require(_0x7711('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7711('0x14'));var db=require(_0x7711('0x15'))['db'];function respondWithStatusCode(_0x3d9269,_0x4c4e01){_0x4c4e01=_0x4c4e01||0xcc;return function(_0x2b13cb){if(_0x2b13cb){return _0x3d9269[_0x7711('0x16')](_0x4c4e01);}return _0x3d9269['status'](_0x4c4e01)[_0x7711('0x17')]();};}function respondWithResult(_0xe1ebfd,_0xf2cc5c){_0xf2cc5c=_0xf2cc5c||0xc8;return function(_0x223eea){if(_0x223eea){return _0xe1ebfd['status'](_0xf2cc5c)[_0x7711('0x18')](_0x223eea);}};}function respondWithFilteredResult(_0x2dbb60,_0xee7b2d){return function(_0x8ad57e){if(_0x8ad57e){var _0x28b28e=typeof _0xee7b2d[_0x7711('0x19')]===_0x7711('0x1a')&&typeof _0xee7b2d[_0x7711('0x1b')]===_0x7711('0x1a');var _0x3e3dcd=_0x8ad57e['count'];var _0x2b182f=_0x28b28e?0x0:_0xee7b2d['offset'];var _0x1bbea3=_0x28b28e?_0x8ad57e[_0x7711('0x1c')]:_0xee7b2d[_0x7711('0x19')]+_0xee7b2d[_0x7711('0x1b')];var _0x477234;if(_0x1bbea3>=_0x3e3dcd){_0x1bbea3=_0x3e3dcd;_0x477234=0xc8;}else{_0x477234=0xce;}_0x2dbb60[_0x7711('0x1d')](_0x477234);return _0x2dbb60[_0x7711('0x1e')](_0x7711('0x1f'),_0x2b182f+'-'+_0x1bbea3+'/'+_0x3e3dcd)[_0x7711('0x18')](_0x8ad57e);}return null;};}function patchUpdates(_0x5895c6){return function(_0x1d227f){try{jsonpatch[_0x7711('0x20')](_0x1d227f,_0x5895c6,!![]);}catch(_0x3dd245){return BPromise['reject'](_0x3dd245);}return _0x1d227f[_0x7711('0x21')]();};}function saveUpdates(_0x5180f6,_0x451e2e){return function(_0x217edf){if(_0x217edf){return _0x217edf[_0x7711('0x22')](_0x5180f6)[_0x7711('0x23')](function(_0x223cd5){return _0x223cd5;});}return null;};}function removeEntity(_0x18ac2a,_0x14874a){return function(_0x29da2b){if(_0x29da2b){return _0x29da2b[_0x7711('0x24')]()[_0x7711('0x23')](function(){var _0x2f9657=_0x29da2b[_0x7711('0x25')]({'plain':!![]});var _0xb2a5aa=_0x7711('0x26');return db[_0x7711('0x27')][_0x7711('0x24')]({'where':{'type':_0xb2a5aa,'resourceId':_0x2f9657['id']}})[_0x7711('0x23')](function(){return _0x29da2b;});})[_0x7711('0x23')](function(){_0x18ac2a[_0x7711('0x1d')](0xcc)[_0x7711('0x17')]();});}};}function handleEntityNotFound(_0x182675,_0x20c718){return function(_0x34ca6c){if(!_0x34ca6c){_0x182675[_0x7711('0x16')](0x194);}return _0x34ca6c;};}function handleError(_0x21004f,_0x2b8a00){_0x2b8a00=_0x2b8a00||0x1f4;return function(_0x4d1fd9){logger[_0x7711('0x28')](_0x4d1fd9[_0x7711('0x29')]);if(_0x4d1fd9['name']){delete _0x4d1fd9['name'];}_0x21004f[_0x7711('0x1d')](_0x2b8a00)[_0x7711('0x2a')](_0x4d1fd9);};}exports['index']=function(_0x5ad2f0,_0x3c1024){var _0x4e37f5={},_0x1979cd={},_0x3b9a07={'count':0x0,'rows':[]};var _0x4077b3=_[_0x7711('0x2b')](db[_0x7711('0x2c')]['rawAttributes'],function(_0x47ec57){return{'name':_0x47ec57[_0x7711('0x2d')],'type':_0x47ec57['type'][_0x7711('0x2e')]};});_0x1979cd[_0x7711('0x2f')]=_[_0x7711('0x2b')](_0x4077b3,_0x7711('0x30'));_0x1979cd['query']=_['keys'](_0x5ad2f0['query']);_0x1979cd[_0x7711('0x31')]=_[_0x7711('0x32')](_0x1979cd['model'],_0x1979cd['query']);_0x4e37f5[_0x7711('0x33')]=_[_0x7711('0x32')](_0x1979cd[_0x7711('0x2f')],qs[_0x7711('0x34')](_0x5ad2f0[_0x7711('0x35')][_0x7711('0x34')]));_0x4e37f5[_0x7711('0x33')]=_0x4e37f5['attributes']['length']?_0x4e37f5[_0x7711('0x33')]:_0x1979cd['model'];if(!_0x5ad2f0['query']['hasOwnProperty'](_0x7711('0x36'))){_0x4e37f5[_0x7711('0x1b')]=qs[_0x7711('0x1b')](_0x5ad2f0['query'][_0x7711('0x1b')]);_0x4e37f5['offset']=qs[_0x7711('0x19')](_0x5ad2f0['query'][_0x7711('0x19')]);}_0x4e37f5[_0x7711('0x37')]=qs[_0x7711('0x38')](_0x5ad2f0[_0x7711('0x35')]['sort']);_0x4e37f5[_0x7711('0x39')]=qs[_0x7711('0x31')](_[_0x7711('0x3a')](_0x5ad2f0[_0x7711('0x35')],_0x1979cd['filters']),_0x4077b3);if(_0x5ad2f0[_0x7711('0x35')]['filter']){_0x4e37f5[_0x7711('0x39')]=_[_0x7711('0x3b')](_0x4e37f5[_0x7711('0x39')],{'$or':_['map'](_0x4077b3,function(_0x388522){if(_0x388522['type']!==_0x7711('0x3c')){var _0x267e53={};_0x267e53[_0x388522[_0x7711('0x30')]]={'$like':'%'+_0x5ad2f0[_0x7711('0x35')][_0x7711('0x3d')]+'%'};return _0x267e53;}})});}_0x4e37f5=_[_0x7711('0x3b')]({},_0x4e37f5,_0x5ad2f0['options']);var _0x46e018={'where':_0x4e37f5[_0x7711('0x39')]};return db[_0x7711('0x2c')]['count'](_0x46e018)['then'](function(_0x35ad7f){_0x3b9a07['count']=_0x35ad7f;if(_0x5ad2f0[_0x7711('0x35')][_0x7711('0x3e')]){_0x4e37f5['include']=[{'all':!![]}];}return db[_0x7711('0x2c')][_0x7711('0x3f')](_0x4e37f5);})[_0x7711('0x23')](function(_0x5cb857){_0x3b9a07[_0x7711('0x40')]=_0x5cb857;return _0x3b9a07;})[_0x7711('0x23')](respondWithFilteredResult(_0x3c1024,_0x4e37f5))[_0x7711('0x41')](handleError(_0x3c1024,null));};exports[_0x7711('0x42')]=function(_0x4defc7,_0x1af6ee){var _0x340180={'raw':![],'where':{'id':_0x4defc7[_0x7711('0x43')]['id']}},_0x244500={};_0x244500[_0x7711('0x2f')]=_['keys'](db[_0x7711('0x2c')][_0x7711('0x44')]);_0x244500[_0x7711('0x35')]=_[_0x7711('0x45')](_0x4defc7['query']);_0x244500[_0x7711('0x31')]=_[_0x7711('0x32')](_0x244500['model'],_0x244500[_0x7711('0x35')]);_0x340180[_0x7711('0x33')]=_[_0x7711('0x32')](_0x244500['model'],qs[_0x7711('0x34')](_0x4defc7[_0x7711('0x35')][_0x7711('0x34')]));_0x340180[_0x7711('0x33')]=_0x340180[_0x7711('0x33')]['length']?_0x340180[_0x7711('0x33')]:_0x244500[_0x7711('0x2f')];if(_0x4defc7[_0x7711('0x35')][_0x7711('0x3e')]){_0x340180['include']=[{'all':!![]}];}_0x340180=_[_0x7711('0x3b')]({},_0x340180,_0x4defc7['options']);return db[_0x7711('0x2c')][_0x7711('0x46')](_0x340180)[_0x7711('0x23')](handleEntityNotFound(_0x1af6ee,null))[_0x7711('0x23')](respondWithResult(_0x1af6ee,null))[_0x7711('0x41')](handleError(_0x1af6ee,null));};exports[_0x7711('0x47')]=function(_0xc44e62,_0x226578){return db[_0x7711('0x2c')]['create'](_0xc44e62[_0x7711('0x48')],{})['then'](function(_0x235d8f){var _0x3ddda1=_0xc44e62['user'][_0x7711('0x25')]({'plain':!![]});if(!_0x3ddda1)throw new Error(_0x7711('0x49'));if(_0x3ddda1[_0x7711('0x4a')]===_0x7711('0x4b')){var _0x37f77c=_0x235d8f[_0x7711('0x25')]({'plain':!![]});var _0x443596=_0x7711('0x26');return db[_0x7711('0x4c')][_0x7711('0x46')]({'where':{'name':_0x443596,'userProfileId':_0x3ddda1[_0x7711('0x4d')]},'raw':!![]})[_0x7711('0x23')](function(_0x5eb49){if(_0x5eb49&&_0x5eb49[_0x7711('0x4e')]===0x0){return db[_0x7711('0x27')]['create']({'name':_0x37f77c[_0x7711('0x30')],'resourceId':_0x37f77c['id'],'type':_0x5eb49['name'],'sectionId':_0x5eb49['id']},{})[_0x7711('0x23')](function(){return _0x235d8f;});}else{return _0x235d8f;}})[_0x7711('0x41')](function(_0x3664da){logger[_0x7711('0x28')](_0x7711('0x4f'),_0x3664da);throw _0x3664da;});}return _0x235d8f;})[_0x7711('0x23')](respondWithResult(_0x226578,0xc9))['catch'](handleError(_0x226578,null));};exports[_0x7711('0x22')]=function(_0x1acc6f,_0x2615fa){if(_0x1acc6f[_0x7711('0x48')]['id']){delete _0x1acc6f['body']['id'];}return db['VoiceChanSpy'][_0x7711('0x46')]({'where':{'id':_0x1acc6f[_0x7711('0x43')]['id']}})[_0x7711('0x23')](handleEntityNotFound(_0x2615fa,null))[_0x7711('0x23')](saveUpdates(_0x1acc6f[_0x7711('0x48')],null))[_0x7711('0x23')](respondWithResult(_0x2615fa,null))[_0x7711('0x41')](handleError(_0x2615fa,null));};exports[_0x7711('0x24')]=function(_0x5ea62a,_0x1c0b4f){return db[_0x7711('0x2c')][_0x7711('0x46')]({'where':{'id':_0x5ea62a[_0x7711('0x43')]['id']}})[_0x7711('0x23')](handleEntityNotFound(_0x1c0b4f,null))[_0x7711('0x23')](removeEntity(_0x1c0b4f,null))['catch'](handleError(_0x1c0b4f,null));}; \ No newline at end of file +var _0x1491=['query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','options','includeAll','include','rows','catch','params','keys','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','error','name','send','map','VoiceChanSpy','rawAttributes','type','key','intersection','model'];(function(_0x2d120a,_0x5e4d33){var _0x205747=function(_0x3530de){while(--_0x3530de){_0x2d120a['push'](_0x2d120a['shift']());}};_0x205747(++_0x5e4d33);}(_0x1491,0x1b1));var _0x1149=function(_0x106641,_0x571045){_0x106641=_0x106641-0x0;var _0x2676ae=_0x1491[_0x106641];return _0x2676ae;};'use strict';var emlformat=require(_0x1149('0x0'));var rimraf=require(_0x1149('0x1'));var zipdir=require(_0x1149('0x2'));var jsonpatch=require(_0x1149('0x3'));var rp=require('request-promise');var moment=require(_0x1149('0x4'));var BPromise=require(_0x1149('0x5'));var Mustache=require(_0x1149('0x6'));var util=require(_0x1149('0x7'));var path=require(_0x1149('0x8'));var sox=require(_0x1149('0x9'));var csv=require(_0x1149('0xa'));var ejs=require(_0x1149('0xb'));var fs=require('fs');var fs_extra=require(_0x1149('0xc'));var _=require(_0x1149('0xd'));var squel=require(_0x1149('0xe'));var crypto=require(_0x1149('0xf'));var jsforce=require(_0x1149('0x10'));var deskjs=require(_0x1149('0x11'));var toCsv=require(_0x1149('0xa'));var querystring=require(_0x1149('0x12'));var Papa=require(_0x1149('0x13'));var Redis=require(_0x1149('0x14'));var authService=require(_0x1149('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x1149('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1149('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1149('0x18'))['db'];function respondWithStatusCode(_0x55ba22,_0x439553){_0x439553=_0x439553||0xcc;return function(_0x3531e6){if(_0x3531e6){return _0x55ba22[_0x1149('0x19')](_0x439553);}return _0x55ba22[_0x1149('0x1a')](_0x439553)[_0x1149('0x1b')]();};}function respondWithResult(_0x22a1b6,_0x5aa405){_0x5aa405=_0x5aa405||0xc8;return function(_0x4749f1){if(_0x4749f1){return _0x22a1b6['status'](_0x5aa405)['json'](_0x4749f1);}};}function respondWithFilteredResult(_0x669ae,_0xdac107){return function(_0x552de8){if(_0x552de8){var _0xdee3e5=typeof _0xdac107[_0x1149('0x1c')]===_0x1149('0x1d')&&typeof _0xdac107[_0x1149('0x1e')]===_0x1149('0x1d');var _0x27f49f=_0x552de8[_0x1149('0x1f')];var _0x373ca0=_0xdee3e5?0x0:_0xdac107[_0x1149('0x1c')];var _0x88c9b1=_0xdee3e5?_0x552de8[_0x1149('0x1f')]:_0xdac107[_0x1149('0x1c')]+_0xdac107[_0x1149('0x1e')];var _0x517c77;if(_0x88c9b1>=_0x27f49f){_0x88c9b1=_0x27f49f;_0x517c77=0xc8;}else{_0x517c77=0xce;}_0x669ae['status'](_0x517c77);return _0x669ae[_0x1149('0x20')](_0x1149('0x21'),_0x373ca0+'-'+_0x88c9b1+'/'+_0x27f49f)[_0x1149('0x22')](_0x552de8);}return null;};}function patchUpdates(_0x4781b8){return function(_0x27a2fb){try{jsonpatch['apply'](_0x27a2fb,_0x4781b8,!![]);}catch(_0x20b2bc){return BPromise[_0x1149('0x23')](_0x20b2bc);}return _0x27a2fb[_0x1149('0x24')]();};}function saveUpdates(_0x4d5649,_0x3a891c){return function(_0x2d6b4b){if(_0x2d6b4b){return _0x2d6b4b[_0x1149('0x25')](_0x4d5649)['then'](function(_0x695140){return _0x695140;});}return null;};}function removeEntity(_0x214f3e,_0x20a1b6){return function(_0x59eb5e){if(_0x59eb5e){return _0x59eb5e[_0x1149('0x26')]()[_0x1149('0x27')](function(){var _0x1f36ff=_0x59eb5e[_0x1149('0x28')]({'plain':!![]});var _0x1d6843=_0x1149('0x29');return db[_0x1149('0x2a')][_0x1149('0x26')]({'where':{'type':_0x1d6843,'resourceId':_0x1f36ff['id']}})[_0x1149('0x27')](function(){return _0x59eb5e;});})[_0x1149('0x27')](function(){_0x214f3e['status'](0xcc)[_0x1149('0x1b')]();});}};}function handleEntityNotFound(_0x17cf9b,_0x56a81e){return function(_0x5516d4){if(!_0x5516d4){_0x17cf9b[_0x1149('0x19')](0x194);}return _0x5516d4;};}function handleError(_0x4dc164,_0x593df7){_0x593df7=_0x593df7||0x1f4;return function(_0x1b633a){logger[_0x1149('0x2b')](_0x1b633a['stack']);if(_0x1b633a[_0x1149('0x2c')]){delete _0x1b633a[_0x1149('0x2c')];}_0x4dc164[_0x1149('0x1a')](_0x593df7)[_0x1149('0x2d')](_0x1b633a);};}exports['index']=function(_0x5d267a,_0x4f9834){var _0x1ce0e8={},_0x27619c={},_0x337569={'count':0x0,'rows':[]};var _0x482c8e=_[_0x1149('0x2e')](db[_0x1149('0x2f')][_0x1149('0x30')],function(_0x123317){return{'name':_0x123317['fieldName'],'type':_0x123317[_0x1149('0x31')][_0x1149('0x32')]};});_0x27619c['model']=_['map'](_0x482c8e,_0x1149('0x2c'));_0x27619c['query']=_['keys'](_0x5d267a['query']);_0x27619c['filters']=_[_0x1149('0x33')](_0x27619c[_0x1149('0x34')],_0x27619c[_0x1149('0x35')]);_0x1ce0e8['attributes']=_[_0x1149('0x33')](_0x27619c['model'],qs['fields'](_0x5d267a[_0x1149('0x35')][_0x1149('0x36')]));_0x1ce0e8[_0x1149('0x37')]=_0x1ce0e8[_0x1149('0x37')][_0x1149('0x38')]?_0x1ce0e8['attributes']:_0x27619c[_0x1149('0x34')];if(!_0x5d267a[_0x1149('0x35')][_0x1149('0x39')](_0x1149('0x3a'))){_0x1ce0e8[_0x1149('0x1e')]=qs['limit'](_0x5d267a[_0x1149('0x35')][_0x1149('0x1e')]);_0x1ce0e8[_0x1149('0x1c')]=qs[_0x1149('0x1c')](_0x5d267a[_0x1149('0x35')][_0x1149('0x1c')]);}_0x1ce0e8[_0x1149('0x3b')]=qs[_0x1149('0x3c')](_0x5d267a['query'][_0x1149('0x3c')]);_0x1ce0e8[_0x1149('0x3d')]=qs['filters'](_['pick'](_0x5d267a[_0x1149('0x35')],_0x27619c[_0x1149('0x3e')]),_0x482c8e);if(_0x5d267a[_0x1149('0x35')][_0x1149('0x3f')]){_0x1ce0e8['where']=_['merge'](_0x1ce0e8['where'],{'$or':_[_0x1149('0x2e')](_0x482c8e,function(_0x38a980){if(_0x38a980[_0x1149('0x31')]!=='VIRTUAL'){var _0x478a5c={};_0x478a5c[_0x38a980['name']]={'$like':'%'+_0x5d267a[_0x1149('0x35')]['filter']+'%'};return _0x478a5c;}})});}_0x1ce0e8=_['merge']({},_0x1ce0e8,_0x5d267a[_0x1149('0x40')]);var _0x47c84d={'where':_0x1ce0e8[_0x1149('0x3d')]};return db['VoiceChanSpy']['count'](_0x47c84d)['then'](function(_0x37ad54){_0x337569['count']=_0x37ad54;if(_0x5d267a['query'][_0x1149('0x41')]){_0x1ce0e8[_0x1149('0x42')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x1ce0e8);})[_0x1149('0x27')](function(_0x31e646){_0x337569[_0x1149('0x43')]=_0x31e646;return _0x337569;})[_0x1149('0x27')](respondWithFilteredResult(_0x4f9834,_0x1ce0e8))[_0x1149('0x44')](handleError(_0x4f9834,null));};exports['show']=function(_0x58b434,_0x3ccf97){var _0x31df65={'raw':![],'where':{'id':_0x58b434[_0x1149('0x45')]['id']}},_0x47af09={};_0x47af09['model']=_[_0x1149('0x46')](db['VoiceChanSpy'][_0x1149('0x30')]);_0x47af09[_0x1149('0x35')]=_[_0x1149('0x46')](_0x58b434[_0x1149('0x35')]);_0x47af09[_0x1149('0x3e')]=_['intersection'](_0x47af09[_0x1149('0x34')],_0x47af09[_0x1149('0x35')]);_0x31df65[_0x1149('0x37')]=_[_0x1149('0x33')](_0x47af09[_0x1149('0x34')],qs['fields'](_0x58b434['query'][_0x1149('0x36')]));_0x31df65[_0x1149('0x37')]=_0x31df65[_0x1149('0x37')][_0x1149('0x38')]?_0x31df65['attributes']:_0x47af09[_0x1149('0x34')];if(_0x58b434[_0x1149('0x35')]['includeAll']){_0x31df65[_0x1149('0x42')]=[{'all':!![]}];}_0x31df65=_[_0x1149('0x47')]({},_0x31df65,_0x58b434['options']);return db['VoiceChanSpy'][_0x1149('0x48')](_0x31df65)[_0x1149('0x27')](handleEntityNotFound(_0x3ccf97,null))['then'](respondWithResult(_0x3ccf97,null))[_0x1149('0x44')](handleError(_0x3ccf97,null));};exports[_0x1149('0x49')]=function(_0x3af860,_0x24bcc0){return db['VoiceChanSpy'][_0x1149('0x49')](_0x3af860[_0x1149('0x4a')],{})[_0x1149('0x27')](function(_0x332c28){var _0x19b5b1=_0x3af860[_0x1149('0x4b')][_0x1149('0x28')]({'plain':!![]});if(!_0x19b5b1)throw new Error(_0x1149('0x4c'));if(_0x19b5b1[_0x1149('0x4d')]===_0x1149('0x4b')){var _0xff32f4=_0x332c28[_0x1149('0x28')]({'plain':!![]});var _0x13c8ed='ChanSpies';return db[_0x1149('0x4e')][_0x1149('0x48')]({'where':{'name':_0x13c8ed,'userProfileId':_0x19b5b1[_0x1149('0x4f')]},'raw':!![]})[_0x1149('0x27')](function(_0x22e18d){if(_0x22e18d&&_0x22e18d['autoAssociation']===0x0){return db[_0x1149('0x2a')][_0x1149('0x49')]({'name':_0xff32f4[_0x1149('0x2c')],'resourceId':_0xff32f4['id'],'type':_0x22e18d[_0x1149('0x2c')],'sectionId':_0x22e18d['id']},{})[_0x1149('0x27')](function(){return _0x332c28;});}else{return _0x332c28;}})[_0x1149('0x44')](function(_0x301796){logger[_0x1149('0x2b')](_0x1149('0x50'),_0x301796);throw _0x301796;});}return _0x332c28;})[_0x1149('0x27')](respondWithResult(_0x24bcc0,0xc9))['catch'](handleError(_0x24bcc0,null));};exports[_0x1149('0x25')]=function(_0x44d8d6,_0x37c82e){if(_0x44d8d6['body']['id']){delete _0x44d8d6['body']['id'];}return db[_0x1149('0x2f')][_0x1149('0x48')]({'where':{'id':_0x44d8d6[_0x1149('0x45')]['id']}})['then'](handleEntityNotFound(_0x37c82e,null))['then'](saveUpdates(_0x44d8d6[_0x1149('0x4a')],null))[_0x1149('0x27')](respondWithResult(_0x37c82e,null))[_0x1149('0x44')](handleError(_0x37c82e,null));};exports[_0x1149('0x26')]=function(_0x5b6924,_0x16c12e){return db['VoiceChanSpy'][_0x1149('0x48')]({'where':{'id':_0x5b6924[_0x1149('0x45')]['id']}})[_0x1149('0x27')](handleEntityNotFound(_0x16c12e,null))['then'](removeEntity(_0x16c12e,null))['catch'](handleError(_0x16c12e,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c2f1b2c..84c520a 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 _0x7618=['recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','concat','internal','findAll','agent','then','catch','exports','models','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x7618,0xec));var _0x8761=function(_0x47427f,_0x410bf6){_0x47427f=_0x47427f-0x0;var _0x36f236=_0x7618[_0x47427f];return _0x36f236;};'use strict';var _=require(_0x8761('0x0'));var util=require(_0x8761('0x1'));var BPromise=require(_0x8761('0x2'));var attributes=require(_0x8761('0x3'));var getUserApplications=function(_0x18f369,_0x409fe6,_0x27bf21){var _0x457918=0x1;var _0x53277c=[];var _0x5e569e={'context':_0x409fe6[_0x8761('0x4')]||_0x8761('0x5'),'exten':util[_0x8761('0x6')](_0x8761('0x7'),_0x18f369['prefix'],_0x27bf21),'type':_0x8761('0x8'),'isApp':![],'ChanSpyId':_0x18f369['id'],'UserId':_0x409fe6['id']};_0x53277c[_0x8761('0x9')](_[_0x8761('0xa')]({'app':_0x8761('0xb'),'appdata':util[_0x8761('0x6')](_0x8761('0xc'),_0x8761('0xd')),'priority':_0x457918++},_0x5e569e));if(_0x18f369[_0x8761('0xe')]){_0x53277c[_0x8761('0x9')](_[_0x8761('0xa')]({'app':_0x8761('0xf'),'appdata':util[_0x8761('0x6')]('${UNIQUEID}.%s,a',_0x18f369[_0x8761('0x10')]),'priority':_0x457918++},_0x5e569e));}if(_0x18f369[_0x8761('0x11')]){_0x53277c[_0x8761('0x9')](_[_0x8761('0xa')]({'app':_0x8761('0x12'),'appdata':_0x18f369[_0x8761('0x13')],'priority':_0x457918++},_0x5e569e));}_0x53277c[_0x8761('0x9')](_['merge']({'app':_0x8761('0x14'),'appdata':util[_0x8761('0x6')](_0x8761('0x15'),_0x409fe6[_0x8761('0x16')],_0x18f369[_0x8761('0x17')]?_0x18f369[_0x8761('0x17')]['join'](''):''),'priority':_0x457918++},_0x5e569e));if(_0x18f369[_0x8761('0xe')]){_0x53277c[_0x8761('0x9')](_[_0x8761('0xa')]({'app':'StopMixMonitor','priority':_0x457918++},_0x5e569e));}return _0x53277c;};var getChanSpyApplications=function(_0x524f6c,_0x2212fd){var _0xc5b580=[];for(var _0x1e61e0=0x0,_0x199386=0x1;_0x1e61e0<_0x2212fd['length'];_0x1e61e0++,_0x199386=0x1){_0xc5b580=_0xc5b580[_0x8761('0x18')](getUserApplications(_0x524f6c,_0x2212fd[_0x1e61e0],_0x2212fd[_0x1e61e0][_0x8761('0x19')]));if(_0x2212fd[_0x1e61e0][_0x8761('0x19')]!=_0x2212fd[_0x1e61e0][_0x8761('0x16')]){_0xc5b580=_0xc5b580[_0x8761('0x18')](getUserApplications(_0x524f6c,_0x2212fd[_0x1e61e0],_0x2212fd[_0x1e61e0][_0x8761('0x16')]));}}return _0xc5b580;};var getChanSpyPromise=function(_0x5f5a7f,_0x5b7579){return new BPromise(function(_0x4ca039,_0x5ae4c8){return _0x5f5a7f['User'][_0x8761('0x1a')]({'attributes':['id',_0x8761('0x16'),'internal'],'where':{'role':_0x8761('0x1b'),'chanspy':!![]},'raw':!![]})[_0x8761('0x1c')](function(_0xaeae2e){if(_0xaeae2e){return _0x4ca039(getChanSpyApplications(_0x5b7579,_0xaeae2e));}return _0x4ca039([]);})[_0x8761('0x1d')](function(_0x21affc){_0x5ae4c8(_0x21affc);});});};module[_0x8761('0x1e')]=function(_0x1e97cb,_0x152d4c){var _0x56c487=_0x1e97cb[_0x8761('0x1f')];return _0x1e97cb['define']('VoiceChanSpy',attributes,{'tableName':_0x8761('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x26a525,_0x225f39,_0x5ab3cc){return getChanSpyPromise(_0x56c487,_0x26a525)['then'](function(_0xeca371){if(_0xeca371&&_0xeca371['length']){return _0x56c487[_0x8761('0x21')][_0x8761('0x22')](_0xeca371);}})[_0x8761('0x1c')](function(){_0x5ab3cc();})['catch'](function(_0x53b690){_0x5ab3cc(_0x53b690);});},'afterUpdate':function(_0x546fdd,_0x3b8d74,_0x15efc7){return _0x56c487[_0x8761('0x21')][_0x8761('0x23')]({'where':{'ChanSpyId':_0x546fdd['id']}})['then'](function(){return getChanSpyPromise(_0x56c487,_0x546fdd);})[_0x8761('0x1c')](function(_0xfb1c48){if(_0xfb1c48&&_0xfb1c48['length']){return _0x56c487[_0x8761('0x21')][_0x8761('0x22')](_0xfb1c48);}})[_0x8761('0x1c')](function(){_0x15efc7();})[_0x8761('0x1d')](function(_0x23cb48){_0x15efc7(_0x23cb48);});},'afterDestroy':function(_0xd04056,_0x2d9887,_0x4f86bf){return _0x56c487[_0x8761('0x21')][_0x8761('0x23')]({'where':{'ChanSpyId':_0xd04056['id']}})[_0x8761('0x1c')](function(){_0x4f86bf();})[_0x8761('0x1d')](function(_0x2467b3){_0x4f86bf(_0x2467b3);});}}});}; \ No newline at end of file +var _0xd113=['Set','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','record','StopMixMonitor','internal','concat','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','length','VoiceExtension','bulkCreate','lodash','util','context','from-sip','%s%s','prefix','push','merge'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xd113,0x1cc));var _0x3d11=function(_0x5be6b7,_0x1bfd7c){_0x5be6b7=_0x5be6b7-0x0;var _0xc2a75=_0xd113[_0x5be6b7];return _0xc2a75;};'use strict';var _=require(_0x3d11('0x0'));var util=require(_0x3d11('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xe7e53e,_0x59724f,_0x4a2ddf){var _0x5193b2=0x1;var _0x56b3cf=[];var _0x28f0a9={'context':_0x59724f[_0x3d11('0x2')]||_0x3d11('0x3'),'exten':util['format'](_0x3d11('0x4'),_0xe7e53e[_0x3d11('0x5')],_0x4a2ddf),'type':'system','isApp':![],'ChanSpyId':_0xe7e53e['id'],'UserId':_0x59724f['id']};_0x56b3cf[_0x3d11('0x6')](_[_0x3d11('0x7')]({'app':_0x3d11('0x8'),'appdata':util['format']('CDR(type)=%s','chanspy'),'priority':_0x5193b2++},_0x28f0a9));if(_0xe7e53e['record']){_0x56b3cf[_0x3d11('0x6')](_[_0x3d11('0x7')]({'app':_0x3d11('0x9'),'appdata':util[_0x3d11('0xa')](_0x3d11('0xb'),_0xe7e53e[_0x3d11('0xc')]),'priority':_0x5193b2++},_0x28f0a9));}if(_0xe7e53e['auth']){_0x56b3cf[_0x3d11('0x6')](_[_0x3d11('0x7')]({'app':_0x3d11('0xd'),'appdata':_0xe7e53e[_0x3d11('0xe')],'priority':_0x5193b2++},_0x28f0a9));}_0x56b3cf[_0x3d11('0x6')](_[_0x3d11('0x7')]({'app':_0x3d11('0xf'),'appdata':util[_0x3d11('0xa')](_0x3d11('0x10'),_0x59724f[_0x3d11('0x11')],_0xe7e53e[_0x3d11('0x12')]?_0xe7e53e[_0x3d11('0x12')]['join'](''):''),'priority':_0x5193b2++},_0x28f0a9));if(_0xe7e53e[_0x3d11('0x13')]){_0x56b3cf[_0x3d11('0x6')](_[_0x3d11('0x7')]({'app':_0x3d11('0x14'),'priority':_0x5193b2++},_0x28f0a9));}return _0x56b3cf;};var getChanSpyApplications=function(_0x4aba9f,_0xb34719){var _0x193b71=[];for(var _0x2cf14e=0x0,_0x5910af=0x1;_0x2cf14e<_0xb34719['length'];_0x2cf14e++,_0x5910af=0x1){_0x193b71=_0x193b71['concat'](getUserApplications(_0x4aba9f,_0xb34719[_0x2cf14e],_0xb34719[_0x2cf14e][_0x3d11('0x15')]));if(_0xb34719[_0x2cf14e]['internal']!=_0xb34719[_0x2cf14e][_0x3d11('0x11')]){_0x193b71=_0x193b71[_0x3d11('0x16')](getUserApplications(_0x4aba9f,_0xb34719[_0x2cf14e],_0xb34719[_0x2cf14e][_0x3d11('0x11')]));}}return _0x193b71;};var getChanSpyPromise=function(_0x33616c,_0x37a50a){return new BPromise(function(_0x237ee8,_0x36c5d7){return _0x33616c[_0x3d11('0x17')][_0x3d11('0x18')]({'attributes':['id','name',_0x3d11('0x15')],'where':{'role':_0x3d11('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x189ee4){if(_0x189ee4){return _0x237ee8(getChanSpyApplications(_0x37a50a,_0x189ee4));}return _0x237ee8([]);})[_0x3d11('0x1a')](function(_0x15e520){_0x36c5d7(_0x15e520);});});};module[_0x3d11('0x1b')]=function(_0x443402,_0x2be1d0){var _0x2b8d5d=_0x443402[_0x3d11('0x1c')];return _0x443402[_0x3d11('0x1d')](_0x3d11('0x1e'),attributes,{'tableName':_0x3d11('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xb32cc7,_0x5b7579,_0x1ba769){return getChanSpyPromise(_0x2b8d5d,_0xb32cc7)[_0x3d11('0x20')](function(_0x452e86){if(_0x452e86&&_0x452e86[_0x3d11('0x21')]){return _0x2b8d5d[_0x3d11('0x22')]['bulkCreate'](_0x452e86);}})['then'](function(){_0x1ba769();})[_0x3d11('0x1a')](function(_0x302865){_0x1ba769(_0x302865);});},'afterUpdate':function(_0x251672,_0x83eadd,_0x1ce335){return _0x2b8d5d[_0x3d11('0x22')]['destroy']({'where':{'ChanSpyId':_0x251672['id']}})['then'](function(){return getChanSpyPromise(_0x2b8d5d,_0x251672);})[_0x3d11('0x20')](function(_0x20865a){if(_0x20865a&&_0x20865a['length']){return _0x2b8d5d['VoiceExtension'][_0x3d11('0x23')](_0x20865a);}})['then'](function(){_0x1ce335();})['catch'](function(_0x374740){_0x1ce335(_0x374740);});},'afterDestroy':function(_0x20f063,_0x14a98e,_0x378a56){return _0x2b8d5d[_0x3d11('0x22')]['destroy']({'where':{'ChanSpyId':_0x20f063['id']}})[_0x3d11('0x20')](function(){_0x378a56();})['catch'](function(_0xd7288c){_0x378a56(_0xd7288c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6037b2c..9f82ae6 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 _0x6f0d=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0xb60fa4,_0x13ad73){var _0x111132=function(_0x3c6c17){while(--_0x3c6c17){_0xb60fa4['push'](_0xb60fa4['shift']());}};_0x111132(++_0x13ad73);}(_0x6f0d,0x16c));var _0xd6f0=function(_0xcaaec0,_0x253fb3){_0xcaaec0=_0xcaaec0-0x0;var _0x1e6ae4=_0x6f0d[_0xcaaec0];return _0x1e6ae4;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0x0eaa=['http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x354e4e,_0x74f187){var _0x1ca266=function(_0x5772d3){while(--_0x5772d3){_0x354e4e['push'](_0x354e4e['shift']());}};_0x1ca266(++_0x74f187);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x8f47ba,_0x512d97){_0x8f47ba=_0x8f47ba-0x0;var _0x36918c=_0x0eaa[_0x8f47ba];return _0x36918c;};'use strict';var _=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0ea('0x2'));var fs=require('fs');var Redis=require(_0xa0ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0ea('0x4'));var logger=require(_0xa0ea('0x5'))(_0xa0ea('0x6'));var config=require(_0xa0ea('0x7'));var jayson=require(_0xa0ea('0x8'));var client=jayson['client'][_0xa0ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x521881,_0x4b8856,_0x361178){return new BPromise(function(_0x8632a1,_0x5b2adc){return client['request'](_0x521881,_0x361178)[_0xa0ea('0xa')](function(_0x2746f2){logger[_0xa0ea('0xb')](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));logger['debug'](_0xa0ea('0xe'),_0x4b8856,_0xa0ea('0xd'),JSON[_0xa0ea('0xf')](_0x2746f2));if(_0x2746f2[_0xa0ea('0x10')]){if(_0x2746f2['error'][_0xa0ea('0x11')]===0x1f4){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x5b2adc(_0x2746f2['error'][_0xa0ea('0x12')]);}logger[_0xa0ea('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x8632a1(_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);}else{logger['info'](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));_0x8632a1(_0x2746f2[_0xa0ea('0x13')][_0xa0ea('0x12')]);}})[_0xa0ea('0x14')](function(_0x34b94c){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x34b94c);_0x5b2adc(_0x34b94c);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 44bc7fa..9a4eef8 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 _0xca4b=['fs-extra','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4daaa1,_0x4a1bbd){var _0x37a1fd=function(_0xa5d8c1){while(--_0xa5d8c1){_0x4daaa1['push'](_0x4daaa1['shift']());}};_0x37a1fd(++_0x4a1bbd);}(_0xca4b,0x18a));var _0xbca4=function(_0x50207d,_0x1fc7a7){_0x50207d=_0x50207d-0x0;var _0x106faf=_0xca4b[_0x50207d];return _0x106faf;};'use strict';var multer=require(_0xbca4('0x0'));var util=require(_0xbca4('0x1'));var path=require(_0xbca4('0x2'));var timeout=require(_0xbca4('0x3'));var express=require(_0xbca4('0x4'));var router=express[_0xbca4('0x5')]();var fs_extra=require(_0xbca4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbca4('0x7'));var config=require('../../config/environment');var controller=require(_0xbca4('0x8'));router[_0xbca4('0x9')]('/',auth[_0xbca4('0xa')](),controller['index']);router[_0xbca4('0x9')](_0xbca4('0xb'),auth[_0xbca4('0xa')](),controller[_0xbca4('0xc')]);router[_0xbca4('0xd')]('/',auth[_0xbca4('0xa')](),controller[_0xbca4('0xe')]);router[_0xbca4('0xf')](_0xbca4('0xb'),auth[_0xbca4('0xa')](),controller[_0xbca4('0x10')]);router[_0xbca4('0x11')](_0xbca4('0xb'),auth['isAuthenticated'](),controller[_0xbca4('0x12')]);module[_0xbca4('0x13')]=router; \ No newline at end of file +var _0xe51a=['exports','multer','path','connect-timeout','express','Router','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','update'];(function(_0x15f5bc,_0x591107){var _0x3c7089=function(_0x565652){while(--_0x565652){_0x15f5bc['push'](_0x15f5bc['shift']());}};_0x3c7089(++_0x591107);}(_0xe51a,0x1b3));var _0xae51=function(_0x24c30a,_0x58b97a){_0x24c30a=_0x24c30a-0x0;var _0x27eec6=_0xe51a[_0x24c30a];return _0x27eec6;};'use strict';var multer=require(_0xae51('0x0'));var util=require('util');var path=require(_0xae51('0x1'));var timeout=require(_0xae51('0x2'));var express=require(_0xae51('0x3'));var router=express[_0xae51('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xae51('0x5'));var controller=require(_0xae51('0x6'));router[_0xae51('0x7')]('/',auth[_0xae51('0x8')](),controller['index']);router[_0xae51('0x7')](_0xae51('0x9'),auth['isAuthenticated'](),controller[_0xae51('0xa')]);router[_0xae51('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xae51('0x9'),auth[_0xae51('0x8')](),controller[_0xae51('0xc')]);router['delete'](_0xae51('0x9'),auth[_0xae51('0x8')](),controller['destroy']);module[_0xae51('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index e8fcc27..e774dc4 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 _0xb530=['BOOLEAN','sequelize','name','STRING'];(function(_0x314570,_0x2a8734){var _0x47263f=function(_0x54628f){while(--_0x54628f){_0x314570['push'](_0x314570['shift']());}};_0x47263f(++_0x2a8734);}(_0xb530,0x16d));var _0x0b53=function(_0x5fc74,_0x2fb6c9){_0x5fc74=_0x5fc74-0x0;var _0x39257e=_0xb530[_0x5fc74];return _0x39257e;};'use strict';var Sequelize=require(_0x0b53('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0b53('0x1')},'description':{'type':Sequelize[_0x0b53('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x0b53('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3a5a=['sequelize','exports','STRING','name'];(function(_0x1d65cc,_0x496a21){var _0x3f312c=function(_0x56e22f){while(--_0x56e22f){_0x1d65cc['push'](_0x1d65cc['shift']());}};_0x3f312c(++_0x496a21);}(_0x3a5a,0x1e0));var _0xa3a5=function(_0x2fb2a9,_0x5badf7){_0x2fb2a9=_0x2fb2a9-0x0;var _0x106844=_0x3a5a[_0x2fb2a9];return _0x106844;};'use strict';var Sequelize=require(_0xa3a5('0x0'));module[_0xa3a5('0x1')]={'name':{'type':Sequelize[_0xa3a5('0x2')],'unique':_0xa3a5('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 024abb4..aaa8597 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 _0x23c9=['http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','offset','limit','undefined','count','status','set','json','apply','save','update','destroy','UserProfileResource','end','stack','name','send','index','map','VoiceContext','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','role','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','root','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2eb3fb,_0xdc30e8){var _0x29c07b=function(_0x41a588){while(--_0x41a588){_0x2eb3fb['push'](_0x2eb3fb['shift']());}};_0x29c07b(++_0xdc30e8);}(_0x23c9,0x1e1));var _0x923c=function(_0x673e91,_0x5066f8){_0x673e91=_0x673e91-0x0;var _0x3ee5cb=_0x23c9[_0x673e91];return _0x3ee5cb;};'use strict';var emlformat=require(_0x923c('0x0'));var rimraf=require(_0x923c('0x1'));var zipdir=require(_0x923c('0x2'));var jsonpatch=require(_0x923c('0x3'));var rp=require('request-promise');var moment=require(_0x923c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x923c('0x5'));var util=require(_0x923c('0x6'));var path=require(_0x923c('0x7'));var sox=require(_0x923c('0x8'));var csv=require(_0x923c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x923c('0xa'));var _=require(_0x923c('0xb'));var squel=require(_0x923c('0xc'));var crypto=require(_0x923c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x923c('0xe'));var toCsv=require(_0x923c('0x9'));var querystring=require(_0x923c('0xf'));var Papa=require(_0x923c('0x10'));var Redis=require(_0x923c('0x11'));var authService=require(_0x923c('0x12'));var qs=require(_0x923c('0x13'));var as=require(_0x923c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x923c('0x15'));var config=require(_0x923c('0x16'));var licenseUtil=require(_0x923c('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x923c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x427a96,_0x3124bd,_0x1aa469,_0x9a4792){return new BPromise(function(_0x4f01db,_0xbb090e){var _0x29c248=_0x9a4792||client;return _0x29c248[_0x923c('0x19')](_0x427a96,_0x1aa469)[_0x923c('0x1a')](function(_0x351021){logger[_0x923c('0x1b')](_0x923c('0x1c'),_0x3124bd,_0x923c('0x1d'));logger['debug'](_0x923c('0x1e'),_0x3124bd,_0x923c('0x1d'),JSON[_0x923c('0x1f')](_0x351021));if(_0x351021['error']){if(_0x351021[_0x923c('0x20')][_0x923c('0x21')]===0x1f4){logger['error'](_0x923c('0x1c'),_0x3124bd,_0x351021['error']['message']);return _0xbb090e(_0x351021['error'][_0x923c('0x22')]);}logger[_0x923c('0x20')]('VoiceContext,\x20%s,\x20%s',_0x3124bd,_0x351021[_0x923c('0x20')]['message']);return _0x4f01db(_0x351021[_0x923c('0x20')][_0x923c('0x22')]);}else{logger[_0x923c('0x1b')](_0x923c('0x1c'),_0x3124bd,_0x923c('0x1d'));_0x4f01db(_0x351021[_0x923c('0x23')]['message']);}})['catch'](function(_0x1b591f){logger[_0x923c('0x20')]('VoiceContext,\x20%s,\x20%s',_0x3124bd,_0x1b591f);_0xbb090e(_0x1b591f);});});}function respondWithStatusCode(_0x3bc0a0,_0x29b2af){_0x29b2af=_0x29b2af||0xcc;return function(_0x55a82c){if(_0x55a82c){return _0x3bc0a0[_0x923c('0x24')](_0x29b2af);}return _0x3bc0a0['status'](_0x29b2af)['end']();};}function respondWithResult(_0x4c687c,_0xd725d4){_0xd725d4=_0xd725d4||0xc8;return function(_0x1a0533){if(_0x1a0533){return _0x4c687c['status'](_0xd725d4)['json'](_0x1a0533);}};}function respondWithFilteredResult(_0x4da610,_0x3825e2){return function(_0x5329f0){if(_0x5329f0){var _0xf22b74=typeof _0x3825e2[_0x923c('0x25')]==='undefined'&&typeof _0x3825e2[_0x923c('0x26')]===_0x923c('0x27');var _0x3debe2=_0x5329f0[_0x923c('0x28')];var _0x35ba31=_0xf22b74?0x0:_0x3825e2[_0x923c('0x25')];var _0x179700=_0xf22b74?_0x5329f0[_0x923c('0x28')]:_0x3825e2[_0x923c('0x25')]+_0x3825e2[_0x923c('0x26')];var _0xba4d59;if(_0x179700>=_0x3debe2){_0x179700=_0x3debe2;_0xba4d59=0xc8;}else{_0xba4d59=0xce;}_0x4da610[_0x923c('0x29')](_0xba4d59);return _0x4da610[_0x923c('0x2a')]('Content-Range',_0x35ba31+'-'+_0x179700+'/'+_0x3debe2)[_0x923c('0x2b')](_0x5329f0);}return null;};}function patchUpdates(_0x1f5423){return function(_0x472bd8){try{jsonpatch[_0x923c('0x2c')](_0x472bd8,_0x1f5423,!![]);}catch(_0x4c4b14){return BPromise['reject'](_0x4c4b14);}return _0x472bd8[_0x923c('0x2d')]();};}function saveUpdates(_0x1ecfa6,_0x203ce6){return function(_0x52cb50){if(_0x52cb50){return _0x52cb50[_0x923c('0x2e')](_0x1ecfa6)['then'](function(_0x12674c){return _0x12674c;});}return null;};}function removeEntity(_0xcc4f44,_0x543444){return function(_0x1ca838){if(_0x1ca838){return _0x1ca838[_0x923c('0x2f')]()['then'](function(){var _0x59cc33=_0x1ca838['get']({'plain':!![]});var _0xc8fee9='Contexts';return db[_0x923c('0x30')][_0x923c('0x2f')]({'where':{'type':_0xc8fee9,'resourceId':_0x59cc33['id']}})['then'](function(){return _0x1ca838;});})[_0x923c('0x1a')](function(){_0xcc4f44[_0x923c('0x29')](0xcc)[_0x923c('0x31')]();});}};}function handleEntityNotFound(_0x1183b6,_0x1fa597){return function(_0x488387){if(!_0x488387){_0x1183b6['sendStatus'](0x194);}return _0x488387;};}function handleError(_0x29d35a,_0x182ab8){_0x182ab8=_0x182ab8||0x1f4;return function(_0x261706){logger[_0x923c('0x20')](_0x261706[_0x923c('0x32')]);if(_0x261706[_0x923c('0x33')]){delete _0x261706['name'];}_0x29d35a[_0x923c('0x29')](_0x182ab8)[_0x923c('0x34')](_0x261706);};}exports[_0x923c('0x35')]=function(_0x55df0d,_0x4f9422){var _0xea636c={},_0x16c558={},_0x52e128={'count':0x0,'rows':[]};var _0x3aa352=_[_0x923c('0x36')](db[_0x923c('0x37')][_0x923c('0x38')],function(_0x518fab){return{'name':_0x518fab['fieldName'],'type':_0x518fab[_0x923c('0x39')][_0x923c('0x3a')]};});_0x16c558['model']=_[_0x923c('0x36')](_0x3aa352,_0x923c('0x33'));_0x16c558['query']=_[_0x923c('0x3b')](_0x55df0d[_0x923c('0x3c')]);_0x16c558[_0x923c('0x3d')]=_[_0x923c('0x3e')](_0x16c558[_0x923c('0x3f')],_0x16c558['query']);_0xea636c[_0x923c('0x40')]=_['intersection'](_0x16c558[_0x923c('0x3f')],qs[_0x923c('0x41')](_0x55df0d[_0x923c('0x3c')]['fields']));_0xea636c[_0x923c('0x40')]=_0xea636c[_0x923c('0x40')][_0x923c('0x42')]?_0xea636c[_0x923c('0x40')]:_0x16c558[_0x923c('0x3f')];if(!_0x55df0d[_0x923c('0x3c')][_0x923c('0x43')](_0x923c('0x44'))){_0xea636c[_0x923c('0x26')]=qs[_0x923c('0x26')](_0x55df0d[_0x923c('0x3c')][_0x923c('0x26')]);_0xea636c['offset']=qs[_0x923c('0x25')](_0x55df0d['query'][_0x923c('0x25')]);}_0xea636c[_0x923c('0x45')]=qs['sort'](_0x55df0d['query'][_0x923c('0x46')]);_0xea636c['where']=qs[_0x923c('0x3d')](_[_0x923c('0x47')](_0x55df0d[_0x923c('0x3c')],_0x16c558[_0x923c('0x3d')]),_0x3aa352);if(_0x55df0d[_0x923c('0x3c')][_0x923c('0x48')]){_0xea636c[_0x923c('0x49')]=_[_0x923c('0x4a')](_0xea636c['where'],{'$or':_['map'](_0x3aa352,function(_0x4507a5){if(_0x4507a5[_0x923c('0x39')]!=='VIRTUAL'){var _0x54f772={};_0x54f772[_0x4507a5[_0x923c('0x33')]]={'$like':'%'+_0x55df0d[_0x923c('0x3c')][_0x923c('0x48')]+'%'};return _0x54f772;}})});}_0xea636c=_['merge']({},_0xea636c,_0x55df0d[_0x923c('0x4b')]);var _0x4711a6={'where':_0xea636c[_0x923c('0x49')]};return db['VoiceContext'][_0x923c('0x28')](_0x4711a6)[_0x923c('0x1a')](function(_0x22f7dc){_0x52e128[_0x923c('0x28')]=_0x22f7dc;if(_0x55df0d[_0x923c('0x3c')][_0x923c('0x4c')]){_0xea636c[_0x923c('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0x923c('0x4e')](_0xea636c);})[_0x923c('0x1a')](function(_0x1f0258){_0x52e128['rows']=_0x1f0258;return _0x52e128;})[_0x923c('0x1a')](respondWithFilteredResult(_0x4f9422,_0xea636c))[_0x923c('0x4f')](handleError(_0x4f9422,null));};exports['show']=function(_0x41e840,_0x112f12){var _0x542054={'raw':![],'where':{'id':_0x41e840['params']['id']}},_0x3c0ff0={};_0x3c0ff0['model']=_['keys'](db[_0x923c('0x37')][_0x923c('0x38')]);_0x3c0ff0['query']=_[_0x923c('0x3b')](_0x41e840['query']);_0x3c0ff0['filters']=_[_0x923c('0x3e')](_0x3c0ff0[_0x923c('0x3f')],_0x3c0ff0[_0x923c('0x3c')]);_0x542054[_0x923c('0x40')]=_[_0x923c('0x3e')](_0x3c0ff0[_0x923c('0x3f')],qs['fields'](_0x41e840[_0x923c('0x3c')][_0x923c('0x41')]));_0x542054[_0x923c('0x40')]=_0x542054['attributes']['length']?_0x542054[_0x923c('0x40')]:_0x3c0ff0[_0x923c('0x3f')];if(_0x41e840[_0x923c('0x3c')][_0x923c('0x4c')]){_0x542054[_0x923c('0x4d')]=[{'all':!![]}];}_0x542054=_[_0x923c('0x4a')]({},_0x542054,_0x41e840[_0x923c('0x4b')]);return db['VoiceContext'][_0x923c('0x50')](_0x542054)[_0x923c('0x1a')](handleEntityNotFound(_0x112f12,null))[_0x923c('0x1a')](respondWithResult(_0x112f12,null))[_0x923c('0x4f')](handleError(_0x112f12,null));};exports[_0x923c('0x51')]=function(_0x3967da,_0x2cfdb3,_0x4dc25e){var _0x30cf63;return db[_0x923c('0x37')]['create'](_0x3967da[_0x923c('0x52')],{'raw':!![]})[_0x923c('0x1a')](function(_0x16de11){_0x30cf63=_0x16de11;return db[_0x923c('0x37')][_0x923c('0x4e')]({'raw':!![]});})[_0x923c('0x1a')](function(_0x2c8248){var _0x19db6f=fs[_0x923c('0x53')](path[_0x923c('0x54')](config['root'],_0x923c('0x55')),_0x923c('0x56'));var _0x5182a0=ejs[_0x923c('0x57')](_0x19db6f,{'contexts':_0x2c8248||[]});fs[_0x923c('0x58')](_0x923c('0x59'),_0x5182a0);})[_0x923c('0x1a')](function(){return respondWithRpcPromise(_0x923c('0x5a'),_0x923c('0x51'),{'module':_0x923c('0x5b')});})[_0x923c('0x1a')](function(){var _0x2f944b=_0x3967da[_0x923c('0x5c')][_0x923c('0x5d')]({'plain':!![]});if(!_0x2f944b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f944b[_0x923c('0x5e')]===_0x923c('0x5c')){var _0x1e1330=_0x30cf63[_0x923c('0x5d')]({'plain':!![]});return db['UserProfileSection'][_0x923c('0x50')]({'where':{'name':_0x923c('0x5f'),'userProfileId':_0x2f944b[_0x923c('0x60')]},'raw':!![]})[_0x923c('0x1a')](function(_0x2ecdd5){if(_0x2ecdd5&&_0x2ecdd5[_0x923c('0x61')]===0x0){return db[_0x923c('0x30')][_0x923c('0x51')]({'name':_0x1e1330[_0x923c('0x33')],'resourceId':_0x1e1330['id'],'type':_0x2ecdd5[_0x923c('0x33')],'sectionId':_0x2ecdd5['id']},{})[_0x923c('0x1a')](function(){return _0x30cf63;});}else{return _0x30cf63;}})['catch'](function(_0x14f822){logger[_0x923c('0x20')](_0x923c('0x62'),_0x14f822);throw _0x14f822;});}return _0x30cf63;})[_0x923c('0x1a')](respondWithResult(_0x2cfdb3,0xc9))[_0x923c('0x4f')](handleError(_0x2cfdb3,null));};exports['update']=function(_0x2e2c5e,_0x47651f,_0x561263){var _0x3f0aa1;return db[_0x923c('0x37')]['find']({'where':{'id':_0x2e2c5e[_0x923c('0x63')]['id']}})[_0x923c('0x1a')](handleEntityNotFound(_0x47651f,null))[_0x923c('0x1a')](saveUpdates(_0x2e2c5e[_0x923c('0x52')],null))[_0x923c('0x1a')](function(_0x50f9b3){if(_0x50f9b3){_0x3f0aa1=_0x50f9b3;return db['VoiceContext'][_0x923c('0x4e')]({'raw':!![]});}})['then'](function(_0x31f998){var _0x21d3e4=fs[_0x923c('0x53')](path[_0x923c('0x54')](config[_0x923c('0x64')],_0x923c('0x55')),'utf8');var _0x3fa445=ejs[_0x923c('0x57')](_0x21d3e4,{'contexts':_0x31f998||[]});fs[_0x923c('0x58')](_0x923c('0x59'),_0x3fa445);})[_0x923c('0x1a')](function(){return respondWithRpcPromise('Reload',_0x923c('0x2e'),{'module':_0x923c('0x5b')});})['then'](function(){return _0x3f0aa1;})[_0x923c('0x1a')](respondWithResult(_0x47651f,null))[_0x923c('0x4f')](handleError(_0x47651f,null));};exports[_0x923c('0x2f')]=function(_0xc159f0,_0x54d543,_0x55f519){var _0x441836;return db[_0x923c('0x37')][_0x923c('0x50')]({'where':{'id':_0xc159f0[_0x923c('0x63')]['id']}})[_0x923c('0x1a')](handleEntityNotFound(_0x54d543,null))[_0x923c('0x1a')](removeEntity(_0x54d543,null))[_0x923c('0x1a')](function(){return db['VoiceContext'][_0x923c('0x4e')]({'raw':!![]});})[_0x923c('0x1a')](function(_0x3b16b2){var _0x32ff5d=fs[_0x923c('0x53')](path[_0x923c('0x54')](config[_0x923c('0x64')],_0x923c('0x55')),_0x923c('0x56'));var _0x23e7d1=ejs['render'](_0x32ff5d,{'contexts':_0x3b16b2});fs[_0x923c('0x58')](_0x923c('0x59'),_0x23e7d1);return respondWithRpcPromise('Reload','destroy',{'module':_0x923c('0x5b')});})[_0x923c('0x4f')](handleError(_0x54d543,null));}; \ No newline at end of file +var _0xdb21=['catch','show','params','length','find','create','findAll','readFileSync','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Contexts','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','root','server/files/templates/context.ejs','render','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','status','end','json','offset','limit','set','apply','reject','update','then','destroy','get','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows'];(function(_0x137aa6,_0xc9ad62){var _0x24cb82=function(_0x278fcd){while(--_0x278fcd){_0x137aa6['push'](_0x137aa6['shift']());}};_0x24cb82(++_0xc9ad62);}(_0xdb21,0x85));var _0x1db2=function(_0x1c490a,_0x217f34){_0x1c490a=_0x1c490a-0x0;var _0x1e0b1d=_0xdb21[_0x1c490a];return _0x1e0b1d;};'use strict';var emlformat=require(_0x1db2('0x0'));var rimraf=require(_0x1db2('0x1'));var zipdir=require(_0x1db2('0x2'));var jsonpatch=require(_0x1db2('0x3'));var rp=require(_0x1db2('0x4'));var moment=require(_0x1db2('0x5'));var BPromise=require(_0x1db2('0x6'));var Mustache=require('mustache');var util=require(_0x1db2('0x7'));var path=require(_0x1db2('0x8'));var sox=require(_0x1db2('0x9'));var csv=require(_0x1db2('0xa'));var ejs=require(_0x1db2('0xb'));var fs=require('fs');var fs_extra=require(_0x1db2('0xc'));var _=require(_0x1db2('0xd'));var squel=require(_0x1db2('0xe'));var crypto=require(_0x1db2('0xf'));var jsforce=require(_0x1db2('0x10'));var deskjs=require(_0x1db2('0x11'));var toCsv=require(_0x1db2('0xa'));var querystring=require(_0x1db2('0x12'));var Papa=require(_0x1db2('0x13'));var Redis=require(_0x1db2('0x14'));var authService=require(_0x1db2('0x15'));var qs=require(_0x1db2('0x16'));var as=require(_0x1db2('0x17'));var hardwareService=require(_0x1db2('0x18'));var logger=require(_0x1db2('0x19'))(_0x1db2('0x1a'));var utils=require(_0x1db2('0x1b'));var config=require(_0x1db2('0x1c'));var licenseUtil=require(_0x1db2('0x1d'));var db=require(_0x1db2('0x1e'))['db'];var jayson=require(_0x1db2('0x1f'));var client=jayson[_0x1db2('0x20')][_0x1db2('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xeb8f39,_0x500567,_0x2f5aa0,_0x48bdd6){return new BPromise(function(_0xe67192,_0x3f7b0c){var _0x28fcc1=_0x48bdd6||client;return _0x28fcc1['request'](_0xeb8f39,_0x2f5aa0)['then'](function(_0x32f3fb){logger['info'](_0x1db2('0x22'),_0x500567,'request\x20sent');logger[_0x1db2('0x23')](_0x1db2('0x24'),_0x500567,_0x1db2('0x25'),JSON[_0x1db2('0x26')](_0x32f3fb));if(_0x32f3fb[_0x1db2('0x27')]){if(_0x32f3fb[_0x1db2('0x27')][_0x1db2('0x28')]===0x1f4){logger[_0x1db2('0x27')](_0x1db2('0x22'),_0x500567,_0x32f3fb[_0x1db2('0x27')]['message']);return _0x3f7b0c(_0x32f3fb[_0x1db2('0x27')][_0x1db2('0x29')]);}logger[_0x1db2('0x27')](_0x1db2('0x22'),_0x500567,_0x32f3fb[_0x1db2('0x27')]['message']);return _0xe67192(_0x32f3fb[_0x1db2('0x27')]['message']);}else{logger[_0x1db2('0x2a')](_0x1db2('0x22'),_0x500567,_0x1db2('0x25'));_0xe67192(_0x32f3fb['result'][_0x1db2('0x29')]);}})['catch'](function(_0x209297){logger[_0x1db2('0x27')](_0x1db2('0x22'),_0x500567,_0x209297);_0x3f7b0c(_0x209297);});});}function respondWithStatusCode(_0x5a95fd,_0x5f47e6){_0x5f47e6=_0x5f47e6||0xcc;return function(_0x23eabe){if(_0x23eabe){return _0x5a95fd['sendStatus'](_0x5f47e6);}return _0x5a95fd[_0x1db2('0x2b')](_0x5f47e6)[_0x1db2('0x2c')]();};}function respondWithResult(_0x3f29b5,_0x5f4257){_0x5f4257=_0x5f4257||0xc8;return function(_0x1fdb26){if(_0x1fdb26){return _0x3f29b5[_0x1db2('0x2b')](_0x5f4257)[_0x1db2('0x2d')](_0x1fdb26);}};}function respondWithFilteredResult(_0x2543f9,_0x159b2b){return function(_0x41e249){if(_0x41e249){var _0x482c63=typeof _0x159b2b[_0x1db2('0x2e')]==='undefined'&&typeof _0x159b2b['limit']==='undefined';var _0xaaca07=_0x41e249['count'];var _0x39ba5a=_0x482c63?0x0:_0x159b2b['offset'];var _0x2e10a5=_0x482c63?_0x41e249['count']:_0x159b2b[_0x1db2('0x2e')]+_0x159b2b[_0x1db2('0x2f')];var _0x4e03c9;if(_0x2e10a5>=_0xaaca07){_0x2e10a5=_0xaaca07;_0x4e03c9=0xc8;}else{_0x4e03c9=0xce;}_0x2543f9[_0x1db2('0x2b')](_0x4e03c9);return _0x2543f9[_0x1db2('0x30')]('Content-Range',_0x39ba5a+'-'+_0x2e10a5+'/'+_0xaaca07)[_0x1db2('0x2d')](_0x41e249);}return null;};}function patchUpdates(_0x4a5f15){return function(_0x161c44){try{jsonpatch[_0x1db2('0x31')](_0x161c44,_0x4a5f15,!![]);}catch(_0x18d2b7){return BPromise[_0x1db2('0x32')](_0x18d2b7);}return _0x161c44['save']();};}function saveUpdates(_0x410c27,_0x4303ad){return function(_0x2323f6){if(_0x2323f6){return _0x2323f6[_0x1db2('0x33')](_0x410c27)[_0x1db2('0x34')](function(_0x46bf97){return _0x46bf97;});}return null;};}function removeEntity(_0x33e77d,_0x5b9001){return function(_0x73525a){if(_0x73525a){return _0x73525a[_0x1db2('0x35')]()['then'](function(){var _0x360104=_0x73525a[_0x1db2('0x36')]({'plain':!![]});var _0x3a6b10='Contexts';return db['UserProfileResource'][_0x1db2('0x35')]({'where':{'type':_0x3a6b10,'resourceId':_0x360104['id']}})[_0x1db2('0x34')](function(){return _0x73525a;});})['then'](function(){_0x33e77d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x539540,_0x1876e5){return function(_0x2bad2d){if(!_0x2bad2d){_0x539540[_0x1db2('0x37')](0x194);}return _0x2bad2d;};}function handleError(_0x201519,_0x5519f2){_0x5519f2=_0x5519f2||0x1f4;return function(_0x5897a1){logger['error'](_0x5897a1[_0x1db2('0x38')]);if(_0x5897a1[_0x1db2('0x39')]){delete _0x5897a1[_0x1db2('0x39')];}_0x201519[_0x1db2('0x2b')](_0x5519f2)[_0x1db2('0x3a')](_0x5897a1);};}exports[_0x1db2('0x3b')]=function(_0x306207,_0x2c4911){var _0x57bee2={},_0x21c933={},_0x2eb859={'count':0x0,'rows':[]};var _0x483039=_[_0x1db2('0x3c')](db[_0x1db2('0x3d')][_0x1db2('0x3e')],function(_0x5d5da7){return{'name':_0x5d5da7['fieldName'],'type':_0x5d5da7['type'][_0x1db2('0x3f')]};});_0x21c933[_0x1db2('0x40')]=_[_0x1db2('0x3c')](_0x483039,'name');_0x21c933[_0x1db2('0x41')]=_[_0x1db2('0x42')](_0x306207['query']);_0x21c933[_0x1db2('0x43')]=_[_0x1db2('0x44')](_0x21c933['model'],_0x21c933[_0x1db2('0x41')]);_0x57bee2['attributes']=_[_0x1db2('0x44')](_0x21c933[_0x1db2('0x40')],qs[_0x1db2('0x45')](_0x306207[_0x1db2('0x41')]['fields']));_0x57bee2[_0x1db2('0x46')]=_0x57bee2['attributes']['length']?_0x57bee2[_0x1db2('0x46')]:_0x21c933[_0x1db2('0x40')];if(!_0x306207[_0x1db2('0x41')][_0x1db2('0x47')](_0x1db2('0x48'))){_0x57bee2[_0x1db2('0x2f')]=qs[_0x1db2('0x2f')](_0x306207['query'][_0x1db2('0x2f')]);_0x57bee2[_0x1db2('0x2e')]=qs['offset'](_0x306207[_0x1db2('0x41')][_0x1db2('0x2e')]);}_0x57bee2[_0x1db2('0x49')]=qs['sort'](_0x306207[_0x1db2('0x41')]['sort']);_0x57bee2[_0x1db2('0x4a')]=qs[_0x1db2('0x43')](_[_0x1db2('0x4b')](_0x306207[_0x1db2('0x41')],_0x21c933[_0x1db2('0x43')]),_0x483039);if(_0x306207[_0x1db2('0x41')][_0x1db2('0x4c')]){_0x57bee2[_0x1db2('0x4a')]=_[_0x1db2('0x4d')](_0x57bee2[_0x1db2('0x4a')],{'$or':_[_0x1db2('0x3c')](_0x483039,function(_0x5a8851){if(_0x5a8851[_0x1db2('0x4e')]!==_0x1db2('0x4f')){var _0x3d7350={};_0x3d7350[_0x5a8851['name']]={'$like':'%'+_0x306207['query'][_0x1db2('0x4c')]+'%'};return _0x3d7350;}})});}_0x57bee2=_[_0x1db2('0x4d')]({},_0x57bee2,_0x306207[_0x1db2('0x50')]);var _0x589982={'where':_0x57bee2[_0x1db2('0x4a')]};return db[_0x1db2('0x3d')][_0x1db2('0x51')](_0x589982)[_0x1db2('0x34')](function(_0x5cdee4){_0x2eb859[_0x1db2('0x51')]=_0x5cdee4;if(_0x306207['query'][_0x1db2('0x52')]){_0x57bee2[_0x1db2('0x53')]=[{'all':!![]}];}return db[_0x1db2('0x3d')]['findAll'](_0x57bee2);})[_0x1db2('0x34')](function(_0x112055){_0x2eb859[_0x1db2('0x54')]=_0x112055;return _0x2eb859;})[_0x1db2('0x34')](respondWithFilteredResult(_0x2c4911,_0x57bee2))[_0x1db2('0x55')](handleError(_0x2c4911,null));};exports[_0x1db2('0x56')]=function(_0x58380d,_0x3394b8){var _0x2fc72b={'raw':![],'where':{'id':_0x58380d[_0x1db2('0x57')]['id']}},_0x40c0e0={};_0x40c0e0[_0x1db2('0x40')]=_[_0x1db2('0x42')](db['VoiceContext'][_0x1db2('0x3e')]);_0x40c0e0[_0x1db2('0x41')]=_[_0x1db2('0x42')](_0x58380d[_0x1db2('0x41')]);_0x40c0e0[_0x1db2('0x43')]=_[_0x1db2('0x44')](_0x40c0e0[_0x1db2('0x40')],_0x40c0e0[_0x1db2('0x41')]);_0x2fc72b[_0x1db2('0x46')]=_[_0x1db2('0x44')](_0x40c0e0[_0x1db2('0x40')],qs[_0x1db2('0x45')](_0x58380d[_0x1db2('0x41')][_0x1db2('0x45')]));_0x2fc72b[_0x1db2('0x46')]=_0x2fc72b[_0x1db2('0x46')][_0x1db2('0x58')]?_0x2fc72b['attributes']:_0x40c0e0['model'];if(_0x58380d[_0x1db2('0x41')]['includeAll']){_0x2fc72b[_0x1db2('0x53')]=[{'all':!![]}];}_0x2fc72b=_[_0x1db2('0x4d')]({},_0x2fc72b,_0x58380d['options']);return db['VoiceContext'][_0x1db2('0x59')](_0x2fc72b)[_0x1db2('0x34')](handleEntityNotFound(_0x3394b8,null))['then'](respondWithResult(_0x3394b8,null))[_0x1db2('0x55')](handleError(_0x3394b8,null));};exports[_0x1db2('0x5a')]=function(_0xe5720c,_0x32ee01,_0x49a060){var _0x1878c9;return db[_0x1db2('0x3d')][_0x1db2('0x5a')](_0xe5720c['body'],{'raw':!![]})[_0x1db2('0x34')](function(_0x49c987){_0x1878c9=_0x49c987;return db[_0x1db2('0x3d')][_0x1db2('0x5b')]({'raw':!![]});})[_0x1db2('0x34')](function(_0x339d7f){var _0x167d96=fs[_0x1db2('0x5c')](path['join'](config['root'],'server/files/templates/context.ejs'),_0x1db2('0x5d'));var _0xe8eb06=ejs['render'](_0x167d96,{'contexts':_0x339d7f||[]});fs[_0x1db2('0x5e')](_0x1db2('0x5f'),_0xe8eb06);})['then'](function(){return respondWithRpcPromise(_0x1db2('0x60'),'create',{'module':_0x1db2('0x61')});})[_0x1db2('0x34')](function(){var _0x56442d=_0xe5720c[_0x1db2('0x62')][_0x1db2('0x36')]({'plain':!![]});if(!_0x56442d)throw new Error(_0x1db2('0x63'));if(_0x56442d['role']==='user'){var _0x234c8e=_0x1878c9[_0x1db2('0x36')]({'plain':!![]});return db['UserProfileSection'][_0x1db2('0x59')]({'where':{'name':_0x1db2('0x64'),'userProfileId':_0x56442d[_0x1db2('0x65')]},'raw':!![]})[_0x1db2('0x34')](function(_0x24d40f){if(_0x24d40f&&_0x24d40f['autoAssociation']===0x0){return db[_0x1db2('0x66')][_0x1db2('0x5a')]({'name':_0x234c8e['name'],'resourceId':_0x234c8e['id'],'type':_0x24d40f[_0x1db2('0x39')],'sectionId':_0x24d40f['id']},{})[_0x1db2('0x34')](function(){return _0x1878c9;});}else{return _0x1878c9;}})[_0x1db2('0x55')](function(_0x333fd0){logger[_0x1db2('0x27')](_0x1db2('0x67'),_0x333fd0);throw _0x333fd0;});}return _0x1878c9;})[_0x1db2('0x34')](respondWithResult(_0x32ee01,0xc9))['catch'](handleError(_0x32ee01,null));};exports[_0x1db2('0x33')]=function(_0x13a06b,_0x30616e,_0x388b90){var _0x170f2f;return db[_0x1db2('0x3d')][_0x1db2('0x59')]({'where':{'id':_0x13a06b[_0x1db2('0x57')]['id']}})[_0x1db2('0x34')](handleEntityNotFound(_0x30616e,null))[_0x1db2('0x34')](saveUpdates(_0x13a06b[_0x1db2('0x68')],null))['then'](function(_0x18ca14){if(_0x18ca14){_0x170f2f=_0x18ca14;return db[_0x1db2('0x3d')]['findAll']({'raw':!![]});}})[_0x1db2('0x34')](function(_0x4c4a5c){var _0x58adc0=fs['readFileSync'](path[_0x1db2('0x69')](config[_0x1db2('0x6a')],_0x1db2('0x6b')),_0x1db2('0x5d'));var _0x5f4ad5=ejs[_0x1db2('0x6c')](_0x58adc0,{'contexts':_0x4c4a5c||[]});fs[_0x1db2('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5f4ad5);})[_0x1db2('0x34')](function(){return respondWithRpcPromise(_0x1db2('0x60'),_0x1db2('0x33'),{'module':_0x1db2('0x61')});})[_0x1db2('0x34')](function(){return _0x170f2f;})[_0x1db2('0x34')](respondWithResult(_0x30616e,null))[_0x1db2('0x55')](handleError(_0x30616e,null));};exports[_0x1db2('0x35')]=function(_0x323f6d,_0x570421,_0x254f9e){var _0x57e73c;return db[_0x1db2('0x3d')][_0x1db2('0x59')]({'where':{'id':_0x323f6d[_0x1db2('0x57')]['id']}})['then'](handleEntityNotFound(_0x570421,null))[_0x1db2('0x34')](removeEntity(_0x570421,null))['then'](function(){return db['VoiceContext'][_0x1db2('0x5b')]({'raw':!![]});})[_0x1db2('0x34')](function(_0x27369d){var _0x5f4008=fs['readFileSync'](path['join'](config['root'],_0x1db2('0x6b')),_0x1db2('0x5d'));var _0x41094e=ejs['render'](_0x5f4008,{'contexts':_0x27369d});fs[_0x1db2('0x5e')](_0x1db2('0x5f'),_0x41094e);return respondWithRpcPromise(_0x1db2('0x60'),'destroy',{'module':_0x1db2('0x61')});})[_0x1db2('0x55')](handleError(_0x570421,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 7bf33fc..3f7f69f 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 _0xdaf5=['bluebird','request-promise','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash','util','../../config/logger','api','moment'];(function(_0x2d23b9,_0x148240){var _0x404cdf=function(_0x380acd){while(--_0x380acd){_0x2d23b9['push'](_0x2d23b9['shift']());}};_0x404cdf(++_0x148240);}(_0xdaf5,0x17b));var _0x5daf=function(_0x31ed74,_0x96d0de){_0x31ed74=_0x31ed74-0x0;var _0x260f84=_0xdaf5[_0x31ed74];return _0x260f84;};'use strict';var _=require(_0x5daf('0x0'));var util=require(_0x5daf('0x1'));var logger=require(_0x5daf('0x2'))(_0x5daf('0x3'));var moment=require(_0x5daf('0x4'));var BPromise=require(_0x5daf('0x5'));var rp=require(_0x5daf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5daf('0x7'));var attributes=require(_0x5daf('0x8'));module[_0x5daf('0x9')]=function(_0x40cdb6,_0x5d8e5d){return _0x40cdb6[_0x5daf('0xa')]('VoiceContext',attributes,{'tableName':_0x5daf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07cc=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','api','moment'];(function(_0xbedb1,_0xe0134e){var _0x32085f=function(_0x5408f4){while(--_0x5408f4){_0xbedb1['push'](_0xbedb1['shift']());}};_0x32085f(++_0xe0134e);}(_0x07cc,0x12f));var _0xc07c=function(_0x17321b,_0x5250c1){_0x17321b=_0x17321b-0x0;var _0x3037c1=_0x07cc[_0x17321b];return _0x3037c1;};'use strict';var _=require(_0xc07c('0x0'));var util=require(_0xc07c('0x1'));var logger=require(_0xc07c('0x2'))(_0xc07c('0x3'));var moment=require(_0xc07c('0x4'));var BPromise=require(_0xc07c('0x5'));var rp=require(_0xc07c('0x6'));var fs=require('fs');var path=require(_0xc07c('0x7'));var rimraf=require(_0xc07c('0x8'));var config=require(_0xc07c('0x9'));var attributes=require(_0xc07c('0xa'));module[_0xc07c('0xb')]=function(_0x531f4a,_0x2185e0){return _0x531f4a[_0xc07c('0xc')](_0xc07c('0xd'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index eaceaa1..1a5d31f 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 _0x2a5c=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x4f4db8,_0x17630a){var _0x10874c=function(_0x2c4c11){while(--_0x2c4c11){_0x4f4db8['push'](_0x4f4db8['shift']());}};_0x10874c(++_0x17630a);}(_0x2a5c,0x1f3));var _0xc2a5=function(_0x2e77a5,_0x2f7d0f){_0x2e77a5=_0x2e77a5-0x0;var _0x1d1e39=_0x2a5c[_0x2e77a5];return _0x1d1e39;};'use strict';var _=require(_0xc2a5('0x0'));var util=require(_0xc2a5('0x1'));var moment=require(_0xc2a5('0x2'));var BPromise=require(_0xc2a5('0x3'));var rs=require(_0xc2a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2a5('0x5'))['db'];var utils=require(_0xc2a5('0x6'));var logger=require(_0xc2a5('0x7'))(_0xc2a5('0x8'));var config=require('../../config/environment');var jayson=require(_0xc2a5('0x9'));var client=jayson['client'][_0xc2a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x350b2d,_0x4909dc,_0x50de53){return new BPromise(function(_0x3a3cfb,_0x1fbb44){return client['request'](_0x350b2d,_0x50de53)[_0xc2a5('0xb')](function(_0xeec346){logger[_0xc2a5('0xc')](_0xc2a5('0xd'),_0x4909dc,_0xc2a5('0xe'));logger[_0xc2a5('0xf')](_0xc2a5('0x10'),_0x4909dc,_0xc2a5('0xe'),JSON[_0xc2a5('0x11')](_0xeec346));if(_0xeec346[_0xc2a5('0x12')]){if(_0xeec346[_0xc2a5('0x12')]['code']===0x1f4){logger[_0xc2a5('0x12')](_0xc2a5('0xd'),_0x4909dc,_0xeec346[_0xc2a5('0x12')][_0xc2a5('0x13')]);return _0x1fbb44(_0xeec346[_0xc2a5('0x12')][_0xc2a5('0x13')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x4909dc,_0xeec346[_0xc2a5('0x12')][_0xc2a5('0x13')]);return _0x3a3cfb(_0xeec346['error'][_0xc2a5('0x13')]);}else{logger['info'](_0xc2a5('0xd'),_0x4909dc,_0xc2a5('0xe'));_0x3a3cfb(_0xeec346[_0xc2a5('0x14')][_0xc2a5('0x13')]);}})['catch'](function(_0x187090){logger[_0xc2a5('0x12')](_0xc2a5('0xd'),_0x4909dc,_0x187090);_0x1fbb44(_0x187090);});});} \ No newline at end of file +var _0x4060=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x3a6cf2,_0x44455d){var _0x3225b6=function(_0x2b995e){while(--_0x2b995e){_0x3a6cf2['push'](_0x3a6cf2['shift']());}};_0x3225b6(++_0x44455d);}(_0x4060,0x89));var _0x0406=function(_0x23b682,_0x4f1908){_0x23b682=_0x23b682-0x0;var _0x3986ba=_0x4060[_0x23b682];return _0x3986ba;};'use strict';var _=require('lodash');var util=require(_0x0406('0x0'));var moment=require('moment');var BPromise=require(_0x0406('0x1'));var rs=require(_0x0406('0x2'));var fs=require('fs');var Redis=require(_0x0406('0x3'));var db=require(_0x0406('0x4'))['db'];var utils=require(_0x0406('0x5'));var logger=require(_0x0406('0x6'))('rpc');var config=require(_0x0406('0x7'));var jayson=require(_0x0406('0x8'));var client=jayson['client'][_0x0406('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x268207,_0x50d503,_0x1a190d){return new BPromise(function(_0x1c99f9,_0x170d59){return client[_0x0406('0xa')](_0x268207,_0x1a190d)[_0x0406('0xb')](function(_0x2be039){logger[_0x0406('0xc')](_0x0406('0xd'),_0x50d503,'request\x20sent');logger[_0x0406('0xe')](_0x0406('0xf'),_0x50d503,_0x0406('0x10'),JSON[_0x0406('0x11')](_0x2be039));if(_0x2be039[_0x0406('0x12')]){if(_0x2be039[_0x0406('0x12')][_0x0406('0x13')]===0x1f4){logger[_0x0406('0x12')]('VoiceContext,\x20%s,\x20%s',_0x50d503,_0x2be039[_0x0406('0x12')][_0x0406('0x14')]);return _0x170d59(_0x2be039[_0x0406('0x12')]['message']);}logger['error'](_0x0406('0xd'),_0x50d503,_0x2be039[_0x0406('0x12')][_0x0406('0x14')]);return _0x1c99f9(_0x2be039[_0x0406('0x12')][_0x0406('0x14')]);}else{logger[_0x0406('0xc')](_0x0406('0xd'),_0x50d503,_0x0406('0x10'));_0x1c99f9(_0x2be039[_0x0406('0x15')][_0x0406('0x14')]);}})[_0x0406('0x16')](function(_0x37bf30){logger[_0x0406('0x12')]('VoiceContext,\x20%s,\x20%s',_0x50d503,_0x37bf30);_0x170d59(_0x37bf30);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 99f5c05..55efd41 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 _0xfe60=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','post','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x24595d,_0x2b7d55){var _0x23d9c0=function(_0x262760){while(--_0x262760){_0x24595d['push'](_0x24595d['shift']());}};_0x23d9c0(++_0x2b7d55);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x385578,_0x17e793){_0x385578=_0x385578-0x0;var _0x4d04d1=_0xfe60[_0x385578];return _0x4d04d1;};'use strict';var multer=require('multer');var util=require(_0x0fe6('0x0'));var path=require('path');var timeout=require(_0x0fe6('0x1'));var express=require(_0x0fe6('0x2'));var router=express[_0x0fe6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0fe6('0x4'));var interaction=require(_0x0fe6('0x5'));var config=require(_0x0fe6('0x6'));var controller=require(_0x0fe6('0x7'));router[_0x0fe6('0x8')]('/',auth[_0x0fe6('0x9')](),controller[_0x0fe6('0xa')]);router[_0x0fe6('0x8')](_0x0fe6('0xb'),auth[_0x0fe6('0x9')](),controller['describe']);router[_0x0fe6('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0fe6('0xc')]('/',auth['isAuthenticated'](),controller[_0x0fe6('0xd')]);router[_0x0fe6('0xe')](_0x0fe6('0xf'),auth[_0x0fe6('0x9')](),controller[_0x0fe6('0x10')]);router[_0x0fe6('0x11')](_0x0fe6('0xf'),auth['isAuthenticated'](),controller[_0x0fe6('0x12')]);module[_0x0fe6('0x13')]=router; \ No newline at end of file +var _0xbe12=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create'];(function(_0x30e3d7,_0xd64140){var _0x427871=function(_0x55fa2c){while(--_0x55fa2c){_0x30e3d7['push'](_0x30e3d7['shift']());}};_0x427871(++_0xd64140);}(_0xbe12,0xea));var _0x2be1=function(_0x45030e,_0x32b6b8){_0x45030e=_0x45030e-0x0;var _0x4df3be=_0xbe12[_0x45030e];return _0x4df3be;};'use strict';var multer=require(_0x2be1('0x0'));var util=require(_0x2be1('0x1'));var path=require(_0x2be1('0x2'));var timeout=require(_0x2be1('0x3'));var express=require(_0x2be1('0x4'));var router=express[_0x2be1('0x5')]();var fs_extra=require(_0x2be1('0x6'));var auth=require(_0x2be1('0x7'));var interaction=require(_0x2be1('0x8'));var config=require(_0x2be1('0x9'));var controller=require(_0x2be1('0xa'));router[_0x2be1('0xb')]('/',auth['isAuthenticated'](),controller[_0x2be1('0xc')]);router[_0x2be1('0xb')]('/describe',auth[_0x2be1('0xd')](),controller[_0x2be1('0xe')]);router[_0x2be1('0xb')](_0x2be1('0xf'),auth[_0x2be1('0xd')](),controller[_0x2be1('0x10')]);router[_0x2be1('0x11')]('/',auth['isAuthenticated'](),controller[_0x2be1('0x12')]);router[_0x2be1('0x13')](_0x2be1('0xf'),auth[_0x2be1('0xd')](),controller[_0x2be1('0x14')]);router['delete'](_0x2be1('0xf'),auth[_0x2be1('0xd')](),controller[_0x2be1('0x15')]);module[_0x2be1('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 08bbac9..ec8c623 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 _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x3e74,0x175));var _0x43e7=function(_0x1a5299,_0x252e05){_0x1a5299=_0x1a5299-0x0;var _0x1a8319=_0x3e74[_0x1a5299];return _0x1a8319;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x008c=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x3d61a5,_0x2493ab){var _0x533067=function(_0xe7aac9){while(--_0xe7aac9){_0x3d61a5['push'](_0x3d61a5['shift']());}};_0x533067(++_0x2493ab);}(_0x008c,0x188));var _0xc008=function(_0x1e1bb5,_0x23b4e9){_0x1e1bb5=_0x1e1bb5-0x0;var _0x413b4c=_0x008c[_0x1e1bb5];return _0x413b4c;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'privilege':{'type':Sequelize[_0xc008('0x2')]},'channel':{'type':Sequelize[_0xc008('0x2')]},'channelstate':{'type':Sequelize[_0xc008('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc008('0x2')]},'calleridname':{'type':Sequelize[_0xc008('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'connectedlinename':{'type':Sequelize[_0xc008('0x2')]},'language':{'type':Sequelize[_0xc008('0x2')]},'accountcode':{'type':Sequelize[_0xc008('0x2')]},'context':{'type':Sequelize[_0xc008('0x2')]},'exten':{'type':Sequelize[_0xc008('0x2')]},'priority':{'type':Sequelize[_0xc008('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xc008('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc008('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc008('0x2')]},'destexten':{'type':Sequelize[_0xc008('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xc008('0x2')]},'destlinkedid':{'type':Sequelize[_0xc008('0x2')]},'dialstring':{'type':Sequelize[_0xc008('0x2')]},'dialstatus':{'type':Sequelize[_0xc008('0x2')]},'starttime':{'type':Sequelize[_0xc008('0x4')]},'answertime':{'type':Sequelize[_0xc008('0x4')]},'endtime':{'type':Sequelize[_0xc008('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xc008('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xc008('0x3')]},'billableseconds':{'type':Sequelize[_0xc008('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 6834a2d..3431370 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 _0x1a70=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','stack','map','VoiceDialReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset'];(function(_0x5bd914,_0x574b6e){var _0x40bea9=function(_0x4925e6){while(--_0x4925e6){_0x5bd914['push'](_0x5bd914['shift']());}};_0x40bea9(++_0x574b6e);}(_0x1a70,0x119));var _0x01a7=function(_0x2703b4,_0x327991){_0x2703b4=_0x2703b4-0x0;var _0x394cdf=_0x1a70[_0x2703b4];return _0x394cdf;};'use strict';var emlformat=require(_0x01a7('0x0'));var rimraf=require(_0x01a7('0x1'));var zipdir=require(_0x01a7('0x2'));var jsonpatch=require(_0x01a7('0x3'));var rp=require('request-promise');var moment=require(_0x01a7('0x4'));var BPromise=require(_0x01a7('0x5'));var Mustache=require('mustache');var util=require(_0x01a7('0x6'));var path=require(_0x01a7('0x7'));var sox=require(_0x01a7('0x8'));var csv=require(_0x01a7('0x9'));var ejs=require(_0x01a7('0xa'));var fs=require('fs');var fs_extra=require(_0x01a7('0xb'));var _=require(_0x01a7('0xc'));var squel=require('squel');var crypto=require(_0x01a7('0xd'));var jsforce=require(_0x01a7('0xe'));var deskjs=require(_0x01a7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x01a7('0x10'));var Papa=require(_0x01a7('0x11'));var Redis=require(_0x01a7('0x12'));var authService=require(_0x01a7('0x13'));var qs=require(_0x01a7('0x14'));var as=require(_0x01a7('0x15'));var hardwareService=require(_0x01a7('0x16'));var logger=require(_0x01a7('0x17'))(_0x01a7('0x18'));var utils=require(_0x01a7('0x19'));var config=require(_0x01a7('0x1a'));var licenseUtil=require(_0x01a7('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x218460,_0x1a09e5){_0x1a09e5=_0x1a09e5||0xcc;return function(_0x564eae){if(_0x564eae){return _0x218460['sendStatus'](_0x1a09e5);}return _0x218460['status'](_0x1a09e5)[_0x01a7('0x1c')]();};}function respondWithResult(_0x20882a,_0x283542){_0x283542=_0x283542||0xc8;return function(_0xcaca1e){if(_0xcaca1e){return _0x20882a['status'](_0x283542)[_0x01a7('0x1d')](_0xcaca1e);}};}function respondWithFilteredResult(_0x409f99,_0x8401d3){return function(_0x357b61){if(_0x357b61){var _0x1bdc82=typeof _0x8401d3[_0x01a7('0x1e')]===_0x01a7('0x1f')&&typeof _0x8401d3[_0x01a7('0x20')]===_0x01a7('0x1f');var _0xb004ad=_0x357b61['count'];var _0xd6afae=_0x1bdc82?0x0:_0x8401d3[_0x01a7('0x1e')];var _0x3e1777=_0x1bdc82?_0x357b61[_0x01a7('0x21')]:_0x8401d3[_0x01a7('0x1e')]+_0x8401d3[_0x01a7('0x20')];var _0x363fa3;if(_0x3e1777>=_0xb004ad){_0x3e1777=_0xb004ad;_0x363fa3=0xc8;}else{_0x363fa3=0xce;}_0x409f99['status'](_0x363fa3);return _0x409f99[_0x01a7('0x22')](_0x01a7('0x23'),_0xd6afae+'-'+_0x3e1777+'/'+_0xb004ad)[_0x01a7('0x1d')](_0x357b61);}return null;};}function patchUpdates(_0x77c469){return function(_0x102819){try{jsonpatch[_0x01a7('0x24')](_0x102819,_0x77c469,!![]);}catch(_0x22fdc2){return BPromise[_0x01a7('0x25')](_0x22fdc2);}return _0x102819[_0x01a7('0x26')]();};}function saveUpdates(_0x3e1231,_0x3241d7){return function(_0x3ed972){if(_0x3ed972){return _0x3ed972[_0x01a7('0x27')](_0x3e1231)[_0x01a7('0x28')](function(_0x44f26a){return _0x44f26a;});}return null;};}function removeEntity(_0x59b590,_0x1fcd56){return function(_0x11c992){if(_0x11c992){return _0x11c992[_0x01a7('0x29')]()[_0x01a7('0x28')](function(){_0x59b590[_0x01a7('0x2a')](0xcc)[_0x01a7('0x1c')]();});}};}function handleEntityNotFound(_0x35285d,_0x3d01e2){return function(_0x37b9f5){if(!_0x37b9f5){_0x35285d[_0x01a7('0x2b')](0x194);}return _0x37b9f5;};}function handleError(_0x31cbac,_0x5e933a){_0x5e933a=_0x5e933a||0x1f4;return function(_0xf9c67a){logger['error'](_0xf9c67a[_0x01a7('0x2c')]);if(_0xf9c67a['name']){delete _0xf9c67a['name'];}_0x31cbac['status'](_0x5e933a)['send'](_0xf9c67a);};}exports['index']=function(_0xf1a6df,_0x43f352){var _0x5c48bc={},_0x506aa2={},_0x253003={'count':0x0,'rows':[]};var _0x5f093a=_[_0x01a7('0x2d')](db[_0x01a7('0x2e')][_0x01a7('0x2f')],function(_0x51a1bf){return{'name':_0x51a1bf[_0x01a7('0x30')],'type':_0x51a1bf['type'][_0x01a7('0x31')]};});_0x506aa2[_0x01a7('0x32')]=_['map'](_0x5f093a,_0x01a7('0x33'));_0x506aa2[_0x01a7('0x34')]=_[_0x01a7('0x35')](_0xf1a6df['query']);_0x506aa2[_0x01a7('0x36')]=_[_0x01a7('0x37')](_0x506aa2[_0x01a7('0x32')],_0x506aa2[_0x01a7('0x34')]);_0x5c48bc[_0x01a7('0x38')]=_[_0x01a7('0x37')](_0x506aa2[_0x01a7('0x32')],qs['fields'](_0xf1a6df['query'][_0x01a7('0x39')]));_0x5c48bc['attributes']=_0x5c48bc[_0x01a7('0x38')][_0x01a7('0x3a')]?_0x5c48bc[_0x01a7('0x38')]:_0x506aa2[_0x01a7('0x32')];if(!_0xf1a6df[_0x01a7('0x34')][_0x01a7('0x3b')](_0x01a7('0x3c'))){_0x5c48bc[_0x01a7('0x20')]=qs[_0x01a7('0x20')](_0xf1a6df[_0x01a7('0x34')][_0x01a7('0x20')]);_0x5c48bc[_0x01a7('0x1e')]=qs[_0x01a7('0x1e')](_0xf1a6df[_0x01a7('0x34')][_0x01a7('0x1e')]);}_0x5c48bc[_0x01a7('0x3d')]=qs[_0x01a7('0x3e')](_0xf1a6df[_0x01a7('0x34')]['sort']);_0x5c48bc['where']=qs['filters'](_[_0x01a7('0x3f')](_0xf1a6df['query'],_0x506aa2['filters']),_0x5f093a);if(_0xf1a6df[_0x01a7('0x34')][_0x01a7('0x40')]){_0x5c48bc[_0x01a7('0x41')]=_[_0x01a7('0x42')](_0x5c48bc[_0x01a7('0x41')],{'$or':_[_0x01a7('0x2d')](_0x5f093a,function(_0x4ea92f){if(_0x4ea92f[_0x01a7('0x43')]!==_0x01a7('0x44')){var _0x1a9fc9={};_0x1a9fc9[_0x4ea92f[_0x01a7('0x33')]]={'$like':'%'+_0xf1a6df[_0x01a7('0x34')][_0x01a7('0x40')]+'%'};return _0x1a9fc9;}})});}_0x5c48bc=_[_0x01a7('0x42')]({},_0x5c48bc,_0xf1a6df[_0x01a7('0x45')]);var _0xf8148={'where':_0x5c48bc[_0x01a7('0x41')]};return db[_0x01a7('0x2e')][_0x01a7('0x21')](_0xf8148)[_0x01a7('0x28')](function(_0x35541a){_0x253003[_0x01a7('0x21')]=_0x35541a;if(_0xf1a6df[_0x01a7('0x34')][_0x01a7('0x46')]){_0x5c48bc[_0x01a7('0x47')]=[{'all':!![]}];}return db[_0x01a7('0x2e')]['findAll'](_0x5c48bc);})['then'](function(_0x3ffadd){_0x253003['rows']=_0x3ffadd;return _0x253003;})['then'](respondWithFilteredResult(_0x43f352,_0x5c48bc))['catch'](handleError(_0x43f352,null));};exports['show']=function(_0x575687,_0x49bdac){var _0x4b3ffd={'raw':!![],'where':{'id':_0x575687[_0x01a7('0x48')]['id']}},_0x14d58a={};_0x14d58a[_0x01a7('0x32')]=_[_0x01a7('0x35')](db[_0x01a7('0x2e')][_0x01a7('0x2f')]);_0x14d58a[_0x01a7('0x34')]=_['keys'](_0x575687[_0x01a7('0x34')]);_0x14d58a[_0x01a7('0x36')]=_[_0x01a7('0x37')](_0x14d58a[_0x01a7('0x32')],_0x14d58a['query']);_0x4b3ffd[_0x01a7('0x38')]=_[_0x01a7('0x37')](_0x14d58a['model'],qs[_0x01a7('0x39')](_0x575687[_0x01a7('0x34')][_0x01a7('0x39')]));_0x4b3ffd[_0x01a7('0x38')]=_0x4b3ffd[_0x01a7('0x38')][_0x01a7('0x3a')]?_0x4b3ffd[_0x01a7('0x38')]:_0x14d58a[_0x01a7('0x32')];if(_0x575687[_0x01a7('0x34')][_0x01a7('0x46')]){_0x4b3ffd['include']=[{'all':!![]}];}_0x4b3ffd=_[_0x01a7('0x42')]({},_0x4b3ffd,_0x575687[_0x01a7('0x45')]);return db[_0x01a7('0x2e')][_0x01a7('0x49')](_0x4b3ffd)['then'](handleEntityNotFound(_0x49bdac,null))[_0x01a7('0x28')](respondWithResult(_0x49bdac,null))[_0x01a7('0x4a')](handleError(_0x49bdac,null));};exports[_0x01a7('0x4b')]=function(_0x510402,_0xd3fb93){return db[_0x01a7('0x2e')][_0x01a7('0x4b')](_0x510402[_0x01a7('0x4c')],{})[_0x01a7('0x28')](respondWithResult(_0xd3fb93,0xc9))[_0x01a7('0x4a')](handleError(_0xd3fb93,null));};exports[_0x01a7('0x27')]=function(_0x5e6e7d,_0x30a03c){if(_0x5e6e7d[_0x01a7('0x4c')]['id']){delete _0x5e6e7d[_0x01a7('0x4c')]['id'];}return db[_0x01a7('0x2e')][_0x01a7('0x49')]({'where':{'id':_0x5e6e7d[_0x01a7('0x48')]['id']}})[_0x01a7('0x28')](handleEntityNotFound(_0x30a03c,null))['then'](saveUpdates(_0x5e6e7d[_0x01a7('0x4c')],null))['then'](respondWithResult(_0x30a03c,null))[_0x01a7('0x4a')](handleError(_0x30a03c,null));};exports['destroy']=function(_0x112fc2,_0x422d81){return db[_0x01a7('0x2e')]['find']({'where':{'id':_0x112fc2['params']['id']}})[_0x01a7('0x28')](handleEntityNotFound(_0x422d81,null))[_0x01a7('0x28')](removeEntity(_0x422d81,null))['catch'](handleError(_0x422d81,null));};exports['describe']=function(_0x194c54,_0x497979){return db['VoiceDialReport'][_0x01a7('0x4d')]()[_0x01a7('0x28')](respondWithResult(_0x497979,null))['catch'](handleError(_0x497979,null));}; \ No newline at end of file +var _0x8ad6=['pick','filter','merge','options','VoiceDialReport','includeAll','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2891bf,_0x50416d){var _0x2b5ba8=function(_0x164b3d){while(--_0x164b3d){_0x2891bf['push'](_0x2891bf['shift']());}};_0x2b5ba8(++_0x50416d);}(_0x8ad6,0xed));var _0x68ad=function(_0x1f6dad,_0x2dbd32){_0x1f6dad=_0x1f6dad-0x0;var _0x20b146=_0x8ad6[_0x1f6dad];return _0x20b146;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68ad('0x0'));var zipdir=require(_0x68ad('0x1'));var jsonpatch=require(_0x68ad('0x2'));var rp=require('request-promise');var moment=require(_0x68ad('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x68ad('0x4'));var path=require('path');var sox=require(_0x68ad('0x5'));var csv=require(_0x68ad('0x6'));var ejs=require(_0x68ad('0x7'));var fs=require('fs');var fs_extra=require(_0x68ad('0x8'));var _=require(_0x68ad('0x9'));var squel=require(_0x68ad('0xa'));var crypto=require(_0x68ad('0xb'));var jsforce=require(_0x68ad('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x68ad('0x6'));var querystring=require(_0x68ad('0xd'));var Papa=require(_0x68ad('0xe'));var Redis=require(_0x68ad('0xf'));var authService=require(_0x68ad('0x10'));var qs=require(_0x68ad('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68ad('0x12'));var logger=require('../../config/logger')(_0x68ad('0x13'));var utils=require(_0x68ad('0x14'));var config=require(_0x68ad('0x15'));var licenseUtil=require(_0x68ad('0x16'));var db=require(_0x68ad('0x17'))['db'];function respondWithStatusCode(_0x6cf019,_0x316068){_0x316068=_0x316068||0xcc;return function(_0x2fea11){if(_0x2fea11){return _0x6cf019[_0x68ad('0x18')](_0x316068);}return _0x6cf019['status'](_0x316068)[_0x68ad('0x19')]();};}function respondWithResult(_0x5afe63,_0x8afb4f){_0x8afb4f=_0x8afb4f||0xc8;return function(_0x1bbef6){if(_0x1bbef6){return _0x5afe63[_0x68ad('0x1a')](_0x8afb4f)[_0x68ad('0x1b')](_0x1bbef6);}};}function respondWithFilteredResult(_0x38b144,_0x53f53e){return function(_0x2d2bc9){if(_0x2d2bc9){var _0xc5cd0a=typeof _0x53f53e[_0x68ad('0x1c')]==='undefined'&&typeof _0x53f53e[_0x68ad('0x1d')]==='undefined';var _0x1b558d=_0x2d2bc9[_0x68ad('0x1e')];var _0x36ab21=_0xc5cd0a?0x0:_0x53f53e[_0x68ad('0x1c')];var _0x1d7451=_0xc5cd0a?_0x2d2bc9[_0x68ad('0x1e')]:_0x53f53e[_0x68ad('0x1c')]+_0x53f53e[_0x68ad('0x1d')];var _0x3d5889;if(_0x1d7451>=_0x1b558d){_0x1d7451=_0x1b558d;_0x3d5889=0xc8;}else{_0x3d5889=0xce;}_0x38b144[_0x68ad('0x1a')](_0x3d5889);return _0x38b144[_0x68ad('0x1f')]('Content-Range',_0x36ab21+'-'+_0x1d7451+'/'+_0x1b558d)['json'](_0x2d2bc9);}return null;};}function patchUpdates(_0x46fdf2){return function(_0x5b06c6){try{jsonpatch['apply'](_0x5b06c6,_0x46fdf2,!![]);}catch(_0x16e2a5){return BPromise[_0x68ad('0x20')](_0x16e2a5);}return _0x5b06c6[_0x68ad('0x21')]();};}function saveUpdates(_0x5bd3df,_0x21f519){return function(_0x14084b){if(_0x14084b){return _0x14084b[_0x68ad('0x22')](_0x5bd3df)['then'](function(_0x3ffdb6){return _0x3ffdb6;});}return null;};}function removeEntity(_0x2ddab1,_0x472c18){return function(_0x42f3e5){if(_0x42f3e5){return _0x42f3e5[_0x68ad('0x23')]()[_0x68ad('0x24')](function(){_0x2ddab1[_0x68ad('0x1a')](0xcc)[_0x68ad('0x19')]();});}};}function handleEntityNotFound(_0x2ffa41,_0x45e631){return function(_0x431b96){if(!_0x431b96){_0x2ffa41[_0x68ad('0x18')](0x194);}return _0x431b96;};}function handleError(_0x4b3219,_0x24c9cc){_0x24c9cc=_0x24c9cc||0x1f4;return function(_0x496374){logger[_0x68ad('0x25')](_0x496374[_0x68ad('0x26')]);if(_0x496374[_0x68ad('0x27')]){delete _0x496374['name'];}_0x4b3219[_0x68ad('0x1a')](_0x24c9cc)[_0x68ad('0x28')](_0x496374);};}exports[_0x68ad('0x29')]=function(_0x1a4338,_0x400518){var _0x59d7ca={},_0x17ac1a={},_0x4551f6={'count':0x0,'rows':[]};var _0x597315=_[_0x68ad('0x2a')](db['VoiceDialReport'][_0x68ad('0x2b')],function(_0x1251ae){return{'name':_0x1251ae[_0x68ad('0x2c')],'type':_0x1251ae[_0x68ad('0x2d')]['key']};});_0x17ac1a[_0x68ad('0x2e')]=_[_0x68ad('0x2a')](_0x597315,'name');_0x17ac1a[_0x68ad('0x2f')]=_[_0x68ad('0x30')](_0x1a4338['query']);_0x17ac1a[_0x68ad('0x31')]=_['intersection'](_0x17ac1a[_0x68ad('0x2e')],_0x17ac1a[_0x68ad('0x2f')]);_0x59d7ca[_0x68ad('0x32')]=_[_0x68ad('0x33')](_0x17ac1a['model'],qs[_0x68ad('0x34')](_0x1a4338[_0x68ad('0x2f')][_0x68ad('0x34')]));_0x59d7ca[_0x68ad('0x32')]=_0x59d7ca[_0x68ad('0x32')][_0x68ad('0x35')]?_0x59d7ca[_0x68ad('0x32')]:_0x17ac1a['model'];if(!_0x1a4338[_0x68ad('0x2f')][_0x68ad('0x36')](_0x68ad('0x37'))){_0x59d7ca['limit']=qs[_0x68ad('0x1d')](_0x1a4338[_0x68ad('0x2f')][_0x68ad('0x1d')]);_0x59d7ca[_0x68ad('0x1c')]=qs[_0x68ad('0x1c')](_0x1a4338['query']['offset']);}_0x59d7ca[_0x68ad('0x38')]=qs[_0x68ad('0x39')](_0x1a4338[_0x68ad('0x2f')][_0x68ad('0x39')]);_0x59d7ca[_0x68ad('0x3a')]=qs[_0x68ad('0x31')](_[_0x68ad('0x3b')](_0x1a4338['query'],_0x17ac1a[_0x68ad('0x31')]),_0x597315);if(_0x1a4338[_0x68ad('0x2f')][_0x68ad('0x3c')]){_0x59d7ca[_0x68ad('0x3a')]=_[_0x68ad('0x3d')](_0x59d7ca[_0x68ad('0x3a')],{'$or':_[_0x68ad('0x2a')](_0x597315,function(_0x397f18){if(_0x397f18[_0x68ad('0x2d')]!=='VIRTUAL'){var _0x5acc52={};_0x5acc52[_0x397f18['name']]={'$like':'%'+_0x1a4338[_0x68ad('0x2f')][_0x68ad('0x3c')]+'%'};return _0x5acc52;}})});}_0x59d7ca=_['merge']({},_0x59d7ca,_0x1a4338[_0x68ad('0x3e')]);var _0x1755ac={'where':_0x59d7ca['where']};return db[_0x68ad('0x3f')][_0x68ad('0x1e')](_0x1755ac)[_0x68ad('0x24')](function(_0x414b01){_0x4551f6[_0x68ad('0x1e')]=_0x414b01;if(_0x1a4338[_0x68ad('0x2f')][_0x68ad('0x40')]){_0x59d7ca['include']=[{'all':!![]}];}return db[_0x68ad('0x3f')][_0x68ad('0x41')](_0x59d7ca);})[_0x68ad('0x24')](function(_0x233219){_0x4551f6[_0x68ad('0x42')]=_0x233219;return _0x4551f6;})[_0x68ad('0x24')](respondWithFilteredResult(_0x400518,_0x59d7ca))[_0x68ad('0x43')](handleError(_0x400518,null));};exports[_0x68ad('0x44')]=function(_0x57e531,_0x76eeb9){var _0x3ef2a8={'raw':!![],'where':{'id':_0x57e531[_0x68ad('0x45')]['id']}},_0x368105={};_0x368105[_0x68ad('0x2e')]=_[_0x68ad('0x30')](db['VoiceDialReport']['rawAttributes']);_0x368105[_0x68ad('0x2f')]=_[_0x68ad('0x30')](_0x57e531[_0x68ad('0x2f')]);_0x368105['filters']=_[_0x68ad('0x33')](_0x368105[_0x68ad('0x2e')],_0x368105[_0x68ad('0x2f')]);_0x3ef2a8[_0x68ad('0x32')]=_[_0x68ad('0x33')](_0x368105[_0x68ad('0x2e')],qs['fields'](_0x57e531[_0x68ad('0x2f')][_0x68ad('0x34')]));_0x3ef2a8[_0x68ad('0x32')]=_0x3ef2a8['attributes']['length']?_0x3ef2a8['attributes']:_0x368105[_0x68ad('0x2e')];if(_0x57e531['query'][_0x68ad('0x40')]){_0x3ef2a8['include']=[{'all':!![]}];}_0x3ef2a8=_[_0x68ad('0x3d')]({},_0x3ef2a8,_0x57e531[_0x68ad('0x3e')]);return db[_0x68ad('0x3f')][_0x68ad('0x46')](_0x3ef2a8)[_0x68ad('0x24')](handleEntityNotFound(_0x76eeb9,null))[_0x68ad('0x24')](respondWithResult(_0x76eeb9,null))[_0x68ad('0x43')](handleError(_0x76eeb9,null));};exports[_0x68ad('0x47')]=function(_0x1654d1,_0x4661e9){return db[_0x68ad('0x3f')]['create'](_0x1654d1[_0x68ad('0x48')],{})[_0x68ad('0x24')](respondWithResult(_0x4661e9,0xc9))[_0x68ad('0x43')](handleError(_0x4661e9,null));};exports[_0x68ad('0x22')]=function(_0x3cea66,_0x4dcda7){if(_0x3cea66['body']['id']){delete _0x3cea66[_0x68ad('0x48')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x3cea66[_0x68ad('0x45')]['id']}})[_0x68ad('0x24')](handleEntityNotFound(_0x4dcda7,null))[_0x68ad('0x24')](saveUpdates(_0x3cea66['body'],null))[_0x68ad('0x24')](respondWithResult(_0x4dcda7,null))[_0x68ad('0x43')](handleError(_0x4dcda7,null));};exports['destroy']=function(_0x235dde,_0x4565d7){return db[_0x68ad('0x3f')][_0x68ad('0x46')]({'where':{'id':_0x235dde['params']['id']}})[_0x68ad('0x24')](handleEntityNotFound(_0x4565d7,null))[_0x68ad('0x24')](removeEntity(_0x4565d7,null))[_0x68ad('0x43')](handleError(_0x4565d7,null));};exports[_0x68ad('0x49')]=function(_0x31fe1a,_0x525d5a){return db[_0x68ad('0x3f')]['describe']()[_0x68ad('0x24')](respondWithResult(_0x525d5a,null))[_0x68ad('0x43')](handleError(_0x525d5a,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7af4bd2..1d9766c 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 _0xc507=['VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x370581,_0x57d0d3){var _0x55660c=function(_0xa26643){while(--_0xa26643){_0x370581['push'](_0x370581['shift']());}};_0x55660c(++_0x57d0d3);}(_0xc507,0x73));var _0x7c50=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0xc507[_0x427d3a];return _0xe5c521;};'use strict';var _=require(_0x7c50('0x0'));var util=require(_0x7c50('0x1'));var logger=require(_0x7c50('0x2'))(_0x7c50('0x3'));var moment=require(_0x7c50('0x4'));var BPromise=require(_0x7c50('0x5'));var rp=require(_0x7c50('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c50('0x7'));var config=require(_0x7c50('0x8'));var attributes=require('./voiceDialReport.attributes');module[_0x7c50('0x9')]=function(_0x873562,_0x1572e3){return _0x873562[_0x7c50('0xa')](_0x7c50('0xb'),attributes,{'tableName':_0x7c50('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7c50('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2251=['bluebird','request-promise','exports','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x1dbb5e,_0x1a6250){var _0x48096f=function(_0x19cf93){while(--_0x19cf93){_0x1dbb5e['push'](_0x1dbb5e['shift']());}};_0x48096f(++_0x1a6250);}(_0x2251,0x1c8));var _0x1225=function(_0x43b075,_0x797164){_0x43b075=_0x43b075-0x0;var _0x14cad0=_0x2251[_0x43b075];return _0x14cad0;};'use strict';var _=require(_0x1225('0x0'));var util=require('util');var logger=require(_0x1225('0x1'))(_0x1225('0x2'));var moment=require(_0x1225('0x3'));var BPromise=require(_0x1225('0x4'));var rp=require(_0x1225('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x1225('0x6')]=function(_0x1c1187,_0x393efb){return _0x1c1187['define'](_0x1225('0x7'),attributes,{'tableName':_0x1225('0x8'),'paranoid':![],'indexes':[{'fields':[_0x1225('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 7f19010..c860366 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 _0xb923=['request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','CreateVoiceDialReport','VoiceDialReport','create','body','options','catch','UpdateVoiceDialReport','update','raw','where','attributes','limit','debug','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xb923,0x73));var _0x3b92=function(_0x5eb40b,_0x3fcd44){_0x5eb40b=_0x5eb40b-0x0;var _0x53f4e9=_0xb923[_0x5eb40b];return _0x53f4e9;};'use strict';var _=require(_0x3b92('0x0'));var util=require(_0x3b92('0x1'));var moment=require('moment');var BPromise=require(_0x3b92('0x2'));var rs=require(_0x3b92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3b92('0x4'))('rpc');var config=require(_0x3b92('0x5'));var jayson=require(_0x3b92('0x6'));var client=jayson[_0x3b92('0x7')][_0x3b92('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36760e,_0x4f8eb7,_0x2136a5){return new BPromise(function(_0x2bca7c,_0x1f29b3){return client[_0x3b92('0x9')](_0x36760e,_0x2136a5)[_0x3b92('0xa')](function(_0x280b71){logger[_0x3b92('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x4f8eb7,'request\x20sent');logger['debug'](_0x3b92('0xc'),_0x4f8eb7,_0x3b92('0xd'),JSON[_0x3b92('0xe')](_0x280b71));if(_0x280b71['error']){if(_0x280b71[_0x3b92('0xf')][_0x3b92('0x10')]===0x1f4){logger[_0x3b92('0xf')](_0x3b92('0x11'),_0x4f8eb7,_0x280b71[_0x3b92('0xf')][_0x3b92('0x12')]);return _0x1f29b3(_0x280b71['error'][_0x3b92('0x12')]);}logger[_0x3b92('0xf')](_0x3b92('0x11'),_0x4f8eb7,_0x280b71['error'][_0x3b92('0x12')]);return _0x2bca7c(_0x280b71[_0x3b92('0xf')][_0x3b92('0x12')]);}else{logger[_0x3b92('0xb')](_0x3b92('0x11'),_0x4f8eb7,'request\x20sent');_0x2bca7c(_0x280b71['result'][_0x3b92('0x12')]);}})['catch'](function(_0x1fe895){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x4f8eb7,_0x1fe895);_0x1f29b3(_0x1fe895);});});}exports[_0x3b92('0x13')]=function(_0xc62e1e){var _0x5d67b5=this;return new Promise(function(_0xfa0c5a,_0xa567e3){return db[_0x3b92('0x14')][_0x3b92('0x15')](_0xc62e1e[_0x3b92('0x16')],{'raw':_0xc62e1e['options']?_0xc62e1e[_0x3b92('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3b92('0xa')](function(_0x31671c){logger[_0x3b92('0xb')](_0x3b92('0x13'),_0xc62e1e);logger['debug']('CreateVoiceDialReport',_0xc62e1e,JSON[_0x3b92('0xe')](_0x31671c));_0xfa0c5a(_0x31671c);})[_0x3b92('0x18')](function(_0x6215e5){logger['error'](_0x3b92('0x13'),_0x6215e5['message'],_0xc62e1e);_0xa567e3(_0x5d67b5[_0x3b92('0xf')](0x1f4,_0x6215e5[_0x3b92('0x12')]));});});};exports[_0x3b92('0x19')]=function(_0x389a2e){var _0x37496c=this;return new Promise(function(_0x5e2137,_0xc213bd){return db['VoiceDialReport'][_0x3b92('0x1a')](_0x389a2e[_0x3b92('0x16')],{'raw':_0x389a2e[_0x3b92('0x17')]?_0x389a2e[_0x3b92('0x17')][_0x3b92('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x389a2e[_0x3b92('0x17')]?_0x389a2e['options'][_0x3b92('0x1c')]||null:null,'attributes':_0x389a2e[_0x3b92('0x17')]?_0x389a2e[_0x3b92('0x17')][_0x3b92('0x1d')]||null:null,'limit':_0x389a2e[_0x3b92('0x17')]?_0x389a2e[_0x3b92('0x17')][_0x3b92('0x1e')]||null:null})[_0x3b92('0xa')](function(_0x58ce69){logger[_0x3b92('0xb')](_0x3b92('0x19'),_0x389a2e);logger[_0x3b92('0x1f')](_0x3b92('0x19'),_0x389a2e,JSON[_0x3b92('0xe')](_0x58ce69));_0x5e2137(_0x58ce69);})['catch'](function(_0x1d8a74){logger[_0x3b92('0xf')](_0x3b92('0x19'),_0x1d8a74[_0x3b92('0x12')],_0x389a2e);_0xc213bd(_0x37496c[_0x3b92('0xf')](0x1f4,_0x1d8a74[_0x3b92('0x12')]));});});}; \ No newline at end of file +var _0x400b=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','raw','UpdateVoiceDialReport','update','body','options','where','attributes','limit','stringify','lodash','util','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x400b,0xa7));var _0xb400=function(_0x59ac9a,_0x3dbf43){_0x59ac9a=_0x59ac9a-0x0;var _0x2d2a66=_0x400b[_0x59ac9a];return _0x2d2a66;};'use strict';var _=require(_0xb400('0x0'));var util=require(_0xb400('0x1'));var moment=require('moment');var BPromise=require(_0xb400('0x2'));var rs=require(_0xb400('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb400('0x4'))['db'];var utils=require(_0xb400('0x5'));var logger=require('../../config/logger')(_0xb400('0x6'));var config=require('../../config/environment');var jayson=require(_0xb400('0x7'));var client=jayson[_0xb400('0x8')][_0xb400('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b2779,_0x3cd348,_0x2eee48){return new BPromise(function(_0x2eff74,_0x11df45){return client[_0xb400('0xa')](_0x5b2779,_0x2eee48)[_0xb400('0xb')](function(_0x3fe7b0){logger[_0xb400('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x3cd348,_0xb400('0xd'));logger[_0xb400('0xe')](_0xb400('0xf'),_0x3cd348,_0xb400('0xd'),JSON['stringify'](_0x3fe7b0));if(_0x3fe7b0[_0xb400('0x10')]){if(_0x3fe7b0[_0xb400('0x10')][_0xb400('0x11')]===0x1f4){logger[_0xb400('0x10')](_0xb400('0x12'),_0x3cd348,_0x3fe7b0[_0xb400('0x10')]['message']);return _0x11df45(_0x3fe7b0[_0xb400('0x10')][_0xb400('0x13')]);}logger[_0xb400('0x10')](_0xb400('0x12'),_0x3cd348,_0x3fe7b0[_0xb400('0x10')]['message']);return _0x2eff74(_0x3fe7b0['error'][_0xb400('0x13')]);}else{logger[_0xb400('0xc')](_0xb400('0x12'),_0x3cd348,'request\x20sent');_0x2eff74(_0x3fe7b0[_0xb400('0x14')][_0xb400('0x13')]);}})[_0xb400('0x15')](function(_0x35b0f6){logger[_0xb400('0x10')](_0xb400('0x12'),_0x3cd348,_0x35b0f6);_0x11df45(_0x35b0f6);});});}exports[_0xb400('0x16')]=function(_0x5a4291){var _0x387cae=this;return new Promise(function(_0x3f403f,_0x51f987){return db[_0xb400('0x17')][_0xb400('0x18')](_0x5a4291['body'],{'raw':_0x5a4291['options']?_0x5a4291['options'][_0xb400('0x19')]===undefined?!![]:![]:!![]})[_0xb400('0xb')](function(_0x1bccf1){logger['info'](_0xb400('0x16'),_0x5a4291);logger[_0xb400('0xe')]('CreateVoiceDialReport',_0x5a4291,JSON['stringify'](_0x1bccf1));_0x3f403f(_0x1bccf1);})['catch'](function(_0xf40037){logger[_0xb400('0x10')](_0xb400('0x16'),_0xf40037['message'],_0x5a4291);_0x51f987(_0x387cae[_0xb400('0x10')](0x1f4,_0xf40037[_0xb400('0x13')]));});});};exports[_0xb400('0x1a')]=function(_0x398dd0){var _0x113c9a=this;return new Promise(function(_0x27f87c,_0x4452b7){return db[_0xb400('0x17')][_0xb400('0x1b')](_0x398dd0[_0xb400('0x1c')],{'raw':_0x398dd0['options']?_0x398dd0[_0xb400('0x1d')][_0xb400('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x398dd0['options']?_0x398dd0[_0xb400('0x1d')][_0xb400('0x1e')]||null:null,'attributes':_0x398dd0[_0xb400('0x1d')]?_0x398dd0[_0xb400('0x1d')][_0xb400('0x1f')]||null:null,'limit':_0x398dd0[_0xb400('0x1d')]?_0x398dd0[_0xb400('0x1d')][_0xb400('0x20')]||null:null})[_0xb400('0xb')](function(_0x517181){logger['info']('UpdateVoiceDialReport',_0x398dd0);logger['debug'](_0xb400('0x1a'),_0x398dd0,JSON[_0xb400('0x21')](_0x517181));_0x27f87c(_0x517181);})[_0xb400('0x15')](function(_0xc7889f){logger[_0xb400('0x10')](_0xb400('0x1a'),_0xc7889f[_0xb400('0x13')],_0x398dd0);_0x4452b7(_0x113c9a[_0xb400('0x10')](0x1f4,_0xc7889f[_0xb400('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 152fdc5..cf77ac0 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 _0xf90e=['../../components/auth/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','addApplications','put','update','delete','destroy','path','connect-timeout','Router'];(function(_0x431537,_0x2cc4eb){var _0x45d82e=function(_0x2f94bf){while(--_0x2f94bf){_0x431537['push'](_0x431537['shift']());}};_0x45d82e(++_0x2cc4eb);}(_0xf90e,0x7b));var _0xef90=function(_0x10d91d,_0x576515){_0x10d91d=_0x10d91d-0x0;var _0x465a17=_0xf90e[_0x10d91d];return _0x465a17;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xef90('0x0'));var timeout=require(_0xef90('0x1'));var express=require('express');var router=express[_0xef90('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xef90('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xef90('0x4'));var controller=require(_0xef90('0x5'));router[_0xef90('0x6')]('/',auth['isAuthenticated'](),controller[_0xef90('0x7')]);router[_0xef90('0x6')](_0xef90('0x8'),auth[_0xef90('0x9')](),controller[_0xef90('0xa')]);router[_0xef90('0xb')]('/',auth[_0xef90('0x9')](),controller[_0xef90('0xc')]);router[_0xef90('0xb')]('/:id/applications',auth['isAuthenticated'](),controller[_0xef90('0xd')]);router[_0xef90('0xe')](_0xef90('0x8'),auth[_0xef90('0x9')](),controller[_0xef90('0xf')]);router[_0xef90('0x10')](_0xef90('0x8'),auth[_0xef90('0x9')](),controller[_0xef90('0x11')]);module['exports']=router; \ No newline at end of file +var _0x959a=['util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','/:id/applications','addApplications','/:id','update','delete','destroy','exports','multer'];(function(_0x26af88,_0x314490){var _0x12b15c=function(_0x147af5){while(--_0x147af5){_0x26af88['push'](_0x26af88['shift']());}};_0x12b15c(++_0x314490);}(_0x959a,0x84));var _0xa959=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x959a[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xa959('0x0'));var util=require(_0xa959('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa959('0x2'));var router=express[_0xa959('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa959('0x4'));var config=require(_0xa959('0x5'));var controller=require('./voiceExtension.controller');router[_0xa959('0x6')]('/',auth[_0xa959('0x7')](),controller[_0xa959('0x8')]);router[_0xa959('0x6')]('/:id',auth[_0xa959('0x7')](),controller[_0xa959('0x9')]);router[_0xa959('0xa')]('/',auth[_0xa959('0x7')](),controller[_0xa959('0xb')]);router[_0xa959('0xa')](_0xa959('0xc'),auth[_0xa959('0x7')](),controller[_0xa959('0xd')]);router['put'](_0xa959('0xe'),auth[_0xa959('0x7')](),controller[_0xa959('0xf')]);router[_0xa959('0x10')](_0xa959('0xe'),auth['isAuthenticated'](),controller[_0xa959('0x11')]);module[_0xa959('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 71cc4ed..17e93ef 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 _0x4678=['inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','internal'];(function(_0x5be09a,_0x525dc7){var _0x143708=function(_0x1deff5){while(--_0x1deff5){_0x5be09a['push'](_0x5be09a['shift']());}};_0x143708(++_0x525dc7);}(_0x4678,0x14f));var _0x8467=function(_0x3e6f88,_0x301a12){_0x3e6f88=_0x3e6f88-0x0;var _0x13f644=_0x4678[_0x3e6f88];return _0x13f644;};'use strict';var Sequelize=require(_0x8467('0x0'));module[_0x8467('0x1')]={'context':{'type':Sequelize[_0x8467('0x2')],'allowNull':![],'unique':_0x8467('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x8467('0x2')],'allowNull':![],'unique':_0x8467('0x3')},'priority':{'type':Sequelize[_0x8467('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x8467('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x8467('0x2')],'allowNull':![],'defaultValue':_0x8467('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x8467('0x5')]('inbound','outbound',_0x8467('0x6'),_0x8467('0x7'),_0x8467('0x8'),_0x8467('0x9'),_0x8467('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x8467('0x2')]},'interval':{'type':Sequelize[_0x8467('0x2')],'allowNull':![],'defaultValue':_0x8467('0xb')},'IntervalId':{'type':Sequelize[_0x8467('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x8467('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x8467('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x8467('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x8467('0xe')},'answer':{'type':Sequelize[_0x8467('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x8467('0xf')],'get':function(_0x4529d3){return this[_0x8467('0x10')](_0x8467('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x99a9=['outbound','internal','inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','exports','compositeIndex','STRING','ENUM','inbound'];(function(_0x297b2b,_0x11eb85){var _0x14754b=function(_0x377d2f){while(--_0x377d2f){_0x297b2b['push'](_0x297b2b['shift']());}};_0x14754b(++_0x11eb85);}(_0x99a9,0x7b));var _0x999a=function(_0x1ae5db,_0x4e53b8){_0x1ae5db=_0x1ae5db-0x0;var _0x49d2e4=_0x99a9[_0x1ae5db];return _0x49d2e4;};'use strict';var Sequelize=require('sequelize');module[_0x999a('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x999a('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x999a('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x999a('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x999a('0x1')},'tag':{'type':Sequelize[_0x999a('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x999a('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x999a('0x3')](_0x999a('0x4'),_0x999a('0x5'),_0x999a('0x6'),_0x999a('0x7'),'outbound-fax',_0x999a('0x8'),_0x999a('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x999a('0x2')],'allowNull':![],'defaultValue':_0x999a('0xa')},'IntervalId':{'type':Sequelize[_0x999a('0xb')]},'isApp':{'type':Sequelize[_0x999a('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x999a('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x999a('0xb')]},'recordingFormat':{'type':Sequelize[_0x999a('0x2')],'defaultValue':_0x999a('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x999a('0xe')],'get':function(_0x18e88e){return this['getDataValue'](_0x999a('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 0c77009..5414daf 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 _0xe376=['ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','VoiceExtension','rawAttributes','key','model','keys','intersection','attributes','fields','length','query','order','sort','pick','filters','where','merge','options','includeAll','findAll','rows','catch','show','include','create','body','exten','user','role','outbound','InternalRoutes','userProfileId','autoAssociation','params','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','then','get','InboundRoutes','inbound','OutboundRoutes','filter'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe376,0x155));var _0x6e37=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xe376[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x6e37('0x0'));var Redis=require(_0x6e37('0x1'));var qs=require(_0x6e37('0x2'));var logger=require(_0x6e37('0x3'))('api');var config=require(_0x6e37('0x4'));var db=require(_0x6e37('0x5'))['db'];config[_0x6e37('0x6')]=_[_0x6e37('0x7')](config[_0x6e37('0x6')],{'host':_0x6e37('0x8'),'port':0x18eb});var socket=require(_0x6e37('0x9'))(new Redis(config['redis']));require(_0x6e37('0xa'))[_0x6e37('0xb')](socket);function respondWithStatusCode(_0x50c272,_0x4de801){_0x4de801=_0x4de801||0xcc;return function(_0x489563){if(_0x489563){return _0x50c272[_0x6e37('0xc')](_0x4de801);}return _0x50c272[_0x6e37('0xd')](_0x4de801)[_0x6e37('0xe')]();};}function respondWithResult(_0x3fc7b3,_0x172d5a){_0x172d5a=_0x172d5a||0xc8;return function(_0x3c00d8){if(_0x3c00d8){return _0x3fc7b3['status'](_0x172d5a)[_0x6e37('0xf')](_0x3c00d8);}};}function respondWithFilteredResult(_0x38042e,_0xa2be4d){return function(_0x19533c){if(_0x19533c){var _0x53c056=typeof _0xa2be4d[_0x6e37('0x10')]===_0x6e37('0x11')&&typeof _0xa2be4d[_0x6e37('0x12')]===_0x6e37('0x11');var _0x309012=_0x19533c[_0x6e37('0x13')];var _0x54c979=_0x53c056?0x0:_0xa2be4d[_0x6e37('0x10')];var _0x44e166=_0x53c056?_0x19533c['count']:_0xa2be4d['offset']+_0xa2be4d['limit'];var _0x233cbb;if(_0x44e166>=_0x309012){_0x44e166=_0x309012;_0x233cbb=0xc8;}else{_0x233cbb=0xce;}_0x38042e[_0x6e37('0xd')](_0x233cbb);return _0x38042e[_0x6e37('0x14')]('Content-Range',_0x54c979+'-'+_0x44e166+'/'+_0x309012)['json'](_0x19533c);}return null;};}function removeEntity(_0x2c1255){return function(_0x5d51ea){if(_0x5d51ea){return _0x5d51ea['destroy']()[_0x6e37('0x15')](function(){var _0x3b7374=_0x5d51ea[_0x6e37('0x16')]({'plain':!![]});var _0x2ce51d=[{'name':_0x6e37('0x17'),'value':_0x6e37('0x18'),'ignore':![]},{'name':_0x6e37('0x19'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x42c8a6=_(_0x2ce51d)[_0x6e37('0x1a')](_0x6e37('0x1b'))[_0x6e37('0x1c')](_0x6e37('0x1d'))['value']();if(_[_0x6e37('0x1e')](_0x42c8a6,_0x3b7374[_0x6e37('0x1f')])){return;}var _0x1e6013=_[_0x6e37('0x20')](_0x2ce51d,[_0x6e37('0x1d'),_0x3b7374[_0x6e37('0x1f')]])[_0x6e37('0x21')];return db[_0x6e37('0x22')][_0x6e37('0x23')]({'where':{'type':_0x1e6013,'resourceId':_0x3b7374['id']}})[_0x6e37('0x15')](function(){return _0x5d51ea;});})[_0x6e37('0x15')](function(){_0x2c1255[_0x6e37('0xd')](0xcc)[_0x6e37('0xe')]();});}};}function handleEntityNotFound(_0x1dd01e){return function(_0x497dae){if(!_0x497dae){_0x1dd01e[_0x6e37('0xc')](0x194);}return _0x497dae;};}function handleError(_0x451a4d,_0x5e1cee){_0x5e1cee=_0x5e1cee||0x1f4;return function(_0x38b19d){logger[_0x6e37('0x24')](_0x38b19d[_0x6e37('0x25')]);if(_0x38b19d[_0x6e37('0x21')]){delete _0x38b19d[_0x6e37('0x21')];}_0x451a4d['status'](_0x5e1cee)[_0x6e37('0x26')](_0x38b19d);};}exports[_0x6e37('0x27')]=function(_0x24c608,_0x2f9991){var _0x3db198={},_0x40534b={},_0x343ad0={'count':0x0,'rows':[]};var _0x55ed19=_[_0x6e37('0x1c')](db[_0x6e37('0x28')][_0x6e37('0x29')],function(_0x56de3f){return{'name':_0x56de3f['fieldName'],'type':_0x56de3f[_0x6e37('0x1f')][_0x6e37('0x2a')]};});_0x40534b[_0x6e37('0x2b')]=_[_0x6e37('0x1c')](_0x55ed19,_0x6e37('0x21'));_0x40534b['query']=_[_0x6e37('0x2c')](_0x24c608['query']);_0x40534b['filters']=_[_0x6e37('0x2d')](_0x40534b['model'],_0x40534b['query']);_0x3db198[_0x6e37('0x2e')]=_[_0x6e37('0x2d')](_0x40534b[_0x6e37('0x2b')],qs[_0x6e37('0x2f')](_0x24c608['query'][_0x6e37('0x2f')]));_0x3db198[_0x6e37('0x2e')]=_0x3db198[_0x6e37('0x2e')][_0x6e37('0x30')]?_0x3db198[_0x6e37('0x2e')]:_0x40534b[_0x6e37('0x2b')];if(!_0x24c608['query']['hasOwnProperty']('nolimit')){_0x3db198[_0x6e37('0x12')]=qs[_0x6e37('0x12')](_0x24c608[_0x6e37('0x31')][_0x6e37('0x12')]);_0x3db198['offset']=qs['offset'](_0x24c608[_0x6e37('0x31')][_0x6e37('0x10')]);}_0x3db198[_0x6e37('0x32')]=qs[_0x6e37('0x33')](_0x24c608['query'][_0x6e37('0x33')]);_0x3db198['where']=qs['filters'](_[_0x6e37('0x34')](_0x24c608[_0x6e37('0x31')],_0x40534b[_0x6e37('0x35')]),_0x55ed19);if(_0x24c608['query'][_0x6e37('0x1a')]){_0x3db198[_0x6e37('0x36')]=_[_0x6e37('0x37')](_0x3db198[_0x6e37('0x36')],{'$or':_[_0x6e37('0x1c')](_0x55ed19,function(_0x308941){if(_0x308941['type']!=='VIRTUAL'){var _0x2c3663={};_0x2c3663[_0x308941['name']]={'$like':'%'+_0x24c608['query'][_0x6e37('0x1a')]+'%'};return _0x2c3663;}})});}_0x3db198=_[_0x6e37('0x37')]({},_0x3db198,_0x24c608[_0x6e37('0x38')]);var _0x31f4aa={'where':_0x3db198[_0x6e37('0x36')]};return db[_0x6e37('0x28')][_0x6e37('0x13')](_0x31f4aa)['then'](function(_0x2c060c){_0x343ad0[_0x6e37('0x13')]=_0x2c060c;if(_0x24c608[_0x6e37('0x31')][_0x6e37('0x39')]){_0x3db198['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x6e37('0x3a')](_0x3db198);})['then'](function(_0xb3e4e1){_0x343ad0[_0x6e37('0x3b')]=_0xb3e4e1;return _0x343ad0;})[_0x6e37('0x15')](respondWithFilteredResult(_0x2f9991,_0x3db198))[_0x6e37('0x3c')](handleError(_0x2f9991,null));};exports[_0x6e37('0x3d')]=function(_0x1bc4ad,_0x3e6f4f){var _0x1977e2={'raw':![],'where':{'id':_0x1bc4ad['params']['id']}},_0x3a017b={};_0x3a017b['model']=_['keys'](db[_0x6e37('0x28')][_0x6e37('0x29')]);_0x3a017b[_0x6e37('0x31')]=_[_0x6e37('0x2c')](_0x1bc4ad[_0x6e37('0x31')]);_0x3a017b[_0x6e37('0x35')]=_[_0x6e37('0x2d')](_0x3a017b[_0x6e37('0x2b')],_0x3a017b[_0x6e37('0x31')]);_0x1977e2['attributes']=_[_0x6e37('0x2d')](_0x3a017b[_0x6e37('0x2b')],qs[_0x6e37('0x2f')](_0x1bc4ad[_0x6e37('0x31')][_0x6e37('0x2f')]));_0x1977e2[_0x6e37('0x2e')]=_0x1977e2[_0x6e37('0x2e')]['length']?_0x1977e2['attributes']:_0x3a017b[_0x6e37('0x2b')];if(_0x1bc4ad[_0x6e37('0x31')]['includeAll']){_0x1977e2[_0x6e37('0x3e')]=[{'all':!![]}];}_0x1977e2=_[_0x6e37('0x37')]({},_0x1977e2,_0x1bc4ad[_0x6e37('0x38')]);return db['VoiceExtension']['find'](_0x1977e2)[_0x6e37('0x15')](handleEntityNotFound(_0x3e6f4f,null))[_0x6e37('0x15')](respondWithResult(_0x3e6f4f,null))[_0x6e37('0x3c')](handleError(_0x3e6f4f,null));};exports[_0x6e37('0x23')]=function(_0x7646ff,_0x107b99){return db[_0x6e37('0x28')][_0x6e37('0x20')]({'where':{'id':_0x7646ff['params']['id']}})[_0x6e37('0x15')](handleEntityNotFound(_0x107b99,null))['then'](removeEntity(_0x107b99,null))[_0x6e37('0x3c')](handleError(_0x107b99,null));};exports[_0x6e37('0x3f')]=function(_0x524924,_0x5e6018){if(_0x524924[_0x6e37('0x40')][_0x6e37('0x1f')]==='outbound'&&!_['startsWith'](_0x524924[_0x6e37('0x40')][_0x6e37('0x41')],'_')){_0x524924[_0x6e37('0x40')][_0x6e37('0x41')]='_'['concat'](_0x524924[_0x6e37('0x40')]['exten']);}return db[_0x6e37('0x28')][_0x6e37('0x3f')](_0x524924['body'],{'raw':![]})[_0x6e37('0x15')](function(_0x40a4d8){var _0xa0a24f=_0x524924[_0x6e37('0x42')][_0x6e37('0x16')]({'plain':!![]});if(!_0xa0a24f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa0a24f[_0x6e37('0x43')]===_0x6e37('0x42')){var _0x4c8b81=_0x40a4d8[_0x6e37('0x16')]({'plain':!![]});var _0x49deeb=[{'name':_0x6e37('0x17'),'value':_0x6e37('0x18')},{'name':_0x6e37('0x19'),'value':_0x6e37('0x44')},{'name':_0x6e37('0x45'),'value':'internal'}];var _0x35a0ca=_[_0x6e37('0x20')](_0x49deeb,['value',_0x4c8b81['type']])[_0x6e37('0x21')];return db['UserProfileSection'][_0x6e37('0x20')]({'where':{'name':_0x35a0ca,'userProfileId':_0xa0a24f[_0x6e37('0x46')]},'raw':!![]})[_0x6e37('0x15')](function(_0x241650){if(_0x241650&&_0x241650[_0x6e37('0x47')]===0x0){return db[_0x6e37('0x22')][_0x6e37('0x3f')]({'name':_0x4c8b81[_0x6e37('0x21')],'resourceId':_0x4c8b81['id'],'type':_0x241650['name'],'sectionId':_0x241650['id']},{})['then'](function(){return _0x40a4d8;});}else{return _0x40a4d8;}})['catch'](function(_0x31c608){logger[_0x6e37('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31c608);throw _0x31c608;});}return _0x40a4d8;})[_0x6e37('0x15')](respondWithResult(_0x5e6018,0xc9))[_0x6e37('0x3c')](handleError(_0x5e6018,null));};exports['update']=function(_0x156767,_0x15ed3f){if(_0x156767[_0x6e37('0x40')]['id']){delete _0x156767['body']['id'];}return db['VoiceExtension'][_0x6e37('0x20')]({'where':{'id':_0x156767[_0x6e37('0x48')]['id']}})['then'](handleEntityNotFound(_0x15ed3f,null))['then'](function(_0x2cd187){if(_0x2cd187){return db[_0x6e37('0x28')]['update'](_[_0x6e37('0x34')](_0x156767['body'],[_0x6e37('0x41'),_0x6e37('0x49'),_0x6e37('0x4a'),_0x6e37('0x4b'),_0x6e37('0x4c'),_0x6e37('0x4d'),_0x6e37('0x4e')]),{'where':{'context':_0x2cd187[_0x6e37('0x49')],'exten':_0x2cd187[_0x6e37('0x41')]},'individualHooks':!![]})[_0x6e37('0x15')](function(_0x4d3cbf){return _0x4d3cbf;});}return null;})['then'](respondWithStatusCode(_0x15ed3f,null))['catch'](handleError(_0x15ed3f,null));};exports[_0x6e37('0x4f')]=function(_0x112cc6,_0x3395c1){var _0x4d8480=_0x112cc6[_0x6e37('0x48')]['id'];var _0x1ee3ce=_0x112cc6['body'];var _0x59c579=0xc8;var _0x2150a3=null;return db[_0x6e37('0x50')][_0x6e37('0x51')]({'isolationLevel':db[_0x6e37('0x50')][_0x6e37('0x52')][_0x6e37('0x53')][_0x6e37('0x54')]},function(_0x150582){return db['VoiceExtension'][_0x6e37('0x55')]({'where':{'id':_0x4d8480},'transaction':_0x150582})[_0x6e37('0x15')](function(_0x4318a3){if(_0x4318a3){return db[_0x6e37('0x28')][_0x6e37('0x23')]({'where':{'VoiceExtensionId':_0x4d8480},'transaction':_0x150582})['then'](function(){var _0x4fd2e5=_[_0x6e37('0x1c')](_0x1ee3ce,function(_0x5c58c4){_0x5c58c4[_0x6e37('0x56')]=_0x4d8480;_0x5c58c4[_0x6e37('0x57')]=!![];return _0x5c58c4;});return _0x4318a3[_0x6e37('0x58')](_0x4fd2e5);})[_0x6e37('0x15')](function(_0xe71491){return db[_0x6e37('0x28')][_0x6e37('0x59')](_0xe71491,{'transaction':_0x150582});});}else{_0x59c579=0x194;_0x2150a3=[];}});})['then'](function(){if(_0x59c579!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x4d8480},'order':_0x6e37('0x5a')})['then'](function(_0x2e8175){_0x2150a3=_0x2e8175;});}})[_0x6e37('0x3c')](function(_0x2ef4d5){_0x59c579=0x1f4;logger['error'](_0x2ef4d5[_0x6e37('0x25')]);if(_0x2ef4d5[_0x6e37('0x21')]){delete _0x2ef4d5[_0x6e37('0x21')];}_0x2150a3=_0x2ef4d5;})[_0x6e37('0x5b')](function(){if(_0x2150a3===null){_0x3395c1[_0x6e37('0xc')](_0x59c579);}else{if(_0x59c579===0x1f4){_0x3395c1[_0x6e37('0xd')](_0x59c579)['send'](_0x2150a3);}else{_0x3395c1[_0x6e37('0xd')](_0x59c579)['json'](_0x2150a3);}}});}; \ No newline at end of file +var _0x4c4d=['VoiceExtensionId','isApp','createRouting','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','undefined','count','set','Content-Range','json','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','transaction','sequelize','Transaction','findOne'];(function(_0x11af78,_0x3f49e2){var _0x5d4deb=function(_0x548d5c){while(--_0x548d5c){_0x11af78['push'](_0x11af78['shift']());}};_0x5d4deb(++_0x3f49e2);}(_0x4c4d,0xc0));var _0xd4c4=function(_0xa13012,_0x3d8be4){_0xa13012=_0xa13012-0x0;var _0x3a0b5d=_0x4c4d[_0xa13012];return _0x3a0b5d;};'use strict';var _=require(_0xd4c4('0x0'));var Redis=require(_0xd4c4('0x1'));var qs=require(_0xd4c4('0x2'));var logger=require(_0xd4c4('0x3'))(_0xd4c4('0x4'));var config=require(_0xd4c4('0x5'));var db=require(_0xd4c4('0x6'))['db'];config[_0xd4c4('0x7')]=_[_0xd4c4('0x8')](config[_0xd4c4('0x7')],{'host':_0xd4c4('0x9'),'port':0x18eb});var socket=require(_0xd4c4('0xa'))(new Redis(config[_0xd4c4('0x7')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x40c4d0,_0x572a86){_0x572a86=_0x572a86||0xcc;return function(_0x53ccdf){if(_0x53ccdf){return _0x40c4d0[_0xd4c4('0xb')](_0x572a86);}return _0x40c4d0['status'](_0x572a86)[_0xd4c4('0xc')]();};}function respondWithResult(_0x1eb2e6,_0x1e1145){_0x1e1145=_0x1e1145||0xc8;return function(_0x37b301){if(_0x37b301){return _0x1eb2e6[_0xd4c4('0xd')](_0x1e1145)['json'](_0x37b301);}};}function respondWithFilteredResult(_0x1c8da1,_0x43802d){return function(_0xd17c76){if(_0xd17c76){var _0x564817=typeof _0x43802d['offset']===_0xd4c4('0xe')&&typeof _0x43802d['limit']===_0xd4c4('0xe');var _0x44ac6c=_0xd17c76[_0xd4c4('0xf')];var _0x3ac110=_0x564817?0x0:_0x43802d['offset'];var _0x4020c7=_0x564817?_0xd17c76['count']:_0x43802d['offset']+_0x43802d['limit'];var _0x52fdf2;if(_0x4020c7>=_0x44ac6c){_0x4020c7=_0x44ac6c;_0x52fdf2=0xc8;}else{_0x52fdf2=0xce;}_0x1c8da1[_0xd4c4('0xd')](_0x52fdf2);return _0x1c8da1[_0xd4c4('0x10')](_0xd4c4('0x11'),_0x3ac110+'-'+_0x4020c7+'/'+_0x44ac6c)[_0xd4c4('0x12')](_0xd17c76);}return null;};}function removeEntity(_0xc56249){return function(_0x4b51dc){if(_0x4b51dc){return _0x4b51dc[_0xd4c4('0x13')]()[_0xd4c4('0x14')](function(){var _0x2bbd77=_0x4b51dc[_0xd4c4('0x15')]({'plain':!![]});var _0x501333=[{'name':'InboundRoutes','value':_0xd4c4('0x16'),'ignore':![]},{'name':_0xd4c4('0x17'),'value':_0xd4c4('0x18'),'ignore':![]},{'name':_0xd4c4('0x19'),'value':_0xd4c4('0x1a'),'ignore':![]}];var _0x1a9caa=_(_0x501333)[_0xd4c4('0x1b')](_0xd4c4('0x1c'))[_0xd4c4('0x1d')]('value')[_0xd4c4('0x1e')]();if(_[_0xd4c4('0x1f')](_0x1a9caa,_0x2bbd77[_0xd4c4('0x20')])){return;}var _0x480e88=_[_0xd4c4('0x21')](_0x501333,[_0xd4c4('0x1e'),_0x2bbd77[_0xd4c4('0x20')]])[_0xd4c4('0x22')];return db[_0xd4c4('0x23')][_0xd4c4('0x13')]({'where':{'type':_0x480e88,'resourceId':_0x2bbd77['id']}})[_0xd4c4('0x14')](function(){return _0x4b51dc;});})[_0xd4c4('0x14')](function(){_0xc56249[_0xd4c4('0xd')](0xcc)[_0xd4c4('0xc')]();});}};}function handleEntityNotFound(_0x25b62f){return function(_0x34995e){if(!_0x34995e){_0x25b62f[_0xd4c4('0xb')](0x194);}return _0x34995e;};}function handleError(_0x792321,_0x2f6186){_0x2f6186=_0x2f6186||0x1f4;return function(_0x26798d){logger[_0xd4c4('0x24')](_0x26798d[_0xd4c4('0x25')]);if(_0x26798d['name']){delete _0x26798d[_0xd4c4('0x22')];}_0x792321[_0xd4c4('0xd')](_0x2f6186)[_0xd4c4('0x26')](_0x26798d);};}exports[_0xd4c4('0x27')]=function(_0x2d87d7,_0xe3f78d){var _0x504be8={},_0x1c9a59={},_0x5c3f7d={'count':0x0,'rows':[]};var _0x9b806f=_[_0xd4c4('0x1d')](db[_0xd4c4('0x28')][_0xd4c4('0x29')],function(_0x33584e){return{'name':_0x33584e['fieldName'],'type':_0x33584e[_0xd4c4('0x20')]['key']};});_0x1c9a59[_0xd4c4('0x2a')]=_[_0xd4c4('0x1d')](_0x9b806f,'name');_0x1c9a59[_0xd4c4('0x2b')]=_[_0xd4c4('0x2c')](_0x2d87d7['query']);_0x1c9a59[_0xd4c4('0x2d')]=_[_0xd4c4('0x2e')](_0x1c9a59['model'],_0x1c9a59['query']);_0x504be8[_0xd4c4('0x2f')]=_[_0xd4c4('0x2e')](_0x1c9a59['model'],qs[_0xd4c4('0x30')](_0x2d87d7[_0xd4c4('0x2b')][_0xd4c4('0x30')]));_0x504be8[_0xd4c4('0x2f')]=_0x504be8[_0xd4c4('0x2f')]['length']?_0x504be8[_0xd4c4('0x2f')]:_0x1c9a59[_0xd4c4('0x2a')];if(!_0x2d87d7[_0xd4c4('0x2b')][_0xd4c4('0x31')](_0xd4c4('0x32'))){_0x504be8[_0xd4c4('0x33')]=qs['limit'](_0x2d87d7[_0xd4c4('0x2b')][_0xd4c4('0x33')]);_0x504be8[_0xd4c4('0x34')]=qs[_0xd4c4('0x34')](_0x2d87d7['query'][_0xd4c4('0x34')]);}_0x504be8[_0xd4c4('0x35')]=qs['sort'](_0x2d87d7['query'][_0xd4c4('0x36')]);_0x504be8[_0xd4c4('0x37')]=qs[_0xd4c4('0x2d')](_[_0xd4c4('0x38')](_0x2d87d7[_0xd4c4('0x2b')],_0x1c9a59['filters']),_0x9b806f);if(_0x2d87d7[_0xd4c4('0x2b')][_0xd4c4('0x1b')]){_0x504be8[_0xd4c4('0x37')]=_[_0xd4c4('0x39')](_0x504be8[_0xd4c4('0x37')],{'$or':_['map'](_0x9b806f,function(_0x238b57){if(_0x238b57[_0xd4c4('0x20')]!=='VIRTUAL'){var _0x4a56a6={};_0x4a56a6[_0x238b57['name']]={'$like':'%'+_0x2d87d7[_0xd4c4('0x2b')][_0xd4c4('0x1b')]+'%'};return _0x4a56a6;}})});}_0x504be8=_[_0xd4c4('0x39')]({},_0x504be8,_0x2d87d7[_0xd4c4('0x3a')]);var _0x8e9a14={'where':_0x504be8[_0xd4c4('0x37')]};return db['VoiceExtension'][_0xd4c4('0xf')](_0x8e9a14)[_0xd4c4('0x14')](function(_0x2d42a7){_0x5c3f7d['count']=_0x2d42a7;if(_0x2d87d7[_0xd4c4('0x2b')][_0xd4c4('0x3b')]){_0x504be8[_0xd4c4('0x3c')]=[{'all':!![]}];}return db[_0xd4c4('0x28')][_0xd4c4('0x3d')](_0x504be8);})[_0xd4c4('0x14')](function(_0x26cf28){_0x5c3f7d[_0xd4c4('0x3e')]=_0x26cf28;return _0x5c3f7d;})[_0xd4c4('0x14')](respondWithFilteredResult(_0xe3f78d,_0x504be8))[_0xd4c4('0x3f')](handleError(_0xe3f78d,null));};exports[_0xd4c4('0x40')]=function(_0x340bd3,_0x4d82fd){var _0x13d3c0={'raw':![],'where':{'id':_0x340bd3[_0xd4c4('0x41')]['id']}},_0x369a61={};_0x369a61[_0xd4c4('0x2a')]=_[_0xd4c4('0x2c')](db[_0xd4c4('0x28')][_0xd4c4('0x29')]);_0x369a61[_0xd4c4('0x2b')]=_[_0xd4c4('0x2c')](_0x340bd3['query']);_0x369a61[_0xd4c4('0x2d')]=_['intersection'](_0x369a61[_0xd4c4('0x2a')],_0x369a61[_0xd4c4('0x2b')]);_0x13d3c0[_0xd4c4('0x2f')]=_[_0xd4c4('0x2e')](_0x369a61['model'],qs[_0xd4c4('0x30')](_0x340bd3['query']['fields']));_0x13d3c0[_0xd4c4('0x2f')]=_0x13d3c0[_0xd4c4('0x2f')][_0xd4c4('0x42')]?_0x13d3c0[_0xd4c4('0x2f')]:_0x369a61['model'];if(_0x340bd3[_0xd4c4('0x2b')][_0xd4c4('0x3b')]){_0x13d3c0[_0xd4c4('0x3c')]=[{'all':!![]}];}_0x13d3c0=_['merge']({},_0x13d3c0,_0x340bd3['options']);return db[_0xd4c4('0x28')][_0xd4c4('0x21')](_0x13d3c0)['then'](handleEntityNotFound(_0x4d82fd,null))[_0xd4c4('0x14')](respondWithResult(_0x4d82fd,null))[_0xd4c4('0x3f')](handleError(_0x4d82fd,null));};exports[_0xd4c4('0x13')]=function(_0x42490a,_0x47c5d7){return db[_0xd4c4('0x28')][_0xd4c4('0x21')]({'where':{'id':_0x42490a['params']['id']}})[_0xd4c4('0x14')](handleEntityNotFound(_0x47c5d7,null))[_0xd4c4('0x14')](removeEntity(_0x47c5d7,null))['catch'](handleError(_0x47c5d7,null));};exports[_0xd4c4('0x43')]=function(_0x3f2495,_0x3e766c){if(_0x3f2495[_0xd4c4('0x44')][_0xd4c4('0x20')]===_0xd4c4('0x18')&&!_[_0xd4c4('0x45')](_0x3f2495[_0xd4c4('0x44')][_0xd4c4('0x46')],'_')){_0x3f2495[_0xd4c4('0x44')][_0xd4c4('0x46')]='_'[_0xd4c4('0x47')](_0x3f2495['body']['exten']);}return db['VoiceExtension'][_0xd4c4('0x43')](_0x3f2495[_0xd4c4('0x44')],{'raw':![]})['then'](function(_0x337639){var _0x19e0cc=_0x3f2495[_0xd4c4('0x48')]['get']({'plain':!![]});if(!_0x19e0cc)throw new Error(_0xd4c4('0x49'));if(_0x19e0cc[_0xd4c4('0x4a')]===_0xd4c4('0x48')){var _0x45d663=_0x337639[_0xd4c4('0x15')]({'plain':!![]});var _0x1a841c=[{'name':_0xd4c4('0x4b'),'value':_0xd4c4('0x16')},{'name':_0xd4c4('0x17'),'value':_0xd4c4('0x18')},{'name':_0xd4c4('0x19'),'value':_0xd4c4('0x1a')}];var _0x4393c0=_[_0xd4c4('0x21')](_0x1a841c,[_0xd4c4('0x1e'),_0x45d663[_0xd4c4('0x20')]])['name'];return db[_0xd4c4('0x4c')][_0xd4c4('0x21')]({'where':{'name':_0x4393c0,'userProfileId':_0x19e0cc['userProfileId']},'raw':!![]})[_0xd4c4('0x14')](function(_0x5d6ed1){if(_0x5d6ed1&&_0x5d6ed1[_0xd4c4('0x4d')]===0x0){return db[_0xd4c4('0x23')]['create']({'name':_0x45d663[_0xd4c4('0x22')],'resourceId':_0x45d663['id'],'type':_0x5d6ed1['name'],'sectionId':_0x5d6ed1['id']},{})[_0xd4c4('0x14')](function(){return _0x337639;});}else{return _0x337639;}})[_0xd4c4('0x3f')](function(_0x50dccd){logger[_0xd4c4('0x24')](_0xd4c4('0x4e'),_0x50dccd);throw _0x50dccd;});}return _0x337639;})[_0xd4c4('0x14')](respondWithResult(_0x3e766c,0xc9))[_0xd4c4('0x3f')](handleError(_0x3e766c,null));};exports[_0xd4c4('0x4f')]=function(_0x2f48e3,_0x4c98da){if(_0x2f48e3[_0xd4c4('0x44')]['id']){delete _0x2f48e3['body']['id'];}return db[_0xd4c4('0x28')][_0xd4c4('0x21')]({'where':{'id':_0x2f48e3[_0xd4c4('0x41')]['id']}})[_0xd4c4('0x14')](handleEntityNotFound(_0x4c98da,null))[_0xd4c4('0x14')](function(_0x46bdd3){if(_0x46bdd3){return db[_0xd4c4('0x28')][_0xd4c4('0x4f')](_[_0xd4c4('0x38')](_0x2f48e3[_0xd4c4('0x44')],[_0xd4c4('0x46'),_0xd4c4('0x50'),_0xd4c4('0x51'),_0xd4c4('0x52'),_0xd4c4('0x53'),_0xd4c4('0x54'),_0xd4c4('0x55')]),{'where':{'context':_0x46bdd3['context'],'exten':_0x46bdd3['exten']},'individualHooks':!![]})[_0xd4c4('0x14')](function(_0x1175ce){return _0x1175ce;});}return null;})[_0xd4c4('0x14')](respondWithStatusCode(_0x4c98da,null))[_0xd4c4('0x3f')](handleError(_0x4c98da,null));};exports['addApplications']=function(_0x2393a0,_0x5958ec){var _0x33763b=_0x2393a0['params']['id'];var _0x819918=_0x2393a0[_0xd4c4('0x44')];var _0x2bec40=0xc8;var _0x269fe0=null;return db['sequelize'][_0xd4c4('0x56')]({'isolationLevel':db[_0xd4c4('0x57')][_0xd4c4('0x58')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0xead33f){return db[_0xd4c4('0x28')][_0xd4c4('0x59')]({'where':{'id':_0x33763b},'transaction':_0xead33f})[_0xd4c4('0x14')](function(_0x2194d9){if(_0x2194d9){return db[_0xd4c4('0x28')][_0xd4c4('0x13')]({'where':{'VoiceExtensionId':_0x33763b},'transaction':_0xead33f})['then'](function(){var _0x3410a3=_['map'](_0x819918,function(_0x4d61c4){_0x4d61c4[_0xd4c4('0x5a')]=_0x33763b;_0x4d61c4[_0xd4c4('0x5b')]=!![];return _0x4d61c4;});return _0x2194d9[_0xd4c4('0x5c')](_0x3410a3);})[_0xd4c4('0x14')](function(_0x2c74c2){return db['VoiceExtension']['bulkCreate'](_0x2c74c2,{'transaction':_0xead33f});});}else{_0x2bec40=0x194;_0x269fe0=[];}});})['then'](function(){if(_0x2bec40!==0x194){return db[_0xd4c4('0x28')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x33763b},'order':'cast(priority\x20as\x20unsigned)'})[_0xd4c4('0x14')](function(_0x2d88ba){_0x269fe0=_0x2d88ba;});}})[_0xd4c4('0x3f')](function(_0x5bd238){_0x2bec40=0x1f4;logger[_0xd4c4('0x24')](_0x5bd238[_0xd4c4('0x25')]);if(_0x5bd238[_0xd4c4('0x22')]){delete _0x5bd238[_0xd4c4('0x22')];}_0x269fe0=_0x5bd238;})[_0xd4c4('0x5d')](function(){if(_0x269fe0===null){_0x5958ec[_0xd4c4('0xb')](_0x2bec40);}else{if(_0x2bec40===0x1f4){_0x5958ec[_0xd4c4('0xd')](_0x2bec40)['send'](_0x269fe0);}else{_0x5958ec[_0xd4c4('0xd')](_0x2bec40)['json'](_0x269fe0);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index bfc0a96..1aeb855 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 _0x03ef=['remove','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x43de4e,_0x188f27){var _0x5f1974=function(_0xcd1e93){while(--_0xcd1e93){_0x43de4e['push'](_0x43de4e['shift']());}};_0x5f1974(++_0x188f27);}(_0x03ef,0x162));var _0xf03e=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x03ef[_0x51c819];return _0x15c5d2;};'use strict';var EventEmitter=require(_0xf03e('0x0'));var VoiceExtension=require(_0xf03e('0x1'))['db'][_0xf03e('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf03e('0x3')](0x0);var events={'afterCreate':_0xf03e('0x4'),'afterUpdate':_0xf03e('0x5'),'afterDestroy':_0xf03e('0x6')};function emitEvent(_0x38cb7a){return function(_0x5f5759,_0x5062a2,_0x2c524a){VoiceExtensionEvents['emit'](_0x38cb7a+':'+_0x5f5759['id'],_0x5f5759);VoiceExtensionEvents['emit'](_0x38cb7a,_0x5f5759);_0x2c524a(null);};}for(var e in events){if(events[_0xf03e('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xf03e('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xd422=['update','emit','hook','exports','events','VoiceExtension','setMaxListeners','save'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xd422,0xdc));var _0x2d42=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xd422[_0x1cb18a];return _0x22442e;};'use strict';var EventEmitter=require(_0x2d42('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x2d42('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2d42('0x2')](0x0);var events={'afterCreate':_0x2d42('0x3'),'afterUpdate':_0x2d42('0x4'),'afterDestroy':'remove'};function emitEvent(_0x7d5fac){return function(_0x2ce9ae,_0x3e0fcc,_0x12373f){VoiceExtensionEvents[_0x2d42('0x5')](_0x7d5fac+':'+_0x2ce9ae['id'],_0x2ce9ae);VoiceExtensionEvents['emit'](_0x7d5fac,_0x2ce9ae);_0x12373f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x2d42('0x6')](e,emitEvent(event));}}module[_0x2d42('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 841e038..a2705d1 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 _0x8147=['trunk','timeout','options','url','length','name','param','phone','split','prefix','${EXTEN:','${EXTEN}','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','intervals','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','models','Set','CDR(type)=','exten','type','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','context','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav'];(function(_0x5e639c,_0x589433){var _0x4f50ec=function(_0x306959){while(--_0x306959){_0x5e639c['push'](_0x5e639c['shift']());}};_0x4f50ec(++_0x589433);}(_0x8147,0x179));var _0x7814=function(_0x43bfa5,_0x2be933){_0x43bfa5=_0x43bfa5-0x0;var _0x1ec4ee=_0x8147[_0x43bfa5];return _0x1ec4ee;};'use strict';var _=require(_0x7814('0x0'));var attributes=require(_0x7814('0x1'));module['exports']=function(_0x51ce31){var _0x9f411d=_0x51ce31[_0x7814('0x2')];function _0x49026e(_0x319076){var _0x43c2c9=0x2;var _0x4b094d=[{'type':_0x319076['type'],'app':_0x7814('0x3'),'appdata':_0x7814('0x4')+_0x319076['type'],'context':_0x319076['context'],'exten':_0x319076[_0x7814('0x5')],'priority':_0x43c2c9++,'VoiceExtensionId':_0x319076['id']},{'type':_0x319076[_0x7814('0x6')],'app':_0x319076[_0x7814('0x7')]?'Set':_0x7814('0x8'),'appdata':_0x319076['alias']?_0x7814('0x9')+_0x319076[_0x7814('0x7')]:_0x7814('0xa'),'context':_0x319076['context'],'exten':_0x319076[_0x7814('0x5')],'priority':_0x43c2c9++,'VoiceExtensionId':_0x319076['id']}];if(_0x319076['type']===_0x7814('0xb')){_0x4b094d[_0x7814('0xc')]({'type':'inbound','app':_0x7814('0x3'),'appdata':_0x7814('0xd')+_0x319076['id'],'context':_0x319076[_0x7814('0xe')],'exten':_0x319076[_0x7814('0x5')],'priority':_0x43c2c9++,'VoiceExtensionId':_0x319076['id']});}_0x4b094d['push']({'type':_0x319076[_0x7814('0x6')],'app':_0x7814('0x3'),'appdata':_0x7814('0xf'),'context':_0x319076[_0x7814('0xe')],'exten':_0x319076[_0x7814('0x5')],'priority':_0x43c2c9++,'VoiceExtensionId':_0x319076['id']},{'type':_0x319076[_0x7814('0x6')],'app':'Set','appdata':_0x7814('0x10'),'context':_0x319076[_0x7814('0xe')],'exten':_0x319076[_0x7814('0x5')],'priority':_0x43c2c9++,'VoiceExtensionId':_0x319076['id']},{'type':_0x319076['type'],'app':_0x7814('0x3'),'appdata':_0x7814('0x11'),'context':_0x319076[_0x7814('0xe')],'exten':_0x319076[_0x7814('0x5')],'priority':_0x43c2c9++,'VoiceExtensionId':_0x319076['id']});return _0x4b094d;}function _0x28451f(_0x5366ae){var _0x586317=0x2;var _0x3c89b5=[{'type':'outbound','app':_0x7814('0x3'),'appdata':_0x7814('0x12'),'context':_0x5366ae[_0x7814('0xe')],'exten':_0x5366ae[_0x7814('0x5')],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']},{'type':_0x7814('0x13'),'app':_0x5366ae[_0x7814('0x7')]?_0x7814('0x3'):_0x7814('0x8'),'appdata':_0x5366ae[_0x7814('0x7')]?_0x7814('0x9')+_0x5366ae[_0x7814('0x7')]:_0x7814('0xa'),'context':_0x5366ae['context'],'exten':_0x5366ae[_0x7814('0x5')],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']},{'type':_0x7814('0x13'),'app':'Set','appdata':_0x7814('0x14')+(_0x5366ae[_0x7814('0x15')]?'${EXTEN:'+_0x5366ae['cutdigits']+'}':'${EXTEN}'),'context':_0x5366ae[_0x7814('0xe')],'exten':_0x5366ae[_0x7814('0x5')],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']},{'type':_0x7814('0x13'),'app':_0x7814('0x3'),'appdata':_0x7814('0xd')+_0x5366ae['id'],'context':_0x5366ae[_0x7814('0xe')],'exten':_0x5366ae[_0x7814('0x5')],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']},{'type':_0x7814('0x13'),'app':'ExecIf','appdata':_0x7814('0x16')+(_0x586317+0x2)+'):Goto('+(_0x586317+0x1)+')','context':_0x5366ae[_0x7814('0xe')],'exten':_0x5366ae[_0x7814('0x5')],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']},{'type':_0x7814('0x13'),'app':_0x7814('0x3'),'appdata':_0x5366ae[_0x7814('0x15')]?_0x7814('0x17')+_0x5366ae[_0x7814('0x15')]+'}':'CDR(prefix)=noprefix','context':_0x5366ae[_0x7814('0xe')],'exten':_0x5366ae['exten'],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']},{'type':'outbound','app':_0x7814('0x3'),'appdata':_0x7814('0xf'),'context':_0x5366ae[_0x7814('0xe')],'exten':_0x5366ae['exten'],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']},{'type':_0x7814('0x13'),'app':_0x7814('0x3'),'appdata':_0x7814('0x10'),'context':_0x5366ae['context'],'exten':_0x5366ae[_0x7814('0x5')],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']},{'type':'outbound','app':'Set','appdata':_0x7814('0x11'),'context':_0x5366ae[_0x7814('0xe')],'exten':_0x5366ae[_0x7814('0x5')],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']},{'type':_0x7814('0x13'),'app':_0x7814('0x3'),'appdata':'outboundrouteid='+_0x5366ae['id'],'context':_0x5366ae[_0x7814('0xe')],'exten':_0x5366ae[_0x7814('0x5')],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']}];if(_0x5366ae['hasOwnProperty'](_0x7814('0x18'))&&_0x5366ae[_0x7814('0x18')]!==_0x7814('0x19')){_0x3c89b5['push']({'type':'outbound','app':_0x7814('0x3'),'appdata':_0x7814('0x1a'),'context':_0x5366ae[_0x7814('0xe')],'exten':_0x5366ae[_0x7814('0x5')],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']},{'type':_0x7814('0x13'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5366ae['recordingFormat']||_0x7814('0x1b'),'context':_0x5366ae[_0x7814('0xe')],'exten':_0x5366ae[_0x7814('0x5')],'priority':_0x586317++,'VoiceExtensionId':_0x5366ae['id']});}return _0x3c89b5;}function _0x440502(_0x4072dd,_0x4c0b74){var _0x6d3632=[{'name':_0x7814('0x1c'),'param':0x0},{'name':_0x7814('0x1d'),'param':0x1},{'name':_0x7814('0x1e'),'param':0x2},{'name':_0x7814('0x1f'),'param':0x3}];var _0x4a12a5={};var _0x1ddb12=_0x4c0b74['split'](',');var _0xb2ac02=[];for(var _0x3c54fb=0x0;_0x3c54fb<_0x6d3632[_0x7814('0x20')];_0x3c54fb++){switch(_0x6d3632[_0x3c54fb][_0x7814('0x21')]){case _0x7814('0x1c'):_0x4a12a5['trunk']=_0x1ddb12[_0x6d3632[_0x3c54fb][_0x7814('0x22')]]['split']('/')[0x1];_0x4a12a5[_0x7814('0x23')]=_0x1ddb12[_0x6d3632[_0x3c54fb][_0x7814('0x22')]][_0x7814('0x24')]('/')[0x2];_0x4a12a5[_0x7814('0x25')]=_0x4a12a5[_0x7814('0x23')]?_0x4a12a5[_0x7814('0x23')][_0x7814('0x24')]('$')[0x0]:undefined;_0x4a12a5[_0x7814('0x23')]=_0x4072dd[_0x7814('0x15')]?(_0x4a12a5[_0x7814('0x25')]||'')+_0x7814('0x26')+_0x4072dd[_0x7814('0x15')]+'}':(_0x4a12a5['prefix']||'')+_0x7814('0x27');_0xb2ac02[_0x6d3632[_0x3c54fb][_0x7814('0x22')]]=[_0x7814('0x28'),_0x4a12a5[_0x7814('0x1c')],_0x4a12a5['phone']][_0x7814('0x29')]('/');break;case _0x7814('0x1e'):_0x4a12a5['options']=_0x1ddb12[_0x6d3632[_0x3c54fb][_0x7814('0x22')]];if(_0x4072dd[_0x7814('0x18')]!==_0x7814('0x19')){if(_0x4a12a5[_0x7814('0x1e')][_0x7814('0x2a')](_0x7814('0x2b'))<0x0){_0x4a12a5[_0x7814('0x1e')]+=_0x7814('0x2b');}}else{_0x4a12a5[_0x7814('0x1e')]=_0x4a12a5[_0x7814('0x1e')][_0x7814('0x2c')](_0x7814('0x2b'),'');}_0xb2ac02[_0x6d3632[_0x3c54fb]['param']]=_0x4a12a5[_0x7814('0x1e')];break;default:_0xb2ac02[_0x6d3632[_0x3c54fb]['param']]=_0x1ddb12[_0x6d3632[_0x3c54fb][_0x7814('0x22')]];}}return _0xb2ac02[_0x7814('0x29')](',');}function _0x590452(_0x349ab0,_0x3ff49c,_0x2d2f7){return new Promise(function(_0x5e4e99,_0x420545){var _0x3acccd=[];if(_[_0x7814('0x2d')](_0x3ff49c))return _0x5e4e99(_0x3acccd);_0x9f411d[_0x7814('0x2e')][_0x7814('0x2f')]({'attributes':['id',_0x7814('0x30'),_0x7814('0x31')],'raw':!![]})[_0x7814('0x32')](function(_0x58382e){for(var _0x1161ba=0x0,_0x40646e=0x0;_0x1161ba<_0x3ff49c['length'];_0x1161ba++,_0x40646e=0x0){var _0x52385d=_0x3ff49c[_0x1161ba];var _0x4d6c72=[];var _0x364b2f=[];delete _0x52385d['id'];if(_0x52385d[_0x7814('0x30')]!=='*,*,*,*'){_0x52385d[_0x7814('0x33')]=[_0x52385d[_0x7814('0x30')]];}else{_0x52385d[_0x7814('0x33')]=_0x52385d['IntervalId']?_['map'](_[_0x7814('0x34')](_0x58382e,{'IntervalId':_0x52385d['IntervalId']}),_0x7814('0x30')):[];}_0x52385d['context']=_0x349ab0['context'];_0x52385d[_0x7814('0x5')]=_0x349ab0[_0x7814('0x5')];if(_0x52385d[_0x7814('0x6')])_0x52385d[_0x7814('0x6')]=_0x52385d[_0x7814('0x6')][_0x7814('0x35')]();if(_0x349ab0[_0x7814('0x6')]===_0x7814('0x13')){if(_0x52385d[_0x7814('0x36')](_0x7814('0x37'))&&_0x52385d[_0x7814('0x37')]&&_0x52385d[_0x7814('0x37')]!=='--'){_0x4d6c72[_0x7814('0xc')]({'type':_0x52385d[_0x7814('0x6')][_0x7814('0x35')](),'app':_0x7814('0x3'),'appdata':_0x7814('0x38')+_0x52385d[_0x7814('0x37')],'context':_0x349ab0[_0x7814('0xe')],'exten':_0x349ab0[_0x7814('0x5')],'priority':_0x52385d['intervals']['length']+_0x2d2f7+_0x40646e++,'VoiceExtensionId':_0x349ab0['id']});}_0x4d6c72[_0x7814('0xc')]({'type':_0x52385d[_0x7814('0x6')][_0x7814('0x35')](),'app':_0x7814('0x39'),'appdata':_0x7814('0x3a')+(_0x52385d[_0x7814('0x3b')]?_0x7814('0x3c')+_0x52385d['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x349ab0[_0x7814('0xe')],'exten':_0x349ab0[_0x7814('0x5')],'priority':_0x52385d['intervals'][_0x7814('0x20')]+_0x2d2f7+_0x40646e++,'VoiceExtensionId':_0x349ab0['id']});}else{if(_0x52385d[_0x7814('0x36')](_0x7814('0x3d'))){if([_0x7814('0x3e'),_0x7814('0x3f')][_0x7814('0x40')](_0x52385d[_0x7814('0x41')]['toLowerCase']())&&_0x52385d[_0x7814('0x42')]!==_0x7814('0x43')){if(_0x52385d['answer']){_0x4d6c72['push']({'type':_0x52385d[_0x7814('0x6')][_0x7814('0x35')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x349ab0[_0x7814('0xe')],'exten':_0x349ab0[_0x7814('0x5')],'priority':_0x52385d[_0x7814('0x33')][_0x7814('0x20')]+_0x2d2f7+_0x40646e++,'VoiceExtensionId':_0x349ab0['id']});_0x4d6c72['push']({'type':_0x52385d[_0x7814('0x6')]['toLowerCase'](),'app':_0x7814('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x349ab0[_0x7814('0xe')],'exten':_0x349ab0[_0x7814('0x5')],'priority':_0x52385d['intervals'][_0x7814('0x20')]+_0x2d2f7+_0x40646e++,'VoiceExtensionId':_0x349ab0['id']});}else{_0x4d6c72['push']({'type':_0x52385d[_0x7814('0x6')][_0x7814('0x35')](),'app':'ExecIf','appdata':_0x7814('0x44'),'context':_0x349ab0[_0x7814('0xe')],'exten':_0x349ab0[_0x7814('0x5')],'priority':_0x52385d[_0x7814('0x33')][_0x7814('0x20')]+_0x2d2f7+_0x40646e++,'VoiceExtensionId':_0x349ab0['id']});_0x4d6c72[_0x7814('0xc')]({'type':_0x52385d[_0x7814('0x6')]['toLowerCase'](),'app':_0x7814('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x349ab0[_0x7814('0xe')],'exten':_0x349ab0['exten'],'priority':_0x52385d[_0x7814('0x33')][_0x7814('0x20')]+_0x2d2f7+_0x40646e++,'VoiceExtensionId':_0x349ab0['id']});}}}}for(var _0x2649ce=0x0;_0x2649ce<_0x52385d[_0x7814('0x33')]['length'];_0x2649ce++){var _0x2f6872=_0x2d2f7+_0x52385d['intervals'][_0x7814('0x20')];var _0x5e6586=_0x2649ce===_0x52385d[_0x7814('0x33')][_0x7814('0x20')]-0x1?_0x2d2f7+_0x4d6c72[_0x7814('0x20')]+_0x364b2f['length']+0x2:_0x2d2f7+_0x2649ce+0x1;_0x4d6c72[_0x7814('0x45')](_0x2649ce,0x0,{'type':_0x349ab0[_0x7814('0x6')],'app':_0x7814('0x46'),'appdata':_0x52385d[_0x7814('0x33')][_0x2649ce]+'?'+_0x349ab0[_0x7814('0xe')]+_0x7814('0x47')+_0x2f6872+':'+_0x349ab0[_0x7814('0xe')]+_0x7814('0x47')+_0x5e6586,'exten':_0x349ab0['exten'],'context':_0x349ab0[_0x7814('0xe')],'priority':_0x2d2f7+_0x2649ce,'VoiceExtensionId':_0x349ab0['id']});}if(_0x52385d['appType']==='outboundDial')_0x52385d['appdata']=_0x440502(_0x349ab0,_0x52385d['appdata']);_0x52385d[_0x7814('0x48')]=_0x4d6c72[_0x7814('0x20')]?_[_0x7814('0x49')](_0x4d6c72)[_0x7814('0x48')]+0x1:_0x2d2f7;_0x3acccd=_[_0x7814('0x4a')](_0x3acccd,_0x4d6c72,[_0x52385d],_0x364b2f);_0x2d2f7=_['last'](_0x3acccd)[_0x7814('0x48')]+0x1;}return _0x5e4e99(_0x3acccd);})[_0x7814('0x4b')](function(_0x43b7dc){_0x420545(_0x43b7dc);});});}return _0x51ce31[_0x7814('0x4c')](_0x7814('0x4d'),attributes,{'tableName':_0x7814('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3d24ba){var _0x4c3ff2=this[_0x7814('0x4f')]({'plain':!![]});var _0x32c2b2=_0x4c3ff2[_0x7814('0x6')]===_0x7814('0x13')?_0x28451f(_0x4c3ff2):_0x49026e(_0x4c3ff2);return _0x590452(_0x4c3ff2,_0x3d24ba,_[_0x7814('0x49')](_0x32c2b2)[_0x7814('0x48')]+0x1)[_0x7814('0x32')](function(_0x1de3ca){var _0x12fdb3=_[_0x7814('0x4a')](_0x32c2b2,_0x1de3ca);_0x12fdb3[_0x7814('0xc')]({'type':_0x4c3ff2[_0x7814('0x6')],'app':_0x7814('0x50'),'exten':_0x4c3ff2[_0x7814('0x5')],'context':_0x4c3ff2[_0x7814('0xe')],'priority':_[_0x7814('0x49')](_0x12fdb3)['priority']+0x1,'VoiceExtensionId':_0x4c3ff2['id']});return _0x12fdb3;});}}});}; \ No newline at end of file +var _0x291c=['CDR(routeAlias)=','No\x20alias\x20set','context','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','CDR(type)=outbound','outbound','NoOp','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','hasOwnProperty','recordingFormat','none','push','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','name','split','prefix','phone','param','join','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','define','voice_extensions','get','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','exten','alias','Set'];(function(_0x28665e,_0x7db8be){var _0x56fd3e=function(_0x5d8f42){while(--_0x5d8f42){_0x28665e['push'](_0x28665e['shift']());}};_0x56fd3e(++_0x7db8be);}(_0x291c,0x137));var _0xc291=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x291c[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xc291('0x0'));var attributes=require(_0xc291('0x1'));module[_0xc291('0x2')]=function(_0x180bc4){var _0xfdfc37=_0x180bc4[_0xc291('0x3')];function _0xc32916(_0x7b34d6){var _0xafdfee=0x2;var _0x118ddf=[{'type':_0x7b34d6[_0xc291('0x4')],'app':'Set','appdata':_0xc291('0x5')+_0x7b34d6['type'],'context':_0x7b34d6['context'],'exten':_0x7b34d6[_0xc291('0x6')],'priority':_0xafdfee++,'VoiceExtensionId':_0x7b34d6['id']},{'type':_0x7b34d6[_0xc291('0x4')],'app':_0x7b34d6[_0xc291('0x7')]?_0xc291('0x8'):'NoOp','appdata':_0x7b34d6[_0xc291('0x7')]?_0xc291('0x9')+_0x7b34d6[_0xc291('0x7')]:_0xc291('0xa'),'context':_0x7b34d6[_0xc291('0xb')],'exten':_0x7b34d6[_0xc291('0x6')],'priority':_0xafdfee++,'VoiceExtensionId':_0x7b34d6['id']}];if(_0x7b34d6[_0xc291('0x4')]===_0xc291('0xc')){_0x118ddf['push']({'type':'inbound','app':'Set','appdata':_0xc291('0xd')+_0x7b34d6['id'],'context':_0x7b34d6[_0xc291('0xb')],'exten':_0x7b34d6[_0xc291('0x6')],'priority':_0xafdfee++,'VoiceExtensionId':_0x7b34d6['id']});}_0x118ddf['push']({'type':_0x7b34d6[_0xc291('0x4')],'app':'Set','appdata':_0xc291('0xe'),'context':_0x7b34d6[_0xc291('0xb')],'exten':_0x7b34d6[_0xc291('0x6')],'priority':_0xafdfee++,'VoiceExtensionId':_0x7b34d6['id']},{'type':_0x7b34d6[_0xc291('0x4')],'app':_0xc291('0x8'),'appdata':_0xc291('0xf'),'context':_0x7b34d6[_0xc291('0xb')],'exten':_0x7b34d6[_0xc291('0x6')],'priority':_0xafdfee++,'VoiceExtensionId':_0x7b34d6['id']},{'type':_0x7b34d6[_0xc291('0x4')],'app':_0xc291('0x8'),'appdata':'MONITOR_OPTIONS=ab','context':_0x7b34d6[_0xc291('0xb')],'exten':_0x7b34d6[_0xc291('0x6')],'priority':_0xafdfee++,'VoiceExtensionId':_0x7b34d6['id']});return _0x118ddf;}function _0x5888de(_0x28259b){var _0x54105c=0x2;var _0x4c8947=[{'type':'outbound','app':_0xc291('0x8'),'appdata':_0xc291('0x10'),'context':_0x28259b[_0xc291('0xb')],'exten':_0x28259b[_0xc291('0x6')],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']},{'type':_0xc291('0x11'),'app':_0x28259b[_0xc291('0x7')]?_0xc291('0x8'):_0xc291('0x12'),'appdata':_0x28259b[_0xc291('0x7')]?_0xc291('0x9')+_0x28259b['alias']:_0xc291('0xa'),'context':_0x28259b[_0xc291('0xb')],'exten':_0x28259b[_0xc291('0x6')],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']},{'type':'outbound','app':_0xc291('0x8'),'appdata':'CDR(destination)='+(_0x28259b[_0xc291('0x13')]?_0xc291('0x14')+_0x28259b['cutdigits']+'}':'${EXTEN}'),'context':_0x28259b[_0xc291('0xb')],'exten':_0x28259b[_0xc291('0x6')],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']},{'type':_0xc291('0x11'),'app':'Set','appdata':_0xc291('0xd')+_0x28259b['id'],'context':_0x28259b['context'],'exten':_0x28259b[_0xc291('0x6')],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']},{'type':_0xc291('0x11'),'app':_0xc291('0x15'),'appdata':_0xc291('0x16')+(_0x54105c+0x2)+_0xc291('0x17')+(_0x54105c+0x1)+')','context':_0x28259b[_0xc291('0xb')],'exten':_0x28259b[_0xc291('0x6')],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']},{'type':_0xc291('0x11'),'app':'Set','appdata':_0x28259b[_0xc291('0x13')]?_0xc291('0x18')+_0x28259b[_0xc291('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x28259b[_0xc291('0xb')],'exten':_0x28259b[_0xc291('0x6')],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']},{'type':_0xc291('0x11'),'app':_0xc291('0x8'),'appdata':_0xc291('0xe'),'context':_0x28259b['context'],'exten':_0x28259b[_0xc291('0x6')],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']},{'type':_0xc291('0x11'),'app':_0xc291('0x8'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x28259b[_0xc291('0xb')],'exten':_0x28259b[_0xc291('0x6')],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']},{'type':_0xc291('0x11'),'app':_0xc291('0x8'),'appdata':'MONITOR_OPTIONS=ab','context':_0x28259b['context'],'exten':_0x28259b['exten'],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']},{'type':_0xc291('0x11'),'app':'Set','appdata':'outboundrouteid='+_0x28259b['id'],'context':_0x28259b[_0xc291('0xb')],'exten':_0x28259b[_0xc291('0x6')],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']}];if(_0x28259b[_0xc291('0x19')](_0xc291('0x1a'))&&_0x28259b[_0xc291('0x1a')]!==_0xc291('0x1b')){_0x4c8947[_0xc291('0x1c')]({'type':_0xc291('0x11'),'app':_0xc291('0x8'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x28259b[_0xc291('0xb')],'exten':_0x28259b['exten'],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']},{'type':_0xc291('0x11'),'app':_0xc291('0x8'),'appdata':_0xc291('0x1d')+_0x28259b['recordingFormat']||_0xc291('0x1e'),'context':_0x28259b[_0xc291('0xb')],'exten':_0x28259b['exten'],'priority':_0x54105c++,'VoiceExtensionId':_0x28259b['id']});}return _0x4c8947;}function _0x446583(_0x7b83f6,_0x4abf51){var _0x8b1cb=[{'name':_0xc291('0x1f'),'param':0x0},{'name':_0xc291('0x20'),'param':0x1},{'name':_0xc291('0x21'),'param':0x2},{'name':_0xc291('0x22'),'param':0x3}];var _0x31961d={};var _0x2a46f9=_0x4abf51['split'](',');var _0x2e0cd7=[];for(var _0x2e71d6=0x0;_0x2e71d6<_0x8b1cb[_0xc291('0x23')];_0x2e71d6++){switch(_0x8b1cb[_0x2e71d6][_0xc291('0x24')]){case _0xc291('0x1f'):_0x31961d[_0xc291('0x1f')]=_0x2a46f9[_0x8b1cb[_0x2e71d6]['param']][_0xc291('0x25')]('/')[0x1];_0x31961d['phone']=_0x2a46f9[_0x8b1cb[_0x2e71d6]['param']][_0xc291('0x25')]('/')[0x2];_0x31961d[_0xc291('0x26')]=_0x31961d[_0xc291('0x27')]?_0x31961d[_0xc291('0x27')]['split']('$')[0x0]:undefined;_0x31961d['phone']=_0x7b83f6[_0xc291('0x13')]?(_0x31961d['prefix']||'')+'${EXTEN:'+_0x7b83f6[_0xc291('0x13')]+'}':(_0x31961d[_0xc291('0x26')]||'')+'${EXTEN}';_0x2e0cd7[_0x8b1cb[_0x2e71d6][_0xc291('0x28')]]=['SIP',_0x31961d[_0xc291('0x1f')],_0x31961d[_0xc291('0x27')]][_0xc291('0x29')]('/');break;case _0xc291('0x21'):_0x31961d[_0xc291('0x21')]=_0x2a46f9[_0x8b1cb[_0x2e71d6][_0xc291('0x28')]];if(_0x7b83f6['recordingFormat']!==_0xc291('0x1b')){if(_0x31961d[_0xc291('0x21')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x31961d[_0xc291('0x21')]+=_0xc291('0x2a');}}else{_0x31961d[_0xc291('0x21')]=_0x31961d['options'][_0xc291('0x2b')](_0xc291('0x2a'),'');}_0x2e0cd7[_0x8b1cb[_0x2e71d6]['param']]=_0x31961d[_0xc291('0x21')];break;default:_0x2e0cd7[_0x8b1cb[_0x2e71d6]['param']]=_0x2a46f9[_0x8b1cb[_0x2e71d6][_0xc291('0x28')]];}}return _0x2e0cd7[_0xc291('0x29')](',');}function _0x5c8ec6(_0x2b64d4,_0x13607f,_0x20e4f5){return new Promise(function(_0x2492e5,_0x1719ab){var _0x2606c5=[];if(_['isEmpty'](_0x13607f))return _0x2492e5(_0x2606c5);_0xfdfc37[_0xc291('0x2c')][_0xc291('0x2d')]({'attributes':['id',_0xc291('0x2e'),_0xc291('0x2f')],'raw':!![]})[_0xc291('0x30')](function(_0x4efd8d){for(var _0x5f0e83=0x0,_0x3ae451=0x0;_0x5f0e83<_0x13607f['length'];_0x5f0e83++,_0x3ae451=0x0){var _0x49d28e=_0x13607f[_0x5f0e83];var _0x30c879=[];var _0xabe044=[];delete _0x49d28e['id'];if(_0x49d28e[_0xc291('0x2e')]!==_0xc291('0x31')){_0x49d28e[_0xc291('0x32')]=[_0x49d28e[_0xc291('0x2e')]];}else{_0x49d28e[_0xc291('0x32')]=_0x49d28e[_0xc291('0x2f')]?_[_0xc291('0x33')](_[_0xc291('0x34')](_0x4efd8d,{'IntervalId':_0x49d28e['IntervalId']}),_0xc291('0x2e')):[];}_0x49d28e['context']=_0x2b64d4[_0xc291('0xb')];_0x49d28e[_0xc291('0x6')]=_0x2b64d4[_0xc291('0x6')];if(_0x49d28e[_0xc291('0x4')])_0x49d28e[_0xc291('0x4')]=_0x49d28e[_0xc291('0x4')]['toLowerCase']();if(_0x2b64d4[_0xc291('0x4')]===_0xc291('0x11')){if(_0x49d28e[_0xc291('0x19')](_0xc291('0x35'))&&_0x49d28e[_0xc291('0x35')]&&_0x49d28e['tag']!=='--'){_0x30c879[_0xc291('0x1c')]({'type':_0x49d28e['type']['toLowerCase'](),'app':'Set','appdata':_0xc291('0x36')+_0x49d28e[_0xc291('0x35')],'context':_0x2b64d4[_0xc291('0xb')],'exten':_0x2b64d4[_0xc291('0x6')],'priority':_0x49d28e['intervals'][_0xc291('0x23')]+_0x20e4f5+_0x3ae451++,'VoiceExtensionId':_0x2b64d4['id']});}_0x30c879[_0xc291('0x1c')]({'type':_0x49d28e['type'][_0xc291('0x37')](),'app':'ExecIf','appdata':_0xc291('0x38')+(_0x49d28e['callerID']?_0xc291('0x39')+_0x49d28e[_0xc291('0x3a')]+')':_0xc291('0x3b')),'context':_0x2b64d4[_0xc291('0xb')],'exten':_0x2b64d4['exten'],'priority':_0x49d28e[_0xc291('0x32')][_0xc291('0x23')]+_0x20e4f5+_0x3ae451++,'VoiceExtensionId':_0x2b64d4['id']});}else{if(_0x49d28e[_0xc291('0x19')](_0xc291('0x3c'))){if([_0xc291('0x3d'),_0xc291('0x3e')][_0xc291('0x3f')](_0x49d28e[_0xc291('0x40')][_0xc291('0x37')]())&&_0x49d28e[_0xc291('0x41')]!==_0xc291('0x42')){if(_0x49d28e[_0xc291('0x3c')]){_0x30c879[_0xc291('0x1c')]({'type':_0x49d28e[_0xc291('0x4')][_0xc291('0x37')](),'app':_0xc291('0x15'),'appdata':_0xc291('0x43'),'context':_0x2b64d4[_0xc291('0xb')],'exten':_0x2b64d4[_0xc291('0x6')],'priority':_0x49d28e[_0xc291('0x32')][_0xc291('0x23')]+_0x20e4f5+_0x3ae451++,'VoiceExtensionId':_0x2b64d4['id']});_0x30c879['push']({'type':_0x49d28e[_0xc291('0x4')][_0xc291('0x37')](),'app':_0xc291('0x8'),'appdata':_0xc291('0x44'),'context':_0x2b64d4[_0xc291('0xb')],'exten':_0x2b64d4[_0xc291('0x6')],'priority':_0x49d28e['intervals'][_0xc291('0x23')]+_0x20e4f5+_0x3ae451++,'VoiceExtensionId':_0x2b64d4['id']});}else{_0x30c879['push']({'type':_0x49d28e['type'][_0xc291('0x37')](),'app':_0xc291('0x15'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2b64d4[_0xc291('0xb')],'exten':_0x2b64d4[_0xc291('0x6')],'priority':_0x49d28e[_0xc291('0x32')][_0xc291('0x23')]+_0x20e4f5+_0x3ae451++,'VoiceExtensionId':_0x2b64d4['id']});_0x30c879[_0xc291('0x1c')]({'type':_0x49d28e[_0xc291('0x4')][_0xc291('0x37')](),'app':_0xc291('0x8'),'appdata':_0xc291('0x45'),'context':_0x2b64d4[_0xc291('0xb')],'exten':_0x2b64d4[_0xc291('0x6')],'priority':_0x49d28e[_0xc291('0x32')][_0xc291('0x23')]+_0x20e4f5+_0x3ae451++,'VoiceExtensionId':_0x2b64d4['id']});}}}}for(var _0x41c487=0x0;_0x41c487<_0x49d28e[_0xc291('0x32')][_0xc291('0x23')];_0x41c487++){var _0xae7f7a=_0x20e4f5+_0x49d28e['intervals']['length'];var _0x1da2d9=_0x41c487===_0x49d28e[_0xc291('0x32')]['length']-0x1?_0x20e4f5+_0x30c879[_0xc291('0x23')]+_0xabe044[_0xc291('0x23')]+0x2:_0x20e4f5+_0x41c487+0x1;_0x30c879['splice'](_0x41c487,0x0,{'type':_0x2b64d4[_0xc291('0x4')],'app':_0xc291('0x46'),'appdata':_0x49d28e[_0xc291('0x32')][_0x41c487]+'?'+_0x2b64d4[_0xc291('0xb')]+',${EXTEN},'+_0xae7f7a+':'+_0x2b64d4[_0xc291('0xb')]+_0xc291('0x47')+_0x1da2d9,'exten':_0x2b64d4[_0xc291('0x6')],'context':_0x2b64d4['context'],'priority':_0x20e4f5+_0x41c487,'VoiceExtensionId':_0x2b64d4['id']});}if(_0x49d28e[_0xc291('0x41')]===_0xc291('0x48'))_0x49d28e[_0xc291('0x49')]=_0x446583(_0x2b64d4,_0x49d28e['appdata']);_0x49d28e[_0xc291('0x4a')]=_0x30c879[_0xc291('0x23')]?_[_0xc291('0x4b')](_0x30c879)[_0xc291('0x4a')]+0x1:_0x20e4f5;_0x2606c5=_[_0xc291('0x4c')](_0x2606c5,_0x30c879,[_0x49d28e],_0xabe044);_0x20e4f5=_['last'](_0x2606c5)['priority']+0x1;}return _0x2492e5(_0x2606c5);})['catch'](function(_0x3515bd){_0x1719ab(_0x3515bd);});});}return _0x180bc4[_0xc291('0x4d')]('VoiceExtension',attributes,{'tableName':_0xc291('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x18e171){var _0x4c2307=this[_0xc291('0x4f')]({'plain':!![]});var _0x5ccd66=_0x4c2307[_0xc291('0x4')]==='outbound'?_0x5888de(_0x4c2307):_0xc32916(_0x4c2307);return _0x5c8ec6(_0x4c2307,_0x18e171,_[_0xc291('0x4b')](_0x5ccd66)[_0xc291('0x4a')]+0x1)['then'](function(_0xa03790){var _0x25b928=_[_0xc291('0x4c')](_0x5ccd66,_0xa03790);_0x25b928[_0xc291('0x1c')]({'type':_0x4c2307['type'],'app':'Hangup','exten':_0x4c2307['exten'],'context':_0x4c2307[_0xc291('0xb')],'priority':_['last'](_0x25b928)['priority']+0x1,'VoiceExtensionId':_0x4c2307['id']});return _0x25b928;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2cbb2d5..c40b071 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 _0x9b69=['socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetVoiceExtension','options','raw','where','attributes','limit','include','map','model','debug','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost'];(function(_0xf94422,_0x358996){var _0x4bbfcd=function(_0x380138){while(--_0x380138){_0xf94422['push'](_0xf94422['shift']());}};_0x4bbfcd(++_0x358996);}(_0x9b69,0xa3));var _0x99b6=function(_0x1a44fe,_0x4d3e22){_0x1a44fe=_0x1a44fe-0x0;var _0x40ccf4=_0x9b69[_0x1a44fe];return _0x40ccf4;};'use strict';var _=require(_0x99b6('0x0'));var util=require(_0x99b6('0x1'));var moment=require(_0x99b6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99b6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x99b6('0x4'));var logger=require(_0x99b6('0x5'))(_0x99b6('0x6'));var config=require('../../config/environment');var jayson=require(_0x99b6('0x7'));var client=jayson['client'][_0x99b6('0x8')]({'port':0x232a});config[_0x99b6('0x9')]=_[_0x99b6('0xa')](config[_0x99b6('0x9')],{'host':_0x99b6('0xb'),'port':0x18eb});var socket=require(_0x99b6('0xc'))(new Redis(config[_0x99b6('0x9')]));require(_0x99b6('0xd'))[_0x99b6('0xe')](socket);function respondWithRpcPromise(_0x400c81,_0x3081f5,_0x3f2d8e){return new BPromise(function(_0x3af521,_0x6b24b1){return client[_0x99b6('0xf')](_0x400c81,_0x3f2d8e)[_0x99b6('0x10')](function(_0x409539){logger[_0x99b6('0x11')](_0x99b6('0x12'),_0x3081f5,_0x99b6('0x13'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x3081f5,'request\x20sent',JSON['stringify'](_0x409539));if(_0x409539['error']){if(_0x409539['error']['code']===0x1f4){logger[_0x99b6('0x14')](_0x99b6('0x12'),_0x3081f5,_0x409539[_0x99b6('0x14')]['message']);return _0x6b24b1(_0x409539[_0x99b6('0x14')][_0x99b6('0x15')]);}logger[_0x99b6('0x14')](_0x99b6('0x12'),_0x3081f5,_0x409539['error'][_0x99b6('0x15')]);return _0x3af521(_0x409539[_0x99b6('0x14')][_0x99b6('0x15')]);}else{logger[_0x99b6('0x11')](_0x99b6('0x12'),_0x3081f5,_0x99b6('0x13'));_0x3af521(_0x409539[_0x99b6('0x16')][_0x99b6('0x15')]);}})[_0x99b6('0x17')](function(_0x547488){logger[_0x99b6('0x14')](_0x99b6('0x12'),_0x3081f5,_0x547488);_0x6b24b1(_0x547488);});});}exports[_0x99b6('0x18')]=function(_0x2036bb){var _0x34476d=this;return new Promise(function(_0xc65470,_0x35b47a){return db['VoiceExtension']['findAll']({'raw':_0x2036bb[_0x99b6('0x19')]?_0x2036bb[_0x99b6('0x19')][_0x99b6('0x1a')]===undefined?!![]:![]:!![],'where':_0x2036bb[_0x99b6('0x19')]?_0x2036bb['options'][_0x99b6('0x1b')]||null:null,'attributes':_0x2036bb[_0x99b6('0x19')]?_0x2036bb[_0x99b6('0x19')][_0x99b6('0x1c')]||null:null,'limit':_0x2036bb[_0x99b6('0x19')]?_0x2036bb[_0x99b6('0x19')][_0x99b6('0x1d')]||null:null,'include':_0x2036bb[_0x99b6('0x19')]?_0x2036bb[_0x99b6('0x19')][_0x99b6('0x1e')]?_[_0x99b6('0x1f')](_0x2036bb[_0x99b6('0x19')][_0x99b6('0x1e')],function(_0x58176f){return{'model':db[_0x58176f[_0x99b6('0x20')]],'as':_0x58176f['as'],'attributes':_0x58176f['attributes'],'include':_0x58176f[_0x99b6('0x1e')]?_['map'](_0x58176f[_0x99b6('0x1e')],function(_0x246b17){return{'model':db[_0x246b17['model']],'as':_0x246b17['as'],'attributes':_0x246b17['attributes'],'include':_0x246b17[_0x99b6('0x1e')]?_[_0x99b6('0x1f')](_0x246b17[_0x99b6('0x1e')],function(_0x48f796){return{'model':db[_0x48f796['model']],'as':_0x48f796['as'],'attributes':_0x48f796['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x9b1901){logger[_0x99b6('0x11')]('GetVoiceExtension',_0x2036bb);logger[_0x99b6('0x21')](_0x99b6('0x18'),_0x2036bb,JSON[_0x99b6('0x22')](_0x9b1901));_0xc65470(_0x9b1901);})[_0x99b6('0x17')](function(_0x200caf){logger['error'](_0x99b6('0x18'),_0x200caf[_0x99b6('0x15')],_0x2036bb);_0x35b47a(_0x34476d[_0x99b6('0x14')](0x1f4,_0x200caf[_0x99b6('0x15')]));});});}; \ No newline at end of file +var _0x004c=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','where','limit','include','map','attributes','GetVoiceExtension','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent'];(function(_0x1f7a47,_0x550024){var _0xf51ba4=function(_0x206e07){while(--_0x206e07){_0x1f7a47['push'](_0x1f7a47['shift']());}};_0xf51ba4(++_0x550024);}(_0x004c,0x85));var _0xc004=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x004c[_0x4c445a];return _0x2f611c;};'use strict';var _=require(_0xc004('0x0'));var util=require(_0xc004('0x1'));var moment=require(_0xc004('0x2'));var BPromise=require(_0xc004('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc004('0x4'));var db=require(_0xc004('0x5'))['db'];var utils=require(_0xc004('0x6'));var logger=require(_0xc004('0x7'))('rpc');var config=require(_0xc004('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc004('0x9')][_0xc004('0xa')]({'port':0x232a});config[_0xc004('0xb')]=_['defaults'](config[_0xc004('0xb')],{'host':_0xc004('0xc'),'port':0x18eb});var socket=require(_0xc004('0xd'))(new Redis(config[_0xc004('0xb')]));require('./voiceExtension.socket')[_0xc004('0xe')](socket);function respondWithRpcPromise(_0x1dde42,_0xf67998,_0x9a540e){return new BPromise(function(_0x348b4d,_0x1de32b){return client[_0xc004('0xf')](_0x1dde42,_0x9a540e)[_0xc004('0x10')](function(_0x46850d){logger[_0xc004('0x11')]('VoiceExtension,\x20%s,\x20%s',_0xf67998,_0xc004('0x12'));logger[_0xc004('0x13')](_0xc004('0x14'),_0xf67998,_0xc004('0x12'),JSON[_0xc004('0x15')](_0x46850d));if(_0x46850d[_0xc004('0x16')]){if(_0x46850d[_0xc004('0x16')][_0xc004('0x17')]===0x1f4){logger[_0xc004('0x16')](_0xc004('0x18'),_0xf67998,_0x46850d[_0xc004('0x16')][_0xc004('0x19')]);return _0x1de32b(_0x46850d[_0xc004('0x16')][_0xc004('0x19')]);}logger['error'](_0xc004('0x18'),_0xf67998,_0x46850d[_0xc004('0x16')][_0xc004('0x19')]);return _0x348b4d(_0x46850d[_0xc004('0x16')][_0xc004('0x19')]);}else{logger['info'](_0xc004('0x18'),_0xf67998,_0xc004('0x12'));_0x348b4d(_0x46850d[_0xc004('0x1a')][_0xc004('0x19')]);}})[_0xc004('0x1b')](function(_0x2aeea2){logger[_0xc004('0x16')]('VoiceExtension,\x20%s,\x20%s',_0xf67998,_0x2aeea2);_0x1de32b(_0x2aeea2);});});}exports['GetVoiceExtension']=function(_0x2c2b30){var _0x3cc9f4=this;return new Promise(function(_0x43fbbe,_0x5cbffc){return db[_0xc004('0x1c')][_0xc004('0x1d')]({'raw':_0x2c2b30[_0xc004('0x1e')]?_0x2c2b30[_0xc004('0x1e')][_0xc004('0x1f')]===undefined?!![]:![]:!![],'where':_0x2c2b30[_0xc004('0x1e')]?_0x2c2b30[_0xc004('0x1e')][_0xc004('0x20')]||null:null,'attributes':_0x2c2b30[_0xc004('0x1e')]?_0x2c2b30[_0xc004('0x1e')]['attributes']||null:null,'limit':_0x2c2b30[_0xc004('0x1e')]?_0x2c2b30[_0xc004('0x1e')][_0xc004('0x21')]||null:null,'include':_0x2c2b30[_0xc004('0x1e')]?_0x2c2b30['options'][_0xc004('0x22')]?_['map'](_0x2c2b30[_0xc004('0x1e')]['include'],function(_0x6cff19){return{'model':db[_0x6cff19['model']],'as':_0x6cff19['as'],'attributes':_0x6cff19['attributes'],'include':_0x6cff19[_0xc004('0x22')]?_[_0xc004('0x23')](_0x6cff19[_0xc004('0x22')],function(_0x57d993){return{'model':db[_0x57d993['model']],'as':_0x57d993['as'],'attributes':_0x57d993[_0xc004('0x24')],'include':_0x57d993[_0xc004('0x22')]?_[_0xc004('0x23')](_0x57d993[_0xc004('0x22')],function(_0x53a7af){return{'model':db[_0x53a7af['model']],'as':_0x53a7af['as'],'attributes':_0x53a7af[_0xc004('0x24')]};}):[]};}):[]};}):[]:[]})[_0xc004('0x10')](function(_0x40ac00){logger['info'](_0xc004('0x25'),_0x2c2b30);logger[_0xc004('0x13')](_0xc004('0x25'),_0x2c2b30,JSON[_0xc004('0x15')](_0x40ac00));_0x43fbbe(_0x40ac00);})[_0xc004('0x1b')](function(_0x48e261){logger['error']('GetVoiceExtension',_0x48e261['message'],_0x2c2b30);_0x5cbffc(_0x3cc9f4[_0xc004('0x16')](0x1f4,_0x48e261['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c95ff25..c22b7a5 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(_0x5e7d5f,_0x2357c6){var _0x20c5eb=function(_0x1a7834){while(--_0x1a7834){_0x5e7d5f['push'](_0x5e7d5f['shift']());}};_0x20c5eb(++_0x2357c6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0x5fc3[_0x36d25e];return _0x4b95b8;};'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 _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x13bfba,_0x51c2ce){var _0x32f31f=function(_0x4ecab0){while(--_0x4ecab0){_0x13bfba['push'](_0x13bfba['shift']());}};_0x32f31f(++_0x51c2ce);}(_0x5fc3,0xa8));var _0x35fc=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0x5fc3[_0x36bf88];return _0x332914;};'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 diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 7900fe9..21b36ce 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 _0x4991=['show','/:id/messages','post','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated'];(function(_0xde672c,_0x3db0c7){var _0x57d761=function(_0x4e42b1){while(--_0x4e42b1){_0xde672c['push'](_0xde672c['shift']());}};_0x57d761(++_0x3db0c7);}(_0x4991,0xf7));var _0x1499=function(_0x54ae02,_0x22b535){_0x54ae02=_0x54ae02-0x0;var _0x4c8a24=_0x4991[_0x54ae02];return _0x4c8a24;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require(_0x1499('0x4'));var auth=require(_0x1499('0x5'));var interaction=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var controller=require(_0x1499('0x8'));router[_0x1499('0x9')]('/',auth['isAuthenticated'](),controller[_0x1499('0xa')]);router[_0x1499('0x9')](_0x1499('0xb'),auth[_0x1499('0xc')](),controller[_0x1499('0xd')]);router[_0x1499('0x9')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller['getMessages']);router[_0x1499('0xf')]('/',auth[_0x1499('0xc')](),controller['create']);router[_0x1499('0x10')](_0x1499('0xb'),auth['isAuthenticated'](),controller[_0x1499('0x11')]);router[_0x1499('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1499('0x13')]=router; \ No newline at end of file +var _0x68b3=['index','/:id','show','/:id/messages','getMessages','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x26be26,_0x221850){var _0x479345=function(_0x3f30f3){while(--_0x3f30f3){_0x26be26['push'](_0x26be26['shift']());}};_0x479345(++_0x221850);}(_0x68b3,0x1d8));var _0x368b=function(_0x3db8a5,_0x2812a8){_0x3db8a5=_0x3db8a5-0x0;var _0x5123a0=_0x68b3[_0x3db8a5];return _0x5123a0;};'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('./voiceMail.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['post']('/',auth[_0x368b('0xa')](),controller[_0x368b('0x10')]);router[_0x368b('0x11')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('0x12')]);router[_0x368b('0x13')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('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 e82f2aa..e24da69 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 _0xb833=['trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0xa5a667,_0x185e58){var _0x2b4b54=function(_0x5601cb){while(--_0x5601cb){_0xa5a667['push'](_0xa5a667['shift']());}};_0x2b4b54(++_0x185e58);}(_0xb833,0x110));var _0x3b83=function(_0x29b095,_0x3e85ea){_0x29b095=_0x29b095-0x0;var _0x5c1751=_0xb833[_0x29b095];return _0x5c1751;};'use strict';var Sequelize=require(_0x3b83('0x0'));module[_0x3b83('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3b83('0x2')],'defaultValue':_0x3b83('0x3'),'unique':_0x3b83('0x4')},'mailbox':{'type':Sequelize[_0x3b83('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3b83('0x2')]},'fullname':{'type':Sequelize[_0x3b83('0x2')]},'email':{'type':Sequelize[_0x3b83('0x2')],'validate':{'isEmail':!![]},'set':function(_0x369875){this[_0x3b83('0x5')](_0x3b83('0x6'),typeof _0x369875===_0x3b83('0x7')&&_0x369875[_0x3b83('0x8')]()?_0x369875[_0x3b83('0x8')]():null);}},'pager':{'type':Sequelize[_0x3b83('0x2')]},'tz':{'type':Sequelize[_0x3b83('0x2')],'defaultValue':_0x3b83('0x9')},'attach':{'type':Sequelize[_0x3b83('0xa')](_0x3b83('0xb'),'no'),'defaultValue':_0x3b83('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3b83('0xa')](_0x3b83('0xb'),'no'),'defaultValue':_0x3b83('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3b83('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3b83('0xa')](_0x3b83('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3b83('0xa')](_0x3b83('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x3b83('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3b83('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3b83('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3b83('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3b83('0xa')](_0x3b83('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x3b83('0xa')](_0x3b83('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3b83('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x3b83('0xb'),'no'),'defaultValue':_0x3b83('0xb'),'allowNull':![]},'stamp':{'type':_0x3b83('0xd')},'emailsubject':{'type':Sequelize[_0x3b83('0x2')]},'emailbody':{'type':Sequelize[_0x3b83('0x2')]},'maxsecs':{'type':Sequelize[_0x3b83('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3b83('0xf')],'get':function(){return this[_0x3b83('0x10')](_0x3b83('0x11'))+_0x3b83('0x12')+this['getDataValue'](_0x3b83('0x13'));}}}; \ No newline at end of file +var _0xf7dd=['getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','from-voicemail','contest_mailbox','STRING','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x1b627d,_0x3f9847){var _0x5fb52e=function(_0x2bb4d5){while(--_0x2bb4d5){_0x1b627d['push'](_0x1b627d['shift']());}};_0x5fb52e(++_0x3f9847);}(_0xf7dd,0xaf));var _0xdf7d=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0xf7dd[_0x4ce028];return _0x583d0c;};'use strict';var Sequelize=require(_0xdf7d('0x0'));module[_0xdf7d('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0xdf7d('0x2'),'unique':_0xdf7d('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xdf7d('0x4')]},'fullname':{'type':Sequelize[_0xdf7d('0x4')]},'email':{'type':Sequelize[_0xdf7d('0x4')],'validate':{'isEmail':!![]},'set':function(_0x23544e){this[_0xdf7d('0x5')]('email',typeof _0x23544e===_0xdf7d('0x6')&&_0x23544e['trim']()?_0x23544e[_0xdf7d('0x7')]():null);}},'pager':{'type':Sequelize[_0xdf7d('0x4')]},'tz':{'type':Sequelize[_0xdf7d('0x4')],'defaultValue':_0xdf7d('0x8')},'attach':{'type':Sequelize[_0xdf7d('0x9')](_0xdf7d('0xa'),'no'),'defaultValue':_0xdf7d('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xdf7d('0x9')](_0xdf7d('0xa'),'no'),'defaultValue':_0xdf7d('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xdf7d('0x4')]},'callback':{'type':Sequelize[_0xdf7d('0x4')]},'review':{'type':Sequelize[_0xdf7d('0x9')](_0xdf7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xdf7d('0x9')](_0xdf7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xdf7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xdf7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xdf7d('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xdf7d('0x9')](_0xdf7d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xdf7d('0x9')](_0xdf7d('0xa'),'no'),'defaultValue':_0xdf7d('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xdf7d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xdf7d('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xdf7d('0xa'),'no'),'defaultValue':_0xdf7d('0xa'),'allowNull':![]},'stamp':{'type':_0xdf7d('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xdf7d('0x4')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xdf7d('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xdf7d('0xe')],'get':function(){return this[_0xdf7d('0xf')](_0xdf7d('0x10'))+_0xdf7d('0x11')+this[_0xdf7d('0xf')](_0xdf7d('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index d72c088..8a4e3ad 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 _0xb9a7=['model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','params','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','body','findOne','VoiceMailMessage','rawAttributes','nolimit','findAndCountAll','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','fieldName','type'];(function(_0xbd99fb,_0x4f8c07){var _0x130606=function(_0x455dcc){while(--_0x455dcc){_0xbd99fb['push'](_0xbd99fb['shift']());}};_0x130606(++_0x4f8c07);}(_0xb9a7,0x112));var _0x7b9a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xb9a7[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){var _0x5b2f52=_0x269c07[_0x7b9a('0x20')]({'plain':!![]});var _0x23219e='Voicemails';return db[_0x7b9a('0x21')]['destroy']({'where':{'type':_0x23219e,'resourceId':_0x5b2f52['id']}})[_0x7b9a('0x1e')](function(){return _0x269c07;});})[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d886,_0x55301c){return function(_0x54df8a){if(!_0x54df8a){_0x24d886[_0x7b9a('0x22')](0x194);}return _0x54df8a;};}function handleError(_0x58fec8,_0x5be740){_0x5be740=_0x5be740||0x1f4;return function(_0x3847b4){logger['error'](_0x3847b4[_0x7b9a('0x23')]);if(_0x3847b4[_0x7b9a('0x24')]){delete _0x3847b4['name'];}_0x58fec8[_0x7b9a('0x14')](_0x5be740)[_0x7b9a('0x25')](_0x3847b4);};}exports[_0x7b9a('0x26')]=function(_0x5b64d7,_0x45ccf5){var _0x2ce78b={},_0x181e9c={},_0x6c8b1f={'count':0x0,'rows':[]};var _0x5028e7=_[_0x7b9a('0x27')](db['VoiceMail']['rawAttributes'],function(_0x2d278e){return{'name':_0x2d278e[_0x7b9a('0x28')],'type':_0x2d278e[_0x7b9a('0x29')]['key']};});_0x181e9c[_0x7b9a('0x2a')]=_[_0x7b9a('0x27')](_0x5028e7,'name');_0x181e9c['query']=_[_0x7b9a('0x2b')](_0x5b64d7[_0x7b9a('0x2c')]);_0x181e9c['filters']=_[_0x7b9a('0x2d')](_0x181e9c[_0x7b9a('0x2a')],_0x181e9c[_0x7b9a('0x2c')]);_0x2ce78b[_0x7b9a('0x2e')]=_[_0x7b9a('0x2d')](_0x181e9c['model'],qs[_0x7b9a('0x2f')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x2ce78b[_0x7b9a('0x2e')]=_0x2ce78b[_0x7b9a('0x2e')][_0x7b9a('0x30')]?_0x2ce78b['attributes']:_0x181e9c['model'];if(!_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x31')]('nolimit')){_0x2ce78b[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x5b64d7[_0x7b9a('0x2c')]['limit']);_0x2ce78b[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x5b64d7['query']['offset']);}_0x2ce78b[_0x7b9a('0x32')]=qs[_0x7b9a('0x33')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x33')]);_0x2ce78b[_0x7b9a('0x34')]=qs[_0x7b9a('0x35')](_[_0x7b9a('0x36')](_0x5b64d7[_0x7b9a('0x2c')],_0x181e9c['filters']),_0x5028e7);if(_0x5b64d7[_0x7b9a('0x2c')]['filter']){_0x2ce78b[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x2ce78b[_0x7b9a('0x34')],{'$or':_[_0x7b9a('0x27')](_0x5028e7,function(_0x3fa4cd){if(_0x3fa4cd[_0x7b9a('0x29')]!=='VIRTUAL'){var _0x34eebe={};_0x34eebe[_0x3fa4cd[_0x7b9a('0x24')]]={'$like':'%'+_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x38')]+'%'};return _0x34eebe;}})});}_0x2ce78b=_['merge']({},_0x2ce78b,_0x5b64d7[_0x7b9a('0x39')]);var _0xf86939={'where':_0x2ce78b[_0x7b9a('0x34')]};return db[_0x7b9a('0x3a')]['count'](_0xf86939)[_0x7b9a('0x1e')](function(_0x53d89a){_0x6c8b1f[_0x7b9a('0x19')]=_0x53d89a;if(_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x3b')]){_0x2ce78b[_0x7b9a('0x3c')]=[{'all':!![]}];}return db[_0x7b9a('0x3a')][_0x7b9a('0x3d')](_0x2ce78b);})['then'](function(_0x33edc6){_0x6c8b1f[_0x7b9a('0x3e')]=_0x33edc6;return _0x6c8b1f;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x45ccf5,_0x2ce78b))['catch'](handleError(_0x45ccf5,null));};exports['show']=function(_0x3724fe,_0x454b35){var _0x995d59={'raw':!![],'where':{'id':_0x3724fe[_0x7b9a('0x3f')]['id']}},_0x5cd3dd={};_0x5cd3dd[_0x7b9a('0x2a')]=_['keys'](db['VoiceMail']['rawAttributes']);_0x5cd3dd[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x3724fe['query']);_0x5cd3dd[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0x5cd3dd[_0x7b9a('0x2a')],_0x5cd3dd['query']);_0x995d59[_0x7b9a('0x2e')]=_['intersection'](_0x5cd3dd[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x3724fe[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x995d59[_0x7b9a('0x2e')]=_0x995d59['attributes'][_0x7b9a('0x30')]?_0x995d59['attributes']:_0x5cd3dd[_0x7b9a('0x2a')];if(_0x3724fe['query']['includeAll']){_0x995d59[_0x7b9a('0x3c')]=[{'all':!![]}];}_0x995d59=_[_0x7b9a('0x37')]({},_0x995d59,_0x3724fe[_0x7b9a('0x39')]);return db[_0x7b9a('0x3a')][_0x7b9a('0x40')](_0x995d59)[_0x7b9a('0x1e')](handleEntityNotFound(_0x454b35,null))[_0x7b9a('0x1e')](respondWithResult(_0x454b35,null))[_0x7b9a('0x41')](handleError(_0x454b35,null));};exports[_0x7b9a('0x42')]=function(_0x5088c7,_0x1d7957){return db[_0x7b9a('0x3a')]['create'](_0x5088c7['body'],{})['then'](function(_0x1b3e65){var _0x30296e=_0x5088c7[_0x7b9a('0x43')][_0x7b9a('0x20')]({'plain':!![]});if(!_0x30296e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30296e[_0x7b9a('0x44')]===_0x7b9a('0x43')){var _0x287dea=_0x1b3e65[_0x7b9a('0x20')]({'plain':!![]});var _0x2d083b='Voicemails';return db[_0x7b9a('0x45')]['find']({'where':{'name':_0x2d083b,'userProfileId':_0x30296e[_0x7b9a('0x46')]},'raw':!![]})[_0x7b9a('0x1e')](function(_0x239146){if(_0x239146&&_0x239146[_0x7b9a('0x47')]===0x0){return db['UserProfileResource'][_0x7b9a('0x42')]({'name':_0x287dea[_0x7b9a('0x24')],'resourceId':_0x287dea['id'],'type':_0x239146[_0x7b9a('0x24')],'sectionId':_0x239146['id']},{})[_0x7b9a('0x1e')](function(){return _0x1b3e65;});}else{return _0x1b3e65;}})[_0x7b9a('0x41')](function(_0x3e2f1b){logger[_0x7b9a('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e2f1b);throw _0x3e2f1b;});}return _0x1b3e65;})['then'](respondWithResult(_0x1d7957,0xc9))['catch'](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1d')]=function(_0x2f8929,_0x5a1b7d){if(_0x2f8929['body']['id']){delete _0x2f8929['body']['id'];}return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x2f8929[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x5a1b7d,null))[_0x7b9a('0x1e')](saveUpdates(_0x2f8929[_0x7b9a('0x49')],null))[_0x7b9a('0x1e')](respondWithResult(_0x5a1b7d,null))[_0x7b9a('0x41')](handleError(_0x5a1b7d,null));};exports[_0x7b9a('0x1f')]=function(_0x5dc17e,_0x1f99f5){return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x5dc17e[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1f99f5,null))[_0x7b9a('0x1e')](removeEntity(_0x1f99f5,null))[_0x7b9a('0x41')](handleError(_0x1f99f5,null));};exports['getMessages']=function(_0x25ec82,_0x491804,_0x3d2df4){return db[_0x7b9a('0x3a')][_0x7b9a('0x4a')]({'where':{'id':_0x25ec82['params']['id']}})['then'](handleEntityNotFound(_0x491804,null))['then'](function(_0x4f6843){var _0x33375c;var _0x8a777f={},_0xb91099={};_0xb91099['model']=_[_0x7b9a('0x2b')](db[_0x7b9a('0x4b')][_0x7b9a('0x4c')]);_0xb91099[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x25ec82['query']);_0xb91099[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0xb91099[_0x7b9a('0x2a')],_0xb91099['query']);_0x8a777f['attributes']=_['intersection'](_0xb91099[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x25ec82[_0x7b9a('0x2c')]['fields']));_0x8a777f[_0x7b9a('0x2e')]=_0x8a777f[_0x7b9a('0x2e')]['length']?_0x8a777f[_0x7b9a('0x2e')]:_0xb91099['model'];if(!_0x25ec82[_0x7b9a('0x2c')]['hasOwnProperty'](_0x7b9a('0x4d'))){_0x8a777f[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x25ec82[_0x7b9a('0x2c')]['limit']);_0x8a777f[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x25ec82[_0x7b9a('0x2c')][_0x7b9a('0x17')]);}_0x8a777f['order']=qs[_0x7b9a('0x33')](_0x25ec82['query'][_0x7b9a('0x33')]);_0x8a777f['where']=qs[_0x7b9a('0x35')](_['pick'](_0x25ec82['query'],_0xb91099['filters']));if(_0x25ec82['query'][_0x7b9a('0x38')]){_0x8a777f[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'$or':_['map'](_0x8a777f[_0x7b9a('0x2e')],function(_0x4b9462){var _0x50b6f1={};_0x50b6f1[_0x4b9462]={'$like':'%'+_0x25ec82[_0x7b9a('0x2c')]['filter']+'%'};return _0x50b6f1;})});}_0x8a777f['where']=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'mailboxuser':_0x4f6843['mailbox']});_0x8a777f=_[_0x7b9a('0x37')]({},_0x8a777f,_0x25ec82['options']);return db[_0x7b9a('0x4b')][_0x7b9a('0x4e')](_0x8a777f)[_0x7b9a('0x1e')](respondWithFilteredResult(_0x491804,_0x8a777f));})['catch'](handleError(_0x491804,null));}; \ No newline at end of file +var _0xd87e=['autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMessages','findOne','VoiceMailMessage','hasOwnProperty','sort','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Voicemails','UserProfileResource','error','name','map','VoiceMail','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x37bad2,_0x1590e9){var _0x4c53bc=function(_0x5987b3){while(--_0x5987b3){_0x37bad2['push'](_0x37bad2['shift']());}};_0x4c53bc(++_0x1590e9);}(_0xd87e,0x1bf));var _0xed87=function(_0x49048c,_0x17697d){_0x49048c=_0x49048c-0x0;var _0x615ce0=_0xd87e[_0x49048c];return _0x615ce0;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];function respondWithStatusCode(_0x5e912e,_0x4ffc2d){_0x4ffc2d=_0x4ffc2d||0xcc;return function(_0x466f35){if(_0x466f35){return _0x5e912e[_0xed87('0x18')](_0x4ffc2d);}return _0x5e912e[_0xed87('0x19')](_0x4ffc2d)[_0xed87('0x1a')]();};}function respondWithResult(_0x16bfd6,_0x3865c5){_0x3865c5=_0x3865c5||0xc8;return function(_0x52dfe8){if(_0x52dfe8){return _0x16bfd6[_0xed87('0x19')](_0x3865c5)[_0xed87('0x1b')](_0x52dfe8);}};}function respondWithFilteredResult(_0x1722a6,_0x1e9a3d){return function(_0x2f2fd3){if(_0x2f2fd3){var _0xd34e0e=typeof _0x1e9a3d[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x1e9a3d[_0xed87('0x1e')]==='undefined';var _0x3db5ea=_0x2f2fd3[_0xed87('0x1f')];var _0x2c386a=_0xd34e0e?0x0:_0x1e9a3d[_0xed87('0x1c')];var _0x5f4076=_0xd34e0e?_0x2f2fd3[_0xed87('0x1f')]:_0x1e9a3d[_0xed87('0x1c')]+_0x1e9a3d[_0xed87('0x1e')];var _0x3f9e08;if(_0x5f4076>=_0x3db5ea){_0x5f4076=_0x3db5ea;_0x3f9e08=0xc8;}else{_0x3f9e08=0xce;}_0x1722a6[_0xed87('0x19')](_0x3f9e08);return _0x1722a6[_0xed87('0x20')](_0xed87('0x21'),_0x2c386a+'-'+_0x5f4076+'/'+_0x3db5ea)[_0xed87('0x1b')](_0x2f2fd3);}return null;};}function patchUpdates(_0x3b7981){return function(_0x52e81c){try{jsonpatch['apply'](_0x52e81c,_0x3b7981,!![]);}catch(_0x5db546){return BPromise['reject'](_0x5db546);}return _0x52e81c[_0xed87('0x22')]();};}function saveUpdates(_0x5d3ec8,_0x4191a7){return function(_0x2b0b98){if(_0x2b0b98){return _0x2b0b98['update'](_0x5d3ec8)[_0xed87('0x23')](function(_0x505733){return _0x505733;});}return null;};}function removeEntity(_0x3d1641,_0x24962e){return function(_0x27799a){if(_0x27799a){return _0x27799a[_0xed87('0x24')]()[_0xed87('0x23')](function(){var _0x5d15b3=_0x27799a[_0xed87('0x25')]({'plain':!![]});var _0x3c22b7=_0xed87('0x26');return db[_0xed87('0x27')][_0xed87('0x24')]({'where':{'type':_0x3c22b7,'resourceId':_0x5d15b3['id']}})[_0xed87('0x23')](function(){return _0x27799a;});})[_0xed87('0x23')](function(){_0x3d1641[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x38f5c,_0x469181){return function(_0x341a35){if(!_0x341a35){_0x38f5c[_0xed87('0x18')](0x194);}return _0x341a35;};}function handleError(_0x2b86e2,_0x4dfaf2){_0x4dfaf2=_0x4dfaf2||0x1f4;return function(_0xb32b1c){logger[_0xed87('0x28')](_0xb32b1c['stack']);if(_0xb32b1c[_0xed87('0x29')]){delete _0xb32b1c[_0xed87('0x29')];}_0x2b86e2[_0xed87('0x19')](_0x4dfaf2)['send'](_0xb32b1c);};}exports['index']=function(_0xd0efba,_0x428b75){var _0x21ab8a={},_0x549a19={},_0x37d45a={'count':0x0,'rows':[]};var _0x3b87e3=_[_0xed87('0x2a')](db[_0xed87('0x2b')][_0xed87('0x2c')],function(_0x46b9f9){return{'name':_0x46b9f9[_0xed87('0x2d')],'type':_0x46b9f9[_0xed87('0x2e')][_0xed87('0x2f')]};});_0x549a19['model']=_[_0xed87('0x2a')](_0x3b87e3,_0xed87('0x29'));_0x549a19['query']=_[_0xed87('0x30')](_0xd0efba['query']);_0x549a19[_0xed87('0x31')]=_[_0xed87('0x32')](_0x549a19[_0xed87('0x33')],_0x549a19[_0xed87('0x34')]);_0x21ab8a[_0xed87('0x35')]=_[_0xed87('0x32')](_0x549a19[_0xed87('0x33')],qs[_0xed87('0x36')](_0xd0efba[_0xed87('0x34')][_0xed87('0x36')]));_0x21ab8a[_0xed87('0x35')]=_0x21ab8a['attributes'][_0xed87('0x37')]?_0x21ab8a[_0xed87('0x35')]:_0x549a19['model'];if(!_0xd0efba[_0xed87('0x34')]['hasOwnProperty'](_0xed87('0x38'))){_0x21ab8a[_0xed87('0x1e')]=qs['limit'](_0xd0efba[_0xed87('0x34')][_0xed87('0x1e')]);_0x21ab8a[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0xd0efba[_0xed87('0x34')]['offset']);}_0x21ab8a[_0xed87('0x39')]=qs['sort'](_0xd0efba[_0xed87('0x34')]['sort']);_0x21ab8a[_0xed87('0x3a')]=qs[_0xed87('0x31')](_[_0xed87('0x3b')](_0xd0efba[_0xed87('0x34')],_0x549a19[_0xed87('0x31')]),_0x3b87e3);if(_0xd0efba[_0xed87('0x34')][_0xed87('0x3c')]){_0x21ab8a[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0x21ab8a['where'],{'$or':_['map'](_0x3b87e3,function(_0xa6714a){if(_0xa6714a[_0xed87('0x2e')]!==_0xed87('0x3e')){var _0x325112={};_0x325112[_0xa6714a[_0xed87('0x29')]]={'$like':'%'+_0xd0efba[_0xed87('0x34')]['filter']+'%'};return _0x325112;}})});}_0x21ab8a=_[_0xed87('0x3d')]({},_0x21ab8a,_0xd0efba[_0xed87('0x3f')]);var _0x1c49b0={'where':_0x21ab8a['where']};return db[_0xed87('0x2b')][_0xed87('0x1f')](_0x1c49b0)[_0xed87('0x23')](function(_0x1b0092){_0x37d45a[_0xed87('0x1f')]=_0x1b0092;if(_0xd0efba[_0xed87('0x34')][_0xed87('0x40')]){_0x21ab8a[_0xed87('0x41')]=[{'all':!![]}];}return db[_0xed87('0x2b')][_0xed87('0x42')](_0x21ab8a);})['then'](function(_0x7e6cbb){_0x37d45a[_0xed87('0x43')]=_0x7e6cbb;return _0x37d45a;})[_0xed87('0x23')](respondWithFilteredResult(_0x428b75,_0x21ab8a))['catch'](handleError(_0x428b75,null));};exports['show']=function(_0xa31eec,_0x7aa7fa){var _0x40cd98={'raw':!![],'where':{'id':_0xa31eec['params']['id']}},_0x41a658={};_0x41a658[_0xed87('0x33')]=_[_0xed87('0x30')](db['VoiceMail'][_0xed87('0x2c')]);_0x41a658[_0xed87('0x34')]=_[_0xed87('0x30')](_0xa31eec[_0xed87('0x34')]);_0x41a658[_0xed87('0x31')]=_[_0xed87('0x32')](_0x41a658[_0xed87('0x33')],_0x41a658[_0xed87('0x34')]);_0x40cd98[_0xed87('0x35')]=_[_0xed87('0x32')](_0x41a658[_0xed87('0x33')],qs['fields'](_0xa31eec[_0xed87('0x34')][_0xed87('0x36')]));_0x40cd98[_0xed87('0x35')]=_0x40cd98[_0xed87('0x35')][_0xed87('0x37')]?_0x40cd98[_0xed87('0x35')]:_0x41a658[_0xed87('0x33')];if(_0xa31eec[_0xed87('0x34')][_0xed87('0x40')]){_0x40cd98[_0xed87('0x41')]=[{'all':!![]}];}_0x40cd98=_[_0xed87('0x3d')]({},_0x40cd98,_0xa31eec[_0xed87('0x3f')]);return db[_0xed87('0x2b')][_0xed87('0x44')](_0x40cd98)[_0xed87('0x23')](handleEntityNotFound(_0x7aa7fa,null))[_0xed87('0x23')](respondWithResult(_0x7aa7fa,null))[_0xed87('0x45')](handleError(_0x7aa7fa,null));};exports['create']=function(_0x2c7bef,_0x1a68a7){return db[_0xed87('0x2b')]['create'](_0x2c7bef[_0xed87('0x46')],{})[_0xed87('0x23')](function(_0x54bc95){var _0x33e736=_0x2c7bef[_0xed87('0x47')][_0xed87('0x25')]({'plain':!![]});if(!_0x33e736)throw new Error(_0xed87('0x48'));if(_0x33e736['role']===_0xed87('0x47')){var _0x436e15=_0x54bc95[_0xed87('0x25')]({'plain':!![]});var _0x272a07=_0xed87('0x26');return db[_0xed87('0x49')][_0xed87('0x44')]({'where':{'name':_0x272a07,'userProfileId':_0x33e736[_0xed87('0x4a')]},'raw':!![]})[_0xed87('0x23')](function(_0x251d4e){if(_0x251d4e&&_0x251d4e[_0xed87('0x4b')]===0x0){return db[_0xed87('0x27')][_0xed87('0x4c')]({'name':_0x436e15['name'],'resourceId':_0x436e15['id'],'type':_0x251d4e[_0xed87('0x29')],'sectionId':_0x251d4e['id']},{})['then'](function(){return _0x54bc95;});}else{return _0x54bc95;}})[_0xed87('0x45')](function(_0x329973){logger[_0xed87('0x28')](_0xed87('0x4d'),_0x329973);throw _0x329973;});}return _0x54bc95;})[_0xed87('0x23')](respondWithResult(_0x1a68a7,0xc9))[_0xed87('0x45')](handleError(_0x1a68a7,null));};exports[_0xed87('0x4e')]=function(_0xccdbb6,_0x3b413d){if(_0xccdbb6[_0xed87('0x46')]['id']){delete _0xccdbb6['body']['id'];}return db[_0xed87('0x2b')][_0xed87('0x44')]({'where':{'id':_0xccdbb6[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x3b413d,null))[_0xed87('0x23')](saveUpdates(_0xccdbb6[_0xed87('0x46')],null))[_0xed87('0x23')](respondWithResult(_0x3b413d,null))[_0xed87('0x45')](handleError(_0x3b413d,null));};exports[_0xed87('0x24')]=function(_0x367ff4,_0x32db1f){return db['VoiceMail']['find']({'where':{'id':_0x367ff4[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x32db1f,null))[_0xed87('0x23')](removeEntity(_0x32db1f,null))[_0xed87('0x45')](handleError(_0x32db1f,null));};exports[_0xed87('0x50')]=function(_0x4dd840,_0x7e6738,_0x1ddd72){return db[_0xed87('0x2b')][_0xed87('0x51')]({'where':{'id':_0x4dd840[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x7e6738,null))[_0xed87('0x23')](function(_0x1391a2){var _0x2ffffa;var _0xf4ec55={},_0x3feebb={};_0x3feebb[_0xed87('0x33')]=_[_0xed87('0x30')](db[_0xed87('0x52')]['rawAttributes']);_0x3feebb[_0xed87('0x34')]=_[_0xed87('0x30')](_0x4dd840[_0xed87('0x34')]);_0x3feebb[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3feebb[_0xed87('0x33')],_0x3feebb[_0xed87('0x34')]);_0xf4ec55[_0xed87('0x35')]=_['intersection'](_0x3feebb[_0xed87('0x33')],qs[_0xed87('0x36')](_0x4dd840[_0xed87('0x34')][_0xed87('0x36')]));_0xf4ec55[_0xed87('0x35')]=_0xf4ec55[_0xed87('0x35')]['length']?_0xf4ec55['attributes']:_0x3feebb[_0xed87('0x33')];if(!_0x4dd840[_0xed87('0x34')][_0xed87('0x53')](_0xed87('0x38'))){_0xf4ec55[_0xed87('0x1e')]=qs[_0xed87('0x1e')](_0x4dd840[_0xed87('0x34')][_0xed87('0x1e')]);_0xf4ec55['offset']=qs[_0xed87('0x1c')](_0x4dd840['query'][_0xed87('0x1c')]);}_0xf4ec55[_0xed87('0x39')]=qs['sort'](_0x4dd840[_0xed87('0x34')][_0xed87('0x54')]);_0xf4ec55['where']=qs[_0xed87('0x31')](_[_0xed87('0x3b')](_0x4dd840[_0xed87('0x34')],_0x3feebb[_0xed87('0x31')]));if(_0x4dd840[_0xed87('0x34')]['filter']){_0xf4ec55[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0xf4ec55[_0xed87('0x3a')],{'$or':_[_0xed87('0x2a')](_0xf4ec55['attributes'],function(_0x58279a){var _0x3a6ab6={};_0x3a6ab6[_0x58279a]={'$like':'%'+_0x4dd840[_0xed87('0x34')]['filter']+'%'};return _0x3a6ab6;})});}_0xf4ec55[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0xf4ec55[_0xed87('0x3a')],{'mailboxuser':_0x1391a2[_0xed87('0x55')]});_0xf4ec55=_[_0xed87('0x3d')]({},_0xf4ec55,_0x4dd840[_0xed87('0x3f')]);return db[_0xed87('0x52')][_0xed87('0x56')](_0xf4ec55)[_0xed87('0x23')](respondWithFilteredResult(_0x7e6738,_0xf4ec55));})[_0xed87('0x45')](handleError(_0x7e6738,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index d46a458..8bbc4d6 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 _0x5be4=['util','../../config/logger','api','moment','path','rimraf','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x3171f1,_0x28c520){var _0x244bc2=function(_0x975013){while(--_0x975013){_0x3171f1['push'](_0x3171f1['shift']());}};_0x244bc2(++_0x28c520);}(_0x5be4,0x108));var _0x45be=function(_0x17a997,_0x11a632){_0x17a997=_0x17a997-0x0;var _0x336971=_0x5be4[_0x17a997];return _0x336971;};'use strict';var _=require('lodash');var util=require(_0x45be('0x0'));var logger=require(_0x45be('0x1'))(_0x45be('0x2'));var moment=require(_0x45be('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x45be('0x4'));var rimraf=require(_0x45be('0x5'));var config=require('../../config/environment');var attributes=require(_0x45be('0x6'));module[_0x45be('0x7')]=function(_0x34f635,_0x4c2b00){return _0x34f635['define'](_0x45be('0x8'),attributes,{'tableName':_0x45be('0x9'),'paranoid':![],'indexes':[{'name':_0x45be('0xa'),'fields':[_0x45be('0xb'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3538=['VoiceMail','voice_voicemail','mailbox','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x370c69,_0x13b0da){var _0x2393ed=function(_0x1992ac){while(--_0x1992ac){_0x370c69['push'](_0x370c69['shift']());}};_0x2393ed(++_0x13b0da);}(_0x3538,0x1df));var _0x8353=function(_0x4197e5,_0x4e21db){_0x4197e5=_0x4197e5-0x0;var _0x3658ee=_0x3538[_0x4197e5];return _0x3658ee;};'use strict';var _=require('lodash');var util=require(_0x8353('0x0'));var logger=require(_0x8353('0x1'))(_0x8353('0x2'));var moment=require(_0x8353('0x3'));var BPromise=require(_0x8353('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8353('0x5'));var rimraf=require(_0x8353('0x6'));var config=require(_0x8353('0x7'));var attributes=require(_0x8353('0x8'));module[_0x8353('0x9')]=function(_0x558550,_0x500480){return _0x558550[_0x8353('0xa')](_0x8353('0xb'),attributes,{'tableName':_0x8353('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x8353('0xd'),'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 e23bf70..a911de0 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 _0x61c6=['bluebird','randomstring','../../config/logger','rpc','jayson/promise','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x4e0992,_0x24ef95){var _0x14cf18=function(_0x2addfd){while(--_0x2addfd){_0x4e0992['push'](_0x4e0992['shift']());}};_0x14cf18(++_0x24ef95);}(_0x61c6,0x1b2));var _0x661c=function(_0x50949e,_0x305130){_0x50949e=_0x50949e-0x0;var _0x29d1fd=_0x61c6[_0x50949e];return _0x29d1fd;};'use strict';var _=require(_0x661c('0x0'));var util=require(_0x661c('0x1'));var moment=require(_0x661c('0x2'));var BPromise=require(_0x661c('0x3'));var rs=require(_0x661c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x661c('0x5'))(_0x661c('0x6'));var config=require('../../config/environment');var jayson=require(_0x661c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9f448a,_0x1b1cc4,_0x59bfe9){return new BPromise(function(_0x13a0ee,_0x42b231){return client['request'](_0x9f448a,_0x59bfe9)[_0x661c('0x8')](function(_0x1b1f8a){logger[_0x661c('0x9')](_0x661c('0xa'),_0x1b1cc4,_0x661c('0xb'));logger[_0x661c('0xc')](_0x661c('0xd'),_0x1b1cc4,_0x661c('0xb'),JSON[_0x661c('0xe')](_0x1b1f8a));if(_0x1b1f8a[_0x661c('0xf')]){if(_0x1b1f8a[_0x661c('0xf')][_0x661c('0x10')]===0x1f4){logger['error'](_0x661c('0xa'),_0x1b1cc4,_0x1b1f8a['error'][_0x661c('0x11')]);return _0x42b231(_0x1b1f8a[_0x661c('0xf')][_0x661c('0x11')]);}logger[_0x661c('0xf')]('VoiceMail,\x20%s,\x20%s',_0x1b1cc4,_0x1b1f8a[_0x661c('0xf')]['message']);return _0x13a0ee(_0x1b1f8a['error']['message']);}else{logger[_0x661c('0x9')]('VoiceMail,\x20%s,\x20%s',_0x1b1cc4,_0x661c('0xb'));_0x13a0ee(_0x1b1f8a[_0x661c('0x12')][_0x661c('0x11')]);}})['catch'](function(_0xb81224){logger[_0x661c('0xf')](_0x661c('0xa'),_0x1b1cc4,_0xb81224);_0x42b231(_0xb81224);});});} \ No newline at end of file +var _0x6302=['../../config/environment','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x6302,0x15d));var _0x2630=function(_0x25338f,_0x3914f9){_0x25338f=_0x25338f-0x0;var _0x437edb=_0x6302[_0x25338f];return _0x437edb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2630('0x0'));var BPromise=require(_0x2630('0x1'));var rs=require(_0x2630('0x2'));var fs=require('fs');var Redis=require(_0x2630('0x3'));var db=require(_0x2630('0x4'))['db'];var utils=require(_0x2630('0x5'));var logger=require(_0x2630('0x6'))(_0x2630('0x7'));var config=require(_0x2630('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2630('0x9')][_0x2630('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f7bd3,_0x5936bb,_0x31dacd){return new BPromise(function(_0xc48c12,_0x205323){return client['request'](_0x4f7bd3,_0x31dacd)[_0x2630('0xb')](function(_0x4c982a){logger[_0x2630('0xc')](_0x2630('0xd'),_0x5936bb,_0x2630('0xe'));logger[_0x2630('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5936bb,'request\x20sent',JSON['stringify'](_0x4c982a));if(_0x4c982a[_0x2630('0x10')]){if(_0x4c982a[_0x2630('0x10')][_0x2630('0x11')]===0x1f4){logger[_0x2630('0x10')](_0x2630('0xd'),_0x5936bb,_0x4c982a[_0x2630('0x10')][_0x2630('0x12')]);return _0x205323(_0x4c982a[_0x2630('0x10')]['message']);}logger[_0x2630('0x10')]('VoiceMail,\x20%s,\x20%s',_0x5936bb,_0x4c982a[_0x2630('0x10')]['message']);return _0xc48c12(_0x4c982a[_0x2630('0x10')][_0x2630('0x12')]);}else{logger[_0x2630('0xc')](_0x2630('0xd'),_0x5936bb,_0x2630('0xe'));_0xc48c12(_0x4c982a[_0x2630('0x13')][_0x2630('0x12')]);}})[_0x2630('0x14')](function(_0x1096f8){logger[_0x2630('0x10')](_0x2630('0xd'),_0x5936bb,_0x1096f8);_0x205323(_0x1096f8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 3164630..0edcaae 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 _0x3c2b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','download','post','create','delete','destroy','exports','multer','util','path'];(function(_0x32eb86,_0x4e99f5){var _0x24b2ed=function(_0x4b9041){while(--_0x4b9041){_0x32eb86['push'](_0x32eb86['shift']());}};_0x24b2ed(++_0x4e99f5);}(_0x3c2b,0x89));var _0xb3c2=function(_0x5f103a,_0x157473){_0x5f103a=_0x5f103a-0x0;var _0x2b4e16=_0x3c2b[_0x5f103a];return _0x2b4e16;};'use strict';var multer=require(_0xb3c2('0x0'));var util=require(_0xb3c2('0x1'));var path=require(_0xb3c2('0x2'));var timeout=require(_0xb3c2('0x3'));var express=require(_0xb3c2('0x4'));var router=express[_0xb3c2('0x5')]();var fs_extra=require(_0xb3c2('0x6'));var auth=require(_0xb3c2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb3c2('0x8'));var controller=require(_0xb3c2('0x9'));router[_0xb3c2('0xa')]('/',auth[_0xb3c2('0xb')](),controller['index']);router['get'](_0xb3c2('0xc'),auth[_0xb3c2('0xb')](),controller[_0xb3c2('0xd')]);router[_0xb3c2('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xb3c2('0xe')]);router[_0xb3c2('0xf')]('/',auth[_0xb3c2('0xb')](),controller[_0xb3c2('0x10')]);router['put'](_0xb3c2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb3c2('0x11')](_0xb3c2('0xc'),auth[_0xb3c2('0xb')](),controller[_0xb3c2('0x12')]);module[_0xb3c2('0x13')]=router; \ No newline at end of file +var _0xb602=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id/download','download','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0xc3f0cd,_0x3886a2){var _0x14a8c4=function(_0x48846b){while(--_0x48846b){_0xc3f0cd['push'](_0xc3f0cd['shift']());}};_0x14a8c4(++_0x3886a2);}(_0xb602,0x19d));var _0x2b60=function(_0x591565,_0x5371f8){_0x591565=_0x591565-0x0;var _0x17666b=_0xb602[_0x591565];return _0x17666b;};'use strict';var multer=require(_0x2b60('0x0'));var util=require(_0x2b60('0x1'));var path=require(_0x2b60('0x2'));var timeout=require(_0x2b60('0x3'));var express=require(_0x2b60('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b60('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2b60('0x6'));var controller=require(_0x2b60('0x7'));router[_0x2b60('0x8')]('/',auth[_0x2b60('0x9')](),controller[_0x2b60('0xa')]);router['get']('/:id',auth[_0x2b60('0x9')](),controller['show']);router[_0x2b60('0x8')](_0x2b60('0xb'),auth[_0x2b60('0x9')](),controller[_0x2b60('0xc')]);router[_0x2b60('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2b60('0xe')](_0x2b60('0xf'),auth[_0x2b60('0x9')](),controller[_0x2b60('0x10')]);router[_0x2b60('0x11')](_0x2b60('0xf'),auth[_0x2b60('0x9')](),controller[_0x2b60('0x12')]);module[_0x2b60('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index f5d39c4..69d75eb 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 _0xd817=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x129348,_0x2ee0ed){var _0x10aaec=function(_0x386507){while(--_0x386507){_0x129348['push'](_0x129348['shift']());}};_0x10aaec(++_0x2ee0ed);}(_0xd817,0x1ef));var _0x7d81=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0xd817[_0x134d5e];return _0x1e166a;};'use strict';var Sequelize=require(_0x7d81('0x0'));module[_0x7d81('0x1')]={'name':{'type':Sequelize[_0x7d81('0x2')],'get':function(_0xb38121){return this[_0x7d81('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x7d81('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x7d81('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x7d81('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7d81('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x7d81('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x7d81('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x7d81('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7d81('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x7d81('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x7d81('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x7d81('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x7d81('0x7')](_0x7d81('0x8'))}}; \ No newline at end of file +var _0x0622=['BLOB','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','INTEGER','STRING'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x0622,0x1d4));var _0x2062=function(_0x26a01b,_0x596242){_0x26a01b=_0x26a01b-0x0;var _0x2b43f1=_0x0622[_0x26a01b];return _0x2b43f1;};'use strict';var Sequelize=require(_0x2062('0x0'));module['exports']={'name':{'type':Sequelize[_0x2062('0x1')],'get':function(_0x47069c){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x2062('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x2062('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x2062('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x2062('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x2062('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x2062('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x2062('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x2062('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x2062('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x2062('0x4')](_0x2062('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x2062('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x2062('0x6')](_0x2062('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index cc10c33..9a8d1fc 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 _0x5841=['options','VoiceMailMessage','includeAll','findAll','show','params','length','include','find','catch','create','body','download','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter'];(function(_0x3508ae,_0x1e2185){var _0x3834be=function(_0x44d2f9){while(--_0x44d2f9){_0x3508ae['push'](_0x3508ae['shift']());}};_0x3834be(++_0x1e2185);}(_0x5841,0x65));var _0x1584=function(_0x52bbb9,_0x16f86b){_0x52bbb9=_0x52bbb9-0x0;var _0x2d93b0=_0x5841[_0x52bbb9];return _0x2d93b0;};'use strict';var emlformat=require(_0x1584('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1584('0x1'));var rp=require(_0x1584('0x2'));var moment=require(_0x1584('0x3'));var BPromise=require(_0x1584('0x4'));var Mustache=require(_0x1584('0x5'));var util=require(_0x1584('0x6'));var path=require(_0x1584('0x7'));var sox=require(_0x1584('0x8'));var csv=require(_0x1584('0x9'));var ejs=require(_0x1584('0xa'));var fs=require('fs');var fs_extra=require(_0x1584('0xb'));var _=require(_0x1584('0xc'));var squel=require(_0x1584('0xd'));var crypto=require(_0x1584('0xe'));var jsforce=require(_0x1584('0xf'));var deskjs=require(_0x1584('0x10'));var toCsv=require(_0x1584('0x9'));var querystring=require('querystring');var Papa=require(_0x1584('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1584('0x12'));var as=require(_0x1584('0x13'));var hardwareService=require(_0x1584('0x14'));var logger=require(_0x1584('0x15'))(_0x1584('0x16'));var utils=require('../../config/utils');var config=require(_0x1584('0x17'));var licenseUtil=require(_0x1584('0x18'));var db=require(_0x1584('0x19'))['db'];function respondWithStatusCode(_0x28a03a,_0x6602f1){_0x6602f1=_0x6602f1||0xcc;return function(_0xd55738){if(_0xd55738){return _0x28a03a[_0x1584('0x1a')](_0x6602f1);}return _0x28a03a[_0x1584('0x1b')](_0x6602f1)[_0x1584('0x1c')]();};}function respondWithResult(_0x166e38,_0x4b3536){_0x4b3536=_0x4b3536||0xc8;return function(_0x242a9c){if(_0x242a9c){return _0x166e38[_0x1584('0x1b')](_0x4b3536)['json'](_0x242a9c);}};}function respondWithFilteredResult(_0x3f7852,_0x56e682){return function(_0x2cd2dd){if(_0x2cd2dd){var _0x16e4be=typeof _0x56e682['offset']===_0x1584('0x1d')&&typeof _0x56e682[_0x1584('0x1e')]===_0x1584('0x1d');var _0x1fbcfc=_0x2cd2dd[_0x1584('0x1f')];var _0x4c0816=_0x16e4be?0x0:_0x56e682[_0x1584('0x20')];var _0x277fb5=_0x16e4be?_0x2cd2dd[_0x1584('0x1f')]:_0x56e682[_0x1584('0x20')]+_0x56e682[_0x1584('0x1e')];var _0x2fb172;if(_0x277fb5>=_0x1fbcfc){_0x277fb5=_0x1fbcfc;_0x2fb172=0xc8;}else{_0x2fb172=0xce;}_0x3f7852[_0x1584('0x1b')](_0x2fb172);return _0x3f7852[_0x1584('0x21')]('Content-Range',_0x4c0816+'-'+_0x277fb5+'/'+_0x1fbcfc)[_0x1584('0x22')](_0x2cd2dd);}return null;};}function patchUpdates(_0x2c09e1){return function(_0x3c837a){try{jsonpatch[_0x1584('0x23')](_0x3c837a,_0x2c09e1,!![]);}catch(_0x26d536){return BPromise[_0x1584('0x24')](_0x26d536);}return _0x3c837a[_0x1584('0x25')]();};}function saveUpdates(_0x320404,_0x520035){return function(_0x2dc842){if(_0x2dc842){return _0x2dc842['update'](_0x320404)[_0x1584('0x26')](function(_0x33844b){return _0x33844b;});}return null;};}function removeEntity(_0x4550c3,_0x44c8a2){return function(_0x29e659){if(_0x29e659){return _0x29e659[_0x1584('0x27')]()[_0x1584('0x26')](function(){_0x4550c3[_0x1584('0x1b')](0xcc)[_0x1584('0x1c')]();});}};}function handleEntityNotFound(_0x2fd850,_0x3097f4){return function(_0x12e258){if(!_0x12e258){_0x2fd850[_0x1584('0x1a')](0x194);}return _0x12e258;};}function handleError(_0x3fe582,_0x13311a){_0x13311a=_0x13311a||0x1f4;return function(_0x26c8a5){logger[_0x1584('0x28')](_0x26c8a5[_0x1584('0x29')]);if(_0x26c8a5['name']){delete _0x26c8a5[_0x1584('0x2a')];}_0x3fe582[_0x1584('0x1b')](_0x13311a)[_0x1584('0x2b')](_0x26c8a5);};}exports[_0x1584('0x2c')]=function(_0x3b405e,_0x4fb1da){var _0x488bae={},_0x31ee85={},_0x25b437={'count':0x0,'rows':[]};var _0x45a1b5=_[_0x1584('0x2d')](db['VoiceMailMessage'][_0x1584('0x2e')],function(_0x5e378c){return{'name':_0x5e378c[_0x1584('0x2f')],'type':_0x5e378c[_0x1584('0x30')]['key']};});_0x31ee85[_0x1584('0x31')]=_[_0x1584('0x32')](_[_0x1584('0x2d')](_0x45a1b5,_0x1584('0x2a')),[_0x1584('0x2a')]);_0x31ee85[_0x1584('0x33')]=_[_0x1584('0x34')](_0x3b405e[_0x1584('0x33')]);_0x31ee85[_0x1584('0x35')]=_[_0x1584('0x36')](_0x31ee85['model'],_0x31ee85[_0x1584('0x33')]);_0x488bae[_0x1584('0x37')]=_[_0x1584('0x36')](_0x31ee85[_0x1584('0x31')],qs[_0x1584('0x38')](_0x3b405e[_0x1584('0x33')][_0x1584('0x38')]));_0x488bae[_0x1584('0x37')]=_0x488bae[_0x1584('0x37')]['length']?_0x488bae[_0x1584('0x37')]:_0x31ee85['model'];if(!_0x3b405e[_0x1584('0x33')][_0x1584('0x39')](_0x1584('0x3a'))){_0x488bae[_0x1584('0x1e')]=qs[_0x1584('0x1e')](_0x3b405e[_0x1584('0x33')]['limit']);_0x488bae['offset']=qs[_0x1584('0x20')](_0x3b405e[_0x1584('0x33')][_0x1584('0x20')]);}_0x488bae[_0x1584('0x3b')]=qs[_0x1584('0x3c')](_0x3b405e[_0x1584('0x33')][_0x1584('0x3c')]);_0x488bae['where']=qs[_0x1584('0x35')](_['pick'](_0x3b405e[_0x1584('0x33')],_0x31ee85[_0x1584('0x35')]),_0x45a1b5);if(_0x3b405e[_0x1584('0x33')]['filter']){_0x488bae[_0x1584('0x3d')]=_[_0x1584('0x3e')](_0x488bae[_0x1584('0x3d')],{'$or':_['map'](_0x45a1b5,function(_0x3aa71f){if(_0x3aa71f[_0x1584('0x30')]!==_0x1584('0x3f')){var _0x86775b={};_0x86775b[_0x3aa71f['name']]={'$like':'%'+_0x3b405e['query'][_0x1584('0x40')]+'%'};return _0x86775b;}})});}_0x488bae=_['merge']({},_0x488bae,_0x3b405e[_0x1584('0x41')]);var _0x11f386={'where':_0x488bae[_0x1584('0x3d')]};return db[_0x1584('0x42')][_0x1584('0x1f')](_0x11f386)[_0x1584('0x26')](function(_0x232109){_0x25b437[_0x1584('0x1f')]=_0x232109;if(_0x3b405e[_0x1584('0x33')][_0x1584('0x43')]){_0x488bae['include']=[{'all':!![]}];}return db[_0x1584('0x42')][_0x1584('0x44')](_0x488bae);})[_0x1584('0x26')](function(_0x131436){_0x25b437['rows']=_0x131436;return _0x25b437;})[_0x1584('0x26')](respondWithFilteredResult(_0x4fb1da,_0x488bae))['catch'](handleError(_0x4fb1da,null));};exports[_0x1584('0x45')]=function(_0x5088b6,_0x54ff38){var _0x9ef9dc={'raw':!![],'where':{'id':_0x5088b6[_0x1584('0x46')]['id']}},_0x4c6aa9={};_0x4c6aa9['model']=_[_0x1584('0x34')](db[_0x1584('0x42')][_0x1584('0x2e')]);_0x4c6aa9[_0x1584('0x33')]=_[_0x1584('0x34')](_0x5088b6[_0x1584('0x33')]);_0x4c6aa9[_0x1584('0x35')]=_[_0x1584('0x36')](_0x4c6aa9[_0x1584('0x31')],_0x4c6aa9[_0x1584('0x33')]);_0x9ef9dc[_0x1584('0x37')]=_['intersection'](_0x4c6aa9[_0x1584('0x31')],qs['fields'](_0x5088b6[_0x1584('0x33')]['fields']));_0x9ef9dc[_0x1584('0x37')]=_0x9ef9dc[_0x1584('0x37')][_0x1584('0x47')]?_0x9ef9dc[_0x1584('0x37')]:_0x4c6aa9['model'];if(_0x5088b6[_0x1584('0x33')][_0x1584('0x43')]){_0x9ef9dc[_0x1584('0x48')]=[{'all':!![]}];}_0x9ef9dc=_[_0x1584('0x3e')]({},_0x9ef9dc,_0x5088b6[_0x1584('0x41')]);return db[_0x1584('0x42')][_0x1584('0x49')](_0x9ef9dc)[_0x1584('0x26')](handleEntityNotFound(_0x54ff38,null))['then'](respondWithResult(_0x54ff38,null))[_0x1584('0x4a')](handleError(_0x54ff38,null));};exports[_0x1584('0x4b')]=function(_0xe4b61e,_0x3beb77){return db[_0x1584('0x42')]['create'](_0xe4b61e[_0x1584('0x4c')],{})[_0x1584('0x26')](respondWithResult(_0x3beb77,0xc9))[_0x1584('0x4a')](handleError(_0x3beb77,null));};exports['update']=function(_0x26fe24,_0xc16284){if(_0x26fe24['body']['id']){delete _0x26fe24[_0x1584('0x4c')]['id'];}return db[_0x1584('0x42')]['find']({'where':{'id':_0x26fe24[_0x1584('0x46')]['id']}})[_0x1584('0x26')](handleEntityNotFound(_0xc16284,null))['then'](saveUpdates(_0x26fe24['body'],null))[_0x1584('0x26')](respondWithResult(_0xc16284,null))[_0x1584('0x4a')](handleError(_0xc16284,null));};exports['destroy']=function(_0x48df06,_0x1f6bee){return db[_0x1584('0x42')]['find']({'where':{'id':_0x48df06['params']['id']}})['then'](handleEntityNotFound(_0x1f6bee,null))[_0x1584('0x26')](removeEntity(_0x1f6bee,null))['catch'](handleError(_0x1f6bee,null));};exports[_0x1584('0x4d')]=function(_0x32272d,_0x3d3612,_0x56f954){return db[_0x1584('0x42')]['find']({'where':{'id':_0x32272d[_0x1584('0x46')]['id']},'attributes':['id','recording',_0x1584('0x4e')]})[_0x1584('0x26')](handleEntityNotFound(_0x3d3612,null))[_0x1584('0x26')](function(_0x282053){if(_0x282053){if(!_0x282053['recording']){throw new db[(_0x1584('0x4f'))]['ValidationError'](_0x1584('0x50'));}var _0x8b3c3e={'Content-Type':'audio/wav','Content-Disposition':_0x1584('0x51')};if(_0x282053['msg_id']){_0x8b3c3e['Content-Disposition']=_0x1584('0x52')+_0x282053[_0x1584('0x4e')]+'.wav\x22';}_0x3d3612[_0x1584('0x21')](_0x8b3c3e);return _0x3d3612['send'](new Buffer(_0x282053['recording']));}})['catch'](handleError(_0x3d3612,null));}; \ No newline at end of file +var _0x0dbf=['destroy','find','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','then','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','VoiceMailMessage','includeAll','include','findAll','catch','show','params','length','create','body','update'];(function(_0x5df843,_0x35331a){var _0x160f4f=function(_0x48a47d){while(--_0x48a47d){_0x5df843['push'](_0x5df843['shift']());}};_0x160f4f(++_0x35331a);}(_0x0dbf,0x1ab));var _0xf0db=function(_0x3ef8f7,_0x35359a){_0x3ef8f7=_0x3ef8f7-0x0;var _0x3b097e=_0x0dbf[_0x3ef8f7];return _0x3b097e;};'use strict';var emlformat=require(_0xf0db('0x0'));var rimraf=require(_0xf0db('0x1'));var zipdir=require(_0xf0db('0x2'));var jsonpatch=require(_0xf0db('0x3'));var rp=require(_0xf0db('0x4'));var moment=require(_0xf0db('0x5'));var BPromise=require(_0xf0db('0x6'));var Mustache=require(_0xf0db('0x7'));var util=require(_0xf0db('0x8'));var path=require('path');var sox=require(_0xf0db('0x9'));var csv=require(_0xf0db('0xa'));var ejs=require(_0xf0db('0xb'));var fs=require('fs');var fs_extra=require(_0xf0db('0xc'));var _=require(_0xf0db('0xd'));var squel=require(_0xf0db('0xe'));var crypto=require(_0xf0db('0xf'));var jsforce=require(_0xf0db('0x10'));var deskjs=require(_0xf0db('0x11'));var toCsv=require(_0xf0db('0xa'));var querystring=require(_0xf0db('0x12'));var Papa=require(_0xf0db('0x13'));var Redis=require('ioredis');var authService=require(_0xf0db('0x14'));var qs=require(_0xf0db('0x15'));var as=require(_0xf0db('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0db('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0db('0x18'));var db=require(_0xf0db('0x19'))['db'];function respondWithStatusCode(_0x15f33a,_0x1c8b59){_0x1c8b59=_0x1c8b59||0xcc;return function(_0x14b516){if(_0x14b516){return _0x15f33a['sendStatus'](_0x1c8b59);}return _0x15f33a[_0xf0db('0x1a')](_0x1c8b59)['end']();};}function respondWithResult(_0x78e5f4,_0x1f308c){_0x1f308c=_0x1f308c||0xc8;return function(_0x2978d7){if(_0x2978d7){return _0x78e5f4[_0xf0db('0x1a')](_0x1f308c)[_0xf0db('0x1b')](_0x2978d7);}};}function respondWithFilteredResult(_0x58ee15,_0x12e0d0){return function(_0xd1b855){if(_0xd1b855){var _0x5188f2=typeof _0x12e0d0[_0xf0db('0x1c')]==='undefined'&&typeof _0x12e0d0[_0xf0db('0x1d')]===_0xf0db('0x1e');var _0x3ee784=_0xd1b855[_0xf0db('0x1f')];var _0x556748=_0x5188f2?0x0:_0x12e0d0[_0xf0db('0x1c')];var _0x49fc8f=_0x5188f2?_0xd1b855[_0xf0db('0x1f')]:_0x12e0d0[_0xf0db('0x1c')]+_0x12e0d0[_0xf0db('0x1d')];var _0x44234b;if(_0x49fc8f>=_0x3ee784){_0x49fc8f=_0x3ee784;_0x44234b=0xc8;}else{_0x44234b=0xce;}_0x58ee15[_0xf0db('0x1a')](_0x44234b);return _0x58ee15['set'](_0xf0db('0x20'),_0x556748+'-'+_0x49fc8f+'/'+_0x3ee784)[_0xf0db('0x1b')](_0xd1b855);}return null;};}function patchUpdates(_0x1c897c){return function(_0x3fbd9f){try{jsonpatch[_0xf0db('0x21')](_0x3fbd9f,_0x1c897c,!![]);}catch(_0x128aa0){return BPromise['reject'](_0x128aa0);}return _0x3fbd9f['save']();};}function saveUpdates(_0x4cb4d,_0x3c6347){return function(_0x4b1f88){if(_0x4b1f88){return _0x4b1f88['update'](_0x4cb4d)[_0xf0db('0x22')](function(_0x4073a2){return _0x4073a2;});}return null;};}function removeEntity(_0x39fc14,_0x244160){return function(_0x471148){if(_0x471148){return _0x471148['destroy']()[_0xf0db('0x22')](function(){_0x39fc14[_0xf0db('0x1a')](0xcc)[_0xf0db('0x23')]();});}};}function handleEntityNotFound(_0x196455,_0x5e5b5a){return function(_0x592b4f){if(!_0x592b4f){_0x196455['sendStatus'](0x194);}return _0x592b4f;};}function handleError(_0x346505,_0x437e12){_0x437e12=_0x437e12||0x1f4;return function(_0x1894da){logger[_0xf0db('0x24')](_0x1894da[_0xf0db('0x25')]);if(_0x1894da[_0xf0db('0x26')]){delete _0x1894da[_0xf0db('0x26')];}_0x346505['status'](_0x437e12)[_0xf0db('0x27')](_0x1894da);};}exports[_0xf0db('0x28')]=function(_0x26dd44,_0x26423e){var _0x39ba0b={},_0x2638ef={},_0x22c4fa={'count':0x0,'rows':[]};var _0x4dd96b=_[_0xf0db('0x29')](db['VoiceMailMessage'][_0xf0db('0x2a')],function(_0x1b5a7b){return{'name':_0x1b5a7b['fieldName'],'type':_0x1b5a7b[_0xf0db('0x2b')][_0xf0db('0x2c')]};});_0x2638ef[_0xf0db('0x2d')]=_['differenceBy'](_[_0xf0db('0x29')](_0x4dd96b,'name'),[_0xf0db('0x26')]);_0x2638ef[_0xf0db('0x2e')]=_[_0xf0db('0x2f')](_0x26dd44[_0xf0db('0x2e')]);_0x2638ef['filters']=_[_0xf0db('0x30')](_0x2638ef['model'],_0x2638ef[_0xf0db('0x2e')]);_0x39ba0b['attributes']=_[_0xf0db('0x30')](_0x2638ef[_0xf0db('0x2d')],qs[_0xf0db('0x31')](_0x26dd44['query'][_0xf0db('0x31')]));_0x39ba0b['attributes']=_0x39ba0b[_0xf0db('0x32')]['length']?_0x39ba0b[_0xf0db('0x32')]:_0x2638ef[_0xf0db('0x2d')];if(!_0x26dd44[_0xf0db('0x2e')][_0xf0db('0x33')](_0xf0db('0x34'))){_0x39ba0b[_0xf0db('0x1d')]=qs['limit'](_0x26dd44['query'][_0xf0db('0x1d')]);_0x39ba0b[_0xf0db('0x1c')]=qs[_0xf0db('0x1c')](_0x26dd44[_0xf0db('0x2e')][_0xf0db('0x1c')]);}_0x39ba0b['order']=qs[_0xf0db('0x35')](_0x26dd44[_0xf0db('0x2e')]['sort']);_0x39ba0b[_0xf0db('0x36')]=qs['filters'](_[_0xf0db('0x37')](_0x26dd44['query'],_0x2638ef[_0xf0db('0x38')]),_0x4dd96b);if(_0x26dd44['query'][_0xf0db('0x39')]){_0x39ba0b['where']=_[_0xf0db('0x3a')](_0x39ba0b['where'],{'$or':_[_0xf0db('0x29')](_0x4dd96b,function(_0x26245b){if(_0x26245b[_0xf0db('0x2b')]!=='VIRTUAL'){var _0x3deee8={};_0x3deee8[_0x26245b['name']]={'$like':'%'+_0x26dd44['query'][_0xf0db('0x39')]+'%'};return _0x3deee8;}})});}_0x39ba0b=_[_0xf0db('0x3a')]({},_0x39ba0b,_0x26dd44[_0xf0db('0x3b')]);var _0x3b26a6={'where':_0x39ba0b['where']};return db[_0xf0db('0x3c')]['count'](_0x3b26a6)[_0xf0db('0x22')](function(_0x4e7b89){_0x22c4fa[_0xf0db('0x1f')]=_0x4e7b89;if(_0x26dd44[_0xf0db('0x2e')][_0xf0db('0x3d')]){_0x39ba0b[_0xf0db('0x3e')]=[{'all':!![]}];}return db[_0xf0db('0x3c')][_0xf0db('0x3f')](_0x39ba0b);})[_0xf0db('0x22')](function(_0x5e131d){_0x22c4fa['rows']=_0x5e131d;return _0x22c4fa;})[_0xf0db('0x22')](respondWithFilteredResult(_0x26423e,_0x39ba0b))[_0xf0db('0x40')](handleError(_0x26423e,null));};exports[_0xf0db('0x41')]=function(_0x394e91,_0x2e5407){var _0x4c3bc0={'raw':!![],'where':{'id':_0x394e91[_0xf0db('0x42')]['id']}},_0x285d88={};_0x285d88[_0xf0db('0x2d')]=_[_0xf0db('0x2f')](db[_0xf0db('0x3c')]['rawAttributes']);_0x285d88[_0xf0db('0x2e')]=_[_0xf0db('0x2f')](_0x394e91[_0xf0db('0x2e')]);_0x285d88[_0xf0db('0x38')]=_['intersection'](_0x285d88[_0xf0db('0x2d')],_0x285d88['query']);_0x4c3bc0[_0xf0db('0x32')]=_[_0xf0db('0x30')](_0x285d88[_0xf0db('0x2d')],qs[_0xf0db('0x31')](_0x394e91[_0xf0db('0x2e')][_0xf0db('0x31')]));_0x4c3bc0[_0xf0db('0x32')]=_0x4c3bc0[_0xf0db('0x32')][_0xf0db('0x43')]?_0x4c3bc0[_0xf0db('0x32')]:_0x285d88[_0xf0db('0x2d')];if(_0x394e91['query'][_0xf0db('0x3d')]){_0x4c3bc0['include']=[{'all':!![]}];}_0x4c3bc0=_[_0xf0db('0x3a')]({},_0x4c3bc0,_0x394e91[_0xf0db('0x3b')]);return db[_0xf0db('0x3c')]['find'](_0x4c3bc0)[_0xf0db('0x22')](handleEntityNotFound(_0x2e5407,null))['then'](respondWithResult(_0x2e5407,null))[_0xf0db('0x40')](handleError(_0x2e5407,null));};exports['create']=function(_0xbb9822,_0x279827){return db[_0xf0db('0x3c')][_0xf0db('0x44')](_0xbb9822[_0xf0db('0x45')],{})[_0xf0db('0x22')](respondWithResult(_0x279827,0xc9))[_0xf0db('0x40')](handleError(_0x279827,null));};exports[_0xf0db('0x46')]=function(_0x2cf85b,_0x2a8e1e){if(_0x2cf85b[_0xf0db('0x45')]['id']){delete _0x2cf85b['body']['id'];}return db[_0xf0db('0x3c')]['find']({'where':{'id':_0x2cf85b[_0xf0db('0x42')]['id']}})['then'](handleEntityNotFound(_0x2a8e1e,null))[_0xf0db('0x22')](saveUpdates(_0x2cf85b[_0xf0db('0x45')],null))['then'](respondWithResult(_0x2a8e1e,null))['catch'](handleError(_0x2a8e1e,null));};exports[_0xf0db('0x47')]=function(_0x21d02e,_0x1d3f6a){return db[_0xf0db('0x3c')][_0xf0db('0x48')]({'where':{'id':_0x21d02e[_0xf0db('0x42')]['id']}})[_0xf0db('0x22')](handleEntityNotFound(_0x1d3f6a,null))[_0xf0db('0x22')](removeEntity(_0x1d3f6a,null))[_0xf0db('0x40')](handleError(_0x1d3f6a,null));};exports[_0xf0db('0x49')]=function(_0x3fe5cf,_0x16b1eb,_0x554106){return db[_0xf0db('0x3c')]['find']({'where':{'id':_0x3fe5cf[_0xf0db('0x42')]['id']},'attributes':['id',_0xf0db('0x4a'),_0xf0db('0x4b')]})['then'](handleEntityNotFound(_0x16b1eb,null))[_0xf0db('0x22')](function(_0x1243cc){if(_0x1243cc){if(!_0x1243cc[_0xf0db('0x4a')]){throw new db[(_0xf0db('0x4c'))][(_0xf0db('0x4d'))](_0xf0db('0x4e'));}var _0x2453ce={'Content-Type':_0xf0db('0x4f'),'Content-Disposition':'attachment'};if(_0x1243cc[_0xf0db('0x4b')]){_0x2453ce['Content-Disposition']=_0xf0db('0x50')+_0x1243cc['msg_id']+_0xf0db('0x51');}_0x16b1eb[_0xf0db('0x52')](_0x2453ce);return _0x16b1eb[_0xf0db('0x27')](new Buffer(_0x1243cc[_0xf0db('0x4a')]));}})['catch'](handleError(_0x16b1eb,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index cb2b507..01830d2 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 _0x0188=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0xec5b5d,_0x106a4e){var _0x5a65e9=function(_0x4326fc){while(--_0x4326fc){_0xec5b5d['push'](_0xec5b5d['shift']());}};_0x5a65e9(++_0x106a4e);}(_0x0188,0x129));var _0x8018=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x0188[_0x4b03c9];return _0x161ba2;};'use strict';var _=require(_0x8018('0x0'));var util=require(_0x8018('0x1'));var logger=require(_0x8018('0x2'))(_0x8018('0x3'));var moment=require(_0x8018('0x4'));var BPromise=require(_0x8018('0x5'));var rp=require(_0x8018('0x6'));var fs=require('fs');var path=require(_0x8018('0x7'));var rimraf=require(_0x8018('0x8'));var config=require(_0x8018('0x9'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x1ab90f,_0x14e120){return _0x1ab90f[_0x8018('0xa')](_0x8018('0xb'),attributes,{'tableName':_0x8018('0xc'),'paranoid':![],'indexes':[{'name':_0x8018('0xd'),'fields':[_0x8018('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xca68=['moment','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api'];(function(_0x4855fa,_0x490cf3){var _0x4b7a91=function(_0x456ec7){while(--_0x456ec7){_0x4855fa['push'](_0x4855fa['shift']());}};_0x4b7a91(++_0x490cf3);}(_0xca68,0x14c));var _0x8ca6=function(_0x132926,_0x135ad7){_0x132926=_0x132926-0x0;var _0x164533=_0xca68[_0x132926];return _0x164533;};'use strict';var _=require(_0x8ca6('0x0'));var util=require(_0x8ca6('0x1'));var logger=require(_0x8ca6('0x2'))(_0x8ca6('0x3'));var moment=require(_0x8ca6('0x4'));var BPromise=require(_0x8ca6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ca6('0x6'));var rimraf=require(_0x8ca6('0x7'));var config=require(_0x8ca6('0x8'));var attributes=require(_0x8ca6('0x9'));module['exports']=function(_0x4d6a2a,_0x12258e){return _0x4d6a2a[_0x8ca6('0xa')](_0x8ca6('0xb'),attributes,{'tableName':_0x8ca6('0xc'),'paranoid':![],'indexes':[{'name':_0x8ca6('0xd'),'fields':[_0x8ca6('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c004aa8..a69f894 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 _0xd2f4=['client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4af177,_0x1dd882){var _0x6a65bc=function(_0x47d64f){while(--_0x47d64f){_0x4af177['push'](_0x4af177['shift']());}};_0x6a65bc(++_0x1dd882);}(_0xd2f4,0xae));var _0x4d2f=function(_0x42dfd1,_0x13f4d4){_0x42dfd1=_0x42dfd1-0x0;var _0x3b573c=_0xd2f4[_0x42dfd1];return _0x3b573c;};'use strict';var _=require(_0x4d2f('0x0'));var util=require(_0x4d2f('0x1'));var moment=require(_0x4d2f('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d2f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d2f('0x4'))['db'];var utils=require(_0x4d2f('0x5'));var logger=require(_0x4d2f('0x6'))(_0x4d2f('0x7'));var config=require(_0x4d2f('0x8'));var jayson=require(_0x4d2f('0x9'));var client=jayson[_0x4d2f('0xa')][_0x4d2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57e8d8,_0x5a6bc1,_0x3ca396){return new BPromise(function(_0x3b4bb4,_0x33251a){return client['request'](_0x57e8d8,_0x3ca396)[_0x4d2f('0xc')](function(_0x3e8d7b){logger[_0x4d2f('0xd')](_0x4d2f('0xe'),_0x5a6bc1,_0x4d2f('0xf'));logger['debug'](_0x4d2f('0x10'),_0x5a6bc1,_0x4d2f('0xf'),JSON[_0x4d2f('0x11')](_0x3e8d7b));if(_0x3e8d7b[_0x4d2f('0x12')]){if(_0x3e8d7b[_0x4d2f('0x12')][_0x4d2f('0x13')]===0x1f4){logger['error'](_0x4d2f('0xe'),_0x5a6bc1,_0x3e8d7b[_0x4d2f('0x12')][_0x4d2f('0x14')]);return _0x33251a(_0x3e8d7b[_0x4d2f('0x12')][_0x4d2f('0x14')]);}logger[_0x4d2f('0x12')](_0x4d2f('0xe'),_0x5a6bc1,_0x3e8d7b[_0x4d2f('0x12')][_0x4d2f('0x14')]);return _0x3b4bb4(_0x3e8d7b[_0x4d2f('0x12')]['message']);}else{logger[_0x4d2f('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x5a6bc1,_0x4d2f('0xf'));_0x3b4bb4(_0x3e8d7b[_0x4d2f('0x15')]['message']);}})[_0x4d2f('0x16')](function(_0x2a819e){logger[_0x4d2f('0x12')](_0x4d2f('0xe'),_0x5a6bc1,_0x2a819e);_0x33251a(_0x2a819e);});});} \ No newline at end of file +var _0x9df0=['debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x8568fe,_0x22eb12){var _0x1aedbe=function(_0x4fccd0){while(--_0x4fccd0){_0x8568fe['push'](_0x8568fe['shift']());}};_0x1aedbe(++_0x22eb12);}(_0x9df0,0x197));var _0x09df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9df0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x09df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x09df('0x1'));var rs=require(_0x09df('0x2'));var fs=require('fs');var Redis=require(_0x09df('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09df('0x4'));var logger=require('../../config/logger')(_0x09df('0x5'));var config=require(_0x09df('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x09df('0x7')][_0x09df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x128153,_0x823bf5,_0x25a3af){return new BPromise(function(_0x223683,_0x2178a0){return client[_0x09df('0x9')](_0x128153,_0x25a3af)[_0x09df('0xa')](function(_0x3811e0){logger[_0x09df('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x823bf5,_0x09df('0xc'));logger[_0x09df('0xd')](_0x09df('0xe'),_0x823bf5,_0x09df('0xc'),JSON['stringify'](_0x3811e0));if(_0x3811e0[_0x09df('0xf')]){if(_0x3811e0[_0x09df('0xf')][_0x09df('0x10')]===0x1f4){logger[_0x09df('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x823bf5,_0x3811e0[_0x09df('0xf')][_0x09df('0x11')]);return _0x2178a0(_0x3811e0[_0x09df('0xf')][_0x09df('0x11')]);}logger[_0x09df('0xf')](_0x09df('0x12'),_0x823bf5,_0x3811e0[_0x09df('0xf')][_0x09df('0x11')]);return _0x223683(_0x3811e0['error']['message']);}else{logger['info'](_0x09df('0x12'),_0x823bf5,_0x09df('0xc'));_0x223683(_0x3811e0[_0x09df('0x13')][_0x09df('0x11')]);}})['catch'](function(_0x3f9d9f){logger['error'](_0x09df('0x12'),_0x823bf5,_0x3f9d9f);_0x2178a0(_0x3f9d9f);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 99b34c4..4dda645 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 _0xae85=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','/:id','show','get','/:id/sounds','getSounds','create','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2feb55,_0x2b0dbf){var _0x1ddff7=function(_0x181e22){while(--_0x181e22){_0x2feb55['push'](_0x2feb55['shift']());}};_0x1ddff7(++_0x2b0dbf);}(_0xae85,0x173));var _0x5ae8=function(_0x16748c,_0x485da4){_0x16748c=_0x16748c-0x0;var _0x205974=_0xae85[_0x16748c];return _0x205974;};'use strict';var multer=require(_0x5ae8('0x0'));var util=require(_0x5ae8('0x1'));var path=require('path');var timeout=require(_0x5ae8('0x2'));var express=require(_0x5ae8('0x3'));var router=express[_0x5ae8('0x4')]();var fs_extra=require(_0x5ae8('0x5'));var auth=require(_0x5ae8('0x6'));var interaction=require(_0x5ae8('0x7'));var config=require(_0x5ae8('0x8'));var controller=require(_0x5ae8('0x9'));router['get']('/',auth[_0x5ae8('0xa')](),controller[_0x5ae8('0xb')]);router['get'](_0x5ae8('0xc'),auth[_0x5ae8('0xa')](),controller[_0x5ae8('0xd')]);router[_0x5ae8('0xe')](_0x5ae8('0xf'),auth['isAuthenticated'](),controller[_0x5ae8('0x10')]);router['post']('/',auth[_0x5ae8('0xa')](),controller[_0x5ae8('0x11')]);router[_0x5ae8('0x12')](_0x5ae8('0xf'),auth[_0x5ae8('0xa')](),controller[_0x5ae8('0x13')]);router[_0x5ae8('0x14')](_0x5ae8('0xc'),auth[_0x5ae8('0xa')](),controller[_0x5ae8('0x15')]);router[_0x5ae8('0x16')]('/:id',auth[_0x5ae8('0xa')](),controller[_0x5ae8('0x17')]);router[_0x5ae8('0x16')](_0x5ae8('0x18'),auth[_0x5ae8('0xa')](),controller[_0x5ae8('0x19')]);module[_0x5ae8('0x1a')]=router; \ No newline at end of file +var _0x82fc=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','index','/:id','isAuthenticated','show','/:id/sounds','post','create','addSound','update','delete','removeSound','util'];(function(_0x54165e,_0x33fc32){var _0x1a2142=function(_0x322d1c){while(--_0x322d1c){_0x54165e['push'](_0x54165e['shift']());}};_0x1a2142(++_0x33fc32);}(_0x82fc,0x155));var _0xc82f=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x82fc[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0xc82f('0x0'));var path=require(_0xc82f('0x1'));var timeout=require('connect-timeout');var express=require(_0xc82f('0x2'));var router=express[_0xc82f('0x3')]();var fs_extra=require(_0xc82f('0x4'));var auth=require(_0xc82f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc82f('0x6'));var controller=require(_0xc82f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc82f('0x8')]);router['get'](_0xc82f('0x9'),auth[_0xc82f('0xa')](),controller[_0xc82f('0xb')]);router['get'](_0xc82f('0xc'),auth[_0xc82f('0xa')](),controller['getSounds']);router[_0xc82f('0xd')]('/',auth[_0xc82f('0xa')](),controller[_0xc82f('0xe')]);router[_0xc82f('0xd')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xc82f('0xf')]);router['put'](_0xc82f('0x9'),auth['isAuthenticated'](),controller[_0xc82f('0x10')]);router['delete'](_0xc82f('0x9'),auth[_0xc82f('0xa')](),controller['destroy']);router[_0xc82f('0x11')]('/:id/sounds/:id2',auth[_0xc82f('0xa')](),controller[_0xc82f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c9d3f79..0427d08 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 _0x4d79=['alpha','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb'];(function(_0x1ef113,_0x3600a7){var _0x367b61=function(_0x56ce67){while(--_0x56ce67){_0x1ef113['push'](_0x1ef113['shift']());}};_0x367b61(++_0x3600a7);}(_0x4d79,0x17b));var _0x94d7=function(_0x2df2d0,_0x1d6ea8){_0x2df2d0=_0x2df2d0-0x0;var _0x3c4438=_0x4d79[_0x2df2d0];return _0x3c4438;};'use strict';var Sequelize=require(_0x94d7('0x0'));module[_0x94d7('0x1')]={'name':{'type':Sequelize[_0x94d7('0x2')],'allowNull':![],'unique':_0x94d7('0x3')},'mode':{'type':Sequelize[_0x94d7('0x4')](_0x94d7('0x5'),_0x94d7('0x6'),_0x94d7('0x7'),'quietmp3nb','quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x94d7('0x6')},'directory':{'type':Sequelize[_0x94d7('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x94d7('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x94d7('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x94d7('0x2')],'allowNull':!![],'defaultValue':_0x94d7('0x8')},'format':{'type':Sequelize[_0x94d7('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0826=['TIMESTAMP','sequelize','exports','STRING','name','ENUM','custom','mp3nb','quietmp3nb','quietmp3','mp3','files','alpha'];(function(_0x4e45af,_0x527553){var _0x3add70=function(_0x45423f){while(--_0x45423f){_0x4e45af['push'](_0x4e45af['shift']());}};_0x3add70(++_0x527553);}(_0x0826,0x194));var _0x6082=function(_0x1d2896,_0x35f34e){_0x1d2896=_0x1d2896-0x0;var _0x13c164=_0x0826[_0x1d2896];return _0x13c164;};'use strict';var Sequelize=require(_0x6082('0x0'));module[_0x6082('0x1')]={'name':{'type':Sequelize[_0x6082('0x2')],'allowNull':![],'unique':_0x6082('0x3')},'mode':{'type':Sequelize[_0x6082('0x4')](_0x6082('0x5'),'files',_0x6082('0x6'),_0x6082('0x7'),_0x6082('0x8'),_0x6082('0x9')),'allowNull':!![],'defaultValue':_0x6082('0xa')},'directory':{'type':Sequelize[_0x6082('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x6082('0x2')],'allowNull':!![],'defaultValue':_0x6082('0xb')},'format':{'type':Sequelize[_0x6082('0x2')],'allowNull':!![]},'stamp':{'type':_0x6082('0xc')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 0b90973..114f504 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 _0x9e96=['pick','merge','filter','options','VoiceMusicOnHold','includeAll','include','rows','catch','keys','rawAttributes','body','params','sequelize','transaction','files','directory','join','root','server/files/moh','create','mode','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','addSound','findOne','createdAt','%s.%s','basename','save_name','extname','converted_format','format','message','removeSound','id2','Sound','length','getSounds','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','MusicOnHolds','error','stack','name','send','index','map','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x59ec0f,_0x59f7f5){var _0x53525b=function(_0x2f9464){while(--_0x2f9464){_0x59ec0f['push'](_0x59ec0f['shift']());}};_0x53525b(++_0x59f7f5);}(_0x9e96,0x1e7));var _0x69e9=function(_0x5b6a88,_0xad9b5a){_0x5b6a88=_0x5b6a88-0x0;var _0x4009e4=_0x9e96[_0x5b6a88];return _0x4009e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69e9('0x0'));var zipdir=require(_0x69e9('0x1'));var jsonpatch=require(_0x69e9('0x2'));var rp=require(_0x69e9('0x3'));var moment=require(_0x69e9('0x4'));var BPromise=require(_0x69e9('0x5'));var Mustache=require('mustache');var util=require(_0x69e9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x69e9('0x7'));var ejs=require(_0x69e9('0x8'));var fs=require('fs');var fs_extra=require(_0x69e9('0x9'));var _=require(_0x69e9('0xa'));var squel=require(_0x69e9('0xb'));var crypto=require(_0x69e9('0xc'));var jsforce=require(_0x69e9('0xd'));var deskjs=require(_0x69e9('0xe'));var toCsv=require(_0x69e9('0x7'));var querystring=require(_0x69e9('0xf'));var Papa=require('papaparse');var Redis=require(_0x69e9('0x10'));var authService=require(_0x69e9('0x11'));var qs=require(_0x69e9('0x12'));var as=require(_0x69e9('0x13'));var hardwareService=require(_0x69e9('0x14'));var logger=require('../../config/logger')(_0x69e9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x69e9('0x16'));var db=require(_0x69e9('0x17'))['db'];function respondWithStatusCode(_0x48e817,_0xeb012d){_0xeb012d=_0xeb012d||0xcc;return function(_0x3bcebf){if(_0x3bcebf){return _0x48e817[_0x69e9('0x18')](_0xeb012d);}return _0x48e817[_0x69e9('0x19')](_0xeb012d)[_0x69e9('0x1a')]();};}function respondWithResult(_0x212cb5,_0x3c20b5){_0x3c20b5=_0x3c20b5||0xc8;return function(_0x39fdd3){if(_0x39fdd3){return _0x212cb5[_0x69e9('0x19')](_0x3c20b5)[_0x69e9('0x1b')](_0x39fdd3);}};}function respondWithFilteredResult(_0x3a3970,_0x2ef1bf){return function(_0x6656f4){if(_0x6656f4){var _0x5e9743=typeof _0x2ef1bf[_0x69e9('0x1c')]===_0x69e9('0x1d')&&typeof _0x2ef1bf[_0x69e9('0x1e')]===_0x69e9('0x1d');var _0x561420=_0x6656f4['count'];var _0xaffdaf=_0x5e9743?0x0:_0x2ef1bf['offset'];var _0x185127=_0x5e9743?_0x6656f4[_0x69e9('0x1f')]:_0x2ef1bf[_0x69e9('0x1c')]+_0x2ef1bf['limit'];var _0x33e268;if(_0x185127>=_0x561420){_0x185127=_0x561420;_0x33e268=0xc8;}else{_0x33e268=0xce;}_0x3a3970[_0x69e9('0x19')](_0x33e268);return _0x3a3970[_0x69e9('0x20')](_0x69e9('0x21'),_0xaffdaf+'-'+_0x185127+'/'+_0x561420)[_0x69e9('0x1b')](_0x6656f4);}return null;};}function patchUpdates(_0x212c42){return function(_0x3e5682){try{jsonpatch[_0x69e9('0x22')](_0x3e5682,_0x212c42,!![]);}catch(_0x151b5c){return BPromise[_0x69e9('0x23')](_0x151b5c);}return _0x3e5682[_0x69e9('0x24')]();};}function saveUpdates(_0x4a712d,_0x1c64d2){return function(_0x35553e){if(_0x35553e){return _0x35553e[_0x69e9('0x25')](_0x4a712d)[_0x69e9('0x26')](function(_0x4a46e9){return _0x4a46e9;});}return null;};}function removeEntity(_0x8c8081,_0x475575){return function(_0xabbc79){if(_0xabbc79){return _0xabbc79[_0x69e9('0x27')]()[_0x69e9('0x26')](function(){var _0x51b896=_0xabbc79['get']({'plain':!![]});var _0x2d85e9=_0x69e9('0x28');return db['UserProfileResource'][_0x69e9('0x27')]({'where':{'type':_0x2d85e9,'resourceId':_0x51b896['id']}})[_0x69e9('0x26')](function(){return _0xabbc79;});})['then'](function(){_0x8c8081[_0x69e9('0x19')](0xcc)[_0x69e9('0x1a')]();});}};}function handleEntityNotFound(_0x56c7b7,_0x3b4209){return function(_0x455ec9){if(!_0x455ec9){_0x56c7b7['sendStatus'](0x194);}return _0x455ec9;};}function handleError(_0x2e45cf,_0x1e0b19){_0x1e0b19=_0x1e0b19||0x1f4;return function(_0x5c41b3){logger[_0x69e9('0x29')](_0x5c41b3[_0x69e9('0x2a')]);if(_0x5c41b3[_0x69e9('0x2b')]){delete _0x5c41b3[_0x69e9('0x2b')];}_0x2e45cf[_0x69e9('0x19')](_0x1e0b19)[_0x69e9('0x2c')](_0x5c41b3);};}exports[_0x69e9('0x2d')]=function(_0x11f130,_0x256e30){var _0x2ccbf8={},_0x2b0b65={},_0x54b484={'count':0x0,'rows':[]};var _0x411d79=_[_0x69e9('0x2e')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x46a508){return{'name':_0x46a508['fieldName'],'type':_0x46a508[_0x69e9('0x2f')]['key']};});_0x2b0b65[_0x69e9('0x30')]=_['map'](_0x411d79,_0x69e9('0x2b'));_0x2b0b65[_0x69e9('0x31')]=_['keys'](_0x11f130[_0x69e9('0x31')]);_0x2b0b65['filters']=_[_0x69e9('0x32')](_0x2b0b65[_0x69e9('0x30')],_0x2b0b65[_0x69e9('0x31')]);_0x2ccbf8[_0x69e9('0x33')]=_[_0x69e9('0x32')](_0x2b0b65[_0x69e9('0x30')],qs[_0x69e9('0x34')](_0x11f130['query']['fields']));_0x2ccbf8[_0x69e9('0x33')]=_0x2ccbf8['attributes']['length']?_0x2ccbf8[_0x69e9('0x33')]:_0x2b0b65[_0x69e9('0x30')];if(!_0x11f130[_0x69e9('0x31')][_0x69e9('0x35')](_0x69e9('0x36'))){_0x2ccbf8['limit']=qs[_0x69e9('0x1e')](_0x11f130[_0x69e9('0x31')][_0x69e9('0x1e')]);_0x2ccbf8[_0x69e9('0x1c')]=qs['offset'](_0x11f130[_0x69e9('0x31')]['offset']);}_0x2ccbf8['order']=qs[_0x69e9('0x37')](_0x11f130['query'][_0x69e9('0x37')]);delete _0x11f130['query'][_0x69e9('0x37')];_0x2ccbf8[_0x69e9('0x38')]=qs[_0x69e9('0x39')](_[_0x69e9('0x3a')](_0x11f130['query'],_0x2b0b65['filters']),_0x411d79);if(_0x11f130[_0x69e9('0x31')]['filter']){_0x2ccbf8[_0x69e9('0x38')]=_[_0x69e9('0x3b')](_0x2ccbf8[_0x69e9('0x38')],{'$or':_[_0x69e9('0x2e')](_0x411d79,function(_0x33371e){if(_0x33371e[_0x69e9('0x2f')]!=='VIRTUAL'){var _0x59fb90={};_0x59fb90[_0x33371e[_0x69e9('0x2b')]]={'$like':'%'+_0x11f130[_0x69e9('0x31')][_0x69e9('0x3c')]+'%'};return _0x59fb90;}})});}_0x2ccbf8=_[_0x69e9('0x3b')]({},_0x2ccbf8,_0x11f130[_0x69e9('0x3d')]);var _0x1658e7={'where':_0x2ccbf8['where']};return db[_0x69e9('0x3e')][_0x69e9('0x1f')](_0x1658e7)['then'](function(_0x20e8d5){_0x54b484[_0x69e9('0x1f')]=_0x20e8d5;if(_0x11f130['query'][_0x69e9('0x3f')]){_0x2ccbf8[_0x69e9('0x40')]=[{'all':!![]}];}return db[_0x69e9('0x3e')]['findAll'](_0x2ccbf8);})[_0x69e9('0x26')](function(_0x33e16e){_0x54b484[_0x69e9('0x41')]=_0x33e16e;return _0x54b484;})[_0x69e9('0x26')](respondWithFilteredResult(_0x256e30,_0x2ccbf8))[_0x69e9('0x42')](handleError(_0x256e30,null));};exports['show']=function(_0x28a3fc,_0x5fd1dd){var _0x2f84d6={'raw':![],'where':{'id':_0x28a3fc['params']['id']}},_0x29cba0={};_0x29cba0['model']=_[_0x69e9('0x43')](db[_0x69e9('0x3e')][_0x69e9('0x44')]);_0x29cba0[_0x69e9('0x31')]=_[_0x69e9('0x43')](_0x28a3fc[_0x69e9('0x31')]);_0x29cba0['filters']=_['intersection'](_0x29cba0[_0x69e9('0x30')],_0x29cba0[_0x69e9('0x31')]);_0x2f84d6[_0x69e9('0x33')]=_[_0x69e9('0x32')](_0x29cba0['model'],qs[_0x69e9('0x34')](_0x28a3fc[_0x69e9('0x31')][_0x69e9('0x34')]));_0x2f84d6[_0x69e9('0x33')]=_0x2f84d6['attributes']['length']?_0x2f84d6[_0x69e9('0x33')]:_0x29cba0[_0x69e9('0x30')];if(_0x28a3fc[_0x69e9('0x31')]['includeAll']){_0x2f84d6[_0x69e9('0x40')]=[{'all':!![]}];}_0x2f84d6=_[_0x69e9('0x3b')]({},_0x2f84d6,_0x28a3fc['options']);return db[_0x69e9('0x3e')]['find'](_0x2f84d6)['then'](handleEntityNotFound(_0x5fd1dd,null))[_0x69e9('0x26')](respondWithResult(_0x5fd1dd,null))[_0x69e9('0x42')](handleError(_0x5fd1dd,null));};exports[_0x69e9('0x25')]=function(_0x1c762c,_0x288c13){if(_0x1c762c[_0x69e9('0x45')]['id']){delete _0x1c762c[_0x69e9('0x45')]['id'];}return db[_0x69e9('0x3e')]['find']({'where':{'id':_0x1c762c[_0x69e9('0x46')]['id']}})[_0x69e9('0x26')](handleEntityNotFound(_0x288c13,null))[_0x69e9('0x26')](saveUpdates(_0x1c762c['body'],null))[_0x69e9('0x26')](respondWithResult(_0x288c13,null))['catch'](handleError(_0x288c13,null));};exports['create']=function(_0x226a1a,_0x494a75,_0x1c456d){return db[_0x69e9('0x47')][_0x69e9('0x48')](function(_0x26e268){if(_0x226a1a[_0x69e9('0x45')]['mode']===_0x69e9('0x49')){_0x226a1a['body'][_0x69e9('0x4a')]=path[_0x69e9('0x4b')](config[_0x69e9('0x4c')],_0x69e9('0x4d'),_0x226a1a[_0x69e9('0x45')][_0x69e9('0x2b')]);}return db[_0x69e9('0x3e')][_0x69e9('0x4e')](_0x226a1a[_0x69e9('0x45')],{'transaction':_0x26e268})['then'](function(_0x58b020){if(_0x226a1a['body'][_0x69e9('0x4f')]===_0x69e9('0x49')){fs['mkdirSync'](_0x58b020['directory'],parseInt(_0x69e9('0x50'),0x8));}var _0x520c08=_0x226a1a[_0x69e9('0x51')][_0x69e9('0x52')]({'plain':!![]});if(!_0x520c08)throw new Error(_0x69e9('0x53'));if(_0x520c08[_0x69e9('0x54')]===_0x69e9('0x51')){var _0x2ab233=_0x58b020[_0x69e9('0x52')]({'plain':!![]});return db[_0x69e9('0x55')][_0x69e9('0x56')]({'where':{'name':_0x69e9('0x28'),'userProfileId':_0x520c08['userProfileId']},'raw':!![]})[_0x69e9('0x26')](function(_0x21288d){if(_0x21288d&&_0x21288d['autoAssociation']===0x0){return db[_0x69e9('0x57')][_0x69e9('0x4e')]({'name':_0x2ab233[_0x69e9('0x2b')],'resourceId':_0x2ab233['id'],'type':_0x21288d['name'],'sectionId':_0x21288d['id']},{})[_0x69e9('0x26')](function(){return _0x58b020;});}else{return _0x58b020;}})[_0x69e9('0x42')](function(_0x1c10be){logger['error'](_0x69e9('0x58'),_0x1c10be);});}return _0x58b020;});})[_0x69e9('0x26')](respondWithResult(_0x494a75,0xc9))[_0x69e9('0x42')](handleError(_0x494a75,null));};exports['destroy']=function(_0x5694b8,_0x32603b,_0x3e8e45){var _0xfdcdba;return db[_0x69e9('0x3e')][_0x69e9('0x56')]({'where':{'id':_0x5694b8['params']['id']}})[_0x69e9('0x26')](function(_0x171ca0){if(_0x171ca0){return db[_0x69e9('0x47')]['transaction'](function(_0x2c45b9){return _0x171ca0[_0x69e9('0x27')]({'transaction':_0x2c45b9,'raw':!![]})[_0x69e9('0x26')](function(_0x43efd8){if(_0x43efd8[_0x69e9('0x4a')]){fs[_0x69e9('0x59')](_0x43efd8[_0x69e9('0x4a')])[_0x69e9('0x5a')](function(_0xd80978){fs[_0x69e9('0x5b')](path['join'](_0x43efd8[_0x69e9('0x4a')],_0xd80978));});fs['rmdirSync'](_0x43efd8[_0x69e9('0x4a')]);}return _0x43efd8;});})[_0x69e9('0x42')](function(_0x308edb){throw new db[(_0x69e9('0x5c'))][(_0x69e9('0x5d'))](_0x308edb['message']);});}})['then'](handleEntityNotFound(_0x32603b,null))[_0x69e9('0x26')](removeEntity(_0x32603b,null))[_0x69e9('0x42')](handleError(_0x32603b,null));};exports[_0x69e9('0x5e')]=function(_0xe27541,_0x51fa1a,_0x400f13){return db[_0x69e9('0x47')][_0x69e9('0x48')](function(_0x53ee1b){var _0x5ddd93;return db['VoiceMusicOnHold'][_0x69e9('0x56')]({'where':{'id':_0xe27541[_0x69e9('0x46')]['id']}})['then'](function(_0x27db89){if(_0x27db89){_0x5ddd93=_0x27db89;return _0x27db89['addSound'](_0xe27541['body']['id'],{'transaction':_0x53ee1b});}})[_0x69e9('0x26')](function(_0x4c888a){if(_0x4c888a){return db['Sound'][_0x69e9('0x5f')]({'where':{'id':_0xe27541[_0x69e9('0x45')]['id']},'attributes':['id',_0x69e9('0x2b'),'save_name','converted_format',_0x69e9('0x60')],'raw':!![]});}})[_0x69e9('0x26')](function(_0x2aa182){if(_0x2aa182){var _0x427b5c=path[_0x69e9('0x4b')](config['root'],'server/files/sounds/converted',util['format'](_0x69e9('0x61'),path[_0x69e9('0x62')](_0x2aa182[_0x69e9('0x63')],path[_0x69e9('0x64')](_0x2aa182[_0x69e9('0x63')])),_0x2aa182[_0x69e9('0x65')]));var _0x4f47fc=path['join'](config[_0x69e9('0x4c')],_0x69e9('0x4d'),_0x5ddd93['name'],util[_0x69e9('0x66')](_0x69e9('0x61'),_0x2aa182[_0x69e9('0x2b')],_0x2aa182[_0x69e9('0x65')]));fs['symlinkSync'](_0x427b5c,_0x4f47fc);return _0x2aa182;}})[_0x69e9('0x42')](function(_0x4a3738){throw new db[(_0x69e9('0x5c'))][(_0x69e9('0x5d'))](_0x4a3738[_0x69e9('0x67')]);});})['then'](handleEntityNotFound(_0x51fa1a,null))[_0x69e9('0x26')](respondWithResult(_0x51fa1a,0xc9))[_0x69e9('0x42')](handleError(_0x51fa1a,null));};exports[_0x69e9('0x68')]=function(_0x52bc42,_0x26b35c,_0x2f7ac2){return db['sequelize'][_0x69e9('0x48')](function(_0x4db2d1){var _0x37d8ac;return db[_0x69e9('0x3e')]['findOne']({'where':{'id':_0x52bc42[_0x69e9('0x46')]['id']}})[_0x69e9('0x26')](handleEntityNotFound(_0x26b35c,null))['then'](function(_0x15c6ca){if(_0x15c6ca){_0x37d8ac=_0x15c6ca;return _0x15c6ca[_0x69e9('0x68')](_0x52bc42['params'][_0x69e9('0x69')]);}})[_0x69e9('0x26')](function(_0x500aef){if(_0x500aef){return db[_0x69e9('0x6a')][_0x69e9('0x5f')]({'where':{'id':_0x52bc42[_0x69e9('0x46')][_0x69e9('0x69')]},'attributes':['id',_0x69e9('0x2b'),_0x69e9('0x63'),'converted_format',_0x69e9('0x60')],'raw':!![]});}})[_0x69e9('0x26')](function(_0x30628d){if(_0x30628d){fs[_0x69e9('0x5b')](path[_0x69e9('0x4b')](_0x37d8ac['directory'],util[_0x69e9('0x66')](_0x69e9('0x61'),_0x30628d[_0x69e9('0x2b')],_0x30628d[_0x69e9('0x65')])));return _0x30628d;}})[_0x69e9('0x42')](function(_0x407871){throw new db[(_0x69e9('0x5c'))][(_0x69e9('0x5d'))](_0x407871[_0x69e9('0x67')]);});})[_0x69e9('0x26')](handleEntityNotFound(_0x26b35c,null))[_0x69e9('0x26')](respondWithStatusCode(_0x26b35c,0xcc))[_0x69e9('0x42')](handleError(_0x26b35c,null));};exports['getSounds']=function(_0x400912,_0x17566e,_0x408804){var _0x21fb33={};var _0x291838={};var _0xa6fb9f;var _0x42cddd;return db[_0x69e9('0x3e')][_0x69e9('0x5f')]({'where':{'id':_0x400912[_0x69e9('0x46')]['id']}})['then'](handleEntityNotFound(_0x17566e,null))[_0x69e9('0x26')](function(_0x22791d){if(_0x22791d){_0xa6fb9f=_0x22791d;_0x291838['model']=_[_0x69e9('0x43')](db[_0x69e9('0x6a')][_0x69e9('0x44')]);_0x291838[_0x69e9('0x31')]=_[_0x69e9('0x43')](_0x400912[_0x69e9('0x31')]);_0x291838[_0x69e9('0x39')]=_[_0x69e9('0x32')](_0x291838['model'],_0x291838[_0x69e9('0x31')]);_0x21fb33['attributes']=_[_0x69e9('0x32')](_0x291838[_0x69e9('0x30')],qs[_0x69e9('0x34')](_0x400912['query']['fields']));_0x21fb33[_0x69e9('0x33')]=_0x21fb33[_0x69e9('0x33')][_0x69e9('0x6b')]?_0x21fb33['attributes']:_0x291838['model'];_0x21fb33['order']=qs[_0x69e9('0x37')](_0x400912[_0x69e9('0x31')][_0x69e9('0x37')]);_0x21fb33['where']=qs[_0x69e9('0x39')](_['pick'](_0x400912['query'],_0x291838[_0x69e9('0x39')]));if(_0x400912['query'][_0x69e9('0x3c')]){_0x21fb33[_0x69e9('0x38')]=_[_0x69e9('0x3b')](_0x21fb33[_0x69e9('0x38')],{'$or':_[_0x69e9('0x2e')](_0x21fb33['attributes'],function(_0xa721d4){var _0x5196a5={};_0x5196a5[_0xa721d4]={'$like':'%'+_0x400912[_0x69e9('0x31')]['filter']+'%'};return _0x5196a5;})});}_0x21fb33=_[_0x69e9('0x3b')]({},_0x21fb33,_0x400912[_0x69e9('0x3d')]);return _0xa6fb9f[_0x69e9('0x6c')](_0x21fb33);}})['then'](function(_0x135e00){if(_0x135e00){_0x42cddd=_0x135e00[_0x69e9('0x6b')];if(!_0x400912['query'][_0x69e9('0x35')](_0x69e9('0x36'))){_0x21fb33[_0x69e9('0x1e')]=qs[_0x69e9('0x1e')](_0x400912['query'][_0x69e9('0x1e')]);_0x21fb33[_0x69e9('0x1c')]=qs[_0x69e9('0x1c')](_0x400912['query'][_0x69e9('0x1c')]);}return _0xa6fb9f['getSounds'](_0x21fb33);}})[_0x69e9('0x26')](function(_0x125102){if(_0x125102){return _0x125102?{'count':_0x42cddd,'rows':_0x125102}:null;}})['then'](respondWithResult(_0x17566e,null))['catch'](handleError(_0x17566e,null));}; \ No newline at end of file +var _0x3e31=['Sequelize','addSound','Sound','findOne','converted_format','join','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','message','removeSound','id2','createdAt','unlinkSync','ValidationError','getSounds','hasOwnProperty','nolimit','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','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','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','keys','filters','intersection','model','fields','query','attributes','length','order','sort','where','pick','filter','merge','options','VoiceMusicOnHold','count','includeAll','findAll','show','params','include','find','catch','body','create','sequelize','transaction','files','directory','root','server/files/moh','mode','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','rmdirSync'];(function(_0x616b6a,_0x33bd2f){var _0x2714ba=function(_0x235f63){while(--_0x235f63){_0x616b6a['push'](_0x616b6a['shift']());}};_0x2714ba(++_0x33bd2f);}(_0x3e31,0x165));var _0x13e3=function(_0x1ef199,_0x81bda0){_0x1ef199=_0x1ef199-0x0;var _0x28a64c=_0x3e31[_0x1ef199];return _0x28a64c;};'use strict';var emlformat=require(_0x13e3('0x0'));var rimraf=require(_0x13e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13e3('0x2'));var rp=require(_0x13e3('0x3'));var moment=require('moment');var BPromise=require(_0x13e3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x13e3('0x5'));var sox=require(_0x13e3('0x6'));var csv=require(_0x13e3('0x7'));var ejs=require(_0x13e3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x13e3('0x9'));var squel=require('squel');var crypto=require(_0x13e3('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x13e3('0x7'));var querystring=require(_0x13e3('0xb'));var Papa=require(_0x13e3('0xc'));var Redis=require(_0x13e3('0xd'));var authService=require(_0x13e3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x13e3('0xf'));var hardwareService=require(_0x13e3('0x10'));var logger=require(_0x13e3('0x11'))(_0x13e3('0x12'));var utils=require(_0x13e3('0x13'));var config=require(_0x13e3('0x14'));var licenseUtil=require(_0x13e3('0x15'));var db=require(_0x13e3('0x16'))['db'];function respondWithStatusCode(_0x1c57c2,_0x54c366){_0x54c366=_0x54c366||0xcc;return function(_0x3dee33){if(_0x3dee33){return _0x1c57c2[_0x13e3('0x17')](_0x54c366);}return _0x1c57c2[_0x13e3('0x18')](_0x54c366)[_0x13e3('0x19')]();};}function respondWithResult(_0x1d7449,_0x1ec80b){_0x1ec80b=_0x1ec80b||0xc8;return function(_0x28e6a5){if(_0x28e6a5){return _0x1d7449[_0x13e3('0x18')](_0x1ec80b)[_0x13e3('0x1a')](_0x28e6a5);}};}function respondWithFilteredResult(_0x4ec5c3,_0x12013a){return function(_0x5799dc){if(_0x5799dc){var _0x2460c6=typeof _0x12013a['offset']===_0x13e3('0x1b')&&typeof _0x12013a[_0x13e3('0x1c')]===_0x13e3('0x1b');var _0x581841=_0x5799dc['count'];var _0x1de691=_0x2460c6?0x0:_0x12013a[_0x13e3('0x1d')];var _0xfd3f0d=_0x2460c6?_0x5799dc['count']:_0x12013a[_0x13e3('0x1d')]+_0x12013a[_0x13e3('0x1c')];var _0x5393ac;if(_0xfd3f0d>=_0x581841){_0xfd3f0d=_0x581841;_0x5393ac=0xc8;}else{_0x5393ac=0xce;}_0x4ec5c3[_0x13e3('0x18')](_0x5393ac);return _0x4ec5c3[_0x13e3('0x1e')](_0x13e3('0x1f'),_0x1de691+'-'+_0xfd3f0d+'/'+_0x581841)[_0x13e3('0x1a')](_0x5799dc);}return null;};}function patchUpdates(_0x45067a){return function(_0x5d7ce6){try{jsonpatch[_0x13e3('0x20')](_0x5d7ce6,_0x45067a,!![]);}catch(_0xbc87d4){return BPromise[_0x13e3('0x21')](_0xbc87d4);}return _0x5d7ce6[_0x13e3('0x22')]();};}function saveUpdates(_0x5b2b52,_0x5f434c){return function(_0x40ad2c){if(_0x40ad2c){return _0x40ad2c[_0x13e3('0x23')](_0x5b2b52)[_0x13e3('0x24')](function(_0x590e6c){return _0x590e6c;});}return null;};}function removeEntity(_0x3d7fed,_0x1b876d){return function(_0x5d9277){if(_0x5d9277){return _0x5d9277[_0x13e3('0x25')]()['then'](function(){var _0x59a904=_0x5d9277[_0x13e3('0x26')]({'plain':!![]});var _0x2d38af=_0x13e3('0x27');return db[_0x13e3('0x28')][_0x13e3('0x25')]({'where':{'type':_0x2d38af,'resourceId':_0x59a904['id']}})['then'](function(){return _0x5d9277;});})[_0x13e3('0x24')](function(){_0x3d7fed[_0x13e3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5725c1,_0x49899a){return function(_0x24034e){if(!_0x24034e){_0x5725c1[_0x13e3('0x17')](0x194);}return _0x24034e;};}function handleError(_0x3beee3,_0x342dd1){_0x342dd1=_0x342dd1||0x1f4;return function(_0x5efd09){logger[_0x13e3('0x29')](_0x5efd09[_0x13e3('0x2a')]);if(_0x5efd09[_0x13e3('0x2b')]){delete _0x5efd09[_0x13e3('0x2b')];}_0x3beee3[_0x13e3('0x18')](_0x342dd1)[_0x13e3('0x2c')](_0x5efd09);};}exports[_0x13e3('0x2d')]=function(_0x5edaba,_0x13337c){var _0x3e4090={},_0x481b29={},_0x184c65={'count':0x0,'rows':[]};var _0x2eb0be=_[_0x13e3('0x2e')](db['VoiceMusicOnHold'][_0x13e3('0x2f')],function(_0x2c4bdf){return{'name':_0x2c4bdf[_0x13e3('0x30')],'type':_0x2c4bdf['type'][_0x13e3('0x31')]};});_0x481b29['model']=_[_0x13e3('0x2e')](_0x2eb0be,_0x13e3('0x2b'));_0x481b29['query']=_[_0x13e3('0x32')](_0x5edaba['query']);_0x481b29[_0x13e3('0x33')]=_[_0x13e3('0x34')](_0x481b29['model'],_0x481b29['query']);_0x3e4090['attributes']=_[_0x13e3('0x34')](_0x481b29[_0x13e3('0x35')],qs[_0x13e3('0x36')](_0x5edaba[_0x13e3('0x37')]['fields']));_0x3e4090[_0x13e3('0x38')]=_0x3e4090[_0x13e3('0x38')][_0x13e3('0x39')]?_0x3e4090[_0x13e3('0x38')]:_0x481b29[_0x13e3('0x35')];if(!_0x5edaba[_0x13e3('0x37')]['hasOwnProperty']('nolimit')){_0x3e4090[_0x13e3('0x1c')]=qs[_0x13e3('0x1c')](_0x5edaba[_0x13e3('0x37')][_0x13e3('0x1c')]);_0x3e4090['offset']=qs['offset'](_0x5edaba[_0x13e3('0x37')]['offset']);}_0x3e4090[_0x13e3('0x3a')]=qs[_0x13e3('0x3b')](_0x5edaba[_0x13e3('0x37')]['sort']);delete _0x5edaba[_0x13e3('0x37')]['sort'];_0x3e4090[_0x13e3('0x3c')]=qs[_0x13e3('0x33')](_[_0x13e3('0x3d')](_0x5edaba[_0x13e3('0x37')],_0x481b29[_0x13e3('0x33')]),_0x2eb0be);if(_0x5edaba[_0x13e3('0x37')]['filter']){_0x3e4090[_0x13e3('0x3c')]=_['merge'](_0x3e4090[_0x13e3('0x3c')],{'$or':_[_0x13e3('0x2e')](_0x2eb0be,function(_0x342fdf){if(_0x342fdf['type']!=='VIRTUAL'){var _0x2b435d={};_0x2b435d[_0x342fdf[_0x13e3('0x2b')]]={'$like':'%'+_0x5edaba[_0x13e3('0x37')][_0x13e3('0x3e')]+'%'};return _0x2b435d;}})});}_0x3e4090=_[_0x13e3('0x3f')]({},_0x3e4090,_0x5edaba[_0x13e3('0x40')]);var _0x61bdd={'where':_0x3e4090['where']};return db[_0x13e3('0x41')][_0x13e3('0x42')](_0x61bdd)[_0x13e3('0x24')](function(_0x3b4673){_0x184c65[_0x13e3('0x42')]=_0x3b4673;if(_0x5edaba['query'][_0x13e3('0x43')]){_0x3e4090['include']=[{'all':!![]}];}return db[_0x13e3('0x41')][_0x13e3('0x44')](_0x3e4090);})['then'](function(_0x1d5864){_0x184c65['rows']=_0x1d5864;return _0x184c65;})[_0x13e3('0x24')](respondWithFilteredResult(_0x13337c,_0x3e4090))['catch'](handleError(_0x13337c,null));};exports[_0x13e3('0x45')]=function(_0x1f399f,_0xec9c41){var _0x4b1cc3={'raw':![],'where':{'id':_0x1f399f[_0x13e3('0x46')]['id']}},_0x2047d3={};_0x2047d3['model']=_[_0x13e3('0x32')](db[_0x13e3('0x41')][_0x13e3('0x2f')]);_0x2047d3[_0x13e3('0x37')]=_[_0x13e3('0x32')](_0x1f399f[_0x13e3('0x37')]);_0x2047d3['filters']=_['intersection'](_0x2047d3['model'],_0x2047d3['query']);_0x4b1cc3[_0x13e3('0x38')]=_[_0x13e3('0x34')](_0x2047d3[_0x13e3('0x35')],qs['fields'](_0x1f399f[_0x13e3('0x37')][_0x13e3('0x36')]));_0x4b1cc3[_0x13e3('0x38')]=_0x4b1cc3[_0x13e3('0x38')][_0x13e3('0x39')]?_0x4b1cc3['attributes']:_0x2047d3[_0x13e3('0x35')];if(_0x1f399f[_0x13e3('0x37')][_0x13e3('0x43')]){_0x4b1cc3[_0x13e3('0x47')]=[{'all':!![]}];}_0x4b1cc3=_[_0x13e3('0x3f')]({},_0x4b1cc3,_0x1f399f[_0x13e3('0x40')]);return db[_0x13e3('0x41')][_0x13e3('0x48')](_0x4b1cc3)['then'](handleEntityNotFound(_0xec9c41,null))['then'](respondWithResult(_0xec9c41,null))[_0x13e3('0x49')](handleError(_0xec9c41,null));};exports[_0x13e3('0x23')]=function(_0x42d636,_0x3101a2){if(_0x42d636[_0x13e3('0x4a')]['id']){delete _0x42d636[_0x13e3('0x4a')]['id'];}return db[_0x13e3('0x41')]['find']({'where':{'id':_0x42d636[_0x13e3('0x46')]['id']}})[_0x13e3('0x24')](handleEntityNotFound(_0x3101a2,null))[_0x13e3('0x24')](saveUpdates(_0x42d636[_0x13e3('0x4a')],null))[_0x13e3('0x24')](respondWithResult(_0x3101a2,null))[_0x13e3('0x49')](handleError(_0x3101a2,null));};exports[_0x13e3('0x4b')]=function(_0x1554be,_0x3bf648,_0x527016){return db[_0x13e3('0x4c')][_0x13e3('0x4d')](function(_0x526cf3){if(_0x1554be[_0x13e3('0x4a')]['mode']===_0x13e3('0x4e')){_0x1554be[_0x13e3('0x4a')][_0x13e3('0x4f')]=path['join'](config[_0x13e3('0x50')],_0x13e3('0x51'),_0x1554be[_0x13e3('0x4a')][_0x13e3('0x2b')]);}return db['VoiceMusicOnHold'][_0x13e3('0x4b')](_0x1554be[_0x13e3('0x4a')],{'transaction':_0x526cf3})[_0x13e3('0x24')](function(_0x26e0a5){if(_0x1554be[_0x13e3('0x4a')][_0x13e3('0x52')]===_0x13e3('0x4e')){fs[_0x13e3('0x53')](_0x26e0a5[_0x13e3('0x4f')],parseInt('0777',0x8));}var _0xaf17f6=_0x1554be[_0x13e3('0x54')]['get']({'plain':!![]});if(!_0xaf17f6)throw new Error(_0x13e3('0x55'));if(_0xaf17f6[_0x13e3('0x56')]===_0x13e3('0x54')){var _0x36a80d=_0x26e0a5[_0x13e3('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x13e3('0x48')]({'where':{'name':_0x13e3('0x27'),'userProfileId':_0xaf17f6['userProfileId']},'raw':!![]})[_0x13e3('0x24')](function(_0x34382d){if(_0x34382d&&_0x34382d[_0x13e3('0x57')]===0x0){return db['UserProfileResource'][_0x13e3('0x4b')]({'name':_0x36a80d[_0x13e3('0x2b')],'resourceId':_0x36a80d['id'],'type':_0x34382d['name'],'sectionId':_0x34382d['id']},{})[_0x13e3('0x24')](function(){return _0x26e0a5;});}else{return _0x26e0a5;}})[_0x13e3('0x49')](function(_0x18a1c5){logger['error'](_0x13e3('0x58'),_0x18a1c5);});}return _0x26e0a5;});})[_0x13e3('0x24')](respondWithResult(_0x3bf648,0xc9))['catch'](handleError(_0x3bf648,null));};exports['destroy']=function(_0x11111e,_0x2d3053,_0x9e2ca8){var _0x44c2e5;return db[_0x13e3('0x41')][_0x13e3('0x48')]({'where':{'id':_0x11111e[_0x13e3('0x46')]['id']}})['then'](function(_0x59f1a3){if(_0x59f1a3){return db['sequelize']['transaction'](function(_0xaf874c){return _0x59f1a3[_0x13e3('0x25')]({'transaction':_0xaf874c,'raw':!![]})[_0x13e3('0x24')](function(_0x3f720c){if(_0x3f720c[_0x13e3('0x4f')]){fs['readdirSync'](_0x3f720c['directory'])[_0x13e3('0x59')](function(_0x152929){fs['unlinkSync'](path['join'](_0x3f720c[_0x13e3('0x4f')],_0x152929));});fs[_0x13e3('0x5a')](_0x3f720c['directory']);}return _0x3f720c;});})[_0x13e3('0x49')](function(_0x1f2fd3){throw new db[(_0x13e3('0x5b'))]['ValidationError'](_0x1f2fd3['message']);});}})[_0x13e3('0x24')](handleEntityNotFound(_0x2d3053,null))['then'](removeEntity(_0x2d3053,null))[_0x13e3('0x49')](handleError(_0x2d3053,null));};exports[_0x13e3('0x5c')]=function(_0x2ec817,_0x5a2074,_0x315130){return db[_0x13e3('0x4c')][_0x13e3('0x4d')](function(_0xe120f5){var _0x3534c3;return db[_0x13e3('0x41')][_0x13e3('0x48')]({'where':{'id':_0x2ec817[_0x13e3('0x46')]['id']}})[_0x13e3('0x24')](function(_0x429445){if(_0x429445){_0x3534c3=_0x429445;return _0x429445[_0x13e3('0x5c')](_0x2ec817[_0x13e3('0x4a')]['id'],{'transaction':_0xe120f5});}})['then'](function(_0x342109){if(_0x342109){return db[_0x13e3('0x5d')][_0x13e3('0x5e')]({'where':{'id':_0x2ec817['body']['id']},'attributes':['id',_0x13e3('0x2b'),'save_name',_0x13e3('0x5f'),'createdAt'],'raw':!![]});}})[_0x13e3('0x24')](function(_0x2e0f42){if(_0x2e0f42){var _0x55cff8=path[_0x13e3('0x60')](config[_0x13e3('0x50')],_0x13e3('0x61'),util[_0x13e3('0x62')](_0x13e3('0x63'),path[_0x13e3('0x64')](_0x2e0f42[_0x13e3('0x65')],path[_0x13e3('0x66')](_0x2e0f42['save_name'])),_0x2e0f42[_0x13e3('0x5f')]));var _0x3a0437=path['join'](config[_0x13e3('0x50')],_0x13e3('0x51'),_0x3534c3[_0x13e3('0x2b')],util[_0x13e3('0x62')](_0x13e3('0x63'),_0x2e0f42[_0x13e3('0x2b')],_0x2e0f42[_0x13e3('0x5f')]));fs['symlinkSync'](_0x55cff8,_0x3a0437);return _0x2e0f42;}})['catch'](function(_0x3b3433){throw new db[(_0x13e3('0x5b'))]['ValidationError'](_0x3b3433[_0x13e3('0x67')]);});})[_0x13e3('0x24')](handleEntityNotFound(_0x5a2074,null))['then'](respondWithResult(_0x5a2074,0xc9))['catch'](handleError(_0x5a2074,null));};exports[_0x13e3('0x68')]=function(_0x18dc62,_0x296d5a,_0x168e85){return db[_0x13e3('0x4c')][_0x13e3('0x4d')](function(_0x380137){var _0x4e762d;return db[_0x13e3('0x41')][_0x13e3('0x5e')]({'where':{'id':_0x18dc62['params']['id']}})['then'](handleEntityNotFound(_0x296d5a,null))[_0x13e3('0x24')](function(_0x5c13f4){if(_0x5c13f4){_0x4e762d=_0x5c13f4;return _0x5c13f4[_0x13e3('0x68')](_0x18dc62[_0x13e3('0x46')][_0x13e3('0x69')]);}})[_0x13e3('0x24')](function(_0x12d908){if(_0x12d908){return db[_0x13e3('0x5d')][_0x13e3('0x5e')]({'where':{'id':_0x18dc62[_0x13e3('0x46')][_0x13e3('0x69')]},'attributes':['id',_0x13e3('0x2b'),_0x13e3('0x65'),_0x13e3('0x5f'),_0x13e3('0x6a')],'raw':!![]});}})[_0x13e3('0x24')](function(_0x17367e){if(_0x17367e){fs[_0x13e3('0x6b')](path[_0x13e3('0x60')](_0x4e762d['directory'],util[_0x13e3('0x62')]('%s.%s',_0x17367e[_0x13e3('0x2b')],_0x17367e[_0x13e3('0x5f')])));return _0x17367e;}})[_0x13e3('0x49')](function(_0x377ad6){throw new db[(_0x13e3('0x5b'))][(_0x13e3('0x6c'))](_0x377ad6[_0x13e3('0x67')]);});})[_0x13e3('0x24')](handleEntityNotFound(_0x296d5a,null))[_0x13e3('0x24')](respondWithStatusCode(_0x296d5a,0xcc))[_0x13e3('0x49')](handleError(_0x296d5a,null));};exports[_0x13e3('0x6d')]=function(_0x5dce4d,_0xab131d,_0x2b5ed5){var _0x3979e6={};var _0x141919={};var _0x62fa7;var _0xe7d8;return db[_0x13e3('0x41')][_0x13e3('0x5e')]({'where':{'id':_0x5dce4d[_0x13e3('0x46')]['id']}})[_0x13e3('0x24')](handleEntityNotFound(_0xab131d,null))[_0x13e3('0x24')](function(_0x43c036){if(_0x43c036){_0x62fa7=_0x43c036;_0x141919['model']=_['keys'](db['Sound'][_0x13e3('0x2f')]);_0x141919[_0x13e3('0x37')]=_['keys'](_0x5dce4d[_0x13e3('0x37')]);_0x141919[_0x13e3('0x33')]=_[_0x13e3('0x34')](_0x141919[_0x13e3('0x35')],_0x141919[_0x13e3('0x37')]);_0x3979e6[_0x13e3('0x38')]=_[_0x13e3('0x34')](_0x141919[_0x13e3('0x35')],qs[_0x13e3('0x36')](_0x5dce4d[_0x13e3('0x37')][_0x13e3('0x36')]));_0x3979e6['attributes']=_0x3979e6['attributes'][_0x13e3('0x39')]?_0x3979e6[_0x13e3('0x38')]:_0x141919['model'];_0x3979e6[_0x13e3('0x3a')]=qs[_0x13e3('0x3b')](_0x5dce4d[_0x13e3('0x37')][_0x13e3('0x3b')]);_0x3979e6[_0x13e3('0x3c')]=qs[_0x13e3('0x33')](_[_0x13e3('0x3d')](_0x5dce4d[_0x13e3('0x37')],_0x141919[_0x13e3('0x33')]));if(_0x5dce4d['query'][_0x13e3('0x3e')]){_0x3979e6[_0x13e3('0x3c')]=_[_0x13e3('0x3f')](_0x3979e6['where'],{'$or':_[_0x13e3('0x2e')](_0x3979e6[_0x13e3('0x38')],function(_0xee4a5){var _0xbd0759={};_0xbd0759[_0xee4a5]={'$like':'%'+_0x5dce4d[_0x13e3('0x37')]['filter']+'%'};return _0xbd0759;})});}_0x3979e6=_[_0x13e3('0x3f')]({},_0x3979e6,_0x5dce4d[_0x13e3('0x40')]);return _0x62fa7['getSounds'](_0x3979e6);}})['then'](function(_0x3de64){if(_0x3de64){_0xe7d8=_0x3de64['length'];if(!_0x5dce4d[_0x13e3('0x37')][_0x13e3('0x6e')](_0x13e3('0x6f'))){_0x3979e6[_0x13e3('0x1c')]=qs[_0x13e3('0x1c')](_0x5dce4d['query'][_0x13e3('0x1c')]);_0x3979e6[_0x13e3('0x1d')]=qs['offset'](_0x5dce4d[_0x13e3('0x37')][_0x13e3('0x1d')]);}return _0x62fa7['getSounds'](_0x3979e6);}})[_0x13e3('0x24')](function(_0x324f15){if(_0x324f15){return _0x324f15?{'count':_0xe7d8,'rows':_0x324f15}:null;}})[_0x13e3('0x24')](respondWithResult(_0xab131d,null))[_0x13e3('0x49')](handleError(_0xab131d,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 1d3031a..0badbee 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 _0x7ae9=['exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x152d50,_0x3857eb){var _0x50a171=function(_0x89a450){while(--_0x89a450){_0x152d50['push'](_0x152d50['shift']());}};_0x50a171(++_0x3857eb);}(_0x7ae9,0x7c));var _0x97ae=function(_0x48d540,_0x58f1da){_0x48d540=_0x48d540-0x0;var _0x38e9d9=_0x7ae9[_0x48d540];return _0x38e9d9;};'use strict';var _=require('lodash');var util=require(_0x97ae('0x0'));var logger=require(_0x97ae('0x1'))(_0x97ae('0x2'));var moment=require(_0x97ae('0x3'));var BPromise=require(_0x97ae('0x4'));var rp=require(_0x97ae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x97ae('0x6'));var config=require(_0x97ae('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x97ae('0x8')]=function(_0x29709b,_0x297891){return _0x29709b[_0x97ae('0x9')](_0x97ae('0xa'),attributes,{'tableName':_0x97ae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe386=['VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','moment','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x463664,_0x126285){var _0x7db6be=function(_0x42b1ef){while(--_0x42b1ef){_0x463664['push'](_0x463664['shift']());}};_0x7db6be(++_0x126285);}(_0xe386,0x1af));var _0x6e38=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe386[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x6e38('0x0'));var logger=require(_0x6e38('0x1'))('api');var moment=require(_0x6e38('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e38('0x3'));var rimraf=require(_0x6e38('0x4'));var config=require(_0x6e38('0x5'));var attributes=require(_0x6e38('0x6'));module[_0x6e38('0x7')]=function(_0x6745ac,_0x45473b){return _0x6745ac[_0x6e38('0x8')](_0x6e38('0x9'),attributes,{'tableName':_0x6e38('0xa'),'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 71d7ea2..de7b849 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(_0x2fcd68,_0x585288){var _0x151c49=function(_0x1fdcf1){while(--_0x1fdcf1){_0x2fcd68['push'](_0x2fcd68['shift']());}};_0x151c49(++_0x585288);}(_0xe706,0xa3));var _0x6e70=function(_0xed9c99,_0x2217b1){_0xed9c99=_0xed9c99-0x0;var _0x5443a1=_0xe706[_0xed9c99];return _0x5443a1;};'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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1e2e6a,_0x4d55c1){var _0x4f0aab=function(_0x3ba9d3){while(--_0x3ba9d3){_0x1e2e6a['push'](_0x1e2e6a['shift']());}};_0x4f0aab(++_0x4d55c1);}(_0x70e0,0x17b));var _0x070e=function(_0x1c5353,_0x1151e2){_0x1c5353=_0x1c5353-0x0;var _0x2c2c6e=_0x70e0[_0x1c5353];return _0x2c2c6e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b4448ef..ae730ab 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 _0x2e8a=['addAgents','addTeams','update','delete','destroy','removeTeams','exports','util','path','express','Router','../../components/auth/service','isAuthenticated','index','get','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create'];(function(_0x120f4e,_0x3e71b5){var _0x494f82=function(_0x56044d){while(--_0x56044d){_0x120f4e['push'](_0x120f4e['shift']());}};_0x494f82(++_0x3e71b5);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x21b037,_0x1f310a){_0x21b037=_0x21b037-0x0;var _0x20556c=_0x2e8a[_0x21b037];return _0x20556c;};'use strict';var multer=require('multer');var util=require(_0xa2e8('0x0'));var path=require(_0xa2e8('0x1'));var timeout=require('connect-timeout');var express=require(_0xa2e8('0x2'));var router=express[_0xa2e8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa2e8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router['get']('/',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x6')]);router[_0xa2e8('0x7')]('/describe',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x8')]);router[_0xa2e8('0x7')](_0xa2e8('0x9'),auth['isAuthenticated'](),controller[_0xa2e8('0xa')]);router['get'](_0xa2e8('0xb'),auth[_0xa2e8('0x5')](),controller[_0xa2e8('0xc')]);router[_0xa2e8('0x7')](_0xa2e8('0xd'),auth['isAuthenticated'](),controller[_0xa2e8('0xe')]);router[_0xa2e8('0xf')]('/',auth['isAuthenticated'](),controller[_0xa2e8('0x10')]);router['post'](_0xa2e8('0xb'),auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x11')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xa2e8('0x12')]);router['put'](_0xa2e8('0x9'),auth['isAuthenticated'](),controller[_0xa2e8('0x13')]);router[_0xa2e8('0x14')](_0xa2e8('0x9'),auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x15')]);router[_0xa2e8('0x14')]('/:id/users',auth[_0xa2e8('0x5')](),controller['removeAgents']);router['delete'](_0xa2e8('0xd'),auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x16')]);module[_0xa2e8('0x17')]=router; \ No newline at end of file +var _0x0dec=['../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x2867ed,_0x433803){var _0x2acbc8=function(_0x229c11){while(--_0x229c11){_0x2867ed['push'](_0x2867ed['shift']());}};_0x2acbc8(++_0x433803);}(_0x0dec,0x11c));var _0xc0de=function(_0x1b98f8,_0x3d0ab9){_0x1b98f8=_0x1b98f8-0x0;var _0x7dea5e=_0x0dec[_0x1b98f8];return _0x7dea5e;};'use strict';var multer=require(_0xc0de('0x0'));var util=require(_0xc0de('0x1'));var path=require(_0xc0de('0x2'));var timeout=require(_0xc0de('0x3'));var express=require('express');var router=express[_0xc0de('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc0de('0x5'));var config=require(_0xc0de('0x6'));var controller=require(_0xc0de('0x7'));router[_0xc0de('0x8')]('/',auth[_0xc0de('0x9')](),controller[_0xc0de('0xa')]);router[_0xc0de('0x8')](_0xc0de('0xb'),auth[_0xc0de('0x9')](),controller[_0xc0de('0xc')]);router[_0xc0de('0x8')](_0xc0de('0xd'),auth[_0xc0de('0x9')](),controller[_0xc0de('0xe')]);router[_0xc0de('0x8')](_0xc0de('0xf'),auth[_0xc0de('0x9')](),controller[_0xc0de('0x10')]);router[_0xc0de('0x8')](_0xc0de('0x11'),auth[_0xc0de('0x9')](),controller[_0xc0de('0x12')]);router[_0xc0de('0x13')]('/',auth[_0xc0de('0x9')](),controller[_0xc0de('0x14')]);router['post'](_0xc0de('0xf'),auth[_0xc0de('0x9')](),controller[_0xc0de('0x15')]);router[_0xc0de('0x13')](_0xc0de('0x11'),auth[_0xc0de('0x9')](),controller[_0xc0de('0x16')]);router[_0xc0de('0x17')](_0xc0de('0xd'),auth[_0xc0de('0x9')](),controller[_0xc0de('0x18')]);router[_0xc0de('0x19')]('/:id',auth[_0xc0de('0x9')](),controller[_0xc0de('0x1a')]);router['delete'](_0xc0de('0xf'),auth[_0xc0de('0x9')](),controller[_0xc0de('0x1b')]);router['delete'](_0xc0de('0x11'),auth['isAuthenticated'](),controller[_0xc0de('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index bcf6394..6e6e072 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 _0xfc1c=['exports','STRING','getDataValue','name','INTEGER'];(function(_0x539d3c,_0x2c3c32){var _0x26b19f=function(_0xb01067){while(--_0xb01067){_0x539d3c['push'](_0x539d3c['shift']());}};_0x26b19f(++_0x2c3c32);}(_0xfc1c,0x96));var _0xcfc1=function(_0x31ca4c,_0x38802c){_0x31ca4c=_0x31ca4c-0x0;var _0x423753=_0xfc1c[_0x31ca4c];return _0x423753;};'use strict';var Sequelize=require('sequelize');module[_0xcfc1('0x0')]={'name':{'type':Sequelize[_0xcfc1('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x336f86){return'system-'+this[_0xcfc1('0x2')](_0xcfc1('0x3'))+'-';}},'description':{'type':Sequelize[_0xcfc1('0x1')]},'callerIdAll':{'type':Sequelize[_0xcfc1('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xcfc1('0x4')]}}; \ No newline at end of file +var _0xc6bb=['sequelize','getDataValue','STRING','INTEGER'];(function(_0x1fb212,_0x4b2dc3){var _0x395af9=function(_0x5ccd6d){while(--_0x5ccd6d){_0x1fb212['push'](_0x1fb212['shift']());}};_0x395af9(++_0x4b2dc3);}(_0xc6bb,0x124));var _0xbc6b=function(_0x45a0f6,_0x50c5f2){_0x45a0f6=_0x45a0f6-0x0;var _0x3b06b1=_0xc6bb[_0x45a0f6];return _0x3b06b1;};'use strict';var Sequelize=require(_0xbc6b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0xadd889){return'system-'+this[_0xbc6b('0x1')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xbc6b('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xbc6b('0x3')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 7134ee0..8bc982e 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 _0x1893=['compact','value','isEmpty','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','error','name','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','VoicePrefix','includeAll','findAll','rows','show','length','options','find','catch','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','context','${EXTEN:','charAt','body','system-','findById','addAgents','params','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','rawAttributes','pick','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','flatMap','each','upsert','findOrCreate','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1893,0xa2));var _0x3189=function(_0x56321f,_0x1c41eb){_0x56321f=_0x56321f-0x0;var _0x5aa129=_0x1893[_0x56321f];return _0x5aa129;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];config['redis']=_[_0x3189('0x19')](config[_0x3189('0x1a')],{'host':_0x3189('0x1b'),'port':0x18eb});var socket=require(_0x3189('0x1c'))(new Redis(config[_0x3189('0x1a')]));require(_0x3189('0x1d'))[_0x3189('0x1e')](socket);function respondWithStatusCode(_0x25a917,_0x5521bb){_0x5521bb=_0x5521bb||0xcc;return function(_0x220b18){if(_0x220b18){return _0x25a917[_0x3189('0x1f')](_0x5521bb);}return _0x25a917[_0x3189('0x20')](_0x5521bb)[_0x3189('0x21')]();};}function respondWithResult(_0x486dd2,_0x40195d){_0x40195d=_0x40195d||0xc8;return function(_0x5f2e82){if(_0x5f2e82){return _0x486dd2['status'](_0x40195d)[_0x3189('0x22')](_0x5f2e82);}};}function respondWithFilteredResult(_0x49b1bc,_0x42c3a3){return function(_0xf8aed7){if(_0xf8aed7){var _0x22c7ba=typeof _0x42c3a3[_0x3189('0x23')]==='undefined'&&typeof _0x42c3a3[_0x3189('0x24')]===_0x3189('0x25');var _0x16edd7=_0xf8aed7['count'];var _0x561265=_0x22c7ba?0x0:_0x42c3a3[_0x3189('0x23')];var _0x306ed3=_0x22c7ba?_0xf8aed7[_0x3189('0x26')]:_0x42c3a3[_0x3189('0x23')]+_0x42c3a3['limit'];var _0x1771a8;if(_0x306ed3>=_0x16edd7){_0x306ed3=_0x16edd7;_0x1771a8=0xc8;}else{_0x1771a8=0xce;}_0x49b1bc[_0x3189('0x20')](_0x1771a8);return _0x49b1bc[_0x3189('0x27')]('Content-Range',_0x561265+'-'+_0x306ed3+'/'+_0x16edd7)[_0x3189('0x22')](_0xf8aed7);}return null;};}function patchUpdates(_0x47abb4){return function(_0x4bfc03){try{jsonpatch[_0x3189('0x28')](_0x4bfc03,_0x47abb4,!![]);}catch(_0x200f16){return BPromise[_0x3189('0x29')](_0x200f16);}return _0x4bfc03[_0x3189('0x2a')]();};}function saveUpdates(_0x393fcb,_0x5a08dc){return function(_0x4b03ad){if(_0x4b03ad){return _0x4b03ad[_0x3189('0x2b')](_0x393fcb)[_0x3189('0x2c')](function(_0x1dc1c8){return _0x1dc1c8;});}return null;};}function removeEntity(_0x3cc1e5,_0x103de4){return function(_0x3f4789){if(_0x3f4789){return _0x3f4789[_0x3189('0x2d')]()[_0x3189('0x2c')](function(){var _0x17b540=_0x3f4789[_0x3189('0x2e')]({'plain':!![]});var _0x5ce5f5='VoicePrefixes';return db['UserProfileResource'][_0x3189('0x2d')]({'where':{'type':_0x5ce5f5,'resourceId':_0x17b540['id']}})[_0x3189('0x2c')](function(){return _0x3f4789;});})[_0x3189('0x2c')](function(){_0x3cc1e5[_0x3189('0x20')](0xcc)[_0x3189('0x21')]();});}};}function handleEntityNotFound(_0x2f7504,_0x4d453a){return function(_0x1ab94b){if(!_0x1ab94b){_0x2f7504[_0x3189('0x1f')](0x194);}return _0x1ab94b;};}function handleError(_0x4bd677,_0x173f18){_0x173f18=_0x173f18||0x1f4;return function(_0x3744ff){logger[_0x3189('0x2f')](_0x3744ff['stack']);if(_0x3744ff[_0x3189('0x30')]){delete _0x3744ff[_0x3189('0x30')];}_0x4bd677[_0x3189('0x20')](_0x173f18)['send'](_0x3744ff);};}exports[_0x3189('0x31')]=function(_0x47f7a7,_0x51ce54){var _0x32ca90={},_0x34007b={},_0x374f23={'count':0x0,'rows':[]};var _0x3bdc84=_[_0x3189('0x32')](db['VoicePrefix']['rawAttributes'],function(_0x7d7745){return{'name':_0x7d7745['fieldName'],'type':_0x7d7745[_0x3189('0x33')][_0x3189('0x34')]};});_0x34007b[_0x3189('0x35')]=_[_0x3189('0x32')](_0x3bdc84,_0x3189('0x30'));_0x34007b[_0x3189('0x36')]=_[_0x3189('0x37')](_0x47f7a7[_0x3189('0x36')]);_0x34007b[_0x3189('0x38')]=_['intersection'](_0x34007b[_0x3189('0x35')],_0x34007b[_0x3189('0x36')]);_0x32ca90[_0x3189('0x39')]=_[_0x3189('0x3a')](_0x34007b[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x47f7a7[_0x3189('0x36')]['fields']));_0x32ca90['attributes']=_0x32ca90[_0x3189('0x39')]['length']?_0x32ca90[_0x3189('0x39')]:_0x34007b[_0x3189('0x35')];if(!_0x47f7a7['query'][_0x3189('0x3c')](_0x3189('0x3d'))){_0x32ca90[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x47f7a7['query'][_0x3189('0x24')]);_0x32ca90['offset']=qs['offset'](_0x47f7a7[_0x3189('0x36')][_0x3189('0x23')]);}_0x32ca90[_0x3189('0x3e')]=qs[_0x3189('0x3f')](_0x47f7a7[_0x3189('0x36')][_0x3189('0x3f')]);_0x32ca90[_0x3189('0x40')]=qs[_0x3189('0x38')](_['pick'](_0x47f7a7['query'],_0x34007b[_0x3189('0x38')]),_0x3bdc84);if(_0x47f7a7[_0x3189('0x36')][_0x3189('0x41')]){_0x32ca90[_0x3189('0x40')]=_[_0x3189('0x42')](_0x32ca90[_0x3189('0x40')],{'$or':_['map'](_0x3bdc84,function(_0x280146){if(_0x280146[_0x3189('0x33')]!==_0x3189('0x43')){var _0xaf76f1={};_0xaf76f1[_0x280146['name']]={'$like':'%'+_0x47f7a7[_0x3189('0x36')][_0x3189('0x41')]+'%'};return _0xaf76f1;}})});}_0x32ca90=_['merge']({},_0x32ca90,_0x47f7a7['options']);var _0x1ef1b2={'where':_0x32ca90['where']};return db[_0x3189('0x44')][_0x3189('0x26')](_0x1ef1b2)[_0x3189('0x2c')](function(_0x9593f3){_0x374f23['count']=_0x9593f3;if(_0x47f7a7[_0x3189('0x36')][_0x3189('0x45')]){_0x32ca90['include']=[{'all':!![]}];}return db[_0x3189('0x44')][_0x3189('0x46')](_0x32ca90);})[_0x3189('0x2c')](function(_0x3a6a36){_0x374f23[_0x3189('0x47')]=_0x3a6a36;return _0x374f23;})['then'](respondWithFilteredResult(_0x51ce54,_0x32ca90))['catch'](handleError(_0x51ce54,null));};exports[_0x3189('0x48')]=function(_0x5ca360,_0x44e45f){var _0xf095fe={'raw':![],'where':{'id':_0x5ca360['params']['id']}},_0x1a3e51={};_0x1a3e51[_0x3189('0x35')]=_[_0x3189('0x37')](db[_0x3189('0x44')]['rawAttributes']);_0x1a3e51[_0x3189('0x36')]=_[_0x3189('0x37')](_0x5ca360[_0x3189('0x36')]);_0x1a3e51[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x1a3e51[_0x3189('0x35')],_0x1a3e51['query']);_0xf095fe['attributes']=_[_0x3189('0x3a')](_0x1a3e51['model'],qs['fields'](_0x5ca360[_0x3189('0x36')]['fields']));_0xf095fe[_0x3189('0x39')]=_0xf095fe[_0x3189('0x39')][_0x3189('0x49')]?_0xf095fe['attributes']:_0x1a3e51[_0x3189('0x35')];if(_0x5ca360['query'][_0x3189('0x45')]){_0xf095fe['include']=[{'all':!![]}];}_0xf095fe=_['merge']({},_0xf095fe,_0x5ca360[_0x3189('0x4a')]);return db['VoicePrefix'][_0x3189('0x4b')](_0xf095fe)['then'](handleEntityNotFound(_0x44e45f,null))['then'](respondWithResult(_0x44e45f,null))[_0x3189('0x4c')](handleError(_0x44e45f,null));};exports[_0x3189('0x2d')]=function(_0x4373f6,_0x35cb23){return db[_0x3189('0x44')][_0x3189('0x4b')]({'where':{'id':_0x4373f6['params']['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x35cb23,null))['then'](removeEntity(_0x35cb23,null))['catch'](handleError(_0x35cb23,null));};exports[_0x3189('0x4d')]=function(_0x4f641a,_0xd90868){return db[_0x3189('0x44')][_0x3189('0x4d')]()[_0x3189('0x2c')](respondWithResult(_0xd90868,null))['catch'](handleError(_0xd90868,null));};exports[_0x3189('0x4e')]=function(_0x4ad892,_0x35fdb2){var _0x242ec4;return db[_0x3189('0x4f')][_0x3189('0x50')](function(_0x4f41e5){return db[_0x3189('0x44')][_0x3189('0x4e')](_0x4ad892['body'],{'transaction':_0x4f41e5})[_0x3189('0x2c')](function(_0xbf07c5){_0x242ec4=_0xbf07c5[_0x3189('0x2e')]({'plain':!![]});return db[_0x3189('0x51')]['find']({'where':{'id':_0x242ec4[_0x3189('0x52')]},'raw':!![]})['then'](function(_0x1ebb0d){return createVoicePrefixExtensions(_0x242ec4,_0x1ebb0d,_0x4f41e5);});});})['then'](function(){var _0x460c6e=_0x4ad892[_0x3189('0x53')]['get']({'plain':!![]});if(!_0x460c6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x460c6e['role']===_0x3189('0x53')){var _0x5b14ac=_0x242ec4;return db[_0x3189('0x54')][_0x3189('0x4b')]({'where':{'name':_0x3189('0x55'),'userProfileId':_0x460c6e[_0x3189('0x56')]},'raw':!![]})[_0x3189('0x2c')](function(_0x40623f){if(_0x40623f&&_0x40623f[_0x3189('0x57')]===0x0){return db[_0x3189('0x58')][_0x3189('0x4e')]({'name':_0x5b14ac['name'],'resourceId':_0x5b14ac['id'],'type':_0x40623f[_0x3189('0x30')],'sectionId':_0x40623f['id']},{})[_0x3189('0x2c')](function(){return _0x242ec4;});}else{return _0x242ec4;}})[_0x3189('0x4c')](function(_0x429de3){logger[_0x3189('0x2f')](_0x3189('0x59'),_0x429de3);throw _0x429de3;});}return _0x242ec4;})[_0x3189('0x2c')](respondWithResult(_0x35fdb2,null))[_0x3189('0x4c')](handleError(_0x35fdb2,null));};function Extension(_0xa1316a,_0x68de3c,_0x187877,_0x3a2fe6){this['context']='from-sip';this[_0x3189('0x5a')]=_0xa1316a;this[_0x3189('0x5b')]=_0x187877;this[_0x3189('0x33')]=_0x3189('0x5c');this[_0x3189('0x5d')]=_0x3189('0x5e');this[_0x3189('0x5f')]=_0x68de3c;this[_0x3189('0x60')]=_0x3a2fe6;}function createVoicePrefixExtensions(_0x120a8a,_0x1472b6,_0xd45395){return new BPromise(function(_0x4f0ccb,_0x5b31dd){var _0x57aae5=new Extension(formatPrefixName(_0x120a8a[_0x3189('0x61')]),0x1,_0x3189('0x62'),'Voice\x20Prefix');_0x57aae5[_0x3189('0x63')]=_0x120a8a['id'];return db[_0x3189('0x51')][_0x3189('0x4e')](_0x57aae5,{'transaction':_0xd45395})[_0x3189('0x2c')](function(_0x26fdf2){var _0x4875a2=_0x26fdf2[_0x3189('0x2e')]({'plain':!![]});var _0x35a4d1=_[_0x3189('0x32')](addVoicePrefixExtensions(_0x120a8a,_0x1472b6),function(_0x228dfc){_0x228dfc['VoiceExtensionId']=_0x4875a2['id'];_0x228dfc[_0x3189('0x63')]=_0x120a8a['id'];return _0x228dfc;});return db[_0x3189('0x51')][_0x3189('0x64')](_0x35a4d1,{'transaction':_0xd45395})[_0x3189('0x2c')](function(_0x4a7172){if(!_0x4a7172){return _0x5b31dd(_0x3189('0x65'));}else{return _0x4f0ccb(_0x4a7172);}})['catch'](function(_0x1d7a44){return _0x5b31dd(_0x1d7a44);});});;});};function addVoicePrefixExtensions(_0x448635,_0x10fe1b){var _0xb02b4f=[];var _0x55bcf0=formatPrefixName(_0x448635[_0x3189('0x61')]);_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x2,_0x3189('0x67'),_0x3189('0x68')+_0x448635[_0x3189('0x30')]));if(_0x448635[_0x3189('0x69')]){_0xb02b4f['push'](new Extension(_0x55bcf0,0x3,_0x3189('0x67'),_0x3189('0x6a')+_0x448635[_0x3189('0x69')]));}else{_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x3,_0x3189('0x62'),'No\x20callerid\x20available'));}_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x4,'goto',_0x10fe1b[_0x3189('0x6b')]+','+_0x3189('0x6c')+(0x8+_0x448635[_0x3189('0x30')][_0x3189('0x49')])+'}'+','+0x1));return _0xb02b4f;}function formatPrefixName(_0x46faac){var _0x458db9='_';for(var _0x403d31=0x0;_0x403d31<_0x46faac[_0x3189('0x49')];_0x403d31++){if(_0x46faac['charAt'](_0x403d31)=='-'){_0x458db9+=_0x46faac[_0x3189('0x6d')](_0x403d31);}else{_0x458db9+='['+_0x46faac['charAt'](_0x403d31)+']';}}_0x458db9+='.';return _0x458db9;}exports[_0x3189('0x2b')]=function(_0x2eedf4,_0xf740b0,_0x1e08f4){var _0x3d11ac=_0x2eedf4[_0x3189('0x6e')];_0x3d11ac['prefix']=_0x3189('0x6f')+_0x3d11ac[_0x3189('0x30')]+'-';return db['sequelize'][_0x3189('0x50')](function(_0x50438f){return db[_0x3189('0x44')][_0x3189('0x2b')](_0x3d11ac,{'where':{'id':_0x3d11ac['id']},'transaction':_0x50438f})[_0x3189('0x2c')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x3d11ac['id']},'transaction':_0x50438f})[_0x3189('0x2c')](function(){return db[_0x3189('0x51')][_0x3189('0x4b')]({'where':{'id':_0x3d11ac['VoiceExtensionId']},'raw':!![]})[_0x3189('0x2c')](function(_0x285b0d){return createVoicePrefixExtensions(_0x3d11ac,_0x285b0d,_0x50438f);});});});})['then'](function(){return db[_0x3189('0x44')][_0x3189('0x70')](_0x3d11ac['id']);})[_0x3189('0x2c')](respondWithResult(_0xf740b0,null))['catch'](handleError(_0xf740b0,null));};exports[_0x3189('0x71')]=function(_0x28bbe6,_0x3ab88e,_0x5d3478){return db['VoicePrefix'][_0x3189('0x4b')]({'where':{'id':_0x28bbe6[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x3ab88e,null))['then'](function(_0x1f57c7){if(_0x1f57c7){return _0x1f57c7[_0x3189('0x71')](_0x28bbe6[_0x3189('0x6e')][_0x3189('0x73')],_[_0x3189('0x74')](_0x28bbe6[_0x3189('0x6e')],[_0x3189('0x73'),'id'])||{})[_0x3189('0x75')](function(_0x2c110e){for(var _0x41d415=0x0;_0x41d415<_0x28bbe6['body'][_0x3189('0x73')][_0x3189('0x49')];_0x41d415+=0x1){socket[_0x3189('0x76')](_0x3189('0x77'),{'UserId':Number(_0x28bbe6[_0x3189('0x6e')][_0x3189('0x73')][_0x41d415]),'VoicePrefixId':Number(_0x28bbe6[_0x3189('0x72')]['id'])});}return _0x2c110e;});}})[_0x3189('0x2c')](respondWithResult(_0x3ab88e,null))['catch'](handleError(_0x3ab88e,null));};exports[_0x3189('0x78')]=function(_0x4861ba,_0x226a58,_0x176c44){return db[_0x3189('0x44')][_0x3189('0x4b')]({'where':{'id':_0x4861ba['params']['id']}})['then'](handleEntityNotFound(_0x226a58,null))[_0x3189('0x2c')](function(_0x2c0e85){if(_0x2c0e85){return _0x2c0e85[_0x3189('0x78')](_0x4861ba[_0x3189('0x36')]['ids'])[_0x3189('0x2c')](function(){if(_[_0x3189('0x79')](_0x4861ba['query'][_0x3189('0x73')])){for(var _0x65c13f=0x0;_0x65c13f<_0x4861ba['query'][_0x3189('0x73')][_0x3189('0x49')];_0x65c13f+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x4861ba[_0x3189('0x36')]['ids'][_0x65c13f]),'VoicePrefixId':Number(_0x4861ba[_0x3189('0x72')]['id'])});}}else{socket[_0x3189('0x76')](_0x3189('0x7a'),{'UserId':Number(_0x4861ba[_0x3189('0x36')][_0x3189('0x73')]),'VoicePrefixId':Number(_0x4861ba['params']['id'])});}});}})['then'](respondWithStatusCode(_0x226a58,null))[_0x3189('0x4c')](handleError(_0x226a58,null));};exports['getAgents']=function(_0x33b271,_0x5c138a,_0x583d35){var _0x51303a={};var _0x278553={};var _0x4917e3;var _0x2d3d78;return db[_0x3189('0x44')][_0x3189('0x7b')]({'where':{'id':_0x33b271[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x5c138a,null))[_0x3189('0x2c')](function(_0x4d3554){if(_0x4d3554){_0x4917e3=_0x4d3554;_0x278553[_0x3189('0x35')]=_[_0x3189('0x37')](db[_0x3189('0x7c')][_0x3189('0x7d')]);_0x278553[_0x3189('0x36')]=_['keys'](_0x33b271[_0x3189('0x36')]);_0x278553[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x278553[_0x3189('0x35')],_0x278553[_0x3189('0x36')]);_0x51303a['attributes']=_[_0x3189('0x3a')](_0x278553[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x33b271[_0x3189('0x36')][_0x3189('0x3b')]));_0x51303a[_0x3189('0x39')]=_0x51303a[_0x3189('0x39')][_0x3189('0x49')]?_0x51303a[_0x3189('0x39')]:_0x278553[_0x3189('0x35')];_0x51303a['order']=qs[_0x3189('0x3f')](_0x33b271[_0x3189('0x36')][_0x3189('0x3f')]);_0x51303a[_0x3189('0x40')]=qs[_0x3189('0x38')](_[_0x3189('0x7e')](_0x33b271['query'],_0x278553[_0x3189('0x38')]));if(_0x33b271['query'][_0x3189('0x41')]){_0x51303a['where']=_[_0x3189('0x42')](_0x51303a['where'],{'$or':_[_0x3189('0x32')](_0x51303a['attributes'],function(_0x3a84e8){var _0x17b46a={};_0x17b46a[_0x3a84e8]={'$like':'%'+_0x33b271['query'][_0x3189('0x41')]+'%'};return _0x17b46a;})});}_0x51303a=_[_0x3189('0x42')]({},_0x51303a,_0x33b271[_0x3189('0x4a')]);return _0x4917e3[_0x3189('0x7f')](_0x51303a);}})[_0x3189('0x2c')](function(_0x549bbd){if(_0x549bbd){_0x2d3d78=_0x549bbd['length'];if(!_0x33b271[_0x3189('0x36')][_0x3189('0x3c')](_0x3189('0x3d'))){_0x51303a[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x33b271[_0x3189('0x36')]['limit']);_0x51303a[_0x3189('0x23')]=qs[_0x3189('0x23')](_0x33b271['query'][_0x3189('0x23')]);}return _0x4917e3[_0x3189('0x7f')](_0x51303a);}})[_0x3189('0x2c')](function(_0x5d10f8){if(_0x5d10f8){return _0x5d10f8?{'count':_0x2d3d78,'rows':_0x5d10f8}:null;}})[_0x3189('0x2c')](respondWithResult(_0x5c138a,null))[_0x3189('0x4c')](handleError(_0x5c138a,null));};exports[_0x3189('0x80')]=function(_0x24fec5,_0x5a7cf4,_0x2ef30c){var _0x14cecc={};var _0x2165f1={};var _0x1b8666;var _0x5bbf36;return db[_0x3189('0x44')][_0x3189('0x7b')]({'where':{'id':_0x24fec5[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x5a7cf4,null))['then'](function(_0x4371b7){if(_0x4371b7){_0x1b8666=_0x4371b7;_0x2165f1[_0x3189('0x35')]=_[_0x3189('0x37')](db['Team'][_0x3189('0x7d')]);_0x2165f1['query']=_[_0x3189('0x37')](_0x24fec5['query']);_0x2165f1[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x2165f1[_0x3189('0x35')],_0x2165f1[_0x3189('0x36')]);_0x14cecc['attributes']=_[_0x3189('0x3a')](_0x2165f1[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x24fec5[_0x3189('0x36')][_0x3189('0x3b')]));_0x14cecc[_0x3189('0x39')]=_0x14cecc['attributes']['length']?_0x14cecc[_0x3189('0x39')]:_0x2165f1[_0x3189('0x35')];_0x14cecc['order']=qs[_0x3189('0x3f')](_0x24fec5[_0x3189('0x36')][_0x3189('0x3f')]);_0x14cecc[_0x3189('0x40')]=qs['filters'](_[_0x3189('0x7e')](_0x24fec5[_0x3189('0x36')],_0x2165f1[_0x3189('0x38')]));if(_0x24fec5[_0x3189('0x36')]['filter']){_0x14cecc[_0x3189('0x40')]=_[_0x3189('0x42')](_0x14cecc['where'],{'$or':_[_0x3189('0x32')](_0x14cecc[_0x3189('0x39')],function(_0x5eeb3d){var _0xe94bda={};_0xe94bda[_0x5eeb3d]={'$like':'%'+_0x24fec5[_0x3189('0x36')]['filter']+'%'};return _0xe94bda;})});}_0x14cecc=_[_0x3189('0x42')]({},_0x14cecc,_0x24fec5[_0x3189('0x4a')]);return _0x1b8666[_0x3189('0x80')](_0x14cecc);}})[_0x3189('0x2c')](function(_0x23d34e){if(_0x23d34e){_0x5bbf36=_0x23d34e[_0x3189('0x49')];if(!_0x24fec5['query'][_0x3189('0x3c')](_0x3189('0x3d'))){_0x14cecc[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x24fec5[_0x3189('0x36')][_0x3189('0x24')]);_0x14cecc[_0x3189('0x23')]=qs[_0x3189('0x23')](_0x24fec5['query'][_0x3189('0x23')]);}return _0x1b8666[_0x3189('0x80')](_0x14cecc);}})['then'](function(_0x418ef8){if(_0x418ef8){return _0x418ef8?{'count':_0x5bbf36,'rows':_0x418ef8}:null;}})[_0x3189('0x2c')](respondWithResult(_0x5a7cf4,null))['catch'](handleError(_0x5a7cf4,null));};exports[_0x3189('0x81')]=function(_0x85c195,_0x4917ee,_0x2a8f73){var _0x464843=_0x85c195[_0x3189('0x6e')][_0x3189('0x73')];var _0x429bc1;return db[_0x3189('0x82')]['findAll']({'where':{'id':_0x464843},'attributes':['id'],'include':[{'model':db[_0x3189('0x7c')],'as':_0x3189('0x83'),'attributes':['id','name',_0x3189('0x84'),_0x3189('0x85'),'interface'],'raw':!![]}]})['then'](function(_0x158199){if(_0x158199){_0x429bc1=_0x158199;var _0x431e68=_[_0x3189('0x86')](_0x158199,function(_0x18d525){var _0x5e565c=_0x18d525['get']({'plain':!![]});return _0x5e565c[_0x3189('0x83')];});return db[_0x3189('0x44')]['find']({'where':{'id':_0x85c195[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](function(_0x36262a){return db['sequelize'][_0x3189('0x50')](function(_0xd24f4a){return _0x36262a[_0x3189('0x81')](_0x464843,{'transaction':_0xd24f4a})[_0x3189('0x2c')](function(){return BPromise[_0x3189('0x87')](_0x429bc1,function(_0x33f64c){return db['TeamVoicePrefix'][_0x3189('0x88')]({'TeamId':_0x33f64c['id'],'VoicePrefixId':_0x85c195['params']['id']},{'transaction':_0xd24f4a});});})[_0x3189('0x2c')](function(){return BPromise[_0x3189('0x87')](_0x431e68,function(_0x1c919f){return db['UserVoicePrefix'][_0x3189('0x89')]({'where':{'UserId':_0x1c919f['id'],'VoicePrefixId':_0x85c195[_0x3189('0x72')]['id']},'transaction':_0xd24f4a});});})['then'](function(){_0x431e68[_0x3189('0x8a')](function(_0x2bab94){socket['emit'](_0x3189('0x77'),{'UserId':_0x2bab94['id'],'VoicePrefixId':_0x36262a['id']});});});});});}})[_0x3189('0x2c')](respondWithStatusCode(_0x4917ee,null))[_0x3189('0x4c')](handleError(_0x4917ee,null));};exports[_0x3189('0x8b')]=function(_0x39fe89,_0x4f564d,_0x341e23){return db['Team'][_0x3189('0x46')]({'where':{'id':_0x39fe89[_0x3189('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3189('0x7c')],'as':_0x3189('0x83'),'attributes':['id'],'raw':!![]}]})[_0x3189('0x2c')](handleEntityNotFound(_0x4f564d,null))['then'](function(_0x4fb475){var _0x522aa5=_[_0x3189('0x32')](_0x4fb475,'id');var _0x1f0c98=[];var _0x3f5cf9=[];var _0x47ce18=squel['select']();_0x47ce18[_0x3189('0x8c')](_0x3189('0x8d'))[_0x3189('0x8e')](_0x3189('0x8f'),'tq')[_0x3189('0x90')]('user_has_teams','ut',_0x3189('0x91'))['where'](_0x3189('0x92'),_0x39fe89['params']['id']);for(var _0x241a67=0x0;_0x241a67<_0x4fb475[_0x3189('0x49')];_0x241a67+=0x1){let _0x51913c=_0x4fb475[_0x241a67];for(var _0x1a07d7=0x0;_0x1a07d7<_0x51913c[_0x3189('0x83')][_0x3189('0x49')];_0x1a07d7+=0x1){let _0x36602c=_0x51913c['Agents'][_0x1a07d7];var _0x1f9018=_0x47ce18[_0x3189('0x93')]();_0x1f9018[_0x3189('0x40')]('ut.UserId\x20=\x20?',_0x36602c['id']);_0x3f5cf9[_0x3189('0x66')](db[_0x3189('0x4f')][_0x3189('0x36')](_0x1f9018[_0x3189('0x94')](),{'type':db['sequelize'][_0x3189('0x95')][_0x3189('0x96')]})[_0x3189('0x2c')](function(_0x13fc9f){if(_0x13fc9f[_0x3189('0x49')]===0x1){return _0x36602c['id'];}else{var _0x516164=_[_0x3189('0x97')](_['map'](_0x13fc9f,_0x3189('0x98')),function(_0x1f506c){return _[_0x3189('0x99')](_0x522aa5,_0x1f506c);});if(_0x516164){return _0x36602c['id'];}}}));}}return BPromise[_0x3189('0x9a')](_0x3f5cf9)[_0x3189('0x2c')](function(_0x48835c){_0x1f0c98=_(_0x1f0c98)[_0x3189('0x9b')](_0x48835c)[_0x3189('0x9c')]()[_0x3189('0x9d')]();return db['VoicePrefix']['find']({'where':{'id':_0x39fe89[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](function(_0x4c19e2){return db[_0x3189('0x4f')][_0x3189('0x50')](function(_0x5d89ec){return _0x4c19e2[_0x3189('0x8b')](_0x39fe89[_0x3189('0x36')][_0x3189('0x73')],{'transaction':_0x5d89ec})['then'](function(){if(!_[_0x3189('0x9e')](_0x1f0c98)){return _0x4c19e2[_0x3189('0x78')](_0x1f0c98,{'transaction':_0x5d89ec});}})['then'](function(){_0x1f0c98[_0x3189('0x8a')](function(_0xab746c){socket[_0x3189('0x76')](_0x3189('0x7a'),{'UserId':_0xab746c,'VoicePrefixId':_0x4c19e2['id']});});});});});});})[_0x3189('0x2c')](respondWithStatusCode(_0x4f564d,null))[_0x3189('0x4c')](handleError(_0x4f564d,null));}; \ No newline at end of file +var _0x7334=['rawAttributes','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','goto','charAt','findById','ids','userVoicePrefix:save','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','order','pick','nolimit','getTeams','addTeams','Team','Agents','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','eml-format','rimraf','zip-dir','moment','mustache','util','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','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','name','send','index','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7334,0x184));var _0x4733=function(_0x166a42,_0x587b40){_0x166a42=_0x166a42-0x0;var _0x252ea0=_0x7334[_0x166a42];return _0x252ea0;};'use strict';var emlformat=require(_0x4733('0x0'));var rimraf=require(_0x4733('0x1'));var zipdir=require(_0x4733('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4733('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4733('0x4'));var util=require(_0x4733('0x5'));var path=require(_0x4733('0x6'));var sox=require(_0x4733('0x7'));var csv=require(_0x4733('0x8'));var ejs=require(_0x4733('0x9'));var fs=require('fs');var fs_extra=require(_0x4733('0xa'));var _=require(_0x4733('0xb'));var squel=require(_0x4733('0xc'));var crypto=require(_0x4733('0xd'));var jsforce=require(_0x4733('0xe'));var deskjs=require(_0x4733('0xf'));var toCsv=require(_0x4733('0x8'));var querystring=require(_0x4733('0x10'));var Papa=require(_0x4733('0x11'));var Redis=require(_0x4733('0x12'));var authService=require(_0x4733('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4733('0x14'));var hardwareService=require(_0x4733('0x15'));var logger=require('../../config/logger')(_0x4733('0x16'));var utils=require('../../config/utils');var config=require(_0x4733('0x17'));var licenseUtil=require(_0x4733('0x18'));var db=require(_0x4733('0x19'))['db'];config[_0x4733('0x1a')]=_[_0x4733('0x1b')](config[_0x4733('0x1a')],{'host':_0x4733('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4733('0x1a')]));require('./voicePrefix.socket')[_0x4733('0x1d')](socket);function respondWithStatusCode(_0x1a22e4,_0x2e5b1b){_0x2e5b1b=_0x2e5b1b||0xcc;return function(_0x22283e){if(_0x22283e){return _0x1a22e4[_0x4733('0x1e')](_0x2e5b1b);}return _0x1a22e4[_0x4733('0x1f')](_0x2e5b1b)[_0x4733('0x20')]();};}function respondWithResult(_0x9fff,_0x1920ce){_0x1920ce=_0x1920ce||0xc8;return function(_0x4ab37a){if(_0x4ab37a){return _0x9fff[_0x4733('0x1f')](_0x1920ce)[_0x4733('0x21')](_0x4ab37a);}};}function respondWithFilteredResult(_0x47b129,_0x444824){return function(_0x1d2fb6){if(_0x1d2fb6){var _0x2aa223=typeof _0x444824[_0x4733('0x22')]==='undefined'&&typeof _0x444824['limit']===_0x4733('0x23');var _0x3b730a=_0x1d2fb6['count'];var _0x32f166=_0x2aa223?0x0:_0x444824[_0x4733('0x22')];var _0x15339c=_0x2aa223?_0x1d2fb6[_0x4733('0x24')]:_0x444824['offset']+_0x444824[_0x4733('0x25')];var _0xb45e1;if(_0x15339c>=_0x3b730a){_0x15339c=_0x3b730a;_0xb45e1=0xc8;}else{_0xb45e1=0xce;}_0x47b129['status'](_0xb45e1);return _0x47b129[_0x4733('0x26')](_0x4733('0x27'),_0x32f166+'-'+_0x15339c+'/'+_0x3b730a)['json'](_0x1d2fb6);}return null;};}function patchUpdates(_0x15a291){return function(_0x115ce4){try{jsonpatch[_0x4733('0x28')](_0x115ce4,_0x15a291,!![]);}catch(_0x1a0643){return BPromise[_0x4733('0x29')](_0x1a0643);}return _0x115ce4[_0x4733('0x2a')]();};}function saveUpdates(_0x180049,_0x2bb78f){return function(_0x523697){if(_0x523697){return _0x523697[_0x4733('0x2b')](_0x180049)[_0x4733('0x2c')](function(_0x7884e5){return _0x7884e5;});}return null;};}function removeEntity(_0x2cb247,_0x30ee9b){return function(_0x3bd683){if(_0x3bd683){return _0x3bd683[_0x4733('0x2d')]()[_0x4733('0x2c')](function(){var _0x13bc12=_0x3bd683[_0x4733('0x2e')]({'plain':!![]});var _0x521855=_0x4733('0x2f');return db['UserProfileResource']['destroy']({'where':{'type':_0x521855,'resourceId':_0x13bc12['id']}})[_0x4733('0x2c')](function(){return _0x3bd683;});})['then'](function(){_0x2cb247[_0x4733('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4abc0d,_0x517c73){return function(_0x2976b0){if(!_0x2976b0){_0x4abc0d[_0x4733('0x1e')](0x194);}return _0x2976b0;};}function handleError(_0x29621e,_0x61419a){_0x61419a=_0x61419a||0x1f4;return function(_0x4fee4a){logger['error'](_0x4fee4a['stack']);if(_0x4fee4a[_0x4733('0x30')]){delete _0x4fee4a['name'];}_0x29621e['status'](_0x61419a)[_0x4733('0x31')](_0x4fee4a);};}exports[_0x4733('0x32')]=function(_0xa915ce,_0x59172a){var _0x523c61={},_0x4412f7={},_0x3a4307={'count':0x0,'rows':[]};var _0x22d38a=_[_0x4733('0x33')](db[_0x4733('0x34')]['rawAttributes'],function(_0x191ff8){return{'name':_0x191ff8[_0x4733('0x35')],'type':_0x191ff8[_0x4733('0x36')][_0x4733('0x37')]};});_0x4412f7[_0x4733('0x38')]=_['map'](_0x22d38a,'name');_0x4412f7[_0x4733('0x39')]=_[_0x4733('0x3a')](_0xa915ce[_0x4733('0x39')]);_0x4412f7[_0x4733('0x3b')]=_[_0x4733('0x3c')](_0x4412f7['model'],_0x4412f7[_0x4733('0x39')]);_0x523c61[_0x4733('0x3d')]=_[_0x4733('0x3c')](_0x4412f7['model'],qs[_0x4733('0x3e')](_0xa915ce[_0x4733('0x39')][_0x4733('0x3e')]));_0x523c61[_0x4733('0x3d')]=_0x523c61[_0x4733('0x3d')][_0x4733('0x3f')]?_0x523c61[_0x4733('0x3d')]:_0x4412f7[_0x4733('0x38')];if(!_0xa915ce['query'][_0x4733('0x40')]('nolimit')){_0x523c61[_0x4733('0x25')]=qs[_0x4733('0x25')](_0xa915ce[_0x4733('0x39')][_0x4733('0x25')]);_0x523c61[_0x4733('0x22')]=qs[_0x4733('0x22')](_0xa915ce[_0x4733('0x39')][_0x4733('0x22')]);}_0x523c61['order']=qs[_0x4733('0x41')](_0xa915ce[_0x4733('0x39')]['sort']);_0x523c61[_0x4733('0x42')]=qs[_0x4733('0x3b')](_['pick'](_0xa915ce[_0x4733('0x39')],_0x4412f7['filters']),_0x22d38a);if(_0xa915ce[_0x4733('0x39')]['filter']){_0x523c61[_0x4733('0x42')]=_[_0x4733('0x43')](_0x523c61['where'],{'$or':_['map'](_0x22d38a,function(_0x3a766b){if(_0x3a766b[_0x4733('0x36')]!=='VIRTUAL'){var _0x2d0739={};_0x2d0739[_0x3a766b[_0x4733('0x30')]]={'$like':'%'+_0xa915ce[_0x4733('0x39')][_0x4733('0x44')]+'%'};return _0x2d0739;}})});}_0x523c61=_[_0x4733('0x43')]({},_0x523c61,_0xa915ce[_0x4733('0x45')]);var _0x23e355={'where':_0x523c61[_0x4733('0x42')]};return db[_0x4733('0x34')][_0x4733('0x24')](_0x23e355)[_0x4733('0x2c')](function(_0x1d32df){_0x3a4307[_0x4733('0x24')]=_0x1d32df;if(_0xa915ce[_0x4733('0x39')][_0x4733('0x46')]){_0x523c61[_0x4733('0x47')]=[{'all':!![]}];}return db[_0x4733('0x34')][_0x4733('0x48')](_0x523c61);})['then'](function(_0x1a0c5c){_0x3a4307[_0x4733('0x49')]=_0x1a0c5c;return _0x3a4307;})[_0x4733('0x2c')](respondWithFilteredResult(_0x59172a,_0x523c61))[_0x4733('0x4a')](handleError(_0x59172a,null));};exports[_0x4733('0x4b')]=function(_0x3bbe48,_0x70123d){var _0x32b777={'raw':![],'where':{'id':_0x3bbe48[_0x4733('0x4c')]['id']}},_0x34ec6c={};_0x34ec6c[_0x4733('0x38')]=_[_0x4733('0x3a')](db[_0x4733('0x34')][_0x4733('0x4d')]);_0x34ec6c['query']=_['keys'](_0x3bbe48[_0x4733('0x39')]);_0x34ec6c[_0x4733('0x3b')]=_[_0x4733('0x3c')](_0x34ec6c[_0x4733('0x38')],_0x34ec6c[_0x4733('0x39')]);_0x32b777[_0x4733('0x3d')]=_[_0x4733('0x3c')](_0x34ec6c[_0x4733('0x38')],qs[_0x4733('0x3e')](_0x3bbe48[_0x4733('0x39')]['fields']));_0x32b777['attributes']=_0x32b777['attributes']['length']?_0x32b777[_0x4733('0x3d')]:_0x34ec6c[_0x4733('0x38')];if(_0x3bbe48[_0x4733('0x39')][_0x4733('0x46')]){_0x32b777[_0x4733('0x47')]=[{'all':!![]}];}_0x32b777=_[_0x4733('0x43')]({},_0x32b777,_0x3bbe48[_0x4733('0x45')]);return db[_0x4733('0x34')][_0x4733('0x4e')](_0x32b777)[_0x4733('0x2c')](handleEntityNotFound(_0x70123d,null))['then'](respondWithResult(_0x70123d,null))['catch'](handleError(_0x70123d,null));};exports[_0x4733('0x2d')]=function(_0x5372d2,_0x2882ed){return db[_0x4733('0x34')][_0x4733('0x4e')]({'where':{'id':_0x5372d2['params']['id']}})[_0x4733('0x2c')](handleEntityNotFound(_0x2882ed,null))[_0x4733('0x2c')](removeEntity(_0x2882ed,null))[_0x4733('0x4a')](handleError(_0x2882ed,null));};exports[_0x4733('0x4f')]=function(_0xdc2998,_0x41cb8b){return db[_0x4733('0x34')][_0x4733('0x4f')]()[_0x4733('0x2c')](respondWithResult(_0x41cb8b,null))['catch'](handleError(_0x41cb8b,null));};exports[_0x4733('0x50')]=function(_0xdb1561,_0x899344){var _0x491fa5;return db[_0x4733('0x51')][_0x4733('0x52')](function(_0xafb3f8){return db[_0x4733('0x34')]['create'](_0xdb1561[_0x4733('0x53')],{'transaction':_0xafb3f8})['then'](function(_0x2468e2){_0x491fa5=_0x2468e2[_0x4733('0x2e')]({'plain':!![]});return db[_0x4733('0x54')][_0x4733('0x4e')]({'where':{'id':_0x491fa5[_0x4733('0x55')]},'raw':!![]})['then'](function(_0x4619f7){return createVoicePrefixExtensions(_0x491fa5,_0x4619f7,_0xafb3f8);});});})[_0x4733('0x2c')](function(){var _0x5e4668=_0xdb1561['user'][_0x4733('0x2e')]({'plain':!![]});if(!_0x5e4668)throw new Error(_0x4733('0x56'));if(_0x5e4668[_0x4733('0x57')]===_0x4733('0x58')){var _0x422010=_0x491fa5;return db[_0x4733('0x59')][_0x4733('0x4e')]({'where':{'name':_0x4733('0x2f'),'userProfileId':_0x5e4668['userProfileId']},'raw':!![]})['then'](function(_0x3b7f06){if(_0x3b7f06&&_0x3b7f06['autoAssociation']===0x0){return db[_0x4733('0x5a')][_0x4733('0x50')]({'name':_0x422010[_0x4733('0x30')],'resourceId':_0x422010['id'],'type':_0x3b7f06['name'],'sectionId':_0x3b7f06['id']},{})['then'](function(){return _0x491fa5;});}else{return _0x491fa5;}})['catch'](function(_0x1106df){logger[_0x4733('0x5b')](_0x4733('0x5c'),_0x1106df);throw _0x1106df;});}return _0x491fa5;})['then'](respondWithResult(_0x899344,null))[_0x4733('0x4a')](handleError(_0x899344,null));};function Extension(_0x3d1157,_0x15a32e,_0xd9974c,_0x87398f){this[_0x4733('0x5d')]=_0x4733('0x5e');this['exten']=_0x3d1157;this[_0x4733('0x5f')]=_0xd9974c;this[_0x4733('0x36')]='system';this['description']=_0x4733('0x60');this[_0x4733('0x61')]=_0x15a32e;this[_0x4733('0x62')]=_0x87398f;}function createVoicePrefixExtensions(_0x1ca20e,_0x475dad,_0x1f84de){return new BPromise(function(_0x31f1d1,_0x460969){var _0x3597bf=new Extension(formatPrefixName(_0x1ca20e['prefix']),0x1,_0x4733('0x63'),_0x4733('0x64'));_0x3597bf[_0x4733('0x65')]=_0x1ca20e['id'];return db['VoiceExtension'][_0x4733('0x50')](_0x3597bf,{'transaction':_0x1f84de})['then'](function(_0x22434d){var _0x4695db=_0x22434d[_0x4733('0x2e')]({'plain':!![]});var _0x3696d6=_[_0x4733('0x33')](addVoicePrefixExtensions(_0x1ca20e,_0x475dad),function(_0x40c870){_0x40c870['VoiceExtensionId']=_0x4695db['id'];_0x40c870[_0x4733('0x65')]=_0x1ca20e['id'];return _0x40c870;});return db['VoiceExtension'][_0x4733('0x66')](_0x3696d6,{'transaction':_0x1f84de})[_0x4733('0x2c')](function(_0x54326d){if(!_0x54326d){return _0x460969(_0x4733('0x67'));}else{return _0x31f1d1(_0x54326d);}})['catch'](function(_0x483986){return _0x460969(_0x483986);});});;});};function addVoicePrefixExtensions(_0x39d393,_0x28a04f){var _0x1a0ebf=[];var _0x3166c5=formatPrefixName(_0x39d393[_0x4733('0x68')]);_0x1a0ebf[_0x4733('0x69')](new Extension(_0x3166c5,0x2,_0x4733('0x6a'),_0x4733('0x6b')+_0x39d393[_0x4733('0x30')]));if(_0x39d393['callerIdAll']){_0x1a0ebf['push'](new Extension(_0x3166c5,0x3,'Set',_0x4733('0x6c')+_0x39d393[_0x4733('0x6d')]));}else{_0x1a0ebf[_0x4733('0x69')](new Extension(_0x3166c5,0x3,_0x4733('0x63'),'No\x20callerid\x20available'));}_0x1a0ebf[_0x4733('0x69')](new Extension(_0x3166c5,0x4,_0x4733('0x6e'),_0x28a04f[_0x4733('0x5d')]+','+'${EXTEN:'+(0x8+_0x39d393[_0x4733('0x30')]['length'])+'}'+','+0x1));return _0x1a0ebf;}function formatPrefixName(_0x7436b7){var _0x57156a='_';for(var _0x4c66b2=0x0;_0x4c66b2<_0x7436b7[_0x4733('0x3f')];_0x4c66b2++){if(_0x7436b7['charAt'](_0x4c66b2)=='-'){_0x57156a+=_0x7436b7[_0x4733('0x6f')](_0x4c66b2);}else{_0x57156a+='['+_0x7436b7['charAt'](_0x4c66b2)+']';}}_0x57156a+='.';return _0x57156a;}exports['update']=function(_0x1a7baf,_0x5c6083,_0x54bf73){var _0x918cd9=_0x1a7baf[_0x4733('0x53')];_0x918cd9[_0x4733('0x68')]='system-'+_0x918cd9[_0x4733('0x30')]+'-';return db[_0x4733('0x51')][_0x4733('0x52')](function(_0x7003cc){return db[_0x4733('0x34')][_0x4733('0x2b')](_0x918cd9,{'where':{'id':_0x918cd9['id']},'transaction':_0x7003cc})['then'](function(){return db[_0x4733('0x54')][_0x4733('0x2d')]({'where':{'VoicePrefixId':_0x918cd9['id']},'transaction':_0x7003cc})[_0x4733('0x2c')](function(){return db['VoiceExtension'][_0x4733('0x4e')]({'where':{'id':_0x918cd9[_0x4733('0x55')]},'raw':!![]})[_0x4733('0x2c')](function(_0xe265ec){return createVoicePrefixExtensions(_0x918cd9,_0xe265ec,_0x7003cc);});});});})[_0x4733('0x2c')](function(){return db[_0x4733('0x34')][_0x4733('0x70')](_0x918cd9['id']);})[_0x4733('0x2c')](respondWithResult(_0x5c6083,null))['catch'](handleError(_0x5c6083,null));};exports['addAgents']=function(_0x1af81e,_0x4fac10,_0x527ba8){return db[_0x4733('0x34')][_0x4733('0x4e')]({'where':{'id':_0x1af81e[_0x4733('0x4c')]['id']}})[_0x4733('0x2c')](handleEntityNotFound(_0x4fac10,null))['then'](function(_0x28c5c8){if(_0x28c5c8){return _0x28c5c8['addAgents'](_0x1af81e[_0x4733('0x53')]['ids'],_['omit'](_0x1af81e[_0x4733('0x53')],['ids','id'])||{})['spread'](function(_0x58d5ba){for(var _0x416e3f=0x0;_0x416e3f<_0x1af81e['body'][_0x4733('0x71')][_0x4733('0x3f')];_0x416e3f+=0x1){socket['emit'](_0x4733('0x72'),{'UserId':Number(_0x1af81e['body']['ids'][_0x416e3f]),'VoicePrefixId':Number(_0x1af81e[_0x4733('0x4c')]['id'])});}return _0x58d5ba;});}})[_0x4733('0x2c')](respondWithResult(_0x4fac10,null))[_0x4733('0x4a')](handleError(_0x4fac10,null));};exports['removeAgents']=function(_0x4bde5b,_0x6179db,_0x5f5c88){return db[_0x4733('0x34')][_0x4733('0x4e')]({'where':{'id':_0x4bde5b[_0x4733('0x4c')]['id']}})[_0x4733('0x2c')](handleEntityNotFound(_0x6179db,null))[_0x4733('0x2c')](function(_0x27494c){if(_0x27494c){return _0x27494c['removeAgents'](_0x4bde5b[_0x4733('0x39')][_0x4733('0x71')])[_0x4733('0x2c')](function(){if(_[_0x4733('0x73')](_0x4bde5b['query']['ids'])){for(var _0x4119d9=0x0;_0x4119d9<_0x4bde5b['query'][_0x4733('0x71')][_0x4733('0x3f')];_0x4119d9+=0x1){socket[_0x4733('0x74')](_0x4733('0x75'),{'UserId':Number(_0x4bde5b[_0x4733('0x39')][_0x4733('0x71')][_0x4119d9]),'VoicePrefixId':Number(_0x4bde5b[_0x4733('0x4c')]['id'])});}}else{socket['emit'](_0x4733('0x75'),{'UserId':Number(_0x4bde5b[_0x4733('0x39')]['ids']),'VoicePrefixId':Number(_0x4bde5b['params']['id'])});}});}})[_0x4733('0x2c')](respondWithStatusCode(_0x6179db,null))['catch'](handleError(_0x6179db,null));};exports[_0x4733('0x76')]=function(_0x592a5b,_0x4b1ea4,_0x6a624){var _0x45e8cf={};var _0xf68581={};var _0x1f08a7;var _0xf6c791;return db['VoicePrefix'][_0x4733('0x77')]({'where':{'id':_0x592a5b[_0x4733('0x4c')]['id']}})[_0x4733('0x2c')](handleEntityNotFound(_0x4b1ea4,null))['then'](function(_0x4a7b45){if(_0x4a7b45){_0x1f08a7=_0x4a7b45;_0xf68581['model']=_[_0x4733('0x3a')](db[_0x4733('0x78')][_0x4733('0x4d')]);_0xf68581[_0x4733('0x39')]=_[_0x4733('0x3a')](_0x592a5b[_0x4733('0x39')]);_0xf68581['filters']=_[_0x4733('0x3c')](_0xf68581[_0x4733('0x38')],_0xf68581[_0x4733('0x39')]);_0x45e8cf['attributes']=_['intersection'](_0xf68581['model'],qs[_0x4733('0x3e')](_0x592a5b['query'][_0x4733('0x3e')]));_0x45e8cf[_0x4733('0x3d')]=_0x45e8cf[_0x4733('0x3d')][_0x4733('0x3f')]?_0x45e8cf['attributes']:_0xf68581[_0x4733('0x38')];_0x45e8cf[_0x4733('0x79')]=qs[_0x4733('0x41')](_0x592a5b[_0x4733('0x39')][_0x4733('0x41')]);_0x45e8cf[_0x4733('0x42')]=qs[_0x4733('0x3b')](_[_0x4733('0x7a')](_0x592a5b['query'],_0xf68581[_0x4733('0x3b')]));if(_0x592a5b['query'][_0x4733('0x44')]){_0x45e8cf[_0x4733('0x42')]=_[_0x4733('0x43')](_0x45e8cf['where'],{'$or':_[_0x4733('0x33')](_0x45e8cf['attributes'],function(_0x420896){var _0x4f7558={};_0x4f7558[_0x420896]={'$like':'%'+_0x592a5b[_0x4733('0x39')]['filter']+'%'};return _0x4f7558;})});}_0x45e8cf=_[_0x4733('0x43')]({},_0x45e8cf,_0x592a5b[_0x4733('0x45')]);return _0x1f08a7[_0x4733('0x76')](_0x45e8cf);}})[_0x4733('0x2c')](function(_0x11aed9){if(_0x11aed9){_0xf6c791=_0x11aed9[_0x4733('0x3f')];if(!_0x592a5b['query']['hasOwnProperty'](_0x4733('0x7b'))){_0x45e8cf[_0x4733('0x25')]=qs[_0x4733('0x25')](_0x592a5b[_0x4733('0x39')][_0x4733('0x25')]);_0x45e8cf['offset']=qs[_0x4733('0x22')](_0x592a5b['query']['offset']);}return _0x1f08a7['getAgents'](_0x45e8cf);}})[_0x4733('0x2c')](function(_0x61323b){if(_0x61323b){return _0x61323b?{'count':_0xf6c791,'rows':_0x61323b}:null;}})[_0x4733('0x2c')](respondWithResult(_0x4b1ea4,null))[_0x4733('0x4a')](handleError(_0x4b1ea4,null));};exports[_0x4733('0x7c')]=function(_0x2738e4,_0x49094c,_0x376c38){var _0x5ba285={};var _0x3621ec={};var _0x483183;var _0x390792;return db[_0x4733('0x34')][_0x4733('0x77')]({'where':{'id':_0x2738e4['params']['id']}})['then'](handleEntityNotFound(_0x49094c,null))[_0x4733('0x2c')](function(_0x4727c4){if(_0x4727c4){_0x483183=_0x4727c4;_0x3621ec[_0x4733('0x38')]=_[_0x4733('0x3a')](db['Team'][_0x4733('0x4d')]);_0x3621ec[_0x4733('0x39')]=_['keys'](_0x2738e4[_0x4733('0x39')]);_0x3621ec[_0x4733('0x3b')]=_[_0x4733('0x3c')](_0x3621ec['model'],_0x3621ec['query']);_0x5ba285['attributes']=_[_0x4733('0x3c')](_0x3621ec[_0x4733('0x38')],qs['fields'](_0x2738e4['query']['fields']));_0x5ba285['attributes']=_0x5ba285['attributes'][_0x4733('0x3f')]?_0x5ba285[_0x4733('0x3d')]:_0x3621ec[_0x4733('0x38')];_0x5ba285['order']=qs[_0x4733('0x41')](_0x2738e4[_0x4733('0x39')][_0x4733('0x41')]);_0x5ba285[_0x4733('0x42')]=qs[_0x4733('0x3b')](_[_0x4733('0x7a')](_0x2738e4[_0x4733('0x39')],_0x3621ec[_0x4733('0x3b')]));if(_0x2738e4[_0x4733('0x39')][_0x4733('0x44')]){_0x5ba285[_0x4733('0x42')]=_['merge'](_0x5ba285[_0x4733('0x42')],{'$or':_[_0x4733('0x33')](_0x5ba285['attributes'],function(_0xd04ac7){var _0x33b72e={};_0x33b72e[_0xd04ac7]={'$like':'%'+_0x2738e4[_0x4733('0x39')]['filter']+'%'};return _0x33b72e;})});}_0x5ba285=_[_0x4733('0x43')]({},_0x5ba285,_0x2738e4[_0x4733('0x45')]);return _0x483183[_0x4733('0x7c')](_0x5ba285);}})[_0x4733('0x2c')](function(_0x58423d){if(_0x58423d){_0x390792=_0x58423d[_0x4733('0x3f')];if(!_0x2738e4[_0x4733('0x39')][_0x4733('0x40')](_0x4733('0x7b'))){_0x5ba285[_0x4733('0x25')]=qs[_0x4733('0x25')](_0x2738e4['query'][_0x4733('0x25')]);_0x5ba285[_0x4733('0x22')]=qs[_0x4733('0x22')](_0x2738e4['query'][_0x4733('0x22')]);}return _0x483183[_0x4733('0x7c')](_0x5ba285);}})[_0x4733('0x2c')](function(_0x18059d){if(_0x18059d){return _0x18059d?{'count':_0x390792,'rows':_0x18059d}:null;}})[_0x4733('0x2c')](respondWithResult(_0x49094c,null))['catch'](handleError(_0x49094c,null));};exports[_0x4733('0x7d')]=function(_0xdca68f,_0x54661b,_0x39f946){var _0xcf9a7b=_0xdca68f['body'][_0x4733('0x71')];var _0x44c378;return db[_0x4733('0x7e')][_0x4733('0x48')]({'where':{'id':_0xcf9a7b},'attributes':['id'],'include':[{'model':db[_0x4733('0x78')],'as':_0x4733('0x7f'),'attributes':['id',_0x4733('0x30'),'online','voicePause',_0x4733('0x80')],'raw':!![]}]})[_0x4733('0x2c')](function(_0x5e9302){if(_0x5e9302){_0x44c378=_0x5e9302;var _0x18b38c=_['flatMap'](_0x5e9302,function(_0x4d8180){var _0x24ceea=_0x4d8180[_0x4733('0x2e')]({'plain':!![]});return _0x24ceea[_0x4733('0x7f')];});return db[_0x4733('0x34')][_0x4733('0x4e')]({'where':{'id':_0xdca68f['params']['id']}})[_0x4733('0x2c')](function(_0x21172a){return db[_0x4733('0x51')][_0x4733('0x52')](function(_0x398650){return _0x21172a[_0x4733('0x7d')](_0xcf9a7b,{'transaction':_0x398650})[_0x4733('0x2c')](function(){return BPromise[_0x4733('0x81')](_0x44c378,function(_0x3bce79){return db[_0x4733('0x82')][_0x4733('0x83')]({'TeamId':_0x3bce79['id'],'VoicePrefixId':_0xdca68f[_0x4733('0x4c')]['id']},{'transaction':_0x398650});});})[_0x4733('0x2c')](function(){return BPromise['each'](_0x18b38c,function(_0x2ce46b){return db[_0x4733('0x84')][_0x4733('0x85')]({'where':{'UserId':_0x2ce46b['id'],'VoicePrefixId':_0xdca68f['params']['id']},'transaction':_0x398650});});})['then'](function(){_0x18b38c['forEach'](function(_0x483475){socket['emit'](_0x4733('0x72'),{'UserId':_0x483475['id'],'VoicePrefixId':_0x21172a['id']});});});});});}})[_0x4733('0x2c')](respondWithStatusCode(_0x54661b,null))['catch'](handleError(_0x54661b,null));};exports[_0x4733('0x86')]=function(_0x4c0c74,_0x225ed7,_0x3008dd){return db[_0x4733('0x7e')]['findAll']({'where':{'id':_0x4c0c74['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x4733('0x78')],'as':_0x4733('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x4733('0x2c')](handleEntityNotFound(_0x225ed7,null))[_0x4733('0x2c')](function(_0x30cf64){var _0x2a4f8f=_['map'](_0x30cf64,'id');var _0x11de09=[];var _0x32aa25=[];var _0x4c1543=squel[_0x4733('0x87')]();_0x4c1543[_0x4733('0x88')](_0x4733('0x89'))[_0x4733('0x8a')](_0x4733('0x8b'),'tq')[_0x4733('0x8c')](_0x4733('0x8d'),'ut',_0x4733('0x8e'))['where'](_0x4733('0x8f'),_0x4c0c74[_0x4733('0x4c')]['id']);for(var _0x56d626=0x0;_0x56d626<_0x30cf64[_0x4733('0x3f')];_0x56d626+=0x1){let _0x43c7d8=_0x30cf64[_0x56d626];for(var _0x277d4b=0x0;_0x277d4b<_0x43c7d8['Agents'][_0x4733('0x3f')];_0x277d4b+=0x1){let _0x47134a=_0x43c7d8['Agents'][_0x277d4b];var _0x499fc9=_0x4c1543['clone']();_0x499fc9['where'](_0x4733('0x90'),_0x47134a['id']);_0x32aa25['push'](db['sequelize'][_0x4733('0x39')](_0x499fc9[_0x4733('0x91')](),{'type':db[_0x4733('0x51')][_0x4733('0x92')][_0x4733('0x93')]})[_0x4733('0x2c')](function(_0x4a5b46){if(_0x4a5b46['length']===0x1){return _0x47134a['id'];}else{var _0x35fe07=_[_0x4733('0x94')](_['map'](_0x4a5b46,_0x4733('0x95')),function(_0x45225f){return _['includes'](_0x2a4f8f,_0x45225f);});if(_0x35fe07){return _0x47134a['id'];}}}));}}return BPromise[_0x4733('0x96')](_0x32aa25)[_0x4733('0x2c')](function(_0x7bf30a){_0x11de09=_(_0x11de09)['union'](_0x7bf30a)[_0x4733('0x97')]()[_0x4733('0x98')]();return db[_0x4733('0x34')][_0x4733('0x4e')]({'where':{'id':_0x4c0c74[_0x4733('0x4c')]['id']}})[_0x4733('0x2c')](function(_0x26c366){return db[_0x4733('0x51')]['transaction'](function(_0x4ee7ae){return _0x26c366[_0x4733('0x86')](_0x4c0c74[_0x4733('0x39')][_0x4733('0x71')],{'transaction':_0x4ee7ae})[_0x4733('0x2c')](function(){if(!_[_0x4733('0x99')](_0x11de09)){return _0x26c366[_0x4733('0x9a')](_0x11de09,{'transaction':_0x4ee7ae});}})[_0x4733('0x2c')](function(){_0x11de09['forEach'](function(_0x2b2e10){socket[_0x4733('0x74')](_0x4733('0x75'),{'UserId':_0x2b2e10,'VoicePrefixId':_0x26c366['id']});});});});});});})[_0x4733('0x2c')](respondWithStatusCode(_0x225ed7,null))[_0x4733('0x4a')](handleError(_0x225ed7,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index c914ba3..9c75744 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 _0xe716=['emit','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe716,0x8d));var _0x6e71=function(_0x2fecfb,_0x2077ef){_0x2fecfb=_0x2fecfb-0x0;var _0x168268=_0xe716[_0x2fecfb];return _0x168268;};'use strict';var EventEmitter=require(_0x6e71('0x0'));var VoicePrefix=require(_0x6e71('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6e71('0x2')](0x0);var events={'afterCreate':_0x6e71('0x3'),'afterUpdate':_0x6e71('0x4'),'afterDestroy':_0x6e71('0x5')};function emitEvent(_0xef6e3c){return function(_0x31e071,_0x46a54a,_0x5be456){VoicePrefixEvents['emit'](_0xef6e3c+':'+_0x31e071['id'],_0x31e071);VoicePrefixEvents[_0x6e71('0x6')](_0xef6e3c,_0x31e071);_0x5be456(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xaeea=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x331b85,_0x5f3e6e){var _0x1b97b2=function(_0x44d7c9){while(--_0x44d7c9){_0x331b85['push'](_0x331b85['shift']());}};_0x1b97b2(++_0x5f3e6e);}(_0xaeea,0x13b));var _0xaaee=function(_0x45eadb,_0x2c656c){_0x45eadb=_0x45eadb-0x0;var _0x29559f=_0xaeea[_0x45eadb];return _0x29559f;};'use strict';var EventEmitter=require(_0xaaee('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xaaee('0x1')](0x0);var events={'afterCreate':_0xaaee('0x2'),'afterUpdate':_0xaaee('0x3'),'afterDestroy':_0xaaee('0x4')};function emitEvent(_0x387e45){return function(_0x2530f3,_0x4b0520,_0xa4e88){VoicePrefixEvents[_0xaaee('0x5')](_0x387e45+':'+_0x2530f3['id'],_0x2530f3);VoicePrefixEvents[_0xaaee('0x5')](_0x387e45,_0x2530f3);_0xa4e88(null);};}for(var e in events){if(events[_0xaaee('0x6')](e)){var event=events[e];VoicePrefix[_0xaaee('0x7')](e,emitEvent(event));}}module[_0xaaee('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 03be02b..f81867d 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 _0x58ee=['request-promise','path','../../config/environment','define','VoicePrefix','voice_prefixes','lodash','util','api'];(function(_0x5de889,_0x115fc4){var _0x549a4f=function(_0x1255e8){while(--_0x1255e8){_0x5de889['push'](_0x5de889['shift']());}};_0x549a4f(++_0x115fc4);}(_0x58ee,0x16e));var _0xe58e=function(_0x440831,_0x11b6ca){_0x440831=_0x440831-0x0;var _0x5da803=_0x58ee[_0x440831];return _0x5da803;};'use strict';var _=require(_0xe58e('0x0'));var util=require(_0xe58e('0x1'));var logger=require('../../config/logger')(_0xe58e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe58e('0x3'));var fs=require('fs');var path=require(_0xe58e('0x4'));var rimraf=require('rimraf');var config=require(_0xe58e('0x5'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x3e1036,_0x4fd1cf){return _0x3e1036[_0xe58e('0x6')](_0xe58e('0x7'),attributes,{'tableName':_0xe58e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19ae=['moment','request-promise','path','rimraf','../../config/environment','exports','VoicePrefix','voice_prefixes','lodash','api'];(function(_0x309766,_0x2e03a6){var _0x44e45a=function(_0x31ffd6){while(--_0x31ffd6){_0x309766['push'](_0x309766['shift']());}};_0x44e45a(++_0x2e03a6);}(_0x19ae,0x102));var _0xe19a=function(_0x30e498,_0x57f274){_0x30e498=_0x30e498-0x0;var _0x42082a=_0x19ae[_0x30e498];return _0x42082a;};'use strict';var _=require(_0xe19a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe19a('0x1'));var moment=require(_0xe19a('0x2'));var BPromise=require('bluebird');var rp=require(_0xe19a('0x3'));var fs=require('fs');var path=require(_0xe19a('0x4'));var rimraf=require(_0xe19a('0x5'));var config=require(_0xe19a('0x6'));var attributes=require('./voicePrefix.attributes');module[_0xe19a('0x7')]=function(_0x3b6de5,_0x84bb24){return _0x3b6de5['define'](_0xe19a('0x8'),attributes,{'tableName':_0xe19a('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 f85764d..970acb7 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 _0x5ff9=['util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x64a083,_0x4af4f3){var _0x1e46bd=function(_0x3ab9a8){while(--_0x3ab9a8){_0x64a083['push'](_0x64a083['shift']());}};_0x1e46bd(++_0x4af4f3);}(_0x5ff9,0xa0));var _0x95ff=function(_0x16bb96,_0x590ef5){_0x16bb96=_0x16bb96-0x0;var _0x4720c8=_0x5ff9[_0x16bb96];return _0x4720c8;};'use strict';var _=require(_0x95ff('0x0'));var util=require(_0x95ff('0x1'));var moment=require('moment');var BPromise=require(_0x95ff('0x2'));var rs=require(_0x95ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95ff('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x95ff('0x5'));var jayson=require(_0x95ff('0x6'));var client=jayson['client'][_0x95ff('0x7')]({'port':0x232a});config['redis']=_[_0x95ff('0x8')](config[_0x95ff('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x95ff('0xa'))(new Redis(config['redis']));require(_0x95ff('0xb'))[_0x95ff('0xc')](socket);function respondWithRpcPromise(_0x4807b6,_0x17b39b,_0x1f3e2d){return new BPromise(function(_0x2a1750,_0x4f5bb9){return client[_0x95ff('0xd')](_0x4807b6,_0x1f3e2d)[_0x95ff('0xe')](function(_0x39d786){logger[_0x95ff('0xf')](_0x95ff('0x10'),_0x17b39b,_0x95ff('0x11'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x17b39b,_0x95ff('0x11'),JSON[_0x95ff('0x12')](_0x39d786));if(_0x39d786[_0x95ff('0x13')]){if(_0x39d786[_0x95ff('0x13')]['code']===0x1f4){logger[_0x95ff('0x13')](_0x95ff('0x10'),_0x17b39b,_0x39d786['error'][_0x95ff('0x14')]);return _0x4f5bb9(_0x39d786[_0x95ff('0x13')]['message']);}logger['error'](_0x95ff('0x10'),_0x17b39b,_0x39d786[_0x95ff('0x13')][_0x95ff('0x14')]);return _0x2a1750(_0x39d786['error'][_0x95ff('0x14')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x17b39b,_0x95ff('0x11'));_0x2a1750(_0x39d786[_0x95ff('0x15')][_0x95ff('0x14')]);}})[_0x95ff('0x16')](function(_0x5e7132){logger[_0x95ff('0x13')](_0x95ff('0x10'),_0x17b39b,_0x5e7132);_0x4f5bb9(_0x5e7132);});});} \ No newline at end of file +var _0x78f4=['debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x478f('0x0'));var moment=require(_0x478f('0x1'));var BPromise=require(_0x478f('0x2'));var rs=require(_0x478f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x478f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x478f('0x5'))(_0x478f('0x6'));var config=require(_0x478f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x478f('0x8')][_0x478f('0x9')]({'port':0x232a});config['redis']=_[_0x478f('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x478f('0xb'))(new Redis(config['redis']));require(_0x478f('0xc'))[_0x478f('0xd')](socket);function respondWithRpcPromise(_0xec2f39,_0x469c69,_0x5a724b){return new BPromise(function(_0x5e6a27,_0x32ea1a){return client[_0x478f('0xe')](_0xec2f39,_0x5a724b)[_0x478f('0xf')](function(_0x45e1dd){logger[_0x478f('0x10')](_0x478f('0x11'),_0x469c69,_0x478f('0x12'));logger[_0x478f('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x469c69,_0x478f('0x12'),JSON[_0x478f('0x14')](_0x45e1dd));if(_0x45e1dd[_0x478f('0x15')]){if(_0x45e1dd[_0x478f('0x15')][_0x478f('0x16')]===0x1f4){logger[_0x478f('0x15')](_0x478f('0x11'),_0x469c69,_0x45e1dd[_0x478f('0x15')]['message']);return _0x32ea1a(_0x45e1dd[_0x478f('0x15')][_0x478f('0x17')]);}logger[_0x478f('0x15')](_0x478f('0x11'),_0x469c69,_0x45e1dd['error'][_0x478f('0x17')]);return _0x5e6a27(_0x45e1dd['error'][_0x478f('0x17')]);}else{logger[_0x478f('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x469c69,_0x478f('0x12'));_0x5e6a27(_0x45e1dd['result'][_0x478f('0x17')]);}})[_0x478f('0x18')](function(_0x181d9d){logger[_0x478f('0x15')](_0x478f('0x11'),_0x469c69,_0x181d9d);_0x32ea1a(_0x181d9d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 47dce18..b64fb3e 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 _0xfdb5=['remove','register','voicePrefix:','./voicePrefix.events','save'];(function(_0x42bd5d,_0x3133cf){var _0x19c35a=function(_0x1f691d){while(--_0x1f691d){_0x42bd5d['push'](_0x42bd5d['shift']());}};_0x19c35a(++_0x3133cf);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xfdb5[_0x1589dd];return _0x1bddd1;};'use strict';var VoicePrefixEvents=require(_0x5fdb('0x0'));var events=[_0x5fdb('0x1'),_0x5fdb('0x2'),'update'];function createListener(_0x190bc2,_0x3067fa){return function(_0x7da3ba){_0x3067fa['emit'](_0x190bc2,_0x7da3ba);};}function removeListener(_0x55124b,_0x3ff059){return function(){VoicePrefixEvents['removeListener'](_0x55124b,_0x3ff059);};}exports[_0x5fdb('0x3')]=function(_0x4a2149){for(var _0x1b0148=0x0,_0xda053e=events['length'];_0x1b0148<_0xda053e;_0x1b0148++){var _0x542bbc=events[_0x1b0148];var _0x5a556e=createListener(_0x5fdb('0x4')+_0x542bbc,_0x4a2149);VoicePrefixEvents['on'](_0x542bbc,_0x5a556e);}}; \ No newline at end of file +var _0x6c6f=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x48f13c,_0x29e885){var _0x3c5779=function(_0x5e3ebb){while(--_0x5e3ebb){_0x48f13c['push'](_0x48f13c['shift']());}};_0x3c5779(++_0x29e885);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x5cbdbe,_0x322f75){_0x5cbdbe=_0x5cbdbe-0x0;var _0x783646=_0x6c6f[_0x5cbdbe];return _0x783646;};'use strict';var VoicePrefixEvents=require(_0xf6c6('0x0'));var events=[_0xf6c6('0x1'),_0xf6c6('0x2'),_0xf6c6('0x3')];function createListener(_0x2f571d,_0x3c8fc3){return function(_0x332916){_0x3c8fc3[_0xf6c6('0x4')](_0x2f571d,_0x332916);};}function removeListener(_0x36fcd2,_0xa1183){return function(){VoicePrefixEvents[_0xf6c6('0x5')](_0x36fcd2,_0xa1183);};}exports['register']=function(_0x3b4e7b){for(var _0x4f8e34=0x0,_0x4c27f8=events[_0xf6c6('0x6')];_0x4f8e34<_0x4c27f8;_0x4f8e34++){var _0x5b34df=events[_0x4f8e34];var _0x308c42=createListener(_0xf6c6('0x7')+_0x5b34df,_0x3b4e7b);VoicePrefixEvents['on'](_0x5b34df,_0x308c42);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e9b6f48..bd39ecb 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x350998,_0x3cfdc4){var _0x3ba4af=function(_0x51e45f){while(--_0x51e45f){_0x350998['push'](_0x350998['shift']());}};_0x3ba4af(++_0x3cfdc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x2e5981,_0xe4e846){var _0x6e4fef=function(_0x252b0c){while(--_0x252b0c){_0x2e5981['push'](_0x2e5981['shift']());}};_0x6e4fef(++_0xe4e846);}(_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/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 1b1bbe8..ed2b6e5 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 _0xe407=['sequelize','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','Active/Disactive\x20Campaign','progressive','predictive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition'];(function(_0x107713,_0x18d7b1){var _0x1d849e=function(_0x15925c){while(--_0x15925c){_0x107713['push'](_0x107713['shift']());}};_0x1d849e(++_0x18d7b1);}(_0xe407,0x12c));var _0x7e40=function(_0x3a3569,_0x25a697){_0x3a3569=_0x3a3569-0x0;var _0x49d1dd=_0xe407[_0x3a3569];return _0x49d1dd;};'use strict';var Sequelize=require(_0x7e40('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e40('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7e40('0x2')](_0x7e40('0x3'),_0x7e40('0x4')),'allowNull':![],'defaultValue':_0x7e40('0x3')},'musiconhold':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':_0x7e40('0x5')},'announce':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x7e40('0x2')]('rr',_0x7e40('0x6'),_0x7e40('0x7'),_0x7e40('0x8'),'random',_0x7e40('0x9'),_0x7e40('0xa'),'wrandom',_0x7e40('0xb')),'allowNull':![],'defaultValue':_0x7e40('0x6'),'set':function(_0x17488c){this[_0x7e40('0xc')](_0x7e40('0xd'),_0x17488c?_0x17488c:'rrmemory');},'get':function(){var _0x227556=this[_0x7e40('0xe')](_0x7e40('0xf'));var _0x251af6=this[_0x7e40('0xe')](_0x7e40('0x10'));var _0x3557f6=this[_0x7e40('0xe')](_0x7e40('0xd'));if(_0x227556===_0x7e40('0x4')){if(_0x251af6===_0x7e40('0x11')){return null;}if(_0x251af6===_0x7e40('0x12')&&![_0x7e40('0x9'),'roundrobin'][_0x7e40('0x13')](_0x3557f6)){this[_0x7e40('0xc')](_0x7e40('0xd'),'rrmemory');}}return _0x3557f6;}},'servicelevel':{'type':Sequelize[_0x7e40('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7e40('0x14')](0xb)},'timeout':{'type':Sequelize[_0x7e40('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7e40('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7e40('0x1')]},'weight':{'type':Sequelize[_0x7e40('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x7e40('0x15'),'no'),'defaultValue':_0x7e40('0x15')},'autopause':{'type':Sequelize['ENUM'](_0x7e40('0x15'),'no',_0x7e40('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x7e40('0x2')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7e40('0x2')](_0x7e40('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x7e40('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7e40('0x2')](_0x7e40('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7e40('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7e40('0x2')](_0x7e40('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x7e40('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7e40('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x7e40('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7e40('0x2')](_0x7e40('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x7e40('0x2')](_0x7e40('0x15'),'no'),'defaultValue':_0x7e40('0x15')},'announce_holdtime':{'type':Sequelize[_0x7e40('0x2')]('yes','no',_0x7e40('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x7e40('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x7e40('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7e40('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7e40('0x1')]},'queue_quantity1':{'type':Sequelize[_0x7e40('0x1')]},'queue_quantity2':{'type':Sequelize[_0x7e40('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x7e40('0x1')]},'periodic_announce':{'type':Sequelize[_0x7e40('0x18')],'set':function(_0x58157f){this['setDataValue'](_0x7e40('0x19'),_0x58157f?_0x58157f[_0x7e40('0x1a')](','):[]);},'get':function(){return this[_0x7e40('0xe')](_0x7e40('0x19'))?this[_0x7e40('0xe')]('periodic_announce')[_0x7e40('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':_0x7e40('0x15'),'set':function(_0x5c65a9){this[_0x7e40('0xc')](_0x7e40('0x1c'),_0x5c65a9?_0x5c65a9[_0x7e40('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0x7e40('0x1c'))?this[_0x7e40('0xe')](_0x7e40('0x1c'))[_0x7e40('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':'no','set':function(_0x2e60a1){this[_0x7e40('0xc')]('leavewhenempty',_0x2e60a1?_0x2e60a1['join'](','):undefined);},'get':function(){return this[_0x7e40('0xe')](_0x7e40('0x1d'))?this['getDataValue'](_0x7e40('0x1d'))[_0x7e40('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7e40('0x2')](_0x7e40('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7e40('0x2')](_0x7e40('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x7e40('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7e40('0x2')](_0x7e40('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7e40('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0xdcc9eb){this[_0x7e40('0xc')]('acw',_0xdcc9eb);if(_0xdcc9eb){if(this[_0x7e40('0xe')]('wrapuptime')<0x2){this[_0x7e40('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7e40('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7e40('0x1e')],'defaultValue':0x0,'comment':_0x7e40('0x1f')},'dialMethod':{'type':Sequelize[_0x7e40('0x2')](_0x7e40('0x11'),_0x7e40('0x20'),'power',_0x7e40('0x21'),_0x7e40('0x12')),'defaultValue':_0x7e40('0x20'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x7e40('0x14')](0x4)[_0x7e40('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7e40('0x23')},'dialLimitQueue':{'type':Sequelize[_0x7e40('0x14')](0x4)[_0x7e40('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7e40('0x24')},'dialPowerLevel':{'type':Sequelize[_0x7e40('0x25')](0x2)[_0x7e40('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7e40('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x7e40('0x2')]('agentBusyFactor',_0x7e40('0x27')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7e40('0x25')](0x2)[_0x7e40('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x7e40('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0x7e40('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x7e40('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7e40('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7e40('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x7e40('0x14')](0x3)[_0x7e40('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e40('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x7e40('0x14')](0x3)[_0x7e40('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e40('0x2b')},'dialQueueProject':{'type':Sequelize[_0x7e40('0x1')],'comment':_0x7e40('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7e40('0x14')](0x3)[_0x7e40('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7e40('0x14')](0x5)[_0x7e40('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e40('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0x7e40('0x14')](0x3)[_0x7e40('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x7e40('0x14')](0x5)[_0x7e40('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7e40('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x7e40('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7e40('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7e40('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7e40('0x2f')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7e40('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x7e40('0x2')](_0x7e40('0x30'),_0x7e40('0x31'),_0x7e40('0x32')),'defaultValue':_0x7e40('0x30')},'dialAMDActive':{'type':Sequelize[_0x7e40('0x1e')],'defaultValue':0x0,'comment':_0x7e40('0x33')},'dialAMDInitialSilence':{'type':Sequelize[_0x7e40('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7e40('0x34')},'dialAMDGreeting':{'type':Sequelize[_0x7e40('0x14')](0x9)[_0x7e40('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7e40('0x35')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7e40('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7e40('0x14')](0x9)[_0x7e40('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7e40('0x36')},'dialAMDMinWordLength':{'type':Sequelize[_0x7e40('0x14')](0x9)[_0x7e40('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7e40('0x37')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7e40('0x14')](0x9)[_0x7e40('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7e40('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7e40('0x14')](0x9)[_0x7e40('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7e40('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7e40('0x14')](0x5)[_0x7e40('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7e40('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7e40('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7e40('0x3b')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x7e40('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7e40('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x7e40('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x7e40('0x2')]('DESC',_0x7e40('0x3d')),'defaultValue':_0x7e40('0x3e')},'dialQueueProject2':{'type':Sequelize[_0x7e40('0x1')],'comment':_0x7e40('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7e40('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x7e40('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7e40('0x14')](0x3)[_0x7e40('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7e40('0x3f')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x7e40('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e40('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7e40('0x14')](0x5)[_0x7e40('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e40('0x41')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e40('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0x7e40('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e40('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7e40('0x14')](0x3)[_0x7e40('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e40('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7e40('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e40('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x7e40('0x14')](0x3)[_0x7e40('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x7e40('0x14')](0x5)[_0x7e40('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7e40('0x14')](0x3)[_0x7e40('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7e40('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7e40('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7e40('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7e40('0x14')],'allowNull':!![],'comment':_0x7e40('0x48')},'mandatoryDisposition':{'type':Sequelize[_0x7e40('0x1e')],'defaultValue':![],'comment':_0x7e40('0x49'),'set':function(_0x5642e8){if(!_0x5642e8)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x7e40('0xc')](_0x7e40('0x4a'),_0x5642e8);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7e40('0x14')](0x3)[_0x7e40('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x7e40('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x7e40('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x7e40('0x14')](0x3)[_0x7e40('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7e40('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x4ed1=['#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','STRING','name','inbound','ENUM','ringall','leastrecent','fewestcalls','random','linear','wrandom','rrordered','setDataValue','rrmemory','getDataValue','type','dialMethod','strategy','outbound','preview','booked','INTEGER','yes','all','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','acw','Active/Disactive\x20Campaign','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','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)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\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','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4ed1,0x148));var _0x14ed=function(_0x53f6a1,_0xe2c066){_0x53f6a1=_0x53f6a1-0x0;var _0x433f93=_0x4ed1[_0x53f6a1];return _0x433f93;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x14ed('0x0')],'allowNull':![],'unique':_0x14ed('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x14ed('0x2'),'outbound'),'allowNull':![],'defaultValue':_0x14ed('0x2')},'musiconhold':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':''},'strategy':{'type':Sequelize[_0x14ed('0x3')]('rr',_0x14ed('0x4'),_0x14ed('0x5'),_0x14ed('0x6'),_0x14ed('0x7'),'rrmemory',_0x14ed('0x8'),_0x14ed('0x9'),_0x14ed('0xa')),'allowNull':![],'defaultValue':_0x14ed('0x4'),'set':function(_0x4231eb){this[_0x14ed('0xb')]('strategy',_0x4231eb?_0x4231eb:_0x14ed('0xc'));},'get':function(){var _0x36062a=this[_0x14ed('0xd')](_0x14ed('0xe'));var _0x41a29d=this[_0x14ed('0xd')](_0x14ed('0xf'));var _0x5bf377=this[_0x14ed('0xd')](_0x14ed('0x10'));if(_0x36062a===_0x14ed('0x11')){if(_0x41a29d===_0x14ed('0x12')){return null;}if(_0x41a29d===_0x14ed('0x13')&&!['rrmemory','roundrobin']['includes'](_0x5bf377)){this[_0x14ed('0xb')](_0x14ed('0x10'),_0x14ed('0xc'));}}return _0x5bf377;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x14ed('0x14')](0xb)},'timeout':{'type':Sequelize[_0x14ed('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x14ed('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x14ed('0x0')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x14ed('0x3')]('yes','no'),'defaultValue':_0x14ed('0x15')},'autopause':{'type':Sequelize['ENUM'](_0x14ed('0x15'),'no',_0x14ed('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x14ed('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x14ed('0x3')](_0x14ed('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x14ed('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x14ed('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x14ed('0x3')](_0x14ed('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x14ed('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x14ed('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x14ed('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x14ed('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x14ed('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x14ed('0x3')](_0x14ed('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x14ed('0x3')](_0x14ed('0x15'),'no'),'defaultValue':_0x14ed('0x15')},'announce_holdtime':{'type':Sequelize[_0x14ed('0x3')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x14ed('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x14ed('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x14ed('0x0')]},'queue_youarenext':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x14ed('0x0')]},'queue_quantity1':{'type':Sequelize[_0x14ed('0x0')]},'queue_quantity2':{'type':Sequelize[_0x14ed('0x0')]},'queue_periodic_announce':{'type':Sequelize[_0x14ed('0x0')]},'queue_less_than':{'type':Sequelize[_0x14ed('0x0')]},'periodic_announce':{'type':Sequelize[_0x14ed('0x17')],'set':function(_0x498fc8){this[_0x14ed('0xb')](_0x14ed('0x18'),_0x498fc8?_0x498fc8[_0x14ed('0x19')](','):[]);},'get':function(){return this[_0x14ed('0xd')](_0x14ed('0x18'))?this['getDataValue'](_0x14ed('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':_0x14ed('0x15'),'set':function(_0x3cccd2){this[_0x14ed('0xb')]('joinempty',_0x3cccd2?_0x3cccd2[_0x14ed('0x19')](','):undefined);},'get':function(){return this[_0x14ed('0xd')](_0x14ed('0x1a'))?this[_0x14ed('0xd')](_0x14ed('0x1a'))[_0x14ed('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':'no','set':function(_0x17c011){this[_0x14ed('0xb')](_0x14ed('0x1c'),_0x17c011?_0x17c011[_0x14ed('0x19')](','):undefined);},'get':function(){return this[_0x14ed('0xd')](_0x14ed('0x1c'))?this['getDataValue'](_0x14ed('0x1c'))[_0x14ed('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x14ed('0x3')](_0x14ed('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x14ed('0x3')](_0x14ed('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x14ed('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x14ed('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x14ed('0x0')]},'description':{'type':Sequelize[_0x14ed('0x0')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x11a718){this[_0x14ed('0xb')](_0x14ed('0x1d'),_0x11a718);if(_0x11a718){if(this[_0x14ed('0xd')]('wrapuptime')<0x2){this[_0x14ed('0xb')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x14ed('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x14ed('0x1e')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x14ed('0x1f'),'power',_0x14ed('0x20'),'booked'),'defaultValue':_0x14ed('0x1f'),'comment':_0x14ed('0x21')},'dialLimitChannel':{'type':Sequelize[_0x14ed('0x14')](0x4)[_0x14ed('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x14ed('0x23')},'dialLimitQueue':{'type':Sequelize[_0x14ed('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x14ed('0x24')},'dialPowerLevel':{'type':Sequelize[_0x14ed('0x25')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x14ed('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x14ed('0x3')](_0x14ed('0x27'),_0x14ed('0x28')),'defaultValue':_0x14ed('0x28'),'comment':_0x14ed('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x14ed('0x25')](0x2)[_0x14ed('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x14ed('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x14ed('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x14ed('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x14ed('0x0')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x14ed('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14ed('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':'tTxX','comment':_0x14ed('0x2c')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x14ed('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14ed('0x2d')},'dialQueueProject':{'type':Sequelize[_0x14ed('0x0')],'comment':_0x14ed('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x14ed('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14ed('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x14ed('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14ed('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x14ed('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14ed('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x14ed('0x14')](0x5)[_0x14ed('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x14ed('0x22')],'defaultValue':0x3,'comment':_0x14ed('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x14ed('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x14ed('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x14ed('0x33')},'dialTimezone':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':_0x14ed('0x34')},'dialPrefix':{'type':Sequelize[_0x14ed('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x14ed('0x3')](_0x14ed('0x35'),_0x14ed('0x36'),_0x14ed('0x37')),'defaultValue':_0x14ed('0x35')},'dialAMDActive':{'type':Sequelize[_0x14ed('0x38')],'defaultValue':0x0,'comment':_0x14ed('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x14ed('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x14ed('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x14ed('0x14')](0x9)[_0x14ed('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x14ed('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x14ed('0x14')](0x9)[_0x14ed('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x14ed('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x14ed('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x14ed('0x3d')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x14ed('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x14ed('0x14')](0x9)[_0x14ed('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x14ed('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x14ed('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x14ed('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x14ed('0x14')](0x5)[_0x14ed('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x14ed('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x14ed('0x14')](0x9)[_0x14ed('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x14ed('0x14')](0x5)[_0x14ed('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x14ed('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x14ed('0x38')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x14ed('0x3')](_0x14ed('0x42'),_0x14ed('0x43')),'defaultValue':_0x14ed('0x42')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x14ed('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x14ed('0x38')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x14ed('0x14')](0x3)[_0x14ed('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x14ed('0x14')](0x3)[_0x14ed('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x14ed('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x14ed('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14ed('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x14ed('0x14')](0x5)[_0x14ed('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14ed('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x14ed('0x14')](0x3)[_0x14ed('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x14ed('0x14')](0x5)[_0x14ed('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14ed('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x14ed('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14ed('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x14ed('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14ed('0x49')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x14ed('0x14')](0x5)[_0x14ed('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14ed('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x14ed('0x14')](0x3)[_0x14ed('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14ed('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x14ed('0x14')](0x5)[_0x14ed('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14ed('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x14ed('0x14')],'allowNull':!![],'comment':_0x14ed('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x14ed('0x38')],'defaultValue':![],'comment':_0x14ed('0x4e'),'set':function(_0x462ffa){if(!_0x462ffa)this[_0x14ed('0xb')](_0x14ed('0x4f'),null);this['setDataValue']('mandatoryDisposition',_0x462ffa);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x14ed('0x14')](0x3)[_0x14ed('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x14ed('0x14')](0x3)[_0x14ed('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x14ed('0x38')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x14ed('0x14')](0x3)[_0x14ed('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x14ed('0x38')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index e362fa0..bc3d7cd 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 _0x90ec=['getHoppers','CmHopper','hasOwnProperty','nolimit','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','Team','getTeams','addTeams','User','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueueRt','format','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','userVoiceQueue:save','online','isNil','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ListId','select','phone','ContactId','CmListId','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','scheduledAt','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','CmHopperId','OrderBy','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','json','offset','count','status','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','value','includes','type','find','name','UserProfileResource','send','index','map','VoiceQueue','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','createdAt','updatedAt','omit','role','userProfileId'];(function(_0xa3e33b,_0x4633fc){var _0x437125=function(_0xf98cfc){while(--_0xf98cfc){_0xa3e33b['push'](_0xa3e33b['shift']());}};_0x437125(++_0x4633fc);}(_0x90ec,0x1d4));var _0xc90e=function(_0xa3d13d,_0x134b1b){_0xa3d13d=_0xa3d13d-0x0;var _0x35f6cf=_0x90ec[_0xa3d13d];return _0x35f6cf;};'use strict';var emlformat=require(_0xc90e('0x0'));var rimraf=require(_0xc90e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc90e('0x2'));var rp=require(_0xc90e('0x3'));var moment=require(_0xc90e('0x4'));var BPromise=require(_0xc90e('0x5'));var Mustache=require(_0xc90e('0x6'));var util=require('util');var path=require(_0xc90e('0x7'));var sox=require(_0xc90e('0x8'));var csv=require(_0xc90e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc90e('0xa'));var _=require('lodash');var squel=require(_0xc90e('0xb'));var crypto=require(_0xc90e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc90e('0xd'));var toCsv=require(_0xc90e('0x9'));var querystring=require(_0xc90e('0xe'));var Papa=require(_0xc90e('0xf'));var Redis=require(_0xc90e('0x10'));var authService=require(_0xc90e('0x11'));var qs=require(_0xc90e('0x12'));var as=require(_0xc90e('0x13'));var hardwareService=require(_0xc90e('0x14'));var logger=require('../../config/logger')(_0xc90e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc90e('0x16')]=_[_0xc90e('0x17')](config['redis'],{'host':_0xc90e('0x18'),'port':0x18eb});var socket=require(_0xc90e('0x19'))(new Redis(config['redis']));require(_0xc90e('0x1a'))[_0xc90e('0x1b')](socket);function respondWithStatusCode(_0x274876,_0x2758bb){_0x2758bb=_0x2758bb||0xcc;return function(_0x1de265){if(_0x1de265){return _0x274876[_0xc90e('0x1c')](_0x2758bb);}return _0x274876['status'](_0x2758bb)[_0xc90e('0x1d')]();};}function respondWithResult(_0x2ada5a,_0x4ff295){_0x4ff295=_0x4ff295||0xc8;return function(_0xd16172){if(_0xd16172){return _0x2ada5a['status'](_0x4ff295)[_0xc90e('0x1e')](_0xd16172);}};}function respondWithFilteredResult(_0x153415,_0x558b22){return function(_0x934f8b){if(_0x934f8b){var _0xe0e0bc=typeof _0x558b22[_0xc90e('0x1f')]==='undefined'&&typeof _0x558b22['limit']==='undefined';var _0x161a3a=_0x934f8b[_0xc90e('0x20')];var _0x25b1d7=_0xe0e0bc?0x0:_0x558b22[_0xc90e('0x1f')];var _0x8fb1ef=_0xe0e0bc?_0x934f8b['count']:_0x558b22[_0xc90e('0x1f')]+_0x558b22['limit'];var _0x3ae806;if(_0x8fb1ef>=_0x161a3a){_0x8fb1ef=_0x161a3a;_0x3ae806=0xc8;}else{_0x3ae806=0xce;}_0x153415[_0xc90e('0x21')](_0x3ae806);return _0x153415['set'](_0xc90e('0x22'),_0x25b1d7+'-'+_0x8fb1ef+'/'+_0x161a3a)[_0xc90e('0x1e')](_0x934f8b);}return null;};}function patchUpdates(_0x957d1e){return function(_0x114042){try{jsonpatch[_0xc90e('0x23')](_0x114042,_0x957d1e,!![]);}catch(_0x282c53){return BPromise[_0xc90e('0x24')](_0x282c53);}return _0x114042[_0xc90e('0x25')]();};}function saveUpdates(_0x1cff73,_0x52aa00){return function(_0x1d700a){if(_0x1d700a){return _0x1d700a[_0xc90e('0x26')](_0x1cff73)[_0xc90e('0x27')](function(_0x380f3f){return _0x380f3f;});}return null;};}function removeEntity(_0x3371aa,_0x59d731){return function(_0x2e4d0c){if(_0x2e4d0c){return _0x2e4d0c[_0xc90e('0x28')]()[_0xc90e('0x27')](function(){var _0x4fde04=_0x2e4d0c[_0xc90e('0x29')]({'plain':!![]});var _0x2ea6e6=[{'name':_0xc90e('0x2a'),'value':_0xc90e('0x2b'),'ignore':![]},{'name':_0xc90e('0x2c'),'value':_0xc90e('0x2d'),'ignore':![]}];var _0x5ab0af=_(_0x2ea6e6)['filter'](_0xc90e('0x2e'))['map'](_0xc90e('0x2f'))[_0xc90e('0x2f')]();if(_[_0xc90e('0x30')](_0x5ab0af,_0x4fde04[_0xc90e('0x31')])){return;}var _0x2c9ced=_[_0xc90e('0x32')](_0x2ea6e6,[_0xc90e('0x2f'),_0x4fde04['type']])[_0xc90e('0x33')];return db[_0xc90e('0x34')]['destroy']({'where':{'type':_0x2c9ced,'resourceId':_0x4fde04['id']}})[_0xc90e('0x27')](function(){return _0x2e4d0c;});})['then'](function(){_0x3371aa[_0xc90e('0x21')](0xcc)[_0xc90e('0x1d')]();});}};}function handleEntityNotFound(_0xad857d,_0x3ecbc1){return function(_0x297498){if(!_0x297498){_0xad857d[_0xc90e('0x1c')](0x194);}return _0x297498;};}function handleError(_0xc65f5b,_0x14f534){_0x14f534=_0x14f534||0x1f4;return function(_0x89462e){logger['error'](_0x89462e['stack']);if(_0x89462e[_0xc90e('0x33')]){delete _0x89462e[_0xc90e('0x33')];}_0xc65f5b[_0xc90e('0x21')](_0x14f534)[_0xc90e('0x35')](_0x89462e);};}exports[_0xc90e('0x36')]=function(_0x314644,_0x5924fa){var _0x1f7d4c={},_0x42b216={},_0x186db4={'count':0x0,'rows':[]};var _0x4fc508=_[_0xc90e('0x37')](db[_0xc90e('0x38')][_0xc90e('0x39')],function(_0x437d26){return{'name':_0x437d26['fieldName'],'type':_0x437d26['type']['key']};});_0x42b216[_0xc90e('0x3a')]=_[_0xc90e('0x37')](_0x4fc508,_0xc90e('0x33'));_0x42b216[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x314644['query']);_0x42b216[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0x42b216[_0xc90e('0x3a')],_0x42b216[_0xc90e('0x3b')]);_0x1f7d4c[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x42b216[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x314644[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x1f7d4c[_0xc90e('0x3f')]=_0x1f7d4c[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x1f7d4c['attributes']:_0x42b216[_0xc90e('0x3a')];if(!_0x314644[_0xc90e('0x3b')]['hasOwnProperty']('nolimit')){_0x1f7d4c[_0xc90e('0x42')]=qs['limit'](_0x314644[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x1f7d4c['offset']=qs[_0xc90e('0x1f')](_0x314644['query']['offset']);}_0x1f7d4c[_0xc90e('0x43')]=qs['sort'](_0x314644['query'][_0xc90e('0x44')]);_0x1f7d4c[_0xc90e('0x45')]=qs['filters'](_[_0xc90e('0x46')](_0x314644[_0xc90e('0x3b')],_0x42b216[_0xc90e('0x3d')]),_0x4fc508);if(_0x314644[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x1f7d4c[_0xc90e('0x45')]=_[_0xc90e('0x48')](_0x1f7d4c[_0xc90e('0x45')],{'$or':_['map'](_0x4fc508,function(_0xd8113c){if(_0xd8113c['type']!=='VIRTUAL'){var _0x36f1f7={};_0x36f1f7[_0xd8113c['name']]={'$like':'%'+_0x314644[_0xc90e('0x3b')]['filter']+'%'};return _0x36f1f7;}})});}_0x1f7d4c=_[_0xc90e('0x48')]({},_0x1f7d4c,_0x314644[_0xc90e('0x49')]);var _0x15f492={'where':_0x1f7d4c[_0xc90e('0x45')]};return db[_0xc90e('0x38')][_0xc90e('0x20')](_0x15f492)[_0xc90e('0x27')](function(_0x260520){_0x186db4[_0xc90e('0x20')]=_0x260520;if(_0x314644['query'][_0xc90e('0x4a')]){_0x1f7d4c[_0xc90e('0x4b')]=[{'all':!![]}];}return db[_0xc90e('0x38')][_0xc90e('0x4c')](_0x1f7d4c);})['then'](function(_0x21408a){_0x186db4[_0xc90e('0x4d')]=_0x21408a;return _0x186db4;})[_0xc90e('0x27')](respondWithFilteredResult(_0x5924fa,_0x1f7d4c))['catch'](handleError(_0x5924fa,null));};exports[_0xc90e('0x4e')]=function(_0x49c8ab,_0x45f816){var _0x4c547c={'raw':![],'where':{'id':_0x49c8ab['params']['id']}},_0x130263={};_0x130263[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x38')][_0xc90e('0x39')]);_0x130263[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x49c8ab[_0xc90e('0x3b')]);_0x130263[_0xc90e('0x3d')]=_['intersection'](_0x130263[_0xc90e('0x3a')],_0x130263[_0xc90e('0x3b')]);_0x4c547c['attributes']=_['intersection'](_0x130263[_0xc90e('0x3a')],qs['fields'](_0x49c8ab[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x4c547c[_0xc90e('0x3f')]=_0x4c547c[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x4c547c['attributes']:_0x130263[_0xc90e('0x3a')];if(_0x49c8ab[_0xc90e('0x3b')]['includeAll']){_0x4c547c[_0xc90e('0x4b')]=[{'all':!![]}];}_0x4c547c=_['merge']({},_0x4c547c,_0x49c8ab[_0xc90e('0x49')]);return db['VoiceQueue'][_0xc90e('0x32')](_0x4c547c)[_0xc90e('0x27')](handleEntityNotFound(_0x45f816,null))[_0xc90e('0x27')](respondWithResult(_0x45f816,null))[_0xc90e('0x4f')](handleError(_0x45f816,null));};exports[_0xc90e('0x50')]=function(_0x3b8ec8,_0xa8b8b6){return db[_0xc90e('0x38')][_0xc90e('0x50')](_0x3b8ec8[_0xc90e('0x51')],{})[_0xc90e('0x27')](function(_0x38e86c){var _0x13f306=_0x3b8ec8[_0xc90e('0x52')][_0xc90e('0x29')]({'plain':!![]});if(!_0x13f306)throw new Error(_0xc90e('0x53'));if(_0x13f306['role']===_0xc90e('0x52')){var _0x1e0ef8=_0x38e86c[_0xc90e('0x29')]({'plain':!![]});var _0x2dadfe=[{'name':_0xc90e('0x2a'),'value':_0xc90e('0x2b')},{'name':_0xc90e('0x2c'),'value':'outbound'}];var _0x1ec7f2=_['find'](_0x2dadfe,[_0xc90e('0x2f'),_0x1e0ef8[_0xc90e('0x31')]])[_0xc90e('0x33')];return db[_0xc90e('0x54')][_0xc90e('0x32')]({'where':{'name':_0x1ec7f2,'userProfileId':_0x13f306['userProfileId']},'raw':!![]})[_0xc90e('0x27')](function(_0x26f06f){if(_0x26f06f&&_0x26f06f['autoAssociation']===0x0){return db[_0xc90e('0x34')][_0xc90e('0x50')]({'name':_0x1e0ef8[_0xc90e('0x33')],'resourceId':_0x1e0ef8['id'],'type':_0x26f06f[_0xc90e('0x33')],'sectionId':_0x26f06f['id']},{})['then'](function(){return _0x38e86c;});}else{return _0x38e86c;}})['catch'](function(_0x308b22){logger[_0xc90e('0x55')](_0xc90e('0x56'),_0x308b22);throw _0x308b22;});}return _0x38e86c;})[_0xc90e('0x27')](respondWithResult(_0xa8b8b6,0xc9))[_0xc90e('0x4f')](handleError(_0xa8b8b6,null));};exports['clone']=function(_0x3e8c0d,_0x40b61e){var _0x4aa069={'where':{'id':_0x3e8c0d[_0xc90e('0x57')]['id']}},_0x4a0f64={};_0x4a0f64[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x38')]['rawAttributes']);_0x4aa069[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x4a0f64[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x3e8c0d[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x4aa069[_0xc90e('0x3f')]=_0x4aa069[_0xc90e('0x3f')]['length']?_0x4aa069[_0xc90e('0x3f')]:_0x4a0f64[_0xc90e('0x3a')];if(_0x3e8c0d[_0xc90e('0x3b')][_0xc90e('0x4a')]){_0x4aa069[_0xc90e('0x4b')]=[{'all':!![]}];}_0x4aa069=_['merge']({},_0x4aa069,_0x3e8c0d[_0xc90e('0x49')]);return db[_0xc90e('0x38')][_0xc90e('0x32')](_0x4aa069)['then'](handleEntityNotFound(_0x40b61e,null))['then'](function(_0x31bca6){if(_0x31bca6){var _0x52691a=_0x31bca6[_0xc90e('0x29')]({'plain':!![]});_0x52691a=qs['omit'](_0x52691a,['id',_0xc90e('0x58'),_0xc90e('0x59')]);_0x3e8c0d[_0xc90e('0x51')]=_[_0xc90e('0x5a')](_0x3e8c0d[_0xc90e('0x51')],['id',_0xc90e('0x58'),_0xc90e('0x59')]);return db[_0xc90e('0x38')][_0xc90e('0x50')](_[_0xc90e('0x48')](_0x52691a,_0x3e8c0d[_0xc90e('0x51')]),{'include':_0x3e8c0d[_0xc90e('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0xc90e('0x27')](function(_0x511e33){var _0x5c4441=_0x3e8c0d['user']['get']({'plain':!![]});if(!_0x5c4441)throw new Error(_0xc90e('0x53'));if(_0x5c4441[_0xc90e('0x5b')]==='user'){var _0x5c6240=_0x511e33[_0xc90e('0x29')]({'plain':!![]});var _0x1e4477=[{'name':_0xc90e('0x2a'),'value':_0xc90e('0x2b')},{'name':_0xc90e('0x2c'),'value':'outbound'}];var _0x371ba6=_[_0xc90e('0x32')](_0x1e4477,[_0xc90e('0x2f'),_0x5c6240[_0xc90e('0x31')]])[_0xc90e('0x33')];return db[_0xc90e('0x54')]['find']({'where':{'name':_0x371ba6,'userProfileId':_0x5c4441[_0xc90e('0x5c')]},'raw':!![]})['then'](function(_0x1b92e3){if(_0x1b92e3&&_0x1b92e3['autoAssociation']===0x0){return db['UserProfileResource'][_0xc90e('0x50')]({'name':_0x5c6240[_0xc90e('0x33')],'resourceId':_0x5c6240['id'],'type':_0x1b92e3['name'],'sectionId':_0x1b92e3['id']},{})[_0xc90e('0x27')](function(){return _0x511e33;});}else{return _0x511e33;}})['catch'](function(_0x555e41){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x555e41);throw _0x555e41;});}return _0x511e33;});}})[_0xc90e('0x27')](respondWithResult(_0x40b61e,0xc9))[_0xc90e('0x4f')](handleError(_0x40b61e,null));};exports['update']=function(_0x104288,_0x115f53){if(_0x104288[_0xc90e('0x51')]['id']){delete _0x104288[_0xc90e('0x51')]['id'];}return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x104288[_0xc90e('0x57')]['id']}})['then'](handleEntityNotFound(_0x115f53,null))[_0xc90e('0x27')](saveUpdates(_0x104288[_0xc90e('0x51')],null))['then'](respondWithResult(_0x115f53,null))['catch'](handleError(_0x115f53,null));};exports[_0xc90e('0x28')]=function(_0x4c37ab,_0x4ce773){return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x4c37ab[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x4ce773,null))[_0xc90e('0x27')](removeEntity(_0x4ce773,null))[_0xc90e('0x4f')](handleError(_0x4ce773,null));};exports[_0xc90e('0x5d')]=function(_0x4a081e,_0x1225a4,_0x3eafba){var _0x56f2be={'raw':![],'where':{}};var _0x29619f={};var _0xefb790={'count':0x0,'rows':[]};return db[_0xc90e('0x38')]['findOne']({'where':{'id':_0x4a081e['params']['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x1225a4,null))['then'](function(_0x2db8af){if(_0x2db8af){_0x29619f[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x5e')]['rawAttributes']);_0x29619f[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x4a081e[_0xc90e('0x3b')]);_0x29619f[_0xc90e('0x3d')]=_['intersection'](_0x29619f[_0xc90e('0x3a')],_0x29619f['query']);_0x56f2be[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x29619f[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x4a081e[_0xc90e('0x3b')]['fields']));_0x56f2be[_0xc90e('0x3f')]=_0x56f2be[_0xc90e('0x3f')]['length']?_0x56f2be[_0xc90e('0x3f')]:_0x29619f[_0xc90e('0x3a')];if(!_0x4a081e[_0xc90e('0x3b')][_0xc90e('0x5f')](_0xc90e('0x60'))){_0x56f2be[_0xc90e('0x42')]=qs['limit'](_0x4a081e['query'][_0xc90e('0x42')]);_0x56f2be[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x4a081e[_0xc90e('0x3b')]['offset']);}_0x56f2be[_0xc90e('0x43')]=qs['sort'](_0x4a081e['query'][_0xc90e('0x44')]);_0x56f2be[_0xc90e('0x45')]=qs[_0xc90e('0x3d')](_['pick'](_0x4a081e[_0xc90e('0x3b')],_0x29619f[_0xc90e('0x3d')]));_0x56f2be[_0xc90e('0x45')][_0xc90e('0x61')]=_0x2db8af['id'];if(_0x4a081e[_0xc90e('0x3b')]['filter']){_0x56f2be[_0xc90e('0x45')]=_[_0xc90e('0x48')](_0x56f2be[_0xc90e('0x45')],{'$or':_[_0xc90e('0x37')](_0x56f2be[_0xc90e('0x3f')],function(_0x51eee0){var _0x4316c3={};_0x4316c3[_0x51eee0]={'$like':'%'+_0x4a081e[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x4316c3;})});}_0x56f2be=_[_0xc90e('0x48')]({},_0x56f2be,_0x4a081e['options']);return db[_0xc90e('0x5e')][_0xc90e('0x20')]({'where':_0x56f2be[_0xc90e('0x45')]})[_0xc90e('0x27')](function(_0x57b031){_0xefb790[_0xc90e('0x20')]=_0x57b031;if(_0x4a081e[_0xc90e('0x3b')][_0xc90e('0x4a')]){_0x56f2be[_0xc90e('0x4b')]=[{'all':!![]}];}return db['CmHopper'][_0xc90e('0x4c')](_0x56f2be);})['then'](function(_0x466275){_0xefb790[_0xc90e('0x4d')]=_0x466275;return _0xefb790;});}})['then'](respondWithFilteredResult(_0x1225a4,_0x56f2be))[_0xc90e('0x4f')](handleError(_0x1225a4,null));};exports[_0xc90e('0x62')]=function(_0x159835,_0x474b17,_0x169cf2){var _0x51c8c5={'raw':!![],'where':{}};var _0x1054dc={};var _0x1ffcab={'count':0x0,'rows':[]};return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x159835[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x474b17,null))[_0xc90e('0x27')](function(_0x20adcb){if(_0x20adcb){_0x1054dc[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x64')]['rawAttributes']);_0x1054dc[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x159835['query']);_0x1054dc['filters']=_[_0xc90e('0x3e')](_0x1054dc[_0xc90e('0x3a')],_0x1054dc['query']);_0x51c8c5['attributes']=_['intersection'](_0x1054dc['model'],qs['fields'](_0x159835[_0xc90e('0x3b')]['fields']));_0x51c8c5[_0xc90e('0x3f')]=_0x51c8c5[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x51c8c5['attributes']:_0x1054dc['model'];if(!_0x159835[_0xc90e('0x3b')][_0xc90e('0x5f')](_0xc90e('0x60'))){_0x51c8c5[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x159835['query'][_0xc90e('0x42')]);_0x51c8c5[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x159835['query'][_0xc90e('0x1f')]);}_0x51c8c5[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x159835['query'][_0xc90e('0x44')]);_0x51c8c5['where']=qs['filters'](_[_0xc90e('0x46')](_0x159835[_0xc90e('0x3b')],_0x1054dc[_0xc90e('0x3d')]));_0x51c8c5[_0xc90e('0x45')][_0xc90e('0x61')]=_0x20adcb['id'];if(_0x159835[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x51c8c5[_0xc90e('0x45')]=_[_0xc90e('0x48')](_0x51c8c5[_0xc90e('0x45')],{'$or':_[_0xc90e('0x37')](_0x51c8c5['attributes'],function(_0x2c01f5){var _0x5c12e2={};_0x5c12e2[_0x2c01f5]={'$like':'%'+_0x159835[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x5c12e2;})});}_0x51c8c5=_[_0xc90e('0x48')]({},_0x51c8c5,_0x159835['options']);return db[_0xc90e('0x64')][_0xc90e('0x20')]({'where':_0x51c8c5[_0xc90e('0x45')]})[_0xc90e('0x27')](function(_0x24735b){_0x1ffcab[_0xc90e('0x20')]=_0x24735b;if(_0x159835[_0xc90e('0x3b')][_0xc90e('0x4a')]){_0x51c8c5[_0xc90e('0x4b')]=[{'all':!![]}];}return db[_0xc90e('0x64')][_0xc90e('0x4c')](_0x51c8c5);})['then'](function(_0x104005){_0x1ffcab[_0xc90e('0x4d')]=_0x104005;return _0x1ffcab;});}})[_0xc90e('0x27')](respondWithFilteredResult(_0x474b17,_0x51c8c5))[_0xc90e('0x4f')](handleError(_0x474b17,null));};exports[_0xc90e('0x65')]=function(_0x2bedad,_0x3922f5,_0x393231){var _0x3fcfa7={'raw':!![],'where':{}};var _0x1d10eb={};var _0x590b13={'count':0x0,'rows':[]};return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x2bedad['params']['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x3922f5,null))[_0xc90e('0x27')](function(_0x29a281){if(_0x29a281){_0x1d10eb[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x66')]['rawAttributes']);_0x1d10eb[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x2bedad[_0xc90e('0x3b')]);_0x1d10eb[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0x1d10eb[_0xc90e('0x3a')],_0x1d10eb['query']);_0x3fcfa7[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x1d10eb[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x3fcfa7[_0xc90e('0x3f')]=_0x3fcfa7['attributes']['length']?_0x3fcfa7['attributes']:_0x1d10eb[_0xc90e('0x3a')];if(!_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x5f')]('nolimit')){_0x3fcfa7['limit']=qs[_0xc90e('0x42')](_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x3fcfa7[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x2bedad['query'][_0xc90e('0x1f')]);}_0x3fcfa7[_0xc90e('0x43')]=qs['sort'](_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x44')]);_0x3fcfa7[_0xc90e('0x45')]=qs[_0xc90e('0x3d')](_['pick'](_0x2bedad[_0xc90e('0x3b')],_0x1d10eb['filters']));_0x3fcfa7[_0xc90e('0x45')][_0xc90e('0x61')]=_0x29a281['id'];if(_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x3fcfa7['where']=_['merge'](_0x3fcfa7[_0xc90e('0x45')],{'$or':_[_0xc90e('0x37')](_0x3fcfa7[_0xc90e('0x3f')],function(_0x221bc4){var _0x20b6df={};_0x20b6df[_0x221bc4]={'$like':'%'+_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x20b6df;})});}_0x3fcfa7=_[_0xc90e('0x48')]({},_0x3fcfa7,_0x2bedad[_0xc90e('0x49')]);return db[_0xc90e('0x66')]['count']({'where':_0x3fcfa7[_0xc90e('0x45')]})[_0xc90e('0x27')](function(_0x1a2ad1){_0x590b13['count']=_0x1a2ad1;if(_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x4a')]){_0x3fcfa7['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xc90e('0x4c')](_0x3fcfa7);})[_0xc90e('0x27')](function(_0x5626e1){_0x590b13[_0xc90e('0x4d')]=_0x5626e1;return _0x590b13;});}})['then'](respondWithFilteredResult(_0x3922f5,_0x3fcfa7))['catch'](handleError(_0x3922f5,null));};exports['getHopperBlacks']=function(_0x41febe,_0x40d552,_0x77d99a){var _0x350070={'raw':!![],'where':{}};var _0x337775={};var _0x5e004c={'count':0x0,'rows':[]};return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x41febe[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x40d552,null))['then'](function(_0x3ec332){if(_0x3ec332){_0x337775[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x67')]['rawAttributes']);_0x337775['query']=_[_0xc90e('0x3c')](_0x41febe[_0xc90e('0x3b')]);_0x337775[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0x337775[_0xc90e('0x3a')],_0x337775[_0xc90e('0x3b')]);_0x350070[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x337775[_0xc90e('0x3a')],qs['fields'](_0x41febe[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x350070[_0xc90e('0x3f')]=_0x350070[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x350070[_0xc90e('0x3f')]:_0x337775['model'];if(!_0x41febe[_0xc90e('0x3b')][_0xc90e('0x5f')](_0xc90e('0x60'))){_0x350070[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x41febe[_0xc90e('0x3b')]['limit']);_0x350070[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x41febe[_0xc90e('0x3b')]['offset']);}_0x350070[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x41febe[_0xc90e('0x3b')]['sort']);_0x350070[_0xc90e('0x45')]=qs['filters'](_[_0xc90e('0x46')](_0x41febe[_0xc90e('0x3b')],_0x337775[_0xc90e('0x3d')]));_0x350070[_0xc90e('0x45')]['VoiceQueueId']=_0x3ec332['id'];if(_0x41febe[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x350070[_0xc90e('0x45')]=_['merge'](_0x350070[_0xc90e('0x45')],{'$or':_['map'](_0x350070[_0xc90e('0x3f')],function(_0x4d7b5d){var _0x5b6ae5={};_0x5b6ae5[_0x4d7b5d]={'$like':'%'+_0x41febe[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x5b6ae5;})});}_0x350070=_[_0xc90e('0x48')]({},_0x350070,_0x41febe[_0xc90e('0x49')]);return db['CmHopperBlack']['count']({'where':_0x350070[_0xc90e('0x45')]})[_0xc90e('0x27')](function(_0xbf1725){_0x5e004c[_0xc90e('0x20')]=_0xbf1725;if(_0x41febe[_0xc90e('0x3b')][_0xc90e('0x4a')]){_0x350070[_0xc90e('0x4b')]=[{'all':!![]}];}return db[_0xc90e('0x67')]['findAll'](_0x350070);})['then'](function(_0x312306){_0x5e004c['rows']=_0x312306;return _0x5e004c;});}})[_0xc90e('0x27')](respondWithFilteredResult(_0x40d552,_0x350070))[_0xc90e('0x4f')](handleError(_0x40d552,null));};exports['getTeams']=function(_0x226701,_0x4bb7d2,_0x35fdea){var _0x476261={};var _0x4512fa={};var _0x5dfe4f;var _0x304616;return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x226701[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x4bb7d2,null))['then'](function(_0x5c81fc){if(_0x5c81fc){_0x5dfe4f=_0x5c81fc;_0x4512fa['model']=_[_0xc90e('0x3c')](db[_0xc90e('0x68')][_0xc90e('0x39')]);_0x4512fa[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x226701['query']);_0x4512fa[_0xc90e('0x3d')]=_['intersection'](_0x4512fa[_0xc90e('0x3a')],_0x4512fa[_0xc90e('0x3b')]);_0x476261[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x4512fa[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x226701[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x476261['attributes']=_0x476261[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x476261[_0xc90e('0x3f')]:_0x4512fa[_0xc90e('0x3a')];_0x476261[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x226701['query'][_0xc90e('0x44')]);_0x476261[_0xc90e('0x45')]=qs[_0xc90e('0x3d')](_[_0xc90e('0x46')](_0x226701[_0xc90e('0x3b')],_0x4512fa[_0xc90e('0x3d')]));if(_0x226701[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x476261['where']=_[_0xc90e('0x48')](_0x476261[_0xc90e('0x45')],{'$or':_['map'](_0x476261[_0xc90e('0x3f')],function(_0x569664){var _0x1a83af={};_0x1a83af[_0x569664]={'$like':'%'+_0x226701['query'][_0xc90e('0x47')]+'%'};return _0x1a83af;})});}_0x476261=_['merge']({},_0x476261,_0x226701[_0xc90e('0x49')]);return _0x5dfe4f[_0xc90e('0x69')](_0x476261);}})[_0xc90e('0x27')](function(_0x4966db){if(_0x4966db){_0x304616=_0x4966db['length'];if(!_0x226701[_0xc90e('0x3b')]['hasOwnProperty'](_0xc90e('0x60'))){_0x476261[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x226701[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x476261[_0xc90e('0x1f')]=qs['offset'](_0x226701['query'][_0xc90e('0x1f')]);}return _0x5dfe4f['getTeams'](_0x476261);}})[_0xc90e('0x27')](function(_0x3dd719){if(_0x3dd719){return _0x3dd719?{'count':_0x304616,'rows':_0x3dd719}:null;}})['then'](respondWithResult(_0x4bb7d2,null))[_0xc90e('0x4f')](handleError(_0x4bb7d2,null));};exports[_0xc90e('0x6a')]=function(_0x1c42ae,_0x4f4904,_0x59a7f1){var _0x1069d1=_0x1c42ae[_0xc90e('0x51')]['teams'];var _0x1a4883=_['map'](_0x1069d1,'id');return db[_0xc90e('0x68')][_0xc90e('0x4c')]({'where':{'id':_0x1a4883},'attributes':['id'],'include':[{'model':db[_0xc90e('0x6b')],'as':'Agents','attributes':['id',_0xc90e('0x33'),'online',_0xc90e('0x6c'),_0xc90e('0x6d')],'raw':!![]}]})['then'](function(_0x140331){if(_0x140331){var _0x4055e5=_[_0xc90e('0x6e')](_0x140331,function(_0xd85f0f){var _0x350c4a=_0xd85f0f['get']({'plain':!![]});_0x350c4a[_0xc90e('0x6f')][_0xc90e('0x70')](function(_0x2646c6){_0x2646c6[_0xc90e('0x71')]=_['find'](_0x1069d1,{'id':_0x350c4a['id']})['penalty'];});return _0x350c4a[_0xc90e('0x6f')];});return db['VoiceQueue'][_0xc90e('0x32')]({'where':{'id':_0x1c42ae[_0xc90e('0x57')]['id']}})['then'](function(_0x1204bd){return db[_0xc90e('0x72')][_0xc90e('0x73')](function(_0x8439c6){return _0x1204bd[_0xc90e('0x6a')](_0x1a4883,{'transaction':_0x8439c6})['then'](function(){return BPromise[_0xc90e('0x74')](_0x1069d1,function(_0x20f863){return db['TeamVoiceQueue'][_0xc90e('0x75')]({'TeamId':_0x20f863['id'],'VoiceQueueId':_0x1c42ae[_0xc90e('0x57')]['id'],'penalty':_0x20f863[_0xc90e('0x71')]},{'transaction':_0x8439c6});});})['then'](function(){return BPromise[_0xc90e('0x74')](_0x4055e5,function(_0x3195aa){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x3195aa['id'],'VoiceQueueId':_0x1c42ae['params']['id']},'defaults':{'penalty':_0x3195aa[_0xc90e('0x71')]},'transaction':_0x8439c6});});})[_0xc90e('0x27')](function(){return BPromise[_0xc90e('0x74')](_['filter'](_0x4055e5,{'online':!![]}),function(_0x3a4f74){return db[_0xc90e('0x76')][_0xc90e('0x75')]({'membername':_0x3a4f74[_0xc90e('0x33')],'UserId':_0x3a4f74['id'],'queue_name':_0x1204bd[_0xc90e('0x33')],'VoiceQueueId':_0x1204bd['id'],'interface':_['isNil'](_0x3a4f74[_0xc90e('0x6d')])?util[_0xc90e('0x77')]('SIP/%s',_0x3a4f74['name']):_0x3a4f74['interface'],'paused':_0x3a4f74[_0xc90e('0x6c')]||![],'penalty':_0x3a4f74[_0xc90e('0x71')]},{'transaction':_0x8439c6});});})[_0xc90e('0x27')](function(){_0x4055e5['forEach'](function(_0x1d50c1){socket['emit']('userVoiceQueue:save',{'UserId':_0x1d50c1['id'],'VoiceQueueId':_0x1204bd['id']});});});});});}})[_0xc90e('0x27')](respondWithStatusCode(_0x4f4904,null))['catch'](handleError(_0x4f4904,null));};exports[_0xc90e('0x78')]=function(_0x3083f5,_0x55ffd8,_0x2c2d6a){return db[_0xc90e('0x68')][_0xc90e('0x4c')]({'where':{'id':_0x3083f5[_0xc90e('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc90e('0x6b')],'as':_0xc90e('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xc90e('0x27')](handleEntityNotFound(_0x55ffd8,null))[_0xc90e('0x27')](function(_0x450fd2){var _0x39af19=_['map'](_0x450fd2,'id');var _0x40a1e2=[];var _0x1c6c3c=[];var _0x405359=squel['select']();_0x405359[_0xc90e('0x79')](_0xc90e('0x7a'))[_0xc90e('0x7b')]('team_has_voice_queues','tq')[_0xc90e('0x7c')](_0xc90e('0x7d'),'ut',_0xc90e('0x7e'))['where']('VoiceQueueId\x20=\x20?',_0x3083f5[_0xc90e('0x57')]['id']);for(var _0x4c3fc2=0x0;_0x4c3fc2<_0x450fd2[_0xc90e('0x41')];_0x4c3fc2+=0x1){let _0x4b8b0e=_0x450fd2[_0x4c3fc2];for(var _0x2cc4c9=0x0;_0x2cc4c9<_0x4b8b0e[_0xc90e('0x6f')][_0xc90e('0x41')];_0x2cc4c9+=0x1){let _0x29a154=_0x4b8b0e[_0xc90e('0x6f')][_0x2cc4c9];var _0x96b3f7=_0x405359[_0xc90e('0x7f')]();_0x96b3f7[_0xc90e('0x45')](_0xc90e('0x80'),_0x29a154['id']);_0x1c6c3c[_0xc90e('0x81')](db[_0xc90e('0x72')]['query'](_0x96b3f7[_0xc90e('0x82')](),{'type':db[_0xc90e('0x72')][_0xc90e('0x83')][_0xc90e('0x84')]})['then'](function(_0x3f17bb){if(_0x3f17bb['length']===0x1){return _0x29a154['id'];}else{var _0x492df6=_[_0xc90e('0x85')](_['map'](_0x3f17bb,_0xc90e('0x86')),function(_0x398528){return _[_0xc90e('0x30')](_0x39af19,_0x398528);});if(_0x492df6){return _0x29a154['id'];}}}));}}return BPromise[_0xc90e('0x87')](_0x1c6c3c)['then'](function(_0x163e0c){_0x40a1e2=_(_0x40a1e2)[_0xc90e('0x88')](_0x163e0c)['compact']()[_0xc90e('0x2f')]();return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x3083f5[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](function(_0x2e3f34){return db[_0xc90e('0x72')][_0xc90e('0x73')](function(_0x41a212){return _0x2e3f34[_0xc90e('0x78')](_0x3083f5['query'][_0xc90e('0x89')],{'transaction':_0x41a212})[_0xc90e('0x27')](function(){if(!_[_0xc90e('0x8a')](_0x40a1e2)){return _0x2e3f34[_0xc90e('0x8b')](_0x40a1e2,{'transaction':_0x41a212})['then'](function(){return db[_0xc90e('0x76')][_0xc90e('0x28')]({'where':{'VoiceQueueId':_0x3083f5['params']['id'],'UserId':_0x40a1e2},'transaction':_0x41a212});});}})['then'](function(){_0x40a1e2['forEach'](function(_0x218969){socket['emit'](_0xc90e('0x8c'),{'UserId':_0x218969,'VoiceQueueId':_0x2e3f34['id']});});});});});});})[_0xc90e('0x27')](respondWithStatusCode(_0x55ffd8,null))['catch'](handleError(_0x55ffd8,null));};exports[_0xc90e('0x8d')]=function(_0x4f7c46,_0x54d74b,_0x3a6572){var _0x121da6,_0xa5764c;return db['VoiceQueue'][_0xc90e('0x32')]({'where':{'id':_0x4f7c46['params']['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x54d74b,null))[_0xc90e('0x27')](function(_0x4a23c8){if(_0x4a23c8){_0xa5764c=_0x4a23c8;return _0x4a23c8['addAgents'](_0x4f7c46[_0xc90e('0x51')][_0xc90e('0x89')],_[_0xc90e('0x5a')](_0x4f7c46['body'],[_0xc90e('0x89'),'id'])||{})[_0xc90e('0x8e')](function(_0x4ab394){for(var _0x3231b6=0x0;_0x3231b6<_0x4f7c46['body']['ids'][_0xc90e('0x41')];_0x3231b6+=0x1){socket[_0xc90e('0x8f')](_0xc90e('0x90'),{'UserId':Number(_0x4f7c46[_0xc90e('0x51')]['ids'][_0x3231b6]),'VoiceQueueId':Number(_0x4f7c46[_0xc90e('0x57')]['id'])});}return _0x4ab394;});}})[_0xc90e('0x27')](function(_0x28fc0c){_0x121da6=_0x28fc0c||[];if(_0xa5764c){return db[_0xc90e('0x6b')]['findAll']({'where':{'id':_0x4f7c46[_0xc90e('0x51')][_0xc90e('0x89')]},'attributes':['id',_0xc90e('0x33'),_0xc90e('0x91'),_0xc90e('0x6c'),_0xc90e('0x6d')],'raw':!![]});}})[_0xc90e('0x27')](function(_0x931c7e){if(!_[_0xc90e('0x8a')](_0x931c7e)){var _0x4292db=[];for(var _0x2614da=0x0;_0x2614da<_0x931c7e[_0xc90e('0x41')];_0x2614da++){if(_0x931c7e[_0x2614da][_0xc90e('0x91')]){_0x4292db[_0xc90e('0x81')](db[_0xc90e('0x76')][_0xc90e('0x75')]({'membername':_0x931c7e[_0x2614da][_0xc90e('0x33')],'UserId':_0x931c7e[_0x2614da]['id'],'queue_name':_0xa5764c[_0xc90e('0x33')],'VoiceQueueId':_0xa5764c['id'],'interface':_[_0xc90e('0x92')](_0x931c7e[_0x2614da][_0xc90e('0x6d')])?util['format']('SIP/%s',_0x931c7e[_0x2614da]['name']):_0x931c7e[_0x2614da][_0xc90e('0x6d')],'paused':_0x931c7e[_0x2614da]['voicePause']||![],'penalty':_0x4f7c46[_0xc90e('0x51')][_0xc90e('0x71')]||0x0}));}}return BPromise['all'](_0x4292db);}})['then'](function(){return _0x121da6;})[_0xc90e('0x27')](respondWithResult(_0x54d74b,null))[_0xc90e('0x4f')](handleError(_0x54d74b,null));};exports[_0xc90e('0x8b')]=function(_0x15de20,_0xa646cf,_0x290e46){return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x15de20['params']['id']}})['then'](handleEntityNotFound(_0xa646cf,null))[_0xc90e('0x27')](function(_0x53229b){if(_0x53229b){return _0x53229b[_0xc90e('0x8b')](_0x15de20[_0xc90e('0x3b')]['ids'])[_0xc90e('0x27')](function(){if(_[_0xc90e('0x93')](_0x15de20[_0xc90e('0x3b')]['ids'])){for(var _0x5386be=0x0;_0x5386be<_0x15de20['query']['ids'][_0xc90e('0x41')];_0x5386be+=0x1){socket[_0xc90e('0x8f')](_0xc90e('0x8c'),{'UserId':Number(_0x15de20['query'][_0xc90e('0x89')][_0x5386be]),'VoiceQueueId':Number(_0x15de20['params']['id'])});}}else{socket[_0xc90e('0x8f')](_0xc90e('0x8c'),{'UserId':Number(_0x15de20[_0xc90e('0x3b')][_0xc90e('0x89')]),'VoiceQueueId':Number(_0x15de20[_0xc90e('0x57')]['id'])});}});}})[_0xc90e('0x27')](function(_0x1c218e){return db[_0xc90e('0x76')]['destroy']({'where':{'VoiceQueueId':_0x15de20[_0xc90e('0x57')]['id'],'UserId':_0x15de20[_0xc90e('0x3b')][_0xc90e('0x89')]}})[_0xc90e('0x27')](function(){return _0x1c218e;});})['then'](respondWithStatusCode(_0xa646cf,null))[_0xc90e('0x4f')](handleError(_0xa646cf,null));};exports[_0xc90e('0x94')]=function(_0x3712e9,_0xc6f721,_0x59860a){var _0x2748b1={};var _0x48ada1={};var _0x11b2f0;var _0x24e3f0;return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x3712e9[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0xc6f721,null))[_0xc90e('0x27')](function(_0x3d4e2e){if(_0x3d4e2e){_0x11b2f0=_0x3d4e2e;_0x48ada1['model']=_['keys'](db[_0xc90e('0x6b')][_0xc90e('0x39')]);_0x48ada1[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x3712e9[_0xc90e('0x3b')]);_0x48ada1['filters']=_['intersection'](_0x48ada1[_0xc90e('0x3a')],_0x48ada1[_0xc90e('0x3b')]);_0x2748b1[_0xc90e('0x3f')]=_['intersection'](_0x48ada1[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x3712e9[_0xc90e('0x3b')]['fields']));_0x2748b1[_0xc90e('0x3f')]=_0x2748b1[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x2748b1[_0xc90e('0x3f')]:_0x48ada1[_0xc90e('0x3a')];_0x2748b1[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x3712e9[_0xc90e('0x3b')][_0xc90e('0x44')]);_0x2748b1['where']=qs[_0xc90e('0x3d')](_[_0xc90e('0x46')](_0x3712e9['query'],_0x48ada1[_0xc90e('0x3d')]));if(_0x3712e9[_0xc90e('0x3b')]['filter']){_0x2748b1['where']=_[_0xc90e('0x48')](_0x2748b1[_0xc90e('0x45')],{'$or':_['map'](_0x2748b1[_0xc90e('0x3f')],function(_0x2a08f4){var _0x44cabb={};_0x44cabb[_0x2a08f4]={'$like':'%'+_0x3712e9[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x44cabb;})});}_0x2748b1=_[_0xc90e('0x48')]({},_0x2748b1,_0x3712e9[_0xc90e('0x49')]);return _0x11b2f0['getAgents'](_0x2748b1);}})[_0xc90e('0x27')](function(_0x696bb6){if(_0x696bb6){_0x24e3f0=_0x696bb6[_0xc90e('0x41')];if(!_0x3712e9[_0xc90e('0x3b')]['hasOwnProperty'](_0xc90e('0x60'))){_0x2748b1[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x3712e9[_0xc90e('0x3b')]['limit']);_0x2748b1[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x3712e9[_0xc90e('0x3b')][_0xc90e('0x1f')]);}return _0x11b2f0['getAgents'](_0x2748b1);}})['then'](function(_0x128ea8){if(_0x128ea8){return _0x128ea8?{'count':_0x24e3f0,'rows':_0x128ea8}:null;}})['then'](respondWithResult(_0xc6f721,null))[_0xc90e('0x4f')](handleError(_0xc6f721,null));};exports[_0xc90e('0x95')]=function(_0x4910ea,_0x1b1733,_0x1cae9f){var _0x6ede9c={};var _0x4e6b69={};var _0x3a6352;var _0x2d76d0;return db[_0xc90e('0x38')]['findOne']({'where':{'id':_0x4910ea[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x1b1733,null))[_0xc90e('0x27')](function(_0x222fbd){if(_0x222fbd){_0x3a6352=_0x222fbd;_0x4e6b69[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db['UserVoiceQueueRt'][_0xc90e('0x39')]);_0x4e6b69[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x4910ea[_0xc90e('0x3b')]);_0x4e6b69[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0x4e6b69['model'],_0x4e6b69[_0xc90e('0x3b')]);_0x6ede9c[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x4e6b69[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x4910ea[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x6ede9c[_0xc90e('0x3f')]=_0x6ede9c[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x6ede9c[_0xc90e('0x3f')]:_0x4e6b69[_0xc90e('0x3a')];_0x6ede9c[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x4910ea[_0xc90e('0x3b')][_0xc90e('0x44')]);_0x6ede9c[_0xc90e('0x45')]=qs['filters'](_[_0xc90e('0x46')](_0x4910ea[_0xc90e('0x3b')],_0x4e6b69[_0xc90e('0x3d')]));if(_0x4910ea[_0xc90e('0x3b')]['filter']){_0x6ede9c[_0xc90e('0x45')]=_['merge'](_0x6ede9c[_0xc90e('0x45')],{'$or':_['map'](_0x6ede9c['attributes'],function(_0x472f4d){var _0x1d56cf={};_0x1d56cf[_0x472f4d]={'$like':'%'+_0x4910ea[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x1d56cf;})});}_0x6ede9c=_[_0xc90e('0x48')]({},_0x6ede9c,_0x4910ea[_0xc90e('0x49')]);return _0x3a6352['getMembers'](_0x6ede9c);}})[_0xc90e('0x27')](function(_0x2c13ad){if(_0x2c13ad){_0x2d76d0=_0x2c13ad['length'];if(!_0x4910ea['query'][_0xc90e('0x5f')](_0xc90e('0x60'))){_0x6ede9c[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x4910ea[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x6ede9c['offset']=qs[_0xc90e('0x1f')](_0x4910ea['query']['offset']);}return _0x3a6352[_0xc90e('0x95')](_0x6ede9c);}})[_0xc90e('0x27')](function(_0x25bd9f){return _0x25bd9f?{'count':_0x2d76d0,'rows':_0x25bd9f}:null;})[_0xc90e('0x27')](respondWithResult(_0x1b1733,null))[_0xc90e('0x4f')](handleError(_0x1b1733,null));};exports['getLists']=function(_0x1c7a36,_0x46b5e2,_0x58b8a8){var _0x435360={};var _0xaa739c={};var _0x10a5fe;var _0x8da189;return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x1c7a36[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x46b5e2,null))[_0xc90e('0x27')](function(_0x1abdcf){if(_0x1abdcf){_0x10a5fe=_0x1abdcf;_0xaa739c[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db['CmList'][_0xc90e('0x39')]);_0xaa739c['query']=_[_0xc90e('0x3c')](_0x1c7a36[_0xc90e('0x3b')]);_0xaa739c[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0xaa739c[_0xc90e('0x3a')],_0xaa739c[_0xc90e('0x3b')]);_0x435360[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0xaa739c[_0xc90e('0x3a')],qs['fields'](_0x1c7a36[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x435360[_0xc90e('0x3f')]=_0x435360[_0xc90e('0x3f')]['length']?_0x435360[_0xc90e('0x3f')]:_0xaa739c[_0xc90e('0x3a')];_0x435360[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x1c7a36['query'][_0xc90e('0x44')]);_0x435360['where']=qs[_0xc90e('0x3d')](_[_0xc90e('0x46')](_0x1c7a36[_0xc90e('0x3b')],_0xaa739c[_0xc90e('0x3d')]));if(_0x1c7a36[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x435360['where']=_['merge'](_0x435360[_0xc90e('0x45')],{'$or':_[_0xc90e('0x37')](_0x435360[_0xc90e('0x3f')],function(_0xb13ab2){var _0x256cc0={};_0x256cc0[_0xb13ab2]={'$like':'%'+_0x1c7a36[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x256cc0;})});}_0x435360=_['merge']({},_0x435360,_0x1c7a36['options']);return _0x10a5fe['getLists'](_0x435360);}})[_0xc90e('0x27')](function(_0x326ed8){if(_0x326ed8){_0x8da189=_0x326ed8[_0xc90e('0x41')];if(!_0x1c7a36[_0xc90e('0x3b')][_0xc90e('0x5f')](_0xc90e('0x60'))){_0x435360[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x1c7a36[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x435360[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x1c7a36[_0xc90e('0x3b')]['offset']);}return _0x10a5fe[_0xc90e('0x96')](_0x435360);}})[_0xc90e('0x27')](function(_0x4bedb7){if(_0x4bedb7){return _0x4bedb7?{'count':_0x8da189,'rows':_0x4bedb7}:null;}})[_0xc90e('0x27')](respondWithResult(_0x46b5e2,null))[_0xc90e('0x4f')](handleError(_0x46b5e2,null));};exports[_0xc90e('0x97')]=function(_0x2d6eaa,_0x42ad22,_0x1045d1){var _0x165886=moment()[_0xc90e('0x77')](_0xc90e('0x98'));var _0x1a413c,_0x4565e7;return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x2d6eaa[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x42ad22,null))[_0xc90e('0x27')](function(_0x34fcdf){if(_0x34fcdf){_0x4565e7=_0x34fcdf;return _0x34fcdf[_0xc90e('0x97')](_0x2d6eaa['body']['ids'],_['omit'](_0x2d6eaa['body'],[_0xc90e('0x89'),'id'])||{});}return null;})[_0xc90e('0x8e')](function(_0x5d50e1){var _0x4ca33c;_0x1a413c=_0x5d50e1||[];var _0xe2c837=[];if(_0x5d50e1){for(var _0x218efa=0x0;_0x218efa<_0x5d50e1['length'];_0x218efa+=0x1){var _0x2e5249=_0x5d50e1[_0x218efa]['get']({'plain':!![]});_0x4565e7[_0xc90e('0x99')]=_0x2d6eaa[_0xc90e('0x51')][_0xc90e('0x99')]?_0x2d6eaa[_0xc90e('0x51')][_0xc90e('0x99')]:_0x4565e7[_0xc90e('0x99')];switch(_0x4565e7[_0xc90e('0x99')]){case _0xc90e('0x9a'):_0x4ca33c=squel[_0xc90e('0x9b')]()[_0xc90e('0x9c')](_0xc90e('0x9d'))[_0xc90e('0x9e')](['phone','scheduledAt','ContactId',_0xc90e('0x9f'),_0xc90e('0x61'),_0xc90e('0x58'),_0xc90e('0x59')],squel[_0xc90e('0xa0')]()[_0xc90e('0x79')](_0xc90e('0xa1'),_0xc90e('0xa1'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27','scheduledAt')[_0xc90e('0x79')]('id',_0xc90e('0xa2'))['field'](_0x2e5249[_0xc90e('0xa3')]['toString'](),_0xc90e('0x9f'))[_0xc90e('0x79')](_0x2d6eaa[_0xc90e('0x57')]['id'][_0xc90e('0x82')](),_0xc90e('0x61'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0x58'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0x59'))[_0xc90e('0x7b')]('cm_contacts')[_0xc90e('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0xc90e('0xa4'),_0x2e5249[_0xc90e('0xa3')]['toString']())[_0xc90e('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xc90e('0x45')](_0xc90e('0xa5'),squel[_0xc90e('0xa0')]()[_0xc90e('0x79')](_0xc90e('0xa6'))[_0xc90e('0x7b')](_0xc90e('0xa7'))[_0xc90e('0x45')](_0xc90e('0xa8'),_0x2d6eaa[_0xc90e('0x57')]['id'][_0xc90e('0x82')]()))[_0xc90e('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc90e('0xa0')]()[_0xc90e('0x79')](_0xc90e('0xa9'))[_0xc90e('0x7b')]('cm_hopper')[_0xc90e('0x45')](_0xc90e('0xa8'),_0x2d6eaa[_0xc90e('0x57')]['id'][_0xc90e('0x82')]())))[_0xc90e('0x82')]();break;case'onlyIfOpen':_0x4ca33c=squel[_0xc90e('0x9b')]()[_0xc90e('0x9c')]('cm_hopper')[_0xc90e('0x9e')]([_0xc90e('0xa1'),'scheduledAt',_0xc90e('0xa2'),_0xc90e('0x9f'),'VoiceQueueId',_0xc90e('0x58'),_0xc90e('0x59')],squel[_0xc90e('0xa0')]()[_0xc90e('0x79')]('phone',_0xc90e('0xa1'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0xaa'))['field']('id',_0xc90e('0xa2'))[_0xc90e('0x79')](_0x2e5249[_0xc90e('0xa3')][_0xc90e('0x82')](),_0xc90e('0x9f'))[_0xc90e('0x79')](_0x2d6eaa['params']['id'][_0xc90e('0x82')](),_0xc90e('0x61'))['field']('\x27'+_0x165886+'\x27',_0xc90e('0x58'))['field']('\x27'+_0x165886+'\x27','updatedAt')[_0xc90e('0x7b')](_0xc90e('0xab'))[_0xc90e('0x45')](_0xc90e('0xac'))[_0xc90e('0x45')](_0xc90e('0xa4'),_0x2e5249[_0xc90e('0xa3')]['toString']())[_0xc90e('0x45')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc90e('0xa5'),squel['select']()[_0xc90e('0x79')](_0xc90e('0xa9'))[_0xc90e('0x7b')](_0xc90e('0x9d'))[_0xc90e('0x45')](_0xc90e('0xa8'),_0x2d6eaa['params']['id'][_0xc90e('0x82')]())))[_0xc90e('0x82')]();break;default:_0x4ca33c=squel['insert']()['into'](_0xc90e('0x9d'))[_0xc90e('0x9e')](['phone',_0xc90e('0xaa'),_0xc90e('0xa2'),_0xc90e('0x9f'),_0xc90e('0x61'),_0xc90e('0x58'),_0xc90e('0x59')],squel[_0xc90e('0xa0')]()[_0xc90e('0x79')](_0xc90e('0xa1'),_0xc90e('0xa1'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27','scheduledAt')['field']('id',_0xc90e('0xa2'))['field'](_0x2e5249[_0xc90e('0xa3')]['toString'](),_0xc90e('0x9f'))[_0xc90e('0x79')](_0x2d6eaa['params']['id']['toString'](),_0xc90e('0x61'))['field']('\x27'+_0x165886+'\x27',_0xc90e('0x58'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0x59'))[_0xc90e('0x7b')](_0xc90e('0xab'))[_0xc90e('0x45')](_0xc90e('0xac'))[_0xc90e('0x45')](_0xc90e('0xa4'),_0x2e5249['CmListId'][_0xc90e('0x82')]())[_0xc90e('0x45')](_0xc90e('0xad')))[_0xc90e('0x82')]();}_0xe2c837[_0xc90e('0x81')](db[_0xc90e('0x72')][_0xc90e('0x3b')](_0x4ca33c));}return BPromise['all'](_0xe2c837);}})[_0xc90e('0x27')](function(){var _0x41d7ae=[];var _0x552205=squel['insert']()[_0xc90e('0x9c')]('cm_hopper_additional_phones')[_0xc90e('0x9e')]([_0xc90e('0xae'),_0xc90e('0xa1'),_0xc90e('0xaf'),_0xc90e('0x58'),_0xc90e('0x59')],squel[_0xc90e('0xa0')]()[_0xc90e('0x79')](_0xc90e('0xb0'))['field']('ci.item')[_0xc90e('0x79')]('ci.OrderBy+1')[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0x58'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0x59'))[_0xc90e('0x7b')](_0xc90e('0xb1'),'ci')[_0xc90e('0x7c')]('cm_hopper','h',_0xc90e('0xb2'))[_0xc90e('0x45')](_0xc90e('0xb3'),_0x165886)[_0xc90e('0x45')](_0xc90e('0xb4'),_0xc90e('0xb5')))[_0xc90e('0x82')]();_0x41d7ae['push'](db[_0xc90e('0x72')]['query'](_0x552205));return BPromise[_0xc90e('0x87')](_0x41d7ae);})[_0xc90e('0x27')](function(){return _0x1a413c;})[_0xc90e('0x27')](respondWithResult(_0x42ad22,null))['catch'](handleError(_0x42ad22,null));};exports[_0xc90e('0xb6')]=function(_0x1fac05,_0x1f3519,_0x274794){return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x1fac05['params']['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x1f3519,null))[_0xc90e('0x27')](function(_0x21d868){if(_0x21d868){return _0x21d868[_0xc90e('0xb6')](_0x1fac05['query'][_0xc90e('0x89')]);}})[_0xc90e('0x27')](function(_0x590269){if(_0x590269){return db['CmHopper'][_0xc90e('0x28')]({'where':{'ListId':_0x1fac05[_0xc90e('0x3b')][_0xc90e('0x89')],'VoiceQueueId':_0x1fac05[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](function(){return _0x590269;});}})[_0xc90e('0x27')](respondWithStatusCode(_0x1f3519,null))['catch'](handleError(_0x1f3519,null));};exports[_0xc90e('0xb7')]=function(_0x5fc2a9,_0x29602e,_0x3eb0e2){var _0x6b049a={};var _0x366cca={};var _0x4d569a;var _0x1f4224;return db['VoiceQueue'][_0xc90e('0x63')]({'where':{'id':_0x5fc2a9['params']['id']}})['then'](handleEntityNotFound(_0x29602e,null))['then'](function(_0x4a86b8){if(_0x4a86b8){_0x4d569a=_0x4a86b8;_0x366cca[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db['CmList']['rawAttributes']);_0x366cca['query']=_['keys'](_0x5fc2a9['query']);_0x366cca[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0x366cca[_0xc90e('0x3a')],_0x366cca[_0xc90e('0x3b')]);_0x6b049a[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x366cca[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x5fc2a9[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x6b049a['attributes']=_0x6b049a[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x6b049a[_0xc90e('0x3f')]:_0x366cca['model'];_0x6b049a['order']=qs[_0xc90e('0x44')](_0x5fc2a9[_0xc90e('0x3b')][_0xc90e('0x44')]);_0x6b049a[_0xc90e('0x45')]=qs[_0xc90e('0x3d')](_[_0xc90e('0x46')](_0x5fc2a9[_0xc90e('0x3b')],_0x366cca[_0xc90e('0x3d')]));if(_0x5fc2a9['query'][_0xc90e('0x47')]){_0x6b049a[_0xc90e('0x45')]=_[_0xc90e('0x48')](_0x6b049a[_0xc90e('0x45')],{'$or':_['map'](_0x6b049a[_0xc90e('0x3f')],function(_0x5bfcdd){var _0x3c3c1e={};_0x3c3c1e[_0x5bfcdd]={'$like':'%'+_0x5fc2a9['query']['filter']+'%'};return _0x3c3c1e;})});}_0x6b049a=_[_0xc90e('0x48')]({},_0x6b049a,_0x5fc2a9[_0xc90e('0x49')]);return _0x4d569a[_0xc90e('0xb7')](_0x6b049a);}})['then'](function(_0x3c935b){if(_0x3c935b){_0x1f4224=_0x3c935b[_0xc90e('0x41')];if(!_0x5fc2a9[_0xc90e('0x3b')]['hasOwnProperty'](_0xc90e('0x60'))){_0x6b049a[_0xc90e('0x42')]=qs['limit'](_0x5fc2a9[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x6b049a['offset']=qs[_0xc90e('0x1f')](_0x5fc2a9[_0xc90e('0x3b')][_0xc90e('0x1f')]);}return _0x4d569a['getBlackLists'](_0x6b049a);}})['then'](function(_0x7ddb9){if(_0x7ddb9){return _0x7ddb9?{'count':_0x1f4224,'rows':_0x7ddb9}:null;}})[_0xc90e('0x27')](respondWithResult(_0x29602e,null))['catch'](handleError(_0x29602e,null));};exports['addBlackLists']=function(_0xd11328,_0x1ab33a,_0x17ebd9){var _0x58c112,_0x39a7dc;return db['VoiceQueue'][_0xc90e('0x32')]({'where':{'id':_0xd11328['params']['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x1ab33a,null))[_0xc90e('0x27')](function(_0x58ab9b){if(_0x58ab9b){_0x39a7dc=_0x58ab9b;return _0x58ab9b['addBlackLists'](_0xd11328[_0xc90e('0x51')][_0xc90e('0x89')],_[_0xc90e('0x5a')](_0xd11328['body'],['ids','id'])||{});}return null;})[_0xc90e('0x8e')](function(_0x2f05c6){var _0x2162ed;_0x58c112=_0x2f05c6||[];var _0x2689a7=[];if(_0x2f05c6){for(var _0x441a6c=0x0;_0x441a6c<_0x2f05c6[_0xc90e('0x41')];_0x441a6c+=0x1){var _0x5b3649=_0x2f05c6[_0x441a6c][_0xc90e('0x29')]({'plain':!![]});_0x2162ed=squel['insert']()[_0xc90e('0x9c')](_0xc90e('0xb8'))[_0xc90e('0x9e')]([_0xc90e('0xa1'),_0xc90e('0xa2'),_0xc90e('0x9f'),_0xc90e('0x61'),_0xc90e('0x58'),_0xc90e('0x59')],squel['select']()[_0xc90e('0x79')](_0xc90e('0xa1'),'phone')[_0xc90e('0x79')]('id',_0xc90e('0xa2'))['field'](_0x5b3649['CmListId'][_0xc90e('0x82')](),_0xc90e('0x9f'))[_0xc90e('0x79')](_0xd11328['params']['id']['toString'](),'VoiceQueueId')['field'](_0xc90e('0xb9'),'createdAt')[_0xc90e('0x79')](_0xc90e('0xb9'),_0xc90e('0x59'))[_0xc90e('0x7b')](_0xc90e('0xab'))[_0xc90e('0x45')]('deletedAt\x20IS\x20NULL')[_0xc90e('0x45')](_0xc90e('0xa4'),_0x5b3649[_0xc90e('0xa3')]['toString']())['where'](_0xc90e('0xad')))['toString']();_0x2689a7[_0xc90e('0x81')](db['sequelize'][_0xc90e('0x3b')](_0x2162ed));}return BPromise[_0xc90e('0x87')](_0x2689a7);}})[_0xc90e('0x27')](function(){return _0x58c112;})[_0xc90e('0x27')](respondWithResult(_0x1ab33a,null))[_0xc90e('0x4f')](handleError(_0x1ab33a,null));};exports[_0xc90e('0xba')]=function(_0x2604d7,_0x1f0fc1,_0x45c307){return db[_0xc90e('0x38')]['find']({'where':{'id':_0x2604d7['params']['id']}})['then'](handleEntityNotFound(_0x1f0fc1,null))[_0xc90e('0x27')](function(_0x36bbf3){if(_0x36bbf3){return _0x36bbf3[_0xc90e('0xba')](_0x2604d7[_0xc90e('0x3b')][_0xc90e('0x89')]);}})[_0xc90e('0x27')](function(_0x47fdb2){if(_0x47fdb2){return db[_0xc90e('0x67')][_0xc90e('0x28')]({'where':{'ListId':_0x2604d7[_0xc90e('0x3b')][_0xc90e('0x89')],'VoiceQueueId':_0x2604d7[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](function(){return _0x47fdb2;});}})[_0xc90e('0x27')](respondWithStatusCode(_0x1f0fc1,null))[_0xc90e('0x4f')](handleError(_0x1f0fc1,null));}; \ No newline at end of file +var _0xd663=['pick','merge','options','includeAll','findAll','rows','catch','show','fields','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','body','createdAt','updatedAt','params','destroy','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','User','Agents','online','interface','flatMap','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','forEach','emit','removeTeams','ids','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','every','TeamId','union','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','all','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','scheduledAt','ContactId','ListId','field','phone','CmListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','onlyIfOpen','insert','into','fromQuery','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','CmList','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','VoiceQueue','rawAttributes','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x46a38b,_0x16ffb5){var _0x346e75=function(_0x34f8d0){while(--_0x34f8d0){_0x46a38b['push'](_0x46a38b['shift']());}};_0x346e75(++_0x16ffb5);}(_0xd663,0x1ed));var _0x3d66=function(_0x565650,_0x5c6cc6){_0x565650=_0x565650-0x0;var _0x3c3146=_0xd663[_0x565650];return _0x3c3146;};'use strict';var emlformat=require(_0x3d66('0x0'));var rimraf=require(_0x3d66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d66('0x2'));var rp=require(_0x3d66('0x3'));var moment=require(_0x3d66('0x4'));var BPromise=require(_0x3d66('0x5'));var Mustache=require(_0x3d66('0x6'));var util=require('util');var path=require(_0x3d66('0x7'));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(_0x3d66('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3d66('0x9'));var deskjs=require(_0x3d66('0xa'));var toCsv=require(_0x3d66('0xb'));var querystring=require(_0x3d66('0xc'));var Papa=require(_0x3d66('0xd'));var Redis=require(_0x3d66('0xe'));var authService=require(_0x3d66('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3d66('0x10'));var hardwareService=require(_0x3d66('0x11'));var logger=require(_0x3d66('0x12'))('api');var utils=require(_0x3d66('0x13'));var config=require(_0x3d66('0x14'));var licenseUtil=require(_0x3d66('0x15'));var db=require('../../mysqldb')['db'];config[_0x3d66('0x16')]=_[_0x3d66('0x17')](config[_0x3d66('0x16')],{'host':_0x3d66('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d66('0x16')]));require('./voiceQueue.socket')[_0x3d66('0x19')](socket);function respondWithStatusCode(_0x290f29,_0x271dd0){_0x271dd0=_0x271dd0||0xcc;return function(_0x3075e2){if(_0x3075e2){return _0x290f29[_0x3d66('0x1a')](_0x271dd0);}return _0x290f29[_0x3d66('0x1b')](_0x271dd0)['end']();};}function respondWithResult(_0x5eba7e,_0xe5bf8f){_0xe5bf8f=_0xe5bf8f||0xc8;return function(_0x4651b8){if(_0x4651b8){return _0x5eba7e['status'](_0xe5bf8f)[_0x3d66('0x1c')](_0x4651b8);}};}function respondWithFilteredResult(_0x24d137,_0x42cd68){return function(_0x1dfd81){if(_0x1dfd81){var _0xe13f0f=typeof _0x42cd68[_0x3d66('0x1d')]===_0x3d66('0x1e')&&typeof _0x42cd68[_0x3d66('0x1f')]===_0x3d66('0x1e');var _0x3902f1=_0x1dfd81[_0x3d66('0x20')];var _0x353c5f=_0xe13f0f?0x0:_0x42cd68[_0x3d66('0x1d')];var _0x42df07=_0xe13f0f?_0x1dfd81[_0x3d66('0x20')]:_0x42cd68['offset']+_0x42cd68[_0x3d66('0x1f')];var _0x5e1516;if(_0x42df07>=_0x3902f1){_0x42df07=_0x3902f1;_0x5e1516=0xc8;}else{_0x5e1516=0xce;}_0x24d137[_0x3d66('0x1b')](_0x5e1516);return _0x24d137[_0x3d66('0x21')](_0x3d66('0x22'),_0x353c5f+'-'+_0x42df07+'/'+_0x3902f1)[_0x3d66('0x1c')](_0x1dfd81);}return null;};}function patchUpdates(_0x11be7f){return function(_0x139cb5){try{jsonpatch[_0x3d66('0x23')](_0x139cb5,_0x11be7f,!![]);}catch(_0x1bfa81){return BPromise[_0x3d66('0x24')](_0x1bfa81);}return _0x139cb5['save']();};}function saveUpdates(_0x151364,_0x1a970c){return function(_0x2c1779){if(_0x2c1779){return _0x2c1779[_0x3d66('0x25')](_0x151364)['then'](function(_0x59fe0a){return _0x59fe0a;});}return null;};}function removeEntity(_0x45628b,_0x4302ad){return function(_0x29819d){if(_0x29819d){return _0x29819d['destroy']()[_0x3d66('0x26')](function(){var _0x3e6712=_0x29819d[_0x3d66('0x27')]({'plain':!![]});var _0x7350d8=[{'name':_0x3d66('0x28'),'value':_0x3d66('0x29'),'ignore':![]},{'name':_0x3d66('0x2a'),'value':_0x3d66('0x2b'),'ignore':![]}];var _0x325de1=_(_0x7350d8)[_0x3d66('0x2c')]('ignore')[_0x3d66('0x2d')](_0x3d66('0x2e'))[_0x3d66('0x2e')]();if(_[_0x3d66('0x2f')](_0x325de1,_0x3e6712[_0x3d66('0x30')])){return;}var _0x41bf36=_[_0x3d66('0x31')](_0x7350d8,[_0x3d66('0x2e'),_0x3e6712[_0x3d66('0x30')]])[_0x3d66('0x32')];return db[_0x3d66('0x33')]['destroy']({'where':{'type':_0x41bf36,'resourceId':_0x3e6712['id']}})['then'](function(){return _0x29819d;});})[_0x3d66('0x26')](function(){_0x45628b[_0x3d66('0x1b')](0xcc)[_0x3d66('0x34')]();});}};}function handleEntityNotFound(_0x26f667,_0x16ec87){return function(_0x32081c){if(!_0x32081c){_0x26f667[_0x3d66('0x1a')](0x194);}return _0x32081c;};}function handleError(_0x218ce8,_0x2af4b2){_0x2af4b2=_0x2af4b2||0x1f4;return function(_0x44de79){logger[_0x3d66('0x35')](_0x44de79[_0x3d66('0x36')]);if(_0x44de79[_0x3d66('0x32')]){delete _0x44de79[_0x3d66('0x32')];}_0x218ce8[_0x3d66('0x1b')](_0x2af4b2)[_0x3d66('0x37')](_0x44de79);};}exports[_0x3d66('0x38')]=function(_0x2e7263,_0x21692b){var _0x1b679f={},_0x44874c={},_0x13bd16={'count':0x0,'rows':[]};var _0x443d0c=_['map'](db[_0x3d66('0x39')][_0x3d66('0x3a')],function(_0xf1bcb4){return{'name':_0xf1bcb4['fieldName'],'type':_0xf1bcb4[_0x3d66('0x30')]['key']};});_0x44874c[_0x3d66('0x3b')]=_[_0x3d66('0x2d')](_0x443d0c,'name');_0x44874c[_0x3d66('0x3c')]=_[_0x3d66('0x3d')](_0x2e7263['query']);_0x44874c[_0x3d66('0x3e')]=_[_0x3d66('0x3f')](_0x44874c['model'],_0x44874c[_0x3d66('0x3c')]);_0x1b679f[_0x3d66('0x40')]=_[_0x3d66('0x3f')](_0x44874c[_0x3d66('0x3b')],qs['fields'](_0x2e7263[_0x3d66('0x3c')]['fields']));_0x1b679f[_0x3d66('0x40')]=_0x1b679f['attributes'][_0x3d66('0x41')]?_0x1b679f[_0x3d66('0x40')]:_0x44874c[_0x3d66('0x3b')];if(!_0x2e7263['query'][_0x3d66('0x42')](_0x3d66('0x43'))){_0x1b679f[_0x3d66('0x1f')]=qs[_0x3d66('0x1f')](_0x2e7263[_0x3d66('0x3c')][_0x3d66('0x1f')]);_0x1b679f[_0x3d66('0x1d')]=qs[_0x3d66('0x1d')](_0x2e7263[_0x3d66('0x3c')][_0x3d66('0x1d')]);}_0x1b679f[_0x3d66('0x44')]=qs[_0x3d66('0x45')](_0x2e7263[_0x3d66('0x3c')]['sort']);_0x1b679f[_0x3d66('0x46')]=qs[_0x3d66('0x3e')](_[_0x3d66('0x47')](_0x2e7263['query'],_0x44874c['filters']),_0x443d0c);if(_0x2e7263[_0x3d66('0x3c')][_0x3d66('0x2c')]){_0x1b679f[_0x3d66('0x46')]=_[_0x3d66('0x48')](_0x1b679f[_0x3d66('0x46')],{'$or':_[_0x3d66('0x2d')](_0x443d0c,function(_0x389691){if(_0x389691[_0x3d66('0x30')]!=='VIRTUAL'){var _0x185459={};_0x185459[_0x389691[_0x3d66('0x32')]]={'$like':'%'+_0x2e7263[_0x3d66('0x3c')]['filter']+'%'};return _0x185459;}})});}_0x1b679f=_['merge']({},_0x1b679f,_0x2e7263[_0x3d66('0x49')]);var _0x39a460={'where':_0x1b679f[_0x3d66('0x46')]};return db[_0x3d66('0x39')][_0x3d66('0x20')](_0x39a460)[_0x3d66('0x26')](function(_0x45ef7c){_0x13bd16[_0x3d66('0x20')]=_0x45ef7c;if(_0x2e7263['query'][_0x3d66('0x4a')]){_0x1b679f['include']=[{'all':!![]}];}return db[_0x3d66('0x39')][_0x3d66('0x4b')](_0x1b679f);})[_0x3d66('0x26')](function(_0x5a4203){_0x13bd16[_0x3d66('0x4c')]=_0x5a4203;return _0x13bd16;})[_0x3d66('0x26')](respondWithFilteredResult(_0x21692b,_0x1b679f))[_0x3d66('0x4d')](handleError(_0x21692b,null));};exports[_0x3d66('0x4e')]=function(_0x4c8c2d,_0x5cb410){var _0x1c6575={'raw':![],'where':{'id':_0x4c8c2d['params']['id']}},_0x52e237={};_0x52e237[_0x3d66('0x3b')]=_[_0x3d66('0x3d')](db[_0x3d66('0x39')][_0x3d66('0x3a')]);_0x52e237[_0x3d66('0x3c')]=_[_0x3d66('0x3d')](_0x4c8c2d[_0x3d66('0x3c')]);_0x52e237['filters']=_[_0x3d66('0x3f')](_0x52e237[_0x3d66('0x3b')],_0x52e237[_0x3d66('0x3c')]);_0x1c6575[_0x3d66('0x40')]=_[_0x3d66('0x3f')](_0x52e237['model'],qs[_0x3d66('0x4f')](_0x4c8c2d[_0x3d66('0x3c')][_0x3d66('0x4f')]));_0x1c6575[_0x3d66('0x40')]=_0x1c6575[_0x3d66('0x40')][_0x3d66('0x41')]?_0x1c6575[_0x3d66('0x40')]:_0x52e237['model'];if(_0x4c8c2d['query']['includeAll']){_0x1c6575[_0x3d66('0x50')]=[{'all':!![]}];}_0x1c6575=_[_0x3d66('0x48')]({},_0x1c6575,_0x4c8c2d['options']);return db[_0x3d66('0x39')][_0x3d66('0x31')](_0x1c6575)[_0x3d66('0x26')](handleEntityNotFound(_0x5cb410,null))[_0x3d66('0x26')](respondWithResult(_0x5cb410,null))[_0x3d66('0x4d')](handleError(_0x5cb410,null));};exports[_0x3d66('0x51')]=function(_0x17bc27,_0x39e123){return db[_0x3d66('0x39')]['create'](_0x17bc27['body'],{})[_0x3d66('0x26')](function(_0x4ea803){var _0x4ce562=_0x17bc27[_0x3d66('0x52')][_0x3d66('0x27')]({'plain':!![]});if(!_0x4ce562)throw new Error(_0x3d66('0x53'));if(_0x4ce562[_0x3d66('0x54')]===_0x3d66('0x52')){var _0x4863d5=_0x4ea803[_0x3d66('0x27')]({'plain':!![]});var _0x33b4f1=[{'name':_0x3d66('0x28'),'value':_0x3d66('0x29')},{'name':'QueueCampaigns','value':_0x3d66('0x2b')}];var _0x320886=_[_0x3d66('0x31')](_0x33b4f1,['value',_0x4863d5['type']])['name'];return db[_0x3d66('0x55')][_0x3d66('0x31')]({'where':{'name':_0x320886,'userProfileId':_0x4ce562[_0x3d66('0x56')]},'raw':!![]})[_0x3d66('0x26')](function(_0x4b451d){if(_0x4b451d&&_0x4b451d[_0x3d66('0x57')]===0x0){return db[_0x3d66('0x33')]['create']({'name':_0x4863d5[_0x3d66('0x32')],'resourceId':_0x4863d5['id'],'type':_0x4b451d[_0x3d66('0x32')],'sectionId':_0x4b451d['id']},{})[_0x3d66('0x26')](function(){return _0x4ea803;});}else{return _0x4ea803;}})[_0x3d66('0x4d')](function(_0x1cb738){logger[_0x3d66('0x35')](_0x3d66('0x58'),_0x1cb738);throw _0x1cb738;});}return _0x4ea803;})['then'](respondWithResult(_0x39e123,0xc9))['catch'](handleError(_0x39e123,null));};exports['clone']=function(_0x232dbf,_0x10177d){var _0x2206c9={'where':{'id':_0x232dbf['params']['id']}},_0x32c159={};_0x32c159[_0x3d66('0x3b')]=_[_0x3d66('0x3d')](db[_0x3d66('0x39')][_0x3d66('0x3a')]);_0x2206c9[_0x3d66('0x40')]=_[_0x3d66('0x3f')](_0x32c159[_0x3d66('0x3b')],qs[_0x3d66('0x4f')](_0x232dbf['query'][_0x3d66('0x4f')]));_0x2206c9['attributes']=_0x2206c9['attributes'][_0x3d66('0x41')]?_0x2206c9[_0x3d66('0x40')]:_0x32c159[_0x3d66('0x3b')];if(_0x232dbf[_0x3d66('0x3c')][_0x3d66('0x4a')]){_0x2206c9[_0x3d66('0x50')]=[{'all':!![]}];}_0x2206c9=_[_0x3d66('0x48')]({},_0x2206c9,_0x232dbf[_0x3d66('0x49')]);return db[_0x3d66('0x39')][_0x3d66('0x31')](_0x2206c9)[_0x3d66('0x26')](handleEntityNotFound(_0x10177d,null))[_0x3d66('0x26')](function(_0x4cea34){if(_0x4cea34){var _0x18fd84=_0x4cea34['get']({'plain':!![]});_0x18fd84=qs[_0x3d66('0x59')](_0x18fd84,['id','createdAt','updatedAt']);_0x232dbf[_0x3d66('0x5a')]=_[_0x3d66('0x59')](_0x232dbf[_0x3d66('0x5a')],['id',_0x3d66('0x5b'),_0x3d66('0x5c')]);return db[_0x3d66('0x39')][_0x3d66('0x51')](_[_0x3d66('0x48')](_0x18fd84,_0x232dbf['body']),{'include':_0x232dbf[_0x3d66('0x3c')][_0x3d66('0x4a')]?[{'all':!![]}]:undefined})[_0x3d66('0x26')](function(_0x51e50a){var _0x1cf222=_0x232dbf[_0x3d66('0x52')][_0x3d66('0x27')]({'plain':!![]});if(!_0x1cf222)throw new Error(_0x3d66('0x53'));if(_0x1cf222[_0x3d66('0x54')]===_0x3d66('0x52')){var _0x34db08=_0x51e50a[_0x3d66('0x27')]({'plain':!![]});var _0x1ec163=[{'name':_0x3d66('0x28'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x3d66('0x2b')}];var _0x271963=_['find'](_0x1ec163,[_0x3d66('0x2e'),_0x34db08[_0x3d66('0x30')]])[_0x3d66('0x32')];return db[_0x3d66('0x55')][_0x3d66('0x31')]({'where':{'name':_0x271963,'userProfileId':_0x1cf222[_0x3d66('0x56')]},'raw':!![]})[_0x3d66('0x26')](function(_0x5d11cd){if(_0x5d11cd&&_0x5d11cd[_0x3d66('0x57')]===0x0){return db[_0x3d66('0x33')]['create']({'name':_0x34db08[_0x3d66('0x32')],'resourceId':_0x34db08['id'],'type':_0x5d11cd[_0x3d66('0x32')],'sectionId':_0x5d11cd['id']},{})[_0x3d66('0x26')](function(){return _0x51e50a;});}else{return _0x51e50a;}})['catch'](function(_0x39c155){logger['error'](_0x3d66('0x58'),_0x39c155);throw _0x39c155;});}return _0x51e50a;});}})[_0x3d66('0x26')](respondWithResult(_0x10177d,0xc9))[_0x3d66('0x4d')](handleError(_0x10177d,null));};exports[_0x3d66('0x25')]=function(_0x2c49b2,_0x997db7){if(_0x2c49b2['body']['id']){delete _0x2c49b2['body']['id'];}return db[_0x3d66('0x39')]['find']({'where':{'id':_0x2c49b2[_0x3d66('0x5d')]['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0x997db7,null))[_0x3d66('0x26')](saveUpdates(_0x2c49b2['body'],null))[_0x3d66('0x26')](respondWithResult(_0x997db7,null))[_0x3d66('0x4d')](handleError(_0x997db7,null));};exports[_0x3d66('0x5e')]=function(_0x4fbfab,_0x26e494){return db[_0x3d66('0x39')]['find']({'where':{'id':_0x4fbfab[_0x3d66('0x5d')]['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0x26e494,null))[_0x3d66('0x26')](removeEntity(_0x26e494,null))[_0x3d66('0x4d')](handleError(_0x26e494,null));};exports[_0x3d66('0x5f')]=function(_0x5e26fe,_0xa6a2fa,_0x316eaa){var _0x205ef4={'raw':![],'where':{}};var _0x15d110={};var _0x19aba3={'count':0x0,'rows':[]};return db[_0x3d66('0x39')][_0x3d66('0x60')]({'where':{'id':_0x5e26fe[_0x3d66('0x5d')]['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0xa6a2fa,null))[_0x3d66('0x26')](function(_0x36982a){if(_0x36982a){_0x15d110[_0x3d66('0x3b')]=_['keys'](db[_0x3d66('0x61')]['rawAttributes']);_0x15d110[_0x3d66('0x3c')]=_[_0x3d66('0x3d')](_0x5e26fe[_0x3d66('0x3c')]);_0x15d110['filters']=_[_0x3d66('0x3f')](_0x15d110['model'],_0x15d110[_0x3d66('0x3c')]);_0x205ef4[_0x3d66('0x40')]=_[_0x3d66('0x3f')](_0x15d110[_0x3d66('0x3b')],qs[_0x3d66('0x4f')](_0x5e26fe[_0x3d66('0x3c')][_0x3d66('0x4f')]));_0x205ef4[_0x3d66('0x40')]=_0x205ef4[_0x3d66('0x40')]['length']?_0x205ef4[_0x3d66('0x40')]:_0x15d110[_0x3d66('0x3b')];if(!_0x5e26fe[_0x3d66('0x3c')][_0x3d66('0x42')](_0x3d66('0x43'))){_0x205ef4[_0x3d66('0x1f')]=qs[_0x3d66('0x1f')](_0x5e26fe[_0x3d66('0x3c')][_0x3d66('0x1f')]);_0x205ef4['offset']=qs[_0x3d66('0x1d')](_0x5e26fe[_0x3d66('0x3c')][_0x3d66('0x1d')]);}_0x205ef4[_0x3d66('0x44')]=qs[_0x3d66('0x45')](_0x5e26fe[_0x3d66('0x3c')][_0x3d66('0x45')]);_0x205ef4[_0x3d66('0x46')]=qs[_0x3d66('0x3e')](_[_0x3d66('0x47')](_0x5e26fe[_0x3d66('0x3c')],_0x15d110['filters']));_0x205ef4[_0x3d66('0x46')][_0x3d66('0x62')]=_0x36982a['id'];if(_0x5e26fe['query'][_0x3d66('0x2c')]){_0x205ef4[_0x3d66('0x46')]=_['merge'](_0x205ef4['where'],{'$or':_[_0x3d66('0x2d')](_0x205ef4[_0x3d66('0x40')],function(_0x206073){var _0x4992d5={};_0x4992d5[_0x206073]={'$like':'%'+_0x5e26fe[_0x3d66('0x3c')][_0x3d66('0x2c')]+'%'};return _0x4992d5;})});}_0x205ef4=_[_0x3d66('0x48')]({},_0x205ef4,_0x5e26fe[_0x3d66('0x49')]);return db['CmHopper'][_0x3d66('0x20')]({'where':_0x205ef4[_0x3d66('0x46')]})[_0x3d66('0x26')](function(_0x5dee77){_0x19aba3[_0x3d66('0x20')]=_0x5dee77;if(_0x5e26fe[_0x3d66('0x3c')][_0x3d66('0x4a')]){_0x205ef4['include']=[{'all':!![]}];}return db[_0x3d66('0x61')]['findAll'](_0x205ef4);})[_0x3d66('0x26')](function(_0x396a59){_0x19aba3[_0x3d66('0x4c')]=_0x396a59;return _0x19aba3;});}})['then'](respondWithFilteredResult(_0xa6a2fa,_0x205ef4))[_0x3d66('0x4d')](handleError(_0xa6a2fa,null));};exports[_0x3d66('0x63')]=function(_0x573134,_0x1dc7b5,_0x4ed024){var _0x25b997={'raw':!![],'where':{}};var _0x150f3c={};var _0x214191={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3d66('0x60')]({'where':{'id':_0x573134[_0x3d66('0x5d')]['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0x1dc7b5,null))[_0x3d66('0x26')](function(_0x458d71){if(_0x458d71){_0x150f3c['model']=_[_0x3d66('0x3d')](db[_0x3d66('0x64')][_0x3d66('0x3a')]);_0x150f3c['query']=_[_0x3d66('0x3d')](_0x573134[_0x3d66('0x3c')]);_0x150f3c[_0x3d66('0x3e')]=_[_0x3d66('0x3f')](_0x150f3c[_0x3d66('0x3b')],_0x150f3c['query']);_0x25b997['attributes']=_[_0x3d66('0x3f')](_0x150f3c[_0x3d66('0x3b')],qs['fields'](_0x573134[_0x3d66('0x3c')][_0x3d66('0x4f')]));_0x25b997[_0x3d66('0x40')]=_0x25b997['attributes'][_0x3d66('0x41')]?_0x25b997[_0x3d66('0x40')]:_0x150f3c['model'];if(!_0x573134['query'][_0x3d66('0x42')]('nolimit')){_0x25b997[_0x3d66('0x1f')]=qs[_0x3d66('0x1f')](_0x573134[_0x3d66('0x3c')]['limit']);_0x25b997['offset']=qs[_0x3d66('0x1d')](_0x573134[_0x3d66('0x3c')][_0x3d66('0x1d')]);}_0x25b997[_0x3d66('0x44')]=qs[_0x3d66('0x45')](_0x573134['query']['sort']);_0x25b997[_0x3d66('0x46')]=qs[_0x3d66('0x3e')](_[_0x3d66('0x47')](_0x573134[_0x3d66('0x3c')],_0x150f3c[_0x3d66('0x3e')]));_0x25b997[_0x3d66('0x46')]['VoiceQueueId']=_0x458d71['id'];if(_0x573134['query'][_0x3d66('0x2c')]){_0x25b997[_0x3d66('0x46')]=_['merge'](_0x25b997[_0x3d66('0x46')],{'$or':_[_0x3d66('0x2d')](_0x25b997['attributes'],function(_0x5a7a81){var _0x5f19d5={};_0x5f19d5[_0x5a7a81]={'$like':'%'+_0x573134['query']['filter']+'%'};return _0x5f19d5;})});}_0x25b997=_['merge']({},_0x25b997,_0x573134[_0x3d66('0x49')]);return db[_0x3d66('0x64')][_0x3d66('0x20')]({'where':_0x25b997[_0x3d66('0x46')]})[_0x3d66('0x26')](function(_0x116867){_0x214191[_0x3d66('0x20')]=_0x116867;if(_0x573134['query'][_0x3d66('0x4a')]){_0x25b997[_0x3d66('0x50')]=[{'all':!![]}];}return db[_0x3d66('0x64')][_0x3d66('0x4b')](_0x25b997);})[_0x3d66('0x26')](function(_0x5e0db2){_0x214191['rows']=_0x5e0db2;return _0x214191;});}})[_0x3d66('0x26')](respondWithFilteredResult(_0x1dc7b5,_0x25b997))[_0x3d66('0x4d')](handleError(_0x1dc7b5,null));};exports[_0x3d66('0x65')]=function(_0x4340c1,_0x461cd4,_0x431c60){var _0x36cc3a={'raw':!![],'where':{}};var _0x16a3cf={};var _0x1b2a0e={'count':0x0,'rows':[]};return db[_0x3d66('0x39')][_0x3d66('0x60')]({'where':{'id':_0x4340c1[_0x3d66('0x5d')]['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0x461cd4,null))['then'](function(_0x302d14){if(_0x302d14){_0x16a3cf[_0x3d66('0x3b')]=_[_0x3d66('0x3d')](db['CmHopperFinal'][_0x3d66('0x3a')]);_0x16a3cf[_0x3d66('0x3c')]=_[_0x3d66('0x3d')](_0x4340c1['query']);_0x16a3cf['filters']=_['intersection'](_0x16a3cf[_0x3d66('0x3b')],_0x16a3cf['query']);_0x36cc3a[_0x3d66('0x40')]=_[_0x3d66('0x3f')](_0x16a3cf[_0x3d66('0x3b')],qs[_0x3d66('0x4f')](_0x4340c1['query'][_0x3d66('0x4f')]));_0x36cc3a[_0x3d66('0x40')]=_0x36cc3a['attributes'][_0x3d66('0x41')]?_0x36cc3a['attributes']:_0x16a3cf[_0x3d66('0x3b')];if(!_0x4340c1[_0x3d66('0x3c')]['hasOwnProperty']('nolimit')){_0x36cc3a[_0x3d66('0x1f')]=qs['limit'](_0x4340c1[_0x3d66('0x3c')][_0x3d66('0x1f')]);_0x36cc3a[_0x3d66('0x1d')]=qs['offset'](_0x4340c1[_0x3d66('0x3c')][_0x3d66('0x1d')]);}_0x36cc3a[_0x3d66('0x44')]=qs[_0x3d66('0x45')](_0x4340c1[_0x3d66('0x3c')]['sort']);_0x36cc3a[_0x3d66('0x46')]=qs['filters'](_[_0x3d66('0x47')](_0x4340c1[_0x3d66('0x3c')],_0x16a3cf['filters']));_0x36cc3a[_0x3d66('0x46')][_0x3d66('0x62')]=_0x302d14['id'];if(_0x4340c1[_0x3d66('0x3c')]['filter']){_0x36cc3a[_0x3d66('0x46')]=_[_0x3d66('0x48')](_0x36cc3a[_0x3d66('0x46')],{'$or':_[_0x3d66('0x2d')](_0x36cc3a[_0x3d66('0x40')],function(_0x5c9302){var _0x54808d={};_0x54808d[_0x5c9302]={'$like':'%'+_0x4340c1[_0x3d66('0x3c')]['filter']+'%'};return _0x54808d;})});}_0x36cc3a=_[_0x3d66('0x48')]({},_0x36cc3a,_0x4340c1[_0x3d66('0x49')]);return db[_0x3d66('0x66')]['count']({'where':_0x36cc3a[_0x3d66('0x46')]})[_0x3d66('0x26')](function(_0x191263){_0x1b2a0e['count']=_0x191263;if(_0x4340c1[_0x3d66('0x3c')]['includeAll']){_0x36cc3a[_0x3d66('0x50')]=[{'all':!![]}];}return db[_0x3d66('0x66')][_0x3d66('0x4b')](_0x36cc3a);})[_0x3d66('0x26')](function(_0x4791e2){_0x1b2a0e[_0x3d66('0x4c')]=_0x4791e2;return _0x1b2a0e;});}})['then'](respondWithFilteredResult(_0x461cd4,_0x36cc3a))['catch'](handleError(_0x461cd4,null));};exports[_0x3d66('0x67')]=function(_0x1e349d,_0x3ee655,_0x482e9d){var _0x11c05b={'raw':!![],'where':{}};var _0x5e4272={};var _0x5ef999={'count':0x0,'rows':[]};return db[_0x3d66('0x39')]['findOne']({'where':{'id':_0x1e349d[_0x3d66('0x5d')]['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0x3ee655,null))[_0x3d66('0x26')](function(_0x50cffa){if(_0x50cffa){_0x5e4272[_0x3d66('0x3b')]=_['keys'](db['CmHopperBlack'][_0x3d66('0x3a')]);_0x5e4272['query']=_[_0x3d66('0x3d')](_0x1e349d[_0x3d66('0x3c')]);_0x5e4272[_0x3d66('0x3e')]=_[_0x3d66('0x3f')](_0x5e4272[_0x3d66('0x3b')],_0x5e4272[_0x3d66('0x3c')]);_0x11c05b[_0x3d66('0x40')]=_[_0x3d66('0x3f')](_0x5e4272[_0x3d66('0x3b')],qs[_0x3d66('0x4f')](_0x1e349d['query'][_0x3d66('0x4f')]));_0x11c05b[_0x3d66('0x40')]=_0x11c05b[_0x3d66('0x40')][_0x3d66('0x41')]?_0x11c05b[_0x3d66('0x40')]:_0x5e4272[_0x3d66('0x3b')];if(!_0x1e349d['query'][_0x3d66('0x42')](_0x3d66('0x43'))){_0x11c05b[_0x3d66('0x1f')]=qs[_0x3d66('0x1f')](_0x1e349d[_0x3d66('0x3c')][_0x3d66('0x1f')]);_0x11c05b[_0x3d66('0x1d')]=qs['offset'](_0x1e349d[_0x3d66('0x3c')]['offset']);}_0x11c05b['order']=qs[_0x3d66('0x45')](_0x1e349d[_0x3d66('0x3c')]['sort']);_0x11c05b['where']=qs[_0x3d66('0x3e')](_[_0x3d66('0x47')](_0x1e349d[_0x3d66('0x3c')],_0x5e4272['filters']));_0x11c05b[_0x3d66('0x46')][_0x3d66('0x62')]=_0x50cffa['id'];if(_0x1e349d['query']['filter']){_0x11c05b[_0x3d66('0x46')]=_['merge'](_0x11c05b[_0x3d66('0x46')],{'$or':_[_0x3d66('0x2d')](_0x11c05b[_0x3d66('0x40')],function(_0x335f32){var _0x22c6c9={};_0x22c6c9[_0x335f32]={'$like':'%'+_0x1e349d[_0x3d66('0x3c')]['filter']+'%'};return _0x22c6c9;})});}_0x11c05b=_['merge']({},_0x11c05b,_0x1e349d[_0x3d66('0x49')]);return db[_0x3d66('0x68')][_0x3d66('0x20')]({'where':_0x11c05b[_0x3d66('0x46')]})[_0x3d66('0x26')](function(_0x2da93e){_0x5ef999[_0x3d66('0x20')]=_0x2da93e;if(_0x1e349d['query']['includeAll']){_0x11c05b[_0x3d66('0x50')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3d66('0x4b')](_0x11c05b);})[_0x3d66('0x26')](function(_0x475982){_0x5ef999[_0x3d66('0x4c')]=_0x475982;return _0x5ef999;});}})[_0x3d66('0x26')](respondWithFilteredResult(_0x3ee655,_0x11c05b))[_0x3d66('0x4d')](handleError(_0x3ee655,null));};exports[_0x3d66('0x69')]=function(_0x3fb3ba,_0x46a956,_0x102f98){var _0x63e5b1={};var _0x20bed1={};var _0x288d4d;var _0x2f3a12;return db[_0x3d66('0x39')][_0x3d66('0x60')]({'where':{'id':_0x3fb3ba[_0x3d66('0x5d')]['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0x46a956,null))[_0x3d66('0x26')](function(_0x110f2e){if(_0x110f2e){_0x288d4d=_0x110f2e;_0x20bed1[_0x3d66('0x3b')]=_[_0x3d66('0x3d')](db['Team'][_0x3d66('0x3a')]);_0x20bed1['query']=_['keys'](_0x3fb3ba[_0x3d66('0x3c')]);_0x20bed1[_0x3d66('0x3e')]=_[_0x3d66('0x3f')](_0x20bed1['model'],_0x20bed1[_0x3d66('0x3c')]);_0x63e5b1[_0x3d66('0x40')]=_[_0x3d66('0x3f')](_0x20bed1['model'],qs[_0x3d66('0x4f')](_0x3fb3ba['query']['fields']));_0x63e5b1[_0x3d66('0x40')]=_0x63e5b1[_0x3d66('0x40')][_0x3d66('0x41')]?_0x63e5b1[_0x3d66('0x40')]:_0x20bed1[_0x3d66('0x3b')];_0x63e5b1['order']=qs[_0x3d66('0x45')](_0x3fb3ba[_0x3d66('0x3c')]['sort']);_0x63e5b1[_0x3d66('0x46')]=qs['filters'](_[_0x3d66('0x47')](_0x3fb3ba['query'],_0x20bed1[_0x3d66('0x3e')]));if(_0x3fb3ba['query'][_0x3d66('0x2c')]){_0x63e5b1['where']=_['merge'](_0x63e5b1[_0x3d66('0x46')],{'$or':_['map'](_0x63e5b1[_0x3d66('0x40')],function(_0x42d1a5){var _0x5dbad4={};_0x5dbad4[_0x42d1a5]={'$like':'%'+_0x3fb3ba[_0x3d66('0x3c')][_0x3d66('0x2c')]+'%'};return _0x5dbad4;})});}_0x63e5b1=_[_0x3d66('0x48')]({},_0x63e5b1,_0x3fb3ba[_0x3d66('0x49')]);return _0x288d4d[_0x3d66('0x69')](_0x63e5b1);}})[_0x3d66('0x26')](function(_0x1c04f3){if(_0x1c04f3){_0x2f3a12=_0x1c04f3[_0x3d66('0x41')];if(!_0x3fb3ba[_0x3d66('0x3c')][_0x3d66('0x42')]('nolimit')){_0x63e5b1[_0x3d66('0x1f')]=qs[_0x3d66('0x1f')](_0x3fb3ba[_0x3d66('0x3c')][_0x3d66('0x1f')]);_0x63e5b1[_0x3d66('0x1d')]=qs[_0x3d66('0x1d')](_0x3fb3ba[_0x3d66('0x3c')][_0x3d66('0x1d')]);}return _0x288d4d[_0x3d66('0x69')](_0x63e5b1);}})[_0x3d66('0x26')](function(_0x35ebe5){if(_0x35ebe5){return _0x35ebe5?{'count':_0x2f3a12,'rows':_0x35ebe5}:null;}})[_0x3d66('0x26')](respondWithResult(_0x46a956,null))[_0x3d66('0x4d')](handleError(_0x46a956,null));};exports['addTeams']=function(_0x4decb0,_0x35fae3,_0x4dbb99){var _0x55d4be=_0x4decb0[_0x3d66('0x5a')][_0x3d66('0x6a')];var _0xb09af6=_[_0x3d66('0x2d')](_0x55d4be,'id');return db[_0x3d66('0x6b')][_0x3d66('0x4b')]({'where':{'id':_0xb09af6},'attributes':['id'],'include':[{'model':db[_0x3d66('0x6c')],'as':_0x3d66('0x6d'),'attributes':['id','name',_0x3d66('0x6e'),'voicePause',_0x3d66('0x6f')],'raw':!![]}]})[_0x3d66('0x26')](function(_0xc1d558){if(_0xc1d558){var _0x4b7124=_[_0x3d66('0x70')](_0xc1d558,function(_0x153eb8){var _0x5b7aea=_0x153eb8[_0x3d66('0x27')]({'plain':!![]});_0x5b7aea[_0x3d66('0x6d')]['forEach'](function(_0x4b8ffe){_0x4b8ffe[_0x3d66('0x71')]=_[_0x3d66('0x31')](_0x55d4be,{'id':_0x5b7aea['id']})[_0x3d66('0x71')];});return _0x5b7aea['Agents'];});return db['VoiceQueue'][_0x3d66('0x31')]({'where':{'id':_0x4decb0['params']['id']}})['then'](function(_0x3a9929){return db['sequelize'][_0x3d66('0x72')](function(_0x565e25){return _0x3a9929['addTeams'](_0xb09af6,{'transaction':_0x565e25})[_0x3d66('0x26')](function(){return BPromise[_0x3d66('0x73')](_0x55d4be,function(_0x435d63){return db[_0x3d66('0x74')][_0x3d66('0x75')]({'TeamId':_0x435d63['id'],'VoiceQueueId':_0x4decb0[_0x3d66('0x5d')]['id'],'penalty':_0x435d63[_0x3d66('0x71')]},{'transaction':_0x565e25});});})[_0x3d66('0x26')](function(){return BPromise[_0x3d66('0x73')](_0x4b7124,function(_0x2c4466){return db[_0x3d66('0x76')][_0x3d66('0x77')]({'where':{'UserId':_0x2c4466['id'],'VoiceQueueId':_0x4decb0[_0x3d66('0x5d')]['id']},'defaults':{'penalty':_0x2c4466[_0x3d66('0x71')]},'transaction':_0x565e25});});})['then'](function(){return BPromise['each'](_[_0x3d66('0x2c')](_0x4b7124,{'online':!![]}),function(_0x340901){return db[_0x3d66('0x78')][_0x3d66('0x75')]({'membername':_0x340901[_0x3d66('0x32')],'UserId':_0x340901['id'],'queue_name':_0x3a9929['name'],'VoiceQueueId':_0x3a9929['id'],'interface':_[_0x3d66('0x79')](_0x340901[_0x3d66('0x6f')])?util[_0x3d66('0x7a')](_0x3d66('0x7b'),_0x340901[_0x3d66('0x32')]):_0x340901[_0x3d66('0x6f')],'paused':_0x340901[_0x3d66('0x7c')]||![],'penalty':_0x340901[_0x3d66('0x71')]},{'transaction':_0x565e25});});})[_0x3d66('0x26')](function(){_0x4b7124[_0x3d66('0x7d')](function(_0x58da3f){socket[_0x3d66('0x7e')]('userVoiceQueue:save',{'UserId':_0x58da3f['id'],'VoiceQueueId':_0x3a9929['id']});});});});});}})[_0x3d66('0x26')](respondWithStatusCode(_0x35fae3,null))[_0x3d66('0x4d')](handleError(_0x35fae3,null));};exports[_0x3d66('0x7f')]=function(_0x3dc8b4,_0x21b545,_0x43ff52){return db[_0x3d66('0x6b')][_0x3d66('0x4b')]({'where':{'id':_0x3dc8b4[_0x3d66('0x3c')][_0x3d66('0x80')]},'attributes':['id'],'include':[{'model':db[_0x3d66('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21b545,null))[_0x3d66('0x26')](function(_0x48ddff){var _0x18291f=_[_0x3d66('0x2d')](_0x48ddff,'id');var _0x352506=[];var _0x132fd6=[];var _0x1f3194=squel[_0x3d66('0x81')]();_0x1f3194['field'](_0x3d66('0x82'))[_0x3d66('0x83')](_0x3d66('0x84'),'tq')[_0x3d66('0x85')](_0x3d66('0x86'),'ut',_0x3d66('0x87'))['where']('VoiceQueueId\x20=\x20?',_0x3dc8b4[_0x3d66('0x5d')]['id']);for(var _0x473de9=0x0;_0x473de9<_0x48ddff[_0x3d66('0x41')];_0x473de9+=0x1){let _0x267d74=_0x48ddff[_0x473de9];for(var _0x5c1355=0x0;_0x5c1355<_0x267d74[_0x3d66('0x6d')][_0x3d66('0x41')];_0x5c1355+=0x1){let _0x239f60=_0x267d74[_0x3d66('0x6d')][_0x5c1355];var _0x4797d5=_0x1f3194[_0x3d66('0x88')]();_0x4797d5['where'](_0x3d66('0x89'),_0x239f60['id']);_0x132fd6[_0x3d66('0x8a')](db[_0x3d66('0x8b')][_0x3d66('0x3c')](_0x4797d5['toString'](),{'type':db[_0x3d66('0x8b')]['QueryTypes']['SELECT']})[_0x3d66('0x26')](function(_0x78e756){if(_0x78e756[_0x3d66('0x41')]===0x1){return _0x239f60['id'];}else{var _0x6e246a=_[_0x3d66('0x8c')](_[_0x3d66('0x2d')](_0x78e756,_0x3d66('0x8d')),function(_0xe219b){return _[_0x3d66('0x2f')](_0x18291f,_0xe219b);});if(_0x6e246a){return _0x239f60['id'];}}}));}}return BPromise['all'](_0x132fd6)[_0x3d66('0x26')](function(_0x49a95b){_0x352506=_(_0x352506)[_0x3d66('0x8e')](_0x49a95b)['compact']()['value']();return db[_0x3d66('0x39')][_0x3d66('0x31')]({'where':{'id':_0x3dc8b4['params']['id']}})[_0x3d66('0x26')](function(_0x5dcf5e){return db['sequelize'][_0x3d66('0x72')](function(_0x445509){return _0x5dcf5e[_0x3d66('0x7f')](_0x3dc8b4[_0x3d66('0x3c')]['ids'],{'transaction':_0x445509})[_0x3d66('0x26')](function(){if(!_['isEmpty'](_0x352506)){return _0x5dcf5e[_0x3d66('0x8f')](_0x352506,{'transaction':_0x445509})['then'](function(){return db['UserVoiceQueueRt'][_0x3d66('0x5e')]({'where':{'VoiceQueueId':_0x3dc8b4[_0x3d66('0x5d')]['id'],'UserId':_0x352506},'transaction':_0x445509});});}})[_0x3d66('0x26')](function(){_0x352506[_0x3d66('0x7d')](function(_0x818cd){socket['emit'](_0x3d66('0x90'),{'UserId':_0x818cd,'VoiceQueueId':_0x5dcf5e['id']});});});});});});})[_0x3d66('0x26')](respondWithStatusCode(_0x21b545,null))[_0x3d66('0x4d')](handleError(_0x21b545,null));};exports[_0x3d66('0x91')]=function(_0x5be776,_0x24f841,_0x662d05){var _0x458148,_0x96ec99;return db[_0x3d66('0x39')][_0x3d66('0x31')]({'where':{'id':_0x5be776[_0x3d66('0x5d')]['id']}})['then'](handleEntityNotFound(_0x24f841,null))[_0x3d66('0x26')](function(_0xf72a6a){if(_0xf72a6a){_0x96ec99=_0xf72a6a;return _0xf72a6a[_0x3d66('0x91')](_0x5be776['body'][_0x3d66('0x80')],_[_0x3d66('0x59')](_0x5be776[_0x3d66('0x5a')],[_0x3d66('0x80'),'id'])||{})[_0x3d66('0x92')](function(_0x33795c){for(var _0x2a0c5c=0x0;_0x2a0c5c<_0x5be776['body'][_0x3d66('0x80')][_0x3d66('0x41')];_0x2a0c5c+=0x1){socket['emit'](_0x3d66('0x93'),{'UserId':Number(_0x5be776[_0x3d66('0x5a')][_0x3d66('0x80')][_0x2a0c5c]),'VoiceQueueId':Number(_0x5be776['params']['id'])});}return _0x33795c;});}})[_0x3d66('0x26')](function(_0x3d79f4){_0x458148=_0x3d79f4||[];if(_0x96ec99){return db[_0x3d66('0x6c')][_0x3d66('0x4b')]({'where':{'id':_0x5be776['body'][_0x3d66('0x80')]},'attributes':['id',_0x3d66('0x32'),_0x3d66('0x6e'),'voicePause',_0x3d66('0x6f')],'raw':!![]});}})[_0x3d66('0x26')](function(_0x27119a){if(!_['isEmpty'](_0x27119a)){var _0x4588cb=[];for(var _0x11bae4=0x0;_0x11bae4<_0x27119a[_0x3d66('0x41')];_0x11bae4++){if(_0x27119a[_0x11bae4]['online']){_0x4588cb[_0x3d66('0x8a')](db[_0x3d66('0x78')][_0x3d66('0x75')]({'membername':_0x27119a[_0x11bae4][_0x3d66('0x32')],'UserId':_0x27119a[_0x11bae4]['id'],'queue_name':_0x96ec99[_0x3d66('0x32')],'VoiceQueueId':_0x96ec99['id'],'interface':_[_0x3d66('0x79')](_0x27119a[_0x11bae4][_0x3d66('0x6f')])?util['format']('SIP/%s',_0x27119a[_0x11bae4][_0x3d66('0x32')]):_0x27119a[_0x11bae4][_0x3d66('0x6f')],'paused':_0x27119a[_0x11bae4][_0x3d66('0x7c')]||![],'penalty':_0x5be776['body']['penalty']||0x0}));}}return BPromise[_0x3d66('0x94')](_0x4588cb);}})[_0x3d66('0x26')](function(){return _0x458148;})[_0x3d66('0x26')](respondWithResult(_0x24f841,null))[_0x3d66('0x4d')](handleError(_0x24f841,null));};exports['removeAgents']=function(_0x1f797e,_0xf06f4d,_0x23e5b3){return db[_0x3d66('0x39')][_0x3d66('0x31')]({'where':{'id':_0x1f797e['params']['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0xf06f4d,null))[_0x3d66('0x26')](function(_0x2d94a5){if(_0x2d94a5){return _0x2d94a5[_0x3d66('0x8f')](_0x1f797e[_0x3d66('0x3c')][_0x3d66('0x80')])['then'](function(){if(_[_0x3d66('0x95')](_0x1f797e[_0x3d66('0x3c')]['ids'])){for(var _0x4db8e1=0x0;_0x4db8e1<_0x1f797e[_0x3d66('0x3c')][_0x3d66('0x80')][_0x3d66('0x41')];_0x4db8e1+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x1f797e[_0x3d66('0x3c')][_0x3d66('0x80')][_0x4db8e1]),'VoiceQueueId':Number(_0x1f797e['params']['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x1f797e['query']['ids']),'VoiceQueueId':Number(_0x1f797e[_0x3d66('0x5d')]['id'])});}});}})[_0x3d66('0x26')](function(_0x5b3de9){return db[_0x3d66('0x78')][_0x3d66('0x5e')]({'where':{'VoiceQueueId':_0x1f797e[_0x3d66('0x5d')]['id'],'UserId':_0x1f797e[_0x3d66('0x3c')][_0x3d66('0x80')]}})[_0x3d66('0x26')](function(){return _0x5b3de9;});})['then'](respondWithStatusCode(_0xf06f4d,null))['catch'](handleError(_0xf06f4d,null));};exports[_0x3d66('0x96')]=function(_0x5d0236,_0x3fa2b7,_0x4cecaf){var _0x4a677a={};var _0x54aad8={};var _0x28f3e2;var _0x96aa8d;return db[_0x3d66('0x39')][_0x3d66('0x60')]({'where':{'id':_0x5d0236[_0x3d66('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3fa2b7,null))[_0x3d66('0x26')](function(_0x2644e0){if(_0x2644e0){_0x28f3e2=_0x2644e0;_0x54aad8['model']=_[_0x3d66('0x3d')](db[_0x3d66('0x6c')][_0x3d66('0x3a')]);_0x54aad8[_0x3d66('0x3c')]=_[_0x3d66('0x3d')](_0x5d0236[_0x3d66('0x3c')]);_0x54aad8[_0x3d66('0x3e')]=_[_0x3d66('0x3f')](_0x54aad8[_0x3d66('0x3b')],_0x54aad8[_0x3d66('0x3c')]);_0x4a677a[_0x3d66('0x40')]=_[_0x3d66('0x3f')](_0x54aad8['model'],qs['fields'](_0x5d0236[_0x3d66('0x3c')][_0x3d66('0x4f')]));_0x4a677a[_0x3d66('0x40')]=_0x4a677a[_0x3d66('0x40')][_0x3d66('0x41')]?_0x4a677a['attributes']:_0x54aad8[_0x3d66('0x3b')];_0x4a677a[_0x3d66('0x44')]=qs[_0x3d66('0x45')](_0x5d0236['query'][_0x3d66('0x45')]);_0x4a677a['where']=qs['filters'](_[_0x3d66('0x47')](_0x5d0236[_0x3d66('0x3c')],_0x54aad8[_0x3d66('0x3e')]));if(_0x5d0236[_0x3d66('0x3c')][_0x3d66('0x2c')]){_0x4a677a[_0x3d66('0x46')]=_[_0x3d66('0x48')](_0x4a677a['where'],{'$or':_[_0x3d66('0x2d')](_0x4a677a['attributes'],function(_0x4f1d76){var _0x4f6344={};_0x4f6344[_0x4f1d76]={'$like':'%'+_0x5d0236['query'][_0x3d66('0x2c')]+'%'};return _0x4f6344;})});}_0x4a677a=_['merge']({},_0x4a677a,_0x5d0236[_0x3d66('0x49')]);return _0x28f3e2[_0x3d66('0x96')](_0x4a677a);}})['then'](function(_0x2242ae){if(_0x2242ae){_0x96aa8d=_0x2242ae[_0x3d66('0x41')];if(!_0x5d0236[_0x3d66('0x3c')][_0x3d66('0x42')]('nolimit')){_0x4a677a[_0x3d66('0x1f')]=qs[_0x3d66('0x1f')](_0x5d0236['query'][_0x3d66('0x1f')]);_0x4a677a[_0x3d66('0x1d')]=qs[_0x3d66('0x1d')](_0x5d0236[_0x3d66('0x3c')]['offset']);}return _0x28f3e2[_0x3d66('0x96')](_0x4a677a);}})[_0x3d66('0x26')](function(_0x52b06a){if(_0x52b06a){return _0x52b06a?{'count':_0x96aa8d,'rows':_0x52b06a}:null;}})[_0x3d66('0x26')](respondWithResult(_0x3fa2b7,null))[_0x3d66('0x4d')](handleError(_0x3fa2b7,null));};exports[_0x3d66('0x97')]=function(_0x405f2a,_0x220458,_0x50f8e0){var _0x4bf402={};var _0x5c1600={};var _0x13059e;var _0x1412e0;return db['VoiceQueue'][_0x3d66('0x60')]({'where':{'id':_0x405f2a[_0x3d66('0x5d')]['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0x220458,null))[_0x3d66('0x26')](function(_0x93b251){if(_0x93b251){_0x13059e=_0x93b251;_0x5c1600['model']=_[_0x3d66('0x3d')](db[_0x3d66('0x78')][_0x3d66('0x3a')]);_0x5c1600['query']=_[_0x3d66('0x3d')](_0x405f2a[_0x3d66('0x3c')]);_0x5c1600[_0x3d66('0x3e')]=_[_0x3d66('0x3f')](_0x5c1600[_0x3d66('0x3b')],_0x5c1600[_0x3d66('0x3c')]);_0x4bf402['attributes']=_[_0x3d66('0x3f')](_0x5c1600['model'],qs[_0x3d66('0x4f')](_0x405f2a[_0x3d66('0x3c')][_0x3d66('0x4f')]));_0x4bf402[_0x3d66('0x40')]=_0x4bf402[_0x3d66('0x40')][_0x3d66('0x41')]?_0x4bf402[_0x3d66('0x40')]:_0x5c1600[_0x3d66('0x3b')];_0x4bf402['order']=qs['sort'](_0x405f2a['query'][_0x3d66('0x45')]);_0x4bf402[_0x3d66('0x46')]=qs[_0x3d66('0x3e')](_[_0x3d66('0x47')](_0x405f2a[_0x3d66('0x3c')],_0x5c1600[_0x3d66('0x3e')]));if(_0x405f2a[_0x3d66('0x3c')]['filter']){_0x4bf402[_0x3d66('0x46')]=_['merge'](_0x4bf402[_0x3d66('0x46')],{'$or':_['map'](_0x4bf402[_0x3d66('0x40')],function(_0x2d1ad4){var _0x4fcb2a={};_0x4fcb2a[_0x2d1ad4]={'$like':'%'+_0x405f2a[_0x3d66('0x3c')]['filter']+'%'};return _0x4fcb2a;})});}_0x4bf402=_[_0x3d66('0x48')]({},_0x4bf402,_0x405f2a[_0x3d66('0x49')]);return _0x13059e[_0x3d66('0x97')](_0x4bf402);}})['then'](function(_0x360266){if(_0x360266){_0x1412e0=_0x360266[_0x3d66('0x41')];if(!_0x405f2a['query']['hasOwnProperty'](_0x3d66('0x43'))){_0x4bf402[_0x3d66('0x1f')]=qs['limit'](_0x405f2a[_0x3d66('0x3c')][_0x3d66('0x1f')]);_0x4bf402['offset']=qs['offset'](_0x405f2a[_0x3d66('0x3c')]['offset']);}return _0x13059e['getMembers'](_0x4bf402);}})['then'](function(_0x3c1a0a){return _0x3c1a0a?{'count':_0x1412e0,'rows':_0x3c1a0a}:null;})[_0x3d66('0x26')](respondWithResult(_0x220458,null))[_0x3d66('0x4d')](handleError(_0x220458,null));};exports[_0x3d66('0x98')]=function(_0x50243b,_0x12119c,_0xcf5b73){var _0xae8a14={};var _0x116f0b={};var _0xaa1817;var _0x1a58bd;return db[_0x3d66('0x39')][_0x3d66('0x60')]({'where':{'id':_0x50243b[_0x3d66('0x5d')]['id']}})['then'](handleEntityNotFound(_0x12119c,null))[_0x3d66('0x26')](function(_0x395e3f){if(_0x395e3f){_0xaa1817=_0x395e3f;_0x116f0b[_0x3d66('0x3b')]=_[_0x3d66('0x3d')](db['CmList'][_0x3d66('0x3a')]);_0x116f0b[_0x3d66('0x3c')]=_[_0x3d66('0x3d')](_0x50243b[_0x3d66('0x3c')]);_0x116f0b[_0x3d66('0x3e')]=_[_0x3d66('0x3f')](_0x116f0b[_0x3d66('0x3b')],_0x116f0b[_0x3d66('0x3c')]);_0xae8a14[_0x3d66('0x40')]=_[_0x3d66('0x3f')](_0x116f0b[_0x3d66('0x3b')],qs['fields'](_0x50243b[_0x3d66('0x3c')][_0x3d66('0x4f')]));_0xae8a14[_0x3d66('0x40')]=_0xae8a14[_0x3d66('0x40')][_0x3d66('0x41')]?_0xae8a14[_0x3d66('0x40')]:_0x116f0b[_0x3d66('0x3b')];_0xae8a14[_0x3d66('0x44')]=qs[_0x3d66('0x45')](_0x50243b['query'][_0x3d66('0x45')]);_0xae8a14[_0x3d66('0x46')]=qs[_0x3d66('0x3e')](_[_0x3d66('0x47')](_0x50243b[_0x3d66('0x3c')],_0x116f0b['filters']));if(_0x50243b[_0x3d66('0x3c')]['filter']){_0xae8a14[_0x3d66('0x46')]=_[_0x3d66('0x48')](_0xae8a14['where'],{'$or':_[_0x3d66('0x2d')](_0xae8a14['attributes'],function(_0x4ec5a8){var _0x4cc785={};_0x4cc785[_0x4ec5a8]={'$like':'%'+_0x50243b['query'][_0x3d66('0x2c')]+'%'};return _0x4cc785;})});}_0xae8a14=_[_0x3d66('0x48')]({},_0xae8a14,_0x50243b[_0x3d66('0x49')]);return _0xaa1817['getLists'](_0xae8a14);}})[_0x3d66('0x26')](function(_0xfa9d30){if(_0xfa9d30){_0x1a58bd=_0xfa9d30[_0x3d66('0x41')];if(!_0x50243b[_0x3d66('0x3c')][_0x3d66('0x42')](_0x3d66('0x43'))){_0xae8a14[_0x3d66('0x1f')]=qs[_0x3d66('0x1f')](_0x50243b[_0x3d66('0x3c')][_0x3d66('0x1f')]);_0xae8a14[_0x3d66('0x1d')]=qs['offset'](_0x50243b[_0x3d66('0x3c')][_0x3d66('0x1d')]);}return _0xaa1817['getLists'](_0xae8a14);}})[_0x3d66('0x26')](function(_0x1b024b){if(_0x1b024b){return _0x1b024b?{'count':_0x1a58bd,'rows':_0x1b024b}:null;}})[_0x3d66('0x26')](respondWithResult(_0x12119c,null))[_0x3d66('0x4d')](handleError(_0x12119c,null));};exports[_0x3d66('0x99')]=function(_0x2aa8e7,_0x428bdc,_0x7fbd19){var _0x19b97d=moment()[_0x3d66('0x7a')](_0x3d66('0x9a'));var _0x18caf8,_0x5b7782;return db[_0x3d66('0x39')][_0x3d66('0x31')]({'where':{'id':_0x2aa8e7[_0x3d66('0x5d')]['id']}})['then'](handleEntityNotFound(_0x428bdc,null))[_0x3d66('0x26')](function(_0x3daff3){if(_0x3daff3){_0x5b7782=_0x3daff3;return _0x3daff3['addLists'](_0x2aa8e7['body']['ids'],_[_0x3d66('0x59')](_0x2aa8e7[_0x3d66('0x5a')],[_0x3d66('0x80'),'id'])||{});}return null;})[_0x3d66('0x92')](function(_0x26b86c){var _0x11bd08;_0x18caf8=_0x26b86c||[];var _0x198239=[];if(_0x26b86c){for(var _0x3d7037=0x0;_0x3d7037<_0x26b86c[_0x3d66('0x41')];_0x3d7037+=0x1){var _0x29a524=_0x26b86c[_0x3d7037][_0x3d66('0x27')]({'plain':!![]});_0x5b7782[_0x3d66('0x9b')]=_0x2aa8e7[_0x3d66('0x5a')]['dialCheckDuplicateType']?_0x2aa8e7[_0x3d66('0x5a')]['dialCheckDuplicateType']:_0x5b7782['dialCheckDuplicateType'];switch(_0x5b7782[_0x3d66('0x9b')]){case _0x3d66('0x9c'):_0x11bd08=squel['insert']()['into']('cm_hopper')['fromQuery'](['phone',_0x3d66('0x9d'),_0x3d66('0x9e'),_0x3d66('0x9f'),_0x3d66('0x62'),_0x3d66('0x5b'),_0x3d66('0x5c')],squel['select']()[_0x3d66('0xa0')](_0x3d66('0xa1'),_0x3d66('0xa1'))[_0x3d66('0xa0')]('\x27'+_0x19b97d+'\x27',_0x3d66('0x9d'))[_0x3d66('0xa0')]('id','ContactId')[_0x3d66('0xa0')](_0x29a524[_0x3d66('0xa2')][_0x3d66('0xa3')](),_0x3d66('0x9f'))[_0x3d66('0xa0')](_0x2aa8e7[_0x3d66('0x5d')]['id']['toString'](),_0x3d66('0x62'))['field']('\x27'+_0x19b97d+'\x27',_0x3d66('0x5b'))[_0x3d66('0xa0')]('\x27'+_0x19b97d+'\x27',_0x3d66('0x5c'))[_0x3d66('0x83')](_0x3d66('0xa4'))[_0x3d66('0x46')]('deletedAt\x20IS\x20NULL')[_0x3d66('0x46')](_0x3d66('0xa5'),_0x29a524['CmListId'][_0x3d66('0xa3')]())[_0x3d66('0x46')](_0x3d66('0xa6'))[_0x3d66('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3d66('0x81')]()['field'](_0x3d66('0xa7'))[_0x3d66('0x83')]('cm_hopper_final')[_0x3d66('0x46')](_0x3d66('0xa8'),_0x2aa8e7[_0x3d66('0x5d')]['id']['toString']()))[_0x3d66('0x46')](_0x3d66('0xa9'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x3d66('0x83')](_0x3d66('0xaa'))[_0x3d66('0x46')](_0x3d66('0xa8'),_0x2aa8e7['params']['id']['toString']())))['toString']();break;case _0x3d66('0xab'):_0x11bd08=squel[_0x3d66('0xac')]()[_0x3d66('0xad')](_0x3d66('0xaa'))[_0x3d66('0xae')](['phone',_0x3d66('0x9d'),'ContactId',_0x3d66('0x9f'),_0x3d66('0x62'),'createdAt',_0x3d66('0x5c')],squel[_0x3d66('0x81')]()[_0x3d66('0xa0')]('phone','phone')[_0x3d66('0xa0')]('\x27'+_0x19b97d+'\x27','scheduledAt')[_0x3d66('0xa0')]('id',_0x3d66('0x9e'))['field'](_0x29a524['CmListId'][_0x3d66('0xa3')](),_0x3d66('0x9f'))['field'](_0x2aa8e7[_0x3d66('0x5d')]['id'][_0x3d66('0xa3')](),_0x3d66('0x62'))[_0x3d66('0xa0')]('\x27'+_0x19b97d+'\x27',_0x3d66('0x5b'))[_0x3d66('0xa0')]('\x27'+_0x19b97d+'\x27',_0x3d66('0x5c'))[_0x3d66('0x83')]('cm_contacts')[_0x3d66('0x46')](_0x3d66('0xaf'))['where']('ListId\x20=\x20?',_0x29a524[_0x3d66('0xa2')][_0x3d66('0xa3')]())['where'](_0x3d66('0xa6'))[_0x3d66('0x46')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3d66('0xa0')](_0x3d66('0xb0'))[_0x3d66('0x83')](_0x3d66('0xaa'))['where'](_0x3d66('0xa8'),_0x2aa8e7[_0x3d66('0x5d')]['id'][_0x3d66('0xa3')]())))[_0x3d66('0xa3')]();break;default:_0x11bd08=squel[_0x3d66('0xac')]()['into'](_0x3d66('0xaa'))[_0x3d66('0xae')]([_0x3d66('0xa1'),_0x3d66('0x9d'),_0x3d66('0x9e'),'ListId','VoiceQueueId',_0x3d66('0x5b'),_0x3d66('0x5c')],squel[_0x3d66('0x81')]()[_0x3d66('0xa0')](_0x3d66('0xa1'),'phone')['field']('\x27'+_0x19b97d+'\x27',_0x3d66('0x9d'))[_0x3d66('0xa0')]('id',_0x3d66('0x9e'))[_0x3d66('0xa0')](_0x29a524[_0x3d66('0xa2')][_0x3d66('0xa3')](),_0x3d66('0x9f'))[_0x3d66('0xa0')](_0x2aa8e7[_0x3d66('0x5d')]['id'][_0x3d66('0xa3')](),_0x3d66('0x62'))[_0x3d66('0xa0')]('\x27'+_0x19b97d+'\x27','createdAt')['field']('\x27'+_0x19b97d+'\x27',_0x3d66('0x5c'))['from'](_0x3d66('0xa4'))[_0x3d66('0x46')](_0x3d66('0xaf'))[_0x3d66('0x46')](_0x3d66('0xa5'),_0x29a524[_0x3d66('0xa2')][_0x3d66('0xa3')]())[_0x3d66('0x46')](_0x3d66('0xa6')))[_0x3d66('0xa3')]();}_0x198239[_0x3d66('0x8a')](db[_0x3d66('0x8b')][_0x3d66('0x3c')](_0x11bd08));}return BPromise['all'](_0x198239);}})[_0x3d66('0x26')](function(){var _0x4e84b6=[];var _0x24cb6b=squel['insert']()[_0x3d66('0xad')](_0x3d66('0xb1'))[_0x3d66('0xae')]([_0x3d66('0xb2'),'phone',_0x3d66('0xb3'),'createdAt',_0x3d66('0x5c')],squel[_0x3d66('0x81')]()[_0x3d66('0xa0')]('h.id')[_0x3d66('0xa0')](_0x3d66('0xb4'))[_0x3d66('0xa0')]('ci.OrderBy+1')['field']('\x27'+_0x19b97d+'\x27',_0x3d66('0x5b'))[_0x3d66('0xa0')]('\x27'+_0x19b97d+'\x27',_0x3d66('0x5c'))[_0x3d66('0x83')]('cm_contact_has_items','ci')[_0x3d66('0x85')](_0x3d66('0xaa'),'h','h.ContactId=ci.CmContactId')['where'](_0x3d66('0xb5'),_0x19b97d)[_0x3d66('0x46')](_0x3d66('0xb6'),'PHONE'))['toString']();_0x4e84b6[_0x3d66('0x8a')](db[_0x3d66('0x8b')][_0x3d66('0x3c')](_0x24cb6b));return BPromise[_0x3d66('0x94')](_0x4e84b6);})[_0x3d66('0x26')](function(){return _0x18caf8;})[_0x3d66('0x26')](respondWithResult(_0x428bdc,null))[_0x3d66('0x4d')](handleError(_0x428bdc,null));};exports[_0x3d66('0xb7')]=function(_0x450b4b,_0x1f6163,_0x395421){return db[_0x3d66('0x39')][_0x3d66('0x31')]({'where':{'id':_0x450b4b['params']['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0x1f6163,null))[_0x3d66('0x26')](function(_0x4b46e8){if(_0x4b46e8){return _0x4b46e8[_0x3d66('0xb7')](_0x450b4b[_0x3d66('0x3c')][_0x3d66('0x80')]);}})[_0x3d66('0x26')](function(_0x4e7b8e){if(_0x4e7b8e){return db[_0x3d66('0x61')]['destroy']({'where':{'ListId':_0x450b4b[_0x3d66('0x3c')]['ids'],'VoiceQueueId':_0x450b4b[_0x3d66('0x5d')]['id']}})['then'](function(){return _0x4e7b8e;});}})['then'](respondWithStatusCode(_0x1f6163,null))[_0x3d66('0x4d')](handleError(_0x1f6163,null));};exports[_0x3d66('0xb8')]=function(_0x14276f,_0x3c1166,_0x526d51){var _0x38f346={};var _0x3d7dcd={};var _0x44cf70;var _0x3d57a6;return db['VoiceQueue'][_0x3d66('0x60')]({'where':{'id':_0x14276f[_0x3d66('0x5d')]['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0x3c1166,null))[_0x3d66('0x26')](function(_0x266457){if(_0x266457){_0x44cf70=_0x266457;_0x3d7dcd[_0x3d66('0x3b')]=_[_0x3d66('0x3d')](db[_0x3d66('0xb9')][_0x3d66('0x3a')]);_0x3d7dcd[_0x3d66('0x3c')]=_['keys'](_0x14276f['query']);_0x3d7dcd[_0x3d66('0x3e')]=_[_0x3d66('0x3f')](_0x3d7dcd[_0x3d66('0x3b')],_0x3d7dcd[_0x3d66('0x3c')]);_0x38f346[_0x3d66('0x40')]=_['intersection'](_0x3d7dcd['model'],qs[_0x3d66('0x4f')](_0x14276f[_0x3d66('0x3c')]['fields']));_0x38f346[_0x3d66('0x40')]=_0x38f346[_0x3d66('0x40')][_0x3d66('0x41')]?_0x38f346[_0x3d66('0x40')]:_0x3d7dcd['model'];_0x38f346[_0x3d66('0x44')]=qs[_0x3d66('0x45')](_0x14276f[_0x3d66('0x3c')][_0x3d66('0x45')]);_0x38f346[_0x3d66('0x46')]=qs[_0x3d66('0x3e')](_['pick'](_0x14276f['query'],_0x3d7dcd['filters']));if(_0x14276f[_0x3d66('0x3c')]['filter']){_0x38f346[_0x3d66('0x46')]=_['merge'](_0x38f346['where'],{'$or':_[_0x3d66('0x2d')](_0x38f346[_0x3d66('0x40')],function(_0x5b5d91){var _0x4afa6e={};_0x4afa6e[_0x5b5d91]={'$like':'%'+_0x14276f[_0x3d66('0x3c')]['filter']+'%'};return _0x4afa6e;})});}_0x38f346=_[_0x3d66('0x48')]({},_0x38f346,_0x14276f[_0x3d66('0x49')]);return _0x44cf70[_0x3d66('0xb8')](_0x38f346);}})['then'](function(_0x20ae7c){if(_0x20ae7c){_0x3d57a6=_0x20ae7c[_0x3d66('0x41')];if(!_0x14276f['query']['hasOwnProperty'](_0x3d66('0x43'))){_0x38f346[_0x3d66('0x1f')]=qs[_0x3d66('0x1f')](_0x14276f[_0x3d66('0x3c')][_0x3d66('0x1f')]);_0x38f346[_0x3d66('0x1d')]=qs['offset'](_0x14276f['query']['offset']);}return _0x44cf70['getBlackLists'](_0x38f346);}})['then'](function(_0x4b1862){if(_0x4b1862){return _0x4b1862?{'count':_0x3d57a6,'rows':_0x4b1862}:null;}})[_0x3d66('0x26')](respondWithResult(_0x3c1166,null))[_0x3d66('0x4d')](handleError(_0x3c1166,null));};exports['addBlackLists']=function(_0x1ed4d0,_0x1c778c,_0x19ec3a){var _0x525cda,_0x102c54;return db[_0x3d66('0x39')]['find']({'where':{'id':_0x1ed4d0['params']['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0x1c778c,null))['then'](function(_0x439421){if(_0x439421){_0x102c54=_0x439421;return _0x439421['addBlackLists'](_0x1ed4d0[_0x3d66('0x5a')][_0x3d66('0x80')],_[_0x3d66('0x59')](_0x1ed4d0[_0x3d66('0x5a')],[_0x3d66('0x80'),'id'])||{});}return null;})[_0x3d66('0x92')](function(_0x523321){var _0x11c078;_0x525cda=_0x523321||[];var _0x5309bd=[];if(_0x523321){for(var _0x1df470=0x0;_0x1df470<_0x523321['length'];_0x1df470+=0x1){var _0x4af147=_0x523321[_0x1df470][_0x3d66('0x27')]({'plain':!![]});_0x11c078=squel[_0x3d66('0xac')]()['into'](_0x3d66('0xba'))[_0x3d66('0xae')]([_0x3d66('0xa1'),_0x3d66('0x9e'),_0x3d66('0x9f'),_0x3d66('0x62'),_0x3d66('0x5b'),_0x3d66('0x5c')],squel[_0x3d66('0x81')]()['field']('phone',_0x3d66('0xa1'))[_0x3d66('0xa0')]('id',_0x3d66('0x9e'))[_0x3d66('0xa0')](_0x4af147[_0x3d66('0xa2')][_0x3d66('0xa3')](),_0x3d66('0x9f'))[_0x3d66('0xa0')](_0x1ed4d0['params']['id'][_0x3d66('0xa3')](),'VoiceQueueId')[_0x3d66('0xa0')]('NOW()',_0x3d66('0x5b'))[_0x3d66('0xa0')]('NOW()',_0x3d66('0x5c'))['from']('cm_contacts')[_0x3d66('0x46')](_0x3d66('0xaf'))[_0x3d66('0x46')](_0x3d66('0xa5'),_0x4af147[_0x3d66('0xa2')][_0x3d66('0xa3')]())[_0x3d66('0x46')](_0x3d66('0xa6')))[_0x3d66('0xa3')]();_0x5309bd[_0x3d66('0x8a')](db[_0x3d66('0x8b')][_0x3d66('0x3c')](_0x11c078));}return BPromise[_0x3d66('0x94')](_0x5309bd);}})['then'](function(){return _0x525cda;})[_0x3d66('0x26')](respondWithResult(_0x1c778c,null))[_0x3d66('0x4d')](handleError(_0x1c778c,null));};exports[_0x3d66('0xbb')]=function(_0x494e0d,_0x23a836,_0x23d849){return db[_0x3d66('0x39')]['find']({'where':{'id':_0x494e0d[_0x3d66('0x5d')]['id']}})[_0x3d66('0x26')](handleEntityNotFound(_0x23a836,null))[_0x3d66('0x26')](function(_0x3fde6f){if(_0x3fde6f){return _0x3fde6f['removeBlackLists'](_0x494e0d[_0x3d66('0x3c')]['ids']);}})['then'](function(_0x5e8ee6){if(_0x5e8ee6){return db[_0x3d66('0x68')][_0x3d66('0x5e')]({'where':{'ListId':_0x494e0d['query'][_0x3d66('0x80')],'VoiceQueueId':_0x494e0d[_0x3d66('0x5d')]['id']}})[_0x3d66('0x26')](function(){return _0x5e8ee6;});}})[_0x3d66('0x26')](respondWithStatusCode(_0x23a836,null))[_0x3d66('0x4d')](handleError(_0x23a836,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index bf49886..55bac2b 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 _0xc0af=['hasOwnProperty','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','remove'];(function(_0x5251f3,_0x326aaf){var _0x3bf489=function(_0x4925e5){while(--_0x4925e5){_0x5251f3['push'](_0x5251f3['shift']());}};_0x3bf489(++_0x326aaf);}(_0xc0af,0xcd));var _0xfc0a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc0af[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xfc0a('0x0'))['db'][_0xfc0a('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xfc0a('0x2')](0x0);var events={'afterCreate':_0xfc0a('0x3'),'afterUpdate':'update','afterDestroy':_0xfc0a('0x4')};function emitEvent(_0x36d5ab){return function(_0x2bae34,_0x274a95,_0x309889){VoiceQueueEvents['emit'](_0x36d5ab+':'+_0x2bae34['id'],_0x2bae34);VoiceQueueEvents['emit'](_0x36d5ab,_0x2bae34);_0x309889(null);};}for(var e in events){if(events[_0xfc0a('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xfc0a('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x4eaa=['save','update','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x4eaa,0x162));var _0xa4ea=function(_0x44dd8a,_0x24c385){_0x44dd8a=_0x44dd8a-0x0;var _0x4b7715=_0x4eaa[_0x44dd8a];return _0x4b7715;};'use strict';var EventEmitter=require(_0xa4ea('0x0'));var VoiceQueue=require(_0xa4ea('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa4ea('0x2')](0x0);var events={'afterCreate':_0xa4ea('0x3'),'afterUpdate':_0xa4ea('0x4'),'afterDestroy':'remove'};function emitEvent(_0x26744e){return function(_0x5548e1,_0x20750e,_0x49c6c4){VoiceQueueEvents[_0xa4ea('0x5')](_0x26744e+':'+_0x5548e1['id'],_0x5548e1);VoiceQueueEvents[_0xa4ea('0x5')](_0x26744e,_0x5548e1);_0x49c6c4(null);};}for(var e in events){if(events[_0xa4ea('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index c8cdd64..b537e32 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x40e466,_0x213d5d){var _0x5060a1=function(_0x1cf315){while(--_0x1cf315){_0x40e466['push'](_0x40e466['shift']());}};_0x5060a1(++_0x213d5d);}(_0xedd9,0xfc));var _0x9edd=function(_0x48d0e0,_0x106d7d){_0x48d0e0=_0x48d0e0-0x0;var _0x52f631=_0xedd9[_0x48d0e0];return _0x52f631;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x22eb76,_0x129358){var _0x5f0465=function(_0xe20fd7){while(--_0xe20fd7){_0x22eb76['push'](_0x22eb76['shift']());}};_0x5f0465(++_0x129358);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 3664a35..8ff0f25 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 _0x495e=['socket.io-emitter','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceQueue','findAll','options','raw','where','attributes','map','model','include','GetVoiceQueue','debug','stringify','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','localhost'];(function(_0x5d1533,_0x176ac8){var _0x36dff8=function(_0x490da7){while(--_0x490da7){_0x5d1533['push'](_0x5d1533['shift']());}};_0x36dff8(++_0x176ac8);}(_0x495e,0x124));var _0xe495=function(_0x54fc1f,_0x1703c2){_0x54fc1f=_0x54fc1f-0x0;var _0x53f699=_0x495e[_0x54fc1f];return _0x53f699;};'use strict';var _=require(_0xe495('0x0'));var util=require(_0xe495('0x1'));var moment=require(_0xe495('0x2'));var BPromise=require(_0xe495('0x3'));var rs=require(_0xe495('0x4'));var fs=require('fs');var Redis=require(_0xe495('0x5'));var db=require(_0xe495('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe495('0x7'))(_0xe495('0x8'));var config=require('../../config/environment');var jayson=require(_0xe495('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xe495('0xa')]=_['defaults'](config[_0xe495('0xa')],{'host':_0xe495('0xb'),'port':0x18eb});var socket=require(_0xe495('0xc'))(new Redis(config[_0xe495('0xa')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x32744c,_0x12a03c,_0x340276){return new BPromise(function(_0x2c255f,_0x263ed3){return client[_0xe495('0xd')](_0x32744c,_0x340276)[_0xe495('0xe')](function(_0x45e15c){logger[_0xe495('0xf')](_0xe495('0x10'),_0x12a03c,_0xe495('0x11'));logger['debug'](_0xe495('0x12'),_0x12a03c,_0xe495('0x11'),JSON['stringify'](_0x45e15c));if(_0x45e15c[_0xe495('0x13')]){if(_0x45e15c[_0xe495('0x13')][_0xe495('0x14')]===0x1f4){logger[_0xe495('0x13')](_0xe495('0x10'),_0x12a03c,_0x45e15c['error'][_0xe495('0x15')]);return _0x263ed3(_0x45e15c[_0xe495('0x13')][_0xe495('0x15')]);}logger['error'](_0xe495('0x10'),_0x12a03c,_0x45e15c['error'][_0xe495('0x15')]);return _0x2c255f(_0x45e15c['error']['message']);}else{logger[_0xe495('0xf')](_0xe495('0x10'),_0x12a03c,_0xe495('0x11'));_0x2c255f(_0x45e15c[_0xe495('0x16')][_0xe495('0x15')]);}})[_0xe495('0x17')](function(_0x5d942e){logger[_0xe495('0x13')](_0xe495('0x10'),_0x12a03c,_0x5d942e);_0x263ed3(_0x5d942e);});});}exports['GetVoiceQueue']=function(_0x59095a){var _0x8b04eb=this;return new Promise(function(_0x4155fe,_0x385405){return db[_0xe495('0x18')][_0xe495('0x19')]({'raw':_0x59095a[_0xe495('0x1a')]?_0x59095a['options'][_0xe495('0x1b')]===undefined?!![]:![]:!![],'where':_0x59095a[_0xe495('0x1a')]?_0x59095a['options'][_0xe495('0x1c')]||null:null,'attributes':_0x59095a[_0xe495('0x1a')]?_0x59095a[_0xe495('0x1a')][_0xe495('0x1d')]||null:null,'limit':_0x59095a[_0xe495('0x1a')]?_0x59095a['options']['limit']||null:null,'include':_0x59095a[_0xe495('0x1a')]?_0x59095a[_0xe495('0x1a')]['include']?_[_0xe495('0x1e')](_0x59095a[_0xe495('0x1a')]['include'],function(_0x56187a){return{'model':db[_0x56187a[_0xe495('0x1f')]],'as':_0x56187a['as'],'attributes':_0x56187a[_0xe495('0x1d')],'include':_0x56187a[_0xe495('0x20')]?_[_0xe495('0x1e')](_0x56187a['include'],function(_0x33d3ae){return{'model':db[_0x33d3ae[_0xe495('0x1f')]],'as':_0x33d3ae['as'],'attributes':_0x33d3ae[_0xe495('0x1d')],'include':_0x33d3ae[_0xe495('0x20')]?_['map'](_0x33d3ae[_0xe495('0x20')],function(_0x4b3364){return{'model':db[_0x4b3364['model']],'as':_0x4b3364['as'],'attributes':_0x4b3364['attributes']};}):[]};}):[]};}):[]:[]})[_0xe495('0xe')](function(_0x3f5409){logger[_0xe495('0xf')](_0xe495('0x21'),_0x59095a);logger[_0xe495('0x22')](_0xe495('0x21'),_0x59095a,JSON[_0xe495('0x23')](_0x3f5409));_0x4155fe(_0x3f5409);})['catch'](function(_0x400792){logger[_0xe495('0x13')]('GetVoiceQueue',_0x400792[_0xe495('0x15')],_0x59095a);_0x385405(_0x8b04eb[_0xe495('0x13')](0x1f4,_0x400792[_0xe495('0x15')]));});});};exports[_0xe495('0x24')]=function(_0x22128d){var _0x4d961a=this;return new Promise(function(_0x54f061,_0x4af89a){return db[_0xe495('0x18')][_0xe495('0x25')]({'raw':_0x22128d[_0xe495('0x1a')]?_0x22128d[_0xe495('0x1a')][_0xe495('0x1b')]===undefined?!![]:![]:!![],'where':_0x22128d[_0xe495('0x1a')]?_0x22128d[_0xe495('0x1a')][_0xe495('0x1c')]||null:null,'attributes':_0x22128d[_0xe495('0x1a')]?_0x22128d[_0xe495('0x1a')][_0xe495('0x1d')]||null:null,'include':_0x22128d[_0xe495('0x1a')]?_0x22128d[_0xe495('0x1a')][_0xe495('0x20')]?_[_0xe495('0x1e')](_0x22128d[_0xe495('0x1a')][_0xe495('0x20')],function(_0x4c5413){return{'model':db[_0x4c5413[_0xe495('0x1f')]],'as':_0x4c5413['as'],'attributes':_0x4c5413[_0xe495('0x1d')],'include':_0x4c5413[_0xe495('0x20')]?_[_0xe495('0x1e')](_0x4c5413['include'],function(_0x414d3b){return{'model':db[_0x414d3b[_0xe495('0x1f')]],'as':_0x414d3b['as'],'attributes':_0x414d3b['attributes'],'include':_0x414d3b['include']?_[_0xe495('0x1e')](_0x414d3b[_0xe495('0x20')],function(_0x31d602){return{'model':db[_0x31d602['model']],'as':_0x31d602['as'],'attributes':_0x31d602['attributes']};}):[]};}):[]};}):[]:[]})[_0xe495('0xe')](function(_0x5c8816){logger[_0xe495('0xf')](_0xe495('0x24'),_0x22128d);logger[_0xe495('0x22')]('ShowVoiceQueue',_0x22128d,JSON['stringify'](_0x5c8816));_0x54f061(_0x5c8816);})[_0xe495('0x17')](function(_0xc8c254){logger[_0xe495('0x13')]('ShowVoiceQueue',_0xc8c254['message'],_0x22128d);_0x4af89a(_0x4d961a['error'](0x1f4,_0xc8c254[_0xe495('0x15')]));});});}; \ No newline at end of file +var _0x797a=['request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','GetVoiceQueue','VoiceQueue','options','raw','attributes','limit','map','model','include','then','find','where','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x797a,0x105));var _0xa797=function(_0x5a06eb,_0x2ecccb){_0x5a06eb=_0x5a06eb-0x0;var _0x18c91b=_0x797a[_0x5a06eb];return _0x18c91b;};'use strict';var _=require(_0xa797('0x0'));var util=require(_0xa797('0x1'));var moment=require(_0xa797('0x2'));var BPromise=require(_0xa797('0x3'));var rs=require(_0xa797('0x4'));var fs=require('fs');var Redis=require(_0xa797('0x5'));var db=require(_0xa797('0x6'))['db'];var utils=require(_0xa797('0x7'));var logger=require(_0xa797('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa797('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xa797('0xa')]=_['defaults'](config[_0xa797('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2e7e58,_0x1e30da,_0x1be0dd){return new BPromise(function(_0x3baa90,_0x2e6e75){return client[_0xa797('0xb')](_0x2e7e58,_0x1be0dd)['then'](function(_0x58816c){logger[_0xa797('0xc')](_0xa797('0xd'),_0x1e30da,_0xa797('0xe'));logger[_0xa797('0xf')](_0xa797('0x10'),_0x1e30da,'request\x20sent',JSON[_0xa797('0x11')](_0x58816c));if(_0x58816c['error']){if(_0x58816c['error'][_0xa797('0x12')]===0x1f4){logger[_0xa797('0x13')](_0xa797('0xd'),_0x1e30da,_0x58816c[_0xa797('0x13')][_0xa797('0x14')]);return _0x2e6e75(_0x58816c['error']['message']);}logger[_0xa797('0x13')](_0xa797('0xd'),_0x1e30da,_0x58816c[_0xa797('0x13')][_0xa797('0x14')]);return _0x3baa90(_0x58816c[_0xa797('0x13')]['message']);}else{logger['info'](_0xa797('0xd'),_0x1e30da,_0xa797('0xe'));_0x3baa90(_0x58816c['result'][_0xa797('0x14')]);}})['catch'](function(_0x115996){logger[_0xa797('0x13')](_0xa797('0xd'),_0x1e30da,_0x115996);_0x2e6e75(_0x115996);});});}exports[_0xa797('0x15')]=function(_0x394650){var _0x51c957=this;return new Promise(function(_0x2ba4b1,_0x5638de){return db[_0xa797('0x16')]['findAll']({'raw':_0x394650[_0xa797('0x17')]?_0x394650[_0xa797('0x17')][_0xa797('0x18')]===undefined?!![]:![]:!![],'where':_0x394650[_0xa797('0x17')]?_0x394650[_0xa797('0x17')]['where']||null:null,'attributes':_0x394650[_0xa797('0x17')]?_0x394650[_0xa797('0x17')][_0xa797('0x19')]||null:null,'limit':_0x394650['options']?_0x394650[_0xa797('0x17')][_0xa797('0x1a')]||null:null,'include':_0x394650[_0xa797('0x17')]?_0x394650[_0xa797('0x17')]['include']?_[_0xa797('0x1b')](_0x394650[_0xa797('0x17')]['include'],function(_0x5950e1){return{'model':db[_0x5950e1[_0xa797('0x1c')]],'as':_0x5950e1['as'],'attributes':_0x5950e1['attributes'],'include':_0x5950e1[_0xa797('0x1d')]?_[_0xa797('0x1b')](_0x5950e1['include'],function(_0x77896){return{'model':db[_0x77896[_0xa797('0x1c')]],'as':_0x77896['as'],'attributes':_0x77896['attributes'],'include':_0x77896[_0xa797('0x1d')]?_[_0xa797('0x1b')](_0x77896[_0xa797('0x1d')],function(_0x5aebc6){return{'model':db[_0x5aebc6['model']],'as':_0x5aebc6['as'],'attributes':_0x5aebc6[_0xa797('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa797('0x1e')](function(_0x2291e6){logger[_0xa797('0xc')](_0xa797('0x15'),_0x394650);logger['debug'](_0xa797('0x15'),_0x394650,JSON['stringify'](_0x2291e6));_0x2ba4b1(_0x2291e6);})['catch'](function(_0x4f488b){logger[_0xa797('0x13')]('GetVoiceQueue',_0x4f488b[_0xa797('0x14')],_0x394650);_0x5638de(_0x51c957[_0xa797('0x13')](0x1f4,_0x4f488b[_0xa797('0x14')]));});});};exports['ShowVoiceQueue']=function(_0x277773){var _0x56196a=this;return new Promise(function(_0x285763,_0x5676ed){return db[_0xa797('0x16')][_0xa797('0x1f')]({'raw':_0x277773[_0xa797('0x17')]?_0x277773[_0xa797('0x17')][_0xa797('0x18')]===undefined?!![]:![]:!![],'where':_0x277773['options']?_0x277773[_0xa797('0x17')][_0xa797('0x20')]||null:null,'attributes':_0x277773[_0xa797('0x17')]?_0x277773[_0xa797('0x17')][_0xa797('0x19')]||null:null,'include':_0x277773[_0xa797('0x17')]?_0x277773['options'][_0xa797('0x1d')]?_['map'](_0x277773[_0xa797('0x17')]['include'],function(_0x3acfb0){return{'model':db[_0x3acfb0[_0xa797('0x1c')]],'as':_0x3acfb0['as'],'attributes':_0x3acfb0[_0xa797('0x19')],'include':_0x3acfb0[_0xa797('0x1d')]?_['map'](_0x3acfb0[_0xa797('0x1d')],function(_0x56ce35){return{'model':db[_0x56ce35[_0xa797('0x1c')]],'as':_0x56ce35['as'],'attributes':_0x56ce35[_0xa797('0x19')],'include':_0x56ce35[_0xa797('0x1d')]?_[_0xa797('0x1b')](_0x56ce35['include'],function(_0x29b001){return{'model':db[_0x29b001[_0xa797('0x1c')]],'as':_0x29b001['as'],'attributes':_0x29b001[_0xa797('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa797('0x1e')](function(_0x3dca28){logger[_0xa797('0xc')](_0xa797('0x21'),_0x277773);logger[_0xa797('0xf')](_0xa797('0x21'),_0x277773,JSON[_0xa797('0x11')](_0x3dca28));_0x285763(_0x3dca28);})['catch'](function(_0x39f32c){logger[_0xa797('0x13')](_0xa797('0x21'),_0x39f32c['message'],_0x277773);_0x5676ed(_0x56196a[_0xa797('0x13')](0x1f4,_0x39f32c[_0xa797('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 78c5fc1..8a17d5d 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 _0x7f08=['./voiceQueue.events','remove','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7f08,0x80));var _0x87f0=function(_0x42309d,_0x321285){_0x42309d=_0x42309d-0x0;var _0x594933=_0x7f08[_0x42309d];return _0x594933;};'use strict';var VoiceQueueEvents=require(_0x87f0('0x0'));var events=['save',_0x87f0('0x1'),_0x87f0('0x2')];function createListener(_0x558204,_0x198e78){return function(_0x47cb0c){_0x198e78[_0x87f0('0x3')](_0x558204,_0x47cb0c);};}function removeListener(_0x238fa1,_0x4ec6c9){return function(){VoiceQueueEvents[_0x87f0('0x4')](_0x238fa1,_0x4ec6c9);};}exports[_0x87f0('0x5')]=function(_0x53efde){for(var _0x1a1516=0x0,_0x33d03d=events[_0x87f0('0x6')];_0x1a1516<_0x33d03d;_0x1a1516++){var _0x5be8c2=events[_0x1a1516];var _0x464998=createListener(_0x87f0('0x7')+_0x5be8c2,_0x53efde);VoiceQueueEvents['on'](_0x5be8c2,_0x464998);}}; \ No newline at end of file +var _0x14cb=['emit','removeListener','length','./voiceQueue.events','save','remove','update'];(function(_0x29e5d1,_0x186116){var _0x54c1bc=function(_0x27b5e8){while(--_0x27b5e8){_0x29e5d1['push'](_0x29e5d1['shift']());}};_0x54c1bc(++_0x186116);}(_0x14cb,0x16f));var _0xb14c=function(_0x41fbd2,_0x33d5d7){_0x41fbd2=_0x41fbd2-0x0;var _0x528c5f=_0x14cb[_0x41fbd2];return _0x528c5f;};'use strict';var VoiceQueueEvents=require(_0xb14c('0x0'));var events=[_0xb14c('0x1'),_0xb14c('0x2'),_0xb14c('0x3')];function createListener(_0x3e189c,_0x4d44d4){return function(_0x4cacc5){_0x4d44d4[_0xb14c('0x4')](_0x3e189c,_0x4cacc5);};}function removeListener(_0x37f83a,_0x430ffc){return function(){VoiceQueueEvents[_0xb14c('0x5')](_0x37f83a,_0x430ffc);};}exports['register']=function(_0x1343fe){for(var _0x293692=0x0,_0x26fd21=events[_0xb14c('0x6')];_0x293692<_0x26fd21;_0x293692++){var _0x3e1bfb=events[_0x293692];var _0x4cbc70=createListener('voiceQueue:'+_0x3e1bfb,_0x1343fe);VoiceQueueEvents['on'](_0x3e1bfb,_0x4cbc70);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 214150b..7769cf0 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 _0xda74=['express','Router','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x2f8e5e,_0x1778e8){var _0x126d06=function(_0x135631){while(--_0x135631){_0x2f8e5e['push'](_0x2f8e5e['shift']());}};_0x126d06(++_0x1778e8);}(_0xda74,0xe3));var _0x4da7=function(_0x483df0,_0x57ce6a){_0x483df0=_0x483df0-0x0;var _0x463aa4=_0xda74[_0x483df0];return _0x463aa4;};'use strict';var multer=require(_0x4da7('0x0'));var util=require(_0x4da7('0x1'));var path=require('path');var timeout=require(_0x4da7('0x2'));var express=require(_0x4da7('0x3'));var router=express[_0x4da7('0x4')]();var fs_extra=require(_0x4da7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4da7('0x6'));var config=require('../../config/environment');var controller=require(_0x4da7('0x7'));router[_0x4da7('0x8')]('/',auth[_0x4da7('0x9')](),controller[_0x4da7('0xa')]);router['get'](_0x4da7('0xb'),auth[_0x4da7('0x9')](),controller[_0x4da7('0xc')]);router[_0x4da7('0x8')](_0x4da7('0xd'),auth[_0x4da7('0x9')](),controller[_0x4da7('0xe')]);router[_0x4da7('0x8')](_0x4da7('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x4da7('0x10')]('/',auth[_0x4da7('0x9')](),controller[_0x4da7('0x11')]);router[_0x4da7('0x12')](_0x4da7('0xf'),auth['isAuthenticated'](),controller[_0x4da7('0x13')]);router[_0x4da7('0x14')](_0x4da7('0xf'),auth[_0x4da7('0x9')](),controller[_0x4da7('0x15')]);module[_0x4da7('0x16')]=router; \ No newline at end of file +var _0x1b23=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getVoiceQueuesReport','/:id','show','post','create','put','delete','destroy','util'];(function(_0x44062b,_0x24d044){var _0x4b31bf=function(_0x20be7e){while(--_0x20be7e){_0x44062b['push'](_0x44062b['shift']());}};_0x4b31bf(++_0x24d044);}(_0x1b23,0xd0));var _0x31b2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1b23[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x31b2('0x0'));var path=require(_0x31b2('0x1'));var timeout=require(_0x31b2('0x2'));var express=require(_0x31b2('0x3'));var router=express[_0x31b2('0x4')]();var fs_extra=require(_0x31b2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x31b2('0x6'));var config=require(_0x31b2('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x31b2('0x8')]('/',auth[_0x31b2('0x9')](),controller[_0x31b2('0xa')]);router[_0x31b2('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x31b2('0x8')]('/index',auth[_0x31b2('0x9')](),controller[_0x31b2('0xb')]);router[_0x31b2('0x8')](_0x31b2('0xc'),auth['isAuthenticated'](),controller[_0x31b2('0xd')]);router[_0x31b2('0xe')]('/',auth['isAuthenticated'](),controller[_0x31b2('0xf')]);router[_0x31b2('0x10')]('/:id',auth[_0x31b2('0x9')](),controller['update']);router[_0x31b2('0x11')](_0x31b2('0xc'),auth[_0x31b2('0x9')](),controller[_0x31b2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index bdc68c4..7ebbcf2 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 _0x266f=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x2c7fbb,_0x9a7efb){var _0x4a8798=function(_0x3d1192){while(--_0x3d1192){_0x2c7fbb['push'](_0x2c7fbb['shift']());}};_0x4a8798(++_0x9a7efb);}(_0x266f,0x123));var _0xf266=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x266f[_0x4d21ff];return _0x22b554;};'use strict';var Sequelize=require(_0xf266('0x0'));var moment=require(_0xf266('0x1'));module['exports']={'type':{'type':Sequelize[_0xf266('0x2')]},'uniqueid':{'type':Sequelize[_0xf266('0x2')]},'calleridnum':{'type':Sequelize[_0xf266('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf266('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xf266('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xf266('0x3')],'set':function(_0x406834){var _0x4b17b2=moment(_0x406834);var _0x18e187=moment(this[_0xf266('0x4')](_0xf266('0x5')))[_0xf266('0x6')](_0xf266('0x7'));var _0x1f1a65=_0x4b17b2[_0xf266('0x8')](_0x18e187,_0xf266('0x9'));this[_0xf266('0xa')](_0xf266('0xb'),_0x406834);this['setDataValue'](_0xf266('0xc'),_0x1f1a65||null);}},'position':{'type':Sequelize[_0xf266('0xd')]},'count':{'type':Sequelize[_0xf266('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xf266('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xf266('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xf266('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xf266('0x2')],'comment':_0xf266('0xf')},'originalposition':{'type':Sequelize[_0xf266('0xd')]},'channel':{'type':Sequelize[_0xf266('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf266('0x2')]},'connectedlinename':{'type':Sequelize[_0xf266('0x2')]},'accountcode':{'type':Sequelize[_0xf266('0x2')]},'context':{'type':Sequelize[_0xf266('0x2')]},'exten':{'type':Sequelize[_0xf266('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xf266('0xd')]},'mohtime':{'type':Sequelize[_0xf266('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf266('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf266('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xf266('0x10')},'transferexten':{'type':Sequelize[_0xf266('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf266('0x2')]},'disposition':{'type':Sequelize[_0xf266('0x2')]},'secondDisposition':{'type':Sequelize[_0xf266('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf266('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xf266('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0xf266('0x2')]}}; \ No newline at end of file +var _0x7fbe=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime'];(function(_0x187609,_0x388909){var _0x106c65=function(_0x2d6d3d){while(--_0x2d6d3d){_0x187609['push'](_0x187609['shift']());}};_0x106c65(++_0x388909);}(_0x7fbe,0x65));var _0xe7fb=function(_0xbda849,_0x2dcb1a){_0xbda849=_0xbda849-0x0;var _0x2d3e9d=_0x7fbe[_0xbda849];return _0x2d3e9d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe7fb('0x0'));module['exports']={'type':{'type':Sequelize[_0xe7fb('0x1')]},'uniqueid':{'type':Sequelize[_0xe7fb('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe7fb('0x1')]},'queue':{'type':Sequelize[_0xe7fb('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xe7fb('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xe7fb('0x2')],'set':function(_0x330fde){var _0x4a1d9e=moment(_0x330fde);var _0x4ae82f=moment(this[_0xe7fb('0x3')](_0xe7fb('0x4')))[_0xe7fb('0x5')](_0xe7fb('0x6'));var _0xd9959=_0x4a1d9e[_0xe7fb('0x7')](_0x4ae82f,_0xe7fb('0x8'));this[_0xe7fb('0x9')]('queuecallerleaveAt',_0x330fde);this['setDataValue'](_0xe7fb('0xa'),_0xd9959||null);}},'position':{'type':Sequelize[_0xe7fb('0xb')]},'count':{'type':Sequelize[_0xe7fb('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xe7fb('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xe7fb('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xe7fb('0x2')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xe7fb('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xe7fb('0xb')]},'channel':{'type':Sequelize[_0xe7fb('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe7fb('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe7fb('0x1')]},'context':{'type':Sequelize[_0xe7fb('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe7fb('0x1')]},'holdtime':{'type':Sequelize[_0xe7fb('0xb')]},'mohtime':{'type':Sequelize[_0xe7fb('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe7fb('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe7fb('0x1')],'comment':_0xe7fb('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xe7fb('0x1')]},'secondDisposition':{'type':Sequelize[_0xe7fb('0x1')]},'thirdDisposition':{'type':Sequelize[_0xe7fb('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0xe7fb('0xb')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 5197bbd..7ccbd57 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 _0x2276=['status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','rawAttributes','fieldName','type','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','sort','pick','filter','where','map','VIRTUAL','merge','options','VoiceQueueReport','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus'];(function(_0x4e35d2,_0x516864){var _0x384964=function(_0x53012b){while(--_0x53012b){_0x4e35d2['push'](_0x4e35d2['shift']());}};_0x384964(++_0x516864);}(_0x2276,0x8c));var _0x6227=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x2276[_0x1cb18a];return _0x22442e;};'use strict';var emlformat=require(_0x6227('0x0'));var rimraf=require(_0x6227('0x1'));var zipdir=require(_0x6227('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6227('0x3'));var moment=require('moment');var BPromise=require(_0x6227('0x4'));var Mustache=require('mustache');var util=require(_0x6227('0x5'));var path=require(_0x6227('0x6'));var sox=require(_0x6227('0x7'));var csv=require(_0x6227('0x8'));var ejs=require(_0x6227('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6227('0xa'));var squel=require(_0x6227('0xb'));var crypto=require(_0x6227('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6227('0xd'));var toCsv=require(_0x6227('0x8'));var querystring=require(_0x6227('0xe'));var Papa=require(_0x6227('0xf'));var Redis=require(_0x6227('0x10'));var authService=require(_0x6227('0x11'));var qs=require(_0x6227('0x12'));var as=require(_0x6227('0x13'));var hardwareService=require(_0x6227('0x14'));var logger=require(_0x6227('0x15'))(_0x6227('0x16'));var utils=require(_0x6227('0x17'));var config=require(_0x6227('0x18'));var licenseUtil=require(_0x6227('0x19'));var db=require(_0x6227('0x1a'))['db'];config['redis']=_[_0x6227('0x1b')](config[_0x6227('0x1c')],{'host':_0x6227('0x1d'),'port':0x18eb});var socket=require(_0x6227('0x1e'))(new Redis(config['redis']));require(_0x6227('0x1f'))[_0x6227('0x20')](socket);function respondWithStatusCode(_0x1a56a,_0x145d91){_0x145d91=_0x145d91||0xcc;return function(_0x78b6a8){if(_0x78b6a8){return _0x1a56a[_0x6227('0x21')](_0x145d91);}return _0x1a56a['status'](_0x145d91)['end']();};}function respondWithResult(_0x2431c6,_0x32e490){_0x32e490=_0x32e490||0xc8;return function(_0x33c02c){if(_0x33c02c){return _0x2431c6[_0x6227('0x22')](_0x32e490)[_0x6227('0x23')](_0x33c02c);}};}function respondWithFilteredResult(_0x2e8ef8,_0x3a1677){return function(_0x3755d0){if(_0x3755d0){var _0x287867=typeof _0x3a1677[_0x6227('0x24')]==='undefined'&&typeof _0x3a1677[_0x6227('0x25')]===_0x6227('0x26');var _0x1ba44b=_0x3755d0['count'];var _0x20f8bd=_0x287867?0x0:_0x3a1677[_0x6227('0x24')];var _0x6e58b4=_0x287867?_0x3755d0[_0x6227('0x27')]:_0x3a1677['offset']+_0x3a1677['limit'];var _0x749d9d;if(_0x6e58b4>=_0x1ba44b){_0x6e58b4=_0x1ba44b;_0x749d9d=0xc8;}else{_0x749d9d=0xce;}_0x2e8ef8['status'](_0x749d9d);return _0x2e8ef8[_0x6227('0x28')](_0x6227('0x29'),_0x20f8bd+'-'+_0x6e58b4+'/'+_0x1ba44b)[_0x6227('0x23')](_0x3755d0);}return null;};}function patchUpdates(_0x38ccee){return function(_0x579f91){try{jsonpatch[_0x6227('0x2a')](_0x579f91,_0x38ccee,!![]);}catch(_0xa19a4){return BPromise[_0x6227('0x2b')](_0xa19a4);}return _0x579f91[_0x6227('0x2c')]();};}function saveUpdates(_0x1efea8,_0x3b19d8){return function(_0x4733f7){if(_0x4733f7){return _0x4733f7[_0x6227('0x2d')](_0x1efea8)[_0x6227('0x2e')](function(_0x39495f){return _0x39495f;});}return null;};}function removeEntity(_0x1874d5,_0x11f5cd){return function(_0x347fa5){if(_0x347fa5){return _0x347fa5[_0x6227('0x2f')]()[_0x6227('0x2e')](function(){_0x1874d5['status'](0xcc)[_0x6227('0x30')]();});}};}function handleEntityNotFound(_0x281ad9,_0x8adf2){return function(_0x32e3a0){if(!_0x32e3a0){_0x281ad9['sendStatus'](0x194);}return _0x32e3a0;};}function handleError(_0x14559f,_0x3487b6){_0x3487b6=_0x3487b6||0x1f4;return function(_0x56eb62){logger[_0x6227('0x31')](_0x56eb62[_0x6227('0x32')]);if(_0x56eb62[_0x6227('0x33')]){delete _0x56eb62[_0x6227('0x33')];}_0x14559f['status'](_0x3487b6)[_0x6227('0x34')](_0x56eb62);};}exports['index']=function(_0x1b1364,_0x55c855){var _0x5bbf23={},_0x944260={},_0x246196={'count':0x0,'rows':[]};var _0x512315=_['map'](db['VoiceQueueReport'][_0x6227('0x35')],function(_0x247aac){return{'name':_0x247aac[_0x6227('0x36')],'type':_0x247aac[_0x6227('0x37')]['key']};});_0x944260['model']=_['map'](_0x512315,'name');_0x944260[_0x6227('0x38')]=_[_0x6227('0x39')](_0x1b1364[_0x6227('0x38')]);_0x944260[_0x6227('0x3a')]=_[_0x6227('0x3b')](_0x944260['model'],_0x944260['query']);_0x5bbf23['attributes']=_['intersection'](_0x944260['model'],qs[_0x6227('0x3c')](_0x1b1364['query'][_0x6227('0x3c')]));_0x5bbf23[_0x6227('0x3d')]=_0x5bbf23['attributes'][_0x6227('0x3e')]?_0x5bbf23['attributes']:_0x944260[_0x6227('0x3f')];if(!_0x1b1364[_0x6227('0x38')][_0x6227('0x40')](_0x6227('0x41'))){_0x5bbf23[_0x6227('0x25')]=qs[_0x6227('0x25')](_0x1b1364[_0x6227('0x38')]['limit']);_0x5bbf23['offset']=qs[_0x6227('0x24')](_0x1b1364[_0x6227('0x38')][_0x6227('0x24')]);}_0x5bbf23['order']=qs[_0x6227('0x42')](_0x1b1364['query'][_0x6227('0x42')]);_0x5bbf23['where']=qs['filters'](_[_0x6227('0x43')](_0x1b1364[_0x6227('0x38')],_0x944260[_0x6227('0x3a')]),_0x512315);if(_0x1b1364[_0x6227('0x38')][_0x6227('0x44')]){_0x5bbf23[_0x6227('0x45')]=_['merge'](_0x5bbf23[_0x6227('0x45')],{'$or':_[_0x6227('0x46')](_0x512315,function(_0x2e8fdf){if(_0x2e8fdf[_0x6227('0x37')]!==_0x6227('0x47')){var _0x441e05={};_0x441e05[_0x2e8fdf[_0x6227('0x33')]]={'$like':'%'+_0x1b1364[_0x6227('0x38')][_0x6227('0x44')]+'%'};return _0x441e05;}})});}_0x5bbf23=_[_0x6227('0x48')]({},_0x5bbf23,_0x1b1364[_0x6227('0x49')]);var _0x351d4e={'where':_0x5bbf23[_0x6227('0x45')]};return db[_0x6227('0x4a')][_0x6227('0x27')](_0x351d4e)[_0x6227('0x2e')](function(_0x847079){_0x246196[_0x6227('0x27')]=_0x847079;if(_0x1b1364['query']['includeAll']){_0x5bbf23['include']=[{'all':!![]}];}return db[_0x6227('0x4a')][_0x6227('0x4b')](_0x5bbf23);})['then'](function(_0x22ffe0){_0x246196[_0x6227('0x4c')]=_0x22ffe0;return _0x246196;})[_0x6227('0x2e')](respondWithFilteredResult(_0x55c855,_0x5bbf23))[_0x6227('0x4d')](handleError(_0x55c855,null));};exports[_0x6227('0x4e')]=function(_0x27a712,_0x45f0c4){var _0x3a1e40={'raw':![],'where':{'id':_0x27a712[_0x6227('0x4f')]['id']}},_0x2eec8c={};_0x2eec8c['model']=_['keys'](db[_0x6227('0x4a')][_0x6227('0x35')]);_0x2eec8c['query']=_[_0x6227('0x39')](_0x27a712[_0x6227('0x38')]);_0x2eec8c[_0x6227('0x3a')]=_[_0x6227('0x3b')](_0x2eec8c[_0x6227('0x3f')],_0x2eec8c[_0x6227('0x38')]);_0x3a1e40[_0x6227('0x3d')]=_[_0x6227('0x3b')](_0x2eec8c[_0x6227('0x3f')],qs[_0x6227('0x3c')](_0x27a712['query']['fields']));_0x3a1e40[_0x6227('0x3d')]=_0x3a1e40[_0x6227('0x3d')][_0x6227('0x3e')]?_0x3a1e40['attributes']:_0x2eec8c[_0x6227('0x3f')];if(_0x27a712[_0x6227('0x38')][_0x6227('0x50')]){_0x3a1e40[_0x6227('0x51')]=[{'all':!![]}];}_0x3a1e40=_['merge']({},_0x3a1e40,_0x27a712[_0x6227('0x49')]);return db[_0x6227('0x4a')][_0x6227('0x52')](_0x3a1e40)[_0x6227('0x2e')](handleEntityNotFound(_0x45f0c4,null))[_0x6227('0x2e')](respondWithResult(_0x45f0c4,null))['catch'](handleError(_0x45f0c4,null));};exports['create']=function(_0x1118bb,_0x178bba){return db['VoiceQueueReport'][_0x6227('0x53')](_0x1118bb[_0x6227('0x54')],{})[_0x6227('0x2e')](respondWithResult(_0x178bba,0xc9))[_0x6227('0x4d')](handleError(_0x178bba,null));};exports[_0x6227('0x2d')]=function(_0x27c34e,_0x1b27e8){if(_0x27c34e[_0x6227('0x54')]['id']){delete _0x27c34e[_0x6227('0x54')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x27c34e['params']['id']}})[_0x6227('0x2e')](handleEntityNotFound(_0x1b27e8,null))['then'](saveUpdates(_0x27c34e['body'],null))[_0x6227('0x2e')](respondWithResult(_0x1b27e8,null))['catch'](handleError(_0x1b27e8,null));};exports[_0x6227('0x2f')]=function(_0x4ce28e,_0x152ba3){return db[_0x6227('0x4a')][_0x6227('0x52')]({'where':{'id':_0x4ce28e[_0x6227('0x4f')]['id']}})[_0x6227('0x2e')](handleEntityNotFound(_0x152ba3,null))['then'](removeEntity(_0x152ba3,null))[_0x6227('0x4d')](handleError(_0x152ba3,null));};exports[_0x6227('0x55')]=function(_0x178389,_0x37ec9e){return db[_0x6227('0x4a')][_0x6227('0x55')]()[_0x6227('0x2e')](respondWithResult(_0x37ec9e,null))[_0x6227('0x4d')](handleError(_0x37ec9e,null));};exports[_0x6227('0x56')]=function(_0x511de8,_0x22d479){var _0x3a94b4={},_0x75935e={},_0x4cbb55={'count':0x0,'rows':[]};_0x75935e[_0x6227('0x3f')]=_['keys'](db[_0x6227('0x4a')][_0x6227('0x35')]);_0x75935e[_0x6227('0x38')]=_[_0x6227('0x39')](_0x511de8['query']);_0x75935e[_0x6227('0x3a')]=_[_0x6227('0x3b')](_0x75935e[_0x6227('0x3f')],_0x75935e[_0x6227('0x38')]);_0x3a94b4['attributes']=_['intersection'](_0x75935e[_0x6227('0x3f')],qs[_0x6227('0x3c')](_0x511de8['query'][_0x6227('0x3c')]));_0x3a94b4[_0x6227('0x3d')]=_0x3a94b4[_0x6227('0x3d')][_0x6227('0x3e')]?_0x3a94b4[_0x6227('0x3d')]:_0x75935e[_0x6227('0x3f')];if(!_0x511de8[_0x6227('0x38')][_0x6227('0x40')](_0x6227('0x41'))){_0x3a94b4[_0x6227('0x25')]=qs[_0x6227('0x25')](_0x511de8[_0x6227('0x38')][_0x6227('0x25')]);_0x3a94b4[_0x6227('0x24')]=qs[_0x6227('0x24')](_0x511de8[_0x6227('0x38')][_0x6227('0x24')]);}_0x3a94b4['order']=qs[_0x6227('0x42')](_0x511de8[_0x6227('0x38')]['sort']);_0x3a94b4['where']=qs['filters'](_[_0x6227('0x43')](_0x511de8['query'],_0x75935e[_0x6227('0x3a')]));if(_0x511de8['query'][_0x6227('0x44')]){_0x3a94b4['where']=_[_0x6227('0x48')](_0x3a94b4[_0x6227('0x45')],{'$or':_[_0x6227('0x46')](_0x3a94b4[_0x6227('0x3d')],function(_0xbfffc7){var _0x3d2fbf={};_0x3d2fbf[_0xbfffc7]={'$like':'%'+_0x511de8[_0x6227('0x38')][_0x6227('0x44')]+'%'};return _0x3d2fbf;})});}_0x3a94b4=_['merge']({},_0x3a94b4,_0x511de8[_0x6227('0x49')]);var _0x2a527e={'where':_0x3a94b4[_0x6227('0x45')]};return db['VoiceQueueReport']['count'](_0x2a527e)[_0x6227('0x2e')](function(_0x45e96c){_0x4cbb55[_0x6227('0x27')]=_0x45e96c;if(_0x511de8[_0x6227('0x38')][_0x6227('0x50')]){_0x3a94b4[_0x6227('0x51')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6227('0x4b')](_0x3a94b4);})[_0x6227('0x2e')](function(_0x4adc5e){_0x4cbb55[_0x6227('0x4c')]=_0x4adc5e;return _0x4cbb55;})[_0x6227('0x2e')](respondWithFilteredResult(_0x22d479,_0x3a94b4,_0x6227('0x56')))[_0x6227('0x4d')](handleError(_0x22d479,null,_0x6227('0x56')));}; \ No newline at end of file +var _0x480d=['where','merge','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','describe','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x2dc19b,_0x45f51a){var _0x25c1b3=function(_0x47831f){while(--_0x47831f){_0x2dc19b['push'](_0x2dc19b['shift']());}};_0x25c1b3(++_0x45f51a);}(_0x480d,0x11b));var _0xd480=function(_0x24c97f,_0x218b33){_0x24c97f=_0x24c97f-0x0;var _0x506c31=_0x480d[_0x24c97f];return _0x506c31;};'use strict';var emlformat=require(_0xd480('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd480('0x1'));var jsonpatch=require(_0xd480('0x2'));var rp=require(_0xd480('0x3'));var moment=require('moment');var BPromise=require(_0xd480('0x4'));var Mustache=require(_0xd480('0x5'));var util=require(_0xd480('0x6'));var path=require(_0xd480('0x7'));var sox=require(_0xd480('0x8'));var csv=require(_0xd480('0x9'));var ejs=require(_0xd480('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd480('0xb'));var squel=require(_0xd480('0xc'));var crypto=require(_0xd480('0xd'));var jsforce=require(_0xd480('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd480('0x9'));var querystring=require(_0xd480('0xf'));var Papa=require(_0xd480('0x10'));var Redis=require(_0xd480('0x11'));var authService=require(_0xd480('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd480('0x13'));var logger=require(_0xd480('0x14'))(_0xd480('0x15'));var utils=require(_0xd480('0x16'));var config=require(_0xd480('0x17'));var licenseUtil=require(_0xd480('0x18'));var db=require(_0xd480('0x19'))['db'];config[_0xd480('0x1a')]=_[_0xd480('0x1b')](config['redis'],{'host':_0xd480('0x1c'),'port':0x18eb});var socket=require(_0xd480('0x1d'))(new Redis(config['redis']));require(_0xd480('0x1e'))[_0xd480('0x1f')](socket);function respondWithStatusCode(_0x4e39c9,_0x4f388c){_0x4f388c=_0x4f388c||0xcc;return function(_0x31f074){if(_0x31f074){return _0x4e39c9[_0xd480('0x20')](_0x4f388c);}return _0x4e39c9[_0xd480('0x21')](_0x4f388c)[_0xd480('0x22')]();};}function respondWithResult(_0x2d0479,_0x32fdec){_0x32fdec=_0x32fdec||0xc8;return function(_0x4e57c7){if(_0x4e57c7){return _0x2d0479[_0xd480('0x21')](_0x32fdec)[_0xd480('0x23')](_0x4e57c7);}};}function respondWithFilteredResult(_0x3f2a50,_0x22e399){return function(_0x3a01de){if(_0x3a01de){var _0x35f07e=typeof _0x22e399[_0xd480('0x24')]===_0xd480('0x25')&&typeof _0x22e399['limit']===_0xd480('0x25');var _0xd5e60=_0x3a01de[_0xd480('0x26')];var _0x51b469=_0x35f07e?0x0:_0x22e399['offset'];var _0x2bdc74=_0x35f07e?_0x3a01de[_0xd480('0x26')]:_0x22e399[_0xd480('0x24')]+_0x22e399[_0xd480('0x27')];var _0x5698e5;if(_0x2bdc74>=_0xd5e60){_0x2bdc74=_0xd5e60;_0x5698e5=0xc8;}else{_0x5698e5=0xce;}_0x3f2a50[_0xd480('0x21')](_0x5698e5);return _0x3f2a50[_0xd480('0x28')](_0xd480('0x29'),_0x51b469+'-'+_0x2bdc74+'/'+_0xd5e60)['json'](_0x3a01de);}return null;};}function patchUpdates(_0x750a50){return function(_0x313634){try{jsonpatch[_0xd480('0x2a')](_0x313634,_0x750a50,!![]);}catch(_0x43d737){return BPromise[_0xd480('0x2b')](_0x43d737);}return _0x313634[_0xd480('0x2c')]();};}function saveUpdates(_0x2963b9,_0x509d2d){return function(_0x5a6af7){if(_0x5a6af7){return _0x5a6af7[_0xd480('0x2d')](_0x2963b9)[_0xd480('0x2e')](function(_0x31c5b5){return _0x31c5b5;});}return null;};}function removeEntity(_0x1cc390,_0x56a8ae){return function(_0x2d80ce){if(_0x2d80ce){return _0x2d80ce[_0xd480('0x2f')]()[_0xd480('0x2e')](function(){_0x1cc390[_0xd480('0x21')](0xcc)[_0xd480('0x22')]();});}};}function handleEntityNotFound(_0x48eb63,_0x4d0b1c){return function(_0x2fd1d5){if(!_0x2fd1d5){_0x48eb63['sendStatus'](0x194);}return _0x2fd1d5;};}function handleError(_0x109fea,_0x28c7c1){_0x28c7c1=_0x28c7c1||0x1f4;return function(_0x1dcde8){logger[_0xd480('0x30')](_0x1dcde8[_0xd480('0x31')]);if(_0x1dcde8['name']){delete _0x1dcde8[_0xd480('0x32')];}_0x109fea['status'](_0x28c7c1)[_0xd480('0x33')](_0x1dcde8);};}exports['index']=function(_0x249376,_0x4a9249){var _0x4feadc={},_0x28a86f={},_0x1b9d7a={'count':0x0,'rows':[]};var _0x378fe4=_[_0xd480('0x34')](db['VoiceQueueReport']['rawAttributes'],function(_0x30cadc){return{'name':_0x30cadc[_0xd480('0x35')],'type':_0x30cadc[_0xd480('0x36')][_0xd480('0x37')]};});_0x28a86f[_0xd480('0x38')]=_['map'](_0x378fe4,_0xd480('0x32'));_0x28a86f['query']=_['keys'](_0x249376[_0xd480('0x39')]);_0x28a86f[_0xd480('0x3a')]=_[_0xd480('0x3b')](_0x28a86f[_0xd480('0x38')],_0x28a86f[_0xd480('0x39')]);_0x4feadc[_0xd480('0x3c')]=_['intersection'](_0x28a86f[_0xd480('0x38')],qs[_0xd480('0x3d')](_0x249376[_0xd480('0x39')][_0xd480('0x3d')]));_0x4feadc[_0xd480('0x3c')]=_0x4feadc[_0xd480('0x3c')][_0xd480('0x3e')]?_0x4feadc[_0xd480('0x3c')]:_0x28a86f['model'];if(!_0x249376[_0xd480('0x39')][_0xd480('0x3f')](_0xd480('0x40'))){_0x4feadc[_0xd480('0x27')]=qs[_0xd480('0x27')](_0x249376[_0xd480('0x39')]['limit']);_0x4feadc['offset']=qs[_0xd480('0x24')](_0x249376[_0xd480('0x39')][_0xd480('0x24')]);}_0x4feadc[_0xd480('0x41')]=qs[_0xd480('0x42')](_0x249376['query']['sort']);_0x4feadc['where']=qs[_0xd480('0x3a')](_[_0xd480('0x43')](_0x249376[_0xd480('0x39')],_0x28a86f['filters']),_0x378fe4);if(_0x249376[_0xd480('0x39')][_0xd480('0x44')]){_0x4feadc[_0xd480('0x45')]=_[_0xd480('0x46')](_0x4feadc[_0xd480('0x45')],{'$or':_[_0xd480('0x34')](_0x378fe4,function(_0x5b9fac){if(_0x5b9fac[_0xd480('0x36')]!==_0xd480('0x47')){var _0x2aa077={};_0x2aa077[_0x5b9fac[_0xd480('0x32')]]={'$like':'%'+_0x249376[_0xd480('0x39')][_0xd480('0x44')]+'%'};return _0x2aa077;}})});}_0x4feadc=_[_0xd480('0x46')]({},_0x4feadc,_0x249376['options']);var _0x47a0b9={'where':_0x4feadc[_0xd480('0x45')]};return db[_0xd480('0x48')][_0xd480('0x26')](_0x47a0b9)['then'](function(_0x3ff589){_0x1b9d7a['count']=_0x3ff589;if(_0x249376[_0xd480('0x39')][_0xd480('0x49')]){_0x4feadc[_0xd480('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xd480('0x4b')](_0x4feadc);})[_0xd480('0x2e')](function(_0x4ba292){_0x1b9d7a[_0xd480('0x4c')]=_0x4ba292;return _0x1b9d7a;})['then'](respondWithFilteredResult(_0x4a9249,_0x4feadc))[_0xd480('0x4d')](handleError(_0x4a9249,null));};exports[_0xd480('0x4e')]=function(_0x3cf06a,_0xc64851){var _0x4bdbeb={'raw':![],'where':{'id':_0x3cf06a[_0xd480('0x4f')]['id']}},_0x47ee47={};_0x47ee47[_0xd480('0x38')]=_[_0xd480('0x50')](db[_0xd480('0x48')][_0xd480('0x51')]);_0x47ee47[_0xd480('0x39')]=_['keys'](_0x3cf06a[_0xd480('0x39')]);_0x47ee47[_0xd480('0x3a')]=_[_0xd480('0x3b')](_0x47ee47[_0xd480('0x38')],_0x47ee47[_0xd480('0x39')]);_0x4bdbeb[_0xd480('0x3c')]=_['intersection'](_0x47ee47[_0xd480('0x38')],qs[_0xd480('0x3d')](_0x3cf06a[_0xd480('0x39')][_0xd480('0x3d')]));_0x4bdbeb['attributes']=_0x4bdbeb[_0xd480('0x3c')]['length']?_0x4bdbeb[_0xd480('0x3c')]:_0x47ee47[_0xd480('0x38')];if(_0x3cf06a[_0xd480('0x39')]['includeAll']){_0x4bdbeb[_0xd480('0x4a')]=[{'all':!![]}];}_0x4bdbeb=_['merge']({},_0x4bdbeb,_0x3cf06a[_0xd480('0x52')]);return db[_0xd480('0x48')][_0xd480('0x53')](_0x4bdbeb)['then'](handleEntityNotFound(_0xc64851,null))[_0xd480('0x2e')](respondWithResult(_0xc64851,null))['catch'](handleError(_0xc64851,null));};exports[_0xd480('0x54')]=function(_0x3637fa,_0x5e7293){return db['VoiceQueueReport'][_0xd480('0x54')](_0x3637fa[_0xd480('0x55')],{})[_0xd480('0x2e')](respondWithResult(_0x5e7293,0xc9))[_0xd480('0x4d')](handleError(_0x5e7293,null));};exports[_0xd480('0x2d')]=function(_0x33f95e,_0x587e21){if(_0x33f95e['body']['id']){delete _0x33f95e[_0xd480('0x55')]['id'];}return db[_0xd480('0x48')][_0xd480('0x53')]({'where':{'id':_0x33f95e[_0xd480('0x4f')]['id']}})[_0xd480('0x2e')](handleEntityNotFound(_0x587e21,null))[_0xd480('0x2e')](saveUpdates(_0x33f95e['body'],null))[_0xd480('0x2e')](respondWithResult(_0x587e21,null))[_0xd480('0x4d')](handleError(_0x587e21,null));};exports[_0xd480('0x2f')]=function(_0x1f3312,_0x2f0587){return db[_0xd480('0x48')][_0xd480('0x53')]({'where':{'id':_0x1f3312[_0xd480('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2f0587,null))[_0xd480('0x2e')](removeEntity(_0x2f0587,null))[_0xd480('0x4d')](handleError(_0x2f0587,null));};exports['describe']=function(_0x20e7c0,_0x261f31){return db['VoiceQueueReport'][_0xd480('0x56')]()[_0xd480('0x2e')](respondWithResult(_0x261f31,null))[_0xd480('0x4d')](handleError(_0x261f31,null));};exports['getVoiceQueuesReport']=function(_0x45a2e4,_0x105812){var _0x4a5792={},_0x393ed9={},_0x4b5960={'count':0x0,'rows':[]};_0x393ed9[_0xd480('0x38')]=_[_0xd480('0x50')](db[_0xd480('0x48')][_0xd480('0x51')]);_0x393ed9[_0xd480('0x39')]=_[_0xd480('0x50')](_0x45a2e4['query']);_0x393ed9[_0xd480('0x3a')]=_[_0xd480('0x3b')](_0x393ed9[_0xd480('0x38')],_0x393ed9[_0xd480('0x39')]);_0x4a5792[_0xd480('0x3c')]=_['intersection'](_0x393ed9['model'],qs[_0xd480('0x3d')](_0x45a2e4[_0xd480('0x39')][_0xd480('0x3d')]));_0x4a5792[_0xd480('0x3c')]=_0x4a5792[_0xd480('0x3c')][_0xd480('0x3e')]?_0x4a5792['attributes']:_0x393ed9['model'];if(!_0x45a2e4[_0xd480('0x39')][_0xd480('0x3f')](_0xd480('0x40'))){_0x4a5792[_0xd480('0x27')]=qs[_0xd480('0x27')](_0x45a2e4[_0xd480('0x39')][_0xd480('0x27')]);_0x4a5792['offset']=qs[_0xd480('0x24')](_0x45a2e4[_0xd480('0x39')][_0xd480('0x24')]);}_0x4a5792[_0xd480('0x41')]=qs['sort'](_0x45a2e4[_0xd480('0x39')][_0xd480('0x42')]);_0x4a5792[_0xd480('0x45')]=qs['filters'](_[_0xd480('0x43')](_0x45a2e4[_0xd480('0x39')],_0x393ed9[_0xd480('0x3a')]));if(_0x45a2e4[_0xd480('0x39')]['filter']){_0x4a5792[_0xd480('0x45')]=_[_0xd480('0x46')](_0x4a5792['where'],{'$or':_[_0xd480('0x34')](_0x4a5792[_0xd480('0x3c')],function(_0x1f53b0){var _0x3a8dde={};_0x3a8dde[_0x1f53b0]={'$like':'%'+_0x45a2e4[_0xd480('0x39')][_0xd480('0x44')]+'%'};return _0x3a8dde;})});}_0x4a5792=_[_0xd480('0x46')]({},_0x4a5792,_0x45a2e4[_0xd480('0x52')]);var _0x5e5c91={'where':_0x4a5792[_0xd480('0x45')]};return db['VoiceQueueReport']['count'](_0x5e5c91)[_0xd480('0x2e')](function(_0x59d556){_0x4b5960['count']=_0x59d556;if(_0x45a2e4['query'][_0xd480('0x49')]){_0x4a5792['include']=[{'all':!![]}];}return db[_0xd480('0x48')][_0xd480('0x4b')](_0x4a5792);})['then'](function(_0x30c29f){_0x4b5960[_0xd480('0x4c')]=_0x30c29f;return _0x4b5960;})[_0xd480('0x2e')](respondWithFilteredResult(_0x105812,_0x4a5792,_0xd480('0x57')))[_0xd480('0x4d')](handleError(_0x105812,null,_0xd480('0x57')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 19cb990..326b88d 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 _0x4ead=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport'];(function(_0xa4c18a,_0xbe111a){var _0x1aca47=function(_0x430ca4){while(--_0x430ca4){_0xa4c18a['push'](_0xa4c18a['shift']());}};_0x1aca47(++_0xbe111a);}(_0x4ead,0x10e));var _0xd4ea=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x4ead[_0x31ced5];return _0x10d9e5;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xd4ea('0x0'))['db'][_0xd4ea('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd4ea('0x2'),'afterUpdate':_0xd4ea('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1498fd){return function(_0x32956c,_0x425fc9,_0x2f8cc1){VoiceQueueReportEvents['emit'](_0x1498fd+':'+_0x32956c['id'],_0x32956c);VoiceQueueReportEvents[_0xd4ea('0x4')](_0x1498fd,_0x32956c);_0x2f8cc1(null);};}for(var e in events){if(events[_0xd4ea('0x5')](e)){var event=events[e];VoiceQueueReport[_0xd4ea('0x6')](e,emitEvent(event));}}module[_0xd4ea('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x10a2=['update','remove','emit','hook','exports','events','VoiceQueueReport','setMaxListeners','save'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0x10a2,0x12e));var _0x210a=function(_0x75010c,_0x35fc88){_0x75010c=_0x75010c-0x0;var _0x402fed=_0x10a2[_0x75010c];return _0x402fed;};'use strict';var EventEmitter=require(_0x210a('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x210a('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x210a('0x2')](0x0);var events={'afterCreate':_0x210a('0x3'),'afterUpdate':_0x210a('0x4'),'afterDestroy':_0x210a('0x5')};function emitEvent(_0x4c5172){return function(_0x214882,_0x3f72f3,_0x581c95){VoiceQueueReportEvents[_0x210a('0x6')](_0x4c5172+':'+_0x214882['id'],_0x214882);VoiceQueueReportEvents[_0x210a('0x6')](_0x4c5172,_0x214882);_0x581c95(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x210a('0x7')](e,emitEvent(event));}}module[_0x210a('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 61f72d2..992de06 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 _0x59ce=['report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x49f509,_0x5c7395){var _0x1250d2=function(_0x3d5cec){while(--_0x3d5cec){_0x49f509['push'](_0x49f509['shift']());}};_0x1250d2(++_0x5c7395);}(_0x59ce,0x92));var _0xe59c=function(_0x10579d,_0x4c1b54){_0x10579d=_0x10579d-0x0;var _0x2b0906=_0x59ce[_0x10579d];return _0x2b0906;};'use strict';var _=require(_0xe59c('0x0'));var util=require(_0xe59c('0x1'));var logger=require(_0xe59c('0x2'))('api');var moment=require(_0xe59c('0x3'));var BPromise=require(_0xe59c('0x4'));var rp=require(_0xe59c('0x5'));var fs=require('fs');var path=require(_0xe59c('0x6'));var rimraf=require(_0xe59c('0x7'));var config=require(_0xe59c('0x8'));var attributes=require(_0xe59c('0x9'));module['exports']=function(_0x387c49,_0x4ba903){return _0x387c49['define']('VoiceQueueReport',attributes,{'tableName':_0xe59c('0xa'),'paranoid':![],'indexes':[{'fields':[_0xe59c('0xb')]},{'fields':[_0xe59c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x24e6=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x24e6,0x17f));var _0x624e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x24e6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x624e('0x0'));var util=require(_0x624e('0x1'));var logger=require('../../config/logger')(_0x624e('0x2'));var moment=require(_0x624e('0x3'));var BPromise=require(_0x624e('0x4'));var rp=require(_0x624e('0x5'));var fs=require('fs');var path=require(_0x624e('0x6'));var rimraf=require(_0x624e('0x7'));var config=require(_0x624e('0x8'));var attributes=require(_0x624e('0x9'));module[_0x624e('0xa')]=function(_0x1bb6e9,_0xa3d666){return _0x1bb6e9[_0x624e('0xb')]('VoiceQueueReport',attributes,{'tableName':_0x624e('0xc'),'paranoid':![],'indexes':[{'fields':[_0x624e('0xd')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d2ca2a2..b194cf8 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 _0xb91c=['redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','debug','stringify','CreateVoiceQueueReport','create','raw','UpdateVoiceQueueReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3eff07,_0x1a872a){var _0x5a28aa=function(_0x3d832b){while(--_0x3d832b){_0x3eff07['push'](_0x3eff07['shift']());}};_0x5a28aa(++_0x1a872a);}(_0xb91c,0xfc));var _0xcb91=function(_0x2f45e8,_0x2df56f){_0x2f45e8=_0x2f45e8-0x0;var _0x2916a7=_0xb91c[_0x2f45e8];return _0x2916a7;};'use strict';var _=require(_0xcb91('0x0'));var util=require(_0xcb91('0x1'));var moment=require(_0xcb91('0x2'));var BPromise=require(_0xcb91('0x3'));var rs=require(_0xcb91('0x4'));var fs=require('fs');var Redis=require(_0xcb91('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb91('0x6'));var logger=require(_0xcb91('0x7'))(_0xcb91('0x8'));var config=require(_0xcb91('0x9'));var jayson=require(_0xcb91('0xa'));var client=jayson['client'][_0xcb91('0xb')]({'port':0x232a});config[_0xcb91('0xc')]=_['defaults'](config['redis'],{'host':_0xcb91('0xd'),'port':0x18eb});var socket=require(_0xcb91('0xe'))(new Redis(config[_0xcb91('0xc')]));require(_0xcb91('0xf'))['register'](socket);function respondWithRpcPromise(_0x5daf9a,_0x228901,_0x5f2c20){return new BPromise(function(_0x4522ff,_0x247129){return client[_0xcb91('0x10')](_0x5daf9a,_0x5f2c20)[_0xcb91('0x11')](function(_0x36b643){logger[_0xcb91('0x12')](_0xcb91('0x13'),_0x228901,'request\x20sent');logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x228901,_0xcb91('0x14'),JSON['stringify'](_0x36b643));if(_0x36b643['error']){if(_0x36b643[_0xcb91('0x15')][_0xcb91('0x16')]===0x1f4){logger[_0xcb91('0x15')](_0xcb91('0x13'),_0x228901,_0x36b643[_0xcb91('0x15')][_0xcb91('0x17')]);return _0x247129(_0x36b643['error'][_0xcb91('0x17')]);}logger[_0xcb91('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x228901,_0x36b643[_0xcb91('0x15')][_0xcb91('0x17')]);return _0x4522ff(_0x36b643[_0xcb91('0x15')][_0xcb91('0x17')]);}else{logger[_0xcb91('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x228901,_0xcb91('0x14'));_0x4522ff(_0x36b643[_0xcb91('0x18')][_0xcb91('0x17')]);}})[_0xcb91('0x19')](function(_0x229131){logger[_0xcb91('0x15')](_0xcb91('0x13'),_0x228901,_0x229131);_0x247129(_0x229131);});});}exports[_0xcb91('0x1a')]=function(_0x5a9a38){var _0x26a0a8=this;return new Promise(function(_0x2824b8,_0x1231df){return db[_0xcb91('0x1b')][_0xcb91('0x1c')]({'raw':_0x5a9a38[_0xcb91('0x1d')]?_0x5a9a38[_0xcb91('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5a9a38[_0xcb91('0x1d')]?_0x5a9a38[_0xcb91('0x1d')][_0xcb91('0x1e')]||null:null,'attributes':_0x5a9a38['options']?_0x5a9a38['options'][_0xcb91('0x1f')]||null:null,'limit':_0x5a9a38[_0xcb91('0x1d')]?_0x5a9a38[_0xcb91('0x1d')][_0xcb91('0x20')]||null:null,'include':_0x5a9a38['options']?_0x5a9a38[_0xcb91('0x1d')][_0xcb91('0x21')]?_[_0xcb91('0x22')](_0x5a9a38[_0xcb91('0x1d')][_0xcb91('0x21')],function(_0x2c0661){return{'model':db[_0x2c0661['model']],'as':_0x2c0661['as'],'attributes':_0x2c0661['attributes'],'include':_0x2c0661['include']?_[_0xcb91('0x22')](_0x2c0661[_0xcb91('0x21')],function(_0x5091b9){return{'model':db[_0x5091b9[_0xcb91('0x23')]],'as':_0x5091b9['as'],'attributes':_0x5091b9[_0xcb91('0x1f')],'include':_0x5091b9[_0xcb91('0x21')]?_[_0xcb91('0x22')](_0x5091b9[_0xcb91('0x21')],function(_0x57daf7){return{'model':db[_0x57daf7['model']],'as':_0x57daf7['as'],'attributes':_0x57daf7[_0xcb91('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcb91('0x11')](function(_0x1b5d87){logger['info']('GetVoiceQueueReport',_0x5a9a38);logger[_0xcb91('0x24')](_0xcb91('0x1a'),_0x5a9a38,JSON[_0xcb91('0x25')](_0x1b5d87));_0x2824b8(_0x1b5d87);})[_0xcb91('0x19')](function(_0x1a3e06){logger[_0xcb91('0x15')]('GetVoiceQueueReport',_0x1a3e06[_0xcb91('0x17')],_0x5a9a38);_0x1231df(_0x26a0a8[_0xcb91('0x15')](0x1f4,_0x1a3e06[_0xcb91('0x17')]));});});};exports[_0xcb91('0x26')]=function(_0x5a7b33){var _0x30c27b=this;return new Promise(function(_0x583ccc,_0x34cc1b){return db[_0xcb91('0x1b')][_0xcb91('0x27')](_0x5a7b33['body'],{'raw':_0x5a7b33['options']?_0x5a7b33[_0xcb91('0x1d')][_0xcb91('0x28')]===undefined?!![]:![]:!![]})[_0xcb91('0x11')](function(_0x381781){logger[_0xcb91('0x12')](_0xcb91('0x26'),_0x5a7b33);logger['debug']('CreateVoiceQueueReport',_0x5a7b33,JSON['stringify'](_0x381781));_0x583ccc(_0x381781);})[_0xcb91('0x19')](function(_0x55b1c6){logger[_0xcb91('0x15')](_0xcb91('0x26'),_0x55b1c6['message'],_0x5a7b33);_0x34cc1b(_0x30c27b[_0xcb91('0x15')](0x1f4,_0x55b1c6['message']));});});};exports[_0xcb91('0x29')]=function(_0xfa664c){var _0x611217=this;return new Promise(function(_0x166be6,_0x3bcde3){return db[_0xcb91('0x1b')][_0xcb91('0x2a')](_0xfa664c[_0xcb91('0x2b')],{'raw':_0xfa664c[_0xcb91('0x1d')]?_0xfa664c[_0xcb91('0x1d')][_0xcb91('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfa664c[_0xcb91('0x1d')]?_0xfa664c[_0xcb91('0x1d')][_0xcb91('0x1e')]||null:null,'attributes':_0xfa664c[_0xcb91('0x1d')]?_0xfa664c[_0xcb91('0x1d')][_0xcb91('0x1f')]||null:null,'limit':_0xfa664c[_0xcb91('0x1d')]?_0xfa664c[_0xcb91('0x1d')][_0xcb91('0x20')]||null:null})['then'](function(_0x1beab4){logger['info'](_0xcb91('0x29'),_0xfa664c);logger['debug'](_0xcb91('0x29'),_0xfa664c,JSON[_0xcb91('0x25')](_0x1beab4));_0x166be6(_0x1beab4);})[_0xcb91('0x19')](function(_0x28851d){logger['error'](_0xcb91('0x29'),_0x28851d[_0xcb91('0x17')],_0xfa664c);_0x3bcde3(_0x611217[_0xcb91('0x15')](0x1f4,_0x28851d[_0xcb91('0x17')]));});});}; \ No newline at end of file +var _0x0f36=['message','result','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','info','catch','VoiceQueueReport','create','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x0f36,0x154));var _0x60f3=function(_0x534617,_0x41a7ba){_0x534617=_0x534617-0x0;var _0x516e6a=_0x0f36[_0x534617];return _0x516e6a;};'use strict';var _=require('lodash');var util=require(_0x60f3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x60f3('0x1'));var fs=require('fs');var Redis=require(_0x60f3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x60f3('0x3'));var logger=require(_0x60f3('0x4'))(_0x60f3('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x60f3('0x6')]['http']({'port':0x232a});config[_0x60f3('0x7')]=_[_0x60f3('0x8')](config[_0x60f3('0x7')],{'host':_0x60f3('0x9'),'port':0x18eb});var socket=require(_0x60f3('0xa'))(new Redis(config[_0x60f3('0x7')]));require(_0x60f3('0xb'))['register'](socket);function respondWithRpcPromise(_0x118a07,_0x443403,_0x604db3){return new BPromise(function(_0x127859,_0x305fb5){return client[_0x60f3('0xc')](_0x118a07,_0x604db3)[_0x60f3('0xd')](function(_0x4e108d){logger['info'](_0x60f3('0xe'),_0x443403,_0x60f3('0xf'));logger[_0x60f3('0x10')](_0x60f3('0x11'),_0x443403,_0x60f3('0xf'),JSON[_0x60f3('0x12')](_0x4e108d));if(_0x4e108d[_0x60f3('0x13')]){if(_0x4e108d['error']['code']===0x1f4){logger['error'](_0x60f3('0xe'),_0x443403,_0x4e108d['error'][_0x60f3('0x14')]);return _0x305fb5(_0x4e108d[_0x60f3('0x13')][_0x60f3('0x14')]);}logger[_0x60f3('0x13')](_0x60f3('0xe'),_0x443403,_0x4e108d[_0x60f3('0x13')][_0x60f3('0x14')]);return _0x127859(_0x4e108d[_0x60f3('0x13')][_0x60f3('0x14')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x443403,_0x60f3('0xf'));_0x127859(_0x4e108d[_0x60f3('0x15')][_0x60f3('0x14')]);}})['catch'](function(_0x3b7345){logger[_0x60f3('0x13')](_0x60f3('0xe'),_0x443403,_0x3b7345);_0x305fb5(_0x3b7345);});});}exports[_0x60f3('0x16')]=function(_0x44de35){var _0x4ac466=this;return new Promise(function(_0x52d1d9,_0x462309){return db['VoiceQueueReport'][_0x60f3('0x17')]({'raw':_0x44de35[_0x60f3('0x18')]?_0x44de35[_0x60f3('0x18')][_0x60f3('0x19')]===undefined?!![]:![]:!![],'where':_0x44de35[_0x60f3('0x18')]?_0x44de35[_0x60f3('0x18')][_0x60f3('0x1a')]||null:null,'attributes':_0x44de35[_0x60f3('0x18')]?_0x44de35['options'][_0x60f3('0x1b')]||null:null,'limit':_0x44de35[_0x60f3('0x18')]?_0x44de35['options'][_0x60f3('0x1c')]||null:null,'include':_0x44de35[_0x60f3('0x18')]?_0x44de35['options'][_0x60f3('0x1d')]?_[_0x60f3('0x1e')](_0x44de35[_0x60f3('0x18')][_0x60f3('0x1d')],function(_0x33f0a0){return{'model':db[_0x33f0a0['model']],'as':_0x33f0a0['as'],'attributes':_0x33f0a0['attributes'],'include':_0x33f0a0[_0x60f3('0x1d')]?_['map'](_0x33f0a0[_0x60f3('0x1d')],function(_0x4fa653){return{'model':db[_0x4fa653[_0x60f3('0x1f')]],'as':_0x4fa653['as'],'attributes':_0x4fa653[_0x60f3('0x1b')],'include':_0x4fa653['include']?_[_0x60f3('0x1e')](_0x4fa653[_0x60f3('0x1d')],function(_0x71bdd0){return{'model':db[_0x71bdd0[_0x60f3('0x1f')]],'as':_0x71bdd0['as'],'attributes':_0x71bdd0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd43b88){logger[_0x60f3('0x20')](_0x60f3('0x16'),_0x44de35);logger[_0x60f3('0x10')](_0x60f3('0x16'),_0x44de35,JSON[_0x60f3('0x12')](_0xd43b88));_0x52d1d9(_0xd43b88);})[_0x60f3('0x21')](function(_0xb06460){logger[_0x60f3('0x13')](_0x60f3('0x16'),_0xb06460['message'],_0x44de35);_0x462309(_0x4ac466[_0x60f3('0x13')](0x1f4,_0xb06460[_0x60f3('0x14')]));});});};exports['CreateVoiceQueueReport']=function(_0x35e413){var _0x44e6c7=this;return new Promise(function(_0x117059,_0x599814){return db[_0x60f3('0x22')][_0x60f3('0x23')](_0x35e413['body'],{'raw':_0x35e413[_0x60f3('0x18')]?_0x35e413[_0x60f3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x60f3('0xd')](function(_0x26ae67){logger['info'](_0x60f3('0x24'),_0x35e413);logger[_0x60f3('0x10')](_0x60f3('0x24'),_0x35e413,JSON[_0x60f3('0x12')](_0x26ae67));_0x117059(_0x26ae67);})['catch'](function(_0x3cbcde){logger[_0x60f3('0x13')](_0x60f3('0x24'),_0x3cbcde[_0x60f3('0x14')],_0x35e413);_0x599814(_0x44e6c7['error'](0x1f4,_0x3cbcde[_0x60f3('0x14')]));});});};exports[_0x60f3('0x25')]=function(_0x4591af){var _0x181697=this;return new Promise(function(_0x283621,_0x53e838){return db['VoiceQueueReport'][_0x60f3('0x26')](_0x4591af[_0x60f3('0x27')],{'raw':_0x4591af[_0x60f3('0x18')]?_0x4591af[_0x60f3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4591af[_0x60f3('0x18')]?_0x4591af[_0x60f3('0x18')][_0x60f3('0x1a')]||null:null,'attributes':_0x4591af[_0x60f3('0x18')]?_0x4591af[_0x60f3('0x18')]['attributes']||null:null,'limit':_0x4591af[_0x60f3('0x18')]?_0x4591af['options']['limit']||null:null})[_0x60f3('0xd')](function(_0x128e4c){logger[_0x60f3('0x20')](_0x60f3('0x25'),_0x4591af);logger[_0x60f3('0x10')](_0x60f3('0x25'),_0x4591af,JSON[_0x60f3('0x12')](_0x128e4c));_0x283621(_0x128e4c);})[_0x60f3('0x21')](function(_0x1b4642){logger[_0x60f3('0x13')]('UpdateVoiceQueueReport',_0x1b4642['message'],_0x4591af);_0x53e838(_0x181697[_0x60f3('0x13')](0x1f4,_0x1b4642[_0x60f3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index d3cbfcd..3e1e549 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 _0xafdd=['emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x4b1c0c,_0x397811){var _0x44189b=function(_0x381529){while(--_0x381529){_0x4b1c0c['push'](_0x4b1c0c['shift']());}};_0x44189b(++_0x397811);}(_0xafdd,0x19a));var _0xdafd=function(_0x382b7d,_0x5b41cb){_0x382b7d=_0x382b7d-0x0;var _0xd5dc5=_0xafdd[_0x382b7d];return _0xd5dc5;};'use strict';var VoiceQueueReportEvents=require(_0xdafd('0x0'));var events=[_0xdafd('0x1'),_0xdafd('0x2'),_0xdafd('0x3')];function createListener(_0xf13a21,_0x3ceef2){return function(_0x268b14){_0x3ceef2[_0xdafd('0x4')](_0xf13a21,_0x268b14);};}function removeListener(_0x5624f6,_0x283ab1){return function(){VoiceQueueReportEvents[_0xdafd('0x5')](_0x5624f6,_0x283ab1);};}exports[_0xdafd('0x6')]=function(_0x37f05a){for(var _0xfa4ad6=0x0,_0x57cfee=events[_0xdafd('0x7')];_0xfa4ad6<_0x57cfee;_0xfa4ad6++){var _0x53e09c=events[_0xfa4ad6];var _0x9b9c6b=createListener(_0xdafd('0x8')+_0x53e09c,_0x37f05a);VoiceQueueReportEvents['on'](_0x53e09c,_0x9b9c6b);}}; \ No newline at end of file +var _0xcfeb=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','register'];(function(_0x3d5378,_0x417113){var _0x58b9f1=function(_0x483583){while(--_0x483583){_0x3d5378['push'](_0x3d5378['shift']());}};_0x58b9f1(++_0x417113);}(_0xcfeb,0x1b2));var _0xbcfe=function(_0x219eaa,_0x25ee78){_0x219eaa=_0x219eaa-0x0;var _0x1d4462=_0xcfeb[_0x219eaa];return _0x1d4462;};'use strict';var VoiceQueueReportEvents=require(_0xbcfe('0x0'));var events=[_0xbcfe('0x1'),_0xbcfe('0x2'),_0xbcfe('0x3')];function createListener(_0x4e0dc9,_0x5e2e1c){return function(_0x264f6a){_0x5e2e1c[_0xbcfe('0x4')](_0x4e0dc9,_0x264f6a);};}function removeListener(_0x3c6522,_0x562b14){return function(){VoiceQueueReportEvents['removeListener'](_0x3c6522,_0x562b14);};}exports[_0xbcfe('0x5')]=function(_0x3de8ae){for(var _0x351b20=0x0,_0x24743b=events[_0xbcfe('0x6')];_0x351b20<_0x24743b;_0x351b20++){var _0x586e64=events[_0x351b20];var _0x43af4c=createListener(_0xbcfe('0x7')+_0x586e64,_0x3de8ae);VoiceQueueReportEvents['on'](_0x586e64,_0x43af4c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index dbf90f7..f13fac5 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 _0x5781=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','multer'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x5781,0x179));var _0x1578=function(_0x36d3b8,_0x1e4de2){_0x36d3b8=_0x36d3b8-0x0;var _0x26c794=_0x5781[_0x36d3b8];return _0x26c794;};'use strict';var multer=require(_0x1578('0x0'));var util=require('util');var path=require(_0x1578('0x1'));var timeout=require(_0x1578('0x2'));var express=require('express');var router=express[_0x1578('0x3')]();var fs_extra=require(_0x1578('0x4'));var auth=require(_0x1578('0x5'));var interaction=require(_0x1578('0x6'));var config=require(_0x1578('0x7'));var controller=require(_0x1578('0x8'));router[_0x1578('0x9')]('/',auth[_0x1578('0xa')](),controller[_0x1578('0xb')]);router['get'](_0x1578('0xc'),auth[_0x1578('0xa')](),controller[_0x1578('0xd')]);router[_0x1578('0xe')]('/',auth[_0x1578('0xa')](),controller['create']);router['put'](_0x1578('0xc'),auth[_0x1578('0xa')](),controller[_0x1578('0xf')]);router[_0x1578('0x10')](_0x1578('0xc'),auth[_0x1578('0xa')](),controller[_0x1578('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3d4f=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','get','/:id','show','create','put','delete','destroy','exports','multer','util','path'];(function(_0x2aa87a,_0x3ac30b){var _0x5121b5=function(_0x4fdfc7){while(--_0x4fdfc7){_0x2aa87a['push'](_0x2aa87a['shift']());}};_0x5121b5(++_0x3ac30b);}(_0x3d4f,0x9f));var _0xf3d4=function(_0x305cc5,_0x317607){_0x305cc5=_0x305cc5-0x0;var _0x3ef26f=_0x3d4f[_0x305cc5];return _0x3ef26f;};'use strict';var multer=require(_0xf3d4('0x0'));var util=require(_0xf3d4('0x1'));var path=require(_0xf3d4('0x2'));var timeout=require(_0xf3d4('0x3'));var express=require(_0xf3d4('0x4'));var router=express[_0xf3d4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf3d4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf3d4('0x7'));var controller=require(_0xf3d4('0x8'));router['get']('/',auth[_0xf3d4('0x9')](),controller['index']);router[_0xf3d4('0xa')](_0xf3d4('0xb'),auth[_0xf3d4('0x9')](),controller[_0xf3d4('0xc')]);router['post']('/',auth[_0xf3d4('0x9')](),controller[_0xf3d4('0xd')]);router[_0xf3d4('0xe')]('/:id',auth[_0xf3d4('0x9')](),controller['update']);router[_0xf3d4('0xf')](_0xf3d4('0xb'),auth[_0xf3d4('0x9')](),controller[_0xf3d4('0x10')]);module[_0xf3d4('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 961c578..5211d5a 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 _0xc55e=['STRING','DATE','sequelize','moment'];(function(_0x3585a5,_0x388b16){var _0x4f37eb=function(_0x55cd17){while(--_0x55cd17){_0x3585a5['push'](_0x3585a5['shift']());}};_0x4f37eb(++_0x388b16);}(_0xc55e,0xe6));var _0xec55=function(_0xb3fdb6,_0x4e9143){_0xb3fdb6=_0xb3fdb6-0x0;var _0x26df27=_0xc55e[_0xb3fdb6];return _0x26df27;};'use strict';var Sequelize=require(_0xec55('0x0'));var moment=require(_0xec55('0x1'));module['exports']={'time':{'type':Sequelize[_0xec55('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xec55('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xec55('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xec55('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xec55('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xec55('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xec55('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xec55('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xec55('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xec55('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xec55('0x3')],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x5137=['exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0x5137,0x196));var _0x7513=function(_0x167f26,_0x1be9f1){_0x167f26=_0x167f26-0x0;var _0x146405=_0x5137[_0x167f26];return _0x146405;};'use strict';var Sequelize=require(_0x7513('0x0'));var moment=require(_0x7513('0x1'));module[_0x7513('0x2')]={'time':{'type':Sequelize[_0x7513('0x3')]},'callid':{'type':Sequelize[_0x7513('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7513('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7513('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7513('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7513('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7513('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x7513('0x4')](_0x7513('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 701fc45..d9ce4a0 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 _0x2f18=['VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x1e6c68,_0x1dced3){var _0x36dcdc=function(_0x1f1a49){while(--_0x1f1a49){_0x1e6c68['push'](_0x1e6c68['shift']());}};_0x36dcdc(++_0x1dced3);}(_0x2f18,0x179));var _0x82f1=function(_0x12b1a9,_0x4227ec){_0x12b1a9=_0x12b1a9-0x0;var _0x1e6f0c=_0x2f18[_0x12b1a9];return _0x1e6f0c;};'use strict';var emlformat=require(_0x82f1('0x0'));var rimraf=require(_0x82f1('0x1'));var zipdir=require(_0x82f1('0x2'));var jsonpatch=require(_0x82f1('0x3'));var rp=require(_0x82f1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x82f1('0x5'));var util=require(_0x82f1('0x6'));var path=require(_0x82f1('0x7'));var sox=require(_0x82f1('0x8'));var csv=require(_0x82f1('0x9'));var ejs=require(_0x82f1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82f1('0xb'));var squel=require(_0x82f1('0xc'));var crypto=require(_0x82f1('0xd'));var jsforce=require(_0x82f1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x82f1('0xf'));var Redis=require(_0x82f1('0x10'));var authService=require(_0x82f1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x82f1('0x12'));var hardwareService=require(_0x82f1('0x13'));var logger=require('../../config/logger')(_0x82f1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x82f1('0x15'));var db=require(_0x82f1('0x16'))['db'];function respondWithStatusCode(_0xc61808,_0x3f7642){_0x3f7642=_0x3f7642||0xcc;return function(_0x39efd6){if(_0x39efd6){return _0xc61808[_0x82f1('0x17')](_0x3f7642);}return _0xc61808[_0x82f1('0x18')](_0x3f7642)[_0x82f1('0x19')]();};}function respondWithResult(_0x2c7461,_0x164d85){_0x164d85=_0x164d85||0xc8;return function(_0x1a7fb6){if(_0x1a7fb6){return _0x2c7461[_0x82f1('0x18')](_0x164d85)[_0x82f1('0x1a')](_0x1a7fb6);}};}function respondWithFilteredResult(_0x5a7e17,_0x5efcd9){return function(_0x3766ec){if(_0x3766ec){var _0x40bfe0=typeof _0x5efcd9[_0x82f1('0x1b')]===_0x82f1('0x1c')&&typeof _0x5efcd9[_0x82f1('0x1d')]===_0x82f1('0x1c');var _0x166688=_0x3766ec[_0x82f1('0x1e')];var _0x42307f=_0x40bfe0?0x0:_0x5efcd9[_0x82f1('0x1b')];var _0x47e22e=_0x40bfe0?_0x3766ec['count']:_0x5efcd9[_0x82f1('0x1b')]+_0x5efcd9[_0x82f1('0x1d')];var _0x67cf28;if(_0x47e22e>=_0x166688){_0x47e22e=_0x166688;_0x67cf28=0xc8;}else{_0x67cf28=0xce;}_0x5a7e17[_0x82f1('0x18')](_0x67cf28);return _0x5a7e17['set'](_0x82f1('0x1f'),_0x42307f+'-'+_0x47e22e+'/'+_0x166688)[_0x82f1('0x1a')](_0x3766ec);}return null;};}function patchUpdates(_0x153f7b){return function(_0x17ce3c){try{jsonpatch[_0x82f1('0x20')](_0x17ce3c,_0x153f7b,!![]);}catch(_0x5eeb17){return BPromise[_0x82f1('0x21')](_0x5eeb17);}return _0x17ce3c['save']();};}function saveUpdates(_0x523d4e,_0x32df7f){return function(_0x47f0c4){if(_0x47f0c4){return _0x47f0c4[_0x82f1('0x22')](_0x523d4e)[_0x82f1('0x23')](function(_0x2bc251){return _0x2bc251;});}return null;};}function removeEntity(_0x1bd931,_0x5d81bc){return function(_0x5aa6e0){if(_0x5aa6e0){return _0x5aa6e0[_0x82f1('0x24')]()['then'](function(){_0x1bd931['status'](0xcc)[_0x82f1('0x19')]();});}};}function handleEntityNotFound(_0x5b2090,_0x5315e9){return function(_0x3061e1){if(!_0x3061e1){_0x5b2090[_0x82f1('0x17')](0x194);}return _0x3061e1;};}function handleError(_0xc4fa08,_0x353688){_0x353688=_0x353688||0x1f4;return function(_0x17765c){logger[_0x82f1('0x25')](_0x17765c['stack']);if(_0x17765c[_0x82f1('0x26')]){delete _0x17765c[_0x82f1('0x26')];}_0xc4fa08[_0x82f1('0x18')](_0x353688)[_0x82f1('0x27')](_0x17765c);};}exports['index']=function(_0x2956fc,_0x374738){var _0x4babec={},_0x4bcbf7={},_0x28731d={'count':0x0,'rows':[]};var _0x1cf886=_[_0x82f1('0x28')](db[_0x82f1('0x29')][_0x82f1('0x2a')],function(_0x353134){return{'name':_0x353134[_0x82f1('0x2b')],'type':_0x353134[_0x82f1('0x2c')]['key']};});_0x4bcbf7['model']=_[_0x82f1('0x28')](_0x1cf886,'name');_0x4bcbf7[_0x82f1('0x2d')]=_[_0x82f1('0x2e')](_0x2956fc[_0x82f1('0x2d')]);_0x4bcbf7['filters']=_['intersection'](_0x4bcbf7[_0x82f1('0x2f')],_0x4bcbf7[_0x82f1('0x2d')]);_0x4babec[_0x82f1('0x30')]=_[_0x82f1('0x31')](_0x4bcbf7[_0x82f1('0x2f')],qs[_0x82f1('0x32')](_0x2956fc[_0x82f1('0x2d')][_0x82f1('0x32')]));_0x4babec[_0x82f1('0x30')]=_0x4babec[_0x82f1('0x30')][_0x82f1('0x33')]?_0x4babec['attributes']:_0x4bcbf7[_0x82f1('0x2f')];if(!_0x2956fc[_0x82f1('0x2d')][_0x82f1('0x34')](_0x82f1('0x35'))){_0x4babec[_0x82f1('0x1d')]=qs[_0x82f1('0x1d')](_0x2956fc[_0x82f1('0x2d')]['limit']);_0x4babec['offset']=qs[_0x82f1('0x1b')](_0x2956fc['query'][_0x82f1('0x1b')]);}_0x4babec[_0x82f1('0x36')]=qs['sort'](_0x2956fc[_0x82f1('0x2d')][_0x82f1('0x37')]);_0x4babec[_0x82f1('0x38')]=qs[_0x82f1('0x39')](_[_0x82f1('0x3a')](_0x2956fc[_0x82f1('0x2d')],_0x4bcbf7[_0x82f1('0x39')]),_0x1cf886);if(_0x2956fc['query'][_0x82f1('0x3b')]){_0x4babec[_0x82f1('0x38')]=_[_0x82f1('0x3c')](_0x4babec['where'],{'$or':_[_0x82f1('0x28')](_0x1cf886,function(_0x5a43fe){if(_0x5a43fe['type']!==_0x82f1('0x3d')){var _0x369882={};_0x369882[_0x5a43fe[_0x82f1('0x26')]]={'$like':'%'+_0x2956fc['query'][_0x82f1('0x3b')]+'%'};return _0x369882;}})});}_0x4babec=_[_0x82f1('0x3c')]({},_0x4babec,_0x2956fc[_0x82f1('0x3e')]);var _0x3173a5={'where':_0x4babec[_0x82f1('0x38')]};return db[_0x82f1('0x29')][_0x82f1('0x1e')](_0x3173a5)['then'](function(_0x542ea9){_0x28731d[_0x82f1('0x1e')]=_0x542ea9;if(_0x2956fc['query']['includeAll']){_0x4babec[_0x82f1('0x3f')]=[{'all':!![]}];}return db[_0x82f1('0x29')][_0x82f1('0x40')](_0x4babec);})['then'](function(_0x4c3ab7){_0x28731d[_0x82f1('0x41')]=_0x4c3ab7;return _0x28731d;})[_0x82f1('0x23')](respondWithFilteredResult(_0x374738,_0x4babec))[_0x82f1('0x42')](handleError(_0x374738,null));};exports[_0x82f1('0x43')]=function(_0x1b9698,_0x327172){var _0x1a1ec5={'raw':!![],'where':{'id':_0x1b9698[_0x82f1('0x44')]['id']}},_0x1381d8={};_0x1381d8['model']=_[_0x82f1('0x2e')](db[_0x82f1('0x29')][_0x82f1('0x2a')]);_0x1381d8[_0x82f1('0x2d')]=_[_0x82f1('0x2e')](_0x1b9698['query']);_0x1381d8['filters']=_['intersection'](_0x1381d8[_0x82f1('0x2f')],_0x1381d8['query']);_0x1a1ec5[_0x82f1('0x30')]=_[_0x82f1('0x31')](_0x1381d8['model'],qs[_0x82f1('0x32')](_0x1b9698[_0x82f1('0x2d')]['fields']));_0x1a1ec5[_0x82f1('0x30')]=_0x1a1ec5['attributes'][_0x82f1('0x33')]?_0x1a1ec5[_0x82f1('0x30')]:_0x1381d8[_0x82f1('0x2f')];if(_0x1b9698[_0x82f1('0x2d')][_0x82f1('0x45')]){_0x1a1ec5[_0x82f1('0x3f')]=[{'all':!![]}];}_0x1a1ec5=_[_0x82f1('0x3c')]({},_0x1a1ec5,_0x1b9698[_0x82f1('0x3e')]);return db[_0x82f1('0x29')]['find'](_0x1a1ec5)[_0x82f1('0x23')](handleEntityNotFound(_0x327172,null))[_0x82f1('0x23')](respondWithResult(_0x327172,null))[_0x82f1('0x42')](handleError(_0x327172,null));};exports[_0x82f1('0x46')]=function(_0x5f22a1,_0x486fd9){return db['VoiceQueuesLog'][_0x82f1('0x46')](_0x5f22a1['body'],{})[_0x82f1('0x23')](respondWithResult(_0x486fd9,0xc9))[_0x82f1('0x42')](handleError(_0x486fd9,null));};exports[_0x82f1('0x22')]=function(_0x4a8fd2,_0x7d2628){if(_0x4a8fd2[_0x82f1('0x47')]['id']){delete _0x4a8fd2[_0x82f1('0x47')]['id'];}return db[_0x82f1('0x29')][_0x82f1('0x48')]({'where':{'id':_0x4a8fd2[_0x82f1('0x44')]['id']}})[_0x82f1('0x23')](handleEntityNotFound(_0x7d2628,null))[_0x82f1('0x23')](saveUpdates(_0x4a8fd2[_0x82f1('0x47')],null))['then'](respondWithResult(_0x7d2628,null))[_0x82f1('0x42')](handleError(_0x7d2628,null));};exports['destroy']=function(_0x59a29b,_0xaae114){return db[_0x82f1('0x29')]['find']({'where':{'id':_0x59a29b[_0x82f1('0x44')]['id']}})[_0x82f1('0x23')](handleEntityNotFound(_0xaae114,null))[_0x82f1('0x23')](removeEntity(_0xaae114,null))[_0x82f1('0x42')](handleError(_0xaae114,null));}; \ No newline at end of file +var _0x5129=['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','../../config/license/util','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs'];(function(_0x485cea,_0x1ea014){var _0x4bc1b2=function(_0x4be0b1){while(--_0x4be0b1){_0x485cea['push'](_0x485cea['shift']());}};_0x4bc1b2(++_0x1ea014);}(_0x5129,0x1bf));var _0x9512=function(_0x50b6ee,_0x5edd81){_0x50b6ee=_0x50b6ee-0x0;var _0x311cc0=_0x5129[_0x50b6ee];return _0x311cc0;};'use strict';var emlformat=require(_0x9512('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9512('0x1'));var jsonpatch=require(_0x9512('0x2'));var rp=require('request-promise');var moment=require(_0x9512('0x3'));var BPromise=require(_0x9512('0x4'));var Mustache=require(_0x9512('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9512('0x6'));var csv=require(_0x9512('0x7'));var ejs=require(_0x9512('0x8'));var fs=require('fs');var fs_extra=require(_0x9512('0x9'));var _=require(_0x9512('0xa'));var squel=require(_0x9512('0xb'));var crypto=require(_0x9512('0xc'));var jsforce=require(_0x9512('0xd'));var deskjs=require(_0x9512('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9512('0xf'));var Redis=require(_0x9512('0x10'));var authService=require(_0x9512('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9512('0x12'));var hardwareService=require(_0x9512('0x13'));var logger=require(_0x9512('0x14'))(_0x9512('0x15'));var utils=require(_0x9512('0x16'));var config=require(_0x9512('0x17'));var licenseUtil=require(_0x9512('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c15e7,_0x1fba4c){_0x1fba4c=_0x1fba4c||0xcc;return function(_0x589628){if(_0x589628){return _0x3c15e7['sendStatus'](_0x1fba4c);}return _0x3c15e7[_0x9512('0x19')](_0x1fba4c)[_0x9512('0x1a')]();};}function respondWithResult(_0x42bad0,_0x204696){_0x204696=_0x204696||0xc8;return function(_0x1e285c){if(_0x1e285c){return _0x42bad0[_0x9512('0x19')](_0x204696)[_0x9512('0x1b')](_0x1e285c);}};}function respondWithFilteredResult(_0x53b792,_0x2fd695){return function(_0x59e6f1){if(_0x59e6f1){var _0x10adc0=typeof _0x2fd695['offset']==='undefined'&&typeof _0x2fd695[_0x9512('0x1c')]==='undefined';var _0x5564e3=_0x59e6f1[_0x9512('0x1d')];var _0x161bbf=_0x10adc0?0x0:_0x2fd695['offset'];var _0x1cb113=_0x10adc0?_0x59e6f1[_0x9512('0x1d')]:_0x2fd695[_0x9512('0x1e')]+_0x2fd695[_0x9512('0x1c')];var _0x57300c;if(_0x1cb113>=_0x5564e3){_0x1cb113=_0x5564e3;_0x57300c=0xc8;}else{_0x57300c=0xce;}_0x53b792[_0x9512('0x19')](_0x57300c);return _0x53b792['set'](_0x9512('0x1f'),_0x161bbf+'-'+_0x1cb113+'/'+_0x5564e3)['json'](_0x59e6f1);}return null;};}function patchUpdates(_0x24bad5){return function(_0x3a2d13){try{jsonpatch[_0x9512('0x20')](_0x3a2d13,_0x24bad5,!![]);}catch(_0x428468){return BPromise[_0x9512('0x21')](_0x428468);}return _0x3a2d13[_0x9512('0x22')]();};}function saveUpdates(_0x4cf892,_0x1ef51e){return function(_0x3a7f4a){if(_0x3a7f4a){return _0x3a7f4a[_0x9512('0x23')](_0x4cf892)[_0x9512('0x24')](function(_0x11f1f8){return _0x11f1f8;});}return null;};}function removeEntity(_0x31f52d,_0x34baf8){return function(_0x5c2acd){if(_0x5c2acd){return _0x5c2acd[_0x9512('0x25')]()[_0x9512('0x24')](function(){_0x31f52d['status'](0xcc)[_0x9512('0x1a')]();});}};}function handleEntityNotFound(_0x1de947,_0x4a26c8){return function(_0x517271){if(!_0x517271){_0x1de947[_0x9512('0x26')](0x194);}return _0x517271;};}function handleError(_0x3be220,_0x16e9c3){_0x16e9c3=_0x16e9c3||0x1f4;return function(_0x5272df){logger[_0x9512('0x27')](_0x5272df[_0x9512('0x28')]);if(_0x5272df['name']){delete _0x5272df[_0x9512('0x29')];}_0x3be220[_0x9512('0x19')](_0x16e9c3)[_0x9512('0x2a')](_0x5272df);};}exports['index']=function(_0x1e59f3,_0x15794f){var _0x53b8cd={},_0x174a45={},_0x2786f8={'count':0x0,'rows':[]};var _0x226bf0=_[_0x9512('0x2b')](db[_0x9512('0x2c')][_0x9512('0x2d')],function(_0x206be5){return{'name':_0x206be5['fieldName'],'type':_0x206be5[_0x9512('0x2e')][_0x9512('0x2f')]};});_0x174a45[_0x9512('0x30')]=_[_0x9512('0x2b')](_0x226bf0,_0x9512('0x29'));_0x174a45[_0x9512('0x31')]=_[_0x9512('0x32')](_0x1e59f3[_0x9512('0x31')]);_0x174a45['filters']=_[_0x9512('0x33')](_0x174a45['model'],_0x174a45['query']);_0x53b8cd[_0x9512('0x34')]=_[_0x9512('0x33')](_0x174a45[_0x9512('0x30')],qs[_0x9512('0x35')](_0x1e59f3[_0x9512('0x31')][_0x9512('0x35')]));_0x53b8cd[_0x9512('0x34')]=_0x53b8cd[_0x9512('0x34')][_0x9512('0x36')]?_0x53b8cd[_0x9512('0x34')]:_0x174a45[_0x9512('0x30')];if(!_0x1e59f3[_0x9512('0x31')][_0x9512('0x37')](_0x9512('0x38'))){_0x53b8cd[_0x9512('0x1c')]=qs[_0x9512('0x1c')](_0x1e59f3[_0x9512('0x31')][_0x9512('0x1c')]);_0x53b8cd[_0x9512('0x1e')]=qs['offset'](_0x1e59f3[_0x9512('0x31')]['offset']);}_0x53b8cd[_0x9512('0x39')]=qs['sort'](_0x1e59f3[_0x9512('0x31')][_0x9512('0x3a')]);_0x53b8cd[_0x9512('0x3b')]=qs[_0x9512('0x3c')](_[_0x9512('0x3d')](_0x1e59f3[_0x9512('0x31')],_0x174a45[_0x9512('0x3c')]),_0x226bf0);if(_0x1e59f3['query'][_0x9512('0x3e')]){_0x53b8cd['where']=_['merge'](_0x53b8cd['where'],{'$or':_[_0x9512('0x2b')](_0x226bf0,function(_0x779c3c){if(_0x779c3c[_0x9512('0x2e')]!==_0x9512('0x3f')){var _0x24d192={};_0x24d192[_0x779c3c[_0x9512('0x29')]]={'$like':'%'+_0x1e59f3['query'][_0x9512('0x3e')]+'%'};return _0x24d192;}})});}_0x53b8cd=_[_0x9512('0x40')]({},_0x53b8cd,_0x1e59f3['options']);var _0x5a0c8f={'where':_0x53b8cd[_0x9512('0x3b')]};return db[_0x9512('0x2c')][_0x9512('0x1d')](_0x5a0c8f)[_0x9512('0x24')](function(_0x142260){_0x2786f8[_0x9512('0x1d')]=_0x142260;if(_0x1e59f3[_0x9512('0x31')][_0x9512('0x41')]){_0x53b8cd['include']=[{'all':!![]}];}return db[_0x9512('0x2c')][_0x9512('0x42')](_0x53b8cd);})[_0x9512('0x24')](function(_0xe16f6b){_0x2786f8[_0x9512('0x43')]=_0xe16f6b;return _0x2786f8;})['then'](respondWithFilteredResult(_0x15794f,_0x53b8cd))[_0x9512('0x44')](handleError(_0x15794f,null));};exports[_0x9512('0x45')]=function(_0x3e9e20,_0x4474f3){var _0x39cdd7={'raw':!![],'where':{'id':_0x3e9e20['params']['id']}},_0x2e63c4={};_0x2e63c4[_0x9512('0x30')]=_['keys'](db[_0x9512('0x2c')][_0x9512('0x2d')]);_0x2e63c4[_0x9512('0x31')]=_[_0x9512('0x32')](_0x3e9e20[_0x9512('0x31')]);_0x2e63c4['filters']=_[_0x9512('0x33')](_0x2e63c4['model'],_0x2e63c4[_0x9512('0x31')]);_0x39cdd7[_0x9512('0x34')]=_['intersection'](_0x2e63c4[_0x9512('0x30')],qs[_0x9512('0x35')](_0x3e9e20[_0x9512('0x31')][_0x9512('0x35')]));_0x39cdd7[_0x9512('0x34')]=_0x39cdd7['attributes']['length']?_0x39cdd7[_0x9512('0x34')]:_0x2e63c4['model'];if(_0x3e9e20[_0x9512('0x31')]['includeAll']){_0x39cdd7[_0x9512('0x46')]=[{'all':!![]}];}_0x39cdd7=_[_0x9512('0x40')]({},_0x39cdd7,_0x3e9e20[_0x9512('0x47')]);return db[_0x9512('0x2c')][_0x9512('0x48')](_0x39cdd7)['then'](handleEntityNotFound(_0x4474f3,null))[_0x9512('0x24')](respondWithResult(_0x4474f3,null))[_0x9512('0x44')](handleError(_0x4474f3,null));};exports[_0x9512('0x49')]=function(_0x1bbf86,_0x477291){return db[_0x9512('0x2c')]['create'](_0x1bbf86[_0x9512('0x4a')],{})[_0x9512('0x24')](respondWithResult(_0x477291,0xc9))['catch'](handleError(_0x477291,null));};exports['update']=function(_0x7f3930,_0x277d04){if(_0x7f3930[_0x9512('0x4a')]['id']){delete _0x7f3930['body']['id'];}return db[_0x9512('0x2c')][_0x9512('0x48')]({'where':{'id':_0x7f3930[_0x9512('0x4b')]['id']}})['then'](handleEntityNotFound(_0x277d04,null))[_0x9512('0x24')](saveUpdates(_0x7f3930[_0x9512('0x4a')],null))[_0x9512('0x24')](respondWithResult(_0x277d04,null))[_0x9512('0x44')](handleError(_0x277d04,null));};exports[_0x9512('0x25')]=function(_0x2f3f9a,_0x4300d9){return db[_0x9512('0x2c')][_0x9512('0x48')]({'where':{'id':_0x2f3f9a[_0x9512('0x4b')]['id']}})[_0x9512('0x24')](handleEntityNotFound(_0x4300d9,null))['then'](removeEntity(_0x4300d9,null))[_0x9512('0x44')](handleError(_0x4300d9,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8701c47..fb72581 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 _0xfb99=['dtm','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event'];(function(_0xf200b0,_0x16c9fd){var _0x1270bc=function(_0x340c0c){while(--_0x340c0c){_0xf200b0['push'](_0xf200b0['shift']());}};_0x1270bc(++_0x16c9fd);}(_0xfb99,0x1e1));var _0x9fb9=function(_0x5bd151,_0x4d80e9){_0x5bd151=_0x5bd151-0x0;var _0x57b703=_0xfb99[_0x5bd151];return _0x57b703;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9fb9('0x0'))('api');var moment=require(_0x9fb9('0x1'));var BPromise=require(_0x9fb9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fb9('0x3'));var rimraf=require(_0x9fb9('0x4'));var config=require(_0x9fb9('0x5'));var attributes=require('./voiceQueuesLog.attributes');module[_0x9fb9('0x6')]=function(_0x40ec37,_0x3bfa3){return _0x40ec37[_0x9fb9('0x7')](_0x9fb9('0x8'),attributes,{'tableName':_0x9fb9('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x9fb9('0xa'),_0x9fb9('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xbc6c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util'];(function(_0x33aa42,_0x19b09f){var _0x195523=function(_0x3b7d76){while(--_0x3b7d76){_0x33aa42['push'](_0x33aa42['shift']());}};_0x195523(++_0x19b09f);}(_0xbc6c,0x1b1));var _0xcbc6=function(_0x2faa6d,_0x61cafc){_0x2faa6d=_0x2faa6d-0x0;var _0x3ba28d=_0xbc6c[_0x2faa6d];return _0x3ba28d;};'use strict';var _=require('lodash');var util=require(_0xcbc6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcbc6('0x1'));var BPromise=require(_0xcbc6('0x2'));var rp=require(_0xcbc6('0x3'));var fs=require('fs');var path=require(_0xcbc6('0x4'));var rimraf=require(_0xcbc6('0x5'));var config=require(_0xcbc6('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0xcbc6('0x7')]=function(_0x57792f,_0x44c786){return _0x57792f[_0xcbc6('0x8')](_0xcbc6('0x9'),attributes,{'tableName':_0xcbc6('0xa'),'paranoid':![],'indexes':[{'name':_0xcbc6('0xb'),'fields':[_0xcbc6('0xc'),_0xcbc6('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index bd378ea..9599c7d 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 _0x5308=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x5d3e8d,_0x4479e9){var _0x2a2644=function(_0x2bf7fd){while(--_0x2bf7fd){_0x5d3e8d['push'](_0x5d3e8d['shift']());}};_0x2a2644(++_0x4479e9);}(_0x5308,0x11c));var _0x8530=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0x5308[_0x5179a5];return _0x15c8ce;};'use strict';var _=require('lodash');var util=require(_0x8530('0x0'));var moment=require(_0x8530('0x1'));var BPromise=require(_0x8530('0x2'));var rs=require(_0x8530('0x3'));var fs=require('fs');var Redis=require(_0x8530('0x4'));var db=require(_0x8530('0x5'))['db'];var utils=require(_0x8530('0x6'));var logger=require(_0x8530('0x7'))('rpc');var config=require(_0x8530('0x8'));var jayson=require(_0x8530('0x9'));var client=jayson[_0x8530('0xa')][_0x8530('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a5018,_0x3729c4,_0x5c4895){return new BPromise(function(_0x41dd67,_0x8459dd){return client[_0x8530('0xc')](_0x1a5018,_0x5c4895)[_0x8530('0xd')](function(_0x1091fa){logger[_0x8530('0xe')](_0x8530('0xf'),_0x3729c4,_0x8530('0x10'));logger['debug'](_0x8530('0x11'),_0x3729c4,_0x8530('0x10'),JSON[_0x8530('0x12')](_0x1091fa));if(_0x1091fa[_0x8530('0x13')]){if(_0x1091fa[_0x8530('0x13')][_0x8530('0x14')]===0x1f4){logger[_0x8530('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3729c4,_0x1091fa[_0x8530('0x13')][_0x8530('0x15')]);return _0x8459dd(_0x1091fa[_0x8530('0x13')]['message']);}logger[_0x8530('0x13')](_0x8530('0xf'),_0x3729c4,_0x1091fa[_0x8530('0x13')][_0x8530('0x15')]);return _0x41dd67(_0x1091fa[_0x8530('0x13')][_0x8530('0x15')]);}else{logger[_0x8530('0xe')](_0x8530('0xf'),_0x3729c4,_0x8530('0x10'));_0x41dd67(_0x1091fa[_0x8530('0x16')][_0x8530('0x15')]);}})[_0x8530('0x17')](function(_0x558824){logger[_0x8530('0x13')](_0x8530('0xf'),_0x3729c4,_0x558824);_0x8459dd(_0x558824);});});} \ No newline at end of file +var _0x7cc4=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x300b38,_0x144a20){var _0x540061=function(_0x4d6b9a){while(--_0x4d6b9a){_0x300b38['push'](_0x300b38['shift']());}};_0x540061(++_0x144a20);}(_0x7cc4,0x1a8));var _0x47cc=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x7cc4[_0x47e7cb];return _0x2a8874;};'use strict';var _=require('lodash');var util=require(_0x47cc('0x0'));var moment=require(_0x47cc('0x1'));var BPromise=require(_0x47cc('0x2'));var rs=require(_0x47cc('0x3'));var fs=require('fs');var Redis=require(_0x47cc('0x4'));var db=require(_0x47cc('0x5'))['db'];var utils=require(_0x47cc('0x6'));var logger=require('../../config/logger')(_0x47cc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x47cc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a9b7f,_0x30d4f5,_0x21f13e){return new BPromise(function(_0x6718f7,_0x4b76f8){return client[_0x47cc('0x9')](_0x2a9b7f,_0x21f13e)[_0x47cc('0xa')](function(_0x5bf134){logger[_0x47cc('0xb')](_0x47cc('0xc'),_0x30d4f5,_0x47cc('0xd'));logger[_0x47cc('0xe')](_0x47cc('0xf'),_0x30d4f5,_0x47cc('0xd'),JSON[_0x47cc('0x10')](_0x5bf134));if(_0x5bf134[_0x47cc('0x11')]){if(_0x5bf134[_0x47cc('0x11')][_0x47cc('0x12')]===0x1f4){logger['error'](_0x47cc('0xc'),_0x30d4f5,_0x5bf134[_0x47cc('0x11')]['message']);return _0x4b76f8(_0x5bf134['error']['message']);}logger[_0x47cc('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x30d4f5,_0x5bf134[_0x47cc('0x11')]['message']);return _0x6718f7(_0x5bf134[_0x47cc('0x11')][_0x47cc('0x13')]);}else{logger[_0x47cc('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x30d4f5,_0x47cc('0xd'));_0x6718f7(_0x5bf134[_0x47cc('0x14')][_0x47cc('0x13')]);}})[_0x47cc('0x15')](function(_0x353c53){logger[_0x47cc('0x11')](_0x47cc('0xc'),_0x30d4f5,_0x353c53);_0x4b76f8(_0x353c53);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 671ddfd..63d63fe 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 _0xe8d9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','put','update','delete','path','connect-timeout','express','Router','fs-extra'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xe8d9,0x159));var _0x9e8d=function(_0x334495,_0x12630f){_0x334495=_0x334495-0x0;var _0x39f309=_0xe8d9[_0x334495];return _0x39f309;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e8d('0x0'));var timeout=require(_0x9e8d('0x1'));var express=require(_0x9e8d('0x2'));var router=express[_0x9e8d('0x3')]();var fs_extra=require(_0x9e8d('0x4'));var auth=require(_0x9e8d('0x5'));var interaction=require(_0x9e8d('0x6'));var config=require(_0x9e8d('0x7'));var controller=require(_0x9e8d('0x8'));router[_0x9e8d('0x9')]('/',auth[_0x9e8d('0xa')](),controller[_0x9e8d('0xb')]);router[_0x9e8d('0x9')](_0x9e8d('0xc'),auth[_0x9e8d('0xa')](),controller[_0x9e8d('0xd')]);router['get'](_0x9e8d('0xe'),auth[_0x9e8d('0xa')](),controller[_0x9e8d('0xf')]);router['get'](_0x9e8d('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x9e8d('0x9')](_0x9e8d('0x11'),controller[_0x9e8d('0x12')]);router[_0x9e8d('0x9')](_0x9e8d('0x13'),auth[_0x9e8d('0xa')](),controller[_0x9e8d('0x14')]);router[_0x9e8d('0x15')]('/',auth[_0x9e8d('0xa')](),controller['create']);router[_0x9e8d('0x15')]('/:id/transcribe',auth[_0x9e8d('0xa')](),controller['runTranscribe']);router[_0x9e8d('0x16')](_0x9e8d('0xe'),auth[_0x9e8d('0xa')](),controller[_0x9e8d('0x17')]);router[_0x9e8d('0x18')](_0x9e8d('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbaf3=['downloadTranscribe','create','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','isAuthenticated','describe','/:id/download','download','downloads','/:id/transcribe'];(function(_0x1383ac,_0x1017bc){var _0x18c6f4=function(_0x1aaee0){while(--_0x1aaee0){_0x1383ac['push'](_0x1383ac['shift']());}};_0x18c6f4(++_0x1017bc);}(_0xbaf3,0xc9));var _0x3baf=function(_0x118da4,_0x2e192e){_0x118da4=_0x118da4-0x0;var _0x40dfbb=_0xbaf3[_0x118da4];return _0x40dfbb;};'use strict';var multer=require(_0x3baf('0x0'));var util=require(_0x3baf('0x1'));var path=require(_0x3baf('0x2'));var timeout=require(_0x3baf('0x3'));var express=require('express');var router=express[_0x3baf('0x4')]();var fs_extra=require(_0x3baf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3baf('0x6'));var controller=require(_0x3baf('0x7'));router[_0x3baf('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3baf('0x8')]('/describe',auth[_0x3baf('0x9')](),controller[_0x3baf('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3baf('0x8')](_0x3baf('0xb'),auth[_0x3baf('0x9')](),controller[_0x3baf('0xc')]);router[_0x3baf('0x8')]('/:id/downloads',controller[_0x3baf('0xd')]);router['get'](_0x3baf('0xe'),auth[_0x3baf('0x9')](),controller[_0x3baf('0xf')]);router['post']('/',auth[_0x3baf('0x9')](),controller[_0x3baf('0x10')]);router[_0x3baf('0x11')](_0x3baf('0xe'),auth[_0x3baf('0x9')](),controller['runTranscribe']);router[_0x3baf('0x12')](_0x3baf('0x13'),auth[_0x3baf('0x9')](),controller[_0x3baf('0x14')]);router[_0x3baf('0x15')]('/:id',auth[_0x3baf('0x9')](),controller[_0x3baf('0x16')]);module[_0x3baf('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 2e1b3c9..6ba1209 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 1c2efe7..63f7d28 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 _0xc6c2=['query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','VoiceRecording','rows','catch','show','params','find','create','body','describe','../../components/encryptor','uniqueid','value','existsSync','secrets','recording','Sequelize','ValidationError','filename','download','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','token','$and','push','%s.cypher','decryptFile','info','cancellazione\x20fisica\x20documento\x20%s','isNil','.cypher','File:\x20\x22','unlinkSync','listBuckets','createBucket','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','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','differenceBy','format'];(function(_0x41b9f7,_0x1e7e06){var _0x209af8=function(_0x163e2e){while(--_0x163e2e){_0x41b9f7['push'](_0x41b9f7['shift']());}};_0x209af8(++_0x1e7e06);}(_0xc6c2,0xfa));var _0x2c6c=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0xc6c2[_0x28a5ad];return _0x176b8a;};'use strict';var emlformat=require(_0x2c6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c6c('0x1'));var jsonpatch=require(_0x2c6c('0x2'));var rp=require(_0x2c6c('0x3'));var moment=require(_0x2c6c('0x4'));var BPromise=require(_0x2c6c('0x5'));var Mustache=require(_0x2c6c('0x6'));var util=require(_0x2c6c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2c6c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c6c('0x9'));var _=require(_0x2c6c('0xa'));var squel=require('squel');var crypto=require(_0x2c6c('0xb'));var jsforce=require(_0x2c6c('0xc'));var deskjs=require(_0x2c6c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2c6c('0xe'));var Papa=require(_0x2c6c('0xf'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0x2c6c('0x10'));var qs=require(_0x2c6c('0x11'));var as=require(_0x2c6c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2c6c('0x13'));var utils=require(_0x2c6c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2c6c('0x15'));var db=require(_0x2c6c('0x16'))['db'];function respondWithStatusCode(_0x5cc572,_0x3f52a3){_0x3f52a3=_0x3f52a3||0xcc;return function(_0x508747){if(_0x508747){return _0x5cc572[_0x2c6c('0x17')](_0x3f52a3);}return _0x5cc572[_0x2c6c('0x18')](_0x3f52a3)[_0x2c6c('0x19')]();};}function respondWithResult(_0x4c2545,_0x3671a8){_0x3671a8=_0x3671a8||0xc8;return function(_0x41dadc){if(_0x41dadc){return _0x4c2545[_0x2c6c('0x18')](_0x3671a8)[_0x2c6c('0x1a')](_0x41dadc);}};}function respondWithFilteredResult(_0x146c14,_0x1da77d){return function(_0x4fadd2){if(_0x4fadd2){var _0x53c6e9=typeof _0x1da77d[_0x2c6c('0x1b')]===_0x2c6c('0x1c')&&typeof _0x1da77d['limit']==='undefined';var _0x14179f=_0x4fadd2[_0x2c6c('0x1d')];var _0xb71311=_0x53c6e9?0x0:_0x1da77d[_0x2c6c('0x1b')];var _0x15315b=_0x53c6e9?_0x4fadd2[_0x2c6c('0x1d')]:_0x1da77d['offset']+_0x1da77d[_0x2c6c('0x1e')];var _0x3ddbac;if(_0x15315b>=_0x14179f){_0x15315b=_0x14179f;_0x3ddbac=0xc8;}else{_0x3ddbac=0xce;}_0x146c14[_0x2c6c('0x18')](_0x3ddbac);return _0x146c14[_0x2c6c('0x1f')](_0x2c6c('0x20'),_0xb71311+'-'+_0x15315b+'/'+_0x14179f)['json'](_0x4fadd2);}return null;};}function patchUpdates(_0x58785b){return function(_0x5b1028){try{jsonpatch[_0x2c6c('0x21')](_0x5b1028,_0x58785b,!![]);}catch(_0x254ddf){return BPromise['reject'](_0x254ddf);}return _0x5b1028[_0x2c6c('0x22')]();};}function saveUpdates(_0x130cb7,_0x116619){return function(_0x1f1179){if(_0x1f1179){return _0x1f1179[_0x2c6c('0x23')](_0x130cb7)[_0x2c6c('0x24')](function(_0x44bc86){return _0x44bc86;});}return null;};}function removeEntity(_0x157455,_0xf4e8b9){return function(_0x382968){if(_0x382968){return _0x382968[_0x2c6c('0x25')]()[_0x2c6c('0x24')](function(){_0x157455[_0x2c6c('0x18')](0xcc)[_0x2c6c('0x19')]();});}};}function handleEntityNotFound(_0x5768fb,_0x9f10b){return function(_0x47fdca){if(!_0x47fdca){_0x5768fb[_0x2c6c('0x17')](0x194);}return _0x47fdca;};}function handleError(_0x5275ec,_0x2c98c8){_0x2c98c8=_0x2c98c8||0x1f4;return function(_0x5602e6){logger['error'](_0x5602e6[_0x2c6c('0x26')]);if(_0x5602e6[_0x2c6c('0x27')]){delete _0x5602e6[_0x2c6c('0x27')];}_0x5275ec[_0x2c6c('0x18')](_0x2c98c8)[_0x2c6c('0x28')](_0x5602e6);};}exports[_0x2c6c('0x29')]=function(_0x1a6fe5,_0x197732){var _0x19111d={},_0x1f5280={},_0x2e91b5={'count':0x0,'rows':[]};var _0x3d541e=_[_0x2c6c('0x2a')](db['VoiceRecording'][_0x2c6c('0x2b')],function(_0x3be2ed){return{'name':_0x3be2ed[_0x2c6c('0x2c')],'type':_0x3be2ed['type'][_0x2c6c('0x2d')]};});_0x1f5280['model']=_[_0x2c6c('0x2e')](_[_0x2c6c('0x2a')](_0x3d541e,_0x2c6c('0x27')),[_0x2c6c('0x2f')]);_0x1f5280[_0x2c6c('0x30')]=_[_0x2c6c('0x31')](_0x1a6fe5[_0x2c6c('0x30')]);_0x1f5280[_0x2c6c('0x32')]=_[_0x2c6c('0x33')](_0x1f5280['model'],_0x1f5280[_0x2c6c('0x30')]);_0x19111d[_0x2c6c('0x34')]=_[_0x2c6c('0x33')](_0x1f5280[_0x2c6c('0x35')],qs[_0x2c6c('0x36')](_0x1a6fe5['query']['fields']));_0x19111d['attributes']=_0x19111d['attributes'][_0x2c6c('0x37')]?_0x19111d['attributes']:_0x1f5280[_0x2c6c('0x35')];if(!_0x1a6fe5[_0x2c6c('0x30')][_0x2c6c('0x38')](_0x2c6c('0x39'))){_0x19111d[_0x2c6c('0x1e')]=qs[_0x2c6c('0x1e')](_0x1a6fe5[_0x2c6c('0x30')][_0x2c6c('0x1e')]);_0x19111d[_0x2c6c('0x1b')]=qs[_0x2c6c('0x1b')](_0x1a6fe5[_0x2c6c('0x30')][_0x2c6c('0x1b')]);}_0x19111d[_0x2c6c('0x3a')]=qs['sort'](_0x1a6fe5[_0x2c6c('0x30')][_0x2c6c('0x3b')]);_0x19111d[_0x2c6c('0x3c')]=qs[_0x2c6c('0x32')](_[_0x2c6c('0x3d')](_0x1a6fe5[_0x2c6c('0x30')],_0x1f5280[_0x2c6c('0x32')]),_0x3d541e);if(_0x1a6fe5['query']['filter']){_0x19111d['where']=_[_0x2c6c('0x3e')](_0x19111d['where'],{'$or':_['map'](_0x3d541e,function(_0xd45e7){if(_0xd45e7[_0x2c6c('0x3f')]!==_0x2c6c('0x40')){var _0x1bb71a={};_0x1bb71a[_0xd45e7[_0x2c6c('0x27')]]={'$like':'%'+_0x1a6fe5[_0x2c6c('0x30')]['filter']+'%'};return _0x1bb71a;}})});}_0x19111d=_[_0x2c6c('0x3e')]({},_0x19111d,_0x1a6fe5[_0x2c6c('0x41')]);var _0x1a7370={'where':_0x19111d[_0x2c6c('0x3c')]};return db['VoiceRecording'][_0x2c6c('0x1d')](_0x1a7370)[_0x2c6c('0x24')](function(_0x32569e){_0x2e91b5[_0x2c6c('0x1d')]=_0x32569e;if(_0x1a6fe5['query'][_0x2c6c('0x42')]){_0x19111d[_0x2c6c('0x43')]=[{'all':!![]}];}return db[_0x2c6c('0x44')]['findAll'](_0x19111d);})[_0x2c6c('0x24')](function(_0xb6104d){_0x2e91b5[_0x2c6c('0x45')]=_0xb6104d;return _0x2e91b5;})[_0x2c6c('0x24')](respondWithFilteredResult(_0x197732,_0x19111d))[_0x2c6c('0x46')](handleError(_0x197732,null));};exports[_0x2c6c('0x47')]=function(_0x59f104,_0x1ca053){var _0xd20993={'raw':![],'where':{'id':_0x59f104[_0x2c6c('0x48')]['id']}},_0x3496d4={};_0x3496d4['model']=_['keys'](db[_0x2c6c('0x44')][_0x2c6c('0x2b')]);_0x3496d4[_0x2c6c('0x30')]=_[_0x2c6c('0x31')](_0x59f104['query']);_0x3496d4[_0x2c6c('0x32')]=_[_0x2c6c('0x33')](_0x3496d4[_0x2c6c('0x35')],_0x3496d4['query']);_0xd20993[_0x2c6c('0x34')]=_[_0x2c6c('0x33')](_0x3496d4[_0x2c6c('0x35')],qs['fields'](_0x59f104[_0x2c6c('0x30')]['fields']));_0xd20993[_0x2c6c('0x34')]=_0xd20993['attributes']['length']?_0xd20993[_0x2c6c('0x34')]:_0x3496d4['model'];if(_0x59f104['query'][_0x2c6c('0x42')]){_0xd20993['include']=[{'all':!![]}];}_0xd20993=_[_0x2c6c('0x3e')]({},_0xd20993,_0x59f104[_0x2c6c('0x41')]);return db[_0x2c6c('0x44')][_0x2c6c('0x49')](_0xd20993)[_0x2c6c('0x24')](handleEntityNotFound(_0x1ca053,null))[_0x2c6c('0x24')](respondWithResult(_0x1ca053,null))[_0x2c6c('0x46')](handleError(_0x1ca053,null));};exports[_0x2c6c('0x4a')]=function(_0x105ce6,_0x5d945d){return db[_0x2c6c('0x44')][_0x2c6c('0x4a')](_0x105ce6[_0x2c6c('0x4b')],{})[_0x2c6c('0x24')](respondWithResult(_0x5d945d,0xc9))['catch'](handleError(_0x5d945d,null));};exports[_0x2c6c('0x23')]=function(_0xaa293d,_0x1a3290){if(_0xaa293d[_0x2c6c('0x4b')]['id']){delete _0xaa293d['body']['id'];}return db['VoiceRecording'][_0x2c6c('0x49')]({'where':{'id':_0xaa293d[_0x2c6c('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a3290,null))[_0x2c6c('0x24')](saveUpdates(_0xaa293d['body'],null))['then'](respondWithResult(_0x1a3290,null))[_0x2c6c('0x46')](handleError(_0x1a3290,null));};exports[_0x2c6c('0x4c')]=function(_0x2ad94b,_0x9b274a){return db['VoiceRecording']['describe']()[_0x2c6c('0x24')](respondWithResult(_0x9b274a,null))[_0x2c6c('0x46')](handleError(_0x9b274a,null));};exports['download']=function(_0xda07d4,_0x1640c2,_0x143ddb){var _0x62cfd7=require(_0x2c6c('0x4d'));var _0x59e162=![];var _0x26f35c={};if(_0xda07d4[_0x2c6c('0x30')][_0x2c6c('0x3f')]&&_0xda07d4[_0x2c6c('0x30')]['type']===_0x2c6c('0x4e')){_0x26f35c[_0x2c6c('0x4e')]=_0xda07d4['params']['id'];}else{_0x26f35c['id']=_0xda07d4[_0x2c6c('0x48')]['id'];}return db[_0x2c6c('0x44')][_0x2c6c('0x49')]({'where':_0x26f35c,'attributes':['id','value'],'raw':!![]})[_0x2c6c('0x24')](handleEntityNotFound(_0x1640c2,null))[_0x2c6c('0x24')](function(_0x95c42f){if(_0x95c42f){var _0x126c65=_0x95c42f[_0x2c6c('0x4f')];var _0x2c2e00=util['format']('%s.cypher',_0x126c65);if(fs[_0x2c6c('0x50')](_0x2c2e00)){_0x59e162=!![];return _0x62cfd7['decryptFile'](_0x2c2e00,_0x126c65,config[_0x2c6c('0x51')][_0x2c6c('0x52')])['then'](function(){return _0x95c42f;});}return _0x95c42f;}})[_0x2c6c('0x24')](function(_0x4d69f7){if(_0x4d69f7){var _0x5050ab=_0x4d69f7[_0x2c6c('0x4f')];if(!fs[_0x2c6c('0x50')](_0x5050ab)){throw new db[(_0x2c6c('0x53'))][(_0x2c6c('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x4d69f7[_0x2c6c('0x55')]){return _0x1640c2[_0x2c6c('0x56')](_0x5050ab,_0x4d69f7['filename']+path[_0x2c6c('0x57')](_0x5050ab),function(){if(_0x59e162){fs[_0x2c6c('0x58')](_0x5050ab);}});}else{return _0x1640c2[_0x2c6c('0x56')](_0x5050ab,function(_0x5b85f7){if(_0x59e162){fs[_0x2c6c('0x58')](_0x5050ab);}});}}})[_0x2c6c('0x46')](function(_0x32b282){if(_0x32b282[_0x2c6c('0x59')]===_0x2c6c('0x5a')){_0x1640c2[_0x2c6c('0x18')](0x194)['send'](_0x2c6c('0x5b'));}else{return handleError(_0x1640c2,null);}});};exports[_0x2c6c('0x5c')]=function(_0x5179f8,_0x3b7897,_0x42610a){var _0x2dacc0=require(_0x2c6c('0x4d'));var _0x14e03d=![];var _0x2116a9={'$and':[db[_0x2c6c('0x5d')][_0x2c6c('0x3c')](db['sequelize']['fn']('MD5',db[_0x2c6c('0x5d')]['col'](_0x2c6c('0x4e'))),_0x5179f8[_0x2c6c('0x30')][_0x2c6c('0x5e')])]};if(_0x5179f8[_0x2c6c('0x30')]['type']&&_0x5179f8[_0x2c6c('0x30')][_0x2c6c('0x3f')]===_0x2c6c('0x4e')){_0x2116a9[_0x2c6c('0x5f')][_0x2c6c('0x60')]({'uniqueid':_0x5179f8[_0x2c6c('0x48')]['id']});}else{_0x2116a9['$and'][_0x2c6c('0x60')]({'id':_0x5179f8[_0x2c6c('0x48')]['id']});}return db[_0x2c6c('0x44')]['find']({'where':_0x2116a9,'attributes':['id',_0x2c6c('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x3b7897,null))[_0x2c6c('0x24')](function(_0x362fca){if(_0x362fca){var _0x31869b=util[_0x2c6c('0x2f')](_0x2c6c('0x61'),_0x362fca[_0x2c6c('0x4f')]);if(fs[_0x2c6c('0x50')](_0x31869b)){_0x14e03d=!![];return _0x2dacc0[_0x2c6c('0x62')](_0x31869b,_0x362fca[_0x2c6c('0x4f')],config[_0x2c6c('0x51')][_0x2c6c('0x52')])[_0x2c6c('0x24')](function(){return _0x362fca;});}return _0x362fca;}})[_0x2c6c('0x24')](function(_0x36ed78){if(_0x36ed78){if(!fs[_0x2c6c('0x50')](_0x36ed78[_0x2c6c('0x4f')])){throw new db[(_0x2c6c('0x53'))]['ValidationError'](_0x2c6c('0x5a'));}if(_0x36ed78[_0x2c6c('0x55')]){return _0x3b7897[_0x2c6c('0x56')](_0x36ed78[_0x2c6c('0x4f')],_0x36ed78[_0x2c6c('0x55')]+path[_0x2c6c('0x57')](_0x36ed78[_0x2c6c('0x4f')]),function(){if(_0x14e03d){fs[_0x2c6c('0x58')](_0x36ed78[_0x2c6c('0x4f')]);}});}else{return _0x3b7897[_0x2c6c('0x56')](_0x36ed78[_0x2c6c('0x4f')],function(_0x553f74){if(_0x14e03d){fs[_0x2c6c('0x58')](_0x36ed78[_0x2c6c('0x4f')]);}});}}})[_0x2c6c('0x46')](handleError(_0x3b7897,null));};exports['destroy']=function(_0x2ee42a,_0x251075){return db[_0x2c6c('0x44')][_0x2c6c('0x49')]({'where':{'id':_0x2ee42a['params']['id']}})[_0x2c6c('0x24')](function(_0x248345){if(_['isNil'](_0x248345)){throw new ReferenceError('Entity\x20not\x20found');}return _0x248345;})[_0x2c6c('0x24')](function(_0x5579b9){var _0x18240d=_0x5579b9['value'];logger[_0x2c6c('0x63')](_0x2c6c('0x64'),_0x18240d);if(!_[_0x2c6c('0x65')](_0x5579b9['value'])&&fs[_0x2c6c('0x50')](_0x18240d)){logger[_0x2c6c('0x63')]('File:\x20\x22'+_0x18240d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x18240d);}_0x18240d=_0x18240d+_0x2c6c('0x66');if(!_[_0x2c6c('0x65')](_0x5579b9[_0x2c6c('0x4f')])&&fs[_0x2c6c('0x50')](_0x18240d)){logger['info'](_0x2c6c('0x67')+_0x18240d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2c6c('0x68')](_0x18240d);}return _0x5579b9;})['then'](function(_0x35f592){if(!_0x35f592)throw new InternalError();return _0x35f592['destroy']();})['then'](function(){_0x251075[_0x2c6c('0x18')](0xcc)[_0x2c6c('0x19')]();})[_0x2c6c('0x46')](handleError(_0x251075,null));};function getBucketslist(_0x31a5f2,_0x5e376d,_0x5112bc){return new Promise(function(_0x48bc3e,_0x3a3bac){var _0x499c64=new AWS['S3']({'accessKeyId':_0x5e376d,'secretAccessKey':_0x31a5f2,'region':_0x5112bc});_0x499c64[_0x2c6c('0x69')]({},function(_0xfa3477,_0x46776a){if(_0xfa3477){return _0x3a3bac(_0xfa3477);}else{return _0x48bc3e(_0x46776a);}});});}function createBucket(_0x6d084d,_0x333bb1,_0x40103f,_0x3e0f13){return new Promise(function(_0x65e5c5,_0x4b3776){var _0x122e6c=new AWS['S3']({'accessKeyId':_0x333bb1,'secretAccessKey':_0x6d084d,'region':_0x40103f});_0x122e6c[_0x2c6c('0x6a')]({'Bucket':_0x3e0f13},function(_0x5e2ace,_0x179476){if(_0x5e2ace){return _0x4b3776(_0x5e2ace);}else{return _0x65e5c5(_0x179476);}});});}function uploadFile(_0x339216,_0x288785,_0x1c13e4,_0xe0dd4d,_0x126a11,_0x476f4b){return new Promise(function(_0x390a4e,_0x39ece3){var _0xc148b8=new AWS['S3']({'accessKeyId':_0x288785,'secretAccessKey':_0x339216,'region':_0x1c13e4});_0xc148b8['upload']({'Bucket':_0xe0dd4d,'Key':_0x126a11,'Body':_0x476f4b},function(_0x55a04b,_0x476bb3){if(_0x55a04b){return _0x39ece3(_0x55a04b);}else{return _0x390a4e(_0x476bb3);}});});}function startTranscribe(_0x48b703,_0x590aa0,_0x48949c,_0x154b97,_0x1dff99,_0x2ffb4d){return new Promise(function(_0x4871db,_0x46cd65){var _0x1e33bd=new AWS[(_0x2c6c('0x6b'))]({'accessKeyId':_0x590aa0,'secretAccessKey':_0x48b703,'region':_0x48949c});_0x1e33bd[_0x2c6c('0x6c')]({'TranscriptionJobName':_0x154b97,'LanguageCode':_0x1dff99,'Media':{'MediaFileUri':_0x2ffb4d}},function(_0x14a047,_0x62a093){if(_0x14a047){return _0x46cd65(_0x14a047);}else{return _0x4871db(_0x62a093);}});});}function transcribe(_0x5f34d0,_0x5901a8,_0x5424b8,_0x27cbdb,_0x47dd6d,_0x41c54e,_0x4d1c48){return new Promise(function(_0x5d8d3f,_0x30e819){var _0xc2f513={};logger[_0x2c6c('0x63')](util[_0x2c6c('0x2f')](_0x2c6c('0x6d'),_0x5f34d0,_0x47dd6d));return uploadFile(_0x5901a8,_0x5424b8,_0x27cbdb,_0x47dd6d,path[_0x2c6c('0x6e')](_0x41c54e),fs['readFileSync'](_0x41c54e))['then'](function(_0x5c6745){logger[_0x2c6c('0x63')](util[_0x2c6c('0x2f')](_0x2c6c('0x6f'),_0x5f34d0,_0x47dd6d,_0x5c6745['Location']));_0xc2f513[_0x2c6c('0x70')]=_0x5c6745[_0x2c6c('0x71')];_0xc2f513[_0x2c6c('0x72')]=_0x5c6745[_0x2c6c('0x73')];logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x5f34d0));return startTranscribe(_0x5901a8,_0x5424b8,_0x27cbdb,uuidv4(),_0x4d1c48,_0x5c6745['Location']);})['then'](function(_0x3ea537){logger[_0x2c6c('0x63')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x5f34d0,_0x3ea537['TranscriptionJob']['TranscriptionJobName']));_0xc2f513[_0x2c6c('0x74')]=_0x3ea537[_0x2c6c('0x75')][_0x2c6c('0x76')];_0xc2f513[_0x2c6c('0x77')]=_0x3ea537[_0x2c6c('0x75')][_0x2c6c('0x78')];return _0x5d8d3f(_0xc2f513);})[_0x2c6c('0x46')](function(_0x4edbd5){return _0x30e819(_0x4edbd5);});});}exports[_0x2c6c('0x79')]=function(_0xfb1a4,_0xe4031,_0x58cd33){var _0x3debb4;var _0x388c34;var _0x462849;var _0x31c327=require(_0x2c6c('0x4d'));return db[_0x2c6c('0x44')]['findOne']({'where':{'id':_0xfb1a4[_0x2c6c('0x48')]['id']}})[_0x2c6c('0x24')](function(_0xcb5024){if(_0xcb5024){var _0x2c2f13=util[_0x2c6c('0x2f')](_0x2c6c('0x61'),_0xcb5024['value']);if(fs['existsSync'](_0x2c2f13)){cypher=!![];return _0x31c327[_0x2c6c('0x62')](_0x2c2f13,_0xcb5024[_0x2c6c('0x4f')],config[_0x2c6c('0x51')][_0x2c6c('0x52')])[_0x2c6c('0x24')](function(){return _0xcb5024;});}return _0xcb5024;}})[_0x2c6c('0x24')](function(_0x3379de){if(!_0x3379de){throw new db[(_0x2c6c('0x53'))][(_0x2c6c('0x54'))](_0x2c6c('0x7a'));}_0x388c34=_0x3379de;return db[_0x2c6c('0x7b')][_0x2c6c('0x7c')]({'where':{'id':0x1}});})[_0x2c6c('0x24')](handleEntityNotFound(_0xe4031,null))[_0x2c6c('0x24')](function(_0x31d523){if(_0x31d523){_0x3debb4=_0x31d523;if(!_0x3debb4['transcribe']||!_0x3debb4['transcribeAccountId']||!_0x3debb4[_0x2c6c('0x7d')]||!_0x3debb4[_0x2c6c('0x7e')]||!_0x3debb4[_0x2c6c('0x70')]){throw new db[(_0x2c6c('0x53'))][(_0x2c6c('0x54'))]('Transcribe\x20not\x20configured');}if(_0xfb1a4[_0x2c6c('0x4b')][_0x2c6c('0x7f')]&&(!_0x3debb4[_0x2c6c('0x80')]||!_0x3debb4[_0x2c6c('0x81')]||!_0x3debb4[_0x2c6c('0x82')]||!_0x3debb4[_0x2c6c('0x7e')]||!_0x3debb4[_0x2c6c('0x70')])){throw new db[(_0x2c6c('0x53'))][(_0x2c6c('0x54'))](_0x2c6c('0x83'));}return db[_0x2c6c('0x84')][_0x2c6c('0x7c')]({'where':{'id':_0x3debb4[_0x2c6c('0x85')]}});}})['then'](function(_0x272e2f){if(!_0x272e2f){throw new db[(_0x2c6c('0x53'))]['ValidationError'](_0x2c6c('0x86'));}if(!_0x272e2f[_0x2c6c('0x87')]||!_0x272e2f[_0x2c6c('0x88')]){throw new db[(_0x2c6c('0x53'))][(_0x2c6c('0x54'))](_0x2c6c('0x89'));}_0x462849=_0x272e2f;return getBucketslist(_0x462849[_0x2c6c('0x87')],_0x462849['data2'],_0x3debb4[_0x2c6c('0x7d')]);})[_0x2c6c('0x24')](function(_0x55e016){if(_0x55e016&&_0x55e016[_0x2c6c('0x8a')]){var _0x3784fd=_[_0x2c6c('0x49')](_0x55e016[_0x2c6c('0x8a')],function(_0x1844e7){return _0x1844e7[_0x2c6c('0x8b')]===_0x3debb4[_0x2c6c('0x70')];});if(!_0x3784fd){logger['info'](util['format'](_0x2c6c('0x8c'),_0xfb1a4[_0x2c6c('0x48')]['id'],_0x3debb4[_0x2c6c('0x70')]));return createBucket(_0x462849[_0x2c6c('0x87')],_0x462849[_0x2c6c('0x88')],_0x3debb4[_0x2c6c('0x7d')],_0x3debb4[_0x2c6c('0x70')]);}logger[_0x2c6c('0x63')](util[_0x2c6c('0x2f')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0xfb1a4[_0x2c6c('0x48')]['id'],_0x3debb4['bucket']));return;}})['then'](function(_0x73f1d0){if(_0x388c34[_0x2c6c('0x77')]==='NEW'){return transcribe(_0xfb1a4[_0x2c6c('0x48')]['id'],_0x462849[_0x2c6c('0x87')],_0x462849[_0x2c6c('0x88')],_0x3debb4[_0x2c6c('0x7d')],_0x3debb4[_0x2c6c('0x70')],_0x388c34[_0x2c6c('0x4f')],_0x3debb4[_0x2c6c('0x7e')]);}else{logger['info'](util[_0x2c6c('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0xfb1a4['params']['id']));return{'transcribeStatus':_0x2c6c('0x8d')};}})[_0x2c6c('0x24')](function(_0xbdd5ee){if(_0xbdd5ee){_0xbdd5ee[_0x2c6c('0x8e')]=_0xfb1a4[_0x2c6c('0x4b')]['runSentiment'];return _0x388c34['updateAttributes'](_0xbdd5ee);}})[_0x2c6c('0x24')](respondWithResult(_0xe4031,null))[_0x2c6c('0x46')](handleError(_0xe4031,null));};function writeFile(_0x35c55a,_0x3df729){return new Promise(function(_0x53ecd4,_0x11b45f){fs['writeFile'](_0x3df729,_0x35c55a,function(_0xfeed49,_0x460644){if(_0xfeed49){return _0x11b45f(_0xfeed49);}else{return _0x53ecd4(_0x460644);}});});}exports[_0x2c6c('0x8f')]=function(_0x53492f,_0x32c973,_0x289607){return db['VoiceRecording'][_0x2c6c('0x7c')]({'where':{'id':_0x53492f[_0x2c6c('0x48')]['id']}})[_0x2c6c('0x24')](handleEntityNotFound(_0x32c973))[_0x2c6c('0x24')](function(_0x151c20){if(_0x151c20&&_0x151c20[_0x2c6c('0x90')]){var _0x2982a2=_0x151c20[_0x2c6c('0x90')];var _0x448cef=config[_0x2c6c('0x91')]+_0x2c6c('0x92')+_0x151c20['id']+_0x2c6c('0x93');if(fs[_0x2c6c('0x50')](_0x448cef)){return _0x448cef;}return writeFile(_0x2982a2,_0x448cef)[_0x2c6c('0x24')](function(){return _0x448cef;});}else{throw new db[(_0x2c6c('0x53'))][(_0x2c6c('0x54'))](_0x2c6c('0x94'));}})['then'](function(_0x1c5892){return _0x32c973[_0x2c6c('0x56')](_0x1c5892);})[_0x2c6c('0x46')](handleError(_0x32c973));}; \ No newline at end of file +var _0x3cb9=['VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','$and','push','Sequelize','extname','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','isNil','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceRecording','includeAll','rows','show','params','include','find','catch','create','body','describe','download','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError'];(function(_0xf1f37e,_0x159a20){var _0x2e3a6d=function(_0x4163cd){while(--_0x4163cd){_0xf1f37e['push'](_0xf1f37e['shift']());}};_0x2e3a6d(++_0x159a20);}(_0x3cb9,0x17f));var _0x93cb=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x3cb9[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require(_0x93cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x93cb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x93cb('0x2'));var moment=require(_0x93cb('0x3'));var BPromise=require(_0x93cb('0x4'));var Mustache=require(_0x93cb('0x5'));var util=require(_0x93cb('0x6'));var path=require(_0x93cb('0x7'));var sox=require(_0x93cb('0x8'));var csv=require(_0x93cb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93cb('0xa'));var _=require(_0x93cb('0xb'));var squel=require(_0x93cb('0xc'));var crypto=require(_0x93cb('0xd'));var jsforce=require(_0x93cb('0xe'));var deskjs=require(_0x93cb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x93cb('0x10'));var Papa=require(_0x93cb('0x11'));var AWS=require(_0x93cb('0x12'));var uuidv4=require(_0x93cb('0x13'));var Redis=require(_0x93cb('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x93cb('0x15'));var as=require(_0x93cb('0x16'));var hardwareService=require(_0x93cb('0x17'));var logger=require(_0x93cb('0x18'))('api');var utils=require(_0x93cb('0x19'));var config=require(_0x93cb('0x1a'));var licenseUtil=require(_0x93cb('0x1b'));var db=require(_0x93cb('0x1c'))['db'];function respondWithStatusCode(_0x4fc320,_0x59edb3){_0x59edb3=_0x59edb3||0xcc;return function(_0x5946b2){if(_0x5946b2){return _0x4fc320['sendStatus'](_0x59edb3);}return _0x4fc320[_0x93cb('0x1d')](_0x59edb3)['end']();};}function respondWithResult(_0x3b0d1a,_0x143a66){_0x143a66=_0x143a66||0xc8;return function(_0x2989a4){if(_0x2989a4){return _0x3b0d1a[_0x93cb('0x1d')](_0x143a66)[_0x93cb('0x1e')](_0x2989a4);}};}function respondWithFilteredResult(_0xec1f30,_0x1ccf0f){return function(_0x51fb7f){if(_0x51fb7f){var _0x1cb46f=typeof _0x1ccf0f[_0x93cb('0x1f')]===_0x93cb('0x20')&&typeof _0x1ccf0f['limit']===_0x93cb('0x20');var _0x340adc=_0x51fb7f[_0x93cb('0x21')];var _0x3ffac0=_0x1cb46f?0x0:_0x1ccf0f[_0x93cb('0x1f')];var _0x5b391d=_0x1cb46f?_0x51fb7f[_0x93cb('0x21')]:_0x1ccf0f[_0x93cb('0x1f')]+_0x1ccf0f['limit'];var _0xbd95d9;if(_0x5b391d>=_0x340adc){_0x5b391d=_0x340adc;_0xbd95d9=0xc8;}else{_0xbd95d9=0xce;}_0xec1f30[_0x93cb('0x1d')](_0xbd95d9);return _0xec1f30[_0x93cb('0x22')](_0x93cb('0x23'),_0x3ffac0+'-'+_0x5b391d+'/'+_0x340adc)[_0x93cb('0x1e')](_0x51fb7f);}return null;};}function patchUpdates(_0x38ad45){return function(_0x19550f){try{jsonpatch[_0x93cb('0x24')](_0x19550f,_0x38ad45,!![]);}catch(_0x85fcb4){return BPromise[_0x93cb('0x25')](_0x85fcb4);}return _0x19550f['save']();};}function saveUpdates(_0xdd30ea,_0x418c20){return function(_0x58e0c4){if(_0x58e0c4){return _0x58e0c4[_0x93cb('0x26')](_0xdd30ea)[_0x93cb('0x27')](function(_0x324840){return _0x324840;});}return null;};}function removeEntity(_0x1578c1,_0xa9ec0e){return function(_0x1f4c9b){if(_0x1f4c9b){return _0x1f4c9b[_0x93cb('0x28')]()[_0x93cb('0x27')](function(){_0x1578c1[_0x93cb('0x1d')](0xcc)[_0x93cb('0x29')]();});}};}function handleEntityNotFound(_0x341f28,_0x53ae8b){return function(_0x54f346){if(!_0x54f346){_0x341f28[_0x93cb('0x2a')](0x194);}return _0x54f346;};}function handleError(_0x4acc0f,_0x37d4ca){_0x37d4ca=_0x37d4ca||0x1f4;return function(_0x38732d){logger['error'](_0x38732d['stack']);if(_0x38732d[_0x93cb('0x2b')]){delete _0x38732d['name'];}_0x4acc0f[_0x93cb('0x1d')](_0x37d4ca)[_0x93cb('0x2c')](_0x38732d);};}exports[_0x93cb('0x2d')]=function(_0x3fd536,_0x3d0de2){var _0x55d228={},_0x5d0aa5={},_0x465d71={'count':0x0,'rows':[]};var _0x1cc0f7=_[_0x93cb('0x2e')](db['VoiceRecording'][_0x93cb('0x2f')],function(_0x5bf828){return{'name':_0x5bf828[_0x93cb('0x30')],'type':_0x5bf828[_0x93cb('0x31')][_0x93cb('0x32')]};});_0x5d0aa5[_0x93cb('0x33')]=_['differenceBy'](_[_0x93cb('0x2e')](_0x1cc0f7,_0x93cb('0x2b')),['format']);_0x5d0aa5[_0x93cb('0x34')]=_[_0x93cb('0x35')](_0x3fd536[_0x93cb('0x34')]);_0x5d0aa5[_0x93cb('0x36')]=_[_0x93cb('0x37')](_0x5d0aa5['model'],_0x5d0aa5[_0x93cb('0x34')]);_0x55d228[_0x93cb('0x38')]=_[_0x93cb('0x37')](_0x5d0aa5['model'],qs[_0x93cb('0x39')](_0x3fd536[_0x93cb('0x34')][_0x93cb('0x39')]));_0x55d228['attributes']=_0x55d228[_0x93cb('0x38')][_0x93cb('0x3a')]?_0x55d228[_0x93cb('0x38')]:_0x5d0aa5[_0x93cb('0x33')];if(!_0x3fd536['query'][_0x93cb('0x3b')](_0x93cb('0x3c'))){_0x55d228['limit']=qs[_0x93cb('0x3d')](_0x3fd536[_0x93cb('0x34')][_0x93cb('0x3d')]);_0x55d228['offset']=qs[_0x93cb('0x1f')](_0x3fd536['query'][_0x93cb('0x1f')]);}_0x55d228[_0x93cb('0x3e')]=qs['sort'](_0x3fd536[_0x93cb('0x34')][_0x93cb('0x3f')]);_0x55d228[_0x93cb('0x40')]=qs[_0x93cb('0x36')](_[_0x93cb('0x41')](_0x3fd536[_0x93cb('0x34')],_0x5d0aa5[_0x93cb('0x36')]),_0x1cc0f7);if(_0x3fd536[_0x93cb('0x34')][_0x93cb('0x42')]){_0x55d228['where']=_[_0x93cb('0x43')](_0x55d228['where'],{'$or':_[_0x93cb('0x2e')](_0x1cc0f7,function(_0x3c28f9){if(_0x3c28f9[_0x93cb('0x31')]!==_0x93cb('0x44')){var _0x14bce3={};_0x14bce3[_0x3c28f9[_0x93cb('0x2b')]]={'$like':'%'+_0x3fd536[_0x93cb('0x34')][_0x93cb('0x42')]+'%'};return _0x14bce3;}})});}_0x55d228=_[_0x93cb('0x43')]({},_0x55d228,_0x3fd536[_0x93cb('0x45')]);var _0x415d4e={'where':_0x55d228[_0x93cb('0x40')]};return db[_0x93cb('0x46')][_0x93cb('0x21')](_0x415d4e)[_0x93cb('0x27')](function(_0x4575dd){_0x465d71[_0x93cb('0x21')]=_0x4575dd;if(_0x3fd536['query'][_0x93cb('0x47')]){_0x55d228['include']=[{'all':!![]}];}return db[_0x93cb('0x46')]['findAll'](_0x55d228);})[_0x93cb('0x27')](function(_0x2325aa){_0x465d71[_0x93cb('0x48')]=_0x2325aa;return _0x465d71;})['then'](respondWithFilteredResult(_0x3d0de2,_0x55d228))['catch'](handleError(_0x3d0de2,null));};exports[_0x93cb('0x49')]=function(_0x1fc8f7,_0xcc72e5){var _0x4aef15={'raw':![],'where':{'id':_0x1fc8f7[_0x93cb('0x4a')]['id']}},_0x40a87b={};_0x40a87b[_0x93cb('0x33')]=_['keys'](db['VoiceRecording'][_0x93cb('0x2f')]);_0x40a87b[_0x93cb('0x34')]=_[_0x93cb('0x35')](_0x1fc8f7['query']);_0x40a87b[_0x93cb('0x36')]=_[_0x93cb('0x37')](_0x40a87b[_0x93cb('0x33')],_0x40a87b[_0x93cb('0x34')]);_0x4aef15[_0x93cb('0x38')]=_[_0x93cb('0x37')](_0x40a87b[_0x93cb('0x33')],qs[_0x93cb('0x39')](_0x1fc8f7[_0x93cb('0x34')][_0x93cb('0x39')]));_0x4aef15[_0x93cb('0x38')]=_0x4aef15['attributes'][_0x93cb('0x3a')]?_0x4aef15[_0x93cb('0x38')]:_0x40a87b[_0x93cb('0x33')];if(_0x1fc8f7[_0x93cb('0x34')][_0x93cb('0x47')]){_0x4aef15[_0x93cb('0x4b')]=[{'all':!![]}];}_0x4aef15=_[_0x93cb('0x43')]({},_0x4aef15,_0x1fc8f7['options']);return db[_0x93cb('0x46')][_0x93cb('0x4c')](_0x4aef15)[_0x93cb('0x27')](handleEntityNotFound(_0xcc72e5,null))[_0x93cb('0x27')](respondWithResult(_0xcc72e5,null))[_0x93cb('0x4d')](handleError(_0xcc72e5,null));};exports[_0x93cb('0x4e')]=function(_0x51969c,_0x422a66){return db[_0x93cb('0x46')]['create'](_0x51969c[_0x93cb('0x4f')],{})[_0x93cb('0x27')](respondWithResult(_0x422a66,0xc9))[_0x93cb('0x4d')](handleError(_0x422a66,null));};exports['update']=function(_0x1e0e7d,_0x4594e4){if(_0x1e0e7d[_0x93cb('0x4f')]['id']){delete _0x1e0e7d[_0x93cb('0x4f')]['id'];}return db[_0x93cb('0x46')][_0x93cb('0x4c')]({'where':{'id':_0x1e0e7d[_0x93cb('0x4a')]['id']}})[_0x93cb('0x27')](handleEntityNotFound(_0x4594e4,null))[_0x93cb('0x27')](saveUpdates(_0x1e0e7d[_0x93cb('0x4f')],null))[_0x93cb('0x27')](respondWithResult(_0x4594e4,null))['catch'](handleError(_0x4594e4,null));};exports[_0x93cb('0x50')]=function(_0x5eabca,_0x51c292){return db[_0x93cb('0x46')][_0x93cb('0x50')]()[_0x93cb('0x27')](respondWithResult(_0x51c292,null))['catch'](handleError(_0x51c292,null));};exports[_0x93cb('0x51')]=function(_0x5e3313,_0x5c3dd1,_0x1967a0){var _0x166a0f=require('../../components/encryptor');var _0x126421=![];var _0x53ae2b={};if(_0x5e3313[_0x93cb('0x34')][_0x93cb('0x31')]&&_0x5e3313['query']['type']===_0x93cb('0x52')){_0x53ae2b[_0x93cb('0x52')]=_0x5e3313[_0x93cb('0x4a')]['id'];}else{_0x53ae2b['id']=_0x5e3313['params']['id'];}return db[_0x93cb('0x46')][_0x93cb('0x4c')]({'where':_0x53ae2b,'attributes':['id',_0x93cb('0x53')],'raw':!![]})[_0x93cb('0x27')](handleEntityNotFound(_0x5c3dd1,null))[_0x93cb('0x27')](function(_0x55abf9){if(_0x55abf9){var _0x302037=_0x55abf9['value'];var _0x52aa1f=util[_0x93cb('0x54')](_0x93cb('0x55'),_0x302037);if(fs[_0x93cb('0x56')](_0x52aa1f)){_0x126421=!![];return _0x166a0f[_0x93cb('0x57')](_0x52aa1f,_0x302037,config[_0x93cb('0x58')][_0x93cb('0x59')])['then'](function(){return _0x55abf9;});}return _0x55abf9;}})[_0x93cb('0x27')](function(_0x40382b){if(_0x40382b){var _0x1da6c6=_0x40382b[_0x93cb('0x53')];if(!fs['existsSync'](_0x1da6c6)){throw new db['Sequelize'][(_0x93cb('0x5a'))](_0x93cb('0x5b'));}if(_0x40382b[_0x93cb('0x5c')]){return _0x5c3dd1[_0x93cb('0x51')](_0x1da6c6,_0x40382b[_0x93cb('0x5c')]+path['extname'](_0x1da6c6),function(){if(_0x126421){fs[_0x93cb('0x5d')](_0x1da6c6);}});}else{return _0x5c3dd1[_0x93cb('0x51')](_0x1da6c6,function(_0x28d8e3){if(_0x126421){fs[_0x93cb('0x5d')](_0x1da6c6);}});}}})['catch'](function(_0x410d92){if(_0x410d92[_0x93cb('0x5e')]===_0x93cb('0x5b')){_0x5c3dd1[_0x93cb('0x1d')](0x194)[_0x93cb('0x2c')](_0x93cb('0x5f'));}else{return handleError(_0x5c3dd1,null);}});};exports['downloads']=function(_0x11710a,_0x568885,_0x2d4775){var _0x1d6767=require(_0x93cb('0x60'));var _0x37e099=![];var _0x5e9c4b={'$and':[db['sequelize'][_0x93cb('0x40')](db[_0x93cb('0x61')]['fn'](_0x93cb('0x62'),db[_0x93cb('0x61')][_0x93cb('0x63')](_0x93cb('0x52'))),_0x11710a[_0x93cb('0x34')][_0x93cb('0x64')])]};if(_0x11710a['query']['type']&&_0x11710a[_0x93cb('0x34')]['type']===_0x93cb('0x52')){_0x5e9c4b['$and']['push']({'uniqueid':_0x11710a[_0x93cb('0x4a')]['id']});}else{_0x5e9c4b[_0x93cb('0x65')][_0x93cb('0x66')]({'id':_0x11710a[_0x93cb('0x4a')]['id']});}return db[_0x93cb('0x46')][_0x93cb('0x4c')]({'where':_0x5e9c4b,'attributes':['id',_0x93cb('0x53')],'raw':!![]})[_0x93cb('0x27')](handleEntityNotFound(_0x568885,null))[_0x93cb('0x27')](function(_0x396ce0){if(_0x396ce0){var _0x533e4d=util[_0x93cb('0x54')](_0x93cb('0x55'),_0x396ce0[_0x93cb('0x53')]);if(fs['existsSync'](_0x533e4d)){_0x37e099=!![];return _0x1d6767[_0x93cb('0x57')](_0x533e4d,_0x396ce0[_0x93cb('0x53')],config[_0x93cb('0x58')][_0x93cb('0x59')])[_0x93cb('0x27')](function(){return _0x396ce0;});}return _0x396ce0;}})[_0x93cb('0x27')](function(_0x264a5e){if(_0x264a5e){if(!fs[_0x93cb('0x56')](_0x264a5e['value'])){throw new db[(_0x93cb('0x67'))][(_0x93cb('0x5a'))](_0x93cb('0x5b'));}if(_0x264a5e[_0x93cb('0x5c')]){return _0x568885['download'](_0x264a5e[_0x93cb('0x53')],_0x264a5e[_0x93cb('0x5c')]+path[_0x93cb('0x68')](_0x264a5e['value']),function(){if(_0x37e099){fs[_0x93cb('0x5d')](_0x264a5e['value']);}});}else{return _0x568885['download'](_0x264a5e[_0x93cb('0x53')],function(_0x3089d3){if(_0x37e099){fs[_0x93cb('0x5d')](_0x264a5e[_0x93cb('0x53')]);}});}}})['catch'](handleError(_0x568885,null));};exports[_0x93cb('0x28')]=function(_0x1487ca,_0x3de796){return db[_0x93cb('0x46')][_0x93cb('0x4c')]({'where':{'id':_0x1487ca[_0x93cb('0x4a')]['id']}})[_0x93cb('0x27')](function(_0x2f2995){if(_['isNil'](_0x2f2995)){throw new ReferenceError(_0x93cb('0x69'));}return _0x2f2995;})[_0x93cb('0x27')](function(_0x278a15){var _0x1c9936=_0x278a15[_0x93cb('0x53')];logger[_0x93cb('0x6a')]('cancellazione\x20fisica\x20documento\x20%s',_0x1c9936);if(!_['isNil'](_0x278a15[_0x93cb('0x53')])&&fs[_0x93cb('0x56')](_0x1c9936)){logger[_0x93cb('0x6a')](_0x93cb('0x6b')+_0x1c9936+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x93cb('0x6c')](_0x1c9936);}_0x1c9936=_0x1c9936+_0x93cb('0x6d');if(!_[_0x93cb('0x6e')](_0x278a15[_0x93cb('0x53')])&&fs['existsSync'](_0x1c9936)){logger[_0x93cb('0x6a')](_0x93cb('0x6b')+_0x1c9936+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x93cb('0x6c')](_0x1c9936);}return _0x278a15;})[_0x93cb('0x27')](function(_0x57bce5){if(!_0x57bce5)throw new InternalError();return _0x57bce5[_0x93cb('0x28')]();})[_0x93cb('0x27')](function(){_0x3de796[_0x93cb('0x1d')](0xcc)['end']();})[_0x93cb('0x4d')](handleError(_0x3de796,null));};function getBucketslist(_0x5b975e,_0x4dcf77,_0x1784ba){return new Promise(function(_0x1274a8,_0x12e967){var _0x4ce511=new AWS['S3']({'accessKeyId':_0x4dcf77,'secretAccessKey':_0x5b975e,'region':_0x1784ba});_0x4ce511[_0x93cb('0x6f')]({},function(_0x138917,_0x7b32de){if(_0x138917){return _0x12e967(_0x138917);}else{return _0x1274a8(_0x7b32de);}});});}function createBucket(_0x1f55da,_0x6017ed,_0xd3e7a8,_0x18cf3b){return new Promise(function(_0x3849ad,_0x13bb68){var _0x13732a=new AWS['S3']({'accessKeyId':_0x6017ed,'secretAccessKey':_0x1f55da,'region':_0xd3e7a8});_0x13732a[_0x93cb('0x70')]({'Bucket':_0x18cf3b},function(_0x94ec9b,_0x3ef286){if(_0x94ec9b){return _0x13bb68(_0x94ec9b);}else{return _0x3849ad(_0x3ef286);}});});}function uploadFile(_0x393e63,_0x598a83,_0x413d84,_0x5b426d,_0x1e07de,_0x4a5906){return new Promise(function(_0x1c9e44,_0x551445){var _0x3597db=new AWS['S3']({'accessKeyId':_0x598a83,'secretAccessKey':_0x393e63,'region':_0x413d84});_0x3597db[_0x93cb('0x71')]({'Bucket':_0x5b426d,'Key':_0x1e07de,'Body':_0x4a5906},function(_0x35d6ad,_0x162077){if(_0x35d6ad){return _0x551445(_0x35d6ad);}else{return _0x1c9e44(_0x162077);}});});}function startTranscribe(_0x9cc33a,_0x23143d,_0x37544f,_0x3a44e5,_0xa1adf2,_0x3619a4){return new Promise(function(_0x4c3fd8,_0x34e139){var _0x326a71=new AWS[(_0x93cb('0x72'))]({'accessKeyId':_0x23143d,'secretAccessKey':_0x9cc33a,'region':_0x37544f});_0x326a71[_0x93cb('0x73')]({'TranscriptionJobName':_0x3a44e5,'LanguageCode':_0xa1adf2,'Media':{'MediaFileUri':_0x3619a4}},function(_0x559e78,_0x595f87){if(_0x559e78){return _0x34e139(_0x559e78);}else{return _0x4c3fd8(_0x595f87);}});});}function transcribe(_0x4e87b7,_0x7973f7,_0x1d0057,_0x4c86c7,_0x5b080d,_0x404705,_0xf6d603){return new Promise(function(_0x1490ef,_0x521e12){var _0x31626a={};logger[_0x93cb('0x6a')](util['format'](_0x93cb('0x74'),_0x4e87b7,_0x5b080d));return uploadFile(_0x7973f7,_0x1d0057,_0x4c86c7,_0x5b080d,path[_0x93cb('0x75')](_0x404705),fs[_0x93cb('0x76')](_0x404705))['then'](function(_0xf60e0d){logger[_0x93cb('0x6a')](util['format'](_0x93cb('0x77'),_0x4e87b7,_0x5b080d,_0xf60e0d[_0x93cb('0x78')]));_0x31626a[_0x93cb('0x79')]=_0xf60e0d[_0x93cb('0x7a')];_0x31626a[_0x93cb('0x7b')]=_0xf60e0d['Location'];logger['info'](util[_0x93cb('0x54')](_0x93cb('0x7c'),_0x4e87b7));return startTranscribe(_0x7973f7,_0x1d0057,_0x4c86c7,uuidv4(),_0xf6d603,_0xf60e0d['Location']);})['then'](function(_0x43c5e7){logger[_0x93cb('0x6a')](util[_0x93cb('0x54')](_0x93cb('0x7d'),_0x4e87b7,_0x43c5e7[_0x93cb('0x7e')]['TranscriptionJobName']));_0x31626a[_0x93cb('0x7f')]=_0x43c5e7[_0x93cb('0x7e')]['TranscriptionJobName'];_0x31626a[_0x93cb('0x80')]=_0x43c5e7[_0x93cb('0x7e')][_0x93cb('0x81')];return _0x1490ef(_0x31626a);})[_0x93cb('0x4d')](function(_0x1a08f6){return _0x521e12(_0x1a08f6);});});}exports[_0x93cb('0x82')]=function(_0x28d19f,_0x1420b8,_0x1ee367){var _0x16a200;var _0x2576d5;var _0x4a8653;var _0xb5f780=require(_0x93cb('0x60'));return db[_0x93cb('0x46')][_0x93cb('0x83')]({'where':{'id':_0x28d19f[_0x93cb('0x4a')]['id']}})[_0x93cb('0x27')](function(_0xf77466){if(_0xf77466){var _0x4af31a=util['format'](_0x93cb('0x55'),_0xf77466['value']);if(fs['existsSync'](_0x4af31a)){cypher=!![];return _0xb5f780[_0x93cb('0x57')](_0x4af31a,_0xf77466[_0x93cb('0x53')],config[_0x93cb('0x58')][_0x93cb('0x59')])['then'](function(){return _0xf77466;});}return _0xf77466;}})[_0x93cb('0x27')](function(_0x38532e){if(!_0x38532e){throw new db[(_0x93cb('0x67'))][(_0x93cb('0x5a'))](_0x93cb('0x84'));}_0x2576d5=_0x38532e;return db[_0x93cb('0x85')]['findOne']({'where':{'id':0x1}});})[_0x93cb('0x27')](handleEntityNotFound(_0x1420b8,null))[_0x93cb('0x27')](function(_0x1598eb){if(_0x1598eb){_0x16a200=_0x1598eb;if(!_0x16a200['transcribe']||!_0x16a200[_0x93cb('0x86')]||!_0x16a200[_0x93cb('0x87')]||!_0x16a200[_0x93cb('0x88')]||!_0x16a200['bucket']){throw new db['Sequelize'][(_0x93cb('0x5a'))](_0x93cb('0x89'));}if(_0x28d19f[_0x93cb('0x4f')]['runSentiment']&&(!_0x16a200[_0x93cb('0x8a')]||!_0x16a200[_0x93cb('0x8b')]||!_0x16a200[_0x93cb('0x8c')]||!_0x16a200[_0x93cb('0x88')]||!_0x16a200[_0x93cb('0x79')])){throw new db[(_0x93cb('0x67'))]['ValidationError'](_0x93cb('0x8d'));}return db[_0x93cb('0x8e')]['findOne']({'where':{'id':_0x16a200[_0x93cb('0x86')]}});}})[_0x93cb('0x27')](function(_0x54e763){if(!_0x54e763){throw new db[(_0x93cb('0x67'))]['ValidationError'](_0x93cb('0x8f'));}if(!_0x54e763[_0x93cb('0x90')]||!_0x54e763[_0x93cb('0x91')]){throw new db[(_0x93cb('0x67'))][(_0x93cb('0x5a'))](_0x93cb('0x92'));}_0x4a8653=_0x54e763;return getBucketslist(_0x4a8653['data1'],_0x4a8653[_0x93cb('0x91')],_0x16a200[_0x93cb('0x87')]);})['then'](function(_0x473d0d){if(_0x473d0d&&_0x473d0d[_0x93cb('0x93')]){var _0x143d17=_[_0x93cb('0x4c')](_0x473d0d[_0x93cb('0x93')],function(_0x4fd504){return _0x4fd504[_0x93cb('0x94')]===_0x16a200['bucket'];});if(!_0x143d17){logger[_0x93cb('0x6a')](util[_0x93cb('0x54')](_0x93cb('0x95'),_0x28d19f[_0x93cb('0x4a')]['id'],_0x16a200[_0x93cb('0x79')]));return createBucket(_0x4a8653[_0x93cb('0x90')],_0x4a8653['data2'],_0x16a200['transcribeRegion'],_0x16a200['bucket']);}logger['info'](util[_0x93cb('0x54')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x28d19f[_0x93cb('0x4a')]['id'],_0x16a200[_0x93cb('0x79')]));return;}})[_0x93cb('0x27')](function(_0x2b46ab){if(_0x2576d5[_0x93cb('0x80')]===_0x93cb('0x96')){return transcribe(_0x28d19f['params']['id'],_0x4a8653['data1'],_0x4a8653[_0x93cb('0x91')],_0x16a200[_0x93cb('0x87')],_0x16a200[_0x93cb('0x79')],_0x2576d5[_0x93cb('0x53')],_0x16a200[_0x93cb('0x88')]);}else{logger[_0x93cb('0x6a')](util[_0x93cb('0x54')](_0x93cb('0x97'),_0x28d19f[_0x93cb('0x4a')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x93cb('0x27')](function(_0x317eea){if(_0x317eea){_0x317eea['tempSentiment']=_0x28d19f['body']['runSentiment'];return _0x2576d5[_0x93cb('0x98')](_0x317eea);}})[_0x93cb('0x27')](respondWithResult(_0x1420b8,null))['catch'](handleError(_0x1420b8,null));};function writeFile(_0x103409,_0x59112e){return new Promise(function(_0xeaddbf,_0x8f94e){fs['writeFile'](_0x59112e,_0x103409,function(_0x5cb195,_0x3cd9a3){if(_0x5cb195){return _0x8f94e(_0x5cb195);}else{return _0xeaddbf(_0x3cd9a3);}});});}exports[_0x93cb('0x99')]=function(_0x5c016c,_0x1d6284,_0x1cfc6d){return db[_0x93cb('0x46')][_0x93cb('0x83')]({'where':{'id':_0x5c016c[_0x93cb('0x4a')]['id']}})[_0x93cb('0x27')](handleEntityNotFound(_0x1d6284))[_0x93cb('0x27')](function(_0xf85b8a){if(_0xf85b8a&&_0xf85b8a[_0x93cb('0x9a')]){var _0x54488a=_0xf85b8a[_0x93cb('0x9a')];var _0x3d9a0e=config[_0x93cb('0x9b')]+'/server/files/transcribes/transcribe_'+_0xf85b8a['id']+_0x93cb('0x9c');if(fs['existsSync'](_0x3d9a0e)){return _0x3d9a0e;}return writeFile(_0x54488a,_0x3d9a0e)[_0x93cb('0x27')](function(){return _0x3d9a0e;});}else{throw new db['Sequelize'][(_0x93cb('0x5a'))](_0x93cb('0x9d'));}})[_0x93cb('0x27')](function(_0x655965){return _0x1d6284['download'](_0x655965);})[_0x93cb('0x4d')](handleError(_0x1d6284));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index c05cb1e..b6fcbb4 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 _0x6ce9=['VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0x6ce9,0x76));var _0x96ce=function(_0xb1482d,_0x247314){_0xb1482d=_0xb1482d-0x0;var _0x57dd25=_0x6ce9[_0xb1482d];return _0x57dd25;};'use strict';var attributes=require(_0x96ce('0x0'));module[_0x96ce('0x1')]=function(_0x1d736b,_0x59dbfa){return _0x1d736b['define'](_0x96ce('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x96ce('0x3'),'fields':[_0x96ce('0x3')]},{'name':_0x96ce('0x4'),'fields':[_0x96ce('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x089f=['exports','define','VoiceRecording','uniqueid','transcribeStatus'];(function(_0x17dbd3,_0x3da50e){var _0x31a403=function(_0x540b86){while(--_0x540b86){_0x17dbd3['push'](_0x17dbd3['shift']());}};_0x31a403(++_0x3da50e);}(_0x089f,0x1c7));var _0xf089=function(_0x1c6782,_0x189c2d){_0x1c6782=_0x1c6782-0x0;var _0x2d27b4=_0x089f[_0x1c6782];return _0x2d27b4;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xf089('0x0')]=function(_0x3722ad,_0x250c0e){return _0x3722ad[_0xf089('0x1')](_0xf089('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xf089('0x3'),'fields':[_0xf089('0x3')]},{'name':_0xf089('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index be1128b..f0ce26d 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 _0x32b6=['jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','info','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x32b6,0x1d1));var _0x632b=function(_0x498415,_0x418a03){_0x498415=_0x498415-0x0;var _0xcdc83a=_0x32b6[_0x498415];return _0xcdc83a;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')](_0x3bb27f[_0x632b('0x18')],{'raw':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')]['where']||null:null,'attributes':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')]['attributes']||null:null,'limit':_0x3bb27f[_0x632b('0x19')]?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1b')]||null:null})['then'](function(_0x10fc32){logger[_0x632b('0x14')]('UpdateVoiceRecording',_0x3bb27f);logger[_0x632b('0xd')](_0x632b('0x15'),_0x3bb27f,JSON[_0x632b('0xf')](_0x10fc32));_0x51c894(_0x10fc32);})[_0x632b('0x1c')](function(_0x45d017){logger[_0x632b('0x10')]('UpdateVoiceRecording',_0x45d017['message'],_0x3bb27f);_0x2f3e88(_0x28c472[_0x632b('0x10')](0x1f4,_0x45d017['message']));});});};exports[_0x632b('0x1d')]=function(_0x954fa0){var _0x5d6855=this;return new Promise(function(_0x273e89,_0x3f4eab){var _0x29d9aa=require(_0x632b('0x1e'));var _0x4728a8;return db[_0x632b('0x1f')][_0x632b('0x20')]({'attributes':['id',_0x632b('0x21')],'where':{'id':0x1},'raw':!![]})[_0x632b('0xc')](function(_0x4f8410){_0x4728a8=_0x4f8410;return db[_0x632b('0x16')][_0x632b('0x22')](_0x954fa0[_0x632b('0x18')]);})[_0x632b('0xc')](function(_0x17a5ba){if(_0x4728a8[_0x632b('0x21')]&&fs[_0x632b('0x23')](_0x17a5ba[_0x632b('0x24')])){var _0x1ace1b=util[_0x632b('0x25')](_0x632b('0x26'),_0x17a5ba[_0x632b('0x24')]);return _0x29d9aa[_0x632b('0x27')](_0x17a5ba[_0x632b('0x24')],_0x1ace1b,config[_0x632b('0x28')][_0x632b('0x29')])[_0x632b('0xc')](function(){fs[_0x632b('0x2a')](_0x17a5ba[_0x632b('0x24')]);logger[_0x632b('0x14')]('CreateVoiceRecording\x20file\x20encrypted');return _0x17a5ba;});}return _0x17a5ba;})[_0x632b('0xc')](function(_0x4401dc){logger[_0x632b('0x14')](_0x632b('0x1d'),_0x954fa0);logger['debug'](_0x632b('0x1d'),_0x954fa0,JSON['stringify'](_0x4401dc));_0x273e89(_0x4401dc);})[_0x632b('0x1c')](function(_0x15b22d){logger['error'](_0x632b('0x1d'),_0x15b22d[_0x632b('0x13')],_0x954fa0);_0x3f4eab(_0x5d6855[_0x632b('0x10')](0x1f4,_0x15b22d[_0x632b('0x13')]));});});}; \ No newline at end of file +var _0x4325=['attributes','CreateVoiceRecording','Setting','findOne','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where'];(function(_0x1fc6d0,_0x4c8431){var _0xc97455=function(_0x40ab75){while(--_0x40ab75){_0x1fc6d0['push'](_0x1fc6d0['shift']());}};_0xc97455(++_0x4c8431);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')](_0x32fe60[_0x5432('0x1a')],{'raw':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fe60['options']?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1d')]||null:null,'attributes':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1e')]||null:null,'limit':_0x32fe60['options']?_0x32fe60['options']['limit']||null:null})[_0x5432('0xb')](function(_0xb900f2){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger['debug']('UpdateVoiceRecording',_0x32fe60,JSON[_0x5432('0x10')](_0xb900f2));_0x5f011f(_0xb900f2);})[_0x5432('0x16')](function(_0x4a40fc){logger[_0x5432('0x12')](_0x5432('0x17'),_0x4a40fc[_0x5432('0x13')],_0x32fe60);_0x3f3873(_0x4221a8['error'](0x1f4,_0x4a40fc[_0x5432('0x13')]));});});};exports[_0x5432('0x1f')]=function(_0xe7eda2){var _0x520da1=this;return new Promise(function(_0x4ab09d,_0x1f2055){var _0x2114b8=require('../../components/encryptor');var _0x1abe73;return db[_0x5432('0x20')][_0x5432('0x21')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5432('0xb')](function(_0x5be867){_0x1abe73=_0x5be867;return db['VoiceRecording'][_0x5432('0x22')](_0xe7eda2['body']);})[_0x5432('0xb')](function(_0x578281){if(_0x1abe73['callRecordingEncryption']&&fs[_0x5432('0x23')](_0x578281[_0x5432('0x24')])){var _0x345b51=util['format'](_0x5432('0x25'),_0x578281[_0x5432('0x24')]);return _0x2114b8[_0x5432('0x26')](_0x578281[_0x5432('0x24')],_0x345b51,config[_0x5432('0x27')][_0x5432('0x28')])[_0x5432('0xb')](function(){fs[_0x5432('0x29')](_0x578281[_0x5432('0x24')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x578281;});}return _0x578281;})[_0x5432('0xb')](function(_0x42ab1e){logger[_0x5432('0x14')](_0x5432('0x1f'),_0xe7eda2);logger[_0x5432('0xd')]('CreateVoiceRecording',_0xe7eda2,JSON[_0x5432('0x10')](_0x42ab1e));_0x4ab09d(_0x42ab1e);})['catch'](function(_0x2955e0){logger[_0x5432('0x12')](_0x5432('0x1f'),_0x2955e0[_0x5432('0x13')],_0xe7eda2);_0x1f2055(_0x520da1[_0x5432('0x12')](0x1f4,_0x2955e0[_0x5432('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index d50d809..8ebae8d 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 _0x6aee=['express','Router','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x33a906,_0x32d1e7){var _0x56c15c=function(_0x200177){while(--_0x200177){_0x33a906['push'](_0x33a906['shift']());}};_0x56c15c(++_0x32d1e7);}(_0x6aee,0x1b4));var _0xe6ae=function(_0x53a739,_0x41b71d){_0x53a739=_0x53a739-0x0;var _0x3dd460=_0x6aee[_0x53a739];return _0x3dd460;};'use strict';var multer=require(_0xe6ae('0x0'));var util=require(_0xe6ae('0x1'));var path=require(_0xe6ae('0x2'));var timeout=require(_0xe6ae('0x3'));var express=require(_0xe6ae('0x4'));var router=express[_0xe6ae('0x5')]();var fs_extra=require(_0xe6ae('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe6ae('0x7'));var config=require('../../config/environment');var controller=require(_0xe6ae('0x8'));router['get']('/',auth[_0xe6ae('0x9')](),controller[_0xe6ae('0xa')]);router[_0xe6ae('0xb')]('/describe',auth[_0xe6ae('0x9')](),controller[_0xe6ae('0xc')]);router[_0xe6ae('0xb')](_0xe6ae('0xd'),auth[_0xe6ae('0x9')](),controller[_0xe6ae('0xe')]);router[_0xe6ae('0xf')]('/',auth[_0xe6ae('0x9')](),controller['create']);router[_0xe6ae('0x10')](_0xe6ae('0xd'),auth[_0xe6ae('0x9')](),controller['update']);router[_0xe6ae('0x11')](_0xe6ae('0xd'),auth[_0xe6ae('0x9')](),controller[_0xe6ae('0x12')]);module[_0xe6ae('0x13')]=router; \ No newline at end of file +var _0x441f=['/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x441f,0x82));var _0xf441=function(_0x54a9b9,_0x31352f){_0x54a9b9=_0x54a9b9-0x0;var _0x2a34ef=_0x441f[_0x54a9b9];return _0x2a34ef;};'use strict';var multer=require(_0xf441('0x0'));var util=require(_0xf441('0x1'));var path=require(_0xf441('0x2'));var timeout=require('connect-timeout');var express=require(_0xf441('0x3'));var router=express[_0xf441('0x4')]();var fs_extra=require(_0xf441('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf441('0x6'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0xf441('0x7')](),controller[_0xf441('0x8')]);router[_0xf441('0x9')](_0xf441('0xa'),auth[_0xf441('0x7')](),controller[_0xf441('0xb')]);router['get'](_0xf441('0xc'),auth[_0xf441('0x7')](),controller[_0xf441('0xd')]);router[_0xf441('0xe')]('/',auth[_0xf441('0x7')](),controller[_0xf441('0xf')]);router['put'](_0xf441('0xc'),auth[_0xf441('0x7')](),controller[_0xf441('0x10')]);router[_0xf441('0x11')](_0xf441('0xc'),auth[_0xf441('0x7')](),controller[_0xf441('0x12')]);module[_0xf441('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 4fca64b..e2e8208 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 _0x0360=['ENUM','blind','attended','STRING','Yes','moment'];(function(_0x15bdf5,_0x367cbf){var _0x147c62=function(_0x808389){while(--_0x808389){_0x15bdf5['push'](_0x15bdf5['shift']());}};_0x147c62(++_0x367cbf);}(_0x0360,0x12b));var _0x0036=function(_0x5a5476,_0x3bd606){_0x5a5476=_0x5a5476-0x0;var _0x2dfd18=_0x0360[_0x5a5476];return _0x2dfd18;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0036('0x0'));module['exports']={'type':{'type':Sequelize[_0x0036('0x1')](_0x0036('0x2'),_0x0036('0x3'))},'result':{'type':Sequelize[_0x0036('0x4')]},'transfererchannel':{'type':Sequelize[_0x0036('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x0036('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x0036('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x0036('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x0036('0x4')]},'transfererexten':{'type':Sequelize[_0x0036('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x0036('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x0036('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x0036('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x0036('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x0036('0x1')](_0x0036('0x5'),'No')},'context':{'type':Sequelize[_0x0036('0x4')]},'extension':{'type':Sequelize[_0x0036('0x4')]}}; \ No newline at end of file +var _0x888b=['exports','ENUM','blind','STRING','Yes','moment'];(function(_0x2ebc34,_0xa1bd97){var _0xdaef26=function(_0x59daf6){while(--_0x59daf6){_0x2ebc34['push'](_0x2ebc34['shift']());}};_0xdaef26(++_0xa1bd97);}(_0x888b,0x18b));var _0xb888=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x888b[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb888('0x0'));module[_0xb888('0x1')]={'type':{'type':Sequelize[_0xb888('0x2')](_0xb888('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xb888('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xb888('0x4')]},'transferercalleridname':{'type':Sequelize[_0xb888('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb888('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xb888('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xb888('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xb888('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xb888('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xb888('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb888('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb888('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xb888('0x4')]},'transfereecontext':{'type':Sequelize[_0xb888('0x4')]},'transfereeexten':{'type':Sequelize[_0xb888('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0xb888('0x5'),'No')},'context':{'type':Sequelize[_0xb888('0x4')]},'extension':{'type':Sequelize[_0xb888('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 507abec..ca0fc5a 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 _0x7b5f=['body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','send','index','map','VoiceTransferReport','type','key','keys','query','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x7b5f,0x90));var _0xf7b5=function(_0x277eae,_0x358eb0){_0x277eae=_0x277eae-0x0;var _0x1ccc7a=_0x7b5f[_0x277eae];return _0x1ccc7a;};'use strict';var emlformat=require(_0xf7b5('0x0'));var rimraf=require(_0xf7b5('0x1'));var zipdir=require(_0xf7b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7b5('0x3'));var moment=require(_0xf7b5('0x4'));var BPromise=require(_0xf7b5('0x5'));var Mustache=require(_0xf7b5('0x6'));var util=require('util');var path=require(_0xf7b5('0x7'));var sox=require(_0xf7b5('0x8'));var csv=require(_0xf7b5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7b5('0xa'));var _=require(_0xf7b5('0xb'));var squel=require(_0xf7b5('0xc'));var crypto=require(_0xf7b5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf7b5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf7b5('0xf'));var Papa=require(_0xf7b5('0x10'));var Redis=require(_0xf7b5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf7b5('0x12'));var as=require(_0xf7b5('0x13'));var hardwareService=require(_0xf7b5('0x14'));var logger=require(_0xf7b5('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf7b5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45fe26,_0x25fa45){_0x25fa45=_0x25fa45||0xcc;return function(_0x26eb92){if(_0x26eb92){return _0x45fe26[_0xf7b5('0x17')](_0x25fa45);}return _0x45fe26[_0xf7b5('0x18')](_0x25fa45)['end']();};}function respondWithResult(_0x2c3c78,_0x3ba98b){_0x3ba98b=_0x3ba98b||0xc8;return function(_0x4536d4){if(_0x4536d4){return _0x2c3c78['status'](_0x3ba98b)[_0xf7b5('0x19')](_0x4536d4);}};}function respondWithFilteredResult(_0x798852,_0xd49986){return function(_0x297a23){if(_0x297a23){var _0x284810=typeof _0xd49986[_0xf7b5('0x1a')]===_0xf7b5('0x1b')&&typeof _0xd49986[_0xf7b5('0x1c')]===_0xf7b5('0x1b');var _0xeaba39=_0x297a23[_0xf7b5('0x1d')];var _0x44ed6a=_0x284810?0x0:_0xd49986['offset'];var _0x592daa=_0x284810?_0x297a23[_0xf7b5('0x1d')]:_0xd49986['offset']+_0xd49986[_0xf7b5('0x1c')];var _0x3ad3c0;if(_0x592daa>=_0xeaba39){_0x592daa=_0xeaba39;_0x3ad3c0=0xc8;}else{_0x3ad3c0=0xce;}_0x798852['status'](_0x3ad3c0);return _0x798852[_0xf7b5('0x1e')]('Content-Range',_0x44ed6a+'-'+_0x592daa+'/'+_0xeaba39)[_0xf7b5('0x19')](_0x297a23);}return null;};}function patchUpdates(_0x5711dc){return function(_0x1a76b8){try{jsonpatch[_0xf7b5('0x1f')](_0x1a76b8,_0x5711dc,!![]);}catch(_0x1d3680){return BPromise[_0xf7b5('0x20')](_0x1d3680);}return _0x1a76b8['save']();};}function saveUpdates(_0x378fa4,_0x2ff932){return function(_0x57a2fe){if(_0x57a2fe){return _0x57a2fe[_0xf7b5('0x21')](_0x378fa4)[_0xf7b5('0x22')](function(_0x2fa1c7){return _0x2fa1c7;});}return null;};}function removeEntity(_0x2f962b,_0x3a713d){return function(_0x4a32d9){if(_0x4a32d9){return _0x4a32d9[_0xf7b5('0x23')]()[_0xf7b5('0x22')](function(){_0x2f962b[_0xf7b5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cc4ab,_0x665bf6){return function(_0x2d2a62){if(!_0x2d2a62){_0x4cc4ab[_0xf7b5('0x17')](0x194);}return _0x2d2a62;};}function handleError(_0x570655,_0x2282f9){_0x2282f9=_0x2282f9||0x1f4;return function(_0x2aeb51){logger[_0xf7b5('0x24')](_0x2aeb51['stack']);if(_0x2aeb51[_0xf7b5('0x25')]){delete _0x2aeb51[_0xf7b5('0x25')];}_0x570655[_0xf7b5('0x18')](_0x2282f9)[_0xf7b5('0x26')](_0x2aeb51);};}exports[_0xf7b5('0x27')]=function(_0x334158,_0x4ddfa9){var _0x3b8d6b={},_0x3b79c2={},_0x2a0c17={'count':0x0,'rows':[]};var _0x4cceff=_[_0xf7b5('0x28')](db[_0xf7b5('0x29')]['rawAttributes'],function(_0x4f4546){return{'name':_0x4f4546['fieldName'],'type':_0x4f4546[_0xf7b5('0x2a')][_0xf7b5('0x2b')]};});_0x3b79c2['model']=_[_0xf7b5('0x28')](_0x4cceff,_0xf7b5('0x25'));_0x3b79c2['query']=_[_0xf7b5('0x2c')](_0x334158[_0xf7b5('0x2d')]);_0x3b79c2[_0xf7b5('0x2e')]=_[_0xf7b5('0x2f')](_0x3b79c2[_0xf7b5('0x30')],_0x3b79c2[_0xf7b5('0x2d')]);_0x3b8d6b[_0xf7b5('0x31')]=_[_0xf7b5('0x2f')](_0x3b79c2[_0xf7b5('0x30')],qs[_0xf7b5('0x32')](_0x334158['query'][_0xf7b5('0x32')]));_0x3b8d6b[_0xf7b5('0x31')]=_0x3b8d6b['attributes']['length']?_0x3b8d6b[_0xf7b5('0x31')]:_0x3b79c2[_0xf7b5('0x30')];if(!_0x334158[_0xf7b5('0x2d')]['hasOwnProperty']('nolimit')){_0x3b8d6b['limit']=qs[_0xf7b5('0x1c')](_0x334158[_0xf7b5('0x2d')]['limit']);_0x3b8d6b['offset']=qs[_0xf7b5('0x1a')](_0x334158[_0xf7b5('0x2d')][_0xf7b5('0x1a')]);}_0x3b8d6b[_0xf7b5('0x33')]=qs[_0xf7b5('0x34')](_0x334158['query'][_0xf7b5('0x34')]);_0x3b8d6b[_0xf7b5('0x35')]=qs[_0xf7b5('0x2e')](_['pick'](_0x334158[_0xf7b5('0x2d')],_0x3b79c2[_0xf7b5('0x2e')]),_0x4cceff);if(_0x334158[_0xf7b5('0x2d')]['filter']){_0x3b8d6b['where']=_[_0xf7b5('0x36')](_0x3b8d6b[_0xf7b5('0x35')],{'$or':_['map'](_0x4cceff,function(_0x123769){if(_0x123769[_0xf7b5('0x2a')]!==_0xf7b5('0x37')){var _0x3b86ce={};_0x3b86ce[_0x123769[_0xf7b5('0x25')]]={'$like':'%'+_0x334158['query'][_0xf7b5('0x38')]+'%'};return _0x3b86ce;}})});}_0x3b8d6b=_[_0xf7b5('0x36')]({},_0x3b8d6b,_0x334158[_0xf7b5('0x39')]);var _0x4a1f40={'where':_0x3b8d6b[_0xf7b5('0x35')]};return db[_0xf7b5('0x29')][_0xf7b5('0x1d')](_0x4a1f40)[_0xf7b5('0x22')](function(_0x11dcf5){_0x2a0c17[_0xf7b5('0x1d')]=_0x11dcf5;if(_0x334158[_0xf7b5('0x2d')][_0xf7b5('0x3a')]){_0x3b8d6b[_0xf7b5('0x3b')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xf7b5('0x3c')](_0x3b8d6b);})['then'](function(_0x3561f4){_0x2a0c17[_0xf7b5('0x3d')]=_0x3561f4;return _0x2a0c17;})[_0xf7b5('0x22')](respondWithFilteredResult(_0x4ddfa9,_0x3b8d6b))[_0xf7b5('0x3e')](handleError(_0x4ddfa9,null));};exports[_0xf7b5('0x3f')]=function(_0xe87ba7,_0x54c68d){var _0x52c3bc={'raw':!![],'where':{'id':_0xe87ba7[_0xf7b5('0x40')]['id']}},_0x68abaa={};_0x68abaa['model']=_[_0xf7b5('0x2c')](db['VoiceTransferReport'][_0xf7b5('0x41')]);_0x68abaa[_0xf7b5('0x2d')]=_[_0xf7b5('0x2c')](_0xe87ba7['query']);_0x68abaa['filters']=_['intersection'](_0x68abaa[_0xf7b5('0x30')],_0x68abaa[_0xf7b5('0x2d')]);_0x52c3bc[_0xf7b5('0x31')]=_[_0xf7b5('0x2f')](_0x68abaa[_0xf7b5('0x30')],qs[_0xf7b5('0x32')](_0xe87ba7[_0xf7b5('0x2d')][_0xf7b5('0x32')]));_0x52c3bc['attributes']=_0x52c3bc[_0xf7b5('0x31')][_0xf7b5('0x42')]?_0x52c3bc[_0xf7b5('0x31')]:_0x68abaa[_0xf7b5('0x30')];if(_0xe87ba7[_0xf7b5('0x2d')][_0xf7b5('0x3a')]){_0x52c3bc[_0xf7b5('0x3b')]=[{'all':!![]}];}_0x52c3bc=_['merge']({},_0x52c3bc,_0xe87ba7[_0xf7b5('0x39')]);return db['VoiceTransferReport'][_0xf7b5('0x43')](_0x52c3bc)['then'](handleEntityNotFound(_0x54c68d,null))[_0xf7b5('0x22')](respondWithResult(_0x54c68d,null))['catch'](handleError(_0x54c68d,null));};exports['create']=function(_0x5d6f5e,_0x19a493){return db[_0xf7b5('0x29')][_0xf7b5('0x44')](_0x5d6f5e['body'],{})[_0xf7b5('0x22')](respondWithResult(_0x19a493,0xc9))[_0xf7b5('0x3e')](handleError(_0x19a493,null));};exports[_0xf7b5('0x21')]=function(_0x1e48d3,_0x19d9a6){if(_0x1e48d3[_0xf7b5('0x45')]['id']){delete _0x1e48d3[_0xf7b5('0x45')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x1e48d3['params']['id']}})[_0xf7b5('0x22')](handleEntityNotFound(_0x19d9a6,null))['then'](saveUpdates(_0x1e48d3[_0xf7b5('0x45')],null))[_0xf7b5('0x22')](respondWithResult(_0x19d9a6,null))[_0xf7b5('0x3e')](handleError(_0x19d9a6,null));};exports[_0xf7b5('0x23')]=function(_0x515a03,_0x1a5925){return db['VoiceTransferReport']['find']({'where':{'id':_0x515a03[_0xf7b5('0x40')]['id']}})['then'](handleEntityNotFound(_0x1a5925,null))[_0xf7b5('0x22')](removeEntity(_0x1a5925,null))['catch'](handleError(_0x1a5925,null));};exports[_0xf7b5('0x46')]=function(_0x5f27cd,_0x2580b0){return db['VoiceTransferReport']['describe']()['then'](respondWithResult(_0x2580b0,null))[_0xf7b5('0x3e')](handleError(_0x2580b0,null));}; \ No newline at end of file +var _0x9bbd=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','length','find','create','catch','update','body','params','describe','eml-format','rimraf','zip-dir'];(function(_0x3aa6ab,_0x3b5f7c){var _0x5789d7=function(_0xe143d6){while(--_0xe143d6){_0x3aa6ab['push'](_0x3aa6ab['shift']());}};_0x5789d7(++_0x3b5f7c);}(_0x9bbd,0x135));var _0xd9bb=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9bbd[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xd9bb('0x0'));var rimraf=require(_0xd9bb('0x1'));var zipdir=require(_0xd9bb('0x2'));var jsonpatch=require(_0xd9bb('0x3'));var rp=require(_0xd9bb('0x4'));var moment=require(_0xd9bb('0x5'));var BPromise=require(_0xd9bb('0x6'));var Mustache=require(_0xd9bb('0x7'));var util=require(_0xd9bb('0x8'));var path=require(_0xd9bb('0x9'));var sox=require(_0xd9bb('0xa'));var csv=require(_0xd9bb('0xb'));var ejs=require(_0xd9bb('0xc'));var fs=require('fs');var fs_extra=require(_0xd9bb('0xd'));var _=require('lodash');var squel=require(_0xd9bb('0xe'));var crypto=require(_0xd9bb('0xf'));var jsforce=require(_0xd9bb('0x10'));var deskjs=require(_0xd9bb('0x11'));var toCsv=require(_0xd9bb('0xb'));var querystring=require(_0xd9bb('0x12'));var Papa=require(_0xd9bb('0x13'));var Redis=require('ioredis');var authService=require(_0xd9bb('0x14'));var qs=require(_0xd9bb('0x15'));var as=require(_0xd9bb('0x16'));var hardwareService=require(_0xd9bb('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd9bb('0x18'));var licenseUtil=require(_0xd9bb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21f2aa,_0x4705af){_0x4705af=_0x4705af||0xcc;return function(_0x19d25a){if(_0x19d25a){return _0x21f2aa['sendStatus'](_0x4705af);}return _0x21f2aa[_0xd9bb('0x1a')](_0x4705af)[_0xd9bb('0x1b')]();};}function respondWithResult(_0x5d5e66,_0x2ff4e4){_0x2ff4e4=_0x2ff4e4||0xc8;return function(_0x4d53a5){if(_0x4d53a5){return _0x5d5e66[_0xd9bb('0x1a')](_0x2ff4e4)[_0xd9bb('0x1c')](_0x4d53a5);}};}function respondWithFilteredResult(_0x192d7b,_0x155e54){return function(_0x45842e){if(_0x45842e){var _0x5bc080=typeof _0x155e54[_0xd9bb('0x1d')]==='undefined'&&typeof _0x155e54['limit']==='undefined';var _0x5ee085=_0x45842e[_0xd9bb('0x1e')];var _0xa09566=_0x5bc080?0x0:_0x155e54[_0xd9bb('0x1d')];var _0x11eb0c=_0x5bc080?_0x45842e[_0xd9bb('0x1e')]:_0x155e54[_0xd9bb('0x1d')]+_0x155e54[_0xd9bb('0x1f')];var _0x4ffa87;if(_0x11eb0c>=_0x5ee085){_0x11eb0c=_0x5ee085;_0x4ffa87=0xc8;}else{_0x4ffa87=0xce;}_0x192d7b[_0xd9bb('0x1a')](_0x4ffa87);return _0x192d7b[_0xd9bb('0x20')](_0xd9bb('0x21'),_0xa09566+'-'+_0x11eb0c+'/'+_0x5ee085)[_0xd9bb('0x1c')](_0x45842e);}return null;};}function patchUpdates(_0x20f551){return function(_0x43be34){try{jsonpatch[_0xd9bb('0x22')](_0x43be34,_0x20f551,!![]);}catch(_0x65a083){return BPromise[_0xd9bb('0x23')](_0x65a083);}return _0x43be34[_0xd9bb('0x24')]();};}function saveUpdates(_0x502650,_0x52d0c5){return function(_0x2ff23e){if(_0x2ff23e){return _0x2ff23e['update'](_0x502650)['then'](function(_0x1b1aca){return _0x1b1aca;});}return null;};}function removeEntity(_0x120874,_0x2d0b78){return function(_0x470cc3){if(_0x470cc3){return _0x470cc3[_0xd9bb('0x25')]()[_0xd9bb('0x26')](function(){_0x120874[_0xd9bb('0x1a')](0xcc)[_0xd9bb('0x1b')]();});}};}function handleEntityNotFound(_0x47165a,_0x17fb33){return function(_0x1fb08c){if(!_0x1fb08c){_0x47165a['sendStatus'](0x194);}return _0x1fb08c;};}function handleError(_0x399d0d,_0x5eaf48){_0x5eaf48=_0x5eaf48||0x1f4;return function(_0x107902){logger[_0xd9bb('0x27')](_0x107902[_0xd9bb('0x28')]);if(_0x107902[_0xd9bb('0x29')]){delete _0x107902[_0xd9bb('0x29')];}_0x399d0d[_0xd9bb('0x1a')](_0x5eaf48)[_0xd9bb('0x2a')](_0x107902);};}exports[_0xd9bb('0x2b')]=function(_0x578693,_0x2b6e7b){var _0x8f507a={},_0x4bd7ec={},_0x2d0635={'count':0x0,'rows':[]};var _0x439e09=_[_0xd9bb('0x2c')](db[_0xd9bb('0x2d')][_0xd9bb('0x2e')],function(_0x576611){return{'name':_0x576611[_0xd9bb('0x2f')],'type':_0x576611[_0xd9bb('0x30')]['key']};});_0x4bd7ec['model']=_[_0xd9bb('0x2c')](_0x439e09,'name');_0x4bd7ec[_0xd9bb('0x31')]=_[_0xd9bb('0x32')](_0x578693[_0xd9bb('0x31')]);_0x4bd7ec[_0xd9bb('0x33')]=_[_0xd9bb('0x34')](_0x4bd7ec[_0xd9bb('0x35')],_0x4bd7ec[_0xd9bb('0x31')]);_0x8f507a[_0xd9bb('0x36')]=_[_0xd9bb('0x34')](_0x4bd7ec['model'],qs[_0xd9bb('0x37')](_0x578693[_0xd9bb('0x31')][_0xd9bb('0x37')]));_0x8f507a[_0xd9bb('0x36')]=_0x8f507a[_0xd9bb('0x36')]['length']?_0x8f507a[_0xd9bb('0x36')]:_0x4bd7ec['model'];if(!_0x578693[_0xd9bb('0x31')][_0xd9bb('0x38')](_0xd9bb('0x39'))){_0x8f507a['limit']=qs[_0xd9bb('0x1f')](_0x578693['query'][_0xd9bb('0x1f')]);_0x8f507a[_0xd9bb('0x1d')]=qs[_0xd9bb('0x1d')](_0x578693['query'][_0xd9bb('0x1d')]);}_0x8f507a[_0xd9bb('0x3a')]=qs[_0xd9bb('0x3b')](_0x578693[_0xd9bb('0x31')][_0xd9bb('0x3b')]);_0x8f507a['where']=qs[_0xd9bb('0x33')](_[_0xd9bb('0x3c')](_0x578693['query'],_0x4bd7ec[_0xd9bb('0x33')]),_0x439e09);if(_0x578693[_0xd9bb('0x31')][_0xd9bb('0x3d')]){_0x8f507a[_0xd9bb('0x3e')]=_[_0xd9bb('0x3f')](_0x8f507a[_0xd9bb('0x3e')],{'$or':_[_0xd9bb('0x2c')](_0x439e09,function(_0x147c98){if(_0x147c98[_0xd9bb('0x30')]!==_0xd9bb('0x40')){var _0x3ffa35={};_0x3ffa35[_0x147c98[_0xd9bb('0x29')]]={'$like':'%'+_0x578693[_0xd9bb('0x31')][_0xd9bb('0x3d')]+'%'};return _0x3ffa35;}})});}_0x8f507a=_[_0xd9bb('0x3f')]({},_0x8f507a,_0x578693[_0xd9bb('0x41')]);var _0x2ba21e={'where':_0x8f507a[_0xd9bb('0x3e')]};return db[_0xd9bb('0x2d')][_0xd9bb('0x1e')](_0x2ba21e)['then'](function(_0x3d5c1f){_0x2d0635[_0xd9bb('0x1e')]=_0x3d5c1f;if(_0x578693[_0xd9bb('0x31')][_0xd9bb('0x42')]){_0x8f507a[_0xd9bb('0x43')]=[{'all':!![]}];}return db[_0xd9bb('0x2d')][_0xd9bb('0x44')](_0x8f507a);})['then'](function(_0x3c3e07){_0x2d0635['rows']=_0x3c3e07;return _0x2d0635;})[_0xd9bb('0x26')](respondWithFilteredResult(_0x2b6e7b,_0x8f507a))['catch'](handleError(_0x2b6e7b,null));};exports[_0xd9bb('0x45')]=function(_0x59106d,_0x1a193a){var _0x513f5f={'raw':!![],'where':{'id':_0x59106d['params']['id']}},_0x55e50a={};_0x55e50a[_0xd9bb('0x35')]=_[_0xd9bb('0x32')](db[_0xd9bb('0x2d')][_0xd9bb('0x2e')]);_0x55e50a[_0xd9bb('0x31')]=_[_0xd9bb('0x32')](_0x59106d['query']);_0x55e50a['filters']=_[_0xd9bb('0x34')](_0x55e50a[_0xd9bb('0x35')],_0x55e50a['query']);_0x513f5f[_0xd9bb('0x36')]=_[_0xd9bb('0x34')](_0x55e50a['model'],qs[_0xd9bb('0x37')](_0x59106d[_0xd9bb('0x31')][_0xd9bb('0x37')]));_0x513f5f[_0xd9bb('0x36')]=_0x513f5f['attributes'][_0xd9bb('0x46')]?_0x513f5f[_0xd9bb('0x36')]:_0x55e50a[_0xd9bb('0x35')];if(_0x59106d[_0xd9bb('0x31')][_0xd9bb('0x42')]){_0x513f5f[_0xd9bb('0x43')]=[{'all':!![]}];}_0x513f5f=_[_0xd9bb('0x3f')]({},_0x513f5f,_0x59106d[_0xd9bb('0x41')]);return db[_0xd9bb('0x2d')][_0xd9bb('0x47')](_0x513f5f)[_0xd9bb('0x26')](handleEntityNotFound(_0x1a193a,null))[_0xd9bb('0x26')](respondWithResult(_0x1a193a,null))['catch'](handleError(_0x1a193a,null));};exports[_0xd9bb('0x48')]=function(_0x206858,_0x182660){return db[_0xd9bb('0x2d')][_0xd9bb('0x48')](_0x206858['body'],{})[_0xd9bb('0x26')](respondWithResult(_0x182660,0xc9))[_0xd9bb('0x49')](handleError(_0x182660,null));};exports[_0xd9bb('0x4a')]=function(_0x482633,_0x4e7594){if(_0x482633[_0xd9bb('0x4b')]['id']){delete _0x482633[_0xd9bb('0x4b')]['id'];}return db[_0xd9bb('0x2d')][_0xd9bb('0x47')]({'where':{'id':_0x482633[_0xd9bb('0x4c')]['id']}})[_0xd9bb('0x26')](handleEntityNotFound(_0x4e7594,null))[_0xd9bb('0x26')](saveUpdates(_0x482633[_0xd9bb('0x4b')],null))[_0xd9bb('0x26')](respondWithResult(_0x4e7594,null))['catch'](handleError(_0x4e7594,null));};exports[_0xd9bb('0x25')]=function(_0x27135f,_0x33b014){return db[_0xd9bb('0x2d')][_0xd9bb('0x47')]({'where':{'id':_0x27135f[_0xd9bb('0x4c')]['id']}})[_0xd9bb('0x26')](handleEntityNotFound(_0x33b014,null))[_0xd9bb('0x26')](removeEntity(_0x33b014,null))[_0xd9bb('0x49')](handleError(_0x33b014,null));};exports[_0xd9bb('0x4d')]=function(_0x16e532,_0x48b4d6){return db['VoiceTransferReport'][_0xd9bb('0x4d')]()['then'](respondWithResult(_0x48b4d6,null))[_0xd9bb('0x49')](handleError(_0x48b4d6,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 732d9dd..8183908 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 _0x1471=['api','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger'];(function(_0xcfdc19,_0x1f39c2){var _0xb9a8df=function(_0x37c340){while(--_0x37c340){_0xcfdc19['push'](_0xcfdc19['shift']());}};_0xb9a8df(++_0x1f39c2);}(_0x1471,0x1b6));var _0x1147=function(_0x15c3fc,_0x4e0f34){_0x15c3fc=_0x15c3fc-0x0;var _0x37997d=_0x1471[_0x15c3fc];return _0x37997d;};'use strict';var _=require(_0x1147('0x0'));var util=require('util');var logger=require(_0x1147('0x1'))(_0x1147('0x2'));var moment=require('moment');var BPromise=require(_0x1147('0x3'));var rp=require(_0x1147('0x4'));var fs=require('fs');var path=require(_0x1147('0x5'));var rimraf=require('rimraf');var config=require(_0x1147('0x6'));var attributes=require(_0x1147('0x7'));module['exports']=function(_0x49b85b,_0x204dc7){return _0x49b85b[_0x1147('0x8')](_0x1147('0x9'),attributes,{'tableName':_0x1147('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a1e=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x3a1e,0x66));var _0xe3a1=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3a1e[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xe3a1('0x0'));var util=require(_0xe3a1('0x1'));var logger=require(_0xe3a1('0x2'))('api');var moment=require(_0xe3a1('0x3'));var BPromise=require(_0xe3a1('0x4'));var rp=require(_0xe3a1('0x5'));var fs=require('fs');var path=require(_0xe3a1('0x6'));var rimraf=require('rimraf');var config=require(_0xe3a1('0x7'));var attributes=require(_0xe3a1('0x8'));module[_0xe3a1('0x9')]=function(_0x31a3f3,_0x4edf5f){return _0x31a3f3[_0xe3a1('0xa')](_0xe3a1('0xb'),attributes,{'tableName':_0xe3a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index f2f51be..dcd8071 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 _0x1f93=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','stringify'];(function(_0x1b3f60,_0x4acced){var _0x2fcab7=function(_0x3676b6){while(--_0x3676b6){_0x1b3f60['push'](_0x1b3f60['shift']());}};_0x2fcab7(++_0x4acced);}(_0x1f93,0x1a9));var _0x31f9=function(_0x56f8a3,_0x3ea68a){_0x56f8a3=_0x56f8a3-0x0;var _0x2c92f8=_0x1f93[_0x56f8a3];return _0x2c92f8;};'use strict';var _=require('lodash');var util=require(_0x31f9('0x0'));var moment=require(_0x31f9('0x1'));var BPromise=require('bluebird');var rs=require(_0x31f9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31f9('0x3'))['db'];var utils=require(_0x31f9('0x4'));var logger=require('../../config/logger')(_0x31f9('0x5'));var config=require(_0x31f9('0x6'));var jayson=require(_0x31f9('0x7'));var client=jayson['client'][_0x31f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x195cfa,_0x2b598d,_0x1fe87c){return new BPromise(function(_0x46a880,_0x2d934a){return client[_0x31f9('0x9')](_0x195cfa,_0x1fe87c)[_0x31f9('0xa')](function(_0x56c406){logger[_0x31f9('0xb')](_0x31f9('0xc'),_0x2b598d,_0x31f9('0xd'));logger['debug'](_0x31f9('0xe'),_0x2b598d,_0x31f9('0xd'),JSON['stringify'](_0x56c406));if(_0x56c406['error']){if(_0x56c406['error']['code']===0x1f4){logger[_0x31f9('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x2b598d,_0x56c406[_0x31f9('0xf')][_0x31f9('0x10')]);return _0x2d934a(_0x56c406['error']['message']);}logger[_0x31f9('0xf')](_0x31f9('0xc'),_0x2b598d,_0x56c406['error']['message']);return _0x46a880(_0x56c406['error'][_0x31f9('0x10')]);}else{logger['info'](_0x31f9('0xc'),_0x2b598d,_0x31f9('0xd'));_0x46a880(_0x56c406[_0x31f9('0x11')]['message']);}})['catch'](function(_0x4912c7){logger[_0x31f9('0xf')](_0x31f9('0xc'),_0x2b598d,_0x4912c7);_0x2d934a(_0x4912c7);});});}exports[_0x31f9('0x12')]=function(_0x1b7064){var _0xc474f4=this;return new Promise(function(_0x1cd140,_0x332c52){return db[_0x31f9('0x13')][_0x31f9('0x14')](_0x1b7064[_0x31f9('0x15')],{'raw':_0x1b7064['options']?_0x1b7064[_0x31f9('0x16')][_0x31f9('0x17')]===undefined?!![]:![]:!![]})[_0x31f9('0xa')](function(_0x4f3db8){logger[_0x31f9('0xb')](_0x31f9('0x12'),_0x1b7064);logger['debug'](_0x31f9('0x12'),_0x1b7064,JSON[_0x31f9('0x18')](_0x4f3db8));_0x1cd140(_0x4f3db8);})['catch'](function(_0x25d6d2){logger[_0x31f9('0xf')](_0x31f9('0x12'),_0x25d6d2[_0x31f9('0x10')],_0x1b7064);_0x332c52(_0xc474f4[_0x31f9('0xf')](0x1f4,_0x25d6d2['message']));});});}; \ No newline at end of file +var _0xb9f5=['debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','client','http','request','info','request\x20sent'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0xb9f5,0x1d0));var _0x5b9f=function(_0x1075a2,_0xb2f371){_0x1075a2=_0x1075a2-0x0;var _0x43f5f9=_0xb9f5[_0x1075a2];return _0x43f5f9;};'use strict';var _=require(_0x5b9f('0x0'));var util=require(_0x5b9f('0x1'));var moment=require(_0x5b9f('0x2'));var BPromise=require(_0x5b9f('0x3'));var rs=require(_0x5b9f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b9f('0x5'))(_0x5b9f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5b9f('0x7')][_0x5b9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a0868,_0x3245a3,_0x59100a){return new BPromise(function(_0x25c10d,_0x164afe){return client[_0x5b9f('0x9')](_0x1a0868,_0x59100a)['then'](function(_0x3097ed){logger[_0x5b9f('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x3245a3,_0x5b9f('0xb'));logger[_0x5b9f('0xc')](_0x5b9f('0xd'),_0x3245a3,'request\x20sent',JSON['stringify'](_0x3097ed));if(_0x3097ed[_0x5b9f('0xe')]){if(_0x3097ed['error'][_0x5b9f('0xf')]===0x1f4){logger['error'](_0x5b9f('0x10'),_0x3245a3,_0x3097ed[_0x5b9f('0xe')][_0x5b9f('0x11')]);return _0x164afe(_0x3097ed[_0x5b9f('0xe')]['message']);}logger[_0x5b9f('0xe')](_0x5b9f('0x10'),_0x3245a3,_0x3097ed[_0x5b9f('0xe')][_0x5b9f('0x11')]);return _0x25c10d(_0x3097ed['error']['message']);}else{logger[_0x5b9f('0xa')](_0x5b9f('0x10'),_0x3245a3,'request\x20sent');_0x25c10d(_0x3097ed[_0x5b9f('0x12')]['message']);}})[_0x5b9f('0x13')](function(_0x26d4e4){logger[_0x5b9f('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x3245a3,_0x26d4e4);_0x164afe(_0x26d4e4);});});}exports[_0x5b9f('0x14')]=function(_0x3544a1){var _0x4f3b89=this;return new Promise(function(_0x34bf70,_0xcc4202){return db[_0x5b9f('0x15')][_0x5b9f('0x16')](_0x3544a1[_0x5b9f('0x17')],{'raw':_0x3544a1[_0x5b9f('0x18')]?_0x3544a1[_0x5b9f('0x18')][_0x5b9f('0x19')]===undefined?!![]:![]:!![]})[_0x5b9f('0x1a')](function(_0x3bc293){logger[_0x5b9f('0xa')](_0x5b9f('0x14'),_0x3544a1);logger['debug'](_0x5b9f('0x14'),_0x3544a1,JSON[_0x5b9f('0x1b')](_0x3bc293));_0x34bf70(_0x3bc293);})[_0x5b9f('0x13')](function(_0x465439){logger[_0x5b9f('0xe')](_0x5b9f('0x14'),_0x465439['message'],_0x3544a1);_0xcc4202(_0x4f3b89[_0x5b9f('0xe')](0x1f4,_0x465439[_0x5b9f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 41dcdd6..4f92718 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 _0x9a19=['hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup'];(function(_0x3062ef,_0x491f88){var _0x864a7f=function(_0x1993e5){while(--_0x1993e5){_0x3062ef['push'](_0x3062ef['shift']());}};_0x864a7f(++_0x491f88);}(_0x9a19,0x114));var _0x99a1=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9a19[_0x50a0c2];return _0x5ebadd;};'use strict';var express=require(_0x99a1('0x0'));var router=express[_0x99a1('0x1')]();var auth=require(_0x99a1('0x2'));var controller=require('./webbar.controller');router[_0x99a1('0x3')](_0x99a1('0x4'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x7')]);router[_0x99a1('0x3')](_0x99a1('0x8'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x9')]);router[_0x99a1('0x3')]('/answer',auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x99a1('0xa')]);router[_0x99a1('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x3')](_0x99a1('0xc'),auth[_0x99a1('0x5')](),auth['isWebrtcLicence'](),controller[_0x99a1('0xd')]);router[_0x99a1('0x3')](_0x99a1('0xe'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x3')](_0x99a1('0x10'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x11')]);module[_0x99a1('0x12')]=router; \ No newline at end of file +var _0x54ef=['unhold','/calls','/transfer','transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/hold','hold','/unhold'];(function(_0x4627dd,_0xcaf0b9){var _0x427e45=function(_0x542b2f){while(--_0x542b2f){_0x4627dd['push'](_0x4627dd['shift']());}};_0x427e45(++_0xcaf0b9);}(_0x54ef,0x112));var _0xf54e=function(_0x2fc090,_0x3f9ac2){_0x2fc090=_0x2fc090-0x0;var _0x580e0a=_0x54ef[_0x2fc090];return _0x580e0a;};'use strict';var express=require(_0xf54e('0x0'));var router=express[_0xf54e('0x1')]();var auth=require(_0xf54e('0x2'));var controller=require('./webbar.controller');router[_0xf54e('0x3')](_0xf54e('0x4'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x7')]);router[_0xf54e('0x3')](_0xf54e('0x8'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xf54e('0x9')]);router[_0xf54e('0x3')](_0xf54e('0xa'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['answer']);router[_0xf54e('0x3')](_0xf54e('0xb'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xc')]);router[_0xf54e('0x3')](_0xf54e('0xd'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xe')]);router[_0xf54e('0x3')](_0xf54e('0xf'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['calls']);router['post'](_0xf54e('0x10'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d9df61f..6c473bd 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 _0x9f62=['user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer','answer\x20fired:','validate','webbar:answer','answer\x20executed!','hold','entityFound:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../config/environment','util','bluebird','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','callNumber\x20is\x20required','string','userId\x20is\x20required','transferNumber\x20is\x20required','number','info','stringify','log','handleError:','stack','name','status','send','NotFound','request','error','code','message','result','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','originate','originate\x20fired:','body','json','userId','callNumber','callerId','format'];(function(_0x2fb8d3,_0x2ec153){var _0x278bec=function(_0x2bfd19){while(--_0x2bfd19){_0x2fb8d3['push'](_0x2fb8d3['shift']());}};_0x278bec(++_0x2ec153);}(_0x9f62,0x154));var _0x29f6=function(_0xba1420,_0x25eae5){_0xba1420=_0xba1420-0x0;var _0x2ae9c8=_0x9f62[_0xba1420];return _0x2ae9c8;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x29f6('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x29f6('0x1'));var util=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x29f6('0x4')]({'port':0x232a});var logger=require(_0x29f6('0x5'))(_0x29f6('0x6'));var Redis=require(_0x29f6('0x7'));config['redis']=_[_0x29f6('0x8')](config[_0x29f6('0x9')],{'host':_0x29f6('0xa'),'port':0x18eb});var io=require(_0x29f6('0xb'))(new Redis(config[_0x29f6('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x29f6('0xc')]},'callerId':{'type':_0x29f6('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x29f6('0xe')]},'sessionId':{'type':_0x29f6('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x29f6('0xe')]},'sessionId':{'type':_0x29f6('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x29f6('0xd'),'required':[!![],_0x29f6('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x29f6('0x10'),'required':[!![],_0x29f6('0xe')]},'sessionId':{'type':_0x29f6('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x29f6('0x10'),'required':[!![],_0x29f6('0xe')]},'sessionId':{'type':_0x29f6('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x29f6('0x10'),'required':[!![],_0x29f6('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x29f6('0x10'),'required':[!![],_0x29f6('0xe')]}});function emit(_0x1dde97,_0x3a75d0,_0x25e5a2){logger[_0x29f6('0x11')](_0x1dde97,_0x3a75d0,JSON[_0x29f6('0x12')](_0x25e5a2));io['to'](_0x1dde97)['emit'](_0x3a75d0,_0x25e5a2);}function handleError(_0x51c92f){return function(_0x2e66d3){console[_0x29f6('0x13')](_0x29f6('0x14'),_0x2e66d3,_0x2e66d3 instanceof RangeError);logger['error'](_0x2e66d3[_0x29f6('0x15')]);if(_0x2e66d3 instanceof RangeError){if(_0x2e66d3[_0x29f6('0x16')]){delete _0x2e66d3['name'];}_0x51c92f[_0x29f6('0x17')](0x194)[_0x29f6('0x18')](_0x2e66d3);}else{if(_0x2e66d3[_0x29f6('0x16')]){delete _0x2e66d3[_0x29f6('0x16')];}_0x51c92f[_0x29f6('0x17')](0x1f4)[_0x29f6('0x18')](_0x2e66d3);}};}function checkError(){return function(_0x5673c8){if(!_0x5673c8){throw new RangeError(_0x29f6('0x19'));}return _0x5673c8;};}function respondWithRpcPromise(_0x59def4,_0x4acb15){return new BPromise(function(_0x470019,_0x1fa159){var _0x39c6b3=amiClient;return _0x39c6b3[_0x29f6('0x1a')](_0x59def4,_0x4acb15)['then'](function(_0x2c672e){if(_0x2c672e['error']){if(_0x2c672e[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){return _0x1fa159(_0x2c672e[_0x29f6('0x1b')][_0x29f6('0x1d')]);}return _0x470019(_0x2c672e['error'][_0x29f6('0x1d')]);}else{_0x470019(_0x2c672e[_0x29f6('0x1e')]);}})['catch'](function(_0x1401fb){_0x1fa159(_0x1401fb);});});}function getAgent(_0x45f792){return db[_0x29f6('0x1f')][_0x29f6('0x20')]({'where':{'id':_0x45f792,'role':_0x29f6('0x21')}})[_0x29f6('0x22')](checkError());}function getAgentCheckSession(_0x23c630,_0x50cdd2){return new BPromise(function(_0x2183b7,_0x454a4a){var _0x1ab8d8=respondWithRpcPromise(_0x29f6('0x23'));var _0xda0a63=getAgent(_0x23c630);Promise[_0x29f6('0x24')]([_0x1ab8d8,_0xda0a63])[_0x29f6('0x22')](function(_0x17b2f2){var _0x3d88db=_0x17b2f2[0x0];var _0x13a3a2=_0x17b2f2[0x1];var _0x2915bc=_[_0x29f6('0x25')](_0x3d88db[_0x29f6('0x26')],function(_0x304c28){return _0x304c28[_0x29f6('0x27')]==_0x13a3a2['id']&&_0x304c28[_0x29f6('0x28')]==_0x50cdd2;});if(_0x2915bc[_0x29f6('0x29')]==0x1){_0x2183b7(_0x13a3a2);}else{_0x454a4a(new RangeError('sessionId\x20'+_0x50cdd2+'\x20not\x20found!'));}});});}exports[_0x29f6('0x2a')]=function(_0x489897,_0x341071){logger[_0x29f6('0x11')](_0x29f6('0x2b'),_0x489897[_0x29f6('0x2c')]);var _0x5e5d89=originateValidation['validate'](_0x489897[_0x29f6('0x2c')]);if(_0x5e5d89[_0x29f6('0x29')]>0x0){return _0x341071[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0x5e5d89);}var _0x3a223b=_0x489897[_0x29f6('0x2c')][_0x29f6('0x2e')];var _0x1c3f0f=_0x489897[_0x29f6('0x2c')][_0x29f6('0x2f')];var _0x46d0d0=_0x489897[_0x29f6('0x2c')][_0x29f6('0x30')];var _0x23ad1a=_0x489897['body']['callbackUrl'];return getAgent(_0x3a223b)[_0x29f6('0x22')](function(_0x44cf19){logger[_0x29f6('0x11')]('entityFound:',_0x44cf19[_0x29f6('0x16')]);emit(util[_0x29f6('0x31')](_0x29f6('0x32'),_0x44cf19[_0x29f6('0x16')]),_0x29f6('0x33'),{'callNumber':_0x1c3f0f,'callerId':_0x46d0d0,'callbackUrl':_0x23ad1a});return _0x341071['status'](0xc8)[_0x29f6('0x2d')]({'error':![],'message':_0x29f6('0x34')});})[_0x29f6('0x35')](handleError(_0x341071));};exports[_0x29f6('0x36')]=function(_0x4f5fe1,_0x30d747){logger[_0x29f6('0x11')](_0x29f6('0x37'),_0x4f5fe1[_0x29f6('0x2c')]);var _0x5ddc09=hangupValidation['validate'](_0x4f5fe1[_0x29f6('0x2c')]);if(_0x5ddc09['length']>0x0){return _0x30d747[_0x29f6('0x17')](0x190)['json'](_0x5ddc09);}var _0x3a1a75=_0x4f5fe1['body'][_0x29f6('0x2e')];var _0x11fb2d=_0x4f5fe1['body'][_0x29f6('0x28')];return getAgent(_0x3a1a75)['then'](function(_0x3f3475){logger[_0x29f6('0x11')]('entityFound:',_0x3f3475[_0x29f6('0x16')]);emit(util[_0x29f6('0x31')](_0x29f6('0x32'),_0x3f3475[_0x29f6('0x16')]),'webbar:hangup',{'sessionId':_0x11fb2d});return _0x30d747[_0x29f6('0x17')](0xc8)[_0x29f6('0x2d')]({'error':![],'message':_0x29f6('0x38')});})[_0x29f6('0x35')](handleError(_0x30d747));};exports[_0x29f6('0x39')]=function(_0x4d4189,_0xb5f2b1){logger['info'](_0x29f6('0x3a'),_0x4d4189['body']);var _0xbfe671=answerValidation[_0x29f6('0x3b')](_0x4d4189['body']);if(_0xbfe671[_0x29f6('0x29')]>0x0){return _0xb5f2b1[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0xbfe671);}var _0x27d655=_0x4d4189['body'][_0x29f6('0x2e')];var _0x2a83b7=_0x4d4189[_0x29f6('0x2c')]['sessionId'];return getAgent(_0x27d655)[_0x29f6('0x22')](function(_0x4a5f35){logger[_0x29f6('0x11')]('entityFound:',_0x4a5f35['name']);emit(util['format'](_0x29f6('0x32'),_0x4a5f35[_0x29f6('0x16')]),_0x29f6('0x3c'),{'sessionId':_0x2a83b7});return _0xb5f2b1[_0x29f6('0x17')](0xc8)[_0x29f6('0x2d')]({'error':![],'message':_0x29f6('0x3d')});})[_0x29f6('0x35')](handleError(_0xb5f2b1));};exports[_0x29f6('0x3e')]=function(_0x352119,_0x1bde93){logger['info']('hold\x20fired:',_0x352119[_0x29f6('0x2c')]);var _0x450e76=holdValidation[_0x29f6('0x3b')](_0x352119[_0x29f6('0x2c')]);if(_0x450e76['length']>0x0){return _0x1bde93[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0x450e76);}var _0x532df5=_0x352119[_0x29f6('0x2c')][_0x29f6('0x2e')];var _0x123e2f=_0x352119[_0x29f6('0x2c')][_0x29f6('0x28')];return getAgent(_0x532df5)[_0x29f6('0x22')](function(_0x320b5e){logger[_0x29f6('0x11')](_0x29f6('0x3f'),_0x320b5e[_0x29f6('0x16')]);emit(util[_0x29f6('0x31')](_0x29f6('0x32'),_0x320b5e['name']),_0x29f6('0x40'),{'sessionId':_0x123e2f});return _0x1bde93[_0x29f6('0x17')](0xc8)[_0x29f6('0x2d')]({'error':![],'message':_0x29f6('0x41')});})[_0x29f6('0x35')](handleError(_0x1bde93));};exports['unhold']=function(_0x2e29e3,_0x52be22){logger['info'](_0x29f6('0x42'),_0x2e29e3[_0x29f6('0x2c')]);var _0x3194fa=unholdValidation[_0x29f6('0x3b')](_0x2e29e3[_0x29f6('0x2c')]);if(_0x3194fa['length']>0x0){return _0x52be22[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0x3194fa);}var _0x5f42f3=_0x2e29e3[_0x29f6('0x2c')]['userId'];var _0x288cf2=_0x2e29e3[_0x29f6('0x2c')][_0x29f6('0x28')];return getAgent(_0x5f42f3)[_0x29f6('0x22')](function(_0x5c9113){logger[_0x29f6('0x11')](_0x29f6('0x3f'),_0x5c9113[_0x29f6('0x16')]);emit(util[_0x29f6('0x31')](_0x29f6('0x32'),_0x5c9113[_0x29f6('0x16')]),_0x29f6('0x43'),{'sessionId':_0x288cf2});return _0x52be22['status'](0xc8)[_0x29f6('0x2d')]({'error':![],'message':_0x29f6('0x44')});})[_0x29f6('0x35')](handleError(_0x52be22));};exports[_0x29f6('0x45')]=function(_0x36e52c,_0x1ac20d){logger[_0x29f6('0x11')](_0x29f6('0x46'),_0x1ac20d[_0x29f6('0x2c')]);var _0x3dbd19=callsValidation['validate'](_0x36e52c['body']);if(_0x3dbd19[_0x29f6('0x29')]>0x0){return _0x1ac20d[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0x3dbd19);}var _0x5ab84e=_0x36e52c[_0x29f6('0x2c')]['userId'];var _0x550190=respondWithRpcPromise(_0x29f6('0x23'));var _0x234d30=getAgent(_0x5ab84e);return Promise['all']([_0x550190,_0x234d30])['then'](function(_0x3e22f8){var _0x46998c=_0x3e22f8[0x0];var _0x439c0b=_0x3e22f8[0x1];var _0x58694e=_[_0x29f6('0x25')](_0x46998c[_0x29f6('0x26')],function(_0x4284fd){return _0x4284fd[_0x29f6('0x27')]==_0x439c0b['id'];});return _0x1ac20d[_0x29f6('0x17')](0xc8)[_0x29f6('0x2d')]({'count':_0x58694e[_0x29f6('0x29')],'rows':_0x58694e});})[_0x29f6('0x35')](handleError(_0x1ac20d));};exports[_0x29f6('0x47')]=function(_0x192525,_0x2d4c8d){logger[_0x29f6('0x11')](_0x29f6('0x48'),_0x192525['body']);var _0x5e25c0=conferenceValidation[_0x29f6('0x3b')](_0x192525['body']);if(_0x5e25c0[_0x29f6('0x29')]>0x0){return _0x2d4c8d[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0x5e25c0);}var _0x40b4d7=_0x192525[_0x29f6('0x2c')]['userId'];return getAgent(_0x40b4d7)[_0x29f6('0x22')](function(_0x38d684){logger[_0x29f6('0x11')](_0x29f6('0x3f'),_0x38d684[_0x29f6('0x16')]);emit(util['format'](_0x29f6('0x32'),_0x38d684['name']),'webbar:conference');return _0x2d4c8d[_0x29f6('0x17')](0xc8)[_0x29f6('0x2d')]({'error':![],'message':'conference\x20executed!'});})[_0x29f6('0x35')](handleError(_0x2d4c8d));};exports[_0x29f6('0x49')]=function(_0x58bdf4,_0x44b3ee){logger[_0x29f6('0x11')](_0x29f6('0x4a'),_0x58bdf4[_0x29f6('0x2c')]);var _0xf3c5f1=transferValidation[_0x29f6('0x3b')](_0x58bdf4[_0x29f6('0x2c')]);if(_0xf3c5f1['length']>0x0){return _0x44b3ee[_0x29f6('0x17')](0x190)['json'](_0xf3c5f1);}var _0x37162d=_0x58bdf4['body']['userId'];var _0x1a3357=_0x58bdf4[_0x29f6('0x2c')][_0x29f6('0x28')];var _0x536b0c=_0x58bdf4[_0x29f6('0x2c')][_0x29f6('0x4b')];return getAgent(_0x37162d)[_0x29f6('0x22')](function(_0x5625b1){logger[_0x29f6('0x11')](_0x29f6('0x3f'),_0x5625b1[_0x29f6('0x16')]);emit(util[_0x29f6('0x31')](_0x29f6('0x32'),_0x5625b1[_0x29f6('0x16')]),_0x29f6('0x4c'),{'sessionId':_0x1a3357,'transferNumber':_0x536b0c});return _0x44b3ee[_0x29f6('0x17')](0xc8)['json']({'error':![],'message':_0x29f6('0x4d')});})[_0x29f6('0x35')](handleError(_0x44b3ee));}; \ No newline at end of file +var _0x579c=['redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','result','catch','User','VoiceChannels','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','body','json','callbackUrl','user:%s','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','userId','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','http','../../config/logger','webbarapi','ioredis'];(function(_0x275268,_0x5907a6){var _0x27aa04=function(_0x28bfc7){while(--_0x28bfc7){_0x275268['push'](_0x275268['shift']());}};_0x27aa04(++_0x5907a6);}(_0x579c,0xda));var _0xc579=function(_0x5e3d33,_0x221945){_0x5e3d33=_0x5e3d33-0x0;var _0x1bbf23=_0x579c[_0x5e3d33];return _0x1bbf23;};'use strict';var path=require(_0xc579('0x0'));var fs=require('fs');var _=require(_0xc579('0x1'));var db=require(_0xc579('0x2'))['db'];var config=require(_0xc579('0x3'));var util=require(_0xc579('0x4'));var BPromise=require('bluebird');var jayson=require(_0xc579('0x5'));var amiClient=jayson['client'][_0xc579('0x6')]({'port':0x232a});var logger=require(_0xc579('0x7'))(_0xc579('0x8'));var Redis=require(_0xc579('0x9'));config[_0xc579('0xa')]=_[_0xc579('0xb')](config[_0xc579('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xc579('0xc'))(new Redis(config[_0xc579('0xa')]));var Schema=require(_0xc579('0xd'));var originateValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],_0xc579('0xf')]},'callNumber':{'type':_0xc579('0x10'),'required':[!![],_0xc579('0x11')]},'callerId':{'type':_0xc579('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],_0xc579('0xf')]},'sessionId':{'type':_0xc579('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],_0xc579('0xf')]},'sessionId':{'type':_0xc579('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],_0xc579('0xf')]},'sessionId':{'type':_0xc579('0x10'),'required':[!![],_0xc579('0x12')]},'transferNumber':{'type':_0xc579('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc579('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc579('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xc579('0xe'),'required':[!![],_0xc579('0xf')]}});function emit(_0x567de5,_0x54557b,_0x3f5d14){logger[_0xc579('0x13')](_0x567de5,_0x54557b,JSON[_0xc579('0x14')](_0x3f5d14));io['to'](_0x567de5)[_0xc579('0x15')](_0x54557b,_0x3f5d14);}function handleError(_0x7d5865){return function(_0x33d341){console[_0xc579('0x16')](_0xc579('0x17'),_0x33d341,_0x33d341 instanceof RangeError);logger[_0xc579('0x18')](_0x33d341[_0xc579('0x19')]);if(_0x33d341 instanceof RangeError){if(_0x33d341['name']){delete _0x33d341[_0xc579('0x1a')];}_0x7d5865[_0xc579('0x1b')](0x194)['send'](_0x33d341);}else{if(_0x33d341[_0xc579('0x1a')]){delete _0x33d341[_0xc579('0x1a')];}_0x7d5865[_0xc579('0x1b')](0x1f4)[_0xc579('0x1c')](_0x33d341);}};}function checkError(){return function(_0x13188a){if(!_0x13188a){throw new RangeError(_0xc579('0x1d'));}return _0x13188a;};}function respondWithRpcPromise(_0x147bb6,_0x1b214d){return new BPromise(function(_0x55781e,_0x92657f){var _0xad4889=amiClient;return _0xad4889[_0xc579('0x1e')](_0x147bb6,_0x1b214d)[_0xc579('0x1f')](function(_0x1da86e){if(_0x1da86e['error']){if(_0x1da86e[_0xc579('0x18')][_0xc579('0x20')]===0x1f4){return _0x92657f(_0x1da86e[_0xc579('0x18')]['message']);}return _0x55781e(_0x1da86e[_0xc579('0x18')]['message']);}else{_0x55781e(_0x1da86e[_0xc579('0x21')]);}})[_0xc579('0x22')](function(_0x4d758a){_0x92657f(_0x4d758a);});});}function getAgent(_0x5935e9){return db[_0xc579('0x23')]['findOne']({'where':{'id':_0x5935e9,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x540d90,_0x3f7363){return new BPromise(function(_0xfdbb73,_0x2ddebd){var _0x206e39=respondWithRpcPromise(_0xc579('0x24'));var _0x45fef4=getAgent(_0x540d90);Promise['all']([_0x206e39,_0x45fef4])['then'](function(_0x4a5f6){var _0x4897a1=_0x4a5f6[0x0];var _0x314daa=_0x4a5f6[0x1];var _0x56224e=_[_0xc579('0x25')](_0x4897a1[_0xc579('0x26')],function(_0x1ad8f7){return _0x1ad8f7[_0xc579('0x27')]==_0x314daa['id']&&_0x1ad8f7[_0xc579('0x28')]==_0x3f7363;});if(_0x56224e[_0xc579('0x29')]==0x1){_0xfdbb73(_0x314daa);}else{_0x2ddebd(new RangeError('sessionId\x20'+_0x3f7363+_0xc579('0x2a')));}});});}exports[_0xc579('0x2b')]=function(_0x1ace71,_0x333fa4){logger['info']('originate\x20fired:',_0x1ace71[_0xc579('0x2c')]);var _0x560e3b=originateValidation[_0xc579('0xd')](_0x1ace71[_0xc579('0x2c')]);if(_0x560e3b[_0xc579('0x29')]>0x0){return _0x333fa4[_0xc579('0x1b')](0x190)[_0xc579('0x2d')](_0x560e3b);}var _0x552c3a=_0x1ace71[_0xc579('0x2c')]['userId'];var _0x172409=_0x1ace71[_0xc579('0x2c')]['callNumber'];var _0x3535af=_0x1ace71[_0xc579('0x2c')]['callerId'];var _0x499229=_0x1ace71[_0xc579('0x2c')][_0xc579('0x2e')];return getAgent(_0x552c3a)['then'](function(_0x3775d7){logger[_0xc579('0x13')]('entityFound:',_0x3775d7[_0xc579('0x1a')]);emit(util['format'](_0xc579('0x2f'),_0x3775d7[_0xc579('0x1a')]),'webbar:originate',{'callNumber':_0x172409,'callerId':_0x3535af,'callbackUrl':_0x499229});return _0x333fa4[_0xc579('0x1b')](0xc8)[_0xc579('0x2d')]({'error':![],'message':_0xc579('0x30')});})[_0xc579('0x22')](handleError(_0x333fa4));};exports[_0xc579('0x31')]=function(_0x324b51,_0x59ae89){logger[_0xc579('0x13')](_0xc579('0x32'),_0x324b51['body']);var _0xc21792=hangupValidation[_0xc579('0xd')](_0x324b51[_0xc579('0x2c')]);if(_0xc21792[_0xc579('0x29')]>0x0){return _0x59ae89['status'](0x190)[_0xc579('0x2d')](_0xc21792);}var _0x2864de=_0x324b51[_0xc579('0x2c')]['userId'];var _0x500b0d=_0x324b51['body'][_0xc579('0x28')];return getAgent(_0x2864de)[_0xc579('0x1f')](function(_0x3349e0){logger[_0xc579('0x13')](_0xc579('0x33'),_0x3349e0[_0xc579('0x1a')]);emit(util['format'](_0xc579('0x2f'),_0x3349e0['name']),_0xc579('0x34'),{'sessionId':_0x500b0d});return _0x59ae89[_0xc579('0x1b')](0xc8)[_0xc579('0x2d')]({'error':![],'message':_0xc579('0x35')});})[_0xc579('0x22')](handleError(_0x59ae89));};exports[_0xc579('0x36')]=function(_0x120410,_0x44f77e){logger['info'](_0xc579('0x37'),_0x120410[_0xc579('0x2c')]);var _0x74b63d=answerValidation[_0xc579('0xd')](_0x120410[_0xc579('0x2c')]);if(_0x74b63d[_0xc579('0x29')]>0x0){return _0x44f77e['status'](0x190)[_0xc579('0x2d')](_0x74b63d);}var _0x290493=_0x120410[_0xc579('0x2c')]['userId'];var _0x3e66c0=_0x120410[_0xc579('0x2c')][_0xc579('0x28')];return getAgent(_0x290493)['then'](function(_0x3a5b10){logger['info'](_0xc579('0x33'),_0x3a5b10[_0xc579('0x1a')]);emit(util[_0xc579('0x38')]('user:%s',_0x3a5b10[_0xc579('0x1a')]),_0xc579('0x39'),{'sessionId':_0x3e66c0});return _0x44f77e['status'](0xc8)['json']({'error':![],'message':_0xc579('0x3a')});})[_0xc579('0x22')](handleError(_0x44f77e));};exports[_0xc579('0x3b')]=function(_0x3964df,_0x524daa){logger['info'](_0xc579('0x3c'),_0x3964df[_0xc579('0x2c')]);var _0x292b95=holdValidation[_0xc579('0xd')](_0x3964df['body']);if(_0x292b95[_0xc579('0x29')]>0x0){return _0x524daa[_0xc579('0x1b')](0x190)['json'](_0x292b95);}var _0x40d790=_0x3964df['body']['userId'];var _0x5b2929=_0x3964df[_0xc579('0x2c')][_0xc579('0x28')];return getAgent(_0x40d790)[_0xc579('0x1f')](function(_0x90a0d3){logger[_0xc579('0x13')]('entityFound:',_0x90a0d3[_0xc579('0x1a')]);emit(util[_0xc579('0x38')](_0xc579('0x2f'),_0x90a0d3['name']),'webbar:hold',{'sessionId':_0x5b2929});return _0x524daa[_0xc579('0x1b')](0xc8)[_0xc579('0x2d')]({'error':![],'message':_0xc579('0x3d')});})[_0xc579('0x22')](handleError(_0x524daa));};exports[_0xc579('0x3e')]=function(_0xe1a1d7,_0x138ab2){logger['info']('unhold\x20fired:',_0xe1a1d7[_0xc579('0x2c')]);var _0x349c65=unholdValidation['validate'](_0xe1a1d7[_0xc579('0x2c')]);if(_0x349c65['length']>0x0){return _0x138ab2[_0xc579('0x1b')](0x190)[_0xc579('0x2d')](_0x349c65);}var _0x3cb0f7=_0xe1a1d7[_0xc579('0x2c')][_0xc579('0x3f')];var _0x297b54=_0xe1a1d7['body'][_0xc579('0x28')];return getAgent(_0x3cb0f7)[_0xc579('0x1f')](function(_0x20bd2a){logger['info'](_0xc579('0x33'),_0x20bd2a['name']);emit(util[_0xc579('0x38')](_0xc579('0x2f'),_0x20bd2a[_0xc579('0x1a')]),_0xc579('0x40'),{'sessionId':_0x297b54});return _0x138ab2['status'](0xc8)['json']({'error':![],'message':_0xc579('0x41')});})['catch'](handleError(_0x138ab2));};exports[_0xc579('0x42')]=function(_0x3737f1,_0x2aafde){logger['info'](_0xc579('0x43'),_0x2aafde[_0xc579('0x2c')]);var _0x4a2701=callsValidation[_0xc579('0xd')](_0x3737f1[_0xc579('0x2c')]);if(_0x4a2701[_0xc579('0x29')]>0x0){return _0x2aafde[_0xc579('0x1b')](0x190)[_0xc579('0x2d')](_0x4a2701);}var _0x50e98a=_0x3737f1['body'][_0xc579('0x3f')];var _0x409948=respondWithRpcPromise(_0xc579('0x24'));var _0x56c482=getAgent(_0x50e98a);return Promise['all']([_0x409948,_0x56c482])[_0xc579('0x1f')](function(_0x4554a2){var _0x4fb2fb=_0x4554a2[0x0];var _0x1d1d5b=_0x4554a2[0x1];var _0x43d2b1=_[_0xc579('0x25')](_0x4fb2fb[_0xc579('0x26')],function(_0x2b5325){return _0x2b5325[_0xc579('0x27')]==_0x1d1d5b['id'];});return _0x2aafde[_0xc579('0x1b')](0xc8)['json']({'count':_0x43d2b1[_0xc579('0x29')],'rows':_0x43d2b1});})[_0xc579('0x22')](handleError(_0x2aafde));};exports[_0xc579('0x44')]=function(_0x59579b,_0x27678a){logger['info'](_0xc579('0x45'),_0x59579b[_0xc579('0x2c')]);var _0x119faa=conferenceValidation[_0xc579('0xd')](_0x59579b[_0xc579('0x2c')]);if(_0x119faa['length']>0x0){return _0x27678a[_0xc579('0x1b')](0x190)[_0xc579('0x2d')](_0x119faa);}var _0x2844b2=_0x59579b[_0xc579('0x2c')][_0xc579('0x3f')];return getAgent(_0x2844b2)[_0xc579('0x1f')](function(_0x5c4d32){logger[_0xc579('0x13')](_0xc579('0x33'),_0x5c4d32[_0xc579('0x1a')]);emit(util[_0xc579('0x38')](_0xc579('0x2f'),_0x5c4d32[_0xc579('0x1a')]),_0xc579('0x46'));return _0x27678a[_0xc579('0x1b')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0xc579('0x22')](handleError(_0x27678a));};exports[_0xc579('0x47')]=function(_0x98f60,_0x1d05dd){logger[_0xc579('0x13')](_0xc579('0x48'),_0x98f60[_0xc579('0x2c')]);var _0x10981b=transferValidation[_0xc579('0xd')](_0x98f60[_0xc579('0x2c')]);if(_0x10981b[_0xc579('0x29')]>0x0){return _0x1d05dd[_0xc579('0x1b')](0x190)[_0xc579('0x2d')](_0x10981b);}var _0x33109f=_0x98f60['body'][_0xc579('0x3f')];var _0x2a45d7=_0x98f60['body'][_0xc579('0x28')];var _0x1ff618=_0x98f60['body'][_0xc579('0x49')];return getAgent(_0x33109f)[_0xc579('0x1f')](function(_0x1ab782){logger[_0xc579('0x13')](_0xc579('0x33'),_0x1ab782[_0xc579('0x1a')]);emit(util[_0xc579('0x38')](_0xc579('0x2f'),_0x1ab782[_0xc579('0x1a')]),_0xc579('0x4a'),{'sessionId':_0x2a45d7,'transferNumber':_0x1ff618});return _0x1d05dd[_0xc579('0x1b')](0xc8)[_0xc579('0x2d')]({'error':![],'message':_0xc579('0x4b')});})['catch'](handleError(_0x1d05dd));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d42b26c..57f7ca2 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 _0xd4a2=['../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','addAgents','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','connect-timeout','Router'];(function(_0x378e07,_0x31a60f){var _0x15f2d0=function(_0x2260f3){while(--_0x2260f3){_0x378e07['push'](_0x378e07['shift']());}};_0x15f2d0(++_0x31a60f);}(_0xd4a2,0x173));var _0x2d4a=function(_0x37378d,_0x3a2a50){_0x37378d=_0x37378d-0x0;var _0x16d811=_0xd4a2[_0x37378d];return _0x16d811;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0x6')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2d4a('0xf')]);router['get'](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x11')]);router[_0x2d4a('0x6')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x13')]);router[_0x2d4a('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d4a('0x14')]('/:id/dispositions',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x15')]);router[_0x2d4a('0x14')](_0x2d4a('0x16'),auth['isAuthenticated'](),controller[_0x2d4a('0x17')]);router['post'](_0x2d4a('0x10'),auth['isAuthenticated'](),controller[_0x2d4a('0x18')]);router[_0x2d4a('0x14')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x2d4a('0x19')]);router[_0x2d4a('0x14')](_0x2d4a('0x1a'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1b')]);router[_0x2d4a('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x2d4a('0x1d')]);router[_0x2d4a('0x1e')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1f')]);router[_0x2d4a('0x1e')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller['removeDispositions']);router[_0x2d4a('0x1e')](_0x2d4a('0x16'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x20')]);router[_0x2d4a('0x1e')](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x21')]);module['exports']=router; \ No newline at end of file +var _0x33af=['getAnswers','/:id/users','/:id/applications','post','create','addDisposition','addAgents','addApplications','/:id/notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions'];(function(_0xf1b011,_0x85263a){var _0x1f9ba4=function(_0x2337db){while(--_0x2337db){_0xf1b011['push'](_0xf1b011['shift']());}};_0x1f9ba4(++_0x85263a);}(_0x33af,0xec));var _0xf33a=function(_0x2ef252,_0x1993fe){_0x2ef252=_0x2ef252-0x0;var _0x1139ca=_0x33af[_0x2ef252];return _0x1139ca;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0x8')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router['get']('/:id/canned_answers',auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x8')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller['getAgents']);router[_0xf33a('0x8')](_0xf33a('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0xf33a('0x13')]('/',auth[_0xf33a('0xb')](),controller[_0xf33a('0x14')]);router[_0xf33a('0x13')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x15')]);router[_0xf33a('0x13')]('/:id/canned_answers',auth[_0xf33a('0xb')](),controller['addAnswer']);router[_0xf33a('0x13')](_0xf33a('0x11'),auth['isAuthenticated'](),controller[_0xf33a('0x16')]);router[_0xf33a('0x13')]('/:id/applications',auth[_0xf33a('0xb')](),controller[_0xf33a('0x17')]);router[_0xf33a('0x13')](_0xf33a('0x18'),controller['notify']);router[_0xf33a('0x13')](_0xf33a('0x19'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1a')]);router[_0xf33a('0x1b')](_0xf33a('0x1c'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1d')]);router[_0xf33a('0x1e')](_0xf33a('0x1c'),auth['isAuthenticated'](),controller[_0xf33a('0x1f')]);router[_0xf33a('0x1e')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x20')]);router['delete'](_0xf33a('0x21'),auth['isAuthenticated'](),controller[_0xf33a('0x22')]);router[_0xf33a('0x1e')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index de88a88..b774097 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 _0xd946=['ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','name'];(function(_0xf48e32,_0x5193b1){var _0x65b3a4=function(_0x1db8ab){while(--_0x1db8ab){_0xf48e32['push'](_0xf48e32['shift']());}};_0x65b3a4(++_0x5193b1);}(_0xd946,0x1af));var _0x6d94=function(_0x1dc9ff,_0xe5c2d6){_0x1dc9ff=_0x1dc9ff-0x0;var _0x48613d=_0xd946[_0x1dc9ff];return _0x48613d;};'use strict';var Sequelize=require(_0x6d94('0x0'));var rs=require('randomstring');module[_0x6d94('0x1')]={'name':{'type':Sequelize[_0x6d94('0x2')],'unique':_0x6d94('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6d94('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6d94('0x4')](_0x6d94('0x5'),_0x6d94('0x6'))},'accountSid':{'type':Sequelize[_0x6d94('0x2')]},'baseUrl':{'type':Sequelize[_0x6d94('0x2')]},'authToken':{'type':Sequelize[_0x6d94('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6d94('0x7')],'defaultValue':function(){return _0x6d94('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6d94('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6d94('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6d94('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6d94('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6d94('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6d94('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6d94('0xa')],'comment':_0x6d94('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6d94('0xc'),'set':function(_0x55d7d5){if(!_0x55d7d5){this[_0x6d94('0xd')](_0x6d94('0xe'),null);}this[_0x6d94('0xd')]('mandatoryDisposition',_0x55d7d5);}},'description':{'type':Sequelize[_0x6d94('0x2')]}}; \ No newline at end of file +var _0xc9b7=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x27dae1,_0x740fc2){var _0x5edd81=function(_0x5a5478){while(--_0x5a5478){_0x27dae1['push'](_0x27dae1['shift']());}};_0x5edd81(++_0x740fc2);}(_0xc9b7,0x153));var _0x7c9b=function(_0x11de96,_0x3b172b){_0x11de96=_0x11de96-0x0;var _0x26d213=_0xc9b7[_0x11de96];return _0x26d213;};'use strict';var Sequelize=require(_0x7c9b('0x0'));var rs=require(_0x7c9b('0x1'));module[_0x7c9b('0x2')]={'name':{'type':Sequelize[_0x7c9b('0x3')],'unique':_0x7c9b('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x7c9b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x7c9b('0x3')],'defaultValue':function(){return rs[_0x7c9b('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7c9b('0x6')](_0x7c9b('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0x7c9b('0x3')]},'baseUrl':{'type':Sequelize[_0x7c9b('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x7c9b('0x8')],'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[_0x7c9b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7c9b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7c9b('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7c9b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7c9b('0x9')],'comment':_0x7c9b('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x7c9b('0xa')],'defaultValue':![],'comment':_0x7c9b('0xc'),'set':function(_0x50b301){if(!_0x50b301){this[_0x7c9b('0xd')](_0x7c9b('0xe'),null);}this['setDataValue'](_0x7c9b('0xf'),_0x50b301);}},'description':{'type':Sequelize[_0x7c9b('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index b18cc80..7f3d7b1 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 _0x71da=['message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','WhatsappAccount','include','findAll','rows','params','keys','rawAttributes','length','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','getDispositions','findOne','Disposition','nolimit','WhatsappAccountId','removeDispositions','ids','CannedAnswer','includeAll','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','finally','getApplications','whatsapp','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','asc','Applications','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','contact','WhatsappInteraction','interaction','created','close','unmanaged','*,*,*,*','ContactId','UserId','waitForTheAssignedAgent','startRouting','Start','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x179522,_0x927635){var _0x240422=function(_0xb621f2){while(--_0xb621f2){_0x179522['push'](_0x179522['shift']());}};_0x240422(++_0x927635);}(_0x71da,0x9e));var _0xa71d=function(_0x9c5512,_0x5651f1){_0x9c5512=_0x9c5512-0x0;var _0x5c4f5d=_0x71da[_0x9c5512];return _0x5c4f5d;};'use strict';var emlformat=require(_0xa71d('0x0'));var rimraf=require(_0xa71d('0x1'));var zipdir=require(_0xa71d('0x2'));var jsonpatch=require(_0xa71d('0x3'));var rp=require(_0xa71d('0x4'));var moment=require(_0xa71d('0x5'));var BPromise=require(_0xa71d('0x6'));var Mustache=require('mustache');var util=require(_0xa71d('0x7'));var path=require(_0xa71d('0x8'));var sox=require(_0xa71d('0x9'));var csv=require(_0xa71d('0xa'));var ejs=require(_0xa71d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa71d('0xc'));var squel=require(_0xa71d('0xd'));var crypto=require(_0xa71d('0xe'));var jsforce=require(_0xa71d('0xf'));var deskjs=require(_0xa71d('0x10'));var toCsv=require(_0xa71d('0xa'));var querystring=require(_0xa71d('0x11'));var Papa=require(_0xa71d('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa71d('0x13'));var as=require(_0xa71d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa71d('0x15'))(_0xa71d('0x16'));var utils=require(_0xa71d('0x17'));var config=require(_0xa71d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa71d('0x19'))['db'];config[_0xa71d('0x1a')]=_[_0xa71d('0x1b')](config[_0xa71d('0x1a')],{'host':_0xa71d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa71d('0x1a')]));require('./whatsappAccount.socket')[_0xa71d('0x1d')](socket);var jayson=require(_0xa71d('0x1e'));var client=jayson[_0xa71d('0x1f')][_0xa71d('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x4ec13d,_0x89bfa5,_0x46b9f6,_0x3e171d){return new BPromise(function(_0x437f08,_0x1a7da9){var _0x397b51=_0x3e171d||client;return _0x397b51[_0xa71d('0x21')](_0x4ec13d,_0x46b9f6)['then'](function(_0x5b6264){logger[_0xa71d('0x22')](_0xa71d('0x23'),_0x89bfa5,_0xa71d('0x24'));logger[_0xa71d('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x89bfa5,_0xa71d('0x24'),JSON[_0xa71d('0x26')](_0x5b6264));if(_0x5b6264[_0xa71d('0x27')]){if(_0x5b6264[_0xa71d('0x27')][_0xa71d('0x28')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x89bfa5,_0x5b6264[_0xa71d('0x27')][_0xa71d('0x29')]);return _0x1a7da9(_0x5b6264[_0xa71d('0x27')][_0xa71d('0x29')]);}logger[_0xa71d('0x27')](_0xa71d('0x23'),_0x89bfa5,_0x5b6264[_0xa71d('0x27')]['message']);return _0x437f08(_0x5b6264['error'][_0xa71d('0x29')]);}else{logger['info'](_0xa71d('0x23'),_0x89bfa5,'request\x20sent');_0x437f08(_0x5b6264[_0xa71d('0x2a')][_0xa71d('0x29')]);}})['catch'](function(_0x589311){logger[_0xa71d('0x27')](_0xa71d('0x23'),_0x89bfa5,_0x589311);_0x1a7da9(_0x589311);});});}function respondWithStatusCode(_0x289ea1,_0x341c0f){_0x341c0f=_0x341c0f||0xcc;return function(_0x3bd903){if(_0x3bd903){return _0x289ea1[_0xa71d('0x2b')](_0x341c0f);}return _0x289ea1[_0xa71d('0x2c')](_0x341c0f)[_0xa71d('0x2d')]();};}function respondWithResult(_0x4032f5,_0x4cda39){_0x4cda39=_0x4cda39||0xc8;return function(_0x58f95e){if(_0x58f95e){return _0x4032f5[_0xa71d('0x2c')](_0x4cda39)[_0xa71d('0x2e')](_0x58f95e);}};}function respondWithFilteredResult(_0x3f2dd9,_0x154deb){return function(_0x128de4){if(_0x128de4){var _0x23995c=typeof _0x154deb[_0xa71d('0x2f')]===_0xa71d('0x30')&&typeof _0x154deb['limit']===_0xa71d('0x30');var _0x199fdd=_0x128de4[_0xa71d('0x31')];var _0x3d55e6=_0x23995c?0x0:_0x154deb[_0xa71d('0x2f')];var _0x42dedd=_0x23995c?_0x128de4[_0xa71d('0x31')]:_0x154deb[_0xa71d('0x2f')]+_0x154deb[_0xa71d('0x32')];var _0x2aa0cd;if(_0x42dedd>=_0x199fdd){_0x42dedd=_0x199fdd;_0x2aa0cd=0xc8;}else{_0x2aa0cd=0xce;}_0x3f2dd9[_0xa71d('0x2c')](_0x2aa0cd);return _0x3f2dd9[_0xa71d('0x33')](_0xa71d('0x34'),_0x3d55e6+'-'+_0x42dedd+'/'+_0x199fdd)[_0xa71d('0x2e')](_0x128de4);}return null;};}function patchUpdates(_0x2c3c37){return function(_0xf1839){try{jsonpatch[_0xa71d('0x35')](_0xf1839,_0x2c3c37,!![]);}catch(_0x482b27){return BPromise[_0xa71d('0x36')](_0x482b27);}return _0xf1839[_0xa71d('0x37')]();};}function saveUpdates(_0x31cbaa,_0x148180){return function(_0x224dbe){if(_0x224dbe){return _0x224dbe['update'](_0x31cbaa)[_0xa71d('0x38')](function(_0x44e7e8){return _0x44e7e8;});}return null;};}function removeEntity(_0x4944c1,_0x343411){return function(_0x4b9e9b){if(_0x4b9e9b){return _0x4b9e9b[_0xa71d('0x39')]()[_0xa71d('0x38')](function(){var _0x495a3c=_0x4b9e9b[_0xa71d('0x3a')]({'plain':!![]});var _0x4b3251='WhatsappAccounts';return db[_0xa71d('0x3b')][_0xa71d('0x39')]({'where':{'type':_0x4b3251,'resourceId':_0x495a3c['id']}})[_0xa71d('0x38')](function(){return _0x4b9e9b;});})[_0xa71d('0x38')](function(){_0x4944c1[_0xa71d('0x2c')](0xcc)[_0xa71d('0x2d')]();});}};}function handleEntityNotFound(_0xf64e86,_0x559942){return function(_0x3cbc4c){if(!_0x3cbc4c){_0xf64e86[_0xa71d('0x2b')](0x194);}return _0x3cbc4c;};}function handleError(_0x2bf6e9,_0x46ce67){_0x46ce67=_0x46ce67||0x1f4;return function(_0x310388){logger[_0xa71d('0x27')](_0x310388[_0xa71d('0x3c')]);if(_0x310388[_0xa71d('0x3d')]){delete _0x310388[_0xa71d('0x3d')];}_0x2bf6e9[_0xa71d('0x2c')](_0x46ce67)[_0xa71d('0x3e')](_0x310388);};}exports[_0xa71d('0x3f')]=function(_0x25fc08,_0x55d13e){var _0x1fa387={'include':[{'model':db[_0xa71d('0x40')],'as':_0xa71d('0x41')}]},_0x592bdf={},_0x503232={'count':0x0,'rows':[]};var _0x45a4c2=_[_0xa71d('0x42')](db['WhatsappAccount']['rawAttributes'],function(_0x192bc0){return{'name':_0x192bc0[_0xa71d('0x43')],'type':_0x192bc0[_0xa71d('0x44')][_0xa71d('0x45')]};});_0x592bdf[_0xa71d('0x46')]=_[_0xa71d('0x42')](_0x45a4c2,'name');_0x592bdf['query']=_['keys'](_0x25fc08[_0xa71d('0x47')]);_0x592bdf[_0xa71d('0x48')]=_['intersection'](_0x592bdf[_0xa71d('0x46')],_0x592bdf[_0xa71d('0x47')]);_0x1fa387[_0xa71d('0x49')]=_[_0xa71d('0x4a')](_0x592bdf[_0xa71d('0x46')],qs[_0xa71d('0x4b')](_0x25fc08['query'][_0xa71d('0x4b')]));_0x1fa387[_0xa71d('0x49')]=_0x1fa387['attributes']['length']?_0x1fa387[_0xa71d('0x49')]:_0x592bdf[_0xa71d('0x46')];if(!_0x25fc08[_0xa71d('0x47')][_0xa71d('0x4c')]('nolimit')){_0x1fa387[_0xa71d('0x32')]=qs[_0xa71d('0x32')](_0x25fc08['query']['limit']);_0x1fa387[_0xa71d('0x2f')]=qs[_0xa71d('0x2f')](_0x25fc08[_0xa71d('0x47')][_0xa71d('0x2f')]);}_0x1fa387[_0xa71d('0x4d')]=qs[_0xa71d('0x4e')](_0x25fc08[_0xa71d('0x47')][_0xa71d('0x4e')]);_0x1fa387[_0xa71d('0x4f')]=qs['filters'](_[_0xa71d('0x50')](_0x25fc08[_0xa71d('0x47')],_0x592bdf[_0xa71d('0x48')]),_0x45a4c2);if(_0x25fc08[_0xa71d('0x47')]['filter']){_0x1fa387[_0xa71d('0x4f')]=_[_0xa71d('0x51')](_0x1fa387[_0xa71d('0x4f')],{'$or':_[_0xa71d('0x42')](_0x45a4c2,function(_0xa5412){if(_0xa5412['type']!=='VIRTUAL'){var _0xeb1c8={};_0xeb1c8[_0xa5412[_0xa71d('0x3d')]]={'$like':'%'+_0x25fc08[_0xa71d('0x47')][_0xa71d('0x52')]+'%'};return _0xeb1c8;}})});}_0x1fa387=_[_0xa71d('0x51')]({},_0x1fa387,_0x25fc08[_0xa71d('0x53')]);var _0x396059={'where':_0x1fa387[_0xa71d('0x4f')]};return db[_0xa71d('0x54')][_0xa71d('0x31')](_0x396059)[_0xa71d('0x38')](function(_0x5f10cd){_0x503232[_0xa71d('0x31')]=_0x5f10cd;if(_0x25fc08[_0xa71d('0x47')]['includeAll']){_0x1fa387[_0xa71d('0x55')]=[{'all':!![]}];}return db[_0xa71d('0x54')][_0xa71d('0x56')](_0x1fa387);})[_0xa71d('0x38')](function(_0x2678e6){_0x503232[_0xa71d('0x57')]=_0x2678e6;return _0x503232;})['then'](respondWithFilteredResult(_0x55d13e,_0x1fa387))['catch'](handleError(_0x55d13e,null));};exports['show']=function(_0x4f9cbd,_0x11ff71){var _0x35b859={'raw':![],'where':{'id':_0x4f9cbd[_0xa71d('0x58')]['id']},'include':[{'model':db[_0xa71d('0x40')],'as':_0xa71d('0x41')}]},_0x4b8e49={};_0x4b8e49[_0xa71d('0x46')]=_[_0xa71d('0x59')](db['WhatsappAccount'][_0xa71d('0x5a')]);_0x4b8e49[_0xa71d('0x47')]=_['keys'](_0x4f9cbd[_0xa71d('0x47')]);_0x4b8e49[_0xa71d('0x48')]=_[_0xa71d('0x4a')](_0x4b8e49[_0xa71d('0x46')],_0x4b8e49[_0xa71d('0x47')]);_0x35b859['attributes']=_['intersection'](_0x4b8e49[_0xa71d('0x46')],qs[_0xa71d('0x4b')](_0x4f9cbd[_0xa71d('0x47')][_0xa71d('0x4b')]));_0x35b859[_0xa71d('0x49')]=_0x35b859[_0xa71d('0x49')][_0xa71d('0x5b')]?_0x35b859[_0xa71d('0x49')]:_0x4b8e49[_0xa71d('0x46')];if(_0x4f9cbd[_0xa71d('0x47')]['includeAll']){_0x35b859['include']=[{'all':!![]}];}_0x35b859=_[_0xa71d('0x51')]({},_0x35b859,_0x4f9cbd[_0xa71d('0x53')]);return db[_0xa71d('0x54')][_0xa71d('0x5c')](_0x35b859)['then'](handleEntityNotFound(_0x11ff71,null))[_0xa71d('0x38')](respondWithResult(_0x11ff71,null))[_0xa71d('0x5d')](handleError(_0x11ff71,null));};exports[_0xa71d('0x5e')]=function(_0x3b1273,_0x320d13){return db[_0xa71d('0x54')][_0xa71d('0x5e')](_0x3b1273[_0xa71d('0x5f')],{})[_0xa71d('0x38')](function(_0x1efec1){var _0x497b11=_0x3b1273['user'][_0xa71d('0x3a')]({'plain':!![]});if(!_0x497b11)throw new Error(_0xa71d('0x60'));if(_0x497b11['role']===_0xa71d('0x61')){var _0xc024fc=_0x1efec1[_0xa71d('0x3a')]({'plain':!![]});var _0x3cdb34=_0xa71d('0x62');return db[_0xa71d('0x63')][_0xa71d('0x5c')]({'where':{'name':_0x3cdb34,'userProfileId':_0x497b11[_0xa71d('0x64')]},'raw':!![]})[_0xa71d('0x38')](function(_0x2e628e){if(_0x2e628e&&_0x2e628e[_0xa71d('0x65')]===0x0){return db[_0xa71d('0x3b')]['create']({'name':_0xc024fc[_0xa71d('0x3d')],'resourceId':_0xc024fc['id'],'type':_0x2e628e['name'],'sectionId':_0x2e628e['id']},{})[_0xa71d('0x38')](function(){return _0x1efec1;});}else{return _0x1efec1;}})[_0xa71d('0x5d')](function(_0x394312){logger[_0xa71d('0x27')](_0xa71d('0x66'),_0x394312);throw _0x394312;});}return _0x1efec1;})[_0xa71d('0x38')](respondWithResult(_0x320d13,0xc9))[_0xa71d('0x5d')](handleError(_0x320d13,null));};exports[_0xa71d('0x67')]=function(_0x821441,_0x1d556c){if(_0x821441[_0xa71d('0x5f')]['id']){delete _0x821441[_0xa71d('0x5f')]['id'];}return db[_0xa71d('0x54')][_0xa71d('0x5c')]({'where':{'id':_0x821441[_0xa71d('0x58')]['id']},'include':[{'model':db[_0xa71d('0x40')],'as':_0xa71d('0x41')}]})[_0xa71d('0x38')](handleEntityNotFound(_0x1d556c,null))[_0xa71d('0x38')](saveUpdates(_0x821441[_0xa71d('0x5f')],null))[_0xa71d('0x38')](respondWithResult(_0x1d556c,null))[_0xa71d('0x5d')](handleError(_0x1d556c,null));};exports['destroy']=function(_0x54262c,_0x352d6d){return db['WhatsappAccount'][_0xa71d('0x5c')]({'where':{'id':_0x54262c[_0xa71d('0x58')]['id']}})[_0xa71d('0x38')](handleEntityNotFound(_0x352d6d,null))[_0xa71d('0x38')](removeEntity(_0x352d6d,null))[_0xa71d('0x5d')](handleError(_0x352d6d,null));};exports[_0xa71d('0x68')]=function(_0x4b82e3,_0x4b7e29){return db[_0xa71d('0x54')]['describe']()[_0xa71d('0x38')](respondWithResult(_0x4b7e29,null))[_0xa71d('0x5d')](handleError(_0x4b7e29,null));};exports[_0xa71d('0x69')]=function(_0x22bfcc,_0x2c52ed,_0x2e04fa){if(_0x22bfcc[_0xa71d('0x5f')]['id']){delete _0x22bfcc[_0xa71d('0x5f')]['id'];}return db[_0xa71d('0x54')]['find']({'where':{'id':_0x22bfcc['params']['id']}})['then'](handleEntityNotFound(_0x2c52ed,null))[_0xa71d('0x38')](function(_0x26196a){if(_0x26196a){_0x22bfcc[_0xa71d('0x5f')]['WhatsappAccountId']=_0x26196a['id'];return db['Disposition']['create'](_0x22bfcc['body']);}})[_0xa71d('0x38')](respondWithResult(_0x2c52ed,null))[_0xa71d('0x5d')](handleError(_0x2c52ed,null));};exports[_0xa71d('0x6a')]=function(_0x122957,_0x372c47,_0x290a69){var _0x15ddd4={'raw':![],'where':{}};var _0x3bfbb8={};var _0x3bdee4={'count':0x0,'rows':[]};return db[_0xa71d('0x54')][_0xa71d('0x6b')]({'where':{'id':_0x122957[_0xa71d('0x58')]['id']}})['then'](handleEntityNotFound(_0x372c47,null))['then'](function(_0x15e397){if(_0x15e397){_0x3bfbb8[_0xa71d('0x46')]=_[_0xa71d('0x59')](db[_0xa71d('0x6c')][_0xa71d('0x5a')]);_0x3bfbb8['query']=_[_0xa71d('0x59')](_0x122957['query']);_0x3bfbb8[_0xa71d('0x48')]=_[_0xa71d('0x4a')](_0x3bfbb8[_0xa71d('0x46')],_0x3bfbb8['query']);_0x15ddd4[_0xa71d('0x49')]=_[_0xa71d('0x4a')](_0x3bfbb8[_0xa71d('0x46')],qs[_0xa71d('0x4b')](_0x122957['query'][_0xa71d('0x4b')]));_0x15ddd4[_0xa71d('0x49')]=_0x15ddd4[_0xa71d('0x49')]['length']?_0x15ddd4[_0xa71d('0x49')]:_0x3bfbb8[_0xa71d('0x46')];if(!_0x122957[_0xa71d('0x47')][_0xa71d('0x4c')](_0xa71d('0x6d'))){_0x15ddd4[_0xa71d('0x32')]=qs[_0xa71d('0x32')](_0x122957[_0xa71d('0x47')]['limit']);_0x15ddd4[_0xa71d('0x2f')]=qs['offset'](_0x122957[_0xa71d('0x47')][_0xa71d('0x2f')]);}_0x15ddd4[_0xa71d('0x4d')]=qs[_0xa71d('0x4e')](_0x122957['query'][_0xa71d('0x4e')]);_0x15ddd4[_0xa71d('0x4f')]=qs[_0xa71d('0x48')](_[_0xa71d('0x50')](_0x122957[_0xa71d('0x47')],_0x3bfbb8['filters']));_0x15ddd4['where'][_0xa71d('0x6e')]=_0x15e397['id'];if(_0x122957[_0xa71d('0x47')][_0xa71d('0x52')]){_0x15ddd4['where']=_[_0xa71d('0x51')](_0x15ddd4[_0xa71d('0x4f')],{'$or':_[_0xa71d('0x42')](_0x15ddd4[_0xa71d('0x49')],function(_0x2ae883){var _0x222131={};_0x222131[_0x2ae883]={'$like':'%'+_0x122957[_0xa71d('0x47')][_0xa71d('0x52')]+'%'};return _0x222131;})});}_0x15ddd4=_[_0xa71d('0x51')]({},_0x15ddd4,_0x122957[_0xa71d('0x53')]);return db[_0xa71d('0x6c')][_0xa71d('0x31')]({'where':_0x15ddd4[_0xa71d('0x4f')]})[_0xa71d('0x38')](function(_0x4aa0ac){_0x3bdee4[_0xa71d('0x31')]=_0x4aa0ac;if(_0x122957[_0xa71d('0x47')]['includeAll']){_0x15ddd4[_0xa71d('0x55')]=[{'all':!![]}];}return db[_0xa71d('0x6c')][_0xa71d('0x56')](_0x15ddd4);})[_0xa71d('0x38')](function(_0x1fc90f){_0x3bdee4[_0xa71d('0x57')]=_0x1fc90f;return _0x3bdee4;});}})[_0xa71d('0x38')](respondWithFilteredResult(_0x372c47,_0x15ddd4))[_0xa71d('0x5d')](handleError(_0x372c47,null));};exports['removeDispositions']=function(_0x8d8b80,_0x1a4f28,_0x561da0){return db[_0xa71d('0x54')]['find']({'where':{'id':_0x8d8b80[_0xa71d('0x58')]['id']}})['then'](handleEntityNotFound(_0x1a4f28,null))['then'](function(_0x28c600){if(_0x28c600){return _0x28c600[_0xa71d('0x6f')](_0x8d8b80[_0xa71d('0x47')][_0xa71d('0x70')]);}})[_0xa71d('0x38')](respondWithStatusCode(_0x1a4f28,null))[_0xa71d('0x5d')](handleError(_0x1a4f28,null));};exports['addAnswer']=function(_0x2839d8,_0x115927,_0x38870c){if(_0x2839d8[_0xa71d('0x5f')]['id']){delete _0x2839d8[_0xa71d('0x5f')]['id'];}return db[_0xa71d('0x54')][_0xa71d('0x5c')]({'where':{'id':_0x2839d8[_0xa71d('0x58')]['id']}})[_0xa71d('0x38')](handleEntityNotFound(_0x115927,null))[_0xa71d('0x38')](function(_0x3f9a84){if(_0x3f9a84){_0x2839d8[_0xa71d('0x5f')][_0xa71d('0x6e')]=_0x3f9a84['id'];return db[_0xa71d('0x71')][_0xa71d('0x5e')](_0x2839d8[_0xa71d('0x5f')]);}})[_0xa71d('0x38')](respondWithResult(_0x115927,null))[_0xa71d('0x5d')](handleError(_0x115927,null));};exports['getAnswers']=function(_0x28a256,_0x4ccc45,_0x2f8927){var _0x353dac={'raw':![],'where':{}};var _0x1e04f0={};var _0x5de888={'count':0x0,'rows':[]};return db[_0xa71d('0x54')]['findOne']({'where':{'id':_0x28a256[_0xa71d('0x58')]['id']}})[_0xa71d('0x38')](handleEntityNotFound(_0x4ccc45,null))[_0xa71d('0x38')](function(_0x12096e){if(_0x12096e){_0x1e04f0[_0xa71d('0x46')]=_[_0xa71d('0x59')](db['CannedAnswer']['rawAttributes']);_0x1e04f0['query']=_[_0xa71d('0x59')](_0x28a256[_0xa71d('0x47')]);_0x1e04f0['filters']=_[_0xa71d('0x4a')](_0x1e04f0[_0xa71d('0x46')],_0x1e04f0[_0xa71d('0x47')]);_0x353dac[_0xa71d('0x49')]=_[_0xa71d('0x4a')](_0x1e04f0[_0xa71d('0x46')],qs[_0xa71d('0x4b')](_0x28a256[_0xa71d('0x47')][_0xa71d('0x4b')]));_0x353dac[_0xa71d('0x49')]=_0x353dac[_0xa71d('0x49')][_0xa71d('0x5b')]?_0x353dac[_0xa71d('0x49')]:_0x1e04f0[_0xa71d('0x46')];if(!_0x28a256[_0xa71d('0x47')][_0xa71d('0x4c')](_0xa71d('0x6d'))){_0x353dac[_0xa71d('0x32')]=qs[_0xa71d('0x32')](_0x28a256[_0xa71d('0x47')]['limit']);_0x353dac[_0xa71d('0x2f')]=qs['offset'](_0x28a256[_0xa71d('0x47')][_0xa71d('0x2f')]);}_0x353dac[_0xa71d('0x4d')]=qs[_0xa71d('0x4e')](_0x28a256['query'][_0xa71d('0x4e')]);_0x353dac['where']=qs[_0xa71d('0x48')](_['pick'](_0x28a256[_0xa71d('0x47')],_0x1e04f0['filters']));_0x353dac['where'][_0xa71d('0x6e')]=_0x12096e['id'];if(_0x28a256['query'][_0xa71d('0x52')]){_0x353dac[_0xa71d('0x4f')]=_['merge'](_0x353dac[_0xa71d('0x4f')],{'$or':_[_0xa71d('0x42')](_0x353dac[_0xa71d('0x49')],function(_0x85807f){var _0xc41e30={};_0xc41e30[_0x85807f]={'$like':'%'+_0x28a256[_0xa71d('0x47')][_0xa71d('0x52')]+'%'};return _0xc41e30;})});}_0x353dac=_[_0xa71d('0x51')]({},_0x353dac,_0x28a256[_0xa71d('0x53')]);return db['CannedAnswer'][_0xa71d('0x31')]({'where':_0x353dac[_0xa71d('0x4f')]})['then'](function(_0x2e2fde){_0x5de888[_0xa71d('0x31')]=_0x2e2fde;if(_0x28a256[_0xa71d('0x47')][_0xa71d('0x72')]){_0x353dac[_0xa71d('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa71d('0x56')](_0x353dac);})['then'](function(_0x470951){_0x5de888[_0xa71d('0x57')]=_0x470951;return _0x5de888;});}})[_0xa71d('0x38')](respondWithFilteredResult(_0x4ccc45,_0x353dac))[_0xa71d('0x5d')](handleError(_0x4ccc45,null));};exports[_0xa71d('0x73')]=function(_0x2ff097,_0x12ba0b,_0x52dfe1){return db[_0xa71d('0x54')][_0xa71d('0x5c')]({'where':{'id':_0x2ff097[_0xa71d('0x58')]['id']}})['then'](handleEntityNotFound(_0x12ba0b,null))[_0xa71d('0x38')](function(_0x4e040a){if(_0x4e040a){return _0x4e040a[_0xa71d('0x73')](_0x2ff097[_0xa71d('0x47')][_0xa71d('0x70')]);}})[_0xa71d('0x38')](respondWithStatusCode(_0x12ba0b,null))[_0xa71d('0x5d')](handleError(_0x12ba0b,null));};exports[_0xa71d('0x74')]=function(_0x1bbaba,_0x232ed2,_0x36c463){return db[_0xa71d('0x54')][_0xa71d('0x5c')]({'where':{'id':_0x1bbaba[_0xa71d('0x58')]['id']}})[_0xa71d('0x38')](handleEntityNotFound(_0x232ed2,null))['then'](function(_0x394c42){if(_0x394c42){return _0x394c42[_0xa71d('0x74')](_0x1bbaba['body'][_0xa71d('0x70')],_['omit'](_0x1bbaba[_0xa71d('0x5f')],[_0xa71d('0x70'),'id'])||{})[_0xa71d('0x75')](function(_0x5553f6){for(var _0x1cf9f7=0x0;_0x1cf9f7<_0x1bbaba['body']['ids'][_0xa71d('0x5b')];_0x1cf9f7+=0x1){socket[_0xa71d('0x76')](_0xa71d('0x77'),{'UserId':Number(_0x1bbaba[_0xa71d('0x5f')][_0xa71d('0x70')][_0x1cf9f7]),'WhatsappAccountId':Number(_0x1bbaba['params']['id'])});}return _0x5553f6;});}})[_0xa71d('0x38')](respondWithResult(_0x232ed2,null))['catch'](handleError(_0x232ed2,null));};exports[_0xa71d('0x78')]=function(_0x172e42,_0x25bd44,_0x3df048){return db[_0xa71d('0x54')][_0xa71d('0x5c')]({'where':{'id':_0x172e42[_0xa71d('0x58')]['id']}})[_0xa71d('0x38')](handleEntityNotFound(_0x25bd44,null))['then'](function(_0x39ef5c){if(_0x39ef5c){return _0x39ef5c[_0xa71d('0x78')](_0x172e42['query'][_0xa71d('0x70')])[_0xa71d('0x38')](function(){if(_['isArray'](_0x172e42['query'][_0xa71d('0x70')])){for(var _0x3c385f=0x0;_0x3c385f<_0x172e42[_0xa71d('0x47')][_0xa71d('0x70')][_0xa71d('0x5b')];_0x3c385f+=0x1){socket[_0xa71d('0x76')](_0xa71d('0x79'),{'UserId':Number(_0x172e42[_0xa71d('0x47')][_0xa71d('0x70')][_0x3c385f]),'WhatsappAccountId':Number(_0x172e42[_0xa71d('0x58')]['id'])});}}else{socket[_0xa71d('0x76')]('userWhatsappAccount:remove',{'UserId':Number(_0x172e42['query'][_0xa71d('0x70')]),'WhatsappAccountId':Number(_0x172e42[_0xa71d('0x58')]['id'])});}});}})[_0xa71d('0x38')](respondWithStatusCode(_0x25bd44,null))[_0xa71d('0x5d')](handleError(_0x25bd44,null));};exports[_0xa71d('0x7a')]=function(_0x249dba,_0x38130b,_0x56c721){var _0x4252eb={};var _0x52e71a={};var _0x2ea29e;var _0x1b2002;return db['WhatsappAccount'][_0xa71d('0x6b')]({'where':{'id':_0x249dba[_0xa71d('0x58')]['id']}})['then'](handleEntityNotFound(_0x38130b,null))[_0xa71d('0x38')](function(_0x4ad510){if(_0x4ad510){_0x2ea29e=_0x4ad510;_0x52e71a[_0xa71d('0x46')]=_[_0xa71d('0x59')](db[_0xa71d('0x7b')][_0xa71d('0x5a')]);_0x52e71a[_0xa71d('0x47')]=_[_0xa71d('0x59')](_0x249dba[_0xa71d('0x47')]);_0x52e71a[_0xa71d('0x48')]=_[_0xa71d('0x4a')](_0x52e71a[_0xa71d('0x46')],_0x52e71a[_0xa71d('0x47')]);_0x4252eb[_0xa71d('0x49')]=_[_0xa71d('0x4a')](_0x52e71a['model'],qs[_0xa71d('0x4b')](_0x249dba[_0xa71d('0x47')][_0xa71d('0x4b')]));_0x4252eb[_0xa71d('0x49')]=_0x4252eb[_0xa71d('0x49')][_0xa71d('0x5b')]?_0x4252eb['attributes']:_0x52e71a[_0xa71d('0x46')];_0x4252eb[_0xa71d('0x4d')]=qs[_0xa71d('0x4e')](_0x249dba[_0xa71d('0x47')][_0xa71d('0x4e')]);_0x4252eb[_0xa71d('0x4f')]=qs[_0xa71d('0x48')](_[_0xa71d('0x50')](_0x249dba[_0xa71d('0x47')],_0x52e71a[_0xa71d('0x48')]));if(_0x249dba[_0xa71d('0x47')]['filter']){_0x4252eb[_0xa71d('0x4f')]=_[_0xa71d('0x51')](_0x4252eb[_0xa71d('0x4f')],{'$or':_[_0xa71d('0x42')](_0x4252eb[_0xa71d('0x49')],function(_0x3ac076){var _0x46d3d1={};_0x46d3d1[_0x3ac076]={'$like':'%'+_0x249dba[_0xa71d('0x47')]['filter']+'%'};return _0x46d3d1;})});}_0x4252eb=_[_0xa71d('0x51')]({},_0x4252eb,_0x249dba[_0xa71d('0x53')]);return _0x2ea29e[_0xa71d('0x7a')](_0x4252eb);}})[_0xa71d('0x38')](function(_0x1e5417){if(_0x1e5417){_0x1b2002=_0x1e5417[_0xa71d('0x5b')];if(!_0x249dba[_0xa71d('0x47')]['hasOwnProperty'](_0xa71d('0x6d'))){_0x4252eb['limit']=qs[_0xa71d('0x32')](_0x249dba[_0xa71d('0x47')][_0xa71d('0x32')]);_0x4252eb[_0xa71d('0x2f')]=qs['offset'](_0x249dba[_0xa71d('0x47')][_0xa71d('0x2f')]);}return _0x2ea29e[_0xa71d('0x7a')](_0x4252eb);}})[_0xa71d('0x38')](function(_0x4df1dd){if(_0x4df1dd){return _0x4df1dd?{'count':_0x1b2002,'rows':_0x4df1dd}:null;}})['then'](respondWithResult(_0x38130b,null))[_0xa71d('0x5d')](handleError(_0x38130b,null));};exports[_0xa71d('0x7c')]=function(_0x354161,_0x5d1348){var _0x22c35e=_0x354161[_0xa71d('0x58')]['id'];var _0x2469b8=_0x354161[_0xa71d('0x5f')];var _0x3fd445=0xc8;var _0x5190f2=null;return db[_0xa71d('0x7d')][_0xa71d('0x7e')]({'isolationLevel':db[_0xa71d('0x7d')][_0xa71d('0x7f')][_0xa71d('0x80')][_0xa71d('0x81')]},function(_0xbf7a22){return db[_0xa71d('0x54')][_0xa71d('0x6b')]({'where':{'id':_0x22c35e},'transaction':_0xbf7a22})['then'](function(_0x264ce8){if(_0x264ce8){return db[_0xa71d('0x82')][_0xa71d('0x39')]({'where':{'WhatsappAccountId':_0x22c35e},'transaction':_0xbf7a22})[_0xa71d('0x38')](function(){var _0x51bce9=_[_0xa71d('0x42')](_0x2469b8,function(_0x204766){_0x204766[_0xa71d('0x6e')]=_0x22c35e;return _0x204766;});return db[_0xa71d('0x82')]['bulkCreate'](_0x51bce9,{'transaction':_0xbf7a22});});}else{_0x3fd445=0x194;_0x5190f2=[];}});})[_0xa71d('0x38')](function(){if(_0x3fd445!==0x194){return db['WhatsappApplication'][_0xa71d('0x83')]({'where':{'WhatsappAccountId':_0x22c35e},'order':'priority'})[_0xa71d('0x38')](function(_0xf938a2){_0x5190f2=_0xf938a2;});}})[_0xa71d('0x5d')](function(_0x4ba005){_0x3fd445=0x1f4;logger[_0xa71d('0x27')](_0x4ba005[_0xa71d('0x3c')]);if(_0x4ba005[_0xa71d('0x3d')]){delete _0x4ba005['name'];}_0x5190f2=_0x4ba005;})[_0xa71d('0x84')](function(){if(_0x5190f2===null){_0x5d1348['sendStatus'](_0x3fd445);}else{if(_0x3fd445===0x1f4){_0x5d1348['status'](_0x3fd445)['send'](_0x5190f2);}else{_0x5d1348[_0xa71d('0x2c')](_0x3fd445)[_0xa71d('0x2e')](_0x5190f2);}}});};exports[_0xa71d('0x85')]=function(_0x2205db,_0x1d77f1,_0x4a4ef0){var _0x32b830={};var _0x300302={};var _0x47ea94;var _0x3bfe3a;return db[_0xa71d('0x54')][_0xa71d('0x6b')]({'where':{'id':_0x2205db[_0xa71d('0x58')]['id']}})[_0xa71d('0x38')](handleEntityNotFound(_0x1d77f1,null))[_0xa71d('0x38')](function(_0x4ceb53){if(_0x4ceb53){_0x47ea94=_0x4ceb53;_0x300302['model']=_[_0xa71d('0x59')](db[_0xa71d('0x82')][_0xa71d('0x5a')]);_0x300302[_0xa71d('0x47')]=_[_0xa71d('0x59')](_0x2205db[_0xa71d('0x47')]);_0x300302[_0xa71d('0x48')]=_[_0xa71d('0x4a')](_0x300302[_0xa71d('0x46')],_0x300302[_0xa71d('0x47')]);_0x32b830['attributes']=_['intersection'](_0x300302[_0xa71d('0x46')],qs[_0xa71d('0x4b')](_0x2205db[_0xa71d('0x47')][_0xa71d('0x4b')]));_0x32b830[_0xa71d('0x49')]=_0x32b830[_0xa71d('0x49')][_0xa71d('0x5b')]?_0x32b830[_0xa71d('0x49')]:_0x300302[_0xa71d('0x46')];_0x32b830['order']=qs[_0xa71d('0x4e')](_0x2205db[_0xa71d('0x47')][_0xa71d('0x4e')]);_0x32b830[_0xa71d('0x4f')]=qs[_0xa71d('0x48')](_[_0xa71d('0x50')](_0x2205db[_0xa71d('0x47')],_0x300302[_0xa71d('0x48')]));if(_0x2205db[_0xa71d('0x47')][_0xa71d('0x52')]){_0x32b830[_0xa71d('0x4f')]=_[_0xa71d('0x51')](_0x32b830[_0xa71d('0x4f')],{'$or':_[_0xa71d('0x42')](_0x32b830[_0xa71d('0x49')],function(_0x213bbc){var _0x2f9963={};_0x2f9963[_0x213bbc]={'$like':'%'+_0x2205db[_0xa71d('0x47')][_0xa71d('0x52')]+'%'};return _0x2f9963;})});}_0x32b830=_[_0xa71d('0x51')]({},_0x32b830,_0x2205db[_0xa71d('0x53')]);return _0x47ea94[_0xa71d('0x85')](_0x32b830);}})[_0xa71d('0x38')](function(_0x443d0f){if(_0x443d0f){_0x3bfe3a=_0x443d0f[_0xa71d('0x5b')];if(!_0x2205db['query'][_0xa71d('0x4c')](_0xa71d('0x6d'))){_0x32b830['limit']=qs[_0xa71d('0x32')](_0x2205db[_0xa71d('0x47')][_0xa71d('0x32')]);_0x32b830[_0xa71d('0x2f')]=qs[_0xa71d('0x2f')](_0x2205db[_0xa71d('0x47')][_0xa71d('0x2f')]);}return _0x47ea94[_0xa71d('0x85')](_0x32b830);}})[_0xa71d('0x38')](function(_0x150579){if(_0x150579){return _0x150579?{'count':_0x3bfe3a,'rows':_0x150579}:null;}})['then'](respondWithResult(_0x1d77f1,null))['catch'](handleError(_0x1d77f1,null));};exports['notify']=function(_0x1d2429,_0x35291a,_0x1e5e78){var _0x17724a={'channel':_0xa71d('0x86')};var _0x587907=[];var _0x1fb8a1=[];var _0x5310e8={};return db['WhatsappAccount'][_0xa71d('0x5c')]({'where':{'id':_0x1d2429[_0xa71d('0x58')]['id']},'include':[{'model':db[_0xa71d('0x82')],'as':'Applications'}]})[_0xa71d('0x38')](handleEntityNotFound(_0x35291a,null))['then'](function(_0x528693){_0x17724a[_0xa71d('0x87')]=_0x528693;if(_0x17724a[_0xa71d('0x87')]&&_0x17724a['account'][_0xa71d('0x44')]===_0xa71d('0x88')&&_0x1d2429[_0xa71d('0x5f')][_0xa71d('0x89')]){if(_0x1d2429[_0xa71d('0x5f')][_0xa71d('0x89')][_0xa71d('0x5b')]===0x0)return;if(_0x1d2429['body'][_0xa71d('0x89')][0x0]['state']!==_0xa71d('0x8a'))return;return db[_0xa71d('0x8b')][_0xa71d('0x67')]({'read':!![],'readAt':_0x1d2429[_0xa71d('0x5f')][_0xa71d('0x89')][0x0][_0xa71d('0x8c')]},{'where':{'messageId':_0x1d2429['body'][_0xa71d('0x89')][0x0][_0xa71d('0x8d')]},'individualHooks':!![]})[_0xa71d('0x38')](function(_0x42a3d7){return _0x35291a[_0xa71d('0x2c')](0xc8)[_0xa71d('0x2e')](_0x42a3d7);});}_0x17724a[_0xa71d('0x8e')]=_[_0xa71d('0x8f')](_0x528693['Applications'],[_0xa71d('0x90')],[_0xa71d('0x91')]);if(_0x17724a[_0xa71d('0x87')][_0xa71d('0x92')]){delete _0x17724a[_0xa71d('0x87')]['Applications'];}return db[_0xa71d('0x93')]['describe']()['then'](function(_0x3cdae6){if(!_0x3cdae6){throw new db[(_0xa71d('0x94'))]['ValidationError']('no\x20available\x20attributes');}_0x587907=_[_0xa71d('0x95')](_['keys'](_0x3cdae6),[_0xa71d('0x96'),_0xa71d('0x97')]);_0x1fb8a1=_[_0xa71d('0x95')](_[_0xa71d('0x59')](_0x3cdae6),['createdAt',_0xa71d('0x97'),_0xa71d('0x98'),'ListId']);_0x17724a[_0xa71d('0x5f')]={'mapKey':'mobile'};if(_0x17724a['account']&&_0x17724a[_0xa71d('0x87')][_0xa71d('0x44')]===_0xa71d('0x99')){_0x17724a[_0xa71d('0x5f')][_0xa71d('0x9a')]=_0x1d2429['body'][_0xa71d('0x9b')][_0xa71d('0x9c')](_0xa71d('0x9d'),'');_0x17724a[_0xa71d('0x5f')][_0xa71d('0x5f')]=_0x1d2429[_0xa71d('0x5f')][_0xa71d('0x9e')];_0x17724a[_0xa71d('0x5f')][_0xa71d('0x9f')]=_0x1d2429[_0xa71d('0x5f')][_0xa71d('0xa0')];}if(_0x17724a[_0xa71d('0x87')]&&_0x17724a[_0xa71d('0x87')]['type']===_0xa71d('0x88')){_0x17724a[_0xa71d('0x5f')][_0xa71d('0x9a')]=_0x1d2429['body']['notifications'][0x0][_0xa71d('0x9a')];_0x17724a['body'][_0xa71d('0x5f')]=_0x1d2429[_0xa71d('0x5f')][_0xa71d('0xa1')][0x0][_0xa71d('0x29')][_0xa71d('0x5f')];_0x17724a[_0xa71d('0x5f')][_0xa71d('0x9f')]=_0x1d2429['body']['notifications'][0x0]['message_id'];}if(_0x17724a['body']['id']){delete _0x17724a['body']['id'];}if(_[_0xa71d('0xa2')](_0x17724a[_0xa71d('0x5f')][_0xa71d('0x9a')])){throw new db[(_0xa71d('0x94'))][(_0xa71d('0xa3'))]('from\x20is\x20mandatory');}if(_[_0xa71d('0xa2')](_0x17724a[_0xa71d('0x5f')][_0xa71d('0x5f')])||_0x17724a['body'][_0xa71d('0x5f')]===''){throw new db[(_0xa71d('0x94'))][(_0xa71d('0xa3'))](_0xa71d('0xa4'));}if(_[_0xa71d('0xa2')](_0x17724a['body'][_0xa71d('0xa5')])){throw new db[(_0xa71d('0x94'))][(_0xa71d('0xa3'))](_0xa71d('0xa6')+_0x1fb8a1);}if(!_[_0xa71d('0xa7')](_0x1fb8a1,_0x17724a[_0xa71d('0x5f')][_0xa71d('0xa5')])){throw new db['Sequelize'][(_0xa71d('0xa3'))](_0xa71d('0xa8')+_0x1fb8a1);}_0x5310e8[_0x17724a[_0xa71d('0x5f')][_0xa71d('0xa5')]]=_0x17724a['body']['from'];return db[_0xa71d('0xa9')][_0xa71d('0x5c')]({'where':{'id':_0x17724a['account'][_0xa71d('0xaa')]},'include':[{'model':db['CmContact'],'as':_0xa71d('0xab'),'where':_0x5310e8,'limit':0x1,'order':[[_0xa71d('0x97'),_0xa71d('0xac')]]}]});})[_0xa71d('0x38')](handleEntityNotFound(_0x35291a,null))['then'](function(_0x1c75aa){if(_0x1c75aa){_0x17724a[_0xa71d('0xad')]=_[_0xa71d('0xae')](_0x1c75aa,['Contacts']);if(_0x1c75aa['Contacts'][_0xa71d('0x5b')]){return _0x1c75aa[_0xa71d('0xab')][0x0];}var _0x59b6fd=_[_0xa71d('0x1b')](_0x17724a['body'],{'firstName':_0x17724a[_0xa71d('0x5f')][_0xa71d('0x9a')],'ListId':_0x1c75aa['id']});_0x59b6fd[_0x17724a[_0xa71d('0x5f')][_0xa71d('0xa5')]]=_0x17724a['body'][_0xa71d('0x9a')];return db['CmContact'][_0xa71d('0x5e')](_0x59b6fd,{'fields':_0x587907,'raw':!![]});}})[_0xa71d('0x38')](handleEntityNotFound(_0x35291a,null))['then'](function(_0xa5c375){if(_0xa5c375){_0x17724a[_0xa71d('0xaf')]=_0xa5c375;var _0x258a60={'ContactId':_0xa5c375['id'],'phone':_0x17724a['body'][_0xa71d('0x9a')],'WhatsappAccountId':_0x1d2429[_0xa71d('0x58')]['id']};var _0x186f02={'ContactId':_0xa5c375['id'],'WhatsappAccountId':_0x1d2429[_0xa71d('0x58')]['id'],'closed':![]};return db[_0xa71d('0xb0')][_0xa71d('0x5c')]({'where':_0x186f02})['then'](function(_0xcbb729){if(_0xcbb729){return[_0xcbb729,![]];}return db[_0xa71d('0xb0')][_0xa71d('0x5e')](_0x258a60)[_0xa71d('0x38')](function(_0x40c19c){return[_0x40c19c,!![]];});});}})[_0xa71d('0x75')](function(_0x38a54d,_0x151723){_0x17724a[_0xa71d('0xb1')]=_0x38a54d[_0xa71d('0x3a')]({'plain':!![]});_0x17724a[_0xa71d('0xb1')][_0xa71d('0xb2')]=![];if(_0x151723){if(_0x17724a[_0xa71d('0x87')]['autoclose']){_0x17724a[_0xa71d('0x8e')]['push']({'id':0x0,'priority':_0x17724a[_0xa71d('0x8e')][_0xa71d('0x5b')]+0x1,'app':_0xa71d('0xb3'),'appdata':_0xa71d('0xb4'),'interval':_0xa71d('0xb5')});}_0x17724a[_0xa71d('0xb1')]['created']=!![];}return db[_0xa71d('0x8b')][_0xa71d('0x5e')]({'phone':_0x17724a[_0xa71d('0x5f')]['from'],'messageId':_0x17724a[_0xa71d('0x5f')][_0xa71d('0x9f')],'body':_0x17724a['body']['body'],'WhatsappAccountId':_0x1d2429[_0xa71d('0x58')]['id'],'WhatsappInteractionId':_0x38a54d['id'],'direction':'in','ContactId':_0x38a54d[_0xa71d('0xb6')],'AttachmentId':_0x17724a[_0xa71d('0x5f')]['AttachmentId']});})[_0xa71d('0x38')](function(_0x4d9698){_0x17724a[_0xa71d('0x29')]=_0x4d9698;if(_0x17724a['interaction'][_0xa71d('0xb7')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x17724a[_0xa71d('0xb1')][_0xa71d('0xb7')]}})[_0xa71d('0x38')](function(_0x28f5b8){if(_0x28f5b8){_0x17724a[_0xa71d('0x8e')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x28f5b8['name']+','+(_0x17724a[_0xa71d('0x87')][_0xa71d('0xb8')]||0xa),'interval':_0xa71d('0xb5')});}return respondWithRpcPromise('Start',_0xa71d('0xb9'),_0x17724a);});}return respondWithRpcPromise(_0xa71d('0xba'),'startRouting',_0x17724a);})['then'](function(_0x272cc5){if(_0x272cc5){var _0x2e989e=0xc8;var _0xce9c8c='receiveMessage';logger[_0xa71d('0x22')](_0xa71d('0xbb'),_0xce9c8c,_0x2e989e,_0xa71d('0xbc'));logger[_0xa71d('0x25')](_0xa71d('0xbd'),_0xce9c8c,_0x2e989e,_0xa71d('0xbc'),JSON[_0xa71d('0x26')](_0x272cc5));if(_0x17724a[_0xa71d('0x87')][_0xa71d('0x44')]==='twilio'){return _0x35291a['status'](_0x2e989e)[_0xa71d('0x33')](_0xa71d('0xbe'),_0xa71d('0xbf'))[_0xa71d('0x3e')](_0xa71d('0xc0'));}else{return _0x35291a[_0xa71d('0x2c')](_0x2e989e)['json'](_0x272cc5);}}});})[_0xa71d('0x5d')](handleError(_0x35291a,null));};exports[_0xa71d('0x3e')]=function(_0x522b4d,_0x5c29e9,_0x5d5786){var _0x55e18d,_0xab522b,_0x5b2dff;if(_['isNil'](_0x522b4d['body']['body'])||_0x522b4d[_0xa71d('0x5f')][_0xa71d('0x5f')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa71d('0xa2')](_0x522b4d[_0xa71d('0x5f')]['to'])){throw new db[(_0xa71d('0x94'))][(_0xa71d('0xa3'))](_0xa71d('0xc1'));}_0x55e18d=_0x522b4d[_0xa71d('0x5f')]['to'];return db['WhatsappAccount'][_0xa71d('0x5c')]({'where':{'id':_0x522b4d[_0xa71d('0x58')]['id']},'include':[{'model':db[_0xa71d('0xa9')],'as':_0xa71d('0xc2'),'include':[{'model':db[_0xa71d('0x93')],'as':_0xa71d('0xab'),'where':{'mobile':_0x55e18d},'limit':0x1,'order':[[_0xa71d('0x97'),_0xa71d('0xac')]]}]}]})['then'](handleEntityNotFound(_0x5c29e9,null))[_0xa71d('0x38')](function(_0x303003){if(_0x303003&&_0x303003[_0xa71d('0xc2')]){_0xab522b=_0x303003['get']({'plain':!![]});if(_0xab522b[_0xa71d('0xc2')]&&_0xab522b[_0xa71d('0xc2')]['Contacts']['length']){return _0xab522b[_0xa71d('0xc2')][_0xa71d('0xab')][0x0];}return db[_0xa71d('0x93')][_0xa71d('0x5e')](_[_0xa71d('0x1b')](_0x522b4d['body'],{'firstName':_0x55e18d,'mobile':_0x55e18d,'phone':_0x55e18d,'ListId':_0xab522b[_0xa71d('0xaa')]}));}})[_0xa71d('0x38')](handleEntityNotFound(_0x5c29e9,null))[_0xa71d('0x38')](function(_0x28f3d0){if(_0x28f3d0){_0x5b2dff=_0x28f3d0;return db[_0xa71d('0xb0')][_0xa71d('0x5c')]({'where':{'ContactId':_0x5b2dff['id'],'closed':![],'WhatsappAccountId':_0xab522b['id']}})[_0xa71d('0x38')](function(_0x595b83){if(_0x595b83){return[_0x595b83,![]];}return db[_0xa71d('0xb0')]['create']({'UserId':_0x522b4d[_0xa71d('0x61')]['id'],'ContactId':_0x5b2dff['id'],'WhatsappAccountId':_0xab522b['id'],'phone':_0x55e18d,'firstMsgDirection':_0xa71d('0xc3'),'Messages':[_['merge'](_0x522b4d[_0xa71d('0x5f')],{'read':![],'body':_0x522b4d[_0xa71d('0x5f')][_0xa71d('0x5f')],'phone':_0x55e18d,'WhatsappAccountId':_0xab522b['id'],'UserId':_0x522b4d['user']['id'],'ContactId':_0x5b2dff['id']})]},{'include':[{'model':db[_0xa71d('0x8b')],'as':_0xa71d('0xc4')}]})[_0xa71d('0x38')](function(_0x2db62c){return[_0x2db62c,!![]];});});}})[_0xa71d('0x75')](function(_0x3a64b4,_0xfbb2a1){if(_0xfbb2a1){return _0x3a64b4;}return db[_0xa71d('0x8b')][_0xa71d('0x5e')](_['merge'](_0x522b4d[_0xa71d('0x5f')],{'read':![],'body':_0x522b4d[_0xa71d('0x5f')][_0xa71d('0x5f')],'phone':_0x55e18d,'WhatsappAccountId':_0xab522b['id'],'WhatsappInteractionId':_0x3a64b4['id'],'UserId':_0x522b4d[_0xa71d('0x61')]['id'],'ContactId':_0x5b2dff['id']}))[_0xa71d('0x38')](function(_0xbc0621){_0x3a64b4[_0xa71d('0xc5')][_0xa71d('0xc4')]=[];_0x3a64b4[_0xa71d('0xc5')][_0xa71d('0xc4')][_0xa71d('0xc6')](_0xbc0621[_0xa71d('0xc5')]);return _0x3a64b4;});})[_0xa71d('0x38')](respondWithResult(_0x5c29e9,null))[_0xa71d('0x5d')](handleError(_0x5c29e9,null));}; \ No newline at end of file +var _0x2151=['result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','map','VIRTUAL','WhatsappAccount','includeAll','findAll','rows','show','params','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','pick','filter','removeDispositions','ids','addAnswer','getAnswers','hasOwnProperty','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','send','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','applications','Applications','asc','CmContact','ValidationError','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','notifications','message_id','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','Contacts','updatedAt','WhatsappInteraction','interaction','push','close','unmanaged','created','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','DESC','out','dataValues','Messages','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2151,0x96));var _0x1215=function(_0x169c3f,_0x54f7d0){_0x169c3f=_0x169c3f-0x0;var _0x3fa434=_0x2151[_0x169c3f];return _0x3fa434;};'use strict';var emlformat=require(_0x1215('0x0'));var rimraf=require(_0x1215('0x1'));var zipdir=require(_0x1215('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1215('0x3'));var Mustache=require(_0x1215('0x4'));var util=require('util');var path=require(_0x1215('0x5'));var sox=require(_0x1215('0x6'));var csv=require(_0x1215('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1215('0x8'));var _=require(_0x1215('0x9'));var squel=require(_0x1215('0xa'));var crypto=require(_0x1215('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1215('0xc'));var toCsv=require(_0x1215('0x7'));var querystring=require(_0x1215('0xd'));var Papa=require(_0x1215('0xe'));var Redis=require(_0x1215('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1215('0x10'));var as=require(_0x1215('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1215('0x12'))(_0x1215('0x13'));var utils=require('../../config/utils');var config=require(_0x1215('0x14'));var licenseUtil=require(_0x1215('0x15'));var db=require(_0x1215('0x16'))['db'];config['redis']=_[_0x1215('0x17')](config[_0x1215('0x18')],{'host':_0x1215('0x19'),'port':0x18eb});var socket=require(_0x1215('0x1a'))(new Redis(config['redis']));require(_0x1215('0x1b'))['register'](socket);var jayson=require(_0x1215('0x1c'));var client=jayson[_0x1215('0x1d')][_0x1215('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x643ea2,_0x386997,_0x2c8f96,_0x2f9c68){return new BPromise(function(_0x51f912,_0x12cb75){var _0x4e791e=_0x2f9c68||client;return _0x4e791e[_0x1215('0x1f')](_0x643ea2,_0x2c8f96)[_0x1215('0x20')](function(_0x540576){logger[_0x1215('0x21')](_0x1215('0x22'),_0x386997,_0x1215('0x23'));logger[_0x1215('0x24')](_0x1215('0x25'),_0x386997,_0x1215('0x23'),JSON[_0x1215('0x26')](_0x540576));if(_0x540576[_0x1215('0x27')]){if(_0x540576[_0x1215('0x27')][_0x1215('0x28')]===0x1f4){logger[_0x1215('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x386997,_0x540576['error'][_0x1215('0x29')]);return _0x12cb75(_0x540576[_0x1215('0x27')][_0x1215('0x29')]);}logger[_0x1215('0x27')](_0x1215('0x22'),_0x386997,_0x540576[_0x1215('0x27')][_0x1215('0x29')]);return _0x51f912(_0x540576[_0x1215('0x27')]['message']);}else{logger[_0x1215('0x21')](_0x1215('0x22'),_0x386997,_0x1215('0x23'));_0x51f912(_0x540576[_0x1215('0x2a')][_0x1215('0x29')]);}})[_0x1215('0x2b')](function(_0x5b1620){logger[_0x1215('0x27')](_0x1215('0x22'),_0x386997,_0x5b1620);_0x12cb75(_0x5b1620);});});}function respondWithStatusCode(_0x314c87,_0x490037){_0x490037=_0x490037||0xcc;return function(_0x370424){if(_0x370424){return _0x314c87[_0x1215('0x2c')](_0x490037);}return _0x314c87[_0x1215('0x2d')](_0x490037)[_0x1215('0x2e')]();};}function respondWithResult(_0x2389ec,_0x145f66){_0x145f66=_0x145f66||0xc8;return function(_0x1a86fa){if(_0x1a86fa){return _0x2389ec[_0x1215('0x2d')](_0x145f66)[_0x1215('0x2f')](_0x1a86fa);}};}function respondWithFilteredResult(_0x22cd49,_0x5758c0){return function(_0x2d4d65){if(_0x2d4d65){var _0x252541=typeof _0x5758c0[_0x1215('0x30')]===_0x1215('0x31')&&typeof _0x5758c0[_0x1215('0x32')]===_0x1215('0x31');var _0x2a4153=_0x2d4d65[_0x1215('0x33')];var _0x2f34db=_0x252541?0x0:_0x5758c0[_0x1215('0x30')];var _0x34be47=_0x252541?_0x2d4d65['count']:_0x5758c0['offset']+_0x5758c0[_0x1215('0x32')];var _0x38805c;if(_0x34be47>=_0x2a4153){_0x34be47=_0x2a4153;_0x38805c=0xc8;}else{_0x38805c=0xce;}_0x22cd49[_0x1215('0x2d')](_0x38805c);return _0x22cd49[_0x1215('0x34')]('Content-Range',_0x2f34db+'-'+_0x34be47+'/'+_0x2a4153)[_0x1215('0x2f')](_0x2d4d65);}return null;};}function patchUpdates(_0x279153){return function(_0x55d66b){try{jsonpatch[_0x1215('0x35')](_0x55d66b,_0x279153,!![]);}catch(_0x533fd8){return BPromise[_0x1215('0x36')](_0x533fd8);}return _0x55d66b[_0x1215('0x37')]();};}function saveUpdates(_0x11d9c7,_0x55bb33){return function(_0x41373d){if(_0x41373d){return _0x41373d[_0x1215('0x38')](_0x11d9c7)['then'](function(_0x2faa5c){return _0x2faa5c;});}return null;};}function removeEntity(_0x58cbc0,_0x591b0c){return function(_0x8b1bf3){if(_0x8b1bf3){return _0x8b1bf3[_0x1215('0x39')]()[_0x1215('0x20')](function(){var _0xcfff79=_0x8b1bf3[_0x1215('0x3a')]({'plain':!![]});var _0x3b1f3e=_0x1215('0x3b');return db[_0x1215('0x3c')][_0x1215('0x39')]({'where':{'type':_0x3b1f3e,'resourceId':_0xcfff79['id']}})['then'](function(){return _0x8b1bf3;});})['then'](function(){_0x58cbc0[_0x1215('0x2d')](0xcc)[_0x1215('0x2e')]();});}};}function handleEntityNotFound(_0x1d90e6,_0x20cd33){return function(_0x5028c2){if(!_0x5028c2){_0x1d90e6[_0x1215('0x2c')](0x194);}return _0x5028c2;};}function handleError(_0xfc9c97,_0x10c1ed){_0x10c1ed=_0x10c1ed||0x1f4;return function(_0x3d2bee){logger['error'](_0x3d2bee[_0x1215('0x3d')]);if(_0x3d2bee['name']){delete _0x3d2bee[_0x1215('0x3e')];}_0xfc9c97[_0x1215('0x2d')](_0x10c1ed)['send'](_0x3d2bee);};}exports[_0x1215('0x3f')]=function(_0x3c0486,_0x2ba23d){var _0xb23979={'include':[{'model':db[_0x1215('0x40')],'as':_0x1215('0x41')}]},_0x57c715={},_0x149d24={'count':0x0,'rows':[]};var _0x17cd05=_['map'](db['WhatsappAccount'][_0x1215('0x42')],function(_0x4804de){return{'name':_0x4804de[_0x1215('0x43')],'type':_0x4804de[_0x1215('0x44')][_0x1215('0x45')]};});_0x57c715[_0x1215('0x46')]=_['map'](_0x17cd05,_0x1215('0x3e'));_0x57c715['query']=_[_0x1215('0x47')](_0x3c0486[_0x1215('0x48')]);_0x57c715[_0x1215('0x49')]=_['intersection'](_0x57c715[_0x1215('0x46')],_0x57c715[_0x1215('0x48')]);_0xb23979[_0x1215('0x4a')]=_[_0x1215('0x4b')](_0x57c715['model'],qs[_0x1215('0x4c')](_0x3c0486[_0x1215('0x48')]['fields']));_0xb23979[_0x1215('0x4a')]=_0xb23979[_0x1215('0x4a')][_0x1215('0x4d')]?_0xb23979[_0x1215('0x4a')]:_0x57c715[_0x1215('0x46')];if(!_0x3c0486['query']['hasOwnProperty'](_0x1215('0x4e'))){_0xb23979['limit']=qs[_0x1215('0x32')](_0x3c0486[_0x1215('0x48')]['limit']);_0xb23979[_0x1215('0x30')]=qs[_0x1215('0x30')](_0x3c0486[_0x1215('0x48')][_0x1215('0x30')]);}_0xb23979[_0x1215('0x4f')]=qs['sort'](_0x3c0486[_0x1215('0x48')][_0x1215('0x50')]);_0xb23979[_0x1215('0x51')]=qs[_0x1215('0x49')](_['pick'](_0x3c0486[_0x1215('0x48')],_0x57c715[_0x1215('0x49')]),_0x17cd05);if(_0x3c0486[_0x1215('0x48')]['filter']){_0xb23979[_0x1215('0x51')]=_[_0x1215('0x52')](_0xb23979[_0x1215('0x51')],{'$or':_[_0x1215('0x53')](_0x17cd05,function(_0x519277){if(_0x519277['type']!==_0x1215('0x54')){var _0x25b757={};_0x25b757[_0x519277['name']]={'$like':'%'+_0x3c0486['query']['filter']+'%'};return _0x25b757;}})});}_0xb23979=_[_0x1215('0x52')]({},_0xb23979,_0x3c0486['options']);var _0x57aeb7={'where':_0xb23979[_0x1215('0x51')]};return db[_0x1215('0x55')][_0x1215('0x33')](_0x57aeb7)[_0x1215('0x20')](function(_0x4f3b30){_0x149d24[_0x1215('0x33')]=_0x4f3b30;if(_0x3c0486[_0x1215('0x48')][_0x1215('0x56')]){_0xb23979['include']=[{'all':!![]}];}return db[_0x1215('0x55')][_0x1215('0x57')](_0xb23979);})[_0x1215('0x20')](function(_0x32e0b3){_0x149d24[_0x1215('0x58')]=_0x32e0b3;return _0x149d24;})['then'](respondWithFilteredResult(_0x2ba23d,_0xb23979))['catch'](handleError(_0x2ba23d,null));};exports[_0x1215('0x59')]=function(_0x2e6751,_0x51cbe1){var _0x186fec={'raw':![],'where':{'id':_0x2e6751[_0x1215('0x5a')]['id']},'include':[{'model':db[_0x1215('0x40')],'as':_0x1215('0x41')}]},_0x419c49={};_0x419c49['model']=_['keys'](db['WhatsappAccount'][_0x1215('0x42')]);_0x419c49[_0x1215('0x48')]=_['keys'](_0x2e6751[_0x1215('0x48')]);_0x419c49[_0x1215('0x49')]=_[_0x1215('0x4b')](_0x419c49[_0x1215('0x46')],_0x419c49[_0x1215('0x48')]);_0x186fec['attributes']=_[_0x1215('0x4b')](_0x419c49['model'],qs['fields'](_0x2e6751[_0x1215('0x48')][_0x1215('0x4c')]));_0x186fec[_0x1215('0x4a')]=_0x186fec[_0x1215('0x4a')][_0x1215('0x4d')]?_0x186fec['attributes']:_0x419c49[_0x1215('0x46')];if(_0x2e6751['query'][_0x1215('0x56')]){_0x186fec[_0x1215('0x5b')]=[{'all':!![]}];}_0x186fec=_[_0x1215('0x52')]({},_0x186fec,_0x2e6751[_0x1215('0x5c')]);return db[_0x1215('0x55')][_0x1215('0x5d')](_0x186fec)[_0x1215('0x20')](handleEntityNotFound(_0x51cbe1,null))[_0x1215('0x20')](respondWithResult(_0x51cbe1,null))[_0x1215('0x2b')](handleError(_0x51cbe1,null));};exports[_0x1215('0x5e')]=function(_0x33a848,_0x1c442b){return db[_0x1215('0x55')][_0x1215('0x5e')](_0x33a848[_0x1215('0x5f')],{})[_0x1215('0x20')](function(_0xd5e43b){var _0x230a8f=_0x33a848['user']['get']({'plain':!![]});if(!_0x230a8f)throw new Error(_0x1215('0x60'));if(_0x230a8f[_0x1215('0x61')]===_0x1215('0x62')){var _0x1da15e=_0xd5e43b[_0x1215('0x3a')]({'plain':!![]});var _0x4c5d0a=_0x1215('0x3b');return db['UserProfileSection'][_0x1215('0x5d')]({'where':{'name':_0x4c5d0a,'userProfileId':_0x230a8f[_0x1215('0x63')]},'raw':!![]})['then'](function(_0x1795ed){if(_0x1795ed&&_0x1795ed[_0x1215('0x64')]===0x0){return db[_0x1215('0x3c')][_0x1215('0x5e')]({'name':_0x1da15e[_0x1215('0x3e')],'resourceId':_0x1da15e['id'],'type':_0x1795ed[_0x1215('0x3e')],'sectionId':_0x1795ed['id']},{})[_0x1215('0x20')](function(){return _0xd5e43b;});}else{return _0xd5e43b;}})[_0x1215('0x2b')](function(_0x4b5031){logger[_0x1215('0x27')](_0x1215('0x65'),_0x4b5031);throw _0x4b5031;});}return _0xd5e43b;})[_0x1215('0x20')](respondWithResult(_0x1c442b,0xc9))['catch'](handleError(_0x1c442b,null));};exports[_0x1215('0x38')]=function(_0x1d68f9,_0x5add0d){if(_0x1d68f9[_0x1215('0x5f')]['id']){delete _0x1d68f9[_0x1215('0x5f')]['id'];}return db['WhatsappAccount'][_0x1215('0x5d')]({'where':{'id':_0x1d68f9['params']['id']},'include':[{'model':db[_0x1215('0x40')],'as':_0x1215('0x41')}]})['then'](handleEntityNotFound(_0x5add0d,null))[_0x1215('0x20')](saveUpdates(_0x1d68f9[_0x1215('0x5f')],null))[_0x1215('0x20')](respondWithResult(_0x5add0d,null))[_0x1215('0x2b')](handleError(_0x5add0d,null));};exports[_0x1215('0x39')]=function(_0x4571da,_0x428a29){return db[_0x1215('0x55')][_0x1215('0x5d')]({'where':{'id':_0x4571da['params']['id']}})[_0x1215('0x20')](handleEntityNotFound(_0x428a29,null))[_0x1215('0x20')](removeEntity(_0x428a29,null))[_0x1215('0x2b')](handleError(_0x428a29,null));};exports[_0x1215('0x66')]=function(_0x562402,_0x4afeeb){return db[_0x1215('0x55')][_0x1215('0x66')]()[_0x1215('0x20')](respondWithResult(_0x4afeeb,null))[_0x1215('0x2b')](handleError(_0x4afeeb,null));};exports[_0x1215('0x67')]=function(_0x47b7ee,_0x1d3793,_0x18107a){if(_0x47b7ee[_0x1215('0x5f')]['id']){delete _0x47b7ee[_0x1215('0x5f')]['id'];}return db[_0x1215('0x55')][_0x1215('0x5d')]({'where':{'id':_0x47b7ee[_0x1215('0x5a')]['id']}})[_0x1215('0x20')](handleEntityNotFound(_0x1d3793,null))['then'](function(_0x3adc8f){if(_0x3adc8f){_0x47b7ee['body'][_0x1215('0x68')]=_0x3adc8f['id'];return db['Disposition'][_0x1215('0x5e')](_0x47b7ee['body']);}})[_0x1215('0x20')](respondWithResult(_0x1d3793,null))[_0x1215('0x2b')](handleError(_0x1d3793,null));};exports[_0x1215('0x69')]=function(_0x84885c,_0x32a8a2,_0x34cdf){var _0x34c459={'raw':![],'where':{}};var _0x4fcb6b={};var _0x86348e={'count':0x0,'rows':[]};return db[_0x1215('0x55')][_0x1215('0x6a')]({'where':{'id':_0x84885c[_0x1215('0x5a')]['id']}})[_0x1215('0x20')](handleEntityNotFound(_0x32a8a2,null))[_0x1215('0x20')](function(_0x19f525){if(_0x19f525){_0x4fcb6b[_0x1215('0x46')]=_[_0x1215('0x47')](db[_0x1215('0x6b')][_0x1215('0x42')]);_0x4fcb6b[_0x1215('0x48')]=_['keys'](_0x84885c[_0x1215('0x48')]);_0x4fcb6b['filters']=_[_0x1215('0x4b')](_0x4fcb6b[_0x1215('0x46')],_0x4fcb6b[_0x1215('0x48')]);_0x34c459[_0x1215('0x4a')]=_['intersection'](_0x4fcb6b['model'],qs[_0x1215('0x4c')](_0x84885c[_0x1215('0x48')][_0x1215('0x4c')]));_0x34c459['attributes']=_0x34c459[_0x1215('0x4a')]['length']?_0x34c459[_0x1215('0x4a')]:_0x4fcb6b[_0x1215('0x46')];if(!_0x84885c[_0x1215('0x48')]['hasOwnProperty'](_0x1215('0x4e'))){_0x34c459['limit']=qs[_0x1215('0x32')](_0x84885c[_0x1215('0x48')][_0x1215('0x32')]);_0x34c459['offset']=qs[_0x1215('0x30')](_0x84885c[_0x1215('0x48')]['offset']);}_0x34c459['order']=qs[_0x1215('0x50')](_0x84885c[_0x1215('0x48')][_0x1215('0x50')]);_0x34c459[_0x1215('0x51')]=qs[_0x1215('0x49')](_[_0x1215('0x6c')](_0x84885c[_0x1215('0x48')],_0x4fcb6b['filters']));_0x34c459[_0x1215('0x51')][_0x1215('0x68')]=_0x19f525['id'];if(_0x84885c[_0x1215('0x48')][_0x1215('0x6d')]){_0x34c459[_0x1215('0x51')]=_[_0x1215('0x52')](_0x34c459[_0x1215('0x51')],{'$or':_['map'](_0x34c459[_0x1215('0x4a')],function(_0x238c8d){var _0x1e3650={};_0x1e3650[_0x238c8d]={'$like':'%'+_0x84885c[_0x1215('0x48')][_0x1215('0x6d')]+'%'};return _0x1e3650;})});}_0x34c459=_[_0x1215('0x52')]({},_0x34c459,_0x84885c[_0x1215('0x5c')]);return db[_0x1215('0x6b')][_0x1215('0x33')]({'where':_0x34c459['where']})['then'](function(_0x2bd9ff){_0x86348e[_0x1215('0x33')]=_0x2bd9ff;if(_0x84885c[_0x1215('0x48')][_0x1215('0x56')]){_0x34c459[_0x1215('0x5b')]=[{'all':!![]}];}return db[_0x1215('0x6b')][_0x1215('0x57')](_0x34c459);})[_0x1215('0x20')](function(_0xa3e8b3){_0x86348e[_0x1215('0x58')]=_0xa3e8b3;return _0x86348e;});}})[_0x1215('0x20')](respondWithFilteredResult(_0x32a8a2,_0x34c459))[_0x1215('0x2b')](handleError(_0x32a8a2,null));};exports['removeDispositions']=function(_0x295c96,_0x268704,_0x29b22e){return db[_0x1215('0x55')][_0x1215('0x5d')]({'where':{'id':_0x295c96[_0x1215('0x5a')]['id']}})[_0x1215('0x20')](handleEntityNotFound(_0x268704,null))[_0x1215('0x20')](function(_0x243988){if(_0x243988){return _0x243988[_0x1215('0x6e')](_0x295c96['query'][_0x1215('0x6f')]);}})[_0x1215('0x20')](respondWithStatusCode(_0x268704,null))['catch'](handleError(_0x268704,null));};exports[_0x1215('0x70')]=function(_0x4eb01a,_0xdf933d,_0x20851f){if(_0x4eb01a[_0x1215('0x5f')]['id']){delete _0x4eb01a[_0x1215('0x5f')]['id'];}return db[_0x1215('0x55')][_0x1215('0x5d')]({'where':{'id':_0x4eb01a[_0x1215('0x5a')]['id']}})['then'](handleEntityNotFound(_0xdf933d,null))[_0x1215('0x20')](function(_0x5be2ba){if(_0x5be2ba){_0x4eb01a['body'][_0x1215('0x68')]=_0x5be2ba['id'];return db['CannedAnswer'][_0x1215('0x5e')](_0x4eb01a[_0x1215('0x5f')]);}})['then'](respondWithResult(_0xdf933d,null))['catch'](handleError(_0xdf933d,null));};exports[_0x1215('0x71')]=function(_0x135b38,_0x209a06,_0x7c104c){var _0x59c5c5={'raw':![],'where':{}};var _0x29f9b3={};var _0x344db6={'count':0x0,'rows':[]};return db[_0x1215('0x55')][_0x1215('0x6a')]({'where':{'id':_0x135b38['params']['id']}})[_0x1215('0x20')](handleEntityNotFound(_0x209a06,null))[_0x1215('0x20')](function(_0x5bccfe){if(_0x5bccfe){_0x29f9b3[_0x1215('0x46')]=_['keys'](db['CannedAnswer'][_0x1215('0x42')]);_0x29f9b3[_0x1215('0x48')]=_[_0x1215('0x47')](_0x135b38[_0x1215('0x48')]);_0x29f9b3[_0x1215('0x49')]=_[_0x1215('0x4b')](_0x29f9b3[_0x1215('0x46')],_0x29f9b3[_0x1215('0x48')]);_0x59c5c5[_0x1215('0x4a')]=_[_0x1215('0x4b')](_0x29f9b3['model'],qs[_0x1215('0x4c')](_0x135b38[_0x1215('0x48')][_0x1215('0x4c')]));_0x59c5c5[_0x1215('0x4a')]=_0x59c5c5[_0x1215('0x4a')][_0x1215('0x4d')]?_0x59c5c5['attributes']:_0x29f9b3[_0x1215('0x46')];if(!_0x135b38[_0x1215('0x48')][_0x1215('0x72')](_0x1215('0x4e'))){_0x59c5c5[_0x1215('0x32')]=qs[_0x1215('0x32')](_0x135b38[_0x1215('0x48')][_0x1215('0x32')]);_0x59c5c5[_0x1215('0x30')]=qs[_0x1215('0x30')](_0x135b38[_0x1215('0x48')][_0x1215('0x30')]);}_0x59c5c5['order']=qs[_0x1215('0x50')](_0x135b38[_0x1215('0x48')][_0x1215('0x50')]);_0x59c5c5[_0x1215('0x51')]=qs[_0x1215('0x49')](_[_0x1215('0x6c')](_0x135b38[_0x1215('0x48')],_0x29f9b3[_0x1215('0x49')]));_0x59c5c5[_0x1215('0x51')][_0x1215('0x68')]=_0x5bccfe['id'];if(_0x135b38[_0x1215('0x48')][_0x1215('0x6d')]){_0x59c5c5[_0x1215('0x51')]=_[_0x1215('0x52')](_0x59c5c5[_0x1215('0x51')],{'$or':_[_0x1215('0x53')](_0x59c5c5[_0x1215('0x4a')],function(_0x59f762){var _0x3181ca={};_0x3181ca[_0x59f762]={'$like':'%'+_0x135b38[_0x1215('0x48')][_0x1215('0x6d')]+'%'};return _0x3181ca;})});}_0x59c5c5=_[_0x1215('0x52')]({},_0x59c5c5,_0x135b38[_0x1215('0x5c')]);return db[_0x1215('0x73')][_0x1215('0x33')]({'where':_0x59c5c5[_0x1215('0x51')]})[_0x1215('0x20')](function(_0x143715){_0x344db6[_0x1215('0x33')]=_0x143715;if(_0x135b38[_0x1215('0x48')]['includeAll']){_0x59c5c5['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x1215('0x57')](_0x59c5c5);})['then'](function(_0x54996f){_0x344db6[_0x1215('0x58')]=_0x54996f;return _0x344db6;});}})[_0x1215('0x20')](respondWithFilteredResult(_0x209a06,_0x59c5c5))[_0x1215('0x2b')](handleError(_0x209a06,null));};exports[_0x1215('0x74')]=function(_0x2468eb,_0x479f24,_0x5d156b){return db[_0x1215('0x55')]['find']({'where':{'id':_0x2468eb[_0x1215('0x5a')]['id']}})[_0x1215('0x20')](handleEntityNotFound(_0x479f24,null))['then'](function(_0x1c39f1){if(_0x1c39f1){return _0x1c39f1['removeAnswers'](_0x2468eb[_0x1215('0x48')][_0x1215('0x6f')]);}})['then'](respondWithStatusCode(_0x479f24,null))['catch'](handleError(_0x479f24,null));};exports[_0x1215('0x75')]=function(_0x5197ed,_0x3f2c82,_0x4a4366){return db[_0x1215('0x55')][_0x1215('0x5d')]({'where':{'id':_0x5197ed['params']['id']}})[_0x1215('0x20')](handleEntityNotFound(_0x3f2c82,null))['then'](function(_0x214097){if(_0x214097){return _0x214097[_0x1215('0x75')](_0x5197ed[_0x1215('0x5f')][_0x1215('0x6f')],_[_0x1215('0x76')](_0x5197ed['body'],['ids','id'])||{})[_0x1215('0x77')](function(_0x43ec8c){for(var _0x124a85=0x0;_0x124a85<_0x5197ed[_0x1215('0x5f')][_0x1215('0x6f')][_0x1215('0x4d')];_0x124a85+=0x1){socket[_0x1215('0x78')]('userWhatsappAccount:save',{'UserId':Number(_0x5197ed[_0x1215('0x5f')][_0x1215('0x6f')][_0x124a85]),'WhatsappAccountId':Number(_0x5197ed[_0x1215('0x5a')]['id'])});}return _0x43ec8c;});}})[_0x1215('0x20')](respondWithResult(_0x3f2c82,null))[_0x1215('0x2b')](handleError(_0x3f2c82,null));};exports['removeAgents']=function(_0x12f5e7,_0x494b10,_0x2a184a){return db[_0x1215('0x55')][_0x1215('0x5d')]({'where':{'id':_0x12f5e7[_0x1215('0x5a')]['id']}})[_0x1215('0x20')](handleEntityNotFound(_0x494b10,null))[_0x1215('0x20')](function(_0x24b17c){if(_0x24b17c){return _0x24b17c[_0x1215('0x79')](_0x12f5e7[_0x1215('0x48')][_0x1215('0x6f')])[_0x1215('0x20')](function(){if(_[_0x1215('0x7a')](_0x12f5e7[_0x1215('0x48')][_0x1215('0x6f')])){for(var _0x1c29ed=0x0;_0x1c29ed<_0x12f5e7[_0x1215('0x48')][_0x1215('0x6f')][_0x1215('0x4d')];_0x1c29ed+=0x1){socket['emit'](_0x1215('0x7b'),{'UserId':Number(_0x12f5e7['query'][_0x1215('0x6f')][_0x1c29ed]),'WhatsappAccountId':Number(_0x12f5e7[_0x1215('0x5a')]['id'])});}}else{socket[_0x1215('0x78')](_0x1215('0x7b'),{'UserId':Number(_0x12f5e7[_0x1215('0x48')][_0x1215('0x6f')]),'WhatsappAccountId':Number(_0x12f5e7[_0x1215('0x5a')]['id'])});}});}})[_0x1215('0x20')](respondWithStatusCode(_0x494b10,null))['catch'](handleError(_0x494b10,null));};exports['getAgents']=function(_0x32fd98,_0x1eefce,_0x4eb3af){var _0x1cb68f={};var _0x48fa95={};var _0x143358;var _0x4ad064;return db[_0x1215('0x55')][_0x1215('0x6a')]({'where':{'id':_0x32fd98[_0x1215('0x5a')]['id']}})[_0x1215('0x20')](handleEntityNotFound(_0x1eefce,null))[_0x1215('0x20')](function(_0x340d91){if(_0x340d91){_0x143358=_0x340d91;_0x48fa95['model']=_[_0x1215('0x47')](db[_0x1215('0x7c')]['rawAttributes']);_0x48fa95[_0x1215('0x48')]=_[_0x1215('0x47')](_0x32fd98[_0x1215('0x48')]);_0x48fa95[_0x1215('0x49')]=_['intersection'](_0x48fa95[_0x1215('0x46')],_0x48fa95[_0x1215('0x48')]);_0x1cb68f[_0x1215('0x4a')]=_[_0x1215('0x4b')](_0x48fa95[_0x1215('0x46')],qs[_0x1215('0x4c')](_0x32fd98['query']['fields']));_0x1cb68f[_0x1215('0x4a')]=_0x1cb68f[_0x1215('0x4a')][_0x1215('0x4d')]?_0x1cb68f[_0x1215('0x4a')]:_0x48fa95[_0x1215('0x46')];_0x1cb68f[_0x1215('0x4f')]=qs[_0x1215('0x50')](_0x32fd98[_0x1215('0x48')]['sort']);_0x1cb68f[_0x1215('0x51')]=qs['filters'](_[_0x1215('0x6c')](_0x32fd98[_0x1215('0x48')],_0x48fa95['filters']));if(_0x32fd98['query'][_0x1215('0x6d')]){_0x1cb68f[_0x1215('0x51')]=_['merge'](_0x1cb68f[_0x1215('0x51')],{'$or':_[_0x1215('0x53')](_0x1cb68f[_0x1215('0x4a')],function(_0x14d2c4){var _0x395766={};_0x395766[_0x14d2c4]={'$like':'%'+_0x32fd98[_0x1215('0x48')][_0x1215('0x6d')]+'%'};return _0x395766;})});}_0x1cb68f=_[_0x1215('0x52')]({},_0x1cb68f,_0x32fd98[_0x1215('0x5c')]);return _0x143358[_0x1215('0x7d')](_0x1cb68f);}})[_0x1215('0x20')](function(_0x11ce4c){if(_0x11ce4c){_0x4ad064=_0x11ce4c[_0x1215('0x4d')];if(!_0x32fd98[_0x1215('0x48')][_0x1215('0x72')]('nolimit')){_0x1cb68f[_0x1215('0x32')]=qs['limit'](_0x32fd98[_0x1215('0x48')][_0x1215('0x32')]);_0x1cb68f['offset']=qs[_0x1215('0x30')](_0x32fd98['query']['offset']);}return _0x143358['getAgents'](_0x1cb68f);}})[_0x1215('0x20')](function(_0x42b832){if(_0x42b832){return _0x42b832?{'count':_0x4ad064,'rows':_0x42b832}:null;}})[_0x1215('0x20')](respondWithResult(_0x1eefce,null))[_0x1215('0x2b')](handleError(_0x1eefce,null));};exports['addApplications']=function(_0x2d88be,_0xa65d0){var _0x4c56d0=_0x2d88be[_0x1215('0x5a')]['id'];var _0x51fdec=_0x2d88be['body'];var _0xcb0391=0xc8;var _0x2eda25=null;return db[_0x1215('0x7e')][_0x1215('0x7f')]({'isolationLevel':db[_0x1215('0x7e')]['Transaction'][_0x1215('0x80')][_0x1215('0x81')]},function(_0x13af49){return db['WhatsappAccount'][_0x1215('0x6a')]({'where':{'id':_0x4c56d0},'transaction':_0x13af49})[_0x1215('0x20')](function(_0x78c1bf){if(_0x78c1bf){return db[_0x1215('0x82')]['destroy']({'where':{'WhatsappAccountId':_0x4c56d0},'transaction':_0x13af49})[_0x1215('0x20')](function(){var _0x449b6f=_[_0x1215('0x53')](_0x51fdec,function(_0x23ea21){_0x23ea21[_0x1215('0x68')]=_0x4c56d0;return _0x23ea21;});return db[_0x1215('0x82')][_0x1215('0x83')](_0x449b6f,{'transaction':_0x13af49});});}else{_0xcb0391=0x194;_0x2eda25=[];}});})['then'](function(){if(_0xcb0391!==0x194){return db['WhatsappApplication'][_0x1215('0x84')]({'where':{'WhatsappAccountId':_0x4c56d0},'order':_0x1215('0x85')})[_0x1215('0x20')](function(_0x5e8382){_0x2eda25=_0x5e8382;});}})[_0x1215('0x2b')](function(_0x5ccc81){_0xcb0391=0x1f4;logger[_0x1215('0x27')](_0x5ccc81[_0x1215('0x3d')]);if(_0x5ccc81[_0x1215('0x3e')]){delete _0x5ccc81[_0x1215('0x3e')];}_0x2eda25=_0x5ccc81;})['finally'](function(){if(_0x2eda25===null){_0xa65d0[_0x1215('0x2c')](_0xcb0391);}else{if(_0xcb0391===0x1f4){_0xa65d0[_0x1215('0x2d')](_0xcb0391)[_0x1215('0x86')](_0x2eda25);}else{_0xa65d0[_0x1215('0x2d')](_0xcb0391)[_0x1215('0x2f')](_0x2eda25);}}});};exports['getApplications']=function(_0x5beba6,_0x25e09b,_0x30202f){var _0x2b96ab={};var _0x917166={};var _0x48ec46;var _0x4b16b4;return db[_0x1215('0x55')][_0x1215('0x6a')]({'where':{'id':_0x5beba6[_0x1215('0x5a')]['id']}})[_0x1215('0x20')](handleEntityNotFound(_0x25e09b,null))['then'](function(_0x52e696){if(_0x52e696){_0x48ec46=_0x52e696;_0x917166[_0x1215('0x46')]=_['keys'](db[_0x1215('0x82')][_0x1215('0x42')]);_0x917166[_0x1215('0x48')]=_[_0x1215('0x47')](_0x5beba6[_0x1215('0x48')]);_0x917166['filters']=_[_0x1215('0x4b')](_0x917166[_0x1215('0x46')],_0x917166[_0x1215('0x48')]);_0x2b96ab['attributes']=_[_0x1215('0x4b')](_0x917166[_0x1215('0x46')],qs[_0x1215('0x4c')](_0x5beba6['query'][_0x1215('0x4c')]));_0x2b96ab[_0x1215('0x4a')]=_0x2b96ab[_0x1215('0x4a')][_0x1215('0x4d')]?_0x2b96ab[_0x1215('0x4a')]:_0x917166[_0x1215('0x46')];_0x2b96ab[_0x1215('0x4f')]=qs[_0x1215('0x50')](_0x5beba6['query'][_0x1215('0x50')]);_0x2b96ab['where']=qs[_0x1215('0x49')](_['pick'](_0x5beba6[_0x1215('0x48')],_0x917166[_0x1215('0x49')]));if(_0x5beba6[_0x1215('0x48')][_0x1215('0x6d')]){_0x2b96ab[_0x1215('0x51')]=_[_0x1215('0x52')](_0x2b96ab[_0x1215('0x51')],{'$or':_[_0x1215('0x53')](_0x2b96ab[_0x1215('0x4a')],function(_0x960ad4){var _0x289dd2={};_0x289dd2[_0x960ad4]={'$like':'%'+_0x5beba6[_0x1215('0x48')][_0x1215('0x6d')]+'%'};return _0x289dd2;})});}_0x2b96ab=_['merge']({},_0x2b96ab,_0x5beba6[_0x1215('0x5c')]);return _0x48ec46['getApplications'](_0x2b96ab);}})[_0x1215('0x20')](function(_0x13926d){if(_0x13926d){_0x4b16b4=_0x13926d[_0x1215('0x4d')];if(!_0x5beba6['query']['hasOwnProperty'](_0x1215('0x4e'))){_0x2b96ab['limit']=qs[_0x1215('0x32')](_0x5beba6[_0x1215('0x48')][_0x1215('0x32')]);_0x2b96ab[_0x1215('0x30')]=qs['offset'](_0x5beba6['query'][_0x1215('0x30')]);}return _0x48ec46[_0x1215('0x87')](_0x2b96ab);}})['then'](function(_0x261da7){if(_0x261da7){return _0x261da7?{'count':_0x4b16b4,'rows':_0x261da7}:null;}})[_0x1215('0x20')](respondWithResult(_0x25e09b,null))[_0x1215('0x2b')](handleError(_0x25e09b,null));};exports[_0x1215('0x88')]=function(_0x2472cf,_0x3060d8,_0x12f065){var _0x327692={'channel':_0x1215('0x89')};var _0x43a019=[];var _0x2da09d=[];var _0x4e2bfc={};return db[_0x1215('0x55')]['find']({'where':{'id':_0x2472cf[_0x1215('0x5a')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x1215('0x20')](handleEntityNotFound(_0x3060d8,null))[_0x1215('0x20')](function(_0x2b64dc){_0x327692['account']=_0x2b64dc;if(_0x327692['account']&&_0x327692[_0x1215('0x8a')][_0x1215('0x44')]===_0x1215('0x8b')&&_0x2472cf[_0x1215('0x5f')][_0x1215('0x8c')]){if(_0x2472cf[_0x1215('0x5f')][_0x1215('0x8c')][_0x1215('0x4d')]===0x0)return;if(_0x2472cf[_0x1215('0x5f')][_0x1215('0x8c')][0x0][_0x1215('0x8d')]!==_0x1215('0x8e'))return;return db[_0x1215('0x8f')][_0x1215('0x38')]({'read':!![],'readAt':_0x2472cf[_0x1215('0x5f')][_0x1215('0x8c')][0x0]['timestamp']},{'where':{'messageId':_0x2472cf[_0x1215('0x5f')][_0x1215('0x8c')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x463b57){return _0x3060d8[_0x1215('0x2d')](0xc8)[_0x1215('0x2f')](_0x463b57);});}_0x327692[_0x1215('0x90')]=_['orderBy'](_0x2b64dc[_0x1215('0x91')],[_0x1215('0x85')],[_0x1215('0x92')]);if(_0x327692['account'][_0x1215('0x91')]){delete _0x327692[_0x1215('0x8a')][_0x1215('0x91')];}return db[_0x1215('0x93')][_0x1215('0x66')]()[_0x1215('0x20')](function(_0xbbd188){if(!_0xbbd188){throw new db['Sequelize'][(_0x1215('0x94'))]('no\x20available\x20attributes');}_0x43a019=_[_0x1215('0x95')](_[_0x1215('0x47')](_0xbbd188),[_0x1215('0x96'),'updatedAt']);_0x2da09d=_[_0x1215('0x95')](_['keys'](_0xbbd188),[_0x1215('0x96'),'updatedAt',_0x1215('0x97'),_0x1215('0x98')]);_0x327692[_0x1215('0x5f')]={'mapKey':_0x1215('0x99')};if(_0x327692[_0x1215('0x8a')]&&_0x327692[_0x1215('0x8a')]['type']===_0x1215('0x9a')){_0x327692['body'][_0x1215('0x9b')]=_0x2472cf['body']['From']['replace']('whatsapp:','');_0x327692[_0x1215('0x5f')][_0x1215('0x5f')]=_0x2472cf[_0x1215('0x5f')][_0x1215('0x9c')];_0x327692[_0x1215('0x5f')][_0x1215('0x9d')]=_0x2472cf['body'][_0x1215('0x9e')];}if(_0x327692[_0x1215('0x8a')]&&_0x327692[_0x1215('0x8a')][_0x1215('0x44')]===_0x1215('0x8b')){_0x327692[_0x1215('0x5f')][_0x1215('0x9b')]=_0x2472cf[_0x1215('0x5f')][_0x1215('0x9f')][0x0][_0x1215('0x9b')];_0x327692[_0x1215('0x5f')]['body']=_0x2472cf[_0x1215('0x5f')][_0x1215('0x9f')][0x0][_0x1215('0x29')][_0x1215('0x5f')];_0x327692['body'][_0x1215('0x9d')]=_0x2472cf[_0x1215('0x5f')][_0x1215('0x9f')][0x0][_0x1215('0xa0')];}if(_0x327692['body']['id']){delete _0x327692[_0x1215('0x5f')]['id'];}if(_[_0x1215('0xa1')](_0x327692[_0x1215('0x5f')][_0x1215('0x9b')])){throw new db['Sequelize'][(_0x1215('0x94'))]('from\x20is\x20mandatory');}if(_[_0x1215('0xa1')](_0x327692['body'][_0x1215('0x5f')])||_0x327692['body']['body']===''){throw new db[(_0x1215('0xa2'))][(_0x1215('0x94'))](_0x1215('0xa3'));}if(_[_0x1215('0xa1')](_0x327692['body'][_0x1215('0xa4')])){throw new db[(_0x1215('0xa2'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2da09d);}if(!_['includes'](_0x2da09d,_0x327692[_0x1215('0x5f')][_0x1215('0xa4')])){throw new db[(_0x1215('0xa2'))][(_0x1215('0x94'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2da09d);}_0x4e2bfc[_0x327692[_0x1215('0x5f')][_0x1215('0xa4')]]=_0x327692[_0x1215('0x5f')][_0x1215('0x9b')];return db[_0x1215('0xa5')][_0x1215('0x5d')]({'where':{'id':_0x327692['account'][_0x1215('0x98')]},'include':[{'model':db[_0x1215('0x93')],'as':_0x1215('0xa6'),'where':_0x4e2bfc,'limit':0x1,'order':[[_0x1215('0xa7'),'DESC']]}]});})[_0x1215('0x20')](handleEntityNotFound(_0x3060d8,null))[_0x1215('0x20')](function(_0x228a23){if(_0x228a23){_0x327692['list']=_[_0x1215('0x76')](_0x228a23,[_0x1215('0xa6')]);if(_0x228a23[_0x1215('0xa6')]['length']){return _0x228a23[_0x1215('0xa6')][0x0];}var _0x403dcc=_[_0x1215('0x17')](_0x327692['body'],{'firstName':_0x327692[_0x1215('0x5f')]['from'],'ListId':_0x228a23['id']});_0x403dcc[_0x327692[_0x1215('0x5f')][_0x1215('0xa4')]]=_0x327692[_0x1215('0x5f')][_0x1215('0x9b')];return db[_0x1215('0x93')][_0x1215('0x5e')](_0x403dcc,{'fields':_0x43a019,'raw':!![]});}})[_0x1215('0x20')](handleEntityNotFound(_0x3060d8,null))[_0x1215('0x20')](function(_0x383f11){if(_0x383f11){_0x327692['contact']=_0x383f11;var _0x32a86d={'ContactId':_0x383f11['id'],'phone':_0x327692[_0x1215('0x5f')][_0x1215('0x9b')],'WhatsappAccountId':_0x2472cf[_0x1215('0x5a')]['id']};var _0x234a6b={'ContactId':_0x383f11['id'],'WhatsappAccountId':_0x2472cf[_0x1215('0x5a')]['id'],'closed':![]};return db[_0x1215('0xa8')]['find']({'where':_0x234a6b})['then'](function(_0x5c5b61){if(_0x5c5b61){return[_0x5c5b61,![]];}return db['WhatsappInteraction']['create'](_0x32a86d)[_0x1215('0x20')](function(_0x42c0be){return[_0x42c0be,!![]];});});}})[_0x1215('0x77')](function(_0x289d9c,_0x32ff56){_0x327692[_0x1215('0xa9')]=_0x289d9c[_0x1215('0x3a')]({'plain':!![]});_0x327692[_0x1215('0xa9')]['created']=![];if(_0x32ff56){if(_0x327692[_0x1215('0x8a')]['autoclose']){_0x327692[_0x1215('0x90')][_0x1215('0xaa')]({'id':0x0,'priority':_0x327692[_0x1215('0x90')][_0x1215('0x4d')]+0x1,'app':_0x1215('0xab'),'appdata':_0x1215('0xac'),'interval':'*,*,*,*'});}_0x327692['interaction'][_0x1215('0xad')]=!![];}return db['WhatsappMessage'][_0x1215('0x5e')]({'phone':_0x327692['body']['from'],'messageId':_0x327692[_0x1215('0x5f')][_0x1215('0x9d')],'body':_0x327692[_0x1215('0x5f')][_0x1215('0x5f')],'WhatsappAccountId':_0x2472cf['params']['id'],'WhatsappInteractionId':_0x289d9c['id'],'direction':'in','ContactId':_0x289d9c['ContactId'],'AttachmentId':_0x327692['body'][_0x1215('0xae')]});})['then'](function(_0x555122){_0x327692[_0x1215('0x29')]=_0x555122;if(_0x327692[_0x1215('0xa9')][_0x1215('0xaf')]){return db[_0x1215('0x7c')][_0x1215('0x5d')]({'attributes':['id',_0x1215('0x3e')],'where':{'id':_0x327692[_0x1215('0xa9')][_0x1215('0xaf')]}})['then'](function(_0x4d2658){if(_0x4d2658){_0x327692[_0x1215('0x90')][_0x1215('0xb0')]({'id':0x0,'priority':0x0,'app':_0x1215('0xb1'),'appdata':_0x4d2658[_0x1215('0x3e')]+','+(_0x327692[_0x1215('0x8a')][_0x1215('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1215('0xb3'),_0x1215('0xb4'),_0x327692);});}return respondWithRpcPromise(_0x1215('0xb3'),_0x1215('0xb4'),_0x327692);})[_0x1215('0x20')](function(_0x11a3e3){if(_0x11a3e3){var _0x5c8a78=0xc8;var _0xe91262=_0x1215('0xb5');logger[_0x1215('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xe91262,_0x5c8a78,_0x1215('0xb6'));logger[_0x1215('0x24')](_0x1215('0xb7'),_0xe91262,_0x5c8a78,_0x1215('0xb6'),JSON[_0x1215('0x26')](_0x11a3e3));if(_0x327692['account'][_0x1215('0x44')]===_0x1215('0x9a')){return _0x3060d8[_0x1215('0x2d')](_0x5c8a78)['set'](_0x1215('0xb8'),'text/xml')['send'](_0x1215('0xb9'));}else{return _0x3060d8[_0x1215('0x2d')](_0x5c8a78)[_0x1215('0x2f')](_0x11a3e3);}}});})[_0x1215('0x2b')](handleError(_0x3060d8,null));};exports[_0x1215('0x86')]=function(_0x4e75a8,_0x236d1a,_0x21655f){var _0x5e347e,_0x373a67,_0x4949b8;if(_['isNil'](_0x4e75a8['body']['body'])||_0x4e75a8[_0x1215('0x5f')][_0x1215('0x5f')]===''){throw new db[(_0x1215('0xa2'))][(_0x1215('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1215('0xa1')](_0x4e75a8['body']['to'])){throw new db['Sequelize'][(_0x1215('0x94'))](_0x1215('0xba'));}_0x5e347e=_0x4e75a8[_0x1215('0x5f')]['to'];return db[_0x1215('0x55')][_0x1215('0x5d')]({'where':{'id':_0x4e75a8[_0x1215('0x5a')]['id']},'include':[{'model':db[_0x1215('0xa5')],'as':_0x1215('0xbb'),'include':[{'model':db[_0x1215('0x93')],'as':_0x1215('0xa6'),'where':{'mobile':_0x5e347e},'limit':0x1,'order':[['updatedAt',_0x1215('0xbc')]]}]}]})[_0x1215('0x20')](handleEntityNotFound(_0x236d1a,null))[_0x1215('0x20')](function(_0x5473e8){if(_0x5473e8&&_0x5473e8[_0x1215('0xbb')]){_0x373a67=_0x5473e8[_0x1215('0x3a')]({'plain':!![]});if(_0x373a67[_0x1215('0xbb')]&&_0x373a67[_0x1215('0xbb')][_0x1215('0xa6')][_0x1215('0x4d')]){return _0x373a67[_0x1215('0xbb')][_0x1215('0xa6')][0x0];}return db[_0x1215('0x93')][_0x1215('0x5e')](_[_0x1215('0x17')](_0x4e75a8[_0x1215('0x5f')],{'firstName':_0x5e347e,'mobile':_0x5e347e,'phone':_0x5e347e,'ListId':_0x373a67[_0x1215('0x98')]}));}})[_0x1215('0x20')](handleEntityNotFound(_0x236d1a,null))[_0x1215('0x20')](function(_0xbfd50c){if(_0xbfd50c){_0x4949b8=_0xbfd50c;return db[_0x1215('0xa8')][_0x1215('0x5d')]({'where':{'ContactId':_0x4949b8['id'],'closed':![],'WhatsappAccountId':_0x373a67['id']}})[_0x1215('0x20')](function(_0x1528fc){if(_0x1528fc){return[_0x1528fc,![]];}return db[_0x1215('0xa8')][_0x1215('0x5e')]({'UserId':_0x4e75a8[_0x1215('0x62')]['id'],'ContactId':_0x4949b8['id'],'WhatsappAccountId':_0x373a67['id'],'phone':_0x5e347e,'firstMsgDirection':_0x1215('0xbd'),'Messages':[_['merge'](_0x4e75a8[_0x1215('0x5f')],{'read':![],'body':_0x4e75a8[_0x1215('0x5f')][_0x1215('0x5f')],'phone':_0x5e347e,'WhatsappAccountId':_0x373a67['id'],'UserId':_0x4e75a8[_0x1215('0x62')]['id'],'ContactId':_0x4949b8['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x1e0aec){return[_0x1e0aec,!![]];});});}})['spread'](function(_0x221c00,_0x4dda94){if(_0x4dda94){return _0x221c00;}return db[_0x1215('0x8f')][_0x1215('0x5e')](_['merge'](_0x4e75a8[_0x1215('0x5f')],{'read':![],'body':_0x4e75a8['body'][_0x1215('0x5f')],'phone':_0x5e347e,'WhatsappAccountId':_0x373a67['id'],'WhatsappInteractionId':_0x221c00['id'],'UserId':_0x4e75a8[_0x1215('0x62')]['id'],'ContactId':_0x4949b8['id']}))[_0x1215('0x20')](function(_0x5b727c){_0x221c00[_0x1215('0xbe')][_0x1215('0xbf')]=[];_0x221c00[_0x1215('0xbe')]['Messages'][_0x1215('0xaa')](_0x5b727c[_0x1215('0xbe')]);return _0x221c00;});})[_0x1215('0x20')](respondWithResult(_0x236d1a,null))[_0x1215('0x2b')](handleError(_0x236d1a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 58df98f..e115e6b 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 _0x35d2=['update','emit','hasOwnProperty','events','../../mysqldb','save'];(function(_0x103b42,_0x1069c0){var _0x517fa9=function(_0x1edab9){while(--_0x1edab9){_0x103b42['push'](_0x103b42['shift']());}};_0x517fa9(++_0x1069c0);}(_0x35d2,0x11d));var _0x235d=function(_0x5093c6,_0x48e317){_0x5093c6=_0x5093c6-0x0;var _0x54dbdd=_0x35d2[_0x5093c6];return _0x54dbdd;};'use strict';var EventEmitter=require(_0x235d('0x0'));var WhatsappAccount=require(_0x235d('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x235d('0x2'),'afterUpdate':_0x235d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x57f68d){return function(_0x3958c6,_0x1bc4c7,_0x2d5b28){WhatsappAccountEvents['emit'](_0x57f68d+':'+_0x3958c6['id'],_0x3958c6);WhatsappAccountEvents[_0x235d('0x4')](_0x57f68d,_0x3958c6);_0x2d5b28(null);};}for(var e in events){if(events[_0x235d('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xdb15=['update','remove','emit','hasOwnProperty','WhatsappAccount','setMaxListeners','save'];(function(_0x1898de,_0x38d3f1){var _0xc74743=function(_0xa6af96){while(--_0xa6af96){_0x1898de['push'](_0x1898de['shift']());}};_0xc74743(++_0x38d3f1);}(_0xdb15,0x1cb));var _0x5db1=function(_0x14e0fc,_0x39620a){_0x14e0fc=_0x14e0fc-0x0;var _0x3fdb24=_0xdb15[_0x14e0fc];return _0x3fdb24;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x5db1('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5db1('0x1')](0x0);var events={'afterCreate':_0x5db1('0x2'),'afterUpdate':_0x5db1('0x3'),'afterDestroy':_0x5db1('0x4')};function emitEvent(_0x36b3d2){return function(_0x2b9118,_0x216b7a,_0x2f6320){WhatsappAccountEvents['emit'](_0x36b3d2+':'+_0x2b9118['id'],_0x2b9118);WhatsappAccountEvents[_0x5db1('0x5')](_0x36b3d2,_0x2b9118);_0x2f6320(null);};}for(var e in events){if(events[_0x5db1('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 6424671..12206ec 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 _0xfb8e=['moment','bluebird','rimraf','../../config/environment','exports','define','whatsapp_accounts','lodash','util','api'];(function(_0x134db,_0x112e55){var _0x458a47=function(_0x582f21){while(--_0x582f21){_0x134db['push'](_0x134db['shift']());}};_0x458a47(++_0x112e55);}(_0xfb8e,0x13d));var _0xefb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfb8e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xefb8('0x0'));var util=require(_0xefb8('0x1'));var logger=require('../../config/logger')(_0xefb8('0x2'));var moment=require(_0xefb8('0x3'));var BPromise=require(_0xefb8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xefb8('0x5'));var config=require(_0xefb8('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0xefb8('0x7')]=function(_0x472226,_0x1024e9){return _0x472226[_0xefb8('0x8')]('WhatsappAccount',attributes,{'tableName':_0xefb8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa938=['../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x33a92d,_0x10b4fb){var _0x393514=function(_0x47507b){while(--_0x47507b){_0x33a92d['push'](_0x33a92d['shift']());}};_0x393514(++_0x10b4fb);}(_0xa938,0x118));var _0x8a93=function(_0x547224,_0x22fdf5){_0x547224=_0x547224-0x0;var _0x276f75=_0xa938[_0x547224];return _0x276f75;};'use strict';var _=require(_0x8a93('0x0'));var util=require('util');var logger=require(_0x8a93('0x1'))(_0x8a93('0x2'));var moment=require(_0x8a93('0x3'));var BPromise=require(_0x8a93('0x4'));var rp=require(_0x8a93('0x5'));var fs=require('fs');var path=require(_0x8a93('0x6'));var rimraf=require(_0x8a93('0x7'));var config=require(_0x8a93('0x8'));var attributes=require(_0x8a93('0x9'));module[_0x8a93('0xa')]=function(_0x5004d4,_0x4b48d6){return _0x5004d4['define'](_0x8a93('0xb'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 33db589..90fa1ff 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 _0x58a6=['then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowWhatsappAccount','WhatsappAccount','options','raw','where','include','map','model','attributes','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappAccount.socket','request'];(function(_0x539885,_0x5a4d8){var _0x40a247=function(_0x2fa93f){while(--_0x2fa93f){_0x539885['push'](_0x539885['shift']());}};_0x40a247(++_0x5a4d8);}(_0x58a6,0x109));var _0x658a=function(_0x57b24e,_0x57bed9){_0x57b24e=_0x57b24e-0x0;var _0x14aec5=_0x58a6[_0x57b24e];return _0x14aec5;};'use strict';var _=require('lodash');var util=require(_0x658a('0x0'));var moment=require('moment');var BPromise=require(_0x658a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x658a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x658a('0x3'));var logger=require(_0x658a('0x4'))(_0x658a('0x5'));var config=require(_0x658a('0x6'));var jayson=require(_0x658a('0x7'));var client=jayson[_0x658a('0x8')][_0x658a('0x9')]({'port':0x232a});config['redis']=_[_0x658a('0xa')](config[_0x658a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x658a('0xc'))(new Redis(config['redis']));require(_0x658a('0xd'))['register'](socket);function respondWithRpcPromise(_0x54cefb,_0x266a0d,_0x7ffa76){return new BPromise(function(_0x1502e0,_0x558368){return client[_0x658a('0xe')](_0x54cefb,_0x7ffa76)[_0x658a('0xf')](function(_0x482413){logger['info'](_0x658a('0x10'),_0x266a0d,_0x658a('0x11'));logger[_0x658a('0x12')](_0x658a('0x13'),_0x266a0d,_0x658a('0x11'),JSON['stringify'](_0x482413));if(_0x482413[_0x658a('0x14')]){if(_0x482413[_0x658a('0x14')][_0x658a('0x15')]===0x1f4){logger[_0x658a('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x266a0d,_0x482413[_0x658a('0x14')][_0x658a('0x16')]);return _0x558368(_0x482413['error']['message']);}logger[_0x658a('0x14')](_0x658a('0x10'),_0x266a0d,_0x482413[_0x658a('0x14')][_0x658a('0x16')]);return _0x1502e0(_0x482413[_0x658a('0x14')][_0x658a('0x16')]);}else{logger[_0x658a('0x17')](_0x658a('0x10'),_0x266a0d,_0x658a('0x11'));_0x1502e0(_0x482413[_0x658a('0x18')][_0x658a('0x16')]);}})['catch'](function(_0x3ee499){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x266a0d,_0x3ee499);_0x558368(_0x3ee499);});});}exports[_0x658a('0x19')]=function(_0x113238){var _0x15f4f1=this;return new Promise(function(_0x46e8e8,_0x46cbba){return db[_0x658a('0x1a')]['find']({'raw':_0x113238[_0x658a('0x1b')]?_0x113238[_0x658a('0x1b')][_0x658a('0x1c')]===undefined?!![]:![]:!![],'where':_0x113238['options']?_0x113238['options'][_0x658a('0x1d')]||null:null,'attributes':_0x113238[_0x658a('0x1b')]?_0x113238[_0x658a('0x1b')]['attributes']||null:null,'include':_0x113238['options']?_0x113238[_0x658a('0x1b')][_0x658a('0x1e')]?_[_0x658a('0x1f')](_0x113238[_0x658a('0x1b')][_0x658a('0x1e')],function(_0x15b16d){return{'model':db[_0x15b16d[_0x658a('0x20')]],'as':_0x15b16d['as'],'attributes':_0x15b16d['attributes'],'include':_0x15b16d[_0x658a('0x1e')]?_[_0x658a('0x1f')](_0x15b16d[_0x658a('0x1e')],function(_0x265127){return{'model':db[_0x265127[_0x658a('0x20')]],'as':_0x265127['as'],'attributes':_0x265127['attributes'],'include':_0x265127[_0x658a('0x1e')]?_[_0x658a('0x1f')](_0x265127[_0x658a('0x1e')],function(_0x2258c6){return{'model':db[_0x2258c6['model']],'as':_0x2258c6['as'],'attributes':_0x2258c6[_0x658a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x658a('0xf')](function(_0x3fa57b){logger[_0x658a('0x17')]('ShowWhatsappAccount',_0x113238);logger['debug']('ShowWhatsappAccount',_0x113238,JSON['stringify'](_0x3fa57b));_0x46e8e8(_0x3fa57b);})[_0x658a('0x22')](function(_0x1ee5aa){logger['error']('ShowWhatsappAccount',_0x1ee5aa[_0x658a('0x16')],_0x113238);_0x46cbba(_0x15f4f1[_0x658a('0x14')](0x1f4,_0x1ee5aa[_0x658a('0x16')]));});});}; \ No newline at end of file +var _0x3970=['message','result','ShowWhatsappAccount','WhatsappAccount','find','options','where','include','attributes','model','map','info','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x508a19,_0xba5af1){var _0x2b2393=function(_0x2c33a6){while(--_0x2c33a6){_0x508a19['push'](_0x508a19['shift']());}};_0x2b2393(++_0xba5af1);}(_0x3970,0x1d4));var _0x0397=function(_0x46451c,_0x88ddd){_0x46451c=_0x46451c-0x0;var _0x12dce4=_0x3970[_0x46451c];return _0x12dce4;};'use strict';var _=require(_0x0397('0x0'));var util=require(_0x0397('0x1'));var moment=require('moment');var BPromise=require(_0x0397('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0397('0x3'));var db=require(_0x0397('0x4'))['db'];var utils=require(_0x0397('0x5'));var logger=require(_0x0397('0x6'))(_0x0397('0x7'));var config=require('../../config/environment');var jayson=require(_0x0397('0x8'));var client=jayson[_0x0397('0x9')][_0x0397('0xa')]({'port':0x232a});config[_0x0397('0xb')]=_[_0x0397('0xc')](config[_0x0397('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0397('0xb')]));require(_0x0397('0xd'))[_0x0397('0xe')](socket);function respondWithRpcPromise(_0x4b87cf,_0x22566b,_0x43920f){return new BPromise(function(_0x418f47,_0x546324){return client[_0x0397('0xf')](_0x4b87cf,_0x43920f)[_0x0397('0x10')](function(_0xd10906){logger['info'](_0x0397('0x11'),_0x22566b,_0x0397('0x12'));logger[_0x0397('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x22566b,'request\x20sent',JSON[_0x0397('0x14')](_0xd10906));if(_0xd10906['error']){if(_0xd10906[_0x0397('0x15')]['code']===0x1f4){logger[_0x0397('0x15')](_0x0397('0x11'),_0x22566b,_0xd10906['error'][_0x0397('0x16')]);return _0x546324(_0xd10906[_0x0397('0x15')][_0x0397('0x16')]);}logger[_0x0397('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x22566b,_0xd10906['error'][_0x0397('0x16')]);return _0x418f47(_0xd10906[_0x0397('0x15')][_0x0397('0x16')]);}else{logger['info'](_0x0397('0x11'),_0x22566b,_0x0397('0x12'));_0x418f47(_0xd10906[_0x0397('0x17')]['message']);}})['catch'](function(_0x4a2150){logger['error'](_0x0397('0x11'),_0x22566b,_0x4a2150);_0x546324(_0x4a2150);});});}exports[_0x0397('0x18')]=function(_0x103f16){var _0x3dd49e=this;return new Promise(function(_0x11e9c8,_0x19040a){return db[_0x0397('0x19')][_0x0397('0x1a')]({'raw':_0x103f16[_0x0397('0x1b')]?_0x103f16[_0x0397('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x103f16[_0x0397('0x1b')]?_0x103f16[_0x0397('0x1b')][_0x0397('0x1c')]||null:null,'attributes':_0x103f16[_0x0397('0x1b')]?_0x103f16['options']['attributes']||null:null,'include':_0x103f16[_0x0397('0x1b')]?_0x103f16[_0x0397('0x1b')][_0x0397('0x1d')]?_['map'](_0x103f16[_0x0397('0x1b')][_0x0397('0x1d')],function(_0x2d921f){return{'model':db[_0x2d921f['model']],'as':_0x2d921f['as'],'attributes':_0x2d921f[_0x0397('0x1e')],'include':_0x2d921f[_0x0397('0x1d')]?_['map'](_0x2d921f[_0x0397('0x1d')],function(_0xf1fe30){return{'model':db[_0xf1fe30[_0x0397('0x1f')]],'as':_0xf1fe30['as'],'attributes':_0xf1fe30[_0x0397('0x1e')],'include':_0xf1fe30['include']?_[_0x0397('0x20')](_0xf1fe30[_0x0397('0x1d')],function(_0x4b96c1){return{'model':db[_0x4b96c1['model']],'as':_0x4b96c1['as'],'attributes':_0x4b96c1[_0x0397('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0397('0x10')](function(_0x4d13ab){logger[_0x0397('0x21')](_0x0397('0x18'),_0x103f16);logger[_0x0397('0x13')](_0x0397('0x18'),_0x103f16,JSON[_0x0397('0x14')](_0x4d13ab));_0x11e9c8(_0x4d13ab);})[_0x0397('0x22')](function(_0x1eec83){logger[_0x0397('0x15')](_0x0397('0x18'),_0x1eec83[_0x0397('0x16')],_0x103f16);_0x19040a(_0x3dd49e[_0x0397('0x15')](0x1f4,_0x1eec83['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 4ccbeaf..d875d1a 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 _0x9e92=['./whatsappAccount.events','remove','update','emit','length'];(function(_0x2cc077,_0x2c72aa){var _0x4a004d=function(_0x501f33){while(--_0x501f33){_0x2cc077['push'](_0x2cc077['shift']());}};_0x4a004d(++_0x2c72aa);}(_0x9e92,0x96));var _0x29e9=function(_0x36d0d1,_0x1bb408){_0x36d0d1=_0x36d0d1-0x0;var _0x2d4ae0=_0x9e92[_0x36d0d1];return _0x2d4ae0;};'use strict';var WhatsappAccountEvents=require(_0x29e9('0x0'));var events=['save',_0x29e9('0x1'),_0x29e9('0x2')];function createListener(_0x5ef429,_0x1bc70d){return function(_0x4b2c04){_0x1bc70d[_0x29e9('0x3')](_0x5ef429,_0x4b2c04);};}function removeListener(_0x25b8a6,_0x528eef){return function(){WhatsappAccountEvents['removeListener'](_0x25b8a6,_0x528eef);};}exports['register']=function(_0x196f43){for(var _0x4c1d3d=0x0,_0x4aed0d=events[_0x29e9('0x4')];_0x4c1d3d<_0x4aed0d;_0x4c1d3d++){var _0x146c6c=events[_0x4c1d3d];var _0x5c680d=createListener('whatsappAccount:'+_0x146c6c,_0x196f43);WhatsappAccountEvents['on'](_0x146c6c,_0x5c680d);}}; \ No newline at end of file +var _0x1ac1=['update','removeListener','register','length','whatsappAccount:','save','remove'];(function(_0xf54ea1,_0x3c6d9a){var _0x3b10a7=function(_0x109fa7){while(--_0x109fa7){_0xf54ea1['push'](_0xf54ea1['shift']());}};_0x3b10a7(++_0x3c6d9a);}(_0x1ac1,0xe5));var _0x11ac=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x1ac1[_0x9cfe28];return _0x54a1d0;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x11ac('0x0'),_0x11ac('0x1'),_0x11ac('0x2')];function createListener(_0x2f71af,_0xb583d2){return function(_0x2085f1){_0xb583d2['emit'](_0x2f71af,_0x2085f1);};}function removeListener(_0x4f0420,_0x5acc7a){return function(){WhatsappAccountEvents[_0x11ac('0x3')](_0x4f0420,_0x5acc7a);};}exports[_0x11ac('0x4')]=function(_0x230ba4){for(var _0x14c503=0x0,_0x5b9e58=events[_0x11ac('0x5')];_0x14c503<_0x5b9e58;_0x14c503++){var _0xbacef8=events[_0x14c503];var _0x3db5d=createListener(_0x11ac('0x6')+_0xbacef8,_0x230ba4);WhatsappAccountEvents['on'](_0xbacef8,_0x3db5d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 6b7631f..710dae9 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 _0x06a1=['fs-extra','../../config/environment','./whatsappApplication.controller','index','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','path','Router'];(function(_0x4eeaf4,_0x2e23b0){var _0x51b2ec=function(_0x5b362c){while(--_0x5b362c){_0x4eeaf4['push'](_0x4eeaf4['shift']());}};_0x51b2ec(++_0x2e23b0);}(_0x06a1,0xa7));var _0x106a=function(_0x569de1,_0x3d69fb){_0x569de1=_0x569de1-0x0;var _0x2755b1=_0x06a1[_0x569de1];return _0x2755b1;};'use strict';var multer=require('multer');var util=require(_0x106a('0x0'));var path=require(_0x106a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x106a('0x2')]();var fs_extra=require(_0x106a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x106a('0x4'));var controller=require(_0x106a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x106a('0x6')]);router[_0x106a('0x7')](_0x106a('0x8'),auth[_0x106a('0x9')](),controller[_0x106a('0xa')]);router['post']('/',auth[_0x106a('0x9')](),controller[_0x106a('0xb')]);router[_0x106a('0xc')](_0x106a('0x8'),auth[_0x106a('0x9')](),controller[_0x106a('0xd')]);router[_0x106a('0xe')](_0x106a('0x8'),auth[_0x106a('0x9')](),controller[_0x106a('0xf')]);module[_0x106a('0x10')]=router; \ No newline at end of file +var _0xf01b=['delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x1bf736,_0x39a528){var _0x2bffe1=function(_0x503b0f){while(--_0x503b0f){_0x1bf736['push'](_0x1bf736['shift']());}};_0x2bffe1(++_0x39a528);}(_0xf01b,0x1e8));var _0xbf01=function(_0xc817a7,_0x235e01){_0xc817a7=_0xc817a7-0x0;var _0x5c8426=_0xf01b[_0xc817a7];return _0x5c8426;};'use strict';var multer=require(_0xbf01('0x0'));var util=require(_0xbf01('0x1'));var path=require(_0xbf01('0x2'));var timeout=require(_0xbf01('0x3'));var express=require('express');var router=express[_0xbf01('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbf01('0x5'));var interaction=require(_0xbf01('0x6'));var config=require(_0xbf01('0x7'));var controller=require('./whatsappApplication.controller');router[_0xbf01('0x8')]('/',auth[_0xbf01('0x9')](),controller[_0xbf01('0xa')]);router[_0xbf01('0x8')](_0xbf01('0xb'),auth[_0xbf01('0x9')](),controller[_0xbf01('0xc')]);router[_0xbf01('0xd')]('/',auth[_0xbf01('0x9')](),controller['create']);router[_0xbf01('0xe')](_0xbf01('0xb'),auth['isAuthenticated'](),controller[_0xbf01('0xf')]);router[_0xbf01('0x10')](_0xbf01('0xb'),auth[_0xbf01('0x9')](),controller[_0xbf01('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ea311d2..4787301 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 _0x5c24=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x4c245f,_0x2bb619){var _0x4a2b5a=function(_0x5b1279){while(--_0x5b1279){_0x4c245f['push'](_0x4c245f['shift']());}};_0x4a2b5a(++_0x2bb619);}(_0x5c24,0x8a));var _0x45c2=function(_0xf84870,_0x4dc38f){_0xf84870=_0xf84870-0x0;var _0x4541a4=_0x5c24[_0xf84870];return _0x4541a4;};'use strict';var Sequelize=require(_0x45c2('0x0'));module[_0x45c2('0x1')]={'priority':{'type':Sequelize[_0x45c2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x45c2('0x3')],'allowNull':![],'defaultValue':_0x45c2('0x4')},'appdata':{'type':Sequelize[_0x45c2('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x45c2('0x3')],'defaultValue':_0x45c2('0x6')}}; \ No newline at end of file +var _0x176f=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x48add5,_0x2e728e){var _0x185448=function(_0x4bea78){while(--_0x4bea78){_0x48add5['push'](_0x48add5['shift']());}};_0x185448(++_0x2e728e);}(_0x176f,0x9b));var _0xf176=function(_0x552a8e,_0x56fac3){_0x552a8e=_0x552a8e-0x0;var _0x4fa3da=_0x176f[_0x552a8e];return _0x4fa3da;};'use strict';var Sequelize=require(_0xf176('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf176('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf176('0x2')},'appdata':{'type':Sequelize[_0xf176('0x3')]()},'description':{'type':Sequelize[_0xf176('0x4')]},'interval':{'type':Sequelize[_0xf176('0x4')],'defaultValue':_0xf176('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 40b8d1e..218e5dc 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 _0x4c4a=['WhatsappApplication','include','findAll','rows','catch','show','length','includeAll','options','find','create','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x1ee0e4,_0x32f7f9){_0x1ee0e4=_0x1ee0e4-0x0;var _0x530a6a=_0x4c4a[_0x1ee0e4];return _0x530a6a;};'use strict';var emlformat=require(_0xa4c4('0x0'));var rimraf=require(_0xa4c4('0x1'));var zipdir=require(_0xa4c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa4c4('0x3'));var moment=require(_0xa4c4('0x4'));var BPromise=require(_0xa4c4('0x5'));var Mustache=require(_0xa4c4('0x6'));var util=require('util');var path=require(_0xa4c4('0x7'));var sox=require('sox');var csv=require(_0xa4c4('0x8'));var ejs=require(_0xa4c4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa4c4('0xa'));var crypto=require('crypto');var jsforce=require(_0xa4c4('0xb'));var deskjs=require(_0xa4c4('0xc'));var toCsv=require(_0xa4c4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa4c4('0xd'));var authService=require(_0xa4c4('0xe'));var qs=require(_0xa4c4('0xf'));var as=require(_0xa4c4('0x10'));var hardwareService=require(_0xa4c4('0x11'));var logger=require('../../config/logger')(_0xa4c4('0x12'));var utils=require('../../config/utils');var config=require(_0xa4c4('0x13'));var licenseUtil=require(_0xa4c4('0x14'));var db=require(_0xa4c4('0x15'))['db'];function respondWithStatusCode(_0x2f6c71,_0x1d7750){_0x1d7750=_0x1d7750||0xcc;return function(_0x1f2051){if(_0x1f2051){return _0x2f6c71[_0xa4c4('0x16')](_0x1d7750);}return _0x2f6c71[_0xa4c4('0x17')](_0x1d7750)[_0xa4c4('0x18')]();};}function respondWithResult(_0x57ae15,_0x1abded){_0x1abded=_0x1abded||0xc8;return function(_0x35cc1f){if(_0x35cc1f){return _0x57ae15[_0xa4c4('0x17')](_0x1abded)[_0xa4c4('0x19')](_0x35cc1f);}};}function respondWithFilteredResult(_0x14a55c,_0x19033a){return function(_0x31cde0){if(_0x31cde0){var _0x5e8006=typeof _0x19033a[_0xa4c4('0x1a')]===_0xa4c4('0x1b')&&typeof _0x19033a['limit']===_0xa4c4('0x1b');var _0x451dfa=_0x31cde0[_0xa4c4('0x1c')];var _0x5f5ef=_0x5e8006?0x0:_0x19033a[_0xa4c4('0x1a')];var _0x40661e=_0x5e8006?_0x31cde0[_0xa4c4('0x1c')]:_0x19033a[_0xa4c4('0x1a')]+_0x19033a[_0xa4c4('0x1d')];var _0x157143;if(_0x40661e>=_0x451dfa){_0x40661e=_0x451dfa;_0x157143=0xc8;}else{_0x157143=0xce;}_0x14a55c[_0xa4c4('0x17')](_0x157143);return _0x14a55c[_0xa4c4('0x1e')](_0xa4c4('0x1f'),_0x5f5ef+'-'+_0x40661e+'/'+_0x451dfa)[_0xa4c4('0x19')](_0x31cde0);}return null;};}function patchUpdates(_0x19e17e){return function(_0x167502){try{jsonpatch[_0xa4c4('0x20')](_0x167502,_0x19e17e,!![]);}catch(_0x3cb3a7){return BPromise[_0xa4c4('0x21')](_0x3cb3a7);}return _0x167502['save']();};}function saveUpdates(_0x4e0249,_0x183bdf){return function(_0x3aa9a8){if(_0x3aa9a8){return _0x3aa9a8[_0xa4c4('0x22')](_0x4e0249)[_0xa4c4('0x23')](function(_0xd56b75){return _0xd56b75;});}return null;};}function removeEntity(_0x76b8f1,_0x5f1215){return function(_0x568b6a){if(_0x568b6a){return _0x568b6a['destroy']()[_0xa4c4('0x23')](function(){_0x76b8f1[_0xa4c4('0x17')](0xcc)[_0xa4c4('0x18')]();});}};}function handleEntityNotFound(_0x50bb08,_0x295c57){return function(_0x41f1ac){if(!_0x41f1ac){_0x50bb08[_0xa4c4('0x16')](0x194);}return _0x41f1ac;};}function handleError(_0x48a503,_0x40435d){_0x40435d=_0x40435d||0x1f4;return function(_0xfa33ec){logger[_0xa4c4('0x24')](_0xfa33ec[_0xa4c4('0x25')]);if(_0xfa33ec[_0xa4c4('0x26')]){delete _0xfa33ec['name'];}_0x48a503[_0xa4c4('0x17')](_0x40435d)[_0xa4c4('0x27')](_0xfa33ec);};}exports[_0xa4c4('0x28')]=function(_0x425fd8,_0x182335){var _0x5c3b3b={},_0x32af71={},_0x5688a6={'count':0x0,'rows':[]};var _0x4abddc=_['map'](db['WhatsappApplication'][_0xa4c4('0x29')],function(_0x1d852b){return{'name':_0x1d852b[_0xa4c4('0x2a')],'type':_0x1d852b[_0xa4c4('0x2b')][_0xa4c4('0x2c')]};});_0x32af71['model']=_['map'](_0x4abddc,'name');_0x32af71[_0xa4c4('0x2d')]=_[_0xa4c4('0x2e')](_0x425fd8['query']);_0x32af71[_0xa4c4('0x2f')]=_[_0xa4c4('0x30')](_0x32af71['model'],_0x32af71[_0xa4c4('0x2d')]);_0x5c3b3b[_0xa4c4('0x31')]=_['intersection'](_0x32af71[_0xa4c4('0x32')],qs[_0xa4c4('0x33')](_0x425fd8[_0xa4c4('0x2d')][_0xa4c4('0x33')]));_0x5c3b3b[_0xa4c4('0x31')]=_0x5c3b3b[_0xa4c4('0x31')]['length']?_0x5c3b3b[_0xa4c4('0x31')]:_0x32af71[_0xa4c4('0x32')];if(!_0x425fd8[_0xa4c4('0x2d')][_0xa4c4('0x34')](_0xa4c4('0x35'))){_0x5c3b3b[_0xa4c4('0x1d')]=qs[_0xa4c4('0x1d')](_0x425fd8[_0xa4c4('0x2d')]['limit']);_0x5c3b3b[_0xa4c4('0x1a')]=qs['offset'](_0x425fd8[_0xa4c4('0x2d')][_0xa4c4('0x1a')]);}_0x5c3b3b['order']=qs[_0xa4c4('0x36')](_0x425fd8[_0xa4c4('0x2d')][_0xa4c4('0x36')]);_0x5c3b3b[_0xa4c4('0x37')]=qs[_0xa4c4('0x2f')](_[_0xa4c4('0x38')](_0x425fd8['query'],_0x32af71[_0xa4c4('0x2f')]),_0x4abddc);if(_0x425fd8[_0xa4c4('0x2d')]['filter']){_0x5c3b3b[_0xa4c4('0x37')]=_[_0xa4c4('0x39')](_0x5c3b3b[_0xa4c4('0x37')],{'$or':_[_0xa4c4('0x3a')](_0x4abddc,function(_0x3193f8){if(_0x3193f8[_0xa4c4('0x2b')]!==_0xa4c4('0x3b')){var _0x2b9c17={};_0x2b9c17[_0x3193f8[_0xa4c4('0x26')]]={'$like':'%'+_0x425fd8[_0xa4c4('0x2d')][_0xa4c4('0x3c')]+'%'};return _0x2b9c17;}})});}_0x5c3b3b=_[_0xa4c4('0x39')]({},_0x5c3b3b,_0x425fd8['options']);var _0x2b02e0={'where':_0x5c3b3b[_0xa4c4('0x37')]};return db[_0xa4c4('0x3d')][_0xa4c4('0x1c')](_0x2b02e0)['then'](function(_0x588777){_0x5688a6['count']=_0x588777;if(_0x425fd8[_0xa4c4('0x2d')]['includeAll']){_0x5c3b3b[_0xa4c4('0x3e')]=[{'all':!![]}];}return db[_0xa4c4('0x3d')][_0xa4c4('0x3f')](_0x5c3b3b);})[_0xa4c4('0x23')](function(_0x379b5a){_0x5688a6[_0xa4c4('0x40')]=_0x379b5a;return _0x5688a6;})[_0xa4c4('0x23')](respondWithFilteredResult(_0x182335,_0x5c3b3b))[_0xa4c4('0x41')](handleError(_0x182335,null));};exports[_0xa4c4('0x42')]=function(_0x2a6e06,_0x4b6136){var _0x1c00b6={'raw':!![],'where':{'id':_0x2a6e06['params']['id']}},_0x7fea70={};_0x7fea70[_0xa4c4('0x32')]=_[_0xa4c4('0x2e')](db[_0xa4c4('0x3d')][_0xa4c4('0x29')]);_0x7fea70[_0xa4c4('0x2d')]=_[_0xa4c4('0x2e')](_0x2a6e06[_0xa4c4('0x2d')]);_0x7fea70['filters']=_[_0xa4c4('0x30')](_0x7fea70[_0xa4c4('0x32')],_0x7fea70[_0xa4c4('0x2d')]);_0x1c00b6[_0xa4c4('0x31')]=_[_0xa4c4('0x30')](_0x7fea70[_0xa4c4('0x32')],qs[_0xa4c4('0x33')](_0x2a6e06[_0xa4c4('0x2d')][_0xa4c4('0x33')]));_0x1c00b6[_0xa4c4('0x31')]=_0x1c00b6['attributes'][_0xa4c4('0x43')]?_0x1c00b6['attributes']:_0x7fea70[_0xa4c4('0x32')];if(_0x2a6e06[_0xa4c4('0x2d')][_0xa4c4('0x44')]){_0x1c00b6['include']=[{'all':!![]}];}_0x1c00b6=_[_0xa4c4('0x39')]({},_0x1c00b6,_0x2a6e06[_0xa4c4('0x45')]);return db[_0xa4c4('0x3d')][_0xa4c4('0x46')](_0x1c00b6)[_0xa4c4('0x23')](handleEntityNotFound(_0x4b6136,null))[_0xa4c4('0x23')](respondWithResult(_0x4b6136,null))[_0xa4c4('0x41')](handleError(_0x4b6136,null));};exports[_0xa4c4('0x47')]=function(_0x1157ff,_0x381092){return db[_0xa4c4('0x3d')][_0xa4c4('0x47')](_0x1157ff[_0xa4c4('0x48')],{})[_0xa4c4('0x23')](respondWithResult(_0x381092,0xc9))[_0xa4c4('0x41')](handleError(_0x381092,null));};exports[_0xa4c4('0x22')]=function(_0x197e84,_0x835f73){if(_0x197e84[_0xa4c4('0x48')]['id']){delete _0x197e84[_0xa4c4('0x48')]['id'];}return db[_0xa4c4('0x3d')]['find']({'where':{'id':_0x197e84[_0xa4c4('0x49')]['id']}})[_0xa4c4('0x23')](handleEntityNotFound(_0x835f73,null))['then'](saveUpdates(_0x197e84[_0xa4c4('0x48')],null))['then'](respondWithResult(_0x835f73,null))['catch'](handleError(_0x835f73,null));};exports[_0xa4c4('0x4a')]=function(_0xb812e5,_0x187cc0){return db[_0xa4c4('0x3d')][_0xa4c4('0x46')]({'where':{'id':_0xb812e5[_0xa4c4('0x49')]['id']}})[_0xa4c4('0x23')](handleEntityNotFound(_0x187cc0,null))[_0xa4c4('0x23')](removeEntity(_0x187cc0,null))[_0xa4c4('0x41')](handleError(_0x187cc0,null));}; \ No newline at end of file +var _0x078a=['fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir'];(function(_0x24b6fc,_0x554082){var _0x217232=function(_0x346e7c){while(--_0x346e7c){_0x24b6fc['push'](_0x24b6fc['shift']());}};_0x217232(++_0x554082);}(_0x078a,0x12d));var _0xa078=function(_0x1967a1,_0x547957){_0x1967a1=_0x1967a1-0x0;var _0x1fdff0=_0x078a[_0x1967a1];return _0x1fdff0;};'use strict';var emlformat=require(_0xa078('0x0'));var rimraf=require(_0xa078('0x1'));var zipdir=require(_0xa078('0x2'));var jsonpatch=require(_0xa078('0x3'));var rp=require(_0xa078('0x4'));var moment=require(_0xa078('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa078('0x6'));var util=require(_0xa078('0x7'));var path=require(_0xa078('0x8'));var sox=require('sox');var csv=require(_0xa078('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa078('0xa'));var _=require(_0xa078('0xb'));var squel=require(_0xa078('0xc'));var crypto=require(_0xa078('0xd'));var jsforce=require(_0xa078('0xe'));var deskjs=require(_0xa078('0xf'));var toCsv=require(_0xa078('0x9'));var querystring=require(_0xa078('0x10'));var Papa=require('papaparse');var Redis=require(_0xa078('0x11'));var authService=require(_0xa078('0x12'));var qs=require(_0xa078('0x13'));var as=require(_0xa078('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa078('0x15'))(_0xa078('0x16'));var utils=require(_0xa078('0x17'));var config=require(_0xa078('0x18'));var licenseUtil=require(_0xa078('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31efe8,_0x23e314){_0x23e314=_0x23e314||0xcc;return function(_0x3e1d0a){if(_0x3e1d0a){return _0x31efe8[_0xa078('0x1a')](_0x23e314);}return _0x31efe8[_0xa078('0x1b')](_0x23e314)[_0xa078('0x1c')]();};}function respondWithResult(_0x43064b,_0x214106){_0x214106=_0x214106||0xc8;return function(_0x162163){if(_0x162163){return _0x43064b[_0xa078('0x1b')](_0x214106)[_0xa078('0x1d')](_0x162163);}};}function respondWithFilteredResult(_0x195ed7,_0x4fee95){return function(_0x3a24f8){if(_0x3a24f8){var _0x410ff9=typeof _0x4fee95[_0xa078('0x1e')]==='undefined'&&typeof _0x4fee95[_0xa078('0x1f')]===_0xa078('0x20');var _0x5da909=_0x3a24f8[_0xa078('0x21')];var _0xde9c46=_0x410ff9?0x0:_0x4fee95[_0xa078('0x1e')];var _0x5943ca=_0x410ff9?_0x3a24f8[_0xa078('0x21')]:_0x4fee95[_0xa078('0x1e')]+_0x4fee95[_0xa078('0x1f')];var _0x24f9a1;if(_0x5943ca>=_0x5da909){_0x5943ca=_0x5da909;_0x24f9a1=0xc8;}else{_0x24f9a1=0xce;}_0x195ed7[_0xa078('0x1b')](_0x24f9a1);return _0x195ed7[_0xa078('0x22')]('Content-Range',_0xde9c46+'-'+_0x5943ca+'/'+_0x5da909)['json'](_0x3a24f8);}return null;};}function patchUpdates(_0x240a5f){return function(_0x4a19f1){try{jsonpatch[_0xa078('0x23')](_0x4a19f1,_0x240a5f,!![]);}catch(_0x1023eb){return BPromise[_0xa078('0x24')](_0x1023eb);}return _0x4a19f1[_0xa078('0x25')]();};}function saveUpdates(_0x262134,_0x3af3e6){return function(_0x59577c){if(_0x59577c){return _0x59577c[_0xa078('0x26')](_0x262134)['then'](function(_0x5b05e3){return _0x5b05e3;});}return null;};}function removeEntity(_0x17d034,_0x20a368){return function(_0x5b7278){if(_0x5b7278){return _0x5b7278['destroy']()[_0xa078('0x27')](function(){_0x17d034[_0xa078('0x1b')](0xcc)[_0xa078('0x1c')]();});}};}function handleEntityNotFound(_0x262b22,_0x52d202){return function(_0x3b746a){if(!_0x3b746a){_0x262b22[_0xa078('0x1a')](0x194);}return _0x3b746a;};}function handleError(_0x550560,_0xeb5d3d){_0xeb5d3d=_0xeb5d3d||0x1f4;return function(_0x4596ca){logger[_0xa078('0x28')](_0x4596ca[_0xa078('0x29')]);if(_0x4596ca[_0xa078('0x2a')]){delete _0x4596ca[_0xa078('0x2a')];}_0x550560[_0xa078('0x1b')](_0xeb5d3d)[_0xa078('0x2b')](_0x4596ca);};}exports[_0xa078('0x2c')]=function(_0x18d6b2,_0x308085){var _0x5ae5ac={},_0x2e2199={},_0x2c972e={'count':0x0,'rows':[]};var _0x1fee4d=_[_0xa078('0x2d')](db[_0xa078('0x2e')][_0xa078('0x2f')],function(_0x5cd3d6){return{'name':_0x5cd3d6[_0xa078('0x30')],'type':_0x5cd3d6['type'][_0xa078('0x31')]};});_0x2e2199[_0xa078('0x32')]=_[_0xa078('0x2d')](_0x1fee4d,_0xa078('0x2a'));_0x2e2199['query']=_[_0xa078('0x33')](_0x18d6b2[_0xa078('0x34')]);_0x2e2199[_0xa078('0x35')]=_[_0xa078('0x36')](_0x2e2199[_0xa078('0x32')],_0x2e2199['query']);_0x5ae5ac['attributes']=_[_0xa078('0x36')](_0x2e2199[_0xa078('0x32')],qs['fields'](_0x18d6b2[_0xa078('0x34')][_0xa078('0x37')]));_0x5ae5ac['attributes']=_0x5ae5ac[_0xa078('0x38')][_0xa078('0x39')]?_0x5ae5ac[_0xa078('0x38')]:_0x2e2199[_0xa078('0x32')];if(!_0x18d6b2[_0xa078('0x34')][_0xa078('0x3a')](_0xa078('0x3b'))){_0x5ae5ac[_0xa078('0x1f')]=qs['limit'](_0x18d6b2[_0xa078('0x34')][_0xa078('0x1f')]);_0x5ae5ac['offset']=qs[_0xa078('0x1e')](_0x18d6b2['query']['offset']);}_0x5ae5ac['order']=qs['sort'](_0x18d6b2[_0xa078('0x34')]['sort']);_0x5ae5ac[_0xa078('0x3c')]=qs[_0xa078('0x35')](_['pick'](_0x18d6b2[_0xa078('0x34')],_0x2e2199[_0xa078('0x35')]),_0x1fee4d);if(_0x18d6b2[_0xa078('0x34')]['filter']){_0x5ae5ac[_0xa078('0x3c')]=_[_0xa078('0x3d')](_0x5ae5ac[_0xa078('0x3c')],{'$or':_[_0xa078('0x2d')](_0x1fee4d,function(_0x51bcc2){if(_0x51bcc2[_0xa078('0x3e')]!==_0xa078('0x3f')){var _0x103179={};_0x103179[_0x51bcc2[_0xa078('0x2a')]]={'$like':'%'+_0x18d6b2[_0xa078('0x34')]['filter']+'%'};return _0x103179;}})});}_0x5ae5ac=_['merge']({},_0x5ae5ac,_0x18d6b2[_0xa078('0x40')]);var _0x3dda89={'where':_0x5ae5ac[_0xa078('0x3c')]};return db[_0xa078('0x2e')]['count'](_0x3dda89)[_0xa078('0x27')](function(_0x29a8e2){_0x2c972e[_0xa078('0x21')]=_0x29a8e2;if(_0x18d6b2[_0xa078('0x34')][_0xa078('0x41')]){_0x5ae5ac[_0xa078('0x42')]=[{'all':!![]}];}return db[_0xa078('0x2e')][_0xa078('0x43')](_0x5ae5ac);})[_0xa078('0x27')](function(_0x365407){_0x2c972e[_0xa078('0x44')]=_0x365407;return _0x2c972e;})[_0xa078('0x27')](respondWithFilteredResult(_0x308085,_0x5ae5ac))[_0xa078('0x45')](handleError(_0x308085,null));};exports[_0xa078('0x46')]=function(_0x374420,_0x157317){var _0xc85e1b={'raw':!![],'where':{'id':_0x374420[_0xa078('0x47')]['id']}},_0x306144={};_0x306144['model']=_[_0xa078('0x33')](db[_0xa078('0x2e')][_0xa078('0x2f')]);_0x306144[_0xa078('0x34')]=_[_0xa078('0x33')](_0x374420[_0xa078('0x34')]);_0x306144[_0xa078('0x35')]=_[_0xa078('0x36')](_0x306144[_0xa078('0x32')],_0x306144[_0xa078('0x34')]);_0xc85e1b['attributes']=_[_0xa078('0x36')](_0x306144[_0xa078('0x32')],qs[_0xa078('0x37')](_0x374420[_0xa078('0x34')][_0xa078('0x37')]));_0xc85e1b[_0xa078('0x38')]=_0xc85e1b[_0xa078('0x38')]['length']?_0xc85e1b[_0xa078('0x38')]:_0x306144['model'];if(_0x374420[_0xa078('0x34')][_0xa078('0x41')]){_0xc85e1b['include']=[{'all':!![]}];}_0xc85e1b=_[_0xa078('0x3d')]({},_0xc85e1b,_0x374420[_0xa078('0x40')]);return db[_0xa078('0x2e')][_0xa078('0x48')](_0xc85e1b)[_0xa078('0x27')](handleEntityNotFound(_0x157317,null))['then'](respondWithResult(_0x157317,null))['catch'](handleError(_0x157317,null));};exports[_0xa078('0x49')]=function(_0x38eeb1,_0x4f685f){return db[_0xa078('0x2e')][_0xa078('0x49')](_0x38eeb1['body'],{})[_0xa078('0x27')](respondWithResult(_0x4f685f,0xc9))[_0xa078('0x45')](handleError(_0x4f685f,null));};exports[_0xa078('0x26')]=function(_0x4bf214,_0x1c386f){if(_0x4bf214[_0xa078('0x4a')]['id']){delete _0x4bf214[_0xa078('0x4a')]['id'];}return db[_0xa078('0x2e')][_0xa078('0x48')]({'where':{'id':_0x4bf214[_0xa078('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c386f,null))[_0xa078('0x27')](saveUpdates(_0x4bf214[_0xa078('0x4a')],null))['then'](respondWithResult(_0x1c386f,null))['catch'](handleError(_0x1c386f,null));};exports[_0xa078('0x4b')]=function(_0x2c941d,_0x2c3b45){return db['WhatsappApplication'][_0xa078('0x48')]({'where':{'id':_0x2c941d[_0xa078('0x47')]['id']}})[_0xa078('0x27')](handleEntityNotFound(_0x2c3b45,null))['then'](removeEntity(_0x2c3b45,null))['catch'](handleError(_0x2c3b45,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 45f87cc..88cffb8 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 _0xfd2f=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','utf8mb4'];(function(_0xd550b6,_0x1455ef){var _0xeacecb=function(_0x340fea){while(--_0x340fea){_0xd550b6['push'](_0xd550b6['shift']());}};_0xeacecb(++_0x1455ef);}(_0xfd2f,0x14a));var _0xffd2=function(_0x2a5263,_0x3c9ad5){_0x2a5263=_0x2a5263-0x0;var _0x25a05c=_0xfd2f[_0x2a5263];return _0x25a05c;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var logger=require(_0xffd2('0x2'))('api');var moment=require(_0xffd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xffd2('0x4'));var fs=require('fs');var path=require(_0xffd2('0x5'));var rimraf=require('rimraf');var config=require(_0xffd2('0x6'));var attributes=require(_0xffd2('0x7'));module['exports']=function(_0x5955d2,_0x490a28){return _0x5955d2[_0xffd2('0x8')](_0xffd2('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xffd2('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcb66=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb66,0x19f));var _0x6cb6=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcb66[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x6cb6('0x0'));var logger=require(_0x6cb6('0x1'))(_0x6cb6('0x2'));var moment=require(_0x6cb6('0x3'));var BPromise=require(_0x6cb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cb6('0x5'));var rimraf=require(_0x6cb6('0x6'));var config=require(_0x6cb6('0x7'));var attributes=require(_0x6cb6('0x8'));module[_0x6cb6('0x9')]=function(_0x506d14,_0x53078d){return _0x506d14[_0x6cb6('0xa')](_0x6cb6('0xb'),attributes,{'tableName':_0x6cb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6cb6('0xd'),'collate':_0x6cb6('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index e2f1cc9..ce86811 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 _0x5c12=['../../config/environment','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0x5c12,0x188));var _0x25c1=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x5c12[_0x3b3cc6];return _0x1161e4;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382922,_0x4ab674,_0x5c69b1){return new BPromise(function(_0x24981c,_0x3b69ba){return client[_0x25c1('0xb')](_0x382922,_0x5c69b1)[_0x25c1('0xc')](function(_0xf8363f){logger['info'](_0x25c1('0xd'),_0x4ab674,_0x25c1('0xe'));logger[_0x25c1('0xf')](_0x25c1('0x10'),_0x4ab674,_0x25c1('0xe'),JSON['stringify'](_0xf8363f));if(_0xf8363f[_0x25c1('0x11')]){if(_0xf8363f[_0x25c1('0x11')]['code']===0x1f4){logger[_0x25c1('0x11')](_0x25c1('0xd'),_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x3b69ba(_0xf8363f['error']['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x24981c(_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);}else{logger[_0x25c1('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0x25c1('0xe'));_0x24981c(_0xf8363f['result']['message']);}})['catch'](function(_0x284712){logger[_0x25c1('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0x284712);_0x3b69ba(_0x284712);});});} \ No newline at end of file +var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x41296f,_0x4c1ffb){var _0x160a49=function(_0x16145a){while(--_0x16145a){_0x41296f['push'](_0x41296f['shift']());}};_0x160a49(++_0x4c1ffb);}(_0x54ef,0x112));var _0xf54e=function(_0x55f55f,_0x8faa09){_0x55f55f=_0x55f55f-0x0;var _0x23e269=_0x54ef[_0x55f55f];return _0x23e269;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 901a907..93efff5 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 _0xb46f=['index','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','create','tracked','whatsappinteraction:addtags','addTags','put','/:id','whatsapp','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x835f07,_0x4abebe){var _0x32b50f=function(_0x212d05){while(--_0x212d05){_0x835f07['push'](_0x835f07['shift']());}};_0x32b50f(++_0x4abebe);}(_0xb46f,0xb6));var _0xfb46=function(_0x208a70,_0x5419dd){_0x208a70=_0x208a70-0x0;var _0x1dbdbb=_0xb46f[_0x208a70];return _0x1dbdbb;};'use strict';var multer=require(_0xfb46('0x0'));var util=require(_0xfb46('0x1'));var path=require('path');var timeout=require(_0xfb46('0x2'));var express=require(_0xfb46('0x3'));var router=express[_0xfb46('0x4')]();var fs_extra=require(_0xfb46('0x5'));var auth=require(_0xfb46('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb46('0x7'));var controller=require('./whatsappInteraction.controller');router[_0xfb46('0x8')]('/',auth[_0xfb46('0x9')](),controller[_0xfb46('0xa')]);router[_0xfb46('0x8')](_0xfb46('0xb'),auth['isAuthenticated'](),controller[_0xfb46('0xc')]);router[_0xfb46('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xfb46('0xd'),auth['isAuthenticated'](),controller[_0xfb46('0xe')]);router[_0xfb46('0x8')](_0xfb46('0xf'),auth[_0xfb46('0x9')](),controller[_0xfb46('0x10')]);router[_0xfb46('0x11')]('/',auth[_0xfb46('0x9')](),controller[_0xfb46('0x12')]);router[_0xfb46('0x11')](_0xfb46('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0xfb46('0x11')]('/:id/tags',auth[_0xfb46('0x9')](),interaction[_0xfb46('0x13')]('whatsapp',_0xfb46('0x14')),controller[_0xfb46('0x15')]);router[_0xfb46('0x16')](_0xfb46('0x17'),auth['isAuthenticated'](),interaction[_0xfb46('0x13')](_0xfb46('0x18'),_0xfb46('0x19')),controller['update']);router[_0xfb46('0x1a')](_0xfb46('0x17'),auth['isAuthenticated'](),interaction['tracked'](_0xfb46('0x18'),_0xfb46('0x1b')),controller[_0xfb46('0x1c')]);router[_0xfb46('0x1a')](_0xfb46('0x1d'),auth[_0xfb46('0x9')](),controller[_0xfb46('0x1e')]);module[_0xfb46('0x1f')]=router; \ No newline at end of file +var _0x8b8e=['whatsappinteraction:destroy','removeTags','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','put','/:id','whatsapp','whatsappinteraction:update','update','delete'];(function(_0x43bb4e,_0x45c6cc){var _0x5b8df7=function(_0xb6b0b3){while(--_0xb6b0b3){_0x43bb4e['push'](_0x43bb4e['shift']());}};_0x5b8df7(++_0x45c6cc);}(_0x8b8e,0x108));var _0xe8b8=function(_0x56102f,_0x51bfc3){_0x56102f=_0x56102f-0x0;var _0x56f783=_0x8b8e[_0x56102f];return _0x56f783;};'use strict';var multer=require(_0xe8b8('0x0'));var util=require('util');var path=require(_0xe8b8('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8b8('0x3'));var interaction=require(_0xe8b8('0x4'));var config=require(_0xe8b8('0x5'));var controller=require(_0xe8b8('0x6'));router[_0xe8b8('0x7')]('/',auth[_0xe8b8('0x8')](),controller[_0xe8b8('0x9')]);router[_0xe8b8('0x7')](_0xe8b8('0xa'),auth[_0xe8b8('0x8')](),controller['describe']);router[_0xe8b8('0x7')]('/:id',auth[_0xe8b8('0x8')](),controller['show']);router['get'](_0xe8b8('0xb'),auth[_0xe8b8('0x8')](),controller['getMessages']);router['get'](_0xe8b8('0xc'),auth[_0xe8b8('0x8')](),controller[_0xe8b8('0xd')]);router[_0xe8b8('0xe')]('/',auth[_0xe8b8('0x8')](),controller[_0xe8b8('0xf')]);router[_0xe8b8('0xe')](_0xe8b8('0xb'),auth[_0xe8b8('0x8')](),controller[_0xe8b8('0x10')]);router[_0xe8b8('0xe')](_0xe8b8('0x11'),auth[_0xe8b8('0x8')](),interaction[_0xe8b8('0x12')]('whatsapp',_0xe8b8('0x13')),controller['addTags']);router[_0xe8b8('0x14')](_0xe8b8('0x15'),auth[_0xe8b8('0x8')](),interaction[_0xe8b8('0x12')](_0xe8b8('0x16'),_0xe8b8('0x17')),controller[_0xe8b8('0x18')]);router[_0xe8b8('0x19')](_0xe8b8('0x15'),auth[_0xe8b8('0x8')](),interaction['tracked'](_0xe8b8('0x16'),_0xe8b8('0x1a')),controller['destroy']);router[_0xe8b8('0x19')](_0xe8b8('0x11'),auth[_0xe8b8('0x8')](),controller[_0xe8b8('0x1b')]);module[_0xe8b8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index a83acb9..8e092ca 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 _0xd8a5=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0xdcc881,_0x56436b){var _0x1dfeca=function(_0x1b7c0b){while(--_0x1b7c0b){_0xdcc881['push'](_0xdcc881['shift']());}};_0x1dfeca(++_0x56436b);}(_0xd8a5,0x160));var _0x5d8a=function(_0x581f18,_0x2746dd){_0x581f18=_0x581f18-0x0;var _0x38e94d=_0xd8a5[_0x581f18];return _0x38e94d;};'use strict';var Sequelize=require(_0x5d8a('0x0'));var moment=require('moment');module[_0x5d8a('0x1')]={'closed':{'type':Sequelize[_0x5d8a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5d8a('0x3')]},'secondDisposition':{'type':Sequelize[_0x5d8a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5d8a('0x3')]},'note':{'type':Sequelize[_0x5d8a('0x3')]},'phone':{'type':Sequelize[_0x5d8a('0x3')]},'read1stAt':{'type':Sequelize[_0x5d8a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x5d8a('0x5')]('in',_0x5d8a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5d8a('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x5d8a('0x5')]('in',_0x5d8a('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5d8a('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x5577=['out','ENUM','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x24fe37,_0x51d16a){var _0x420dfe=function(_0x13afae){while(--_0x13afae){_0x24fe37['push'](_0x24fe37['shift']());}};_0x420dfe(++_0x51d16a);}(_0x5577,0x1b4));var _0x7557=function(_0x3d8597,_0x1a4f3a){_0x3d8597=_0x3d8597-0x0;var _0x2cfbcc=_0x5577[_0x3d8597];return _0x2cfbcc;};'use strict';var Sequelize=require(_0x7557('0x0'));var moment=require('moment');module[_0x7557('0x1')]={'closed':{'type':Sequelize[_0x7557('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7557('0x3')]},'secondDisposition':{'type':Sequelize[_0x7557('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7557('0x3')]},'note':{'type':Sequelize[_0x7557('0x3')]},'phone':{'type':Sequelize[_0x7557('0x3')]},'read1stAt':{'type':Sequelize[_0x7557('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7557('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7557('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7557('0x6')]('in',_0x7557('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7557('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index f8d60a0..95079c2 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 _0xe4ea=['server','files','tmp','root','push','User','fullname','Contact','firstName','lastName','Attachment','createdAt','read','WhatsappAccount','Account','Owner','get','mkdirSync','closed','disposition','basename','existsSync','createReadStream','pipe','out','System','direction','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','err','unlinkSync','sendStatus','rimraf','bluebird','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','catch','show','params','model','keys','WhatsappInteraction','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','WhatsappMessage','addMessage','omit','ids','getMessages','findOne','order','sort','where','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','toString','join'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xe4ea,0x18e));var _0xae4e=function(_0xb011c4,_0x18bcba){_0xb011c4=_0xb011c4-0x0;var _0x3ce7b8=_0xe4ea[_0xb011c4];return _0x3ce7b8;};'use strict';var rimraf=require(_0xae4e('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xae4e('0x1'));var util=require('util');var path=require('path');var ejs=require(_0xae4e('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xae4e('0x3'));var interaction=require(_0xae4e('0x4'));var qs=require('../../components/parsers/qs');var pdf=require(_0xae4e('0x5'));var logger=require(_0xae4e('0x6'))(_0xae4e('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xae4e('0x8')]=_[_0xae4e('0x9')](config['redis'],{'host':_0xae4e('0xa'),'port':0x18eb});var socket=require(_0xae4e('0xb'))(new Redis(config['redis']));require(_0xae4e('0xc'))[_0xae4e('0xd')](socket);function respondWithStatusCode(_0x5c5421,_0x3cd696){_0x3cd696=_0x3cd696||0xcc;return function(_0x646605){if(_0x646605){return _0x5c5421['sendStatus'](_0x3cd696);}return _0x5c5421[_0xae4e('0xe')](_0x3cd696)[_0xae4e('0xf')]();};}function respondWithResult(_0x1b724d,_0x1fecd4){_0x1fecd4=_0x1fecd4||0xc8;return function(_0x3d2b3f){if(_0x3d2b3f){return _0x1b724d[_0xae4e('0xe')](_0x1fecd4)[_0xae4e('0x10')](_0x3d2b3f);}};}function respondWithFilteredResult(_0x52bca0,_0x1bc512){return function(_0x51c487){if(_0x51c487){var _0x48a350=typeof _0x1bc512[_0xae4e('0x11')]===_0xae4e('0x12')&&typeof _0x1bc512['limit']==='undefined';var _0x40acea=_0x51c487[_0xae4e('0x13')];var _0x300a90=_0x48a350?0x0:_0x1bc512['offset'];var _0x3cbabf=_0x48a350?_0x51c487['count']:_0x1bc512[_0xae4e('0x11')]+_0x1bc512[_0xae4e('0x14')];var _0x15bfdd;if(_0x3cbabf>=_0x40acea){_0x3cbabf=_0x40acea;_0x15bfdd=0xc8;}else{_0x15bfdd=0xce;}_0x52bca0[_0xae4e('0xe')](_0x15bfdd);return _0x52bca0[_0xae4e('0x15')](_0xae4e('0x16'),_0x300a90+'-'+_0x3cbabf+'/'+_0x40acea)['json'](_0x51c487);}return null;};}function saveUpdates(_0x41a96a){return function(_0x5f4108){if(_0x5f4108){return _0x5f4108[_0xae4e('0x17')](_0x41a96a)[_0xae4e('0x18')](function(_0xc86bec){return _0xc86bec;});}return null;};}function removeEntity(_0x50e6db){return function(_0x2e2d7b){if(_0x2e2d7b){return _0x2e2d7b[_0xae4e('0x19')]()['then'](function(){_0x50e6db[_0xae4e('0xe')](0xcc)[_0xae4e('0xf')]();});}};}function handleEntityNotFound(_0x3f6919){return function(_0x5a7271){if(!_0x5a7271){_0x3f6919['sendStatus'](0x194);}return _0x5a7271;};}function handleError(_0x30a669,_0xcd3046){_0xcd3046=_0xcd3046||0x1f4;return function(_0x5c0eab){logger['error'](_0x5c0eab[_0xae4e('0x1a')]);if(_0x5c0eab['name']){delete _0x5c0eab[_0xae4e('0x1b')];}_0x30a669['status'](_0xcd3046)[_0xae4e('0x1c')](_0x5c0eab);};}exports[_0xae4e('0x1d')]=function(_0x532335,_0x58c7fb){var _0x9f00a0={};var _0x5b7c51=_[_0xae4e('0x1e')](db['WhatsappInteraction'][_0xae4e('0x1f')],function(_0x372882){return{'name':_0x372882[_0xae4e('0x20')],'type':_0x372882[_0xae4e('0x21')][_0xae4e('0x22')]};});_0x9f00a0=qs[_0xae4e('0x23')](_0x5b7c51,_0x532335);return interaction[_0xae4e('0x24')](_0xae4e('0x25'),_0x532335[_0xae4e('0x26')],_0x532335[_0xae4e('0x27')],_0x9f00a0,_0x5b7c51)[_0xae4e('0x18')](respondWithFilteredResult(_0x58c7fb,_0x9f00a0))[_0xae4e('0x28')](handleError(_0x58c7fb,null));};exports[_0xae4e('0x29')]=function(_0x151da3,_0x594cb3){var _0x536b66={'raw':![],'where':{'id':_0x151da3[_0xae4e('0x2a')]['id']}},_0x2c5f7a={};_0x2c5f7a[_0xae4e('0x2b')]=_[_0xae4e('0x2c')](db[_0xae4e('0x2d')][_0xae4e('0x1f')]);_0x2c5f7a[_0xae4e('0x26')]=_[_0xae4e('0x2c')](_0x151da3[_0xae4e('0x26')]);_0x2c5f7a[_0xae4e('0x2e')]=_[_0xae4e('0x2f')](_0x2c5f7a[_0xae4e('0x2b')],_0x2c5f7a['query']);_0x536b66[_0xae4e('0x30')]=_[_0xae4e('0x2f')](_0x2c5f7a[_0xae4e('0x2b')],qs['fields'](_0x151da3['query'][_0xae4e('0x31')]));_0x536b66[_0xae4e('0x30')]=_0x536b66['attributes'][_0xae4e('0x32')]?_0x536b66[_0xae4e('0x30')]:_0x2c5f7a['model'];if(_0x151da3[_0xae4e('0x26')][_0xae4e('0x33')]){_0x536b66[_0xae4e('0x34')]=[{'all':!![]}];}_0x536b66=_['merge']({},_0x536b66,_0x151da3[_0xae4e('0x35')]);return db[_0xae4e('0x2d')][_0xae4e('0x36')](_0x536b66)[_0xae4e('0x18')](handleEntityNotFound(_0x594cb3,null))['then'](respondWithResult(_0x594cb3,null))['catch'](handleError(_0x594cb3,null));};exports[_0xae4e('0x37')]=function(_0x1c438a,_0x129284){return db[_0xae4e('0x2d')][_0xae4e('0x37')](_0x1c438a['body'],{})[_0xae4e('0x18')](respondWithResult(_0x129284,0xc9))[_0xae4e('0x28')](handleError(_0x129284,null));};exports[_0xae4e('0x17')]=function(_0x1184e3,_0x4fa644){if(_0x1184e3[_0xae4e('0x38')]['id']){delete _0x1184e3[_0xae4e('0x38')]['id'];}return db['WhatsappInteraction'][_0xae4e('0x36')]({'where':{'id':_0x1184e3[_0xae4e('0x2a')]['id']}})[_0xae4e('0x18')](handleEntityNotFound(_0x4fa644,null))[_0xae4e('0x18')](saveUpdates(_0x1184e3[_0xae4e('0x38')],null))[_0xae4e('0x18')](respondWithResult(_0x4fa644,null))[_0xae4e('0x28')](handleError(_0x4fa644,null));};exports['destroy']=function(_0x2b31e1,_0x34ba10){return db[_0xae4e('0x2d')]['find']({'where':{'id':_0x2b31e1[_0xae4e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x34ba10,null))[_0xae4e('0x18')](removeEntity(_0x34ba10,null))[_0xae4e('0x28')](handleError(_0x34ba10,null));};exports[_0xae4e('0x39')]=function(_0x38a8c9,_0x2d0f9d){return db[_0xae4e('0x2d')]['describe']()['then'](respondWithResult(_0x2d0f9d,null))[_0xae4e('0x28')](handleError(_0x2d0f9d,null));};exports['addMessage']=function(_0x186cf3,_0x413236){return db[_0xae4e('0x3a')][_0xae4e('0x36')]({'where':{'id':_0x186cf3[_0xae4e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x413236,null))[_0xae4e('0x18')](function(_0x1bcfe9){if(_0x1bcfe9){return _0x1bcfe9[_0xae4e('0x3b')](_0x186cf3[_0xae4e('0x38')]['ids'],_[_0xae4e('0x3c')](_0x186cf3[_0xae4e('0x38')],[_0xae4e('0x3d'),'id'])||{});}})[_0xae4e('0x18')](respondWithResult(_0x413236,null))[_0xae4e('0x28')](handleError(_0x413236,null));};exports[_0xae4e('0x3e')]=function(_0x29ecbe,_0x4c7b61){var _0x324c13={'raw':![],'where':{}};var _0x17c374={};var _0x48a95c={'count':0x0,'rows':[]};return db[_0xae4e('0x2d')][_0xae4e('0x3f')]({'where':{'id':_0x29ecbe[_0xae4e('0x2a')]['id']}})[_0xae4e('0x18')](handleEntityNotFound(_0x4c7b61,null))[_0xae4e('0x18')](function(_0x26404f){if(_0x26404f){_0x17c374[_0xae4e('0x2b')]=_[_0xae4e('0x2c')](db[_0xae4e('0x3a')][_0xae4e('0x1f')]);_0x17c374['query']=_[_0xae4e('0x2c')](_0x29ecbe[_0xae4e('0x26')]);_0x17c374[_0xae4e('0x2e')]=_[_0xae4e('0x2f')](_0x17c374['model'],_0x17c374[_0xae4e('0x26')]);_0x324c13[_0xae4e('0x30')]=_[_0xae4e('0x2f')](_0x17c374[_0xae4e('0x2b')],qs[_0xae4e('0x31')](_0x29ecbe[_0xae4e('0x26')]['fields']));_0x324c13[_0xae4e('0x30')]=_0x324c13['attributes'][_0xae4e('0x32')]?_0x324c13['attributes']:_0x17c374[_0xae4e('0x2b')];if(!_0x29ecbe[_0xae4e('0x26')]['hasOwnProperty']('nolimit')){_0x324c13[_0xae4e('0x14')]=qs['limit'](_0x29ecbe['query'][_0xae4e('0x14')]);_0x324c13['offset']=qs[_0xae4e('0x11')](_0x29ecbe['query']['offset']);}_0x324c13[_0xae4e('0x40')]=qs[_0xae4e('0x41')](_0x29ecbe[_0xae4e('0x26')]['sort']);_0x324c13[_0xae4e('0x42')]=qs['filters'](_['pick'](_0x29ecbe[_0xae4e('0x26')],_0x17c374[_0xae4e('0x2e')]));_0x324c13[_0xae4e('0x42')]['WhatsappInteractionId']=_0x26404f['id'];if(_0x29ecbe[_0xae4e('0x26')][_0xae4e('0x43')]){_0x324c13['where']=_[_0xae4e('0x44')](_0x324c13['where'],{'$or':_['map'](_0x324c13[_0xae4e('0x30')],function(_0x54f254){var _0x497f0c={};_0x497f0c[_0x54f254]={'$like':'%'+_0x29ecbe['query'][_0xae4e('0x43')]+'%'};return _0x497f0c;})});}if(_0x29ecbe['query'][_0xae4e('0x45')]){var _0x45716a=_0x29ecbe[_0xae4e('0x26')]['$gte'][_0xae4e('0x46')](',');var _0xd7cd33={};_0xd7cd33[_0x45716a[0x0]]={'$gte':moment(_0x45716a[0x1])[_0xae4e('0x47')](_0xae4e('0x48'))};_0x324c13[_0xae4e('0x42')]=_[_0xae4e('0x44')](_0x324c13[_0xae4e('0x42')],_0xd7cd33);}_0x324c13=_[_0xae4e('0x44')]({},_0x324c13,_0x29ecbe[_0xae4e('0x35')]);return db[_0xae4e('0x3a')][_0xae4e('0x13')]({'where':_0x324c13[_0xae4e('0x42')]})[_0xae4e('0x18')](function(_0x1707c4){_0x48a95c[_0xae4e('0x13')]=_0x1707c4;if(_0x29ecbe[_0xae4e('0x26')][_0xae4e('0x33')]){_0x324c13[_0xae4e('0x34')]=[{'all':!![]}];}return db[_0xae4e('0x3a')][_0xae4e('0x24')](_0x324c13);})['then'](function(_0x28cfeb){_0x48a95c[_0xae4e('0x49')]=_0x28cfeb;return _0x48a95c;});}})[_0xae4e('0x18')](respondWithFilteredResult(_0x4c7b61,_0x324c13))[_0xae4e('0x28')](handleError(_0x4c7b61,null));};exports['addTags']=function(_0x4a4955,_0x2ffad2){return db[_0xae4e('0x2d')]['find']({'where':{'id':_0x4a4955[_0xae4e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2ffad2,null))['then'](function(_0xfc728a){if(_0xfc728a){return _0xfc728a['setTags'](_0x4a4955[_0xae4e('0x38')]['ids'],_[_0xae4e('0x3c')](_0x4a4955['body'],[_0xae4e('0x3d'),'id'])||{})[_0xae4e('0x4a')](function(){return db[_0xae4e('0x4b')]['findAll']({'attributes':['id','name',_0xae4e('0x4c')],'where':{'id':_0x4a4955[_0xae4e('0x38')]['ids']}});})['then'](function(_0x255d18){socket[_0xae4e('0x4d')](_0xae4e('0x4e'),{'id':Number(_0x4a4955[_0xae4e('0x2a')]['id']),'tags':_0x255d18||[]});return{'id':Number(_0x4a4955[_0xae4e('0x2a')]['id']),'tags':_0x255d18||[]};});}})[_0xae4e('0x18')](respondWithResult(_0x2ffad2,null))['catch'](handleError(_0x2ffad2,null));};exports['removeTags']=function(_0x1c5145,_0x1ec2b4){return db['WhatsappInteraction'][_0xae4e('0x36')]({'where':{'id':_0x1c5145['params']['id']}})[_0xae4e('0x18')](handleEntityNotFound(_0x1ec2b4,null))[_0xae4e('0x18')](function(_0x428c89){if(_0x428c89){return _0x428c89[_0xae4e('0x4f')](_0x1c5145[_0xae4e('0x26')]['ids']);}})['then'](respondWithStatusCode(_0x1ec2b4,null))[_0xae4e('0x28')](handleError(_0x1ec2b4,null));};exports['download']=function(_0x1739b9,_0x28a7e2){var _0x42a869=moment()['unix']()[_0xae4e('0x50')]();var _0x4a7d60=path[_0xae4e('0x51')](config['root'],_0xae4e('0x52'),_0xae4e('0x53'),_0xae4e('0x54'));var _0x3b30d9=path['join'](config[_0xae4e('0x55')],_0xae4e('0x52'),_0xae4e('0x53'),'attachments');var _0x1793fb=path[_0xae4e('0x51')](_0x4a7d60,_0x42a869);var _0x2003ff=util[_0xae4e('0x47')]('transcript-%d-%s.zip',_0x1739b9[_0xae4e('0x2a')]['id'],_0x42a869);var _0x151838=path[_0xae4e('0x51')](_0x4a7d60,_0x2003ff);var _0x564f43=[];_0x564f43[_0xae4e('0x56')]({'model':db[_0xae4e('0x57')],'as':'User','attributes':['id',_0xae4e('0x58')],'raw':!![]});_0x564f43[_0xae4e('0x56')]({'model':db['CmContact'],'as':_0xae4e('0x59'),'attributes':['id',_0xae4e('0x5a'),_0xae4e('0x5b')],'raw':!![]});if(_0x1739b9['query']['attachments']){_0x564f43['push']({'model':db[_0xae4e('0x5c')],'as':_0xae4e('0x5c'),'raw':!![]});}var _0x1b8519=[{'model':db[_0xae4e('0x3a')],'as':'Messages','attributes':['id',_0xae4e('0x38'),_0xae4e('0x5d'),'direction','secret',_0xae4e('0x5e')],'include':_0x564f43}];_0x1b8519['push']({'model':db[_0xae4e('0x5f')],'as':_0xae4e('0x60'),'attributes':['id',_0xae4e('0x1b')]});_0x1b8519[_0xae4e('0x56')]({'model':db[_0xae4e('0x57')],'as':_0xae4e('0x61'),'attributes':['id',_0xae4e('0x58')]});return db[_0xae4e('0x2d')][_0xae4e('0x36')]({'where':{'id':_0x1739b9[_0xae4e('0x2a')]['id']},'include':_0x1b8519})[_0xae4e('0x18')](handleEntityNotFound(_0x28a7e2,null))[_0xae4e('0x18')](function(_0x10c8df){if(_0x10c8df){var _0x146ea0=_0x10c8df[_0xae4e('0x62')]({'plain':!![]});fs[_0xae4e('0x63')](_0x1793fb);var _0x1a23fd={'channel':'Whatsapp','account':_0x146ea0[_0xae4e('0x60')][_0xae4e('0x1b')],'agent':_0x146ea0[_0xae4e('0x61')]?_0x146ea0[_0xae4e('0x61')][_0xae4e('0x58')]:'N.A.','createdAt':moment(_0x146ea0[_0xae4e('0x5d')])[_0xae4e('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0xae4e('0x50')](),'closedAt':_0x146ea0[_0xae4e('0x64')]?moment(_0x146ea0['closedAt'])['format'](_0xae4e('0x48'))[_0xae4e('0x50')]():'','disposition':_0x146ea0[_0xae4e('0x65')],'messages':_(_0x146ea0['Messages'])[_0xae4e('0x43')]({'secret':![]})[_0xae4e('0x1e')](function(_0x480575){if(_0x480575[_0xae4e('0x5c')]){var _0x1055db=path['join'](_0x3b30d9,_0x480575[_0xae4e('0x5c')][_0xae4e('0x66')]);if(fs[_0xae4e('0x67')](_0x1055db)){fs[_0xae4e('0x68')](_0x1055db)[_0xae4e('0x69')](fs['createWriteStream'](path[_0xae4e('0x51')](_0x1793fb,_0x480575[_0xae4e('0x5c')][_0xae4e('0x66')])));}}return{'date':moment(_0x480575[_0xae4e('0x5d')])[_0xae4e('0x47')](_0xae4e('0x48'))['toString'](),'sender':_0x480575['direction']===_0xae4e('0x6a')?_0x480575[_0xae4e('0x57')]?_0x480575['User']['fullname']:_0xae4e('0x6b'):_0x480575[_0xae4e('0x59')][_0xae4e('0x5a')]+(_0x480575['Contact'][_0xae4e('0x5b')]?'\x20'+_0x480575[_0xae4e('0x59')][_0xae4e('0x5b')]:''),'body':_0x480575[_0xae4e('0x5c')]?_0x480575[_0xae4e('0x5c')][_0xae4e('0x66')]:_0x480575[_0xae4e('0x38')],'direction':_0x480575[_0xae4e('0x6c')]===_0xae4e('0x6a')?'A':'C','secret':_0x480575[_0xae4e('0x6d')],'read':_0x480575[_0xae4e('0x5e')],'attachment':_0x480575[_0xae4e('0x5c')]};})[_0xae4e('0x6e')]()};return ejs[_0xae4e('0x6f')](path[_0xae4e('0x51')](config[_0xae4e('0x55')],_0xae4e('0x52'),_0xae4e('0x70'),_0xae4e('0x71')),{'interaction':_0x1a23fd})[_0xae4e('0x18')](function(_0x1834fe){var _0x2e9bba=path[_0xae4e('0x51')](_0x1793fb,_0xae4e('0x72')+_0x146ea0['id']+'-'+_0x42a869+'.pdf');var _0x5be43b={'path':_0x2e9bba,'channel':_0xae4e('0x73'),'interactionId':_0x146ea0['id']};return pdf[_0xae4e('0x74')](_0x1834fe,_0x5be43b);})[_0xae4e('0x18')](function(){return new BPromise(function(_0x18cdf1,_0x42adc1){zipdir(_0x1793fb,{'saveTo':_0x151838},function(_0xba5ea7,_0x433731){if(_0xba5ea7)return _0x42adc1(_0xba5ea7);return _0x18cdf1(_0x433731);});})['then'](function(){return new BPromise(function(_0x2cc7d8,_0x29ad66){rimraf(_0x1793fb,function(_0x23c95f){if(_0x23c95f)_0x29ad66(_0x23c95f);return _0x2cc7d8();});});})[_0xae4e('0x18')](function(){return _0x28a7e2['download'](_0x151838,_0x2003ff,function(_0x39a460){if(_0x39a460){console['log'](_0xae4e('0x75'),_0x39a460);}else{fs[_0xae4e('0x76')](_0x151838);}});});});}else{return _0x28a7e2[_0xae4e('0x77')](0xc8);}})['catch'](handleError(_0x28a7e2,null));}; \ No newline at end of file +var _0x1f42=['whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','push','WhatsappAccount','Whatsapp','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','secret','read','value','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','findAll','query','user','show','params','model','keys','filters','attributes','fields','length','includeAll','merge','options','find','create','catch','body','describe','addMessage','WhatsappMessage','omit','ids','intersection','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','Tag','color'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x1f42,0x11f));var _0x21f4=function(_0x4f16dc,_0xa625b){_0x4f16dc=_0x4f16dc-0x0;var _0x15e123=_0x1f42[_0x4f16dc];return _0x15e123;};'use strict';var rimraf=require(_0x21f4('0x0'));var zipdir=require(_0x21f4('0x1'));var moment=require(_0x21f4('0x2'));var BPromise=require('bluebird');var util=require(_0x21f4('0x3'));var path=require(_0x21f4('0x4'));var ejs=require(_0x21f4('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x21f4('0x6'));var qs=require(_0x21f4('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x21f4('0x8'))(_0x21f4('0x9'));var config=require('../../config/environment');var db=require(_0x21f4('0xa'))['db'];config[_0x21f4('0xb')]=_['defaults'](config[_0x21f4('0xb')],{'host':_0x21f4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x21f4('0xd')](socket);function respondWithStatusCode(_0x2f66e2,_0x485ce4){_0x485ce4=_0x485ce4||0xcc;return function(_0x3b5178){if(_0x3b5178){return _0x2f66e2[_0x21f4('0xe')](_0x485ce4);}return _0x2f66e2['status'](_0x485ce4)[_0x21f4('0xf')]();};}function respondWithResult(_0x5251ed,_0x54e579){_0x54e579=_0x54e579||0xc8;return function(_0x240415){if(_0x240415){return _0x5251ed[_0x21f4('0x10')](_0x54e579)['json'](_0x240415);}};}function respondWithFilteredResult(_0x119d3e,_0x176f6e){return function(_0x392002){if(_0x392002){var _0x2cbaa6=typeof _0x176f6e[_0x21f4('0x11')]===_0x21f4('0x12')&&typeof _0x176f6e['limit']===_0x21f4('0x12');var _0x15bda6=_0x392002[_0x21f4('0x13')];var _0x1793d6=_0x2cbaa6?0x0:_0x176f6e[_0x21f4('0x11')];var _0x5ac672=_0x2cbaa6?_0x392002[_0x21f4('0x13')]:_0x176f6e[_0x21f4('0x11')]+_0x176f6e[_0x21f4('0x14')];var _0x51291a;if(_0x5ac672>=_0x15bda6){_0x5ac672=_0x15bda6;_0x51291a=0xc8;}else{_0x51291a=0xce;}_0x119d3e[_0x21f4('0x10')](_0x51291a);return _0x119d3e[_0x21f4('0x15')](_0x21f4('0x16'),_0x1793d6+'-'+_0x5ac672+'/'+_0x15bda6)[_0x21f4('0x17')](_0x392002);}return null;};}function saveUpdates(_0x470582){return function(_0x144bd9){if(_0x144bd9){return _0x144bd9[_0x21f4('0x18')](_0x470582)[_0x21f4('0x19')](function(_0x9085ed){return _0x9085ed;});}return null;};}function removeEntity(_0x2fb6b9){return function(_0xb33916){if(_0xb33916){return _0xb33916[_0x21f4('0x1a')]()[_0x21f4('0x19')](function(){_0x2fb6b9[_0x21f4('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a86a0){return function(_0x107a9f){if(!_0x107a9f){_0x5a86a0[_0x21f4('0xe')](0x194);}return _0x107a9f;};}function handleError(_0x4ff65c,_0x2cfc1a){_0x2cfc1a=_0x2cfc1a||0x1f4;return function(_0x1c88f6){logger[_0x21f4('0x1b')](_0x1c88f6[_0x21f4('0x1c')]);if(_0x1c88f6[_0x21f4('0x1d')]){delete _0x1c88f6[_0x21f4('0x1d')];}_0x4ff65c[_0x21f4('0x10')](_0x2cfc1a)['send'](_0x1c88f6);};}exports[_0x21f4('0x1e')]=function(_0x38d583,_0x3cc535){var _0x5439db={};var _0x579cfb=_[_0x21f4('0x1f')](db[_0x21f4('0x20')][_0x21f4('0x21')],function(_0x27147b){return{'name':_0x27147b[_0x21f4('0x22')],'type':_0x27147b[_0x21f4('0x23')]['key']};});_0x5439db=qs[_0x21f4('0x24')](_0x579cfb,_0x38d583);return interaction[_0x21f4('0x25')]('whatsapp',_0x38d583[_0x21f4('0x26')],_0x38d583[_0x21f4('0x27')],_0x5439db,_0x579cfb)['then'](respondWithFilteredResult(_0x3cc535,_0x5439db))['catch'](handleError(_0x3cc535,null));};exports[_0x21f4('0x28')]=function(_0x25caef,_0x2aebbc){var _0x5606ff={'raw':![],'where':{'id':_0x25caef[_0x21f4('0x29')]['id']}},_0x48f657={};_0x48f657[_0x21f4('0x2a')]=_[_0x21f4('0x2b')](db[_0x21f4('0x20')][_0x21f4('0x21')]);_0x48f657['query']=_['keys'](_0x25caef[_0x21f4('0x26')]);_0x48f657[_0x21f4('0x2c')]=_['intersection'](_0x48f657[_0x21f4('0x2a')],_0x48f657[_0x21f4('0x26')]);_0x5606ff[_0x21f4('0x2d')]=_['intersection'](_0x48f657['model'],qs[_0x21f4('0x2e')](_0x25caef['query']['fields']));_0x5606ff[_0x21f4('0x2d')]=_0x5606ff[_0x21f4('0x2d')][_0x21f4('0x2f')]?_0x5606ff[_0x21f4('0x2d')]:_0x48f657[_0x21f4('0x2a')];if(_0x25caef[_0x21f4('0x26')][_0x21f4('0x30')]){_0x5606ff['include']=[{'all':!![]}];}_0x5606ff=_[_0x21f4('0x31')]({},_0x5606ff,_0x25caef[_0x21f4('0x32')]);return db[_0x21f4('0x20')][_0x21f4('0x33')](_0x5606ff)['then'](handleEntityNotFound(_0x2aebbc,null))['then'](respondWithResult(_0x2aebbc,null))['catch'](handleError(_0x2aebbc,null));};exports[_0x21f4('0x34')]=function(_0x4e317b,_0x379f9a){return db[_0x21f4('0x20')][_0x21f4('0x34')](_0x4e317b['body'],{})[_0x21f4('0x19')](respondWithResult(_0x379f9a,0xc9))[_0x21f4('0x35')](handleError(_0x379f9a,null));};exports[_0x21f4('0x18')]=function(_0x5c4b07,_0x539ecf){if(_0x5c4b07['body']['id']){delete _0x5c4b07[_0x21f4('0x36')]['id'];}return db[_0x21f4('0x20')][_0x21f4('0x33')]({'where':{'id':_0x5c4b07['params']['id']}})[_0x21f4('0x19')](handleEntityNotFound(_0x539ecf,null))[_0x21f4('0x19')](saveUpdates(_0x5c4b07[_0x21f4('0x36')],null))['then'](respondWithResult(_0x539ecf,null))['catch'](handleError(_0x539ecf,null));};exports[_0x21f4('0x1a')]=function(_0x20baa7,_0x2d6bed){return db[_0x21f4('0x20')][_0x21f4('0x33')]({'where':{'id':_0x20baa7[_0x21f4('0x29')]['id']}})['then'](handleEntityNotFound(_0x2d6bed,null))[_0x21f4('0x19')](removeEntity(_0x2d6bed,null))[_0x21f4('0x35')](handleError(_0x2d6bed,null));};exports['describe']=function(_0x47f64a,_0x3943df){return db[_0x21f4('0x20')][_0x21f4('0x37')]()[_0x21f4('0x19')](respondWithResult(_0x3943df,null))['catch'](handleError(_0x3943df,null));};exports[_0x21f4('0x38')]=function(_0x4592dd,_0x4d4315){return db[_0x21f4('0x39')]['find']({'where':{'id':_0x4592dd[_0x21f4('0x29')]['id']}})[_0x21f4('0x19')](handleEntityNotFound(_0x4d4315,null))[_0x21f4('0x19')](function(_0x33ef8b){if(_0x33ef8b){return _0x33ef8b[_0x21f4('0x38')](_0x4592dd[_0x21f4('0x36')]['ids'],_[_0x21f4('0x3a')](_0x4592dd[_0x21f4('0x36')],[_0x21f4('0x3b'),'id'])||{});}})[_0x21f4('0x19')](respondWithResult(_0x4d4315,null))[_0x21f4('0x35')](handleError(_0x4d4315,null));};exports['getMessages']=function(_0x1fec5f,_0x201973){var _0x53d3db={'raw':![],'where':{}};var _0x12a156={};var _0x5da31d={'count':0x0,'rows':[]};return db[_0x21f4('0x20')]['findOne']({'where':{'id':_0x1fec5f[_0x21f4('0x29')]['id']}})[_0x21f4('0x19')](handleEntityNotFound(_0x201973,null))[_0x21f4('0x19')](function(_0x3ed050){if(_0x3ed050){_0x12a156['model']=_[_0x21f4('0x2b')](db[_0x21f4('0x39')][_0x21f4('0x21')]);_0x12a156[_0x21f4('0x26')]=_[_0x21f4('0x2b')](_0x1fec5f[_0x21f4('0x26')]);_0x12a156[_0x21f4('0x2c')]=_['intersection'](_0x12a156[_0x21f4('0x2a')],_0x12a156[_0x21f4('0x26')]);_0x53d3db[_0x21f4('0x2d')]=_[_0x21f4('0x3c')](_0x12a156[_0x21f4('0x2a')],qs['fields'](_0x1fec5f[_0x21f4('0x26')][_0x21f4('0x2e')]));_0x53d3db[_0x21f4('0x2d')]=_0x53d3db['attributes'][_0x21f4('0x2f')]?_0x53d3db[_0x21f4('0x2d')]:_0x12a156[_0x21f4('0x2a')];if(!_0x1fec5f['query']['hasOwnProperty']('nolimit')){_0x53d3db[_0x21f4('0x14')]=qs['limit'](_0x1fec5f[_0x21f4('0x26')][_0x21f4('0x14')]);_0x53d3db[_0x21f4('0x11')]=qs[_0x21f4('0x11')](_0x1fec5f[_0x21f4('0x26')][_0x21f4('0x11')]);}_0x53d3db[_0x21f4('0x3d')]=qs['sort'](_0x1fec5f[_0x21f4('0x26')][_0x21f4('0x3e')]);_0x53d3db[_0x21f4('0x3f')]=qs[_0x21f4('0x2c')](_[_0x21f4('0x40')](_0x1fec5f[_0x21f4('0x26')],_0x12a156[_0x21f4('0x2c')]));_0x53d3db[_0x21f4('0x3f')]['WhatsappInteractionId']=_0x3ed050['id'];if(_0x1fec5f[_0x21f4('0x26')][_0x21f4('0x41')]){_0x53d3db[_0x21f4('0x3f')]=_[_0x21f4('0x31')](_0x53d3db['where'],{'$or':_[_0x21f4('0x1f')](_0x53d3db[_0x21f4('0x2d')],function(_0x521c18){var _0x1819b0={};_0x1819b0[_0x521c18]={'$like':'%'+_0x1fec5f[_0x21f4('0x26')]['filter']+'%'};return _0x1819b0;})});}if(_0x1fec5f[_0x21f4('0x26')][_0x21f4('0x42')]){var _0x1306f0=_0x1fec5f[_0x21f4('0x26')][_0x21f4('0x42')][_0x21f4('0x43')](',');var _0x875cc0={};_0x875cc0[_0x1306f0[0x0]]={'$gte':moment(_0x1306f0[0x1])[_0x21f4('0x44')](_0x21f4('0x45'))};_0x53d3db['where']=_[_0x21f4('0x31')](_0x53d3db['where'],_0x875cc0);}_0x53d3db=_[_0x21f4('0x31')]({},_0x53d3db,_0x1fec5f[_0x21f4('0x32')]);return db[_0x21f4('0x39')]['count']({'where':_0x53d3db['where']})['then'](function(_0x54d01d){_0x5da31d['count']=_0x54d01d;if(_0x1fec5f[_0x21f4('0x26')]['includeAll']){_0x53d3db[_0x21f4('0x46')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x21f4('0x25')](_0x53d3db);})[_0x21f4('0x19')](function(_0x3733d4){_0x5da31d['rows']=_0x3733d4;return _0x5da31d;});}})[_0x21f4('0x19')](respondWithFilteredResult(_0x201973,_0x53d3db))['catch'](handleError(_0x201973,null));};exports[_0x21f4('0x47')]=function(_0x3bf4ea,_0x14bee7){return db[_0x21f4('0x20')][_0x21f4('0x33')]({'where':{'id':_0x3bf4ea[_0x21f4('0x29')]['id']}})[_0x21f4('0x19')](handleEntityNotFound(_0x14bee7,null))[_0x21f4('0x19')](function(_0x368791){if(_0x368791){return _0x368791[_0x21f4('0x48')](_0x3bf4ea[_0x21f4('0x36')][_0x21f4('0x3b')],_['omit'](_0x3bf4ea[_0x21f4('0x36')],[_0x21f4('0x3b'),'id'])||{})[_0x21f4('0x49')](function(){return db[_0x21f4('0x4a')]['findAll']({'attributes':['id','name',_0x21f4('0x4b')],'where':{'id':_0x3bf4ea[_0x21f4('0x36')][_0x21f4('0x3b')]}});})[_0x21f4('0x19')](function(_0x303a06){socket['emit'](_0x21f4('0x4c'),{'id':Number(_0x3bf4ea[_0x21f4('0x29')]['id']),'tags':_0x303a06||[]});return{'id':Number(_0x3bf4ea[_0x21f4('0x29')]['id']),'tags':_0x303a06||[]};});}})[_0x21f4('0x19')](respondWithResult(_0x14bee7,null))[_0x21f4('0x35')](handleError(_0x14bee7,null));};exports[_0x21f4('0x4d')]=function(_0x4a5fe0,_0x5a38a9){return db[_0x21f4('0x20')][_0x21f4('0x33')]({'where':{'id':_0x4a5fe0[_0x21f4('0x29')]['id']}})[_0x21f4('0x19')](handleEntityNotFound(_0x5a38a9,null))[_0x21f4('0x19')](function(_0x986fb0){if(_0x986fb0){return _0x986fb0[_0x21f4('0x4d')](_0x4a5fe0[_0x21f4('0x26')][_0x21f4('0x3b')]);}})[_0x21f4('0x19')](respondWithStatusCode(_0x5a38a9,null))[_0x21f4('0x35')](handleError(_0x5a38a9,null));};exports[_0x21f4('0x4e')]=function(_0x4070fb,_0x4ddb00){var _0x4313d8=moment()[_0x21f4('0x4f')]()[_0x21f4('0x50')]();var _0x2ff64e=path[_0x21f4('0x51')](config[_0x21f4('0x52')],_0x21f4('0x53'),_0x21f4('0x54'),'tmp');var _0x10edc3=path[_0x21f4('0x51')](config[_0x21f4('0x52')],_0x21f4('0x53'),_0x21f4('0x54'),'attachments');var _0x151901=path['join'](_0x2ff64e,_0x4313d8);var _0x2a7d5e=util[_0x21f4('0x44')](_0x21f4('0x55'),_0x4070fb[_0x21f4('0x29')]['id'],_0x4313d8);var _0x439a45=path[_0x21f4('0x51')](_0x2ff64e,_0x2a7d5e);var _0x10dde5=[];_0x10dde5['push']({'model':db[_0x21f4('0x56')],'as':_0x21f4('0x56'),'attributes':['id',_0x21f4('0x57')],'raw':!![]});_0x10dde5['push']({'model':db[_0x21f4('0x58')],'as':'Contact','attributes':['id',_0x21f4('0x59'),_0x21f4('0x5a')],'raw':!![]});if(_0x4070fb[_0x21f4('0x26')][_0x21f4('0x5b')]){_0x10dde5['push']({'model':db[_0x21f4('0x5c')],'as':_0x21f4('0x5c'),'raw':!![]});}var _0x2eddf2=[{'model':db[_0x21f4('0x39')],'as':_0x21f4('0x5d'),'attributes':['id','body',_0x21f4('0x5e'),_0x21f4('0x5f'),'secret','read'],'include':_0x10dde5}];_0x2eddf2[_0x21f4('0x60')]({'model':db[_0x21f4('0x61')],'as':'Account','attributes':['id',_0x21f4('0x1d')]});_0x2eddf2[_0x21f4('0x60')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db['WhatsappInteraction'][_0x21f4('0x33')]({'where':{'id':_0x4070fb[_0x21f4('0x29')]['id']},'include':_0x2eddf2})[_0x21f4('0x19')](handleEntityNotFound(_0x4ddb00,null))[_0x21f4('0x19')](function(_0x50f45b){if(_0x50f45b){var _0x337677=_0x50f45b['get']({'plain':!![]});fs['mkdirSync'](_0x151901);var _0x5d0fa1={'channel':_0x21f4('0x62'),'account':_0x337677['Account']['name'],'agent':_0x337677[_0x21f4('0x63')]?_0x337677['Owner'][_0x21f4('0x57')]:_0x21f4('0x64'),'createdAt':moment(_0x337677[_0x21f4('0x5e')])[_0x21f4('0x44')](_0x21f4('0x45'))[_0x21f4('0x50')](),'closedAt':_0x337677[_0x21f4('0x65')]?moment(_0x337677[_0x21f4('0x66')])[_0x21f4('0x44')](_0x21f4('0x45'))[_0x21f4('0x50')]():'','disposition':_0x337677[_0x21f4('0x67')],'messages':_(_0x337677['Messages'])[_0x21f4('0x41')]({'secret':![]})[_0x21f4('0x1f')](function(_0x40f6f8){if(_0x40f6f8['Attachment']){var _0x5d8bd4=path['join'](_0x10edc3,_0x40f6f8[_0x21f4('0x5c')][_0x21f4('0x68')]);if(fs[_0x21f4('0x69')](_0x5d8bd4)){fs[_0x21f4('0x6a')](_0x5d8bd4)[_0x21f4('0x6b')](fs[_0x21f4('0x6c')](path[_0x21f4('0x51')](_0x151901,_0x40f6f8[_0x21f4('0x5c')][_0x21f4('0x68')])));}}return{'date':moment(_0x40f6f8[_0x21f4('0x5e')])[_0x21f4('0x44')](_0x21f4('0x45'))['toString'](),'sender':_0x40f6f8[_0x21f4('0x5f')]===_0x21f4('0x6d')?_0x40f6f8[_0x21f4('0x56')]?_0x40f6f8[_0x21f4('0x56')]['fullname']:_0x21f4('0x6e'):_0x40f6f8['Contact']['firstName']+(_0x40f6f8['Contact'][_0x21f4('0x5a')]?'\x20'+_0x40f6f8[_0x21f4('0x6f')][_0x21f4('0x5a')]:''),'body':_0x40f6f8['Attachment']?_0x40f6f8['Attachment'][_0x21f4('0x68')]:_0x40f6f8[_0x21f4('0x36')],'direction':_0x40f6f8[_0x21f4('0x5f')]===_0x21f4('0x6d')?'A':'C','secret':_0x40f6f8[_0x21f4('0x70')],'read':_0x40f6f8[_0x21f4('0x71')],'attachment':_0x40f6f8['Attachment']};})[_0x21f4('0x72')]()};return ejs['renderFile'](path[_0x21f4('0x51')](config[_0x21f4('0x52')],'server',_0x21f4('0x73'),_0x21f4('0x74')),{'interaction':_0x5d0fa1})[_0x21f4('0x19')](function(_0x4c197c){var _0xe591d2=path[_0x21f4('0x51')](_0x151901,_0x21f4('0x75')+_0x337677['id']+'-'+_0x4313d8+'.pdf');var _0xaad0e2={'path':_0xe591d2,'channel':_0x21f4('0x62'),'interactionId':_0x337677['id']};return pdf[_0x21f4('0x76')](_0x4c197c,_0xaad0e2);})[_0x21f4('0x19')](function(){return new BPromise(function(_0x21e04c,_0x4b0d48){zipdir(_0x151901,{'saveTo':_0x439a45},function(_0x46fefa,_0x104d81){if(_0x46fefa)return _0x4b0d48(_0x46fefa);return _0x21e04c(_0x104d81);});})[_0x21f4('0x19')](function(){return new BPromise(function(_0x466f92,_0x136172){rimraf(_0x151901,function(_0x5a669e){if(_0x5a669e)_0x136172(_0x5a669e);return _0x466f92();});});})[_0x21f4('0x19')](function(){return _0x4ddb00[_0x21f4('0x4e')](_0x439a45,_0x2a7d5e,function(_0x44de12){if(_0x44de12){console[_0x21f4('0x77')]('err',_0x44de12);}else{fs[_0x21f4('0x78')](_0x439a45);}});});});}else{return _0x4ddb00[_0x21f4('0xe')](0xc8);}})[_0x21f4('0x35')](handleError(_0x4ddb00,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6c525c2..eddee54 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 _0x31c2=['emit','exports','events','../../mysqldb','WhatsappMessage','save','update','remove','getUsers','Users','map','findAll','setDataValue','unreadMessages','length'];(function(_0x436f12,_0x120e16){var _0x4e7f84=function(_0x5442f6){while(--_0x5442f6){_0x436f12['push'](_0x436f12['shift']());}};_0x4e7f84(++_0x120e16);}(_0x31c2,0x98));var _0x231c=function(_0x1b7fa1,_0x5198c3){_0x1b7fa1=_0x1b7fa1-0x0;var _0x346e4b=_0x31c2[_0x1b7fa1];return _0x346e4b;};'use strict';var EventEmitter=require(_0x231c('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x231c('0x1'))['db'][_0x231c('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x231c('0x3'),'afterUpdate':_0x231c('0x4'),'afterDestroy':_0x231c('0x5')};function emitEvent(_0xe1bfea){return function(_0x6343fb,_0x243f47,_0x21b4df){_0x6343fb[_0x231c('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1e3997){_0x6343fb['setDataValue'](_0x231c('0x7'),_0x1e3997[_0x231c('0x8')](function(_0x2e1839){return{'id':_0x2e1839['id']};}));return WhatsappMessage[_0x231c('0x9')]({'where':{'WhatsappInteractionId':_0x6343fb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xb80482){_0x6343fb[_0x231c('0xa')](_0x231c('0xb'),_0xb80482[_0x231c('0xc')]);WhatsappInteractionEvents[_0x231c('0xd')](_0xe1bfea+':'+_0x6343fb['id'],_0x6343fb);WhatsappInteractionEvents[_0x231c('0xd')](_0xe1bfea,_0x6343fb);_0x21b4df(null);})['catch'](_0x21b4df(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x231c('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x6d0b=['catch','events','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6d0b,0x71));var _0xb6d0=function(_0x3c0618,_0xc29b1){_0x3c0618=_0x3c0618-0x0;var _0x12bee6=_0x6d0b[_0x3c0618];return _0x12bee6;};'use strict';var EventEmitter=require(_0xb6d0('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xb6d0('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xb6d0('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb6d0('0x3')](0x0);var events={'afterCreate':_0xb6d0('0x4'),'afterUpdate':_0xb6d0('0x5'),'afterDestroy':_0xb6d0('0x6')};function emitEvent(_0x374a27){return function(_0x2b4984,_0x57161a,_0x35142b){_0x2b4984[_0xb6d0('0x7')]({'attributes':['id'],'raw':!![]})[_0xb6d0('0x8')](function(_0x341756){_0x2b4984[_0xb6d0('0x9')](_0xb6d0('0xa'),_0x341756[_0xb6d0('0xb')](function(_0x354e56){return{'id':_0x354e56['id']};}));return WhatsappMessage[_0xb6d0('0xc')]({'where':{'WhatsappInteractionId':_0x2b4984['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb6d0('0x8')](function(_0x324713){_0x2b4984[_0xb6d0('0x9')]('unreadMessages',_0x324713[_0xb6d0('0xd')]);WhatsappInteractionEvents['emit'](_0x374a27+':'+_0x2b4984['id'],_0x2b4984);WhatsappInteractionEvents[_0xb6d0('0xe')](_0x374a27,_0x2b4984);_0x35142b(null);})[_0xb6d0('0xf')](_0x35142b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index fa161eb..1176780 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 _0x4eb0=['../../config/logger','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x5e56db,_0x37f86e){var _0x2f49c9=function(_0x4838e0){while(--_0x4838e0){_0x5e56db['push'](_0x5e56db['shift']());}};_0x2f49c9(++_0x37f86e);}(_0x4eb0,0xd0));var _0x04eb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4eb0[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x04eb('0x0'));var util=require(_0x04eb('0x1'));var logger=require(_0x04eb('0x2'))('api');var moment=require('moment');var BPromise=require(_0x04eb('0x3'));var rp=require(_0x04eb('0x4'));var fs=require('fs');var path=require(_0x04eb('0x5'));var rimraf=require('rimraf');var config=require(_0x04eb('0x6'));var attributes=require(_0x04eb('0x7'));module[_0x04eb('0x8')]=function(_0x70707,_0x32ae51){return _0x70707[_0x04eb('0x9')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a3bfd,_0x23f979,_0x29e877){if(_0x5a3bfd[_0x04eb('0xa')](_0x04eb('0xb'))){_0x5a3bfd[_0x04eb('0xc')]=moment()[_0x04eb('0xd')](_0x04eb('0xe'));}_0x29e877(null,_0x5a3bfd);}}});}; \ No newline at end of file +var _0x480d=['whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','request-promise','./whatsappInteraction.attributes','exports','WhatsappInteraction'];(function(_0x34ef08,_0x3490fc){var _0x161a4f=function(_0x47f7a1){while(--_0x47f7a1){_0x34ef08['push'](_0x34ef08['shift']());}};_0x161a4f(++_0x3490fc);}(_0x480d,0x19d));var _0xd480=function(_0xd10aff,_0x3785de){_0xd10aff=_0xd10aff-0x0;var _0x452075=_0x480d[_0xd10aff];return _0x452075;};'use strict';var _=require('lodash');var util=require(_0xd480('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd480('0x1'));var BPromise=require(_0xd480('0x2'));var rp=require(_0xd480('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd480('0x4'));module[_0xd480('0x5')]=function(_0x58acca,_0xb4676d){return _0x58acca['define'](_0xd480('0x6'),attributes,{'tableName':_0xd480('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bfc96,_0x58c501,_0x2cc1ed){if(_0x1bfc96[_0xd480('0x8')](_0xd480('0x9'))){_0x1bfc96[_0xd480('0xa')]=moment()['format'](_0xd480('0xb'));}_0x2cc1ed(null,_0x1bfc96);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 76eec25..c4be9a6 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 _0x80a2=['WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','raw','options','where','attributes','limit','info','stringify','AddTagsToWhatsappInteraction','addTags','body','ids','spread','AddTags','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x19eea8,_0x2ba23a){var _0x862240=function(_0x7532c){while(--_0x7532c){_0x19eea8['push'](_0x19eea8['shift']());}};_0x862240(++_0x2ba23a);}(_0x80a2,0x6a));var _0x280a=function(_0xc0f818,_0x134ee4){_0xc0f818=_0xc0f818-0x0;var _0x2281d=_0x80a2[_0xc0f818];return _0x2281d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x280a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x280a('0x1'));var db=require(_0x280a('0x2'))['db'];var utils=require(_0x280a('0x3'));var logger=require(_0x280a('0x4'))(_0x280a('0x5'));var config=require(_0x280a('0x6'));var jayson=require(_0x280a('0x7'));var client=jayson[_0x280a('0x8')][_0x280a('0x9')]({'port':0x232a});config[_0x280a('0xa')]=_[_0x280a('0xb')](config[_0x280a('0xa')],{'host':_0x280a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x280a('0xa')]));require(_0x280a('0xd'))[_0x280a('0xe')](socket);function respondWithRpcPromise(_0x21a793,_0x3165c9,_0x5a867a){return new BPromise(function(_0x266519,_0x1416e8){return client[_0x280a('0xf')](_0x21a793,_0x5a867a)[_0x280a('0x10')](function(_0x517db2){logger['info'](_0x280a('0x11'),_0x3165c9,_0x280a('0x12'));logger[_0x280a('0x13')](_0x280a('0x14'),_0x3165c9,'request\x20sent',JSON['stringify'](_0x517db2));if(_0x517db2[_0x280a('0x15')]){if(_0x517db2['error'][_0x280a('0x16')]===0x1f4){logger[_0x280a('0x15')](_0x280a('0x11'),_0x3165c9,_0x517db2['error']['message']);return _0x1416e8(_0x517db2[_0x280a('0x15')][_0x280a('0x17')]);}logger['error'](_0x280a('0x11'),_0x3165c9,_0x517db2[_0x280a('0x15')][_0x280a('0x17')]);return _0x266519(_0x517db2[_0x280a('0x15')][_0x280a('0x17')]);}else{logger['info'](_0x280a('0x11'),_0x3165c9,_0x280a('0x12'));_0x266519(_0x517db2[_0x280a('0x18')][_0x280a('0x17')]);}})[_0x280a('0x19')](function(_0x8c33e1){logger['error'](_0x280a('0x11'),_0x3165c9,_0x8c33e1);_0x1416e8(_0x8c33e1);});});}exports[_0x280a('0x1a')]=function(_0xfd50d5){var _0x5c09c4=this;return new Promise(function(_0x677892,_0x26fd04){return db[_0x280a('0x1b')][_0x280a('0x1c')](_0xfd50d5['body'],{'raw':_0xfd50d5['options']?_0xfd50d5['options'][_0x280a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfd50d5[_0x280a('0x1e')]?_0xfd50d5['options'][_0x280a('0x1f')]||null:null,'attributes':_0xfd50d5[_0x280a('0x1e')]?_0xfd50d5[_0x280a('0x1e')][_0x280a('0x20')]||null:null,'limit':_0xfd50d5['options']?_0xfd50d5[_0x280a('0x1e')][_0x280a('0x21')]||null:null})[_0x280a('0x10')](function(_0x129bf2){logger[_0x280a('0x22')]('UpdateWhatsappInteraction',_0xfd50d5);logger[_0x280a('0x13')](_0x280a('0x1a'),_0xfd50d5,JSON[_0x280a('0x23')](_0x129bf2));_0x677892(_0x129bf2);})[_0x280a('0x19')](function(_0x29067a){logger[_0x280a('0x15')]('UpdateWhatsappInteraction',_0x29067a[_0x280a('0x17')],_0xfd50d5);_0x26fd04(_0x5c09c4[_0x280a('0x15')](0x1f4,_0x29067a[_0x280a('0x17')]));});});};exports[_0x280a('0x24')]=function(_0x44834e){return new Promise(function(_0x1231a0,_0x232f8b){return db[_0x280a('0x1b')]['find']({'where':_0x44834e[_0x280a('0x1e')]?_0x44834e['options']['where']||null:null})[_0x280a('0x10')](function(_0x4ad379){if(_0x4ad379){return _0x4ad379[_0x280a('0x25')](_0x44834e[_0x280a('0x26')]['ids'],_['omit'](_0x44834e[_0x280a('0x26')],[_0x280a('0x27'),'id'])||{});}})[_0x280a('0x28')](function(_0x4e095d){logger['info'](_0x280a('0x29'),_0x44834e);logger['debug'](_0x280a('0x29'),_0x44834e,JSON[_0x280a('0x23')](_0x4e095d));_0x1231a0(_0x4e095d);})[_0x280a('0x19')](function(_0x4fc72a){logger[_0x280a('0x15')](_0x280a('0x29'),_0x4fc72a[_0x280a('0x17')],_0x44834e);_0x232f8b(_this[_0x280a('0x15')](0x1f4,_0x4fc72a[_0x280a('0x17')]));});});}; \ No newline at end of file +var _0xf095=['limit','debug','find','addTags','body','ids','omit','spread','AddTags','stringify','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateWhatsappInteraction','update','options','raw','where','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf095,0x1a4));var _0x5f09=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0xf095[_0x5a7d41];return _0x98d8fa;};'use strict';var _=require(_0x5f09('0x0'));var util=require(_0x5f09('0x1'));var moment=require('moment');var BPromise=require(_0x5f09('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f09('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f09('0x4'))(_0x5f09('0x5'));var config=require('../../config/environment');var jayson=require(_0x5f09('0x6'));var client=jayson[_0x5f09('0x7')][_0x5f09('0x8')]({'port':0x232a});config['redis']=_[_0x5f09('0x9')](config[_0x5f09('0xa')],{'host':_0x5f09('0xb'),'port':0x18eb});var socket=require(_0x5f09('0xc'))(new Redis(config['redis']));require(_0x5f09('0xd'))[_0x5f09('0xe')](socket);function respondWithRpcPromise(_0x5c5271,_0x7c0e78,_0x4172a7){return new BPromise(function(_0x1bf00d,_0x58db4c){return client[_0x5f09('0xf')](_0x5c5271,_0x4172a7)[_0x5f09('0x10')](function(_0x9fd852){logger[_0x5f09('0x11')](_0x5f09('0x12'),_0x7c0e78,_0x5f09('0x13'));logger['debug'](_0x5f09('0x14'),_0x7c0e78,_0x5f09('0x13'),JSON['stringify'](_0x9fd852));if(_0x9fd852['error']){if(_0x9fd852[_0x5f09('0x15')][_0x5f09('0x16')]===0x1f4){logger[_0x5f09('0x15')](_0x5f09('0x12'),_0x7c0e78,_0x9fd852[_0x5f09('0x15')][_0x5f09('0x17')]);return _0x58db4c(_0x9fd852[_0x5f09('0x15')][_0x5f09('0x17')]);}logger[_0x5f09('0x15')](_0x5f09('0x12'),_0x7c0e78,_0x9fd852[_0x5f09('0x15')][_0x5f09('0x17')]);return _0x1bf00d(_0x9fd852[_0x5f09('0x15')]['message']);}else{logger[_0x5f09('0x11')](_0x5f09('0x12'),_0x7c0e78,_0x5f09('0x13'));_0x1bf00d(_0x9fd852[_0x5f09('0x18')]['message']);}})['catch'](function(_0x3ff9dd){logger['error'](_0x5f09('0x12'),_0x7c0e78,_0x3ff9dd);_0x58db4c(_0x3ff9dd);});});}exports[_0x5f09('0x19')]=function(_0x256cb5){var _0x1d4a7e=this;return new Promise(function(_0x10fdd7,_0x2c3fd0){return db['WhatsappInteraction'][_0x5f09('0x1a')](_0x256cb5['body'],{'raw':_0x256cb5[_0x5f09('0x1b')]?_0x256cb5[_0x5f09('0x1b')][_0x5f09('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x256cb5[_0x5f09('0x1b')]?_0x256cb5[_0x5f09('0x1b')][_0x5f09('0x1d')]||null:null,'attributes':_0x256cb5[_0x5f09('0x1b')]?_0x256cb5['options'][_0x5f09('0x1e')]||null:null,'limit':_0x256cb5[_0x5f09('0x1b')]?_0x256cb5[_0x5f09('0x1b')][_0x5f09('0x1f')]||null:null})[_0x5f09('0x10')](function(_0x35a94a){logger['info'](_0x5f09('0x19'),_0x256cb5);logger[_0x5f09('0x20')]('UpdateWhatsappInteraction',_0x256cb5,JSON['stringify'](_0x35a94a));_0x10fdd7(_0x35a94a);})['catch'](function(_0x499485){logger[_0x5f09('0x15')](_0x5f09('0x19'),_0x499485[_0x5f09('0x17')],_0x256cb5);_0x2c3fd0(_0x1d4a7e['error'](0x1f4,_0x499485[_0x5f09('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x12f5c4){return new Promise(function(_0x25bad1,_0x778846){return db['WhatsappInteraction'][_0x5f09('0x21')]({'where':_0x12f5c4[_0x5f09('0x1b')]?_0x12f5c4['options'][_0x5f09('0x1d')]||null:null})[_0x5f09('0x10')](function(_0x2cef16){if(_0x2cef16){return _0x2cef16[_0x5f09('0x22')](_0x12f5c4[_0x5f09('0x23')][_0x5f09('0x24')],_[_0x5f09('0x25')](_0x12f5c4[_0x5f09('0x23')],['ids','id'])||{});}})[_0x5f09('0x26')](function(_0x31f349){logger[_0x5f09('0x11')]('AddTags',_0x12f5c4);logger['debug'](_0x5f09('0x27'),_0x12f5c4,JSON[_0x5f09('0x28')](_0x31f349));_0x25bad1(_0x31f349);})['catch'](function(_0x5b4b4e){logger[_0x5f09('0x15')](_0x5f09('0x27'),_0x5b4b4e[_0x5f09('0x17')],_0x12f5c4);_0x778846(_this[_0x5f09('0x15')](0x1f4,_0x5b4b4e[_0x5f09('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index a811ede..58184a1 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 _0x80db=['save','remove','update','removeListener','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x1e0eed,_0x156647){var _0x2fdd39=function(_0x36da39){while(--_0x36da39){_0x1e0eed['push'](_0x1e0eed['shift']());}};_0x2fdd39(++_0x156647);}(_0x80db,0x13a));var _0xb80d=function(_0x3bcf4f,_0x507a7b){_0x3bcf4f=_0x3bcf4f-0x0;var _0x26d549=_0x80db[_0x3bcf4f];return _0x26d549;};'use strict';var WhatsappInteractionEvents=require(_0xb80d('0x0'));var events=[_0xb80d('0x1'),_0xb80d('0x2'),_0xb80d('0x3')];function createListener(_0x284d90,_0x401bfa){return function(_0x54807c){_0x401bfa['emit'](_0x284d90,_0x54807c);};}function removeListener(_0x1e6708,_0x222628){return function(){WhatsappInteractionEvents[_0xb80d('0x4')](_0x1e6708,_0x222628);};}exports[_0xb80d('0x5')]=function(_0xa89782){for(var _0x1f703d=0x0,_0x274704=events['length'];_0x1f703d<_0x274704;_0x1f703d++){var _0x3265c3=events[_0x1f703d];var _0x33b01b=createListener(_0xb80d('0x6')+_0x3265c3,_0xa89782);WhatsappInteractionEvents['on'](_0x3265c3,_0x33b01b);}}; \ No newline at end of file +var _0x6eac=['remove','update','emit','removeListener','register','./whatsappInteraction.events','save'];(function(_0x54612b,_0x4e74da){var _0x573ed6=function(_0x21e0ec){while(--_0x21e0ec){_0x54612b['push'](_0x54612b['shift']());}};_0x573ed6(++_0x4e74da);}(_0x6eac,0x19b));var _0xc6ea=function(_0xcba816,_0x1b1eb8){_0xcba816=_0xcba816-0x0;var _0x5e4c1f=_0x6eac[_0xcba816];return _0x5e4c1f;};'use strict';var WhatsappInteractionEvents=require(_0xc6ea('0x0'));var events=[_0xc6ea('0x1'),_0xc6ea('0x2'),_0xc6ea('0x3')];function createListener(_0x16a336,_0x561c86){return function(_0x27a18d){_0x561c86[_0xc6ea('0x4')](_0x16a336,_0x27a18d);};}function removeListener(_0x567e8e,_0x39e522){return function(){WhatsappInteractionEvents[_0xc6ea('0x5')](_0x567e8e,_0x39e522);};}exports[_0xc6ea('0x6')]=function(_0x10f12e){for(var _0x12a4a5=0x0,_0x11fef9=events['length'];_0x12a4a5<_0x11fef9;_0x12a4a5++){var _0x32ce63=events[_0x12a4a5];var _0x244c58=createListener('whatsappInteraction:'+_0x32ce63,_0x10f12e);WhatsappInteractionEvents['on'](_0x32ce63,_0x244c58);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index ee0b809..5977291 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 _0x25d5=['/describe','isAuthenticated','describe','/:id','whatsapp','whatsappmessage:create','create','post','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller'];(function(_0xe26f5c,_0x29ef05){var _0x6218cd=function(_0x62bd24){while(--_0x62bd24){_0xe26f5c['push'](_0xe26f5c['shift']());}};_0x6218cd(++_0x29ef05);}(_0x25d5,0x7e));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x525d('0x0'));var path=require(_0x525d('0x1'));var timeout=require('connect-timeout');var express=require(_0x525d('0x2'));var router=express[_0x525d('0x3')]();var fs_extra=require(_0x525d('0x4'));var auth=require(_0x525d('0x5'));var interaction=require(_0x525d('0x6'));var config=require(_0x525d('0x7'));var controller=require(_0x525d('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x525d('0x9'),auth[_0x525d('0xa')](),controller[_0x525d('0xb')]);router['get'](_0x525d('0xc'),auth[_0x525d('0xa')](),controller['show']);router['post']('/',auth[_0x525d('0xa')](),interaction['tracked'](_0x525d('0xd'),_0x525d('0xe')),controller[_0x525d('0xf')]);router[_0x525d('0x10')]('/:id/status',controller[_0x525d('0x11')]);router[_0x525d('0x12')](_0x525d('0xc'),auth['isAuthenticated'](),controller[_0x525d('0x13')]);router[_0x525d('0x12')](_0x525d('0x14'),auth[_0x525d('0xa')](),controller[_0x525d('0x15')]);router['put'](_0x525d('0x16'),auth[_0x525d('0xa')](),controller[_0x525d('0x17')]);router[_0x525d('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x525d('0x19')]);module[_0x525d('0x1a')]=router; \ No newline at end of file +var _0xcc7a=['isAuthenticated','/describe','describe','show','post','tracked','whatsappmessage:create','/:id/status','status','put','/:id','update','/:id/accept','/:id/reject','delete','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4d10de,_0x3c2cd6){var _0x29afc2=function(_0x31688a){while(--_0x31688a){_0x4d10de['push'](_0x4d10de['shift']());}};_0x29afc2(++_0x3c2cd6);}(_0xcc7a,0x1db));var _0xacc7=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0xcc7a[_0x5d5bcb];return _0x4ea5eb;};'use strict';var multer=require('multer');var util=require(_0xacc7('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xacc7('0x1'));var router=express[_0xacc7('0x2')]();var fs_extra=require(_0xacc7('0x3'));var auth=require(_0xacc7('0x4'));var interaction=require(_0xacc7('0x5'));var config=require(_0xacc7('0x6'));var controller=require('./whatsappMessage.controller');router[_0xacc7('0x7')]('/',auth[_0xacc7('0x8')](),controller['index']);router[_0xacc7('0x7')](_0xacc7('0x9'),auth[_0xacc7('0x8')](),controller[_0xacc7('0xa')]);router['get']('/:id',auth[_0xacc7('0x8')](),controller[_0xacc7('0xb')]);router[_0xacc7('0xc')]('/',auth[_0xacc7('0x8')](),interaction[_0xacc7('0xd')]('whatsapp',_0xacc7('0xe')),controller['create']);router[_0xacc7('0xc')](_0xacc7('0xf'),controller[_0xacc7('0x10')]);router[_0xacc7('0x11')](_0xacc7('0x12'),auth[_0xacc7('0x8')](),controller[_0xacc7('0x13')]);router[_0xacc7('0x11')](_0xacc7('0x14'),auth[_0xacc7('0x8')](),controller['accept']);router['put'](_0xacc7('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0xacc7('0x16')](_0xacc7('0x12'),auth[_0xacc7('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 6f87dd9..68e071b 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 _0x2bf4=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x2bf4,0x193));var _0x42bf=function(_0x36f79c,_0x41e72e){_0x36f79c=_0x36f79c-0x0;var _0x4978a6=_0x2bf4[_0x36f79c];return _0x4978a6;};'use strict';var Sequelize=require(_0x42bf('0x0'));module[_0x42bf('0x1')]={'body':{'type':Sequelize[_0x42bf('0x2')](_0x42bf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x42bf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x42bf('0x5')]('in',_0x42bf('0x6')),'defaultValue':_0x42bf('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x42bf('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x42bf('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x42bf('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa081=['STRING','sequelize','BOOLEAN','ENUM','out'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0xa081,0x146));var _0x1a08=function(_0x5adcbe,_0x49774d){_0x5adcbe=_0x5adcbe-0x0;var _0x94cede=_0xa081[_0x5adcbe];return _0x94cede;};'use strict';var Sequelize=require(_0x1a08('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1a08('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1a08('0x2')]('in',_0x1a08('0x3')),'defaultValue':_0x1a08('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1a08('0x4')](0xbe)},'phone':{'type':Sequelize[_0x1a08('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x1a08('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9c97596..04ccd76 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 _0x75cb=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','stack','name','index','WhatsappMessage','rawAttributes','fieldName','map','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','keys','include','options','create','body','catch','find','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','fullname','internal','manual','interface','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','Sequelize','QueryTypes','contact','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x3733eb,_0x2d9450){var _0x4c80e3=function(_0x365bce){while(--_0x365bce){_0x3733eb['push'](_0x3733eb['shift']());}};_0x4c80e3(++_0x2d9450);}(_0x75cb,0x196));var _0xb75c=function(_0x650c7f,_0x1704b7){_0x650c7f=_0x650c7f-0x0;var _0x1bc89e=_0x75cb[_0x650c7f];return _0x1bc89e;};'use strict';var emlformat=require(_0xb75c('0x0'));var rimraf=require(_0xb75c('0x1'));var zipdir=require(_0xb75c('0x2'));var jsonpatch=require(_0xb75c('0x3'));var rp=require(_0xb75c('0x4'));var moment=require(_0xb75c('0x5'));var BPromise=require(_0xb75c('0x6'));var Mustache=require(_0xb75c('0x7'));var util=require(_0xb75c('0x8'));var path=require(_0xb75c('0x9'));var sox=require('sox');var csv=require(_0xb75c('0xa'));var ejs=require(_0xb75c('0xb'));var fs=require('fs');var fs_extra=require(_0xb75c('0xc'));var _=require(_0xb75c('0xd'));var squel=require('squel');var crypto=require(_0xb75c('0xe'));var jsforce=require(_0xb75c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb75c('0xa'));var querystring=require(_0xb75c('0x10'));var Papa=require(_0xb75c('0x11'));var Redis=require(_0xb75c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb75c('0x13'));var as=require(_0xb75c('0x14'));var hardwareService=require(_0xb75c('0x15'));var logger=require(_0xb75c('0x16'))(_0xb75c('0x17'));var utils=require(_0xb75c('0x18'));var config=require(_0xb75c('0x19'));var licenseUtil=require(_0xb75c('0x1a'));var db=require(_0xb75c('0x1b'))['db'];config['redis']=_[_0xb75c('0x1c')](config[_0xb75c('0x1d')],{'host':_0xb75c('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb75c('0x1d')]));require(_0xb75c('0x1f'))['register'](socket);var jayson=require(_0xb75c('0x20'));var client=jayson[_0xb75c('0x21')][_0xb75c('0x22')]({'port':0x232c});var client9002=jayson[_0xb75c('0x21')][_0xb75c('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2b6dc2,_0x3ab666,_0xe18e83,_0x379ee5){return new BPromise(function(_0x461462,_0x701ba9){var _0x16c41c=_0x379ee5||client;return _0x16c41c[_0xb75c('0x23')](_0x2b6dc2,_0xe18e83)[_0xb75c('0x24')](function(_0x1d1b38){logger[_0xb75c('0x25')](_0xb75c('0x26'),_0x3ab666,_0xb75c('0x27'));logger[_0xb75c('0x28')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3ab666,_0xb75c('0x27'),JSON[_0xb75c('0x29')](_0x1d1b38));if(_0x1d1b38[_0xb75c('0x2a')]){if(_0x1d1b38[_0xb75c('0x2a')][_0xb75c('0x2b')]===0x1f4){logger['error'](_0xb75c('0x26'),_0x3ab666,_0x1d1b38[_0xb75c('0x2a')][_0xb75c('0x2c')]);return _0x701ba9(_0x1d1b38['error'][_0xb75c('0x2c')]);}logger[_0xb75c('0x2a')](_0xb75c('0x26'),_0x3ab666,_0x1d1b38[_0xb75c('0x2a')]['message']);return _0x461462(_0x1d1b38[_0xb75c('0x2a')][_0xb75c('0x2c')]);}else{logger['info'](_0xb75c('0x26'),_0x3ab666,'request\x20sent');_0x461462(_0x1d1b38[_0xb75c('0x2d')][_0xb75c('0x2c')]);}})['catch'](function(_0x3a04b5){logger[_0xb75c('0x2a')](_0xb75c('0x26'),_0x3ab666,_0x3a04b5);_0x701ba9(_0x3a04b5);});});}function respondWithStatusCode(_0x82b3eb,_0x27161e){_0x27161e=_0x27161e||0xcc;return function(_0x282030){if(_0x282030){return _0x82b3eb[_0xb75c('0x2e')](_0x27161e);}return _0x82b3eb[_0xb75c('0x2f')](_0x27161e)[_0xb75c('0x30')]();};}function respondWithResult(_0x24eebb,_0x24f196){_0x24f196=_0x24f196||0xc8;return function(_0x232707){if(_0x232707){return _0x24eebb[_0xb75c('0x2f')](_0x24f196)['json'](_0x232707);}};}function respondWithFilteredResult(_0x4fe288,_0x3dfa7c){return function(_0x470dcf){if(_0x470dcf){var _0x315271=typeof _0x3dfa7c[_0xb75c('0x31')]===_0xb75c('0x32')&&typeof _0x3dfa7c[_0xb75c('0x33')]==='undefined';var _0xb08832=_0x470dcf[_0xb75c('0x34')];var _0x16cc17=_0x315271?0x0:_0x3dfa7c[_0xb75c('0x31')];var _0x424d5b=_0x315271?_0x470dcf[_0xb75c('0x34')]:_0x3dfa7c[_0xb75c('0x31')]+_0x3dfa7c[_0xb75c('0x33')];var _0x469913;if(_0x424d5b>=_0xb08832){_0x424d5b=_0xb08832;_0x469913=0xc8;}else{_0x469913=0xce;}_0x4fe288[_0xb75c('0x2f')](_0x469913);return _0x4fe288[_0xb75c('0x35')](_0xb75c('0x36'),_0x16cc17+'-'+_0x424d5b+'/'+_0xb08832)[_0xb75c('0x37')](_0x470dcf);}return null;};}function patchUpdates(_0xe33923){return function(_0x257c97){try{jsonpatch[_0xb75c('0x38')](_0x257c97,_0xe33923,!![]);}catch(_0x1bf23c){return BPromise[_0xb75c('0x39')](_0x1bf23c);}return _0x257c97[_0xb75c('0x3a')]();};}function saveUpdates(_0x4952e2,_0x2af9a9){return function(_0xbcac05){if(_0xbcac05){return _0xbcac05['update'](_0x4952e2)[_0xb75c('0x24')](function(_0x5ddbf3){return _0x5ddbf3;});}return null;};}function removeEntity(_0x156991,_0x3e8b59){return function(_0x34d537){if(_0x34d537){return _0x34d537[_0xb75c('0x3b')]()['then'](function(){_0x156991[_0xb75c('0x2f')](0xcc)[_0xb75c('0x30')]();});}};}function handleEntityNotFound(_0x395e4a,_0xe3675b){return function(_0x5e6036){if(!_0x5e6036){_0x395e4a['sendStatus'](0x194);}return _0x5e6036;};}function handleError(_0x1f2aec,_0x2f6c2d){_0x2f6c2d=_0x2f6c2d||0x1f4;return function(_0xfe94d0){logger[_0xb75c('0x2a')](_0xfe94d0[_0xb75c('0x3c')]);if(_0xfe94d0[_0xb75c('0x3d')]){delete _0xfe94d0[_0xb75c('0x3d')];}_0x1f2aec[_0xb75c('0x2f')](_0x2f6c2d)['send'](_0xfe94d0);};}exports[_0xb75c('0x3e')]=function(_0xe4111b,_0x3cfb32){var _0x5b30d7={},_0x4f2bd1={},_0x246e75={'count':0x0,'rows':[]};var _0x577dac=_['map'](db[_0xb75c('0x3f')][_0xb75c('0x40')],function(_0x29acfc){return{'name':_0x29acfc[_0xb75c('0x41')],'type':_0x29acfc['type']['key']};});_0x4f2bd1['model']=_[_0xb75c('0x42')](_0x577dac,_0xb75c('0x3d'));_0x4f2bd1[_0xb75c('0x43')]=_['keys'](_0xe4111b['query']);_0x4f2bd1[_0xb75c('0x44')]=_['intersection'](_0x4f2bd1[_0xb75c('0x45')],_0x4f2bd1[_0xb75c('0x43')]);_0x5b30d7['attributes']=_[_0xb75c('0x46')](_0x4f2bd1[_0xb75c('0x45')],qs[_0xb75c('0x47')](_0xe4111b[_0xb75c('0x43')][_0xb75c('0x47')]));_0x5b30d7[_0xb75c('0x48')]=_0x5b30d7[_0xb75c('0x48')][_0xb75c('0x49')]?_0x5b30d7[_0xb75c('0x48')]:_0x4f2bd1[_0xb75c('0x45')];if(!_0xe4111b[_0xb75c('0x43')][_0xb75c('0x4a')](_0xb75c('0x4b'))){_0x5b30d7[_0xb75c('0x33')]=qs[_0xb75c('0x33')](_0xe4111b[_0xb75c('0x43')]['limit']);_0x5b30d7[_0xb75c('0x31')]=qs[_0xb75c('0x31')](_0xe4111b[_0xb75c('0x43')][_0xb75c('0x31')]);}_0x5b30d7['order']=qs['sort'](_0xe4111b[_0xb75c('0x43')][_0xb75c('0x4c')]);_0x5b30d7['where']=qs['filters'](_[_0xb75c('0x4d')](_0xe4111b[_0xb75c('0x43')],_0x4f2bd1[_0xb75c('0x44')]),_0x577dac);if(_0xe4111b[_0xb75c('0x43')][_0xb75c('0x4e')]){_0x5b30d7[_0xb75c('0x4f')]=_[_0xb75c('0x50')](_0x5b30d7[_0xb75c('0x4f')],{'$or':_['map'](_0x577dac,function(_0x1e2b91){if(_0x1e2b91[_0xb75c('0x51')]!==_0xb75c('0x52')){var _0x565b0b={};_0x565b0b[_0x1e2b91['name']]={'$like':'%'+_0xe4111b[_0xb75c('0x43')][_0xb75c('0x4e')]+'%'};return _0x565b0b;}})});}_0x5b30d7=_[_0xb75c('0x50')]({},_0x5b30d7,_0xe4111b['options']);var _0x310f38={'where':_0x5b30d7['where']};return db[_0xb75c('0x3f')][_0xb75c('0x34')](_0x310f38)[_0xb75c('0x24')](function(_0x488a91){_0x246e75[_0xb75c('0x34')]=_0x488a91;if(_0xe4111b['query'][_0xb75c('0x53')]){_0x5b30d7['include']=[{'all':!![]}];}return db[_0xb75c('0x3f')][_0xb75c('0x54')](_0x5b30d7);})['then'](function(_0x53b550){_0x246e75[_0xb75c('0x55')]=_0x53b550;return _0x246e75;})[_0xb75c('0x24')](respondWithFilteredResult(_0x3cfb32,_0x5b30d7))['catch'](handleError(_0x3cfb32,null));};exports[_0xb75c('0x56')]=function(_0xc7fcaa,_0x211f61){var _0x19dd99={'raw':!![],'where':{'id':_0xc7fcaa[_0xb75c('0x57')]['id']}},_0x73418e={};_0x73418e['model']=_[_0xb75c('0x58')](db['WhatsappMessage'][_0xb75c('0x40')]);_0x73418e[_0xb75c('0x43')]=_['keys'](_0xc7fcaa[_0xb75c('0x43')]);_0x73418e[_0xb75c('0x44')]=_[_0xb75c('0x46')](_0x73418e[_0xb75c('0x45')],_0x73418e[_0xb75c('0x43')]);_0x19dd99[_0xb75c('0x48')]=_[_0xb75c('0x46')](_0x73418e[_0xb75c('0x45')],qs[_0xb75c('0x47')](_0xc7fcaa[_0xb75c('0x43')][_0xb75c('0x47')]));_0x19dd99['attributes']=_0x19dd99[_0xb75c('0x48')]['length']?_0x19dd99[_0xb75c('0x48')]:_0x73418e[_0xb75c('0x45')];if(_0xc7fcaa[_0xb75c('0x43')][_0xb75c('0x53')]){_0x19dd99[_0xb75c('0x59')]=[{'all':!![]}];}_0x19dd99=_['merge']({},_0x19dd99,_0xc7fcaa[_0xb75c('0x5a')]);return db[_0xb75c('0x3f')]['find'](_0x19dd99)[_0xb75c('0x24')](handleEntityNotFound(_0x211f61,null))[_0xb75c('0x24')](respondWithResult(_0x211f61,null))['catch'](handleError(_0x211f61,null));};exports[_0xb75c('0x5b')]=function(_0x5ece8c,_0x51f8bc){return db['WhatsappMessage'][_0xb75c('0x5b')](_0x5ece8c[_0xb75c('0x5c')],{})['then'](respondWithResult(_0x51f8bc,0xc9))[_0xb75c('0x5d')](handleError(_0x51f8bc,null));};exports['update']=function(_0x51626f,_0x49af79){if(_0x51626f[_0xb75c('0x5c')]['id']){delete _0x51626f[_0xb75c('0x5c')]['id'];}return db[_0xb75c('0x3f')][_0xb75c('0x5e')]({'where':{'id':_0x51626f[_0xb75c('0x57')]['id']}})[_0xb75c('0x24')](handleEntityNotFound(_0x49af79,null))['then'](saveUpdates(_0x51626f[_0xb75c('0x5c')],null))['then'](respondWithResult(_0x49af79,null))['catch'](handleError(_0x49af79,null));};exports['destroy']=function(_0x6249dc,_0x247b2a){return db['WhatsappMessage'][_0xb75c('0x5e')]({'where':{'id':_0x6249dc[_0xb75c('0x57')]['id']}})['then'](handleEntityNotFound(_0x247b2a,null))['then'](removeEntity(_0x247b2a,null))['catch'](handleError(_0x247b2a,null));};exports['describe']=function(_0x3a7111,_0x562693){return db[_0xb75c('0x3f')][_0xb75c('0x5f')]()[_0xb75c('0x24')](respondWithResult(_0x562693,null))[_0xb75c('0x5d')](handleError(_0x562693,null));};var interaction_log=require('../../config/logger')(_0xb75c('0x60'));exports[_0xb75c('0x61')]=function(_0x1986d8,_0x2997a2,_0x2ccb38){var _0x1caec8={'agent':{},'channel':_0xb75c('0x62')};if(_0x1986d8[_0xb75c('0x5c')]['id']){delete _0x1986d8[_0xb75c('0x5c')]['id'];}_0x1986d8['body']['read']=!![];_0x1986d8[_0xb75c('0x5c')][_0xb75c('0x63')]=moment()[_0xb75c('0x64')](_0xb75c('0x65'));_0x1986d8['body'][_0xb75c('0x66')]=_0x1986d8[_0xb75c('0x5c')][_0xb75c('0x66')]||_0x1986d8[_0xb75c('0x67')]['id'];_0x1caec8[_0xb75c('0x68')]['id']=_0x1986d8[_0xb75c('0x5c')]['UserId'];return db['WhatsappMessage'][_0xb75c('0x5e')]({'where':{'id':_0x1986d8['params']['id'],'UserId':null}})[_0xb75c('0x24')](handleEntityNotFound(_0x2997a2,null))[_0xb75c('0x24')](saveUpdates(_0x1986d8['body'],null))[_0xb75c('0x24')](function(_0xc93e8e){if(_0xc93e8e){_0x1caec8['message']=_0xc93e8e[_0xb75c('0x69')]({'plain':!![]});return db[_0xb75c('0x6a')][_0xb75c('0x5e')]({'where':{'id':_0xc93e8e[_0xb75c('0x6b')]}});}return null;})[_0xb75c('0x24')](handleEntityNotFound(_0x2997a2,null))['then'](function(_0x489857){if(_0x489857){return _0x489857['update']({'UserId':_0x1986d8[_0xb75c('0x5c')][_0xb75c('0x66')],'read1stAt':_[_0xb75c('0x6c')](_0x489857[_0xb75c('0x6d')])?moment()[_0xb75c('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb75c('0x24')](function(_0x51a7de){if(_0x51a7de){_0x1caec8[_0xb75c('0x6e')]=_0x51a7de[_0xb75c('0x69')]({'plain':!![]});interaction_log[_0xb75c('0x25')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1986d8['user']['id'],_0x1986d8[_0xb75c('0x67')][_0xb75c('0x3d')],_0x1986d8[_0xb75c('0x67')][_0xb75c('0x6f')],_0x1caec8[_0xb75c('0x6e')]['id'],_0x1986d8[_0xb75c('0x5c')]?JSON[_0xb75c('0x29')](_0x1986d8[_0xb75c('0x5c')]):'null');return respondWithRpcPromise(_0xb75c('0x70'),_0xb75c('0x71'),_0x1caec8);}return null;})[_0xb75c('0x24')](function(_0x4cbf2a){var _0x5e846a=_0xb75c('0x72')+_0x4cbf2a['message'][_0xb75c('0x73')];return db[_0xb75c('0x74')]['query'](_0x5e846a,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xb75c('0x24')](function(_0x4ddc90){return _0x4ddc90;});})['then'](function(_0x1cd764){if(_0x1cd764){_0x1caec8[_0xb75c('0x2c')]['contact']=_0x1cd764[0x0];if(!_0x1986d8[_0xb75c('0x5c')][_0xb75c('0x66')])return;return db['User'][_0xb75c('0x5e')]({'where':{'id':_0x1986d8[_0xb75c('0x5c')]['UserId'],'role':_0xb75c('0x68')},'attributes':['id','name',_0xb75c('0x75'),'email',_0xb75c('0x76')],'raw':!![]});}return null;})[_0xb75c('0x24')](function(_0x8a07d5){if(!_0x8a07d5)return null;_0x1caec8[_0xb75c('0x2c')][_0xb75c('0x68')]=_0x8a07d5;return _0x1caec8;})[_0xb75c('0x24')](function(_0x2ab1ae){if(_0x2ab1ae){if(_0x1986d8['body'][_0xb75c('0x77')]){_0x1caec8[_0xb75c('0x2c')][_0xb75c('0x78')]=util['format']('SIP/%s',_0x1986d8[_0xb75c('0x67')]['name']);_0x1caec8[_0xb75c('0x2c')][_0xb75c('0x79')]=_0x1caec8['channel'];_0x1caec8[_0xb75c('0x2c')]['motionChannel']=_0x1caec8[_0xb75c('0x79')];_0x1caec8[_0xb75c('0x2c')][_0xb75c('0x7a')]=_0xb75c('0x61');return respondWithRpcPromise(_0xb75c('0x7b'),'EventManager',{'event':_0xb75c('0x7c'),'message':_0x1caec8[_0xb75c('0x2c')]},client9002)[_0xb75c('0x24')](function(){return _0x1caec8;});}return _0x1caec8;}return null;})[_0xb75c('0x24')](respondWithResult(_0x2997a2,null))[_0xb75c('0x5d')](handleError(_0x2997a2,null));};var interaction_log=require('../../config/logger')(_0xb75c('0x60'));exports[_0xb75c('0x39')]=function(_0x26c772,_0x151154,_0x2828da){var _0x31c6ce={'agent':{},'channel':'whatsapp'};if(_0x26c772[_0xb75c('0x5c')]['id']){delete _0x26c772[_0xb75c('0x5c')]['id'];}_0x26c772['body'][_0xb75c('0x66')]=_0x26c772[_0xb75c('0x5c')][_0xb75c('0x66')]||_0x26c772[_0xb75c('0x67')]['id'];_0x31c6ce['agent']['id']=_0x26c772[_0xb75c('0x5c')][_0xb75c('0x66')];return db[_0xb75c('0x3f')][_0xb75c('0x5e')]({'where':{'id':_0x26c772[_0xb75c('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x151154,null))[_0xb75c('0x24')](function(_0x1237de){if(_0x1237de){_0x31c6ce[_0xb75c('0x2c')]=_0x1237de[_0xb75c('0x69')]({'plain':!![]});return db[_0xb75c('0x6a')][_0xb75c('0x5e')]({'where':{'id':_0x1237de[_0xb75c('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x151154,null))[_0xb75c('0x24')](function(_0x343343){if(_0x343343){_0x31c6ce[_0xb75c('0x6e')]=_0x343343[_0xb75c('0x69')]({'plain':!![]});interaction_log[_0xb75c('0x25')](_0xb75c('0x7d'),_0x26c772[_0xb75c('0x67')]['id'],_0x26c772[_0xb75c('0x67')][_0xb75c('0x3d')],_0x26c772[_0xb75c('0x67')]['role'],_0x31c6ce[_0xb75c('0x6e')]['id'],_0x26c772[_0xb75c('0x5c')]?JSON['stringify'](_0x26c772[_0xb75c('0x5c')]):_0xb75c('0x7e'));return respondWithRpcPromise(_0xb75c('0x7f'),'rejectMessage',_0x31c6ce);}return null;})[_0xb75c('0x24')](function(_0x34dc45){var _0x482064='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x34dc45[_0xb75c('0x2c')][_0xb75c('0x73')];return db[_0xb75c('0x74')]['query'](_0x482064,{'type':db[_0xb75c('0x80')][_0xb75c('0x81')]['SELECT'],'raw':!![]})[_0xb75c('0x24')](function(_0x865501){return _0x865501;});})[_0xb75c('0x24')](function(_0x48e746){if(_0x48e746){_0x31c6ce[_0xb75c('0x2c')][_0xb75c('0x82')]=_0x48e746[0x0];if(!_0x26c772['body'][_0xb75c('0x66')])return;return db['User'][_0xb75c('0x5e')]({'where':{'id':_0x26c772['body'][_0xb75c('0x66')],'role':_0xb75c('0x68')},'attributes':['id',_0xb75c('0x3d'),_0xb75c('0x75'),'email',_0xb75c('0x76')],'raw':!![]});}return null;})[_0xb75c('0x24')](function(_0x1879f7){if(!_0x1879f7)return null;_0x31c6ce[_0xb75c('0x2c')][_0xb75c('0x68')]=_0x1879f7;return _0x31c6ce;})['then'](function(_0x9d9ef6){if(_0x9d9ef6){_0x9d9ef6['message'][_0xb75c('0x78')]=util[_0xb75c('0x64')]('SIP/%s',_0x26c772[_0xb75c('0x67')][_0xb75c('0x3d')]);_0x9d9ef6[_0xb75c('0x2c')][_0xb75c('0x79')]=_0x31c6ce['channel'];_0x9d9ef6[_0xb75c('0x2c')][_0xb75c('0x83')]=_0x31c6ce[_0xb75c('0x79')];_0x9d9ef6[_0xb75c('0x2c')]['event']='reject';respondWithRpcPromise(_0xb75c('0x7b'),_0xb75c('0x7b'),{'event':_0xb75c('0x84'),'message':_0x9d9ef6[_0xb75c('0x2c')]},client9002);return _0x31c6ce;}return null;})[_0xb75c('0x24')](respondWithResult(_0x151154,null))[_0xb75c('0x5d')](handleError(_0x151154,null));};exports[_0xb75c('0x2f')]=function(_0x553774,_0x2fcc03,_0x2c2cc8){if(_0x553774[_0xb75c('0x5c')]['id']){delete _0x553774['body']['id'];}var _0x268e00;return db[_0xb75c('0x3f')][_0xb75c('0x5e')]({'where':{'id':_0x553774[_0xb75c('0x57')]['id']}})['then'](handleEntityNotFound(_0x2fcc03,null))['then'](function(_0x265802){if(_0x265802){_0x268e00=_0x265802;return db[_0xb75c('0x85')][_0xb75c('0x5e')]({'where':{'id':_0x265802[_0xb75c('0x86')]}});}})[_0xb75c('0x24')](handleEntityNotFound(_0x2fcc03,null))[_0xb75c('0x24')](function(_0x2b9bd1){if(_0x2b9bd1){logger[_0xb75c('0x28')](_0xb75c('0x87'),'status',_0xb75c('0x88'),_0x2b9bd1[_0xb75c('0x51')],util[_0xb75c('0x89')](_0x553774[_0xb75c('0x5c')],{'showHidden':![],'depth':null}));switch(_0x2b9bd1[_0xb75c('0x51')]){case _0xb75c('0x8a'):if(_0x553774[_0xb75c('0x5c')][_0xb75c('0x8b')]&&_0x553774['body'][_0xb75c('0x8b')]===_0x268e00['messageId']&&_0x553774[_0xb75c('0x5c')][_0xb75c('0x8c')]&&_0x553774['body'][_0xb75c('0x8c')]===_0xb75c('0x8d')){return _0x268e00['update']({'read':!![]});}else{logger[_0xb75c('0x2a')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xb75c('0x2f'),'twilio',util[_0xb75c('0x89')](_0x553774[_0xb75c('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x268e00;}})[_0xb75c('0x24')](respondWithResult(_0x2fcc03,null))[_0xb75c('0x5d')](handleError(_0x2fcc03,null));}; \ No newline at end of file +var _0xb859=['zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','then','destroy','name','send','index','map','WhatsappMessage','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','create','body','describe','../../config/logger','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','update','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','SIP/%s','channel','event','accept','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','fullname','internal','motionChannel','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf'];(function(_0x5f3072,_0x73328b){var _0x47f631=function(_0x2262a2){while(--_0x2262a2){_0x5f3072['push'](_0x5f3072['shift']());}};_0x47f631(++_0x73328b);}(_0xb859,0x19a));var _0x9b85=function(_0x4ef826,_0x2e0ac8){_0x4ef826=_0x4ef826-0x0;var _0x154b8=_0xb859[_0x4ef826];return _0x154b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b85('0x0'));var zipdir=require(_0x9b85('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9b85('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9b85('0x3'));var util=require(_0x9b85('0x4'));var path=require(_0x9b85('0x5'));var sox=require(_0x9b85('0x6'));var csv=require(_0x9b85('0x7'));var ejs=require(_0x9b85('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b85('0x9'));var squel=require(_0x9b85('0xa'));var crypto=require('crypto');var jsforce=require(_0x9b85('0xb'));var deskjs=require(_0x9b85('0xc'));var toCsv=require(_0x9b85('0x7'));var querystring=require('querystring');var Papa=require(_0x9b85('0xd'));var Redis=require(_0x9b85('0xe'));var authService=require(_0x9b85('0xf'));var qs=require(_0x9b85('0x10'));var as=require(_0x9b85('0x11'));var hardwareService=require(_0x9b85('0x12'));var logger=require('../../config/logger')(_0x9b85('0x13'));var utils=require('../../config/utils');var config=require(_0x9b85('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b85('0x15'))['db'];config[_0x9b85('0x16')]=_[_0x9b85('0x17')](config[_0x9b85('0x16')],{'host':_0x9b85('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x9b85('0x19'));var client=jayson[_0x9b85('0x1a')][_0x9b85('0x1b')]({'port':0x232c});var client9002=jayson[_0x9b85('0x1a')][_0x9b85('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x97cece,_0x2b309a,_0x1196b5,_0x5a95ba){return new BPromise(function(_0x29f97a,_0x101c57){var _0x436cee=_0x5a95ba||client;return _0x436cee[_0x9b85('0x1c')](_0x97cece,_0x1196b5)['then'](function(_0x23eea8){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x2b309a,_0x9b85('0x1d'));logger[_0x9b85('0x1e')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2b309a,_0x9b85('0x1d'),JSON[_0x9b85('0x1f')](_0x23eea8));if(_0x23eea8[_0x9b85('0x20')]){if(_0x23eea8[_0x9b85('0x20')][_0x9b85('0x21')]===0x1f4){logger[_0x9b85('0x20')](_0x9b85('0x22'),_0x2b309a,_0x23eea8[_0x9b85('0x20')][_0x9b85('0x23')]);return _0x101c57(_0x23eea8[_0x9b85('0x20')][_0x9b85('0x23')]);}logger[_0x9b85('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x2b309a,_0x23eea8[_0x9b85('0x20')]['message']);return _0x29f97a(_0x23eea8['error'][_0x9b85('0x23')]);}else{logger[_0x9b85('0x24')](_0x9b85('0x22'),_0x2b309a,_0x9b85('0x1d'));_0x29f97a(_0x23eea8[_0x9b85('0x25')][_0x9b85('0x23')]);}})[_0x9b85('0x26')](function(_0x53a98e){logger[_0x9b85('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x2b309a,_0x53a98e);_0x101c57(_0x53a98e);});});}function respondWithStatusCode(_0x363486,_0x36730f){_0x36730f=_0x36730f||0xcc;return function(_0x243961){if(_0x243961){return _0x363486[_0x9b85('0x27')](_0x36730f);}return _0x363486[_0x9b85('0x28')](_0x36730f)[_0x9b85('0x29')]();};}function respondWithResult(_0x2d6440,_0x5420c2){_0x5420c2=_0x5420c2||0xc8;return function(_0x355d92){if(_0x355d92){return _0x2d6440[_0x9b85('0x28')](_0x5420c2)['json'](_0x355d92);}};}function respondWithFilteredResult(_0x49b517,_0x46922d){return function(_0x3718e8){if(_0x3718e8){var _0x5dcfc4=typeof _0x46922d[_0x9b85('0x2a')]===_0x9b85('0x2b')&&typeof _0x46922d[_0x9b85('0x2c')]===_0x9b85('0x2b');var _0x324ae5=_0x3718e8['count'];var _0x5e5ae9=_0x5dcfc4?0x0:_0x46922d[_0x9b85('0x2a')];var _0x566750=_0x5dcfc4?_0x3718e8[_0x9b85('0x2d')]:_0x46922d[_0x9b85('0x2a')]+_0x46922d[_0x9b85('0x2c')];var _0x136621;if(_0x566750>=_0x324ae5){_0x566750=_0x324ae5;_0x136621=0xc8;}else{_0x136621=0xce;}_0x49b517[_0x9b85('0x28')](_0x136621);return _0x49b517[_0x9b85('0x2e')]('Content-Range',_0x5e5ae9+'-'+_0x566750+'/'+_0x324ae5)[_0x9b85('0x2f')](_0x3718e8);}return null;};}function patchUpdates(_0x1b2ebe){return function(_0x8877e5){try{jsonpatch['apply'](_0x8877e5,_0x1b2ebe,!![]);}catch(_0x41d2dc){return BPromise[_0x9b85('0x30')](_0x41d2dc);}return _0x8877e5[_0x9b85('0x31')]();};}function saveUpdates(_0x231b15,_0x4ecdf0){return function(_0x452f61){if(_0x452f61){return _0x452f61['update'](_0x231b15)[_0x9b85('0x32')](function(_0x1b85b3){return _0x1b85b3;});}return null;};}function removeEntity(_0x5d2513,_0x27594a){return function(_0x41136f){if(_0x41136f){return _0x41136f[_0x9b85('0x33')]()[_0x9b85('0x32')](function(){_0x5d2513['status'](0xcc)[_0x9b85('0x29')]();});}};}function handleEntityNotFound(_0x1c21c3,_0x4f5694){return function(_0x146630){if(!_0x146630){_0x1c21c3['sendStatus'](0x194);}return _0x146630;};}function handleError(_0x23aa60,_0x51cb26){_0x51cb26=_0x51cb26||0x1f4;return function(_0x4b206b){logger[_0x9b85('0x20')](_0x4b206b['stack']);if(_0x4b206b[_0x9b85('0x34')]){delete _0x4b206b[_0x9b85('0x34')];}_0x23aa60['status'](_0x51cb26)[_0x9b85('0x35')](_0x4b206b);};}exports[_0x9b85('0x36')]=function(_0x62cecd,_0x203ad1){var _0x21b93d={},_0x14a2da={},_0x5f310d={'count':0x0,'rows':[]};var _0x30e26e=_[_0x9b85('0x37')](db[_0x9b85('0x38')]['rawAttributes'],function(_0x9b964a){return{'name':_0x9b964a[_0x9b85('0x39')],'type':_0x9b964a['type']['key']};});_0x14a2da[_0x9b85('0x3a')]=_[_0x9b85('0x37')](_0x30e26e,'name');_0x14a2da[_0x9b85('0x3b')]=_['keys'](_0x62cecd[_0x9b85('0x3b')]);_0x14a2da[_0x9b85('0x3c')]=_[_0x9b85('0x3d')](_0x14a2da[_0x9b85('0x3a')],_0x14a2da[_0x9b85('0x3b')]);_0x21b93d[_0x9b85('0x3e')]=_[_0x9b85('0x3d')](_0x14a2da[_0x9b85('0x3a')],qs['fields'](_0x62cecd[_0x9b85('0x3b')][_0x9b85('0x3f')]));_0x21b93d[_0x9b85('0x3e')]=_0x21b93d['attributes'][_0x9b85('0x40')]?_0x21b93d['attributes']:_0x14a2da[_0x9b85('0x3a')];if(!_0x62cecd[_0x9b85('0x3b')][_0x9b85('0x41')](_0x9b85('0x42'))){_0x21b93d[_0x9b85('0x2c')]=qs[_0x9b85('0x2c')](_0x62cecd[_0x9b85('0x3b')]['limit']);_0x21b93d['offset']=qs[_0x9b85('0x2a')](_0x62cecd['query'][_0x9b85('0x2a')]);}_0x21b93d[_0x9b85('0x43')]=qs[_0x9b85('0x44')](_0x62cecd[_0x9b85('0x3b')][_0x9b85('0x44')]);_0x21b93d[_0x9b85('0x45')]=qs[_0x9b85('0x3c')](_[_0x9b85('0x46')](_0x62cecd[_0x9b85('0x3b')],_0x14a2da['filters']),_0x30e26e);if(_0x62cecd[_0x9b85('0x3b')][_0x9b85('0x47')]){_0x21b93d[_0x9b85('0x45')]=_[_0x9b85('0x48')](_0x21b93d[_0x9b85('0x45')],{'$or':_[_0x9b85('0x37')](_0x30e26e,function(_0x1355af){if(_0x1355af[_0x9b85('0x49')]!==_0x9b85('0x4a')){var _0x3a74a6={};_0x3a74a6[_0x1355af[_0x9b85('0x34')]]={'$like':'%'+_0x62cecd['query']['filter']+'%'};return _0x3a74a6;}})});}_0x21b93d=_[_0x9b85('0x48')]({},_0x21b93d,_0x62cecd[_0x9b85('0x4b')]);var _0x397631={'where':_0x21b93d[_0x9b85('0x45')]};return db[_0x9b85('0x38')][_0x9b85('0x2d')](_0x397631)[_0x9b85('0x32')](function(_0x4aed65){_0x5f310d[_0x9b85('0x2d')]=_0x4aed65;if(_0x62cecd[_0x9b85('0x3b')][_0x9b85('0x4c')]){_0x21b93d[_0x9b85('0x4d')]=[{'all':!![]}];}return db[_0x9b85('0x38')][_0x9b85('0x4e')](_0x21b93d);})[_0x9b85('0x32')](function(_0x5f2005){_0x5f310d['rows']=_0x5f2005;return _0x5f310d;})['then'](respondWithFilteredResult(_0x203ad1,_0x21b93d))[_0x9b85('0x26')](handleError(_0x203ad1,null));};exports[_0x9b85('0x4f')]=function(_0x307a16,_0x1f3d9c){var _0xc67ea7={'raw':!![],'where':{'id':_0x307a16[_0x9b85('0x50')]['id']}},_0x6ec20c={};_0x6ec20c[_0x9b85('0x3a')]=_[_0x9b85('0x51')](db['WhatsappMessage']['rawAttributes']);_0x6ec20c[_0x9b85('0x3b')]=_['keys'](_0x307a16['query']);_0x6ec20c[_0x9b85('0x3c')]=_['intersection'](_0x6ec20c['model'],_0x6ec20c['query']);_0xc67ea7[_0x9b85('0x3e')]=_[_0x9b85('0x3d')](_0x6ec20c[_0x9b85('0x3a')],qs[_0x9b85('0x3f')](_0x307a16[_0x9b85('0x3b')][_0x9b85('0x3f')]));_0xc67ea7['attributes']=_0xc67ea7[_0x9b85('0x3e')][_0x9b85('0x40')]?_0xc67ea7[_0x9b85('0x3e')]:_0x6ec20c[_0x9b85('0x3a')];if(_0x307a16[_0x9b85('0x3b')][_0x9b85('0x4c')]){_0xc67ea7[_0x9b85('0x4d')]=[{'all':!![]}];}_0xc67ea7=_[_0x9b85('0x48')]({},_0xc67ea7,_0x307a16[_0x9b85('0x4b')]);return db[_0x9b85('0x38')][_0x9b85('0x52')](_0xc67ea7)[_0x9b85('0x32')](handleEntityNotFound(_0x1f3d9c,null))[_0x9b85('0x32')](respondWithResult(_0x1f3d9c,null))['catch'](handleError(_0x1f3d9c,null));};exports[_0x9b85('0x53')]=function(_0x4f044d,_0x439490){return db[_0x9b85('0x38')][_0x9b85('0x53')](_0x4f044d['body'],{})[_0x9b85('0x32')](respondWithResult(_0x439490,0xc9))[_0x9b85('0x26')](handleError(_0x439490,null));};exports['update']=function(_0x3a3cf6,_0x555b8c){if(_0x3a3cf6[_0x9b85('0x54')]['id']){delete _0x3a3cf6[_0x9b85('0x54')]['id'];}return db[_0x9b85('0x38')]['find']({'where':{'id':_0x3a3cf6[_0x9b85('0x50')]['id']}})[_0x9b85('0x32')](handleEntityNotFound(_0x555b8c,null))[_0x9b85('0x32')](saveUpdates(_0x3a3cf6[_0x9b85('0x54')],null))[_0x9b85('0x32')](respondWithResult(_0x555b8c,null))[_0x9b85('0x26')](handleError(_0x555b8c,null));};exports[_0x9b85('0x33')]=function(_0x180374,_0x9df928){return db['WhatsappMessage'][_0x9b85('0x52')]({'where':{'id':_0x180374[_0x9b85('0x50')]['id']}})['then'](handleEntityNotFound(_0x9df928,null))['then'](removeEntity(_0x9df928,null))[_0x9b85('0x26')](handleError(_0x9df928,null));};exports[_0x9b85('0x55')]=function(_0xbc1b86,_0x4eddea){return db[_0x9b85('0x38')][_0x9b85('0x55')]()[_0x9b85('0x32')](respondWithResult(_0x4eddea,null))[_0x9b85('0x26')](handleError(_0x4eddea,null));};var interaction_log=require(_0x9b85('0x56'))(_0x9b85('0x57'));exports['accept']=function(_0x14dc9f,_0x4e952c,_0x201dff){var _0x3641b2={'agent':{},'channel':_0x9b85('0x58')};if(_0x14dc9f[_0x9b85('0x54')]['id']){delete _0x14dc9f[_0x9b85('0x54')]['id'];}_0x14dc9f[_0x9b85('0x54')][_0x9b85('0x59')]=!![];_0x14dc9f['body'][_0x9b85('0x5a')]=moment()[_0x9b85('0x5b')](_0x9b85('0x5c'));_0x14dc9f['body'][_0x9b85('0x5d')]=_0x14dc9f[_0x9b85('0x54')][_0x9b85('0x5d')]||_0x14dc9f[_0x9b85('0x5e')]['id'];_0x3641b2[_0x9b85('0x5f')]['id']=_0x14dc9f[_0x9b85('0x54')]['UserId'];return db[_0x9b85('0x38')][_0x9b85('0x52')]({'where':{'id':_0x14dc9f[_0x9b85('0x50')]['id'],'UserId':null}})[_0x9b85('0x32')](handleEntityNotFound(_0x4e952c,null))[_0x9b85('0x32')](saveUpdates(_0x14dc9f[_0x9b85('0x54')],null))[_0x9b85('0x32')](function(_0x346440){if(_0x346440){_0x3641b2['message']=_0x346440[_0x9b85('0x60')]({'plain':!![]});return db[_0x9b85('0x61')][_0x9b85('0x52')]({'where':{'id':_0x346440[_0x9b85('0x62')]}});}return null;})[_0x9b85('0x32')](handleEntityNotFound(_0x4e952c,null))[_0x9b85('0x32')](function(_0x489cdf){if(_0x489cdf){return _0x489cdf[_0x9b85('0x63')]({'UserId':_0x14dc9f[_0x9b85('0x54')][_0x9b85('0x5d')],'read1stAt':_['isNil'](_0x489cdf[_0x9b85('0x64')])?moment()['format'](_0x9b85('0x5c')):undefined});}return null;})[_0x9b85('0x32')](function(_0x1a4051){if(_0x1a4051){_0x3641b2[_0x9b85('0x65')]=_0x1a4051[_0x9b85('0x60')]({'plain':!![]});interaction_log[_0x9b85('0x24')](_0x9b85('0x66'),_0x14dc9f['user']['id'],_0x14dc9f[_0x9b85('0x5e')]['name'],_0x14dc9f['user']['role'],_0x3641b2[_0x9b85('0x65')]['id'],_0x14dc9f['body']?JSON[_0x9b85('0x1f')](_0x14dc9f[_0x9b85('0x54')]):_0x9b85('0x67'));return respondWithRpcPromise(_0x9b85('0x68'),_0x9b85('0x69'),_0x3641b2);}return null;})[_0x9b85('0x32')](function(_0x4edc40){var _0x5d6a73=_0x9b85('0x6a')+_0x4edc40[_0x9b85('0x23')][_0x9b85('0x6b')];return db[_0x9b85('0x6c')][_0x9b85('0x3b')](_0x5d6a73,{'type':db['Sequelize'][_0x9b85('0x6d')][_0x9b85('0x6e')],'raw':!![]})['then'](function(_0x4f2000){return _0x4f2000;});})['then'](function(_0x2276dd){if(_0x2276dd){_0x3641b2[_0x9b85('0x23')][_0x9b85('0x6f')]=_0x2276dd[0x0];if(!_0x14dc9f[_0x9b85('0x54')]['UserId'])return;return db[_0x9b85('0x70')][_0x9b85('0x52')]({'where':{'id':_0x14dc9f['body']['UserId'],'role':_0x9b85('0x5f')},'attributes':['id',_0x9b85('0x34'),'fullname',_0x9b85('0x71'),'internal'],'raw':!![]});}return null;})[_0x9b85('0x32')](function(_0x67377b){if(!_0x67377b)return null;_0x3641b2[_0x9b85('0x23')][_0x9b85('0x5f')]=_0x67377b;return _0x3641b2;})['then'](function(_0x2d915e){if(_0x2d915e){if(_0x14dc9f[_0x9b85('0x54')]['manual']){_0x3641b2[_0x9b85('0x23')]['interface']=util[_0x9b85('0x5b')](_0x9b85('0x72'),_0x14dc9f[_0x9b85('0x5e')][_0x9b85('0x34')]);_0x3641b2['message']['channel']=_0x3641b2[_0x9b85('0x73')];_0x3641b2[_0x9b85('0x23')]['motionChannel']=_0x3641b2['channel'];_0x3641b2['message'][_0x9b85('0x74')]=_0x9b85('0x75');return respondWithRpcPromise(_0x9b85('0x76'),_0x9b85('0x76'),{'event':_0x9b85('0x77'),'message':_0x3641b2['message']},client9002)['then'](function(){return _0x3641b2;});}return _0x3641b2;}return null;})[_0x9b85('0x32')](respondWithResult(_0x4e952c,null))[_0x9b85('0x26')](handleError(_0x4e952c,null));};var interaction_log=require(_0x9b85('0x56'))(_0x9b85('0x57'));exports['reject']=function(_0x4e5d5c,_0x721e72,_0x1a4525){var _0x2fddf9={'agent':{},'channel':_0x9b85('0x58')};if(_0x4e5d5c[_0x9b85('0x54')]['id']){delete _0x4e5d5c[_0x9b85('0x54')]['id'];}_0x4e5d5c[_0x9b85('0x54')][_0x9b85('0x5d')]=_0x4e5d5c[_0x9b85('0x54')][_0x9b85('0x5d')]||_0x4e5d5c['user']['id'];_0x2fddf9['agent']['id']=_0x4e5d5c[_0x9b85('0x54')][_0x9b85('0x5d')];return db[_0x9b85('0x38')]['find']({'where':{'id':_0x4e5d5c[_0x9b85('0x50')]['id'],'UserId':null}})[_0x9b85('0x32')](handleEntityNotFound(_0x721e72,null))[_0x9b85('0x32')](function(_0x5a90b2){if(_0x5a90b2){_0x2fddf9[_0x9b85('0x23')]=_0x5a90b2[_0x9b85('0x60')]({'plain':!![]});return db[_0x9b85('0x61')][_0x9b85('0x52')]({'where':{'id':_0x5a90b2['WhatsappInteractionId']}});}return null;})[_0x9b85('0x32')](handleEntityNotFound(_0x721e72,null))[_0x9b85('0x32')](function(_0x11302a){if(_0x11302a){_0x2fddf9[_0x9b85('0x65')]=_0x11302a[_0x9b85('0x60')]({'plain':!![]});interaction_log['info'](_0x9b85('0x78'),_0x4e5d5c[_0x9b85('0x5e')]['id'],_0x4e5d5c[_0x9b85('0x5e')]['name'],_0x4e5d5c[_0x9b85('0x5e')]['role'],_0x2fddf9['interaction']['id'],_0x4e5d5c['body']?JSON[_0x9b85('0x1f')](_0x4e5d5c[_0x9b85('0x54')]):'null');return respondWithRpcPromise(_0x9b85('0x79'),_0x9b85('0x7a'),_0x2fddf9);}return null;})[_0x9b85('0x32')](function(_0x3b5551){var _0x6fbda6=_0x9b85('0x6a')+_0x3b5551[_0x9b85('0x23')][_0x9b85('0x6b')];return db[_0x9b85('0x6c')][_0x9b85('0x3b')](_0x6fbda6,{'type':db[_0x9b85('0x7b')][_0x9b85('0x6d')][_0x9b85('0x6e')],'raw':!![]})[_0x9b85('0x32')](function(_0x74727a){return _0x74727a;});})[_0x9b85('0x32')](function(_0xce9051){if(_0xce9051){_0x2fddf9[_0x9b85('0x23')][_0x9b85('0x6f')]=_0xce9051[0x0];if(!_0x4e5d5c[_0x9b85('0x54')]['UserId'])return;return db[_0x9b85('0x70')]['find']({'where':{'id':_0x4e5d5c['body']['UserId'],'role':_0x9b85('0x5f')},'attributes':['id',_0x9b85('0x34'),_0x9b85('0x7c'),_0x9b85('0x71'),_0x9b85('0x7d')],'raw':!![]});}return null;})[_0x9b85('0x32')](function(_0x30f1a8){if(!_0x30f1a8)return null;_0x2fddf9[_0x9b85('0x23')]['agent']=_0x30f1a8;return _0x2fddf9;})[_0x9b85('0x32')](function(_0x3bbfb9){if(_0x3bbfb9){_0x3bbfb9[_0x9b85('0x23')]['interface']=util['format']('SIP/%s',_0x4e5d5c[_0x9b85('0x5e')][_0x9b85('0x34')]);_0x3bbfb9[_0x9b85('0x23')][_0x9b85('0x73')]=_0x2fddf9['channel'];_0x3bbfb9[_0x9b85('0x23')][_0x9b85('0x7e')]=_0x2fddf9[_0x9b85('0x73')];_0x3bbfb9[_0x9b85('0x23')][_0x9b85('0x74')]=_0x9b85('0x30');respondWithRpcPromise(_0x9b85('0x76'),_0x9b85('0x76'),{'event':_0x9b85('0x7f'),'message':_0x3bbfb9['message']},client9002);return _0x2fddf9;}return null;})[_0x9b85('0x32')](respondWithResult(_0x721e72,null))['catch'](handleError(_0x721e72,null));};exports[_0x9b85('0x28')]=function(_0x20d270,_0x2e4479,_0x37cb94){if(_0x20d270[_0x9b85('0x54')]['id']){delete _0x20d270[_0x9b85('0x54')]['id'];}var _0xf7e5d0;return db[_0x9b85('0x38')][_0x9b85('0x52')]({'where':{'id':_0x20d270[_0x9b85('0x50')]['id']}})[_0x9b85('0x32')](handleEntityNotFound(_0x2e4479,null))['then'](function(_0xb1a139){if(_0xb1a139){_0xf7e5d0=_0xb1a139;return db[_0x9b85('0x80')]['find']({'where':{'id':_0xb1a139['WhatsappAccountId']}});}})[_0x9b85('0x32')](handleEntityNotFound(_0x2e4479,null))[_0x9b85('0x32')](function(_0x4b55a1){if(_0x4b55a1){logger[_0x9b85('0x1e')](_0x9b85('0x81'),_0x9b85('0x28'),_0x9b85('0x82'),_0x4b55a1[_0x9b85('0x49')],util[_0x9b85('0x83')](_0x20d270[_0x9b85('0x54')],{'showHidden':![],'depth':null}));switch(_0x4b55a1['type']){case _0x9b85('0x84'):if(_0x20d270[_0x9b85('0x54')][_0x9b85('0x85')]&&_0x20d270[_0x9b85('0x54')][_0x9b85('0x85')]===_0xf7e5d0[_0x9b85('0x86')]&&_0x20d270['body'][_0x9b85('0x87')]&&_0x20d270[_0x9b85('0x54')][_0x9b85('0x87')]==='read'){return _0xf7e5d0['update']({'read':!![]});}else{logger['error'](_0x9b85('0x88'),'status',_0x9b85('0x84'),util[_0x9b85('0x83')](_0x20d270[_0x9b85('0x54')],{'showHidden':![],'depth':null}));}break;}return _0xf7e5d0;}})[_0x9b85('0x32')](respondWithResult(_0x2e4479,null))[_0x9b85('0x26')](handleError(_0x2e4479,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index db322d9..04c6878 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 _0xb248=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','WhatsappMessage'];(function(_0x559f1b,_0x26e76d){var _0x35eb38=function(_0x3f4e1c){while(--_0x3f4e1c){_0x559f1b['push'](_0x559f1b['shift']());}};_0x35eb38(++_0x26e76d);}(_0xb248,0xc6));var _0x8b24=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb248[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0x8b24('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x8b24('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8b24('0x2')](0x0);var events={'afterCreate':_0x8b24('0x3'),'afterUpdate':_0x8b24('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ea760){return function(_0x4438f7,_0x5d4103,_0x253441){WhatsappMessageEvents[_0x8b24('0x5')](_0x1ea760+':'+_0x4438f7['id'],_0x4438f7);WhatsappMessageEvents['emit'](_0x1ea760,_0x4438f7);_0x253441(null);};}for(var e in events){if(events[_0x8b24('0x6')](e)){var event=events[e];WhatsappMessage[_0x8b24('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x6cb4=['update','remove','emit','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x606a54,_0x3b6d20){var _0x3d5174=function(_0x1fd67d){while(--_0x1fd67d){_0x606a54['push'](_0x606a54['shift']());}};_0x3d5174(++_0x3b6d20);}(_0x6cb4,0xff));var _0x46cb=function(_0x2fe3ce,_0x1c170a){_0x2fe3ce=_0x2fe3ce-0x0;var _0x1e6243=_0x6cb4[_0x2fe3ce];return _0x1e6243;};'use strict';var EventEmitter=require(_0x46cb('0x0'));var WhatsappMessage=require(_0x46cb('0x1'))['db'][_0x46cb('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x46cb('0x3')](0x0);var events={'afterCreate':_0x46cb('0x4'),'afterUpdate':_0x46cb('0x5'),'afterDestroy':_0x46cb('0x6')};function emitEvent(_0x786ab7){return function(_0x2efd19,_0x5032a4,_0x1a3fe4){WhatsappMessageEvents['emit'](_0x786ab7+':'+_0x2efd19['id'],_0x2efd19);WhatsappMessageEvents[_0x46cb('0x7')](_0x786ab7,_0x2efd19);_0x1a3fe4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x46cb('0x8')](e,emitEvent(event));}}module[_0x46cb('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 5d2f109..71eb4cc 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 _0x80a1=['toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','create','body','whatsapp:','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','POST','application/json','statuses','message_id','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','models','get','direction'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0x80a1,0x185));var _0x180a=function(_0x1aea16,_0x461e2d){_0x1aea16=_0x1aea16-0x0;var _0x1f622c=_0x80a1[_0x1aea16];return _0x1f622c;};'use strict';var _=require(_0x180a('0x0'));var util=require('util');var logger=require(_0x180a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x180a('0x2'));var rp=require(_0x180a('0x3'));var fetch=require(_0x180a('0x4'));var fs=require('fs');var path=require(_0x180a('0x5'));var rimraf=require(_0x180a('0x6'));var config=require(_0x180a('0x7'));var attributes=require(_0x180a('0x8'));module[_0x180a('0x9')]=function(_0x471bb2,_0xc74f6){return _0x471bb2[_0x180a('0xa')]('WhatsappMessage',attributes,{'tableName':_0x180a('0xb'),'paranoid':![],'indexes':[{'name':_0x180a('0xc'),'fields':[_0x180a('0xc')]},{'name':_0x180a('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bb317,_0x370c3c,_0x2cfdbd){var _0x53a40e=_0x471bb2[_0x180a('0xe')];var _0x2ae454=_0x1bb317[_0x180a('0xf')]({'plain':!![]});if(_0x2ae454[_0x180a('0x10')][_0x180a('0x11')]()==='in'||_0x2ae454[_0x180a('0x10')][_0x180a('0x11')]()===_0x180a('0x12')&&!_0x2ae454['secret']&&!_[_0x180a('0x13')](_0x2ae454[_0x180a('0x14')])){_0x53a40e[_0x180a('0x15')][_0x180a('0x16')]({'where':{'id':_0x2ae454[_0x180a('0x17')]}})[_0x180a('0x18')](function(_0x28d391){if(_0x28d391){_0x28d391[_0x180a('0x19')]({'lastMsgAt':_0x2ae454[_0x180a('0x1a')],'lastMsgDirection':_0x2ae454[_0x180a('0x10')][_0x180a('0x11')]()});}})[_0x180a('0x1b')](function(_0x18c491){console['error'](_0x18c491);});}if(_0x2ae454[_0x180a('0x10')]===_0x180a('0x12')&&!_0x2ae454[_0x180a('0x1c')]){var _0x488cae;_0x53a40e[_0x180a('0x1d')][_0x180a('0x1e')]({'where':{'id':_0x2ae454[_0x180a('0x1f')]},'raw':!![]})[_0x180a('0x18')](function(_0x2ae3a0){_0x488cae=_0x2ae3a0;if(_0x488cae&&_0x488cae[_0x180a('0x20')]){switch(_0x488cae['type']){case _0x180a('0x21'):var _0x1f9522=require(_0x180a('0x21'));if(_0x488cae['accountSid']&&_0x488cae[_0x180a('0x22')]&&_0x488cae[_0x180a('0x23')]){var _0x1f2e49=new _0x1f9522(_0x488cae[_0x180a('0x24')],_0x488cae[_0x180a('0x22')]);_0x1f2e49['messages'][_0x180a('0x25')]({'body':_0x2ae454[_0x180a('0x26')],'to':_0x180a('0x27')+_0x2ae454[_0x180a('0x23')],'from':_0x180a('0x27')+_0x488cae[_0x180a('0x23')],'statusCallback':_0x488cae['remote']+'/api/whatsapp/messages/'+_0x2ae454['id']+_0x180a('0x28')+_0x488cae['token']})[_0x180a('0x18')](function(_0x1e50f8){if(_0x1e50f8[_0x180a('0x29')]){return _0x1bb317['update']({'messageId':_0x1e50f8[_0x180a('0x29')]});}})[_0x180a('0x1b')](function(_0x313138){logger['error'](_0x180a('0x2a'),_0x180a('0x2b'),_0x180a('0x21'),util[_0x180a('0x2c')](_0x313138,{'showHidden':![],'depth':null}));});}else{logger[_0x180a('0x2d')](_0x180a('0x2a'),_0x180a('0x2b'),'twilio',_0x180a('0x2e'));}break;case _0x180a('0x2f'):var _0xa606f5=_0x488cae['accountSid'];var _0x265dde=_0x488cae[_0x180a('0x22')];var _0x466362=_0x488cae[_0x180a('0x30')]+'/whatsapp/v1/'+_0xa606f5+_0x180a('0x31');var _0x311821={'to':[_0x2ae454['phone']],'message':{'type':_0x180a('0x32'),'text':_0x2ae454[_0x180a('0x26')]}};var _0xd9884f={'method':_0x180a('0x33'),'uri':_0x466362,'headers':{'Authorization':'Bearer\x20'+_0x265dde,'Content-Type':_0x180a('0x34')},'body':_0x311821,'json':!![]};rp(_0xd9884f)['then'](function(_0x5316d9){if(_0x5316d9[_0x180a('0x35')][0x0][_0x180a('0x36')]){return _0x1bb317[_0x180a('0x19')]({'messageId':_0x5316d9['statuses'][0x0]['message_id']});}})[_0x180a('0x1b')](function(_0x527c75){logger['err'](_0x180a('0x37'),_0x527c75);});break;}}})['finally'](function(){_0x2cfdbd();});}else{_0x2cfdbd();}}},'charset':_0x180a('0x38'),'collate':_0x180a('0x39')});}; \ No newline at end of file +var _0x7259=['type','twilio','authToken','phone','accountSid','messages','body','remote','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','node-fetch','path','rimraf','exports','define','whatsapp_messages','fti_whatsapp_messages','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','then','update','error','out','WhatsappAccount','find'];(function(_0x46c59b,_0x5635dd){var _0x16dd2d=function(_0x4e7378){while(--_0x4e7378){_0x46c59b['push'](_0x46c59b['shift']());}};_0x16dd2d(++_0x5635dd);}(_0x7259,0xee));var _0x9725=function(_0x2f5a49,_0x535d9d){_0x2f5a49=_0x2f5a49-0x0;var _0x338927=_0x7259[_0x2f5a49];return _0x338927;};'use strict';var _=require(_0x9725('0x0'));var util=require(_0x9725('0x1'));var logger=require(_0x9725('0x2'))(_0x9725('0x3'));var moment=require(_0x9725('0x4'));var BPromise=require(_0x9725('0x5'));var rp=require('request-promise');var fetch=require(_0x9725('0x6'));var fs=require('fs');var path=require(_0x9725('0x7'));var rimraf=require(_0x9725('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x9725('0x9')]=function(_0x77d44b,_0x5cb3dc){return _0x77d44b[_0x9725('0xa')]('WhatsappMessage',attributes,{'tableName':_0x9725('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x9725('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3548b2,_0x318fd4,_0x5d37cd){var _0x3d6203=_0x77d44b[_0x9725('0xd')];var _0x4bc708=_0x3548b2[_0x9725('0xe')]({'plain':!![]});if(_0x4bc708[_0x9725('0xf')][_0x9725('0x10')]()==='in'||_0x4bc708[_0x9725('0xf')][_0x9725('0x10')]()==='out'&&!_0x4bc708[_0x9725('0x11')]&&!_[_0x9725('0x12')](_0x4bc708[_0x9725('0x13')])){_0x3d6203['WhatsappInteraction'][_0x9725('0x14')]({'where':{'id':_0x4bc708['WhatsappInteractionId']}})[_0x9725('0x15')](function(_0x2f491f){if(_0x2f491f){_0x2f491f[_0x9725('0x16')]({'lastMsgAt':_0x4bc708['createdAt'],'lastMsgDirection':_0x4bc708[_0x9725('0xf')][_0x9725('0x10')]()});}})['catch'](function(_0x1198b2){console[_0x9725('0x17')](_0x1198b2);});}if(_0x4bc708[_0x9725('0xf')]===_0x9725('0x18')&&!_0x4bc708[_0x9725('0x11')]){var _0x50cc52;_0x3d6203[_0x9725('0x19')][_0x9725('0x1a')]({'where':{'id':_0x4bc708['WhatsappAccountId']},'raw':!![]})['then'](function(_0x64a61e){_0x50cc52=_0x64a61e;if(_0x50cc52&&_0x50cc52[_0x9725('0x1b')]){switch(_0x50cc52[_0x9725('0x1b')]){case _0x9725('0x1c'):var _0x15f43d=require('twilio');if(_0x50cc52['accountSid']&&_0x50cc52[_0x9725('0x1d')]&&_0x50cc52[_0x9725('0x1e')]){var _0x5e0a2a=new _0x15f43d(_0x50cc52[_0x9725('0x1f')],_0x50cc52[_0x9725('0x1d')]);_0x5e0a2a[_0x9725('0x20')]['create']({'body':_0x4bc708[_0x9725('0x21')],'to':'whatsapp:'+_0x4bc708['phone'],'from':'whatsapp:'+_0x50cc52['phone'],'statusCallback':_0x50cc52[_0x9725('0x22')]+'/api/whatsapp/messages/'+_0x4bc708['id']+_0x9725('0x23')+_0x50cc52['token']})[_0x9725('0x15')](function(_0x115234){if(_0x115234[_0x9725('0x24')]){return _0x3548b2[_0x9725('0x16')]({'messageId':_0x115234['sid']});}})[_0x9725('0x25')](function(_0x16090e){logger[_0x9725('0x17')](_0x9725('0x26'),'afterCreate',_0x9725('0x1c'),util[_0x9725('0x27')](_0x16090e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9725('0x26'),_0x9725('0x28'),_0x9725('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x3eb642=_0x50cc52['accountSid'];var _0x5e3f5c=_0x50cc52[_0x9725('0x1d')];var _0x4707fd=_0x50cc52[_0x9725('0x29')]+_0x9725('0x2a')+_0x3eb642+_0x9725('0x2b');var _0x3bf5c8={'to':[_0x4bc708[_0x9725('0x1e')]],'message':{'type':_0x9725('0x2c'),'text':_0x4bc708[_0x9725('0x21')]}};var _0x407195={'method':_0x9725('0x2d'),'uri':_0x4707fd,'headers':{'Authorization':'Bearer\x20'+_0x5e3f5c,'Content-Type':_0x9725('0x2e')},'body':_0x3bf5c8,'json':!![]};rp(_0x407195)[_0x9725('0x15')](function(_0x324751){if(_0x324751[_0x9725('0x2f')][0x0][_0x9725('0x30')]){return _0x3548b2[_0x9725('0x16')]({'messageId':_0x324751[_0x9725('0x2f')][0x0]['message_id']});}})[_0x9725('0x25')](function(_0x1455c6){logger[_0x9725('0x31')](_0x9725('0x32'),_0x1455c6);});break;}}})['finally'](function(){_0x5d37cd();});}else{_0x5d37cd();}}},'charset':_0x9725('0x33'),'collate':_0x9725('0x34')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 5b283e6..3098e4e 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 _0x2d25=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','body','options','raw','CreateWhatsappMessage','stringify','lodash'];(function(_0x23f0e1,_0x11d94b){var _0x257f0d=function(_0xab63c7){while(--_0xab63c7){_0x23f0e1['push'](_0x23f0e1['shift']());}};_0x257f0d(++_0x11d94b);}(_0x2d25,0xff));var _0x52d2=function(_0x35f22c,_0x5ed848){_0x35f22c=_0x35f22c-0x0;var _0x395afb=_0x2d25[_0x35f22c];return _0x395afb;};'use strict';var _=require(_0x52d2('0x0'));var util=require(_0x52d2('0x1'));var moment=require('moment');var BPromise=require(_0x52d2('0x2'));var rs=require(_0x52d2('0x3'));var fs=require('fs');var Redis=require(_0x52d2('0x4'));var db=require(_0x52d2('0x5'))['db'];var utils=require(_0x52d2('0x6'));var logger=require(_0x52d2('0x7'))(_0x52d2('0x8'));var config=require('../../config/environment');var jayson=require(_0x52d2('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x52d2('0xa')]=_[_0x52d2('0xb')](config['redis'],{'host':_0x52d2('0xc'),'port':0x18eb});var socket=require(_0x52d2('0xd'))(new Redis(config[_0x52d2('0xa')]));require('./whatsappMessage.socket')[_0x52d2('0xe')](socket);function respondWithRpcPromise(_0x24e08c,_0xcd17e6,_0x194520){return new BPromise(function(_0x1ff69f,_0x3b564e){return client[_0x52d2('0xf')](_0x24e08c,_0x194520)[_0x52d2('0x10')](function(_0x13adb6){logger[_0x52d2('0x11')](_0x52d2('0x12'),_0xcd17e6,_0x52d2('0x13'));logger[_0x52d2('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xcd17e6,'request\x20sent',JSON['stringify'](_0x13adb6));if(_0x13adb6[_0x52d2('0x15')]){if(_0x13adb6[_0x52d2('0x15')][_0x52d2('0x16')]===0x1f4){logger['error'](_0x52d2('0x12'),_0xcd17e6,_0x13adb6[_0x52d2('0x15')][_0x52d2('0x17')]);return _0x3b564e(_0x13adb6['error'][_0x52d2('0x17')]);}logger[_0x52d2('0x15')](_0x52d2('0x12'),_0xcd17e6,_0x13adb6['error']['message']);return _0x1ff69f(_0x13adb6[_0x52d2('0x15')][_0x52d2('0x17')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xcd17e6,'request\x20sent');_0x1ff69f(_0x13adb6[_0x52d2('0x18')][_0x52d2('0x17')]);}})[_0x52d2('0x19')](function(_0x296ed7){logger[_0x52d2('0x15')](_0x52d2('0x12'),_0xcd17e6,_0x296ed7);_0x3b564e(_0x296ed7);});});}exports['CreateWhatsappMessage']=function(_0x303e50){var _0x1a8046=this;return new Promise(function(_0x47a0b4,_0x4f774a){return db['WhatsappMessage'][_0x52d2('0x1a')](_0x303e50[_0x52d2('0x1b')],{'raw':_0x303e50[_0x52d2('0x1c')]?_0x303e50[_0x52d2('0x1c')][_0x52d2('0x1d')]===undefined?!![]:![]:!![]})[_0x52d2('0x10')](function(_0x4ac7b7){logger['info'](_0x52d2('0x1e'),_0x303e50);logger['debug'](_0x52d2('0x1e'),_0x303e50,JSON[_0x52d2('0x1f')](_0x4ac7b7));_0x47a0b4(_0x4ac7b7);})[_0x52d2('0x19')](function(_0x357d33){logger['error']('CreateWhatsappMessage',_0x357d33[_0x52d2('0x17')],_0x303e50);_0x4f774a(_0x1a8046['error'](0x1f4,_0x357d33[_0x52d2('0x17')]));});});}; \ No newline at end of file +var _0x580c=['message','result','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x580c,0x1c3));var _0xc580=function(_0x38e6d3,_0x5099ab){_0x38e6d3=_0x38e6d3-0x0;var _0x3ae9ce=_0x580c[_0x38e6d3];return _0x3ae9ce;};'use strict';var _=require(_0xc580('0x0'));var util=require(_0xc580('0x1'));var moment=require('moment');var BPromise=require(_0xc580('0x2'));var rs=require(_0xc580('0x3'));var fs=require('fs');var Redis=require(_0xc580('0x4'));var db=require(_0xc580('0x5'))['db'];var utils=require(_0xc580('0x6'));var logger=require(_0xc580('0x7'))('rpc');var config=require(_0xc580('0x8'));var jayson=require(_0xc580('0x9'));var client=jayson[_0xc580('0xa')][_0xc580('0xb')]({'port':0x232a});config['redis']=_[_0xc580('0xc')](config[_0xc580('0xd')],{'host':_0xc580('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc580('0xd')]));require('./whatsappMessage.socket')[_0xc580('0xf')](socket);function respondWithRpcPromise(_0x2cc382,_0x416ba2,_0x4db0bb){return new BPromise(function(_0x502cac,_0x486195){return client[_0xc580('0x10')](_0x2cc382,_0x4db0bb)[_0xc580('0x11')](function(_0x592e4d){logger[_0xc580('0x12')](_0xc580('0x13'),_0x416ba2,'request\x20sent');logger[_0xc580('0x14')](_0xc580('0x15'),_0x416ba2,_0xc580('0x16'),JSON[_0xc580('0x17')](_0x592e4d));if(_0x592e4d[_0xc580('0x18')]){if(_0x592e4d[_0xc580('0x18')]['code']===0x1f4){logger['error'](_0xc580('0x13'),_0x416ba2,_0x592e4d[_0xc580('0x18')][_0xc580('0x19')]);return _0x486195(_0x592e4d[_0xc580('0x18')][_0xc580('0x19')]);}logger[_0xc580('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x416ba2,_0x592e4d[_0xc580('0x18')][_0xc580('0x19')]);return _0x502cac(_0x592e4d[_0xc580('0x18')][_0xc580('0x19')]);}else{logger[_0xc580('0x12')](_0xc580('0x13'),_0x416ba2,'request\x20sent');_0x502cac(_0x592e4d[_0xc580('0x1a')][_0xc580('0x19')]);}})['catch'](function(_0x5c8dad){logger[_0xc580('0x18')](_0xc580('0x13'),_0x416ba2,_0x5c8dad);_0x486195(_0x5c8dad);});});}exports['CreateWhatsappMessage']=function(_0x33f474){var _0x4d26dc=this;return new Promise(function(_0x13bc01,_0x15522a){return db[_0xc580('0x1b')][_0xc580('0x1c')](_0x33f474[_0xc580('0x1d')],{'raw':_0x33f474[_0xc580('0x1e')]?_0x33f474[_0xc580('0x1e')][_0xc580('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1c742e){logger['info'](_0xc580('0x20'),_0x33f474);logger[_0xc580('0x14')](_0xc580('0x20'),_0x33f474,JSON[_0xc580('0x17')](_0x1c742e));_0x13bc01(_0x1c742e);})[_0xc580('0x21')](function(_0x2aca20){logger[_0xc580('0x18')](_0xc580('0x20'),_0x2aca20[_0xc580('0x19')],_0x33f474);_0x15522a(_0x4d26dc['error'](0x1f4,_0x2aca20['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b678d78..89a512a 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 _0xfcff=['removeListener','register','length','whatsappMessage:','save','remove','emit'];(function(_0x36d6d0,_0x5db6d3){var _0x4eba2b=function(_0x4ca603){while(--_0x4ca603){_0x36d6d0['push'](_0x36d6d0['shift']());}};_0x4eba2b(++_0x5db6d3);}(_0xfcff,0x107));var _0xffcf=function(_0x2cf8e4,_0x404ab2){_0x2cf8e4=_0x2cf8e4-0x0;var _0x32ae3f=_0xfcff[_0x2cf8e4];return _0x32ae3f;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xffcf('0x0'),_0xffcf('0x1'),'update'];function createListener(_0x4b7edb,_0x37ce09){return function(_0x2305b8){_0x37ce09[_0xffcf('0x2')](_0x4b7edb,_0x2305b8);};}function removeListener(_0x24e86e,_0x4b5eb9){return function(){WhatsappMessageEvents[_0xffcf('0x3')](_0x24e86e,_0x4b5eb9);};}exports[_0xffcf('0x4')]=function(_0x1b48a5){for(var _0x93f416=0x0,_0x14b403=events[_0xffcf('0x5')];_0x93f416<_0x14b403;_0x93f416++){var _0x4a551a=events[_0x93f416];var _0x4bce5=createListener(_0xffcf('0x6')+_0x4a551a,_0x1b48a5);WhatsappMessageEvents['on'](_0x4a551a,_0x4bce5);}}; \ No newline at end of file +var _0xa06c=['remove','removeListener','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x4aaaef,_0x4cd2d0){var _0xbe59a=function(_0x271997){while(--_0x271997){_0x4aaaef['push'](_0x4aaaef['shift']());}};_0xbe59a(++_0x4cd2d0);}(_0xa06c,0x136));var _0xca06=function(_0x14657f,_0x3f4e0a){_0x14657f=_0x14657f-0x0;var _0x447402=_0xa06c[_0x14657f];return _0x447402;};'use strict';var WhatsappMessageEvents=require(_0xca06('0x0'));var events=[_0xca06('0x1'),_0xca06('0x2'),'update'];function createListener(_0x33daf0,_0x12d3ba){return function(_0x5ebb92){_0x12d3ba['emit'](_0x33daf0,_0x5ebb92);};}function removeListener(_0x4b087a,_0x597e6c){return function(){WhatsappMessageEvents[_0xca06('0x3')](_0x4b087a,_0x597e6c);};}exports['register']=function(_0x1e96e5){for(var _0x573759=0x0,_0x1e243f=events[_0xca06('0x4')];_0x573759<_0x1e243f;_0x573759++){var _0x7dd835=events[_0x573759];var _0x4e5ef3=createListener(_0xca06('0x5')+_0x7dd835,_0x1e96e5);WhatsappMessageEvents['on'](_0x7dd835,_0x4e5ef3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6fd4756..744eb3c 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 _0x57ea=['destroy','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','index','get','describe','/:id','isAuthenticated','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','addAgents','put'];(function(_0x4e3d3f,_0x4980c7){var _0x4e082f=function(_0x97f3d0){while(--_0x97f3d0){_0x4e3d3f['push'](_0x4e3d3f['shift']());}};_0x4e082f(++_0x4980c7);}(_0x57ea,0x193));var _0xa57e=function(_0x3f2cfc,_0x2827b0){_0x3f2cfc=_0x3f2cfc-0x0;var _0x1d1e61=_0x57ea[_0x3f2cfc];return _0x1d1e61;};'use strict';var multer=require(_0xa57e('0x0'));var util=require(_0xa57e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa57e('0x2'));var router=express[_0xa57e('0x3')]();var fs_extra=require(_0xa57e('0x4'));var auth=require(_0xa57e('0x5'));var interaction=require(_0xa57e('0x6'));var config=require('../../config/environment');var controller=require(_0xa57e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa57e('0x8')]);router[_0xa57e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa57e('0xa')]);router['get'](_0xa57e('0xb'),auth[_0xa57e('0xc')](),controller[_0xa57e('0xd')]);router['get']('/:id/members',auth[_0xa57e('0xc')](),controller[_0xa57e('0xe')]);router[_0xa57e('0x9')](_0xa57e('0xf'),auth[_0xa57e('0xc')](),controller['getTeams']);router['get'](_0xa57e('0x10'),auth[_0xa57e('0xc')](),controller['getAgents']);router[_0xa57e('0x11')]('/',auth[_0xa57e('0xc')](),controller[_0xa57e('0x12')]);router['post'](_0xa57e('0xf'),auth[_0xa57e('0xc')](),controller[_0xa57e('0x13')]);router[_0xa57e('0x11')]('/:id/users',auth[_0xa57e('0xc')](),controller[_0xa57e('0x14')]);router[_0xa57e('0x15')](_0xa57e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xa57e('0xc')](),controller[_0xa57e('0x16')]);router[_0xa57e('0x17')](_0xa57e('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xa57e('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xa57e('0x18')]=router; \ No newline at end of file +var _0xf9c9=['post','put','delete','destroy','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams'];(function(_0x568b0c,_0x590a15){var _0x2bb8ca=function(_0x1fb79e){while(--_0x1fb79e){_0x568b0c['push'](_0x568b0c['shift']());}};_0x2bb8ca(++_0x590a15);}(_0xf9c9,0x165));var _0x9f9c=function(_0x2b37b5,_0x4f677b){_0x2b37b5=_0x2b37b5-0x0;var _0x36df6d=_0xf9c9[_0x2b37b5];return _0x36df6d;};'use strict';var multer=require(_0x9f9c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9f9c('0x1'));var express=require(_0x9f9c('0x2'));var router=express[_0x9f9c('0x3')]();var fs_extra=require(_0x9f9c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f9c('0x5'));var config=require('../../config/environment');var controller=require(_0x9f9c('0x6'));router[_0x9f9c('0x7')]('/',auth[_0x9f9c('0x8')](),controller['index']);router[_0x9f9c('0x7')](_0x9f9c('0x9'),auth[_0x9f9c('0x8')](),controller[_0x9f9c('0xa')]);router[_0x9f9c('0x7')](_0x9f9c('0xb'),auth[_0x9f9c('0x8')](),controller[_0x9f9c('0xc')]);router['get'](_0x9f9c('0xd'),auth[_0x9f9c('0x8')](),controller[_0x9f9c('0xe')]);router[_0x9f9c('0x7')](_0x9f9c('0xf'),auth['isAuthenticated'](),controller[_0x9f9c('0x10')]);router[_0x9f9c('0x7')](_0x9f9c('0x11'),auth[_0x9f9c('0x8')](),controller[_0x9f9c('0x12')]);router['post']('/',auth[_0x9f9c('0x8')](),controller[_0x9f9c('0x13')]);router['post']('/:id/teams',auth[_0x9f9c('0x8')](),controller[_0x9f9c('0x14')]);router[_0x9f9c('0x15')]('/:id/users',auth[_0x9f9c('0x8')](),controller['addAgents']);router[_0x9f9c('0x16')](_0x9f9c('0xb'),auth[_0x9f9c('0x8')](),controller['update']);router[_0x9f9c('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x9f9c('0x18')]);router[_0x9f9c('0x17')]('/:id/teams',auth[_0x9f9c('0x8')](),controller[_0x9f9c('0x19')]);router[_0x9f9c('0x17')](_0x9f9c('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x9f9c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 699de8c..acd40ec 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 _0xd66c=['ENUM','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x440b49,_0x307648){var _0x70848d=function(_0x1e1b53){while(--_0x1e1b53){_0x440b49['push'](_0x440b49['shift']());}};_0x70848d(++_0x307648);}(_0xd66c,0x106));var _0xcd66=function(_0x1ad225,_0x1fad60){_0x1ad225=_0x1ad225-0x0;var _0x16ba64=_0xd66c[_0x1ad225];return _0x16ba64;};'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 +var _0xb48d=['rrmemory','beepall','sequelize','STRING','INTEGER','ENUM'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xb48d,0x194));var _0xdb48=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xb48d[_0x45f951];return _0x24756c;};'use strict';var Sequelize=require(_0xdb48('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb48('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xdb48('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdb48('0x3')](_0xdb48('0x4'),_0xdb48('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xdb48('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index b4082fe..676f70e 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 _0xb054=['includes','all','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','merge','VIRTUAL','filter','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','length','order','WhatsappQueueId','User','UserId','agent','updatedAt','format','%s/%s','SIP','whatsappPause','createdAt','getTeams','Team','nolimit','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','Agents','push','toString','QueryTypes','SELECT','every','TeamId'];(function(_0xb6b27f,_0x5b93db){var _0x1c8052=function(_0xac32f9){while(--_0xac32f9){_0xb6b27f['push'](_0xb6b27f['shift']());}};_0x1c8052(++_0x5b93db);}(_0xb054,0x1ae));var _0x4b05=function(_0x24955f,_0x2eb32e){_0x24955f=_0x24955f-0x0;var _0x20ec55=_0xb054[_0x24955f];return _0x20ec55;};'use strict';var emlformat=require(_0x4b05('0x0'));var rimraf=require(_0x4b05('0x1'));var zipdir=require(_0x4b05('0x2'));var jsonpatch=require(_0x4b05('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4b05('0x4'));var util=require(_0x4b05('0x5'));var path=require('path');var sox=require(_0x4b05('0x6'));var csv=require(_0x4b05('0x7'));var ejs=require(_0x4b05('0x8'));var fs=require('fs');var fs_extra=require(_0x4b05('0x9'));var _=require(_0x4b05('0xa'));var squel=require(_0x4b05('0xb'));var crypto=require(_0x4b05('0xc'));var jsforce=require(_0x4b05('0xd'));var deskjs=require(_0x4b05('0xe'));var toCsv=require(_0x4b05('0x7'));var querystring=require('querystring');var Papa=require(_0x4b05('0xf'));var Redis=require(_0x4b05('0x10'));var authService=require(_0x4b05('0x11'));var qs=require(_0x4b05('0x12'));var as=require(_0x4b05('0x13'));var hardwareService=require(_0x4b05('0x14'));var logger=require(_0x4b05('0x15'))('api');var utils=require(_0x4b05('0x16'));var config=require(_0x4b05('0x17'));var licenseUtil=require(_0x4b05('0x18'));var db=require(_0x4b05('0x19'))['db'];config['redis']=_['defaults'](config[_0x4b05('0x1a')],{'host':_0x4b05('0x1b'),'port':0x18eb});var socket=require(_0x4b05('0x1c'))(new Redis(config['redis']));require(_0x4b05('0x1d'))[_0x4b05('0x1e')](socket);function respondWithStatusCode(_0x3ec91c,_0x36e9f7){_0x36e9f7=_0x36e9f7||0xcc;return function(_0x1c3b18){if(_0x1c3b18){return _0x3ec91c[_0x4b05('0x1f')](_0x36e9f7);}return _0x3ec91c[_0x4b05('0x20')](_0x36e9f7)[_0x4b05('0x21')]();};}function respondWithResult(_0x42709e,_0x446271){_0x446271=_0x446271||0xc8;return function(_0x2e7993){if(_0x2e7993){return _0x42709e[_0x4b05('0x20')](_0x446271)[_0x4b05('0x22')](_0x2e7993);}};}function respondWithFilteredResult(_0x5d79d2,_0x451add){return function(_0x37f7dd){if(_0x37f7dd){var _0x2df6cb=typeof _0x451add[_0x4b05('0x23')]===_0x4b05('0x24')&&typeof _0x451add[_0x4b05('0x25')]==='undefined';var _0x220ae5=_0x37f7dd[_0x4b05('0x26')];var _0x39ab8d=_0x2df6cb?0x0:_0x451add['offset'];var _0x41b219=_0x2df6cb?_0x37f7dd[_0x4b05('0x26')]:_0x451add[_0x4b05('0x23')]+_0x451add['limit'];var _0x279224;if(_0x41b219>=_0x220ae5){_0x41b219=_0x220ae5;_0x279224=0xc8;}else{_0x279224=0xce;}_0x5d79d2[_0x4b05('0x20')](_0x279224);return _0x5d79d2[_0x4b05('0x27')]('Content-Range',_0x39ab8d+'-'+_0x41b219+'/'+_0x220ae5)['json'](_0x37f7dd);}return null;};}function patchUpdates(_0x2e3527){return function(_0x1416c1){try{jsonpatch['apply'](_0x1416c1,_0x2e3527,!![]);}catch(_0x551d91){return BPromise[_0x4b05('0x28')](_0x551d91);}return _0x1416c1[_0x4b05('0x29')]();};}function saveUpdates(_0x3b4565,_0x4e7a46){return function(_0x520deb){if(_0x520deb){return _0x520deb[_0x4b05('0x2a')](_0x3b4565)[_0x4b05('0x2b')](function(_0xfc6c46){return _0xfc6c46;});}return null;};}function removeEntity(_0x23ec48,_0x4dc1a1){return function(_0x48b862){if(_0x48b862){return _0x48b862[_0x4b05('0x2c')]()['then'](function(){var _0x117444=_0x48b862[_0x4b05('0x2d')]({'plain':!![]});var _0x3165f7=_0x4b05('0x2e');return db[_0x4b05('0x2f')][_0x4b05('0x2c')]({'where':{'type':_0x3165f7,'resourceId':_0x117444['id']}})[_0x4b05('0x2b')](function(){return _0x48b862;});})['then'](function(){_0x23ec48[_0x4b05('0x20')](0xcc)[_0x4b05('0x21')]();});}};}function handleEntityNotFound(_0xdb74cd,_0x454ad5){return function(_0x3f0590){if(!_0x3f0590){_0xdb74cd[_0x4b05('0x1f')](0x194);}return _0x3f0590;};}function handleError(_0x56a32b,_0x2fda0d){_0x2fda0d=_0x2fda0d||0x1f4;return function(_0x301285){logger['error'](_0x301285[_0x4b05('0x30')]);if(_0x301285[_0x4b05('0x31')]){delete _0x301285[_0x4b05('0x31')];}_0x56a32b[_0x4b05('0x20')](_0x2fda0d)['send'](_0x301285);};}exports[_0x4b05('0x32')]=function(_0x318753,_0x279182){var _0x33f402={},_0x137027={},_0x7e1d7={'count':0x0,'rows':[]};var _0x400ad0=_[_0x4b05('0x33')](db[_0x4b05('0x34')][_0x4b05('0x35')],function(_0x2fc2bf){return{'name':_0x2fc2bf[_0x4b05('0x36')],'type':_0x2fc2bf['type'][_0x4b05('0x37')]};});_0x137027[_0x4b05('0x38')]=_['map'](_0x400ad0,_0x4b05('0x31'));_0x137027[_0x4b05('0x39')]=_[_0x4b05('0x3a')](_0x318753[_0x4b05('0x39')]);_0x137027['filters']=_[_0x4b05('0x3b')](_0x137027[_0x4b05('0x38')],_0x137027[_0x4b05('0x39')]);_0x33f402[_0x4b05('0x3c')]=_[_0x4b05('0x3b')](_0x137027[_0x4b05('0x38')],qs[_0x4b05('0x3d')](_0x318753[_0x4b05('0x39')][_0x4b05('0x3d')]));_0x33f402[_0x4b05('0x3c')]=_0x33f402[_0x4b05('0x3c')]['length']?_0x33f402[_0x4b05('0x3c')]:_0x137027[_0x4b05('0x38')];if(!_0x318753[_0x4b05('0x39')][_0x4b05('0x3e')]('nolimit')){_0x33f402[_0x4b05('0x25')]=qs['limit'](_0x318753['query'][_0x4b05('0x25')]);_0x33f402['offset']=qs[_0x4b05('0x23')](_0x318753[_0x4b05('0x39')][_0x4b05('0x23')]);}_0x33f402['order']=qs[_0x4b05('0x3f')](_0x318753['query'][_0x4b05('0x3f')]);_0x33f402[_0x4b05('0x40')]=qs['filters'](_[_0x4b05('0x41')](_0x318753['query'],_0x137027[_0x4b05('0x42')]),_0x400ad0);if(_0x318753['query']['filter']){_0x33f402['where']=_[_0x4b05('0x43')](_0x33f402[_0x4b05('0x40')],{'$or':_[_0x4b05('0x33')](_0x400ad0,function(_0x290044){if(_0x290044['type']!==_0x4b05('0x44')){var _0x2388ff={};_0x2388ff[_0x290044[_0x4b05('0x31')]]={'$like':'%'+_0x318753[_0x4b05('0x39')][_0x4b05('0x45')]+'%'};return _0x2388ff;}})});}_0x33f402=_[_0x4b05('0x43')]({},_0x33f402,_0x318753['options']);var _0x48c30a={'where':_0x33f402['where']};return db[_0x4b05('0x34')][_0x4b05('0x26')](_0x48c30a)[_0x4b05('0x2b')](function(_0xab75c1){_0x7e1d7[_0x4b05('0x26')]=_0xab75c1;if(_0x318753[_0x4b05('0x39')]['includeAll']){_0x33f402[_0x4b05('0x46')]=[{'all':!![]}];}return db[_0x4b05('0x34')][_0x4b05('0x47')](_0x33f402);})[_0x4b05('0x2b')](function(_0x2f4d23){_0x7e1d7[_0x4b05('0x48')]=_0x2f4d23;return _0x7e1d7;})[_0x4b05('0x2b')](respondWithFilteredResult(_0x279182,_0x33f402))[_0x4b05('0x49')](handleError(_0x279182,null));};exports[_0x4b05('0x4a')]=function(_0x413519,_0x40d64e){var _0x44c8f5={'raw':!![],'where':{'id':_0x413519['params']['id']}},_0x1bc457={};_0x1bc457['model']=_[_0x4b05('0x3a')](db['WhatsappQueue'][_0x4b05('0x35')]);_0x1bc457[_0x4b05('0x39')]=_[_0x4b05('0x3a')](_0x413519[_0x4b05('0x39')]);_0x1bc457[_0x4b05('0x42')]=_[_0x4b05('0x3b')](_0x1bc457[_0x4b05('0x38')],_0x1bc457['query']);_0x44c8f5[_0x4b05('0x3c')]=_['intersection'](_0x1bc457[_0x4b05('0x38')],qs[_0x4b05('0x3d')](_0x413519['query'][_0x4b05('0x3d')]));_0x44c8f5[_0x4b05('0x3c')]=_0x44c8f5[_0x4b05('0x3c')]['length']?_0x44c8f5[_0x4b05('0x3c')]:_0x1bc457['model'];if(_0x413519[_0x4b05('0x39')]['includeAll']){_0x44c8f5[_0x4b05('0x46')]=[{'all':!![]}];}_0x44c8f5=_[_0x4b05('0x43')]({},_0x44c8f5,_0x413519[_0x4b05('0x4b')]);return db[_0x4b05('0x34')][_0x4b05('0x4c')](_0x44c8f5)['then'](handleEntityNotFound(_0x40d64e,null))[_0x4b05('0x2b')](respondWithResult(_0x40d64e,null))[_0x4b05('0x49')](handleError(_0x40d64e,null));};exports[_0x4b05('0x4d')]=function(_0x32302e,_0x95a3ee){return db[_0x4b05('0x34')][_0x4b05('0x4d')](_0x32302e[_0x4b05('0x4e')],{})[_0x4b05('0x2b')](function(_0xb0249e){var _0x4a1bbd=_0x32302e[_0x4b05('0x4f')][_0x4b05('0x2d')]({'plain':!![]});if(!_0x4a1bbd)throw new Error(_0x4b05('0x50'));if(_0x4a1bbd['role']==='user'){var _0x5dd94a=_0xb0249e[_0x4b05('0x2d')]({'plain':!![]});var _0x2c1683='WhatsappQueues';return db[_0x4b05('0x51')][_0x4b05('0x4c')]({'where':{'name':_0x2c1683,'userProfileId':_0x4a1bbd['userProfileId']},'raw':!![]})[_0x4b05('0x2b')](function(_0xe3500){if(_0xe3500&&_0xe3500[_0x4b05('0x52')]===0x0){return db[_0x4b05('0x2f')][_0x4b05('0x4d')]({'name':_0x5dd94a[_0x4b05('0x31')],'resourceId':_0x5dd94a['id'],'type':_0xe3500[_0x4b05('0x31')],'sectionId':_0xe3500['id']},{})[_0x4b05('0x2b')](function(){return _0xb0249e;});}else{return _0xb0249e;}})[_0x4b05('0x49')](function(_0x44d145){logger['error'](_0x4b05('0x53'),_0x44d145);throw _0x44d145;});}return _0xb0249e;})[_0x4b05('0x2b')](respondWithResult(_0x95a3ee,0xc9))[_0x4b05('0x49')](handleError(_0x95a3ee,null));};exports['update']=function(_0x2827ba,_0x126ebe){if(_0x2827ba[_0x4b05('0x4e')]['id']){delete _0x2827ba[_0x4b05('0x4e')]['id'];}return db[_0x4b05('0x34')][_0x4b05('0x4c')]({'where':{'id':_0x2827ba[_0x4b05('0x54')]['id']}})[_0x4b05('0x2b')](handleEntityNotFound(_0x126ebe,null))['then'](saveUpdates(_0x2827ba[_0x4b05('0x4e')],null))[_0x4b05('0x2b')](respondWithResult(_0x126ebe,null))[_0x4b05('0x49')](handleError(_0x126ebe,null));};exports['destroy']=function(_0x5c0e30,_0x5405c5){return db[_0x4b05('0x34')][_0x4b05('0x4c')]({'where':{'id':_0x5c0e30[_0x4b05('0x54')]['id']}})[_0x4b05('0x2b')](handleEntityNotFound(_0x5405c5,null))['then'](removeEntity(_0x5405c5,null))[_0x4b05('0x49')](handleError(_0x5405c5,null));};exports[_0x4b05('0x55')]=function(_0x3fd233,_0x33fe95){return db[_0x4b05('0x34')]['describe']()[_0x4b05('0x2b')](respondWithResult(_0x33fe95,null))[_0x4b05('0x49')](handleError(_0x33fe95,null));};exports[_0x4b05('0x56')]=function(_0x41e8c8,_0x23f5b7,_0xcd5216){var _0x330489={'raw':!![],'where':{}},_0x46f9be={},_0x5dd752;return db[_0x4b05('0x34')][_0x4b05('0x57')]({'where':{'id':_0x41e8c8[_0x4b05('0x54')]['id']}})['then'](handleEntityNotFound(_0x23f5b7,null))['then'](function(_0x310a4c){if(_0x310a4c){_0x5dd752=_0x310a4c[_0x4b05('0x2d')]({'plain':!![]});_0x46f9be[_0x4b05('0x38')]=_[_0x4b05('0x3a')](db[_0x4b05('0x58')][_0x4b05('0x35')]);_0x46f9be[_0x4b05('0x39')]=_['keys'](_0x41e8c8['query']);_0x46f9be[_0x4b05('0x42')]=_[_0x4b05('0x3b')](_0x46f9be[_0x4b05('0x38')],_0x46f9be[_0x4b05('0x39')]);_0x330489['attributes']=_[_0x4b05('0x3b')](_0x46f9be['model'],qs['fields'](_0x41e8c8['query']['fields']));_0x330489[_0x4b05('0x3c')]=_0x330489['attributes'][_0x4b05('0x59')]?_0x330489['attributes']:_0x46f9be[_0x4b05('0x38')];if(!_0x41e8c8['query'][_0x4b05('0x3e')]('nolimit')){_0x330489[_0x4b05('0x25')]=qs[_0x4b05('0x25')](_0x41e8c8[_0x4b05('0x39')]['limit']);_0x330489[_0x4b05('0x23')]=qs[_0x4b05('0x23')](_0x41e8c8[_0x4b05('0x39')][_0x4b05('0x23')]);}_0x330489[_0x4b05('0x5a')]=qs[_0x4b05('0x3f')](_0x41e8c8[_0x4b05('0x39')]['sort']);_0x330489['where']=qs[_0x4b05('0x42')](_[_0x4b05('0x41')](_0x41e8c8[_0x4b05('0x39')],_0x46f9be[_0x4b05('0x42')]));_0x330489[_0x4b05('0x40')][_0x4b05('0x5b')]=_0x310a4c['id'];if(_0x41e8c8[_0x4b05('0x39')][_0x4b05('0x45')]){_0x330489['where']=_[_0x4b05('0x43')](_0x330489[_0x4b05('0x40')],{'$or':_[_0x4b05('0x33')](_0x330489['attributes'],function(_0x4bed41){var _0x13a489={};_0x13a489[_0x4bed41]={'$like':'%'+_0x41e8c8[_0x4b05('0x39')]['filter']+'%'};return _0x13a489;})});}_0x330489=_[_0x4b05('0x43')]({},_0x330489,_0x41e8c8[_0x4b05('0x4b')]);return db['UserWhatsappQueue']['findAll'](_0x330489);}})[_0x4b05('0x2b')](function(_0x1e5a33){if(_0x1e5a33){return db[_0x4b05('0x5c')]['findAndCountAll']({'where':{'id':_[_0x4b05('0x33')](_0x1e5a33,_0x4b05('0x5d')),'role':_0x4b05('0x5e')},'attributes':['id','name','whatsappPause',_0x4b05('0x5f'),'createdAt']});}})[_0x4b05('0x2b')](function(_0x43b605){if(_0x43b605){return{'count':_0x43b605[_0x4b05('0x26')],'rows':_[_0x4b05('0x33')](_0x43b605[_0x4b05('0x48')],function(_0x553305){return{'membername':_0x553305[_0x4b05('0x31')],'UserId':_0x553305['id'],'queue_name':_0x5dd752[_0x4b05('0x31')],'WhatsappQueueId':_0x5dd752['id'],'interface':util[_0x4b05('0x60')](_0x4b05('0x61'),_0x4b05('0x62'),_0x553305[_0x4b05('0x31')]),'penalty':0x0,'paused':_0x553305[_0x4b05('0x63')],'createdAt':_0x553305[_0x4b05('0x64')],'updatedAt':_0x553305[_0x4b05('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b05('0x2b')](respondWithFilteredResult(_0x23f5b7,_0x330489))[_0x4b05('0x49')](handleError(_0x23f5b7,null));};exports[_0x4b05('0x65')]=function(_0x1c9999,_0xafaa31,_0x3138cb){var _0x39a224={};var _0x47ba44={};var _0x4de4af;var _0x12d835;return db['WhatsappQueue'][_0x4b05('0x57')]({'where':{'id':_0x1c9999['params']['id']}})[_0x4b05('0x2b')](handleEntityNotFound(_0xafaa31,null))[_0x4b05('0x2b')](function(_0x3c2bdb){if(_0x3c2bdb){_0x4de4af=_0x3c2bdb;_0x47ba44[_0x4b05('0x38')]=_[_0x4b05('0x3a')](db[_0x4b05('0x66')][_0x4b05('0x35')]);_0x47ba44[_0x4b05('0x39')]=_['keys'](_0x1c9999['query']);_0x47ba44[_0x4b05('0x42')]=_[_0x4b05('0x3b')](_0x47ba44[_0x4b05('0x38')],_0x47ba44['query']);_0x39a224[_0x4b05('0x3c')]=_['intersection'](_0x47ba44[_0x4b05('0x38')],qs[_0x4b05('0x3d')](_0x1c9999[_0x4b05('0x39')][_0x4b05('0x3d')]));_0x39a224[_0x4b05('0x3c')]=_0x39a224[_0x4b05('0x3c')][_0x4b05('0x59')]?_0x39a224['attributes']:_0x47ba44['model'];_0x39a224[_0x4b05('0x5a')]=qs['sort'](_0x1c9999['query'][_0x4b05('0x3f')]);_0x39a224[_0x4b05('0x40')]=qs[_0x4b05('0x42')](_[_0x4b05('0x41')](_0x1c9999['query'],_0x47ba44[_0x4b05('0x42')]));if(_0x1c9999[_0x4b05('0x39')][_0x4b05('0x45')]){_0x39a224[_0x4b05('0x40')]=_[_0x4b05('0x43')](_0x39a224[_0x4b05('0x40')],{'$or':_[_0x4b05('0x33')](_0x39a224[_0x4b05('0x3c')],function(_0x71eb5d){var _0x12a97e={};_0x12a97e[_0x71eb5d]={'$like':'%'+_0x1c9999[_0x4b05('0x39')][_0x4b05('0x45')]+'%'};return _0x12a97e;})});}_0x39a224=_[_0x4b05('0x43')]({},_0x39a224,_0x1c9999['options']);return _0x4de4af['getTeams'](_0x39a224);}})['then'](function(_0xcb96aa){if(_0xcb96aa){_0x12d835=_0xcb96aa[_0x4b05('0x59')];if(!_0x1c9999[_0x4b05('0x39')][_0x4b05('0x3e')](_0x4b05('0x67'))){_0x39a224['limit']=qs[_0x4b05('0x25')](_0x1c9999['query'][_0x4b05('0x25')]);_0x39a224['offset']=qs[_0x4b05('0x23')](_0x1c9999[_0x4b05('0x39')][_0x4b05('0x23')]);}return _0x4de4af[_0x4b05('0x65')](_0x39a224);}})['then'](function(_0x20f36d){if(_0x20f36d){return _0x20f36d?{'count':_0x12d835,'rows':_0x20f36d}:null;}})['then'](respondWithResult(_0xafaa31,null))['catch'](handleError(_0xafaa31,null));};exports[_0x4b05('0x68')]=function(_0x1892cf,_0x315125,_0x486a3e){var _0x49bd7b=_0x1892cf[_0x4b05('0x4e')][_0x4b05('0x69')];return db[_0x4b05('0x66')][_0x4b05('0x47')]({'where':{'id':_0x49bd7b},'attributes':['id'],'include':[{'model':db[_0x4b05('0x5c')],'as':'Agents','attributes':['id',_0x4b05('0x31'),_0x4b05('0x6a'),_0x4b05('0x6b'),_0x4b05('0x6c')],'raw':!![]}]})['then'](function(_0x2a971c){if(_0x2a971c){var _0x4387c1=_[_0x4b05('0x6d')](_0x2a971c,function(_0x4dd989){var _0x5e10fd=_0x4dd989[_0x4b05('0x2d')]({'plain':!![]});return _0x5e10fd['Agents'];});return db['WhatsappQueue']['find']({'where':{'id':_0x1892cf[_0x4b05('0x54')]['id']}})[_0x4b05('0x2b')](function(_0x1d6874){return db[_0x4b05('0x6e')][_0x4b05('0x6f')](function(_0x1faab4){return _0x1d6874['addTeams'](_0x49bd7b,{'transaction':_0x1faab4})[_0x4b05('0x2b')](function(){return BPromise[_0x4b05('0x70')](_0x4387c1,function(_0x252e97){return db[_0x4b05('0x58')][_0x4b05('0x71')]({'where':{'UserId':_0x252e97['id'],'WhatsappQueueId':_0x1892cf[_0x4b05('0x54')]['id']},'transaction':_0x1faab4});});})[_0x4b05('0x2b')](function(){_0x4387c1[_0x4b05('0x72')](function(_0x823a43){socket[_0x4b05('0x73')](_0x4b05('0x74'),{'UserId':_0x823a43['id'],'WhatsappQueueId':_0x1d6874['id']});});});});});}})[_0x4b05('0x2b')](respondWithStatusCode(_0x315125,null))[_0x4b05('0x49')](handleError(_0x315125,null));};exports['removeTeams']=function(_0x88130d,_0x304bdb,_0x249d7d){return db[_0x4b05('0x66')]['findAll']({'where':{'id':_0x88130d['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4b05('0x2b')](handleEntityNotFound(_0x304bdb,null))[_0x4b05('0x2b')](function(_0x4af835){var _0x164c0b=_[_0x4b05('0x33')](_0x4af835,'id');var _0x8a3fdb=[];var _0x1d83b3=[];var _0x396a2a=squel['select']();_0x396a2a['field'](_0x4b05('0x75'))[_0x4b05('0x76')](_0x4b05('0x77'),'tq')[_0x4b05('0x78')]('user_has_teams','ut',_0x4b05('0x79'))[_0x4b05('0x40')](_0x4b05('0x7a'),_0x88130d[_0x4b05('0x54')]['id']);for(var _0x4a043f=0x0;_0x4a043f<_0x4af835['length'];_0x4a043f+=0x1){let _0x417913=_0x4af835[_0x4a043f];for(var _0x1bdd29=0x0;_0x1bdd29<_0x417913[_0x4b05('0x7b')][_0x4b05('0x59')];_0x1bdd29+=0x1){let _0x3b14c9=_0x417913[_0x4b05('0x7b')][_0x1bdd29];var _0x28945b=_0x396a2a['clone']();_0x28945b[_0x4b05('0x40')]('ut.UserId\x20=\x20?',_0x3b14c9['id']);_0x1d83b3[_0x4b05('0x7c')](db['sequelize'][_0x4b05('0x39')](_0x28945b[_0x4b05('0x7d')](),{'type':db[_0x4b05('0x6e')][_0x4b05('0x7e')][_0x4b05('0x7f')]})[_0x4b05('0x2b')](function(_0x2c7b08){if(_0x2c7b08[_0x4b05('0x59')]===0x1){return _0x3b14c9['id'];}else{var _0x37cf8a=_[_0x4b05('0x80')](_[_0x4b05('0x33')](_0x2c7b08,_0x4b05('0x81')),function(_0x393350){return _[_0x4b05('0x82')](_0x164c0b,_0x393350);});if(_0x37cf8a){return _0x3b14c9['id'];}}}));}}return BPromise[_0x4b05('0x83')](_0x1d83b3)[_0x4b05('0x2b')](function(_0x10b2c6){_0x8a3fdb=_(_0x8a3fdb)['union'](_0x10b2c6)[_0x4b05('0x84')]()[_0x4b05('0x85')]();return db[_0x4b05('0x34')]['find']({'where':{'id':_0x88130d[_0x4b05('0x54')]['id']}})[_0x4b05('0x2b')](function(_0x2424f5){return db[_0x4b05('0x6e')][_0x4b05('0x6f')](function(_0x4bb922){return _0x2424f5['removeTeams'](_0x88130d[_0x4b05('0x39')][_0x4b05('0x69')],{'transaction':_0x4bb922})['then'](function(){if(!_[_0x4b05('0x86')](_0x8a3fdb)){return _0x2424f5[_0x4b05('0x87')](_0x8a3fdb,{'transaction':_0x4bb922});}})[_0x4b05('0x2b')](function(){_0x8a3fdb[_0x4b05('0x72')](function(_0x55063a){socket['emit'](_0x4b05('0x88'),{'UserId':_0x55063a,'WhatsappQueueId':_0x2424f5['id']});});});});});});})[_0x4b05('0x2b')](respondWithStatusCode(_0x304bdb,null))['catch'](handleError(_0x304bdb,null));};exports['addAgents']=function(_0x299503,_0x5286aa,_0x1399cf){return db['WhatsappQueue'][_0x4b05('0x4c')]({'where':{'id':_0x299503[_0x4b05('0x54')]['id']}})['then'](handleEntityNotFound(_0x5286aa,null))[_0x4b05('0x2b')](function(_0x1f34e3){if(_0x1f34e3){return _0x1f34e3[_0x4b05('0x89')](_0x299503[_0x4b05('0x4e')][_0x4b05('0x69')],_[_0x4b05('0x8a')](_0x299503[_0x4b05('0x4e')],['ids','id'])||{})['spread'](function(_0xcec53f){for(var _0x3e5708=0x0;_0x3e5708<_0x299503[_0x4b05('0x4e')][_0x4b05('0x69')][_0x4b05('0x59')];_0x3e5708+=0x1){socket[_0x4b05('0x73')](_0x4b05('0x74'),{'UserId':Number(_0x299503[_0x4b05('0x4e')][_0x4b05('0x69')][_0x3e5708]),'WhatsappQueueId':Number(_0x299503[_0x4b05('0x54')]['id'])});}return _0xcec53f;});}})[_0x4b05('0x2b')](respondWithResult(_0x5286aa,null))[_0x4b05('0x49')](handleError(_0x5286aa,null));};exports['removeAgents']=function(_0x18ebdc,_0x1bb7ab,_0x4055a9){return db[_0x4b05('0x34')]['find']({'where':{'id':_0x18ebdc['params']['id']}})[_0x4b05('0x2b')](handleEntityNotFound(_0x1bb7ab,null))['then'](function(_0x4222f8){if(_0x4222f8){return _0x4222f8['removeAgents'](_0x18ebdc[_0x4b05('0x39')]['ids'])[_0x4b05('0x2b')](function(){if(_['isArray'](_0x18ebdc[_0x4b05('0x39')][_0x4b05('0x69')])){for(var _0x18e5fb=0x0;_0x18e5fb<_0x18ebdc[_0x4b05('0x39')][_0x4b05('0x69')][_0x4b05('0x59')];_0x18e5fb+=0x1){socket[_0x4b05('0x73')]('userWhatsappQueue:remove',{'UserId':Number(_0x18ebdc[_0x4b05('0x39')][_0x4b05('0x69')][_0x18e5fb]),'WhatsappQueueId':Number(_0x18ebdc[_0x4b05('0x54')]['id'])});}}else{socket[_0x4b05('0x73')](_0x4b05('0x88'),{'UserId':Number(_0x18ebdc['query'][_0x4b05('0x69')]),'WhatsappQueueId':Number(_0x18ebdc[_0x4b05('0x54')]['id'])});}});}})[_0x4b05('0x2b')](respondWithStatusCode(_0x1bb7ab,null))[_0x4b05('0x49')](handleError(_0x1bb7ab,null));};exports[_0x4b05('0x8b')]=function(_0x262975,_0x59bef5,_0x2a6db4){var _0x3e4cd5={};var _0x2acb05={};var _0x2b8e69;var _0x3de23a;return db[_0x4b05('0x34')][_0x4b05('0x57')]({'where':{'id':_0x262975[_0x4b05('0x54')]['id']}})[_0x4b05('0x2b')](handleEntityNotFound(_0x59bef5,null))[_0x4b05('0x2b')](function(_0x16133d){if(_0x16133d){_0x2b8e69=_0x16133d;_0x2acb05[_0x4b05('0x38')]=_[_0x4b05('0x3a')](db[_0x4b05('0x5c')]['rawAttributes']);_0x2acb05[_0x4b05('0x39')]=_[_0x4b05('0x3a')](_0x262975[_0x4b05('0x39')]);_0x2acb05[_0x4b05('0x42')]=_[_0x4b05('0x3b')](_0x2acb05[_0x4b05('0x38')],_0x2acb05[_0x4b05('0x39')]);_0x3e4cd5[_0x4b05('0x3c')]=_[_0x4b05('0x3b')](_0x2acb05['model'],qs[_0x4b05('0x3d')](_0x262975[_0x4b05('0x39')][_0x4b05('0x3d')]));_0x3e4cd5[_0x4b05('0x3c')]=_0x3e4cd5[_0x4b05('0x3c')]['length']?_0x3e4cd5[_0x4b05('0x3c')]:_0x2acb05[_0x4b05('0x38')];_0x3e4cd5['order']=qs[_0x4b05('0x3f')](_0x262975[_0x4b05('0x39')][_0x4b05('0x3f')]);_0x3e4cd5[_0x4b05('0x40')]=qs[_0x4b05('0x42')](_['pick'](_0x262975['query'],_0x2acb05['filters']));if(_0x262975['query']['filter']){_0x3e4cd5[_0x4b05('0x40')]=_[_0x4b05('0x43')](_0x3e4cd5[_0x4b05('0x40')],{'$or':_[_0x4b05('0x33')](_0x3e4cd5[_0x4b05('0x3c')],function(_0x169cd4){var _0xcbe13b={};_0xcbe13b[_0x169cd4]={'$like':'%'+_0x262975['query']['filter']+'%'};return _0xcbe13b;})});}_0x3e4cd5=_['merge']({},_0x3e4cd5,_0x262975[_0x4b05('0x4b')]);return _0x2b8e69['getAgents'](_0x3e4cd5);}})['then'](function(_0x1c59de){if(_0x1c59de){_0x3de23a=_0x1c59de[_0x4b05('0x59')];if(!_0x262975[_0x4b05('0x39')]['hasOwnProperty'](_0x4b05('0x67'))){_0x3e4cd5['limit']=qs[_0x4b05('0x25')](_0x262975[_0x4b05('0x39')][_0x4b05('0x25')]);_0x3e4cd5['offset']=qs[_0x4b05('0x23')](_0x262975[_0x4b05('0x39')]['offset']);}return _0x2b8e69['getAgents'](_0x3e4cd5);}})[_0x4b05('0x2b')](function(_0x427c92){if(_0x427c92){return _0x427c92?{'count':_0x3de23a,'rows':_0x427c92}:null;}})[_0x4b05('0x2b')](respondWithResult(_0x59bef5,null))[_0x4b05('0x49')](handleError(_0x59bef5,null));}; \ No newline at end of file +var _0xb936=['ids','Agents','online','transaction','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','userWhatsappQueue:save','userWhatsappQueue:remove','getAgents','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','WhatsappQueues','UserProfileResource','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','show','options','find','catch','create','body','user','get','role','UserProfileSection','userProfileId','error','params','describe','getMembers','findOne','UserWhatsappQueue','length','User','findAndCountAll','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team'];(function(_0x2c91eb,_0x497adc){var _0x4c378c=function(_0x5f3f91){while(--_0x5f3f91){_0x2c91eb['push'](_0x2c91eb['shift']());}};_0x4c378c(++_0x497adc);}(_0xb936,0x1c1));var _0x6b93=function(_0x1a41cf,_0x25cbd5){_0x1a41cf=_0x1a41cf-0x0;var _0x59e83c=_0xb936[_0x1a41cf];return _0x59e83c;};'use strict';var emlformat=require(_0x6b93('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b93('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b93('0x2'));var BPromise=require(_0x6b93('0x3'));var Mustache=require(_0x6b93('0x4'));var util=require(_0x6b93('0x5'));var path=require(_0x6b93('0x6'));var sox=require(_0x6b93('0x7'));var csv=require('to-csv');var ejs=require(_0x6b93('0x8'));var fs=require('fs');var fs_extra=require(_0x6b93('0x9'));var _=require(_0x6b93('0xa'));var squel=require(_0x6b93('0xb'));var crypto=require(_0x6b93('0xc'));var jsforce=require(_0x6b93('0xd'));var deskjs=require(_0x6b93('0xe'));var toCsv=require(_0x6b93('0xf'));var querystring=require(_0x6b93('0x10'));var Papa=require('papaparse');var Redis=require(_0x6b93('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6b93('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b93('0x13'));var logger=require(_0x6b93('0x14'))(_0x6b93('0x15'));var utils=require(_0x6b93('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6b93('0x17'));var db=require(_0x6b93('0x18'))['db'];config['redis']=_[_0x6b93('0x19')](config[_0x6b93('0x1a')],{'host':_0x6b93('0x1b'),'port':0x18eb});var socket=require(_0x6b93('0x1c'))(new Redis(config[_0x6b93('0x1a')]));require(_0x6b93('0x1d'))['register'](socket);function respondWithStatusCode(_0x563af4,_0xd8c247){_0xd8c247=_0xd8c247||0xcc;return function(_0x48043d){if(_0x48043d){return _0x563af4[_0x6b93('0x1e')](_0xd8c247);}return _0x563af4[_0x6b93('0x1f')](_0xd8c247)[_0x6b93('0x20')]();};}function respondWithResult(_0x5afe23,_0x38c4d4){_0x38c4d4=_0x38c4d4||0xc8;return function(_0x308022){if(_0x308022){return _0x5afe23[_0x6b93('0x1f')](_0x38c4d4)[_0x6b93('0x21')](_0x308022);}};}function respondWithFilteredResult(_0x58c88a,_0x5c0a4c){return function(_0x59b1ec){if(_0x59b1ec){var _0x13fa0e=typeof _0x5c0a4c[_0x6b93('0x22')]===_0x6b93('0x23')&&typeof _0x5c0a4c[_0x6b93('0x24')]===_0x6b93('0x23');var _0x2c517f=_0x59b1ec[_0x6b93('0x25')];var _0x9734d0=_0x13fa0e?0x0:_0x5c0a4c[_0x6b93('0x22')];var _0x55914e=_0x13fa0e?_0x59b1ec[_0x6b93('0x25')]:_0x5c0a4c['offset']+_0x5c0a4c['limit'];var _0x8cb6ea;if(_0x55914e>=_0x2c517f){_0x55914e=_0x2c517f;_0x8cb6ea=0xc8;}else{_0x8cb6ea=0xce;}_0x58c88a[_0x6b93('0x1f')](_0x8cb6ea);return _0x58c88a[_0x6b93('0x26')](_0x6b93('0x27'),_0x9734d0+'-'+_0x55914e+'/'+_0x2c517f)[_0x6b93('0x21')](_0x59b1ec);}return null;};}function patchUpdates(_0x6824c4){return function(_0x54cfb5){try{jsonpatch['apply'](_0x54cfb5,_0x6824c4,!![]);}catch(_0x229306){return BPromise[_0x6b93('0x28')](_0x229306);}return _0x54cfb5[_0x6b93('0x29')]();};}function saveUpdates(_0x4d67fc,_0x46a6fb){return function(_0x20527b){if(_0x20527b){return _0x20527b[_0x6b93('0x2a')](_0x4d67fc)[_0x6b93('0x2b')](function(_0x497de4){return _0x497de4;});}return null;};}function removeEntity(_0x3ea9b7,_0x57f9f2){return function(_0xbbcd95){if(_0xbbcd95){return _0xbbcd95[_0x6b93('0x2c')]()[_0x6b93('0x2b')](function(){var _0x57d535=_0xbbcd95['get']({'plain':!![]});var _0x545510=_0x6b93('0x2d');return db[_0x6b93('0x2e')][_0x6b93('0x2c')]({'where':{'type':_0x545510,'resourceId':_0x57d535['id']}})['then'](function(){return _0xbbcd95;});})[_0x6b93('0x2b')](function(){_0x3ea9b7[_0x6b93('0x1f')](0xcc)[_0x6b93('0x20')]();});}};}function handleEntityNotFound(_0x47d65a,_0x2fe246){return function(_0x3f6af1){if(!_0x3f6af1){_0x47d65a[_0x6b93('0x1e')](0x194);}return _0x3f6af1;};}function handleError(_0x5a6cf2,_0x1d9c0f){_0x1d9c0f=_0x1d9c0f||0x1f4;return function(_0x7f329){logger['error'](_0x7f329['stack']);if(_0x7f329[_0x6b93('0x2f')]){delete _0x7f329[_0x6b93('0x2f')];}_0x5a6cf2[_0x6b93('0x1f')](_0x1d9c0f)[_0x6b93('0x30')](_0x7f329);};}exports[_0x6b93('0x31')]=function(_0x41e1b8,_0x48d4b7){var _0x162248={},_0x2293e3={},_0x265db7={'count':0x0,'rows':[]};var _0x131e9b=_[_0x6b93('0x32')](db[_0x6b93('0x33')][_0x6b93('0x34')],function(_0x1ef3da){return{'name':_0x1ef3da[_0x6b93('0x35')],'type':_0x1ef3da[_0x6b93('0x36')]['key']};});_0x2293e3[_0x6b93('0x37')]=_[_0x6b93('0x32')](_0x131e9b,_0x6b93('0x2f'));_0x2293e3[_0x6b93('0x38')]=_[_0x6b93('0x39')](_0x41e1b8['query']);_0x2293e3[_0x6b93('0x3a')]=_[_0x6b93('0x3b')](_0x2293e3[_0x6b93('0x37')],_0x2293e3[_0x6b93('0x38')]);_0x162248['attributes']=_['intersection'](_0x2293e3[_0x6b93('0x37')],qs[_0x6b93('0x3c')](_0x41e1b8[_0x6b93('0x38')]['fields']));_0x162248[_0x6b93('0x3d')]=_0x162248[_0x6b93('0x3d')]['length']?_0x162248[_0x6b93('0x3d')]:_0x2293e3[_0x6b93('0x37')];if(!_0x41e1b8[_0x6b93('0x38')][_0x6b93('0x3e')](_0x6b93('0x3f'))){_0x162248[_0x6b93('0x24')]=qs[_0x6b93('0x24')](_0x41e1b8[_0x6b93('0x38')][_0x6b93('0x24')]);_0x162248[_0x6b93('0x22')]=qs['offset'](_0x41e1b8['query'][_0x6b93('0x22')]);}_0x162248[_0x6b93('0x40')]=qs['sort'](_0x41e1b8[_0x6b93('0x38')][_0x6b93('0x41')]);_0x162248['where']=qs[_0x6b93('0x3a')](_[_0x6b93('0x42')](_0x41e1b8['query'],_0x2293e3['filters']),_0x131e9b);if(_0x41e1b8[_0x6b93('0x38')][_0x6b93('0x43')]){_0x162248['where']=_[_0x6b93('0x44')](_0x162248['where'],{'$or':_['map'](_0x131e9b,function(_0xe93f92){if(_0xe93f92['type']!==_0x6b93('0x45')){var _0x15e3d4={};_0x15e3d4[_0xe93f92[_0x6b93('0x2f')]]={'$like':'%'+_0x41e1b8[_0x6b93('0x38')][_0x6b93('0x43')]+'%'};return _0x15e3d4;}})});}_0x162248=_[_0x6b93('0x44')]({},_0x162248,_0x41e1b8['options']);var _0x219dd3={'where':_0x162248[_0x6b93('0x46')]};return db['WhatsappQueue']['count'](_0x219dd3)[_0x6b93('0x2b')](function(_0x441a7b){_0x265db7['count']=_0x441a7b;if(_0x41e1b8[_0x6b93('0x38')][_0x6b93('0x47')]){_0x162248[_0x6b93('0x48')]=[{'all':!![]}];}return db[_0x6b93('0x33')][_0x6b93('0x49')](_0x162248);})[_0x6b93('0x2b')](function(_0x3443bd){_0x265db7['rows']=_0x3443bd;return _0x265db7;})['then'](respondWithFilteredResult(_0x48d4b7,_0x162248))['catch'](handleError(_0x48d4b7,null));};exports[_0x6b93('0x4a')]=function(_0x589d43,_0x56218f){var _0x3131cc={'raw':!![],'where':{'id':_0x589d43['params']['id']}},_0x1bff80={};_0x1bff80['model']=_[_0x6b93('0x39')](db[_0x6b93('0x33')][_0x6b93('0x34')]);_0x1bff80[_0x6b93('0x38')]=_[_0x6b93('0x39')](_0x589d43[_0x6b93('0x38')]);_0x1bff80['filters']=_[_0x6b93('0x3b')](_0x1bff80[_0x6b93('0x37')],_0x1bff80[_0x6b93('0x38')]);_0x3131cc[_0x6b93('0x3d')]=_['intersection'](_0x1bff80[_0x6b93('0x37')],qs[_0x6b93('0x3c')](_0x589d43[_0x6b93('0x38')][_0x6b93('0x3c')]));_0x3131cc[_0x6b93('0x3d')]=_0x3131cc[_0x6b93('0x3d')]['length']?_0x3131cc[_0x6b93('0x3d')]:_0x1bff80[_0x6b93('0x37')];if(_0x589d43[_0x6b93('0x38')][_0x6b93('0x47')]){_0x3131cc[_0x6b93('0x48')]=[{'all':!![]}];}_0x3131cc=_[_0x6b93('0x44')]({},_0x3131cc,_0x589d43[_0x6b93('0x4b')]);return db[_0x6b93('0x33')][_0x6b93('0x4c')](_0x3131cc)[_0x6b93('0x2b')](handleEntityNotFound(_0x56218f,null))[_0x6b93('0x2b')](respondWithResult(_0x56218f,null))[_0x6b93('0x4d')](handleError(_0x56218f,null));};exports[_0x6b93('0x4e')]=function(_0x3b663c,_0x15cdf5){return db[_0x6b93('0x33')]['create'](_0x3b663c[_0x6b93('0x4f')],{})[_0x6b93('0x2b')](function(_0x248fa5){var _0x2750e1=_0x3b663c[_0x6b93('0x50')][_0x6b93('0x51')]({'plain':!![]});if(!_0x2750e1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2750e1[_0x6b93('0x52')]===_0x6b93('0x50')){var _0x4ae33b=_0x248fa5[_0x6b93('0x51')]({'plain':!![]});var _0x3fa7a3='WhatsappQueues';return db[_0x6b93('0x53')]['find']({'where':{'name':_0x3fa7a3,'userProfileId':_0x2750e1[_0x6b93('0x54')]},'raw':!![]})[_0x6b93('0x2b')](function(_0x3988bd){if(_0x3988bd&&_0x3988bd['autoAssociation']===0x0){return db[_0x6b93('0x2e')][_0x6b93('0x4e')]({'name':_0x4ae33b['name'],'resourceId':_0x4ae33b['id'],'type':_0x3988bd[_0x6b93('0x2f')],'sectionId':_0x3988bd['id']},{})[_0x6b93('0x2b')](function(){return _0x248fa5;});}else{return _0x248fa5;}})['catch'](function(_0xa2ad4c){logger[_0x6b93('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa2ad4c);throw _0xa2ad4c;});}return _0x248fa5;})[_0x6b93('0x2b')](respondWithResult(_0x15cdf5,0xc9))['catch'](handleError(_0x15cdf5,null));};exports[_0x6b93('0x2a')]=function(_0x52e48d,_0x518df7){if(_0x52e48d[_0x6b93('0x4f')]['id']){delete _0x52e48d[_0x6b93('0x4f')]['id'];}return db['WhatsappQueue'][_0x6b93('0x4c')]({'where':{'id':_0x52e48d[_0x6b93('0x56')]['id']}})[_0x6b93('0x2b')](handleEntityNotFound(_0x518df7,null))[_0x6b93('0x2b')](saveUpdates(_0x52e48d[_0x6b93('0x4f')],null))[_0x6b93('0x2b')](respondWithResult(_0x518df7,null))[_0x6b93('0x4d')](handleError(_0x518df7,null));};exports[_0x6b93('0x2c')]=function(_0x535756,_0x652b21){return db[_0x6b93('0x33')][_0x6b93('0x4c')]({'where':{'id':_0x535756[_0x6b93('0x56')]['id']}})[_0x6b93('0x2b')](handleEntityNotFound(_0x652b21,null))[_0x6b93('0x2b')](removeEntity(_0x652b21,null))['catch'](handleError(_0x652b21,null));};exports['describe']=function(_0x43b52d,_0x177618){return db[_0x6b93('0x33')][_0x6b93('0x57')]()['then'](respondWithResult(_0x177618,null))[_0x6b93('0x4d')](handleError(_0x177618,null));};exports[_0x6b93('0x58')]=function(_0x5c4d13,_0x3924d0,_0x1dde72){var _0x11c4e2={'raw':!![],'where':{}},_0x4f071e={},_0x3d72ca;return db[_0x6b93('0x33')][_0x6b93('0x59')]({'where':{'id':_0x5c4d13['params']['id']}})['then'](handleEntityNotFound(_0x3924d0,null))[_0x6b93('0x2b')](function(_0x1da889){if(_0x1da889){_0x3d72ca=_0x1da889[_0x6b93('0x51')]({'plain':!![]});_0x4f071e[_0x6b93('0x37')]=_[_0x6b93('0x39')](db[_0x6b93('0x5a')][_0x6b93('0x34')]);_0x4f071e[_0x6b93('0x38')]=_['keys'](_0x5c4d13['query']);_0x4f071e[_0x6b93('0x3a')]=_[_0x6b93('0x3b')](_0x4f071e['model'],_0x4f071e[_0x6b93('0x38')]);_0x11c4e2['attributes']=_[_0x6b93('0x3b')](_0x4f071e['model'],qs[_0x6b93('0x3c')](_0x5c4d13['query']['fields']));_0x11c4e2['attributes']=_0x11c4e2['attributes'][_0x6b93('0x5b')]?_0x11c4e2[_0x6b93('0x3d')]:_0x4f071e[_0x6b93('0x37')];if(!_0x5c4d13[_0x6b93('0x38')][_0x6b93('0x3e')](_0x6b93('0x3f'))){_0x11c4e2[_0x6b93('0x24')]=qs[_0x6b93('0x24')](_0x5c4d13[_0x6b93('0x38')]['limit']);_0x11c4e2[_0x6b93('0x22')]=qs[_0x6b93('0x22')](_0x5c4d13[_0x6b93('0x38')][_0x6b93('0x22')]);}_0x11c4e2[_0x6b93('0x40')]=qs[_0x6b93('0x41')](_0x5c4d13[_0x6b93('0x38')][_0x6b93('0x41')]);_0x11c4e2[_0x6b93('0x46')]=qs['filters'](_[_0x6b93('0x42')](_0x5c4d13['query'],_0x4f071e['filters']));_0x11c4e2[_0x6b93('0x46')]['WhatsappQueueId']=_0x1da889['id'];if(_0x5c4d13[_0x6b93('0x38')][_0x6b93('0x43')]){_0x11c4e2[_0x6b93('0x46')]=_[_0x6b93('0x44')](_0x11c4e2[_0x6b93('0x46')],{'$or':_[_0x6b93('0x32')](_0x11c4e2[_0x6b93('0x3d')],function(_0x35c559){var _0x53a8e0={};_0x53a8e0[_0x35c559]={'$like':'%'+_0x5c4d13[_0x6b93('0x38')][_0x6b93('0x43')]+'%'};return _0x53a8e0;})});}_0x11c4e2=_['merge']({},_0x11c4e2,_0x5c4d13[_0x6b93('0x4b')]);return db[_0x6b93('0x5a')][_0x6b93('0x49')](_0x11c4e2);}})[_0x6b93('0x2b')](function(_0x1f1bc6){if(_0x1f1bc6){return db[_0x6b93('0x5c')][_0x6b93('0x5d')]({'where':{'id':_[_0x6b93('0x32')](_0x1f1bc6,'UserId'),'role':'agent'},'attributes':['id',_0x6b93('0x2f'),_0x6b93('0x5e'),_0x6b93('0x5f'),_0x6b93('0x60')]});}})[_0x6b93('0x2b')](function(_0x1f0911){if(_0x1f0911){return{'count':_0x1f0911['count'],'rows':_[_0x6b93('0x32')](_0x1f0911[_0x6b93('0x61')],function(_0x2e4bc1){return{'membername':_0x2e4bc1['name'],'UserId':_0x2e4bc1['id'],'queue_name':_0x3d72ca[_0x6b93('0x2f')],'WhatsappQueueId':_0x3d72ca['id'],'interface':util[_0x6b93('0x62')](_0x6b93('0x63'),_0x6b93('0x64'),_0x2e4bc1['name']),'penalty':0x0,'paused':_0x2e4bc1[_0x6b93('0x5e')],'createdAt':_0x2e4bc1[_0x6b93('0x60')],'updatedAt':_0x2e4bc1[_0x6b93('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6b93('0x2b')](respondWithFilteredResult(_0x3924d0,_0x11c4e2))[_0x6b93('0x4d')](handleError(_0x3924d0,null));};exports[_0x6b93('0x65')]=function(_0xf2ea75,_0x22aed7,_0x3c2e8d){var _0x58ca21={};var _0x17591b={};var _0x518060;var _0x39bdbb;return db[_0x6b93('0x33')][_0x6b93('0x59')]({'where':{'id':_0xf2ea75[_0x6b93('0x56')]['id']}})['then'](handleEntityNotFound(_0x22aed7,null))[_0x6b93('0x2b')](function(_0x1f4976){if(_0x1f4976){_0x518060=_0x1f4976;_0x17591b[_0x6b93('0x37')]=_[_0x6b93('0x39')](db[_0x6b93('0x66')][_0x6b93('0x34')]);_0x17591b[_0x6b93('0x38')]=_[_0x6b93('0x39')](_0xf2ea75[_0x6b93('0x38')]);_0x17591b[_0x6b93('0x3a')]=_[_0x6b93('0x3b')](_0x17591b[_0x6b93('0x37')],_0x17591b[_0x6b93('0x38')]);_0x58ca21[_0x6b93('0x3d')]=_['intersection'](_0x17591b[_0x6b93('0x37')],qs[_0x6b93('0x3c')](_0xf2ea75[_0x6b93('0x38')][_0x6b93('0x3c')]));_0x58ca21[_0x6b93('0x3d')]=_0x58ca21['attributes'][_0x6b93('0x5b')]?_0x58ca21['attributes']:_0x17591b[_0x6b93('0x37')];_0x58ca21[_0x6b93('0x40')]=qs['sort'](_0xf2ea75[_0x6b93('0x38')][_0x6b93('0x41')]);_0x58ca21[_0x6b93('0x46')]=qs[_0x6b93('0x3a')](_[_0x6b93('0x42')](_0xf2ea75[_0x6b93('0x38')],_0x17591b[_0x6b93('0x3a')]));if(_0xf2ea75[_0x6b93('0x38')][_0x6b93('0x43')]){_0x58ca21[_0x6b93('0x46')]=_[_0x6b93('0x44')](_0x58ca21[_0x6b93('0x46')],{'$or':_[_0x6b93('0x32')](_0x58ca21[_0x6b93('0x3d')],function(_0x48d850){var _0x357067={};_0x357067[_0x48d850]={'$like':'%'+_0xf2ea75[_0x6b93('0x38')][_0x6b93('0x43')]+'%'};return _0x357067;})});}_0x58ca21=_[_0x6b93('0x44')]({},_0x58ca21,_0xf2ea75[_0x6b93('0x4b')]);return _0x518060[_0x6b93('0x65')](_0x58ca21);}})['then'](function(_0xf3d146){if(_0xf3d146){_0x39bdbb=_0xf3d146[_0x6b93('0x5b')];if(!_0xf2ea75[_0x6b93('0x38')][_0x6b93('0x3e')](_0x6b93('0x3f'))){_0x58ca21[_0x6b93('0x24')]=qs[_0x6b93('0x24')](_0xf2ea75['query'][_0x6b93('0x24')]);_0x58ca21[_0x6b93('0x22')]=qs['offset'](_0xf2ea75['query'][_0x6b93('0x22')]);}return _0x518060[_0x6b93('0x65')](_0x58ca21);}})['then'](function(_0x5095e0){if(_0x5095e0){return _0x5095e0?{'count':_0x39bdbb,'rows':_0x5095e0}:null;}})['then'](respondWithResult(_0x22aed7,null))['catch'](handleError(_0x22aed7,null));};exports['addTeams']=function(_0x1e4881,_0x38767c,_0x1700ca){var _0xeddd20=_0x1e4881[_0x6b93('0x4f')][_0x6b93('0x67')];return db[_0x6b93('0x66')][_0x6b93('0x49')]({'where':{'id':_0xeddd20},'attributes':['id'],'include':[{'model':db[_0x6b93('0x5c')],'as':_0x6b93('0x68'),'attributes':['id','name',_0x6b93('0x69'),'voicePause','interface'],'raw':!![]}]})[_0x6b93('0x2b')](function(_0x399301){if(_0x399301){var _0x40dded=_['flatMap'](_0x399301,function(_0x27fc0e){var _0x46b2d6=_0x27fc0e[_0x6b93('0x51')]({'plain':!![]});return _0x46b2d6[_0x6b93('0x68')];});return db[_0x6b93('0x33')]['find']({'where':{'id':_0x1e4881[_0x6b93('0x56')]['id']}})['then'](function(_0x404092){return db['sequelize'][_0x6b93('0x6a')](function(_0x9c899){return _0x404092['addTeams'](_0xeddd20,{'transaction':_0x9c899})[_0x6b93('0x2b')](function(){return BPromise[_0x6b93('0x6b')](_0x40dded,function(_0xcb77a8){return db[_0x6b93('0x5a')][_0x6b93('0x6c')]({'where':{'UserId':_0xcb77a8['id'],'WhatsappQueueId':_0x1e4881[_0x6b93('0x56')]['id']},'transaction':_0x9c899});});})[_0x6b93('0x2b')](function(){_0x40dded[_0x6b93('0x6d')](function(_0x149601){socket[_0x6b93('0x6e')]('userWhatsappQueue:save',{'UserId':_0x149601['id'],'WhatsappQueueId':_0x404092['id']});});});});});}})[_0x6b93('0x2b')](respondWithStatusCode(_0x38767c,null))['catch'](handleError(_0x38767c,null));};exports[_0x6b93('0x6f')]=function(_0x2bbf04,_0x1ef846,_0x88f94d){return db[_0x6b93('0x66')]['findAll']({'where':{'id':_0x2bbf04['query'][_0x6b93('0x67')]},'attributes':['id'],'include':[{'model':db[_0x6b93('0x5c')],'as':_0x6b93('0x68'),'attributes':['id'],'raw':!![]}]})[_0x6b93('0x2b')](handleEntityNotFound(_0x1ef846,null))[_0x6b93('0x2b')](function(_0x33db83){var _0x4779b2=_[_0x6b93('0x32')](_0x33db83,'id');var _0x5e5c25=[];var _0x322919=[];var _0x1e2e65=squel[_0x6b93('0x70')]();_0x1e2e65['field'](_0x6b93('0x71'))['from'](_0x6b93('0x72'),'tq')[_0x6b93('0x73')](_0x6b93('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6b93('0x46')](_0x6b93('0x75'),_0x2bbf04[_0x6b93('0x56')]['id']);for(var _0x4bb425=0x0;_0x4bb425<_0x33db83[_0x6b93('0x5b')];_0x4bb425+=0x1){let _0x59149f=_0x33db83[_0x4bb425];for(var _0x1ea272=0x0;_0x1ea272<_0x59149f[_0x6b93('0x68')][_0x6b93('0x5b')];_0x1ea272+=0x1){let _0x2f759f=_0x59149f[_0x6b93('0x68')][_0x1ea272];var _0x99941f=_0x1e2e65[_0x6b93('0x76')]();_0x99941f[_0x6b93('0x46')](_0x6b93('0x77'),_0x2f759f['id']);_0x322919[_0x6b93('0x78')](db[_0x6b93('0x79')]['query'](_0x99941f[_0x6b93('0x7a')](),{'type':db['sequelize']['QueryTypes'][_0x6b93('0x7b')]})[_0x6b93('0x2b')](function(_0x59b706){if(_0x59b706['length']===0x1){return _0x2f759f['id'];}else{var _0x5c5928=_[_0x6b93('0x7c')](_[_0x6b93('0x32')](_0x59b706,_0x6b93('0x7d')),function(_0xd53f86){return _['includes'](_0x4779b2,_0xd53f86);});if(_0x5c5928){return _0x2f759f['id'];}}}));}}return BPromise[_0x6b93('0x7e')](_0x322919)[_0x6b93('0x2b')](function(_0x23319f){_0x5e5c25=_(_0x5e5c25)[_0x6b93('0x7f')](_0x23319f)[_0x6b93('0x80')]()[_0x6b93('0x81')]();return db['WhatsappQueue'][_0x6b93('0x4c')]({'where':{'id':_0x2bbf04[_0x6b93('0x56')]['id']}})[_0x6b93('0x2b')](function(_0x2feccb){return db[_0x6b93('0x79')][_0x6b93('0x6a')](function(_0x34b641){return _0x2feccb['removeTeams'](_0x2bbf04['query'][_0x6b93('0x67')],{'transaction':_0x34b641})[_0x6b93('0x2b')](function(){if(!_[_0x6b93('0x82')](_0x5e5c25)){return _0x2feccb[_0x6b93('0x83')](_0x5e5c25,{'transaction':_0x34b641});}})[_0x6b93('0x2b')](function(){_0x5e5c25[_0x6b93('0x6d')](function(_0x2bb910){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x2bb910,'WhatsappQueueId':_0x2feccb['id']});});});});});});})[_0x6b93('0x2b')](respondWithStatusCode(_0x1ef846,null))[_0x6b93('0x4d')](handleError(_0x1ef846,null));};exports[_0x6b93('0x84')]=function(_0x409e05,_0x896bfc,_0x4f416d){return db[_0x6b93('0x33')][_0x6b93('0x4c')]({'where':{'id':_0x409e05['params']['id']}})[_0x6b93('0x2b')](handleEntityNotFound(_0x896bfc,null))[_0x6b93('0x2b')](function(_0x14e668){if(_0x14e668){return _0x14e668['addAgents'](_0x409e05['body'][_0x6b93('0x67')],_[_0x6b93('0x85')](_0x409e05['body'],[_0x6b93('0x67'),'id'])||{})[_0x6b93('0x86')](function(_0x465238){for(var _0x20ee15=0x0;_0x20ee15<_0x409e05[_0x6b93('0x4f')][_0x6b93('0x67')]['length'];_0x20ee15+=0x1){socket['emit'](_0x6b93('0x87'),{'UserId':Number(_0x409e05[_0x6b93('0x4f')][_0x6b93('0x67')][_0x20ee15]),'WhatsappQueueId':Number(_0x409e05['params']['id'])});}return _0x465238;});}})[_0x6b93('0x2b')](respondWithResult(_0x896bfc,null))[_0x6b93('0x4d')](handleError(_0x896bfc,null));};exports['removeAgents']=function(_0x5c956a,_0x3d7021,_0x46946e){return db[_0x6b93('0x33')][_0x6b93('0x4c')]({'where':{'id':_0x5c956a[_0x6b93('0x56')]['id']}})[_0x6b93('0x2b')](handleEntityNotFound(_0x3d7021,null))[_0x6b93('0x2b')](function(_0x4388d4){if(_0x4388d4){return _0x4388d4[_0x6b93('0x83')](_0x5c956a[_0x6b93('0x38')][_0x6b93('0x67')])[_0x6b93('0x2b')](function(){if(_['isArray'](_0x5c956a[_0x6b93('0x38')]['ids'])){for(var _0x45ae9c=0x0;_0x45ae9c<_0x5c956a[_0x6b93('0x38')][_0x6b93('0x67')][_0x6b93('0x5b')];_0x45ae9c+=0x1){socket['emit'](_0x6b93('0x88'),{'UserId':Number(_0x5c956a[_0x6b93('0x38')][_0x6b93('0x67')][_0x45ae9c]),'WhatsappQueueId':Number(_0x5c956a['params']['id'])});}}else{socket['emit'](_0x6b93('0x88'),{'UserId':Number(_0x5c956a[_0x6b93('0x38')][_0x6b93('0x67')]),'WhatsappQueueId':Number(_0x5c956a[_0x6b93('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x3d7021,null))[_0x6b93('0x4d')](handleError(_0x3d7021,null));};exports[_0x6b93('0x89')]=function(_0xc0cb55,_0x31c815,_0x1143b1){var _0x5e5e94={};var _0x3ab121={};var _0x420a6e;var _0x1974da;return db[_0x6b93('0x33')][_0x6b93('0x59')]({'where':{'id':_0xc0cb55['params']['id']}})[_0x6b93('0x2b')](handleEntityNotFound(_0x31c815,null))[_0x6b93('0x2b')](function(_0x1b5150){if(_0x1b5150){_0x420a6e=_0x1b5150;_0x3ab121['model']=_['keys'](db[_0x6b93('0x5c')][_0x6b93('0x34')]);_0x3ab121['query']=_[_0x6b93('0x39')](_0xc0cb55[_0x6b93('0x38')]);_0x3ab121[_0x6b93('0x3a')]=_[_0x6b93('0x3b')](_0x3ab121['model'],_0x3ab121[_0x6b93('0x38')]);_0x5e5e94[_0x6b93('0x3d')]=_[_0x6b93('0x3b')](_0x3ab121[_0x6b93('0x37')],qs[_0x6b93('0x3c')](_0xc0cb55[_0x6b93('0x38')][_0x6b93('0x3c')]));_0x5e5e94[_0x6b93('0x3d')]=_0x5e5e94[_0x6b93('0x3d')]['length']?_0x5e5e94['attributes']:_0x3ab121[_0x6b93('0x37')];_0x5e5e94['order']=qs[_0x6b93('0x41')](_0xc0cb55['query'][_0x6b93('0x41')]);_0x5e5e94[_0x6b93('0x46')]=qs[_0x6b93('0x3a')](_[_0x6b93('0x42')](_0xc0cb55['query'],_0x3ab121[_0x6b93('0x3a')]));if(_0xc0cb55[_0x6b93('0x38')][_0x6b93('0x43')]){_0x5e5e94['where']=_[_0x6b93('0x44')](_0x5e5e94['where'],{'$or':_['map'](_0x5e5e94[_0x6b93('0x3d')],function(_0x33ca59){var _0x25616d={};_0x25616d[_0x33ca59]={'$like':'%'+_0xc0cb55[_0x6b93('0x38')][_0x6b93('0x43')]+'%'};return _0x25616d;})});}_0x5e5e94=_['merge']({},_0x5e5e94,_0xc0cb55['options']);return _0x420a6e[_0x6b93('0x89')](_0x5e5e94);}})[_0x6b93('0x2b')](function(_0x5dd60c){if(_0x5dd60c){_0x1974da=_0x5dd60c[_0x6b93('0x5b')];if(!_0xc0cb55[_0x6b93('0x38')][_0x6b93('0x3e')](_0x6b93('0x3f'))){_0x5e5e94[_0x6b93('0x24')]=qs[_0x6b93('0x24')](_0xc0cb55[_0x6b93('0x38')][_0x6b93('0x24')]);_0x5e5e94[_0x6b93('0x22')]=qs[_0x6b93('0x22')](_0xc0cb55[_0x6b93('0x38')][_0x6b93('0x22')]);}return _0x420a6e[_0x6b93('0x89')](_0x5e5e94);}})['then'](function(_0x15b5b9){if(_0x15b5b9){return _0x15b5b9?{'count':_0x1974da,'rows':_0x15b5b9}:null;}})[_0x6b93('0x2b')](respondWithResult(_0x31c815,null))[_0x6b93('0x4d')](handleError(_0x31c815,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4443b43..3643d76 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 _0x858d=['events','WhatsappQueue','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x149730,_0x40aae8){var _0x2c23c0=function(_0x49ad9d){while(--_0x49ad9d){_0x149730['push'](_0x149730['shift']());}};_0x2c23c0(++_0x40aae8);}(_0x858d,0x130));var _0xd858=function(_0x11cc67,_0x44a9a9){_0x11cc67=_0x11cc67-0x0;var _0x163139=_0x858d[_0x11cc67];return _0x163139;};'use strict';var EventEmitter=require(_0xd858('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xd858('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd858('0x2'),'afterUpdate':_0xd858('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4561a2){return function(_0x59898f,_0x36ceda,_0x38553d){WhatsappQueueEvents[_0xd858('0x4')](_0x4561a2+':'+_0x59898f['id'],_0x59898f);WhatsappQueueEvents['emit'](_0x4561a2,_0x59898f);_0x38553d(null);};}for(var e in events){if(events[_0xd858('0x5')](e)){var event=events[e];WhatsappQueue[_0xd858('0x6')](e,emitEvent(event));}}module[_0xd858('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x1ff1=['hook','events','../../mysqldb','WhatsappQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x2051c5,_0x3d235c){var _0x146f60=function(_0x550a46){while(--_0x550a46){_0x2051c5['push'](_0x2051c5['shift']());}};_0x146f60(++_0x3d235c);}(_0x1ff1,0x160));var _0x11ff=function(_0x25cd64,_0x53c25a){_0x25cd64=_0x25cd64-0x0;var _0x49c325=_0x1ff1[_0x25cd64];return _0x49c325;};'use strict';var EventEmitter=require(_0x11ff('0x0'));var WhatsappQueue=require(_0x11ff('0x1'))['db'][_0x11ff('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x11ff('0x3'),'afterUpdate':_0x11ff('0x4'),'afterDestroy':_0x11ff('0x5')};function emitEvent(_0x43b43f){return function(_0x19b407,_0x108c5e,_0x59be28){WhatsappQueueEvents[_0x11ff('0x6')](_0x43b43f+':'+_0x19b407['id'],_0x19b407);WhatsappQueueEvents['emit'](_0x43b43f,_0x19b407);_0x59be28(null);};}for(var e in events){if(events[_0x11ff('0x7')](e)){var event=events[e];WhatsappQueue[_0x11ff('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 04d58ea..9aa5f21 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 _0xa50f=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x832ad,_0x553e9d){var _0x53ff3f=function(_0x4cfb8e){while(--_0x4cfb8e){_0x832ad['push'](_0x832ad['shift']());}};_0x53ff3f(++_0x553e9d);}(_0xa50f,0x82));var _0xfa50=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa50f[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xfa50('0x0'));var util=require(_0xfa50('0x1'));var logger=require(_0xfa50('0x2'))('api');var moment=require(_0xfa50('0x3'));var BPromise=require('bluebird');var rp=require(_0xfa50('0x4'));var fs=require('fs');var path=require(_0xfa50('0x5'));var rimraf=require(_0xfa50('0x6'));var config=require(_0xfa50('0x7'));var attributes=require(_0xfa50('0x8'));module['exports']=function(_0x7b6f99,_0x3a2a0e){return _0x7b6f99[_0xfa50('0x9')](_0xfa50('0xa'),attributes,{'tableName':_0xfa50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b9e=['define','whatsapp_queues','util','request-promise','path','exports'];(function(_0x7cb5d3,_0x44177b){var _0x4ec5f4=function(_0x13a084){while(--_0x13a084){_0x7cb5d3['push'](_0x7cb5d3['shift']());}};_0x4ec5f4(++_0x44177b);}(_0x7b9e,0x1be));var _0xe7b9=function(_0x49b15c,_0x53b2c9){_0x49b15c=_0x49b15c-0x0;var _0x46d4b0=_0x7b9e[_0x49b15c];return _0x46d4b0;};'use strict';var _=require('lodash');var util=require(_0xe7b9('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe7b9('0x1'));var fs=require('fs');var path=require(_0xe7b9('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0xe7b9('0x3')]=function(_0x3c3321,_0x57dbd5){return _0x3c3321[_0xe7b9('0x4')]('WhatsappQueue',attributes,{'tableName':_0xe7b9('0x5'),'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 50dc73e..a574764 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 _0x5689=['localhost','socket.io-emitter','register','request','info','request\x20sent','debug','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','WhatsappQueue','options','raw','attributes','limit','include','map','model','then','GetWhatsappQueue','catch','ShowWhatsappQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x39cc56,_0x964a69){var _0x741987=function(_0x2d1500){while(--_0x2d1500){_0x39cc56['push'](_0x39cc56['shift']());}};_0x741987(++_0x964a69);}(_0x5689,0x6a));var _0x9568=function(_0x453eee,_0x3e6c80){_0x453eee=_0x453eee-0x0;var _0x59cd85=_0x5689[_0x453eee];return _0x59cd85;};'use strict';var _=require(_0x9568('0x0'));var util=require('util');var moment=require(_0x9568('0x1'));var BPromise=require(_0x9568('0x2'));var rs=require(_0x9568('0x3'));var fs=require('fs');var Redis=require(_0x9568('0x4'));var db=require(_0x9568('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9568('0x6'))(_0x9568('0x7'));var config=require(_0x9568('0x8'));var jayson=require(_0x9568('0x9'));var client=jayson[_0x9568('0xa')][_0x9568('0xb')]({'port':0x232a});config[_0x9568('0xc')]=_[_0x9568('0xd')](config[_0x9568('0xc')],{'host':_0x9568('0xe'),'port':0x18eb});var socket=require(_0x9568('0xf'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x9568('0x10')](socket);function respondWithRpcPromise(_0x318bb8,_0x472a9f,_0x22f3b1){return new BPromise(function(_0x44b26d,_0x3c54ce){return client[_0x9568('0x11')](_0x318bb8,_0x22f3b1)['then'](function(_0x2ce5b1){logger[_0x9568('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x472a9f,_0x9568('0x13'));logger[_0x9568('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x472a9f,_0x9568('0x13'),JSON[_0x9568('0x15')](_0x2ce5b1));if(_0x2ce5b1[_0x9568('0x16')]){if(_0x2ce5b1['error'][_0x9568('0x17')]===0x1f4){logger[_0x9568('0x16')](_0x9568('0x18'),_0x472a9f,_0x2ce5b1[_0x9568('0x16')][_0x9568('0x19')]);return _0x3c54ce(_0x2ce5b1[_0x9568('0x16')]['message']);}logger[_0x9568('0x16')](_0x9568('0x18'),_0x472a9f,_0x2ce5b1[_0x9568('0x16')][_0x9568('0x19')]);return _0x44b26d(_0x2ce5b1[_0x9568('0x16')][_0x9568('0x19')]);}else{logger[_0x9568('0x12')](_0x9568('0x18'),_0x472a9f,_0x9568('0x13'));_0x44b26d(_0x2ce5b1[_0x9568('0x1a')][_0x9568('0x19')]);}})['catch'](function(_0x1fafb6){logger['error'](_0x9568('0x18'),_0x472a9f,_0x1fafb6);_0x3c54ce(_0x1fafb6);});});}exports['GetWhatsappQueue']=function(_0x313602){var _0x3f372f=this;return new Promise(function(_0x31bce8,_0x2d248b){return db[_0x9568('0x1b')]['findAll']({'raw':_0x313602[_0x9568('0x1c')]?_0x313602[_0x9568('0x1c')][_0x9568('0x1d')]===undefined?!![]:![]:!![],'where':_0x313602['options']?_0x313602[_0x9568('0x1c')]['where']||null:null,'attributes':_0x313602[_0x9568('0x1c')]?_0x313602['options'][_0x9568('0x1e')]||null:null,'limit':_0x313602[_0x9568('0x1c')]?_0x313602['options'][_0x9568('0x1f')]||null:null,'include':_0x313602[_0x9568('0x1c')]?_0x313602[_0x9568('0x1c')][_0x9568('0x20')]?_[_0x9568('0x21')](_0x313602['options'][_0x9568('0x20')],function(_0x3fb333){return{'model':db[_0x3fb333[_0x9568('0x22')]],'as':_0x3fb333['as'],'attributes':_0x3fb333[_0x9568('0x1e')],'include':_0x3fb333[_0x9568('0x20')]?_[_0x9568('0x21')](_0x3fb333[_0x9568('0x20')],function(_0x3c4383){return{'model':db[_0x3c4383[_0x9568('0x22')]],'as':_0x3c4383['as'],'attributes':_0x3c4383[_0x9568('0x1e')],'include':_0x3c4383[_0x9568('0x20')]?_[_0x9568('0x21')](_0x3c4383[_0x9568('0x20')],function(_0x2452ba){return{'model':db[_0x2452ba[_0x9568('0x22')]],'as':_0x2452ba['as'],'attributes':_0x2452ba['attributes']};}):[]};}):[]};}):[]:[]})[_0x9568('0x23')](function(_0x7f286c){logger[_0x9568('0x12')](_0x9568('0x24'),_0x313602);logger[_0x9568('0x14')](_0x9568('0x24'),_0x313602,JSON['stringify'](_0x7f286c));_0x31bce8(_0x7f286c);})[_0x9568('0x25')](function(_0x2b1a1d){logger[_0x9568('0x16')]('GetWhatsappQueue',_0x2b1a1d[_0x9568('0x19')],_0x313602);_0x2d248b(_0x3f372f['error'](0x1f4,_0x2b1a1d[_0x9568('0x19')]));});});};exports[_0x9568('0x26')]=function(_0x514b33){var _0x55723a=this;return new Promise(function(_0x3d645a,_0x1ca63d){return db[_0x9568('0x1b')][_0x9568('0x27')]({'raw':_0x514b33[_0x9568('0x1c')]?_0x514b33[_0x9568('0x1c')][_0x9568('0x1d')]===undefined?!![]:![]:!![],'where':_0x514b33[_0x9568('0x1c')]?_0x514b33[_0x9568('0x1c')]['where']||null:null,'attributes':_0x514b33[_0x9568('0x1c')]?_0x514b33[_0x9568('0x1c')][_0x9568('0x1e')]||null:null,'include':_0x514b33['options']?_0x514b33[_0x9568('0x1c')][_0x9568('0x20')]?_[_0x9568('0x21')](_0x514b33['options'][_0x9568('0x20')],function(_0x774e7){return{'model':db[_0x774e7['model']],'as':_0x774e7['as'],'attributes':_0x774e7['attributes'],'include':_0x774e7[_0x9568('0x20')]?_['map'](_0x774e7[_0x9568('0x20')],function(_0x35ad42){return{'model':db[_0x35ad42['model']],'as':_0x35ad42['as'],'attributes':_0x35ad42[_0x9568('0x1e')],'include':_0x35ad42[_0x9568('0x20')]?_[_0x9568('0x21')](_0x35ad42[_0x9568('0x20')],function(_0x205471){return{'model':db[_0x205471['model']],'as':_0x205471['as'],'attributes':_0x205471[_0x9568('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x535680){logger[_0x9568('0x12')](_0x9568('0x26'),_0x514b33);logger['debug'](_0x9568('0x26'),_0x514b33,JSON['stringify'](_0x535680));_0x3d645a(_0x535680);})[_0x9568('0x25')](function(_0x3daeb3){logger['error'](_0x9568('0x26'),_0x3daeb3[_0x9568('0x19')],_0x514b33);_0x1ca63d(_0x55723a[_0x9568('0x16')](0x1f4,_0x3daeb3[_0x9568('0x19')]));});});}; \ No newline at end of file +var _0xe01d=['WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowWhatsappQueue','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetWhatsappQueue'];(function(_0x3ea3cb,_0x58e54c){var _0x49d38b=function(_0x1af7a0){while(--_0x1af7a0){_0x3ea3cb['push'](_0x3ea3cb['shift']());}};_0x49d38b(++_0x58e54c);}(_0xe01d,0x11e));var _0xde01=function(_0x50e001,_0x45aa55){_0x50e001=_0x50e001-0x0;var _0x3fe4a2=_0xe01d[_0x50e001];return _0x3fe4a2;};'use strict';var _=require(_0xde01('0x0'));var util=require(_0xde01('0x1'));var moment=require(_0xde01('0x2'));var BPromise=require('bluebird');var rs=require(_0xde01('0x3'));var fs=require('fs');var Redis=require(_0xde01('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xde01('0x5'));var logger=require(_0xde01('0x6'))('rpc');var config=require(_0xde01('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xde01('0x8')]({'port':0x232a});config[_0xde01('0x9')]=_[_0xde01('0xa')](config[_0xde01('0x9')],{'host':_0xde01('0xb'),'port':0x18eb});var socket=require(_0xde01('0xc'))(new Redis(config[_0xde01('0x9')]));require(_0xde01('0xd'))[_0xde01('0xe')](socket);function respondWithRpcPromise(_0x5bcd8d,_0x3e60f1,_0x22fcf9){return new BPromise(function(_0x42c811,_0x381113){return client[_0xde01('0xf')](_0x5bcd8d,_0x22fcf9)[_0xde01('0x10')](function(_0x446bcb){logger[_0xde01('0x11')](_0xde01('0x12'),_0x3e60f1,_0xde01('0x13'));logger[_0xde01('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3e60f1,_0xde01('0x13'),JSON['stringify'](_0x446bcb));if(_0x446bcb['error']){if(_0x446bcb[_0xde01('0x15')]['code']===0x1f4){logger[_0xde01('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x3e60f1,_0x446bcb[_0xde01('0x15')][_0xde01('0x16')]);return _0x381113(_0x446bcb[_0xde01('0x15')]['message']);}logger['error'](_0xde01('0x12'),_0x3e60f1,_0x446bcb[_0xde01('0x15')][_0xde01('0x16')]);return _0x42c811(_0x446bcb[_0xde01('0x15')][_0xde01('0x16')]);}else{logger[_0xde01('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x3e60f1,_0xde01('0x13'));_0x42c811(_0x446bcb[_0xde01('0x17')][_0xde01('0x16')]);}})[_0xde01('0x18')](function(_0x368fb2){logger[_0xde01('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x3e60f1,_0x368fb2);_0x381113(_0x368fb2);});});}exports[_0xde01('0x19')]=function(_0x8a8960){var _0x2d1f5a=this;return new Promise(function(_0x1c43cd,_0x37cf0e){return db[_0xde01('0x1a')][_0xde01('0x1b')]({'raw':_0x8a8960[_0xde01('0x1c')]?_0x8a8960[_0xde01('0x1c')][_0xde01('0x1d')]===undefined?!![]:![]:!![],'where':_0x8a8960[_0xde01('0x1c')]?_0x8a8960[_0xde01('0x1c')][_0xde01('0x1e')]||null:null,'attributes':_0x8a8960[_0xde01('0x1c')]?_0x8a8960[_0xde01('0x1c')]['attributes']||null:null,'limit':_0x8a8960[_0xde01('0x1c')]?_0x8a8960[_0xde01('0x1c')][_0xde01('0x1f')]||null:null,'include':_0x8a8960['options']?_0x8a8960['options'][_0xde01('0x20')]?_[_0xde01('0x21')](_0x8a8960[_0xde01('0x1c')]['include'],function(_0x39ad96){return{'model':db[_0x39ad96[_0xde01('0x22')]],'as':_0x39ad96['as'],'attributes':_0x39ad96[_0xde01('0x23')],'include':_0x39ad96['include']?_[_0xde01('0x21')](_0x39ad96[_0xde01('0x20')],function(_0x34bac0){return{'model':db[_0x34bac0[_0xde01('0x22')]],'as':_0x34bac0['as'],'attributes':_0x34bac0[_0xde01('0x23')],'include':_0x34bac0['include']?_[_0xde01('0x21')](_0x34bac0['include'],function(_0x216f98){return{'model':db[_0x216f98[_0xde01('0x22')]],'as':_0x216f98['as'],'attributes':_0x216f98['attributes']};}):[]};}):[]};}):[]:[]})[_0xde01('0x10')](function(_0x1ecfeb){logger['info'](_0xde01('0x19'),_0x8a8960);logger[_0xde01('0x14')](_0xde01('0x19'),_0x8a8960,JSON[_0xde01('0x24')](_0x1ecfeb));_0x1c43cd(_0x1ecfeb);})[_0xde01('0x18')](function(_0x42c420){logger['error']('GetWhatsappQueue',_0x42c420['message'],_0x8a8960);_0x37cf0e(_0x2d1f5a['error'](0x1f4,_0x42c420[_0xde01('0x16')]));});});};exports[_0xde01('0x25')]=function(_0x58bbc2){var _0x25b5bf=this;return new Promise(function(_0x9dcca1,_0x2199d1){return db[_0xde01('0x1a')][_0xde01('0x26')]({'raw':_0x58bbc2[_0xde01('0x1c')]?_0x58bbc2['options']['raw']===undefined?!![]:![]:!![],'where':_0x58bbc2[_0xde01('0x1c')]?_0x58bbc2[_0xde01('0x1c')][_0xde01('0x1e')]||null:null,'attributes':_0x58bbc2[_0xde01('0x1c')]?_0x58bbc2[_0xde01('0x1c')][_0xde01('0x23')]||null:null,'include':_0x58bbc2[_0xde01('0x1c')]?_0x58bbc2[_0xde01('0x1c')]['include']?_[_0xde01('0x21')](_0x58bbc2[_0xde01('0x1c')][_0xde01('0x20')],function(_0x4eeadc){return{'model':db[_0x4eeadc[_0xde01('0x22')]],'as':_0x4eeadc['as'],'attributes':_0x4eeadc[_0xde01('0x23')],'include':_0x4eeadc[_0xde01('0x20')]?_[_0xde01('0x21')](_0x4eeadc['include'],function(_0xa61138){return{'model':db[_0xa61138['model']],'as':_0xa61138['as'],'attributes':_0xa61138[_0xde01('0x23')],'include':_0xa61138[_0xde01('0x20')]?_[_0xde01('0x21')](_0xa61138[_0xde01('0x20')],function(_0x107b82){return{'model':db[_0x107b82[_0xde01('0x22')]],'as':_0x107b82['as'],'attributes':_0x107b82[_0xde01('0x23')]};}):[]};}):[]};}):[]:[]})[_0xde01('0x10')](function(_0x4e4c01){logger['info'](_0xde01('0x25'),_0x58bbc2);logger[_0xde01('0x14')](_0xde01('0x25'),_0x58bbc2,JSON[_0xde01('0x24')](_0x4e4c01));_0x9dcca1(_0x4e4c01);})['catch'](function(_0xe0bf69){logger[_0xde01('0x15')]('ShowWhatsappQueue',_0xe0bf69[_0xde01('0x16')],_0x58bbc2);_0x2199d1(_0x25b5bf['error'](0x1f4,_0xe0bf69[_0xde01('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 0ff817f..1048c40 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 _0x79c3=['./whatsappQueue.events','save','remove','register','whatsappQueue:'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x79c3,0xaf));var _0x379c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x79c3[_0x5b644e];return _0x49c6bf;};'use strict';var WhatsappQueueEvents=require(_0x379c('0x0'));var events=[_0x379c('0x1'),_0x379c('0x2'),'update'];function createListener(_0x3183a7,_0x34f16e){return function(_0x280329){_0x34f16e['emit'](_0x3183a7,_0x280329);};}function removeListener(_0x78f3c4,_0x401b59){return function(){WhatsappQueueEvents['removeListener'](_0x78f3c4,_0x401b59);};}exports[_0x379c('0x3')]=function(_0x1e9a6c){for(var _0x27ace3=0x0,_0x131f32=events['length'];_0x27ace3<_0x131f32;_0x27ace3++){var _0x19abaf=events[_0x27ace3];var _0x2282e9=createListener(_0x379c('0x4')+_0x19abaf,_0x1e9a6c);WhatsappQueueEvents['on'](_0x19abaf,_0x2282e9);}}; \ No newline at end of file +var _0x90c9=['save','remove','update','emit','length','./whatsappQueue.events'];(function(_0x2b73b0,_0x5e868e){var _0x59b94f=function(_0x476b13){while(--_0x476b13){_0x2b73b0['push'](_0x2b73b0['shift']());}};_0x59b94f(++_0x5e868e);}(_0x90c9,0x113));var _0x990c=function(_0x7844b9,_0x579e6a){_0x7844b9=_0x7844b9-0x0;var _0x4e9db6=_0x90c9[_0x7844b9];return _0x4e9db6;};'use strict';var WhatsappQueueEvents=require(_0x990c('0x0'));var events=[_0x990c('0x1'),_0x990c('0x2'),_0x990c('0x3')];function createListener(_0x7776d8,_0x4731f1){return function(_0xaa98c0){_0x4731f1[_0x990c('0x4')](_0x7776d8,_0xaa98c0);};}function removeListener(_0x38d9d2,_0x5f42f0){return function(){WhatsappQueueEvents['removeListener'](_0x38d9d2,_0x5f42f0);};}exports['register']=function(_0x49d454){for(var _0x540bdb=0x0,_0x101c9f=events[_0x990c('0x5')];_0x540bdb<_0x101c9f;_0x540bdb++){var _0x359cdd=events[_0x540bdb];var _0x8d313e=createListener('whatsappQueue:'+_0x359cdd,_0x49d454);WhatsappQueueEvents['on'](_0x359cdd,_0x8d313e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index f36b85e..ea0c90d 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 _0x8e74=['/:id','show','put','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x8e74,0x97));var _0x48e7=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x8e74[_0x28aea5];return _0x6a55f9;};'use strict';var multer=require('multer');var util=require(_0x48e7('0x0'));var path=require(_0x48e7('0x1'));var timeout=require('connect-timeout');var express=require(_0x48e7('0x2'));var router=express[_0x48e7('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x48e7('0x4'));var config=require(_0x48e7('0x5'));var controller=require('./whatsappQueueReport.controller');router[_0x48e7('0x6')]('/',auth[_0x48e7('0x7')](),controller['index']);router[_0x48e7('0x6')]('/describe',auth[_0x48e7('0x7')](),controller[_0x48e7('0x8')]);router[_0x48e7('0x6')](_0x48e7('0x9'),auth[_0x48e7('0x7')](),controller[_0x48e7('0xa')]);router['post']('/',auth[_0x48e7('0x7')](),controller['create']);router[_0x48e7('0xb')](_0x48e7('0x9'),auth[_0x48e7('0x7')](),controller[_0x48e7('0xc')]);router[_0x48e7('0xd')](_0x48e7('0x9'),auth[_0x48e7('0x7')](),controller[_0x48e7('0xe')]);module[_0x48e7('0xf')]=router; \ No newline at end of file +var _0x93cd=['index','/describe','describe','/:id','post','create','put','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated'];(function(_0x510cce,_0x25489d){var _0x315044=function(_0x5d291a){while(--_0x5d291a){_0x510cce['push'](_0x510cce['shift']());}};_0x315044(++_0x25489d);}(_0x93cd,0x128));var _0xd93c=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x93cd[_0x1e6b59];return _0x40d7c5;};'use strict';var multer=require(_0xd93c('0x0'));var util=require('util');var path=require(_0xd93c('0x1'));var timeout=require(_0xd93c('0x2'));var express=require(_0xd93c('0x3'));var router=express[_0xd93c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd93c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd93c('0x6'));var controller=require(_0xd93c('0x7'));router[_0xd93c('0x8')]('/',auth[_0xd93c('0x9')](),controller[_0xd93c('0xa')]);router[_0xd93c('0x8')](_0xd93c('0xb'),auth[_0xd93c('0x9')](),controller[_0xd93c('0xc')]);router['get'](_0xd93c('0xd'),auth[_0xd93c('0x9')](),controller['show']);router[_0xd93c('0xe')]('/',auth[_0xd93c('0x9')](),controller[_0xd93c('0xf')]);router[_0xd93c('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xd93c('0xd'),auth[_0xd93c('0x9')](),controller['destroy']);module[_0xd93c('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 2edac5c..f4e1b39 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x30aacf,_0x1a3d21){var _0x11da62=function(_0x58c6a4){while(--_0x58c6a4){_0x30aacf['push'](_0x30aacf['shift']());}};_0x11da62(++_0x1a3d21);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4c2101,_0x331c4a){var _0x2d0a67=function(_0x5f0c07){while(--_0x5f0c07){_0x4c2101['push'](_0x4c2101['shift']());}};_0x2d0a67(++_0x331c4a);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 5cf9116..339672b 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 _0x2032=['body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','rows','show','params','keys','rawAttributes','includeAll','find','catch'];(function(_0x57bb3a,_0x237ede){var _0x5decaa=function(_0x262a8f){while(--_0x262a8f){_0x57bb3a['push'](_0x57bb3a['shift']());}};_0x5decaa(++_0x237ede);}(_0x2032,0xd9));var _0x2203=function(_0x46a4bc,_0xa762d6){_0x46a4bc=_0x46a4bc-0x0;var _0x589d5c=_0x2032[_0x46a4bc];return _0x589d5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'all':!![]}];}return db[_0x2203('0x2c')]['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x446209){_0x34b8ba[_0x2203('0x3f')]=_0x446209;return _0x34b8ba;})['then'](respondWithFilteredResult(_0x1df508,_0x9c53f))['catch'](handleError(_0x1df508,null));};exports[_0x2203('0x40')]=function(_0x3739f6,_0x368444){var _0x1e09f3={'raw':!![],'where':{'id':_0x3739f6[_0x2203('0x41')]['id']}},_0x372709={};_0x372709['model']=_[_0x2203('0x42')](db[_0x2203('0x2c')][_0x2203('0x43')]);_0x372709[_0x2203('0x30')]=_[_0x2203('0x42')](_0x3739f6[_0x2203('0x30')]);_0x372709[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],_0x372709[_0x2203('0x30')]);_0x1e09f3['attributes']=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],qs[_0x2203('0x34')](_0x3739f6[_0x2203('0x30')]['fields']));_0x1e09f3['attributes']=_0x1e09f3[_0x2203('0x32')]['length']?_0x1e09f3[_0x2203('0x32')]:_0x372709[_0x2203('0x31')];if(_0x3739f6[_0x2203('0x30')][_0x2203('0x44')]){_0x1e09f3['include']=[{'all':!![]}];}_0x1e09f3=_[_0x2203('0x3c')]({},_0x1e09f3,_0x3739f6[_0x2203('0x3e')]);return db['WhatsappQueueReport'][_0x2203('0x45')](_0x1e09f3)[_0x2203('0x23')](handleEntityNotFound(_0x368444,null))[_0x2203('0x23')](respondWithResult(_0x368444,null))[_0x2203('0x46')](handleError(_0x368444,null));};exports['create']=function(_0x4c1a29,_0x21b8ab){return db['WhatsappQueueReport']['create'](_0x4c1a29[_0x2203('0x47')],{})[_0x2203('0x23')](respondWithResult(_0x21b8ab,0xc9))[_0x2203('0x46')](handleError(_0x21b8ab,null));};exports['update']=function(_0x4c1496,_0x131aec){if(_0x4c1496[_0x2203('0x47')]['id']){delete _0x4c1496[_0x2203('0x47')]['id'];}return db[_0x2203('0x2c')][_0x2203('0x45')]({'where':{'id':_0x4c1496[_0x2203('0x41')]['id']}})['then'](handleEntityNotFound(_0x131aec,null))[_0x2203('0x23')](saveUpdates(_0x4c1496['body'],null))[_0x2203('0x23')](respondWithResult(_0x131aec,null))[_0x2203('0x46')](handleError(_0x131aec,null));};exports[_0x2203('0x24')]=function(_0x1e49dd,_0x58b9bb){return db['WhatsappQueueReport'][_0x2203('0x45')]({'where':{'id':_0x1e49dd[_0x2203('0x41')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x58b9bb,null))[_0x2203('0x23')](removeEntity(_0x58b9bb,null))['catch'](handleError(_0x58b9bb,null));};exports['describe']=function(_0x49999a,_0x4064d5){return db[_0x2203('0x2c')]['describe']()[_0x2203('0x23')](respondWithResult(_0x4064d5,null))[_0x2203('0x46')](handleError(_0x4064d5,null));}; \ No newline at end of file +var _0xe5b5=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','create','body','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','jsforce','desk.js','querystring','papaparse'];(function(_0x501f51,_0x40f804){var _0x351621=function(_0x1ffd9f){while(--_0x1ffd9f){_0x501f51['push'](_0x501f51['shift']());}};_0x351621(++_0x40f804);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0xe5b5[_0x1b1f88];return _0x5045b9;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310f71,_0x18434e){_0x18434e=_0x18434e||0xcc;return function(_0x4559a0){if(_0x4559a0){return _0x310f71[_0x5e5b('0x1b')](_0x18434e);}return _0x310f71[_0x5e5b('0x1c')](_0x18434e)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x2e331d,_0x49edd0){_0x49edd0=_0x49edd0||0xc8;return function(_0x2b37fa){if(_0x2b37fa){return _0x2e331d[_0x5e5b('0x1c')](_0x49edd0)['json'](_0x2b37fa);}};}function respondWithFilteredResult(_0x227417,_0x578c14){return function(_0x4e9509){if(_0x4e9509){var _0x13a1cb=typeof _0x578c14[_0x5e5b('0x1e')]===_0x5e5b('0x1f')&&typeof _0x578c14['limit']===_0x5e5b('0x1f');var _0x4d490c=_0x4e9509[_0x5e5b('0x20')];var _0x45a091=_0x13a1cb?0x0:_0x578c14['offset'];var _0xe5aa6b=_0x13a1cb?_0x4e9509[_0x5e5b('0x20')]:_0x578c14[_0x5e5b('0x1e')]+_0x578c14['limit'];var _0x2bf0b7;if(_0xe5aa6b>=_0x4d490c){_0xe5aa6b=_0x4d490c;_0x2bf0b7=0xc8;}else{_0x2bf0b7=0xce;}_0x227417[_0x5e5b('0x1c')](_0x2bf0b7);return _0x227417['set'](_0x5e5b('0x21'),_0x45a091+'-'+_0xe5aa6b+'/'+_0x4d490c)[_0x5e5b('0x22')](_0x4e9509);}return null;};}function patchUpdates(_0x3c488e){return function(_0x2d8252){try{jsonpatch[_0x5e5b('0x23')](_0x2d8252,_0x3c488e,!![]);}catch(_0x33d61b){return BPromise[_0x5e5b('0x24')](_0x33d61b);}return _0x2d8252[_0x5e5b('0x25')]();};}function saveUpdates(_0x4a78e3,_0x512e46){return function(_0x256a00){if(_0x256a00){return _0x256a00[_0x5e5b('0x26')](_0x4a78e3)[_0x5e5b('0x27')](function(_0xe1c268){return _0xe1c268;});}return null;};}function removeEntity(_0x2e38ed,_0x28cd95){return function(_0x135c6c){if(_0x135c6c){return _0x135c6c[_0x5e5b('0x28')]()[_0x5e5b('0x27')](function(){_0x2e38ed[_0x5e5b('0x1c')](0xcc)[_0x5e5b('0x1d')]();});}};}function handleEntityNotFound(_0x4da321,_0x1ebb11){return function(_0x75800d){if(!_0x75800d){_0x4da321[_0x5e5b('0x1b')](0x194);}return _0x75800d;};}function handleError(_0x5a2ba8,_0x988e5d){_0x988e5d=_0x988e5d||0x1f4;return function(_0xdb2863){logger['error'](_0xdb2863[_0x5e5b('0x29')]);if(_0xdb2863[_0x5e5b('0x2a')]){delete _0xdb2863[_0x5e5b('0x2a')];}_0x5a2ba8[_0x5e5b('0x1c')](_0x988e5d)[_0x5e5b('0x2b')](_0xdb2863);};}exports[_0x5e5b('0x2c')]=function(_0x2cb695,_0x2b4351){var _0x3f6b25={},_0x42da3b={},_0xcb272c={'count':0x0,'rows':[]};var _0x28157a=_['map'](db['WhatsappQueueReport'][_0x5e5b('0x2d')],function(_0x289f54){return{'name':_0x289f54[_0x5e5b('0x2e')],'type':_0x289f54[_0x5e5b('0x2f')][_0x5e5b('0x30')]};});_0x42da3b['model']=_[_0x5e5b('0x31')](_0x28157a,'name');_0x42da3b[_0x5e5b('0x32')]=_[_0x5e5b('0x33')](_0x2cb695[_0x5e5b('0x32')]);_0x42da3b[_0x5e5b('0x34')]=_['intersection'](_0x42da3b[_0x5e5b('0x35')],_0x42da3b[_0x5e5b('0x32')]);_0x3f6b25['attributes']=_[_0x5e5b('0x36')](_0x42da3b[_0x5e5b('0x35')],qs[_0x5e5b('0x37')](_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x37')]));_0x3f6b25[_0x5e5b('0x38')]=_0x3f6b25[_0x5e5b('0x38')][_0x5e5b('0x39')]?_0x3f6b25['attributes']:_0x42da3b[_0x5e5b('0x35')];if(!_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x3a')](_0x5e5b('0x3b'))){_0x3f6b25[_0x5e5b('0x3c')]=qs[_0x5e5b('0x3c')](_0x2cb695['query']['limit']);_0x3f6b25[_0x5e5b('0x1e')]=qs[_0x5e5b('0x1e')](_0x2cb695[_0x5e5b('0x32')]['offset']);}_0x3f6b25[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x3e')]);_0x3f6b25['where']=qs[_0x5e5b('0x34')](_[_0x5e5b('0x3f')](_0x2cb695['query'],_0x42da3b['filters']),_0x28157a);if(_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x40')]){_0x3f6b25[_0x5e5b('0x41')]=_['merge'](_0x3f6b25[_0x5e5b('0x41')],{'$or':_['map'](_0x28157a,function(_0x5cb741){if(_0x5cb741[_0x5e5b('0x2f')]!==_0x5e5b('0x42')){var _0xef0295={};_0xef0295[_0x5cb741[_0x5e5b('0x2a')]]={'$like':'%'+_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x40')]+'%'};return _0xef0295;}})});}_0x3f6b25=_[_0x5e5b('0x43')]({},_0x3f6b25,_0x2cb695[_0x5e5b('0x44')]);var _0x1034fa={'where':_0x3f6b25['where']};return db[_0x5e5b('0x45')][_0x5e5b('0x20')](_0x1034fa)['then'](function(_0x204487){_0xcb272c['count']=_0x204487;if(_0x2cb695[_0x5e5b('0x32')][_0x5e5b('0x46')]){_0x3f6b25[_0x5e5b('0x47')]=[{'all':!![]}];}return db[_0x5e5b('0x45')][_0x5e5b('0x48')](_0x3f6b25);})[_0x5e5b('0x27')](function(_0x371550){_0xcb272c[_0x5e5b('0x49')]=_0x371550;return _0xcb272c;})[_0x5e5b('0x27')](respondWithFilteredResult(_0x2b4351,_0x3f6b25))[_0x5e5b('0x4a')](handleError(_0x2b4351,null));};exports[_0x5e5b('0x4b')]=function(_0x4e6fe2,_0x2b81dd){var _0x40e8ce={'raw':!![],'where':{'id':_0x4e6fe2['params']['id']}},_0x46fec9={};_0x46fec9[_0x5e5b('0x35')]=_[_0x5e5b('0x33')](db['WhatsappQueueReport'][_0x5e5b('0x2d')]);_0x46fec9[_0x5e5b('0x32')]=_['keys'](_0x4e6fe2[_0x5e5b('0x32')]);_0x46fec9['filters']=_['intersection'](_0x46fec9['model'],_0x46fec9[_0x5e5b('0x32')]);_0x40e8ce['attributes']=_[_0x5e5b('0x36')](_0x46fec9['model'],qs[_0x5e5b('0x37')](_0x4e6fe2[_0x5e5b('0x32')][_0x5e5b('0x37')]));_0x40e8ce[_0x5e5b('0x38')]=_0x40e8ce[_0x5e5b('0x38')][_0x5e5b('0x39')]?_0x40e8ce[_0x5e5b('0x38')]:_0x46fec9['model'];if(_0x4e6fe2['query'][_0x5e5b('0x46')]){_0x40e8ce['include']=[{'all':!![]}];}_0x40e8ce=_['merge']({},_0x40e8ce,_0x4e6fe2['options']);return db[_0x5e5b('0x45')]['find'](_0x40e8ce)[_0x5e5b('0x27')](handleEntityNotFound(_0x2b81dd,null))[_0x5e5b('0x27')](respondWithResult(_0x2b81dd,null))[_0x5e5b('0x4a')](handleError(_0x2b81dd,null));};exports[_0x5e5b('0x4c')]=function(_0x2982e7,_0x192445){return db['WhatsappQueueReport'][_0x5e5b('0x4c')](_0x2982e7[_0x5e5b('0x4d')],{})['then'](respondWithResult(_0x192445,0xc9))[_0x5e5b('0x4a')](handleError(_0x192445,null));};exports['update']=function(_0x41e4b3,_0x36d8fa){if(_0x41e4b3[_0x5e5b('0x4d')]['id']){delete _0x41e4b3[_0x5e5b('0x4d')]['id'];}return db['WhatsappQueueReport'][_0x5e5b('0x4e')]({'where':{'id':_0x41e4b3[_0x5e5b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36d8fa,null))[_0x5e5b('0x27')](saveUpdates(_0x41e4b3[_0x5e5b('0x4d')],null))[_0x5e5b('0x27')](respondWithResult(_0x36d8fa,null))[_0x5e5b('0x4a')](handleError(_0x36d8fa,null));};exports[_0x5e5b('0x28')]=function(_0x5ae8d0,_0x50fc9c){return db[_0x5e5b('0x45')][_0x5e5b('0x4e')]({'where':{'id':_0x5ae8d0['params']['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x50fc9c,null))[_0x5e5b('0x27')](removeEntity(_0x50fc9c,null))[_0x5e5b('0x4a')](handleError(_0x50fc9c,null));};exports['describe']=function(_0x3f9d26,_0x3e0ce5){return db[_0x5e5b('0x45')]['describe']()[_0x5e5b('0x27')](respondWithResult(_0x3e0ce5,null))[_0x5e5b('0x4a')](handleError(_0x3e0ce5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index d9f5ccb..2f199c9 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 _0x2195=['path','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x1edd30,_0x479b00){var _0x23c47b=function(_0x10b0d8){while(--_0x10b0d8){_0x1edd30['push'](_0x1edd30['shift']());}};_0x23c47b(++_0x479b00);}(_0x2195,0x7f));var _0x5219=function(_0x528511,_0x815fd3){_0x528511=_0x528511-0x0;var _0xd1b2b7=_0x2195[_0x528511];return _0xd1b2b7;};'use strict';var _=require(_0x5219('0x0'));var util=require(_0x5219('0x1'));var logger=require(_0x5219('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5219('0x3'));var rp=require(_0x5219('0x4'));var fs=require('fs');var path=require(_0x5219('0x5'));var rimraf=require('rimraf');var config=require(_0x5219('0x6'));var attributes=require(_0x5219('0x7'));module[_0x5219('0x8')]=function(_0x590c51,_0x5d6555){return _0x590c51[_0x5219('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x5219('0xa'),'paranoid':![],'indexes':[{'name':_0x5219('0xb'),'fields':[_0x5219('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cd6=['moment','bluebird','request-promise','path','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x1cd6,0x1b6));var _0x61cd=function(_0x5b0679,_0x35fa02){_0x5b0679=_0x5b0679-0x0;var _0x47dfe7=_0x1cd6[_0x5b0679];return _0x47dfe7;};'use strict';var _=require(_0x61cd('0x0'));var util=require(_0x61cd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x61cd('0x2'));var BPromise=require(_0x61cd('0x3'));var rp=require(_0x61cd('0x4'));var fs=require('fs');var path=require(_0x61cd('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x61cd('0x6')]=function(_0x3e5173,_0x1b957f){return _0x3e5173['define'](_0x61cd('0x7'),attributes,{'tableName':_0x61cd('0x8'),'paranoid':![],'indexes':[{'name':_0x61cd('0x9'),'fields':[_0x61cd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7ee5c79..1191249 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 _0x6f0f=['http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','body','where','attributes','limit','lodash','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x41b621,_0x43fa31){var _0x3ceca8=function(_0x458791){while(--_0x458791){_0x41b621['push'](_0x41b621['shift']());}};_0x3ceca8(++_0x43fa31);}(_0x6f0f,0xcb));var _0xf6f0=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x6f0f[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0xf6f0('0x0'));var util=require('util');var moment=require(_0xf6f0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6f0('0x2'))['db'];var utils=require(_0xf6f0('0x3'));var logger=require('../../config/logger')(_0xf6f0('0x4'));var config=require(_0xf6f0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf6f0('0x6')][_0xf6f0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x51e88c,_0x5e40f4,_0x32228b){return new BPromise(function(_0x167b56,_0x418ed8){return client[_0xf6f0('0x8')](_0x51e88c,_0x32228b)['then'](function(_0x38ee31){logger[_0xf6f0('0x9')](_0xf6f0('0xa'),_0x5e40f4,_0xf6f0('0xb'));logger[_0xf6f0('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5e40f4,'request\x20sent',JSON[_0xf6f0('0xd')](_0x38ee31));if(_0x38ee31[_0xf6f0('0xe')]){if(_0x38ee31['error'][_0xf6f0('0xf')]===0x1f4){logger[_0xf6f0('0xe')](_0xf6f0('0xa'),_0x5e40f4,_0x38ee31[_0xf6f0('0xe')][_0xf6f0('0x10')]);return _0x418ed8(_0x38ee31[_0xf6f0('0xe')][_0xf6f0('0x10')]);}logger['error'](_0xf6f0('0xa'),_0x5e40f4,_0x38ee31['error']['message']);return _0x167b56(_0x38ee31['error']['message']);}else{logger['info'](_0xf6f0('0xa'),_0x5e40f4,_0xf6f0('0xb'));_0x167b56(_0x38ee31[_0xf6f0('0x11')][_0xf6f0('0x10')]);}})[_0xf6f0('0x12')](function(_0x343a84){logger[_0xf6f0('0xe')](_0xf6f0('0xa'),_0x5e40f4,_0x343a84);_0x418ed8(_0x343a84);});});}exports[_0xf6f0('0x13')]=function(_0x432f86){var _0x58b0bd=this;return new Promise(function(_0x2b9617,_0x3374ae){return db[_0xf6f0('0x14')][_0xf6f0('0x15')](_0x432f86['body'],{'raw':_0x432f86[_0xf6f0('0x16')]?_0x432f86[_0xf6f0('0x16')][_0xf6f0('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3deaf6){logger[_0xf6f0('0x9')](_0xf6f0('0x13'),_0x432f86);logger[_0xf6f0('0xc')](_0xf6f0('0x13'),_0x432f86,JSON[_0xf6f0('0xd')](_0x3deaf6));_0x2b9617(_0x3deaf6);})[_0xf6f0('0x12')](function(_0x4c494f){logger[_0xf6f0('0xe')]('CreateWhatsappQueueReport',_0x4c494f['message'],_0x432f86);_0x3374ae(_0x58b0bd[_0xf6f0('0xe')](0x1f4,_0x4c494f['message']));});});};exports[_0xf6f0('0x18')]=function(_0x182c4b){var _0xcc8711=this;return new Promise(function(_0xc76a1f,_0x4aa5e6){return db['WhatsappQueueReport'][_0xf6f0('0x19')](_0x182c4b[_0xf6f0('0x1a')],{'raw':_0x182c4b[_0xf6f0('0x16')]?_0x182c4b[_0xf6f0('0x16')][_0xf6f0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x182c4b[_0xf6f0('0x16')]?_0x182c4b[_0xf6f0('0x16')][_0xf6f0('0x1b')]||null:null,'attributes':_0x182c4b[_0xf6f0('0x16')]?_0x182c4b['options'][_0xf6f0('0x1c')]||null:null,'limit':_0x182c4b[_0xf6f0('0x16')]?_0x182c4b[_0xf6f0('0x16')][_0xf6f0('0x1d')]||null:null})['then'](function(_0x1d41b8){logger[_0xf6f0('0x9')](_0xf6f0('0x18'),_0x182c4b);logger['debug'](_0xf6f0('0x18'),_0x182c4b,JSON[_0xf6f0('0xd')](_0x1d41b8));_0xc76a1f(_0x1d41b8);})[_0xf6f0('0x12')](function(_0x2bc650){logger['error']('UpdateWhatsappQueueReport',_0x2bc650[_0xf6f0('0x10')],_0x182c4b);_0x4aa5e6(_0xcc8711[_0xf6f0('0xe')](0x1f4,_0x2bc650['message']));});});}; \ No newline at end of file +var _0xdef0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','then','UpdateWhatsappQueueReport','update','body','raw','options','where','attributes','util','moment'];(function(_0x22562e,_0x3cab96){var _0x495af0=function(_0x141b65){while(--_0x141b65){_0x22562e['push'](_0x22562e['shift']());}};_0x495af0(++_0x3cab96);}(_0xdef0,0x196));var _0x0def=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdef0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x0def('0x0'));var moment=require(_0x0def('0x1'));var BPromise=require(_0x0def('0x2'));var rs=require(_0x0def('0x3'));var fs=require('fs');var Redis=require(_0x0def('0x4'));var db=require(_0x0def('0x5'))['db'];var utils=require(_0x0def('0x6'));var logger=require(_0x0def('0x7'))('rpc');var config=require(_0x0def('0x8'));var jayson=require(_0x0def('0x9'));var client=jayson[_0x0def('0xa')][_0x0def('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c9151,_0x31fb87,_0x19da20){return new BPromise(function(_0x1ad858,_0x1e7ecf){return client[_0x0def('0xc')](_0x1c9151,_0x19da20)['then'](function(_0x21ba68){logger[_0x0def('0xd')](_0x0def('0xe'),_0x31fb87,_0x0def('0xf'));logger[_0x0def('0x10')](_0x0def('0x11'),_0x31fb87,'request\x20sent',JSON[_0x0def('0x12')](_0x21ba68));if(_0x21ba68[_0x0def('0x13')]){if(_0x21ba68[_0x0def('0x13')]['code']===0x1f4){logger[_0x0def('0x13')](_0x0def('0xe'),_0x31fb87,_0x21ba68['error'][_0x0def('0x14')]);return _0x1e7ecf(_0x21ba68[_0x0def('0x13')]['message']);}logger[_0x0def('0x13')](_0x0def('0xe'),_0x31fb87,_0x21ba68[_0x0def('0x13')][_0x0def('0x14')]);return _0x1ad858(_0x21ba68[_0x0def('0x13')][_0x0def('0x14')]);}else{logger[_0x0def('0xd')](_0x0def('0xe'),_0x31fb87,_0x0def('0xf'));_0x1ad858(_0x21ba68[_0x0def('0x15')][_0x0def('0x14')]);}})[_0x0def('0x16')](function(_0x1f4fdb){logger[_0x0def('0x13')](_0x0def('0xe'),_0x31fb87,_0x1f4fdb);_0x1e7ecf(_0x1f4fdb);});});}exports[_0x0def('0x17')]=function(_0x10b6c0){var _0x1a1d6b=this;return new Promise(function(_0xc2b7cb,_0x2537e3){return db[_0x0def('0x18')][_0x0def('0x19')](_0x10b6c0['body'],{'raw':_0x10b6c0['options']?_0x10b6c0['options']['raw']===undefined?!![]:![]:!![]})[_0x0def('0x1a')](function(_0x102a44){logger['info']('CreateWhatsappQueueReport',_0x10b6c0);logger[_0x0def('0x10')](_0x0def('0x17'),_0x10b6c0,JSON['stringify'](_0x102a44));_0xc2b7cb(_0x102a44);})['catch'](function(_0x2dc804){logger['error']('CreateWhatsappQueueReport',_0x2dc804[_0x0def('0x14')],_0x10b6c0);_0x2537e3(_0x1a1d6b[_0x0def('0x13')](0x1f4,_0x2dc804[_0x0def('0x14')]));});});};exports[_0x0def('0x1b')]=function(_0x3bd7f9){var _0x24c867=this;return new Promise(function(_0xc4a3d6,_0x230248){return db[_0x0def('0x18')][_0x0def('0x1c')](_0x3bd7f9[_0x0def('0x1d')],{'raw':_0x3bd7f9['options']?_0x3bd7f9['options'][_0x0def('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bd7f9[_0x0def('0x1f')]?_0x3bd7f9[_0x0def('0x1f')][_0x0def('0x20')]||null:null,'attributes':_0x3bd7f9[_0x0def('0x1f')]?_0x3bd7f9[_0x0def('0x1f')][_0x0def('0x21')]||null:null,'limit':_0x3bd7f9['options']?_0x3bd7f9[_0x0def('0x1f')]['limit']||null:null})[_0x0def('0x1a')](function(_0x33ed0d){logger[_0x0def('0xd')](_0x0def('0x1b'),_0x3bd7f9);logger[_0x0def('0x10')](_0x0def('0x1b'),_0x3bd7f9,JSON['stringify'](_0x33ed0d));_0xc4a3d6(_0x33ed0d);})[_0x0def('0x16')](function(_0x3bd499){logger[_0x0def('0x13')](_0x0def('0x1b'),_0x3bd499[_0x0def('0x14')],_0x3bd7f9);_0x230248(_0x24c867['error'](0x1f4,_0x3bd499[_0x0def('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index c6838f5..8a8ede5 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 _0x4ccc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','destroy','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x4ccc,0x1e9));var _0xc4cc=function(_0x236f98,_0x20aa59){_0x236f98=_0x236f98-0x0;var _0xff6ca6=_0x4ccc[_0x236f98];return _0xff6ca6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc4cc('0x0'));var timeout=require(_0xc4cc('0x1'));var express=require(_0xc4cc('0x2'));var router=express[_0xc4cc('0x3')]();var fs_extra=require(_0xc4cc('0x4'));var auth=require(_0xc4cc('0x5'));var interaction=require(_0xc4cc('0x6'));var config=require(_0xc4cc('0x7'));var controller=require(_0xc4cc('0x8'));router[_0xc4cc('0x9')]('/',auth[_0xc4cc('0xa')](),controller[_0xc4cc('0xb')]);router[_0xc4cc('0x9')](_0xc4cc('0xc'),auth[_0xc4cc('0xa')](),controller['describe']);router[_0xc4cc('0x9')](_0xc4cc('0xd'),auth[_0xc4cc('0xa')](),controller[_0xc4cc('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc4cc('0xf')]);router[_0xc4cc('0x10')](_0xc4cc('0xd'),auth[_0xc4cc('0xa')](),controller['update']);router['delete'](_0xc4cc('0xd'),auth['isAuthenticated'](),controller[_0xc4cc('0x11')]);module[_0xc4cc('0x12')]=router; \ No newline at end of file +var _0x4c5f=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x4abb73,_0x50ff72){var _0x4cf57e=function(_0x3ae8cf){while(--_0x3ae8cf){_0x4abb73['push'](_0x4abb73['shift']());}};_0x4cf57e(++_0x50ff72);}(_0x4c5f,0xe7));var _0xf4c5=function(_0x43c0a6,_0x2c8304){_0x43c0a6=_0x43c0a6-0x0;var _0x18b59d=_0x4c5f[_0x43c0a6];return _0x18b59d;};'use strict';var multer=require(_0xf4c5('0x0'));var util=require(_0xf4c5('0x1'));var path=require(_0xf4c5('0x2'));var timeout=require(_0xf4c5('0x3'));var express=require('express');var router=express[_0xf4c5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf4c5('0x5'));var config=require(_0xf4c5('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xf4c5('0x7')]('/',auth[_0xf4c5('0x8')](),controller['index']);router['get'](_0xf4c5('0x9'),auth['isAuthenticated'](),controller[_0xf4c5('0xa')]);router['get'](_0xf4c5('0xb'),auth[_0xf4c5('0x8')](),controller[_0xf4c5('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf4c5('0xd')]);router[_0xf4c5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf4c5('0xf')]);router[_0xf4c5('0x10')](_0xf4c5('0xb'),auth['isAuthenticated'](),controller[_0xf4c5('0x11')]);module[_0xf4c5('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 e079a5e..642e12d 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 _0x1ebd=['queue','DATE','sequelize','exports','STRING','account','agent'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x1ebd,0x64));var _0xd1eb=function(_0x1d89df,_0x103a73){_0x1d89df=_0x1d89df-0x0;var _0x318b51=_0x1ebd[_0x1d89df];return _0x318b51;};'use strict';var Sequelize=require(_0xd1eb('0x0'));module[_0xd1eb('0x1')]={'uniqueid':{'type':Sequelize[_0xd1eb('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd1eb('0x3'),_0xd1eb('0x4'),_0xd1eb('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xd1eb('0x6')]}}; \ No newline at end of file +var _0x3c91=['exports','STRING','agent','queue','DATE','sequelize'];(function(_0xe5d2c,_0xff5469){var _0x690de8=function(_0x44355c){while(--_0x44355c){_0xe5d2c['push'](_0xe5d2c['shift']());}};_0x690de8(++_0xff5469);}(_0x3c91,0x1af));var _0x13c9=function(_0x4e3ec3,_0x5c02e6){_0x4e3ec3=_0x4e3ec3-0x0;var _0x1a2a6e=_0x3c91[_0x4e3ec3];return _0x1a2a6e;};'use strict';var Sequelize=require(_0x13c9('0x0'));module[_0x13c9('0x1')]={'uniqueid':{'type':Sequelize[_0x13c9('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x13c9('0x3'),_0x13c9('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x13c9('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 0173dad..b4397ee 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 _0x47c5=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','includeAll','include','find','create','body','update','params','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x553718,_0x4e7880){var _0x15ede5=function(_0x5ed82d){while(--_0x5ed82d){_0x553718['push'](_0x553718['shift']());}};_0x15ede5(++_0x4e7880);}(_0x47c5,0x1cd));var _0x547c=function(_0x596776,_0x209317){_0x596776=_0x596776-0x0;var _0x153c39=_0x47c5[_0x596776];return _0x153c39;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x547c('0x0'));var jsonpatch=require(_0x547c('0x1'));var rp=require('request-promise');var moment=require(_0x547c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x3'));var util=require(_0x547c('0x4'));var path=require(_0x547c('0x5'));var sox=require(_0x547c('0x6'));var csv=require(_0x547c('0x7'));var ejs=require(_0x547c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x547c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x547c('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x547c('0xb'));var Redis=require(_0x547c('0xc'));var authService=require(_0x547c('0xd'));var qs=require(_0x547c('0xe'));var as=require(_0x547c('0xf'));var hardwareService=require(_0x547c('0x10'));var logger=require('../../config/logger')(_0x547c('0x11'));var utils=require(_0x547c('0x12'));var config=require(_0x547c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x547c('0x14'))['db'];function respondWithStatusCode(_0x193ef5,_0xb1fbd6){_0xb1fbd6=_0xb1fbd6||0xcc;return function(_0x304878){if(_0x304878){return _0x193ef5['sendStatus'](_0xb1fbd6);}return _0x193ef5[_0x547c('0x15')](_0xb1fbd6)[_0x547c('0x16')]();};}function respondWithResult(_0xb675b2,_0x433564){_0x433564=_0x433564||0xc8;return function(_0x330a3b){if(_0x330a3b){return _0xb675b2[_0x547c('0x15')](_0x433564)[_0x547c('0x17')](_0x330a3b);}};}function respondWithFilteredResult(_0x202f48,_0x362a37){return function(_0x2048c1){if(_0x2048c1){var _0x2fd760=typeof _0x362a37[_0x547c('0x18')]===_0x547c('0x19')&&typeof _0x362a37['limit']==='undefined';var _0x5aea90=_0x2048c1['count'];var _0x3bb696=_0x2fd760?0x0:_0x362a37['offset'];var _0x1de47e=_0x2fd760?_0x2048c1[_0x547c('0x1a')]:_0x362a37[_0x547c('0x18')]+_0x362a37[_0x547c('0x1b')];var _0x1f802a;if(_0x1de47e>=_0x5aea90){_0x1de47e=_0x5aea90;_0x1f802a=0xc8;}else{_0x1f802a=0xce;}_0x202f48['status'](_0x1f802a);return _0x202f48['set'](_0x547c('0x1c'),_0x3bb696+'-'+_0x1de47e+'/'+_0x5aea90)['json'](_0x2048c1);}return null;};}function patchUpdates(_0x3dd7e2){return function(_0x3592f4){try{jsonpatch[_0x547c('0x1d')](_0x3592f4,_0x3dd7e2,!![]);}catch(_0x2a8aed){return BPromise[_0x547c('0x1e')](_0x2a8aed);}return _0x3592f4[_0x547c('0x1f')]();};}function saveUpdates(_0x1e3ba6,_0xcac732){return function(_0x34992f){if(_0x34992f){return _0x34992f['update'](_0x1e3ba6)[_0x547c('0x20')](function(_0x4ce047){return _0x4ce047;});}return null;};}function removeEntity(_0x1e80d1,_0x249271){return function(_0x30044d){if(_0x30044d){return _0x30044d[_0x547c('0x21')]()[_0x547c('0x20')](function(){_0x1e80d1['status'](0xcc)[_0x547c('0x16')]();});}};}function handleEntityNotFound(_0x3cf714,_0x607642){return function(_0x2e918c){if(!_0x2e918c){_0x3cf714[_0x547c('0x22')](0x194);}return _0x2e918c;};}function handleError(_0x5cd417,_0x58bab6){_0x58bab6=_0x58bab6||0x1f4;return function(_0x4c9099){logger[_0x547c('0x23')](_0x4c9099[_0x547c('0x24')]);if(_0x4c9099[_0x547c('0x25')]){delete _0x4c9099[_0x547c('0x25')];}_0x5cd417[_0x547c('0x15')](_0x58bab6)[_0x547c('0x26')](_0x4c9099);};}exports[_0x547c('0x27')]=function(_0x3c3703,_0x1431d5){var _0x309edf={},_0x142de0={},_0x4d717b={'count':0x0,'rows':[]};var _0x465641=_[_0x547c('0x28')](db[_0x547c('0x29')][_0x547c('0x2a')],function(_0x33e1a4){return{'name':_0x33e1a4[_0x547c('0x2b')],'type':_0x33e1a4[_0x547c('0x2c')]['key']};});_0x142de0[_0x547c('0x2d')]=_[_0x547c('0x28')](_0x465641,_0x547c('0x25'));_0x142de0[_0x547c('0x2e')]=_[_0x547c('0x2f')](_0x3c3703['query']);_0x142de0[_0x547c('0x30')]=_[_0x547c('0x31')](_0x142de0[_0x547c('0x2d')],_0x142de0[_0x547c('0x2e')]);_0x309edf[_0x547c('0x32')]=_['intersection'](_0x142de0[_0x547c('0x2d')],qs['fields'](_0x3c3703[_0x547c('0x2e')][_0x547c('0x33')]));_0x309edf['attributes']=_0x309edf[_0x547c('0x32')][_0x547c('0x34')]?_0x309edf[_0x547c('0x32')]:_0x142de0[_0x547c('0x2d')];if(!_0x3c3703[_0x547c('0x2e')][_0x547c('0x35')](_0x547c('0x36'))){_0x309edf['limit']=qs[_0x547c('0x1b')](_0x3c3703[_0x547c('0x2e')]['limit']);_0x309edf[_0x547c('0x18')]=qs[_0x547c('0x18')](_0x3c3703['query'][_0x547c('0x18')]);}_0x309edf[_0x547c('0x37')]=qs[_0x547c('0x38')](_0x3c3703[_0x547c('0x2e')][_0x547c('0x38')]);_0x309edf[_0x547c('0x39')]=qs[_0x547c('0x30')](_[_0x547c('0x3a')](_0x3c3703[_0x547c('0x2e')],_0x142de0['filters']),_0x465641);if(_0x3c3703['query'][_0x547c('0x3b')]){_0x309edf[_0x547c('0x39')]=_[_0x547c('0x3c')](_0x309edf['where'],{'$or':_[_0x547c('0x28')](_0x465641,function(_0x49c681){if(_0x49c681[_0x547c('0x2c')]!==_0x547c('0x3d')){var _0x4e1164={};_0x4e1164[_0x49c681[_0x547c('0x25')]]={'$like':'%'+_0x3c3703['query'][_0x547c('0x3b')]+'%'};return _0x4e1164;}})});}_0x309edf=_['merge']({},_0x309edf,_0x3c3703[_0x547c('0x3e')]);var _0x5833d7={'where':_0x309edf[_0x547c('0x39')]};return db[_0x547c('0x29')]['count'](_0x5833d7)[_0x547c('0x20')](function(_0x34d5e6){_0x4d717b[_0x547c('0x1a')]=_0x34d5e6;if(_0x3c3703['query']['includeAll']){_0x309edf['include']=[{'all':!![]}];}return db[_0x547c('0x29')][_0x547c('0x3f')](_0x309edf);})[_0x547c('0x20')](function(_0x5c9685){_0x4d717b[_0x547c('0x40')]=_0x5c9685;return _0x4d717b;})['then'](respondWithFilteredResult(_0x1431d5,_0x309edf))[_0x547c('0x41')](handleError(_0x1431d5,null));};exports['show']=function(_0x1ac9f8,_0x22d6e6){var _0x1d18c9={'raw':!![],'where':{'id':_0x1ac9f8['params']['id']}},_0x195437={};_0x195437[_0x547c('0x2d')]=_[_0x547c('0x2f')](db['WhatsappTransferReport'][_0x547c('0x2a')]);_0x195437['query']=_[_0x547c('0x2f')](_0x1ac9f8['query']);_0x195437['filters']=_['intersection'](_0x195437[_0x547c('0x2d')],_0x195437[_0x547c('0x2e')]);_0x1d18c9[_0x547c('0x32')]=_[_0x547c('0x31')](_0x195437[_0x547c('0x2d')],qs[_0x547c('0x33')](_0x1ac9f8[_0x547c('0x2e')][_0x547c('0x33')]));_0x1d18c9[_0x547c('0x32')]=_0x1d18c9[_0x547c('0x32')][_0x547c('0x34')]?_0x1d18c9[_0x547c('0x32')]:_0x195437[_0x547c('0x2d')];if(_0x1ac9f8['query'][_0x547c('0x42')]){_0x1d18c9[_0x547c('0x43')]=[{'all':!![]}];}_0x1d18c9=_[_0x547c('0x3c')]({},_0x1d18c9,_0x1ac9f8['options']);return db[_0x547c('0x29')][_0x547c('0x44')](_0x1d18c9)[_0x547c('0x20')](handleEntityNotFound(_0x22d6e6,null))[_0x547c('0x20')](respondWithResult(_0x22d6e6,null))[_0x547c('0x41')](handleError(_0x22d6e6,null));};exports[_0x547c('0x45')]=function(_0x5f52a5,_0x4cb724){return db[_0x547c('0x29')]['create'](_0x5f52a5[_0x547c('0x46')],{})[_0x547c('0x20')](respondWithResult(_0x4cb724,0xc9))[_0x547c('0x41')](handleError(_0x4cb724,null));};exports[_0x547c('0x47')]=function(_0x3f0e69,_0x3cc6a3){if(_0x3f0e69[_0x547c('0x46')]['id']){delete _0x3f0e69[_0x547c('0x46')]['id'];}return db[_0x547c('0x29')][_0x547c('0x44')]({'where':{'id':_0x3f0e69[_0x547c('0x48')]['id']}})['then'](handleEntityNotFound(_0x3cc6a3,null))[_0x547c('0x20')](saveUpdates(_0x3f0e69['body'],null))[_0x547c('0x20')](respondWithResult(_0x3cc6a3,null))[_0x547c('0x41')](handleError(_0x3cc6a3,null));};exports['destroy']=function(_0x3470e2,_0xab47d0){return db[_0x547c('0x29')][_0x547c('0x44')]({'where':{'id':_0x3470e2['params']['id']}})[_0x547c('0x20')](handleEntityNotFound(_0xab47d0,null))[_0x547c('0x20')](removeEntity(_0xab47d0,null))[_0x547c('0x41')](handleError(_0xab47d0,null));};exports['describe']=function(_0x330e1e,_0x983573){return db[_0x547c('0x29')]['describe']()['then'](respondWithResult(_0x983573,null))[_0x547c('0x41')](handleError(_0x983573,null));}; \ No newline at end of file +var _0x1a4b=['params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','update','then','error','name','index','map','WhatsappTransferReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','keys','find','catch','create','body','destroy'];(function(_0x2a0c43,_0x2e8169){var _0xc9de8a=function(_0x45f510){while(--_0x45f510){_0x2a0c43['push'](_0x2a0c43['shift']());}};_0xc9de8a(++_0x2e8169);}(_0x1a4b,0xe3));var _0xb1a4=function(_0x36b9c4,_0x25176e){_0x36b9c4=_0x36b9c4-0x0;var _0x31b2d5=_0x1a4b[_0x36b9c4];return _0x31b2d5;};'use strict';var emlformat=require(_0xb1a4('0x0'));var rimraf=require(_0xb1a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1a4('0x2'));var rp=require(_0xb1a4('0x3'));var moment=require(_0xb1a4('0x4'));var BPromise=require(_0xb1a4('0x5'));var Mustache=require(_0xb1a4('0x6'));var util=require(_0xb1a4('0x7'));var path=require(_0xb1a4('0x8'));var sox=require(_0xb1a4('0x9'));var csv=require(_0xb1a4('0xa'));var ejs=require(_0xb1a4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1a4('0xc'));var squel=require(_0xb1a4('0xd'));var crypto=require(_0xb1a4('0xe'));var jsforce=require(_0xb1a4('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb1a4('0x10'));var Papa=require(_0xb1a4('0x11'));var Redis=require(_0xb1a4('0x12'));var authService=require(_0xb1a4('0x13'));var qs=require(_0xb1a4('0x14'));var as=require(_0xb1a4('0x15'));var hardwareService=require(_0xb1a4('0x16'));var logger=require(_0xb1a4('0x17'))('api');var utils=require(_0xb1a4('0x18'));var config=require(_0xb1a4('0x19'));var licenseUtil=require(_0xb1a4('0x1a'));var db=require(_0xb1a4('0x1b'))['db'];function respondWithStatusCode(_0x372532,_0x7c536d){_0x7c536d=_0x7c536d||0xcc;return function(_0x1c793f){if(_0x1c793f){return _0x372532[_0xb1a4('0x1c')](_0x7c536d);}return _0x372532[_0xb1a4('0x1d')](_0x7c536d)[_0xb1a4('0x1e')]();};}function respondWithResult(_0x2e646b,_0x503bcb){_0x503bcb=_0x503bcb||0xc8;return function(_0x34c825){if(_0x34c825){return _0x2e646b[_0xb1a4('0x1d')](_0x503bcb)[_0xb1a4('0x1f')](_0x34c825);}};}function respondWithFilteredResult(_0x102b48,_0x451c49){return function(_0x4b293d){if(_0x4b293d){var _0x594031=typeof _0x451c49[_0xb1a4('0x20')]===_0xb1a4('0x21')&&typeof _0x451c49['limit']===_0xb1a4('0x21');var _0x363992=_0x4b293d['count'];var _0x14082e=_0x594031?0x0:_0x451c49['offset'];var _0x3703a7=_0x594031?_0x4b293d['count']:_0x451c49[_0xb1a4('0x20')]+_0x451c49[_0xb1a4('0x22')];var _0x2a2cd3;if(_0x3703a7>=_0x363992){_0x3703a7=_0x363992;_0x2a2cd3=0xc8;}else{_0x2a2cd3=0xce;}_0x102b48[_0xb1a4('0x1d')](_0x2a2cd3);return _0x102b48['set']('Content-Range',_0x14082e+'-'+_0x3703a7+'/'+_0x363992)[_0xb1a4('0x1f')](_0x4b293d);}return null;};}function patchUpdates(_0x1d01a8){return function(_0x5c78bc){try{jsonpatch[_0xb1a4('0x23')](_0x5c78bc,_0x1d01a8,!![]);}catch(_0x499f7a){return BPromise[_0xb1a4('0x24')](_0x499f7a);}return _0x5c78bc[_0xb1a4('0x25')]();};}function saveUpdates(_0x24ffaa,_0x418703){return function(_0xa91304){if(_0xa91304){return _0xa91304[_0xb1a4('0x26')](_0x24ffaa)[_0xb1a4('0x27')](function(_0x271c64){return _0x271c64;});}return null;};}function removeEntity(_0xb1b108,_0x38fabe){return function(_0x39022f){if(_0x39022f){return _0x39022f['destroy']()[_0xb1a4('0x27')](function(){_0xb1b108[_0xb1a4('0x1d')](0xcc)[_0xb1a4('0x1e')]();});}};}function handleEntityNotFound(_0xfcecdc,_0x337e6a){return function(_0x1fafe8){if(!_0x1fafe8){_0xfcecdc[_0xb1a4('0x1c')](0x194);}return _0x1fafe8;};}function handleError(_0x2620b4,_0x17bdb3){_0x17bdb3=_0x17bdb3||0x1f4;return function(_0x33516f){logger[_0xb1a4('0x28')](_0x33516f['stack']);if(_0x33516f[_0xb1a4('0x29')]){delete _0x33516f[_0xb1a4('0x29')];}_0x2620b4['status'](_0x17bdb3)['send'](_0x33516f);};}exports[_0xb1a4('0x2a')]=function(_0x2e771e,_0x1a7a47){var _0x456b33={},_0x16b3a9={},_0x4febff={'count':0x0,'rows':[]};var _0x59db15=_[_0xb1a4('0x2b')](db[_0xb1a4('0x2c')][_0xb1a4('0x2d')],function(_0x1c52a3){return{'name':_0x1c52a3['fieldName'],'type':_0x1c52a3[_0xb1a4('0x2e')][_0xb1a4('0x2f')]};});_0x16b3a9[_0xb1a4('0x30')]=_['map'](_0x59db15,_0xb1a4('0x29'));_0x16b3a9['query']=_['keys'](_0x2e771e[_0xb1a4('0x31')]);_0x16b3a9[_0xb1a4('0x32')]=_['intersection'](_0x16b3a9[_0xb1a4('0x30')],_0x16b3a9[_0xb1a4('0x31')]);_0x456b33[_0xb1a4('0x33')]=_[_0xb1a4('0x34')](_0x16b3a9[_0xb1a4('0x30')],qs[_0xb1a4('0x35')](_0x2e771e[_0xb1a4('0x31')][_0xb1a4('0x35')]));_0x456b33[_0xb1a4('0x33')]=_0x456b33[_0xb1a4('0x33')][_0xb1a4('0x36')]?_0x456b33[_0xb1a4('0x33')]:_0x16b3a9[_0xb1a4('0x30')];if(!_0x2e771e['query'][_0xb1a4('0x37')]('nolimit')){_0x456b33[_0xb1a4('0x22')]=qs[_0xb1a4('0x22')](_0x2e771e[_0xb1a4('0x31')][_0xb1a4('0x22')]);_0x456b33[_0xb1a4('0x20')]=qs[_0xb1a4('0x20')](_0x2e771e['query']['offset']);}_0x456b33['order']=qs[_0xb1a4('0x38')](_0x2e771e[_0xb1a4('0x31')][_0xb1a4('0x38')]);_0x456b33[_0xb1a4('0x39')]=qs[_0xb1a4('0x32')](_[_0xb1a4('0x3a')](_0x2e771e['query'],_0x16b3a9['filters']),_0x59db15);if(_0x2e771e[_0xb1a4('0x31')][_0xb1a4('0x3b')]){_0x456b33[_0xb1a4('0x39')]=_[_0xb1a4('0x3c')](_0x456b33[_0xb1a4('0x39')],{'$or':_[_0xb1a4('0x2b')](_0x59db15,function(_0x4532b3){if(_0x4532b3[_0xb1a4('0x2e')]!==_0xb1a4('0x3d')){var _0x5795fc={};_0x5795fc[_0x4532b3['name']]={'$like':'%'+_0x2e771e[_0xb1a4('0x31')]['filter']+'%'};return _0x5795fc;}})});}_0x456b33=_['merge']({},_0x456b33,_0x2e771e[_0xb1a4('0x3e')]);var _0x40f56c={'where':_0x456b33['where']};return db[_0xb1a4('0x2c')][_0xb1a4('0x3f')](_0x40f56c)['then'](function(_0x5dae62){_0x4febff[_0xb1a4('0x3f')]=_0x5dae62;if(_0x2e771e[_0xb1a4('0x31')][_0xb1a4('0x40')]){_0x456b33[_0xb1a4('0x41')]=[{'all':!![]}];}return db[_0xb1a4('0x2c')]['findAll'](_0x456b33);})[_0xb1a4('0x27')](function(_0x5cd2a7){_0x4febff[_0xb1a4('0x42')]=_0x5cd2a7;return _0x4febff;})[_0xb1a4('0x27')](respondWithFilteredResult(_0x1a7a47,_0x456b33))['catch'](handleError(_0x1a7a47,null));};exports['show']=function(_0x50e01e,_0x175f8a){var _0x3a2849={'raw':!![],'where':{'id':_0x50e01e['params']['id']}},_0x5cdde3={};_0x5cdde3[_0xb1a4('0x30')]=_[_0xb1a4('0x43')](db[_0xb1a4('0x2c')][_0xb1a4('0x2d')]);_0x5cdde3['query']=_[_0xb1a4('0x43')](_0x50e01e['query']);_0x5cdde3[_0xb1a4('0x32')]=_[_0xb1a4('0x34')](_0x5cdde3['model'],_0x5cdde3[_0xb1a4('0x31')]);_0x3a2849['attributes']=_[_0xb1a4('0x34')](_0x5cdde3[_0xb1a4('0x30')],qs[_0xb1a4('0x35')](_0x50e01e[_0xb1a4('0x31')][_0xb1a4('0x35')]));_0x3a2849[_0xb1a4('0x33')]=_0x3a2849[_0xb1a4('0x33')][_0xb1a4('0x36')]?_0x3a2849[_0xb1a4('0x33')]:_0x5cdde3[_0xb1a4('0x30')];if(_0x50e01e['query']['includeAll']){_0x3a2849['include']=[{'all':!![]}];}_0x3a2849=_[_0xb1a4('0x3c')]({},_0x3a2849,_0x50e01e[_0xb1a4('0x3e')]);return db[_0xb1a4('0x2c')][_0xb1a4('0x44')](_0x3a2849)['then'](handleEntityNotFound(_0x175f8a,null))[_0xb1a4('0x27')](respondWithResult(_0x175f8a,null))[_0xb1a4('0x45')](handleError(_0x175f8a,null));};exports[_0xb1a4('0x46')]=function(_0x29b826,_0x7a65){return db[_0xb1a4('0x2c')]['create'](_0x29b826[_0xb1a4('0x47')],{})[_0xb1a4('0x27')](respondWithResult(_0x7a65,0xc9))['catch'](handleError(_0x7a65,null));};exports[_0xb1a4('0x26')]=function(_0x3ac338,_0x13a956){if(_0x3ac338[_0xb1a4('0x47')]['id']){delete _0x3ac338['body']['id'];}return db[_0xb1a4('0x2c')]['find']({'where':{'id':_0x3ac338['params']['id']}})[_0xb1a4('0x27')](handleEntityNotFound(_0x13a956,null))[_0xb1a4('0x27')](saveUpdates(_0x3ac338[_0xb1a4('0x47')],null))[_0xb1a4('0x27')](respondWithResult(_0x13a956,null))[_0xb1a4('0x45')](handleError(_0x13a956,null));};exports[_0xb1a4('0x48')]=function(_0x346ff8,_0x196195){return db['WhatsappTransferReport']['find']({'where':{'id':_0x346ff8[_0xb1a4('0x49')]['id']}})[_0xb1a4('0x27')](handleEntityNotFound(_0x196195,null))[_0xb1a4('0x27')](removeEntity(_0x196195,null))['catch'](handleError(_0x196195,null));};exports[_0xb1a4('0x4a')]=function(_0x39fd91,_0x1eec5d){return db[_0xb1a4('0x2c')][_0xb1a4('0x4a')]()[_0xb1a4('0x27')](respondWithResult(_0x1eec5d,null))[_0xb1a4('0x45')](handleError(_0x1eec5d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index c218731..4293efe 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 _0xe6fd=['../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x14a69f,_0x159b4e){var _0x4d542c=function(_0x46f7f1){while(--_0x46f7f1){_0x14a69f['push'](_0x14a69f['shift']());}};_0x4d542c(++_0x159b4e);}(_0xe6fd,0x156));var _0xde6f=function(_0x117813,_0x587f91){_0x117813=_0x117813-0x0;var _0x2a2405=_0xe6fd[_0x117813];return _0x2a2405;};'use strict';var _=require('lodash');var util=require(_0xde6f('0x0'));var logger=require(_0xde6f('0x1'))('api');var moment=require(_0xde6f('0x2'));var BPromise=require(_0xde6f('0x3'));var rp=require(_0xde6f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde6f('0x5'));var config=require(_0xde6f('0x6'));var attributes=require(_0xde6f('0x7'));module['exports']=function(_0x486a53,_0xd42553){return _0x486a53[_0xde6f('0x8')](_0xde6f('0x9'),attributes,{'tableName':_0xde6f('0xa'),'paranoid':![],'indexes':[{'name':_0xde6f('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x170b=['exports','report_whatsapp_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappTransferReport.attributes'];(function(_0x36c7aa,_0x1801db){var _0x16fe25=function(_0x2c0f8f){while(--_0x2c0f8f){_0x36c7aa['push'](_0x36c7aa['shift']());}};_0x16fe25(++_0x1801db);}(_0x170b,0x11b));var _0xb170=function(_0x4375d0,_0x195a5c){_0x4375d0=_0x4375d0-0x0;var _0x10cc85=_0x170b[_0x4375d0];return _0x10cc85;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb170('0x0'))(_0xb170('0x1'));var moment=require(_0xb170('0x2'));var BPromise=require(_0xb170('0x3'));var rp=require(_0xb170('0x4'));var fs=require('fs');var path=require(_0xb170('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb170('0x6'));module[_0xb170('0x7')]=function(_0x44998e,_0x1c5ce2){return _0x44998e['define']('WhatsappTransferReport',attributes,{'tableName':_0xb170('0x8'),'paranoid':![],'indexes':[{'name':_0xb170('0x9'),'fields':[_0xb170('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d3d962e..bba6ae9 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 _0x2ced=['info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x2ced,0xe6));var _0xd2ce=function(_0x4e5dd6,_0x5e9b0d){_0x4e5dd6=_0x4e5dd6-0x0;var _0x29eb0e=_0x2ced[_0x4e5dd6];return _0x29eb0e;};'use strict';var _=require(_0xd2ce('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd2ce('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2ce('0x2'));var db=require(_0xd2ce('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd2ce('0x4'))(_0xd2ce('0x5'));var config=require(_0xd2ce('0x6'));var jayson=require(_0xd2ce('0x7'));var client=jayson[_0xd2ce('0x8')][_0xd2ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ed655,_0x3e0427,_0x4492fd){return new BPromise(function(_0x233530,_0x45e348){return client[_0xd2ce('0xa')](_0x5ed655,_0x4492fd)[_0xd2ce('0xb')](function(_0x1810c7){logger[_0xd2ce('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3e0427,'request\x20sent');logger['debug'](_0xd2ce('0xd'),_0x3e0427,_0xd2ce('0xe'),JSON[_0xd2ce('0xf')](_0x1810c7));if(_0x1810c7[_0xd2ce('0x10')]){if(_0x1810c7[_0xd2ce('0x10')][_0xd2ce('0x11')]===0x1f4){logger[_0xd2ce('0x10')](_0xd2ce('0x12'),_0x3e0427,_0x1810c7[_0xd2ce('0x10')][_0xd2ce('0x13')]);return _0x45e348(_0x1810c7[_0xd2ce('0x10')]['message']);}logger[_0xd2ce('0x10')](_0xd2ce('0x12'),_0x3e0427,_0x1810c7[_0xd2ce('0x10')]['message']);return _0x233530(_0x1810c7[_0xd2ce('0x10')]['message']);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x3e0427,_0xd2ce('0xe'));_0x233530(_0x1810c7[_0xd2ce('0x14')][_0xd2ce('0x13')]);}})[_0xd2ce('0x15')](function(_0x2e2211){logger[_0xd2ce('0x10')](_0xd2ce('0x12'),_0x3e0427,_0x2e2211);_0x45e348(_0x2e2211);});});} \ No newline at end of file +var _0x6752=['client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6752,0x176));var _0x2675=function(_0x3b493e,_0x24c4db){_0x3b493e=_0x3b493e-0x0;var _0x5e526b=_0x6752[_0x3b493e];return _0x5e526b;};'use strict';var _=require(_0x2675('0x0'));var util=require(_0x2675('0x1'));var moment=require(_0x2675('0x2'));var BPromise=require(_0x2675('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2675('0x4'));var db=require(_0x2675('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2675('0x6'))(_0x2675('0x7'));var config=require(_0x2675('0x8'));var jayson=require(_0x2675('0x9'));var client=jayson[_0x2675('0xa')][_0x2675('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4056cf,_0x558f26,_0x615326){return new BPromise(function(_0x4897c3,_0x48394a){return client[_0x2675('0xc')](_0x4056cf,_0x615326)['then'](function(_0x2ff5da){logger[_0x2675('0xd')](_0x2675('0xe'),_0x558f26,_0x2675('0xf'));logger[_0x2675('0x10')](_0x2675('0x11'),_0x558f26,_0x2675('0xf'),JSON[_0x2675('0x12')](_0x2ff5da));if(_0x2ff5da[_0x2675('0x13')]){if(_0x2ff5da[_0x2675('0x13')][_0x2675('0x14')]===0x1f4){logger[_0x2675('0x13')](_0x2675('0xe'),_0x558f26,_0x2ff5da[_0x2675('0x13')]['message']);return _0x48394a(_0x2ff5da[_0x2675('0x13')][_0x2675('0x15')]);}logger[_0x2675('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x558f26,_0x2ff5da['error'][_0x2675('0x15')]);return _0x4897c3(_0x2ff5da[_0x2675('0x13')]['message']);}else{logger[_0x2675('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x558f26,_0x2675('0xf'));_0x4897c3(_0x2ff5da[_0x2675('0x16')]['message']);}})[_0x2675('0x17')](function(_0x3907de){logger[_0x2675('0x13')](_0x2675('0xe'),_0x558f26,_0x3907de);_0x48394a(_0x3907de);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 49b1b7c..0b0f156 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4350=['Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sync','default','then','info','start','filter','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','Online\x20apps:','online','name','join','Offline\x20apps:','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x4350,0x1d0));var _0x0435=function(_0x589f7a,_0x1fe67e){_0x589f7a=_0x589f7a-0x0;var _0x16af88=_0x4350[_0x589f7a];return _0x16af88;};'use strict';var _=require(_0x0435('0x0'));var db=require(_0x0435('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x0435('0x2'));var rpc=require('./rpc');var config=require(_0x0435('0x3'));var logger=require(_0x0435('0x4'))('app');var pm2=require(_0x0435('0x5'));var pm2Config=require(_0x0435('0x6'));var schedule=require(_0x0435('0x7'));var chat=require(_0x0435('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x0435('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db['sequelize'][_0x0435('0xa')]()['then'](function(){if(config['seedDB']){return seedDb[_0x0435('0xb')]();}})['then'](function(){return checkLicense[_0x0435('0xb')]();})[_0x0435('0xc')](function(){return rpc['listen']();})[_0x0435('0xc')](function(_0x518b5d){logger[_0x0435('0xd')](_0x518b5d);return chat[_0x0435('0xe')]();})[_0x0435('0xc')](function(){return whatsapp[_0x0435('0xe')]();})[_0x0435('0xc')](function(){return schedule[_0x0435('0xe')]();})[_0x0435('0xc')](function(){return transcribe[_0x0435('0xe')]();})['then'](function(){return provider['start']();})[_0x0435('0xc')](function(_0x4ada09){logger[_0x0435('0xd')](_0x4ada09);return pm2['start'](pm2Config);})[_0x0435('0xc')](function(_0x298a88){var _0x535f28=_0x298a88[_0x0435('0xf')](function(_0x3ec691){return typeof _0x3ec691['exitCode']===_0x0435('0x10')&&_0x3ec691['exitCode']>=0x0;});if(_0x535f28[_0x0435('0x11')]>0x0){throw new Error(_0x535f28[_0x0435('0x11')]+_0x0435('0x12')+_[_0x0435('0x13')](_0x535f28,function(_0x18564a){return'\x22'+_0x18564a['pm2_env']['name']+'\x22';}));}logger[_0x0435('0xd')](_0x0435('0x14'),_[_0x0435('0x13')](_[_0x0435('0xf')](_0x298a88,{'status':_0x0435('0x15')}),_0x0435('0x16'))[_0x0435('0x17')]());logger[_0x0435('0xd')](_0x0435('0x18'),_['map'](_['filter'](_0x298a88,function(_0x589a2b){return _0x589a2b['status']!==_0x0435('0x15');}),_0x0435('0x16'))[_0x0435('0x17')]()||_0x0435('0x19'));console[_0x0435('0x1a')](_0x0435('0x1b'));})[_0x0435('0x1c')](function(_0x18fa08){console[_0x0435('0x1a')](_0x0435('0x1d'),_0x18fa08);logger[_0x0435('0x1e')](_0x0435('0x1f'),_0x18fa08);process[_0x0435('0x20')](0x1);});}main(); \ No newline at end of file +var _0x9b6d=['pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','then','default','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map'];(function(_0x5cf5c1,_0x5453bb){var _0x12902b=function(_0x48b502){while(--_0x48b502){_0x5cf5c1['push'](_0x5cf5c1['shift']());}};_0x12902b(++_0x5453bb);}(_0x9b6d,0x105));var _0xd9b6=function(_0x46380f,_0x192b74){_0x46380f=_0x46380f-0x0;var _0x1d2d5e=_0x9b6d[_0x46380f];return _0x1d2d5e;};'use strict';var _=require('lodash');var db=require(_0xd9b6('0x0'))['db'];var seedDb=require(_0xd9b6('0x1'));var checkLicense=require(_0xd9b6('0x2'));var rpc=require(_0xd9b6('0x3'));var config=require(_0xd9b6('0x4'));var logger=require(_0xd9b6('0x5'))(_0xd9b6('0x6'));var pm2=require(_0xd9b6('0x7'));var pm2Config=require(_0xd9b6('0x8'));var schedule=require(_0xd9b6('0x9'));var chat=require(_0xd9b6('0xa'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xd9b6('0xb'));var provider=require(_0xd9b6('0xc'));function main(){return db[_0xd9b6('0xd')][_0xd9b6('0xe')]()['then'](function(){if(config[_0xd9b6('0xf')]){return seedDb['default']();}})[_0xd9b6('0x10')](function(){return checkLicense[_0xd9b6('0x11')]();})[_0xd9b6('0x10')](function(){return rpc[_0xd9b6('0x12')]();})[_0xd9b6('0x10')](function(_0x4397fa){logger[_0xd9b6('0x13')](_0x4397fa);return chat['start']();})[_0xd9b6('0x10')](function(){return whatsapp[_0xd9b6('0x14')]();})['then'](function(){return schedule[_0xd9b6('0x14')]();})[_0xd9b6('0x10')](function(){return transcribe[_0xd9b6('0x14')]();})[_0xd9b6('0x10')](function(){return provider[_0xd9b6('0x14')]();})[_0xd9b6('0x10')](function(_0x23c7eb){logger['info'](_0x23c7eb);return pm2[_0xd9b6('0x14')](pm2Config);})['then'](function(_0x15acd9){var _0x86d18=_0x15acd9[_0xd9b6('0x15')](function(_0x274b5d){return typeof _0x274b5d[_0xd9b6('0x16')]==='number'&&_0x274b5d[_0xd9b6('0x16')]>=0x0;});if(_0x86d18[_0xd9b6('0x17')]>0x0){throw new Error(_0x86d18[_0xd9b6('0x17')]+_0xd9b6('0x18')+_[_0xd9b6('0x19')](_0x86d18,function(_0x529658){return'\x22'+_0x529658[_0xd9b6('0x1a')][_0xd9b6('0x1b')]+'\x22';}));}logger['info'](_0xd9b6('0x1c'),_[_0xd9b6('0x19')](_[_0xd9b6('0x15')](_0x15acd9,{'status':_0xd9b6('0x1d')}),_0xd9b6('0x1b'))[_0xd9b6('0x1e')]());logger['info'](_0xd9b6('0x1f'),_[_0xd9b6('0x19')](_[_0xd9b6('0x15')](_0x15acd9,function(_0x297acf){return _0x297acf[_0xd9b6('0x20')]!==_0xd9b6('0x1d');}),'name')[_0xd9b6('0x1e')]()||_0xd9b6('0x21'));console['log'](_0xd9b6('0x22'));})[_0xd9b6('0x23')](function(_0x197a13){console[_0xd9b6('0x24')](_0xd9b6('0x25'),_0x197a13);logger[_0xd9b6('0x26')](_0xd9b6('0x27'),_0x197a13);process[_0xd9b6('0x28')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 54b6d1e..44a0611 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 _0x9bde=['whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','User','find','authenticate','pass','json','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','isNil','generateApiKey','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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.','updatePasswordsHistory','length','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x199d5f,_0x7e79d1){_0x199d5f=_0x199d5f-0x0;var _0x1eca8=_0x9bde[_0x199d5f];return _0x1eca8;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xe9bd('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xe9bd('0x1'));var encryptor=require('../encryptor');var _=require(_0xe9bd('0x2'));var jwt=require(_0xe9bd('0x3'));var expressJwt=require(_0xe9bd('0x4'));var compose=require(_0xe9bd('0x5'));var basicAuth=require(_0xe9bd('0x6'));var crypto=require(_0xe9bd('0x7'));var BPromise=require(_0xe9bd('0x8'));var util=require('util');var moment=require(_0xe9bd('0x9'));var validateJwt=expressJwt({'secret':config[_0xe9bd('0xa')][_0xe9bd('0xb')]});var userAttributes=['id',_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe'),_0xe9bd('0xf'),_0xe9bd('0x10'),_0xe9bd('0x11'),_0xe9bd('0x12'),'md5secret','voicePause',_0xe9bd('0x13'),_0xe9bd('0x14'),_0xe9bd('0x15'),'smsPause',_0xe9bd('0x16'),_0xe9bd('0x17'),_0xe9bd('0x18'),_0xe9bd('0x19'),'lastPauseAt',_0xe9bd('0x1a'),'allowmessenger',_0xe9bd('0x1b'),_0xe9bd('0x1c'),_0xe9bd('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0xe9bd('0x1e'),_0xe9bd('0x1f'),_0xe9bd('0x20'),_0xe9bd('0x21'),_0xe9bd('0x22'),_0xe9bd('0x23'),_0xe9bd('0x24'),'hotdesk',_0xe9bd('0x25'),_0xe9bd('0x26'),_0xe9bd('0x27'),'settingsEnabled',_0xe9bd('0x28'),_0xe9bd('0x29'),_0xe9bd('0x2a'),_0xe9bd('0x2b'),'ignorePauseForPreviewCalls',_0xe9bd('0x2c'),'chatAutoanswer',_0xe9bd('0x2d'),'emailAutoanswer',_0xe9bd('0x2e'),_0xe9bd('0x2f'),_0xe9bd('0x30'),_0xe9bd('0x31'),_0xe9bd('0x32'),_0xe9bd('0x33'),_0xe9bd('0x34'),'whatsappAutoanswer',_0xe9bd('0x35')];exports[_0xe9bd('0x36')]=function(){return this['isAuthenticated'](!![])[_0xe9bd('0x37')](function(_0x505c23,_0x238ab1,_0x1b9cc9){if(_0x505c23[_0xe9bd('0x38')]){_0x1b9cc9();}else{return db[_0xe9bd('0x39')]['findOne']({'where':{'id':_0x505c23[_0xe9bd('0x3a')]['id']},'attributes':['id',_0xe9bd('0x3b'),_0xe9bd('0x3c')],'raw':!![]})[_0xe9bd('0x3d')](function(_0x2641be){if(_0x2641be&&_0x2641be[_0xe9bd('0x3b')]){return _0x238ab1[_0xe9bd('0x3e')](_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?0x195:0x193)['json']({'message':_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?'Unmanaged.':_0xe9bd('0x40')});}else{_0x1b9cc9();}})[_0xe9bd('0x41')](function(_0x119672){_0x1b9cc9(_0x119672);});}});};exports[_0xe9bd('0x42')]=function isAuthenticated(_0x141b95){return compose()[_0xe9bd('0x37')](function(_0x519f48,_0x5b7f1d,_0x1de54c){var _0x56e409;if(_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')]){if(_[_0xe9bd('0x45')](_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')],'Basic')){var _0x4b7bc2=basicAuth(_0x519f48);db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'name':_0x4b7bc2[_0xe9bd('0xe')]}})[_0xe9bd('0x3d')](function(_0xe2436){if(!_0xe2436||!_0xe2436[_0xe9bd('0x48')](_0x4b7bc2[_0xe9bd('0x49')])){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':'Wrong\x20credentials.'});}_0x519f48[_0xe9bd('0x38')]={'id':_0xe2436['id']};_0x1de54c();})[_0xe9bd('0x41')](function(_0x390a43){_0x1de54c(_0x390a43);});}else if(_['startsWith'](_0x519f48['headers'][_0xe9bd('0x44')],_0xe9bd('0x4b'))){validateJwt(_0x519f48,_0x5b7f1d,_0x1de54c);}else{if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}}}else if(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')]){try{var _0x1c6173={'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};verifyJwt(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')],_0x1c6173)[_0xe9bd('0x3d')](function(_0x199477){return db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'id':_0x199477[_0xe9bd('0x50')]}})[_0xe9bd('0x3d')](function(_0x4c689d){_0x56e409=_0x4c689d;return db[_0xe9bd('0x51')][_0xe9bd('0x52')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe9bd('0x53')],'raw':!![]});})[_0xe9bd('0x3d')](function(_0x4c7d47){if(!_0x56e409||!_['isEqual'](_0x56e409[_0xe9bd('0x54')],_0x199477[_0xe9bd('0x55')])){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x56')});}if(_0x56e409[_0xe9bd('0x57')]){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x56e409[_0xe9bd('0x58')]){if(_0x4c7d47[_0xe9bd('0x53')]>0x0){if(moment(_0x56e409[_0xe9bd('0x59')])[_0xe9bd('0x5a')](_0x4c7d47['blockDuration'],_0xe9bd('0x5b'))>moment()){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}_0x519f48[_0xe9bd('0x38')]={'id':_0x56e409['id']};_0x1de54c();});})[_0xe9bd('0x41')](function(){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xcf9a0c){_0x1de54c(_0xcf9a0c);}}else if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d['status'](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}})[_0xe9bd('0x37')](function(_0x480797,_0x1ba613,_0x2923cf){if(_0x480797[_0xe9bd('0x38')]){db['User'][_0xe9bd('0x47')]({'where':{'id':_0x480797[_0xe9bd('0x38')]['id']},'attributes':userAttributes})[_0xe9bd('0x3d')](function(_0x388132){if(!_0x388132){return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5d')});}_0x480797[_0xe9bd('0x38')]=_0x388132;_0x2923cf();})[_0xe9bd('0x41')](function(_0x300e07){_0x2923cf(_0x300e07);});}else if(_0x141b95){_0x2923cf();}else{return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5e')});}});};exports[_0xe9bd('0x5f')]=function canUpdate(){return compose()[_0xe9bd('0x37')](function(_0x5b70d3,_0x5a86fd,_0x283e67){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x58828b){if(_0x58828b['update']){_0x283e67();}else{return _0x5a86fd[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0x39fb61){_0x283e67(_0x39fb61);});});};exports[_0xe9bd('0x62')]=function isWebrtcLicence(){return compose()[_0xe9bd('0x37')](function(_0x512899,_0x1e45fc,_0x4cc146){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x33ba69){if(_0x33ba69[_0xe9bd('0x63')]){_0x4cc146();}else{return _0x1e45fc[_0xe9bd('0x3e')](0x193)['json']({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0xe14fa4){_0x4cc146(_0xe14fa4);});});};exports['isMiddleware']=function(_0xff4e14,_0x476f23,_0x34f787){_0xff4e14['isMiddleware']=!![];return _0x34f787();};exports[_0xe9bd('0x64')]=function signToken(_0x27e7b0){return signJwt(_0x27e7b0);};exports[_0xe9bd('0x65')]=function(_0x10ec29,_0x1ee09c){if(!_0x10ec29['user']){return _0x1ee09c[_0xe9bd('0x3e')](0x194)['json']({'message':_0xe9bd('0x66')});}var _0x239be9={'payload':{'id':_0x10ec29[_0xe9bd('0x38')]['id'],'role':_0x10ec29[_0xe9bd('0x38')][_0xe9bd('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x239be9)['then'](function(_0x15d1d0){_0x1ee09c['cookie'](_0xe9bd('0x67'),_0x15d1d0);_0x1ee09c[_0xe9bd('0x68')]('/dashboards/general');})['catch'](function(_0x1ce539){return _0x1ee09c['status'](0x1f4)[_0xe9bd('0x69')](_0x1ce539);});};exports['retrieveApiKey']=function(_0x26b25a){if(_[_0xe9bd('0x6a')](_0x26b25a['apiKeyNonce'])||_[_0xe9bd('0x6a')](_0x26b25a['apiKeyIat'])){return null;}else{return createJwt(_0x26b25a);}};exports[_0xe9bd('0x6b')]=function(_0x2d9a94){_0x2d9a94[_0xe9bd('0x54')]=generateNonce();_0x2d9a94['apiKeyIat']=generateIssuedAt();return createJwt(_0x2d9a94);};exports[_0xe9bd('0x6c')]=function(_0x1d703f,_0x45b69e){var _0x232a36=_0x1d703f['query']['apikey'];if(_0x232a36){var _0x441f89={'nonce':_0x45b69e['apiKeyNonce'],'iat':_0x45b69e[_0xe9bd('0x6d')],'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};return verifyJwt(_0x232a36,_0x441f89)[_0xe9bd('0x3d')](function(){return generateApiKey(_0x45b69e);});}else{throw{'message':_0xe9bd('0x6e')};}};exports[_0xe9bd('0x6f')]=function(_0x373057){var _0x3381ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3381ee[_0xe9bd('0x70')](_0x373057))throw new db[(_0xe9bd('0x71'))][(_0xe9bd('0x72'))](_0xe9bd('0x73'));return;};exports['validatePasswordHistory']=function(_0x596a7d,_0x566dd8,_0x10e685){var _0x5a516e=encryptor[_0xe9bd('0x74')](_0x566dd8)[_0xe9bd('0x75')](',');for(var _0x90db01=0x0;_0x90db01<_0x10e685;_0x90db01++){if(!_0x5a516e[_0x90db01])break;if(_0x596a7d[_0xe9bd('0x76')]()===_0x5a516e[_0x90db01][_0xe9bd('0x76')]()){var _0xaf6ffd=util[_0xe9bd('0x77')](_0xe9bd('0x78'),_0x10e685);if(_0x10e685===0x1){_0xaf6ffd=_0xe9bd('0x79');}throw new db['Sequelize'][(_0xe9bd('0x72'))](_0xaf6ffd);}}return;};exports[_0xe9bd('0x7a')]=function(_0x3d3e74,_0x3f848d){var _0x4d58c1=_0x3f848d?encryptor[_0xe9bd('0x74')](_0x3f848d)[_0xe9bd('0x75')](','):[];if(_0x4d58c1[_0xe9bd('0x7b')]===0x5){_0x4d58c1['splice'](-0x1,0x1);}_0x4d58c1[_0xe9bd('0x7c')](_0x3d3e74);return encryptor[_0xe9bd('0x7d')](_0x4d58c1[_0xe9bd('0x7e')](','));};function signJwt(_0xfe82f7){var _0x4ee26a=BPromise['promisify'](jwt[_0xe9bd('0x7f')],{'context':jwt});var _0x188891=_0xfe82f7[_0xe9bd('0x80')]||config[_0xe9bd('0xa')]['session'];return new BPromise(function(_0x49add9,_0x305efa){_0x4ee26a(_0xfe82f7[_0xe9bd('0x81')],_0x188891,_0xfe82f7[_0xe9bd('0x82')])[_0xe9bd('0x3d')](function(_0x1fd2b5){_0x49add9(_0x1fd2b5);})[_0xe9bd('0x41')](function(_0x4870f8){_0x305efa(_0x4870f8);});});}function verifyJwt(_0x179c8d,_0x5681ab,_0x27e07c){var _0x28dd03=BPromise[_0xe9bd('0x83')](jwt[_0xe9bd('0x84')],{'context':jwt});var _0x5bc1f8=_0x27e07c||config[_0xe9bd('0xa')][_0xe9bd('0xb')];return new BPromise(function(_0x3b0190,_0x4f35c4){_0x28dd03(_0x179c8d,_0x5bc1f8,_0x5681ab)[_0xe9bd('0x3d')](function(_0x1a9d0c){_0x3b0190(_0x1a9d0c);})[_0xe9bd('0x41')](function(_0x3e3e05){_0x4f35c4(_0x3e3e05);});});}function generateNonce(){return crypto[_0xe9bd('0x85')](0x10)[_0xe9bd('0x86')](_0xe9bd('0x87'));}function generateIssuedAt(){return Math[_0xe9bd('0x88')](Date[_0xe9bd('0x89')]()/0x3e8)[_0xe9bd('0x86')]();}function createJwt(_0x14c599){var _0x37d07a={'payload':{'iat':_0x14c599['apiKeyIat'],'nonce':_0x14c599[_0xe9bd('0x54')]},'options':{'algorithm':_0xe9bd('0x8a'),'subject':_0x14c599['id']['toString'](),'issuer':hardwareConf[_0xe9bd('0x4f')](),'audience':hardwareConf[_0xe9bd('0x4f')]()}};return signJwt(_0x37d07a)['then'](function(_0x561165){return{'iat':_0x14c599[_0xe9bd('0x6d')],'nonce':_0x14c599[_0xe9bd('0x54')],'token':_0x561165};});} \ No newline at end of file +var _0xa41a=['passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','User','name','then','status','json','Wrong\x20credentials.','startsWith','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','splice','unshift','join','promisify','sign','secret','verify','secrets','session','randomBytes','now','toString','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastPauseAt','allowmessenger'];(function(_0x2cd160,_0xce27af){var _0x20f054=function(_0x5ddb7b){while(--_0x5ddb7b){_0x2cd160['push'](_0x2cd160['shift']());}};_0x20f054(++_0xce27af);}(_0xa41a,0x6b));var _0xaa41=function(_0xf26171,_0x311410){_0xf26171=_0xf26171-0x0;var _0xca9989=_0xa41a[_0xf26171];return _0xca9989;};'use strict';var db=require(_0xaa41('0x0'))['db'];var config=require(_0xaa41('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xaa41('0x2'));var encryptor=require(_0xaa41('0x3'));var _=require(_0xaa41('0x4'));var jwt=require(_0xaa41('0x5'));var expressJwt=require(_0xaa41('0x6'));var compose=require(_0xaa41('0x7'));var basicAuth=require(_0xaa41('0x8'));var crypto=require(_0xaa41('0x9'));var BPromise=require('bluebird');var util=require(_0xaa41('0xa'));var moment=require(_0xaa41('0xb'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xaa41('0xc'),_0xaa41('0xd'),'name',_0xaa41('0xe'),_0xaa41('0xf'),_0xaa41('0x10'),_0xaa41('0x11'),_0xaa41('0x12'),_0xaa41('0x13'),_0xaa41('0x14'),_0xaa41('0x15'),_0xaa41('0x16'),'smsPause',_0xaa41('0x17'),_0xaa41('0x18'),'showWebBar','lastLoginAt',_0xaa41('0x19'),'crudPermissions',_0xaa41('0x1a'),_0xaa41('0x1b'),_0xaa41('0x1c'),_0xaa41('0x1d'),_0xaa41('0x1e'),'phoneBarDnd',_0xaa41('0x1f'),_0xaa41('0x20'),_0xaa41('0x21'),_0xaa41('0x22'),_0xaa41('0x23'),_0xaa41('0x24'),_0xaa41('0x25'),'hotdesk',_0xaa41('0x26'),_0xaa41('0x27'),_0xaa41('0x28'),_0xaa41('0x29'),_0xaa41('0x2a'),_0xaa41('0x2b'),_0xaa41('0x2c'),_0xaa41('0x2d'),_0xaa41('0x2e'),'selectRecallMeCampaign','chatAutoanswer',_0xaa41('0x2f'),_0xaa41('0x30'),_0xaa41('0x31'),'smsAutoanswer',_0xaa41('0x32'),_0xaa41('0x33'),'openchannelAutoanswerDelay','faxAutoanswer',_0xaa41('0x34'),'whatsappAutoanswer',_0xaa41('0x35')];exports[_0xaa41('0x36')]=function(){return this[_0xaa41('0x37')](!![])[_0xaa41('0x38')](function(_0x1d623c,_0x4eb01f,_0x43c430){if(_0x1d623c[_0xaa41('0x39')]){_0x43c430();}else{return db[_0xaa41('0x3a')][_0xaa41('0x3b')]({'where':{'id':_0x1d623c[_0xaa41('0x3c')]['id']},'attributes':['id',_0xaa41('0x3d'),'disposition'],'raw':!![]})['then'](function(_0x16aec5){if(_0x16aec5&&_0x16aec5['closed']){return _0x4eb01f['status'](_0x16aec5[_0xaa41('0x3e')]==='unmanaged'?0x195:0x193)['json']({'message':_0x16aec5[_0xaa41('0x3e')]===_0xaa41('0x3f')?_0xaa41('0x40'):_0xaa41('0x41')});}else{_0x43c430();}})[_0xaa41('0x42')](function(_0xa7269f){_0x43c430(_0xa7269f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x30a174){return compose()[_0xaa41('0x38')](function(_0x63c18c,_0x9a16e3,_0x1d8c2b){var _0x4466a3;if(_0x63c18c[_0xaa41('0x43')][_0xaa41('0x44')]){if(_['startsWith'](_0x63c18c[_0xaa41('0x43')]['authorization'],'Basic')){var _0x714537=basicAuth(_0x63c18c);db[_0xaa41('0x45')]['find']({'where':{'name':_0x714537[_0xaa41('0x46')]}})[_0xaa41('0x47')](function(_0x4e3b44){if(!_0x4e3b44||!_0x4e3b44['authenticate'](_0x714537['pass'])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x4a')});}_0x63c18c[_0xaa41('0x39')]={'id':_0x4e3b44['id']};_0x1d8c2b();})['catch'](function(_0x289c4a){_0x1d8c2b(_0x289c4a);});}else if(_[_0xaa41('0x4b')](_0x63c18c[_0xaa41('0x43')]['authorization'],_0xaa41('0x4c'))){validateJwt(_0x63c18c,_0x9a16e3,_0x1d8c2b);}else{if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x63c18c[_0xaa41('0x4d')][_0xaa41('0x4e')]){try{var _0x57fe1d={'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};verifyJwt(_0x63c18c[_0xaa41('0x4d')]['apikey'],_0x57fe1d)[_0xaa41('0x47')](function(_0x48335f){return db[_0xaa41('0x45')][_0xaa41('0x50')]({'where':{'id':_0x48335f[_0xaa41('0x51')]}})['then'](function(_0x526377){_0x4466a3=_0x526377;return db['Setting'][_0xaa41('0x3b')]({'where':{'id':0x1},'attributes':[_0xaa41('0x52'),_0xaa41('0x53')],'raw':!![]});})[_0xaa41('0x47')](function(_0x4fbb92){if(!_0x4466a3||!_['isEqual'](_0x4466a3[_0xaa41('0x54')],_0x48335f[_0xaa41('0x55')])){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x56')});}if(_0x4466a3[_0xaa41('0x57')]){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}if(_0x4466a3[_0xaa41('0x59')]){if(_0x4fbb92[_0xaa41('0x53')]>0x0){if(moment(_0x4466a3[_0xaa41('0x5a')])['add'](_0x4fbb92['blockDuration'],_0xaa41('0x5b'))>moment()){return _0x9a16e3[_0xaa41('0x48')](0x191)['json']({'message':_0xaa41('0x58')});}}else{return _0x9a16e3['status'](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});}}_0x63c18c[_0xaa41('0x39')]={'id':_0x4466a3['id']};_0x1d8c2b();});})[_0xaa41('0x42')](function(){return _0x9a16e3[_0xaa41('0x48')](0x191)[_0xaa41('0x49')]({'message':_0xaa41('0x58')});});}catch(_0x21f204){_0x1d8c2b(_0x21f204);}}else if(_0x30a174){_0x1d8c2b();}else{return _0x9a16e3['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5c')});}})[_0xaa41('0x38')](function(_0x398c35,_0xc84fb8,_0x1e2eb2){if(_0x398c35['user']){db['User'][_0xaa41('0x50')]({'where':{'id':_0x398c35['user']['id']},'attributes':userAttributes})[_0xaa41('0x47')](function(_0x215896){if(!_0x215896){return _0xc84fb8[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x5d')});}_0x398c35[_0xaa41('0x39')]=_0x215896;_0x1e2eb2();})[_0xaa41('0x42')](function(_0x5ee74c){_0x1e2eb2(_0x5ee74c);});}else if(_0x30a174){_0x1e2eb2();}else{return _0xc84fb8[_0xaa41('0x48')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xaa41('0x5e')]=function canUpdate(){return compose()['use'](function(_0x57240d,_0x5274c9,_0x3bad48){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x198716){if(_0x198716['update']){_0x3bad48();}else{return _0x5274c9['status'](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})[_0xaa41('0x42')](function(_0x2af8ba){_0x3bad48(_0x2af8ba);});});};exports[_0xaa41('0x60')]=function isWebrtcLicence(){return compose()[_0xaa41('0x38')](function(_0x258096,_0x37bf5d,_0x2fa6ec){return licenseUtil['getLicense']()[_0xaa41('0x47')](function(_0x22d512){if(_0x22d512[_0xaa41('0x61')]){_0x2fa6ec();}else{return _0x37bf5d[_0xaa41('0x48')](0x193)[_0xaa41('0x49')]({'message':_0xaa41('0x5f')});}})['catch'](function(_0x406824){_0x2fa6ec(_0x406824);});});};exports[_0xaa41('0x62')]=function(_0x1f50c,_0x2288f8,_0x57d1f6){_0x1f50c[_0xaa41('0x62')]=!![];return _0x57d1f6();};exports['signToken']=function signToken(_0x49fedd){return signJwt(_0x49fedd);};exports[_0xaa41('0x63')]=function(_0xe0eec0,_0x3e16ef){if(!_0xe0eec0['user']){return _0x3e16ef[_0xaa41('0x48')](0x194)[_0xaa41('0x49')]({'message':_0xaa41('0x64')});}var _0x48fa37={'payload':{'id':_0xe0eec0[_0xaa41('0x39')]['id'],'role':_0xe0eec0[_0xaa41('0x39')][_0xaa41('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x48fa37)[_0xaa41('0x47')](function(_0x37fbe2){_0x3e16ef[_0xaa41('0x65')](_0xaa41('0x66'),_0x37fbe2);_0x3e16ef[_0xaa41('0x67')]('/dashboards/general');})[_0xaa41('0x42')](function(_0x5bef5f){return _0x3e16ef['status'](0x1f4)[_0xaa41('0x68')](_0x5bef5f);});};exports[_0xaa41('0x69')]=function(_0x3fef3e){if(_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x54')])||_[_0xaa41('0x6a')](_0x3fef3e[_0xaa41('0x6b')])){return null;}else{return createJwt(_0x3fef3e);}};exports[_0xaa41('0x6c')]=function(_0x519e39){_0x519e39[_0xaa41('0x54')]=generateNonce();_0x519e39[_0xaa41('0x6b')]=generateIssuedAt();return createJwt(_0x519e39);};exports[_0xaa41('0x6d')]=function(_0x4f9e92,_0x2e0f53){var _0x35f664=_0x4f9e92['query'][_0xaa41('0x4e')];if(_0x35f664){var _0xd36d1a={'nonce':_0x2e0f53[_0xaa41('0x54')],'iat':_0x2e0f53['apiKeyIat'],'audience':hardwareConf[_0xaa41('0x4f')](),'issuer':hardwareConf[_0xaa41('0x4f')]()};return verifyJwt(_0x35f664,_0xd36d1a)['then'](function(){return generateApiKey(_0x2e0f53);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xaa41('0x6e')]=function(_0x3cd14f){var _0x3a29d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3a29d2['test'](_0x3cd14f))throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0xaa41('0x71'));return;};exports[_0xaa41('0x72')]=function(_0x2abb78,_0x5ccdc5,_0x2ae70c){var _0x57cb70=encryptor['decryptString'](_0x5ccdc5)[_0xaa41('0x73')](',');for(var _0x52ae7f=0x0;_0x52ae7f<_0x2ae70c;_0x52ae7f++){if(!_0x57cb70[_0x52ae7f])break;if(_0x2abb78[_0xaa41('0x74')]()===_0x57cb70[_0x52ae7f][_0xaa41('0x74')]()){var _0x169ddf=util['format'](_0xaa41('0x75'),_0x2ae70c);if(_0x2ae70c===0x1){_0x169ddf=_0xaa41('0x76');}throw new db[(_0xaa41('0x6f'))][(_0xaa41('0x70'))](_0x169ddf);}}return;};exports[_0xaa41('0x77')]=function(_0x332a3c,_0xc56018){var _0x337059=_0xc56018?encryptor[_0xaa41('0x78')](_0xc56018)['split'](','):[];if(_0x337059[_0xaa41('0x79')]===0x5){_0x337059[_0xaa41('0x7a')](-0x1,0x1);}_0x337059[_0xaa41('0x7b')](_0x332a3c);return encryptor['encryptString'](_0x337059[_0xaa41('0x7c')](','));};function signJwt(_0x2caf5c){var _0x157898=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x7e')],{'context':jwt});var _0xfbe748=_0x2caf5c[_0xaa41('0x7f')]||config['secrets']['session'];return new BPromise(function(_0x5cb34d,_0x540325){_0x157898(_0x2caf5c['payload'],_0xfbe748,_0x2caf5c['options'])[_0xaa41('0x47')](function(_0x50b598){_0x5cb34d(_0x50b598);})['catch'](function(_0x24c6f3){_0x540325(_0x24c6f3);});});}function verifyJwt(_0x40a524,_0x1a877b,_0x312eee){var _0x5cabc4=BPromise[_0xaa41('0x7d')](jwt[_0xaa41('0x80')],{'context':jwt});var _0x1ddb6c=_0x312eee||config[_0xaa41('0x81')][_0xaa41('0x82')];return new BPromise(function(_0x41ca40,_0x46ebcd){_0x5cabc4(_0x40a524,_0x1ddb6c,_0x1a877b)[_0xaa41('0x47')](function(_0x1795d1){_0x41ca40(_0x1795d1);})['catch'](function(_0x185600){_0x46ebcd(_0x185600);});});}function generateNonce(){return crypto[_0xaa41('0x83')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xaa41('0x84')]()/0x3e8)['toString']();}function createJwt(_0x1eac4a){var _0x5c8028={'payload':{'iat':_0x1eac4a[_0xaa41('0x6b')],'nonce':_0x1eac4a[_0xaa41('0x54')]},'options':{'algorithm':'HS512','subject':_0x1eac4a['id'][_0xaa41('0x85')](),'issuer':hardwareConf[_0xaa41('0x4f')](),'audience':hardwareConf[_0xaa41('0x4f')]()}};return signJwt(_0x5c8028)[_0xaa41('0x47')](function(_0x5a2683){return{'iat':_0x1eac4a['apiKeyIat'],'nonce':_0x1eac4a[_0xaa41('0x54')],'token':_0x5a2683};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 2be7a00..6fbc68e 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd866=['all','length','type','map','lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','filter','user','clause','tags','checkListsRestrictions','ids','count','fields','getFilteredContacts','rows','describe','CmContact','keys','startsWith','cf_','CmCustomField','findOne','slice'];(function(_0x987ca1,_0x25b789){var _0x1467ff=function(_0x114a24){while(--_0x114a24){_0x987ca1['push'](_0x987ca1['shift']());}};_0x1467ff(++_0x25b789);}(_0xd866,0x158));var _0x6d86=function(_0x5bf9c0,_0x206f4c){_0x5bf9c0=_0x5bf9c0-0x0;var _0x285285=_0xd866[_0x5bf9c0];return _0x285285;};'use strict';var _=require(_0x6d86('0x0'));var sqlUtils=require(_0x6d86('0x1'));var db=require(_0x6d86('0x2'))['db'];exports['findAll']=function(_0x2109c6,_0x615b56,_0x5241bf,_0x4d0172){var _0x3e7ad1={'count':0x0,'rows':[]};var _0x9202b1=sqlUtils[_0x6d86('0x3')](_0x615b56,_0x2109c6);if(_0x9202b1){return Promise[_0x6d86('0x4')](_0x3e7ad1);}var _0x22204b=sqlUtils[_0x6d86('0x5')]();var _0xad44cd={};var _0x2fc007=![];var _0xc53f3d=![];return Promise[_0x6d86('0x4')]()[_0x6d86('0x6')](function(){if(_0x2109c6[_0x6d86('0x7')]){return sqlUtils[_0x6d86('0x8')](_0x2109c6['search'],_0x4d0172);}else{return sqlUtils[_0x6d86('0x9')](_0x2109c6,_0x4d0172);}})[_0x6d86('0x6')](function(_0x12f95e){_0x22204b[_0x6d86('0xa')](_0x12f95e[_0x6d86('0xb')]);_0x22204b[_0x6d86('0xa')](_0x12f95e['fields']);_0x22204b[_0x6d86('0xa')](_0x12f95e[_0x6d86('0xc')]);_0x22204b[_0x6d86('0xa')](_0x12f95e[_0x6d86('0xd')][_0x6d86('0xe')]);_0xad44cd=_0x12f95e[_0x6d86('0xf')];_0xc53f3d=_0x12f95e[_0x6d86('0xd')]['skip'];return sqlUtils[_0x6d86('0x10')](_0x615b56,_0x2109c6,_0xc53f3d);})[_0x6d86('0x6')](function(_0x4fdbc3){_0x22204b[_0x6d86('0xa')](_0x4fdbc3);var _0x5a9acb=_0x2109c6['search']?_0xad44cd[_0x6d86('0x11')]:_0x2109c6['tag'];_0x2fc007=_0x5a9acb?!![]:![];return sqlUtils['countFilteredContacts'](_0x22204b,_0x5a9acb);})['then'](function(_0x18d954){_0x3e7ad1[_0x6d86('0x12')]=_0x18d954;if(_0x3e7ad1[_0x6d86('0x12')]===0x0){return;}if(_0x2109c6['User']){_0xc53f3d=!![];}return sqlUtils['buildContactsQuery'](_0x22204b,_0x2109c6[_0x6d86('0x13')],_0x5241bf,_0x2fc007,_0xad44cd[_0x6d86('0xe')],_0xc53f3d);})[_0x6d86('0x6')](function(_0x1ee098){if(!_0x1ee098){return[];}return sqlUtils[_0x6d86('0x14')](_0x1ee098,_0x2109c6,_0x5241bf);})[_0x6d86('0x6')](function(_0x519835){_0x3e7ad1[_0x6d86('0x15')]=_0x519835;return _0x3e7ad1;})['catch'](function(_0x50dba6){throw _0x50dba6;});};exports[_0x6d86('0x16')]=function(){var _0xc7e7d4={};var _0x16f990=[];return db[_0x6d86('0x17')][_0x6d86('0x16')]()[_0x6d86('0x6')](function(_0x115195){_0xc7e7d4=_0x115195;var _0x44f3ed=Object[_0x6d86('0x18')](_0xc7e7d4)[_0x6d86('0xc')](function(_0x13864c){return _[_0x6d86('0x19')](_0x13864c,_0x6d86('0x1a'))?_0x13864c:undefined;});var _0x160972=_0x44f3ed['map'](function(_0x47c533){return db[_0x6d86('0x1b')][_0x6d86('0x1c')]({'where':{'id':_0x47c533[_0x6d86('0x1d')](0x3)},'raw':!![]});});return Promise[_0x6d86('0x1e')](_0x160972);})['then'](function(_0x1f5af4){for(var _0x2e50c3=0x0;_0x2e50c3<_0x1f5af4[_0x6d86('0x1f')];_0x2e50c3++){if(_0x1f5af4[_0x2e50c3]){var _0x5eb168=_0x6d86('0x1a')+_0x1f5af4[_0x2e50c3]['id'];_0xc7e7d4[_0x5eb168]['fieldType']=_0x1f5af4[_0x2e50c3][_0x6d86('0x20')];}}_0x16f990=_[_0x6d86('0x21')](Object['keys'](_0xc7e7d4),function(_0x306439){return{'name':_0x306439,'type':_0xc7e7d4[_0x306439][_0x6d86('0x20')]};});return _0x16f990;})['catch'](function(_0x4d9e93){throw _0x4d9e93;});}; \ No newline at end of file +var _0x3ae1=['cf_','map','CmCustomField','findOne','slice','all','length','keys','type','lodash','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','where','default','fields','filter','user','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','rows','catch','startsWith'];(function(_0x2f4f1c,_0x1e2c9f){var _0x4c49a8=function(_0x5b9938){while(--_0x5b9938){_0x2f4f1c['push'](_0x2f4f1c['shift']());}};_0x4c49a8(++_0x1e2c9f);}(_0x3ae1,0xb3));var _0x13ae=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x3ae1[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x13ae('0x0'));var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0x13ae('0x1')]=function(_0x46372d,_0x4b8682,_0x3ed0a9,_0x4a7332){var _0x1a7659={'count':0x0,'rows':[]};var _0x5873df=sqlUtils[_0x13ae('0x2')](_0x4b8682,_0x46372d);if(_0x5873df){return Promise['resolve'](_0x1a7659);}var _0x5eef9d=sqlUtils['getContactsSubquery']();var _0x56bf32={};var _0x5b97ca=![];var _0x21959f=![];return Promise[_0x13ae('0x3')]()[_0x13ae('0x4')](function(){if(_0x46372d[_0x13ae('0x5')]){return sqlUtils[_0x13ae('0x6')](_0x46372d[_0x13ae('0x5')],_0x4a7332);}else{return sqlUtils['parseQueryParameters'](_0x46372d,_0x4a7332);}})[_0x13ae('0x4')](function(_0x1b95b1){_0x5eef9d[_0x13ae('0x7')](_0x1b95b1[_0x13ae('0x8')]);_0x5eef9d[_0x13ae('0x7')](_0x1b95b1[_0x13ae('0x9')]);_0x5eef9d[_0x13ae('0x7')](_0x1b95b1[_0x13ae('0xa')]);_0x5eef9d[_0x13ae('0x7')](_0x1b95b1[_0x13ae('0xb')]['clause']);_0x56bf32=_0x1b95b1[_0x13ae('0xc')];_0x21959f=_0x1b95b1['user'][_0x13ae('0xd')];return sqlUtils[_0x13ae('0xe')](_0x4b8682,_0x46372d,_0x21959f);})[_0x13ae('0x4')](function(_0x5f4206){_0x5eef9d[_0x13ae('0x7')](_0x5f4206);var _0x365423=_0x46372d[_0x13ae('0x5')]?_0x56bf32[_0x13ae('0xf')]:_0x46372d[_0x13ae('0x10')];_0x5b97ca=_0x365423?!![]:![];return sqlUtils[_0x13ae('0x11')](_0x5eef9d,_0x365423);})[_0x13ae('0x4')](function(_0x505c3e){_0x1a7659['count']=_0x505c3e;if(_0x1a7659[_0x13ae('0x12')]===0x0){return;}if(_0x46372d['User']){_0x21959f=!![];}return sqlUtils[_0x13ae('0x13')](_0x5eef9d,_0x46372d[_0x13ae('0x9')],_0x3ed0a9,_0x5b97ca,_0x56bf32[_0x13ae('0x14')],_0x21959f);})[_0x13ae('0x4')](function(_0xd0622a){if(!_0xd0622a){return[];}return sqlUtils[_0x13ae('0x15')](_0xd0622a,_0x46372d,_0x3ed0a9);})[_0x13ae('0x4')](function(_0x17e4d7){_0x1a7659[_0x13ae('0x16')]=_0x17e4d7;return _0x1a7659;})[_0x13ae('0x17')](function(_0x4f2470){throw _0x4f2470;});};exports['describe']=function(){var _0x19d89c={};var _0x128f03=[];return db['CmContact']['describe']()['then'](function(_0x100ff6){_0x19d89c=_0x100ff6;var _0x4464ad=Object['keys'](_0x19d89c)['filter'](function(_0x1595cb){return _[_0x13ae('0x18')](_0x1595cb,_0x13ae('0x19'))?_0x1595cb:undefined;});var _0x46d4c3=_0x4464ad[_0x13ae('0x1a')](function(_0x4764a8){return db[_0x13ae('0x1b')][_0x13ae('0x1c')]({'where':{'id':_0x4764a8[_0x13ae('0x1d')](0x3)},'raw':!![]});});return Promise[_0x13ae('0x1e')](_0x46d4c3);})[_0x13ae('0x4')](function(_0x1cf95b){for(var _0x3bfc4e=0x0;_0x3bfc4e<_0x1cf95b[_0x13ae('0x1f')];_0x3bfc4e++){if(_0x1cf95b[_0x3bfc4e]){var _0x3bff6c='cf_'+_0x1cf95b[_0x3bfc4e]['id'];_0x19d89c[_0x3bff6c]['fieldType']=_0x1cf95b[_0x3bfc4e]['type'];}}_0x128f03=_[_0x13ae('0x1a')](Object[_0x13ae('0x20')](_0x19d89c),function(_0x30e3c8){return{'name':_0x30e3c8,'type':_0x19d89c[_0x30e3c8][_0x13ae('0x21')]};});return _0x128f03;})[_0x13ae('0x17')](function(_0x1f79d3){throw _0x1f79d3;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 94dc601..2bd271b 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3eb=['limit','offset','subqry.id','order','DESC','subqry.','from','subqry','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','Tags','c.id','isEmpty','t.id\x20IN\x20?','QueryTypes','query','COUNT(*)','exports','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','ListId','autocomplete','true','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','firstName','phone','fax','email','updatedAt','deletedAt','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','type','default','value','start','end','Tag','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','user','skip','keys','some','Contact','push','c.ListId\x20IN\x20?','concat','\x20=\x20?','fields','tag','then','resolve','search','getLists','c.ListId\x20IS\x20NULL','attributes','select','group'];(function(_0x4651d4,_0x230abc){var _0x326d8e=function(_0x2d6b53){while(--_0x2d6b53){_0x4651d4['push'](_0x4651d4['shift']());}};_0x326d8e(++_0x230abc);}(_0xd3eb,0x1bb));var _0xbd3e=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0xd3eb[_0x9a3e0f];return _0x3d2a9a;};'use strict';var _=require(_0xbd3e('0x0'));var squel=require(_0xbd3e('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xbd3e('0x2'));var utils=require(_0xbd3e('0x3'));var db=require(_0xbd3e('0x4'))['db'];function skipContactsQuery(_0x2c3f5b,_0x5689a1){var _0x5b3786=![];if(_0x2c3f5b[_0xbd3e('0x5')]===_0xbd3e('0x6')&&!_0x5689a1['search']&&!_0x5689a1[_0xbd3e('0x7')]&&_0x5689a1[_0xbd3e('0x8')]!==_0xbd3e('0x9')){_0x5b3786=!![];}return _0x5b3786;}function getContactsSubquery(){return squel['select']()['from'](_0xbd3e('0xa'),'c')[_0xbd3e('0xb')](_0xbd3e('0xc'));}function applyJoinClauses(_0x37a5ed,_0x1ee934){var _0x1d8f14=_0x1ee934?'c':'subqry';_0x37a5ed[_0xbd3e('0xd')](_0xbd3e('0xe'),'uc','uc.CmContactId\x20=\x20'+_0x1d8f14+_0xbd3e('0xf'))[_0xbd3e('0xd')](_0xbd3e('0x10'),'ct',_0xbd3e('0x11')+_0x1d8f14+_0xbd3e('0xf'))[_0xbd3e('0xd')](_0xbd3e('0x12'),'t','t.id\x20=\x20ct.TagId');return _0x37a5ed;}function addFieldsToQuery(_0x522b79,_0x48bec0,_0x3bca8a,_0x82dd0,_0x8c8ed7){var _0x117397=_0x8c8ed7?'c':'subqry';if(!_0x48bec0){_0x48bec0=['id',_0xbd3e('0x13'),'lastName',_0xbd3e('0x14'),'mobile',_0xbd3e('0x15'),_0xbd3e('0x16'),_0xbd3e('0x7'),'CompanyId','createdAt',_0xbd3e('0x17'),_0xbd3e('0x18'),'TagIds'];}else if(!_0x48bec0['includes']('id')){_0x48bec0['push']('id');}var _0x48653a=_0x3bca8a&&_0x8c8ed7||!_0x3bca8a&&!_0x8c8ed7;if(_0x82dd0){_0x48653a=_0x82dd0&&_0x8c8ed7||!_0x82dd0&&!_0x8c8ed7;}_0x48bec0['forEach'](function(_0x3a38ce){if(_0x3a38ce===_0xbd3e('0x19')){if(_0x48653a){_0x522b79[_0xbd3e('0x1a')](_0xbd3e('0x1b'),_0x3a38ce);}else if(_0x3bca8a||_0x82dd0){_0x522b79[_0xbd3e('0x1a')](_0x117397+'.'+_0x3a38ce);}}else{_0x522b79[_0xbd3e('0x1a')](_0x117397+'.'+_0x3a38ce);}});return _0x522b79;}function getSqlClauses(){var _0x20613a={'default':squel[_0xbd3e('0x1c')](),'fields':squel[_0xbd3e('0x1c')](),'filter':squel[_0xbd3e('0x1c')](),'tags':{'clause':squel[_0xbd3e('0x1c')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x20613a;}function parseTagParameter(_0x355bde){var _0x172b26=squel[_0xbd3e('0x1c')]();if(_0x355bde){var _0x2e585b=utils[_0xbd3e('0x1d')](_0x355bde);_0x2e585b[_0xbd3e('0x1e')](function(_0x317341){_0x172b26['or'](_0xbd3e('0x1f'),'%,'+_0x317341+',%');});}return _0x172b26;}function parseSearchFilter(_0x347a8b){var _0x4340cf=squel[_0xbd3e('0x1c')]();if(_0x347a8b){var _0x56e3dd=_0x347a8b[_0xbd3e('0x20')]('\x5c','\x5c\x5c')[_0xbd3e('0x20')](/'/g,'\x27\x27');if(_0x56e3dd[_0xbd3e('0x21')]('\x20')[_0xbd3e('0x22')]>0x1){_0x4340cf['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbd3e('0x23')](_0x56e3dd,!![]),null);}else{if(qs[_0xbd3e('0x24')](_0x56e3dd)){_0x4340cf['or'](_0xbd3e('0x25'),_0x56e3dd+'%');_0x4340cf['or']('c.phone\x20LIKE\x20?',_0x56e3dd+'%');_0x4340cf['or']('c.mobile\x20LIKE\x20?',_0x56e3dd+'%');_0x4340cf['or'](_0xbd3e('0x26'),_0x56e3dd+'%');}else if(qs['isEmail'](_0x56e3dd)){_0x4340cf['or']('c.email\x20LIKE\x20?',_0x56e3dd+'%');}else{_0x4340cf['or'](_0xbd3e('0x27'),'%'+_0x56e3dd+'%');_0x4340cf['or']('c.lastName\x20LIKE\x20?','%'+_0x56e3dd+'%');_0x4340cf['or']('c.email\x20LIKE\x20?','%'+_0x56e3dd+'%');}}}return _0x4340cf;}function parseAdvancedSearchFilter(_0x476242,_0xaa3cf5){var _0x553751=getSqlClauses();var _0x5c95da=as[_0xbd3e('0x28')](_0x476242);var _0x3326d3=_0x5c95da[_0xbd3e('0x29')];for(var _0x426cd6=0x0;_0x426cd6<_0x5c95da[_0xbd3e('0x2a')]['length'];_0x426cd6++){var _0x28c656=_0x5c95da[_0xbd3e('0x2a')][_0x426cd6];var _0x150ae2='c';var _0x890199=_[_0xbd3e('0x2b')](_0xaa3cf5,[_0xbd3e('0x2c'),_0x28c656[_0xbd3e('0x1a')]]);if(_0x890199){if(_0x28c656['field']===_0xbd3e('0x2d')||_0x890199[_0xbd3e('0x2e')]===_0xbd3e('0x2f')){_0x28c656[_0xbd3e('0x30')]=_0xbd3e('0x31');}var _0xa57da4=as['buildExpression'](_0x150ae2,_0x890199[_0xbd3e('0x32')],_0x28c656);_0x553751[_0xbd3e('0x33')][_0x3326d3](_0xa57da4['text'],_0xa57da4[_0xbd3e('0x34')][_0xbd3e('0x35')],_0xa57da4[_0xbd3e('0x34')][_0xbd3e('0x36')]);}else{if(_0x28c656[_0xbd3e('0x1a')]===_0xbd3e('0x37')){var _0x17f142=_0x28c656[_0xbd3e('0x34')][_0xbd3e('0x21')](',')[_0xbd3e('0x38')](function(_0x29a64f){return Number(_0x29a64f);});var _0x5b3fa5=parseTagParameter(_0x17f142);_0x553751[_0xbd3e('0x39')][_0xbd3e('0x3a')][_0xbd3e('0x3b')](_0x5b3fa5);_0x553751[_0xbd3e('0x39')][_0xbd3e('0x3c')]=_0x17f142;}else if(_0x28c656[_0xbd3e('0x1a')]===_0xbd3e('0x3d')){_0x553751['user'][_0xbd3e('0x3a')][_0xbd3e('0x3b')](_0xbd3e('0x3e'),_0x28c656[_0xbd3e('0x34')]);_0x553751[_0xbd3e('0x3f')][_0xbd3e('0x40')]=!![];}}}return _0x553751;}function parseModelFields(_0xbd3011,_0x43fdc1){var _0x189ed1=squel[_0xbd3e('0x1c')]();var _0x32cdd0=_(_0xbd3011)[_0xbd3e('0x41')]()[_0xbd3e('0x38')](function(_0x4f2dab){return _[_0xbd3e('0x42')](_0x43fdc1,[_0xbd3e('0x2c'),_0x4f2dab])?_0x4f2dab:undefined;})['compact']()['value']();if(_0xbd3011[_0xbd3e('0x43')]){_0x32cdd0[_0xbd3e('0x44')](_0xbd3e('0x43'));}if(_0xbd3011[_0xbd3e('0x3d')]){_0x32cdd0[_0xbd3e('0x44')](_0xbd3e('0x3d'));}if(_0x32cdd0['length']>0x0){_0x32cdd0['forEach'](function(_0x37fd4e){if(_0x37fd4e==='ListId'){_0x189ed1[_0xbd3e('0x3b')](_0xbd3e('0x45'),[][_0xbd3e('0x46')](_0xbd3011[_0x37fd4e]));}else if(_0x37fd4e===_0xbd3e('0x43')){var _0x15e7eb='%'+_0xbd3011[_0x37fd4e]+'%';_0x189ed1[_0xbd3e('0x3b')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x15e7eb);}else if(_0x37fd4e===_0xbd3e('0x3d')){_0x189ed1['and'](_0xbd3e('0x3e'),_0xbd3011[_0x37fd4e]);}else{_0x189ed1[_0xbd3e('0x3b')]('c.'+_0x37fd4e+_0xbd3e('0x47'),_0xbd3011[_0x37fd4e]);}});}return _0x189ed1;}function parseQueryParameters(_0x5607ea,_0x31f8d0){var _0x108711=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x5607ea,_0x31f8d0);})['then'](function(_0x3636a3){_0x108711[_0xbd3e('0x48')][_0xbd3e('0x3b')](_0x3636a3);return parseTagParameter(_0x5607ea[_0xbd3e('0x49')]);})['then'](function(_0x3c6cc8){_0x108711['tags'][_0xbd3e('0x3a')][_0xbd3e('0x3b')](_0x3c6cc8);return parseSearchFilter(_0x5607ea['filter']);})[_0xbd3e('0x4a')](function(_0x313999){_0x108711['filter']=_0x313999;return _0x108711;});}function checkListsRestrictions(_0x914e2a,_0x3105c6,_0x408efd){var _0x340b95=squel[_0xbd3e('0x1c')]();return Promise[_0xbd3e('0x4b')]()[_0xbd3e('0x4a')](function(){if(_0x3105c6[_0xbd3e('0x4c')]&&_0x914e2a[_0xbd3e('0x5')]==='agent'&&!_0x408efd){return _0x914e2a[_0xbd3e('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0xbd3e('0x4a')](function(_0x3acb5c){if(_0x3acb5c){if(_0x3acb5c[_0xbd3e('0x22')]===0x0){_0x340b95['and'](_0xbd3e('0x4e'));}else{_0x340b95[_0xbd3e('0x3b')]('c.ListId\x20IN\x20?',_[_0xbd3e('0x38')](_0x3acb5c,'id'));}}})['then'](function(){return _0x340b95;});}function buildContactsQuery(_0x23fd11,_0x2d44c4,_0x934bd0,_0x5ee571,_0x1a5f34,_0x9b808f){if(_0x2d44c4){_0x2d44c4=_0x934bd0[_0xbd3e('0x4f')];}_0x23fd11=addFieldsToQuery(_0x23fd11,_0x2d44c4,_0x5ee571,_0x9b808f,!![]);var _0x12ac53=squel[_0xbd3e('0x50')]();_0x12ac53=addFieldsToQuery(_0x12ac53,_0x2d44c4,_0x5ee571,_0x9b808f,![]);if(_0x5ee571||_0x9b808f){_0x23fd11=applyJoinClauses(_0x23fd11,!![]);_0x23fd11[_0xbd3e('0x51')]('c.id');if(_0x934bd0['limit']){_0x12ac53[_0xbd3e('0x52')](_0x934bd0[_0xbd3e('0x52')]);}if(_0x934bd0[_0xbd3e('0x53')]){_0x12ac53[_0xbd3e('0x53')](_0x934bd0[_0xbd3e('0x53')]);}}else{_0x12ac53=applyJoinClauses(_0x12ac53,![]);_0x12ac53[_0xbd3e('0x51')](_0xbd3e('0x54'));if(_0x934bd0[_0xbd3e('0x52')]){_0x23fd11[_0xbd3e('0x52')](_0x934bd0['limit']);}if(_0x934bd0[_0xbd3e('0x53')]){_0x23fd11[_0xbd3e('0x53')](_0x934bd0[_0xbd3e('0x53')]);}}_0x12ac53['having'](_0x1a5f34);if(_0x934bd0[_0xbd3e('0x55')]){_0x934bd0[_0xbd3e('0x55')][_0xbd3e('0x1e')](function(_0x316108){_0x23fd11[_0xbd3e('0x55')]('c.'+_0x316108[0x0],_0x316108[0x1]===_0xbd3e('0x56')?![]:!![]);_0x12ac53[_0xbd3e('0x55')](_0xbd3e('0x57')+_0x316108[0x0],_0x316108[0x1]===_0xbd3e('0x56')?![]:!![]);});}_0x12ac53[_0xbd3e('0x58')](_0x23fd11,_0xbd3e('0x59'));return _0x12ac53;}function getFilteredContacts(_0x7118b6){var _0x42dc0f=[];return db[_0xbd3e('0x37')][_0xbd3e('0x5a')]({'attributes':['id',_0xbd3e('0x2c'),_0xbd3e('0x5b')],'raw':!![]})['then'](function(_0x454c83){_0x42dc0f=_[_0xbd3e('0x5c')](_0x454c83,'id');var _0x50cd13={'type':db[_0xbd3e('0x5d')]['QueryTypes'][_0xbd3e('0x5e')],'model':db[_0xbd3e('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xbd3e('0x60')]['query'](_0x7118b6['toString'](),_0x50cd13);})[_0xbd3e('0x4a')](function(_0x6f0d84){_0x6f0d84[_0xbd3e('0x1e')](function(_0x3f60bc){if(_0x3f60bc['TagIds']){_0x3f60bc[_0xbd3e('0x61')]=[];_0x3f60bc[_0xbd3e('0x19')][_0xbd3e('0x21')](',')[_0xbd3e('0x1e')](function(_0x2eff56){_0x3f60bc[_0xbd3e('0x61')][_0xbd3e('0x44')](_0x42dc0f[_0x2eff56]);});}delete _0x3f60bc['TagIds'];});return _0x6f0d84;});}function countFilteredContacts(_0x14c10e,_0x93348d){var _0x30aa7f=_0x14c10e['clone']();_0x30aa7f[_0xbd3e('0x1a')]('COUNT(*)');_0x30aa7f=applyJoinClauses(_0x30aa7f,!![]);_0x14c10e['group'](_0xbd3e('0x62'));var _0x2b50e0=utils[_0xbd3e('0x1d')](_0x93348d);if(!_[_0xbd3e('0x63')](_0x2b50e0)){_0x30aa7f[_0xbd3e('0xb')](_0xbd3e('0x64'),_0x2b50e0);}var _0x2ac506={'type':db['Sequelize'][_0xbd3e('0x65')][_0xbd3e('0x5e')],'raw':!![]};return db['sequelize'][_0xbd3e('0x66')](_0x30aa7f['toString'](),_0x2ac506)[_0xbd3e('0x4a')](function(_0x5ca029){return _0x5ca029[0x0][_0xbd3e('0x67')];});}module[_0xbd3e('0x68')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x61ab=['true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','cm_user_has_contacts','uc.CmContactId\x20=\x20','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','subqry','firstName','lastName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','includes','push','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','dateOfBirth','fieldType','datetime','DATE','buildExpression','default','text','value','end','Tag','split','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','map','name','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','having','order','subqry.','DESC','color','Sequelize','SELECT','sequelize','query','toString','TagIds','Tags','clone','isEmpty','t.id\x20IN\x20?','QueryTypes','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','role','agent','search','ListId','autocomplete'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x61ab,0xd3));var _0xb61a=function(_0xff9679,_0x25d7b6){_0xff9679=_0xff9679-0x0;var _0x1904d7=_0x61ab[_0xff9679];return _0x1904d7;};'use strict';var _=require(_0xb61a('0x0'));var squel=require(_0xb61a('0x1'));var as=require(_0xb61a('0x2'));var qs=require(_0xb61a('0x3'));var utils=require('../interaction/utils');var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x40febe,_0x4775dd){var _0x542815=![];if(_0x40febe[_0xb61a('0x4')]===_0xb61a('0x5')&&!_0x4775dd[_0xb61a('0x6')]&&!_0x4775dd[_0xb61a('0x7')]&&_0x4775dd[_0xb61a('0x8')]!==_0xb61a('0x9')){_0x542815=!![];}return _0x542815;}function getContactsSubquery(){return squel[_0xb61a('0xa')]()[_0xb61a('0xb')](_0xb61a('0xc'),'c')[_0xb61a('0xd')](_0xb61a('0xe'));}function applyJoinClauses(_0x41a13c,_0x33e857){var _0x4c902c=_0x33e857?'c':'subqry';_0x41a13c['left_join'](_0xb61a('0xf'),'uc',_0xb61a('0x10')+_0x4c902c+'.id')[_0xb61a('0x11')](_0xb61a('0x12'),'ct',_0xb61a('0x13')+_0x4c902c+_0xb61a('0x14'))['left_join'](_0xb61a('0x15'),'t','t.id\x20=\x20ct.TagId');return _0x41a13c;}function addFieldsToQuery(_0x1361f0,_0x27625f,_0x342ff7,_0x3bf63c,_0x142213){var _0x292775=_0x142213?'c':_0xb61a('0x16');if(!_0x27625f){_0x27625f=['id',_0xb61a('0x17'),_0xb61a('0x18'),_0xb61a('0x19'),_0xb61a('0x1a'),_0xb61a('0x1b'),_0xb61a('0x1c'),'ListId',_0xb61a('0x1d'),_0xb61a('0x1e'),_0xb61a('0x1f'),_0xb61a('0x20'),'TagIds'];}else if(!_0x27625f[_0xb61a('0x21')]('id')){_0x27625f[_0xb61a('0x22')]('id');}var _0xf4a167=_0x342ff7&&_0x142213||!_0x342ff7&&!_0x142213;if(_0x3bf63c){_0xf4a167=_0x3bf63c&&_0x142213||!_0x3bf63c&&!_0x142213;}_0x27625f['forEach'](function(_0x345a3c){if(_0x345a3c==='TagIds'){if(_0xf4a167){_0x1361f0[_0xb61a('0x23')](_0xb61a('0x24'),_0x345a3c);}else if(_0x342ff7||_0x3bf63c){_0x1361f0[_0xb61a('0x23')](_0x292775+'.'+_0x345a3c);}}else{_0x1361f0[_0xb61a('0x23')](_0x292775+'.'+_0x345a3c);}});return _0x1361f0;}function getSqlClauses(){var _0x3cbeb2={'default':squel[_0xb61a('0x25')](),'fields':squel[_0xb61a('0x25')](),'filter':squel[_0xb61a('0x25')](),'tags':{'clause':squel[_0xb61a('0x25')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x3cbeb2;}function parseTagParameter(_0x679912){var _0x5c0549=squel['expr']();if(_0x679912){var _0x5df642=utils[_0xb61a('0x26')](_0x679912);_0x5df642[_0xb61a('0x27')](function(_0x3738d9){_0x5c0549['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3738d9+',%');});}return _0x5c0549;}function parseSearchFilter(_0x355786){var _0x4f3d69=squel[_0xb61a('0x25')]();if(_0x355786){var _0x136b2a=_0x355786[_0xb61a('0x28')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x136b2a['split']('\x20')[_0xb61a('0x29')]>0x1){_0x4f3d69['or'](_0xb61a('0x2a'),qs[_0xb61a('0x2b')](_0x136b2a,!![]),null);}else{if(qs[_0xb61a('0x2c')](_0x136b2a)){_0x4f3d69['or'](_0xb61a('0x2d'),_0x136b2a+'%');_0x4f3d69['or'](_0xb61a('0x2e'),_0x136b2a+'%');_0x4f3d69['or'](_0xb61a('0x2f'),_0x136b2a+'%');_0x4f3d69['or'](_0xb61a('0x30'),_0x136b2a+'%');}else if(qs[_0xb61a('0x31')](_0x136b2a)){_0x4f3d69['or']('c.email\x20LIKE\x20?',_0x136b2a+'%');}else{_0x4f3d69['or']('c.firstName\x20LIKE\x20?','%'+_0x136b2a+'%');_0x4f3d69['or'](_0xb61a('0x32'),'%'+_0x136b2a+'%');_0x4f3d69['or']('c.email\x20LIKE\x20?','%'+_0x136b2a+'%');}}}return _0x4f3d69;}function parseAdvancedSearchFilter(_0x58d541,_0x1c2688){var _0x3c7053=getSqlClauses();var _0x555f92=as[_0xb61a('0x33')](_0x58d541);var _0x5a6eb0=_0x555f92['sqlOperator'];for(var _0x4f4da4=0x0;_0x4f4da4<_0x555f92[_0xb61a('0x34')][_0xb61a('0x29')];_0x4f4da4++){var _0x3e5935=_0x555f92[_0xb61a('0x34')][_0x4f4da4];var _0x5f8d26='c';var _0x15e947=_[_0xb61a('0x35')](_0x1c2688,['name',_0x3e5935[_0xb61a('0x23')]]);if(_0x15e947){if(_0x3e5935['field']===_0xb61a('0x36')||_0x15e947[_0xb61a('0x37')]===_0xb61a('0x38')){_0x3e5935['castTo']=_0xb61a('0x39');}var _0x40d415=as[_0xb61a('0x3a')](_0x5f8d26,_0x15e947['type'],_0x3e5935);_0x3c7053[_0xb61a('0x3b')][_0x5a6eb0](_0x40d415[_0xb61a('0x3c')],_0x40d415[_0xb61a('0x3d')]['start'],_0x40d415[_0xb61a('0x3d')][_0xb61a('0x3e')]);}else{if(_0x3e5935[_0xb61a('0x23')]===_0xb61a('0x3f')){var _0x2a13ca=_0x3e5935[_0xb61a('0x3d')][_0xb61a('0x40')](',')['map'](function(_0x245f70){return Number(_0x245f70);});var _0x2fa24c=parseTagParameter(_0x2a13ca);_0x3c7053[_0xb61a('0x41')][_0xb61a('0x42')][_0xb61a('0x43')](_0x2fa24c);_0x3c7053[_0xb61a('0x41')][_0xb61a('0x44')]=_0x2a13ca;}else if(_0x3e5935[_0xb61a('0x23')]===_0xb61a('0x45')){_0x3c7053[_0xb61a('0x46')][_0xb61a('0x42')][_0xb61a('0x43')](_0xb61a('0x47'),_0x3e5935[_0xb61a('0x3d')]);_0x3c7053[_0xb61a('0x46')][_0xb61a('0x48')]=!![];}}}return _0x3c7053;}function parseModelFields(_0x289ee1,_0x355fa9){var _0xcedf86=squel[_0xb61a('0x25')]();var _0x2a1f33=_(_0x289ee1)[_0xb61a('0x49')]()[_0xb61a('0x4a')](function(_0x9336b8){return _['some'](_0x355fa9,[_0xb61a('0x4b'),_0x9336b8])?_0x9336b8:undefined;})[_0xb61a('0x4c')]()[_0xb61a('0x3d')]();if(_0x289ee1[_0xb61a('0x4d')]){_0x2a1f33[_0xb61a('0x22')]('Contact');}if(_0x289ee1[_0xb61a('0x45')]){_0x2a1f33[_0xb61a('0x22')](_0xb61a('0x45'));}if(_0x2a1f33[_0xb61a('0x29')]>0x0){_0x2a1f33[_0xb61a('0x27')](function(_0x3be667){if(_0x3be667===_0xb61a('0x7')){_0xcedf86[_0xb61a('0x43')]('c.ListId\x20IN\x20?',[][_0xb61a('0x4e')](_0x289ee1[_0x3be667]));}else if(_0x3be667==='Contact'){var _0x227e94='%'+_0x289ee1[_0x3be667]+'%';_0xcedf86[_0xb61a('0x43')](_0xb61a('0x4f'),_0x227e94);}else if(_0x3be667===_0xb61a('0x45')){_0xcedf86[_0xb61a('0x43')]('uc.UserId\x20=\x20?',_0x289ee1[_0x3be667]);}else{_0xcedf86[_0xb61a('0x43')]('c.'+_0x3be667+_0xb61a('0x50'),_0x289ee1[_0x3be667]);}});}return _0xcedf86;}function parseQueryParameters(_0x5e22d5,_0xe7a331){var _0x2ffb7d=getSqlClauses();return Promise[_0xb61a('0x51')]()[_0xb61a('0x52')](function(){return parseModelFields(_0x5e22d5,_0xe7a331);})[_0xb61a('0x52')](function(_0x6bef41){_0x2ffb7d[_0xb61a('0x53')][_0xb61a('0x43')](_0x6bef41);return parseTagParameter(_0x5e22d5[_0xb61a('0x54')]);})[_0xb61a('0x52')](function(_0x24f839){_0x2ffb7d['tags']['clause'][_0xb61a('0x43')](_0x24f839);return parseSearchFilter(_0x5e22d5['filter']);})['then'](function(_0x235680){_0x2ffb7d['filter']=_0x235680;return _0x2ffb7d;});}function checkListsRestrictions(_0x66334e,_0x4f23e9,_0x57eaa9){var _0x33b50f=squel[_0xb61a('0x25')]();return Promise['resolve']()['then'](function(){if(_0x4f23e9[_0xb61a('0x6')]&&_0x66334e[_0xb61a('0x4')]===_0xb61a('0x5')&&!_0x57eaa9){return _0x66334e[_0xb61a('0x55')]({'attributes':['id'],'raw':!![]});}})[_0xb61a('0x52')](function(_0x2353b4){if(_0x2353b4){if(_0x2353b4[_0xb61a('0x29')]===0x0){_0x33b50f[_0xb61a('0x43')](_0xb61a('0x56'));}else{_0x33b50f[_0xb61a('0x43')]('c.ListId\x20IN\x20?',_['map'](_0x2353b4,'id'));}}})['then'](function(){return _0x33b50f;});}function buildContactsQuery(_0x204116,_0x4ef22a,_0x27aef3,_0x5bdef8,_0x2394ea,_0x27bf59){if(_0x4ef22a){_0x4ef22a=_0x27aef3[_0xb61a('0x57')];}_0x204116=addFieldsToQuery(_0x204116,_0x4ef22a,_0x5bdef8,_0x27bf59,!![]);var _0x37e0d8=squel[_0xb61a('0xa')]();_0x37e0d8=addFieldsToQuery(_0x37e0d8,_0x4ef22a,_0x5bdef8,_0x27bf59,![]);if(_0x5bdef8||_0x27bf59){_0x204116=applyJoinClauses(_0x204116,!![]);_0x204116[_0xb61a('0x58')](_0xb61a('0x59'));if(_0x27aef3[_0xb61a('0x5a')]){_0x37e0d8[_0xb61a('0x5a')](_0x27aef3[_0xb61a('0x5a')]);}if(_0x27aef3[_0xb61a('0x5b')]){_0x37e0d8[_0xb61a('0x5b')](_0x27aef3[_0xb61a('0x5b')]);}}else{_0x37e0d8=applyJoinClauses(_0x37e0d8,![]);_0x37e0d8[_0xb61a('0x58')]('subqry.id');if(_0x27aef3[_0xb61a('0x5a')]){_0x204116[_0xb61a('0x5a')](_0x27aef3[_0xb61a('0x5a')]);}if(_0x27aef3[_0xb61a('0x5b')]){_0x204116[_0xb61a('0x5b')](_0x27aef3[_0xb61a('0x5b')]);}}_0x37e0d8[_0xb61a('0x5c')](_0x2394ea);if(_0x27aef3[_0xb61a('0x5d')]){_0x27aef3[_0xb61a('0x5d')][_0xb61a('0x27')](function(_0x18b105){_0x204116[_0xb61a('0x5d')]('c.'+_0x18b105[0x0],_0x18b105[0x1]==='DESC'?![]:!![]);_0x37e0d8[_0xb61a('0x5d')](_0xb61a('0x5e')+_0x18b105[0x0],_0x18b105[0x1]===_0xb61a('0x5f')?![]:!![]);});}_0x37e0d8[_0xb61a('0xb')](_0x204116,_0xb61a('0x16'));return _0x37e0d8;}function getFilteredContacts(_0xd26fb9){var _0x31b51a=[];return db['Tag']['findAll']({'attributes':['id',_0xb61a('0x4b'),_0xb61a('0x60')],'raw':!![]})[_0xb61a('0x52')](function(_0x46876e){_0x31b51a=_['keyBy'](_0x46876e,'id');var _0x8c3ab4={'type':db[_0xb61a('0x61')]['QueryTypes'][_0xb61a('0x62')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb61a('0x63')][_0xb61a('0x64')](_0xd26fb9[_0xb61a('0x65')](),_0x8c3ab4);})[_0xb61a('0x52')](function(_0x52023d){_0x52023d[_0xb61a('0x27')](function(_0x55e485){if(_0x55e485[_0xb61a('0x66')]){_0x55e485[_0xb61a('0x67')]=[];_0x55e485['TagIds'][_0xb61a('0x40')](',')[_0xb61a('0x27')](function(_0x211e18){_0x55e485[_0xb61a('0x67')][_0xb61a('0x22')](_0x31b51a[_0x211e18]);});}delete _0x55e485[_0xb61a('0x66')];});return _0x52023d;});}function countFilteredContacts(_0x5ab962,_0x3d6c89){var _0xaceb51=_0x5ab962[_0xb61a('0x68')]();_0xaceb51[_0xb61a('0x23')]('COUNT(*)');_0xaceb51=applyJoinClauses(_0xaceb51,!![]);_0x5ab962['group']('c.id');var _0x304ec1=utils[_0xb61a('0x26')](_0x3d6c89);if(!_[_0xb61a('0x69')](_0x304ec1)){_0xaceb51[_0xb61a('0xd')](_0xb61a('0x6a'),_0x304ec1);}var _0x2a225e={'type':db[_0xb61a('0x61')][_0xb61a('0x6b')][_0xb61a('0x62')],'raw':!![]};return db[_0xb61a('0x63')][_0xb61a('0x64')](_0xaceb51[_0xb61a('0x65')](),_0x2a225e)[_0xb61a('0x52')](function(_0x1b4556){return _0x1b4556[0x0][_0xb61a('0x6c')];});}module[_0xb61a('0x6d')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 04fc569..18123e9 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 _0x5fbe=['createWriteStream','createCipher','data','update','binary','write','final','end','close','unlink','decryptFile','createDecipher','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream'];(function(_0xc56e4c,_0x320e2b){var _0xcbfc0a=function(_0x2ab00b){while(--_0x2ab00b){_0xc56e4c['push'](_0xc56e4c['shift']());}};_0xcbfc0a(++_0x320e2b);}(_0x5fbe,0x76));var _0xe5fb=function(_0x563799,_0x30abd4){_0x563799=_0x563799-0x0;var _0x3a5568=_0x5fbe[_0x563799];return _0x3a5568;};'use strict';var crypto=require(_0xe5fb('0x0'));var fs=require('fs');var BPromise=require(_0xe5fb('0x1'));var _=require(_0xe5fb('0x2'));var config=require(_0xe5fb('0x3'));var logger=require(_0xe5fb('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe5fb('0x5')][_0xe5fb('0x6')],'algorithm':_0xe5fb('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0xe5fb('0x8')]&&config[_0xe5fb('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xe5fb('0x8')]['algorithm']);if(isSupported){fileOptions[_0xe5fb('0x9')]=config['encrypt'][_0xe5fb('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xe5fb('0xa')](config[_0xe5fb('0x8')]['algorithm'],_0xe5fb('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x19cc3c){return AES_SUPPORTED_RX[_0xe5fb('0xc')](_0x19cc3c);}function getSupportedCiphers(){return crypto[_0xe5fb('0xd')]()[_0xe5fb('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x20c419){return getSupportedCiphers()[_0xe5fb('0xf')](_0x20c419)>-0x1;}function combineOptions(_0x2c839f){var _0x1baa40={};for(var _0x24d6e4 in fileOptions){if(fileOptions[_0xe5fb('0x10')](_0x24d6e4)){_0x1baa40[_0x24d6e4]=fileOptions[_0x24d6e4];}}if(_0x2c839f){for(var _0x15c0c5 in _0x2c839f){if(_0x2c839f[_0xe5fb('0x10')](_0x15c0c5)){_0x1baa40[_0x15c0c5]=_0x2c839f[_0x15c0c5];}}}return _0x1baa40;}exports['encryptFile']=function(_0x88ad9f,_0x21e170,_0x50f0a7,_0x57a5e5){return new BPromise(function(_0x4ebd8c,_0x54bd8d){_0x57a5e5=combineOptions(_0x57a5e5);var _0x556176=new Buffer(_0x50f0a7);var _0x250f19=fs[_0xe5fb('0x11')](_0x88ad9f);var _0x59fa84=fs[_0xe5fb('0x12')](_0x21e170);var _0x2dfefa=crypto[_0xe5fb('0x13')](_0x57a5e5[_0xe5fb('0x9')],_0x556176);_0x250f19['on'](_0xe5fb('0x14'),function(_0x199c53){var _0x3d53ea=new Buffer(_0x2dfefa[_0xe5fb('0x15')](_0x199c53),_0xe5fb('0x16'));_0x59fa84[_0xe5fb('0x17')](_0x3d53ea);});_0x250f19['on']('end',function(){try{var _0x407e80=new Buffer(_0x2dfefa[_0xe5fb('0x18')](_0xe5fb('0x16')),_0xe5fb('0x16'));_0x59fa84[_0xe5fb('0x17')](_0x407e80);_0x59fa84[_0xe5fb('0x19')]();_0x59fa84['on'](_0xe5fb('0x1a'),function(){return _0x4ebd8c(_0x21e170);});}catch(_0xf2bb12){fs[_0xe5fb('0x1b')](_0x21e170);return _0x54bd8d(_0xf2bb12);}});});};exports[_0xe5fb('0x1c')]=function(_0x5049c5,_0x54079e,_0x56fcb0,_0x477430){return new BPromise(function(_0x37884f,_0x4ca905){_0x477430=combineOptions(_0x477430);var _0x23a7d7=new Buffer(_0x56fcb0);var _0x584f36=fs[_0xe5fb('0x11')](_0x5049c5);var _0x59d219=fs['createWriteStream'](_0x54079e);var _0x22f99f=crypto[_0xe5fb('0x1d')](_0x477430[_0xe5fb('0x9')],_0x23a7d7);_0x584f36['on'](_0xe5fb('0x14'),function(_0x28895c){var _0x511f6b=new Buffer(_0x22f99f[_0xe5fb('0x15')](_0x28895c),_0xe5fb('0x16'));_0x59d219[_0xe5fb('0x17')](_0x511f6b);});_0x584f36['on'](_0xe5fb('0x19'),function(){try{var _0x161c1d=new Buffer(_0x22f99f[_0xe5fb('0x18')]('binary'),'binary');_0x59d219['write'](_0x161c1d);_0x59d219[_0xe5fb('0x19')]();_0x59d219['on']('close',function(){return _0x37884f(_0x54079e);});}catch(_0x1fd8e1){fs[_0xe5fb('0x1b')](_0x54079e);return _0x4ca905(_0x1fd8e1);}});});};exports['encryptString']=function(_0x1b347d,_0x29ca2c,_0x4f3808){var _0x2336ec=_0x4f3808||stringOptions[_0xe5fb('0x9')];var _0x149a9f=_0x29ca2c||stringOptions[_0xe5fb('0x1e')];var _0x375da9=crypto[_0xe5fb('0x13')](_0x2336ec,_0x149a9f);var _0x54fbb1=_0x375da9[_0xe5fb('0x15')](_0x1b347d,_0xe5fb('0x1f'),_0xe5fb('0x20'));_0x54fbb1+=_0x375da9[_0xe5fb('0x18')]('base64');return _0x54fbb1;};exports[_0xe5fb('0x21')]=function(_0x3d4ce8,_0x196f34,_0x14592f){var _0x5e3bfc=_0x14592f||stringOptions['algorithm'];var _0x1d95e0=_0x196f34||stringOptions[_0xe5fb('0x1e')];var _0x352a06=crypto['createDecipher'](_0x5e3bfc,_0x1d95e0);var _0x27a856=_0x352a06[_0xe5fb('0x15')](_0x3d4ce8,_0xe5fb('0x20'),_0xe5fb('0x1f'));_0x27a856+=_0x352a06[_0xe5fb('0x18')](_0xe5fb('0x1f'));return _0x27a856;}; \ No newline at end of file +var _0xcd19=['binary','end','final','write','close','unlink','decryptFile','createDecipher','secret','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update'];(function(_0x209ff5,_0x542f40){var _0x13398e=function(_0x403964){while(--_0x403964){_0x209ff5['push'](_0x209ff5['shift']());}};_0x13398e(++_0x542f40);}(_0xcd19,0x6f));var _0x9cd1=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0xcd19[_0x1d2bc8];return _0x1857e1;};'use strict';var crypto=require(_0x9cd1('0x0'));var fs=require('fs');var BPromise=require(_0x9cd1('0x1'));var _=require(_0x9cd1('0x2'));var config=require(_0x9cd1('0x3'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x9cd1('0x4')][_0x9cd1('0x5')],'algorithm':_0x9cd1('0x6')};const fileOptions={'algorithm':_0x9cd1('0x7')};if(config[_0x9cd1('0x8')]&&config['encrypt'][_0x9cd1('0x9')]){var isSupported=isAlgorithmSupported(config[_0x9cd1('0x8')][_0x9cd1('0x9')]);if(isSupported){fileOptions[_0x9cd1('0x9')]=config[_0x9cd1('0x8')][_0x9cd1('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x9cd1('0xa')](',\x20');logger[_0x9cd1('0xb')](config[_0x9cd1('0x8')][_0x9cd1('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2375b0){return AES_SUPPORTED_RX[_0x9cd1('0xc')](_0x2375b0);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xca778){return getSupportedCiphers()[_0x9cd1('0xd')](_0xca778)>-0x1;}function combineOptions(_0x10a158){var _0x53090c={};for(var _0x387b39 in fileOptions){if(fileOptions[_0x9cd1('0xe')](_0x387b39)){_0x53090c[_0x387b39]=fileOptions[_0x387b39];}}if(_0x10a158){for(var _0x1f7e73 in _0x10a158){if(_0x10a158[_0x9cd1('0xe')](_0x1f7e73)){_0x53090c[_0x1f7e73]=_0x10a158[_0x1f7e73];}}}return _0x53090c;}exports[_0x9cd1('0xf')]=function(_0x23edbe,_0x5c0b56,_0x13b043,_0x28f179){return new BPromise(function(_0x447d5c,_0x5f27b2){_0x28f179=combineOptions(_0x28f179);var _0x5ef50e=new Buffer(_0x13b043);var _0x216d3e=fs[_0x9cd1('0x10')](_0x23edbe);var _0x297975=fs[_0x9cd1('0x11')](_0x5c0b56);var _0x244d61=crypto[_0x9cd1('0x12')](_0x28f179[_0x9cd1('0x9')],_0x5ef50e);_0x216d3e['on'](_0x9cd1('0x13'),function(_0x16adde){var _0x45400=new Buffer(_0x244d61[_0x9cd1('0x14')](_0x16adde),_0x9cd1('0x15'));_0x297975['write'](_0x45400);});_0x216d3e['on'](_0x9cd1('0x16'),function(){try{var _0xe43aca=new Buffer(_0x244d61[_0x9cd1('0x17')](_0x9cd1('0x15')),_0x9cd1('0x15'));_0x297975[_0x9cd1('0x18')](_0xe43aca);_0x297975['end']();_0x297975['on'](_0x9cd1('0x19'),function(){return _0x447d5c(_0x5c0b56);});}catch(_0x1ab846){fs[_0x9cd1('0x1a')](_0x5c0b56);return _0x5f27b2(_0x1ab846);}});});};exports[_0x9cd1('0x1b')]=function(_0x37bc04,_0x2fe573,_0x4767c5,_0x3d3bf2){return new BPromise(function(_0xd6f0a6,_0x6adb2){_0x3d3bf2=combineOptions(_0x3d3bf2);var _0x3e7c0e=new Buffer(_0x4767c5);var _0xb1d633=fs[_0x9cd1('0x10')](_0x37bc04);var _0x2e68a2=fs[_0x9cd1('0x11')](_0x2fe573);var _0x3ed265=crypto[_0x9cd1('0x1c')](_0x3d3bf2[_0x9cd1('0x9')],_0x3e7c0e);_0xb1d633['on']('data',function(_0x2eac81){var _0x3fccc6=new Buffer(_0x3ed265[_0x9cd1('0x14')](_0x2eac81),_0x9cd1('0x15'));_0x2e68a2[_0x9cd1('0x18')](_0x3fccc6);});_0xb1d633['on'](_0x9cd1('0x16'),function(){try{var _0x45ed13=new Buffer(_0x3ed265[_0x9cd1('0x17')](_0x9cd1('0x15')),_0x9cd1('0x15'));_0x2e68a2[_0x9cd1('0x18')](_0x45ed13);_0x2e68a2[_0x9cd1('0x16')]();_0x2e68a2['on']('close',function(){return _0xd6f0a6(_0x2fe573);});}catch(_0x37cc70){fs[_0x9cd1('0x1a')](_0x2fe573);return _0x6adb2(_0x37cc70);}});});};exports['encryptString']=function(_0x515c2d,_0x12b585,_0x3799e3){var _0x597f03=_0x3799e3||stringOptions[_0x9cd1('0x9')];var _0x3bae55=_0x12b585||stringOptions[_0x9cd1('0x1d')];var _0x55b421=crypto[_0x9cd1('0x12')](_0x597f03,_0x3bae55);var _0x317869=_0x55b421[_0x9cd1('0x14')](_0x515c2d,'utf8','base64');_0x317869+=_0x55b421[_0x9cd1('0x17')](_0x9cd1('0x1e'));return _0x317869;};exports[_0x9cd1('0x1f')]=function(_0x1f7569,_0x47f502,_0x575797){var _0x91f8a2=_0x575797||stringOptions[_0x9cd1('0x9')];var _0x614b72=_0x47f502||stringOptions[_0x9cd1('0x1d')];var _0x1d8cc4=crypto[_0x9cd1('0x1c')](_0x91f8a2,_0x614b72);var _0x2d8099=_0x1d8cc4[_0x9cd1('0x14')](_0x1f7569,_0x9cd1('0x1e'),_0x9cd1('0x20'));_0x2d8099+=_0x1d8cc4[_0x9cd1('0x17')](_0x9cd1('0x20'));return _0x2d8099;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 033a985..d6986bd 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 _0xb043=['lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path'];(function(_0x3b882a,_0x270169){var _0x56612e=function(_0x15d596){while(--_0x15d596){_0x3b882a['push'](_0x3b882a['shift']());}};_0x56612e(++_0x270169);}(_0xb043,0xce));var _0x3b04=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0xb043[_0x264b9b];return _0x4c7a0e;};'use strict';var util=require(_0x3b04('0x0'));var path=require(_0x3b04('0x1'));var _=require(_0x3b04('0x2'));var csv=require(_0x3b04('0x3'));var fs=require('fs');var BPromise=require(_0x3b04('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x3b04('0x5'));var db=require(_0x3b04('0x6'))['db'];var dbH=require(_0x3b04('0x6'))[_0x3b04('0x7')];var logger=require(_0x3b04('0x8'))(_0x3b04('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3b04('0xa')][0x3];var PATH=process[_0x3b04('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4972f9,_0x15cd14){var _0x1cd696={'status':_0x4972f9};var _0x30e319={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15cd14){_0x1cd696[_0x3b04('0xb')]=_0x15cd14;}return db[_0x3b04('0xc')][_0x3b04('0xd')](_0x1cd696,_0x30e319);}function main(){var _0x5d87e3=0x1388;var _0x41ac2b;logger[_0x3b04('0xe')](util[_0x3b04('0xf')](_0x3b04('0x10'),EXTRACTED_REPORT_ID,_0x3b04('0x11')));return db[_0x3b04('0x12')][_0x3b04('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3b04('0x14'),_0x3b04('0x15')]})[_0x3b04('0x16')](function(_0x24bdee){if(_0x24bdee){_0x41ac2b=_0x24bdee;_0x5d87e3=_0x41ac2b[_0x3b04('0x15')]||0x1388;}})[_0x3b04('0x16')](function(){return dbH[_0x3b04('0x17')][_0x3b04('0x18')](util[_0x3b04('0xf')](_0x3b04('0x19'),QUERY),{'type':dbH[_0x3b04('0x17')][_0x3b04('0x1a')][_0x3b04('0x1b')]});})[_0x3b04('0x16')](function(_0x4cb765){if(!_0x4cb765[0x0]['num']){return analyticExtractedReport('Empty');}var _0x3c24e=[];var _0x3607f0=0x0;if(_0x41ac2b['split']){if(_0x4cb765&&_0x4cb765[_0x3b04('0x1c')]){var _0x2b1733=_[_0x3b04('0x1d')](_0x4cb765[0x0][_0x3b04('0x1e')]/_0x5d87e3);var _0x6a7d4b=Number[_0x3b04('0x1f')](_0x4cb765[0x0][_0x3b04('0x1e')]/_0x5d87e3)?_0x4cb765[0x0]['num']%_0x5d87e3:0x0;_0x2b1733[_0x3b04('0x20')](function(_0x4c6b49){if(_0x4c6b49>0x0){_0x3607f0+=_0x5d87e3;}_0x3c24e[_0x3b04('0x21')](dbH[_0x3b04('0x17')]['query'](util[_0x3b04('0xf')](_0x3b04('0x22'),QUERY,_0x5d87e3,_0x3607f0),{'type':dbH[_0x3b04('0x17')][_0x3b04('0x1a')][_0x3b04('0x1b')]}));});if(_0x6a7d4b>0x0){_0x3607f0+=_0x5d87e3;_0x3c24e['push'](dbH['sequelize'][_0x3b04('0x18')](util[_0x3b04('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x6a7d4b,_0x3607f0),{'type':dbH['sequelize'][_0x3b04('0x1a')][_0x3b04('0x1b')]}));}}}else{_0x3c24e['push'](dbH[_0x3b04('0x17')]['query'](QUERY,{'type':dbH[_0x3b04('0x17')][_0x3b04('0x1a')][_0x3b04('0x1b')]}));}var _0x3df932=path[_0x3b04('0x23')](PATH);var _0x11598b=path[_0x3b04('0x24')](PATH,_0x3b04('0x25'));var _0xb36a68=_0x41ac2b[_0x3b04('0x14')]&&_0x3c24e[_0x3b04('0x1c')]>0x1;var _0x2befcd=[];if(!fs['existsSync'](path[_0x3b04('0x26')](_0x3df932,_0x11598b))&&_0xb36a68){fs['mkdirSync'](path[_0x3b04('0x26')](_0x3df932,_0x11598b));}return BPromise[_0x3b04('0x27')](_0x3c24e,function(_0x2ace94){_0x2befcd['push'](_0x2ace94);})[_0x3b04('0x16')](function(){for(var _0x32bb59=0x0;_0x32bb59<_0x2befcd[_0x3b04('0x1c')];_0x32bb59+=0x1){var _0x4cb63f;var _0x536cc5=_0x2befcd[_0x32bb59];if(_0xb36a68){_0x4cb63f=path[_0x3b04('0x26')](_0x3df932,_0x11598b,util[_0x3b04('0xf')](_0x3b04('0x28'),_0x11598b,_0x32bb59,_0x3b04('0x29')));}else{_0x4cb63f=path[_0x3b04('0x26')](_0x3df932,util['format'](_0x3b04('0x2a'),_0x11598b,_0x3b04('0x29')));}fs[_0x3b04('0x2b')](_0x4cb63f,csv(_0x536cc5));}})[_0x3b04('0x16')](function(){if(_0xb36a68){return new Promise(function(_0x49d12c){zipdir(path[_0x3b04('0x26')](_0x3df932,_0x11598b),{'saveTo':path[_0x3b04('0x26')](_0x3df932,util[_0x3b04('0xf')]('%s.%s',_0x11598b,_0x3b04('0x2c')))},function(_0x4ef4fe,_0x5712d8){rimraf(path['join'](_0x3df932,_0x11598b),function(){});_0x49d12c(_0x3b04('0x2d'));});});}})[_0x3b04('0x16')](function(){logger[_0x3b04('0xe')](util['format'](_0x3b04('0x2e'),EXTRACTED_REPORT_ID,_0x3b04('0x11')));return analyticExtractedReport(_0x3b04('0x2f'),_0xb36a68?util[_0x3b04('0xf')](_0x3b04('0x2a'),_0x11598b,_0xb36a68?_0x3b04('0x2c'):_0x3b04('0x29')):null);});})['catch'](function(_0x3ad374){logger[_0x3b04('0xe')](util[_0x3b04('0xf')](_0x3b04('0x30'),EXTRACTED_REPORT_ID,_0x3b04('0x11')),util[_0x3b04('0x31')](_0x3ad374,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x3b04('0x32')](function(){process[_0x3b04('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0a4f=['../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','inspect','Failed','exit','util','path','lodash','bluebird','rimraf','../../mysqldb'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0x0a4f,0xef));var _0xf0a4=function(_0x553f4b,_0x48c94e){_0x553f4b=_0x553f4b-0x0;var _0x329299=_0x0a4f[_0x553f4b];return _0x329299;};'use strict';var util=require(_0xf0a4('0x0'));var path=require(_0xf0a4('0x1'));var _=require(_0xf0a4('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xf0a4('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xf0a4('0x4'));var db=require(_0xf0a4('0x5'))['db'];var dbH=require(_0xf0a4('0x5'))['dbH'];var logger=require(_0xf0a4('0x6'))(_0xf0a4('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xf0a4('0x8')][0x2]);var QUERY=process[_0xf0a4('0x8')][0x3];var PATH=process[_0xf0a4('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x574752,_0x4e7ebb){var _0x354937={'status':_0x574752};var _0x3e0652={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e7ebb){_0x354937[_0xf0a4('0x9')]=_0x4e7ebb;}return db['AnalyticExtractedReport'][_0xf0a4('0xa')](_0x354937,_0x3e0652);}function main(){var _0x432be9=0x1388;var _0x530888;logger[_0xf0a4('0xb')](util[_0xf0a4('0xc')](_0xf0a4('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xf0a4('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf0a4('0xf'),_0xf0a4('0x10')]})['then'](function(_0x566de4){if(_0x566de4){_0x530888=_0x566de4;_0x432be9=_0x530888[_0xf0a4('0x10')]||0x1388;}})[_0xf0a4('0x11')](function(){return dbH[_0xf0a4('0x12')][_0xf0a4('0x13')](util['format'](_0xf0a4('0x14'),QUERY),{'type':dbH[_0xf0a4('0x12')][_0xf0a4('0x15')]['SELECT']});})['then'](function(_0x4deb8d){if(!_0x4deb8d[0x0][_0xf0a4('0x16')]){return analyticExtractedReport('Empty');}var _0x2b37f1=[];var _0x34ad6b=0x0;if(_0x530888[_0xf0a4('0xf')]){if(_0x4deb8d&&_0x4deb8d[_0xf0a4('0x17')]){var _0x23791f=_['range'](_0x4deb8d[0x0][_0xf0a4('0x16')]/_0x432be9);var _0x14ca6c=Number[_0xf0a4('0x18')](_0x4deb8d[0x0][_0xf0a4('0x16')]/_0x432be9)?_0x4deb8d[0x0][_0xf0a4('0x16')]%_0x432be9:0x0;_0x23791f[_0xf0a4('0x19')](function(_0x1793a1){if(_0x1793a1>0x0){_0x34ad6b+=_0x432be9;}_0x2b37f1[_0xf0a4('0x1a')](dbH[_0xf0a4('0x12')]['query'](util[_0xf0a4('0xc')](_0xf0a4('0x1b'),QUERY,_0x432be9,_0x34ad6b),{'type':dbH[_0xf0a4('0x12')][_0xf0a4('0x15')][_0xf0a4('0x1c')]}));});if(_0x14ca6c>0x0){_0x34ad6b+=_0x432be9;_0x2b37f1[_0xf0a4('0x1a')](dbH[_0xf0a4('0x12')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14ca6c,_0x34ad6b),{'type':dbH[_0xf0a4('0x12')]['QueryTypes'][_0xf0a4('0x1c')]}));}}}else{_0x2b37f1[_0xf0a4('0x1a')](dbH[_0xf0a4('0x12')][_0xf0a4('0x13')](QUERY,{'type':dbH[_0xf0a4('0x12')][_0xf0a4('0x15')][_0xf0a4('0x1c')]}));}var _0x4acff3=path[_0xf0a4('0x1d')](PATH);var _0x19d069=path[_0xf0a4('0x1e')](PATH,_0xf0a4('0x1f'));var _0x5d451c=_0x530888[_0xf0a4('0xf')]&&_0x2b37f1[_0xf0a4('0x17')]>0x1;var _0x15d73d=[];if(!fs[_0xf0a4('0x20')](path[_0xf0a4('0x21')](_0x4acff3,_0x19d069))&&_0x5d451c){fs[_0xf0a4('0x22')](path[_0xf0a4('0x21')](_0x4acff3,_0x19d069));}return BPromise[_0xf0a4('0x23')](_0x2b37f1,function(_0x3beb6c){_0x15d73d[_0xf0a4('0x1a')](_0x3beb6c);})[_0xf0a4('0x11')](function(){for(var _0x9ec98a=0x0;_0x9ec98a<_0x15d73d['length'];_0x9ec98a+=0x1){var _0xaad16e;var _0x49c933=_0x15d73d[_0x9ec98a];if(_0x5d451c){_0xaad16e=path['join'](_0x4acff3,_0x19d069,util[_0xf0a4('0xc')](_0xf0a4('0x24'),_0x19d069,_0x9ec98a,_0xf0a4('0x25')));}else{_0xaad16e=path[_0xf0a4('0x21')](_0x4acff3,util[_0xf0a4('0xc')](_0xf0a4('0x26'),_0x19d069,_0xf0a4('0x25')));}fs[_0xf0a4('0x27')](_0xaad16e,csv(_0x49c933));}})[_0xf0a4('0x11')](function(){if(_0x5d451c){return new Promise(function(_0x10e1e3){zipdir(path[_0xf0a4('0x21')](_0x4acff3,_0x19d069),{'saveTo':path[_0xf0a4('0x21')](_0x4acff3,util['format'](_0xf0a4('0x26'),_0x19d069,_0xf0a4('0x28')))},function(_0x4d9ac1,_0x1e7e08){rimraf(path['join'](_0x4acff3,_0x19d069),function(){});_0x10e1e3(_0xf0a4('0x29'));});});}})[_0xf0a4('0x11')](function(){logger[_0xf0a4('0xb')](util[_0xf0a4('0xc')](_0xf0a4('0x2a'),EXTRACTED_REPORT_ID,_0xf0a4('0x2b')));return analyticExtractedReport(_0xf0a4('0x2c'),_0x5d451c?util[_0xf0a4('0xc')](_0xf0a4('0x26'),_0x19d069,_0x5d451c?'zip':'csv'):null);});})[_0xf0a4('0x2d')](function(_0x226880){logger[_0xf0a4('0xb')](util[_0xf0a4('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf0a4('0x2b')),util[_0xf0a4('0x2e')](_0x226880,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf0a4('0x2f'));})['finally'](function(){process[_0xf0a4('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d12886f..0dd7875 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 _0xa688=['join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','toString','fill','length','auto','body','push','concat','keys','format','name','endDate','header','before','margin','landscape','Arial','black','right','num','Setting','find','split','splitSizePdf','then','range','isInteger','forEach','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','dirname','basename','existsSync'];(function(_0x1a1174,_0x2691eb){var _0x168e02=function(_0x5c2a97){while(--_0x5c2a97){_0x1a1174['push'](_0x1a1174['shift']());}};_0x168e02(++_0x2691eb);}(_0xa688,0x191));var _0x8a68=function(_0x3d8812,_0x24b648){_0x3d8812=_0x3d8812-0x0;var _0x3aa4ee=_0xa688[_0x3d8812];return _0x3aa4ee;};'use strict';var _=require(_0x8a68('0x0'));var fs=require('fs');var util=require(_0x8a68('0x1'));var path=require(_0x8a68('0x2'));var moment=require(_0x8a68('0x3'));var htmlToPdfmake=require(_0x8a68('0x4'));var PdfPrinter=require(_0x8a68('0x5'));var zipdir=require(_0x8a68('0x6'));var rimraf=require(_0x8a68('0x7'));var JSDOM=require(_0x8a68('0x8'))[_0x8a68('0x9')];var window=new JSDOM('')[_0x8a68('0xa')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0x8a68('0xb'))['dbH'];var logger=require(_0x8a68('0xc'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8a68('0xd')][0x2]);var QUERY=process[_0x8a68('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x8a68('0xd')][0x5];var FORMAT=_0x8a68('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xf1284c,_0x1e0294){var _0x4048ba={'status':_0xf1284c};var _0x5d19fc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1e0294){_0x4048ba[_0x8a68('0xf')]=_0x1e0294;}return db[_0x8a68('0x10')][_0x8a68('0x11')](_0x4048ba,_0x5d19fc);}function getHeaders(_0x276f12){return _['map'](_0x276f12,function(_0x592ea8){return{'text':_0x592ea8,'style':'tableHeader'};});}function getRows(_0x4b7b02,_0x1ad662){return _[_0x8a68('0x12')](_0x1ad662,function(_0x2cbcb6){return _(_0x2cbcb6)['pick'](_0x4b7b02)[_0x8a68('0x12')](function(_0x56aa36){return _0x56aa36?_[_0x8a68('0x13')](_0x56aa36):'';})['value']();});}function createTable(_0x4a69e5,_0x59854c){var _0x4ddd6e={'widths':_[_0x8a68('0x14')](Array(_0x4a69e5[_0x8a68('0x15')]),0x91),'heights':function(_0x4d8536){return _0x4d8536===0x0?_0x8a68('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x9d9fb7=getHeaders(_0x4a69e5);_0x4ddd6e[_0x8a68('0x17')][_0x8a68('0x18')](_0x9d9fb7);var _0x1c112e=getRows(_0x4a69e5,_0x59854c);_0x4ddd6e['body']=_0x4ddd6e[_0x8a68('0x17')][_0x8a68('0x19')](_0x1c112e);return _0x4ddd6e;}function createTables(_0x2030f6){var _0x5b2e9d=[];var _0x2b373a=_['chunk'](Object[_0x8a68('0x1a')](_0x2030f6[0x0]),0x5);_0x2b373a['forEach'](function(_0x45acd2){_0x5b2e9d['push'](createTable(_0x45acd2,_0x2030f6));});return _0x5b2e9d;}function getPDFDocDefinition(_0x58b55d){var _0x5a3b88=util[_0x8a68('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x8a68('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0x8a68('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x8a68('0x1d')])[_0x8a68('0x1b')](FORMAT));var _0x2988af=[];for(var _0x5034a4=0x0;_0x5034a4<_0x58b55d[_0x8a68('0x15')];_0x5034a4++){var _0x24b790=[];if(_0x5034a4===0x0){_0x24b790[_0x8a68('0x18')]({'text':_0x5a3b88,'style':_0x8a68('0x1e')});}var _0x5c5410={'table':_0x58b55d[_0x5034a4]};if(_0x5034a4>0x0){_0x5c5410['pageBreak']=_0x8a68('0x1f');_0x5c5410[_0x8a68('0x20')]=[0x0,0x46,0x0,0x0];}_0x24b790[_0x8a68('0x18')](_0x5c5410);_0x2988af[_0x8a68('0x18')](_0x24b790);}return{'pageSize':'A4','pageOrientation':_0x8a68('0x21'),'content':_0x2988af,'footer':function(_0x4389ec,_0x4d8d23){return{'text':_0x4389ec[_0x8a68('0x13')]()+'\x20/\x20'+_0x4d8d23,'style':'footer'};},'defaultStyle':{'font':_0x8a68('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8a68('0x23')},'footer':{'alignment':_0x8a68('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x573c1b){var _0x3a0ac4=0x1388;var _0x2302b4;if(!_0x573c1b[0x0][_0x8a68('0x25')]){return analyticExtractedReport('Empty');}return db[_0x8a68('0x26')][_0x8a68('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8a68('0x28'),_0x8a68('0x29')]})[_0x8a68('0x2a')](function(_0x41dc3e){if(_0x41dc3e){_0x2302b4=_0x41dc3e;_0x3a0ac4=_0x2302b4[_0x8a68('0x29')]||0x3e8;}})[_0x8a68('0x2a')](function(){var _0x5d1929=[];var _0x523409=0x0;if(_0x2302b4[_0x8a68('0x28')]){if(_0x573c1b&&_0x573c1b[_0x8a68('0x15')]){var _0x2260f8=_[_0x8a68('0x2b')](_0x573c1b[0x0]['num']/_0x3a0ac4);var _0x43994e=Number[_0x8a68('0x2c')](_0x573c1b[0x0][_0x8a68('0x25')]/_0x3a0ac4)?_0x573c1b[0x0][_0x8a68('0x25')]%_0x3a0ac4:0x0;_0x2260f8[_0x8a68('0x2d')](function(_0x3948a0){if(_0x3948a0>0x0){_0x523409+=_0x3a0ac4;}_0x5d1929[_0x8a68('0x18')](dbH['sequelize'][_0x8a68('0x2e')](util[_0x8a68('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3a0ac4,_0x523409),{'type':dbH['sequelize'][_0x8a68('0x2f')][_0x8a68('0x30')]}));});if(_0x43994e>0x0){_0x523409+=_0x3a0ac4;_0x5d1929[_0x8a68('0x18')](dbH['sequelize']['query'](util[_0x8a68('0x1b')](_0x8a68('0x31'),QUERY,_0x43994e,_0x523409),{'type':dbH[_0x8a68('0x32')][_0x8a68('0x2f')][_0x8a68('0x30')]}));}}}else{_0x5d1929['push'](dbH['sequelize'][_0x8a68('0x2e')](QUERY,{'type':dbH[_0x8a68('0x32')]['QueryTypes'][_0x8a68('0x30')]}));}var _0xcfcbd2=path[_0x8a68('0x33')](PATH);var _0x3b3dc4=path[_0x8a68('0x34')](PATH,'.pdf');var _0x1a3a3d=_0x2302b4[_0x8a68('0x28')]&&_0x5d1929[_0x8a68('0x15')]>0x1;var _0x128c2b=[];if(!fs[_0x8a68('0x35')](path[_0x8a68('0x36')](_0xcfcbd2,_0x3b3dc4))&&_0x1a3a3d){fs[_0x8a68('0x37')](path['join'](_0xcfcbd2,_0x3b3dc4));}return BPromise[_0x8a68('0x38')](_0x5d1929,function(_0xfca4eb){_0x128c2b[_0x8a68('0x18')](_0xfca4eb);})[_0x8a68('0x2a')](function(){var _0x3ccc24=[];for(var _0x1ee328=0x0;_0x1ee328<_0x128c2b[_0x8a68('0x15')];_0x1ee328+=0x1){var _0x47f735=_0x128c2b[_0x1ee328];var _0x5302e8=createTables(_[_0x8a68('0x39')](_0x47f735));var _0x4a1091;var _0x1144e0=getPDFDocDefinition(_0x5302e8);var _0x1ff5ae=getPDFPrinter();var _0x2e9e09=_0x1ff5ae[_0x8a68('0x3a')](_0x1144e0);if(_0x1a3a3d){_0x4a1091=path['join'](_0xcfcbd2,_0x3b3dc4,util[_0x8a68('0x1b')]('%s%d.%s',_0x3b3dc4,_0x1ee328,_0x8a68('0x3b')));}else{_0x4a1091=path[_0x8a68('0x36')](_0xcfcbd2,util['format'](_0x8a68('0x3c'),_0x3b3dc4,_0x8a68('0x3b')));}_0x3ccc24['push'](writePDFDocument(_0x2e9e09,_0x4a1091));}return Promise[_0x8a68('0x3d')](_0x3ccc24);})[_0x8a68('0x2a')](function(){if(_0x1a3a3d){return new Promise(function(_0x19a2fd){zipdir(path['join'](_0xcfcbd2,_0x3b3dc4),{'saveTo':path[_0x8a68('0x36')](_0xcfcbd2,util['format']('%s.%s',_0x3b3dc4,_0x8a68('0x3e')))},function(){rimraf(path['join'](_0xcfcbd2,_0x3b3dc4),function(){});_0x19a2fd('zip\x20finished');});});}})[_0x8a68('0x2a')](function(){if(!_0x1a3a3d)return;rimraf(path['join'](_0xcfcbd2,_0x3b3dc4),function(){});})[_0x8a68('0x2a')](function(){logger[_0x8a68('0x3f')](util[_0x8a68('0x1b')](_0x8a68('0x40'),EXTRACTED_REPORT_ID,_0x8a68('0x41')));return analyticExtractedReport(_0x8a68('0x42'),_0x1a3a3d?util[_0x8a68('0x1b')](_0x8a68('0x3c'),_0x3b3dc4,_0x1a3a3d?_0x8a68('0x3e'):_0x8a68('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8a68('0x3f')](util['format'](_0x8a68('0x43'),EXTRACTED_REPORT_ID,_0x8a68('0x41')));return db[_0x8a68('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x52c555){EXTRACTED_REPORT=_0x52c555;return dbH['sequelize'][_0x8a68('0x2e')](util[_0x8a68('0x1b')](_0x8a68('0x44'),QUERY),{'type':dbH[_0x8a68('0x32')][_0x8a68('0x2f')]['SELECT']});})[_0x8a68('0x2a')](extractReport)[_0x8a68('0x45')](function(_0x2ee6d6){logger[_0x8a68('0x3f')](util['format'](_0x8a68('0x46'),EXTRACTED_REPORT_ID,_0x8a68('0x41')),util[_0x8a68('0x47')](_0x2ee6d6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8a68('0x48'));})[_0x8a68('0x49')](function(){process[_0x8a68('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xfc0fe7=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x8a68('0x4b'),'italics':__dirname+_0x8a68('0x4c'),'bolditalics':__dirname+_0x8a68('0x4d')}});return _0xfc0fe7;}function getPDFDocDefinitionFromHTML(_0xa2b505,_0x5c2ef0){var _0x33b1c4=util[_0x8a68('0x1b')](_0x8a68('0x4e'),_0x5c2ef0[_0x8a68('0x4f')],_0x5c2ef0['interactionId']);var _0x4f2795=moment()[_0x8a68('0x1b')](_0x8a68('0x50'))[_0x8a68('0x13')]();var _0x4aea76=htmlToPdfmake(_0xa2b505,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4aea76],'defaultStyle':{'font':_0x8a68('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x8a68('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x8a68('0x51')}},'header':function(){return[{'text':_0x8a68('0x52'),'style':'header'}];},'footer':function(_0x4d5113,_0x13747b){return[{'text':util[_0x8a68('0x1b')](_0x8a68('0x53'),_0x33b1c4,_0x4d5113,_0x13747b,_0x4f2795),'style':_0x8a68('0x54')}];}};}function writePDFDocument(_0x114619,_0x454920){return new Promise(function(_0x474394,_0x56aa3c){var _0x38d4b7=_0x114619[_0x8a68('0x55')](fs[_0x8a68('0x56')](_0x454920));_0x38d4b7['on'](_0x8a68('0x57'),function(){_0x474394(_0x8a68('0x57'));});_0x38d4b7['on'](_0x8a68('0x58'),function(_0x478835){_0x56aa3c(_0x478835);});_0x114619[_0x8a68('0x59')]();});}exports[_0x8a68('0x5a')]=function(_0x10d2a7,_0x1b59d9){var _0x112f9c=getPDFPrinter();var _0x31dd08=getPDFDocDefinitionFromHTML(_0x10d2a7,_0x1b59d9);var _0x2e8da3=_0x112f9c['createPdfKitDocument'](_0x31dd08);return writePDFDocument(_0x2e8da3,_0x1b59d9[_0x8a68('0x2')])[_0x8a68('0x45')](function(_0x48f3a6){throw _0x48f3a6;});}; \ No newline at end of file +var _0xc532=['isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','all','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','createPdfFromHTML','createPdfKitDocument','path','catch','lodash','moment','html-to-pdfmake','pdfmake/src/printer','jsdom','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','auto','body','push','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','endDate','length','header','before','landscape','\x20/\x20','Arial','right','Empty','Setting','find','split','splitSizePdf','then','num'];(function(_0x4d3378,_0xc5a2b2){var _0x106e20=function(_0x5d2432){while(--_0x5d2432){_0x4d3378['push'](_0x4d3378['shift']());}};_0x106e20(++_0xc5a2b2);}(_0xc532,0x194));var _0x2c53=function(_0x219d98,_0x447e0b){_0x219d98=_0x219d98-0x0;var _0x50218f=_0xc532[_0x219d98];return _0x50218f;};'use strict';var _=require(_0x2c53('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x2c53('0x1'));var htmlToPdfmake=require(_0x2c53('0x2'));var PdfPrinter=require(_0x2c53('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x2c53('0x4'))[_0x2c53('0x5')];var window=new JSDOM('')[_0x2c53('0x6')];var BPromise=require(_0x2c53('0x7'));var db=require(_0x2c53('0x8'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x2c53('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x2c53('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x2c53('0xa')][0x5];var FORMAT=_0x2c53('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5de593,_0x86bdcd){var _0x12f62b={'status':_0x5de593};var _0x3ccb23={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x86bdcd){_0x12f62b[_0x2c53('0xc')]=_0x86bdcd;}return db[_0x2c53('0xd')][_0x2c53('0xe')](_0x12f62b,_0x3ccb23);}function getHeaders(_0x3ba96e){return _[_0x2c53('0xf')](_0x3ba96e,function(_0x546571){return{'text':_0x546571,'style':_0x2c53('0x10')};});}function getRows(_0x24c9f0,_0x3f0e43){return _[_0x2c53('0xf')](_0x3f0e43,function(_0x18a4b7){return _(_0x18a4b7)[_0x2c53('0x11')](_0x24c9f0)[_0x2c53('0xf')](function(_0x12d0fe){return _0x12d0fe?_[_0x2c53('0x12')](_0x12d0fe):'';})[_0x2c53('0x13')]();});}function createTable(_0x2e22a3,_0x4d2c37){var _0x165c11={'widths':_[_0x2c53('0x14')](Array(_0x2e22a3['length']),0x91),'heights':function(_0x243e99){return _0x243e99===0x0?_0x2c53('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x267f0e=getHeaders(_0x2e22a3);_0x165c11[_0x2c53('0x16')][_0x2c53('0x17')](_0x267f0e);var _0x2bb239=getRows(_0x2e22a3,_0x4d2c37);_0x165c11[_0x2c53('0x16')]=_0x165c11['body'][_0x2c53('0x18')](_0x2bb239);return _0x165c11;}function createTables(_0x2ac236){var _0x42de50=[];var _0x3000fe=_[_0x2c53('0x19')](Object[_0x2c53('0x1a')](_0x2ac236[0x0]),0x5);_0x3000fe[_0x2c53('0x1b')](function(_0xf09f4c){_0x42de50[_0x2c53('0x17')](createTable(_0xf09f4c,_0x2ac236));});return _0x42de50;}function getPDFDocDefinition(_0x14c0e4){var _0x115e65=util['format'](_0x2c53('0x1c'),NAME,EXTRACTED_REPORT[_0x2c53('0x1d')],moment(EXTRACTED_REPORT['startDate'])[_0x2c53('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x2c53('0x1f')])[_0x2c53('0x1e')](FORMAT));var _0x995964=[];for(var _0x2aa37e=0x0;_0x2aa37e<_0x14c0e4[_0x2c53('0x20')];_0x2aa37e++){var _0x498c06=[];if(_0x2aa37e===0x0){_0x498c06[_0x2c53('0x17')]({'text':_0x115e65,'style':_0x2c53('0x21')});}var _0x7dea9a={'table':_0x14c0e4[_0x2aa37e]};if(_0x2aa37e>0x0){_0x7dea9a['pageBreak']=_0x2c53('0x22');_0x7dea9a['margin']=[0x0,0x46,0x0,0x0];}_0x498c06['push'](_0x7dea9a);_0x995964[_0x2c53('0x17')](_0x498c06);}return{'pageSize':'A4','pageOrientation':_0x2c53('0x23'),'content':_0x995964,'footer':function(_0xea9d1a,_0x240a0e){return{'text':_0xea9d1a[_0x2c53('0x12')]()+_0x2c53('0x24')+_0x240a0e,'style':'footer'};},'defaultStyle':{'font':_0x2c53('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x2c53('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3596ae){var _0x22c8e2=0x1388;var _0x1741dd;if(!_0x3596ae[0x0]['num']){return analyticExtractedReport(_0x2c53('0x27'));}return db[_0x2c53('0x28')][_0x2c53('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2c53('0x2a'),_0x2c53('0x2b')]})[_0x2c53('0x2c')](function(_0x6baf5e){if(_0x6baf5e){_0x1741dd=_0x6baf5e;_0x22c8e2=_0x1741dd[_0x2c53('0x2b')]||0x3e8;}})[_0x2c53('0x2c')](function(){var _0x163198=[];var _0x2640bf=0x0;if(_0x1741dd[_0x2c53('0x2a')]){if(_0x3596ae&&_0x3596ae[_0x2c53('0x20')]){var _0x2ac3e3=_['range'](_0x3596ae[0x0][_0x2c53('0x2d')]/_0x22c8e2);var _0x2faa4d=Number[_0x2c53('0x2e')](_0x3596ae[0x0][_0x2c53('0x2d')]/_0x22c8e2)?_0x3596ae[0x0][_0x2c53('0x2d')]%_0x22c8e2:0x0;_0x2ac3e3[_0x2c53('0x1b')](function(_0x147a26){if(_0x147a26>0x0){_0x2640bf+=_0x22c8e2;}_0x163198[_0x2c53('0x17')](dbH[_0x2c53('0x2f')][_0x2c53('0x30')](util['format'](_0x2c53('0x31'),QUERY,_0x22c8e2,_0x2640bf),{'type':dbH[_0x2c53('0x2f')][_0x2c53('0x32')][_0x2c53('0x33')]}));});if(_0x2faa4d>0x0){_0x2640bf+=_0x22c8e2;_0x163198[_0x2c53('0x17')](dbH[_0x2c53('0x2f')]['query'](util[_0x2c53('0x1e')](_0x2c53('0x31'),QUERY,_0x2faa4d,_0x2640bf),{'type':dbH[_0x2c53('0x2f')][_0x2c53('0x32')]['SELECT']}));}}}else{_0x163198['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x2c53('0x2f')][_0x2c53('0x32')]['SELECT']}));}var _0x32bcfe=path[_0x2c53('0x34')](PATH);var _0x179cd4=path[_0x2c53('0x35')](PATH,_0x2c53('0x36'));var _0x5d8273=_0x1741dd[_0x2c53('0x2a')]&&_0x163198[_0x2c53('0x20')]>0x1;var _0x4047b1=[];if(!fs['existsSync'](path[_0x2c53('0x37')](_0x32bcfe,_0x179cd4))&&_0x5d8273){fs[_0x2c53('0x38')](path['join'](_0x32bcfe,_0x179cd4));}return BPromise[_0x2c53('0x39')](_0x163198,function(_0x786d1d){_0x4047b1['push'](_0x786d1d);})[_0x2c53('0x2c')](function(){var _0x34d732=[];for(var _0x275838=0x0;_0x275838<_0x4047b1[_0x2c53('0x20')];_0x275838+=0x1){var _0x53cc97=_0x4047b1[_0x275838];var _0x3cbc71=createTables(_[_0x2c53('0x3a')](_0x53cc97));var _0x168b4d;var _0x34a5f6=getPDFDocDefinition(_0x3cbc71);var _0x802cbc=getPDFPrinter();var _0x4ddcb4=_0x802cbc['createPdfKitDocument'](_0x34a5f6);if(_0x5d8273){_0x168b4d=path[_0x2c53('0x37')](_0x32bcfe,_0x179cd4,util[_0x2c53('0x1e')](_0x2c53('0x3b'),_0x179cd4,_0x275838,_0x2c53('0x3c')));}else{_0x168b4d=path[_0x2c53('0x37')](_0x32bcfe,util['format'](_0x2c53('0x3d'),_0x179cd4,_0x2c53('0x3c')));}_0x34d732[_0x2c53('0x17')](writePDFDocument(_0x4ddcb4,_0x168b4d));}return Promise[_0x2c53('0x3e')](_0x34d732);})[_0x2c53('0x2c')](function(){if(_0x5d8273){return new Promise(function(_0x40f478){zipdir(path[_0x2c53('0x37')](_0x32bcfe,_0x179cd4),{'saveTo':path[_0x2c53('0x37')](_0x32bcfe,util['format'](_0x2c53('0x3d'),_0x179cd4,'zip'))},function(){rimraf(path[_0x2c53('0x37')](_0x32bcfe,_0x179cd4),function(){});_0x40f478('zip\x20finished');});});}})[_0x2c53('0x2c')](function(){if(!_0x5d8273)return;rimraf(path['join'](_0x32bcfe,_0x179cd4),function(){});})[_0x2c53('0x2c')](function(){logger[_0x2c53('0x3f')](util[_0x2c53('0x1e')](_0x2c53('0x40'),EXTRACTED_REPORT_ID,_0x2c53('0x41')));return analyticExtractedReport(_0x2c53('0x42'),_0x5d8273?util[_0x2c53('0x1e')]('%s.%s',_0x179cd4,_0x5d8273?_0x2c53('0x43'):_0x2c53('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x2c53('0x1e')](_0x2c53('0x44'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0x2c53('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x2c53('0x2c')](function(_0x48191a){EXTRACTED_REPORT=_0x48191a;return dbH[_0x2c53('0x2f')][_0x2c53('0x30')](util[_0x2c53('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2c53('0x2f')][_0x2c53('0x32')]['SELECT']});})['then'](extractReport)['catch'](function(_0x2de72f){logger[_0x2c53('0x3f')](util[_0x2c53('0x1e')](_0x2c53('0x46'),EXTRACTED_REPORT_ID,_0x2c53('0x41')),util[_0x2c53('0x47')](_0x2de72f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2c53('0x48'));})['finally'](function(){process[_0x2c53('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x136528=new PdfPrinter({'Arial':{'normal':__dirname+_0x2c53('0x4a'),'bold':__dirname+_0x2c53('0x4b'),'italics':__dirname+_0x2c53('0x4c'),'bolditalics':__dirname+_0x2c53('0x4d')}});return _0x136528;}function getPDFDocDefinitionFromHTML(_0x4cc343,_0x4490a9){var _0x3af92f=util[_0x2c53('0x1e')](_0x2c53('0x4e'),_0x4490a9[_0x2c53('0x4f')],_0x4490a9['interactionId']);var _0x26e285=moment()['format']('YYYY-MM-DD')[_0x2c53('0x12')]();var _0x2ceaa6=htmlToPdfmake(_0x4cc343,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2ceaa6],'defaultStyle':{'font':_0x2c53('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x2c53('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x2c53('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x2c53('0x50')}},'header':function(){return[{'text':_0x2c53('0x51'),'style':_0x2c53('0x21')}];},'footer':function(_0x118266,_0x4b7be2){return[{'text':util[_0x2c53('0x1e')](_0x2c53('0x52'),_0x3af92f,_0x118266,_0x4b7be2,_0x26e285),'style':'footer'}];}};}function writePDFDocument(_0x107aed,_0x3ed3f9){return new Promise(function(_0x9e66ae,_0xa8e59){var _0xe2d607=_0x107aed[_0x2c53('0x53')](fs['createWriteStream'](_0x3ed3f9));_0xe2d607['on'](_0x2c53('0x54'),function(){_0x9e66ae('finish');});_0xe2d607['on'](_0x2c53('0x55'),function(_0x1398f9){_0xa8e59(_0x1398f9);});_0x107aed['end']();});}exports[_0x2c53('0x56')]=function(_0x3d5d79,_0x2ffc91){var _0x47f553=getPDFPrinter();var _0xbd8cec=getPDFDocDefinitionFromHTML(_0x3d5d79,_0x2ffc91);var _0xcf12f4=_0x47f553[_0x2c53('0x57')](_0xbd8cec);return writePDFDocument(_0xcf12f4,_0x2ffc91[_0x2c53('0x58')])[_0x2c53('0x59')](function(_0x2e4496){throw _0x2e4496;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 733c5f4..e97e82c 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 _0xb9ed=['inspect','Failed','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','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','QueryTypes','num','Empty','range','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','SELECT','dirname','basename','.xlsx','length','mkdirSync','join','%s%d.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','info','Completed','catch'];(function(_0x3aff50,_0x36a5b2){var _0x46c895=function(_0x498df9){while(--_0x498df9){_0x3aff50['push'](_0x3aff50['shift']());}};_0x46c895(++_0x36a5b2);}(_0xb9ed,0x1bc));var _0xdb9e=function(_0x2ecb75,_0x15cd25){_0x2ecb75=_0x2ecb75-0x0;var _0x51b5e9=_0xb9ed[_0x2ecb75];return _0x51b5e9;};'use strict';var util=require(_0xdb9e('0x0'));var path=require('path');var _=require(_0xdb9e('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xdb9e('0x2'));var zipdir=require(_0xdb9e('0x3'));var rimraf=require(_0xdb9e('0x4'));var db=require(_0xdb9e('0x5'))['db'];var dbH=require(_0xdb9e('0x5'))[_0xdb9e('0x6')];var logger=require(_0xdb9e('0x7'))(_0xdb9e('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xdb9e('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x45e22b,_0x57ab79){var _0xd9de78={'status':_0x45e22b};var _0x59451a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x57ab79){_0xd9de78[_0xdb9e('0xa')]=_0x57ab79;}return db['AnalyticExtractedReport'][_0xdb9e('0xb')](_0xd9de78,_0x59451a);}function main(){var _0x10670b=0x1388;var _0x511e80;logger['info'](util[_0xdb9e('0xc')](_0xdb9e('0xd'),EXTRACTED_REPORT_ID,_0xdb9e('0xe')));return db[_0xdb9e('0xf')][_0xdb9e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdb9e('0x11'),_0xdb9e('0x12')]})['then'](function(_0x564a4c){if(_0x564a4c){_0x511e80=_0x564a4c;_0x10670b=_0x511e80[_0xdb9e('0x12')]||0x1388;}})[_0xdb9e('0x13')](function(){return dbH['sequelize']['query'](util[_0xdb9e('0xc')](_0xdb9e('0x14'),QUERY),{'type':dbH['sequelize'][_0xdb9e('0x15')]['SELECT']});})[_0xdb9e('0x13')](function(_0x39bb04){if(!_0x39bb04[0x0][_0xdb9e('0x16')]){return analyticExtractedReport(_0xdb9e('0x17'));}var _0x3e5a4f=[];var _0x1ed73e=0x0;if(_0x511e80['split']){if(_0x39bb04&&_0x39bb04['length']){var _0x3d1f7f=_[_0xdb9e('0x18')](_0x39bb04[0x0][_0xdb9e('0x16')]/_0x10670b);var _0x254f5b=Number[_0xdb9e('0x19')](_0x39bb04[0x0][_0xdb9e('0x16')]/_0x10670b)?_0x39bb04[0x0][_0xdb9e('0x16')]%_0x10670b:0x0;_0x3d1f7f['forEach'](function(_0x35e2ca){if(_0x35e2ca>0x0){_0x1ed73e+=_0x10670b;}_0x3e5a4f[_0xdb9e('0x1a')](dbH['sequelize'][_0xdb9e('0x1b')](util[_0xdb9e('0xc')](_0xdb9e('0x1c'),QUERY,_0x10670b,_0x1ed73e),{'type':dbH[_0xdb9e('0x1d')][_0xdb9e('0x15')]['SELECT']}));});if(_0x254f5b>0x0){_0x1ed73e+=_0x10670b;_0x3e5a4f['push'](dbH[_0xdb9e('0x1d')][_0xdb9e('0x1b')](util[_0xdb9e('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x254f5b,_0x1ed73e),{'type':dbH[_0xdb9e('0x1d')][_0xdb9e('0x15')][_0xdb9e('0x1e')]}));}}}else{_0x3e5a4f[_0xdb9e('0x1a')](dbH[_0xdb9e('0x1d')][_0xdb9e('0x1b')](QUERY,{'type':dbH[_0xdb9e('0x1d')][_0xdb9e('0x15')]['SELECT']}));}var _0x21afa8=path[_0xdb9e('0x1f')](PATH);var _0x1c1306=path[_0xdb9e('0x20')](PATH,_0xdb9e('0x21'));var _0x37faee=_0x511e80[_0xdb9e('0x11')]&&_0x3e5a4f[_0xdb9e('0x22')]>0x1;var _0x3efcd2=[];if(!fs['existsSync'](path['join'](_0x21afa8,_0x1c1306))&&_0x37faee){fs[_0xdb9e('0x23')](path[_0xdb9e('0x24')](_0x21afa8,_0x1c1306));}return BPromise['each'](_0x3e5a4f,function(_0x3fb4b7){_0x3efcd2[_0xdb9e('0x1a')](_0x3fb4b7);})['then'](function(){for(var _0xa4b6ff=0x0;_0xa4b6ff<_0x3efcd2[_0xdb9e('0x22')];_0xa4b6ff+=0x1){var _0x5ae869;var _0xaef890=_0x3efcd2[_0xa4b6ff];if(_0x37faee){_0x5ae869=path[_0xdb9e('0x24')](_0x21afa8,_0x1c1306,util[_0xdb9e('0xc')](_0xdb9e('0x25'),_0x1c1306,_0xa4b6ff,_0xdb9e('0x26')));}else{_0x5ae869=path[_0xdb9e('0x24')](_0x21afa8,util[_0xdb9e('0xc')]('%s.%s',_0x1c1306,'xlsx'));}fs[_0xdb9e('0x27')](_0x5ae869,json2xls(_0xaef890),_0xdb9e('0x28'));}})[_0xdb9e('0x13')](function(){if(_0x37faee){return new Promise(function(_0x3b23d0){zipdir(path[_0xdb9e('0x24')](_0x21afa8,_0x1c1306),{'saveTo':path[_0xdb9e('0x24')](_0x21afa8,util[_0xdb9e('0xc')]('%s.%s',_0x1c1306,_0xdb9e('0x29')))},function(_0x54d046,_0x36d810){rimraf(path[_0xdb9e('0x24')](_0x21afa8,_0x1c1306),function(){});_0x3b23d0(_0xdb9e('0x2a'));});});}})[_0xdb9e('0x13')](function(){logger[_0xdb9e('0x2b')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xdb9e('0x2c'),_0x37faee?util[_0xdb9e('0xc')]('%s.%s',_0x1c1306,_0x37faee?'zip':_0xdb9e('0x26')):null);});})[_0xdb9e('0x2d')](function(_0x3a9772){logger[_0xdb9e('0x2b')](util[_0xdb9e('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xdb9e('0xe')),util[_0xdb9e('0x2e')](_0x3a9772,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdb9e('0x2f'));})['finally'](function(){process[_0xdb9e('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x20e8=['inspect','Failed','exit','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','isInteger','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','join','mkdirSync','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x3852be,_0x30a961){var _0x1eeb45=function(_0x2bcdb4){while(--_0x2bcdb4){_0x3852be['push'](_0x3852be['shift']());}};_0x1eeb45(++_0x30a961);}(_0x20e8,0x6b));var _0x820e=function(_0x5e9146,_0x11ddde){_0x5e9146=_0x5e9146-0x0;var _0xd6d350=_0x20e8[_0x5e9146];return _0xd6d350;};'use strict';var util=require(_0x820e('0x0'));var path=require(_0x820e('0x1'));var _=require(_0x820e('0x2'));var fs=require('fs');var json2xls=require(_0x820e('0x3'));var BPromise=require(_0x820e('0x4'));var zipdir=require(_0x820e('0x5'));var rimraf=require('rimraf');var db=require(_0x820e('0x6'))['db'];var dbH=require(_0x820e('0x6'))[_0x820e('0x7')];var logger=require(_0x820e('0x8'))(_0x820e('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x820e('0xa')][0x2]);var QUERY=process[_0x820e('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5cc43e,_0x545d80){var _0x5295c0={'status':_0x5cc43e};var _0x537bcb={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x545d80){_0x5295c0[_0x820e('0xb')]=_0x545d80;}return db[_0x820e('0xc')][_0x820e('0xd')](_0x5295c0,_0x537bcb);}function main(){var _0x13df2c=0x1388;var _0x4bdc8f;logger[_0x820e('0xe')](util[_0x820e('0xf')](_0x820e('0x10'),EXTRACTED_REPORT_ID,_0x820e('0x11')));return db[_0x820e('0x12')][_0x820e('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x820e('0x14'),'splitSizeXlsx']})[_0x820e('0x15')](function(_0x39e4f5){if(_0x39e4f5){_0x4bdc8f=_0x39e4f5;_0x13df2c=_0x4bdc8f['splitSizeXlsx']||0x1388;}})[_0x820e('0x15')](function(){return dbH[_0x820e('0x16')][_0x820e('0x17')](util['format'](_0x820e('0x18'),QUERY),{'type':dbH[_0x820e('0x16')][_0x820e('0x19')][_0x820e('0x1a')]});})[_0x820e('0x15')](function(_0x3b34e8){if(!_0x3b34e8[0x0]['num']){return analyticExtractedReport(_0x820e('0x1b'));}var _0x473e1e=[];var _0x4fe4dd=0x0;if(_0x4bdc8f[_0x820e('0x14')]){if(_0x3b34e8&&_0x3b34e8[_0x820e('0x1c')]){var _0x2691b0=_[_0x820e('0x1d')](_0x3b34e8[0x0]['num']/_0x13df2c);var _0x42b4d9=Number[_0x820e('0x1e')](_0x3b34e8[0x0]['num']/_0x13df2c)?_0x3b34e8[0x0][_0x820e('0x1f')]%_0x13df2c:0x0;_0x2691b0['forEach'](function(_0xe0d995){if(_0xe0d995>0x0){_0x4fe4dd+=_0x13df2c;}_0x473e1e[_0x820e('0x20')](dbH[_0x820e('0x16')][_0x820e('0x17')](util[_0x820e('0xf')](_0x820e('0x21'),QUERY,_0x13df2c,_0x4fe4dd),{'type':dbH['sequelize'][_0x820e('0x19')][_0x820e('0x1a')]}));});if(_0x42b4d9>0x0){_0x4fe4dd+=_0x13df2c;_0x473e1e['push'](dbH[_0x820e('0x16')][_0x820e('0x17')](util[_0x820e('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x42b4d9,_0x4fe4dd),{'type':dbH[_0x820e('0x16')][_0x820e('0x19')][_0x820e('0x1a')]}));}}}else{_0x473e1e[_0x820e('0x20')](dbH[_0x820e('0x16')][_0x820e('0x17')](QUERY,{'type':dbH['sequelize'][_0x820e('0x19')]['SELECT']}));}var _0x3ac62b=path[_0x820e('0x22')](PATH);var _0x5d79a3=path['basename'](PATH,_0x820e('0x23'));var _0x264cdd=_0x4bdc8f[_0x820e('0x14')]&&_0x473e1e[_0x820e('0x1c')]>0x1;var _0x344b52=[];if(!fs[_0x820e('0x24')](path[_0x820e('0x25')](_0x3ac62b,_0x5d79a3))&&_0x264cdd){fs[_0x820e('0x26')](path[_0x820e('0x25')](_0x3ac62b,_0x5d79a3));}return BPromise['each'](_0x473e1e,function(_0x3fc25e){_0x344b52[_0x820e('0x20')](_0x3fc25e);})[_0x820e('0x15')](function(){for(var _0x2a71e3=0x0;_0x2a71e3<_0x344b52[_0x820e('0x1c')];_0x2a71e3+=0x1){var _0x44d394;var _0x4385d3=_0x344b52[_0x2a71e3];if(_0x264cdd){_0x44d394=path[_0x820e('0x25')](_0x3ac62b,_0x5d79a3,util[_0x820e('0xf')]('%s%d.%s',_0x5d79a3,_0x2a71e3,_0x820e('0x27')));}else{_0x44d394=path[_0x820e('0x25')](_0x3ac62b,util['format'](_0x820e('0x28'),_0x5d79a3,_0x820e('0x27')));}fs[_0x820e('0x29')](_0x44d394,json2xls(_0x4385d3),_0x820e('0x2a'));}})[_0x820e('0x15')](function(){if(_0x264cdd){return new Promise(function(_0x3f1105){zipdir(path[_0x820e('0x25')](_0x3ac62b,_0x5d79a3),{'saveTo':path['join'](_0x3ac62b,util['format'](_0x820e('0x28'),_0x5d79a3,_0x820e('0x2b')))},function(_0x869c2e,_0x185817){rimraf(path['join'](_0x3ac62b,_0x5d79a3),function(){});_0x3f1105(_0x820e('0x2c'));});});}})[_0x820e('0x15')](function(){logger['info'](util[_0x820e('0xf')](_0x820e('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x820e('0x2e'),_0x264cdd?util[_0x820e('0xf')](_0x820e('0x28'),_0x5d79a3,_0x264cdd?'zip':_0x820e('0x27')):null);});})[_0x820e('0x2f')](function(_0x59964d){logger[_0x820e('0xe')](util[_0x820e('0xf')](_0x820e('0x30'),EXTRACTED_REPORT_ID,_0x820e('0x11')),util[_0x820e('0x31')](_0x59964d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x820e('0x32'));})['finally'](function(){process[_0x820e('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7f58f30..3880da1 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 _0xcb94=['priority','extensions','extension','push','type','Set','format','CDR(type)=%s','inbound','CDR(routeid)=','VoiceExtensionId','context','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','indexOf','app','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','concat','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','models','Interval','then','intervals','VoiceExtension','findAll','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','playback','hasOwnProperty'];(function(_0x221a70,_0x364013){var _0x1070b4=function(_0x32b9f3){while(--_0x32b9f3){_0x221a70['push'](_0x221a70['shift']());}};_0x1070b4(++_0x364013);}(_0xcb94,0xbd));var _0x4cb9=function(_0xcc4e58,_0x532ca0){_0xcc4e58=_0xcc4e58-0x0;var _0x1a2ea5=_0xcb94[_0xcc4e58];return _0x1a2ea5;};'use strict';var _=require(_0x4cb9('0x0'));var util=require(_0x4cb9('0x1'));function rewrite(_0x8a610c,_0xfa8dd2){var _0xe20ab2=this;return _0x8a610c[_0x4cb9('0x2')][_0x4cb9('0x3')]['findAll']({'raw':!![]})[_0x4cb9('0x4')](function(_0x3c6c85){_0xe20ab2[_0x4cb9('0x5')]=_0x3c6c85;return _0x8a610c[_0x4cb9('0x2')][_0x4cb9('0x6')][_0x4cb9('0x7')]({'where':{'IntervalId':_0xfa8dd2['IntervalId']},'raw':!![]});})[_0x4cb9('0x4')](function(_0x519c23){return _0x8a610c[_0x4cb9('0x2')][_0x4cb9('0x6')][_0x4cb9('0x7')]({'where':{'exten':{'$in':_[_0x4cb9('0x8')](_[_0x4cb9('0x9')](_0x519c23,'exten'))}},'order':[{'raw':_0x4cb9('0xa')}],'raw':!![]});})['then'](function(_0x3232fb){var _0x54eeaa=_['filter'](_0x3232fb,{'priority':'1'});var _0x129c6b=_[_0x4cb9('0xb')](_0x3232fb,{'isApp':0x1});var _0x41c4fc=_['groupBy'](_0x129c6b,_0x4cb9('0xc'));var _0x5b2628=['queue',_0x4cb9('0xd')];var _0x22ba02=[];var _0xb17bad=[];for(var _0x1c724e in _0x41c4fc){if(_0x41c4fc[_0x4cb9('0xe')](_0x1c724e)){_0xe20ab2[_0x4cb9('0xf')]=0x2;_0xe20ab2[_0x4cb9('0x10')]=[];_0xe20ab2[_0x4cb9('0x11')]=_['find'](_0x54eeaa,{'exten':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0xc')]});_0xe20ab2['extensions'][_0x4cb9('0x12')]({'type':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')],'app':_0x4cb9('0x14'),'appdata':util[_0x4cb9('0x15')](_0x4cb9('0x16'),_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')]),'context':_0x41c4fc[_0x1c724e][0x0]['context'],'exten':_0x41c4fc[_0x1c724e][0x0]['exten'],'priority':_0xe20ab2['priority']++,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0]['VoiceExtensionId']});if(_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')]===_0x4cb9('0x17')){_0xe20ab2[_0x4cb9('0x10')][_0x4cb9('0x12')]({'type':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')],'app':_0x4cb9('0x14'),'appdata':_0x4cb9('0x18')+_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')],'context':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x1a')],'exten':_0x41c4fc[_0x1c724e][0x0]['exten'],'priority':_0xe20ab2['priority']++,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});}else if(_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')]===_0x4cb9('0x1b')){if(_0xe20ab2[_0x4cb9('0x11')]){_0xe20ab2[_0x4cb9('0x10')]['push']({'type':_0x41c4fc[_0x1c724e][0x0]['type'],'app':_0x4cb9('0x14'),'appdata':'CDR(destination)='+(_0xe20ab2[_0x4cb9('0x11')][_0x4cb9('0x1c')]?_0x4cb9('0x1d')+_0xe20ab2[_0x4cb9('0x11')][_0x4cb9('0x1c')]+'}':_0x4cb9('0x1e')),'context':_0x41c4fc[_0x1c724e][0x0]['context'],'exten':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0xc')],'priority':_0xe20ab2['priority']++,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});}_0xe20ab2[_0x4cb9('0x10')]['push']({'type':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')],'app':_0x4cb9('0x14'),'appdata':_0x4cb9('0x18')+_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')],'context':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x1a')],'exten':_0x41c4fc[_0x1c724e][0x0]['exten'],'priority':_0xe20ab2['priority']++,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});var _0x876b66=_0xe20ab2[_0x4cb9('0xf')]++;_0xe20ab2[_0x4cb9('0x10')]['push']({'type':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')],'app':_0x4cb9('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x876b66+0x2)+_0x4cb9('0x20')+(_0x876b66+0x1)+')','context':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x1a')],'exten':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0xc')],'priority':_0x876b66,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});if(_0xe20ab2['extension']){_0xe20ab2['extensions'][_0x4cb9('0x12')]({'type':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')],'app':_0x4cb9('0x14'),'appdata':_0xe20ab2[_0x4cb9('0x11')][_0x4cb9('0x1c')]?_0x4cb9('0x21')+_0xe20ab2['extension'][_0x4cb9('0x1c')]+'}':_0x4cb9('0x22'),'context':_0x41c4fc[_0x1c724e][0x0]['context'],'exten':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0xc')],'priority':_0xe20ab2[_0x4cb9('0xf')]++,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0]['VoiceExtensionId']});}_0xe20ab2[_0x4cb9('0x10')][_0x4cb9('0x12')]({'type':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')],'app':_0x4cb9('0x14'),'appdata':_0x4cb9('0x23')+_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')],'context':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x1a')],'exten':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0xc')],'priority':_0xe20ab2[_0x4cb9('0xf')]++,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});if(_0xe20ab2[_0x4cb9('0x11')]&&_0xe20ab2[_0x4cb9('0x11')][_0x4cb9('0xe')](_0x4cb9('0x24'))&&_0xe20ab2[_0x4cb9('0x11')][_0x4cb9('0x24')]!==_0x4cb9('0x25')){_0xe20ab2[_0x4cb9('0x10')][_0x4cb9('0x12')]({'type':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')],'app':'Set','appdata':_0x4cb9('0x26'),'context':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x1a')],'exten':_0x41c4fc[_0x1c724e][0x0]['exten'],'priority':_0xe20ab2[_0x4cb9('0xf')]++,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});_0xe20ab2[_0x4cb9('0x10')][_0x4cb9('0x12')]({'type':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')],'app':_0x4cb9('0x14'),'appdata':_0x4cb9('0x27')+_0xe20ab2[_0x4cb9('0x11')][_0x4cb9('0x24')]||_0x4cb9('0x28'),'context':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x1a')],'exten':_0x41c4fc[_0x1c724e][0x0]['exten'],'priority':_0xe20ab2['priority']++,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});}}_0xe20ab2[_0x4cb9('0x10')][_0x4cb9('0x12')]({'type':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')],'app':_0x4cb9('0x14'),'appdata':_0x4cb9('0x29'),'context':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x1a')],'exten':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0xc')],'priority':_0xe20ab2[_0x4cb9('0xf')]++,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});_0xe20ab2[_0x4cb9('0x10')][_0x4cb9('0x12')]({'type':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')],'app':_0x4cb9('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x41c4fc[_0x1c724e][0x0]['context'],'exten':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0xc')],'priority':_0xe20ab2[_0x4cb9('0xf')]++,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});_0xe20ab2['extensions'][_0x4cb9('0x12')]({'type':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x13')],'app':_0x4cb9('0x14'),'appdata':_0x4cb9('0x2a'),'context':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x1a')],'exten':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0xc')],'priority':_0xe20ab2['priority']++,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});for(var _0x35ac2b=0x0,_0x579f36=0x0;_0x35ac2b<_0x41c4fc[_0x1c724e][_0x4cb9('0x2b')];_0x35ac2b+=0x1,_0x579f36=0x0){var _0x4a616e=_0x41c4fc[_0x1c724e][_0x35ac2b];if(_0x4a616e[_0x4cb9('0x13')]){_0x4a616e[_0x4cb9('0x13')]=_0x4a616e[_0x4cb9('0x13')][_0x4cb9('0x2c')]();}var _0x424ea7=[];var _0x2fcfa0=[];delete _0x4a616e['id'];delete _0x4a616e[_0x4cb9('0x2d')];delete _0x4a616e['updatedAt'];var _0x3dafb7=_0x4a616e[_0x4cb9('0x2e')]!==_0x4cb9('0x2f')?[_0x4a616e['interval']]:_0x4a616e['IntervalId']?_[_0x4cb9('0x9')](_[_0x4cb9('0xb')](_0xe20ab2[_0x4cb9('0x5')],{'IntervalId':_0x4a616e[_0x4cb9('0x30')]}),_0x4cb9('0x2e')):[];if(_0x4a616e[_0x4cb9('0xe')]('tag')){if(_0x4a616e[_0x4cb9('0x31')]&&_0x4a616e[_0x4cb9('0x31')]!=='--'){_0x424ea7['push']({'type':_0x4a616e[_0x4cb9('0x13')],'app':_0x4cb9('0x14'),'appdata':_0x4cb9('0x32')+_0x4a616e['tag'],'context':_0x4a616e['context'],'exten':_0x4a616e[_0x4cb9('0xc')],'priority':_0x3dafb7[_0x4cb9('0x2b')]+_0xe20ab2[_0x4cb9('0xf')]+_0x579f36++,'VoiceExtensionId':_0x4a616e[_0x4cb9('0x19')]});}}if(_0x4a616e[_0x4cb9('0x13')]===_0x4cb9('0x1b')&&_0x4a616e[_0x4cb9('0xe')]('callerID')){if(_0x4a616e['callerID']){_0x424ea7[_0x4cb9('0x12')]({'type':_0x4a616e[_0x4cb9('0x13')],'app':_0x4cb9('0x1f'),'appdata':_0x4cb9('0x33')+_0x4a616e[_0x4cb9('0x34')]+')','context':_0x4a616e[_0x4cb9('0x1a')],'exten':_0x4a616e['exten'],'priority':_0x3dafb7[_0x4cb9('0x2b')]+_0xe20ab2[_0x4cb9('0xf')]+_0x579f36++,'VoiceExtensionId':_0x4a616e['VoiceExtensionId']});}else{_0x424ea7[_0x4cb9('0x12')]({'type':_0x4a616e['type'],'app':_0x4cb9('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x4a616e[_0x4cb9('0x1a')],'exten':_0x4a616e[_0x4cb9('0xc')],'priority':_0x3dafb7[_0x4cb9('0x2b')]+_0xe20ab2['priority']+_0x579f36++,'VoiceExtensionId':_0x4a616e[_0x4cb9('0x19')]});}}if(_0x4a616e[_0x4cb9('0xe')]('answer')){if(_0x5b2628[_0x4cb9('0x35')](_0x4a616e[_0x4cb9('0x36')][_0x4cb9('0x2c')]())>=0x0&&_0x4a616e[_0x4cb9('0x37')]!=='custom'){if(_0x4a616e['answer']){_0x424ea7[_0x4cb9('0x12')]({'type':_0x4a616e[_0x4cb9('0x13')],'app':_0x4cb9('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4a616e[_0x4cb9('0x1a')],'exten':_0x4a616e[_0x4cb9('0xc')],'priority':_0x3dafb7[_0x4cb9('0x2b')]+_0xe20ab2[_0x4cb9('0xf')]+_0x579f36++,'VoiceExtensionId':_0x4a616e['VoiceExtensionId']});_0x424ea7[_0x4cb9('0x12')]({'type':_0x4a616e[_0x4cb9('0x13')],'app':_0x4cb9('0x14'),'appdata':_0x4cb9('0x38'),'context':_0x4a616e[_0x4cb9('0x1a')],'exten':_0x4a616e[_0x4cb9('0xc')],'priority':_0x3dafb7['length']+_0xe20ab2[_0x4cb9('0xf')]+_0x579f36++,'VoiceExtensionId':_0x4a616e[_0x4cb9('0x19')]});}else{_0x424ea7['push']({'type':_0x4a616e[_0x4cb9('0x13')],'app':_0x4cb9('0x1f'),'appdata':_0x4cb9('0x39'),'context':_0x4a616e[_0x4cb9('0x1a')],'exten':_0x4a616e[_0x4cb9('0xc')],'priority':_0x3dafb7[_0x4cb9('0x2b')]+_0xe20ab2[_0x4cb9('0xf')]+_0x579f36++,'VoiceExtensionId':_0x4a616e[_0x4cb9('0x19')]});_0x424ea7[_0x4cb9('0x12')]({'type':_0x4a616e['type'],'app':'Set','appdata':_0x4cb9('0x3a'),'context':_0x4a616e[_0x4cb9('0x1a')],'exten':_0x4a616e[_0x4cb9('0xc')],'priority':_0x3dafb7[_0x4cb9('0x2b')]+_0xe20ab2[_0x4cb9('0xf')]+_0x579f36++,'VoiceExtensionId':_0x4a616e[_0x4cb9('0x19')]});}}}for(var _0x549eb8=0x0;_0x549eb8<_0x3dafb7[_0x4cb9('0x2b')];_0x549eb8+=0x1){var _0x20c0d8=_0xe20ab2[_0x4cb9('0xf')]+_0x3dafb7[_0x4cb9('0x2b')];var _0x291e8d=_0x549eb8===_0x3dafb7[_0x4cb9('0x2b')]-0x1?_0xe20ab2[_0x4cb9('0xf')]+_0x424ea7[_0x4cb9('0x2b')]+_0x2fcfa0['length']+0x2:_0xe20ab2['priority']+_0x549eb8+0x1;_0x424ea7[_0x4cb9('0x3b')](_0x549eb8,0x0,{'type':_0x4a616e[_0x4cb9('0x13')],'app':'GotoIfTime','appdata':_0x3dafb7[_0x549eb8]+'?'+_0x4a616e[_0x4cb9('0x1a')]+',${EXTEN},'+_0x20c0d8+':'+_0x4a616e['context']+_0x4cb9('0x3c')+_0x291e8d,'exten':_0x4a616e[_0x4cb9('0xc')],'context':_0x4a616e[_0x4cb9('0x1a')],'priority':_0xe20ab2[_0x4cb9('0xf')]+_0x549eb8,'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});}_0x4a616e[_0x4cb9('0xf')]=_0x424ea7[_0x4cb9('0x2b')]?_['last'](_0x424ea7)[_0x4cb9('0xf')]+0x1:_0xe20ab2['priority'];_0xe20ab2['priority']=(_0x2fcfa0[_0x4cb9('0x2b')]?_['last'](_0x2fcfa0)['priority']:_0x4a616e[_0x4cb9('0xf')])+0x1;_0xe20ab2['extensions']=_['concat'](_0xe20ab2[_0x4cb9('0x10')],_0x424ea7,[_0x4a616e],_0x2fcfa0);}_0xe20ab2[_0x4cb9('0x10')]['push']({'type':_0x41c4fc[_0x1c724e][0x0]['type'],'app':'Hangup','exten':_0x41c4fc[_0x1c724e][0x0]['exten'],'context':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x1a')],'priority':_0xe20ab2['priority'],'VoiceExtensionId':_0x41c4fc[_0x1c724e][0x0][_0x4cb9('0x19')]});_0x22ba02[_0x4cb9('0x12')](_0x41c4fc[_0x1c724e][0x0]['VoiceExtensionId']);_0xb17bad=_[_0x4cb9('0x3d')](_0xb17bad,_0xe20ab2[_0x4cb9('0x10')]);}}return _0x8a610c[_0x4cb9('0x3e')](function(_0xce3230){return _0x8a610c['models'][_0x4cb9('0x6')][_0x4cb9('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x22ba02}},'transaction':_0xce3230})[_0x4cb9('0x4')](function(_0x410fe0){return _0x8a610c[_0x4cb9('0x2')][_0x4cb9('0x6')]['bulkCreate'](_[_0x4cb9('0x40')](_0xb17bad,_0x4cb9('0xf')),{'transaction':_0xce3230});});});})[_0x4cb9('0x41')](function(_0x7322d2){console[_0x4cb9('0x42')](_0x7322d2);});}exports[_0x4cb9('0x43')]=rewrite; \ No newline at end of file +var _0x3bd6=['bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','VoiceExtension','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','push','type','Set','format','context','inbound','CDR(routeid)=','VoiceExtensionId','CDR(destination)=','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','IntervalId','intervals','tag','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy'];(function(_0x243b29,_0x1f20e6){var _0x1d0943=function(_0x345278){while(--_0x345278){_0x243b29['push'](_0x243b29['shift']());}};_0x1d0943(++_0x1f20e6);}(_0x3bd6,0x171));var _0x63bd=function(_0x274a42,_0xf670b8){_0x274a42=_0x274a42-0x0;var _0x5f3a80=_0x3bd6[_0x274a42];return _0x5f3a80;};'use strict';var _=require(_0x63bd('0x0'));var util=require(_0x63bd('0x1'));function rewrite(_0x513377,_0x1fc4f0){var _0x17185d=this;return _0x513377[_0x63bd('0x2')][_0x63bd('0x3')][_0x63bd('0x4')]({'raw':!![]})['then'](function(_0x2ff4e9){_0x17185d['intervals']=_0x2ff4e9;return _0x513377['models'][_0x63bd('0x5')][_0x63bd('0x4')]({'where':{'IntervalId':_0x1fc4f0['IntervalId']},'raw':!![]});})[_0x63bd('0x6')](function(_0x511596){return _0x513377['models'][_0x63bd('0x5')][_0x63bd('0x4')]({'where':{'exten':{'$in':_[_0x63bd('0x7')](_[_0x63bd('0x8')](_0x511596,_0x63bd('0x9')))}},'order':[{'raw':_0x63bd('0xa')}],'raw':!![]});})['then'](function(_0x1fb301){var _0x3a49d4=_['filter'](_0x1fb301,{'priority':'1'});var _0x11d3e1=_[_0x63bd('0xb')](_0x1fb301,{'isApp':0x1});var _0x6ec715=_[_0x63bd('0xc')](_0x11d3e1,_0x63bd('0x9'));var _0x1e1b21=[_0x63bd('0xd'),_0x63bd('0xe')];var _0x1a9136=[];var _0x289ed3=[];for(var _0x5a94e3 in _0x6ec715){if(_0x6ec715['hasOwnProperty'](_0x5a94e3)){_0x17185d[_0x63bd('0xf')]=0x2;_0x17185d[_0x63bd('0x10')]=[];_0x17185d[_0x63bd('0x11')]=_[_0x63bd('0x12')](_0x3a49d4,{'exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')]});_0x17185d['extensions'][_0x63bd('0x13')]({'type':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')],'app':_0x63bd('0x15'),'appdata':util[_0x63bd('0x16')]('CDR(type)=%s',_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')]),'context':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x17')],'exten':_0x6ec715[_0x5a94e3][0x0]['exten'],'priority':_0x17185d['priority']++,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0]['VoiceExtensionId']});if(_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')]===_0x63bd('0x18')){_0x17185d[_0x63bd('0x10')][_0x63bd('0x13')]({'type':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')],'app':_0x63bd('0x15'),'appdata':_0x63bd('0x19')+_0x6ec715[_0x5a94e3][0x0]['VoiceExtensionId'],'context':_0x6ec715[_0x5a94e3][0x0]['context'],'exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')],'priority':_0x17185d[_0x63bd('0xf')]++,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x1a')]});}else if(_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')]==='outbound'){if(_0x17185d[_0x63bd('0x11')]){_0x17185d[_0x63bd('0x10')][_0x63bd('0x13')]({'type':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')],'app':_0x63bd('0x15'),'appdata':_0x63bd('0x1b')+(_0x17185d[_0x63bd('0x11')]['cutdigits']?_0x63bd('0x1c')+_0x17185d[_0x63bd('0x11')]['cutdigits']+'}':'${EXTEN}'),'context':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x17')],'exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')],'priority':_0x17185d['priority']++,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x1a')]});}_0x17185d[_0x63bd('0x10')][_0x63bd('0x13')]({'type':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')],'app':_0x63bd('0x15'),'appdata':_0x63bd('0x19')+_0x6ec715[_0x5a94e3][0x0]['VoiceExtensionId'],'context':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x17')],'exten':_0x6ec715[_0x5a94e3][0x0]['exten'],'priority':_0x17185d[_0x63bd('0xf')]++,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0]['VoiceExtensionId']});var _0x164b04=_0x17185d[_0x63bd('0xf')]++;_0x17185d[_0x63bd('0x10')][_0x63bd('0x13')]({'type':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')],'app':_0x63bd('0x1d'),'appdata':_0x63bd('0x1e')+(_0x164b04+0x2)+_0x63bd('0x1f')+(_0x164b04+0x1)+')','context':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x17')],'exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')],'priority':_0x164b04,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0]['VoiceExtensionId']});if(_0x17185d[_0x63bd('0x11')]){_0x17185d[_0x63bd('0x10')][_0x63bd('0x13')]({'type':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')],'app':'Set','appdata':_0x17185d['extension'][_0x63bd('0x20')]?_0x63bd('0x21')+_0x17185d[_0x63bd('0x11')][_0x63bd('0x20')]+'}':'CDR(prefix)=noprefix','context':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x17')],'exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')],'priority':_0x17185d[_0x63bd('0xf')]++,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0]['VoiceExtensionId']});}_0x17185d[_0x63bd('0x10')]['push']({'type':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')],'app':_0x63bd('0x15'),'appdata':_0x63bd('0x22')+_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x1a')],'context':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x17')],'exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')],'priority':_0x17185d['priority']++,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x1a')]});if(_0x17185d[_0x63bd('0x11')]&&_0x17185d[_0x63bd('0x11')][_0x63bd('0x23')](_0x63bd('0x24'))&&_0x17185d[_0x63bd('0x11')][_0x63bd('0x24')]!==_0x63bd('0x25')){_0x17185d[_0x63bd('0x10')][_0x63bd('0x13')]({'type':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')],'app':_0x63bd('0x15'),'appdata':_0x63bd('0x26'),'context':_0x6ec715[_0x5a94e3][0x0]['context'],'exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')],'priority':_0x17185d['priority']++,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x1a')]});_0x17185d[_0x63bd('0x10')]['push']({'type':_0x6ec715[_0x5a94e3][0x0]['type'],'app':_0x63bd('0x15'),'appdata':_0x63bd('0x27')+_0x17185d['extension'][_0x63bd('0x24')]||_0x63bd('0x28'),'context':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x17')],'exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')],'priority':_0x17185d[_0x63bd('0xf')]++,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0]['VoiceExtensionId']});}}_0x17185d[_0x63bd('0x10')][_0x63bd('0x13')]({'type':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')],'app':'Set','appdata':_0x63bd('0x29'),'context':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x17')],'exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')],'priority':_0x17185d[_0x63bd('0xf')]++,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x1a')]});_0x17185d['extensions'][_0x63bd('0x13')]({'type':_0x6ec715[_0x5a94e3][0x0]['type'],'app':_0x63bd('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x17')],'exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')],'priority':_0x17185d['priority']++,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x1a')]});_0x17185d['extensions']['push']({'type':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')],'app':'Set','appdata':_0x63bd('0x2a'),'context':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x17')],'exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')],'priority':_0x17185d[_0x63bd('0xf')]++,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x1a')]});for(var _0x4522f6=0x0,_0x5383c6=0x0;_0x4522f6<_0x6ec715[_0x5a94e3][_0x63bd('0x2b')];_0x4522f6+=0x1,_0x5383c6=0x0){var _0x285488=_0x6ec715[_0x5a94e3][_0x4522f6];if(_0x285488[_0x63bd('0x14')]){_0x285488[_0x63bd('0x14')]=_0x285488['type'][_0x63bd('0x2c')]();}var _0x7df723=[];var _0x3006b1=[];delete _0x285488['id'];delete _0x285488[_0x63bd('0x2d')];delete _0x285488[_0x63bd('0x2e')];var _0xb5a99f=_0x285488['interval']!=='*,*,*,*'?[_0x285488[_0x63bd('0x2f')]]:_0x285488[_0x63bd('0x30')]?_[_0x63bd('0x8')](_[_0x63bd('0xb')](_0x17185d[_0x63bd('0x31')],{'IntervalId':_0x285488['IntervalId']}),_0x63bd('0x2f')):[];if(_0x285488['hasOwnProperty']('tag')){if(_0x285488[_0x63bd('0x32')]&&_0x285488['tag']!=='--'){_0x7df723['push']({'type':_0x285488['type'],'app':_0x63bd('0x15'),'appdata':'CDR(tag)='+_0x285488['tag'],'context':_0x285488[_0x63bd('0x17')],'exten':_0x285488[_0x63bd('0x9')],'priority':_0xb5a99f[_0x63bd('0x2b')]+_0x17185d[_0x63bd('0xf')]+_0x5383c6++,'VoiceExtensionId':_0x285488['VoiceExtensionId']});}}if(_0x285488[_0x63bd('0x14')]===_0x63bd('0x33')&&_0x285488[_0x63bd('0x23')](_0x63bd('0x34'))){if(_0x285488[_0x63bd('0x34')]){_0x7df723[_0x63bd('0x13')]({'type':_0x285488[_0x63bd('0x14')],'app':_0x63bd('0x1d'),'appdata':_0x63bd('0x35')+_0x285488[_0x63bd('0x34')]+')','context':_0x285488[_0x63bd('0x17')],'exten':_0x285488['exten'],'priority':_0xb5a99f['length']+_0x17185d[_0x63bd('0xf')]+_0x5383c6++,'VoiceExtensionId':_0x285488[_0x63bd('0x1a')]});}else{_0x7df723[_0x63bd('0x13')]({'type':_0x285488[_0x63bd('0x14')],'app':_0x63bd('0x1d'),'appdata':_0x63bd('0x36'),'context':_0x285488['context'],'exten':_0x285488[_0x63bd('0x9')],'priority':_0xb5a99f['length']+_0x17185d[_0x63bd('0xf')]+_0x5383c6++,'VoiceExtensionId':_0x285488[_0x63bd('0x1a')]});}}if(_0x285488[_0x63bd('0x23')]('answer')){if(_0x1e1b21[_0x63bd('0x37')](_0x285488[_0x63bd('0x38')][_0x63bd('0x2c')]())>=0x0&&_0x285488[_0x63bd('0x39')]!=='custom'){if(_0x285488[_0x63bd('0x3a')]){_0x7df723[_0x63bd('0x13')]({'type':_0x285488[_0x63bd('0x14')],'app':'ExecIf','appdata':_0x63bd('0x3b'),'context':_0x285488[_0x63bd('0x17')],'exten':_0x285488['exten'],'priority':_0xb5a99f[_0x63bd('0x2b')]+_0x17185d[_0x63bd('0xf')]+_0x5383c6++,'VoiceExtensionId':_0x285488[_0x63bd('0x1a')]});_0x7df723[_0x63bd('0x13')]({'type':_0x285488[_0x63bd('0x14')],'app':_0x63bd('0x15'),'appdata':_0x63bd('0x3c'),'context':_0x285488[_0x63bd('0x17')],'exten':_0x285488[_0x63bd('0x9')],'priority':_0xb5a99f[_0x63bd('0x2b')]+_0x17185d[_0x63bd('0xf')]+_0x5383c6++,'VoiceExtensionId':_0x285488['VoiceExtensionId']});}else{_0x7df723[_0x63bd('0x13')]({'type':_0x285488['type'],'app':'ExecIf','appdata':_0x63bd('0x3d'),'context':_0x285488[_0x63bd('0x17')],'exten':_0x285488['exten'],'priority':_0xb5a99f[_0x63bd('0x2b')]+_0x17185d[_0x63bd('0xf')]+_0x5383c6++,'VoiceExtensionId':_0x285488[_0x63bd('0x1a')]});_0x7df723[_0x63bd('0x13')]({'type':_0x285488[_0x63bd('0x14')],'app':_0x63bd('0x15'),'appdata':_0x63bd('0x3e'),'context':_0x285488[_0x63bd('0x17')],'exten':_0x285488['exten'],'priority':_0xb5a99f[_0x63bd('0x2b')]+_0x17185d[_0x63bd('0xf')]+_0x5383c6++,'VoiceExtensionId':_0x285488[_0x63bd('0x1a')]});}}}for(var _0x6f3a31=0x0;_0x6f3a31<_0xb5a99f[_0x63bd('0x2b')];_0x6f3a31+=0x1){var _0x516508=_0x17185d[_0x63bd('0xf')]+_0xb5a99f[_0x63bd('0x2b')];var _0x2b18e0=_0x6f3a31===_0xb5a99f[_0x63bd('0x2b')]-0x1?_0x17185d[_0x63bd('0xf')]+_0x7df723[_0x63bd('0x2b')]+_0x3006b1[_0x63bd('0x2b')]+0x2:_0x17185d[_0x63bd('0xf')]+_0x6f3a31+0x1;_0x7df723['splice'](_0x6f3a31,0x0,{'type':_0x285488[_0x63bd('0x14')],'app':_0x63bd('0x3f'),'appdata':_0xb5a99f[_0x6f3a31]+'?'+_0x285488[_0x63bd('0x17')]+_0x63bd('0x40')+_0x516508+':'+_0x285488[_0x63bd('0x17')]+_0x63bd('0x40')+_0x2b18e0,'exten':_0x285488['exten'],'context':_0x285488[_0x63bd('0x17')],'priority':_0x17185d['priority']+_0x6f3a31,'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x1a')]});}_0x285488[_0x63bd('0xf')]=_0x7df723[_0x63bd('0x2b')]?_[_0x63bd('0x41')](_0x7df723)[_0x63bd('0xf')]+0x1:_0x17185d[_0x63bd('0xf')];_0x17185d['priority']=(_0x3006b1[_0x63bd('0x2b')]?_['last'](_0x3006b1)[_0x63bd('0xf')]:_0x285488[_0x63bd('0xf')])+0x1;_0x17185d[_0x63bd('0x10')]=_[_0x63bd('0x42')](_0x17185d[_0x63bd('0x10')],_0x7df723,[_0x285488],_0x3006b1);}_0x17185d['extensions'][_0x63bd('0x13')]({'type':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x14')],'app':'Hangup','exten':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x9')],'context':_0x6ec715[_0x5a94e3][0x0]['context'],'priority':_0x17185d[_0x63bd('0xf')],'VoiceExtensionId':_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x1a')]});_0x1a9136['push'](_0x6ec715[_0x5a94e3][0x0][_0x63bd('0x1a')]);_0x289ed3=_[_0x63bd('0x42')](_0x289ed3,_0x17185d['extensions']);}}return _0x513377[_0x63bd('0x43')](function(_0x11813f){return _0x513377[_0x63bd('0x2')][_0x63bd('0x5')][_0x63bd('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x1a9136}},'transaction':_0x11813f})[_0x63bd('0x6')](function(_0x1a6631){return _0x513377[_0x63bd('0x2')]['VoiceExtension'][_0x63bd('0x45')](_[_0x63bd('0x46')](_0x289ed3,_0x63bd('0xf')),{'transaction':_0x11813f});});});})['catch'](function(_0x57b9e2){console[_0x63bd('0x47')](_0x57b9e2);});}exports[_0x63bd('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 33ce109..4422975 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 _0x1101=['phone','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','CmContact','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','ContactId','updatedAt','select','field','NOW()','scheduledAt','toString','ListId','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','fromQuery','str','calleridnum','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','CmList','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!'];(function(_0x114b54,_0x2c67ab){var _0x1ae37b=function(_0x5c1cf8){while(--_0x5c1cf8){_0x114b54['push'](_0x114b54['shift']());}};_0x1ae37b(++_0x2c67ab);}(_0x1101,0x1a3));var _0x1110=function(_0x3cf8af,_0x450233){_0x3cf8af=_0x3cf8af-0x0;var _0x1435ae=_0x1101[_0x3cf8af];return _0x1435ae;};'use strict';var BPromise=require(_0x1110('0x0'));var util=require(_0x1110('0x1'));var _=require(_0x1110('0x2'));var fs=require('fs');var squel=require(_0x1110('0x3'));var Papa=require(_0x1110('0x4'));var Redis=require(_0x1110('0x5'));var db=require(_0x1110('0x6'))['db'];var config=require(_0x1110('0x7'));var logger=require(_0x1110('0x8'))('api');config[_0x1110('0x9')]=_[_0x1110('0xa')](config[_0x1110('0x9')],{'host':_0x1110('0xb'),'port':0x18eb});var socket=require(_0x1110('0xc'))(new Redis(config['redis']));require(_0x1110('0xd'))[_0x1110('0xe')](socket);try{if(!process['argv'][0x2]||process[_0x1110('0xf')][0x2]===_0x1110('0x10')||process[_0x1110('0xf')][0x2]==='null'){throw new Error(_0x1110('0x11'));}var FILEPATH=process['argv'][0x2];if(!process[_0x1110('0xf')][0x3]||process['argv'][0x3]===_0x1110('0x10')||process[_0x1110('0xf')][0x3]===_0x1110('0x12')||!process[_0x1110('0xf')][0x4]||process[_0x1110('0xf')][0x4]==='undefined'||process[_0x1110('0xf')][0x4]===_0x1110('0x12')){throw new Error(_0x1110('0x13'));}var FIELDS=_[_0x1110('0x14')](process[_0x1110('0xf')][0x3][_0x1110('0x15')](','),process[_0x1110('0xf')][0x4]['split'](','));if(!process[_0x1110('0xf')][0x5]||process[_0x1110('0xf')][0x5]==='undefined'||process['argv'][0x5]==='null'){throw new Error(_0x1110('0x16'));}var LISTID=process[_0x1110('0xf')][0x5];var COMPANYID=process[_0x1110('0xf')][0x6]&&process[_0x1110('0xf')][0x6]!=='undefined'&&process[_0x1110('0xf')][0x6]!=='null'?process[_0x1110('0xf')][0x6]:null;var DUPLICATES=process[_0x1110('0xf')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1110('0xf')][0x7]!==_0x1110('0x12')?process[_0x1110('0xf')][0x7]:null;if(!process[_0x1110('0xf')][0x8]||process[_0x1110('0xf')][0x8]===_0x1110('0x10')||process[_0x1110('0xf')][0x8]===_0x1110('0x12')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1110('0xf')][0x8];}catch(_0xd3f65a){logger[_0x1110('0x17')](_0xd3f65a);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(_0x2f316e,_0x192000,_0x64dfd8,_0x2713bd){var _0x3b43d6={'message':_0x192000};_0x3b43d6[_0x2f316e]=!![];if(_0x64dfd8){_0x3b43d6[_0x1110('0x18')]=_0x64dfd8;}if(_0x2713bd){_0x3b43d6[_0x1110('0x19')]=_0x2713bd;}return _0x3b43d6;}function isEmail(_0x2b7bbf){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))*$/[_0x1110('0x1a')](_0x2b7bbf);}function checkRow(_0x28d3cc,_0x3f36d6,_0x1871c3){return new BPromise(function(_0x15d475,_0x1d9acc){if(_['isNil'](_0x28d3cc)){return _0x1d9acc(handleCheckRowError('error',_0x1110('0x1b'),null,_0x1871c3));}if(_0x28d3cc['errors']&&_0x28d3cc[_0x1110('0x1c')][_0x1110('0x1d')]){var _0x3bffeb=_[_0x1110('0x1e')](_0x28d3cc[_0x1110('0x1c')],_0x1110('0x1f'))[_0x1110('0x20')](';');return _0x1d9acc(handleCheckRowError(_0x1110('0x17'),_0x3bffeb,null,_0x1871c3));}var _0x572f85={};for(var _0x1c36b7 in FIELDS){if(FIELDS[_0x1110('0x21')](_0x1c36b7)&&FIELDS[_0x1c36b7]){_0x572f85[_0x1c36b7]=_0x28d3cc['data'][0x0][FIELDS[_0x1c36b7]]||_0x28d3cc[_0x1110('0x22')][0x0]['\ufeff'+FIELDS[_0x1c36b7]];}}if(!_0x572f85[_0x1110('0x23')]){return _0x1d9acc(handleCheckRowError('error',_0x1110('0x24'),null,_0x1871c3));}if(!_0x572f85[_0x1110('0x25')]){return _0x1d9acc(handleCheckRowError('error',_0x1110('0x26'),null,_0x1871c3));}if(_0x572f85['birthDate']){var _0x1cdb9c=moment(_0x572f85[_0x1110('0x27')],'YYYY-MM-DD');if(!_0x1cdb9c['isValid']()){return _0x1d9acc(handleCheckRowError(_0x1110('0x17'),_0x1110('0x28'),null,_0x1871c3));}}if(_0x572f85[_0x1110('0x29')]){if(!isEmail(_0x572f85[_0x1110('0x29')])){return _0x1d9acc(handleCheckRowError(_0x1110('0x17'),_0x1110('0x2a'),null,_0x1871c3));}}_0x572f85['ListId']=LISTID;_0x572f85[_0x1110('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1110('0x1d')]&&_0x3f36d6){var _0x24fb92={};for(var _0x2f0211=0x0,_0x4a96b5=DUPLICATES[_0x1110('0x1d')];_0x2f0211<_0x4a96b5;_0x2f0211+=0x1){_0x24fb92[DUPLICATES[_0x2f0211]]=_0x572f85[DUPLICATES[_0x2f0211]];}var _0x1258a6=_[_0x1110('0x2c')](_0x3f36d6,_0x24fb92);if(_0x1258a6){return _0x1d9acc(handleCheckRowError(_0x1110('0x2d'),'Duplicate\x20Contact',_0x1258a6,_0x1871c3));}}return db[_0x1110('0x2e')]['create'](_0x572f85,{'raw':!![],'hooks':![],'fields':_[_0x1110('0x2f')](_0x572f85)})[_0x1110('0x30')](function(_0x4d1289){if(DUPLICATES&&DUPLICATES[_0x1110('0x1d')]&&_0x3f36d6){_0x3f36d6['push'](_[_0x1110('0x31')](_0x572f85,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4d1289['id'];return _0x15d475();})[_0x1110('0x32')](function(_0x118520){return _0x1d9acc(handleCheckRowError(_0x1110('0x17'),_0x1110('0x33')+(_0x118520[_0x1110('0x1f')]||JSON['stringify'](_0x118520)),null,_0x1871c3));});});}function checkHopper(){function _0xbf23c(){return function(_0xb67ef8){logger[_0x1110('0x17')](_0x1110('0x34'),_0x1110('0x35'),util[_0x1110('0x36')](_0xb67ef8,{'showHidden':![],'depth':null}));};}var _0x240486=function(_0x94118f,_0x57504b){var _0x47e406=squel[_0x1110('0x37')]()[_0x1110('0x38')]('cm_hopper')['fromQuery']([_0x1110('0x25'),'scheduledAt',_0x1110('0x39'),'ListId',_0x57504b,'createdAt',_0x1110('0x3a')],squel[_0x1110('0x3b')]()[_0x1110('0x3c')](_0x1110('0x25'),'phone')[_0x1110('0x3c')](_0x1110('0x3d'),_0x1110('0x3e'))[_0x1110('0x3c')]('id',_0x1110('0x39'))[_0x1110('0x3c')](LISTID[_0x1110('0x3f')](),_0x1110('0x40'))[_0x1110('0x3c')](_0x94118f['id'][_0x1110('0x3f')](),_0x57504b)[_0x1110('0x3c')]('NOW()',_0x1110('0x41'))[_0x1110('0x3c')]('NOW()',_0x1110('0x3a'))[_0x1110('0x42')](_0x1110('0x43'))[_0x1110('0x44')](_0x1110('0x45'))[_0x1110('0x44')](_0x1110('0x46'),LISTID[_0x1110('0x3f')]())[_0x1110('0x44')](_0x1110('0x47'))[_0x1110('0x44')](_0x1110('0x48'),squel['select']()[_0x1110('0x3c')]('phone')[_0x1110('0x42')](_0x1110('0x49'))[_0x1110('0x44')](_0x57504b+_0x1110('0x4a'),_0x94118f['id'][_0x1110('0x3f')]())))['toString']();return _0x47e406;};var _0x3df7e9=function(_0x11fd41,_0x5ddb89){var _0x11508a=squel[_0x1110('0x37')]()[_0x1110('0x38')]('cm_hopper')[_0x1110('0x4b')]([_0x1110('0x25'),_0x1110('0x3e'),_0x1110('0x39'),'ListId',_0x5ddb89,_0x1110('0x41'),_0x1110('0x3a')],squel[_0x1110('0x3b')]()[_0x1110('0x3c')]('phone','phone')[_0x1110('0x3c')]('NOW()',_0x1110('0x3e'))[_0x1110('0x3c')]('id',_0x1110('0x39'))[_0x1110('0x3c')](LISTID[_0x1110('0x3f')](),_0x1110('0x40'))[_0x1110('0x3c')](_0x11fd41['id'][_0x1110('0x3f')](),_0x5ddb89)[_0x1110('0x3c')](_0x1110('0x3d'),_0x1110('0x41'))[_0x1110('0x3c')](_0x1110('0x3d'),'updatedAt')[_0x1110('0x42')](_0x1110('0x43'))[_0x1110('0x44')](_0x1110('0x45'))[_0x1110('0x44')](_0x1110('0x46'),LISTID[_0x1110('0x3f')]())[_0x1110('0x44')]('id\x20IN\x20?',squel[_0x1110('0x4c')](hopperContacts))[_0x1110('0x44')](_0x1110('0x47'))[_0x1110('0x44')](_0x1110('0x48'),squel[_0x1110('0x3b')]()[_0x1110('0x3c')](_0x1110('0x4d'))[_0x1110('0x42')]('cm_hopper_final')[_0x1110('0x44')](_0x5ddb89+_0x1110('0x4a'),_0x11fd41['id']['toString']()))['where'](_0x1110('0x48'),squel[_0x1110('0x3b')]()[_0x1110('0x3c')]('phone')[_0x1110('0x42')](_0x1110('0x49'))[_0x1110('0x44')](_0x5ddb89+_0x1110('0x4a'),_0x11fd41['id']['toString']())))[_0x1110('0x3f')]();return _0x11508a;};function _0x2674d6(_0x25c641,_0x5ccc7c){var _0x2f007d=squel[_0x1110('0x37')]()['into']('cm_hopper')['fromQuery'](['phone',_0x1110('0x3e'),_0x1110('0x39'),'ListId',_0x5ccc7c,_0x1110('0x41'),'updatedAt'],squel['select']()['field']('phone',_0x1110('0x25'))[_0x1110('0x3c')](_0x1110('0x3d'),'scheduledAt')[_0x1110('0x3c')]('id',_0x1110('0x39'))[_0x1110('0x3c')](LISTID[_0x1110('0x3f')](),_0x1110('0x40'))['field'](_0x25c641['id']['toString'](),_0x5ccc7c)['field'](_0x1110('0x3d'),_0x1110('0x41'))[_0x1110('0x3c')](_0x1110('0x3d'),_0x1110('0x3a'))['from']('cm_contacts')['where'](_0x1110('0x45'))['where'](_0x1110('0x46'),LISTID[_0x1110('0x3f')]())[_0x1110('0x44')]('id\x20IN\x20?',squel[_0x1110('0x4c')](hopperContacts))[_0x1110('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x1110('0x3f')]();return _0x2f007d;}function _0x3660c3(_0x85962,_0x475900){var _0x36a5e4=squel[_0x1110('0x37')]()[_0x1110('0x38')]('cm_hopper_black')[_0x1110('0x4b')]([_0x1110('0x25'),'ContactId',_0x1110('0x40'),_0x475900,_0x1110('0x41'),'updatedAt'],squel[_0x1110('0x3b')]()['field'](_0x1110('0x25'),'phone')['field']('id',_0x1110('0x39'))[_0x1110('0x3c')](LISTID[_0x1110('0x3f')](),_0x1110('0x40'))[_0x1110('0x3c')](_0x85962['id'][_0x1110('0x3f')](),_0x475900)[_0x1110('0x3c')](_0x1110('0x3d'),_0x1110('0x41'))[_0x1110('0x3c')](_0x1110('0x3d'),'updatedAt')[_0x1110('0x42')](_0x1110('0x43'))[_0x1110('0x44')](_0x1110('0x45'))[_0x1110('0x44')](_0x1110('0x46'),LISTID[_0x1110('0x3f')]())[_0x1110('0x44')](_0x1110('0x4e'),squel[_0x1110('0x4c')](hopperContacts))[_0x1110('0x44')](_0x1110('0x47')))[_0x1110('0x3f')]();return _0x36a5e4;}return db[_0x1110('0x4f')][_0x1110('0x50')]({'where':{'type':_0x1110('0x51')},'attributes':['id',_0x1110('0x52')],'include':[{'model':db['CmList'],'as':_0x1110('0x53'),'where':{'id':LISTID}}]})[_0x1110('0x30')](function(_0x594674){var _0xa0f397=[];if(_0x594674){var _0x121c2b;for(var _0x285abe=0x0,_0x1b12dc;_0x285abe<_0x594674[_0x1110('0x1d')];_0x285abe+=0x1){_0x1b12dc=_0x594674[_0x285abe][_0x1110('0x54')]({'plain':!![]});switch(_0x1b12dc[_0x1110('0x52')]){case _0x1110('0x55'):_0xa0f397[_0x1110('0x56')](db[_0x1110('0x57')][_0x1110('0x58')](_0x3df7e9(_0x1b12dc,_0x1110('0x59')))[_0x1110('0x30')](function(){})['catch'](_0xbf23c()));break;case _0x1110('0x5a'):_0xa0f397['push'](db[_0x1110('0x57')][_0x1110('0x58')](_0x240486(_0x1b12dc,_0x1110('0x59')))[_0x1110('0x30')](function(){})[_0x1110('0x32')](_0xbf23c()));break;default:_0xa0f397[_0x1110('0x56')](db[_0x1110('0x57')][_0x1110('0x58')](_0x2674d6(_0x1b12dc,_0x1110('0x59')))[_0x1110('0x30')](function(){})[_0x1110('0x32')](_0xbf23c()));}}}return _0xa0f397;})['all']()[_0x1110('0x30')](function(){return db[_0x1110('0x4f')][_0x1110('0x50')]({'where':{'type':_0x1110('0x51')},'attributes':['id'],'include':[{'model':db[_0x1110('0x5b')],'as':_0x1110('0x5c'),'where':{'id':LISTID}}]})[_0x1110('0x30')](function(_0x1ae3f9){var _0x4fd9e9=[];if(_0x1ae3f9){var _0x53a1db;for(var _0x366173=0x0,_0x244f15;_0x366173<_0x1ae3f9[_0x1110('0x1d')];_0x366173+=0x1){_0x244f15=_0x1ae3f9[_0x366173][_0x1110('0x54')]({'plain':!![]});_0x4fd9e9['push'](db['sequelize'][_0x1110('0x58')](_0x3660c3(_0x244f15,'VoiceQueueId'))[_0x1110('0x30')](function(){})['catch'](_0xbf23c()));}}return _0x4fd9e9;})[_0x1110('0x5d')]();})[_0x1110('0x30')](function(){return db[_0x1110('0x5e')][_0x1110('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x1110('0x53'),'where':{'id':LISTID}}]})['then'](function(_0x214145){var _0x970dd3=[];if(_0x214145){for(var _0x358cf9=0x0,_0x1762af;_0x358cf9<_0x214145[_0x1110('0x1d')];_0x358cf9+=0x1){_0x1762af=_0x214145[_0x358cf9][_0x1110('0x54')]({'plain':!![]});switch(_0x1762af[_0x1110('0x52')]){case'always':_0x970dd3[_0x1110('0x56')](db[_0x1110('0x57')]['query'](_0x3df7e9(_0x1762af,_0x1110('0x5f')))[_0x1110('0x30')](function(){})[_0x1110('0x32')](_0xbf23c()));break;case _0x1110('0x5a'):_0x970dd3[_0x1110('0x56')](db['sequelize']['query'](_0x240486(_0x1762af,'CampaignId'))[_0x1110('0x30')](function(){})['catch'](_0xbf23c()));break;default:_0x970dd3[_0x1110('0x56')](db[_0x1110('0x57')][_0x1110('0x58')](_0x2674d6(_0x1762af,_0x1110('0x5f')))[_0x1110('0x30')](function(){})[_0x1110('0x32')](_0xbf23c()));}}}return _0x970dd3;})[_0x1110('0x5d')]();})[_0x1110('0x30')](function(){return db[_0x1110('0x5e')][_0x1110('0x50')]({'attributes':['id'],'include':[{'model':db[_0x1110('0x5b')],'as':_0x1110('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x38e7c6){var _0x1d29ee=[];if(_0x38e7c6){for(var _0x15d137=0x0,_0x1e003e;_0x15d137<_0x38e7c6[_0x1110('0x1d')];_0x15d137+=0x1){_0x1e003e=_0x38e7c6[_0x15d137][_0x1110('0x54')]({'plain':!![]});_0x1d29ee['push'](db[_0x1110('0x57')]['query'](_0x3660c3(_0x1e003e,'CampaignId'))[_0x1110('0x30')](function(){})[_0x1110('0x32')](_0xbf23c()));}}return _0x1d29ee;})[_0x1110('0x5d')]();})[_0x1110('0x32')](function(_0x5a1315){logger[_0x1110('0x17')](_0x1110('0x60'),_0x1110('0x61'),_0x5a1315[_0x1110('0x1f')]);});}var processPromises=function(_0x1b2073){return BPromise[_0x1110('0x5d')](promises)[_0x1110('0x30')](function(_0x23e277){})[_0x1110('0x32')](function(_0x154115){logger['error'](_0x1110('0x62'),JSON[_0x1110('0x63')](_0x154115));})['finally'](function(){socket[_0x1110('0x64')](_0x1110('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1b2073){return _0x1b2073[_0x1110('0x66')]();}});};var endCsv=function(){return BPromise[_0x1110('0x67')]()[_0x1110('0x30')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x1110('0x64')](_0x1110('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1110('0x68')](FILEPATH);}catch(_0x2f02a6){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x2f02a6));}finally{process[_0x1110('0x69')](0x0);}});};process['on'](_0x1110('0x6a'),function(){logger[_0x1110('0x6b')](_0x1110('0x6c'));endCsv();});function main(){return BPromise[_0x1110('0x67')]()[_0x1110('0x30')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1110('0x15')](',');return db[_0x1110('0x2e')][_0x1110('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1110('0x30')](function(_0x17fe52){var _0x319365=fs[_0x1110('0x6d')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x319365,{'header':!![],'skipEmptyLines':!![],'step':function(_0x24c69d,_0x253940){total+=0x1;var _0xc60a3b=total;promises[_0x1110('0x56')](checkRow(_0x24c69d,_0x17fe52,_0xc60a3b)[_0x1110('0x30')](function(){success+=0x1;})[_0x1110('0x32')](function(_0xb49159){if(_0xb49159[_0x1110('0x17')]){errors+=0x1;delete _0xb49159[_0x1110('0x17')];}else if(_0xb49159[_0x1110('0x2d')]){duplicates+=0x1;delete _0xb49159['duplicate'];}rows[_0x1110('0x56')](_0xb49159);}));if(total%0xc8===0x0){_0x253940[_0x1110('0x6e')]();return processPromises(_0x253940);}},'complete':function(){return processPromises()[_0x1110('0x30')](function(){logger[_0x1110('0x6b')](_0x1110('0x6f'));endCsv();});},'error':function(_0x47adf2,_0x3cd5cf){logger['info'](_0x1110('0x70'),JSON['stringify'](_0x47adf2));endCsv();}});})[_0x1110('0x32')](function(_0x327ba7){logger['error'](_0x1110('0x71'),JSON[_0x1110('0x63')](_0x327ba7));});}main(); \ No newline at end of file +var _0x72e0=['cmContact','inspect','cm_hopper','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','into','fromQuery','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','str','insert','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','then','get','push','sequelize','VoiceQueueId','query','all','CmList','Campaign','always','CampaignId','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../mysqldb','../../../config/logger','api','redis','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','test','isNil','errors','length','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','duplicate','CmContact','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify'];(function(_0x2166e1,_0x4a9a63){var _0x42ada1=function(_0x1d487a){while(--_0x1d487a){_0x2166e1['push'](_0x2166e1['shift']());}};_0x42ada1(++_0x4a9a63);}(_0x72e0,0x1de));var _0x072e=function(_0x38a085,_0x46907f){_0x38a085=_0x38a085-0x0;var _0x2995ae=_0x72e0[_0x38a085];return _0x2995ae;};'use strict';var BPromise=require(_0x072e('0x0'));var util=require(_0x072e('0x1'));var _=require(_0x072e('0x2'));var fs=require('fs');var squel=require(_0x072e('0x3'));var Papa=require('papaparse');var Redis=require(_0x072e('0x4'));var db=require(_0x072e('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x072e('0x6'))(_0x072e('0x7'));config[_0x072e('0x8')]=_['defaults'](config[_0x072e('0x8')],{'host':_0x072e('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x072e('0x8')]));require(_0x072e('0xa'))[_0x072e('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x072e('0xc')][0x2]===_0x072e('0xd')||process[_0x072e('0xc')][0x2]===_0x072e('0xe')){throw new Error(_0x072e('0xf'));}var FILEPATH=process[_0x072e('0xc')][0x2];if(!process[_0x072e('0xc')][0x3]||process[_0x072e('0xc')][0x3]===_0x072e('0xd')||process[_0x072e('0xc')][0x3]===_0x072e('0xe')||!process[_0x072e('0xc')][0x4]||process[_0x072e('0xc')][0x4]===_0x072e('0xd')||process[_0x072e('0xc')][0x4]===_0x072e('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0x072e('0xc')][0x3][_0x072e('0x10')](','),process[_0x072e('0xc')][0x4][_0x072e('0x10')](','));if(!process[_0x072e('0xc')][0x5]||process[_0x072e('0xc')][0x5]==='undefined'||process[_0x072e('0xc')][0x5]===_0x072e('0xe')){throw new Error(_0x072e('0x11'));}var LISTID=process[_0x072e('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x072e('0xc')][0x6]!==_0x072e('0xd')&&process[_0x072e('0xc')][0x6]!==_0x072e('0xe')?process[_0x072e('0xc')][0x6]:null;var DUPLICATES=process[_0x072e('0xc')][0x7]&&process['argv'][0x7]!==_0x072e('0xd')&&process[_0x072e('0xc')][0x7]!==_0x072e('0xe')?process[_0x072e('0xc')][0x7]:null;if(!process[_0x072e('0xc')][0x8]||process[_0x072e('0xc')][0x8]===_0x072e('0xd')||process['argv'][0x8]===_0x072e('0xe')){throw new Error(_0x072e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x59d5cb){logger[_0x072e('0x13')](_0x59d5cb);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(_0x240b9f,_0x324b88,_0x5ceee3,_0x155d72){var _0x1e0dce={'message':_0x324b88};_0x1e0dce[_0x240b9f]=!![];if(_0x5ceee3){_0x1e0dce['contact']=_0x5ceee3;}if(_0x155d72){_0x1e0dce['index']=_0x155d72;}return _0x1e0dce;}function isEmail(_0x35b35b){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))*$/[_0x072e('0x14')](_0x35b35b);}function checkRow(_0x102081,_0x1f9486,_0x40b77c){return new BPromise(function(_0x161e14,_0x2bc6cc){if(_[_0x072e('0x15')](_0x102081)){return _0x2bc6cc(handleCheckRowError(_0x072e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x40b77c));}if(_0x102081[_0x072e('0x16')]&&_0x102081[_0x072e('0x16')][_0x072e('0x17')]){var _0x81be1c=_['map'](_0x102081[_0x072e('0x16')],_0x072e('0x18'))[_0x072e('0x19')](';');return _0x2bc6cc(handleCheckRowError(_0x072e('0x13'),_0x81be1c,null,_0x40b77c));}var _0x3bd122={};for(var _0x1c6661 in FIELDS){if(FIELDS[_0x072e('0x1a')](_0x1c6661)&&FIELDS[_0x1c6661]){_0x3bd122[_0x1c6661]=_0x102081[_0x072e('0x1b')][0x0][FIELDS[_0x1c6661]]||_0x102081['data'][0x0]['\ufeff'+FIELDS[_0x1c6661]];}}if(!_0x3bd122['firstName']){return _0x2bc6cc(handleCheckRowError(_0x072e('0x13'),_0x072e('0x1c'),null,_0x40b77c));}if(!_0x3bd122['phone']){return _0x2bc6cc(handleCheckRowError(_0x072e('0x13'),'phone\x20not\x20specified!',null,_0x40b77c));}if(_0x3bd122['birthDate']){var _0x5d1245=moment(_0x3bd122[_0x072e('0x1d')],_0x072e('0x1e'));if(!_0x5d1245[_0x072e('0x1f')]()){return _0x2bc6cc(handleCheckRowError(_0x072e('0x13'),_0x072e('0x20'),null,_0x40b77c));}}if(_0x3bd122[_0x072e('0x21')]){if(!isEmail(_0x3bd122[_0x072e('0x21')])){return _0x2bc6cc(handleCheckRowError(_0x072e('0x13'),'email\x20format\x20is\x20not\x20valid!',null,_0x40b77c));}}_0x3bd122[_0x072e('0x22')]=LISTID;_0x3bd122[_0x072e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x1f9486){var _0x414698={};for(var _0x2bcd99=0x0,_0x419bbe=DUPLICATES[_0x072e('0x17')];_0x2bcd99<_0x419bbe;_0x2bcd99+=0x1){_0x414698[DUPLICATES[_0x2bcd99]]=_0x3bd122[DUPLICATES[_0x2bcd99]];}var _0x31da78=_['find'](_0x1f9486,_0x414698);if(_0x31da78){return _0x2bc6cc(handleCheckRowError(_0x072e('0x24'),'Duplicate\x20Contact',_0x31da78,_0x40b77c));}}return db[_0x072e('0x25')]['create'](_0x3bd122,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3bd122)})['then'](function(_0x41870a){if(DUPLICATES&&DUPLICATES[_0x072e('0x17')]&&_0x1f9486){_0x1f9486['push'](_[_0x072e('0x26')](_0x3bd122,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x41870a['id'];return _0x161e14();})[_0x072e('0x27')](function(_0x5635af){return _0x2bc6cc(handleCheckRowError(_0x072e('0x13'),_0x072e('0x28')+(_0x5635af[_0x072e('0x18')]||JSON[_0x072e('0x29')](_0x5635af)),null,_0x40b77c));});});}function checkHopper(){function _0x2b85ae(){return function(_0x372957){logger[_0x072e('0x13')](_0x072e('0x2a'),'checkHopper',util[_0x072e('0x2b')](_0x372957,{'showHidden':![],'depth':null}));};}var _0x558e4f=function(_0x451769,_0x567324){var _0x555f85=squel['insert']()['into'](_0x072e('0x2c'))['fromQuery']([_0x072e('0x2d'),_0x072e('0x2e'),_0x072e('0x2f'),_0x072e('0x22'),_0x567324,_0x072e('0x30'),_0x072e('0x31')],squel[_0x072e('0x32')]()['field'](_0x072e('0x2d'),_0x072e('0x2d'))[_0x072e('0x33')](_0x072e('0x34'),_0x072e('0x2e'))[_0x072e('0x33')]('id',_0x072e('0x2f'))['field'](LISTID[_0x072e('0x35')](),_0x072e('0x22'))[_0x072e('0x33')](_0x451769['id'][_0x072e('0x35')](),_0x567324)['field'](_0x072e('0x34'),_0x072e('0x30'))[_0x072e('0x33')]('NOW()',_0x072e('0x31'))[_0x072e('0x36')](_0x072e('0x37'))[_0x072e('0x38')](_0x072e('0x39'))[_0x072e('0x38')](_0x072e('0x3a'),LISTID['toString']())[_0x072e('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0x072e('0x38')](_0x072e('0x3b'),squel[_0x072e('0x32')]()[_0x072e('0x33')]('phone')[_0x072e('0x36')](_0x072e('0x2c'))['where'](_0x567324+'\x20=\x20?',_0x451769['id'][_0x072e('0x35')]())))[_0x072e('0x35')]();return _0x555f85;};var _0x21b5eb=function(_0x394988,_0x3c19e8){var _0x2d6553=squel['insert']()[_0x072e('0x3c')](_0x072e('0x2c'))[_0x072e('0x3d')](['phone',_0x072e('0x2e'),_0x072e('0x2f'),_0x072e('0x22'),_0x3c19e8,'createdAt',_0x072e('0x31')],squel[_0x072e('0x32')]()[_0x072e('0x33')](_0x072e('0x2d'),'phone')['field'](_0x072e('0x34'),_0x072e('0x2e'))['field']('id',_0x072e('0x2f'))[_0x072e('0x33')](LISTID[_0x072e('0x35')](),_0x072e('0x22'))[_0x072e('0x33')](_0x394988['id'][_0x072e('0x35')](),_0x3c19e8)[_0x072e('0x33')]('NOW()','createdAt')['field']('NOW()',_0x072e('0x31'))[_0x072e('0x36')](_0x072e('0x37'))[_0x072e('0x38')](_0x072e('0x39'))[_0x072e('0x38')]('ListId\x20=\x20?',LISTID[_0x072e('0x35')]())[_0x072e('0x38')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x072e('0x38')](_0x072e('0x3e'))[_0x072e('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x072e('0x32')]()['field'](_0x072e('0x3f'))[_0x072e('0x36')](_0x072e('0x40'))['where'](_0x3c19e8+_0x072e('0x41'),_0x394988['id'][_0x072e('0x35')]()))['where'](_0x072e('0x3b'),squel[_0x072e('0x32')]()[_0x072e('0x33')](_0x072e('0x2d'))[_0x072e('0x36')](_0x072e('0x2c'))['where'](_0x3c19e8+_0x072e('0x41'),_0x394988['id'][_0x072e('0x35')]())))[_0x072e('0x35')]();return _0x2d6553;};function _0x340ec4(_0x8fdefb,_0xb309b8){var _0x13ae5b=squel['insert']()[_0x072e('0x3c')](_0x072e('0x2c'))[_0x072e('0x3d')]([_0x072e('0x2d'),_0x072e('0x2e'),'ContactId','ListId',_0xb309b8,_0x072e('0x30'),_0x072e('0x31')],squel['select']()[_0x072e('0x33')](_0x072e('0x2d'),_0x072e('0x2d'))[_0x072e('0x33')]('NOW()','scheduledAt')[_0x072e('0x33')]('id',_0x072e('0x2f'))['field'](LISTID['toString'](),_0x072e('0x22'))[_0x072e('0x33')](_0x8fdefb['id']['toString'](),_0xb309b8)[_0x072e('0x33')](_0x072e('0x34'),'createdAt')[_0x072e('0x33')](_0x072e('0x34'),'updatedAt')[_0x072e('0x36')]('cm_contacts')[_0x072e('0x38')]('deletedAt\x20IS\x20NULL')[_0x072e('0x38')]('ListId\x20=\x20?',LISTID['toString']())[_0x072e('0x38')](_0x072e('0x42'),squel[_0x072e('0x43')](hopperContacts))['where'](_0x072e('0x3e')))[_0x072e('0x35')]();return _0x13ae5b;}function _0x2e0f82(_0x5e8e20,_0x119cfa){var _0x125abf=squel[_0x072e('0x44')]()[_0x072e('0x3c')]('cm_hopper_black')[_0x072e('0x3d')]([_0x072e('0x2d'),_0x072e('0x2f'),'ListId',_0x119cfa,_0x072e('0x30'),_0x072e('0x31')],squel[_0x072e('0x32')]()[_0x072e('0x33')]('phone',_0x072e('0x2d'))['field']('id',_0x072e('0x2f'))[_0x072e('0x33')](LISTID[_0x072e('0x35')](),_0x072e('0x22'))[_0x072e('0x33')](_0x5e8e20['id'][_0x072e('0x35')](),_0x119cfa)[_0x072e('0x33')](_0x072e('0x34'),_0x072e('0x30'))['field'](_0x072e('0x34'),'updatedAt')[_0x072e('0x36')](_0x072e('0x37'))[_0x072e('0x38')](_0x072e('0x39'))[_0x072e('0x38')](_0x072e('0x3a'),LISTID[_0x072e('0x35')]())[_0x072e('0x38')]('id\x20IN\x20?',squel[_0x072e('0x43')](hopperContacts))[_0x072e('0x38')](_0x072e('0x3e')))[_0x072e('0x35')]();return _0x125abf;}return db[_0x072e('0x45')][_0x072e('0x46')]({'where':{'type':_0x072e('0x47')},'attributes':['id',_0x072e('0x48')],'include':[{'model':db['CmList'],'as':_0x072e('0x49'),'where':{'id':LISTID}}]})[_0x072e('0x4a')](function(_0x43fa2a){var _0x34e755=[];if(_0x43fa2a){var _0x202c5f;for(var _0x3fd1e8=0x0,_0x37c5ec;_0x3fd1e8<_0x43fa2a['length'];_0x3fd1e8+=0x1){_0x37c5ec=_0x43fa2a[_0x3fd1e8][_0x072e('0x4b')]({'plain':!![]});switch(_0x37c5ec[_0x072e('0x48')]){case'always':_0x34e755[_0x072e('0x4c')](db[_0x072e('0x4d')]['query'](_0x21b5eb(_0x37c5ec,_0x072e('0x4e')))[_0x072e('0x4a')](function(){})['catch'](_0x2b85ae()));break;case'onlyIfOpen':_0x34e755[_0x072e('0x4c')](db['sequelize'][_0x072e('0x4f')](_0x558e4f(_0x37c5ec,'VoiceQueueId'))[_0x072e('0x4a')](function(){})['catch'](_0x2b85ae()));break;default:_0x34e755[_0x072e('0x4c')](db['sequelize'][_0x072e('0x4f')](_0x340ec4(_0x37c5ec,_0x072e('0x4e')))[_0x072e('0x4a')](function(){})[_0x072e('0x27')](_0x2b85ae()));}}}return _0x34e755;})[_0x072e('0x50')]()[_0x072e('0x4a')](function(){return db[_0x072e('0x45')][_0x072e('0x46')]({'where':{'type':_0x072e('0x47')},'attributes':['id'],'include':[{'model':db[_0x072e('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x2e8847){var _0x1dd296=[];if(_0x2e8847){var _0x25f9b6;for(var _0x1d2530=0x0,_0x53627a;_0x1d2530<_0x2e8847[_0x072e('0x17')];_0x1d2530+=0x1){_0x53627a=_0x2e8847[_0x1d2530][_0x072e('0x4b')]({'plain':!![]});_0x1dd296[_0x072e('0x4c')](db[_0x072e('0x4d')][_0x072e('0x4f')](_0x2e0f82(_0x53627a,_0x072e('0x4e')))[_0x072e('0x4a')](function(){})['catch'](_0x2b85ae()));}}return _0x1dd296;})[_0x072e('0x50')]();})[_0x072e('0x4a')](function(){return db[_0x072e('0x52')][_0x072e('0x46')]({'attributes':['id',_0x072e('0x48')],'include':[{'model':db[_0x072e('0x51')],'as':'Lists','where':{'id':LISTID}}]})[_0x072e('0x4a')](function(_0x4800cf){var _0x1a193e=[];if(_0x4800cf){for(var _0x368163=0x0,_0x3edbfe;_0x368163<_0x4800cf[_0x072e('0x17')];_0x368163+=0x1){_0x3edbfe=_0x4800cf[_0x368163][_0x072e('0x4b')]({'plain':!![]});switch(_0x3edbfe['dialCheckDuplicateType']){case _0x072e('0x53'):_0x1a193e[_0x072e('0x4c')](db[_0x072e('0x4d')][_0x072e('0x4f')](_0x21b5eb(_0x3edbfe,_0x072e('0x54')))[_0x072e('0x4a')](function(){})[_0x072e('0x27')](_0x2b85ae()));break;case _0x072e('0x55'):_0x1a193e[_0x072e('0x4c')](db[_0x072e('0x4d')]['query'](_0x558e4f(_0x3edbfe,_0x072e('0x54')))['then'](function(){})[_0x072e('0x27')](_0x2b85ae()));break;default:_0x1a193e['push'](db['sequelize'][_0x072e('0x4f')](_0x340ec4(_0x3edbfe,_0x072e('0x54')))[_0x072e('0x4a')](function(){})[_0x072e('0x27')](_0x2b85ae()));}}}return _0x1a193e;})[_0x072e('0x50')]();})[_0x072e('0x4a')](function(){return db[_0x072e('0x52')][_0x072e('0x46')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x072e('0x56'),'where':{'id':LISTID}}]})[_0x072e('0x4a')](function(_0x1b10b0){var _0x9f3213=[];if(_0x1b10b0){for(var _0x250159=0x0,_0x2e16d1;_0x250159<_0x1b10b0[_0x072e('0x17')];_0x250159+=0x1){_0x2e16d1=_0x1b10b0[_0x250159]['get']({'plain':!![]});_0x9f3213[_0x072e('0x4c')](db[_0x072e('0x4d')][_0x072e('0x4f')](_0x2e0f82(_0x2e16d1,_0x072e('0x54')))[_0x072e('0x4a')](function(){})[_0x072e('0x27')](_0x2b85ae()));}}return _0x9f3213;})[_0x072e('0x50')]();})[_0x072e('0x27')](function(_0x2a8031){logger[_0x072e('0x13')](_0x072e('0x57'),_0x072e('0x58'),_0x2a8031[_0x072e('0x18')]);});}var processPromises=function(_0x40d128){return BPromise[_0x072e('0x50')](promises)[_0x072e('0x4a')](function(_0x503b67){})['catch'](function(_0x3254ec){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x072e('0x29')](_0x3254ec));})[_0x072e('0x59')](function(){socket[_0x072e('0x5a')](_0x072e('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x40d128){return _0x40d128['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x072e('0x4a')](function(){if(hopperContacts){return checkHopper();}})[_0x072e('0x4a')](function(){socket[_0x072e('0x5a')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x072e('0x5c')](FILEPATH);}catch(_0x34d92e){logger[_0x072e('0x13')](_0x072e('0x5d'),JSON['stringify'](_0x34d92e));}finally{process[_0x072e('0x5e')](0x0);}});};process['on']('SIGINT',function(){logger[_0x072e('0x5f')](_0x072e('0x60'));endCsv();});function main(){return BPromise[_0x072e('0x61')]()[_0x072e('0x4a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x072e('0x10')](',');return db['CmContact'][_0x072e('0x46')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x072e('0x4a')](function(_0xb285f){var _0x4eef26=fs[_0x072e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x072e('0x63')](_0x4eef26,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3169bc,_0x276d09){total+=0x1;var _0x1a4c9e=total;promises[_0x072e('0x4c')](checkRow(_0x3169bc,_0xb285f,_0x1a4c9e)[_0x072e('0x4a')](function(){success+=0x1;})[_0x072e('0x27')](function(_0x53529e){if(_0x53529e[_0x072e('0x13')]){errors+=0x1;delete _0x53529e[_0x072e('0x13')];}else if(_0x53529e[_0x072e('0x24')]){duplicates+=0x1;delete _0x53529e[_0x072e('0x24')];}rows[_0x072e('0x4c')](_0x53529e);}));if(total%0xc8===0x0){_0x276d09[_0x072e('0x64')]();return processPromises(_0x276d09);}},'complete':function(){return processPromises()[_0x072e('0x4a')](function(){logger[_0x072e('0x5f')](_0x072e('0x65'));endCsv();});},'error':function(_0x532cc9,_0x1b9e6f){logger[_0x072e('0x5f')](_0x072e('0x66'),JSON['stringify'](_0x532cc9));endCsv();}});})[_0x072e('0x27')](function(_0x33c7a6){logger['error'](_0x072e('0x67'),JSON['stringify'](_0x33c7a6));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index ed17140..c31c0d3 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 _0x0bb7=['lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','where','CmContact','findAll','AdditionalPhones','push','then','length','all','split','isNil','filter','CmContactHasItem','findOne','update','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','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','createdAt','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','offset','query','main','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','ContactItemType','name','_description','header','writeFileSync','createReadStream','data','rows','find','hasOwnProperty','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_blacklists','campaigns','CampaignId','VoiceQueueId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path'];(function(_0x363b86,_0x2bdc0d){var _0x4af218=function(_0x28179b){while(--_0x28179b){_0x363b86['push'](_0x363b86['shift']());}};_0x4af218(++_0x2bdc0d);}(_0x0bb7,0xb4));var _0x70bb=function(_0x19eb04,_0x376f4f){_0x19eb04=_0x19eb04-0x0;var _0x1df3f1=_0x0bb7[_0x19eb04];return _0x1df3f1;};'use strict';var fs=require('fs');var path=require(_0x70bb('0x0'));var _=require(_0x70bb('0x1'));var Papa=require(_0x70bb('0x2'));var util=require(_0x70bb('0x3'));var BPromise=require(_0x70bb('0x4'));var moment=require(_0x70bb('0x5'));var squel=require(_0x70bb('0x6'));var Redis=require('ioredis');var db=require(_0x70bb('0x7'))['db'];var config=require(_0x70bb('0x8'));var shared=require(_0x70bb('0x9'));var logger=require(_0x70bb('0xa'))('import');config[_0x70bb('0xb')]=_[_0x70bb('0xc')](config[_0x70bb('0xb')],{'host':_0x70bb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x70bb('0xe')](_0x70bb('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x70bb('0xf'));function isEmail(_0x3df1fe){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))*$/[_0x70bb('0x10')](_0x3df1fe);}function selectNotIn(_0x41c808,_0x4b3dd6,_0xbbf926,_0x3c6c4f,_0x595ae2){return squel[_0x70bb('0x11')]()[_0x70bb('0x12')](_0x70bb('0x13'))[_0x70bb('0x14')](_0x3c6c4f)[_0x70bb('0x15')](_0x4b3dd6,null,_0x4b3dd6+'.id\x20=\x20'+_0x3c6c4f+'.'+_0xbbf926)[_0x70bb('0x16')](_0x3c6c4f+'.'+_0xbbf926+'\x20=\x20'+_0x41c808+'.'+_0xbbf926)[_0x70bb('0x16')](_0x4b3dd6+'.dialCheckDuplicateType\x20IN\x20('+_0x595ae2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x543841,_0x28d920){promisesAdditionalPhones=[];return db[_0x70bb('0x17')][_0x70bb('0x18')]({'raw':!![],'attributes':['id',_0x70bb('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x40d17b){if(_0x40d17b!==null){var _0x4d9c77=[];for(var _0x32fb13=0x0;_0x32fb13<_0x40d17b['length'];_0x32fb13++){var _0x51bc05=_0x40d17b[_0x32fb13];_0x4d9c77[_0x70bb('0x1a')](insertAdditionalPhones(_0x51bc05));}}Promise['all'](_0x4d9c77)[_0x70bb('0x1b')](function(){_0x543841({'val':0x1});});});});}function insertAdditionalPhones(_0x16d533){return new Promise(function(_0x48874e,_0x4f867d){var _0x389167=_0x16d533['AdditionalPhones'];var _0x58758e=_0x389167['split'](';');var _0x33698a=[];orderBy=0x0;for(var _0xa2cf55=0x0;_0xa2cf55<_0x58758e[_0x70bb('0x1c')];_0xa2cf55++){_0x33698a[_0x70bb('0x1a')](splitAdditionalPhone(_0x16d533['id'],_0x58758e[_0xa2cf55]));}Promise[_0x70bb('0x1d')](_0x33698a)[_0x70bb('0x1b')](function(){_0x48874e({'val':_0x58758e[_0x70bb('0x1c')]});});});}function splitAdditionalPhone(_0x3484dc,_0x17d913){return new Promise(function(_0x23a0ca,_0x5d3d8f){var _0x19863b=_0x17d913[_0x70bb('0x1e')](':');var _0x452f39=_0x19863b[0x0];var _0x5deeef=_0x19863b[0x1];if(!_[_0x70bb('0x1f')](_0x5deeef)){var _0x38d3ad=_0x5deeef[_0x70bb('0x1e')]('|');var _0x5d4e35=[];for(var _0x3673ff=0x0;_0x3673ff<_0x38d3ad[_0x70bb('0x1c')];_0x3673ff++){if(_0x38d3ad[_0x3673ff]!==''){var _0x53097b=_[_0x70bb('0x20')](promisesAdditionalPhones,{'contactId':_0x3484dc,'phone':_0x38d3ad[_0x3673ff]});if(_0x53097b[_0x70bb('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x70bb('0x1a')]({'contactId':_0x3484dc,'contactTypeId':_0x452f39,'phone':_0x38d3ad[_0x3673ff],'orderBy':orderBy});}}}_0x23a0ca({'ok':0x1});}else _0x23a0ca({'res':0x0});});}function createAdditionalPhone(_0x3b3da6,_0xf97407,_0x5b06cd,_0x36a634){var _0x18835b='';var _0x1cfbd0='';var _0x134a03=_0x5b06cd[_0x70bb('0x1e')]('§');_0x18835b=_0x134a03[0x0];if(_0x134a03[_0x70bb('0x1c')]==0x2)_0x1cfbd0=_0x134a03[0x1];return new Promise(function(_0x14f9e5,_0x468c8c){return db[_0x70bb('0x21')][_0x70bb('0x22')]({'where':{'CmContactId':_0x3b3da6,'item':_0x18835b}})[_0x70bb('0x1b')](function(_0x344bb1){if(_0x344bb1){return db['CmContactHasItem'][_0x70bb('0x23')]({'ItemTypeId':_0xf97407,'description':_0x1cfbd0,'OrderBy':_0x36a634},{'where':{'CmContactId':_0x3b3da6,'item':_0x18835b}})[_0x70bb('0x1b')](function(_0x4acdaf){_0x14f9e5({'res':'updated'});});}else{return db[_0x70bb('0x21')]['create']({'CmContactId':_0x3b3da6,'item':_0x18835b,'description':_0x1cfbd0,'ItemTypeId':_0xf97407,'OrderBy':_0x36a634,'ItemClass':'PHONE'})[_0x70bb('0x1b')](function(_0x54a0e0){_0x14f9e5({'res':'inserted'});});}});});}function insertCmHopper(_0x39701e,_0x28064a,_0x267d53,_0x4e76d3,_0x52b812){var _0x297322=['cm_contacts.phone',_0x70bb('0x24'),_0x70bb('0x25'),_0x70bb('0x26'),_0x28064a+'.'+_0x4e76d3,_0x70bb('0x27'),_0x70bb('0x28'),_0x70bb('0x29'),_0x70bb('0x2a'),'\x22'+_0x52b812+'\x22'];return squel[_0x70bb('0x2b')]()[_0x70bb('0x2c')](_0x70bb('0x2d'))[_0x70bb('0x2e')]([_0x70bb('0x13'),_0x70bb('0x2f'),_0x70bb('0x30'),_0x70bb('0x31'),_0x4e76d3,'createdAt',_0x70bb('0x32'),_0x70bb('0x33'),_0x70bb('0x34'),_0x70bb('0x35')],squel[_0x70bb('0x11')]()[_0x70bb('0x36')](_0x297322)['from'](_0x28064a)[_0x70bb('0x15')](_0x70bb('0x37'),null,_0x70bb('0x38')+_0x28064a+_0x70bb('0x39'))['join'](_0x267d53,null,_0x267d53+_0x70bb('0x3a')+_0x28064a+'.'+_0x4e76d3)[_0x70bb('0x16')](_0x28064a+_0x70bb('0x3b'),_0x39701e)[_0x70bb('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x70bb('0x16')](_0x70bb('0x3c'),selectNotIn(_0x28064a,_0x267d53,_0x4e76d3,_0x70bb('0x2d'),[_0x70bb('0x3d'),_0x70bb('0x3e')]))[_0x70bb('0x16')](_0x70bb('0x3c'),selectNotIn(_0x28064a,_0x267d53,_0x4e76d3,_0x70bb('0x2d'),[_0x70bb('0x3d')])))[_0x70bb('0x3f')]();}function insertCmHopperBlack(_0x1c2346,_0x5f5af2,_0x628605,_0xf875c3){var _0x24df55=[_0x70bb('0x40'),_0x70bb('0x25'),_0x70bb('0x26'),_0x5f5af2+'.'+_0xf875c3,_0x70bb('0x27'),_0x70bb('0x28')];return squel[_0x70bb('0x2b')]()[_0x70bb('0x2c')](_0x70bb('0x41'))[_0x70bb('0x2e')](['phone',_0x70bb('0x30'),_0x70bb('0x31'),_0xf875c3,_0x70bb('0x42'),'updatedAt'],squel[_0x70bb('0x11')]()[_0x70bb('0x36')](_0x24df55)[_0x70bb('0x14')](_0x5f5af2)['join'](_0x70bb('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x5f5af2+_0x70bb('0x39'))[_0x70bb('0x15')](_0x628605,null,_0x628605+'.id\x20=\x20'+_0x5f5af2+'.'+_0xf875c3)[_0x70bb('0x16')](_0x5f5af2+_0x70bb('0x3b'),_0x1c2346)[_0x70bb('0x16')](_0x70bb('0x43'),NOW)[_0x70bb('0x16')](_0x70bb('0x3c'),squel[_0x70bb('0x11')]()[_0x70bb('0x12')](_0x70bb('0x13'))['from'](_0x70bb('0x41'))[_0x70bb('0x16')](_0x70bb('0x44'),_0x1c2346)[_0x70bb('0x16')](_0xf875c3+'\x20=\x20'+_0x5f5af2+'.'+_0xf875c3)))['toString']();}function insertTzCmHopper(_0x866978,_0x3b4eb2,_0x2a73e8,_0x184c8b,_0x2ad064,_0x1fa00a){var _0x243858=[_0x70bb('0x40'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x1fa00a+'.offset-cm_contacts.utcOffset\x20minute)',_0x70bb('0x25'),_0x70bb('0x26'),_0x3b4eb2+'.'+_0x184c8b,_0x70bb('0x27'),_0x70bb('0x28'),_0x70bb('0x29'),_0x70bb('0x2a'),'\x22'+_0x2ad064+'\x22'];var _0x55a31c=squel[_0x70bb('0x2b')]()[_0x70bb('0x2c')]('cm_hopper')['fromQuery'](['phone',_0x70bb('0x2f'),'ContactId',_0x70bb('0x31'),_0x184c8b,_0x70bb('0x42'),'updatedAt','priority',_0x70bb('0x34'),_0x70bb('0x35')],squel[_0x70bb('0x11')]()[_0x70bb('0x36')](_0x243858)[_0x70bb('0x14')](_0x3b4eb2)[_0x70bb('0x15')](_0x70bb('0x37'),null,_0x70bb('0x38')+_0x3b4eb2+_0x70bb('0x39'))[_0x70bb('0x15')](_0x2a73e8,null,_0x2a73e8+'.id\x20=\x20'+_0x3b4eb2+'.'+_0x184c8b)[_0x70bb('0x15')](_0x1fa00a,null,_0x1fa00a+_0x70bb('0x3a')+_0x3b4eb2+'.'+_0x184c8b)[_0x70bb('0x16')](_0x3b4eb2+_0x70bb('0x3b'),_0x866978)[_0x70bb('0x16')](_0x70bb('0x43'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3b4eb2,_0x2a73e8,_0x184c8b,_0x70bb('0x2d'),[_0x70bb('0x3d'),_0x70bb('0x3e')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3b4eb2,_0x2a73e8,_0x184c8b,'cm_hopper',[_0x70bb('0x3d')])))[_0x70bb('0x3f')]();return _0x55a31c;}function insertTzCmHopperBlack(_0x130b6b,_0x3e713c,_0x57f6c7,_0x13105c){var _0xaf5475=[_0x70bb('0x40'),_0x70bb('0x25'),_0x70bb('0x26'),_0x3e713c+'.'+_0x13105c,_0x70bb('0x27'),_0x70bb('0x28')];return squel['insert']()[_0x70bb('0x2c')](_0x70bb('0x41'))[_0x70bb('0x2e')]([_0x70bb('0x13'),_0x70bb('0x30'),_0x70bb('0x31'),_0x13105c,_0x70bb('0x42'),_0x70bb('0x32')],squel['select']()['fields'](_0xaf5475)['from'](_0x3e713c)[_0x70bb('0x15')](_0x70bb('0x37'),null,_0x70bb('0x38')+_0x3e713c+_0x70bb('0x39'))[_0x70bb('0x15')](_0x57f6c7,null,_0x57f6c7+_0x70bb('0x3a')+_0x3e713c+'.'+_0x13105c)[_0x70bb('0x16')](_0x3e713c+_0x70bb('0x3b'),_0x130b6b)[_0x70bb('0x16')](_0x70bb('0x43'),NOW)[_0x70bb('0x16')](_0x70bb('0x3c'),squel[_0x70bb('0x11')]()['field'](_0x70bb('0x13'))[_0x70bb('0x14')](_0x70bb('0x41'))[_0x70bb('0x16')](_0x70bb('0x44'),_0x130b6b)[_0x70bb('0x16')](_0x13105c+'\x20=\x20'+_0x3e713c+'.'+_0x13105c)))[_0x70bb('0x3f')]();}function insertCmHopperAdditionalPhones(_0x442ecd){var _0x13a5ff=[_0x70bb('0x45'),_0x70bb('0x46'),_0x70bb('0x47'),_0x70bb('0x48'),'cm_contact_has_items.updatedAt'];return squel[_0x70bb('0x2b')]()['into'](_0x70bb('0x49'))[_0x70bb('0x2e')]([_0x70bb('0x4a'),_0x70bb('0x13'),'OrderBy','createdAt',_0x70bb('0x32')],squel[_0x70bb('0x11')]()[_0x70bb('0x36')](_0x13a5ff)[_0x70bb('0x14')]('cm_hopper')[_0x70bb('0x15')](_0x70bb('0x37'),null,_0x70bb('0x4b'))[_0x70bb('0x15')](_0x70bb('0x4c'),null,_0x70bb('0x4d'))[_0x70bb('0x16')]('cm_hopper.ListId\x20=\x20?',_0x442ecd)['where'](_0x70bb('0x43'),NOW))[_0x70bb('0x3f')]();}function insertCmContact(_0x1e9fe4,_0x19adde,_0x537698,_0x57b1f5){var _0x5dd25f=_[_0x70bb('0x4e')](_[_0x70bb('0x4f')](_0x57b1f5),[_0x70bb('0x31'),'CompanyId',_0x70bb('0x42'),_0x70bb('0x32'),_0x70bb('0x50')]);return squel['insert']()[_0x70bb('0x2c')]('cm_contacts')[_0x70bb('0x2e')](_0x5dd25f,squel[_0x70bb('0x11')]()['fields'](_0x5dd25f)[_0x70bb('0x14')](_0x19adde)[_0x70bb('0x16')]('('+_0x537698[_0x70bb('0x15')](',')+_0x70bb('0x51'),squel[_0x70bb('0x11')]()[_0x70bb('0x36')](_0x537698)[_0x70bb('0x14')](_0x70bb('0x37'))[_0x70bb('0x16')](_0x70bb('0x44'),_0x1e9fe4)[_0x70bb('0x16')](_0x70bb('0x52')))[_0x70bb('0x16')](_0x70bb('0x53'),squel[_0x70bb('0x11')]()['field'](_0x70bb('0x54'),_0x70bb('0x55'))[_0x70bb('0x14')](_0x19adde)[_0x70bb('0x56')](_0x537698['join'](','))))[_0x70bb('0x3f')]();}function handleStop(){logger[_0x70bb('0x57')](_0x70bb('0x58'));stopped=!![];}function handleUncaughtException(_0x23468d){logger[_0x70bb('0x59')](_0x23468d[_0x70bb('0x5a')]);process[_0x70bb('0x5b')](0x1);}function handleError(_0xb06a09,_0x79cd2e){stats[_0x70bb('0x5c')]['push']({'name':_0x79cd2e[_0x70bb('0x5d')],'message':_0x79cd2e[_0x70bb('0x5a')],'row':_0xb06a09});}function handleQuery(_0xeb4976){logger[_0x70bb('0x57')](_0xeb4976);return db[_0x70bb('0x5e')]['query'](_0xeb4976)[_0x70bb('0x5f')](function(_0xadca48){results[_0x70bb('0x1a')](_0xadca48);})[_0x70bb('0x60')](function(_0x30ed7c){logger[_0x70bb('0x59')](_0x30ed7c['message']);});}function updateTzCampaigns(_0x427d7a){return new Promise(function(_0x4b58e7,_0x4cd5e1){var _0x4ff1ea=squel[_0x70bb('0x11')]()[_0x70bb('0x36')]([_0x70bb('0x61'),_0x70bb('0x62')])[_0x70bb('0x14')]('campaigns')[_0x70bb('0x15')](_0x70bb('0x63'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x70bb('0x16')](_0x70bb('0x64')+_0x427d7a);db[_0x70bb('0x5e')]['query'](_0x4ff1ea[_0x70bb('0x3f')]())['spread'](function(_0x4b5db6){var _0x520c48=[];for(var _0x4325e0=0x0;_0x4325e0<_0x4b5db6['length'];_0x4325e0++){_0x520c48[_0x70bb('0x1a')](getTimezoneData(_0x4b5db6[_0x4325e0],tmp_campaigns));}BPromise[_0x70bb('0x1d')](_0x520c48)['then'](function(){_0x4b58e7({'val':0x1});});})[_0x70bb('0x60')](function(_0x352aef){logger[_0x70bb('0x59')](_0x352aef['message']);_0x4b58e7({'val':0x0});});});}function updateTzVoiceQueues(_0x51e6ae){return new Promise(function(_0x146cb7,_0xb38bc9){var _0x4eaab9=squel['select']()['fields']([_0x70bb('0x65'),_0x70bb('0x66')])[_0x70bb('0x14')](_0x70bb('0x67'))[_0x70bb('0x15')](_0x70bb('0x68'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0x70bb('0x69')+_0x51e6ae);db[_0x70bb('0x5e')]['query'](_0x4eaab9['toString']())['spread'](function(_0x9a0847){var _0x3a6ae6=[];for(var _0x79980f=0x0;_0x79980f<_0x9a0847['length'];_0x79980f++){_0x3a6ae6[_0x70bb('0x1a')](getTimezoneData(_0x9a0847[_0x79980f],tmp_voice_queues));}BPromise[_0x70bb('0x1d')](_0x3a6ae6)[_0x70bb('0x1b')](function(){_0x146cb7({'val':0x1});});})['catch'](function(_0x4468cf){logger[_0x70bb('0x59')](_0x4468cf['message']);_0x146cb7({'val':0x0});});});}function getTimezoneData(_0x55e534,_0x2c864e){return new Promise(function(_0x4fb9fb,_0xee8e42){var _0x6c9d9d=shared[_0x70bb('0x6a')];var _0x1925ec=_0x6c9d9d[_0x55e534[_0x70bb('0x6b')]];if(_[_0x70bb('0x1f')](_0x1925ec)){_0x4fb9fb({'ret':0x1});}else{var _0x41d8fc=_0x1925ec['utcOffset'];var _0x2f3041=squel[_0x70bb('0x2b')]()[_0x70bb('0x2c')](_0x2c864e)[_0x70bb('0x6c')]('id',_0x55e534['id'])[_0x70bb('0x6c')](_0x70bb('0x6d'),_0x41d8fc)['set']('dialTimezone',_0x55e534[_0x70bb('0x6b')])[_0x70bb('0x3f')]();return db[_0x70bb('0x5e')][_0x70bb('0x6e')](_0x2f3041)[_0x70bb('0x5f')](function(_0x43efa6){_0x4fb9fb({'ret':0x1});})[_0x70bb('0x60')](function(_0x40584d){logger[_0x70bb('0x59')](_0x40584d[_0x70bb('0x5a')]);_0xee8e42({'ret':0x1});});}});}function handleTZQuery(_0x1c392a){logger[_0x70bb('0x57')](_0x1c392a);return db[_0x70bb('0x5e')][_0x70bb('0x6e')](_0x1c392a)['spread'](function(_0x436870){})[_0x70bb('0x60')](function(_0x3cd3b3){logger[_0x70bb('0x59')](_0x3cd3b3[_0x70bb('0x5a')]);});}function main(_0x4a9ecb,_0x30efed,_0xe6b96b,_0x392a96){logger[_0x70bb('0x57')](_0x70bb('0x6f'),_0x4a9ecb,JSON['stringify'](_0x30efed));process['send']('start');var _0x3c2b16=_0x30efed[_0x70bb('0x70')];var _0x205157=_[_0x70bb('0x71')](_0x3c2b16);var _0x2a0782=_0x30efed[_0x70bb('0x72')];var _0x5383d0=path[_0x70bb('0x15')](config[_0x70bb('0x73')],_0x70bb('0x74'),_0x2a0782+_0x70bb('0x75'));hasTZ=_[_0x70bb('0x4f')](_0x3c2b16)[_0x70bb('0x76')]('dialTimezone');var _0x5f4349=_[_0x70bb('0x4f')](_0x3c2b16)[_0x70bb('0x15')]();logger['info']('header',_0x5f4349);db[_0x70bb('0x77')]['findAll']({'raw':!![],'attributes':['id',_0x70bb('0x78')]})[_0x70bb('0x1b')](function(_0x5bc532){for(var _0x25dac4=0x0;_0x25dac4<_0x5bc532[_0x70bb('0x1c')];_0x25dac4++){if(_0x5bc532[_0x25dac4]['name']in _0x3c2b16){contactItemTypes['push'](_0x5bc532[_0x25dac4]);delete _0x205157[_0x5bc532[_0x25dac4][_0x70bb('0x78')]];hasAdditionalPhones=!![];}for(var _0xdbfcf3 in _0x3c2b16){if(_0x5bc532[_0x25dac4][_0x70bb('0x78')]+_0x70bb('0x79')===_0xdbfcf3){phoneDescriptions[_0x70bb('0x1a')]({'itemTypeId':_0x5bc532[_0x25dac4]['id'],'description':_0xdbfcf3});delete _0x205157[_0xdbfcf3];}}}if(hasAdditionalPhones)_0x205157['AdditionalPhones']='';var _0x157340=_[_0x70bb('0x4f')](_0x205157)[_0x70bb('0x15')]();logger[_0x70bb('0x57')](_0x70bb('0x7a'),_0x157340);fs[_0x70bb('0x7b')](_0x5383d0,_0x157340+'\x0a');Papa['parse'](fs[_0x70bb('0x7c')](_0x4a9ecb),{'header':!![],'skipEmptyLines':!![],'step':function(_0x481ff2,_0x4c400d){try{for(var _0x83166e=0x0,_0x282951=[];_0x83166e<_0x481ff2[_0x70bb('0x7d')]['length'];_0x83166e++){stats[_0x70bb('0x7e')]+=0x1;if(_0x481ff2[_0x70bb('0x5c')][_0x83166e]){handleError(_0x481ff2[_0x70bb('0x7d')][_0x83166e],_0x481ff2[_0x70bb('0x5c')][_0x83166e]);}else{var _0x6e2306=[];var _0xfeb799=[];var _0x389960={};for(var _0x552778 in _0x3c2b16){let _0x599da5=contactItemTypes[_0x70bb('0x7f')](_0x22341a=>_0x22341a[_0x70bb('0x78')]===_0x552778);let _0x3e3041=contactItemTypes[_0x70bb('0x7f')](_0xdc6a05=>_0xdc6a05['name']+_0x70bb('0x79')===_0x552778);if(_[_0x70bb('0x1f')](_0x599da5)&&_[_0x70bb('0x1f')](_0x3e3041)){if(_0x3c2b16[_0x70bb('0x80')](_0x552778)){if(_0x481ff2[_0x70bb('0x7d')][_0x83166e][_0x3c2b16[_0x552778]]){var _0x4970ef=_['trim'](_0x481ff2[_0x70bb('0x7d')][_0x83166e][_0x3c2b16[_0x552778]]['replace'](/"/g,'\x27'));switch(_0x552778){case _0x70bb('0x2f'):var _0x1cb770=moment(_0x4970ef,_0x70bb('0xf'),!![]);if(_0x1cb770['isValid']()){_0x282951['push']('\x22'+_0x4970ef+'\x22');}else{_0x6e2306[_0x70bb('0x1a')](_0x70bb('0x81'));}break;case _0x70bb('0x33'):var _0x2cb55f=parseInt(_0x4970ef);_0x4970ef=_['isNaN'](_0x2cb55f)||_0x2cb55f<0x0||_0x2cb55f>0x4?_0x392a96?0x3:0x2:_0x2cb55f;_0x282951[_0x70bb('0x1a')]('\x22'+_0x4970ef+'\x22');break;case _0x70bb('0x34'):var _0x482047=parseInt(_0x4970ef);if(_[_0x70bb('0x82')](_0x482047)&&_[_0x70bb('0x76')](_0xe6b96b,_0x482047)){_0x282951['push']('\x22'+_0x482047+'\x22');}else{_0x6e2306['push'](_0x70bb('0x83'));}break;case _0x70bb('0x84'):if(isEmail(_0x4970ef)){_0x282951['push']('\x22'+_0x4970ef+'\x22');}else{_0x6e2306[_0x70bb('0x1a')](_0x70bb('0x85'));}break;case _0x70bb('0x86'):var _0x4754a7=moment(_0x4970ef,'YYYY-MM-DD',!![]);if(_0x4754a7['isValid']()){_0x282951[_0x70bb('0x1a')]('\x22'+_0x4970ef+'\x22');}else{_0x6e2306['push'](_0x70bb('0x87'));}break;case'dialTimezone':var _0x221bdb=shared[_0x70bb('0x6a')];var _0x5254b8=_0x221bdb[_0x4970ef];if(!_[_0x70bb('0x1f')](_0x5254b8)){var _0x5786de=_0x5254b8[_0x70bb('0x88')];_0x282951['push']('\x22'+_0x4970ef+'\x22');_0x282951['push']('\x22'+_0x5786de+'\x22');}break;default:_0x282951[_0x70bb('0x1a')]('\x22'+_0x4970ef+'\x22');}}else{switch(_0x552778){case'firstName':case _0x70bb('0x13'):_0x6e2306[_0x70bb('0x1a')](_0x552778+_0x70bb('0x89'));break;default:_0x282951[_0x70bb('0x1a')]('\x22\x22');}}}}else{var _0xf6c142='';if(!_[_0x70bb('0x1f')](_0x599da5)){if(!_0x389960['hasOwnProperty'](_0x599da5['id'])){if(!_[_0x70bb('0x1f')](_0x481ff2[_0x70bb('0x7d')][_0x83166e][_0x3c2b16[_0x552778]])){var _0x4970ef=_['trim'](_0x481ff2[_0x70bb('0x7d')][_0x83166e][_0x3c2b16[_0x552778]][_0x70bb('0x8a')](/"/g,'\x27'));var _0xa58442=phoneDescriptions[_0x70bb('0x7f')](_0x5ceff0=>_0x5ceff0[_0x70bb('0x8b')]===_0x599da5['id']);if(!_[_0x70bb('0x1f')](_0xa58442)){var _0x428e4a=_['trim'](_0x481ff2[_0x70bb('0x7d')][_0x83166e][_0x3c2b16[_0xa58442[_0x70bb('0x8c')]]]['replace'](/"/g,'\x27'));if(!_[_0x70bb('0x1f')](_0x428e4a))_0x4970ef=_0x4970ef+'§'+_0x428e4a;}if(_0xf6c142=='')_0xf6c142=_0x4970ef;else _0xf6c142+='|'+_0x4970ef;}_0xfeb799['push'](_0x599da5['id']+':'+_0xf6c142);_0x389960[_0x599da5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x282951[_0x70bb('0x1a')]('\x22'+_0xfeb799['join'](';')+'\x22');}if(_0x6e2306[_0x70bb('0x1c')]){handleError(_0x481ff2[_0x70bb('0x7d')][_0x83166e],{'code':_0x70bb('0x8d'),'message':_0x6e2306[_0x70bb('0x15')]()});}else{fs[_0x70bb('0x8e')](_0x5383d0,_0x282951['join']()+'\x0a');}_0x282951=[];}if(!(stats[_0x70bb('0x7e')]%0xc8)){socket[_0x70bb('0x8f')](_0x70bb('0x90')+_0x2a0782,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x70bb('0x91'));_0x4c400d['abort']();}}catch(_0x3eb437){handleError(_0x481ff2[_0x70bb('0x7d')][_0x83166e],{'code':'SystemError','message':_0x3eb437[_0x70bb('0x5a')]});logger[_0x70bb('0x59')](_0x70bb('0x92'),_0x3eb437[_0x70bb('0x5a')]);}},'complete':function(){try{var _0x3aacf9=[];var _0x382eca=[];var _0x54ae01=_0x70bb('0x37');if(_0x30efed[_0x70bb('0x93')]&&_0x30efed['duplicates'][_0x70bb('0x1c')]){_0x54ae01=_0x70bb('0x94')+_0x2a0782;_0x3aacf9[_0x70bb('0x1a')](_0x70bb('0x95')+_0x54ae01+_0x70bb('0x96'));}tmp_campaigns=_0x70bb('0x97')+_0x2a0782;tmp_voice_queues='voice_queues_'+_0x2a0782;_0x382eca[_0x70bb('0x1a')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x70bb('0x98'));_0x382eca[_0x70bb('0x1a')](_0x70bb('0x95')+tmp_voice_queues+_0x70bb('0x98'));BPromise[_0x70bb('0x99')](_0x382eca,handleTZQuery)[_0x70bb('0x1b')](function(_0x5ba05c){updateTzCampaigns(_0x30efed['ListId'])[_0x70bb('0x1b')](function(_0x5676a1){updateTzVoiceQueues(_0x30efed[_0x70bb('0x31')])['then'](function(_0x3178a3){if(hasTZ)_0x157340=_0x157340[_0x70bb('0x8a')](_0x70bb('0x6b'),_0x70bb('0x9a'));var _0x9bcfa9=util[_0x70bb('0xe')](_0x70bb('0x9b'),_0x5383d0,_0x54ae01,_0x157340,_0x30efed['ListId'],_0x30efed['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x3c2b16['scheduledat'])){_0x9bcfa9+=_0x70bb('0x9c');}_0x3aacf9[_0x70bb('0x1a')](_0x9bcfa9);if(_0x30efed[_0x70bb('0x93')]&&_0x30efed['duplicates']['length']){_0x3aacf9['push'](insertCmContact(_0x30efed['ListId'],_0x54ae01,_0x30efed[_0x70bb('0x93')],_0x3c2b16));_0x3aacf9['push'](_0x70bb('0x9d')+_0x54ae01+';');}BPromise['each'](_0x3aacf9,handleQuery)['then'](function(_0xf121fe){BPromise[_0x70bb('0x1d')]([handleAdditionalPhones()])[_0x70bb('0x1b')](function(){_0x3aacf9=[];for(var _0x2bde35=0x0;_0x2bde35\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','path','papaparse','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','phone','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','then','length','push','all','AdditionalPhones','split','isNil','filter','findOne','CmContactHasItem','update','updated','create','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','ListId','updatedAt','priority','recallme','fields','from','cm_contacts','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)'];(function(_0x2ae68c,_0x52e467){var _0x49fe7e=function(_0x3f067c){while(--_0x3f067c){_0x2ae68c['push'](_0x2ae68c['shift']());}};_0x49fe7e(++_0x52e467);}(_0x78c1,0x82));var _0x178c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x78c1[_0x4a9fb1];return _0x348672;};'use strict';var fs=require('fs');var path=require(_0x178c('0x0'));var _=require('lodash');var Papa=require(_0x178c('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x178c('0x2'));var squel=require(_0x178c('0x3'));var Redis=require(_0x178c('0x4'));var db=require(_0x178c('0x5'))['db'];var config=require(_0x178c('0x6'));var shared=require(_0x178c('0x7'));var logger=require(_0x178c('0x8'))(_0x178c('0x9'));config['redis']=_[_0x178c('0xa')](config[_0x178c('0xb')],{'host':_0x178c('0xc'),'port':0x18eb});var socket=require(_0x178c('0xd'))(new Redis(config[_0x178c('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x178c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x178c('0xe')](_0x178c('0xf'));function isEmail(_0x50ee0b){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))*$/[_0x178c('0x10')](_0x50ee0b);}function selectNotIn(_0x2cc462,_0x30f221,_0x74b3f8,_0x2ba8ee,_0x2c8b8c){return squel['select']()['field'](_0x178c('0x11'))['from'](_0x2ba8ee)[_0x178c('0x12')](_0x30f221,null,_0x30f221+'.id\x20=\x20'+_0x2ba8ee+'.'+_0x74b3f8)[_0x178c('0x13')](_0x2ba8ee+'.'+_0x74b3f8+_0x178c('0x14')+_0x2cc462+'.'+_0x74b3f8)[_0x178c('0x13')](_0x30f221+_0x178c('0x15')+_0x2c8b8c[_0x178c('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x164c86,_0x4ca432){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x178c('0x16')](function(_0x1af8a9){if(_0x1af8a9!==null){var _0x43d6b7=[];for(var _0x3e2313=0x0;_0x3e2313<_0x1af8a9[_0x178c('0x17')];_0x3e2313++){var _0x504b2d=_0x1af8a9[_0x3e2313];_0x43d6b7[_0x178c('0x18')](insertAdditionalPhones(_0x504b2d));}}Promise[_0x178c('0x19')](_0x43d6b7)[_0x178c('0x16')](function(){_0x164c86({'val':0x1});});});});}function insertAdditionalPhones(_0x545c9b){return new Promise(function(_0x20393e,_0x24fdde){var _0xbc1a93=_0x545c9b[_0x178c('0x1a')];var _0x2131b9=_0xbc1a93[_0x178c('0x1b')](';');var _0x38843a=[];orderBy=0x0;for(var _0x49c450=0x0;_0x49c450<_0x2131b9[_0x178c('0x17')];_0x49c450++){_0x38843a['push'](splitAdditionalPhone(_0x545c9b['id'],_0x2131b9[_0x49c450]));}Promise[_0x178c('0x19')](_0x38843a)[_0x178c('0x16')](function(){_0x20393e({'val':_0x2131b9['length']});});});}function splitAdditionalPhone(_0x2bff26,_0x1261c6){return new Promise(function(_0x432d86,_0x1c813f){var _0x286a78=_0x1261c6[_0x178c('0x1b')](':');var _0x3cc344=_0x286a78[0x0];var _0x714049=_0x286a78[0x1];if(!_[_0x178c('0x1c')](_0x714049)){var _0x19fae9=_0x714049[_0x178c('0x1b')]('|');var _0x4cc742=[];for(var _0x556b4a=0x0;_0x556b4a<_0x19fae9['length'];_0x556b4a++){if(_0x19fae9[_0x556b4a]!==''){var _0x165fcb=_[_0x178c('0x1d')](promisesAdditionalPhones,{'contactId':_0x2bff26,'phone':_0x19fae9[_0x556b4a]});if(_0x165fcb[_0x178c('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x178c('0x18')]({'contactId':_0x2bff26,'contactTypeId':_0x3cc344,'phone':_0x19fae9[_0x556b4a],'orderBy':orderBy});}}}_0x432d86({'ok':0x1});}else _0x432d86({'res':0x0});});}function createAdditionalPhone(_0x59ba6e,_0x33f6b9,_0x552fd5,_0x311625){var _0x454d94='';var _0x52b107='';var _0x4da0b2=_0x552fd5[_0x178c('0x1b')]('§');_0x454d94=_0x4da0b2[0x0];if(_0x4da0b2['length']==0x2)_0x52b107=_0x4da0b2[0x1];return new Promise(function(_0x3791b2,_0x4430f9){return db['CmContactHasItem'][_0x178c('0x1e')]({'where':{'CmContactId':_0x59ba6e,'item':_0x454d94}})[_0x178c('0x16')](function(_0x275843){if(_0x275843){return db[_0x178c('0x1f')][_0x178c('0x20')]({'ItemTypeId':_0x33f6b9,'description':_0x52b107,'OrderBy':_0x311625},{'where':{'CmContactId':_0x59ba6e,'item':_0x454d94}})[_0x178c('0x16')](function(_0x6f97b8){_0x3791b2({'res':_0x178c('0x21')});});}else{return db[_0x178c('0x1f')][_0x178c('0x22')]({'CmContactId':_0x59ba6e,'item':_0x454d94,'description':_0x52b107,'ItemTypeId':_0x33f6b9,'OrderBy':_0x311625,'ItemClass':'PHONE'})['then'](function(_0x47fd04){_0x3791b2({'res':_0x178c('0x23')});});}});});}function insertCmHopper(_0xb6979b,_0x19ce75,_0x316e43,_0x39caae,_0x54b8d1){var _0x2c3970=[_0x178c('0x24'),'cm_contacts.scheduledat',_0x178c('0x25'),'cm_contacts.ListId',_0x19ce75+'.'+_0x39caae,_0x178c('0x26'),'cm_contacts.updatedAt',_0x178c('0x27'),'cm_contacts.UserId','\x22'+_0x54b8d1+'\x22'];return squel[_0x178c('0x28')]()[_0x178c('0x29')](_0x178c('0x2a'))[_0x178c('0x2b')]([_0x178c('0x11'),'scheduledat','ContactId',_0x178c('0x2c'),_0x39caae,'createdAt',_0x178c('0x2d'),_0x178c('0x2e'),'UserId',_0x178c('0x2f')],squel['select']()[_0x178c('0x30')](_0x2c3970)[_0x178c('0x31')](_0x19ce75)[_0x178c('0x12')](_0x178c('0x32'),null,'cm_contacts.ListId\x20=\x20'+_0x19ce75+_0x178c('0x33'))[_0x178c('0x12')](_0x316e43,null,_0x316e43+_0x178c('0x34')+_0x19ce75+'.'+_0x39caae)[_0x178c('0x13')](_0x19ce75+_0x178c('0x35'),_0xb6979b)[_0x178c('0x13')](_0x178c('0x36'),NOW)[_0x178c('0x13')](_0x178c('0x37'),selectNotIn(_0x19ce75,_0x316e43,_0x39caae,_0x178c('0x2a'),[_0x178c('0x38'),_0x178c('0x39')]))['where'](_0x178c('0x37'),selectNotIn(_0x19ce75,_0x316e43,_0x39caae,_0x178c('0x2a'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x5d7feb,_0x4271f6,_0x31ad5f,_0x44248e){var _0x24c847=['cm_contacts.phone',_0x178c('0x25'),_0x178c('0x3a'),_0x4271f6+'.'+_0x44248e,_0x178c('0x26'),_0x178c('0x3b')];return squel['insert']()[_0x178c('0x29')](_0x178c('0x3c'))['fromQuery']([_0x178c('0x11'),_0x178c('0x3d'),'ListId',_0x44248e,_0x178c('0x3e'),_0x178c('0x2d')],squel[_0x178c('0x3f')]()['fields'](_0x24c847)[_0x178c('0x31')](_0x4271f6)['join']('cm_contacts',null,_0x178c('0x40')+_0x4271f6+_0x178c('0x33'))[_0x178c('0x12')](_0x31ad5f,null,_0x31ad5f+_0x178c('0x34')+_0x4271f6+'.'+_0x44248e)[_0x178c('0x13')](_0x4271f6+_0x178c('0x35'),_0x5d7feb)[_0x178c('0x13')](_0x178c('0x36'),NOW)[_0x178c('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x178c('0x3f')]()[_0x178c('0x41')](_0x178c('0x11'))[_0x178c('0x31')](_0x178c('0x3c'))['where'](_0x178c('0x42'),_0x5d7feb)[_0x178c('0x13')](_0x44248e+_0x178c('0x14')+_0x4271f6+'.'+_0x44248e)))[_0x178c('0x43')]();}function insertTzCmHopper(_0x63e88a,_0x4ad2db,_0x4ad8ba,_0x6f35ab,_0x6760f6,_0x39aa3c){var _0x5f0e5c=['cm_contacts.phone',_0x178c('0x44')+_0x39aa3c+'.offset-cm_contacts.utcOffset\x20minute)',_0x178c('0x25'),'cm_contacts.ListId',_0x4ad2db+'.'+_0x6f35ab,_0x178c('0x26'),_0x178c('0x3b'),_0x178c('0x27'),_0x178c('0x45'),'\x22'+_0x6760f6+'\x22'];var _0x356169=squel[_0x178c('0x28')]()[_0x178c('0x29')]('cm_hopper')[_0x178c('0x2b')]([_0x178c('0x11'),_0x178c('0x46'),_0x178c('0x3d'),'ListId',_0x6f35ab,'createdAt','updatedAt',_0x178c('0x2e'),_0x178c('0x47'),_0x178c('0x2f')],squel[_0x178c('0x3f')]()['fields'](_0x5f0e5c)[_0x178c('0x31')](_0x4ad2db)[_0x178c('0x12')]('cm_contacts',null,_0x178c('0x40')+_0x4ad2db+_0x178c('0x33'))[_0x178c('0x12')](_0x4ad8ba,null,_0x4ad8ba+_0x178c('0x34')+_0x4ad2db+'.'+_0x6f35ab)[_0x178c('0x12')](_0x39aa3c,null,_0x39aa3c+_0x178c('0x34')+_0x4ad2db+'.'+_0x6f35ab)[_0x178c('0x13')](_0x4ad2db+_0x178c('0x35'),_0x63e88a)[_0x178c('0x13')](_0x178c('0x36'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4ad2db,_0x4ad8ba,_0x6f35ab,'cm_hopper',['\x22always\x22',_0x178c('0x39')]))['where'](_0x178c('0x37'),selectNotIn(_0x4ad2db,_0x4ad8ba,_0x6f35ab,_0x178c('0x2a'),[_0x178c('0x38')])))[_0x178c('0x43')]();return _0x356169;}function insertTzCmHopperBlack(_0x15ef81,_0x19a30f,_0x3befb7,_0x4e4e79){var _0xf5a5a0=[_0x178c('0x24'),_0x178c('0x25'),'cm_contacts.ListId',_0x19a30f+'.'+_0x4e4e79,_0x178c('0x26'),'cm_contacts.updatedAt'];return squel[_0x178c('0x28')]()[_0x178c('0x29')](_0x178c('0x3c'))['fromQuery'](['phone',_0x178c('0x3d'),_0x178c('0x2c'),_0x4e4e79,_0x178c('0x3e'),'updatedAt'],squel[_0x178c('0x3f')]()[_0x178c('0x30')](_0xf5a5a0)['from'](_0x19a30f)[_0x178c('0x12')](_0x178c('0x32'),null,_0x178c('0x40')+_0x19a30f+_0x178c('0x33'))[_0x178c('0x12')](_0x3befb7,null,_0x3befb7+_0x178c('0x34')+_0x19a30f+'.'+_0x4e4e79)[_0x178c('0x13')](_0x19a30f+'.CmListId\x20=\x20?',_0x15ef81)[_0x178c('0x13')](_0x178c('0x36'),NOW)['where'](_0x178c('0x37'),squel[_0x178c('0x3f')]()[_0x178c('0x41')](_0x178c('0x11'))[_0x178c('0x31')](_0x178c('0x3c'))['where'](_0x178c('0x42'),_0x15ef81)[_0x178c('0x13')](_0x4e4e79+_0x178c('0x14')+_0x19a30f+'.'+_0x4e4e79)))[_0x178c('0x43')]();}function insertCmHopperAdditionalPhones(_0x5d6ca0){var _0x27a0e8=[_0x178c('0x48'),_0x178c('0x49'),_0x178c('0x4a'),_0x178c('0x4b'),'cm_contact_has_items.updatedAt'];return squel[_0x178c('0x28')]()[_0x178c('0x29')](_0x178c('0x4c'))[_0x178c('0x2b')]([_0x178c('0x4d'),_0x178c('0x11'),'OrderBy','createdAt',_0x178c('0x2d')],squel[_0x178c('0x3f')]()['fields'](_0x27a0e8)['from'](_0x178c('0x2a'))[_0x178c('0x12')](_0x178c('0x32'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x178c('0x12')](_0x178c('0x4e'),null,_0x178c('0x4f'))[_0x178c('0x13')](_0x178c('0x50'),_0x5d6ca0)[_0x178c('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x178c('0x43')]();}function insertCmContact(_0x18e4be,_0xc37567,_0x345302,_0x5d6467){var _0x492d35=_[_0x178c('0x51')](_[_0x178c('0x52')](_0x5d6467),[_0x178c('0x2c'),_0x178c('0x53'),'createdAt',_0x178c('0x2d'),_0x178c('0x54')]);return squel[_0x178c('0x28')]()['into']('cm_contacts')[_0x178c('0x2b')](_0x492d35,squel[_0x178c('0x3f')]()[_0x178c('0x30')](_0x492d35)['from'](_0xc37567)['where']('('+_0x345302['join'](',')+_0x178c('0x55'),squel[_0x178c('0x3f')]()[_0x178c('0x30')](_0x345302)[_0x178c('0x31')](_0x178c('0x32'))['where'](_0x178c('0x42'),_0x18e4be)[_0x178c('0x13')](_0x178c('0x56')))[_0x178c('0x13')]('id\x20IN\x20?',squel[_0x178c('0x3f')]()[_0x178c('0x41')](_0x178c('0x57'),_0x178c('0x58'))[_0x178c('0x31')](_0xc37567)['group'](_0x345302[_0x178c('0x12')](','))))[_0x178c('0x43')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4d8b62){logger['error'](_0x4d8b62['message']);process[_0x178c('0x59')](0x1);}function handleError(_0x3e4d0d,_0x5c8c73){stats[_0x178c('0x5a')][_0x178c('0x18')]({'name':_0x5c8c73[_0x178c('0x5b')],'message':_0x5c8c73[_0x178c('0x5c')],'row':_0x3e4d0d});}function handleQuery(_0xd1f18c){logger[_0x178c('0x5d')](_0xd1f18c);return db[_0x178c('0x5e')][_0x178c('0x5f')](_0xd1f18c)[_0x178c('0x60')](function(_0x10695a){results[_0x178c('0x18')](_0x10695a);})['catch'](function(_0x202d9c){logger[_0x178c('0x61')](_0x202d9c[_0x178c('0x5c')]);});}function updateTzCampaigns(_0x407a34){return new Promise(function(_0x26d35b,_0x15fad6){var _0x23de39=squel[_0x178c('0x3f')]()[_0x178c('0x30')]([_0x178c('0x62'),_0x178c('0x63')])[_0x178c('0x31')](_0x178c('0x64'))[_0x178c('0x12')](_0x178c('0x65'),null,_0x178c('0x66'))[_0x178c('0x13')](_0x178c('0x67')+_0x407a34);db[_0x178c('0x5e')][_0x178c('0x5f')](_0x23de39[_0x178c('0x43')]())['spread'](function(_0x2a33c7){var _0x59a74c=[];for(var _0x106bf2=0x0;_0x106bf2<_0x2a33c7[_0x178c('0x17')];_0x106bf2++){_0x59a74c[_0x178c('0x18')](getTimezoneData(_0x2a33c7[_0x106bf2],tmp_campaigns));}BPromise[_0x178c('0x19')](_0x59a74c)[_0x178c('0x16')](function(){_0x26d35b({'val':0x1});});})[_0x178c('0x68')](function(_0x4dfc11){logger['error'](_0x4dfc11[_0x178c('0x5c')]);_0x26d35b({'val':0x0});});});}function updateTzVoiceQueues(_0x1d3a4f){return new Promise(function(_0x48d5c6,_0x2ebce6){var _0x26d8c7=squel['select']()[_0x178c('0x30')]([_0x178c('0x69'),'voice_queues.dialTimezone'])[_0x178c('0x31')]('voice_queues')['join'](_0x178c('0x6a'),null,_0x178c('0x6b'))['where'](_0x178c('0x6c')+_0x1d3a4f);db[_0x178c('0x5e')][_0x178c('0x5f')](_0x26d8c7[_0x178c('0x43')]())[_0x178c('0x60')](function(_0x4388a6){var _0x15ebdc=[];for(var _0x3f650f=0x0;_0x3f650f<_0x4388a6[_0x178c('0x17')];_0x3f650f++){_0x15ebdc['push'](getTimezoneData(_0x4388a6[_0x3f650f],tmp_voice_queues));}BPromise[_0x178c('0x19')](_0x15ebdc)['then'](function(){_0x48d5c6({'val':0x1});});})[_0x178c('0x68')](function(_0x3c258d){logger[_0x178c('0x61')](_0x3c258d[_0x178c('0x5c')]);_0x48d5c6({'val':0x0});});});}function getTimezoneData(_0x5ec675,_0x2fdb43){return new Promise(function(_0x496696,_0x5e392f){var _0x9db385=shared['timezones'];var _0x5e1d74=_0x9db385[_0x5ec675[_0x178c('0x6d')]];if(_[_0x178c('0x1c')](_0x5e1d74)){_0x496696({'ret':0x1});}else{var _0x3cebe1=_0x5e1d74['utcOffset'];var _0xaf3987=squel['insert']()[_0x178c('0x29')](_0x2fdb43)[_0x178c('0x6e')]('id',_0x5ec675['id'])[_0x178c('0x6e')](_0x178c('0x6f'),_0x3cebe1)[_0x178c('0x6e')](_0x178c('0x6d'),_0x5ec675[_0x178c('0x6d')])[_0x178c('0x43')]();return db[_0x178c('0x5e')][_0x178c('0x5f')](_0xaf3987)[_0x178c('0x60')](function(_0x347d5d){_0x496696({'ret':0x1});})[_0x178c('0x68')](function(_0x478d8c){logger[_0x178c('0x61')](_0x478d8c['message']);_0x5e392f({'ret':0x1});});}});}function handleTZQuery(_0x3c60c0){logger[_0x178c('0x5d')](_0x3c60c0);return db[_0x178c('0x5e')]['query'](_0x3c60c0)[_0x178c('0x60')](function(_0x2c18df){})[_0x178c('0x68')](function(_0x14ea57){logger[_0x178c('0x61')](_0x14ea57['message']);});}function main(_0x293c82,_0x34323c,_0x5cc58d,_0x5f210d){logger['info'](_0x178c('0x70'),_0x293c82,JSON[_0x178c('0x71')](_0x34323c));process[_0x178c('0x72')](_0x178c('0x73'));var _0x380ce1=_0x34323c[_0x178c('0x74')];var _0x436bac=_[_0x178c('0x75')](_0x380ce1);var _0xc29685=_0x34323c[_0x178c('0x76')];var _0x387dcf=path['join'](config[_0x178c('0x77')],_0x178c('0x78'),_0xc29685+'.csv');hasTZ=_[_0x178c('0x52')](_0x380ce1)[_0x178c('0x79')]('dialTimezone');var _0x44535b=_['keys'](_0x380ce1)[_0x178c('0x12')]();logger[_0x178c('0x5d')](_0x178c('0x7a'),_0x44535b);db['ContactItemType'][_0x178c('0x7b')]({'raw':!![],'attributes':['id','name']})[_0x178c('0x16')](function(_0x594058){for(var _0x4c8dd6=0x0;_0x4c8dd6<_0x594058['length'];_0x4c8dd6++){if(_0x594058[_0x4c8dd6][_0x178c('0x7c')]in _0x380ce1){contactItemTypes[_0x178c('0x18')](_0x594058[_0x4c8dd6]);delete _0x436bac[_0x594058[_0x4c8dd6]['name']];hasAdditionalPhones=!![];}for(var _0x28eeee in _0x380ce1){if(_0x594058[_0x4c8dd6][_0x178c('0x7c')]+'_description'===_0x28eeee){phoneDescriptions[_0x178c('0x18')]({'itemTypeId':_0x594058[_0x4c8dd6]['id'],'description':_0x28eeee});delete _0x436bac[_0x28eeee];}}}if(hasAdditionalPhones)_0x436bac[_0x178c('0x1a')]='';var _0x5f5b88=_[_0x178c('0x52')](_0x436bac)[_0x178c('0x12')]();logger[_0x178c('0x5d')]('header',_0x5f5b88);fs[_0x178c('0x7d')](_0x387dcf,_0x5f5b88+'\x0a');Papa[_0x178c('0x7e')](fs[_0x178c('0x7f')](_0x293c82),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5ae2c4,_0x5ab408){try{for(var _0x2d2f96=0x0,_0x427ef3=[];_0x2d2f96<_0x5ae2c4[_0x178c('0x80')][_0x178c('0x17')];_0x2d2f96++){stats[_0x178c('0x81')]+=0x1;if(_0x5ae2c4[_0x178c('0x5a')][_0x2d2f96]){handleError(_0x5ae2c4[_0x178c('0x80')][_0x2d2f96],_0x5ae2c4[_0x178c('0x5a')][_0x2d2f96]);}else{var _0x5e352e=[];var _0x472488=[];var _0x56e7f8={};for(var _0x27731f in _0x380ce1){let _0x314894=contactItemTypes[_0x178c('0x82')](_0x237c3a=>_0x237c3a[_0x178c('0x7c')]===_0x27731f);let _0x28e575=contactItemTypes[_0x178c('0x82')](_0xcd2092=>_0xcd2092[_0x178c('0x7c')]+_0x178c('0x83')===_0x27731f);if(_[_0x178c('0x1c')](_0x314894)&&_[_0x178c('0x1c')](_0x28e575)){if(_0x380ce1['hasOwnProperty'](_0x27731f)){if(_0x5ae2c4[_0x178c('0x80')][_0x2d2f96][_0x380ce1[_0x27731f]]){var _0x3d85f3=_[_0x178c('0x84')](_0x5ae2c4['data'][_0x2d2f96][_0x380ce1[_0x27731f]]['replace'](/"/g,'\x27'));switch(_0x27731f){case _0x178c('0x46'):var _0x3bda89=moment(_0x3d85f3,_0x178c('0xf'),!![]);if(_0x3bda89['isValid']()){_0x427ef3[_0x178c('0x18')]('\x22'+_0x3d85f3+'\x22');}else{_0x5e352e[_0x178c('0x18')](_0x178c('0x85'));}break;case'priority':var _0x57ff2d=parseInt(_0x3d85f3);_0x3d85f3=_[_0x178c('0x86')](_0x57ff2d)||_0x57ff2d<0x0||_0x57ff2d>0x4?_0x5f210d?0x3:0x2:_0x57ff2d;_0x427ef3['push']('\x22'+_0x3d85f3+'\x22');break;case _0x178c('0x47'):var _0x16a6dd=parseInt(_0x3d85f3);if(_[_0x178c('0x87')](_0x16a6dd)&&_[_0x178c('0x79')](_0x5cc58d,_0x16a6dd)){_0x427ef3[_0x178c('0x18')]('\x22'+_0x16a6dd+'\x22');}else{_0x5e352e['push'](_0x178c('0x88'));}break;case'email':if(isEmail(_0x3d85f3)){_0x427ef3[_0x178c('0x18')]('\x22'+_0x3d85f3+'\x22');}else{_0x5e352e[_0x178c('0x18')](_0x178c('0x89'));}break;case'dateOfBirth':var _0x376386=moment(_0x3d85f3,_0x178c('0x8a'),!![]);if(_0x376386[_0x178c('0x8b')]()){_0x427ef3[_0x178c('0x18')]('\x22'+_0x3d85f3+'\x22');}else{_0x5e352e['push'](_0x178c('0x8c'));}break;case _0x178c('0x6d'):var _0x508676=shared[_0x178c('0x8d')];var _0x52ae24=_0x508676[_0x3d85f3];if(!_[_0x178c('0x1c')](_0x52ae24)){var _0x4b5e33=_0x52ae24[_0x178c('0x8e')];_0x427ef3[_0x178c('0x18')]('\x22'+_0x3d85f3+'\x22');_0x427ef3['push']('\x22'+_0x4b5e33+'\x22');}break;default:_0x427ef3['push']('\x22'+_0x3d85f3+'\x22');}}else{switch(_0x27731f){case _0x178c('0x8f'):case _0x178c('0x11'):_0x5e352e['push'](_0x27731f+'\x20not\x20specified');break;default:_0x427ef3['push']('\x22\x22');}}}}else{var _0x3baf86='';if(!_[_0x178c('0x1c')](_0x314894)){if(!_0x56e7f8[_0x178c('0x90')](_0x314894['id'])){if(!_['isNil'](_0x5ae2c4[_0x178c('0x80')][_0x2d2f96][_0x380ce1[_0x27731f]])){var _0x3d85f3=_[_0x178c('0x84')](_0x5ae2c4[_0x178c('0x80')][_0x2d2f96][_0x380ce1[_0x27731f]][_0x178c('0x91')](/"/g,'\x27'));var _0x451125=phoneDescriptions[_0x178c('0x82')](_0x70e96=>_0x70e96[_0x178c('0x92')]===_0x314894['id']);if(!_['isNil'](_0x451125)){var _0x17be4f=_[_0x178c('0x84')](_0x5ae2c4[_0x178c('0x80')][_0x2d2f96][_0x380ce1[_0x451125[_0x178c('0x93')]]][_0x178c('0x91')](/"/g,'\x27'));if(!_[_0x178c('0x1c')](_0x17be4f))_0x3d85f3=_0x3d85f3+'§'+_0x17be4f;}if(_0x3baf86=='')_0x3baf86=_0x3d85f3;else _0x3baf86+='|'+_0x3d85f3;}_0x472488[_0x178c('0x18')](_0x314894['id']+':'+_0x3baf86);_0x56e7f8[_0x314894['id']]=0x1;}}}}if(hasAdditionalPhones){_0x427ef3['push']('\x22'+_0x472488[_0x178c('0x12')](';')+'\x22');}if(_0x5e352e['length']){handleError(_0x5ae2c4[_0x178c('0x80')][_0x2d2f96],{'code':'SystemRow','message':_0x5e352e['join']()});}else{fs[_0x178c('0x94')](_0x387dcf,_0x427ef3[_0x178c('0x12')]()+'\x0a');}_0x427ef3=[];}if(!(stats[_0x178c('0x81')]%0xc8)){socket[_0x178c('0x95')]('contact:import:'+_0xc29685,stats);stats['errors']=[];}}if(stopped){logger[_0x178c('0x5d')](_0x178c('0x96'));_0x5ab408[_0x178c('0x97')]();}}catch(_0x4d1e63){handleError(_0x5ae2c4['data'][_0x2d2f96],{'code':_0x178c('0x98'),'message':_0x4d1e63[_0x178c('0x5c')]});logger['error'](_0x178c('0x99'),_0x4d1e63[_0x178c('0x5c')]);}},'complete':function(){try{var _0x323380=[];var _0x848e11=[];var _0xc9868b=_0x178c('0x32');if(_0x34323c[_0x178c('0x9a')]&&_0x34323c[_0x178c('0x9a')][_0x178c('0x17')]){_0xc9868b='cm_contacts_'+_0xc29685;_0x323380[_0x178c('0x18')]('CREATE\x20TABLE\x20'+_0xc9868b+_0x178c('0x9b'));}tmp_campaigns=_0x178c('0x9c')+_0xc29685;tmp_voice_queues=_0x178c('0x9d')+_0xc29685;_0x848e11[_0x178c('0x18')](_0x178c('0x9e')+tmp_campaigns+_0x178c('0x9f'));_0x848e11[_0x178c('0x18')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x178c('0xa0')](_0x848e11,handleTZQuery)['then'](function(_0x3ca6ad){updateTzCampaigns(_0x34323c[_0x178c('0x2c')])[_0x178c('0x16')](function(_0x9e7acf){updateTzVoiceQueues(_0x34323c[_0x178c('0x2c')])[_0x178c('0x16')](function(_0x2a3010){if(hasTZ)_0x5f5b88=_0x5f5b88[_0x178c('0x91')]('dialTimezone','dialTimezone,utcOffset');var _0x36a855=util[_0x178c('0xe')](_0x178c('0xa1'),_0x387dcf,_0xc9868b,_0x5f5b88,_0x34323c[_0x178c('0x2c')],_0x34323c['CompanyId']||null,NOW,NOW);if(_[_0x178c('0x1c')](_0x380ce1[_0x178c('0x46')])){_0x36a855+=',\x20scheduledAt\x20=\x20NOW()';}_0x323380[_0x178c('0x18')](_0x36a855);if(_0x34323c[_0x178c('0x9a')]&&_0x34323c[_0x178c('0x9a')][_0x178c('0x17')]){_0x323380[_0x178c('0x18')](insertCmContact(_0x34323c['ListId'],_0xc9868b,_0x34323c[_0x178c('0x9a')],_0x380ce1));_0x323380[_0x178c('0x18')](_0x178c('0xa2')+_0xc9868b+';');}BPromise[_0x178c('0xa0')](_0x323380,handleQuery)[_0x178c('0x16')](function(_0x418984){BPromise[_0x178c('0x19')]([handleAdditionalPhones()])[_0x178c('0x16')](function(){_0x323380=[];for(var _0x4ad27b=0x0;_0x4ad27b_0x2c5219['name']===_0x6fa000);let _0x14b467=contactItemTypes['find'](_0x2c80c0=>_0x2c80c0[_0xdc23('0x71')]+'_description'===_0x6fa000);if(_[_0xdc23('0x1d')](_0x9eac24)&&_[_0xdc23('0x1d')](_0x14b467)){if(_0x34e03c[_0xdc23('0x77')](_0x6fa000)){if(_0xaf561e[_0xdc23('0x74')][_0x5ce7a9][_0x34e03c[_0x6fa000]]){var _0x4c3423=_[_0xdc23('0x78')](_0xaf561e[_0xdc23('0x74')][_0x5ce7a9][_0x34e03c[_0x6fa000]][_0xdc23('0x79')](/"/g,'\x27'));switch(_0x6fa000){case _0xdc23('0x36'):var _0x447852=moment(_0x4c3423,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x447852[_0xdc23('0x7a')]()){_0x56a4e4['push']('\x22'+_0x4c3423+'\x22');}else{_0x3a6744['push'](_0xdc23('0x7b'));}break;case'priority':var _0x1114bd=parseInt(_0x4c3423);_0x4c3423=_['isNaN'](_0x1114bd)||_0x1114bd<0x0||_0x1114bd>0x4?_0x151e35?0x3:0x2:_0x1114bd;_0x56a4e4[_0xdc23('0x1f')]('\x22'+_0x4c3423+'\x22');break;case _0xdc23('0x3b'):var _0x2f171c=parseInt(_0x4c3423);if(_['isNumber'](_0x2f171c)&&_[_0xdc23('0x7c')](_0x190cc5,_0x2f171c)){_0x56a4e4[_0xdc23('0x1f')]('\x22'+_0x2f171c+'\x22');}else{_0x3a6744[_0xdc23('0x1f')](_0xdc23('0x7d'));}break;case'email':if(isEmail(_0x4c3423)){_0x56a4e4[_0xdc23('0x1f')]('\x22'+_0x4c3423+'\x22');}else{_0x3a6744[_0xdc23('0x1f')]('email\x20wrong\x20format');}break;case _0xdc23('0x7e'):var _0x415806=moment(_0x4c3423,_0xdc23('0x7f'),!![]);if(_0x415806[_0xdc23('0x7a')]()){_0x56a4e4['push']('\x22'+_0x4c3423+'\x22');}else{_0x3a6744[_0xdc23('0x1f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x56a4e4[_0xdc23('0x1f')]('\x22'+_0x4c3423+'\x22');}}else{switch(_0x6fa000){case _0xdc23('0x80'):case'phone':_0x3a6744[_0xdc23('0x1f')](_0x6fa000+'\x20not\x20specified');break;default:_0x56a4e4['push']('\x22\x22');}}}}else{var _0x1bc81b='';if(!_[_0xdc23('0x1d')](_0x9eac24)){if(!_0x5d39e0[_0xdc23('0x77')](_0x9eac24['id'])){for(var _0x588c8b=0x0;_0x588c8b<_0x34e03c[_0x6fa000]['length'];_0x588c8b++){var _0x4c3423=_[_0xdc23('0x78')](_0xaf561e['data'][_0x5ce7a9][_0x34e03c[_0x6fa000][_0x588c8b]][_0xdc23('0x79')](/"/g,'\x27'));var _0xf6e49=phoneDescriptions['find'](_0x2959db=>_0x2959db['itemTypeId']===_0x9eac24['id']);if(!_[_0xdc23('0x1d')](_0xf6e49)){var _0x2fec81=_[_0xdc23('0x78')](_0xaf561e[_0xdc23('0x74')][_0x5ce7a9][_0x34e03c[_0xf6e49['description']][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xdc23('0x1d')](_0x2fec81))_0x4c3423=_0x4c3423+'§'+_0x2fec81;}if(_0x1bc81b=='')_0x1bc81b=_0x4c3423;else _0x1bc81b+='|'+_0x4c3423;}_0x3dfe60['push'](_0x9eac24['id']+':'+_0x1bc81b);_0x5d39e0[_0x9eac24['id']]=0x1;}}}}if(hasAdditionalPhones){_0x56a4e4[_0xdc23('0x1f')]('\x22'+_0x3dfe60[_0xdc23('0x15')](';')+'\x22');}if(_0x3a6744[_0xdc23('0x1c')]){handleError(_0xaf561e[_0xdc23('0x74')][_0x5ce7a9],{'code':'SystemRow','message':_0x3a6744[_0xdc23('0x15')]()});}else{fs[_0xdc23('0x81')](_0x43e081,_0x56a4e4[_0xdc23('0x15')]()+'\x0a');}_0x56a4e4=[];}if(!(stats[_0xdc23('0x75')]%0xc8)){socket[_0xdc23('0x82')](_0xdc23('0x83')+_0x4d8ecc,stats);stats[_0xdc23('0x62')]=[];}}if(stopped){logger[_0xdc23('0x5f')](_0xdc23('0x84'));_0x59765b[_0xdc23('0x85')]();}}catch(_0xfefc59){handleError(_0xaf561e[_0xdc23('0x74')][_0x5ce7a9],{'code':_0xdc23('0x86'),'message':_0xfefc59['message']});logger[_0xdc23('0x22')]('step',_0xfefc59[_0xdc23('0x23')]);}},'complete':function(){try{var _0x353ae9=[];var _0x1c4866=tempTableName;_0x353ae9[_0xdc23('0x1f')](_0xdc23('0x87')+_0x1c4866+_0xdc23('0x88'));logger[_0xdc23('0x5f')](_0xdc23('0x89'),contactItemTypes[_0xdc23('0x1c')]);var _0x1e9df3=util[_0xdc23('0xd')](_0xdc23('0x8a'),_0x43e081,_0x1c4866,_0x55435a,_0x24edff[_0xdc23('0x48')],_0x24edff[_0xdc23('0x5a')]||null,NOW,NOW);if(_[_0xdc23('0x1d')](_0x34e03c[_0xdc23('0x36')])){_0x1e9df3+=_0xdc23('0x8b');}_0x353ae9[_0xdc23('0x1f')](_0x1e9df3);BPromise[_0xdc23('0x8c')](_0x353ae9,handleQuery)['then'](function(_0x5e6ca3){BPromise['all']([handleAdditionalPhones()])[_0xdc23('0x20')](function(){_0x353ae9=[];for(var _0x598313=0x0;_0x598313\x20\x20');}var _0x257408=path['join'](config[_0xdc23('0x6b')],_0xdc23('0x6c'),process[_0xdc23('0x95')][0x2]);if(!fs[_0xdc23('0x96')](_0x257408)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x66a096={};try{_0x66a096=JSON[_0xdc23('0x72')](process[_0xdc23('0x95')][0x3]);if(!_0x66a096['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x574337=0x0;if(_0x66a096[_0xdc23('0x68')][_0xdc23('0x3b')]){_0x574337=0x1;}if(!_0x66a096[_0xdc23('0x48')]){throw new Error(_0xdc23('0x97'));}}catch(_0x1107ff){throw new Error(_0xdc23('0x98'));}var _0x380cb0=[];try{_0x380cb0=_[_0xdc23('0x99')](JSON[_0xdc23('0x72')](process[_0xdc23('0x95')][0x4]),'id');}catch(_0x1e6cda){logger[_0xdc23('0x5f')](_0xdc23('0x9a'));}main(_0x257408,_0x66a096,_0x380cb0,_0x574337);}validate();process['on'](_0xdc23('0x9b'),handleStop);process['on'](_0xdc23('0x9c'),handleUncaughtException); \ No newline at end of file +var _0x081e=['ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','rows','errors','find','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','SystemRow','emit','contact:import:','abort','SystemError','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','CmContactHasItem','findOne','update','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','ContactId','ListId','createdAt','UserId','recallme','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','updatedAt','cm_contacts','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','CmHopperId','OrderBy','fields','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','info','exit','code','query','spread','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv'];(function(_0x5e3c46,_0x3bb0d8){var _0x4230d6=function(_0x2bd2a7){while(--_0x2bd2a7){_0x5e3c46['push'](_0x5e3c46['shift']());}};_0x4230d6(++_0x3bb0d8);}(_0x081e,0xc5));var _0xe081=function(_0x4706af,_0x24b450){_0x4706af=_0x4706af-0x0;var _0x2f75c4=_0x081e[_0x4706af];return _0x2f75c4;};'use strict';var fs=require('fs');var path=require(_0xe081('0x0'));var _=require(_0xe081('0x1'));var Papa=require('papaparse');var util=require(_0xe081('0x2'));var BPromise=require('bluebird');var moment=require(_0xe081('0x3'));var squel=require(_0xe081('0x4'));var Redis=require(_0xe081('0x5'));var db=require(_0xe081('0x6'))['db'];var config=require(_0xe081('0x7'));var logger=require(_0xe081('0x8'))(_0xe081('0x9'));config['redis']=_[_0xe081('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xe081('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xe081('0xc')+moment()['format'](_0xe081('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x6dae6e){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))*$/[_0xe081('0xe')](_0x6dae6e);}function selectNotIn(_0x57dc18,_0x540e8a,_0x1745b7,_0x59ddc0,_0x1dd90e){return squel[_0xe081('0xf')]()[_0xe081('0x10')](_0xe081('0x11'))[_0xe081('0x12')](_0x59ddc0)[_0xe081('0x13')](_0x540e8a,null,_0x540e8a+'.id\x20=\x20'+_0x59ddc0+'.'+_0x1745b7)[_0xe081('0x14')](_0x59ddc0+'.'+_0x1745b7+_0xe081('0x15')+_0x57dc18+'.'+_0x1745b7)['where'](_0x540e8a+_0xe081('0x16')+_0x1dd90e[_0xe081('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xe10895,_0x4fbd8a){promisesAdditionalPhones=[];promisesContact=[];return db[_0xe081('0x17')]['query']('select\x20*\x20from\x20'+tempTableName)['spread'](function(_0x4911a0){if(_0x4911a0!==null){var _0x2d0fce=[];for(var _0x47026f=0x0;_0x47026f<_0x4911a0[_0xe081('0x18')];_0x47026f++){var _0x5294d0=_0x4911a0[_0x47026f];if(!_['isNil'](_0x5294d0[_0xe081('0x11')])){if(!_[_0xe081('0x19')](_0x5294d0[_0xe081('0x1a')]))_0x2d0fce['push'](insertAdditionalPhones(_0x5294d0));promisesContact[_0xe081('0x1b')]({'contact':_0x5294d0});}}}Promise[_0xe081('0x1c')](_0x2d0fce)[_0xe081('0x1d')](function(){_0xe10895({'val':0x1});});})[_0xe081('0x1e')](function(_0x2f354b){logger[_0xe081('0x1f')](_0x2f354b[_0xe081('0x20')]);});});}function insertAdditionalPhones(_0x3963bd){return new Promise(function(_0xa328b8,_0x4c0e3a){var _0x2975ef=_0x3963bd[_0xe081('0x1a')];if(_[_0xe081('0x19')](_0x2975ef))_0x4c0e3a({'val':0x0});else{var _0x50cbb9=_0x2975ef['split'](';');var _0x2bb7b8=[];orderBy=0x0;for(var _0x1dcc72=0x0;_0x1dcc72<_0x50cbb9[_0xe081('0x18')];_0x1dcc72++){_0x2bb7b8[_0xe081('0x1b')](splitAdditionalPhone(_0x3963bd['id'],_0x50cbb9[_0x1dcc72]));}Promise[_0xe081('0x1c')](_0x2bb7b8)[_0xe081('0x1d')](function(){_0xa328b8({'val':_0x50cbb9['length']});});}});}function splitAdditionalPhone(_0x3cbd9c,_0x462700){return new Promise(function(_0x2b4cef,_0x2eca97){var _0x46e0f2=_0x462700[_0xe081('0x21')](':');var _0x2b6272=_0x46e0f2[0x0];var _0xeb720=_0x46e0f2[0x1];if(_0xeb720!==''){var _0x28cd52=_0xeb720[_0xe081('0x21')]('|');var _0x4f1272=[];for(var _0x335986=0x0;_0x335986<_0x28cd52[_0xe081('0x18')];_0x335986++){if(_0x28cd52[_0x335986]!==''){var _0x3c9dde=_['filter'](promisesAdditionalPhones,{'contactId':_0x3cbd9c,'phone':_0x28cd52[_0x335986]});if(_0x3c9dde[_0xe081('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3cbd9c,'contactTypeId':_0x2b6272,'phone':_0x28cd52[_0x335986],'orderBy':orderBy});}}}_0x2b4cef({'ok':0x1});}else _0x2b4cef({'res':0x0});});}function createAdditionalPhone(_0x4256ba,_0x41b1d7,_0xd4d01e,_0x17f6e7){var _0x3cd360='';var _0x5ddcd5='';var _0x2b53d8=_0xd4d01e[_0xe081('0x21')]('§');_0x3cd360=_0x2b53d8[0x0];if(_0x2b53d8[_0xe081('0x18')]==0x2)_0x5ddcd5=_0x2b53d8[0x1];return new Promise(function(_0x2096c7,_0xb52eef){return db[_0xe081('0x22')][_0xe081('0x23')]({'where':{'CmContactId':_0x4256ba,'item':_0x3cd360}})[_0xe081('0x1d')](function(_0x4be615){if(_0x4be615){return db[_0xe081('0x22')][_0xe081('0x24')]({'ItemTypeId':_0x41b1d7,'description':_0x5ddcd5,'OrderBy':_0x17f6e7},{'where':{'CmContactId':_0x4256ba,'item':_0x3cd360}})[_0xe081('0x1d')](function(_0x229739){_0x2096c7({'res':'updated'});});}else{return db[_0xe081('0x22')]['create']({'CmContactId':_0x4256ba,'item':_0x3cd360,'ItemTypeId':_0x41b1d7,'description':_0x5ddcd5,'OrderBy':_0x17f6e7,'ItemClass':_0xe081('0x25')})[_0xe081('0x1d')](function(_0x424198){_0x2096c7({'res':'inserted'});});}});});}function updateContact(_0x3699d3){return new Promise(function(_0x44199f,_0x3f383f){var _0x2e12b6=_0x3699d3['id'];delete _0x3699d3['id'];return db['CmContact'][_0xe081('0x24')](_0x3699d3,{'where':{'id':_0x2e12b6}})[_0xe081('0x1d')](function(_0x1c6504){updatedRows+=0x1;return db['CmHopper'][_0xe081('0x24')]({'phone':_0x3699d3[_0xe081('0x11')]},{'where':{'ContactId':_0x2e12b6}})[_0xe081('0x1d')](function(_0x72b4f6){_0x44199f({'ret':'OK'});});});});}function insertCmHopper(_0x5e63c9,_0x1936f9,_0x4466bd,_0x1c8089,_0x97763d){var _0x57877e=[_0xe081('0x26'),_0xe081('0x27'),_0xe081('0x28'),'cm_contacts.ListId',_0x1936f9+'.'+_0x1c8089,_0xe081('0x29'),_0xe081('0x2a'),_0xe081('0x2b'),_0xe081('0x2c'),'\x22'+_0x97763d+'\x22'];return squel[_0xe081('0x2d')]()[_0xe081('0x2e')]('cm_hopper')[_0xe081('0x2f')]([_0xe081('0x11'),'scheduledat',_0xe081('0x30'),_0xe081('0x31'),_0x1c8089,_0xe081('0x32'),'updatedAt','priority',_0xe081('0x33'),_0xe081('0x34')],squel[_0xe081('0xf')]()['fields'](_0x57877e)[_0xe081('0x12')](_0x1936f9)[_0xe081('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1936f9+_0xe081('0x35'))[_0xe081('0x13')](_0x4466bd,null,_0x4466bd+_0xe081('0x36')+_0x1936f9+'.'+_0x1c8089)['where'](_0x1936f9+_0xe081('0x37'),_0x5e63c9)[_0xe081('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe081('0x14')](_0xe081('0x38'),selectNotIn(_0x1936f9,_0x4466bd,_0x1c8089,_0xe081('0x39'),[_0xe081('0x3a'),'\x22onlyIfOpen\x22']))[_0xe081('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1936f9,_0x4466bd,_0x1c8089,'cm_hopper',['\x22always\x22'])))[_0xe081('0x3b')]();}function insertCmHopperBlack(_0x1d2e02,_0x443038,_0x10065b,_0x187a6f){var _0x501360=[_0xe081('0x26'),_0xe081('0x28'),_0xe081('0x3c'),_0x443038+'.'+_0x187a6f,_0xe081('0x29'),'cm_contacts.updatedAt'];return squel[_0xe081('0x2d')]()[_0xe081('0x2e')](_0xe081('0x3d'))[_0xe081('0x2f')]([_0xe081('0x11'),_0xe081('0x30'),_0xe081('0x31'),_0x187a6f,_0xe081('0x32'),_0xe081('0x3e')],squel['select']()['fields'](_0x501360)['from'](_0x443038)[_0xe081('0x13')](_0xe081('0x3f'),null,'cm_contacts.ListId\x20=\x20'+_0x443038+_0xe081('0x35'))[_0xe081('0x13')](_0x10065b,null,_0x10065b+_0xe081('0x36')+_0x443038+'.'+_0x187a6f)[_0xe081('0x14')](_0x443038+'.CmListId\x20=\x20?',_0x1d2e02)[_0xe081('0x14')](_0xe081('0x40'),NOW)[_0xe081('0x14')](_0xe081('0x38'),squel['select']()['field'](_0xe081('0x11'))[_0xe081('0x12')]('cm_hopper_black')[_0xe081('0x14')](_0xe081('0x41'),_0x1d2e02)[_0xe081('0x14')](_0x187a6f+_0xe081('0x42'),_0x443038+'.'+_0x187a6f)))[_0xe081('0x3b')]();}function insertCmHopperAdditionalPhones(_0x361ed5){var _0x219032=[_0xe081('0x43'),_0xe081('0x44'),_0xe081('0x45'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xe081('0x2d')]()[_0xe081('0x2e')]('cm_hopper_additional_phones')[_0xe081('0x2f')]([_0xe081('0x46'),_0xe081('0x11'),_0xe081('0x47'),_0xe081('0x32'),_0xe081('0x3e')],squel['select']()[_0xe081('0x48')](_0x219032)['from'](_0xe081('0x39'))[_0xe081('0x13')](_0xe081('0x3f'),null,_0xe081('0x49'))[_0xe081('0x13')](_0xe081('0x4a'),null,_0xe081('0x4b'))[_0xe081('0x14')](_0xe081('0x4c'),_0x361ed5)[_0xe081('0x14')](_0xe081('0x40'),NOW))['toString']();}function insertCmContact(_0x5579f4,_0x53c418,_0x555a73,_0x20d087){var _0x30072a=_[_0xe081('0x4d')](_[_0xe081('0x4e')](_0x20d087),[_0xe081('0x31'),_0xe081('0x4f'),_0xe081('0x32'),_0xe081('0x3e')]);return squel[_0xe081('0x2d')]()['into'](_0xe081('0x3f'))['fromQuery'](_0x30072a,squel['select']()[_0xe081('0x48')](_0x30072a)[_0xe081('0x12')](_0x53c418)[_0xe081('0x14')]('('+_0x555a73[_0xe081('0x13')](',')+_0xe081('0x50'),squel[_0xe081('0xf')]()['fields'](_0x555a73)[_0xe081('0x12')]('cm_contacts')[_0xe081('0x14')](_0xe081('0x41'),_0x5579f4))[_0xe081('0x14')]('id\x20IN\x20?',squel[_0xe081('0xf')]()[_0xe081('0x10')](_0xe081('0x51'),_0xe081('0x52'))[_0xe081('0x12')](_0x53c418)['group'](_0x555a73['join'](','))))[_0xe081('0x3b')]();}function handleStop(){logger[_0xe081('0x53')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3e2d5f){logger[_0xe081('0x1f')](_0x3e2d5f[_0xe081('0x20')]);process[_0xe081('0x54')](0x1);}function handleError(_0x151699,_0x47bf05){stats['errors'][_0xe081('0x1b')]({'name':_0x47bf05[_0xe081('0x55')],'message':_0x47bf05['message'],'row':_0x151699});}function handleQuery(_0x55adf9){logger[_0xe081('0x53')](_0x55adf9);return db['sequelize'][_0xe081('0x56')](_0x55adf9)[_0xe081('0x57')](function(_0x53a3d8){results[_0xe081('0x1b')](_0x53a3d8);})[_0xe081('0x1e')](function(_0x302fcc){logger[_0xe081('0x1f')](_0x302fcc[_0xe081('0x20')]);});}function main(_0x5f17a3,_0x2a5a60,_0x44d3b7,_0x3e5869){logger[_0xe081('0x53')](_0xe081('0x58'),_0x5f17a3,JSON[_0xe081('0x59')](_0x2a5a60));process[_0xe081('0x5a')](_0xe081('0x5b'));var _0x5e9e74=_0x2a5a60[_0xe081('0x5c')];var _0xd3b4be=_[_0xe081('0x5d')](_0x5e9e74);var _0x10ec0b=_0x2a5a60['socket_timestamp'];var _0xce09de=path[_0xe081('0x13')](config[_0xe081('0x5e')],_0xe081('0x5f'),_0x10ec0b+_0xe081('0x60'));logger[_0xe081('0x53')]('body',_0x2a5a60);db[_0xe081('0x61')][_0xe081('0x62')]({'raw':!![],'attributes':['id',_0xe081('0x63')]})[_0xe081('0x1d')](function(_0x3b2c97){for(var _0x4fb367=0x0;_0x4fb367<_0x3b2c97[_0xe081('0x18')];_0x4fb367++){if(_0x3b2c97[_0x4fb367][_0xe081('0x63')]in _0x5e9e74){contactItemTypes[_0xe081('0x1b')](_0x3b2c97[_0x4fb367]);delete _0xd3b4be[_0x3b2c97[_0x4fb367][_0xe081('0x63')]];hasAdditionalPhones=!![];}for(var _0xdf8030 in _0x5e9e74){if(_0x3b2c97[_0x4fb367]['name']+_0xe081('0x64')===_0xdf8030){phoneDescriptions[_0xe081('0x1b')]({'itemTypeId':_0x3b2c97[_0x4fb367]['id'],'description':_0xdf8030});delete _0xd3b4be[_0xdf8030];}}}if(hasAdditionalPhones)_0xd3b4be['AdditionalPhones']='';var _0x45c43b=_[_0xe081('0x4e')](_0xd3b4be)[_0xe081('0x13')]();logger[_0xe081('0x53')](_0xe081('0x65'),_0x45c43b);fs[_0xe081('0x66')](_0xce09de,_0x45c43b+'\x0a');Papa[_0xe081('0x67')](fs[_0xe081('0x68')](_0x5f17a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x9dc25b,_0x3719a0){try{for(var _0x4d7de1=0x0,_0x131a78=[];_0x4d7de1<_0x9dc25b[_0xe081('0x69')][_0xe081('0x18')];_0x4d7de1++){stats[_0xe081('0x6a')]+=0x1;if(_0x9dc25b[_0xe081('0x6b')][_0x4d7de1]){handleError(_0x9dc25b[_0xe081('0x69')][_0x4d7de1],_0x9dc25b[_0xe081('0x6b')][_0x4d7de1]);}else{var _0x2872fa=[];var _0x36f290=[];var _0x1e76de={};for(var _0x179598 in _0x5e9e74){let _0x445a4c=contactItemTypes[_0xe081('0x6c')](_0x3d1d53=>_0x3d1d53['name']===_0x179598);let _0x16e936=contactItemTypes[_0xe081('0x6c')](_0x26b9fa=>_0x26b9fa[_0xe081('0x63')]+_0xe081('0x64')===_0x179598);if(_[_0xe081('0x19')](_0x445a4c)&&_[_0xe081('0x19')](_0x16e936)){if(_0x5e9e74[_0xe081('0x6d')](_0x179598)){if(_0x9dc25b[_0xe081('0x69')][_0x4d7de1][_0x5e9e74[_0x179598]]){var _0x197493=_[_0xe081('0x6e')](_0x9dc25b[_0xe081('0x69')][_0x4d7de1][_0x5e9e74[_0x179598]][_0xe081('0x6f')](/"/g,'\x27'));switch(_0x179598){case _0xe081('0x70'):var _0x2bec35=moment(_0x197493,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2bec35[_0xe081('0x71')]()){_0x131a78[_0xe081('0x1b')]('\x22'+_0x197493+'\x22');}else{_0x2872fa[_0xe081('0x1b')](_0xe081('0x72'));}break;case _0xe081('0x73'):var _0x52818f=parseInt(_0x197493);_0x197493=_[_0xe081('0x74')](_0x52818f)||_0x52818f<0x0||_0x52818f>0x4?_0x3e5869?0x3:0x2:_0x52818f;_0x131a78[_0xe081('0x1b')]('\x22'+_0x197493+'\x22');break;case _0xe081('0x33'):var _0x59715b=parseInt(_0x197493);if(_[_0xe081('0x75')](_0x59715b)&&_['includes'](_0x44d3b7,_0x59715b)){_0x131a78[_0xe081('0x1b')]('\x22'+_0x59715b+'\x22');}else{_0x2872fa['push'](_0xe081('0x76'));}break;case _0xe081('0x77'):if(isEmail(_0x197493)){_0x131a78[_0xe081('0x1b')]('\x22'+_0x197493+'\x22');}else{_0x2872fa[_0xe081('0x1b')](_0xe081('0x78'));}break;case'dateOfBirth':var _0x46f680=moment(_0x197493,'YYYY-MM-DD',!![]);if(_0x46f680[_0xe081('0x71')]()){_0x131a78[_0xe081('0x1b')]('\x22'+_0x197493+'\x22');}else{_0x2872fa['push'](_0xe081('0x79'));}break;default:_0x131a78[_0xe081('0x1b')]('\x22'+_0x197493+'\x22');}}else{switch(_0x179598){case _0xe081('0x7a'):case _0xe081('0x11'):_0x2872fa['push'](_0x179598+'\x20not\x20specified');break;default:_0x131a78[_0xe081('0x1b')]('\x22\x22');}}}}else{var _0x111a41='';if(!_['isNil'](_0x445a4c)){if(!_0x1e76de[_0xe081('0x6d')](_0x445a4c['id'])){for(var _0x439ce3=0x0;_0x439ce3<_0x5e9e74[_0x179598]['length'];_0x439ce3++){var _0x197493=_[_0xe081('0x6e')](_0x9dc25b[_0xe081('0x69')][_0x4d7de1][_0x5e9e74[_0x179598][_0x439ce3]]['replace'](/"/g,'\x27'));var _0x3e6c9c=phoneDescriptions[_0xe081('0x6c')](_0x3412d2=>_0x3412d2[_0xe081('0x7b')]===_0x445a4c['id']);if(!_[_0xe081('0x19')](_0x3e6c9c)){var _0x1d9f53=_[_0xe081('0x6e')](_0x9dc25b[_0xe081('0x69')][_0x4d7de1][_0x5e9e74[_0x3e6c9c['description']][0x0]][_0xe081('0x6f')](/"/g,'\x27'));if(!_[_0xe081('0x19')](_0x1d9f53))_0x197493=_0x197493+'§'+_0x1d9f53;}if(_0x111a41=='')_0x111a41=_0x197493;else _0x111a41+='|'+_0x197493;}_0x36f290[_0xe081('0x1b')](_0x445a4c['id']+':'+_0x111a41);_0x1e76de[_0x445a4c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x131a78['push']('\x22'+_0x36f290['join'](';')+'\x22');}if(_0x2872fa[_0xe081('0x18')]){handleError(_0x9dc25b[_0xe081('0x69')][_0x4d7de1],{'code':_0xe081('0x7c'),'message':_0x2872fa[_0xe081('0x13')]()});}else{fs['appendFileSync'](_0xce09de,_0x131a78[_0xe081('0x13')]()+'\x0a');}_0x131a78=[];}if(!(stats[_0xe081('0x6a')]%0xc8)){socket[_0xe081('0x7d')](_0xe081('0x7e')+_0x10ec0b,stats);stats['errors']=[];}}if(stopped){logger[_0xe081('0x53')]('Abort\x20parser');_0x3719a0[_0xe081('0x7f')]();}}catch(_0x437a7a){handleError(_0x9dc25b[_0xe081('0x69')][_0x4d7de1],{'code':_0xe081('0x80'),'message':_0x437a7a[_0xe081('0x20')]});logger['error']('step',_0x437a7a[_0xe081('0x20')]);}},'complete':function(){try{var _0x23733c=[];var _0x323f09=tempTableName;_0x23733c[_0xe081('0x1b')]('CREATE\x20TABLE\x20'+_0x323f09+_0xe081('0x81'));logger['info']('CIS\x20len',contactItemTypes[_0xe081('0x18')]);var _0x7a4d28=util['format'](_0xe081('0x82'),_0xce09de,_0x323f09,_0x45c43b,_0x2a5a60[_0xe081('0x31')],_0x2a5a60['CompanyId']||null,NOW,NOW);if(_[_0xe081('0x19')](_0x5e9e74[_0xe081('0x70')])){_0x7a4d28+=',\x20scheduledAt\x20=\x20NOW()';}_0x23733c['push'](_0x7a4d28);BPromise['each'](_0x23733c,handleQuery)[_0xe081('0x1d')](function(_0x2153c6){BPromise[_0xe081('0x1c')]([handleAdditionalPhones()])[_0xe081('0x1d')](function(){_0x23733c=[];for(var _0xef112=0x0;_0xef112\x20\x20');}var _0x547250=path[_0xe081('0x13')](config[_0xe081('0x5e')],_0xe081('0x5f'),process['argv'][0x2]);if(!fs[_0xe081('0x8d')](_0x547250)){throw new Error(_0xe081('0x8e'));}var _0xc869a8={};try{_0xc869a8=JSON[_0xe081('0x67')](process['argv'][0x3]);if(!_0xc869a8[_0xe081('0x5c')]){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x192910=0x0;if(_0xc869a8[_0xe081('0x5c')]['UserId']){_0x192910=0x1;}if(!_0xc869a8[_0xe081('0x31')]){throw new Error(_0xe081('0x8f'));}}catch(_0x29b3f9){throw new Error(_0xe081('0x90'));}var _0xc7659=[];try{_0xc7659=_['map'](JSON[_0xe081('0x67')](process[_0xe081('0x8c')][0x4]),'id');}catch(_0x167ab5){logger[_0xe081('0x53')](_0xe081('0x91'));}main(_0x547250,_0xc869a8,_0xc7659,_0x192910);}validate();process['on'](_0xe081('0x92'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index bd5d560..7f9c148 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 _0x1576=['string','***\x20Call\x20Info\x20***','Caller\x20Name','calleridname','keyValue','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','starttime','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','variable','push','calleridnum','outbound','Outbound\x20Call','destcalleridnum'];(function(_0x2f5270,_0x51ed0d){var _0x1af773=function(_0x5491e5){while(--_0x5491e5){_0x2f5270['push'](_0x2f5270['shift']());}};_0x1af773(++_0x51ed0d);}(_0x1576,0x9b));var _0x6157=function(_0x4f484c,_0x9bccb4){_0x4f484c=_0x4f484c-0x0;var _0x276e95=_0x1576[_0x4f484c];return _0x276e95;};'use strict';exports[_0x6157('0x0')]=function(_0x1ce5ee,_0xe319e5){var _0x5a5a23=[{'type':'string','content':_0x6157('0x1'),'variableName':null}];switch(_0x1ce5ee[_0x6157('0x2')]()){case'voice':switch(_0xe319e5['toLowerCase']()){case'inbound':_0x5a5a23['push']({'type':_0x6157('0x3'),'content':'','variableName':'queue'});_0x5a5a23[_0x6157('0x4')]({'type':'variable','content':'','variableName':_0x6157('0x5')});break;case _0x6157('0x6'):_0x5a5a23['push']({'type':'string','content':_0x6157('0x7'),'variableName':null});_0x5a5a23[_0x6157('0x4')]({'type':_0x6157('0x3'),'content':'','variableName':_0x6157('0x8')});break;}}return _0x5a5a23;};exports['getDescriptions']=function(_0x77b4b9,_0x410a74){var _0x2ceefb=[];switch(_0x77b4b9['toLowerCase']()){case'voice':switch(_0x410a74['toLowerCase']()){case'inbound':_0x2ceefb=[{'type':_0x6157('0x9'),'content':_0x6157('0xa'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0x6157('0x3'),'variableName':_0x6157('0x5')},{'type':'keyValue','content':'','key':_0x6157('0xb'),'keyType':_0x6157('0x3'),'variableName':_0x6157('0xc')},{'type':_0x6157('0xd'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0x6157('0xe')},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0xf'),'keyType':'variable','variableName':_0x6157('0x10')},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0x11'),'keyType':_0x6157('0x3'),'variableName':_0x6157('0x12')},{'type':'keyValue','content':'','key':_0x6157('0x13'),'keyType':_0x6157('0x3'),'variableName':_0x6157('0x14')},{'type':_0x6157('0x9'),'content':_0x6157('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x6157('0xd'),'content':'','key':'Agent\x20Name','keyType':_0x6157('0x3'),'variableName':_0x6157('0x16')},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0x17'),'keyType':_0x6157('0x3'),'variableName':_0x6157('0x8')},{'type':_0x6157('0x9'),'content':_0x6157('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x6157('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0x6157('0x3'),'variableName':'agentcalledAt'},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0x19'),'keyType':_0x6157('0x3'),'variableName':_0x6157('0x1a')},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0x1b'),'keyType':_0x6157('0x3'),'variableName':_0x6157('0x1c')},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0x1d'),'keyType':_0x6157('0x3'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':_0x6157('0x1e'),'keyType':_0x6157('0x3'),'variableName':_0x6157('0x1f')}];break;case'outbound':_0x2ceefb=[{'type':'string','content':_0x6157('0xa'),'variableName':null},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0x20'),'keyType':'variable','keyContent':'','variableName':_0x6157('0x8')},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0x21'),'keyType':_0x6157('0x3'),'keyContent':'','variableName':'membername'},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0x11'),'keyType':_0x6157('0x3'),'keyContent':'','variableName':_0x6157('0x12')},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0x13'),'keyType':'variable','keyContent':'','variableName':_0x6157('0x22')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0x6157('0x3'),'keyContent':'','variableName':_0x6157('0x23')},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0x24'),'keyType':_0x6157('0x3'),'keyContent':'','variableName':_0x6157('0x25')},{'type':_0x6157('0xd'),'content':'','key':_0x6157('0x26'),'keyType':_0x6157('0x3'),'keyContent':'','variableName':_0x6157('0x27')},{'type':_0x6157('0xd'),'content':'','key':'Billable\x20Time','keyType':_0x6157('0x3'),'keyContent':'','variableName':_0x6157('0x28')}];break;}}return _0x2ceefb;}; \ No newline at end of file +var _0x336a=['queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','talktime','***\x20Call\x20Info\x20***','Member\x20Name','membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','endtime','Duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','variable','outbound','Outbound\x20Call','destcalleridnum','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten'];(function(_0x522501,_0x33153e){var _0x32476a=function(_0x385771){while(--_0x385771){_0x522501['push'](_0x522501['shift']());}};_0x32476a(++_0x33153e);}(_0x336a,0x18b));var _0xa336=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x336a[_0x24f31b];return _0x488401;};'use strict';exports['getSubjects']=function(_0x59ac4b,_0x4dc0a0){var _0x8f7f46=[{'type':_0xa336('0x0'),'content':_0xa336('0x1'),'variableName':null}];switch(_0x59ac4b[_0xa336('0x2')]()){case _0xa336('0x3'):switch(_0x4dc0a0[_0xa336('0x2')]()){case _0xa336('0x4'):_0x8f7f46['push']({'type':'variable','content':'','variableName':'queue'});_0x8f7f46['push']({'type':_0xa336('0x5'),'content':'','variableName':'calleridnum'});break;case _0xa336('0x6'):_0x8f7f46['push']({'type':_0xa336('0x0'),'content':_0xa336('0x7'),'variableName':null});_0x8f7f46['push']({'type':'variable','content':'','variableName':_0xa336('0x8')});break;}}return _0x8f7f46;};exports['getDescriptions']=function(_0x456e51,_0x43ae2a){var _0x1303ee=[];switch(_0x456e51[_0xa336('0x2')]()){case _0xa336('0x3'):switch(_0x43ae2a[_0xa336('0x2')]()){case _0xa336('0x4'):_0x1303ee=[{'type':_0xa336('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xa336('0x9'),'keyType':_0xa336('0x5'),'variableName':'calleridnum'},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0xb'),'keyType':_0xa336('0x5'),'variableName':_0xa336('0xc')},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0xd'),'keyType':'variable','variableName':_0xa336('0xe')},{'type':_0xa336('0xa'),'content':'','key':'Queue','keyType':'variable','variableName':_0xa336('0xf')},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x10'),'keyType':'variable','variableName':_0xa336('0x11')},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x12'),'keyType':_0xa336('0x5'),'variableName':_0xa336('0x13')},{'type':_0xa336('0x0'),'content':_0xa336('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x15'),'keyType':_0xa336('0x5'),'variableName':_0xa336('0x16')},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x17'),'keyType':'variable','variableName':'destcalleridnum'},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x18'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x19'),'keyType':'variable','variableName':_0xa336('0x1a')},{'type':_0xa336('0xa'),'content':'','key':'Agent\x20Complete','keyType':_0xa336('0x5'),'variableName':_0xa336('0x1b')},{'type':'keyValue','content':'','key':_0xa336('0x1c'),'keyType':_0xa336('0x5'),'variableName':_0xa336('0x1d')},{'type':_0xa336('0xa'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0xa336('0x1e')}];break;case'outbound':_0x1303ee=[{'type':_0xa336('0x0'),'content':_0xa336('0x1f'),'variableName':null},{'type':_0xa336('0xa'),'content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0xa336('0x8')},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x20'),'keyType':_0xa336('0x5'),'keyContent':'','variableName':_0xa336('0x21')},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x10'),'keyType':_0xa336('0x5'),'keyContent':'','variableName':_0xa336('0x11')},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x12'),'keyType':_0xa336('0x5'),'keyContent':'','variableName':_0xa336('0x22')},{'type':_0xa336('0x0'),'content':_0xa336('0x23')},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x24'),'keyType':_0xa336('0x5'),'keyContent':'','variableName':'answertime'},{'type':_0xa336('0xa'),'content':'','key':'Complete\x20Time','keyType':_0xa336('0x5'),'keyContent':'','variableName':_0xa336('0x25')},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x26'),'keyType':_0xa336('0x5'),'keyContent':'','variableName':'duration'},{'type':_0xa336('0xa'),'content':'','key':_0xa336('0x27'),'keyType':_0xa336('0x5'),'keyContent':'','variableName':_0xa336('0x28')}];break;}}return _0x1303ee;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 77c6815..5d27669 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 _0xee6a=['length','clause','order','forEach','contactName','DESC','closed','getClosedOrderClause','rows','catch','clone','omit','html','phone','fax','updateUser','lodash','findAll','skipInteractionsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','body','contact','fields','filter','user','having','read','tags','checkAccountsRestrictions','group','i.id','tag','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee6a,0x82));var _0xaee6=function(_0x4c915d,_0x1ca430){_0x4c915d=_0x4c915d-0x0;var _0x24948b=_0xee6a[_0x4c915d];return _0x24948b;};'use strict';var _=require(_0xaee6('0x0'));var sqlUtils=require('./sql-utils');var utils=require('./utils');exports[_0xaee6('0x1')]=function(_0x33558d,_0x33cad7,_0x2767bd,_0x141049,_0x15f805){var _0x36888d={'count':0x0,'rows':[]};var _0x38d008=sqlUtils[_0xaee6('0x2')](_0x33558d,_0x2767bd,_0x33cad7);if(_0x38d008){return Promise[_0xaee6('0x3')](_0x36888d);}var _0x3de1d0=sqlUtils['getInteractionsQuery'](_0x33558d);var _0x51798a={};return Promise[_0xaee6('0x3')]()[_0xaee6('0x4')](function(){if(_0x33cad7[_0xaee6('0x5')]){return sqlUtils[_0xaee6('0x6')](_0x33cad7[_0xaee6('0x5')],_0x15f805);}else{return sqlUtils[_0xaee6('0x7')](_0x33558d,_0x33cad7,_0x15f805);}})[_0xaee6('0x4')](function(_0x425acd){_0x3de1d0[_0xaee6('0x8')](_0x425acd[_0xaee6('0x9')]);_0x3de1d0['where'](_0x425acd[_0xaee6('0xa')]);_0x3de1d0[_0xaee6('0x8')](_0x425acd['default']);_0x3de1d0[_0xaee6('0x8')](_0x425acd[_0xaee6('0xb')]);_0x3de1d0['where'](_0x425acd[_0xaee6('0xc')]);_0x3de1d0[_0xaee6('0x8')](_0x425acd[_0xaee6('0xd')]);_0x3de1d0[_0xaee6('0xe')](_0x425acd[_0xaee6('0xf')]);_0x51798a=_0x425acd[_0xaee6('0x10')];return sqlUtils[_0xaee6('0x11')](_0x33558d,_0x2767bd,_0x33cad7);})[_0xaee6('0x4')](function(_0x139601){_0x3de1d0[_0xaee6('0x8')](_0x139601);_0x3de1d0[_0xaee6('0x12')](_0xaee6('0x13'));var _0x2cee31=_0x33cad7[_0xaee6('0x5')]?_0x51798a['ids']:_0x33cad7[_0xaee6('0x14')];return sqlUtils['countFilteredInteractions'](_0x3de1d0,_0x2cee31);})[_0xaee6('0x4')](function(_0x2cf020){_0x36888d[_0xaee6('0x15')]=_0x2cf020[_0xaee6('0x16')];if(_0x36888d[_0xaee6('0x15')]===0x0){return[];}_0x3de1d0['having'](_0x51798a[_0xaee6('0x17')]);if(_0x141049['order']){_0x141049[_0xaee6('0x18')][_0xaee6('0x19')](function(_0x2f4f09){var _0x3bf52a=_0x2f4f09[0x0]===_0xaee6('0x1a')?_0x2f4f09[0x0]:'i.'+_0x2f4f09[0x0];_0x3de1d0[_0xaee6('0x18')](_0x3bf52a,_0x2f4f09[0x1]===_0xaee6('0x1b')?![]:!![]);if(_0x2f4f09[0x0]===_0xaee6('0x1c')){var _0x18261a=sqlUtils[_0xaee6('0x1d')](_0x33558d,_0x33cad7);_0x3de1d0[_0xaee6('0x18')](_0x18261a,_0x2f4f09[0x1]===_0xaee6('0x1b')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x33558d,_0x3de1d0,_0x33cad7,_0x141049);})[_0xaee6('0x4')](function(_0xae6835){_0x36888d[_0xaee6('0x1e')]=_0xae6835;return _0x36888d;})[_0xaee6('0x1f')](function(_0x1a3352){throw _0x1a3352;});};exports['tracked']=function(_0x2c94cb,_0x44ac3f){return function(_0x27cc92,_0x44d274,_0x1e4546){var _0x51f8d0=_0x27cc92[_0xaee6('0xd')];var _0x5f38c0={};var _0x4c3644=_0x27cc92['query'];if(_0x5f38c0){_0x5f38c0=_[_0xaee6('0x20')](_0x27cc92[_0xaee6('0x9')]);_0x5f38c0=_[_0xaee6('0x21')](_0x5f38c0,[_0xaee6('0x9'),_0xaee6('0x22'),_0xaee6('0x23'),_0xaee6('0x24'),'mobile']);}utils[_0xaee6('0x25')](_0x51f8d0,_0x5f38c0,_0x4c3644,_0x2c94cb,_0x44ac3f);_0x1e4546(null);};}; \ No newline at end of file +var _0x99c0=['omit','html','phone','fax','mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','then','parseAdvancedSearchFilter','search','where','body','contact','default','fields','user','read','i.id','ids','tag','countFilteredInteractions','count','length','having','order','forEach','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions','rows','catch','tracked','query','clone'];(function(_0x1d7bc0,_0x50a455){var _0x15a179=function(_0x378a42){while(--_0x378a42){_0x1d7bc0['push'](_0x1d7bc0['shift']());}};_0x15a179(++_0x50a455);}(_0x99c0,0xaa));var _0x099c=function(_0xe02296,_0x93dfa6){_0xe02296=_0xe02296-0x0;var _0x31df57=_0x99c0[_0xe02296];return _0x31df57;};'use strict';var _=require(_0x099c('0x0'));var sqlUtils=require(_0x099c('0x1'));var utils=require(_0x099c('0x2'));exports[_0x099c('0x3')]=function(_0xa0a244,_0x1a694b,_0x1e7484,_0x328b3e,_0x5176bf){var _0x12c521={'count':0x0,'rows':[]};var _0xeea567=sqlUtils[_0x099c('0x4')](_0xa0a244,_0x1e7484,_0x1a694b);if(_0xeea567){return Promise[_0x099c('0x5')](_0x12c521);}var _0x29a02e=sqlUtils['getInteractionsQuery'](_0xa0a244);var _0x28522b={};return Promise[_0x099c('0x5')]()[_0x099c('0x6')](function(){if(_0x1a694b['search']){return sqlUtils[_0x099c('0x7')](_0x1a694b[_0x099c('0x8')],_0x5176bf);}else{return sqlUtils['parseQueryParameters'](_0xa0a244,_0x1a694b,_0x5176bf);}})[_0x099c('0x6')](function(_0x3bb5ba){_0x29a02e[_0x099c('0x9')](_0x3bb5ba[_0x099c('0xa')]);_0x29a02e[_0x099c('0x9')](_0x3bb5ba[_0x099c('0xb')]);_0x29a02e['where'](_0x3bb5ba[_0x099c('0xc')]);_0x29a02e[_0x099c('0x9')](_0x3bb5ba[_0x099c('0xd')]);_0x29a02e['where'](_0x3bb5ba['filter']);_0x29a02e[_0x099c('0x9')](_0x3bb5ba[_0x099c('0xe')]);_0x29a02e['having'](_0x3bb5ba[_0x099c('0xf')]);_0x28522b=_0x3bb5ba['tags'];return sqlUtils['checkAccountsRestrictions'](_0xa0a244,_0x1e7484,_0x1a694b);})['then'](function(_0x46c2d2){_0x29a02e[_0x099c('0x9')](_0x46c2d2);_0x29a02e['group'](_0x099c('0x10'));var _0x3533e3=_0x1a694b[_0x099c('0x8')]?_0x28522b[_0x099c('0x11')]:_0x1a694b[_0x099c('0x12')];return sqlUtils[_0x099c('0x13')](_0x29a02e,_0x3533e3);})[_0x099c('0x6')](function(_0x1a7b19){_0x12c521[_0x099c('0x14')]=_0x1a7b19[_0x099c('0x15')];if(_0x12c521[_0x099c('0x14')]===0x0){return[];}_0x29a02e[_0x099c('0x16')](_0x28522b['clause']);if(_0x328b3e[_0x099c('0x17')]){_0x328b3e[_0x099c('0x17')][_0x099c('0x18')](function(_0x539f55){var _0x50c10b=_0x539f55[0x0]===_0x099c('0x19')?_0x539f55[0x0]:'i.'+_0x539f55[0x0];_0x29a02e[_0x099c('0x17')](_0x50c10b,_0x539f55[0x1]===_0x099c('0x1a')?![]:!![]);if(_0x539f55[0x0]===_0x099c('0x1b')){var _0x596dd8=sqlUtils[_0x099c('0x1c')](_0xa0a244,_0x1a694b);_0x29a02e[_0x099c('0x17')](_0x596dd8,_0x539f55[0x1]===_0x099c('0x1a')?![]:!![]);}});}return sqlUtils[_0x099c('0x1d')](_0xa0a244,_0x29a02e,_0x1a694b,_0x328b3e);})[_0x099c('0x6')](function(_0x28d111){_0x12c521[_0x099c('0x1e')]=_0x28d111;return _0x12c521;})[_0x099c('0x1f')](function(_0x182d12){throw _0x182d12;});};exports[_0x099c('0x20')]=function(_0x4e6989,_0x292515){return function(_0x3e6f73,_0x5b9d3e,_0x53b8c2){var _0x4fa732=_0x3e6f73[_0x099c('0xe')];var _0x32cbba={};var _0x73821a=_0x3e6f73[_0x099c('0x21')];if(_0x32cbba){_0x32cbba=_[_0x099c('0x22')](_0x3e6f73[_0x099c('0xa')]);_0x32cbba=_[_0x099c('0x23')](_0x32cbba,[_0x099c('0xa'),_0x099c('0x24'),_0x099c('0x25'),_0x099c('0x26'),_0x099c('0x27')]);}utils[_0x099c('0x28')](_0x4fa732,_0x32cbba,_0x73821a,_0x4e6989,_0x292515);_0x53b8c2(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index bb39112..4d8b449 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82b6=['Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','where','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','role','agent','search','field','name','color','tools_tags','getInteractionFK','user_has_','_interactions','select','u.id','u.fullname','ui.','from','left_join','u.id\x20=\x20ui.UserId','length','\x20IN\x20?','map','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','isNumeric','sms','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','parseSearch','conditions','find','buildExpression','default','text','value','start','end','read','and','Contact','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','Tag','clause','tags','ids','User','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','unreadMessages','Account.key','a.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','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'];(function(_0x4d74f,_0x808875){var _0x866794=function(_0x1afa35){while(--_0x1afa35){_0x4d74f['push'](_0x4d74f['shift']());}};_0x866794(++_0x808875);}(_0x82b6,0x168));var _0x682b=function(_0x3b934f,_0x59dc45){_0x3b934f=_0x3b934f-0x0;var _0x136c82=_0x82b6[_0x3b934f];return _0x136c82;};'use strict';var _=require(_0x682b('0x0'));var squel=require(_0x682b('0x1'));var as=require(_0x682b('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0x682b('0x3'))[_0x682b('0x4')];var utils=require('./utils');var db=require(_0x682b('0x5'))['db'];function skipInteractionsQuery(_0xf5a0a4,_0x13df84,_0x54225d){var _0x1f440d=![];var _0x25ed19=utils[_0x682b('0x6')](_0xf5a0a4);if(_0x13df84[_0x682b('0x7')]===_0x682b('0x8')&&!_0x54225d[_0x682b('0x9')]&&!_0x54225d[_0x25ed19]){_0x1f440d=!![];}return _0x1f440d;}function getTagsQuery(){return squel['select']()[_0x682b('0xa')]('id')[_0x682b('0xa')](_0x682b('0xb'))[_0x682b('0xa')](_0x682b('0xc'))['from'](_0x682b('0xd'));}function getUsersQuery(_0x3c6a6d,_0x511b1a){var _0x7c00ec=utils[_0x682b('0xe')](_0x3c6a6d);var _0x25f8b1=_0x682b('0xf')+_0x3c6a6d+_0x682b('0x10');var _0x25f817=squel[_0x682b('0x11')]()[_0x682b('0xa')](_0x682b('0x12'))[_0x682b('0xa')](_0x682b('0x13'))[_0x682b('0xa')](_0x682b('0x14')+_0x7c00ec)[_0x682b('0x15')](_0x25f8b1,'ui')[_0x682b('0x16')]('users','u',_0x682b('0x17'));if(_0x511b1a[_0x682b('0x18')]>0x0){_0x25f817['where'](_0x682b('0x14')+_0x7c00ec+_0x682b('0x19'),_[_0x682b('0x1a')](_0x511b1a,'id'));}return _0x25f817;}function getInteractionsQuery(_0x55c7f7){var _0x3db90c=utils['getInteractionsTables'](_0x55c7f7);var _0x2defe9=utils['getAccountFK'](_0x55c7f7);var _0x179a88=utils[_0x682b('0xe')](_0x55c7f7);return squel['select']()[_0x682b('0x15')](_0x3db90c['interactions'],'i')[_0x682b('0x16')](_0x682b('0x1b'),'c',_0x682b('0x1c'))[_0x682b('0x16')]('users','o',_0x682b('0x1d'))[_0x682b('0x16')](_0x3db90c[_0x682b('0x1e')],'a',_0x682b('0x1f')+_0x2defe9)[_0x682b('0x16')](_0x3db90c[_0x682b('0x20')],'me',_0x682b('0x21')+_0x179a88+'\x20=\x20i.id')[_0x682b('0x16')](_0x3db90c[_0x682b('0x22')],'it',_0x682b('0x23')+_0x179a88+'\x20=\x20i.id')[_0x682b('0x16')](_0x682b('0xd'),'t',_0x682b('0x24'));}function getSqlClauses(){var _0x41ffd6={'body':squel[_0x682b('0x25')](),'contact':squel[_0x682b('0x25')](),'default':squel[_0x682b('0x25')](),'fields':squel[_0x682b('0x25')](),'filter':squel['expr'](),'read':squel[_0x682b('0x25')](),'tags':{'clause':squel[_0x682b('0x25')](),'ids':null},'user':squel[_0x682b('0x25')]()};return _0x41ffd6;}function parseTagParameter(_0x5268d9){var _0x193ba6=squel[_0x682b('0x25')]();if(_0x5268d9){var _0x567c55=utils[_0x682b('0x26')](_0x5268d9);_0x567c55[_0x682b('0x27')](function(_0x3e42b8){_0x193ba6['or'](_0x682b('0x28'),'%,'+_0x3e42b8+',%');});}return _0x193ba6;}function parseReadParameter(_0x49e1c3){var _0x15e03f='';if(_0x49e1c3){_0x15e03f='unreadMessages\x20{OPERATOR}\x200';if(_0x49e1c3==='1'){_0x15e03f=_0x15e03f['replace']('{OPERATOR}','=');}else{_0x15e03f=_0x15e03f['replace'](_0x682b('0x29'),'>');}}return _0x15e03f;}function parseSearchFilter(_0x2c37a5,_0x22f0b7){var _0x268308=squel[_0x682b('0x25')]();if(_0x22f0b7){var _0x3feac2=_0x22f0b7['replace']('\x5c','\x5c\x5c')[_0x682b('0x2a')](/'/g,'\x27\x27');if(qs[_0x682b('0x2b')](_0x3feac2)){_0x268308['or']('i.id\x20LIKE\x20?',_0x3feac2+'%');if([_0x682b('0x2c'),'whatsapp'][_0x682b('0x2d')](_0x2c37a5)){_0x268308['or'](_0x682b('0x2e'),_0x3feac2+'%');}else if(_0x2c37a5===_0x682b('0x2f')){_0x268308['or'](_0x682b('0x30'),_0x3feac2+'%');}else if(_0x2c37a5===_0x682b('0x31')){_0x268308['or'](_0x682b('0x32'),_0x3feac2+'%');}}else if(_0x2c37a5===_0x682b('0x33')&&qs[_0x682b('0x34')](_0x3feac2)){_0x268308['or'](_0x682b('0x35'),_0x3feac2+'%');}else{if(_0x2c37a5===_0x682b('0x33')){_0x268308['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3feac2,!![]))['or'](_0x682b('0x36'),qs['getFullTextValue'](_0x3feac2));}else if(_0x2c37a5!=='fax'){_0x268308['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3feac2));}_0x268308['or'](_0x682b('0x37'),qs[_0x682b('0x38')](_0x3feac2,!![]),null);}}return _0x268308;}function parseAdvancedSearchFilter(_0x3417f7,_0x460d71){var _0x4ec6c4=getSqlClauses();var _0x1d74fa=as[_0x682b('0x39')](_0x3417f7);var _0x2e559f=_0x1d74fa['sqlOperator'];for(var _0x12f081=0x0;_0x12f081<_0x1d74fa['conditions']['length'];_0x12f081++){var _0x18148d=_0x1d74fa[_0x682b('0x3a')][_0x12f081];var _0x2f7aae='i';var _0x36b42e=_[_0x682b('0x3b')](_0x460d71,[_0x682b('0xb'),_0x18148d['field']]);if(_0x36b42e){var _0x30e55d=as[_0x682b('0x3c')](_0x2f7aae,_0x36b42e['type'],_0x18148d);_0x4ec6c4[_0x682b('0x3d')][_0x2e559f](_0x30e55d[_0x682b('0x3e')],_0x30e55d[_0x682b('0x3f')][_0x682b('0x40')],_0x30e55d['value'][_0x682b('0x41')]);}else{switch(_0x18148d[_0x682b('0xa')]){case'unreadMessages':var _0x1cfdd5=parseReadParameter(_0x18148d[_0x682b('0x3f')]);_0x4ec6c4[_0x682b('0x42')][_0x682b('0x43')](_0x1cfdd5);break;case _0x682b('0x44'):if(_0x18148d['operator']===_0x682b('0x45')){if(_0x18148d[_0x682b('0x3f')][_0x682b('0x46')]('\x20')[_0x682b('0x18')]>0x1){_0x4ec6c4[_0x682b('0x47')][_0x2e559f](_0x682b('0x37'),qs[_0x682b('0x38')](_0x18148d[_0x682b('0x3f')],!![]),null);}else{var _0x1a28f8='%'+_0x18148d[_0x682b('0x3f')]+'%';_0x4ec6c4[_0x682b('0x47')][_0x2e559f](_0x682b('0x48'),_0x1a28f8,_0x1a28f8,_0x1a28f8);}}else{_0x36b42e=_[_0x682b('0x3b')](_0x460d71,['name',_0x682b('0x49')]);_0x18148d['field']=_0x682b('0x49');_0x30e55d=as['buildExpression'](_0x2f7aae,_0x36b42e[_0x682b('0x4a')],_0x18148d);_0x4ec6c4['contact'][_0x2e559f](_0x30e55d[_0x682b('0x3e')],_0x30e55d[_0x682b('0x3f')]['start'],_0x30e55d['value'][_0x682b('0x41')]);}break;case _0x682b('0x4b'):var _0x4e03db=_0x18148d['value']['split'](',')[_0x682b('0x1a')](function(_0x4e78b2){return Number(_0x4e78b2);});var _0x13ad1e=parseTagParameter(_0x4e03db);_0x4ec6c4['tags'][_0x682b('0x4c')][_0x682b('0x43')](_0x13ad1e);_0x4ec6c4[_0x682b('0x4d')][_0x682b('0x4e')]=_0x4e03db;break;case _0x682b('0x4f'):if(_0x18148d[_0x682b('0x50')]===_0x682b('0x45')){_0x4ec6c4[_0x682b('0x51')][_0x2e559f](_0x682b('0x52'),'%'+_0x18148d[_0x682b('0x3f')]+'%',null);}else{_0x36b42e=_[_0x682b('0x3b')](_0x460d71,[_0x682b('0xb'),_0x682b('0x53')]);_0x18148d[_0x682b('0xa')]=_0x682b('0x53');_0x30e55d=as['buildExpression'](_0x2f7aae,_0x36b42e['type'],_0x18148d);_0x4ec6c4[_0x682b('0x51')][_0x2e559f](_0x30e55d[_0x682b('0x3e')],_0x30e55d[_0x682b('0x3f')][_0x682b('0x40')],_0x30e55d[_0x682b('0x3f')][_0x682b('0x41')]);}break;case _0x682b('0x54'):case _0x682b('0x55'):_0x30e55d=as[_0x682b('0x3c')]('me',null,_0x18148d);_0x4ec6c4[_0x682b('0x54')][_0x2e559f](_0x30e55d['text'],_0x30e55d['value'][_0x682b('0x40')],_0x30e55d[_0x682b('0x3f')]['end']);break;}}}return _0x4ec6c4;}function parseModelFields(_0x3df300,_0x3d5ec1,_0x23a997){var _0x3af59c=utils[_0x682b('0x6')](_0x3df300);var _0x396927=squel['expr']();var _0x1d3851=_(_0x3d5ec1)[_0x682b('0x56')]()[_0x682b('0x1a')](function(_0x135a78){return _[_0x682b('0x57')](_0x23a997,['name',_0x135a78])?_0x135a78:undefined;})[_0x682b('0x58')]()[_0x682b('0x3f')]();if(_0x1d3851[_0x682b('0x18')]>0x0){_0x1d3851[_0x682b('0x27')](function(_0x4138d6){if(_0x4138d6===_0x3af59c){_0x396927[_0x682b('0x43')]('i.'+_0x3af59c+_0x682b('0x19'),[]['concat'](_0x3d5ec1[_0x4138d6]));}else if(_0x4138d6===_0x682b('0x59')){var _0x5dd1e5=JSON[_0x682b('0x5a')](_0x3d5ec1[_0x4138d6])['$gte'];var _0x2d87df=JSON[_0x682b('0x5a')](_0x3d5ec1[_0x4138d6])[_0x682b('0x5b')];_0x396927[_0x682b('0x43')](_0x682b('0x5c'),_0x5dd1e5,_0x2d87df);}else{if(_0x3d5ec1[_0x4138d6]===_0x682b('0x5d')){_0x396927[_0x682b('0x43')]('i.'+_0x4138d6+_0x682b('0x5e'));}else{_0x396927[_0x682b('0x43')]('i.'+_0x4138d6+_0x682b('0x5f'),_0x3d5ec1[_0x4138d6]);}}});}return _0x396927;}function parseQueryParameters(_0x3a40f1,_0x4051c0,_0xac0412){var _0x42b02c=getSqlClauses();return Promise[_0x682b('0x60')]()[_0x682b('0x61')](function(){return parseModelFields(_0x3a40f1,_0x4051c0,_0xac0412);})[_0x682b('0x61')](function(_0x4bc287){_0x42b02c[_0x682b('0x62')][_0x682b('0x43')](_0x4bc287);return parseReadParameter(_0x4051c0[_0x682b('0x42')]);})[_0x682b('0x61')](function(_0x1e1daa){_0x42b02c['read'][_0x682b('0x43')](_0x1e1daa);return parseTagParameter(_0x4051c0[_0x682b('0x63')]);})[_0x682b('0x61')](function(_0x39e907){_0x42b02c[_0x682b('0x4d')][_0x682b('0x4c')][_0x682b('0x43')](_0x39e907);return parseSearchFilter(_0x3a40f1,_0x4051c0[_0x682b('0x64')]);})[_0x682b('0x61')](function(_0xc6f7b){_0x42b02c[_0x682b('0x64')]=_0xc6f7b;return _0x42b02c;});}function checkAccountsRestrictions(_0x2f5fc0,_0x3cac0b,_0x4996dd){var _0x15014b=utils[_0x682b('0x6')](_0x2f5fc0);var _0x1beb2c='get'+_['capitalize'](_0x2f5fc0)+(_0x2f5fc0==='chat'?_0x682b('0x65'):_0x682b('0x66'));var _0x36ebce=squel['expr']();return Promise[_0x682b('0x60')]()[_0x682b('0x61')](function(){if(_0x4996dd[_0x682b('0x9')]&&_0x3cac0b[_0x682b('0x7')]===_0x682b('0x8')){return _0x3cac0b[_0x1beb2c]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2f54bb){if(_0x2f54bb){if(_0x2f54bb[_0x682b('0x18')]===0x0){_0x36ebce[_0x682b('0x43')]('i.'+_0x15014b+_0x682b('0x5e'));}else{_0x36ebce[_0x682b('0x43')]('i.'+_0x15014b+'\x20IN\x20?',_[_0x682b('0x1a')](_0x2f54bb,'id'));}}else if(!_0x4996dd[_0x15014b]){_0x36ebce[_0x682b('0x43')]('i.'+_0x15014b+_0x682b('0x67'));}})[_0x682b('0x61')](function(){return _0x36ebce;});}function getClosedOrderClause(_0xd08d64,_0x1d0c9e){var _0x4f7389='';var _0x577829=[_0x682b('0x68'),_0x682b('0x69'),_0x682b('0x6a')];if(_0xd08d64==='mail'){_0x577829[_0x682b('0x6b')](_0x682b('0x6c'));}if(_0x1d0c9e[_0x682b('0x6d')]==='0'&&_0xd08d64==='mail'){_0x4f7389='i.substatus';}else{if(_0x1d0c9e[_0x682b('0x6d')]==='1'){_0x577829[_0x682b('0x6e')]();}_0x4f7389=_0x682b('0x6f')+_0x577829['join'](',\x20')+')';}return _0x4f7389;}function getFilteredInteractions(_0x5812b9,_0x28b67d,_0xa92c62,_0x23566d){var _0x4e26f4=utils[_0x682b('0xe')](_0x5812b9);var _0x4a7503=_[_0x682b('0x70')](_0x5812b9)+_0x682b('0x71');var _0x56d844=[];var _0x3656ce=getTagsQuery();var _0x1b9137={'type':db[_0x682b('0x72')][_0x682b('0x73')][_0x682b('0x74')],'raw':!![]};var _0x418e29=[];var _0x4f87e9=[];return db[_0x682b('0x75')][_0x682b('0x76')](_0x3656ce[_0x682b('0x77')](),_0x1b9137)[_0x682b('0x61')](function(_0x4230c4){_0x56d844=_[_0x682b('0x78')](_0x4230c4,'id');_0x1b9137=_[_0x682b('0x79')](_0x1b9137,{'model':db[_0x4a7503],'mapToModel':!![],'nest':!![]});if(_0xa92c62[_0x682b('0x62')]){_0x23566d[_0x682b('0x7a')][_0x682b('0x27')](function(_0x568671){_0x28b67d['field']('i.'+_0x568671);});}else{_0x28b67d[_0x682b('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x682b('0x7b'));_0x28b67d['field']('a.key',_0x682b('0x7c'));_0x28b67d[_0x682b('0xa')](_0x682b('0x7d'),'Account.mandatoryDisposition');if(_0x5812b9===_0x682b('0x33')){_0x28b67d[_0x682b('0xa')](_0x682b('0x7e'),_0x682b('0x7f'));_0x28b67d[_0x682b('0xa')](_0x682b('0x80'),_0x682b('0x81'));_0x28b67d[_0x682b('0xa')](_0x682b('0x82'));_0x28b67d[_0x682b('0xa')]('i.createdAt');_0x28b67d[_0x682b('0xa')](_0x682b('0x83'));_0x28b67d[_0x682b('0xa')](_0x682b('0x84'));_0x28b67d[_0x682b('0xa')](_0x682b('0x85'));_0x28b67d[_0x682b('0xa')](_0x682b('0x86'));_0x28b67d[_0x682b('0xa')](_0x682b('0x87'));_0x28b67d[_0x682b('0xa')](_0x682b('0x88'));_0x28b67d[_0x682b('0xa')]('i.subject');_0x28b67d[_0x682b('0xa')](_0x682b('0x6a'));_0x28b67d[_0x682b('0xa')](_0x682b('0x69'));_0x28b67d[_0x682b('0xa')](_0x682b('0x68'));_0x28b67d[_0x682b('0xa')](_0x682b('0x6c'));_0x28b67d[_0x682b('0xa')](_0x682b('0x89'));_0x28b67d[_0x682b('0xa')](_0x682b('0x8a'));_0x28b67d[_0x682b('0xa')](_0x682b('0x8b'));_0x28b67d['field'](_0x682b('0x8c'));}else if(_0x5812b9===_0x682b('0x31')){_0x28b67d[_0x682b('0xa')](_0x682b('0x8d'),_0x682b('0x81'));}else{_0x28b67d[_0x682b('0xa')](_0x682b('0x8e'),_0x682b('0x81'));}if(_0x5812b9!=='mail'){_0x28b67d['field']('i.*');}_0x28b67d[_0x682b('0xa')](_0x682b('0x8f'),_0x682b('0x90'));_0x28b67d[_0x682b('0xa')](_0x682b('0x91'),_0x682b('0x92'));_0x28b67d[_0x682b('0xa')]('c.email',_0x682b('0x93'));_0x28b67d[_0x682b('0xa')]('c.phone','Contact.phone');_0x28b67d[_0x682b('0xa')](_0x682b('0x94'),_0x682b('0x95'));_0x28b67d[_0x682b('0xa')]('c.fax',_0x682b('0x96'));_0x28b67d[_0x682b('0xa')](_0x682b('0x97'),_0x682b('0x98'));_0x28b67d[_0x682b('0xa')](_0x682b('0x99'),'Owner.internal');_0x28b67d[_0x682b('0xa')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x682b('0x9a'));}if(_0x23566d[_0x682b('0x9b')]){_0x28b67d['limit'](_0x23566d[_0x682b('0x9b')]);}if(_0x23566d[_0x682b('0x9c')]){_0x28b67d[_0x682b('0x9c')](_0x23566d[_0x682b('0x9c')]);}return db[_0x682b('0x75')][_0x682b('0x76')](_0x28b67d[_0x682b('0x77')](),_0x1b9137);})[_0x682b('0x61')](function(_0xae5705){_0x418e29=_0xae5705;var _0x46faaf=getUsersQuery(_0x5812b9,_0x418e29);return db[_0x682b('0x75')]['query'](_0x46faaf[_0x682b('0x77')](),_0x1b9137);})[_0x682b('0x61')](function(_0x2b8b0d){_0x4f87e9=_[_0x682b('0x9d')](_0x2b8b0d,_0x4e26f4);if(_0x5812b9===_0x682b('0x33')){return db[_0x682b('0x9e')][_0x682b('0x9f')]({'attributes':[_0x682b('0xa0')],'raw':!![]});}})[_0x682b('0x61')](function(_0x2ab038){var _0x3d610b=_0x2ab038?_0x2ab038[_0x682b('0xa0')]:undefined;var _0x5d8655=_0x418e29[_0x682b('0x1a')](function(_0x2ae563){return updateInteraction(_0x2ae563,_0x56d844,_0x4f87e9,_0x3d610b);});return Promise[_0x682b('0xa1')](_0x5d8655);});}function countFilteredInteractions(_0x234214,_0x373ca2){var _0x368519=_0x234214[_0x682b('0xa2')]();_0x368519[_0x682b('0xa')](_0x682b('0xa3'));_0x368519[_0x682b('0xa')](_0x682b('0xa4'),_0x682b('0x7b'));var _0x4d1f0f=utils[_0x682b('0x26')](_0x373ca2);if(!_[_0x682b('0xa5')](_0x4d1f0f)){_0x368519[_0x682b('0xa6')]('t.id\x20IN\x20?',_0x4d1f0f);}var _0xc1c7a1={'type':db[_0x682b('0x72')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x682b('0x75')][_0x682b('0x76')](_0x368519['toString'](),_0xc1c7a1);}module[_0x682b('0xa7')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x82a3=['buildExpression','default','text','value','start','unreadMessages','and','Contact','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','type','end','Tag','clause','tags','ids','User','UserId','body','plainBody','some','compact','concat','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','read','tag','filter','get','chat','Websites','Accounts','i.thirdDisposition','i.secondDisposition','mail','i.substatus','closed','shift','join','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','toString','keyBy','attributes','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','i.id','i.createdAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.to','i.ContactId','i.MailAccountId','i.UserId','contactName','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','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)','TagIds','limit','offset','query','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','where','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','user_has_','_interactions','u.id','left_join','users','u.id\x20=\x20ui.UserId','ui.','\x20IN\x20?','map','getInteractionsTables','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.','me.','\x20=\x20i.id','it.','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','sms','whatsapp','includes','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','length'];(function(_0x109971,_0x2c49ad){var _0x162b0a=function(_0xe158f){while(--_0xe158f){_0x109971['push'](_0x109971['shift']());}};_0x162b0a(++_0x2c49ad);}(_0x82a3,0x1ab));var _0x382a=function(_0x543bf6,_0x763bd7){_0x543bf6=_0x543bf6-0x0;var _0x4187b3=_0x82a3[_0x543bf6];return _0x4187b3;};'use strict';var _=require(_0x382a('0x0'));var squel=require(_0x382a('0x1'));var as=require(_0x382a('0x2'));var qs=require(_0x382a('0x3'));var updateInteraction=require(_0x382a('0x4'))[_0x382a('0x5')];var utils=require(_0x382a('0x6'));var db=require(_0x382a('0x7'))['db'];function skipInteractionsQuery(_0x59fbb6,_0x6034a8,_0x1b12e6){var _0x578fd3=![];var _0x4d101c=utils[_0x382a('0x8')](_0x59fbb6);if(_0x6034a8[_0x382a('0x9')]===_0x382a('0xa')&&!_0x1b12e6[_0x382a('0xb')]&&!_0x1b12e6[_0x4d101c]){_0x578fd3=!![];}return _0x578fd3;}function getTagsQuery(){return squel[_0x382a('0xc')]()[_0x382a('0xd')]('id')[_0x382a('0xd')](_0x382a('0xe'))['field'](_0x382a('0xf'))[_0x382a('0x10')](_0x382a('0x11'));}function getUsersQuery(_0x4c0f09,_0x43a6ad){var _0x2cf29f=utils['getInteractionFK'](_0x4c0f09);var _0x2ea60=_0x382a('0x12')+_0x4c0f09+_0x382a('0x13');var _0x2b182c=squel[_0x382a('0xc')]()[_0x382a('0xd')](_0x382a('0x14'))[_0x382a('0xd')]('u.fullname')[_0x382a('0xd')]('ui.'+_0x2cf29f)[_0x382a('0x10')](_0x2ea60,'ui')[_0x382a('0x15')](_0x382a('0x16'),'u',_0x382a('0x17'));if(_0x43a6ad['length']>0x0){_0x2b182c['where'](_0x382a('0x18')+_0x2cf29f+_0x382a('0x19'),_[_0x382a('0x1a')](_0x43a6ad,'id'));}return _0x2b182c;}function getInteractionsQuery(_0x5f4373){var _0x18f1ac=utils[_0x382a('0x1b')](_0x5f4373);var _0x1b1975=utils['getAccountFK'](_0x5f4373);var _0x41fd8d=utils['getInteractionFK'](_0x5f4373);return squel[_0x382a('0xc')]()[_0x382a('0x10')](_0x18f1ac['interactions'],'i')[_0x382a('0x15')](_0x382a('0x1c'),'c',_0x382a('0x1d'))[_0x382a('0x15')](_0x382a('0x16'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x18f1ac['accounts'],'a',_0x382a('0x1e')+_0x1b1975)['left_join'](_0x18f1ac['messages'],'me',_0x382a('0x1f')+_0x41fd8d+_0x382a('0x20'))[_0x382a('0x15')](_0x18f1ac['interactionsTags'],'it',_0x382a('0x21')+_0x41fd8d+'\x20=\x20i.id')[_0x382a('0x15')](_0x382a('0x11'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x2c2d2d={'body':squel['expr'](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0x382a('0x22')](),'filter':squel[_0x382a('0x22')](),'read':squel[_0x382a('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel['expr']()};return _0x2c2d2d;}function parseTagParameter(_0x55a7e9){var _0x4361b8=squel[_0x382a('0x22')]();if(_0x55a7e9){var _0x2dd81c=utils[_0x382a('0x23')](_0x55a7e9);_0x2dd81c[_0x382a('0x24')](function(_0x5f1751){_0x4361b8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5f1751+',%');});}return _0x4361b8;}function parseReadParameter(_0x2e34a1){var _0x531074='';if(_0x2e34a1){_0x531074=_0x382a('0x25');if(_0x2e34a1==='1'){_0x531074=_0x531074['replace'](_0x382a('0x26'),'=');}else{_0x531074=_0x531074[_0x382a('0x27')](_0x382a('0x26'),'>');}}return _0x531074;}function parseSearchFilter(_0x533cf8,_0x489adf){var _0x1670ad=squel[_0x382a('0x22')]();if(_0x489adf){var _0x92d96d=_0x489adf[_0x382a('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x382a('0x28')](_0x92d96d)){_0x1670ad['or']('i.id\x20LIKE\x20?',_0x92d96d+'%');if([_0x382a('0x29'),_0x382a('0x2a')][_0x382a('0x2b')](_0x533cf8)){_0x1670ad['or']('i.phone\x20LIKE\x20?',_0x92d96d+'%');}else if(_0x533cf8===_0x382a('0x2c')){_0x1670ad['or'](_0x382a('0x2d'),_0x92d96d+'%');}else if(_0x533cf8==='openchannel'){_0x1670ad['or'](_0x382a('0x2e'),_0x92d96d+'%');}}else if(_0x533cf8==='mail'&&qs['isEmail'](_0x92d96d)){_0x1670ad['or']('c.email\x20LIKE\x20?',_0x92d96d+'%');}else{if(_0x533cf8==='mail'){_0x1670ad['or'](_0x382a('0x2f'),qs['getFullTextValue'](_0x92d96d,!![]))['or'](_0x382a('0x30'),qs['getFullTextValue'](_0x92d96d));}else if(_0x533cf8!==_0x382a('0x2c')){_0x1670ad['or'](_0x382a('0x31'),qs[_0x382a('0x32')](_0x92d96d));}_0x1670ad['or'](_0x382a('0x33'),qs[_0x382a('0x32')](_0x92d96d,!![]),null);}}return _0x1670ad;}function parseAdvancedSearchFilter(_0x3484d4,_0x10d075){var _0x2946f6=getSqlClauses();var _0x101429=as[_0x382a('0x34')](_0x3484d4);var _0x351457=_0x101429[_0x382a('0x35')];for(var _0x303d87=0x0;_0x303d87<_0x101429[_0x382a('0x36')][_0x382a('0x37')];_0x303d87++){var _0x24f26d=_0x101429['conditions'][_0x303d87];var _0x7c378e='i';var _0xb35fdb=_['find'](_0x10d075,[_0x382a('0xe'),_0x24f26d['field']]);if(_0xb35fdb){var _0x474825=as[_0x382a('0x38')](_0x7c378e,_0xb35fdb['type'],_0x24f26d);_0x2946f6[_0x382a('0x39')][_0x351457](_0x474825[_0x382a('0x3a')],_0x474825[_0x382a('0x3b')][_0x382a('0x3c')],_0x474825[_0x382a('0x3b')]['end']);}else{switch(_0x24f26d[_0x382a('0xd')]){case _0x382a('0x3d'):var _0x22677d=parseReadParameter(_0x24f26d[_0x382a('0x3b')]);_0x2946f6['read'][_0x382a('0x3e')](_0x22677d);break;case _0x382a('0x3f'):if(_0x24f26d[_0x382a('0x40')]===_0x382a('0x41')){if(_0x24f26d[_0x382a('0x3b')]['split']('\x20')['length']>0x1){_0x2946f6[_0x382a('0x42')][_0x351457](_0x382a('0x33'),qs[_0x382a('0x32')](_0x24f26d[_0x382a('0x3b')],!![]),null);}else{var _0x37dff2='%'+_0x24f26d[_0x382a('0x3b')]+'%';_0x2946f6[_0x382a('0x42')][_0x351457](_0x382a('0x43'),_0x37dff2,_0x37dff2,_0x37dff2);}}else{_0xb35fdb=_[_0x382a('0x44')](_0x10d075,['name',_0x382a('0x45')]);_0x24f26d[_0x382a('0xd')]=_0x382a('0x45');_0x474825=as[_0x382a('0x38')](_0x7c378e,_0xb35fdb[_0x382a('0x46')],_0x24f26d);_0x2946f6['contact'][_0x351457](_0x474825[_0x382a('0x3a')],_0x474825[_0x382a('0x3b')][_0x382a('0x3c')],_0x474825[_0x382a('0x3b')][_0x382a('0x47')]);}break;case _0x382a('0x48'):var _0x5a7284=_0x24f26d[_0x382a('0x3b')]['split'](',')[_0x382a('0x1a')](function(_0x309a62){return Number(_0x309a62);});var _0x56e4a3=parseTagParameter(_0x5a7284);_0x2946f6['tags'][_0x382a('0x49')][_0x382a('0x3e')](_0x56e4a3);_0x2946f6[_0x382a('0x4a')][_0x382a('0x4b')]=_0x5a7284;break;case _0x382a('0x4c'):if(_0x24f26d[_0x382a('0x40')]==='$substring'){_0x2946f6['user'][_0x351457]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x24f26d[_0x382a('0x3b')]+'%',null);}else{_0xb35fdb=_[_0x382a('0x44')](_0x10d075,[_0x382a('0xe'),_0x382a('0x4d')]);_0x24f26d[_0x382a('0xd')]=_0x382a('0x4d');_0x474825=as[_0x382a('0x38')](_0x7c378e,_0xb35fdb[_0x382a('0x46')],_0x24f26d);_0x2946f6['user'][_0x351457](_0x474825['text'],_0x474825['value']['start'],_0x474825[_0x382a('0x3b')]['end']);}break;case _0x382a('0x4e'):case _0x382a('0x4f'):_0x474825=as[_0x382a('0x38')]('me',null,_0x24f26d);_0x2946f6['body'][_0x351457](_0x474825['text'],_0x474825[_0x382a('0x3b')][_0x382a('0x3c')],_0x474825[_0x382a('0x3b')]['end']);break;}}}return _0x2946f6;}function parseModelFields(_0x1898f2,_0xc60dce,_0x401f61){var _0x3efecb=utils[_0x382a('0x8')](_0x1898f2);var _0x3ccb83=squel[_0x382a('0x22')]();var _0x3ea4c8=_(_0xc60dce)['keys']()[_0x382a('0x1a')](function(_0x411a47){return _[_0x382a('0x50')](_0x401f61,[_0x382a('0xe'),_0x411a47])?_0x411a47:undefined;})[_0x382a('0x51')]()['value']();if(_0x3ea4c8[_0x382a('0x37')]>0x0){_0x3ea4c8[_0x382a('0x24')](function(_0x31372c){if(_0x31372c===_0x3efecb){_0x3ccb83[_0x382a('0x3e')]('i.'+_0x3efecb+_0x382a('0x19'),[][_0x382a('0x52')](_0xc60dce[_0x31372c]));}else if(_0x31372c==='createdAt'){var _0x4804dd=JSON['parse'](_0xc60dce[_0x31372c])[_0x382a('0x53')];var _0x4503e9=JSON[_0x382a('0x54')](_0xc60dce[_0x31372c])['$lte'];_0x3ccb83['and'](_0x382a('0x55'),_0x4804dd,_0x4503e9);}else{if(_0xc60dce[_0x31372c]===_0x382a('0x56')){_0x3ccb83[_0x382a('0x3e')]('i.'+_0x31372c+_0x382a('0x57'));}else{_0x3ccb83[_0x382a('0x3e')]('i.'+_0x31372c+'\x20=\x20?',_0xc60dce[_0x31372c]);}}});}return _0x3ccb83;}function parseQueryParameters(_0x48ba68,_0x4b9ea2,_0x32fe6c){var _0x5146e8=getSqlClauses();return Promise[_0x382a('0x58')]()[_0x382a('0x59')](function(){return parseModelFields(_0x48ba68,_0x4b9ea2,_0x32fe6c);})[_0x382a('0x59')](function(_0x282e7d){_0x5146e8[_0x382a('0x5a')][_0x382a('0x3e')](_0x282e7d);return parseReadParameter(_0x4b9ea2[_0x382a('0x5b')]);})[_0x382a('0x59')](function(_0x524c4f){_0x5146e8[_0x382a('0x5b')][_0x382a('0x3e')](_0x524c4f);return parseTagParameter(_0x4b9ea2[_0x382a('0x5c')]);})[_0x382a('0x59')](function(_0x1fc736){_0x5146e8[_0x382a('0x4a')][_0x382a('0x49')][_0x382a('0x3e')](_0x1fc736);return parseSearchFilter(_0x48ba68,_0x4b9ea2[_0x382a('0x5d')]);})[_0x382a('0x59')](function(_0x10eab5){_0x5146e8[_0x382a('0x5d')]=_0x10eab5;return _0x5146e8;});}function checkAccountsRestrictions(_0x520107,_0x15428,_0x5812fc){var _0x5ee8e9=utils['getAccountFK'](_0x520107);var _0x405d94=_0x382a('0x5e')+_['capitalize'](_0x520107)+(_0x520107===_0x382a('0x5f')?_0x382a('0x60'):_0x382a('0x61'));var _0x470010=squel[_0x382a('0x22')]();return Promise[_0x382a('0x58')]()[_0x382a('0x59')](function(){if(_0x5812fc['search']&&_0x15428['role']===_0x382a('0xa')){return _0x15428[_0x405d94]({'attributes':['id'],'raw':!![]});}})[_0x382a('0x59')](function(_0x23af4c){if(_0x23af4c){if(_0x23af4c[_0x382a('0x37')]===0x0){_0x470010[_0x382a('0x3e')]('i.'+_0x5ee8e9+'\x20IS\x20NULL');}else{_0x470010[_0x382a('0x3e')]('i.'+_0x5ee8e9+_0x382a('0x19'),_['map'](_0x23af4c,'id'));}}else if(!_0x5812fc[_0x5ee8e9]){_0x470010[_0x382a('0x3e')]('i.'+_0x5ee8e9+'\x20IS\x20NOT\x20NULL');}})[_0x382a('0x59')](function(){return _0x470010;});}function getClosedOrderClause(_0x3c3599,_0x1d9b93){var _0x572844='';var _0x1683ef=[_0x382a('0x62'),_0x382a('0x63'),'i.disposition'];if(_0x3c3599==='mail'){_0x1683ef['unshift']('i.substatus');}if(_0x1d9b93['closed']==='0'&&_0x3c3599===_0x382a('0x64')){_0x572844=_0x382a('0x65');}else{if(_0x1d9b93[_0x382a('0x66')]==='1'){_0x1683ef[_0x382a('0x67')]();}_0x572844='CONCAT_WS(\x27\x27,\x20'+_0x1683ef[_0x382a('0x68')](',\x20')+')';}return _0x572844;}function getFilteredInteractions(_0x3ed530,_0x5e819a,_0xac950b,_0x1b5fc7){var _0x49d282=utils['getInteractionFK'](_0x3ed530);var _0x2c6db9=_[_0x382a('0x69')](_0x3ed530)+_0x382a('0x6a');var _0x408703=[];var _0x31a4d0=getTagsQuery();var _0x18332c={'type':db[_0x382a('0x6b')][_0x382a('0x6c')][_0x382a('0x6d')],'raw':!![]};var _0x9e2d2=[];var _0xf3adb4=[];return db[_0x382a('0x6e')]['query'](_0x31a4d0[_0x382a('0x6f')](),_0x18332c)[_0x382a('0x59')](function(_0x29df9a){_0x408703=_[_0x382a('0x70')](_0x29df9a,'id');_0x18332c=_['merge'](_0x18332c,{'model':db[_0x2c6db9],'mapToModel':!![],'nest':!![]});if(_0xac950b[_0x382a('0x5a')]){_0x1b5fc7[_0x382a('0x71')]['forEach'](function(_0x1a549e){_0x5e819a['field']('i.'+_0x1a549e);});}else{_0x5e819a[_0x382a('0xd')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x382a('0x3d'));_0x5e819a['field'](_0x382a('0x72'),'Account.key');_0x5e819a['field'](_0x382a('0x73'),_0x382a('0x74'));if(_0x3ed530===_0x382a('0x64')){_0x5e819a[_0x382a('0xd')]('a.email',_0x382a('0x75'));_0x5e819a['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5e819a[_0x382a('0xd')](_0x382a('0x76'));_0x5e819a[_0x382a('0xd')](_0x382a('0x77'));_0x5e819a[_0x382a('0xd')]('i.updatedAt');_0x5e819a[_0x382a('0xd')]('i.closed');_0x5e819a[_0x382a('0xd')](_0x382a('0x78'));_0x5e819a['field'](_0x382a('0x79'));_0x5e819a[_0x382a('0xd')](_0x382a('0x7a'));_0x5e819a[_0x382a('0xd')](_0x382a('0x7b'));_0x5e819a[_0x382a('0xd')](_0x382a('0x7c'));_0x5e819a[_0x382a('0xd')](_0x382a('0x7d'));_0x5e819a[_0x382a('0xd')]('i.secondDisposition');_0x5e819a[_0x382a('0xd')]('i.thirdDisposition');_0x5e819a[_0x382a('0xd')](_0x382a('0x65'));_0x5e819a['field'](_0x382a('0x7e'));_0x5e819a[_0x382a('0xd')](_0x382a('0x7f'));_0x5e819a[_0x382a('0xd')](_0x382a('0x80'));_0x5e819a[_0x382a('0xd')](_0x382a('0x81'));}else if(_0x3ed530==='openchannel'){_0x5e819a[_0x382a('0xd')]('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',_0x382a('0x82'));}else{_0x5e819a[_0x382a('0xd')](_0x382a('0x83'),'contactName');}if(_0x3ed530!==_0x382a('0x64')){_0x5e819a[_0x382a('0xd')](_0x382a('0x84'));}_0x5e819a[_0x382a('0xd')](_0x382a('0x85'),'Contact.firstName');_0x5e819a[_0x382a('0xd')](_0x382a('0x86'),_0x382a('0x87'));_0x5e819a[_0x382a('0xd')](_0x382a('0x88'),_0x382a('0x89'));_0x5e819a[_0x382a('0xd')](_0x382a('0x8a'),_0x382a('0x8b'));_0x5e819a[_0x382a('0xd')](_0x382a('0x8c'),_0x382a('0x8d'));_0x5e819a['field'](_0x382a('0x8e'),'Contact.fax');_0x5e819a[_0x382a('0xd')](_0x382a('0x8f'),'Owner.fullname');_0x5e819a['field'](_0x382a('0x90'),_0x382a('0x91'));_0x5e819a[_0x382a('0xd')](_0x382a('0x92'),_0x382a('0x93'));}if(_0x1b5fc7[_0x382a('0x94')]){_0x5e819a[_0x382a('0x94')](_0x1b5fc7['limit']);}if(_0x1b5fc7[_0x382a('0x95')]){_0x5e819a[_0x382a('0x95')](_0x1b5fc7[_0x382a('0x95')]);}return db['sequelize'][_0x382a('0x96')](_0x5e819a[_0x382a('0x6f')](),_0x18332c);})[_0x382a('0x59')](function(_0x14d0fe){_0x9e2d2=_0x14d0fe;var _0x5297fb=getUsersQuery(_0x3ed530,_0x9e2d2);return db[_0x382a('0x6e')][_0x382a('0x96')](_0x5297fb[_0x382a('0x6f')](),_0x18332c);})['then'](function(_0x59b400){_0xf3adb4=_[_0x382a('0x97')](_0x59b400,_0x49d282);if(_0x3ed530===_0x382a('0x64')){return db[_0x382a('0x98')][_0x382a('0x99')]({'attributes':[_0x382a('0x9a')],'raw':!![]});}})[_0x382a('0x59')](function(_0x5b7076){var _0x34d8c5=_0x5b7076?_0x5b7076[_0x382a('0x9a')]:undefined;var _0x57dafd=_0x9e2d2['map'](function(_0x4a7403){return updateInteraction(_0x4a7403,_0x408703,_0xf3adb4,_0x34d8c5);});return Promise[_0x382a('0x9b')](_0x57dafd);});}function countFilteredInteractions(_0x1f182c,_0x1d5d36){var _0x23c74f=_0x1f182c[_0x382a('0x9c')]();_0x23c74f[_0x382a('0xd')](_0x382a('0x9d'));_0x23c74f[_0x382a('0xd')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x382a('0x3d'));var _0x37e61a=utils[_0x382a('0x23')](_0x1d5d36);if(!_[_0x382a('0x9e')](_0x37e61a)){_0x23c74f[_0x382a('0x9f')]('t.id\x20IN\x20?',_0x37e61a);}var _0x52e0de={'type':db[_0x382a('0x6b')][_0x382a('0x6c')][_0x382a('0x6d')],'raw':!![]};return db[_0x382a('0x6e')]['query'](_0x23c74f[_0x382a('0x6f')](),_0x52e0de);}module[_0x382a('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 4b12947..6b6e9a0 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b1b=['lodash','map','fullname','split','forEach','waiting','talking','answered','unmanaged','total','closed','disposition','abandoned','UserId','findOne','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','Users','then','TagIds'];(function(_0x47a862,_0x3656ff){var _0x3752a6=function(_0x5e2293){while(--_0x5e2293){_0x47a862['push'](_0x47a862['shift']());}};_0x3752a6(++_0x3656ff);}(_0x6b1b,0xc0));var _0xb6b1=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x6b1b[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0xb6b1('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x4429b4,_0x556720){return new Promise(function(_0x5a04eb,_0x5d6aca){try{var _0x4a8a1=[];if(_0x556720[_0x4429b4]){_0x4a8a1=_0x556720[_0x4429b4][_0xb6b1('0x1')](function(_0x16e432){return{'id':_0x16e432['id'],'fullname':_0x16e432[_0xb6b1('0x2')]};});}return _0x5a04eb(_0x4a8a1);}catch(_0x3fd37b){_0x5d6aca(_0x3fd37b);}});}function getInteractionTags(_0x5e462a,_0xeefa85){var _0x4e0f54=[];if(_0x5e462a){_0x5e462a[_0xb6b1('0x3')](',')[_0xb6b1('0x4')](function(_0xb67787){_0x4e0f54['push'](_0xeefa85[_0xb67787]);});}return _0x4e0f54;}function updateWaitingCounter(_0x2cad66){if(_0x2cad66[_0xb6b1('0x5')]){_0x2cad66['waiting']-=0x1;}}function updateInteractionCounters(_0x235fbf){_0x235fbf[_0xb6b1('0x5')]=0x0;_0x235fbf[_0xb6b1('0x6')]=0x0;_0x235fbf[_0xb6b1('0x7')]=0x0;_0x235fbf[_0xb6b1('0x8')]=0x0;_0x235fbf['abandoned']=0x0;_0x235fbf[_0xb6b1('0x9')]=0x0;if(_0x235fbf[_0xb6b1('0xa')]){if(_0x235fbf[_0xb6b1('0xb')]===_0xb6b1('0xc')){_0x235fbf['abandoned']+=0x1;updateWaitingCounter(_0x235fbf);}if(_0x235fbf[_0xb6b1('0xd')]){_0x235fbf['answered']+=0x1;if(_0x235fbf[_0xb6b1('0x6')]){_0x235fbf[_0xb6b1('0x6')]-=0x1;}}else{if(_0x235fbf[_0xb6b1('0xb')]){_0x235fbf['unmanaged']+=0x1;updateWaitingCounter(_0x235fbf);}}}else{if(!_0x235fbf[_0xb6b1('0xd')]){_0x235fbf[_0xb6b1('0x5')]+=0x1;}if(_0x235fbf[_0xb6b1('0xd')]){_0x235fbf[_0xb6b1('0x6')]+=0x1;updateWaitingCounter(_0x235fbf);}}_0x235fbf[_0xb6b1('0x9')]+=0x1;return _0x235fbf;}function getLastMessageText(_0x34d70d){return db['MailMessage'][_0xb6b1('0xe')]({'where':{'$and':[{'MailInteractionId':_0x34d70d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xb6b1('0xf')],'order':_0xb6b1('0x10'),'raw':!![]})['then'](function(_0x188187){if(_0x188187&&_0x188187[_0xb6b1('0xf')]){_0x34d70d[_0xb6b1('0x11')]=_[_0xb6b1('0x12')](_0x188187['plainBody']);}return _0x34d70d;})[_0xb6b1('0x13')](function(_0x26d6be){throw _0x26d6be;});}exports[_0xb6b1('0x14')]=function(_0x3d88b6,_0x2bc7d6,_0x58bf79,_0xffabd3){return new Promise(function(_0x19050a,_0x452543){return getInteractionUsers(_0x3d88b6['id'],_0x58bf79)['then'](function(_0x1dde07){_0x3d88b6[_0xb6b1('0x15')]=_0x1dde07;return getInteractionTags(_0x3d88b6['TagIds'],_0x2bc7d6);})[_0xb6b1('0x16')](function(_0x150954){_0x3d88b6['Tags']=_0x150954;delete _0x3d88b6[_0xb6b1('0x17')];return updateInteractionCounters(_0x3d88b6);})['then'](function(_0x5c6d33){if(_0xffabd3){return getLastMessageText(_0x5c6d33);}else{return _0x5c6d33;}})[_0xb6b1('0x16')](function(_0x1c2c1e){_0x19050a(_0x1c2c1e);})[_0xb6b1('0x13')](function(_0x4b9009){_0x452543(_0x4b9009);});});}; \ No newline at end of file +var _0x2e51=['Tags','../../mysqldb','fullname','split','push','waiting','talking','answered','unmanaged','abandoned','total','disposition','UserId','MailMessage','out','-id','then','lastMsgText','trimStart','plainBody','catch','updateInteraction','Users','TagIds'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x2e51,0x1c9));var _0x12e5=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x2e51[_0x2f45ea];return _0x485a84;};'use strict';var _=require('lodash');var db=require(_0x12e5('0x0'))['db'];function getInteractionUsers(_0xc37a36,_0x1a7587){return new Promise(function(_0x58c5fc,_0x5d0aaf){try{var _0x4dd644=[];if(_0x1a7587[_0xc37a36]){_0x4dd644=_0x1a7587[_0xc37a36]['map'](function(_0x464cda){return{'id':_0x464cda['id'],'fullname':_0x464cda[_0x12e5('0x1')]};});}return _0x58c5fc(_0x4dd644);}catch(_0x1f983b){_0x5d0aaf(_0x1f983b);}});}function getInteractionTags(_0x6782c6,_0x3f2114){var _0x2df774=[];if(_0x6782c6){_0x6782c6[_0x12e5('0x2')](',')['forEach'](function(_0x33b98e){_0x2df774[_0x12e5('0x3')](_0x3f2114[_0x33b98e]);});}return _0x2df774;}function updateWaitingCounter(_0x508fa5){if(_0x508fa5[_0x12e5('0x4')]){_0x508fa5[_0x12e5('0x4')]-=0x1;}}function updateInteractionCounters(_0x5c8649){_0x5c8649['waiting']=0x0;_0x5c8649[_0x12e5('0x5')]=0x0;_0x5c8649[_0x12e5('0x6')]=0x0;_0x5c8649[_0x12e5('0x7')]=0x0;_0x5c8649[_0x12e5('0x8')]=0x0;_0x5c8649[_0x12e5('0x9')]=0x0;if(_0x5c8649['closed']){if(_0x5c8649[_0x12e5('0xa')]===_0x12e5('0x8')){_0x5c8649[_0x12e5('0x8')]+=0x1;updateWaitingCounter(_0x5c8649);}if(_0x5c8649[_0x12e5('0xb')]){_0x5c8649['answered']+=0x1;if(_0x5c8649[_0x12e5('0x5')]){_0x5c8649[_0x12e5('0x5')]-=0x1;}}else{if(_0x5c8649[_0x12e5('0xa')]){_0x5c8649['unmanaged']+=0x1;updateWaitingCounter(_0x5c8649);}}}else{if(!_0x5c8649['UserId']){_0x5c8649[_0x12e5('0x4')]+=0x1;}if(_0x5c8649[_0x12e5('0xb')]){_0x5c8649['talking']+=0x1;updateWaitingCounter(_0x5c8649);}}_0x5c8649['total']+=0x1;return _0x5c8649;}function getLastMessageText(_0xc28c30){return db[_0x12e5('0xc')]['findOne']({'where':{'$and':[{'MailInteractionId':_0xc28c30['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x12e5('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x12e5('0xe'),'raw':!![]})[_0x12e5('0xf')](function(_0x2b4ae9){if(_0x2b4ae9&&_0x2b4ae9['plainBody']){_0xc28c30[_0x12e5('0x10')]=_[_0x12e5('0x11')](_0x2b4ae9[_0x12e5('0x12')]);}return _0xc28c30;})[_0x12e5('0x13')](function(_0x29e0c0){throw _0x29e0c0;});}exports[_0x12e5('0x14')]=function(_0x4d63db,_0x5bba38,_0x2dbf71,_0x13de08){return new Promise(function(_0x3f4467,_0x13cba2){return getInteractionUsers(_0x4d63db['id'],_0x2dbf71)[_0x12e5('0xf')](function(_0x34541d){_0x4d63db[_0x12e5('0x15')]=_0x34541d;return getInteractionTags(_0x4d63db[_0x12e5('0x16')],_0x5bba38);})[_0x12e5('0xf')](function(_0x443886){_0x4d63db[_0x12e5('0x17')]=_0x443886;delete _0x4d63db[_0x12e5('0x16')];return updateInteractionCounters(_0x4d63db);})[_0x12e5('0xf')](function(_0x470202){if(_0x13de08){return getLastMessageText(_0x470202);}else{return _0x470202;}})[_0x12e5('0xf')](function(_0x2408b1){_0x3f4467(_0x2408b1);})['catch'](function(_0x1dff95){_0x13cba2(_0x1dff95);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 39db5f3..bf5b8bc 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dd6=['chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_messages','_interactions','isArray','toLowerCase','toUpperCase','role','stringify','Interaction','findOne','then','update','exports','lodash','../../config/logger','openchannel-interactions','mail-interactions','whatsapp-interactions','capitalize'];(function(_0x3bead5,_0x2f2b48){var _0x392e9c=function(_0xcb8509){while(--_0xcb8509){_0x3bead5['push'](_0x3bead5['shift']());}};_0x392e9c(++_0x2f2b48);}(_0x2dd6,0x1e8));var _0x62dd=function(_0x24dfd2,_0x504fac){_0x24dfd2=_0x24dfd2-0x0;var _0x3abda1=_0x2dd6[_0x24dfd2];return _0x3abda1;};'use strict';var _=require(_0x62dd('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x62dd('0x1'))(_0x62dd('0x2')),'mail':require(_0x62dd('0x1'))(_0x62dd('0x3')),'fax':require(_0x62dd('0x1'))('fax-interactions'),'sms':require('../../config/logger')('sms-interactions'),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require('../../config/logger')(_0x62dd('0x4'))};function getAccountFK(_0x3529fe){return _[_0x62dd('0x5')](_0x3529fe)+(_0x3529fe===_0x62dd('0x6')?_0x62dd('0x7'):_0x62dd('0x8'))+'Id';}function getInteractionFK(_0x5286b7){return _[_0x62dd('0x5')](_0x5286b7)+_0x62dd('0x9');}function getInteractionId(_0x123e67,_0x169bdc,_0x5c51c8){if(_0x123e67&&_0x123e67[_[_0x62dd('0xa')](_0x5c51c8)+_0x62dd('0x9')]){return _0x123e67[_[_0x62dd('0xa')](_0x5c51c8)+_0x62dd('0x9')];}else if(_0x123e67&&_0x123e67['id']){return _0x123e67['id'];}else if(_0x169bdc&&_0x169bdc['id']){return _0x169bdc['id'];}else{return _0x62dd('0xb');}}function getInteractionsTables(_0x1bb413){return{'accounts':_0x1bb413+'_'+(_0x1bb413===_0x62dd('0x6')?_0x62dd('0xc'):_0x62dd('0xd')),'interactions':_0x1bb413+'_interactions','interactionsTags':_0x1bb413+'_interaction_has_tags','messages':_0x1bb413+_0x62dd('0xe'),'userInteractions':'user_has_'+_0x1bb413+_0x62dd('0xf')};}function getSelectedTags(_0x31efa7){var _0x3eaa08=[];if(_0x31efa7){_0x3eaa08=Array[_0x62dd('0x10')](_0x31efa7)?_0x31efa7:[_0x31efa7];}return _0x3eaa08;}function log(_0x3a0684,_0x5506ac,_0x1db7b1,_0x16cca7,_0x108207,_0xeeb9ab){loggers[_0x108207[_0x62dd('0x11')]()][_0x3a0684]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xeeb9ab[_0x62dd('0x12')](),_0x5506ac?_0x5506ac['id']:null,_0x5506ac?_0x5506ac['name']:null,_0x5506ac?_0x5506ac[_0x62dd('0x13')]:null,getInteractionId(_0x1db7b1,_0x16cca7,_0x108207),_0x1db7b1?JSON[_0x62dd('0x14')](_0x1db7b1):'null');}function updateUser(_0xcdba8e,_0x5c96b7,_0x1fc3e7,_0x3f5258,_0x526d5e){db[_[_0x62dd('0xa')](_0x3f5258)+_0x62dd('0x15')][_0x62dd('0x16')]({'where':{'id':getInteractionId(_0x5c96b7,_0x1fc3e7,_0x3f5258)}})[_0x62dd('0x17')](function(_0x4c7d8d){if(_0x4c7d8d){return _0x4c7d8d[_0x62dd('0x18')]({'UserId':_0xcdba8e?_0xcdba8e['id']:null});}})['then'](function(_0x156548){if(_0x156548){log('info',_0xcdba8e,_0x5c96b7,_0x1fc3e7,_0x3f5258,_0x526d5e);}})['catch'](function(){log('error',_0xcdba8e,_0x5c96b7,_0x1fc3e7,_0x3f5258,_0x526d5e);});}module[_0x62dd('0x19')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x7595=['Interaction','findOne','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','chat','Website','Account','capitalize','InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','upperFirst'];(function(_0x3851d5,_0x41d670){var _0x1b9119=function(_0x61de9b){while(--_0x61de9b){_0x3851d5['push'](_0x3851d5['shift']());}};_0x1b9119(++_0x41d670);}(_0x7595,0x188));var _0x5759=function(_0x3dd266,_0x4d919f){_0x3dd266=_0x3dd266-0x0;var _0x320665=_0x7595[_0x3dd266];return _0x320665;};'use strict';var _=require(_0x5759('0x0'));var db=require(_0x5759('0x1'))['db'];var loggers={'openchannel':require(_0x5759('0x2'))(_0x5759('0x3')),'mail':require(_0x5759('0x2'))(_0x5759('0x4')),'fax':require(_0x5759('0x2'))(_0x5759('0x5')),'sms':require(_0x5759('0x2'))(_0x5759('0x6')),'chat':require(_0x5759('0x2'))(_0x5759('0x7')),'whatsapp':require(_0x5759('0x2'))('whatsapp-interactions')};function getAccountFK(_0x26f058){return _['capitalize'](_0x26f058)+(_0x26f058===_0x5759('0x8')?_0x5759('0x9'):_0x5759('0xa'))+'Id';}function getInteractionFK(_0x3618f7){return _[_0x5759('0xb')](_0x3618f7)+_0x5759('0xc');}function getInteractionId(_0x2f92b9,_0x2fed25,_0x17a0a7){if(_0x2f92b9&&_0x2f92b9[_['upperFirst'](_0x17a0a7)+_0x5759('0xc')]){return _0x2f92b9[_['upperFirst'](_0x17a0a7)+_0x5759('0xc')];}else if(_0x2f92b9&&_0x2f92b9['id']){return _0x2f92b9['id'];}else if(_0x2fed25&&_0x2fed25['id']){return _0x2fed25['id'];}else{return _0x5759('0xd');}}function getInteractionsTables(_0x2f8c79){return{'accounts':_0x2f8c79+'_'+(_0x2f8c79===_0x5759('0x8')?_0x5759('0xe'):_0x5759('0xf')),'interactions':_0x2f8c79+_0x5759('0x10'),'interactionsTags':_0x2f8c79+_0x5759('0x11'),'messages':_0x2f8c79+_0x5759('0x12'),'userInteractions':_0x5759('0x13')+_0x2f8c79+_0x5759('0x10')};}function getSelectedTags(_0x439c69){var _0x3d6633=[];if(_0x439c69){_0x3d6633=Array[_0x5759('0x14')](_0x439c69)?_0x439c69:[_0x439c69];}return _0x3d6633;}function log(_0x298ad8,_0x2a5b8e,_0x2d59d3,_0x2dd37e,_0x25c679,_0x10f393){loggers[_0x25c679[_0x5759('0x15')]()][_0x298ad8](_0x5759('0x16'),_0x10f393[_0x5759('0x17')](),_0x2a5b8e?_0x2a5b8e['id']:null,_0x2a5b8e?_0x2a5b8e[_0x5759('0x18')]:null,_0x2a5b8e?_0x2a5b8e[_0x5759('0x19')]:null,getInteractionId(_0x2d59d3,_0x2dd37e,_0x25c679),_0x2d59d3?JSON['stringify'](_0x2d59d3):_0x5759('0x1a'));}function updateUser(_0x230ef6,_0x27e70c,_0x248ab3,_0x1e0802,_0xf40c11){db[_[_0x5759('0x1b')](_0x1e0802)+_0x5759('0x1c')][_0x5759('0x1d')]({'where':{'id':getInteractionId(_0x27e70c,_0x248ab3,_0x1e0802)}})['then'](function(_0xe0f359){if(_0xe0f359){return _0xe0f359[_0x5759('0x1e')]({'UserId':_0x230ef6?_0x230ef6['id']:null});}})['then'](function(_0x38a8b7){if(_0x38a8b7){log(_0x5759('0x1f'),_0x230ef6,_0x27e70c,_0x248ab3,_0x1e0802,_0xf40c11);}})[_0x5759('0x20')](function(){log(_0x5759('0x21'),_0x230ef6,_0x27e70c,_0x248ab3,_0x1e0802,_0xf40c11);});}module[_0x5759('0x22')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 796bd1c..e369c41 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 _0x7239=['base64','utf8','final','parse','hasOwnProperty','License','then','count','status','json','catch','users','crypto','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update'];(function(_0x100e29,_0x3914d4){var _0x35b96d=function(_0x23c709){while(--_0x23c709){_0x100e29['push'](_0x100e29['shift']());}};_0x35b96d(++_0x3914d4);}(_0x7239,0xad));var _0x9723=function(_0x514dad,_0x318102){_0x514dad=_0x514dad-0x0;var _0x2ad10a=_0x7239[_0x514dad];return _0x2ad10a;};'use strict';var crypto=require(_0x9723('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x9723('0x1'))['db'];var config=require(_0x9723('0x2'));function getValueFromLicense(_0x5b9c1c,_0x5cbd45){if(_0x5b9c1c&&_0x5cbd45){if(_0x5cbd45['data1']&&_0x5cbd45[_0x9723('0x3')]){var _0x381804=_0x5cbd45[_0x9723('0x4')];var _0x5e1e7d=_0x5cbd45['license'];var _0x329175=_0x381804[_0x9723('0x5')]('-')[0x4];var _0x3048cf=_0x381804[_0x9723('0x5')]('-')[0x0];var _0x42e597=crypto[_0x9723('0x6')](_0x9723('0x7'),util[_0x9723('0x8')](_0x9723('0x9'),_0x329175,_0x381804,_0x3048cf));var _0xa2b1f0=_0x42e597[_0x9723('0xa')](_0x5e1e7d,_0x9723('0xb'),_0x9723('0xc'));_0xa2b1f0+=_0x42e597[_0x9723('0xd')]('utf8');var _0x3c304d=JSON[_0x9723('0xe')](_0xa2b1f0);return _0x3c304d[_0x9723('0xf')](_0x5b9c1c)?_0x3c304d[_0x5b9c1c]:null;}}return null;}function isLimit(_0xbd3aaf,_0x13f217,_0x462775,_0x10039e){var _0x5f1f28=_0x13f217;return compose()['use'](function(_0x467235,_0x5baea6,_0x3f8b7f){return db[_0x9723('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x9723('0x11')](function(_0x39466f){var _0x570a2d=getValueFromLicense(_0xbd3aaf,_0x39466f);return _0x570a2d?_0x570a2d:_0x5f1f28;})[_0x9723('0x11')](function(_0x1d513a){_0x5f1f28=_0x1d513a;return _0x462775[_0x9723('0x12')](_0x10039e);})['then'](function(_0xd3d95e){if(_0xd3d95e>=_0x5f1f28){return _0x5baea6[_0x9723('0x13')](0x193)[_0x9723('0x14')]({'message':util[_0x9723('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0xbd3aaf)});}_0x3f8b7f();})[_0x9723('0x15')](function(_0x3da332){_0x3f8b7f(_0x3da332);});});}function isUserLimit(){return isLimit(_0x9723('0x16'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xc2c2=['then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','crypto','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use'];(function(_0x1d4a02,_0x2f0772){var _0x3e3bd3=function(_0x3d88e0){while(--_0x3d88e0){_0x1d4a02['push'](_0x1d4a02['shift']());}};_0x3e3bd3(++_0x2f0772);}(_0xc2c2,0xf2));var _0x2c2c=function(_0x340c37,_0xc7fdb){_0x340c37=_0x340c37-0x0;var _0x33d28c=_0xc2c2[_0x340c37];return _0x33d28c;};'use strict';var crypto=require(_0x2c2c('0x0'));var util=require(_0x2c2c('0x1'));var compose=require(_0x2c2c('0x2'));var db=require(_0x2c2c('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x52b375,_0x3de541){if(_0x52b375&&_0x3de541){if(_0x3de541[_0x2c2c('0x4')]&&_0x3de541[_0x2c2c('0x5')]){var _0x575287=_0x3de541[_0x2c2c('0x4')];var _0x115afc=_0x3de541[_0x2c2c('0x5')];var _0x4d48d7=_0x575287[_0x2c2c('0x6')]('-')[0x4];var _0x1027bd=_0x575287['split']('-')[0x0];var _0x3b7128=crypto[_0x2c2c('0x7')](_0x2c2c('0x8'),util[_0x2c2c('0x9')](_0x2c2c('0xa'),_0x4d48d7,_0x575287,_0x1027bd));var _0x57d7f9=_0x3b7128[_0x2c2c('0xb')](_0x115afc,_0x2c2c('0xc'),_0x2c2c('0xd'));_0x57d7f9+=_0x3b7128[_0x2c2c('0xe')](_0x2c2c('0xd'));var _0x4940ec=JSON[_0x2c2c('0xf')](_0x57d7f9);return _0x4940ec[_0x2c2c('0x10')](_0x52b375)?_0x4940ec[_0x52b375]:null;}}return null;}function isLimit(_0x15d060,_0xb5ae4b,_0x554a9c,_0x4524da){var _0x424dd0=_0xb5ae4b;return compose()[_0x2c2c('0x11')](function(_0x2565a2,_0x1a0833,_0x51fa8c){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x45eb73){var _0x27ce4b=getValueFromLicense(_0x15d060,_0x45eb73);return _0x27ce4b?_0x27ce4b:_0x424dd0;})['then'](function(_0x89d124){_0x424dd0=_0x89d124;return _0x554a9c['count'](_0x4524da);})[_0x2c2c('0x12')](function(_0xe662c){if(_0xe662c>=_0x424dd0){return _0x1a0833['status'](0x193)[_0x2c2c('0x13')]({'message':util[_0x2c2c('0x9')](_0x2c2c('0x14'),_0x15d060)});}_0x51fa8c();})[_0x2c2c('0x15')](function(_0xf5c636){_0x51fa8c(_0xf5c636);});});}function isUserLimit(){return isLimit(_0x2c2c('0x16'),0x1,db[_0x2c2c('0x17')],{'where':{'$or':[{'role':_0x2c2c('0x18')},{'role':_0x2c2c('0x19')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2446e0b..5e4976d 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 _0x43ec=['push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','castTo','text','CAST(','field','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','$ne','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','$substring','pop','utcOffset','format','hours','seconds','lodash','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','length','slice','split','shift','forEach','filter','map'];(function(_0x1680a9,_0x40651d){var _0x1e456a=function(_0x95654){while(--_0x95654){_0x1680a9['push'](_0x1680a9['shift']());}};_0x1e456a(++_0x40651d);}(_0x43ec,0x1a9));var _0xc43e=function(_0x1290c5,_0x2d5b20){_0x1290c5=_0x1290c5-0x0;var _0x37a6ef=_0x43ec[_0x1290c5];return _0x37a6ef;};'use strict';var _=require(_0xc43e('0x0'));var moment=require('moment');exports[_0xc43e('0x1')]=function(_0x5648da){var _0x4ae52d={'conditions':[]};_0x4ae52d[_0xc43e('0x2')]=_[_0xc43e('0x3')](_0x5648da,'[$or]')?'or':_0xc43e('0x4');var _0x52ec00=_0x5648da[_0xc43e('0x5')](_0xc43e('0x6'),'')[_0xc43e('0x5')](_0xc43e('0x7'),'')['split']('||');for(var _0x1ba76f=0x0;_0x1ba76f<_0x52ec00[_0xc43e('0x8')];_0x1ba76f++){var _0x3c5916=_0x52ec00[_0x1ba76f]['split'](':=');var _0x54f642=_0x3c5916[0x0];var _0x30d1e5=_0x3c5916[_0xc43e('0x9')](0x1);_0x30d1e5['forEach'](function(_0x13fffa){var _0x127a7d=_0x13fffa[_0xc43e('0xa')]('[')[_0xc43e('0xb')]();var _0x117288=_0x13fffa['match'](/\[(.*?)\]/g);_0x117288[_0xc43e('0xc')](function(_0x294bfb){var _0x300bcc=_0x294bfb[_0xc43e('0xa')]('[')[_0xc43e('0xd')](function(_0x1c6ba8){return _0x1c6ba8['indexOf'](']')>-0x1;})[_0xc43e('0xe')](function(_0x3ada34){return _0x3ada34[_0xc43e('0xa')](']')[0x0];})[0x0];_0x4ae52d['conditions'][_0xc43e('0xf')]({'field':_0x54f642,'operator':_0x127a7d,'value':_0x300bcc});});});}return _0x4ae52d;};exports[_0xc43e('0x10')]=function(_0x5a003b,_0x467cad,_0x1d4eac){var _0x5664ae={};if(_0x467cad===_0xc43e('0x11')){if(_0x1d4eac[_0xc43e('0x12')]==='$eq'){_0x1d4eac[_0xc43e('0x12')]=_0xc43e('0x13');_0x1d4eac[_0xc43e('0x14')]+=','+_0x1d4eac[_0xc43e('0x14')];}else if(_[_0xc43e('0x15')]([_0xc43e('0x16'),_0xc43e('0x17')],_0x1d4eac[_0xc43e('0x12')])){_0x1d4eac[_0xc43e('0x14')]=moment(_0x1d4eac[_0xc43e('0x14')])[_0xc43e('0x18')](0x1,_0xc43e('0x19'))['format']('YYYY-MM-DD');}}if(_0x1d4eac[_0xc43e('0x1a')]){_0x467cad=_0x1d4eac[_0xc43e('0x1a')];_0x5664ae[_0xc43e('0x1b')]=_0xc43e('0x1c')+_0x5a003b+'.'+_0x1d4eac[_0xc43e('0x1d')]+'\x20AS\x20'+_0x1d4eac['castTo']+')\x20'+parseOperator(_0x1d4eac['operator']);}else{_0x5664ae[_0xc43e('0x1b')]=_0x5a003b+'.'+_0x1d4eac['field']+'\x20'+parseOperator(_0x1d4eac['operator']);}if(_[_0xc43e('0x15')](['$ne',_0xc43e('0x1e')],_0x1d4eac['operator']))_0x5664ae[_0xc43e('0x1b')]='('+_0x5664ae['text']+_0xc43e('0x1f')+_0x5a003b+'.'+_0x1d4eac[_0xc43e('0x1d')]+_0xc43e('0x20');_0x5664ae[_0xc43e('0x14')]=parseValue(_0x467cad,_0x1d4eac[_0xc43e('0x12')],_0x1d4eac[_0xc43e('0x14')]);return _0x5664ae;};function parseOperator(_0x536aa0){var _0x27784f;switch(_0x536aa0){case _0xc43e('0x21'):_0x27784f=_0xc43e('0x22');break;case _0xc43e('0x1e'):_0x27784f=_0xc43e('0x23');break;case _0xc43e('0x24'):_0x27784f='=\x20?';break;case _0xc43e('0x25'):_0x27784f=_0xc43e('0x26');break;case'$substring':case _0xc43e('0x27'):case _0xc43e('0x28'):_0x27784f=_0xc43e('0x29');break;case _0xc43e('0x2a'):_0x27784f=_0xc43e('0x2b');break;case'$gt':_0x27784f=_0xc43e('0x2c');break;case _0xc43e('0x17'):_0x27784f=_0xc43e('0x2d');break;case _0xc43e('0x2e'):_0x27784f=_0xc43e('0x2f');break;case _0xc43e('0x13'):_0x27784f='BETWEEN\x20?\x20AND\x20?';break;}return _0x27784f;}function parseValue(_0x47b078,_0x2fb4ab,_0x2ddd45){var _0x1c3dc5={'start':undefined,'end':undefined};switch(_0x2fb4ab){case _0xc43e('0x21'):case'$notIn':_0x1c3dc5[_0xc43e('0x30')]=_0x2ddd45[_0xc43e('0xa')](',');break;case _0xc43e('0x31'):_0x1c3dc5[_0xc43e('0x30')]='%'+_0x2ddd45+'%';break;case _0xc43e('0x27'):_0x1c3dc5[_0xc43e('0x30')]=_0x2ddd45+'%';break;case _0xc43e('0x28'):_0x1c3dc5['start']='%'+_0x2ddd45;break;case _0xc43e('0x13'):var _0x5907af=_0x2ddd45['split'](',');var _0x2ddd45=_0x5907af[_0xc43e('0xb')]();var _0x59b6de=_0x5907af[_0xc43e('0x32')]();if(_0x47b078===_0xc43e('0x11')){_0x2ddd45=moment(_0x2ddd45)[_0xc43e('0x33')](0x0,!![])[_0xc43e('0x34')]();_0x59b6de=moment(_0x59b6de)[_0xc43e('0x33')](0x0,!![])[_0xc43e('0x18')](0x17,_0xc43e('0x35'))['add'](0x3b,'minutes')[_0xc43e('0x18')](0x3b,_0xc43e('0x36'))[_0xc43e('0x34')]();}_0x1c3dc5={'start':_0x2ddd45,'end':_0x59b6de};break;default:_0x1c3dc5[_0xc43e('0x30')]=_0x2ddd45;break;}return _0x1c3dc5;} \ No newline at end of file +var _0xbc6a=['$in','start','shift','utcOffset','hours','minutes','seconds','moment','sqlOperator','[$or]','and','replace','length','split','slice','forEach','filter','indexOf','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xbc6a,0x16c));var _0xabc6=function(_0x19f38d,_0x29c8fd){_0x19f38d=_0x19f38d-0x0;var _0x2d8d7a=_0xbc6a[_0x19f38d];return _0x2d8d7a;};'use strict';var _=require('lodash');var moment=require(_0xabc6('0x0'));exports['parseSearch']=function(_0x2cae79){var _0x3f6e40={'conditions':[]};_0x3f6e40[_0xabc6('0x1')]=_['startsWith'](_0x2cae79,_0xabc6('0x2'))?'or':_0xabc6('0x3');var _0x5255ea=_0x2cae79[_0xabc6('0x4')]('[$and]','')[_0xabc6('0x4')](_0xabc6('0x2'),'')['split']('||');for(var _0x55a6ac=0x0;_0x55a6ac<_0x5255ea[_0xabc6('0x5')];_0x55a6ac++){var _0x464a27=_0x5255ea[_0x55a6ac][_0xabc6('0x6')](':=');var _0x1c1ce2=_0x464a27[0x0];var _0x4cf215=_0x464a27[_0xabc6('0x7')](0x1);_0x4cf215[_0xabc6('0x8')](function(_0x586c68){var _0x561135=_0x586c68['split']('[')['shift']();var _0x4c0511=_0x586c68['match'](/\[(.*?)\]/g);_0x4c0511[_0xabc6('0x8')](function(_0x265f5e){var _0x4dc381=_0x265f5e['split']('[')[_0xabc6('0x9')](function(_0xe650f7){return _0xe650f7[_0xabc6('0xa')](']')>-0x1;})['map'](function(_0xc457a1){return _0xc457a1['split'](']')[0x0];})[0x0];_0x3f6e40['conditions'][_0xabc6('0xb')]({'field':_0x1c1ce2,'operator':_0x561135,'value':_0x4dc381});});});}return _0x3f6e40;};exports[_0xabc6('0xc')]=function(_0x4964ca,_0xdc243b,_0x358c8f){var _0x12cbc5={};if(_0xdc243b===_0xabc6('0xd')){if(_0x358c8f[_0xabc6('0xe')]==='$eq'){_0x358c8f[_0xabc6('0xe')]=_0xabc6('0xf');_0x358c8f['value']+=','+_0x358c8f[_0xabc6('0x10')];}else if(_[_0xabc6('0x11')]([_0xabc6('0x12'),_0xabc6('0x13')],_0x358c8f[_0xabc6('0xe')])){_0x358c8f['value']=moment(_0x358c8f['value'])[_0xabc6('0x14')](0x1,_0xabc6('0x15'))[_0xabc6('0x16')]('YYYY-MM-DD');}}if(_0x358c8f[_0xabc6('0x17')]){_0xdc243b=_0x358c8f['castTo'];_0x12cbc5[_0xabc6('0x18')]=_0xabc6('0x19')+_0x4964ca+'.'+_0x358c8f[_0xabc6('0x1a')]+_0xabc6('0x1b')+_0x358c8f[_0xabc6('0x17')]+')\x20'+parseOperator(_0x358c8f[_0xabc6('0xe')]);}else{_0x12cbc5[_0xabc6('0x18')]=_0x4964ca+'.'+_0x358c8f[_0xabc6('0x1a')]+'\x20'+parseOperator(_0x358c8f[_0xabc6('0xe')]);}if(_[_0xabc6('0x11')](['$ne',_0xabc6('0x1c')],_0x358c8f[_0xabc6('0xe')]))_0x12cbc5[_0xabc6('0x18')]='('+_0x12cbc5[_0xabc6('0x18')]+_0xabc6('0x1d')+_0x4964ca+'.'+_0x358c8f['field']+_0xabc6('0x1e');_0x12cbc5[_0xabc6('0x10')]=parseValue(_0xdc243b,_0x358c8f['operator'],_0x358c8f[_0xabc6('0x10')]);return _0x12cbc5;};function parseOperator(_0x2d1599){var _0x1fd5c8;switch(_0x2d1599){case'$in':_0x1fd5c8=_0xabc6('0x1f');break;case _0xabc6('0x1c'):_0x1fd5c8='NOT\x20IN\x20?';break;case'$eq':_0x1fd5c8=_0xabc6('0x20');break;case _0xabc6('0x21'):_0x1fd5c8=_0xabc6('0x22');break;case _0xabc6('0x23'):case _0xabc6('0x24'):case _0xabc6('0x25'):_0x1fd5c8='LIKE\x20?';break;case _0xabc6('0x26'):_0x1fd5c8=_0xabc6('0x27');break;case _0xabc6('0x12'):_0x1fd5c8=_0xabc6('0x28');break;case _0xabc6('0x13'):_0x1fd5c8='<=\x20?';break;case _0xabc6('0x29'):_0x1fd5c8=_0xabc6('0x2a');break;case'$between':_0x1fd5c8=_0xabc6('0x2b');break;}return _0x1fd5c8;}function parseValue(_0x5dc99a,_0x4ec3a9,_0x2bcd8b){var _0x57bebd={'start':undefined,'end':undefined};switch(_0x4ec3a9){case _0xabc6('0x2c'):case _0xabc6('0x1c'):_0x57bebd['start']=_0x2bcd8b[_0xabc6('0x6')](',');break;case'$substring':_0x57bebd[_0xabc6('0x2d')]='%'+_0x2bcd8b+'%';break;case'$startsWith':_0x57bebd[_0xabc6('0x2d')]=_0x2bcd8b+'%';break;case'$endsWith':_0x57bebd[_0xabc6('0x2d')]='%'+_0x2bcd8b;break;case _0xabc6('0xf'):var _0x14a272=_0x2bcd8b[_0xabc6('0x6')](',');var _0x2bcd8b=_0x14a272[_0xabc6('0x2e')]();var _0x524708=_0x14a272['pop']();if(_0x5dc99a==='DATE'){_0x2bcd8b=moment(_0x2bcd8b)[_0xabc6('0x2f')](0x0,!![])[_0xabc6('0x16')]();_0x524708=moment(_0x524708)[_0xabc6('0x2f')](0x0,!![])['add'](0x17,_0xabc6('0x30'))[_0xabc6('0x14')](0x3b,_0xabc6('0x31'))[_0xabc6('0x14')](0x3b,_0xabc6('0x32'))[_0xabc6('0x16')]();}_0x57bebd={'start':_0x2bcd8b,'end':_0x524708};break;default:_0x57bebd[_0xabc6('0x2d')]=_0x2bcd8b;break;}return _0x57bebd;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 5aab288..fc44748 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 _0xf401=['fields','attributes','hasOwnProperty','nolimit','sort','filter','object','columns','value','where','lower','options','lodash','sequelize','parse','keys','includes','split','filters','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','limit','offset','map','priority','unsigned','substr','cast','col','ASC','omit','isEmpty','length','isObject','isString','unset','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','$id','query','model','intersection'];(function(_0x546ed7,_0x3766e4){var _0x54e0e1=function(_0x357bd0){while(--_0x357bd0){_0x546ed7['push'](_0x546ed7['shift']());}};_0x54e0e1(++_0x3766e4);}(_0xf401,0x1b7));var _0x1f40=function(_0x451d22,_0x48cdad){_0x451d22=_0x451d22-0x0;var _0x19636e=_0xf401[_0x451d22];return _0x19636e;};'use strict';var _=require(_0x1f40('0x0'));var sequelize=require(_0x1f40('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x308c15){var _0x52c3b7=['ne'];try{var _0x54ee90=JSON[_0x1f40('0x2')](_0x308c15);var _0x2fd5c0=Object[_0x1f40('0x3')](_0x54ee90)[0x0];return _0x52c3b7[_0x1f40('0x4')](_0x2fd5c0);}catch(_0x225332){return![];}}function getOperatorValue(_0x17e55d){var _0x4943ae=JSON[_0x1f40('0x2')](_0x17e55d);var _0x5326d1=Object['keys'](_0x4943ae)[0x0];var _0x53ca98=_0x4943ae[_0x5326d1];return{['$'+_0x5326d1]:_0x53ca98};}exports['fields']=function(_0x294bd9){var _0x3d1b29=null;if(_0x294bd9){_0x3d1b29=_0x294bd9[_0x1f40('0x5')](',');}return _0x3d1b29;};exports[_0x1f40('0x6')]=function(_0x295549,_0x565469){var _0x51eeef={};if(!_['isEmpty'](_0x295549)){_[_0x1f40('0x7')](_0x295549,function(_0x1b6ca4,_0x387fe8){try{if(_0x565469){var _0x7da8c1=_[_0x1f40('0x8')](_0x565469,{'name':_0x387fe8})||{};if(hasSequelizeOperator(_0x1b6ca4)){_0x51eeef[_0x387fe8]=getOperatorValue(_0x1b6ca4);}else if(_0x7da8c1[_0x1f40('0x9')]===_0x1f40('0xa')&&_[_0x1f40('0xb')](_0x1b6ca4)){var _0x490bdc=JSON['parse'](_0x1b6ca4);var _0x178215={'$gte':moment(moment(_0x490bdc[_0x1f40('0xc')])[_0x1f40('0xd')](_0x1f40('0xe')))[_0x1f40('0xf')]()[_0x1f40('0xd')](),'$lte':moment(moment(_0x490bdc[_0x1f40('0x10')])[_0x1f40('0xd')](_0x1f40('0xe')))[_0x1f40('0xf')]()[_0x1f40('0x11')](0x1,'s')[_0x1f40('0xd')]()};_0x51eeef[_0x387fe8]=_0x178215;}else if(_0x7da8c1[_0x1f40('0x12')]==='uniqueid'){_0x51eeef[_0x387fe8]=_0x1b6ca4;}else{_0x51eeef[_0x387fe8]=_[_0x1f40('0x13')](_0x1b6ca4)?_0x1b6ca4:JSON[_0x1f40('0x2')](_0x1b6ca4);}}else{_0x51eeef[_0x387fe8]=_[_0x1f40('0x13')](_0x1b6ca4)?_0x1b6ca4:JSON[_0x1f40('0x2')](_0x1b6ca4);}}catch(_0x104e6d){_0x51eeef[_0x387fe8]=_0x1b6ca4['split'](',');}});}return _0x51eeef;};exports[_0x1f40('0x14')]=function(_0x14b3b1){_0x14b3b1=parseInt(_0x14b3b1,0xa);if(!_0x14b3b1||_0x14b3b1<0x0){_0x14b3b1=LIMIT_VALUE;}return _0x14b3b1;};exports[_0x1f40('0x15')]=function(_0x109934){_0x109934=parseInt(_0x109934,0xa);if(!_0x109934||_0x109934<0x0){_0x109934=0x0;}return _0x109934;};exports['sort']=function(_0x2a3329){var _0x436791,_0x29b82c=null;if(_0x2a3329){_0x436791=_0x2a3329[_0x1f40('0x5')](',');_0x29b82c=_[_0x1f40('0x16')](_0x436791,function(_0x14598d){if(_0x14598d['indexOf']('-')===0x0){return[_0x14598d===_0x1f40('0x17')?sequelize['cast'](sequelize['col'](_0x1f40('0x17')),_0x1f40('0x18')):_0x14598d[_0x1f40('0x19')](0x1),'DESC'];}else{return[_0x14598d===_0x1f40('0x17')?sequelize[_0x1f40('0x1a')](sequelize[_0x1f40('0x1b')]('priority'),_0x1f40('0x18')):_0x14598d,_0x1f40('0x1c')];}});}return _0x29b82c;};exports[_0x1f40('0x1d')]=function(_0x1de415,_0x21ae39){if(_[_0x1f40('0x1e')](_0x1de415)){return _0x1de415;}if(_['isArray'](_0x1de415)){for(var _0x1b612b=0x0;_0x1b612b<_0x1de415[_0x1f40('0x1f')];_0x1b612b+=0x1){_0x1de415[_0x1b612b]=this[_0x1f40('0x1d')](_0x1de415[_0x1b612b],_0x21ae39);}return _0x1de415;}if(!_[_0x1f40('0x20')](_0x1de415)){return _0x1de415;}if(_[_0x1f40('0x21')](_0x21ae39)){_0x21ae39=[_0x21ae39];}if(!_['isArray'](_0x21ae39)){return _0x1de415;}for(var _0x4f73b3=0x0;_0x4f73b3<_0x21ae39[_0x1f40('0x1f')];_0x4f73b3+=0x1){_[_0x1f40('0x22')](_0x1de415,_0x21ae39[_0x4f73b3]);}for(var _0xc9b27 in _0x1de415){if(_0x1de415['hasOwnProperty'](_0xc9b27)){_0x1de415[_0xc9b27]=this[_0x1f40('0x1d')](_0x1de415[_0xc9b27],_0x21ae39);}}return _0x1de415;};exports['isNumeric']=function(_0x323e08){return _0x323e08[_0x1f40('0x23')](RegExp(_0x1f40('0x24')))?!![]:![];};exports[_0x1f40('0x25')]=function(_0x1e25bb){return _0x1e25bb[_0x1f40('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x1f40('0x26')]=function(_0x40d118,_0xca2d39){var _0x6f1d99=[];var _0x36e1ed=/[ `!@#$%^&*()_\-?~]/;var _0x38b0c3=_0xca2d39?_0x1f40('0x27'):_0x1f40('0x28');_0x40d118[_0x1f40('0x5')](/[ ,]+/)[_0x1f40('0x29')](function(_0x458bf6){_0x458bf6=_0x458bf6[_0x1f40('0x2a')](/([^:]")"+/g,'$1');_0x458bf6='+'+_0x458bf6+'*';var _0x3bb99f=_0x458bf6[_0x1f40('0x23')](_0x36e1ed);if(_0x3bb99f){_0x458bf6='\x22'+_0x458bf6+'\x22';}_0x6f1d99[_0x1f40('0x2b')](_0x458bf6);});_0x38b0c3=_0x38b0c3[_0x1f40('0x2a')]('{EXPR}',_0x6f1d99[_0x1f40('0x2c')]('\x20'));return _0x38b0c3;};exports['getOptions']=function(_0x5d9a85,_0x35ddc2,_0x7d3994){var _0x1ffa45={},_0x2edc4c={};if(_0x35ddc2['query'][_0x1f40('0x2d')]){_0x35ddc2['query']['id']=_0x35ddc2[_0x1f40('0x2e')][_0x1f40('0x2d')];delete _0x35ddc2[_0x1f40('0x2e')]['$id'];}_0x1ffa45[_0x1f40('0x2f')]=_[_0x1f40('0x16')](_0x5d9a85,_0x1f40('0x12'));_0x1ffa45[_0x1f40('0x2e')]=_[_0x1f40('0x3')](_0x35ddc2[_0x1f40('0x2e')]);_0x1ffa45['filters']=_[_0x1f40('0x30')](_0x1ffa45[_0x1f40('0x2f')],_0x1ffa45[_0x1f40('0x2e')]);_0x2edc4c['attributes']=_[_0x1f40('0x30')](_0x1ffa45[_0x1f40('0x2f')],this[_0x1f40('0x31')](_0x35ddc2[_0x1f40('0x2e')]['fields']));_0x2edc4c[_0x1f40('0x32')]=_0x2edc4c[_0x1f40('0x32')][_0x1f40('0x1f')]?_0x2edc4c['attributes']:_0x1ffa45[_0x1f40('0x2f')];if(!_0x35ddc2[_0x1f40('0x2e')][_0x1f40('0x33')](_0x1f40('0x34'))){_0x2edc4c[_0x1f40('0x14')]=this['limit'](_0x35ddc2[_0x1f40('0x2e')][_0x1f40('0x14')]);_0x2edc4c[_0x1f40('0x15')]=this[_0x1f40('0x15')](_0x35ddc2['query'][_0x1f40('0x15')]);}_0x2edc4c['order']=this[_0x1f40('0x35')](_0x35ddc2[_0x1f40('0x2e')]['sort']);_0x2edc4c['where']=this[_0x1f40('0x6')](_['pick'](_0x35ddc2['query'],_0x1ffa45[_0x1f40('0x6')]),_0x5d9a85);if(_0x35ddc2[_0x1f40('0x2e')][_0x1f40('0x36')]){var _0x4b69c7=_0x5d9a85;var _0x185c02=_0x35ddc2[_0x1f40('0x2e')][_0x1f40('0x36')];if(typeof _0x185c02===_0x1f40('0x37')){_0x4b69c7=_[_0x1f40('0x36')](_0x5d9a85,function(_0x54bfcd){return _['includes'](_0x185c02[_0x1f40('0x38')],_0x54bfcd[_0x1f40('0x12')]);});_0x185c02=_0x185c02[_0x1f40('0x39')];}_0x2edc4c[_0x1f40('0x3a')]=_['merge'](_0x2edc4c['where'],{'$or':_[_0x1f40('0x16')](_0x4b69c7,function(_0x5d0475){if(_0x5d0475[_0x1f40('0x9')]!=='VIRTUAL'){if(_0x7d3994){return sequelize[_0x1f40('0x3a')](sequelize['fn'](_0x1f40('0x3b'),sequelize['col'](_0x5d0475['name'])),{'$like':sequelize['fn'](_0x1f40('0x3b'),'%'+_0x35ddc2[_0x1f40('0x2e')]['filter']+'%')});}else{var _0x10e12b={};_0x10e12b[_0x5d0475['name']]={'$like':'%'+_0x35ddc2['query']['filter']+'%'};return _0x10e12b;}}})});}_0x2edc4c=_['merge']({},_0x2edc4c,_0x35ddc2[_0x1f40('0x3c')]);return _0x2edc4c;}; \ No newline at end of file +var _0xdae9=['match','^[+]?[0-9]*$','\x22{EXPR}\x22','forEach','replace','{EXPR}','join','getOptions','$id','query','model','attributes','intersection','nolimit','offset','order','sort','where','filters','pick','filter','object','columns','VIRTUAL','merge','options','sequelize','moment','parse','keys','includes','fields','split','isEmpty','forOwn','find','DATE','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','limit','map','indexOf','priority','cast','col','unsigned','substr','DESC','omit','length','isObject','unset','hasOwnProperty','isNumeric'];(function(_0x19e76f,_0x313940){var _0x485dcc=function(_0x36c7b3){while(--_0x36c7b3){_0x19e76f['push'](_0x19e76f['shift']());}};_0x485dcc(++_0x313940);}(_0xdae9,0x182));var _0x9dae=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xdae9[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var sequelize=require(_0x9dae('0x0'));var moment=require(_0x9dae('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4936eb){var _0x40deee=['ne'];try{var _0xd47692=JSON[_0x9dae('0x2')](_0x4936eb);var _0x36b725=Object[_0x9dae('0x3')](_0xd47692)[0x0];return _0x40deee[_0x9dae('0x4')](_0x36b725);}catch(_0x275f1b){return![];}}function getOperatorValue(_0x964503){var _0x16a69a=JSON[_0x9dae('0x2')](_0x964503);var _0xc63293=Object['keys'](_0x16a69a)[0x0];var _0x1cf5b8=_0x16a69a[_0xc63293];return{['$'+_0xc63293]:_0x1cf5b8};}exports[_0x9dae('0x5')]=function(_0x3fec85){var _0x418ba7=null;if(_0x3fec85){_0x418ba7=_0x3fec85[_0x9dae('0x6')](',');}return _0x418ba7;};exports['filters']=function(_0x23cc7b,_0x24b2fd){var _0xc62780={};if(!_[_0x9dae('0x7')](_0x23cc7b)){_[_0x9dae('0x8')](_0x23cc7b,function(_0x292b96,_0x10d844){try{if(_0x24b2fd){var _0x26d7a3=_[_0x9dae('0x9')](_0x24b2fd,{'name':_0x10d844})||{};if(hasSequelizeOperator(_0x292b96)){_0xc62780[_0x10d844]=getOperatorValue(_0x292b96);}else if(_0x26d7a3['type']===_0x9dae('0xa')&&_['isPlainObject'](_0x292b96)){var _0x106665=JSON[_0x9dae('0x2')](_0x292b96);var _0x5b406d={'$gte':moment(moment(_0x106665[_0x9dae('0xb')])[_0x9dae('0xc')](_0x9dae('0xd')))['utc']()['format'](),'$lte':moment(moment(_0x106665['$lte'])[_0x9dae('0xc')](_0x9dae('0xd')))[_0x9dae('0xe')]()[_0x9dae('0xf')](0x1,'s')[_0x9dae('0xc')]()};_0xc62780[_0x10d844]=_0x5b406d;}else if(_0x26d7a3[_0x9dae('0x10')]===_0x9dae('0x11')){_0xc62780[_0x10d844]=_0x292b96;}else{_0xc62780[_0x10d844]=_[_0x9dae('0x12')](_0x292b96)?_0x292b96:JSON[_0x9dae('0x2')](_0x292b96);}}else{_0xc62780[_0x10d844]=_[_0x9dae('0x12')](_0x292b96)?_0x292b96:JSON[_0x9dae('0x2')](_0x292b96);}}catch(_0x79a4f4){_0xc62780[_0x10d844]=_0x292b96[_0x9dae('0x6')](',');}});}return _0xc62780;};exports[_0x9dae('0x13')]=function(_0x4a4ff2){_0x4a4ff2=parseInt(_0x4a4ff2,0xa);if(!_0x4a4ff2||_0x4a4ff2<0x0){_0x4a4ff2=LIMIT_VALUE;}return _0x4a4ff2;};exports['offset']=function(_0x486d8){_0x486d8=parseInt(_0x486d8,0xa);if(!_0x486d8||_0x486d8<0x0){_0x486d8=0x0;}return _0x486d8;};exports['sort']=function(_0x3fd3fb){var _0x102032,_0x21ec82=null;if(_0x3fd3fb){_0x102032=_0x3fd3fb[_0x9dae('0x6')](',');_0x21ec82=_[_0x9dae('0x14')](_0x102032,function(_0x3f6bc7){if(_0x3f6bc7[_0x9dae('0x15')]('-')===0x0){return[_0x3f6bc7===_0x9dae('0x16')?sequelize[_0x9dae('0x17')](sequelize[_0x9dae('0x18')](_0x9dae('0x16')),_0x9dae('0x19')):_0x3f6bc7[_0x9dae('0x1a')](0x1),_0x9dae('0x1b')];}else{return[_0x3f6bc7==='priority'?sequelize[_0x9dae('0x17')](sequelize[_0x9dae('0x18')](_0x9dae('0x16')),_0x9dae('0x19')):_0x3f6bc7,'ASC'];}});}return _0x21ec82;};exports[_0x9dae('0x1c')]=function(_0x216765,_0x189b17){if(_[_0x9dae('0x7')](_0x216765)){return _0x216765;}if(_[_0x9dae('0x12')](_0x216765)){for(var _0x2163e6=0x0;_0x2163e6<_0x216765[_0x9dae('0x1d')];_0x2163e6+=0x1){_0x216765[_0x2163e6]=this['omit'](_0x216765[_0x2163e6],_0x189b17);}return _0x216765;}if(!_[_0x9dae('0x1e')](_0x216765)){return _0x216765;}if(_['isString'](_0x189b17)){_0x189b17=[_0x189b17];}if(!_['isArray'](_0x189b17)){return _0x216765;}for(var _0x2812c1=0x0;_0x2812c1<_0x189b17['length'];_0x2812c1+=0x1){_[_0x9dae('0x1f')](_0x216765,_0x189b17[_0x2812c1]);}for(var _0x4d8b2a in _0x216765){if(_0x216765[_0x9dae('0x20')](_0x4d8b2a)){_0x216765[_0x4d8b2a]=this[_0x9dae('0x1c')](_0x216765[_0x4d8b2a],_0x189b17);}}return _0x216765;};exports[_0x9dae('0x21')]=function(_0x39c662){return _0x39c662[_0x9dae('0x22')](RegExp(_0x9dae('0x23')))?!![]:![];};exports['isEmail']=function(_0x474858){return _0x474858['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x9632fc,_0x58ea82){var _0x40688c=[];var _0xb47e67=/[ `!@#$%^&*()_\-?~]/;var _0x22c515=_0x58ea82?_0x9dae('0x24'):'{EXPR}';_0x9632fc[_0x9dae('0x6')](/[ ,]+/)[_0x9dae('0x25')](function(_0x40463d){_0x40463d=_0x40463d[_0x9dae('0x26')](/([^:]")"+/g,'$1');_0x40463d='+'+_0x40463d+'*';var _0x31be80=_0x40463d[_0x9dae('0x22')](_0xb47e67);if(_0x31be80){_0x40463d='\x22'+_0x40463d+'\x22';}_0x40688c['push'](_0x40463d);});_0x22c515=_0x22c515[_0x9dae('0x26')](_0x9dae('0x27'),_0x40688c[_0x9dae('0x28')]('\x20'));return _0x22c515;};exports[_0x9dae('0x29')]=function(_0x3f4ac7,_0x55278b,_0x33cf87){var _0x3444d9={},_0x53edae={};if(_0x55278b['query'][_0x9dae('0x2a')]){_0x55278b['query']['id']=_0x55278b['query']['$id'];delete _0x55278b[_0x9dae('0x2b')][_0x9dae('0x2a')];}_0x3444d9['model']=_[_0x9dae('0x14')](_0x3f4ac7,_0x9dae('0x10'));_0x3444d9[_0x9dae('0x2b')]=_[_0x9dae('0x3')](_0x55278b['query']);_0x3444d9['filters']=_['intersection'](_0x3444d9[_0x9dae('0x2c')],_0x3444d9[_0x9dae('0x2b')]);_0x53edae[_0x9dae('0x2d')]=_[_0x9dae('0x2e')](_0x3444d9[_0x9dae('0x2c')],this[_0x9dae('0x5')](_0x55278b['query'][_0x9dae('0x5')]));_0x53edae[_0x9dae('0x2d')]=_0x53edae[_0x9dae('0x2d')][_0x9dae('0x1d')]?_0x53edae[_0x9dae('0x2d')]:_0x3444d9[_0x9dae('0x2c')];if(!_0x55278b[_0x9dae('0x2b')][_0x9dae('0x20')](_0x9dae('0x2f'))){_0x53edae[_0x9dae('0x13')]=this['limit'](_0x55278b['query'][_0x9dae('0x13')]);_0x53edae['offset']=this[_0x9dae('0x30')](_0x55278b[_0x9dae('0x2b')]['offset']);}_0x53edae[_0x9dae('0x31')]=this[_0x9dae('0x32')](_0x55278b[_0x9dae('0x2b')][_0x9dae('0x32')]);_0x53edae[_0x9dae('0x33')]=this[_0x9dae('0x34')](_[_0x9dae('0x35')](_0x55278b['query'],_0x3444d9[_0x9dae('0x34')]),_0x3f4ac7);if(_0x55278b[_0x9dae('0x2b')][_0x9dae('0x36')]){var _0x2e6d46=_0x3f4ac7;var _0x3bb092=_0x55278b[_0x9dae('0x2b')][_0x9dae('0x36')];if(typeof _0x3bb092===_0x9dae('0x37')){_0x2e6d46=_['filter'](_0x3f4ac7,function(_0x23be3f){return _[_0x9dae('0x4')](_0x3bb092[_0x9dae('0x38')],_0x23be3f[_0x9dae('0x10')]);});_0x3bb092=_0x3bb092['value'];}_0x53edae['where']=_['merge'](_0x53edae[_0x9dae('0x33')],{'$or':_[_0x9dae('0x14')](_0x2e6d46,function(_0x3f7291){if(_0x3f7291['type']!==_0x9dae('0x39')){if(_0x33cf87){return sequelize['where'](sequelize['fn']('lower',sequelize[_0x9dae('0x18')](_0x3f7291['name'])),{'$like':sequelize['fn']('lower','%'+_0x55278b['query'][_0x9dae('0x36')]+'%')});}else{var _0x58ad2c={};_0x58ad2c[_0x3f7291[_0x9dae('0x10')]]={'$like':'%'+_0x55278b[_0x9dae('0x2b')]['filter']+'%'};return _0x58ad2c;}}})});}_0x53edae=_[_0x9dae('0x3a')]({},_0x53edae,_0x55278b[_0x9dae('0x3b')]);return _0x53edae;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 7d76243..17fd5bc 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f5d=['sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','internal','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','smsStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','pick','value','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','whatsappPause','every','length','idle','ringing','isNil','voiceStatus','voicePause','chatStatus','mailStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','result','merge','catch','getRealtimeAgents','pause','*pause','getAgentStatus','isArray','startCase','map','findOne','all','flatten','uniq','includes','filter','busy','getAgentIdsByStatus','resolve','User','findAll','name','fullname','openchannelPause','smsPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','substring','indexOf','validateSortParameter','sort','toLowerCase'];(function(_0x33e2e5,_0x3db342){var _0xb39187=function(_0xae9b6b){while(--_0xae9b6b){_0x33e2e5['push'](_0x33e2e5['shift']());}};_0xb39187(++_0x3db342);}(_0x7f5d,0xe2));var _0xd7f5=function(_0x5147ea,_0x452737){_0x5147ea=_0x5147ea-0x0;var _0x4a1095=_0x7f5d[_0x5147ea];return _0x4a1095;};'use strict';var _=require(_0xd7f5('0x0'));var jayson=require(_0xd7f5('0x1'));var db=require(_0xd7f5('0x2'))['db'];var amiClient=jayson[_0xd7f5('0x3')][_0xd7f5('0x4')]({'port':0x232a});var routingClient=jayson[_0xd7f5('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x59c4e2,_0x42ce5e){var _0x4cb5c0=[_0x59c4e2[_0xd7f5('0x5')],_0x59c4e2[_0xd7f5('0x6')],_0x59c4e2[_0xd7f5('0x7')],_0x59c4e2['openchannelPause'],_0x59c4e2['smsPause'],_0x59c4e2['voicePause'],_0x59c4e2[_0xd7f5('0x8')]];if(!_0x42ce5e)return _[_0xd7f5('0x9')](_0x4cb5c0);var _0x4a0bd9=_['filter'](_0x4cb5c0);return _0x4a0bd9['length']>0x0&&_0x4a0bd9[_0xd7f5('0xa')]<_0x4cb5c0[_0xd7f5('0xa')]?!![]:![];}function isIdle(_0xee0fad){return _0xee0fad===_0xd7f5('0xb')||_0xee0fad==='unknown'||_0xee0fad==='unavailable'||_0xee0fad===_0xd7f5('0xc')||_[_0xd7f5('0xd')](_0xee0fad);}function isAgentIdle(_0x54d270){if(_0x54d270[_0xd7f5('0xe')]!=='idle'&&_0x54d270[_0xd7f5('0xf')]){_0x54d270[_0xd7f5('0xe')]='pause';return![];}return _[_0xd7f5('0x9')]([_0x54d270[_0xd7f5('0x10')],_0x54d270['faxStatus'],_0x54d270[_0xd7f5('0x11')],_0x54d270[_0xd7f5('0x12')],_0x54d270['smsStatus'],_0x54d270[_0xd7f5('0xe')],_0x54d270[_0xd7f5('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xd7f5('0x14')](_0xd7f5('0x15'),{})[_0xd7f5('0x16')](function(_0x3dd045){if(_0x3dd045[_0xd7f5('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0xc877ae=_0x3dd045[_0xd7f5('0x18')];return routingClient[_0xd7f5('0x14')](_0xd7f5('0x15'),{})[_0xd7f5('0x16')](function(_0x331aec){if(_0x331aec['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4fae01=_0x331aec[_0xd7f5('0x18')];return _[_0xd7f5('0x19')]({},_0xc877ae,_0x4fae01);});})[_0xd7f5('0x1a')](function(_0x383127){throw _0x383127;});}exports[_0xd7f5('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x26cd12){var _0x65d489='unknown';if(isAgentPaused(_0x26cd12))_0x65d489=_0xd7f5('0x1c');else if(isAgentPaused(_0x26cd12,!![]))_0x65d489=_0xd7f5('0x1d');else if(isAgentIdle(_0x26cd12))_0x65d489=_0xd7f5('0xb');else _0x65d489='busy';return _0x65d489;}exports[_0xd7f5('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x21d1a9,_0x791ec0){var _0x1f7850=_[_0xd7f5('0x1f')](_0x21d1a9)?_0x21d1a9:[_0x21d1a9];var _0x5db6f6=_[_0xd7f5('0x20')](_0x791ec0)+'Queue';var _0x559068=_[_0xd7f5('0x21')](_0x1f7850,function(_0x2fbd16){return db[_0x5db6f6][_0xd7f5('0x22')]({'where':{'id':_0x2fbd16}})[_0xd7f5('0x16')](function(_0x3690c0){if(!_0x3690c0)return[];return _0x3690c0['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xd7f5('0x23')](_0x559068)[_0xd7f5('0x16')](function(_0x456e9a){var _0x2cc279=_(_0x456e9a)[_0xd7f5('0x24')]()[_0xd7f5('0x21')]('id')[_0xd7f5('0x25')]()['value']();return _0x2cc279;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x248bb9,_0x587015,_0x366b85){try{if(_0x587015[_0xd7f5('0xa')]>0x0){_0x248bb9=_0x248bb9['filter'](function(_0x3d2887){return _0x587015[_0xd7f5('0x26')](_0x3d2887['id']);});}var _0x971011=_0x248bb9[_0xd7f5('0x27')](function(_0x1664d7){var _0x5dea44=_0xd7f5('0x28');if(isAgentIdle(_0x1664d7)){_0x5dea44=_0xd7f5('0xb');}return _0x5dea44===_0x366b85;});return _[_0xd7f5('0x21')](_0x971011,'id');}catch(_0x15a655){throw _0x15a655;}}exports[_0xd7f5('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x37db06,_0x2f866b,_0x7f9284){return Promise[_0xd7f5('0x2a')]()[_0xd7f5('0x16')](function(){if(_0x2f866b[_0xd7f5('0xa')]>0x0){_0x37db06=_0x37db06['filter'](function(_0x32d7c9){return _0x2f866b[_0xd7f5('0x26')](_0x32d7c9['id']);});}return _0x37db06;})[_0xd7f5('0x16')](function(){return db[_0xd7f5('0x2b')][_0xd7f5('0x2c')]({'attributes':['id',_0xd7f5('0x2d'),_0xd7f5('0x2e'),_0xd7f5('0x5'),_0xd7f5('0x6'),_0xd7f5('0x7'),_0xd7f5('0x2f'),_0xd7f5('0x30'),_0xd7f5('0xf'),'whatsappPause',_0xd7f5('0x31')],'where':{'id':{'$in':_[_0xd7f5('0x21')](_0x37db06,'id')}},'raw':!![]});})[_0xd7f5('0x16')](function(_0x1aff96){return _0x1aff96['map'](function(_0x30ec86){var _0x173215=_[_0xd7f5('0x32')](_0x37db06,['id',_0x30ec86['id']]);var _0x6cc01f=filterAgentAttributes(_0x173215);_[_0xd7f5('0x19')](_0x30ec86,_0x6cc01f);_0x30ec86[_0xd7f5('0x33')]=getAgentStatus(_0x30ec86);return _0x30ec86;});})['then'](function(_0x45fbc4){var _0x5c4665=sortAgentsByStatus(_0x45fbc4,_0x7f9284);return _[_0xd7f5('0x21')](_0x5c4665,'id');})[_0xd7f5('0x1a')](function(_0x1f4399){throw _0x1f4399;});}exports[_0xd7f5('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4b807d){var _0x59387f={'fields':[],'order':null};var _0x361cf4=_0x4b807d[_0xd7f5('0x35')](',');_0x59387f[_0xd7f5('0x36')]=_[_0xd7f5('0x27')](_0x361cf4,function(_0x5ddfb2){if(!_0x5ddfb2[_0xd7f5('0x26')]('globalStatus')){return!![];}_0x59387f[_0xd7f5('0x37')]=_[_0xd7f5('0x38')](_0x5ddfb2,'-')?_0xd7f5('0x39'):_0xd7f5('0x3a');return![];});return _0x59387f;}exports[_0xd7f5('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0xe3546a){if(_0xe3546a[_0xd7f5('0x26')](_0xd7f5('0x2e'))&&!_0xe3546a[_0xd7f5('0x26')]('internal')){var _0x97344a=_0xe3546a[_0xd7f5('0x3c')](0x0,_0xe3546a[_0xd7f5('0x3d')]('fullname'));_0xe3546a+=','+_0x97344a+'internal';}return _0xe3546a;}exports[_0xd7f5('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x5585fa,_0x37ec7a){var _0x35fa6e=_0x5585fa[_0xd7f5('0x3f')](function(_0x3c227b,_0x50b290){if(_0x3c227b[_0xd7f5('0x33')]===_0x50b290[_0xd7f5('0x33')]){if(_0x3c227b[_0xd7f5('0x33')]===_0xd7f5('0x1c')){if(_0x37ec7a===_0xd7f5('0x39')){return(_0x3c227b['pauseType']||'')<(_0x50b290[_0xd7f5('0x31')]||'')||_0x3c227b[_0xd7f5('0x2e')][_0xd7f5('0x40')]()>_0x50b290[_0xd7f5('0x2e')][_0xd7f5('0x40')]()?0x1:-0x1;}else{return(_0x3c227b['pauseType']||'')<(_0x50b290[_0xd7f5('0x31')]||'')||_0x3c227b[_0xd7f5('0x2e')][_0xd7f5('0x40')]()>_0x50b290[_0xd7f5('0x2e')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x37ec7a===_0xd7f5('0x39')){return _0x3c227b['fullname'][_0xd7f5('0x40')]()<_0x50b290[_0xd7f5('0x2e')][_0xd7f5('0x40')]()?0x1:-0x1;}else{return _0x3c227b['fullname']['toLowerCase']()<_0x50b290[_0xd7f5('0x2e')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x37ec7a===_0xd7f5('0x39')){return _0x3c227b[_0xd7f5('0x33')]<_0x50b290[_0xd7f5('0x33')]?0x1:-0x1;}else{return _0x3c227b[_0xd7f5('0x33')]<_0x50b290['globalStatus']?-0x1:0x1;}}});return _0x35fa6e;}exports[_0xd7f5('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x147fdd){var _0x2841cf=[_0xd7f5('0x42'),'online',_0xd7f5('0x43'),_0xd7f5('0x44'),_0xd7f5('0x31'),_0xd7f5('0x44'),_0xd7f5('0x45'),_0xd7f5('0x46'),_0xd7f5('0x5'),_0xd7f5('0x2f'),'mailPause','smsPause',_0xd7f5('0x8'),_0xd7f5('0x6'),_0xd7f5('0xf'),'chatCapacity',_0xd7f5('0x47'),_0xd7f5('0x48'),_0xd7f5('0x49'),_0xd7f5('0x4a'),_0xd7f5('0x4b'),_0xd7f5('0x4c'),_0xd7f5('0x4d'),_0xd7f5('0x4e'),_0xd7f5('0x4f'),'whatsappCurrentCapacity',_0xd7f5('0x50'),'chatStatus','openchannelStatus',_0xd7f5('0x11'),_0xd7f5('0x51'),_0xd7f5('0x13'),'faxStatus',_0xd7f5('0xe'),'chatStatusTime',_0xd7f5('0x52'),_0xd7f5('0x53'),_0xd7f5('0x54'),_0xd7f5('0x55'),_0xd7f5('0x56'),'voiceStatusTime',_0xd7f5('0x57'),_0xd7f5('0x58'),_0xd7f5('0x59'),_0xd7f5('0x5a'),_0xd7f5('0x5b'),_0xd7f5('0x5c')];var _0x4b3475=[_0xd7f5('0x5'),_0xd7f5('0x2f'),'mailPause',_0xd7f5('0x30'),_0xd7f5('0x8'),_0xd7f5('0x6'),_0xd7f5('0xf'),_0xd7f5('0x5d')];var _0x53723e=_(_0x147fdd)['omit'](_0x4b3475)[_0xd7f5('0x5e')](_0x2841cf)[_0xd7f5('0x5f')]();return _0x53723e;}exports[_0xd7f5('0x60')]=filterAgentAttributes; \ No newline at end of file +var _0xa516=['getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','map','getAgentIdsByStatus','resolve','User','findAll','name','fullname','openchannelPause','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','startsWith','ASC','getUpdatedSortOptions','indexOf','internal','validateSortParameter','toLowerCase','DESC','userpic','lastLoginAt','lastPauseAt','address','chatPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','faxStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','pick','filterAgentAttributes','jayson/promise','../../mysqldb','client','http','faxPause','mailPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','ringing','voiceStatus','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','findOne'];(function(_0x4de3ae,_0x4c2d83){var _0x264e7c=function(_0x183150){while(--_0x183150){_0x4de3ae['push'](_0x4de3ae['shift']());}};_0x264e7c(++_0x4c2d83);}(_0xa516,0x9b));var _0x6a51=function(_0x5b2181,_0x3a7b74){_0x5b2181=_0x5b2181-0x0;var _0x44c1a1=_0xa516[_0x5b2181];return _0x44c1a1;};'use strict';var _=require('lodash');var jayson=require(_0x6a51('0x0'));var db=require(_0x6a51('0x1'))['db'];var amiClient=jayson[_0x6a51('0x2')][_0x6a51('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x6a51('0x3')]({'port':0x232c});function isAgentPaused(_0x5d0dd7,_0x28cb86){var _0x14fb3c=[_0x5d0dd7['chatPause'],_0x5d0dd7[_0x6a51('0x4')],_0x5d0dd7[_0x6a51('0x5')],_0x5d0dd7['openchannelPause'],_0x5d0dd7[_0x6a51('0x6')],_0x5d0dd7[_0x6a51('0x7')],_0x5d0dd7[_0x6a51('0x8')]];if(!_0x28cb86)return _[_0x6a51('0x9')](_0x14fb3c);var _0x4a1245=_[_0x6a51('0xa')](_0x14fb3c);return _0x4a1245[_0x6a51('0xb')]>0x0&&_0x4a1245['length']<_0x14fb3c[_0x6a51('0xb')]?!![]:![];}function isIdle(_0x3db233){return _0x3db233===_0x6a51('0xc')||_0x3db233===_0x6a51('0xd')||_0x3db233==='unavailable'||_0x3db233===_0x6a51('0xe')||_['isNil'](_0x3db233);}function isAgentIdle(_0x3bfc0a){if(_0x3bfc0a[_0x6a51('0xf')]!=='idle'&&_0x3bfc0a[_0x6a51('0x7')]){_0x3bfc0a[_0x6a51('0xf')]='pause';return![];}return _[_0x6a51('0x9')]([_0x3bfc0a[_0x6a51('0x10')],_0x3bfc0a['faxStatus'],_0x3bfc0a[_0x6a51('0x11')],_0x3bfc0a[_0x6a51('0x12')],_0x3bfc0a[_0x6a51('0x13')],_0x3bfc0a[_0x6a51('0xf')],_0x3bfc0a[_0x6a51('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x6a51('0x15')]('Agents',{})['then'](function(_0x36068a){if(_0x36068a[_0x6a51('0x16')]){throw new Error(_0x6a51('0x17'));}var _0x113383=_0x36068a['result'];return routingClient[_0x6a51('0x15')](_0x6a51('0x18'),{})[_0x6a51('0x19')](function(_0x58c959){if(_0x58c959[_0x6a51('0x16')]){throw new Error(_0x6a51('0x1a'));}var _0x3cab8f=_0x58c959[_0x6a51('0x1b')];return _[_0x6a51('0x1c')]({},_0x113383,_0x3cab8f);});})['catch'](function(_0x45cd25){throw _0x45cd25;});}exports[_0x6a51('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x356f6a){var _0xb0ad64=_0x6a51('0xd');if(isAgentPaused(_0x356f6a))_0xb0ad64=_0x6a51('0x1e');else if(isAgentPaused(_0x356f6a,!![]))_0xb0ad64=_0x6a51('0x1f');else if(isAgentIdle(_0x356f6a))_0xb0ad64=_0x6a51('0xc');else _0xb0ad64=_0x6a51('0x20');return _0xb0ad64;}exports[_0x6a51('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x2fc3c2,_0x1ad246){var _0x5aecc9=_[_0x6a51('0x22')](_0x2fc3c2)?_0x2fc3c2:[_0x2fc3c2];var _0x2574de=_[_0x6a51('0x23')](_0x1ad246)+'Queue';var _0x336f9f=_['map'](_0x5aecc9,function(_0x40f600){return db[_0x2574de][_0x6a51('0x24')]({'where':{'id':_0x40f600}})[_0x6a51('0x19')](function(_0x1bdd16){if(!_0x1bdd16)return[];return _0x1bdd16[_0x6a51('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x6a51('0x26')](_0x336f9f)['then'](function(_0xbf00b2){var _0x553d41=_(_0xbf00b2)[_0x6a51('0x27')]()['map']('id')[_0x6a51('0x28')]()[_0x6a51('0x29')]();return _0x553d41;});}exports[_0x6a51('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1cc6e1,_0x341786,_0xb5e663){try{if(_0x341786[_0x6a51('0xb')]>0x0){_0x1cc6e1=_0x1cc6e1[_0x6a51('0xa')](function(_0x486466){return _0x341786[_0x6a51('0x2b')](_0x486466['id']);});}var _0x47a8ee=_0x1cc6e1['filter'](function(_0x19b0a7){var _0x3d620d=_0x6a51('0x20');if(isAgentIdle(_0x19b0a7)){_0x3d620d=_0x6a51('0xc');}return _0x3d620d===_0xb5e663;});return _[_0x6a51('0x2c')](_0x47a8ee,'id');}catch(_0x3e9159){throw _0x3e9159;}}exports[_0x6a51('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x22d513,_0x25c250,_0x390218){return Promise[_0x6a51('0x2e')]()[_0x6a51('0x19')](function(){if(_0x25c250[_0x6a51('0xb')]>0x0){_0x22d513=_0x22d513[_0x6a51('0xa')](function(_0x8e35c3){return _0x25c250[_0x6a51('0x2b')](_0x8e35c3['id']);});}return _0x22d513;})[_0x6a51('0x19')](function(){return db[_0x6a51('0x2f')][_0x6a51('0x30')]({'attributes':['id',_0x6a51('0x31'),_0x6a51('0x32'),'chatPause',_0x6a51('0x4'),_0x6a51('0x5'),_0x6a51('0x33'),_0x6a51('0x6'),_0x6a51('0x7'),_0x6a51('0x8'),_0x6a51('0x34')],'where':{'id':{'$in':_[_0x6a51('0x2c')](_0x22d513,'id')}},'raw':!![]});})[_0x6a51('0x19')](function(_0x5a8203){return _0x5a8203[_0x6a51('0x2c')](function(_0x106cf3){var _0x51162b=_[_0x6a51('0x35')](_0x22d513,['id',_0x106cf3['id']]);var _0x44266f=filterAgentAttributes(_0x51162b);_[_0x6a51('0x1c')](_0x106cf3,_0x44266f);_0x106cf3[_0x6a51('0x36')]=getAgentStatus(_0x106cf3);return _0x106cf3;});})[_0x6a51('0x19')](function(_0x15227e){var _0x8f9ed2=sortAgentsByStatus(_0x15227e,_0x390218);return _['map'](_0x8f9ed2,'id');})[_0x6a51('0x37')](function(_0x4e59f7){throw _0x4e59f7;});}exports[_0x6a51('0x38')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1b9d8c){var _0x22d977={'fields':[],'order':null};var _0xc0cf31=_0x1b9d8c[_0x6a51('0x39')](',');_0x22d977[_0x6a51('0x3a')]=_['filter'](_0xc0cf31,function(_0x2c1b83){if(!_0x2c1b83['includes']('globalStatus')){return!![];}_0x22d977[_0x6a51('0x3b')]=_[_0x6a51('0x3c')](_0x2c1b83,'-')?'DESC':_0x6a51('0x3d');return![];});return _0x22d977;}exports[_0x6a51('0x3e')]=getUpdatedSortOptions;function validateSortParameter(_0x20752d){if(_0x20752d[_0x6a51('0x2b')](_0x6a51('0x32'))&&!_0x20752d[_0x6a51('0x2b')]('internal')){var _0x38717=_0x20752d['substring'](0x0,_0x20752d[_0x6a51('0x3f')](_0x6a51('0x32')));_0x20752d+=','+_0x38717+_0x6a51('0x40');}return _0x20752d;}exports[_0x6a51('0x41')]=validateSortParameter;function sortAgentsByStatus(_0x309320,_0x3aee0c){var _0xefafec=_0x309320['sort'](function(_0x32945c,_0x5c260c){if(_0x32945c[_0x6a51('0x36')]===_0x5c260c[_0x6a51('0x36')]){if(_0x32945c[_0x6a51('0x36')]===_0x6a51('0x1e')){if(_0x3aee0c==='DESC'){return(_0x32945c[_0x6a51('0x34')]||'')<(_0x5c260c[_0x6a51('0x34')]||'')||_0x32945c[_0x6a51('0x32')]['toLowerCase']()>_0x5c260c[_0x6a51('0x32')][_0x6a51('0x42')]()?0x1:-0x1;}else{return(_0x32945c[_0x6a51('0x34')]||'')<(_0x5c260c[_0x6a51('0x34')]||'')||_0x32945c[_0x6a51('0x32')][_0x6a51('0x42')]()>_0x5c260c[_0x6a51('0x32')][_0x6a51('0x42')]()?-0x1:0x1;}}else{if(_0x3aee0c===_0x6a51('0x43')){return _0x32945c[_0x6a51('0x32')]['toLowerCase']()<_0x5c260c['fullname'][_0x6a51('0x42')]()?0x1:-0x1;}else{return _0x32945c[_0x6a51('0x32')][_0x6a51('0x42')]()<_0x5c260c[_0x6a51('0x32')][_0x6a51('0x42')]()?-0x1:0x1;}}}else{if(_0x3aee0c===_0x6a51('0x43')){return _0x32945c[_0x6a51('0x36')]<_0x5c260c[_0x6a51('0x36')]?0x1:-0x1;}else{return _0x32945c[_0x6a51('0x36')]<_0x5c260c['globalStatus']?-0x1:0x1;}}});return _0xefafec;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x5d920c){var _0x593e86=[_0x6a51('0x44'),'online',_0x6a51('0x45'),'lastPauseAt','pauseType',_0x6a51('0x46'),_0x6a51('0x40'),_0x6a51('0x47'),_0x6a51('0x48'),'openchannelPause',_0x6a51('0x5'),'smsPause',_0x6a51('0x8'),'faxPause',_0x6a51('0x7'),_0x6a51('0x49'),_0x6a51('0x4a'),_0x6a51('0x4b'),_0x6a51('0x4c'),_0x6a51('0x4d'),_0x6a51('0x4e'),'chatCurrentCapacity',_0x6a51('0x4f'),_0x6a51('0x50'),_0x6a51('0x51'),'whatsappCurrentCapacity',_0x6a51('0x52'),_0x6a51('0x10'),_0x6a51('0x12'),_0x6a51('0x11'),_0x6a51('0x13'),'whatsappStatus',_0x6a51('0x53'),_0x6a51('0xf'),'chatStatusTime',_0x6a51('0x54'),_0x6a51('0x55'),_0x6a51('0x56'),'whatsappStatusTime',_0x6a51('0x57'),_0x6a51('0x58'),'queue','destconnectedlinenum',_0x6a51('0x59'),'phoneBarEnableScreenRecordingByAgent',_0x6a51('0x5a'),_0x6a51('0x5b')];var _0x32855b=[_0x6a51('0x48'),_0x6a51('0x33'),_0x6a51('0x5'),_0x6a51('0x6'),_0x6a51('0x8'),_0x6a51('0x4'),_0x6a51('0x7'),_0x6a51('0x5c')];var _0xb13509=_(_0x5d920c)[_0x6a51('0x5d')](_0x32855b)[_0x6a51('0x5e')](_0x593e86)[_0x6a51('0x29')]();return _0xb13509;}exports[_0x6a51('0x5f')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 030427a..78cd02f 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce13=['unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','startCase','Queues','then','format','result','catch','voice','inbound','concat','outbound','map','get','waiting','busy','find','merge','pick','initializeQueues','lodash','jayson/promise','client','http','available','loggedIn','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable'];(function(_0x361e5d,_0x15e1a4){var _0x4c303d=function(_0x504f9f){while(--_0x504f9f){_0x361e5d['push'](_0x361e5d['shift']());}};_0x4c303d(++_0x15e1a4);}(_0xce13,0x91));var _0x3ce1=function(_0x2e96d8,_0x3d2edc){_0x2e96d8=_0x2e96d8-0x0;var _0x4437f4=_0xce13[_0x2e96d8];return _0x4437f4;};'use strict';var _=require(_0x3ce1('0x0'));var jayson=require(_0x3ce1('0x1'));var util=require('util');var amiClient=jayson[_0x3ce1('0x2')][_0x3ce1('0x3')]({'port':0x232a});var routingClient=jayson[_0x3ce1('0x2')][_0x3ce1('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x3ce1('0x4'),_0x3ce1('0x5'),'paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x3ce1('0x6'),_0x3ce1('0x7'),_0x3ce1('0x8'),_0x3ce1('0x9'),_0x3ce1('0xa'),_0x3ce1('0xb'),_0x3ce1('0xc'),_0x3ce1('0xd'),_0x3ce1('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x3ce1('0xf'),_0x3ce1('0x10'),_0x3ce1('0x11'),_0x3ce1('0x12'),_0x3ce1('0x13'),_0x3ce1('0x14'),_0x3ce1('0x15'),_0x3ce1('0x16'),_0x3ce1('0x17'),_0x3ce1('0x18'),_0x3ce1('0x19'),_0x3ce1('0x1a'),_0x3ce1('0x1b'),_0x3ce1('0x1c'),_0x3ce1('0x1d'),'dialPredictiveIntervalMinThreshold',_0x3ce1('0x1e'),_0x3ce1('0x1f'),_0x3ce1('0x20'),_0x3ce1('0x21'),'predictiveIntervalDroppedCallsCallersExit',_0x3ce1('0x22'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x8da197,_0x38cebd){var _0x5a19db=_0x38cebd==='voice'?amiClient:routingClient;return _0x5a19db['request'](_[_0x3ce1('0x23')](_0x38cebd)+_0x3ce1('0x24'),_0x8da197)[_0x3ce1('0x25')](function(_0x5cbcb4){if(_0x5cbcb4['error'])throw new Error(util[_0x3ce1('0x26')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x38cebd));return _0x5cbcb4[_0x3ce1('0x27')];})[_0x3ce1('0x28')](function(_0x32f336){throw _0x32f336;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0xcbf856,_0x502a73,_0x4d6b08,_0x20a50d){var _0x40741a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4d6b08===_0x3ce1('0x29')){if(_0x20a50d===_0x3ce1('0x2a')){_0x40741a=_0x40741a[_0x3ce1('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x20a50d===_0x3ce1('0x2c')){_0x40741a=_0x40741a[_0x3ce1('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xcbf856[_0x3ce1('0x2d')](function(_0x4dad00){var _0x3962ee=_0x4dad00[_0x3ce1('0x2e')]({'plain':!![]});_0x3962ee['paused']=0x0;_0x3962ee[_0x3ce1('0x7')]=0x0;_0x3962ee[_0x3ce1('0x5')]=0x0;_0x3962ee[_0x3ce1('0x4')]=0x0;_0x3962ee[_0x3ce1('0x2f')]=0x0;if(_0x4d6b08===_0x3ce1('0x29')){_0x3962ee['talking']=0x0;_0x3962ee[_0x3ce1('0x30')]=0x0;if(_0x20a50d===_0x3ce1('0x2c')){_0x3962ee[_0x3ce1('0xf')]=0x0;_0x3962ee[_0x3ce1('0x10')]=0x0;}}var _0x20c28d=_[_0x3ce1('0x31')](_0x502a73,['id',_0x3962ee['id']]);if(_0x20c28d){_[_0x3ce1('0x32')](_0x3962ee,_[_0x3ce1('0x33')](_0x20c28d,_0x40741a));}return _0x3962ee;});}exports[_0x3ce1('0x34')]=initializeQueues; \ No newline at end of file +var _0x37af=['http','available','loggedIn','paused','waiting','busy','inUse','loggedInDb','onHold','ringing','ringInUse','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','get','talking','find','merge','initializeQueues','lodash','jayson/promise','util','client'];(function(_0x201b28,_0x4c430e){var _0x24156b=function(_0x1ccc8c){while(--_0x1ccc8c){_0x201b28['push'](_0x201b28['shift']());}};_0x24156b(++_0x4c430e);}(_0x37af,0x1e6));var _0xf37a=function(_0x3a91d8,_0x4922c3){_0x3a91d8=_0x3a91d8-0x0;var _0x2ef3a1=_0x37af[_0x3a91d8];return _0x2ef3a1;};'use strict';var _=require(_0xf37a('0x0'));var jayson=require(_0xf37a('0x1'));var util=require(_0xf37a('0x2'));var amiClient=jayson[_0xf37a('0x3')][_0xf37a('0x4')]({'port':0x232a});var routingClient=jayson[_0xf37a('0x3')][_0xf37a('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xf37a('0x5'),_0xf37a('0x6'),_0xf37a('0x7'),_0xf37a('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0xf37a('0x9'),_0xf37a('0xa'),'invalid',_0xf37a('0xb'),'notInUse',_0xf37a('0xc'),_0xf37a('0xd'),_0xf37a('0xe'),'talking',_0xf37a('0xf'),_0xf37a('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xf37a('0x11'),_0xf37a('0x12'),_0xf37a('0x13'),_0xf37a('0x14'),_0xf37a('0x15'),_0xf37a('0x16'),'Trunk',_0xf37a('0x17'),_0xf37a('0x18'),'erlangCalls',_0xf37a('0x19'),'erlangAbandonmentRate',_0xf37a('0x1a'),_0xf37a('0x1b'),'dialPredictiveIntervalMaxThreshold',_0xf37a('0x1c'),_0xf37a('0x1d'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xf37a('0x1e'),_0xf37a('0x1f'),_0xf37a('0x20')];function getRealtimeQueues(_0x35c5c1,_0x2df6c2){var _0xac8586=_0x2df6c2===_0xf37a('0x21')?amiClient:routingClient;return _0xac8586[_0xf37a('0x22')](_[_0xf37a('0x23')](_0x2df6c2)+_0xf37a('0x24'),_0x35c5c1)['then'](function(_0x1377b7){if(_0x1377b7[_0xf37a('0x25')])throw new Error(util['format'](_0xf37a('0x26'),_0x2df6c2));return _0x1377b7[_0xf37a('0x27')];})[_0xf37a('0x28')](function(_0xa13bbd){throw _0xa13bbd;});}exports[_0xf37a('0x29')]=getRealtimeQueues;function initializeQueues(_0x56df59,_0x26fb7a,_0x45ed49,_0xcb7811){var _0x24e062=DEFAULT_QUEUE_ATTRIBUTES;if(_0x45ed49===_0xf37a('0x21')){if(_0xcb7811===_0xf37a('0x2a')){_0x24e062=_0x24e062['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0xcb7811==='outbound'){_0x24e062=_0x24e062[_0xf37a('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x56df59['map'](function(_0x42aab8){var _0x372001=_0x42aab8[_0xf37a('0x2c')]({'plain':!![]});_0x372001['paused']=0x0;_0x372001[_0xf37a('0xb')]=0x0;_0x372001[_0xf37a('0x6')]=0x0;_0x372001['available']=0x0;_0x372001[_0xf37a('0x8')]=0x0;if(_0x45ed49===_0xf37a('0x21')){_0x372001[_0xf37a('0x2d')]=0x0;_0x372001[_0xf37a('0x9')]=0x0;if(_0xcb7811==='outbound'){_0x372001[_0xf37a('0x11')]=0x0;_0x372001[_0xf37a('0x12')]=0x0;}}var _0x4c430e=_[_0xf37a('0x2e')](_0x26fb7a,['id',_0x372001['id']]);if(_0x4c430e){_[_0xf37a('0x2f')](_0x372001,_['pick'](_0x4c430e,_0x24e062));}return _0x372001;});}exports[_0xf37a('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 3473148..f374866 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b81ce24..d531886 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 _0xb26a=['hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','md5','substring','crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','keys','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','map','model','join','update','digest'];(function(_0x5a7676,_0x1dd3b9){var _0x140d86=function(_0x218c90){while(--_0x218c90){_0x5a7676['push'](_0x5a7676['shift']());}};_0x140d86(++_0x1dd3b9);}(_0xb26a,0x11e));var _0xab26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb26a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xab26('0x0'));var machine=require(_0xab26('0x1'));var exec=require(_0xab26('0x2'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x4077f8=[];var _0x15f8c1=os[_0xab26('0x3')]();var _0x115e42=_[_0xab26('0x4')](_[_0xab26('0x5')](_0x15f8c1));for(var _0x1286ac=0x0;_0x1286ac<_0x115e42['length'];_0x1286ac++){var _0x27ef3c=_0x15f8c1[_0x115e42[_0x1286ac]][_0xab26('0x6')](function(_0x131afb){return _0x131afb[_0xab26('0x7')]===_0xab26('0x8')&&_0x131afb[_0xab26('0x9')]===![];});_0x4077f8=_0x4077f8['concat'](_0x27ef3c);}return _0x4077f8;}function getFirstInterface(){var _0x44d3f8=_[_0xab26('0xa')](getInterfaces());return{'macAddress':_0x44d3f8&&_0x44d3f8[_0xab26('0xb')]?_0x44d3f8['mac']:_0xab26('0xc'),'ipAddress':_0x44d3f8&&_0x44d3f8['address']?_0x44d3f8['address']:_0xab26('0xd')};}exports[_0xab26('0xe')]=getFirstInterface;function getCPUhash(){var _0x193082=_['orderBy'](os['cpus']()[_0xab26('0xf')](function(_0x155a7d){return _0x155a7d[_0xab26('0x10')];}))[_0xab26('0x11')](':');return crypto['createHash']('md5')[_0xab26('0x12')](_0x193082)[_0xab26('0x13')](_0xab26('0x14'));}exports[_0xab26('0x15')]=function(){var _0x11c62e=os['platform']();var _0x1c1954=/[0-9a-f-]{36}/;if(config[_0xab26('0x16')]&&_0x1c1954[_0xab26('0x17')](config[_0xab26('0x16')])){return config[_0xab26('0x16')];}else if(_0x11c62e===_0xab26('0x18')){return exec(_0xab26('0x19'),{'encoding':_0xab26('0x1a')})[_0xab26('0x1b')]('\x0d\x0a','');}else{var _0x23ea3e=getFirstInterface();var _0xff5b8a=getCPUhash();var _0x27d779=_0xff5b8a+'|'+os[_0xab26('0x1c')]()+'|'+_0x23ea3e[_0xab26('0x1d')]+'|'+_0x23ea3e[_0xab26('0x1e')];var _0x135c8e=crypto[_0xab26('0x1f')](_0xab26('0x20'))[_0xab26('0x12')](_0x27d779)[_0xab26('0x13')](_0xab26('0x14'));return _0x135c8e[_0xab26('0x21')](0x0,0x8)+'-'+_0x135c8e['substring'](0x8,0xc)+'-'+_0x135c8e[_0xab26('0x21')](0xc,0x10)+'-'+_0x135c8e['substring'](0x10,0x14)+'-'+_0x135c8e['substring'](0x14);}}; \ No newline at end of file +var _0x40ae=['utf8','replace','hostname','ipAddress','digest','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','length','filter','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','createHash','md5','update','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x40ae,0xd3));var _0xe40a=function(_0x327a17,_0x300298){_0x327a17=_0x327a17-0x0;var _0x1df851=_0x40ae[_0x327a17];return _0x1df851;};'use strict';var _=require(_0xe40a('0x0'));var os=require('os');var crypto=require(_0xe40a('0x1'));var machine=require(_0xe40a('0x2'));var exec=require(_0xe40a('0x3'))['execSync'];var config=require(_0xe40a('0x4'));function getInterfaces(){var _0x4381a4=[];var _0x129f0b=os['networkInterfaces']();var _0x22cedd=_['orderBy'](_['keys'](_0x129f0b));for(var _0x533a0e=0x0;_0x533a0e<_0x22cedd[_0xe40a('0x5')];_0x533a0e++){var _0x15d49d=_0x129f0b[_0x22cedd[_0x533a0e]][_0xe40a('0x6')](function(_0x3a0d14){return _0x3a0d14['family']==='IPv4'&&_0x3a0d14['internal']===![];});_0x4381a4=_0x4381a4[_0xe40a('0x7')](_0x15d49d);}return _0x4381a4;}function getFirstInterface(){var _0x19b5a6=_[_0xe40a('0x8')](getInterfaces());return{'macAddress':_0x19b5a6&&_0x19b5a6['mac']?_0x19b5a6[_0xe40a('0x9')]:_0xe40a('0xa'),'ipAddress':_0x19b5a6&&_0x19b5a6[_0xe40a('0xb')]?_0x19b5a6['address']:_0xe40a('0xc')};}exports[_0xe40a('0xd')]=getFirstInterface;function getCPUhash(){var _0x117425=_[_0xe40a('0xe')](os[_0xe40a('0xf')]()[_0xe40a('0x10')](function(_0x1ca607){return _0x1ca607[_0xe40a('0x11')];}))['join'](':');return crypto[_0xe40a('0x12')](_0xe40a('0x13'))[_0xe40a('0x14')](_0x117425)['digest']('hex');}exports[_0xe40a('0x15')]=function(){var _0x3e9bbf=os[_0xe40a('0x16')]();var _0x334d62=/[0-9a-f-]{36}/;if(config[_0xe40a('0x17')]&&_0x334d62[_0xe40a('0x18')](config['licenseToken'])){return config[_0xe40a('0x17')];}else if(_0x3e9bbf===_0xe40a('0x19')){return exec(_0xe40a('0x1a'),{'encoding':_0xe40a('0x1b')})[_0xe40a('0x1c')]('\x0d\x0a','');}else{var _0x5e8734=getFirstInterface();var _0x2ce887=getCPUhash();var _0xc0c731=_0x2ce887+'|'+os[_0xe40a('0x1d')]()+'|'+_0x5e8734['macAddress']+'|'+_0x5e8734[_0xe40a('0x1e')];var _0x219823=crypto[_0xe40a('0x12')](_0xe40a('0x13'))[_0xe40a('0x14')](_0xc0c731)[_0xe40a('0x1f')](_0xe40a('0x20'));return _0x219823[_0xe40a('0x21')](0x0,0x8)+'-'+_0x219823['substring'](0x8,0xc)+'-'+_0x219823[_0xe40a('0x21')](0xc,0x10)+'-'+_0x219823['substring'](0x10,0x14)+'-'+_0x219823['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a5ff4fb..5d290aa 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 _0xdc05=['update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','pkginfo','version','../../mysqldb','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','catch','get','data1','data2','then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0xdc05,0x8a));var _0x5dc0=function(_0x3dd4cc,_0x12bed4){_0x3dd4cc=_0x3dd4cc-0x0;var _0x5de536=_0xdc05[_0x3dd4cc];return _0x5de536;};'use strict';var util=require('util');var moment=require(_0x5dc0('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x5dc0('0x1'))(module,_0x5dc0('0x2'));var db=require(_0x5dc0('0x3'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x5dc0('0x4'));var logger=require(_0x5dc0('0x5'))('license');var HOST=_0x5dc0('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x324b19){return new BPromise(function(_0x4e3fa9,_0x2b4c1c){var _0x59c8fa=util[_0x5dc0('0x7')](_0x5dc0('0x8'),HOST,_0x324b19,module['exports'][_0x5dc0('0x2')]);if(oldToken){_0x59c8fa=util['format'](_0x5dc0('0x9'),HOST,_0x324b19,module[_0x5dc0('0xa')][_0x5dc0('0x2')],oldToken);}var _0x4c7d16={'uri':_0x59c8fa,'method':_0x5dc0('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x4c7d16)['then'](function(_0x19a845){_0x4e3fa9(_0x19a845);})[_0x5dc0('0xc')](function(_0x1814a2){_0x2b4c1c(_0x1814a2);});});}function manageLicense(_0x473fa4,_0x301553){var _0x58648c=_0x301553[_0x5dc0('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x58648c[_0x5dc0('0xe')]!==_0x473fa4&&!_0x58648c[_0x5dc0('0xf')]){oldToken=_0x58648c['data1'];}httpRequest(_0x473fa4)[_0x5dc0('0x10')](function(_0x5dde97){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5dde97[_0x5dc0('0x11')]){isOldTokenSent=![];if(!_0x58648c[_0x5dc0('0x12')]&&_0x58648c[_0x5dc0('0x12')]!=_0x5dde97[_0x5dc0('0x12')]||_0x58648c['license']&&_0x58648c[_0x5dc0('0xf')]){logger[_0x5dc0('0x13')](_0x5dc0('0x14'));}if(_0x58648c[_0x5dc0('0x12')]&&!_0x58648c[_0x5dc0('0xf')]&&_0x58648c[_0x5dc0('0x12')]!=_0x5dde97[_0x5dc0('0x12')]){logger[_0x5dc0('0x13')](_0x5dc0('0x15'));}if(_0x58648c[_0x5dc0('0x12')]&&!_0x58648c[_0x5dc0('0xf')]&&_0x58648c['license']==_0x5dde97['license']){return _0x301553;}return _0x301553[_0x5dc0('0x16')]({'data1':_0x473fa4,'data2':null,'license':_0x5dde97[_0x5dc0('0x12')]});}else{if(_0x5dde97[_0x5dc0('0x12')]||_0x58648c['license']){if(!_0x58648c[_0x5dc0('0xf')]){if(_0x58648c[_0x5dc0('0xe')]==_0x473fa4){GRAY_PERIOD_REASON=_0x5dc0('0x17');logger['info'](_0x5dc0('0x18'));}else{GRAY_PERIOD_REASON=_0x5dc0('0x19');logger[_0x5dc0('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x58648c[_0x5dc0('0xe')],_0x473fa4);}logger[_0x5dc0('0x13')](_0x5dc0('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x5dc0('0x1b')));return _0x301553['update']({'data2':encryptor[_0x5dc0('0x1c')](moment()[_0x5dc0('0x7')](_0x5dc0('0x1b')))});}else{if(moment()[_0x5dc0('0x1d')](encryptor[_0x5dc0('0x1e')](_0x58648c[_0x5dc0('0xf')]),_0x5dc0('0x1f'))>DAYS){logger['info'](_0x5dc0('0x20'),moment()[_0x5dc0('0x7')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x301553[_0x5dc0('0x16')]({'data1':_0x473fa4,'data2':null,'license':null});}}}else{if(_0x58648c[_0x5dc0('0xe')]!=_0x473fa4){logger[_0x5dc0('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x58648c[_0x5dc0('0xe')],_0x473fa4);return _0x301553[_0x5dc0('0x16')]({'data1':_0x473fa4,'data2':null,'license':null});}}}return _0x301553;})[_0x5dc0('0x10')](function(_0x139625){_0x301553=_0x139625;})[_0x5dc0('0xc')](function(_0x3521ff){logger[_0x5dc0('0x21')](_0x3521ff[_0x5dc0('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x5dc0('0x23')](),_0x301553);},TIME);});}function defaultLicense(){var _0x1b5dba=hardware['getUuid']();if(_0x1b5dba){return db['License'][_0x5dc0('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x1b5dba}})[_0x5dc0('0x25')](function(_0x2af9fd,_0x2e568b){logger[_0x5dc0('0x13')](_0x5dc0('0x26'),_0x1b5dba);manageLicense(_0x1b5dba,_0x2af9fd);})[_0x5dc0('0xc')](function(_0x2e586e){logger[_0x5dc0('0x21')](_0x2e586e[_0x5dc0('0x22')]);});}}exports[_0x5dc0('0x27')]=defaultLicense; \ No newline at end of file +var _0xa0c3=['findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','then','catch','get','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','getUuid','License'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0xa0c3,0x123));var _0x3a0c=function(_0x27c819,_0x4084b5){_0x27c819=_0x27c819-0x0;var _0x33b620=_0xa0c3[_0x27c819];return _0x33b620;};'use strict';var util=require(_0x3a0c('0x0'));var moment=require(_0x3a0c('0x1'));var rp=require('request-promise');var BPromise=require(_0x3a0c('0x2'));var pkginfo=require('pkginfo')(module,_0x3a0c('0x3'));var db=require(_0x3a0c('0x4'))['db'];var encryptor=require(_0x3a0c('0x5'));var hardware=require(_0x3a0c('0x6'));var logger=require(_0x3a0c('0x7'))('license');var HOST=_0x3a0c('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x185b75){return new BPromise(function(_0x4307f6,_0x5c000f){var _0x35947b=util[_0x3a0c('0x9')](_0x3a0c('0xa'),HOST,_0x185b75,module['exports'][_0x3a0c('0x3')]);if(oldToken){_0x35947b=util[_0x3a0c('0x9')](_0x3a0c('0xb'),HOST,_0x185b75,module[_0x3a0c('0xc')]['version'],oldToken);}var _0x48649e={'uri':_0x35947b,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x48649e)[_0x3a0c('0xd')](function(_0x298a4a){_0x4307f6(_0x298a4a);})[_0x3a0c('0xe')](function(_0x20ffed){_0x5c000f(_0x20ffed);});});}function manageLicense(_0x53adeb,_0x5e777){var _0x3dad1f=_0x5e777[_0x3a0c('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x3dad1f[_0x3a0c('0x10')]!==_0x53adeb&&!_0x3dad1f[_0x3a0c('0x11')]){oldToken=_0x3dad1f['data1'];}httpRequest(_0x53adeb)[_0x3a0c('0xd')](function(_0x42129a){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x42129a[_0x3a0c('0x12')]){isOldTokenSent=![];if(!_0x3dad1f[_0x3a0c('0x13')]&&_0x3dad1f[_0x3a0c('0x13')]!=_0x42129a[_0x3a0c('0x13')]||_0x3dad1f[_0x3a0c('0x13')]&&_0x3dad1f['data2']){logger[_0x3a0c('0x14')](_0x3a0c('0x15'));}if(_0x3dad1f[_0x3a0c('0x13')]&&!_0x3dad1f['data2']&&_0x3dad1f[_0x3a0c('0x13')]!=_0x42129a[_0x3a0c('0x13')]){logger[_0x3a0c('0x14')](_0x3a0c('0x16'));}if(_0x3dad1f[_0x3a0c('0x13')]&&!_0x3dad1f[_0x3a0c('0x11')]&&_0x3dad1f[_0x3a0c('0x13')]==_0x42129a[_0x3a0c('0x13')]){return _0x5e777;}return _0x5e777[_0x3a0c('0x17')]({'data1':_0x53adeb,'data2':null,'license':_0x42129a[_0x3a0c('0x13')]});}else{if(_0x42129a[_0x3a0c('0x13')]||_0x3dad1f[_0x3a0c('0x13')]){if(!_0x3dad1f[_0x3a0c('0x11')]){if(_0x3dad1f[_0x3a0c('0x10')]==_0x53adeb){GRAY_PERIOD_REASON='Disabled';logger[_0x3a0c('0x14')](_0x3a0c('0x18'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x3a0c('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3dad1f['data1'],_0x53adeb);}logger[_0x3a0c('0x14')](_0x3a0c('0x19'),GRAY_PERIOD_REASON[_0x3a0c('0x1a')](),moment()[_0x3a0c('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x5e777[_0x3a0c('0x17')]({'data2':encryptor[_0x3a0c('0x1b')](moment()[_0x3a0c('0x9')](_0x3a0c('0x1c')))});}else{if(moment()[_0x3a0c('0x1d')](encryptor[_0x3a0c('0x1e')](_0x3dad1f[_0x3a0c('0x11')]),_0x3a0c('0x1f'))>DAYS){logger[_0x3a0c('0x14')](_0x3a0c('0x20'),moment()[_0x3a0c('0x9')](_0x3a0c('0x1c')));isOldTokenSent=![];return _0x5e777[_0x3a0c('0x17')]({'data1':_0x53adeb,'data2':null,'license':null});}}}else{if(_0x3dad1f[_0x3a0c('0x10')]!=_0x53adeb){logger[_0x3a0c('0x14')](_0x3a0c('0x21'),_0x3dad1f[_0x3a0c('0x10')],_0x53adeb);return _0x5e777['update']({'data1':_0x53adeb,'data2':null,'license':null});}}}return _0x5e777;})['then'](function(_0x1fceb9){_0x5e777=_0x1fceb9;})['catch'](function(_0x1133bc){logger['error'](_0x1133bc[_0x3a0c('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5e777);},TIME);});}function defaultLicense(){var _0x1d3e31=hardware[_0x3a0c('0x23')]();if(_0x1d3e31){return db[_0x3a0c('0x24')][_0x3a0c('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x1d3e31}})['spread'](function(_0x850028,_0x258b75){logger['info'](_0x3a0c('0x26'),_0x1d3e31);manageLicense(_0x1d3e31,_0x850028);})[_0x3a0c('0xe')](function(_0x5181d6){logger[_0x3a0c('0x27')](_0x5181d6[_0x3a0c('0x22')]);});}}exports[_0x3a0c('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 537f11a..e028f7e 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 _0xf27e=['disabled','message','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','catch','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','uuid','data1','isEmpty','data2','split','decryptString','format','parse','demo','machineUuid','gray','deadline','add','grayReason'];(function(_0xd2bdec,_0x4ef17e){var _0x55cca1=function(_0x2c9917){while(--_0x2c9917){_0xd2bdec['push'](_0xd2bdec['shift']());}};_0x55cca1(++_0x4ef17e);}(_0xf27e,0xc5));var _0xef27=function(_0x1d485c,_0x7f37d){_0x1d485c=_0x1d485c-0x0;var _0x2e1e16=_0xf27e[_0x1d485c];return _0x2e1e16;};'use strict';var util=require(_0xef27('0x0'));var _=require(_0xef27('0x1'));var moment=require(_0xef27('0x2'));var BPromise=require(_0xef27('0x3'));var hardware=require(_0xef27('0x4'));var encryptor=require(_0xef27('0x5'));var db=require(_0xef27('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xef27('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xef27('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xef27('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x9c7bb7){return new BPromise(function(_0x4e7ba6,_0x4af0e5){return db[_0xef27('0xa')][_0xef27('0xb')](_[_0xef27('0xc')](_0x9c7bb7,{'raw':!![],'where':{'id':0x1}}))[_0xef27('0xd')](function(_0x410423){return checkLicense(_0x410423,null);})[_0xef27('0xd')](function(_0xddc2a1){_0x4e7ba6(_0xddc2a1);return;})['catch'](function(_0x310876){_0x4af0e5(_0x310876);});});}function checkLicense(_0x10ac3c,_0x418ce8){if(!_0x10ac3c){demoLicense[_0xef27('0xe')]=_0x10ac3c[_0xef27('0xf')];return demoLicense;}try{var _0x586ada=_0x418ce8||_0x10ac3c['license'];if(_[_0xef27('0x10')](_0x586ada)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x4063db=_0x10ac3c[_0xef27('0xf')];var _0x41beae=_0x10ac3c[_0xef27('0x11')];var _0x1edf1e=_0x4063db[_0xef27('0x12')]('-')[0x4];var _0x1d0910=_0x4063db[_0xef27('0x12')]('-')[0x0];var _0x1ad6d8=encryptor[_0xef27('0x13')](_0x586ada,util[_0xef27('0x14')]('%s:%s:%s',_0x1edf1e,_0x4063db,_0x1d0910));var _0x4e4abd=JSON[_0xef27('0x15')](_0x1ad6d8);_0x4e4abd[_0xef27('0x16')]=![];_0x4e4abd[_0xef27('0xe')]=_0x4063db;_0x4e4abd[_0xef27('0x17')]=hardware[_0xef27('0x7')]();if(_0x41beae){var _0x5c1386=encryptor[_0xef27('0x13')](_0x41beae);_0x4e4abd[_0xef27('0x18')]=_0x5c1386;_0x4e4abd[_0xef27('0x19')]=moment(_0x5c1386)[_0xef27('0x1a')](0x7,'days')[_0xef27('0x14')]();_0x4e4abd[_0xef27('0x1b')]=_0x4e4abd[_0xef27('0xe')]!=_0x4e4abd[_0xef27('0x17')]?'changed':_0xef27('0x1c');}return _0x4e4abd;}catch(_0x15f155){breakingLicense['uuid']=_0x10ac3c[_0xef27('0xf')];breakingLicense[_0xef27('0x1d')]=_0x15f155[_0xef27('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5890c9,_0x3892e6){getLicense()['then'](function(_0x5dc152){return db['User'][_0xef27('0x1e')]({'attributes':[_0xef27('0x1f'),[db[_0xef27('0x20')]['fn'](_0xef27('0x21'),db[_0xef27('0x20')][_0xef27('0x22')](_0xef27('0x1f'))),_0xef27('0x23')]],'group':_0xef27('0x1f'),'where':{'role':{'$or':[_0xef27('0x24'),_0xef27('0x25'),_0xef27('0x26')]}},'raw':!![]})[_0xef27('0xd')](function(_0x3b216f){var _0x31122d={'user':_0x5dc152[_0xef27('0x27')]||0x0,'telephone':_0x5dc152[_0xef27('0x28')]||0x0};_0x3b216f[_0xef27('0x29')](function(_0xe465e){var _0x473db1=_0xe465e[_0xef27('0x1f')]===_0xef27('0x24')?_0xef27('0x25'):_0xe465e[_0xef27('0x1f')];_0x31122d[_0x473db1]-=_0xe465e[_0xef27('0x23')];if(_0x31122d[_0x473db1]<0x0)_0x31122d[_0x473db1]=0x0;});_0x5890c9(_0x31122d);return;});})[_0xef27('0x2a')](function(_0x37b331){_0x3892e6(_0x37b331);});});}function checkUserLimits(_0x5aa1af){return new BPromise(function(_0x230f22,_0x21ad5c){getLimits()[_0xef27('0xd')](function(_0x39a603){var _0x87fe3d=_['pick'](_['countBy'](_0x5aa1af,_0xef27('0x1f')),['admin',_0xef27('0x25'),_0xef27('0x26')]);var _0x2242cf=(_0x87fe3d['admin']||0x0)+(_0x87fe3d[_0xef27('0x25')]||0x0);var _0x587d9c=_0x87fe3d[_0xef27('0x26')]||0x0;if(_0x2242cf>_0x39a603[_0xef27('0x25')])return _0x21ad5c(_0xef27('0x2b'));if(_0x587d9c>_0x39a603['telephone'])return _0x21ad5c(_0xef27('0x2c'));return _0x230f22();})[_0xef27('0x2a')](function(_0x401552){_0x21ad5c(_0x401552);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x670e=['defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','add','grayReason','disabled','message','findAll','sequelize','COUNT','role','count','telephone','users','telephones','admin','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find'];(function(_0x3fb225,_0x47d95d){var _0x5122d3=function(_0xa489cc){while(--_0xa489cc){_0x3fb225['push'](_0x3fb225['shift']());}};_0x5122d3(++_0x47d95d);}(_0x670e,0xe0));var _0xe670=function(_0x48779f,_0x17bad1){_0x48779f=_0x48779f-0x0;var _0x274a5f=_0x670e[_0x48779f];return _0x274a5f;};'use strict';var util=require(_0xe670('0x0'));var _=require(_0xe670('0x1'));var moment=require('moment');var BPromise=require(_0xe670('0x2'));var hardware=require(_0xe670('0x3'));var encryptor=require(_0xe670('0x4'));var db=require(_0xe670('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe670('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe670('0x7'),'machineUuid':hardware[_0xe670('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe670('0x9'),'machineUuid':hardware[_0xe670('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x59c360){return new BPromise(function(_0x514f71,_0x574022){return db['License'][_0xe670('0xa')](_[_0xe670('0xb')](_0x59c360,{'raw':!![],'where':{'id':0x1}}))[_0xe670('0xc')](function(_0x5eb617){return checkLicense(_0x5eb617,null);})['then'](function(_0x5d2dd6){_0x514f71(_0x5d2dd6);return;})[_0xe670('0xd')](function(_0x56c6df){_0x574022(_0x56c6df);});});}function checkLicense(_0x26062b,_0x459c53){if(!_0x26062b){demoLicense[_0xe670('0xe')]=_0x26062b[_0xe670('0xf')];return demoLicense;}try{var _0x6e87c7=_0x459c53||_0x26062b[_0xe670('0x10')];if(_[_0xe670('0x11')](_0x6e87c7)){throw new Error(_0xe670('0x12'));}var _0x262259=_0x26062b[_0xe670('0xf')];var _0x5818d0=_0x26062b[_0xe670('0x13')];var _0x2bc416=_0x262259[_0xe670('0x14')]('-')[0x4];var _0x110d36=_0x262259['split']('-')[0x0];var _0x2fcf75=encryptor[_0xe670('0x15')](_0x6e87c7,util[_0xe670('0x16')](_0xe670('0x17'),_0x2bc416,_0x262259,_0x110d36));var _0x5a5589=JSON[_0xe670('0x18')](_0x2fcf75);_0x5a5589[_0xe670('0x19')]=![];_0x5a5589[_0xe670('0xe')]=_0x262259;_0x5a5589[_0xe670('0x1a')]=hardware[_0xe670('0x8')]();if(_0x5818d0){var _0x492262=encryptor[_0xe670('0x15')](_0x5818d0);_0x5a5589[_0xe670('0x1b')]=_0x492262;_0x5a5589['deadline']=moment(_0x492262)[_0xe670('0x1c')](0x7,'days')['format']();_0x5a5589[_0xe670('0x1d')]=_0x5a5589[_0xe670('0xe')]!=_0x5a5589[_0xe670('0x1a')]?'changed':_0xe670('0x1e');}return _0x5a5589;}catch(_0x29bb3f){breakingLicense[_0xe670('0xe')]=_0x26062b['data1'];breakingLicense[_0xe670('0x1f')]=_0x29bb3f[_0xe670('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3c4811,_0x5e21fa){getLicense()[_0xe670('0xc')](function(_0xbf5284){return db['User'][_0xe670('0x20')]({'attributes':['role',[db[_0xe670('0x21')]['fn'](_0xe670('0x22'),db[_0xe670('0x21')]['col'](_0xe670('0x23'))),_0xe670('0x24')]],'group':_0xe670('0x23'),'where':{'role':{'$or':['admin','user',_0xe670('0x25')]}},'raw':!![]})['then'](function(_0x1167a2){var _0x294cca={'user':_0xbf5284[_0xe670('0x26')]||0x0,'telephone':_0xbf5284[_0xe670('0x27')]||0x0};_0x1167a2['forEach'](function(_0xdd8f7e){var _0x159b3b=_0xdd8f7e[_0xe670('0x23')]===_0xe670('0x28')?_0xe670('0x29'):_0xdd8f7e[_0xe670('0x23')];_0x294cca[_0x159b3b]-=_0xdd8f7e['count'];if(_0x294cca[_0x159b3b]<0x0)_0x294cca[_0x159b3b]=0x0;});_0x3c4811(_0x294cca);return;});})[_0xe670('0xd')](function(_0x3d3b48){_0x5e21fa(_0x3d3b48);});});}function checkUserLimits(_0x5f105f){return new BPromise(function(_0x395533,_0x55e7b5){getLimits()[_0xe670('0xc')](function(_0x1723e2){var _0x41b5ed=_[_0xe670('0x2a')](_[_0xe670('0x2b')](_0x5f105f,_0xe670('0x23')),[_0xe670('0x28'),_0xe670('0x29'),_0xe670('0x25')]);var _0x22a723=(_0x41b5ed[_0xe670('0x28')]||0x0)+(_0x41b5ed[_0xe670('0x29')]||0x0);var _0x31c634=_0x41b5ed[_0xe670('0x25')]||0x0;if(_0x22a723>_0x1723e2['user'])return _0x55e7b5(_0xe670('0x2c'));if(_0x31c634>_0x1723e2[_0xe670('0x25')])return _0x55e7b5(_0xe670('0x2d'));return _0x395533();})[_0xe670('0xd')](function(_0x4d753e){_0x55e7b5(_0x4d753e);});});}module[_0xe670('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 1f48f51..85072af 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 _0x4991=['secret','exports','myappanuglar-secret'];(function(_0x129f02,_0x576d5e){var _0x39ee88=function(_0x3f4071){while(--_0x3f4071){_0x129f02['push'](_0x129f02['shift']());}};_0x39ee88(++_0x576d5e);}(_0x4991,0xf7));var _0x1499=function(_0x14e63c,_0x20bd9f){_0x14e63c=_0x14e63c-0x0;var _0x4ce954=_0x4991[_0x14e63c];return _0x4ce954;};'use strict';module[_0x1499('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1499('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x1499('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x6a95=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x5914fd,_0x2d5c6c){var _0x53e7ee=function(_0x4360d4){while(--_0x4360d4){_0x5914fd['push'](_0x5914fd['shift']());}};_0x53e7ee(++_0x2d5c6c);}(_0x6a95,0x1db));var _0x56a9=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x6a95[_0x1ac595];return _0x455fff;};'use strict';module[_0x56a9('0x0')]={'DOMAIN':_0x56a9('0x1'),'SESSION_SECRET':_0x56a9('0x2'),'GOOGLE_ID':_0x56a9('0x3'),'GOOGLE_SECRET':_0x56a9('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index df2eae3..8a86aa5 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa353=['../utils/loggers','exports'];(function(_0x2d876b,_0x3ad5fa){var _0xbde956=function(_0x3d5401){while(--_0x3d5401){_0x2d876b['push'](_0x2d876b['shift']());}};_0xbde956(++_0x3ad5fa);}(_0xa353,0x1c8));var _0x3a35=function(_0x4a560c,_0xc4531d){_0x4a560c=_0x4a560c-0x0;var _0x384626=_0xa353[_0x4a560c];return _0x384626;};'use strict';var fileLogger=require(_0x3a35('0x0'))['fileLogger'];module[_0x3a35('0x1')]=fileLogger; \ No newline at end of file +var _0x35ef=['fileLogger','exports'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x35ef,0xc8));var _0xf35e=function(_0x2c3520,_0x356774){_0x2c3520=_0x2c3520-0x0;var _0x196cca=_0x35ef[_0x2c3520];return _0x196cca;};'use strict';var fileLogger=require('../utils/loggers')[_0xf35e('0x0')];module[_0xf35e('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 61ed6d1..3fbcc6e 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 _0xb152=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','join','root','legacy-libs','express','../../services/express/index.js','ami'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb152,0xe7));var _0x2b15=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0xb152[_0x2e819c];return _0x24e271;};'use strict';var path=require(_0x2b15('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path['resolve'](path[_0x2b15('0x1')](cfg[_0x2b15('0x2')],_0x2b15('0x3')))};var pm2config={'apps':[{'name':_0x2b15('0x4'),'script':path[_0x2b15('0x1')](__dirname,_0x2b15('0x5')),'env':env},{'name':_0x2b15('0x6'),'script':path[_0x2b15('0x1')](__dirname,_0x2b15('0x7')),'env':env},{'name':_0x2b15('0x8'),'script':path['join'](__dirname,_0x2b15('0x9')),'env':env},{'name':_0x2b15('0xa'),'script':path[_0x2b15('0x1')](__dirname,_0x2b15('0xb')),'env':env},{'name':_0x2b15('0xc'),'script':path['join'](__dirname,_0x2b15('0xd')),'env':env},{'name':_0x2b15('0xe'),'script':path[_0x2b15('0x1')](__dirname,_0x2b15('0xf')),'env':env}]};module[_0x2b15('0x10')]=pm2config; \ No newline at end of file +var _0x184b=['routing','../../services/routing/index.js','../../services/xdr/index.js','exports','../../config/environment','resolve','join','root','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js'];(function(_0x25f912,_0x2cc6e7){var _0xa326f1=function(_0x51c74b){while(--_0x51c74b){_0x25f912['push'](_0x25f912['shift']());}};_0xa326f1(++_0x2cc6e7);}(_0x184b,0x6d));var _0xb184=function(_0x909734,_0x16d6c2){_0x909734=_0x909734-0x0;var _0x1063eb=_0x184b[_0x909734];return _0x1063eb;};'use strict';var path=require('path');var cfg=require(_0xb184('0x0'));var env={'NODE_PATH':path[_0xb184('0x1')](path[_0xb184('0x2')](cfg[_0xb184('0x3')],'legacy-libs'))};var pm2config={'apps':[{'name':_0xb184('0x4'),'script':path['join'](__dirname,_0xb184('0x5')),'env':env},{'name':_0xb184('0x6'),'script':path[_0xb184('0x2')](__dirname,_0xb184('0x7')),'env':env},{'name':_0xb184('0x8'),'script':path[_0xb184('0x2')](__dirname,_0xb184('0x9')),'env':env},{'name':'email','script':path[_0xb184('0x2')](__dirname,_0xb184('0xa')),'env':env},{'name':_0xb184('0xb'),'script':path[_0xb184('0x2')](__dirname,_0xb184('0xc')),'env':env},{'name':'xdr','script':path[_0xb184('0x2')](__dirname,_0xb184('0xd')),'env':env}]};module[_0xb184('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ba31030..2654571 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 _0x367b=['disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','connect','start','then'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x367b,0x1c2));var _0xb367=function(_0x48bf52,_0x30eeae){_0x48bf52=_0x48bf52-0x0;var _0x3f127d=_0x367b[_0x48bf52];return _0x3f127d;};'use strict';var pm2=require(_0xb367('0x0'));var BPromise=require(_0xb367('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x1fc68b,_0x655cb7){return pm2[_0xb367('0x2')](function(_0x26eaf4){if(_0x26eaf4){return _0x655cb7(_0x26eaf4);}return _0x1fc68b('connected');});});};exports[_0xb367('0x3')]=function(_0x18f781){return connect()[_0xb367('0x4')](function(){return new BPromise(function(_0x10bee2,_0x5c75d4){return pm2['start'](_0x18f781,function(_0x5dfe4e,_0x1dbd56){if(_0x5dfe4e){return _0x5c75d4(_0x5dfe4e);}pm2[_0xb367('0x5')]();return _0x10bee2(_0x1dbd56);});});});};exports[_0xb367('0x6')]=function(_0x30f459){return connect()[_0xb367('0x4')](function(){return new BPromise(function(_0xfd9fc8,_0x47b9e5){return pm2[_0xb367('0x6')](_0x30f459,function(_0x189b03,_0x500dd9){if(_0x189b03){return _0x47b9e5(_0x189b03);}pm2['disconnect']();return _0xfd9fc8(_0x500dd9);});});});};exports[_0xb367('0x7')]=function(_0x23d251){return connect()[_0xb367('0x4')](function(){return new BPromise(function(_0x5b2483,_0x6e7a90){return pm2[_0xb367('0x7')](_0x23d251,function(_0x55357d,_0x2e9f3e){if(_0x55357d){return _0x6e7a90(_0x55357d);}pm2[_0xb367('0x5')]();return _0x5b2483(_0x2e9f3e);});});});};exports[_0xb367('0x8')]=function(){return connect()[_0xb367('0x4')](function(){return new BPromise(function(_0x5c0a7f,_0x52b5d4){return pm2[_0xb367('0x8')](function(_0x336ccf,_0x3abf47){if(_0x336ccf){return _0x52b5d4(_0x336ccf);}pm2[_0xb367('0x5')]();return _0x5c0a7f(_0x3abf47);});});});};exports[_0xb367('0x9')]=function(_0x5c10d7){return connect()[_0xb367('0x4')](function(){return new BPromise(function(_0x408155,_0xc9bf96){return pm2[_0xb367('0x9')](_0x5c10d7,function(_0x1e5c5f,_0x3ec5e1){if(_0x1e5c5f){return _0xc9bf96(_0x1e5c5f);}pm2[_0xb367('0x5')]();return _0x408155(_0x3ec5e1);});});});};exports[_0xb367('0xa')]=function(_0x4e803c){return connect()[_0xb367('0x4')](function(){return new BPromise(function(_0x1d6050,_0x3564f7){return pm2[_0xb367('0xa')](_0x4e803c,function(_0x58790f,_0x226680){if(_0x58790f){return _0x3564f7(_0x58790f);}pm2[_0xb367('0x5')]();return _0x1d6050(_0x226680);});});});};exports[_0xb367('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3c6b1e,_0x21af99){return pm2[_0xb367('0xb')](function(_0x4feb7b){if(_0x4feb7b){return _0x21af99(_0x4feb7b);}return _0x3c6b1e(_0xb367('0xc'));});});});}; \ No newline at end of file +var _0x652b=['bluebird','connect','connected','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x652b,0x1db));var _0xb652=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x652b[_0x29db36];return _0x234e87;};'use strict';var pm2=require(_0xb652('0x0'));var BPromise=require(_0xb652('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x32a070,_0xc3bba6){return pm2[_0xb652('0x2')](function(_0x422160){if(_0x422160){return _0xc3bba6(_0x422160);}return _0x32a070(_0xb652('0x3'));});});};exports['start']=function(_0x633a30){return connect()[_0xb652('0x4')](function(){return new BPromise(function(_0x4ee0ea,_0xe1bf91){return pm2[_0xb652('0x5')](_0x633a30,function(_0x4cdffe,_0x23dc4d){if(_0x4cdffe){return _0xe1bf91(_0x4cdffe);}pm2[_0xb652('0x6')]();return _0x4ee0ea(_0x23dc4d);});});});};exports[_0xb652('0x7')]=function(_0xc3663a){return connect()[_0xb652('0x4')](function(){return new BPromise(function(_0x48d6eb,_0x8bff8f){return pm2[_0xb652('0x7')](_0xc3663a,function(_0x4ecd20,_0x3c5488){if(_0x4ecd20){return _0x8bff8f(_0x4ecd20);}pm2[_0xb652('0x6')]();return _0x48d6eb(_0x3c5488);});});});};exports[_0xb652('0x8')]=function(_0x3f8b10){return connect()[_0xb652('0x4')](function(){return new BPromise(function(_0x238b8e,_0x4bda12){return pm2[_0xb652('0x8')](_0x3f8b10,function(_0x35478c,_0x2b97ae){if(_0x35478c){return _0x4bda12(_0x35478c);}pm2[_0xb652('0x6')]();return _0x238b8e(_0x2b97ae);});});});};exports[_0xb652('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3818e7,_0x2df3eb){return pm2[_0xb652('0x9')](function(_0x457966,_0x5b3fe3){if(_0x457966){return _0x2df3eb(_0x457966);}pm2[_0xb652('0x6')]();return _0x3818e7(_0x5b3fe3);});});});};exports[_0xb652('0xa')]=function(_0x286de1){return connect()[_0xb652('0x4')](function(){return new BPromise(function(_0x2b7a81,_0x1e11a6){return pm2[_0xb652('0xa')](_0x286de1,function(_0x1433ff,_0x657cf0){if(_0x1433ff){return _0x1e11a6(_0x1433ff);}pm2[_0xb652('0x6')]();return _0x2b7a81(_0x657cf0);});});});};exports[_0xb652('0xb')]=function(_0x2ca335){return connect()['then'](function(){return new BPromise(function(_0x5d172e,_0x3c6c62){return pm2[_0xb652('0xb')](_0x2ca335,function(_0x2c4e0b,_0x342785){if(_0x2c4e0b){return _0x3c6c62(_0x2c4e0b);}pm2[_0xb652('0x6')]();return _0x5d172e(_0x342785);});});});};exports[_0xb652('0xc')]=function(){return connect()[_0xb652('0x4')](function(){return new BPromise(function(_0x1e739b,_0x261885){return pm2[_0xb652('0xc')](function(_0x3656f0){if(_0x3656f0){return _0x261885(_0x3656f0);}return _0x1e739b(_0xb652('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 5c7f1f1..56a73de 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 _0x86d8=['../../mysqldb','../logger','schedule','localhost','find','then','ChatInteraction','findAll','lastMsgAt','subtract','chatTimeout','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment'];(function(_0x1c4e53,_0x33578f){var _0x1b8091=function(_0x1ef0d9){while(--_0x1ef0d9){_0x1c4e53['push'](_0x1c4e53['shift']());}};_0x1b8091(++_0x33578f);}(_0x86d8,0x1a8));var _0x886d=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0x86d8[_0x5aa373];return _0x590e8e;};'use strict';var _=require(_0x886d('0x0'));var moment=require(_0x886d('0x1'));var Redis=require(_0x886d('0x2'));var util=require(_0x886d('0x3'));var config=require(_0x886d('0x4'));var db=require(_0x886d('0x5'))['db'];var logger=require(_0x886d('0x6'))(_0x886d('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0x886d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x84945b=0x0;var _0x26801c=[];return db['Setting'][_0x886d('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x886d('0xa')](function(_0xc48ac6){_0x84945b=_0xc48ac6['chatTimeout'];if(_0x84945b){return db[_0x886d('0xb')][_0x886d('0xc')]({'raw':!![],'attributes':['id',_0x886d('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x886d('0xe')](_0xc48ac6[_0x886d('0xf')],'minutes')}}});}else{return[];}})['then'](function(_0x4c88c3){if(_0x4c88c3&&_0x4c88c3[_0x886d('0x10')]){_0x26801c=_[_0x886d('0x11')](_0x4c88c3||[],'id');logger[_0x886d('0x12')](_0x886d('0x13'),_0x26801c['join']());return db[_0x886d('0xb')][_0x886d('0x14')]({'closeReason':_0x886d('0x15'),'disposition':_0x886d('0x16'),'closed':!![],'closedAt':moment()[_0x886d('0x17')](_0x886d('0x18'))},{'where':{'id':_0x26801c}});}})[_0x886d('0xa')](function(){if(_0x26801c&&_0x26801c['length']){logger['info'](_0x886d('0x19'),_0x26801c[_0x886d('0x1a')]());for(var _0x977ed1=0x0;_0x977ed1<_0x26801c[_0x886d('0x10')];_0x977ed1++){io[_0x886d('0x1b')](_0x886d('0x1c'),{'id':_0x26801c[_0x977ed1],'closed':!![]});}}})[_0x886d('0x1d')](function(_0x318d93){logger[_0x886d('0x1e')](_0x886d('0x1f'),_0x318d93?util['inspect'](_0x318d93,{'showHidden':![],'depth':null}):'');});}exports[_0x886d('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xaac6=['redis','defaults','localhost','socket.io-emitter','find','then','chatTimeout','ChatInteraction','findAll','subtract','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x38e084,_0x5792dc){var _0x1dd0ea=function(_0x18d535){while(--_0x18d535){_0x38e084['push'](_0x38e084['shift']());}};_0x1dd0ea(++_0x5792dc);}(_0xaac6,0x1a5));var _0x6aac=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xaac6[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x6aac('0x0'));var moment=require(_0x6aac('0x1'));var Redis=require(_0x6aac('0x2'));var util=require(_0x6aac('0x3'));var config=require(_0x6aac('0x4'));var db=require(_0x6aac('0x5'))['db'];var logger=require(_0x6aac('0x6'))(_0x6aac('0x7'));config[_0x6aac('0x8')]=_[_0x6aac('0x9')](config[_0x6aac('0x8')],{'host':_0x6aac('0xa'),'port':0x18eb});var io=require(_0x6aac('0xb'))(new Redis(config[_0x6aac('0x8')]));function closeInteractions(){var _0x318476=0x0;var _0x2133f2=[];return db['Setting'][_0x6aac('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x6aac('0xd')](function(_0x3b7917){_0x318476=_0x3b7917[_0x6aac('0xe')];if(_0x318476){return db[_0x6aac('0xf')][_0x6aac('0x10')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6aac('0x11')](_0x3b7917[_0x6aac('0xe')],'minutes')}}});}else{return[];}})['then'](function(_0x40f9a8){if(_0x40f9a8&&_0x40f9a8[_0x6aac('0x12')]){_0x2133f2=_[_0x6aac('0x13')](_0x40f9a8||[],'id');logger[_0x6aac('0x14')]('[CHAT]\x20Interactions\x20to\x20close:',_0x2133f2[_0x6aac('0x15')]());return db['ChatInteraction'][_0x6aac('0x16')]({'closeReason':_0x6aac('0x17'),'disposition':_0x6aac('0x18'),'closed':!![],'closedAt':moment()[_0x6aac('0x19')](_0x6aac('0x1a'))},{'where':{'id':_0x2133f2}});}})[_0x6aac('0xd')](function(){if(_0x2133f2&&_0x2133f2['length']){logger['info'](_0x6aac('0x1b'),_0x2133f2['join']());for(var _0x5245f7=0x0;_0x5245f7<_0x2133f2['length'];_0x5245f7++){io[_0x6aac('0x1c')](_0x6aac('0x1d'),{'id':_0x2133f2[_0x5245f7],'closed':!![]});}}})[_0x6aac('0x1e')](function(_0x444a30){logger[_0x6aac('0x1f')]('[CHAT]\x20Error\x20closing\x20interactions',_0x444a30?util[_0x6aac('0x20')](_0x444a30,{'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/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 32b71c6..66003cd 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02a7=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0x02a7,0x10c));var _0x702a=function(_0x133882,_0x2ca2a2){_0x133882=_0x133882-0x0;var _0x3f0626=_0x02a7[_0x133882];return _0x3f0626;};'use strict';function start(){var _0x34bfb6=require(_0x702a('0x0'));return _0x34bfb6[_0x702a('0x1')]();}module[_0x702a('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xba39=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x2abfb7,_0x1f6a6b){var _0x3cfb4e=function(_0x319f7b){while(--_0x319f7b){_0x2abfb7['push'](_0x2abfb7['shift']());}};_0x3cfb4e(++_0x1f6a6b);}(_0xba39,0x74));var _0x9ba3=function(_0x1c8654,_0x1a76e6){_0x1c8654=_0x1c8654-0x0;var _0x4b7fce=_0xba39[_0x1c8654];return _0x4b7fce;};'use strict';function start(){var _0x3bca49=require(_0x9ba3('0x0'));return _0x3bca49[_0x9ba3('0x1')]();}module[_0x9ba3('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 2f7e8e4..f1baf9a 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 _0x4852=['isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','Schedule','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x4852,0xc8));var _0x2485=function(_0x1d2021,_0x15a12c){_0x1d2021=_0x1d2021-0x0;var _0x29ccc5=_0x4852[_0x1d2021];return _0x29ccc5;};'use strict';var fs=require('fs');var util=require(_0x2485('0x0'));var path=require(_0x2485('0x1'));var _=require(_0x2485('0x2'));var moment=require(_0x2485('0x3'));var CronJobManager=require(_0x2485('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x2485('0x5'));var logger=require('../logger')(_0x2485('0x6'));var db=require(_0x2485('0x7'))['db'];var analyticCustomReportController=require(_0x2485('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x2485('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4e3bf2,_0x526b6f){return function(){logger[_0x2485('0xa')](_0x2485('0xb'),_0x4e3bf2[_0x2485('0xc')]);var _0x9a4062=!![];var _0x299a69=_0x4e3bf2[_0x2485('0xd')][_0x2485('0xe')]();var _0x15bff8={'account':_0x299a69,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4e3bf2['MailAccount'][_0x2485('0xf')],_0x4e3bf2['MailAccount'][_0x2485('0xc')]||_0x4e3bf2[_0x2485('0xd')][_0x2485('0x10')][_0x2485('0x11')]),'to':_0x4e3bf2[_0x2485('0xc')],'cc':_0x4e3bf2['cc'],'bcc':_0x4e3bf2[_0x2485('0x12')],'subject':util[_0x2485('0x13')](_0x2485('0x14'),_0x526b6f['name'],_0x4e3bf2[_0x2485('0x15')],_0x4e3bf2[_0x2485('0x16')])}};var _0x28b6db=path[_0x2485('0x17')](__dirname,_0x2485('0x18'));var _0x55d492=_0x526b6f[_0x2485('0x19')];var _0x38219a=util[_0x2485('0x13')](_0x2485('0x1a'),path[_0x2485('0x1b')](_0x526b6f[_0x2485('0x19')],path[_0x2485('0x1c')](_0x526b6f[_0x2485('0x19')])),_0x2485('0x1d'));var _0x16c07d=path[_0x2485('0x17')](_0x28b6db,_0x55d492);var _0x1eda0d=path[_0x2485('0x17')](_0x28b6db,_0x38219a);if(fs[_0x2485('0x1e')](_0x16c07d)){_0x526b6f[_0x2485('0x1f')]=_0x2485('0x20');_0x15bff8[_0x2485('0x21')][_0x2485('0x22')]=[{'filename':_0x55d492,'path':_0x16c07d}];_0x15bff8[_0x2485('0x21')][_0x2485('0x23')]=util[_0x2485('0x13')](_0x2485('0x24'),JSON['stringify'](_0x526b6f,null,0x2));}else if(fs[_0x2485('0x1e')](_0x1eda0d)){_0x526b6f[_0x2485('0x1f')]=_0x2485('0x20');_0x15bff8[_0x2485('0x21')]['attachments']=[{'filename':_0x38219a,'path':_0x1eda0d}];}else{_0x15bff8[_0x2485('0x21')][_0x2485('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4e3bf2['sendIfEmpty']){_0x9a4062=![];logger[_0x2485('0xa')](_0x2485('0x25'));}}if(_0x9a4062){return client[_0x2485('0x26')](_0x2485('0x27'),_0x15bff8)[_0x2485('0x28')](function(_0x14de2c){if(_0x14de2c['error']){return logger[_0x2485('0x29')](_0x2485('0x2a'),JSON[_0x2485('0x2b')](_0x14de2c));}return logger['info'](_0x2485('0x2c'));})[_0x2485('0x2d')](function(_0x37e314){return logger[_0x2485('0x29')]('error\x20mail',JSON[_0x2485('0x2b')](_0x37e314));});}};}function handleError(){return function(_0x1c5ebf){return logger[_0x2485('0x29')](JSON[_0x2485('0x2b')](_0x1c5ebf));};}function handleResult(_0x14bcc3){return function(_0x4d7c7a){logger[_0x2485('0xa')]('data',JSON[_0x2485('0x2b')](_0x4d7c7a));if(_0x14bcc3[_0x2485('0xd')]&&_0x14bcc3[_0x2485('0xd')][_0x2485('0x10')]&&!_[_0x2485('0x2e')](_0x14bcc3[_0x2485('0xc')])){setTimeout(handleSendEmail(_0x14bcc3,_0x4d7c7a),0x3c*0x3e8);}};}function handleJob(_0x18e683){return function(){try{if(_['isNil'](_0x18e683[_0x2485('0x15')])){return logger[_0x2485('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x2485('0x2e')](_0x18e683[_0x2485('0x16')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x303790={'startDate':moment()[_0x2485('0x2f')](_0x18e683[_0x2485('0x15')],_0x18e683[_0x2485('0x16')])[_0x2485('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x2485('0x30')),'type':_0x2485('0x31'),'output':_0x18e683[_0x2485('0x32')],'name':_0x18e683['name']};if(!_[_0x2485('0x2e')](_0x18e683['DefaultReportId'])){logger[_0x2485('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x18e683['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x18e683[_0x2485('0x33')]},_0x303790)[_0x2485('0x28')](handleResult(_0x18e683))['catch'](handleError());}if(!_[_0x2485('0x2e')](_0x18e683[_0x2485('0x34')])){logger['info'](_0x2485('0x35'),_0x18e683[_0x2485('0x34')]);return analyticCustomReportController[_0x2485('0x36')]({'id':_0x18e683[_0x2485('0x34')]},_0x303790)[_0x2485('0x28')](handleResult(_0x18e683))[_0x2485('0x2d')](handleError());}}catch(_0x47c7dd){logger[_0x2485('0x29')](JSON[_0x2485('0x2b')](_0x47c7dd));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x236a48){var _0x1fe45e={};if(_0x236a48){_0x1fe45e['id']=_0x236a48;}return db[_0x2485('0x37')]['findAll']({'where':_0x1fe45e,'include':[{'model':db[_0x2485('0xd')],'attributes':['id',_0x2485('0xf'),_0x2485('0xc')],'include':[{'model':db[_0x2485('0x38')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})['then'](function(_0x338c72){var _0x132db3=_['keys'](manager[_0x2485('0x39')]);var _0x30bb6e=_[_0x2485('0x3a')](_0x338c72,function(_0x510cee){return _0x510cee['id'][_0x2485('0x3b')]();});var _0xe13224=_[_0x2485('0x3c')](_0x338c72,function(_0x3fe044){return _0x3fe044['id'][_0x2485('0x3b')]();});var _0xca9c08=_0x236a48?_0x30bb6e:_[_0x2485('0x3d')](_0x30bb6e,_0x132db3);var _0x2dfc4b=_[_0x2485('0x3e')](_0x30bb6e,_0x132db3);var _0x26cd54=_[_0x2485('0x3d')](_0x132db3,_0x30bb6e);var _0x4d0916;var _0x371e6;for(_0x4d0916=0x0;_0x4d0916<_0x26cd54[_0x2485('0x3f')]&&!_0x236a48;_0x4d0916+=0x1){_0x371e6=_0x26cd54[_0x4d0916][_0x2485('0x3b')]();if(manager[_0x2485('0x40')](_0x371e6)){manager[_0x2485('0x41')](_0x371e6);manager[_0x2485('0x42')](_0x371e6);logger[_0x2485('0xa')](_0x2485('0x43'),_0x371e6);}}logger['info'](_0x2485('0x44'),JSON[_0x2485('0x2b')](_0xca9c08));for(_0x4d0916=0x0;_0x4d0916<_0xca9c08[_0x2485('0x3f')];_0x4d0916+=0x1){_0x371e6=_0xca9c08[_0x4d0916][_0x2485('0x3b')]();logger[_0x2485('0xa')](_0x2485('0x45'),_0x371e6);if(_0x236a48){logger[_0x2485('0xa')](_0x2485('0x46'),_0x236a48);logger[_0x2485('0xa')](JSON[_0x2485('0x2b')](_0xe13224[_0x371e6]));BPromise[_0x2485('0x47')]()[_0x2485('0x28')](handleJob(_0xe13224[_0x371e6]));logger[_0x2485('0xa')]('run\x20job',_0xe13224[_0x371e6][_0x2485('0xf')],_0xe13224[_0x371e6]['cron']);}else if(_0xe13224[_0x371e6][_0x2485('0x48')]&&_0xe13224[_0x371e6][_0x2485('0x49')]&&moment()[_0x2485('0x4a')](_0xe13224[_0x371e6][_0x2485('0x4b')],_0xe13224[_0x371e6][_0x2485('0x4c')])){manager[_0x2485('0x4d')](_0x371e6,_0xe13224[_0x371e6]['cron'],handleJob(_0xe13224[_0x371e6]));manager[_0x2485('0x4e')](_0x371e6);logger[_0x2485('0xa')](_0x2485('0x4f'),_0xe13224[_0x371e6]['name'],_0xe13224[_0x371e6][_0x2485('0x48')]);}else if(manager[_0x2485('0x40')](_0x371e6)){manager[_0x2485('0x41')](_0x371e6);manager[_0x2485('0x42')](_0x371e6);logger[_0x2485('0xa')]('stop\x20cron',_0xe13224[_0x371e6][_0x2485('0xf')],_0xe13224[_0x371e6]['cron']);}}for(_0x4d0916=0x0,_0x371e6;_0x4d0916<_0x2dfc4b['length']&&!_0x236a48;_0x4d0916+=0x1){_0x371e6=_0x2dfc4b[_0x4d0916][_0x2485('0x3b')]();if(manager[_0x2485('0x40')](_0x371e6)){if(_0xe13224[_0x371e6]['cron']&&_0xe13224[_0x371e6]['active']&&moment()[_0x2485('0x4a')](_0xe13224[_0x371e6][_0x2485('0x4b')],_0xe13224[_0x371e6][_0x2485('0x4c')])){manager['update'](_0x371e6,_0xe13224[_0x371e6]['cron'],handleJob(_0xe13224[_0x371e6]));logger[_0x2485('0xa')]('update\x20cron',_0xe13224[_0x371e6][_0x2485('0xf')],_0xe13224[_0x371e6]['cron']);}else{manager[_0x2485('0x41')](_0x371e6);manager['deleteJob'](_0x371e6);logger[_0x2485('0xa')](_0x2485('0x50'),_0xe13224[_0x371e6][_0x2485('0xf')],_0xe13224[_0x371e6][_0x2485('0x48')]);}}}})[_0x2485('0x2d')](function(_0x53dafa){logger['error'](JSON[_0x2485('0x2b')](_0x53dafa));});}exports[_0x2485('0x51')]=function(_0xa9b609){return getJobs(_0xa9b609);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x105b=['info','email','MailAccount','format','\x22%s\x22\x20<%s>','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','name','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','catch','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','findAll','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','stop','deleteJob','toRun','index','cron','active','isBetween','startAt','add','endAt','update','update\x20cron','stop\x20cron','run','start','util','lodash','jayson/promise','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http'];(function(_0x4ce919,_0x32a7ba){var _0x699092=function(_0x117640){while(--_0x117640){_0x4ce919['push'](_0x4ce919['shift']());}};_0x699092(++_0x32a7ba);}(_0x105b,0x179));var _0xb105=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x105b[_0x411add];return _0x238242;};'use strict';var fs=require('fs');var util=require(_0xb105('0x0'));var path=require('path');var _=require(_0xb105('0x1'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0xb105('0x2'));var BPromise=require('bluebird');var logger=require(_0xb105('0x3'))(_0xb105('0x4'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xb105('0x5'));var client=jayson[_0xb105('0x6')][_0xb105('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x40b804,_0x3f1f05){return function(){logger[_0xb105('0x8')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x40b804[_0xb105('0x9')]);var _0x137e49=!![];var _0x2e2601=_0x40b804[_0xb105('0xa')]['getSmtpOptions']();var _0x598d39={'account':_0x2e2601,'message':{'from':util[_0xb105('0xb')](_0xb105('0xc'),_0x40b804[_0xb105('0xa')]['name'],_0x40b804['MailAccount']['email']||_0x40b804[_0xb105('0xa')][_0xb105('0xd')]['user']),'to':_0x40b804[_0xb105('0x9')],'cc':_0x40b804['cc'],'bcc':_0x40b804[_0xb105('0xe')],'subject':util[_0xb105('0xb')](_0xb105('0xf'),_0x3f1f05[_0xb105('0x10')],_0x40b804['subtractNumber'],_0x40b804['subtractUnit'])}};var _0x30dddd=path[_0xb105('0x11')](__dirname,_0xb105('0x12'));var _0x389219=_0x3f1f05['savename'];var _0x537577=util[_0xb105('0xb')](_0xb105('0x13'),path[_0xb105('0x14')](_0x3f1f05[_0xb105('0x15')],path[_0xb105('0x16')](_0x3f1f05[_0xb105('0x15')])),_0xb105('0x17'));var _0x4acd69=path[_0xb105('0x11')](_0x30dddd,_0x389219);var _0x8398a7=path[_0xb105('0x11')](_0x30dddd,_0x537577);if(fs[_0xb105('0x18')](_0x4acd69)){_0x3f1f05[_0xb105('0x19')]=_0xb105('0x1a');_0x598d39['message']['attachments']=[{'filename':_0x389219,'path':_0x4acd69}];_0x598d39[_0xb105('0x1b')][_0xb105('0x1c')]=util[_0xb105('0xb')](_0xb105('0x1d'),JSON[_0xb105('0x1e')](_0x3f1f05,null,0x2));}else if(fs[_0xb105('0x18')](_0x8398a7)){_0x3f1f05[_0xb105('0x19')]='Sent';_0x598d39['message'][_0xb105('0x1f')]=[{'filename':_0x537577,'path':_0x8398a7}];}else{_0x598d39[_0xb105('0x1b')]['text']=_0xb105('0x20');if(!_0x40b804['sendIfEmpty']){_0x137e49=![];logger[_0xb105('0x8')](_0xb105('0x21'));}}if(_0x137e49){return client[_0xb105('0x22')]('SendMail',_0x598d39)[_0xb105('0x23')](function(_0x1f9cdb){if(_0x1f9cdb['error']){return logger[_0xb105('0x24')](_0xb105('0x25'),JSON[_0xb105('0x1e')](_0x1f9cdb));}return logger['info']('email\x20sent');})[_0xb105('0x26')](function(_0x10669a){return logger[_0xb105('0x24')](_0xb105('0x25'),JSON[_0xb105('0x1e')](_0x10669a));});}};}function handleError(){return function(_0x34d372){return logger[_0xb105('0x24')](JSON[_0xb105('0x1e')](_0x34d372));};}function handleResult(_0x586395){return function(_0x33e627){logger[_0xb105('0x8')]('data',JSON[_0xb105('0x1e')](_0x33e627));if(_0x586395[_0xb105('0xa')]&&_0x586395[_0xb105('0xa')]['Smtp']&&!_[_0xb105('0x27')](_0x586395[_0xb105('0x9')])){setTimeout(handleSendEmail(_0x586395,_0x33e627),0x3c*0x3e8);}};}function handleJob(_0x46ad22){return function(){try{if(_[_0xb105('0x27')](_0x46ad22[_0xb105('0x28')])){return logger[_0xb105('0x8')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xb105('0x27')](_0x46ad22['subtractUnit'])){return logger[_0xb105('0x8')](_0xb105('0x29'));}var _0x15888f={'startDate':moment()['subtract'](_0x46ad22['subtractNumber'],_0x46ad22[_0xb105('0x2a')])[_0xb105('0xb')](_0xb105('0x2b')),'endDate':moment()[_0xb105('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xb105('0x2c'),'output':_0x46ad22[_0xb105('0x2d')],'name':_0x46ad22[_0xb105('0x10')]};if(!_['isNil'](_0x46ad22['DefaultReportId'])){logger[_0xb105('0x8')](_0xb105('0x2e'),_0x46ad22['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x46ad22[_0xb105('0x2f')]},_0x15888f)[_0xb105('0x23')](handleResult(_0x46ad22))[_0xb105('0x26')](handleError());}if(!_[_0xb105('0x27')](_0x46ad22[_0xb105('0x30')])){logger[_0xb105('0x8')](_0xb105('0x31'),_0x46ad22[_0xb105('0x30')]);return analyticCustomReportController[_0xb105('0x32')]({'id':_0x46ad22['CustomReportId']},_0x15888f)[_0xb105('0x23')](handleResult(_0x46ad22))[_0xb105('0x26')](handleError());}}catch(_0x206d23){logger['error'](JSON['stringify'](_0x206d23));}return logger['info'](_0xb105('0x33'));};}function getJobs(_0x528dc4){var _0x27974f={};if(_0x528dc4){_0x27974f['id']=_0x528dc4;}return db['Schedule'][_0xb105('0x34')]({'where':_0x27974f,'include':[{'model':db['MailAccount'],'attributes':['id',_0xb105('0x10'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xb105('0xd'),'include':[{'model':db[_0xb105('0x35')],'as':_0xb105('0x35')}]}]}]})['then'](function(_0x15731c){var _0x1ff383=_[_0xb105('0x36')](manager[_0xb105('0x37')]);var _0x3eefbb=_[_0xb105('0x38')](_0x15731c,function(_0x5da80c){return _0x5da80c['id'][_0xb105('0x39')]();});var _0x575dd7=_['keyBy'](_0x15731c,function(_0x222b1f){return _0x222b1f['id'][_0xb105('0x39')]();});var _0x1a2e05=_0x528dc4?_0x3eefbb:_[_0xb105('0x3a')](_0x3eefbb,_0x1ff383);var _0x5dd263=_[_0xb105('0x3b')](_0x3eefbb,_0x1ff383);var _0x4e0899=_[_0xb105('0x3a')](_0x1ff383,_0x3eefbb);var _0x512000;var _0x1cb6fd;for(_0x512000=0x0;_0x512000<_0x4e0899[_0xb105('0x3c')]&&!_0x528dc4;_0x512000+=0x1){_0x1cb6fd=_0x4e0899[_0x512000][_0xb105('0x39')]();if(manager[_0xb105('0x3d')](_0x1cb6fd)){manager[_0xb105('0x3e')](_0x1cb6fd);manager[_0xb105('0x3f')](_0x1cb6fd);logger[_0xb105('0x8')]('delete\x20cron',_0x1cb6fd);}}logger['info'](_0xb105('0x40'),JSON[_0xb105('0x1e')](_0x1a2e05));for(_0x512000=0x0;_0x512000<_0x1a2e05['length'];_0x512000+=0x1){_0x1cb6fd=_0x1a2e05[_0x512000][_0xb105('0x39')]();logger[_0xb105('0x8')](_0xb105('0x41'),_0x1cb6fd);if(_0x528dc4){logger[_0xb105('0x8')]('my\x20id',_0x528dc4);logger[_0xb105('0x8')](JSON['stringify'](_0x575dd7[_0x1cb6fd]));BPromise['resolve']()[_0xb105('0x23')](handleJob(_0x575dd7[_0x1cb6fd]));logger[_0xb105('0x8')]('run\x20job',_0x575dd7[_0x1cb6fd][_0xb105('0x10')],_0x575dd7[_0x1cb6fd][_0xb105('0x42')]);}else if(_0x575dd7[_0x1cb6fd][_0xb105('0x42')]&&_0x575dd7[_0x1cb6fd][_0xb105('0x43')]&&moment()[_0xb105('0x44')](_0x575dd7[_0x1cb6fd][_0xb105('0x45')],_0x575dd7[_0x1cb6fd]['endAt'])){manager[_0xb105('0x46')](_0x1cb6fd,_0x575dd7[_0x1cb6fd][_0xb105('0x42')],handleJob(_0x575dd7[_0x1cb6fd]));manager['start'](_0x1cb6fd);logger['info']('add\x20cron',_0x575dd7[_0x1cb6fd]['name'],_0x575dd7[_0x1cb6fd][_0xb105('0x42')]);}else if(manager[_0xb105('0x3d')](_0x1cb6fd)){manager[_0xb105('0x3e')](_0x1cb6fd);manager['deleteJob'](_0x1cb6fd);logger['info']('stop\x20cron',_0x575dd7[_0x1cb6fd]['name'],_0x575dd7[_0x1cb6fd][_0xb105('0x42')]);}}for(_0x512000=0x0,_0x1cb6fd;_0x512000<_0x5dd263['length']&&!_0x528dc4;_0x512000+=0x1){_0x1cb6fd=_0x5dd263[_0x512000][_0xb105('0x39')]();if(manager['exists'](_0x1cb6fd)){if(_0x575dd7[_0x1cb6fd][_0xb105('0x42')]&&_0x575dd7[_0x1cb6fd][_0xb105('0x43')]&&moment()[_0xb105('0x44')](_0x575dd7[_0x1cb6fd][_0xb105('0x45')],_0x575dd7[_0x1cb6fd][_0xb105('0x47')])){manager[_0xb105('0x48')](_0x1cb6fd,_0x575dd7[_0x1cb6fd][_0xb105('0x42')],handleJob(_0x575dd7[_0x1cb6fd]));logger[_0xb105('0x8')](_0xb105('0x49'),_0x575dd7[_0x1cb6fd][_0xb105('0x10')],_0x575dd7[_0x1cb6fd][_0xb105('0x42')]);}else{manager['stop'](_0x1cb6fd);manager[_0xb105('0x3f')](_0x1cb6fd);logger[_0xb105('0x8')](_0xb105('0x4a'),_0x575dd7[_0x1cb6fd][_0xb105('0x10')],_0x575dd7[_0x1cb6fd][_0xb105('0x42')]);}}}})[_0xb105('0x26')](function(_0x4faca8){logger[_0xb105('0x24')](JSON[_0xb105('0x1e')](_0x4faca8));});}exports[_0xb105('0x4b')]=function(_0x336f6f){return getJobs(_0x336f6f);};exports[_0xb105('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 0c2c638..a4bc997 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 _0x4e61=['request-promise','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','info','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','sentimentAccountId','Sequelize','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','start','lodash','aws-sdk'];(function(_0x269ae5,_0x5d10bd){var _0x452f04=function(_0x56a1ae){while(--_0x56a1ae){_0x269ae5['push'](_0x269ae5['shift']());}};_0x452f04(++_0x5d10bd);}(_0x4e61,0x8c));var _0x14e6=function(_0x1ad12c,_0x5bd618){_0x1ad12c=_0x1ad12c-0x0;var _0xb60e0f=_0x4e61[_0x1ad12c];return _0xb60e0f;};var _=require(_0x14e6('0x0'));var AWS=require(_0x14e6('0x1'));var rp=require(_0x14e6('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x14e6('0x3'))['db'];var logger=require(_0x14e6('0x4'))(_0x14e6('0x5'));function getTranscriptionJob(_0xdcdb2a,_0x1cef29,_0x2b4538,_0x723ba9){return new Promise(function(_0x5ae983,_0x78f960){var _0x9f9c31=new AWS[(_0x14e6('0x6'))]({'accessKeyId':_0x1cef29,'secretAccessKey':_0xdcdb2a,'region':_0x2b4538});_0x9f9c31[_0x14e6('0x7')]({'TranscriptionJobName':_0x723ba9},function(_0x34b4eb,_0x1200e5){if(_0x34b4eb){return _0x78f960(_0x34b4eb);}else{return _0x5ae983(_0x1200e5);}});});}function sentiment(_0x24326b,_0x8c10fd,_0x17eeed,_0x40ce5d,_0x4bc647){return new Promise(function(_0x213bf3,_0x473ed2){var _0x1ae9be=new AWS[(_0x14e6('0x8'))]({'accessKeyId':_0x8c10fd,'secretAccessKey':_0x24326b,'region':_0x17eeed});_0x1ae9be['detectSentiment']({'Text':_0x40ce5d,'LanguageCode':_0x4bc647['substring'](0x0,0x2)},function(_0x53ab5d,_0x4d7ec0){if(_0x53ab5d){return _0x473ed2(_0x53ab5d);}else{return _0x213bf3(_0x4d7ec0);}});});}function checkTranscribeJob(_0x404d21,_0x5de0ea,_0x5a1ced){var _0x128e45;return new BPromise(function(_0x2eea38,_0x3834c2){logger['info'](util[_0x14e6('0x9')](_0x14e6('0xa'),_0x404d21['id'],_0x404d21[_0x14e6('0xb')]));return getTranscriptionJob(_0x5a1ced[_0x14e6('0xc')],_0x5a1ced[_0x14e6('0xd')],_0x5de0ea['transcribeRegion'],_0x404d21[_0x14e6('0xb')])[_0x14e6('0xe')](function(_0x753064){logger[_0x14e6('0xf')](util[_0x14e6('0x9')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x404d21['id'],_0x404d21[_0x14e6('0xb')],_0x753064['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x404d21['fileText']){switch(_0x753064[_0x14e6('0x10')][_0x14e6('0x11')]){case _0x14e6('0x12'):var _0x3423b3={'transcribeStatus':_0x753064['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x753064[_0x14e6('0x10')][_0x14e6('0x13')][_0x14e6('0x14')]};logger[_0x14e6('0xf')](util[_0x14e6('0x9')](_0x14e6('0x15'),_0x404d21['id']));return rp({'uri':_0x753064[_0x14e6('0x10')][_0x14e6('0x13')][_0x14e6('0x14')],'json':!![]})[_0x14e6('0xe')](function(_0x20ea17){logger[_0x14e6('0xf')](util[_0x14e6('0x9')](_0x14e6('0x16'),_0x404d21['id']));if(_0x20ea17&&_0x20ea17[_0x14e6('0x17')]&&_0x20ea17[_0x14e6('0x17')][_0x14e6('0x18')]&&_0x20ea17[_0x14e6('0x17')][_0x14e6('0x18')][_0x14e6('0x19')]){_0x3423b3[_0x14e6('0x1a')]='';for(var _0x4a5084=0x0;_0x4a5084<_0x20ea17[_0x14e6('0x17')][_0x14e6('0x18')][_0x14e6('0x19')];_0x4a5084++){_0x3423b3[_0x14e6('0x1a')]+=_0x20ea17[_0x14e6('0x17')][_0x14e6('0x18')][_0x4a5084][_0x14e6('0x1b')]+'';}}return _0x404d21['update'](_0x3423b3);})[_0x14e6('0xe')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x404d21['id']));if(!_0x404d21[_0x14e6('0x1c')]){throw new db['Sequelize'][(_0x14e6('0x1d'))](_0x14e6('0x1e'));}if(!_0x5de0ea[_0x14e6('0x1f')]||!_0x5de0ea['sentimentAccountId']||!_0x5de0ea[_0x14e6('0x20')]||!_0x5de0ea[_0x14e6('0x21')]||!_0x5de0ea[_0x14e6('0x22')]){throw new db['Sequelize'][(_0x14e6('0x1d'))](_0x14e6('0x23'));}if(!_0x3423b3[_0x14e6('0x1a')]){throw new Error(_0x14e6('0x24'));}if(_0x5de0ea['sentimentAccountId']===_0x5a1ced['id']){return _0x5a1ced;}else{return db[_0x14e6('0x25')]['findOne']({'where':{'id':_settings[_0x14e6('0x26')]}});}})[_0x14e6('0xe')](function(_0x52dafa){if(!_0x52dafa){throw new db[(_0x14e6('0x27'))][(_0x14e6('0x1d'))](_0x14e6('0x28'));}if(!_0x52dafa[_0x14e6('0xc')]||!_0x52dafa['data2']){throw new db[(_0x14e6('0x27'))][(_0x14e6('0x1d'))](_0x14e6('0x29'));}_0x128e45=_0x52dafa;logger[_0x14e6('0xf')](util[_0x14e6('0x9')](_0x14e6('0x2a'),_0x404d21['id']));return sentiment(_0x128e45[_0x14e6('0xc')],_0x128e45['data2'],_0x5de0ea[_0x14e6('0x20')],_0x3423b3[_0x14e6('0x1a')],_0x5de0ea[_0x14e6('0x21')]);})[_0x14e6('0xe')](function(_0x47ecac){logger[_0x14e6('0xf')](util[_0x14e6('0x9')](_0x14e6('0x2b'),_0x404d21['id']));return _0x404d21[_0x14e6('0x2c')]({'sentiment':_0x47ecac[_0x14e6('0x2d')],'sPositive':_0x47ecac[_0x14e6('0x2e')][_0x14e6('0x2f')],'sNegative':_0x47ecac[_0x14e6('0x2e')][_0x14e6('0x30')],'sMixed':_0x47ecac[_0x14e6('0x2e')][_0x14e6('0x31')],'sNeutral':_0x47ecac[_0x14e6('0x2e')]['Neutral']});})[_0x14e6('0xe')](function(){logger[_0x14e6('0xf')](util[_0x14e6('0x9')](_0x14e6('0x32'),_0x404d21['id']));_0x2eea38();});case _0x14e6('0x33'):return _0x404d21[_0x14e6('0x2c')]({'transcribeStatus':_0x14e6('0x33'),'failureReason':_0x753064[_0x14e6('0x10')][_0x14e6('0x34')]})[_0x14e6('0xe')](function(){logger[_0x14e6('0xf')](util[_0x14e6('0x9')](_0x14e6('0x32'),_0x404d21['id']));_0x2eea38();});default:logger[_0x14e6('0xf')](util[_0x14e6('0x9')](_0x14e6('0x35'),_0x404d21['id']));break;}}else{return BPromise[_0x14e6('0x36')]()['then'](function(){if(!_0x404d21[_0x14e6('0x1c')]){throw new db['Sequelize'][(_0x14e6('0x1d'))](_0x14e6('0x1e'));}if(!_0x5de0ea[_0x14e6('0x1f')]||!_0x5de0ea[_0x14e6('0x26')]||!_0x5de0ea['sentimentRegion']||!_0x5de0ea[_0x14e6('0x21')]||!_0x5de0ea[_0x14e6('0x22')]){throw new db['Sequelize'][(_0x14e6('0x1d'))](_0x14e6('0x23'));}if(!_0x404d21[_0x14e6('0x1a')]){throw new Error(_0x14e6('0x24'));}if(_0x5de0ea[_0x14e6('0x26')]===_0x5a1ced['id']){return _0x5a1ced;}else{return db['CloudProvider'][_0x14e6('0x37')]({'where':{'id':_settings[_0x14e6('0x26')]}});}})['then'](function(_0x4a7155){if(!_0x4a7155){throw new db[(_0x14e6('0x27'))][(_0x14e6('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4a7155['data1']||!_0x4a7155[_0x14e6('0xd')]){throw new db[(_0x14e6('0x27'))][(_0x14e6('0x1d'))](_0x14e6('0x29'));}_0x128e45=_0x4a7155;logger[_0x14e6('0xf')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x404d21['id']));return sentiment(_0x128e45['data1'],_0x128e45[_0x14e6('0xd')],_0x5de0ea[_0x14e6('0x20')],_0x404d21[_0x14e6('0x1a')],_0x5de0ea[_0x14e6('0x21')]);})[_0x14e6('0xe')](function(_0x36ba4d){logger[_0x14e6('0xf')](util[_0x14e6('0x9')](_0x14e6('0x2b'),_0x404d21['id']));return _0x404d21[_0x14e6('0x2c')]({'sentiment':_0x36ba4d['Sentiment'],'sPositive':_0x36ba4d[_0x14e6('0x2e')][_0x14e6('0x2f')],'sNegative':_0x36ba4d['SentimentScore'][_0x14e6('0x30')],'sMixed':_0x36ba4d[_0x14e6('0x2e')]['Mixed'],'sNeutral':_0x36ba4d[_0x14e6('0x2e')][_0x14e6('0x38')],'transcribeStatus':_0x14e6('0x12')});})['then'](function(){logger['info'](util[_0x14e6('0x9')](_0x14e6('0x32'),_0x404d21['id']));_0x2eea38();});}})[_0x14e6('0x39')](function(_0x16f205){if(_0x16f205){if(!_0x16f205['name']||_0x16f205[_0x14e6('0x3a')]!==_0x14e6('0x3b')){logger[_0x14e6('0x3c')](util['format'](_0x14e6('0x3d'),_0x404d21['id']),util[_0x14e6('0x3e')](_0x16f205,{'showHidden':![],'depth':null}));}}_0x2eea38();});});}function checkTranscribe(){var _0xb5ad23;var _0x14bc25;var _0x4b26f5;return db[_0x14e6('0x3f')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x14e6('0xe')](function(_0x2e9072){if(!_0x2e9072||!_0x2e9072[_0x14e6('0x19')]){throw new db[(_0x14e6('0x27'))][(_0x14e6('0x1d'))](_0x14e6('0x40'));}_0xb5ad23=_0x2e9072;return db[_0x14e6('0x41')][_0x14e6('0x37')]({'where':{'id':0x1}});})[_0x14e6('0xe')](function(_0x2ccd96){if(!_0x2ccd96){throw new db['Sequelize']['ValidationError']('Settings\x20not\x20available');}_0x14bc25=_0x2ccd96;if(!_0x14bc25[_0x14e6('0x5')]||!_0x14bc25[_0x14e6('0x42')]||!_0x14bc25['transcribeRegion']||!_0x14bc25['language']||!_0x14bc25[_0x14e6('0x22')]){throw new db[(_0x14e6('0x27'))][(_0x14e6('0x1d'))](_0x14e6('0x43'));}return db[_0x14e6('0x25')]['findOne']({'where':{'id':_0x14bc25[_0x14e6('0x42')]}});})[_0x14e6('0xe')](function(_0x3dd00d){if(!_0x3dd00d){throw new db[(_0x14e6('0x27'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x3dd00d[_0x14e6('0xc')]||!_0x3dd00d[_0x14e6('0xd')]){throw new db['Sequelize'][(_0x14e6('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x4b26f5=_0x3dd00d;var _0x1c5d22=[];_0xb5ad23[_0x14e6('0x44')](function(_0x4c030b){_0x1c5d22[_0x14e6('0x45')](checkTranscribeJob(_0x4c030b,_0x14bc25,_0x4b26f5));});return BPromise['all'](_0x1c5d22);})[_0x14e6('0x39')](function(_0x4aeda2){if(_0x4aeda2){if(!_0x4aeda2['name']||_0x4aeda2[_0x14e6('0x3a')]!==_0x14e6('0x3b')){logger[_0x14e6('0x3c')](util['inspect'](_0x4aeda2,{'showHidden':![],'depth':null}));}}});}exports[_0x14e6('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2cb0=['detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','info','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','length','fileText','results','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','Comprehend'];(function(_0x234f92,_0x196e6f){var _0x3d5505=function(_0x404fcf){while(--_0x404fcf){_0x234f92['push'](_0x234f92['shift']());}};_0x3d5505(++_0x196e6f);}(_0x2cb0,0x12c));var _0x02cb=function(_0x332a53,_0x373c39){_0x332a53=_0x332a53-0x0;var _0x55bef1=_0x2cb0[_0x332a53];return _0x55bef1;};var _=require(_0x02cb('0x0'));var AWS=require(_0x02cb('0x1'));var rp=require('request-promise');var util=require(_0x02cb('0x2'));var BPromise=require(_0x02cb('0x3'));var db=require(_0x02cb('0x4'))['db'];var logger=require(_0x02cb('0x5'))('transcribe');function getTranscriptionJob(_0x29575b,_0x179a8b,_0x3f7743,_0x2fb292){return new Promise(function(_0x32cfdf,_0x452212){var _0x291240=new AWS[(_0x02cb('0x6'))]({'accessKeyId':_0x179a8b,'secretAccessKey':_0x29575b,'region':_0x3f7743});_0x291240['getTranscriptionJob']({'TranscriptionJobName':_0x2fb292},function(_0x175b98,_0x294182){if(_0x175b98){return _0x452212(_0x175b98);}else{return _0x32cfdf(_0x294182);}});});}function sentiment(_0x1fa694,_0x43a8d2,_0xcdfc87,_0x5a1efb,_0x1735c8){return new Promise(function(_0x847342,_0x2787a7){var _0x59511e=new AWS[(_0x02cb('0x7'))]({'accessKeyId':_0x43a8d2,'secretAccessKey':_0x1fa694,'region':_0xcdfc87});_0x59511e[_0x02cb('0x8')]({'Text':_0x5a1efb,'LanguageCode':_0x1735c8[_0x02cb('0x9')](0x0,0x2)},function(_0x8a6345,_0x4813fc){if(_0x8a6345){return _0x2787a7(_0x8a6345);}else{return _0x847342(_0x4813fc);}});});}function checkTranscribeJob(_0x2864c3,_0x19b326,_0x403cc9){var _0x6f43c0;return new BPromise(function(_0x45f349,_0x3d4b9c){logger['info'](util[_0x02cb('0xa')](_0x02cb('0xb'),_0x2864c3['id'],_0x2864c3[_0x02cb('0xc')]));return getTranscriptionJob(_0x403cc9['data1'],_0x403cc9[_0x02cb('0xd')],_0x19b326[_0x02cb('0xe')],_0x2864c3[_0x02cb('0xc')])[_0x02cb('0xf')](function(_0x1c88aa){logger['info'](util['format'](_0x02cb('0x10'),_0x2864c3['id'],_0x2864c3[_0x02cb('0xc')],_0x1c88aa[_0x02cb('0x11')][_0x02cb('0x12')]));if(!_0x2864c3['fileText']){switch(_0x1c88aa[_0x02cb('0x11')]['TranscriptionJobStatus']){case _0x02cb('0x13'):var _0x4cbb03={'transcribeStatus':_0x1c88aa[_0x02cb('0x11')][_0x02cb('0x12')],'fileUri':_0x1c88aa[_0x02cb('0x11')]['Transcript'][_0x02cb('0x14')]};logger['info'](util[_0x02cb('0xa')](_0x02cb('0x15'),_0x2864c3['id']));return rp({'uri':_0x1c88aa[_0x02cb('0x11')][_0x02cb('0x16')][_0x02cb('0x14')],'json':!![]})[_0x02cb('0xf')](function(_0x4c7bfe){logger[_0x02cb('0x17')](util[_0x02cb('0xa')](_0x02cb('0x18'),_0x2864c3['id']));if(_0x4c7bfe&&_0x4c7bfe['results']&&_0x4c7bfe['results']['transcripts']&&_0x4c7bfe['results'][_0x02cb('0x19')][_0x02cb('0x1a')]){_0x4cbb03[_0x02cb('0x1b')]='';for(var _0x267b0f=0x0;_0x267b0f<_0x4c7bfe[_0x02cb('0x1c')][_0x02cb('0x19')][_0x02cb('0x1a')];_0x267b0f++){_0x4cbb03[_0x02cb('0x1b')]+=_0x4c7bfe[_0x02cb('0x1c')]['transcripts'][_0x267b0f][_0x02cb('0x1d')]+'';}}return _0x2864c3[_0x02cb('0x1e')](_0x4cbb03);})[_0x02cb('0xf')](function(){logger[_0x02cb('0x17')](util[_0x02cb('0xa')](_0x02cb('0x1f'),_0x2864c3['id']));if(!_0x2864c3[_0x02cb('0x20')]){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x19b326['sentiment']||!_0x19b326[_0x02cb('0x23')]||!_0x19b326[_0x02cb('0x24')]||!_0x19b326[_0x02cb('0x25')]||!_0x19b326[_0x02cb('0x26')]){throw new db[(_0x02cb('0x21'))]['ValidationError'](_0x02cb('0x27'));}if(!_0x4cbb03['fileText']){throw new Error(_0x02cb('0x28'));}if(_0x19b326['sentimentAccountId']===_0x403cc9['id']){return _0x403cc9;}else{return db[_0x02cb('0x29')][_0x02cb('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3585f3){if(!_0x3585f3){throw new db['Sequelize']['ValidationError'](_0x02cb('0x2b'));}if(!_0x3585f3['data1']||!_0x3585f3[_0x02cb('0xd')]){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))](_0x02cb('0x2c'));}_0x6f43c0=_0x3585f3;logger[_0x02cb('0x17')](util[_0x02cb('0xa')](_0x02cb('0x2d'),_0x2864c3['id']));return sentiment(_0x6f43c0[_0x02cb('0x2e')],_0x6f43c0[_0x02cb('0xd')],_0x19b326[_0x02cb('0x24')],_0x4cbb03[_0x02cb('0x1b')],_0x19b326[_0x02cb('0x25')]);})['then'](function(_0x5b35ea){logger[_0x02cb('0x17')](util[_0x02cb('0xa')](_0x02cb('0x2f'),_0x2864c3['id']));return _0x2864c3[_0x02cb('0x1e')]({'sentiment':_0x5b35ea[_0x02cb('0x30')],'sPositive':_0x5b35ea[_0x02cb('0x31')][_0x02cb('0x32')],'sNegative':_0x5b35ea[_0x02cb('0x31')][_0x02cb('0x33')],'sMixed':_0x5b35ea[_0x02cb('0x31')][_0x02cb('0x34')],'sNeutral':_0x5b35ea[_0x02cb('0x31')][_0x02cb('0x35')]});})[_0x02cb('0xf')](function(){logger[_0x02cb('0x17')](util['format'](_0x02cb('0x1f'),_0x2864c3['id']));_0x45f349();});case _0x02cb('0x36'):return _0x2864c3[_0x02cb('0x1e')]({'transcribeStatus':_0x02cb('0x36'),'failureReason':_0x1c88aa[_0x02cb('0x11')][_0x02cb('0x37')]})['then'](function(){logger['info'](util[_0x02cb('0xa')](_0x02cb('0x1f'),_0x2864c3['id']));_0x45f349();});default:logger[_0x02cb('0x17')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2864c3['id']));break;}}else{return BPromise[_0x02cb('0x38')]()['then'](function(){if(!_0x2864c3[_0x02cb('0x20')]){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))](_0x02cb('0x39'));}if(!_0x19b326[_0x02cb('0x3a')]||!_0x19b326[_0x02cb('0x23')]||!_0x19b326[_0x02cb('0x24')]||!_0x19b326[_0x02cb('0x25')]||!_0x19b326['bucket']){throw new db['Sequelize'][(_0x02cb('0x22'))](_0x02cb('0x27'));}if(!_0x2864c3['fileText']){throw new Error(_0x02cb('0x28'));}if(_0x19b326[_0x02cb('0x23')]===_0x403cc9['id']){return _0x403cc9;}else{return db[_0x02cb('0x29')]['findOne']({'where':{'id':_settings[_0x02cb('0x23')]}});}})[_0x02cb('0xf')](function(_0x14981f){if(!_0x14981f){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x14981f[_0x02cb('0x2e')]||!_0x14981f[_0x02cb('0xd')]){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))](_0x02cb('0x2c'));}_0x6f43c0=_0x14981f;logger['info'](util['format'](_0x02cb('0x2d'),_0x2864c3['id']));return sentiment(_0x6f43c0['data1'],_0x6f43c0[_0x02cb('0xd')],_0x19b326['sentimentRegion'],_0x2864c3[_0x02cb('0x1b')],_0x19b326[_0x02cb('0x25')]);})[_0x02cb('0xf')](function(_0x2a9346){logger[_0x02cb('0x17')](util[_0x02cb('0xa')](_0x02cb('0x2f'),_0x2864c3['id']));return _0x2864c3['update']({'sentiment':_0x2a9346[_0x02cb('0x30')],'sPositive':_0x2a9346[_0x02cb('0x31')][_0x02cb('0x32')],'sNegative':_0x2a9346['SentimentScore'][_0x02cb('0x33')],'sMixed':_0x2a9346[_0x02cb('0x31')][_0x02cb('0x34')],'sNeutral':_0x2a9346[_0x02cb('0x31')][_0x02cb('0x35')],'transcribeStatus':_0x02cb('0x13')});})[_0x02cb('0xf')](function(){logger['info'](util[_0x02cb('0xa')](_0x02cb('0x1f'),_0x2864c3['id']));_0x45f349();});}})[_0x02cb('0x3b')](function(_0xc77a54){if(_0xc77a54){if(!_0xc77a54[_0x02cb('0x3c')]||_0xc77a54[_0x02cb('0x3c')]!==_0x02cb('0x3d')){logger[_0x02cb('0x3e')](util['format'](_0x02cb('0x3f'),_0x2864c3['id']),util[_0x02cb('0x40')](_0xc77a54,{'showHidden':![],'depth':null}));}}_0x45f349();});});}function checkTranscribe(){var _0x3182c5;var _0x58c10c;var _0x41927f;return db[_0x02cb('0x41')][_0x02cb('0x42')]({'where':{'transcribeStatus':_0x02cb('0x43')}})[_0x02cb('0xf')](function(_0xc33f25){if(!_0xc33f25||!_0xc33f25[_0x02cb('0x1a')]){throw new db[(_0x02cb('0x21'))][(_0x02cb('0x22'))](_0x02cb('0x44'));}_0x3182c5=_0xc33f25;return db['Setting'][_0x02cb('0x2a')]({'where':{'id':0x1}});})[_0x02cb('0xf')](function(_0x163571){if(!_0x163571){throw new db['Sequelize'][(_0x02cb('0x22'))](_0x02cb('0x45'));}_0x58c10c=_0x163571;if(!_0x58c10c[_0x02cb('0x46')]||!_0x58c10c[_0x02cb('0x47')]||!_0x58c10c[_0x02cb('0xe')]||!_0x58c10c[_0x02cb('0x25')]||!_0x58c10c[_0x02cb('0x26')]){throw new db[(_0x02cb('0x21'))]['ValidationError'](_0x02cb('0x48'));}return db['CloudProvider'][_0x02cb('0x2a')]({'where':{'id':_0x58c10c[_0x02cb('0x47')]}});})[_0x02cb('0xf')](function(_0x50dcb3){if(!_0x50dcb3){throw new db['Sequelize'][(_0x02cb('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x50dcb3[_0x02cb('0x2e')]||!_0x50dcb3[_0x02cb('0xd')]){throw new db['Sequelize'][(_0x02cb('0x22'))](_0x02cb('0x2c'));}_0x41927f=_0x50dcb3;var _0x3de4ee=[];_0x3182c5[_0x02cb('0x49')](function(_0x2ca600){_0x3de4ee[_0x02cb('0x4a')](checkTranscribeJob(_0x2ca600,_0x58c10c,_0x41927f));});return BPromise[_0x02cb('0x4b')](_0x3de4ee);})[_0x02cb('0x3b')](function(_0x2f1b44){if(_0x2f1b44){if(!_0x2f1b44[_0x02cb('0x3c')]||_0x2f1b44['name']!==_0x02cb('0x3d')){logger[_0x02cb('0x3e')](util[_0x02cb('0x40')](_0x2f1b44,{'showHidden':![],'depth':null}));}}});}exports[_0x02cb('0x4c')]=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 df7f3ed..bc01a89 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 _0x17bb=['WhatsappInteraction','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','util','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','socket.io-emitter'];(function(_0x3e671c,_0x1b41fd){var _0x271c6c=function(_0x25d639){while(--_0x25d639){_0x3e671c['push'](_0x3e671c['shift']());}};_0x271c6c(++_0x1b41fd);}(_0x17bb,0x80));var _0xb17b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x17bb[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xb17b('0x0'));var moment=require(_0xb17b('0x1'));var Redis=require('ioredis');var util=require(_0xb17b('0x2'));var config=require(_0xb17b('0x3'));var db=require(_0xb17b('0x4'))['db'];var logger=require(_0xb17b('0x5'))('schedule');config['redis']=_[_0xb17b('0x6')](config[_0xb17b('0x7')],{'host':_0xb17b('0x8'),'port':0x18eb});var io=require(_0xb17b('0x9'))(new Redis(config[_0xb17b('0x7')]));function closeInteractions(){var _0x33e131=[];return db[_0xb17b('0xa')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb17b('0xb')](0x18,'hours')}}})[_0xb17b('0xc')](function(_0x24981a){if(_0x24981a&&_0x24981a[_0xb17b('0xd')]){_0x33e131=_[_0xb17b('0xe')](_0x24981a||[],'id');logger['info'](_0xb17b('0xf'),_0x33e131[_0xb17b('0x10')]());return db[_0xb17b('0xa')]['update']({'closeReason':_0xb17b('0x11'),'disposition':_0xb17b('0x12'),'closed':!![],'closedAt':moment()[_0xb17b('0x13')](_0xb17b('0x14'))},{'where':{'id':_0x33e131}});}})[_0xb17b('0xc')](function(){if(_0x33e131&&_0x33e131[_0xb17b('0xd')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x33e131['join']());for(var _0x55dc56=0x0;_0x55dc56<_0x33e131[_0xb17b('0xd')];_0x55dc56++){io[_0xb17b('0x15')]('whatsappInteraction:update',{'id':_0x33e131[_0x55dc56],'closed':!![]});}}})['catch'](function(_0x315d8f){logger['error'](_0xb17b('0x16'),_0x315d8f?util['inspect'](_0x315d8f,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9c7f=['lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment','../../mysqldb','../logger','defaults','localhost','socket.io-emitter','findAll'];(function(_0x31a7b5,_0x307d8a){var _0x3ed7c5=function(_0x5d16f9){while(--_0x5d16f9){_0x31a7b5['push'](_0x31a7b5['shift']());}};_0x3ed7c5(++_0x307d8a);}(_0x9c7f,0x157));var _0xf9c7=function(_0x133ea1,_0x337441){_0x133ea1=_0x133ea1-0x0;var _0xaa1252=_0x9c7f[_0x133ea1];return _0xaa1252;};'use strict';var _=require(_0xf9c7('0x0'));var moment=require(_0xf9c7('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xf9c7('0x2'));var db=require(_0xf9c7('0x3'))['db'];var logger=require(_0xf9c7('0x4'))('schedule');config['redis']=_[_0xf9c7('0x5')](config['redis'],{'host':_0xf9c7('0x6'),'port':0x18eb});var io=require(_0xf9c7('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x374485=[];return db['WhatsappInteraction'][_0xf9c7('0x8')]({'raw':!![],'attributes':['id',_0xf9c7('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf9c7('0xa')](0x18,_0xf9c7('0xb'))}}})[_0xf9c7('0xc')](function(_0x1556f7){if(_0x1556f7&&_0x1556f7[_0xf9c7('0xd')]){_0x374485=_[_0xf9c7('0xe')](_0x1556f7||[],'id');logger[_0xf9c7('0xf')](_0xf9c7('0x10'),_0x374485[_0xf9c7('0x11')]());return db[_0xf9c7('0x12')][_0xf9c7('0x13')]({'closeReason':_0xf9c7('0x14'),'disposition':_0xf9c7('0x15'),'closed':!![],'closedAt':moment()[_0xf9c7('0x16')](_0xf9c7('0x17'))},{'where':{'id':_0x374485}});}})[_0xf9c7('0xc')](function(){if(_0x374485&&_0x374485['length']){logger[_0xf9c7('0xf')](_0xf9c7('0x18'),_0x374485['join']());for(var _0x26f048=0x0;_0x26f048<_0x374485[_0xf9c7('0xd')];_0x26f048++){io[_0xf9c7('0x19')](_0xf9c7('0x1a'),{'id':_0x374485[_0x26f048],'closed':!![]});}}})[_0xf9c7('0x1b')](function(_0x480f21){logger[_0xf9c7('0x1c')](_0xf9c7('0x1d'),_0x480f21?util[_0xf9c7('0x1e')](_0x480f21,{'showHidden':![],'depth':null}):'');});}exports[_0xf9c7('0x1f')]=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 0304ea0..d7088bf 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe502=['log','CmHopper','hopper1','finished\x20populating','hopper2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','CmContact','bulkCreate','then'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xe502,0x17c));var _0x2e50=function(_0x124fb8,_0x5af767){_0x124fb8=_0x124fb8-0x0;var _0x5ecd0f=_0xe502[_0x124fb8];return _0x5ecd0f;};'use strict';var util=require('util');var db=require(_0x2e50('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2e50('0x1')]({'id':i,'firstName':_0x2e50('0x2')+i,'lastName':_0x2e50('0x3')+i,'phone':0xf879fb460+i,'email':_0x2e50('0x4')+i+_0x2e50('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x2e50('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2e50('0x6')](),'updatedAt':Date[_0x2e50('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x2e50('0x3')+i,'phone':0xf879fb460+i,'email':_0x2e50('0x4')+i+_0x2e50('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2e50('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x2e50('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2e50('0x6')](),'updatedAt':Date['now']()});}db['CmContact'][_0x2e50('0x7')]({'where':{}})['then'](function(){return db[_0x2e50('0x8')][_0x2e50('0x9')](contacts);})[_0x2e50('0xa')](function(){console[_0x2e50('0xb')]('finished\x20populating','contacts1');return db[_0x2e50('0xc')]['destroy']({'where':{}});})[_0x2e50('0xa')](function(){return db['CmHopper'][_0x2e50('0x9')](hopper);})[_0x2e50('0xa')](function(){console[_0x2e50('0xb')]('finished\x20populating',_0x2e50('0xd'));return db[_0x2e50('0x8')]['bulkCreate'](contacts2);})[_0x2e50('0xa')](function(){console[_0x2e50('0xb')](_0x2e50('0xe'),'contacts2');return db[_0x2e50('0xc')][_0x2e50('0x9')](hopper2);})[_0x2e50('0xa')](function(){console[_0x2e50('0xb')](_0x2e50('0xe'),_0x2e50('0xf'));})[_0x2e50('0x10')](function(_0xd09178){console[_0x2e50('0xb')](_0xd09178);}); \ No newline at end of file +var _0x87a5=['hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','then','bulkCreate','CmHopper','destroy','log','finished\x20populating'];(function(_0x12af14,_0x135bc5){var _0x100286=function(_0x49ba84){while(--_0x49ba84){_0x12af14['push'](_0x12af14['shift']());}};_0x100286(++_0x135bc5);}(_0x87a5,0xee));var _0x587a=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0x87a5[_0x32729c];return _0x482cfd;};'use strict';var util=require(_0x587a('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x587a('0x1')]({'id':i,'firstName':_0x587a('0x2')+i,'lastName':_0x587a('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x587a('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x587a('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x587a('0x5')](),'updatedAt':Date[_0x587a('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x587a('0x1')]({'id':i,'firstName':_0x587a('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x587a('0x6')+i+_0x587a('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x587a('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x587a('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x587a('0x5')](),'updatedAt':Date[_0x587a('0x5')]()});}db[_0x587a('0x7')]['destroy']({'where':{}})[_0x587a('0x8')](function(){return db[_0x587a('0x7')][_0x587a('0x9')](contacts);})[_0x587a('0x8')](function(){console['log']('finished\x20populating','contacts1');return db[_0x587a('0xa')][_0x587a('0xb')]({'where':{}});})[_0x587a('0x8')](function(){return db[_0x587a('0xa')][_0x587a('0x9')](hopper);})[_0x587a('0x8')](function(){console[_0x587a('0xc')](_0x587a('0xd'),_0x587a('0xe'));return db[_0x587a('0x7')]['bulkCreate'](contacts2);})['then'](function(){console[_0x587a('0xc')](_0x587a('0xd'),_0x587a('0xf'));return db[_0x587a('0xa')][_0x587a('0x9')](hopper2);})[_0x587a('0x8')](function(){console['log'](_0x587a('0xd'),_0x587a('0x10'));})[_0x587a('0x11')](function(_0x15f82c){console['log'](_0x15f82c);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 719b676..b28b737 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x693a=['friend','wss','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password'];(function(_0x1e5d56,_0x8a4924){var _0x37f85b=function(_0x250679){while(--_0x250679){_0x1e5d56['push'](_0x1e5d56['shift']());}};_0x37f85b(++_0x8a4924);}(_0x693a,0x19c));var _0xa693=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x693a[_0x20d54d];return _0x516e8b;};'use strict';var util=require(_0xa693('0x0'));var db=require(_0xa693('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa693('0x2')]({'name':util[_0xa693('0x3')](_0xa693('0x4'),_0xa693('0x5'),i),'fullname':util['format']('%s%s','agent',i),'email':util[_0xa693('0x3')](_0xa693('0x6'),_0xa693('0x5'),i),'role':_0xa693('0x5'),'password':_0xa693('0x7'),'internal':0xfa0+i,'type':_0xa693('0x8'),'transport':['udp','ws',_0xa693('0x9')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0xa693('0x3')](_0xa693('0x4'),_0xa693('0x5'),i),'encryption':_0xa693('0xa'),'avpf':_0xa693('0xa'),'force_avp':'yes','icesupport':_0xa693('0xa'),'dtlsenable':_0xa693('0xa'),'dtlsverify':'no','dtlscertfile':_0xa693('0xb'),'dtlsprivatekey':_0xa693('0xc'),'dtlssetup':_0xa693('0xd'),'callerid':util[_0xa693('0x3')]('\x22%s\x22\x20<%s>',util[_0xa693('0x3')](_0xa693('0x4'),'agent',i),0xfa0+i)});}db[_0xa693('0xe')][_0xa693('0xf')](users)[_0xa693('0x10')](function(){console[_0xa693('0x11')](_0xa693('0x12'));})[_0xa693('0x13')](function(_0x3d629e){console['log'](_0x3d629e);}); \ No newline at end of file +var _0x08b1=['add\x20user','catch','util','../mysqldb','push','agent','format','%s%s','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','log'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x08b1,0x162));var _0x108b=function(_0x158fc8,_0x52d917){_0x158fc8=_0x158fc8-0x0;var _0x16584f=_0x08b1[_0x158fc8];return _0x16584f;};'use strict';var util=require(_0x108b('0x0'));var db=require(_0x108b('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x108b('0x2')]({'name':util['format']('%s%s',_0x108b('0x3'),i),'fullname':util[_0x108b('0x4')](_0x108b('0x5'),_0x108b('0x3'),i),'email':util[_0x108b('0x4')](_0x108b('0x6'),_0x108b('0x3'),i),'role':_0x108b('0x3'),'password':_0x108b('0x7'),'internal':0xfa0+i,'type':_0x108b('0x8'),'transport':[_0x108b('0x9'),'ws',_0x108b('0xa')],'disallow':[_0x108b('0xb')],'allow':[_0x108b('0xc')],'defaultuser':util[_0x108b('0x4')](_0x108b('0x5'),_0x108b('0x3'),i),'encryption':_0x108b('0xd'),'avpf':'yes','force_avp':_0x108b('0xd'),'icesupport':_0x108b('0xd'),'dtlsenable':_0x108b('0xd'),'dtlsverify':'no','dtlscertfile':_0x108b('0xe'),'dtlsprivatekey':_0x108b('0xf'),'dtlssetup':'actpass','callerid':util[_0x108b('0x4')](_0x108b('0x10'),util[_0x108b('0x4')](_0x108b('0x5'),_0x108b('0x3'),i),0xfa0+i)});}db[_0x108b('0x11')][_0x108b('0x12')](users)['then'](function(){console[_0x108b('0x13')](_0x108b('0x14'));})[_0x108b('0x15')](function(_0xa4fc40){console[_0x108b('0x13')](_0xa4fc40);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3455ccb..2d6020e 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba6f=['where','Campaign','ivr','format','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','Trunks','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','request','remoteAddress','remotePort','SocketIO\x20','address','disconnect','lodash','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','map'];(function(_0x53ff8d,_0x53b3f8){var _0x36ae29=function(_0x31e1f6){while(--_0x31e1f6){_0x53ff8d['push'](_0x53ff8d['shift']());}};_0x36ae29(++_0x53b3f8);}(_0xba6f,0x1d0));var _0xfba6=function(_0x2a8122,_0xd957e){_0x2a8122=_0x2a8122-0x0;var _0x49a5c7=_0xba6f[_0x2a8122];return _0x49a5c7;};'use strict';var _=require(_0xfba6('0x0'));var util=require('util');var BPromise=require(_0xfba6('0x1'));var db=require(_0xfba6('0x2'))['db'];var config=require(_0xfba6('0x3'));var queryQueues={'attributes':['id',_0xfba6('0x4')],'include':[{'as':_0xfba6('0x5'),'model':db[_0xfba6('0x6')],'attributes':['id',_0xfba6('0x4'),_0xfba6('0x7')],'raw':!![],'where':{'role':_0xfba6('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xfba6('0x4')],'where':{'role':_0xfba6('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xfba6('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xfba6('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xfba6('0x4'),_0xfba6('0xa')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4b4789,_0x5b4f54,_0x3effea){return db[_0xfba6('0xb')][_0xfba6('0xc')]({'where':{'name':_0x4b4789,'userProfileId':_0x5b4f54},'raw':!![]})[_0xfba6('0xd')](function(_0x1ef8fd){if(_0x1ef8fd){if(_0x1ef8fd[_0xfba6('0xe')]){switch(_0x4b4789){case _0xfba6('0xf'):case _0xfba6('0x10'):case _0xfba6('0x11'):case _0xfba6('0x12'):case _0xfba6('0x13'):case'OpenchannelQueues':case _0xfba6('0x14'):return db[_0x3effea][_0xfba6('0x15')](queryQueues);case _0xfba6('0x16'):return db[_0x3effea][_0xfba6('0x15')](queryTelephones);case'Trunks':return db[_0x3effea][_0xfba6('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x3effea]['findAll'](queryCampaigns);}}else{return db[_0xfba6('0x17')][_0xfba6('0x15')]({'attributes':[_0xfba6('0x18')],'where':{'sectionId':_0x1ef8fd['id']},'raw':!![]})[_0xfba6('0xd')](function(_0x38055e){if(_0x38055e){var _0x2c4692={'where':{'id':_[_0xfba6('0x19')](_0x38055e,_0xfba6('0x18'))},'raw':!![]};switch(_0x3effea){case _0xfba6('0x6'):_0x2c4692[_0xfba6('0x1a')][_0xfba6('0x7')]=_0xfba6('0x9');break;case _0xfba6('0x1b'):_0x2c4692['where'][_0xfba6('0xa')]=_0xfba6('0x1c');break;}return db[_0x3effea]['findAll'](_0x2c4692);}else{return[];}});}}else{return[];}})['then'](function(_0x1fc324){return _0x1fc324;});}function joinOrLeaveQueues(_0x204784,_0x5b382f,_0x14990f,_0x400aa4){_0x204784[_0x5b382f](util[_0xfba6('0x1d')]('%s:queue:%s',_0x14990f,_0x400aa4[_0xfba6('0x4')]));if(_0x400aa4[_0xfba6('0x5')]){for(var _0xa16868=0x0;_0xa16868<_0x400aa4['Agents'][_0xfba6('0x1e')];_0xa16868+=0x1){_0x204784[_0x5b382f](util[_0xfba6('0x1d')](_0xfba6('0x1f'),_0x400aa4[_0xfba6('0x5')][_0xa16868][_0xfba6('0x4')]));}}}function joinOrLeave(_0x444856,_0x203a4e,_0x56b427){var _0x5e09ff;if(_0x444856[_0xfba6('0x20')][_0xfba6('0x21')]['id']){db[_0xfba6('0x6')][_0xfba6('0x22')]({'attributes':['id',_0xfba6('0x4'),'role',_0xfba6('0x23')],'where':{'id':_0x444856[_0xfba6('0x20')][_0xfba6('0x21')]['id']},'include':[{'model':db[_0xfba6('0x24')],'as':_0xfba6('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xfba6('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xfba6('0x27')],'as':_0xfba6('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xfba6('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xfba6('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xfba6('0x2b')],'as':_0xfba6('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x47973f){if(_0x47973f){_0x5e09ff=_0x47973f;_0x444856[_0x203a4e](util['format'](_0xfba6('0x1f'),_0x47973f[_0xfba6('0x4')]));var _0x24e860=[];switch(_0x47973f['role']){case _0xfba6('0x2d'):_0x444856[_0x203a4e](_0xfba6('0x2e'));_0x444856[_0x203a4e](_0xfba6('0x2f'));if(queryQueues[_0xfba6('0x30')]('include')){delete queryQueues[_0xfba6('0x31')];}_0x24e860['push'](db[_0xfba6('0x32')][_0xfba6('0x15')](queryQueues));_0x24e860[_0xfba6('0x33')](db[_0xfba6('0x34')][_0xfba6('0x15')](queryQueues));_0x24e860['push'](db[_0xfba6('0x35')][_0xfba6('0x15')](queryQueues));_0x24e860['push'](db[_0xfba6('0x36')][_0xfba6('0x15')](queryQueues));_0x24e860[_0xfba6('0x33')](db[_0xfba6('0x37')][_0xfba6('0x15')](queryQueues));_0x24e860[_0xfba6('0x33')](db[_0xfba6('0x38')][_0xfba6('0x15')](queryQueues));_0x24e860[_0xfba6('0x33')](db[_0xfba6('0x39')][_0xfba6('0x15')](queryQueues));_0x24e860[_0xfba6('0x33')](db['User'][_0xfba6('0x15')](queryTelephones));_0x24e860[_0xfba6('0x33')](db[_0xfba6('0x3a')][_0xfba6('0x15')](queryTrunks));_0x24e860[_0xfba6('0x33')](db[_0xfba6('0x1b')][_0xfba6('0x15')](queryCampaigns));_0x24e860[_0xfba6('0x33')](db[_0xfba6('0x6')][_0xfba6('0x15')](queryAgents));break;case _0xfba6('0x3b'):_0x444856[_0x203a4e]('voice:inbound');_0x444856[_0x203a4e](_0xfba6('0x2f'));_0x24e860['push'](getAssociatedResources(_0xfba6('0xf'),_0x47973f[_0xfba6('0x23')],_0xfba6('0x32')));_0x24e860[_0xfba6('0x33')](getAssociatedResources(_0xfba6('0x10'),_0x47973f[_0xfba6('0x23')],_0xfba6('0x34')));_0x24e860[_0xfba6('0x33')](getAssociatedResources('FaxQueues',_0x47973f[_0xfba6('0x23')],_0xfba6('0x35')));_0x24e860['push'](getAssociatedResources(_0xfba6('0x12'),_0x47973f['userProfileId'],_0xfba6('0x36')));_0x24e860[_0xfba6('0x33')](getAssociatedResources('MailQueues',_0x47973f[_0xfba6('0x23')],_0xfba6('0x37')));_0x24e860[_0xfba6('0x33')](getAssociatedResources('OpenchannelQueues',_0x47973f[_0xfba6('0x23')],_0xfba6('0x38')));_0x24e860[_0xfba6('0x33')](getAssociatedResources(_0xfba6('0x14'),_0x47973f[_0xfba6('0x23')],_0xfba6('0x39')));_0x24e860['push'](getAssociatedResources(_0xfba6('0x16'),_0x47973f[_0xfba6('0x23')],_0xfba6('0x6')));_0x24e860[_0xfba6('0x33')](getAssociatedResources(_0xfba6('0x3c'),_0x47973f[_0xfba6('0x23')],_0xfba6('0x3a')));_0x24e860[_0xfba6('0x33')](getAssociatedResources('IvrCampaigns',_0x47973f['userProfileId'],_0xfba6('0x1b')));_0x24e860['push'](db[_0xfba6('0x6')][_0xfba6('0x15')](queryAgents));break;case _0xfba6('0x8'):_0x444856[_0x203a4e](_0xfba6('0x2e'));_0x444856[_0x203a4e]('voice:outbound');_0x24e860[_0xfba6('0x33')](_0x47973f['getVoiceQueues']({'attributes':['id',_0xfba6('0x4')]}));_0x24e860['push'](_0x47973f[_0xfba6('0x3d')]({'attributes':['id',_0xfba6('0x4')]}));_0x24e860[_0xfba6('0x33')](_0x47973f[_0xfba6('0x3e')]({'attributes':['id',_0xfba6('0x4')]}));_0x24e860[_0xfba6('0x33')](_0x47973f[_0xfba6('0x3f')]({'attributes':['id',_0xfba6('0x4')]}));_0x24e860[_0xfba6('0x33')](_0x47973f['getMailQueues']({'attributes':['id',_0xfba6('0x4')]}));_0x24e860[_0xfba6('0x33')](_0x47973f[_0xfba6('0x40')]({'attributes':['id',_0xfba6('0x4')]}));_0x24e860[_0xfba6('0x33')](_0x47973f[_0xfba6('0x41')]({'attributes':['id',_0xfba6('0x4')]}));break;}return BPromise[_0xfba6('0x42')](_0x24e860);}})[_0xfba6('0xd')](function(_0x251bbc){if(_0x251bbc&&_0x251bbc[_0xfba6('0x1e')]){for(var _0x31c30c=0x0;_0x31c30c<_0x251bbc[_0xfba6('0x1e')];_0x31c30c+=0x1){for(var _0x319637=0x0;_0x319637<_0x251bbc[_0x31c30c][_0xfba6('0x1e')];_0x319637+=0x1){switch(_0x31c30c){case 0x0:joinOrLeaveQueues(_0x444856,_0x203a4e,'voice',_0x251bbc[_0x31c30c][_0x319637]);break;case 0x1:joinOrLeaveQueues(_0x444856,_0x203a4e,_0xfba6('0x43'),_0x251bbc[_0x31c30c][_0x319637]);break;case 0x2:joinOrLeaveQueues(_0x444856,_0x203a4e,_0xfba6('0x44'),_0x251bbc[_0x31c30c][_0x319637]);break;case 0x3:joinOrLeaveQueues(_0x444856,_0x203a4e,_0xfba6('0x45'),_0x251bbc[_0x31c30c][_0x319637]);break;case 0x4:joinOrLeaveQueues(_0x444856,_0x203a4e,_0xfba6('0x46'),_0x251bbc[_0x31c30c][_0x319637]);break;case 0x5:joinOrLeaveQueues(_0x444856,_0x203a4e,_0xfba6('0x47'),_0x251bbc[_0x31c30c][_0x319637]);break;case 0x6:joinOrLeaveQueues(_0x444856,_0x203a4e,_0xfba6('0x48'),_0x251bbc[_0x31c30c][_0x319637]);break;case 0x7:if(_0x5e09ff[_0xfba6('0x7')]!==_0xfba6('0x8'))_0x444856[_0x203a4e](util['format']('telephone:%s',_0x251bbc[_0x31c30c][_0x319637][_0xfba6('0x4')]));break;case 0x8:if(_0x5e09ff[_0xfba6('0x7')]!==_0xfba6('0x8'))_0x444856[_0x203a4e](util[_0xfba6('0x1d')](_0xfba6('0x49'),_0x251bbc[_0x31c30c][_0x319637]['name']));break;case 0x9:if(_0x5e09ff['role']!==_0xfba6('0x8'))_0x444856[_0x203a4e](util[_0xfba6('0x1d')]('campaign:%s:%s',_0x251bbc[_0x31c30c][_0x319637][_0xfba6('0xa')],_0x251bbc[_0x31c30c][_0x319637][_0xfba6('0x4')]));break;case 0xa:_0x444856[_0x203a4e](util[_0xfba6('0x1d')]('user:%s',_0x251bbc[_0x31c30c][_0x319637][_0xfba6('0x4')]));break;}}}}})['then'](function(){if(_0x203a4e===_0xfba6('0x4a')){var _0x1a68b3=_[_0xfba6('0x19')](_0x5e09ff[_0xfba6('0x25')],'id');return _0x5e09ff[_0xfba6('0x4b')](_0x1a68b3)[_0xfba6('0xd')](function(){for(var _0x37b571=0x0;_0x37b571<_0x1a68b3[_0xfba6('0x1e')];_0x37b571+=0x1){_0x56b427[_0xfba6('0x4c')](_0xfba6('0x4d'),{'ChatInteractionId':Number(_0x1a68b3[_0x37b571]),'UserId':Number(_0x5e09ff['id'])});}});}})[_0xfba6('0xd')](function(){if(_0x203a4e===_0xfba6('0x4a')){var _0x1173d8=_['map'](_0x5e09ff[_0xfba6('0x4e')],'id');return _0x5e09ff['removeMailInteractions'](_0x1173d8)[_0xfba6('0xd')](function(){for(var _0x327833=0x0;_0x327833<_0x1173d8['length'];_0x327833+=0x1){_0x56b427[_0xfba6('0x4c')](_0xfba6('0x4f'),{'MailInteractionId':Number(_0x1173d8[_0x327833]),'UserId':Number(_0x5e09ff['id'])});}});}})[_0xfba6('0xd')](function(){if(_0x203a4e===_0xfba6('0x4a')){var _0x7a6bf1=_[_0xfba6('0x19')](_0x5e09ff[_0xfba6('0x28')],'id');return _0x5e09ff[_0xfba6('0x50')](_0x7a6bf1)[_0xfba6('0xd')](function(){for(var _0x50ee4c=0x0;_0x50ee4c<_0x7a6bf1[_0xfba6('0x1e')];_0x50ee4c+=0x1){_0x56b427[_0xfba6('0x4c')](_0xfba6('0x51'),{'FaxInteractionId':Number(_0x7a6bf1[_0x50ee4c]),'UserId':Number(_0x5e09ff['id'])});}});}})[_0xfba6('0xd')](function(){if(_0x203a4e===_0xfba6('0x4a')){var _0xea7c3b=_[_0xfba6('0x19')](_0x5e09ff[_0xfba6('0x29')],'id');return _0x5e09ff[_0xfba6('0x52')](_0xea7c3b)[_0xfba6('0xd')](function(){for(var _0xfa4398=0x0;_0xfa4398<_0xea7c3b[_0xfba6('0x1e')];_0xfa4398+=0x1){_0x56b427[_0xfba6('0x4c')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0xea7c3b[_0xfa4398]),'UserId':Number(_0x5e09ff['id'])});}});}})[_0xfba6('0xd')](function(){if(_0x203a4e===_0xfba6('0x4a')){var _0x48b937=_[_0xfba6('0x19')](_0x5e09ff[_0xfba6('0x53')],'id');return _0x5e09ff[_0xfba6('0x54')](_0x48b937)[_0xfba6('0xd')](function(){for(var _0x2eb0e7=0x0;_0x2eb0e7<_0x48b937[_0xfba6('0x1e')];_0x2eb0e7+=0x1){_0x56b427[_0xfba6('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x48b937[_0x2eb0e7]),'UserId':Number(_0x5e09ff['id'])});}});}})['then'](function(){if(_0x203a4e==='leave'){var _0x5832fb=_[_0xfba6('0x19')](_0x5e09ff[_0xfba6('0x2c')],'id');return _0x5e09ff[_0xfba6('0x55')](_0x5832fb)[_0xfba6('0xd')](function(){for(var _0x2a20ab=0x0;_0x2a20ab<_0x5832fb[_0xfba6('0x1e')];_0x2a20ab+=0x1){_0x56b427['emit'](_0xfba6('0x56'),{'WhatsappInteractionId':Number(_0x5832fb[_0x2a20ab]),'UserId':Number(_0x5e09ff['id'])});}});}})[_0xfba6('0x57')](function(_0x2ffbc2){_0x444856[_0xfba6('0x58')](_0x2ffbc2);});}}function onDisconnect(_0x107953,_0x56de3a){joinOrLeave(_0x107953,_0xfba6('0x4a'),_0x56de3a);}function onConnect(_0x50897a){joinOrLeave(_0x50897a,_0xfba6('0x59'));}exports['default']=function(_0x1452f7){_0x1452f7['on'](_0xfba6('0x5a'),function(_0x3c43c5){_0x3c43c5[_0xfba6('0x5b')](0x0);_0x3c43c5['address']=_0x3c43c5[_0xfba6('0x5c')][_0xfba6('0x5a')][_0xfba6('0x5d')]+':'+_0x3c43c5[_0xfba6('0x5c')][_0xfba6('0x5a')][_0xfba6('0x5e')];_0x3c43c5['connectedAt']=new Date();_0x3c43c5['log']=function(_0x1b11f2){console['log'](_0xfba6('0x5f')+_0x3c43c5['nsp'][_0xfba6('0x4')]+'['+_0x3c43c5[_0xfba6('0x60')]+']',_0x1b11f2);};_0x3c43c5['on'](_0xfba6('0x61'),function(){onDisconnect(_0x3c43c5,_0x1452f7);_0x3c43c5[_0xfba6('0x58')]('DISCONNECTED');});onConnect(_0x3c43c5);_0x3c43c5[_0xfba6('0x58')]('CONNECTED');});}; \ No newline at end of file +var _0xc14a=['SmsInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','ChatQueues','MailQueue','OpenchannelQueues','WhatsappQueue','Telephones','Trunks','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','user:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','log','default','setMaxListeners','address','connection','remoteAddress','request','remotePort','connectedAt','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','role','name','telephone','agent','type','UserProfileSection','then','autoAssociation','VoiceQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','IvrCampaigns','resourceId','map','where','Campaign','ivr','format','%s:queue:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0xc14a,0xa9));var _0xac14=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc14a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xac14('0x0'));var util=require(_0xac14('0x1'));var BPromise=require(_0xac14('0x2'));var db=require(_0xac14('0x3'))['db'];var config=require(_0xac14('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xac14('0x5'),'model':db[_0xac14('0x6')],'attributes':['id','name',_0xac14('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xac14('0x8')],'where':{'role':_0xac14('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xac14('0x8')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xac14('0xa')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xac14('0x8'),_0xac14('0xb')],'where':{'type':'ivr'}};function getAssociatedResources(_0x3d3182,_0x3b3cc6,_0x3901cb){return db[_0xac14('0xc')]['findOne']({'where':{'name':_0x3d3182,'userProfileId':_0x3b3cc6},'raw':!![]})[_0xac14('0xd')](function(_0x540967){if(_0x540967){if(_0x540967[_0xac14('0xe')]){switch(_0x3d3182){case _0xac14('0xf'):case'ChatQueues':case'FaxQueues':case _0xac14('0x10'):case _0xac14('0x11'):case'OpenchannelQueues':case _0xac14('0x12'):return db[_0x3901cb][_0xac14('0x13')](queryQueues);case'Telephones':return db[_0x3901cb][_0xac14('0x13')](queryTelephones);case'Trunks':return db[_0x3901cb][_0xac14('0x13')](queryTrunks);case _0xac14('0x14'):return db[_0x3901cb][_0xac14('0x13')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0xac14('0x15')],'where':{'sectionId':_0x540967['id']},'raw':!![]})['then'](function(_0xe50537){if(_0xe50537){var _0x497be2={'where':{'id':_[_0xac14('0x16')](_0xe50537,_0xac14('0x15'))},'raw':!![]};switch(_0x3901cb){case _0xac14('0x6'):_0x497be2[_0xac14('0x17')][_0xac14('0x7')]='telephone';break;case _0xac14('0x18'):_0x497be2[_0xac14('0x17')][_0xac14('0xb')]=_0xac14('0x19');break;}return db[_0x3901cb][_0xac14('0x13')](_0x497be2);}else{return[];}});}}else{return[];}})[_0xac14('0xd')](function(_0x159e85){return _0x159e85;});}function joinOrLeaveQueues(_0x572d08,_0x429390,_0x26bf1c,_0x151ae8){_0x572d08[_0x429390](util[_0xac14('0x1a')](_0xac14('0x1b'),_0x26bf1c,_0x151ae8['name']));if(_0x151ae8['Agents']){for(var _0x1cbb67=0x0;_0x1cbb67<_0x151ae8[_0xac14('0x5')]['length'];_0x1cbb67+=0x1){_0x572d08[_0x429390](util[_0xac14('0x1a')]('user:%s',_0x151ae8['Agents'][_0x1cbb67]['name']));}}}function joinOrLeave(_0x3b6615,_0x4c6580,_0x1b863e){var _0x8e5979;if(_0x3b6615[_0xac14('0x1c')][_0xac14('0x1d')]['id']){db['User'][_0xac14('0x1e')]({'attributes':['id','name',_0xac14('0x7'),_0xac14('0x1f')],'where':{'id':_0x3b6615['handshake'][_0xac14('0x1d')]['id']},'include':[{'model':db[_0xac14('0x20')],'as':_0xac14('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xac14('0x22')],'as':_0xac14('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xac14('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xac14('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xac14('0x26')],'as':_0xac14('0x27'),'attributes':['id'],'raw':!![]}]})[_0xac14('0xd')](function(_0x53584e){if(_0x53584e){_0x8e5979=_0x53584e;_0x3b6615[_0x4c6580](util['format']('user:%s',_0x53584e['name']));var _0x5c2717=[];switch(_0x53584e[_0xac14('0x7')]){case _0xac14('0x28'):_0x3b6615[_0x4c6580](_0xac14('0x29'));_0x3b6615[_0x4c6580](_0xac14('0x2a'));if(queryQueues[_0xac14('0x2b')]('include')){delete queryQueues[_0xac14('0x2c')];}_0x5c2717['push'](db[_0xac14('0x2d')][_0xac14('0x13')](queryQueues));_0x5c2717[_0xac14('0x2e')](db[_0xac14('0x2f')]['findAll'](queryQueues));_0x5c2717[_0xac14('0x2e')](db[_0xac14('0x30')][_0xac14('0x13')](queryQueues));_0x5c2717[_0xac14('0x2e')](db[_0xac14('0x31')][_0xac14('0x13')](queryQueues));_0x5c2717['push'](db['MailQueue']['findAll'](queryQueues));_0x5c2717[_0xac14('0x2e')](db[_0xac14('0x32')][_0xac14('0x13')](queryQueues));_0x5c2717[_0xac14('0x2e')](db['WhatsappQueue'][_0xac14('0x13')](queryQueues));_0x5c2717[_0xac14('0x2e')](db[_0xac14('0x6')]['findAll'](queryTelephones));_0x5c2717[_0xac14('0x2e')](db[_0xac14('0x33')]['findAll'](queryTrunks));_0x5c2717['push'](db['Campaign'][_0xac14('0x13')](queryCampaigns));_0x5c2717[_0xac14('0x2e')](db[_0xac14('0x6')][_0xac14('0x13')](queryAgents));break;case _0xac14('0x34'):_0x3b6615[_0x4c6580](_0xac14('0x29'));_0x3b6615[_0x4c6580](_0xac14('0x2a'));_0x5c2717[_0xac14('0x2e')](getAssociatedResources('VoiceQueues',_0x53584e[_0xac14('0x1f')],_0xac14('0x2d')));_0x5c2717['push'](getAssociatedResources(_0xac14('0x35'),_0x53584e[_0xac14('0x1f')],_0xac14('0x2f')));_0x5c2717[_0xac14('0x2e')](getAssociatedResources('FaxQueues',_0x53584e[_0xac14('0x1f')],_0xac14('0x30')));_0x5c2717[_0xac14('0x2e')](getAssociatedResources(_0xac14('0x10'),_0x53584e[_0xac14('0x1f')],'SmsQueue'));_0x5c2717[_0xac14('0x2e')](getAssociatedResources(_0xac14('0x11'),_0x53584e[_0xac14('0x1f')],_0xac14('0x36')));_0x5c2717['push'](getAssociatedResources(_0xac14('0x37'),_0x53584e['userProfileId'],_0xac14('0x32')));_0x5c2717[_0xac14('0x2e')](getAssociatedResources(_0xac14('0x12'),_0x53584e[_0xac14('0x1f')],_0xac14('0x38')));_0x5c2717[_0xac14('0x2e')](getAssociatedResources(_0xac14('0x39'),_0x53584e['userProfileId'],_0xac14('0x6')));_0x5c2717[_0xac14('0x2e')](getAssociatedResources(_0xac14('0x3a'),_0x53584e['userProfileId'],_0xac14('0x33')));_0x5c2717[_0xac14('0x2e')](getAssociatedResources(_0xac14('0x14'),_0x53584e[_0xac14('0x1f')],_0xac14('0x18')));_0x5c2717[_0xac14('0x2e')](db[_0xac14('0x6')]['findAll'](queryAgents));break;case _0xac14('0xa'):_0x3b6615[_0x4c6580](_0xac14('0x29'));_0x3b6615[_0x4c6580](_0xac14('0x2a'));_0x5c2717[_0xac14('0x2e')](_0x53584e['getVoiceQueues']({'attributes':['id','name']}));_0x5c2717[_0xac14('0x2e')](_0x53584e[_0xac14('0x3b')]({'attributes':['id',_0xac14('0x8')]}));_0x5c2717[_0xac14('0x2e')](_0x53584e[_0xac14('0x3c')]({'attributes':['id','name']}));_0x5c2717[_0xac14('0x2e')](_0x53584e[_0xac14('0x3d')]({'attributes':['id','name']}));_0x5c2717[_0xac14('0x2e')](_0x53584e[_0xac14('0x3e')]({'attributes':['id','name']}));_0x5c2717[_0xac14('0x2e')](_0x53584e['getOpenchannelQueues']({'attributes':['id',_0xac14('0x8')]}));_0x5c2717[_0xac14('0x2e')](_0x53584e[_0xac14('0x3f')]({'attributes':['id',_0xac14('0x8')]}));break;}return BPromise[_0xac14('0x40')](_0x5c2717);}})[_0xac14('0xd')](function(_0x14cb32){if(_0x14cb32&&_0x14cb32[_0xac14('0x41')]){for(var _0x145810=0x0;_0x145810<_0x14cb32[_0xac14('0x41')];_0x145810+=0x1){for(var _0x1f28ad=0x0;_0x1f28ad<_0x14cb32[_0x145810][_0xac14('0x41')];_0x1f28ad+=0x1){switch(_0x145810){case 0x0:joinOrLeaveQueues(_0x3b6615,_0x4c6580,_0xac14('0x42'),_0x14cb32[_0x145810][_0x1f28ad]);break;case 0x1:joinOrLeaveQueues(_0x3b6615,_0x4c6580,'chat',_0x14cb32[_0x145810][_0x1f28ad]);break;case 0x2:joinOrLeaveQueues(_0x3b6615,_0x4c6580,_0xac14('0x43'),_0x14cb32[_0x145810][_0x1f28ad]);break;case 0x3:joinOrLeaveQueues(_0x3b6615,_0x4c6580,_0xac14('0x44'),_0x14cb32[_0x145810][_0x1f28ad]);break;case 0x4:joinOrLeaveQueues(_0x3b6615,_0x4c6580,_0xac14('0x45'),_0x14cb32[_0x145810][_0x1f28ad]);break;case 0x5:joinOrLeaveQueues(_0x3b6615,_0x4c6580,_0xac14('0x46'),_0x14cb32[_0x145810][_0x1f28ad]);break;case 0x6:joinOrLeaveQueues(_0x3b6615,_0x4c6580,_0xac14('0x47'),_0x14cb32[_0x145810][_0x1f28ad]);break;case 0x7:if(_0x8e5979[_0xac14('0x7')]!==_0xac14('0xa'))_0x3b6615[_0x4c6580](util[_0xac14('0x1a')](_0xac14('0x48'),_0x14cb32[_0x145810][_0x1f28ad]['name']));break;case 0x8:if(_0x8e5979['role']!==_0xac14('0xa'))_0x3b6615[_0x4c6580](util[_0xac14('0x1a')](_0xac14('0x49'),_0x14cb32[_0x145810][_0x1f28ad]['name']));break;case 0x9:if(_0x8e5979[_0xac14('0x7')]!==_0xac14('0xa'))_0x3b6615[_0x4c6580](util[_0xac14('0x1a')]('campaign:%s:%s',_0x14cb32[_0x145810][_0x1f28ad][_0xac14('0xb')],_0x14cb32[_0x145810][_0x1f28ad][_0xac14('0x8')]));break;case 0xa:_0x3b6615[_0x4c6580](util['format'](_0xac14('0x4a'),_0x14cb32[_0x145810][_0x1f28ad][_0xac14('0x8')]));break;}}}}})[_0xac14('0xd')](function(){if(_0x4c6580==='leave'){var _0x19d330=_[_0xac14('0x16')](_0x8e5979[_0xac14('0x21')],'id');return _0x8e5979[_0xac14('0x4b')](_0x19d330)[_0xac14('0xd')](function(){for(var _0x458c07=0x0;_0x458c07<_0x19d330[_0xac14('0x41')];_0x458c07+=0x1){_0x1b863e[_0xac14('0x4c')](_0xac14('0x4d'),{'ChatInteractionId':Number(_0x19d330[_0x458c07]),'UserId':Number(_0x8e5979['id'])});}});}})[_0xac14('0xd')](function(){if(_0x4c6580===_0xac14('0x4e')){var _0x158ad4=_[_0xac14('0x16')](_0x8e5979[_0xac14('0x23')],'id');return _0x8e5979[_0xac14('0x4f')](_0x158ad4)[_0xac14('0xd')](function(){for(var _0x1b45e5=0x0;_0x1b45e5<_0x158ad4[_0xac14('0x41')];_0x1b45e5+=0x1){_0x1b863e[_0xac14('0x4c')](_0xac14('0x50'),{'MailInteractionId':Number(_0x158ad4[_0x1b45e5]),'UserId':Number(_0x8e5979['id'])});}});}})[_0xac14('0xd')](function(){if(_0x4c6580===_0xac14('0x4e')){var _0xfb8f22=_[_0xac14('0x16')](_0x8e5979[_0xac14('0x51')],'id');return _0x8e5979[_0xac14('0x52')](_0xfb8f22)[_0xac14('0xd')](function(){for(var _0x210ccb=0x0;_0x210ccb<_0xfb8f22[_0xac14('0x41')];_0x210ccb+=0x1){_0x1b863e['emit'](_0xac14('0x53'),{'FaxInteractionId':Number(_0xfb8f22[_0x210ccb]),'UserId':Number(_0x8e5979['id'])});}});}})['then'](function(){if(_0x4c6580===_0xac14('0x4e')){var _0x1f24b2=_['map'](_0x8e5979[_0xac14('0x54')],'id');return _0x8e5979[_0xac14('0x55')](_0x1f24b2)['then'](function(){for(var _0xf729fe=0x0;_0xf729fe<_0x1f24b2[_0xac14('0x41')];_0xf729fe+=0x1){_0x1b863e[_0xac14('0x4c')](_0xac14('0x56'),{'SmsInteractionId':Number(_0x1f24b2[_0xf729fe]),'UserId':Number(_0x8e5979['id'])});}});}})[_0xac14('0xd')](function(){if(_0x4c6580===_0xac14('0x4e')){var _0x58e222=_['map'](_0x8e5979[_0xac14('0x57')],'id');return _0x8e5979[_0xac14('0x58')](_0x58e222)['then'](function(){for(var _0x51fd38=0x0;_0x51fd38<_0x58e222[_0xac14('0x41')];_0x51fd38+=0x1){_0x1b863e[_0xac14('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x58e222[_0x51fd38]),'UserId':Number(_0x8e5979['id'])});}});}})[_0xac14('0xd')](function(){if(_0x4c6580===_0xac14('0x4e')){var _0x2dfe78=_[_0xac14('0x16')](_0x8e5979[_0xac14('0x27')],'id');return _0x8e5979['removeWhatsappInteractions'](_0x2dfe78)[_0xac14('0xd')](function(){for(var _0x55e058=0x0;_0x55e058<_0x2dfe78[_0xac14('0x41')];_0x55e058+=0x1){_0x1b863e[_0xac14('0x4c')](_0xac14('0x59'),{'WhatsappInteractionId':Number(_0x2dfe78[_0x55e058]),'UserId':Number(_0x8e5979['id'])});}});}})[_0xac14('0x5a')](function(_0x1ebb4){_0x3b6615[_0xac14('0x5b')](_0x1ebb4);});}}function onDisconnect(_0x3b3dc8,_0xf6d4ce){joinOrLeave(_0x3b3dc8,'leave',_0xf6d4ce);}function onConnect(_0x42804f){joinOrLeave(_0x42804f,'join');}exports[_0xac14('0x5c')]=function(_0x2b50e4){_0x2b50e4['on']('connection',function(_0x523af6){_0x523af6[_0xac14('0x5d')](0x0);_0x523af6[_0xac14('0x5e')]=_0x523af6['request'][_0xac14('0x5f')][_0xac14('0x60')]+':'+_0x523af6[_0xac14('0x61')]['connection'][_0xac14('0x62')];_0x523af6[_0xac14('0x63')]=new Date();_0x523af6[_0xac14('0x5b')]=function(_0x347230){console['log']('SocketIO\x20'+_0x523af6['nsp'][_0xac14('0x8')]+'['+_0x523af6[_0xac14('0x5e')]+']',_0x347230);};_0x523af6['on'](_0xac14('0x64'),function(){onDisconnect(_0x523af6,_0x2b50e4);_0x523af6[_0xac14('0x5b')](_0xac14('0x65'));});onConnect(_0x523af6);_0x523af6[_0xac14('0x5b')](_0xac14('0x66'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 3e586f7..46a8248 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 _0x577b=['contact','UserId','format','name','incomingmessage','outgoingmessage','AfterCreateMessage','channel','offlineMessage','opened','SELECT','interface','SIP/%s','agent','AfterCreate','changed','substatus','query','AfterUpdate','User','find','internal','default','length','hasOwnProperty','model','hook','callback','condition','util','../../mysqldb','jayson/promise','../logger','triggers','ChatInteraction','afterCreate','newinteraction','Chat','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','error','code','catch','EventManager','get','motionChannel','event','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes'];(function(_0x1b8f1c,_0x1d8569){var _0x433ac0=function(_0x3fc40e){while(--_0x3fc40e){_0x1b8f1c['push'](_0x1b8f1c['shift']());}};_0x433ac0(++_0x1d8569);}(_0x577b,0x1cd));var _0xb577=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x577b[_0x126558];return _0x1f6d14;};'use strict';var util=require(_0xb577('0x0'));var db=require(_0xb577('0x1'))['db'];var jayson=require(_0xb577('0x2'));var logger=require(_0xb577('0x3'))(_0xb577('0x4'));var client=jayson['client']['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xb577('0x5'),'event':_0xb577('0x6'),'condition':_0xb577('0x7'),'callback':afterCreate},{'channel':_0xb577('0x8'),'model':_0xb577('0x5'),'event':'afterUpdate','condition':_0xb577('0x9'),'callback':afterUpdate},{'channel':'Chat','model':_0xb577('0xa'),'event':_0xb577('0x6'),'condition':_0xb577('0xb'),'callback':afterCreateMessage},{'channel':_0xb577('0x8'),'model':_0xb577('0xc'),'event':_0xb577('0x6'),'condition':_0xb577('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0xb577('0xd'),'model':_0xb577('0xe'),'event':_0xb577('0x6'),'condition':_0xb577('0x7'),'callback':afterCreate},{'channel':_0xb577('0xd'),'model':_0xb577('0xe'),'event':_0xb577('0xf'),'condition':_0xb577('0x9'),'callback':afterUpdate},{'channel':_0xb577('0xd'),'model':'SmsMessage','event':_0xb577('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xb577('0x10'),'model':'WhatsappInteraction','event':_0xb577('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xb577('0x10'),'model':_0xb577('0x11'),'event':'afterUpdate','condition':_0xb577('0x9'),'callback':afterUpdate},{'channel':_0xb577('0x10'),'model':'WhatsappMessage','event':_0xb577('0x6'),'condition':_0xb577('0xb'),'callback':afterCreateMessage},{'channel':_0xb577('0x12'),'model':'FaxInteraction','event':_0xb577('0x6'),'condition':_0xb577('0x7'),'callback':afterCreate},{'channel':_0xb577('0x12'),'model':_0xb577('0x13'),'event':_0xb577('0xf'),'condition':_0xb577('0x9'),'callback':afterUpdate},{'channel':_0xb577('0x12'),'model':_0xb577('0x14'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0xb577('0x15'),'event':_0xb577('0x6'),'condition':_0xb577('0x7'),'callback':afterCreate},{'channel':_0xb577('0x16'),'model':'MailInteraction','event':'afterUpdate','condition':_0xb577('0x9'),'callback':afterUpdate},{'channel':_0xb577('0x16'),'model':_0xb577('0x17'),'event':_0xb577('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0xb577('0x18'),'event':_0xb577('0x6'),'condition':_0xb577('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0xb577('0xf'),'condition':_0xb577('0x9'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xb577('0x19'),'event':_0xb577('0x6'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x3d6b65){return client[_0xb577('0x1a')]('EventManager',_0x3d6b65)[_0xb577('0x1b')](function(_0x3abd74){logger[_0xb577('0x1c')](_0xb577('0x1d'),'EventManager',_0x3abd74);if(_0x3abd74[_0xb577('0x1e')]){if(_0x3abd74[_0xb577('0x1e')][_0xb577('0x1f')]===0x1f4){logger[_0xb577('0x1e')](_0xb577('0x1d'),'EventManager',_0x3abd74[_0xb577('0x1e')]);}}})[_0xb577('0x20')](function(_0x420445){logger['error'](_0xb577('0x1d'),_0xb577('0x21'),_0x420445);});}function afterCreateMessage(_0x368dcd){return function(_0x904139){_0x904139=_0x904139[_0xb577('0x22')]({'plain':!![]});_0x904139['channel']=_0x368dcd;_0x904139[_0xb577('0x23')]=_0x368dcd;_0x904139[_0xb577('0x24')]=_0x904139['direction'];Promise['resolve']()[_0xb577('0x1b')](function(){if(typeof _0x904139[_0xb577('0x25')]===_0xb577('0x26'))return null;var _0x85c48c=_0xb577('0x27')+_0x904139[_0xb577('0x25')];return db[_0xb577('0x28')]['query'](_0x85c48c,{'type':db[_0xb577('0x29')][_0xb577('0x2a')]['SELECT'],'raw':!![]});})[_0xb577('0x1b')](function(_0x4f26f9){if(_0x4f26f9){_0x904139[_0xb577('0x2b')]=_0x4f26f9[0x0];}if(typeof _0x904139['UserId']===_0xb577('0x26'))return;return getAgent(_0x904139[_0xb577('0x2c')]);})[_0xb577('0x1b')](function(_0x5403b5){if(_0x5403b5){_0x904139['interface']=util[_0xb577('0x2d')]('SIP/%s',_0x5403b5[_0xb577('0x2e')]);_0x904139['agent']=_0x5403b5;_0x904139['channel']=_0x368dcd;return request({'event':_0xb577('0x2f'),'message':_0x904139});}else{return request({'event':_0xb577('0x30'),'message':_0x904139});}})['catch'](function(_0x4162a5){logger[_0xb577('0x1e')](_0xb577('0x1d'),_0xb577('0x31'),_0x4162a5);});};}function afterCreateOfflineMessage(_0x402f40){return function(_0x52df95){_0x52df95=_0x52df95[_0xb577('0x22')]({'plain':!![]});_0x52df95[_0xb577('0x32')]=_0x402f40;_0x52df95[_0xb577('0x23')]=_0x402f40;_0x52df95[_0xb577('0x24')]=_0xb577('0x33');return request({'event':_0x52df95[_0xb577('0x24')],'message':_0x52df95});};}function afterCreate(_0x1705c4,_0x39b1ce){return function(_0x1204d0){_0x1204d0=_0x1204d0[_0xb577('0x22')]({'plain':!![]});_0x1204d0[_0xb577('0x32')]=_0x1705c4;_0x1204d0[_0xb577('0x23')]=_0x1705c4;_0x1204d0[_0xb577('0x24')]=_0xb577('0x34');Promise['resolve']()[_0xb577('0x1b')](function(){var _0x55c376=_0xb577('0x27')+_0x1204d0[_0xb577('0x25')];return db['sequelize']['query'](_0x55c376,{'type':db['Sequelize'][_0xb577('0x2a')][_0xb577('0x35')],'raw':!![]});})[_0xb577('0x1b')](function(_0xc8e03a){if(_0xc8e03a){_0x1204d0[_0xb577('0x2b')]=_0xc8e03a[0x0];}if(typeof _0x1204d0[_0xb577('0x2c')]===_0xb577('0x26'))return;return getAgent(_0x1204d0['UserId']);})[_0xb577('0x1b')](function(_0x3a9241){if(_0x3a9241){_0x1204d0[_0xb577('0x36')]=util[_0xb577('0x2d')](_0xb577('0x37'),_0x3a9241[_0xb577('0x2e')]);_0x1204d0[_0xb577('0x38')]=_0x3a9241;}return request({'event':_0x39b1ce,'message':_0x1204d0});})['catch'](function(_0x2e8645){logger['error'](_0xb577('0x1d'),_0xb577('0x39'),_0x2e8645);});};}function afterUpdate(_0xbfa9e6){return function(_0x2a1a52){var _0x59d92c=_0x2a1a52[_0xb577('0x3a')]('closed')&&_0x2a1a52['closed'];var _0x1b71fa=_0x2a1a52[_0xb577('0x3a')](_0xb577('0x3b'));if(_0x59d92c||_0x1b71fa){var _0x115db6=_0x59d92c?_0xb577('0x9'):_0xb577('0x3b');var _0x5d9f8b=_0x2a1a52[_0xb577('0x22')]({'plain':!![]});_0x5d9f8b[_0xb577('0x32')]=_0xbfa9e6;_0x5d9f8b[_0xb577('0x23')]=_0xbfa9e6;_0x5d9f8b[_0xb577('0x24')]=_0x59d92c?'closed':'substatus';var _0x276c2e=_0xb577('0x27')+_0x5d9f8b[_0xb577('0x25')];return db[_0xb577('0x28')][_0xb577('0x3c')](_0x276c2e,{'type':db[_0xb577('0x29')][_0xb577('0x2a')][_0xb577('0x35')],'raw':!![]})[_0xb577('0x1b')](function(_0x36963f){if(_0x36963f){_0x5d9f8b['contact']=_0x36963f[0x0];}if(typeof _0x5d9f8b[_0xb577('0x2c')]===_0xb577('0x26'))return;return getAgent(_0x5d9f8b['UserId']);})[_0xb577('0x1b')](function(_0x2c580f){if(_0x2c580f){_0x5d9f8b[_0xb577('0x36')]=util[_0xb577('0x2d')](_0xb577('0x37'),_0x2c580f[_0xb577('0x2e')]);_0x5d9f8b[_0xb577('0x38')]=_0x2c580f;}return request({'event':_0x115db6,'message':_0x5d9f8b});})[_0xb577('0x20')](function(_0xa52142){logger[_0xb577('0x1e')](_0xb577('0x1d'),_0xb577('0x3d'),_0xa52142);});}};}function getAgent(_0x5e7d16){return db[_0xb577('0x3e')][_0xb577('0x3f')]({'where':{'id':_0x5e7d16},'attributes':['id',_0xb577('0x2e'),'fullname','email',_0xb577('0x40')],'raw':!![]})[_0xb577('0x1b')](function(_0x1718f3){return _0x1718f3;});}exports[_0xb577('0x41')]=function(){for(var _0x2965f0=0x0;_0x2965f0=_0x517919[_0x781f('0x17')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x30bd7c(_0x6db205);})['catch'](function(_0xa79825){_0x7d7f7c(_0xa79825);});});}; \ No newline at end of file +var _0x6b24=['lodash','bluebird','../mysqldb','voice','fax','sms','whatsapp','getChannels','isValidChannel','includes','isUndefined','blockedAt','updateAttributes','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x2cc506,_0x396d71){var _0x66cfd6=function(_0x5288fa){while(--_0x5288fa){_0x2cc506['push'](_0x2cc506['shift']());}};_0x66cfd6(++_0x396d71);}(_0x6b24,0x111));var _0x46b2=function(_0x22d72b,_0x112e6d){_0x22d72b=_0x22d72b-0x0;var _0x35f65f=_0x6b24[_0x22d72b];return _0x35f65f;};'use strict';var _=require(_0x46b2('0x0'));var BPromise=require(_0x46b2('0x1'));var db=require(_0x46b2('0x2'))['db'];var util=require('./license/util');var channels=[_0x46b2('0x3'),'mail','chat',_0x46b2('0x4'),_0x46b2('0x5'),_0x46b2('0x6'),'openchannel'];exports[_0x46b2('0x7')]=function(){return channels;};exports[_0x46b2('0x8')]=function(_0x2bd4e0){_0x2bd4e0=_0x2bd4e0['toLowerCase']();return _[_0x46b2('0x9')](channels,_0x2bd4e0);};exports['clearBlockUser']=function(_0x305611,_0x3c958c,_0x42e3ac,_0x12c311){var _0x4a3f7b={'loginAttempts':_0x3c958c,'blocked':_0x42e3ac};if(!_[_0x46b2('0xa')](_0x12c311)){_0x4a3f7b[_0x46b2('0xb')]=_0x12c311;}return _0x305611[_0x46b2('0xc')](_0x4a3f7b);};exports['getLicense']=function(_0x2b0fbc){return new BPromise(function(_0x12a8bd,_0x518f9f){var _0x136d14=0x0;if(_0x2b0fbc[_0x46b2('0xd')]!==_0x46b2('0xe')){_0x12a8bd(_0x2b0fbc);}db[_0x46b2('0xf')][_0x46b2('0x10')]({'where':{'role':_0x46b2('0xe'),'online':!![],'id':{'$ne':_0x2b0fbc['id']}}})[_0x46b2('0x11')](function(_0x433b14){_0x136d14=_0x433b14;return util[_0x46b2('0x12')]();})['then'](function(_0x288a79){if(_0x288a79&&_0x288a79[_0x46b2('0x13')]&&_0x136d14>=_0x288a79['agents']){throw Error(_0x46b2('0x14'));}_0x12a8bd(_0x2b0fbc);})['catch'](function(_0x288807){_0x518f9f(_0x288807);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index eb4c9c7..35ff45d 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Bad\x20Request','Not\x20Found','Forbidden','OutOfInterval','stack','status','send','exports','util','../config/logger','message','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('api');var APIError=function(_0x585166,_0x4b72b0){this[_0x0d8b('0x2')]=_0x585166||_0x0d8b('0x3');this[_0x0d8b('0x4')]=_0x4b72b0||_0x0d8b('0x5');util[_0x0d8b('0x6')](APIError,Error);};var APIBadRequestError=function(_0x577834){this['message']=_0x577834||_0x0d8b('0x7');this[_0x0d8b('0x4')]=_0x0d8b('0x7');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x413284){this[_0x0d8b('0x2')]=_0x413284||'Entity\x20not\x20found';this[_0x0d8b('0x4')]=_0x0d8b('0x8');util[_0x0d8b('0x6')](APINotFoundError,APIError);};function getStatusCode(_0x1f4800){switch(_0x1f4800){case _0x0d8b('0x7'):return 0x190;case _0x0d8b('0x9'),_0x0d8b('0xa'):return 0x193;case _0x0d8b('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x48fa16){return function(_0x3c4bfa){logger['error'](_0x3c4bfa[_0x0d8b('0xb')]);var _0xc574a3=getStatusCode(_0x3c4bfa[_0x0d8b('0x4')]);if(_0x3c4bfa[_0x0d8b('0x4')])delete _0x3c4bfa[_0x0d8b('0x4')];return _0x48fa16[_0x0d8b('0xc')](_0xc574a3)[_0x0d8b('0xd')](_0x3c4bfa);};}module[_0x0d8b('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xe706=['inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','stack','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error'];(function(_0x6f041d,_0x4029b4){var _0x4609b8=function(_0x1d9505){while(--_0x1d9505){_0x6f041d['push'](_0x6f041d['shift']());}};_0x4609b8(++_0x4029b4);}(_0xe706,0xa3));var _0x6e70=function(_0x32aac9,_0x5eb63d){_0x32aac9=_0x32aac9-0x0;var _0x51bafd=_0xe706[_0x32aac9];return _0x51bafd;};'use strict';var util=require(_0x6e70('0x0'));var logger=require(_0x6e70('0x1'))(_0x6e70('0x2'));var APIError=function(_0x5e8446,_0x2cae77){this[_0x6e70('0x3')]=_0x5e8446||_0x6e70('0x4');this[_0x6e70('0x5')]=_0x2cae77||_0x6e70('0x6');util[_0x6e70('0x7')](APIError,Error);};var APIBadRequestError=function(_0x376a8d){this[_0x6e70('0x3')]=_0x376a8d||_0x6e70('0x8');this[_0x6e70('0x5')]=_0x6e70('0x8');util[_0x6e70('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x45a2d4){this[_0x6e70('0x3')]=_0x45a2d4||_0x6e70('0x9');this[_0x6e70('0x5')]=_0x6e70('0xa');util[_0x6e70('0x7')](APINotFoundError,APIError);};function getStatusCode(_0x100eb7){switch(_0x100eb7){case _0x6e70('0x8'):return 0x190;case _0x6e70('0xb'),_0x6e70('0xc'):return 0x193;case _0x6e70('0xa'):return 0x194;default:return 0x1f4;}}function handleError(_0x4600f9){return function(_0x5b3d07){logger['error'](_0x5b3d07[_0x6e70('0xd')]);var _0x15a1a5=getStatusCode(_0x5b3d07[_0x6e70('0x5')]);if(_0x5b3d07[_0x6e70('0x5')])delete _0x5b3d07[_0x6e70('0x5')];return _0x4600f9[_0x6e70('0xe')](_0x15a1a5)[_0x6e70('0xf')](_0x5b3d07);};}module[_0x6e70('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index e1165cc..efec626 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0c8=['send','exports','404','status','json'];(function(_0x11907c,_0x145aaa){var _0x13d7b7=function(_0x353726){while(--_0x353726){_0x11907c['push'](_0x11907c['shift']());}};_0x13d7b7(++_0x145aaa);}(_0xc0c8,0xab));var _0x8c0c=function(_0x284c56,_0x5181d2){_0x284c56=_0x284c56-0x0;var _0x32fc0e=_0xc0c8[_0x284c56];return _0x32fc0e;};'use strict';module[_0x8c0c('0x0')][0x194]=function pageNotFound(_0x1d3fc7,_0xe083f){var _0x4e01e2=_0x8c0c('0x1');var _0x50a8cf=0x194;var _0x4d9cb4={'status':_0x50a8cf};_0xe083f['status'](_0x4d9cb4[_0x8c0c('0x2')]);_0xe083f['render'](_0x4e01e2,{},function(_0x2941a7,_0x209486){if(_0x2941a7){return _0xe083f['status'](_0x4d9cb4[_0x8c0c('0x2')])[_0x8c0c('0x3')](_0x4d9cb4);}_0xe083f[_0x8c0c('0x4')](_0x209486);});}; \ No newline at end of file +var _0xdb28=['exports','status','render','json','send'];(function(_0x11bd02,_0x2d91d1){var _0x262863=function(_0x80104){while(--_0x80104){_0x11bd02['push'](_0x11bd02['shift']());}};_0x262863(++_0x2d91d1);}(_0xdb28,0x1ae));var _0x8db2=function(_0xd17e36,_0x485df7){_0xd17e36=_0xd17e36-0x0;var _0x2bd582=_0xdb28[_0xd17e36];return _0x2bd582;};'use strict';module[_0x8db2('0x0')][0x194]=function pageNotFound(_0x1246e1,_0xd004c7){var _0x231922='404';var _0x8f381c=0x194;var _0x3d8e13={'status':_0x8f381c};_0xd004c7['status'](_0x3d8e13[_0x8db2('0x1')]);_0xd004c7[_0x8db2('0x2')](_0x231922,{},function(_0x131ec3,_0x32e915){if(_0x131ec3){return _0xd004c7[_0x8db2('0x1')](_0x3d8e13[_0x8db2('0x1')])[_0x8db2('0x3')](_0x3d8e13);}_0xd004c7[_0x8db2('0x4')](_0x32e915);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e6dfc42..6568a4b 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 7e67032..c40b64f 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326b=['./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/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/setting','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','snippet','3.1.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','/api/users','use','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/trunk','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions'];(function(_0x1a2302,_0x42e5bb){var _0x285a5c=function(_0x2ba927){while(--_0x2ba927){_0x1a2302['push'](_0x1a2302['shift']());}};_0x285a5c(++_0x42e5bb);}(_0x326b,0xbe));var _0xb326=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0x326b[_0x33ca22];return _0x1790c3;};'use strict';var path=require(_0xb326('0x0'));var express=require(_0xb326('0x1'));var errors=require(_0xb326('0x2'));var config=require('./config/environment');var setupLoggers=require(_0xb326('0x3'))[_0xb326('0x4')];var clientSideLogs=require(_0xb326('0x5'));exports[_0xb326('0x6')]=function(_0x5b5fa8){return setupLoggers(_0x5b5fa8)['then'](function(){_0x5b5fa8['use'](_0xb326('0x7'),require('./api/user'));_0x5b5fa8[_0xb326('0x8')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x9'),require(_0xb326('0xa')));_0x5b5fa8['use'](_0xb326('0xb'),require(_0xb326('0xc')));_0x5b5fa8[_0xb326('0x8')]('/api/voice/mohs',require(_0xb326('0xd')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xe'),require(_0xb326('0xf')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x10'),require('./api/voiceRecording'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x11'),require(_0xb326('0x12')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x13'),require(_0xb326('0x14')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x15'),require('./api/voiceMailMessage'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x16'),require(_0xb326('0x17')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x18'),require(_0xb326('0x19')));_0x5b5fa8['use'](_0xb326('0x1a'),require(_0xb326('0x1b')));_0x5b5fa8['use']('/api/voice/queues/reports',require(_0xb326('0x1c')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x1d'),require('./api/memberReport'));_0x5b5fa8[_0xb326('0x8')]('/api/trunks',require(_0xb326('0x1e')));_0x5b5fa8[_0xb326('0x8')]('/api/voice/transfers/reports',require(_0xb326('0x1f')));_0x5b5fa8[_0xb326('0x8')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x5b5fa8['use'](_0xb326('0x20'),require(_0xb326('0x21')));_0x5b5fa8[_0xb326('0x8')]('/api/mail/queues',require('./api/mailQueue'));_0x5b5fa8[_0xb326('0x8')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x22'),require(_0xb326('0x23')));_0x5b5fa8[_0xb326('0x8')]('/api/mail/messages',require(_0xb326('0x24')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x25'),require('./api/mailApplication'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x26'),require('./api/mailQueueReport'));_0x5b5fa8[_0xb326('0x8')]('/api/dashboards',require(_0xb326('0x27')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x28'),require(_0xb326('0x29')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x2a'),require('./api/faxAccount'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x2b'),require(_0xb326('0x2c')));_0x5b5fa8['use'](_0xb326('0x2d'),require(_0xb326('0x2e')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x2f'),require(_0xb326('0x30')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x31'),require(_0xb326('0x32')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x33'),require(_0xb326('0x34')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x35'),require('./api/smsAccount'));_0x5b5fa8[_0xb326('0x8')]('/api/sms/applications',require('./api/smsApplication'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x36'),require(_0xb326('0x37')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x38'),require('./api/smsMessage'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x39'),require(_0xb326('0x3a')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x3b'),require(_0xb326('0x3c')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x3d'),require(_0xb326('0x3e')));_0x5b5fa8['use'](_0xb326('0x3f'),require(_0xb326('0x40')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x41'),require(_0xb326('0x42')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x43'),require('./api/openchannelQueue'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x44'),require(_0xb326('0x45')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x46'),require(_0xb326('0x47')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x48'),require('./api/chatApplication'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x49'),require(_0xb326('0x4a')));_0x5b5fa8['use'](_0xb326('0x4b'),require(_0xb326('0x4c')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x4d'),require(_0xb326('0x4e')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x4f'),require('./api/chatQueue'));_0x5b5fa8['use']('/api/chat/groups',require(_0xb326('0x50')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x51'),require(_0xb326('0x52')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x53'),require(_0xb326('0x54')));_0x5b5fa8['use']('/api/cm/contacts',require('./api/cmContact'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x55'),require('./api/cmHopper'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x56'),require(_0xb326('0x57')));_0x5b5fa8[_0xb326('0x8')]('/api/cm/hopper_final',require(_0xb326('0x58')));_0x5b5fa8['use'](_0xb326('0x59'),require(_0xb326('0x5a')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x5b'),require(_0xb326('0x5c')));_0x5b5fa8['use'](_0xb326('0x5d'),require(_0xb326('0x5e')));_0x5b5fa8['use'](_0xb326('0x5f'),require(_0xb326('0x60')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x61'),require(_0xb326('0x62')));_0x5b5fa8[_0xb326('0x8')]('/api/dispositions',require(_0xb326('0x63')));_0x5b5fa8['use'](_0xb326('0x64'),require(_0xb326('0x65')));_0x5b5fa8[_0xb326('0x8')]('/api/intervals',require('./api/interval'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x66'),require(_0xb326('0x67')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x68'),require(_0xb326('0x69')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x6a'),require(_0xb326('0x6b')));_0x5b5fa8[_0xb326('0x8')]('/api/schedules',require(_0xb326('0x6c')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x6d'),require('./api/sound'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x6e'),require(_0xb326('0x6f')));_0x5b5fa8['use'](_0xb326('0x70'),require(_0xb326('0x71')));_0x5b5fa8[_0xb326('0x8')]('/api/cm_contact_has_items',require(_0xb326('0x72')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x73'),require('./api/cmHopperAdditionalPhone'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x74'),require(_0xb326('0x75')));_0x5b5fa8['use'](_0xb326('0x76'),require(_0xb326('0x77')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x78'),require(_0xb326('0x79')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x7a'),require(_0xb326('0x7b')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x7c'),require('./api/integrationReport'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x7d'),require('./api/analyticCustomReport'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x7e'),require(_0xb326('0x7f')));_0x5b5fa8['use'](_0xb326('0x80'),require(_0xb326('0x81')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x82'),require('./api/analyticMetric'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x83'),require(_0xb326('0x84')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x85'),require(_0xb326('0x86')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x87'),require('./api/intSalesforceAccount'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x88'),require(_0xb326('0x89')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x8a'),require(_0xb326('0x8b')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x8c'),require(_0xb326('0x8d')));_0x5b5fa8['use'](_0xb326('0x8e'),require(_0xb326('0x8f')));_0x5b5fa8[_0xb326('0x8')]('/api/integrations/sugarcrm/fields',require(_0xb326('0x90')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x91'),require(_0xb326('0x92')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x93'),require(_0xb326('0x94')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x95'),require(_0xb326('0x96')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x97'),require(_0xb326('0x98')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x99'),require(_0xb326('0x9a')));_0x5b5fa8[_0xb326('0x8')]('/api/integrations/zoho/fields',require(_0xb326('0x9b')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x9c'),require(_0xb326('0x9d')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x9e'),require('./api/intZendeskConfiguration'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x9f'),require(_0xb326('0xa0')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xa1'),require(_0xb326('0xa2')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xa3'),require(_0xb326('0xa4')));_0x5b5fa8[_0xb326('0x8')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x5b5fa8[_0xb326('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x5b5fa8['use'](_0xb326('0xa5'),require(_0xb326('0xa6')));_0x5b5fa8['use'](_0xb326('0xa7'),require('./api/intVtigerField'));_0x5b5fa8['use'](_0xb326('0xa8'),require(_0xb326('0xa9')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xaa'),require(_0xb326('0xab')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xac'),require(_0xb326('0xad')));_0x5b5fa8['use'](_0xb326('0xae'),require(_0xb326('0xaf')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xb0'),require('./api/intDynamics365Configuration'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xb1'),require(_0xb326('0xb2')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xb3'),require(_0xb326('0xb4')));_0x5b5fa8[_0xb326('0x8')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x5b5fa8[_0xb326('0x8')]('/api/integrations/freshsales/fields',require(_0xb326('0xb5')));_0x5b5fa8['use'](_0xb326('0xb6'),require('./api/network'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xb7'),require(_0xb326('0xb8')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xb9'),require('./api/chatInternalMessage'));_0x5b5fa8[_0xb326('0x8')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x5b5fa8['use'](_0xb326('0xba'),require(_0xb326('0xbb')));_0x5b5fa8['use'](_0xb326('0xbc'),require(_0xb326('0xbd')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xbe'),require(_0xb326('0xbf')));_0x5b5fa8[_0xb326('0x8')]('/api/square/reports',require(_0xb326('0xc0')));_0x5b5fa8['use'](_0xb326('0xc1'),require(_0xb326('0xc2')));_0x5b5fa8[_0xb326('0x8')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xc3'),require(_0xb326('0xc4')));_0x5b5fa8['use']('/api/square/odbc',require(_0xb326('0xc5')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xc6'),require('./api/squareProject'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xc7'),require(_0xb326('0xc8')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xc9'),require(_0xb326('0xca')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xcb'),require('./api/team'));_0x5b5fa8[_0xb326('0x8')]('/api/license',require(_0xb326('0xcc')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xcd'),require(_0xb326('0xce')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xcf'),require(_0xb326('0xd0')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xd1'),require(_0xb326('0xd2')));_0x5b5fa8['use'](_0xb326('0xd3'),require('./api/plugin'));_0x5b5fa8['use'](_0xb326('0xd4'),require(_0xb326('0xd5')));_0x5b5fa8['use'](_0xb326('0xd6'),require(_0xb326('0xd7')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xd8'),require(_0xb326('0xd9')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xda'),require('./api/openchannelTransferReport'));_0x5b5fa8['use'](_0xb326('0xdb'),require(_0xb326('0xdc')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xdd'),require(_0xb326('0xde')));_0x5b5fa8['use'](_0xb326('0xdf'),require('./api/voicePrefix'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xe0'),require(_0xb326('0xe1')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xe2'),require('./api/userProfileSection'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xe3'),require(_0xb326('0xe4')));_0x5b5fa8['use'](_0xb326('0xe5'),require(_0xb326('0xe6')));_0x5b5fa8[_0xb326('0x8')]('/api/whatsapp/accounts',require(_0xb326('0xe7')));_0x5b5fa8['use'](_0xb326('0xe8'),require(_0xb326('0xe9')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xea'),require(_0xb326('0xeb')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xec'),require(_0xb326('0xed')));_0x5b5fa8['use']('/api/whatsapp/reports/queue',require(_0xb326('0xee')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xef'),require(_0xb326('0xf0')));_0x5b5fa8['use']('/api/whatsapp/queues',require(_0xb326('0xf1')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xf2'),require('./api/cloudProvider'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xf3'),require(_0xb326('0xf4')));_0x5b5fa8['use'](_0xb326('0xf5'),require(_0xb326('0xf6')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xf7'),require('./api/authLocal'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xf8'),require(_0xb326('0xf9')));_0x5b5fa8[_0xb326('0x8')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xfa'),require('./api/jira'));_0x5b5fa8['use'](_0xb326('0xfb'),require(_0xb326('0xfc')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0xfd'),require(_0xb326('0xfe')));_0x5b5fa8[_0xb326('0x8')]('/api/system',require('./api/system'));_0x5b5fa8[_0xb326('0x8')]('/api/pm2',require(_0xb326('0xff')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x100'),require(_0xb326('0x101')));_0x5b5fa8['use'](_0xb326('0x102'),clientSideLogs);_0x5b5fa8[_0xb326('0x8')](_0xb326('0x103'),express[_0xb326('0x104')](path[_0xb326('0x105')](config[_0xb326('0x106')],'/apidoc')));_0x5b5fa8[_0xb326('0x8')](_0xb326('0x107'),express[_0xb326('0x104')](path[_0xb326('0x105')](config[_0xb326('0x106')],_0xb326('0x107'))));_0x5b5fa8[_0xb326('0x8')]('/demo',express[_0xb326('0x104')](path['join'](config[_0xb326('0x106')],'/demo')));_0x5b5fa8[_0xb326('0x8')]('/snippet',express[_0xb326('0x104')](path['join'](config['root'],_0xb326('0x108'),_0xb326('0x109'))));_0x5b5fa8['use'](_0xb326('0x10a'),express['static'](path[_0xb326('0x105')](config['root'],'/server/files/plugins')));_0x5b5fa8[_0xb326('0x10b')](_0xb326('0x10c'))['get'](errors[0x194]);_0x5b5fa8[_0xb326('0x10b')]('/*')[_0xb326('0x10d')](function(_0x2f5c0a,_0x51842c){_0x51842c['sendFile'](path[_0xb326('0x10e')](_0x5b5fa8[_0xb326('0x10d')](_0xb326('0x10f'))+'/index.html'));});return _0x5b5fa8;});}; \ No newline at end of file +var _0xf046=['./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/disposition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/variable','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./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/intZohoField','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/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/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/demo','/snippet','snippet','3.1.0','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard'];(function(_0x336280,_0x10a45c){var _0x2a1b5b=function(_0x3c99ea){while(--_0x3c99ea){_0x336280['push'](_0x336280['shift']());}};_0x2a1b5b(++_0x10a45c);}(_0xf046,0x1e4));var _0x6f04=function(_0x57abf7,_0x11bb02){_0x57abf7=_0x57abf7-0x0;var _0x1c7779=_0xf046[_0x57abf7];return _0x1c7779;};'use strict';var path=require('path');var express=require(_0x6f04('0x0'));var errors=require(_0x6f04('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x6f04('0x2'))[_0x6f04('0x3')];var clientSideLogs=require(_0x6f04('0x4'));exports[_0x6f04('0x5')]=function(_0x2f464a){return setupLoggers(_0x2f464a)[_0x6f04('0x6')](function(){_0x2f464a[_0x6f04('0x7')](_0x6f04('0x8'),require(_0x6f04('0x9')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xa'),require(_0x6f04('0xb')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xc'),require(_0x6f04('0xd')));_0x2f464a[_0x6f04('0x7')]('/api/voice/extensions',require(_0x6f04('0xe')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xf'),require(_0x6f04('0x10')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x11'),require(_0x6f04('0x12')));_0x2f464a[_0x6f04('0x7')]('/api/voice/recordings',require(_0x6f04('0x13')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x14'),require(_0x6f04('0x15')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x16'),require('./api/voiceMail'));_0x2f464a[_0x6f04('0x7')]('/api/voice/mails/messages',require(_0x6f04('0x17')));_0x2f464a['use'](_0x6f04('0x18'),require(_0x6f04('0x19')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x1a'),require('./api/voiceDialReport'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x1b'),require(_0x6f04('0x1c')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x1d'),require(_0x6f04('0x1e')));_0x2f464a['use'](_0x6f04('0x1f'),require(_0x6f04('0x20')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x21'),require(_0x6f04('0x22')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x23'),require('./api/voiceTransferReport'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x24'),require('./api/mailServerOut'));_0x2f464a[_0x6f04('0x7')]('/api/mail/accounts',require('./api/mailAccount'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x25'),require(_0x6f04('0x26')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x27'),require(_0x6f04('0x28')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x29'),require(_0x6f04('0x2a')));_0x2f464a[_0x6f04('0x7')]('/api/mail/messages',require(_0x6f04('0x2b')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x2c'),require(_0x6f04('0x2d')));_0x2f464a[_0x6f04('0x7')]('/api/mail/reports/queue',require(_0x6f04('0x2e')));_0x2f464a[_0x6f04('0x7')]('/api/dashboards',require(_0x6f04('0x2f')));_0x2f464a['use']('/api/dashboards/items',require(_0x6f04('0x30')));_0x2f464a['use'](_0x6f04('0x31'),require('./api/faxAccount'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x32'),require(_0x6f04('0x33')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x34'),require(_0x6f04('0x35')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x36'),require(_0x6f04('0x37')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x38'),require('./api/faxQueue'));_0x2f464a[_0x6f04('0x7')]('/api/fax/reports/queue',require(_0x6f04('0x39')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x3a'),require(_0x6f04('0x3b')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x3c'),require(_0x6f04('0x3d')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x3e'),require('./api/smsInteraction'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x3f'),require(_0x6f04('0x40')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x41'),require(_0x6f04('0x42')));_0x2f464a['use'](_0x6f04('0x43'),require(_0x6f04('0x44')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x45'),require(_0x6f04('0x46')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x47'),require('./api/openchannelInteraction'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x48'),require(_0x6f04('0x49')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x4a'),require(_0x6f04('0x4b')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x4c'),require(_0x6f04('0x4d')));_0x2f464a['use']('/api/openchannel/reports/queue',require(_0x6f04('0x4e')));_0x2f464a['use'](_0x6f04('0x4f'),require(_0x6f04('0x50')));_0x2f464a[_0x6f04('0x7')]('/api/chat/interactions',require(_0x6f04('0x51')));_0x2f464a['use'](_0x6f04('0x52'),require('./api/chatMessage'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x53'),require(_0x6f04('0x54')));_0x2f464a['use']('/api/chat/queues',require(_0x6f04('0x55')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x56'),require(_0x6f04('0x57')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x58'),require(_0x6f04('0x59')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x5a'),require('./api/cmCompany'));_0x2f464a[_0x6f04('0x7')]('/api/cm/contacts',require(_0x6f04('0x5b')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x5c'),require(_0x6f04('0x5d')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x5e'),require(_0x6f04('0x5f')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x60'),require('./api/cmHopperFinal'));_0x2f464a['use'](_0x6f04('0x61'),require(_0x6f04('0x62')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x63'),require(_0x6f04('0x64')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x65'),require(_0x6f04('0x66')));_0x2f464a[_0x6f04('0x7')]('/api/automations',require(_0x6f04('0x67')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x68'),require('./api/cannedAnswer'));_0x2f464a[_0x6f04('0x7')]('/api/dispositions',require(_0x6f04('0x69')));_0x2f464a[_0x6f04('0x7')]('/api/conditions',require('./api/condition'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x6a'),require('./api/interval'));_0x2f464a['use'](_0x6f04('0x6b'),require(_0x6f04('0x6c')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x6d'),require(_0x6f04('0x6e')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x6f'),require(_0x6f04('0x70')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x71'),require(_0x6f04('0x72')));_0x2f464a['use']('/api/sounds',require(_0x6f04('0x73')));_0x2f464a[_0x6f04('0x7')]('/api/tags',require(_0x6f04('0x74')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x75'),require(_0x6f04('0x76')));_0x2f464a[_0x6f04('0x7')]('/api/cm_contact_has_items',require(_0x6f04('0x77')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x78'),require(_0x6f04('0x79')));_0x2f464a[_0x6f04('0x7')]('/api/templates',require(_0x6f04('0x7a')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x7b'),require('./api/trigger'));_0x2f464a[_0x6f04('0x7')]('/api/variables',require(_0x6f04('0x7c')));_0x2f464a[_0x6f04('0x7')]('/api/integrations',require('./api/integration'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x7d'),require('./api/integrationReport'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x7e'),require(_0x6f04('0x7f')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x80'),require(_0x6f04('0x81')));_0x2f464a[_0x6f04('0x7')]('/api/analytics/extracted_reports',require(_0x6f04('0x82')));_0x2f464a['use'](_0x6f04('0x83'),require(_0x6f04('0x84')));_0x2f464a[_0x6f04('0x7')]('/api/analytics/field_reports',require(_0x6f04('0x85')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x86'),require(_0x6f04('0x87')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x88'),require(_0x6f04('0x89')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x8a'),require('./api/intSalesforceConfiguration'));_0x2f464a['use'](_0x6f04('0x8b'),require('./api/intSalesforceField'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x8c'),require('./api/intSugarcrmAccount'));_0x2f464a['use']('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x8d'),require(_0x6f04('0x8e')));_0x2f464a['use']('/api/integrations/desk/accounts',require(_0x6f04('0x8f')));_0x2f464a[_0x6f04('0x7')]('/api/integrations/desk/configurations',require(_0x6f04('0x90')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x91'),require(_0x6f04('0x92')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x93'),require(_0x6f04('0x94')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x95'),require(_0x6f04('0x96')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x97'),require(_0x6f04('0x98')));_0x2f464a['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x99'),require('./api/intZendeskConfiguration'));_0x2f464a['use'](_0x6f04('0x9a'),require(_0x6f04('0x9b')));_0x2f464a['use'](_0x6f04('0x9c'),require(_0x6f04('0x9d')));_0x2f464a['use']('/api/integrations/freshdesk/configurations',require(_0x6f04('0x9e')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x9f'),require('./api/intFreshdeskField'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xa0'),require(_0x6f04('0xa1')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xa2'),require('./api/intVtigerConfiguration'));_0x2f464a[_0x6f04('0x7')]('/api/integrations/vtiger/fields',require(_0x6f04('0xa3')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xa4'),require(_0x6f04('0xa5')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xa6'),require(_0x6f04('0xa7')));_0x2f464a[_0x6f04('0x7')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x2f464a['use'](_0x6f04('0xa8'),require(_0x6f04('0xa9')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xaa'),require('./api/intDynamics365Configuration'));_0x2f464a[_0x6f04('0x7')]('/api/integrations/dynamics365/fields',require(_0x6f04('0xab')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xac'),require(_0x6f04('0xad')));_0x2f464a[_0x6f04('0x7')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xae'),require('./api/intFreshsalesField'));_0x2f464a[_0x6f04('0x7')]('/api/networks',require(_0x6f04('0xaf')));_0x2f464a['use'](_0x6f04('0xb0'),require('./api/chatQueueReport'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xb1'),require(_0x6f04('0xb2')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xb3'),require('./api/jscriptyAnswerReport'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xb4'),require('./api/jscriptyQuestionReport'));_0x2f464a['use'](_0x6f04('0xb5'),require(_0x6f04('0xb6')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xb7'),require('./api/smsQueueReport'));_0x2f464a['use'](_0x6f04('0xb8'),require(_0x6f04('0xb9')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xba'),require(_0x6f04('0xbb')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xbc'),require('./api/jscriptyProject'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xbd'),require(_0x6f04('0xbe')));_0x2f464a[_0x6f04('0x7')]('/api/square/odbc',require(_0x6f04('0xbf')));_0x2f464a[_0x6f04('0x7')]('/api/square/projects',require(_0x6f04('0xc0')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xc1'),require(_0x6f04('0xc2')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xc3'),require('./api/squareMessage'));_0x2f464a['use'](_0x6f04('0xc4'),require('./api/team'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xc5'),require(_0x6f04('0xc6')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xc7'),require('./api/campaign'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xc8'),require(_0x6f04('0xc9')));_0x2f464a['use'](_0x6f04('0xca'),require(_0x6f04('0xcb')));_0x2f464a['use'](_0x6f04('0xcc'),require('./api/plugin'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xcd'),require(_0x6f04('0xce')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xcf'),require(_0x6f04('0xd0')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xd1'),require('./api/faxTransferReport'));_0x2f464a['use']('/api/openchannel/reports/transfer',require(_0x6f04('0xd2')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xd3'),require(_0x6f04('0xd4')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xd5'),require('./api/cmList'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xd6'),require(_0x6f04('0xd7')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xd8'),require('./api/userProfile'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xd9'),require('./api/userProfileSection'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xda'),require(_0x6f04('0xdb')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xdc'),require('./api/userNotification'));_0x2f464a[_0x6f04('0x7')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x2f464a['use'](_0x6f04('0xdd'),require('./api/whatsappApplication'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xde'),require(_0x6f04('0xdf')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xe0'),require(_0x6f04('0xe1')));_0x2f464a[_0x6f04('0x7')]('/api/whatsapp/reports/queue',require(_0x6f04('0xe2')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xe3'),require(_0x6f04('0xe4')));_0x2f464a[_0x6f04('0x7')]('/api/whatsapp/queues',require(_0x6f04('0xe5')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xe6'),require(_0x6f04('0xe7')));_0x2f464a['use'](_0x6f04('0xe8'),require(_0x6f04('0xe9')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xea'),require('./api/user-setting'));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xeb'),require(_0x6f04('0xec')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xed'),require(_0x6f04('0xee')));_0x2f464a[_0x6f04('0x7')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x2f464a['use'](_0x6f04('0xef'),require(_0x6f04('0xf0')));_0x2f464a['use'](_0x6f04('0xf1'),require(_0x6f04('0xf2')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xf3'),require(_0x6f04('0xf4')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xf5'),require(_0x6f04('0xf6')));_0x2f464a['use'](_0x6f04('0xf7'),require(_0x6f04('0xf8')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xf9'),require(_0x6f04('0xfa')));_0x2f464a[_0x6f04('0x7')]('/api/logs',clientSideLogs);_0x2f464a[_0x6f04('0x7')]('/apidoc',express[_0x6f04('0xfb')](path[_0x6f04('0xfc')](config[_0x6f04('0xfd')],_0x6f04('0xfe'))));_0x2f464a[_0x6f04('0x7')]('/www',express[_0x6f04('0xfb')](path[_0x6f04('0xfc')](config[_0x6f04('0xfd')],'/www')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0xff'),express[_0x6f04('0xfb')](path['join'](config[_0x6f04('0xfd')],'/demo')));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x100'),express[_0x6f04('0xfb')](path[_0x6f04('0xfc')](config[_0x6f04('0xfd')],_0x6f04('0x101'),_0x6f04('0x102'))));_0x2f464a[_0x6f04('0x7')](_0x6f04('0x103'),express[_0x6f04('0xfb')](path[_0x6f04('0xfc')](config['root'],_0x6f04('0x104'))));_0x2f464a[_0x6f04('0x105')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x2f464a['route']('/*')[_0x6f04('0x106')](function(_0x506a99,_0x50065c){_0x50065c['sendFile'](path[_0x6f04('0x107')](_0x2f464a[_0x6f04('0x106')](_0x6f04('0x108'))+_0x6f04('0x109')));});return _0x2f464a;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a88e797..96092eb 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x278f=['../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.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/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc'];(function(_0x2eda7d,_0x162382){var _0x2fd21d=function(_0x3bf4d0){while(--_0x3bf4d0){_0x2eda7d['push'](_0x2eda7d['shift']());}};_0x2fd21d(++_0x162382);}(_0x278f,0x12b));var _0xf278=function(_0x342929,_0x2276b8){_0x342929=_0x342929-0x0;var _0x3e7f17=_0x278f[_0x342929];return _0x3e7f17;};'use strict';var jayson=require(_0xf278('0x0'));var _=require(_0xf278('0x1'));var config=require('../config/environment');exports[_0xf278('0x2')]=function(){return new Promise(function(_0x5188ff,_0x1807d9){var _0x4334ec={};_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x4')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x5')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/voiceQueue/voiceQueue.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x6')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x7')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x8')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x9')));_0x4334ec=_['merge'](_0x4334ec,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0xa')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0xb')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0xc')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0xd')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0xe')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0xf')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x10')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/mailMessage/mailMessage.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/mailApplication/mailApplication.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x11')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x12')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x13')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x14')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x15')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x16')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x17')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x18')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x19')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x1a')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x1b')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x1c')));_0x4334ec=_['merge'](_0x4334ec,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x1d')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x1e')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x1f')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x20')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/chatQueue/chatQueue.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x21')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x22')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x23')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/interval/interval.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x24')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x25')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require('../api/template/template.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x26')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x27')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x28')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x29')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x2a')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x2b')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x2c')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x2d')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x2e')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x2f')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x30')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x31')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x32')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x33')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x34')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x35')));_0x4334ec=_['merge'](_0x4334ec,require('../api/setting/setting.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x36')));_0x4334ec=_['merge'](_0x4334ec,require('../api/squareProject/squareProject.rpc'));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x37')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x38')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x39')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x3a')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x3b')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x3c')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x3d')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x3e')));_0x4334ec=_['merge'](_0x4334ec,require(_0xf278('0x3f')));_0x4334ec=_[_0xf278('0x3')](_0x4334ec,require(_0xf278('0x40')));var _0x4e1e7f=jayson[_0xf278('0x41')](_0x4334ec)[_0xf278('0x42')]();var _0x43c859=config['rpc'][_0xf278('0x43')]||config['port']+0x1;var _0x586b97=config['rpc']['ip']||'localhost';_0x4e1e7f['on']('error',function(_0x570231){return _0x1807d9(_0x570231);});_0x4e1e7f[_0xf278('0x2')](_0x43c859,_0x586b97,function(){console['log'](_0xf278('0x44'),_0x586b97,_0x43c859);require(_0xf278('0x45'))['default']();return _0x5188ff(_0xf278('0x46')+_0x586b97+':'+_0x43c859);});});}; \ No newline at end of file +var _0x0755=['../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc'];(function(_0x12a201,_0x30aaba){var _0x52a4d2=function(_0x5ca28d){while(--_0x5ca28d){_0x12a201['push'](_0x12a201['shift']());}};_0x52a4d2(++_0x30aaba);}(_0x0755,0x194));var _0x5075=function(_0x2d7e4e,_0xaf55ad){_0x2d7e4e=_0x2d7e4e-0x0;var _0x143072=_0x0755[_0x2d7e4e];return _0x143072;};'use strict';var jayson=require(_0x5075('0x0'));var _=require(_0x5075('0x1'));var config=require('../config/environment');exports[_0x5075('0x2')]=function(){return new Promise(function(_0x4d699c,_0x41e282){var _0x2a0928={};_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x4')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x5')));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x6')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x7')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x8')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x9')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0xa')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0xb')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0xc')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0xd')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0xe')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0xf')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x10')));_0x2a0928=_['merge'](_0x2a0928,require('../api/mailInteraction/mailInteraction.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x11')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x12')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x13')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require('../api/faxAccount/faxAccount.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require('../api/faxApplication/faxApplication.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x14')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x15')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x16')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x17')));_0x2a0928=_['merge'](_0x2a0928,require('../api/smsAccount/smsAccount.rpc'));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x18')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require('../api/smsMessage/smsMessage.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x19')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x1a')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x1b')));_0x2a0928=_['merge'](_0x2a0928,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x1c')));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x1d')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x1e')));_0x2a0928=_['merge'](_0x2a0928,require('../api/chatMessage/chatMessage.rpc'));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x1f')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x20')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x21')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x22')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x23')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x24')));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x25')));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x26')));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x27')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x28')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x29')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require('../api/template/template.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x2a')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x2b')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x2c')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x2d')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x2e')));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x2f')));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x30')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x31')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x32')));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x33')));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x34')));_0x2a0928=_['merge'](_0x2a0928,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x35')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x36')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x37')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require('../api/squareOdbc/squareOdbc.rpc'));_0x2a0928=_['merge'](_0x2a0928,require('../api/squareProject/squareProject.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x38')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x39')));_0x2a0928=_['merge'](_0x2a0928,require('../api/campaign/campaign.rpc'));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x3a')));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x3b')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x3c')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x3d')));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2a0928=_[_0x5075('0x3')](_0x2a0928,require(_0x5075('0x3e')));_0x2a0928=_['merge'](_0x2a0928,require(_0x5075('0x3f')));var _0x2cddb7=jayson[_0x5075('0x40')](_0x2a0928)[_0x5075('0x41')]();var _0x5c8e9f=config[_0x5075('0x42')][_0x5075('0x43')]||config[_0x5075('0x43')]+0x1;var _0x3ebf6f=config[_0x5075('0x42')]['ip']||_0x5075('0x44');_0x2cddb7['on'](_0x5075('0x45'),function(_0x514bd7){return _0x41e282(_0x514bd7);});_0x2cddb7[_0x5075('0x2')](_0x5c8e9f,_0x3ebf6f,function(){console[_0x5075('0x46')](_0x5075('0x47'),_0x3ebf6f,_0x5c8e9f);require(_0x5075('0x48'))[_0x5075('0x49')]();return _0x4d699c(_0x5075('0x4a')+_0x3ebf6f+':'+_0x5c8e9f);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 63b5ab6..4490878 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 _0x2544=['SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','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','agi','AGI','wait','exec','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','lodash','events','EventEmitter','./reply','setEncoding','utf8','setTimeout','headers','emit','ready','line','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','replace','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sync','answer','sendRequest','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','hangup','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x2544,0x1ec));var _0x4254=function(_0x4b1f18,_0x292559){_0x4b1f18=_0x4b1f18-0x0;var _0x78a510=_0x2544[_0x4b1f18];return _0x78a510;};'use strict';var util=require('util');var _=require(_0x4254('0x0'));var EventEmitter=require(_0x4254('0x1'))[_0x4254('0x2')];var AGIReply=require(_0x4254('0x3'));var AGIError=require('./error');function AGIChannel(_0x448916){var _0x31e585=this,_0x483d09=new AGIReply(),_0x5b263c=![],_0x8aa018={};EventEmitter['call'](_0x31e585);_0x448916[_0x4254('0x4')](_0x4254('0x5'));_0x448916[_0x4254('0x6')](0x8*0x3c*0x3c*0x3e8);_0x483d09[_0x4254('0x4')](_0x4254('0x5'));_0x483d09['on'](_0x4254('0x7'),function(_0x1caf13){for(var _0x214894 in _0x1caf13){_0x31e585[_0x214894]=_0x1caf13[_0x214894];}_0x31e585[_0x4254('0x8')](_0x4254('0x9'));});_0x483d09['on'](_0x4254('0xa'),function(_0x286b2d){if(_0x286b2d['toLowerCase']()=='hangup'){_0x31e585['emit']('hangup');return;}if(_0x286b2d['substring'](0x0,0xb)==_0x4254('0xb')){_0x5b263c=!![];}if(_0x5b263c){_0x8aa018['rx']+=_0x286b2d+'\x0a';if(_0x286b2d[_0x4254('0xc')](_0x4254('0xd'))!=-0x1){_0x5b263c=![];}}else{_0x8aa018['rx']=_0x286b2d;}if(_0x5b263c){return;}if(typeof _0x8aa018['cb']==_0x4254('0xe')){var _0x3ce95b=_0x8aa018['rx'][_0x4254('0xf')](0x0,0x3),_0x52285a=null,_0x3fab44=null;_0x3ce95b=parseInt(_0x3ce95b);if(isNaN(_0x3ce95b)){_0x8aa018['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x3ce95b!=0xc8){_0x8aa018['cb'](null,{'code':_0x3ce95b,'result':-0x1,'extra':'KO'});return;}_0x52285a=_0x8aa018['rx'][_0x4254('0xf')](0x4)[_0x4254('0x10')]('result=','');if(_0x52285a[_0x4254('0x11')]('\x20')!=-0x1){_0x52285a=_0x52285a['substr'](0x0,_0x52285a[_0x4254('0x11')]('\x20'));}if(_[_0x4254('0x12')](_0x52285a,'-1')){_0x52285a=parseInt(_0x52285a);}_0x3fab44=_0x8aa018['rx'][_0x4254('0x13')]('\x20');if(_0x3fab44['length']==0x3){_0x3fab44=_0x3fab44[0x2][_0x4254('0xf')](0x1,_0x3fab44[0x2]['length']-0x1);}else if(_0x3fab44[_0x4254('0x14')]>0x3){var _0x1dd188=/\((.+)\)/;var _0x2e371d=_0x8aa018['rx'][_0x4254('0x15')](_0x1dd188);if(_0x2e371d){_0x3fab44=_0x2e371d[0x1];}else{_0x3fab44=null;}}else{_0x3fab44=null;}_0x8aa018['cb'](null,{'code':_0x3ce95b,'result':_0x52285a,'extra':_0x3fab44});}});_0x448916['on'](_0x4254('0x16'),function(_0x18fbe9){_0x31e585['emit'](_0x4254('0x16'),new AGIError(_0x4254('0x17'),_0x18fbe9[_0x4254('0x18')]));});_0x448916['on']('close',function(){_0x31e585[_0x4254('0x8')](_0x4254('0x19'),new AGIError(_0x4254('0x1a')));});_0x448916['on'](_0x4254('0x1b'),function(){_0x31e585['emit']('timeout',new AGIError(_0x4254('0x1c')));_0x448916[_0x4254('0x1d')]();});_0x448916[_0x4254('0x1e')](_0x483d09);this[_0x4254('0x1f')]=function(_0xf3b761,_0x44e6a8){var _0xf3b761=_0xf3b761||'',_0x44e6a8=typeof _0x44e6a8=='function'?_0x44e6a8:new Function();_0x8aa018={'tx':_0xf3b761,'rx':'','cb':_0x44e6a8};_0x448916[_0x4254('0x20')](_0xf3b761+'\x0a');},this[_0x4254('0x19')]=function(){_0x448916['destroy']();};}util[_0x4254('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x4254('0x22')]['sendRequest']=function(_0x1af8cd){return this[_0x4254('0x1f')][_0x4254('0x23')](this,_0x1af8cd);};AGIChannel[_0x4254('0x22')][_0x4254('0x24')]=function(){return this[_0x4254('0x25')](_0x4254('0x26'));};AGIChannel[_0x4254('0x22')]['getData']=function(_0x49fc90,_0x2426be,_0x3991fa){_0x49fc90=_0x49fc90===undefined?_0x4254('0x27'):_0x49fc90;_0x2426be=_0x2426be===undefined?'5':_0x2426be;_0x3991fa=_0x3991fa===undefined?'1':_0x3991fa;return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x29'),_0x49fc90,_0x2426be*0x3e8,_0x3991fa));};AGIChannel['prototype'][_0x4254('0x2a')]=function(_0x1600cf){_0x1600cf=_0x1600cf||_0x4254('0x2b');return this[_0x4254('0x25')](util['format'](_0x4254('0x2c'),_0x1600cf));};AGIChannel['prototype']['exec']=function(_0x3dd104,_0x186644){if(_[_0x4254('0x2d')](_0x186644)){return this[_0x4254('0x25')](util['format'](_0x4254('0x2e'),_0x3dd104,_0x186644[_0x4254('0x2f')](',')));}return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x2e'),_0x3dd104,_0x186644));};AGIChannel[_0x4254('0x22')][_0x4254('0x30')]=function(_0x3e76d3){return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x31'),_0x3e76d3));};AGIChannel[_0x4254('0x22')][_0x4254('0x32')]=function(_0x20f2ee){return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x33'),_0x20f2ee));};AGIChannel[_0x4254('0x22')][_0x4254('0x34')]=function(_0x1b90b6){return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x35'),_0x1b90b6));};AGIChannel[_0x4254('0x22')][_0x4254('0x36')]=function(){return this[_0x4254('0x25')](_0x4254('0x37'));};AGIChannel[_0x4254('0x22')][_0x4254('0x38')]=function(_0x1b5aff,_0x4db986){var _0x335775=_[_0x4254('0x39')](_0x4db986)||_[_0x4254('0x3a')](_0x4db986)?_0x4db986[_0x4254('0x3b')]():_0x4db986;return this[_0x4254('0x25')](util[_0x4254('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x1b5aff,_0x335775?_0x335775[_0x4254('0x3b')]()[_0x4254('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x4254('0x3c')]=function(_0x5bdc9d,_0x60c046){return this[_0x4254('0x25')](util['format'](_0x4254('0x3d'),_0x5bdc9d,_0x60c046));};AGIChannel['prototype'][_0x4254('0x3e')]=function(_0x2a9626,_0x335ef3){return this[_0x4254('0x25')](util[_0x4254('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x2a9626,_0x335ef3));};AGIChannel[_0x4254('0x22')][_0x4254('0x3f')]=function(_0x1647b5,_0xc6e36b){return this[_0x4254('0x25')](util['format'](_0x4254('0x40'),_0x1647b5,_0xc6e36b));};AGIChannel['prototype'][_0x4254('0x41')]=function(_0x5c9d2b,_0x527321,_0x1c4486){_0x527321=_0x527321||this[_0x4254('0x42')];_0x1c4486=_0x1c4486||0x1;this[_0x4254('0x30')](_0x5c9d2b);this[_0x4254('0x32')](_0x527321);this['setPriority'](_0x1c4486);return this[_0x4254('0x2a')](util[_0x4254('0x28')](_0x4254('0x43'),_0x5c9d2b,_0x527321,_0x1c4486));};AGIChannel[_0x4254('0x22')]['getVariable']=function(_0x415f00){return this['sendRequest'](util[_0x4254('0x28')](_0x4254('0x44'),_0x415f00));};AGIChannel[_0x4254('0x22')][_0x4254('0x45')]=function(_0x580588,_0x31b953,_0x25572f,_0x3b8fb1,_0x26fbfd,_0x600caa){_0x31b953=_0x31b953||_0x4254('0x46');_0x25572f=_0x25572f||'';_0x3b8fb1=_0x3b8fb1===undefined?-0x1:_0x3b8fb1==='-1'?-0x1:_0x3b8fb1*0x3e8;_0x26fbfd=_0x26fbfd===undefined?'':'s='+_0x26fbfd;_0x600caa=_0x600caa?_0x4254('0x47'):'';return this[_0x4254('0x25')](util[_0x4254('0x28')](_0x4254('0x48'),_0x580588,_0x31b953,_0x25572f,_0x3b8fb1,_0x600caa,_0x26fbfd));};AGIChannel['prototype']['streamFile']=function(_0x6e42,_0x353ed5){_0x353ed5=_0x353ed5||'';return this[_0x4254('0x25')](util[_0x4254('0x28')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x6e42,_0x353ed5));};AGIChannel[_0x4254('0x22')][_0x4254('0x49')]=function(_0x308159){return this['exec'](_0x4254('0x4a'),_0x308159);};AGIChannel[_0x4254('0x22')][_0x4254('0x4b')]=function(_0x44c195){return this[_0x4254('0x4c')]('WAIT',_0x44c195);};AGIChannel['prototype'][_0x4254('0x16')]=function(_0x871608,_0x488fbc){this[_0x4254('0x2a')](util[_0x4254('0x28')](_0x4254('0x4d'),_0x871608['id'],_0x871608[_0x4254('0x4e')],_0x488fbc));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xa5c1=['SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','extension','setExtension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','call','setEncoding','setTimeout','utf8','headers','emit','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','close','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x539c1e,_0x1c5c1d){_0x539c1e=_0x539c1e-0x0;var _0x44f34a=_0xa5c1[_0x539c1e];return _0x44f34a;};'use strict';var util=require(_0x1a5c('0x0'));var _=require(_0x1a5c('0x1'));var EventEmitter=require(_0x1a5c('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x1a5c('0x3'));function AGIChannel(_0x543e69){var _0x1013a3=this,_0x2889d3=new AGIReply(),_0x441817=![],_0x3df6c5={};EventEmitter[_0x1a5c('0x4')](_0x1013a3);_0x543e69[_0x1a5c('0x5')]('utf8');_0x543e69[_0x1a5c('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2889d3['setEncoding'](_0x1a5c('0x7'));_0x2889d3['on'](_0x1a5c('0x8'),function(_0x1702ce){for(var _0x5666c3 in _0x1702ce){_0x1013a3[_0x5666c3]=_0x1702ce[_0x5666c3];}_0x1013a3[_0x1a5c('0x9')]('ready');});_0x2889d3['on'](_0x1a5c('0xa'),function(_0x4edb10){if(_0x4edb10['toLowerCase']()==_0x1a5c('0xb')){_0x1013a3[_0x1a5c('0x9')]('hangup');return;}if(_0x4edb10[_0x1a5c('0xc')](0x0,0xb)==_0x1a5c('0xd')){_0x441817=!![];}if(_0x441817){_0x3df6c5['rx']+=_0x4edb10+'\x0a';if(_0x4edb10[_0x1a5c('0xe')](_0x1a5c('0xf'))!=-0x1){_0x441817=![];}}else{_0x3df6c5['rx']=_0x4edb10;}if(_0x441817){return;}if(typeof _0x3df6c5['cb']==_0x1a5c('0x10')){var _0x2b8a65=_0x3df6c5['rx'][_0x1a5c('0xc')](0x0,0x3),_0x38c7d7=null,_0x5bfb05=null;_0x2b8a65=parseInt(_0x2b8a65);if(isNaN(_0x2b8a65)){_0x3df6c5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1a5c('0x11')});return;}if(_0x2b8a65!=0xc8){_0x3df6c5['cb'](null,{'code':_0x2b8a65,'result':-0x1,'extra':'KO'});return;}_0x38c7d7=_0x3df6c5['rx']['substring'](0x4)[_0x1a5c('0x12')](_0x1a5c('0x13'),'');if(_0x38c7d7['indexOf']('\x20')!=-0x1){_0x38c7d7=_0x38c7d7[_0x1a5c('0x14')](0x0,_0x38c7d7[_0x1a5c('0x15')]('\x20'));}if(_[_0x1a5c('0x16')](_0x38c7d7,'-1')){_0x38c7d7=parseInt(_0x38c7d7);}_0x5bfb05=_0x3df6c5['rx'][_0x1a5c('0x17')]('\x20');if(_0x5bfb05['length']==0x3){_0x5bfb05=_0x5bfb05[0x2][_0x1a5c('0xc')](0x1,_0x5bfb05[0x2]['length']-0x1);}else if(_0x5bfb05[_0x1a5c('0x18')]>0x3){var _0x44648a=/\((.+)\)/;var _0x57cb61=_0x3df6c5['rx']['match'](_0x44648a);if(_0x57cb61){_0x5bfb05=_0x57cb61[0x1];}else{_0x5bfb05=null;}}else{_0x5bfb05=null;}_0x3df6c5['cb'](null,{'code':_0x2b8a65,'result':_0x38c7d7,'extra':_0x5bfb05});}});_0x543e69['on']('error',function(_0x32e177){_0x1013a3[_0x1a5c('0x9')](_0x1a5c('0x19'),new AGIError(_0x1a5c('0x1a'),_0x32e177[_0x1a5c('0x1b')]));});_0x543e69['on']('close',function(){_0x1013a3[_0x1a5c('0x9')]('close',new AGIError(_0x1a5c('0x1c')));});_0x543e69['on'](_0x1a5c('0x1d'),function(){_0x1013a3[_0x1a5c('0x9')]('timeout',new AGIError(_0x1a5c('0x1e')));_0x543e69[_0x1a5c('0x1f')]();});_0x543e69[_0x1a5c('0x20')](_0x2889d3);this[_0x1a5c('0x21')]=function(_0x144abf,_0x4d04d0){var _0x144abf=_0x144abf||'',_0x4d04d0=typeof _0x4d04d0==_0x1a5c('0x10')?_0x4d04d0:new Function();_0x3df6c5={'tx':_0x144abf,'rx':'','cb':_0x4d04d0};_0x543e69[_0x1a5c('0x22')](_0x144abf+'\x0a');},this[_0x1a5c('0x23')]=function(){_0x543e69[_0x1a5c('0x1f')]();};}util[_0x1a5c('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x26')]=function(_0x751c88){return this[_0x1a5c('0x21')][_0x1a5c('0x27')](this,_0x751c88);};AGIChannel['prototype'][_0x1a5c('0x28')]=function(){return this['sendRequest'](_0x1a5c('0x29'));};AGIChannel['prototype'][_0x1a5c('0x2a')]=function(_0x4323f8,_0x12784b,_0x1ba1cf){_0x4323f8=_0x4323f8===undefined?_0x1a5c('0x2b'):_0x4323f8;_0x12784b=_0x12784b===undefined?'5':_0x12784b;_0x1ba1cf=_0x1ba1cf===undefined?'1':_0x1ba1cf;return this[_0x1a5c('0x26')](util[_0x1a5c('0x2c')](_0x1a5c('0x2d'),_0x4323f8,_0x12784b*0x3e8,_0x1ba1cf));};AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x2e')]=function(_0x444f1c){_0x444f1c=_0x444f1c||'NO\x20MESSAGE';return this[_0x1a5c('0x26')](util[_0x1a5c('0x2c')](_0x1a5c('0x2f'),_0x444f1c));};AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x30')]=function(_0x36335c,_0x406470){if(_[_0x1a5c('0x31')](_0x406470)){return this[_0x1a5c('0x26')](util['format'](_0x1a5c('0x32'),_0x36335c,_0x406470[_0x1a5c('0x33')](',')));}return this[_0x1a5c('0x26')](util[_0x1a5c('0x2c')]('EXEC\x20%s\x20%s',_0x36335c,_0x406470));};AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x34')]=function(_0x25adc6){return this[_0x1a5c('0x26')](util[_0x1a5c('0x2c')](_0x1a5c('0x35'),_0x25adc6));};AGIChannel[_0x1a5c('0x25')]['setExtension']=function(_0x1a6dcf){return this[_0x1a5c('0x26')](util['format'](_0x1a5c('0x36'),_0x1a6dcf));};AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x37')]=function(_0x22867a){return this['sendRequest'](util[_0x1a5c('0x2c')](_0x1a5c('0x38'),_0x22867a));};AGIChannel['prototype'][_0x1a5c('0xb')]=function(){return this[_0x1a5c('0x26')](_0x1a5c('0x39'));};AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x3a')]=function(_0x4324e5,_0x38e8cb){var _0x1b80af=_[_0x1a5c('0x3b')](_0x38e8cb)||_[_0x1a5c('0x3c')](_0x38e8cb)?_0x38e8cb['toString']():_0x38e8cb;return this[_0x1a5c('0x26')](util[_0x1a5c('0x2c')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4324e5,_0x1b80af?_0x1b80af[_0x1a5c('0x3d')]()[_0x1a5c('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x294b69,_0xefaf30){return this[_0x1a5c('0x26')](util[_0x1a5c('0x2c')]('SAY\x20NUMBER\x20%s\x20%s',_0x294b69,_0xefaf30));};AGIChannel['prototype'][_0x1a5c('0x3e')]=function(_0x387152,_0x379f21){return this['sendRequest'](util[_0x1a5c('0x2c')](_0x1a5c('0x3f'),_0x387152,_0x379f21));};AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x40')]=function(_0x2c37e3,_0x344efa){return this[_0x1a5c('0x26')](util[_0x1a5c('0x2c')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2c37e3,_0x344efa));};AGIChannel['prototype']['continueAt']=function(_0x44700d,_0x500d6e,_0x5943a9){_0x500d6e=_0x500d6e||this[_0x1a5c('0x41')];_0x5943a9=_0x5943a9||0x1;this[_0x1a5c('0x34')](_0x44700d);this[_0x1a5c('0x42')](_0x500d6e);this[_0x1a5c('0x37')](_0x5943a9);return this[_0x1a5c('0x2e')](util[_0x1a5c('0x2c')]('GOTO\x20%s\x20%s\x20%s',_0x44700d,_0x500d6e,_0x5943a9));};AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x43')]=function(_0x2fef3e){return this['sendRequest'](util[_0x1a5c('0x2c')](_0x1a5c('0x44'),_0x2fef3e));};AGIChannel[_0x1a5c('0x25')]['recordFile']=function(_0x2f3621,_0x2499fd,_0x509f95,_0x340d5b,_0x194663,_0x5743de){_0x2499fd=_0x2499fd||'wav';_0x509f95=_0x509f95||'';_0x340d5b=_0x340d5b===undefined?-0x1:_0x340d5b==='-1'?-0x1:_0x340d5b*0x3e8;_0x194663=_0x194663===undefined?'':'s='+_0x194663;_0x5743de=_0x5743de?'BEEP':'';return this[_0x1a5c('0x26')](util[_0x1a5c('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x2f3621,_0x2499fd,_0x509f95,_0x340d5b,_0x5743de,_0x194663));};AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x45')]=function(_0x435d6a,_0xe74fd0){_0xe74fd0=_0xe74fd0||'';return this[_0x1a5c('0x26')](util[_0x1a5c('0x2c')](_0x1a5c('0x46'),_0x435d6a,_0xe74fd0));};AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x47')]=function(_0x1aba56){return this['exec'](_0x1a5c('0x48'),_0x1aba56);};AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x49')]=function(_0x11f4c2){return this[_0x1a5c('0x30')](_0x1a5c('0x4a'),_0x11f4c2);};AGIChannel[_0x1a5c('0x25')][_0x1a5c('0x19')]=function(_0x2c2c2e,_0x4dcefb){this['noop'](util['format'](_0x1a5c('0x4b'),_0x2c2c2e['id'],_0x2c2c2e[_0x1a5c('0x4c')],_0x4dcefb));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1a5c('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d05baea..94a5ff0 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 _0x6ce9=['Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x6ce9,0x15a));var _0x96ce=function(_0x166081,_0xe195d0){_0x166081=_0x166081-0x0;var _0x2f5340=_0x6ce9[_0x166081];return _0x2f5340;};'use strict';var util=require(_0x96ce('0x0'));var error={'E_AGI_UNDEFINED':_0x96ce('0x1'),'E_AGI_ARGUMENT_PORT':_0x96ce('0x2'),'E_AGI_SERVER_ERROR':_0x96ce('0x3'),'E_AGI_SERVER_CLOSE':_0x96ce('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x96ce('0x5'),'E_AGI_SOCKET_CLOSE':_0x96ce('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x96ce('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x96ce('0x8'),'E_AGI_IVR_ENTRY':_0x96ce('0x9')};function AGIError(_0x58177c){var _0x58177c=_0x58177c||null,_0x2a227f=_0x2a227f||[],_0xf28e7d=0x1,_0x489095='';if(!error[_0x58177c]){_0x58177c='E_AGI_UNDEFINED';}_0x2a227f[_0x96ce('0xa')](error[_0x58177c]);while(arguments[_0xf28e7d]){_0x2a227f[_0x96ce('0xa')](arguments[_0xf28e7d]);_0xf28e7d++;}_0x489095=util[_0x96ce('0xb')]['apply'](util,_0x2a227f);this[_0x96ce('0xc')]=_0x489095;this['name']=_0x58177c;}module[_0x96ce('0xd')]=AGIError; \ No newline at end of file +var _0xc9e9=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x467e9e,_0x4a6888){var _0x10376a=function(_0x5f3437){while(--_0x5f3437){_0x467e9e['push'](_0x467e9e['shift']());}};_0x10376a(++_0x4a6888);}(_0xc9e9,0xd8));var _0x9c9e=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0xc9e9[_0xb301d4];return _0x3b5bde;};'use strict';var util=require(_0x9c9e('0x0'));var error={'E_AGI_UNDEFINED':_0x9c9e('0x1'),'E_AGI_ARGUMENT_PORT':_0x9c9e('0x2'),'E_AGI_SERVER_ERROR':_0x9c9e('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x9c9e('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x9c9e('0x5'),'E_AGI_SOCKET_ERROR':_0x9c9e('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x9c9e('0x7'),'E_AGI_COMMAND_EMPTY':_0x9c9e('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x9c9e('0x9'),'E_AGI_IVR_ENTRY':_0x9c9e('0xa')};function AGIError(_0x3817db){var _0x3817db=_0x3817db||null,_0x158039=_0x158039||[],_0x4e7edf=0x1,_0x1ab745='';if(!error[_0x3817db]){_0x3817db=_0x9c9e('0xb');}_0x158039['push'](error[_0x3817db]);while(arguments[_0x4e7edf]){_0x158039[_0x9c9e('0xc')](arguments[_0x4e7edf]);_0x4e7edf++;}_0x1ab745=util['format'][_0x9c9e('0xd')](util,_0x158039);this[_0x9c9e('0xe')]=_0x1ab745;this[_0x9c9e('0xf')]=_0x3817db;}module[_0x9c9e('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 99b7c53..36d6618 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1071=['localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','events','ioredis','./error','defaults','redis'];(function(_0x159861,_0x10a60e){var _0x441a83=function(_0x2eed2d){while(--_0x2eed2d){_0x159861['push'](_0x159861['shift']());}};_0x441a83(++_0x10a60e);}(_0x1071,0xca));var _0x1107=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1071[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x1107('0x0'));var EventEmitter=require(_0x1107('0x1'))['EventEmitter'];var Redis=require(_0x1107('0x2'));var AGIError=require(_0x1107('0x3'));var config=require('../../config/environment');config['redis']=_[_0x1107('0x4')](config[_0x1107('0x5')],{'host':_0x1107('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x1107('0x7')](_0x1107('0x8'),function(_0x122979){if(_0x122979)return eventEmitter[_0x1107('0x9')](_0x1107('0xa'),new AGIError(_0x1107('0xb'),_0x122979));});sub['on'](_0x1107('0xc'),function(_0x3b4090,_0x35ec10){if(_0x3b4090!=='agi')return;try{var _0x5d9019=JSON[_0x1107('0xd')](_0x35ec10);eventEmitter['emit'](_0x1107('0xe'),_0x5d9019);}catch(_0x298a8b){eventEmitter[_0x1107('0x9')](_0x1107('0xa'),new AGIError(_0x1107('0xb'),_0x298a8b));}});module[_0x1107('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xb10f=['subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','lodash','EventEmitter','./error','../../config/environment','redis','defaults','localhost'];(function(_0x1bf66e,_0x415bac){var _0x32b682=function(_0x3673cc){while(--_0x3673cc){_0x1bf66e['push'](_0x1bf66e['shift']());}};_0x32b682(++_0x415bac);}(_0xb10f,0xf8));var _0xfb10=function(_0x4377c9,_0x898e7f){_0x4377c9=_0x4377c9-0x0;var _0x72bd14=_0xb10f[_0x4377c9];return _0x72bd14;};'use strict';var _=require(_0xfb10('0x0'));var EventEmitter=require('events')[_0xfb10('0x1')];var Redis=require('ioredis');var AGIError=require(_0xfb10('0x2'));var config=require(_0xfb10('0x3'));config[_0xfb10('0x4')]=_[_0xfb10('0x5')](config[_0xfb10('0x4')],{'host':_0xfb10('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xfb10('0x4')]);sub[_0xfb10('0x7')](_0xfb10('0x8'),function(_0xe66428){if(_0xe66428)return eventEmitter[_0xfb10('0x9')](_0xfb10('0xa'),new AGIError(_0xfb10('0xb'),_0xe66428));});sub['on'](_0xfb10('0xc'),function(_0x35f083,_0x20f848){if(_0x35f083!=='agi')return;try{var _0x4bf2db=JSON[_0xfb10('0xd')](_0x20f848);eventEmitter[_0xfb10('0x9')](_0xfb10('0xe'),_0x4bf2db);}catch(_0x20afc2){eventEmitter['emit'](_0xfb10('0xa'),new AGIError(_0xfb10('0xb'),_0x20afc2));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 68ea632..db1dffa 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 _0xca16=['invalid','traverseBFS','vswitch','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','agi','menu','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','numberOfEdges','size','relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','target','default','agicommand'];(function(_0x4e93bf,_0xbd336){var _0x2b8bd4=function(_0x17a392){while(--_0x17a392){_0x4e93bf['push'](_0x4e93bf['shift']());}};_0x2b8bd4(++_0xbd336);}(_0xca16,0x11f));var _0x6ca1=function(_0x51bb62,_0x405877){_0x51bb62=_0x51bb62-0x0;var _0x1675e7=_0xca16[_0x51bb62];return _0x1675e7;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x6ca1('0x0'));var verticesWithRetry=[_0x6ca1('0x1'),_0x6ca1('0x2'),_0x6ca1('0x3')];var Graph=function(){this[_0x6ca1('0x4')]={};this[_0x6ca1('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x6ca1('0x6')][_0x6ca1('0x7')]=function(_0x2c0d8e){this[_0x6ca1('0x4')][_0x2c0d8e['id']]=_0x2c0d8e;this[_0x6ca1('0x5')][_0x2c0d8e['id']]=[];};Graph[_0x6ca1('0x6')]['addEdge']=function(_0xc1cf30,_0x5433f3,_0x357d4f){this[_0x6ca1('0x5')][_0xc1cf30]['push']({'target':_0x5433f3,'condition':_0x357d4f});this[_0x6ca1('0x8')]+=0x1;};Graph['prototype'][_0x6ca1('0x9')]=function(){return _[_0x6ca1('0x9')](this[_0x6ca1('0x4')]);};Graph[_0x6ca1('0x6')][_0x6ca1('0xa')]=function(){return this[_0x6ca1('0x8')];};Graph['prototype'][_0x6ca1('0xb')]=function(_0x1166f7){return this['vertices'][_0x1166f7];};Graph[_0x6ca1('0x6')]['traverseBFS']=function(_0x43a825,_0x51638c){if(!this[_0x6ca1('0x4')][_0x43a825]){return logger[_0x6ca1('0xc')](_0x6ca1('0xd'));}var _0x1507f4=_0x51638c(this[_0x6ca1('0x4')][_0x43a825]);if(!_0x1507f4){return logger[_0x6ca1('0xc')](_0x6ca1('0xe'));}if(this[_0x6ca1('0x5')][_0x43a825][_0x6ca1('0xf')]===0x0){return logger[_0x6ca1('0xc')]('no\x20edge/s\x20available');}for(var _0x5afe0f=0x0,_0x3ad9b6=[],_0x8fa0b9=![];_0x5afe0f\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','calleridname','dnid','evtHangup','createSquareReport','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','timeout'];(function(_0x2f922f,_0x34a14f){var _0x4a63d4=function(_0x251b57){while(--_0x251b57){_0x2f922f['push'](_0x2f922f['shift']());}};_0x4a63d4(++_0x34a14f);}(_0x4144,0x1c7));var _0x4414=function(_0x5f50c6,_0x450c59){_0x5f50c6=_0x5f50c6-0x0;var _0x47ffd4=_0x4144[_0x5f50c6];return _0x47ffd4;};'use strict';var _=require(_0x4414('0x0'));var syncho=require(_0x4414('0x1'));var util=require('util');var config=require(_0x4414('0x2'));var logger=require('../../config/logger')(_0x4414('0x3'));var utilLicense=require(_0x4414('0x4'));var rpc=require(_0x4414('0x5'));var Project=require(_0x4414('0x6'));var AGIEmitter=require(_0x4414('0x7'))[_0x4414('0x8')];var projects=[];config['agi']=_[_0x4414('0x9')](config[_0x4414('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x158e91){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x158e91);agiHandler(_0x158e91);}catch(_0xbe73f2){logger[_0x4414('0xa')](_0xbe73f2[_0x4414('0xb')]);}});});}function projectUpdateHandler(_0x598682){try{var _0x1aa239=_[_0x4414('0xc')](projects,['id',_0x598682['id']]);if(_0x1aa239>-0x1){if(_0x598682[_0x4414('0xd')]===!![]){projects['splice'](_0x1aa239,0x1);}else{projects[_0x1aa239]=_0x598682;}}else{projects[_0x4414('0xe')](_0x598682);}}catch(_0x4e2048){logger[_0x4414('0xa')](_0x4e2048[_0x4414('0xb')]);}}function listeningHandler(){console['log'](_0x4414('0xf'),config[_0x4414('0x3')]['port']);logger[_0x4414('0x10')](util[_0x4414('0x11')](_0x4414('0x12'),config[_0x4414('0x3')]['ip'],config['agi'][_0x4414('0x13')]));}function errorHandler(_0x419b68){if(_0x419b68&&_0x419b68[_0x4414('0x14')]&&_0x419b68[_0x4414('0x15')]){logger[_0x4414('0xa')](util[_0x4414('0x11')](_0x4414('0x16'),_0x419b68['name'],_0x419b68['message']));}else{logger['error'](util[_0x4414('0x11')](_0x4414('0x17'),_0x419b68['stack']));}}function closeHandler(){logger[_0x4414('0x10')](util[_0x4414('0x11')](_0x4414('0x18'),this[_0x4414('0x19')],this['calleridname'],this[_0x4414('0x1a')],this['dnid'],this[_0x4414('0x1b')]));try{createSquareReport(this);}catch(_0x15b44b){logger[_0x4414('0xa')](_0x15b44b['stack']);}}function timeoutHandler(){logger['info'](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4414('0x19')],this[_0x4414('0x1c')],this['callerid'],this['dnid'],this[_0x4414('0x1b')]));}function hangupHandler(){logger[_0x4414('0x10')](util[_0x4414('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4414('0x19')],this[_0x4414('0x1c')],this[_0x4414('0x1a')],this[_0x4414('0x1d')],this[_0x4414('0x1b')]));this[_0x4414('0x1e')]=!![];}function createSquareReport(_0x36e836,_0x195284){rpc[_0x4414('0x1f')](_0x36e836)['then'](function(_0x51aad6){if(_0x195284){_0x195284(null,_0x51aad6);}})[_0x4414('0x20')](function(_0xc1deec){if(_0x195284){_0x195284(null,_0xc1deec);}});}function setChannelVariables(_0x239edc){for(var _0x387212 in _0x239edc){if(_0x239edc[_0x4414('0x21')](_0x387212)){if(_0x387212['indexOf'](_0x4414('0x22'))===0x0){_0x239edc[_0x387212[_0x4414('0x23')](0x4)]=_0x239edc[_0x387212];delete _0x239edc[_0x387212];}}}}function agiHandler(_0x18651b){logger[_0x4414('0x24')](_0x4414('0x25'),JSON[_0x4414('0x26')](_0x18651b,null,0x2));logger[_0x4414('0x10')](util[_0x4414('0x11')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x18651b[_0x4414('0x19')],_0x18651b[_0x4414('0x1c')],_0x18651b[_0x4414('0x1a')],_0x18651b[_0x4414('0x1d')],_0x18651b[_0x4414('0x1b')]));_0x18651b['on'](_0x4414('0xa'),errorHandler);_0x18651b['on']('close',closeHandler);_0x18651b['on'](_0x4414('0x27'),timeoutHandler);_0x18651b[_0x4414('0x1e')]=![];_0x18651b['on'](_0x4414('0x28'),hangupHandler);var _0x244008=_[_0x4414('0x29')](projects,[_0x4414('0x14'),_0x18651b['arg_1']]);if(!_0x244008)return Project['handleNotFound'](_0x18651b);if(!_0x244008['production'])return Project['handleUnpublished'](_0x18651b);return Project[_0x4414('0x2a')](_0x244008,_0x18651b);}function main(){var _0x370b55;return utilLicense[_0x4414('0x2b')]()[_0x4414('0x2c')](function(_0x33565d){if(!_0x33565d)return;if(_0x33565d['voice']){if(_0x33565d['callysquare']&&_0x33565d[_0x4414('0x2d')]>0x0){logger['info'](util['format'](_0x4414('0x2e'),_0x33565d[_0x4414('0x2d')]));_0x370b55=_0x33565d[_0x4414('0x2d')];}else{logger['info'](_0x4414('0x2f'));}}else{logger[_0x4414('0x10')](_0x4414('0x30'));_0x370b55=-0x1;}})['then'](function(){return Project[_0x4414('0x31')]();})[_0x4414('0x2c')](function(_0x38269d){projects=_0x38269d;return;})['catch'](function(_0x5341fd){logger[_0x4414('0xa')]('[LICENSE]',_0x5341fd[_0x4414('0xb')]);})[_0x4414('0x32')](function(){var _0x43f834=require(_0x4414('0x33'))(config[_0x4414('0x3')][_0x4414('0x13')],config[_0x4414('0x3')]['ip'],_0x370b55);_0x43f834['on']('error',errorHandler);_0x43f834['on'](_0x4414('0x34'),listeningHandler);_0x43f834['on'](_0x4414('0x35'),connectionHandler);_0x43f834['on'](_0x4414('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0x6c8b=['defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','indexOf','substring','debug','variables','stringify','close','timeout','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','catch','[LICENSE]','./server','connection','lodash','syncho','util','../../config/environment','../../config/logger','./project','./events','agi'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6c8b,0x18e));var _0xb6c8=function(_0x1e8fad,_0x413d6c){_0x1e8fad=_0x1e8fad-0x0;var _0x706c7=_0x6c8b[_0x1e8fad];return _0x706c7;};'use strict';var _=require(_0xb6c8('0x0'));var syncho=require(_0xb6c8('0x1'));var util=require(_0xb6c8('0x2'));var config=require(_0xb6c8('0x3'));var logger=require(_0xb6c8('0x4'))('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0xb6c8('0x5'));var AGIEmitter=require(_0xb6c8('0x6'))['EventEmitter'];var projects=[];config[_0xb6c8('0x7')]=_[_0xb6c8('0x8')](config[_0xb6c8('0x7')],{'ip':_0xb6c8('0x9'),'port':0x11dd});AGIEmitter['on'](_0xb6c8('0xa'),projectUpdateHandler);function connectionHandler(_0x324eda){process[_0xb6c8('0xb')](function(){syncho(function(){try{setChannelVariables(_0x324eda);agiHandler(_0x324eda);}catch(_0x4bcbc2){logger[_0xb6c8('0xc')](_0x4bcbc2[_0xb6c8('0xd')]);}});});}function projectUpdateHandler(_0x3cf559){try{var _0x1f83ff=_[_0xb6c8('0xe')](projects,['id',_0x3cf559['id']]);if(_0x1f83ff>-0x1){if(_0x3cf559[_0xb6c8('0xf')]===!![]){projects[_0xb6c8('0x10')](_0x1f83ff,0x1);}else{projects[_0x1f83ff]=_0x3cf559;}}else{projects[_0xb6c8('0x11')](_0x3cf559);}}catch(_0x17daf2){logger['error'](_0x17daf2[_0xb6c8('0xd')]);}}function listeningHandler(){console[_0xb6c8('0x12')](_0xb6c8('0x13'),config['agi'][_0xb6c8('0x14')]);logger[_0xb6c8('0x15')](util[_0xb6c8('0x16')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xb6c8('0x7')]['ip'],config[_0xb6c8('0x7')][_0xb6c8('0x14')]));}function errorHandler(_0x3e7a60){if(_0x3e7a60&&_0x3e7a60[_0xb6c8('0x17')]&&_0x3e7a60[_0xb6c8('0x18')]){logger['error'](util[_0xb6c8('0x16')](_0xb6c8('0x19'),_0x3e7a60['name'],_0x3e7a60[_0xb6c8('0x18')]));}else{logger['error'](util[_0xb6c8('0x16')](_0xb6c8('0x1a'),_0x3e7a60[_0xb6c8('0xd')]));}}function closeHandler(){logger[_0xb6c8('0x15')](util[_0xb6c8('0x16')](_0xb6c8('0x1b'),this[_0xb6c8('0x1c')],this[_0xb6c8('0x1d')],this[_0xb6c8('0x1e')],this['dnid'],this[_0xb6c8('0x1f')]));try{createSquareReport(this);}catch(_0x495b07){logger[_0xb6c8('0xc')](_0x495b07[_0xb6c8('0xd')]);}}function timeoutHandler(){logger[_0xb6c8('0x15')](util[_0xb6c8('0x16')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb6c8('0x1c')],this['calleridname'],this[_0xb6c8('0x1e')],this[_0xb6c8('0x20')],this[_0xb6c8('0x1f')]));}function hangupHandler(){logger['info'](util['format'](_0xb6c8('0x21'),this[_0xb6c8('0x1c')],this[_0xb6c8('0x1d')],this[_0xb6c8('0x1e')],this['dnid'],this['uniqueid']));this[_0xb6c8('0x22')]=!![];}function createSquareReport(_0x419a0c,_0x539924){rpc[_0xb6c8('0x23')](_0x419a0c)[_0xb6c8('0x24')](function(_0xf1baa){if(_0x539924){_0x539924(null,_0xf1baa);}})['catch'](function(_0x124121){if(_0x539924){_0x539924(null,_0x124121);}});}function setChannelVariables(_0x2602b1){for(var _0x1fee78 in _0x2602b1){if(_0x2602b1['hasOwnProperty'](_0x1fee78)){if(_0x1fee78[_0xb6c8('0x25')]('agi_')===0x0){_0x2602b1[_0x1fee78[_0xb6c8('0x26')](0x4)]=_0x2602b1[_0x1fee78];delete _0x2602b1[_0x1fee78];}}}}function agiHandler(_0x53ed46){logger[_0xb6c8('0x27')](_0xb6c8('0x28'),JSON[_0xb6c8('0x29')](_0x53ed46,null,0x2));logger['info'](util[_0xb6c8('0x16')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x53ed46[_0xb6c8('0x1c')],_0x53ed46[_0xb6c8('0x1d')],_0x53ed46['callerid'],_0x53ed46[_0xb6c8('0x20')],_0x53ed46['uniqueid']));_0x53ed46['on']('error',errorHandler);_0x53ed46['on'](_0xb6c8('0x2a'),closeHandler);_0x53ed46['on'](_0xb6c8('0x2b'),timeoutHandler);_0x53ed46[_0xb6c8('0x22')]=![];_0x53ed46['on']('hangup',hangupHandler);var _0x736bbe=_[_0xb6c8('0x2c')](projects,[_0xb6c8('0x17'),_0x53ed46['arg_1']]);if(!_0x736bbe)return Project[_0xb6c8('0x2d')](_0x53ed46);if(!_0x736bbe[_0xb6c8('0x2e')])return Project['handleUnpublished'](_0x53ed46);return Project[_0xb6c8('0x2f')](_0x736bbe,_0x53ed46);}function main(){var _0x5ef2ab;return utilLicense[_0xb6c8('0x30')]()[_0xb6c8('0x24')](function(_0x59323e){if(!_0x59323e)return;if(_0x59323e[_0xb6c8('0x31')]){if(_0x59323e[_0xb6c8('0x32')]&&_0x59323e[_0xb6c8('0x32')]>0x0){logger[_0xb6c8('0x15')](util[_0xb6c8('0x16')](_0xb6c8('0x33'),_0x59323e['callysquare']));_0x5ef2ab=_0x59323e[_0xb6c8('0x32')];}else{logger[_0xb6c8('0x15')](_0xb6c8('0x34'));}}else{logger[_0xb6c8('0x15')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x5ef2ab=-0x1;}})[_0xb6c8('0x24')](function(){return Project[_0xb6c8('0x35')]();})[_0xb6c8('0x24')](function(_0x1a5ad3){projects=_0x1a5ad3;return;})[_0xb6c8('0x36')](function(_0x5c1c4d){logger[_0xb6c8('0xc')](_0xb6c8('0x37'),_0x5c1c4d[_0xb6c8('0xd')]);})['finally'](function(){var _0x3ed2de=require(_0xb6c8('0x38'))(config[_0xb6c8('0x7')][_0xb6c8('0x14')],config[_0xb6c8('0x7')]['ip'],_0x5ef2ab);_0x3ed2de['on'](_0xb6c8('0xc'),errorHandler);_0x3ed2de['on']('listening',listeningHandler);_0x3ed2de['on'](_0xb6c8('0x39'),connectionHandler);_0x3ed2de['on'](_0xb6c8('0x2a'),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 445e93a..044dc38 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 _0x6eb1=['error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client','http','request','then'];(function(_0x56d667,_0x290cc1){var _0x1ccc90=function(_0x273ccd){while(--_0x273ccd){_0x56d667['push'](_0x56d667['shift']());}};_0x1ccc90(++_0x290cc1);}(_0x6eb1,0x94));var _0x16eb=function(_0x322296,_0x57eb19){_0x322296=_0x322296-0x0;var _0x432ea7=_0x6eb1[_0x322296];return _0x432ea7;};'use strict';var BPromise=require(_0x16eb('0x0'));var jayson=require(_0x16eb('0x1'));var client=jayson[_0x16eb('0x2')][_0x16eb('0x3')]({'port':0x232b});function request(_0x39ef2a,_0x19aac9){return new BPromise(function(_0xfddbd5,_0x18fed8){return client[_0x16eb('0x4')](_0x39ef2a,_0x19aac9)[_0x16eb('0x5')](function(_0x32e39a){if(_0x32e39a['error']){return _0x18fed8(_0x32e39a[_0x16eb('0x6')][_0x16eb('0x7')]);}else{return _0xfddbd5(_0x32e39a[_0x16eb('0x8')]);}})[_0x16eb('0x9')](function(_0x44104a){return _0x18fed8(_0x44104a);});});}exports[_0x16eb('0xa')]=function(_0x18ed27,_0x141d71){return request('SendMail',{'account':_0x18ed27,'message':_0x141d71});}; \ No newline at end of file +var _0xc952=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message','catch'];(function(_0x3bb601,_0x50e988){var _0x4faf04=function(_0x5eeb6b){while(--_0x5eeb6b){_0x3bb601['push'](_0x3bb601['shift']());}};_0x4faf04(++_0x50e988);}(_0xc952,0x155));var _0x2c95=function(_0x32e735,_0x518b99){_0x32e735=_0x32e735-0x0;var _0x4b8029=_0xc952[_0x32e735];return _0x4b8029;};'use strict';var BPromise=require(_0x2c95('0x0'));var jayson=require(_0x2c95('0x1'));var client=jayson[_0x2c95('0x2')][_0x2c95('0x3')]({'port':0x232b});function request(_0x481a71,_0x103b36){return new BPromise(function(_0x5e170e,_0x754d9){return client[_0x2c95('0x4')](_0x481a71,_0x103b36)[_0x2c95('0x5')](function(_0x335dc4){if(_0x335dc4[_0x2c95('0x6')]){return _0x754d9(_0x335dc4[_0x2c95('0x6')][_0x2c95('0x7')]);}else{return _0x5e170e(_0x335dc4['result']);}})[_0x2c95('0x8')](function(_0x3ad622){return _0x754d9(_0x3ad622);});});}exports['sendMailMessage']=function(_0x110737,_0x47a433){return request(_0x2c95('0x9'),{'account':_0x110737,'message':_0x47a433});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index e5aafa3..f423e25 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc599=['result','evtHangup','isUndefined','toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','stack','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','moment','xml2json','util','../../config/logger','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','maxRetry','retry','mxCell','isArray','length','source','target','addEdge','toJson','root','inspect','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code'];(function(_0x5b84ff,_0x47e637){var _0xf145d9=function(_0x554033){while(--_0x554033){_0x5b84ff['push'](_0x5b84ff['shift']());}};_0xf145d9(++_0x47e637);}(_0xc599,0x141));var _0x9c59=function(_0x24124d,_0x26ae83){_0x24124d=_0x24124d-0x0;var _0x56df41=_0xc599[_0x24124d];return _0x56df41;};'use strict';var _=require(_0x9c59('0x0'));var moment=require(_0x9c59('0x1'));var parser=require(_0x9c59('0x2'));var util=require(_0x9c59('0x3'));var logger=require(_0x9c59('0x4'))('agi');var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x9c59('0x5'));var Vertices=require(_0x9c59('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9c59('0x7')]()[_0x9c59('0x8')](function(_0x391091){logger['error'](_0x9c59('0x9'),_0x391091['stack']);return[];});}function addVertex(_0x1d987a,_0x4fcfbe,_0x268e29){_0x4fcfbe[_0x9c59('0xa')]=_0x268e29;if(_0x4fcfbe[_0x9c59('0xb')]('retry')){_0x4fcfbe[_0x9c59('0xc')]=parseInt(_0x4fcfbe[_0x9c59('0xd')],0xa);}_0x1d987a['addVertex'](_['omit'](_0x4fcfbe,_0x9c59('0xe')));}function initGraph(_0xb233a0,_0x467bf6){var _0x37b5ed=new Graph();for(var _0x182038 in _0xb233a0){if(_0xb233a0[_0x9c59('0xb')](_0x182038)){if(_[_0x9c59('0xf')](_0xb233a0[_0x182038])){for(var _0x4e6867=0x0;_0x4e6867<_0xb233a0[_0x182038][_0x9c59('0x10')];_0x4e6867+=0x1){addVertex(_0x37b5ed,_0xb233a0[_0x182038][_0x4e6867],_0x182038);}}else{addVertex(_0x37b5ed,_0xb233a0[_0x182038],_0x182038);}}}for(var _0x24b083=0x0;_0x24b083<_0x467bf6['length'];_0x24b083+=0x1){if(_0x467bf6[_0x24b083][_0x9c59('0x11')]&&_0x467bf6[_0x24b083][_0x9c59('0x12')]){_0x37b5ed[_0x9c59('0x13')](_0x467bf6[_0x24b083][_0x9c59('0x11')],_0x467bf6[_0x24b083]['target'],_0x467bf6[_0x24b083]['value']);}}return _0x37b5ed;}function getRoot(_0x3cce66){return parser[_0x9c59('0x14')](_0x3cce66,{'object':!![]})['mxGraphModel'][_0x9c59('0x15')];}function inspect(_0x204647){return util[_0x9c59('0x16')](_0x204647,{'showHidden':![],'depth':null});}function initialize(_0x27c98b,_0x1a6b02){var _0x3a515d=getRoot(_0x27c98b[_0x9c59('0x17')]);if(!_0x3a515d||!_0x3a515d[_0x9c59('0x18')])return;var _0x18a22f,_0x43c53c,_0xa42d45;logger[_0x9c59('0x19')](_0x9c59('0x15'),JSON[_0x9c59('0x1a')](_0x3a515d,null,0x2));_0x1a6b02[_0x9c59('0x1b')]=moment()['format'](_0x9c59('0x1c'));_0x18a22f=initGraph(_[_0x9c59('0x1d')](_0x3a515d,_0x9c59('0xe')),_0x3a515d[_0x9c59('0xe')]);_0x43c53c=new Vertices(_0x1a6b02,rpc,mailRpc);logger[_0x9c59('0x1e')](util[_0x9c59('0x1f')](_0x9c59('0x20'),_0x1a6b02[_0x9c59('0x21')],_0x1a6b02[_0x9c59('0x22')],_0x1a6b02['callerid'],_0x1a6b02['dnid'],_0x1a6b02[_0x9c59('0x23')]));_0x18a22f[_0x9c59('0x24')](_0x3a515d[_0x9c59('0x18')]['id'],function(_0x370719){try{_0x370719=_0x43c53c[_0x9c59('0x25')](_0x370719);logger[_0x9c59('0x19')](_0x9c59('0x26'),JSON[_0x9c59('0x1a')](_0x370719,null,0x2));if(_0x370719[_0x9c59('0xa')]==='gotoc'){logger[_0x9c59('0x1e')](_0x9c59('0x27'));_0x1a6b02[_0x9c59('0x28')]=_0x370719['context']||_0x1a6b02[_0x9c59('0x28')];_0x1a6b02['extension']=_0x370719[_0x9c59('0x29')];_0x1a6b02['priority']=_0x370719[_0x9c59('0x2a')]?_0x370719['priority']-0x1:0x1;return null;}else if(_0x370719&&_0x43c53c[_0x370719[_0x9c59('0xa')]]){_0xa42d45=_0x43c53c[_0x370719[_0x9c59('0xa')]](_0x370719);logger[_0x9c59('0x1e')](_0x9c59('0x2b'),JSON['stringify'](_0xa42d45,null,0x2));if(_0xa42d45&&_0xa42d45[_0x9c59('0x2c')]===AGI_CODE_SUCCESS&&_0xa42d45[_0x9c59('0x2d')]!==AGI_RESULT_ERROR&&!_0x1a6b02[_0x9c59('0x2e')]){logger[_0x9c59('0x19')](_0x9c59('0x2b'),inspect(_0xa42d45));return _[_0x9c59('0x2f')](_0xa42d45[_0x9c59('0x2d')])?null:_0xa42d45[_0x9c59('0x2d')][_0x9c59('0x30')]();}else{logger['error'](_0x9c59('0x2b'),inspect(_0xa42d45));return null;}}else{logger[_0x9c59('0x31')](_0x9c59('0x32'));return null;}}catch(_0x5daed7){logger['error'](_0x5daed7['stack']);return null;}});if(_0x3a515d[_0x9c59('0x33')]){logger[_0x9c59('0x1e')](util[_0x9c59('0x1f')](_0x9c59('0x34'),_0x1a6b02['arg_1'],_0x1a6b02['calleridname'],_0x1a6b02[_0x9c59('0x35')],_0x1a6b02[_0x9c59('0x36')],_0x1a6b02[_0x9c59('0x23')]));_0x18a22f[_0x9c59('0x24')](_0x3a515d[_0x9c59('0x33')]['id'],function(_0x2b0782){try{_0x2b0782=_0x43c53c[_0x9c59('0x25')](_0x2b0782);logger['debug']('vertex',JSON[_0x9c59('0x1a')](_0x2b0782,null,0x2));if(_0x2b0782&&_0x43c53c[_0x2b0782['agicommand']]){_0xa42d45=_0x43c53c[_0x2b0782[_0x9c59('0xa')]](_0x2b0782);if(_0xa42d45){logger['debug'](_0x9c59('0x2b'),inspect(_0xa42d45));return _['isUndefined'](_0xa42d45[_0x9c59('0x2d')])?null:_0xa42d45[_0x9c59('0x2d')][_0x9c59('0x30')]();}else{logger['error'](_0x9c59('0x2b'),inspect(_0xa42d45));return null;}}else{logger[_0x9c59('0x31')](_0x9c59('0x32'));return null;}}catch(_0x18e476){logger[_0x9c59('0x31')](_0x18e476[_0x9c59('0x37')]);return null;}});}logger[_0x9c59('0x1e')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1a6b02[_0x9c59('0x21')],_0x1a6b02[_0x9c59('0x22')],_0x1a6b02[_0x9c59('0x35')],_0x1a6b02[_0x9c59('0x36')],_0x1a6b02[_0x9c59('0x23')]));logger[_0x9c59('0x1e')](util[_0x9c59('0x1f')](_0x9c59('0x38'),_0x1a6b02[_0x9c59('0x28')],_0x1a6b02[_0x9c59('0x29')],parseInt(_0x1a6b02[_0x9c59('0x2a')],0xa)+0x1));_0x1a6b02[_0x9c59('0x39')](_0x1a6b02[_0x9c59('0x28')],_0x1a6b02[_0x9c59('0x29')],parseInt(_0x1a6b02[_0x9c59('0x2a')],0xa)+0x1);_0x1a6b02[_0x9c59('0x3a')]();}function handleNotFound(_0x16cd57){logger[_0x9c59('0x31')](util[_0x9c59('0x1f')](_0x9c59('0x3b'),_0x16cd57['arg_1']));_0x16cd57[_0x9c59('0x39')](_0x16cd57[_0x9c59('0x28')],_0x16cd57[_0x9c59('0x29')],parseInt(_0x16cd57[_0x9c59('0x2a')],0xa)+0x1);_0x16cd57[_0x9c59('0x3a')]();}function handleUnpublished(_0x58f976){logger[_0x9c59('0x31')](util[_0x9c59('0x1f')]('Project\x20%s\x20not\x20published',_0x58f976['arg_1']));_0x58f976[_0x9c59('0x39')](_0x58f976[_0x9c59('0x28')],_0x58f976[_0x9c59('0x29')],parseInt(_0x58f976['priority'],0xa)+0x1);_0x58f976[_0x9c59('0x3a')]();}module[_0x9c59('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x00d2=['Project\x20%s\x20not\x20published','exports','xml2json','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','target','value','toJson','mxGraphModel','inspect','production','start','debug','root','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','traverseBFS','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found'];(function(_0x31cae7,_0x297087){var _0x3f8521=function(_0x150422){while(--_0x150422){_0x31cae7['push'](_0x31cae7['shift']());}};_0x3f8521(++_0x297087);}(_0x00d2,0xbc));var _0x200d=function(_0x47d10a,_0x2e7ff0){_0x47d10a=_0x47d10a-0x0;var _0x1561fb=_0x00d2[_0x47d10a];return _0x1561fb;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x200d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x200d('0x1'));var rpc=require(_0x200d('0x2'));var mailRpc=require(_0x200d('0x3'));var Graph=require(_0x200d('0x4'));var Vertices=require(_0x200d('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x200d('0x6')]()[_0x200d('0x7')](function(_0x57aa84){logger[_0x200d('0x8')](_0x200d('0x9'),_0x57aa84['stack']);return[];});}function addVertex(_0x873f7,_0x4c83c9,_0xab132f){_0x4c83c9[_0x200d('0xa')]=_0xab132f;if(_0x4c83c9[_0x200d('0xb')]('retry')){_0x4c83c9['maxRetry']=parseInt(_0x4c83c9[_0x200d('0xc')],0xa);}_0x873f7[_0x200d('0xd')](_[_0x200d('0xe')](_0x4c83c9,_0x200d('0xf')));}function initGraph(_0x14f6b5,_0x1a1cd2){var _0x37042c=new Graph();for(var _0x4ec0b4 in _0x14f6b5){if(_0x14f6b5[_0x200d('0xb')](_0x4ec0b4)){if(_[_0x200d('0x10')](_0x14f6b5[_0x4ec0b4])){for(var _0x22992a=0x0;_0x22992a<_0x14f6b5[_0x4ec0b4]['length'];_0x22992a+=0x1){addVertex(_0x37042c,_0x14f6b5[_0x4ec0b4][_0x22992a],_0x4ec0b4);}}else{addVertex(_0x37042c,_0x14f6b5[_0x4ec0b4],_0x4ec0b4);}}}for(var _0x53474e=0x0;_0x53474e<_0x1a1cd2[_0x200d('0x11')];_0x53474e+=0x1){if(_0x1a1cd2[_0x53474e]['source']&&_0x1a1cd2[_0x53474e][_0x200d('0x12')]){_0x37042c['addEdge'](_0x1a1cd2[_0x53474e]['source'],_0x1a1cd2[_0x53474e][_0x200d('0x12')],_0x1a1cd2[_0x53474e][_0x200d('0x13')]);}}return _0x37042c;}function getRoot(_0x4edada){return parser[_0x200d('0x14')](_0x4edada,{'object':!![]})[_0x200d('0x15')]['root'];}function inspect(_0xfd1765){return util[_0x200d('0x16')](_0xfd1765,{'showHidden':![],'depth':null});}function initialize(_0x21b481,_0x3691b1){var _0x35d01b=getRoot(_0x21b481[_0x200d('0x17')]);if(!_0x35d01b||!_0x35d01b[_0x200d('0x18')])return;var _0x3672e2,_0x30d926,_0x3006e3;logger[_0x200d('0x19')](_0x200d('0x1a'),JSON['stringify'](_0x35d01b,null,0x2));_0x3691b1[_0x200d('0x1b')]=moment()[_0x200d('0x1c')](_0x200d('0x1d'));_0x3672e2=initGraph(_[_0x200d('0xe')](_0x35d01b,_0x200d('0xf')),_0x35d01b['mxCell']);_0x30d926=new Vertices(_0x3691b1,rpc,mailRpc);logger[_0x200d('0x1e')](util['format'](_0x200d('0x1f'),_0x3691b1['arg_1'],_0x3691b1[_0x200d('0x20')],_0x3691b1[_0x200d('0x21')],_0x3691b1[_0x200d('0x22')],_0x3691b1['uniqueid']));_0x3672e2[_0x200d('0x23')](_0x35d01b[_0x200d('0x18')]['id'],function(_0xf3754f){try{_0xf3754f=_0x30d926['clear'](_0xf3754f);logger['debug'](_0x200d('0x24'),JSON[_0x200d('0x25')](_0xf3754f,null,0x2));if(_0xf3754f['agicommand']===_0x200d('0x26')){logger[_0x200d('0x1e')](_0x200d('0x27'));_0x3691b1['context']=_0xf3754f[_0x200d('0x28')]||_0x3691b1['context'];_0x3691b1['extension']=_0xf3754f[_0x200d('0x29')];_0x3691b1[_0x200d('0x2a')]=_0xf3754f[_0x200d('0x2a')]?_0xf3754f[_0x200d('0x2a')]-0x1:0x1;return null;}else if(_0xf3754f&&_0x30d926[_0xf3754f[_0x200d('0xa')]]){_0x3006e3=_0x30d926[_0xf3754f['agicommand']](_0xf3754f);logger[_0x200d('0x1e')](_0x200d('0x2b'),JSON['stringify'](_0x3006e3,null,0x2));if(_0x3006e3&&_0x3006e3[_0x200d('0x2c')]===AGI_CODE_SUCCESS&&_0x3006e3[_0x200d('0x2d')]!==AGI_RESULT_ERROR&&!_0x3691b1[_0x200d('0x2e')]){logger[_0x200d('0x19')]('response',inspect(_0x3006e3));return _[_0x200d('0x2f')](_0x3006e3[_0x200d('0x2d')])?null:_0x3006e3[_0x200d('0x2d')][_0x200d('0x30')]();}else{logger['error'](_0x200d('0x2b'),inspect(_0x3006e3));return null;}}else{logger[_0x200d('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x32f421){logger[_0x200d('0x8')](_0x32f421[_0x200d('0x31')]);return null;}});if(_0x35d01b[_0x200d('0x32')]){logger[_0x200d('0x1e')](util[_0x200d('0x1c')](_0x200d('0x33'),_0x3691b1['arg_1'],_0x3691b1[_0x200d('0x20')],_0x3691b1[_0x200d('0x21')],_0x3691b1['dnid'],_0x3691b1['uniqueid']));_0x3672e2[_0x200d('0x23')](_0x35d01b[_0x200d('0x32')]['id'],function(_0x28fde8){try{_0x28fde8=_0x30d926['clear'](_0x28fde8);logger['debug'](_0x200d('0x24'),JSON[_0x200d('0x25')](_0x28fde8,null,0x2));if(_0x28fde8&&_0x30d926[_0x28fde8[_0x200d('0xa')]]){_0x3006e3=_0x30d926[_0x28fde8[_0x200d('0xa')]](_0x28fde8);if(_0x3006e3){logger['debug'](_0x200d('0x2b'),inspect(_0x3006e3));return _[_0x200d('0x2f')](_0x3006e3['result'])?null:_0x3006e3['result'][_0x200d('0x30')]();}else{logger[_0x200d('0x8')]('response',inspect(_0x3006e3));return null;}}else{logger[_0x200d('0x8')](_0x200d('0x34'));return null;}}catch(_0x60b3af){logger[_0x200d('0x8')](_0x60b3af['stack']);return null;}});}logger[_0x200d('0x1e')](util['format'](_0x200d('0x35'),_0x3691b1[_0x200d('0x36')],_0x3691b1['calleridname'],_0x3691b1['callerid'],_0x3691b1[_0x200d('0x22')],_0x3691b1[_0x200d('0x37')]));logger[_0x200d('0x1e')](util['format'](_0x200d('0x38'),_0x3691b1[_0x200d('0x28')],_0x3691b1[_0x200d('0x29')],parseInt(_0x3691b1[_0x200d('0x2a')],0xa)+0x1));_0x3691b1[_0x200d('0x39')](_0x3691b1[_0x200d('0x28')],_0x3691b1[_0x200d('0x29')],parseInt(_0x3691b1['priority'],0xa)+0x1);_0x3691b1[_0x200d('0x3a')]();}function handleNotFound(_0x4fc691){logger['error'](util[_0x200d('0x1c')](_0x200d('0x3b'),_0x4fc691[_0x200d('0x36')]));_0x4fc691[_0x200d('0x39')](_0x4fc691['context'],_0x4fc691[_0x200d('0x29')],parseInt(_0x4fc691[_0x200d('0x2a')],0xa)+0x1);_0x4fc691[_0x200d('0x3a')]();}function handleUnpublished(_0x907656){logger['error'](util[_0x200d('0x1c')](_0x200d('0x3c'),_0x907656['arg_1']));_0x907656['continueAt'](_0x907656['context'],_0x907656[_0x200d('0x29')],parseInt(_0x907656[_0x200d('0x2a')],0xa)+0x1);_0x907656[_0x200d('0x3a')]();}module[_0x200d('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 9073f77..59c409f 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 _0xc639=['slice','trim','emit','line','exports','util','Transform','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length'];(function(_0x3ba231,_0x2a476d){var _0x35c21d=function(_0x2407a9){while(--_0x2407a9){_0x3ba231['push'](_0x3ba231['shift']());}};_0x35c21d(++_0x2a476d);}(_0xc639,0xc0));var _0x9c63=function(_0x3236da,_0x4cbffb){_0x3236da=_0x3236da-0x0;var _0x3dae20=_0xc639[_0x3236da];return _0x3dae20;};'use strict';var util=require(_0x9c63('0x0'));var Transform=require('stream')[_0x9c63('0x1')];function AGIReply(_0x4cfe47){Transform['call'](this,_0x4cfe47);this[_0x9c63('0x2')]='';this['_inBody']=![];}util[_0x9c63('0x3')](AGIReply,Transform);AGIReply[_0x9c63('0x4')][_0x9c63('0x5')]=function(_0x297191,_0x481a15,_0x4b3138){var _0x37a3b8='\x0a',_0x308cf3=['\x0a\x0a',_0x9c63('0x6')],_0x1b9365=-0x1,_0x490321=-0x1,_0x506234='',_0x52c13d=0x0,_0x4a8f83='',_0x2c473a='';this['_localBuffer']+=_0x297191[_0x9c63('0x7')]();_0x4a8f83=this[_0x9c63('0x2')];if(!this[_0x9c63('0x8')]){_0x52c13d=0x0;while(_0x308cf3[_0x52c13d]){while((_0x490321=_0x4a8f83[_0x9c63('0x9')](_0x308cf3[_0x52c13d]))!=-0x1){_0x506234=_0x308cf3[_0x52c13d];_0x2c473a=_0x4a8f83[_0x9c63('0xa')](0x0,_0x490321);_0x4a8f83=_0x4a8f83[_0x9c63('0xa')](_0x490321+_0x506234[_0x9c63('0xb')]);var _0x153c10=_0x2c473a['split'](_0x37a3b8),_0x2f00b4=0x0,_0x3df2bb={},_0x29d0ae='',_0x460d50='',_0x4050c9=-0x1;while(_0x153c10[_0x2f00b4]){_0x4050c9=_0x153c10[_0x2f00b4]['indexOf'](':');if(_0x4050c9!=-0x1){_0x29d0ae=_0x153c10[_0x2f00b4][_0x9c63('0xc')](0x0,_0x4050c9)[_0x9c63('0xd')]();_0x460d50=_0x153c10[_0x2f00b4][_0x9c63('0xc')](_0x4050c9+0x1)[_0x9c63('0xd')]();if(_0x29d0ae['length']>0x0){_0x3df2bb[_0x29d0ae]=_0x460d50;}}else{}_0x2f00b4++;}this[_0x9c63('0xe')]('headers',_0x3df2bb);this[_0x9c63('0x8')]=!![];}_0x52c13d++;}this['_localBuffer']=_0x4a8f83;}else{while((_0x1b9365=_0x4a8f83[_0x9c63('0x9')](_0x37a3b8))!=-0x1){_0x2c473a=_0x4a8f83['substring'](0x0,_0x1b9365);this['emit'](_0x9c63('0xf'),_0x2c473a);_0x4a8f83=_0x4a8f83[_0x9c63('0xa')](_0x1b9365+_0x37a3b8[_0x9c63('0xb')]);}this[_0x9c63('0x2')]=_0x4a8f83;}_0x4b3138();};module[_0x9c63('0x10')]=AGIReply; \ No newline at end of file +var _0x287b=['trim','emit','headers','substring','line','exports','util','Transform','call','inherits','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','length','split','slice'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0x287b,0x96));var _0xb287=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0x287b[_0x49c68e];return _0x33032b;};'use strict';var util=require(_0xb287('0x0'));var Transform=require('stream')[_0xb287('0x1')];function AGIReply(_0x259abb){Transform[_0xb287('0x2')](this,_0x259abb);this['_localBuffer']='';this['_inBody']=![];}util[_0xb287('0x3')](AGIReply,Transform);AGIReply['prototype'][_0xb287('0x4')]=function(_0x48c25e,_0x450df6,_0xc6c172){var _0x130648='\x0a',_0x3b442a=['\x0a\x0a',_0xb287('0x5')],_0x3f14cb=-0x1,_0x1fcbd7=-0x1,_0x2a5111='',_0x8c2958=0x0,_0x3e01c9='',_0x8922f1='';this[_0xb287('0x6')]+=_0x48c25e[_0xb287('0x7')]();_0x3e01c9=this[_0xb287('0x6')];if(!this['_inBody']){_0x8c2958=0x0;while(_0x3b442a[_0x8c2958]){while((_0x1fcbd7=_0x3e01c9[_0xb287('0x8')](_0x3b442a[_0x8c2958]))!=-0x1){_0x2a5111=_0x3b442a[_0x8c2958];_0x8922f1=_0x3e01c9['substring'](0x0,_0x1fcbd7);_0x3e01c9=_0x3e01c9['substring'](_0x1fcbd7+_0x2a5111[_0xb287('0x9')]);var _0x56d02b=_0x8922f1[_0xb287('0xa')](_0x130648),_0x4435e7=0x0,_0x4c3d0d={},_0x5ba231='',_0x186ce1='',_0x2a6c5d=-0x1;while(_0x56d02b[_0x4435e7]){_0x2a6c5d=_0x56d02b[_0x4435e7][_0xb287('0x8')](':');if(_0x2a6c5d!=-0x1){_0x5ba231=_0x56d02b[_0x4435e7][_0xb287('0xb')](0x0,_0x2a6c5d)['trim']();_0x186ce1=_0x56d02b[_0x4435e7][_0xb287('0xb')](_0x2a6c5d+0x1)[_0xb287('0xc')]();if(_0x5ba231[_0xb287('0x9')]>0x0){_0x4c3d0d[_0x5ba231]=_0x186ce1;}}else{}_0x4435e7++;}this[_0xb287('0xd')](_0xb287('0xe'),_0x4c3d0d);this['_inBody']=!![];}_0x8c2958++;}this[_0xb287('0x6')]=_0x3e01c9;}else{while((_0x3f14cb=_0x3e01c9['indexOf'](_0x130648))!=-0x1){_0x8922f1=_0x3e01c9[_0xb287('0xf')](0x0,_0x3f14cb);this[_0xb287('0xd')](_0xb287('0x10'),_0x8922f1);_0x3e01c9=_0x3e01c9[_0xb287('0xf')](_0x3f14cb+_0x130648[_0xb287('0x9')]);}this[_0xb287('0x6')]=_0x3e01c9;}_0xc6c172();};module[_0xb287('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 3d9658d..5f3faba 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 _0x98a8=['lodash','moment','jayson/promise','client','http','request','then','error','message','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','LogoutUser'];(function(_0xf41604,_0x38fbfc){var _0x15e10d=function(_0x2e717c){while(--_0x2e717c){_0xf41604['push'](_0xf41604['shift']());}};_0x15e10d(++_0x38fbfc);}(_0x98a8,0x12c));var _0x898a=function(_0x1754bf,_0x4f8e70){_0x1754bf=_0x1754bf-0x0;var _0x275a7d=_0x98a8[_0x1754bf];return _0x275a7d;};'use strict';var _=require(_0x898a('0x0'));var moment=require(_0x898a('0x1'));var jayson=require(_0x898a('0x2'));var client=jayson[_0x898a('0x3')][_0x898a('0x4')]({'port':0x2329});function request(_0x226db7,_0x69c61f){return new Promise(function(_0x4a0836,_0x2bb3e2){return client[_0x898a('0x5')](_0x226db7,_0x69c61f)[_0x898a('0x6')](function(_0x101b7b){if(_0x101b7b[_0x898a('0x7')]){return _0x2bb3e2(_0x101b7b['error'][_0x898a('0x8')]);}else{return _0x4a0836(_0x101b7b['result']);}})[_0x898a('0x9')](function(_0x4fbce5){return _0x2bb3e2(_0x4fbce5);});});}exports[_0x898a('0xa')]=function(){return request(_0x898a('0xb'),{'options':{'raw':![],'attributes':['id',_0x898a('0xc'),_0x898a('0xd')]}});};exports[_0x898a('0xe')]=function(_0x388a47){return request(_0x898a('0xf'),{'options':{'raw':![],'where':{'name':_0x388a47},'attributes':[_0x898a('0xd')]}});};exports[_0x898a('0x10')]=function(_0x5d2de4){return request(_0x898a('0x11'),{'options':{'raw':![],'where':{'id':_0x5d2de4},'include':[{'model':'MailServerOut','as':_0x898a('0x12'),'include':[{'model':'CloudProvider','as':_0x898a('0x13')}]}],'attributes':['id',_0x898a('0xc'),_0x898a('0x14')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x5bfded){return request('ShowSquareProject',{'options':{'where':{'id':_0x5bfded},'attributes':[_0x898a('0xc')]}});};exports[_0x898a('0x15')]=function(_0xb24335){return request(_0x898a('0x16'),{'options':{'where':{'id':_0xb24335},'attributes':[_0x898a('0xc')]}});};exports[_0x898a('0x17')]=function(_0x506023){return request(_0x898a('0x18'),{'options':{'where':{'id':_0x506023},'attributes':['name']}});};exports[_0x898a('0x19')]=function(_0x5c96a6){return request(_0x898a('0x1a'),{'options':{'where':{'id':_0x5c96a6},'attributes':['dsn']}});};exports[_0x898a('0x1b')]=function(_0x56f8f9){return request(_0x898a('0x1c'),{'options':{'where':{'id':_0x56f8f9},'attributes':[_0x898a('0xc')]}});};exports[_0x898a('0x1d')]=function(_0x4ddd4d){return request(_0x898a('0x1e'),{'options':{'where':{'phone':_0x4ddd4d['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x3f8af4){return request(_0x898a('0x1f'),{'options':{'where':{'id':_0x3f8af4},'attributes':['name']}});};exports['getSoundById']=function(_0x12bc0f){return request(_0x898a('0x20'),{'options':{'where':{'id':_0x12bc0f},'attributes':[_0x898a('0x21')]}});};exports[_0x898a('0x22')]=function(_0x2da52d){return request(_0x898a('0x23'),{'options':{'raw':![],'where':{'id':_0x2da52d},'include':[{'model':_0x898a('0x24'),'as':'Intervals'}]}});};exports[_0x898a('0x25')]=function(_0x50718e){return request(_0x898a('0x26'),{'options':{'where':{'id':_0x50718e},'attributes':['id',_0x898a('0xc')]}});};exports[_0x898a('0x27')]=function(_0x310bfa){return request('CreateSmsMessage',{'body':_0x310bfa});};exports[_0x898a('0x28')]=function(_0x16c318){return request(_0x898a('0x29'),{'body':_0x16c318});};exports[_0x898a('0x2a')]=function(_0x3901ab){return request(_0x898a('0x2b'),{'body':_['merge'](_0x3901ab,{'project_name':_0x3901ab[_0x898a('0x2c')],'prev_project_name':_0x3901ab['arg_2']||'','is_subproject':_0x3901ab['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x898a('0x2d'))})});};exports[_0x898a('0x2e')]=function(_0x420b25){return request(_0x898a('0x2f'),{'body':_0x420b25});};exports[_0x898a('0x30')]=function(_0x2efde2){return request(_0x898a('0x31'),{'body':_0x2efde2});};exports[_0x898a('0x32')]=function(_0xd31922){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xd31922['phone'],'ListId':_0xd31922['ListId']}}})[_0x898a('0x6')](function(_0x62fe93){if(_0x62fe93){return _0x62fe93;}return request(_0x898a('0x33'),{'body':_0xd31922});});};exports[_0x898a('0x34')]=function(_0x34f447){return request(_0x898a('0x35'),{'options':{'where':{'id':_0x34f447},'attributes':[_0x898a('0xc')]}});};exports[_0x898a('0x36')]=function(_0x18773a,_0x4287da){return request(_0x898a('0x37'),{'body':{'interface':_0x4287da},'options':{'where':_0x18773a}});};exports[_0x898a('0x38')]=function(_0x494127,_0x7a1eb5,_0x17a5f3){return request(_0x898a('0x39'),{'body':{'type':_0x7a1eb5,'uniqueid':_0x17a5f3},'options':{'where':_0x494127}});};exports[_0x898a('0x3a')]=function(_0x2aa99e){return request('UnpauseUser',{'body':{},'options':{'where':_0x2aa99e}});};exports['agentLogout']=function(_0x20a3fe){return request(_0x898a('0x3b'),{'body':{},'options':{'where':_0x20a3fe}});}; \ No newline at end of file +var _0x6aa7=['client','http','request','error','message','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','lodash','jayson/promise'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x6aa7,0x178));var _0x76aa=function(_0x4c97d4,_0x19c6d2){_0x4c97d4=_0x4c97d4-0x0;var _0x3be2e1=_0x6aa7[_0x4c97d4];return _0x3be2e1;};'use strict';var _=require(_0x76aa('0x0'));var moment=require('moment');var jayson=require(_0x76aa('0x1'));var client=jayson[_0x76aa('0x2')][_0x76aa('0x3')]({'port':0x2329});function request(_0x2db4fe,_0x4f007e){return new Promise(function(_0x13f62b,_0xef15ef){return client[_0x76aa('0x4')](_0x2db4fe,_0x4f007e)['then'](function(_0x588e62){if(_0x588e62[_0x76aa('0x5')]){return _0xef15ef(_0x588e62['error'][_0x76aa('0x6')]);}else{return _0x13f62b(_0x588e62[_0x76aa('0x7')]);}})[_0x76aa('0x8')](function(_0x56d6bc){return _0xef15ef(_0x56d6bc);});});}exports[_0x76aa('0x9')]=function(){return request(_0x76aa('0xa'),{'options':{'raw':![],'attributes':['id',_0x76aa('0xb'),'production']}});};exports[_0x76aa('0xc')]=function(_0x25856d){return request(_0x76aa('0xd'),{'options':{'raw':![],'where':{'name':_0x25856d},'attributes':[_0x76aa('0xe')]}});};exports[_0x76aa('0xf')]=function(_0x128435){return request(_0x76aa('0x10'),{'options':{'raw':![],'where':{'id':_0x128435},'include':[{'model':_0x76aa('0x11'),'as':_0x76aa('0x12'),'include':[{'model':_0x76aa('0x13'),'as':'CloudProvider'}]}],'attributes':['id',_0x76aa('0xb'),'email'],'smtp':!![]}});};exports[_0x76aa('0x14')]=function(_0x12dde0){return request(_0x76aa('0xd'),{'options':{'where':{'id':_0x12dde0},'attributes':[_0x76aa('0xb')]}});};exports[_0x76aa('0x15')]=function(_0x4e309f){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4e309f},'attributes':[_0x76aa('0xb')]}});};exports['getVariableById']=function(_0x180d92){return request(_0x76aa('0x16'),{'options':{'where':{'id':_0x180d92},'attributes':['name']}});};exports[_0x76aa('0x17')]=function(_0x550d9a){return request(_0x76aa('0x18'),{'options':{'where':{'id':_0x550d9a},'attributes':['dsn']}});};exports[_0x76aa('0x19')]=function(_0x413cf6){return request(_0x76aa('0x1a'),{'options':{'where':{'id':_0x413cf6},'attributes':[_0x76aa('0xb')]}});};exports[_0x76aa('0x1b')]=function(_0x3ead3f){return request('GetContactByPhone',{'options':{'where':{'phone':_0x3ead3f['phone']},'attributes':['id']}});};exports[_0x76aa('0x1c')]=function(_0x454dd3){return request(_0x76aa('0x1d'),{'options':{'where':{'id':_0x454dd3},'attributes':[_0x76aa('0xb')]}});};exports[_0x76aa('0x1e')]=function(_0x191560){return request(_0x76aa('0x1f'),{'options':{'where':{'id':_0x191560},'attributes':[_0x76aa('0x20')]}});};exports[_0x76aa('0x21')]=function(_0x5990c1){return request(_0x76aa('0x22'),{'options':{'raw':![],'where':{'id':_0x5990c1},'include':[{'model':_0x76aa('0x23'),'as':_0x76aa('0x24')}]}});};exports['getSmsAccountById']=function(_0x41463a){return request(_0x76aa('0x25'),{'options':{'where':{'id':_0x41463a},'attributes':['id',_0x76aa('0xb')]}});};exports[_0x76aa('0x26')]=function(_0x29c50c){return request(_0x76aa('0x27'),{'body':_0x29c50c});};exports[_0x76aa('0x28')]=function(_0x3363b3){return request(_0x76aa('0x29'),{'body':_0x3363b3});};exports[_0x76aa('0x2a')]=function(_0x37f1ab){return request(_0x76aa('0x2b'),{'body':_[_0x76aa('0x2c')](_0x37f1ab,{'project_name':_0x37f1ab['arg_1'],'prev_project_name':_0x37f1ab[_0x76aa('0x2d')]||'','is_subproject':_0x37f1ab[_0x76aa('0x2d')]?!![]:![],'leaveAt':moment()[_0x76aa('0x2e')](_0x76aa('0x2f'))})});};exports[_0x76aa('0x30')]=function(_0x2f9316){return request(_0x76aa('0x31'),{'body':_0x2f9316});};exports[_0x76aa('0x32')]=function(_0xd12a99){return request(_0x76aa('0x33'),{'body':_0xd12a99});};exports['createCmContact']=function(_0x3fcb7f){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3fcb7f[_0x76aa('0x34')],'ListId':_0x3fcb7f[_0x76aa('0x35')]}}})[_0x76aa('0x36')](function(_0x1e90b9){if(_0x1e90b9){return _0x1e90b9;}return request(_0x76aa('0x37'),{'body':_0x3fcb7f});});};exports[_0x76aa('0x38')]=function(_0x2ee0f9){return request(_0x76aa('0x39'),{'options':{'where':{'id':_0x2ee0f9},'attributes':[_0x76aa('0xb')]}});};exports[_0x76aa('0x3a')]=function(_0x5edcd8,_0x430ad6){return request(_0x76aa('0x3b'),{'body':{'interface':_0x430ad6},'options':{'where':_0x5edcd8}});};exports[_0x76aa('0x3c')]=function(_0x928ccf,_0x458ac3,_0x38ecd1){return request(_0x76aa('0x3d'),{'body':{'type':_0x458ac3,'uniqueid':_0x38ecd1},'options':{'where':_0x928ccf}});};exports['agentUnpause']=function(_0x258624){return request(_0x76aa('0x3e'),{'body':{},'options':{'where':_0x258624}});};exports['agentLogout']=function(_0x2ee338){return request('LogoutUser',{'body':{},'options':{'where':_0x2ee338}});}; \ 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 f1ea623..b0fbe94 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 _0x6c45=['./lex','./polly'];(function(_0x5d697d,_0x450649){var _0x5668a2=function(_0x2e1cd6){while(--_0x2e1cd6){_0x5d697d['push'](_0x5d697d['shift']());}};_0x5668a2(++_0x450649);}(_0x6c45,0xb1));var _0x56c4=function(_0x3d5e06,_0xa87f27){_0x3d5e06=_0x3d5e06-0x0;var _0x561c5a=_0x6c45[_0x3d5e06];return _0x561c5a;};var polly=require(_0x56c4('0x0'));var lex=require(_0x56c4('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc1db=['./polly','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc1db,0x120));var _0xbc1d=function(_0x4f9401,_0x14243a){_0x4f9401=_0x4f9401-0x0;var _0x46c215=_0xc1db[_0x4f9401];return _0x46c215;};var polly=require(_0xbc1d('0x0'));var lex=require('./lex');module[_0xbc1d('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 2fab2e1..e7c37a4 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 _0xbdb7=['./lib/api','exports'];(function(_0x341a0d,_0x17d682){var _0x17505e=function(_0x2a71d0){while(--_0x2a71d0){_0x341a0d['push'](_0x341a0d['shift']());}};_0x17505e(++_0x17d682);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x58e2d2,_0x4ff59b){_0x58e2d2=_0x58e2d2-0x0;var _0x249768=_0xbdb7[_0x58e2d2];return _0x249768;};'use strict';var lex=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]=function(_0x44467d,_0x2a2c1c,_0x23c326,_0x433850,_0x4496ac,_0x2c7e07){return lex(_0x44467d,_0x2a2c1c,_0x23c326,_0x433850,_0x4496ac,_0x2c7e07);}; \ No newline at end of file +var _0x4483=['exports','./lib/api'];(function(_0xc52586,_0x17aecf){var _0x4eaa2b=function(_0x312f75){while(--_0x312f75){_0xc52586['push'](_0xc52586['shift']());}};_0x4eaa2b(++_0x17aecf);}(_0x4483,0x1a3));var _0x3448=function(_0x195c96,_0x4714a8){_0x195c96=_0x195c96-0x0;var _0x4cdef7=_0x4483[_0x195c96];return _0x4cdef7;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ 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 98ad17d..99e2614 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(_0x997530,_0x237690){var _0x4823b7=function(_0x562fdc){while(--_0x562fdc){_0x997530['push'](_0x997530['shift']());}};_0x4823b7(++_0x237690);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x371083,_0x5427c1){var _0x49a086=function(_0x7b4fe3){while(--_0x7b4fe3){_0x371083['push'](_0x371083['shift']());}};_0x49a086(++_0x5427c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 d2f7008..bccca7e 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 _0x80ee=['exports','./lib/api'];(function(_0x4b138c,_0x4922a8){var _0x35db23=function(_0xa599cd){while(--_0xa599cd){_0x4b138c['push'](_0x4b138c['shift']());}};_0x35db23(++_0x4922a8);}(_0x80ee,0x8f));var _0xe80e=function(_0x52ea48,_0x14f622){_0x52ea48=_0x52ea48-0x0;var _0x1f8e44=_0x80ee[_0x52ea48];return _0x1f8e44;};'use strict';var polly=require(_0xe80e('0x0'));module[_0xe80e('0x1')]=function(_0x331175,_0x98e05a,_0x4e3ec5,_0x2ddb16,_0x289b33,_0x53c989,_0x58feff){return polly(_0x331175,_0x98e05a,_0x4e3ec5,_0x2ddb16,_0x289b33,_0x53c989,_0x58feff);}; \ No newline at end of file +var _0xa75a=['exports'];(function(_0x213917,_0xaa4ada){var _0x2522ac=function(_0xc62dcd){while(--_0xc62dcd){_0x213917['push'](_0x213917['shift']());}};_0x2522ac(++_0xaa4ada);}(_0xa75a,0xee));var _0xaa75=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa75a[_0x43d11d];return _0x38cd08;};'use strict';var polly=require('./lib/api');module[_0xaa75('0x0')]=function(_0x5bd65a,_0x375c06,_0x437908,_0x196c33,_0x4bdb49,_0x541ddd,_0xe537db){return polly(_0x5bd65a,_0x375c06,_0x437908,_0x196c33,_0x4bdb49,_0x541ddd,_0xe537db);}; \ 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 a03431f..b96f5db 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 _0x1b5d=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x9f6ad2,_0x44390e){var _0xf9fb3a=function(_0x568c5d){while(--_0x568c5d){_0x9f6ad2['push'](_0x9f6ad2['shift']());}};_0xf9fb3a(++_0x44390e);}(_0x1b5d,0x13a));var _0xd1b5=function(_0x2d2b81,_0x5189e0){_0x2d2b81=_0x2d2b81-0x0;var _0x46f7cf=_0x1b5d[_0x2d2b81];return _0x46f7cf;};'use strict';var fs=require('fs');var path=require(_0xd1b5('0x0'));var BPromise=require(_0xd1b5('0x1'));var rs=require(_0xd1b5('0x2'));var AWS=require(_0xd1b5('0x3'));function pollyResult(_0x320869,_0x58e77a,_0x5681d2){return new BPromise(function(_0x471137,_0x31c3c2){_0x320869[_0xd1b5('0x4')](_0x58e77a,function(_0x3a9b67,_0x2e8722){if(_0x3a9b67){_0x31c3c2(_0x3a9b67);}else if(_0x2e8722){if(_0x2e8722[_0xd1b5('0x5')]instanceof Buffer){fs[_0xd1b5('0x6')](_0x5681d2,_0x2e8722[_0xd1b5('0x5')],function(_0xd44fc){if(_0xd44fc){_0x31c3c2(_0xd44fc);}else{_0x471137();}});}else{_0x31c3c2(new Error(_0xd1b5('0x7')));}}else{_0x31c3c2(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x2b6c1e,_0x5a111e,_0x12aa4d,_0x2efc71,_0x34ff63,_0x2e7d93,_0x2c45e4){var _0x4b690f=new AWS[(_0xd1b5('0x8'))]({'accessKeyId':_0x2b6c1e,'secretAccessKey':_0x5a111e,'region':_0x12aa4d});var _0x1d31db={'Text':_0x34ff63,'TextType':_0x2e7d93||_0xd1b5('0x9'),'OutputFormat':_0xd1b5('0xa'),'VoiceId':_0x2efc71};return pollyResult(_0x4b690f,_0x1d31db,_0x2c45e4);}; \ No newline at end of file +var _0x6d6a=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x6d6a,0x1dd));var _0xa6d6=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0x6d6a[_0x2f0057];return _0x17f2c3;};'use strict';var fs=require('fs');var path=require(_0xa6d6('0x0'));var BPromise=require(_0xa6d6('0x1'));var rs=require(_0xa6d6('0x2'));var AWS=require(_0xa6d6('0x3'));function pollyResult(_0x55e5c3,_0x4d6afd,_0x5a1595){return new BPromise(function(_0x566712,_0x16fc21){_0x55e5c3[_0xa6d6('0x4')](_0x4d6afd,function(_0x2faa55,_0x5d661d){if(_0x2faa55){_0x16fc21(_0x2faa55);}else if(_0x5d661d){if(_0x5d661d[_0xa6d6('0x5')]instanceof Buffer){fs[_0xa6d6('0x6')](_0x5a1595,_0x5d661d[_0xa6d6('0x5')],function(_0x1d7801){if(_0x1d7801){_0x16fc21(_0x1d7801);}else{_0x566712();}});}else{_0x16fc21(new Error(_0xa6d6('0x7')));}}else{_0x16fc21(new Error(_0xa6d6('0x8')));}});});}module[_0xa6d6('0x9')]=function(_0x59fb7e,_0x2be23e,_0x1e02f2,_0x14cd4e,_0xe394ed,_0x424945,_0x275103){var _0x54c6fb=new AWS[(_0xa6d6('0xa'))]({'accessKeyId':_0x59fb7e,'secretAccessKey':_0x2be23e,'region':_0x1e02f2});var _0x28aa6e={'Text':_0xe394ed,'TextType':_0x424945||_0xa6d6('0xb'),'OutputFormat':_0xa6d6('0xc'),'VoiceId':_0x14cd4e};return pollyResult(_0x54c6fb,_0x28aa6e,_0x275103);}; \ 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 1d1dbbb..712760e 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 _0x32f1=['./lib/api'];(function(_0x1f05fe,_0x48c6c0){var _0x52ddae=function(_0x220cc5){while(--_0x220cc5){_0x1f05fe['push'](_0x1f05fe['shift']());}};_0x52ddae(++_0x48c6c0);}(_0x32f1,0x1b1));var _0x132f=function(_0x321d6a,_0x18675e){_0x321d6a=_0x321d6a-0x0;var _0x2435bc=_0x32f1[_0x321d6a];return _0x2435bc;};'use strict';var asr=require(_0x132f('0x0'));module['exports']=function(_0x5999a1,_0x4fb2f0,_0x22e326,_0x59f751){return asr(_0x5999a1,_0x4fb2f0,_0x22e326);}; \ No newline at end of file +var _0x76b8=['./lib/api'];(function(_0x2e3312,_0xfefe34){var _0x332d48=function(_0xec1a2a){while(--_0xec1a2a){_0x2e3312['push'](_0x2e3312['shift']());}};_0x332d48(++_0xfefe34);}(_0x76b8,0xa5));var _0x876b=function(_0x5aaf95,_0x5e8f9b){_0x5aaf95=_0x5aaf95-0x0;var _0x1eb0c5=_0x76b8[_0x5aaf95];return _0x1eb0c5;};'use strict';var asr=require(_0x876b('0x0'));module['exports']=function(_0x599b64,_0x3e797f,_0x51b855,_0x19ae06){return asr(_0x599b64,_0x3e797f,_0x51b855);}; \ 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 291e473..4b80295 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 _0xd847=['POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString'];(function(_0x1d2922,_0xdcb3e0){var _0x1d7211=function(_0x2becdf){while(--_0x2becdf){_0x1d2922['push'](_0x1d2922['shift']());}};_0x1d7211(++_0xdcb3e0);}(_0xd847,0x18a));var _0x7d84=function(_0x1d64cb,_0x5dabab){_0x1d64cb=_0x1d64cb-0x0;var _0x3aa518=_0xd847[_0x1d64cb];return _0x3aa518;};'use strict';var url=require(_0x7d84('0x0'));var BPromise=require(_0x7d84('0x1'));var fs=require('fs');var host=_0x7d84('0x2');module[_0x7d84('0x3')]=function(_0x58816d,_0x5a1e39,_0x4492d5){return new BPromise(function(_0xd9edc8,_0x207e6f){var _0x15f200;if(typeof _0x58816d!==_0x7d84('0x4')||_0x58816d['length']===0x0){return _0x207e6f(_0x7d84('0x5'));}if(typeof _0x5a1e39!=='string'||_0x5a1e39[_0x7d84('0x6')]===0x0){return _0x207e6f(_0x7d84('0x7'));}if(typeof _0x4492d5!==_0x7d84('0x8')&&(typeof _0x4492d5!==_0x7d84('0x4')||_0x4492d5[_0x7d84('0x6')]===0x0)){return _0x207e6f(_0x7d84('0x9'));}try{_0x15f200=fs['readFileSync'](_0x58816d)[_0x7d84('0xa')]('base64');}catch(_0x4a9dc7){return _0x207e6f(_0x4a9dc7);}return _0xd9edc8({'method':_0x7d84('0xb'),'uri':host+_0x7d84('0xc')+_0x5a1e39,'body':{'config':{'encoding':_0x7d84('0xd'),'sampleRateHertz':_0x7d84('0xe'),'languageCode':_0x4492d5},'audio':{'content':_0x15f200}},'json':!![]});});}; \ No newline at end of file +var _0x9f62=['string','length','key\x20should\x20be\x20a\x20string','undefined','base64','LINEAR16','8000','bluebird','exports'];(function(_0x416e51,_0x36b026){var _0x25caaf=function(_0x4a9f0f){while(--_0x4a9f0f){_0x416e51['push'](_0x416e51['shift']());}};_0x25caaf(++_0x36b026);}(_0x9f62,0x154));var _0x29f6=function(_0x21027c,_0x3b5bf6){_0x21027c=_0x21027c-0x0;var _0x32a544=_0x9f62[_0x21027c];return _0x32a544;};'use strict';var url=require('url');var BPromise=require(_0x29f6('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x29f6('0x1')]=function(_0x254ab3,_0x548050,_0x5618b7){return new BPromise(function(_0x54d164,_0x258ddd){var _0x2f0420;if(typeof _0x254ab3!==_0x29f6('0x2')||_0x254ab3[_0x29f6('0x3')]===0x0){return _0x258ddd('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x548050!==_0x29f6('0x2')||_0x548050[_0x29f6('0x3')]===0x0){return _0x258ddd(_0x29f6('0x4'));}if(typeof _0x5618b7!==_0x29f6('0x5')&&(typeof _0x5618b7!==_0x29f6('0x2')||_0x5618b7['length']===0x0)){return _0x258ddd('lang\x20should\x20be\x20a\x20string');}try{_0x2f0420=fs['readFileSync'](_0x254ab3)['toString'](_0x29f6('0x6'));}catch(_0x44db16){return _0x258ddd(_0x44db16);}return _0x54d164({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x548050,'body':{'config':{'encoding':_0x29f6('0x7'),'sampleRateHertz':_0x29f6('0x8'),'languageCode':_0x5618b7},'audio':{'content':_0x2f0420}},'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 8e1b016..00ef6d6 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 _0x1fcb=['./asr','exports'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0x1fcb,0x12e));var _0xb1fc=function(_0x5b9553,_0x2e4058){_0x5b9553=_0x5b9553-0x0;var _0x5089c5=_0x1fcb[_0x5b9553];return _0x5089c5;};var asr=require(_0xb1fc('0x0'));module[_0xb1fc('0x1')]={'asr':asr}; \ No newline at end of file +var _0x3f3e=['./asr','exports'];(function(_0x175fa8,_0x27a9e9){var _0x424eed=function(_0x4a844d){while(--_0x4a844d){_0x175fa8['push'](_0x175fa8['shift']());}};_0x424eed(++_0x27a9e9);}(_0x3f3e,0xea));var _0xe3f3=function(_0x5a85b8,_0x47f088){_0x5a85b8=_0x5a85b8-0x0;var _0x24c897=_0x3f3e[_0x5a85b8];return _0x24c897;};var asr=require(_0xe3f3('0x0'));module[_0xe3f3('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 0c96a29..3cfcf62 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 _0x6f7d=['languageCode','intentDetectionConfidence','fulfillmentText','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','md5','path','querystring','request-promise','randomstring','google-tts-api','url','parse','util','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','error','unlink','download\x20error','pipe','end','host','WHAT_EVER','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','?key=','ssml','input','MP3','text:synthesize','POST','generate','.mp3','from','audioContent','writeFile','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','slice','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','intent','isFallback'];(function(_0x9d1b6e,_0x3bd003){var _0x53fc5f=function(_0x2424b8){while(--_0x2424b8){_0x9d1b6e['push'](_0x9d1b6e['shift']());}};_0x53fc5f(++_0x3bd003);}(_0x6f7d,0x98));var _0xd6f7=function(_0x2590b9,_0x6fca4d){_0x2590b9=_0x2590b9-0x0;var _0x59d358=_0x6f7d[_0x2590b9];return _0x59d358;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xd6f7('0x0'));var dialogflow=require(_0xd6f7('0x1'));var fs=require('fs');var http=require(_0xd6f7('0x2'));var https=require('https');var md5=require(_0xd6f7('0x3'));var path=require(_0xd6f7('0x4'));var querystring=require(_0xd6f7('0x5'));var rp=require(_0xd6f7('0x6'));var rs=require(_0xd6f7('0x7'));var sox=require('sox');var tts=require(_0xd6f7('0x8'));var urlParse=require(_0xd6f7('0x9'))[_0xd6f7('0xa')];var util=require(_0xd6f7('0xb'));var aws=require('./aws');var google=require(_0xd6f7('0xc'));var sestek=require(_0xd6f7('0xd'));var tilde=require(_0xd6f7('0xe'));var logger=require('../../../config/logger')(_0xd6f7('0xf'));var ISPEECH_API=_0xd6f7('0x10');function downloadFile(_0x1f2e7f,_0x5c6c1f){return new BPromise(function(_0x1b15b8,_0x2a36b2){var _0x423aca=urlParse(_0x1f2e7f);var _0x4d5988=_0x423aca[_0xd6f7('0x11')]===_0xd6f7('0x12')?https:http;var _0x2bc099={'host':_0x423aca['host'],'path':_0x423aca[_0xd6f7('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x4d5988[_0xd6f7('0x13')](_0x2bc099,function(_0x1aa36d){if(_0x1aa36d[_0xd6f7('0x14')]!==0xc8){logger['error'](_0xd6f7('0x15')+_0x1f2e7f+_0xd6f7('0x16')+_0x1aa36d[_0xd6f7('0x14')]+'\x20('+_0x1aa36d[_0xd6f7('0x17')]+')');_0x2a36b2(new Error(_0xd6f7('0x15')+_0x1f2e7f+'\x20failed,\x20status\x20code\x20=\x20'+_0x1aa36d[_0xd6f7('0x14')]+'\x20('+_0x1aa36d[_0xd6f7('0x17')]+')'));return;}var _0x171d43=fs[_0xd6f7('0x18')](_0x5c6c1f);_0x171d43['on'](_0xd6f7('0x19'),function(){logger[_0xd6f7('0x1a')]('finish\x20download\x20file');_0x171d43[_0xd6f7('0x1b')](_0x1b15b8);});_0x171d43['on'](_0xd6f7('0x1c'),function(_0x30e5a0){fs[_0xd6f7('0x1d')](_0x5c6c1f);logger[_0xd6f7('0x1c')](_0xd6f7('0x1e'),_0x30e5a0);_0x2a36b2(_0x30e5a0);});_0x1aa36d[_0xd6f7('0x1f')](_0x171d43);})['on'](_0xd6f7('0x1c'),function(_0x45b1ee){logger[_0xd6f7('0x1c')](_0x45b1ee);_0x2a36b2(_0x45b1ee);})[_0xd6f7('0x20')]();});}function uploadFile(_0xeb4c09){return new BPromise(function(_0x5cc3f1,_0x35fb96){var _0x4c13d4=urlParse(_0xeb4c09);var _0x35f23c=_0x4c13d4[_0xd6f7('0x11')]===_0xd6f7('0x12')?https:http;var _0x278e42={'host':_0x4c13d4[_0xd6f7('0x21')],'path':_0x4c13d4[_0xd6f7('0x4')],'headers':{'user-agent':_0xd6f7('0x22')}};_0x35f23c[_0xd6f7('0x13')](_0x278e42,function(_0x4d04c5){if(_0x4d04c5['statusCode']!==0xc8){_0x35fb96(new Error('request\x20to\x20'+_0xeb4c09+_0xd6f7('0x16')+_0x4d04c5[_0xd6f7('0x14')]+'\x20('+_0x4d04c5[_0xd6f7('0x17')]+')'));return;}var _0x1d5fb2='';_0x4d04c5['on'](_0xd6f7('0x23'),function(_0x108379){_0x1d5fb2+=_0x108379;});_0x4d04c5['on'](_0xd6f7('0x20'),function(){_0x5cc3f1(_0x1d5fb2);});})['on'](_0xd6f7('0x1c'),function(_0xe078fb){_0x35fb96(_0xe078fb);})[_0xd6f7('0x20')]();});}function convertFile(_0x3dc3b0,_0x3ec618){return new BPromise(function(_0x287c58,_0x435ed4){var _0x2270fd=sox[_0xd6f7('0x24')](_0x3dc3b0,_0x3ec618,{'sampleRate':0x1f40,'format':_0xd6f7('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2270fd['on']('error',function(_0x151f7d){logger[_0xd6f7('0x1c')](_0xd6f7('0x26'),_0x151f7d);_0x435ed4(_0x151f7d);});_0x2270fd['on'](_0xd6f7('0x20'),function(){logger[_0xd6f7('0x1a')](_0xd6f7('0x27'));_0x287c58();});_0x2270fd['start']();});}function base64Decode(_0x543c6c,_0x241ff1){var _0x114157=path[_0xd6f7('0x28')](__dirname,_0xd6f7('0x29'),rs['generate'](0x4)+_0xd6f7('0x2a'));fs[_0xd6f7('0x2b')](_0x114157,_0x543c6c,_0xd6f7('0x2c'));return convertFile(_0x114157,_0x241ff1)[_0xd6f7('0x2d')](function(){try{fs[_0xd6f7('0x1d')](_0x114157);fs[_0xd6f7('0x2e')](_0x241ff1,_0xd6f7('0x2f'));}catch(_0x10e855){logger[_0xd6f7('0x1c')](_0x10e855);}return _0x241ff1[_0xd6f7('0x30')]('.')[0x0];});}function base64Encode(_0x113261){var _0x3f169b=fs[_0xd6f7('0x31')](_0x113261);return new Buffer(_0x3f169b)[_0xd6f7('0x32')](_0xd6f7('0x2c'));}exports['googleCloudTTS']=function(_0xa25b61,_0x3bbad0,_0x14ea0f,_0x56b399,_0xdad3da,_0x3d68e2){var _0x3f58c2,_0x26c264;var _0x3a2f34='https://texttospeech.googleapis.com/v1/';var _0x44c434=_0xd6f7('0x33')+_0xa25b61;var _0x2b3993={};if(_0x3bbad0===_0xd6f7('0x34')){_0x2b3993[_0xd6f7('0x35')]={'ssml':_0x14ea0f};}else{_0x2b3993[_0xd6f7('0x35')]={'text':_0x14ea0f};};_0x2b3993['voice']={'languageCode':_0x56b399,'ssmlGender':_0xdad3da};_0x2b3993['audioConfig']={'audioEncoding':_0xd6f7('0x36'),'sampleRateHertz':0x1f40};var _0x1843c8={'url':_0x3a2f34+_0xd6f7('0x37')+_0x44c434,'method':_0xd6f7('0x38'),'json':!![],'body':_0x2b3993};return rp(_0x1843c8)[_0xd6f7('0x2d')](function(_0x43d0bf){return new BPromise(function(_0x387688,_0x5d9a16){_0x3f58c2=path[_0xd6f7('0x28')](__dirname,_0xd6f7('0x29'),rs[_0xd6f7('0x39')](0x4)+_0xd6f7('0x3a'));var _0x50e9bc=Buffer[_0xd6f7('0x3b')](_0x43d0bf[_0xd6f7('0x3c')],_0xd6f7('0x2c'));return fs[_0xd6f7('0x3d')](_0x3f58c2,_0x50e9bc,function(_0x354465){_0x5d9a16(_0x354465);},function(_0x4a84cd){fs[_0xd6f7('0x2e')](_0x3f58c2,_0xd6f7('0x2f'));_0x387688(_0x4a84cd);});});})['then'](function(_0x14b2d6){_0x26c264=path[_0xd6f7('0x28')](__dirname,'tmp',rs[_0xd6f7('0x39')](0x4)+_0xd6f7('0x2a'));return convertFile(_0x3f58c2,_0x26c264);})[_0xd6f7('0x2d')](function(){try{fs[_0xd6f7('0x1d')](_0x3f58c2);fs[_0xd6f7('0x2e')](_0x26c264,_0xd6f7('0x2f'));}catch(_0xf77f01){logger['error'](_0xf77f01);}logger['info']('googleCloudTTS\x20path',_0x26c264[_0xd6f7('0x30')]('.')[0x0]);return _0x26c264[_0xd6f7('0x30')]('.')[0x0];});};exports[_0xd6f7('0x3e')]=function(_0x13b174,_0x540023){var _0x57bc78=_0xd6f7('0x3f');var _0x5de792,_0x331431;var _0x5a2491;var _0x543d10={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x57bc78,'headers':{'Content-Type':_0xd6f7('0x40')},'body':_0xd6f7('0x41')+encodeURIComponent(JSON[_0xd6f7('0x42')]([[[_0xd6f7('0x43'),JSON[_0xd6f7('0x42')]([_0x13b174,_0x540023||'en',![],'null']),null,'generic']]]))};return rp(_0x543d10)[_0xd6f7('0x2d')](function(_0x53ac17){try{_0x5a2491=eval(_0x53ac17[_0xd6f7('0x44')](0x5))[0x0][0x2];}catch(_0x2c942e){throw new Error('parse\x20response\x20failed:\x0a'+_0x53ac17[_0xd6f7('0x23')]);}if(!_0x5a2491){if(_0x13b174['length']>0xc8){throw new Error(_0xd6f7('0x45'));}else{throw new Error(_0xd6f7('0x46')+_0x540023+_0xd6f7('0x47'));}}try{_0x5a2491=eval(_0x5a2491)[0x0];}catch(_0x3ddf28){throw new Error(_0xd6f7('0x48')+res[_0xd6f7('0x23')]);}const _0x528771=_0x5a2491;_0x5de792=path[_0xd6f7('0x28')](__dirname,_0xd6f7('0x29'),rs[_0xd6f7('0x39')](0x4)+_0xd6f7('0x3a'));fs[_0xd6f7('0x2b')](_0x5de792,_0x5a2491,{'encoding':_0xd6f7('0x2c')});_0x331431=path[_0xd6f7('0x28')](__dirname,_0xd6f7('0x29'),rs[_0xd6f7('0x39')](0x4)+_0xd6f7('0x2a'));return convertFile(_0x5de792,_0x331431);})[_0xd6f7('0x2d')](function(){try{fs[_0xd6f7('0x1d')](_0x5de792);fs['chmodSync'](_0x331431,_0xd6f7('0x2f'));}catch(_0x2e9861){logger[_0xd6f7('0x1c')](_0x2e9861);}logger[_0xd6f7('0x1a')](_0xd6f7('0x49'),_0x331431[_0xd6f7('0x30')]('.')[0x0]);return _0x331431['split']('.')[0x0];});};exports['googleASR']=function(_0x395793,_0x573961,_0x367c92){return google[_0xd6f7('0x4a')](_0x395793,_0x573961,_0x367c92)['then'](function(_0x2be50c){logger[_0xd6f7('0x1a')](_0x2be50c['uri']);return rp(_0x2be50c);})[_0xd6f7('0x2d')](function(_0x3500e3){var _0x398eea='';var _0x389806=0x0;try{fs['unlink'](_0x395793);}catch(_0x2b946b){logger['error'](_0x2b946b);}if(_0x3500e3&&_0x3500e3[_0xd6f7('0x4b')]){_0x398eea=_0x3500e3[_0xd6f7('0x4b')]['map'](function(_0x413723){return _0x413723&&_0x413723[_0xd6f7('0x4c')][0x0]&&_0x413723[_0xd6f7('0x4c')][0x0][_0xd6f7('0x4d')]?_0x413723[_0xd6f7('0x4c')][0x0][_0xd6f7('0x4d')]:'';})[_0xd6f7('0x4e')]('\x0a');_0x389806=_0x3500e3['results'][_0xd6f7('0x4f')](function(_0x2a81c5){return _0x2a81c5&&_0x2a81c5[_0xd6f7('0x4c')][0x0]&&_0x2a81c5['alternatives'][0x0][_0xd6f7('0x50')]?_0x2a81c5[_0xd6f7('0x4c')][0x0][_0xd6f7('0x50')]:0x0;})[_0xd6f7('0x4e')]('\x0a');}logger[_0xd6f7('0x1a')](_0xd6f7('0x51'),_0x398eea);logger[_0xd6f7('0x1a')](_0xd6f7('0x52'),_0x389806);return{'transcript':_0x398eea,'confidence':_0x389806};})[_0xd6f7('0x53')](function(_0x4c1120){logger[_0xd6f7('0x1c')]('[%s]\x20%s:%s',_0x4c1120['statusCode'],_0x4c1120[_0xd6f7('0x54')],_0x4c1120[_0xd6f7('0x55')]);});};exports[_0xd6f7('0x56')]=function(_0x5bb6ba,_0x32d132,_0x1600a0,_0x1686a5){var _0x403eba=apiai(_0x32d132,{'language':_0x1686a5||'en'});return _0x403eba[_0xd6f7('0x57')](_0x1600a0,{'sessionId':md5(_0x5bb6ba)})[_0xd6f7('0x2d')](function(_0x3f5f8e){logger[_0xd6f7('0x1a')](JSON['stringify'](_0x3f5f8e));return{'source':_0x3f5f8e[_0xd6f7('0x58')]['source'],'resolvedQuery':_0x3f5f8e[_0xd6f7('0x58')]['resolvedQuery'],'action':_0x3f5f8e[_0xd6f7('0x58')][_0xd6f7('0x59')],'actionIncomplete':_0x3f5f8e[_0xd6f7('0x58')][_0xd6f7('0x5a')],'speech':_0x3f5f8e[_0xd6f7('0x58')][_0xd6f7('0x5b')][_0xd6f7('0x5c')],'score':_0x3f5f8e[_0xd6f7('0x58')][_0xd6f7('0x5d')],'statusCode':_0x3f5f8e[_0xd6f7('0x5e')][_0xd6f7('0x5f')],'endConversation':_0x3f5f8e[_0xd6f7('0x58')][_0xd6f7('0x60')][_0xd6f7('0x61')]||![],'isFallbackIntent':_0x3f5f8e[_0xd6f7('0x58')]['metadata'][_0xd6f7('0x62')]};});};exports[_0xd6f7('0x63')]=function(_0x4b7f2b,_0x1efa5c,_0xcdb8fc,_0x2a3387,_0x5588c6,_0x27eb26){var _0x3f1d34=_0x2a3387[_0xd6f7('0x64')](/\\n/g,'\x0a');var _0x30bb50={'credentials':{'private_key':_0x3f1d34,'client_email':_0xcdb8fc}};var _0x511e3b=new dialogflow[(_0xd6f7('0x65'))](_0x30bb50);var _0x5e2e58=_0x511e3b['sessionPath'](_0x1efa5c,md5(_0x4b7f2b));var _0x13ba30={'session':_0x5e2e58,'queryInput':{'text':{'text':_0x5588c6,'languageCode':_0x27eb26}}};return _0x511e3b[_0xd6f7('0x66')](_0x13ba30)['then'](function(_0x252eb5){if(_0x252eb5&&_0x252eb5[_0xd6f7('0x67')]){logger[_0xd6f7('0x1a')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x252eb5));var _0x45f466=_0x252eb5[0x0];if(_0x45f466){var _0x4a2036={'action':_0x45f466['queryResult'][_0xd6f7('0x59')],'allRequiredParamsPresent':_0x45f466[_0xd6f7('0x68')]['allRequiredParamsPresent'],'endConversation':_0x45f466['queryResult'][_0xd6f7('0x69')]&&_0x45f466['queryResult'][_0xd6f7('0x69')][_0xd6f7('0x6a')]?_0x45f466[_0xd6f7('0x68')]['diagnosticInfo'][_0xd6f7('0x6a')][_0xd6f7('0x6b')]['boolValue']:![],'fulfillmentText':_0x45f466[_0xd6f7('0x68')]['fulfillmentText'],'intentName':_0x45f466['queryResult'][_0xd6f7('0x6c')][_0xd6f7('0x54')],'intentDisplayName':_0x45f466[_0xd6f7('0x68')]['intent']['displayName'],'isFallbackIntent':_0x45f466[_0xd6f7('0x68')][_0xd6f7('0x6c')][_0xd6f7('0x6d')],'languageCode':_0x45f466['queryResult'][_0xd6f7('0x6e')],'queryText':_0x45f466[_0xd6f7('0x68')]['queryText'],'responseId':_0x45f466['responseId'],'score':_0x45f466[_0xd6f7('0x68')][_0xd6f7('0x6f')],'speech':_0x45f466[_0xd6f7('0x68')][_0xd6f7('0x70')],'providerResponse':JSON[_0xd6f7('0x42')](_0x252eb5)};return _0x4a2036;}}});};exports['tildeASR']=function(_0x403f68,_0x3b54cb,_0x270238,_0x422137){return tilde[_0xd6f7('0x4a')](_0x403f68,_0x3b54cb,_0x270238,_0x422137)[_0xd6f7('0x2d')](function(_0x4d38b1){try{fs[_0xd6f7('0x1d')](_0x403f68);}catch(_0x192979){logger[_0xd6f7('0x1c')](_0x192979);}logger['info'](_0xd6f7('0x71'),_0x4d38b1['transcript']);logger[_0xd6f7('0x1a')](_0xd6f7('0x72'),_0x4d38b1[_0xd6f7('0x50')]);return _0x4d38b1;});};exports[_0xd6f7('0x73')]=function(_0x3dbcde,_0x4bcba5,_0x5247fa,_0x4a50ef,_0x56994b,_0x1d2a98){var _0x4d3f7c=path['resolve'](__dirname,_0xd6f7('0x29'),rs[_0xd6f7('0x39')](0x4)+_0xd6f7('0x3a'));var _0x1bc915;return aws[_0xd6f7('0x74')](_0x3dbcde,_0x4bcba5,_0x5247fa,_0x4a50ef,_0x56994b,_0x1d2a98,_0x4d3f7c)[_0xd6f7('0x2d')](function(){_0x1bc915=path['resolve'](__dirname,_0xd6f7('0x29'),rs[_0xd6f7('0x39')](0x4)+_0xd6f7('0x2a'));return convertFile(_0x4d3f7c,_0x1bc915);})[_0xd6f7('0x2d')](function(){try{fs['unlink'](_0x4d3f7c);fs[_0xd6f7('0x2e')](_0x1bc915,'777');}catch(_0x52744e){logger['error'](_0x52744e);}return _0x1bc915['split']('.')[0x0];});};exports['awsLex']=function(_0x12dfdf,_0x2cb91f,_0x33c724,_0x2a7afa,_0x2ede05,_0x4bdbfe){return aws[_0xd6f7('0x75')](_0x12dfdf,_0x2cb91f,_0x33c724,_0x2a7afa,_0x2ede05,_0x4bdbfe)[_0xd6f7('0x2d')](function(_0xa4e787){logger['info'](JSON[_0xd6f7('0x42')](_0xa4e787));return _0xa4e787;});};exports['ispeechTTS']=function(_0x4ae410,_0x474941,_0x5df330,_0x5402ba){var _0x2f250d=util[_0xd6f7('0x76')](_0xd6f7('0x77'),ISPEECH_API,_0x4ae410,encodeURIComponent(_0x474941),_0x5df330,_0x5402ba);var _0x58fc9a=path[_0xd6f7('0x28')](__dirname,_0xd6f7('0x29'),rs[_0xd6f7('0x39')](0x4)+_0xd6f7('0x3a'));var _0x435382;return downloadFile(_0x2f250d,_0x58fc9a)[_0xd6f7('0x2d')](function(){_0x435382=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xd6f7('0x2a'));return convertFile(_0x58fc9a,_0x435382);})[_0xd6f7('0x2d')](function(){try{fs[_0xd6f7('0x1d')](_0x58fc9a);fs['chmodSync'](_0x435382,_0xd6f7('0x2f'));}catch(_0x369bfe){logger['error'](_0x369bfe);}return _0x435382['split']('.')[0x0];});};exports[_0xd6f7('0x78')]=function(_0xc71c5f,_0x2b1d83,_0x1dabce,_0x24d1b5){var _0x55eaf1=util[_0xd6f7('0x76')](_0xd6f7('0x79'),ISPEECH_API,_0x2b1d83,_0x1dabce,base64Encode(_0xc71c5f),_0x24d1b5?util['format']('model=%s',encodeURIComponent(_0x24d1b5)):_0xd6f7('0x7a'));return uploadFile(_0x55eaf1)[_0xd6f7('0x2d')](function(_0xfb6b12){return querystring['parse'](_0xfb6b12);});};exports['sestekNDA']=function(_0x1e38a9,_0x321956){return sestek[_0xd6f7('0x7b')](_0x1e38a9,_0x321956)[_0xd6f7('0x2d')](function(_0x420cfe){logger[_0xd6f7('0x1a')](JSON[_0xd6f7('0x42')](_0x420cfe));var _0x5738fd={'speech':_0x420cfe[_0xd6f7('0x7c')],'action':_0x420cfe[_0xd6f7('0x7d')]?_0x420cfe[_0xd6f7('0x7d')][_0xd6f7('0x7e')]:undefined,'actiondata':_0x420cfe[_0xd6f7('0x7d')]?_0x420cfe[_0xd6f7('0x7d')]['CustomActionData']:undefined};if(_0x420cfe[_0xd6f7('0x7d')]&&_0x420cfe['channelData'][_0xd6f7('0x7f')]){return base64Decode(_0x420cfe['channelData'][_0xd6f7('0x7f')][_0xd6f7('0x80')],path['resolve'](__dirname,_0xd6f7('0x29'),rs[_0xd6f7('0x39')](0x4)+'.wav'))[_0xd6f7('0x2d')](function(_0x2731ac){_0x5738fd[_0xd6f7('0x81')]=_0x2731ac;return _0x5738fd;});}return _0x5738fd;});};exports[_0xd6f7('0x82')]=function(){return __dirname;}; \ No newline at end of file +var _0x079c=['googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','result','source','resolvedQuery','action','actionIncomplete','speech','score','metadata','endConversation','isFallbackIntent','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','languageCode','queryText','intentDetectionConfidence','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','randomstring','google-tts-api','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','end','https:','transcode','wav','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','f.req=','stringify','jQ1olc','null','generic','then','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','confidence','join','googleASR\x20transcription'];(function(_0x24bf66,_0x36929a){var _0x2b0c23=function(_0x52cbb0){while(--_0x52cbb0){_0x24bf66['push'](_0x24bf66['shift']());}};_0x2b0c23(++_0x36929a);}(_0x079c,0x1c6));var _0xc079=function(_0x1c0e5c,_0x586435){_0x1c0e5c=_0x1c0e5c-0x0;var _0x195733=_0x079c[_0x1c0e5c];return _0x195733;};'use strict';var apiai=require(_0xc079('0x0'));var BPromise=require(_0xc079('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xc079('0x2'));var https=require(_0xc079('0x3'));var md5=require(_0xc079('0x4'));var path=require(_0xc079('0x5'));var querystring=require(_0xc079('0x6'));var rp=require(_0xc079('0x7'));var rs=require(_0xc079('0x8'));var sox=require('sox');var tts=require(_0xc079('0x9'));var urlParse=require('url')[_0xc079('0xa')];var util=require(_0xc079('0xb'));var aws=require(_0xc079('0xc'));var google=require(_0xc079('0xd'));var sestek=require(_0xc079('0xe'));var tilde=require(_0xc079('0xf'));var logger=require(_0xc079('0x10'))(_0xc079('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x26a55e,_0x552c64){return new BPromise(function(_0x55b58f,_0x4c49c4){var _0x559954=urlParse(_0x26a55e);var _0x49de0a=_0x559954[_0xc079('0x12')]==='https:'?https:http;var _0x3a8628={'host':_0x559954[_0xc079('0x13')],'path':_0x559954['path'],'headers':{'user-agent':_0xc079('0x14')}};_0x49de0a[_0xc079('0x15')](_0x3a8628,function(_0x3e3bd6){if(_0x3e3bd6[_0xc079('0x16')]!==0xc8){logger[_0xc079('0x17')](_0xc079('0x18')+_0x26a55e+_0xc079('0x19')+_0x3e3bd6[_0xc079('0x16')]+'\x20('+_0x3e3bd6[_0xc079('0x1a')]+')');_0x4c49c4(new Error(_0xc079('0x18')+_0x26a55e+_0xc079('0x19')+_0x3e3bd6['statusCode']+'\x20('+_0x3e3bd6[_0xc079('0x1a')]+')'));return;}var _0x3127f6=fs[_0xc079('0x1b')](_0x552c64);_0x3127f6['on'](_0xc079('0x1c'),function(){logger[_0xc079('0x1d')]('finish\x20download\x20file');_0x3127f6[_0xc079('0x1e')](_0x55b58f);});_0x3127f6['on'](_0xc079('0x17'),function(_0x306354){fs[_0xc079('0x1f')](_0x552c64);logger[_0xc079('0x17')](_0xc079('0x20'),_0x306354);_0x4c49c4(_0x306354);});_0x3e3bd6['pipe'](_0x3127f6);})['on'](_0xc079('0x17'),function(_0x54aac9){logger[_0xc079('0x17')](_0x54aac9);_0x4c49c4(_0x54aac9);})[_0xc079('0x21')]();});}function uploadFile(_0x26744){return new BPromise(function(_0x139af9,_0x1548d6){var _0x67204d=urlParse(_0x26744);var _0x7d5172=_0x67204d[_0xc079('0x12')]===_0xc079('0x22')?https:http;var _0x291931={'host':_0x67204d[_0xc079('0x13')],'path':_0x67204d[_0xc079('0x5')],'headers':{'user-agent':_0xc079('0x14')}};_0x7d5172[_0xc079('0x15')](_0x291931,function(_0x36ded7){if(_0x36ded7[_0xc079('0x16')]!==0xc8){_0x1548d6(new Error('request\x20to\x20'+_0x26744+_0xc079('0x19')+_0x36ded7['statusCode']+'\x20('+_0x36ded7[_0xc079('0x1a')]+')'));return;}var _0x3d6ceb='';_0x36ded7['on']('data',function(_0x3da1b9){_0x3d6ceb+=_0x3da1b9;});_0x36ded7['on'](_0xc079('0x21'),function(){_0x139af9(_0x3d6ceb);});})['on'](_0xc079('0x17'),function(_0x41f21d){_0x1548d6(_0x41f21d);})[_0xc079('0x21')]();});}function convertFile(_0x4dff3d,_0x105122){return new BPromise(function(_0x4e756c,_0x3d514e){var _0x53577d=sox[_0xc079('0x23')](_0x4dff3d,_0x105122,{'sampleRate':0x1f40,'format':_0xc079('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x53577d['on']('error',function(_0x584f1f){logger[_0xc079('0x17')]('error\x20convert',_0x584f1f);_0x3d514e(_0x584f1f);});_0x53577d['on']('end',function(){logger['info']('finish\x20to\x20convert');_0x4e756c();});_0x53577d[_0xc079('0x25')]();});}function base64Decode(_0x2b1f10,_0x2d7de4){var _0x3950d7=path[_0xc079('0x26')](__dirname,_0xc079('0x27'),rs[_0xc079('0x28')](0x4)+_0xc079('0x29'));fs[_0xc079('0x2a')](_0x3950d7,_0x2b1f10,_0xc079('0x2b'));return convertFile(_0x3950d7,_0x2d7de4)['then'](function(){try{fs[_0xc079('0x1f')](_0x3950d7);fs[_0xc079('0x2c')](_0x2d7de4,_0xc079('0x2d'));}catch(_0x18adaf){logger['error'](_0x18adaf);}return _0x2d7de4['split']('.')[0x0];});}function base64Encode(_0x3587fd){var _0x4419f3=fs['readFileSync'](_0x3587fd);return new Buffer(_0x4419f3)[_0xc079('0x2e')]('base64');}exports['googleCloudTTS']=function(_0x2b7e34,_0x47b51d,_0x584dc0,_0x326eda,_0x29172d,_0x31fdd2){var _0x310ac3,_0x3e8c7b;var _0x1bfb0c=_0xc079('0x2f');var _0x4ba4b4=_0xc079('0x30')+_0x2b7e34;var _0x32d1ff={};if(_0x47b51d===_0xc079('0x31')){_0x32d1ff['input']={'ssml':_0x584dc0};}else{_0x32d1ff[_0xc079('0x32')]={'text':_0x584dc0};};_0x32d1ff[_0xc079('0x33')]={'languageCode':_0x326eda,'ssmlGender':_0x29172d};_0x32d1ff[_0xc079('0x34')]={'audioEncoding':_0xc079('0x35'),'sampleRateHertz':0x1f40};var _0x46f01b={'url':_0x1bfb0c+_0xc079('0x36')+_0x4ba4b4,'method':'POST','json':!![],'body':_0x32d1ff};return rp(_0x46f01b)['then'](function(_0x407e2c){return new BPromise(function(_0x3ce604,_0x388447){_0x310ac3=path[_0xc079('0x26')](__dirname,'tmp',rs[_0xc079('0x28')](0x4)+_0xc079('0x37'));var _0x334229=Buffer[_0xc079('0x38')](_0x407e2c[_0xc079('0x39')],'base64');return fs[_0xc079('0x3a')](_0x310ac3,_0x334229,function(_0x385527){_0x388447(_0x385527);},function(_0x3ee36d){fs[_0xc079('0x2c')](_0x310ac3,_0xc079('0x2d'));_0x3ce604(_0x3ee36d);});});})['then'](function(_0x69a01){_0x3e8c7b=path[_0xc079('0x26')](__dirname,_0xc079('0x27'),rs['generate'](0x4)+'.wav');return convertFile(_0x310ac3,_0x3e8c7b);})['then'](function(){try{fs['unlink'](_0x310ac3);fs[_0xc079('0x2c')](_0x3e8c7b,_0xc079('0x2d'));}catch(_0x13045d){logger[_0xc079('0x17')](_0x13045d);}logger[_0xc079('0x1d')](_0xc079('0x3b'),_0x3e8c7b[_0xc079('0x3c')]('.')[0x0]);return _0x3e8c7b['split']('.')[0x0];});};exports['googleTTS']=function(_0x5645e2,_0xfbff31){var _0x4b2694=_0xc079('0x3d');var _0x2d45ae,_0x1d8fe6;var _0x361800;var _0x3152e1={'encoding':_0xc079('0x3e'),'method':_0xc079('0x3f'),'timeout':0x2710,'url':_0x4b2694,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xc079('0x40')+encodeURIComponent(JSON[_0xc079('0x41')]([[[_0xc079('0x42'),JSON[_0xc079('0x41')]([_0x5645e2,_0xfbff31||'en',![],_0xc079('0x43')]),null,_0xc079('0x44')]]]))};return rp(_0x3152e1)[_0xc079('0x45')](function(_0x8311e7){try{_0x361800=eval(_0x8311e7[_0xc079('0x46')](0x5))[0x0][0x2];}catch(_0x1b4cda){throw new Error(_0xc079('0x47')+_0x8311e7[_0xc079('0x48')]);}if(!_0x361800){if(_0x5645e2[_0xc079('0x49')]>0xc8){throw new Error(_0xc079('0x4a'));}else{throw new Error(_0xc079('0x4b')+_0xfbff31+'\x22\x20might\x20not\x20exist');}}try{_0x361800=eval(_0x361800)[0x0];}catch(_0xc8655){throw new Error(_0xc079('0x47')+res[_0xc079('0x48')]);}const _0x2e9b41=_0x361800;_0x2d45ae=path[_0xc079('0x26')](__dirname,_0xc079('0x27'),rs[_0xc079('0x28')](0x4)+_0xc079('0x37'));fs[_0xc079('0x2a')](_0x2d45ae,_0x361800,{'encoding':'base64'});_0x1d8fe6=path[_0xc079('0x26')](__dirname,_0xc079('0x27'),rs[_0xc079('0x28')](0x4)+'.wav');return convertFile(_0x2d45ae,_0x1d8fe6);})['then'](function(){try{fs['unlink'](_0x2d45ae);fs[_0xc079('0x2c')](_0x1d8fe6,_0xc079('0x2d'));}catch(_0x508394){logger[_0xc079('0x17')](_0x508394);}logger[_0xc079('0x1d')](_0xc079('0x4c'),_0x1d8fe6['split']('.')[0x0]);return _0x1d8fe6[_0xc079('0x3c')]('.')[0x0];});};exports[_0xc079('0x4d')]=function(_0x549818,_0x6e11f0,_0x1aedf9){return google[_0xc079('0x4e')](_0x549818,_0x6e11f0,_0x1aedf9)[_0xc079('0x45')](function(_0x40d5f6){logger[_0xc079('0x1d')](_0x40d5f6[_0xc079('0x4f')]);return rp(_0x40d5f6);})[_0xc079('0x45')](function(_0x36077d){var _0x42c19d='';var _0x1144e7=0x0;try{fs[_0xc079('0x1f')](_0x549818);}catch(_0x5b5a5e){logger['error'](_0x5b5a5e);}if(_0x36077d&&_0x36077d[_0xc079('0x50')]){_0x42c19d=_0x36077d[_0xc079('0x50')][_0xc079('0x51')](function(_0x95a4a1){return _0x95a4a1&&_0x95a4a1[_0xc079('0x52')][0x0]&&_0x95a4a1[_0xc079('0x52')][0x0]['transcript']?_0x95a4a1['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x1144e7=_0x36077d[_0xc079('0x50')]['map'](function(_0x30a567){return _0x30a567&&_0x30a567['alternatives'][0x0]&&_0x30a567['alternatives'][0x0][_0xc079('0x53')]?_0x30a567['alternatives'][0x0][_0xc079('0x53')]:0x0;})[_0xc079('0x54')]('\x0a');}logger[_0xc079('0x1d')](_0xc079('0x55'),_0x42c19d);logger[_0xc079('0x1d')](_0xc079('0x56'),_0x1144e7);return{'transcript':_0x42c19d,'confidence':_0x1144e7};})[_0xc079('0x57')](function(_0x5d24c0){logger[_0xc079('0x17')](_0xc079('0x58'),_0x5d24c0[_0xc079('0x16')],_0x5d24c0['name'],_0x5d24c0[_0xc079('0x59')]);});};exports[_0xc079('0x5a')]=function(_0x354adb,_0x346fed,_0x4915d6,_0x1b1b85){var _0x41e6bd=apiai(_0x346fed,{'language':_0x1b1b85||'en'});return _0x41e6bd['textRequest'](_0x4915d6,{'sessionId':md5(_0x354adb)})[_0xc079('0x45')](function(_0x4683c1){logger['info'](JSON[_0xc079('0x41')](_0x4683c1));return{'source':_0x4683c1[_0xc079('0x5b')][_0xc079('0x5c')],'resolvedQuery':_0x4683c1[_0xc079('0x5b')][_0xc079('0x5d')],'action':_0x4683c1[_0xc079('0x5b')][_0xc079('0x5e')],'actionIncomplete':_0x4683c1[_0xc079('0x5b')][_0xc079('0x5f')],'speech':_0x4683c1[_0xc079('0x5b')]['fulfillment'][_0xc079('0x60')],'score':_0x4683c1[_0xc079('0x5b')][_0xc079('0x61')],'statusCode':_0x4683c1['status']['code'],'endConversation':_0x4683c1[_0xc079('0x5b')][_0xc079('0x62')][_0xc079('0x63')]||![],'isFallbackIntent':_0x4683c1['result'][_0xc079('0x62')][_0xc079('0x64')]};});};exports['googleDialogflowV2']=function(_0x464f03,_0xfd0964,_0x2a2d0a,_0x20e94e,_0x245a66,_0x19b531){var _0x3cb775=_0x20e94e['replace'](/\\n/g,'\x0a');var _0xa845a5={'credentials':{'private_key':_0x3cb775,'client_email':_0x2a2d0a}};var _0x17a11b=new dialogflow['SessionsClient'](_0xa845a5);var _0x246fe3=_0x17a11b[_0xc079('0x65')](_0xfd0964,md5(_0x464f03));var _0x2f6988={'session':_0x246fe3,'queryInput':{'text':{'text':_0x245a66,'languageCode':_0x19b531}}};return _0x17a11b[_0xc079('0x66')](_0x2f6988)[_0xc079('0x45')](function(_0x3230f8){if(_0x3230f8&&_0x3230f8[_0xc079('0x49')]){logger['info'](_0xc079('0x67'),JSON[_0xc079('0x41')](_0x3230f8));var _0x1632c0=_0x3230f8[0x0];if(_0x1632c0){var _0x624364={'action':_0x1632c0[_0xc079('0x68')][_0xc079('0x5e')],'allRequiredParamsPresent':_0x1632c0[_0xc079('0x68')][_0xc079('0x69')],'endConversation':_0x1632c0[_0xc079('0x68')][_0xc079('0x6a')]&&_0x1632c0[_0xc079('0x68')][_0xc079('0x6a')][_0xc079('0x6b')]?_0x1632c0[_0xc079('0x68')][_0xc079('0x6a')][_0xc079('0x6b')][_0xc079('0x6c')][_0xc079('0x6d')]:![],'fulfillmentText':_0x1632c0[_0xc079('0x68')][_0xc079('0x6e')],'intentName':_0x1632c0[_0xc079('0x68')][_0xc079('0x6f')][_0xc079('0x70')],'intentDisplayName':_0x1632c0[_0xc079('0x68')][_0xc079('0x6f')][_0xc079('0x71')],'isFallbackIntent':_0x1632c0['queryResult'][_0xc079('0x6f')]['isFallback'],'languageCode':_0x1632c0[_0xc079('0x68')][_0xc079('0x72')],'queryText':_0x1632c0[_0xc079('0x68')][_0xc079('0x73')],'responseId':_0x1632c0['responseId'],'score':_0x1632c0[_0xc079('0x68')][_0xc079('0x74')],'speech':_0x1632c0[_0xc079('0x68')]['fulfillmentText'],'providerResponse':JSON[_0xc079('0x41')](_0x3230f8)};return _0x624364;}}});};exports['tildeASR']=function(_0x544909,_0x394e2c,_0x5a0248,_0xf8b372){return tilde[_0xc079('0x4e')](_0x544909,_0x394e2c,_0x5a0248,_0xf8b372)['then'](function(_0x3c7a1e){try{fs[_0xc079('0x1f')](_0x544909);}catch(_0x2bc77e){logger[_0xc079('0x17')](_0x2bc77e);}logger[_0xc079('0x1d')](_0xc079('0x75'),_0x3c7a1e['transcript']);logger[_0xc079('0x1d')]('Tilde\x20ASR\x20confidence',_0x3c7a1e['confidence']);return _0x3c7a1e;});};exports[_0xc079('0x76')]=function(_0x44cfcb,_0x27c2dc,_0x55b84f,_0x4eac74,_0x336c08,_0x27e61c){var _0x4fb977=path[_0xc079('0x26')](__dirname,_0xc079('0x27'),rs['generate'](0x4)+_0xc079('0x37'));var _0x3c63d1;return aws[_0xc079('0x77')](_0x44cfcb,_0x27c2dc,_0x55b84f,_0x4eac74,_0x336c08,_0x27e61c,_0x4fb977)[_0xc079('0x45')](function(){_0x3c63d1=path[_0xc079('0x26')](__dirname,_0xc079('0x27'),rs[_0xc079('0x28')](0x4)+'.wav');return convertFile(_0x4fb977,_0x3c63d1);})['then'](function(){try{fs['unlink'](_0x4fb977);fs[_0xc079('0x2c')](_0x3c63d1,_0xc079('0x2d'));}catch(_0x391079){logger[_0xc079('0x17')](_0x391079);}return _0x3c63d1[_0xc079('0x3c')]('.')[0x0];});};exports[_0xc079('0x78')]=function(_0x34cea6,_0xb059bf,_0x143da5,_0x46ab58,_0x221b4e,_0x4d2e1f){return aws[_0xc079('0x79')](_0x34cea6,_0xb059bf,_0x143da5,_0x46ab58,_0x221b4e,_0x4d2e1f)[_0xc079('0x45')](function(_0x1661d9){logger[_0xc079('0x1d')](JSON[_0xc079('0x41')](_0x1661d9));return _0x1661d9;});};exports[_0xc079('0x7a')]=function(_0x39cb51,_0x24df80,_0x1ffa74,_0x14a79e){var _0x5afefa=util['format'](_0xc079('0x7b'),ISPEECH_API,_0x39cb51,encodeURIComponent(_0x24df80),_0x1ffa74,_0x14a79e);var _0x3ca291=path[_0xc079('0x26')](__dirname,_0xc079('0x27'),rs[_0xc079('0x28')](0x4)+_0xc079('0x37'));var _0x3c6711;return downloadFile(_0x5afefa,_0x3ca291)[_0xc079('0x45')](function(){_0x3c6711=path['resolve'](__dirname,_0xc079('0x27'),rs[_0xc079('0x28')](0x4)+_0xc079('0x29'));return convertFile(_0x3ca291,_0x3c6711);})['then'](function(){try{fs[_0xc079('0x1f')](_0x3ca291);fs[_0xc079('0x2c')](_0x3c6711,_0xc079('0x2d'));}catch(_0x5ef899){logger[_0xc079('0x17')](_0x5ef899);}return _0x3c6711[_0xc079('0x3c')]('.')[0x0];});};exports[_0xc079('0x7c')]=function(_0x37cf8b,_0x57542d,_0x15a530,_0x3d900c){var _0x484432=util[_0xc079('0x7d')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x57542d,_0x15a530,base64Encode(_0x37cf8b),_0x3d900c?util[_0xc079('0x7d')](_0xc079('0x7e'),encodeURIComponent(_0x3d900c)):'freeform=3');return uploadFile(_0x484432)[_0xc079('0x45')](function(_0x3f3568){return querystring['parse'](_0x3f3568);});};exports['sestekNDA']=function(_0x325aee,_0x140f0c){return sestek[_0xc079('0x7f')](_0x325aee,_0x140f0c)[_0xc079('0x45')](function(_0x6f7f3c){logger[_0xc079('0x1d')](JSON[_0xc079('0x41')](_0x6f7f3c));var _0x269212={'speech':_0x6f7f3c[_0xc079('0x80')],'action':_0x6f7f3c['channelData']?_0x6f7f3c[_0xc079('0x81')][_0xc079('0x82')]:undefined,'actiondata':_0x6f7f3c[_0xc079('0x81')]?_0x6f7f3c[_0xc079('0x81')]['CustomActionData']:undefined};if(_0x6f7f3c[_0xc079('0x81')]&&_0x6f7f3c['channelData'][_0xc079('0x83')]){return base64Decode(_0x6f7f3c[_0xc079('0x81')][_0xc079('0x83')][_0xc079('0x84')],path[_0xc079('0x26')](__dirname,_0xc079('0x27'),rs['generate'](0x4)+_0xc079('0x29')))['then'](function(_0x33d98c){_0x269212[_0xc079('0x85')]=_0x33d98c;return _0x269212;});}return _0x269212;});};exports[_0xc079('0x86')]=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 b3e1b47..a9fe1df 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 _0x90ae=['exports','./nda'];(function(_0x170db0,_0x56aa1d){var _0x7b5d47=function(_0x233ae1){while(--_0x233ae1){_0x170db0['push'](_0x170db0['shift']());}};_0x7b5d47(++_0x56aa1d);}(_0x90ae,0xff));var _0xe90a=function(_0xdf718f,_0x128708){_0xdf718f=_0xdf718f-0x0;var _0x38b404=_0x90ae[_0xdf718f];return _0x38b404;};var nda=require(_0xe90a('0x0'));module[_0xe90a('0x1')]={'nda':nda}; \ No newline at end of file +var _0xe81e=['./nda'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0xe81e,0x151));var _0xee81=function(_0x42cb73,_0x2e8b6){_0x42cb73=_0x42cb73-0x0;var _0x18d89c=_0xe81e[_0x42cb73];return _0x18d89c;};var nda=require(_0xee81('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 4385a15..b6c0b76 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 _0x80c7=['CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0x80c7,0x8d));var _0x780c=function(_0x373835,_0x25a9be){_0x373835=_0x373835-0x0;var _0x158bb9=_0x80c7[_0x373835];return _0x158bb9;};'use strict';var rp=require(_0x780c('0x0'));var url=require(_0x780c('0x1'));var logger=require(_0x780c('0x2'))(_0x780c('0x3'));module['exports']=function(_0x5589b0,_0x381187){var _0x5af044={'method':_0x780c('0x4'),'uri':url[_0x780c('0x5')](_0x381187[_0x780c('0x6')],_0x780c('0x7')),'form':{'grant_type':_0x780c('0x8'),'username':_0x381187[_0x780c('0x9')],'password':_0x381187[_0x780c('0x8')]},'json':!![]};return rp(_0x5af044)[_0x780c('0xa')](function(_0x4041cb){var _0x2d858f={'method':_0x780c('0x4'),'uri':url['resolve'](_0x381187[_0x780c('0xb')],_0x780c('0xc')),'body':{'type':_0x381187['ndaactivity_type']||_0x780c('0xd'),'channelId':_0x780c('0xe'),'conversation':{'id':_0x5589b0[_0x780c('0xf')]},'from':{'id':_0x5589b0['callerid'],'name':_0x5589b0[_0x780c('0x10')]},'recipient':{'id':_0x5589b0[_0x780c('0x11')],'name':_0x5589b0[_0x780c('0x12')]},'text':_0x381187[_0x780c('0x13')],'channelData':{}},'headers':{'Authorization':_0x780c('0x14')+_0x4041cb[_0x780c('0x15')]},'json':!![]};if(_0x381187[_0x780c('0x16')]){_0x2d858f[_0x780c('0x17')][_0x780c('0x18')][_0x780c('0x19')]=_0x381187[_0x780c('0x16')];}if(_0x381187[_0x780c('0x1a')]=='1'){_0x2d858f['body']['channelData'][_0x780c('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x780c('0x1c')};}if(_0x381187['custom_action']){_0x2d858f['body'][_0x780c('0x18')][_0x780c('0x1d')]=_0x381187[_0x780c('0x1e')];if(_0x381187[_0x780c('0x1f')]){_0x2d858f[_0x780c('0x17')][_0x780c('0x18')]['CustomActionData']=_0x381187[_0x780c('0x1f')];}}logger[_0x780c('0x20')](JSON[_0x780c('0x21')](_0x2d858f));return rp(_0x2d858f);});}; \ No newline at end of file +var _0xa788=['POST','resolve','username','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','custom_action','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xa788,0x70));var _0x8a78=function(_0x25a514,_0x3ac080){_0x25a514=_0x25a514-0x0;var _0x1dff2d=_0xa788[_0x25a514];return _0x1dff2d;};'use strict';var rp=require(_0x8a78('0x0'));var url=require(_0x8a78('0x1'));var logger=require(_0x8a78('0x2'))(_0x8a78('0x3'));module['exports']=function(_0x3a648f,_0x83f5a6){var _0x5c3b65={'method':_0x8a78('0x4'),'uri':url[_0x8a78('0x5')](_0x83f5a6['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x83f5a6[_0x8a78('0x6')],'password':_0x83f5a6[_0x8a78('0x7')]},'json':!![]};return rp(_0x5c3b65)['then'](function(_0x4def98){var _0x22ebca={'method':'POST','uri':url['resolve'](_0x83f5a6[_0x8a78('0x8')],_0x8a78('0x9')),'body':{'type':_0x83f5a6['ndaactivity_type']||_0x8a78('0xa'),'channelId':_0x8a78('0xb'),'conversation':{'id':_0x3a648f[_0x8a78('0xc')]},'from':{'id':_0x3a648f[_0x8a78('0xd')],'name':_0x3a648f[_0x8a78('0xe')]},'recipient':{'id':_0x3a648f[_0x8a78('0xf')],'name':_0x3a648f[_0x8a78('0x10')]},'text':_0x83f5a6[_0x8a78('0x11')],'channelData':{}},'headers':{'Authorization':_0x8a78('0x12')+_0x4def98['access_token']},'json':!![]};if(_0x83f5a6[_0x8a78('0x13')]){_0x22ebca[_0x8a78('0x14')][_0x8a78('0x15')]['ProjectName']=_0x83f5a6[_0x8a78('0x13')];}if(_0x83f5a6[_0x8a78('0x16')]=='1'){_0x22ebca[_0x8a78('0x14')]['channelData'][_0x8a78('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x83f5a6[_0x8a78('0x18')]){_0x22ebca['body'][_0x8a78('0x15')]['CustomAction']=_0x83f5a6['custom_action'];if(_0x83f5a6['custom_action_data']){_0x22ebca[_0x8a78('0x14')][_0x8a78('0x15')][_0x8a78('0x19')]=_0x83f5a6[_0x8a78('0x1a')];}}logger[_0x8a78('0x1b')](JSON[_0x8a78('0x1c')](_0x22ebca));return rp(_0x22ebca);});}; \ 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 c9f037c..d641155 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 _0xf3ba=['./lib/api','exports'];(function(_0x26adf5,_0x1e9088){var _0x170d5b=function(_0x1273ee){while(--_0x1273ee){_0x26adf5['push'](_0x26adf5['shift']());}};_0x170d5b(++_0x1e9088);}(_0xf3ba,0x82));var _0xaf3b=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xf3ba[_0x18a436];return _0x5c2cf8;};'use strict';var asr=require(_0xaf3b('0x0'));module[_0xaf3b('0x1')]=function(_0x1fdcce,_0x3219da,_0x2ec7b5,_0x43d065){return asr(_0x1fdcce,_0x3219da,_0x2ec7b5,_0x43d065);}; \ No newline at end of file +var _0x5aec=['./lib/api','exports'];(function(_0x3559f5,_0x37af46){var _0x76ed82=function(_0x4f174b){while(--_0x4f174b){_0x3559f5['push'](_0x3559f5['shift']());}};_0x76ed82(++_0x37af46);}(_0x5aec,0xc6));var _0xc5ae=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x5aec[_0xc8a931];return _0x28bd27;};'use strict';var asr=require(_0xc5ae('0x0'));module[_0xc5ae('0x1')]=function(_0x62e47c,_0x5a8f40,_0x125a9d,_0x2312e0){return asr(_0x62e47c,_0x5a8f40,_0x125a9d,_0x2312e0);}; \ 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 5ead25f..8f4c27c 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 _0xfd7a=['transcript','terminate','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','crypto','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','final','info','Tilde\x20ASR\x20hypoteses','result','hypotheses'];(function(_0xf42960,_0x477d1e){var _0x10d7f9=function(_0xec6f27){while(--_0xec6f27){_0xf42960['push'](_0xf42960['shift']());}};_0x10d7f9(++_0x477d1e);}(_0xfd7a,0xcf));var _0xafd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd7a[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var _=require(_0xafd7('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xafd7('0x1'));var crypto=require(_0xafd7('0x2'));var logger=require('../../../../../../config/logger')('agi');module[_0xafd7('0x3')]=function(_0xb43824,_0xc0e07f,_0x1c545d,_0x432b2f){return new BPromise(function(_0xc88916,_0x21db79){logger['info'](_0xafd7('0x4'),_0x432b2f||_0xafd7('0x5'));var _0x53782b=new WebSocket(_0x432b2f||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1f2033='';var _0x2d5394='0';var _0xf24872='1';var _0x48f224=_0xafd7('0x6');function _0xc6d274(_0x2708c5){var _0x12533f=crypto[_0xafd7('0x7')](_0xafd7('0x8'));_0x12533f[_0xafd7('0x9')](_0x2708c5);return _0x12533f['digest'](_0xafd7('0xa'));}function _0x5cc79a(){try{logger['info'](_0xafd7('0xb'));var _0x5e207f=moment()[_0xafd7('0xc')]();var _0x350579=_0xc6d274(_0x5e207f+_0xc0e07f+_0x1c545d);_0x53782b[_0xafd7('0xd')](JSON[_0xafd7('0xe')]({'appID':_0xc0e07f,'timestamp':_0x5e207f,'appKey':_0x350579}));var _0x4362cd=fs[_0xafd7('0xf')](_0xb43824);_0x4362cd['on'](_0xafd7('0x10'),function(_0x1867b2){_0x53782b[_0xafd7('0xd')](_0x1867b2);});_0x4362cd['on'](_0xafd7('0x11'),function(){_0x53782b[_0xafd7('0xd')](_0xafd7('0x12'));});}catch(_0x17648f){logger[_0xafd7('0x13')](_0xafd7('0x14'),JSON[_0xafd7('0xe')](_0x17648f));_0x53782b['terminate']();}}function _0x57217d(_0x5db846){try{if(_0x5db846){var _0x5db2a6=JSON[_0xafd7('0x15')](_0x5db846);switch(_0x5db2a6['status']){case 0x0:if(_0x5db2a6['result']){if(_0x5db2a6['result'][_0xafd7('0x16')]){logger[_0xafd7('0x17')](_0xafd7('0x18'),JSON[_0xafd7('0xe')](_0x5db2a6[_0xafd7('0x19')]['hypotheses']));_0x1f2033=_0x5db2a6[_0xafd7('0x19')][_0xafd7('0x1a')][0x0][_0xafd7('0x1b')];_0x2d5394=_0x5db2a6['result'][_0xafd7('0x1a')][0x0]['likelihood'];_0xf24872='0';_0x48f224='Success.';_0x53782b[_0xafd7('0x1c')]();}}break;case 0x1:logger[_0xafd7('0x17')](_0xafd7('0x6'));_0xf24872='1';_0x48f224=_0xafd7('0x6');break;case 0x2:logger[_0xafd7('0x17')](_0xafd7('0x1d'));_0xf24872='2';_0x48f224='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xafd7('0x17')](_0xafd7('0x1e'));_0xf24872='9';_0x48f224=_0xafd7('0x1e');break;case 0xa:logger[_0xafd7('0x17')]('Authentication\x20failed.');_0xf24872='10';_0x48f224='Authentication\x20failed.';break;case 0xb:logger[_0xafd7('0x17')](_0xafd7('0x1f'));_0xf24872='11';_0x48f224=_0xafd7('0x1f');}}}catch(_0x43fef6){logger[_0xafd7('0x13')](_0xafd7('0x20'),JSON[_0xafd7('0xe')](_0x43fef6));_0x53782b[_0xafd7('0x1c')]();}}function _0x4579b3(){logger[_0xafd7('0x17')](_0xafd7('0x21'));_0xc88916({'transcript':_0x1f2033,'confidence':_0x2d5394,'status':_0xf24872,'status_message':_0x48f224});}function _0xc424e6(_0x448b65){logger[_0xafd7('0x13')](_0xafd7('0x22'));if(!_[_0xafd7('0x23')](_0x448b65)){logger['error'](_[_0xafd7('0x24')](_0x448b65)?JSON[_0xafd7('0xe')](_0x448b65):_0x448b65);}}_0x53782b['on'](_0xafd7('0x25'),_0x5cc79a);_0x53782b['on'](_0xafd7('0x26'),_0x57217d);_0x53782b['on'](_0xafd7('0x11'),_0x4579b3);_0x53782b['on'](_0xafd7('0x13'),_0xc424e6);});}; \ No newline at end of file +var _0xb6ae=['terminate','parse','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','likelihood','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','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','stringify'];(function(_0x385920,_0x1f62d0){var _0x584026=function(_0x584a38){while(--_0x584a38){_0x385920['push'](_0x385920['shift']());}};_0x584026(++_0x1f62d0);}(_0xb6ae,0x1f1));var _0xeb6a=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0xb6ae[_0x390a19];return _0x5d8230;};'use strict';var BPromise=require(_0xeb6a('0x0'));var _=require(_0xeb6a('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xeb6a('0x2'));var logger=require(_0xeb6a('0x3'))(_0xeb6a('0x4'));module[_0xeb6a('0x5')]=function(_0x4e73fc,_0x3f9bb5,_0xba667e,_0x59cc64){return new BPromise(function(_0x2fb658,_0x22c083){logger['info'](_0xeb6a('0x6'),_0x59cc64||_0xeb6a('0x7'));var _0x9221e7=new WebSocket(_0x59cc64||_0xeb6a('0x7'),{'perMessageDeflate':![]});var _0x3d2d2f='';var _0x3ef60c='0';var _0x127720='1';var _0x1137c4=_0xeb6a('0x8');function _0x1b068d(_0x1239d2){var _0x309481=crypto[_0xeb6a('0x9')]('sha1');_0x309481[_0xeb6a('0xa')](_0x1239d2);return _0x309481[_0xeb6a('0xb')](_0xeb6a('0xc'));}function _0x40e4d7(){try{logger[_0xeb6a('0xd')](_0xeb6a('0xe'));var _0x57453c=moment()[_0xeb6a('0xf')]();var _0x8cf47c=_0x1b068d(_0x57453c+_0x3f9bb5+_0xba667e);_0x9221e7[_0xeb6a('0x10')](JSON['stringify']({'appID':_0x3f9bb5,'timestamp':_0x57453c,'appKey':_0x8cf47c}));var _0x19bca5=fs[_0xeb6a('0x11')](_0x4e73fc);_0x19bca5['on'](_0xeb6a('0x12'),function(_0x3cd807){_0x9221e7['send'](_0x3cd807);});_0x19bca5['on'](_0xeb6a('0x13'),function(){_0x9221e7[_0xeb6a('0x10')](_0xeb6a('0x14'));});}catch(_0x4faf51){logger[_0xeb6a('0x15')]('Tilde\x20ASR\x20send\x20error',JSON[_0xeb6a('0x16')](_0x4faf51));_0x9221e7[_0xeb6a('0x17')]();}}function _0x2256a3(_0x375761){try{if(_0x375761){var _0x105f96=JSON[_0xeb6a('0x18')](_0x375761);switch(_0x105f96['status']){case 0x0:if(_0x105f96['result']){if(_0x105f96['result'][_0xeb6a('0x19')]){logger['info'](_0xeb6a('0x1a'),JSON['stringify'](_0x105f96[_0xeb6a('0x1b')][_0xeb6a('0x1c')]));_0x3d2d2f=_0x105f96['result'][_0xeb6a('0x1c')][0x0]['transcript'];_0x3ef60c=_0x105f96[_0xeb6a('0x1b')]['hypotheses'][0x0][_0xeb6a('0x1d')];_0x127720='0';_0x1137c4='Success.';_0x9221e7[_0xeb6a('0x17')]();}}break;case 0x1:logger[_0xeb6a('0xd')](_0xeb6a('0x8'));_0x127720='1';_0x1137c4='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xeb6a('0xd')](_0xeb6a('0x1e'));_0x127720='2';_0x1137c4=_0xeb6a('0x1e');break;case 0x9:logger[_0xeb6a('0xd')](_0xeb6a('0x1f'));_0x127720='9';_0x1137c4='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0xeb6a('0x20'));_0x127720='10';_0x1137c4=_0xeb6a('0x20');break;case 0xb:logger[_0xeb6a('0xd')](_0xeb6a('0x21'));_0x127720='11';_0x1137c4='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2cb936){logger[_0xeb6a('0x15')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xeb6a('0x16')](_0x2cb936));_0x9221e7[_0xeb6a('0x17')]();}}function _0x319112(){logger[_0xeb6a('0xd')](_0xeb6a('0x22'));_0x2fb658({'transcript':_0x3d2d2f,'confidence':_0x3ef60c,'status':_0x127720,'status_message':_0x1137c4});}function _0x111b7e(_0x34daf8){logger['error'](_0xeb6a('0x23'));if(!_[_0xeb6a('0x24')](_0x34daf8)){logger[_0xeb6a('0x15')](_[_0xeb6a('0x25')](_0x34daf8)?JSON[_0xeb6a('0x16')](_0x34daf8):_0x34daf8);}}_0x9221e7['on'](_0xeb6a('0x26'),_0x40e4d7);_0x9221e7['on'](_0xeb6a('0x27'),_0x2256a3);_0x9221e7['on'](_0xeb6a('0x13'),_0x319112);_0x9221e7['on'](_0xeb6a('0x15'),_0x111b7e);});}; \ 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 288cbde..51ca9c7 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 _0xc340=['./asr'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0xc340,0x64));var _0x0c34=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc340[_0x20a584];return _0x4b41a8;};var asr=require(_0x0c34('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x8631=['exports'];(function(_0x48c4ef,_0x319d44){var _0x435715=function(_0x925d50){while(--_0x925d50){_0x48c4ef['push'](_0x48c4ef['shift']());}};_0x435715(++_0x319d44);}(_0x8631,0xd3));var _0x1863=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x8631[_0x2f5ac5];return _0x37c9a8;};var asr=require('./asr');module[_0x1863('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c6a0690..27824c2 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x530db1,_0x2b9531){var _0x31c1f2=function(_0x1c77b3){while(--_0x1c77b3){_0x530db1['push'](_0x530db1['shift']());}};_0x31c1f2(++_0x2b9531);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 95173ea..d916439 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 _0x765e=['extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','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','no\x20grammar\x20configured','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','label','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','MRCPRecog','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:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','speech','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','ndassistant_url','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','variable_id','getData','response','maxdigit','test','hiddendigitsnum','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','generate','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','getIntervals','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechASR','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%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','failure','logout','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','record','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','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','Smtp','user','bcc','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','.wav','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','name','catch','rpc','getVoiceQueueById','then','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervalById','IntervalId','interval','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','dnid','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','includes','POST','PUT','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','body','statusCode','message','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll'];(function(_0x5033ae,_0x10be21){var _0x17e1e6=function(_0x281557){while(--_0x281557){_0x5033ae['push'](_0x5033ae['shift']());}};_0x17e1e6(++_0x10be21);}(_0x765e,0x131));var _0xe765=function(_0x4634e4,_0x449f31){_0x4634e4=_0x4634e4-0x0;var _0x5d0559=_0x765e[_0x4634e4];return _0x5d0559;};'use strict';var fs=require('fs');var util=require(_0xe765('0x0'));var _=require(_0xe765('0x1'));var sh=require(_0xe765('0x2'));var odbc=require(_0xe765('0x3'))();var rs=require(_0xe765('0x4'));var moment=require(_0xe765('0x5'));var Mustache=require(_0xe765('0x6'));var rp=require(_0xe765('0x7'));var logger=require(_0xe765('0x8'))(_0xe765('0x9'));var config=require(_0xe765('0xa'));var shared=require(_0xe765('0xb'));var scripts=require(_0xe765('0xc'));var FILES_PATH=_0xe765('0xd');var recursiveMapAttributes=[_0xe765('0xe'),'rawBody'];var verticesWithRetry=[_0xe765('0xf'),_0xe765('0x10'),_0xe765('0x11')];var AGIVertices=function(_0x2c1232,_0x384f52,_0x41801f){this[_0xe765('0x12')]=_0x2c1232;this['rpc']=_0x384f52;this[_0xe765('0x13')]=_0x41801f;};AGIVertices[_0xe765('0x14')][_0xe765('0x15')]=function(_0x4db1bb,_0x6e86dc){this['rpc']['getVariableById'](_0x4db1bb)['then'](function(_0x35ac59){_0x6e86dc(null,_0x35ac59?_0x35ac59[_0xe765('0x16')]:![]);})[_0xe765('0x17')](function(_0x27456b){_0x6e86dc(_0x27456b);});};AGIVertices[_0xe765('0x14')]['getVoiceQueue']=function(_0x3e2ffb,_0x3a26d8){this[_0xe765('0x18')][_0xe765('0x19')](_0x3e2ffb)[_0xe765('0x1a')](function(_0x5b9436){_0x3a26d8(null,_0x5b9436?_0x5b9436['name']:![]);})[_0xe765('0x17')](function(_0x1b1cfe){_0x3a26d8(_0x1b1cfe);});};AGIVertices[_0xe765('0x14')]['getSquareProject']=function(_0xb240d6,_0x36aca3){this[_0xe765('0x18')][_0xe765('0x1b')](_0xb240d6)[_0xe765('0x1a')](function(_0xf93371){_0x36aca3(null,_0xf93371?_0xf93371[_0xe765('0x16')]:![]);})[_0xe765('0x17')](function(_0x99e6a9){_0x36aca3(_0x99e6a9);});};AGIVertices['prototype'][_0xe765('0x1c')]=function(_0x56905c,_0x14a3c3){this[_0xe765('0x18')]['getSquareOdbcById'](_0x56905c)[_0xe765('0x1a')](function(_0x59118f){_0x14a3c3(null,_0x59118f?_0x59118f[_0xe765('0x1d')]:![]);})[_0xe765('0x17')](function(_0x1efb96){_0x14a3c3(_0x1efb96);});};AGIVertices['prototype']['getUser']=function(_0x4b789b,_0x1c6de4){this[_0xe765('0x18')][_0xe765('0x1e')](_0x4b789b)[_0xe765('0x1a')](function(_0x54b59c){_0x1c6de4(null,_0x54b59c?_0x54b59c['name']:![]);})[_0xe765('0x17')](function(_0x2e2a34){_0x1c6de4(_0x2e2a34);});};AGIVertices[_0xe765('0x14')][_0xe765('0x1f')]=function(_0xad34a7,_0x52bf11){this[_0xe765('0x18')]['getTrunkById'](_0xad34a7)[_0xe765('0x1a')](function(_0xff097f){_0x52bf11(null,_0xff097f?_0xff097f[_0xe765('0x16')]:![]);})[_0xe765('0x17')](function(_0x40492d){_0x52bf11(_0x40492d);});};AGIVertices[_0xe765('0x14')][_0xe765('0x20')]=function(_0x530838,_0x55086d){var _0x52476f=this;this['rpc'][_0xe765('0x21')](_0x530838)[_0xe765('0x1a')](function(_0x2fcbc9){_0x55086d(null,_0x2fcbc9?_0x52476f[_0xe765('0x22')](_0x2fcbc9[_0xe765('0x23')]):![]);})['catch'](function(_0x43349b){_0x55086d(_0x43349b);});};AGIVertices[_0xe765('0x14')][_0xe765('0x24')]=function(_0x5b4a3f,_0x5947c1){this[_0xe765('0x18')]['getMailAccountById'](_0x5b4a3f)[_0xe765('0x1a')](function(_0xe81d01){_0x5947c1(null,_0xe81d01?_0xe81d01:![]);})[_0xe765('0x17')](function(_0x4121f8){_0x5947c1(_0x4121f8);});};AGIVertices[_0xe765('0x14')]['sendMailMessage']=function(_0x58401e,_0x3ecf47,_0x1d0218){this[_0xe765('0x13')][_0xe765('0x25')](_0x58401e,_0x3ecf47)[_0xe765('0x1a')](function(){_0x1d0218(null);})['catch'](function(_0x57b68a){_0x1d0218(_0x57b68a);});};AGIVertices[_0xe765('0x14')]['getIntervals']=function(_0x1c0339,_0x2771c2){this[_0xe765('0x18')][_0xe765('0x26')](_0x1c0339)[_0xe765('0x1a')](function(_0x45fd85){if(_0x45fd85){if(_0x45fd85[_0xe765('0x27')]){_0x2771c2(null,[_0x45fd85['interval']]);}else{_0x2771c2(null,_['map'](_0x45fd85['Intervals'],_0xe765('0x28')));}}else{_0x2771c2(null,![]);}})[_0xe765('0x17')](function(_0x120ca9){_0x2771c2(_0x120ca9);});};AGIVertices[_0xe765('0x14')]['getSoundPath']=function(_0x2412c5){return util[_0xe765('0x29')](_0xe765('0x2a'),FILES_PATH,_0x2412c5);};AGIVertices[_0xe765('0x14')]['getQueryOdbc']=function(_0x458a5b,_0x5905e8,_0x1e084c){odbc[_0xe765('0x2b')](_0x458a5b,function(_0xe2beaf){if(_0xe2beaf){logger[_0xe765('0x2c')](_0xe765('0x2d'),_0xe2beaf);_0x1e084c(_0xe2beaf);}else{logger[_0xe765('0x2e')](_0xe765('0x2f'));odbc[_0xe765('0x30')](_0x5905e8,function(_0xc6618c,_0x472c77){if(_0xc6618c){logger['info'](_0xe765('0x31'),_0x5905e8);_0x1e084c(_0xc6618c);}else{logger[_0xe765('0x2e')](_0xe765('0x32'),_0x5905e8);odbc['close'](function(_0x494b2d){if(_0x494b2d){logger['error'](_0xe765('0x33'),_0x494b2d);}_0x1e084c(null,_0x472c77);});}});}});};AGIVertices['prototype'][_0xe765('0x34')]=function(_0x10f850,_0x3be7d7){this[_0xe765('0x18')]['getSmsAccountById'](_0x10f850)[_0xe765('0x1a')](function(_0x132d49){_0x3be7d7(null,_0x132d49?_0x132d49:![]);})[_0xe765('0x17')](function(_0x4199ea){_0x3be7d7(_0x4199ea);});};AGIVertices[_0xe765('0x14')][_0xe765('0x35')]=function(_0x25c500,_0x18356e){this[_0xe765('0x18')][_0xe765('0x35')](_0x25c500)['then'](function(_0x3d3a24){_0x18356e(null,_0x3d3a24);})['catch'](function(_0x1248ea){_0x18356e(_0x1248ea);});};AGIVertices[_0xe765('0x14')]['createSquareDetailsReport']=function(_0x3977e5,_0x56bd50,_0x4e07ed){this['rpc'][_0xe765('0x36')]({'uniqueid':this[_0xe765('0x12')][_0xe765('0x37')],'node':_0x3977e5['label'],'application':_0x3977e5[_0xe765('0x38')],'data':_0x56bd50||null,'project_name':this[_0xe765('0x12')][_0xe765('0x39')],'callerid':this[_0xe765('0x12')][_0xe765('0x3a')]})[_0xe765('0x1a')](function(_0x1ca660){if(_0x4e07ed){_0x4e07ed(null,_0x1ca660);}})[_0xe765('0x17')](function(_0x2a6ab5){if(_0x4e07ed){_0x4e07ed(_0x2a6ab5);}});};AGIVertices['prototype'][_0xe765('0x3b')]=function(_0x5d0a15,_0x57405f,_0x33eac6,_0x4d4d13){this[_0xe765('0x18')][_0xe765('0x3b')]({'uniqueid':this[_0xe765('0x12')]['uniqueid'],'callerid':this[_0xe765('0x12')]['callerid'],'calleridname':this[_0xe765('0x12')][_0xe765('0x3c')],'context':this[_0xe765('0x12')]['context'],'extension':this[_0xe765('0x12')][_0xe765('0x3d')],'priority':this[_0xe765('0x12')][_0xe765('0x3e')],'accountcode':this['channel']['accountcode'],'dnid':this['channel'][_0xe765('0x3f')],'projectName':this[_0xe765('0x12')][_0xe765('0x39')],'saveName':_0x57405f,'filename':_0x5d0a15['file']||_0x57405f,'savePath':_0x33eac6})[_0xe765('0x1a')](function(_0x4d6bbc){_0x4d4d13(null,_0x4d6bbc);})[_0xe765('0x17')](function(_0xc92af2){_0x4d4d13(_0xc92af2);});};AGIVertices[_0xe765('0x14')][_0xe765('0x40')]=function(_0x7f132f,_0x29a10a,_0x4a7c2a,_0xbd1cd3,_0x3aa1a2){this[_0xe765('0x18')][_0xe765('0x40')]({'uniqueid':this[_0xe765('0x12')][_0xe765('0x37')],'body':_0x7f132f,'direction':_0x29a10a,'providerName':_0x4a7c2a,'providerResponse':_0xbd1cd3})['then'](function(_0x51c73e){if(_0x3aa1a2){_0x3aa1a2(null,_0x51c73e);}})[_0xe765('0x17')](function(_0x1c4792){if(_0x3aa1a2){_0x3aa1a2(_0x1c4792);}});};AGIVertices[_0xe765('0x14')]['createCmContact']=function(_0x4e6762,_0x151828){this[_0xe765('0x18')][_0xe765('0x41')]({'firstName':_[_0xe765('0x42')](_0x4e6762[_0xe765('0x16')])||_[_0xe765('0x43')](_0x4e6762[_0xe765('0x16')])?'callback_'+Math['random']():_0x4e6762[_0xe765('0x16')],'lastName':_['isEmpty'](_0x4e6762[_0xe765('0x44')])||_[_0xe765('0x43')](_0x4e6762[_0xe765('0x44')])?null:_0x4e6762['lastName'],'phone':_0x4e6762[_0xe765('0x45')],'ListId':_0x4e6762[_0xe765('0x46')],'scheduledat':_0x4e6762['scheduledAt'],'callbackUniqueid':this[_0xe765('0x12')][_0xe765('0x37')],'tags':_0xe765('0x47'),'description':_0xe765('0x48')+_0x4e6762[_0xe765('0x49')][_0xe765('0x4a')](),'priority':_0x4e6762[_0xe765('0x4b')]})[_0xe765('0x1a')](function(_0x45be53){_0x151828(null,_0x45be53);})[_0xe765('0x17')](function(_0x2e122d){_0x151828(_0x2e122d);});};AGIVertices[_0xe765('0x14')][_0xe765('0x4c')]=function(_0x47c8f3,_0x11c08a){this[_0xe765('0x18')][_0xe765('0x4d')](_0x47c8f3)[_0xe765('0x1a')](function(_0x3ec5b0){_0x11c08a(null,_0x3ec5b0?_0x3ec5b0[_0xe765('0x16')]:![]);})[_0xe765('0x17')](function(_0x433b6c){_0x11c08a(_0x433b6c);});};AGIVertices[_0xe765('0x14')]['agentPause']=function(_0x138118,_0x478d32,_0x114f2c){var _0x4071c7={'role':'agent'};_0x4071c7[_0x138118]=this[_0xe765('0x12')][_0xe765('0x3a')];this[_0xe765('0x18')][_0xe765('0x4e')](_0x4071c7,_0x478d32,this[_0xe765('0x12')][_0xe765('0x37')])[_0xe765('0x1a')](function(_0x4a19d8){_0x114f2c(null,_[_0xe765('0x43')](_0x4a19d8)?![]:!![]);})[_0xe765('0x17')](function(_0x5c68ff){logger[_0xe765('0x2c')](_0x5c68ff);_0x114f2c(null,![]);});};AGIVertices[_0xe765('0x14')][_0xe765('0x4f')]=function(_0x5965b6,_0x4e3e9a){var _0x1c8f75={'role':_0xe765('0x50')};_0x1c8f75[_0x5965b6]=this['channel']['callerid'];this['rpc'][_0xe765('0x4f')](_0x1c8f75)[_0xe765('0x1a')](function(_0x4b666b){_0x4e3e9a(null,_['isNil'](_0x4b666b)?![]:!![]);})[_0xe765('0x17')](function(_0x52852a){logger[_0xe765('0x2c')](_0x52852a);_0x4e3e9a(null,![]);});};AGIVertices[_0xe765('0x14')][_0xe765('0x51')]=function(_0x1c1968,_0x2e6892){var _0x27b80a={'role':_0xe765('0x50')};_0x27b80a[_0x1c1968]=this[_0xe765('0x12')][_0xe765('0x3a')];this[_0xe765('0x18')][_0xe765('0x51')](_0x27b80a)['then'](function(_0x7f2a02){_0x2e6892(null,_[_0xe765('0x43')](_0x7f2a02)?![]:!![]);})[_0xe765('0x17')](function(_0x2b30cd){logger['error'](_0x2b30cd);_0x2e6892(null,![]);});};AGIVertices[_0xe765('0x14')][_0xe765('0x52')]=function(_0x70bbac,_0x4c5d81){var _0x20ad2a={'role':_0xe765('0x50')};_0x20ad2a[_0x70bbac]=this[_0xe765('0x12')][_0xe765('0x3a')];var _0x349c56=_0x70bbac!=_0xe765('0x53')?util[_0xe765('0x29')](_0xe765('0x54'),_0xe765('0x55'),this[_0xe765('0x12')][_0xe765('0x3a')]):undefined;this[_0xe765('0x18')]['agentLogin'](_0x20ad2a,_0x349c56)[_0xe765('0x1a')](function(_0x2a48aa){_0x4c5d81(null,_['isNil'](_0x2a48aa)?![]:!![]);})[_0xe765('0x17')](function(_0x22ad1d){logger[_0xe765('0x2c')](_0x22ad1d);_0x4c5d81(null,![]);});};AGIVertices[_0xe765('0x14')]['shellCommand']=function(_0x129203,_0x2a1ce1){sh[_0xe765('0x56')](_[_0xe765('0x57')](_0x129203),function(_0x154e41,_0xd06385){var _0x77e081=_0xd06385[_0xe765('0x58')](/(\r\n|\n|\r)/gm,'');_0x2a1ce1(null,_0x77e081);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x245d4f,_0x148c26){scripts['googleCloudTTS'](_0x245d4f[_0xe765('0x59')],_0x245d4f[_0xe765('0x5a')]||_0xe765('0x5b'),_0x245d4f[_0xe765('0x5b')],_0x245d4f[_0xe765('0x5c')]||_0xe765('0x5d'),_0x245d4f[_0xe765('0x5e')]||_0xe765('0x5f'),_0x245d4f[_0xe765('0x60')]||_0xe765('0x61'))[_0xe765('0x1a')](function(_0x28e8a6){_0x148c26(null,_0x28e8a6);})[_0xe765('0x17')](function(_0x4959ed){_0x148c26(_0x4959ed);});};AGIVertices[_0xe765('0x14')]['googleTTS']=function(_0x5416a1,_0x5bf19a){scripts[_0xe765('0x62')](_0x5416a1[_0xe765('0x5b')],_0x5416a1[_0xe765('0x63')]||'en',0x1)[_0xe765('0x1a')](function(_0x5f25a5){_0x5bf19a(null,_0x5f25a5);})[_0xe765('0x17')](function(_0x2ac226){_0x5bf19a(_0x2ac226);});};AGIVertices[_0xe765('0x14')][_0xe765('0x64')]=function(_0x4ac025,_0x3d8feb){var _0x2ddc22={'uri':_0x4ac025[_0xe765('0x65')],'method':_0x4ac025[_0xe765('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4ac025['timeout'])==='number'&&parseInt(_0x4ac025['timeout'])>=0x1?parseInt(_0x4ac025['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xe765('0x67')]([_0xe765('0x68'),_0xe765('0x69')],_0x2ddc22[_0xe765('0x66')][_0xe765('0x6a')]())){try{_0x2ddc22['body']=_0x4ac025[_0xe765('0x6b')]?JSON[_0xe765('0x6c')](_0x4ac025[_0xe765('0x6b')]):{};}catch(_0x3bf008){logger['error'](_0xe765('0x6d'),_0x3bf008);}}try{_0x2ddc22[_0xe765('0x6e')]=_0x4ac025[_0xe765('0xe')]?JSON[_0xe765('0x6c')](_0x4ac025[_0xe765('0xe')]):{};}catch(_0x454d7a){logger['error'](_0xe765('0x6f'),_0x454d7a);}if(_0x4ac025[_0xe765('0x70')]){try{var _0x45bd1b=require(_0x4ac025[_0xe765('0x70')])[_0xe765('0x71')](this,_0x2ddc22);_0x2ddc22['uri']=Mustache['render'](_0x4ac025['url'],_0x45bd1b,{},['$$','$$']);if(_0x2ddc22['headers']){_0x2ddc22['headers']=JSON[_0xe765('0x6c')](Mustache[_0xe765('0x72')](JSON[_0xe765('0x73')](_0x2ddc22['headers']),_0x45bd1b,{},['$$','$$']));}if(_0x2ddc22['body']){_0x2ddc22[_0xe765('0x74')]=JSON[_0xe765('0x6c')](Mustache['render'](JSON['stringify'](_0x2ddc22['body']),_0x45bd1b,{},['$$','$$']));}}catch(_0x2fd976){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2fd976);}}rp(_0x2ddc22)[_0xe765('0x1a')](function(_0x100a00){var _0xbd75b9={'statusCode':_0x100a00[_0xe765('0x75')]||0xc8,'statusMessage':_0x100a00['statusMessage']||'OK','headers':_0x100a00['headers']||{},'body':_0x100a00[_0xe765('0x74')]||{}};_0x3d8feb(null,_0xbd75b9);})[_0xe765('0x17')](function(_0x44d91a){var _0x263dbe={'statusCode':_0x44d91a['statusCode']||0x1f4,'statusMessage':_0x44d91a[_0xe765('0x76')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x44d91a[_0xe765('0x77')][_0xe765('0x6e')]||{},'body':_0x44d91a['options'][_0xe765('0x74')]||{}};_0x3d8feb(null,_0x263dbe);});};AGIVertices['prototype']['googleDialogflow']=function(_0x4287f4,_0x1fdf14){scripts[_0xe765('0x78')](this['channel']['uniqueid'],_0x4287f4[_0xe765('0x79')],_0x4287f4[_0xe765('0x5b')],_0x4287f4['dialogflow_language']||'en')[_0xe765('0x1a')](function(_0x273a3b){_0x1fdf14(null,_0x273a3b);})[_0xe765('0x17')](function(_0x33195c){_0x1fdf14(_0x33195c);});};AGIVertices['prototype'][_0xe765('0x7a')]=function(_0x39d6be,_0x2d102f){scripts[_0xe765('0x7a')](this[_0xe765('0x12')]['uniqueid'],_0x39d6be[_0xe765('0x7b')],_0x39d6be[_0xe765('0x7c')],_0x39d6be[_0xe765('0x7d')],_0x39d6be[_0xe765('0x5b')],_0x39d6be[_0xe765('0x7e')]||'en')[_0xe765('0x1a')](function(_0x3b5faf){_0x2d102f(null,_0x3b5faf);})[_0xe765('0x17')](function(_0x13ba0e){_0x2d102f(_0x13ba0e);});};AGIVertices['prototype'][_0xe765('0x7f')]=function(_0xc55490,_0x43f344){scripts['sestekNDA'](this['channel'],_0xc55490)[_0xe765('0x1a')](function(_0x45f628){_0x43f344(null,_0x45f628);})[_0xe765('0x17')](function(_0x414152){_0x43f344(_0x414152);});};AGIVertices[_0xe765('0x14')]['ispeechTTS']=function(_0x38e76b,_0x3216f9){scripts[_0xe765('0x80')](_0x38e76b[_0xe765('0x79')],_0x38e76b[_0xe765('0x5b')],_0x38e76b['ispeech_tts_language']||_0xe765('0x5d'),_0x38e76b['speed'])[_0xe765('0x1a')](function(_0x1df4b0){_0x3216f9(null,_0x1df4b0);})['catch'](function(_0x53d533){_0x3216f9(_0x53d533);});};AGIVertices['prototype']['ispeechASR']=function(_0x9cf54f,_0x17bfe9,_0x15c6be){scripts['ispeechASR'](_0x17bfe9,_0x9cf54f[_0xe765('0x79')],_0x9cf54f['ispeech_asr_language']||'en-US',this[_0xe765('0x81')](_0x9cf54f[_0xe765('0x82')])?_0x9cf54f['model']:undefined)['then'](function(_0x432036){_0x15c6be(null,_0x432036);})[_0xe765('0x17')](function(_0x50f2d8){_0x15c6be(_0x50f2d8);});};AGIVertices[_0xe765('0x14')][_0xe765('0x83')]=function(_0x5ae4d2,_0x220afe){scripts['awsPolly'](_0x5ae4d2[_0xe765('0x84')],_0x5ae4d2[_0xe765('0x85')],_0x5ae4d2['aws_polly_region'],_0x5ae4d2[_0xe765('0x86')]||_0xe765('0x87'),_0x5ae4d2['text'],_0x5ae4d2[_0xe765('0x88')]||_0xe765('0x5b'))[_0xe765('0x1a')](function(_0x2936fe){_0x220afe(null,_0x2936fe);})['catch'](function(_0x7b9db5){_0x220afe(_0x7b9db5);});};AGIVertices['prototype']['awsLex']=function(_0x20c725,_0x2b202a){scripts[_0xe765('0x89')](this[_0xe765('0x12')]['uniqueid'],_0x20c725[_0xe765('0x84')],_0x20c725['aws_secret_access_key'],_0x20c725['aws_lex_region'],_0x20c725[_0xe765('0x5b')],_0x20c725[_0xe765('0x8a')])[_0xe765('0x1a')](function(_0x404b49){_0x2b202a(null,_0x404b49);})[_0xe765('0x17')](function(_0x43952d){_0x2b202a(_0x43952d);});};AGIVertices['prototype'][_0xe765('0x8b')]=function(_0x17572d,_0x102f27,_0x1b55e2){scripts[_0xe765('0x8b')](_0x102f27,_0x17572d[_0xe765('0x79')],_0x17572d['google_asr_language']||_0xe765('0x5d'))[_0xe765('0x1a')](function(_0x289c7a){_0x1b55e2(null,_0x289c7a);})[_0xe765('0x17')](function(_0x5db6e7){_0x1b55e2(_0x5db6e7);});};AGIVertices[_0xe765('0x14')]['tildeASR']=function(_0x215c89,_0x2f565b,_0x4eb3cf){scripts[_0xe765('0x8c')](_0x2f565b,_0x215c89[_0xe765('0x8d')],_0x215c89[_0xe765('0x8e')],_0x215c89['uri'])['then'](function(_0x24c3dc){_0x4eb3cf(null,_0x24c3dc);})['catch'](function(_0x54d555){_0x4eb3cf(_0x54d555);});};AGIVertices[_0xe765('0x14')][_0xe765('0x8f')]=function(_0x1a46c6){var _0x4b4be6=_[_0xe765('0x67')](verticesWithRetry,_0x1a46c6['agicommand'])?_0x1a46c6:_[_0xe765('0x90')](_0x1a46c6);for(var _0x48535d in _0x4b4be6){if(_0x4b4be6[_0xe765('0x91')](_0x48535d)){if(_0x4b4be6[_0x48535d]&&_[_0xe765('0x92')](_0x4b4be6[_0x48535d])){if(_[_0xe765('0x67')](recursiveMapAttributes,_0x48535d)){_0x4b4be6[_0x48535d]=this[_0xe765('0x93')](_0x4b4be6[_0x48535d]);}else{_0x4b4be6[_0x48535d]=this[_0xe765('0x94')](_0x4b4be6[_0x48535d]);}}}}return _0x4b4be6;};AGIVertices[_0xe765('0x14')]['recursiveNodeIndex']=function(_0x2ac115){for(var _0x127ccc in _0x2ac115){if(_0x2ac115[_0xe765('0x91')](_0x127ccc)){if(_[_0xe765('0x95')](_0x2ac115[_0x127ccc])){this[_0xe765('0x96')](_0x2ac115[_0x127ccc]);}else if(_[_0xe765('0x97')](_0x2ac115[_0x127ccc])){for(var _0x1f472d=0x0;_0x1f472d<_0x2ac115[_0x127ccc][_0xe765('0x98')];_0x1f472d++){this[_0xe765('0x96')](_0x2ac115[_0x127ccc][_0x1f472d]);}}else if(_[_0xe765('0x92')](_0x2ac115[_0x127ccc])){_0x2ac115[_0x127ccc]=this[_0xe765('0x94')](_0x2ac115[_0x127ccc]);}}}};AGIVertices[_0xe765('0x14')][_0xe765('0x99')]=function(_0x51e109,_0x4b4f48){for(var _0x104a66 in _0x51e109){if(_0x51e109[_0xe765('0x91')](_0x104a66)){if(_[_0xe765('0x95')](_0x51e109[_0x104a66])){if(!_[_0xe765('0x42')](_0x51e109[_0x104a66])){this[_0xe765('0x99')](_0x51e109[_0x104a66],util[_0xe765('0x29')](_0xe765('0x9a'),_0x4b4f48,_0x104a66));}}else if(_[_0xe765('0x97')](_0x51e109[_0x104a66])){for(var _0x3efc75=0x0;_0x3efc75<_0x51e109[_0x104a66][_0xe765('0x98')];_0x3efc75++){this['saveRestApiResult'](_0x51e109[_0x104a66][_0x3efc75],util[_0xe765('0x29')](_0xe765('0x9a'),_0x4b4f48,_0x104a66+'['+_0x3efc75+']'));}}else{if(!_[_0xe765('0x43')](_0x51e109[_0x104a66])){this[_0xe765('0x12')][_0xe765('0x9b')](util[_0xe765('0x29')](_0xe765('0x9a'),_0x4b4f48,_0x104a66),_0x51e109[_0x104a66]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x224d64){try{var _0x4be7e2=JSON['parse'](_0x224d64);this[_0xe765('0x96')](_0x4be7e2);return JSON[_0xe765('0x73')](_0x4be7e2);}catch(_0x34587a){return this[_0xe765('0x94')](_0x224d64);}};AGIVertices[_0xe765('0x14')][_0xe765('0x94')]=function(_0x99c36d){var _0x22fdfb=_0x99c36d['split']('{');for(var _0x12cbef=0x1;_0x12cbef<_0x22fdfb['length'];_0x12cbef+=0x1){var _0x7438c4=_0x22fdfb[_0x12cbef][_0xe765('0x9c')]('}');if(_0x7438c4[_0xe765('0x98')]>0x1){_0x99c36d=_0x99c36d[_0xe765('0x9d')]('{'+_0x7438c4[0x0]+'}',this['channel'][_0xe765('0x15')](_0x7438c4[0x0])[_0xe765('0x9e')]||_0x7438c4[0x0]);}}if(_0x22fdfb[_0xe765('0x98')]===0x1){return _0x99c36d[_0xe765('0x4a')]();}return this[_0xe765('0x94')](_0x99c36d);};AGIVertices[_0xe765('0x14')][_0xe765('0x9f')]=function(_0x89cb94,_0x4758e1){var _0x5ebe3e=this['channel'][_0xe765('0x15')](_0x89cb94);if(_0x5ebe3e[_0xe765('0xa0')]===-0x1){return _0x5ebe3e;}logger[_0xe765('0x2e')](util['format'](_0xe765('0xa1'),_0x4758e1,_0x5ebe3e['extra']));return this[_0xe765('0x12')][_0xe765('0x9b')](_0x4758e1,_0x5ebe3e[_0xe765('0x9e')]);};AGIVertices['prototype'][_0xe765('0x81')]=function(_0x125b8a){return _0x125b8a&&_0x125b8a!=='0'&&_0x125b8a!=='-1'&&_0x125b8a!=='';};AGIVertices[_0xe765('0x14')][_0xe765('0xa2')]=function(_0x215abe){this['createSquareDetailsReport'][_0xe765('0x71')](this,_0x215abe,'-');_0x215abe[_0xe765('0xa3')]=_0x215abe[_0xe765('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe765('0x14')][_0xe765('0xa4')]=function(_0x1276e9){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0xa5'),_0x1276e9['label']));if(!this[_0xe765('0x81')](_0x1276e9['text'])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0xa7'));}var _0x376a6b='\x22'+_0x1276e9[_0xe765('0x5b')]+'\x22';if(this[_0xe765('0x81')](_0x1276e9[_0xe765('0x77')])){_0x376a6b+=','+_0x1276e9[_0xe765('0x77')];}var _0x23293c=this['channel'][_0xe765('0x56')](_0xe765('0xa8'),_0x376a6b);if(_0x23293c['result']===-0x1){return _0x23293c;}return this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0xa9'),_0x376a6b));};AGIVertices['prototype'][_0xe765('0xaa')]=function(_0x3219f1){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0xab'),_0x3219f1['label']));if(!this[_0xe765('0x81')](_0x3219f1['grammar'])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0xac'));}var _0x2bfe3d=_0x3219f1[_0xe765('0xad')];if(this[_0xe765('0x81')](_0x3219f1[_0xe765('0x77')])){_0x2bfe3d+=','+_0x3219f1[_0xe765('0x77')];}var _0x34050d=this[_0xe765('0x12')]['exec']('MRCPRecog',_0x2bfe3d);if(_0x34050d[_0xe765('0xa0')]===-0x1){return _0x34050d;}var _0x4885ab=this[_0xe765('0x9f')](_0xe765('0xae'),_0xe765('0xaf'));if(_0x4885ab[_0xe765('0xa0')]===-0x1){return _0x4885ab;}var _0x12bf01=this[_0xe765('0x9f')](_0xe765('0xb0'),_0xe765('0xb1'));if(_0x12bf01['result']===-0x1){return _0x12bf01;}var _0x279ab4=this['getAndSetVariable'](_0xe765('0xb2'),'MRCP_RECOG_INSTANCE');if(_0x279ab4[_0xe765('0xa0')]===-0x1){return _0x279ab4;}return this['channel']['noop'](util[_0xe765('0x29')](_0xe765('0xb3'),_0x2bfe3d));};AGIVertices[_0xe765('0x14')]['agi']=function(_0x59f1ef){logger['info'](util[_0xe765('0x29')](_0xe765('0xb4'),_0x59f1ef['label']));return this[_0xe765('0x12')][_0xe765('0x9')]([_0x59f1ef[_0xe765('0xb5')],_0x59f1ef['args']]);};AGIVertices[_0xe765('0x14')]['answer']=function(_0x57adb1){logger[_0xe765('0x2e')](util[_0xe765('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x57adb1[_0xe765('0xb6')]));if(this[_0xe765('0x81')](_0x57adb1[_0xe765('0xb7')])){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0xb8'),_0x57adb1['timeout']));var _0x5805e6=this[_0xe765('0x12')][_0xe765('0xb9')](_0x57adb1[_0xe765('0xb7')]);if(_0x5805e6[_0xe765('0xa0')]===-0x1){return _0x5805e6;}}return this[_0xe765('0x12')][_0xe765('0xba')]();};AGIVertices[_0xe765('0x14')]['callback']=function(_0x4e2c15){logger[_0xe765('0x2e')](util[_0xe765('0x29')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4e2c15[_0xe765('0xb6')]));if(!this['isConfigured'](_0x4e2c15[_0xe765('0x46')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x4e2c15,_0xe765('0xbb'));}_0x4e2c15[_0xe765('0x49')]=moment();if(this['isConfigured'](_0x4e2c15[_0xe765('0xbc')])){_0x4e2c15[_0xe765('0x49')]=moment()[_0xe765('0xbd')](_0x4e2c15[_0xe765('0xbc')],_0xe765('0xbe'));}if(!this[_0xe765('0x81')](_0x4e2c15[_0xe765('0x4b')])){_0x4e2c15[_0xe765('0x4b')]=0x2;}this[_0xe765('0x41')][_0xe765('0x71')](this,_0x4e2c15);return this[_0xe765('0x12')][_0xe765('0xa6')](util['format'](_0xe765('0xbf'),_0x4e2c15[_0xe765('0x45')],_0x4e2c15[_0xe765('0x46')],_0x4e2c15[_0xe765('0x49')]));};AGIVertices[_0xe765('0x14')]['custom_app']=function(_0x5b960a){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0xc0'),_0x5b960a[_0xe765('0xb6')]));var _0x12fc8c=this[_0xe765('0x12')][_0xe765('0x56')](_0x5b960a[_0xe765('0xc1')],_0x5b960a['options']);if(_0x12fc8c[_0xe765('0xa0')]===-0x1){return _0x12fc8c;}return this['channel'][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0xc2'),_0x5b960a[_0xe765('0xc1')],_0x5b960a[_0xe765('0x77')]));};AGIVertices[_0xe765('0x14')][_0xe765('0xc3')]=function(_0x23fe83){logger[_0xe765('0x2e')](util['format'](_0xe765('0xc4'),_0x23fe83['label']));if(!this['isConfigured'](_0x23fe83['text'])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0xa7'));}var _0x2c1820='\x22'+_0x23fe83[_0xe765('0x5b')]+'\x22';if(this[_0xe765('0x81')](_0x23fe83[_0xe765('0x77')])){_0x2c1820+=','+_0x23fe83[_0xe765('0x77')];}var _0x111338=this['channel'][_0xe765('0x56')]('MRCPSynth',_0x2c1820);if(_0x111338[_0xe765('0xa0')]===-0x1){return _0x111338;}return this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0xa9'),_0x2c1820));};AGIVertices[_0xe765('0x14')][_0xe765('0xc5')]=function(_0x4b1483){logger['info'](util[_0xe765('0x29')](_0xe765('0xc6'),_0x4b1483['label']));if(!this['isConfigured'](_0x4b1483[_0xe765('0x5b')])){return this['channel']['noop'](_0xe765('0xa7'));}var _0x24045d='\x22'+_0x4b1483[_0xe765('0x5b')]+'\x22';if(this[_0xe765('0x81')](_0x4b1483[_0xe765('0x77')])){_0x24045d+=','+_0x4b1483[_0xe765('0x77')];}var _0xba0a4=this[_0xe765('0x12')][_0xe765('0x56')](_0xe765('0xa8'),_0x24045d);if(_0xba0a4['result']===-0x1){return _0xba0a4;}return this['channel'][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0xa9'),_0x24045d));};AGIVertices[_0xe765('0x14')][_0xe765('0xc7')]=function(_0x59d813){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0xc8'),_0x59d813['label']));if(!this[_0xe765('0x81')](_0x59d813[_0xe765('0xad')])){return this[_0xe765('0x12')]['noop'](_0xe765('0xac'));}var _0x569a93=_0x59d813[_0xe765('0xad')];if(this[_0xe765('0x81')](_0x59d813[_0xe765('0x77')])){_0x569a93+=','+_0x59d813[_0xe765('0x77')];}var _0x5b82b4=this[_0xe765('0x12')][_0xe765('0x56')]('MRCPRecog',_0x569a93);if(_0x5b82b4[_0xe765('0xa0')]===-0x1){return _0x5b82b4;}var _0x2c8843=this['getAndSetVariable'](_0xe765('0xae'),_0xe765('0xc9'));if(_0x2c8843[_0xe765('0xa0')]===-0x1){return _0x2c8843;}var _0x41636b=this[_0xe765('0x9f')]('RECOG_INPUT()',_0xe765('0xca'));if(_0x41636b[_0xe765('0xa0')]===-0x1){return _0x41636b;}var _0x48ce76=this[_0xe765('0x9f')](_0xe765('0xb2'),'LUMENVOX_ASR_INSTANCE');if(_0x48ce76[_0xe765('0xa0')]===-0x1){return _0x48ce76;}return this[_0xe765('0x12')][_0xe765('0xa6')](util['format'](_0xe765('0xb3'),_0x569a93));};AGIVertices[_0xe765('0x14')][_0xe765('0xcb')]=function(_0x14b4e3){logger[_0xe765('0x2e')](util[_0xe765('0x29')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x14b4e3[_0xe765('0xb6')]));if(!this['isConfigured'](_0x14b4e3['grammar'])){return this['channel']['noop'](_0xe765('0xac'));}var _0x3b7121=_0x14b4e3[_0xe765('0xad')];if(this['isConfigured'](_0x14b4e3[_0xe765('0x77')])){_0x3b7121+=','+_0x14b4e3['options'];}var _0xcd0035=this[_0xe765('0x12')][_0xe765('0x56')](_0xe765('0xcc'),_0x3b7121);if(_0xcd0035[_0xe765('0xa0')]===-0x1){return _0xcd0035;}var _0x1dff2f=this['getAndSetVariable'](_0xe765('0xae'),_0xe765('0xcd'));if(_0x1dff2f['result']===-0x1){return _0x1dff2f;}var _0xa5a32e=this[_0xe765('0x9f')](_0xe765('0xb0'),_0xe765('0xce'));if(_0xa5a32e['result']===-0x1){return _0xa5a32e;}var _0x55ba6e=this['getAndSetVariable'](_0xe765('0xb2'),_0xe765('0xcf'));if(_0x55ba6e['result']===-0x1){return _0x55ba6e;}return this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3b7121));};AGIVertices[_0xe765('0x14')][_0xe765('0xd0')]=function(_0x3f0d39){logger[_0xe765('0x2e')](util['format'](_0xe765('0xd1'),_0x3f0d39[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0x3f0d39[_0xe765('0xd2')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x3f0d39,_0xe765('0xd3'));}var _0x382555=this[_0xe765('0x1c')][_0xe765('0x71')](this,_0x3f0d39[_0xe765('0xd2')]);if(!_0x382555){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x3f0d39,'no\x20odbc\x20database\x20found');}if(!this[_0xe765('0x81')](_0x3f0d39[_0xe765('0x30')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x3f0d39,_0xe765('0xd4'));}var _0x4376d4=_0x3f0d39['query'][_0xe765('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe765('0x12')]['noop'](util[_0xe765('0x29')](_0xe765('0xd5'),_0x4376d4));var _0x47debe=this[_0xe765('0xd6')][_0xe765('0x71')](this,_0x382555,_0x4376d4);this[_0xe765('0x36')]['sync'](this,_0x3f0d39,_0x4376d4);if(!this[_0xe765('0x81')](_0x3f0d39['variable_id'])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0xd7'));}var _0x2e759b=this[_0xe765('0x15')][_0xe765('0x71')](this,_0x3f0d39['variable_id']);if(!_0x2e759b){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x3f0d39,_0xe765('0xd8'));}var _0x2c3e29=this;_0x47debe[_0xe765('0xd9')](function(_0x3b63bc,_0x49f03a){Object[_0xe765('0xda')](_0x3b63bc)[_0xe765('0xd9')](function(_0x4ae830){_0x2c3e29[_0xe765('0x12')][_0xe765('0x9b')](util[_0xe765('0x29')](_0xe765('0xdb'),_0x2e759b,_0x49f03a,_0x4ae830),_0x3b63bc[_0x4ae830]);});});this[_0xe765('0x12')][_0xe765('0x9b')](util['format']('%s_ROWS_COUNT',_0x2e759b),_0x47debe[_0xe765('0x98')]);return this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0xdc'),_0x2e759b));};AGIVertices[_0xe765('0x14')]['dial']=function(_0x27a9df){logger[_0xe765('0xdd')](util[_0xe765('0x29')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x27a9df['label']));if(!this['isConfigured'](_0x27a9df[_0xe765('0xde')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x27a9df,_0xe765('0xdf'));}var _0x5ad4ef=this[_0xe765('0xe0')]['sync'](this,_0x27a9df[_0xe765('0xde')]);if(!_0x5ad4ef){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x27a9df,_0xe765('0xe1'));}var _0x4f6cf3=this[_0xe765('0x12')][_0xe765('0x56')]('DIAL',[util[_0xe765('0x29')](_0xe765('0xe2'),_0x5ad4ef),_0x27a9df[_0xe765('0xb7')],_0x27a9df['opts'],_0x27a9df[_0xe765('0x65')]]);if(_0x4f6cf3[_0xe765('0xa0')]===-0x1){return _0x4f6cf3;}return this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0xe3'),_0xe765('0xe4')));};AGIVertices[_0xe765('0x14')]['dialogflow']=function(_0x52d45a){logger[_0xe765('0x2e')](util['format'](_0xe765('0xe5'),_0x52d45a[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0x52d45a['key'])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0xe6'));}if(!this['isConfigured'](_0x52d45a[_0xe765('0x5b')])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0xa7'));}this[_0xe765('0x12')]['bot']=!![];this['createSquareDetailsReport'](_0x52d45a);this[_0xe765('0x40')](_0x52d45a['text'],'in','','');this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0xe7'),_0x52d45a[_0xe765('0x5b')]));var _0x567c93=this[_0xe765('0x78')][_0xe765('0x71')](this,_0x52d45a);if(_0x567c93){for(var _0xb72ae2 in _0x567c93){if(_0x567c93[_0xe765('0x91')](_0xb72ae2)){this['channel'][_0xe765('0x9b')](util['format'](_0xe765('0xe8'),_0xb72ae2['toUpperCase']()),_0x567c93[_0xb72ae2]);}}this[_0xe765('0x40')](_0x567c93['speech'],_0xe765('0xe9'),_0xe765('0xea'),'');return this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0xeb'),_0x567c93[_0xe765('0xec')]));}return this['channel'][_0xe765('0x2c')](_0x52d45a,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xe765('0xed')]=function(_0x299b35){logger['info'](util['format'](_0xe765('0xee'),_0x299b35['label']));if(!this['isConfigured'](_0x299b35[_0xe765('0x7b')])){return this[_0xe765('0x12')]['noop'](_0xe765('0xef'));}if(!this['isConfigured'](_0x299b35[_0xe765('0x7c')])){return this[_0xe765('0x12')]['noop']('no\x20client_email\x20configured');}if(!this[_0xe765('0x81')](_0x299b35[_0xe765('0x7d')])){return this['channel']['noop'](_0xe765('0xf0'));}if(!this[_0xe765('0x81')](_0x299b35[_0xe765('0x7e')])){return this[_0xe765('0x12')][_0xe765('0xa6')]('no\x20anguage\x20configured');}if(!this[_0xe765('0x81')](_0x299b35[_0xe765('0x5b')])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0xa7'));}this['channel'][_0xe765('0xf1')]=!![];this[_0xe765('0x36')](_0x299b35);this[_0xe765('0x40')](_0x299b35['text'],'in','','');this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0xf2'),_0x299b35[_0xe765('0x5b')]));var _0x402082=this[_0xe765('0x7a')][_0xe765('0x71')](this,_0x299b35);if(_0x402082){for(var _0x483fdc in _0x402082){if(_0x402082[_0xe765('0x91')](_0x483fdc)){if(_0x483fdc!==_0xe765('0xf3')){this[_0xe765('0x12')][_0xe765('0x9b')](util[_0xe765('0x29')](_0xe765('0xe8'),_0x483fdc[_0xe765('0x6a')]()),_0x402082[_0x483fdc]);}}}this['createSquareMessage'](_0x402082['speech'],_0xe765('0xe9'),_0xe765('0xed'),_0x402082['providerResponse']);return this[_0xe765('0x12')]['noop'](util['format'](_0xe765('0xf4'),_0x402082[_0xe765('0xec')]));}return this['channel'][_0xe765('0x2c')](_0x299b35,_0xe765('0xf5'));};AGIVertices['prototype'][_0xe765('0xf6')]=function(_0xe85a05){logger[_0xe765('0x2e')](util['format'](_0xe765('0xf7'),_0xe85a05[_0xe765('0xb6')]));if(!this['isConfigured'](_0xe85a05[_0xe765('0xf8')])){return this['channel'][_0xe765('0xa6')](_0xe765('0xf9'));}if(!this[_0xe765('0x81')](_0xe85a05[_0xe765('0xfa')])){return this['channel'][_0xe765('0xa6')](_0xe765('0xfb'));}if(!this[_0xe765('0x81')](_0xe85a05['password'])){return this[_0xe765('0x12')][_0xe765('0xa6')]('no\x20password\x20configured');}if(!this[_0xe765('0x81')](_0xe85a05[_0xe765('0xfc')])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0xa7'));}this[_0xe765('0x12')]['bot']=!![];this[_0xe765('0x36')](_0xe85a05);this[_0xe765('0x40')](_0xe85a05[_0xe765('0x5b')],'in','','');this[_0xe765('0x12')][_0xe765('0xa6')](util['format']('Trying\x20SestekNDA:\x20%s',_0xe85a05[_0xe765('0x5b')]));var _0x477240=this['sestekNDA'][_0xe765('0x71')](this,_0xe85a05);if(_0x477240){for(var _0x3e7db9 in _0x477240){if(_0x477240['hasOwnProperty'](_0x3e7db9)){this[_0xe765('0x12')]['setVariable'](util[_0xe765('0x29')](_0xe765('0xfd'),_0x3e7db9[_0xe765('0x6a')]()),_0x477240[_0x3e7db9]);}}this[_0xe765('0x40')](_0x477240['speech'],_0xe765('0xe9'),_0xe765('0xf6'),'');if(_0x477240['audiofile']){this[_0xe765('0x12')][_0xe765('0xa6')](util['format'](_0xe765('0xfe'),_0x477240[_0xe765('0xff')]));var _0x33f681=this[_0xe765('0x12')][_0xe765('0x100')](_0x477240[_0xe765('0xff')]);try{fs['unlink'](_0x477240[_0xe765('0xff')]+'.wav');}catch(_0x2b15e0){logger[_0xe765('0x2c')](_0x2b15e0);}return _0x33f681;}else{return this[_0xe765('0x12')]['noop'](util[_0xe765('0x29')](_0xe765('0x101'),_0x477240[_0xe765('0xec')]));}}return this[_0xe765('0x12')][_0xe765('0x2c')](_0xe85a05,_0xe765('0x102'));};AGIVertices[_0xe765('0x14')]['end']=function(_0xa32f5c){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x103'),_0xa32f5c[_0xe765('0xb6')]));return this['channel'][_0xe765('0xa6')](_0xe765('0x104'));};AGIVertices[_0xe765('0x14')][_0xe765('0x105')]=function(_0x51ee41){logger['info'](util['format'](_0xe765('0x106'),_0x51ee41[_0xe765('0xb6')]));var _0xc91efe='';if(_0x51ee41['trunk_id']){if(!this['isConfigured'](_0x51ee41[_0xe765('0x107')])){return this['channel']['error'](_0x51ee41,'no\x20trunk\x20selected');}else{var _0x2fd2f5=parseInt(_0x51ee41['trunk_id'],0xa);if(isNaN(_0x2fd2f5)){_0xc91efe=_0x51ee41[_0xe765('0x107')];}else{_0xc91efe=this[_0xe765('0x1f')][_0xe765('0x71')](this,_0x51ee41[_0xe765('0x107')]);if(!_0xc91efe){return this['channel'][_0xe765('0x2c')](_0x51ee41,_0xe765('0x108'));}}}}else if(_0x51ee41[_0xe765('0x109')]){_0xc91efe=_0x51ee41[_0xe765('0x109')];}else{return this['channel'][_0xe765('0x2c')](_0x51ee41,_0xe765('0x10a'));}var _0x5f5c99=this[_0xe765('0x12')][_0xe765('0x56')](_0xe765('0xe4'),[util[_0xe765('0x29')](_0xe765('0x10b'),_0xc91efe,_0x51ee41['phone']),_0x51ee41['timeout'],_0x51ee41[_0xe765('0x10c')],_0x51ee41['url']]);if(_0x5f5c99['result']===-0x1){return _0x5f5c99;}return this[_0xe765('0x12')][_0xe765('0xa6')](util['format']('Executed\x20command\x20%s',_0xe765('0xe4')));};AGIVertices[_0xe765('0x14')][_0xe765('0x10d')]=function(_0x10829a){logger['info'](util[_0xe765('0x29')](_0xe765('0x10e'),_0x10829a[_0xe765('0xb6')]));return this['channel'][_0xe765('0xa6')](_0xe765('0x10d'));};AGIVertices[_0xe765('0x14')][_0xe765('0x10')]=function(_0x14b3c8){logger['info'](util[_0xe765('0x29')](_0xe765('0x10f'),_0x14b3c8['label']));if(_0x14b3c8[_0xe765('0xa3')]===0x0){return this[_0xe765('0xa2')](_0x14b3c8);}_0x14b3c8['retry']-=0x1;if(!this[_0xe765('0x81')](_0x14b3c8[_0xe765('0x110')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x14b3c8,_0xe765('0x111'));}var _0x7c9af6=this[_0xe765('0x20')][_0xe765('0x71')](this,_0x14b3c8[_0xe765('0x110')]);if(!_0x7c9af6){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x14b3c8,_0xe765('0x112'));}if(!this[_0xe765('0x81')](_0x14b3c8[_0xe765('0x113')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0xe765('0xd7'));}var _0x290d93=this[_0xe765('0x12')][_0xe765('0x114')](_0x7c9af6,_0x14b3c8[_0xe765('0x115')],_0x14b3c8[_0xe765('0x116')]);var _0xc95701=_0x290d93[_0xe765('0xa0')]?_0x290d93[_0xe765('0xa0')][_0xe765('0x4a')]():'';logger[_0xe765('0x2e')](_0xe765('0x117'),JSON[_0xe765('0x73')](_0x290d93));if(_0x290d93[_0xe765('0xa0')]===-0x1){this['createSquareDetailsReport'][_0xe765('0x71')](this,_0x14b3c8,_0xc95701);return _0x290d93;}else if(_0x290d93[_0xe765('0x9e')]===_0xe765('0xb7')){_0x290d93[_0xe765('0xa0')]=_0xc95701[_0xe765('0x98')]>=parseInt(_0x14b3c8['mindigit'])?'x':'i';}else{_0x290d93['result']=_0xc95701[_0xe765('0x98')]>=parseInt(_0x14b3c8['mindigit'])&&_0xc95701[_0xe765('0x98')]<=parseInt(_0x14b3c8['maxdigit'])?'x':'i';}var _0x5ece8e=this[_0xe765('0x15')][_0xe765('0x71')](this,_0x14b3c8['variable_id']);if(!_0x5ece8e){return this[_0xe765('0x12')]['error'](_0x14b3c8,_0xe765('0xd8'));}this[_0xe765('0x12')][_0xe765('0x9b')](_0x5ece8e,_0xc95701);if(this[_0xe765('0x81')](_0x14b3c8['hiddendigitsnum'])){var _0x4a46db=parseInt(_0x14b3c8[_0xe765('0x118')],0xa);var _0xfba27c=rs['generate']({'charset':'*','length':_0x4a46db});var _0x1252ca=_0xc95701[_0xe765('0x98')];if(_0x1252ca>0x0){if(_0x1252ca>_0x4a46db){this[_0xe765('0x36')][_0xe765('0x71')](this,_0x14b3c8,_0x14b3c8[_0xe765('0x119')]===_0xe765('0x11a')?_0xfba27c+_0xc95701[_0xe765('0x11b')](_0x4a46db):_0xc95701['substr'](0x0,_0x1252ca-_0x4a46db)+_0xfba27c);}else{this['createSquareDetailsReport']['sync'](this,_0x14b3c8,rs['generate']({'charset':'*','length':_0x1252ca}));}}else{this['createSquareDetailsReport'][_0xe765('0x71')](this,_0x14b3c8,'');}}else{this[_0xe765('0x36')][_0xe765('0x71')](this,_0x14b3c8,_0xc95701);}return _0x290d93;};AGIVertices[_0xe765('0x14')][_0xe765('0x11')]=function(_0x3fb849){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x11c'),_0x3fb849[_0xe765('0xb6')]));return this['getdigits'](_0x3fb849);};AGIVertices['prototype'][_0xe765('0x11d')]=function(_0x2d110a){logger[_0xe765('0x2e')](util['format'](_0xe765('0x11e'),_0x2d110a['label']));this[_0xe765('0x36')][_0xe765('0x71')](this,_0x2d110a,_0x2d110a[_0xe765('0x11f')]);return this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x120'),_0x2d110a[_0xe765('0x11f')]));};AGIVertices[_0xe765('0x14')][_0xe765('0x121')]=function(_0x428234){logger['info'](util[_0xe765('0x29')](_0xe765('0x122'),_0x428234[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0x428234[_0xe765('0x84')])||!this[_0xe765('0x81')](_0x428234[_0xe765('0x85')])){return this[_0xe765('0x12')]['noop'](_0xe765('0x123'));}if(!this[_0xe765('0x81')](_0x428234[_0xe765('0x5b')])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0xa7'));}this[_0xe765('0x12')]['noop'](util[_0xe765('0x29')](_0xe765('0x124'),_0x428234[_0xe765('0x5b')]));var _0x1de756=this[_0xe765('0x83')][_0xe765('0x71')](this,_0x428234);if(_0x1de756){this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x125'),_0x1de756));var _0xe8a8a3=this['channel'][_0xe765('0x100')](_0x1de756);try{fs[_0xe765('0x126')](_0x1de756+'.wav');}catch(_0x1ff7c6){logger[_0xe765('0x2c')](_0x1ff7c6);}return _0xe8a8a3;}return this[_0xe765('0x12')][_0xe765('0x2c')](_0x428234,_0xe765('0x127'));};AGIVertices['prototype'][_0xe765('0x128')]=function(_0x544b7e){logger['info'](util['format'](_0xe765('0x129'),_0x544b7e[_0xe765('0xb6')]));if(!this['isConfigured'](_0x544b7e[_0xe765('0x84')])||!this[_0xe765('0x81')](_0x544b7e[_0xe765('0x85')])){return this['channel'][_0xe765('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xe765('0x81')](_0x544b7e[_0xe765('0x8a')])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0x12a'));}if(!this[_0xe765('0x81')](_0x544b7e[_0xe765('0x5b')])){return this['channel'][_0xe765('0xa6')](_0xe765('0xa7'));}this[_0xe765('0x12')][_0xe765('0xf1')]=!![];this['createSquareDetailsReport'](_0x544b7e);this['createSquareMessage'](_0x544b7e['text'],'in','','');this['channel'][_0xe765('0xa6')](util['format'](_0xe765('0x12b'),_0x544b7e[_0xe765('0x5b')]));var _0x3939a2=this['awsLex'][_0xe765('0x71')](this,_0x544b7e);if(_0x3939a2){for(var _0x5be912 in _0x3939a2){if(_0x3939a2[_0xe765('0x91')](_0x5be912)&&_[_0xe765('0x92')](_0x3939a2[_0x5be912])){this[_0xe765('0x12')][_0xe765('0x9b')](util[_0xe765('0x29')]('AWS_LEX_%s',_0x5be912[_0xe765('0x6a')]()),_0x3939a2[_0x5be912]);}}if(_['isNil'](_0x3939a2[_0xe765('0x76')])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0x12c'));}else{this[_0xe765('0x40')](_0x3939a2[_0xe765('0x76')],_0xe765('0xe9'),'amazonlex','');return this['channel'][_0xe765('0xa6')](util[_0xe765('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x3939a2[_0xe765('0x76')]));}}return this[_0xe765('0x12')][_0xe765('0x2c')](_0x544b7e,_0xe765('0x12d'));};AGIVertices['prototype'][_0xe765('0x12e')]=function(_0x10f25c){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x12f'),_0x10f25c[_0xe765('0xb6')],_0x10f25c[_0xe765('0xb7')]));if(!this['isConfigured'](_0x10f25c[_0xe765('0x79')])){return this[_0xe765('0x12')][_0xe765('0xa6')]('no\x20key\x20configured');}var _0x5e967d=_0xe765('0x130');var _0x135bfd=util[_0xe765('0x29')](_0xe765('0x131'),FILES_PATH,rs[_0xe765('0x132')](0x4));var _0x36a752=util[_0xe765('0x29')](_0xe765('0x9a'),_0x135bfd,_0x5e967d);var _0x5c575a=!![];if(_0x10f25c['beep']===_0xe765('0x133')){_0x5c575a=![];}var _0x75e3b3=this[_0xe765('0x12')][_0xe765('0x134')](_0x135bfd,_0x5e967d,_0x10f25c[_0xe765('0x135')],_0x10f25c[_0xe765('0xb7')],undefined,_0x5c575a);if(_0x75e3b3['result']!==-0x1){this[_0xe765('0x12')][_0xe765('0xa6')](util['format'](_0xe765('0x136'),_0x36a752));var _0x195105=this[_0xe765('0x8b')][_0xe765('0x71')](this,_0x10f25c,_0x36a752);if(_0x195105){for(var _0x2aacb9 in _0x195105){if(_0x195105[_0xe765('0x91')](_0x2aacb9)){this[_0xe765('0x12')][_0xe765('0x9b')](util['format']('GOOGLE_ASR_%s',_0x2aacb9['toUpperCase']()),_0x195105[_0x2aacb9]);}}return this['channel']['noop'](util[_0xe765('0x29')](_0xe765('0x137'),JSON['stringify'](_0x195105)));}}return _0x75e3b3;};AGIVertices[_0xe765('0x14')][_0xe765('0x138')]=function(_0x1c4400){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x139'),_0x1c4400[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0x1c4400[_0xe765('0x8d')])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0x13a'));}if(!this[_0xe765('0x81')](_0x1c4400['appsecret'])){return this['channel'][_0xe765('0xa6')](_0xe765('0x13b'));}var _0x4dece1='wav';var _0x4e48fb=util[_0xe765('0x29')](_0xe765('0x131'),FILES_PATH,rs['generate'](0x4));var _0x518985=util[_0xe765('0x29')](_0xe765('0x9a'),_0x4e48fb,_0x4dece1);var _0x31c272=!![];if(_0x1c4400[_0xe765('0x13c')]===_0xe765('0x133')){_0x31c272=![];}var _0x57dc7e=this['channel'][_0xe765('0x134')](_0x4e48fb,_0x4dece1,_0x1c4400[_0xe765('0x135')],_0x1c4400[_0xe765('0xb7')],undefined,_0x31c272);if(_0x57dc7e[_0xe765('0xa0')]!==-0x1){this[_0xe765('0x12')]['noop'](util['format'](_0xe765('0x13d'),_0x518985));var _0x44a87c=this[_0xe765('0x8c')][_0xe765('0x71')](this,_0x1c4400,_0x518985);if(_0x44a87c){for(var _0x56ae85 in _0x44a87c){if(_0x44a87c['hasOwnProperty'](_0x56ae85)){this[_0xe765('0x12')]['setVariable'](util[_0xe765('0x29')](_0xe765('0x13e'),_0x56ae85['toUpperCase']()),_0x44a87c[_0x56ae85]);}}return this['channel'][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x13f'),JSON[_0xe765('0x73')](_0x44a87c)));}}return _0x57dc7e;};AGIVertices[_0xe765('0x14')][_0xe765('0x140')]=function(_0x95a8e4){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x141'),_0x95a8e4[_0xe765('0xb6')]));return this['channel'][_0xe765('0x142')](_0x95a8e4[_0xe765('0x143')],_0x95a8e4[_0xe765('0x3d')],_0x95a8e4[_0xe765('0x3e')]);};AGIVertices[_0xe765('0x14')][_0xe765('0x144')]=function(_0x267543){logger['info'](util[_0xe765('0x29')](_0xe765('0x145'),_0x267543[_0xe765('0xb6')]));if(!this['isConfigured'](_0x267543[_0xe765('0x146')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x267543,'no\x20condition\x20configured');}try{var _0x86429e=eval(_0x267543['condition'])?_0xe765('0x147'):_0xe765('0x148');this['channel']['noop'](util[_0xe765('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x267543['condition'],_0x86429e));return{'code':0xc8,'result':_0x86429e};}catch(_0x36b4f1){return{'code':0xc8,'result':_0xe765('0x148')};}};AGIVertices[_0xe765('0x14')]['gotoiftime']=function(_0x349cb1){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x149'),_0x349cb1[_0xe765('0xb6')]));if(!this['isConfigured'](_0x349cb1['interval_id'])){return this['channel'][_0xe765('0x2c')](_0x349cb1,'no\x20interval\x20configured');}var _0x5e9391=this[_0xe765('0x14a')]['sync'](this,_0x349cb1[_0xe765('0x14b')]);if(!_0x5e9391){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x349cb1,_0xe765('0x14c'));}for(var _0x154082=0x0;_0x154082<_0x5e9391[_0xe765('0x98')];_0x154082+=0x1){var _0x889b28=this[_0xe765('0x12')][_0xe765('0x15')](util[_0xe765('0x29')]('IFTIME(%s?true:false)',_0x5e9391[_0x154082]));if(_0x889b28['result']===-0x1){return _0x889b28;}logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x14d'),_0x5e9391[_0x154082],_0x889b28['extra']));if(_0x889b28[_0xe765('0x9e')]===_0xe765('0x147')){logger[_0xe765('0x2e')](util['format'](_0xe765('0x14d'),_0x5e9391[_0x154082],_0xe765('0x147')));this[_0xe765('0x12')]['noop'](util['format'](_0xe765('0x14d'),_0x5e9391[_0x154082],_0xe765('0x147')));return{'code':0xc8,'result':'true'};}else{logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x14d'),_0x5e9391[_0x154082],'false'));this[_0xe765('0x12')]['noop'](util[_0xe765('0x29')](_0xe765('0x14d'),_0x5e9391[_0x154082],_0xe765('0x148')));}}return{'code':0xc8,'result':_0xe765('0x148')};};AGIVertices[_0xe765('0x14')][_0xe765('0x14e')]=function(_0xce6842){logger[_0xe765('0x2e')](util['format'](_0xe765('0x14f'),_0xce6842[_0xe765('0xb6')]));return this[_0xe765('0x12')][_0xe765('0x14e')]();};AGIVertices[_0xe765('0x14')]['ispeechasr']=function(_0x772643){logger[_0xe765('0x2e')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x772643['label']));if(!this[_0xe765('0x81')](_0x772643['key'])){return this[_0xe765('0x12')][_0xe765('0xa6')]('no\x20key\x20configured');}var _0x5c47e6=_0xe765('0x130');var _0x3d324a=util[_0xe765('0x29')](_0xe765('0x131'),FILES_PATH,rs['generate'](0x4));var _0x24f179=util[_0xe765('0x29')](_0xe765('0x9a'),_0x3d324a,_0x5c47e6);var _0x3e93df=!![];if(_0x772643[_0xe765('0x13c')]===_0xe765('0x133')){_0x3e93df=![];}var _0x5a3643=this['channel'][_0xe765('0x134')](_0x3d324a,_0x5c47e6,_0x772643['intKey'],_0x772643[_0xe765('0xb7')],undefined,_0x3e93df);if(_0x5a3643[_0xe765('0xa0')]!==-0x1){this['channel'][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x150'),_0x24f179));var _0x2c6af5=this[_0xe765('0x151')][_0xe765('0x71')](this,_0x772643,_0x24f179);if(_0x2c6af5){for(var _0x15c3c7 in _0x2c6af5){if(_0x2c6af5[_0xe765('0x91')](_0x15c3c7)){this['channel'][_0xe765('0x9b')](util[_0xe765('0x29')](_0xe765('0x152'),_0x15c3c7[_0xe765('0x6a')]()),_0x2c6af5[_0x15c3c7]);}}return this['channel'][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x153'),JSON[_0xe765('0x73')](_0x2c6af5)));}}return _0x5a3643;};AGIVertices['prototype'][_0xe765('0x154')]=function(_0x15181d){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x155'),_0x15181d[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0x15181d[_0xe765('0x79')])){return this[_0xe765('0x12')][_0xe765('0xa6')]('no\x20key\x20configured');}if(!this[_0xe765('0x81')](_0x15181d[_0xe765('0x5b')])){return this['channel']['noop'](_0xe765('0xa7'));}this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x156'),_0x15181d[_0xe765('0x5b')]));var _0xa7731d=this[_0xe765('0x80')][_0xe765('0x71')](this,_0x15181d);if(_0xa7731d){this['channel'][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x150'),_0xa7731d));var _0x4c611c=this[_0xe765('0x12')][_0xe765('0x100')](_0xa7731d,_0x15181d[_0xe765('0x135')]);try{fs[_0xe765('0x126')](_0xa7731d+'.wav');}catch(_0x26b70d){logger[_0xe765('0x2c')](_0x26b70d);}return _0x4c611c;}return this[_0xe765('0x12')][_0xe765('0x2c')](_0x15181d,_0xe765('0x157'));};AGIVertices[_0xe765('0x14')][_0xe765('0x158')]=function(_0x5f2a29){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x159'),_0x5f2a29['label']));if(!this[_0xe765('0x81')](_0x5f2a29[_0xe765('0x15a')])){return this['channel'][_0xe765('0x2c')](_0x5f2a29,_0xe765('0x15b'));}logger['info'](util[_0xe765('0x29')](_0xe765('0x15c'),this[_0xe765('0x12')][_0xe765('0x3a')],_0x5f2a29[_0xe765('0x15a')]));var _0x5b76a5=this[_0xe765('0x52')][_0xe765('0x71')](this,_0x5f2a29[_0xe765('0x15a')]);if(_0x5b76a5){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xe765('0x12')][_0xe765('0x3a')],_0x5f2a29[_0xe765('0x15a')]));this[_0xe765('0x12')][_0xe765('0xa6')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xe765('0x3a')],_0x5f2a29[_0xe765('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe765('0x2e')](util[_0xe765('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe765('0x12')][_0xe765('0x3a')],_0x5f2a29[_0xe765('0x15a')]));this[_0xe765('0x12')][_0xe765('0xa6')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe765('0x12')][_0xe765('0x3a')],_0x5f2a29[_0xe765('0x15a')]));return{'code':0xc8,'result':_0xe765('0x15d')};}};AGIVertices['prototype'][_0xe765('0x15e')]=function(_0x5aff0c){logger[_0xe765('0x2e')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x5aff0c[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0x5aff0c[_0xe765('0x15a')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x5aff0c,'no\x20find\x20by\x20configured');}logger[_0xe765('0x2e')](util['format'](_0xe765('0x15c'),this[_0xe765('0x12')]['callerid'],_0x5aff0c['findBy']));var _0x163731=this['agentLogout'][_0xe765('0x71')](this,_0x5aff0c[_0xe765('0x15a')]);if(_0x163731){logger[_0xe765('0x2e')](util['format'](_0xe765('0x15f'),this[_0xe765('0x12')][_0xe765('0x3a')],_0x5aff0c[_0xe765('0x15a')]));this[_0xe765('0x12')][_0xe765('0xa6')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xe765('0x12')][_0xe765('0x3a')],_0x5aff0c['findBy']));return{'code':0xc8,'result':_0xe765('0x160')};}else{logger[_0xe765('0x2e')](util[_0xe765('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe765('0x12')][_0xe765('0x3a')],_0x5aff0c[_0xe765('0x15a')]));this[_0xe765('0x12')]['noop'](util['format'](_0xe765('0x161'),this[_0xe765('0x12')][_0xe765('0x3a')],_0x5aff0c[_0xe765('0x15a')]));return{'code':0xc8,'result':_0xe765('0x15d')};}};AGIVertices['prototype']['math']=function(_0x2928c2){logger['info'](util['format'](_0xe765('0x162'),_0x2928c2['label']));if(!this[_0xe765('0x81')](_0x2928c2['operation'])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x2928c2,_0xe765('0x163'));}this['channel'][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x164'),_0x2928c2[_0xe765('0x165')]));var _0x2692bc=eval(_0x2928c2['operation']);if(!this[_0xe765('0x81')](_0x2928c2[_0xe765('0x113')])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0xd7'));}var _0x209255=this['getVariable']['sync'](this,_0x2928c2[_0xe765('0x113')]);if(!_0x209255){return this['channel'][_0xe765('0x2c')](_0x2928c2,'no\x20variable\x20found');}if(_['isArray'](_0x2692bc)){var _0x1dc5fb=this;_0x2692bc[_0xe765('0xd9')](function(_0x5885cc,_0x44c204){_0x1dc5fb['channel'][_0xe765('0x9b')](util[_0xe765('0x29')]('%s[%s]',_0x209255,_0x44c204),_0x5885cc);});return this[_0xe765('0x12')]['noop'](util['format'](_0xe765('0x166'),_0x209255));}else{return this[_0xe765('0x12')][_0xe765('0x9b')](_0x209255,_0x2692bc);}};AGIVertices[_0xe765('0x14')][_0xe765('0xf')]=function(_0x3d6b91){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x167'),_0x3d6b91['label']));if(_0x3d6b91[_0xe765('0xa3')]===0x0){return this['maxRetry'](_0x3d6b91);}_0x3d6b91['retry']-=0x1;if(!this['isConfigured'](_0x3d6b91['file_id'])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x3d6b91,_0xe765('0x111'));}var _0x153213=this[_0xe765('0x20')][_0xe765('0x71')](this,_0x3d6b91['file_id']);if(!_0x153213){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x3d6b91,_0xe765('0x112'));}var _0x259424=this[_0xe765('0x12')]['getData'](_0x153213,_0x3d6b91[_0xe765('0x115')],_0x3d6b91[_0xe765('0x168')]);var _0x1e9d29=_0x259424[_0xe765('0xa0')];if(_0x259424['result']===-0x1){this[_0xe765('0x36')][_0xe765('0x71')](this,_0x3d6b91,'-1');return _0x259424;}else if(_0x259424[_0xe765('0x9e')]==='timeout'){_0x259424[_0xe765('0xa0')]=_0x259424[_0xe765('0xa0')][_0xe765('0x98')]>0x0?_0x259424['result']:'t';}else if(_['isEmpty'](_0x259424[_0xe765('0xa0')])){_0x259424[_0xe765('0xa0')]='#';_0x1e9d29='#';}if(!this['isConfigured'](_0x3d6b91[_0xe765('0x113')])){this[_0xe765('0x12')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x3d7886=this[_0xe765('0x15')][_0xe765('0x71')](this,_0x3d6b91[_0xe765('0x113')]);if(!_0x3d7886){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x3d6b91,_0xe765('0xd8'));}this['channel'][_0xe765('0x9b')](_0x3d7886,_0x1e9d29);}this[_0xe765('0x36')][_0xe765('0x71')](this,_0x3d6b91,_0x1e9d29);return _0x259424;};AGIVertices[_0xe765('0x14')]['noop']=function(_0x1d3c78){logger[_0xe765('0x2e')](util[_0xe765('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x1d3c78['label']));return this[_0xe765('0x12')][_0xe765('0xa6')](_0x1d3c78[_0xe765('0x169')]||_0x1d3c78[_0xe765('0xb6')]);};AGIVertices[_0xe765('0x14')]['pause']=function(_0x1f2c07){logger['info'](util[_0xe765('0x29')](_0xe765('0x16a'),_0x1f2c07['label']));if(!this['isConfigured'](_0x1f2c07[_0xe765('0x15a')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x1f2c07,_0xe765('0x15b'));}logger[_0xe765('0x2e')](util[_0xe765('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe765('0x12')]['callerid'],_0x1f2c07[_0xe765('0x15a')]));var _0x21ac91=this['getPause'][_0xe765('0x71')](this,_0x1f2c07['pause_id']);var _0x137ed7=this[_0xe765('0x4e')][_0xe765('0x71')](this,_0x1f2c07[_0xe765('0x15a')],_0x21ac91);if(_0x137ed7){logger['info'](util['format'](_0xe765('0x15f'),this[_0xe765('0x12')][_0xe765('0x3a')],_0x1f2c07[_0xe765('0x15a')]));this['channel'][_0xe765('0xa6')](util['format'](_0xe765('0x15f'),this[_0xe765('0x12')]['callerid'],_0x1f2c07[_0xe765('0x15a')]));return{'code':0xc8,'result':_0xe765('0x160')};}else{logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x161'),this[_0xe765('0x12')][_0xe765('0x3a')],_0x1f2c07[_0xe765('0x15a')]));this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x15f'),this[_0xe765('0x12')]['callerid'],_0x1f2c07['findBy']));return{'code':0xc8,'result':_0xe765('0x15d')};}};AGIVertices[_0xe765('0x14')][_0xe765('0x16b')]=function(_0x3bb8b8){logger['info'](util[_0xe765('0x29')](_0xe765('0x16c'),_0x3bb8b8[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0x3bb8b8[_0xe765('0x110')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x3bb8b8,_0xe765('0x111'));}var _0x5855c5=this[_0xe765('0x20')]['sync'](this,_0x3bb8b8[_0xe765('0x110')]);if(!_0x5855c5){return this[_0xe765('0x12')]['error'](_0x3bb8b8,'no\x20file\x20audio\x20found');}var _0x39c472=this[_0xe765('0x12')][_0xe765('0x56')](_0xe765('0x16d'),[_0x5855c5,_0x3bb8b8['opts']]);if(_0x39c472[_0xe765('0xa0')]===-0x1){return _0x39c472;}return this['channel'][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0xc2'),'PLAYBACK',_0x5855c5));};AGIVertices[_0xe765('0x14')][_0xe765('0x16e')]=function(_0xc3ff86){logger[_0xe765('0x2e')](util['format'](_0xe765('0x16f'),_0xc3ff86[_0xe765('0xb6')]));if(!this['isConfigured'](_0xc3ff86[_0xe765('0x170')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0xc3ff86,_0xe765('0x171'));}var _0x1a5df7='';var _0x286fe4=parseInt(_0xc3ff86[_0xe765('0x170')],0xa);if(isNaN(_0x286fe4)){_0x1a5df7=_0xc3ff86['queue_id'];}else{_0x1a5df7=this[_0xe765('0x172')][_0xe765('0x71')](this,_0xc3ff86[_0xe765('0x170')]);if(!_0x1a5df7){return this[_0xe765('0x12')][_0xe765('0x2c')](_0xc3ff86,_0xe765('0x173'));}}var _0x317688='';if(this[_0xe765('0x81')](_0xc3ff86[_0xe765('0x110')])){var _0x88b63c=this['getSound'][_0xe765('0x71')](this,_0xc3ff86['file_id']);if(_0x88b63c){_0x317688=_0x88b63c;}}this[_0xe765('0x36')][_0xe765('0x71')](this,_0xc3ff86,_0x1a5df7);if(_0xc3ff86[_0xe765('0x10c')][_0xe765('0x174')]('x')<0x0){_0xc3ff86[_0xe765('0x10c')]+='x';}if(_0xc3ff86[_0xe765('0x10c')][_0xe765('0x174')]('X')<0x0){_0xc3ff86[_0xe765('0x10c')]+='X';}this[_0xe765('0x12')]['setVariable'](_0xe765('0x175'),_0x1a5df7?_0x1a5df7[_0xe765('0x176')]():'');var _0x49a288=this[_0xe765('0x12')][_0xe765('0x56')](_0xe765('0x177'),[_0x1a5df7,_0xc3ff86['opts'],_0xc3ff86['url'],_0x317688,_0xc3ff86['timeout'],_0xc3ff86[_0xe765('0x9')],_0xc3ff86['macro'],_0xc3ff86[_0xe765('0x178')],'',_0xc3ff86['position']]);if(_0x49a288['result']===-0x1){return _0x49a288;}return this['channel'][_0xe765('0xa6')](util['format'](_0xe765('0xc2'),_0xe765('0x177'),_0x1a5df7));};AGIVertices[_0xe765('0x14')][_0xe765('0x179')]=function(_0x5adf1d){logger[_0xe765('0x2e')](util[_0xe765('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x5adf1d[_0xe765('0xb6')]));var _0x1937f7=_0x5adf1d[_0xe765('0x17a')]||'wav';var _0x42ee6f=util[_0xe765('0x29')](_0xe765('0x17b'),this['channel'][_0xe765('0x37')],rs[_0xe765('0x132')](0x5));var _0x328697=util[_0xe765('0x29')](_0xe765('0x17c'),FILES_PATH,_0x42ee6f,_0x1937f7);var _0x35a558=util[_0xe765('0x29')](_0xe765('0x131'),FILES_PATH,_0x42ee6f);this['createSquareRecording'][_0xe765('0x71')](this,_0x5adf1d,_0x42ee6f,_0x328697);this['channel']['setVariable'](_0xe765('0x17d'),_0x42ee6f);logger[_0xe765('0x2e')](_0xe765('0x17e'),_0x35a558,_0x1937f7,_0x5adf1d[_0xe765('0x17f')],_0x5adf1d['timeout']);return this['channel']['recordFile'](_0x35a558,_0x1937f7,_0x5adf1d['escape_digits'],_0x5adf1d[_0xe765('0xb7')],undefined,!![]);};AGIVertices[_0xe765('0x14')][_0xe765('0x180')]=function(_0x2a2e96){logger[_0xe765('0x2e')](util['format'](_0xe765('0x181'),_0x2a2e96[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0x2a2e96[_0xe765('0x65')])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0x182'));}var _0x4e2253=this[_0xe765('0x64')]['sync'](this,_0x2a2e96);logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x183'),util[_0xe765('0x184')](_0x4e2253,{'showHidden':![],'depth':null})));if(!this[_0xe765('0x81')](_0x2a2e96[_0xe765('0x113')])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0x185'));}var _0x5b4585=this[_0xe765('0x15')]['sync'](this,_0x2a2e96[_0xe765('0x113')]);if(!_0x5b4585){return this['channel'][_0xe765('0x2c')](_0x2a2e96,_0xe765('0xd8'));}this[_0xe765('0x12')]['setVariable'](util[_0xe765('0x29')](_0xe765('0x186'),_0x5b4585),_0x4e2253['statusCode']?_0x4e2253[_0xe765('0x75')]:_0xe765('0x187'));this[_0xe765('0x12')][_0xe765('0x9b')](util[_0xe765('0x29')](_0xe765('0x188'),_0x5b4585),_0x4e2253[_0xe765('0x189')]?_0x4e2253[_0xe765('0x189')]:'OK');if(_0x4e2253[_0xe765('0x74')]){try{this[_0xe765('0x99')](_0x4e2253[_0xe765('0x74')],_0x5b4585);}catch(_0x331961){logger['error'](util[_0xe765('0x29')](_0xe765('0x18a'),_0x5b4585));}}return this[_0xe765('0x12')][_0xe765('0xa6')](util['format'](_0xe765('0xdc'),_0x5b4585));};AGIVertices[_0xe765('0x14')][_0xe765('0x18b')]=function(_0x121b9f){logger['info'](util[_0xe765('0x29')](_0xe765('0x18c'),_0x121b9f[_0xe765('0xb6')]));return this[_0xe765('0x12')][_0xe765('0x18d')](_0x121b9f[_0xe765('0x18e')][_0xe765('0x58')](/\s+/g,''),_0x121b9f[_0xe765('0x17f')]);};AGIVertices['prototype']['saynumber']=function(_0x40bb69){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x18f'),_0x40bb69['label']));return this[_0xe765('0x12')][_0xe765('0x190')](_0x40bb69[_0xe765('0x191')][_0xe765('0x58')](/\s+/g,''),_0x40bb69[_0xe765('0x17f')]);};AGIVertices[_0xe765('0x14')][_0xe765('0x192')]=function(_0x2c6482){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x193'),_0x2c6482[_0xe765('0xb6')]));return this[_0xe765('0x12')][_0xe765('0x194')](_0x2c6482[_0xe765('0x5b')],_0x2c6482['escape_digits']);};AGIVertices[_0xe765('0x14')]['sendMail']=function(_0xbd5a63){logger[_0xe765('0x2e')](util[_0xe765('0x29')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0xbd5a63[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0xbd5a63[_0xe765('0x195')])){return this['channel'][_0xe765('0xa6')](_0xe765('0x196'));}var _0x57e82c=this[_0xe765('0x24')]['sync'](this,_0xbd5a63['account_id']);if(!_0x57e82c||!_0x57e82c['Smtp']){return this[_0xe765('0x12')][_0xe765('0x2c')](_0xbd5a63,_0xe765('0x197'));}var _0x79d729={'from':util[_0xe765('0x29')]('\x22%s\x22\x20<%s>',_0x57e82c['name'],_0x57e82c['email']||_0x57e82c[_0xe765('0x198')][_0xe765('0x199')]),'to':_0xbd5a63['to']||'','cc':_0xbd5a63['cc']||'','bcc':_0xbd5a63[_0xe765('0x19a')]||'','subject':_0xbd5a63['subject'],'html':_0xbd5a63[_0xe765('0x5b')],'text':_0xbd5a63['text']};if(this[_0xe765('0x81')](_0xbd5a63[_0xe765('0x19b')])){}logger[_0xe765('0xdd')]('sendMail\x20message',JSON[_0xe765('0x73')](_0x79d729));this[_0xe765('0x36')][_0xe765('0x71')](this,_0xbd5a63,_0xbd5a63[_0xe765('0x195')]);this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x19c'),_0x57e82c[_0xe765('0x16')]));this[_0xe765('0x25')][_0xe765('0x71')](this,_0x57e82c[_0xe765('0x19d')],_0x79d729);return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0x19e'));};AGIVertices[_0xe765('0x14')][_0xe765('0x19f')]=function(_0x50f3b8){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x1a0'),_0x50f3b8[_0xe765('0xb6')]));return this[_0xe765('0x12')][_0xe765('0xa6')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xe765('0x14')][_0xe765('0x1a1')]=function(_0x266bfb){logger[_0xe765('0x2e')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x266bfb[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0x266bfb['sms_account_id'])){return this['channel'][_0xe765('0xa6')](_0xe765('0x1a2'));}var _0x49491a=this[_0xe765('0x34')][_0xe765('0x71')](this,_0x266bfb[_0xe765('0x1a3')]);if(!_0x49491a){return this['channel']['error'](_0x266bfb,_0xe765('0x1a4'));}var _0x2eeb72={'body':_0x266bfb[_0xe765('0x1a5')],'phone':_0x266bfb['to']||'','SmsAccountId':_0x49491a['id']};logger['debug'](_0xe765('0x1a6'),JSON['stringify'](_0x2eeb72));this['createSquareDetailsReport'][_0xe765('0x71')](this,_0x266bfb,_0x266bfb[_0xe765('0x1a3')]);this[_0xe765('0x12')]['noop'](util[_0xe765('0x29')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x49491a['name']));this[_0xe765('0x35')][_0xe765('0x71')](this,_0x2eeb72);return this['channel'][_0xe765('0xa6')](_0xe765('0x1a7'));};AGIVertices['prototype'][_0xe765('0x1a8')]=function(_0x1819fe){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x1a9'),_0x1819fe[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0x1819fe[_0xe765('0x113')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x1819fe,'no\x20variable\x20selected');}var _0x2bc7a4=this['getVariable'][_0xe765('0x71')](this,_0x1819fe[_0xe765('0x113')]);if(!_0x2bc7a4){return this[_0xe765('0x12')]['error'](_0x1819fe,'no\x20variable\x20found');}return this['channel'][_0xe765('0x9b')](_0x2bc7a4,_0x1819fe[_0xe765('0x1aa')]);};AGIVertices[_0xe765('0x14')][_0xe765('0x1ab')]=function(_0x3f6105){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x1ac'),_0x3f6105['label']));this[_0xe765('0x12')]['noop'](_0xe765('0x1ad'));if(_0x3f6105[_0xe765('0xba')]===_0xe765('0x1ae')){this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0x1af'));return this[_0xe765('0x12')][_0xe765('0xba')]();}return this[_0xe765('0x12')]['noop'](_0xe765('0x1b0'));};AGIVertices[_0xe765('0x14')][_0xe765('0x1b1')]=function(_0x2e5e99){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x1b2'),_0x2e5e99['label']));if(!this['isConfigured'](_0x2e5e99[_0xe765('0x1b3')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x2e5e99,_0xe765('0x1b4'));}var _0x8ed111=this[_0xe765('0x1b5')][_0xe765('0x71')](this,_0x2e5e99['project_id']);if(!this[_0xe765('0x81')](_0x8ed111)){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x2e5e99,util[_0xe765('0x29')](_0xe765('0x1b6'),_0x2e5e99['project_id']));}if(_0x8ed111===this[_0xe765('0x12')][_0xe765('0x39')]){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x2e5e99,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x2e5e99,_0x8ed111);var _0x3661c5=this[_0xe765('0x12')][_0xe765('0x56')]('AGI',util['format'](_0xe765('0x1b7'),config[_0xe765('0x9')][_0xe765('0x1b8')]||_0xe765('0x1b9'),_0x8ed111,this['channel'][_0xe765('0x39')]));if(_0x3661c5[_0xe765('0xa0')]===-0x1){return _0x3661c5;}return this['channel'][_0xe765('0xa6')](util[_0xe765('0x29')]('Executed\x20command\x20%s\x20%s',_0xe765('0x1ba'),_0x8ed111));};AGIVertices[_0xe765('0x14')]['system']=function(_0x15dfce){logger[_0xe765('0x2e')](util[_0xe765('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x15dfce['label']));var _0x3e4eeb=this['shellCommand'][_0xe765('0x71')](this,_0x15dfce['command']);this[_0xe765('0x36')]['sync'](this,_0x15dfce,_0x15dfce[_0xe765('0xb5')]);if(this[_0xe765('0x81')](_0x15dfce['variable_id'])){var _0x245119=this[_0xe765('0x15')][_0xe765('0x71')](this,_0x15dfce['variable_id']);if(_0x245119){this[_0xe765('0x12')][_0xe765('0x9b')](_0x245119,_0x3e4eeb);return this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x1bb'),_0x15dfce[_0xe765('0xb5')],_0x245119));}}return this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x15dfce[_0xe765('0xb5')]));};AGIVertices['prototype'][_0xe765('0x1bc')]=function(_0x26b744){logger['info'](util[_0xe765('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x26b744[_0xe765('0xb6')]));_0x26b744[_0xe765('0x5b')]=_0x26b744[_0xe765('0x5b')][_0xe765('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x26b744[_0xe765('0x59')])){return this[_0xe765('0x12')]['noop']('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x26b744[_0xe765('0x5b')])){return this[_0xe765('0x12')][_0xe765('0xa6')](_0xe765('0xa7'));}this[_0xe765('0x12')][_0xe765('0xa6')](util['format'](_0xe765('0x1bd'),_0x26b744[_0xe765('0x5b')]));var _0x5608ab=this[_0xe765('0x1be')]['sync'](this,_0x26b744);if(_0x5608ab){this['channel'][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x1bf'),_0x5608ab));var _0x599d9e=this['channel'][_0xe765('0x100')](_0x5608ab);try{fs['unlink'](_0x5608ab+'.wav');}catch(_0x1a8ba7){logger[_0xe765('0x2c')](_0x1a8ba7);}return _0x599d9e;}return this[_0xe765('0x12')][_0xe765('0x2c')](_0x26b744,_0xe765('0x1c0'));};AGIVertices[_0xe765('0x14')][_0xe765('0x1c1')]=function(_0x2fe45f){logger[_0xe765('0x2e')](util[_0xe765('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2fe45f['label']));_0x2fe45f[_0xe765('0x5b')]=_0x2fe45f['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2fe45f[_0xe765('0x5b')])){return this['channel'][_0xe765('0xa6')](_0xe765('0xa7'));}this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x1c2'),_0x2fe45f[_0xe765('0x5b')]));var _0x3d48a0=this[_0xe765('0x62')][_0xe765('0x71')](this,_0x2fe45f);if(_0x3d48a0){this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x1c3'),_0x3d48a0));var _0x29071b=this[_0xe765('0x12')][_0xe765('0x100')](_0x3d48a0);try{fs[_0xe765('0x126')](_0x3d48a0+_0xe765('0x1c4'));}catch(_0x2ac4ce){logger[_0xe765('0x2c')](_0x2ac4ce);}return _0x29071b;}return this['channel']['error'](_0x2fe45f,_0xe765('0x1c5'));};AGIVertices['prototype'][_0xe765('0x1c6')]=function(_0x1ea2f8){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x1c7'),_0x1ea2f8[_0xe765('0xb6')]));if(!this['isConfigured'](_0x1ea2f8[_0xe765('0x15a')])){return this[_0xe765('0x12')][_0xe765('0x2c')](_0x1ea2f8,_0xe765('0x15b'));}logger[_0xe765('0x2e')](util[_0xe765('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe765('0x12')][_0xe765('0x3a')],_0x1ea2f8['findBy']));var _0x5368f0=this[_0xe765('0x4f')][_0xe765('0x71')](this,_0x1ea2f8['findBy']);if(_0x5368f0){logger[_0xe765('0x2e')](util['format'](_0xe765('0x15f'),this[_0xe765('0x12')][_0xe765('0x3a')],_0x1ea2f8[_0xe765('0x15a')]));this[_0xe765('0x12')]['noop'](util[_0xe765('0x29')](_0xe765('0x15f'),this['channel'][_0xe765('0x3a')],_0x1ea2f8[_0xe765('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xe765('0x29')](_0xe765('0x161'),this[_0xe765('0x12')][_0xe765('0x3a')],_0x1ea2f8[_0xe765('0x15a')]));this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0x161'),this['channel'][_0xe765('0x3a')],_0x1ea2f8[_0xe765('0x15a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xe765('0x14')][_0xe765('0x1c8')]=function(_0x1777c8){logger[_0xe765('0x2e')](util[_0xe765('0x29')](_0xe765('0x1c9'),_0x1777c8[_0xe765('0xb6')]));var _0x5f0055=this[_0xe765('0x12')][_0xe765('0x56')]('VOICEMAIL',[_0x1777c8[_0xe765('0x1ca')],_0x1777c8['options']]);if(_0x5f0055['result']===-0x1){return _0x5f0055;}return this[_0xe765('0x12')][_0xe765('0xa6')](util[_0xe765('0x29')](_0xe765('0xc2'),'VOICEMAIL',_0x1777c8['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x411a31){logger['info'](util[_0xe765('0x29')](_0xe765('0x1cb'),_0x411a31[_0xe765('0xb6')]));if(!this[_0xe765('0x81')](_0x411a31[_0xe765('0x113')])){return this['channel']['error'](_0x411a31,_0xe765('0x1cc'));}var _0x48f11e=this[_0xe765('0x15')]['sync'](this,_0x411a31[_0xe765('0x113')]);if(!_0x48f11e){return this['channel'][_0xe765('0x2c')](_0x411a31,_0xe765('0xd8'));}var _0x295cbf=this[_0xe765('0x12')][_0xe765('0x15')](_0x48f11e);return{'code':0xc8,'result':_0x295cbf[_0xe765('0x9e')]?_0x295cbf[_0xe765('0x9e')]:'-'};};String[_0xe765('0x14')][_0xe765('0x9d')]=function(_0x3e9cc8,_0xc07e4a){return this[_0xe765('0x9c')](_0x3e9cc8)[_0xe765('0x1cd')](_0xc07e4a);};module[_0xe765('0x1ce')]=AGIVertices; \ No newline at end of file +var _0xc94f=['sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getData','response','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','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','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','shellCommand','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','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','no\x20variable\x20selected','join','exports','util','shelljs','odbc','moment','request-promise','../../config/logger','agi','../../config/environment','rawHeaders','rawBody','getdigits','channel','prototype','getVariable','rpc','getVariableById','name','catch','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','scheduledAt','uniqueid','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','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','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','clone','isString','includes','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','saveRestApiResult','length','%s.%s','replaceObjectAllVariables','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable'];(function(_0x489bd1,_0x3b51a3){var _0x207d40=function(_0x38992c){while(--_0x38992c){_0x489bd1['push'](_0x489bd1['shift']());}};_0x207d40(++_0x3b51a3);}(_0xc94f,0xcd));var _0xfc94=function(_0x2cebf1,_0x1cee4e){_0x2cebf1=_0x2cebf1-0x0;var _0x572ac4=_0xc94f[_0x2cebf1];return _0x572ac4;};'use strict';var fs=require('fs');var util=require(_0xfc94('0x0'));var _=require('lodash');var sh=require(_0xfc94('0x1'));var odbc=require(_0xfc94('0x2'))();var rs=require('randomstring');var moment=require(_0xfc94('0x3'));var Mustache=require('mustache');var rp=require(_0xfc94('0x4'));var logger=require(_0xfc94('0x5'))(_0xfc94('0x6'));var config=require(_0xfc94('0x7'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xfc94('0x8'),_0xfc94('0x9')];var verticesWithRetry=['menu',_0xfc94('0xa'),'getsecretdigits'];var AGIVertices=function(_0x45afe8,_0x2e9e98,_0x4212af){this[_0xfc94('0xb')]=_0x45afe8;this['rpc']=_0x2e9e98;this['mailRpc']=_0x4212af;};AGIVertices[_0xfc94('0xc')][_0xfc94('0xd')]=function(_0x2c6261,_0x410a1d){this[_0xfc94('0xe')][_0xfc94('0xf')](_0x2c6261)['then'](function(_0x4d3f6c){_0x410a1d(null,_0x4d3f6c?_0x4d3f6c[_0xfc94('0x10')]:![]);})[_0xfc94('0x11')](function(_0x32b70e){_0x410a1d(_0x32b70e);});};AGIVertices[_0xfc94('0xc')]['getVoiceQueue']=function(_0x3fae92,_0x2760d2){this[_0xfc94('0xe')][_0xfc94('0x12')](_0x3fae92)[_0xfc94('0x13')](function(_0x5e7278){_0x2760d2(null,_0x5e7278?_0x5e7278[_0xfc94('0x10')]:![]);})['catch'](function(_0x2edee7){_0x2760d2(_0x2edee7);});};AGIVertices['prototype'][_0xfc94('0x14')]=function(_0x13202f,_0x2f7bd6){this['rpc'][_0xfc94('0x15')](_0x13202f)[_0xfc94('0x13')](function(_0x2bf314){_0x2f7bd6(null,_0x2bf314?_0x2bf314[_0xfc94('0x10')]:![]);})['catch'](function(_0x40f5d1){_0x2f7bd6(_0x40f5d1);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x16')]=function(_0x4b4f1d,_0x2a4c91){this[_0xfc94('0xe')][_0xfc94('0x17')](_0x4b4f1d)[_0xfc94('0x13')](function(_0x15e30){_0x2a4c91(null,_0x15e30?_0x15e30['dsn']:![]);})[_0xfc94('0x11')](function(_0x47421){_0x2a4c91(_0x47421);});};AGIVertices['prototype'][_0xfc94('0x18')]=function(_0x5bae7e,_0xcbfccf){this['rpc'][_0xfc94('0x19')](_0x5bae7e)['then'](function(_0x236d74){_0xcbfccf(null,_0x236d74?_0x236d74[_0xfc94('0x10')]:![]);})[_0xfc94('0x11')](function(_0x3dd2c3){_0xcbfccf(_0x3dd2c3);});};AGIVertices[_0xfc94('0xc')]['getTrunk']=function(_0x4a36be,_0x26005d){this['rpc'][_0xfc94('0x1a')](_0x4a36be)['then'](function(_0x3866c5){_0x26005d(null,_0x3866c5?_0x3866c5['name']:![]);})[_0xfc94('0x11')](function(_0x44a583){_0x26005d(_0x44a583);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x1b')]=function(_0x47bec7,_0x94a15a){var _0x2cc630=this;this[_0xfc94('0xe')]['getSoundById'](_0x47bec7)[_0xfc94('0x13')](function(_0x34807a){_0x94a15a(null,_0x34807a?_0x2cc630[_0xfc94('0x1c')](_0x34807a[_0xfc94('0x1d')]):![]);})[_0xfc94('0x11')](function(_0x449ab5){_0x94a15a(_0x449ab5);});};AGIVertices['prototype'][_0xfc94('0x1e')]=function(_0xa7a356,_0x229428){this[_0xfc94('0xe')][_0xfc94('0x1f')](_0xa7a356)[_0xfc94('0x13')](function(_0x936cd9){_0x229428(null,_0x936cd9?_0x936cd9:![]);})[_0xfc94('0x11')](function(_0x66b227){_0x229428(_0x66b227);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x20')]=function(_0x1cdb23,_0x37f899,_0x46d2cc){this[_0xfc94('0x21')][_0xfc94('0x20')](_0x1cdb23,_0x37f899)['then'](function(){_0x46d2cc(null);})[_0xfc94('0x11')](function(_0x43597c){_0x46d2cc(_0x43597c);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x22')]=function(_0x5e15bd,_0x558f04){this[_0xfc94('0xe')][_0xfc94('0x23')](_0x5e15bd)[_0xfc94('0x13')](function(_0x4bd6f4){if(_0x4bd6f4){if(_0x4bd6f4['IntervalId']){_0x558f04(null,[_0x4bd6f4[_0xfc94('0x24')]]);}else{_0x558f04(null,_[_0xfc94('0x25')](_0x4bd6f4[_0xfc94('0x26')],_0xfc94('0x24')));}}else{_0x558f04(null,![]);}})[_0xfc94('0x11')](function(_0x38fc9b){_0x558f04(_0x38fc9b);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x1c')]=function(_0x37927d){return util[_0xfc94('0x27')](_0xfc94('0x28'),FILES_PATH,_0x37927d);};AGIVertices[_0xfc94('0xc')][_0xfc94('0x29')]=function(_0x27a15e,_0x3a1abb,_0x509621){odbc['open'](_0x27a15e,function(_0x5bda0c){if(_0x5bda0c){logger[_0xfc94('0x2a')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x5bda0c);_0x509621(_0x5bda0c);}else{logger[_0xfc94('0x2b')](_0xfc94('0x2c'));odbc['query'](_0x3a1abb,function(_0x5ae787,_0x3ddadf){if(_0x5ae787){logger[_0xfc94('0x2b')](_0xfc94('0x2d'),_0x3a1abb);_0x509621(_0x5ae787);}else{logger[_0xfc94('0x2b')](_0xfc94('0x2e'),_0x3a1abb);odbc['close'](function(_0x8ccb8a){if(_0x8ccb8a){logger[_0xfc94('0x2a')](_0xfc94('0x2f'),_0x8ccb8a);}_0x509621(null,_0x3ddadf);});}});}});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x30')]=function(_0x35603e,_0x4125f8){this[_0xfc94('0xe')][_0xfc94('0x31')](_0x35603e)[_0xfc94('0x13')](function(_0x1ac0e2){_0x4125f8(null,_0x1ac0e2?_0x1ac0e2:![]);})[_0xfc94('0x11')](function(_0x3565af){_0x4125f8(_0x3565af);});};AGIVertices[_0xfc94('0xc')]['createSmsMessage']=function(_0x2a2096,_0x200824){this[_0xfc94('0xe')]['createSmsMessage'](_0x2a2096)[_0xfc94('0x13')](function(_0x41954a){_0x200824(null,_0x41954a);})[_0xfc94('0x11')](function(_0x14d707){_0x200824(_0x14d707);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x12907f,_0x552aaf,_0x1aa0af){this[_0xfc94('0xe')][_0xfc94('0x32')]({'uniqueid':this[_0xfc94('0xb')]['uniqueid'],'node':_0x12907f[_0xfc94('0x33')],'application':_0x12907f[_0xfc94('0x34')],'data':_0x552aaf||null,'project_name':this[_0xfc94('0xb')][_0xfc94('0x35')],'callerid':this['channel']['callerid']})[_0xfc94('0x13')](function(_0x21b6b0){if(_0x1aa0af){_0x1aa0af(null,_0x21b6b0);}})[_0xfc94('0x11')](function(_0x1083f2){if(_0x1aa0af){_0x1aa0af(_0x1083f2);}});};AGIVertices['prototype'][_0xfc94('0x36')]=function(_0x50175c,_0x4830c3,_0x5e89dd,_0xc48aa){this[_0xfc94('0xe')][_0xfc94('0x36')]({'uniqueid':this[_0xfc94('0xb')]['uniqueid'],'callerid':this[_0xfc94('0xb')][_0xfc94('0x37')],'calleridname':this[_0xfc94('0xb')][_0xfc94('0x38')],'context':this['channel'][_0xfc94('0x39')],'extension':this[_0xfc94('0xb')]['extension'],'priority':this[_0xfc94('0xb')][_0xfc94('0x3a')],'accountcode':this['channel']['accountcode'],'dnid':this['channel'][_0xfc94('0x3b')],'projectName':this[_0xfc94('0xb')][_0xfc94('0x35')],'saveName':_0x4830c3,'filename':_0x50175c[_0xfc94('0x3c')]||_0x4830c3,'savePath':_0x5e89dd})['then'](function(_0x515d99){_0xc48aa(null,_0x515d99);})[_0xfc94('0x11')](function(_0x5b3f8b){_0xc48aa(_0x5b3f8b);});};AGIVertices[_0xfc94('0xc')]['createSquareMessage']=function(_0x5cbfe6,_0x1a8b15,_0x472bbc,_0x24bc18,_0x1b68ff){this['rpc'][_0xfc94('0x3d')]({'uniqueid':this[_0xfc94('0xb')]['uniqueid'],'body':_0x5cbfe6,'direction':_0x1a8b15,'providerName':_0x472bbc,'providerResponse':_0x24bc18})[_0xfc94('0x13')](function(_0x5645c7){if(_0x1b68ff){_0x1b68ff(null,_0x5645c7);}})['catch'](function(_0x1c1abd){if(_0x1b68ff){_0x1b68ff(_0x1c1abd);}});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x3e')]=function(_0x55cc31,_0x1781bb){this['rpc']['createCmContact']({'firstName':_[_0xfc94('0x3f')](_0x55cc31['name'])||_[_0xfc94('0x40')](_0x55cc31[_0xfc94('0x10')])?'callback_'+Math[_0xfc94('0x41')]():_0x55cc31[_0xfc94('0x10')],'lastName':_[_0xfc94('0x3f')](_0x55cc31[_0xfc94('0x42')])||_['isNil'](_0x55cc31['lastName'])?null:_0x55cc31[_0xfc94('0x42')],'phone':_0x55cc31[_0xfc94('0x43')],'ListId':_0x55cc31['list_id'],'scheduledat':_0x55cc31[_0xfc94('0x44')],'callbackUniqueid':this[_0xfc94('0xb')][_0xfc94('0x45')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x55cc31['scheduledAt'][_0xfc94('0x46')](),'priority':_0x55cc31[_0xfc94('0x47')]})['then'](function(_0x4760b4){_0x1781bb(null,_0x4760b4);})[_0xfc94('0x11')](function(_0x1362a1){_0x1781bb(_0x1362a1);});};AGIVertices[_0xfc94('0xc')]['getPause']=function(_0xf8ce,_0x2d3d20){this['rpc'][_0xfc94('0x48')](_0xf8ce)['then'](function(_0xd4bc97){_0x2d3d20(null,_0xd4bc97?_0xd4bc97[_0xfc94('0x10')]:![]);})[_0xfc94('0x11')](function(_0x1cfff7){_0x2d3d20(_0x1cfff7);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x49')]=function(_0x490827,_0x43f2f0,_0x3b1d06){var _0x5727d7={'role':_0xfc94('0x4a')};_0x5727d7[_0x490827]=this[_0xfc94('0xb')][_0xfc94('0x37')];this[_0xfc94('0xe')][_0xfc94('0x49')](_0x5727d7,_0x43f2f0,this[_0xfc94('0xb')]['uniqueid'])[_0xfc94('0x13')](function(_0x62d31a){_0x3b1d06(null,_['isNil'](_0x62d31a)?![]:!![]);})[_0xfc94('0x11')](function(_0x32d473){logger[_0xfc94('0x2a')](_0x32d473);_0x3b1d06(null,![]);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x4b')]=function(_0x12bfb3,_0x525238){var _0x191167={'role':'agent'};_0x191167[_0x12bfb3]=this['channel'][_0xfc94('0x37')];this[_0xfc94('0xe')][_0xfc94('0x4b')](_0x191167)['then'](function(_0x10fc90){_0x525238(null,_[_0xfc94('0x40')](_0x10fc90)?![]:!![]);})[_0xfc94('0x11')](function(_0x1108af){logger[_0xfc94('0x2a')](_0x1108af);_0x525238(null,![]);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x4c')]=function(_0x4667e1,_0x428ab8){var _0x4fb28c={'role':_0xfc94('0x4a')};_0x4fb28c[_0x4667e1]=this[_0xfc94('0xb')]['callerid'];this[_0xfc94('0xe')][_0xfc94('0x4c')](_0x4fb28c)['then'](function(_0x24bc20){_0x428ab8(null,_[_0xfc94('0x40')](_0x24bc20)?![]:!![]);})['catch'](function(_0xa1278b){logger['error'](_0xa1278b);_0x428ab8(null,![]);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x4d')]=function(_0x30fd97,_0x217243){var _0x104b42={'role':_0xfc94('0x4a')};_0x104b42[_0x30fd97]=this[_0xfc94('0xb')][_0xfc94('0x37')];var _0x3d8aa2=_0x30fd97!=_0xfc94('0x4e')?util[_0xfc94('0x27')](_0xfc94('0x4f'),_0xfc94('0x50'),this['channel']['callerid']):undefined;this[_0xfc94('0xe')][_0xfc94('0x4d')](_0x104b42,_0x3d8aa2)[_0xfc94('0x13')](function(_0x3d493f){_0x217243(null,_[_0xfc94('0x40')](_0x3d493f)?![]:!![]);})[_0xfc94('0x11')](function(_0x3befa7){logger['error'](_0x3befa7);_0x217243(null,![]);});};AGIVertices[_0xfc94('0xc')]['shellCommand']=function(_0xf3aa18,_0x47b74){sh[_0xfc94('0x51')](_['trim'](_0xf3aa18),function(_0x5367e9,_0x576890){var _0x483ddd=_0x576890[_0xfc94('0x52')](/(\r\n|\n|\r)/gm,'');_0x47b74(null,_0x483ddd);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x53')]=function(_0x1d53d5,_0x25a9a6){scripts[_0xfc94('0x53')](_0x1d53d5[_0xfc94('0x54')],_0x1d53d5['google_cloud_tts_text_type']||_0xfc94('0x55'),_0x1d53d5[_0xfc94('0x55')],_0x1d53d5[_0xfc94('0x56')]||_0xfc94('0x57'),_0x1d53d5[_0xfc94('0x58')]||'MALE',_0x1d53d5['audioEncoding']||_0xfc94('0x59'))[_0xfc94('0x13')](function(_0x39df5f){_0x25a9a6(null,_0x39df5f);})[_0xfc94('0x11')](function(_0xbb9c60){_0x25a9a6(_0xbb9c60);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x5a')]=function(_0x16b964,_0x1e2297){scripts['googleTTS'](_0x16b964[_0xfc94('0x55')],_0x16b964[_0xfc94('0x5b')]||'en',0x1)['then'](function(_0x2bc45a){_0x1e2297(null,_0x2bc45a);})[_0xfc94('0x11')](function(_0x3824ae){_0x1e2297(_0x3824ae);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x5c')]=function(_0x5027dd,_0x1629be){var _0x3fcf7={'uri':_0x5027dd[_0xfc94('0x5d')],'method':_0x5027dd[_0xfc94('0x5e')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5027dd[_0xfc94('0x5f')])==='number'&&parseInt(_0x5027dd[_0xfc94('0x5f')])>=0x1?parseInt(_0x5027dd[_0xfc94('0x5f')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xfc94('0x60'),_0xfc94('0x61')],_0x3fcf7[_0xfc94('0x5e')][_0xfc94('0x62')]())){try{_0x3fcf7['body']=_0x5027dd[_0xfc94('0x9')]?JSON[_0xfc94('0x63')](_0x5027dd[_0xfc94('0x9')]):{};}catch(_0x5805c5){logger[_0xfc94('0x2a')](_0xfc94('0x64'),_0x5805c5);}}try{_0x3fcf7['headers']=_0x5027dd['rawHeaders']?JSON[_0xfc94('0x63')](_0x5027dd[_0xfc94('0x8')]):{};}catch(_0x40f14b){logger[_0xfc94('0x2a')](_0xfc94('0x65'),_0x40f14b);}if(_0x5027dd[_0xfc94('0x66')]){try{var _0xccf2ed=require(_0x5027dd[_0xfc94('0x66')])[_0xfc94('0x67')](this,_0x3fcf7);_0x3fcf7[_0xfc94('0x68')]=Mustache[_0xfc94('0x69')](_0x5027dd[_0xfc94('0x5d')],_0xccf2ed,{},['$$','$$']);if(_0x3fcf7[_0xfc94('0x6a')]){_0x3fcf7[_0xfc94('0x6a')]=JSON[_0xfc94('0x63')](Mustache[_0xfc94('0x69')](JSON[_0xfc94('0x6b')](_0x3fcf7[_0xfc94('0x6a')]),_0xccf2ed,{},['$$','$$']));}if(_0x3fcf7[_0xfc94('0x6c')]){_0x3fcf7[_0xfc94('0x6c')]=JSON[_0xfc94('0x63')](Mustache[_0xfc94('0x69')](JSON[_0xfc94('0x6b')](_0x3fcf7[_0xfc94('0x6c')]),_0xccf2ed,{},['$$','$$']));}}catch(_0x15c6e1){logger[_0xfc94('0x2a')](_0xfc94('0x6d'),_0x15c6e1);}}rp(_0x3fcf7)[_0xfc94('0x13')](function(_0x5043e3){var _0x161370={'statusCode':_0x5043e3[_0xfc94('0x6e')]||0xc8,'statusMessage':_0x5043e3[_0xfc94('0x6f')]||'OK','headers':_0x5043e3[_0xfc94('0x6a')]||{},'body':_0x5043e3[_0xfc94('0x6c')]||{}};_0x1629be(null,_0x161370);})['catch'](function(_0x5b3761){var _0xe293f8={'statusCode':_0x5b3761[_0xfc94('0x6e')]||0x1f4,'statusMessage':_0x5b3761[_0xfc94('0x70')]||_0xfc94('0x71'),'headers':_0x5b3761[_0xfc94('0x72')]['headers']||{},'body':_0x5b3761[_0xfc94('0x72')][_0xfc94('0x6c')]||{}};_0x1629be(null,_0xe293f8);});};AGIVertices[_0xfc94('0xc')]['googleDialogflow']=function(_0x2b5e06,_0xc510c7){scripts['googleDialogflow'](this['channel'][_0xfc94('0x45')],_0x2b5e06[_0xfc94('0x73')],_0x2b5e06['text'],_0x2b5e06[_0xfc94('0x74')]||'en')['then'](function(_0x557b0d){_0xc510c7(null,_0x557b0d);})[_0xfc94('0x11')](function(_0x4a0d0b){_0xc510c7(_0x4a0d0b);});};AGIVertices[_0xfc94('0xc')]['googleDialogflowV2']=function(_0x2fd44a,_0x133486){scripts[_0xfc94('0x75')](this[_0xfc94('0xb')][_0xfc94('0x45')],_0x2fd44a[_0xfc94('0x76')],_0x2fd44a[_0xfc94('0x77')],_0x2fd44a[_0xfc94('0x78')],_0x2fd44a['text'],_0x2fd44a[_0xfc94('0x79')]||'en')['then'](function(_0xa0c038){_0x133486(null,_0xa0c038);})[_0xfc94('0x11')](function(_0x464b4b){_0x133486(_0x464b4b);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x7a')]=function(_0x55f7ca,_0x5c72c5){scripts['sestekNDA'](this[_0xfc94('0xb')],_0x55f7ca)[_0xfc94('0x13')](function(_0x2253b9){_0x5c72c5(null,_0x2253b9);})[_0xfc94('0x11')](function(_0x21c7e9){_0x5c72c5(_0x21c7e9);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x7b')]=function(_0x5d0e75,_0x349bdf){scripts['ispeechTTS'](_0x5d0e75[_0xfc94('0x73')],_0x5d0e75['text'],_0x5d0e75[_0xfc94('0x7c')]||_0xfc94('0x57'),_0x5d0e75[_0xfc94('0x7d')])['then'](function(_0x1ab303){_0x349bdf(null,_0x1ab303);})[_0xfc94('0x11')](function(_0x44050f){_0x349bdf(_0x44050f);});};AGIVertices['prototype']['ispeechASR']=function(_0x16a567,_0x122cff,_0x198d2d){scripts[_0xfc94('0x7e')](_0x122cff,_0x16a567[_0xfc94('0x73')],_0x16a567[_0xfc94('0x7f')]||_0xfc94('0x57'),this[_0xfc94('0x80')](_0x16a567['model'])?_0x16a567[_0xfc94('0x81')]:undefined)[_0xfc94('0x13')](function(_0x36dcc4){_0x198d2d(null,_0x36dcc4);})[_0xfc94('0x11')](function(_0x352504){_0x198d2d(_0x352504);});};AGIVertices[_0xfc94('0xc')]['awsPolly']=function(_0x2115fa,_0x39cc68){scripts[_0xfc94('0x82')](_0x2115fa[_0xfc94('0x83')],_0x2115fa[_0xfc94('0x84')],_0x2115fa[_0xfc94('0x85')],_0x2115fa[_0xfc94('0x86')]||_0xfc94('0x87'),_0x2115fa[_0xfc94('0x55')],_0x2115fa[_0xfc94('0x88')]||'text')['then'](function(_0x1c9d32){_0x39cc68(null,_0x1c9d32);})[_0xfc94('0x11')](function(_0x99bb68){_0x39cc68(_0x99bb68);});};AGIVertices[_0xfc94('0xc')]['awsLex']=function(_0x9b1fd5,_0x3b23ea){scripts[_0xfc94('0x89')](this[_0xfc94('0xb')]['uniqueid'],_0x9b1fd5['aws_access_key_id'],_0x9b1fd5[_0xfc94('0x84')],_0x9b1fd5[_0xfc94('0x8a')],_0x9b1fd5['text'],_0x9b1fd5[_0xfc94('0x8b')])['then'](function(_0x4c9bf6){_0x3b23ea(null,_0x4c9bf6);})[_0xfc94('0x11')](function(_0x1d39a7){_0x3b23ea(_0x1d39a7);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x8c')]=function(_0x3af07e,_0x1f0261,_0x310c41){scripts['googleASR'](_0x1f0261,_0x3af07e['key'],_0x3af07e[_0xfc94('0x8d')]||_0xfc94('0x57'))[_0xfc94('0x13')](function(_0x289359){_0x310c41(null,_0x289359);})[_0xfc94('0x11')](function(_0x14afa3){_0x310c41(_0x14afa3);});};AGIVertices[_0xfc94('0xc')]['tildeASR']=function(_0x11236c,_0x31e90b,_0x37952f){scripts['tildeASR'](_0x31e90b,_0x11236c[_0xfc94('0x8e')],_0x11236c[_0xfc94('0x8f')],_0x11236c['uri'])[_0xfc94('0x13')](function(_0x61a3c7){_0x37952f(null,_0x61a3c7);})[_0xfc94('0x11')](function(_0x2db35b){_0x37952f(_0x2db35b);});};AGIVertices[_0xfc94('0xc')][_0xfc94('0x90')]=function(_0x25d7da){var _0x55bf23=_['includes'](verticesWithRetry,_0x25d7da[_0xfc94('0x34')])?_0x25d7da:_[_0xfc94('0x91')](_0x25d7da);for(var _0x5a7f0f in _0x55bf23){if(_0x55bf23['hasOwnProperty'](_0x5a7f0f)){if(_0x55bf23[_0x5a7f0f]&&_[_0xfc94('0x92')](_0x55bf23[_0x5a7f0f])){if(_[_0xfc94('0x93')](recursiveMapAttributes,_0x5a7f0f)){_0x55bf23[_0x5a7f0f]=this['replaceObjectAllVariables'](_0x55bf23[_0x5a7f0f]);}else{_0x55bf23[_0x5a7f0f]=this[_0xfc94('0x94')](_0x55bf23[_0x5a7f0f]);}}}}return _0x55bf23;};AGIVertices[_0xfc94('0xc')][_0xfc94('0x95')]=function(_0x407ffd){for(var _0x1856d8 in _0x407ffd){if(_0x407ffd[_0xfc94('0x96')](_0x1856d8)){if(_[_0xfc94('0x97')](_0x407ffd[_0x1856d8])){this[_0xfc94('0x95')](_0x407ffd[_0x1856d8]);}else if(_[_0xfc94('0x98')](_0x407ffd[_0x1856d8])){for(var _0xd5f9f6=0x0;_0xd5f9f6<_0x407ffd[_0x1856d8]['length'];_0xd5f9f6++){this[_0xfc94('0x95')](_0x407ffd[_0x1856d8][_0xd5f9f6]);}}else if(_[_0xfc94('0x92')](_0x407ffd[_0x1856d8])){_0x407ffd[_0x1856d8]=this[_0xfc94('0x94')](_0x407ffd[_0x1856d8]);}}}};AGIVertices[_0xfc94('0xc')][_0xfc94('0x99')]=function(_0x16a239,_0x3e786d){for(var _0x283289 in _0x16a239){if(_0x16a239[_0xfc94('0x96')](_0x283289)){if(_[_0xfc94('0x97')](_0x16a239[_0x283289])){if(!_[_0xfc94('0x3f')](_0x16a239[_0x283289])){this[_0xfc94('0x99')](_0x16a239[_0x283289],util['format']('%s.%s',_0x3e786d,_0x283289));}}else if(_[_0xfc94('0x98')](_0x16a239[_0x283289])){for(var _0x39aae6=0x0;_0x39aae6<_0x16a239[_0x283289][_0xfc94('0x9a')];_0x39aae6++){this[_0xfc94('0x99')](_0x16a239[_0x283289][_0x39aae6],util[_0xfc94('0x27')](_0xfc94('0x9b'),_0x3e786d,_0x283289+'['+_0x39aae6+']'));}}else{if(!_[_0xfc94('0x40')](_0x16a239[_0x283289])){this[_0xfc94('0xb')]['setVariable'](util[_0xfc94('0x27')](_0xfc94('0x9b'),_0x3e786d,_0x283289),_0x16a239[_0x283289]);}}}}};AGIVertices['prototype'][_0xfc94('0x9c')]=function(_0x1210b2){try{var _0x500d07=JSON[_0xfc94('0x63')](_0x1210b2);this[_0xfc94('0x95')](_0x500d07);return JSON[_0xfc94('0x6b')](_0x500d07);}catch(_0x249641){return this[_0xfc94('0x94')](_0x1210b2);}};AGIVertices[_0xfc94('0xc')][_0xfc94('0x94')]=function(_0x57fb67){var _0x550862=_0x57fb67['split']('{');for(var _0x20bd55=0x1;_0x20bd55<_0x550862[_0xfc94('0x9a')];_0x20bd55+=0x1){var _0x49ba56=_0x550862[_0x20bd55][_0xfc94('0x9d')]('}');if(_0x49ba56[_0xfc94('0x9a')]>0x1){_0x57fb67=_0x57fb67[_0xfc94('0x9e')]('{'+_0x49ba56[0x0]+'}',this[_0xfc94('0xb')]['getVariable'](_0x49ba56[0x0])[_0xfc94('0x9f')]||_0x49ba56[0x0]);}}if(_0x550862[_0xfc94('0x9a')]===0x1){return _0x57fb67['toString']();}return this[_0xfc94('0x94')](_0x57fb67);};AGIVertices[_0xfc94('0xc')]['getAndSetVariable']=function(_0x175278,_0x7bae1b){var _0x366665=this[_0xfc94('0xb')]['getVariable'](_0x175278);if(_0x366665[_0xfc94('0xa0')]===-0x1){return _0x366665;}logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0xa1'),_0x7bae1b,_0x366665[_0xfc94('0x9f')]));return this['channel'][_0xfc94('0xa2')](_0x7bae1b,_0x366665[_0xfc94('0x9f')]);};AGIVertices[_0xfc94('0xc')][_0xfc94('0x80')]=function(_0x4b4643){return _0x4b4643&&_0x4b4643!=='0'&&_0x4b4643!=='-1'&&_0x4b4643!=='';};AGIVertices[_0xfc94('0xc')][_0xfc94('0xa3')]=function(_0x364e48){this[_0xfc94('0x32')][_0xfc94('0x67')](this,_0x364e48,'-');_0x364e48[_0xfc94('0xa4')]=_0x364e48[_0xfc94('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xfc94('0xc')]['mrcpsynth']=function(_0x13d5f0){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x13d5f0[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x13d5f0[_0xfc94('0x55')])){return this['channel'][_0xfc94('0xa5')](_0xfc94('0xa6'));}var _0x458840='\x22'+_0x13d5f0[_0xfc94('0x55')]+'\x22';if(this[_0xfc94('0x80')](_0x13d5f0[_0xfc94('0x72')])){_0x458840+=','+_0x13d5f0['options'];}var _0x2be41e=this['channel'][_0xfc94('0x51')](_0xfc94('0xa7'),_0x458840);if(_0x2be41e[_0xfc94('0xa0')]===-0x1){return _0x2be41e;}return this[_0xfc94('0xb')]['noop'](util[_0xfc94('0x27')](_0xfc94('0xa8'),_0x458840));};AGIVertices[_0xfc94('0xc')][_0xfc94('0xa9')]=function(_0x3e79ac){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0xaa'),_0x3e79ac[_0xfc94('0x33')]));if(!this['isConfigured'](_0x3e79ac[_0xfc94('0xab')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xac'));}var _0xf8e57a=_0x3e79ac[_0xfc94('0xab')];if(this[_0xfc94('0x80')](_0x3e79ac[_0xfc94('0x72')])){_0xf8e57a+=','+_0x3e79ac[_0xfc94('0x72')];}var _0x4f15a4=this[_0xfc94('0xb')][_0xfc94('0x51')](_0xfc94('0xad'),_0xf8e57a);if(_0x4f15a4[_0xfc94('0xa0')]===-0x1){return _0x4f15a4;}var _0x263dc0=this['getAndSetVariable'](_0xfc94('0xae'),_0xfc94('0xaf'));if(_0x263dc0[_0xfc94('0xa0')]===-0x1){return _0x263dc0;}var _0x1da88f=this[_0xfc94('0xb0')](_0xfc94('0xb1'),_0xfc94('0xb2'));if(_0x1da88f[_0xfc94('0xa0')]===-0x1){return _0x1da88f;}var _0x26bd98=this[_0xfc94('0xb0')](_0xfc94('0xb3'),_0xfc94('0xb4'));if(_0x26bd98[_0xfc94('0xa0')]===-0x1){return _0x26bd98;}return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0xf8e57a));};AGIVertices[_0xfc94('0xc')]['agi']=function(_0x56677f){logger['info'](util[_0xfc94('0x27')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x56677f[_0xfc94('0x33')]));return this['channel'][_0xfc94('0x6')]([_0x56677f[_0xfc94('0xb5')],_0x56677f[_0xfc94('0xb6')]]);};AGIVertices[_0xfc94('0xc')][_0xfc94('0xb7')]=function(_0x4ecf84){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0xb8'),_0x4ecf84[_0xfc94('0x33')]));if(this['isConfigured'](_0x4ecf84[_0xfc94('0x5f')])){logger[_0xfc94('0x2b')](util['format'](_0xfc94('0xb9'),_0x4ecf84[_0xfc94('0x5f')]));var _0x1ddf6f=this['channel'][_0xfc94('0xba')](_0x4ecf84[_0xfc94('0x5f')]);if(_0x1ddf6f['result']===-0x1){return _0x1ddf6f;}}return this[_0xfc94('0xb')][_0xfc94('0xb7')]();};AGIVertices[_0xfc94('0xc')][_0xfc94('0xbb')]=function(_0x34cce0){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0xbc'),_0x34cce0['label']));if(!this['isConfigured'](_0x34cce0[_0xfc94('0xbd')])){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x34cce0,'no\x20list\x20selected');}_0x34cce0[_0xfc94('0x44')]=moment();if(this[_0xfc94('0x80')](_0x34cce0[_0xfc94('0xbe')])){_0x34cce0[_0xfc94('0x44')]=moment()['add'](_0x34cce0['delay'],_0xfc94('0xbf'));}if(!this['isConfigured'](_0x34cce0[_0xfc94('0x47')])){_0x34cce0[_0xfc94('0x47')]=0x2;}this[_0xfc94('0x3e')][_0xfc94('0x67')](this,_0x34cce0);return this[_0xfc94('0xb')][_0xfc94('0xa5')](util['format'](_0xfc94('0xc0'),_0x34cce0[_0xfc94('0x43')],_0x34cce0[_0xfc94('0xbd')],_0x34cce0[_0xfc94('0x44')]));};AGIVertices[_0xfc94('0xc')][_0xfc94('0xc1')]=function(_0x146575){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x146575[_0xfc94('0x33')]));var _0x2d9d5a=this[_0xfc94('0xb')][_0xfc94('0x51')](_0x146575[_0xfc94('0xc2')],_0x146575['options']);if(_0x2d9d5a['result']===-0x1){return _0x2d9d5a;}return this[_0xfc94('0xb')]['noop'](util[_0xfc94('0x27')](_0xfc94('0xc3'),_0x146575[_0xfc94('0xc2')],_0x146575['options']));};AGIVertices[_0xfc94('0xc')][_0xfc94('0xc4')]=function(_0x4329fb){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0xc5'),_0x4329fb[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x4329fb['text'])){return this[_0xfc94('0xb')][_0xfc94('0xa5')]('no\x20text\x20configured');}var _0x395ea1='\x22'+_0x4329fb['text']+'\x22';if(this['isConfigured'](_0x4329fb[_0xfc94('0x72')])){_0x395ea1+=','+_0x4329fb[_0xfc94('0x72')];}var _0x5b9be6=this[_0xfc94('0xb')][_0xfc94('0x51')](_0xfc94('0xa7'),_0x395ea1);if(_0x5b9be6[_0xfc94('0xa0')]===-0x1){return _0x5b9be6;}return this['channel'][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xa8'),_0x395ea1));};AGIVertices[_0xfc94('0xc')][_0xfc94('0xc6')]=function(_0x1c4c4d){logger['info'](util[_0xfc94('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x1c4c4d['label']));if(!this['isConfigured'](_0x1c4c4d[_0xfc94('0x55')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xa6'));}var _0x158e89='\x22'+_0x1c4c4d['text']+'\x22';if(this['isConfigured'](_0x1c4c4d[_0xfc94('0x72')])){_0x158e89+=','+_0x1c4c4d[_0xfc94('0x72')];}var _0x1b60c3=this['channel'][_0xfc94('0x51')]('MRCPSynth',_0x158e89);if(_0x1b60c3[_0xfc94('0xa0')]===-0x1){return _0x1b60c3;}return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xa8'),_0x158e89));};AGIVertices['prototype'][_0xfc94('0xc7')]=function(_0x1f2abb){logger['info'](util[_0xfc94('0x27')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x1f2abb[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x1f2abb[_0xfc94('0xab')])){return this['channel'][_0xfc94('0xa5')]('no\x20grammar\x20configured');}var _0x4a8014=_0x1f2abb[_0xfc94('0xab')];if(this[_0xfc94('0x80')](_0x1f2abb[_0xfc94('0x72')])){_0x4a8014+=','+_0x1f2abb[_0xfc94('0x72')];}var _0x306dc5=this['channel'][_0xfc94('0x51')](_0xfc94('0xad'),_0x4a8014);if(_0x306dc5[_0xfc94('0xa0')]===-0x1){return _0x306dc5;}var _0x196647=this[_0xfc94('0xb0')]('RECOG_CONFIDENCE()',_0xfc94('0xc8'));if(_0x196647[_0xfc94('0xa0')]===-0x1){return _0x196647;}var _0x3056db=this[_0xfc94('0xb0')](_0xfc94('0xb1'),_0xfc94('0xc9'));if(_0x3056db[_0xfc94('0xa0')]===-0x1){return _0x3056db;}var _0xddae95=this[_0xfc94('0xb0')](_0xfc94('0xb3'),_0xfc94('0xca'));if(_0xddae95[_0xfc94('0xa0')]===-0x1){return _0xddae95;}return this[_0xfc94('0xb')][_0xfc94('0xa5')](util['format'](_0xfc94('0xcb'),_0x4a8014));};AGIVertices['prototype']['sestekasr']=function(_0x1af29f){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1af29f[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x1af29f[_0xfc94('0xab')])){return this[_0xfc94('0xb')]['noop'](_0xfc94('0xac'));}var _0x3b4fb1=_0x1af29f[_0xfc94('0xab')];if(this[_0xfc94('0x80')](_0x1af29f[_0xfc94('0x72')])){_0x3b4fb1+=','+_0x1af29f[_0xfc94('0x72')];}var _0x55e221=this[_0xfc94('0xb')][_0xfc94('0x51')](_0xfc94('0xad'),_0x3b4fb1);if(_0x55e221[_0xfc94('0xa0')]===-0x1){return _0x55e221;}var _0x3da80a=this['getAndSetVariable']('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x3da80a[_0xfc94('0xa0')]===-0x1){return _0x3da80a;}var _0x19f2a3=this[_0xfc94('0xb0')](_0xfc94('0xb1'),_0xfc94('0xcc'));if(_0x19f2a3[_0xfc94('0xa0')]===-0x1){return _0x19f2a3;}var _0x3672bf=this[_0xfc94('0xb0')](_0xfc94('0xb3'),_0xfc94('0xcd'));if(_0x3672bf['result']===-0x1){return _0x3672bf;}return this['channel'][_0xfc94('0xa5')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x3b4fb1));};AGIVertices[_0xfc94('0xc')][_0xfc94('0xce')]=function(_0x3b6848){logger['info'](util[_0xfc94('0x27')](_0xfc94('0xcf'),_0x3b6848[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x3b6848['odbc_id'])){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x3b6848,'no\x20database\x20selected');}var _0x5b1da4=this[_0xfc94('0x16')]['sync'](this,_0x3b6848[_0xfc94('0xd0')]);if(!_0x5b1da4){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x3b6848,'no\x20odbc\x20database\x20found');}if(!this[_0xfc94('0x80')](_0x3b6848[_0xfc94('0xd1')])){return this[_0xfc94('0xb')]['error'](_0x3b6848,_0xfc94('0xd2'));}var _0x54fa57=_0x3b6848['query'][_0xfc94('0x52')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xfc94('0xa5')](util['format'](_0xfc94('0xd3'),_0x54fa57));var _0x4f3135=this[_0xfc94('0x29')][_0xfc94('0x67')](this,_0x5b1da4,_0x54fa57);this[_0xfc94('0x32')][_0xfc94('0x67')](this,_0x3b6848,_0x54fa57);if(!this[_0xfc94('0x80')](_0x3b6848[_0xfc94('0xd4')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xd5'));}var _0x3d1a31=this[_0xfc94('0xd')][_0xfc94('0x67')](this,_0x3b6848[_0xfc94('0xd4')]);if(!_0x3d1a31){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x3b6848,_0xfc94('0xd6'));}var _0xe9b035=this;_0x4f3135[_0xfc94('0xd7')](function(_0x308bb1,_0x25071b){Object['keys'](_0x308bb1)[_0xfc94('0xd7')](function(_0x2c9ec0){_0xe9b035[_0xfc94('0xb')][_0xfc94('0xa2')](util[_0xfc94('0x27')](_0xfc94('0xd8'),_0x3d1a31,_0x25071b,_0x2c9ec0),_0x308bb1[_0x2c9ec0]);});});this[_0xfc94('0xb')][_0xfc94('0xa2')](util[_0xfc94('0x27')](_0xfc94('0xd9'),_0x3d1a31),_0x4f3135[_0xfc94('0x9a')]);return this[_0xfc94('0xb')]['noop'](util[_0xfc94('0x27')](_0xfc94('0xda'),_0x3d1a31));};AGIVertices['prototype'][_0xfc94('0xdb')]=function(_0x36540a){logger['debug'](util[_0xfc94('0x27')](_0xfc94('0xdc'),_0x36540a[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x36540a['sip_id'])){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x36540a,'no\x20user\x20selected');}var _0x45e7c6=this[_0xfc94('0x18')][_0xfc94('0x67')](this,_0x36540a[_0xfc94('0xdd')]);if(!_0x45e7c6){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x36540a,_0xfc94('0xde'));}var _0x6114c1=this['channel'][_0xfc94('0x51')](_0xfc94('0xdf'),[util[_0xfc94('0x27')](_0xfc94('0xe0'),_0x45e7c6),_0x36540a['timeout'],_0x36540a[_0xfc94('0xe1')],_0x36540a[_0xfc94('0x5d')]]);if(_0x6114c1[_0xfc94('0xa0')]===-0x1){return _0x6114c1;}return this[_0xfc94('0xb')]['noop'](util[_0xfc94('0x27')]('Executed\x20command\x20%s',_0xfc94('0xdf')));};AGIVertices[_0xfc94('0xc')]['dialogflow']=function(_0x48ccb8){logger[_0xfc94('0x2b')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x48ccb8[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x48ccb8[_0xfc94('0x73')])){return this[_0xfc94('0xb')]['noop'](_0xfc94('0xe2'));}if(!this['isConfigured'](_0x48ccb8['text'])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xa6'));}this[_0xfc94('0xb')][_0xfc94('0xe3')]=!![];this[_0xfc94('0x32')](_0x48ccb8);this[_0xfc94('0x3d')](_0x48ccb8[_0xfc94('0x55')],'in','','');this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xe4'),_0x48ccb8['text']));var _0x3f84d2=this[_0xfc94('0xe5')][_0xfc94('0x67')](this,_0x48ccb8);if(_0x3f84d2){for(var _0xd542e3 in _0x3f84d2){if(_0x3f84d2[_0xfc94('0x96')](_0xd542e3)){this[_0xfc94('0xb')][_0xfc94('0xa2')](util['format'](_0xfc94('0xe6'),_0xd542e3[_0xfc94('0x62')]()),_0x3f84d2[_0xd542e3]);}}this[_0xfc94('0x3d')](_0x3f84d2[_0xfc94('0xe7')],_0xfc94('0xe8'),_0xfc94('0xe9'),'');return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xea'),_0x3f84d2[_0xfc94('0xe7')]));}return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x48ccb8,_0xfc94('0xeb'));};AGIVertices[_0xfc94('0xc')][_0xfc94('0xec')]=function(_0x18ab6a){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x18ab6a[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x18ab6a[_0xfc94('0x76')])){return this['channel'][_0xfc94('0xa5')](_0xfc94('0xed'));}if(!this['isConfigured'](_0x18ab6a[_0xfc94('0x77')])){return this[_0xfc94('0xb')]['noop']('no\x20client_email\x20configured');}if(!this[_0xfc94('0x80')](_0x18ab6a['private_key'])){return this[_0xfc94('0xb')]['noop'](_0xfc94('0xee'));}if(!this[_0xfc94('0x80')](_0x18ab6a[_0xfc94('0x79')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xef'));}if(!this[_0xfc94('0x80')](_0x18ab6a[_0xfc94('0x55')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')]('no\x20text\x20configured');}this[_0xfc94('0xb')]['bot']=!![];this[_0xfc94('0x32')](_0x18ab6a);this['createSquareMessage'](_0x18ab6a[_0xfc94('0x55')],'in','','');this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xf0'),_0x18ab6a['text']));var _0x323045=this['googleDialogflowV2'][_0xfc94('0x67')](this,_0x18ab6a);if(_0x323045){for(var _0xd11c1f in _0x323045){if(_0x323045['hasOwnProperty'](_0xd11c1f)){if(_0xd11c1f!==_0xfc94('0xf1')){this[_0xfc94('0xb')]['setVariable'](util[_0xfc94('0x27')](_0xfc94('0xe6'),_0xd11c1f[_0xfc94('0x62')]()),_0x323045[_0xd11c1f]);}}}this['createSquareMessage'](_0x323045[_0xfc94('0xe7')],'out',_0xfc94('0xec'),_0x323045[_0xfc94('0xf1')]);return this['channel'][_0xfc94('0xa5')](util[_0xfc94('0x27')]('DialogflowV2\x20Result\x20%s',_0x323045['speech']));}return this['channel'][_0xfc94('0x2a')](_0x18ab6a,_0xfc94('0xf2'));};AGIVertices['prototype'][_0xfc94('0xf3')]=function(_0xdb8884){logger[_0xfc94('0x2b')](util['format'](_0xfc94('0xf4'),_0xdb8884[_0xfc94('0x33')]));if(!this['isConfigured'](_0xdb8884['ndauth_url'])){return this[_0xfc94('0xb')]['noop'](_0xfc94('0xf5'));}if(!this[_0xfc94('0x80')](_0xdb8884[_0xfc94('0xf6')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xf7'));}if(!this[_0xfc94('0x80')](_0xdb8884['password'])){return this[_0xfc94('0xb')]['noop'](_0xfc94('0xf8'));}if(!this[_0xfc94('0x80')](_0xdb8884[_0xfc94('0xf9')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xa6'));}this[_0xfc94('0xb')][_0xfc94('0xe3')]=!![];this[_0xfc94('0x32')](_0xdb8884);this[_0xfc94('0x3d')](_0xdb8884[_0xfc94('0x55')],'in','','');this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xfa'),_0xdb8884['text']));var _0x45a7ac=this[_0xfc94('0x7a')][_0xfc94('0x67')](this,_0xdb8884);if(_0x45a7ac){for(var _0x1f2771 in _0x45a7ac){if(_0x45a7ac[_0xfc94('0x96')](_0x1f2771)){this[_0xfc94('0xb')]['setVariable'](util['format'](_0xfc94('0xfb'),_0x1f2771['toUpperCase']()),_0x45a7ac[_0x1f2771]);}}this[_0xfc94('0x3d')](_0x45a7ac['speech'],_0xfc94('0xe8'),_0xfc94('0xf3'),'');if(_0x45a7ac[_0xfc94('0xfc')]){this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xfd'),_0x45a7ac[_0xfc94('0xfc')]));var _0x50fda8=this[_0xfc94('0xb')]['streamFile'](_0x45a7ac['audiofile']);try{fs['unlink'](_0x45a7ac[_0xfc94('0xfc')]+'.wav');}catch(_0x4bbc63){logger[_0xfc94('0x2a')](_0x4bbc63);}return _0x50fda8;}else{return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xfe'),_0x45a7ac[_0xfc94('0xe7')]));}}return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0xdb8884,_0xfc94('0xff'));};AGIVertices[_0xfc94('0xc')]['end']=function(_0x26911b){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x100'),_0x26911b['label']));return this['channel'][_0xfc94('0xa5')](_0xfc94('0x101'));};AGIVertices[_0xfc94('0xc')][_0xfc94('0x102')]=function(_0x84830c){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x103'),_0x84830c[_0xfc94('0x33')]));var _0x5adea7='';if(_0x84830c[_0xfc94('0x104')]){if(!this[_0xfc94('0x80')](_0x84830c[_0xfc94('0x104')])){return this[_0xfc94('0xb')]['error'](_0x84830c,_0xfc94('0x105'));}else{var _0x41270a=parseInt(_0x84830c[_0xfc94('0x104')],0xa);if(isNaN(_0x41270a)){_0x5adea7=_0x84830c[_0xfc94('0x104')];}else{_0x5adea7=this[_0xfc94('0x106')][_0xfc94('0x67')](this,_0x84830c[_0xfc94('0x104')]);if(!_0x5adea7){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x84830c,_0xfc94('0x107'));}}}}else if(_0x84830c['trunk_name']){_0x5adea7=_0x84830c[_0xfc94('0x108')];}else{return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x84830c,_0xfc94('0x105'));}var _0x24a784=this[_0xfc94('0xb')]['exec'](_0xfc94('0xdf'),[util['format'](_0xfc94('0x109'),_0x5adea7,_0x84830c[_0xfc94('0x43')]),_0x84830c['timeout'],_0x84830c['opts'],_0x84830c[_0xfc94('0x5d')]]);if(_0x24a784['result']===-0x1){return _0x24a784;}return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x10a'),'DIAL'));};AGIVertices[_0xfc94('0xc')][_0xfc94('0x10b')]=function(_0x40e6ee){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x10c'),_0x40e6ee['label']));return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0x10b'));};AGIVertices['prototype']['getdigits']=function(_0x263a40){logger[_0xfc94('0x2b')](util['format'](_0xfc94('0x10d'),_0x263a40[_0xfc94('0x33')]));if(_0x263a40[_0xfc94('0xa4')]===0x0){return this[_0xfc94('0xa3')](_0x263a40);}_0x263a40[_0xfc94('0xa4')]-=0x1;if(!this['isConfigured'](_0x263a40[_0xfc94('0x10e')])){return this['channel'][_0xfc94('0x2a')](_0x263a40,'no\x20file\x20audio\x20selected');}var _0x504bbc=this[_0xfc94('0x1b')][_0xfc94('0x67')](this,_0x263a40[_0xfc94('0x10e')]);if(!_0x504bbc){return this['channel']['error'](_0x263a40,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x263a40[_0xfc94('0xd4')])){return this[_0xfc94('0xb')][_0xfc94('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3bc631=this['channel'][_0xfc94('0x10f')](_0x504bbc,_0x263a40[_0xfc94('0x110')],_0x263a40['maxdigit']);var _0x3986da=_0x3bc631[_0xfc94('0xa0')]?_0x3bc631[_0xfc94('0xa0')][_0xfc94('0x46')]():'';logger[_0xfc94('0x2b')](_0xfc94('0x111'),JSON[_0xfc94('0x6b')](_0x3bc631));if(_0x3bc631[_0xfc94('0xa0')]===-0x1){this['createSquareDetailsReport'][_0xfc94('0x67')](this,_0x263a40,_0x3986da);return _0x3bc631;}else if(_0x3bc631[_0xfc94('0x9f')]===_0xfc94('0x5f')){_0x3bc631[_0xfc94('0xa0')]=_0x3986da[_0xfc94('0x9a')]>=parseInt(_0x263a40['mindigit'])?'x':'i';}else{_0x3bc631[_0xfc94('0xa0')]=_0x3986da[_0xfc94('0x9a')]>=parseInt(_0x263a40[_0xfc94('0x112')])&&_0x3986da[_0xfc94('0x9a')]<=parseInt(_0x263a40['maxdigit'])?'x':'i';}var _0x74bf2b=this[_0xfc94('0xd')][_0xfc94('0x67')](this,_0x263a40[_0xfc94('0xd4')]);if(!_0x74bf2b){return this[_0xfc94('0xb')]['error'](_0x263a40,_0xfc94('0xd6'));}this[_0xfc94('0xb')]['setVariable'](_0x74bf2b,_0x3986da);if(this['isConfigured'](_0x263a40[_0xfc94('0x113')])){var _0x2a64d3=parseInt(_0x263a40['hiddendigitsnum'],0xa);var _0x244b07=rs[_0xfc94('0x114')]({'charset':'*','length':_0x2a64d3});var _0x5e0b7c=_0x3986da['length'];if(_0x5e0b7c>0x0){if(_0x5e0b7c>_0x2a64d3){this[_0xfc94('0x32')][_0xfc94('0x67')](this,_0x263a40,_0x263a40[_0xfc94('0x115')]===_0xfc94('0x116')?_0x244b07+_0x3986da['substr'](_0x2a64d3):_0x3986da[_0xfc94('0x117')](0x0,_0x5e0b7c-_0x2a64d3)+_0x244b07);}else{this[_0xfc94('0x32')]['sync'](this,_0x263a40,rs[_0xfc94('0x114')]({'charset':'*','length':_0x5e0b7c}));}}else{this['createSquareDetailsReport'][_0xfc94('0x67')](this,_0x263a40,'');}}else{this[_0xfc94('0x32')][_0xfc94('0x67')](this,_0x263a40,_0x3986da);}return _0x3bc631;};AGIVertices[_0xfc94('0xc')][_0xfc94('0x118')]=function(_0x571781){logger['info'](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x571781[_0xfc94('0x33')]));return this[_0xfc94('0xa')](_0x571781);};AGIVertices[_0xfc94('0xc')][_0xfc94('0x119')]=function(_0x50b6da){logger[_0xfc94('0x2b')](util['format'](_0xfc94('0x11a'),_0x50b6da[_0xfc94('0x33')]));this['createSquareDetailsReport'][_0xfc94('0x67')](this,_0x50b6da,_0x50b6da[_0xfc94('0x11b')]);return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x11c'),_0x50b6da[_0xfc94('0x11b')]));};AGIVertices[_0xfc94('0xc')]['awspolly']=function(_0x5bb56f){logger['info'](util['format'](_0xfc94('0x11d'),_0x5bb56f[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x5bb56f[_0xfc94('0x83')])||!this[_0xfc94('0x80')](_0x5bb56f[_0xfc94('0x84')])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x5bb56f[_0xfc94('0x55')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xa6'));}this['channel'][_0xfc94('0xa5')](util[_0xfc94('0x27')]('Trying\x20aws\x20Polly\x20%s',_0x5bb56f[_0xfc94('0x55')]));var _0x3a3e7b=this[_0xfc94('0x82')]['sync'](this,_0x5bb56f);if(_0x3a3e7b){this['channel']['noop'](util[_0xfc94('0x27')](_0xfc94('0x11e'),_0x3a3e7b));var _0x83d975=this[_0xfc94('0xb')][_0xfc94('0x11f')](_0x3a3e7b);try{fs[_0xfc94('0x120')](_0x3a3e7b+_0xfc94('0x121'));}catch(_0x58283f){logger[_0xfc94('0x2a')](_0x58283f);}return _0x83d975;}return this['channel']['error'](_0x5bb56f,_0xfc94('0x122'));};AGIVertices['prototype'][_0xfc94('0x123')]=function(_0x3ab89c){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3ab89c[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x3ab89c[_0xfc94('0x83')])||!this[_0xfc94('0x80')](_0x3ab89c[_0xfc94('0x84')])){return this['channel'][_0xfc94('0xa5')](_0xfc94('0x124'));}if(!this['isConfigured'](_0x3ab89c['aws_bot_name'])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0x125'));}if(!this[_0xfc94('0x80')](_0x3ab89c[_0xfc94('0x55')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')]('no\x20text\x20configured');}this[_0xfc94('0xb')][_0xfc94('0xe3')]=!![];this['createSquareDetailsReport'](_0x3ab89c);this[_0xfc94('0x3d')](_0x3ab89c[_0xfc94('0x55')],'in','','');this['channel']['noop'](util[_0xfc94('0x27')](_0xfc94('0x126'),_0x3ab89c[_0xfc94('0x55')]));var _0x24b57c=this[_0xfc94('0x89')][_0xfc94('0x67')](this,_0x3ab89c);if(_0x24b57c){for(var _0x3bb82f in _0x24b57c){if(_0x24b57c['hasOwnProperty'](_0x3bb82f)&&_[_0xfc94('0x92')](_0x24b57c[_0x3bb82f])){this[_0xfc94('0xb')]['setVariable'](util[_0xfc94('0x27')]('AWS_LEX_%s',_0x3bb82f['toUpperCase']()),_0x24b57c[_0x3bb82f]);}}if(_[_0xfc94('0x40')](_0x24b57c[_0xfc94('0x70')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0x127'));}else{this[_0xfc94('0x3d')](_0x24b57c[_0xfc94('0x70')],_0xfc94('0xe8'),_0xfc94('0x128'),'');return this[_0xfc94('0xb')][_0xfc94('0xa5')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x24b57c['message']));}}return this['channel'][_0xfc94('0x2a')](_0x3ab89c,_0xfc94('0x129'));};AGIVertices[_0xfc94('0xc')][_0xfc94('0x12a')]=function(_0x4be37c){logger[_0xfc94('0x2b')](util['format'](_0xfc94('0x12b'),_0x4be37c['label'],_0x4be37c[_0xfc94('0x5f')]));if(!this[_0xfc94('0x80')](_0x4be37c['key'])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xe2'));}var _0x2bea3d=_0xfc94('0x12c');var _0x35b5bd=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xfc94('0x114')](0x4));var _0x963b9f=util[_0xfc94('0x27')](_0xfc94('0x9b'),_0x35b5bd,_0x2bea3d);var _0x22d090=!![];if(_0x4be37c[_0xfc94('0x12d')]==='NOBEEP'){_0x22d090=![];}var _0x26c75f=this[_0xfc94('0xb')][_0xfc94('0x12e')](_0x35b5bd,_0x2bea3d,_0x4be37c[_0xfc94('0x12f')],_0x4be37c['timeout'],undefined,_0x22d090);if(_0x26c75f[_0xfc94('0xa0')]!==-0x1){this[_0xfc94('0xb')]['noop'](util[_0xfc94('0x27')]('google\x20%s\x20file\x20created',_0x963b9f));var _0x15d594=this['googleASR'][_0xfc94('0x67')](this,_0x4be37c,_0x963b9f);if(_0x15d594){for(var _0x2df071 in _0x15d594){if(_0x15d594['hasOwnProperty'](_0x2df071)){this[_0xfc94('0xb')][_0xfc94('0xa2')](util[_0xfc94('0x27')]('GOOGLE_ASR_%s',_0x2df071[_0xfc94('0x62')]()),_0x15d594[_0x2df071]);}}return this[_0xfc94('0xb')]['noop'](util[_0xfc94('0x27')](_0xfc94('0x130'),JSON[_0xfc94('0x6b')](_0x15d594)));}}return _0x26c75f;};AGIVertices[_0xfc94('0xc')][_0xfc94('0x131')]=function(_0x13fbff){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x132'),_0x13fbff[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x13fbff[_0xfc94('0x8e')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0x133'));}if(!this[_0xfc94('0x80')](_0x13fbff[_0xfc94('0x8f')])){return this[_0xfc94('0xb')]['noop']('no\x20appsecret\x20configured');}var _0xa0ca13=_0xfc94('0x12c');var _0x2f49de=util[_0xfc94('0x27')](_0xfc94('0x134'),FILES_PATH,rs['generate'](0x4));var _0x172d85=util[_0xfc94('0x27')]('%s.%s',_0x2f49de,_0xa0ca13);var _0x1efbcc=!![];if(_0x13fbff[_0xfc94('0x12d')]==='NOBEEP'){_0x1efbcc=![];}var _0x28952b=this['channel']['recordFile'](_0x2f49de,_0xa0ca13,_0x13fbff['intKey'],_0x13fbff[_0xfc94('0x5f')],undefined,_0x1efbcc);if(_0x28952b['result']!==-0x1){this[_0xfc94('0xb')]['noop'](util['format'](_0xfc94('0x135'),_0x172d85));var _0x546316=this['tildeASR'][_0xfc94('0x67')](this,_0x13fbff,_0x172d85);if(_0x546316){for(var _0xf9c5c8 in _0x546316){if(_0x546316[_0xfc94('0x96')](_0xf9c5c8)){this['channel'][_0xfc94('0xa2')](util[_0xfc94('0x27')]('TILDE_ASR_%s',_0xf9c5c8[_0xfc94('0x62')]()),_0x546316[_0xf9c5c8]);}}return this['channel']['noop'](util[_0xfc94('0x27')](_0xfc94('0x136'),JSON['stringify'](_0x546316)));}}return _0x28952b;};AGIVertices['prototype'][_0xfc94('0x137')]=function(_0x56d376){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x138'),_0x56d376[_0xfc94('0x33')]));return this[_0xfc94('0xb')][_0xfc94('0x139')](_0x56d376[_0xfc94('0x39')],_0x56d376[_0xfc94('0x13a')],_0x56d376[_0xfc94('0x3a')]);};AGIVertices[_0xfc94('0xc')][_0xfc94('0x13b')]=function(_0x510696){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x510696['label']));if(!this[_0xfc94('0x80')](_0x510696['condition'])){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x510696,_0xfc94('0x13c'));}try{var _0x2eb20e=eval(_0x510696[_0xfc94('0x13d')])?_0xfc94('0x13e'):_0xfc94('0x13f');this['channel'][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x140'),_0x510696['condition'],_0x2eb20e));return{'code':0xc8,'result':_0x2eb20e};}catch(_0x3044d1){return{'code':0xc8,'result':_0xfc94('0x13f')};}};AGIVertices[_0xfc94('0xc')][_0xfc94('0x141')]=function(_0x3f60d9){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x3f60d9['label']));if(!this[_0xfc94('0x80')](_0x3f60d9['interval_id'])){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x3f60d9,_0xfc94('0x142'));}var _0x3a6455=this[_0xfc94('0x22')][_0xfc94('0x67')](this,_0x3f60d9[_0xfc94('0x143')]);if(!_0x3a6455){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x3f60d9,'no\x20intervals\x20found');}for(var _0x4fc739=0x0;_0x4fc739<_0x3a6455['length'];_0x4fc739+=0x1){var _0x5a9a26=this[_0xfc94('0xb')][_0xfc94('0xd')](util[_0xfc94('0x27')](_0xfc94('0x144'),_0x3a6455[_0x4fc739]));if(_0x5a9a26[_0xfc94('0xa0')]===-0x1){return _0x5a9a26;}logger['info'](util['format'](_0xfc94('0x145'),_0x3a6455[_0x4fc739],_0x5a9a26[_0xfc94('0x9f')]));if(_0x5a9a26[_0xfc94('0x9f')]===_0xfc94('0x13e')){logger[_0xfc94('0x2b')](util['format'](_0xfc94('0x145'),_0x3a6455[_0x4fc739],_0xfc94('0x13e')));this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x145'),_0x3a6455[_0x4fc739],_0xfc94('0x13e')));return{'code':0xc8,'result':_0xfc94('0x13e')};}else{logger['info'](util[_0xfc94('0x27')](_0xfc94('0x145'),_0x3a6455[_0x4fc739],_0xfc94('0x13f')));this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x145'),_0x3a6455[_0x4fc739],'false'));}}return{'code':0xc8,'result':_0xfc94('0x13f')};};AGIVertices[_0xfc94('0xc')][_0xfc94('0x146')]=function(_0x3c6277){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x147'),_0x3c6277[_0xfc94('0x33')]));return this[_0xfc94('0xb')][_0xfc94('0x146')]();};AGIVertices[_0xfc94('0xc')][_0xfc94('0x148')]=function(_0x3d9d74){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x149'),_0x3d9d74['label']));if(!this[_0xfc94('0x80')](_0x3d9d74['key'])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xe2'));}var _0x562ee9=_0xfc94('0x12c');var _0x3807cb=util['format'](_0xfc94('0x134'),FILES_PATH,rs[_0xfc94('0x114')](0x4));var _0x1957b3=util['format'](_0xfc94('0x9b'),_0x3807cb,_0x562ee9);var _0x6b6ad=!![];if(_0x3d9d74['beep']===_0xfc94('0x14a')){_0x6b6ad=![];}var _0x3b0b4a=this[_0xfc94('0xb')][_0xfc94('0x12e')](_0x3807cb,_0x562ee9,_0x3d9d74['intKey'],_0x3d9d74[_0xfc94('0x5f')],undefined,_0x6b6ad);if(_0x3b0b4a['result']!==-0x1){this['channel'][_0xfc94('0xa5')](util[_0xfc94('0x27')]('ispeech\x20%s\x20file\x20created',_0x1957b3));var _0x570427=this[_0xfc94('0x7e')][_0xfc94('0x67')](this,_0x3d9d74,_0x1957b3);if(_0x570427){for(var _0x14c2ba in _0x570427){if(_0x570427['hasOwnProperty'](_0x14c2ba)){this[_0xfc94('0xb')][_0xfc94('0xa2')](util[_0xfc94('0x27')](_0xfc94('0x14b'),_0x14c2ba['toUpperCase']()),_0x570427[_0x14c2ba]);}}return this['channel'][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x14c'),JSON[_0xfc94('0x6b')](_0x570427)));}}return _0x3b0b4a;};AGIVertices[_0xfc94('0xc')]['ispeechtts']=function(_0x1fd3ce){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x14d'),_0x1fd3ce[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x1fd3ce[_0xfc94('0x73')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xe2'));}if(!this[_0xfc94('0x80')](_0x1fd3ce[_0xfc94('0x55')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')]('no\x20text\x20configured');}this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')]('Trying\x20ispeech\x20TTS\x20%s',_0x1fd3ce[_0xfc94('0x55')]));var _0x38a653=this[_0xfc94('0x7b')][_0xfc94('0x67')](this,_0x1fd3ce);if(_0x38a653){this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x14e'),_0x38a653));var _0x635870=this[_0xfc94('0xb')][_0xfc94('0x11f')](_0x38a653,_0x1fd3ce[_0xfc94('0x12f')]);try{fs[_0xfc94('0x120')](_0x38a653+_0xfc94('0x121'));}catch(_0x1c0a64){logger[_0xfc94('0x2a')](_0x1c0a64);}return _0x635870;}return this['channel'][_0xfc94('0x2a')](_0x1fd3ce,_0xfc94('0x14f'));};AGIVertices[_0xfc94('0xc')]['login']=function(_0x591c32){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x150'),_0x591c32[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x591c32[_0xfc94('0x151')])){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x591c32,'no\x20find\x20by\x20configured');}logger[_0xfc94('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xfc94('0xb')]['callerid'],_0x591c32[_0xfc94('0x151')]));var _0x3f6a46=this[_0xfc94('0x4d')][_0xfc94('0x67')](this,_0x591c32[_0xfc94('0x151')]);if(_0x3f6a46){logger[_0xfc94('0x2b')](util['format'](_0xfc94('0x152'),this[_0xfc94('0xb')][_0xfc94('0x37')],_0x591c32['findBy']));this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x152'),this[_0xfc94('0xb')][_0xfc94('0x37')],_0x591c32[_0xfc94('0x151')]));return{'code':0xc8,'result':_0xfc94('0x153')};}else{logger['info'](util[_0xfc94('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfc94('0xb')][_0xfc94('0x37')],_0x591c32[_0xfc94('0x151')]));this[_0xfc94('0xb')][_0xfc94('0xa5')](util['format'](_0xfc94('0x154'),this[_0xfc94('0xb')][_0xfc94('0x37')],_0x591c32[_0xfc94('0x151')]));return{'code':0xc8,'result':_0xfc94('0x155')};}};AGIVertices[_0xfc94('0xc')][_0xfc94('0x156')]=function(_0x123485){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x157'),_0x123485[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x123485[_0xfc94('0x151')])){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x123485,_0xfc94('0x158'));}logger[_0xfc94('0x2b')](util['format'](_0xfc94('0x159'),this['channel'][_0xfc94('0x37')],_0x123485['findBy']));var _0x56efcd=this[_0xfc94('0x4c')]['sync'](this,_0x123485[_0xfc94('0x151')]);if(_0x56efcd){logger[_0xfc94('0x2b')](util['format'](_0xfc94('0x152'),this[_0xfc94('0xb')][_0xfc94('0x37')],_0x123485[_0xfc94('0x151')]));this[_0xfc94('0xb')]['noop'](util[_0xfc94('0x27')](_0xfc94('0x152'),this[_0xfc94('0xb')]['callerid'],_0x123485[_0xfc94('0x151')]));return{'code':0xc8,'result':_0xfc94('0x153')};}else{logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x154'),this['channel']['callerid'],_0x123485[_0xfc94('0x151')]));this[_0xfc94('0xb')]['noop'](util[_0xfc94('0x27')](_0xfc94('0x154'),this['channel'][_0xfc94('0x37')],_0x123485[_0xfc94('0x151')]));return{'code':0xc8,'result':_0xfc94('0x155')};}};AGIVertices[_0xfc94('0xc')]['math']=function(_0xb8b216){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x15a'),_0xb8b216[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0xb8b216[_0xfc94('0x15b')])){return this[_0xfc94('0xb')]['error'](_0xb8b216,_0xfc94('0x15c'));}this['channel']['noop'](util[_0xfc94('0x27')](_0xfc94('0x15d'),_0xb8b216[_0xfc94('0x15b')]));var _0x476176=eval(_0xb8b216[_0xfc94('0x15b')]);if(!this[_0xfc94('0x80')](_0xb8b216[_0xfc94('0xd4')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xd5'));}var _0x1206cf=this[_0xfc94('0xd')][_0xfc94('0x67')](this,_0xb8b216[_0xfc94('0xd4')]);if(!_0x1206cf){return this['channel'][_0xfc94('0x2a')](_0xb8b216,_0xfc94('0xd6'));}if(_['isArray'](_0x476176)){var _0x3bbf39=this;_0x476176[_0xfc94('0xd7')](function(_0x3513c1,_0x49eebb){_0x3bbf39[_0xfc94('0xb')][_0xfc94('0xa2')](util[_0xfc94('0x27')]('%s[%s]',_0x1206cf,_0x49eebb),_0x3513c1);});return this['channel'][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x15e'),_0x1206cf));}else{return this[_0xfc94('0xb')][_0xfc94('0xa2')](_0x1206cf,_0x476176);}};AGIVertices[_0xfc94('0xc')]['menu']=function(_0x561cc8){logger[_0xfc94('0x2b')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x561cc8[_0xfc94('0x33')]));if(_0x561cc8[_0xfc94('0xa4')]===0x0){return this[_0xfc94('0xa3')](_0x561cc8);}_0x561cc8[_0xfc94('0xa4')]-=0x1;if(!this[_0xfc94('0x80')](_0x561cc8[_0xfc94('0x10e')])){return this[_0xfc94('0xb')]['error'](_0x561cc8,_0xfc94('0x15f'));}var _0x1bd58f=this[_0xfc94('0x1b')][_0xfc94('0x67')](this,_0x561cc8['file_id']);if(!_0x1bd58f){return this['channel'][_0xfc94('0x2a')](_0x561cc8,'no\x20file\x20audio\x20found');}var _0x3b7168=this['channel'][_0xfc94('0x10f')](_0x1bd58f,_0x561cc8[_0xfc94('0x110')],_0x561cc8[_0xfc94('0x160')]);var _0x59cc10=_0x3b7168[_0xfc94('0xa0')];if(_0x3b7168[_0xfc94('0xa0')]===-0x1){this['createSquareDetailsReport'][_0xfc94('0x67')](this,_0x561cc8,'-1');return _0x3b7168;}else if(_0x3b7168[_0xfc94('0x9f')]===_0xfc94('0x5f')){_0x3b7168[_0xfc94('0xa0')]=_0x3b7168[_0xfc94('0xa0')][_0xfc94('0x9a')]>0x0?_0x3b7168['result']:'t';}else if(_[_0xfc94('0x3f')](_0x3b7168[_0xfc94('0xa0')])){_0x3b7168['result']='#';_0x59cc10='#';}if(!this['isConfigured'](_0x561cc8[_0xfc94('0xd4')])){this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0xd5'));}else{var _0x3f68f3=this[_0xfc94('0xd')][_0xfc94('0x67')](this,_0x561cc8['variable_id']);if(!_0x3f68f3){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x561cc8,_0xfc94('0xd6'));}this[_0xfc94('0xb')][_0xfc94('0xa2')](_0x3f68f3,_0x59cc10);}this[_0xfc94('0x32')][_0xfc94('0x67')](this,_0x561cc8,_0x59cc10);return _0x3b7168;};AGIVertices[_0xfc94('0xc')]['noop']=function(_0x1731a5){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x161'),_0x1731a5[_0xfc94('0x33')]));return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0x1731a5[_0xfc94('0x162')]||_0x1731a5['label']);};AGIVertices[_0xfc94('0xc')][_0xfc94('0x163')]=function(_0x3155be){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x164'),_0x3155be[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x3155be['findBy'])){return this['channel'][_0xfc94('0x2a')](_0x3155be,'no\x20find\x20by\x20configured');}logger[_0xfc94('0x2b')](util[_0xfc94('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xfc94('0xb')][_0xfc94('0x37')],_0x3155be['findBy']));var _0x3e5147=this['getPause']['sync'](this,_0x3155be[_0xfc94('0x165')]);var _0x2cea3d=this[_0xfc94('0x49')][_0xfc94('0x67')](this,_0x3155be[_0xfc94('0x151')],_0x3e5147);if(_0x2cea3d){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfc94('0xb')][_0xfc94('0x37')],_0x3155be[_0xfc94('0x151')]));this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfc94('0xb')]['callerid'],_0x3155be[_0xfc94('0x151')]));return{'code':0xc8,'result':_0xfc94('0x153')};}else{logger[_0xfc94('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfc94('0xb')][_0xfc94('0x37')],_0x3155be[_0xfc94('0x151')]));this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x152'),this[_0xfc94('0xb')]['callerid'],_0x3155be[_0xfc94('0x151')]));return{'code':0xc8,'result':_0xfc94('0x155')};}};AGIVertices[_0xfc94('0xc')][_0xfc94('0x166')]=function(_0x21d5c0){logger[_0xfc94('0x2b')](util['format'](_0xfc94('0x167'),_0x21d5c0[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x21d5c0[_0xfc94('0x10e')])){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x21d5c0,'no\x20file\x20audio\x20selected');}var _0x577d4b=this[_0xfc94('0x1b')][_0xfc94('0x67')](this,_0x21d5c0[_0xfc94('0x10e')]);if(!_0x577d4b){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x21d5c0,_0xfc94('0x168'));}var _0x1da540=this[_0xfc94('0xb')]['exec'](_0xfc94('0x169'),[_0x577d4b,_0x21d5c0[_0xfc94('0xe1')]]);if(_0x1da540[_0xfc94('0xa0')]===-0x1){return _0x1da540;}return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xc3'),_0xfc94('0x169'),_0x577d4b));};AGIVertices[_0xfc94('0xc')][_0xfc94('0x16a')]=function(_0x162dbf){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x16b'),_0x162dbf['label']));if(!this[_0xfc94('0x80')](_0x162dbf['queue_id'])){return this['channel'][_0xfc94('0x2a')](_0x162dbf,_0xfc94('0x16c'));}var _0x5a592f='';var _0x4c2184=parseInt(_0x162dbf[_0xfc94('0x16d')],0xa);if(isNaN(_0x4c2184)){_0x5a592f=_0x162dbf['queue_id'];}else{_0x5a592f=this['getVoiceQueue'][_0xfc94('0x67')](this,_0x162dbf[_0xfc94('0x16d')]);if(!_0x5a592f){return this['channel'][_0xfc94('0x2a')](_0x162dbf,_0xfc94('0x16e'));}}var _0x118066='';if(this[_0xfc94('0x80')](_0x162dbf[_0xfc94('0x10e')])){var _0x306520=this[_0xfc94('0x1b')][_0xfc94('0x67')](this,_0x162dbf['file_id']);if(_0x306520){_0x118066=_0x306520;}}this['createSquareDetailsReport'][_0xfc94('0x67')](this,_0x162dbf,_0x5a592f);if(_0x162dbf[_0xfc94('0xe1')]['indexOf']('x')<0x0){_0x162dbf['opts']+='x';}if(_0x162dbf[_0xfc94('0xe1')]['indexOf']('X')<0x0){_0x162dbf['opts']+='X';}this[_0xfc94('0xb')][_0xfc94('0xa2')](_0xfc94('0x16f'),_0x5a592f?_0x5a592f[_0xfc94('0x170')]():'');var _0x2ce64c=this[_0xfc94('0xb')][_0xfc94('0x51')](_0xfc94('0x171'),[_0x5a592f,_0x162dbf['opts'],_0x162dbf[_0xfc94('0x5d')],_0x118066,_0x162dbf['timeout'],_0x162dbf['agi'],_0x162dbf[_0xfc94('0x172')],_0x162dbf[_0xfc94('0x173')],'',_0x162dbf[_0xfc94('0x174')]]);if(_0x2ce64c[_0xfc94('0xa0')]===-0x1){return _0x2ce64c;}return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xc3'),'QUEUE',_0x5a592f));};AGIVertices[_0xfc94('0xc')]['record']=function(_0xd5da2a){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x175'),_0xd5da2a[_0xfc94('0x33')]));var _0x30e951=_0xd5da2a[_0xfc94('0x176')]||_0xfc94('0x12c');var _0x543451=util['format'](_0xfc94('0x177'),this[_0xfc94('0xb')][_0xfc94('0x45')],rs['generate'](0x5));var _0x4e2834=util['format'](_0xfc94('0x178'),FILES_PATH,_0x543451,_0x30e951);var _0x587074=util[_0xfc94('0x27')]('%s/recordings/%s',FILES_PATH,_0x543451);this[_0xfc94('0x36')][_0xfc94('0x67')](this,_0xd5da2a,_0x543451,_0x4e2834);this['channel'][_0xfc94('0xa2')](_0xfc94('0x179'),_0x543451);logger[_0xfc94('0x2b')](_0xfc94('0x17a'),_0x587074,_0x30e951,_0xd5da2a['escape_digits'],_0xd5da2a[_0xfc94('0x5f')]);return this[_0xfc94('0xb')][_0xfc94('0x12e')](_0x587074,_0x30e951,_0xd5da2a[_0xfc94('0x17b')],_0xd5da2a['timeout'],undefined,!![]);};AGIVertices[_0xfc94('0xc')][_0xfc94('0x17c')]=function(_0x182da2){logger[_0xfc94('0x2b')](util['format'](_0xfc94('0x17d'),_0x182da2[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x182da2[_0xfc94('0x5d')])){return this['channel'][_0xfc94('0xa5')](_0xfc94('0x17e'));}var _0x480f91=this[_0xfc94('0x5c')][_0xfc94('0x67')](this,_0x182da2);logger[_0xfc94('0x2b')](util['format'](_0xfc94('0x17f'),util[_0xfc94('0x180')](_0x480f91,{'showHidden':![],'depth':null})));if(!this[_0xfc94('0x80')](_0x182da2[_0xfc94('0xd4')])){return this[_0xfc94('0xb')]['noop'](_0xfc94('0x181'));}var _0x12c93f=this['getVariable'][_0xfc94('0x67')](this,_0x182da2[_0xfc94('0xd4')]);if(!_0x12c93f){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x182da2,'no\x20variable\x20found');}this[_0xfc94('0xb')][_0xfc94('0xa2')](util['format']('%s_STATUS_CODE',_0x12c93f),_0x480f91['statusCode']?_0x480f91[_0xfc94('0x6e')]:_0xfc94('0x182'));this[_0xfc94('0xb')][_0xfc94('0xa2')](util[_0xfc94('0x27')]('%s_STATUS_MESSAGE',_0x12c93f),_0x480f91[_0xfc94('0x6f')]?_0x480f91['statusMessage']:'OK');if(_0x480f91[_0xfc94('0x6c')]){try{this[_0xfc94('0x99')](_0x480f91['body'],_0x12c93f);}catch(_0x5bb1ea){logger['error'](util[_0xfc94('0x27')](_0xfc94('0x183'),_0x12c93f));}}return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')]('variable\x20%s\x20set',_0x12c93f));};AGIVertices[_0xfc94('0xc')][_0xfc94('0x184')]=function(_0x285a42){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x185'),_0x285a42[_0xfc94('0x33')]));return this['channel'][_0xfc94('0x186')](_0x285a42[_0xfc94('0x187')][_0xfc94('0x52')](/\s+/g,''),_0x285a42[_0xfc94('0x17b')]);};AGIVertices['prototype'][_0xfc94('0x188')]=function(_0x380d06){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x189'),_0x380d06[_0xfc94('0x33')]));return this[_0xfc94('0xb')][_0xfc94('0x18a')](_0x380d06['number'][_0xfc94('0x52')](/\s+/g,''),_0x380d06[_0xfc94('0x17b')]);};AGIVertices['prototype']['sayphonetic']=function(_0x4fdf90){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x18b'),_0x4fdf90[_0xfc94('0x33')]));return this['channel'][_0xfc94('0x18c')](_0x4fdf90[_0xfc94('0x55')],_0x4fdf90[_0xfc94('0x17b')]);};AGIVertices[_0xfc94('0xc')]['sendMail']=function(_0x4fce38){logger[_0xfc94('0x2b')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x4fce38[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x4fce38[_0xfc94('0x18d')])){return this['channel'][_0xfc94('0xa5')](_0xfc94('0x18e'));}var _0x235fda=this[_0xfc94('0x1e')][_0xfc94('0x67')](this,_0x4fce38[_0xfc94('0x18d')]);if(!_0x235fda||!_0x235fda[_0xfc94('0x18f')]){return this['channel'][_0xfc94('0x2a')](_0x4fce38,_0xfc94('0x190'));}var _0x2d5a99={'from':util['format'](_0xfc94('0x191'),_0x235fda[_0xfc94('0x10')],_0x235fda[_0xfc94('0x192')]||_0x235fda['Smtp']['user']),'to':_0x4fce38['to']||'','cc':_0x4fce38['cc']||'','bcc':_0x4fce38[_0xfc94('0x193')]||'','subject':_0x4fce38[_0xfc94('0x194')],'html':_0x4fce38[_0xfc94('0x55')],'text':_0x4fce38[_0xfc94('0x55')]};if(this[_0xfc94('0x80')](_0x4fce38['template_id'])){}logger[_0xfc94('0x195')]('sendMail\x20message',JSON[_0xfc94('0x6b')](_0x2d5a99));this[_0xfc94('0x32')][_0xfc94('0x67')](this,_0x4fce38,_0x4fce38[_0xfc94('0x18d')]);this[_0xfc94('0xb')][_0xfc94('0xa5')](util['format'](_0xfc94('0x196'),_0x235fda['name']));this[_0xfc94('0x20')][_0xfc94('0x67')](this,_0x235fda[_0xfc94('0x197')],_0x2d5a99);return this[_0xfc94('0xb')][_0xfc94('0xa5')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xfc94('0xc')][_0xfc94('0x198')]=function(_0xdbdc9d){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x199'),_0xdbdc9d[_0xfc94('0x33')]));return this[_0xfc94('0xb')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xfc94('0xc')][_0xfc94('0x19a')]=function(_0x1d1f82){logger['info'](util[_0xfc94('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x1d1f82[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x1d1f82[_0xfc94('0x19b')])){return this[_0xfc94('0xb')][_0xfc94('0xa5')](_0xfc94('0x19c'));}var _0x3b2121=this[_0xfc94('0x30')][_0xfc94('0x67')](this,_0x1d1f82[_0xfc94('0x19b')]);if(!_0x3b2121){return this['channel'][_0xfc94('0x2a')](_0x1d1f82,_0xfc94('0x19d'));}var _0xc3820e={'body':_0x1d1f82[_0xfc94('0x19e')],'phone':_0x1d1f82['to']||'','SmsAccountId':_0x3b2121['id']};logger[_0xfc94('0x195')](_0xfc94('0x19f'),JSON['stringify'](_0xc3820e));this[_0xfc94('0x32')]['sync'](this,_0x1d1f82,_0x1d1f82[_0xfc94('0x19b')]);this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x1a0'),_0x3b2121[_0xfc94('0x10')]));this[_0xfc94('0x1a1')][_0xfc94('0x67')](this,_0xc3820e);return this[_0xfc94('0xb')]['noop'](_0xfc94('0x1a2'));};AGIVertices[_0xfc94('0xc')][_0xfc94('0x1a3')]=function(_0x10ca44){logger['info'](util[_0xfc94('0x27')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x10ca44[_0xfc94('0x33')]));if(!this['isConfigured'](_0x10ca44[_0xfc94('0xd4')])){return this[_0xfc94('0xb')]['error'](_0x10ca44,'no\x20variable\x20selected');}var _0x95151a=this[_0xfc94('0xd')][_0xfc94('0x67')](this,_0x10ca44[_0xfc94('0xd4')]);if(!_0x95151a){return this['channel'][_0xfc94('0x2a')](_0x10ca44,_0xfc94('0xd6'));}return this[_0xfc94('0xb')][_0xfc94('0xa2')](_0x95151a,_0x10ca44[_0xfc94('0x1a4')]);};AGIVertices[_0xfc94('0xc')]['start']=function(_0x760a1){logger['info'](util[_0xfc94('0x27')](_0xfc94('0x1a5'),_0x760a1[_0xfc94('0x33')]));this[_0xfc94('0xb')]['noop']('START\x20CALLY\x20SQUARE');if(_0x760a1['answer']===_0xfc94('0x1a6')){this['channel'][_0xfc94('0xa5')](_0xfc94('0x1a7'));return this['channel'][_0xfc94('0xb7')]();}return this['channel'][_0xfc94('0xa5')]('Skipped\x20Answer');};AGIVertices[_0xfc94('0xc')][_0xfc94('0x1a8')]=function(_0x27c013){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x1a9'),_0x27c013[_0xfc94('0x33')]));if(!this['isConfigured'](_0x27c013[_0xfc94('0x1aa')])){return this['channel']['error'](_0x27c013,'no\x20subproject\x20selected');}var _0x5f4117=this['getSquareProject']['sync'](this,_0x27c013[_0xfc94('0x1aa')]);if(!this[_0xfc94('0x80')](_0x5f4117)){return this['channel'][_0xfc94('0x2a')](_0x27c013,util[_0xfc94('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x27c013['project_id']));}if(_0x5f4117===this[_0xfc94('0xb')][_0xfc94('0x35')]){return this['channel']['error'](_0x27c013,_0xfc94('0x1ab'));}this[_0xfc94('0x32')][_0xfc94('0x67')](this,_0x27c013,_0x5f4117);var _0x4a66f9=this['channel'][_0xfc94('0x51')](_0xfc94('0x1ac'),util['format'](_0xfc94('0x1ad'),config[_0xfc94('0x6')][_0xfc94('0x1ae')]||'127.0.0.1',_0x5f4117,this[_0xfc94('0xb')][_0xfc94('0x35')]));if(_0x4a66f9['result']===-0x1){return _0x4a66f9;}return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xc3'),_0xfc94('0x1ac'),_0x5f4117));};AGIVertices[_0xfc94('0xc')][_0xfc94('0x1af')]=function(_0x4a985c){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4a985c[_0xfc94('0x33')]));var _0x19a09b=this[_0xfc94('0x1b0')][_0xfc94('0x67')](this,_0x4a985c[_0xfc94('0xb5')]);this['createSquareDetailsReport'][_0xfc94('0x67')](this,_0x4a985c,_0x4a985c['command']);if(this[_0xfc94('0x80')](_0x4a985c[_0xfc94('0xd4')])){var _0x630bc2=this[_0xfc94('0xd')][_0xfc94('0x67')](this,_0x4a985c[_0xfc94('0xd4')]);if(_0x630bc2){this[_0xfc94('0xb')][_0xfc94('0xa2')](_0x630bc2,_0x19a09b);return this['channel'][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x1b1'),_0x4a985c[_0xfc94('0xb5')],_0x630bc2));}}return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0x1b2'),_0x4a985c[_0xfc94('0xb5')]));};AGIVertices[_0xfc94('0xc')][_0xfc94('0x1b3')]=function(_0x3b3d28){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x1b4'),_0x3b3d28[_0xfc94('0x33')]));_0x3b3d28[_0xfc94('0x55')]=_0x3b3d28[_0xfc94('0x55')][_0xfc94('0x52')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfc94('0x80')](_0x3b3d28['apiKey'])){return this[_0xfc94('0xb')]['noop'](_0xfc94('0x1b5'));}if(!this['isConfigured'](_0x3b3d28[_0xfc94('0x55')])){return this[_0xfc94('0xb')]['noop']('no\x20text\x20configured');}this[_0xfc94('0xb')]['noop'](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x3b3d28[_0xfc94('0x55')]));var _0x2f22fc=this[_0xfc94('0x53')]['sync'](this,_0x3b3d28);if(_0x2f22fc){this['channel']['noop'](util[_0xfc94('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2f22fc));var _0x5600f4=this[_0xfc94('0xb')][_0xfc94('0x11f')](_0x2f22fc);try{fs[_0xfc94('0x120')](_0x2f22fc+_0xfc94('0x121'));}catch(_0x49273a){logger[_0xfc94('0x2a')](_0x49273a);}return _0x5600f4;}return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x3b3d28,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xfc94('0xc')][_0xfc94('0x1b6')]=function(_0x2ddf71){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x1b7'),_0x2ddf71['label']));_0x2ddf71['text']=_0x2ddf71[_0xfc94('0x55')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfc94('0x80')](_0x2ddf71[_0xfc94('0x55')])){return this['channel']['noop'](_0xfc94('0xa6'));}this[_0xfc94('0xb')][_0xfc94('0xa5')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x2ddf71[_0xfc94('0x55')]));var _0x14f415=this[_0xfc94('0x5a')][_0xfc94('0x67')](this,_0x2ddf71);if(_0x14f415){this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')]('Google\x20TTS\x20%s\x20file\x20created',_0x14f415));var _0x71c66=this[_0xfc94('0xb')][_0xfc94('0x11f')](_0x14f415);try{fs[_0xfc94('0x120')](_0x14f415+'.wav');}catch(_0x12eccd){logger['error'](_0x12eccd);}return _0x71c66;}return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x2ddf71,_0xfc94('0x1b8'));};AGIVertices[_0xfc94('0xc')]['unpause']=function(_0x2c0ca3){logger[_0xfc94('0x2b')](util['format'](_0xfc94('0x1b9'),_0x2c0ca3[_0xfc94('0x33')]));if(!this[_0xfc94('0x80')](_0x2c0ca3[_0xfc94('0x151')])){return this['channel'][_0xfc94('0x2a')](_0x2c0ca3,'no\x20find\x20by\x20configured');}logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x159'),this[_0xfc94('0xb')][_0xfc94('0x37')],_0x2c0ca3[_0xfc94('0x151')]));var _0x115526=this['agentUnpause'][_0xfc94('0x67')](this,_0x2c0ca3[_0xfc94('0x151')]);if(_0x115526){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')](_0xfc94('0x152'),this[_0xfc94('0xb')][_0xfc94('0x37')],_0x2c0ca3[_0xfc94('0x151')]));this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xfc94('0xb')][_0xfc94('0x37')],_0x2c0ca3[_0xfc94('0x151')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfc94('0xb')][_0xfc94('0x37')],_0x2c0ca3['findBy']));this[_0xfc94('0xb')][_0xfc94('0xa5')](util['format'](_0xfc94('0x154'),this[_0xfc94('0xb')][_0xfc94('0x37')],_0x2c0ca3[_0xfc94('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xfc94('0xc')][_0xfc94('0x1ba')]=function(_0x35339b){logger[_0xfc94('0x2b')](util[_0xfc94('0x27')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x35339b['label']));var _0x100d46=this[_0xfc94('0xb')][_0xfc94('0x51')](_0xfc94('0x1bb'),[_0x35339b[_0xfc94('0x1bc')],_0x35339b['options']]);if(_0x100d46[_0xfc94('0xa0')]===-0x1){return _0x100d46;}return this[_0xfc94('0xb')][_0xfc94('0xa5')](util[_0xfc94('0x27')](_0xfc94('0xc3'),'VOICEMAIL',_0x35339b['mailbox']));};AGIVertices[_0xfc94('0xc')]['vswitch']=function(_0x48e048){logger[_0xfc94('0x2b')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x48e048['label']));if(!this['isConfigured'](_0x48e048[_0xfc94('0xd4')])){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x48e048,_0xfc94('0x1bd'));}var _0x37aa5d=this[_0xfc94('0xd')][_0xfc94('0x67')](this,_0x48e048[_0xfc94('0xd4')]);if(!_0x37aa5d){return this[_0xfc94('0xb')][_0xfc94('0x2a')](_0x48e048,'no\x20variable\x20found');}var _0x31f257=this[_0xfc94('0xb')]['getVariable'](_0x37aa5d);return{'code':0xc8,'result':_0x31f257[_0xfc94('0x9f')]?_0x31f257[_0xfc94('0x9f')]:'-'};};String[_0xfc94('0xc')][_0xfc94('0x9e')]=function(_0x3d214b,_0x18ec67){return this[_0xfc94('0x9d')](_0x3d214b)[_0xfc94('0x1be')](_0x18ec67);};module[_0xfc94('0x1bf')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3ef4707..f0c15af 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 _0x4feb=['blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','interface','queue','mandatoryDisposition','name','mandatoryDispositionPause','QueuePause','getAgent','then','voicePause','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','acw','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer'];(function(_0x3541f9,_0x4ad57c){var _0x3ddcf0=function(_0x1724a0){while(--_0x1724a0){_0x3541f9['push'](_0x3541f9['shift']());}};_0x3ddcf0(++_0x4ad57c);}(_0x4feb,0x8d));var _0xb4fe=function(_0x3ad4d0,_0x2f5348){_0x3ad4d0=_0x3ad4d0-0x0;var _0x41fdd1=_0x4feb[_0x3ad4d0];return _0x41fdd1;};'use strict';var _=require(_0xb4fe('0x0'));var moment=require(_0xb4fe('0x1'));var ami=require(_0xb4fe('0x2'));var logger=require(_0xb4fe('0x3'))('acw');var RpcUser=require(_0xb4fe('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x2e8d42){this[_0xb4fe('0x5')]=_0x2e8d42[_0xb4fe('0x5')];this['agents']=_0x2e8d42[_0xb4fe('0x6')];this[_0xb4fe('0x7')]=_0x2e8d42[_0xb4fe('0x7')];this[_0xb4fe('0x8')]={};ami['on'](_0xb4fe('0x9'),this['syncAgentConnect'][_0xb4fe('0xa')](this));ami['on'](_0xb4fe('0xb'),this[_0xb4fe('0xc')][_0xb4fe('0xa')](this));ami['on']('hangup',this['syncHangup'][_0xb4fe('0xa')](this));ami['on'](_0xb4fe('0xd'),this[_0xb4fe('0xe')][_0xb4fe('0xa')](this));ami['on'](_0xb4fe('0xf'),this[_0xb4fe('0x10')][_0xb4fe('0xa')](this));ami['on'](_0xb4fe('0x11'),this[_0xb4fe('0x12')][_0xb4fe('0xa')](this));ami['on'](_0xb4fe('0x13'),this[_0xb4fe('0x14')][_0xb4fe('0xa')](this));}function getDiff(_0x43169a){var _0x535d7c=moment()[_0xb4fe('0x15')](0x0);var _0x21f585=moment(_0x43169a)[_0xb4fe('0x15')](0x0);return _0x535d7c[_0xb4fe('0x16')](_0x21f585,'seconds');}Acw[_0xb4fe('0x17')]['startAcw']=function(_0x34677f){try{var _0x1928fe=this;var _0x5b8733=this[_0xb4fe('0x8')][_0x34677f][_0xb4fe('0x18')];var _0x339b76=this[_0xb4fe('0x8')][_0x34677f][_0xb4fe('0x19')];var _0x468b8c=this[_0xb4fe('0x5')][_0x339b76];var _0x2eb6cd=![];var _0x5eac6f='ACW';if(_0x468b8c[_0xb4fe('0x1a')]){if(_0x468b8c['mandatoryDispositionPause'][_0xb4fe('0x1b')]){_0x2eb6cd=!![];_0x5eac6f=_0x468b8c[_0xb4fe('0x1c')][_0xb4fe('0x1b')];}}return ami['Action']({'action':_0xb4fe('0x1d'),'interface':_0x5b8733,'paused':!![],'reason':_0x5eac6f})['then'](function(){if(_0x1928fe[_0xb4fe('0x6')][_0x5b8733]){return RpcUser[_0xb4fe('0x1e')](_0x1928fe[_0xb4fe('0x6')][_0x5b8733]['id'])[_0xb4fe('0x1f')](function(_0x4e8582){if(_0x4e8582&&!_0x4e8582[_0xb4fe('0x20')]){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x34677f,_0x5b8733,_0x339b76);var _0x3a785d=_0x1928fe[_0xb4fe('0x8')][_0x34677f][_0xb4fe('0x21')]&&_0x1928fe[_0xb4fe('0x8')][_0x34677f]['destlinkedid']?_0x1928fe['channels'][_0x34677f][_0xb4fe('0x22')]:_0x34677f;return RpcUser[_0xb4fe('0x23')](_0x1928fe['agents'][_0x5b8733],_0x5eac6f,_0x3a785d)[_0xb4fe('0x1f')](function(){if(!_0x2eb6cd){_0x1928fe['timers'][_0x5b8733]={};logger[_0xb4fe('0x24')](_0xb4fe('0x25'),_0x34677f,_0x1928fe['voiceQueues'][_0x339b76]['acwTimeout'],_0x5b8733,_0x339b76);_0x1928fe[_0xb4fe('0x7')][_0x5b8733][_0xb4fe('0x26')]=setTimeout(_0x1928fe[_0xb4fe('0x27')][_0xb4fe('0xa')](_0x1928fe,_0x5b8733),_0x1928fe[_0xb4fe('0x5')][_0x339b76]['acwTimeout']*0x3e8);_0x1928fe[_0xb4fe('0x7')][_0x5b8733][_0xb4fe('0x28')]=moment()[_0xb4fe('0x29')](_0xb4fe('0x2a'));_0x1928fe[_0xb4fe('0x7')][_0x5b8733][_0xb4fe('0x2b')]=_0x34677f;_0x1928fe[_0xb4fe('0x7')][_0x5b8733][_0xb4fe('0x19')]=_0x339b76;_0x1928fe['timers'][_0x5b8733][_0xb4fe('0x2c')]=function(){var _0xc81861=getDiff(_0x1928fe[_0xb4fe('0x7')][_0x5b8733][_0xb4fe('0x28')]);clearTimeout(_0x1928fe[_0xb4fe('0x7')][_0x5b8733][_0xb4fe('0x26')]);_0x1928fe['timers'][_0x5b8733][_0xb4fe('0x26')]=![];RpcVoiceAgentReport['update']({'acwtime':_0xc81861},_0x1928fe[_0xb4fe('0x7')][_0x5b8733][_0xb4fe('0x2b')],_0x5b8733)[_0xb4fe('0x1f')](function(_0x309002){logger['info'](_0xb4fe('0x2d'),_0x34677f,_0xc81861,_0x309002);})[_0xb4fe('0x2e')](function(_0x2f038e){logger[_0xb4fe('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x34677f,_0x2f038e);});delete _0x1928fe[_0xb4fe('0x7')][_0x5b8733];};}});}else{logger[_0xb4fe('0x24')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x34677f,_0x5b8733,_0x339b76);}});}})['catch'](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x34677f,_0x1928fe[_0xb4fe('0x5')][_0x339b76]['acwTimeout'],_0x5b8733,_0x339b76);})['finally'](function(){delete _0x1928fe['channels'][_0x34677f];});}catch(_0x15ee2f){logger[_0xb4fe('0x2f')](_0xb4fe('0x30'),_0x15ee2f[_0xb4fe('0x31')]);}};Acw['prototype'][_0xb4fe('0x27')]=function(_0x17bfac){try{var _0x14206c=this;if(_0x14206c[_0xb4fe('0x7')][_0x17bfac]){_0x14206c[_0xb4fe('0x7')][_0x17bfac]['timer']=![];var _0x4f55d0=_0x14206c[_0xb4fe('0x7')][_0x17bfac][_0xb4fe('0x2b')];var _0x20edc7=_0x14206c['timers'][_0x17bfac][_0xb4fe('0x19')];var _0x1682f0=_0x14206c[_0xb4fe('0x5')][_0x20edc7]['acwTimeout'];logger[_0xb4fe('0x24')](_0xb4fe('0x32'),_0x4f55d0,_0x17bfac);RpcUser['saveUnpause'](this[_0xb4fe('0x6')][_0x17bfac]);RpcVoiceAgentReport[_0xb4fe('0x33')]({'acwtime':_0x1682f0,'agentacw':!![]},_0x4f55d0,_0x17bfac)[_0xb4fe('0x1f')](function(_0x5076e8){logger[_0xb4fe('0x24')]('[%s][UPDATE][ACWTIME:%s]',_0x4f55d0,_0x1682f0,_0x5076e8);})[_0xb4fe('0x2e')](function(_0x46d6e1){logger[_0xb4fe('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x4f55d0,_0x46d6e1);});}else{logger[_0xb4fe('0x2f')](_0xb4fe('0x34'),_0x17bfac);if(_0x14206c['timers']){logger[_0xb4fe('0x24')](_0xb4fe('0x35'),JSON[_0xb4fe('0x36')](_0x14206c[_0xb4fe('0x7')]));}}}catch(_0x11baeb){logger[_0xb4fe('0x2f')](_0xb4fe('0x37'),_0x11baeb['message']);}};Acw[_0xb4fe('0x17')][_0xb4fe('0x38')]=function(_0x4cf75f){try{if(this[_0xb4fe('0x5')][_0x4cf75f[_0xb4fe('0x19')]]&&(this[_0xb4fe('0x5')][_0x4cf75f[_0xb4fe('0x19')]][_0xb4fe('0x39')]||this[_0xb4fe('0x5')][_0x4cf75f[_0xb4fe('0x19')]][_0xb4fe('0x1a')])){if(this['agents'][_0x4cf75f[_0xb4fe('0x18')]]){this['channels'][_0x4cf75f[_0xb4fe('0x2b')]]={'queue':_0x4cf75f[_0xb4fe('0x19')],'interface':_0x4cf75f[_0xb4fe('0x18')],'destlinkedid':_0x4cf75f[_0xb4fe('0x22')]};}}}catch(_0x47f89e){logger[_0xb4fe('0x2f')](_0xb4fe('0x3a'),_0x47f89e[_0xb4fe('0x31')]);}};Acw[_0xb4fe('0x17')][_0xb4fe('0x14')]=function(_0x3fe38e){try{if(this[_0xb4fe('0x5')][_0x3fe38e[_0xb4fe('0x19')]]&&(this['voiceQueues'][_0x3fe38e[_0xb4fe('0x19')]]['acw']||this['voiceQueues'][_0x3fe38e[_0xb4fe('0x19')]]['mandatoryDisposition'])){if(this[_0xb4fe('0x6')][_0x3fe38e[_0xb4fe('0x18')]]){this['channels'][_0x3fe38e[_0xb4fe('0x2b')]]={'queue':_0x3fe38e['queue'],'interface':_0x3fe38e['interface']};}}}catch(_0x59f06c){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x59f06c[_0xb4fe('0x31')]);}};Acw[_0xb4fe('0x17')][_0xb4fe('0xc')]=function(_0x5b4d79){try{if(this[_0xb4fe('0x8')][_0x5b4d79[_0xb4fe('0x2b')]]&&_[_0xb4fe('0x3b')](this[_0xb4fe('0x8')][_0x5b4d79['uniqueid']][_0xb4fe('0x21')])){logger['info'](_0xb4fe('0x3c'),_0x5b4d79[_0xb4fe('0x2b')]);this['startAcw'](_0x5b4d79[_0xb4fe('0x2b')]);}else if(this[_0xb4fe('0x8')][_0x5b4d79[_0xb4fe('0x3d')]]&&_[_0xb4fe('0x3b')](this['channels'][_0x5b4d79['linkedid']][_0xb4fe('0x21')])){logger[_0xb4fe('0x24')]('[%s][HANGUP:LINKEDID]',_0x5b4d79['linkedid']);this[_0xb4fe('0x3e')](_0x5b4d79[_0xb4fe('0x3d')]);}}catch(_0x4917f4){logger['error'](_0xb4fe('0x3f'),_0x4917f4[_0xb4fe('0x31')]);}};Acw['prototype']['syncHangup']=function(_0x39d7d6){try{if(this['channels'][_0x39d7d6['uniqueid']]&&this[_0xb4fe('0x8')][_0x39d7d6[_0xb4fe('0x2b')]]['attended']){logger[_0xb4fe('0x24')](_0xb4fe('0x40'),_0x39d7d6['uniqueid']);this[_0xb4fe('0x3e')](_0x39d7d6['uniqueid']);}else if(this[_0xb4fe('0x8')][_0x39d7d6['linkedid']]&&this[_0xb4fe('0x8')][_0x39d7d6[_0xb4fe('0x3d')]][_0xb4fe('0x21')]){logger[_0xb4fe('0x24')](_0xb4fe('0x41'),_0x39d7d6['linkedid']);this['startAcw'](_0x39d7d6[_0xb4fe('0x3d')]);}}catch(_0x12d950){logger[_0xb4fe('0x2f')]('[ACW][syncHangup]\x20%s',_0x12d950[_0xb4fe('0x31')]);}};Acw[_0xb4fe('0x17')][_0xb4fe('0x10')]=function(_0x10a98c){try{if(!_['isNil'](this[_0xb4fe('0x8')][_0x10a98c['transfereeuniqueid']])){this[_0xb4fe('0x3e')](_0x10a98c['transfereeuniqueid']);if(this[_0xb4fe('0x8')][_0x10a98c[_0xb4fe('0x42')]]){this[_0xb4fe('0x8')][_0x10a98c[_0xb4fe('0x42')]][_0xb4fe('0x21')]=!![];this[_0xb4fe('0x8')][_0x10a98c[_0xb4fe('0x43')]]=this[_0xb4fe('0x8')][_0x10a98c[_0xb4fe('0x42')]];delete this['channels'][_0x10a98c[_0xb4fe('0x42')]];}}else if(!_[_0xb4fe('0x44')](this['channels'][_0x10a98c[_0xb4fe('0x43')]])){this['startAcw'](_0x10a98c[_0xb4fe('0x43')]);if(this[_0xb4fe('0x8')][_0x10a98c[_0xb4fe('0x45')]]){this['channels'][_0x10a98c[_0xb4fe('0x45')]][_0xb4fe('0x21')]=!![];this[_0xb4fe('0x8')][_0x10a98c[_0xb4fe('0x46')]]=this[_0xb4fe('0x8')][_0x10a98c['origtransfereruniqueid']];delete this[_0xb4fe('0x8')][_0x10a98c['origtransfereruniqueid']];}}}catch(_0x261759){logger[_0xb4fe('0x2f')](_0xb4fe('0x47'),_0x261759[_0xb4fe('0x31')]);}};Acw[_0xb4fe('0x17')][_0xb4fe('0x12')]=function(_0x54f10c){try{if(this[_0xb4fe('0x8')][_0x54f10c[_0xb4fe('0x48')]]){logger[_0xb4fe('0x24')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x54f10c[_0xb4fe('0x48')]));this[_0xb4fe('0x3e')](_0x54f10c[_0xb4fe('0x48')]);}else if(this[_0xb4fe('0x8')][_0x54f10c['transfererlinkedid']]){logger[_0xb4fe('0x24')](_0xb4fe('0x49'),JSON[_0xb4fe('0x36')](_0x54f10c['transfererlinkedid']));this[_0xb4fe('0x3e')](_0x54f10c[_0xb4fe('0x4a')]);}}catch(_0x15f971){logger[_0xb4fe('0x2f')]('[ACW][syncBlindTransfer]\x20%s',_0x15f971[_0xb4fe('0x31')]);}};Acw[_0xb4fe('0x17')][_0xb4fe('0xe')]=function(_0x2747d7){try{if(this[_0xb4fe('0x5')][_0x2747d7[_0xb4fe('0x19')]]&&this[_0xb4fe('0x5')][_0x2747d7[_0xb4fe('0x19')]]['autopause']==='all'){if(this['agents'][_0x2747d7[_0xb4fe('0x18')]]){logger['info'](_0xb4fe('0x4b'),_0x2747d7['uniqueid'],_0x2747d7[_0xb4fe('0x18')],_0x2747d7[_0xb4fe('0x19')]);return RpcUser['savePause'](this[_0xb4fe('0x6')][_0x2747d7[_0xb4fe('0x18')]],_0xb4fe('0x4c'),_0x2747d7['uniqueid']);}}}catch(_0x45b152){logger[_0xb4fe('0x2f')](_0xb4fe('0x4d'),_0x45b152[_0xb4fe('0x31')]);}};module[_0xb4fe('0x4e')]=Acw; \ No newline at end of file +var _0xf384=['[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','mandatoryDisposition','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','attended','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','prototype'];(function(_0x21fd94,_0x255af2){var _0x703647=function(_0x46dc7b){while(--_0x46dc7b){_0x21fd94['push'](_0x21fd94['shift']());}};_0x703647(++_0x255af2);}(_0xf384,0xc4));var _0x4f38=function(_0x23ad5d,_0x3047c5){_0x23ad5d=_0x23ad5d-0x0;var _0x51eda1=_0xf384[_0x23ad5d];return _0x51eda1;};'use strict';var _=require(_0x4f38('0x0'));var moment=require(_0x4f38('0x1'));var ami=require(_0x4f38('0x2'));var logger=require('../../../config/logger')(_0x4f38('0x3'));var RpcUser=require(_0x4f38('0x4'));var RpcVoiceAgentReport=require(_0x4f38('0x5'));function Acw(_0x21a032){this[_0x4f38('0x6')]=_0x21a032[_0x4f38('0x6')];this[_0x4f38('0x7')]=_0x21a032[_0x4f38('0x7')];this[_0x4f38('0x8')]=_0x21a032['timers'];this[_0x4f38('0x9')]={};ami['on']('agentconnect',this[_0x4f38('0xa')][_0x4f38('0xb')](this));ami['on'](_0x4f38('0xc'),this[_0x4f38('0xd')][_0x4f38('0xb')](this));ami['on'](_0x4f38('0xe'),this[_0x4f38('0xf')][_0x4f38('0xb')](this));ami['on']('agentringnoanswer',this[_0x4f38('0x10')][_0x4f38('0xb')](this));ami['on'](_0x4f38('0x11'),this[_0x4f38('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0x4f38('0x13')][_0x4f38('0xb')](this));ami['on'](_0x4f38('0x14'),this[_0x4f38('0x15')][_0x4f38('0xb')](this));}function getDiff(_0x31b366){var _0x129b4c=moment()[_0x4f38('0x16')](0x0);var _0x4a7a1a=moment(_0x31b366)[_0x4f38('0x16')](0x0);return _0x129b4c[_0x4f38('0x17')](_0x4a7a1a,_0x4f38('0x18'));}Acw['prototype'][_0x4f38('0x19')]=function(_0x5e578e){try{var _0x4184f7=this;var _0xc7d62d=this['channels'][_0x5e578e]['interface'];var _0x5c6066=this['channels'][_0x5e578e]['queue'];var _0xa000a6=this[_0x4f38('0x6')][_0x5c6066];var _0x2d9b0f=![];var _0x52e6bf=_0x4f38('0x1a');if(_0xa000a6['mandatoryDisposition']){if(_0xa000a6['mandatoryDispositionPause'][_0x4f38('0x1b')]){_0x2d9b0f=!![];_0x52e6bf=_0xa000a6[_0x4f38('0x1c')]['name'];}}return ami[_0x4f38('0x1d')]({'action':_0x4f38('0x1e'),'interface':_0xc7d62d,'paused':!![],'reason':_0x52e6bf})[_0x4f38('0x1f')](function(){if(_0x4184f7[_0x4f38('0x7')][_0xc7d62d]){return RpcUser[_0x4f38('0x20')](_0x4184f7[_0x4f38('0x7')][_0xc7d62d]['id'])[_0x4f38('0x1f')](function(_0x59dfa4){if(_0x59dfa4&&!_0x59dfa4[_0x4f38('0x21')]){logger['info'](_0x4f38('0x22'),_0x5e578e,_0xc7d62d,_0x5c6066);var _0x4db45a=_0x4184f7[_0x4f38('0x9')][_0x5e578e]['attended']&&_0x4184f7[_0x4f38('0x9')][_0x5e578e][_0x4f38('0x23')]?_0x4184f7[_0x4f38('0x9')][_0x5e578e]['destlinkedid']:_0x5e578e;return RpcUser[_0x4f38('0x24')](_0x4184f7[_0x4f38('0x7')][_0xc7d62d],_0x52e6bf,_0x4db45a)[_0x4f38('0x1f')](function(){if(!_0x2d9b0f){_0x4184f7['timers'][_0xc7d62d]={};logger[_0x4f38('0x25')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5e578e,_0x4184f7[_0x4f38('0x6')][_0x5c6066][_0x4f38('0x26')],_0xc7d62d,_0x5c6066);_0x4184f7[_0x4f38('0x8')][_0xc7d62d][_0x4f38('0x27')]=setTimeout(_0x4184f7[_0x4f38('0x28')][_0x4f38('0xb')](_0x4184f7,_0xc7d62d),_0x4184f7['voiceQueues'][_0x5c6066][_0x4f38('0x26')]*0x3e8);_0x4184f7['timers'][_0xc7d62d][_0x4f38('0x29')]=moment()[_0x4f38('0x2a')](_0x4f38('0x2b'));_0x4184f7['timers'][_0xc7d62d][_0x4f38('0x2c')]=_0x5e578e;_0x4184f7['timers'][_0xc7d62d][_0x4f38('0x2d')]=_0x5c6066;_0x4184f7[_0x4f38('0x8')][_0xc7d62d][_0x4f38('0x2e')]=function(){var _0x1eeb3f=getDiff(_0x4184f7[_0x4f38('0x8')][_0xc7d62d][_0x4f38('0x29')]);clearTimeout(_0x4184f7[_0x4f38('0x8')][_0xc7d62d][_0x4f38('0x27')]);_0x4184f7[_0x4f38('0x8')][_0xc7d62d]['timer']=![];RpcVoiceAgentReport[_0x4f38('0x2f')]({'acwtime':_0x1eeb3f},_0x4184f7[_0x4f38('0x8')][_0xc7d62d][_0x4f38('0x2c')],_0xc7d62d)['then'](function(_0x16f365){logger[_0x4f38('0x25')](_0x4f38('0x30'),_0x5e578e,_0x1eeb3f,_0x16f365);})[_0x4f38('0x31')](function(_0x2b4f88){logger[_0x4f38('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x5e578e,_0x2b4f88);});delete _0x4184f7['timers'][_0xc7d62d];};}});}else{logger['info'](_0x4f38('0x33'),_0x5e578e,_0xc7d62d,_0x5c6066);}});}})[_0x4f38('0x31')](function(){logger['error'](_0x4f38('0x34'),_0x5e578e,_0x4184f7['voiceQueues'][_0x5c6066][_0x4f38('0x26')],_0xc7d62d,_0x5c6066);})['finally'](function(){delete _0x4184f7[_0x4f38('0x9')][_0x5e578e];});}catch(_0x4d2897){logger['error'](_0x4f38('0x35'),_0x4d2897[_0x4f38('0x36')]);}};Acw[_0x4f38('0x37')][_0x4f38('0x28')]=function(_0x442610){try{var _0x1b4106=this;if(_0x1b4106[_0x4f38('0x8')][_0x442610]){_0x1b4106['timers'][_0x442610][_0x4f38('0x27')]=![];var _0x248bec=_0x1b4106[_0x4f38('0x8')][_0x442610][_0x4f38('0x2c')];var _0x1dc8e4=_0x1b4106[_0x4f38('0x8')][_0x442610][_0x4f38('0x2d')];var _0x1b28d9=_0x1b4106[_0x4f38('0x6')][_0x1dc8e4][_0x4f38('0x26')];logger[_0x4f38('0x25')](_0x4f38('0x38'),_0x248bec,_0x442610);RpcUser[_0x4f38('0x39')](this['agents'][_0x442610]);RpcVoiceAgentReport['update']({'acwtime':_0x1b28d9,'agentacw':!![]},_0x248bec,_0x442610)[_0x4f38('0x1f')](function(_0xa5ea3d){logger[_0x4f38('0x25')](_0x4f38('0x30'),_0x248bec,_0x1b28d9,_0xa5ea3d);})[_0x4f38('0x31')](function(_0x52d4a8){logger[_0x4f38('0x32')](_0x4f38('0x3a'),_0x248bec,_0x52d4a8);});}else{logger[_0x4f38('0x32')](_0x4f38('0x3b'),_0x442610);if(_0x1b4106[_0x4f38('0x8')]){logger['info']('[ACW][TIMERS]',JSON[_0x4f38('0x3c')](_0x1b4106[_0x4f38('0x8')]));}}}catch(_0x57fc4a){logger[_0x4f38('0x32')]('[ACW][STOP]\x20%s',_0x57fc4a['message']);}};Acw[_0x4f38('0x37')]['syncAgentConnect']=function(_0x433a3d){try{if(this[_0x4f38('0x6')][_0x433a3d['queue']]&&(this['voiceQueues'][_0x433a3d[_0x4f38('0x2d')]][_0x4f38('0x3')]||this[_0x4f38('0x6')][_0x433a3d[_0x4f38('0x2d')]][_0x4f38('0x3d')])){if(this[_0x4f38('0x7')][_0x433a3d[_0x4f38('0x3e')]]){this[_0x4f38('0x9')][_0x433a3d[_0x4f38('0x2c')]]={'queue':_0x433a3d[_0x4f38('0x2d')],'interface':_0x433a3d['interface'],'destlinkedid':_0x433a3d[_0x4f38('0x23')]};}}}catch(_0x37d4b7){logger[_0x4f38('0x32')](_0x4f38('0x3f'),_0x37d4b7[_0x4f38('0x36')]);}};Acw['prototype'][_0x4f38('0x15')]=function(_0x9f515a){try{if(this[_0x4f38('0x6')][_0x9f515a['queue']]&&(this[_0x4f38('0x6')][_0x9f515a[_0x4f38('0x2d')]]['acw']||this['voiceQueues'][_0x9f515a['queue']]['mandatoryDisposition'])){if(this[_0x4f38('0x7')][_0x9f515a['interface']]){this[_0x4f38('0x9')][_0x9f515a[_0x4f38('0x2c')]]={'queue':_0x9f515a['queue'],'interface':_0x9f515a[_0x4f38('0x3e')]};}}}catch(_0x7fac3d){logger[_0x4f38('0x32')](_0x4f38('0x40'),_0x7fac3d['message']);}};Acw[_0x4f38('0x37')][_0x4f38('0xd')]=function(_0x56b263){try{if(this['channels'][_0x56b263[_0x4f38('0x2c')]]&&_[_0x4f38('0x41')](this['channels'][_0x56b263[_0x4f38('0x2c')]]['attended'])){logger['info'](_0x4f38('0x42'),_0x56b263[_0x4f38('0x2c')]);this[_0x4f38('0x19')](_0x56b263[_0x4f38('0x2c')]);}else if(this[_0x4f38('0x9')][_0x56b263[_0x4f38('0x43')]]&&_[_0x4f38('0x41')](this[_0x4f38('0x9')][_0x56b263[_0x4f38('0x43')]][_0x4f38('0x44')])){logger[_0x4f38('0x25')](_0x4f38('0x45'),_0x56b263['linkedid']);this['startAcw'](_0x56b263[_0x4f38('0x43')]);}}catch(_0x5b4079){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x5b4079['message']);}};Acw[_0x4f38('0x37')]['syncHangup']=function(_0xc9703){try{if(this[_0x4f38('0x9')][_0xc9703['uniqueid']]&&this[_0x4f38('0x9')][_0xc9703[_0x4f38('0x2c')]][_0x4f38('0x44')]){logger[_0x4f38('0x25')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0xc9703[_0x4f38('0x2c')]);this[_0x4f38('0x19')](_0xc9703[_0x4f38('0x2c')]);}else if(this[_0x4f38('0x9')][_0xc9703['linkedid']]&&this['channels'][_0xc9703['linkedid']]['attended']){logger[_0x4f38('0x25')](_0x4f38('0x46'),_0xc9703['linkedid']);this[_0x4f38('0x19')](_0xc9703[_0x4f38('0x43')]);}}catch(_0x50e5b3){logger[_0x4f38('0x32')](_0x4f38('0x47'),_0x50e5b3['message']);}};Acw[_0x4f38('0x37')][_0x4f38('0x12')]=function(_0x59051c){try{if(!_['isNil'](this[_0x4f38('0x9')][_0x59051c[_0x4f38('0x48')]])){this[_0x4f38('0x19')](_0x59051c[_0x4f38('0x48')]);if(this[_0x4f38('0x9')][_0x59051c[_0x4f38('0x49')]]){this[_0x4f38('0x9')][_0x59051c['secondtransfereruniqueid']]['attended']=!![];this[_0x4f38('0x9')][_0x59051c[_0x4f38('0x4a')]]=this['channels'][_0x59051c[_0x4f38('0x49')]];delete this[_0x4f38('0x9')][_0x59051c[_0x4f38('0x49')]];}}else if(!_['isNil'](this[_0x4f38('0x9')][_0x59051c[_0x4f38('0x4a')]])){this['startAcw'](_0x59051c[_0x4f38('0x4a')]);if(this[_0x4f38('0x9')][_0x59051c['origtransfereruniqueid']]){this[_0x4f38('0x9')][_0x59051c[_0x4f38('0x4b')]]['attended']=!![];this[_0x4f38('0x9')][_0x59051c[_0x4f38('0x48')]]=this[_0x4f38('0x9')][_0x59051c[_0x4f38('0x4b')]];delete this[_0x4f38('0x9')][_0x59051c[_0x4f38('0x4b')]];}}}catch(_0x16f6f4){logger[_0x4f38('0x32')]('[ACW][syncAttendedTransfer]\x20%s',_0x16f6f4[_0x4f38('0x36')]);}};Acw['prototype'][_0x4f38('0x13')]=function(_0x1be204){try{if(this[_0x4f38('0x9')][_0x1be204['transfereruniqueid']]){logger[_0x4f38('0x25')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x4f38('0x3c')](_0x1be204['transfereruniqueid']));this[_0x4f38('0x19')](_0x1be204['transfereruniqueid']);}else if(this[_0x4f38('0x9')][_0x1be204[_0x4f38('0x4c')]]){logger[_0x4f38('0x25')](_0x4f38('0x4d'),JSON[_0x4f38('0x3c')](_0x1be204['transfererlinkedid']));this[_0x4f38('0x19')](_0x1be204[_0x4f38('0x4c')]);}}catch(_0x40cf79){logger[_0x4f38('0x32')](_0x4f38('0x4e'),_0x40cf79['message']);}};Acw[_0x4f38('0x37')]['syncAgentRingNoAnswer']=function(_0x5dbb6b){try{if(this['voiceQueues'][_0x5dbb6b[_0x4f38('0x2d')]]&&this[_0x4f38('0x6')][_0x5dbb6b[_0x4f38('0x2d')]][_0x4f38('0x4f')]===_0x4f38('0x50')){if(this[_0x4f38('0x7')][_0x5dbb6b[_0x4f38('0x3e')]]){logger[_0x4f38('0x25')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x5dbb6b[_0x4f38('0x2c')],_0x5dbb6b[_0x4f38('0x3e')],_0x5dbb6b[_0x4f38('0x2d')]);return RpcUser[_0x4f38('0x24')](this['agents'][_0x5dbb6b[_0x4f38('0x3e')]],_0x4f38('0x51'),_0x5dbb6b[_0x4f38('0x2c')]);}}}catch(_0x63209d){logger[_0x4f38('0x32')](_0x4f38('0x52'),_0x63209d[_0x4f38('0x36')]);}};module[_0x4f38('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 46b958d..8de2c4b 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 _0x5958=['exports','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then'];(function(_0x3a44b3,_0xa466bb){var _0x5efadf=function(_0xaefd97){while(--_0xaefd97){_0x3a44b3['push'](_0x3a44b3['shift']());}};_0x5efadf(++_0xa466bb);}(_0x5958,0x111));var _0x8595=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x5958[_0x258fb0];return _0x4d1afe;};'use strict';var Manager=require(_0x8595('0x0'));var BPromise=require(_0x8595('0x1'));var util=require(_0x8595('0x2'));var logger=require('../../config/logger')(_0x8595('0x3'));var config=require(_0x8595('0x4'));var ami=new Manager(config[_0x8595('0x5')][_0x8595('0x6')],config['asterisk']['ip'],config[_0x8595('0x5')][_0x8595('0x7')],config[_0x8595('0x5')][_0x8595('0x8')],!![]);ami['keepConnected']();ami[_0x8595('0x9')]=BPromise[_0x8595('0xa')](ami['action']);function error(_0x203eb0){logger[_0x8595('0xb')](util[_0x8595('0xc')](_0x8595('0xd'),config['asterisk'][_0x8595('0x7')],config[_0x8595('0x5')]['ip'],config['asterisk'][_0x8595('0x6')],util[_0x8595('0xe')](_0x203eb0,![],null)));}function close(){logger[_0x8595('0xb')](util[_0x8595('0xc')](_0x8595('0xf'),config[_0x8595('0x5')][_0x8595('0x7')],config[_0x8595('0x5')]['ip'],config[_0x8595('0x5')][_0x8595('0x6')]));}ami[_0x8595('0x10')]=function(){return function(){return ami[_0x8595('0x9')]({'action':_0x8595('0x11')});};};ami[_0x8595('0x12')]=function(){return function(){return ami[_0x8595('0x9')]({'action':'devicestatelist'});};};ami[_0x8595('0x13')]=function(){return function(){return ami[_0x8595('0x9')]({'action':_0x8595('0x14')});};};ami[_0x8595('0x15')]=function(){return function(){return ami['Action']({'action':_0x8595('0x16')});};};ami[_0x8595('0x17')]=function(){return function(){return ami[_0x8595('0x9')]({'action':_0x8595('0x18')});};};function connect(){logger[_0x8595('0x19')](util[_0x8595('0xc')](_0x8595('0x1a'),config[_0x8595('0x5')][_0x8595('0x7')],config[_0x8595('0x5')]['ip'],config['asterisk']['port']));ami['once'](_0x8595('0xb'),error);ami[_0x8595('0x1b')](_0x8595('0x1c'),close);}ami['on']('connect',connect);ami['on'](_0x8595('0x1d'),function(_0x25da91){logger[_0x8595('0x19')](util[_0x8595('0xc')](_0x8595('0x1e'),config[_0x8595('0x5')][_0x8595('0x7')],config[_0x8595('0x5')]['ip'],config['asterisk'][_0x8595('0x6')],util[_0x8595('0xe')](_0x25da91,![],null)));});ami['on']('fullybooted',function(){logger[_0x8595('0x19')](util[_0x8595('0xc')](_0x8595('0x1f'),config[_0x8595('0x5')][_0x8595('0x7')],config[_0x8595('0x5')]['ip'],config[_0x8595('0x5')][_0x8595('0x6')]));return Promise['resolve']()['then'](ami[_0x8595('0x10')]())[_0x8595('0x20')](ami['actionDeviceStateList']())[_0x8595('0x20')](ami['actionSipPeerStatus']())[_0x8595('0x20')](ami[_0x8595('0x15')]())[_0x8595('0x20')](ami[_0x8595('0x17')]())['catch'](function(_0x26ea41){logger[_0x8595('0xb')]('[ami.js][fullybooted]',util[_0x8595('0xe')](_0x26ea41,{'showHidden':![],'depth':null}));});});ami[_0x8595('0x1b')](_0x8595('0xb'),error);ami[_0x8595('0x1b')](_0x8595('0x1c'),close);module[_0x8595('0x21')]=ami; \ No newline at end of file +var _0xb636=['error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','format','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionDeviceStateList','actionSipPeerStatus','actionQueueSummary','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','util','../../config/logger','asterisk','port','keepConnected','Action','promisify'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0xb636,0xab));var _0x6b63=function(_0x4a8c28,_0x28ecdb){_0x4a8c28=_0x4a8c28-0x0;var _0xcc9d31=_0xb636[_0x4a8c28];return _0xcc9d31;};'use strict';var Manager=require(_0x6b63('0x0'));var BPromise=require(_0x6b63('0x1'));var util=require(_0x6b63('0x2'));var logger=require(_0x6b63('0x3'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x6b63('0x4')][_0x6b63('0x5')],config[_0x6b63('0x4')]['ip'],config[_0x6b63('0x4')]['username'],config['asterisk']['password'],!![]);ami[_0x6b63('0x6')]();ami[_0x6b63('0x7')]=BPromise[_0x6b63('0x8')](ami['action']);function error(_0xf0702){logger[_0x6b63('0x9')](util['format'](_0x6b63('0xa'),config['asterisk'][_0x6b63('0xb')],config[_0x6b63('0x4')]['ip'],config[_0x6b63('0x4')][_0x6b63('0x5')],util[_0x6b63('0xc')](_0xf0702,![],null)));}function close(){logger[_0x6b63('0x9')](util['format'](_0x6b63('0xd'),config[_0x6b63('0x4')]['username'],config[_0x6b63('0x4')]['ip'],config[_0x6b63('0x4')][_0x6b63('0x5')]));}ami[_0x6b63('0xe')]=function(){return function(){return ami[_0x6b63('0x7')]({'action':_0x6b63('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x6b63('0x10')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x6b63('0x7')]({'action':_0x6b63('0x11')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x6b63('0x12')});};};ami[_0x6b63('0x13')]=function(){return function(){return ami[_0x6b63('0x7')]({'action':_0x6b63('0x14')});};};function connect(){logger['info'](util[_0x6b63('0x15')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk']['username'],config['asterisk']['ip'],config['asterisk']['port']));ami[_0x6b63('0x16')]('error',error);ami['once'](_0x6b63('0x17'),close);}ami['on'](_0x6b63('0x18'),connect);ami['on'](_0x6b63('0x19'),function(_0x1c5b3e){logger[_0x6b63('0x1a')](util[_0x6b63('0x15')](_0x6b63('0x1b'),config[_0x6b63('0x4')][_0x6b63('0xb')],config[_0x6b63('0x4')]['ip'],config['asterisk'][_0x6b63('0x5')],util['inspect'](_0x1c5b3e,![],null)));});ami['on'](_0x6b63('0x1c'),function(){logger[_0x6b63('0x1a')](util[_0x6b63('0x15')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0x6b63('0x4')]['ip'],config[_0x6b63('0x4')]['port']));return Promise[_0x6b63('0x1d')]()[_0x6b63('0x1e')](ami[_0x6b63('0xe')]())[_0x6b63('0x1e')](ami[_0x6b63('0x1f')]())['then'](ami[_0x6b63('0x20')]())[_0x6b63('0x1e')](ami[_0x6b63('0x21')]())[_0x6b63('0x1e')](ami[_0x6b63('0x13')]())[_0x6b63('0x22')](function(_0x4826b8){logger[_0x6b63('0x9')](_0x6b63('0x23'),util['inspect'](_0x4826b8,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0x6b63('0x16')](_0x6b63('0x17'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 7ddd540..86f573d 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x3180a6,_0xaef3d8){var _0x244232=function(_0x407d0e){while(--_0x407d0e){_0x3180a6['push'](_0x3180a6['shift']());}};_0x244232(++_0xaef3d8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file +var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0xac4a,0x13f));var _0xaac4=function(_0x190cc7,_0x1d406b){_0x190cc7=_0x190cc7-0x0;var _0x54c9de=_0xac4a[_0x190cc7];return _0x54c9de;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 31521a3..b8a956d 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 _0x52fe=['busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','predictiveIntervalErlangCallsDroppedCalls','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalHitRate','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','loggedIn','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','available','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','lodash','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:ivr:%s','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','prototype','isTrunkReachable','active','trunks','SIP/%s','status','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','Failure','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','indexOf','true','content','catch','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','resolve','dialGlobalInterval','dialTimezone','[syncCampaigns]','dialMethod','handlePower','power','dialPowerLevel','method\x20not\x20recognized','Dialer::ifTime()','Global:\x20','silly','AMI\x20IfTime','queue','type','ivr','updateOriginated','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','state','Drop','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','verifyAdditionalPhones','dialDropMaxRetry','queueCallerAbandonCreateState','additional','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','countabandonedretry','voiceQueue','dialAbandonedMaxRetry','rescheduleContact','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','queueBooked','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','idHopper','[booked][unlock]','[booked][unlock2]','CampaignId','[unlock2][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','membername','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','AMD','countmachineretry','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','HangupInAMD','buildObj','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','countglobal','countbusyretry','countcongestionretry','dialMachineMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','running','statusMessage','inUse','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','undefined','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','Agent','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','countagentrejectretry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x52fe,0x78));var _0xe52f=function(_0x3e6574,_0x501b77){_0x3e6574=_0x3e6574-0x0;var _0x25accf=_0x52fe[_0x3e6574];return _0x25accf;};'use strict';var util=require('util');var _=require(_0xe52f('0x0'));var uuid=require(_0xe52f('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require(_0xe52f('0x2'));var utils=require(_0xe52f('0x3'));var hopperUtils=require(_0xe52f('0x4'));var ut=require(_0xe52f('0x5'));var config=require(_0xe52f('0x6'));var logger=require('../../../config/logger')(_0xe52f('0x7'));var loggerBooked=require(_0xe52f('0x8'))(_0xe52f('0x9'));var loggerPredictive=require('../../../config/logger')(_0xe52f('0xa'));var loggerPredictiveCalls=require(_0xe52f('0x8'))(_0xe52f('0xb'));var loggerSyncQueueSummary=require(_0xe52f('0x8'))(_0xe52f('0xc'));var ami=require(_0xe52f('0xd'));config[_0xe52f('0xe')]=_[_0xe52f('0xf')](config[_0xe52f('0xe')],{'host':_0xe52f('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0xe52f('0x11'));var voiceQueueRt=require(_0xe52f('0x12'));var RpcSetting=require(_0xe52f('0x13'));var Interval=require(_0xe52f('0x14'));var Action=require(_0xe52f('0x15'));var History=require(_0xe52f('0x16'));var Final=require(_0xe52f('0x17'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require('./models/hangup');var ipAgi=process[_0xe52f('0x18')][_0xe52f('0x19')]||_0xe52f('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xe52f('0x1b')]=function(_0x3a7a7e){this[_0xe52f('0x1c')]=this[_0xe52f('0x1c')]?this[_0xe52f('0x1c')][_0xe52f('0x1d')](_0x3a7a7e):_0x3a7a7e();};function Dialer(_0x217096,_0x304948){this[_0xe52f('0x1e')]=new Sequence();this['preview']=_0x304948;this['voiceQueues']=_0x217096[_0xe52f('0x1f')];this[_0xe52f('0x20')]=_0x217096[_0xe52f('0x20')];this['agents']=_0x217096[_0xe52f('0x21')];this['trunks']=_0x217096['trunks'];this['maxNumberOriginate']=config[_0xe52f('0x22')]||0x2;this[_0xe52f('0x23')]={};this[_0xe52f('0x24')]={};this['contactsId']={};this[_0xe52f('0x25')]={};this['optionPredictive']={};this[_0xe52f('0x26')]={};this[_0xe52f('0x27')]={};this[_0xe52f('0x28')]={};this['queueBooked']={};this[_0xe52f('0x29')]={};this[_0xe52f('0x2a')]={};ami['on']('agentconnect',this[_0xe52f('0x2b')][_0xe52f('0x2c')](this));ami['on'](_0xe52f('0x2d'),this[_0xe52f('0x2e')][_0xe52f('0x2c')](this));ami['on'](_0xe52f('0x2f'),this[_0xe52f('0x30')][_0xe52f('0x2c')](this));ami['on']('agentcomplete',this[_0xe52f('0x31')][_0xe52f('0x2c')](this));ami['on'](_0xe52f('0x32'),this[_0xe52f('0xc')][_0xe52f('0x2c')](this));ami['on'](_0xe52f('0x33'),this[_0xe52f('0x34')]['bind'](this));ami['on'](_0xe52f('0x35'),this[_0xe52f('0x36')][_0xe52f('0x2c')](this));ami['on'](_0xe52f('0x37'),this['syncNewExten'][_0xe52f('0x2c')](this));ami['on'](_0xe52f('0x38'),this[_0xe52f('0x39')][_0xe52f('0x2c')](this));ami['on'](_0xe52f('0x3a'),this[_0xe52f('0x3b')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xe52f('0x3c')][_0xe52f('0x2c')](this));this[_0xe52f('0x3d')]();this['loopClearZombieChannels']();RpcSetting[_0xe52f('0x3e')]()[_0xe52f('0x3f')](function(_0x193555){previewRecallmeReminderInterval=_0x193555[_0xe52f('0x40')];});}function isNotNull(_0x16049f){return _0x16049f!==null&&!_[_0xe52f('0x41')](_0x16049f);}function msgResponse(_0x47ac92,_0x51e24a,_0x556160){return{'action':_0x47ac92,'response':_0x51e24a,'message':_0x556160,'stack':_0x556160};}function emit(_0x31f50e,_0x508e39,_0x1361a4){io['to'](_0x31f50e)[_0xe52f('0x42')](_0x508e39,_0x1361a4);}function emitOutboundVoiceQueueSummary(_0x4a1379){if(_0x4a1379['type']===_0xe52f('0x43')){logger[_0xe52f('0x44')](_0xe52f('0x45'),util[_0xe52f('0x46')](_0x4a1379,{'showHidden':![],'depth':null}));emit(util[_0xe52f('0x47')](_0xe52f('0x48'),_0x4a1379['name']),_0xe52f('0x49'),_0x4a1379);}}function checkGetDataPredictive(_0x1fbfd5){if(isNotNull(_0x1fbfd5)&&!_[_0xe52f('0x4a')](_0x1fbfd5)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x4c'),_0x1fbfd5[_0xe52f('0x4d')]);loggerPredictive[_0xe52f('0x4b')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1fbfd5[_0xe52f('0x4e')]);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x4f'),_0x1fbfd5['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x50'),_0x1fbfd5[_0xe52f('0x51')]);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x52'),_0x1fbfd5[_0xe52f('0x53')]);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x54'),_0x1fbfd5['predictiveIntervalAvgTalktime']);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x55'));if(_0x1fbfd5[_0xe52f('0x4d')]>0x0){if(!_[_0xe52f('0x41')](_0x1fbfd5['predictiveIntervalAvgTalktime'])&&_0x1fbfd5[_0xe52f('0x56')]>0x0){return!![];}loggerPredictive[_0xe52f('0x4b')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x1fbfd5[_0xe52f('0x53')])&&_0x1fbfd5[_0xe52f('0x53')]>0x0){return!![];}loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x57'));}else{loggerPredictive['info'](_0xe52f('0x58'));}}else{loggerPredictive[_0xe52f('0x4b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x120e73){return function(_0x35c16c){loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x59'));loggerPredictive[_0xe52f('0x4b')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35c16c[_0xe52f('0x5a')]);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x5b'),_0x35c16c[_0xe52f('0x5c')]);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x5d'),_0x35c16c['erlangAbandonmentRate']);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x5e'),_0x35c16c[_0xe52f('0x5f')]);loggerPredictive[_0xe52f('0x4b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35c16c[_0xe52f('0x60')]);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x55'));_[_0xe52f('0x61')](_0x120e73,_0x35c16c);};}function ifInterval(_0x476f06,_0x4c6597){if(_[_0xe52f('0x41')](_0x4c6597)){return![];}return utils[_0xe52f('0x62')](undefined,_0x4c6597)<_0x476f06*0x3c;}function clearPredictiveAttributes(_0x85b6e6){if(_0x85b6e6[_0xe52f('0x27')]){_0x85b6e6['startProgressive']=undefined;loggerPredictive[_0xe52f('0x44')](_0x85b6e6[_0xe52f('0x63')],_0xe52f('0x64'));}if(_0x85b6e6[_0xe52f('0x26')]){_0x85b6e6['startPredictive']=undefined;loggerPredictive['debug'](_0x85b6e6['name'],_0xe52f('0x65'));}if(_0x85b6e6[_0xe52f('0x66')]){clearInterval(_0x85b6e6['handlePredictive']);_0x85b6e6['handlePredictive']=undefined;loggerPredictive[_0xe52f('0x44')](_0x85b6e6[_0xe52f('0x63')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x8baef,_0x5bd472){return function(_0x23e701){loggerPredictive[_0xe52f('0x67')](_0x5bd472[_0xe52f('0x63')],_0x8baef);loggerPredictive['error'](_0x23e701[_0xe52f('0x68')]);clearPredictiveAttributes(_0x5bd472);};}function loggerCatch(_0x3e229c){return function(_0x9122e5){logger[_0xe52f('0x67')](_0x3e229c,util[_0xe52f('0x46')](_0x9122e5,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x5d8a8a,_0x797fa2,_0x5d2d81){return function(_0x3b5c30){utils['checkContactLowerLimitOriginate'](_0x797fa2,_0x5d2d81,0x0);logger[_0xe52f('0x67')](_0x5d8a8a,util[_0xe52f('0x46')](_0x3b5c30,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3dd694){return function(_0x39042a){if(isNotNull(_0x39042a)&&isNotNull(_0x39042a[0x0])){if(_0x39042a[0x0][_0xe52f('0x69')]>0x0){_0x3dd694[_0xe52f('0x6a')]=utils[_0xe52f('0x6b')][_0xe52f('0x6c')];logger['info'](_0xe52f('0x6d')+_0x3dd694[_0xe52f('0x63')],_0x39042a[0x0][_0xe52f('0x69')],_0xe52f('0x6e'));}else{_0x3dd694[_0xe52f('0x6a')]=utils[_0xe52f('0x6b')][_0xe52f('0x6f')];logger[_0xe52f('0x4b')](_0xe52f('0x70')+_0x3dd694[_0xe52f('0x63')]);}}};}function createObjHistory(_0x1ac346,_0x50d025,_0x245d8c,_0xa494d4,_0x23427b){_0x1ac346['message']=_0x245d8c;var _0x189f1d=new Action(_0x1ac346,_0x50d025);var _0x212630=new History(_0x189f1d);_0x212630['state']=_0xa494d4;_0x212630[_0xe52f('0x71')]=_0x23427b;_0x212630[_0xe52f('0x72')]=_0x189f1d[_0xe52f('0x73')];return _0x212630;}function unlockQueueStatus(_0x159b89,_0x559f05){setTimeout(function(){if(_[_0xe52f('0x41')](_0x159b89[_0xe52f('0x74')])){loggerBooked['error'](_0xe52f('0x75'),_0x559f05);}_0x159b89[_0xe52f('0x74')]=!![];loggerBooked[_0xe52f('0x4b')](_0xe52f('0x76'),_0x559f05,JSON[_0xe52f('0x77')](_[_0xe52f('0x78')](_0x159b89,[_0xe52f('0x63'),_0xe52f('0x74')])));},0x1f3);}function checkInterval(_0x49a124){return function(){if(!isNotNull(_0x49a124[_0xe52f('0x79')])){_0x49a124[_0xe52f('0x6a')]=utils[_0xe52f('0x6b')][_0xe52f('0x7a')];throw _0x49a124[_0xe52f('0x63')]+_0xe52f('0x7b');}if(!isNotNull(_0x49a124[_0xe52f('0x79')][_0xe52f('0x7c')])){_0x49a124[_0xe52f('0x6a')]=utils[_0xe52f('0x6b')]['NULL_INTERVAL'];throw _0x49a124[_0xe52f('0x63')]+_0xe52f('0x7b');}if(!isNotNull(_[_0xe52f('0x4a')](_0x49a124[_0xe52f('0x79')][_0xe52f('0x7c')]))){_0x49a124[_0xe52f('0x6a')]=utils['CAMPAIGN_STATUS'][_0xe52f('0x7a')];throw _0x49a124[_0xe52f('0x63')]+_0xe52f('0x7b');}};}function checkIsIVRCampaignActive(_0x58063d){return function(){if(!utils[_0xe52f('0x7d')](_0x58063d)){_0x58063d['message']=utils[_0xe52f('0x6b')][_0xe52f('0x7e')];throw _0x58063d[_0xe52f('0x63')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x5aa41a){if(utils[_0xe52f('0x7f')](_0x5aa41a)){emit(util[_0xe52f('0x47')](_0xe52f('0x80'),_0x5aa41a[_0xe52f('0x63')]),'campaign:save',_0x5aa41a);}}function loggerCatchQueueSummary(_0x14baa6,_0x37165b){return function(_0x195323){clearPredictiveAttributes(_0x37165b);emitCampaignSummary(_0x37165b);loggerSyncQueueSummary[_0xe52f('0x44')](_0x14baa6,util[_0xe52f('0x46')](_0x195323,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x31a9f6){if(_0x31a9f6['sendMessageOneNotActive']){if(_0x31a9f6[_0xe52f('0x81')]===0x0){_0x31a9f6[_0xe52f('0x82')]=![];_0x31a9f6[_0xe52f('0x6a')]=utils[_0xe52f('0x6b')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0xe52f('0x83'),_0x31a9f6['name'],'is\x20not\x20active');}else{_0x31a9f6[_0xe52f('0x6a')]=utils[_0xe52f('0x6b')]['DISACTIVED'];loggerSyncQueueSummary[_0xe52f('0x44')](_0xe52f('0x83'),_0x31a9f6[_0xe52f('0x63')],_0xe52f('0x84'));}emitCampaignSummary(_0x31a9f6);}}function myreject(_0x348953){return function(_0x392c5f){return _0x348953(msgResponse(_0xe52f('0x85'),'Error',JSON['stringify'](_0x392c5f)));};}Dialer[_0xe52f('0x86')][_0xe52f('0x87')]=function(_0x48a5c8){return!_[_0xe52f('0x41')](_0x48a5c8)&&_0x48a5c8&&!_[_0xe52f('0x41')](_0x48a5c8[_0xe52f('0x63')])&&!_[_0xe52f('0x41')](_0x48a5c8['active'])&&_0x48a5c8[_0xe52f('0x88')]&&(this[_0xe52f('0x89')][util[_0xe52f('0x47')](_0xe52f('0x8a'),_0x48a5c8[_0xe52f('0x63')])][_0xe52f('0x8b')]==='reachable'||this[_0xe52f('0x89')][util[_0xe52f('0x47')](_0xe52f('0x8a'),_0x48a5c8[_0xe52f('0x63')])]['status']==='unmonitored');};Dialer[_0xe52f('0x86')][_0xe52f('0x8c')]=function(_0x5c21b1){var _0x38f2ec=this;return function(){if(!_0x38f2ec[_0xe52f('0x87')](_0x5c21b1[_0xe52f('0x8d')])){if(!_0x38f2ec['isTrunkReachable'](_0x5c21b1['TrunkBackup'])){_0x5c21b1[_0xe52f('0x6a')]=utils[_0xe52f('0x6b')][_0xe52f('0x8e')];throw _0x5c21b1[_0xe52f('0x63')]+_0xe52f('0x8f');}}};};Dialer[_0xe52f('0x86')][_0xe52f('0x90')]=function(_0x1cc045,_0x4287fb,_0x1ff8a8,_0x5407b1){var _0x3552cf=this;return function(){var _0x42f072=!![];return _0x3552cf[_0xe52f('0x91')](_0x1cc045,_0x4287fb,_0x1ff8a8,_0x5407b1,_0x42f072);};};Dialer['prototype'][_0xe52f('0x92')]=function(_0x541df6,_0x70a9fa,_0x38bcfd,_0xfb9af0){var _0x1860ef=this;return function(){var _0x29c229=![];return _0x1860ef[_0xe52f('0x91')](_0x541df6[_0xe52f('0x7c')],_0x70a9fa,_0x38bcfd,_0xfb9af0,_0x29c229);};};Dialer['prototype'][_0xe52f('0x91')]=function(_0x39f6ab,_0x542270,_0x160fba,_0x24bfd8,_0x3ea5f8){var _0x5f8ab9=[];return new Promise(function(_0x1b1ccc,_0xfacc4c){if(!isNotNull(_0x39f6ab)){_0x24bfd8[_0xe52f('0x6a')]=utils[_0xe52f('0x6b')]['NULL_INTERVAL'];return _0xfacc4c(msgResponse(_0xe52f('0x93'),'Failure',_0x160fba+_0xe52f('0x94')));}if(_[_0xe52f('0x4a')](_0x39f6ab)){_0x24bfd8[_0xe52f('0x6a')]=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0xfacc4c(msgResponse(_0xe52f('0x93'),_0xe52f('0x95'),_0x160fba+'\x20Intervals\x20is\x20empty\x20'));}if(_0x542270&&_[_0xe52f('0x41')](config[_0xe52f('0x96')][_0x542270])){_0x24bfd8[_0xe52f('0x6a')]=utils[_0xe52f('0x6b')][_0xe52f('0x97')];return _0xfacc4c(msgResponse('ifTime',_0xe52f('0x95'),_0x160fba+_0xe52f('0x98')+_0x542270));}if(_[_0xe52f('0x99')](_0x39f6ab)){for(var _0x1d84eb=0x0;_0x1d84eb<_0x39f6ab[_0xe52f('0x9a')];_0x1d84eb+=0x1){_0x5f8ab9[_0xe52f('0x9b')](ami[_0xe52f('0x9c')]({'action':_0xe52f('0x9d'),'command':util[_0xe52f('0x47')](_0xe52f('0x9e'),_0x39f6ab[_0x1d84eb]['interval'],!_[_0xe52f('0x41')](config[_0xe52f('0x96')][_0x542270])?_0x542270:'')})[_0xe52f('0x3f')](function(_0x5e8f22){return _0x5e8f22['content'][_0xe52f('0x9f')](_0xe52f('0xa0'))>=0x0;})['catch'](myreject(_0xfacc4c)));}}else{_0x5f8ab9[_0xe52f('0x9b')](ami[_0xe52f('0x9c')]({'action':'command','command':util[_0xe52f('0x47')](_0xe52f('0x9e'),_0x39f6ab,!_[_0xe52f('0x41')](config[_0xe52f('0x96')][_0x542270])?_0x542270:'')})['then'](function(_0x19358e){return _0x19358e[_0xe52f('0xa1')][_0xe52f('0x9f')](_0xe52f('0xa0'))>=0x0;})[_0xe52f('0xa2')](myreject(_0xfacc4c)));}Promise[_0xe52f('0xa3')](_0x5f8ab9)['then'](function(_0xf69705){var _0x2b9018=_[_0xe52f('0xa4')](_0xf69705);if(_0x2b9018){return _0x1b1ccc(_0x2b9018);}else{_0x24bfd8[_0xe52f('0x6a')]=_0x3ea5f8?utils[_0xe52f('0x6b')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xe52f('0x6b')][_0xe52f('0xa5')];return _0xfacc4c(msgResponse(_0xe52f('0xa6'),'Failure','Global:\x20'+_0x3ea5f8+'\x20'+_0x160fba+_0xe52f('0xa7')+util[_0xe52f('0x46')](_0x39f6ab,{'showHidden':![],'depth':null})+_0xe52f('0xa8')+_0x542270));}})[_0xe52f('0xa2')](function(_0x3cbf74){return _0xfacc4c(msgResponse(_0xe52f('0x93'),_0xe52f('0x95'),JSON[_0xe52f('0x77')](_0x3cbf74)));});});};Dialer[_0xe52f('0x86')][_0xe52f('0x3d')]=function(){var _0x5459b7=this;return cmHopper[_0xe52f('0xa9')]({'active':![]},{'where':{'active':!![]}})[_0xe52f('0x3f')](function(){setInterval(function(){_0x5459b7[_0xe52f('0xaa')]();},0x3e8);});};Dialer[_0xe52f('0x86')][_0xe52f('0xaa')]=function(){var _0x46ef32=this;var _0x18f8ec;for(var _0x5e273c in this[_0xe52f('0x20')]){if(typeof this['campaigns'][_0x5e273c]!=='undefined'){_0x18f8ec=this['campaigns'][_0x5e273c];if(utils[_0xe52f('0x7f')](_0x18f8ec)&&utils[_0xe52f('0x7d')](_0x18f8ec)){_0x18f8ec['sendMessageOneNotActive']=!![];Promise[_0xe52f('0xab')]()[_0xe52f('0x3f')](checkIsIVRCampaignActive(_0x18f8ec))[_0xe52f('0x3f')](checkInterval(_0x18f8ec))[_0xe52f('0x3f')](_0x46ef32[_0xe52f('0x8c')](_0x18f8ec))['then'](_0x46ef32['checkIfTime'](_0x18f8ec[_0xe52f('0xac')],_0x18f8ec[_0xe52f('0xad')],_0x18f8ec[_0xe52f('0x63')],_0x18f8ec))[_0xe52f('0x3f')](_0x46ef32['checkIfTimeIntervals'](_0x18f8ec[_0xe52f('0x79')],_0x18f8ec[_0xe52f('0xad')],_0x18f8ec[_0xe52f('0x63')],_0x18f8ec))[_0xe52f('0x3f')](_0x46ef32['launchHandleIvr'](_0x18f8ec))[_0xe52f('0xa2')](loggerCatchQueueSummary(_0xe52f('0xae'),_0x18f8ec));}else{notSendMessagesCampaign(_0x18f8ec);}}}};Dialer['prototype']['checkDialMethod']=function(_0x169447){if(_0x169447[_0xe52f('0xaf')]!==_0xe52f('0xa')){clearPredictiveAttributes(_0x169447);}switch(_0x169447[_0xe52f('0xaf')]){case'progressive':this[_0xe52f('0xb0')](_0x169447,0x1);break;case _0xe52f('0xb1'):this[_0xe52f('0xb0')](_0x169447,_0x169447[_0xe52f('0xb2')]);break;case _0xe52f('0xa'):this[_0xe52f('0xa')](_0x169447);break;case _0xe52f('0x9'):this['handlePower'](_0x169447,0x1);break;default:logger['error']('Queue',_0x169447[_0xe52f('0x63')],_0xe52f('0xb3'));}};Dialer['prototype']['ifTime']=function(_0x38f15a,_0xa4292f){var _0x1ef8f4=_0x38f15a['dialTimezone'];var _0x34c849=_0xa4292f?_0x38f15a[_0xe52f('0xac')]:_0x38f15a[_0xe52f('0x79')]['Intervals'];logger['silly'](_0xe52f('0xb4'),_0x34c849,_0x1ef8f4,_0x38f15a['name'],util[_0xe52f('0x47')]('Voice\x20Queue\x20%s\x20$s',_0x38f15a[_0xe52f('0x63')],_0x38f15a['id']));var _0x3d7bc2=null;return Interval['intervalIftime'](_0x34c849,_0x1ef8f4)[_0xe52f('0x3f')](function(_0x5ba514){if(_0x5ba514===!![]){return _0x5ba514;}else{_0x38f15a[_0xe52f('0x6a')]=_0xa4292f?utils[_0xe52f('0x6b')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xe52f('0x6b')][_0xe52f('0xa5')];_0x3d7bc2=msgResponse(_0xe52f('0xa6'),_0xe52f('0x95'),_0xe52f('0xb5')+_0xa4292f+'\x20'+_0x38f15a[_0xe52f('0x63')]+_0xe52f('0xa7')+util[_0xe52f('0x46')](_0x34c849,{'showHidden':![],'depth':null})+_0xe52f('0xa8')+_0x1ef8f4);}if(_0x3d7bc2!==null){logger[_0xe52f('0xb6')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x3d7bc2);_0x3d7bc2['isGlobal']=_0xa4292f;throw _0x3d7bc2;}})['catch'](function(_0x374d5d){logger['error'](_0xe52f('0xb7'),_0x374d5d);throw msgResponse(_0xe52f('0x85'),'Error',util['inspect'](_0x374d5d,{'showHidden':![],'depth':null}));});};Dialer[_0xe52f('0x86')]['syncAgentConnect']=function(_0x8752a2){if(this[_0xe52f('0x1f')][_0x8752a2[_0xe52f('0xb8')]]){if(this['uniqueId'][_0x8752a2['uniqueid']]&&this[_0xe52f('0x25')][_0x8752a2['uniqueid']][_0xe52f('0xb9')]!==_0xe52f('0xba')){this[_0xe52f('0xbb')](this[_0xe52f('0x1f')][_0x8752a2['queue']]);this[_0xe52f('0x25')][_0x8752a2[_0xe52f('0xbc')]][_0xe52f('0xbd')]=moment()['format'](_0xe52f('0xbe'));}}};Dialer[_0xe52f('0x86')][_0xe52f('0x31')]=function(_0x5b37c7){var _0x489b1c=this[_0xe52f('0x25')][_0x5b37c7[_0xe52f('0xbc')]];if(this[_0xe52f('0x1f')][_0x5b37c7[_0xe52f('0xb8')]]){if(_0x489b1c&&_0x489b1c[_0xe52f('0xb9')]!==_0xe52f('0xba')){delete this[_0xe52f('0x25')][_0x5b37c7[_0xe52f('0xbc')]];this[_0xe52f('0x1f')][_0x5b37c7[_0xe52f('0xb8')]][_0xe52f('0xbf')]+=0x1;var _0x4a4f2e=new AgentComplete(_0x489b1c,_0x5b37c7);if(_0x5b37c7[_0xe52f('0xc0')]===_0xe52f('0xc1')){_0x4a4f2e[_0xe52f('0xc2')]=this['voiceQueues'][_0x5b37c7[_0xe52f('0xb8')]][_0xe52f('0xc3')]&&this[_0xe52f('0x1f')][_0x5b37c7[_0xe52f('0xb8')]][_0xe52f('0xc4')]?moment()['format'](_0xe52f('0xbe')):undefined;}hopperUtils[_0xe52f('0xc5')](_0x4a4f2e)[_0xe52f('0xa2')](loggerCatch(_0xe52f('0xc6')));hopperUtils['moveContactManagedDialer'](_0x4a4f2e)[_0xe52f('0xa2')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xe52f('0x86')][_0xe52f('0x2e')]=function(_0x215672){var _0x4f9da6=this['uniqueId'][_0x215672[_0xe52f('0xbc')]];var _0x168b94=this;var _0x28fba0=![];var _0x12a398;var _0x4359e5;if(this['voiceQueues'][_0x215672['queue']]){if(_0x4f9da6&&_0x4f9da6['type']!==_0xe52f('0xba')){delete this[_0xe52f('0x25')][_0x215672[_0xe52f('0xbc')]];this[_0xe52f('0xbb')](this['voiceQueues'][_0x215672[_0xe52f('0xb8')]]);_0x4f9da6[_0xe52f('0xc7')]=moment()[_0xe52f('0x47')](_0xe52f('0xbe'));var _0x46a059=new QueueCallerAbandon(_0x4f9da6,_0x215672);if(utils[_0xe52f('0x62')](_0x4f9da6[_0xe52f('0xc7')],_0x4f9da6[_0xe52f('0xc8')])>=_0x4f9da6[_0xe52f('0xc9')]){this[_0xe52f('0x1f')][_0x215672[_0xe52f('0xb8')]][_0xe52f('0xca')]+=0x1;this[_0xe52f('0x1f')][_0x215672[_0xe52f('0xb8')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xe52f('0x1f')][_0x215672[_0xe52f('0xb8')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x46a059[_0xe52f('0xcb')]=0xa;_0x46a059[_0xe52f('0x71')]=_0xe52f('0xcc');_0x46a059[_0xe52f('0xcd')]=_0xe52f('0xce');_0x46a059['agiafterat']=this['voiceQueues'][_0x215672['queue']]['dialQueueProject2']?moment()[_0xe52f('0x47')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x46a059[_0xe52f('0xcf')]+=0x1;_0x46a059['countglobal']+=0x1;_0x12a398=this[_0xe52f('0x1f')][_0x215672['queue']][_0xe52f('0xd0')];_0x4359e5=this[_0xe52f('0x1f')][_0x215672[_0xe52f('0xb8')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xe52f('0xd1')](_0x46a059,_0x46a059[_0xe52f('0xcb')],_0x4f9da6['voiceQueue'])['then'](function(_0x5a73b7){_0x28fba0=_0x5a73b7['additional']==0x1;if(_0x46a059[_0xe52f('0xcf')]>=_0x168b94[_0xe52f('0x1f')][_0x215672[_0xe52f('0xb8')]][_0xe52f('0xd2')]){_0x168b94[_0xe52f('0xd3')](_0x46a059,_0x5a73b7[_0xe52f('0xd4')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x46a059[_0xe52f('0xcf')],'scheduledat':moment()[_0xe52f('0xd5')](_0x168b94['voiceQueues'][_0x215672['queue']][_0xe52f('0xd0')],_0xe52f('0xd6'))['format'](_0xe52f('0xbe')),'ContactId':_0x4f9da6[_0xe52f('0xd7')],'ListId':_0x4f9da6[_0xe52f('0xd8')],'VoiceQueueId':_0x4f9da6[_0xe52f('0xd9')]||undefined,'CampaignId':_0x4f9da6['CampaignId']||undefined})[_0xe52f('0xa2')](loggerCatch(_0xe52f('0xda')));var _0xdb2cdb=new History(_0x46a059);_0xdb2cdb[_0xe52f('0xcb')]=0xa;_0xdb2cdb[_0xe52f('0x71')]=_0xe52f('0xcc');_0xdb2cdb[_0xe52f('0x73')]=moment()['format'](_0xe52f('0xbe'));_0xdb2cdb[_0xe52f('0x72')]=_0xdb2cdb[_0xe52f('0x73')];_0xdb2cdb[_0xe52f('0xdb')]=_0x46a059[_0xe52f('0xdb')];_0xdb2cdb[_0xe52f('0xdc')]=_0x46a059[_0xe52f('0xdc')];hopperUtils[_0xe52f('0xc5')](_0xdb2cdb)[_0xe52f('0xa2')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x28fba0)hopperUtils[_0xe52f('0xdd')](_0x46a059,_0x12a398,_0x4359e5)['then'](function(){return 0x1;});});}else{this[_0xe52f('0x1f')][_0x215672[_0xe52f('0xb8')]][_0xe52f('0x51')]+=0x1;this[_0xe52f('0x1f')][_0x215672[_0xe52f('0xb8')]]['outboundDropCallsDayCallersExit']+=0x1;_0x46a059[_0xe52f('0xcb')]=0xb;_0x46a059['statedesc']='Abandoned';_0x46a059[_0xe52f('0xcd')]='CALLEREXIT';_0x46a059[_0xe52f('0xde')]+=0x1;_0x46a059['countglobal']+=0x1;_0x12a398=this[_0xe52f('0x1f')][_0x215672[_0xe52f('0xb8')]]['dialAbandonedRetryFrequency'];_0x4359e5=this[_0xe52f('0x1f')][_0x215672[_0xe52f('0xb8')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xe52f('0xd1')](_0x46a059,_0x46a059[_0xe52f('0xcb')],_0x4f9da6[_0xe52f('0xdf')])[_0xe52f('0x3f')](function(_0x590799){if(_0x46a059[_0xe52f('0xde')]>=_0x168b94[_0xe52f('0x1f')][_0x215672[_0xe52f('0xb8')]][_0xe52f('0xe0')]){_0x168b94[_0xe52f('0xd3')](_0x46a059,_0x590799[_0xe52f('0xd4')]);}else{hopperUtils[_0xe52f('0xe1')]({'active':![],'countabandonedretry':_0x46a059[_0xe52f('0xde')],'scheduledat':moment()[_0xe52f('0xd5')](_0x168b94['voiceQueues'][_0x215672[_0xe52f('0xb8')]]['dialAbandonedRetryFrequency'],_0xe52f('0xd6'))[_0xe52f('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f9da6[_0xe52f('0xd7')],'ListId':_0x4f9da6[_0xe52f('0xd8')],'VoiceQueueId':_0x4f9da6['VoiceQueueId']||undefined,'CampaignId':_0x4f9da6['CampaignId']||undefined})[_0xe52f('0xa2')](loggerCatch(_0xe52f('0xe2')));var _0x3ee9ea=new History(_0x46a059);_0x3ee9ea['state']=0xb;_0x3ee9ea[_0xe52f('0x71')]=_0xe52f('0xe3');_0x3ee9ea[_0xe52f('0x73')]=moment()[_0xe52f('0x47')](_0xe52f('0xbe'));_0x3ee9ea[_0xe52f('0x72')]=_0x3ee9ea['starttime'];_0x3ee9ea[_0xe52f('0xdb')]=_0x46a059[_0xe52f('0xdb')];_0x3ee9ea[_0xe52f('0xdc')]=_0x46a059[_0xe52f('0xdc')];hopperUtils['createHistory'](_0x3ee9ea)[_0xe52f('0xa2')](loggerCatch(_0xe52f('0xe4')));}})[_0xe52f('0x3f')](function(){if(_0x28fba0)hopperUtils[_0xe52f('0xdd')](_0x46a059,_0x12a398,_0x4359e5)[_0xe52f('0x3f')](function(){return 0x1;});});}}}};Dialer[_0xe52f('0x86')]['syncNewExten']=function(_0x32a88e){if(this[_0xe52f('0x24')][_0x32a88e[_0xe52f('0xbc')]]){this[_0xe52f('0x24')][_0x32a88e['uniqueid']][_0xe52f('0xe5')]=_0x32a88e['channel'];}if(this[_0xe52f('0x25')][_0x32a88e['uniqueid']]){this[_0xe52f('0x25')][_0x32a88e['uniqueid']][_0xe52f('0xe5')]=_0x32a88e[_0xe52f('0xe5')];}};Dialer[_0xe52f('0x86')][_0xe52f('0x3b')]=function(_0x1aefb6){if(!this[_0xe52f('0x24')][_0x1aefb6[_0xe52f('0xe6')]]){return;}var _0x3e3023=this[_0xe52f('0x1f')][this[_0xe52f('0x24')][_0x1aefb6[_0xe52f('0xe6')]][_0xe52f('0xb8')]][_0xe52f('0xe7')]||_0xe52f('0xe8');if(_0x3e3023===_0xe52f('0xe9')){if(this[_0xe52f('0x24')][_0x1aefb6[_0xe52f('0xe6')]]&&_['isNil'](this['actions'][_0x1aefb6[_0xe52f('0xe6')]][_0xe52f('0xea')])&&_0x1aefb6[_0xe52f('0x8b')]==='1'&&_0x1aefb6[_0xe52f('0xeb')]==='0'){if(this['agents'][_0x1aefb6[_0xe52f('0xec')]]){if(!this[_0xe52f('0x21')][_0x1aefb6[_0xe52f('0xec')]][_0xe52f('0xea')]){this[_0xe52f('0x21')][_0x1aefb6['stateinterface']]['locked']=!![];this[_0xe52f('0x24')][_0x1aefb6[_0xe52f('0xe6')]][_0xe52f('0xea')]=!![];this[_0xe52f('0x24')][_0x1aefb6['actionid']]['stateinterface']=_0x1aefb6['stateinterface'];}}}}else if(_0x3e3023==='rrmemory'){if(this[_0xe52f('0x24')][_0x1aefb6[_0xe52f('0xe6')]]){if(this[_0xe52f('0x21')][_0x1aefb6[_0xe52f('0xec')]]){this[_0xe52f('0x24')][_0x1aefb6['actionid']]['stateinterface']=_0x1aefb6['stateinterface'];if(_[_0xe52f('0xed')](this['queueBooked'][this[_0xe52f('0x24')][_0x1aefb6[_0xe52f('0xe6')]]['queue']])){this['queueBooked'][this['actions'][_0x1aefb6[_0xe52f('0xe6')]][_0xe52f('0xb8')]]=[];}this[_0xe52f('0xee')][this[_0xe52f('0x24')][_0x1aefb6['actionid']]['queue']][_0xe52f('0x9b')](_['merge'](_[_0xe52f('0x78')](this[_0xe52f('0x24')][_0x1aefb6[_0xe52f('0xe6')]],['idHopper',_0xe52f('0xec')]),{'status':_0x1aefb6[_0xe52f('0x8b')],'paused':_0x1aefb6[_0xe52f('0xeb')]}));}}}};Dialer[_0xe52f('0x86')][_0xe52f('0x3c')]=function(_0x57f7b3){if(!this[_0xe52f('0x24')][_0x57f7b3['actionid']]){return;}var _0xc96a5a=this;var _0x2c0d75=this[_0xe52f('0x1f')][this[_0xe52f('0x24')][_0x57f7b3['actionid']][_0xe52f('0xb8')]];var _0x55aea9=_0x2c0d75[_0xe52f('0xe7')]||_0xe52f('0xe8');if(_0x55aea9===_0xe52f('0xe9')){if(this[_0xe52f('0x24')][_0x57f7b3[_0xe52f('0xe6')]]&&this[_0xe52f('0x24')][_0x57f7b3['actionid']][_0xe52f('0xec')]){this[_0xe52f('0xef')][_0xe52f('0xf0')](this[_0xe52f('0x24')][_0x57f7b3['actionid']]['idHopper'],this['actions'][_0x57f7b3[_0xe52f('0xe6')]][_0xe52f('0xec')])[_0xe52f('0xa2')](function(_0x5d309d){logger[_0xe52f('0x67')](_0xe52f('0xf1'),util[_0xe52f('0x46')](_0x5d309d,{'showHidden':![],'depth':null}));})['finally'](function(){_0xc96a5a['updateOriginated'](_0xc96a5a[_0xe52f('0x1f')][_0xc96a5a[_0xe52f('0x24')][_0x57f7b3[_0xe52f('0xe6')]][_0xe52f('0xb8')]]);_0xc96a5a[_0xe52f('0x21')][_0xc96a5a['actions'][_0x57f7b3[_0xe52f('0xe6')]]['stateinterface']][_0xe52f('0xea')]=![];delete _0xc96a5a['actions'][_0x57f7b3[_0xe52f('0xe6')]];unlockQueueStatus(_0x2c0d75);});}else{this[_0xe52f('0xbb')](this[_0xe52f('0x1f')][this['actions'][_0x57f7b3['actionid']][_0xe52f('0xb8')]]);hopperUtils[_0xe52f('0xe1')]({'active':![],'ContactId':this[_0xe52f('0x24')][_0x57f7b3[_0xe52f('0xe6')]][_0xe52f('0xd7')],'ListId':this[_0xe52f('0x24')][_0x57f7b3[_0xe52f('0xe6')]]['ListId'],'VoiceQueueId':this[_0xe52f('0x24')][_0x57f7b3[_0xe52f('0xe6')]][_0xe52f('0xd9')]||undefined,'CampaignId':this[_0xe52f('0x24')][_0x57f7b3[_0xe52f('0xe6')]]['CampaignId']||undefined})[_0xe52f('0xa2')](loggerCatch(_0xe52f('0xf2')));delete this['actions'][_0x57f7b3[_0xe52f('0xe6')]];unlockQueueStatus(_0x2c0d75);}}else if(_0x55aea9===_0xe52f('0xe8')){var _0x40cf2a;if(this[_0xe52f('0x24')][_0x57f7b3['actionid']]&&!_['isEmpty'](this[_0xe52f('0xee')][this[_0xe52f('0x24')][_0x57f7b3[_0xe52f('0xe6')]][_0xe52f('0xb8')]])){if(this[_0xe52f('0x29')][_0xc96a5a[_0xe52f('0x24')][_0x57f7b3['actionid']][_0xe52f('0xb8')]]){this[_0xe52f('0x29')][_0xc96a5a[_0xe52f('0x24')][_0x57f7b3[_0xe52f('0xe6')]][_0xe52f('0xb8')]]=this[_0xe52f('0x29')][this['actions'][_0x57f7b3[_0xe52f('0xe6')]][_0xe52f('0xb8')]]?this[_0xe52f('0x29')][this['actions'][_0x57f7b3[_0xe52f('0xe6')]][_0xe52f('0xb8')]]:this[_0xe52f('0xee')][this[_0xe52f('0x24')][_0x57f7b3[_0xe52f('0xe6')]][_0xe52f('0xb8')]]?this[_0xe52f('0xee')][this[_0xe52f('0x24')][_0x57f7b3['actionid']]['queue']][_0xe52f('0xf3')]||0x0:0x0;}this[_0xe52f('0xee')][this[_0xe52f('0x24')][_0x57f7b3[_0xe52f('0xe6')]][_0xe52f('0xb8')]][_0xe52f('0xf3')]=this[_0xe52f('0x29')][this[_0xe52f('0x24')][_0x57f7b3[_0xe52f('0xe6')]]['queue']];for(var _0x135c61=0x0;_0x135c61=_0x14e136[_0xe52f('0x115')]){_0x4fa5fc[_0xe52f('0x116')](_0x1cdedf,_0x14bfd1,_0xa8993,_0xe52f('0x117'));}else{if(_0x1cdedf['countmachineretry']>=_0x14e136['dialMachineMaxRetry']){_0x4fa5fc[_0xe52f('0x118')](_0x1cdedf,_0x14bfd1,_0xa8993,_0xe52f('0x119'));}else{hopperUtils[_0xe52f('0xe1')]({'active':![],'countmachineretry':_0x1cdedf['countmachineretry'],'scheduledat':moment()[_0xe52f('0xd5')](_0x14e136['dialMachineRetryFrequency'],'minutes')[_0xe52f('0x47')](_0xe52f('0xbe')),'ContactId':_0x1cdedf['ContactId'],'ListId':_0x1cdedf[_0xe52f('0xd8')],'VoiceQueueId':_0x1cdedf[_0xe52f('0xd9')]||undefined,'CampaignId':_0x1cdedf['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x14bfd1({'reschedule':0x1});}}});}if(_0x58127['type']===_0xe52f('0xba')&&this[_0xe52f('0x20')][_0x58127[_0xe52f('0xb8')]][_0xe52f('0x106')]&&_0x3dc34f['value']===_0xe52f('0x107')){delete this[_0xe52f('0x25')][_0x3dc34f[_0xe52f('0xbc')]];this[_0xe52f('0xbb')](this[_0xe52f('0x20')][_0x58127[_0xe52f('0xb8')]]);_0x4d475c=new Hangup(_0x58127,_0x3dc34f);_0x4d475c['state']=0x12;_0x4d475c[_0xe52f('0x71')]=_0xe52f('0x11a');_0x4d475c[_0xe52f('0x109')]=_0xe52f('0x110');ami[_0xe52f('0x42')](_0xe52f('0x10a'),ut[_0xe52f('0x11b')](_0x4d475c,_0xe52f('0x10b')));this[_0xe52f('0x10c')](_0x4d475c,_0xe52f('0x11c'),_0xe52f('0x11d'));}if(_0x58127['type']==='ivr'&&this['campaigns'][_0x58127[_0xe52f('0xb8')]][_0xe52f('0x106')]&&_0x3dc34f[_0xe52f('0x10f')]===_0xe52f('0x11e')){return new Promise(function(_0x319067,_0x42ca3f){delete _0x4fa5fc[_0xe52f('0x25')][_0x3dc34f[_0xe52f('0xbc')]];_0x4fa5fc[_0xe52f('0xbb')](_0x4fa5fc[_0xe52f('0x20')][_0x58127[_0xe52f('0xb8')]]);_0x4fa5fc[_0xe52f('0x20')][_0x58127[_0xe52f('0xb8')]]['outboundAnswerCallsDay']+=0x1;_0x4fa5fc[_0xe52f('0x20')][_0x58127[_0xe52f('0xb8')]][_0xe52f('0x108')]+=0x1;var _0x44b1ed=_0x4fa5fc[_0xe52f('0x20')][_0x58127['queue']];var _0x4055e9=new Hangup(_0x58127,_0x3dc34f);_0x4055e9[_0xe52f('0xcb')]=0x13;_0x4055e9[_0xe52f('0x71')]=_0xe52f('0x11f');_0x4055e9[_0xe52f('0x109')]='AMD';_0x4055e9['countmachineretry']+=0x1;_0x4055e9[_0xe52f('0x120')]+=0x1;_0x4055e9[_0xe52f('0x10b')]=!![];ami[_0xe52f('0x42')](_0xe52f('0x10a'),ut[_0xe52f('0x11b')](_0x4055e9,'amd'));hopperUtils[_0xe52f('0xc5')](_0x4055e9)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4055e9[_0xe52f('0x121')]+_0x4055e9[_0xe52f('0x122')]+_0x4055e9[_0xe52f('0x113')]+_0x4055e9[_0xe52f('0x114')]+_0x4055e9[_0xe52f('0xcf')]+_0x4055e9[_0xe52f('0xde')]+_0x4055e9[_0xe52f('0x111')]+_0x4055e9['countagentrejectretry']>=_0x44b1ed[_0xe52f('0x115')]){_0x4fa5fc[_0xe52f('0x116')](_0x4055e9,_0x319067,_0x42ca3f,_0xe52f('0x117'));}else{if(_0x4055e9[_0xe52f('0x111')]>=_0x44b1ed[_0xe52f('0x123')]){_0x4fa5fc[_0xe52f('0x118')](_0x4055e9,_0x319067,_0x42ca3f,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x4055e9[_0xe52f('0x111')],'scheduledat':moment()[_0xe52f('0xd5')](_0x44b1ed[_0xe52f('0x124')],_0xe52f('0xd6'))['format'](_0xe52f('0xbe')),'ContactId':_0x4055e9['ContactId'],'ListId':_0x4055e9[_0xe52f('0xd8')],'VoiceQueueId':_0x4055e9[_0xe52f('0xd9')]||undefined,'CampaignId':_0x4055e9[_0xe52f('0xfb')]||undefined})[_0xe52f('0xa2')](loggerCatch(_0xe52f('0x125')));_0x319067({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xe52f('0x36')]=function(_0x2b99f8){var _0x363ed3=this['uniqueId'][_0x2b99f8[_0xe52f('0xbc')]];var _0x329196;if(_0x363ed3&&_0x363ed3[_0xe52f('0xb9')]===_0xe52f('0xba')){delete this[_0xe52f('0x25')][_0x2b99f8['uniqueid']];this[_0xe52f('0xbb')](this['campaigns'][_0x363ed3[_0xe52f('0xb8')]]);this[_0xe52f('0x20')][_0x363ed3['queue']][_0xe52f('0x126')]+=0x1;_0x329196=new Hangup(_0x363ed3,_0x2b99f8);hopperUtils['createHistory'](_0x329196)['catch'](loggerCatch(_0xe52f('0x127')));hopperUtils[_0xe52f('0x128')](_0x329196)['catch'](loggerCatch(_0xe52f('0x129')));}if(_0x363ed3&&_0x363ed3[_0xe52f('0xb9')]!==_0xe52f('0xba')&&isNotNull(this[_0xe52f('0x1f')][_0x363ed3['queue']][_0xe52f('0x12a')])){delete this['uniqueId'][_0x2b99f8['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x363ed3[_0xe52f('0xb8')]]);this['voiceQueues'][_0x363ed3[_0xe52f('0xb8')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x363ed3[_0xe52f('0xb8')]][_0xe52f('0x108')]+=0x1;_0x329196=new Hangup(_0x363ed3,_0x2b99f8);_0x329196[_0xe52f('0xcb')]=0x10;_0x329196[_0xe52f('0x71')]=_0xe52f('0x12b');_0x329196[_0xe52f('0x109')]='AGI';hopperUtils[_0xe52f('0xc5')](_0x329196)[_0xe52f('0xa2')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xe52f('0x128')](_0x329196)['catch'](loggerCatch(_0xe52f('0x129')));}if(_0x363ed3&&_0x363ed3[_0xe52f('0xb9')]!==_0xe52f('0xba')&&!isNotNull(this[_0xe52f('0x1f')][_0x363ed3['queue']]['dialQueueProject'])){delete this[_0xe52f('0x25')][_0x2b99f8['uniqueid']];this[_0xe52f('0xbb')](this[_0xe52f('0x1f')][_0x363ed3[_0xe52f('0xb8')]]);this[_0xe52f('0x1f')][_0x363ed3[_0xe52f('0xb8')]][_0xe52f('0x12c')]+=0x1;_0x329196=new Hangup(_0x363ed3,_0x2b99f8);_0x329196[_0xe52f('0xcb')]=0xc;_0x329196[_0xe52f('0x71')]=_0x2b99f8[_0xe52f('0x12d')];_0x329196[_0xe52f('0x109')]=_0xe52f('0x12e');hopperUtils[_0xe52f('0xc5')](_0x329196)[_0xe52f('0xa2')](loggerCatch(_0xe52f('0x127')));hopperUtils[_0xe52f('0x128')](_0x329196)[_0xe52f('0xa2')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xe52f('0x86')][_0xe52f('0xc')]=function(_0xa0f933){var _0x55d3a3=this;if(!_0x55d3a3['queuesSummary'][_0xa0f933[_0xe52f('0x63')]]){_0x55d3a3[_0xe52f('0x2a')][_0xa0f933[_0xe52f('0x63')]]={'running':![]};}else if(_0x55d3a3[_0xe52f('0x2a')][_0xa0f933[_0xe52f('0x63')]][_0xe52f('0x12f')]===!![]){return;}else if(_0x55d3a3[_0xe52f('0x2a')][_0xa0f933[_0xe52f('0x63')]][_0xe52f('0x12f')]===![]){_0x55d3a3[_0xe52f('0x2a')][_0xa0f933[_0xe52f('0x63')]][_0xe52f('0x12f')]=!![];}var _0x3198e9=_0x55d3a3['voiceQueues'][_0xa0f933[_0xe52f('0x63')]];var _0x4c0791=_0x3198e9[_0xe52f('0x6a')]!==utils[_0xe52f('0x6b')][_0xe52f('0x7e')];var _0x3e0ea5=utils['isPreviewCampaign'](_0x3198e9);_0x3198e9[_0xe52f('0x130')]=utils['getQueueCampaignStatusMessage'](_0x3198e9,_0x55d3a3['trunks']);Promise[_0xe52f('0xab')]()[_0xe52f('0x3f')](function(){if(_0x3198e9[_0xe52f('0x130')]===utils['CAMPAIGN_STATUS'][_0xe52f('0x7e')]){if(_0x4c0791){clearPredictiveAttributes(_0x3198e9);_0xa0f933[_0xe52f('0x26')]=undefined;_0xa0f933[_0xe52f('0x27')]=undefined;}if(_0x3198e9[_0xe52f('0x130')]===utils[_0xe52f('0x6b')][_0xe52f('0x7e')]){_0xa0f933['available']=0x0;_0xa0f933[_0xe52f('0xeb')]=0x0;_0xa0f933[_0xe52f('0x131')]=0x0;_0xa0f933[_0xe52f('0x132')]=0x0;_0xa0f933[_0xe52f('0x133')]=0x0;}}else if(_0x3198e9[_0xe52f('0x130')]===utils[_0xe52f('0x6b')][_0xe52f('0x134')]&&!_0x3e0ea5){return _0x55d3a3[_0xe52f('0x93')](_0x3198e9,!![])[_0xe52f('0x3f')](function(){return _0x55d3a3[_0xe52f('0x93')](_0x3198e9,![]);})[_0xe52f('0x3f')](function(){return _0x55d3a3[_0xe52f('0x135')](_0x3198e9);})['catch'](function(_0x1ee116){loggerSyncQueueSummary['debug'](_0xe52f('0x136'),util[_0xe52f('0x46')](_0x1ee116,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3198e9);});}else{clearPredictiveAttributes(_0x3198e9);}})[_0xe52f('0x3f')](function(){var _0x1b2ea6=_0xa0f933[_0xe52f('0x137')](_0x3198e9);if(_0x1b2ea6||_0x3198e9['queueSummaryCountersUpdated']){_0x3198e9['queueSummaryCountersUpdated']=![];_0xa0f933['updateReportFromOutboundQueue'](_0x3198e9);Object[_0xe52f('0x138')](_0x3198e9,_0xa0f933);emitOutboundVoiceQueueSummary(_0xa0f933);}_0x55d3a3[_0xe52f('0x2a')][_0x3198e9['name']]['running']=![];})[_0xe52f('0xa2')](function(_0x2f3fb0){logger[_0xe52f('0x67')](_0xe52f('0x136'),util[_0xe52f('0x46')](_0x2f3fb0,{'showHidden':![],'depth':null}));_0x55d3a3[_0xe52f('0x2a')][_0x3198e9[_0xe52f('0x63')]]['running']=![];});};Dialer[_0xe52f('0x86')][_0xe52f('0x34')]=_[_0xe52f('0x139')](function(){var _0x3f68b0=_[_0xe52f('0x13a')](this[_0xe52f('0x1f')],function(_0x5484b1){return _0x5484b1[_0xe52f('0x13b')];});var _0x347ab5=_[_0xe52f('0x13a')](this['agents'],function(_0x4f1909){return _0x4f1909[_0xe52f('0x13c')]&&_0x4f1909['status']===_0xe52f('0x13d');});if(_0x3f68b0[_0xe52f('0x9a')]>0x0&&_0x347ab5[_0xe52f('0x9a')]>0x0){return Promise[_0xe52f('0xab')]()[_0xe52f('0x3f')](cmHopper[_0xe52f('0x13e')](_['map'](_0x3f68b0,'id'),previewRecallmeReminderInterval,_['map'](_0x347ab5,'id')))[_0xe52f('0x3f')](function(_0x5a8015){for(var _0x95ca77=0x0;_0x95ca77<_0x5a8015['length'];_0x95ca77++){var _0x14f419=_0x5a8015[_0x95ca77]['Agent'][_0xe52f('0x63')];if(_0x14f419)io['to'](util[_0xe52f('0x47')]('user:%s',_0x14f419))[_0xe52f('0x42')](_0xe52f('0x13f'),{'hopper':_0x5a8015[_0x95ca77]});}})['catch'](function(_0x1fcae6){logger[_0xe52f('0x67')](_0xe52f('0x140'),_0x1fcae6);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xe52f('0x86')][_0xe52f('0x141')]=function(){var _0x843133=this;setInterval(function(){_0x843133[_0xe52f('0x142')](_0x843133[_0xe52f('0x25')],_0xe52f('0x143'));_0x843133[_0xe52f('0x142')](_0x843133[_0xe52f('0x24')],_0xe52f('0x144'));},0x32c8);};Dialer[_0xe52f('0x86')][_0xe52f('0x142')]=function(_0x5549c9,_0x2269c1){var _0x1eae17=this;for(var _0x47e2e9 in _0x5549c9){if(typeof _0x5549c9[_0x47e2e9]!=='undefined'){this[_0xe52f('0x1e')][_0xe52f('0x1b')](function(){if(!_[_0xe52f('0xed')](_0x5549c9[_0x47e2e9])){return ami[_0xe52f('0x9c')]({'action':_0xe52f('0x8b'),'channel':_0x5549c9[_0x47e2e9]['channel']})[_0xe52f('0xa2')](function(_0x181d1c){if(_0x181d1c[_0xe52f('0x6a')]===_0xe52f('0x145')){setTimeout(function(){if(_0x5549c9[_0x47e2e9]&&_0x5549c9[_0x47e2e9]['type']!==_0xe52f('0xba')){_0x1eae17[_0xe52f('0xbb')](_0x1eae17[_0xe52f('0x1f')][_0x5549c9[_0x47e2e9]['queue']]);logger[_0xe52f('0x67')](_0xe52f('0x146'),_0x2269c1,_0x47e2e9,_0x5549c9[_0x47e2e9][_0xe52f('0xb8')]);delete _0x5549c9[_0x47e2e9];}if(_0x5549c9[_0x47e2e9]&&_0x5549c9[_0x47e2e9]['type']===_0xe52f('0xba')){_0x1eae17[_0xe52f('0xbb')](_0x1eae17[_0xe52f('0x20')][_0x5549c9[_0x47e2e9]['queue']]);logger[_0xe52f('0x67')]('[Dialer][checkChannel][ivr]',_0x2269c1,_0x47e2e9,_0x5549c9[_0x47e2e9][_0xe52f('0xb8')]);delete _0x5549c9[_0x47e2e9];}},0x2328);}});}});}}};Dialer[_0xe52f('0x86')][_0xe52f('0x147')]=function(_0x8e1765){return Promise['resolve']()[_0xe52f('0x3f')](voiceQueueRt[_0xe52f('0x147')](_0x8e1765))[_0xe52f('0xa2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xe52f('0x86')]['updateOriginated']=function(_0x5b35aa){if(!_[_0xe52f('0x41')](_0x5b35aa)&&_0x5b35aa!==null){if(typeof _0x5b35aa[_0xe52f('0x81')]!==_0xe52f('0x148')){if(_0x5b35aa[_0xe52f('0x81')]>0x0){_0x5b35aa[_0xe52f('0x81')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xe52f('0x67')](_0xe52f('0x149'));}};Dialer['prototype'][_0xe52f('0x14a')]=function(_0x9fdbca,_0x228ea6){var _0x390902=this;return function(_0x98d505){_0x390902[_0xe52f('0xbb')](_0x228ea6);logger['error'](_0x9fdbca,util['inspect'](_0x98d505,{'showHidden':![],'depth':null}));};};Dialer[_0xe52f('0x86')]['emptyContact']=function(_0x45a8d6,_0x48ee8d,_0x444edb){var _0x1249f1={'state':0x19,'statedesc':_0xe52f('0x14b')};this[_0xe52f('0xbb')](_0x48ee8d);this[_0xe52f('0x10c')](_[_0xe52f('0x61')](_0x1249f1,_[_0xe52f('0x78')](_0x444edb,[_0xe52f('0xd7'),_0xe52f('0xd8'),_0xe52f('0x14c'),_0xe52f('0xd9'),'CampaignId'])),_0xe52f('0x14d'),_0xe52f('0x14e'));logger[_0xe52f('0x67')](_0x45a8d6);};Dialer['prototype'][_0xe52f('0x10c')]=function(_0x5ebb96,_0x47eb45,_0xc91f9e){hopperUtils[_0xe52f('0xc5')](_0x5ebb96)['catch'](loggerCatch(_0x47eb45));hopperUtils[_0xe52f('0x128')](_0x5ebb96)[_0xe52f('0xa2')](loggerCatch(_0xc91f9e));};Dialer['prototype'][_0xe52f('0xd3')]=function(_0x48ad28,_0x4fe297){hopperUtils[_0xe52f('0xc5')](_0x48ad28)['catch'](loggerCatch(_0xe52f('0xc6')));if(_0x4fe297==0x0){hopperUtils[_0xe52f('0x128')](_0x48ad28)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x2fcda7){return Promise[_0xe52f('0xab')]()[_0xe52f('0x3f')](cmHopper['handlePreviewRecallNotifications'](_0x2fcda7['id'],previewRecallmeReminderInterval))[_0xe52f('0x3f')](function(_0x399f66){for(var _0x22f8ef=0x0;_0x22f8ef<_0x399f66[_0xe52f('0x9a')];_0x22f8ef++){var _0x30240a=_0x399f66[_0x22f8ef][_0xe52f('0x14f')][_0xe52f('0x63')];if(_0x30240a)io['to'](util['format']('user:%s',_0x30240a))[_0xe52f('0x42')]('user:dialPreviewRecallReminder',{'hopper':_0x399f66[_0x22f8ef]});}})[_0xe52f('0xa2')](function(){});};Dialer[_0xe52f('0x86')]['launchHandleIvr']=function(_0x20b0b2){var _0x31e971=this;return function(){_0x31e971[_0xe52f('0x150')](_0x20b0b2);};};Dialer[_0xe52f('0x86')][_0xe52f('0x151')]=function(_0x3f81b4,_0x667046){var _0x19887c=this;var _0x539e14=uuid['v4']();this[_0xe52f('0x24')][_0x539e14]=new Action(_0x3f81b4,_0x667046,_0x539e14);return new Promise(function(_0x517d7a,_0x581a45){if(_[_0xe52f('0x41')](_0x3f81b4)&&typeof _0x3f81b4!==_0xe52f('0x152')){return _0x581a45(msgResponse('originate','Failure',_0xe52f('0x153')));}if(_['isUndefined'](_0x667046[_0xe52f('0x154')])||_0x667046[_0xe52f('0x154')]===null){return _0x581a45(msgResponse(_0xe52f('0x155'),_0xe52f('0x95'),_0xe52f('0x156')));}var _0x54d5b5={'XMD-CALLERID':_0x19887c['actions'][_0x539e14][_0xe52f('0x157')](),'XMD-AGI':_0x3f81b4['dialQueueProject']?util[_0xe52f('0x47')](_0xe52f('0x158'),ipAgi,_0x3f81b4[_0xe52f('0x12a')]):'NONE','XMD-AGIAFTER':_0x3f81b4['dialQueueProject2']?util[_0xe52f('0x47')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3f81b4['dialQueueProject2']):_0xe52f('0x159'),'XMD-QUEUE':utils['isOutboundQueue'](_0x3f81b4)?util[_0xe52f('0x47')]('\x22%s,%s%s,,,%s\x22',_0x3f81b4[_0xe52f('0x63')],_0x3f81b4[_0xe52f('0x15a')]||'',_0x3f81b4[_0xe52f('0xc4')]?'c':'',_0x3f81b4['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x667046['ContactId'],'XMD-CDRTYPE':_0xe52f('0x7'),'CALLERID(all)':_0x19887c[_0xe52f('0x24')][_0x539e14][_0xe52f('0x157')](),'XMD-AMD':_0x3f81b4[_0xe52f('0x106')]?_0xe52f('0x134'):_0xe52f('0x159'),'XMD-DESTINATION':_0xe52f('0x105')};if(_0x3f81b4[_0xe52f('0x106')]){_0x54d5b5[_0xe52f('0x15b')]=_0x3f81b4[_0xe52f('0x15c')]||0x9c4;_0x54d5b5['XMD-AMDGREETING']=_0x3f81b4[_0xe52f('0x15d')]||0x5dc;_0x54d5b5[_0xe52f('0x15e')]=_0x3f81b4[_0xe52f('0x15f')]||0x320;_0x54d5b5['XMD-AMDTOTALANALYSISTIME']=_0x3f81b4[_0xe52f('0x160')]||0x1388;_0x54d5b5[_0xe52f('0x161')]=_0x3f81b4[_0xe52f('0x162')]||0x64;_0x54d5b5['XMD-AMDBETWEENWORDSSILENCE']=_0x3f81b4[_0xe52f('0x163')]||0x32;_0x54d5b5['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x3f81b4[_0xe52f('0x164')]||0x3;_0x54d5b5[_0xe52f('0x165')]=_0x3f81b4[_0xe52f('0x166')]||0x100;_0x54d5b5[_0xe52f('0x167')]=_0x3f81b4[_0xe52f('0x168')]||0x1388;}if(utils[_0xe52f('0x169')](_0x3f81b4)){_0x54d5b5[_0xe52f('0x16a')]=_0x667046['VoiceQueueId'];}else{_0x54d5b5[_0xe52f('0x16b')]=_0x667046[_0xe52f('0xfb')];}for(var _0x5de1c4 in _0x667046[_0xe52f('0x16c')]){if(typeof _0x667046['Contact'][_0x5de1c4]!==_0xe52f('0x148')){if(isNotNull(_0x667046[_0xe52f('0x16c')][_0x5de1c4])&&_0x5de1c4!=='id'&&_0x5de1c4!==_0xe52f('0x16d')&&_0x5de1c4!==_0xe52f('0x16e')&&_0x5de1c4!==_0xe52f('0x16f')){_0x54d5b5[util['format'](_0xe52f('0x170'),'XMD-',_[_0xe52f('0x171')](_0x5de1c4))]=_0x667046[_0xe52f('0x16c')][_0x5de1c4];}}}var _0x4a731b=_0x19887c['isTrunkReachable'](_0x3f81b4[_0xe52f('0x8d')])?utils['getCallerId'](_0x3f81b4[_0xe52f('0x8d')]['callerid'],_0x3f81b4[_0xe52f('0x172')],_0x3f81b4[_0xe52f('0x173')]>0x0?utils[_0xe52f('0x174')](_0x3f81b4[_0xe52f('0x175')],_0x3f81b4[_0xe52f('0x173')]):_0x3f81b4[_0xe52f('0x175')]):utils[_0xe52f('0x176')](_[_0xe52f('0xed')](_0x3f81b4[_0xe52f('0x177')])?_0x3f81b4[_0xe52f('0x8d')]['callerid']:_0x3f81b4[_0xe52f('0x177')][_0xe52f('0x178')],_0x3f81b4[_0xe52f('0x172')],_0x3f81b4[_0xe52f('0x173')]>0x0?utils[_0xe52f('0x174')](_0x3f81b4[_0xe52f('0x175')],_0x3f81b4[_0xe52f('0x173')]):_0x3f81b4[_0xe52f('0x175')]);if(_0x4a731b){_0x54d5b5[_0xe52f('0x179')]=_0x19887c[_0xe52f('0x24')][_0x539e14][_0xe52f('0x17a')]=utils['extractCalleridName'](_0x4a731b);_0x54d5b5['XMD-ORIGINATECALLERIDNUM']=_0x667046[_0xe52f('0x154')];}_0x3f81b4['variables']=_0x54d5b5;return ami['Action']({'actionid':_0x539e14,'action':_0xe52f('0x155'),'channel':_0x19887c['isTrunkReachable'](_0x3f81b4[_0xe52f('0x8d')])?util[_0xe52f('0x47')](_0xe52f('0x17b'),_0x3f81b4['Trunk'][_0xe52f('0x63')],isNotNull(_0x3f81b4[_0xe52f('0x17c')])?_0x3f81b4[_0xe52f('0x17c')][_0xe52f('0x17d')]()||'':'',_0x3f81b4[_0xe52f('0x17e')]>0x0?_0x667046[_0xe52f('0x154')][_0xe52f('0x17f')](_0x3f81b4[_0xe52f('0x17e')]):_0x667046[_0xe52f('0x154')]):util['format'](_0xe52f('0x17b'),_[_0xe52f('0xed')](_0x3f81b4['TrunkBackup'])?_0x3f81b4[_0xe52f('0x8d')][_0xe52f('0x63')]:_0x3f81b4[_0xe52f('0x177')]['name'],isNotNull(_0x3f81b4[_0xe52f('0x17c')])?_0x3f81b4[_0xe52f('0x17c')]['trim']()||'':'',_0x3f81b4[_0xe52f('0x17e')]>0x0?_0x667046[_0xe52f('0x154')][_0xe52f('0x17f')](_0x3f81b4[_0xe52f('0x17e')]):_0x667046['phone']),'callerid':_0x4a731b,'Exten':_0xe52f('0x105'),'Context':'from-sip','Priority':'1','variable':_0x54d5b5,'timeout':(_0x3f81b4[_0xe52f('0x180')]||0x1e)*0x3e8,'async':!![],'channelid':_0x539e14})[_0xe52f('0x3f')](function(_0x52f9b6){return _0x517d7a(_0x52f9b6);})[_0xe52f('0xa2')](function(_0x51e00d){_0x3f81b4['outboundOriginateFailureCallsDay']+=0x1;var _0x345b1c=new History(_0x19887c[_0xe52f('0x24')][_0x539e14]);logger[_0xe52f('0x67')](util[_0xe52f('0x47')](_0xe52f('0x181'),JSON[_0xe52f('0x77')](_0x51e00d)));_0x345b1c[_0xe52f('0xcb')]=0xe;_0x345b1c['statedesc']=_0xe52f('0x182');_0x345b1c[_0xe52f('0x73')]=moment()[_0xe52f('0x47')](_0xe52f('0xbe'));_0x345b1c[_0xe52f('0x72')]=_0x345b1c[_0xe52f('0x73')];hopperUtils['createHistory'](_0x345b1c)[_0xe52f('0xa2')](loggerCatch(_0xe52f('0x183')));_0x19887c[_0xe52f('0x128')](_0x345b1c)['catch'](loggerCatch(_0xe52f('0x183')))[_0xe52f('0x1d')](function(){delete _0x19887c[_0xe52f('0x24')][_0x539e14];return _0x581a45(msgResponse(_0xe52f('0x155'),'Error',_0xe52f('0x184')));});});});};Dialer['prototype'][_0xe52f('0x185')]=function(_0x8fcfce,_0x143173,_0x5ba147){var _0x5a251f=new History(_0x143173);if(_0x5a251f[_0xe52f('0x121')]+_0x5a251f[_0xe52f('0x122')]+_0x5a251f[_0xe52f('0x113')]+_0x5a251f['countnosuchnumberretry']+_0x5a251f['countdropretry']+_0x5a251f[_0xe52f('0xde')]+_0x5a251f[_0xe52f('0x111')]+_0x5a251f['countagentrejectretry']>=_0x5ba147[_0xe52f('0x115')]-0x1){return!![];}switch(_0x8fcfce){case 0x3:if(_0x5a251f['countnoanswerretry']>=_0x5ba147[_0xe52f('0x186')]-0x1){return!![];}hopperUtils[_0xe52f('0xe1')]({'active':![],'countnoanswerretry':_0x5a251f['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x5ba147[_0xe52f('0x187')],_0xe52f('0xd6'))['format'](_0xe52f('0xbe')),'ContactId':_0x5a251f[_0xe52f('0xd7')],'ListId':_0x5a251f[_0xe52f('0xd8')],'VoiceQueueId':_0x5a251f[_0xe52f('0xd9')]||undefined,'CampaignId':_0x5a251f[_0xe52f('0xfb')]||undefined})[_0xe52f('0xa2')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x5a251f['countbusyretry']>=_0x5ba147[_0xe52f('0x188')]-0x1){return!![];}hopperUtils[_0xe52f('0xe1')]({'active':![],'countbusyretry':_0x5a251f[_0xe52f('0x121')]+=0x1,'scheduledat':moment()[_0xe52f('0xd5')](_0x5ba147[_0xe52f('0x189')],_0xe52f('0xd6'))[_0xe52f('0x47')](_0xe52f('0xbe')),'ContactId':_0x5a251f[_0xe52f('0xd7')],'ListId':_0x5a251f['ListId'],'VoiceQueueId':_0x5a251f['VoiceQueueId']||undefined,'CampaignId':_0x5a251f['CampaignId']||undefined})['catch'](loggerCatch(_0xe52f('0x18a')));break;case 0x8:if(_0x5a251f['countcongestionretry']>=_0x5ba147['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xe52f('0xe1')]({'active':![],'countcongestionretry':_0x5a251f[_0xe52f('0x122')]+=0x1,'scheduledat':moment()[_0xe52f('0xd5')](_0x5ba147[_0xe52f('0x18b')],_0xe52f('0xd6'))[_0xe52f('0x47')](_0xe52f('0xbe')),'ContactId':_0x5a251f[_0xe52f('0xd7')],'ListId':_0x5a251f['ListId'],'VoiceQueueId':_0x5a251f[_0xe52f('0xd9')]||undefined,'CampaignId':_0x5a251f[_0xe52f('0xfb')]||undefined})[_0xe52f('0xa2')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x5a251f[_0xe52f('0x114')]>=_0x5ba147[_0xe52f('0x18c')]-0x1){return!![];}else{hopperUtils[_0xe52f('0xe1')]({'active':![],'countnosuchnumberretry':_0x5a251f[_0xe52f('0x114')]+=0x1,'scheduledat':moment()[_0xe52f('0xd5')](_0x5ba147[_0xe52f('0x18d')],'minutes')[_0xe52f('0x47')](_0xe52f('0xbe')),'ContactId':_0x5a251f['ContactId'],'ListId':_0x5a251f['ListId'],'VoiceQueueId':_0x5a251f['VoiceQueueId']||undefined,'CampaignId':_0x5a251f['CampaignId']||undefined})['catch'](loggerCatch(_0xe52f('0x18e')));}break;case 0xa:if(_0x5a251f['countdropretry']>=_0x5ba147[_0xe52f('0xd2')]-0x1){return!![];}hopperUtils[_0xe52f('0xe1')]({'active':![],'countdropretry':_0x5a251f[_0xe52f('0xcf')]+=0x1,'scheduledat':moment()['add'](_0x5ba147['dialDropRetryFrequency'],'minutes')[_0xe52f('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5a251f[_0xe52f('0xd7')],'ListId':_0x5a251f[_0xe52f('0xd8')],'VoiceQueueId':_0x5a251f['VoiceQueueId']||undefined,'CampaignId':_0x5a251f[_0xe52f('0xfb')]||undefined})[_0xe52f('0xa2')](loggerCatch(_0xe52f('0xda')));break;case 0xb:if(_0x5a251f[_0xe52f('0xde')]>=_0x5ba147[_0xe52f('0xe0')]-0x1){return!![];}hopperUtils[_0xe52f('0xe1')]({'active':![],'countabandonedretry':_0x5a251f[_0xe52f('0xde')]+=0x1,'scheduledat':moment()[_0xe52f('0xd5')](_0x5ba147[_0xe52f('0x18f')],_0xe52f('0xd6'))[_0xe52f('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5a251f['ContactId'],'ListId':_0x5a251f['ListId'],'VoiceQueueId':_0x5a251f['VoiceQueueId']||undefined,'CampaignId':_0x5a251f[_0xe52f('0xfb')]||undefined})[_0xe52f('0xa2')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x5a251f[_0xe52f('0x111')]>=_0x5ba147[_0xe52f('0x123')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x5a251f['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x5ba147[_0xe52f('0x124')],_0xe52f('0xd6'))[_0xe52f('0x47')](_0xe52f('0xbe')),'ContactId':_0x5a251f[_0xe52f('0xd7')],'ListId':_0x5a251f[_0xe52f('0xd8')],'VoiceQueueId':_0x5a251f[_0xe52f('0xd9')]||undefined,'CampaignId':_0x5a251f[_0xe52f('0xfb')]||undefined})[_0xe52f('0xa2')](loggerCatch(_0xe52f('0x125')));break;case 0x14:if(_0x5a251f[_0xe52f('0x190')]>=_0x5ba147['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x5a251f[_0xe52f('0x190')]+=0x1,'scheduledat':moment()[_0xe52f('0xd5')](_0x5ba147[_0xe52f('0x191')],_0xe52f('0xd6'))[_0xe52f('0x47')](_0xe52f('0xbe')),'ContactId':_0x5a251f['ContactId'],'ListId':_0x5a251f[_0xe52f('0xd8')],'VoiceQueueId':_0x5a251f[_0xe52f('0xd9')]||undefined,'CampaignId':_0x5a251f[_0xe52f('0xfb')]||undefined})['catch'](loggerCatch(_0xe52f('0x192')));break;default:return!![];}};Dialer[_0xe52f('0x86')][_0xe52f('0x100')]=function(_0x175439,_0x116145,_0x134111){var _0x45c518=this;var _0x5f0e0f=new History(_0x175439);var _0x322d6e=![];var _0x194209;var _0x49a314;return new Promise(function(_0x568fc0,_0x32b52f){if(_['isUndefined'](_0x116145)&&typeof _0x116145!=='object'){return _0x32b52f(msgResponse(_0xe52f('0x193'),_0xe52f('0x95'),_0xe52f('0x194')));}if(_[_0xe52f('0x41')](_0x134111)&&typeof _0x134111!==_0xe52f('0x152')){return _0x32b52f(msgResponse('[callProgressDetecting]',_0xe52f('0x95'),_0xe52f('0x195')));}hopperUtils['verifyAdditionalPhones'](_0x5f0e0f,_0x134111[_0xe52f('0xc0')],_0x116145)['then'](function(_0x549887){if(_0x549887[_0xe52f('0xd4')]==0x1)_0x322d6e=!![];switch(_0x134111[_0xe52f('0xc0')]){case'0':_0x116145[_0xe52f('0x196')]+=0x1;_0x5f0e0f[_0xe52f('0xcb')]=0x0;_0x5f0e0f['statedesc']=_0xe52f('0x197');_0x5f0e0f['countnosuchnumberretry']+=0x1;_0x5f0e0f[_0xe52f('0x120')]+=0x1;ami[_0xe52f('0x42')]('custom:agentnosuchnumber',ut[_0xe52f('0x11b')](_0x175439,'nosuchnumber'));_0x194209=_0x116145['dialNoSuchNumberRetryFrequency'];_0x49a314=_0x116145[_0xe52f('0x198')];hopperUtils['createHistory'](_0x5f0e0f)[_0xe52f('0xa2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x45c518[_0xe52f('0x185')](0x0,_0x175439,_0x116145)&&!_0x322d6e){if(_0x5f0e0f[_0xe52f('0x114')]>=_0x116145['dialNoSuchNumberMaxRetry']){_0x45c518[_0xe52f('0x118')](_0x5f0e0f,_0x568fc0,_0x32b52f,_0xe52f('0x199'));}else{_0x45c518['stateGlobal'](_0x5f0e0f,_0x568fc0,_0x32b52f,_0xe52f('0x199'));}}break;case'3':_0x116145[_0xe52f('0x19a')]+=0x1;_0x5f0e0f['state']=0x3;_0x5f0e0f['statedesc']=_0xe52f('0x19b');_0x5f0e0f[_0xe52f('0x113')]+=0x1;_0x5f0e0f[_0xe52f('0x120')]+=0x1;var _0x1df246=ut[_0xe52f('0x19c')](_0x175439,_0x116145);ami['emit']('custom:agentnoanswer',_0x1df246);_0x194209=_0x116145['dialNoAnswerRetryFrequency'];_0x49a314=_0x116145['callAdditionalPhoneAfterMin'];hopperUtils[_0xe52f('0xc5')](_0x5f0e0f)[_0xe52f('0xa2')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x45c518['checkRetriveMax'](0x3,_0x175439,_0x116145)&&!_0x322d6e){if(_0x5f0e0f[_0xe52f('0x113')]>=_0x116145[_0xe52f('0x186')]){_0x45c518[_0xe52f('0x118')](_0x5f0e0f,_0x568fc0,_0x32b52f,_0xe52f('0x19d'));}else{_0x45c518[_0xe52f('0x116')](_0x5f0e0f,_0x568fc0,_0x32b52f,_0xe52f('0x19d'));}}break;case'5':_0x116145['outboundBusyCallsDay']+=0x1;_0x5f0e0f[_0xe52f('0xcb')]=0x5;_0x5f0e0f[_0xe52f('0x71')]=_0xe52f('0x19e');_0x5f0e0f[_0xe52f('0x121')]+=0x1;_0x5f0e0f[_0xe52f('0x120')]+=0x1;ami['emit'](_0xe52f('0x19f'),ut[_0xe52f('0x11b')](_0x175439,_0xe52f('0x1a0')));_0x194209=_0x116145[_0xe52f('0x189')];_0x49a314=_0x116145['callAdditionalPhoneAfterMin'];hopperUtils[_0xe52f('0xc5')](_0x5f0e0f)[_0xe52f('0xa2')](loggerCatch(_0xe52f('0x1a1')));if(_0x45c518['checkRetriveMax'](0x5,_0x175439,_0x116145)&&!_0x322d6e){if(_0x5f0e0f[_0xe52f('0x121')]>=_0x116145[_0xe52f('0x188')]){_0x45c518[_0xe52f('0x118')](_0x5f0e0f,_0x568fc0,_0x32b52f,'reason\x205\x20busy');}else{_0x45c518['stateGlobal'](_0x5f0e0f,_0x568fc0,_0x32b52f,_0xe52f('0x1a2'));}}break;case'8':_0x116145[_0xe52f('0x1a3')]+=0x1;_0x5f0e0f['state']=0x8;_0x5f0e0f[_0xe52f('0x71')]='Congestion';_0x5f0e0f[_0xe52f('0x122')]+=0x1;_0x5f0e0f[_0xe52f('0x120')]+=0x1;_0x194209=_0x116145[_0xe52f('0x18b')];_0x49a314=_0x116145[_0xe52f('0x198')];ami['emit'](_0xe52f('0x1a4'),ut[_0xe52f('0x11b')](_0x175439,_0xe52f('0x1a5')));hopperUtils[_0xe52f('0xc5')](_0x5f0e0f)['catch'](loggerCatch(_0xe52f('0x1a6')));if(_0x45c518[_0xe52f('0x185')](0x8,_0x175439,_0x116145)&&!_0x322d6e){if(_0x5f0e0f[_0xe52f('0x122')]>=_0x116145['dialCongestionMaxRetry']){_0x45c518[_0xe52f('0x118')](_0x5f0e0f,_0x568fc0,_0x32b52f,_0xe52f('0x1a7'));}else{_0x45c518[_0xe52f('0x116')](_0x5f0e0f,_0x568fc0,_0x32b52f,'reason\x208\x20congestion');}}break;case'11':_0x116145[_0xe52f('0x1a8')]+=0x1;_0x5f0e0f[_0xe52f('0xcb')]=0xb;_0x5f0e0f[_0xe52f('0x71')]='Abandoned';_0x5f0e0f[_0xe52f('0xde')]+=0x1;_0x5f0e0f[_0xe52f('0x120')]+=0x1;_0x194209=_0x116145[_0xe52f('0x18f')];_0x49a314=_0x116145[_0xe52f('0x198')];hopperUtils['createHistory'](_0x5f0e0f)[_0xe52f('0xa2')](loggerCatch(_0xe52f('0xe4')));if(_0x45c518[_0xe52f('0x185')](0xb,_0x175439,_0x116145)&&!_0x322d6e){if(_0x5f0e0f[_0xe52f('0xde')]>=_0x116145[_0xe52f('0xe0')]){_0x45c518[_0xe52f('0x118')](_0x5f0e0f,_0x568fc0,_0x32b52f,'reason\x2011\x20abandoned');}else{_0x45c518[_0xe52f('0x116')](_0x5f0e0f,_0x568fc0,_0x32b52f,_0xe52f('0x1a9'));}}break;case'20':_0x116145['outboundRejectCallsDay']+=0x1;_0x5f0e0f[_0xe52f('0xcb')]=0x14;_0x5f0e0f[_0xe52f('0x71')]=_0xe52f('0x1aa');_0x5f0e0f['countagentrejectretry']+=0x1;_0x5f0e0f['countglobal']+=0x1;_0x194209=_0x116145['dialAgentRejectRetryFrequency'];_0x49a314=_0x116145[_0xe52f('0x198')];ami[_0xe52f('0x42')](_0xe52f('0x1ab'),ut[_0xe52f('0x11b')](_0x175439,_0xe52f('0x1ac')));hopperUtils[_0xe52f('0xc5')](_0x5f0e0f)[_0xe52f('0xa2')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x45c518[_0xe52f('0x185')](0x14,_0x175439,_0x116145)&&!_0x322d6e){if(_0x5f0e0f['countagentrejectretry']>=_0x116145[_0xe52f('0x1ad')]){_0x45c518[_0xe52f('0x118')](_0x5f0e0f,_0x568fc0,_0x32b52f,_0xe52f('0x1ae'));}else{_0x45c518[_0xe52f('0x116')](_0x5f0e0f,_0x568fc0,_0x32b52f,_0xe52f('0x1ae'));}}break;default:_0x116145[_0xe52f('0x12c')]+=0x1;_0x5f0e0f['state']=0xc;_0x5f0e0f['statedesc']=_0x134111[_0xe52f('0xc0')];_0x194209=_0x116145['dialAgentRejectRetryFrequency'];_0x49a314=_0x116145[_0xe52f('0x198')];hopperUtils['createHistory'](_0x5f0e0f)[_0xe52f('0xa2')](loggerCatch(_0xe52f('0x1af')));if(_0x45c518[_0xe52f('0x185')](_0x134111['reason'],_0x175439,_0x116145)&&!_0x322d6e){if(_0x5f0e0f[_0xe52f('0x121')]+_0x5f0e0f[_0xe52f('0x122')]+_0x5f0e0f[_0xe52f('0x113')]+_0x5f0e0f[_0xe52f('0x114')]+_0x5f0e0f[_0xe52f('0xcf')]+_0x5f0e0f['countabandonedretry']+_0x5f0e0f[_0xe52f('0x111')]+_0x5f0e0f[_0xe52f('0x190')]>=_0x116145['dialGlobalMaxRetry']){_0x45c518['stateGlobal'](_0x5f0e0f,_0x568fc0,_0x32b52f,_0x134111['reason']);}else{_0x45c518[_0xe52f('0x118')](_0x5f0e0f,_0x568fc0,_0x32b52f,_0x134111[_0xe52f('0xc0')]);}}}})[_0xe52f('0x3f')](function(){if(_0x322d6e){hopperUtils[_0xe52f('0xdd')](_0x5f0e0f,_0x194209,_0x49a314)[_0xe52f('0x3f')](function(){return _0x568fc0(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x1f3b52,_0x41ba32,_0x3f46f9,_0x45f7e9){var _0x188fcc=new Final(_0x1f3b52);_0x188fcc['state']=0xf;_0x188fcc[_0xe52f('0x71')]=_0xe52f('0x1b0');this['createStateFinal'](_0x188fcc,_0x41ba32,_0x3f46f9,_0x45f7e9);};Dialer['prototype'][_0xe52f('0x118')]=function(_0x53c076,_0x297eb0,_0x5b01f9,_0x2218fe){hopperUtils['moveContactManagedDialer'](_0x53c076)['then'](function(){return _0x297eb0(msgResponse(_0xe52f('0x193'),_0xe52f('0xff'),_0x2218fe));})[_0xe52f('0xa2')](function(){return _0x5b01f9(msgResponse(_0xe52f('0x1b1'),_0xe52f('0x95'),_0xe52f('0x1b2')));});};Dialer[_0xe52f('0x86')][_0xe52f('0xa')]=function(_0xdbd58c){var _0x45ea3d=_0xdbd58c[_0xe52f('0x1b3')]/0x64;var _0x3db81b=_0xdbd58c['outboundDropCallsDayTimeout']/(_0xdbd58c[_0xe52f('0x1b4')]+_0xdbd58c[_0xe52f('0xbf')]);var _0x171d17=Math[_0xe52f('0x1b5')](_0xdbd58c[_0xe52f('0x1b6')]*(_0xdbd58c['predictiveIntervalMaxThreshold']/0x64));var _0x543ee3=Math[_0xe52f('0x1b5')](_0xdbd58c[_0xe52f('0x1b6')]*(_0xdbd58c[_0xe52f('0x1b7')]/0x64));var _0x1adc7f=_0xdbd58c['available']+_0xdbd58c[_0xe52f('0x132')];var _0x42906b=Math[_0xe52f('0x1b8')](_0xdbd58c[_0xe52f('0x5a')]*_0xdbd58c[_0xe52f('0x60')]*_0xdbd58c['predictiveIntervalHitRate']*_0xdbd58c['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0xdbd58c[_0xe52f('0x27')])){if(!_[_0xe52f('0x41')](_0xdbd58c[_0xe52f('0x26')])){_0xdbd58c[_0xe52f('0x26')]=undefined;loggerPredictive['error'](_0xe52f('0x1b9'),_0xe52f('0x1ba'));}if(!_['isUndefined'](_0xdbd58c[_0xe52f('0x66')])){loggerPredictive[_0xe52f('0x67')](_0xe52f('0x1b9'),_0xe52f('0x1bb'));clearInterval(_0xdbd58c[_0xe52f('0x66')]);_0xdbd58c[_0xe52f('0x66')]=undefined;}_0xdbd58c[_0xe52f('0x27')]=moment()['format'](_0xe52f('0xbe'));loggerPredictive[_0xe52f('0x4b')](_0xdbd58c[_0xe52f('0x63')],_0xe52f('0x1bc'),_0xdbd58c[_0xe52f('0x27')]);this[_0xe52f('0xb0')](_0xdbd58c,0x1);}else if(ifInterval(_0xdbd58c['dialPredictiveInterval'],_0xdbd58c[_0xe52f('0x27')])){this[_0xe52f('0xb0')](_0xdbd58c,0x1);loggerPredictiveCalls[_0xe52f('0x4b')](_0xe52f('0x1bd'),_0xdbd58c[_0xe52f('0x27')],_0xdbd58c[_0xe52f('0x63')]);_0xdbd58c['erlangCalls']=0x0;_0xdbd58c['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x45ea3d<_0x3db81b&&_0xdbd58c[_0xe52f('0x1be')]===_0xe52f('0x1bf')){clearPredictiveAttributes(_0xdbd58c);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x3db81b,'startProgressive',_0xdbd58c['name']);}else if(_0x42906b<_0xdbd58c['predictiveIntervalErlangCallsDroppedCalls']&&_0xdbd58c[_0xe52f('0x1be')]===_0xe52f('0x1bf')){clearPredictiveAttributes(_0xdbd58c);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x1c0'),'Max\x20Drop\x20',_0x42906b,_0xe52f('0x1c1'),_0xdbd58c['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0xdbd58c['name']);}else if(!ifInterval(_0xdbd58c[_0xe52f('0x1c2')],_0xdbd58c[_0xe52f('0x27')])&&_[_0xe52f('0x41')](_0xdbd58c[_0xe52f('0x26')])&&!_[_0xe52f('0x41')](_0xdbd58c['startProgressive'])){_0xdbd58c[_0xe52f('0x26')]=moment()[_0xe52f('0x47')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xe52f('0x4b')](_0xdbd58c[_0xe52f('0x63')],_0xe52f('0x1c3'),_0xdbd58c[_0xe52f('0x26')]);hopperUtils[_0xe52f('0x1c4')](_0xdbd58c[_0xe52f('0x1c2')])[_0xe52f('0x3f')](this[_0xe52f('0x1c5')](_0xdbd58c))[_0xe52f('0x3f')](mergeDataErlangB(_0xdbd58c))[_0xe52f('0x3f')](this[_0xe52f('0x1c6')](_0xdbd58c))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0xdbd58c));}else if(!ifInterval(_0xdbd58c[_0xe52f('0x1c2')],_0xdbd58c[_0xe52f('0x26')])){_0xdbd58c[_0xe52f('0x1c7')]=0x0;_0xdbd58c[_0xe52f('0x26')]=moment()[_0xe52f('0x47')](_0xe52f('0xbe'));loggerPredictive[_0xe52f('0x4b')](_0xdbd58c[_0xe52f('0x63')],_0xe52f('0x1c8'),_0xdbd58c[_0xe52f('0x26')]);clearInterval(_0xdbd58c[_0xe52f('0x66')]);_0xdbd58c['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0xdbd58c[_0xe52f('0x1c2')])[_0xe52f('0x3f')](this[_0xe52f('0x1c5')](_0xdbd58c))['then'](mergeDataErlangB(_0xdbd58c))[_0xe52f('0x3f')](this[_0xe52f('0x1c6')](_0xdbd58c))[_0xe52f('0xa2')](loggerCatchPredictive(_0xe52f('0x1c9'),_0xdbd58c));}else if(_0xdbd58c[_0xe52f('0x1b6')]&&_0x1adc7f<_0xdbd58c[_0xe52f('0x1b6')]-_0x543ee3){clearPredictiveAttributes(_0xdbd58c);loggerPredictive[_0xe52f('0x4b')](_0xdbd58c[_0xe52f('0x63')],_0xe52f('0x1ca'),_0x1adc7f,_0xe52f('0x1cb'),_0xdbd58c[_0xe52f('0x1b6')],'-',_0x543ee3,'=',_0xdbd58c['predictiveIntervalAvailable']-_0x543ee3,')');}else if(_0xdbd58c[_0xe52f('0x1b6')]&&_0x1adc7f>_0xdbd58c[_0xe52f('0x1b6')]+_0x171d17){clearPredictiveAttributes(_0xdbd58c);loggerPredictive[_0xe52f('0x4b')](_0xdbd58c['name'],_0xe52f('0x1ca'),_0x1adc7f,_0xe52f('0x1cc'),_0xdbd58c['predictiveIntervalAvailable'],'+',_0x171d17,'=',_0xdbd58c[_0xe52f('0x1b6')]+_0x171d17,')');}};Dialer[_0xe52f('0x86')][_0xe52f('0x1c5')]=function(_0x201501){var _0x3a3d47=this;return function(_0x4ea3a1){return new Promise(function(_0x5a93d7,_0x1412bc){_[_0xe52f('0x61')](_0x201501,_0x4ea3a1[0x0]);if(checkGetDataPredictive(_0x4ea3a1[0x0])){var _0x3f5113=_0x201501['predictiveIntervalAvailable']=_0x201501[_0xe52f('0x132')]+_0x201501['available'];var _0x2d845b=_0x201501['dialPredictiveInterval']*0x3c;var _0x2e006d=_0x4ea3a1[0x0][_0xe52f('0x56')]+_0x4ea3a1[0x0][_0xe52f('0x53')];var _0x2d95c1=(_0x4ea3a1[0x0][_0xe52f('0x4e')]+_0x4ea3a1[0x0][_0xe52f('0xca')]+_0x4ea3a1[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4ea3a1[0x0][_0xe52f('0x4d')];_0x201501[_0xe52f('0x1cd')]=_0x2d95c1>0x0?_0x2d95c1:0x1;switch(_0x201501[_0xe52f('0x1be')]){case'dropRate':var _0x16555f=_0x201501[_0xe52f('0x1b3')]/0x64;return _0x3a3d47[_0xe52f('0x1ce')](_0x3f5113,_0x2d845b,_0x2e006d,_0x2d95c1,_0x16555f)[_0xe52f('0x3f')](function(_0x274597){return _0x5a93d7(_0x274597);});case'agentBusyFactor':var _0x4c7f8a=_0x201501['dialPredictiveOptimizationPercentage']/0x64;return _0x3a3d47[_0xe52f('0x1cf')](_0x3f5113,_0x2d845b,_0x2e006d,_0x2d95c1,_0x4c7f8a)['then'](function(_0x17b598){return _0x5a93d7(_0x17b598);});default:return _0x1412bc(msgResponse(_0xe52f('0x1d0'),'Failure',_0xe52f('0x1d1')));}}else{return _0x1412bc(msgResponse('[getDataPredictive]',_0xe52f('0x95'),_0xe52f('0x1d2')));}});};};Dialer[_0xe52f('0x86')][_0xe52f('0x1d3')]=function(_0x3a65c9){var _0x546f43=this;return function(_0x5986bd){return new Promise(function(_0x10eac4,_0xe2aa62){_['merge'](_0x3a65c9,_0x5986bd[0x0]);if(checkGetDataPredictive(_0x5986bd[0x0])){loggerPredictive[_0xe52f('0x4b')](JSON[_0xe52f('0x77')](_0x5986bd[0x0]));if(_0x3a65c9[_0xe52f('0x1be')]==='dropRate'){return _0x546f43[_0xe52f('0x147')](_0x3a65c9['id'])[_0xe52f('0x3f')](function(_0xc56a5d){var _0x5cfeef=_0x3a65c9['loggedIn']-_0xc56a5d[0x0][_0xe52f('0x1d4')];var _0x4dffcd=_0x3a65c9['dialPredictiveInterval']*0x3c;var _0x3df0ad=_0x5986bd[0x0][_0xe52f('0x56')]+_0x5986bd[0x0][_0xe52f('0x53')];var _0x5f3668=(_0x5986bd[0x0]['predictiveIntervalAnsweredCalls']+_0x5986bd[0x0][_0xe52f('0xca')]+_0x5986bd[0x0][_0xe52f('0x51')])/_0x5986bd[0x0][_0xe52f('0x4d')];var _0x20f64f=_0x3a65c9[_0xe52f('0x1b3')]/0x64;_0x3a65c9[_0xe52f('0x1d5')]=_0xc56a5d[0x0][_0xe52f('0x1d4')]||0x0;_0x3a65c9['predictiveIntervalHitRate']=_0x5f3668>0x0?_0x5f3668:0x1;return _0x546f43['abandonmentRate'](_0x5cfeef,_0x4dffcd,_0x3df0ad,_0x5f3668,_0x20f64f);})[_0xe52f('0x3f')](function(_0xf6b14a){return _0x10eac4(_0xf6b14a);})[_0xe52f('0xa2')](function(_0x540928){return _0xe2aa62(msgResponse(_0xe52f('0x1d6'),_0xe52f('0x95'),JSON[_0xe52f('0x77')](_0x540928)));});}if(_0x3a65c9[_0xe52f('0x1be')]===_0xe52f('0x1d7')){return _0x546f43[_0xe52f('0x147')](_0x3a65c9['id'])[_0xe52f('0x3f')](function(_0x28d398){var _0x5690ad=_0x3a65c9[_0xe52f('0x1d8')]-_0x28d398[0x0][_0xe52f('0x1d4')];var _0x4d824b=_0x3a65c9['dialPredictiveInterval']*0x3c;var _0x5c8024=_0x5986bd[0x0][_0xe52f('0x56')]+_0x5986bd[0x0]['predictiveIntervalAvgHoldtime'];var _0x418651=(_0x5986bd[0x0][_0xe52f('0x4e')]+_0x5986bd[0x0][_0xe52f('0xca')]+_0x5986bd[0x0][_0xe52f('0x51')])/_0x5986bd[0x0][_0xe52f('0x4d')];var _0x59897a=_0x3a65c9['dialPredictiveOptimizationPercentage']/0x64;_0x3a65c9['predictiveIntervalPauses']=_0x28d398[0x0][_0xe52f('0x1d4')]||0x0;_0x3a65c9['predictiveIntervalHitRate']=_0x418651>0x0?_0x418651:0x1;return _0x546f43['busyFactor'](_0x5690ad,_0x4d824b,_0x5c8024,_0x418651,_0x59897a);})['then'](function(_0x212763){return _0x10eac4(_0x212763);})[_0xe52f('0xa2')](function(_0x2785e7){return _0xe2aa62(msgResponse(_0xe52f('0x1d6'),'Failure',JSON[_0xe52f('0x77')](_0x2785e7)));});}}else{return _0xe2aa62(msgResponse('[getDataPredictive]',_0xe52f('0x95'),_0xe52f('0x1d2')));}});};};Dialer[_0xe52f('0x86')][_0xe52f('0x1c6')]=function(_0x1c0791){var _0x5c7442=this;return function(){var _0x1ffaed=0x0;var _0x13ebcf=Math[_0xe52f('0x1b8')](_0x1c0791['erlangCallToSecond']*0x3e8);if(_0x13ebcf>0x0){_0x13ebcf=_0x13ebcf<0x64?0x64:_0x13ebcf;loggerPredictive['info'](_0x1c0791[_0xe52f('0x63')],_0xe52f('0x1d9'),_0x13ebcf,'milliseconds');_0x1c0791['handlePredictive']=setInterval(function(){_0x5c7442['handlePredictive'](_0x1c0791);loggerPredictiveCalls[_0xe52f('0x4b')]('[handlePredictive]',_0x1ffaed+=0x1);},_0x13ebcf);}else{loggerPredictive['info'](_0x1c0791[_0xe52f('0x63')],_0xe52f('0x1da'));}};};Dialer['prototype'][_0xe52f('0x1db')]=function(_0x50311a,_0x3d9d5e){var _0x130178=this;return function(_0x2781ac){if(_[_0xe52f('0x4a')](_0x2781ac)){if(_[_0xe52f('0xed')](_0x3d9d5e[_0xe52f('0x14c')])||!_0x3d9d5e[_0xe52f('0x1dc')]){if(_0x50311a[_0xe52f('0xaf')]===_0xe52f('0x9')){_0x50311a[_0xe52f('0x74')]=_[_0xe52f('0x41')](_0x50311a[_0xe52f('0x74')])?!![]:_0x50311a[_0xe52f('0x74')];var _0x5d7d5f=uuid['v4']();_0x130178['actions'][_0x5d7d5f]=new Action(_0x50311a,_0x3d9d5e,_0x5d7d5f);loggerBooked[_0xe52f('0x4b')](_0xe52f('0x1dd'),_0x5d7d5f,_0xe52f('0x1de'),JSON[_0xe52f('0x77')](_0x50311a['queueStatusComplete']),_0xe52f('0x1df'),_0x50311a[_0xe52f('0x63')]);if(_0x50311a[_0xe52f('0x74')]){_0x50311a[_0xe52f('0x74')]=![];_0x130178[_0xe52f('0xee')][_0x130178[_0xe52f('0x24')][_0x5d7d5f]['queue']]=[];ami[_0xe52f('0x9c')]({'actionid':_0x5d7d5f,'action':_0xe52f('0x1e0'),'queue':_0x50311a['name']})['catch'](function(){_0x130178[_0xe52f('0xbb')](_0x50311a);hopperUtils[_0xe52f('0xe1')]({'active':![],'ContactId':_0x130178['actions'][_0x5d7d5f]['ContactId'],'ListId':_0x130178[_0xe52f('0x24')][_0x5d7d5f][_0xe52f('0xd8')],'VoiceQueueId':_0x130178[_0xe52f('0x24')][_0x5d7d5f][_0xe52f('0xd9')]||undefined,'CampaignId':_0x130178['actions'][_0x5d7d5f][_0xe52f('0xfb')]||undefined})[_0xe52f('0xa2')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x130178['actions'][_0x5d7d5f];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xe52f('0x77')](_0x50311a['queueStatusComplete']),_0xe52f('0x1df'),_0x50311a[_0xe52f('0x63')]);_0x130178['updateOriginated'](_0x50311a);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x130178[_0xe52f('0x24')][_0x5d7d5f][_0xe52f('0xd7')],'ListId':_0x130178[_0xe52f('0x24')][_0x5d7d5f][_0xe52f('0xd8')],'VoiceQueueId':_0x130178[_0xe52f('0x24')][_0x5d7d5f]['VoiceQueueId']||undefined,'CampaignId':_0x130178[_0xe52f('0x24')][_0x5d7d5f][_0xe52f('0xfb')]||undefined})[_0xe52f('0xa2')](loggerCatch(_0xe52f('0x1e1')));delete _0x130178[_0xe52f('0x24')][_0x5d7d5f];}}else{return _0x130178[_0xe52f('0x151')](_0x50311a,_0x3d9d5e);}}else{if(utils[_0xe52f('0x62')](undefined,_0x3d9d5e['scheduledat'])<_0x50311a[_0xe52f('0x1e2')]*0x3c){if(_0x3d9d5e[_0xe52f('0x14f')]&&!_0x3d9d5e[_0xe52f('0x14f')][_0xe52f('0x1e3')]){_0x130178[_0xe52f('0xef')]['run'](_0x3d9d5e['id'])[_0xe52f('0x1d')](function(){_0x130178[_0xe52f('0xbb')](_0x50311a);});}else{hopperUtils[_0xe52f('0x1e4')]({'active':![]},_0x3d9d5e['id'],0x1)[_0xe52f('0x1d')](function(){_0x130178['updateOriginated'](_0x50311a);});}}else{_0x50311a[_0xe52f('0x1e5')]+=0x1;_0x130178['updateOriginated'](_0x50311a);if(_0x50311a[_0xe52f('0x1e6')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3d9d5e[_0xe52f('0xd7')],'ListId':_0x3d9d5e[_0xe52f('0xd8')],'VoiceQueueId':_0x3d9d5e[_0xe52f('0xd9')]||undefined,'CampaignId':_0x3d9d5e[_0xe52f('0xfb')]||undefined})[_0xe52f('0xa2')](loggerCatch(_0xe52f('0x1e7')));hopperUtils[_0xe52f('0xc5')](createObjHistory(_0x50311a,_0x3d9d5e,utils[_0xe52f('0x6b')][_0xe52f('0x1e8')],0x17,'RecallInQueue'))[_0xe52f('0xa2')](loggerCatch(_0xe52f('0x1e9')));}else{_0x130178[_0xe52f('0x10c')](createObjHistory(_0x50311a,_0x3d9d5e,utils[_0xe52f('0x6b')]['RECALL_TIMEOUT'],0x16,_0xe52f('0x1ea')),_0xe52f('0x1eb'),_0xe52f('0x1ec'));}}}}else{_0x50311a['outboundBlacklistCallsDay']+=0x1;_0x130178['saveInDb'](createObjHistory(_0x50311a,_0x3d9d5e,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,_0xe52f('0x1ed')),_0xe52f('0x1ee'),_0xe52f('0x1ef'));throw _0xe52f('0x1f0');}};};Dialer[_0xe52f('0x86')][_0xe52f('0x150')]=function(_0x300483){var _0x1f34c6=this;var _0x43e80c=_0x300483[_0xe52f('0x1f1')]-_0x300483[_0xe52f('0x81')]-_0x300483[_0xe52f('0x1f2')];emitCampaignSummary(_0x300483);if(_0x43e80c>0x0){if(_0x43e80c>this[_0xe52f('0x22')]){_0x43e80c=this[_0xe52f('0x22')];}_0x300483[_0xe52f('0x1f2')]+=_0x43e80c;hopperUtils[_0xe52f('0x1f3')](_0x300483,_0x43e80c)[_0xe52f('0x3f')](function(_0x55d958){_0x300483[_0xe52f('0x1f2')]-=_0x43e80c;_0x300483[_0xe52f('0x1f2')]=_0x300483['temp']>0x0?_0x300483[_0xe52f('0x1f2')]:0x0;if(!utils[_0xe52f('0x1f4')](_0x55d958)){_0x300483[_0xe52f('0x6a')]=utils[_0xe52f('0x6b')][_0xe52f('0x6f')];logger[_0xe52f('0x4b')](_0xe52f('0x1f5')+_0x300483[_0xe52f('0x63')]);}else{_0x300483['originated']+=_0x55d958[_0xe52f('0x9a')];_0x300483['message']=utils[_0xe52f('0x6b')][_0xe52f('0x1f6')];for(var _0x36be6a=0x0;_0x36be6a<_0x55d958['length'];_0x36be6a+=0x1){_0x300483[_0xe52f('0x1f7')]+=0x1;if(_[_0xe52f('0xed')](_0x55d958[_0x36be6a])||_[_0xe52f('0xed')](_0x55d958[_0x36be6a][_0xe52f('0x16c')])||_[_0xe52f('0xed')](_0x55d958[_0x36be6a][_0xe52f('0x154')])){_0x1f34c6[_0xe52f('0x1f8')](_0xe52f('0x1f9'),_0x300483,_0x55d958[_0x36be6a]);}else{hopperUtils[_0xe52f('0x1fa')](_['pick'](_0x55d958[_0x36be6a],[_0xe52f('0xfb'),'phone']))[_0xe52f('0x3f')](_0x1f34c6[_0xe52f('0x1db')](_0x300483,_0x55d958[_0x36be6a]))['catch'](_0x1f34c6[_0xe52f('0x14a')](_0xe52f('0x1fb'),_0x300483));}}}})[_0xe52f('0xa2')](loggerGetContactDialer('[getContactCampaign2]',_0x300483,_0x43e80c));}};Dialer['prototype'][_0xe52f('0xb0')]=function(_0x1bd214,_0x2c2cdf){var _0x3f79ee=this;var _0x36f20c=[];if(_0x2c2cdf<0x1||_0x1bd214[_0xe52f('0xaf')]==='booked'){_0x2c2cdf=0x1;}var _0x13dcc7=Math[_0xe52f('0x1b8')](_0x1bd214[_0xe52f('0x1fc')]*_0x2c2cdf)-_0x1bd214[_0xe52f('0x81')]-_0x1bd214['temp'];if(_0x1bd214[_0xe52f('0x1fd')]>0x0){var _0xde7823=_0x1bd214[_0xe52f('0x1fd')]-_0x1bd214[_0xe52f('0x81')]-_0x1bd214['talking']-_0x1bd214[_0xe52f('0x1f2')]-_0x1bd214[_0xe52f('0x133')];if(_0x13dcc7>_0xde7823){_0x13dcc7=_0xde7823;}}if(_0x13dcc7>0x0){if(_0x1bd214[_0xe52f('0xaf')]==='booked'){_0x13dcc7=0x1;}if(_0x13dcc7>this[_0xe52f('0x22')]){_0x13dcc7=this[_0xe52f('0x22')];}_0x1bd214[_0xe52f('0x1f2')]+=_0x13dcc7;for(var _0x51f376 in this[_0xe52f('0x21')]){if(typeof this[_0xe52f('0x21')][_0x51f376]!==_0xe52f('0x148')){if(this[_0xe52f('0x21')][_0x51f376][_0xe52f('0xcb')]===_0xe52f('0x1fe')&&this[_0xe52f('0x21')][_0x51f376][_0xe52f('0x8b')]==='reachable'){_0x36f20c[_0xe52f('0x9b')](this[_0xe52f('0x21')][_0x51f376]['id']);}}}hopperUtils[_0xe52f('0x1ff')](_0x1bd214,_0x36f20c,_0x13dcc7)[_0xe52f('0x3f')](function(_0x2fbc94){_0x1bd214['temp']-=_0x13dcc7;_0x1bd214[_0xe52f('0x1f2')]=_0x1bd214[_0xe52f('0x1f2')]>0x0?_0x1bd214['temp']:0x0;if(!utils[_0xe52f('0x1f4')](_0x2fbc94)){hopperUtils[_0xe52f('0x200')](_0x1bd214)[_0xe52f('0x3f')](sendMessageReschedule(_0x1bd214))[_0xe52f('0xa2')](loggerCatch('[countReScheduled]\x20'));}else{_0x1bd214[_0xe52f('0x81')]+=_0x2fbc94[_0xe52f('0x9a')];_0x1bd214['message']=_0x1bd214[_0xe52f('0xaf')]===_0xe52f('0x9')?utils[_0xe52f('0x6b')][_0xe52f('0x134')]:utils['CAMPAIGN_STATUS'][_0xe52f('0x1f6')];for(var _0x167458=0x0;_0x167458<_0x2fbc94[_0xe52f('0x9a')];_0x167458+=0x1){if(_[_0xe52f('0xed')](_0x2fbc94[_0x167458])||_[_0xe52f('0xed')](_0x2fbc94[_0x167458][_0xe52f('0x16c')])||_[_0xe52f('0xed')](_0x2fbc94[_0x167458][_0xe52f('0x154')])){_0x3f79ee['emptyContact']('[actionOriginate]\x20',_0x1bd214,_0x2fbc94[_0x167458]);}else{hopperUtils[_0xe52f('0x201')](_[_0xe52f('0x78')](_0x2fbc94[_0x167458],[_0xe52f('0xd9'),_0xe52f('0x154')]))[_0xe52f('0x3f')](_0x3f79ee[_0xe52f('0x1db')](_0x1bd214,_0x2fbc94[_0x167458]))['catch'](_0x3f79ee[_0xe52f('0x14a')]('[actionOriginate]\x20',_0x1bd214));}}}})['catch'](loggerGetContactDialer(_0xe52f('0x202'),_0x1bd214,_0x13dcc7));}};Dialer[_0xe52f('0x86')][_0xe52f('0x66')]=function(_0x5bf977){if(_0x5bf977[_0xe52f('0x1fd')]>0x0){var _0x233d84=_0x5bf977[_0xe52f('0x1fd')]-_0x5bf977[_0xe52f('0x81')]-_0x5bf977[_0xe52f('0x132')];if(_0x233d84>0x0){this[_0xe52f('0x203')](_0x5bf977);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0xe52f('0x203')](_0x5bf977);}};Dialer[_0xe52f('0x86')][_0xe52f('0x203')]=function(_0x331e98){var _0x432d48=this;var _0x1e28f7=[];_0x331e98[_0xe52f('0x81')]+=0x1;for(var _0x1c1206 in this[_0xe52f('0x21')]){if(typeof this['agents'][_0x1c1206]!=='undefined'){if(this[_0xe52f('0x21')][_0x1c1206][_0xe52f('0xcb')]===_0xe52f('0x1fe')&&this[_0xe52f('0x21')][_0x1c1206][_0xe52f('0x8b')]==='reachable'){_0x1e28f7['push'](this['agents'][_0x1c1206]['id']);}}}return this[_0xe52f('0x1ff')](_0x331e98['id'],_0x1e28f7,0x1,_0x331e98[_0xe52f('0x204')],_0x331e98)[_0xe52f('0x3f')](function(_0x24b2a1){if(!utils[_0xe52f('0x1f4')](_0x24b2a1)){utils['checkContactLowerLimitOriginate'](_0x331e98,0x1,0x0);return hopperUtils[_0xe52f('0x200')](_0x331e98)[_0xe52f('0x3f')](sendMessageReschedule(_0x331e98))['catch'](loggerCatch(_0xe52f('0x205')));}else{_0x331e98[_0xe52f('0x6a')]=utils['CAMPAIGN_STATUS']['RUNNING'];if(_[_0xe52f('0xed')](_0x24b2a1[0x0])||_[_0xe52f('0xed')](_0x24b2a1[0x0][_0xe52f('0x16c')])||_['isNil'](_0x24b2a1[0x0][_0xe52f('0x154')])){_0x432d48[_0xe52f('0x1f8')]('[actionOriginate]\x20',_0x331e98,_0x24b2a1[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xe52f('0x78')](_0x24b2a1[0x0],['VoiceQueueId','phone']))[_0xe52f('0x3f')](_0x432d48[_0xe52f('0x1db')](_0x331e98,_0x24b2a1[0x0]))['catch'](_0x432d48[_0xe52f('0x14a')](_0xe52f('0x206'),_0x331e98));}}})['catch'](loggerGetContactDialer(_0xe52f('0x207'),_0x331e98,0x1));};Dialer[_0xe52f('0x86')][_0xe52f('0x1ce')]=function(_0x5ebad3,_0x5ee52f,_0xe46f08,_0x5b2d42,_0x24ea92,_0x13acfb){loggerPredictive['info'](_0xe52f('0x208'));loggerPredictive['info']('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',_0x5ebad3);loggerPredictive['info'](_0xe52f('0x209'),_0x5ee52f);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x20a'),_0xe46f08);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x20b'),_0x5b2d42);loggerPredictive[_0xe52f('0x4b')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x24ea92);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x55'));return new Promise(function(_0x1b9fbc,_0x2e2539){if(_0x5ebad3<=0x0||isNaN(_0x5ebad3)){return _0x2e2539(msgResponse(_0xe52f('0x20c'),_0xe52f('0x20d'),_0xe52f('0x20e')+_0x5ebad3));}if(_0xe46f08<=0x0||isNaN(_0xe46f08)){return _0x2e2539(msgResponse(_0xe52f('0x20c'),'Error',_0xe52f('0x20f')+_0xe46f08));}if(_0x5b2d42<=0x0||isNaN(_0x5b2d42)){return _0x2e2539(msgResponse(_0xe52f('0x20c'),_0xe52f('0x20d'),_0xe52f('0x210')+_0x5b2d42));}if(_0x5ee52f<=0x0||isNaN(_0x5ee52f)){return _0x2e2539(msgResponse(_0xe52f('0x20c'),_0xe52f('0x20d'),'interval\x20=\x20'+_0x5ee52f));}if(_0x24ea92<=0x0||isNaN(_0x24ea92)){return _0x2e2539(msgResponse(_0xe52f('0x20c'),'Error',_0xe52f('0x211')+_0x24ea92));}_0x13acfb=_0x13acfb||0x0;var _0x57142b=0x1/_0xe46f08;var _0x38b3c7=0x0;var _0x30ce90=0x0;var _0x3ea268=0x0;var _0x41c13e=0x0;for(var _0x436dfb=0x0;_0x3ea268<_0x24ea92;_0x436dfb+=0x1){_0x30ce90=_0x436dfb/_0x5ee52f;_0x38b3c7=(_0x5b2d42*_0x30ce90+_0x13acfb)/_0x57142b;_0x3ea268=utils[_0xe52f('0x212')](_0x38b3c7,_0x5ebad3);_0x41c13e=_0x38b3c7/_0x5ebad3*(0x1-utils[_0xe52f('0x212')](_0x38b3c7,_0x5ebad3));}return _0x1b9fbc({'erlangCalls':_0x436dfb,'erlangCallToSecond':_0x5ee52f/_0x436dfb,'erlangAbandonmentRate':_0x3ea268,'erlangBusyFactor':_0x41c13e});});};Dialer[_0xe52f('0x86')]['busyFactor']=function(_0x547525,_0x2422c0,_0x3c62ab,_0x49a233,_0x542d88,_0x42b95f){loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x213'));loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x214'),_0x547525);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x209'),_0x2422c0);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x20a'),_0x3c62ab);loggerPredictive[_0xe52f('0x4b')]('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',_0x49a233);loggerPredictive[_0xe52f('0x4b')](_0xe52f('0x215'),_0x542d88);loggerPredictive['info'](_0xe52f('0x55'));return new Promise(function(_0x336b6d,_0x57e120){if(_0x547525<=0x0||isNaN(_0x547525)){return _0x57e120(msgResponse('[busyFactor]',_0xe52f('0x20d'),'m\x20=\x20'+_0x547525));}if(_0x3c62ab<=0x0||isNaN(_0x3c62ab)){return _0x57e120(msgResponse(_0xe52f('0x216'),_0xe52f('0x20d'),_0xe52f('0x20f')+_0x3c62ab));}if(_0x49a233<=0x0||isNaN(_0x49a233)){return _0x57e120(msgResponse('[busyFactor]','Error',_0xe52f('0x210')+_0x49a233));}if(_0x2422c0<=0x0||isNaN(_0x2422c0)){return _0x57e120(msgResponse(_0xe52f('0x216'),_0xe52f('0x20d'),'interval\x20=\x20'+_0x2422c0));}if(_0x542d88<=0x0||isNaN(_0x542d88)){return _0x57e120(msgResponse(_0xe52f('0x216'),_0xe52f('0x20d'),_0xe52f('0x217')+_0x542d88));}_0x42b95f=_0x42b95f||0x0;var _0x3f8d57=0x1/_0x3c62ab;var _0x5b4b39=0x0;var _0x2b2ff1=0x0;var _0x4ebfb5=0x0;var _0x128792=0x0;for(var _0x2db1f2=0x0;_0x128792<_0x542d88;_0x2db1f2+=0x1){_0x2b2ff1=_0x2db1f2/_0x2422c0;_0x5b4b39=(_0x49a233*_0x2b2ff1+_0x42b95f)/_0x3f8d57;_0x4ebfb5=utils[_0xe52f('0x212')](_0x5b4b39,_0x547525);_0x128792=_0x5b4b39/_0x547525*(0x1-utils[_0xe52f('0x212')](_0x5b4b39,_0x547525));}return _0x336b6d({'erlangCalls':_0x2db1f2,'erlangCallToSecond':_0x2422c0/_0x2db1f2,'erlangAbandonmentRate':_0x4ebfb5,'erlangBusyFactor':_0x128792});});};module['exports']=Dialer; \ No newline at end of file +var _0x3c6f=['dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','dialNoAnswerRetryFrequency','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','loggedIn','busyFactor','[CatchErlangB]','floor','one\x20call\x20every:','milliseconds','recallme','booked','[booked][checkContactBlack]','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','getContactDialerIvr','temp','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','getContactDialer','RUNNING','checkIsBlackList','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','dialOrderByScheduledAt','countReScheduled','[countReScheduled]\x20','[getContactDialerPredictive]','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','lodash','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/setting','./models/history','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','getSettings','then','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','erlangAbandonmentRate','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','isIVRCampaignActive','INACTIVE','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','active','SIP/%s','status','unmonitored','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','timezones','content','indexOf','true','catch','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','OVERTIME_GLOBAL_INTERVAL','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','Error','queue','uniqueid','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete]','droptime','responsetime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','dialQueueProject2','countdropretry','countglobal','verifyAdditionalPhones','dialDropMaxRetry','queueCallerAbandonCreateState','additional','add','minutes','ContactId','CampaignId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','rescheduleContact','ListId','VoiceQueueId','[rescheduleContact][Abandoned]','endtime','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','merge','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason\x2019\x20machine....','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','createStateFinal','dialMachineRetryFrequency','syncHangup','ivrAnswerCallsDay','moveContactManagedDialer','AnswerAGI','AGI','dialQueueProject','cause-txt','[syncHangupIvr]','running','statusMessage','getQueueCampaignStatusMessage','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','%s%s','XMD-','toUpper','Trunk','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0x3c6f,0x93));var _0xf3c6=function(_0xa0cdd5,_0x3a3b1a){_0xa0cdd5=_0xa0cdd5-0x0;var _0x50e730=_0x3c6f[_0xa0cdd5];return _0x50e730;};'use strict';var util=require(_0xf3c6('0x0'));var _=require(_0xf3c6('0x1'));var uuid=require(_0xf3c6('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0xf3c6('0x3'));var utils=require(_0xf3c6('0x4'));var hopperUtils=require(_0xf3c6('0x5'));var ut=require(_0xf3c6('0x6'));var config=require(_0xf3c6('0x7'));var logger=require(_0xf3c6('0x8'))(_0xf3c6('0x9'));var loggerBooked=require(_0xf3c6('0x8'))('booked');var loggerPredictive=require(_0xf3c6('0x8'))(_0xf3c6('0xa'));var loggerPredictiveCalls=require(_0xf3c6('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xf3c6('0x8'))(_0xf3c6('0xb'));var ami=require(_0xf3c6('0xc'));config[_0xf3c6('0xd')]=_[_0xf3c6('0xe')](config[_0xf3c6('0xd')],{'host':_0xf3c6('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf3c6('0xd')]));var cmHopper=require(_0xf3c6('0x10'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xf3c6('0x11'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0xf3c6('0x12'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xf3c6('0x13'));var Hangup=require(_0xf3c6('0x14'));var ipAgi=process['env'][_0xf3c6('0x15')]||_0xf3c6('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xf3c6('0x17')][_0xf3c6('0x18')]=function(_0x1c27ce){this['tail']=this[_0xf3c6('0x19')]?this['tail'][_0xf3c6('0x1a')](_0x1c27ce):_0x1c27ce();};function Dialer(_0x5047c6,_0xbc1184){this[_0xf3c6('0x1b')]=new Sequence();this[_0xf3c6('0x1c')]=_0xbc1184;this['voiceQueues']=_0x5047c6[_0xf3c6('0x1d')];this[_0xf3c6('0x1e')]=_0x5047c6[_0xf3c6('0x1e')];this['agents']=_0x5047c6[_0xf3c6('0x1f')];this[_0xf3c6('0x20')]=_0x5047c6[_0xf3c6('0x20')];this['maxNumberOriginate']=config[_0xf3c6('0x21')]||0x2;this[_0xf3c6('0x22')]={};this[_0xf3c6('0x23')]={};this['contactsId']={};this[_0xf3c6('0x24')]={};this[_0xf3c6('0x25')]={};this[_0xf3c6('0x26')]={};this[_0xf3c6('0x27')]={};this[_0xf3c6('0x28')]={};this[_0xf3c6('0x29')]={};this[_0xf3c6('0x2a')]={};this[_0xf3c6('0x2b')]={};ami['on'](_0xf3c6('0x2c'),this['syncAgentConnect'][_0xf3c6('0x2d')](this));ami['on'](_0xf3c6('0x2e'),this[_0xf3c6('0x2f')][_0xf3c6('0x2d')](this));ami['on'](_0xf3c6('0x30'),this[_0xf3c6('0x31')][_0xf3c6('0x2d')](this));ami['on'](_0xf3c6('0x32'),this[_0xf3c6('0x33')][_0xf3c6('0x2d')](this));ami['on']('custom:queuesummary',this[_0xf3c6('0xb')][_0xf3c6('0x2d')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0xf3c6('0x2d')](this));ami['on'](_0xf3c6('0x34'),this['syncHangup'][_0xf3c6('0x2d')](this));ami['on'](_0xf3c6('0x35'),this[_0xf3c6('0x36')][_0xf3c6('0x2d')](this));ami['on'](_0xf3c6('0x37'),this[_0xf3c6('0x38')][_0xf3c6('0x2d')](this));ami['on'](_0xf3c6('0x39'),this[_0xf3c6('0x3a')][_0xf3c6('0x2d')](this));ami['on']('queuestatuscomplete',this[_0xf3c6('0x3b')][_0xf3c6('0x2d')](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting[_0xf3c6('0x3c')]()[_0xf3c6('0x3d')](function(_0x54e1e1){previewRecallmeReminderInterval=_0x54e1e1['previewRecallmeReminderInterval'];});}function isNotNull(_0x2e0cf3){return _0x2e0cf3!==null&&!_[_0xf3c6('0x3e')](_0x2e0cf3);}function msgResponse(_0xbcb0bf,_0x10cbf3,_0x37e767){return{'action':_0xbcb0bf,'response':_0x10cbf3,'message':_0x37e767,'stack':_0x37e767};}function emit(_0x20fd05,_0x49460a,_0x18db57){io['to'](_0x20fd05)[_0xf3c6('0x3f')](_0x49460a,_0x18db57);}function emitOutboundVoiceQueueSummary(_0x14fd50){if(_0x14fd50[_0xf3c6('0x40')]==='outbound'){logger[_0xf3c6('0x41')](_0xf3c6('0x42'),util[_0xf3c6('0x43')](_0x14fd50,{'showHidden':![],'depth':null}));emit(util['format'](_0xf3c6('0x44'),_0x14fd50['name']),_0xf3c6('0x45'),_0x14fd50);}}function checkGetDataPredictive(_0xd545e8){if(isNotNull(_0xd545e8)&&!_['isEmpty'](_0xd545e8)){loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x47'));loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x48'),_0xd545e8['predictiveIntervalTotalCalls']);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x49'),_0xd545e8[_0xf3c6('0x4a')]);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x4b'),_0xd545e8[_0xf3c6('0x4c')]);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x4d'),_0xd545e8[_0xf3c6('0x4e')]);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x4f'),_0xd545e8[_0xf3c6('0x50')]);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x51'),_0xd545e8[_0xf3c6('0x52')]);loggerPredictive['info'](_0xf3c6('0x53'));if(_0xd545e8[_0xf3c6('0x54')]>0x0){if(!_['isUndefined'](_0xd545e8['predictiveIntervalAvgTalktime'])&&_0xd545e8[_0xf3c6('0x52')]>0x0){return!![];}loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x55'));if(!_[_0xf3c6('0x3e')](_0xd545e8[_0xf3c6('0x50')])&&_0xd545e8[_0xf3c6('0x50')]>0x0){return!![];}loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x56'));}else{loggerPredictive['info'](_0xf3c6('0x57'));}}else{loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x58'));}return![];}function mergeDataErlangB(_0x46f843){return function(_0x5d00a3){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x59'),_0x5d00a3['erlangCalls']);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x5a'),_0x5d00a3[_0xf3c6('0x5b')]);loggerPredictive['info'](_0xf3c6('0x5c'),_0x5d00a3[_0xf3c6('0x5d')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d00a3['erlangBusyFactor']);loggerPredictive['info'](_0xf3c6('0x5c'),_0x5d00a3[_0xf3c6('0x5d')]);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x53'));_['merge'](_0x46f843,_0x5d00a3);};}function ifInterval(_0x33a5ce,_0x45e494){if(_[_0xf3c6('0x3e')](_0x45e494)){return![];}return utils[_0xf3c6('0x5e')](undefined,_0x45e494)<_0x33a5ce*0x3c;}function clearPredictiveAttributes(_0x43062a){if(_0x43062a[_0xf3c6('0x27')]){_0x43062a[_0xf3c6('0x27')]=undefined;loggerPredictive[_0xf3c6('0x41')](_0x43062a[_0xf3c6('0x5f')],_0xf3c6('0x60'));}if(_0x43062a[_0xf3c6('0x26')]){_0x43062a[_0xf3c6('0x26')]=undefined;loggerPredictive[_0xf3c6('0x41')](_0x43062a[_0xf3c6('0x5f')],_0xf3c6('0x61'));}if(_0x43062a['handlePredictive']){clearInterval(_0x43062a[_0xf3c6('0x62')]);_0x43062a[_0xf3c6('0x62')]=undefined;loggerPredictive[_0xf3c6('0x41')](_0x43062a['name'],_0xf3c6('0x63'));}}function loggerCatchPredictive(_0x384c0d,_0x1e6c21){return function(_0x4c7a68){loggerPredictive[_0xf3c6('0x64')](_0x1e6c21[_0xf3c6('0x5f')],_0x384c0d);loggerPredictive[_0xf3c6('0x64')](_0x4c7a68[_0xf3c6('0x65')]);clearPredictiveAttributes(_0x1e6c21);};}function loggerCatch(_0x1a2ba9){return function(_0x23914f){logger[_0xf3c6('0x64')](_0x1a2ba9,util[_0xf3c6('0x43')](_0x23914f,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xd5b625,_0x3116c1,_0x2c6d99){return function(_0x3c5a98){utils[_0xf3c6('0x66')](_0x3116c1,_0x2c6d99,0x0);logger[_0xf3c6('0x64')](_0xd5b625,util[_0xf3c6('0x43')](_0x3c5a98,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5ef9b0){return function(_0x39e9e2){if(isNotNull(_0x39e9e2)&&isNotNull(_0x39e9e2[0x0])){if(_0x39e9e2[0x0][_0xf3c6('0x67')]>0x0){_0x5ef9b0[_0xf3c6('0x68')]=utils[_0xf3c6('0x69')][_0xf3c6('0x6a')];logger[_0xf3c6('0x46')]('[getContactDialer2][ReScheduled]'+_0x5ef9b0[_0xf3c6('0x5f')],_0x39e9e2[0x0][_0xf3c6('0x67')],_0xf3c6('0x6b'));}else{_0x5ef9b0[_0xf3c6('0x68')]=utils[_0xf3c6('0x69')][_0xf3c6('0x6c')];logger['info'](_0xf3c6('0x6d')+_0x5ef9b0[_0xf3c6('0x5f')]);}}};}function createObjHistory(_0x4a97f9,_0x2f47f9,_0x1c7c9c,_0x16dc8e,_0x1ace88){_0x4a97f9[_0xf3c6('0x68')]=_0x1c7c9c;var _0x30ea11=new Action(_0x4a97f9,_0x2f47f9);var _0x2d9885=new History(_0x30ea11);_0x2d9885[_0xf3c6('0x6e')]=_0x16dc8e;_0x2d9885['statedesc']=_0x1ace88;_0x2d9885['endtime']=_0x30ea11['starttime'];return _0x2d9885;}function unlockQueueStatus(_0x5e2df5,_0x471384){setTimeout(function(){if(_[_0xf3c6('0x3e')](_0x5e2df5[_0xf3c6('0x6f')])){loggerBooked[_0xf3c6('0x64')](_0xf3c6('0x70'),_0x471384);}_0x5e2df5[_0xf3c6('0x6f')]=!![];loggerBooked[_0xf3c6('0x46')](_0xf3c6('0x71'),_0x471384,JSON[_0xf3c6('0x72')](_[_0xf3c6('0x73')](_0x5e2df5,[_0xf3c6('0x5f'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x3c7dd1){return function(){if(!isNotNull(_0x3c7dd1[_0xf3c6('0x74')])){_0x3c7dd1[_0xf3c6('0x68')]=utils[_0xf3c6('0x69')][_0xf3c6('0x75')];throw _0x3c7dd1[_0xf3c6('0x5f')]+_0xf3c6('0x76');}if(!isNotNull(_0x3c7dd1[_0xf3c6('0x74')][_0xf3c6('0x77')])){_0x3c7dd1['message']=utils[_0xf3c6('0x69')][_0xf3c6('0x75')];throw _0x3c7dd1[_0xf3c6('0x5f')]+_0xf3c6('0x76');}if(!isNotNull(_[_0xf3c6('0x78')](_0x3c7dd1['Interval'][_0xf3c6('0x77')]))){_0x3c7dd1[_0xf3c6('0x68')]=utils[_0xf3c6('0x69')][_0xf3c6('0x75')];throw _0x3c7dd1['name']+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x3f9789){return function(){if(!utils[_0xf3c6('0x79')](_0x3f9789)){_0x3f9789[_0xf3c6('0x68')]=utils[_0xf3c6('0x69')][_0xf3c6('0x7a')];throw _0x3f9789[_0xf3c6('0x5f')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x4594a3){if(utils[_0xf3c6('0x7b')](_0x4594a3)){emit(util[_0xf3c6('0x7c')](_0xf3c6('0x7d'),_0x4594a3[_0xf3c6('0x5f')]),_0xf3c6('0x7e'),_0x4594a3);}}function loggerCatchQueueSummary(_0x19c405,_0x21c83d){return function(_0x4de314){clearPredictiveAttributes(_0x21c83d);emitCampaignSummary(_0x21c83d);loggerSyncQueueSummary[_0xf3c6('0x41')](_0x19c405,util[_0xf3c6('0x43')](_0x4de314,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x417d28){if(_0x417d28[_0xf3c6('0x7f')]){if(_0x417d28['originated']===0x0){_0x417d28[_0xf3c6('0x7f')]=![];_0x417d28['message']=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary[_0xf3c6('0x41')](_0xf3c6('0x80'),_0x417d28[_0xf3c6('0x5f')],'is\x20not\x20active');}else{_0x417d28[_0xf3c6('0x68')]=utils[_0xf3c6('0x69')]['DISACTIVED'];loggerSyncQueueSummary['debug'](_0xf3c6('0x80'),_0x417d28['name'],_0xf3c6('0x81'));}emitCampaignSummary(_0x417d28);}}function myreject(_0x482c2c){return function(_0x1ca056){return _0x482c2c(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x1ca056)));};}Dialer[_0xf3c6('0x17')]['isTrunkReachable']=function(_0x3fe356){return!_[_0xf3c6('0x3e')](_0x3fe356)&&_0x3fe356&&!_[_0xf3c6('0x3e')](_0x3fe356[_0xf3c6('0x5f')])&&!_[_0xf3c6('0x3e')](_0x3fe356[_0xf3c6('0x82')])&&_0x3fe356['active']&&(this[_0xf3c6('0x20')][util[_0xf3c6('0x7c')](_0xf3c6('0x83'),_0x3fe356[_0xf3c6('0x5f')])][_0xf3c6('0x84')]==='reachable'||this[_0xf3c6('0x20')][util['format'](_0xf3c6('0x83'),_0x3fe356[_0xf3c6('0x5f')])][_0xf3c6('0x84')]===_0xf3c6('0x85'));};Dialer[_0xf3c6('0x17')]['checkIsTrunkReachable']=function(_0x2992f7){var _0x26cc3a=this;return function(){if(!_0x26cc3a[_0xf3c6('0x86')](_0x2992f7['Trunk'])){if(!_0x26cc3a[_0xf3c6('0x86')](_0x2992f7[_0xf3c6('0x87')])){_0x2992f7[_0xf3c6('0x68')]=utils['CAMPAIGN_STATUS'][_0xf3c6('0x88')];throw _0x2992f7['name']+_0xf3c6('0x89');}}};};Dialer[_0xf3c6('0x17')][_0xf3c6('0x8a')]=function(_0xa077,_0x421b05,_0x5d67d6,_0x4b8963){var _0x22e3a5=this;return function(){var _0x22e758=!![];return _0x22e3a5[_0xf3c6('0x8b')](_0xa077,_0x421b05,_0x5d67d6,_0x4b8963,_0x22e758);};};Dialer[_0xf3c6('0x17')][_0xf3c6('0x8c')]=function(_0x5a1ad3,_0x3e9827,_0xebdf4d,_0x3980a8){var _0x2abc1a=this;return function(){var _0x4e299b=![];return _0x2abc1a[_0xf3c6('0x8b')](_0x5a1ad3[_0xf3c6('0x77')],_0x3e9827,_0xebdf4d,_0x3980a8,_0x4e299b);};};Dialer[_0xf3c6('0x17')]['ifTimeIvr']=function(_0x4f29fa,_0xb405f5,_0x4f71f4,_0x166e20,_0xb6dbf0){var _0x3da736=[];return new Promise(function(_0x54cf61,_0x2b67f9){if(!isNotNull(_0x4f29fa)){_0x166e20[_0xf3c6('0x68')]=utils[_0xf3c6('0x69')]['NULL_INTERVAL'];return _0x2b67f9(msgResponse(_0xf3c6('0x8d'),_0xf3c6('0x8e'),_0x4f71f4+_0xf3c6('0x8f')));}if(_[_0xf3c6('0x78')](_0x4f29fa)){_0x166e20[_0xf3c6('0x68')]=utils[_0xf3c6('0x69')][_0xf3c6('0x90')];return _0x2b67f9(msgResponse(_0xf3c6('0x8d'),_0xf3c6('0x8e'),_0x4f71f4+'\x20Intervals\x20is\x20empty\x20'));}if(_0xb405f5&&_['isUndefined'](config['timezones'][_0xb405f5])){_0x166e20['message']=utils[_0xf3c6('0x69')]['UNKNOWN_TIMEZONE'];return _0x2b67f9(msgResponse('ifTime',_0xf3c6('0x8e'),_0x4f71f4+_0xf3c6('0x91')+_0xb405f5));}if(_[_0xf3c6('0x92')](_0x4f29fa)){for(var _0x484f0a=0x0;_0x484f0a<_0x4f29fa[_0xf3c6('0x93')];_0x484f0a+=0x1){_0x3da736[_0xf3c6('0x94')](ami[_0xf3c6('0x95')]({'action':_0xf3c6('0x96'),'command':util[_0xf3c6('0x7c')](_0xf3c6('0x97'),_0x4f29fa[_0x484f0a]['interval'],!_[_0xf3c6('0x3e')](config[_0xf3c6('0x98')][_0xb405f5])?_0xb405f5:'')})[_0xf3c6('0x3d')](function(_0x29e626){return _0x29e626[_0xf3c6('0x99')][_0xf3c6('0x9a')](_0xf3c6('0x9b'))>=0x0;})['catch'](myreject(_0x2b67f9)));}}else{_0x3da736['push'](ami[_0xf3c6('0x95')]({'action':_0xf3c6('0x96'),'command':util[_0xf3c6('0x7c')](_0xf3c6('0x97'),_0x4f29fa,!_[_0xf3c6('0x3e')](config[_0xf3c6('0x98')][_0xb405f5])?_0xb405f5:'')})[_0xf3c6('0x3d')](function(_0x3c72d9){return _0x3c72d9[_0xf3c6('0x99')][_0xf3c6('0x9a')]('true')>=0x0;})[_0xf3c6('0x9c')](myreject(_0x2b67f9)));}Promise[_0xf3c6('0x9d')](_0x3da736)[_0xf3c6('0x3d')](function(_0xe2cef5){var _0x8f661b=_[_0xf3c6('0x9e')](_0xe2cef5);if(_0x8f661b){return _0x54cf61(_0x8f661b);}else{_0x166e20[_0xf3c6('0x68')]=_0xb6dbf0?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0xf3c6('0x69')][_0xf3c6('0x9f')];return _0x2b67f9(msgResponse(_0xf3c6('0xa0'),_0xf3c6('0x8e'),_0xf3c6('0xa1')+_0xb6dbf0+'\x20'+_0x4f71f4+_0xf3c6('0xa2')+util[_0xf3c6('0x43')](_0x4f29fa,{'showHidden':![],'depth':null})+_0xf3c6('0xa3')+_0xb405f5));}})[_0xf3c6('0x9c')](function(_0x3b50f8){return _0x2b67f9(msgResponse(_0xf3c6('0x8d'),_0xf3c6('0x8e'),JSON[_0xf3c6('0x72')](_0x3b50f8)));});});};Dialer[_0xf3c6('0x17')][_0xf3c6('0xa4')]=function(){var _0x42546d=this;return cmHopper[_0xf3c6('0xa5')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x42546d[_0xf3c6('0xa6')]();},0x3e8);});};Dialer[_0xf3c6('0x17')][_0xf3c6('0xa6')]=function(){var _0x2e3405=this;var _0x16e357;for(var _0x5e93a2 in this['campaigns']){if(typeof this[_0xf3c6('0x1e')][_0x5e93a2]!==_0xf3c6('0xa7')){_0x16e357=this[_0xf3c6('0x1e')][_0x5e93a2];if(utils[_0xf3c6('0x7b')](_0x16e357)&&utils[_0xf3c6('0x79')](_0x16e357)){_0x16e357[_0xf3c6('0x7f')]=!![];Promise[_0xf3c6('0xa8')]()[_0xf3c6('0x3d')](checkIsIVRCampaignActive(_0x16e357))[_0xf3c6('0x3d')](checkInterval(_0x16e357))['then'](_0x2e3405[_0xf3c6('0xa9')](_0x16e357))['then'](_0x2e3405[_0xf3c6('0x8a')](_0x16e357[_0xf3c6('0xaa')],_0x16e357[_0xf3c6('0xab')],_0x16e357[_0xf3c6('0x5f')],_0x16e357))[_0xf3c6('0x3d')](_0x2e3405[_0xf3c6('0x8c')](_0x16e357['Interval'],_0x16e357['dialTimezone'],_0x16e357[_0xf3c6('0x5f')],_0x16e357))[_0xf3c6('0x3d')](_0x2e3405[_0xf3c6('0xac')](_0x16e357))[_0xf3c6('0x9c')](loggerCatchQueueSummary(_0xf3c6('0xad'),_0x16e357));}else{notSendMessagesCampaign(_0x16e357);}}}};Dialer[_0xf3c6('0x17')][_0xf3c6('0xae')]=function(_0xc8be9b){if(_0xc8be9b['dialMethod']!==_0xf3c6('0xa')){clearPredictiveAttributes(_0xc8be9b);}switch(_0xc8be9b[_0xf3c6('0xaf')]){case _0xf3c6('0xb0'):this[_0xf3c6('0xb1')](_0xc8be9b,0x1);break;case _0xf3c6('0xb2'):this[_0xf3c6('0xb1')](_0xc8be9b,_0xc8be9b['dialPowerLevel']);break;case _0xf3c6('0xa'):this[_0xf3c6('0xa')](_0xc8be9b);break;case'booked':this[_0xf3c6('0xb1')](_0xc8be9b,0x1);break;default:logger['error'](_0xf3c6('0xb3'),_0xc8be9b[_0xf3c6('0x5f')],_0xf3c6('0xb4'));}};Dialer['prototype'][_0xf3c6('0x8d')]=function(_0x47c513,_0x1f622c){var _0x15c465=_0x47c513[_0xf3c6('0xab')];var _0x300c38=_0x1f622c?_0x47c513[_0xf3c6('0xaa')]:_0x47c513[_0xf3c6('0x74')][_0xf3c6('0x77')];logger['silly'](_0xf3c6('0xb5'),_0x300c38,_0x15c465,_0x47c513[_0xf3c6('0x5f')],util[_0xf3c6('0x7c')](_0xf3c6('0xb6'),_0x47c513[_0xf3c6('0x5f')],_0x47c513['id']));var _0x4203f7=null;return Interval['intervalIftime'](_0x300c38,_0x15c465)[_0xf3c6('0x3d')](function(_0x8d2a03){if(_0x8d2a03===!![]){return _0x8d2a03;}else{_0x47c513[_0xf3c6('0x68')]=_0x1f622c?utils[_0xf3c6('0x69')][_0xf3c6('0xb7')]:utils[_0xf3c6('0x69')][_0xf3c6('0x9f')];_0x4203f7=msgResponse(_0xf3c6('0xa0'),_0xf3c6('0x8e'),'Global:\x20'+_0x1f622c+'\x20'+_0x47c513['name']+'\x20Interval\x20is\x20overtime:\x20'+util[_0xf3c6('0x43')](_0x300c38,{'showHidden':![],'depth':null})+_0xf3c6('0xa3')+_0x15c465);}if(_0x4203f7!==null){logger[_0xf3c6('0xb8')](_0xf3c6('0xb9'),_0x4203f7);_0x4203f7[_0xf3c6('0xba')]=_0x1f622c;throw _0x4203f7;}})[_0xf3c6('0x9c')](function(_0xb55d9f){logger[_0xf3c6('0x64')](_0xf3c6('0xbb'),_0xb55d9f);throw msgResponse('[ifTime][Action]',_0xf3c6('0xbc'),util[_0xf3c6('0x43')](_0xb55d9f,{'showHidden':![],'depth':null}));});};Dialer[_0xf3c6('0x17')]['syncAgentConnect']=function(_0x163eeb){if(this['voiceQueues'][_0x163eeb[_0xf3c6('0xbd')]]){if(this[_0xf3c6('0x24')][_0x163eeb[_0xf3c6('0xbe')]]&&this[_0xf3c6('0x24')][_0x163eeb[_0xf3c6('0xbe')]]['type']!=='ivr'){this[_0xf3c6('0xbf')](this[_0xf3c6('0x1d')][_0x163eeb['queue']]);this[_0xf3c6('0x24')][_0x163eeb[_0xf3c6('0xbe')]][_0xf3c6('0xc0')]=moment()['format'](_0xf3c6('0xc1'));}}};Dialer['prototype'][_0xf3c6('0x33')]=function(_0x1a22dd){var _0xa2e6dd=this[_0xf3c6('0x24')][_0x1a22dd[_0xf3c6('0xbe')]];if(this[_0xf3c6('0x1d')][_0x1a22dd[_0xf3c6('0xbd')]]){if(_0xa2e6dd&&_0xa2e6dd['type']!==_0xf3c6('0xc2')){delete this[_0xf3c6('0x24')][_0x1a22dd[_0xf3c6('0xbe')]];this[_0xf3c6('0x1d')][_0x1a22dd[_0xf3c6('0xbd')]][_0xf3c6('0xc3')]+=0x1;var _0xe707e7=new AgentComplete(_0xa2e6dd,_0x1a22dd);if(_0x1a22dd['reason']===_0xf3c6('0xc4')){_0xe707e7[_0xf3c6('0xc5')]=this[_0xf3c6('0x1d')][_0x1a22dd['queue']]['dialQueueProject2']&&this[_0xf3c6('0x1d')][_0x1a22dd['queue']][_0xf3c6('0xc6')]?moment()[_0xf3c6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0xf3c6('0xc7')](_0xe707e7)[_0xf3c6('0x9c')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0xe707e7)[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0xc8')));}}};Dialer[_0xf3c6('0x17')][_0xf3c6('0x2f')]=function(_0x37ef98){var _0x6aab22=this['uniqueId'][_0x37ef98[_0xf3c6('0xbe')]];var _0x141be8=this;var _0x5e0d63=![];var _0x557aff;var _0x17e98e;if(this[_0xf3c6('0x1d')][_0x37ef98['queue']]){if(_0x6aab22&&_0x6aab22['type']!==_0xf3c6('0xc2')){delete this[_0xf3c6('0x24')][_0x37ef98[_0xf3c6('0xbe')]];this[_0xf3c6('0xbf')](this[_0xf3c6('0x1d')][_0x37ef98[_0xf3c6('0xbd')]]);_0x6aab22['droptime']=moment()[_0xf3c6('0x7c')](_0xf3c6('0xc1'));var _0xc50f35=new QueueCallerAbandon(_0x6aab22,_0x37ef98);if(utils[_0xf3c6('0x5e')](_0x6aab22[_0xf3c6('0xc9')],_0x6aab22[_0xf3c6('0xca')])>=_0x6aab22['dialQueueTimeout']){this['voiceQueues'][_0x37ef98[_0xf3c6('0xbd')]][_0xf3c6('0x4c')]+=0x1;this[_0xf3c6('0x1d')][_0x37ef98[_0xf3c6('0xbd')]][_0xf3c6('0xcb')]+=0x1;this['voiceQueues'][_0x37ef98[_0xf3c6('0xbd')]][_0xf3c6('0xcc')]+=0x1;_0xc50f35[_0xf3c6('0x6e')]=0xa;_0xc50f35[_0xf3c6('0xcd')]=_0xf3c6('0xce');_0xc50f35[_0xf3c6('0xcf')]=_0xf3c6('0xd0');_0xc50f35['agiafterat']=this[_0xf3c6('0x1d')][_0x37ef98[_0xf3c6('0xbd')]][_0xf3c6('0xd1')]?moment()['format'](_0xf3c6('0xc1')):undefined;_0xc50f35[_0xf3c6('0xd2')]+=0x1;_0xc50f35[_0xf3c6('0xd3')]+=0x1;_0x557aff=this[_0xf3c6('0x1d')][_0x37ef98['queue']]['dialDropRetryFrequency'];_0x17e98e=this[_0xf3c6('0x1d')][_0x37ef98[_0xf3c6('0xbd')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xf3c6('0xd4')](_0xc50f35,_0xc50f35[_0xf3c6('0x6e')],_0x6aab22['voiceQueue'])['then'](function(_0x5445d6){_0x5e0d63=_0x5445d6['additional']==0x1;if(_0xc50f35[_0xf3c6('0xd2')]>=_0x141be8[_0xf3c6('0x1d')][_0x37ef98[_0xf3c6('0xbd')]][_0xf3c6('0xd5')]){_0x141be8[_0xf3c6('0xd6')](_0xc50f35,_0x5445d6[_0xf3c6('0xd7')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xc50f35[_0xf3c6('0xd2')],'scheduledat':moment()[_0xf3c6('0xd8')](_0x141be8[_0xf3c6('0x1d')][_0x37ef98[_0xf3c6('0xbd')]]['dialDropRetryFrequency'],_0xf3c6('0xd9'))[_0xf3c6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6aab22[_0xf3c6('0xda')],'ListId':_0x6aab22['ListId'],'VoiceQueueId':_0x6aab22['VoiceQueueId']||undefined,'CampaignId':_0x6aab22[_0xf3c6('0xdb')]||undefined})[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0xdc')));var _0x1550d2=new History(_0xc50f35);_0x1550d2['state']=0xa;_0x1550d2[_0xf3c6('0xcd')]='Drop';_0x1550d2[_0xf3c6('0xdd')]=moment()['format'](_0xf3c6('0xc1'));_0x1550d2['endtime']=_0x1550d2['starttime'];_0x1550d2[_0xf3c6('0xde')]=_0xc50f35[_0xf3c6('0xde')];_0x1550d2[_0xf3c6('0xdf')]=_0xc50f35[_0xf3c6('0xdf')];hopperUtils[_0xf3c6('0xc7')](_0x1550d2)[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0xe0')));}})['then'](function(){if(_0x5e0d63)hopperUtils['swapAdditionalPhones'](_0xc50f35,_0x557aff,_0x17e98e)[_0xf3c6('0x3d')](function(){return 0x1;});});}else{this[_0xf3c6('0x1d')][_0x37ef98['queue']][_0xf3c6('0x4e')]+=0x1;this[_0xf3c6('0x1d')][_0x37ef98[_0xf3c6('0xbd')]][_0xf3c6('0xe1')]+=0x1;_0xc50f35[_0xf3c6('0x6e')]=0xb;_0xc50f35['statedesc']=_0xf3c6('0xe2');_0xc50f35[_0xf3c6('0xcf')]='CALLEREXIT';_0xc50f35[_0xf3c6('0xe3')]+=0x1;_0xc50f35[_0xf3c6('0xd3')]+=0x1;_0x557aff=this[_0xf3c6('0x1d')][_0x37ef98[_0xf3c6('0xbd')]][_0xf3c6('0xe4')];_0x17e98e=this[_0xf3c6('0x1d')][_0x37ef98['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0xf3c6('0xd4')](_0xc50f35,_0xc50f35[_0xf3c6('0x6e')],_0x6aab22[_0xf3c6('0xe5')])[_0xf3c6('0x3d')](function(_0x377ede){if(_0xc50f35['countabandonedretry']>=_0x141be8[_0xf3c6('0x1d')][_0x37ef98[_0xf3c6('0xbd')]][_0xf3c6('0xe6')]){_0x141be8[_0xf3c6('0xd6')](_0xc50f35,_0x377ede[_0xf3c6('0xd7')]);}else{hopperUtils[_0xf3c6('0xe7')]({'active':![],'countabandonedretry':_0xc50f35['countabandonedretry'],'scheduledat':moment()['add'](_0x141be8[_0xf3c6('0x1d')][_0x37ef98[_0xf3c6('0xbd')]][_0xf3c6('0xe4')],_0xf3c6('0xd9'))[_0xf3c6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6aab22['ContactId'],'ListId':_0x6aab22[_0xf3c6('0xe8')],'VoiceQueueId':_0x6aab22[_0xf3c6('0xe9')]||undefined,'CampaignId':_0x6aab22['CampaignId']||undefined})[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0xea')));var _0x1d2bcf=new History(_0xc50f35);_0x1d2bcf[_0xf3c6('0x6e')]=0xb;_0x1d2bcf['statedesc']=_0xf3c6('0xe2');_0x1d2bcf[_0xf3c6('0xdd')]=moment()[_0xf3c6('0x7c')](_0xf3c6('0xc1'));_0x1d2bcf[_0xf3c6('0xeb')]=_0x1d2bcf[_0xf3c6('0xdd')];_0x1d2bcf[_0xf3c6('0xde')]=_0xc50f35[_0xf3c6('0xde')];_0x1d2bcf[_0xf3c6('0xdf')]=_0xc50f35[_0xf3c6('0xdf')];hopperUtils[_0xf3c6('0xc7')](_0x1d2bcf)[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0xec')));}})['then'](function(){if(_0x5e0d63)hopperUtils[_0xf3c6('0xed')](_0xc50f35,_0x557aff,_0x17e98e)[_0xf3c6('0x3d')](function(){return 0x1;});});}}}};Dialer[_0xf3c6('0x17')][_0xf3c6('0x36')]=function(_0x38d45a){if(this[_0xf3c6('0x23')][_0x38d45a['uniqueid']]){this['actions'][_0x38d45a['uniqueid']]['channel']=_0x38d45a[_0xf3c6('0xee')];}if(this[_0xf3c6('0x24')][_0x38d45a[_0xf3c6('0xbe')]]){this[_0xf3c6('0x24')][_0x38d45a['uniqueid']][_0xf3c6('0xee')]=_0x38d45a[_0xf3c6('0xee')];}};Dialer['prototype'][_0xf3c6('0x3a')]=function(_0x48f3e7){if(!this[_0xf3c6('0x23')][_0x48f3e7[_0xf3c6('0xef')]]){return;}var _0x446af1=this[_0xf3c6('0x1d')][this['actions'][_0x48f3e7['actionid']][_0xf3c6('0xbd')]][_0xf3c6('0xf0')]||_0xf3c6('0xf1');if(_0x446af1===_0xf3c6('0xf2')){if(this[_0xf3c6('0x23')][_0x48f3e7[_0xf3c6('0xef')]]&&_['isNil'](this[_0xf3c6('0x23')][_0x48f3e7[_0xf3c6('0xef')]][_0xf3c6('0xf3')])&&_0x48f3e7[_0xf3c6('0x84')]==='1'&&_0x48f3e7[_0xf3c6('0xf4')]==='0'){if(this[_0xf3c6('0x1f')][_0x48f3e7[_0xf3c6('0xf5')]]){if(!this[_0xf3c6('0x1f')][_0x48f3e7[_0xf3c6('0xf5')]]['locked']){this[_0xf3c6('0x1f')][_0x48f3e7['stateinterface']][_0xf3c6('0xf3')]=!![];this[_0xf3c6('0x23')][_0x48f3e7[_0xf3c6('0xef')]][_0xf3c6('0xf3')]=!![];this[_0xf3c6('0x23')][_0x48f3e7[_0xf3c6('0xef')]][_0xf3c6('0xf5')]=_0x48f3e7[_0xf3c6('0xf5')];}}}}else if(_0x446af1==='rrmemory'){if(this['actions'][_0x48f3e7[_0xf3c6('0xef')]]){if(this[_0xf3c6('0x1f')][_0x48f3e7[_0xf3c6('0xf5')]]){this[_0xf3c6('0x23')][_0x48f3e7[_0xf3c6('0xef')]][_0xf3c6('0xf5')]=_0x48f3e7['stateinterface'];if(_[_0xf3c6('0xf6')](this[_0xf3c6('0x29')][this[_0xf3c6('0x23')][_0x48f3e7[_0xf3c6('0xef')]][_0xf3c6('0xbd')]])){this[_0xf3c6('0x29')][this[_0xf3c6('0x23')][_0x48f3e7[_0xf3c6('0xef')]][_0xf3c6('0xbd')]]=[];}this[_0xf3c6('0x29')][this[_0xf3c6('0x23')][_0x48f3e7[_0xf3c6('0xef')]][_0xf3c6('0xbd')]]['push'](_[_0xf3c6('0xf7')](_['pick'](this['actions'][_0x48f3e7[_0xf3c6('0xef')]],[_0xf3c6('0xf8'),'stateinterface']),{'status':_0x48f3e7['status'],'paused':_0x48f3e7['paused']}));}}}};Dialer[_0xf3c6('0x17')][_0xf3c6('0x3b')]=function(_0x35e954){if(!this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]]){return;}var _0x40022f=this;var _0x29406b=this[_0xf3c6('0x1d')][this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xbd')]];var _0xf376dd=_0x29406b[_0xf3c6('0xf0')]||_0xf3c6('0xf1');if(_0xf376dd===_0xf3c6('0xf2')){if(this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]]&&this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xf5')]){this[_0xf3c6('0x1c')][_0xf3c6('0xf9')](this['actions'][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xf8')],this[_0xf3c6('0x23')][_0x35e954['actionid']][_0xf3c6('0xf5')])[_0xf3c6('0x9c')](function(_0x535dc6){logger[_0xf3c6('0x64')](_0xf3c6('0xfa'),util['inspect'](_0x535dc6,{'showHidden':![],'depth':null}));})[_0xf3c6('0x1a')](function(){_0x40022f[_0xf3c6('0xbf')](_0x40022f['voiceQueues'][_0x40022f[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xbd')]]);_0x40022f[_0xf3c6('0x1f')][_0x40022f['actions'][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xf5')]]['locked']=![];delete _0x40022f[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]];unlockQueueStatus(_0x29406b);});}else{this['updateOriginated'](this[_0xf3c6('0x1d')][this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xbd')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xda')],'ListId':this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xe8')],'VoiceQueueId':this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xe9')]||undefined,'CampaignId':this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]]['CampaignId']||undefined})[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0xfb')));delete this['actions'][_0x35e954['actionid']];unlockQueueStatus(_0x29406b);}}else if(_0xf376dd===_0xf3c6('0xf1')){var _0x2aee91;if(this['actions'][_0x35e954[_0xf3c6('0xef')]]&&!_[_0xf3c6('0x78')](this[_0xf3c6('0x29')][this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xbd')]])){if(this['queueBookedRR'][_0x40022f[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xbd')]]){this['queueBookedRR'][_0x40022f['actions'][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xbd')]]=this[_0xf3c6('0x2a')][this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xbd')]]?this[_0xf3c6('0x2a')][this[_0xf3c6('0x23')][_0x35e954['actionid']]['queue']]:this['queueBooked'][this['actions'][_0x35e954[_0xf3c6('0xef')]]['queue']]?this[_0xf3c6('0x29')][this['actions'][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xbd')]]['_rr']||0x0:0x0;}this[_0xf3c6('0x29')][this[_0xf3c6('0x23')][_0x35e954[_0xf3c6('0xef')]][_0xf3c6('0xbd')]][_0xf3c6('0xfc')]=this['queueBookedRR'][this[_0xf3c6('0x23')][_0x35e954['actionid']][_0xf3c6('0xbd')]];for(var _0x16abee=0x0;_0x16abee=_0x108904[_0xf3c6('0x124')]){_0x6717c[_0xf3c6('0x125')](_0x39c5fa,_0x252d44,_0x163772,'reason19\x20machine....');}else{if(_0x39c5fa[_0xf3c6('0x11d')]>=_0x108904['dialMachineMaxRetry']){_0x6717c['createStateFinal'](_0x39c5fa,_0x252d44,_0x163772,_0xf3c6('0x126'));}else{hopperUtils[_0xf3c6('0xe7')]({'active':![],'countmachineretry':_0x39c5fa[_0xf3c6('0x11d')],'scheduledat':moment()[_0xf3c6('0xd8')](_0x108904['dialMachineRetryFrequency'],_0xf3c6('0xd9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x39c5fa[_0xf3c6('0xda')],'ListId':_0x39c5fa[_0xf3c6('0xe8')],'VoiceQueueId':_0x39c5fa[_0xf3c6('0xe9')]||undefined,'CampaignId':_0x39c5fa[_0xf3c6('0xdb')]||undefined})[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x127')));_0x252d44({'reschedule':0x1});}}});}if(_0xcb0526['type']===_0xf3c6('0xc2')&&this['campaigns'][_0xcb0526[_0xf3c6('0xbd')]][_0xf3c6('0x10f')]&&_0x5e32ce['value']==='HANGUP'){delete this[_0xf3c6('0x24')][_0x5e32ce['uniqueid']];this[_0xf3c6('0xbf')](this[_0xf3c6('0x1e')][_0xcb0526[_0xf3c6('0xbd')]]);_0x240a9b=new Hangup(_0xcb0526,_0x5e32ce);_0x240a9b[_0xf3c6('0x6e')]=0x12;_0x240a9b['statedesc']='HangupInAMD';_0x240a9b[_0xf3c6('0x113')]='AMD';ami[_0xf3c6('0x3f')](_0xf3c6('0x115'),ut['buildObj'](_0x240a9b,_0xf3c6('0x117')));this[_0xf3c6('0x128')](_0x240a9b,_0xf3c6('0x129'),_0xf3c6('0x12a'));}if(_0xcb0526['type']===_0xf3c6('0xc2')&&this['campaigns'][_0xcb0526[_0xf3c6('0xbd')]][_0xf3c6('0x10f')]&&_0x5e32ce['value']===_0xf3c6('0x11a')){return new Promise(function(_0x33f19e,_0x3756b8){delete _0x6717c['uniqueId'][_0x5e32ce[_0xf3c6('0xbe')]];_0x6717c[_0xf3c6('0xbf')](_0x6717c[_0xf3c6('0x1e')][_0xcb0526[_0xf3c6('0xbd')]]);_0x6717c[_0xf3c6('0x1e')][_0xcb0526[_0xf3c6('0xbd')]][_0xf3c6('0xc3')]+=0x1;_0x6717c[_0xf3c6('0x1e')][_0xcb0526[_0xf3c6('0xbd')]]['outboundAnswerAgiCallsDay']+=0x1;var _0xb5caee=_0x6717c[_0xf3c6('0x1e')][_0xcb0526['queue']];var _0x2aba89=new Hangup(_0xcb0526,_0x5e32ce);_0x2aba89['state']=0x13;_0x2aba89[_0xf3c6('0xcd')]='Machine';_0x2aba89['membername']=_0xf3c6('0x114');_0x2aba89['countmachineretry']+=0x1;_0x2aba89[_0xf3c6('0xd3')]+=0x1;_0x2aba89[_0xf3c6('0x117')]=!![];ami['emit']('custom:amd',ut[_0xf3c6('0x116')](_0x2aba89,'amd'));hopperUtils[_0xf3c6('0xc7')](_0x2aba89)['catch'](loggerCatch(_0xf3c6('0x11e')));if(_0x2aba89['countbusyretry']+_0x2aba89[_0xf3c6('0x120')]+_0x2aba89[_0xf3c6('0x121')]+_0x2aba89[_0xf3c6('0x122')]+_0x2aba89[_0xf3c6('0xd2')]+_0x2aba89[_0xf3c6('0xe3')]+_0x2aba89[_0xf3c6('0x11d')]+_0x2aba89['countagentrejectretry']>=_0xb5caee[_0xf3c6('0x124')]){_0x6717c[_0xf3c6('0x125')](_0x2aba89,_0x33f19e,_0x3756b8,'reason19\x20machine....');}else{if(_0x2aba89['countmachineretry']>=_0xb5caee['dialMachineMaxRetry']){_0x6717c[_0xf3c6('0x12b')](_0x2aba89,_0x33f19e,_0x3756b8,'reason\x2019\x20machine....');}else{hopperUtils[_0xf3c6('0xe7')]({'active':![],'countmachineretry':_0x2aba89[_0xf3c6('0x11d')],'scheduledat':moment()[_0xf3c6('0xd8')](_0xb5caee[_0xf3c6('0x12c')],_0xf3c6('0xd9'))[_0xf3c6('0x7c')](_0xf3c6('0xc1')),'ContactId':_0x2aba89[_0xf3c6('0xda')],'ListId':_0x2aba89[_0xf3c6('0xe8')],'VoiceQueueId':_0x2aba89[_0xf3c6('0xe9')]||undefined,'CampaignId':_0x2aba89[_0xf3c6('0xdb')]||undefined})[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x127')));_0x33f19e({'reschedule':0x1});}}});}}};Dialer[_0xf3c6('0x17')][_0xf3c6('0x12d')]=function(_0x27e0b5){var _0x43d31d=this['uniqueId'][_0x27e0b5[_0xf3c6('0xbe')]];var _0x4a9949;if(_0x43d31d&&_0x43d31d[_0xf3c6('0x40')]===_0xf3c6('0xc2')){delete this['uniqueId'][_0x27e0b5[_0xf3c6('0xbe')]];this[_0xf3c6('0xbf')](this[_0xf3c6('0x1e')][_0x43d31d[_0xf3c6('0xbd')]]);this[_0xf3c6('0x1e')][_0x43d31d['queue']][_0xf3c6('0x12e')]+=0x1;_0x4a9949=new Hangup(_0x43d31d,_0x27e0b5);hopperUtils[_0xf3c6('0xc7')](_0x4a9949)[_0xf3c6('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xf3c6('0x12f')](_0x4a9949)[_0xf3c6('0x9c')](loggerCatch('[syncHangupIvr]'));}if(_0x43d31d&&_0x43d31d[_0xf3c6('0x40')]!==_0xf3c6('0xc2')&&isNotNull(this[_0xf3c6('0x1d')][_0x43d31d[_0xf3c6('0xbd')]]['dialQueueProject'])){delete this[_0xf3c6('0x24')][_0x27e0b5[_0xf3c6('0xbe')]];this['updateOriginated'](this['voiceQueues'][_0x43d31d[_0xf3c6('0xbd')]]);this[_0xf3c6('0x1d')][_0x43d31d[_0xf3c6('0xbd')]][_0xf3c6('0xc3')]+=0x1;this[_0xf3c6('0x1d')][_0x43d31d[_0xf3c6('0xbd')]][_0xf3c6('0x11b')]+=0x1;_0x4a9949=new Hangup(_0x43d31d,_0x27e0b5);_0x4a9949[_0xf3c6('0x6e')]=0x10;_0x4a9949[_0xf3c6('0xcd')]=_0xf3c6('0x130');_0x4a9949[_0xf3c6('0x113')]=_0xf3c6('0x131');hopperUtils['createHistory'](_0x4a9949)[_0xf3c6('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x4a9949)[_0xf3c6('0x9c')](loggerCatch('[syncHangupIvr]'));}if(_0x43d31d&&_0x43d31d[_0xf3c6('0x40')]!==_0xf3c6('0xc2')&&!isNotNull(this['voiceQueues'][_0x43d31d['queue']][_0xf3c6('0x132')])){delete this[_0xf3c6('0x24')][_0x27e0b5['uniqueid']];this['updateOriginated'](this[_0xf3c6('0x1d')][_0x43d31d['queue']]);this[_0xf3c6('0x1d')][_0x43d31d['queue']]['outboundUnknownCallsDay']+=0x1;_0x4a9949=new Hangup(_0x43d31d,_0x27e0b5);_0x4a9949[_0xf3c6('0x6e')]=0xc;_0x4a9949[_0xf3c6('0xcd')]=_0x27e0b5[_0xf3c6('0x133')];_0x4a9949[_0xf3c6('0x113')]='Unknow';hopperUtils[_0xf3c6('0xc7')](_0x4a9949)[_0xf3c6('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xf3c6('0x12f')](_0x4a9949)[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x134')));}};Dialer['prototype'][_0xf3c6('0xb')]=function(_0x35b16a){var _0x3cf4d8=this;if(!_0x3cf4d8[_0xf3c6('0x2b')][_0x35b16a[_0xf3c6('0x5f')]]){_0x3cf4d8[_0xf3c6('0x2b')][_0x35b16a[_0xf3c6('0x5f')]]={'running':![]};}else if(_0x3cf4d8[_0xf3c6('0x2b')][_0x35b16a[_0xf3c6('0x5f')]][_0xf3c6('0x135')]===!![]){return;}else if(_0x3cf4d8[_0xf3c6('0x2b')][_0x35b16a[_0xf3c6('0x5f')]][_0xf3c6('0x135')]===![]){_0x3cf4d8[_0xf3c6('0x2b')][_0x35b16a[_0xf3c6('0x5f')]][_0xf3c6('0x135')]=!![];}var _0x279565=_0x3cf4d8['voiceQueues'][_0x35b16a[_0xf3c6('0x5f')]];var _0x33257f=_0x279565[_0xf3c6('0x68')]!==utils[_0xf3c6('0x69')]['INACTIVE'];var _0x22259e=utils['isPreviewCampaign'](_0x279565);_0x279565[_0xf3c6('0x136')]=utils[_0xf3c6('0x137')](_0x279565,_0x3cf4d8[_0xf3c6('0x20')]);Promise[_0xf3c6('0xa8')]()[_0xf3c6('0x3d')](function(){if(_0x279565[_0xf3c6('0x136')]===utils[_0xf3c6('0x69')][_0xf3c6('0x7a')]){if(_0x33257f){clearPredictiveAttributes(_0x279565);_0x35b16a[_0xf3c6('0x26')]=undefined;_0x35b16a[_0xf3c6('0x27')]=undefined;}if(_0x279565[_0xf3c6('0x136')]===utils[_0xf3c6('0x69')][_0xf3c6('0x7a')]){_0x35b16a['available']=0x0;_0x35b16a[_0xf3c6('0xf4')]=0x0;_0x35b16a['inUse']=0x0;_0x35b16a[_0xf3c6('0x138')]=0x0;_0x35b16a['pTalking']=0x0;}}else if(_0x279565['statusMessage']===utils[_0xf3c6('0x69')][_0xf3c6('0x139')]&&!_0x22259e){return _0x3cf4d8[_0xf3c6('0x8d')](_0x279565,!![])[_0xf3c6('0x3d')](function(){return _0x3cf4d8[_0xf3c6('0x8d')](_0x279565,![]);})[_0xf3c6('0x3d')](function(){return _0x3cf4d8[_0xf3c6('0xae')](_0x279565);})[_0xf3c6('0x9c')](function(_0x46c91b){loggerSyncQueueSummary[_0xf3c6('0x41')](_0xf3c6('0x13a'),util[_0xf3c6('0x43')](_0x46c91b,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x279565);});}else{clearPredictiveAttributes(_0x279565);}})['then'](function(){var _0x542763=_0x35b16a[_0xf3c6('0x13b')](_0x279565);if(_0x542763||_0x279565['queueSummaryCountersUpdated']){_0x279565[_0xf3c6('0x13c')]=![];_0x35b16a[_0xf3c6('0x13d')](_0x279565);Object[_0xf3c6('0x13e')](_0x279565,_0x35b16a);emitOutboundVoiceQueueSummary(_0x35b16a);}_0x3cf4d8[_0xf3c6('0x2b')][_0x279565['name']][_0xf3c6('0x135')]=![];})[_0xf3c6('0x9c')](function(_0x45cd99){logger['error'](_0xf3c6('0x13a'),util['inspect'](_0x45cd99,{'showHidden':![],'depth':null}));_0x3cf4d8[_0xf3c6('0x2b')][_0x279565[_0xf3c6('0x5f')]][_0xf3c6('0x135')]=![];});};Dialer[_0xf3c6('0x17')][_0xf3c6('0x13f')]=_[_0xf3c6('0x140')](function(){var _0x57617a=_[_0xf3c6('0x141')](this[_0xf3c6('0x1d')],function(_0x28fc34){return _0x28fc34[_0xf3c6('0x142')];});var _0x2c8878=_[_0xf3c6('0x141')](this[_0xf3c6('0x1f')],function(_0x482704){return _0x482704[_0xf3c6('0x143')]&&_0x482704[_0xf3c6('0x84')]===_0xf3c6('0x144');});if(_0x57617a[_0xf3c6('0x93')]>0x0&&_0x2c8878[_0xf3c6('0x93')]>0x0){return Promise[_0xf3c6('0xa8')]()['then'](cmHopper[_0xf3c6('0x145')](_[_0xf3c6('0x146')](_0x57617a,'id'),previewRecallmeReminderInterval,_[_0xf3c6('0x146')](_0x2c8878,'id')))[_0xf3c6('0x3d')](function(_0x20f9a2){for(var _0x53c1cc=0x0;_0x53c1cc<_0x20f9a2[_0xf3c6('0x93')];_0x53c1cc++){var _0x14e463=_0x20f9a2[_0x53c1cc][_0xf3c6('0x147')][_0xf3c6('0x5f')];if(_0x14e463)io['to'](util['format'](_0xf3c6('0x148'),_0x14e463))[_0xf3c6('0x3f')](_0xf3c6('0x149'),{'hopper':_0x20f9a2[_0x53c1cc]});}})['catch'](function(_0xd671ea){logger[_0xf3c6('0x64')](_0xf3c6('0x14a'),_0xd671ea);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xf3c6('0x17')][_0xf3c6('0x14b')]=function(){var _0x3df0c7=this;setInterval(function(){_0x3df0c7[_0xf3c6('0x14c')](_0x3df0c7['uniqueId'],_0xf3c6('0x14d'));_0x3df0c7['clearZombieChannels'](_0x3df0c7[_0xf3c6('0x23')],'[actions]');},0x32c8);};Dialer[_0xf3c6('0x17')][_0xf3c6('0x14c')]=function(_0x179544,_0x490d34){var _0x345c46=this;for(var _0x2bb9af in _0x179544){if(typeof _0x179544[_0x2bb9af]!=='undefined'){this['sequence'][_0xf3c6('0x18')](function(){if(!_[_0xf3c6('0xf6')](_0x179544[_0x2bb9af])){return ami['Action']({'action':_0xf3c6('0x84'),'channel':_0x179544[_0x2bb9af][_0xf3c6('0xee')]})[_0xf3c6('0x9c')](function(_0x4195e3){if(_0x4195e3[_0xf3c6('0x68')]===_0xf3c6('0x14e')){setTimeout(function(){if(_0x179544[_0x2bb9af]&&_0x179544[_0x2bb9af][_0xf3c6('0x40')]!==_0xf3c6('0xc2')){_0x345c46['updateOriginated'](_0x345c46[_0xf3c6('0x1d')][_0x179544[_0x2bb9af]['queue']]);logger[_0xf3c6('0x64')](_0xf3c6('0x14f'),_0x490d34,_0x2bb9af,_0x179544[_0x2bb9af][_0xf3c6('0xbd')]);delete _0x179544[_0x2bb9af];}if(_0x179544[_0x2bb9af]&&_0x179544[_0x2bb9af][_0xf3c6('0x40')]===_0xf3c6('0xc2')){_0x345c46['updateOriginated'](_0x345c46[_0xf3c6('0x1e')][_0x179544[_0x2bb9af][_0xf3c6('0xbd')]]);logger[_0xf3c6('0x64')](_0xf3c6('0x150'),_0x490d34,_0x2bb9af,_0x179544[_0x2bb9af][_0xf3c6('0xbd')]);delete _0x179544[_0x2bb9af];}},0x2328);}});}});}}};Dialer[_0xf3c6('0x17')][_0xf3c6('0x151')]=function(_0x29c30b){return Promise[_0xf3c6('0xa8')]()[_0xf3c6('0x3d')](voiceQueueRt['getVoiceQueueRtPauses'](_0x29c30b))[_0xf3c6('0x9c')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xf3c6('0x17')][_0xf3c6('0xbf')]=function(_0x2895f2){if(!_[_0xf3c6('0x3e')](_0x2895f2)&&_0x2895f2!==null){if(typeof _0x2895f2[_0xf3c6('0x152')]!==_0xf3c6('0xa7')){if(_0x2895f2[_0xf3c6('0x152')]>0x0){_0x2895f2['originated']-=0x1;}else{logger[_0xf3c6('0x64')](_0xf3c6('0x153'));}}}else{logger[_0xf3c6('0x64')](_0xf3c6('0x154'));}};Dialer[_0xf3c6('0x17')][_0xf3c6('0x155')]=function(_0x1fa9f0,_0x502508){var _0x5d6472=this;return function(_0x29aacb){_0x5d6472[_0xf3c6('0xbf')](_0x502508);logger[_0xf3c6('0x64')](_0x1fa9f0,util['inspect'](_0x29aacb,{'showHidden':![],'depth':null}));};};Dialer[_0xf3c6('0x17')][_0xf3c6('0x156')]=function(_0x2fdb52,_0x48ae26,_0x3b9000){var _0x559f40={'state':0x19,'statedesc':_0xf3c6('0x157')};this[_0xf3c6('0xbf')](_0x48ae26);this[_0xf3c6('0x128')](_['merge'](_0x559f40,_[_0xf3c6('0x73')](_0x3b9000,['ContactId','ListId',_0xf3c6('0x158'),_0xf3c6('0xe9'),_0xf3c6('0xdb')])),_0xf3c6('0x159'),_0xf3c6('0x15a'));logger[_0xf3c6('0x64')](_0x2fdb52);};Dialer[_0xf3c6('0x17')][_0xf3c6('0x128')]=function(_0x3b1f27,_0x17d9ac,_0x4d0fa2){hopperUtils['createHistory'](_0x3b1f27)[_0xf3c6('0x9c')](loggerCatch(_0x17d9ac));hopperUtils[_0xf3c6('0x12f')](_0x3b1f27)[_0xf3c6('0x9c')](loggerCatch(_0x4d0fa2));};Dialer[_0xf3c6('0x17')][_0xf3c6('0xd6')]=function(_0x3ae0a1,_0x85f106){hopperUtils['createHistory'](_0x3ae0a1)[_0xf3c6('0x9c')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x85f106==0x0){hopperUtils['moveContactManagedDialer'](_0x3ae0a1)[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x15b')));}};Dialer[_0xf3c6('0x17')][_0xf3c6('0x14a')]=function(_0x4c18b1){return Promise[_0xf3c6('0xa8')]()[_0xf3c6('0x3d')](cmHopper[_0xf3c6('0x145')](_0x4c18b1['id'],previewRecallmeReminderInterval))['then'](function(_0x155958){for(var _0x12f300=0x0;_0x12f300<_0x155958[_0xf3c6('0x93')];_0x12f300++){var _0x167991=_0x155958[_0x12f300]['Agent'][_0xf3c6('0x5f')];if(_0x167991)io['to'](util['format'](_0xf3c6('0x148'),_0x167991))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x155958[_0x12f300]});}})['catch'](function(){});};Dialer[_0xf3c6('0x17')]['launchHandleIvr']=function(_0x53b9ea){var _0x617b45=this;return function(){_0x617b45[_0xf3c6('0x15c')](_0x53b9ea);};};Dialer[_0xf3c6('0x17')][_0xf3c6('0x15d')]=function(_0x259003,_0x3ae1fb){var _0x1b2887=this;var _0x4e6c0b=uuid['v4']();this[_0xf3c6('0x23')][_0x4e6c0b]=new Action(_0x259003,_0x3ae1fb,_0x4e6c0b);return new Promise(function(_0x2dd1d4,_0x1f5a62){if(_[_0xf3c6('0x3e')](_0x259003)&&typeof _0x259003!==_0xf3c6('0x15e')){return _0x1f5a62(msgResponse('originate','Failure',_0xf3c6('0x15f')));}if(_['isUndefined'](_0x3ae1fb[_0xf3c6('0x160')])||_0x3ae1fb[_0xf3c6('0x160')]===null){return _0x1f5a62(msgResponse(_0xf3c6('0x161'),_0xf3c6('0x8e'),'contact\x20is\x20undefine'));}var _0x114426={'XMD-CALLERID':_0x1b2887['actions'][_0x4e6c0b][_0xf3c6('0x162')](),'XMD-AGI':_0x259003[_0xf3c6('0x132')]?util[_0xf3c6('0x7c')](_0xf3c6('0x163'),ipAgi,_0x259003[_0xf3c6('0x132')]):_0xf3c6('0x164'),'XMD-AGIAFTER':_0x259003[_0xf3c6('0xd1')]?util[_0xf3c6('0x7c')]('\x22agi://%s/square,%s\x22',ipAgi,_0x259003['dialQueueProject2']):_0xf3c6('0x164'),'XMD-QUEUE':utils[_0xf3c6('0x165')](_0x259003)?util['format'](_0xf3c6('0x166'),_0x259003['name'],_0x259003['dialQueueOptions']||'',_0x259003[_0xf3c6('0xc6')]?'c':'',_0x259003[_0xf3c6('0x167')]||0x3):'NONE','XMD-CONTACTID':_0x3ae1fb[_0xf3c6('0xda')],'XMD-CDRTYPE':_0xf3c6('0x9'),'CALLERID(all)':_0x1b2887[_0xf3c6('0x23')][_0x4e6c0b]['getCaller'](),'XMD-AMD':_0x259003['dialAMDActive']?_0xf3c6('0x139'):_0xf3c6('0x164'),'XMD-DESTINATION':_0xf3c6('0x10e')};if(_0x259003[_0xf3c6('0x10f')]){_0x114426['XMD-AMDINITIALSILENCE']=_0x259003[_0xf3c6('0x168')]||0x9c4;_0x114426[_0xf3c6('0x169')]=_0x259003[_0xf3c6('0x16a')]||0x5dc;_0x114426[_0xf3c6('0x16b')]=_0x259003[_0xf3c6('0x16c')]||0x320;_0x114426['XMD-AMDTOTALANALYSISTIME']=_0x259003[_0xf3c6('0x16d')]||0x1388;_0x114426[_0xf3c6('0x16e')]=_0x259003[_0xf3c6('0x16f')]||0x64;_0x114426['XMD-AMDBETWEENWORDSSILENCE']=_0x259003[_0xf3c6('0x170')]||0x32;_0x114426[_0xf3c6('0x171')]=_0x259003['dialAMDMaximumNumberOfWords']||0x3;_0x114426['XMD-AMDSILENCETHRESHOLD']=_0x259003['dialAMDSilenceThreshold']||0x100;_0x114426[_0xf3c6('0x172')]=_0x259003[_0xf3c6('0x173')]||0x1388;}if(utils[_0xf3c6('0x165')](_0x259003)){_0x114426['XMD-VOICEQUEUEID']=_0x3ae1fb[_0xf3c6('0xe9')];}else{_0x114426[_0xf3c6('0x174')]=_0x3ae1fb['CampaignId'];}for(var _0x394064 in _0x3ae1fb[_0xf3c6('0x175')]){if(typeof _0x3ae1fb[_0xf3c6('0x175')][_0x394064]!=='undefined'){if(isNotNull(_0x3ae1fb[_0xf3c6('0x175')][_0x394064])&&_0x394064!=='id'&&_0x394064!=='tags'&&_0x394064!==_0xf3c6('0x176')&&_0x394064!==_0xf3c6('0x177')){_0x114426[util[_0xf3c6('0x7c')](_0xf3c6('0x178'),_0xf3c6('0x179'),_[_0xf3c6('0x17a')](_0x394064))]=_0x3ae1fb[_0xf3c6('0x175')][_0x394064];}}}var _0x1ab584=_0x1b2887[_0xf3c6('0x86')](_0x259003['Trunk'])?utils['getCallerId'](_0x259003[_0xf3c6('0x17b')][_0xf3c6('0x17c')],_0x259003[_0xf3c6('0x17d')],_0x259003[_0xf3c6('0x17e')]>0x0?utils[_0xf3c6('0x17f')](_0x259003['dialOriginateCallerIdNumber'],_0x259003[_0xf3c6('0x17e')]):_0x259003[_0xf3c6('0x180')]):utils[_0xf3c6('0x181')](_['isNil'](_0x259003[_0xf3c6('0x87')])?_0x259003[_0xf3c6('0x17b')][_0xf3c6('0x17c')]:_0x259003[_0xf3c6('0x87')]['callerid'],_0x259003[_0xf3c6('0x17d')],_0x259003['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xf3c6('0x17f')](_0x259003[_0xf3c6('0x180')],_0x259003[_0xf3c6('0x17e')]):_0x259003[_0xf3c6('0x180')]);if(_0x1ab584){_0x114426[_0xf3c6('0x182')]=_0x1b2887[_0xf3c6('0x23')][_0x4e6c0b][_0xf3c6('0x183')]=utils[_0xf3c6('0x184')](_0x1ab584);_0x114426['XMD-ORIGINATECALLERIDNUM']=_0x3ae1fb[_0xf3c6('0x160')];}_0x259003[_0xf3c6('0x185')]=_0x114426;return ami[_0xf3c6('0x95')]({'actionid':_0x4e6c0b,'action':_0xf3c6('0x161'),'channel':_0x1b2887[_0xf3c6('0x86')](_0x259003[_0xf3c6('0x17b')])?util['format']('SIP/%s/%s%s',_0x259003['Trunk']['name'],isNotNull(_0x259003[_0xf3c6('0x186')])?_0x259003[_0xf3c6('0x186')][_0xf3c6('0x187')]()||'':'',_0x259003[_0xf3c6('0x188')]>0x0?_0x3ae1fb[_0xf3c6('0x160')][_0xf3c6('0x189')](_0x259003[_0xf3c6('0x188')]):_0x3ae1fb[_0xf3c6('0x160')]):util[_0xf3c6('0x7c')](_0xf3c6('0x18a'),_['isNil'](_0x259003[_0xf3c6('0x87')])?_0x259003[_0xf3c6('0x17b')]['name']:_0x259003[_0xf3c6('0x87')][_0xf3c6('0x5f')],isNotNull(_0x259003[_0xf3c6('0x186')])?_0x259003[_0xf3c6('0x186')][_0xf3c6('0x187')]()||'':'',_0x259003[_0xf3c6('0x188')]>0x0?_0x3ae1fb['phone']['substring'](_0x259003[_0xf3c6('0x188')]):_0x3ae1fb[_0xf3c6('0x160')]),'callerid':_0x1ab584,'Exten':'xcally-motion-dialer','Context':_0xf3c6('0x18b'),'Priority':'1','variable':_0x114426,'timeout':(_0x259003[_0xf3c6('0x18c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4e6c0b})[_0xf3c6('0x3d')](function(_0x53bb5a){return _0x2dd1d4(_0x53bb5a);})[_0xf3c6('0x9c')](function(_0x5df825){_0x259003[_0xf3c6('0x18d')]+=0x1;var _0x5a478d=new History(_0x1b2887[_0xf3c6('0x23')][_0x4e6c0b]);logger[_0xf3c6('0x64')](util[_0xf3c6('0x7c')](_0xf3c6('0x18e'),JSON[_0xf3c6('0x72')](_0x5df825)));_0x5a478d[_0xf3c6('0x6e')]=0xe;_0x5a478d[_0xf3c6('0xcd')]=_0xf3c6('0x18f');_0x5a478d['starttime']=moment()['format'](_0xf3c6('0xc1'));_0x5a478d['endtime']=_0x5a478d[_0xf3c6('0xdd')];hopperUtils[_0xf3c6('0xc7')](_0x5a478d)[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x190')));_0x1b2887[_0xf3c6('0x12f')](_0x5a478d)[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x190')))['finally'](function(){delete _0x1b2887[_0xf3c6('0x23')][_0x4e6c0b];return _0x1f5a62(msgResponse(_0xf3c6('0x161'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0xf3c6('0x17')][_0xf3c6('0x191')]=function(_0x12c865,_0x2b5801,_0x416b01){var _0x1b4558=new History(_0x2b5801);if(_0x1b4558[_0xf3c6('0x11f')]+_0x1b4558[_0xf3c6('0x120')]+_0x1b4558['countnoanswerretry']+_0x1b4558[_0xf3c6('0x122')]+_0x1b4558[_0xf3c6('0xd2')]+_0x1b4558[_0xf3c6('0xe3')]+_0x1b4558[_0xf3c6('0x11d')]+_0x1b4558['countagentrejectretry']>=_0x416b01[_0xf3c6('0x124')]-0x1){return!![];}switch(_0x12c865){case 0x3:if(_0x1b4558['countnoanswerretry']>=_0x416b01[_0xf3c6('0x192')]-0x1){return!![];}hopperUtils[_0xf3c6('0xe7')]({'active':![],'countnoanswerretry':_0x1b4558['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xf3c6('0xd8')](_0x416b01['dialNoAnswerRetryFrequency'],'minutes')[_0xf3c6('0x7c')](_0xf3c6('0xc1')),'ContactId':_0x1b4558['ContactId'],'ListId':_0x1b4558[_0xf3c6('0xe8')],'VoiceQueueId':_0x1b4558['VoiceQueueId']||undefined,'CampaignId':_0x1b4558['CampaignId']||undefined})[_0xf3c6('0x9c')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x1b4558[_0xf3c6('0x11f')]>=_0x416b01[_0xf3c6('0x193')]-0x1){return!![];}hopperUtils[_0xf3c6('0xe7')]({'active':![],'countbusyretry':_0x1b4558[_0xf3c6('0x11f')]+=0x1,'scheduledat':moment()[_0xf3c6('0xd8')](_0x416b01[_0xf3c6('0x194')],_0xf3c6('0xd9'))[_0xf3c6('0x7c')](_0xf3c6('0xc1')),'ContactId':_0x1b4558[_0xf3c6('0xda')],'ListId':_0x1b4558['ListId'],'VoiceQueueId':_0x1b4558[_0xf3c6('0xe9')]||undefined,'CampaignId':_0x1b4558['CampaignId']||undefined})[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x195')));break;case 0x8:if(_0x1b4558['countcongestionretry']>=_0x416b01[_0xf3c6('0x196')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x1b4558['countcongestionretry']+=0x1,'scheduledat':moment()[_0xf3c6('0xd8')](_0x416b01[_0xf3c6('0x197')],_0xf3c6('0xd9'))[_0xf3c6('0x7c')](_0xf3c6('0xc1')),'ContactId':_0x1b4558[_0xf3c6('0xda')],'ListId':_0x1b4558[_0xf3c6('0xe8')],'VoiceQueueId':_0x1b4558['VoiceQueueId']||undefined,'CampaignId':_0x1b4558[_0xf3c6('0xdb')]||undefined})[_0xf3c6('0x9c')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x1b4558[_0xf3c6('0x122')]>=_0x416b01[_0xf3c6('0x198')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1b4558['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xf3c6('0xd8')](_0x416b01[_0xf3c6('0x199')],_0xf3c6('0xd9'))[_0xf3c6('0x7c')](_0xf3c6('0xc1')),'ContactId':_0x1b4558[_0xf3c6('0xda')],'ListId':_0x1b4558[_0xf3c6('0xe8')],'VoiceQueueId':_0x1b4558[_0xf3c6('0xe9')]||undefined,'CampaignId':_0x1b4558[_0xf3c6('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1b4558[_0xf3c6('0xd2')]>=_0x416b01[_0xf3c6('0xd5')]-0x1){return!![];}hopperUtils[_0xf3c6('0xe7')]({'active':![],'countdropretry':_0x1b4558[_0xf3c6('0xd2')]+=0x1,'scheduledat':moment()['add'](_0x416b01['dialDropRetryFrequency'],_0xf3c6('0xd9'))['format'](_0xf3c6('0xc1')),'ContactId':_0x1b4558[_0xf3c6('0xda')],'ListId':_0x1b4558[_0xf3c6('0xe8')],'VoiceQueueId':_0x1b4558['VoiceQueueId']||undefined,'CampaignId':_0x1b4558['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1b4558['countabandonedretry']>=_0x416b01[_0xf3c6('0xe6')]-0x1){return!![];}hopperUtils[_0xf3c6('0xe7')]({'active':![],'countabandonedretry':_0x1b4558[_0xf3c6('0xe3')]+=0x1,'scheduledat':moment()[_0xf3c6('0xd8')](_0x416b01[_0xf3c6('0xe4')],_0xf3c6('0xd9'))[_0xf3c6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b4558[_0xf3c6('0xda')],'ListId':_0x1b4558['ListId'],'VoiceQueueId':_0x1b4558[_0xf3c6('0xe9')]||undefined,'CampaignId':_0x1b4558[_0xf3c6('0xdb')]||undefined})[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0xea')));break;case 0x13:if(_0x1b4558['countmachineretry']>=_0x416b01[_0xf3c6('0x19a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x1b4558[_0xf3c6('0x11d')]+=0x1,'scheduledat':moment()[_0xf3c6('0xd8')](_0x416b01[_0xf3c6('0x12c')],'minutes')[_0xf3c6('0x7c')](_0xf3c6('0xc1')),'ContactId':_0x1b4558['ContactId'],'ListId':_0x1b4558[_0xf3c6('0xe8')],'VoiceQueueId':_0x1b4558['VoiceQueueId']||undefined,'CampaignId':_0x1b4558[_0xf3c6('0xdb')]||undefined})[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x127')));break;case 0x14:if(_0x1b4558[_0xf3c6('0x123')]>=_0x416b01[_0xf3c6('0x19b')]-0x1){return!![];}hopperUtils[_0xf3c6('0xe7')]({'active':![],'countagentrejectretry':_0x1b4558[_0xf3c6('0x123')]+=0x1,'scheduledat':moment()['add'](_0x416b01['dialAgentRejectRetryFrequency'],_0xf3c6('0xd9'))['format'](_0xf3c6('0xc1')),'ContactId':_0x1b4558[_0xf3c6('0xda')],'ListId':_0x1b4558[_0xf3c6('0xe8')],'VoiceQueueId':_0x1b4558[_0xf3c6('0xe9')]||undefined,'CampaignId':_0x1b4558[_0xf3c6('0xdb')]||undefined})[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x19c')));break;default:return!![];}};Dialer[_0xf3c6('0x17')][_0xf3c6('0x109')]=function(_0x34d719,_0x5281a2,_0x2cf74d){var _0x1fa79c=this;var _0x4ba7a7=new History(_0x34d719);var _0x2e6af7=![];var _0x357324;var _0x3526f1;return new Promise(function(_0x358d34,_0xb04e48){if(_[_0xf3c6('0x3e')](_0x5281a2)&&typeof _0x5281a2!==_0xf3c6('0x15e')){return _0xb04e48(msgResponse(_0xf3c6('0x19d'),_0xf3c6('0x8e'),_0xf3c6('0x19e')));}if(_[_0xf3c6('0x3e')](_0x2cf74d)&&typeof _0x2cf74d!==_0xf3c6('0x15e')){return _0xb04e48(msgResponse(_0xf3c6('0x19d'),'Failure','evt\x20is\x20undefine'));}hopperUtils[_0xf3c6('0xd4')](_0x4ba7a7,_0x2cf74d[_0xf3c6('0x19f')],_0x5281a2)[_0xf3c6('0x3d')](function(_0x18a960){if(_0x18a960[_0xf3c6('0xd7')]==0x1)_0x2e6af7=!![];switch(_0x2cf74d[_0xf3c6('0x19f')]){case'0':_0x5281a2[_0xf3c6('0x1a0')]+=0x1;_0x4ba7a7['state']=0x0;_0x4ba7a7[_0xf3c6('0xcd')]=_0xf3c6('0x1a1');_0x4ba7a7[_0xf3c6('0x122')]+=0x1;_0x4ba7a7[_0xf3c6('0xd3')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0xf3c6('0x116')](_0x34d719,_0xf3c6('0x1a2')));_0x357324=_0x5281a2[_0xf3c6('0x199')];_0x3526f1=_0x5281a2[_0xf3c6('0x1a3')];hopperUtils['createHistory'](_0x4ba7a7)['catch'](loggerCatch(_0xf3c6('0x11e')));if(_0x1fa79c[_0xf3c6('0x191')](0x0,_0x34d719,_0x5281a2)&&!_0x2e6af7){if(_0x4ba7a7['countnosuchnumberretry']>=_0x5281a2[_0xf3c6('0x198')]){_0x1fa79c['createStateFinal'](_0x4ba7a7,_0x358d34,_0xb04e48,_0xf3c6('0x1a4'));}else{_0x1fa79c[_0xf3c6('0x125')](_0x4ba7a7,_0x358d34,_0xb04e48,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5281a2[_0xf3c6('0x1a5')]+=0x1;_0x4ba7a7[_0xf3c6('0x6e')]=0x3;_0x4ba7a7[_0xf3c6('0xcd')]='NoAnswer';_0x4ba7a7[_0xf3c6('0x121')]+=0x1;_0x4ba7a7['countglobal']+=0x1;var _0x3f50ab=ut['buildNoAnswerEventPayload'](_0x34d719,_0x5281a2);ami[_0xf3c6('0x3f')](_0xf3c6('0x1a6'),_0x3f50ab);_0x357324=_0x5281a2[_0xf3c6('0x1a7')];_0x3526f1=_0x5281a2[_0xf3c6('0x1a3')];hopperUtils['createHistory'](_0x4ba7a7)[_0xf3c6('0x9c')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1fa79c[_0xf3c6('0x191')](0x3,_0x34d719,_0x5281a2)&&!_0x2e6af7){if(_0x4ba7a7['countnoanswerretry']>=_0x5281a2['dialNoAnswerMaxRetry']){_0x1fa79c[_0xf3c6('0x12b')](_0x4ba7a7,_0x358d34,_0xb04e48,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1fa79c[_0xf3c6('0x125')](_0x4ba7a7,_0x358d34,_0xb04e48,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5281a2['outboundBusyCallsDay']+=0x1;_0x4ba7a7[_0xf3c6('0x6e')]=0x5;_0x4ba7a7['statedesc']='Busy';_0x4ba7a7[_0xf3c6('0x11f')]+=0x1;_0x4ba7a7['countglobal']+=0x1;ami[_0xf3c6('0x3f')](_0xf3c6('0x1a8'),ut[_0xf3c6('0x116')](_0x34d719,_0xf3c6('0x1a9')));_0x357324=_0x5281a2[_0xf3c6('0x194')];_0x3526f1=_0x5281a2[_0xf3c6('0x1a3')];hopperUtils[_0xf3c6('0xc7')](_0x4ba7a7)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x1fa79c[_0xf3c6('0x191')](0x5,_0x34d719,_0x5281a2)&&!_0x2e6af7){if(_0x4ba7a7['countbusyretry']>=_0x5281a2[_0xf3c6('0x193')]){_0x1fa79c['createStateFinal'](_0x4ba7a7,_0x358d34,_0xb04e48,_0xf3c6('0x1aa'));}else{_0x1fa79c[_0xf3c6('0x125')](_0x4ba7a7,_0x358d34,_0xb04e48,_0xf3c6('0x1aa'));}}break;case'8':_0x5281a2[_0xf3c6('0x1ab')]+=0x1;_0x4ba7a7[_0xf3c6('0x6e')]=0x8;_0x4ba7a7['statedesc']=_0xf3c6('0x1ac');_0x4ba7a7[_0xf3c6('0x120')]+=0x1;_0x4ba7a7['countglobal']+=0x1;_0x357324=_0x5281a2['dialCongestionRetryFrequency'];_0x3526f1=_0x5281a2[_0xf3c6('0x1a3')];ami[_0xf3c6('0x3f')](_0xf3c6('0x1ad'),ut[_0xf3c6('0x116')](_0x34d719,_0xf3c6('0x1ae')));hopperUtils[_0xf3c6('0xc7')](_0x4ba7a7)[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x1af')));if(_0x1fa79c[_0xf3c6('0x191')](0x8,_0x34d719,_0x5281a2)&&!_0x2e6af7){if(_0x4ba7a7[_0xf3c6('0x120')]>=_0x5281a2[_0xf3c6('0x196')]){_0x1fa79c[_0xf3c6('0x12b')](_0x4ba7a7,_0x358d34,_0xb04e48,_0xf3c6('0x1b0'));}else{_0x1fa79c[_0xf3c6('0x125')](_0x4ba7a7,_0x358d34,_0xb04e48,_0xf3c6('0x1b0'));}}break;case'11':_0x5281a2[_0xf3c6('0x1b1')]+=0x1;_0x4ba7a7[_0xf3c6('0x6e')]=0xb;_0x4ba7a7['statedesc']=_0xf3c6('0xe2');_0x4ba7a7[_0xf3c6('0xe3')]+=0x1;_0x4ba7a7[_0xf3c6('0xd3')]+=0x1;_0x357324=_0x5281a2[_0xf3c6('0xe4')];_0x3526f1=_0x5281a2[_0xf3c6('0x1a3')];hopperUtils[_0xf3c6('0xc7')](_0x4ba7a7)[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0xec')));if(_0x1fa79c[_0xf3c6('0x191')](0xb,_0x34d719,_0x5281a2)&&!_0x2e6af7){if(_0x4ba7a7[_0xf3c6('0xe3')]>=_0x5281a2[_0xf3c6('0xe6')]){_0x1fa79c['createStateFinal'](_0x4ba7a7,_0x358d34,_0xb04e48,_0xf3c6('0x1b2'));}else{_0x1fa79c[_0xf3c6('0x125')](_0x4ba7a7,_0x358d34,_0xb04e48,_0xf3c6('0x1b2'));}}break;case'20':_0x5281a2[_0xf3c6('0x1b3')]+=0x1;_0x4ba7a7[_0xf3c6('0x6e')]=0x14;_0x4ba7a7[_0xf3c6('0xcd')]=_0xf3c6('0x1b4');_0x4ba7a7[_0xf3c6('0x123')]+=0x1;_0x4ba7a7['countglobal']+=0x1;_0x357324=_0x5281a2[_0xf3c6('0x1b5')];_0x3526f1=_0x5281a2[_0xf3c6('0x1a3')];ami[_0xf3c6('0x3f')](_0xf3c6('0x1b6'),ut[_0xf3c6('0x116')](_0x34d719,_0xf3c6('0x1b7')));hopperUtils['createHistory'](_0x4ba7a7)[_0xf3c6('0x9c')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1fa79c[_0xf3c6('0x191')](0x14,_0x34d719,_0x5281a2)&&!_0x2e6af7){if(_0x4ba7a7['countagentrejectretry']>=_0x5281a2[_0xf3c6('0x19b')]){_0x1fa79c[_0xf3c6('0x12b')](_0x4ba7a7,_0x358d34,_0xb04e48,_0xf3c6('0x1b8'));}else{_0x1fa79c[_0xf3c6('0x125')](_0x4ba7a7,_0x358d34,_0xb04e48,_0xf3c6('0x1b8'));}}break;default:_0x5281a2['outboundUnknownCallsDay']+=0x1;_0x4ba7a7[_0xf3c6('0x6e')]=0xc;_0x4ba7a7['statedesc']=_0x2cf74d['reason'];_0x357324=_0x5281a2[_0xf3c6('0x1b5')];_0x3526f1=_0x5281a2[_0xf3c6('0x1a3')];hopperUtils[_0xf3c6('0xc7')](_0x4ba7a7)[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x1b9')));if(_0x1fa79c[_0xf3c6('0x191')](_0x2cf74d['reason'],_0x34d719,_0x5281a2)&&!_0x2e6af7){if(_0x4ba7a7['countbusyretry']+_0x4ba7a7['countcongestionretry']+_0x4ba7a7[_0xf3c6('0x121')]+_0x4ba7a7[_0xf3c6('0x122')]+_0x4ba7a7[_0xf3c6('0xd2')]+_0x4ba7a7[_0xf3c6('0xe3')]+_0x4ba7a7['countmachineretry']+_0x4ba7a7[_0xf3c6('0x123')]>=_0x5281a2[_0xf3c6('0x124')]){_0x1fa79c[_0xf3c6('0x125')](_0x4ba7a7,_0x358d34,_0xb04e48,_0x2cf74d[_0xf3c6('0x19f')]);}else{_0x1fa79c['createStateFinal'](_0x4ba7a7,_0x358d34,_0xb04e48,_0x2cf74d[_0xf3c6('0x19f')]);}}}})[_0xf3c6('0x3d')](function(){if(_0x2e6af7){hopperUtils[_0xf3c6('0xed')](_0x4ba7a7,_0x357324,_0x3526f1)[_0xf3c6('0x3d')](function(){return _0x358d34(0x1);});}});});};Dialer['prototype'][_0xf3c6('0x125')]=function(_0x14c034,_0x1ae79c,_0x448948,_0x22c1ef){var _0x4e95de=new Final(_0x14c034);_0x4e95de[_0xf3c6('0x6e')]=0xf;_0x4e95de[_0xf3c6('0xcd')]='Global';this[_0xf3c6('0x12b')](_0x4e95de,_0x1ae79c,_0x448948,_0x22c1ef);};Dialer[_0xf3c6('0x17')][_0xf3c6('0x12b')]=function(_0x598f34,_0x4f0eda,_0x51d2d6,_0x531745){hopperUtils[_0xf3c6('0x12f')](_0x598f34)[_0xf3c6('0x3d')](function(){return _0x4f0eda(msgResponse(_0xf3c6('0x19d'),'Success',_0x531745));})['catch'](function(){return _0x51d2d6(msgResponse('[moveContactManagedDialer][0]','Failure',_0xf3c6('0x1ba')));});};Dialer[_0xf3c6('0x17')][_0xf3c6('0xa')]=function(_0x3e7545){var _0x478324=_0x3e7545[_0xf3c6('0x1bb')]/0x64;var _0x52315c=_0x3e7545[_0xf3c6('0xcb')]/(_0x3e7545[_0xf3c6('0xcb')]+_0x3e7545['outboundAnswerCallsDay']);var _0x59b08a=Math[_0xf3c6('0x1bc')](_0x3e7545[_0xf3c6('0x1bd')]*(_0x3e7545['predictiveIntervalMaxThreshold']/0x64));var _0x363385=Math[_0xf3c6('0x1bc')](_0x3e7545['predictiveIntervalAvailable']*(_0x3e7545[_0xf3c6('0x1be')]/0x64));var _0x5372e8=_0x3e7545[_0xf3c6('0x1bf')]+_0x3e7545[_0xf3c6('0x138')];var _0x2caff9=Math['floor'](_0x3e7545[_0xf3c6('0x1c0')]*_0x3e7545[_0xf3c6('0x5d')]*_0x3e7545[_0xf3c6('0x1c1')]*_0x3e7545[_0xf3c6('0x1c2')]);if(_[_0xf3c6('0x3e')](_0x3e7545[_0xf3c6('0x27')])){if(!_[_0xf3c6('0x3e')](_0x3e7545[_0xf3c6('0x26')])){_0x3e7545[_0xf3c6('0x26')]=undefined;loggerPredictive['error'](_0xf3c6('0x1c3'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xf3c6('0x3e')](_0x3e7545[_0xf3c6('0x62')])){loggerPredictive[_0xf3c6('0x64')](_0xf3c6('0x1c3'),_0xf3c6('0x1c4'));clearInterval(_0x3e7545[_0xf3c6('0x62')]);_0x3e7545[_0xf3c6('0x62')]=undefined;}_0x3e7545[_0xf3c6('0x27')]=moment()[_0xf3c6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf3c6('0x46')](_0x3e7545[_0xf3c6('0x5f')],_0xf3c6('0x1c5'),_0x3e7545[_0xf3c6('0x27')]);this[_0xf3c6('0xb1')](_0x3e7545,0x1);}else if(ifInterval(_0x3e7545[_0xf3c6('0x1c6')],_0x3e7545[_0xf3c6('0x27')])){this[_0xf3c6('0xb1')](_0x3e7545,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x3e7545[_0xf3c6('0x27')],_0x3e7545[_0xf3c6('0x5f')]);_0x3e7545['erlangCalls']=0x0;_0x3e7545[_0xf3c6('0xcc')]=0x0;}else if(_0x478324<_0x52315c&&_0x3e7545[_0xf3c6('0x1c7')]===_0xf3c6('0x1c8')){clearPredictiveAttributes(_0x3e7545);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x1c9'),_0xf3c6('0x1ca'),_0x52315c,_0xf3c6('0x27'),_0x3e7545[_0xf3c6('0x5f')]);}else if(_0x2caff9<_0x3e7545[_0xf3c6('0xcc')]&&_0x3e7545[_0xf3c6('0x1c7')]===_0xf3c6('0x1c8')){clearPredictiveAttributes(_0x3e7545);loggerPredictive[_0xf3c6('0x46')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xf3c6('0x1cb'),_0x2caff9,_0xf3c6('0x1cc'),_0x3e7545[_0xf3c6('0xcc')],'startProgressive',_0x3e7545[_0xf3c6('0x5f')]);}else if(!ifInterval(_0x3e7545['dialPredictiveInterval'],_0x3e7545[_0xf3c6('0x27')])&&_['isUndefined'](_0x3e7545[_0xf3c6('0x26')])&&!_[_0xf3c6('0x3e')](_0x3e7545[_0xf3c6('0x27')])){_0x3e7545[_0xf3c6('0x26')]=moment()[_0xf3c6('0x7c')](_0xf3c6('0xc1'));loggerPredictive['info'](_0x3e7545['name'],'started\x20in\x20predictive\x20at',_0x3e7545[_0xf3c6('0x26')]);hopperUtils[_0xf3c6('0x1cd')](_0x3e7545['dialPredictiveInterval'])[_0xf3c6('0x3d')](this['getDataPredictive'](_0x3e7545))['then'](mergeDataErlangB(_0x3e7545))[_0xf3c6('0x3d')](this[_0xf3c6('0x1ce')](_0x3e7545))['catch'](loggerCatchPredictive(_0xf3c6('0x1cf'),_0x3e7545));}else if(!ifInterval(_0x3e7545[_0xf3c6('0x1c6')],_0x3e7545[_0xf3c6('0x26')])){_0x3e7545[_0xf3c6('0xcc')]=0x0;_0x3e7545['startPredictive']=moment()[_0xf3c6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x3e7545[_0xf3c6('0x5f')],_0xf3c6('0x1d0'),_0x3e7545[_0xf3c6('0x26')]);clearInterval(_0x3e7545[_0xf3c6('0x62')]);_0x3e7545['handlePredictive']=undefined;hopperUtils[_0xf3c6('0x1cd')](_0x3e7545[_0xf3c6('0x1c6')])[_0xf3c6('0x3d')](this['getDataPredictive'](_0x3e7545))[_0xf3c6('0x3d')](mergeDataErlangB(_0x3e7545))['then'](this['startMethodPredictive'](_0x3e7545))['catch'](loggerCatchPredictive(_0xf3c6('0x1d1'),_0x3e7545));}else if(_0x3e7545[_0xf3c6('0x1bd')]&&_0x5372e8<_0x3e7545[_0xf3c6('0x1bd')]-_0x363385){clearPredictiveAttributes(_0x3e7545);loggerPredictive[_0xf3c6('0x46')](_0x3e7545['name'],_0xf3c6('0x1d2'),_0x5372e8,_0xf3c6('0x1d3'),_0x3e7545[_0xf3c6('0x1bd')],'-',_0x363385,'=',_0x3e7545[_0xf3c6('0x1bd')]-_0x363385,')');}else if(_0x3e7545[_0xf3c6('0x1bd')]&&_0x5372e8>_0x3e7545[_0xf3c6('0x1bd')]+_0x59b08a){clearPredictiveAttributes(_0x3e7545);loggerPredictive[_0xf3c6('0x46')](_0x3e7545['name'],_0xf3c6('0x1d2'),_0x5372e8,_0xf3c6('0x1d4'),_0x3e7545[_0xf3c6('0x1bd')],'+',_0x59b08a,'=',_0x3e7545[_0xf3c6('0x1bd')]+_0x59b08a,')');}};Dialer[_0xf3c6('0x17')][_0xf3c6('0x1d5')]=function(_0x58aaaf){var _0x51d147=this;return function(_0x2a6c9f){return new Promise(function(_0x529229,_0x1e2f5c){_['merge'](_0x58aaaf,_0x2a6c9f[0x0]);if(checkGetDataPredictive(_0x2a6c9f[0x0])){var _0xb0e43a=_0x58aaaf[_0xf3c6('0x1bd')]=_0x58aaaf[_0xf3c6('0x138')]+_0x58aaaf[_0xf3c6('0x1bf')];var _0x29ec48=_0x58aaaf[_0xf3c6('0x1c6')]*0x3c;var _0x5d65f3=_0x2a6c9f[0x0][_0xf3c6('0x52')]+_0x2a6c9f[0x0][_0xf3c6('0x50')];var _0x283f8d=(_0x2a6c9f[0x0][_0xf3c6('0x4a')]+_0x2a6c9f[0x0][_0xf3c6('0x4c')]+_0x2a6c9f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2a6c9f[0x0]['predictiveIntervalTotalCalls'];_0x58aaaf['predictiveIntervalHitRate']=_0x283f8d>0x0?_0x283f8d:0x1;switch(_0x58aaaf[_0xf3c6('0x1c7')]){case _0xf3c6('0x1c8'):var _0x289423=_0x58aaaf[_0xf3c6('0x1bb')]/0x64;return _0x51d147['abandonmentRate'](_0xb0e43a,_0x29ec48,_0x5d65f3,_0x283f8d,_0x289423)[_0xf3c6('0x3d')](function(_0x505c77){return _0x529229(_0x505c77);});case _0xf3c6('0x1d6'):var _0x232a85=_0x58aaaf[_0xf3c6('0x1bb')]/0x64;return _0x51d147['busyFactor'](_0xb0e43a,_0x29ec48,_0x5d65f3,_0x283f8d,_0x232a85)['then'](function(_0x35301f){return _0x529229(_0x35301f);});default:return _0x1e2f5c(msgResponse(_0xf3c6('0x1d7'),_0xf3c6('0x8e'),_0xf3c6('0x1d8')));}}else{return _0x1e2f5c(msgResponse('[getDataPredictive]','Failure',_0xf3c6('0x1d9')));}});};};Dialer[_0xf3c6('0x17')][_0xf3c6('0x1da')]=function(_0xf90094){var _0x39ed24=this;return function(_0x435b65){return new Promise(function(_0xf8a5fb,_0xdbfa81){_[_0xf3c6('0xf7')](_0xf90094,_0x435b65[0x0]);if(checkGetDataPredictive(_0x435b65[0x0])){loggerPredictive[_0xf3c6('0x46')](JSON['stringify'](_0x435b65[0x0]));if(_0xf90094[_0xf3c6('0x1c7')]==='dropRate'){return _0x39ed24[_0xf3c6('0x151')](_0xf90094['id'])[_0xf3c6('0x3d')](function(_0x48d968){var _0xbbe9fd=_0xf90094['loggedIn']-_0x48d968[0x0][_0xf3c6('0x1db')];var _0x14f2bd=_0xf90094[_0xf3c6('0x1c6')]*0x3c;var _0x29a7e8=_0x435b65[0x0][_0xf3c6('0x52')]+_0x435b65[0x0][_0xf3c6('0x50')];var _0x4eb64a=(_0x435b65[0x0]['predictiveIntervalAnsweredCalls']+_0x435b65[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x435b65[0x0][_0xf3c6('0x4e')])/_0x435b65[0x0][_0xf3c6('0x54')];var _0x4e7d87=_0xf90094[_0xf3c6('0x1bb')]/0x64;_0xf90094[_0xf3c6('0x1dc')]=_0x48d968[0x0]['outboundQueuePauses']||0x0;_0xf90094['predictiveIntervalHitRate']=_0x4eb64a>0x0?_0x4eb64a:0x1;return _0x39ed24[_0xf3c6('0x1dd')](_0xbbe9fd,_0x14f2bd,_0x29a7e8,_0x4eb64a,_0x4e7d87);})[_0xf3c6('0x3d')](function(_0x21376b){return _0xf8a5fb(_0x21376b);})['catch'](function(_0x552d47){return _0xdbfa81(msgResponse('[CatchErlangB]',_0xf3c6('0x8e'),JSON[_0xf3c6('0x72')](_0x552d47)));});}if(_0xf90094[_0xf3c6('0x1c7')]===_0xf3c6('0x1d6')){return _0x39ed24[_0xf3c6('0x151')](_0xf90094['id'])[_0xf3c6('0x3d')](function(_0x4d4fd2){var _0x28f0a8=_0xf90094[_0xf3c6('0x1de')]-_0x4d4fd2[0x0][_0xf3c6('0x1db')];var _0x438ea4=_0xf90094['dialPredictiveInterval']*0x3c;var _0x263a41=_0x435b65[0x0][_0xf3c6('0x52')]+_0x435b65[0x0][_0xf3c6('0x50')];var _0x296c3a=(_0x435b65[0x0][_0xf3c6('0x4a')]+_0x435b65[0x0][_0xf3c6('0x4c')]+_0x435b65[0x0][_0xf3c6('0x4e')])/_0x435b65[0x0][_0xf3c6('0x54')];var _0x463016=_0xf90094[_0xf3c6('0x1bb')]/0x64;_0xf90094['predictiveIntervalPauses']=_0x4d4fd2[0x0][_0xf3c6('0x1db')]||0x0;_0xf90094[_0xf3c6('0x1c1')]=_0x296c3a>0x0?_0x296c3a:0x1;return _0x39ed24[_0xf3c6('0x1df')](_0x28f0a8,_0x438ea4,_0x263a41,_0x296c3a,_0x463016);})['then'](function(_0x1e786f){return _0xf8a5fb(_0x1e786f);})[_0xf3c6('0x9c')](function(_0x403871){return _0xdbfa81(msgResponse(_0xf3c6('0x1e0'),'Failure',JSON[_0xf3c6('0x72')](_0x403871)));});}}else{return _0xdbfa81(msgResponse(_0xf3c6('0x1d7'),_0xf3c6('0x8e'),_0xf3c6('0x1d9')));}});};};Dialer[_0xf3c6('0x17')][_0xf3c6('0x1ce')]=function(_0x1783cd){var _0x4abc36=this;return function(){var _0x4f4812=0x0;var _0x20c0bd=Math[_0xf3c6('0x1e1')](_0x1783cd[_0xf3c6('0x5b')]*0x3e8);if(_0x20c0bd>0x0){_0x20c0bd=_0x20c0bd<0x64?0x64:_0x20c0bd;loggerPredictive[_0xf3c6('0x46')](_0x1783cd['name'],_0xf3c6('0x1e2'),_0x20c0bd,_0xf3c6('0x1e3'));_0x1783cd['handlePredictive']=setInterval(function(){_0x4abc36[_0xf3c6('0x62')](_0x1783cd);loggerPredictiveCalls[_0xf3c6('0x46')]('[handlePredictive]',_0x4f4812+=0x1);},_0x20c0bd);}else{loggerPredictive['info'](_0x1783cd[_0xf3c6('0x5f')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xf3c6('0x17')]['checkContactBlack']=function(_0x459f5e,_0x2ece2b){var _0xf02a87=this;return function(_0x16e2c7){if(_[_0xf3c6('0x78')](_0x16e2c7)){if(_[_0xf3c6('0xf6')](_0x2ece2b['UserId'])||!_0x2ece2b[_0xf3c6('0x1e4')]){if(_0x459f5e['dialMethod']===_0xf3c6('0x1e5')){_0x459f5e['queueStatusComplete']=_[_0xf3c6('0x3e')](_0x459f5e[_0xf3c6('0x6f')])?!![]:_0x459f5e['queueStatusComplete'];var _0x5172e6=uuid['v4']();_0xf02a87[_0xf3c6('0x23')][_0x5172e6]=new Action(_0x459f5e,_0x2ece2b,_0x5172e6);loggerBooked[_0xf3c6('0x46')](_0xf3c6('0x1e6'),_0x5172e6,'queueStatusComplete:\x20',JSON[_0xf3c6('0x72')](_0x459f5e[_0xf3c6('0x6f')]),'Queue:\x20',_0x459f5e[_0xf3c6('0x5f')]);if(_0x459f5e[_0xf3c6('0x6f')]){_0x459f5e[_0xf3c6('0x6f')]=![];_0xf02a87['queueBooked'][_0xf02a87['actions'][_0x5172e6][_0xf3c6('0xbd')]]=[];ami[_0xf3c6('0x95')]({'actionid':_0x5172e6,'action':_0xf3c6('0x1e7'),'queue':_0x459f5e[_0xf3c6('0x5f')]})['catch'](function(){_0xf02a87[_0xf3c6('0xbf')](_0x459f5e);hopperUtils[_0xf3c6('0xe7')]({'active':![],'ContactId':_0xf02a87[_0xf3c6('0x23')][_0x5172e6][_0xf3c6('0xda')],'ListId':_0xf02a87[_0xf3c6('0x23')][_0x5172e6][_0xf3c6('0xe8')],'VoiceQueueId':_0xf02a87[_0xf3c6('0x23')][_0x5172e6][_0xf3c6('0xe9')]||undefined,'CampaignId':_0xf02a87[_0xf3c6('0x23')][_0x5172e6][_0xf3c6('0xdb')]||undefined})[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x1e8')));delete _0xf02a87[_0xf3c6('0x23')][_0x5172e6];});}else{loggerBooked[_0xf3c6('0x46')](_0xf3c6('0x1e9'),JSON[_0xf3c6('0x72')](_0x459f5e[_0xf3c6('0x6f')]),_0xf3c6('0x1ea'),_0x459f5e['name']);_0xf02a87['updateOriginated'](_0x459f5e);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0xf02a87[_0xf3c6('0x23')][_0x5172e6][_0xf3c6('0xda')],'ListId':_0xf02a87[_0xf3c6('0x23')][_0x5172e6][_0xf3c6('0xe8')],'VoiceQueueId':_0xf02a87[_0xf3c6('0x23')][_0x5172e6][_0xf3c6('0xe9')]||undefined,'CampaignId':_0xf02a87[_0xf3c6('0x23')][_0x5172e6]['CampaignId']||undefined})['catch'](loggerCatch(_0xf3c6('0x1e8')));delete _0xf02a87[_0xf3c6('0x23')][_0x5172e6];}}else{return _0xf02a87[_0xf3c6('0x15d')](_0x459f5e,_0x2ece2b);}}else{if(utils[_0xf3c6('0x5e')](undefined,_0x2ece2b['scheduledat'])<_0x459f5e[_0xf3c6('0x1eb')]*0x3c){if(_0x2ece2b['Agent']&&!_0x2ece2b[_0xf3c6('0x147')][_0xf3c6('0x1ec')]){_0xf02a87[_0xf3c6('0x1c')][_0xf3c6('0xf9')](_0x2ece2b['id'])[_0xf3c6('0x1a')](function(){_0xf02a87[_0xf3c6('0xbf')](_0x459f5e);});}else{hopperUtils[_0xf3c6('0x1ed')]({'active':![]},_0x2ece2b['id'],0x1)[_0xf3c6('0x1a')](function(){_0xf02a87['updateOriginated'](_0x459f5e);});}}else{_0x459f5e[_0xf3c6('0x1ee')]+=0x1;_0xf02a87[_0xf3c6('0xbf')](_0x459f5e);if(_0x459f5e['dialRecallInQueue']){hopperUtils[_0xf3c6('0xe7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2ece2b[_0xf3c6('0xda')],'ListId':_0x2ece2b[_0xf3c6('0xe8')],'VoiceQueueId':_0x2ece2b['VoiceQueueId']||undefined,'CampaignId':_0x2ece2b[_0xf3c6('0xdb')]||undefined})[_0xf3c6('0x9c')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xf3c6('0xc7')](createObjHistory(_0x459f5e,_0x2ece2b,utils[_0xf3c6('0x69')][_0xf3c6('0x1ef')],0x17,_0xf3c6('0x1f0')))[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x1f1')));}else{_0xf02a87['saveInDb'](createObjHistory(_0x459f5e,_0x2ece2b,utils[_0xf3c6('0x69')][_0xf3c6('0x1f2')],0x16,_0xf3c6('0x1f3')),_0xf3c6('0x1f4'),_0xf3c6('0x1f5'));}}}}else{_0x459f5e[_0xf3c6('0x1f6')]+=0x1;_0xf02a87[_0xf3c6('0x128')](createObjHistory(_0x459f5e,_0x2ece2b,utils[_0xf3c6('0x69')][_0xf3c6('0x1f7')],0xd,_0xf3c6('0x1f8')),_0xf3c6('0x1f9'),_0xf3c6('0x1fa'));throw _0xf3c6('0x1fb');}};};Dialer[_0xf3c6('0x17')][_0xf3c6('0x15c')]=function(_0x5de083){var _0x9882ee=this;var _0x2351f6=_0x5de083['limitCalls']-_0x5de083['originated']-_0x5de083['temp'];emitCampaignSummary(_0x5de083);if(_0x2351f6>0x0){if(_0x2351f6>this[_0xf3c6('0x21')]){_0x2351f6=this[_0xf3c6('0x21')];}_0x5de083['temp']+=_0x2351f6;hopperUtils[_0xf3c6('0x1fc')](_0x5de083,_0x2351f6)['then'](function(_0x4e0c0c){_0x5de083[_0xf3c6('0x1fd')]-=_0x2351f6;_0x5de083['temp']=_0x5de083[_0xf3c6('0x1fd')]>0x0?_0x5de083[_0xf3c6('0x1fd')]:0x0;if(!utils[_0xf3c6('0x1fe')](_0x4e0c0c)){_0x5de083[_0xf3c6('0x68')]=utils[_0xf3c6('0x69')][_0xf3c6('0x6c')];logger[_0xf3c6('0x46')](_0xf3c6('0x1ff')+_0x5de083[_0xf3c6('0x5f')]);}else{_0x5de083['originated']+=_0x4e0c0c['length'];_0x5de083[_0xf3c6('0x68')]=utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x57155a=0x0;_0x57155a<_0x4e0c0c[_0xf3c6('0x93')];_0x57155a+=0x1){_0x5de083[_0xf3c6('0x200')]+=0x1;if(_[_0xf3c6('0xf6')](_0x4e0c0c[_0x57155a])||_['isNil'](_0x4e0c0c[_0x57155a][_0xf3c6('0x175')])||_[_0xf3c6('0xf6')](_0x4e0c0c[_0x57155a][_0xf3c6('0x160')])){_0x9882ee[_0xf3c6('0x156')](_0xf3c6('0x201'),_0x5de083,_0x4e0c0c[_0x57155a]);}else{hopperUtils[_0xf3c6('0x202')](_[_0xf3c6('0x73')](_0x4e0c0c[_0x57155a],['CampaignId',_0xf3c6('0x160')]))[_0xf3c6('0x3d')](_0x9882ee[_0xf3c6('0x203')](_0x5de083,_0x4e0c0c[_0x57155a]))[_0xf3c6('0x9c')](_0x9882ee['loggerHandler'](_0xf3c6('0x204'),_0x5de083));}}}})[_0xf3c6('0x9c')](loggerGetContactDialer(_0xf3c6('0x205'),_0x5de083,_0x2351f6));}};Dialer[_0xf3c6('0x17')][_0xf3c6('0xb1')]=function(_0x3b235a,_0x56c5fe){var _0x21c816=this;var _0x3ef4c0=[];if(_0x56c5fe<0x1||_0x3b235a[_0xf3c6('0xaf')]===_0xf3c6('0x1e5')){_0x56c5fe=0x1;}var _0x4bcd99=Math[_0xf3c6('0x1e1')](_0x3b235a['available']*_0x56c5fe)-_0x3b235a['originated']-_0x3b235a[_0xf3c6('0x1fd')];if(_0x3b235a['dialLimitQueue']>0x0){var _0x5dd4fe=_0x3b235a['dialLimitQueue']-_0x3b235a[_0xf3c6('0x152')]-_0x3b235a[_0xf3c6('0x138')]-_0x3b235a[_0xf3c6('0x1fd')]-_0x3b235a['pTalking'];if(_0x4bcd99>_0x5dd4fe){_0x4bcd99=_0x5dd4fe;}}if(_0x4bcd99>0x0){if(_0x3b235a[_0xf3c6('0xaf')]===_0xf3c6('0x1e5')){_0x4bcd99=0x1;}if(_0x4bcd99>this[_0xf3c6('0x21')]){_0x4bcd99=this[_0xf3c6('0x21')];}_0x3b235a[_0xf3c6('0x1fd')]+=_0x4bcd99;for(var _0x359d08 in this[_0xf3c6('0x1f')]){if(typeof this[_0xf3c6('0x1f')][_0x359d08]!==_0xf3c6('0xa7')){if(this[_0xf3c6('0x1f')][_0x359d08]['state']===_0xf3c6('0x206')&&this[_0xf3c6('0x1f')][_0x359d08]['status']===_0xf3c6('0x144')){_0x3ef4c0[_0xf3c6('0x94')](this['agents'][_0x359d08]['id']);}}}hopperUtils[_0xf3c6('0x207')](_0x3b235a,_0x3ef4c0,_0x4bcd99)[_0xf3c6('0x3d')](function(_0x2ac55e){_0x3b235a[_0xf3c6('0x1fd')]-=_0x4bcd99;_0x3b235a[_0xf3c6('0x1fd')]=_0x3b235a[_0xf3c6('0x1fd')]>0x0?_0x3b235a[_0xf3c6('0x1fd')]:0x0;if(!utils[_0xf3c6('0x1fe')](_0x2ac55e)){hopperUtils['countReScheduled'](_0x3b235a)['then'](sendMessageReschedule(_0x3b235a))[_0xf3c6('0x9c')](loggerCatch('[countReScheduled]\x20'));}else{_0x3b235a[_0xf3c6('0x152')]+=_0x2ac55e[_0xf3c6('0x93')];_0x3b235a[_0xf3c6('0x68')]=_0x3b235a[_0xf3c6('0xaf')]==='booked'?utils[_0xf3c6('0x69')][_0xf3c6('0x139')]:utils[_0xf3c6('0x69')][_0xf3c6('0x208')];for(var _0x48525=0x0;_0x48525<_0x2ac55e[_0xf3c6('0x93')];_0x48525+=0x1){if(_[_0xf3c6('0xf6')](_0x2ac55e[_0x48525])||_[_0xf3c6('0xf6')](_0x2ac55e[_0x48525][_0xf3c6('0x175')])||_[_0xf3c6('0xf6')](_0x2ac55e[_0x48525][_0xf3c6('0x160')])){_0x21c816[_0xf3c6('0x156')](_0xf3c6('0x201'),_0x3b235a,_0x2ac55e[_0x48525]);}else{hopperUtils[_0xf3c6('0x209')](_['pick'](_0x2ac55e[_0x48525],[_0xf3c6('0xe9'),_0xf3c6('0x160')]))[_0xf3c6('0x3d')](_0x21c816[_0xf3c6('0x203')](_0x3b235a,_0x2ac55e[_0x48525]))[_0xf3c6('0x9c')](_0x21c816[_0xf3c6('0x155')](_0xf3c6('0x201'),_0x3b235a));}}}})[_0xf3c6('0x9c')](loggerGetContactDialer(_0xf3c6('0x20a'),_0x3b235a,_0x4bcd99));}};Dialer['prototype'][_0xf3c6('0x62')]=function(_0x54f1b2){if(_0x54f1b2[_0xf3c6('0x20b')]>0x0){var _0x38da2c=_0x54f1b2['dialLimitQueue']-_0x54f1b2[_0xf3c6('0x152')]-_0x54f1b2[_0xf3c6('0x138')];if(_0x38da2c>0x0){this[_0xf3c6('0x20c')](_0x54f1b2);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0xf3c6('0x20c')](_0x54f1b2);}};Dialer[_0xf3c6('0x17')][_0xf3c6('0x20c')]=function(_0x3f6064){var _0x856cdb=this;var _0x5b1eac=[];_0x3f6064[_0xf3c6('0x152')]+=0x1;for(var _0x1e4136 in this['agents']){if(typeof this[_0xf3c6('0x1f')][_0x1e4136]!==_0xf3c6('0xa7')){if(this[_0xf3c6('0x1f')][_0x1e4136][_0xf3c6('0x6e')]==='not_inuse'&&this['agents'][_0x1e4136]['status']===_0xf3c6('0x144')){_0x5b1eac['push'](this[_0xf3c6('0x1f')][_0x1e4136]['id']);}}}return this[_0xf3c6('0x207')](_0x3f6064['id'],_0x5b1eac,0x1,_0x3f6064[_0xf3c6('0x20d')],_0x3f6064)[_0xf3c6('0x3d')](function(_0x321ca5){if(!utils['checkContactEmpty'](_0x321ca5)){utils[_0xf3c6('0x66')](_0x3f6064,0x1,0x0);return hopperUtils[_0xf3c6('0x20e')](_0x3f6064)[_0xf3c6('0x3d')](sendMessageReschedule(_0x3f6064))[_0xf3c6('0x9c')](loggerCatch(_0xf3c6('0x20f')));}else{_0x3f6064[_0xf3c6('0x68')]=utils[_0xf3c6('0x69')][_0xf3c6('0x208')];if(_[_0xf3c6('0xf6')](_0x321ca5[0x0])||_[_0xf3c6('0xf6')](_0x321ca5[0x0][_0xf3c6('0x175')])||_[_0xf3c6('0xf6')](_0x321ca5[0x0][_0xf3c6('0x160')])){_0x856cdb[_0xf3c6('0x156')](_0xf3c6('0x201'),_0x3f6064,_0x321ca5[0x0]);}else{return hopperUtils[_0xf3c6('0x209')](_[_0xf3c6('0x73')](_0x321ca5[0x0],['VoiceQueueId','phone']))[_0xf3c6('0x3d')](_0x856cdb[_0xf3c6('0x203')](_0x3f6064,_0x321ca5[0x0]))[_0xf3c6('0x9c')](_0x856cdb['loggerHandler']('[actionOriginatePredictive]\x20',_0x3f6064));}}})[_0xf3c6('0x9c')](loggerGetContactDialer(_0xf3c6('0x210'),_0x3f6064,0x1));};Dialer[_0xf3c6('0x17')]['abandonmentRate']=function(_0x4eecf6,_0x3e3aef,_0xf2a0c2,_0x40d2a4,_0x5df9e2,_0x2c41c7){loggerPredictive[_0xf3c6('0x46')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xf3c6('0x46')]('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',_0x4eecf6);loggerPredictive['info'](_0xf3c6('0x211'),_0x3e3aef);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x212'),_0xf2a0c2);loggerPredictive[_0xf3c6('0x46')]('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',_0x40d2a4);loggerPredictive['info'](_0xf3c6('0x213'),_0x5df9e2);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x53'));return new Promise(function(_0x585e37,_0x538263){if(_0x4eecf6<=0x0||isNaN(_0x4eecf6)){return _0x538263(msgResponse(_0xf3c6('0x214'),_0xf3c6('0xbc'),'m\x20=\x20'+_0x4eecf6));}if(_0xf2a0c2<=0x0||isNaN(_0xf2a0c2)){return _0x538263(msgResponse(_0xf3c6('0x214'),_0xf3c6('0xbc'),_0xf3c6('0x215')+_0xf2a0c2));}if(_0x40d2a4<=0x0||isNaN(_0x40d2a4)){return _0x538263(msgResponse('[abandonmentRate]',_0xf3c6('0xbc'),_0xf3c6('0x216')+_0x40d2a4));}if(_0x3e3aef<=0x0||isNaN(_0x3e3aef)){return _0x538263(msgResponse('[abandonmentRate]',_0xf3c6('0xbc'),_0xf3c6('0x217')+_0x3e3aef));}if(_0x5df9e2<=0x0||isNaN(_0x5df9e2)){return _0x538263(msgResponse(_0xf3c6('0x214'),_0xf3c6('0xbc'),_0xf3c6('0x218')+_0x5df9e2));}_0x2c41c7=_0x2c41c7||0x0;var _0x2648ec=0x1/_0xf2a0c2;var _0x49db24=0x0;var _0x585520=0x0;var _0x565ab8=0x0;var _0x282371=0x0;for(var _0xcd41c8=0x0;_0x565ab8<_0x5df9e2;_0xcd41c8+=0x1){_0x585520=_0xcd41c8/_0x3e3aef;_0x49db24=(_0x40d2a4*_0x585520+_0x2c41c7)/_0x2648ec;_0x565ab8=utils[_0xf3c6('0x219')](_0x49db24,_0x4eecf6);_0x282371=_0x49db24/_0x4eecf6*(0x1-utils['erlangb'](_0x49db24,_0x4eecf6));}return _0x585e37({'erlangCalls':_0xcd41c8,'erlangCallToSecond':_0x3e3aef/_0xcd41c8,'erlangAbandonmentRate':_0x565ab8,'erlangBusyFactor':_0x282371});});};Dialer['prototype'][_0xf3c6('0x1df')]=function(_0x5e3cf9,_0x6bfd3,_0x5a5525,_0x225c73,_0xd936b5,_0x3e3847){loggerPredictive[_0xf3c6('0x46')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0xf3c6('0x21a'),_0x5e3cf9);loggerPredictive[_0xf3c6('0x46')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x6bfd3);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x212'),_0x5a5525);loggerPredictive['info'](_0xf3c6('0x21b'),_0x225c73);loggerPredictive[_0xf3c6('0x46')](_0xf3c6('0x21c'),_0xd936b5);loggerPredictive[_0xf3c6('0x46')]('---------------------------');return new Promise(function(_0x40e783,_0x4dab97){if(_0x5e3cf9<=0x0||isNaN(_0x5e3cf9)){return _0x4dab97(msgResponse(_0xf3c6('0x21d'),_0xf3c6('0xbc'),'m\x20=\x20'+_0x5e3cf9));}if(_0x5a5525<=0x0||isNaN(_0x5a5525)){return _0x4dab97(msgResponse(_0xf3c6('0x21d'),'Error',_0xf3c6('0x215')+_0x5a5525));}if(_0x225c73<=0x0||isNaN(_0x225c73)){return _0x4dab97(msgResponse(_0xf3c6('0x21d'),'Error',_0xf3c6('0x216')+_0x225c73));}if(_0x6bfd3<=0x0||isNaN(_0x6bfd3)){return _0x4dab97(msgResponse(_0xf3c6('0x21d'),'Error','interval\x20=\x20'+_0x6bfd3));}if(_0xd936b5<=0x0||isNaN(_0xd936b5)){return _0x4dab97(msgResponse(_0xf3c6('0x21d'),_0xf3c6('0xbc'),_0xf3c6('0x21e')+_0xd936b5));}_0x3e3847=_0x3e3847||0x0;var _0x457847=0x1/_0x5a5525;var _0x564269=0x0;var _0x4e7cc9=0x0;var _0x5aa7ee=0x0;var _0x137282=0x0;for(var _0x5289a5=0x0;_0x137282<_0xd936b5;_0x5289a5+=0x1){_0x4e7cc9=_0x5289a5/_0x6bfd3;_0x564269=(_0x225c73*_0x4e7cc9+_0x3e3847)/_0x457847;_0x5aa7ee=utils[_0xf3c6('0x219')](_0x564269,_0x5e3cf9);_0x137282=_0x564269/_0x5e3cf9*(0x1-utils[_0xf3c6('0x219')](_0x564269,_0x5e3cf9));}return _0x40e783({'erlangCalls':_0x5289a5,'erlangCallToSecond':_0x6bfd3/_0x5289a5,'erlangAbandonmentRate':_0x5aa7ee,'erlangBusyFactor':_0x137282});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index df06a0c..49a8c0a 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff1e=['dialCutDigit','substring','getQueue','exports','util','lodash','isNil','string','phone','Contact','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','voiceQueue'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0xff1e,0x1f3));var _0xeff1=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xff1e[_0x47fd36];return _0x21a0fc;};'use strict';var util=require(_0xeff1('0x0'));var _=require(_0xeff1('0x1'));var moment=require('moment');function checkNameSurname(_0x46cf74,_0x524aeb,_0xfc4550){var _0x115de7='';if(!_[_0xeff1('0x2')](_0x524aeb)&&_0xeff1('0x3')===typeof _0x524aeb){_0x115de7+=_0x524aeb;}if(!_[_0xeff1('0x2')](_0xfc4550)&&_0xeff1('0x3')===typeof _0xfc4550){_0x115de7+='\x20'+_0xfc4550;}if(_0x115de7!==''){return _0x115de7;}return _0x46cf74;}function Action(_0x5ec837,_0x3f60d9,_0xdc3c11){this['voiceQueue']=_0x5ec837;this['uniqueid']=_0xdc3c11||undefined;this['name']=checkNameSurname(_0x3f60d9['Contact'][_0xeff1('0x4')],_0x3f60d9[_0xeff1('0x5')][_0xeff1('0x6')],_0x3f60d9[_0xeff1('0x5')][_0xeff1('0x7')]);this[_0xeff1('0x8')]=_0x3f60d9[_0xeff1('0x4')];this[_0xeff1('0x9')]=_0x5ec837[_0xeff1('0xa')];this[_0xeff1('0xb')]=_0x3f60d9[_0xeff1('0xb')]||![];this[_0xeff1('0xc')]=_0x5ec837[_0xeff1('0xc')];this[_0xeff1('0xd')]=_0x5ec837[_0xeff1('0xd')]||0x3;this[_0xeff1('0xe')]=_0x3f60d9[_0xeff1('0xe')];this[_0xeff1('0xf')]=_0x3f60d9[_0xeff1('0xf')];this[_0xeff1('0x10')]=_0x3f60d9[_0xeff1('0x10')];this['countnoanswerretry']=_0x3f60d9[_0xeff1('0x11')];this['countnosuchnumberretry']=_0x3f60d9[_0xeff1('0x12')];this[_0xeff1('0x13')]=_0x3f60d9[_0xeff1('0x13')];this[_0xeff1('0x14')]=_0x3f60d9[_0xeff1('0x14')];this[_0xeff1('0x15')]=_0x3f60d9[_0xeff1('0x15')];this[_0xeff1('0x16')]=_0x3f60d9['countagentrejectretry'];this[_0xeff1('0x17')]=_0x3f60d9['ContactId'];this[_0xeff1('0x18')]=_0x3f60d9['ListId'];this[_0xeff1('0x19')]=_0x3f60d9[_0xeff1('0x19')];this[_0xeff1('0x1a')]=_0x3f60d9[_0xeff1('0x1a')];this[_0xeff1('0x1b')]=_0x3f60d9[_0xeff1('0x1b')];this[_0xeff1('0x1c')]=_0x3f60d9['id'];this[_0xeff1('0x1d')]=_0x3f60d9['Contact']['firstName']||'';this['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xeff1('0x1e')]=_0x3f60d9[_0xeff1('0x1e')];this[_0xeff1('0x1f')]=_0x3f60d9[_0xeff1('0x1f')];this[_0xeff1('0x20')]=_0x3f60d9['callbackat'];this[_0xeff1('0x21')]=_0x3f60d9[_0xeff1('0x21')];this[_0xeff1('0x22')]='';this[_0xeff1('0x23')]='';}Action[_0xeff1('0x24')][_0xeff1('0x25')]=function(){return util[_0xeff1('0x26')](_0xeff1('0x27'),this['name'],this[_0xeff1('0x28')][_0xeff1('0x29')]>0x0?this[_0xeff1('0x8')][_0xeff1('0x2a')](this[_0xeff1('0x28')][_0xeff1('0x29')]):this[_0xeff1('0x8')]);};Action[_0xeff1('0x24')][_0xeff1('0x2b')]=function(){return this['queue'];};module[_0xeff1('0x2c')]=Action; \ No newline at end of file +var _0x1620=['lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','format','substring','dialCutDigit','getQueue','util','lodash','string','isNil','voiceQueue','uniqueid','name','Contact','phone'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x1620,0x171));var _0x0162=function(_0x4a8a55,_0x4e9b04){_0x4a8a55=_0x4a8a55-0x0;var _0x3ea3f8=_0x1620[_0x4a8a55];return _0x3ea3f8;};'use strict';var util=require(_0x0162('0x0'));var _=require(_0x0162('0x1'));var moment=require('moment');function checkNameSurname(_0x11d4dd,_0x2cff66,_0x4b8fd5){var _0x48f9c3='';if(!_['isNil'](_0x2cff66)&&_0x0162('0x2')===typeof _0x2cff66){_0x48f9c3+=_0x2cff66;}if(!_[_0x0162('0x3')](_0x4b8fd5)&&_0x0162('0x2')===typeof _0x4b8fd5){_0x48f9c3+='\x20'+_0x4b8fd5;}if(_0x48f9c3!==''){return _0x48f9c3;}return _0x11d4dd;}function Action(_0x323025,_0xdd7787,_0x37a688){this[_0x0162('0x4')]=_0x323025;this[_0x0162('0x5')]=_0x37a688||undefined;this[_0x0162('0x6')]=checkNameSurname(_0xdd7787[_0x0162('0x7')][_0x0162('0x8')],_0xdd7787[_0x0162('0x7')]['firstName'],_0xdd7787[_0x0162('0x7')][_0x0162('0x9')]);this[_0x0162('0xa')]=_0xdd7787[_0x0162('0x8')];this[_0x0162('0xb')]=_0x323025['name'];this[_0x0162('0xc')]=_0xdd7787['active']||![];this['type']=_0x323025[_0x0162('0xd')];this[_0x0162('0xe')]=_0x323025['dialQueueTimeout']||0x3;this[_0x0162('0xf')]=_0xdd7787[_0x0162('0xf')];this[_0x0162('0x10')]=_0xdd7787['countbusyretry'];this[_0x0162('0x11')]=_0xdd7787[_0x0162('0x11')];this['countnoanswerretry']=_0xdd7787['countnoanswerretry'];this[_0x0162('0x12')]=_0xdd7787['countnosuchnumberretry'];this[_0x0162('0x13')]=_0xdd7787['countdropretry'];this[_0x0162('0x14')]=_0xdd7787[_0x0162('0x14')];this[_0x0162('0x15')]=_0xdd7787[_0x0162('0x15')];this[_0x0162('0x16')]=_0xdd7787[_0x0162('0x16')];this[_0x0162('0x17')]=_0xdd7787['ContactId'];this[_0x0162('0x18')]=_0xdd7787[_0x0162('0x18')];this[_0x0162('0x19')]=_0xdd7787[_0x0162('0x19')];this['VoiceQueueId']=_0xdd7787[_0x0162('0x1a')];this[_0x0162('0x1b')]=_0xdd7787[_0x0162('0x1b')];this[_0x0162('0x1c')]=_0xdd7787['id'];this['ContactFirstName']=_0xdd7787[_0x0162('0x7')]['firstName']||'';this[_0x0162('0x1d')]=moment()['format'](_0x0162('0x1e'));this[_0x0162('0x1f')]=_0xdd7787['callback'];this[_0x0162('0x20')]=_0xdd7787[_0x0162('0x20')];this[_0x0162('0x21')]=_0xdd7787[_0x0162('0x21')];this['recallme']=_0xdd7787[_0x0162('0x22')];this[_0x0162('0x23')]='';this[_0x0162('0x24')]='';}Action[_0x0162('0x25')]['getCaller']=function(){return util[_0x0162('0x26')]('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue']['dialCutDigit']>0x0?this[_0x0162('0xa')][_0x0162('0x27')](this[_0x0162('0x4')][_0x0162('0x28')]):this[_0x0162('0xa')]);};Action[_0x0162('0x25')][_0x0162('0x29')]=function(){return this[_0x0162('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 5b10ab3..6aecb15 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2c4=['queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds'];(function(_0xc145cd,_0x295247){var _0x288bf1=function(_0x311675){while(--_0x311675){_0xc145cd['push'](_0xc145cd['shift']());}};_0x288bf1(++_0x295247);}(_0xd2c4,0x13d));var _0x4d2c=function(_0x49cfcc,_0xf15540){_0x49cfcc=_0x49cfcc-0x0;var _0x44d1cc=_0xd2c4[_0x49cfcc];return _0x44d1cc;};'use strict';var moment=require(_0x4d2c('0x0'));var utils=require(_0x4d2c('0x1'));function AgentComplete(_0x25dc1a,_0x408137){this['state']=0x4;this[_0x4d2c('0x2')]=_0x4d2c('0x3');this[_0x4d2c('0x4')]=_0x25dc1a[_0x4d2c('0x4')];this[_0x4d2c('0x5')]=_0x25dc1a['type'];this['campaigntype']=_0x25dc1a[_0x4d2c('0x5')]===_0x4d2c('0x6')?'queue':_0x25dc1a[_0x4d2c('0x5')];this[_0x4d2c('0x7')]=_0x25dc1a['countbusyretry'];this[_0x4d2c('0x8')]=_0x25dc1a['countcongestionretry'];this[_0x4d2c('0x9')]=_0x25dc1a[_0x4d2c('0x9')];this['countglobal']=_0x25dc1a[_0x4d2c('0x7')]+_0x25dc1a[_0x4d2c('0x8')]+_0x25dc1a[_0x4d2c('0x9')]+_0x25dc1a[_0x4d2c('0xa')]+_0x25dc1a[_0x4d2c('0xb')]+_0x25dc1a[_0x4d2c('0xc')]+_0x25dc1a['countmachineretry']+_0x25dc1a[_0x4d2c('0xd')];this[_0x4d2c('0xa')]=_0x25dc1a[_0x4d2c('0xa')];this[_0x4d2c('0xb')]=_0x25dc1a[_0x4d2c('0xb')];this[_0x4d2c('0xc')]=_0x25dc1a['countabandonedretry'];this['countmachineretry']=_0x25dc1a[_0x4d2c('0xe')];this[_0x4d2c('0xd')]=_0x25dc1a[_0x4d2c('0xd')];this[_0x4d2c('0xf')]=_0x408137['uniqueid'];this[_0x4d2c('0x10')]=_0x25dc1a[_0x4d2c('0x11')];this['calleridnum']=_0x25dc1a[_0x4d2c('0x12')];this[_0x4d2c('0x13')]=_0x25dc1a['starttime'];this[_0x4d2c('0x14')]=_0x25dc1a[_0x4d2c('0x14')];this['answertime']=_0x25dc1a[_0x4d2c('0x15')];this[_0x4d2c('0x16')]=moment()[_0x4d2c('0x17')](_0x4d2c('0x18'));this[_0x4d2c('0x19')]=utils['getSeconds'](_0x25dc1a[_0x4d2c('0x14')],_0x25dc1a[_0x4d2c('0x13')]);this['holdtime']=utils[_0x4d2c('0x1a')](_0x25dc1a['answertime'],_0x25dc1a[_0x4d2c('0x14')]);this['talktime']=utils[_0x4d2c('0x1a')](this[_0x4d2c('0x16')],_0x25dc1a['answertime']);this[_0x4d2c('0x1b')]=_0x408137['queue'];this['membername']=_0x408137[_0x4d2c('0x1c')];this[_0x4d2c('0x1d')]=_0x408137[_0x4d2c('0x1d')];this[_0x4d2c('0x1e')]=_0x25dc1a[_0x4d2c('0x1e')];this[_0x4d2c('0x1f')]=_0x25dc1a[_0x4d2c('0x1f')];this[_0x4d2c('0x20')]=_0x25dc1a[_0x4d2c('0x20')];this[_0x4d2c('0x21')]=_0x25dc1a['recallme'];this['ContactId']=_0x25dc1a[_0x4d2c('0x22')];this[_0x4d2c('0x23')]=_0x25dc1a[_0x4d2c('0x23')];this['UserId']=_0x25dc1a[_0x4d2c('0x24')];this['VoiceQueueId']=_0x25dc1a[_0x4d2c('0x25')];this[_0x4d2c('0x26')]=_0x25dc1a[_0x4d2c('0x26')];this[_0x4d2c('0x27')]=_0x25dc1a[_0x4d2c('0x27')]||'';this['originatecalleridname']=_0x25dc1a[_0x4d2c('0x28')]||'';this[_0x4d2c('0x29')]=_0x25dc1a[_0x4d2c('0x29')];}module[_0x4d2c('0x2a')]=AgentComplete; \ No newline at end of file +var _0x57c6=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x57c6,0xa7));var _0x657c=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0x57c6[_0xe1269d];return _0x261ca1;};'use strict';var moment=require('moment');var utils=require(_0x657c('0x0'));function AgentComplete(_0x3c0c6b,_0x18d125){this[_0x657c('0x1')]=0x4;this[_0x657c('0x2')]=_0x657c('0x3');this[_0x657c('0x4')]=_0x3c0c6b['scheduledat'];this[_0x657c('0x5')]=_0x3c0c6b[_0x657c('0x5')];this[_0x657c('0x6')]=_0x3c0c6b[_0x657c('0x5')]===_0x657c('0x7')?'queue':_0x3c0c6b[_0x657c('0x5')];this['countbusyretry']=_0x3c0c6b[_0x657c('0x8')];this[_0x657c('0x9')]=_0x3c0c6b[_0x657c('0x9')];this[_0x657c('0xa')]=_0x3c0c6b[_0x657c('0xa')];this[_0x657c('0xb')]=_0x3c0c6b['countbusyretry']+_0x3c0c6b[_0x657c('0x9')]+_0x3c0c6b[_0x657c('0xa')]+_0x3c0c6b['countnosuchnumberretry']+_0x3c0c6b[_0x657c('0xc')]+_0x3c0c6b[_0x657c('0xd')]+_0x3c0c6b[_0x657c('0xe')]+_0x3c0c6b[_0x657c('0xf')];this[_0x657c('0x10')]=_0x3c0c6b['countnosuchnumberretry'];this[_0x657c('0xc')]=_0x3c0c6b[_0x657c('0xc')];this[_0x657c('0xd')]=_0x3c0c6b[_0x657c('0xd')];this[_0x657c('0xe')]=_0x3c0c6b['countmachineretry'];this['countagentrejectretry']=_0x3c0c6b[_0x657c('0xf')];this[_0x657c('0x11')]=_0x18d125[_0x657c('0x11')];this[_0x657c('0x12')]=_0x3c0c6b[_0x657c('0x13')];this[_0x657c('0x14')]=_0x3c0c6b[_0x657c('0x15')];this[_0x657c('0x16')]=_0x3c0c6b[_0x657c('0x16')];this[_0x657c('0x17')]=_0x3c0c6b['responsetime'];this[_0x657c('0x18')]=_0x3c0c6b[_0x657c('0x18')];this[_0x657c('0x19')]=moment()[_0x657c('0x1a')](_0x657c('0x1b'));this['ringtime']=utils[_0x657c('0x1c')](_0x3c0c6b[_0x657c('0x17')],_0x3c0c6b[_0x657c('0x16')]);this[_0x657c('0x1d')]=utils['getSeconds'](_0x3c0c6b['answertime'],_0x3c0c6b['responsetime']);this['talktime']=utils[_0x657c('0x1c')](this[_0x657c('0x19')],_0x3c0c6b[_0x657c('0x18')]);this['queue']=_0x18d125[_0x657c('0x1e')];this[_0x657c('0x1f')]=_0x18d125[_0x657c('0x1f')];this[_0x657c('0x20')]=_0x18d125[_0x657c('0x20')];this[_0x657c('0x21')]=_0x3c0c6b[_0x657c('0x21')];this[_0x657c('0x22')]=_0x3c0c6b['callbackuniqueid'];this[_0x657c('0x23')]=_0x3c0c6b[_0x657c('0x23')];this[_0x657c('0x24')]=_0x3c0c6b[_0x657c('0x24')];this[_0x657c('0x25')]=_0x3c0c6b[_0x657c('0x25')];this[_0x657c('0x26')]=_0x3c0c6b[_0x657c('0x26')];this['UserId']=_0x3c0c6b['UserId'];this[_0x657c('0x27')]=_0x3c0c6b[_0x657c('0x27')];this['CampaignId']=_0x3c0c6b['CampaignId'];this[_0x657c('0x28')]=_0x3c0c6b['originatecalleridnum']||'';this[_0x657c('0x29')]=_0x3c0c6b[_0x657c('0x29')]||'';this[_0x657c('0x2a')]=_0x3c0c6b['agiafterat'];}module[_0x657c('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 3f8752b..0071808 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f7a=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x5e6b32,_0x1136d3){var _0x5c5fdb=function(_0x42849c){while(--_0x42849c){_0x5e6b32['push'](_0x5e6b32['shift']());}};_0x5c5fdb(++_0x1136d3);}(_0x4f7a,0x144));var _0xa4f7=function(_0x2651b6,_0x3cdfad){_0x2651b6=_0x2651b6-0x0;var _0x27369d=_0x4f7a[_0x2651b6];return _0x27369d;};'use strict';function Final(_0x41e4d7){this[_0xa4f7('0x0')]=_0x41e4d7[_0xa4f7('0x0')];this[_0xa4f7('0x1')]=_0x41e4d7[_0xa4f7('0x1')];this[_0xa4f7('0x2')]=_0x41e4d7[_0xa4f7('0x2')];this[_0xa4f7('0x3')]=_0x41e4d7[_0xa4f7('0x2')]===_0xa4f7('0x4')?_0xa4f7('0x5'):_0x41e4d7['type'];this[_0xa4f7('0x6')]=_0x41e4d7[_0xa4f7('0x6')];this[_0xa4f7('0x7')]=_0x41e4d7[_0xa4f7('0x7')];this['countnoanswerretry']=_0x41e4d7[_0xa4f7('0x8')];this['countglobal']=_0x41e4d7[_0xa4f7('0x6')]+_0x41e4d7['countcongestionretry']+_0x41e4d7[_0xa4f7('0x8')]+_0x41e4d7['countnosuchnumberretry']+_0x41e4d7[_0xa4f7('0x9')]+_0x41e4d7[_0xa4f7('0xa')]+_0x41e4d7['countmachineretry']+_0x41e4d7[_0xa4f7('0xb')];this[_0xa4f7('0xc')]=_0x41e4d7[_0xa4f7('0xc')];this[_0xa4f7('0x9')]=_0x41e4d7[_0xa4f7('0x9')];this[_0xa4f7('0xa')]=_0x41e4d7[_0xa4f7('0xa')];this[_0xa4f7('0xd')]=_0x41e4d7[_0xa4f7('0xd')];this[_0xa4f7('0xb')]=_0x41e4d7['countagentrejectretry'];this[_0xa4f7('0x5')]=_0x41e4d7['queue'];this['calleridname']=_0x41e4d7['calleridname'];this[_0xa4f7('0xe')]=_0x41e4d7[_0xa4f7('0xe')];this[_0xa4f7('0xf')]=_0x41e4d7[_0xa4f7('0xf')];this['responsetime']=_0x41e4d7[_0xa4f7('0x10')];this[_0xa4f7('0x11')]=_0x41e4d7['responsetime'];this[_0xa4f7('0x12')]=_0x41e4d7['ringtime']||0x0;this[_0xa4f7('0x13')]=_0x41e4d7['holdtime']||0x0;this[_0xa4f7('0x14')]=_0x41e4d7[_0xa4f7('0x14')]||0x0;this[_0xa4f7('0x15')]=_0x41e4d7[_0xa4f7('0x15')];this[_0xa4f7('0x16')]=_0x41e4d7['callbackuniqueid'];this[_0xa4f7('0x17')]=_0x41e4d7['callbackat'];this[_0xa4f7('0x18')]=_0x41e4d7[_0xa4f7('0x18')];this['ContactId']=_0x41e4d7[_0xa4f7('0x19')];this[_0xa4f7('0x1a')]=_0x41e4d7['ListId'];this[_0xa4f7('0x1b')]=_0x41e4d7[_0xa4f7('0x1b')];this[_0xa4f7('0x1c')]=_0x41e4d7[_0xa4f7('0x1c')];this[_0xa4f7('0x1d')]=_0x41e4d7[_0xa4f7('0x1d')];this[_0xa4f7('0x1e')]=_0x41e4d7['originatecalleridnum']||'';this['originatecalleridname']=_0x41e4d7[_0xa4f7('0x1f')]||'';this[_0xa4f7('0x20')]=_0x41e4d7[_0xa4f7('0x20')];this[_0xa4f7('0x21')]=_0x41e4d7['statedesc'];}module[_0xa4f7('0x22')]=Final; \ No newline at end of file +var _0xa6d7=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xa6d7,0xad));var _0x7a6d=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa6d7[_0x2bf141];return _0x48277b;};'use strict';function Final(_0x21894f){this['uniqueid']=_0x21894f['uniqueid'];this['scheduledat']=_0x21894f[_0x7a6d('0x0')];this[_0x7a6d('0x1')]=_0x21894f[_0x7a6d('0x1')];this['campaigntype']=_0x21894f[_0x7a6d('0x1')]===_0x7a6d('0x2')?'queue':_0x21894f['type'];this['countbusyretry']=_0x21894f[_0x7a6d('0x3')];this[_0x7a6d('0x4')]=_0x21894f['countcongestionretry'];this[_0x7a6d('0x5')]=_0x21894f[_0x7a6d('0x5')];this['countglobal']=_0x21894f[_0x7a6d('0x3')]+_0x21894f['countcongestionretry']+_0x21894f[_0x7a6d('0x5')]+_0x21894f[_0x7a6d('0x6')]+_0x21894f[_0x7a6d('0x7')]+_0x21894f[_0x7a6d('0x8')]+_0x21894f['countmachineretry']+_0x21894f[_0x7a6d('0x9')];this[_0x7a6d('0x6')]=_0x21894f[_0x7a6d('0x6')];this[_0x7a6d('0x7')]=_0x21894f[_0x7a6d('0x7')];this[_0x7a6d('0x8')]=_0x21894f[_0x7a6d('0x8')];this[_0x7a6d('0xa')]=_0x21894f[_0x7a6d('0xa')];this[_0x7a6d('0x9')]=_0x21894f['countagentrejectretry'];this[_0x7a6d('0xb')]=_0x21894f[_0x7a6d('0xb')];this['calleridname']=_0x21894f['calleridname'];this[_0x7a6d('0xc')]=_0x21894f[_0x7a6d('0xc')];this[_0x7a6d('0xd')]=_0x21894f['starttime'];this[_0x7a6d('0xe')]=_0x21894f['responsetime'];this['endtime']=_0x21894f['responsetime'];this[_0x7a6d('0xf')]=_0x21894f[_0x7a6d('0xf')]||0x0;this[_0x7a6d('0x10')]=_0x21894f[_0x7a6d('0x10')]||0x0;this['talktime']=_0x21894f[_0x7a6d('0x11')]||0x0;this[_0x7a6d('0x12')]=_0x21894f['callback'];this[_0x7a6d('0x13')]=_0x21894f[_0x7a6d('0x13')];this[_0x7a6d('0x14')]=_0x21894f['callbackat'];this['recallme']=_0x21894f[_0x7a6d('0x15')];this[_0x7a6d('0x16')]=_0x21894f[_0x7a6d('0x16')];this[_0x7a6d('0x17')]=_0x21894f[_0x7a6d('0x17')];this[_0x7a6d('0x18')]=_0x21894f[_0x7a6d('0x18')];this[_0x7a6d('0x19')]=_0x21894f[_0x7a6d('0x19')];this[_0x7a6d('0x1a')]=_0x21894f[_0x7a6d('0x1a')];this['originatecalleridnum']=_0x21894f[_0x7a6d('0x1b')]||'';this[_0x7a6d('0x1c')]=_0x21894f['originatecalleridname']||'';this['state']=_0x21894f[_0x7a6d('0x1d')];this['statedesc']=_0x21894f[_0x7a6d('0x1e')];}module[_0x7a6d('0x1f')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 23de6c9..86fe87e 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6535=['responsetime','endtime','format','ringtime','holdtime','getSeconds','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','statedesc','Answer','scheduledat','campaigntype','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','name','calleridnum','starttime'];(function(_0x542899,_0x27dbf3){var _0x209df5=function(_0x417ffd){while(--_0x417ffd){_0x542899['push'](_0x542899['shift']());}};_0x209df5(++_0x27dbf3);}(_0x6535,0x1da));var _0x5653=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x6535[_0xa148b7];return _0x51efd3;};'use strict';var moment=require('moment');var utils=require('../utils');function Hangup(_0x3fe1b6,_0x6b3ce2){this['state']=0x4;this[_0x5653('0x0')]=_0x5653('0x1');this['scheduledat']=_0x3fe1b6[_0x5653('0x2')];this['type']=_0x3fe1b6['type'];this[_0x5653('0x3')]=_0x3fe1b6[_0x5653('0x4')]===_0x5653('0x5')?_0x5653('0x6'):_0x3fe1b6[_0x5653('0x4')];this[_0x5653('0x7')]=_0x3fe1b6[_0x5653('0x7')]||![];this[_0x5653('0x8')]=_0x3fe1b6[_0x5653('0x8')];this[_0x5653('0x9')]=_0x3fe1b6[_0x5653('0x9')];this[_0x5653('0xa')]=_0x3fe1b6[_0x5653('0xa')];this['countglobal']=_0x3fe1b6[_0x5653('0x8')]+_0x3fe1b6['countcongestionretry']+_0x3fe1b6[_0x5653('0xa')]+_0x3fe1b6[_0x5653('0xb')]+_0x3fe1b6['countdropretry']+_0x3fe1b6['countabandonedretry']+_0x3fe1b6[_0x5653('0xc')]+_0x3fe1b6[_0x5653('0xd')];this[_0x5653('0xb')]=_0x3fe1b6[_0x5653('0xb')];this[_0x5653('0xe')]=_0x3fe1b6[_0x5653('0xe')];this[_0x5653('0xf')]=_0x3fe1b6[_0x5653('0xf')];this[_0x5653('0xc')]=_0x3fe1b6[_0x5653('0xc')];this[_0x5653('0xd')]=_0x3fe1b6[_0x5653('0xd')];this[_0x5653('0x10')]=_0x6b3ce2[_0x5653('0x10')];this['calleridname']=_0x3fe1b6[_0x5653('0x11')];this[_0x5653('0x12')]=_0x3fe1b6['number'];this[_0x5653('0x13')]=_0x3fe1b6[_0x5653('0x13')];this[_0x5653('0x14')]=_0x3fe1b6[_0x5653('0x14')];this[_0x5653('0x15')]=moment()[_0x5653('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5653('0x17')]=utils['getSeconds'](_0x3fe1b6[_0x5653('0x14')],_0x3fe1b6[_0x5653('0x13')]);this[_0x5653('0x18')]=0x0;this['talktime']=utils[_0x5653('0x19')](this[_0x5653('0x15')],_0x3fe1b6[_0x5653('0x14')]);this['queue']=_0x3fe1b6[_0x5653('0x6')];this['membername']=_0x5653('0x1a');this[_0x5653('0x1b')]=_0x6b3ce2['cause-txt'];this[_0x5653('0x1c')]=_0x3fe1b6[_0x5653('0x1c')];this[_0x5653('0x1d')]=_0x3fe1b6['callbackuniqueid'];this['callbackat']=_0x3fe1b6[_0x5653('0x1e')];this[_0x5653('0x1f')]=_0x3fe1b6[_0x5653('0x1f')];this[_0x5653('0x20')]=_0x3fe1b6['ContactId'];this[_0x5653('0x21')]=_0x3fe1b6[_0x5653('0x21')];this[_0x5653('0x22')]=_0x3fe1b6['UserId'];this['VoiceQueueId']=_0x3fe1b6[_0x5653('0x23')];this[_0x5653('0x24')]=_0x3fe1b6['CampaignId'];}module[_0x5653('0x25')]=Hangup; \ No newline at end of file +var _0x7cfd=['holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','getSeconds'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x7cfd,0x1d2));var _0xd7cf=function(_0x3059cf,_0x56553c){_0x3059cf=_0x3059cf-0x0;var _0x3dd42c=_0x7cfd[_0x3059cf];return _0x3dd42c;};'use strict';var moment=require(_0xd7cf('0x0'));var utils=require(_0xd7cf('0x1'));function Hangup(_0x230b28,_0x10e94e){this['state']=0x4;this['statedesc']=_0xd7cf('0x2');this[_0xd7cf('0x3')]=_0x230b28['scheduledat'];this['type']=_0x230b28[_0xd7cf('0x4')];this[_0xd7cf('0x5')]=_0x230b28['type']==='outbound'?_0xd7cf('0x6'):_0x230b28['type'];this[_0xd7cf('0x7')]=_0x230b28['amd']||![];this[_0xd7cf('0x8')]=_0x230b28[_0xd7cf('0x8')];this[_0xd7cf('0x9')]=_0x230b28[_0xd7cf('0x9')];this[_0xd7cf('0xa')]=_0x230b28[_0xd7cf('0xa')];this['countglobal']=_0x230b28[_0xd7cf('0x8')]+_0x230b28[_0xd7cf('0x9')]+_0x230b28[_0xd7cf('0xa')]+_0x230b28[_0xd7cf('0xb')]+_0x230b28[_0xd7cf('0xc')]+_0x230b28[_0xd7cf('0xd')]+_0x230b28[_0xd7cf('0xe')]+_0x230b28[_0xd7cf('0xf')];this['countnosuchnumberretry']=_0x230b28[_0xd7cf('0xb')];this['countdropretry']=_0x230b28[_0xd7cf('0xc')];this['countabandonedretry']=_0x230b28['countabandonedretry'];this[_0xd7cf('0xe')]=_0x230b28[_0xd7cf('0xe')];this['countagentrejectretry']=_0x230b28[_0xd7cf('0xf')];this[_0xd7cf('0x10')]=_0x10e94e[_0xd7cf('0x10')];this[_0xd7cf('0x11')]=_0x230b28[_0xd7cf('0x12')];this[_0xd7cf('0x13')]=_0x230b28[_0xd7cf('0x14')];this[_0xd7cf('0x15')]=_0x230b28[_0xd7cf('0x15')];this[_0xd7cf('0x16')]=_0x230b28[_0xd7cf('0x16')];this[_0xd7cf('0x17')]=moment()[_0xd7cf('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0xd7cf('0x19')](_0x230b28[_0xd7cf('0x16')],_0x230b28[_0xd7cf('0x15')]);this[_0xd7cf('0x1a')]=0x0;this[_0xd7cf('0x1b')]=utils['getSeconds'](this[_0xd7cf('0x17')],_0x230b28[_0xd7cf('0x16')]);this[_0xd7cf('0x6')]=_0x230b28[_0xd7cf('0x6')];this[_0xd7cf('0x1c')]=_0xd7cf('0x1d');this['reason']=_0x10e94e[_0xd7cf('0x1e')];this[_0xd7cf('0x1f')]=_0x230b28['callback'];this[_0xd7cf('0x20')]=_0x230b28[_0xd7cf('0x20')];this[_0xd7cf('0x21')]=_0x230b28[_0xd7cf('0x21')];this['recallme']=_0x230b28[_0xd7cf('0x22')];this[_0xd7cf('0x23')]=_0x230b28[_0xd7cf('0x23')];this['ListId']=_0x230b28[_0xd7cf('0x24')];this['UserId']=_0x230b28[_0xd7cf('0x25')];this[_0xd7cf('0x26')]=_0x230b28[_0xd7cf('0x26')];this['CampaignId']=_0x230b28[_0xd7cf('0x27')];}module[_0xd7cf('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index b8daef2..109fa9a 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18a9=['countagentrejectretry','name','calleridnum','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x1fa353,_0x5b9c98){var _0x32e516=function(_0x130de6){while(--_0x130de6){_0x1fa353['push'](_0x1fa353['shift']());}};_0x32e516(++_0x5b9c98);}(_0x18a9,0x17e));var _0x918a=function(_0x16b51e,_0x30cb17){_0x16b51e=_0x16b51e-0x0;var _0x27b91a=_0x18a9[_0x16b51e];return _0x27b91a;};'use strict';var utils=require(_0x918a('0x0'));function History(_0x547939){this[_0x918a('0x1')]=_0x547939['uniqueid'];this[_0x918a('0x2')]=_0x547939[_0x918a('0x2')]||undefined;this[_0x918a('0x3')]=_0x547939[_0x918a('0x3')];this[_0x918a('0x4')]=_0x547939[_0x918a('0x3')]===_0x918a('0x5')?_0x918a('0x6'):_0x547939[_0x918a('0x3')];this[_0x918a('0x7')]=_0x547939['countbusyretry'];this[_0x918a('0x8')]=_0x547939['countcongestionretry'];this[_0x918a('0x9')]=_0x547939[_0x918a('0x9')];this['countglobal']=_0x547939[_0x918a('0x7')]+_0x547939['countcongestionretry']+_0x547939[_0x918a('0x9')]+_0x547939[_0x918a('0xa')]+_0x547939[_0x918a('0xb')]+_0x547939[_0x918a('0xc')]+_0x547939[_0x918a('0xd')]+_0x547939['countagentrejectretry'];this[_0x918a('0xa')]=_0x547939[_0x918a('0xa')];this[_0x918a('0xb')]=_0x547939[_0x918a('0xb')];this['countabandonedretry']=_0x547939[_0x918a('0xc')];this[_0x918a('0xd')]=_0x547939[_0x918a('0xd')];this['countagentrejectretry']=_0x547939[_0x918a('0xe')];this[_0x918a('0x6')]=_0x547939[_0x918a('0x6')];this['calleridname']=_0x547939[_0x918a('0xf')];this[_0x918a('0x10')]=_0x547939['number'];this['starttime']=_0x547939[_0x918a('0x11')];this[_0x918a('0x12')]=_0x547939[_0x918a('0x12')];this['endtime']=_0x547939[_0x918a('0x12')];this[_0x918a('0x13')]=utils['getSeconds'](_0x547939[_0x918a('0x12')],_0x547939[_0x918a('0x11')]);this[_0x918a('0x14')]=0x0;this['talktime']=0x0;this[_0x918a('0x15')]=_0x547939[_0x918a('0x15')];this['callbackuniqueid']=_0x547939[_0x918a('0x16')];this['callbackat']=_0x547939['callbackat'];this['recallme']=_0x547939[_0x918a('0x17')];this[_0x918a('0x18')]=_0x547939['ContactId'];this[_0x918a('0x19')]=_0x547939[_0x918a('0x19')];this[_0x918a('0x1a')]=_0x547939[_0x918a('0x1a')];this[_0x918a('0x1b')]=_0x547939[_0x918a('0x1b')];this[_0x918a('0x1c')]=_0x547939[_0x918a('0x1c')];this[_0x918a('0x1d')]=_0x547939[_0x918a('0x1d')]||'';this[_0x918a('0x1e')]=_0x547939['originatecalleridname']||'';this[_0x918a('0x1f')]=_0x547939['state'];this[_0x918a('0x20')]=_0x547939[_0x918a('0x20')];}module['exports']=History; \ No newline at end of file +var _0x27c5=['countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x27c5,0x1a1));var _0x527c=function(_0x3bee55,_0x4e25c8){_0x3bee55=_0x3bee55-0x0;var _0x5649d2=_0x27c5[_0x3bee55];return _0x5649d2;};'use strict';var utils=require(_0x527c('0x0'));function History(_0x348cea){this[_0x527c('0x1')]=_0x348cea['uniqueid'];this[_0x527c('0x2')]=_0x348cea['scheduledat']||undefined;this[_0x527c('0x3')]=_0x348cea[_0x527c('0x3')];this[_0x527c('0x4')]=_0x348cea[_0x527c('0x3')]===_0x527c('0x5')?_0x527c('0x6'):_0x348cea[_0x527c('0x3')];this[_0x527c('0x7')]=_0x348cea[_0x527c('0x7')];this[_0x527c('0x8')]=_0x348cea[_0x527c('0x8')];this[_0x527c('0x9')]=_0x348cea[_0x527c('0x9')];this[_0x527c('0xa')]=_0x348cea[_0x527c('0x7')]+_0x348cea['countcongestionretry']+_0x348cea[_0x527c('0x9')]+_0x348cea[_0x527c('0xb')]+_0x348cea[_0x527c('0xc')]+_0x348cea['countabandonedretry']+_0x348cea['countmachineretry']+_0x348cea[_0x527c('0xd')];this[_0x527c('0xb')]=_0x348cea[_0x527c('0xb')];this[_0x527c('0xc')]=_0x348cea[_0x527c('0xc')];this['countabandonedretry']=_0x348cea[_0x527c('0xe')];this[_0x527c('0xf')]=_0x348cea[_0x527c('0xf')];this[_0x527c('0xd')]=_0x348cea[_0x527c('0xd')];this[_0x527c('0x6')]=_0x348cea[_0x527c('0x6')];this[_0x527c('0x10')]=_0x348cea[_0x527c('0x11')];this[_0x527c('0x12')]=_0x348cea[_0x527c('0x13')];this[_0x527c('0x14')]=_0x348cea[_0x527c('0x14')];this[_0x527c('0x15')]=_0x348cea[_0x527c('0x15')];this[_0x527c('0x16')]=_0x348cea['responsetime'];this[_0x527c('0x17')]=utils[_0x527c('0x18')](_0x348cea[_0x527c('0x15')],_0x348cea[_0x527c('0x14')]);this[_0x527c('0x19')]=0x0;this['talktime']=0x0;this['callback']=_0x348cea[_0x527c('0x1a')];this[_0x527c('0x1b')]=_0x348cea['callbackuniqueid'];this[_0x527c('0x1c')]=_0x348cea[_0x527c('0x1c')];this[_0x527c('0x1d')]=_0x348cea[_0x527c('0x1d')];this['ContactId']=_0x348cea[_0x527c('0x1e')];this[_0x527c('0x1f')]=_0x348cea[_0x527c('0x1f')];this['UserId']=_0x348cea[_0x527c('0x20')];this[_0x527c('0x21')]=_0x348cea['VoiceQueueId'];this[_0x527c('0x22')]=_0x348cea[_0x527c('0x22')];this['originatecalleridnum']=_0x348cea[_0x527c('0x23')]||'';this[_0x527c('0x24')]=_0x348cea[_0x527c('0x24')]||'';this[_0x527c('0x25')]=_0x348cea[_0x527c('0x25')];this[_0x527c('0x26')]=_0x348cea['statedesc'];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 8f92a64..de3b087 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa95f=['calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid'];(function(_0x157111,_0x3a9771){var _0x5b00c4=function(_0x1b15e4){while(--_0x1b15e4){_0x157111['push'](_0x157111['shift']());}};_0x5b00c4(++_0x3a9771);}(_0xa95f,0x104));var _0xfa95=function(_0x558880,_0x2c1fe8){_0x558880=_0x558880-0x0;var _0x1680e5=_0xa95f[_0x558880];return _0x1680e5;};'use strict';var utils=require(_0xfa95('0x0'));function QueueCallerAbandon(_0x444d8b,_0x215e6c){this[_0xfa95('0x1')]=_0x444d8b['scheduledat'];this[_0xfa95('0x2')]=_0x444d8b['type'];this[_0xfa95('0x3')]=_0x444d8b[_0xfa95('0x2')]===_0xfa95('0x4')?_0xfa95('0x5'):_0x444d8b['type'];this[_0xfa95('0x6')]=_0x444d8b[_0xfa95('0x6')];this[_0xfa95('0x7')]=_0x444d8b['countcongestionretry'];this['countnoanswerretry']=_0x444d8b[_0xfa95('0x8')];this[_0xfa95('0x9')]=_0x444d8b[_0xfa95('0x6')]+_0x444d8b[_0xfa95('0x7')]+_0x444d8b[_0xfa95('0x8')]+_0x444d8b[_0xfa95('0xa')]+_0x444d8b[_0xfa95('0xb')]+_0x444d8b[_0xfa95('0xc')]+_0x444d8b[_0xfa95('0xd')]+_0x444d8b[_0xfa95('0xe')];this['countnosuchnumberretry']=_0x444d8b[_0xfa95('0xa')];this[_0xfa95('0xb')]=_0x444d8b[_0xfa95('0xb')];this[_0xfa95('0xc')]=_0x444d8b['countabandonedretry'];this[_0xfa95('0xd')]=_0x444d8b[_0xfa95('0xd')];this[_0xfa95('0xe')]=_0x444d8b['countagentrejectretry'];this[_0xfa95('0xf')]=_0x215e6c[_0xfa95('0xf')];this[_0xfa95('0x10')]=_0x444d8b[_0xfa95('0x11')];this[_0xfa95('0x12')]=_0x444d8b[_0xfa95('0x13')];this['starttime']=_0x444d8b[_0xfa95('0x14')];this[_0xfa95('0x15')]=_0x444d8b[_0xfa95('0x15')];this[_0xfa95('0x16')]=_0x444d8b[_0xfa95('0x16')];this[_0xfa95('0x17')]=_0x444d8b[_0xfa95('0x17')];this['endtime']=this[_0xfa95('0x16')];this[_0xfa95('0x18')]=utils[_0xfa95('0x19')](_0x444d8b[_0xfa95('0x15')],_0x444d8b[_0xfa95('0x14')]);this[_0xfa95('0x1a')]=utils['getSeconds'](this[_0xfa95('0x16')],_0x444d8b[_0xfa95('0x15')]);this[_0xfa95('0x1b')]=0x0;this[_0xfa95('0x5')]=_0x215e6c[_0xfa95('0x5')];this[_0xfa95('0x1c')]=_0x215e6c[_0xfa95('0x1d')];this[_0xfa95('0x1e')]=_0x215e6c['reason'];this[_0xfa95('0x1f')]=_0x444d8b['callback'];this[_0xfa95('0x20')]=_0x444d8b[_0xfa95('0x20')];this['callbackat']=_0x444d8b[_0xfa95('0x21')];this[_0xfa95('0x22')]=_0x444d8b['recallme'];this['ContactId']=_0x444d8b[_0xfa95('0x23')];this[_0xfa95('0x24')]=_0x444d8b[_0xfa95('0x24')];this[_0xfa95('0x25')]=_0x444d8b[_0xfa95('0x25')];this['VoiceQueueId']=_0x444d8b[_0xfa95('0x26')];this[_0xfa95('0x27')]=_0x444d8b[_0xfa95('0x27')];this['originatecalleridnum']=_0x444d8b[_0xfa95('0x28')]||'';this[_0xfa95('0x29')]=_0x444d8b['originatecalleridname']||'';this[_0xfa95('0x2a')]=_0x444d8b[_0xfa95('0x2a')];this[_0xfa95('0x2b')]=_0x444d8b[_0xfa95('0x2b')];this[_0xfa95('0x2c')]=_0x444d8b[_0xfa95('0x2c')];}module[_0xfa95('0x2d')]=QueueCallerAbandon; \ No newline at end of file +var _0xb265=['talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','starttime','responsetime','droptime','dropreason','ringtime','holdtime','getSeconds'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0xb265,0x131));var _0x5b26=function(_0x494ffc,_0x504348){_0x494ffc=_0x494ffc-0x0;var _0x2958a1=_0xb265[_0x494ffc];return _0x2958a1;};'use strict';var utils=require(_0x5b26('0x0'));function QueueCallerAbandon(_0x2672e,_0x149be4){this[_0x5b26('0x1')]=_0x2672e[_0x5b26('0x1')];this[_0x5b26('0x2')]=_0x2672e[_0x5b26('0x2')];this['campaigntype']=_0x2672e[_0x5b26('0x2')]===_0x5b26('0x3')?_0x5b26('0x4'):_0x2672e[_0x5b26('0x2')];this[_0x5b26('0x5')]=_0x2672e[_0x5b26('0x5')];this['countcongestionretry']=_0x2672e[_0x5b26('0x6')];this[_0x5b26('0x7')]=_0x2672e[_0x5b26('0x7')];this[_0x5b26('0x8')]=_0x2672e['countbusyretry']+_0x2672e['countcongestionretry']+_0x2672e[_0x5b26('0x7')]+_0x2672e[_0x5b26('0x9')]+_0x2672e[_0x5b26('0xa')]+_0x2672e['countabandonedretry']+_0x2672e['countmachineretry']+_0x2672e[_0x5b26('0xb')];this[_0x5b26('0x9')]=_0x2672e[_0x5b26('0x9')];this['countdropretry']=_0x2672e['countdropretry'];this[_0x5b26('0xc')]=_0x2672e[_0x5b26('0xc')];this[_0x5b26('0xd')]=_0x2672e[_0x5b26('0xd')];this[_0x5b26('0xb')]=_0x2672e['countagentrejectretry'];this[_0x5b26('0xe')]=_0x149be4[_0x5b26('0xe')];this[_0x5b26('0xf')]=_0x2672e['name'];this['calleridnum']=_0x2672e['number'];this['starttime']=_0x2672e[_0x5b26('0x10')];this['responsetime']=_0x2672e[_0x5b26('0x11')];this[_0x5b26('0x12')]=_0x2672e[_0x5b26('0x12')];this[_0x5b26('0x13')]=_0x2672e[_0x5b26('0x13')];this['endtime']=this[_0x5b26('0x12')];this[_0x5b26('0x14')]=utils['getSeconds'](_0x2672e[_0x5b26('0x11')],_0x2672e[_0x5b26('0x10')]);this[_0x5b26('0x15')]=utils[_0x5b26('0x16')](this[_0x5b26('0x12')],_0x2672e[_0x5b26('0x11')]);this[_0x5b26('0x17')]=0x0;this[_0x5b26('0x4')]=_0x149be4['queue'];this[_0x5b26('0x18')]=_0x149be4[_0x5b26('0x19')];this[_0x5b26('0x1a')]=_0x149be4[_0x5b26('0x1a')];this[_0x5b26('0x1b')]=_0x2672e[_0x5b26('0x1b')];this[_0x5b26('0x1c')]=_0x2672e[_0x5b26('0x1c')];this[_0x5b26('0x1d')]=_0x2672e[_0x5b26('0x1d')];this['recallme']=_0x2672e[_0x5b26('0x1e')];this[_0x5b26('0x1f')]=_0x2672e['ContactId'];this[_0x5b26('0x20')]=_0x2672e['ListId'];this[_0x5b26('0x21')]=_0x2672e['UserId'];this[_0x5b26('0x22')]=_0x2672e[_0x5b26('0x22')];this['CampaignId']=_0x2672e[_0x5b26('0x23')];this[_0x5b26('0x24')]=_0x2672e['originatecalleridnum']||'';this['originatecalleridname']=_0x2672e[_0x5b26('0x25')]||'';this[_0x5b26('0x26')]=_0x2672e[_0x5b26('0x26')];this[_0x5b26('0x27')]=_0x2672e[_0x5b26('0x27')];this[_0x5b26('0x28')]=_0x2672e['statedesc'];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index f321394..a641991 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0xf335a7,_0x7933f0){var _0x411ecd=function(_0x4e5e76){while(--_0x4e5e76){_0xf335a7['push'](_0xf335a7['shift']());}};_0x411ecd(++_0x7933f0);}(_0xb10b,0x12a));var _0xbb10=function(_0x177dc7,_0x13501c){_0x177dc7=_0x177dc7-0x0;var _0x19b7dc=_0xb10b[_0x177dc7];return _0x19b7dc;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0x4d2193,_0x262886){var _0x2218c3=function(_0x10e40c){while(--_0x10e40c){_0x4d2193['push'](_0x4d2193['shift']());}};_0x2218c3(++_0x262886);}(_0xb10b,0x12a));var _0xbb10=function(_0x4413cf,_0x3f70e8){_0x4413cf=_0x4413cf-0x0;var _0x9a1479=_0xb10b[_0x4413cf];return _0x9a1479;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 649094f..5d7c34a 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07f5=['getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','name','Trunk','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','SIP/','unmonitored','includes','status','TrunkBackup','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','INACTIVE','getQueueCampaignActiveStatusMessage','isUndefined','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x07f5,0x1ac));var _0x507f=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x07f5[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x507f('0x0'));var moment=require(_0x507f('0x1'));var util=require(_0x507f('0x2'));var logger=require(_0x507f('0x3'))(_0x507f('0x4'));var timezones=require(_0x507f('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x507f('0x6'),'BLACKLIST':_0x507f('0x7'),'CONTACTS_RESCHEDULED':_0x507f('0x8'),'DEACTIVATED':_0x507f('0x9'),'DISACTIVED':_0x507f('0xa'),'EMPTY_INTERVAL':_0x507f('0xb'),'INACTIVE':_0x507f('0xc'),'NO_AGENTS_LOGGED':_0x507f('0xd'),'NO_AVAILABLE_CONTACTS':_0x507f('0xe'),'NULL_INTERVAL':_0x507f('0xf'),'OVERTIME_INTERVAL':_0x507f('0x10'),'OVERTIME_GLOBAL_INTERVAL':_0x507f('0x11'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x507f('0x12'),'RUNNING':_0x507f('0x13'),'UNKNOWN_TIMEZONE':_0x507f('0x14'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x507f('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1aafd1){return _0x1aafd1[_0x507f('0x16')]===_0x507f('0x17');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x15495f){return _0x15495f[_0x507f('0x18')]===_0x507f('0x19');}exports[_0x507f('0x1a')]=isIVRCampaign;function isOutboundQueue(_0x31740a){return _0x31740a[_0x507f('0x18')]==='outbound';}exports[_0x507f('0x1b')]=isOutboundQueue;function isQueueCampaignActive(_0xac9d57){return _0xac9d57[_0x507f('0x1c')];}exports[_0x507f('0x1d')]=isQueueCampaignActive;function isIVRCampaignActive(_0x38802a){return _0x38802a[_0x507f('0x1e')];}exports[_0x507f('0x1f')]=isIVRCampaignActive;function getSeconds(_0x908937,_0x248d05){var _0x114a3b=moment(_0x908937)[_0x507f('0x20')](0x0);var _0x517a0a=moment(_0x248d05)['milliseconds'](0x0);return _0x114a3b['diff'](_0x517a0a,'seconds');}exports[_0x507f('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x633f9b,_0x2ba766){var _0xbcfd23=![];var _0x283b96=_0x633f9b[_0x507f('0x16')]!==_0x2ba766['dialMethod']||_0x633f9b[_0x507f('0x1c')]!==_0x2ba766['dialActive']||_0x633f9b['message']!==_0x2ba766[_0x507f('0x22')];var _0x500943=_0x633f9b['available']!==_0x2ba766[_0x507f('0x23')]||_0x633f9b[_0x507f('0x24')]!==_0x2ba766[_0x507f('0x24')]||_0x633f9b[_0x507f('0x25')]!==_0x2ba766[_0x507f('0x25')]||_0x633f9b[_0x507f('0x26')]!==_0x2ba766['paused']||_0x633f9b['talking']!==_0x2ba766[_0x507f('0x27')]||_0x633f9b[_0x507f('0x28')]!==_0x2ba766[_0x507f('0x28')]||_0x633f9b['waiting']!==_0x2ba766[_0x507f('0x29')]||_0x633f9b[_0x507f('0x2a')]!==_0x2ba766['inUse']||_0x633f9b[_0x507f('0x2b')]!==_0x2ba766['originated'];if(_0x633f9b['Trunk']&&_0x2ba766['Trunk']){_0xbcfd23=_0x633f9b['Trunk']['name']!==_0x2ba766['Trunk'][_0x507f('0x2c')]||_0x633f9b[_0x507f('0x2d')]['active']!==_0x2ba766[_0x507f('0x2d')][_0x507f('0x1e')];}return _0x283b96||_0x500943||_0xbcfd23;}exports[_0x507f('0x2e')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1cd03d){var _0x2cd69b=null;var _0x542631=_0x1cd03d[_0x507f('0x2f')];if(_[_0x507f('0x30')](_0x1cd03d[_0x507f('0x31')])||_[_0x507f('0x30')](_0x1cd03d[_0x507f('0x32')])||_[_0x507f('0x30')](_0x1cd03d['Interval']['Intervals'])){_0x2cd69b=CAMPAIGN_STATUS[_0x507f('0x33')];}else if(_[_0x507f('0x34')](_0x1cd03d[_0x507f('0x31')])||_['isEmpty'](_0x1cd03d[_0x507f('0x32')][_0x507f('0x35')])){_0x2cd69b=CAMPAIGN_STATUS[_0x507f('0x36')];}else if(_0x542631&&!timezones[_0x542631]){_0x2cd69b=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x2cd69b;}function checkAnyValidTrunk(_0x3cbd44,_0xc5b23d){var _0x3f3c56=null;var _0x373c18=_0x507f('0x37');var _0x242574=['reachable',_0x507f('0x38')];var _0x50e9b0=!![];if(_0x3cbd44[_0x507f('0x2d')]&&_0x3cbd44[_0x507f('0x2d')]['active']){_0x373c18+=_0x3cbd44[_0x507f('0x2d')][_0x507f('0x2c')];_0x3f3c56=_0xc5b23d[_0x373c18];_0x50e9b0=_0x242574[_0x507f('0x39')](_0x3f3c56[_0x507f('0x3a')]);}else if(_0x3cbd44[_0x507f('0x3b')]&&_0x3cbd44['TrunkBackup'][_0x507f('0x1e')]){_0x373c18+=_0x3cbd44[_0x507f('0x3b')][_0x507f('0x2c')];_0x3f3c56=_0xc5b23d[_0x373c18];_0x50e9b0=_0x242574[_0x507f('0x39')](_0x3f3c56[_0x507f('0x3a')]);}return _0x50e9b0;}function getQueueCampaignStatusMessage(_0x29a1ac,_0x136820){var _0xc1f158=CAMPAIGN_STATUS['ACTIVE'];var _0x13b931=isPreviewCampaign(_0x29a1ac);if(!isQueueCampaignActive(_0x29a1ac)){if(_0x13b931){_0xc1f158=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x29a1ac[_0x507f('0x2b')]===0x0&&_0x29a1ac['talking']===0x0&&_0x29a1ac[_0x507f('0x29')]===0x0&&(_0x29a1ac['pTalking']||0x0)===0x0){_0xc1f158=CAMPAIGN_STATUS['INACTIVE'];}else{_0xc1f158=CAMPAIGN_STATUS[_0x507f('0x3c')];}}}else if(_0x29a1ac[_0x507f('0x24')]===0x0){_0xc1f158=CAMPAIGN_STATUS[_0x507f('0x3d')];}else if(!checkAnyValidTrunk(_0x29a1ac,_0x136820)){_0xc1f158=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x29a1ac)){var _0x4f9d66=checkAnyValidQueueCampaignInterval(_0x29a1ac);if(_0x4f9d66){_0xc1f158=_0x4f9d66;}}return _0xc1f158;}exports[_0x507f('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1afe58){var _0x3d0108=CAMPAIGN_STATUS['DISACTIVED'];if(_0x1afe58[_0x507f('0x2b')]===0x0&&_0x1afe58[_0x507f('0x27')]===0x0&&_0x1afe58[_0x507f('0x29')]===0x0&&(_0x1afe58[_0x507f('0x28')]||0x0)===0x0){_0x3d0108=CAMPAIGN_STATUS[_0x507f('0x3f')];}return _0x3d0108;}exports[_0x507f('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x34c468){var _0x2f761b=_0x34c468['match'](/"(.*?)"/);return _0x2f761b?_0x2f761b[0x1]:_0x34c468;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x5d5b39,_0xf98cae,_0x5a6b67){if(!_['isUndefined'](_0x5a6b67)&&typeof _0x5a6b67==='string'&&!_['isEmpty'](_0x5a6b67)){if(!_[_0x507f('0x41')](_0xf98cae)&&typeof _0xf98cae==='string'&&!_[_0x507f('0x34')](_0xf98cae)){return util[_0x507f('0x42')](_0x507f('0x43'),_0xf98cae,_0x5a6b67);}return util[_0x507f('0x42')](_0x507f('0x43'),_0x5a6b67,_0x5a6b67);}if(!_[_0x507f('0x41')](_0x5d5b39)&&typeof _0x5d5b39===_0x507f('0x44')&&!_[_0x507f('0x34')](_0x5d5b39)){return _0x5d5b39;}return _0x507f('0x45');}exports[_0x507f('0x46')]=getCallerId;function getCallerIdRandom(_0x3ab9ab,_0x23553c){var _0x5bdfb1;var _0x4e419f;var _0x28a020;if(_0x23553c<=0x0){_0x23553c=0x1;}_0x5bdfb1=new RegExp(_0x507f('0x47')+_0x23553c+'}$');_0x4e419f=Math['pow'](0xa,_0x23553c-0x1);_0x28a020=Math[_0x507f('0x48')](0xa,_0x23553c)-0x1;return util[_0x507f('0x42')]('%s',_[_0x507f('0x49')](_0x3ab9ab,_0x5bdfb1,_[_0x507f('0x4a')](_0x4e419f,_0x28a020)[_0x507f('0x4b')]()));}exports[_0x507f('0x4c')]=getCallerIdRandom;function decrementOriginate(_0x436205){if(_0x436205[_0x507f('0x2b')]&&_0x436205[_0x507f('0x2b')]>0x0){_0x436205[_0x507f('0x2b')]-=0x1;}else{logger[_0x507f('0x4d')](_0x507f('0x4e'));}}exports[_0x507f('0x4f')]=decrementOriginate;function checkContactEmpty(_0x13ee4a){return _0x13ee4a&&_0x13ee4a[_0x507f('0x50')]>0x0;}exports[_0x507f('0x51')]=checkContactEmpty;function erlangb(_0x3e18d6,_0x4cbc19){if(_0x4cbc19===0x0){return 0x0;}var _0x41a624=0x1;for(var _0x4c1f70=0x1;_0x4c1f70<=_0x4cbc19;_0x4c1f70+=0x1){_0x41a624=0x1+_0x41a624*_0x4c1f70/_0x3e18d6;}return 0x1/_0x41a624;}exports[_0x507f('0x52')]=erlangb;function checkContactLowerLimitOriginate(_0x89dd65,_0x114bf1,_0x40c7ba){if(_0x114bf1>_0x40c7ba){for(var _0x1a9c96=0x0;_0x1a9c96<_0x114bf1-_0x40c7ba;_0x1a9c96+=0x1){decrementOriginate(_0x89dd65);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate; \ No newline at end of file +var _0xab66=['erlangb','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','Trunk','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','unmonitored','name','includes','status','TrunkBackup','originated','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty'];(function(_0x4e8286,_0x4eaeb4){var _0x44a440=function(_0x5e0907){while(--_0x5e0907){_0x4e8286['push'](_0x4e8286['shift']());}};_0x44a440(++_0x4eaeb4);}(_0xab66,0x19c));var _0x6ab6=function(_0x3eb188,_0x460bb4){_0x3eb188=_0x3eb188-0x0;var _0x417946=_0xab66[_0x3eb188];return _0x417946;};'use strict';var _=require(_0x6ab6('0x0'));var moment=require(_0x6ab6('0x1'));var util=require(_0x6ab6('0x2'));var logger=require(_0x6ab6('0x3'))(_0x6ab6('0x4'));var timezones=require(_0x6ab6('0x5'))[_0x6ab6('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x6ab6('0x7'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x6ab6('0x8'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x6ab6('0x9'),'EMPTY_INTERVAL':_0x6ab6('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x6ab6('0xb'),'NO_AVAILABLE_CONTACTS':_0x6ab6('0xc'),'NULL_INTERVAL':_0x6ab6('0xd'),'OVERTIME_INTERVAL':_0x6ab6('0xe'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x6ab6('0xf'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x6ab6('0x10'),'UNKNOWN_TIMEZONE':_0x6ab6('0x11'),'UNREACHABLE_TRUNK':_0x6ab6('0x12')};exports[_0x6ab6('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x40c777){return _0x40c777[_0x6ab6('0x14')]===_0x6ab6('0x15');}exports[_0x6ab6('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x4dee7e){return _0x4dee7e[_0x6ab6('0x17')]===_0x6ab6('0x18');}exports[_0x6ab6('0x19')]=isIVRCampaign;function isOutboundQueue(_0x1b9ca4){return _0x1b9ca4[_0x6ab6('0x17')]===_0x6ab6('0x1a');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x320a96){return _0x320a96[_0x6ab6('0x1b')];}exports[_0x6ab6('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4f28ab){return _0x4f28ab[_0x6ab6('0x1d')];}exports[_0x6ab6('0x1e')]=isIVRCampaignActive;function getSeconds(_0x3c72cc,_0x55dedf){var _0x4b92f6=moment(_0x3c72cc)[_0x6ab6('0x1f')](0x0);var _0x35f5c8=moment(_0x55dedf)[_0x6ab6('0x1f')](0x0);return _0x4b92f6[_0x6ab6('0x20')](_0x35f5c8,_0x6ab6('0x21'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0xb93020,_0x3c2e61){var _0x1d96a4=![];var _0x4ac1c4=_0xb93020[_0x6ab6('0x14')]!==_0x3c2e61[_0x6ab6('0x14')]||_0xb93020['dialActive']!==_0x3c2e61[_0x6ab6('0x1b')]||_0xb93020[_0x6ab6('0x22')]!==_0x3c2e61[_0x6ab6('0x22')];var _0x42c79f=_0xb93020[_0x6ab6('0x23')]!==_0x3c2e61['available']||_0xb93020[_0x6ab6('0x24')]!==_0x3c2e61['loggedIn']||_0xb93020['loggedInDb']!==_0x3c2e61[_0x6ab6('0x25')]||_0xb93020[_0x6ab6('0x26')]!==_0x3c2e61[_0x6ab6('0x26')]||_0xb93020[_0x6ab6('0x27')]!==_0x3c2e61[_0x6ab6('0x27')]||_0xb93020['pTalking']!==_0x3c2e61[_0x6ab6('0x28')]||_0xb93020[_0x6ab6('0x29')]!==_0x3c2e61[_0x6ab6('0x29')]||_0xb93020['inUse']!==_0x3c2e61[_0x6ab6('0x2a')]||_0xb93020['originated']!==_0x3c2e61['originated'];if(_0xb93020['Trunk']&&_0x3c2e61[_0x6ab6('0x2b')]){_0x1d96a4=_0xb93020[_0x6ab6('0x2b')]['name']!==_0x3c2e61[_0x6ab6('0x2b')]['name']||_0xb93020[_0x6ab6('0x2b')][_0x6ab6('0x1d')]!==_0x3c2e61[_0x6ab6('0x2b')][_0x6ab6('0x1d')];}return _0x4ac1c4||_0x42c79f||_0x1d96a4;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x16aaba){var _0x857cfc=null;var _0x47c98f=_0x16aaba[_0x6ab6('0x2c')];if(_[_0x6ab6('0x2d')](_0x16aaba[_0x6ab6('0x2e')])||_[_0x6ab6('0x2d')](_0x16aaba['Interval'])||_[_0x6ab6('0x2d')](_0x16aaba[_0x6ab6('0x2f')][_0x6ab6('0x30')])){_0x857cfc=CAMPAIGN_STATUS[_0x6ab6('0x31')];}else if(_['isEmpty'](_0x16aaba[_0x6ab6('0x2e')])||_['isEmpty'](_0x16aaba[_0x6ab6('0x2f')]['Intervals'])){_0x857cfc=CAMPAIGN_STATUS[_0x6ab6('0x32')];}else if(_0x47c98f&&!timezones[_0x47c98f]){_0x857cfc=CAMPAIGN_STATUS[_0x6ab6('0x33')];}return _0x857cfc;}function checkAnyValidTrunk(_0x2fb85e,_0x4db1bb){var _0x27c489=null;var _0x13e6e6='SIP/';var _0x50a0dc=['reachable',_0x6ab6('0x34')];var _0x4eb7da=!![];if(_0x2fb85e['Trunk']&&_0x2fb85e[_0x6ab6('0x2b')][_0x6ab6('0x1d')]){_0x13e6e6+=_0x2fb85e[_0x6ab6('0x2b')][_0x6ab6('0x35')];_0x27c489=_0x4db1bb[_0x13e6e6];_0x4eb7da=_0x50a0dc[_0x6ab6('0x36')](_0x27c489[_0x6ab6('0x37')]);}else if(_0x2fb85e[_0x6ab6('0x38')]&&_0x2fb85e[_0x6ab6('0x38')][_0x6ab6('0x1d')]){_0x13e6e6+=_0x2fb85e[_0x6ab6('0x38')][_0x6ab6('0x35')];_0x27c489=_0x4db1bb[_0x13e6e6];_0x4eb7da=_0x50a0dc[_0x6ab6('0x36')](_0x27c489[_0x6ab6('0x37')]);}return _0x4eb7da;}function getQueueCampaignStatusMessage(_0x7e1e31,_0x4004c0){var _0x26da19=CAMPAIGN_STATUS['ACTIVE'];var _0x5e0253=isPreviewCampaign(_0x7e1e31);if(!isQueueCampaignActive(_0x7e1e31)){if(_0x5e0253){_0x26da19=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x7e1e31[_0x6ab6('0x39')]===0x0&&_0x7e1e31[_0x6ab6('0x27')]===0x0&&_0x7e1e31[_0x6ab6('0x29')]===0x0&&(_0x7e1e31[_0x6ab6('0x28')]||0x0)===0x0){_0x26da19=CAMPAIGN_STATUS[_0x6ab6('0x3a')];}else{_0x26da19=CAMPAIGN_STATUS[_0x6ab6('0x3b')];}}}else if(_0x7e1e31['loggedIn']===0x0){_0x26da19=CAMPAIGN_STATUS[_0x6ab6('0x3c')];}else if(!checkAnyValidTrunk(_0x7e1e31,_0x4004c0)){_0x26da19=CAMPAIGN_STATUS[_0x6ab6('0x3d')];}else if(!isPreviewCampaign(_0x7e1e31)){var _0x1736e4=checkAnyValidQueueCampaignInterval(_0x7e1e31);if(_0x1736e4){_0x26da19=_0x1736e4;}}return _0x26da19;}exports[_0x6ab6('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x56c48d){var _0x508aa1=CAMPAIGN_STATUS[_0x6ab6('0x3b')];if(_0x56c48d[_0x6ab6('0x39')]===0x0&&_0x56c48d[_0x6ab6('0x27')]===0x0&&_0x56c48d[_0x6ab6('0x29')]===0x0&&(_0x56c48d[_0x6ab6('0x28')]||0x0)===0x0){_0x508aa1=CAMPAIGN_STATUS[_0x6ab6('0x3a')];}return _0x508aa1;}exports[_0x6ab6('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4f2d7f){var _0x592df5=_0x4f2d7f[_0x6ab6('0x40')](/"(.*?)"/);return _0x592df5?_0x592df5[0x1]:_0x4f2d7f;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0xcab0eb,_0x202794,_0x40bc84){if(!_[_0x6ab6('0x41')](_0x40bc84)&&typeof _0x40bc84===_0x6ab6('0x42')&&!_[_0x6ab6('0x43')](_0x40bc84)){if(!_[_0x6ab6('0x41')](_0x202794)&&typeof _0x202794===_0x6ab6('0x42')&&!_[_0x6ab6('0x43')](_0x202794)){return util[_0x6ab6('0x44')](_0x6ab6('0x45'),_0x202794,_0x40bc84);}return util[_0x6ab6('0x44')](_0x6ab6('0x45'),_0x40bc84,_0x40bc84);}if(!_[_0x6ab6('0x41')](_0xcab0eb)&&typeof _0xcab0eb===_0x6ab6('0x42')&&!_[_0x6ab6('0x43')](_0xcab0eb)){return _0xcab0eb;}return _0x6ab6('0x46');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x554c5e,_0x54eef6){var _0x4ab905;var _0x250adc;var _0x4f6b89;if(_0x54eef6<=0x0){_0x54eef6=0x1;}_0x4ab905=new RegExp(_0x6ab6('0x47')+_0x54eef6+'}$');_0x250adc=Math[_0x6ab6('0x48')](0xa,_0x54eef6-0x1);_0x4f6b89=Math[_0x6ab6('0x48')](0xa,_0x54eef6)-0x1;return util[_0x6ab6('0x44')]('%s',_[_0x6ab6('0x49')](_0x554c5e,_0x4ab905,_[_0x6ab6('0x4a')](_0x250adc,_0x4f6b89)['toString']()));}exports[_0x6ab6('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x9c1f80){if(_0x9c1f80['originated']&&_0x9c1f80[_0x6ab6('0x39')]>0x0){_0x9c1f80[_0x6ab6('0x39')]-=0x1;}else{logger[_0x6ab6('0x4c')](_0x6ab6('0x4d'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x5b8361){return _0x5b8361&&_0x5b8361[_0x6ab6('0x4e')]>0x0;}exports[_0x6ab6('0x4f')]=checkContactEmpty;function erlangb(_0x1c8120,_0x52a479){if(_0x52a479===0x0){return 0x0;}var _0xd3ef31=0x1;for(var _0x50d7d4=0x1;_0x50d7d4<=_0x52a479;_0x50d7d4+=0x1){_0xd3ef31=0x1+_0xd3ef31*_0x50d7d4/_0x1c8120;}return 0x1/_0xd3ef31;}exports[_0x6ab6('0x50')]=erlangb;function checkContactLowerLimitOriginate(_0x35ee66,_0x11724c,_0x4c74dc){if(_0x11724c>_0x4c74dc){for(var _0x4cd506=0x0;_0x4cd506<_0x11724c-_0x4c74dc;_0x4cd506+=0x1){decrementOriginate(_0x35ee66);}}}exports[_0x6ab6('0x51')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 88ab7a6..730c1d3 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(_0x1d4d67,_0x5c92b6){var _0x9fd1fb=function(_0x44d9e9){while(--_0x44d9e9){_0x1d4d67['push'](_0x1d4d67['shift']());}};_0x9fd1fb(++_0x5c92b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x4b9fb6,_0x50960c){var _0x292183=function(_0x3cf9b6){while(--_0x3cf9b6){_0x4b9fb6['push'](_0x4b9fb6['shift']());}};_0x292183(++_0x50960c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 55649a5..5d76789 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 _0xff5b=['./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','faxAccounts','localstationid','channel','channels','uniqueid','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','pick','response','AttachmentId','update','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','bluebird','uuid','moment','path','tiff2pdf'];(function(_0x2fb68e,_0x179697){var _0x4b33ef=function(_0x421103){while(--_0x421103){_0x2fb68e['push'](_0x2fb68e['shift']());}};_0x4b33ef(++_0x179697);}(_0xff5b,0xe0));var _0xbff5=function(_0x31bd9e,_0x1842cf){_0x31bd9e=_0x31bd9e-0x0;var _0x9989ab=_0xff5b[_0x31bd9e];return _0x9989ab;};'use strict';var util=require(_0xbff5('0x0'));var _=require('lodash');var BPromise=require(_0xbff5('0x1'));var uuid=require(_0xbff5('0x2'));var moment=require(_0xbff5('0x3'));var path=require(_0xbff5('0x4'));var tiff2pdf=require(_0xbff5('0x5'));var gs=require(_0xbff5('0x6'));var logger=require(_0xbff5('0x7'))(_0xbff5('0x8'));var ami=require(_0xbff5('0x9'));var rpcDb=require(_0xbff5('0xa'));var Channel=require(_0xbff5('0xb'));var ut=require(_0xbff5('0xc'));var Action=require('./action');var faxAccount=require(_0xbff5('0xd'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xbff5('0xe'));function Fax(_0x3164e7){this['channels']={};this['faxAccounts']=_0x3164e7['faxAccounts'];this[_0xbff5('0xf')]=_0x3164e7[_0xbff5('0xf')];this[_0xbff5('0x10')]={};ami['on']('newchannel',this[_0xbff5('0x11')][_0xbff5('0x12')](this));ami['on'](_0xbff5('0x13'),this[_0xbff5('0x14')][_0xbff5('0x12')](this));ami['on'](_0xbff5('0x15'),this[_0xbff5('0x16')][_0xbff5('0x12')](this));ami['on'](_0xbff5('0x17'),this[_0xbff5('0x18')][_0xbff5('0x12')](this));ami['on'](_0xbff5('0x19'),this[_0xbff5('0x1a')]['bind'](this));ami['on'](_0xbff5('0x1b'),this[_0xbff5('0x1c')][_0xbff5('0x12')](this));ami['on'](_0xbff5('0x1d'),this[_0xbff5('0x1e')][_0xbff5('0x12')](this));ami['on'](_0xbff5('0x1f'),this['syncOriginateResponse'][_0xbff5('0x12')](this));}Fax[_0xbff5('0x20')]['syncNewchannel']=function(_0x54717d){if(_0x54717d[_0xbff5('0x21')]===_0xbff5('0x22')){for(var _0x2ef6dd in this[_0xbff5('0x23')]){if(this[_0xbff5('0x23')]['hasOwnProperty'](_0x2ef6dd)){if(_0x54717d['exten']===this[_0xbff5('0x23')][_0x2ef6dd][_0xbff5('0x24')]){this['channels'][_0x54717d['uniqueid']]={};this['channels'][_0x54717d['uniqueid']]['channel']=_0x54717d[_0xbff5('0x25')];this[_0xbff5('0x26')][_0x54717d[_0xbff5('0x27')]]['id']=this['faxAccounts'][_0x2ef6dd]['id'];this['channels'][_0x54717d[_0xbff5('0x27')]]['name']=this[_0xbff5('0x23')][_0x2ef6dd][_0xbff5('0x28')];logger[_0xbff5('0x29')](_0x54717d[_0xbff5('0x27')],'\x20syncNewchannel\x20');}}}}if(this[_0xbff5('0x10')][_0x54717d[_0xbff5('0x27')]]){this[_0xbff5('0x26')][_0x54717d[_0xbff5('0x27')]]={};this[_0xbff5('0x26')][_0x54717d[_0xbff5('0x27')]]['channel']=_0x54717d['channel'];logger['info'](_0x54717d['uniqueid'],_0xbff5('0x2a'));}};Fax[_0xbff5('0x20')][_0xbff5('0x14')]=function(_0x11d818){if(this[_0xbff5('0x26')][_0x11d818['uniqueid']]){for(var _0x2f1056 in _0x11d818[_0xbff5('0x2b')]){if(_0x11d818[_0xbff5('0x2b')]['hasOwnProperty'](_0x2f1056)){this['channels'][_0x11d818['uniqueid']][_0x2f1056]=_0x11d818[_0xbff5('0x2c')];}}}};Fax[_0xbff5('0x20')][_0xbff5('0x16')]=function(_0x463ca8){if(this[_0xbff5('0x26')][_0x463ca8['uniqueid']]){this[_0xbff5('0x26')][_0x463ca8['uniqueid']]['channelstate']=_0x463ca8[_0xbff5('0x2d')];this[_0xbff5('0x26')][_0x463ca8[_0xbff5('0x27')]][_0xbff5('0x2e')]=_0x463ca8[_0xbff5('0x2e')];}};Fax[_0xbff5('0x20')]['syncNewExten']=function(_0x290139){if(this[_0xbff5('0x26')][_0x290139[_0xbff5('0x27')]]){for(var _0x2d8335 in _0x290139[_0xbff5('0x2b')]){if(_0x290139[_0xbff5('0x2b')]['hasOwnProperty'](_0x2d8335)){this[_0xbff5('0x26')][_0x290139[_0xbff5('0x27')]][_0x2d8335]=_0x290139[_0xbff5('0x2c')];}}}};Fax[_0xbff5('0x20')]['syncFaxStatus']=function(_0x1d4a40){if(this['channels'][_0x1d4a40[_0xbff5('0x27')]]){this['channels'][_0x1d4a40[_0xbff5('0x27')]]['operation']=_0x1d4a40[_0xbff5('0x2f')];this[_0xbff5('0x26')][_0x1d4a40[_0xbff5('0x27')]][_0xbff5('0x30')]=_0x1d4a40['status'];this[_0xbff5('0x26')][_0x1d4a40[_0xbff5('0x27')]][_0xbff5('0x24')]=_0x1d4a40['localstationid'];this['channels'][_0x1d4a40[_0xbff5('0x27')]]['filename']=_0x1d4a40[_0xbff5('0x31')];logger[_0xbff5('0x29')](_0x1d4a40[_0xbff5('0x27')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xbff5('0x1c')]=function(_0x5da458){var _0x562d1f=this;if(this[_0xbff5('0x26')][_0x5da458[_0xbff5('0x27')]]){var _0x2f805f=this[_0xbff5('0x26')][_0x5da458[_0xbff5('0x27')]]['id'];this[_0xbff5('0x26')][_0x5da458['uniqueid']]['remotestationid']=_0x5da458[_0xbff5('0x32')];this[_0xbff5('0x26')][_0x5da458[_0xbff5('0x27')]]['pagestransferred']=_0x5da458['pagestransferred'];this[_0xbff5('0x26')][_0x5da458[_0xbff5('0x27')]][_0xbff5('0x24')]=_0x5da458[_0xbff5('0x24')];this[_0xbff5('0x26')][_0x5da458['uniqueid']][_0xbff5('0x33')]=_0x5da458[_0xbff5('0x33')];this[_0xbff5('0x26')][_0x5da458[_0xbff5('0x27')]][_0xbff5('0x34')]=_0x5da458[_0xbff5('0x34')];this['channels'][_0x5da458[_0xbff5('0x27')]][_0xbff5('0x31')]=_0x5da458['filename'];this[_0xbff5('0x26')][_0x5da458['uniqueid']][_0xbff5('0x35')]=_0x5da458[_0xbff5('0x35')];if(this[_0xbff5('0x26')][_0x5da458[_0xbff5('0x27')]]['pagestransferred']>0x0){tiff2pdf(_0x5da458[_0xbff5('0x31')],_0xbff5('0x36'),function(_0x5c0a48){logger[_0xbff5('0x29')](_0x5da458[_0xbff5('0x27')],_0xbff5('0x37'),_0x5c0a48[_0xbff5('0x38')]);attachment['create']({'name':path[_0xbff5('0x39')](_0x5da458[_0xbff5('0x31')])[_0xbff5('0x28')],'basename':path[_0xbff5('0x39')](_0x5da458[_0xbff5('0x31')])[_0xbff5('0x28')]+_0xbff5('0x3a'),'type':_0xbff5('0x3b')})['then'](function(_0x4426c9){faxAccount[_0xbff5('0x3c')](_0x2f805f,{'from':_0x5da458[_0xbff5('0x35')],'mapKey':_0xbff5('0x8'),'body':path['parse'](_0x5da458[_0xbff5('0x31')])[_0xbff5('0x28')]+'.pdf','AttachmentId':_0x4426c9['id']})[_0xbff5('0x3d')](function(_0xef01d){logger['error'](_0x5da458[_0xbff5('0x27')],_0xbff5('0x3e'),JSON[_0xbff5('0x3f')](_0xef01d));});})['catch'](function(_0x6dfc31){logger[_0xbff5('0x40')](_0x5da458[_0xbff5('0x27')],'\x20receiveFax\x20',JSON[_0xbff5('0x3f')](_0x6dfc31));});});}logger[_0xbff5('0x29')](_0x5da458[_0xbff5('0x27')],_0xbff5('0x41'));}};Fax['prototype'][_0xbff5('0x42')]=function(_0x16813b){if(this['actions'][_0x16813b[_0xbff5('0x27')]]){_['merge'](this[_0xbff5('0x26')][_0x16813b[_0xbff5('0x27')]],_[_0xbff5('0x43')](_0x16813b,[_0xbff5('0x44'),'reason']));}};function updateStatus(_0x2b1aaa){if(_0x2b1aaa[_0xbff5('0x45')]){faxMessage[_0xbff5('0x46')](_0x2b1aaa[_0xbff5('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xbff5('0x47')](function(_0x1b5557){ut[_0xbff5('0x48')](_0xbff5('0x49'),_0x1b5557);})[_0xbff5('0x3d')](function(_0x5337a9){ut['logger'](_0xbff5('0x4a'),_0x5337a9);});}else{ut[_0xbff5('0x48')](_0xbff5('0x4b'));}}Fax[_0xbff5('0x20')][_0xbff5('0x4c')]=function(_0x51f4d3,_0x148879,_0xcb8b1f){var _0x336960=this;var _0x53d078={};if(_0x148879){_0x53d078={'read':_0x148879};}else{_0x53d078={'failMessage':_0xcb8b1f};}if(this[_0xbff5('0x10')][_0x51f4d3][_0xbff5('0x45')]){faxMessage[_0xbff5('0x46')](this[_0xbff5('0x10')][_0x51f4d3][_0xbff5('0x45')],_0x53d078)[_0xbff5('0x47')](function(_0x5d0db3){ut[_0xbff5('0x48')]('[Fax][Message][Updated]',_0x5d0db3);})[_0xbff5('0x3d')](function(_0x558b1f){ut['logger'](_0xbff5('0x4d'),_0x558b1f);})[_0xbff5('0x4e')](function(){delete _0x336960[_0xbff5('0x26')][_0x51f4d3];delete _0x336960[_0xbff5('0x10')][_0x51f4d3];});}else{ut[_0xbff5('0x48')]('[Fax][Message][NoUpdate2]');delete this[_0xbff5('0x26')][_0x51f4d3];delete this[_0xbff5('0x10')][_0x51f4d3];}};Fax[_0xbff5('0x20')][_0xbff5('0x1e')]=function(_0x11578f){var _0x4a8e1f=this;if(this['channels'][_0x11578f['uniqueid']]){if(this['actions'][_0x11578f[_0xbff5('0x27')]]){this['channels'][_0x11578f[_0xbff5('0x27')]]['id']=this['actions'][_0x11578f[_0xbff5('0x27')]]['id'];this['channels'][_0x11578f[_0xbff5('0x27')]][_0xbff5('0x28')]=this[_0xbff5('0x10')][_0x11578f[_0xbff5('0x27')]][_0xbff5('0x28')];}logger[_0xbff5('0x29')](_0x11578f[_0xbff5('0x27')],this[_0xbff5('0x10')][_0x11578f[_0xbff5('0x27')]]?_0xbff5('0x4f'):_0xbff5('0x50'),JSON[_0xbff5('0x3f')](this[_0xbff5('0x26')][_0x11578f[_0xbff5('0x27')]]));if(this[_0xbff5('0x10')][_0x11578f[_0xbff5('0x27')]]){if(this[_0xbff5('0x26')][_0x11578f[_0xbff5('0x27')]][_0xbff5('0x51')]>0x0&&this['channels'][_0x11578f['uniqueid']][_0xbff5('0x19')]==='SUCCESS'){this['updateStatus'](_0x11578f[_0xbff5('0x27')],!![]);}else{this[_0xbff5('0x4c')](_0x11578f[_0xbff5('0x27')],![],this['channels'][_0x11578f[_0xbff5('0x27')]]['faxstatusstring']?_0xbff5('0x52')+this[_0xbff5('0x26')][_0x11578f[_0xbff5('0x27')]][_0xbff5('0x53')]:_0xbff5('0x54'));}}}};Fax[_0xbff5('0x20')]['send']=function(_0x18fbf2){var _0x355b5b=this;return new BPromise(function(_0x2b1a1c,_0x1cede6){_0x355b5b[_0xbff5('0x55')](_0x18fbf2,_0x355b5b[_0xbff5('0x23')][_0x18fbf2[_0xbff5('0x56')]])[_0xbff5('0x47')](function(_0x408a37){ut[_0xbff5('0x48')](_0xbff5('0x57'),_0x408a37);_0x2b1a1c(ut[_0xbff5('0x38')](_0xbff5('0x58')));})[_0xbff5('0x3d')](function(_0x5602d0){ut['logger'](_0xbff5('0x59'),_0x5602d0);updateStatus(_0x18fbf2);_0x1cede6(ut['message']('Fax\x20failed'));});});};Fax['prototype'][_0xbff5('0x5a')]=function(_0x30fddb){var _0x2f2faf=this;return new BPromise(function(_0x422cc8,_0x2ea2e8){var _0x4e36ac=_0x2f2faf[_0xbff5('0x5b')](_0x2f2faf[_0xbff5('0x23')][_0x30fddb[_0xbff5('0x56')]][_0xbff5('0x5c')],_0x30fddb);if(_0x4e36ac[_0xbff5('0x5d')]){_0x422cc8(ut['message'](_0xbff5('0x5e')));}else{_0x2ea2e8(ut[_0xbff5('0x38')](_0x4e36ac[_0xbff5('0x38')]));}});};function originate(_0x3eefd6,_0x52ea39,_0x5f229c){return new BPromise(function(_0x580704,_0x2bef81){if(_0x5f229c){var _0x5d3f6d=util['format'](_0xbff5('0x5f'),path[_0xbff5('0x39')](_0x3eefd6['path'])['name'],_0x3eefd6[_0xbff5('0x4')]);gs['execute'](_0x5d3f6d)[_0xbff5('0x47')](function(){_0x3eefd6['path']=util[_0xbff5('0x60')](_0xbff5('0x61'),path['parse'](_0x3eefd6[_0xbff5('0x4')])[_0xbff5('0x62')],path['parse'](_0x3eefd6[_0xbff5('0x4')])['name']);_0x52ea39[_0xbff5('0x63')]=_0x3eefd6['path'];ut[_0xbff5('0x48')](_0xbff5('0x64'),'');ami[_0xbff5('0x65')](ut['variablesAction'](_0x3eefd6,_0x52ea39))['then'](function(_0x4d77b3){_0x580704(_0x4d77b3);})[_0xbff5('0x3d')](function(_0x29ce83){_0x2bef81(_0x29ce83);});})['catch'](function(_0x3a7ff1){_0x2bef81(_0x3a7ff1);});}else{ami[_0xbff5('0x65')](ut['variablesAction'](_0x3eefd6,_0x52ea39))[_0xbff5('0x47')](function(_0xf532d8){_0x580704(_0xf532d8);})[_0xbff5('0x3d')](function(_0x5ceb73){_0x2bef81(_0x5ceb73);});}});}Fax['prototype'][_0xbff5('0x55')]=function(_0x36171b,_0x39d20c){var _0x57d4e0=this;return new BPromise(function(_0x535a6a,_0x19f15c){var _0x116463=uuid['v4']();var _0x4963b6=ut[_0xbff5('0x66')](_0x36171b,_0x39d20c);_0x57d4e0[_0xbff5('0x10')][_0x116463]=new Action(_0x116463,_0x39d20c,_0x36171b);var _0x22f389=_0x57d4e0[_0xbff5('0x10')][_0x116463];if(path['parse'](_0x36171b['path'])[_0xbff5('0x67')]===_0xbff5('0x3a')){originate(_0x22f389,_0x4963b6,!![])['then'](function(_0x5139da){_0x535a6a(_0x5139da);})[_0xbff5('0x3d')](function(_0x3257f7){_0x19f15c(_0x3257f7);});}else{originate(_0x22f389,_0x4963b6,![])[_0xbff5('0x47')](function(_0x4d4a9a){_0x535a6a(_0x4d4a9a);})[_0xbff5('0x3d')](function(_0x48acaf){_0x19f15c(_0x48acaf);});}});};Fax[_0xbff5('0x20')][_0xbff5('0x68')]=function(_0x5c65bb){return!_[_0xbff5('0x69')](_0x5c65bb)&&!_[_0xbff5('0x69')](_0x5c65bb[_0xbff5('0x28')])&&!_[_0xbff5('0x69')](_0x5c65bb['active'])&&_0x5c65bb[_0xbff5('0x6a')]&&!_[_0xbff5('0x69')](this[_0xbff5('0xf')][util['format']('SIP/%s',_0x5c65bb['name'])])&&!_['isNil'](this['trunks'][util['format'](_0xbff5('0x6b'),_0x5c65bb[_0xbff5('0x28')])]['status'])&&(this['trunks'][util['format']('SIP/%s',_0x5c65bb[_0xbff5('0x28')])]['status']===_0xbff5('0x6c')||this[_0xbff5('0xf')][util[_0xbff5('0x60')](_0xbff5('0x6b'),_0x5c65bb['name'])][_0xbff5('0x30')]===_0xbff5('0x6d'));};Fax['prototype'][_0xbff5('0x5b')]=function(_0x1bbdf0,_0x145cee){if(!this[_0xbff5('0x68')](_0x1bbdf0)){ut[_0xbff5('0x48')](_0xbff5('0x6e'),_['isNil'](_0x1bbdf0)?'':_0x1bbdf0[_0xbff5('0x28')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xbff5('0x6f')};}if(_[_0xbff5('0x69')](_0x145cee[_0xbff5('0x8')])){ut[_0xbff5('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xbff5('0x3f')](_0x145cee));return{'isValid':![],'message':_0xbff5('0x70')};}if(_[_0xbff5('0x69')](_0x145cee['path'])){ut[_0xbff5('0x48')](_0xbff5('0x71'),JSON[_0xbff5('0x3f')](_0x145cee));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xbff5('0x72')]=Fax; \ No newline at end of file +var _0xde70=['reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','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','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','pick','response'];(function(_0x30c9ea,_0x178405){var _0x288e23=function(_0xb1c2e9){while(--_0xb1c2e9){_0x30c9ea['push'](_0x30c9ea['shift']());}};_0x288e23(++_0x178405);}(_0xde70,0x1a2));var _0x0de7=function(_0x2a50fc,_0x792726){_0x2a50fc=_0x2a50fc-0x0;var _0x5aa6a2=_0xde70[_0x2a50fc];return _0x5aa6a2;};'use strict';var util=require(_0x0de7('0x0'));var _=require(_0x0de7('0x1'));var BPromise=require(_0x0de7('0x2'));var uuid=require(_0x0de7('0x3'));var moment=require(_0x0de7('0x4'));var path=require(_0x0de7('0x5'));var tiff2pdf=require(_0x0de7('0x6'));var gs=require(_0x0de7('0x7'));var logger=require(_0x0de7('0x8'))(_0x0de7('0x9'));var ami=require(_0x0de7('0xa'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x0de7('0xb'));var Action=require(_0x0de7('0xc'));var faxAccount=require(_0x0de7('0xd'));var attachment=require(_0x0de7('0xe'));var faxMessage=require(_0x0de7('0xf'));function Fax(_0x3f75a5){this[_0x0de7('0x10')]={};this[_0x0de7('0x11')]=_0x3f75a5[_0x0de7('0x11')];this['trunks']=_0x3f75a5[_0x0de7('0x12')];this[_0x0de7('0x13')]={};ami['on'](_0x0de7('0x14'),this[_0x0de7('0x15')][_0x0de7('0x16')](this));ami['on'](_0x0de7('0x17'),this[_0x0de7('0x18')][_0x0de7('0x16')](this));ami['on'](_0x0de7('0x19'),this['syncNewState'][_0x0de7('0x16')](this));ami['on'](_0x0de7('0x1a'),this['syncNewExten'][_0x0de7('0x16')](this));ami['on'](_0x0de7('0x1b'),this[_0x0de7('0x1c')][_0x0de7('0x16')](this));ami['on'](_0x0de7('0x1d'),this[_0x0de7('0x1e')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x0de7('0x16')](this));ami['on'](_0x0de7('0x1f'),this[_0x0de7('0x20')]['bind'](this));}Fax[_0x0de7('0x21')][_0x0de7('0x15')]=function(_0x255aea){if(_0x255aea[_0x0de7('0x22')]===_0x0de7('0x23')){for(var _0x5c7989 in this[_0x0de7('0x11')]){if(this['faxAccounts'][_0x0de7('0x24')](_0x5c7989)){if(_0x255aea[_0x0de7('0x25')]===this[_0x0de7('0x11')][_0x5c7989][_0x0de7('0x26')]){this[_0x0de7('0x10')][_0x255aea[_0x0de7('0x27')]]={};this[_0x0de7('0x10')][_0x255aea[_0x0de7('0x27')]][_0x0de7('0x28')]=_0x255aea['channel'];this[_0x0de7('0x10')][_0x255aea['uniqueid']]['id']=this[_0x0de7('0x11')][_0x5c7989]['id'];this[_0x0de7('0x10')][_0x255aea[_0x0de7('0x27')]][_0x0de7('0x29')]=this['faxAccounts'][_0x5c7989][_0x0de7('0x29')];logger[_0x0de7('0x2a')](_0x255aea[_0x0de7('0x27')],_0x0de7('0x2b'));}}}}if(this[_0x0de7('0x13')][_0x255aea[_0x0de7('0x27')]]){this[_0x0de7('0x10')][_0x255aea[_0x0de7('0x27')]]={};this[_0x0de7('0x10')][_0x255aea[_0x0de7('0x27')]][_0x0de7('0x28')]=_0x255aea[_0x0de7('0x28')];logger[_0x0de7('0x2a')](_0x255aea[_0x0de7('0x27')],_0x0de7('0x2b'));}};Fax[_0x0de7('0x21')][_0x0de7('0x18')]=function(_0x12bf29){if(this[_0x0de7('0x10')][_0x12bf29[_0x0de7('0x27')]]){for(var _0x1cde02 in _0x12bf29['variable']){if(_0x12bf29[_0x0de7('0x2c')][_0x0de7('0x24')](_0x1cde02)){this['channels'][_0x12bf29[_0x0de7('0x27')]][_0x1cde02]=_0x12bf29[_0x0de7('0x2d')];}}}};Fax[_0x0de7('0x21')]['syncNewState']=function(_0x107393){if(this[_0x0de7('0x10')][_0x107393['uniqueid']]){this[_0x0de7('0x10')][_0x107393[_0x0de7('0x27')]][_0x0de7('0x2e')]=_0x107393[_0x0de7('0x2e')];this[_0x0de7('0x10')][_0x107393['uniqueid']][_0x0de7('0x2f')]=_0x107393[_0x0de7('0x2f')];}};Fax[_0x0de7('0x21')][_0x0de7('0x30')]=function(_0x47e5b2){if(this['channels'][_0x47e5b2['uniqueid']]){for(var _0x2ec215 in _0x47e5b2['variable']){if(_0x47e5b2[_0x0de7('0x2c')]['hasOwnProperty'](_0x2ec215)){this[_0x0de7('0x10')][_0x47e5b2[_0x0de7('0x27')]][_0x2ec215]=_0x47e5b2[_0x0de7('0x2d')];}}}};Fax['prototype'][_0x0de7('0x1c')]=function(_0x1e7abc){if(this['channels'][_0x1e7abc[_0x0de7('0x27')]]){this[_0x0de7('0x10')][_0x1e7abc[_0x0de7('0x27')]][_0x0de7('0x31')]=_0x1e7abc[_0x0de7('0x31')];this[_0x0de7('0x10')][_0x1e7abc[_0x0de7('0x27')]][_0x0de7('0x32')]=_0x1e7abc[_0x0de7('0x32')];this[_0x0de7('0x10')][_0x1e7abc['uniqueid']][_0x0de7('0x26')]=_0x1e7abc[_0x0de7('0x26')];this[_0x0de7('0x10')][_0x1e7abc[_0x0de7('0x27')]][_0x0de7('0x33')]=_0x1e7abc[_0x0de7('0x33')];logger['info'](_0x1e7abc['uniqueid'],_0x0de7('0x34'));}};Fax[_0x0de7('0x21')][_0x0de7('0x1e')]=function(_0x55382c){var _0x714b8a=this;if(this[_0x0de7('0x10')][_0x55382c['uniqueid']]){var _0x5ad61c=this[_0x0de7('0x10')][_0x55382c[_0x0de7('0x27')]]['id'];this[_0x0de7('0x10')][_0x55382c['uniqueid']]['remotestationid']=_0x55382c[_0x0de7('0x35')];this[_0x0de7('0x10')][_0x55382c[_0x0de7('0x27')]]['pagestransferred']=_0x55382c[_0x0de7('0x36')];this['channels'][_0x55382c[_0x0de7('0x27')]][_0x0de7('0x26')]=_0x55382c[_0x0de7('0x26')];this[_0x0de7('0x10')][_0x55382c[_0x0de7('0x27')]][_0x0de7('0x37')]=_0x55382c['resolution'];this[_0x0de7('0x10')][_0x55382c[_0x0de7('0x27')]][_0x0de7('0x38')]=_0x55382c[_0x0de7('0x38')];this[_0x0de7('0x10')][_0x55382c[_0x0de7('0x27')]][_0x0de7('0x33')]=_0x55382c[_0x0de7('0x33')];this[_0x0de7('0x10')][_0x55382c[_0x0de7('0x27')]][_0x0de7('0x39')]=_0x55382c[_0x0de7('0x39')];if(this['channels'][_0x55382c[_0x0de7('0x27')]]['pagestransferred']>0x0){tiff2pdf(_0x55382c[_0x0de7('0x33')],_0x0de7('0x3a'),function(_0x1f8793){logger[_0x0de7('0x2a')](_0x55382c[_0x0de7('0x27')],'\x20result\x20conversion\x20file\x20',_0x1f8793[_0x0de7('0x3b')]);attachment[_0x0de7('0x3c')]({'name':path['parse'](_0x55382c[_0x0de7('0x33')])[_0x0de7('0x29')],'basename':path[_0x0de7('0x3d')](_0x55382c[_0x0de7('0x33')])[_0x0de7('0x29')]+_0x0de7('0x3e'),'type':'application/pdf'})['then'](function(_0x49bf5f){faxAccount['notify'](_0x5ad61c,{'from':_0x55382c[_0x0de7('0x39')],'mapKey':'fax','body':path['parse'](_0x55382c[_0x0de7('0x33')])[_0x0de7('0x29')]+'.pdf','AttachmentId':_0x49bf5f['id']})[_0x0de7('0x3f')](function(_0x29f218){logger['error'](_0x55382c[_0x0de7('0x27')],_0x0de7('0x40'),JSON[_0x0de7('0x41')](_0x29f218));});})[_0x0de7('0x3f')](function(_0x1a1f5e){logger[_0x0de7('0x42')](_0x55382c[_0x0de7('0x27')],_0x0de7('0x43'),JSON[_0x0de7('0x41')](_0x1a1f5e));});});}logger[_0x0de7('0x2a')](_0x55382c[_0x0de7('0x27')],_0x0de7('0x43'));}};Fax[_0x0de7('0x21')][_0x0de7('0x20')]=function(_0x4e7c19){if(this[_0x0de7('0x13')][_0x4e7c19[_0x0de7('0x27')]]){_['merge'](this['channels'][_0x4e7c19[_0x0de7('0x27')]],_[_0x0de7('0x44')](_0x4e7c19,[_0x0de7('0x45'),_0x0de7('0x46')]));}};function updateStatus(_0x316221){if(_0x316221[_0x0de7('0x47')]){faxMessage[_0x0de7('0x48')](_0x316221['AttachmentId'],{'failMessage':_0x0de7('0x49')})[_0x0de7('0x4a')](function(_0x4bb059){ut[_0x0de7('0x4b')]('[Fax][Message][Error][Updated]',_0x4bb059);})[_0x0de7('0x3f')](function(_0x38c156){ut[_0x0de7('0x4b')](_0x0de7('0x4c'),_0x38c156);});}else{ut[_0x0de7('0x4b')](_0x0de7('0x4d'));}}Fax['prototype'][_0x0de7('0x4e')]=function(_0x3e90a0,_0x39d031,_0x1fc687){var _0x27d24e=this;var _0x545a6d={};if(_0x39d031){_0x545a6d={'read':_0x39d031};}else{_0x545a6d={'failMessage':_0x1fc687};}if(this['actions'][_0x3e90a0][_0x0de7('0x47')]){faxMessage[_0x0de7('0x48')](this[_0x0de7('0x13')][_0x3e90a0][_0x0de7('0x47')],_0x545a6d)[_0x0de7('0x4a')](function(_0x2c8b2d){ut[_0x0de7('0x4b')](_0x0de7('0x4f'),_0x2c8b2d);})[_0x0de7('0x3f')](function(_0x4d75b9){ut[_0x0de7('0x4b')]('[Fax][Message][NoUpdate1]',_0x4d75b9);})[_0x0de7('0x50')](function(){delete _0x27d24e[_0x0de7('0x10')][_0x3e90a0];delete _0x27d24e['actions'][_0x3e90a0];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x0de7('0x10')][_0x3e90a0];delete this[_0x0de7('0x13')][_0x3e90a0];}};Fax[_0x0de7('0x21')][_0x0de7('0x51')]=function(_0x3ca8fa){var _0x5f585f=this;if(this[_0x0de7('0x10')][_0x3ca8fa[_0x0de7('0x27')]]){if(this[_0x0de7('0x13')][_0x3ca8fa['uniqueid']]){this[_0x0de7('0x10')][_0x3ca8fa[_0x0de7('0x27')]]['id']=this['actions'][_0x3ca8fa['uniqueid']]['id'];this[_0x0de7('0x10')][_0x3ca8fa[_0x0de7('0x27')]][_0x0de7('0x29')]=this[_0x0de7('0x13')][_0x3ca8fa[_0x0de7('0x27')]][_0x0de7('0x29')];}logger[_0x0de7('0x2a')](_0x3ca8fa[_0x0de7('0x27')],this[_0x0de7('0x13')][_0x3ca8fa[_0x0de7('0x27')]]?_0x0de7('0x52'):_0x0de7('0x53'),JSON[_0x0de7('0x41')](this[_0x0de7('0x10')][_0x3ca8fa[_0x0de7('0x27')]]));if(this[_0x0de7('0x13')][_0x3ca8fa['uniqueid']]){if(this[_0x0de7('0x10')][_0x3ca8fa['uniqueid']][_0x0de7('0x54')]>0x0&&this[_0x0de7('0x10')][_0x3ca8fa[_0x0de7('0x27')]][_0x0de7('0x1b')]===_0x0de7('0x55')){this[_0x0de7('0x4e')](_0x3ca8fa[_0x0de7('0x27')],!![]);}else{this[_0x0de7('0x4e')](_0x3ca8fa['uniqueid'],![],this['channels'][_0x3ca8fa[_0x0de7('0x27')]][_0x0de7('0x56')]?_0x0de7('0x57')+this['channels'][_0x3ca8fa[_0x0de7('0x27')]][_0x0de7('0x56')]:_0x0de7('0x58'));}}}};Fax[_0x0de7('0x21')][_0x0de7('0x59')]=function(_0x3a1e96){var _0x4e96c0=this;return new BPromise(function(_0x478508,_0x2c9b25){_0x4e96c0[_0x0de7('0x5a')](_0x3a1e96,_0x4e96c0[_0x0de7('0x11')][_0x3a1e96[_0x0de7('0x5b')]])[_0x0de7('0x4a')](function(_0x3458c1){ut[_0x0de7('0x4b')]('[Fax][execOriginate][success]',_0x3458c1);_0x478508(ut[_0x0de7('0x3b')](_0x0de7('0x5c')));})[_0x0de7('0x3f')](function(_0x7ce656){ut[_0x0de7('0x4b')](_0x0de7('0x5d'),_0x7ce656);updateStatus(_0x3a1e96);_0x2c9b25(ut['message'](_0x0de7('0x5e')));});});};Fax['prototype'][_0x0de7('0x5f')]=function(_0xcdb162){var _0x16ae87=this;return new BPromise(function(_0x4f43a7,_0x53f39a){var _0xe27d4b=_0x16ae87[_0x0de7('0x60')](_0x16ae87[_0x0de7('0x11')][_0xcdb162[_0x0de7('0x5b')]][_0x0de7('0x61')],_0xcdb162);if(_0xe27d4b[_0x0de7('0x62')]){_0x4f43a7(ut[_0x0de7('0x3b')](_0x0de7('0x63')));}else{_0x53f39a(ut[_0x0de7('0x3b')](_0xe27d4b['message']));}});};function originate(_0x3ec9cb,_0xc3f1dd,_0x392877){return new BPromise(function(_0x5eb639,_0x362d1a){if(_0x392877){var _0x34daeb=util[_0x0de7('0x64')](_0x0de7('0x65'),path[_0x0de7('0x3d')](_0x3ec9cb[_0x0de7('0x5')])[_0x0de7('0x29')],_0x3ec9cb[_0x0de7('0x5')]);gs['execute'](_0x34daeb)[_0x0de7('0x4a')](function(){_0x3ec9cb[_0x0de7('0x5')]=util[_0x0de7('0x64')](_0x0de7('0x66'),path[_0x0de7('0x3d')](_0x3ec9cb[_0x0de7('0x5')])[_0x0de7('0x67')],path[_0x0de7('0x3d')](_0x3ec9cb['path'])[_0x0de7('0x29')]);_0xc3f1dd[_0x0de7('0x68')]=_0x3ec9cb[_0x0de7('0x5')];ut[_0x0de7('0x4b')](_0x0de7('0x69'),'');ami[_0x0de7('0x6a')](ut[_0x0de7('0x6b')](_0x3ec9cb,_0xc3f1dd))[_0x0de7('0x4a')](function(_0x487a63){_0x5eb639(_0x487a63);})[_0x0de7('0x3f')](function(_0x1212c1){_0x362d1a(_0x1212c1);});})['catch'](function(_0x278566){_0x362d1a(_0x278566);});}else{ami[_0x0de7('0x6a')](ut[_0x0de7('0x6b')](_0x3ec9cb,_0xc3f1dd))['then'](function(_0x4a4c81){_0x5eb639(_0x4a4c81);})[_0x0de7('0x3f')](function(_0x4d3590){_0x362d1a(_0x4d3590);});}});}Fax[_0x0de7('0x21')][_0x0de7('0x5a')]=function(_0x2d8057,_0x49ae44){var _0x1181a5=this;return new BPromise(function(_0x4ff22f,_0x2807a5){var _0x5dd2b0=uuid['v4']();var _0x8bd359=ut[_0x0de7('0x6c')](_0x2d8057,_0x49ae44);_0x1181a5[_0x0de7('0x13')][_0x5dd2b0]=new Action(_0x5dd2b0,_0x49ae44,_0x2d8057);var _0x334c94=_0x1181a5[_0x0de7('0x13')][_0x5dd2b0];if(path[_0x0de7('0x3d')](_0x2d8057[_0x0de7('0x5')])[_0x0de7('0x6d')]==='.pdf'){originate(_0x334c94,_0x8bd359,!![])[_0x0de7('0x4a')](function(_0x1bd69d){_0x4ff22f(_0x1bd69d);})[_0x0de7('0x3f')](function(_0x1ceb85){_0x2807a5(_0x1ceb85);});}else{originate(_0x334c94,_0x8bd359,![])[_0x0de7('0x4a')](function(_0xaf0ded){_0x4ff22f(_0xaf0ded);})[_0x0de7('0x3f')](function(_0x122995){_0x2807a5(_0x122995);});}});};Fax[_0x0de7('0x21')][_0x0de7('0x6e')]=function(_0x4605af){return!_[_0x0de7('0x6f')](_0x4605af)&&!_['isNil'](_0x4605af[_0x0de7('0x29')])&&!_[_0x0de7('0x6f')](_0x4605af[_0x0de7('0x70')])&&_0x4605af['active']&&!_['isNil'](this['trunks'][util['format']('SIP/%s',_0x4605af[_0x0de7('0x29')])])&&!_[_0x0de7('0x6f')](this['trunks'][util[_0x0de7('0x64')](_0x0de7('0x71'),_0x4605af[_0x0de7('0x29')])]['status'])&&(this['trunks'][util['format'](_0x0de7('0x71'),_0x4605af[_0x0de7('0x29')])]['status']==='reachable'||this['trunks'][util[_0x0de7('0x64')](_0x0de7('0x71'),_0x4605af[_0x0de7('0x29')])][_0x0de7('0x32')]===_0x0de7('0x72'));};Fax[_0x0de7('0x21')]['checkTrunk']=function(_0x4b52a0,_0x1f30d1){if(!this['isTrunkReachable'](_0x4b52a0)){ut[_0x0de7('0x4b')](_0x0de7('0x73'),_[_0x0de7('0x6f')](_0x4b52a0)?'':_0x4b52a0[_0x0de7('0x29')]+_0x0de7('0x74'));return{'isValid':![],'message':_0x0de7('0x75')};}if(_[_0x0de7('0x6f')](_0x1f30d1[_0x0de7('0x9')])){ut[_0x0de7('0x4b')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x1f30d1));return{'isValid':![],'message':_0x0de7('0x76')};}if(_[_0x0de7('0x6f')](_0x1f30d1[_0x0de7('0x5')])){ut['logger'](_0x0de7('0x77'),JSON[_0x0de7('0x41')](_0x1f30d1));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x0de7('0x78')};};module[_0x0de7('0x79')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d3a0528..48d8c75 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 _0x35ad=['../rpc/faxAccount','error','inspect','resolve','then','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x1e69f8,_0x77f33a){var _0x3ab000=function(_0x1245d2){while(--_0x1245d2){_0x1e69f8['push'](_0x1e69f8['shift']());}};_0x3ab000(++_0x77f33a);}(_0x35ad,0x1cf));var _0xd35a=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x35ad[_0x3070dc];return _0x431489;};'use strict';var util=require(_0xd35a('0x0'));var BPromise=require(_0xd35a('0x1'));var logger=require(_0xd35a('0x2'))(_0xd35a('0x3'));var _=require(_0xd35a('0x4'));var faxAccount=require(_0xd35a('0x5'));function loggerCatch(_0x3bb9fb){return function(_0x207e98){logger[_0xd35a('0x6')](_0x3bb9fb,util[_0xd35a('0x7')](_0x207e98,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x163db0,_0x5e3b97){return BPromise[_0xd35a('0x8')]()[_0xd35a('0x9')](faxAccount[_0xd35a('0xa')](_0x163db0,_0x5e3b97))[_0xd35a('0xb')](loggerCatch(_0xd35a('0xc')));}; \ No newline at end of file +var _0x5501=['inspect','notify','resolve','then','catch','[Notify]\x20','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x5501,0x74));var _0x1550=function(_0x4783fd,_0x4acfe8){_0x4783fd=_0x4783fd-0x0;var _0x11b8aa=_0x5501[_0x4783fd];return _0x11b8aa;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x1550('0x0'))(_0x1550('0x1'));var _=require(_0x1550('0x2'));var faxAccount=require(_0x1550('0x3'));function loggerCatch(_0x4fdda2){return function(_0x2cb21b){logger[_0x1550('0x4')](_0x4fdda2,util[_0x1550('0x5')](_0x2cb21b,{'showHidden':![],'depth':null}));};}exports[_0x1550('0x6')]=function(_0x52270d,_0x3d9db4){return BPromise[_0x1550('0x7')]()[_0x1550('0x8')](faxAccount[_0x1550('0x6')](_0x52270d,_0x3d9db4))[_0x1550('0x9')](loggerCatch(_0x1550('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 60d77f9..4422ece 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 _0xd49f=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','child_process'];(function(_0x4ed184,_0xeececd){var _0x2248f6=function(_0x31c6f7){while(--_0x31c6f7){_0x4ed184['push'](_0x4ed184['shift']());}};_0x2248f6(++_0xeececd);}(_0xd49f,0x92));var _0xfd49=function(_0x45b5bd,_0x1b2655){_0x45b5bd=_0x45b5bd-0x0;var _0x1af8bb=_0xd49f[_0x45b5bd];return _0x1af8bb;};'use strict';var util=require('util');var logger=require(_0xfd49('0x0'))(_0xfd49('0x1'));var BPromise=require(_0xfd49('0x2'));var exec=require(_0xfd49('0x3'))[_0xfd49('0x4')];exports[_0xfd49('0x5')]=function(_0x33e9af){return new BPromise(function(_0x3722e6,_0x115e97){exec(_0x33e9af,function(_0x257ce5,_0x22ab71,_0x4b9355){logger['info']('Exec\x20gs',_0x22ab71);if(_0x257ce5){logger[_0xfd49('0x6')](_0xfd49('0x7'),_0xfd49('0x8'),util[_0xfd49('0x9')](_0x257ce5,{'showHidden':![],'depth':null}),_0x22ab71,_0x4b9355);_0x115e97(_0x257ce5);}_0x3722e6(_0x22ab71);});});}; \ No newline at end of file +var _0x7318=['fax','bluebird','exec','execute','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x45e699,_0x4ba1eb){var _0x27d789=function(_0x385cd8){while(--_0x385cd8){_0x45e699['push'](_0x45e699['shift']());}};_0x27d789(++_0x4ba1eb);}(_0x7318,0x1c0));var _0x8731=function(_0x5e918f,_0x35641b){_0x5e918f=_0x5e918f-0x0;var _0x4194fd=_0x7318[_0x5e918f];return _0x4194fd;};'use strict';var util=require(_0x8731('0x0'));var logger=require(_0x8731('0x1'))(_0x8731('0x2'));var BPromise=require(_0x8731('0x3'));var exec=require('child_process')[_0x8731('0x4')];exports[_0x8731('0x5')]=function(_0x20df72){return new BPromise(function(_0x29f2d0,_0x55dcc6){exec(_0x20df72,function(_0xa71e7,_0x2bbe82,_0x4730dc){logger['info'](_0x8731('0x6'),_0x2bbe82);if(_0xa71e7){logger['info'](_0x8731('0x6'),_0x8731('0x7'),util[_0x8731('0x8')](_0xa71e7,{'showHidden':![],'depth':null}),_0x2bbe82,_0x4730dc);_0x55dcc6(_0xa71e7);}_0x29f2d0(_0x2bbe82);});});}; \ 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 3eec090..3373b0f 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 _0xa5e0=['modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22'];(function(_0x2991ea,_0x4a0231){var _0x4e1c51=function(_0x59ed64){while(--_0x59ed64){_0x2991ea['push'](_0x2991ea['shift']());}};_0x4e1c51(++_0x4a0231);}(_0xa5e0,0xae));var _0x0a5e=function(_0x3686ff,_0x259ced){_0x3686ff=_0x3686ff-0x0;var _0x414a46=_0xa5e0[_0x3686ff];return _0x414a46;};'use strict';var util=require(_0x0a5e('0x0'));var _=require(_0x0a5e('0x1'));var moment=require(_0x0a5e('0x2'));var logger=require(_0x0a5e('0x3'))(_0x0a5e('0x4'));exports[_0x0a5e('0x5')]=function(_0x2454ce){return{'message':_0x2454ce};};exports[_0x0a5e('0x6')]=function(_0x5b1d00,_0x19f127){logger[_0x0a5e('0x7')](_0x5b1d00,util[_0x0a5e('0x8')](_0x19f127,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x56f7fc,_0x3b2f32){var _0x4ccbbf={'XMF-ECM':_0x3b2f32[_0x0a5e('0x9')],'XMF-HEADERINFO':_0x3b2f32[_0x0a5e('0xa')],'XMF-MINRATE':_0x3b2f32[_0x0a5e('0xb')],'XMF-MAXRATE':_0x3b2f32[_0x0a5e('0xc')],'XMF-MODEM':util[_0x0a5e('0xd')](_0x0a5e('0xe'),_0x3b2f32[_0x0a5e('0xf')]),'XMF-GATEWAY':_0x3b2f32[_0x0a5e('0x10')],'XMF-FAXDETECT':_0x3b2f32[_0x0a5e('0x11')],'XMF-T38TIMEOUT':_0x3b2f32['t38timeout'],'XMF-LOCALSTATIONID':_0x3b2f32[_0x0a5e('0x12')],'XMF-PATH':_0x56f7fc[_0x0a5e('0x13')]};return _0x4ccbbf;};exports[_0x0a5e('0x14')]=function(_0x6e7e54,_0x3d7228){return{'actionid':_0x6e7e54[_0x0a5e('0x15')],'action':_0x0a5e('0x16'),'channel':_0x6e7e54[_0x0a5e('0x17')],'Exten':_0x0a5e('0x18'),'Context':_0x0a5e('0x19'),'Priority':'1','callerid':util[_0x0a5e('0xd')](_0x0a5e('0x1a'),_0x6e7e54[_0x0a5e('0xa')]?_0x6e7e54[_0x0a5e('0xa')]:'',_0x6e7e54[_0x0a5e('0x12')]),'variable':_0x3d7228,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x6e7e54[_0x0a5e('0x15')]};}; \ No newline at end of file +var _0x8134=['../../../../config/logger','fax','message','logger','inspect','ecm','headerinfo','minrate','format','\x22%s\x22','modem','gateway','localstationid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','uniqueid','moment'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x8134,0xf6));var _0x4813=function(_0x3b19f1,_0x478220){_0x3b19f1=_0x3b19f1-0x0;var _0x44dd7b=_0x8134[_0x3b19f1];return _0x44dd7b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4813('0x0'));var logger=require(_0x4813('0x1'))(_0x4813('0x2'));exports[_0x4813('0x3')]=function(_0x309cb6){return{'message':_0x309cb6};};exports[_0x4813('0x4')]=function(_0x482278,_0x812bdf){logger['info'](_0x482278,util[_0x4813('0x5')](_0x812bdf,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x22499e,_0x2d8936){var _0x38d5f8={'XMF-ECM':_0x2d8936[_0x4813('0x6')],'XMF-HEADERINFO':_0x2d8936[_0x4813('0x7')],'XMF-MINRATE':_0x2d8936[_0x4813('0x8')],'XMF-MAXRATE':_0x2d8936['maxrate'],'XMF-MODEM':util[_0x4813('0x9')](_0x4813('0xa'),_0x2d8936[_0x4813('0xb')]),'XMF-GATEWAY':_0x2d8936[_0x4813('0xc')],'XMF-FAXDETECT':_0x2d8936['faxdetect'],'XMF-T38TIMEOUT':_0x2d8936['t38timeout'],'XMF-LOCALSTATIONID':_0x2d8936[_0x4813('0xd')],'XMF-PATH':_0x22499e['path']};return _0x38d5f8;};exports['variablesAction']=function(_0xb0452,_0x359baa){return{'actionid':_0xb0452['uniqueid'],'action':'originate','channel':_0xb0452[_0x4813('0xe')],'Exten':_0x4813('0xf'),'Context':_0x4813('0x10'),'Priority':'1','callerid':util['format'](_0x4813('0x11'),_0xb0452[_0x4813('0x7')]?_0xb0452[_0x4813('0x7')]:'',_0xb0452['localstationid']),'variable':_0x359baa,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xb0452[_0x4813('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index a6ce358..73be87b 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 _0x2c1a=['getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','[index.js][main]','util','moment','./server','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x2c1a,0x122));var _0xa2c1=function(_0x54db3c,_0x57a938){_0x54db3c=_0x54db3c-0x0;var _0x89abe3=_0x2c1a[_0x54db3c];return _0x89abe3;};'use strict';var util=require(_0xa2c1('0x0'));var moment=require(_0xa2c1('0x1'));var server=require(_0xa2c1('0x2'));var Realtime=require('./realtime');var Report=require(_0xa2c1('0x3'));var Acw=require('./acw');var Trigger=require(_0xa2c1('0x4'));var Dialer=require(_0xa2c1('0x5'));var Preview=require(_0xa2c1('0x6'));var Fax=require('./fax');var user=require(_0xa2c1('0x7'));var voiceQueue=require(_0xa2c1('0x8'));var voiceQueueReport=require(_0xa2c1('0x9'));var voiceCallReport=require(_0xa2c1('0xa'));var trunk=require(_0xa2c1('0xb'));var trigger=require(_0xa2c1('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0xa2c1('0xd'));var campaign=require(_0xa2c1('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xa2c1('0xf'));var salesforce=require(_0xa2c1('0x10'));var sugarcrm=require(_0xa2c1('0x11'));var freshdesk=require(_0xa2c1('0x12'));var desk=require(_0xa2c1('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xa2c1('0x14'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xa2c1('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xa2c1('0x16'))(_0xa2c1('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa2c1('0x18')](_0xa2c1('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa2c1('0x18')](_0xa2c1('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xa2c1('0x1a')]()['then'](user[_0xa2c1('0x1b')]())[_0xa2c1('0x1c')](realtime[_0xa2c1('0x1d')]())['then'](user[_0xa2c1('0x1e')]())[_0xa2c1('0x1c')](realtime[_0xa2c1('0x1f')]())['then'](trunk[_0xa2c1('0x20')]())[_0xa2c1('0x1c')](realtime['initTrunks']())['then'](voiceQueue[_0xa2c1('0x21')]())['then'](realtime[_0xa2c1('0x22')]())[_0xa2c1('0x1c')](trigger[_0xa2c1('0x23')]())[_0xa2c1('0x1c')](realtime['initTriggers']())['then'](template[_0xa2c1('0x24')]())[_0xa2c1('0x1c')](realtime['initTemplates']())[_0xa2c1('0x1c')](zendesk[_0xa2c1('0x25')]())[_0xa2c1('0x1c')](realtime['initZendeskAccounts']())[_0xa2c1('0x1c')](salesforce[_0xa2c1('0x26')]())[_0xa2c1('0x1c')](realtime['initSalesforceAccounts']())[_0xa2c1('0x1c')](sugarcrm[_0xa2c1('0x27')]())[_0xa2c1('0x1c')](realtime[_0xa2c1('0x28')]())[_0xa2c1('0x1c')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0xa2c1('0x29')]())[_0xa2c1('0x1c')](desk['getDeskAccounts']())[_0xa2c1('0x1c')](realtime[_0xa2c1('0x2a')]())['then'](zoho[_0xa2c1('0x2b')]())[_0xa2c1('0x1c')](realtime[_0xa2c1('0x2c')]())[_0xa2c1('0x1c')](vtiger[_0xa2c1('0x2d')]())[_0xa2c1('0x1c')](realtime[_0xa2c1('0x2e')]())[_0xa2c1('0x1c')](freshsales[_0xa2c1('0x2f')]())[_0xa2c1('0x1c')](realtime['initFreshsalesAccounts']())[_0xa2c1('0x1c')](servicenow[_0xa2c1('0x30')]())[_0xa2c1('0x1c')](realtime[_0xa2c1('0x31')]())[_0xa2c1('0x1c')](dynamics365[_0xa2c1('0x32')]())[_0xa2c1('0x1c')](realtime['initDynamics365Accounts']())[_0xa2c1('0x1c')](campaign[_0xa2c1('0x33')]())[_0xa2c1('0x1c')](realtime[_0xa2c1('0x34')]())[_0xa2c1('0x1c')](voiceExtension[_0xa2c1('0x35')]())[_0xa2c1('0x1c')](realtime[_0xa2c1('0x36')]())[_0xa2c1('0x1c')](faxAccount[_0xa2c1('0x37')]())['then'](realtime[_0xa2c1('0x38')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0xa2c1('0x1a')]()[_0xa2c1('0x1c')](voiceQueueReport[_0xa2c1('0x39')]())['then'](realtime[_0xa2c1('0x3a')]())[_0xa2c1('0x1c')](cmHopperHistory[_0xa2c1('0x3b')]())[_0xa2c1('0x1c')](realtime[_0xa2c1('0x3c')]())[_0xa2c1('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0xa2c1('0x1c')](realtime['initCampaignHopperHistory']())[_0xa2c1('0x1c')](voiceCallReport[_0xa2c1('0x3d')]())['then'](realtime['initVoiceCallReports']())[_0xa2c1('0x3e')](function(_0x5eccbb){logger[_0xa2c1('0x3f')](_0xa2c1('0x40'),util[_0xa2c1('0x41')](_0x5eccbb,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xa2c1('0x1c')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xa2c1('0x1c')](function(){report[_0xa2c1('0x42')]();setInterval(initRealtime,0x1388);})[_0xa2c1('0x3e')](function(_0x4a1085){logger[_0xa2c1('0x3f')](_0xa2c1('0x43'),util[_0xa2c1('0x41')](_0x4a1085,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xf432=['initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts'];(function(_0x2d9969,_0x5e2e1a){var _0x9b70b8=function(_0x2fef53){while(--_0x2fef53){_0x2d9969['push'](_0x2d9969['shift']());}};_0x9b70b8(++_0x5e2e1a);}(_0xf432,0xff));var _0x2f43=function(_0x24b33c,_0x33cb97){_0x24b33c=_0x24b33c-0x0;var _0x33becf=_0xf432[_0x24b33c];return _0x33becf;};'use strict';var util=require(_0x2f43('0x0'));var moment=require(_0x2f43('0x1'));var server=require(_0x2f43('0x2'));var Realtime=require(_0x2f43('0x3'));var Report=require(_0x2f43('0x4'));var Acw=require(_0x2f43('0x5'));var Trigger=require(_0x2f43('0x6'));var Dialer=require(_0x2f43('0x7'));var Preview=require(_0x2f43('0x8'));var Fax=require('./fax');var user=require(_0x2f43('0x9'));var voiceQueue=require(_0x2f43('0xa'));var voiceQueueReport=require(_0x2f43('0xb'));var voiceCallReport=require(_0x2f43('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0x2f43('0xd'));var template=require(_0x2f43('0xe'));var cmHopperHistory=require(_0x2f43('0xf'));var campaign=require(_0x2f43('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x2f43('0x11'));var zendesk=require(_0x2f43('0x12'));var salesforce=require(_0x2f43('0x13'));var sugarcrm=require(_0x2f43('0x14'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x2f43('0x15'));var zoho=require(_0x2f43('0x16'));var vtiger=require(_0x2f43('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x2f43('0x18'));var dynamics365=require(_0x2f43('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x2f43('0x1a'))(_0x2f43('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2f43('0x1c')](_0x2f43('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2f43('0x1c')](_0x2f43('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x2f43('0x1e')]()['then'](user[_0x2f43('0x1f')]())[_0x2f43('0x20')](realtime[_0x2f43('0x21')]())[_0x2f43('0x20')](user[_0x2f43('0x22')]())[_0x2f43('0x20')](realtime[_0x2f43('0x23')]())[_0x2f43('0x20')](trunk[_0x2f43('0x24')]())['then'](realtime[_0x2f43('0x25')]())[_0x2f43('0x20')](voiceQueue[_0x2f43('0x26')]())['then'](realtime[_0x2f43('0x27')]())['then'](trigger[_0x2f43('0x28')]())[_0x2f43('0x20')](realtime[_0x2f43('0x29')]())[_0x2f43('0x20')](template[_0x2f43('0x2a')]())[_0x2f43('0x20')](realtime[_0x2f43('0x2b')]())[_0x2f43('0x20')](zendesk[_0x2f43('0x2c')]())['then'](realtime[_0x2f43('0x2d')]())[_0x2f43('0x20')](salesforce[_0x2f43('0x2e')]())[_0x2f43('0x20')](realtime[_0x2f43('0x2f')]())[_0x2f43('0x20')](sugarcrm[_0x2f43('0x30')]())[_0x2f43('0x20')](realtime[_0x2f43('0x31')]())['then'](freshdesk[_0x2f43('0x32')]())['then'](realtime['initFreshdeskAccounts']())[_0x2f43('0x20')](desk['getDeskAccounts']())[_0x2f43('0x20')](realtime[_0x2f43('0x33')]())[_0x2f43('0x20')](zoho[_0x2f43('0x34')]())[_0x2f43('0x20')](realtime[_0x2f43('0x35')]())[_0x2f43('0x20')](vtiger[_0x2f43('0x36')]())[_0x2f43('0x20')](realtime[_0x2f43('0x37')]())[_0x2f43('0x20')](freshsales[_0x2f43('0x38')]())[_0x2f43('0x20')](realtime[_0x2f43('0x39')]())[_0x2f43('0x20')](servicenow[_0x2f43('0x3a')]())['then'](realtime[_0x2f43('0x3b')]())[_0x2f43('0x20')](dynamics365[_0x2f43('0x3c')]())[_0x2f43('0x20')](realtime[_0x2f43('0x3d')]())[_0x2f43('0x20')](campaign['getCampaigns']())[_0x2f43('0x20')](realtime[_0x2f43('0x3e')]())['then'](voiceExtension[_0x2f43('0x3f')]())['then'](realtime[_0x2f43('0x40')]())[_0x2f43('0x20')](faxAccount['getFaxAccounts']())['then'](realtime[_0x2f43('0x41')]())[_0x2f43('0x20')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x2f43('0x20')](voiceQueueReport[_0x2f43('0x42')]())[_0x2f43('0x20')](realtime[_0x2f43('0x43')]())[_0x2f43('0x20')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x2f43('0x20')](realtime[_0x2f43('0x44')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x2f43('0x20')](realtime[_0x2f43('0x45')]())['then'](voiceCallReport[_0x2f43('0x46')]())[_0x2f43('0x20')](realtime['initVoiceCallReports']())[_0x2f43('0x47')](function(_0x305594){logger[_0x2f43('0x48')](_0x2f43('0x49'),util[_0x2f43('0x4a')](_0x305594,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2f43('0x4b')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x2f43('0x20')](function(){return initParams();})[_0x2f43('0x20')](function(){report[_0x2f43('0x4c')]();setInterval(initRealtime,0x1388);})[_0x2f43('0x47')](function(_0x52fd99){logger[_0x2f43('0x48')](_0x2f43('0x4d'),util[_0x2f43('0x4a')](_0x52fd99,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 62c92e9..ee4853b 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 _0xda28=['idle','inuse','talking','toNumber','status','address','voiceStatusQueue','stringify','format','user:save','emit','user:presence','exports','lodash','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','prototype','toLowerCase','not_inuse'];(function(_0x113bef,_0x82b4a5){var _0x3b6d82=function(_0xc0df02){while(--_0xc0df02){_0x113bef['push'](_0x113bef['shift']());}};_0x3b6d82(++_0x82b4a5);}(_0xda28,0xfd));var _0x8da2=function(_0x49dd25,_0x53d808){_0x49dd25=_0x49dd25-0x0;var _0x31df6a=_0xda28[_0x49dd25];return _0x31df6a;};'use strict';var _=require(_0x8da2('0x0'));var util=require(_0x8da2('0x1'));var moment=require(_0x8da2('0x2'));var md5=require(_0x8da2('0x3'));var Redis=require(_0x8da2('0x4'));var config=require('../../../config/environment');config[_0x8da2('0x5')]=_[_0x8da2('0x6')](config[_0x8da2('0x5')],{'host':_0x8da2('0x7'),'port':0x18eb});var io=require(_0x8da2('0x8'))(new Redis(config[_0x8da2('0x5')]));function Agent(_0x5a8801){this['id']=_0x5a8801['id']||0x0;this[_0x8da2('0x9')]=_0x5a8801['name']||'';this[_0x8da2('0xa')]=_0x5a8801[_0x8da2('0xa')]||'';this['accountcode']=_0x5a8801[_0x8da2('0xb')]||'';this['fullname']=_0x5a8801[_0x8da2('0xc')]||'';this[_0x8da2('0xd')]=_0x8da2('0xe');this[_0x8da2('0xf')]=0x0;this['status']=_0x8da2('0xe');this['address']='';this[_0x8da2('0x10')]='';this[_0x8da2('0x11')]='';this[_0x8da2('0x12')]='';this['online']=_0x5a8801[_0x8da2('0x13')]||![];this[_0x8da2('0x14')]=_0x8da2('0xe');this[_0x8da2('0x15')]=0x0;this[_0x8da2('0x16')]='';this['voiceStatusQueue']='';this[_0x8da2('0x17')]=![];this['local']=![];this[_0x8da2('0x3')]='';}Agent[_0x8da2('0x18')]['updateStatusRealtime']=function(_0x22e061){var _0x3b6a12;if(_0x22e061&&_0x22e061[_0x8da2('0xd')]){_0x3b6a12=_0x22e061[_0x8da2('0xd')][_0x8da2('0x19')]();switch(_0x3b6a12){case _0x8da2('0x1a'):_0x3b6a12=_0x8da2('0x1b');break;case _0x8da2('0x1c'):_0x3b6a12=_0x8da2('0x1d');break;}}if(_0x3b6a12&&this[_0x8da2('0x14')]!==_0x3b6a12||_0x22e061['statePause']){this[_0x8da2('0x15')]=_[_0x8da2('0x1e')](moment()['format']('x'));}if(_0x3b6a12){this[_0x8da2('0x14')]=_0x3b6a12;}var _0x531caa={'id':this['id'],'name':this['name'],'email':this[_0x8da2('0xa')],'accountcode':this[_0x8da2('0xb')],'fullname':this[_0x8da2('0xc')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0x8da2('0x1f')],'address':this[_0x8da2('0x20')],'online':this[_0x8da2('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x8da2('0x21')],'interface':this[_0x8da2('0x12')],'onhold':this['onhold']};var _0xcc2b51=md5(JSON[_0x8da2('0x22')](_0x531caa));if(this['md5']!==_0xcc2b51){this[_0x8da2('0x3')]=_0xcc2b51;io['to'](util[_0x8da2('0x23')]('user:%s',_0x531caa[_0x8da2('0x9')]))['emit'](_0x8da2('0x24'),_0x531caa);io[_0x8da2('0x25')](_0x8da2('0x26'),_0x531caa);}};module[_0x8da2('0x27')]=Agent; \ No newline at end of file +var _0xb3c3=['name','email','accountcode','fullname','unknown','stateTime','address','phone','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','inuse','talking','statePause','toNumber','status','voiceStatusCallerIdNumber','stringify','format','user:%s','emit','user:save','user:presence','exports','lodash','moment','ioredis','redis','defaults','socket.io-emitter'];(function(_0x337258,_0x3ed507){var _0x155249=function(_0x1929e2){while(--_0x1929e2){_0x337258['push'](_0x337258['shift']());}};_0x155249(++_0x3ed507);}(_0xb3c3,0x1ce));var _0x3b3c=function(_0x2acaeb,_0x584170){_0x2acaeb=_0x2acaeb-0x0;var _0x2935f8=_0xb3c3[_0x2acaeb];return _0x2935f8;};'use strict';var _=require(_0x3b3c('0x0'));var util=require('util');var moment=require(_0x3b3c('0x1'));var md5=require('md5');var Redis=require(_0x3b3c('0x2'));var config=require('../../../config/environment');config[_0x3b3c('0x3')]=_[_0x3b3c('0x4')](config[_0x3b3c('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x3b3c('0x5'))(new Redis(config[_0x3b3c('0x3')]));function Agent(_0x5b60eb){this['id']=_0x5b60eb['id']||0x0;this[_0x3b3c('0x6')]=_0x5b60eb['name']||'';this[_0x3b3c('0x7')]=_0x5b60eb[_0x3b3c('0x7')]||'';this[_0x3b3c('0x8')]=_0x5b60eb['accountcode']||'';this['fullname']=_0x5b60eb[_0x3b3c('0x9')]||'';this['state']=_0x3b3c('0xa');this[_0x3b3c('0xb')]=0x0;this['status']='unknown';this[_0x3b3c('0xc')]='';this[_0x3b3c('0xd')]='';this['mobile']='';this['interface']='';this[_0x3b3c('0xe')]=_0x5b60eb[_0x3b3c('0xe')]||![];this[_0x3b3c('0xf')]=_0x3b3c('0xa');this[_0x3b3c('0x10')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x3b3c('0x11')]='';this[_0x3b3c('0x12')]=![];this[_0x3b3c('0x13')]=![];this[_0x3b3c('0x14')]='';}Agent[_0x3b3c('0x15')][_0x3b3c('0x16')]=function(_0x1f34c4){var _0x2c3971;if(_0x1f34c4&&_0x1f34c4['state']){_0x2c3971=_0x1f34c4[_0x3b3c('0x17')][_0x3b3c('0x18')]();switch(_0x2c3971){case _0x3b3c('0x19'):_0x2c3971='idle';break;case _0x3b3c('0x1a'):_0x2c3971=_0x3b3c('0x1b');break;}}if(_0x2c3971&&this['voiceStatus']!==_0x2c3971||_0x1f34c4[_0x3b3c('0x1c')]){this[_0x3b3c('0x10')]=_[_0x3b3c('0x1d')](moment()['format']('x'));}if(_0x2c3971){this[_0x3b3c('0xf')]=_0x2c3971;}var _0x21bf19={'id':this['id'],'name':this[_0x3b3c('0x6')],'email':this[_0x3b3c('0x7')],'accountcode':this[_0x3b3c('0x8')],'fullname':this['fullname'],'state':this[_0x3b3c('0x17')],'stateTime':this[_0x3b3c('0xb')],'status':this[_0x3b3c('0x1e')],'address':this[_0x3b3c('0xc')],'online':this[_0x3b3c('0xe')],'voiceStatus':this[_0x3b3c('0xf')],'voiceStatusTime':this[_0x3b3c('0x10')],'voiceStatusCallerIdNumber':this[_0x3b3c('0x1f')],'voiceStatusQueue':this[_0x3b3c('0x11')],'interface':this['interface'],'onhold':this[_0x3b3c('0x12')]};var _0x564263=md5(JSON[_0x3b3c('0x20')](_0x21bf19));if(this[_0x3b3c('0x14')]!==_0x564263){this[_0x3b3c('0x14')]=_0x564263;io['to'](util[_0x3b3c('0x21')](_0x3b3c('0x22'),_0x21bf19[_0x3b3c('0x6')]))[_0x3b3c('0x23')](_0x3b3c('0x24'),_0x21bf19);io[_0x3b3c('0x23')](_0x3b3c('0x25'),_0x21bf19);}};module[_0x3b3c('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 7fc689c..0853a20 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 _0x796f=['temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated'];(function(_0x483acd,_0x51fdf8){var _0x2315c5=function(_0x368b55){while(--_0x368b55){_0x483acd['push'](_0x483acd['shift']());}};_0x2315c5(++_0x51fdf8);}(_0x796f,0x1ad));var _0xf796=function(_0x5d65a4,_0x44e282){_0x5d65a4=_0x5d65a4-0x0;var _0x28c091=_0x796f[_0x5d65a4];return _0x28c091;};'use strict';function Campaign(_0x3b1a0d){this['id']=_0x3b1a0d['id']||0x0;this['name']=_0x3b1a0d[_0xf796('0x0')]||'';this[_0xf796('0x1')]=_0x3b1a0d[_0xf796('0x1')]||'campaign';this[_0xf796('0x2')]=0x0;this[_0xf796('0x3')]=0x0;this[_0xf796('0x4')]=0x0;this[_0xf796('0x5')]=0x0;this[_0xf796('0x6')]='';this[_0xf796('0x7')]=!![];this[_0xf796('0x8')]=_0x3b1a0d[_0xf796('0x8')];this[_0xf796('0x9')]=_0x3b1a0d[_0xf796('0x9')];this[_0xf796('0xa')]=_0x3b1a0d[_0xf796('0xa')]||null;this[_0xf796('0xb')]=_0x3b1a0d[_0xf796('0xb')]?_0x3b1a0d[_0xf796('0xb')]:null;this[_0xf796('0xc')]=_0x3b1a0d[_0xf796('0xc')];this[_0xf796('0xd')]=_0x3b1a0d[_0xf796('0xd')];this[_0xf796('0xe')]=_0x3b1a0d['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x3b1a0d[_0xf796('0xf')];this[_0xf796('0x10')]=_0x3b1a0d[_0xf796('0x10')];this[_0xf796('0x11')]=_0x3b1a0d[_0xf796('0x11')];this[_0xf796('0x12')]=_0x3b1a0d['dialBusyRetryFrequency'];this[_0xf796('0x13')]=_0x3b1a0d['dialNoAnswerMaxRetry'];this[_0xf796('0x14')]=_0x3b1a0d['dialNoAnswerRetryFrequency'];this[_0xf796('0x15')]=_0x3b1a0d['dialGlobalMaxRetry'];this[_0xf796('0x16')]=_0x3b1a0d['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3b1a0d['dialNoSuchNumberRetryFrequency']||0x96;this[_0xf796('0x17')]=_0x3b1a0d[_0xf796('0x17')]||0x3;this[_0xf796('0x18')]=_0x3b1a0d[_0xf796('0x18')]||0x96;this[_0xf796('0x19')]=_0x3b1a0d[_0xf796('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x3b1a0d[_0xf796('0x1a')]||0x96;this[_0xf796('0x1b')]=_0x3b1a0d[_0xf796('0x1b')]||0x3;this[_0xf796('0x1c')]=_0x3b1a0d[_0xf796('0x1c')]||0x96;this[_0xf796('0x1d')]=_0x3b1a0d['dialAgentRejectMaxRetry']||0x3;this[_0xf796('0x1e')]=_0x3b1a0d[_0xf796('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x3b1a0d[_0xf796('0x1f')]||_0xf796('0x20');this['dialPrefix']=_0x3b1a0d['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x3b1a0d[_0xf796('0x21')]||undefined;this[_0xf796('0x22')]=_0x3b1a0d['dialCutDigit']||undefined;this['TrunkBackup']=_0x3b1a0d['TrunkBackup']?_0x3b1a0d['TrunkBackup']:undefined;this[_0xf796('0x23')]=_0x3b1a0d['Trunk']?_0x3b1a0d[_0xf796('0x23')]:undefined;this[_0xf796('0x24')]=_0x3b1a0d[_0xf796('0x24')]?_0x3b1a0d['Interval']:undefined;this[_0xf796('0x25')]=_0x3b1a0d[_0xf796('0x25')]?_0x3b1a0d['SquareProject']:undefined;this['dialQueueProject']=_0x3b1a0d[_0xf796('0x25')]?_0x3b1a0d[_0xf796('0x25')]['name']:undefined;this[_0xf796('0x26')]=_0x3b1a0d[_0xf796('0x26')]||![];this[_0xf796('0x27')]=_0x3b1a0d[_0xf796('0x27')];this['dialAMDGreeting']=_0x3b1a0d[_0xf796('0x28')];this[_0xf796('0x29')]=_0x3b1a0d[_0xf796('0x29')];this[_0xf796('0x2a')]=_0x3b1a0d[_0xf796('0x2a')];this[_0xf796('0x2b')]=_0x3b1a0d[_0xf796('0x2b')];this['dialAMDBetweenWordsSilence']=_0x3b1a0d['dialAMDBetweenWordsSilence'];this[_0xf796('0x2c')]=_0x3b1a0d[_0xf796('0x2c')];this[_0xf796('0x2d')]=_0x3b1a0d[_0xf796('0x2d')];this[_0xf796('0x2e')]=_0x3b1a0d[_0xf796('0x2e')];}module[_0xf796('0x2f')]=Campaign; \ No newline at end of file +var _0x2b21=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x278bbb,_0x546e2f){var _0x444877=function(_0x399547){while(--_0x399547){_0x278bbb['push'](_0x278bbb['shift']());}};_0x444877(++_0x546e2f);}(_0x2b21,0xdd));var _0x12b2=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x2b21[_0x18abd2];return _0x1dcad6;};'use strict';function Campaign(_0x37f879){this['id']=_0x37f879['id']||0x0;this[_0x12b2('0x0')]=_0x37f879['name']||'';this[_0x12b2('0x1')]=_0x37f879[_0x12b2('0x1')]||_0x12b2('0x2');this[_0x12b2('0x3')]=0x0;this[_0x12b2('0x4')]=0x0;this[_0x12b2('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x12b2('0x6')]=!![];this[_0x12b2('0x7')]=_0x37f879[_0x12b2('0x7')];this[_0x12b2('0x8')]=_0x37f879['limitCalls'];this[_0x12b2('0x9')]=_0x37f879[_0x12b2('0x9')]||null;this[_0x12b2('0xa')]=_0x37f879[_0x12b2('0xa')]?_0x37f879['dialGlobalInterval']:null;this[_0x12b2('0xb')]=_0x37f879['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x37f879[_0x12b2('0xc')];this['dialOriginateTimeout']=_0x37f879[_0x12b2('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x37f879['dialCongestionMaxRetry'];this[_0x12b2('0xe')]=_0x37f879[_0x12b2('0xe')];this[_0x12b2('0xf')]=_0x37f879[_0x12b2('0xf')];this['dialBusyRetryFrequency']=_0x37f879[_0x12b2('0x10')];this['dialNoAnswerMaxRetry']=_0x37f879[_0x12b2('0x11')];this[_0x12b2('0x12')]=_0x37f879['dialNoAnswerRetryFrequency'];this[_0x12b2('0x13')]=_0x37f879[_0x12b2('0x13')];this[_0x12b2('0x14')]=_0x37f879['dialNoSuchNumberMaxRetry']||0x3;this[_0x12b2('0x15')]=_0x37f879[_0x12b2('0x15')]||0x96;this[_0x12b2('0x16')]=_0x37f879[_0x12b2('0x16')]||0x3;this[_0x12b2('0x17')]=_0x37f879['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x37f879[_0x12b2('0x18')]||0x3;this[_0x12b2('0x19')]=_0x37f879['dialAbandonedRetryFrequency']||0x96;this[_0x12b2('0x1a')]=_0x37f879[_0x12b2('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x37f879[_0x12b2('0x1b')]||0x96;this[_0x12b2('0x1c')]=_0x37f879[_0x12b2('0x1c')]||0x3;this[_0x12b2('0x1d')]=_0x37f879[_0x12b2('0x1d')]||0x96;this[_0x12b2('0x1e')]=_0x37f879[_0x12b2('0x1e')]||'DESC';this['dialPrefix']=_0x37f879[_0x12b2('0x1f')]||undefined;this[_0x12b2('0x20')]=_0x37f879[_0x12b2('0x20')]||undefined;this['dialCutDigit']=_0x37f879[_0x12b2('0x21')]||undefined;this[_0x12b2('0x22')]=_0x37f879['TrunkBackup']?_0x37f879['TrunkBackup']:undefined;this[_0x12b2('0x23')]=_0x37f879[_0x12b2('0x23')]?_0x37f879[_0x12b2('0x23')]:undefined;this[_0x12b2('0x24')]=_0x37f879[_0x12b2('0x24')]?_0x37f879[_0x12b2('0x24')]:undefined;this[_0x12b2('0x25')]=_0x37f879[_0x12b2('0x25')]?_0x37f879[_0x12b2('0x25')]:undefined;this['dialQueueProject']=_0x37f879['SquareProject']?_0x37f879[_0x12b2('0x25')][_0x12b2('0x0')]:undefined;this[_0x12b2('0x26')]=_0x37f879[_0x12b2('0x26')]||![];this['dialAMDInitialSilence']=_0x37f879['dialAMDInitialSilence'];this[_0x12b2('0x27')]=_0x37f879['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x37f879[_0x12b2('0x28')];this[_0x12b2('0x29')]=_0x37f879['dialAMDTotalAnalysisTime'];this[_0x12b2('0x2a')]=_0x37f879[_0x12b2('0x2a')];this['dialAMDBetweenWordsSilence']=_0x37f879[_0x12b2('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x37f879[_0x12b2('0x2c')];this['dialAMDSilenceThreshold']=_0x37f879['dialAMDSilenceThreshold'];this[_0x12b2('0x2d')]=_0x37f879[_0x12b2('0x2d')];}module[_0x12b2('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 10e8953..7d0c16c 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 _0x47cb=['calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum'];(function(_0x1e0499,_0x2222ed){var _0x527766=function(_0xac41b8){while(--_0xac41b8){_0x1e0499['push'](_0x1e0499['shift']());}};_0x527766(++_0x2222ed);}(_0x47cb,0x74));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';function Channel(){this[_0xb47c('0x0')]=null;this[_0xb47c('0x1')]='';this[_0xb47c('0x2')]='';this[_0xb47c('0x3')]=0x0;this[_0xb47c('0x4')]='';this[_0xb47c('0x5')]=undefined;this[_0xb47c('0x6')]=undefined;this[_0xb47c('0x7')]=0x0;this['context']='';this[_0xb47c('0x8')]=0x0;this[_0xb47c('0x9')]=0x0;this[_0xb47c('0xa')]=0x0;this[_0xb47c('0xb')]=![];this[_0xb47c('0xc')]=null;this[_0xb47c('0xd')]=null;this[_0xb47c('0xe')]=![];this[_0xb47c('0xf')]=![];this[_0xb47c('0x10')]='';this[_0xb47c('0x11')]='';this[_0xb47c('0x12')]=0x0;this[_0xb47c('0x13')]=0x0;this[_0xb47c('0x14')]=0x0;this[_0xb47c('0x15')]=null;this[_0xb47c('0x16')]=null;this['disposition']=null;this[_0xb47c('0x17')]=![];this[_0xb47c('0x18')]=null;this[_0xb47c('0x19')]=null;this['monitors']=[];this[_0xb47c('0x1a')]=undefined;this[_0xb47c('0x1b')]=undefined;this['transferType']=undefined;this[_0xb47c('0x1c')]=0x0;}module[_0xb47c('0x1d')]=Channel; \ No newline at end of file +var _0x29b1=['mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','unmanaged','lastapplication','lastdata','billableseconds','holdtime','tag','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x13a913,_0x400d93){var _0xbf71de=function(_0xc750b5){while(--_0xc750b5){_0x13a913['push'](_0x13a913['shift']());}};_0xbf71de(++_0x400d93);}(_0x29b1,0x16d));var _0x129b=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x29b1[_0x16d10f];return _0x50c823;};'use strict';function Channel(){this[_0x129b('0x0')]=null;this[_0x129b('0x1')]='';this[_0x129b('0x2')]='';this[_0x129b('0x3')]=0x0;this[_0x129b('0x4')]='';this['connectedlinenum']=undefined;this[_0x129b('0x5')]=undefined;this[_0x129b('0x6')]=0x0;this[_0x129b('0x7')]='';this[_0x129b('0x8')]=0x0;this[_0x129b('0x9')]=0x0;this[_0x129b('0xa')]=0x0;this[_0x129b('0xb')]=![];this[_0x129b('0xc')]=null;this['endtime']=null;this[_0x129b('0xd')]=![];this['abandoned']=![];this[_0x129b('0xe')]='';this[_0x129b('0xf')]='';this['duration']=0x0;this[_0x129b('0x10')]=0x0;this[_0x129b('0x11')]=0x0;this['type']=null;this[_0x129b('0x12')]=null;this['disposition']=null;this[_0x129b('0x13')]=![];this[_0x129b('0x14')]=null;this[_0x129b('0x15')]=null;this['monitors']=[];this[_0x129b('0x16')]=undefined;this[_0x129b('0x17')]=undefined;this[_0x129b('0x18')]=undefined;this[_0x129b('0x19')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index cf54291..4b3f940 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 _0xd1d5=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x3f6a0b,_0x2845e3){var _0x22e16a=function(_0x30ce8f){while(--_0x30ce8f){_0x3f6a0b['push'](_0x3f6a0b['shift']());}};_0x22e16a(++_0x2845e3);}(_0xd1d5,0x13d));var _0x5d1d=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xd1d5[_0x50007c];return _0x5c1ec7;};'use strict';function DeskAccount(_0x8280f5){this['id']=_0x8280f5['id']||0x0;this['name']=_0x8280f5[_0x5d1d('0x0')]||'';this[_0x5d1d('0x1')]=_0x8280f5[_0x5d1d('0x1')]||'';this['remoteUri']=_0x8280f5[_0x5d1d('0x2')]||'';this[_0x5d1d('0x3')]=_0x8280f5['authType']||'';this['password']=_0x8280f5[_0x5d1d('0x4')]||'';this[_0x5d1d('0x5')]=_0x8280f5['consumerKey']||'';this[_0x5d1d('0x6')]=_0x8280f5[_0x5d1d('0x6')]||'';this[_0x5d1d('0x7')]=_0x8280f5['token']||'';this[_0x5d1d('0x8')]=_0x8280f5[_0x5d1d('0x8')]||'';this['type']=_0x8280f5[_0x5d1d('0x9')]||'';this[_0x5d1d('0xa')]=_0x8280f5['serverUrl']||'';this[_0x5d1d('0xb')]=_0x8280f5[_0x5d1d('0xb')]||{};}module[_0x5d1d('0xc')]=DeskAccount; \ No newline at end of file +var _0x5716=['exports','name','username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x1dab97,_0x408de1){var _0x4487bc=function(_0x4debee){while(--_0x4debee){_0x1dab97['push'](_0x1dab97['shift']());}};_0x4487bc(++_0x408de1);}(_0x5716,0xf1));var _0x6571=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0x5716[_0x427d3a];return _0xe5c521;};'use strict';function DeskAccount(_0x1f7b10){this['id']=_0x1f7b10['id']||0x0;this[_0x6571('0x0')]=_0x1f7b10[_0x6571('0x0')]||'';this['username']=_0x1f7b10[_0x6571('0x1')]||'';this[_0x6571('0x2')]=_0x1f7b10[_0x6571('0x2')]||'';this['authType']=_0x1f7b10['authType']||'';this[_0x6571('0x3')]=_0x1f7b10[_0x6571('0x3')]||'';this[_0x6571('0x4')]=_0x1f7b10[_0x6571('0x4')]||'';this[_0x6571('0x5')]=_0x1f7b10[_0x6571('0x5')]||'';this[_0x6571('0x6')]=_0x1f7b10[_0x6571('0x6')]||'';this[_0x6571('0x7')]=_0x1f7b10['tokenSecret']||'';this[_0x6571('0x8')]=_0x1f7b10[_0x6571('0x8')]||'';this[_0x6571('0x9')]=_0x1f7b10['serverUrl']||'';this[_0x6571('0xa')]=_0x1f7b10[_0x6571('0xa')]||{};}module[_0x6571('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 6cfd6ac..5b45e38 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 _0xa40c=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name'];(function(_0x47c597,_0x4189fe){var _0x140b80=function(_0x3bf901){while(--_0x3bf901){_0x47c597['push'](_0x47c597['shift']());}};_0x140b80(++_0x4189fe);}(_0xa40c,0x107));var _0xca40=function(_0x4a373d,_0x3d017f){_0x4a373d=_0x4a373d-0x0;var _0x4ff28c=_0xa40c[_0x4a373d];return _0x4ff28c;};'use strict';function Dynamics365Account(_0x30c8b7){this['id']=_0x30c8b7['id']||0x0;this[_0xca40('0x0')]=_0x30c8b7[_0xca40('0x0')]||'';this[_0xca40('0x1')]=_0x30c8b7[_0xca40('0x1')]||'';this['password']=_0x30c8b7[_0xca40('0x2')]||'';this[_0xca40('0x3')]=_0x30c8b7[_0xca40('0x3')]||'';this[_0xca40('0x4')]=_0x30c8b7[_0xca40('0x4')]||'';this[_0xca40('0x5')]=_0x30c8b7[_0xca40('0x5')]||'';this[_0xca40('0x6')]=_0x30c8b7[_0xca40('0x6')]||{};this[_0xca40('0x7')]=_0x30c8b7['serverUrl']||'';this['modernAuthentication']=_0x30c8b7[_0xca40('0x8')]||![];this[_0xca40('0x9')]=_0x30c8b7[_0xca40('0x9')]||{};this[_0xca40('0xa')]=_0x30c8b7[_0xca40('0xa')]||{};}module[_0xca40('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xa054=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId'];(function(_0x49f9a0,_0x19c5c0){var _0x40d114=function(_0x2c7531){while(--_0x2c7531){_0x49f9a0['push'](_0x49f9a0['shift']());}};_0x40d114(++_0x19c5c0);}(_0xa054,0x17b));var _0x4a05=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0xa054[_0x3b96cf];return _0x2e315a;};'use strict';function Dynamics365Account(_0x4e7354){this['id']=_0x4e7354['id']||0x0;this[_0x4a05('0x0')]=_0x4e7354[_0x4a05('0x0')]||'';this[_0x4a05('0x1')]=_0x4e7354[_0x4a05('0x1')]||'';this[_0x4a05('0x2')]=_0x4e7354[_0x4a05('0x2')]||'';this[_0x4a05('0x3')]=_0x4e7354[_0x4a05('0x3')]||'';this['tenantId']=_0x4e7354[_0x4a05('0x4')]||'';this[_0x4a05('0x5')]=_0x4e7354[_0x4a05('0x5')]||'';this[_0x4a05('0x6')]=_0x4e7354[_0x4a05('0x6')]||{};this[_0x4a05('0x7')]=_0x4e7354[_0x4a05('0x7')]||'';this[_0x4a05('0x8')]=_0x4e7354[_0x4a05('0x8')]||![];this[_0x4a05('0x9')]=_0x4e7354['Configurations']||{};this[_0x4a05('0xa')]=_0x4e7354[_0x4a05('0xa')]||{};}module[_0x4a05('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index f05c2d1..6ff84d8 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 _0x5c3d=['description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name'];(function(_0x495f3e,_0x1368d9){var _0x5d4a49=function(_0x1c1783){while(--_0x1c1783){_0x495f3e['push'](_0x495f3e['shift']());}};_0x5d4a49(++_0x1368d9);}(_0x5c3d,0x1af));var _0xd5c3=function(_0x43cc43,_0x15b0c8){_0x43cc43=_0x43cc43-0x0;var _0x4212d4=_0x5c3d[_0x43cc43];return _0x4212d4;};'use strict';function FaxAccount(_0x1a2c6e){this['id']=_0x1a2c6e['id']||0x0;this[_0xd5c3('0x0')]=_0x1a2c6e[_0xd5c3('0x0')]||'';this[_0xd5c3('0x1')]=_0x1a2c6e['description'];this[_0xd5c3('0x2')]=_0x1a2c6e[_0xd5c3('0x2')];this['headerinfo']=_0x1a2c6e[_0xd5c3('0x3')];this[_0xd5c3('0x4')]=_0x1a2c6e[_0xd5c3('0x4')];this['minrate']=_0x1a2c6e['minrate']||0x960;this[_0xd5c3('0x5')]=_0x1a2c6e['maxrate']||0x3840;this[_0xd5c3('0x6')]=_0x1a2c6e[_0xd5c3('0x6')]||_0xd5c3('0x7');this['gateway']=_0x1a2c6e[_0xd5c3('0x8')]||'no';this['faxdetect']=_0x1a2c6e[_0xd5c3('0x9')]||'no';this['t38timeout']=_0x1a2c6e[_0xd5c3('0xa')]||0x1388;this[_0xd5c3('0xb')]=_0x1a2c6e[_0xd5c3('0xb')]||_0xd5c3('0xc');this[_0xd5c3('0xd')]=_0x1a2c6e[_0xd5c3('0xd')]?_0x1a2c6e[_0xd5c3('0xd')]:undefined;this[_0xd5c3('0xe')]=_0x1a2c6e[_0xd5c3('0xe')];this[_0xd5c3('0xf')]=_0x1a2c6e['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x1463=['key','exports','name','description','ecm','localstationid','minrate','maxrate','modem','gateway','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x1daac8,_0x2027e8){var _0x40072e=function(_0x197761){while(--_0x197761){_0x1daac8['push'](_0x1daac8['shift']());}};_0x40072e(++_0x2027e8);}(_0x1463,0x98));var _0x3146=function(_0x267aa3,_0x277379){_0x267aa3=_0x267aa3-0x0;var _0x34266b=_0x1463[_0x267aa3];return _0x34266b;};'use strict';function FaxAccount(_0x4a4269){this['id']=_0x4a4269['id']||0x0;this['name']=_0x4a4269[_0x3146('0x0')]||'';this[_0x3146('0x1')]=_0x4a4269[_0x3146('0x1')];this[_0x3146('0x2')]=_0x4a4269[_0x3146('0x2')];this['headerinfo']=_0x4a4269['headerinfo'];this[_0x3146('0x3')]=_0x4a4269[_0x3146('0x3')];this['minrate']=_0x4a4269[_0x3146('0x4')]||0x960;this[_0x3146('0x5')]=_0x4a4269[_0x3146('0x5')]||0x3840;this[_0x3146('0x6')]=_0x4a4269[_0x3146('0x6')]||'v17,v27,v29';this['gateway']=_0x4a4269[_0x3146('0x7')]||'no';this['faxdetect']=_0x4a4269['faxdetect']||'no';this[_0x3146('0x8')]=_0x4a4269[_0x3146('0x8')]||0x1388;this[_0x3146('0x9')]=_0x4a4269['tech']||_0x3146('0xa');this['Trunk']=_0x4a4269[_0x3146('0xb')]?_0x4a4269[_0x3146('0xb')]:undefined;this[_0x3146('0xc')]=_0x4a4269[_0x3146('0xc')];this[_0x3146('0xd')]=_0x4a4269[_0x3146('0xd')];}module[_0x3146('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index da56c67..f3e2d83 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 _0x0ce4=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x459a95,_0x3ea176){var _0x2eed44=function(_0x3529f3){while(--_0x3529f3){_0x459a95['push'](_0x459a95['shift']());}};_0x2eed44(++_0x3ea176);}(_0x0ce4,0x1cf));var _0x40ce=function(_0x148a5f,_0x1582d6){_0x148a5f=_0x148a5f-0x0;var _0x3cc7de=_0x0ce4[_0x148a5f];return _0x3cc7de;};'use strict';function FreshdeskAccount(_0x5588b5){this['id']=_0x5588b5['id']||0x0;this['name']=_0x5588b5[_0x40ce('0x0')]||'';this[_0x40ce('0x1')]=_0x5588b5['username']||'';this[_0x40ce('0x2')]=_0x5588b5[_0x40ce('0x3')]||'';this[_0x40ce('0x4')]=_0x5588b5[_0x40ce('0x4')]||'';this[_0x40ce('0x5')]=_0x5588b5['serverUrl']||'';this[_0x40ce('0x6')]=_0x5588b5['Configurations']||{};}module[_0x40ce('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x48b1=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x2a491e,_0x109841){var _0xbd144b=function(_0x362c1d){while(--_0x362c1d){_0x2a491e['push'](_0x2a491e['shift']());}};_0xbd144b(++_0x109841);}(_0x48b1,0x1b6));var _0x148b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48b1[_0x3dd15e];return _0x231fd0;};'use strict';function FreshdeskAccount(_0x5c59da){this['id']=_0x5c59da['id']||0x0;this['name']=_0x5c59da[_0x148b('0x0')]||'';this[_0x148b('0x1')]=_0x5c59da[_0x148b('0x1')]||'';this[_0x148b('0x2')]=_0x5c59da['token']||'';this[_0x148b('0x3')]=_0x5c59da['remoteUri']||'';this[_0x148b('0x4')]=_0x5c59da[_0x148b('0x4')]||'';this['Configurations']=_0x5c59da[_0x148b('0x5')]||{};}module[_0x148b('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f7b9558..f6ee266 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 _0x0ec6=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x22ccc0,_0x914457){var _0xe2af6a=function(_0x55aa01){while(--_0x55aa01){_0x22ccc0['push'](_0x22ccc0['shift']());}};_0xe2af6a(++_0x914457);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x44372c,_0x237463){_0x44372c=_0x44372c-0x0;var _0x2fcf12=_0x0ec6[_0x44372c];return _0x2fcf12;};'use strict';function FreshsalesAccount(_0xe90f65){this['id']=_0xe90f65['id']||0x0;this['name']=_0xe90f65['name']||'';this[_0x60ec('0x0')]=_0xe90f65[_0x60ec('0x0')]||'';this[_0x60ec('0x1')]=_0xe90f65[_0x60ec('0x2')]||'';this[_0x60ec('0x3')]=_0xe90f65[_0x60ec('0x3')]||'';this[_0x60ec('0x4')]=_0xe90f65['serverUrl']||'';this[_0x60ec('0x5')]=_0xe90f65[_0x60ec('0x5')]||{};}module[_0x60ec('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xfafd=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x4f3d85,_0x246ad0){var _0x4d536e=function(_0x3eb0ac){while(--_0x3eb0ac){_0x4f3d85['push'](_0x4f3d85['shift']());}};_0x4d536e(++_0x246ad0);}(_0xfafd,0xcc));var _0xdfaf=function(_0x28a064,_0x480aa2){_0x28a064=_0x28a064-0x0;var _0x25706e=_0xfafd[_0x28a064];return _0x25706e;};'use strict';function FreshsalesAccount(_0x500079){this['id']=_0x500079['id']||0x0;this[_0xdfaf('0x0')]=_0x500079[_0xdfaf('0x0')]||'';this[_0xdfaf('0x1')]=_0x500079[_0xdfaf('0x1')]||'';this[_0xdfaf('0x2')]=_0x500079[_0xdfaf('0x3')]||'';this[_0xdfaf('0x4')]=_0x500079[_0xdfaf('0x4')]||'';this[_0xdfaf('0x5')]=_0x500079[_0xdfaf('0x5')]||'';this[_0xdfaf('0x6')]=_0x500079[_0xdfaf('0x6')]||{};}module[_0xdfaf('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index fe9c98e..08b259f 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 _0x10ec=['calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','inbound','uniqueid'];(function(_0x489056,_0x17631b){var _0x5e5e8b=function(_0x9b1d0e){while(--_0x9b1d0e){_0x489056['push'](_0x489056['shift']());}};_0x5e5e8b(++_0x17631b);}(_0x10ec,0xb4));var _0xc10e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x10ec[_0xfae23b];return _0x200640;};'use strict';function QueueReport(){this['type']=_0xc10e('0x0');this[_0xc10e('0x1')]='';this[_0xc10e('0x2')]='';this[_0xc10e('0x3')]='';this[_0xc10e('0x4')]='';this['queuecallerjoinAt']=null;this[_0xc10e('0x5')]=null;this[_0xc10e('0x6')]=0x1;this[_0xc10e('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xc10e('0x8')]=null;this[_0xc10e('0x9')]=![];this[_0xc10e('0xa')]=null;this[_0xc10e('0xb')]=![];this[_0xc10e('0xc')]=null;this['originalposition']=0x1;this['channel']='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xc10e('0xd')]='';this[_0xc10e('0xe')]='';this[_0xc10e('0xf')]='';this[_0xc10e('0x10')]='';this[_0xc10e('0x11')]=0x0;this[_0xc10e('0x12')]=![];this[_0xc10e('0x13')]='';this[_0xc10e('0x14')]=_0xc10e('0x15');this[_0xc10e('0x16')]=null;this[_0xc10e('0x17')]=0x0;this[_0xc10e('0x18')]={};}module[_0xc10e('0x19')]=QueueReport; \ No newline at end of file +var _0x9b84=['queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','type','inbound','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count'];(function(_0x283992,_0x185fe8){var _0x3dc145=function(_0x3b28f5){while(--_0x3b28f5){_0x283992['push'](_0x283992['shift']());}};_0x3dc145(++_0x185fe8);}(_0x9b84,0xeb));var _0x49b8=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0x9b84[_0x28e74e];return _0xb45ac1;};'use strict';function QueueReport(){this[_0x49b8('0x0')]=_0x49b8('0x1');this['uniqueid']='';this['calleridnum']='';this[_0x49b8('0x2')]='';this[_0x49b8('0x3')]='';this[_0x49b8('0x4')]=null;this[_0x49b8('0x5')]=null;this[_0x49b8('0x6')]=0x1;this[_0x49b8('0x7')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x49b8('0x8')]=![];this[_0x49b8('0x9')]=null;this['queuecallerexit']=![];this[_0x49b8('0xa')]=null;this['originalposition']=0x1;this[_0x49b8('0xb')]='';this[_0x49b8('0xc')]='';this[_0x49b8('0xd')]='';this[_0x49b8('0xe')]='';this[_0x49b8('0xf')]='';this[_0x49b8('0x10')]='';this[_0x49b8('0x11')]='';this[_0x49b8('0x12')]=0x0;this[_0x49b8('0x13')]=![];this[_0x49b8('0x14')]='';this[_0x49b8('0x15')]=_0x49b8('0x16');this[_0x49b8('0x17')]=null;this[_0x49b8('0x18')]=0x0;this[_0x49b8('0x19')]={};}module[_0x49b8('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 83cb0b3..ac06192 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 _0xe255=['password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x1788fe,_0x925c8c){var _0x86f8b9=function(_0x4cf0b6){while(--_0x4cf0b6){_0x1788fe['push'](_0x1788fe['shift']());}};_0x86f8b9(++_0x925c8c);}(_0xe255,0xcf));var _0x5e25=function(_0x3460d8,_0x565f21){_0x3460d8=_0x3460d8-0x0;var _0x3804f0=_0xe255[_0x3460d8];return _0x3804f0;};'use strict';function SalesforceAccount(_0x31f01c){this['id']=_0x31f01c['id']||0x0;this[_0x5e25('0x0')]=_0x31f01c['name']||'';this[_0x5e25('0x1')]=_0x31f01c[_0x5e25('0x1')]||'';this[_0x5e25('0x2')]=_0x31f01c['remoteUri']||'';this['password']=_0x31f01c[_0x5e25('0x3')]||'';this[_0x5e25('0x4')]=_0x31f01c[_0x5e25('0x4')]||'';this[_0x5e25('0x5')]=_0x31f01c[_0x5e25('0x5')]||'';this[_0x5e25('0x6')]=_0x31f01c[_0x5e25('0x6')]||'';this['type']=_0x31f01c[_0x5e25('0x7')]||'integrationTab';this[_0x5e25('0x8')]=_0x31f01c[_0x5e25('0x8')]||'';this[_0x5e25('0x9')]=_0x31f01c['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xc17f=['type','serverUrl','Configurations','exports','name','username','remoteUri','clientId','clientSecret','securityToken'];(function(_0x26dab8,_0x3be499){var _0xda463e=function(_0x2f2f4b){while(--_0x2f2f4b){_0x26dab8['push'](_0x26dab8['shift']());}};_0xda463e(++_0x3be499);}(_0xc17f,0xae));var _0xfc17=function(_0x507821,_0x39ae7e){_0x507821=_0x507821-0x0;var _0x289f6e=_0xc17f[_0x507821];return _0x289f6e;};'use strict';function SalesforceAccount(_0x24ac32){this['id']=_0x24ac32['id']||0x0;this[_0xfc17('0x0')]=_0x24ac32[_0xfc17('0x0')]||'';this['username']=_0x24ac32[_0xfc17('0x1')]||'';this[_0xfc17('0x2')]=_0x24ac32[_0xfc17('0x2')]||'';this['password']=_0x24ac32['password']||'';this[_0xfc17('0x3')]=_0x24ac32['clientId']||'';this[_0xfc17('0x4')]=_0x24ac32[_0xfc17('0x4')]||'';this[_0xfc17('0x5')]=_0x24ac32[_0xfc17('0x5')]||'';this[_0xfc17('0x6')]=_0x24ac32[_0xfc17('0x6')]||'integrationTab';this[_0xfc17('0x7')]=_0x24ac32[_0xfc17('0x7')]||'';this[_0xfc17('0x8')]=_0x24ac32['Configurations']||{};}module[_0xfc17('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index d69db2d..c246591 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 _0x74e9=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x74e9,0x17f));var _0x974e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x74e9[_0x20a584];return _0x4b41a8;};'use strict';function ServicenowAccount(_0xa9d930){this['id']=_0xa9d930['id']||0x0;this['name']=_0xa9d930[_0x974e('0x0')]||'';this[_0x974e('0x1')]=_0xa9d930[_0x974e('0x1')]||'';this['password']=_0xa9d930[_0x974e('0x2')]||'';this[_0x974e('0x3')]=_0xa9d930[_0x974e('0x3')]||'';this[_0x974e('0x4')]=_0xa9d930[_0x974e('0x4')]||'';this[_0x974e('0x5')]=_0xa9d930[_0x974e('0x5')]||{};}module[_0x974e('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xbb0f=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x502c06,_0x3d5be6){var _0x4ae249=function(_0x3a724e){while(--_0x3a724e){_0x502c06['push'](_0x502c06['shift']());}};_0x4ae249(++_0x3d5be6);}(_0xbb0f,0x132));var _0xfbb0=function(_0x15d38f,_0x2202e0){_0x15d38f=_0x15d38f-0x0;var _0x331044=_0xbb0f[_0x15d38f];return _0x331044;};'use strict';function ServicenowAccount(_0x3dd3fb){this['id']=_0x3dd3fb['id']||0x0;this[_0xfbb0('0x0')]=_0x3dd3fb[_0xfbb0('0x0')]||'';this[_0xfbb0('0x1')]=_0x3dd3fb[_0xfbb0('0x1')]||'';this[_0xfbb0('0x2')]=_0x3dd3fb['password']||'';this[_0xfbb0('0x3')]=_0x3dd3fb[_0xfbb0('0x3')]||'';this['serverUrl']=_0x3dd3fb[_0xfbb0('0x4')]||'';this['Configurations']=_0x3dd3fb[_0xfbb0('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index b9db0a8..09a688e 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 _0x6927=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4315a1,_0x3628c1){var _0x4166df=function(_0x36a7f5){while(--_0x36a7f5){_0x4315a1['push'](_0x4315a1['shift']());}};_0x4166df(++_0x3628c1);}(_0x6927,0x1f3));var _0x7692=function(_0xb19695,_0x31185e){_0xb19695=_0xb19695-0x0;var _0x50c90b=_0x6927[_0xb19695];return _0x50c90b;};'use strict';function SugarcrmAccount(_0xff15e4){this['id']=_0xff15e4['id']||0x0;this['name']=_0xff15e4[_0x7692('0x0')]||'';this[_0x7692('0x1')]=_0xff15e4[_0x7692('0x1')]||'';this[_0x7692('0x2')]=_0xff15e4[_0x7692('0x2')]||'';this[_0x7692('0x3')]=_0xff15e4[_0x7692('0x3')]||'';this[_0x7692('0x4')]=_0xff15e4[_0x7692('0x4')]||'';this[_0x7692('0x5')]=_0xff15e4[_0x7692('0x5')]||{};}module[_0x7692('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xfb0e=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x19df27,_0x8f6c3f){var _0x20842f=function(_0x97c9f4){while(--_0x97c9f4){_0x19df27['push'](_0x19df27['shift']());}};_0x20842f(++_0x8f6c3f);}(_0xfb0e,0xc1));var _0xefb0=function(_0x4f83ca,_0x46f67a){_0x4f83ca=_0x4f83ca-0x0;var _0x1fbac3=_0xfb0e[_0x4f83ca];return _0x1fbac3;};'use strict';function SugarcrmAccount(_0x1e7bbc){this['id']=_0x1e7bbc['id']||0x0;this[_0xefb0('0x0')]=_0x1e7bbc[_0xefb0('0x0')]||'';this[_0xefb0('0x1')]=_0x1e7bbc[_0xefb0('0x1')]||'';this['password']=_0x1e7bbc[_0xefb0('0x2')]||'';this[_0xefb0('0x3')]=_0x1e7bbc[_0xefb0('0x3')]||'';this['serverUrl']=_0x1e7bbc[_0xefb0('0x4')]||'';this['Configurations']=_0x1e7bbc[_0xefb0('0x5')]||{};}module[_0xefb0('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index fa01e01..0fb6c0a 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 _0x552d=['exports','accountcode','state','unknown','stateTime','status','address'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x552d,0xbe));var _0xd552=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x552d[_0x42cae2];return _0x5f256f;};'use strict';function Telephone(_0xc7691c){this['id']=_0xc7691c['id']||0x0;this['name']=_0xc7691c['name']||'';this[_0xd552('0x0')]=_0xc7691c[_0xd552('0x0')]||'';this[_0xd552('0x1')]=_0xd552('0x2');this[_0xd552('0x3')]=0x0;this[_0xd552('0x4')]=_0xd552('0x2');this[_0xd552('0x5')]='';}module[_0xd552('0x6')]=Telephone; \ No newline at end of file +var _0xc593=['address','name','accountcode','state','unknown','status'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xc593,0xfd));var _0x3c59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc593[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x266947){this['id']=_0x266947['id']||0x0;this[_0x3c59('0x0')]=_0x266947['name']||'';this['accountcode']=_0x266947[_0x3c59('0x1')]||'';this[_0x3c59('0x2')]=_0x3c59('0x3');this['stateTime']=0x0;this[_0x3c59('0x4')]=_0x3c59('0x3');this[_0x3c59('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 86ce68d..2f32d6a 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(_0x13a54f,_0x38097d){var _0x252e8f=function(_0x525e31){while(--_0x525e31){_0x13a54f['push'](_0x13a54f['shift']());}};_0x252e8f(++_0x38097d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 _0xa9e0=['exports','name'];(function(_0x1c01cb,_0x3d42ab){var _0x383087=function(_0x251aba){while(--_0x251aba){_0x1c01cb['push'](_0x1c01cb['shift']());}};_0x383087(++_0x3d42ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 1aa15ed..8ee1802 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 _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x5e7cdb,_0x7b0541){var _0x376dfb=function(_0x288f2b){while(--_0x288f2b){_0x5e7cdb['push'](_0x5e7cdb['shift']());}};_0x376dfb(++_0x7b0541);}(_0x2032,0xd9));var _0x2203=function(_0x2e201c,_0x2316f3){_0x2e201c=_0x2e201c-0x0;var _0x50b8e5=_0x2032[_0x2e201c];return _0x50b8e5;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x3d6056,_0xda50b8){var _0x1cef74=function(_0xa73edb){while(--_0xa73edb){_0x3d6056['push'](_0x3d6056['shift']());}};_0x1cef74(++_0xda50b8);}(_0xda2d,0x102));var _0xdda2=function(_0x455a54,_0x31f27d){_0x455a54=_0x455a54-0x0;var _0x446855=_0xda2d[_0x455a54];return _0x446855;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 4b1c8f6..1abeba0 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 _0xa4b6=['address','defaultuser','active','name','state','unknown','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry'];(function(_0x3fa71d,_0x4983c0){var _0x154aaf=function(_0x6c986a){while(--_0x6c986a){_0x3fa71d['push'](_0x3fa71d['shift']());}};_0x154aaf(++_0x4983c0);}(_0xa4b6,0x132));var _0x6a4b=function(_0x4ea4de,_0x25be97){_0x4ea4de=_0x4ea4de-0x0;var _0x500769=_0xa4b6[_0x4ea4de];return _0x500769;};'use strict';function Trunk(_0x5c99e0){this['id']=_0x5c99e0['id']||0x0;this[_0x6a4b('0x0')]=_0x5c99e0[_0x6a4b('0x0')]||![];this['name']=_0x5c99e0[_0x6a4b('0x1')]||'';this[_0x6a4b('0x2')]=_0x6a4b('0x3');this['stateTime']=0x0;this[_0x6a4b('0x4')]='unknown';this[_0x6a4b('0x5')]=_0x5c99e0[_0x6a4b('0x5')]&&_0x5c99e0['registry'][_0x6a4b('0x6')](':')?_0x5c99e0[_0x6a4b('0x5')][_0x6a4b('0x7')](':')[0x0]:'';this[_0x6a4b('0x8')]='';this[_0x6a4b('0x9')]='';this[_0x6a4b('0xa')]='';this[_0x6a4b('0xb')]='';this[_0x6a4b('0xc')]='';this[_0x6a4b('0xd')]='unknown';this['registrationtime']='';this[_0x6a4b('0xe')]='';this[_0x6a4b('0xf')]=_0x5c99e0[_0x6a4b('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xb1fa=['defaultuser','exports','name','state','unknown','stateTime','status','registry','split','host','domain','refresh','registrationtime'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0xb1fa,0x1a2));var _0xab1f=function(_0x11bd14,_0xa708d0){_0x11bd14=_0x11bd14-0x0;var _0x2dc1d6=_0xb1fa[_0x11bd14];return _0x2dc1d6;};'use strict';function Trunk(_0xf081f7){this['id']=_0xf081f7['id']||0x0;this['active']=_0xf081f7['active']||![];this[_0xab1f('0x0')]=_0xf081f7[_0xab1f('0x0')]||'';this[_0xab1f('0x1')]=_0xab1f('0x2');this[_0xab1f('0x3')]=0x0;this[_0xab1f('0x4')]=_0xab1f('0x2');this['registry']=_0xf081f7[_0xab1f('0x5')]&&_0xf081f7[_0xab1f('0x5')]['indexOf'](':')?_0xf081f7[_0xab1f('0x5')][_0xab1f('0x6')](':')[0x0]:'';this[_0xab1f('0x7')]='';this['port']='';this[_0xab1f('0x8')]='';this['domainport']='';this[_0xab1f('0x9')]='';this['stateRegistry']=_0xab1f('0x2');this[_0xab1f('0xa')]='';this['address']='';this[_0xab1f('0xb')]=_0xf081f7[_0xab1f('0xb')]||'';}module[_0xab1f('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 5d7889a..a15643e 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 _0xbd43=['exports','exten','recordingFormat','none'];(function(_0x4cf8cb,_0x45c28b){var _0xf64ef2=function(_0x389a9){while(--_0x389a9){_0x4cf8cb['push'](_0x4cf8cb['shift']());}};_0xf64ef2(++_0x45c28b);}(_0xbd43,0x155));var _0x3bd4=function(_0x5c7347,_0x5ab0d4){_0x5c7347=_0x5c7347-0x0;var _0x44cb3d=_0xbd43[_0x5c7347];return _0x44cb3d;};'use strict';function voiceExtension(_0x2141f6){this['id']=_0x2141f6['id']||0x0;this[_0x3bd4('0x0')]=_0x2141f6[_0x3bd4('0x0')]||'';this[_0x3bd4('0x1')]=_0x2141f6['recordingFormat']||_0x3bd4('0x2');this['mandatoryDisposition']=_0x2141f6['mandatoryDisposition']||![];}module[_0x3bd4('0x3')]=voiceExtension; \ No newline at end of file +var _0x7fa7=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x52c5d0,_0x189098){var _0x19f4d7=function(_0x38e7e9){while(--_0x38e7e9){_0x52c5d0['push'](_0x52c5d0['shift']());}};_0x19f4d7(++_0x189098);}(_0x7fa7,0xc1));var _0x77fa=function(_0x31170f,_0x2ff727){_0x31170f=_0x31170f-0x0;var _0x24ebe6=_0x7fa7[_0x31170f];return _0x24ebe6;};'use strict';function voiceExtension(_0x4359a){this['id']=_0x4359a['id']||0x0;this[_0x77fa('0x0')]=_0x4359a[_0x77fa('0x0')]||'';this[_0x77fa('0x1')]=_0x4359a[_0x77fa('0x1')]||_0x77fa('0x2');this[_0x77fa('0x3')]=_0x4359a['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 6b73c50..5c7320d 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 _0x7d2e=['acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','busy','inUse','invalid','notInUse','paused','ringing','ringInUse','talking','unavailable','unknown'];(function(_0x43a4df,_0x28f4a5){var _0x34bc6f=function(_0xb3112d){while(--_0xb3112d){_0x43a4df['push'](_0x43a4df['shift']());}};_0x34bc6f(++_0x28f4a5);}(_0x7d2e,0x1e6));var _0xe7d2=function(_0x411b75,_0x4de4ca){_0x411b75=_0x411b75-0x0;var _0x5a9239=_0x7d2e[_0x411b75];return _0x5a9239;};'use strict';var monitorFormat={'wav':_0xe7d2('0x0'),'wav49':_0xe7d2('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xe7d2('0x2'),'leastrecent':_0xe7d2('0x3'),'linear':_0xe7d2('0x4'),'random':'random','ringall':_0xe7d2('0x5'),'rr':'roundrobin','rrmemory':_0xe7d2('0x6'),'rrordered':_0xe7d2('0x7'),'wrandom':_0xe7d2('0x8')};function VoiceQueue(_0x51ac95){this['id']=_0x51ac95['id']||0x0;this[_0xe7d2('0x9')]=_0x51ac95['name']||'';this[_0xe7d2('0xa')]=_0x51ac95[_0xe7d2('0xa')]||'';this[_0xe7d2('0xb')]=_0x51ac95[_0xe7d2('0xb')]||_0xe7d2('0xc');this['waiting']=0x0;this[_0xe7d2('0xd')]=0x0;this[_0xe7d2('0xe')]=0x0;this[_0xe7d2('0xf')]=0x0;this[_0xe7d2('0x10')]=0x0;this['sumBillable']=0x0;this[_0xe7d2('0x11')]=0x0;this[_0xe7d2('0x12')]=0x0;this[_0xe7d2('0x13')]=0x0;this[_0xe7d2('0x14')]=0x0;this[_0xe7d2('0x15')]=0x0;this[_0xe7d2('0x16')]=0x0;this['loggedIn']=0x0;this[_0xe7d2('0x17')]=0x0;this['onHold']=0x0;this[_0xe7d2('0x18')]=0x0;this[_0xe7d2('0x19')]=0x0;this[_0xe7d2('0x1a')]=0x0;this[_0xe7d2('0x1b')]=0x0;this[_0xe7d2('0x1c')]=0x0;this[_0xe7d2('0x1d')]=0x0;this[_0xe7d2('0x1e')]=_0x51ac95[_0xe7d2('0x1e')]||![];this[_0xe7d2('0x1f')]=_0x51ac95['acwTimeout']||0xa;this[_0xe7d2('0x20')]=_0x51ac95[_0xe7d2('0x20')]||'no';this[_0xe7d2('0x21')]=!![];this['message']='';this['statusMessage']='';this[_0xe7d2('0x22')]=0x0;this[_0xe7d2('0x23')]=0x0;this[_0xe7d2('0x24')]=_0x51ac95['dialTimezone']||null;this[_0xe7d2('0x25')]=_0x51ac95[_0xe7d2('0x25')]?_0x51ac95[_0xe7d2('0x25')]:null;this[_0xe7d2('0x26')]=_0x51ac95[_0xe7d2('0x26')];this[_0xe7d2('0x27')]=_0x51ac95[_0xe7d2('0x27')]||_0xe7d2('0x28');this[_0xe7d2('0x29')]=_0x51ac95[_0xe7d2('0x29')]||0x0;this[_0xe7d2('0x2a')]=_0x51ac95[_0xe7d2('0x2a')]||0x0;this[_0xe7d2('0x2b')]=_0x51ac95[_0xe7d2('0x2b')]||0x1;this[_0xe7d2('0x2c')]=_0x51ac95[_0xe7d2('0x2c')]||_0xe7d2('0x2d');this['dialPredictiveOptimizationPercentage']=_0x51ac95[_0xe7d2('0x2e')]||0.03;this[_0xe7d2('0x2f')]=_0x51ac95[_0xe7d2('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0x51ac95['dialOriginateCallerIdName']||'anonymous';this['dialOriginateCallerIdNumber']=_0x51ac95[_0xe7d2('0x30')]||_0xe7d2('0x31');this[_0xe7d2('0x32')]=_0x51ac95['dialOriginateTimeout']||0x1e;this[_0xe7d2('0x33')]=_0x51ac95[_0xe7d2('0x33')]||_0xe7d2('0x34');this[_0xe7d2('0x35')]=_0x51ac95[_0xe7d2('0x35')]||0x3;this[_0xe7d2('0x36')]=_0x51ac95[_0xe7d2('0x36')]||undefined;this[_0xe7d2('0x37')]=_0x51ac95[_0xe7d2('0x37')]||0x3;this['dialCongestionRetryFrequency']=_0x51ac95[_0xe7d2('0x38')]||0x96;this[_0xe7d2('0x39')]=_0x51ac95[_0xe7d2('0x39')]||0x3;this[_0xe7d2('0x3a')]=_0x51ac95['dialBusyRetryFrequency']||0x96;this[_0xe7d2('0x3b')]=_0x51ac95[_0xe7d2('0x3b')]||0x3;this['dialNoAnswerRetryFrequency']=_0x51ac95[_0xe7d2('0x3c')]||0x96;this[_0xe7d2('0x3d')]=_0x51ac95['dialNoSuchNumberMaxRetry']||0x3;this[_0xe7d2('0x3e')]=_0x51ac95[_0xe7d2('0x3e')]||0x96;this['dialDropMaxRetry']=_0x51ac95[_0xe7d2('0x3f')]||0x3;this['dialDropRetryFrequency']=_0x51ac95['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x51ac95[_0xe7d2('0x40')]||0x3;this[_0xe7d2('0x41')]=_0x51ac95[_0xe7d2('0x41')]||0x96;this[_0xe7d2('0x42')]=_0x51ac95[_0xe7d2('0x42')]||0x3;this['dialMachineRetryFrequency']=_0x51ac95[_0xe7d2('0x43')]||0x96;this[_0xe7d2('0x44')]=_0x51ac95[_0xe7d2('0x44')]||0x3;this[_0xe7d2('0x45')]=_0x51ac95[_0xe7d2('0x45')]||0x96;this[_0xe7d2('0x46')]=_0x51ac95[_0xe7d2('0x46')]||0x3;this[_0xe7d2('0x47')]=_0x51ac95[_0xe7d2('0x47')]||0x4;this[_0xe7d2('0x48')]=_0x51ac95[_0xe7d2('0x48')]?_0x51ac95['Trunk']:undefined;this['TrunkBackup']=_0x51ac95['TrunkBackup']?_0x51ac95['TrunkBackup']:undefined;this[_0xe7d2('0x49')]=_0x51ac95[_0xe7d2('0x49')]||undefined;this['Interval']=_0x51ac95[_0xe7d2('0x4a')]?_0x51ac95[_0xe7d2('0x4a')]:undefined;this['dialOrderByScheduledAt']=_0x51ac95[_0xe7d2('0x4b')]||'DESC';this[_0xe7d2('0x4c')]=_0x51ac95[_0xe7d2('0x4c')]||undefined;this[_0xe7d2('0x4d')]=_0x51ac95[_0xe7d2('0x4d')]||undefined;this[_0xe7d2('0x4e')]=strategy[_0x51ac95[_0xe7d2('0x4e')]];this[_0xe7d2('0x4f')]=!![];this[_0xe7d2('0x50')]=_0x51ac95[_0xe7d2('0x50')]||![];this['dialAMDInitialSilence']=_0x51ac95[_0xe7d2('0x51')];this[_0xe7d2('0x52')]=_0x51ac95[_0xe7d2('0x52')];this[_0xe7d2('0x53')]=_0x51ac95[_0xe7d2('0x53')];this[_0xe7d2('0x54')]=_0x51ac95[_0xe7d2('0x54')];this[_0xe7d2('0x55')]=_0x51ac95[_0xe7d2('0x55')];this[_0xe7d2('0x56')]=_0x51ac95[_0xe7d2('0x56')];this[_0xe7d2('0x57')]=_0x51ac95[_0xe7d2('0x57')];this[_0xe7d2('0x58')]=_0x51ac95[_0xe7d2('0x58')];this[_0xe7d2('0x59')]=_0x51ac95[_0xe7d2('0x59')];this['outboundRejectCallsDay']=0x0;this[_0xe7d2('0x5a')]=0x0;this[_0xe7d2('0x5b')]=_0x51ac95['timeout'];this[_0xe7d2('0x5c')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xe7d2('0x5d')]=0x0;this[_0xe7d2('0x5e')]=0x0;this[_0xe7d2('0x5f')]=0x0;this[_0xe7d2('0x60')]=0x0;this[_0xe7d2('0x61')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xe7d2('0x62')]=0x0;this[_0xe7d2('0x63')]=0x0;this[_0xe7d2('0x64')]=0x0;this[_0xe7d2('0x65')]=0x0;this[_0xe7d2('0x66')]=0x0;this[_0xe7d2('0x67')]=0x0;this['startProgressive']=undefined;this[_0xe7d2('0x68')]=undefined;this[_0xe7d2('0x69')]=undefined;this[_0xe7d2('0x6a')]=1.05;this[_0xe7d2('0x6b')]=0x0;this[_0xe7d2('0x6c')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xe7d2('0x6d')]=0x0;this[_0xe7d2('0x6e')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xe7d2('0x6f')]=0x0;this[_0xe7d2('0x70')]=0x0;this['predictiveIntervalMaxThreshold']=_0x51ac95['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xe7d2('0x71')]=_0x51ac95[_0xe7d2('0x72')]||0xa;this[_0xe7d2('0x73')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xe7d2('0x74')]=0x0;this[_0xe7d2('0x75')]=0x0;this[_0xe7d2('0x76')]=0x0;this['erlangBusyFactor']=0x0;this[_0xe7d2('0x77')]=_0x51ac95[_0xe7d2('0x77')]||0x1e;this['dialRecallInQueue']=_0x51ac95['dialRecallInQueue']||![];this[_0xe7d2('0x78')]=!!_0x51ac95[_0xe7d2('0x78')]||![];this[_0xe7d2('0x79')]=!!_0x51ac95[_0xe7d2('0x79')]||![];this[_0xe7d2('0x7a')]=_0x51ac95[_0xe7d2('0x7a')]||undefined;this[_0xe7d2('0x7b')]=_0x51ac95[_0xe7d2('0x7b')]||![];this[_0xe7d2('0x7c')]=_0x51ac95[_0xe7d2('0x7c')]||![];this[_0xe7d2('0xa')]=monitorFormat[_0x51ac95['monitor_format']]?monitorFormat[_0x51ac95[_0xe7d2('0xa')]]:undefined;this['mandatoryDisposition']=_0x51ac95[_0xe7d2('0x7d')]||![];this[_0xe7d2('0x7e')]=_0x51ac95[_0xe7d2('0x7e')]?_0x51ac95[_0xe7d2('0x7e')]:undefined;this[_0xe7d2('0x7f')]=![];}module[_0xe7d2('0x80')]=VoiceQueue; \ No newline at end of file +var _0xe0b0=['busy','inUse','invalid','loggedIn','paused','ringing','ringInUse','unavailable','unknown','acw','sendMessageOneNotActive','message','statusMessage','temp','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','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned'];(function(_0x4fb7c2,_0x55818d){var _0x5e1662=function(_0x284d2b){while(--_0x284d2b){_0x4fb7c2['push'](_0x4fb7c2['shift']());}};_0x5e1662(++_0x55818d);}(_0xe0b0,0xe9));var _0x0e0b=function(_0x113d6b,_0x5d166b){_0x113d6b=_0x113d6b-0x0;var _0x351a94=_0xe0b0[_0x113d6b];return _0x351a94;};'use strict';var monitorFormat={'wav':_0x0e0b('0x0'),'wav49':_0x0e0b('0x1'),'gsm':_0x0e0b('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x0e0b('0x3'),'linear':_0x0e0b('0x4'),'random':'random','ringall':_0x0e0b('0x5'),'rr':_0x0e0b('0x6'),'rrmemory':_0x0e0b('0x7'),'rrordered':_0x0e0b('0x8'),'wrandom':_0x0e0b('0x9')};function VoiceQueue(_0x138eeb){this['id']=_0x138eeb['id']||0x0;this[_0x0e0b('0xa')]=_0x138eeb[_0x0e0b('0xa')]||'';this[_0x0e0b('0xb')]=_0x138eeb[_0x0e0b('0xb')]||'';this[_0x0e0b('0xc')]=_0x138eeb[_0x0e0b('0xc')]||_0x0e0b('0xd');this[_0x0e0b('0xe')]=0x0;this[_0x0e0b('0xf')]=0x0;this[_0x0e0b('0x10')]=0x0;this[_0x0e0b('0x11')]=0x0;this[_0x0e0b('0x12')]=0x0;this['sumBillable']=0x0;this[_0x0e0b('0x13')]=0x0;this[_0x0e0b('0x14')]=0x0;this['available']=0x0;this[_0x0e0b('0x15')]=0x0;this[_0x0e0b('0x16')]=0x0;this[_0x0e0b('0x17')]=0x0;this[_0x0e0b('0x18')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x0e0b('0x19')]=0x0;this[_0x0e0b('0x1a')]=0x0;this[_0x0e0b('0x1b')]=0x0;this['talking']=0x0;this[_0x0e0b('0x1c')]=0x0;this[_0x0e0b('0x1d')]=0x0;this[_0x0e0b('0x1e')]=_0x138eeb[_0x0e0b('0x1e')]||![];this['acwTimeout']=_0x138eeb['acwTimeout']||0xa;this['autopause']=_0x138eeb['autopause']||'no';this[_0x0e0b('0x1f')]=!![];this[_0x0e0b('0x20')]='';this[_0x0e0b('0x21')]='';this['originated']=0x0;this[_0x0e0b('0x22')]=0x0;this['dialTimezone']=_0x138eeb[_0x0e0b('0x23')]||null;this['dialGlobalInterval']=_0x138eeb[_0x0e0b('0x24')]?_0x138eeb[_0x0e0b('0x24')]:null;this[_0x0e0b('0x25')]=_0x138eeb['dialActive'];this[_0x0e0b('0x26')]=_0x138eeb[_0x0e0b('0x26')]||_0x0e0b('0x27');this[_0x0e0b('0x28')]=_0x138eeb[_0x0e0b('0x28')]||0x0;this[_0x0e0b('0x29')]=_0x138eeb[_0x0e0b('0x29')]||0x0;this[_0x0e0b('0x2a')]=_0x138eeb['dialPowerLevel']||0x1;this[_0x0e0b('0x2b')]=_0x138eeb[_0x0e0b('0x2b')]||_0x0e0b('0x2c');this[_0x0e0b('0x2d')]=_0x138eeb[_0x0e0b('0x2d')]||0.03;this[_0x0e0b('0x2e')]=_0x138eeb[_0x0e0b('0x2e')]||0x258;this[_0x0e0b('0x2f')]=_0x138eeb['dialOriginateCallerIdName']||_0x0e0b('0x30');this[_0x0e0b('0x31')]=_0x138eeb[_0x0e0b('0x31')]||_0x0e0b('0x30');this[_0x0e0b('0x32')]=_0x138eeb[_0x0e0b('0x32')]||0x1e;this[_0x0e0b('0x33')]=_0x138eeb['dialQueueOptions']||_0x0e0b('0x34');this['dialQueueTimeout']=_0x138eeb[_0x0e0b('0x35')]||0x3;this[_0x0e0b('0x36')]=_0x138eeb[_0x0e0b('0x36')]||undefined;this['dialCongestionMaxRetry']=_0x138eeb[_0x0e0b('0x37')]||0x3;this['dialCongestionRetryFrequency']=_0x138eeb[_0x0e0b('0x38')]||0x96;this['dialBusyMaxRetry']=_0x138eeb[_0x0e0b('0x39')]||0x3;this[_0x0e0b('0x3a')]=_0x138eeb[_0x0e0b('0x3a')]||0x96;this[_0x0e0b('0x3b')]=_0x138eeb['dialNoAnswerMaxRetry']||0x3;this[_0x0e0b('0x3c')]=_0x138eeb[_0x0e0b('0x3c')]||0x96;this[_0x0e0b('0x3d')]=_0x138eeb['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x138eeb[_0x0e0b('0x3e')]||0x96;this['dialDropMaxRetry']=_0x138eeb[_0x0e0b('0x3f')]||0x3;this['dialDropRetryFrequency']=_0x138eeb['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x138eeb[_0x0e0b('0x40')]||0x3;this[_0x0e0b('0x41')]=_0x138eeb[_0x0e0b('0x41')]||0x96;this[_0x0e0b('0x42')]=_0x138eeb[_0x0e0b('0x42')]||0x3;this[_0x0e0b('0x43')]=_0x138eeb[_0x0e0b('0x43')]||0x96;this[_0x0e0b('0x44')]=_0x138eeb[_0x0e0b('0x44')]||0x3;this[_0x0e0b('0x45')]=_0x138eeb[_0x0e0b('0x45')]||0x96;this[_0x0e0b('0x46')]=_0x138eeb['callAdditionalPhoneAfterMin']||0x3;this[_0x0e0b('0x47')]=_0x138eeb['dialGlobalMaxRetry']||0x4;this[_0x0e0b('0x48')]=_0x138eeb[_0x0e0b('0x48')]?_0x138eeb[_0x0e0b('0x48')]:undefined;this[_0x0e0b('0x49')]=_0x138eeb[_0x0e0b('0x49')]?_0x138eeb['TrunkBackup']:undefined;this['dialPrefix']=_0x138eeb[_0x0e0b('0x4a')]||undefined;this[_0x0e0b('0x4b')]=_0x138eeb['Interval']?_0x138eeb[_0x0e0b('0x4b')]:undefined;this['dialOrderByScheduledAt']=_0x138eeb[_0x0e0b('0x4c')]||_0x0e0b('0x4d');this['dialRandomLastDigitCallerIdNumber']=_0x138eeb[_0x0e0b('0x4e')]||undefined;this[_0x0e0b('0x4f')]=_0x138eeb[_0x0e0b('0x4f')]||undefined;this[_0x0e0b('0x50')]=strategy[_0x138eeb['strategy']];this[_0x0e0b('0x51')]=!![];this['dialAMDActive']=_0x138eeb[_0x0e0b('0x52')]||![];this['dialAMDInitialSilence']=_0x138eeb['dialAMDInitialSilence'];this[_0x0e0b('0x53')]=_0x138eeb['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x138eeb['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x138eeb[_0x0e0b('0x54')];this[_0x0e0b('0x55')]=_0x138eeb['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x138eeb[_0x0e0b('0x56')];this[_0x0e0b('0x57')]=_0x138eeb[_0x0e0b('0x57')];this['dialAMDSilenceThreshold']=_0x138eeb[_0x0e0b('0x58')];this[_0x0e0b('0x59')]=_0x138eeb[_0x0e0b('0x59')];this[_0x0e0b('0x5a')]=0x0;this[_0x0e0b('0x5b')]=0x0;this[_0x0e0b('0x5c')]=_0x138eeb['timeout'];this[_0x0e0b('0x5d')]=0x0;this[_0x0e0b('0x5e')]=0x0;this[_0x0e0b('0x5f')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x0e0b('0x60')]=0x0;this[_0x0e0b('0x61')]=0x0;this[_0x0e0b('0x62')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x0e0b('0x63')]=0x0;this[_0x0e0b('0x64')]=0x0;this[_0x0e0b('0x65')]=0x0;this[_0x0e0b('0x66')]=0x0;this[_0x0e0b('0x67')]=undefined;this[_0x0e0b('0x68')]=undefined;this['handlePredictive']=undefined;this[_0x0e0b('0x69')]=1.05;this[_0x0e0b('0x6a')]=0x0;this[_0x0e0b('0x6b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x0e0b('0x6c')]=0x0;this[_0x0e0b('0x6d')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x0e0b('0x6e')]=0x0;this[_0x0e0b('0x6f')]=_0x138eeb[_0x0e0b('0x70')]||0x14;this['predictiveIntervalMinThreshold']=_0x138eeb[_0x0e0b('0x70')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x0e0b('0x71')]=0x0;this[_0x0e0b('0x72')]=0x1;this[_0x0e0b('0x73')]=0x0;this['erlangCallToSecond']=0x0;this[_0x0e0b('0x74')]=0x0;this[_0x0e0b('0x75')]=0x0;this[_0x0e0b('0x76')]=_0x138eeb[_0x0e0b('0x76')]||0x1e;this['dialRecallInQueue']=_0x138eeb[_0x0e0b('0x77')]||![];this['dialPreviewAutoRecallMe']=!!_0x138eeb[_0x0e0b('0x78')]||![];this[_0x0e0b('0x79')]=!!_0x138eeb[_0x0e0b('0x79')]||![];this['dialQueueProject2']=_0x138eeb['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x138eeb[_0x0e0b('0x7a')]||![];this['dialAgiAfterHangupAgent']=_0x138eeb[_0x0e0b('0x7b')]||![];this[_0x0e0b('0xb')]=monitorFormat[_0x138eeb[_0x0e0b('0xb')]]?monitorFormat[_0x138eeb[_0x0e0b('0xb')]]:undefined;this['mandatoryDisposition']=_0x138eeb['mandatoryDisposition']||![];this[_0x0e0b('0x7c')]=_0x138eeb[_0x0e0b('0x7c')]?_0x138eeb[_0x0e0b('0x7c')]:undefined;this[_0x0e0b('0x7d')]=![];}module[_0x0e0b('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 38a3ab8..1fef5b3 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ab0=['strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumDuration','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','active','prototype','loggedin','callers','SIP/','online','status','booked','keys','dialer','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','dialActive','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable'];(function(_0x1dfcd7,_0x3aa138){var _0x265bb5=function(_0x56c380){while(--_0x56c380){_0x1dfcd7['push'](_0x1dfcd7['shift']());}};_0x265bb5(++_0x3aa138);}(_0x9ab0,0x195));var _0x09ab=function(_0x1a954b,_0x237a77){_0x1a954b=_0x1a954b-0x0;var _0x21cf38=_0x9ab0[_0x1a954b];return _0x21cf38;};'use strict';var INBOUND_COUNTERS=[_0x09ab('0x0'),_0x09ab('0x1'),_0x09ab('0x2'),_0x09ab('0x3'),_0x09ab('0x4'),_0x09ab('0x5'),_0x09ab('0x6')];var OUTBOUND_COUNTERS=[_0x09ab('0x0'),_0x09ab('0x7'),'inUse','loggedIn','loggedInDb',_0x09ab('0x8'),_0x09ab('0x9'),_0x09ab('0xa'),_0x09ab('0xb'),_0x09ab('0xc'),_0x09ab('0xd'),_0x09ab('0xe'),_0x09ab('0xf'),_0x09ab('0x10'),'outboundRejectCallsDay',_0x09ab('0x11'),'paused',_0x09ab('0x12'),_0x09ab('0x5'),_0x09ab('0x13'),'sumDuration','total',_0x09ab('0x6')];function VoiceQueueSummary(_0x3bd238){this['id']=_0x3bd238['id'];this['name']=_0x3bd238['name'];this[_0x09ab('0x14')]=_0x3bd238[_0x09ab('0x14')];this[_0x09ab('0x15')]=_0x3bd238[_0x09ab('0x15')]||0x0;this[_0x09ab('0x7')]=_0x3bd238[_0x09ab('0x7')]||0x0;this[_0x09ab('0x0')]=_0x3bd238[_0x09ab('0x0')]||0x0;this[_0x09ab('0x16')]=_0x3bd238[_0x09ab('0x16')]||0x0;this[_0x09ab('0x17')]=_0x3bd238[_0x09ab('0x17')]||0x0;this['invalid']=_0x3bd238[_0x09ab('0x18')]||0x0;this[_0x09ab('0x1')]=_0x3bd238[_0x09ab('0x1')]||0x0;this['loggedInDb']=_0x3bd238[_0x09ab('0x2')]||0x0;this[_0x09ab('0x19')]=_0x3bd238[_0x09ab('0x19')]||0x0;this['notInUse']=_0x3bd238[_0x09ab('0x1a')]||0x0;this[_0x09ab('0x3')]=_0x3bd238[_0x09ab('0x3')]||0x0;this[_0x09ab('0x4')]=_0x3bd238[_0x09ab('0x4')]||0x0;this[_0x09ab('0x1b')]=_0x3bd238['ringInUse'];this[_0x09ab('0x13')]=_0x3bd238[_0x09ab('0x13')];this['sumDuration']=_0x3bd238[_0x09ab('0x1c')];this[_0x09ab('0x1d')]=_0x3bd238[_0x09ab('0x1d')]||0x0;this[_0x09ab('0x5')]=_0x3bd238[_0x09ab('0x5')]||0x0;this[_0x09ab('0x1e')]=_0x3bd238[_0x09ab('0x1e')]||0x0;this[_0x09ab('0x1f')]=_0x3bd238['type'];this[_0x09ab('0x20')]=_0x3bd238[_0x09ab('0x20')]||0x0;this[_0x09ab('0x21')]=_0x3bd238[_0x09ab('0x21')]||0x0;this[_0x09ab('0x22')]=_0x3bd238[_0x09ab('0x22')]||0x0;this['waiting']=_0x3bd238[_0x09ab('0x6')]||0x0;if(_0x3bd238[_0x09ab('0x1f')]===_0x09ab('0x23')){this[_0x09ab('0x12')]=_0x3bd238[_0x09ab('0x12')]||0x0;this['dialActive']=_0x3bd238['dialActive'];this[_0x09ab('0x24')]=_0x3bd238[_0x09ab('0x24')];this['dialOriginateCallerIdName']=_0x3bd238[_0x09ab('0x25')];this[_0x09ab('0x26')]=_0x3bd238[_0x09ab('0x26')];this[_0x09ab('0x27')]=_0x3bd238[_0x09ab('0x27')];this[_0x09ab('0x28')]=_0x3bd238[_0x09ab('0x28')];this[_0x09ab('0x29')]=_0x3bd238['temp'];this[_0x09ab('0x2a')]=_0x3bd238[_0x09ab('0x2a')];this[_0x09ab('0xa')]=_0x3bd238[_0x09ab('0xa')];this[_0x09ab('0xb')]=_0x3bd238[_0x09ab('0xb')];this[_0x09ab('0xc')]=_0x3bd238[_0x09ab('0xc')];this[_0x09ab('0xd')]=_0x3bd238[_0x09ab('0xd')];this[_0x09ab('0x2b')]=_0x3bd238[_0x09ab('0x2b')];this[_0x09ab('0x2c')]=_0x3bd238['outboundDropCallsDayCallersExit'];this[_0x09ab('0x2d')]=_0x3bd238[_0x09ab('0x2d')];this[_0x09ab('0xe')]=_0x3bd238[_0x09ab('0xe')];this[_0x09ab('0xf')]=_0x3bd238[_0x09ab('0xf')];this[_0x09ab('0x2e')]=_0x3bd238[_0x09ab('0x2e')];this[_0x09ab('0x10')]=_0x3bd238['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x3bd238[_0x09ab('0x2f')];this[_0x09ab('0x11')]=_0x3bd238['outboundUnknownCallsDay'];this[_0x09ab('0x30')]=_0x3bd238[_0x09ab('0x30')];this[_0x09ab('0x31')]=_0x3bd238['predictiveIntervalAvgHoldtime'];this[_0x09ab('0x32')]=_0x3bd238[_0x09ab('0x32')];this[_0x09ab('0x33')]=_0x3bd238['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x3bd238[_0x09ab('0x34')];this[_0x09ab('0x35')]=_0x3bd238[_0x09ab('0x35')];this[_0x09ab('0x36')]=_0x3bd238[_0x09ab('0x36')];this['predictiveIntervalHitRate']=_0x3bd238[_0x09ab('0x37')];this[_0x09ab('0x38')]=_0x3bd238['predictiveIntervalMultiplicativeFactor'];this[_0x09ab('0x39')]=_0x3bd238[_0x09ab('0x39')];this['predictiveIntervalAvailable']=_0x3bd238['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x3bd238['predictiveIntervalTotalCalls'];this[_0x09ab('0x8')]=_0x3bd238[_0x09ab('0x8')];this['erlangCalls']=_0x3bd238[_0x09ab('0x3a')];this[_0x09ab('0x3b')]=_0x3bd238[_0x09ab('0x3b')];this[_0x09ab('0x3c')]=_0x3bd238['erlangAbandonmentRate'];this[_0x09ab('0x3d')]=_0x3bd238[_0x09ab('0x3d')];this[_0x09ab('0x3e')]=_0x3bd238[_0x09ab('0x3e')];this[_0x09ab('0x3f')]=_0x3bd238[_0x09ab('0x3f')];this[_0x09ab('0x40')]=_0x3bd238[_0x09ab('0x40')];this[_0x09ab('0x41')]=_0x3bd238[_0x09ab('0x41')];}if(_0x3bd238[_0x09ab('0x42')]){this[_0x09ab('0x42')]={'id':_0x3bd238['Trunk']['id'],'name':_0x3bd238[_0x09ab('0x42')][_0x09ab('0x43')],'active':_0x3bd238[_0x09ab('0x42')][_0x09ab('0x44')],'callerid':_0x3bd238[_0x09ab('0x42')]['callerid']};}}VoiceQueueSummary[_0x09ab('0x45')]['createReport']=function(_0x12f859,_0x317dcf,_0x25d7c2,_0x26f2db){this[_0x09ab('0x2')]=0x0;this['talking']=0x0;this[_0x09ab('0x3')]=0x0;this[_0x09ab('0x21')]=0x0;this[_0x09ab('0x1a')]=0x0;this[_0x09ab('0x17')]=0x0;this[_0x09ab('0x16')]=0x0;this[_0x09ab('0x18')]=0x0;this[_0x09ab('0x20')]=0x0;this[_0x09ab('0x4')]=0x0;this[_0x09ab('0x1b')]=0x0;this[_0x09ab('0x19')]=0x0;if(_0x25d7c2){if(_0x25d7c2[_0x09ab('0x0')]){this[_0x09ab('0x0')]=Number(_0x25d7c2[_0x09ab('0x0')]);}if(_0x25d7c2[_0x09ab('0x46')]){this[_0x09ab('0x1')]=Number(_0x25d7c2[_0x09ab('0x46')]);}if(_0x25d7c2[_0x09ab('0x47')]){this[_0x09ab('0x6')]=Number(_0x25d7c2[_0x09ab('0x47')]);}}for(var _0x566283=0x0;_0x566283<_0x12f859['length'];_0x566283++){var _0x3bcd70=_0x317dcf[_0x09ab('0x48')+_0x12f859[_0x566283]['name']];if(_0x3bcd70&&_0x3bcd70[_0x09ab('0x49')]){this[_0x09ab('0x2')]+=0x1;}if(_0x12f859[_0x566283]['incall']==='1'){this[_0x09ab('0x5')]+=0x1;}if(_0x12f859[_0x566283][_0x09ab('0x3')]==='1'&&!['2','7','8']['includes'](_0x12f859[_0x566283][_0x09ab('0x4a')])){this[_0x09ab('0x3')]+=0x1;}switch(_0x12f859[_0x566283][_0x09ab('0x4a')]){case'0':this[_0x09ab('0x21')]+=0x1;break;case'1':this[_0x09ab('0x1a')]+=0x1;break;case'2':this[_0x09ab('0x17')]+=0x1;break;case'3':this[_0x09ab('0x16')]+=0x1;break;case'4':this[_0x09ab('0x18')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x09ab('0x4')]+=0x1;break;case'7':this[_0x09ab('0x1b')]+=0x1;break;case'8':this[_0x09ab('0x19')]+=0x1;break;}}if(this['dialMethod']===_0x09ab('0x4b')){var _0x3902f9=Object[_0x09ab('0x4c')](_0x26f2db);for(var _0xc2a33b=0x0;_0xc2a33b<_0x3902f9['length'];_0xc2a33b++){var _0x5dc1ee=_0x3902f9[_0xc2a33b];var _0x4ae51e=_0x26f2db[_0x5dc1ee];if(_0x4ae51e['queue']===this[_0x09ab('0x43')]&&_0x4ae51e[_0x09ab('0x1f')]===_0x09ab('0x4d')&&_0x4ae51e['exten']===_0x09ab('0x4e')){this[_0x09ab('0x5')]+=0x1;}}if(this['talking']>this[_0x09ab('0x17')]){this[_0x09ab('0x5')]=this[_0x09ab('0x17')];}this[_0x09ab('0x12')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x09ab('0x4f')]=function(_0x3f4b19){var _0x22fdff=![];if(_0x3f4b19){_0x22fdff=INBOUND_COUNTERS[_0x09ab('0x50')](function(_0x2002c2){return this[_0x2002c2]!==_0x3f4b19[_0x2002c2];},this);}return _0x22fdff;};VoiceQueueSummary['prototype'][_0x09ab('0x51')]=function(_0x14f64d){var _0x278b98=![];var _0x1064ed=![];var _0x47139a=![];if(_0x14f64d){_0x278b98=this[_0x09ab('0x24')]!==_0x14f64d[_0x09ab('0x24')]||this[_0x09ab('0x52')]!==_0x14f64d[_0x09ab('0x52')]||this[_0x09ab('0x40')]!==_0x14f64d['message']||this[_0x09ab('0x41')]!==_0x14f64d[_0x09ab('0x41')];_0x1064ed=OUTBOUND_COUNTERS[_0x09ab('0x50')](function(_0x42ec49){return this[_0x42ec49]!==_0x14f64d[_0x42ec49];},this);if(this['Trunk']&&_0x14f64d[_0x09ab('0x42')]){_0x47139a=this[_0x09ab('0x42')][_0x09ab('0x43')]!==_0x14f64d[_0x09ab('0x42')]['name']||this[_0x09ab('0x42')][_0x09ab('0x44')]!==_0x14f64d['Trunk'][_0x09ab('0x44')];}}return _0x278b98||_0x1064ed||_0x47139a;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0x40c4d9){this[_0x09ab('0x7')]=_0x40c4d9[_0x09ab('0x7')];this['message']=_0x40c4d9['message'];this[_0x09ab('0x41')]=_0x40c4d9[_0x09ab('0x41')];this['originated']=_0x40c4d9[_0x09ab('0x8')];this[_0x09ab('0x9')]=_0x40c4d9[_0x09ab('0x9')];this[_0x09ab('0xa')]=_0x40c4d9[_0x09ab('0xa')];this[_0x09ab('0xb')]=_0x40c4d9[_0x09ab('0xb')];this['outboundBusyCallsDay']=_0x40c4d9[_0x09ab('0xc')];this[_0x09ab('0xd')]=_0x40c4d9[_0x09ab('0xd')];this[_0x09ab('0xe')]=_0x40c4d9[_0x09ab('0xe')];this[_0x09ab('0xf')]=_0x40c4d9[_0x09ab('0xf')];this[_0x09ab('0x10')]=_0x40c4d9[_0x09ab('0x10')];this[_0x09ab('0x2f')]=_0x40c4d9['outboundRejectCallsDay'];this[_0x09ab('0x11')]=_0x40c4d9[_0x09ab('0x11')];this[_0x09ab('0x13')]=_0x40c4d9['sumBillable'];this['sumDuration']=_0x40c4d9[_0x09ab('0x1c')];this[_0x09ab('0x1e')]=_0x40c4d9[_0x09ab('0x1e')];if(this[_0x09ab('0x24')]===_0x09ab('0x53')){this['pTalking']=_0x40c4d9[_0x09ab('0x12')];}};module[_0x09ab('0x54')]=VoiceQueueSummary; \ No newline at end of file +var _0xf6d1=['unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','exten','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','sumDuration','total','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type'];(function(_0x3b29ce,_0x13de5f){var _0x57b233=function(_0x5e4248){while(--_0x5e4248){_0x3b29ce['push'](_0x3b29ce['shift']());}};_0x57b233(++_0x13de5f);}(_0xf6d1,0x99));var _0x1f6d=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xf6d1[_0xae7c2f];return _0x5d7001;};'use strict';var INBOUND_COUNTERS=[_0x1f6d('0x0'),_0x1f6d('0x1'),_0x1f6d('0x2'),_0x1f6d('0x3'),_0x1f6d('0x4'),_0x1f6d('0x5'),_0x1f6d('0x6')];var OUTBOUND_COUNTERS=['available',_0x1f6d('0x7'),'inUse',_0x1f6d('0x1'),_0x1f6d('0x2'),_0x1f6d('0x8'),_0x1f6d('0x9'),_0x1f6d('0xa'),_0x1f6d('0xb'),_0x1f6d('0xc'),_0x1f6d('0xd'),_0x1f6d('0xe'),_0x1f6d('0xf'),_0x1f6d('0x10'),_0x1f6d('0x11'),'outboundUnknownCallsDay',_0x1f6d('0x3'),'pTalking',_0x1f6d('0x5'),'sumBillable',_0x1f6d('0x12'),_0x1f6d('0x13'),_0x1f6d('0x6')];function VoiceQueueSummary(_0x412696){this['id']=_0x412696['id'];this['name']=_0x412696['name'];this[_0x1f6d('0x14')]=_0x412696[_0x1f6d('0x14')];this[_0x1f6d('0x15')]=_0x412696[_0x1f6d('0x15')]||0x0;this[_0x1f6d('0x7')]=_0x412696[_0x1f6d('0x7')]||0x0;this[_0x1f6d('0x0')]=_0x412696[_0x1f6d('0x0')]||0x0;this[_0x1f6d('0x16')]=_0x412696[_0x1f6d('0x16')]||0x0;this['inUse']=_0x412696[_0x1f6d('0x17')]||0x0;this[_0x1f6d('0x18')]=_0x412696[_0x1f6d('0x18')]||0x0;this['loggedIn']=_0x412696[_0x1f6d('0x1')]||0x0;this[_0x1f6d('0x2')]=_0x412696['loggedInDb']||0x0;this[_0x1f6d('0x19')]=_0x412696[_0x1f6d('0x19')]||0x0;this[_0x1f6d('0x1a')]=_0x412696[_0x1f6d('0x1a')]||0x0;this[_0x1f6d('0x3')]=_0x412696[_0x1f6d('0x3')]||0x0;this['ringing']=_0x412696[_0x1f6d('0x4')]||0x0;this[_0x1f6d('0x1b')]=_0x412696[_0x1f6d('0x1b')];this[_0x1f6d('0x1c')]=_0x412696[_0x1f6d('0x1c')];this['sumDuration']=_0x412696[_0x1f6d('0x12')];this[_0x1f6d('0x1d')]=_0x412696['sumHoldTime']||0x0;this['talking']=_0x412696[_0x1f6d('0x5')]||0x0;this[_0x1f6d('0x13')]=_0x412696[_0x1f6d('0x13')]||0x0;this['type']=_0x412696[_0x1f6d('0x1e')];this['unavailable']=_0x412696[_0x1f6d('0x1f')]||0x0;this[_0x1f6d('0x20')]=_0x412696['unknown']||0x0;this[_0x1f6d('0x21')]=_0x412696[_0x1f6d('0x21')]||0x0;this[_0x1f6d('0x6')]=_0x412696['waiting']||0x0;if(_0x412696[_0x1f6d('0x1e')]===_0x1f6d('0x22')){this[_0x1f6d('0x23')]=_0x412696[_0x1f6d('0x23')]||0x0;this[_0x1f6d('0x24')]=_0x412696['dialActive'];this['dialMethod']=_0x412696[_0x1f6d('0x25')];this[_0x1f6d('0x26')]=_0x412696[_0x1f6d('0x26')];this[_0x1f6d('0x27')]=_0x412696[_0x1f6d('0x27')];this[_0x1f6d('0x28')]=_0x412696[_0x1f6d('0x28')];this[_0x1f6d('0x29')]=_0x412696[_0x1f6d('0x29')];this[_0x1f6d('0x2a')]=_0x412696[_0x1f6d('0x2a')];this[_0x1f6d('0x2b')]=_0x412696[_0x1f6d('0x2b')];this['outboundAnswerCallsDay']=_0x412696[_0x1f6d('0xa')];this[_0x1f6d('0xb')]=_0x412696[_0x1f6d('0xb')];this[_0x1f6d('0xc')]=_0x412696[_0x1f6d('0xc')];this[_0x1f6d('0xd')]=_0x412696['outboundCongestionCallsDay'];this[_0x1f6d('0x2c')]=_0x412696['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x412696[_0x1f6d('0x2d')];this[_0x1f6d('0x2e')]=_0x412696[_0x1f6d('0x2e')];this['outboundNoAnswerCallsDay']=_0x412696[_0x1f6d('0xe')];this['outboundNoSuchCallsDay']=_0x412696[_0x1f6d('0xf')];this[_0x1f6d('0x2f')]=_0x412696['outboundOriginateFailureCallsDay'];this[_0x1f6d('0x10')]=_0x412696['outboundReCallsDay'];this[_0x1f6d('0x11')]=_0x412696[_0x1f6d('0x11')];this[_0x1f6d('0x30')]=_0x412696[_0x1f6d('0x30')];this[_0x1f6d('0x31')]=_0x412696['predictiveIntervalAnsweredCalls'];this[_0x1f6d('0x32')]=_0x412696[_0x1f6d('0x32')];this[_0x1f6d('0x33')]=_0x412696[_0x1f6d('0x33')];this[_0x1f6d('0x34')]=_0x412696[_0x1f6d('0x34')];this['predictiveIntervalDroppedCallsTimeout']=_0x412696[_0x1f6d('0x35')];this['predictiveIntervalErlangCalls']=_0x412696[_0x1f6d('0x36')];this[_0x1f6d('0x37')]=_0x412696[_0x1f6d('0x37')];this[_0x1f6d('0x38')]=_0x412696[_0x1f6d('0x38')];this[_0x1f6d('0x39')]=_0x412696['predictiveIntervalMultiplicativeFactor'];this[_0x1f6d('0x3a')]=_0x412696[_0x1f6d('0x3a')];this[_0x1f6d('0x3b')]=_0x412696['predictiveIntervalAvailable'];this[_0x1f6d('0x3c')]=_0x412696[_0x1f6d('0x3c')];this['originated']=_0x412696[_0x1f6d('0x8')];this[_0x1f6d('0x3d')]=_0x412696[_0x1f6d('0x3d')];this[_0x1f6d('0x3e')]=_0x412696[_0x1f6d('0x3e')];this['erlangAbandonmentRate']=_0x412696[_0x1f6d('0x3f')];this[_0x1f6d('0x40')]=_0x412696['erlangBusyFactor'];this['startPredictive']=_0x412696[_0x1f6d('0x41')];this['startProgressive']=_0x412696[_0x1f6d('0x42')];this[_0x1f6d('0x43')]=_0x412696[_0x1f6d('0x43')];this[_0x1f6d('0x44')]=_0x412696[_0x1f6d('0x44')];}if(_0x412696['Trunk']){this[_0x1f6d('0x45')]={'id':_0x412696['Trunk']['id'],'name':_0x412696[_0x1f6d('0x45')][_0x1f6d('0x46')],'active':_0x412696[_0x1f6d('0x45')][_0x1f6d('0x47')],'callerid':_0x412696['Trunk'][_0x1f6d('0x48')]};}}VoiceQueueSummary[_0x1f6d('0x49')][_0x1f6d('0x4a')]=function(_0x49d7fd,_0x52e0c9,_0x457f33,_0x13629c){this[_0x1f6d('0x2')]=0x0;this[_0x1f6d('0x5')]=0x0;this[_0x1f6d('0x3')]=0x0;this[_0x1f6d('0x20')]=0x0;this[_0x1f6d('0x1a')]=0x0;this[_0x1f6d('0x17')]=0x0;this[_0x1f6d('0x16')]=0x0;this[_0x1f6d('0x18')]=0x0;this[_0x1f6d('0x1f')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0x1f6d('0x19')]=0x0;if(_0x457f33){if(_0x457f33[_0x1f6d('0x0')]){this[_0x1f6d('0x0')]=Number(_0x457f33[_0x1f6d('0x0')]);}if(_0x457f33[_0x1f6d('0x4b')]){this[_0x1f6d('0x1')]=Number(_0x457f33[_0x1f6d('0x4b')]);}if(_0x457f33[_0x1f6d('0x4c')]){this[_0x1f6d('0x6')]=Number(_0x457f33[_0x1f6d('0x4c')]);}}for(var _0x2c40ac=0x0;_0x2c40ac<_0x49d7fd[_0x1f6d('0x4d')];_0x2c40ac++){var _0x539620=_0x52e0c9[_0x1f6d('0x4e')+_0x49d7fd[_0x2c40ac][_0x1f6d('0x46')]];if(_0x539620&&_0x539620[_0x1f6d('0x4f')]){this[_0x1f6d('0x2')]+=0x1;}if(_0x49d7fd[_0x2c40ac][_0x1f6d('0x50')]==='1'){this[_0x1f6d('0x5')]+=0x1;}if(_0x49d7fd[_0x2c40ac][_0x1f6d('0x3')]==='1'&&!['2','7','8'][_0x1f6d('0x51')](_0x49d7fd[_0x2c40ac]['status'])){this['paused']+=0x1;}switch(_0x49d7fd[_0x2c40ac][_0x1f6d('0x52')]){case'0':this[_0x1f6d('0x20')]+=0x1;break;case'1':this[_0x1f6d('0x1a')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x1f6d('0x1f')]+=0x1;break;case'6':this[_0x1f6d('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x1f6d('0x19')]+=0x1;break;}}if(this[_0x1f6d('0x25')]===_0x1f6d('0x53')){var _0x4b9f27=Object[_0x1f6d('0x54')](_0x13629c);for(var _0x2d1225=0x0;_0x2d1225<_0x4b9f27[_0x1f6d('0x4d')];_0x2d1225++){var _0x2e017d=_0x4b9f27[_0x2d1225];var _0x42656f=_0x13629c[_0x2e017d];if(_0x42656f['queue']===this[_0x1f6d('0x46')]&&_0x42656f[_0x1f6d('0x1e')]==='dialer'&&_0x42656f[_0x1f6d('0x55')]===_0x1f6d('0x56')){this[_0x1f6d('0x5')]+=0x1;}}if(this['talking']>this[_0x1f6d('0x17')]){this[_0x1f6d('0x5')]=this[_0x1f6d('0x17')];}this[_0x1f6d('0x23')]=0x0;}return this;};VoiceQueueSummary[_0x1f6d('0x49')][_0x1f6d('0x57')]=function(_0x191be0){var _0x2cd751=![];if(_0x191be0){_0x2cd751=INBOUND_COUNTERS[_0x1f6d('0x58')](function(_0xd78357){return this[_0xd78357]!==_0x191be0[_0xd78357];},this);}return _0x2cd751;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x5841c3){var _0x596522=![];var _0x265bba=![];var _0xf1a181=![];if(_0x5841c3){_0x596522=this['dialMethod']!==_0x5841c3[_0x1f6d('0x25')]||this[_0x1f6d('0x24')]!==_0x5841c3['dialActive']||this[_0x1f6d('0x43')]!==_0x5841c3[_0x1f6d('0x43')]||this['statusMessage']!==_0x5841c3[_0x1f6d('0x44')];_0x265bba=OUTBOUND_COUNTERS[_0x1f6d('0x58')](function(_0x17959f){return this[_0x17959f]!==_0x5841c3[_0x17959f];},this);if(this[_0x1f6d('0x45')]&&_0x5841c3[_0x1f6d('0x45')]){_0xf1a181=this['Trunk'][_0x1f6d('0x46')]!==_0x5841c3[_0x1f6d('0x45')][_0x1f6d('0x46')]||this[_0x1f6d('0x45')][_0x1f6d('0x47')]!==_0x5841c3[_0x1f6d('0x45')][_0x1f6d('0x47')];}}return _0x596522||_0x265bba||_0xf1a181;};VoiceQueueSummary[_0x1f6d('0x49')][_0x1f6d('0x59')]=function(_0x4f5cca){this['answered']=_0x4f5cca[_0x1f6d('0x7')];this['message']=_0x4f5cca[_0x1f6d('0x43')];this[_0x1f6d('0x44')]=_0x4f5cca['statusMessage'];this[_0x1f6d('0x8')]=_0x4f5cca[_0x1f6d('0x8')];this[_0x1f6d('0x9')]=_0x4f5cca[_0x1f6d('0x9')];this[_0x1f6d('0xa')]=_0x4f5cca['outboundAnswerCallsDay'];this[_0x1f6d('0xb')]=_0x4f5cca[_0x1f6d('0xb')];this[_0x1f6d('0xc')]=_0x4f5cca['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x4f5cca['outboundCongestionCallsDay'];this[_0x1f6d('0xe')]=_0x4f5cca[_0x1f6d('0xe')];this[_0x1f6d('0xf')]=_0x4f5cca[_0x1f6d('0xf')];this[_0x1f6d('0x10')]=_0x4f5cca[_0x1f6d('0x10')];this['outboundRejectCallsDay']=_0x4f5cca[_0x1f6d('0x11')];this['outboundUnknownCallsDay']=_0x4f5cca['outboundUnknownCallsDay'];this[_0x1f6d('0x1c')]=_0x4f5cca[_0x1f6d('0x1c')];this[_0x1f6d('0x12')]=_0x4f5cca['sumDuration'];this[_0x1f6d('0x13')]=_0x4f5cca['total'];if(this[_0x1f6d('0x25')]===_0x1f6d('0x5a')){this[_0x1f6d('0x23')]=_0x4f5cca[_0x1f6d('0x23')];}};module[_0x1f6d('0x5b')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8b7d54c..7e73cd4 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 _0x8649=['remoteUri','Configurations','exports','name','username','accessKey'];(function(_0x5b2f60,_0x6afda3){var _0x125d03=function(_0x30e34f){while(--_0x30e34f){_0x5b2f60['push'](_0x5b2f60['shift']());}};_0x125d03(++_0x6afda3);}(_0x8649,0x159));var _0x9864=function(_0x37dd2c,_0xed7f18){_0x37dd2c=_0x37dd2c-0x0;var _0x519373=_0x8649[_0x37dd2c];return _0x519373;};'use strict';function VtigerAccount(_0x47975a){this['id']=_0x47975a['id']||0x0;this['name']=_0x47975a[_0x9864('0x0')]||'';this[_0x9864('0x1')]=_0x47975a['username']||'';this[_0x9864('0x2')]=_0x47975a[_0x9864('0x2')]||'';this[_0x9864('0x3')]=_0x47975a[_0x9864('0x3')]||'';this['serverUrl']=_0x47975a['serverUrl']||'';this['Configurations']=_0x47975a[_0x9864('0x4')]||{};}module[_0x9864('0x5')]=VtigerAccount; \ No newline at end of file +var _0x62fc=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x24a8ec,_0x6f8156){var _0x4dd7ea=function(_0x3245ff){while(--_0x3245ff){_0x24a8ec['push'](_0x24a8ec['shift']());}};_0x4dd7ea(++_0x6f8156);}(_0x62fc,0x1c6));var _0xc62f=function(_0x38c2ed,_0xa20cd2){_0x38c2ed=_0x38c2ed-0x0;var _0x1f8097=_0x62fc[_0x38c2ed];return _0x1f8097;};'use strict';function VtigerAccount(_0x265fcc){this['id']=_0x265fcc['id']||0x0;this[_0xc62f('0x0')]=_0x265fcc[_0xc62f('0x0')]||'';this['username']=_0x265fcc[_0xc62f('0x1')]||'';this['accessKey']=_0x265fcc['accessKey']||'';this[_0xc62f('0x2')]=_0x265fcc['remoteUri']||'';this[_0xc62f('0x3')]=_0x265fcc['serverUrl']||'';this[_0xc62f('0x4')]=_0x265fcc[_0xc62f('0x4')]||{};}module[_0xc62f('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 46cedcd..e1ffa84 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 _0x6d05=['remoteUri','type','integrationTab','serverUrl','Configurations','exports','name','username','token'];(function(_0x232907,_0x24b724){var _0x57bddf=function(_0xdedd93){while(--_0xdedd93){_0x232907['push'](_0x232907['shift']());}};_0x57bddf(++_0x24b724);}(_0x6d05,0x19b));var _0x56d0=function(_0x48725e,_0x385515){_0x48725e=_0x48725e-0x0;var _0x4eea65=_0x6d05[_0x48725e];return _0x4eea65;};'use strict';function ZendeskAccount(_0x4e4c36){this['id']=_0x4e4c36['id']||0x0;this[_0x56d0('0x0')]=_0x4e4c36['name']||'';this[_0x56d0('0x1')]=_0x4e4c36[_0x56d0('0x1')]||'';this['password']=_0x4e4c36['password']||'';this[_0x56d0('0x2')]=_0x4e4c36[_0x56d0('0x2')]||'';this[_0x56d0('0x3')]=_0x4e4c36[_0x56d0('0x3')]||'';this['authType']=_0x4e4c36['authType']||'';this[_0x56d0('0x4')]=_0x4e4c36[_0x56d0('0x4')]||_0x56d0('0x5');this[_0x56d0('0x6')]=_0x4e4c36[_0x56d0('0x6')]||'';this['Configurations']=_0x4e4c36[_0x56d0('0x7')]||{};}module[_0x56d0('0x8')]=ZendeskAccount; \ No newline at end of file +var _0xad0f=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x4299f9,_0x2e94f6){var _0x521f3a=function(_0x3e64cb){while(--_0x3e64cb){_0x4299f9['push'](_0x4299f9['shift']());}};_0x521f3a(++_0x2e94f6);}(_0xad0f,0x7e));var _0xfad0=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0xad0f[_0x2dd390];return _0x3afe47;};'use strict';function ZendeskAccount(_0x1061df){this['id']=_0x1061df['id']||0x0;this[_0xfad0('0x0')]=_0x1061df['name']||'';this[_0xfad0('0x1')]=_0x1061df[_0xfad0('0x1')]||'';this['password']=_0x1061df[_0xfad0('0x2')]||'';this['token']=_0x1061df[_0xfad0('0x3')]||'';this[_0xfad0('0x4')]=_0x1061df['remoteUri']||'';this[_0xfad0('0x5')]=_0x1061df[_0xfad0('0x5')]||'';this[_0xfad0('0x6')]=_0x1061df[_0xfad0('0x6')]||_0xfad0('0x7');this[_0xfad0('0x8')]=_0x1061df[_0xfad0('0x8')]||'';this[_0xfad0('0x9')]=_0x1061df[_0xfad0('0x9')]||{};}module[_0xfad0('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 af91050..237203a 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 _0x3cc0=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x17e934,_0x4d2cf2){var _0x4b29f8=function(_0x3f7611){while(--_0x3f7611){_0x17e934['push'](_0x17e934['shift']());}};_0x4b29f8(++_0x4d2cf2);}(_0x3cc0,0x1cb));var _0x03cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3cc0[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0xfc506a){this['id']=_0xfc506a['id']||0x0;this[_0x03cc('0x0')]=_0xfc506a[_0x03cc('0x0')]||'';this[_0x03cc('0x1')]=_0xfc506a[_0x03cc('0x1')]||'';this[_0x03cc('0x2')]=_0xfc506a[_0x03cc('0x2')]||'';this[_0x03cc('0x3')]=_0xfc506a[_0x03cc('0x3')]||'';this['clientId']=_0xfc506a[_0x03cc('0x4')]||'';this[_0x03cc('0x5')]=_0xfc506a[_0x03cc('0x5')]||'';this[_0x03cc('0x6')]=_0xfc506a['serverUrl']||'';this[_0x03cc('0x7')]=_0xfc506a[_0x03cc('0x7')]||'';this[_0x03cc('0x8')]=_0xfc506a['refreshToken']||'';this['Configurations']=_0xfc506a[_0x03cc('0x9')]||{};}module[_0x03cc('0xa')]=ZohoAccount; \ No newline at end of file +var _0xea7e=['code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x1fc4ab,_0x166454){var _0x1466cd=function(_0x1dbbd6){while(--_0x1dbbd6){_0x1fc4ab['push'](_0x1fc4ab['shift']());}};_0x1466cd(++_0x166454);}(_0xea7e,0xe9));var _0xeea7=function(_0xa1225f,_0x291637){_0xa1225f=_0xa1225f-0x0;var _0x2af221=_0xea7e[_0xa1225f];return _0x2af221;};'use strict';function ZohoAccount(_0x284f71){this['id']=_0x284f71['id']||0x0;this[_0xeea7('0x0')]=_0x284f71['name']||'';this[_0xeea7('0x1')]=_0x284f71[_0xeea7('0x1')]||'';this[_0xeea7('0x2')]=_0x284f71[_0xeea7('0x2')]||'';this[_0xeea7('0x3')]=_0x284f71[_0xeea7('0x3')]||'';this[_0xeea7('0x4')]=_0x284f71[_0xeea7('0x4')]||'';this[_0xeea7('0x5')]=_0x284f71['clientSecret']||'';this['serverUrl']=_0x284f71[_0xeea7('0x6')]||'';this[_0xeea7('0x7')]=_0x284f71['code']||'';this[_0xeea7('0x8')]=_0x284f71[_0xeea7('0x8')]||'';this[_0xeea7('0x9')]=_0x284f71[_0xeea7('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 b82be15..f676265 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 _0x7334=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone'];(function(_0x435e3c,_0x4ffd0b){var _0x5250b9=function(_0x1990c9){while(--_0x1990c9){_0x435e3c['push'](_0x435e3c['shift']());}};_0x5250b9(++_0x4ffd0b);}(_0x7334,0x184));var _0x4733=function(_0x13cba6,_0x4b9a9e){_0x13cba6=_0x13cba6-0x0;var _0x48d1ab=_0x7334[_0x13cba6];return _0x48d1ab;};'use strict';var util=require(_0x4733('0x0'));var _=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));function checkNameSurname(_0x5016ad,_0x59882e,_0x26b8f3){var _0x4b8b5a='';if(!_[_0x4733('0x3')](_0x59882e)&&_0x4733('0x4')===typeof _0x59882e){_0x4b8b5a+=_0x59882e;}if(!_[_0x4733('0x3')](_0x26b8f3)&&_0x4733('0x4')===typeof _0x26b8f3){_0x4b8b5a+='\x20'+_0x26b8f3;}if(_0x4b8b5a!==''){return _0x4b8b5a;}return _0x5016ad;}function Action(_0x2b146d,_0x449ead,_0x16d7cc,_0x283754,_0x12cafa){this[_0x4733('0x5')]=_0x16d7cc||undefined;this[_0x4733('0x6')]=_0x2b146d['id'];this[_0x4733('0x7')]=_0x449ead[_0x4733('0x8')];this[_0x4733('0x9')]=_0x449ead[_0x4733('0x9')];this[_0x4733('0xa')]=_0x4733('0x7');this['dialAnswer']=![];this[_0x4733('0xb')]=_[_0x4733('0x3')](_0x2b146d['Agent'])?undefined:_0x2b146d[_0x4733('0xc')]['name'];this[_0x4733('0xd')]=this[_0x4733('0xb')]?util[_0x4733('0xe')](_0x4733('0xf'),this[_0x4733('0xb')]):_0x283754||undefined;this[_0x4733('0x10')]=checkNameSurname(_0x2b146d[_0x4733('0x11')]['phone'],_0x2b146d[_0x4733('0x11')]['firstName'],_0x2b146d[_0x4733('0x11')][_0x4733('0x12')]);this[_0x4733('0x13')]=_0x2b146d[_0x4733('0x13')]||![];this[_0x4733('0x14')]=_0x2b146d[_0x4733('0x15')];this[_0x4733('0x16')]=_0x2b146d[_0x4733('0x16')];this[_0x4733('0x17')]=_0x2b146d['countbusyretry']||0x0;this[_0x4733('0x18')]=_0x2b146d[_0x4733('0x18')]||0x0;this['countnoanswerretry']=_0x2b146d[_0x4733('0x19')]||0x0;this[_0x4733('0x1a')]=(_0x2b146d[_0x4733('0x17')]||0x0)+(_0x2b146d[_0x4733('0x18')]||0x0)+(_0x2b146d['countnoanswerretry']||0x0)+(_0x2b146d['countnosuchnumberretry']||0x0)+(_0x2b146d[_0x4733('0x1b')]||0x0)+(_0x2b146d[_0x4733('0x1c')]||0x0)+(_0x2b146d['countmachineretry']||0x0)+(_0x2b146d[_0x4733('0x1d')]||0x0);this[_0x4733('0x1e')]=_0x2b146d[_0x4733('0x1e')]||0x0;this[_0x4733('0x1b')]=_0x2b146d['countdropretry']||0x0;this[_0x4733('0x1c')]=_0x2b146d[_0x4733('0x1c')]||0x0;this['countmachineretry']=_0x2b146d[_0x4733('0x1f')]||0x0;this[_0x4733('0x1d')]=_0x2b146d['countagentrejectretry']||0x0;this[_0x4733('0x20')]=_0x2b146d[_0x4733('0x20')];this[_0x4733('0x21')]=_0x2b146d[_0x4733('0x21')];this[_0x4733('0x22')]=_0x2b146d[_0x4733('0x22')];this[_0x4733('0x23')]=_0x2b146d[_0x4733('0x23')];this['ContactId']=_0x2b146d[_0x4733('0x24')];this[_0x4733('0x25')]=_0x2b146d[_0x4733('0x25')];this[_0x4733('0x26')]=_[_0x4733('0x3')](_0x2b146d[_0x4733('0xc')])?_0x2b146d[_0x4733('0x26')]:_0x2b146d[_0x4733('0xc')]['id'];this[_0x4733('0x27')]=_0x2b146d[_0x4733('0x27')];this['originatecalleridnum']='';this[_0x4733('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x4733('0xe')]('\x22%s\x22\x20<%s>',this[_0x4733('0x10')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x5b12=['active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName'];(function(_0x3d6949,_0x580884){var _0x112bce=function(_0x1ccf26){while(--_0x1ccf26){_0x3d6949['push'](_0x3d6949['shift']());}};_0x112bce(++_0x580884);}(_0x5b12,0xa3));var _0x25b1=function(_0x1c0d3d,_0x8bfcb8){_0x1c0d3d=_0x1c0d3d-0x0;var _0x21c215=_0x5b12[_0x1c0d3d];return _0x21c215;};'use strict';var util=require(_0x25b1('0x0'));var _=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));function checkNameSurname(_0x569948,_0x1c9b07,_0x5b457b){var _0x2d491e='';if(!_[_0x25b1('0x3')](_0x1c9b07)&&'string'===typeof _0x1c9b07){_0x2d491e+=_0x1c9b07;}if(!_[_0x25b1('0x3')](_0x5b457b)&&'string'===typeof _0x5b457b){_0x2d491e+='\x20'+_0x5b457b;}if(_0x2d491e!==''){return _0x2d491e;}return _0x569948;}function Action(_0x5248c2,_0x35d90b,_0x5523c9,_0x5bb95b,_0x1f715d){this[_0x25b1('0x4')]=_0x5523c9||undefined;this[_0x25b1('0x5')]=_0x5248c2['id'];this[_0x25b1('0x6')]=_0x35d90b[_0x25b1('0x7')];this[_0x25b1('0x8')]=_0x35d90b[_0x25b1('0x8')];this[_0x25b1('0x9')]='queue';this[_0x25b1('0xa')]=![];this[_0x25b1('0xb')]=_[_0x25b1('0x3')](_0x5248c2[_0x25b1('0xc')])?undefined:_0x5248c2[_0x25b1('0xc')][_0x25b1('0x7')];this[_0x25b1('0xd')]=this[_0x25b1('0xb')]?util[_0x25b1('0xe')](_0x25b1('0xf'),this[_0x25b1('0xb')]):_0x5bb95b||undefined;this[_0x25b1('0x10')]=checkNameSurname(_0x5248c2[_0x25b1('0x11')][_0x25b1('0x12')],_0x5248c2[_0x25b1('0x11')][_0x25b1('0x13')],_0x5248c2['Contact'][_0x25b1('0x14')]);this[_0x25b1('0x15')]=_0x5248c2['active']||![];this[_0x25b1('0x16')]=_0x5248c2[_0x25b1('0x12')];this[_0x25b1('0x17')]=_0x5248c2['scheduledat'];this['countbusyretry']=_0x5248c2[_0x25b1('0x18')]||0x0;this['countcongestionretry']=_0x5248c2[_0x25b1('0x19')]||0x0;this[_0x25b1('0x1a')]=_0x5248c2[_0x25b1('0x1a')]||0x0;this[_0x25b1('0x1b')]=(_0x5248c2[_0x25b1('0x18')]||0x0)+(_0x5248c2[_0x25b1('0x19')]||0x0)+(_0x5248c2[_0x25b1('0x1a')]||0x0)+(_0x5248c2[_0x25b1('0x1c')]||0x0)+(_0x5248c2['countdropretry']||0x0)+(_0x5248c2['countabandonedretry']||0x0)+(_0x5248c2[_0x25b1('0x1d')]||0x0)+(_0x5248c2['countagentrejectretry']||0x0);this[_0x25b1('0x1c')]=_0x5248c2['countnosuchnumberretry']||0x0;this[_0x25b1('0x1e')]=_0x5248c2['countdropretry']||0x0;this[_0x25b1('0x1f')]=_0x5248c2['countabandonedretry']||0x0;this[_0x25b1('0x1d')]=_0x5248c2['countmachineretry']||0x0;this['countagentrejectretry']=_0x5248c2['countagentrejectretry']||0x0;this[_0x25b1('0x20')]=_0x5248c2[_0x25b1('0x20')];this['callbackuniqueid']=_0x5248c2[_0x25b1('0x21')];this[_0x25b1('0x22')]=_0x5248c2[_0x25b1('0x22')];this[_0x25b1('0x23')]=_0x5248c2[_0x25b1('0x23')];this['ContactId']=_0x5248c2[_0x25b1('0x24')];this[_0x25b1('0x25')]=_0x5248c2[_0x25b1('0x25')];this[_0x25b1('0x26')]=_[_0x25b1('0x3')](_0x5248c2[_0x25b1('0xc')])?_0x5248c2['UserId']:_0x5248c2[_0x25b1('0xc')]['id'];this[_0x25b1('0x27')]=_0x5248c2[_0x25b1('0x27')];this['originatecalleridnum']='';this[_0x25b1('0x28')]='';}Action[_0x25b1('0x29')][_0x25b1('0x2a')]=function(){return util['format'](_0x25b1('0x2b'),this['calleridname'],this[_0x25b1('0x2c')]);};module[_0x25b1('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 816f220..a80d68d 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 _0x55ca=['syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','originated','sendMessageOneNotActive','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','type','outbound','clockClearZombieChannels','clearZombieChannels','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','originated:\x20','queue','pTalking:\x20','pick','UserId','ListId','Action','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','getContactRecallMe','agents','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','catch','starttime','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','dialActive','Trunk','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','countnosuchnumberretry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','pTalking','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','VoiceQueueId','Queue','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','Calling','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','trunks','SIP/%s','status','reachable','unmonitored','run','unlock','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','unlockContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','actions','originateresponse','syncOriginateResponse','bind','hangup','syncHangup'];(function(_0x4478af,_0x4f27d0){var _0x56e060=function(_0x52d8b3){while(--_0x52d8b3){_0x4478af['push'](_0x4478af['shift']());}};_0x56e060(++_0x4f27d0);}(_0x55ca,0x126));var _0xa55c=function(_0x407bd8,_0x277add){_0x407bd8=_0x407bd8-0x0;var _0x20b6c9=_0x55ca[_0x407bd8];return _0x20b6c9;};'use strict';var util=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require('ioredis');var config=require(_0xa55c('0x2'));var logger=require(_0xa55c('0x3'))('preview');var loggerAction=require(_0xa55c('0x3'))(_0xa55c('0x4'));var ami=require(_0xa55c('0x5'));var rpcDb=require(_0xa55c('0x6'));var cmHopperAdditionalPhone=require(_0xa55c('0x7'));var Action=require(_0xa55c('0x8'));var ut=require(_0xa55c('0x9'));var utils=require('../dialer/utils');config[_0xa55c('0xa')]=_[_0xa55c('0xb')](config['redis'],{'host':_0xa55c('0xc'),'port':0x18eb});var io=require(_0xa55c('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0xa55c('0xe')]=function(_0x20c76a){this[_0xa55c('0xf')]=this[_0xa55c('0xf')]?this[_0xa55c('0xf')][_0xa55c('0x10')](_0x20c76a):_0x20c76a();};function Preview(_0x508342){this[_0xa55c('0x11')]=new Sequence();this[_0xa55c('0x12')]=_0x508342[_0xa55c('0x13')];this['trunks']=_0x508342['trunks'];this[_0xa55c('0x14')]={};this['agents']=_0x508342['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xa55c('0x15'),this[_0xa55c('0x16')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x18'),this[_0xa55c('0x19')][_0xa55c('0x17')](this));ami['on']('hanguprequest',this[_0xa55c('0x1a')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1b'),this[_0xa55c('0x1c')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1d'),this[_0xa55c('0x1e')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x1f'),this['syncVarSet'][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x20'),this[_0xa55c('0x21')][_0xa55c('0x17')](this));ami['on'](_0xa55c('0x22'),this[_0xa55c('0x23')]['bind'](this));this['loopCampaigns'](this[_0xa55c('0x12')]);}function emit(_0x3776ac,_0xade4c4,_0x4cfe10){io['to'](_0x3776ac)[_0xa55c('0x24')](_0xade4c4,_0x4cfe10);}function emitVoiceQueueChannelRemove(_0x2fcb90){logger['info'](_0xa55c('0x25'),JSON[_0xa55c('0x26')](_0x2fcb90));emit(util[_0xa55c('0x27')](_0xa55c('0x28'),_0x2fcb90[_0xa55c('0x29')]),'voice_queue_channel:remove',_0x2fcb90);io[_0xa55c('0x24')]('voice_queue_presence:remove',_0x2fcb90);}function notSendMessagesQueue(_0x5ba836){if(_0x5ba836['sendMessageOneNotActive']){if(_0x5ba836[_0xa55c('0x2a')]===0x0&&_0x5ba836['pTalking']===0x0){_0x5ba836[_0xa55c('0x2b')]=![];_0x5ba836[_0xa55c('0x2c')]=0x0;_0x5ba836[_0xa55c('0x2d')]=0x0;_0x5ba836[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x30')];ut[_0xa55c('0x31')](_0xa55c('0x32'),_0x5ba836[_0xa55c('0x29')]+_0xa55c('0x33'));}else{_0x5ba836[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS'][_0xa55c('0x34')];ut[_0xa55c('0x31')](_0xa55c('0x32'),_0x5ba836[_0xa55c('0x29')]+'\x20is\x20deactivated');}}}Preview[_0xa55c('0x35')][_0xa55c('0x36')]=function(){var _0x1b8388=this;setInterval(function(){_0x1b8388[_0xa55c('0x37')]();},0x7cf);};Preview[_0xa55c('0x35')][_0xa55c('0x37')]=function(){var _0x52d37f=this[_0xa55c('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x35c9c2 in _0x52d37f){if(_0x52d37f[_0xa55c('0x38')](_0x35c9c2)&&(_0x52d37f[_0x35c9c2][_0xa55c('0x39')]===_0xa55c('0x3a')||_0x52d37f[_0x35c9c2]['dialMethod']===_0xa55c('0x3b'))&&_0x52d37f[_0x35c9c2][_0xa55c('0x3c')]===_0xa55c('0x3d')){if(this[_0xa55c('0x3e')]>0x7){this[_0xa55c('0x3e')]=0x0;this[_0xa55c('0x3f')]();}}if(_0x52d37f[_0xa55c('0x38')](_0x35c9c2)&&_0x52d37f[_0x35c9c2][_0xa55c('0x39')]===_0xa55c('0x3a')&&_0x52d37f[_0x35c9c2][_0xa55c('0x3c')]===_0xa55c('0x3d')){if(_0x52d37f[_0x35c9c2]['dialActive']){this['setMessage'](_0x52d37f[_0x35c9c2]);if(_0x52d37f[_0x35c9c2][_0xa55c('0x40')])this[_0xa55c('0x41')](_0x52d37f[_0x35c9c2]);}else{notSendMessagesQueue(_0x52d37f[_0x35c9c2]);}}}};Preview['prototype'][_0xa55c('0x42')]=function(_0x2f0110){var _0x2e9623=this;this[_0xa55c('0x11')][_0xa55c('0xe')](function(){if(!_[_0xa55c('0x43')](_0x2e9623[_0xa55c('0x14')][_0x2f0110])){loggerAction[_0xa55c('0x44')](_0xa55c('0x45'),_0x2f0110,'Queue',_0x2e9623['actions'][_0x2f0110]['queue'],_0xa55c('0x46'),JSON[_0xa55c('0x26')](_0x2e9623[_0xa55c('0x12')][_0x2e9623['actions'][_0x2f0110][_0xa55c('0x47')]]['originated']),_0xa55c('0x48'),JSON['stringify'](_0x2e9623[_0xa55c('0x12')][_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]]['pTalking']),JSON[_0xa55c('0x26')](_0x2e9623[_0xa55c('0x14')][_0x2f0110]['dialAnswer']),JSON[_0xa55c('0x26')](_[_0xa55c('0x49')](_0x2e9623['actions'][_0x2f0110],['contactId',_0xa55c('0x4a'),'VoiceQueueId',_0xa55c('0x4b')])));return ami[_0xa55c('0x4c')]({'action':'status','channel':_0x2e9623['actions'][_0x2f0110]['channel']})['catch'](function(_0x3b3308){if(_0x3b3308[_0xa55c('0x2e')]===_0xa55c('0x4d')){setTimeout(function(){if(_0x2e9623[_0xa55c('0x14')][_0x2f0110]){ut[_0xa55c('0x4e')](_0x2e9623['campaignsPreview'][_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]],_0xa55c('0x4f'));if(_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x50')]===!![]){ut[_0xa55c('0x51')](_0x2e9623['campaignsPreview'][_0x2e9623[_0xa55c('0x14')][_0x2f0110]['queue']],'[clearZombieChannel]');ut[_0xa55c('0x52')](_0xa55c('0x53')+_0x2f0110,_0x2e9623['actions'][_0x2f0110][_0xa55c('0x47')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2f0110,_0x2e9623[_0xa55c('0x14')][_0x2f0110][_0xa55c('0x47')]);delete _0x2e9623[_0xa55c('0x14')][_0x2f0110];}},0x2328);}});}});};Preview['prototype'][_0xa55c('0x3f')]=function(){var _0xd5a006=this;loggerAction['info'](_0xa55c('0x54'),_['size'](this[_0xa55c('0x14')]));for(var _0x43a42d in this['actions']){if(_0xd5a006[_0xa55c('0x14')][_0xa55c('0x38')](_0x43a42d)){_0xd5a006['clearZombieChannel'](_0x43a42d);}}};Preview[_0xa55c('0x35')][_0xa55c('0x41')]=function(_0x204767){var _0x59a6c8=this;rpcDb[_0xa55c('0x55')](_0x204767['id'],ut['agentReadyId'](this[_0xa55c('0x56')]))[_0xa55c('0x57')](function(_0x451269){if(!_['isNil'](_0x451269)){for(var _0x41eab1=0x0;_0x41eab1<_0x451269[_0xa55c('0x58')];_0x41eab1+=0x1){if(ut['getDiff'](_0x451269[_0x41eab1][_0xa55c('0x59')])<_0x204767[_0xa55c('0x5a')]*0x3c){if(_0x451269[_0x41eab1]['Agent']&&!_0x451269[_0x41eab1][_0xa55c('0x5b')][_0xa55c('0x5c')]){_0x59a6c8['run'](_0x451269[_0x41eab1]['id'])[_0xa55c('0x57')](ut[_0xa55c('0x5d')](_0xa55c('0x5e')))[_0xa55c('0x5f')](ut['logger2'](_0xa55c('0x5e')));}else{rpcDb['disableContact'](_0x451269[_0x41eab1]['id']);}}else{var _0x2157d6=new Action(_0x451269[_0x41eab1],_0x204767);_0x2157d6[_0xa55c('0x60')]=moment()[_0xa55c('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x204767[_0xa55c('0x61')]+=0x1;ut[_0xa55c('0x62')](_0x2157d6,0x17,'RecallInQueue');if(_0x204767[_0xa55c('0x63')]){rpcDb[_0xa55c('0x64')](ut[_0xa55c('0x65')](_0x451269[_0x41eab1]));rpcDb[_0xa55c('0x66')](_0x2157d6,_0xa55c('0x67'));}else{ut[_0xa55c('0x62')](_0x2157d6,0x16,_0xa55c('0x68'));rpcDb[_0xa55c('0x66')](_0x2157d6,_0xa55c('0x69'));rpcDb[_0xa55c('0x6a')](_0x2157d6,'[HistoryRecallClose]');}}}}})[_0xa55c('0x5f')](ut[_0xa55c('0x5d')](_0xa55c('0x6b')));};Preview['prototype'][_0xa55c('0x6c')]=function(_0x35bf0a){_0x35bf0a['sendMessageOneNotActive']=!![];if(ut[_0xa55c('0x6d')](_0x35bf0a['loggedIn'])){_0x35bf0a[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x6e')];}else if(!ut[_0xa55c('0x6f')](_0x35bf0a[_0xa55c('0x70')])){_0x35bf0a['message']=utils[_0xa55c('0x2f')][_0xa55c('0x30')];}else if(!this['isTrunkReachable'](_0x35bf0a[_0xa55c('0x71')])){if(!this[_0xa55c('0x72')](_0x35bf0a[_0xa55c('0x73')])){_0x35bf0a[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x35bf0a[_0xa55c('0x2e')]=utils[_0xa55c('0x2f')][_0xa55c('0x74')];}}else{_0x35bf0a[_0xa55c('0x2e')]=utils['CAMPAIGN_STATUS'][_0xa55c('0x74')];}};Preview['prototype'][_0xa55c('0x75')]=function(_0x437ced,_0x20593d,_0x2ccfb1){var _0xec640=this;var _0x53b2f7=this[_0xa55c('0x14')][_0x20593d];var _0x54f776=this[_0xa55c('0x12')][_0x53b2f7[_0xa55c('0x47')]];var _0x2cfe08;var _0x1e1c5b=![];var _0x19aaf5=0x2;var _0x138c9e=0x3;if(_0x54f776){switch(_0x2ccfb1){case'1':_0x54f776[_0xa55c('0x76')]+=0x1;_0x53b2f7['countnosuchnumberretry']+=0x1;_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x0,_0xa55c('0x79'));ami[_0xa55c('0x24')]('custom:agentnosuchnumber',ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x7b')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0x7c'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'0',_0x54f776)['then'](function(_0xdd92c1){_0x1e1c5b=_0xdd92c1[_0xa55c('0x7e')]==0x1;_0x19aaf5=_0x54f776[_0xa55c('0x7f')];_0x138c9e=_0x54f776[_0xa55c('0x80')];if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,'Global');rpcDb[_0xa55c('0x6a')](_0x2cfe08,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x53b2f7[_0xa55c('0x82')]>=_0x54f776['dialNoSuchNumberMaxRetry']){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0x83'));}else{rpcDb[_0xa55c('0x84')](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0x82'),_0x54f776[_0xa55c('0x7f')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];}else{_0x53b2f7['countnosuchnumberretry']++;logger[_0xa55c('0x44')](_0xa55c('0x89'),_0x53b2f7['countnosuchnumberretry']);logger[_0xa55c('0x44')]('id',_0x53b2f7[_0xa55c('0x8a')]);_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnosuchnumberretry':_0x53b2f7[_0xa55c('0x82')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'ANSWER':var _0x1dfaf7=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));_0x53b2f7[_0xa55c('0x8e')]=_0x1dfaf7;_0x53b2f7[_0xa55c('0x8f')]=_0x1dfaf7;_0x53b2f7[_0xa55c('0x50')]=!![];_0x54f776[_0xa55c('0x90')]+=0x1;logger[_0xa55c('0x44')](_0xa55c('0x91'),_0x53b2f7['uniqueid'],_0xa55c('0x92'),_0x54f776[_0xa55c('0x29')],_0xa55c('0x48'),_0x54f776[_0xa55c('0x90')]);ami[_0xa55c('0x24')](_0xa55c('0x93'),ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x94'),this[_0xa55c('0x12')][_0x53b2f7[_0xa55c('0x47')]]));if(_0x54f776[_0xa55c('0x95')]){ami['emit'](_0xa55c('0x96'),ut['buildAcw'](_0x53b2f7));}break;case'16':ami[_0xa55c('0x24')](_0xa55c('0x97'),ut[_0xa55c('0x7a')](_0x53b2f7,'complete',this['campaignsPreview'][_0x53b2f7[_0xa55c('0x47')]]));emitVoiceQueueChannelRemove(ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0x98')));_0x54f776[_0xa55c('0x99')]+=0x1;_0x54f776['total']+=0x1;_0x54f776[_0xa55c('0x9a')]+=0x1;ut[_0xa55c('0x51')](_0x54f776,_0xa55c('0x9b'));_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x4,'Answer');rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0x9c'));rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0x9d'));rpcDb[_0xa55c('0x9e')](_0x53b2f7);_0x54f776['sumDuration']+=_0x53b2f7[_0xa55c('0x9f')];_0x54f776[_0xa55c('0xa0')]+=_0x53b2f7['talktime'];logger[_0xa55c('0x44')](_0xa55c('0xa1'),_0x53b2f7[_0xa55c('0xa2')],'\x20Queue',_0x54f776[_0xa55c('0x29')],_0xa55c('0x48'),_0x54f776[_0xa55c('0x90')]);delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];break;case'BUSY':_0x54f776[_0xa55c('0xa3')]+=0x1;_0x53b2f7[_0xa55c('0xa4')]+=0x1;_0x53b2f7['countglobal']=ut['totalGlobal'](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x5,'Busy');_0x19aaf5=_0x54f776[_0xa55c('0xa5')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')](_0xa55c('0xa6'),ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0xa7')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xa8'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'5',_0x54f776)['then'](function(_0x463195){_0x1e1c5b=_0x463195[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xab'));}else{if(_0x53b2f7[_0xa55c('0xa4')]>=_0x54f776['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x53b2f7,_0xa55c('0xa8'));}else{rpcDb[_0xa55c('0x84')](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0xa4'),_0x54f776['dialBusyRetryFrequency']),_0x53b2f7['unlockAgent'],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xa4')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countbusyretry':_0x53b2f7[_0xa55c('0xa4')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)['then'](function(){});});}});break;case _0xa55c('0xac'):_0x54f776['outboundNoAnswerCallsDay']+=0x1;_0x53b2f7[_0xa55c('0xad')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x3,_0xa55c('0xae'));_0x19aaf5=_0x54f776[_0xa55c('0xaf')];_0x138c9e=_0x54f776[_0xa55c('0x80')];var _0x402f02=ut[_0xa55c('0xb0')](_0x53b2f7,_0x54f776);ami[_0xa55c('0x24')]('custom:agentnoanswer',_0x402f02);rpcDb['createCustomerHistory'](_0x53b2f7,_0xa55c('0xb1'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'3',_0x54f776)[_0xa55c('0x57')](function(_0x256db0){_0x1e1c5b=_0x256db0[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xb2'));}else{if(_0x53b2f7[_0xa55c('0xad')]>=_0x54f776[_0xa55c('0xb3')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xb1'));}else{rpcDb['rescheduleContact'](ut[_0xa55c('0x85')](_0x53b2f7,_0xa55c('0xad'),_0x54f776[_0xa55c('0xaf')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7['countnoanswerretry']++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7['countnoanswerretry']}})['then'](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'CONGESTION':_0x54f776['outboundCongestionCallsDay']+=0x1;_0x53b2f7['countcongestionretry']+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0x8,_0xa55c('0xb4'));_0x19aaf5=_0x54f776[_0xa55c('0xb5')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')]('custom:agentcongestion',ut[_0xa55c('0x7a')](_0x53b2f7,_0xa55c('0xb6')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xb7'));_0xec640['verifyAdditionalPhones'](_0x53b2f7,'8',_0x54f776)[_0xa55c('0x57')](function(_0x25e4e0){_0x1e1c5b=_0x25e4e0[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,'Global');rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xb8'));}else{if(_0x53b2f7[_0xa55c('0xb9')]>=_0x54f776[_0xa55c('0xba')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xb7'));}else{rpcDb[_0xa55c('0x84')](ut['scheduledAt'](_0x53b2f7,'countcongestionretry',_0x54f776[_0xa55c('0xa5')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xb9')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countcongestionretry':_0x53b2f7[_0xa55c('0xb9')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case'CANCEL':_0x54f776[_0xa55c('0xbb')]+=0x1;_0x53b2f7[_0xa55c('0xbc')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x14,_0xa55c('0xbd'));_0x19aaf5=_0x54f776[_0xa55c('0xbe')];_0x138c9e=_0x54f776[_0xa55c('0x80')];ami[_0xa55c('0x24')](_0xa55c('0xbf'),ut['buildObj'](_0x53b2f7,_0xa55c('0xc0')));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xc1'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'20',_0x54f776)[_0xa55c('0x57')](function(_0x31287c){_0x1e1c5b=_0x31287c[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0x14,_0xa55c('0xbd'));rpcDb['createCustomerFinal'](_0x2cfe08,_0xa55c('0xc2'));}else{if(_0x53b2f7[_0xa55c('0xbc')]>=_0x54f776[_0xa55c('0xc3')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0xa55c('0x85')](_0x53b2f7,'countagentrejectretry',_0x54f776[_0xa55c('0xbe')]),_0x53b2f7[_0xa55c('0x86')],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640['incrementPreviewCounters']({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});break;case _0xa55c('0xc4'):_0x54f776[_0xa55c('0xc5')]+=0x1;_0x53b2f7[_0xa55c('0xc6')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut[_0xa55c('0x62')](_0x53b2f7,0xb,_0xa55c('0xc7'));rpcDb[_0xa55c('0x66')](_0x53b2f7,_0xa55c('0xc8'));_0xec640[_0xa55c('0x7d')](_0x53b2f7,'11',_0x54f776)['then'](function(_0x46124b){_0x1e1c5b=_0x46124b['additional']==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x53b2f7[_0xa55c('0xc9')]>=_0x54f776[_0xa55c('0xca')]){rpcDb[_0xa55c('0x6a')](_0x53b2f7,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xa55c('0x84')](ut['scheduledAt'](_0x53b2f7,_0xa55c('0xc6'),_0x54f776[_0xa55c('0xcb')]),_0x53b2f7['unlockAgent'],_0x53b2f7[_0xa55c('0x87')]);}}}else{_0x53b2f7['countnoanswerretry']++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7['countnoanswerretry']}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)['then'](function(){});});}});break;case'18':_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7[_0xa55c('0xcd')]+=0x1;_0x53b2f7['countglobal']=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x12,_0x437ced['cause-txt']||_0x437ced[_0xa55c('0xce')]);ami[_0xa55c('0x24')](_0xa55c('0xcf'),ut[_0xa55c('0x7a')](_0x53b2f7,'amd'));rpcDb[_0xa55c('0x66')](_0x53b2f7,'[callProgressDetectingCustomer][hangupInAMD]');_0xec640[_0xa55c('0x7d')](_0x53b2f7,'18',_0x54f776)['then'](function(_0x4ab9f1){_0x1e1c5b=_0x4ab9f1['additional']==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776['dialGlobalMaxRetry']){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0x12,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd0'));}else{rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xd0'));}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});delete this[_0xa55c('0x14')][_0x437ced['linkedid']];break;case'19':_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7['countglobal']=ut['totalGlobal'](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0x13,_0x437ced[_0xa55c('0xd1')]||_0x437ced['dialstatus']);ami[_0xa55c('0x24')]('custom:amd',ut[_0xa55c('0x7a')](_0x53b2f7,'amd'));rpcDb['createCustomerHistory'](_0x53b2f7,_0xa55c('0xd2'));_0xec640['verifyAdditionalPhones'](_0x53b2f7,'18',_0x54f776)['then'](function(_0x2961b6){_0x1e1c5b=_0x2961b6[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut['totalGlobal'](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut['cloneAction'](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd2'));}else{rpcDb['createCustomerFinal'](_0x53b2f7,'[callProgressDetectingCustomer][machine]');}}else{_0x53b2f7[_0xa55c('0xad')]++;_0xec640[_0xa55c('0x8b')]({'id':_0x53b2f7[_0xa55c('0x8a')],'field':{'countnoanswerretry':_0x53b2f7[_0xa55c('0xad')]}})[_0xa55c('0x57')](function(){_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});});}});delete this[_0xa55c('0x14')][_0x437ced['linkedid']];break;default:if(_0x53b2f7[_0xa55c('0x50')]){ut[_0xa55c('0x51')](_0x54f776,_0xa55c('0xd3'));ut[_0xa55c('0x52')](_0xa55c('0xd4')+_0x54f776[_0xa55c('0x29')],_0x437ced);}_0x54f776[_0xa55c('0xcc')]+=0x1;_0x53b2f7[_0xa55c('0x77')]=ut[_0xa55c('0x78')](_0x53b2f7);ut['logCustomer'](_0x53b2f7,0xc,_0x437ced[_0xa55c('0xd1')]||_0x437ced[_0xa55c('0xce')]);_0x19aaf5=_0x54f776[_0xa55c('0xbe')];_0x138c9e=_0x54f776['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x53b2f7,'[callProgressDetectingCustomer][logUnknown]');_0xec640[_0xa55c('0x7d')](_0x53b2f7,'20',_0x54f776)['then'](function(_0x1ba04f){_0x1e1c5b=_0x1ba04f[_0xa55c('0x7e')]==0x1;if(!_0x1e1c5b){if(ut[_0xa55c('0x78')](_0x53b2f7)>=_0x54f776[_0xa55c('0xa9')]){_0x2cfe08=ut[_0xa55c('0x81')](_0x53b2f7,0xf,_0xa55c('0xaa'));rpcDb[_0xa55c('0x6a')](_0x2cfe08,_0xa55c('0xd5'));}else{rpcDb[_0xa55c('0x6a')](_0x53b2f7,_0xa55c('0xd5'));}delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];}else{_0xec640[_0xa55c('0x8c')](_0x53b2f7,_0x19aaf5,_0x138c9e)[_0xa55c('0x57')](function(){});}});}if(!(_0x53b2f7[_0xa55c('0x50')]&&_0x2ccfb1==='16')){ut[_0xa55c('0x4e')](_0x54f776,_0xa55c('0xd6'));logger[_0xa55c('0x44')](_0xa55c('0xd7'),_0x53b2f7[_0xa55c('0xa2')],_0xa55c('0x92'),_0x54f776[_0xa55c('0x29')],_0xa55c('0x46'),_0x54f776[_0xa55c('0x2a')]);}if(_0x2ccfb1!=='ANSWER'){delete this[_0xa55c('0x14')][_0x437ced[_0xa55c('0x88')]];delete this['actions'][_0x437ced[_0xa55c('0xd8')]];}_0x54f776[_0xa55c('0xd9')]=!![];}};Preview[_0xa55c('0x35')][_0xa55c('0xda')]=function(_0x31767b,_0x4d9b66,_0x456dd4){if(_['isUndefined'](_0x4d9b66)&&'object'!==typeof _0x4d9b66){return;}if(_[_0xa55c('0xdb')](_0x456dd4)&&_0xa55c('0xdc')!==typeof _0x456dd4){return;}switch(_0x456dd4[_0xa55c('0xdd')]){case'0':ut[_0xa55c('0xde')](_0x31767b,0x0,_0xa55c('0x79'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe0'));break;case'3':ut[_0xa55c('0xde')](_0x31767b,0x3,_0xa55c('0xae'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe1'));break;case'5':ut[_0xa55c('0xde')](_0x31767b,0x5,_0xa55c('0xe2'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe3'));break;case'8':ut[_0xa55c('0xde')](_0x31767b,0x8,_0xa55c('0xb4'));rpcDb[_0xa55c('0xdf')](_0x31767b,_0xa55c('0xe4'));break;case'22':ut['logAgent'](_0x31767b,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x31767b,_0xa55c('0xe5'));break;default:ut[_0xa55c('0xde')](_0x31767b,0xc,_0x456dd4['reason']);rpcDb[_0xa55c('0xdf')](_0x31767b,'[callProgressDetectingAgent][logCongestion]');}ut[_0xa55c('0x4e')](_0x4d9b66,'[callProgressDetectingAgent]');logger[_0xa55c('0x44')](_0xa55c('0xe6'),_0x31767b[_0xa55c('0xa2')],_0xa55c('0x92'),_0x4d9b66[_0xa55c('0x29')],_0xa55c('0x46'),_0x4d9b66[_0xa55c('0x2a')]);delete this[_0xa55c('0x14')][_0x31767b[_0xa55c('0xa2')]];};Preview[_0xa55c('0x35')][_0xa55c('0x7d')]=function(_0x53f209,_0x59f3a4,_0xde7bd){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x53f209,_0x59f3a4,_0xde7bd)[_0xa55c('0x5f')](logger['info'](_0xa55c('0xe7')));};Preview[_0xa55c('0x35')][_0xa55c('0x8c')]=function(_0x5b20c5,_0x3b8f15,_0x18584c){return cmHopperAdditionalPhone[_0xa55c('0x8c')](_0x5b20c5,_0x3b8f15,_0x18584c)['catch'](logger[_0xa55c('0x44')]('[swapAdditionalPhone]\x20'));};Preview[_0xa55c('0x35')]['incrementPreviewCounters']=function(_0x4e8433){return Promise[_0xa55c('0xe8')]()[_0xa55c('0x57')](cmHopperAdditionalPhone[_0xa55c('0x8b')](_0x4e8433))['catch'](logger[_0xa55c('0x44')](_0xa55c('0xe9')));};Preview[_0xa55c('0x35')][_0xa55c('0xea')]=function(_0x4399bd,_0x3e9384,_0x2e76ad,_0x24db74,_0x4b1762){var _0x402298=this;return new Promise(function(_0x1b8b05,_0x80befe){if(_[_0xa55c('0x43')](_0x3e9384)||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xeb')])||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xec')])||_[_0xa55c('0x43')](_0x3e9384[_0xa55c('0xed')])){_0x80befe(ut[_0xa55c('0x2e')]('Contact\x20is\x20undefined',_0x24db74,_0x4b1762));return;}var _0x263d16=uuid['v4']();var _0x48127c=_0x402298['campaignsPreview'][_0x3e9384[_0xa55c('0xee')]['name']];var _0x427e3b=_0x2e76ad?_0x402298['agents'][_0x2e76ad]['id']:undefined;_0x402298[_0xa55c('0x14')][_0x263d16]=new Action(_0x3e9384,_0x48127c,_0x263d16,_0x2e76ad,_0x427e3b);var _0x231499=_0x402298[_0xa55c('0x14')][_0x263d16];_0x231499[_0xa55c('0x86')]=_0x24db74;_0x231499[_0xa55c('0x87')]=_0x4b1762;_0x231499[_0xa55c('0xef')]=_0x2e76ad;if(_[_0xa55c('0xf0')](_0x4399bd)){_0x402298['execCall'](_0x231499,_0x48127c,_0x3e9384,_0x2e76ad)[_0xa55c('0x57')](function(_0x590c0c){logger['info'](_0xa55c('0xf1'),_0xa55c('0xf2')+_0x231499['queue']+_0xa55c('0xf3')+_0x231499[_0xa55c('0x8a')],JSON[_0xa55c('0x26')](_0x590c0c));ami['emit']('custom:agentcalled',ut['buildObj'](_0x231499,'called',_0x402298[_0xa55c('0x12')][_0x231499[_0xa55c('0x47')]]));_0x1b8b05(ut['message'](_0xa55c('0xf4')));})[_0xa55c('0x5f')](function(_0x3b3be0){ut['logger'](_0xa55c('0xf5'),_0x3b3be0);_0x80befe(ut['message']('Call\x20failed',_0x24db74,_0x4b1762));});}else{_0x48127c['outboundBlacklistCallsDay']+=0x1;ut[_0xa55c('0xf6')](_0x231499);rpcDb['createHistory'](_0x231499,_0xa55c('0xf7'));delete _0x402298['actions'][_0x263d16];_0x80befe(ut[_0xa55c('0x2e')](_0xa55c('0xf8'),_0x24db74,_0x4b1762));}});};Preview[_0xa55c('0x35')]['isTrunkReachable']=function(_0x1c016d){return!_[_0xa55c('0x43')](_0x1c016d)&&!_[_0xa55c('0x43')](_0x1c016d[_0xa55c('0x29')])&&!_[_0xa55c('0x43')](_0x1c016d[_0xa55c('0xf9')])&&_0x1c016d[_0xa55c('0xf9')]&&!_[_0xa55c('0x43')](this[_0xa55c('0xfa')][util['format'](_0xa55c('0xfb'),_0x1c016d[_0xa55c('0x29')])])&&!_[_0xa55c('0x43')](this[_0xa55c('0xfa')][util[_0xa55c('0x27')](_0xa55c('0xfb'),_0x1c016d['name'])][_0xa55c('0xfc')])&&(this['trunks'][util[_0xa55c('0x27')](_0xa55c('0xfb'),_0x1c016d['name'])][_0xa55c('0xfc')]===_0xa55c('0xfd')||this['trunks'][util['format'](_0xa55c('0xfb'),_0x1c016d[_0xa55c('0x29')])][_0xa55c('0xfc')]===_0xa55c('0xfe'));};Preview[_0xa55c('0x35')][_0xa55c('0xff')]=function(_0x31b866,_0x37ed47){return this['execRun'](_0x31b866,_0x37ed47)[_0xa55c('0x57')](function(_0x331595){return _[_0xa55c('0x49')](_0x331595,[_0xa55c('0x2e')]);})[_0xa55c('0x5f')](function(_0x59a69d){if(_0x59a69d[_0xa55c('0x100')]){rpcDb['unlockContact'](_0x31b866);}if(_0x59a69d['active']){rpcDb[_0xa55c('0x101')](_0x31b866);}throw _[_0xa55c('0x49')](_0x59a69d,[_0xa55c('0x2e')]);});};Preview[_0xa55c('0x35')]['execRun']=function(_0x125812,_0x155c6e){var _0xa22273=this;var _0x1c7506,_0x3b76df;return rpcDb[_0xa55c('0x102')](_0x125812)[_0xa55c('0x57')](function(_0x239b2e){if(!_['isNil'](_0x239b2e[0x0])){_0x3b76df=_0x239b2e[0x0][_0xa55c('0x103')]?![]:!![];_0x1c7506=_0x239b2e[0x0][_0xa55c('0x103')]?!![]:![];_0x1c7506=_0x155c6e?!![]:_0x1c7506;}var _0x2639cc=_0xa22273[_0xa55c('0x104')](_0x239b2e);if(_0x2639cc['isValid']){rpcDb[_0xa55c('0x105')](_[_0xa55c('0x49')](_0x239b2e[0x0],[_0xa55c('0xed'),'phone']))[_0xa55c('0x57')](function(_0x3a67fb){_0xa22273[_0xa55c('0xea')](_0x3a67fb,_0x239b2e[0x0],_0x155c6e,_0x3b76df,_0x1c7506)[_0xa55c('0x57')](function(_0x19e506){return _0x19e506;})[_0xa55c('0x5f')](function(_0x127c2f){throw _0x127c2f;});})['catch'](function(_0xcd4f3a){ut[_0xa55c('0x31')]('[Preview][checkIsBlackList]',_0xcd4f3a);throw ut[_0xa55c('0x2e')](_0xa55c('0x106'),_0x3b76df,_0x1c7506);});}else{throw ut[_0xa55c('0x2e')](_0x2639cc['message'],_0x3b76df,_0x1c7506);}})['catch'](function(_0x4dba17){ut[_0xa55c('0x31')](_0xa55c('0x107'),_0x4dba17);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview[_0xa55c('0x35')][_0xa55c('0x104')]=function(_0x591ee3){if(_['isNil'](_0x591ee3)||_[_0xa55c('0xf0')](_0x591ee3)||!_[_0xa55c('0x43')](_0x591ee3[0x0][_0xa55c('0x5b')])&&_['isNil'](_0x591ee3[0x0]['Agent'][_0xa55c('0x29')])){ut['logger'](_0xa55c('0x108'),_0x591ee3);return{'isValid':![],'message':_0xa55c('0x109')};}var _0x5a4e69=this[_0xa55c('0x12')][_0x591ee3[0x0]['Queue']['name']];_0x5a4e69['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0xa55c('0x43')](_0x5a4e69)){ut['logger'](_0xa55c('0x10a'),_0x5a4e69);return{'isValid':![],'message':_0xa55c('0x10b')};}if(!this[_0xa55c('0x72')](_0x5a4e69['Trunk'])){ut[_0xa55c('0x31')](_0xa55c('0x10c'),_0xa55c('0x10d')+_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x10e'));if(!this[_0xa55c('0x72')](_0x5a4e69[_0xa55c('0x73')])){ut[_0xa55c('0x31')](_0xa55c('0x10c'),_0x5a4e69[_0xa55c('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xa55c('0x10f')};}}if(!ut[_0xa55c('0x6f')](_0x5a4e69['dialActive'])){ut[_0xa55c('0x31')](_0xa55c('0x110'),_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x111'));return{'isValid':![],'message':_0xa55c('0x10d')+_0x5a4e69[_0xa55c('0x29')]+_0xa55c('0x111')};}return{'isValid':!![],'message':_0xa55c('0x112')};};Preview[_0xa55c('0x35')][_0xa55c('0x113')]=function(_0x131288,_0x197953,_0x262d72,_0x228d12){var _0x16e229=this;return new Promise(function(_0x5c8713,_0x2d03b2){var _0x4b2e75=_0x131288[_0xa55c('0xa2')];var _0x3d0c6d=_0x16e229[_0xa55c('0x72')](_0x197953[_0xa55c('0x71')])?util['format'](_0xa55c('0x114'),_0x197953[_0xa55c('0x71')][_0xa55c('0x29')],_['isNil'](_0x197953[_0xa55c('0x115')])?'':_0x197953[_0xa55c('0x115')][_0xa55c('0x116')]()||'',_0x197953['dialCutDigit']>0x0?_0x262d72[_0xa55c('0xec')][_0xa55c('0x117')](_0x197953[_0xa55c('0x118')]):_0x262d72['phone']):util[_0xa55c('0x27')]('SIP/%s/%s%s',_[_0xa55c('0x43')](_0x197953[_0xa55c('0x73')])?_0x197953[_0xa55c('0x71')][_0xa55c('0x29')]:_0x197953[_0xa55c('0x73')]['name'],_[_0xa55c('0x43')](_0x197953[_0xa55c('0x115')])?'':_0x197953[_0xa55c('0x115')]['trim']()||'',_0x197953[_0xa55c('0x118')]>0x0?_0x262d72[_0xa55c('0xec')][_0xa55c('0x117')](_0x197953['dialCutDigit']):_0x262d72[_0xa55c('0xec')]);var _0x2becbd=_0x16e229[_0xa55c('0x72')](_0x197953[_0xa55c('0x71')])?ut[_0xa55c('0x119')](_0x197953[_0xa55c('0x71')][_0xa55c('0x11a')],_0x197953['dialOriginateCallerIdName'],_0x197953[_0xa55c('0x11b')]>0x0?ut[_0xa55c('0x11c')](_0x197953[_0xa55c('0x11d')],_0x197953[_0xa55c('0x11b')]):_0x197953['dialOriginateCallerIdNumber']):ut[_0xa55c('0x119')](_[_0xa55c('0x43')](_0x197953[_0xa55c('0x73')])?_0x197953[_0xa55c('0x71')][_0xa55c('0x11a')]:_0x197953[_0xa55c('0x73')][_0xa55c('0x11a')],_0x197953['dialOriginateCallerIdName'],_0x197953[_0xa55c('0x11b')]>0x0?ut[_0xa55c('0x11c')](_0x197953[_0xa55c('0x11d')],_0x197953[_0xa55c('0x11b')]):_0x197953[_0xa55c('0x11d')]);if(_0x2becbd){_0x131288['originatecalleridname']=ut['extractCalleridName'](_0x2becbd);_0x131288['originatecalleridnum']=ut[_0xa55c('0x11e')](_0x2becbd);}var _0x124873=ut[_0xa55c('0x11f')](_0x197953,_0x262d72,_0x3d0c6d,_0x2becbd,_0x4b2e75,_0x131288);_[_0xa55c('0x120')](_0x131288,ut[_0xa55c('0x121')](_0x124873));_0x131288[_0xa55c('0x60')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));_0x197953['variables']=_0x124873;var _0x35c42c=ut[_0xa55c('0x122')](_0x131288,_0x197953,_0x124873,_0x131288[_0xa55c('0x87')],_0x228d12);return ami[_0xa55c('0x4c')](_0x35c42c)[_0xa55c('0x57')](function(_0xd511c0){_0x197953['originated']+=0x1;logger[_0xa55c('0x44')]('[originated][increment]',_0x4b2e75,'\x20Queue',_0x197953['name'],'originated:\x20',_0x197953[_0xa55c('0x2a')]);_0x5c8713(_0xd511c0);})[_0xa55c('0x5f')](function(_0x4732b4){ut[_0xa55c('0xde')](_0x131288,0xe,_0xa55c('0x123'));rpcDb[_0xa55c('0xdf')](_0x131288,_0xa55c('0x124'));_0x2d03b2(_0x4732b4);});});};Preview[_0xa55c('0x35')][_0xa55c('0x1e')]=function(_0x9c98af){if(this[_0xa55c('0x14')][_0x9c98af['linkedid']]){this['actions'][_0x9c98af[_0xa55c('0x88')]]['channel']=_0x9c98af[_0xa55c('0x125')];}};Preview[_0xa55c('0x35')][_0xa55c('0x16')]=function(_0x340570){var _0x2ef96f=this;var _0x582b22=this[_0xa55c('0x14')][_0x340570[_0xa55c('0x126')]];if(_0x582b22){if(_0x582b22[_0xa55c('0xef')]&&this['agents'][_0x582b22[_0xa55c('0xef')]]){ut[_0xa55c('0x127')](_0x582b22,this['agents'][_0x582b22['lookAgent']][_0xa55c('0x29')],this[_0xa55c('0x56')][_0x582b22[_0xa55c('0xef')]]['id']);}var _0x4f2883=_[_0xa55c('0x128')](_0x582b22);_0x4f2883[_0xa55c('0x8e')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));var _0x5a37d6=_0x2ef96f['campaignsPreview'][_0x582b22[_0xa55c('0x47')]];if(ut['isFailure'](_0x340570['response'])){if(_0x582b22[_0xa55c('0x86')]){rpcDb[_0xa55c('0x129')](_0x582b22[_0xa55c('0x8a')]);}if(_0x582b22[_0xa55c('0x87')]){rpcDb['disableContact'](_0x582b22[_0xa55c('0x8a')]);}ami[_0xa55c('0x24')](_0xa55c('0x12a'),ut[_0xa55c('0x7a')](_0x582b22,_0xa55c('0x12b'),this['campaignsPreview'][_0x582b22[_0xa55c('0x47')]]));this[_0xa55c('0xda')](_0x4f2883,_0x5a37d6,_0x340570);}else{_0x582b22[_0xa55c('0x60')]=moment()[_0xa55c('0x27')](_0xa55c('0x8d'));ut[_0xa55c('0xde')](_0x4f2883,0x4,_0xa55c('0x12c'));rpcDb['createAgentHistory'](_0x4f2883,_0xa55c('0x12d'));}}};Preview['prototype'][_0xa55c('0x19')]=function(_0x26946f){var _0x3755a7=this['actions'][_0x26946f['linkedid']];var _0x307b39;if(_0x3755a7){_0x307b39=this[_0xa55c('0x12')][_0x3755a7['queue']];logger['info'](_0xa55c('0x12e'),_0x26946f[_0xa55c('0x88')],'\x20Queue',_0x307b39[_0xa55c('0x29')],'pTalking:\x20',_0x307b39[_0xa55c('0x90')]);}if(this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]&&_0x26946f[_0xa55c('0x88')]!==_0x26946f['uniqueid']){if(_0x26946f[_0xa55c('0x12f')]==='16'&&this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x26946f,_0x26946f[_0xa55c('0x88')],_0x26946f['cause']);}else if(this['actions'][_0x26946f[_0xa55c('0x88')]][_0xa55c('0x50')]){logger[_0xa55c('0x44')](_0xa55c('0x130'),_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')],_0xa55c('0x92'),_0x307b39[_0xa55c('0x29')],_0xa55c('0x48'),_0x307b39[_0xa55c('0x90')]);this['callProgressDetectingCustomer'](_0x26946f,_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')]);}}else if(_0x3755a7&&_[_0xa55c('0x43')](_0x3755a7[_0xa55c('0x131')])&&_0x307b39[_0xa55c('0x132')]&&_0x26946f['linkedid']===_0x26946f[_0xa55c('0xa2')]&&_[_0xa55c('0x43')](_0x26946f[_0xa55c('0xdd')])&&_0x26946f[_0xa55c('0x12f')]==='16'&&_0x26946f['channelstate']==='6'&&_[_0xa55c('0xdb')](_0x3755a7['transfer'])){if(_0x3755a7['unlockAgent']){rpcDb['unlockContact'](_0x3755a7['idContact']);}if(_0x3755a7[_0xa55c('0x87')]){rpcDb[_0xa55c('0x101')](_0x3755a7['idContact']);}_0x26946f[_0xa55c('0xdd')]='22';this[_0xa55c('0xda')](_0x3755a7,_0x307b39,_0x26946f);}else if(_0x3755a7&&_0x3755a7[_0xa55c('0x133')]){if(_0x26946f[_0xa55c('0x12f')]==='16'&&this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]]['dialAnswer']){logger[_0xa55c('0x44')](_0xa55c('0x134'),_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')],'\x20Queue',_0x307b39['name'],'pTalking:\x20',_0x307b39[_0xa55c('0x90')]);this[_0xa55c('0x75')](_0x26946f,_0x26946f[_0xa55c('0x88')],_0x26946f[_0xa55c('0x12f')]);}else if(this[_0xa55c('0x14')][_0x26946f[_0xa55c('0x88')]][_0xa55c('0x50')]){logger[_0xa55c('0x44')]('[syncHangup][talking][cause]',_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')],_0xa55c('0x92'),_0x307b39['name'],_0xa55c('0x48'),_0x307b39[_0xa55c('0x90')]);this['callProgressDetectingCustomer'](_0x26946f,_0x26946f['linkedid'],_0x26946f[_0xa55c('0x12f')]);}}};Preview[_0xa55c('0x35')][_0xa55c('0x1c')]=function(_0x236015){if(this['actions'][_0x236015['destlinkedid']]&&_0x236015[_0xa55c('0xd8')]!==_0x236015[_0xa55c('0x135')]){this[_0xa55c('0x75')](_0x236015,_0x236015[_0xa55c('0xd8')],_0x236015[_0xa55c('0xce')]);}};Preview[_0xa55c('0x35')][_0xa55c('0x1a')]=function(_0x2511fe){if(this[_0xa55c('0x14')][_0x2511fe[_0xa55c('0x88')]]&&_0x2511fe['linkedid']!==_0x2511fe[_0xa55c('0xa2')]&&!this['actions'][_0x2511fe[_0xa55c('0x88')]][_0xa55c('0x50')]){if(_0x2511fe[_0xa55c('0x12f')]==='1'){this[_0xa55c('0x75')](_0x2511fe,_0x2511fe[_0xa55c('0x88')],_0x2511fe[_0xa55c('0x12f')]);}}};Preview[_0xa55c('0x35')][_0xa55c('0x136')]=function(_0x1e8760,_0x329808,_0x35ad66){if(this[_0xa55c('0x14')][_0x1e8760]){if(_[_0xa55c('0x43')](this['actions'][_0x1e8760][_0xa55c('0x137')])){this[_0xa55c('0x14')][_0x1e8760]['variables']={};}this[_0xa55c('0x14')][_0x1e8760][_0xa55c('0x137')][_0x329808]=_0x35ad66;}};Preview[_0xa55c('0x35')]['syncVarSet']=function(_0x238a43){try{if(!_[_0xa55c('0x43')](_0x238a43)){if(ut['filterKey'](_[_0xa55c('0x138')](_0x238a43[_0xa55c('0x139')])[0x0])){this['addVariable'](_0x238a43[_0xa55c('0xa2')],_['keys'](_0x238a43[_0xa55c('0x139')])[0x0],_0x238a43[_0xa55c('0x13a')]);}}}catch(_0x2a6c2d){logger[_0xa55c('0x13b')](_0xa55c('0x13c'),util[_0xa55c('0x13d')](_0x2a6c2d,{'showHidden':![],'depth':null}));}};Preview[_0xa55c('0x35')][_0xa55c('0x21')]=function(_0x9b5e3a){if(_0x9b5e3a){if(this[_0xa55c('0x14')][_0x9b5e3a[_0xa55c('0x13e')]]){this[_0xa55c('0x14')][_0x9b5e3a[_0xa55c('0x13e')]][_0xa55c('0x133')]=!![];}}};Preview[_0xa55c('0x35')][_0xa55c('0x23')]=function(_0x5ac4fa){if(_0x5ac4fa){if(this[_0xa55c('0x14')][_0x5ac4fa['transfererlinkedid']]){this[_0xa55c('0x14')][_0x5ac4fa[_0xa55c('0x13f')]][_0xa55c('0x133')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x9bde=['[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','IsNotLoggedIn','loggedIn','isActive','isTrunkReachable','Trunk','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','uniqueid','\x20Queue','connect','complete','outboundAnswerCallsDay','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','activeContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','run','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','merge','toLowerVariables','variables','variablesAction','[originated][increment]','syncNewExten','syncOriginateResponse','actionid','response','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','lodash','moment','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','logger','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','stringify','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5a29a4,_0x40014b){_0x5a29a4=_0x5a29a4-0x0;var _0x6e346d=_0x9bde[_0x5a29a4];return _0x6e346d;};'use strict';var util=require('util');var _=require(_0xe9bd('0x0'));var uuid=require('uuid');var moment=require(_0xe9bd('0x1'));var Redis=require('ioredis');var config=require(_0xe9bd('0x2'));var logger=require(_0xe9bd('0x3'))(_0xe9bd('0x4'));var loggerAction=require(_0xe9bd('0x3'))(_0xe9bd('0x5'));var ami=require(_0xe9bd('0x6'));var rpcDb=require(_0xe9bd('0x7'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xe9bd('0x8'));var ut=require(_0xe9bd('0x9'));var utils=require(_0xe9bd('0xa'));config[_0xe9bd('0xb')]=_[_0xe9bd('0xc')](config[_0xe9bd('0xb')],{'host':_0xe9bd('0xd'),'port':0x18eb});var io=require(_0xe9bd('0xe'))(new Redis(config[_0xe9bd('0xb')]));var Sequence=function(){};Sequence[_0xe9bd('0xf')]['enqueue']=function(_0x5f36c8){this[_0xe9bd('0x10')]=this[_0xe9bd('0x10')]?this[_0xe9bd('0x10')]['finally'](_0x5f36c8):_0x5f36c8();};function Preview(_0x12c96e){this[_0xe9bd('0x11')]=new Sequence();this[_0xe9bd('0x12')]=_0x12c96e[_0xe9bd('0x13')];this['trunks']=_0x12c96e[_0xe9bd('0x14')];this['actions']={};this[_0xe9bd('0x15')]=_0x12c96e[_0xe9bd('0x15')];this[_0xe9bd('0x16')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xe9bd('0x17')](this));ami['on'](_0xe9bd('0x18'),this[_0xe9bd('0x19')][_0xe9bd('0x17')](this));ami['on'](_0xe9bd('0x1a'),this[_0xe9bd('0x1b')][_0xe9bd('0x17')](this));ami['on']('dialend',this[_0xe9bd('0x1c')][_0xe9bd('0x17')](this));ami['on'](_0xe9bd('0x1d'),this['syncNewExten'][_0xe9bd('0x17')](this));ami['on'](_0xe9bd('0x1e'),this[_0xe9bd('0x1f')][_0xe9bd('0x17')](this));ami['on']('attendedtransfer',this[_0xe9bd('0x20')]['bind'](this));ami['on'](_0xe9bd('0x21'),this['syncBlindTransfer'][_0xe9bd('0x17')](this));this[_0xe9bd('0x22')](this[_0xe9bd('0x12')]);}function emit(_0x3dda13,_0x1acb82,_0x34ffed){io['to'](_0x3dda13)[_0xe9bd('0x23')](_0x1acb82,_0x34ffed);}function emitVoiceQueueChannelRemove(_0x49165b){logger[_0xe9bd('0x24')](_0xe9bd('0x25'),JSON['stringify'](_0x49165b));emit(util[_0xe9bd('0x26')]('voice:queue:%s',_0x49165b[_0xe9bd('0x27')]),_0xe9bd('0x28'),_0x49165b);io[_0xe9bd('0x23')](_0xe9bd('0x29'),_0x49165b);}function notSendMessagesQueue(_0x5bc4bf){if(_0x5bc4bf[_0xe9bd('0x2a')]){if(_0x5bc4bf[_0xe9bd('0x2b')]===0x0&&_0x5bc4bf[_0xe9bd('0x2c')]===0x0){_0x5bc4bf[_0xe9bd('0x2a')]=![];_0x5bc4bf[_0xe9bd('0x2d')]=0x0;_0x5bc4bf[_0xe9bd('0x2e')]=0x0;_0x5bc4bf[_0xe9bd('0x2f')]=utils[_0xe9bd('0x30')][_0xe9bd('0x31')];ut['logger'](_0xe9bd('0x32'),_0x5bc4bf[_0xe9bd('0x27')]+'\x20is\x20not\x20active');}else{_0x5bc4bf[_0xe9bd('0x2f')]=utils[_0xe9bd('0x30')][_0xe9bd('0x33')];ut[_0xe9bd('0x34')](_0xe9bd('0x32'),_0x5bc4bf[_0xe9bd('0x27')]+'\x20is\x20deactivated');}}}Preview['prototype'][_0xe9bd('0x22')]=function(){var _0x56e409=this;setInterval(function(){_0x56e409[_0xe9bd('0x35')]();},0x7cf);};Preview[_0xe9bd('0xf')][_0xe9bd('0x35')]=function(){var _0x36aa80=this[_0xe9bd('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x4b7bc2 in _0x36aa80){if(_0x36aa80[_0xe9bd('0x36')](_0x4b7bc2)&&(_0x36aa80[_0x4b7bc2][_0xe9bd('0x37')]===_0xe9bd('0x4')||_0x36aa80[_0x4b7bc2][_0xe9bd('0x37')]===_0xe9bd('0x38'))&&_0x36aa80[_0x4b7bc2][_0xe9bd('0x39')]===_0xe9bd('0x3a')){if(this[_0xe9bd('0x16')]>0x7){this[_0xe9bd('0x16')]=0x0;this['clearZombieChannels']();}}if(_0x36aa80[_0xe9bd('0x36')](_0x4b7bc2)&&_0x36aa80[_0x4b7bc2][_0xe9bd('0x37')]===_0xe9bd('0x4')&&_0x36aa80[_0x4b7bc2]['type']==='outbound'){if(_0x36aa80[_0x4b7bc2][_0xe9bd('0x3b')]){this[_0xe9bd('0x3c')](_0x36aa80[_0x4b7bc2]);if(_0x36aa80[_0x4b7bc2][_0xe9bd('0x3d')])this[_0xe9bd('0x3e')](_0x36aa80[_0x4b7bc2]);}else{notSendMessagesQueue(_0x36aa80[_0x4b7bc2]);}}}};Preview[_0xe9bd('0xf')][_0xe9bd('0x3f')]=function(_0x1e50ac){var _0x1c6173=this;this[_0xe9bd('0x11')][_0xe9bd('0x40')](function(){if(!_[_0xe9bd('0x41')](_0x1c6173[_0xe9bd('0x42')][_0x1e50ac])){loggerAction[_0xe9bd('0x24')](_0xe9bd('0x43'),_0x1e50ac,_0xe9bd('0x44'),_0x1c6173[_0xe9bd('0x42')][_0x1e50ac][_0xe9bd('0x45')],_0xe9bd('0x46'),JSON['stringify'](_0x1c6173[_0xe9bd('0x12')][_0x1c6173[_0xe9bd('0x42')][_0x1e50ac]['queue']][_0xe9bd('0x2b')]),_0xe9bd('0x47'),JSON['stringify'](_0x1c6173['campaignsPreview'][_0x1c6173[_0xe9bd('0x42')][_0x1e50ac][_0xe9bd('0x45')]]['pTalking']),JSON[_0xe9bd('0x48')](_0x1c6173[_0xe9bd('0x42')][_0x1e50ac][_0xe9bd('0x49')]),JSON['stringify'](_[_0xe9bd('0x4a')](_0x1c6173['actions'][_0x1e50ac],[_0xe9bd('0x4b'),_0xe9bd('0x4c'),_0xe9bd('0x4d'),_0xe9bd('0x4e')])));return ami['Action']({'action':_0xe9bd('0x4f'),'channel':_0x1c6173[_0xe9bd('0x42')][_0x1e50ac][_0xe9bd('0x50')]})[_0xe9bd('0x51')](function(_0x253359){if(_0x253359[_0xe9bd('0x2f')]===_0xe9bd('0x52')){setTimeout(function(){if(_0x1c6173[_0xe9bd('0x42')][_0x1e50ac]){ut[_0xe9bd('0x53')](_0x1c6173[_0xe9bd('0x12')][_0x1c6173['actions'][_0x1e50ac]['queue']],_0xe9bd('0x54'));if(_0x1c6173['actions'][_0x1e50ac][_0xe9bd('0x49')]===!![]){ut[_0xe9bd('0x55')](_0x1c6173[_0xe9bd('0x12')][_0x1c6173['actions'][_0x1e50ac][_0xe9bd('0x45')]],_0xe9bd('0x54'));ut[_0xe9bd('0x56')]('[Dialer][checkChannel][pTalking][Preview]'+_0x1e50ac,_0x1c6173[_0xe9bd('0x42')][_0x1e50ac][_0xe9bd('0x45')]);}ut[_0xe9bd('0x56')](_0xe9bd('0x57')+_0x1e50ac,_0x1c6173[_0xe9bd('0x42')][_0x1e50ac][_0xe9bd('0x45')]);delete _0x1c6173[_0xe9bd('0x42')][_0x1e50ac];}},0x2328);}});}});};Preview[_0xe9bd('0xf')][_0xe9bd('0x58')]=function(){var _0x300e07=this;loggerAction[_0xe9bd('0x24')](_0xe9bd('0x59'),_[_0xe9bd('0x5a')](this[_0xe9bd('0x42')]));for(var _0x41da6e in this['actions']){if(_0x300e07['actions'][_0xe9bd('0x36')](_0x41da6e)){_0x300e07[_0xe9bd('0x3f')](_0x41da6e);}}};Preview[_0xe9bd('0xf')]['recallMe']=function(_0x594e80){var _0x43cf7d=this;rpcDb[_0xe9bd('0x5b')](_0x594e80['id'],ut[_0xe9bd('0x5c')](this[_0xe9bd('0x15')]))[_0xe9bd('0x5d')](function(_0x3d4b58){if(!_[_0xe9bd('0x41')](_0x3d4b58)){for(var _0x512899=0x0;_0x512899<_0x3d4b58[_0xe9bd('0x5e')];_0x512899+=0x1){if(ut['getDiff'](_0x3d4b58[_0x512899][_0xe9bd('0x5f')])<_0x594e80[_0xe9bd('0x60')]*0x3c){if(_0x3d4b58[_0x512899][_0xe9bd('0x61')]&&!_0x3d4b58[_0x512899][_0xe9bd('0x61')][_0xe9bd('0x62')]){_0x43cf7d['run'](_0x3d4b58[_0x512899]['id'])[_0xe9bd('0x5d')](ut[_0xe9bd('0x63')](_0xe9bd('0x64')))['catch'](ut[_0xe9bd('0x63')](_0xe9bd('0x64')));}else{rpcDb[_0xe9bd('0x65')](_0x3d4b58[_0x512899]['id']);}}else{var _0x5a466b=new Action(_0x3d4b58[_0x512899],_0x594e80);_0x5a466b[_0xe9bd('0x66')]=moment()[_0xe9bd('0x26')](_0xe9bd('0x67'));_0x594e80[_0xe9bd('0x68')]+=0x1;ut[_0xe9bd('0x69')](_0x5a466b,0x17,'RecallInQueue');if(_0x594e80[_0xe9bd('0x6a')]){rpcDb['rescheduleContactInQueue'](ut[_0xe9bd('0x6b')](_0x3d4b58[_0x512899]));rpcDb[_0xe9bd('0x6c')](_0x5a466b,_0xe9bd('0x6d'));}else{ut[_0xe9bd('0x69')](_0x5a466b,0x16,_0xe9bd('0x6e'));rpcDb['createCustomerHistory'](_0x5a466b,_0xe9bd('0x6f'));rpcDb['createCustomerFinal'](_0x5a466b,_0xe9bd('0x6f'));}}}}})[_0xe9bd('0x51')](ut['logger2']('[getContactRecallMe]'));};Preview[_0xe9bd('0xf')]['setMessage']=function(_0x1ad573){_0x1ad573['sendMessageOneNotActive']=!![];if(ut[_0xe9bd('0x70')](_0x1ad573[_0xe9bd('0x71')])){_0x1ad573['message']=utils[_0xe9bd('0x30')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xe9bd('0x72')](_0x1ad573[_0xe9bd('0x3b')])){_0x1ad573[_0xe9bd('0x2f')]=utils['CAMPAIGN_STATUS'][_0xe9bd('0x31')];}else if(!this[_0xe9bd('0x73')](_0x1ad573[_0xe9bd('0x74')])){if(!this[_0xe9bd('0x73')](_0x1ad573['TrunkBackup'])){_0x1ad573['message']=utils[_0xe9bd('0x30')]['UNREACHABLE_TRUNK'];}else{_0x1ad573[_0xe9bd('0x2f')]=utils[_0xe9bd('0x30')][_0xe9bd('0x75')];}}else{_0x1ad573[_0xe9bd('0x2f')]=utils[_0xe9bd('0x30')][_0xe9bd('0x75')];}};Preview[_0xe9bd('0xf')][_0xe9bd('0x76')]=function(_0x46a099,_0x3be526,_0x1fd5bf){var _0x78fab0=this;var _0x51500d=this['actions'][_0x3be526];var _0x566dd8=this[_0xe9bd('0x12')][_0x51500d['queue']];var _0x2c4ca7;var _0xdd1301=![];var _0x90db01=0x2;var _0x6232e5=0x3;if(_0x566dd8){switch(_0x1fd5bf){case'1':_0x566dd8[_0xe9bd('0x77')]+=0x1;_0x51500d[_0xe9bd('0x78')]+=0x1;_0x51500d[_0xe9bd('0x79')]=ut[_0xe9bd('0x7a')](_0x51500d);ut[_0xe9bd('0x69')](_0x51500d,0x0,'NoSuchNumber');ami[_0xe9bd('0x23')](_0xe9bd('0x7b'),ut[_0xe9bd('0x7c')](_0x51500d,_0xe9bd('0x7d')));rpcDb['createCustomerHistory'](_0x51500d,_0xe9bd('0x7e'));_0x78fab0[_0xe9bd('0x7f')](_0x51500d,'0',_0x566dd8)[_0xe9bd('0x5d')](function(_0x4e05f0){_0xdd1301=_0x4e05f0[_0xe9bd('0x80')]==0x1;_0x90db01=_0x566dd8[_0xe9bd('0x81')];_0x6232e5=_0x566dd8[_0xe9bd('0x82')];if(!_0xdd1301){if(ut[_0xe9bd('0x7a')](_0x51500d)>=_0x566dd8['dialGlobalMaxRetry']){_0x2c4ca7=ut['cloneAction'](_0x51500d,0xf,_0xe9bd('0x83'));rpcDb[_0xe9bd('0x84')](_0x2c4ca7,_0xe9bd('0x85'));}else{if(_0x51500d[_0xe9bd('0x78')]>=_0x566dd8['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x51500d,_0xe9bd('0x85'));}else{rpcDb[_0xe9bd('0x86')](ut[_0xe9bd('0x87')](_0x51500d,_0xe9bd('0x78'),_0x566dd8[_0xe9bd('0x81')]),_0x51500d[_0xe9bd('0x88')],_0x51500d['activeContact']);}}delete this[_0xe9bd('0x42')][_0x46a099['linkedid']];}else{_0x51500d[_0xe9bd('0x78')]++;logger[_0xe9bd('0x24')](_0xe9bd('0x89'),_0x51500d[_0xe9bd('0x78')]);logger['info']('id',_0x51500d[_0xe9bd('0x8a')]);_0x78fab0[_0xe9bd('0x8b')]({'id':_0x51500d[_0xe9bd('0x8a')],'field':{'countnosuchnumberretry':_0x51500d['countnosuchnumberretry']}})[_0xe9bd('0x5d')](function(){_0x78fab0[_0xe9bd('0x8c')](_0x51500d,_0x90db01,_0x6232e5)[_0xe9bd('0x5d')](function(){});});}});break;case _0xe9bd('0x8d'):var _0x43dabe=moment()[_0xe9bd('0x26')](_0xe9bd('0x67'));_0x51500d[_0xe9bd('0x8e')]=_0x43dabe;_0x51500d[_0xe9bd('0x8f')]=_0x43dabe;_0x51500d[_0xe9bd('0x49')]=!![];_0x566dd8[_0xe9bd('0x2c')]+=0x1;logger[_0xe9bd('0x24')]('[syncHangup][talking][increment]',_0x51500d[_0xe9bd('0x90')],_0xe9bd('0x91'),_0x566dd8['name'],_0xe9bd('0x47'),_0x566dd8[_0xe9bd('0x2c')]);ami['emit']('custom:agentconnect',ut[_0xe9bd('0x7c')](_0x51500d,_0xe9bd('0x92'),this['campaignsPreview'][_0x51500d['queue']]));if(_0x566dd8['acw']){ami[_0xe9bd('0x23')]('custom:agentConnectPreview',ut['buildAcw'](_0x51500d));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0xe9bd('0x7c')](_0x51500d,_0xe9bd('0x93'),this[_0xe9bd('0x12')][_0x51500d['queue']]));emitVoiceQueueChannelRemove(ut[_0xe9bd('0x7c')](_0x51500d,_0xe9bd('0x93')));_0x566dd8[_0xe9bd('0x94')]+=0x1;_0x566dd8[_0xe9bd('0x95')]+=0x1;_0x566dd8['answered']+=0x1;ut[_0xe9bd('0x55')](_0x566dd8,_0xe9bd('0x96'));_0x51500d[_0xe9bd('0x79')]=ut['totalGlobal'](_0x51500d);ut['logCustomer'](_0x51500d,0x4,_0xe9bd('0x97'));rpcDb[_0xe9bd('0x6c')](_0x51500d,_0xe9bd('0x98'));rpcDb[_0xe9bd('0x84')](_0x51500d,_0xe9bd('0x99'));rpcDb[_0xe9bd('0x9a')](_0x51500d);_0x566dd8[_0xe9bd('0x9b')]+=_0x51500d[_0xe9bd('0x9c')];_0x566dd8['sumBillable']+=_0x51500d[_0xe9bd('0x9c')];logger[_0xe9bd('0x24')](_0xe9bd('0x9d'),_0x51500d[_0xe9bd('0x90')],_0xe9bd('0x91'),_0x566dd8['name'],_0xe9bd('0x47'),_0x566dd8['pTalking']);delete this['actions'][_0x46a099[_0xe9bd('0x9e')]];break;case _0xe9bd('0x9f'):_0x566dd8['outboundBusyCallsDay']+=0x1;_0x51500d[_0xe9bd('0xa0')]+=0x1;_0x51500d[_0xe9bd('0x79')]=ut[_0xe9bd('0x7a')](_0x51500d);ut[_0xe9bd('0x69')](_0x51500d,0x5,'Busy');_0x90db01=_0x566dd8[_0xe9bd('0xa1')];_0x6232e5=_0x566dd8[_0xe9bd('0x82')];ami['emit'](_0xe9bd('0xa2'),ut[_0xe9bd('0x7c')](_0x51500d,_0xe9bd('0xa3')));rpcDb[_0xe9bd('0x6c')](_0x51500d,_0xe9bd('0xa4'));_0x78fab0[_0xe9bd('0x7f')](_0x51500d,'5',_0x566dd8)[_0xe9bd('0x5d')](function(_0x5e127b){_0xdd1301=_0x5e127b[_0xe9bd('0x80')]==0x1;if(!_0xdd1301){if(ut[_0xe9bd('0x7a')](_0x51500d)>=_0x566dd8[_0xe9bd('0xa5')]){_0x2c4ca7=ut[_0xe9bd('0xa6')](_0x51500d,0xf,_0xe9bd('0x83'));rpcDb[_0xe9bd('0x84')](_0x2c4ca7,_0xe9bd('0xa7'));}else{if(_0x51500d[_0xe9bd('0xa0')]>=_0x566dd8[_0xe9bd('0xa8')]){rpcDb['createCustomerFinal'](_0x51500d,_0xe9bd('0xa4'));}else{rpcDb[_0xe9bd('0x86')](ut[_0xe9bd('0x87')](_0x51500d,_0xe9bd('0xa0'),_0x566dd8[_0xe9bd('0xa1')]),_0x51500d[_0xe9bd('0x88')],_0x51500d[_0xe9bd('0xa9')]);}}}else{_0x51500d['countbusyretry']++;_0x78fab0[_0xe9bd('0x8b')]({'id':_0x51500d[_0xe9bd('0x8a')],'field':{'countbusyretry':_0x51500d['countbusyretry']}})[_0xe9bd('0x5d')](function(){_0x78fab0[_0xe9bd('0x8c')](_0x51500d,_0x90db01,_0x6232e5)[_0xe9bd('0x5d')](function(){});});}});break;case _0xe9bd('0xaa'):_0x566dd8[_0xe9bd('0xab')]+=0x1;_0x51500d[_0xe9bd('0xac')]+=0x1;_0x51500d[_0xe9bd('0x79')]=ut['totalGlobal'](_0x51500d);ut['logCustomer'](_0x51500d,0x3,_0xe9bd('0xad'));_0x90db01=_0x566dd8[_0xe9bd('0xae')];_0x6232e5=_0x566dd8[_0xe9bd('0x82')];var _0x1b863f=ut[_0xe9bd('0xaf')](_0x51500d,_0x566dd8);ami[_0xe9bd('0x23')](_0xe9bd('0xb0'),_0x1b863f);rpcDb['createCustomerHistory'](_0x51500d,_0xe9bd('0xb1'));_0x78fab0[_0xe9bd('0x7f')](_0x51500d,'3',_0x566dd8)[_0xe9bd('0x5d')](function(_0x256862){_0xdd1301=_0x256862[_0xe9bd('0x80')]==0x1;if(!_0xdd1301){if(ut[_0xe9bd('0x7a')](_0x51500d)>=_0x566dd8[_0xe9bd('0xa5')]){_0x2c4ca7=ut['cloneAction'](_0x51500d,0xf,'Global');rpcDb['createCustomerFinal'](_0x2c4ca7,_0xe9bd('0xb2'));}else{if(_0x51500d['countnoanswerretry']>=_0x566dd8['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x51500d,_0xe9bd('0xb1'));}else{rpcDb[_0xe9bd('0x86')](ut[_0xe9bd('0x87')](_0x51500d,_0xe9bd('0xac'),_0x566dd8[_0xe9bd('0xae')]),_0x51500d[_0xe9bd('0x88')],_0x51500d[_0xe9bd('0xa9')]);}}}else{_0x51500d[_0xe9bd('0xac')]++;_0x78fab0[_0xe9bd('0x8b')]({'id':_0x51500d['idContact'],'field':{'countnoanswerretry':_0x51500d[_0xe9bd('0xac')]}})['then'](function(){_0x78fab0[_0xe9bd('0x8c')](_0x51500d,_0x90db01,_0x6232e5)[_0xe9bd('0x5d')](function(){});});}});break;case _0xe9bd('0xb3'):_0x566dd8[_0xe9bd('0xb4')]+=0x1;_0x51500d[_0xe9bd('0xb5')]+=0x1;_0x51500d['countglobal']=ut['totalGlobal'](_0x51500d);ut['logCustomer'](_0x51500d,0x8,_0xe9bd('0xb6'));_0x90db01=_0x566dd8[_0xe9bd('0xb7')];_0x6232e5=_0x566dd8['callAdditionalPhoneAfterMin'];ami[_0xe9bd('0x23')](_0xe9bd('0xb8'),ut[_0xe9bd('0x7c')](_0x51500d,_0xe9bd('0xb9')));rpcDb[_0xe9bd('0x6c')](_0x51500d,'[callProgressDetectingCustomer][logCongestion]');_0x78fab0[_0xe9bd('0x7f')](_0x51500d,'8',_0x566dd8)[_0xe9bd('0x5d')](function(_0x2c83fc){_0xdd1301=_0x2c83fc[_0xe9bd('0x80')]==0x1;if(!_0xdd1301){if(ut[_0xe9bd('0x7a')](_0x51500d)>=_0x566dd8[_0xe9bd('0xa5')]){_0x2c4ca7=ut[_0xe9bd('0xa6')](_0x51500d,0xf,_0xe9bd('0x83'));rpcDb[_0xe9bd('0x84')](_0x2c4ca7,_0xe9bd('0xba'));}else{if(_0x51500d['countcongestionretry']>=_0x566dd8['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x51500d,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xe9bd('0x86')](ut[_0xe9bd('0x87')](_0x51500d,_0xe9bd('0xb5'),_0x566dd8['dialBusyRetryFrequency']),_0x51500d[_0xe9bd('0x88')],_0x51500d[_0xe9bd('0xa9')]);}}}else{_0x51500d['countcongestionretry']++;_0x78fab0['incrementPreviewCounters']({'id':_0x51500d[_0xe9bd('0x8a')],'field':{'countcongestionretry':_0x51500d[_0xe9bd('0xb5')]}})[_0xe9bd('0x5d')](function(){_0x78fab0[_0xe9bd('0x8c')](_0x51500d,_0x90db01,_0x6232e5)[_0xe9bd('0x5d')](function(){});});}});break;case'CANCEL':_0x566dd8['outboundRejectCallsDay']+=0x1;_0x51500d['countagentrejectretry']+=0x1;_0x51500d[_0xe9bd('0x79')]=ut[_0xe9bd('0x7a')](_0x51500d);ut[_0xe9bd('0x69')](_0x51500d,0x14,_0xe9bd('0xbb'));_0x90db01=_0x566dd8[_0xe9bd('0xbc')];_0x6232e5=_0x566dd8[_0xe9bd('0x82')];ami[_0xe9bd('0x23')](_0xe9bd('0xbd'),ut[_0xe9bd('0x7c')](_0x51500d,_0xe9bd('0xbe')));rpcDb['createCustomerHistory'](_0x51500d,_0xe9bd('0xbf'));_0x78fab0['verifyAdditionalPhones'](_0x51500d,'20',_0x566dd8)[_0xe9bd('0x5d')](function(_0x57736c){_0xdd1301=_0x57736c['additional']==0x1;if(!_0xdd1301){if(ut[_0xe9bd('0x7a')](_0x51500d)>=_0x566dd8['dialGlobalMaxRetry']){_0x2c4ca7=ut[_0xe9bd('0xa6')](_0x51500d,0x14,'AgentReject');rpcDb[_0xe9bd('0x84')](_0x2c4ca7,_0xe9bd('0xc0'));}else{if(_0x51500d[_0xe9bd('0xc1')]>=_0x566dd8[_0xe9bd('0xc2')]){rpcDb[_0xe9bd('0x84')](_0x51500d,_0xe9bd('0xc0'));}else{rpcDb['rescheduleContact'](ut[_0xe9bd('0x87')](_0x51500d,_0xe9bd('0xc1'),_0x566dd8['dialAgentRejectRetryFrequency']),_0x51500d[_0xe9bd('0x88')],_0x51500d[_0xe9bd('0xa9')]);}}}else{_0x51500d[_0xe9bd('0xac')]++;_0x78fab0['incrementPreviewCounters']({'id':_0x51500d[_0xe9bd('0x8a')],'field':{'countnoanswerretry':_0x51500d[_0xe9bd('0xac')]}})[_0xe9bd('0x5d')](function(){_0x78fab0[_0xe9bd('0x8c')](_0x51500d,_0x90db01,_0x6232e5)[_0xe9bd('0x5d')](function(){});});}});break;case'ABANDONED':_0x566dd8[_0xe9bd('0xc3')]+=0x1;_0x51500d[_0xe9bd('0xc4')]+=0x1;_0x51500d['countglobal']=ut[_0xe9bd('0x7a')](_0x51500d);ut[_0xe9bd('0x69')](_0x51500d,0xb,_0xe9bd('0xc5'));rpcDb[_0xe9bd('0x6c')](_0x51500d,'[callProgressDetectingCustomer][logAbandoned]');_0x78fab0[_0xe9bd('0x7f')](_0x51500d,'11',_0x566dd8)[_0xe9bd('0x5d')](function(_0x209899){_0xdd1301=_0x209899[_0xe9bd('0x80')]==0x1;if(!_0xdd1301){if(ut[_0xe9bd('0x7a')](_0x51500d)>=_0x566dd8[_0xe9bd('0xa5')]){_0x2c4ca7=ut[_0xe9bd('0xa6')](_0x51500d,0xf,'Global');rpcDb[_0xe9bd('0x84')](_0x2c4ca7,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x51500d[_0xe9bd('0xc6')]>=_0x566dd8[_0xe9bd('0xc7')]){rpcDb[_0xe9bd('0x84')](_0x51500d,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xe9bd('0x86')](ut['scheduledAt'](_0x51500d,_0xe9bd('0xc4'),_0x566dd8[_0xe9bd('0xc8')]),_0x51500d[_0xe9bd('0x88')],_0x51500d[_0xe9bd('0xa9')]);}}}else{_0x51500d[_0xe9bd('0xac')]++;_0x78fab0[_0xe9bd('0x8b')]({'id':_0x51500d[_0xe9bd('0x8a')],'field':{'countnoanswerretry':_0x51500d[_0xe9bd('0xac')]}})[_0xe9bd('0x5d')](function(){_0x78fab0[_0xe9bd('0x8c')](_0x51500d,_0x90db01,_0x6232e5)[_0xe9bd('0x5d')](function(){});});}});break;case'18':_0x566dd8['outboundUnknownCallsDay']+=0x1;_0x51500d[_0xe9bd('0xc9')]+=0x1;_0x51500d[_0xe9bd('0x79')]=ut[_0xe9bd('0x7a')](_0x51500d);ut['logCustomer'](_0x51500d,0x12,_0x46a099[_0xe9bd('0xca')]||_0x46a099[_0xe9bd('0xcb')]);ami['emit']('custom:amd',ut['buildObj'](_0x51500d,'amd'));rpcDb[_0xe9bd('0x6c')](_0x51500d,_0xe9bd('0xcc'));_0x78fab0[_0xe9bd('0x7f')](_0x51500d,'18',_0x566dd8)['then'](function(_0x3ad63e){_0xdd1301=_0x3ad63e[_0xe9bd('0x80')]==0x1;if(!_0xdd1301){if(ut['totalGlobal'](_0x51500d)>=_0x566dd8[_0xe9bd('0xa5')]){_0x2c4ca7=ut[_0xe9bd('0xa6')](_0x51500d,0x12,_0xe9bd('0x83'));rpcDb[_0xe9bd('0x84')](_0x2c4ca7,_0xe9bd('0xcc'));}else{rpcDb['createCustomerFinal'](_0x51500d,_0xe9bd('0xcc'));}}else{_0x51500d[_0xe9bd('0xac')]++;_0x78fab0['incrementPreviewCounters']({'id':_0x51500d['idContact'],'field':{'countnoanswerretry':_0x51500d['countnoanswerretry']}})['then'](function(){_0x78fab0[_0xe9bd('0x8c')](_0x51500d,_0x90db01,_0x6232e5)[_0xe9bd('0x5d')](function(){});});}});delete this[_0xe9bd('0x42')][_0x46a099[_0xe9bd('0x9e')]];break;case'19':_0x566dd8['outboundUnknownCallsDay']+=0x1;_0x51500d['countglobal']=ut[_0xe9bd('0x7a')](_0x51500d);ut[_0xe9bd('0x69')](_0x51500d,0x13,_0x46a099[_0xe9bd('0xca')]||_0x46a099['dialstatus']);ami[_0xe9bd('0x23')](_0xe9bd('0xcd'),ut['buildObj'](_0x51500d,'amd'));rpcDb[_0xe9bd('0x6c')](_0x51500d,_0xe9bd('0xce'));_0x78fab0[_0xe9bd('0x7f')](_0x51500d,'18',_0x566dd8)[_0xe9bd('0x5d')](function(_0x16741b){_0xdd1301=_0x16741b[_0xe9bd('0x80')]==0x1;if(!_0xdd1301){if(ut[_0xe9bd('0x7a')](_0x51500d)>=_0x566dd8[_0xe9bd('0xa5')]){_0x2c4ca7=ut[_0xe9bd('0xa6')](_0x51500d,0xf,'Global');rpcDb[_0xe9bd('0x84')](_0x2c4ca7,_0xe9bd('0xce'));}else{rpcDb[_0xe9bd('0x84')](_0x51500d,_0xe9bd('0xce'));}}else{_0x51500d[_0xe9bd('0xac')]++;_0x78fab0[_0xe9bd('0x8b')]({'id':_0x51500d['idContact'],'field':{'countnoanswerretry':_0x51500d[_0xe9bd('0xac')]}})['then'](function(){_0x78fab0[_0xe9bd('0x8c')](_0x51500d,_0x90db01,_0x6232e5)['then'](function(){});});}});delete this[_0xe9bd('0x42')][_0x46a099[_0xe9bd('0x9e')]];break;default:if(_0x51500d['dialAnswer']){ut[_0xe9bd('0x55')](_0x566dd8,_0xe9bd('0xcf'));ut['loggerError'](_0xe9bd('0xd0')+_0x566dd8[_0xe9bd('0x27')],_0x46a099);}_0x566dd8[_0xe9bd('0xd1')]+=0x1;_0x51500d[_0xe9bd('0x79')]=ut['totalGlobal'](_0x51500d);ut[_0xe9bd('0x69')](_0x51500d,0xc,_0x46a099[_0xe9bd('0xca')]||_0x46a099['dialstatus']);_0x90db01=_0x566dd8[_0xe9bd('0xbc')];_0x6232e5=_0x566dd8[_0xe9bd('0x82')];rpcDb[_0xe9bd('0x6c')](_0x51500d,'[callProgressDetectingCustomer][logUnknown]');_0x78fab0[_0xe9bd('0x7f')](_0x51500d,'20',_0x566dd8)[_0xe9bd('0x5d')](function(_0x308fd6){_0xdd1301=_0x308fd6[_0xe9bd('0x80')]==0x1;if(!_0xdd1301){if(ut[_0xe9bd('0x7a')](_0x51500d)>=_0x566dd8[_0xe9bd('0xa5')]){_0x2c4ca7=ut[_0xe9bd('0xa6')](_0x51500d,0xf,'Global');rpcDb[_0xe9bd('0x84')](_0x2c4ca7,_0xe9bd('0xd2'));}else{rpcDb[_0xe9bd('0x84')](_0x51500d,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xe9bd('0x42')][_0x46a099['linkedid']];}else{_0x78fab0['swapAdditionalPhones'](_0x51500d,_0x90db01,_0x6232e5)['then'](function(){});}});}if(!(_0x51500d[_0xe9bd('0x49')]&&_0x1fd5bf==='16')){ut['updateOriginated'](_0x566dd8,'[callProgressDetectingCustomer]');logger[_0xe9bd('0x24')](_0xe9bd('0xd3'),_0x51500d['uniqueid'],_0xe9bd('0x91'),_0x566dd8[_0xe9bd('0x27')],'originated:\x20',_0x566dd8['originated']);}if(_0x1fd5bf!==_0xe9bd('0x8d')){delete this['actions'][_0x46a099['linkedid']];delete this[_0xe9bd('0x42')][_0x46a099[_0xe9bd('0xd4')]];}_0x566dd8[_0xe9bd('0xd5')]=!![];}};Preview[_0xe9bd('0xf')][_0xe9bd('0xd6')]=function(_0xb21467,_0x26aec2,_0x5ebe24){if(_[_0xe9bd('0xd7')](_0x26aec2)&&'object'!==typeof _0x26aec2){return;}if(_['isUndefined'](_0x5ebe24)&&_0xe9bd('0xd8')!==typeof _0x5ebe24){return;}switch(_0x5ebe24[_0xe9bd('0xd9')]){case'0':ut[_0xe9bd('0xda')](_0xb21467,0x0,_0xe9bd('0xdb'));rpcDb[_0xe9bd('0xdc')](_0xb21467,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xe9bd('0xda')](_0xb21467,0x3,_0xe9bd('0xad'));rpcDb[_0xe9bd('0xdc')](_0xb21467,_0xe9bd('0xdd'));break;case'5':ut[_0xe9bd('0xda')](_0xb21467,0x5,_0xe9bd('0xde'));rpcDb['createAgentHistory'](_0xb21467,_0xe9bd('0xdf'));break;case'8':ut[_0xe9bd('0xda')](_0xb21467,0x8,_0xe9bd('0xb6'));rpcDb[_0xe9bd('0xdc')](_0xb21467,_0xe9bd('0xe0'));break;case'22':ut[_0xe9bd('0xda')](_0xb21467,0x16,'AnswerAGI');rpcDb[_0xe9bd('0xdc')](_0xb21467,_0xe9bd('0xe1'));break;default:ut['logAgent'](_0xb21467,0xc,_0x5ebe24[_0xe9bd('0xd9')]);rpcDb[_0xe9bd('0xdc')](_0xb21467,_0xe9bd('0xe0'));}ut[_0xe9bd('0x53')](_0x26aec2,'[callProgressDetectingAgent]');logger[_0xe9bd('0x24')](_0xe9bd('0xe2'),_0xb21467[_0xe9bd('0x90')],_0xe9bd('0x91'),_0x26aec2[_0xe9bd('0x27')],_0xe9bd('0x46'),_0x26aec2[_0xe9bd('0x2b')]);delete this[_0xe9bd('0x42')][_0xb21467[_0xe9bd('0x90')]];};Preview['prototype'][_0xe9bd('0x7f')]=function(_0x2cc8cc,_0x1f2100,_0x28d533){return cmHopperAdditionalPhone[_0xe9bd('0x7f')](_0x2cc8cc,_0x1f2100,_0x28d533)[_0xe9bd('0x51')](logger[_0xe9bd('0x24')]('[verifyAdditionalPhone]\x20'));};Preview[_0xe9bd('0xf')]['swapAdditionalPhones']=function(_0x43fa2a,_0xbc686e,_0x2db271){return cmHopperAdditionalPhone[_0xe9bd('0x8c')](_0x43fa2a,_0xbc686e,_0x2db271)[_0xe9bd('0x51')](logger[_0xe9bd('0x24')]('[swapAdditionalPhone]\x20'));};Preview[_0xe9bd('0xf')][_0xe9bd('0x8b')]=function(_0x39b54b){return Promise['resolve']()[_0xe9bd('0x5d')](cmHopperAdditionalPhone[_0xe9bd('0x8b')](_0x39b54b))[_0xe9bd('0x51')](logger[_0xe9bd('0x24')](_0xe9bd('0xe3')));};Preview[_0xe9bd('0xf')][_0xe9bd('0xe4')]=function(_0x1c3af9,_0x20a8ce,_0x3b0874,_0x5c0b2d,_0x464f7a){var _0xfc35ff=this;return new Promise(function(_0x31aae8,_0x517b10){if(_[_0xe9bd('0x41')](_0x20a8ce)||_[_0xe9bd('0x41')](_0x20a8ce[_0xe9bd('0xe5')])||_['isNil'](_0x20a8ce['phone'])||_[_0xe9bd('0x41')](_0x20a8ce[_0xe9bd('0x4d')])){_0x517b10(ut[_0xe9bd('0x2f')](_0xe9bd('0xe6'),_0x5c0b2d,_0x464f7a));return;}var _0x25ee5d=uuid['v4']();var _0x464102=_0xfc35ff[_0xe9bd('0x12')][_0x20a8ce['Queue'][_0xe9bd('0x27')]];var _0x297ccc=_0x3b0874?_0xfc35ff['agents'][_0x3b0874]['id']:undefined;_0xfc35ff[_0xe9bd('0x42')][_0x25ee5d]=new Action(_0x20a8ce,_0x464102,_0x25ee5d,_0x3b0874,_0x297ccc);var _0x3335a4=_0xfc35ff[_0xe9bd('0x42')][_0x25ee5d];_0x3335a4[_0xe9bd('0x88')]=_0x5c0b2d;_0x3335a4[_0xe9bd('0xa9')]=_0x464f7a;_0x3335a4[_0xe9bd('0xe7')]=_0x3b0874;if(_[_0xe9bd('0xe8')](_0x1c3af9)){_0xfc35ff[_0xe9bd('0xe9')](_0x3335a4,_0x464102,_0x20a8ce,_0x3b0874)[_0xe9bd('0x5d')](function(_0x10dfc8){logger[_0xe9bd('0x24')](_0xe9bd('0xea'),_0xe9bd('0xeb')+_0x3335a4[_0xe9bd('0x45')]+_0xe9bd('0xec')+_0x3335a4['idContact'],JSON[_0xe9bd('0x48')](_0x10dfc8));ami[_0xe9bd('0x23')](_0xe9bd('0xed'),ut[_0xe9bd('0x7c')](_0x3335a4,_0xe9bd('0xee'),_0xfc35ff['campaignsPreview'][_0x3335a4[_0xe9bd('0x45')]]));_0x31aae8(ut[_0xe9bd('0x2f')](_0xe9bd('0xef')));})[_0xe9bd('0x51')](function(_0x3d980d){ut[_0xe9bd('0x34')](_0xe9bd('0xf0'),_0x3d980d);_0x517b10(ut[_0xe9bd('0x2f')](_0xe9bd('0xf1'),_0x5c0b2d,_0x464f7a));});}else{_0x464102[_0xe9bd('0xf2')]+=0x1;ut[_0xe9bd('0xf3')](_0x3335a4);rpcDb[_0xe9bd('0xf4')](_0x3335a4,_0xe9bd('0xf5'));delete _0xfc35ff['actions'][_0x25ee5d];_0x517b10(ut[_0xe9bd('0x2f')](_0xe9bd('0xf6'),_0x5c0b2d,_0x464f7a));}});};Preview[_0xe9bd('0xf')][_0xe9bd('0x73')]=function(_0x31b9a5){return!_[_0xe9bd('0x41')](_0x31b9a5)&&!_[_0xe9bd('0x41')](_0x31b9a5[_0xe9bd('0x27')])&&!_[_0xe9bd('0x41')](_0x31b9a5[_0xe9bd('0xf7')])&&_0x31b9a5[_0xe9bd('0xf7')]&&!_[_0xe9bd('0x41')](this['trunks'][util[_0xe9bd('0x26')](_0xe9bd('0xf8'),_0x31b9a5[_0xe9bd('0x27')])])&&!_[_0xe9bd('0x41')](this[_0xe9bd('0x14')][util['format'](_0xe9bd('0xf8'),_0x31b9a5[_0xe9bd('0x27')])][_0xe9bd('0x4f')])&&(this['trunks'][util[_0xe9bd('0x26')](_0xe9bd('0xf8'),_0x31b9a5['name'])]['status']==='reachable'||this[_0xe9bd('0x14')][util[_0xe9bd('0x26')]('SIP/%s',_0x31b9a5[_0xe9bd('0x27')])][_0xe9bd('0x4f')]===_0xe9bd('0xf9'));};Preview['prototype'][_0xe9bd('0xfa')]=function(_0x3445f6,_0x20e78e){return this[_0xe9bd('0xfb')](_0x3445f6,_0x20e78e)['then'](function(_0x4678aa){return _[_0xe9bd('0x4a')](_0x4678aa,['message']);})[_0xe9bd('0x51')](function(_0x762a5a){if(_0x762a5a[_0xe9bd('0xfc')]){rpcDb[_0xe9bd('0xfd')](_0x3445f6);}if(_0x762a5a['active']){rpcDb['disableContact'](_0x3445f6);}throw _['pick'](_0x762a5a,[_0xe9bd('0x2f')]);});};Preview['prototype'][_0xe9bd('0xfb')]=function(_0x32023e,_0xff728b){var _0x41b16f=this;var _0x1d5b7e,_0x2ff3b8;return rpcDb['getContactPreview'](_0x32023e)[_0xe9bd('0x5d')](function(_0x389b87){if(!_[_0xe9bd('0x41')](_0x389b87[0x0])){_0x2ff3b8=_0x389b87[0x0][_0xe9bd('0xfe')]?![]:!![];_0x1d5b7e=_0x389b87[0x0][_0xe9bd('0xfe')]?!![]:![];_0x1d5b7e=_0xff728b?!![]:_0x1d5b7e;}var _0x27740c=_0x41b16f[_0xe9bd('0xff')](_0x389b87);if(_0x27740c['isValid']){rpcDb[_0xe9bd('0x100')](_[_0xe9bd('0x4a')](_0x389b87[0x0],[_0xe9bd('0x4d'),_0xe9bd('0x101')]))['then'](function(_0x165180){_0x41b16f[_0xe9bd('0xe4')](_0x165180,_0x389b87[0x0],_0xff728b,_0x2ff3b8,_0x1d5b7e)[_0xe9bd('0x5d')](function(_0x152070){return _0x152070;})[_0xe9bd('0x51')](function(_0x101aa0){throw _0x101aa0;});})[_0xe9bd('0x51')](function(_0x566907){ut[_0xe9bd('0x34')](_0xe9bd('0x102'),_0x566907);throw ut[_0xe9bd('0x2f')](_0xe9bd('0x103'),_0x2ff3b8,_0x1d5b7e);});}else{throw ut[_0xe9bd('0x2f')](_0x27740c['message'],_0x2ff3b8,_0x1d5b7e);}})[_0xe9bd('0x51')](function(_0x10e200){ut['logger'](_0xe9bd('0x104'),_0x10e200);throw ut[_0xe9bd('0x2f')](_0xe9bd('0x103'),![],!![]);});};Preview['prototype'][_0xe9bd('0xff')]=function(_0x1a967a){if(_[_0xe9bd('0x41')](_0x1a967a)||_[_0xe9bd('0xe8')](_0x1a967a)||!_['isNil'](_0x1a967a[0x0][_0xe9bd('0x61')])&&_[_0xe9bd('0x41')](_0x1a967a[0x0][_0xe9bd('0x61')][_0xe9bd('0x27')])){ut[_0xe9bd('0x34')](_0xe9bd('0x105'),_0x1a967a);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5353da=this['campaignsPreview'][_0x1a967a[0x0]['Queue'][_0xe9bd('0x27')]];_0x5353da['message']=utils[_0xe9bd('0x30')]['ACTIVE'];if(_[_0xe9bd('0x41')](_0x5353da)){ut[_0xe9bd('0x34')]('[Preview][validateContact][Empty\x20Campaign]',_0x5353da);return{'isValid':![],'message':_0xe9bd('0x106')};}if(!this[_0xe9bd('0x73')](_0x5353da[_0xe9bd('0x74')])){ut[_0xe9bd('0x34')](_0xe9bd('0x107'),_0xe9bd('0x108')+_0x5353da[_0xe9bd('0x27')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xe9bd('0x73')](_0x5353da[_0xe9bd('0x109')])){ut[_0xe9bd('0x34')](_0xe9bd('0x107'),_0x5353da[_0xe9bd('0x27')]+_0xe9bd('0x10a'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xe9bd('0x72')](_0x5353da[_0xe9bd('0x3b')])){ut[_0xe9bd('0x34')](_0xe9bd('0x10b'),_0x5353da[_0xe9bd('0x27')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x5353da['name']+_0xe9bd('0x10c')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xe9bd('0xf')][_0xe9bd('0xe9')]=function(_0x4d3c1b,_0x1547e1,_0x3b91ff,_0x29dce8){var _0x3d9732=this;return new Promise(function(_0x7d8c09,_0x1830a5){var _0x914313=_0x4d3c1b['uniqueid'];var _0x4ece76=_0x3d9732[_0xe9bd('0x73')](_0x1547e1['Trunk'])?util['format'](_0xe9bd('0x10d'),_0x1547e1[_0xe9bd('0x74')][_0xe9bd('0x27')],_[_0xe9bd('0x41')](_0x1547e1[_0xe9bd('0x10e')])?'':_0x1547e1[_0xe9bd('0x10e')][_0xe9bd('0x10f')]()||'',_0x1547e1[_0xe9bd('0x110')]>0x0?_0x3b91ff[_0xe9bd('0x101')][_0xe9bd('0x111')](_0x1547e1[_0xe9bd('0x110')]):_0x3b91ff['phone']):util[_0xe9bd('0x26')]('SIP/%s/%s%s',_[_0xe9bd('0x41')](_0x1547e1[_0xe9bd('0x109')])?_0x1547e1[_0xe9bd('0x74')][_0xe9bd('0x27')]:_0x1547e1['TrunkBackup'][_0xe9bd('0x27')],_[_0xe9bd('0x41')](_0x1547e1[_0xe9bd('0x10e')])?'':_0x1547e1['dialPrefix']['trim']()||'',_0x1547e1[_0xe9bd('0x110')]>0x0?_0x3b91ff[_0xe9bd('0x101')][_0xe9bd('0x111')](_0x1547e1[_0xe9bd('0x110')]):_0x3b91ff[_0xe9bd('0x101')]);var _0x170bd8=_0x3d9732['isTrunkReachable'](_0x1547e1[_0xe9bd('0x74')])?ut[_0xe9bd('0x112')](_0x1547e1[_0xe9bd('0x74')][_0xe9bd('0x113')],_0x1547e1['dialOriginateCallerIdName'],_0x1547e1[_0xe9bd('0x114')]>0x0?ut[_0xe9bd('0x115')](_0x1547e1[_0xe9bd('0x116')],_0x1547e1['dialRandomLastDigitCallerIdNumber']):_0x1547e1[_0xe9bd('0x116')]):ut[_0xe9bd('0x112')](_[_0xe9bd('0x41')](_0x1547e1[_0xe9bd('0x109')])?_0x1547e1[_0xe9bd('0x74')][_0xe9bd('0x113')]:_0x1547e1[_0xe9bd('0x109')]['callerid'],_0x1547e1['dialOriginateCallerIdName'],_0x1547e1[_0xe9bd('0x114')]>0x0?ut[_0xe9bd('0x115')](_0x1547e1[_0xe9bd('0x116')],_0x1547e1['dialRandomLastDigitCallerIdNumber']):_0x1547e1['dialOriginateCallerIdNumber']);if(_0x170bd8){_0x4d3c1b[_0xe9bd('0x117')]=ut[_0xe9bd('0x118')](_0x170bd8);_0x4d3c1b[_0xe9bd('0x119')]=ut['extractCalleridNumber'](_0x170bd8);}var _0x8c0d33=ut['addVariables'](_0x1547e1,_0x3b91ff,_0x4ece76,_0x170bd8,_0x914313,_0x4d3c1b);_[_0xe9bd('0x11a')](_0x4d3c1b,ut[_0xe9bd('0x11b')](_0x8c0d33));_0x4d3c1b[_0xe9bd('0x66')]=moment()[_0xe9bd('0x26')](_0xe9bd('0x67'));_0x1547e1[_0xe9bd('0x11c')]=_0x8c0d33;var _0x103791=ut[_0xe9bd('0x11d')](_0x4d3c1b,_0x1547e1,_0x8c0d33,_0x4d3c1b[_0xe9bd('0xa9')],_0x29dce8);return ami['Action'](_0x103791)['then'](function(_0x8ebe70){_0x1547e1[_0xe9bd('0x2b')]+=0x1;logger[_0xe9bd('0x24')](_0xe9bd('0x11e'),_0x914313,_0xe9bd('0x91'),_0x1547e1[_0xe9bd('0x27')],_0xe9bd('0x46'),_0x1547e1[_0xe9bd('0x2b')]);_0x7d8c09(_0x8ebe70);})['catch'](function(_0x45de5a){ut[_0xe9bd('0xda')](_0x4d3c1b,0xe,'OriginateError');rpcDb[_0xe9bd('0xdc')](_0x4d3c1b,'[originateFailure][logOriginateFailure]');_0x1830a5(_0x45de5a);});});};Preview[_0xe9bd('0xf')][_0xe9bd('0x11f')]=function(_0x401924){if(this['actions'][_0x401924[_0xe9bd('0x9e')]]){this[_0xe9bd('0x42')][_0x401924['linkedid']][_0xe9bd('0x50')]=_0x401924[_0xe9bd('0x50')];}};Preview[_0xe9bd('0xf')][_0xe9bd('0x120')]=function(_0x2256c2){var _0x4eb22e=this;var _0x3000a9=this[_0xe9bd('0x42')][_0x2256c2[_0xe9bd('0x121')]];if(_0x3000a9){if(_0x3000a9[_0xe9bd('0xe7')]&&this[_0xe9bd('0x15')][_0x3000a9[_0xe9bd('0xe7')]]){ut['logLookAgent'](_0x3000a9,this[_0xe9bd('0x15')][_0x3000a9['lookAgent']][_0xe9bd('0x27')],this['agents'][_0x3000a9[_0xe9bd('0xe7')]]['id']);}var _0x1ec28e=_['clone'](_0x3000a9);_0x1ec28e[_0xe9bd('0x8e')]=moment()[_0xe9bd('0x26')]('YYYY-MM-DD\x20HH:mm:ss');var _0xd2c2a1=_0x4eb22e['campaignsPreview'][_0x3000a9['queue']];if(ut['isFailure'](_0x2256c2[_0xe9bd('0x122')])){if(_0x3000a9[_0xe9bd('0x88')]){rpcDb['unlockContact'](_0x3000a9['idContact']);}if(_0x3000a9[_0xe9bd('0xa9')]){rpcDb['disableContact'](_0x3000a9[_0xe9bd('0x8a')]);}ami[_0xe9bd('0x23')]('custom:agentringnoanswer',ut[_0xe9bd('0x7c')](_0x3000a9,_0xe9bd('0x123'),this[_0xe9bd('0x12')][_0x3000a9[_0xe9bd('0x45')]]));this[_0xe9bd('0xd6')](_0x1ec28e,_0xd2c2a1,_0x2256c2);}else{_0x3000a9[_0xe9bd('0x66')]=moment()[_0xe9bd('0x26')](_0xe9bd('0x67'));ut[_0xe9bd('0xda')](_0x1ec28e,0x4,_0xe9bd('0x97'));rpcDb[_0xe9bd('0xdc')](_0x1ec28e,_0xe9bd('0x124'));}}};Preview[_0xe9bd('0xf')]['syncHangup']=function(_0x3713fa){var _0x30c944=this[_0xe9bd('0x42')][_0x3713fa[_0xe9bd('0x9e')]];var _0x2feda3;if(_0x30c944){_0x2feda3=this['campaignsPreview'][_0x30c944[_0xe9bd('0x45')]];logger[_0xe9bd('0x24')](_0xe9bd('0x125'),_0x3713fa[_0xe9bd('0x9e')],_0xe9bd('0x91'),_0x2feda3[_0xe9bd('0x27')],_0xe9bd('0x47'),_0x2feda3['pTalking']);}if(this[_0xe9bd('0x42')][_0x3713fa[_0xe9bd('0x9e')]]&&_0x3713fa['linkedid']!==_0x3713fa[_0xe9bd('0x90')]){if(_0x3713fa[_0xe9bd('0x126')]==='16'&&this[_0xe9bd('0x42')][_0x3713fa[_0xe9bd('0x9e')]][_0xe9bd('0x49')]){this[_0xe9bd('0x76')](_0x3713fa,_0x3713fa[_0xe9bd('0x9e')],_0x3713fa[_0xe9bd('0x126')]);}else if(this['actions'][_0x3713fa[_0xe9bd('0x9e')]][_0xe9bd('0x49')]){logger[_0xe9bd('0x24')]('[syncHangup][talking][cause]',_0x3713fa[_0xe9bd('0x9e')],_0x3713fa[_0xe9bd('0x126')],'\x20Queue',_0x2feda3['name'],_0xe9bd('0x47'),_0x2feda3['pTalking']);this[_0xe9bd('0x76')](_0x3713fa,_0x3713fa[_0xe9bd('0x9e')],_0x3713fa[_0xe9bd('0x126')]);}}else if(_0x30c944&&_[_0xe9bd('0x41')](_0x30c944[_0xe9bd('0x127')])&&_0x2feda3[_0xe9bd('0x128')]&&_0x3713fa[_0xe9bd('0x9e')]===_0x3713fa[_0xe9bd('0x90')]&&_['isNil'](_0x3713fa[_0xe9bd('0xd9')])&&_0x3713fa[_0xe9bd('0x126')]==='16'&&_0x3713fa[_0xe9bd('0x129')]==='6'&&_[_0xe9bd('0xd7')](_0x30c944[_0xe9bd('0x12a')])){if(_0x30c944[_0xe9bd('0x88')]){rpcDb['unlockContact'](_0x30c944[_0xe9bd('0x8a')]);}if(_0x30c944[_0xe9bd('0xa9')]){rpcDb[_0xe9bd('0x65')](_0x30c944[_0xe9bd('0x8a')]);}_0x3713fa[_0xe9bd('0xd9')]='22';this[_0xe9bd('0xd6')](_0x30c944,_0x2feda3,_0x3713fa);}else if(_0x30c944&&_0x30c944[_0xe9bd('0x12a')]){if(_0x3713fa[_0xe9bd('0x126')]==='16'&&this['actions'][_0x3713fa['linkedid']][_0xe9bd('0x49')]){logger[_0xe9bd('0x24')](_0xe9bd('0x12b'),_0x3713fa[_0xe9bd('0x9e')],_0x3713fa[_0xe9bd('0x126')],_0xe9bd('0x91'),_0x2feda3[_0xe9bd('0x27')],_0xe9bd('0x47'),_0x2feda3[_0xe9bd('0x2c')]);this[_0xe9bd('0x76')](_0x3713fa,_0x3713fa['linkedid'],_0x3713fa[_0xe9bd('0x126')]);}else if(this[_0xe9bd('0x42')][_0x3713fa[_0xe9bd('0x9e')]][_0xe9bd('0x49')]){logger[_0xe9bd('0x24')](_0xe9bd('0x12c'),_0x3713fa[_0xe9bd('0x9e')],_0x3713fa['cause'],_0xe9bd('0x91'),_0x2feda3[_0xe9bd('0x27')],_0xe9bd('0x47'),_0x2feda3[_0xe9bd('0x2c')]);this[_0xe9bd('0x76')](_0x3713fa,_0x3713fa['linkedid'],_0x3713fa[_0xe9bd('0x126')]);}}};Preview[_0xe9bd('0xf')][_0xe9bd('0x1c')]=function(_0x2cd552){if(this[_0xe9bd('0x42')][_0x2cd552['destlinkedid']]&&_0x2cd552[_0xe9bd('0xd4')]!==_0x2cd552['destuniqueid']){this[_0xe9bd('0x76')](_0x2cd552,_0x2cd552[_0xe9bd('0xd4')],_0x2cd552[_0xe9bd('0xcb')]);}};Preview['prototype']['syncHangupRequest']=function(_0x38096d){if(this[_0xe9bd('0x42')][_0x38096d[_0xe9bd('0x9e')]]&&_0x38096d['linkedid']!==_0x38096d[_0xe9bd('0x90')]&&!this[_0xe9bd('0x42')][_0x38096d[_0xe9bd('0x9e')]][_0xe9bd('0x49')]){if(_0x38096d[_0xe9bd('0x126')]==='1'){this[_0xe9bd('0x76')](_0x38096d,_0x38096d[_0xe9bd('0x9e')],_0x38096d[_0xe9bd('0x126')]);}}};Preview[_0xe9bd('0xf')][_0xe9bd('0x12d')]=function(_0x1bae64,_0x23f104,_0x3b5bca){if(this[_0xe9bd('0x42')][_0x1bae64]){if(_['isNil'](this[_0xe9bd('0x42')][_0x1bae64][_0xe9bd('0x11c')])){this['actions'][_0x1bae64][_0xe9bd('0x11c')]={};}this[_0xe9bd('0x42')][_0x1bae64][_0xe9bd('0x11c')][_0x23f104]=_0x3b5bca;}};Preview[_0xe9bd('0xf')]['syncVarSet']=function(_0xd0d700){try{if(!_[_0xe9bd('0x41')](_0xd0d700)){if(ut[_0xe9bd('0x12e')](_[_0xe9bd('0x12f')](_0xd0d700[_0xe9bd('0x130')])[0x0])){this['addVariable'](_0xd0d700[_0xe9bd('0x90')],_['keys'](_0xd0d700[_0xe9bd('0x130')])[0x0],_0xd0d700[_0xe9bd('0x131')]);}}}catch(_0x8f8874){logger[_0xe9bd('0x132')](_0xe9bd('0x133'),util['inspect'](_0x8f8874,{'showHidden':![],'depth':null}));}};Preview[_0xe9bd('0xf')][_0xe9bd('0x20')]=function(_0x268025){if(_0x268025){if(this[_0xe9bd('0x42')][_0x268025[_0xe9bd('0x134')]]){this[_0xe9bd('0x42')][_0x268025[_0xe9bd('0x134')]]['transfer']=!![];}}};Preview[_0xe9bd('0xf')][_0xe9bd('0x135')]=function(_0x76aaa6){if(_0x76aaa6){if(this[_0xe9bd('0x42')][_0x76aaa6[_0xe9bd('0x136')]]){this['actions'][_0x76aaa6[_0xe9bd('0x136')]][_0xe9bd('0x12a')]=!![];}}};module[_0xe9bd('0x137')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index a99b7cb..795dbb4 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 _0x9287=['holdtime','assigned','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview'];(function(_0x405294,_0x2691ad){var _0x1c857f=function(_0x56e091){while(--_0x56e091){_0x405294['push'](_0x405294['shift']());}};_0x1c857f(++_0x2691ad);}(_0x9287,0x140));var _0x7928=function(_0x4fe328,_0x5e456d){_0x4fe328=_0x4fe328-0x0;var _0x11a53b=_0x9287[_0x4fe328];return _0x11a53b;};'use strict';var util=require(_0x7928('0x0'));var BPromise=require('bluebird');var logger=require(_0x7928('0x1'))(_0x7928('0x2'));var cmHopper=require(_0x7928('0x3'));var cmHopperHistory=require(_0x7928('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x7928('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x693485){return function(_0x4b4327){logger[_0x7928('0x6')](_0x693485,util[_0x7928('0x7')](_0x4b4327,{'showHidden':![],'depth':null}));};}function create(_0x281b78){return cmHopperHistory[_0x7928('0x8')](_0x281b78)[_0x7928('0x9')](loggerCatch(_0x7928('0xa')));}function createAgent(_0x4965c3){return BPromise[_0x7928('0xb')]()[_0x7928('0xc')](agentReportPreview[_0x7928('0x8')](_0x4965c3))[_0x7928('0x9')](loggerCatch(_0x7928('0xa')));}function moveContact(_0x94220a){return cmHopper['moveContactManagedDialer'](_0x94220a,!![])[_0x7928('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x7928('0xd')]=function(_0xcdb95b){return cmHopperBlack[_0x7928('0xd')](_0xcdb95b)[_0x7928('0x9')](loggerCatch(_0x7928('0xe')));};exports['getContactPreview']=function(_0x41d5e1){return BPromise[_0x7928('0xb')]()[_0x7928('0xc')](cmHopper[_0x7928('0xf')](_0x41d5e1))[_0x7928('0x9')](loggerCatch(_0x7928('0x10')));};exports['createHistory']=function(_0x3a4625,_0x26b6dc){create(_0x3a4625)[_0x7928('0x9')](loggerCatch(_0x26b6dc));moveContact(_0x3a4625)[_0x7928('0x9')](loggerCatch(_0x26b6dc));};exports['createAgentHistory']=function(_0x258ccb,_0x4a70b9){createAgent(_0x258ccb)[_0x7928('0x9')](loggerCatch(_0x4a70b9));};exports[_0x7928('0x11')]=function(_0x4c2aa3,_0x3855da){create(_0x4c2aa3)[_0x7928('0x9')](loggerCatch(_0x3855da));};exports[_0x7928('0x12')]=function(_0x5c85bc,_0x4dc261){moveContact(_0x5c85bc)[_0x7928('0x9')](loggerCatch(_0x4dc261));};exports['rescheduleContact']=function(_0x4ac978,_0xc3aa0,_0x357278){if(_0xc3aa0){_0x4ac978[_0x7928('0x13')]=null;}if(_0x357278){_0x4ac978[_0x7928('0x14')]=![];}return cmHopper['rescheduleContact'](_0x4ac978)[_0x7928('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x7928('0x15')]=function(_0x22a084){return cmHopper[_0x7928('0x15')](_0x22a084)[_0x7928('0x9')](loggerCatch(_0x7928('0x16')));};exports[_0x7928('0x17')]=function(_0x27896e){return cmHopper[_0x7928('0x17')]({'UserId':null},_0x27896e,0x1)[_0x7928('0x9')](loggerCatch(_0x7928('0x18')));};exports[_0x7928('0x19')]=function(_0x1a8d6f){return cmHopper['unlockContact']({'active':![]},_0x1a8d6f,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x7928('0x1a')]=function(_0x4656b6){var _0x30f6ad={};_0x30f6ad[_0x7928('0x1b')]=_0x4656b6[_0x7928('0x1b')];_0x30f6ad['uniqueid']=_0x4656b6[_0x7928('0x1c')];_0x30f6ad[_0x7928('0x1d')]=_0x4656b6[_0x7928('0x1d')];_0x30f6ad['calleridname']=_0x4656b6[_0x7928('0x1e')];_0x30f6ad[_0x7928('0x1f')]=_0x4656b6[_0x7928('0x1f')];_0x30f6ad[_0x7928('0x20')]=_0x4656b6[_0x7928('0x21')];_0x30f6ad[_0x7928('0x22')]=_0x4656b6[_0x7928('0x21')];_0x30f6ad[_0x7928('0x23')]=0x1;_0x30f6ad[_0x7928('0x24')]=_0x4656b6[_0x7928('0x25')];_0x30f6ad[_0x7928('0x26')]=_0x4656b6[_0x7928('0x27')];_0x30f6ad[_0x7928('0x28')]=_0x7928('0x29');_0x30f6ad[_0x7928('0x2a')]=_0x7928('0x2b');_0x30f6ad[_0x7928('0x2c')]=0x0;_0x30f6ad[_0x7928('0x2d')]=0x1;_0x30f6ad['lastAssignedTo']=_0x4656b6[_0x7928('0x27')];_0x30f6ad['queuecallerexitreason']=_0x7928('0x2e');return BPromise[_0x7928('0xb')]()[_0x7928('0xc')](voiceQueueReport['create'](_0x30f6ad))[_0x7928('0x9')](loggerCatch(_0x7928('0x2f')));};exports['getContactRecallMe']=function(_0x3fc2f4,_0x24c119){return BPromise[_0x7928('0xb')]()[_0x7928('0xc')](cmHopper[_0x7928('0x30')](_0x3fc2f4,_0x24c119))[_0x7928('0x9')](loggerCatch(_0x7928('0x31')));};exports[_0x7928('0x32')]=function(_0x2ef911){return cmHopper[_0x7928('0x33')](_0x2ef911,!![],!![])[_0x7928('0x9')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x77ea=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active'];(function(_0x59ec45,_0x1b7732){var _0x5ac0f3=function(_0x2e9839){while(--_0x2e9839){_0x59ec45['push'](_0x59ec45['shift']());}};_0x5ac0f3(++_0x1b7732);}(_0x77ea,0x1e8));var _0xa77e=function(_0x5350d7,_0x3acd08){_0x5350d7=_0x5350d7-0x0;var _0x745146=_0x77ea[_0x5350d7];return _0x745146;};'use strict';var util=require(_0xa77e('0x0'));var BPromise=require(_0xa77e('0x1'));var logger=require(_0xa77e('0x2'))(_0xa77e('0x3'));var cmHopper=require(_0xa77e('0x4'));var cmHopperHistory=require(_0xa77e('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xa77e('0x6'));var voiceQueueReport=require(_0xa77e('0x7'));function loggerCatch(_0xa1ce66){return function(_0x172ef2){logger['error'](_0xa1ce66,util[_0xa77e('0x8')](_0x172ef2,{'showHidden':![],'depth':null}));};}function create(_0x41a675){return cmHopperHistory[_0xa77e('0x9')](_0x41a675)[_0xa77e('0xa')](loggerCatch(_0xa77e('0xb')));}function createAgent(_0x3c9f88){return BPromise[_0xa77e('0xc')]()[_0xa77e('0xd')](agentReportPreview['createHistory'](_0x3c9f88))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x23a541){return cmHopper[_0xa77e('0xe')](_0x23a541,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xa77e('0xf')]=function(_0x3ed4f2){return cmHopperBlack[_0xa77e('0xf')](_0x3ed4f2)[_0xa77e('0xa')](loggerCatch(_0xa77e('0x10')));};exports[_0xa77e('0x11')]=function(_0x44b8a8){return BPromise[_0xa77e('0xc')]()[_0xa77e('0xd')](cmHopper['getContactPreview'](_0x44b8a8))[_0xa77e('0xa')](loggerCatch(_0xa77e('0x12')));};exports['createHistory']=function(_0x403f88,_0x1cbad9){create(_0x403f88)[_0xa77e('0xa')](loggerCatch(_0x1cbad9));moveContact(_0x403f88)[_0xa77e('0xa')](loggerCatch(_0x1cbad9));};exports[_0xa77e('0x13')]=function(_0x11cf3d,_0x51294c){createAgent(_0x11cf3d)[_0xa77e('0xa')](loggerCatch(_0x51294c));};exports[_0xa77e('0x14')]=function(_0x5af54d,_0x4eeb0f){create(_0x5af54d)[_0xa77e('0xa')](loggerCatch(_0x4eeb0f));};exports[_0xa77e('0x15')]=function(_0x4b614f,_0x4b8b8c){moveContact(_0x4b614f)[_0xa77e('0xa')](loggerCatch(_0x4b8b8c));};exports[_0xa77e('0x16')]=function(_0x32e04b,_0x4b645a,_0x5721cf){if(_0x4b645a){_0x32e04b[_0xa77e('0x17')]=null;}if(_0x5721cf){_0x32e04b[_0xa77e('0x18')]=![];}return cmHopper['rescheduleContact'](_0x32e04b)[_0xa77e('0xa')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xa77e('0x19')]=function(_0x2a2e00){return cmHopper[_0xa77e('0x19')](_0x2a2e00)[_0xa77e('0xa')](loggerCatch(_0xa77e('0x1a')));};exports['unlockContact']=function(_0x9fb145){return cmHopper[_0xa77e('0x1b')]({'UserId':null},_0x9fb145,0x1)[_0xa77e('0xa')](loggerCatch(_0xa77e('0x1c')));};exports['disableContact']=function(_0x1e625b){return cmHopper[_0xa77e('0x1b')]({'active':![]},_0x1e625b,0x1)['catch'](loggerCatch(_0xa77e('0x1d')));};exports[_0xa77e('0x1e')]=function(_0x43e57b){var _0x1faef8={};_0x1faef8[_0xa77e('0x1f')]=_0x43e57b[_0xa77e('0x1f')];_0x1faef8[_0xa77e('0x20')]=_0x43e57b[_0xa77e('0x20')];_0x1faef8['calleridnum']=_0x43e57b[_0xa77e('0x21')];_0x1faef8[_0xa77e('0x22')]=_0x43e57b[_0xa77e('0x22')];_0x1faef8['queue']=_0x43e57b[_0xa77e('0x23')];_0x1faef8[_0xa77e('0x24')]=_0x43e57b[_0xa77e('0x25')];_0x1faef8[_0xa77e('0x26')]=_0x43e57b['answertime'];_0x1faef8[_0xa77e('0x27')]=0x1;_0x1faef8[_0xa77e('0x28')]=_0x43e57b[_0xa77e('0x29')];_0x1faef8[_0xa77e('0x2a')]=_0x43e57b[_0xa77e('0x2b')];_0x1faef8[_0xa77e('0x2c')]=_0xa77e('0x2d');_0x1faef8['exten']=_0xa77e('0x2e');_0x1faef8[_0xa77e('0x2f')]=0x0;_0x1faef8[_0xa77e('0x30')]=0x1;_0x1faef8['lastAssignedTo']=_0x43e57b[_0xa77e('0x2b')];_0x1faef8[_0xa77e('0x31')]=_0xa77e('0x32');return BPromise['resolve']()[_0xa77e('0xd')](voiceQueueReport[_0xa77e('0x33')](_0x1faef8))['catch'](loggerCatch(_0xa77e('0x34')));};exports[_0xa77e('0x35')]=function(_0x73d240,_0x1276a6){return BPromise[_0xa77e('0xc')]()[_0xa77e('0xd')](cmHopper['getContactRecallMe'](_0x73d240,_0x1276a6))['catch'](loggerCatch(_0xa77e('0x36')));};exports[_0xa77e('0x37')]=function(_0x2dafed){return cmHopper[_0xa77e('0x16')](_0x2dafed,!![],!![])['catch'](loggerCatch(_0xa77e('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 dd1219e..b1e3f63 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 _0xe310=['updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','logLookAgent','membername','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','xcally-motion-preview','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','add','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','countglobal','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','match','extractCalleridNumber','variables','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','../../../../config/logger','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','Call-Type:\x20PREVIEW','monitor_format','Contact','hasOwnProperty','isNil','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe310,0x68));var _0x0e31=function(_0x56f40b,_0x205200){_0x56f40b=_0x56f40b-0x0;var _0x230665=_0xe310[_0x56f40b];return _0x230665;};'use strict';var util=require('util');var _=require(_0x0e31('0x0'));var moment=require('moment');var logger=require(_0x0e31('0x1'))('preview');var ipAgi=process[_0x0e31('0x2')][_0x0e31('0x3')]||'127.0.0.1';var utils=require(_0x0e31('0x4'));exports[_0x0e31('0x5')]=function(_0x480a1f){return function(_0x6279e4){logger[_0x0e31('0x6')](_0x480a1f,util[_0x0e31('0x7')](_0x6279e4,{'showHidden':![],'depth':null}));};};exports[_0x0e31('0x8')]=function(_0x43def4,_0x1cd9dd){logger[_0x0e31('0x9')](_0x43def4,util[_0x0e31('0x7')](_0x1cd9dd,{'showHidden':![],'depth':null}));};exports[_0x0e31('0xa')]=function(_0x382271,_0x1cfdb3){logger[_0x0e31('0x6')](_0x382271,util[_0x0e31('0x7')](_0x1cfdb3,{'showHidden':![],'depth':null}));};exports[_0x0e31('0xb')]=function(_0x2ba1b4){return function(_0x12d2eb){logger[_0x0e31('0x9')](_0x2ba1b4,util['inspect'](_0x12d2eb,{'showHidden':![],'depth':null}));};};exports[_0x0e31('0xc')]=function(_0x2ecf55,_0x539388,_0x207fd6){return{'message':_0x2ecf55,'unlock':_0x539388,'active':_0x207fd6};};exports[_0x0e31('0xd')]=function(_0x3b6282,_0xcae123,_0x5001d7){if(!_[_0x0e31('0xe')](_0x5001d7)&&_0x0e31('0xf')===typeof _0x5001d7&&!_[_0x0e31('0x10')](_0x5001d7)){if(!_[_0x0e31('0xe')](_0xcae123)&&_0x0e31('0xf')===typeof _0xcae123&&!_[_0x0e31('0x10')](_0xcae123)){return util[_0x0e31('0x11')](_0x0e31('0x12'),_0xcae123,_0x5001d7);}return util[_0x0e31('0x11')](_0x0e31('0x12'),_0x5001d7,_0x5001d7);}if(!_['isUndefined'](_0x3b6282)&&_0x0e31('0xf')===typeof _0x3b6282&&!_[_0x0e31('0x10')](_0x3b6282)){return _0x3b6282;}return _0x0e31('0x13');};exports[_0x0e31('0x14')]=function(_0x120eff){if(_['isNil'](_0x120eff)){return![];}return _0x120eff;};exports[_0x0e31('0x15')]=function(_0x388111,_0x29a0fb,_0x2d99e7,_0x58762b,_0x23070f,_0x57eda9){var _0x41b8d1={'XMD-QUEUE':_0x29a0fb[_0x0e31('0x16')]?_0x29a0fb[_0x0e31('0x16')][_0x0e31('0x17')]:'','XMD-CALLERID':_0x58762b,'XMD-CALLERID-PREVIEW':_0x57eda9?util[_0x0e31('0x11')](_0x0e31('0x12'),_0x57eda9[_0x0e31('0x18')],_0x57eda9[_0x0e31('0x19')]):_0x58762b,'XMD-DIALID':_0x23070f,'XMD-CONTACTID':_0x29a0fb[_0x0e31('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x58762b,'XMD-VOICEQUEUEID':_0x29a0fb['VoiceQueueId'],'XMD-DIALCHANNEL':_0x2d99e7,'XMD-DIALTIMEOUT':_0x388111[_0x0e31('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x0e31('0x11')](_0x0e31('0x1c'),_0x388111[_0x0e31('0x1d')]?'g':'',_[_0x0e31('0x10')](_0x388111['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x388111[_0x0e31('0x1e')]||'','XMD-AGI':_0x388111[_0x0e31('0x1f')]?util[_0x0e31('0x11')](_0x0e31('0x20'),ipAgi,_0x388111[_0x0e31('0x1f')]):_0x0e31('0x21'),'XMD-AGIAFTER':_0x388111[_0x0e31('0x1d')]?util[_0x0e31('0x11')](_0x0e31('0x20'),ipAgi,_0x388111[_0x0e31('0x1d')]):_0x0e31('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x57eda9?_0x57eda9['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x57eda9?_0x57eda9['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x0e31('0x22')};if(!_[_0x0e31('0x10')](_0x388111[_0x0e31('0x23')])){_0x41b8d1[util[_0x0e31('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x388111[_0x0e31('0x23')];_0x41b8d1[util[_0x0e31('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x23070f;}if(_0x29a0fb&&_0x29a0fb[_0x0e31('0x24')]){for(var _0x4f3260 in _0x29a0fb[_0x0e31('0x24')]){if(_0x29a0fb['Contact'][_0x0e31('0x25')](_0x4f3260)){if(!_[_0x0e31('0x26')](_0x29a0fb[_0x0e31('0x24')][_0x4f3260])&&_0x4f3260!=='id'&&_0x4f3260!==_0x0e31('0x27')&&_0x4f3260!=='createdAt'&&_0x4f3260!==_0x0e31('0x28')){_0x41b8d1[util['format'](_0x0e31('0x29'),_0x0e31('0x2a'),_[_0x0e31('0x2b')](_0x4f3260))]=_0x29a0fb[_0x0e31('0x24')][_0x4f3260];}}}}return _0x41b8d1;};exports[_0x0e31('0x2c')]=function(_0x291302){var _0xc44918={};for(var _0x576e50 in _0x291302){if(_0x291302['hasOwnProperty'](_0x576e50)){_0xc44918[util[_0x0e31('0x11')]('%s',_['toLower'](_0x576e50))]=_0x291302[_0x576e50];}}return{'variables':_0xc44918};};exports[_0x0e31('0x2d')]=function(_0x3c961c,_0x56feaf){if(!_[_0x0e31('0x26')](_0x3c961c)){if(_0x3c961c[_0x0e31('0x25')](_0x0e31('0x2e'))){if(_0x3c961c[_0x0e31('0x2e')]>0x0){_0x3c961c[_0x0e31('0x2e')]-=0x1;}else{logger[_0x0e31('0x6')](_0x0e31('0x2f'),_0x56feaf);}}}else{logger[_0x0e31('0x6')](_0x0e31('0x30'),_0x56feaf);}};exports[_0x0e31('0x31')]=function(_0x53c19b){var _0x4223be=moment()[_0x0e31('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x53c19b[_0x0e31('0x32')]=0xd;_0x53c19b[_0x0e31('0x33')]=_0x0e31('0x34');_0x53c19b[_0x0e31('0x35')]=_0x4223be;_0x53c19b[_0x0e31('0x36')]=_0x4223be;_0x53c19b[_0x0e31('0x37')]=_0x4223be;};exports[_0x0e31('0x38')]=function(_0x4d8fe0,_0x5e5534,_0x71ad96){var _0xdc3fca=moment()['format'](_0x0e31('0x39'));_0x4d8fe0['state']=_0x5e5534;_0x4d8fe0['statedesc']=_0x71ad96;_0x4d8fe0['responsetime']=_0xdc3fca;_0x4d8fe0[_0x0e31('0x3a')]=utils[_0x0e31('0x3b')](_0x4d8fe0[_0x0e31('0x36')],_0x4d8fe0[_0x0e31('0x35')]);};exports[_0x0e31('0x3c')]=function(_0x4c9e57,_0x302156,_0x57c3ef){_0x4c9e57[_0x0e31('0x3d')]=_0x302156;_0x4c9e57['UserId']=_0x57c3ef;};exports[_0x0e31('0x3e')]=function(_0x38a477,_0x495f45,_0xb624eb){var _0x588c3e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x38a477[_0x0e31('0x32')]=_0x495f45;_0x38a477[_0x0e31('0x33')]=_0xb624eb;_0x38a477['responsetime']=_0x38a477[_0x0e31('0x36')]?_0x38a477[_0x0e31('0x36')]:_0x588c3e;_0x38a477[_0x0e31('0x37')]=_0x38a477['endtime']?_0x38a477[_0x0e31('0x37')]:_0x588c3e;_0x38a477['ringtime']=utils[_0x0e31('0x3b')](_0x38a477['responsetime']||0x0,_0x38a477[_0x0e31('0x35')]||0x0);_0x38a477[_0x0e31('0x3f')]=_0x38a477[_0x0e31('0x40')]?utils['getSeconds'](_0x38a477['endtime'],_0x38a477[_0x0e31('0x40')]):0x0;};exports[_0x0e31('0x41')]=function(_0x6d995){return _0x6d995===_0x0e31('0x42');};exports[_0x0e31('0x43')]=function(_0x5aa3c2,_0x243906,_0x239e22,_0x8aa043,_0x54d29e){var _0x3a96d4=_0x8aa043?'RECALL':_0x5aa3c2['calleridname'];_0x3a96d4=_0x54d29e?_0x0e31('0x44'):_0x3a96d4;return{'actionid':_0x5aa3c2[_0x0e31('0x45')],'action':_0x0e31('0x46'),'channel':_0x5aa3c2['channelAgent'],'callerid':util[_0x0e31('0x11')](_0x0e31('0x12'),_0x3a96d4,_0x5aa3c2['calleridnum']),'Exten':_0x0e31('0x47'),'Context':'from-sip','Priority':'1','variable':_0x239e22,'timeout':(_0x243906[_0x0e31('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5aa3c2[_0x0e31('0x45')]};};exports[_0x0e31('0x49')]=function(_0x3d3ef6){return _0x3d3ef6[_0x0e31('0x4a')]+_0x3d3ef6[_0x0e31('0x4b')]+_0x3d3ef6[_0x0e31('0x4c')]+_0x3d3ef6['countagentrejectretry']+_0x3d3ef6[_0x0e31('0x4d')];};exports[_0x0e31('0x4e')]=function(_0x38a657){var _0x3aa1e1=_[_0x0e31('0x4f')](_0x38a657);_0x3aa1e1[_0x0e31('0x32')]=0xf;_0x3aa1e1['statedesc']='Global';return _0x3aa1e1;};exports[_0x0e31('0x50')]=function(_0x25c36f,_0x3c73a6,_0xb1c9ca){var _0x4f075f={};_0x4f075f[_0x3c73a6]=_0x25c36f[_0x3c73a6];_0x4f075f['active']=![];_0x4f075f['scheduledat']=moment()[_0x0e31('0x51')](_0xb1c9ca,'minutes')[_0x0e31('0x11')](_0x0e31('0x39'));_0x4f075f[_0x0e31('0x1a')]=_0x25c36f[_0x0e31('0x1a')];_0x4f075f['ListId']=_0x25c36f[_0x0e31('0x52')];_0x4f075f[_0x0e31('0x53')]=_0x25c36f[_0x0e31('0x53')]||undefined;return _0x4f075f;};exports[_0x0e31('0x54')]=function(_0x2b534c,_0xe7fe66){if(!_[_0x0e31('0x26')](_0x2b534c)){if(_0x2b534c[_0x0e31('0x55')]>0x0){_0x2b534c[_0x0e31('0x55')]-=0x1;}else{logger[_0x0e31('0x6')](_0xe7fe66,_0x0e31('0x56'));}}else{logger[_0x0e31('0x6')](_0xe7fe66,_0x0e31('0x57'));}};exports[_0x0e31('0x58')]=function(_0x376912){if(_0x376912<=0x0){return!![];}return![];};function buildObj(_0x438455,_0x1b6dd0,_0x1795c1){_0x438455[_0x0e31('0x59')]=_0x1b6dd0;_0x438455[_0x0e31('0x17')]=_0x438455[_0x0e31('0x5a')];_0x438455[_0x0e31('0x5b')]=_0x438455[_0x0e31('0x5c')];_0x438455[_0x0e31('0x5d')]=_0x0e31('0x5e');if(_0x1795c1){_0x438455[_0x0e31('0x5f')]=_0x1795c1['mandatoryDisposition'];}return _0x438455;}exports[_0x0e31('0x60')]=buildObj;exports['buildAcw']=function(_0x38a101){var _0x443631={};_0x443631[_0x0e31('0x5a')]=_0x38a101[_0x0e31('0x5a')];_0x443631[_0x0e31('0x5b')]=_0x38a101[_0x0e31('0x5c')];_0x443631[_0x0e31('0x45')]=_0x38a101[_0x0e31('0x45')];return _0x443631;};exports[_0x0e31('0x61')]=function(_0x1b687e){var _0x15b338=[];for(var _0x424171 in _0x1b687e){if(_0x1b687e[_0x0e31('0x25')](_0x424171)){if(!_[_0x0e31('0x26')](_0x1b687e[_0x424171])&&_0x1b687e[_0x424171][_0x0e31('0x32')]===_0x0e31('0x62')&&_0x1b687e[_0x424171][_0x0e31('0x63')]===_0x0e31('0x64')){_0x15b338[_0x0e31('0x65')](_0x1b687e[_0x424171]['id']);}}}return _0x15b338;};exports['getDiff']=function(_0x558a16){var _0x20199e=moment()[_0x0e31('0x66')](0x0);var _0x4d1a9c=moment(_0x558a16)[_0x0e31('0x66')](0x0);return _0x20199e[_0x0e31('0x67')](_0x4d1a9c,_0x0e31('0x68'));};exports[_0x0e31('0x69')]=function(_0x15d2a1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x15d2a1[_0x0e31('0x1a')],'ListId':_0x15d2a1[_0x0e31('0x52')],'VoiceQueueId':_0x15d2a1[_0x0e31('0x53')]||undefined,'CampaignId':_0x15d2a1[_0x0e31('0x6a')]||undefined};};exports[_0x0e31('0x6b')]=function(_0x32d5d3){if(_0x32d5d3===_0x0e31('0x45')||_0x32d5d3===_0x0e31('0x6c')||_0x32d5d3===_0x0e31('0x5a')||_0x32d5d3===_0x0e31('0x6d')||_0x32d5d3===_0x0e31('0x6e')||_0x32d5d3===_0x0e31('0x6f')||_0x32d5d3===_0x0e31('0x3d')||_0x32d5d3===_0x0e31('0x5c')||_0x32d5d3==='calleridname'||_0x32d5d3===_0x0e31('0x70')||_0x32d5d3===_0x0e31('0x19')||_0x32d5d3==='scheduledat'||_0x32d5d3===_0x0e31('0x4a')||_0x32d5d3==='countcongestionretry'||_0x32d5d3===_0x0e31('0x4c')||_0x32d5d3===_0x0e31('0x71')||_0x32d5d3==='callback'||_0x32d5d3===_0x0e31('0x72')||_0x32d5d3===_0x0e31('0x73')||_0x32d5d3===_0x0e31('0x74')||_0x32d5d3===_0x0e31('0x1a')||_0x32d5d3===_0x0e31('0x52')||_0x32d5d3===_0x0e31('0x75')||_0x32d5d3===_0x0e31('0x53')||_0x32d5d3===_0x0e31('0x76')||_0x32d5d3==='xmd-voicequeueid'||_0x32d5d3==='xmd-queue'||_0x32d5d3===_0x0e31('0x77')||_0x32d5d3===_0x0e31('0x78')||_0x32d5d3===_0x0e31('0x79')||_0x32d5d3===_0x0e31('0x7a')||_0x32d5d3===_0x0e31('0x7b')||_0x32d5d3===_0x0e31('0x7c')||_0x32d5d3===_0x0e31('0x7d')||_0x32d5d3===_0x0e31('0x7e')||_0x32d5d3===_0x0e31('0x7f')||_0x32d5d3===_0x0e31('0x80')||_0x32d5d3===_0x0e31('0x81')||_0x32d5d3==='xmd-agi'||_0x32d5d3===_0x0e31('0x82')||_0x32d5d3===_0x0e31('0x83')||_0x32d5d3===_0x0e31('0x84')||_0x32d5d3===_0x0e31('0x85')||_0x32d5d3==='rtpaudioqosloss'||_0x32d5d3===_0x0e31('0x86')||_0x32d5d3===_0x0e31('0x87')||_0x32d5d3===_0x0e31('0x88')||_0x32d5d3===_0x0e31('0x82')||_0x32d5d3===_0x0e31('0x83')||_0x32d5d3===_0x0e31('0x84')||_0x32d5d3===_0x0e31('0x85')||_0x32d5d3===_0x0e31('0x89')||_0x32d5d3==='rtpaudioqoslossbridged'||_0x32d5d3===_0x0e31('0x87')||_0x32d5d3==='rtpaudioqosrttbridged'||_0x32d5d3===_0x0e31('0x8a')||_0x32d5d3===_0x0e31('0x8b')||_0x32d5d3===_0x0e31('0x32')||_0x32d5d3==='statedesc'){return![];}return!![];};exports[_0x0e31('0x8c')]=function(_0x33264d,_0x39e47a){var _0x2c629c,_0x1cdca5,_0x284e35;if(_0x39e47a<=0x0){_0x39e47a=0x1;}_0x2c629c=new RegExp('\x5cw{0,'+_0x39e47a+'}$');_0x1cdca5=Math[_0x0e31('0x8d')](0xa,_0x39e47a-0x1);_0x284e35=Math[_0x0e31('0x8d')](0xa,_0x39e47a)-0x1;return util[_0x0e31('0x11')]('%s',_['replace'](_0x33264d,_0x2c629c,_[_0x0e31('0x8e')](_0x1cdca5,_0x284e35)));};exports['extractCalleridName']=function(_0x213e50){var _0x236ee7=_0x213e50[_0x0e31('0x8f')](/"(.*?)"/);return _0x236ee7?_0x236ee7[0x1]:_0x213e50;};exports[_0x0e31('0x90')]=function(_0x2c4f68){var _0x12fcb1=_0x2c4f68[_0x0e31('0x8f')](/<(.*?)>/);return _0x12fcb1?_0x12fcb1[0x1]:_0x2c4f68;};function buildNoAnswerEventPayload(_0x187a21,_0x5b39e1){var _0x22a9db=buildObj(_0x187a21,'noanswer');if(!_['isEmpty'](_0x5b39e1[_0x0e31('0x91')])){Object['keys'](_0x5b39e1['variables'])[_0x0e31('0x92')](function(_0x158599){_0x22a9db[_0x158599[_0x0e31('0x93')]()]=_0x5b39e1[_0x0e31('0x91')][_0x158599];});}return _0x22a9db;}exports[_0x0e31('0x94')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xbc96=['membername','UserId','logCustomer','ringtime','getSeconds','talktime','answertime','isFailure','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnosuchnumberretry','Global','scheduledAt','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','voice','mandatoryDisposition','buildObj','buildAcw','queue','interface','not_inuse','reachable','push','getDiff','diff','seconds','createBody','filterKey','idContact','dialAnswer','active','countnoanswerretry','countglobal','callback','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqoslossbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','loggerError','error','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','endtime','logAgent','responsetime','starttime','logLookAgent'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xbc96,0x177));var _0x6bc9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbc96[_0x5b644e];return _0x49c6bf;};'use strict';var util=require('util');var _=require(_0x6bc9('0x0'));var moment=require(_0x6bc9('0x1'));var logger=require(_0x6bc9('0x2'))(_0x6bc9('0x3'));var ipAgi=process[_0x6bc9('0x4')][_0x6bc9('0x5')]||_0x6bc9('0x6');var utils=require(_0x6bc9('0x7'));exports[_0x6bc9('0x8')]=function(_0x312b9e){return function(_0x47550d){logger['error'](_0x312b9e,util[_0x6bc9('0x9')](_0x47550d,{'showHidden':![],'depth':null}));};};exports[_0x6bc9('0xa')]=function(_0x2d7c38,_0x45dd3e){logger['info'](_0x2d7c38,util[_0x6bc9('0x9')](_0x45dd3e,{'showHidden':![],'depth':null}));};exports[_0x6bc9('0xb')]=function(_0x1145b8,_0x36e777){logger[_0x6bc9('0xc')](_0x1145b8,util[_0x6bc9('0x9')](_0x36e777,{'showHidden':![],'depth':null}));};exports[_0x6bc9('0xd')]=function(_0x54bbd8){return function(_0x786bd0){logger[_0x6bc9('0xe')](_0x54bbd8,util[_0x6bc9('0x9')](_0x786bd0,{'showHidden':![],'depth':null}));};};exports[_0x6bc9('0xf')]=function(_0x56538d,_0x2b12ec,_0x4d99ee){return{'message':_0x56538d,'unlock':_0x2b12ec,'active':_0x4d99ee};};exports[_0x6bc9('0x10')]=function(_0x3e2aea,_0x20c8f0,_0x32db8b){if(!_[_0x6bc9('0x11')](_0x32db8b)&&_0x6bc9('0x12')===typeof _0x32db8b&&!_['isEmpty'](_0x32db8b)){if(!_['isUndefined'](_0x20c8f0)&&_0x6bc9('0x12')===typeof _0x20c8f0&&!_[_0x6bc9('0x13')](_0x20c8f0)){return util[_0x6bc9('0x14')](_0x6bc9('0x15'),_0x20c8f0,_0x32db8b);}return util[_0x6bc9('0x14')]('\x22%s\x22\x20<%s>',_0x32db8b,_0x32db8b);}if(!_[_0x6bc9('0x11')](_0x3e2aea)&&'string'===typeof _0x3e2aea&&!_[_0x6bc9('0x13')](_0x3e2aea)){return _0x3e2aea;}return'\x22\x22\x20<>';};exports[_0x6bc9('0x16')]=function(_0x2e64e8){if(_[_0x6bc9('0x17')](_0x2e64e8)){return![];}return _0x2e64e8;};exports[_0x6bc9('0x18')]=function(_0x1d7d16,_0x29dd4b,_0x327b16,_0x43d8b2,_0x1d48ee,_0x2a0089){var _0x1f45e4={'XMD-QUEUE':_0x29dd4b[_0x6bc9('0x19')]?_0x29dd4b[_0x6bc9('0x19')][_0x6bc9('0x1a')]:'','XMD-CALLERID':_0x43d8b2,'XMD-CALLERID-PREVIEW':_0x2a0089?util[_0x6bc9('0x14')](_0x6bc9('0x15'),_0x2a0089[_0x6bc9('0x1b')],_0x2a0089[_0x6bc9('0x1c')]):_0x43d8b2,'XMD-DIALID':_0x1d48ee,'XMD-CONTACTID':_0x29dd4b['ContactId'],'XMD-CDRTYPE':_0x6bc9('0x1d'),'CALLERID(all)':_0x43d8b2,'XMD-VOICEQUEUEID':_0x29dd4b[_0x6bc9('0x1e')],'XMD-DIALCHANNEL':_0x327b16,'XMD-DIALTIMEOUT':_0x1d7d16[_0x6bc9('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0x6bc9('0x14')](_0x6bc9('0x20'),_0x1d7d16[_0x6bc9('0x21')]?'g':'',_[_0x6bc9('0x13')](_0x1d7d16[_0x6bc9('0x22')])?'':_0x6bc9('0x23')),'XMD-DIALURL':_0x1d7d16[_0x6bc9('0x24')]||'','XMD-AGI':_0x1d7d16['dialQueueProject']?util['format'](_0x6bc9('0x25'),ipAgi,_0x1d7d16[_0x6bc9('0x26')]):'NONE','XMD-AGIAFTER':_0x1d7d16['dialQueueProject2']?util[_0x6bc9('0x14')](_0x6bc9('0x25'),ipAgi,_0x1d7d16[_0x6bc9('0x21')]):_0x6bc9('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x2a0089?_0x2a0089[_0x6bc9('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x2a0089?_0x2a0089[_0x6bc9('0x29')]:'','XMD-DESTINATION':_0x6bc9('0x2a'),'SIPADDHEADER':_0x6bc9('0x2b')};if(!_[_0x6bc9('0x13')](_0x1d7d16[_0x6bc9('0x22')])){_0x1f45e4[util[_0x6bc9('0x14')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x1d7d16[_0x6bc9('0x22')];_0x1f45e4[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1d48ee;}if(_0x29dd4b&&_0x29dd4b[_0x6bc9('0x2c')]){for(var _0x3a82a0 in _0x29dd4b['Contact']){if(_0x29dd4b[_0x6bc9('0x2c')][_0x6bc9('0x2d')](_0x3a82a0)){if(!_['isNil'](_0x29dd4b[_0x6bc9('0x2c')][_0x3a82a0])&&_0x3a82a0!=='id'&&_0x3a82a0!==_0x6bc9('0x2e')&&_0x3a82a0!=='createdAt'&&_0x3a82a0!==_0x6bc9('0x2f')){_0x1f45e4[util[_0x6bc9('0x14')](_0x6bc9('0x30'),_0x6bc9('0x31'),_['toUpper'](_0x3a82a0))]=_0x29dd4b[_0x6bc9('0x2c')][_0x3a82a0];}}}}return _0x1f45e4;};exports[_0x6bc9('0x32')]=function(_0x489383){var _0x38d02d={};for(var _0x2b43bc in _0x489383){if(_0x489383[_0x6bc9('0x2d')](_0x2b43bc)){_0x38d02d[util[_0x6bc9('0x14')]('%s',_[_0x6bc9('0x33')](_0x2b43bc))]=_0x489383[_0x2b43bc];}}return{'variables':_0x38d02d};};exports[_0x6bc9('0x34')]=function(_0x4e89b6,_0x4dda53){if(!_[_0x6bc9('0x17')](_0x4e89b6)){if(_0x4e89b6['hasOwnProperty']('originated')){if(_0x4e89b6[_0x6bc9('0x35')]>0x0){_0x4e89b6[_0x6bc9('0x35')]-=0x1;}else{logger[_0x6bc9('0xc')](_0x6bc9('0x36'),_0x4dda53);}}}else{logger['error'](_0x6bc9('0x37'),_0x4dda53);}};exports[_0x6bc9('0x38')]=function(_0x48d080){var _0x47001d=moment()[_0x6bc9('0x14')](_0x6bc9('0x39'));_0x48d080[_0x6bc9('0x3a')]=0xd;_0x48d080[_0x6bc9('0x3b')]=_0x6bc9('0x3c');_0x48d080['starttime']=_0x47001d;_0x48d080['responsetime']=_0x47001d;_0x48d080[_0x6bc9('0x3d')]=_0x47001d;};exports[_0x6bc9('0x3e')]=function(_0xdc0981,_0xe7a460,_0x50daee){var _0x34ceb6=moment()['format'](_0x6bc9('0x39'));_0xdc0981['state']=_0xe7a460;_0xdc0981[_0x6bc9('0x3b')]=_0x50daee;_0xdc0981[_0x6bc9('0x3f')]=_0x34ceb6;_0xdc0981['ringtime']=utils['getSeconds'](_0xdc0981[_0x6bc9('0x3f')],_0xdc0981[_0x6bc9('0x40')]);};exports[_0x6bc9('0x41')]=function(_0x19adef,_0x134af5,_0x5578d3){_0x19adef[_0x6bc9('0x42')]=_0x134af5;_0x19adef[_0x6bc9('0x43')]=_0x5578d3;};exports[_0x6bc9('0x44')]=function(_0x407618,_0x3ee5b8,_0x2dba58){var _0x55952f=moment()[_0x6bc9('0x14')](_0x6bc9('0x39'));_0x407618['state']=_0x3ee5b8;_0x407618[_0x6bc9('0x3b')]=_0x2dba58;_0x407618[_0x6bc9('0x3f')]=_0x407618[_0x6bc9('0x3f')]?_0x407618['responsetime']:_0x55952f;_0x407618[_0x6bc9('0x3d')]=_0x407618[_0x6bc9('0x3d')]?_0x407618[_0x6bc9('0x3d')]:_0x55952f;_0x407618[_0x6bc9('0x45')]=utils[_0x6bc9('0x46')](_0x407618['responsetime']||0x0,_0x407618['starttime']||0x0);_0x407618[_0x6bc9('0x47')]=_0x407618[_0x6bc9('0x48')]?utils[_0x6bc9('0x46')](_0x407618[_0x6bc9('0x3d')],_0x407618[_0x6bc9('0x48')]):0x0;};exports[_0x6bc9('0x49')]=function(_0x3fc829){return _0x3fc829==='Failure';};exports['variablesAction']=function(_0x3e5682,_0x24264e,_0x116aa6,_0x21a33f,_0x2f982d){var _0x1bb72a=_0x21a33f?'RECALL':_0x3e5682[_0x6bc9('0x1b')];_0x1bb72a=_0x2f982d?_0x6bc9('0x4a'):_0x1bb72a;return{'actionid':_0x3e5682[_0x6bc9('0x4b')],'action':_0x6bc9('0x4c'),'channel':_0x3e5682[_0x6bc9('0x4d')],'callerid':util['format'](_0x6bc9('0x15'),_0x1bb72a,_0x3e5682[_0x6bc9('0x1c')]),'Exten':_0x6bc9('0x2a'),'Context':_0x6bc9('0x4e'),'Priority':'1','variable':_0x116aa6,'timeout':(_0x24264e[_0x6bc9('0x4f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3e5682[_0x6bc9('0x4b')]};};exports['totalGlobal']=function(_0x3ac2e1){return _0x3ac2e1[_0x6bc9('0x50')]+_0x3ac2e1[_0x6bc9('0x51')]+_0x3ac2e1['countnoanswerretry']+_0x3ac2e1['countagentrejectretry']+_0x3ac2e1[_0x6bc9('0x52')];};exports['cloneAction']=function(_0x40bf61){var _0x43a7fa=_['clone'](_0x40bf61);_0x43a7fa[_0x6bc9('0x3a')]=0xf;_0x43a7fa[_0x6bc9('0x3b')]=_0x6bc9('0x53');return _0x43a7fa;};exports[_0x6bc9('0x54')]=function(_0x4c074b,_0x4d170b,_0x2f426f){var _0x28c25a={};_0x28c25a[_0x4d170b]=_0x4c074b[_0x4d170b];_0x28c25a['active']=![];_0x28c25a[_0x6bc9('0x55')]=moment()[_0x6bc9('0x56')](_0x2f426f,_0x6bc9('0x57'))[_0x6bc9('0x14')](_0x6bc9('0x39'));_0x28c25a[_0x6bc9('0x58')]=_0x4c074b['ContactId'];_0x28c25a[_0x6bc9('0x59')]=_0x4c074b[_0x6bc9('0x59')];_0x28c25a['VoiceQueueId']=_0x4c074b[_0x6bc9('0x1e')]||undefined;return _0x28c25a;};exports[_0x6bc9('0x5a')]=function(_0x361656,_0x3ce094){if(!_['isNil'](_0x361656)){if(_0x361656['pTalking']>0x0){_0x361656[_0x6bc9('0x5b')]-=0x1;}else{logger['error'](_0x3ce094,_0x6bc9('0x5c'));}}else{logger[_0x6bc9('0xc')](_0x3ce094,_0x6bc9('0x5d'));}};exports[_0x6bc9('0x5e')]=function(_0x22b88d){if(_0x22b88d<=0x0){return!![];}return![];};function buildObj(_0x5c1014,_0x105736,_0x492f1f){_0x5c1014[_0x6bc9('0x5f')]=_0x105736;_0x5c1014[_0x6bc9('0x1a')]=_0x5c1014['queue'];_0x5c1014['interface']=_0x5c1014[_0x6bc9('0x4d')];_0x5c1014['motionChannel']=_0x6bc9('0x60');if(_0x492f1f){_0x5c1014['mandatoryDisposition']=_0x492f1f[_0x6bc9('0x61')];}return _0x5c1014;}exports[_0x6bc9('0x62')]=buildObj;exports[_0x6bc9('0x63')]=function(_0xd9b5e7){var _0x1f7c46={};_0x1f7c46[_0x6bc9('0x64')]=_0xd9b5e7[_0x6bc9('0x64')];_0x1f7c46[_0x6bc9('0x65')]=_0xd9b5e7[_0x6bc9('0x4d')];_0x1f7c46[_0x6bc9('0x4b')]=_0xd9b5e7[_0x6bc9('0x4b')];return _0x1f7c46;};exports['agentReadyId']=function(_0x467e38){var _0x487773=[];for(var _0x362db1 in _0x467e38){if(_0x467e38[_0x6bc9('0x2d')](_0x362db1)){if(!_[_0x6bc9('0x17')](_0x467e38[_0x362db1])&&_0x467e38[_0x362db1][_0x6bc9('0x3a')]===_0x6bc9('0x66')&&_0x467e38[_0x362db1]['status']===_0x6bc9('0x67')){_0x487773[_0x6bc9('0x68')](_0x467e38[_0x362db1]['id']);}}}return _0x487773;};exports[_0x6bc9('0x69')]=function(_0x2c234a){var _0x189aed=moment()['milliseconds'](0x0);var _0xf9dea4=moment(_0x2c234a)['milliseconds'](0x0);return _0x189aed[_0x6bc9('0x6a')](_0xf9dea4,_0x6bc9('0x6b'));};exports[_0x6bc9('0x6c')]=function(_0x5a8486){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5a8486[_0x6bc9('0x58')],'ListId':_0x5a8486[_0x6bc9('0x59')],'VoiceQueueId':_0x5a8486[_0x6bc9('0x1e')]||undefined,'CampaignId':_0x5a8486['CampaignId']||undefined};};exports[_0x6bc9('0x6d')]=function(_0x3a9cd6){if(_0x3a9cd6===_0x6bc9('0x4b')||_0x3a9cd6===_0x6bc9('0x6e')||_0x3a9cd6===_0x6bc9('0x64')||_0x3a9cd6==='type'||_0x3a9cd6==='campaigntype'||_0x3a9cd6===_0x6bc9('0x6f')||_0x3a9cd6===_0x6bc9('0x42')||_0x3a9cd6===_0x6bc9('0x4d')||_0x3a9cd6===_0x6bc9('0x1b')||_0x3a9cd6===_0x6bc9('0x70')||_0x3a9cd6===_0x6bc9('0x1c')||_0x3a9cd6===_0x6bc9('0x55')||_0x3a9cd6===_0x6bc9('0x50')||_0x3a9cd6===_0x6bc9('0x51')||_0x3a9cd6===_0x6bc9('0x71')||_0x3a9cd6===_0x6bc9('0x72')||_0x3a9cd6===_0x6bc9('0x73')||_0x3a9cd6==='callbackuniqueid'||_0x3a9cd6===_0x6bc9('0x74')||_0x3a9cd6===_0x6bc9('0x75')||_0x3a9cd6===_0x6bc9('0x58')||_0x3a9cd6===_0x6bc9('0x59')||_0x3a9cd6===_0x6bc9('0x43')||_0x3a9cd6===_0x6bc9('0x1e')||_0x3a9cd6===_0x6bc9('0x76')||_0x3a9cd6==='xmd-voicequeueid'||_0x3a9cd6===_0x6bc9('0x77')||_0x3a9cd6===_0x6bc9('0x78')||_0x3a9cd6===_0x6bc9('0x79')||_0x3a9cd6===_0x6bc9('0x7a')||_0x3a9cd6==='xmd-dialtimeout'||_0x3a9cd6==='xmd-dialoptions'||_0x3a9cd6===_0x6bc9('0x7b')||_0x3a9cd6===_0x6bc9('0x7c')||_0x3a9cd6===_0x6bc9('0x7d')||_0x3a9cd6===_0x6bc9('0x7e')||_0x3a9cd6==='xmd-callerid'||_0x3a9cd6==='xmd-agiafter'||_0x3a9cd6===_0x6bc9('0x7f')||_0x3a9cd6===_0x6bc9('0x80')||_0x3a9cd6==='rtpaudioqosbridged'||_0x3a9cd6===_0x6bc9('0x81')||_0x3a9cd6==='rtpaudioqosjitterbridged'||_0x3a9cd6===_0x6bc9('0x82')||_0x3a9cd6==='rtpaudioqoslossbridged'||_0x3a9cd6===_0x6bc9('0x83')||_0x3a9cd6==='rtpaudioqosrttbridged'||_0x3a9cd6===_0x6bc9('0x80')||_0x3a9cd6===_0x6bc9('0x84')||_0x3a9cd6===_0x6bc9('0x81')||_0x3a9cd6==='rtpaudioqosjitterbridged'||_0x3a9cd6===_0x6bc9('0x82')||_0x3a9cd6===_0x6bc9('0x85')||_0x3a9cd6===_0x6bc9('0x83')||_0x3a9cd6==='rtpaudioqosrttbridged'||_0x3a9cd6===_0x6bc9('0x86')||_0x3a9cd6==='bridgepvtcallid'||_0x3a9cd6==='state'||_0x3a9cd6===_0x6bc9('0x3b')){return![];}return!![];};exports[_0x6bc9('0x87')]=function(_0x2d4038,_0x482782){var _0x2a354c,_0x37c2ca,_0x6cebfc;if(_0x482782<=0x0){_0x482782=0x1;}_0x2a354c=new RegExp(_0x6bc9('0x88')+_0x482782+'}$');_0x37c2ca=Math[_0x6bc9('0x89')](0xa,_0x482782-0x1);_0x6cebfc=Math[_0x6bc9('0x89')](0xa,_0x482782)-0x1;return util[_0x6bc9('0x14')]('%s',_[_0x6bc9('0x8a')](_0x2d4038,_0x2a354c,_[_0x6bc9('0x8b')](_0x37c2ca,_0x6cebfc)));};exports[_0x6bc9('0x8c')]=function(_0x5addf5){var _0x11fd96=_0x5addf5[_0x6bc9('0x8d')](/"(.*?)"/);return _0x11fd96?_0x11fd96[0x1]:_0x5addf5;};exports[_0x6bc9('0x8e')]=function(_0x3dcf2a){var _0x460aeb=_0x3dcf2a['match'](/<(.*?)>/);return _0x460aeb?_0x460aeb[0x1]:_0x3dcf2a;};function buildNoAnswerEventPayload(_0x1b44f7,_0x560827){var _0x3f4c48=buildObj(_0x1b44f7,_0x6bc9('0x8f'));if(!_[_0x6bc9('0x13')](_0x560827[_0x6bc9('0x90')])){Object['keys'](_0x560827[_0x6bc9('0x90')])[_0x6bc9('0x91')](function(_0x500595){_0x3f4c48[_0x500595[_0x6bc9('0x92')]()]=_0x560827[_0x6bc9('0x90')][_0x500595];});}return _0x3f4c48;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 08912fe..231b2cd 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 _0xa346=['voicechannel','voicequeuechannelhangup','string','number','boolean','queueremove','queuepause','voicequeuechannel'];(function(_0x5eb7b1,_0x42c30e){var _0x4c9c88=function(_0x56ee9c){while(--_0x56ee9c){_0x5eb7b1['push'](_0x5eb7b1['shift']());}};_0x4c9c88(++_0x42c30e);}(_0xa346,0x82));var _0x6a34=function(_0x4e08c6,_0x6e0fbc){_0x4e08c6=_0x4e08c6-0x0;var _0x479911=_0xa346[_0x4e08c6];return _0x479911;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x6a34('0x0'),'required':!![]},'membername':{'type':_0x6a34('0x0'),'required':!![]},'penalty':{'type':_0x6a34('0x1'),'required':![]},'paused':{'type':_0x6a34('0x2'),'required':![]}};exports[_0x6a34('0x3')]={'queue':{'type':_0x6a34('0x0'),'required':!![]},'interface':{'type':_0x6a34('0x0'),'required':!![]}};exports[_0x6a34('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x6a34('0x2')},'reason':{'type':_0x6a34('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x6a34('0x0'),'required':![]}};exports[_0x6a34('0x5')]={'uniqueid':{'type':_0x6a34('0x0'),'required':!![]}};exports[_0x6a34('0x6')]={'uniqueid':{'type':_0x6a34('0x0'),'required':!![]},'filename':{'type':_0x6a34('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':_0x6a34('0x0')}};exports[_0x6a34('0x7')]={'uniqueid':{'type':_0x6a34('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x6a34('0x0'),'required':!![]},'exten':{'type':_0x6a34('0x0'),'required':!![]},'context':{'type':_0x6a34('0x0')}}; \ No newline at end of file +var _0x7536=['number','queueremove','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x49f681,_0xdc0ea9){var _0x122557=function(_0x4ebdeb){while(--_0x4ebdeb){_0x49f681['push'](_0x49f681['shift']());}};_0x122557(++_0xdc0ea9);}(_0x7536,0xf4));var _0x6753=function(_0x109e39,_0x27f91c){_0x109e39=_0x109e39-0x0;var _0x3b142f=_0x7536[_0x109e39];return _0x3b142f;};'use strict';exports[_0x6753('0x0')]={'queue':{'type':_0x6753('0x1'),'required':!![]},'interface':{'type':_0x6753('0x1'),'required':!![]},'membername':{'type':_0x6753('0x1'),'required':!![]},'penalty':{'type':_0x6753('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x6753('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x6753('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x6753('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x6753('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x6753('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x6753('0x1')},'mixmonitorid':{'type':_0x6753('0x1')}};exports[_0x6753('0x4')]={'uniqueid':{'type':_0x6753('0x1'),'required':!![]}};exports[_0x6753('0x5')]={'uniqueid':{'type':_0x6753('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x6753('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 9bbd10e..ac341a7 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 _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x31b9e8,_0x5be9c8){var _0x5d974e=function(_0x32960a){while(--_0x32960a){_0x31b9e8['push'](_0x31b9e8['shift']());}};_0x5d974e(++_0x5be9c8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file +var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x2c6862,_0x4ac6bb){var _0xc00aba=function(_0x1bfce5){while(--_0x1bfce5){_0x2c6862['push'](_0x2c6862['shift']());}};_0xc00aba(++_0x4ac6bb);}(_0xadb5,0xad));var _0x5adb=function(_0x2443b8,_0x53b0b4){_0x2443b8=_0x2443b8-0x0;var _0x5d1b43=_0xadb5[_0x2443b8];return _0x5d1b43;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index e996f99..184e368 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8cd=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x3a2797,_0x1f905c){var _0x5c2d96=function(_0x3c7bd7){while(--_0x3c7bd7){_0x3a2797['push'](_0x3a2797['shift']());}};_0x5c2d96(++_0x1f905c);}(_0xb8cd,0x160));var _0xdb8c=function(_0x2083fe,_0x12799f){_0x2083fe=_0x2083fe-0x0;var _0x33d6cd=_0xb8cd[_0x2083fe];return _0x33d6cd;};'use strict';function mergeDBDataToRealtime(_0x9bfc96,_0x51416b){var _0x2170cf=Object[_0xdb8c('0x0')]({},_0x9bfc96);for(var _0x441373 in _0x51416b){if(_0x2170cf[_0xdb8c('0x1')](_0x441373)){_0x2170cf[_0x441373]=_0x51416b[_0x441373];}}return _0x2170cf;}exports[_0xdb8c('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xd89c=['hasOwnProperty','assign'];(function(_0x59aaf5,_0x291604){var _0xffe40c=function(_0x4ab988){while(--_0x4ab988){_0x59aaf5['push'](_0x59aaf5['shift']());}};_0xffe40c(++_0x291604);}(_0xd89c,0x145));var _0xcd89=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd89c[_0xaa0309];return _0x5de7ce;};'use strict';function mergeDBDataToRealtime(_0x31c425,_0x4125fb){var _0x1be133=Object[_0xcd89('0x0')]({},_0x31c425);for(var _0x298606 in _0x4125fb){if(_0x1be133[_0xcd89('0x1')](_0x298606)){_0x1be133[_0x298606]=_0x4125fb[_0x298606];}}return _0x1be133;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 272b66a..174fc6e 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 _0xd75e=['assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType','channel','split','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','UserId','membername','monitorFilename','monitors','createdAt','xcally-motion-preview','connectedlinename','voiceAgentReport','isArray','forEach','Local','indexOf','mobile','phone','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','isNil','find','name','interface','format','SIP/%s','connectedlinenum'];(function(_0x445479,_0x5b3561){var _0x5e0d35=function(_0xe5af1a){while(--_0xe5af1a){_0x445479['push'](_0x445479['shift']());}};_0x5e0d35(++_0x5b3561);}(_0xd75e,0x143));var _0xed75=function(_0x185967,_0x29837f){_0x185967=_0x185967-0x0;var _0x367625=_0xd75e[_0x185967];return _0x367625;};'use strict';var _=require(_0xed75('0x0'));var moment=require(_0xed75('0x1'));var util=require(_0xed75('0x2'));var config=require(_0xed75('0x3'));var ami=require(_0xed75('0x4'));var RpcVoiceAgentReport=require(_0xed75('0x5'));var RpcVoiceCallReport=require(_0xed75('0x6'));var RpcVoiceDialReport=require(_0xed75('0x7'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xed75('0x8'));var RpcVoiceRecording=require(_0xed75('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xed75('0xa'));var VoiceCallReport=require(_0xed75('0xb'));var VoiceAgentReport=require(_0xed75('0xc'));var VoiceDialReport=require(_0xed75('0xd'));var UserReport=require('./userReport');function Report(_0x2472e5){this['realtime']=_0x2472e5;this[_0xed75('0xe')]=_0x2472e5[_0xed75('0xe')];this[_0xed75('0xf')]=_0x2472e5[_0xed75('0xf')];}Report[_0xed75('0x10')][_0xed75('0x11')]=function(_0x2e2e59){var _0xcf8c8d=new VoiceQueueReport(this[_0xed75('0x12')]);var _0x1c428e=new VoiceAgentReport(this[_0xed75('0x12')]);var _0x378776=new VoiceDialReport(this[_0xed75('0x12')]);var _0x23199a=new VoiceCallReport(this[_0xed75('0x12')]);var _0x243001=new UserReport(this[_0xed75('0x12')]);if(config[_0xed75('0x13')]&&config['xdr'][_0xed75('0x14')]){ami['on']('custom:voiceQueueReport',this[_0xed75('0x15')][_0xed75('0x16')](this));ami['on'](_0xed75('0x17'),this[_0xed75('0x18')][_0xed75('0x16')](this));ami['on'](_0xed75('0x19'),this['voiceAgentReport'][_0xed75('0x16')](this));ami['on'](_0xed75('0x1a'),this[_0xed75('0x1b')][_0xed75('0x16')](this));ami['on'](_0xed75('0x1c'),this[_0xed75('0x1d')][_0xed75('0x16')](this));ami['on'](_0xed75('0x1e'),this[_0xed75('0x1f')][_0xed75('0x16')](this));}};Report[_0xed75('0x10')][_0xed75('0x20')]=function(_0x27f102){var _0x37b927;_0x37b927=_['find'](this[_0xed75('0xe')],function(_0x3a9b17){return _0x3a9b17[_0xed75('0x21')]==_0x27f102||_0x3a9b17['name']==_0x27f102;});if(_[_0xed75('0x22')](_0x37b927)){var _0x215220=_[_0xed75('0x23')](this[_0xed75('0xf')],function(_0x136d23){return _0x136d23[_0xed75('0x21')]==_0x27f102||_0x136d23[_0xed75('0x24')]==_0x27f102;});if(_0x215220){_0x37b927=_[_0xed75('0x23')](this['agents'],function(_0x14a0a1){return _0x14a0a1[_0xed75('0x25')]==util[_0xed75('0x26')](_0xed75('0x27'),_0x215220[_0xed75('0x24')]);});}}return _0x37b927;};Report[_0xed75('0x10')]['voiceQueueReport']=function(_0x3119a9){for(var _0x5ba3c0=0x0;_0x5ba3c0<_0x3119a9['length'];_0x5ba3c0+=0x1){var _0x27a0de=this[_0xed75('0x20')](_0x3119a9[_0x5ba3c0][_0xed75('0x28')]);if(_0x27a0de){_0x3119a9[_0x5ba3c0][_0xed75('0x21')]=_0x27a0de[_0xed75('0x21')];_0x3119a9[_0x5ba3c0][_0xed75('0x29')]=!![];_0x3119a9[_0x5ba3c0][_0xed75('0x2a')]=_0x27a0de['name'];_0x3119a9[_0x5ba3c0]['interface']=_[_0xed75('0x22')](_0x27a0de[_0xed75('0x25')])?util[_0xed75('0x26')](_0xed75('0x27'),_0x27a0de['name']):_0x27a0de['interface'];if(_0x3119a9[_0x5ba3c0][_0xed75('0x2b')]){_0x3119a9[_0x5ba3c0][_0xed75('0x2c')]=moment()[_0xed75('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3119a9[_0x5ba3c0][_0xed75('0x2d')]){_0x3119a9[_0x5ba3c0][_0xed75('0x2e')]=moment()[_0xed75('0x26')](_0xed75('0x2f'));}RpcMemberReport['voiceQueueReport'](_0x3119a9[_0x5ba3c0]);}RpcVoiceQueueReport[_0xed75('0x30')](_0x3119a9[_0x5ba3c0]);}};function extractCalleridNumber(_0x66f939){var _0x1b1d5a=_0x66f939[_0xed75('0x31')](/<(.*?)>/);return _0x1b1d5a?_0x1b1d5a[0x1]:_0x66f939;}Report[_0xed75('0x10')][_0xed75('0x32')]=function(_0x3dbf89){for(var _0x48ad3e=0x0;_0x48ad3e/);return _0x14c553?_0x14c553[0x1]:_0x4c4d78;}Report[_0x0520('0xc')][_0x0520('0x2b')]=function(_0x5d6ad8){for(var _0x472a4a=0x0;_0x472a4a',_0x122857[_0x0520('0x3f')],_0x122857['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x122857[_0x0520('0x40')]]){var _0x130e5d=RpcVoiceTransferReport[_0x0520('0x41')][_0x122857[_0x0520('0x40')]];_0x130e5d['transfereelinkedid']=_0x122857['uniqueid'];RpcVoiceTransferReport['blindTransfer'](_0x130e5d);delete RpcVoiceTransferReport[_0x0520('0x41')][_0x122857[_0x0520('0x40')]];}if(_[_0x0520('0x1d')](_0x122857[_0x0520('0x32')])){_0x122857[_0x0520('0x32')]=this[_0x0520('0x2d')](_0x122857);}if(_[_0x0520('0x1d')](_0x122857[_0x0520('0x42')])){var _0x3e709a=_0x122857[_0x0520('0x2e')][_0x0520('0x43')]('-')[0x0];var _0x58b6f6=this[_0x0520('0xa')][_0x3e709a];if(!_0x58b6f6)_0x58b6f6=this[_0x0520('0x2b')](_0x122857[_0x0520('0x1e')]);if(_0x58b6f6){_0x122857[_0x0520('0x42')]=_0x58b6f6['id'];_0x122857[_0x0520('0x44')]=_0x58b6f6['name'];}}RpcVoiceCallReport[_0x0520('0x29')](_0x122857);if(_0x122857[_0x0520('0x45')]){for(var _0x3e70ac=0x0;_0x3e70ac<_0x122857[_0x0520('0x46')][_0x0520('0x21')];_0x3e70ac+=0x1){_0x122857['monitorFilename']=_0x122857[_0x0520('0x46')][_0x3e70ac][_0x0520('0x47')];_0x122857[_0x0520('0x48')]=_0x122857[_0x0520('0x46')][_0x3e70ac][_0x0520('0x48')];if(_0x122857[_0x0520('0x31')]=='xcally-motion-preview'){_0x122857[_0x0520('0x2f')]=_0x122857[_0x0520('0x22')];_0x122857['calleridname']=_0x122857[_0x0520('0x49')];_0x122857[_0x0520('0x22')]=_0x122857['accountcode'];_0x122857[_0x0520('0x49')]=_0x122857[_0x0520('0x44')];_0x122857[_0x0520('0x31')]=_0x122857[_0x0520('0x3c')];}else if(_0x122857[_0x0520('0x31')]==_0x0520('0x4a')){_0x122857[_0x0520('0x2f')]=_0x122857['destination'];_0x122857[_0x0520('0x31')]=_0x122857[_0x0520('0x3c')];}RpcVoiceRecording[_0x0520('0x29')](_0x122857);}}};Report[_0x0520('0xc')]['voiceAgentReport']=function(_0x1c6934){if(_['isArray'](_0x1c6934)){_0x1c6934[_0x0520('0x4b')](function(_0x601fd1){RpcVoiceAgentReport[_0x0520('0x29')](_0x601fd1);});}else{RpcVoiceAgentReport['create'](_0x1c6934);}};Report[_0x0520('0xc')][_0x0520('0x16')]=function(_0x658d47){RpcVoiceDialReport['create'](_0x658d47);var _0xe78709;var _0x52fdb3;var _0x4ab5f5=_0x658d47[_0x0520('0x2e')];if(_[_0x0520('0x4c')](_0x4ab5f5,'Local')){_0x52fdb3=_0x4ab5f5[_0x0520('0x4d')](_0x4ab5f5[_0x0520('0x4e')]('/')+0x1,_0x4ab5f5[_0x0520('0x4e')]('@'));_0xe78709=_[_0x0520('0x1b')](this[_0x0520('0xa')],function(_0x2ede82){return _0x2ede82[_0x0520('0x4f')]==_0x52fdb3||_0x2ede82[_0x0520('0x50')]==_0x52fdb3||_0x2ede82['accountcode']==_0x52fdb3;});}else{_0x52fdb3=_0x4ab5f5['substring'](_0x4ab5f5['indexOf']('/')+0x1,_0x4ab5f5[_0x0520('0x51')]('-'));_0xe78709=this[_0x0520('0x1a')](_0x52fdb3);}if(_0xe78709){_0x658d47['interface']=_[_0x0520('0x1d')](_0xe78709[_0x0520('0x1f')])?util[_0x0520('0x20')](_0x0520('0x52'),_0xe78709[_0x0520('0x1c')]):_0xe78709[_0x0520('0x1f')];_0x658d47[_0x0520('0x44')]=_0xe78709[_0x0520('0x1c')];_0x658d47[_0x0520('0x1e')]=_0xe78709[_0x0520('0x1e')];RpcMemberReport['voiceDialReport'](_0x658d47);}};Report[_0x0520('0xc')]['blindTransfer']=function(_0x4ef4a3){RpcVoiceTransferReport['transfers'][_0x4ef4a3['transfererlinkedid']]=_0x4ef4a3;};Report[_0x0520('0xc')][_0x0520('0x19')]=function(_0x16684c){RpcVoiceTransferReport['attendedTransfer'](_0x16684c);};module[_0x0520('0x53')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 0671fe1..9c1e279 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 _0x83d2=['bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','inspect','actionSipPeerStatus','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','info','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','local','toNumber','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','substring','indexOf','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','telephone:save','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','registryentry'];(function(_0x1f106f,_0x199d23){var _0x2ecd94=function(_0x276ae0){while(--_0x276ae0){_0x1f106f['push'](_0x1f106f['shift']());}};_0x2ecd94(++_0x199d23);}(_0x83d2,0x1e3));var _0x283d=function(_0x45ed6e,_0x249f3b){_0x45ed6e=_0x45ed6e-0x0;var _0x436a79=_0x83d2[_0x45ed6e];return _0x436a79;};'use strict';var _=require(_0x283d('0x0'));var moment=require(_0x283d('0x1'));var util=require(_0x283d('0x2'));var Redis=require(_0x283d('0x3'));var BPromise=require('bluebird');var config=require(_0x283d('0x4'));var logger=require(_0x283d('0x5'))(_0x283d('0x6'));var ami=require(_0x283d('0x7'));config[_0x283d('0x8')]=_['defaults'](config[_0x283d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x283d('0x9'))(new Redis(config[_0x283d('0x8')]));function UserReport(_0x45517b){this[_0x283d('0xa')]=_0x45517b['trunks'];this[_0x283d('0xb')]=_0x45517b[_0x283d('0xb')];this[_0x283d('0xc')]=_0x45517b[_0x283d('0xc')];ami['on'](_0x283d('0xd'),this['syncRegistry'][_0x283d('0xe')](this));ami['on'](_0x283d('0xf'),this['syncRegistry'][_0x283d('0xe')](this));ami['on'](_0x283d('0x10'),this[_0x283d('0x11')][_0x283d('0xe')](this));ami['on'](_0x283d('0x12'),this[_0x283d('0x13')][_0x283d('0xe')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x283d('0x14')]()[_0x283d('0x15')](ami[_0x283d('0x16')]())[_0x283d('0x17')](function(_0x17a8ef){logger[_0x283d('0x18')](_0x283d('0x19'),util['inspect'](_0x17a8ef,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x283d('0x14')]()['then'](ami[_0x283d('0x1a')]())[_0x283d('0x17')](function(_0x4420ec){logger['error']('[userReport][devicestatelist]',util[_0x283d('0x1b')](_0x4420ec,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x283d('0x14')]()[_0x283d('0x15')](ami[_0x283d('0x1c')]())[_0x283d('0x17')](function(_0x49c59f){logger[_0x283d('0x18')]('[userReport][sippeerstatus]',util[_0x283d('0x1b')](_0x49c59f,{'showHidden':![],'depth':null}));});}UserReport[_0x283d('0x1d')][_0x283d('0x1e')]=function(){setInterval(function(){BPromise[_0x283d('0x14')]()[_0x283d('0x15')](showSipRegistrations())[_0x283d('0x15')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x283d('0x1d')][_0x283d('0x1f')]=function(_0x52ed17){return _0x52ed17!==null&&!_[_0x283d('0x20')](_0x52ed17);};UserReport['prototype']['emit']=function(_0x1c53a0,_0x1368fe,_0x154a7d){io['to'](_0x1c53a0)[_0x283d('0x21')](_0x1368fe,_0x154a7d);};UserReport['prototype']['syncRegistry']=function(_0x2875e5){try{if(this[_0x283d('0x1f')](_0x2875e5)){logger[_0x283d('0x22')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x2875e5[_0x283d('0x23')],_0x2875e5[_0x283d('0x24')]);logger[_0x283d('0x25')](_0x283d('0x26'),util[_0x283d('0x1b')](_0x2875e5,{'showHidden':![],'depth':null}));var _0x4037ac=_[_0x283d('0x27')](this[_0x283d('0xa')],{'defaultuser':_0x2875e5[_0x283d('0x23')]});if(_0x4037ac){_0x2875e5[_0x283d('0x28')]=_0x2875e5[_0x283d('0x24')];_[_0x283d('0x29')](_0x4037ac,_[_0x283d('0x2a')](_0x2875e5,['event','actionid','username','state']));logger[_0x283d('0x25')](_0x283d('0x2b'),util[_0x283d('0x1b')](_0x4037ac,{'showHidden':![],'depth':null}));this[_0x283d('0x21')](util[_0x283d('0x2c')](_0x283d('0x2d'),_0x4037ac[_0x283d('0x2e')]),_0x283d('0x2f'),_0x4037ac);}}}catch(_0x48e35f){logger['error']('[userReport][registry]',util[_0x283d('0x1b')](_0x48e35f,{'showHidden':![],'depth':null}));}};UserReport[_0x283d('0x1d')][_0x283d('0x11')]=function(_0x1cacec){try{if(this[_0x283d('0x1f')](_0x1cacec)){logger[_0x283d('0x22')](_0x283d('0x30'),_0x1cacec[_0x283d('0x31')],_0x1cacec[_0x283d('0x24')]);logger['debug'](_0x283d('0x32'),util[_0x283d('0x1b')](_0x1cacec,{'showHidden':![],'depth':null}));if(this[_0x283d('0xb')][_0x1cacec[_0x283d('0x31')]]){if(!this[_0x283d('0xb')][_0x1cacec[_0x283d('0x31')]]['local']||_0x1cacec[_0x283d('0x24')][_0x283d('0x33')]()=='inuse'){this[_0x283d('0xb')][_0x1cacec[_0x283d('0x31')]][_0x283d('0x34')]=![];if(this[_0x283d('0xb')][_0x1cacec[_0x283d('0x31')]]['state']!==_0x1cacec[_0x283d('0x24')]['toLowerCase']()){this[_0x283d('0xb')][_0x1cacec[_0x283d('0x31')]]['stateTime']=_[_0x283d('0x35')](moment()[_0x283d('0x2c')]('x'));}this[_0x283d('0xb')][_0x1cacec[_0x283d('0x31')]][_0x283d('0x24')]=_0x1cacec[_0x283d('0x24')][_0x283d('0x33')]();this[_0x283d('0xb')][_0x1cacec[_0x283d('0x31')]][_0x283d('0x36')](_0x1cacec);}}else if(this['telephones'][_0x1cacec[_0x283d('0x31')]]){if(this[_0x283d('0xc')][_0x1cacec['device']][_0x283d('0x24')]!==_0x1cacec['state'][_0x283d('0x33')]()){this[_0x283d('0xc')][_0x1cacec['device']][_0x283d('0x37')]=_[_0x283d('0x35')](moment()['format']('x'));}this[_0x283d('0xc')][_0x1cacec[_0x283d('0x31')]][_0x283d('0x24')]=_0x1cacec[_0x283d('0x24')][_0x283d('0x33')]();logger[_0x283d('0x25')](_0x283d('0x38'),util['inspect'](this[_0x283d('0xc')][_0x1cacec[_0x283d('0x31')]],{'showHidden':![],'depth':null}));this[_0x283d('0x21')](util['format'](_0x283d('0x39'),this[_0x283d('0xc')][_0x1cacec[_0x283d('0x31')]][_0x283d('0x2e')]),'telephone:save',this[_0x283d('0xc')][_0x1cacec[_0x283d('0x31')]]);}else if(this['trunks'][_0x1cacec['device']]){if(this['trunks'][_0x1cacec[_0x283d('0x31')]][_0x283d('0x24')]!==_0x1cacec['state'][_0x283d('0x33')]()){this[_0x283d('0xa')][_0x1cacec['device']]['stateTime']=_[_0x283d('0x35')](moment()[_0x283d('0x2c')]('x'));}this[_0x283d('0xa')][_0x1cacec[_0x283d('0x31')]][_0x283d('0x24')]=_0x1cacec[_0x283d('0x24')]['toLowerCase']();logger[_0x283d('0x25')](_0x283d('0x3a'),util[_0x283d('0x1b')](this[_0x283d('0xa')][_0x1cacec[_0x283d('0x31')]],{'showHidden':![],'depth':null}));this[_0x283d('0x21')](util[_0x283d('0x2c')](_0x283d('0x2d'),this[_0x283d('0xa')][_0x1cacec[_0x283d('0x31')]][_0x283d('0x2e')]),'trunk:save',this[_0x283d('0xa')][_0x1cacec['device']]);}else if(_['startsWith'](_0x1cacec[_0x283d('0x31')],'Local')){var _0x116696=_0x1cacec[_0x283d('0x31')];var _0x350534=_0x116696[_0x283d('0x3b')](_0x116696[_0x283d('0x3c')]('/')+0x1,_0x116696[_0x283d('0x3c')]('@'));var _0x574465=_[_0x283d('0x27')](this['agents'],function(_0x2e7da5){return _0x2e7da5['mobile']==_0x350534||_0x2e7da5[_0x283d('0x3d')]==_0x350534||_0x2e7da5[_0x283d('0x3e')]==_0x350534;});if(_0x574465){if(_0x574465[_0x283d('0x24')]!==_0x1cacec['state'][_0x283d('0x33')]()){_0x574465[_0x283d('0x37')]=_[_0x283d('0x35')](moment()[_0x283d('0x2c')]('x'));}_0x574465[_0x283d('0x24')]=_0x1cacec[_0x283d('0x24')][_0x283d('0x33')]();_0x574465[_0x283d('0x34')]=!![];_0x574465[_0x283d('0x36')](_0x1cacec);}}}}catch(_0x120ea2){logger['error'](_0x283d('0x32'),util[_0x283d('0x1b')](_0x120ea2,{'showHidden':![],'depth':null}));}};UserReport[_0x283d('0x1d')]['syncPeerStatus']=function(_0x1a82bf){try{if(this[_0x283d('0x1f')](_0x1a82bf)&&this[_0x283d('0x1f')](_0x1a82bf[_0x283d('0x12')])){logger['info'](_0x283d('0x3f'),_0x1a82bf[_0x283d('0x40')],_0x1a82bf['address'],_0x1a82bf['peerstatus']);logger[_0x283d('0x25')](_0x283d('0x41'),util[_0x283d('0x1b')](_0x1a82bf,{'showHidden':![],'depth':null}));if(this[_0x283d('0xb')][_0x1a82bf['peer']]){if(!this[_0x283d('0xb')][_0x1a82bf[_0x283d('0x40')]][_0x283d('0x34')]||_0x1a82bf[_0x283d('0x12')][_0x283d('0x33')]()==_0x283d('0x42')){this[_0x283d('0xb')][_0x1a82bf['peer']][_0x283d('0x34')]=![];this[_0x283d('0xb')][_0x1a82bf['peer']][_0x283d('0x43')]=_0x1a82bf[_0x283d('0x12')][_0x283d('0x33')]();this[_0x283d('0xb')][_0x1a82bf[_0x283d('0x40')]][_0x283d('0x44')]=_0x1a82bf[_0x283d('0x44')];this['agents'][_0x1a82bf[_0x283d('0x40')]][_0x283d('0x36')](_0x1a82bf);}}else if(this[_0x283d('0xc')][_0x1a82bf[_0x283d('0x40')]]){this[_0x283d('0xc')][_0x1a82bf[_0x283d('0x40')]][_0x283d('0x43')]=_0x1a82bf[_0x283d('0x12')]['toLowerCase']();this[_0x283d('0xc')][_0x1a82bf[_0x283d('0x40')]][_0x283d('0x44')]=_0x1a82bf[_0x283d('0x44')];logger[_0x283d('0x25')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x283d('0xc')][_0x1a82bf[_0x283d('0x40')]],{'showHidden':![],'depth':null}));this[_0x283d('0x21')](util[_0x283d('0x2c')]('telephone:%s',this[_0x283d('0xc')][_0x1a82bf[_0x283d('0x40')]]['name']),_0x283d('0x45'),this[_0x283d('0xc')][_0x1a82bf['peer']]);}else if(this['trunks'][_0x1a82bf[_0x283d('0x40')]]){this['trunks'][_0x1a82bf[_0x283d('0x40')]][_0x283d('0x43')]=_0x1a82bf[_0x283d('0x12')][_0x283d('0x33')]();this[_0x283d('0xa')][_0x1a82bf[_0x283d('0x40')]][_0x283d('0x44')]=_0x1a82bf['address'];logger[_0x283d('0x25')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x283d('0x1b')](this[_0x283d('0xa')][_0x1a82bf[_0x283d('0x40')]],{'showHidden':![],'depth':null}));this[_0x283d('0x21')](util[_0x283d('0x2c')](_0x283d('0x2d'),this[_0x283d('0xa')][_0x1a82bf[_0x283d('0x40')]][_0x283d('0x2e')]),_0x283d('0x2f'),this[_0x283d('0xa')][_0x1a82bf[_0x283d('0x40')]]);}}}catch(_0x5911af){logger[_0x283d('0x18')](_0x283d('0x41'),util['inspect'](_0x5911af,{'showHidden':![],'depth':null}));}};module[_0x283d('0x46')]=UserReport; \ No newline at end of file +var _0x3fce=['[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','Local','substring','indexOf','accountcode','address','[userReport][peerstatus]','peer','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','catch','error','[userReport][sipshowregistry]','inspect','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state'];(function(_0x5b05de,_0x441400){var _0x1dbd07=function(_0x2ebed2){while(--_0x2ebed2){_0x5b05de['push'](_0x5b05de['shift']());}};_0x1dbd07(++_0x441400);}(_0x3fce,0x191));var _0xe3fc=function(_0x54e333,_0x4ba478){_0x54e333=_0x54e333-0x0;var _0x47279e=_0x3fce[_0x54e333];return _0x47279e;};'use strict';var _=require(_0xe3fc('0x0'));var moment=require('moment');var util=require(_0xe3fc('0x1'));var Redis=require(_0xe3fc('0x2'));var BPromise=require(_0xe3fc('0x3'));var config=require(_0xe3fc('0x4'));var logger=require(_0xe3fc('0x5'))(_0xe3fc('0x6'));var ami=require(_0xe3fc('0x7'));config[_0xe3fc('0x8')]=_[_0xe3fc('0x9')](config[_0xe3fc('0x8')],{'host':_0xe3fc('0xa'),'port':0x18eb});var io=require(_0xe3fc('0xb'))(new Redis(config['redis']));function UserReport(_0x4ef0ff){this[_0xe3fc('0xc')]=_0x4ef0ff[_0xe3fc('0xc')];this[_0xe3fc('0xd')]=_0x4ef0ff['agents'];this['telephones']=_0x4ef0ff[_0xe3fc('0xe')];ami['on'](_0xe3fc('0xf'),this[_0xe3fc('0x10')]['bind'](this));ami['on']('registry',this['syncRegistry'][_0xe3fc('0x11')](this));ami['on'](_0xe3fc('0x12'),this[_0xe3fc('0x13')][_0xe3fc('0x11')](this));ami['on'](_0xe3fc('0x14'),this[_0xe3fc('0x15')][_0xe3fc('0x11')](this));return this[_0xe3fc('0x16')]();}function showSipRegistrations(){Promise[_0xe3fc('0x17')]()[_0xe3fc('0x18')](ami['actionSipShowRegistry']())[_0xe3fc('0x19')](function(_0x3589c9){logger[_0xe3fc('0x1a')](_0xe3fc('0x1b'),util[_0xe3fc('0x1c')](_0x3589c9,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xe3fc('0x18')](ami['actionDeviceStateList']())[_0xe3fc('0x19')](function(_0x5ceb9f){logger[_0xe3fc('0x1a')]('[userReport][devicestatelist]',util[_0xe3fc('0x1c')](_0x5ceb9f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xe3fc('0x17')]()[_0xe3fc('0x18')](ami['actionSipPeerStatus']())[_0xe3fc('0x19')](function(_0x5d53fd){logger[_0xe3fc('0x1a')]('[userReport][sippeerstatus]',util[_0xe3fc('0x1c')](_0x5d53fd,{'showHidden':![],'depth':null}));});}UserReport[_0xe3fc('0x1d')][_0xe3fc('0x16')]=function(){setInterval(function(){BPromise['resolve']()[_0xe3fc('0x18')](showSipRegistrations())[_0xe3fc('0x18')](listDeviceStates())[_0xe3fc('0x18')](showPeersStatus());},0x32c8);};UserReport[_0xe3fc('0x1d')][_0xe3fc('0x1e')]=function(_0x5e6f6a){return _0x5e6f6a!==null&&!_[_0xe3fc('0x1f')](_0x5e6f6a);};UserReport[_0xe3fc('0x1d')][_0xe3fc('0x20')]=function(_0x502161,_0xcba10d,_0x505645){io['to'](_0x502161)[_0xe3fc('0x20')](_0xcba10d,_0x505645);};UserReport['prototype'][_0xe3fc('0x10')]=function(_0x3f5c5f){try{if(this[_0xe3fc('0x1e')](_0x3f5c5f)){logger[_0xe3fc('0x21')](_0xe3fc('0x22'),_0x3f5c5f[_0xe3fc('0x23')],_0x3f5c5f[_0xe3fc('0x24')]);logger['debug'](_0xe3fc('0x25'),util[_0xe3fc('0x1c')](_0x3f5c5f,{'showHidden':![],'depth':null}));var _0x4b4320=_[_0xe3fc('0x26')](this[_0xe3fc('0xc')],{'defaultuser':_0x3f5c5f[_0xe3fc('0x23')]});if(_0x4b4320){_0x3f5c5f[_0xe3fc('0x27')]=_0x3f5c5f[_0xe3fc('0x24')];_[_0xe3fc('0x28')](_0x4b4320,_[_0xe3fc('0x29')](_0x3f5c5f,[_0xe3fc('0x2a'),_0xe3fc('0x2b'),_0xe3fc('0x23'),'state']));logger[_0xe3fc('0x2c')](_0xe3fc('0x2d'),util[_0xe3fc('0x1c')](_0x4b4320,{'showHidden':![],'depth':null}));this[_0xe3fc('0x20')](util[_0xe3fc('0x2e')](_0xe3fc('0x2f'),_0x4b4320[_0xe3fc('0x30')]),'trunk:save',_0x4b4320);}}}catch(_0x1a9e04){logger[_0xe3fc('0x1a')]('[userReport][registry]',util[_0xe3fc('0x1c')](_0x1a9e04,{'showHidden':![],'depth':null}));}};UserReport[_0xe3fc('0x1d')]['syncDeviceState']=function(_0x5a0001){try{if(this[_0xe3fc('0x1e')](_0x5a0001)){logger[_0xe3fc('0x21')](_0xe3fc('0x31'),_0x5a0001[_0xe3fc('0x32')],_0x5a0001[_0xe3fc('0x24')]);logger[_0xe3fc('0x2c')](_0xe3fc('0x33'),util[_0xe3fc('0x1c')](_0x5a0001,{'showHidden':![],'depth':null}));if(this[_0xe3fc('0xd')][_0x5a0001[_0xe3fc('0x32')]]){if(!this[_0xe3fc('0xd')][_0x5a0001[_0xe3fc('0x32')]]['local']||_0x5a0001[_0xe3fc('0x24')][_0xe3fc('0x34')]()==_0xe3fc('0x35')){this[_0xe3fc('0xd')][_0x5a0001[_0xe3fc('0x32')]][_0xe3fc('0x36')]=![];if(this[_0xe3fc('0xd')][_0x5a0001['device']][_0xe3fc('0x24')]!==_0x5a0001[_0xe3fc('0x24')][_0xe3fc('0x34')]()){this[_0xe3fc('0xd')][_0x5a0001['device']][_0xe3fc('0x37')]=_[_0xe3fc('0x38')](moment()[_0xe3fc('0x2e')]('x'));}this['agents'][_0x5a0001[_0xe3fc('0x32')]][_0xe3fc('0x24')]=_0x5a0001[_0xe3fc('0x24')][_0xe3fc('0x34')]();this[_0xe3fc('0xd')][_0x5a0001['device']][_0xe3fc('0x39')](_0x5a0001);}}else if(this[_0xe3fc('0xe')][_0x5a0001[_0xe3fc('0x32')]]){if(this[_0xe3fc('0xe')][_0x5a0001[_0xe3fc('0x32')]][_0xe3fc('0x24')]!==_0x5a0001[_0xe3fc('0x24')][_0xe3fc('0x34')]()){this['telephones'][_0x5a0001[_0xe3fc('0x32')]]['stateTime']=_[_0xe3fc('0x38')](moment()[_0xe3fc('0x2e')]('x'));}this[_0xe3fc('0xe')][_0x5a0001[_0xe3fc('0x32')]][_0xe3fc('0x24')]=_0x5a0001[_0xe3fc('0x24')][_0xe3fc('0x34')]();logger[_0xe3fc('0x2c')](_0xe3fc('0x3a'),util['inspect'](this[_0xe3fc('0xe')][_0x5a0001['device']],{'showHidden':![],'depth':null}));this[_0xe3fc('0x20')](util[_0xe3fc('0x2e')]('telephone:%s',this[_0xe3fc('0xe')][_0x5a0001['device']]['name']),'telephone:save',this['telephones'][_0x5a0001['device']]);}else if(this[_0xe3fc('0xc')][_0x5a0001[_0xe3fc('0x32')]]){if(this[_0xe3fc('0xc')][_0x5a0001[_0xe3fc('0x32')]][_0xe3fc('0x24')]!==_0x5a0001[_0xe3fc('0x24')]['toLowerCase']()){this[_0xe3fc('0xc')][_0x5a0001[_0xe3fc('0x32')]][_0xe3fc('0x37')]=_[_0xe3fc('0x38')](moment()[_0xe3fc('0x2e')]('x'));}this[_0xe3fc('0xc')][_0x5a0001[_0xe3fc('0x32')]]['state']=_0x5a0001[_0xe3fc('0x24')][_0xe3fc('0x34')]();logger[_0xe3fc('0x2c')](_0xe3fc('0x3b'),util[_0xe3fc('0x1c')](this['trunks'][_0x5a0001[_0xe3fc('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xe3fc('0x2e')]('trunk:%s',this[_0xe3fc('0xc')][_0x5a0001['device']][_0xe3fc('0x30')]),_0xe3fc('0x3c'),this['trunks'][_0x5a0001[_0xe3fc('0x32')]]);}else if(_['startsWith'](_0x5a0001['device'],_0xe3fc('0x3d'))){var _0x3426a3=_0x5a0001['device'];var _0x3c8aae=_0x3426a3[_0xe3fc('0x3e')](_0x3426a3[_0xe3fc('0x3f')]('/')+0x1,_0x3426a3['indexOf']('@'));var _0xc70fdb=_[_0xe3fc('0x26')](this[_0xe3fc('0xd')],function(_0x54bfda){return _0x54bfda['mobile']==_0x3c8aae||_0x54bfda['phone']==_0x3c8aae||_0x54bfda[_0xe3fc('0x40')]==_0x3c8aae;});if(_0xc70fdb){if(_0xc70fdb['state']!==_0x5a0001[_0xe3fc('0x24')][_0xe3fc('0x34')]()){_0xc70fdb['stateTime']=_[_0xe3fc('0x38')](moment()['format']('x'));}_0xc70fdb['state']=_0x5a0001[_0xe3fc('0x24')][_0xe3fc('0x34')]();_0xc70fdb[_0xe3fc('0x36')]=!![];_0xc70fdb['updateStatusRealtime'](_0x5a0001);}}}}catch(_0x1d3ffe){logger[_0xe3fc('0x1a')](_0xe3fc('0x33'),util['inspect'](_0x1d3ffe,{'showHidden':![],'depth':null}));}};UserReport[_0xe3fc('0x1d')][_0xe3fc('0x15')]=function(_0x583a33){try{if(this[_0xe3fc('0x1e')](_0x583a33)&&this[_0xe3fc('0x1e')](_0x583a33[_0xe3fc('0x14')])){logger[_0xe3fc('0x21')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x583a33['peer'],_0x583a33[_0xe3fc('0x41')],_0x583a33[_0xe3fc('0x14')]);logger[_0xe3fc('0x2c')](_0xe3fc('0x42'),util[_0xe3fc('0x1c')](_0x583a33,{'showHidden':![],'depth':null}));if(this[_0xe3fc('0xd')][_0x583a33[_0xe3fc('0x43')]]){if(!this['agents'][_0x583a33['peer']]['local']||_0x583a33[_0xe3fc('0x14')]['toLowerCase']()=='registered'){this[_0xe3fc('0xd')][_0x583a33[_0xe3fc('0x43')]]['local']=![];this[_0xe3fc('0xd')][_0x583a33['peer']][_0xe3fc('0x44')]=_0x583a33[_0xe3fc('0x14')]['toLowerCase']();this[_0xe3fc('0xd')][_0x583a33[_0xe3fc('0x43')]][_0xe3fc('0x41')]=_0x583a33[_0xe3fc('0x41')];this['agents'][_0x583a33['peer']][_0xe3fc('0x39')](_0x583a33);}}else if(this[_0xe3fc('0xe')][_0x583a33[_0xe3fc('0x43')]]){this[_0xe3fc('0xe')][_0x583a33[_0xe3fc('0x43')]][_0xe3fc('0x44')]=_0x583a33[_0xe3fc('0x14')]['toLowerCase']();this[_0xe3fc('0xe')][_0x583a33[_0xe3fc('0x43')]][_0xe3fc('0x41')]=_0x583a33['address'];logger[_0xe3fc('0x2c')](_0xe3fc('0x45'),util['inspect'](this[_0xe3fc('0xe')][_0x583a33[_0xe3fc('0x43')]],{'showHidden':![],'depth':null}));this[_0xe3fc('0x20')](util[_0xe3fc('0x2e')](_0xe3fc('0x46'),this['telephones'][_0x583a33[_0xe3fc('0x43')]][_0xe3fc('0x30')]),'telephone:save',this[_0xe3fc('0xe')][_0x583a33['peer']]);}else if(this['trunks'][_0x583a33['peer']]){this['trunks'][_0x583a33['peer']][_0xe3fc('0x44')]=_0x583a33[_0xe3fc('0x14')][_0xe3fc('0x34')]();this['trunks'][_0x583a33[_0xe3fc('0x43')]][_0xe3fc('0x41')]=_0x583a33[_0xe3fc('0x41')];logger['debug'](_0xe3fc('0x47'),util[_0xe3fc('0x1c')](this[_0xe3fc('0xc')][_0x583a33['peer']],{'showHidden':![],'depth':null}));this[_0xe3fc('0x20')](util['format'](_0xe3fc('0x2f'),this[_0xe3fc('0xc')][_0x583a33[_0xe3fc('0x43')]]['name']),_0xe3fc('0x3c'),this[_0xe3fc('0xc')][_0x583a33[_0xe3fc('0x43')]]);}}}catch(_0x32c081){logger[_0xe3fc('0x1a')](_0xe3fc('0x42'),util[_0xe3fc('0x1c')](_0x32c081,{'showHidden':![],'depth':null}));}};module[_0xe3fc('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 268c9a5..3d72f79 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 _0xd88b=['hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','agents','interface','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','debug','custom:agentcalled','calleridnum','queue','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','membername','user:called','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','routealias','merge','pick','accountcode','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','error','[%s][voiceAgentReport][agentconnect]','rejected','name','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','talktime','acw','acwTimeout','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','onhold','[%s][voiceAgentReport][musiconholdstop]','lodash','util','../../../config/environment','../../../config/logger','defaults','redis','localhost','channels','voiceChannels','voiceQueues','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xd88b,0x1c0));var _0xbd88=function(_0x34a98d,_0x469653){_0x34a98d=_0x34a98d-0x0;var _0x4b3042=_0xd88b[_0x34a98d];return _0x4b3042;};'use strict';var _=require(_0xbd88('0x0'));var moment=require('moment');var util=require(_0xbd88('0x1'));var Redis=require('ioredis');var config=require(_0xbd88('0x2'));var logger=require(_0xbd88('0x3'))('ami');var ami=require('../ami');config['redis']=_[_0xbd88('0x4')](config[_0xbd88('0x5')],{'host':_0xbd88('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd88('0x5')]));function VoiceAgentReport(_0x3f692e){this[_0xbd88('0x7')]={};this[_0xbd88('0x8')]=_0x3f692e['channels'];this[_0xbd88('0x9')]=_0x3f692e[_0xbd88('0x9')];this['agents']=_0x3f692e['agents'];this[_0xbd88('0xa')]={};ami['on'](_0xbd88('0xb'),this[_0xbd88('0xc')][_0xbd88('0xd')](this));ami['on'](_0xbd88('0xe'),this[_0xbd88('0xf')][_0xbd88('0xd')](this));ami['on'](_0xbd88('0x10'),this[_0xbd88('0x11')][_0xbd88('0xd')](this));ami['on']('queuecallerabandon',this[_0xbd88('0x12')][_0xbd88('0xd')](this));ami['on'](_0xbd88('0x13'),this[_0xbd88('0x14')][_0xbd88('0xd')](this));ami['on'](_0xbd88('0x15'),this[_0xbd88('0x16')]['bind'](this));ami['on'](_0xbd88('0x17'),this[_0xbd88('0x18')][_0xbd88('0xd')](this));ami['on'](_0xbd88('0x19'),this[_0xbd88('0x1a')][_0xbd88('0xd')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xbd88('0xd')](this));ami['on'](_0xbd88('0x1b'),this[_0xbd88('0x1c')]['bind'](this));ami['on'](_0xbd88('0x1d'),this[_0xbd88('0x1e')][_0xbd88('0xd')](this));}VoiceAgentReport[_0xbd88('0x1f')][_0xbd88('0x20')]=function(_0x2d968d,_0x223bc5,_0x3d5c19){io['to'](_0x2d968d)['emit'](_0x223bc5,_0x3d5c19);};VoiceAgentReport[_0xbd88('0x1f')][_0xbd88('0x21')]=function(_0x44d380){return _0x44d380!==null&&!_[_0xbd88('0x22')](_0x44d380);};VoiceAgentReport[_0xbd88('0x1f')][_0xbd88('0xc')]=function(_0x992437){try{if(this[_0xbd88('0x21')](_0x992437)){logger['info'](_0xbd88('0x23'),_0x992437['uniqueid'],_0x992437['membername'],_0x992437[_0xbd88('0x24')]);logger['debug'](_0xbd88('0x25'),_0x992437[_0xbd88('0x26')],util[_0xbd88('0x27')](_0x992437,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x992437[_0xbd88('0x26')]])){this[_0xbd88('0x7')][_0x992437[_0xbd88('0x26')]]={};}var _0x4bdb56=this[_0xbd88('0x28')][_0x992437[_0xbd88('0x29')]];var _0x128889=this[_0xbd88('0x7')][_0x992437[_0xbd88('0x26')]][_0x992437[_0xbd88('0x24')]];var _0x558788=this[_0xbd88('0x9')][_0x992437['queue']];var _0x32ee1a=this['variables'][_0x992437[_0xbd88('0x26')]];if(_[_0xbd88('0x22')](_0x128889)){_0x128889={'agentcalledAt':moment()['format'](_0xbd88('0x2a')),'lastevent':_0xbd88('0x2b'),'mandatoryDisposition':_0x558788&&_0x558788[_0xbd88('0x2c')]?_0x558788['mandatoryDisposition']:![],'type':_0x558788&&_0x558788[_0xbd88('0x2d')]?_0x558788[_0xbd88('0x2d')]:_0xbd88('0x2e'),'variables':_0x32ee1a,'motionChannel':_0xbd88('0x2f')};}Object[_0xbd88('0x30')](_0x128889,_[_0xbd88('0x31')](_0x992437,[_0xbd88('0x32'),'privilege']));this[_0xbd88('0x7')][_0x992437[_0xbd88('0x26')]][_0x992437['destuniqueid']]=_0x128889;logger[_0xbd88('0x33')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x992437['uniqueid'],util[_0xbd88('0x27')](_0x128889,{'showHidden':![],'depth':null}));ami[_0xbd88('0x20')](_0xbd88('0x34'),_0x128889);var _0x40e815={'id':_0x4bdb56['id'],'calleridnum':_0x128889[_0xbd88('0x35')],'queue':_0x128889[_0xbd88('0x36')],'variables':_0x128889[_0xbd88('0xa')],'uniqueid':_0x992437[_0xbd88('0x26')]};logger[_0xbd88('0x33')](_0xbd88('0x37'),_0x992437['uniqueid'],util[_0xbd88('0x27')](_0x40e815,{'showHidden':![],'depth':null}));this[_0xbd88('0x20')](util[_0xbd88('0x38')](_0xbd88('0x39'),_0x992437[_0xbd88('0x3a')]),_0xbd88('0x3b'),_0x40e815);}}catch(_0xde486f){logger['error'](_0xbd88('0x3c'),_0x992437[_0xbd88('0x26')],util[_0xbd88('0x27')](_0xde486f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd88('0x1f')]['syncAgentConnect']=function(_0x2671a8){try{if(this[_0xbd88('0x21')](_0x2671a8)){if(this[_0xbd88('0x7')][_0x2671a8['uniqueid']]){for(var _0x1b30a9 in this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]]){if(this[_0xbd88('0x7')][_0x2671a8['uniqueid']][_0xbd88('0x3d')](_0x1b30a9)){if(_0x2671a8[_0xbd88('0x24')]===_0x1b30a9){logger[_0xbd88('0x3e')](_0xbd88('0x3f'),_0x2671a8['uniqueid'],_0x2671a8[_0xbd88('0x3a')],_0x2671a8[_0xbd88('0x24')]);this['channels'][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x40')]=moment()[_0xbd88('0x38')](_0xbd88('0x2a'));this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x41')]=_0x2671a8[_0xbd88('0x41')];this[_0xbd88('0x7')][_0x2671a8['uniqueid']][_0x1b30a9][_0xbd88('0x42')]=_0x2671a8[_0xbd88('0x42')];this['channels'][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x43')]=_0x2671a8[_0xbd88('0x43')];this['channels'][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x44')]=_0x2671a8[_0xbd88('0x44')];this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x45')]=_0x2671a8[_0xbd88('0x45')];this[_0xbd88('0x7')][_0x2671a8['uniqueid']][_0x1b30a9][_0xbd88('0x46')]='connect';if(this[_0xbd88('0x8')][this[_0xbd88('0x7')][_0x2671a8['uniqueid']][_0x1b30a9][_0xbd88('0x26')]]){var _0x3f0788=this[_0xbd88('0x8')][this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x26')]][_0xbd88('0x47')];this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9]['routealias']=_0x3f0788;_0x2671a8[_0xbd88('0x47')]=_0x3f0788;}_[_0xbd88('0x48')](this['agents'][_0x2671a8[_0xbd88('0x29')]],_[_0xbd88('0x49')](_0x2671a8,[_0xbd88('0x36'),'destconnectedlinenum',_0xbd88('0x47')]));var _0x5ce18a=this[_0xbd88('0x28')][_0x2671a8[_0xbd88('0x29')]];var _0x5af834={'id':_0x5ce18a['id'],'name':_0x5ce18a['name'],'agentconnected':!![],'destaccountcode':_0x5ce18a[_0xbd88('0x4a')],'destconnectedlinenum':this['channels'][_0x2671a8[_0xbd88('0x26')]][_0x2671a8[_0xbd88('0x24')]][_0xbd88('0x4b')],'queue':this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x2671a8[_0xbd88('0x24')]][_0xbd88('0x36')],'routealias':this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x2671a8['destuniqueid']]['routealias'],'uniqueid':this['channels'][_0x2671a8[_0xbd88('0x26')]][_0x2671a8[_0xbd88('0x24')]][_0xbd88('0x26')]};ami[_0xbd88('0x20')](_0xbd88('0x4c'),this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x2671a8[_0xbd88('0x24')]]);this['emit'](util['format'](_0xbd88('0x39'),_0x2671a8[_0xbd88('0x3a')]),_0xbd88('0x4d'),_0x5af834);}else if(!this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x10')]&&!this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x13')]){logger[_0xbd88('0x3e')](_0xbd88('0x4e'),_0x2671a8[_0xbd88('0x26')],this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x3a')],_0x1b30a9);this['channels'][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x10')]=!![];this['channels'][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x4f')]=moment()[_0xbd88('0x38')](_0xbd88('0x2a'));this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9]['answeredelsewheredestinationuniqueid']=_0x2671a8[_0xbd88('0x24')];this['channels'][_0x2671a8['uniqueid']][_0x1b30a9][_0xbd88('0x50')]=_0x2671a8[_0xbd88('0x3a')];this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x46')]=_0xbd88('0x51');this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9][_0xbd88('0x52')]='answered_elsewhere';logger[_0xbd88('0x33')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x2671a8[_0xbd88('0x26')],util[_0xbd88('0x27')](this[_0xbd88('0x7')][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9],{'showHidden':![],'depth':null}));ami[_0xbd88('0x20')](_0xbd88('0x53'),this['channels'][_0x2671a8[_0xbd88('0x26')]][_0x1b30a9]);}else{logger[_0xbd88('0x33')](_0xbd88('0x54'),_0x2671a8['uniqueid']);}}}}}}catch(_0x3d930f){logger[_0xbd88('0x55')](_0xbd88('0x56'),_0x2671a8[_0xbd88('0x26')],util[_0xbd88('0x27')](_0x3d930f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd88('0x1f')][_0xbd88('0x11')]=function(_0x1f10ba){try{if(this[_0xbd88('0x21')](_0x1f10ba)){logger[_0xbd88('0x33')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x1f10ba['uniqueid'],util['inspect'](_0x1f10ba,{'showHidden':![],'depth':null}));if(this[_0xbd88('0x7')][_0x1f10ba[_0xbd88('0x26')]]&&this[_0xbd88('0x7')][_0x1f10ba[_0xbd88('0x26')]][_0x1f10ba[_0xbd88('0x24')]]){logger[_0xbd88('0x3e')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x1f10ba[_0xbd88('0x26')],_0x1f10ba[_0xbd88('0x3a')],_0x1f10ba['destuniqueid']);var _0x2fa595=this[_0xbd88('0x28')][_0x1f10ba[_0xbd88('0x29')]];var _0x1332fc=this[_0xbd88('0x7')][_0x1f10ba[_0xbd88('0x26')]][_0x1f10ba[_0xbd88('0x24')]];_0x1332fc['agentringnoanswer']=!![];_0x1332fc[_0xbd88('0x4f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1332fc['lastevent']=_0xbd88('0x57');_0x1332fc[_0xbd88('0x52')]=_0xbd88('0x57');var _0x56a077={'id':_0x2fa595['id'],'name':_0x2fa595[_0xbd88('0x58')],'queue':_0x1332fc[_0xbd88('0x36')],'uniqueid':_0x1332fc[_0xbd88('0x26')]};logger[_0xbd88('0x33')](_0xbd88('0x59'),_0x1f10ba['uniqueid'],util['inspect'](_0x56a077,{'showHidden':![],'depth':null}));this['emit'](util[_0xbd88('0x38')](_0xbd88('0x39'),_0x2fa595[_0xbd88('0x58')]),_0xbd88('0x5a'),_0x56a077);ami[_0xbd88('0x20')](_0xbd88('0x5b'),_0x1332fc);this[_0xbd88('0x7')][_0x1f10ba[_0xbd88('0x26')]][_0x1f10ba[_0xbd88('0x24')]]=Object['assign']({},_0x1332fc);}}}catch(_0x333320){logger[_0xbd88('0x55')](_0xbd88('0x5c'),_0x1f10ba['uniqueid'],util['inspect'](_0x333320,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd88('0x1f')][_0xbd88('0x12')]=function(_0x1d469d){try{if(this['isNotNull'](_0x1d469d)){logger[_0xbd88('0x33')](_0xbd88('0x5d'),_0x1d469d[_0xbd88('0x26')],util[_0xbd88('0x27')](_0x1d469d,{'showHidden':![],'depth':null}));if(this[_0xbd88('0x7')][_0x1d469d[_0xbd88('0x26')]]){for(var _0x5541b5 in this[_0xbd88('0x7')][_0x1d469d[_0xbd88('0x26')]]){if(this[_0xbd88('0x7')][_0x1d469d['uniqueid']][_0xbd88('0x3d')](_0x5541b5)&&!this[_0xbd88('0x7')][_0x1d469d[_0xbd88('0x26')]][_0x5541b5]['agentringnoanswer']&&!this[_0xbd88('0x7')][_0x1d469d[_0xbd88('0x26')]][_0x5541b5][_0xbd88('0x13')]){logger[_0xbd88('0x3e')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1d469d[_0xbd88('0x26')],this[_0xbd88('0x7')][_0x1d469d['uniqueid']][_0x5541b5][_0xbd88('0x3a')],_0x5541b5);this[_0xbd88('0x7')][_0x1d469d[_0xbd88('0x26')]][_0x5541b5][_0xbd88('0x10')]=!![];this[_0xbd88('0x7')][_0x1d469d[_0xbd88('0x26')]][_0x5541b5][_0xbd88('0x4f')]=moment()[_0xbd88('0x38')](_0xbd88('0x2a'));this[_0xbd88('0x7')][_0x1d469d[_0xbd88('0x26')]][_0x5541b5][_0xbd88('0x46')]='abandoned';this['channels'][_0x1d469d[_0xbd88('0x26')]][_0x5541b5][_0xbd88('0x52')]=_0xbd88('0x5e');logger[_0xbd88('0x33')](_0xbd88('0x5f'),_0x1d469d[_0xbd88('0x26')],util[_0xbd88('0x27')](this[_0xbd88('0x7')][_0x1d469d[_0xbd88('0x26')]][_0x5541b5],{'showHidden':![],'depth':null}));ami[_0xbd88('0x20')](_0xbd88('0x60'),this[_0xbd88('0x7')][_0x1d469d[_0xbd88('0x26')]][_0x5541b5]);}}}}}catch(_0x32db45){logger[_0xbd88('0x55')](_0xbd88('0x61'),_0x1d469d[_0xbd88('0x26')],util['inspect'](_0x32db45,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd88('0x1f')][_0xbd88('0x14')]=function(_0x5ea2d6){try{if(this[_0xbd88('0x21')](_0x5ea2d6)){logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x5ea2d6[_0xbd88('0x26')],util[_0xbd88('0x27')](_0x5ea2d6,{'showHidden':![],'depth':null}));if(this['channels'][_0x5ea2d6[_0xbd88('0x26')]]){for(var _0x44aa4d in this[_0xbd88('0x7')][_0x5ea2d6[_0xbd88('0x26')]]){if(this['channels'][_0x5ea2d6[_0xbd88('0x26')]][_0xbd88('0x3d')](_0x44aa4d)){if(this['channels'][_0x5ea2d6['uniqueid']][_0x44aa4d][_0xbd88('0x40')]&&!this[_0xbd88('0x7')][_0x5ea2d6[_0xbd88('0x26')]][_0x44aa4d]['agentcomplete']){logger[_0xbd88('0x3e')](_0xbd88('0x62'),_0x5ea2d6[_0xbd88('0x26')],this[_0xbd88('0x7')][_0x5ea2d6[_0xbd88('0x26')]][_0x44aa4d][_0xbd88('0x3a')],_0x44aa4d);this[_0xbd88('0x7')][_0x5ea2d6[_0xbd88('0x26')]][_0x44aa4d][_0xbd88('0x13')]=!![];this['channels'][_0x5ea2d6['uniqueid']][_0x44aa4d]['agentcompleteAt']=moment()[_0xbd88('0x38')](_0xbd88('0x2a'));this['channels'][_0x5ea2d6['uniqueid']][_0x44aa4d][_0xbd88('0x46')]='complete';this[_0xbd88('0x7')][_0x5ea2d6['uniqueid']][_0x44aa4d][_0xbd88('0x52')]=_0x5ea2d6[_0xbd88('0x52')]==_0xbd88('0x63')?'agent':_0x5ea2d6[_0xbd88('0x52')];this[_0xbd88('0x7')][_0x5ea2d6[_0xbd88('0x26')]][_0x44aa4d][_0xbd88('0x64')]=_0x5ea2d6['talktime'];if(this['voiceQueues'][_0x5ea2d6[_0xbd88('0x36')]]&&this[_0xbd88('0x9')][_0x5ea2d6['queue']][_0xbd88('0x65')]){this[_0xbd88('0x7')][_0x5ea2d6[_0xbd88('0x26')]][_0x44aa4d]['acwtime']=this[_0xbd88('0x9')][_0x5ea2d6[_0xbd88('0x36')]][_0xbd88('0x66')];this[_0xbd88('0x7')][_0x5ea2d6[_0xbd88('0x26')]][_0x44aa4d][_0xbd88('0x67')]=!![];}this[_0xbd88('0x28')][_0x5ea2d6[_0xbd88('0x29')]]=_['omit'](this[_0xbd88('0x28')][_0x5ea2d6[_0xbd88('0x29')]],['queue',_0xbd88('0x68')]);logger[_0xbd88('0x33')](_0xbd88('0x69'),_0x5ea2d6[_0xbd88('0x26')],util[_0xbd88('0x27')](this['channels'][_0x5ea2d6[_0xbd88('0x26')]][_0x44aa4d],{'showHidden':![],'depth':null}));ami['emit'](_0xbd88('0x6a'),this[_0xbd88('0x7')][_0x5ea2d6['uniqueid']][_0x44aa4d]);logger[_0xbd88('0x33')](_0xbd88('0x6b'),_0x5ea2d6[_0xbd88('0x26')],util['inspect']({'id':this[_0xbd88('0x28')][_0x5ea2d6[_0xbd88('0x29')]]['id'],'destaccountcode':_0x5ea2d6[_0xbd88('0x6c')]},{'showHidden':![],'depth':null}));this[_0xbd88('0x20')](util[_0xbd88('0x38')](_0xbd88('0x39'),_0x5ea2d6['membername']),_0xbd88('0x6d'),{'id':this[_0xbd88('0x28')][_0x5ea2d6['interface']]['id'],'destaccountcode':Number(_0x5ea2d6['destaccountcode'])});}}}}}}catch(_0x573c90){logger[_0xbd88('0x55')]('[%s][voiceAgentReport][agentcomplete]',_0x5ea2d6[_0xbd88('0x26')],util[_0xbd88('0x27')](_0x573c90,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd88('0x1f')]['syncVarSet']=function(_0x3fecd0){try{if(this[_0xbd88('0x21')](_0x3fecd0)){logger[_0xbd88('0x33')](_0xbd88('0x6e'),_0x3fecd0[_0xbd88('0x26')],util[_0xbd88('0x27')](_0x3fecd0,{'showHidden':![],'depth':null}));this[_0xbd88('0x6f')](_0x3fecd0[_0xbd88('0x26')],_['keys'](_0x3fecd0[_0xbd88('0x70')])[0x0],_0x3fecd0[_0xbd88('0x71')]);if(this[_0xbd88('0x7')][_0x3fecd0[_0xbd88('0x26')]]){for(var _0x5f58c7 in this[_0xbd88('0x7')][_0x3fecd0[_0xbd88('0x26')]]){if(this[_0xbd88('0x7')][_0x3fecd0[_0xbd88('0x26')]][_0xbd88('0x3d')](_0x5f58c7)){logger['info'](_0xbd88('0x72'),_0x3fecd0['uniqueid'],_0x5f58c7,_['keys'](_0x3fecd0[_0xbd88('0x70')])[0x0],_0x3fecd0[_0xbd88('0x71')]);if(_['isUndefined'](this[_0xbd88('0x7')][_0x3fecd0[_0xbd88('0x26')]][_0x5f58c7]['variables'])){this[_0xbd88('0x7')][_0x3fecd0[_0xbd88('0x26')]][_0x5f58c7][_0xbd88('0xa')]={};}this[_0xbd88('0x7')][_0x3fecd0[_0xbd88('0x26')]][_0x5f58c7][_0xbd88('0xa')]=this[_0xbd88('0xa')][_0x3fecd0['uniqueid']];}}}}}catch(_0x4c0e87){logger[_0xbd88('0x55')]('[%s][voiceAgentReport][varset]',_0x3fecd0[_0xbd88('0x26')],util[_0xbd88('0x27')](_0x4c0e87,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xbd88('0x6f')]=function(_0x4ab645,_0x1ebb02,_0xf872f6){var _0x528f68=[_0xbd88('0x73'),'rtpaudioqosbridged',_0xbd88('0x74'),_0xbd88('0x75'),'rtpaudioqosloss',_0xbd88('0x76'),'rtpaudioqosrtt',_0xbd88('0x77'),'sipcallid',_0xbd88('0x78'),_0xbd88('0x79'),_0xbd88('0x7a'),_0xbd88('0x7b'),_0xbd88('0x7c'),_0xbd88('0x7d'),'memberlastcall',_0xbd88('0x3a'),_0xbd88('0x7e'),_0xbd88('0x7f')];if(!_[_0xbd88('0x80')](_0x1ebb02)&&!_[_0xbd88('0x81')](_0x528f68,_0x1ebb02)){if(_[_0xbd88('0x22')](this['variables'][_0x4ab645])){this[_0xbd88('0xa')][_0x4ab645]={};}this[_0xbd88('0xa')][_0x4ab645][_0x1ebb02]=_0xf872f6;}};VoiceAgentReport[_0xbd88('0x1f')][_0xbd88('0x18')]=function(_0x3cf20d){try{if(this[_0xbd88('0x21')](_0x3cf20d)){logger[_0xbd88('0x33')]('[%s][voiceAgentReport][hangup]\x20event:',_0x3cf20d[_0xbd88('0x26')],util[_0xbd88('0x27')](_0x3cf20d,{'showHidden':![],'depth':null}));if(this[_0xbd88('0x7')][_0x3cf20d['uniqueid']]){for(var _0x5a16ec in this[_0xbd88('0x7')][_0x3cf20d[_0xbd88('0x26')]]){if(this['channels'][_0x3cf20d[_0xbd88('0x26')]][_0xbd88('0x3d')](_0x5a16ec)){if(this['channels'][_0x3cf20d[_0xbd88('0x26')]][_0x5a16ec][_0xbd88('0x52')]==_0xbd88('0x63')&&this['channels'][_0x3cf20d[_0xbd88('0x26')]][_0x5a16ec][_0xbd88('0x13')]){logger[_0xbd88('0x3e')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x3cf20d[_0xbd88('0x26')],_0x5a16ec);this[_0xbd88('0x7')][_0x3cf20d['uniqueid']][_0x5a16ec][_0xbd88('0x82')]=moment()[_0xbd88('0x38')](_0xbd88('0x2a'));}}}logger[_0xbd88('0x33')](_0xbd88('0x83'),_0x3cf20d['uniqueid'],util[_0xbd88('0x27')](_[_0xbd88('0x84')](this['channels'][_0x3cf20d[_0xbd88('0x26')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xbd88('0x85'),_[_0xbd88('0x84')](this[_0xbd88('0x7')][_0x3cf20d['uniqueid']]));delete this['channels'][_0x3cf20d['uniqueid']];}if(this[_0xbd88('0xa')][_0x3cf20d[_0xbd88('0x26')]]){delete this['variables'][_0x3cf20d['uniqueid']];}}}catch(_0x1b4ab0){logger[_0xbd88('0x55')](_0xbd88('0x86'),_0x3cf20d[_0xbd88('0x26')],util[_0xbd88('0x27')](_0x1b4ab0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd88('0x1f')][_0xbd88('0x1c')]=function(_0x43e1d4){try{if(this[_0xbd88('0x21')](_0x43e1d4)){logger['debug'](_0xbd88('0x87'),_0x43e1d4['uniqueid'],util['inspect'](_0x43e1d4,{'showHidden':![],'depth':null}));if(this[_0xbd88('0x7')][_0x43e1d4['transfereeuniqueid']]){for(var _0x33a185 in this[_0xbd88('0x7')][_0x43e1d4[_0xbd88('0x88')]]){if(this['channels'][_0x43e1d4[_0xbd88('0x88')]][_0xbd88('0x3d')](_0x33a185)){if(_0x43e1d4[_0xbd88('0x89')]===_0x33a185){logger[_0xbd88('0x3e')](_0xbd88('0x8a'),_0x43e1d4['uniqueid'],this['channels'][_0x43e1d4[_0xbd88('0x88')]][_0x33a185][_0xbd88('0x3a')],_0x33a185);var _0x189017=moment();this[_0xbd88('0x7')][_0x43e1d4['transfereeuniqueid']][_0x33a185][_0xbd88('0x13')]=!![];this[_0xbd88('0x7')][_0x43e1d4[_0xbd88('0x88')]][_0x33a185][_0xbd88('0x82')]=moment()[_0xbd88('0x38')](_0xbd88('0x2a'));this[_0xbd88('0x7')][_0x43e1d4[_0xbd88('0x88')]][_0x33a185][_0xbd88('0x46')]=_0xbd88('0x8b');this['channels'][_0x43e1d4[_0xbd88('0x88')]][_0x33a185][_0xbd88('0x52')]=_0xbd88('0x63');this['channels'][_0x43e1d4['transfereeuniqueid']][_0x33a185][_0xbd88('0x64')]=_0x189017[_0xbd88('0x8c')](this['channels'][_0x43e1d4[_0xbd88('0x88')]][_0x33a185][_0xbd88('0x40')],_0xbd88('0x8d'));}}}}if(this[_0xbd88('0x7')][_0x43e1d4['secondtransfereruniqueid']]){var _0x504012=this['channels'][_0x43e1d4[_0xbd88('0x8e')]];this['channels'][_0x43e1d4['secondtransfereruniqueid']]=this[_0xbd88('0x7')][_0x43e1d4[_0xbd88('0x88')]];this[_0xbd88('0x7')][_0x43e1d4[_0xbd88('0x88')]]=_0x504012;}}}catch(_0x263e60){logger[_0xbd88('0x55')]('[%s][voiceAgentReport][attendedtransfer]',_0x43e1d4[_0xbd88('0x26')],util['inspect'](_0x263e60,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd88('0x1f')][_0xbd88('0x1e')]=function(_0x27e1a2){try{if(this[_0xbd88('0x21')](_0x27e1a2)){logger['debug'](_0xbd88('0x8f'),_0x27e1a2[_0xbd88('0x26')],util['inspect'](_0x27e1a2,{'showHidden':![],'depth':null}));if(this[_0xbd88('0x7')][_0x27e1a2[_0xbd88('0x88')]]){for(var _0x24b2d6 in this['channels'][_0x27e1a2[_0xbd88('0x88')]]){if(this[_0xbd88('0x7')][_0x27e1a2[_0xbd88('0x88')]]['hasOwnProperty'](_0x24b2d6)){if(_0x27e1a2[_0xbd88('0x90')]===_0x24b2d6){logger[_0xbd88('0x3e')](_0xbd88('0x91'),_0x27e1a2[_0xbd88('0x26')],this[_0xbd88('0x7')][_0x27e1a2['transfereeuniqueid']][_0x24b2d6][_0xbd88('0x3a')],_0x24b2d6);var _0x3eb7a0=moment();this['channels'][_0x27e1a2[_0xbd88('0x88')]][_0x24b2d6]['agentcomplete']=!![];this[_0xbd88('0x7')][_0x27e1a2['transfereeuniqueid']][_0x24b2d6]['agentcompleteAt']=_0x3eb7a0;this[_0xbd88('0x7')][_0x27e1a2[_0xbd88('0x88')]][_0x24b2d6][_0xbd88('0x46')]=_0xbd88('0x8b');this[_0xbd88('0x7')][_0x27e1a2[_0xbd88('0x88')]][_0x24b2d6]['reason']=_0xbd88('0x63');this[_0xbd88('0x7')][_0x27e1a2[_0xbd88('0x88')]][_0x24b2d6]['talktime']=_0x3eb7a0['diff'](this[_0xbd88('0x7')][_0x27e1a2[_0xbd88('0x88')]][_0x24b2d6][_0xbd88('0x40')],'seconds');}}}}}}catch(_0x2462ea){logger[_0xbd88('0x55')](_0xbd88('0x92'),_0x27e1a2[_0xbd88('0x26')],util[_0xbd88('0x27')](_0x2462ea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbd88('0x1f')]['syncMusicOnHoldStart']=function(_0x1ce71e){var _0x72967e='';try{if(this['isNotNull'](_0x1ce71e)){logger[_0xbd88('0x33')](_0xbd88('0x93'),_0x1ce71e[_0xbd88('0x26')],util['inspect'](_0x1ce71e,{'showHidden':![],'depth':null}));if(_0x1ce71e['channel']){_0x72967e=_0x1ce71e[_0xbd88('0x94')][_0xbd88('0x95')](0x0,_0x1ce71e[_0xbd88('0x94')][_0xbd88('0x96')]('-'));if(this[_0xbd88('0x28')][_0x72967e]){logger['info'](_0xbd88('0x97'),_0x1ce71e[_0xbd88('0x26')],_0x72967e);this['agents'][_0x72967e]['onhold']=!![];}}}}catch(_0x36c4d2){logger['error'](_0xbd88('0x98'),_0x1ce71e['uniqueid'],util[_0xbd88('0x27')](_0x36c4d2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xbd88('0x99')]=function(_0x2d6075){var _0x488d08='';try{if(this[_0xbd88('0x21')](_0x2d6075)){logger[_0xbd88('0x33')](_0xbd88('0x9a'),_0x2d6075[_0xbd88('0x26')],util['inspect'](_0x2d6075,{'showHidden':![],'depth':null}));if(_0x2d6075[_0xbd88('0x94')]){_0x488d08=_0x2d6075[_0xbd88('0x94')][_0xbd88('0x95')](0x0,_0x2d6075[_0xbd88('0x94')][_0xbd88('0x96')]('-'));if(this[_0xbd88('0x28')][_0x488d08]){logger['info']('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x2d6075[_0xbd88('0x26')],_0x488d08);this[_0xbd88('0x28')][_0x488d08][_0xbd88('0x9b')]=![];}}}}catch(_0xdce3a0){logger['error'](_0xbd88('0x9c'),_0x2d6075[_0xbd88('0x26')],util[_0xbd88('0x27')](_0xdce3a0,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xd2ce=['[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','inspect','queue','format','called','mandatoryDisposition','type','inbound','voice','omit','event','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','merge','interface','pick','destconnectedlinenum','name','accountcode','exten','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheremembername','lastevent','answered_elsewhere','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','assign','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','isUndefined','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:'];(function(_0x3065b5,_0x4f64ff){var _0x2c0deb=function(_0x4135c3){while(--_0x4135c3){_0x3065b5['push'](_0x3065b5['shift']());}};_0x2c0deb(++_0x4f64ff);}(_0xd2ce,0x1e8));var _0xed2c=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xd2ce[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xed2c('0x0'));var moment=require(_0xed2c('0x1'));var util=require(_0xed2c('0x2'));var Redis=require(_0xed2c('0x3'));var config=require(_0xed2c('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0xed2c('0x5'));config[_0xed2c('0x6')]=_['defaults'](config[_0xed2c('0x6')],{'host':_0xed2c('0x7'),'port':0x18eb});var io=require(_0xed2c('0x8'))(new Redis(config[_0xed2c('0x6')]));function VoiceAgentReport(_0x5d93c3){this[_0xed2c('0x9')]={};this['voiceChannels']=_0x5d93c3[_0xed2c('0x9')];this['voiceQueues']=_0x5d93c3[_0xed2c('0xa')];this[_0xed2c('0xb')]=_0x5d93c3[_0xed2c('0xb')];this[_0xed2c('0xc')]={};ami['on'](_0xed2c('0xd'),this[_0xed2c('0xe')][_0xed2c('0xf')](this));ami['on'](_0xed2c('0x10'),this[_0xed2c('0x11')][_0xed2c('0xf')](this));ami['on'](_0xed2c('0x12'),this[_0xed2c('0x13')][_0xed2c('0xf')](this));ami['on'](_0xed2c('0x14'),this[_0xed2c('0x15')][_0xed2c('0xf')](this));ami['on'](_0xed2c('0x16'),this[_0xed2c('0x17')][_0xed2c('0xf')](this));ami['on'](_0xed2c('0x18'),this[_0xed2c('0x19')][_0xed2c('0xf')](this));ami['on'](_0xed2c('0x1a'),this[_0xed2c('0x1b')][_0xed2c('0xf')](this));ami['on'](_0xed2c('0x1c'),this[_0xed2c('0x1d')][_0xed2c('0xf')](this));ami['on'](_0xed2c('0x1e'),this['syncMusicOnHoldStop'][_0xed2c('0xf')](this));ami['on'](_0xed2c('0x1f'),this[_0xed2c('0x20')][_0xed2c('0xf')](this));ami['on'](_0xed2c('0x21'),this[_0xed2c('0x22')][_0xed2c('0xf')](this));}VoiceAgentReport[_0xed2c('0x23')][_0xed2c('0x24')]=function(_0x39dca7,_0x771306,_0x36344c){io['to'](_0x39dca7)[_0xed2c('0x24')](_0x771306,_0x36344c);};VoiceAgentReport[_0xed2c('0x23')][_0xed2c('0x25')]=function(_0x252765){return _0x252765!==null&&!_['isUndefined'](_0x252765);};VoiceAgentReport[_0xed2c('0x23')]['syncAgentCalled']=function(_0x1b74f2){try{if(this['isNotNull'](_0x1b74f2)){logger[_0xed2c('0x26')](_0xed2c('0x27'),_0x1b74f2[_0xed2c('0x28')],_0x1b74f2[_0xed2c('0x29')],_0x1b74f2[_0xed2c('0x2a')]);logger[_0xed2c('0x2b')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x1b74f2[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0x1b74f2,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xed2c('0x9')][_0x1b74f2[_0xed2c('0x28')]])){this[_0xed2c('0x9')][_0x1b74f2[_0xed2c('0x28')]]={};}var _0x535ff0=this[_0xed2c('0xb')][_0x1b74f2['interface']];var _0x46bdeb=this[_0xed2c('0x9')][_0x1b74f2[_0xed2c('0x28')]][_0x1b74f2[_0xed2c('0x2a')]];var _0x37cc70=this[_0xed2c('0xa')][_0x1b74f2[_0xed2c('0x2d')]];var _0x1b4b75=this[_0xed2c('0xc')][_0x1b74f2[_0xed2c('0x28')]];if(_['isUndefined'](_0x46bdeb)){_0x46bdeb={'agentcalledAt':moment()[_0xed2c('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xed2c('0x2f'),'mandatoryDisposition':_0x37cc70&&_0x37cc70['mandatoryDisposition']?_0x37cc70[_0xed2c('0x30')]:![],'type':_0x37cc70&&_0x37cc70[_0xed2c('0x31')]?_0x37cc70[_0xed2c('0x31')]:_0xed2c('0x32'),'variables':_0x1b4b75,'motionChannel':_0xed2c('0x33')};}Object['assign'](_0x46bdeb,_[_0xed2c('0x34')](_0x1b74f2,[_0xed2c('0x35'),'privilege']));this[_0xed2c('0x9')][_0x1b74f2[_0xed2c('0x28')]][_0x1b74f2[_0xed2c('0x2a')]]=_0x46bdeb;logger['debug'](_0xed2c('0x36'),_0x1b74f2['uniqueid'],util[_0xed2c('0x2c')](_0x46bdeb,{'showHidden':![],'depth':null}));ami[_0xed2c('0x24')](_0xed2c('0x37'),_0x46bdeb);var _0x53d87b={'id':_0x535ff0['id'],'calleridnum':_0x46bdeb[_0xed2c('0x38')],'queue':_0x46bdeb['queue'],'variables':_0x46bdeb[_0xed2c('0xc')],'uniqueid':_0x1b74f2['uniqueid']};logger['debug'](_0xed2c('0x39'),_0x1b74f2['uniqueid'],util['inspect'](_0x53d87b,{'showHidden':![],'depth':null}));this['emit'](util[_0xed2c('0x2e')](_0xed2c('0x3a'),_0x1b74f2[_0xed2c('0x29')]),_0xed2c('0x3b'),_0x53d87b);}}catch(_0x44d110){logger[_0xed2c('0x3c')](_0xed2c('0x3d'),_0x1b74f2['uniqueid'],util['inspect'](_0x44d110,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xed2c('0x23')][_0xed2c('0x11')]=function(_0x16fd7a){try{if(this[_0xed2c('0x25')](_0x16fd7a)){if(this['channels'][_0x16fd7a['uniqueid']]){for(var _0x2403e1 in this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]]){if(this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0xed2c('0x3e')](_0x2403e1)){if(_0x16fd7a['destuniqueid']===_0x2403e1){logger[_0xed2c('0x26')](_0xed2c('0x3f'),_0x16fd7a['uniqueid'],_0x16fd7a[_0xed2c('0x29')],_0x16fd7a[_0xed2c('0x2a')]);this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1][_0xed2c('0x40')]=moment()[_0xed2c('0x2e')](_0xed2c('0x41'));this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1][_0xed2c('0x42')]=_0x16fd7a['connectedlinename'];this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1]['connectedlinenum']=_0x16fd7a[_0xed2c('0x43')];this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1]['destchannelstate']=_0x16fd7a[_0xed2c('0x44')];this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1][_0xed2c('0x45')]=_0x16fd7a['destchannelstatedesc'];this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1][_0xed2c('0x46')]=_0x16fd7a['holdtime'];this[_0xed2c('0x9')][_0x16fd7a['uniqueid']][_0x2403e1]['lastevent']=_0xed2c('0x47');if(this['voiceChannels'][this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1][_0xed2c('0x28')]]){var _0x36a62d=this['voiceChannels'][this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1][_0xed2c('0x28')]]['routealias'];this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1]['routealias']=_0x36a62d;_0x16fd7a[_0xed2c('0x48')]=_0x36a62d;}_[_0xed2c('0x49')](this[_0xed2c('0xb')][_0x16fd7a[_0xed2c('0x4a')]],_[_0xed2c('0x4b')](_0x16fd7a,['queue',_0xed2c('0x4c'),_0xed2c('0x48')]));var _0xb164ed=this[_0xed2c('0xb')][_0x16fd7a['interface']];var _0x237b4d={'id':_0xb164ed['id'],'name':_0xb164ed[_0xed2c('0x4d')],'agentconnected':!![],'destaccountcode':_0xb164ed[_0xed2c('0x4e')],'destconnectedlinenum':this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x16fd7a[_0xed2c('0x2a')]][_0xed2c('0x4f')],'queue':this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x16fd7a[_0xed2c('0x2a')]][_0xed2c('0x2d')],'routealias':this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x16fd7a['destuniqueid']]['routealias'],'uniqueid':this[_0xed2c('0x9')][_0x16fd7a['uniqueid']][_0x16fd7a[_0xed2c('0x2a')]][_0xed2c('0x28')]};ami[_0xed2c('0x24')]('custom:agentconnect',this[_0xed2c('0x9')][_0x16fd7a['uniqueid']][_0x16fd7a['destuniqueid']]);this[_0xed2c('0x24')](util['format'](_0xed2c('0x3a'),_0x16fd7a[_0xed2c('0x29')]),'user:agentconnect',_0x237b4d);}else if(!this['channels'][_0x16fd7a['uniqueid']][_0x2403e1][_0xed2c('0x12')]&&!this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1][_0xed2c('0x16')]){logger['info'](_0xed2c('0x50'),_0x16fd7a[_0xed2c('0x28')],this['channels'][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1][_0xed2c('0x29')],_0x2403e1);this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1]['agentringnoanswer']=!![];this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1]['agentringnoanswerAt']=moment()[_0xed2c('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1]['answeredelsewheredestinationuniqueid']=_0x16fd7a['destuniqueid'];this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1][_0xed2c('0x51')]=_0x16fd7a['membername'];this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1][_0xed2c('0x52')]=_0xed2c('0x53');this[_0xed2c('0x9')][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1]['reason']=_0xed2c('0x53');logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x16fd7a[_0xed2c('0x28')],util[_0xed2c('0x2c')](this['channels'][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1],{'showHidden':![],'depth':null}));ami[_0xed2c('0x24')](_0xed2c('0x54'),this['channels'][_0x16fd7a[_0xed2c('0x28')]][_0x2403e1]);}else{logger[_0xed2c('0x2b')](_0xed2c('0x55'),_0x16fd7a[_0xed2c('0x28')]);}}}}}}catch(_0x4712f7){logger[_0xed2c('0x3c')](_0xed2c('0x56'),_0x16fd7a[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0x4712f7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x519dcc){try{if(this['isNotNull'](_0x519dcc)){logger[_0xed2c('0x2b')](_0xed2c('0x57'),_0x519dcc[_0xed2c('0x28')],util['inspect'](_0x519dcc,{'showHidden':![],'depth':null}));if(this[_0xed2c('0x9')][_0x519dcc[_0xed2c('0x28')]]&&this[_0xed2c('0x9')][_0x519dcc[_0xed2c('0x28')]][_0x519dcc[_0xed2c('0x2a')]]){logger[_0xed2c('0x26')](_0xed2c('0x58'),_0x519dcc[_0xed2c('0x28')],_0x519dcc['membername'],_0x519dcc[_0xed2c('0x2a')]);var _0x309b58=this[_0xed2c('0xb')][_0x519dcc[_0xed2c('0x4a')]];var _0x12548e=this['channels'][_0x519dcc[_0xed2c('0x28')]][_0x519dcc[_0xed2c('0x2a')]];_0x12548e[_0xed2c('0x12')]=!![];_0x12548e[_0xed2c('0x59')]=moment()[_0xed2c('0x2e')](_0xed2c('0x41'));_0x12548e[_0xed2c('0x52')]=_0xed2c('0x5a');_0x12548e[_0xed2c('0x5b')]=_0xed2c('0x5a');var _0x1cc762={'id':_0x309b58['id'],'name':_0x309b58['name'],'queue':_0x12548e[_0xed2c('0x2d')],'uniqueid':_0x12548e[_0xed2c('0x28')]};logger[_0xed2c('0x2b')](_0xed2c('0x5c'),_0x519dcc[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0x1cc762,{'showHidden':![],'depth':null}));this[_0xed2c('0x24')](util[_0xed2c('0x2e')](_0xed2c('0x3a'),_0x309b58[_0xed2c('0x4d')]),'user:agentringnoanswer',_0x1cc762);ami[_0xed2c('0x24')]('custom:agentringnoanswer',_0x12548e);this['channels'][_0x519dcc[_0xed2c('0x28')]][_0x519dcc[_0xed2c('0x2a')]]=Object[_0xed2c('0x5d')]({},_0x12548e);}}}catch(_0x24054f){logger[_0xed2c('0x3c')]('[%s][voiceAgentReport][agentringnoanswer]',_0x519dcc[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0x24054f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xed2c('0x23')][_0xed2c('0x15')]=function(_0x2acf2e){try{if(this[_0xed2c('0x25')](_0x2acf2e)){logger[_0xed2c('0x2b')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x2acf2e[_0xed2c('0x28')],util['inspect'](_0x2acf2e,{'showHidden':![],'depth':null}));if(this[_0xed2c('0x9')][_0x2acf2e[_0xed2c('0x28')]]){for(var _0x515d2 in this['channels'][_0x2acf2e[_0xed2c('0x28')]]){if(this[_0xed2c('0x9')][_0x2acf2e['uniqueid']]['hasOwnProperty'](_0x515d2)&&!this[_0xed2c('0x9')][_0x2acf2e[_0xed2c('0x28')]][_0x515d2][_0xed2c('0x12')]&&!this['channels'][_0x2acf2e['uniqueid']][_0x515d2]['agentcomplete']){logger[_0xed2c('0x26')](_0xed2c('0x5e'),_0x2acf2e[_0xed2c('0x28')],this[_0xed2c('0x9')][_0x2acf2e['uniqueid']][_0x515d2][_0xed2c('0x29')],_0x515d2);this['channels'][_0x2acf2e[_0xed2c('0x28')]][_0x515d2][_0xed2c('0x12')]=!![];this[_0xed2c('0x9')][_0x2acf2e[_0xed2c('0x28')]][_0x515d2][_0xed2c('0x59')]=moment()[_0xed2c('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2acf2e['uniqueid']][_0x515d2][_0xed2c('0x52')]=_0xed2c('0x5f');this[_0xed2c('0x9')][_0x2acf2e[_0xed2c('0x28')]][_0x515d2][_0xed2c('0x5b')]=_0xed2c('0x5f');logger[_0xed2c('0x2b')](_0xed2c('0x60'),_0x2acf2e[_0xed2c('0x28')],util['inspect'](this[_0xed2c('0x9')][_0x2acf2e['uniqueid']][_0x515d2],{'showHidden':![],'depth':null}));ami[_0xed2c('0x24')](_0xed2c('0x61'),this[_0xed2c('0x9')][_0x2acf2e[_0xed2c('0x28')]][_0x515d2]);}}}}}catch(_0xb24968){logger[_0xed2c('0x3c')]('[%s][voiceAgentReport][queuecallerabandon]',_0x2acf2e[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0xb24968,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xed2c('0x23')]['syncAgentComplete']=function(_0x4d6925){try{if(this[_0xed2c('0x25')](_0x4d6925)){logger[_0xed2c('0x2b')](_0xed2c('0x62'),_0x4d6925['uniqueid'],util[_0xed2c('0x2c')](_0x4d6925,{'showHidden':![],'depth':null}));if(this[_0xed2c('0x9')][_0x4d6925[_0xed2c('0x28')]]){for(var _0x1a8e14 in this[_0xed2c('0x9')][_0x4d6925[_0xed2c('0x28')]]){if(this['channels'][_0x4d6925[_0xed2c('0x28')]][_0xed2c('0x3e')](_0x1a8e14)){if(this[_0xed2c('0x9')][_0x4d6925[_0xed2c('0x28')]][_0x1a8e14][_0xed2c('0x40')]&&!this[_0xed2c('0x9')][_0x4d6925['uniqueid']][_0x1a8e14]['agentcomplete']){logger['info'](_0xed2c('0x63'),_0x4d6925[_0xed2c('0x28')],this['channels'][_0x4d6925[_0xed2c('0x28')]][_0x1a8e14][_0xed2c('0x29')],_0x1a8e14);this[_0xed2c('0x9')][_0x4d6925[_0xed2c('0x28')]][_0x1a8e14]['agentcomplete']=!![];this[_0xed2c('0x9')][_0x4d6925['uniqueid']][_0x1a8e14][_0xed2c('0x64')]=moment()[_0xed2c('0x2e')](_0xed2c('0x41'));this[_0xed2c('0x9')][_0x4d6925['uniqueid']][_0x1a8e14]['lastevent']=_0xed2c('0x65');this['channels'][_0x4d6925['uniqueid']][_0x1a8e14][_0xed2c('0x5b')]=_0x4d6925['reason']==_0xed2c('0x66')?'agent':_0x4d6925['reason'];this['channels'][_0x4d6925['uniqueid']][_0x1a8e14][_0xed2c('0x67')]=_0x4d6925[_0xed2c('0x67')];if(this[_0xed2c('0xa')][_0x4d6925[_0xed2c('0x2d')]]&&this[_0xed2c('0xa')][_0x4d6925[_0xed2c('0x2d')]][_0xed2c('0x68')]){this[_0xed2c('0x9')][_0x4d6925[_0xed2c('0x28')]][_0x1a8e14]['acwtime']=this['voiceQueues'][_0x4d6925[_0xed2c('0x2d')]][_0xed2c('0x69')];this[_0xed2c('0x9')][_0x4d6925[_0xed2c('0x28')]][_0x1a8e14][_0xed2c('0x6a')]=!![];}this[_0xed2c('0xb')][_0x4d6925[_0xed2c('0x4a')]]=_['omit'](this[_0xed2c('0xb')][_0x4d6925[_0xed2c('0x4a')]],[_0xed2c('0x2d'),'destconnectedlinenum']);logger[_0xed2c('0x2b')](_0xed2c('0x6b'),_0x4d6925[_0xed2c('0x28')],util['inspect'](this[_0xed2c('0x9')][_0x4d6925[_0xed2c('0x28')]][_0x1a8e14],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0xed2c('0x9')][_0x4d6925[_0xed2c('0x28')]][_0x1a8e14]);logger['debug'](_0xed2c('0x6c'),_0x4d6925[_0xed2c('0x28')],util['inspect']({'id':this[_0xed2c('0xb')][_0x4d6925[_0xed2c('0x4a')]]['id'],'destaccountcode':_0x4d6925[_0xed2c('0x6d')]},{'showHidden':![],'depth':null}));this[_0xed2c('0x24')](util[_0xed2c('0x2e')](_0xed2c('0x3a'),_0x4d6925[_0xed2c('0x29')]),'user:agentcomplete',{'id':this[_0xed2c('0xb')][_0x4d6925[_0xed2c('0x4a')]]['id'],'destaccountcode':Number(_0x4d6925[_0xed2c('0x6d')])});}}}}}}catch(_0x5def4b){logger[_0xed2c('0x3c')](_0xed2c('0x6e'),_0x4d6925[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0x5def4b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0xb4b217){try{if(this[_0xed2c('0x25')](_0xb4b217)){logger[_0xed2c('0x2b')](_0xed2c('0x6f'),_0xb4b217['uniqueid'],util[_0xed2c('0x2c')](_0xb4b217,{'showHidden':![],'depth':null}));this[_0xed2c('0x70')](_0xb4b217['uniqueid'],_['keys'](_0xb4b217['variable'])[0x0],_0xb4b217['value']);if(this[_0xed2c('0x9')][_0xb4b217['uniqueid']]){for(var _0x1dba74 in this[_0xed2c('0x9')][_0xb4b217['uniqueid']]){if(this[_0xed2c('0x9')][_0xb4b217['uniqueid']][_0xed2c('0x3e')](_0x1dba74)){logger['info'](_0xed2c('0x71'),_0xb4b217[_0xed2c('0x28')],_0x1dba74,_[_0xed2c('0x72')](_0xb4b217['variable'])[0x0],_0xb4b217['value']);if(_['isUndefined'](this[_0xed2c('0x9')][_0xb4b217['uniqueid']][_0x1dba74][_0xed2c('0xc')])){this[_0xed2c('0x9')][_0xb4b217[_0xed2c('0x28')]][_0x1dba74]['variables']={};}this[_0xed2c('0x9')][_0xb4b217[_0xed2c('0x28')]][_0x1dba74][_0xed2c('0xc')]=this[_0xed2c('0xc')][_0xb4b217[_0xed2c('0x28')]];}}}}}catch(_0x58a611){logger['error'](_0xed2c('0x73'),_0xb4b217[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0x58a611,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xed2c('0x23')][_0xed2c('0x70')]=function(_0x373cc1,_0x1429e2,_0x287b8b){var _0x1d123c=[_0xed2c('0x74'),_0xed2c('0x75'),'rtpaudioqosjitter',_0xed2c('0x76'),'rtpaudioqosloss',_0xed2c('0x77'),_0xed2c('0x78'),_0xed2c('0x79'),'sipcallid',_0xed2c('0x7a'),_0xed2c('0x7b'),_0xed2c('0x7c'),'membercalls',_0xed2c('0x7d'),_0xed2c('0x7e'),_0xed2c('0x7f'),'membername',_0xed2c('0x80'),_0xed2c('0x81')];if(!_['isNil'](_0x1429e2)&&!_[_0xed2c('0x82')](_0x1d123c,_0x1429e2)){if(_[_0xed2c('0x83')](this['variables'][_0x373cc1])){this[_0xed2c('0xc')][_0x373cc1]={};}this[_0xed2c('0xc')][_0x373cc1][_0x1429e2]=_0x287b8b;}};VoiceAgentReport['prototype'][_0xed2c('0x1b')]=function(_0x59ae65){try{if(this[_0xed2c('0x25')](_0x59ae65)){logger[_0xed2c('0x2b')]('[%s][voiceAgentReport][hangup]\x20event:',_0x59ae65[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0x59ae65,{'showHidden':![],'depth':null}));if(this[_0xed2c('0x9')][_0x59ae65[_0xed2c('0x28')]]){for(var _0x1340fe in this[_0xed2c('0x9')][_0x59ae65['uniqueid']]){if(this[_0xed2c('0x9')][_0x59ae65[_0xed2c('0x28')]][_0xed2c('0x3e')](_0x1340fe)){if(this[_0xed2c('0x9')][_0x59ae65[_0xed2c('0x28')]][_0x1340fe]['reason']=='transfer'&&this['channels'][_0x59ae65[_0xed2c('0x28')]][_0x1340fe][_0xed2c('0x16')]){logger['info'](_0xed2c('0x84'),_0x59ae65[_0xed2c('0x28')],_0x1340fe);this[_0xed2c('0x9')][_0x59ae65['uniqueid']][_0x1340fe][_0xed2c('0x64')]=moment()['format'](_0xed2c('0x41'));}}}logger['debug'](_0xed2c('0x85'),_0x59ae65[_0xed2c('0x28')],util[_0xed2c('0x2c')](_['values'](this['channels'][_0x59ae65[_0xed2c('0x28')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xed2c('0x86'),_[_0xed2c('0x87')](this[_0xed2c('0x9')][_0x59ae65[_0xed2c('0x28')]]));delete this[_0xed2c('0x9')][_0x59ae65['uniqueid']];}if(this['variables'][_0x59ae65[_0xed2c('0x28')]]){delete this[_0xed2c('0xc')][_0x59ae65[_0xed2c('0x28')]];}}}catch(_0x469c4b){logger['error'](_0xed2c('0x88'),_0x59ae65[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0x469c4b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xed2c('0x20')]=function(_0x14811b){try{if(this['isNotNull'](_0x14811b)){logger[_0xed2c('0x2b')](_0xed2c('0x89'),_0x14811b[_0xed2c('0x28')],util['inspect'](_0x14811b,{'showHidden':![],'depth':null}));if(this[_0xed2c('0x9')][_0x14811b[_0xed2c('0x8a')]]){for(var _0x463a43 in this[_0xed2c('0x9')][_0x14811b[_0xed2c('0x8a')]]){if(this[_0xed2c('0x9')][_0x14811b[_0xed2c('0x8a')]][_0xed2c('0x3e')](_0x463a43)){if(_0x14811b[_0xed2c('0x8b')]===_0x463a43){logger[_0xed2c('0x26')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x14811b[_0xed2c('0x28')],this[_0xed2c('0x9')][_0x14811b[_0xed2c('0x8a')]][_0x463a43][_0xed2c('0x29')],_0x463a43);var _0x1b122e=moment();this[_0xed2c('0x9')][_0x14811b['transfereeuniqueid']][_0x463a43]['agentcomplete']=!![];this[_0xed2c('0x9')][_0x14811b[_0xed2c('0x8a')]][_0x463a43][_0xed2c('0x64')]=moment()['format'](_0xed2c('0x41'));this[_0xed2c('0x9')][_0x14811b[_0xed2c('0x8a')]][_0x463a43][_0xed2c('0x52')]=_0xed2c('0x65');this['channels'][_0x14811b['transfereeuniqueid']][_0x463a43][_0xed2c('0x5b')]='transfer';this['channels'][_0x14811b[_0xed2c('0x8a')]][_0x463a43][_0xed2c('0x67')]=_0x1b122e[_0xed2c('0x8c')](this[_0xed2c('0x9')][_0x14811b['transfereeuniqueid']][_0x463a43][_0xed2c('0x40')],'seconds');}}}}if(this['channels'][_0x14811b['secondtransfereruniqueid']]){var _0x4354e7=this[_0xed2c('0x9')][_0x14811b[_0xed2c('0x8d')]];this[_0xed2c('0x9')][_0x14811b[_0xed2c('0x8d')]]=this[_0xed2c('0x9')][_0x14811b[_0xed2c('0x8a')]];this['channels'][_0x14811b['transfereeuniqueid']]=_0x4354e7;}}}catch(_0xdf2eb){logger[_0xed2c('0x3c')](_0xed2c('0x8e'),_0x14811b[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0xdf2eb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xed2c('0x23')][_0xed2c('0x22')]=function(_0x4adff3){try{if(this['isNotNull'](_0x4adff3)){logger[_0xed2c('0x2b')](_0xed2c('0x8f'),_0x4adff3['uniqueid'],util[_0xed2c('0x2c')](_0x4adff3,{'showHidden':![],'depth':null}));if(this['channels'][_0x4adff3[_0xed2c('0x8a')]]){for(var _0x21361c in this[_0xed2c('0x9')][_0x4adff3['transfereeuniqueid']]){if(this['channels'][_0x4adff3['transfereeuniqueid']]['hasOwnProperty'](_0x21361c)){if(_0x4adff3['transfereruniqueid']===_0x21361c){logger['info'](_0xed2c('0x90'),_0x4adff3[_0xed2c('0x28')],this['channels'][_0x4adff3[_0xed2c('0x8a')]][_0x21361c][_0xed2c('0x29')],_0x21361c);var _0x2ff226=moment();this[_0xed2c('0x9')][_0x4adff3['transfereeuniqueid']][_0x21361c][_0xed2c('0x16')]=!![];this[_0xed2c('0x9')][_0x4adff3[_0xed2c('0x8a')]][_0x21361c]['agentcompleteAt']=_0x2ff226;this['channels'][_0x4adff3[_0xed2c('0x8a')]][_0x21361c]['lastevent']=_0xed2c('0x65');this[_0xed2c('0x9')][_0x4adff3['transfereeuniqueid']][_0x21361c]['reason']=_0xed2c('0x66');this[_0xed2c('0x9')][_0x4adff3[_0xed2c('0x8a')]][_0x21361c][_0xed2c('0x67')]=_0x2ff226[_0xed2c('0x8c')](this[_0xed2c('0x9')][_0x4adff3[_0xed2c('0x8a')]][_0x21361c][_0xed2c('0x40')],_0xed2c('0x91'));}}}}}}catch(_0x1cae8e){logger['error'](_0xed2c('0x92'),_0x4adff3['uniqueid'],util[_0xed2c('0x2c')](_0x1cae8e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xed2c('0x23')][_0xed2c('0x1d')]=function(_0x1c7122){var _0x5c8b3d='';try{if(this[_0xed2c('0x25')](_0x1c7122)){logger[_0xed2c('0x2b')](_0xed2c('0x93'),_0x1c7122['uniqueid'],util['inspect'](_0x1c7122,{'showHidden':![],'depth':null}));if(_0x1c7122[_0xed2c('0x94')]){_0x5c8b3d=_0x1c7122[_0xed2c('0x94')][_0xed2c('0x95')](0x0,_0x1c7122[_0xed2c('0x94')]['lastIndexOf']('-'));if(this['agents'][_0x5c8b3d]){logger[_0xed2c('0x26')](_0xed2c('0x96'),_0x1c7122['uniqueid'],_0x5c8b3d);this[_0xed2c('0xb')][_0x5c8b3d][_0xed2c('0x97')]=!![];}}}}catch(_0x204e6b){logger['error'](_0xed2c('0x98'),_0x1c7122[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0x204e6b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xed2c('0x23')][_0xed2c('0x99')]=function(_0x1ed04d){var _0x3e2164='';try{if(this[_0xed2c('0x25')](_0x1ed04d)){logger[_0xed2c('0x2b')](_0xed2c('0x9a'),_0x1ed04d[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0x1ed04d,{'showHidden':![],'depth':null}));if(_0x1ed04d[_0xed2c('0x94')]){_0x3e2164=_0x1ed04d['channel'][_0xed2c('0x95')](0x0,_0x1ed04d[_0xed2c('0x94')][_0xed2c('0x9b')]('-'));if(this[_0xed2c('0xb')][_0x3e2164]){logger[_0xed2c('0x26')](_0xed2c('0x9c'),_0x1ed04d[_0xed2c('0x28')],_0x3e2164);this[_0xed2c('0xb')][_0x3e2164]['onhold']=![];}}}}catch(_0x4ed199){logger[_0xed2c('0x3c')](_0xed2c('0x9d'),_0x1ed04d[_0xed2c('0x28')],util[_0xed2c('0x2c')](_0x4ed199,{'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 9642ed5..8e40ce5 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 _0x7e8a=['transferType','then','getSettings','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','BlindTransfer','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','moment','util','path','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','queue','agi','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','syncNewCallerId','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','pick','keys','context','from-sip','channel','split','xcally-motion-preview','connectedlinenum','format','user:%s','user:agentconnect','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','destconnectedlinenum','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','startsWith','CDR(routeAlias)','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','set','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','holdtime','diff','destinationchannel','membername','answertime','connectedlinename','UserId','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','.wav49','find','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%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','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','cause-txt','endtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length'];(function(_0x315f92,_0x390e4f){var _0x347b0c=function(_0x4939a0){while(--_0x4939a0){_0x315f92['push'](_0x315f92['shift']());}};_0x347b0c(++_0x390e4f);}(_0x7e8a,0x1b9));var _0xa7e8=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7e8a[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var moment=require(_0xa7e8('0x0'));var util=require(_0xa7e8('0x1'));var path=require(_0xa7e8('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xa7e8('0x3'))(_0xa7e8('0x4'));var ami=require(_0xa7e8('0x5'));var Channel=require(_0xa7e8('0x6'));var RpcSetting=require(_0xa7e8('0x7'));var applications=['set',_0xa7e8('0x8'),_0xa7e8('0x9'),'dial','playback',_0xa7e8('0xa')];var dispositions=[_0xa7e8('0xb'),'FAILED',_0xa7e8('0xc'),'NO\x20ANSWER',_0xa7e8('0xb'),'NO\x20ANSWER',_0xa7e8('0xd'),_0xa7e8('0xe'),_0xa7e8('0xc'),_0xa7e8('0xc'),_0xa7e8('0xc')];config[_0xa7e8('0xf')]=_[_0xa7e8('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x456b09){this[_0xa7e8('0x11')]=_0x456b09[_0xa7e8('0x11')];this['agents']=_0x456b09[_0xa7e8('0x12')];this[_0xa7e8('0x13')]={};ami['on'](_0xa7e8('0x14'),this[_0xa7e8('0x15')][_0xa7e8('0x16')](this));ami['on'](_0xa7e8('0x17'),this[_0xa7e8('0x15')][_0xa7e8('0x16')](this));ami['on']('newchannel',this[_0xa7e8('0x18')][_0xa7e8('0x16')](this));ami['on']('newstate',this[_0xa7e8('0x19')][_0xa7e8('0x16')](this));ami['on'](_0xa7e8('0x1a'),this[_0xa7e8('0x1b')]['bind'](this));ami['on'](_0xa7e8('0x1c'),this[_0xa7e8('0x1d')]['bind'](this));ami['on'](_0xa7e8('0x1e'),this['syncNewCallerId'][_0xa7e8('0x16')](this));ami['on'](_0xa7e8('0x1f'),this[_0xa7e8('0x20')][_0xa7e8('0x16')](this));ami['on']('blindtransfer',this[_0xa7e8('0x21')]['bind'](this));ami['on'](_0xa7e8('0x22'),this['syncMusicOnHoldStart'][_0xa7e8('0x16')](this));ami['on'](_0xa7e8('0x23'),this[_0xa7e8('0x24')]['bind'](this));try{logger['info'](_0xa7e8('0x25'));ami[_0xa7e8('0x26')]();}catch(_0x96f6b3){logger[_0xa7e8('0x27')](_0xa7e8('0x28'),util[_0xa7e8('0x29')](_0x96f6b3,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xa7e8('0x2a')]=function(_0x4d5424){return _0x4d5424!==null&&!_[_0xa7e8('0x2b')](_0x4d5424);};VoiceCallReport[_0xa7e8('0x2c')][_0xa7e8('0x2d')]=function(_0x55212f,_0x46ef96,_0x53e422){io['to'](_0x55212f)['emit'](_0x46ef96,_0x53e422);};VoiceCallReport[_0xa7e8('0x2c')][_0xa7e8('0x2e')]=function(_0x2027b9){try{if(this[_0xa7e8('0x2a')](_0x2027b9)){logger[_0xa7e8('0x2f')](_0xa7e8('0x30'),_0x2027b9['uniqueid'],_0x2027b9['calleridname'],_0x2027b9[_0xa7e8('0x31')]);logger[_0xa7e8('0x32')](_0xa7e8('0x33'),_0x2027b9[_0xa7e8('0x34')],util[_0xa7e8('0x29')](_0x2027b9,{'showHidden':![],'depth':null}));if(_0x2027b9[_0xa7e8('0x34')]===_0x2027b9[_0xa7e8('0x35')]){if(!_[_0xa7e8('0x2b')](this[_0xa7e8('0x11')][_0x2027b9['uniqueid']])){_[_0xa7e8('0x36')](this[_0xa7e8('0x11')][_0x2027b9['uniqueid']],_[_0xa7e8('0x37')](_0x2027b9,_[_0xa7e8('0x38')](this['channels'][_0x2027b9[_0xa7e8('0x34')]])));}}if(_0x2027b9[_0xa7e8('0x39')]===_0xa7e8('0x3a')){if(this[_0xa7e8('0x12')][_0x2027b9[_0xa7e8('0x3b')][_0xa7e8('0x3c')]('-')[0x0]]){if(_0x2027b9['exten']==_0xa7e8('0x3d')){this[_0xa7e8('0x12')][_0x2027b9['channel'][_0xa7e8('0x3c')]('-')[0x0]]['destconnectedlinenum']=_0x2027b9[_0xa7e8('0x3e')];this[_0xa7e8('0x2d')](util[_0xa7e8('0x3f')](_0xa7e8('0x40'),this[_0xa7e8('0x12')][_0x2027b9['channel'][_0xa7e8('0x3c')]('-')[0x0]]['name']),_0xa7e8('0x41'),{'destaccountcode':this[_0xa7e8('0x12')][_0x2027b9[_0xa7e8('0x3b')][_0xa7e8('0x3c')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2027b9[_0xa7e8('0x3e')]});}}}}}catch(_0x57f2a6){logger[_0xa7e8('0x27')](_0xa7e8('0x42'),_0x2027b9[_0xa7e8('0x34')],util[_0xa7e8('0x29')](_0x57f2a6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa7e8('0x2c')]['syncNewChannel']=function(_0x28c3f7){try{if(this[_0xa7e8('0x2a')](_0x28c3f7)){logger[_0xa7e8('0x32')](_0xa7e8('0x43'),_0x28c3f7[_0xa7e8('0x34')],util[_0xa7e8('0x29')](_0x28c3f7,{'showHidden':![],'depth':null}));if(this[_0xa7e8('0x11')][_0x28c3f7['uniqueid']]){return;}if(_0x28c3f7[_0xa7e8('0x3b')]===_0xa7e8('0x44')){return;}if(_0x28c3f7[_0xa7e8('0x34')]!==_0x28c3f7[_0xa7e8('0x35')]&&!this[_0xa7e8('0x13')][_0x28c3f7['linkedid']]){return;}logger[_0xa7e8('0x2f')](_0xa7e8('0x45'),_0x28c3f7[_0xa7e8('0x34')],_0x28c3f7[_0xa7e8('0x39')],_0x28c3f7[_0xa7e8('0x46')]);this[_0xa7e8('0x11')][_0x28c3f7[_0xa7e8('0x34')]]=new Channel();this[_0xa7e8('0x11')][_0x28c3f7['uniqueid']]['starttime']=moment()[_0xa7e8('0x3f')](_0xa7e8('0x47'));this[_0xa7e8('0x11')][_0x28c3f7[_0xa7e8('0x34')]][_0xa7e8('0x48')]=dispositions[_[_0xa7e8('0x49')](_0x28c3f7['channelstate'])];_[_0xa7e8('0x36')](this['channels'][_0x28c3f7['uniqueid']],_['pick'](_0x28c3f7,_[_0xa7e8('0x38')](this[_0xa7e8('0x11')][_0x28c3f7[_0xa7e8('0x34')]])));if(_0x28c3f7[_0xa7e8('0x39')]==='from-sip'){var _0xcba2fc=this['agents'][_0x28c3f7[_0xa7e8('0x3b')][_0xa7e8('0x3c')]('-')[0x0]];if(_0xcba2fc&&typeof _0xcba2fc[_0xa7e8('0x4a')]===_0xa7e8('0x4b')){_0xcba2fc[_0xa7e8('0x4a')]=_0x28c3f7[_0xa7e8('0x46')];logger[_0xa7e8('0x32')](_0xa7e8('0x4c'),_0x28c3f7[_0xa7e8('0x34')],util[_0xa7e8('0x29')]({'id':_0xcba2fc['id'],'destaccountcode':_0xcba2fc[_0xa7e8('0x4d')],'destconnectedlinenum':_0x28c3f7['exten']},{'showHidden':![],'depth':null}));this[_0xa7e8('0x2d')](util['format'](_0xa7e8('0x40'),_0xcba2fc[_0xa7e8('0x4e')]),_0xa7e8('0x41'),{'id':_0xcba2fc['id'],'destaccountcode':_0xcba2fc[_0xa7e8('0x4d')],'destconnectedlinenum':_0x28c3f7[_0xa7e8('0x46')]});}}}}catch(_0x33601e){logger['error'](_0xa7e8('0x4f'),_0x28c3f7['uniqueid'],util[_0xa7e8('0x29')](_0x33601e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa7e8('0x2c')]['syncNewExten']=function(_0x1d5240){try{if(this[_0xa7e8('0x2a')](_0x1d5240)){logger['debug'](_0xa7e8('0x50'),_0x1d5240[_0xa7e8('0x34')],util[_0xa7e8('0x29')](_0x1d5240,{'showHidden':![],'depth':null}));if(_0x1d5240[_0xa7e8('0x3b')]===_0xa7e8('0x44')||_0x1d5240[_0xa7e8('0x46')]==='h')return;if(_0x1d5240[_0xa7e8('0x34')]===_0x1d5240[_0xa7e8('0x35')]||this[_0xa7e8('0x13')][_0x1d5240[_0xa7e8('0x35')]]){_0x1d5240[_0xa7e8('0x51')]=_0x1d5240[_0xa7e8('0x51')]?_0x1d5240['application'][_0xa7e8('0x52')]():undefined;_0x1d5240['applicationdata']=_0x1d5240[_0xa7e8('0x53')]||_0x1d5240['applicationdata'];if(_0x1d5240[_0xa7e8('0x53')]&&!_0x1d5240[_0xa7e8('0x53')][_0xa7e8('0x54')](_0xa7e8('0x55'))&&_0x1d5240[_0xa7e8('0x51')]!=='queue'){_0x1d5240['applicationdata']=_0x1d5240[_0xa7e8('0x56')]['toLowerCase']();}logger[_0xa7e8('0x2f')](_0xa7e8('0x57'),_0x1d5240[_0xa7e8('0x34')],_0x1d5240[_0xa7e8('0x51')],_0x1d5240[_0xa7e8('0x56')]);if(_['isUndefined'](this[_0xa7e8('0x11')][_0x1d5240[_0xa7e8('0x34')]])){this['channels'][_0x1d5240['uniqueid']]=new Channel();this['channels'][_0x1d5240[_0xa7e8('0x34')]][_0xa7e8('0x58')]=_0x1d5240[_0xa7e8('0x59')]?moment()[_0xa7e8('0x5a')](moment[_0xa7e8('0x59')](_0x1d5240['duration'])[_0xa7e8('0x5b')](),_0xa7e8('0x5b'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()['format'](_0xa7e8('0x47'));this[_0xa7e8('0x11')][_0x1d5240['uniqueid']][_0xa7e8('0x48')]=_0xa7e8('0xb');}_[_0xa7e8('0x36')](this[_0xa7e8('0x11')][_0x1d5240['uniqueid']],_['pick'](_0x1d5240,_[_0xa7e8('0x38')](this[_0xa7e8('0x11')][_0x1d5240['uniqueid']])));if(_[_0xa7e8('0x5c')](applications,_0x1d5240['application'])){this[_0xa7e8('0x11')][_0x1d5240[_0xa7e8('0x34')]][_0xa7e8('0x5d')]=_0x1d5240[_0xa7e8('0x51')];this[_0xa7e8('0x11')][_0x1d5240[_0xa7e8('0x34')]][_0xa7e8('0x5e')]=_0x1d5240['applicationdata'];if(_0x1d5240[_0xa7e8('0x51')]===_0xa7e8('0x5f')&&_[_0xa7e8('0x54')](_0x1d5240[_0xa7e8('0x56')]['toLowerCase'](),_0xa7e8('0x60'))){var _0x193b62=_0x1d5240[_0xa7e8('0x56')][_0xa7e8('0x3c')]('=');var _0x57c046=_0x193b62[0x0][_0xa7e8('0x52')]()[_0xa7e8('0x61')](/cdr\((.*)\)/);if(_0x57c046){if(_0x57c046[0x1]==='type'&&!_['isNil'](this[_0xa7e8('0x11')][_0x1d5240[_0xa7e8('0x34')]][_0x57c046[0x1]]))return;this[_0xa7e8('0x11')][_0x1d5240[_0xa7e8('0x34')]][_0x57c046[0x1]]=_0x193b62[0x1];}}else if(_0x1d5240[_0xa7e8('0x51')]===_0xa7e8('0x8')){this[_0xa7e8('0x11')][_0x1d5240[_0xa7e8('0x34')]][_0xa7e8('0x8')]=_0x1d5240[_0xa7e8('0x56')][_0xa7e8('0x3c')](',')[0x0];}}}}}catch(_0x4e4437){logger['error'](_0xa7e8('0x62'),_0x1d5240[_0xa7e8('0x34')],util[_0xa7e8('0x29')](_0x4e4437,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa7e8('0x2c')][_0xa7e8('0x19')]=function(_0x116623){try{if(this[_0xa7e8('0x2a')](_0x116623)){logger[_0xa7e8('0x2f')](_0xa7e8('0x63'),_0x116623['uniqueid'],_0x116623[_0xa7e8('0x35')],_0x116623[_0xa7e8('0x64')],_0x116623['calleridnum']);logger[_0xa7e8('0x32')](_0xa7e8('0x65'),_0x116623['uniqueid'],util[_0xa7e8('0x29')](_0x116623,{'showHidden':![],'depth':null}));if(_0x116623[_0xa7e8('0x66')]!=='6')return;var _0x14c472=this[_0xa7e8('0x12')][_0x116623[_0xa7e8('0x3b')]['split']('-')[0x0]];if(_0x116623[_0xa7e8('0x34')]!==_0x116623[_0xa7e8('0x35')]){var _0x5a13b0=moment();if(this['channels'][_0x116623[_0xa7e8('0x35')]]){if(!this[_0xa7e8('0x11')][_0x116623['linkedid']][_0xa7e8('0x67')]){this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x35')]][_0xa7e8('0x67')]=!![];this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x35')]]['answertime']=_0x5a13b0[_0xa7e8('0x3f')](_0xa7e8('0x47'));if(this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x35')]]['starttime']){this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x35')]][_0xa7e8('0x68')]=_0x5a13b0[_0xa7e8('0x69')](this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x35')]][_0xa7e8('0x58')],'seconds');}}this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x35')]][_0xa7e8('0x35')]=_0x116623[_0xa7e8('0x34')];if(_0x116623[_0xa7e8('0x31')]!==_0xa7e8('0x3d')){this['channels'][_0x116623[_0xa7e8('0x35')]][_0xa7e8('0x3e')]=_0x116623['calleridnum'];}this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x35')]]['connectedlinename']=_0x116623[_0xa7e8('0x64')];this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x35')]][_0xa7e8('0x6a')]=_0x116623[_0xa7e8('0x3b')];this['channels'][_0x116623[_0xa7e8('0x35')]][_0xa7e8('0x48')]=dispositions[_[_0xa7e8('0x49')](_0x116623[_0xa7e8('0x66')])];if(_0x14c472){this['channels'][_0x116623['linkedid']]['UserId']=_0x14c472['id'];this[_0xa7e8('0x11')][_0x116623['linkedid']][_0xa7e8('0x6b')]=_0x14c472[_0xa7e8('0x4e')];}}if(this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]]){if(!this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]][_0xa7e8('0x67')]){this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]]['answered']=!![];this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]][_0xa7e8('0x6c')]=_0x5a13b0[_0xa7e8('0x3f')](_0xa7e8('0x47'));if(this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]]['starttime']){this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]][_0xa7e8('0x68')]=_0x5a13b0['diff'](this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]][_0xa7e8('0x58')],_0xa7e8('0x5b'));}}if(_0x116623[_0xa7e8('0x31')]!==_0xa7e8('0x3d')){this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]]['connectedlinenum']=_0x116623[_0xa7e8('0x31')];}this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]][_0xa7e8('0x6d')]=_0x116623[_0xa7e8('0x64')];this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]][_0xa7e8('0x6a')]=_0x116623[_0xa7e8('0x3b')];this['channels'][_0x116623['uniqueid']][_0xa7e8('0x48')]=dispositions[_[_0xa7e8('0x49')](_0x116623['channelstate'])];}}else{if(this['channels'][_0x116623[_0xa7e8('0x34')]]){if(_0x14c472){this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]][_0xa7e8('0x6e')]=_0x14c472['id'];this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]][_0xa7e8('0x6b')]=_0x14c472['name'];}}}if(_0x116623[_0xa7e8('0x39')]===_0xa7e8('0x3a')){if(_0x14c472){_0x14c472[_0xa7e8('0x4a')]=_0x116623['exten'];var _0x34cc05,_0x538bf2;if(this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]]){_0x34cc05=this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]][_0xa7e8('0x6f')];_0x538bf2=this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x34')]][_0xa7e8('0x8')];}else if(this[_0xa7e8('0x11')][_0x116623[_0xa7e8('0x35')]]){_0x34cc05=this[_0xa7e8('0x11')][_0x116623['linkedid']]['routealias'];_0x538bf2=this[_0xa7e8('0x11')][_0x116623['linkedid']][_0xa7e8('0x8')];}_0x14c472[_0xa7e8('0x8')]=_0x538bf2;_0x14c472[_0xa7e8('0x6f')]=_0x34cc05;var _0x2cd0a4={'id':_0x14c472['id'],'name':_0x14c472['name'],'agentconnected':!![],'destaccountcode':_0x14c472[_0xa7e8('0x4d')],'destconnectedlinenum':_0x116623[_0xa7e8('0x46')],'queue':_0x538bf2||undefined,'routealias':_0x34cc05,'uniqueid':_0x116623[_0xa7e8('0x35')]};logger[_0xa7e8('0x32')](_0xa7e8('0x70'),_0x116623[_0xa7e8('0x34')],util[_0xa7e8('0x29')](_0x2cd0a4,{'showHidden':![],'depth':null}));this[_0xa7e8('0x2d')](util[_0xa7e8('0x3f')](_0xa7e8('0x40'),_0x14c472[_0xa7e8('0x4e')]),_0xa7e8('0x41'),_0x2cd0a4);}}}}catch(_0x1b2662){logger[_0xa7e8('0x27')](_0xa7e8('0x71'),_0x116623[_0xa7e8('0x34')],util[_0xa7e8('0x29')](_0x1b2662,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa7e8('0x72')]=function(_0x26f160,_0x37da9e){try{if(this['channels'][_0x26f160]){logger[_0xa7e8('0x2f')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x26f160,_0x37da9e);this['channels'][_0x26f160][_0xa7e8('0x73')]=!![];if(_['endsWith'](_0x37da9e,'.wav49')){_0x37da9e=_0x37da9e['replace'](_0xa7e8('0x74'),'.WAV');}this['channels'][_0x26f160]['monitorFilename']=_0x37da9e;var _0x31b4bc=_[_0xa7e8('0x75')](this[_0xa7e8('0x11')][_0x26f160][_0xa7e8('0x76')],{'filename':_0x37da9e});if(_[_0xa7e8('0x77')](_0x31b4bc)){this[_0xa7e8('0x11')][_0x26f160]['monitors'][_0xa7e8('0x78')]({'filename':_0x37da9e,'createdAt':moment()[_0xa7e8('0x3f')](_0xa7e8('0x47')),'mixmonitorid':'','status':'rec'});}}}catch(_0x56727a){logger[_0xa7e8('0x27')](_0xa7e8('0x79'),_0x26f160,util['inspect'](_0x56727a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa7e8('0x1b')]=function(_0x42ee0c){try{if(this[_0xa7e8('0x2a')](_0x42ee0c)){logger['debug'](_0xa7e8('0x7a'),_0x42ee0c[_0xa7e8('0x34')],util['inspect'](_0x42ee0c,{'showHidden':![],'depth':null}));if(this[_0xa7e8('0x11')][_0x42ee0c[_0xa7e8('0x34')]]&&_0x42ee0c[_0xa7e8('0x3b')]!=_0xa7e8('0x44')){if(this[_0xa7e8('0x2a')](_0x42ee0c['variable'])){if(this['isNotNull'](_0x42ee0c[_0xa7e8('0x7b')][_0xa7e8('0x7c')])){logger[_0xa7e8('0x2f')](_0xa7e8('0x7d'),_0x42ee0c['uniqueid'],_0x42ee0c[_0xa7e8('0x7e')]);this['syncMixMonitorFilename'](_0x42ee0c['uniqueid'],_0x42ee0c[_0xa7e8('0x7e')]);}else if(this[_0xa7e8('0x2a')](_0x42ee0c[_0xa7e8('0x7b')]['xmd-phone'])){logger[_0xa7e8('0x2f')](_0xa7e8('0x7f'),_0x42ee0c[_0xa7e8('0x34')],_0x42ee0c[_0xa7e8('0x7e')]);this[_0xa7e8('0x11')][_0x42ee0c['uniqueid']][_0xa7e8('0x31')]=_0x42ee0c[_0xa7e8('0x7e')];}else if(this[_0xa7e8('0x2a')](_0x42ee0c[_0xa7e8('0x7b')]['xmd-callerid'])){logger[_0xa7e8('0x2f')](_0xa7e8('0x80'),_0x42ee0c[_0xa7e8('0x34')],_0x42ee0c[_0xa7e8('0x7e')]);this['channels'][_0x42ee0c[_0xa7e8('0x34')]][_0xa7e8('0x81')]=_0x42ee0c['value'];}else if(this['isNotNull'](_0x42ee0c['variable']['xmd-cdrtype'])){logger[_0xa7e8('0x2f')](_0xa7e8('0x82'),_0x42ee0c[_0xa7e8('0x34')],_0x42ee0c[_0xa7e8('0x7e')]);this['channels'][_0x42ee0c[_0xa7e8('0x34')]][_0xa7e8('0x83')]=_0x42ee0c[_0xa7e8('0x7e')];}else if(this[_0xa7e8('0x2a')](_0x42ee0c['variable'][_0xa7e8('0x84')])){logger[_0xa7e8('0x2f')](_0xa7e8('0x85'),_0x42ee0c['uniqueid'],_0x42ee0c[_0xa7e8('0x7e')][_0xa7e8('0x3c')](',')[0x0]);this[_0xa7e8('0x11')][_0x42ee0c[_0xa7e8('0x34')]]['queue']=_0x42ee0c[_0xa7e8('0x7e')][_0xa7e8('0x3c')](',')[0x0];}else if(this['isNotNull'](_0x42ee0c[_0xa7e8('0x7b')][_0xa7e8('0x86')])){logger[_0xa7e8('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x42ee0c[_0xa7e8('0x34')],_0x42ee0c['value']);this[_0xa7e8('0x11')][_0x42ee0c['uniqueid']][_0xa7e8('0x87')]=_0x42ee0c[_0xa7e8('0x7e')];}else if(this[_0xa7e8('0x2a')](_0x42ee0c[_0xa7e8('0x7b')][_0xa7e8('0x88')])){logger[_0xa7e8('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x42ee0c[_0xa7e8('0x34')],_0x42ee0c[_0xa7e8('0x7e')]);this['channels'][_0x42ee0c['uniqueid']]['destination']=_0x42ee0c[_0xa7e8('0x7e')];}else if(this['isNotNull'](_0x42ee0c[_0xa7e8('0x7b')]['xmd-callerid-preview'])){logger[_0xa7e8('0x2f')](_0xa7e8('0x89'),_0x42ee0c[_0xa7e8('0x34')],_0x42ee0c[_0xa7e8('0x7e')]);this[_0xa7e8('0x11')][_0x42ee0c['uniqueid']]['calleridpreview']=_0x42ee0c[_0xa7e8('0x7e')];}else if(this[_0xa7e8('0x2a')](_0x42ee0c[_0xa7e8('0x7b')][_0xa7e8('0x8a')])){logger[_0xa7e8('0x2f')](_0xa7e8('0x8b'),_0x42ee0c['uniqueid'],_0x42ee0c[_0xa7e8('0x7e')]);this[_0xa7e8('0x11')][_0x42ee0c[_0xa7e8('0x34')]][_0xa7e8('0x8')]=_0x42ee0c['value'];}else if(this[_0xa7e8('0x2a')](_0x42ee0c[_0xa7e8('0x7b')][_0xa7e8('0x8c')])){logger[_0xa7e8('0x2f')](_0xa7e8('0x8d'),_0x42ee0c['uniqueid'],_0x42ee0c[_0xa7e8('0x7e')]);this[_0xa7e8('0x11')][_0x42ee0c['uniqueid']][_0xa7e8('0x8e')]=_0x42ee0c[_0xa7e8('0x7e')];}}}else if(this[_0xa7e8('0x2a')](_0x42ee0c[_0xa7e8('0x7b')][_0xa7e8('0x7c')])){if(_0x42ee0c[_0xa7e8('0x7e')]){var _0x3de3b6=path[_0xa7e8('0x8f')](_0x42ee0c['value'])[_0xa7e8('0x4e')];logger[_0xa7e8('0x2f')](_0xa7e8('0x7d'),_0x3de3b6,_0x42ee0c[_0xa7e8('0x7e')]);this[_0xa7e8('0x72')](_0x3de3b6,_0x42ee0c[_0xa7e8('0x7e')]);}}else if(this[_0xa7e8('0x11')][_0x42ee0c[_0xa7e8('0x35')]]){if(this[_0xa7e8('0x2a')](_0x42ee0c[_0xa7e8('0x7b')])){if(this['isNotNull'](_0x42ee0c[_0xa7e8('0x7b')][_0xa7e8('0x8c')])){logger[_0xa7e8('0x2f')](_0xa7e8('0x8d'),_0x42ee0c[_0xa7e8('0x35')],_0x42ee0c[_0xa7e8('0x7e')]);this['channels'][_0x42ee0c['linkedid']][_0xa7e8('0x90')]=_0x42ee0c[_0xa7e8('0x7e')];}}}}}catch(_0x20dfed){logger[_0xa7e8('0x27')](_0xa7e8('0x91'),_0x42ee0c[_0xa7e8('0x34')],util[_0xa7e8('0x29')](_0x20dfed,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa7e8('0x2c')][_0xa7e8('0x1d')]=function(_0x2d4153){try{if(this[_0xa7e8('0x2a')](_0x2d4153)){logger[_0xa7e8('0x32')](_0xa7e8('0x92'),_0x2d4153[_0xa7e8('0x34')],util[_0xa7e8('0x29')](_0x2d4153,{'showHidden':![],'depth':null}));if(this[_0xa7e8('0x13')][_0x2d4153['linkedid']]){if(this[_0xa7e8('0x11')][this['blindTransfers'][_0x2d4153[_0xa7e8('0x35')]]['linkedid']]){this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]][_0xa7e8('0x35')]][_0xa7e8('0x34')]=_0x2d4153[_0xa7e8('0x34')];this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]][_0xa7e8('0x35')]][_0xa7e8('0x67')]=this[_0xa7e8('0x11')][_0x2d4153['uniqueid']][_0xa7e8('0x67')];this[_0xa7e8('0x11')][this['blindTransfers'][_0x2d4153[_0xa7e8('0x35')]]['linkedid']][_0xa7e8('0x6c')]=this[_0xa7e8('0x11')][_0x2d4153[_0xa7e8('0x34')]]['answertime'];this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]][_0xa7e8('0x35')]]['destinationchannel']=this['channels'][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]][_0xa7e8('0x35')]][_0xa7e8('0x3b')];this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]][_0xa7e8('0x35')]]['disposition']=this[_0xa7e8('0x11')][_0x2d4153[_0xa7e8('0x34')]]['disposition'];this[_0xa7e8('0x11')][_0x2d4153[_0xa7e8('0x34')]]=this[_0xa7e8('0x11')][this['blindTransfers'][_0x2d4153[_0xa7e8('0x35')]]['linkedid']];delete this['channels'][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]]['linkedid']];}else if(this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]][_0xa7e8('0x34')]]){this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]][_0xa7e8('0x34')]]['uniqueid']=[this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]][_0xa7e8('0x34')]][_0xa7e8('0x35')],this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]]['uniqueid']]['linkedid']=this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153['linkedid']][_0xa7e8('0x34')]][_0xa7e8('0x34')]][0x0];this['channels'][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]]['uniqueid']][_0xa7e8('0x67')]=this[_0xa7e8('0x11')][_0x2d4153['uniqueid']][_0xa7e8('0x67')];this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153['linkedid']]['uniqueid']][_0xa7e8('0x6c')]=this[_0xa7e8('0x11')][_0x2d4153[_0xa7e8('0x34')]][_0xa7e8('0x6c')];this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]][_0xa7e8('0x34')]][_0xa7e8('0x6a')]=this['channels'][this[_0xa7e8('0x13')][_0x2d4153[_0xa7e8('0x35')]][_0xa7e8('0x34')]][_0xa7e8('0x3b')];this[_0xa7e8('0x11')][this[_0xa7e8('0x13')][_0x2d4153['linkedid']][_0xa7e8('0x34')]][_0xa7e8('0x48')]=this['channels'][_0x2d4153[_0xa7e8('0x34')]][_0xa7e8('0x48')];this[_0xa7e8('0x11')][_0x2d4153['uniqueid']]=this[_0xa7e8('0x11')][this['blindTransfers'][_0x2d4153[_0xa7e8('0x35')]][_0xa7e8('0x34')]];delete this[_0xa7e8('0x11')][this['blindTransfers'][_0x2d4153[_0xa7e8('0x35')]]['uniqueid']];}}if(this[_0xa7e8('0x11')][_0x2d4153[_0xa7e8('0x34')]]){logger[_0xa7e8('0x2f')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x2d4153['uniqueid'],_0x2d4153[_0xa7e8('0x93')]);var _0x4db874=moment();this[_0xa7e8('0x11')][_0x2d4153['uniqueid']][_0xa7e8('0x94')]=_0x4db874[_0xa7e8('0x3f')](_0xa7e8('0x47'));this[_0xa7e8('0x11')][_0x2d4153[_0xa7e8('0x34')]][_0xa7e8('0x59')]=_0x4db874[_0xa7e8('0x69')](this[_0xa7e8('0x11')][_0x2d4153[_0xa7e8('0x34')]][_0xa7e8('0x58')],'seconds');if(this[_0xa7e8('0x11')][_0x2d4153['uniqueid']]['answered']){this[_0xa7e8('0x11')][_0x2d4153[_0xa7e8('0x34')]][_0xa7e8('0x95')]=_0x4db874[_0xa7e8('0x69')](this['channels'][_0x2d4153['uniqueid']][_0xa7e8('0x6c')],'seconds');this[_0xa7e8('0x11')][_0x2d4153[_0xa7e8('0x34')]]['holdtime']=this[_0xa7e8('0x11')][_0x2d4153[_0xa7e8('0x34')]][_0xa7e8('0x59')]-this[_0xa7e8('0x11')][_0x2d4153[_0xa7e8('0x34')]][_0xa7e8('0x95')];}if(_0x2d4153[_0xa7e8('0x39')]===_0xa7e8('0x3a')){if(this[_0xa7e8('0x12')][_0x2d4153[_0xa7e8('0x3b')]['split']('-')[0x0]]){this['agents'][_0x2d4153[_0xa7e8('0x3b')][_0xa7e8('0x3c')]('-')[0x0]]=_['omit'](this[_0xa7e8('0x12')][_0x2d4153[_0xa7e8('0x3b')]['split']('-')[0x0]],[_0xa7e8('0x4a')]);logger['debug'](_0xa7e8('0x96'),_0x2d4153[_0xa7e8('0x34')],util['inspect']({'id':this[_0xa7e8('0x12')][_0x2d4153[_0xa7e8('0x3b')][_0xa7e8('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xa7e8('0x12')][_0x2d4153[_0xa7e8('0x3b')][_0xa7e8('0x3c')]('-')[0x0]][_0xa7e8('0x4d')]},{'showHidden':![],'depth':null}));this[_0xa7e8('0x2d')](util[_0xa7e8('0x3f')](_0xa7e8('0x40'),this[_0xa7e8('0x12')][_0x2d4153[_0xa7e8('0x3b')][_0xa7e8('0x3c')]('-')[0x0]][_0xa7e8('0x4e')]),_0xa7e8('0x97'),{'id':this[_0xa7e8('0x12')][_0x2d4153[_0xa7e8('0x3b')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x2d4153['channel'][_0xa7e8('0x3c')]('-')[0x0]][_0xa7e8('0x4d')]});for(var _0x4b480d=0x0;_0x4b480d0x0?!![]:![];if(!_0x5af0b3){return this[_0xd46c('0x16')](this[_0xd46c('0x13')][_0xd46c('0x6e')]);}};VoiceQueueReport['prototype'][_0xd46c('0x19')]=function(_0x5736c2){var _0x3cd24b=this[_0xd46c('0x13')]['id'];if(this[_0xd46c('0x13')]['queuestatus'][_0x3cd24b]&&this[_0xd46c('0x13')][_0xd46c('0x6b')][_0x3cd24b][_0x5736c2[_0xd46c('0x62')]]){this['summary'][_0xd46c('0x6b')][_0x3cd24b][_0x5736c2['actionid']]['agents'][_0xd46c('0x6f')](_0x5736c2);}};VoiceQueueReport[_0xd46c('0x9')][_0xd46c('0x14')]=function(_0x2b89fa){var _0x1f0194=this;try{if(this[_0xd46c('0x5a')](_0x2b89fa)&&this[_0xd46c('0x5a')](_0x2b89fa[_0xd46c('0x4f')])){logger[_0xd46c('0x49')](_0xd46c('0x70'),util[_0xd46c('0x41')](_0x2b89fa,{'showHidden':![],'depth':null}));var _0x35d891=this[_0xd46c('0x6a')][_0x2b89fa[_0xd46c('0x4f')]];if(_0x35d891){logger[_0xd46c('0x49')](_0xd46c('0x71'),_0x35d891['name']);this[_0xd46c('0x13')][_0xd46c('0x5d')][_0x35d891[_0xd46c('0x65')]]={'summaryEvent':_0x2b89fa};this[_0xd46c('0x13')][_0xd46c('0x6d')]+=0x1;return ami[_0xd46c('0x5c')]({'action':_0xd46c('0x6b'),'queue':_0x35d891[_0xd46c('0x65')]})[_0xd46c('0x61')](function(_0x5cd382){if(!_0x1f0194['summary']['queuestatus'][_0x2b89fa[_0xd46c('0x62')]]){_0x1f0194[_0xd46c('0x13')][_0xd46c('0x6b')][_0x2b89fa['actionid']]={};}_0x1f0194['summary']['queuestatus'][_0x2b89fa[_0xd46c('0x62')]][_0x5cd382['actionid']]={'queue':_0x35d891[_0xd46c('0x65')],'agents':[]};})[_0xd46c('0x3e')](function(_0x47f34f){throw _0x47f34f;});}}}catch(_0x24b460){logger[_0xd46c('0x40')]('[voiceQueueReport][queuesummary]',util[_0xd46c('0x41')](_0x24b460,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd46c('0x16')]=function(_0x2f081c){if(this[_0xd46c('0x13')][_0xd46c('0x6d')]>0x0){this[_0xd46c('0x13')]['completeEvent']=_0x2f081c;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x2f081c,{'showHidden':![],'depth':null}));this[_0xd46c('0x13')]=initializeSummary();ami[_0xd46c('0x47')](_0xd46c('0x72'),{});};VoiceQueueReport['prototype'][_0xd46c('0x1d')]=function(_0x41575b){try{if(this[_0xd46c('0x5a')](_0x41575b)){logger[_0xd46c('0x49')](_0xd46c('0x73'),_0x41575b[_0xd46c('0x4c')],util[_0xd46c('0x41')](_0x41575b,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x41575b[_0xd46c('0x4c')]])){this[_0xd46c('0xe')][_0x41575b['uniqueid']]=[];}if(_[_0xd46c('0x5b')](this[_0xd46c('0x11')][_0x41575b['uniqueid']])){this[_0xd46c('0x11')][_0x41575b[_0xd46c('0x4c')]]={};}var _0x47ac01=new QueueReport();_0x47ac01[_0xd46c('0x4f')]=_0x41575b[_0xd46c('0x4f')];_0x47ac01['type']=this[_0xd46c('0x6a')][_0x47ac01['queue']]&&this['voiceQueues'][_0x47ac01['queue']]['type']?this[_0xd46c('0x6a')][_0x47ac01[_0xd46c('0x4f')]][_0xd46c('0x56')]||_0xd46c('0x57'):'inbound';_0x47ac01[_0xd46c('0x74')]=moment()[_0xd46c('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x47ac01['position']=_0x41575b[_0xd46c('0x75')];_0x47ac01[_0xd46c('0x76')]=_0x41575b[_0xd46c('0x76')];_0x47ac01[_0xd46c('0x4c')]=_0x41575b[_0xd46c('0x4c')];_0x47ac01[_0xd46c('0x77')]=this[_0xd46c('0x11')][_0x41575b[_0xd46c('0x4c')]]['routealias'];logger[_0xd46c('0x78')](_0xd46c('0x79'),_0x47ac01[_0xd46c('0x4f')],_0x47ac01['type']);Object[_0xd46c('0x69')](_0x47ac01,_['pick'](_0x41575b,_['keys'](_0x47ac01)));this['queueReports'][_0x41575b[_0xd46c('0x4c')]][_0xd46c('0x6f')](_0x47ac01);this[_0xd46c('0x11')][_0x41575b[_0xd46c('0x4c')]]=_0x47ac01;this[_0xd46c('0x48')](_0x47ac01,'queuecallerjoin');}}catch(_0x4a8a55){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x41575b['uniqueid'],util[_0xd46c('0x41')](_0x4a8a55,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd46c('0x9')][_0xd46c('0x1f')]=function(_0x12b52d){try{if(this['isNotNull'](_0x12b52d)){logger[_0xd46c('0x49')]('[%s][voiceQueueReport][queuecallerabandon]',_0x12b52d['uniqueid'],util[_0xd46c('0x41')](_0x12b52d,{'showHidden':![],'depth':null}));if(this[_0xd46c('0xe')][_0x12b52d[_0xd46c('0x4c')]]){var _0x35731e=_[_0xd46c('0x7a')](this[_0xd46c('0xe')][_0x12b52d[_0xd46c('0x4c')]]);_0x35731e[_0xd46c('0x39')]=![];_0x35731e[_0xd46c('0x7b')]=null;_0x35731e['holdtime']=_0x12b52d[_0xd46c('0x7c')];_0x35731e['originalposition']=_0x12b52d['originalposition'];_0x35731e['queuecallerabandon']=!![];_0x35731e[_0xd46c('0x7d')]=moment()[_0xd46c('0x4d')](_0xd46c('0x7e'));_0x35731e[_0xd46c('0x51')]=_0xd46c('0x7f');_0x35731e['lastAssignedTo']=null;logger['info'](_0xd46c('0x80'),_0x35731e[_0xd46c('0x4f')],_0x35731e[_0xd46c('0x56')]);this['channels'][_0x12b52d[_0xd46c('0x4c')]]=_0x35731e;this[_0xd46c('0x45')](_0x35731e,_0xd46c('0x1e'));}}}catch(_0x50e16d){logger[_0xd46c('0x40')]('[%s][voiceQueueReport][queuecallerabandon]',_0x12b52d['uniqueid'],util[_0xd46c('0x41')](_0x50e16d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd46c('0x9')][_0xd46c('0x21')]=function(_0x47a769){try{if(this[_0xd46c('0x5a')](_0x47a769)){logger['debug'](_0xd46c('0x81'),_0x47a769[_0xd46c('0x4c')],util[_0xd46c('0x41')](_0x47a769,{'showHidden':![],'depth':null}));if(this[_0xd46c('0xe')][_0x47a769[_0xd46c('0x4c')]]){var _0x35b838=_[_0xd46c('0x7a')](this[_0xd46c('0xe')][_0x47a769[_0xd46c('0x4c')]]);_0x35b838['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x35b838[_0xd46c('0x82')]=_0x47a769[_0xd46c('0x82')];_0x35b838[_0xd46c('0x83')]=_0x47a769[_0xd46c('0x83')];logger[_0xd46c('0x78')](_0xd46c('0x84'),_0x35b838[_0xd46c('0x4f')],_0x35b838[_0xd46c('0x56')],_0x47a769[_0xd46c('0x82')],_0x47a769['connectedlinename']);this[_0xd46c('0x11')][_0x47a769['uniqueid']]=_0x35b838;this[_0xd46c('0x48')](_0x35b838,_0xd46c('0x20'));}}}catch(_0x2eba9d){logger[_0xd46c('0x40')](_0xd46c('0x81'),_0x47a769[_0xd46c('0x4c')],util[_0xd46c('0x41')](_0x2eba9d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd46c('0x9')][_0xd46c('0x24')]=function(_0x3d2a58){try{if(this[_0xd46c('0x5a')](_0x3d2a58)){logger[_0xd46c('0x49')](_0xd46c('0x85'),_0x3d2a58[_0xd46c('0x4c')],util['inspect'](_0x3d2a58,{'showHidden':![],'depth':null}));if(this[_0xd46c('0xe')][_0x3d2a58[_0xd46c('0x4c')]]){var _0x164202=_[_0xd46c('0x7a')](this[_0xd46c('0xe')][_0x3d2a58[_0xd46c('0x4c')]]);_0x164202[_0xd46c('0x39')]=!![];_0x164202[_0xd46c('0x51')]=_0xd46c('0x86');logger['info'](_0xd46c('0x87'),_0x164202['queue'],_0x164202[_0xd46c('0x56')]);}}}catch(_0x19e24b){logger[_0xd46c('0x40')]('[%s][voiceQueueReport][agentconnect]',_0x3d2a58[_0xd46c('0x4c')],util[_0xd46c('0x41')](_0x19e24b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd46c('0x9')][_0xd46c('0x88')]=function(_0x37fb60){try{if(this[_0xd46c('0x5a')](_0x37fb60)){logger[_0xd46c('0x49')](_0xd46c('0x89'),_0x37fb60[_0xd46c('0x4c')],util[_0xd46c('0x41')](_0x37fb60,{'showHidden':![],'depth':null}));if(this[_0xd46c('0xe')][_0x37fb60[_0xd46c('0x4c')]]){var _0x289caf=_[_0xd46c('0x7a')](this[_0xd46c('0xe')][_0x37fb60['uniqueid']]);_0x289caf[_0xd46c('0x1e')]=![];_0x289caf['queuecallerabandonAt']=null;_0x289caf[_0xd46c('0x8a')]=!![];_0x289caf['lastAssignedTo']=_0x37fb60['membername'];_0x289caf[_0xd46c('0x7c')]=_0x37fb60[_0xd46c('0x7c')];_0x289caf[_0xd46c('0x39')]=!![];_0x289caf['queuecallerexit']=![];_0x289caf['queuecallerexitAt']=null;if(!_0x289caf[_0xd46c('0x8b')]){if(_0x37fb60['reason']==_0xd46c('0x8b')){_0x289caf[_0xd46c('0x51')]='COMPLETED';logger[_0xd46c('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x289caf['queue'],_0x289caf['type']);}else{if(_[_0xd46c('0x8c')](_0x37fb60[_0xd46c('0x3d')][_0xd46c('0x8d')](),_0xd46c('0x8e'))){if(this[_0xd46c('0xe')][_0x37fb60[_0xd46c('0x8f')]]){var _0x394216=_[_0xd46c('0x7a')](this[_0xd46c('0xe')][_0x37fb60[_0xd46c('0x8f')]]);_0x394216[_0xd46c('0x39')]=![];_0x394216[_0xd46c('0x90')]=!![];_0x394216[_0xd46c('0x91')]=moment(_0x289caf[_0xd46c('0x74')])[_0xd46c('0x92')](_0x37fb60['holdtime'],'seconds')[_0xd46c('0x4d')](_0xd46c('0x7e'));_0x394216['queuecallerexitreason']=_0xd46c('0x93');_0x394216[_0xd46c('0x8b')]=!![];_0x394216[_0xd46c('0x94')]=_0xd46c('0x95');_0x394216[_0xd46c('0x96')]=_0x37fb60[_0xd46c('0x97')];_0x394216[_0xd46c('0x98')]=_0x37fb60[_0xd46c('0x4c')];logger[_0xd46c('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x394216[_0xd46c('0x4f')],_0x394216[_0xd46c('0x56')]);var _0x53188c=this[_0xd46c('0xe')][_0x37fb60[_0xd46c('0x8f')]];this[_0xd46c('0xe')][_0x37fb60[_0xd46c('0x8f')]]=this[_0xd46c('0xe')][_0x37fb60['uniqueid']];this[_0xd46c('0xe')][_0x37fb60[_0xd46c('0x4c')]]=_0x53188c;}}else{_0x289caf[_0xd46c('0x51')]=_0xd46c('0x99')+_0x37fb60[_0xd46c('0x9a')][_0xd46c('0x9b')]();logger[_0xd46c('0x78')](_0xd46c('0x9c'),_0x289caf[_0xd46c('0x4f')],_0x289caf[_0xd46c('0x56')],_0x289caf[_0xd46c('0x51')]);}}}this[_0xd46c('0x11')][_0x37fb60[_0xd46c('0x4c')]]=_0x289caf;}}}catch(_0x8a3c53){logger[_0xd46c('0x40')](_0xd46c('0x89'),_0x37fb60[_0xd46c('0x4c')],util[_0xd46c('0x41')](_0x8a3c53,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd46c('0x9')][_0xd46c('0x26')]=function(_0x349eab){try{if(this[_0xd46c('0x5a')](_0x349eab)){logger[_0xd46c('0x49')]('[%s][voiceQueueReport][varset]',_0x349eab['uniqueid'],util['inspect'](_0x349eab,{'showHidden':![],'depth':null}));this[_0xd46c('0x9d')](_0x349eab[_0xd46c('0x4c')],_['keys'](_0x349eab['variable'])[0x0],_0x349eab[_0xd46c('0x9e')]);if(this[_0xd46c('0xe')][_0x349eab[_0xd46c('0x4c')]]){var _0x2ab320=_['last'](this[_0xd46c('0xe')][_0x349eab[_0xd46c('0x4c')]]);if(_0x2ab320){if(this[_0xd46c('0x5a')](_0x349eab[_0xd46c('0x9f')])&&this[_0xd46c('0x5a')](_0x349eab[_0xd46c('0x9f')]['queuestatus'])){switch(_0x349eab[_0xd46c('0x9e')]){case _0xd46c('0xa0'):_0x2ab320[_0xd46c('0x90')]=![];_0x2ab320['queuecallerexitAt']=null;break;case _0xd46c('0xa1'):_0x2ab320[_0xd46c('0xa2')]=_0xd46c('0xa3');_0x2ab320[_0xd46c('0x90')]=!![];_0x2ab320[_0xd46c('0x91')]=moment()[_0xd46c('0x4d')](_0xd46c('0x7e'));_0x2ab320[_0xd46c('0xa4')]=moment()[_0xd46c('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xd46c('0x49')](_0xd46c('0xa5'),_0x349eab[_0xd46c('0x4c')],util[_0xd46c('0x41')](_0x2ab320,{'showHidden':![],'depth':null}));ami[_0xd46c('0x47')](_0xd46c('0xa6'),_0x2ab320);break;default:_0x2ab320[_0xd46c('0x90')]=!![];_0x2ab320[_0xd46c('0x91')]=moment()['format'](_0xd46c('0x7e'));_0x2ab320[_0xd46c('0xa4')]=moment()[_0xd46c('0x4d')](_0xd46c('0x7e'));}_0x2ab320[_0xd46c('0x1e')]=![];_0x2ab320[_0xd46c('0x7d')]=null;_0x2ab320[_0xd46c('0x51')]=_0x349eab['value'];this[_0xd46c('0x11')][_0x349eab[_0xd46c('0x4c')]]=_0x2ab320;this['emitVoiceQueueChannelRemove'](_0x2ab320,_0xd46c('0x25'));}else if(this[_0xd46c('0x5a')](_0x349eab[_0xd46c('0x9f')])&&this[_0xd46c('0x5a')](_0x349eab[_0xd46c('0x9f')][_0xd46c('0xa7')])){if(!_0x2ab320[_0xd46c('0x1e')]){_0x2ab320[_0xd46c('0x90')]=!![];_0x2ab320[_0xd46c('0x91')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ab320['queuecallerexitreason']=_0xd46c('0xa8');_0x2ab320[_0xd46c('0xa4')]=moment()[_0xd46c('0x4d')](_0xd46c('0x7e'));this[_0xd46c('0x11')][_0x349eab[_0xd46c('0x4c')]]=_0x2ab320;}}logger[_0xd46c('0x78')](_0xd46c('0xa9'),_0x349eab[_0xd46c('0x4c')],_0x2ab320[_0xd46c('0x4f')],_0x2ab320['type'],_[_0xd46c('0xaa')](_0x349eab[_0xd46c('0x9f')])[0x0],_0x349eab[_0xd46c('0x9e')]);_0x2ab320[_0xd46c('0x42')]=this[_0xd46c('0x42')][_0x349eab[_0xd46c('0x4c')]];}}}}catch(_0x4807ac){logger[_0xd46c('0x40')](_0xd46c('0xab'),_0x349eab[_0xd46c('0x4c')],util[_0xd46c('0x41')](_0x4807ac,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd46c('0x9')][_0xd46c('0x9d')]=function(_0x1a6651,_0x3ad97b,_0x1827a1){var _0x4dd406=[_0xd46c('0xac'),_0xd46c('0xad'),_0xd46c('0xae'),_0xd46c('0xaf'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0xd46c('0xb0'),_0xd46c('0xb1'),_0xd46c('0xb2'),'bridgepeer','bridgepvtcallid',_0xd46c('0xb3'),_0xd46c('0xb4'),_0xd46c('0xb5'),_0xd46c('0xb6'),'membername',_0xd46c('0xb7'),_0xd46c('0xb8')];if(!_['isNil'](_0x3ad97b)&&!_['includes'](_0x4dd406,_0x3ad97b)){if(_[_0xd46c('0x5b')](this['variables'][_0x1a6651])){this[_0xd46c('0x42')][_0x1a6651]={};}this['variables'][_0x1a6651][_0x3ad97b]=_0x1827a1;}};VoiceQueueReport[_0xd46c('0x9')]['handleHangup']=function(_0x1dbe43,_0x4c0e04,_0x5e0848){var _0x3ee12e={};for(var _0x1a60fb=0x0;_0x1a60fb0x0?!![]:![];if(!_0x4d4096){return this[_0x8315('0x1b')](this[_0x8315('0x16')][_0x8315('0x6d')]);}};VoiceQueueReport[_0x8315('0x3c')][_0x8315('0x1d')]=function(_0x9f7b1e){var _0x2f08d0=this[_0x8315('0x16')]['id'];if(this[_0x8315('0x16')][_0x8315('0x63')][_0x2f08d0]&&this['summary']['queuestatus'][_0x2f08d0][_0x9f7b1e[_0x8315('0x62')]]){this[_0x8315('0x16')][_0x8315('0x63')][_0x2f08d0][_0x9f7b1e[_0x8315('0x62')]][_0x8315('0x12')][_0x8315('0x6e')](_0x9f7b1e);}};VoiceQueueReport[_0x8315('0x3c')][_0x8315('0x18')]=function(_0x3c6c2d){var _0x12f83d=this;try{if(this[_0x8315('0x5d')](_0x3c6c2d)&&this['isNotNull'](_0x3c6c2d[_0x8315('0x52')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x8315('0x45')](_0x3c6c2d,{'showHidden':![],'depth':null}));var _0xe9da02=this[_0x8315('0x69')][_0x3c6c2d[_0x8315('0x52')]];if(_0xe9da02){logger[_0x8315('0x4d')]('[voiceQueueReport][queuesummary]\x20name:%s',_0xe9da02[_0x8315('0x65')]);this[_0x8315('0x16')]['queues'][_0xe9da02[_0x8315('0x65')]]={'summaryEvent':_0x3c6c2d};this['summary']['statusRequests']+=0x1;return ami[_0x8315('0x3f')]({'action':_0x8315('0x63'),'queue':_0xe9da02[_0x8315('0x65')]})[_0x8315('0x61')](function(_0x5b3170){if(!_0x12f83d['summary'][_0x8315('0x63')][_0x3c6c2d['actionid']]){_0x12f83d[_0x8315('0x16')]['queuestatus'][_0x3c6c2d[_0x8315('0x62')]]={};}_0x12f83d[_0x8315('0x16')][_0x8315('0x63')][_0x3c6c2d[_0x8315('0x62')]][_0x5b3170[_0x8315('0x62')]]={'queue':_0xe9da02['name'],'agents':[]};})['catch'](function(_0x54e8c9){throw _0x54e8c9;});}}}catch(_0x1b5911){logger[_0x8315('0x43')](_0x8315('0x6f'),util['inspect'](_0x1b5911,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8315('0x3c')][_0x8315('0x1b')]=function(_0x5ca878){if(this['summary'][_0x8315('0x6c')]>0x0){this[_0x8315('0x16')][_0x8315('0x6d')]=_0x5ca878;return;}logger[_0x8315('0x4d')](_0x8315('0x70'),util[_0x8315('0x45')](_0x5ca878,{'showHidden':![],'depth':null}));this[_0x8315('0x16')]=initializeSummary();ami[_0x8315('0x4c')](_0x8315('0x71'),{});};VoiceQueueReport[_0x8315('0x3c')]['syncQueueCallerJoin']=function(_0x5839f0){try{if(this[_0x8315('0x5d')](_0x5839f0)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x5839f0[_0x8315('0x55')],util[_0x8315('0x45')](_0x5839f0,{'showHidden':![],'depth':null}));if(_[_0x8315('0x5e')](this[_0x8315('0x10')][_0x5839f0[_0x8315('0x55')]])){this[_0x8315('0x10')][_0x5839f0[_0x8315('0x55')]]=[];}if(_[_0x8315('0x5e')](this[_0x8315('0x13')][_0x5839f0['uniqueid']])){this['channels'][_0x5839f0[_0x8315('0x55')]]={};}var _0x4e1105=new QueueReport();_0x4e1105['queue']=_0x5839f0[_0x8315('0x52')];_0x4e1105['type']=this[_0x8315('0x69')][_0x4e1105['queue']]&&this[_0x8315('0x69')][_0x4e1105[_0x8315('0x52')]]['type']?this[_0x8315('0x69')][_0x4e1105[_0x8315('0x52')]][_0x8315('0x59')]||_0x8315('0x5a'):_0x8315('0x5a');_0x4e1105['queuecallerjoinAt']=moment()[_0x8315('0x50')](_0x8315('0x72'));_0x4e1105[_0x8315('0x73')]=_0x5839f0['position'];_0x4e1105[_0x8315('0x74')]=_0x5839f0[_0x8315('0x74')];_0x4e1105[_0x8315('0x55')]=_0x5839f0[_0x8315('0x55')];_0x4e1105[_0x8315('0x75')]=this[_0x8315('0x13')][_0x5839f0[_0x8315('0x55')]]['routealias'];logger[_0x8315('0x76')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4e1105[_0x8315('0x52')],_0x4e1105[_0x8315('0x59')]);Object['assign'](_0x4e1105,_[_0x8315('0x77')](_0x5839f0,_[_0x8315('0x78')](_0x4e1105)));this['queueReports'][_0x5839f0[_0x8315('0x55')]][_0x8315('0x6e')](_0x4e1105);this['channels'][_0x5839f0[_0x8315('0x55')]]=_0x4e1105;this['emitVoiceQueueChannelSave'](_0x4e1105,_0x8315('0x79'));}}catch(_0xd2dbd8){logger[_0x8315('0x43')](_0x8315('0x7a'),_0x5839f0[_0x8315('0x55')],util[_0x8315('0x45')](_0xd2dbd8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8315('0x3c')][_0x8315('0x22')]=function(_0x58eaf3){try{if(this[_0x8315('0x5d')](_0x58eaf3)){logger[_0x8315('0x4d')](_0x8315('0x7b'),_0x58eaf3[_0x8315('0x55')],util[_0x8315('0x45')](_0x58eaf3,{'showHidden':![],'depth':null}));if(this[_0x8315('0x10')][_0x58eaf3[_0x8315('0x55')]]){var _0x3130ba=_[_0x8315('0x7c')](this['queueReports'][_0x58eaf3['uniqueid']]);_0x3130ba[_0x8315('0x3b')]=![];_0x3130ba[_0x8315('0x7d')]=null;_0x3130ba[_0x8315('0x7e')]=_0x58eaf3[_0x8315('0x7e')];_0x3130ba[_0x8315('0x7f')]=_0x58eaf3['originalposition'];_0x3130ba[_0x8315('0x21')]=!![];_0x3130ba['queuecallerabandonAt']=moment()[_0x8315('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x3130ba[_0x8315('0x56')]=_0x8315('0x80');_0x3130ba[_0x8315('0x81')]=null;logger[_0x8315('0x76')](_0x8315('0x82'),_0x3130ba['queue'],_0x3130ba[_0x8315('0x59')]);this[_0x8315('0x13')][_0x58eaf3['uniqueid']]=_0x3130ba;this[_0x8315('0x4a')](_0x3130ba,_0x8315('0x21'));}}}catch(_0x518892){logger[_0x8315('0x43')](_0x8315('0x7b'),_0x58eaf3[_0x8315('0x55')],util[_0x8315('0x45')](_0x518892,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8315('0x3c')][_0x8315('0x24')]=function(_0x49ff1e){try{if(this[_0x8315('0x5d')](_0x49ff1e)){logger[_0x8315('0x4d')]('[%s][voiceQueueReport][queuecallerleave]',_0x49ff1e[_0x8315('0x55')],util[_0x8315('0x45')](_0x49ff1e,{'showHidden':![],'depth':null}));if(this[_0x8315('0x10')][_0x49ff1e[_0x8315('0x55')]]){var _0xb54424=_[_0x8315('0x7c')](this['queueReports'][_0x49ff1e[_0x8315('0x55')]]);_0xb54424[_0x8315('0x83')]=moment()[_0x8315('0x50')](_0x8315('0x72'));_0xb54424[_0x8315('0x84')]=_0x49ff1e[_0x8315('0x84')];_0xb54424[_0x8315('0x85')]=_0x49ff1e['connectedlinename'];logger['info'](_0x8315('0x86'),_0xb54424[_0x8315('0x52')],_0xb54424['type'],_0x49ff1e[_0x8315('0x84')],_0x49ff1e[_0x8315('0x85')]);this[_0x8315('0x13')][_0x49ff1e[_0x8315('0x55')]]=_0xb54424;this['emitVoiceQueueChannelSave'](_0xb54424,_0x8315('0x23'));}}}catch(_0x5834dd){logger[_0x8315('0x43')]('[%s][voiceQueueReport][queuecallerleave]',_0x49ff1e[_0x8315('0x55')],util[_0x8315('0x45')](_0x5834dd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8315('0x3c')][_0x8315('0x27')]=function(_0x23573a){try{if(this['isNotNull'](_0x23573a)){logger[_0x8315('0x4d')](_0x8315('0x87'),_0x23573a['uniqueid'],util[_0x8315('0x45')](_0x23573a,{'showHidden':![],'depth':null}));if(this[_0x8315('0x10')][_0x23573a['uniqueid']]){var _0x1bc52e=_['last'](this[_0x8315('0x10')][_0x23573a[_0x8315('0x55')]]);_0x1bc52e[_0x8315('0x3b')]=!![];_0x1bc52e[_0x8315('0x56')]=_0x8315('0x88');logger[_0x8315('0x76')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x1bc52e[_0x8315('0x52')],_0x1bc52e[_0x8315('0x59')]);}}}catch(_0x2752ba){logger[_0x8315('0x43')]('[%s][voiceQueueReport][agentconnect]',_0x23573a[_0x8315('0x55')],util[_0x8315('0x45')](_0x2752ba,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8315('0x26')]=function(_0x28acec){try{if(this[_0x8315('0x5d')](_0x28acec)){logger[_0x8315('0x4d')]('[%s][voiceQueueReport][agentcomplete]',_0x28acec[_0x8315('0x55')],util['inspect'](_0x28acec,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x28acec[_0x8315('0x55')]]){var _0xb8b369=_[_0x8315('0x7c')](this[_0x8315('0x10')][_0x28acec[_0x8315('0x55')]]);_0xb8b369[_0x8315('0x21')]=![];_0xb8b369[_0x8315('0x89')]=null;_0xb8b369[_0x8315('0x8a')]=!![];_0xb8b369[_0x8315('0x81')]=_0x28acec[_0x8315('0x8b')];_0xb8b369[_0x8315('0x7e')]=_0x28acec['holdtime'];_0xb8b369['queuecallercomplete']=!![];_0xb8b369['queuecallerexit']=![];_0xb8b369[_0x8315('0x8c')]=null;if(!_0xb8b369[_0x8315('0x8d')]){if(_0x28acec[_0x8315('0x8e')]=='transfer'){_0xb8b369[_0x8315('0x56')]=_0x8315('0x8f');logger[_0x8315('0x76')](_0x8315('0x90'),_0xb8b369[_0x8315('0x52')],_0xb8b369[_0x8315('0x59')]);}else{if(_[_0x8315('0x91')](_0x28acec[_0x8315('0x40')][_0x8315('0x92')](),_0x8315('0x93'))){if(this['queueReports'][_0x28acec[_0x8315('0x94')]]){var _0x571120=_['last'](this[_0x8315('0x10')][_0x28acec[_0x8315('0x94')]]);_0x571120['queuecallercomplete']=![];_0x571120[_0x8315('0x3a')]=!![];_0x571120[_0x8315('0x8c')]=moment(_0xb8b369['queuecallerjoinAt'])[_0x8315('0x95')](_0x28acec[_0x8315('0x7e')],_0x8315('0x96'))[_0x8315('0x50')](_0x8315('0x72'));_0x571120[_0x8315('0x56')]=_0x8315('0x97');_0x571120['transfer']=!![];_0x571120['transfertype']=_0x8315('0x98');_0x571120[_0x8315('0x99')]=_0x28acec[_0x8315('0x9a')];_0x571120[_0x8315('0x9b')]=_0x28acec[_0x8315('0x55')];logger['info'](_0x8315('0x9c'),_0x571120[_0x8315('0x52')],_0x571120[_0x8315('0x59')]);var _0xd1bac1=this[_0x8315('0x10')][_0x28acec[_0x8315('0x94')]];this['queueReports'][_0x28acec[_0x8315('0x94')]]=this['queueReports'][_0x28acec[_0x8315('0x55')]];this['queueReports'][_0x28acec['uniqueid']]=_0xd1bac1;}}else{_0xb8b369[_0x8315('0x56')]=_0x8315('0x9d')+_0x28acec['reason'][_0x8315('0x9e')]();logger['info'](_0x8315('0x9f'),_0xb8b369[_0x8315('0x52')],_0xb8b369[_0x8315('0x59')],_0xb8b369[_0x8315('0x56')]);}}}this[_0x8315('0x13')][_0x28acec[_0x8315('0x55')]]=_0xb8b369;}}}catch(_0x2f3e0e){logger[_0x8315('0x43')]('[%s][voiceQueueReport][agentcomplete]',_0x28acec['uniqueid'],util[_0x8315('0x45')](_0x2f3e0e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8315('0x29')]=function(_0x4c5e38){try{if(this[_0x8315('0x5d')](_0x4c5e38)){logger[_0x8315('0x4d')](_0x8315('0xa0'),_0x4c5e38[_0x8315('0x55')],util['inspect'](_0x4c5e38,{'showHidden':![],'depth':null}));this['addVariable'](_0x4c5e38[_0x8315('0x55')],_[_0x8315('0x78')](_0x4c5e38[_0x8315('0xa1')])[0x0],_0x4c5e38[_0x8315('0xa2')]);if(this[_0x8315('0x10')][_0x4c5e38['uniqueid']]){var _0x297348=_[_0x8315('0x7c')](this['queueReports'][_0x4c5e38['uniqueid']]);if(_0x297348){if(this[_0x8315('0x5d')](_0x4c5e38[_0x8315('0xa1')])&&this[_0x8315('0x5d')](_0x4c5e38['variable'][_0x8315('0x63')])){switch(_0x4c5e38['value']){case _0x8315('0xa3'):_0x297348[_0x8315('0x3a')]=![];_0x297348[_0x8315('0x8c')]=null;break;case _0x8315('0xa4'):_0x297348[_0x8315('0xa5')]=_0x8315('0xa6');_0x297348[_0x8315('0x3a')]=!![];_0x297348[_0x8315('0x8c')]=moment()[_0x8315('0x50')](_0x8315('0x72'));_0x297348['queuecallerleaveAt']=moment()['format'](_0x8315('0x72'));logger[_0x8315('0x4d')](_0x8315('0xa7'),_0x4c5e38['uniqueid'],util[_0x8315('0x45')](_0x297348,{'showHidden':![],'depth':null}));ami[_0x8315('0x4c')](_0x8315('0xa8'),_0x297348);break;default:_0x297348[_0x8315('0x3a')]=!![];_0x297348[_0x8315('0x8c')]=moment()[_0x8315('0x50')](_0x8315('0x72'));_0x297348[_0x8315('0x83')]=moment()[_0x8315('0x50')](_0x8315('0x72'));}_0x297348[_0x8315('0x21')]=![];_0x297348[_0x8315('0x89')]=null;_0x297348[_0x8315('0x56')]=_0x4c5e38[_0x8315('0xa2')];this[_0x8315('0x13')][_0x4c5e38['uniqueid']]=_0x297348;this[_0x8315('0x4a')](_0x297348,'varset');}else if(this[_0x8315('0x5d')](_0x4c5e38[_0x8315('0xa1')])&&this[_0x8315('0x5d')](_0x4c5e38[_0x8315('0xa1')][_0x8315('0xa9')])){if(!_0x297348[_0x8315('0x21')]){_0x297348[_0x8315('0x3a')]=!![];_0x297348[_0x8315('0x8c')]=moment()[_0x8315('0x50')](_0x8315('0x72'));_0x297348[_0x8315('0x56')]=_0x8315('0xaa');_0x297348[_0x8315('0x83')]=moment()[_0x8315('0x50')](_0x8315('0x72'));this[_0x8315('0x13')][_0x4c5e38['uniqueid']]=_0x297348;}}logger[_0x8315('0x76')](_0x8315('0xab'),_0x4c5e38[_0x8315('0x55')],_0x297348[_0x8315('0x52')],_0x297348['type'],_[_0x8315('0x78')](_0x4c5e38[_0x8315('0xa1')])[0x0],_0x4c5e38['value']);_0x297348[_0x8315('0x47')]=this[_0x8315('0x47')][_0x4c5e38[_0x8315('0x55')]];}}}}catch(_0x39cb33){logger[_0x8315('0x43')]('[%s][voiceQueueReport][varset]',_0x4c5e38[_0x8315('0x55')],util['inspect'](_0x39cb33,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8315('0x3c')][_0x8315('0xac')]=function(_0x169337,_0x4f9bb0,_0x2b2837){var _0xfa67ea=['rtpaudioqos',_0x8315('0xad'),'rtpaudioqosjitter',_0x8315('0xae'),'rtpaudioqosloss',_0x8315('0xaf'),_0x8315('0xb0'),_0x8315('0xb1'),'sipcallid',_0x8315('0xb2'),_0x8315('0xb3'),_0x8315('0xb4'),_0x8315('0xb5'),_0x8315('0xb6'),_0x8315('0xb7'),_0x8315('0xb8'),_0x8315('0x8b'),_0x8315('0xb9'),_0x8315('0xba')];if(!_[_0x8315('0x3e')](_0x4f9bb0)&&!_['includes'](_0xfa67ea,_0x4f9bb0)){if(_['isUndefined'](this[_0x8315('0x47')][_0x169337])){this[_0x8315('0x47')][_0x169337]={};}this[_0x8315('0x47')][_0x169337][_0x4f9bb0]=_0x2b2837;}};VoiceQueueReport[_0x8315('0x3c')][_0x8315('0xbb')]=function(_0x52af9b,_0x46ff35,_0x62b666){var _0x58703a={};for(var _0x45426b=0x0;_0x45426b=0x0?moment(_0x469b29[_0x9f07('0x16')])[_0x9f07('0xd')](_0x469b29['starttime'],_0x9f07('0xe')):null,'data1':_0x9f07('0x18'),'data2':_0x469b29[_0x9f07('0x13')],'data3':_0x469b29['exten'],'data4':_0x469b29[_0x9f07('0x19')]||null,'role':_0x9f07('0x12'),'internal':_0x469b29['accountcode']?_[_0x9f07('0x1a')](_0x469b29[_0x9f07('0x13')]):undefined,'uniqueid':_0x469b29[_0x9f07('0x1b')]},'log':_0x9f07('0x5')});}; \ No newline at end of file +var _0x574a=['membername','starttime','endtime','outbound','dialstring','agent','toNumber','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','accountcode','uniqueid','voiceDialReport'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x574a,0x129));var _0xa574=function(_0x2e3ec4,_0x220b08){_0x2e3ec4=_0x2e3ec4-0x0;var _0x2c95d8=_0x574a[_0x2e3ec4];return _0x2c95d8;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0xa574('0x0'));var client=require(_0xa574('0x1'));exports[_0xa574('0x2')]=function(_0x459635){var _0x8168ed=_0x459635[_0xa574('0x3')]||_0x459635[_0xa574('0x4')];return client[_0xa574('0x5')](_0xa574('0x6'),{'body':{'channel':_0xa574('0x7'),'membername':_0x459635[_0xa574('0x8')],'interface':_[_0xa574('0x9')](_0x459635[_0xa574('0xa')])?util[_0xa574('0xb')]('SIP/%s',_0x459635['lastAssignedTo']):_0x459635[_0xa574('0xa')],'type':_0xa574('0xc'),'enterAt':_0x459635[_0xa574('0xd')],'exitAt':_0x8168ed,'duration':moment(_0x8168ed)[_0xa574('0xe')](_0x459635[_0xa574('0xd')],_0xa574('0xf')),'data1':'inbound','data2':_0x459635[_0xa574('0x10')],'data3':_0x459635[_0xa574('0x11')],'data4':null,'data5':_0x459635[_0xa574('0x12')],'role':'agent','internal':_0x459635[_0xa574('0x13')]?_['toNumber'](_0x459635[_0xa574('0x13')]):undefined,'uniqueid':_0x459635[_0xa574('0x14')]},'log':_0xa574('0x6')});};exports[_0xa574('0x15')]=function(_0x811d35){return client[_0xa574('0x5')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x811d35[_0xa574('0x16')],'interface':_0x811d35['interface'],'type':_0xa574('0xc'),'enterAt':_0x811d35[_0xa574('0x17')],'exitAt':_0x811d35[_0xa574('0x18')],'duration':moment(_0x811d35[_0xa574('0x18')])['diff'](_0x811d35[_0xa574('0x17')],_0xa574('0xf'))>=0x0?moment(_0x811d35[_0xa574('0x18')])[_0xa574('0xe')](_0x811d35[_0xa574('0x17')],'seconds'):null,'data1':_0xa574('0x19'),'data2':_0x811d35['accountcode'],'data3':_0x811d35[_0xa574('0x11')],'data4':_0x811d35[_0xa574('0x1a')]||null,'role':_0xa574('0x1b'),'internal':_0x811d35[_0xa574('0x13')]?_[_0xa574('0x1c')](_0x811d35['accountcode']):undefined,'uniqueid':_0x811d35['uniqueid']},'log':_0xa574('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 63743ae..5d58faf 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 _0xd33c=['stopRecordingOnTransfer','GetSettings','../client','getSettings','ShowSetting'];(function(_0x256b85,_0x107b78){var _0x480f65=function(_0x45d024){while(--_0x45d024){_0x256b85['push'](_0x256b85['shift']());}};_0x480f65(++_0x107b78);}(_0xd33c,0x115));var _0xcd33=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xd33c[_0x2dea24];return _0x309d58;};'use strict';var client=require(_0xcd33('0x0'));exports[_0xcd33('0x1')]=function(){return client['Request'](_0xcd33('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xcd33('0x3'),'previewRecallmeReminderInterval']},'log':_0xcd33('0x4')});}; \ No newline at end of file +var _0x4977=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x35d79d,_0x2defc7){var _0x1a4a88=function(_0x5f00f3){while(--_0x5f00f3){_0x35d79d['push'](_0x35d79d['shift']());}};_0x1a4a88(++_0x2defc7);}(_0x4977,0x1cd));var _0x7497=function(_0x529145,_0x322da4){_0x529145=_0x529145-0x0;var _0x41855d=_0x4977[_0x529145];return _0x41855d;};'use strict';var client=require(_0x7497('0x0'));exports[_0x7497('0x1')]=function(){return client[_0x7497('0x2')](_0x7497('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7497('0x4'),'previewRecallmeReminderInterval']},'log':_0x7497('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 92ba9ca..29ffabc 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 _0x34ae=['Request','GetTemplate','name','html','getTemplates'];(function(_0x198a74,_0x5aa342){var _0x164b69=function(_0x7b19ae){while(--_0x7b19ae){_0x198a74['push'](_0x198a74['shift']());}};_0x164b69(++_0x5aa342);}(_0x34ae,0x185));var _0xe34a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34ae[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xe34a('0x0')]=function(_0x33d6fd){return function(_0x3b5f77){return client[_0xe34a('0x1')](_0xe34a('0x2'),{'options':{'raw':!![],'attributes':['id',_0xe34a('0x3'),_0xe34a('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xadf3=['Request','name','html','GetTemplate','../client','getTemplates'];(function(_0x6b8339,_0x24527b){var _0x413be6=function(_0x2144e5){while(--_0x2144e5){_0x6b8339['push'](_0x6b8339['shift']());}};_0x413be6(++_0x24527b);}(_0xadf3,0xd0));var _0x3adf=function(_0x3fdfa7,_0x3743bc){_0x3fdfa7=_0x3fdfa7-0x0;var _0x47bacc=_0xadf3[_0x3fdfa7];return _0x47bacc;};'use strict';var client=require(_0x3adf('0x0'));exports[_0x3adf('0x1')]=function(_0x56db53){return function(_0x18ad3f){return client[_0x3adf('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x3adf('0x3'),_0x3adf('0x4')]},'log':_0x3adf('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 2a1d5da..c0bcb00 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 _0x2395=['field','operator','AnyConditions','value','Action','Actions','action','data1','data2','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition'];(function(_0x4fcc5e,_0x385b40){var _0x119c46=function(_0x44da01){while(--_0x44da01){_0x4fcc5e['push'](_0x4fcc5e['shift']());}};_0x119c46(++_0x385b40);}(_0x2395,0x1b0));var _0x5239=function(_0xe92087,_0x1afa9c){_0xe92087=_0xe92087-0x0;var _0x5dae94=_0x2395[_0xe92087];return _0x5dae94;};'use strict';var client=require(_0x5239('0x0'));exports[_0x5239('0x1')]=function(_0x3d3064){return function(_0x5b357){return client[_0x5239('0x2')](_0x5239('0x3'),{'options':{'raw':![],'attributes':['id',_0x5239('0x4'),_0x5239('0x5'),_0x5239('0x6')],'include':[{'model':_0x5239('0x7'),'as':'AllConditions','attributes':['id',_0x5239('0x8'),_0x5239('0x9'),'value']},{'model':'Condition','as':_0x5239('0xa'),'attributes':['id',_0x5239('0x8'),'operator',_0x5239('0xb')]},{'model':_0x5239('0xc'),'as':_0x5239('0xd'),'attributes':['id',_0x5239('0xe'),_0x5239('0xf'),_0x5239('0x10'),'data3','data4',_0x5239('0x11'),_0x5239('0x12'),_0x5239('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x4600=['data7','GetTrigger','../client','Request','name','channel','status','Condition','AllConditions','field','operator','value','Action','action','data1','data2','data4','data5'];(function(_0x5da72f,_0x393cda){var _0x2e4a0d=function(_0x45c8bf){while(--_0x45c8bf){_0x5da72f['push'](_0x5da72f['shift']());}};_0x2e4a0d(++_0x393cda);}(_0x4600,0xc8));var _0x0460=function(_0x4ad51a,_0x3bf1cd){_0x4ad51a=_0x4ad51a-0x0;var _0x3d714f=_0x4600[_0x4ad51a];return _0x3d714f;};'use strict';var client=require(_0x0460('0x0'));exports['getTriggers']=function(_0xcef2a7){return function(_0x32acbe){return client[_0x0460('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x0460('0x2'),_0x0460('0x3'),_0x0460('0x4')],'include':[{'model':_0x0460('0x5'),'as':_0x0460('0x6'),'attributes':['id',_0x0460('0x7'),_0x0460('0x8'),_0x0460('0x9')]},{'model':_0x0460('0x5'),'as':'AnyConditions','attributes':['id',_0x0460('0x7'),'operator','value']},{'model':_0x0460('0xa'),'as':'Actions','attributes':['id',_0x0460('0xb'),_0x0460('0xc'),_0x0460('0xd'),'data3',_0x0460('0xe'),_0x0460('0xf'),'data6',_0x0460('0x10')]}]},'log':_0x0460('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 5fbcadd..a7520eb 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 _0xde94=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x562ec2,_0x390987){var _0x3f7925=function(_0x3c7bc1){while(--_0x3c7bc1){_0x562ec2['push'](_0x562ec2['shift']());}};_0x3f7925(++_0x390987);}(_0xde94,0x134));var _0x4de9=function(_0xc9f9e3,_0x25b8d1){_0xc9f9e3=_0xc9f9e3-0x0;var _0x2cd70c=_0xde94[_0xc9f9e3];return _0x2cd70c;};'use strict';var client=require(_0x4de9('0x0'));exports[_0x4de9('0x1')]=function(_0x295280){return function(_0x20fb77){return client[_0x4de9('0x2')](_0x4de9('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4de9('0x4'),_0x4de9('0x5'),_0x4de9('0x6')]},'log':_0x4de9('0x3')});};}; \ No newline at end of file +var _0x7793=['getTrunks','Request','registry','defaultuser'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x7793,0x120));var _0x3779=function(_0x41bba4,_0x18d5fb){_0x41bba4=_0x41bba4-0x0;var _0x4bb4aa=_0x7793[_0x41bba4];return _0x4bb4aa;};'use strict';var client=require('../client');exports[_0x3779('0x0')]=function(_0x30b716){return function(_0x5742e8){return client[_0x3779('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x3779('0x2'),_0x3779('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7fae3d9..e30186d 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe706,0xa3));var _0x6e70=function(_0x21a1a6,_0x1474bf){_0x21a1a6=_0x21a1a6-0x0;var _0x5cec0e=_0xe706[_0x21a1a6];return _0x5cec0e;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x58ff04,_0x172b1e){var _0x464257=function(_0x3227af){while(--_0x3227af){_0x58ff04['push'](_0x58ff04['shift']());}};_0x464257(++_0x172b1e);}(_0x34e8,0x12c));var _0x834e=function(_0x2b0bc2,_0x58e1e0){_0x2b0bc2=_0x2b0bc2-0x0;var _0x57000b=_0x34e8[_0x2b0bc2];return _0x57000b;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 3a40a11..611f8f8 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 _0xc359=['Request','CreateVoiceAgentReport','update','../client','create'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xc359,0x120));var _0x9c35=function(_0x1d6914,_0x2f6a85){_0x1d6914=_0x1d6914-0x0;var _0x511d10=_0xc359[_0x1d6914];return _0x511d10;};'use strict';var client=require(_0x9c35('0x0'));exports[_0x9c35('0x1')]=function(_0x65e4c2){return client[_0x9c35('0x2')](_0x9c35('0x3'),{'body':_0x65e4c2,'log':_0x9c35('0x3')});};exports[_0x9c35('0x4')]=function(_0x21896f,_0x5ecdb8,_0x48f9d0){return client['Request']('UpdateVoiceAgentReport',{'body':_0x21896f,'options':{'where':{'uniqueid':_0x5ecdb8,'interface':_0x48f9d0,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x64a8=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x2a4b5a,_0x382d80){var _0x18ad1d=function(_0x3196c0){while(--_0x3196c0){_0x2a4b5a['push'](_0x2a4b5a['shift']());}};_0x18ad1d(++_0x382d80);}(_0x64a8,0x16a));var _0x864a=function(_0x418ed2,_0x4b7d36){_0x418ed2=_0x418ed2-0x0;var _0x494652=_0x64a8[_0x418ed2];return _0x494652;};'use strict';var client=require(_0x864a('0x0'));exports[_0x864a('0x1')]=function(_0x8110af){return client[_0x864a('0x2')](_0x864a('0x3'),{'body':_0x8110af,'log':'CreateVoiceAgentReport'});};exports[_0x864a('0x4')]=function(_0x13ec07,_0x38369f,_0x50954c){return client['Request']('UpdateVoiceAgentReport',{'body':_0x13ec07,'options':{'where':{'uniqueid':_0x38369f,'interface':_0x50954c,'agentcomplete':!![]}},'log':_0x864a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 6679445..5ee9b23 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 _0x0605=['calleridnum','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','GetVoiceCallReports','moment','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0x17558c,_0x27a4ad){var _0xa5ff1d=function(_0x291e00){while(--_0x291e00){_0x17558c['push'](_0x17558c['shift']());}};_0xa5ff1d(++_0x27a4ad);}(_0x0605,0x192));var _0x5060=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x0605[_0x138f59];return _0x3d114d;};'use strict';var moment=require(_0x5060('0x0'));var util=require('util');var _=require('lodash');var client=require(_0x5060('0x1'));exports[_0x5060('0x2')]=function(_0x3ff918){return client[_0x5060('0x3')](_0x5060('0x4'),{'body':_[_0x5060('0x5')](_0x3ff918,{'source':_0x3ff918[_0x5060('0x6')],'destinationcontext':_0x3ff918['context'],'callerid':_0x3ff918['callerid'],'amaflags':_0x5060('0x7')}),'log':_0x5060('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x5060('0x8'),{'options':{'where':{'type':[_0x5060('0x9')],'createdAt':{'$between':[moment()[_0x5060('0xa')](_0x5060('0xb'))[_0x5060('0xc')](_0x5060('0xd')),moment()['endOf'](_0x5060('0xb'))[_0x5060('0xc')](_0x5060('0xd'))]}},'attributes':[_0x5060('0xe'),'disposition',_0x5060('0xf'),'billableseconds']},'log':_0x5060('0x10')});};}; \ No newline at end of file +var _0x84bb=['GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','billableseconds','GetVoiceCallReports','moment','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports'];(function(_0x584c64,_0x255610){var _0x3d22c0=function(_0x1ef0c6){while(--_0x1ef0c6){_0x584c64['push'](_0x584c64['shift']());}};_0x3d22c0(++_0x255610);}(_0x84bb,0x122));var _0xb84b=function(_0x1bb9a3,_0x11d873){_0x1bb9a3=_0x1bb9a3-0x0;var _0x36e207=_0x84bb[_0x1bb9a3];return _0x36e207;};'use strict';var moment=require(_0xb84b('0x0'));var util=require('util');var _=require('lodash');var client=require('../client');exports[_0xb84b('0x1')]=function(_0x17aa24){return client[_0xb84b('0x2')]('CreateVoiceCallReport',{'body':_[_0xb84b('0x3')](_0x17aa24,{'source':_0x17aa24[_0xb84b('0x4')],'destinationcontext':_0x17aa24[_0xb84b('0x5')],'callerid':_0x17aa24[_0xb84b('0x6')],'amaflags':_0xb84b('0x7')}),'log':_0xb84b('0x8')});};exports[_0xb84b('0x9')]=function(){return function(){return client[_0xb84b('0x2')](_0xb84b('0xa'),{'options':{'where':{'type':[_0xb84b('0xb')],'createdAt':{'$between':[moment()[_0xb84b('0xc')](_0xb84b('0xd'))[_0xb84b('0xe')](_0xb84b('0xf')),moment()[_0xb84b('0x10')](_0xb84b('0xd'))[_0xb84b('0xe')](_0xb84b('0xf'))]}},'attributes':['type',_0xb84b('0x11'),'duration',_0xb84b('0x12')]},'log':_0xb84b('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8829f0d..2f7cf73 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 _0x37da=['Request','CreateVoiceDialReport','../client'];(function(_0x2a0adc,_0xecd1e9){var _0x16d5c8=function(_0x58941b){while(--_0x58941b){_0x2a0adc['push'](_0x2a0adc['shift']());}};_0x16d5c8(++_0xecd1e9);}(_0x37da,0x125));var _0xa37d=function(_0x4b0003,_0x29b46b){_0x4b0003=_0x4b0003-0x0;var _0x1282af=_0x37da[_0x4b0003];return _0x1282af;};'use strict';var client=require(_0xa37d('0x0'));exports['create']=function(_0x1f6281){return client[_0xa37d('0x1')](_0xa37d('0x2'),{'body':_0x1f6281,'log':_0xa37d('0x2')});}; \ No newline at end of file +var _0x9353=['../client','create','Request','CreateVoiceDialReport'];(function(_0x2fe285,_0x380780){var _0x3e525a=function(_0x2f63b0){while(--_0x2f63b0){_0x2fe285['push'](_0x2fe285['shift']());}};_0x3e525a(++_0x380780);}(_0x9353,0xe8));var _0x3935=function(_0x9b42c4,_0x2960de){_0x9b42c4=_0x9b42c4-0x0;var _0x5c7756=_0x9353[_0x9b42c4];return _0x5c7756;};'use strict';var client=require(_0x3935('0x0'));exports[_0x3935('0x1')]=function(_0x11e53b){return client[_0x3935('0x2')](_0x3935('0x3'),{'body':_0x11e53b,'log':_0x3935('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2484697..c314fd8 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 _0x8eeb=['recordingFormat','getVoiceExtensions','../client','Request','GetVoiceExtension'];(function(_0x40d304,_0x5ef81d){var _0x53217f=function(_0x4b2621){while(--_0x4b2621){_0x40d304['push'](_0x40d304['shift']());}};_0x53217f(++_0x5ef81d);}(_0x8eeb,0x183));var _0xb8ee=function(_0x15935f,_0x45b48d){_0x15935f=_0x15935f-0x0;var _0x4ac8b4=_0x8eeb[_0x15935f];return _0x4ac8b4;};'use strict';var client=require(_0xb8ee('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xb8ee('0x1')](_0xb8ee('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xb8ee('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xb8ee('0x4')});};}; \ No newline at end of file +var _0x803f=['../client','Request','GetVoiceExtension','recordingFormat','getVoiceExtensions'];(function(_0x3a804d,_0x4688b9){var _0x36caaa=function(_0x5188ee){while(--_0x5188ee){_0x3a804d['push'](_0x3a804d['shift']());}};_0x36caaa(++_0x4688b9);}(_0x803f,0x64));var _0xf803=function(_0x253eb9,_0x19173){_0x253eb9=_0x253eb9-0x0;var _0x24b099=_0x803f[_0x253eb9];return _0x24b099;};'use strict';var client=require(_0xf803('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xf803('0x1')](_0xf803('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0xf803('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xf803('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 1514a48..dcd0027 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 _0x2467=['dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','name','acw','autopause','monitor_format','type','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition'];(function(_0x14ab28,_0x35bab6){var _0x2d46a9=function(_0x139d92){while(--_0x139d92){_0x14ab28['push'](_0x14ab28['shift']());}};_0x2d46a9(++_0x35bab6);}(_0x2467,0xfc));var _0x7246=function(_0x2a9e43,_0x260b8d){_0x2a9e43=_0x2a9e43-0x0;var _0x1846c4=_0x2467[_0x2a9e43];return _0x1846c4;};'use strict';var client=require(_0x7246('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x7246('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x7246('0x2'),_0x7246('0x3'),'acwTimeout',_0x7246('0x4'),_0x7246('0x5'),_0x7246('0x6'),'dialActive',_0x7246('0x7'),'dialLimitChannel','dialLimitQueue',_0x7246('0x8'),_0x7246('0x9'),_0x7246('0xa'),_0x7246('0xb'),'dialOriginateCallerIdName',_0x7246('0xc'),_0x7246('0xd'),_0x7246('0xe'),'dialQueueTimeout',_0x7246('0xf'),_0x7246('0x10'),_0x7246('0x11'),'dialBusyMaxRetry',_0x7246('0x12'),_0x7246('0x13'),_0x7246('0x14'),_0x7246('0x15'),_0x7246('0x16'),_0x7246('0x17'),'dialPrefix','dialCheckDuplicateType',_0x7246('0x18'),_0x7246('0x19'),_0x7246('0x1a'),_0x7246('0x1b'),_0x7246('0x1c'),'dialAMDMinWordLength',_0x7246('0x1d'),_0x7246('0x1e'),_0x7246('0x1f'),_0x7246('0x20'),_0x7246('0x21'),'dialRecallMeTimeout','dialRecallInQueue',_0x7246('0x22'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x7246('0x23'),'monitor_format',_0x7246('0x24'),_0x7246('0x25'),_0x7246('0x26'),_0x7246('0x27'),'dialNoSuchNumberRetryFrequency',_0x7246('0x28'),_0x7246('0x29'),_0x7246('0x2a'),_0x7246('0x2b'),'dialMachineMaxRetry',_0x7246('0x2c'),_0x7246('0x2d'),_0x7246('0x2e'),_0x7246('0x2f'),'dialPredictiveIntervalMaxThreshold',_0x7246('0x30'),_0x7246('0x31'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x7246('0x32'),'as':_0x7246('0x32'),'attributes':['id','name',_0x7246('0x33'),_0x7246('0x34')]},{'model':_0x7246('0x35'),'as':_0x7246('0x36'),'attributes':['id',_0x7246('0x2')]},{'model':_0x7246('0x32'),'as':_0x7246('0x37'),'attributes':['id',_0x7246('0x2'),'callerid',_0x7246('0x34')]},{'model':_0x7246('0x38'),'as':_0x7246('0x38'),'attributes':['id',_0x7246('0x2')],'include':[{'model':_0x7246('0x38'),'as':_0x7246('0x39'),'attributes':['id',_0x7246('0x2'),_0x7246('0x3a')]}]}]},'log':_0x7246('0x3b')});};}; \ No newline at end of file +var _0x77fe=['dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','name','TrunkBackup','callerid','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x77fe,0x9b));var _0xe77f=function(_0x102469,_0x3af853){_0x102469=_0x102469-0x0;var _0x57cd31=_0x77fe[_0x102469];return _0x57cd31;};'use strict';var client=require(_0xe77f('0x0'));exports[_0xe77f('0x1')]=function(){return function(){return client[_0xe77f('0x2')](_0xe77f('0x3'),{'options':{'raw':![],'attributes':['id','name','acw','acwTimeout',_0xe77f('0x4'),_0xe77f('0x5'),_0xe77f('0x6'),_0xe77f('0x7'),_0xe77f('0x8'),_0xe77f('0x9'),_0xe77f('0xa'),_0xe77f('0xb'),_0xe77f('0xc'),_0xe77f('0xd'),'dialPredictiveInterval','dialOriginateCallerIdName',_0xe77f('0xe'),_0xe77f('0xf'),_0xe77f('0x10'),_0xe77f('0x11'),_0xe77f('0x12'),_0xe77f('0x13'),_0xe77f('0x14'),_0xe77f('0x15'),_0xe77f('0x16'),_0xe77f('0x17'),_0xe77f('0x18'),_0xe77f('0x19'),_0xe77f('0x1a'),'dialGlobalInterval',_0xe77f('0x1b'),_0xe77f('0x1c'),_0xe77f('0x1d'),_0xe77f('0x1e'),_0xe77f('0x1f'),_0xe77f('0x20'),_0xe77f('0x21'),_0xe77f('0x22'),_0xe77f('0x23'),'dialAMDMaximumNumberOfWords',_0xe77f('0x24'),_0xe77f('0x25'),_0xe77f('0x26'),_0xe77f('0x27'),'dialRecallInQueue',_0xe77f('0x28'),_0xe77f('0x29'),_0xe77f('0x2a'),_0xe77f('0x2b'),_0xe77f('0x5'),_0xe77f('0x2c'),_0xe77f('0x2d'),'dialCutDigit',_0xe77f('0x2e'),'dialNoSuchNumberRetryFrequency',_0xe77f('0x2f'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0xe77f('0x30'),_0xe77f('0x31'),'dialMachineRetryFrequency',_0xe77f('0x32'),'dialAgentRejectRetryFrequency',_0xe77f('0x33'),_0xe77f('0x34'),_0xe77f('0x35'),_0xe77f('0x36'),_0xe77f('0x37')],'include':[{'model':_0xe77f('0x38'),'as':_0xe77f('0x38'),'attributes':['id','name','callerid',_0xe77f('0x39')]},{'model':_0xe77f('0x3a'),'as':_0xe77f('0x3b'),'attributes':['id',_0xe77f('0x3c')]},{'model':_0xe77f('0x38'),'as':_0xe77f('0x3d'),'attributes':['id',_0xe77f('0x3c'),_0xe77f('0x3e'),_0xe77f('0x39')]},{'model':_0xe77f('0x3f'),'as':_0xe77f('0x3f'),'attributes':['id',_0xe77f('0x3c')],'include':[{'model':_0xe77f('0x3f'),'as':_0xe77f('0x40'),'attributes':['id',_0xe77f('0x3c'),_0xe77f('0x41')]}]}]},'log':_0xe77f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 7f7e1a5..f1fca7b 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(_0x53ed0c,_0x2743e5){var _0x592818=function(_0x5226cc){while(--_0x5226cc){_0x53ed0c['push'](_0x53ed0c['shift']());}};_0x592818(++_0x2743e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0xff3756,_0x4fabf8){var _0x50a000=function(_0x18d4bd){while(--_0x18d4bd){_0xff3756['push'](_0xff3756['shift']());}};_0x50a000(++_0x4fabf8);}(_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 diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 6346a04..6c89fb4 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 _0x1cff=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1cff,0x116));var _0xf1cf=function(_0x840e5d,_0x541300){_0x840e5d=_0x840e5d-0x0;var _0x12cb1a=_0x1cff[_0x840e5d];return _0x12cb1a;};'use strict';var client=require(_0xf1cf('0x0'));exports['getVoiceQueueRtPauses']=function(_0x337f06){return function(){return client[_0xf1cf('0x1')](_0xf1cf('0x2'),{'options':{'where':{'VoiceQueueId':_0x337f06,'paused':!![]},'raw':!![]},'log':_0xf1cf('0x3')});};}; \ No newline at end of file +var _0xe2af=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0xf8cb67,_0x23e5d5){var _0x3067f5=function(_0x2a38cd){while(--_0x2a38cd){_0xf8cb67['push'](_0xf8cb67['shift']());}};_0x3067f5(++_0x23e5d5);}(_0xe2af,0x79));var _0xfe2a=function(_0x2c964c,_0x4eee45){_0x2c964c=_0x2c964c-0x0;var _0x5bfb5a=_0xe2af[_0x2c964c];return _0x5bfb5a;};'use strict';var client=require('../client');exports[_0xfe2a('0x0')]=function(_0x3d3c58){return function(){return client[_0xfe2a('0x1')](_0xfe2a('0x2'),{'options':{'where':{'VoiceQueueId':_0x3d3c58,'paused':!![]},'raw':!![]},'log':_0xfe2a('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 9aaad14..1616a34 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(_0x12267f,_0x3b1a45){var _0x4f028b=function(_0x26defe){while(--_0x26defe){_0x12267f['push'](_0x12267f['shift']());}};_0x4f028b(++_0x3b1a45);}(_0x7a54,0x106));var _0x47a5=function(_0x4b4df2,_0x4ac0eb){_0x4b4df2=_0x4b4df2-0x0;var _0x391b99=_0x7a54[_0x4b4df2];return _0x391b99;};'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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x117c2b,_0x8f8dc5){var _0x31e347=function(_0x549110){while(--_0x549110){_0x117c2b['push'](_0x117c2b['shift']());}};_0x31e347(++_0x8f8dc5);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index a3a8b65..6fd565f 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 _0x854a=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x854a,0x13a));var _0xa854=function(_0x558a02,_0x1093fd){_0x558a02=_0x558a02-0x0;var _0x4d78e5=_0x854a[_0x558a02];return _0x4d78e5;};'use strict';var client=require(_0xa854('0x0'));exports[_0xa854('0x1')]={};exports[_0xa854('0x2')]=function(_0x1636ee){return client[_0xa854('0x3')](_0xa854('0x4'),{'body':{'result':_0x1636ee['result'],'transfererchannel':_0x1636ee[_0xa854('0x5')],'transferercalleridnum':_0x1636ee[_0xa854('0x6')],'transferercalleridname':_0x1636ee[_0xa854('0x7')],'transfererconnectedlinenum':_0x1636ee[_0xa854('0x8')],'transfererconnectedlinename':_0x1636ee[_0xa854('0x9')],'transfereraccountcode':_0x1636ee['transfereraccountcode'],'transferercontext':_0x1636ee[_0xa854('0xa')],'transfererexten':_0x1636ee[_0xa854('0xb')],'transfererlinkedid':_0x1636ee['transfererlinkedid'],'transfereechannel':_0x1636ee[_0xa854('0xc')],'transfereecalleridnum':_0x1636ee[_0xa854('0xd')],'transfereecalleridname':_0x1636ee[_0xa854('0xe')],'transfereeconnectedlinenum':_0x1636ee[_0xa854('0xf')],'transfereeconnectedlinename':_0x1636ee[_0xa854('0x10')],'transfereeaccountcode':_0x1636ee['transfereeaccountcode'],'transfereecontext':_0x1636ee[_0xa854('0x11')],'transfereeexten':_0x1636ee[_0xa854('0x12')],'transfereelinkedid':_0x1636ee[_0xa854('0x13')],'isexternal':_0x1636ee[_0xa854('0x14')],'context':_0x1636ee[_0xa854('0x15')],'extension':_0x1636ee[_0xa854('0x16')],'type':_0xa854('0x17')},'log':_0xa854('0x4')});};exports[_0xa854('0x18')]=function(_0x20ffac){return client[_0xa854('0x3')](_0xa854('0x4'),{'body':{'result':_0x20ffac[_0xa854('0x19')],'transfererchannel':_0x20ffac[_0xa854('0x1a')],'transferercalleridnum':_0x20ffac[_0xa854('0x1b')],'transferercalleridname':_0x20ffac['origtransferercalleridname'],'transfererconnectedlinenum':_0x20ffac[_0xa854('0x1c')],'transfererconnectedlinename':_0x20ffac[_0xa854('0x1d')],'transfereraccountcode':_0x20ffac[_0xa854('0x1e')],'transferercontext':_0x20ffac[_0xa854('0x1f')],'transfererexten':_0x20ffac[_0xa854('0x20')],'transfererlinkedid':_0x20ffac[_0xa854('0x21')],'transfereechannel':_0x20ffac[_0xa854('0x22')],'transfereecalleridnum':_0x20ffac['transfertargetcalleridnum'],'transfereecalleridname':_0x20ffac['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x20ffac[_0xa854('0x23')],'transfereeconnectedlinename':_0x20ffac[_0xa854('0x24')],'transfereeaccountcode':_0x20ffac[_0xa854('0x25')],'transfereecontext':_0x20ffac[_0xa854('0x26')],'transfereeexten':_0x20ffac[_0xa854('0x27')],'transfereelinkedid':_0x20ffac[_0xa854('0x28')],'isexternal':_0x20ffac[_0xa854('0x14')],'context':_0x20ffac[_0xa854('0x29')],'extension':_0x20ffac[_0xa854('0x2a')],'type':_0xa854('0x2b')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x3efe=['origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','attended','transfers','blindTransfer','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','isexternal','context','extension','attendedTransfer','Request','origtransfererchannel'];(function(_0x261304,_0x2754c3){var _0x4231a6=function(_0x18fa3d){while(--_0x18fa3d){_0x261304['push'](_0x261304['shift']());}};_0x4231a6(++_0x2754c3);}(_0x3efe,0x99));var _0xe3ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3efe[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xe3ef('0x0')]={};exports[_0xe3ef('0x1')]=function(_0x354c11){return client['Request'](_0xe3ef('0x2'),{'body':{'result':_0x354c11[_0xe3ef('0x3')],'transfererchannel':_0x354c11['transfererchannel'],'transferercalleridnum':_0x354c11['transferercalleridnum'],'transferercalleridname':_0x354c11[_0xe3ef('0x4')],'transfererconnectedlinenum':_0x354c11[_0xe3ef('0x5')],'transfererconnectedlinename':_0x354c11[_0xe3ef('0x6')],'transfereraccountcode':_0x354c11[_0xe3ef('0x7')],'transferercontext':_0x354c11[_0xe3ef('0x8')],'transfererexten':_0x354c11[_0xe3ef('0x9')],'transfererlinkedid':_0x354c11[_0xe3ef('0xa')],'transfereechannel':_0x354c11[_0xe3ef('0xb')],'transfereecalleridnum':_0x354c11[_0xe3ef('0xc')],'transfereecalleridname':_0x354c11[_0xe3ef('0xd')],'transfereeconnectedlinenum':_0x354c11['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x354c11['transfereeconnectedlinename'],'transfereeaccountcode':_0x354c11[_0xe3ef('0xe')],'transfereecontext':_0x354c11[_0xe3ef('0xf')],'transfereeexten':_0x354c11['transfereeexten'],'transfereelinkedid':_0x354c11['transfereelinkedid'],'isexternal':_0x354c11[_0xe3ef('0x10')],'context':_0x354c11[_0xe3ef('0x11')],'extension':_0x354c11[_0xe3ef('0x12')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0xe3ef('0x13')]=function(_0x4de5f1){return client[_0xe3ef('0x14')]('CreateVoiceTransferReport',{'body':{'result':_0x4de5f1['result'],'transfererchannel':_0x4de5f1[_0xe3ef('0x15')],'transferercalleridnum':_0x4de5f1[_0xe3ef('0x16')],'transferercalleridname':_0x4de5f1[_0xe3ef('0x17')],'transfererconnectedlinenum':_0x4de5f1['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4de5f1[_0xe3ef('0x18')],'transfereraccountcode':_0x4de5f1[_0xe3ef('0x19')],'transferercontext':_0x4de5f1['secondtransferercontext'],'transfererexten':_0x4de5f1[_0xe3ef('0x1a')],'transfererlinkedid':_0x4de5f1[_0xe3ef('0x1b')],'transfereechannel':_0x4de5f1[_0xe3ef('0x1c')],'transfereecalleridnum':_0x4de5f1['transfertargetcalleridnum'],'transfereecalleridname':_0x4de5f1['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4de5f1['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4de5f1[_0xe3ef('0x1d')],'transfereeaccountcode':_0x4de5f1[_0xe3ef('0x1e')],'transfereecontext':_0x4de5f1[_0xe3ef('0x1f')],'transfereeexten':_0x4de5f1[_0xe3ef('0x20')],'transfereelinkedid':_0x4de5f1['transfertargetlinkedid'],'isexternal':_0x4de5f1[_0xe3ef('0x10')],'context':_0x4de5f1[_0xe3ef('0x21')],'extension':_0x4de5f1['origtransfererexten'],'type':_0xe3ef('0x22')},'log':_0xe3ef('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 1a30b4a..f416967 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 _0x9957=['content','error','voiceQueues','hasOwnProperty','push','find','undefined','channels','length','voicechannel','uniqueid','format','%s.%s','MixMonitor','channel','monitors','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','destinationchannel','stop','/var/spool/asterisk/monitor/','values','queueChannels','inbound','includes','type','count','rows','voicequeuechannel','Hangup','voicequeuechannelredirect','exten','context','telephones','outboundChannels','outbound','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','reload','action','Action','then','message','catch','isConnected','command','Command'];(function(_0x2526bf,_0x34ac1b){var _0x105af4=function(_0x163cd1){while(--_0x163cd1){_0x2526bf['push'](_0x2526bf['shift']());}};_0x105af4(++_0x34ac1b);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var jayson=require(_0x7995('0x2'));var schema=require(_0x7995('0x3'));var moment=require('moment');var config=require(_0x7995('0x4'));var properties=require(_0x7995('0x5'));var ami=require(_0x7995('0x6'));var VoiceQueueSummary=require(_0x7995('0x7'));exports['listen']=function(_0x744bea,_0x1a36d8,_0x137b6b){return new Promise(function(_0x219534,_0xbda126){var _0x326741={'QueuePause':function(_0x4996ca){return new Promise(function(_0x465276){var _0x1cad37=util['format'](_0x7995('0x8'),_0x7995('0x9'),_0x4996ca[_0x7995('0xa')]);if(_0x744bea[_0x7995('0xb')]&&_0x744bea[_0x7995('0xb')][_0x1cad37]&&_0x744bea[_0x7995('0xb')][_0x1cad37][_0x7995('0xc')]){_0x744bea['timers'][_0x1cad37][_0x7995('0xd')]();}if(_0x744bea[_0x7995('0xe')][_0x1cad37]){_0x744bea['agents'][_0x1cad37][_0x7995('0xf')]({'statePause':_0x4996ca[_0x7995('0x10')]?!![]:![]});}_0x465276({'code':0xc8,'message':_0x7995('0x11')});});},'Reload':function(_0x385f00){var _0x281576=this;return new Promise(function(_0x23999f,_0x2bbe7a){if(ami['isConnected']()==![]){return _0x2bbe7a(_0x281576['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}_0x385f00=_[_0x7995('0x16')](_0x385f00,_[_0x7995('0x17')](properties[_0x7995('0x18')]['module']));_0x385f00[_0x7995('0x19')]='Reload';return ami[_0x7995('0x1a')](_0x385f00)[_0x7995('0x1b')](function(_0x43d4b8){_0x23999f({'code':0xc8,'message':_0x43d4b8[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x37a7d4){_0x2bbe7a(_0x281576['error'](0x1f5,_0x37a7d4['message']));});});},'Command':function(_0x2536c8){var _0x5e6f90=this;return new Promise(function(_0x555f74,_0x3ec178){if(ami[_0x7995('0x1e')]()==![]){return _0x3ec178(_0x5e6f90['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk']['username'],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}_0x2536c8=_[_0x7995('0x16')](_0x2536c8,_0x7995('0x1f'));_0x2536c8[_0x7995('0x19')]=_0x7995('0x20');return ami['Action'](_0x2536c8)[_0x7995('0x1b')](function(_0x46ee4b){_0x555f74({'code':0xc8,'message':_0x46ee4b[_0x7995('0x21')]});})[_0x7995('0x1d')](function(_0x563799){_0x3ec178(_0x5e6f90[_0x7995('0x22')](0x1f5,_0x563799[_0x7995('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x472195){var _0x59405a=[];for(var _0x39df42 in _0x744bea[_0x7995('0x23')]){if(_0x744bea[_0x7995('0x23')][_0x7995('0x24')](_0x39df42)){var _0x3a3fcf=_0x744bea[_0x7995('0x23')][_0x39df42];var _0x56691a=new VoiceQueueSummary(_0x3a3fcf);_0x59405a[_0x7995('0x25')](_0x56691a);}}_0x472195({'count':_0x59405a['length'],'rows':_0x59405a});});},'UpdateVoiceQueue':function(_0x229742){return new Promise(function(_0x49bc7e,_0xf16cc2){var _0x132a42=_[_0x7995('0x26')](_0x744bea['voiceQueues'],{'id':parseInt(_0x229742['id'])});var _0x9b2a15=_['omit'](_0x229742,['id']);if(_0x132a42){for(var _0x456a28 in _0x9b2a15){if(typeof _0x9b2a15[_0x456a28]!==_0x7995('0x27')&&typeof _0x132a42[_0x456a28]!==_0x7995('0x27')){_0x132a42[_0x456a28]=_0x9b2a15[_0x456a28];}}_0x49bc7e(_0x132a42);}else{_0xf16cc2();}});},'VoiceChannels':function(){return new Promise(function(_0x574574){var _0x530611=_['values'](_0x744bea[_0x7995('0x28')]);_0x574574({'count':_0x530611[_0x7995('0x29')],'rows':_0x530611});});},'VoiceChannelMixMonitor':function(_0x327a81){var _0x2b874d=this;return new Promise(function(_0x2e3493,_0x1ca460){if(ami['isConnected']()==![]){return _0x1ca460(_0x2b874d['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk'][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x1e9fa4=schema(properties[_0x7995('0x2a')])['validate'](_0x327a81);if(_0x1e9fa4[_0x7995('0x29')]>0x0){return _0x1ca460(_0x2b874d[_0x7995('0x22')](0x1f4,_['map'](_0x1e9fa4,'message')['join'](',\x20')));}var _0x45bc5e=_[_0x7995('0x26')](_0x744bea['channels'],{'uniqueid':_0x327a81[_0x7995('0x2b')]});if(_0x45bc5e&&_0x45bc5e['channel']){var _0x37917b=util[_0x7995('0x2c')](_0x7995('0x2d'),_0x327a81['filename']||_0x327a81['uniqueid'],_0x327a81[_0x7995('0x2c')]||'wav');return ami['Action']({'action':_0x7995('0x2e'),'channel':_0x45bc5e[_0x7995('0x2f')],'file':_0x37917b,'options':'ai(mixmonitorid)'})[_0x7995('0x1b')](function(_0x1922b4){var _0x2b772f=_[_0x7995('0x26')](_0x45bc5e[_0x7995('0x30')],{'filename':'/var/spool/asterisk/monitor/'+_0x37917b[_0x7995('0x31')]()});if(_[_0x7995('0x32')](_0x2b772f)){_0x45bc5e[_0x7995('0x30')][_0x7995('0x25')]({'filename':'/var/spool/asterisk/monitor/'+_0x37917b[_0x7995('0x31')](),'createdAt':moment()[_0x7995('0x2c')](_0x7995('0x33')),'mixmonitorid':_0x1922b4[_0x7995('0x34')],'status':_0x7995('0x35')});}else{_0x2b772f[_0x7995('0x34')]=_0x1922b4['mixmonitorid'];_0x2b772f[_0x7995('0x36')]=_0x7995('0x35');}_0x2e3493({'code':0xc8,'message':[_0x327a81[_0x7995('0x2b')],_0x7995('0x37'),_0x1922b4[_0x7995('0x34')]][_0x7995('0x15')]('\x20'),'mixmonitorid':_0x1922b4[_0x7995('0x34')]});})[_0x7995('0x1d')](function(_0x1234e1){_0x1ca460(_0x2b874d[_0x7995('0x22')](0x1f5,[_0x327a81[_0x7995('0x2b')],_0x1234e1[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')));});}else{return _0x1ca460(_0x2b874d['error'](0x1f5,_0x7995('0x38')));}});},'VoiceChannelStopMixMonitor':function(_0x7325e8){var _0x58523e=this;return new Promise(function(_0x4b0855,_0x3f8522){if(ami['isConnected']()==![]){return _0x3f8522(_0x58523e['error'](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],'ami\x20disconnected'][_0x7995('0x15')]('\x20')));}var _0x5e85b9=schema(properties[_0x7995('0x2a')])['validate'](_0x7325e8);if(_0x5e85b9['length']>0x0){return _0x3f8522(_0x58523e[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x5e85b9,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x599ecb=_[_0x7995('0x26')](_0x744bea[_0x7995('0x28')],{'uniqueid':_0x7325e8[_0x7995('0x2b')]});if(_0x599ecb){return Promise[_0x7995('0x3a')]()['then'](function(){if(_0x599ecb['channel']){return ami[_0x7995('0x1a')]({'action':'StopMixMonitor','channel':_0x599ecb[_0x7995('0x2f')],'mixmonitorid':_0x7325e8['mixmonitorid']})[_0x7995('0x1d')](function(){});}})['then'](function(){if(_0x599ecb[_0x7995('0x3b')]){return ami[_0x7995('0x1a')]({'action':'StopMixMonitor','channel':_0x599ecb[_0x7995('0x3b')],'mixmonitorid':_0x7325e8[_0x7995('0x34')]})[_0x7995('0x1d')](function(){});}})[_0x7995('0x1b')](function(){var _0x4c6837=_[_0x7995('0x26')](_0x599ecb[_0x7995('0x30')],{'mixmonitorid':_0x7325e8[_0x7995('0x34')]});if(_0x4c6837){_0x4c6837['status']=_0x7995('0x3c');}})[_0x7995('0x1b')](function(){var _0x511567=util[_0x7995('0x2c')](_0x7995('0x2d'),_0x7325e8['filename']||_0x7325e8[_0x7995('0x2b')],_0x7325e8[_0x7995('0x2c')]||'wav');var _0x3d1dbb=_['find'](_0x599ecb[_0x7995('0x30')],{'filename':_0x7995('0x3d')+_0x511567[_0x7995('0x31')]()});if(_0x3d1dbb){_0x3d1dbb[_0x7995('0x36')]=_0x7995('0x3c');}})[_0x7995('0x1b')](function(){_0x4b0855({'code':0xc8,'message':[_0x7325e8[_0x7995('0x2b')],'StopMixMonitor\x20Success'][_0x7995('0x15')]('\x20')});})[_0x7995('0x1d')](function(_0x418eb9){_0x3f8522(_0x58523e['error'](0x1f5,[_0x7325e8[_0x7995('0x2b')],_0x418eb9[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')));});}else{return _0x3f8522(_0x58523e['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0xb70620){var _0x1fd1ca=this;return new Promise(function(_0x4cf5db){var _0x1cd85=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x3f')]);var _0x1a9bd7={'count':_0x1cd85[_0x7995('0x29')],'rows':_0x1cd85};if(_0xb70620&&_0xb70620['type']){if(![_0x7995('0x40'),'outbound'][_0x7995('0x41')](_0xb70620[_0x7995('0x42')])){return _0xbda126(_0x1fd1ca[_0x7995('0x22')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x5e1f34=_['filter'](_0x1cd85,function(_0x563f8e){return _0x563f8e[_0x7995('0x42')]===_0xb70620[_0x7995('0x42')];});_0x1a9bd7[_0x7995('0x43')]=_0x5e1f34[_0x7995('0x29')];_0x1a9bd7[_0x7995('0x44')]=_0x5e1f34;}_0x4cf5db(_0x1a9bd7);});},'VoiceQueuesChannel':function(_0x357e60){var _0x1f4270=this;return new Promise(function(_0xda6ce8,_0x328671){var _0x17ecd3=schema(properties[_0x7995('0x45')])[_0x7995('0x3')](_0x357e60);if(_0x17ecd3[_0x7995('0x29')]>0x0){return _0x328671(_0x1f4270[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x17ecd3,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x223e08=_[_0x7995('0x26')](_0x744bea['queueChannels'],{'uniqueid':_0x357e60[_0x7995('0x2b')]});if(_0x223e08){_0xda6ce8(_0x223e08);}else{return _0x328671(_0x1f4270[_0x7995('0x22')](0x1f5,_0x7995('0x38')));}});},'VoiceQueuesChannelHangup':function(_0x32c0d3){var _0x5d160d=this;return new Promise(function(_0x53125a,_0x402fa0){if(ami[_0x7995('0x1e')]()==![]){return _0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f4,[config[_0x7995('0x12')]['ip'],config['asterisk'][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x33c49c=schema(properties['voicequeuechannelhangup'])['validate'](_0x32c0d3);if(_0x33c49c[_0x7995('0x29')]>0x0){return _0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x33c49c,_0x7995('0x1c'))[_0x7995('0x15')](',\x20')));}var _0x27c5cd=_[_0x7995('0x26')](_0x744bea[_0x7995('0x3f')],{'uniqueid':_0x32c0d3[_0x7995('0x2b')]});if(_0x27c5cd&&_0x27c5cd['channel']){return ami[_0x7995('0x1a')]({'action':_0x7995('0x46'),'channel':_0x27c5cd[_0x7995('0x2f')]})[_0x7995('0x1b')](function(_0x59c5aa){_0x53125a({'code':0xc8,'message':[_0x32c0d3['uniqueid'],_0x59c5aa[_0x7995('0x1c')][_0x7995('0x31')]()]['join']('\x20')});})[_0x7995('0x1d')](function(_0x375fc9){_0x402fa0(_0x5d160d[_0x7995('0x22')](0x1f5,[_0x32c0d3[_0x7995('0x2b')],_0x375fc9[_0x7995('0x1c')]['toLowerCase']()][_0x7995('0x15')]('\x20')));});}else{return _0x402fa0(_0x5d160d['error'](0x1f5,_0x7995('0x38')));}});},'VoiceQueuesChannelRedirect':function(_0xe31dcb){var _0x1722e2=this;return new Promise(function(_0x25b534,_0x4388c1){if(ami[_0x7995('0x1e')]()==![]){return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f4,[config[_0x7995('0x12')]['ip'],config[_0x7995('0x12')][_0x7995('0x13')],_0x7995('0x14')][_0x7995('0x15')]('\x20')));}var _0x56eb85=schema(properties[_0x7995('0x47')])[_0x7995('0x3')](_0xe31dcb);if(_0x56eb85[_0x7995('0x29')]>0x0){return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f4,_[_0x7995('0x39')](_0x56eb85,'message')['join'](',\x20')));}var _0x268fde=_[_0x7995('0x26')](_0x744bea[_0x7995('0x3f')],{'uniqueid':_0xe31dcb[_0x7995('0x2b')]});if(_0x268fde&&_0x268fde['channel']){return ami[_0x7995('0x1a')]({'action':'Redirect','channel':_0x268fde['channel'],'exten':_0xe31dcb[_0x7995('0x48')],'context':_0xe31dcb[_0x7995('0x49')]||_0x268fde[_0x7995('0x49')],'priority':0x1})[_0x7995('0x1b')](function(_0x290eae){_0x25b534({'code':0xc8,'message':[_0xe31dcb[_0x7995('0x2b')],_0x290eae[_0x7995('0x1c')][_0x7995('0x31')]()][_0x7995('0x15')]('\x20')});})[_0x7995('0x1d')](function(_0x560b0a){_0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f5,[_0xe31dcb[_0x7995('0x2b')],_0x560b0a[_0x7995('0x1c')]['toLowerCase']()][_0x7995('0x15')]('\x20')));});}else{return _0x4388c1(_0x1722e2[_0x7995('0x22')](0x1f5,_0x7995('0x38')));}});},'Agents':function(_0x3a7d9d){return new Promise(function(_0x3b0d30){var _0x51ab1e=_[_0x7995('0x3e')](_0x744bea[_0x7995('0xe')]);if(_0x3a7d9d&&_0x3a7d9d['id']){var _0x2f94c4=_[_0x7995('0x26')](_0x51ab1e,function(_0x435a1b){return _0x435a1b['id']===_0x3a7d9d['id'];});_0x3b0d30(_0x2f94c4);}else{_0x3b0d30({'count':_0x51ab1e['length'],'rows':_0x51ab1e});}});},'Telephones':function(){return new Promise(function(_0x5e8b4c){var _0xd07c1c=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x4a')]);_0x5e8b4c({'count':_0xd07c1c[_0x7995('0x29')],'rows':_0xd07c1c});});},'Trunks':function(){return new Promise(function(_0x4dbab8){var _0x3b45e8=_[_0x7995('0x3e')](_0x744bea['trunks']);_0x4dbab8({'count':_0x3b45e8['length'],'rows':_0x3b45e8});});},'OutboundChannels':function(){return new Promise(function(_0x3253b5){var _0x305b5a=_['values'](_0x744bea[_0x7995('0x4b')]);_0x3253b5({'count':_0x305b5a['length'],'rows':_0x305b5a});});},'Outbound':function(){return new Promise(function(_0x3758f9){_0x3758f9(_0x744bea[_0x7995('0x4c')]);});},'Campaigns':function(){return new Promise(function(_0x4ff9ff){var _0x5d9d33=_[_0x7995('0x3e')](_0x744bea['campaigns']);_0x4ff9ff({'count':_0x5d9d33[_0x7995('0x29')],'rows':_0x5d9d33});});},'VoiceQueuesPreview':function(_0xa41fff){var _0x3dd197=this;return new Promise(function(_0x45bd8a,_0x1a1873){_0x1a36d8[_0x7995('0x4d')](_0xa41fff['id'])[_0x7995('0x1b')](function(_0x14cb17){_0x45bd8a({'code':0xc8,'message':_0x14cb17[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x1ab590){_0x1a1873(_0x3dd197[_0x7995('0x22')](0x1f4,_0x1ab590[_0x7995('0x1c')]));});});},'EventManager':function(_0x1ff436){var _0x36e3a7=this;return new Promise(function(_0x3773de,_0x6ad274){if(!_0x1ff436[_0x7995('0x4e')]){return _0x6ad274(_0x36e3a7[_0x7995('0x22')](0x1f4,_0x7995('0x4f')));}ami[_0x7995('0x50')](_0x7995('0x51')+_0x1ff436[_0x7995('0x4e')],_0x1ff436[_0x7995('0x1c')]);_0x3773de({'code':0xc8,'message':_0x1ff436});});},'FaxAccounts':function(){return new Promise(function(_0x260ef1){var _0x33479a=_[_0x7995('0x3e')](_0x744bea[_0x7995('0x52')]);_0x260ef1({'count':_0x33479a['length'],'rows':_0x33479a});});},'SendFax':function(_0x3fdb4b){var _0x10f4ca=this;return new Promise(function(_0x5683b2,_0x4c85cb){_0x137b6b[_0x7995('0x53')](_0x3fdb4b)[_0x7995('0x1b')](function(_0x2d45d5){_0x5683b2({'code':0xc8,'message':_0x2d45d5[_0x7995('0x1c')]});})[_0x7995('0x1d')](function(_0x2491fe){_0x4c85cb(_0x10f4ca['error'](0x1f4,_0x2491fe[_0x7995('0x1c')]));});});},'CheckAfterSend':function(_0xb68962){var _0x3fea6a=this;return new Promise(function(_0x77b03f,_0x7d9c6e){_0x137b6b[_0x7995('0x54')](_0xb68962)[_0x7995('0x1b')](function(_0xc93dcb){_0x77b03f({'code':0xc8,'message':_0xc93dcb['message']});})[_0x7995('0x1d')](function(_0x2b8217){_0x7d9c6e(_0x3fea6a['error'](0x1f4,_0x2b8217['message']));});});}};var _0xd24c64=jayson[_0x7995('0x55')](_0x326741)[_0x7995('0x56')]();_0xd24c64['on'](_0x7995('0x22'),function(_0xe42797){return _0xbda126(_0xe42797);});_0xd24c64['listen'](0x232a,_0x7995('0x57'),function(){console[_0x7995('0x58')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x219534(_0x7995('0x59')+0x232a);});});}; \ No newline at end of file +var _0x207c=['ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','toLowerCase','StopMixMonitor\x20Success','outbound','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','type','count','rows','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','campaigns','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','listen','format','SIP','name','timers','timer','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','module','action','Reload','Action','message','catch','pick','command','Command','then','content','voiceQueues','hasOwnProperty','push','find','omit','undefined','values','channels','length','voicechannel','uniqueid','channel','wav'];(function(_0x386394,_0x543996){var _0x4f8d51=function(_0x4b7ae4){while(--_0x4b7ae4){_0x386394['push'](_0x386394['shift']());}};_0x4f8d51(++_0x543996);}(_0x207c,0x1e8));var _0xc207=function(_0x114e6a,_0x3dc9d2){_0x114e6a=_0x114e6a-0x0;var _0x423189=_0x207c[_0x114e6a];return _0x423189;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var jayson=require(_0xc207('0x1'));var schema=require(_0xc207('0x2'));var moment=require(_0xc207('0x3'));var config=require(_0xc207('0x4'));var properties=require(_0xc207('0x5'));var ami=require(_0xc207('0x6'));var VoiceQueueSummary=require('../model/voiceQueueSummary');exports[_0xc207('0x7')]=function(_0x59bc89,_0x5a727b,_0x55023e){return new Promise(function(_0xc88789,_0x314561){var _0x3395e4={'QueuePause':function(_0x59ff6f){return new Promise(function(_0x25cb97){var _0xad159b=util[_0xc207('0x8')]('%s/%s',_0xc207('0x9'),_0x59ff6f[_0xc207('0xa')]);if(_0x59bc89[_0xc207('0xb')]&&_0x59bc89[_0xc207('0xb')][_0xad159b]&&_0x59bc89[_0xc207('0xb')][_0xad159b][_0xc207('0xc')]){_0x59bc89['timers'][_0xad159b]['updateAcw']();}if(_0x59bc89['agents'][_0xad159b]){_0x59bc89[_0xc207('0xd')][_0xad159b]['updateStatusRealtime']({'statePause':_0x59ff6f[_0xc207('0xe')]?!![]:![]});}_0x25cb97({'code':0xc8,'message':_0xc207('0xf')});});},'Reload':function(_0x59d401){var _0x3e1108=this;return new Promise(function(_0xb86b06,_0x3062f5){if(ami[_0xc207('0x10')]()==![]){return _0x3062f5(_0x3e1108[_0xc207('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xc207('0x12')][_0xc207('0x13')],_0xc207('0x14')][_0xc207('0x15')]('\x20')));}_0x59d401=_['pick'](_0x59d401,_['keys'](properties['reload'][_0xc207('0x16')]));_0x59d401[_0xc207('0x17')]=_0xc207('0x18');return ami[_0xc207('0x19')](_0x59d401)['then'](function(_0x1bc70c){_0xb86b06({'code':0xc8,'message':_0x1bc70c[_0xc207('0x1a')]});})[_0xc207('0x1b')](function(_0x5f288e){_0x3062f5(_0x3e1108[_0xc207('0x11')](0x1f5,_0x5f288e['message']));});});},'Command':function(_0x42c8ba){var _0x33ddb1=this;return new Promise(function(_0x131dc8,_0x461f6a){if(ami[_0xc207('0x10')]()==![]){return _0x461f6a(_0x33ddb1[_0xc207('0x11')](0x1f4,[config[_0xc207('0x12')]['ip'],config[_0xc207('0x12')][_0xc207('0x13')],_0xc207('0x14')][_0xc207('0x15')]('\x20')));}_0x42c8ba=_[_0xc207('0x1c')](_0x42c8ba,_0xc207('0x1d'));_0x42c8ba['action']=_0xc207('0x1e');return ami['Action'](_0x42c8ba)[_0xc207('0x1f')](function(_0x3ac142){_0x131dc8({'code':0xc8,'message':_0x3ac142[_0xc207('0x20')]});})[_0xc207('0x1b')](function(_0x3539f4){_0x461f6a(_0x33ddb1[_0xc207('0x11')](0x1f5,_0x3539f4[_0xc207('0x1a')]));});});},'VoiceQueues':function(){return new Promise(function(_0x1493fb){var _0xa52138=[];for(var _0x2385f7 in _0x59bc89[_0xc207('0x21')]){if(_0x59bc89[_0xc207('0x21')][_0xc207('0x22')](_0x2385f7)){var _0x138970=_0x59bc89[_0xc207('0x21')][_0x2385f7];var _0x56a066=new VoiceQueueSummary(_0x138970);_0xa52138[_0xc207('0x23')](_0x56a066);}}_0x1493fb({'count':_0xa52138['length'],'rows':_0xa52138});});},'UpdateVoiceQueue':function(_0x4cb3af){return new Promise(function(_0x18ef72,_0x3a05f3){var _0x2e41b1=_[_0xc207('0x24')](_0x59bc89[_0xc207('0x21')],{'id':parseInt(_0x4cb3af['id'])});var _0x478af7=_[_0xc207('0x25')](_0x4cb3af,['id']);if(_0x2e41b1){for(var _0x463ac8 in _0x478af7){if(typeof _0x478af7[_0x463ac8]!==_0xc207('0x26')&&typeof _0x2e41b1[_0x463ac8]!==_0xc207('0x26')){_0x2e41b1[_0x463ac8]=_0x478af7[_0x463ac8];}}_0x18ef72(_0x2e41b1);}else{_0x3a05f3();}});},'VoiceChannels':function(){return new Promise(function(_0x11a647){var _0x2ce847=_[_0xc207('0x27')](_0x59bc89[_0xc207('0x28')]);_0x11a647({'count':_0x2ce847[_0xc207('0x29')],'rows':_0x2ce847});});},'VoiceChannelMixMonitor':function(_0x3f79e8){var _0x2043cf=this;return new Promise(function(_0xaa1b54,_0x3cd4b4){if(ami['isConnected']()==![]){return _0x3cd4b4(_0x2043cf[_0xc207('0x11')](0x1f4,[config[_0xc207('0x12')]['ip'],config[_0xc207('0x12')][_0xc207('0x13')],_0xc207('0x14')][_0xc207('0x15')]('\x20')));}var _0x47d4c9=schema(properties[_0xc207('0x2a')])[_0xc207('0x2')](_0x3f79e8);if(_0x47d4c9[_0xc207('0x29')]>0x0){return _0x3cd4b4(_0x2043cf[_0xc207('0x11')](0x1f4,_['map'](_0x47d4c9,_0xc207('0x1a'))[_0xc207('0x15')](',\x20')));}var _0x3b05fd=_[_0xc207('0x24')](_0x59bc89[_0xc207('0x28')],{'uniqueid':_0x3f79e8[_0xc207('0x2b')]});if(_0x3b05fd&&_0x3b05fd[_0xc207('0x2c')]){var _0x458de9=util[_0xc207('0x8')]('%s.%s',_0x3f79e8['filename']||_0x3f79e8[_0xc207('0x2b')],_0x3f79e8[_0xc207('0x8')]||_0xc207('0x2d'));return ami[_0xc207('0x19')]({'action':'MixMonitor','channel':_0x3b05fd[_0xc207('0x2c')],'file':_0x458de9,'options':_0xc207('0x2e')})[_0xc207('0x1f')](function(_0x2a1c60){var _0x1fa850=_['find'](_0x3b05fd[_0xc207('0x2f')],{'filename':_0xc207('0x30')+_0x458de9['toLowerCase']()});if(_[_0xc207('0x31')](_0x1fa850)){_0x3b05fd['monitors'][_0xc207('0x23')]({'filename':_0xc207('0x30')+_0x458de9['toLowerCase'](),'createdAt':moment()[_0xc207('0x8')](_0xc207('0x32')),'mixmonitorid':_0x2a1c60[_0xc207('0x33')],'status':'rec'});}else{_0x1fa850['mixmonitorid']=_0x2a1c60[_0xc207('0x33')];_0x1fa850[_0xc207('0x34')]=_0xc207('0x35');}_0xaa1b54({'code':0xc8,'message':[_0x3f79e8[_0xc207('0x2b')],'MixMonitor\x20Success',_0x2a1c60[_0xc207('0x33')]]['join']('\x20'),'mixmonitorid':_0x2a1c60['mixmonitorid']});})['catch'](function(_0x5c05fb){_0x3cd4b4(_0x2043cf[_0xc207('0x11')](0x1f5,[_0x3f79e8[_0xc207('0x2b')],_0x5c05fb[_0xc207('0x1a')]['toLowerCase']()][_0xc207('0x15')]('\x20')));});}else{return _0x3cd4b4(_0x2043cf[_0xc207('0x11')](0x1f5,_0xc207('0x36')));}});},'VoiceChannelStopMixMonitor':function(_0x5ae1ab){var _0x48efac=this;return new Promise(function(_0x47d43a,_0x223349){if(ami[_0xc207('0x10')]()==![]){return _0x223349(_0x48efac[_0xc207('0x11')](0x1f4,[config[_0xc207('0x12')]['ip'],config['asterisk'][_0xc207('0x13')],_0xc207('0x14')][_0xc207('0x15')]('\x20')));}var _0x471a85=schema(properties[_0xc207('0x2a')])[_0xc207('0x2')](_0x5ae1ab);if(_0x471a85[_0xc207('0x29')]>0x0){return _0x223349(_0x48efac[_0xc207('0x11')](0x1f4,_[_0xc207('0x37')](_0x471a85,'message')[_0xc207('0x15')](',\x20')));}var _0x16ed4f=_['find'](_0x59bc89[_0xc207('0x28')],{'uniqueid':_0x5ae1ab[_0xc207('0x2b')]});if(_0x16ed4f){return Promise[_0xc207('0x38')]()[_0xc207('0x1f')](function(){if(_0x16ed4f[_0xc207('0x2c')]){return ami['Action']({'action':_0xc207('0x39'),'channel':_0x16ed4f[_0xc207('0x2c')],'mixmonitorid':_0x5ae1ab[_0xc207('0x33')]})['catch'](function(){});}})[_0xc207('0x1f')](function(){if(_0x16ed4f[_0xc207('0x3a')]){return ami[_0xc207('0x19')]({'action':_0xc207('0x39'),'channel':_0x16ed4f['destinationchannel'],'mixmonitorid':_0x5ae1ab['mixmonitorid']})[_0xc207('0x1b')](function(){});}})[_0xc207('0x1f')](function(){var _0x45fa1d=_[_0xc207('0x24')](_0x16ed4f[_0xc207('0x2f')],{'mixmonitorid':_0x5ae1ab[_0xc207('0x33')]});if(_0x45fa1d){_0x45fa1d[_0xc207('0x34')]=_0xc207('0x3b');}})[_0xc207('0x1f')](function(){var _0x212552=util[_0xc207('0x8')](_0xc207('0x3c'),_0x5ae1ab['filename']||_0x5ae1ab['uniqueid'],_0x5ae1ab[_0xc207('0x8')]||_0xc207('0x2d'));var _0x2468d0=_['find'](_0x16ed4f[_0xc207('0x2f')],{'filename':_0xc207('0x30')+_0x212552[_0xc207('0x3d')]()});if(_0x2468d0){_0x2468d0[_0xc207('0x34')]='stop';}})[_0xc207('0x1f')](function(){_0x47d43a({'code':0xc8,'message':[_0x5ae1ab['uniqueid'],_0xc207('0x3e')]['join']('\x20')});})['catch'](function(_0x21d9b5){_0x223349(_0x48efac[_0xc207('0x11')](0x1f5,[_0x5ae1ab['uniqueid'],_0x21d9b5['message']['toLowerCase']()][_0xc207('0x15')]('\x20')));});}else{return _0x223349(_0x48efac[_0xc207('0x11')](0x1f5,_0xc207('0x36')));}});},'VoiceQueuesChannels':function(_0x1acc33){var _0x173acf=this;return new Promise(function(_0x35e967){var _0x3dc457=_[_0xc207('0x27')](_0x59bc89['queueChannels']);var _0x26bcfe={'count':_0x3dc457[_0xc207('0x29')],'rows':_0x3dc457};if(_0x1acc33&&_0x1acc33['type']){if(!['inbound',_0xc207('0x3f')]['includes'](_0x1acc33['type'])){return _0x314561(_0x173acf[_0xc207('0x11')](0x190,_0xc207('0x40')));}var _0x356c8c=_[_0xc207('0x41')](_0x3dc457,function(_0x3583b8){return _0x3583b8[_0xc207('0x42')]===_0x1acc33[_0xc207('0x42')];});_0x26bcfe[_0xc207('0x43')]=_0x356c8c[_0xc207('0x29')];_0x26bcfe[_0xc207('0x44')]=_0x356c8c;}_0x35e967(_0x26bcfe);});},'VoiceQueuesChannel':function(_0x2fcfee){var _0x5cd180=this;return new Promise(function(_0x529a21,_0x42d9a0){var _0x246f5b=schema(properties[_0xc207('0x45')])[_0xc207('0x2')](_0x2fcfee);if(_0x246f5b[_0xc207('0x29')]>0x0){return _0x42d9a0(_0x5cd180[_0xc207('0x11')](0x1f4,_[_0xc207('0x37')](_0x246f5b,_0xc207('0x1a'))[_0xc207('0x15')](',\x20')));}var _0x49e724=_[_0xc207('0x24')](_0x59bc89[_0xc207('0x46')],{'uniqueid':_0x2fcfee[_0xc207('0x2b')]});if(_0x49e724){_0x529a21(_0x49e724);}else{return _0x42d9a0(_0x5cd180[_0xc207('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x448f14){var _0x22cdf9=this;return new Promise(function(_0x22625d,_0x409b2d){if(ami[_0xc207('0x10')]()==![]){return _0x409b2d(_0x22cdf9[_0xc207('0x11')](0x1f4,[config[_0xc207('0x12')]['ip'],config['asterisk'][_0xc207('0x13')],_0xc207('0x14')][_0xc207('0x15')]('\x20')));}var _0x298342=schema(properties['voicequeuechannelhangup'])[_0xc207('0x2')](_0x448f14);if(_0x298342['length']>0x0){return _0x409b2d(_0x22cdf9['error'](0x1f4,_[_0xc207('0x37')](_0x298342,_0xc207('0x1a'))[_0xc207('0x15')](',\x20')));}var _0x2ebda4=_[_0xc207('0x24')](_0x59bc89[_0xc207('0x46')],{'uniqueid':_0x448f14[_0xc207('0x2b')]});if(_0x2ebda4&&_0x2ebda4[_0xc207('0x2c')]){return ami[_0xc207('0x19')]({'action':_0xc207('0x47'),'channel':_0x2ebda4[_0xc207('0x2c')]})[_0xc207('0x1f')](function(_0x416e85){_0x22625d({'code':0xc8,'message':[_0x448f14[_0xc207('0x2b')],_0x416e85[_0xc207('0x1a')]['toLowerCase']()][_0xc207('0x15')]('\x20')});})['catch'](function(_0x29b49a){_0x409b2d(_0x22cdf9[_0xc207('0x11')](0x1f5,[_0x448f14[_0xc207('0x2b')],_0x29b49a['message']['toLowerCase']()][_0xc207('0x15')]('\x20')));});}else{return _0x409b2d(_0x22cdf9[_0xc207('0x11')](0x1f5,_0xc207('0x36')));}});},'VoiceQueuesChannelRedirect':function(_0x51a3c1){var _0x31182c=this;return new Promise(function(_0x1cefa3,_0x3509d8){if(ami['isConnected']()==![]){return _0x3509d8(_0x31182c['error'](0x1f4,[config[_0xc207('0x12')]['ip'],config['asterisk'][_0xc207('0x13')],_0xc207('0x14')][_0xc207('0x15')]('\x20')));}var _0x4b197=schema(properties[_0xc207('0x48')])[_0xc207('0x2')](_0x51a3c1);if(_0x4b197[_0xc207('0x29')]>0x0){return _0x3509d8(_0x31182c[_0xc207('0x11')](0x1f4,_['map'](_0x4b197,_0xc207('0x1a'))[_0xc207('0x15')](',\x20')));}var _0xa34ab5=_[_0xc207('0x24')](_0x59bc89[_0xc207('0x46')],{'uniqueid':_0x51a3c1[_0xc207('0x2b')]});if(_0xa34ab5&&_0xa34ab5[_0xc207('0x2c')]){return ami[_0xc207('0x19')]({'action':_0xc207('0x49'),'channel':_0xa34ab5[_0xc207('0x2c')],'exten':_0x51a3c1[_0xc207('0x4a')],'context':_0x51a3c1['context']||_0xa34ab5[_0xc207('0x4b')],'priority':0x1})[_0xc207('0x1f')](function(_0x45b4fb){_0x1cefa3({'code':0xc8,'message':[_0x51a3c1[_0xc207('0x2b')],_0x45b4fb['message']['toLowerCase']()][_0xc207('0x15')]('\x20')});})[_0xc207('0x1b')](function(_0x34f784){_0x3509d8(_0x31182c[_0xc207('0x11')](0x1f5,[_0x51a3c1['uniqueid'],_0x34f784[_0xc207('0x1a')][_0xc207('0x3d')]()][_0xc207('0x15')]('\x20')));});}else{return _0x3509d8(_0x31182c['error'](0x1f5,_0xc207('0x36')));}});},'Agents':function(_0x369b2d){return new Promise(function(_0x322b68){var _0x5a8241=_[_0xc207('0x27')](_0x59bc89['agents']);if(_0x369b2d&&_0x369b2d['id']){var _0x1290e4=_['find'](_0x5a8241,function(_0xf68aae){return _0xf68aae['id']===_0x369b2d['id'];});_0x322b68(_0x1290e4);}else{_0x322b68({'count':_0x5a8241[_0xc207('0x29')],'rows':_0x5a8241});}});},'Telephones':function(){return new Promise(function(_0x598fdb){var _0x2e0ead=_['values'](_0x59bc89[_0xc207('0x4c')]);_0x598fdb({'count':_0x2e0ead[_0xc207('0x29')],'rows':_0x2e0ead});});},'Trunks':function(){return new Promise(function(_0x3fad98){var _0x177e74=_[_0xc207('0x27')](_0x59bc89['trunks']);_0x3fad98({'count':_0x177e74['length'],'rows':_0x177e74});});},'OutboundChannels':function(){return new Promise(function(_0x3d1659){var _0x28b166=_['values'](_0x59bc89[_0xc207('0x4d')]);_0x3d1659({'count':_0x28b166[_0xc207('0x29')],'rows':_0x28b166});});},'Outbound':function(){return new Promise(function(_0x52d7f1){_0x52d7f1(_0x59bc89[_0xc207('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0x13954e){var _0x4fca05=_[_0xc207('0x27')](_0x59bc89[_0xc207('0x4e')]);_0x13954e({'count':_0x4fca05[_0xc207('0x29')],'rows':_0x4fca05});});},'VoiceQueuesPreview':function(_0x1d550d){var _0x13c415=this;return new Promise(function(_0xef037c,_0x5be1e7){_0x5a727b['run'](_0x1d550d['id'])[_0xc207('0x1f')](function(_0x237df5){_0xef037c({'code':0xc8,'message':_0x237df5[_0xc207('0x1a')]});})[_0xc207('0x1b')](function(_0x7fd1a3){_0x5be1e7(_0x13c415['error'](0x1f4,_0x7fd1a3[_0xc207('0x1a')]));});});},'EventManager':function(_0x4f79b3){var _0x6b1089=this;return new Promise(function(_0x97f43,_0x47145a){if(!_0x4f79b3[_0xc207('0x4f')]){return _0x47145a(_0x6b1089[_0xc207('0x11')](0x1f4,_0xc207('0x50')));}ami['emit'](_0xc207('0x51')+_0x4f79b3[_0xc207('0x4f')],_0x4f79b3['message']);_0x97f43({'code':0xc8,'message':_0x4f79b3});});},'FaxAccounts':function(){return new Promise(function(_0x1e5aaf){var _0xf2f689=_[_0xc207('0x27')](_0x59bc89[_0xc207('0x52')]);_0x1e5aaf({'count':_0xf2f689[_0xc207('0x29')],'rows':_0xf2f689});});},'SendFax':function(_0x42d79e){var _0x9be0d2=this;return new Promise(function(_0x3a552c,_0x3bd56c){_0x55023e[_0xc207('0x53')](_0x42d79e)[_0xc207('0x1f')](function(_0x28d245){_0x3a552c({'code':0xc8,'message':_0x28d245[_0xc207('0x1a')]});})['catch'](function(_0x32a7ad){_0x3bd56c(_0x9be0d2[_0xc207('0x11')](0x1f4,_0x32a7ad[_0xc207('0x1a')]));});});},'CheckAfterSend':function(_0x266e65){var _0x48bed7=this;return new Promise(function(_0x327b9f,_0x49f0db){_0x55023e[_0xc207('0x54')](_0x266e65)['then'](function(_0x53cb21){_0x327b9f({'code':0xc8,'message':_0x53cb21[_0xc207('0x1a')]});})[_0xc207('0x1b')](function(_0x383f83){_0x49f0db(_0x48bed7[_0xc207('0x11')](0x1f4,_0x383f83[_0xc207('0x1a')]));});});}};var _0x1bdd51=jayson['server'](_0x3395e4)[_0xc207('0x55')]();_0x1bdd51['on']('error',function(_0x3bb53a){return _0x314561(_0x3bb53a);});_0x1bdd51[_0xc207('0x7')](0x232a,_0xc207('0x56'),function(){console[_0xc207('0x57')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0xc88789(_0xc207('0x58')+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 73900a7..12b5d0b 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 _0x47cb=['[CM][%s][%s]','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','firstName','lastName','mobile','fax','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','ioredis','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info'];(function(_0x14e27a,_0x3b4136){var _0x288688=function(_0x3d7ab1){while(--_0x3d7ab1){_0x14e27a['push'](_0x14e27a['shift']());}};_0x288688(++_0x3b4136);}(_0x47cb,0x1bf));var _0xb47c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb47c('0x0'));var BPromise=require('bluebird');var Redis=require(_0xb47c('0x1'));var util=require('util');var config=require(_0xb47c('0x2'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xb47c('0x3'));config[_0xb47c('0x4')]=_[_0xb47c('0x5')](config['redis'],{'host':_0xb47c('0x6'),'port':0x18eb});var io=require(_0xb47c('0x7'))(new Redis(config['redis']));function emit(_0x15f447,_0x49bac0,_0x166305,_0x4b2b0e,_0xc81762){logger[_0xb47c('0x8')](_0xb47c('0x9'),_0x15f447,_0x49bac0['id'],_0x166305,_0x4b2b0e,JSON['stringify'](_0xc81762));io['to'](_0x166305)['emit'](_0x4b2b0e,_0xc81762);}exports[_0xb47c('0xa')]=function(_0x21d4a7,_0x4abfe2,_0x1deeca,_0x1b6112){var _0x2e7813,_0x331e51;var _0x29a80c={};var _0x398b12;var _0x3d7d96=Number(_0x1deeca['data1']);var _0x185f98=_0x1deeca[_0xb47c('0xb')]?Boolean(Number(_0x1deeca['data2'])):![];var _0x4e4b52;var _0x5866da=![];if(!_[_0xb47c('0xc')](_0x1deeca['data5'])){if(_0x1deeca[_0xb47c('0xd')]=='1')_0x5866da=!![];}if(!_0x5866da){if(_0x1b6112[_0xb47c('0xe')]){_0x29a80c['id']=_0x1b6112['xmd-contactid'];}}if(!_0x29a80c['id']){_0x29a80c[_0xb47c('0xf')]=_0x3d7d96;_0x4e4b52=_0x1deeca[_0xb47c('0x10')]&&_0x1deeca[_0xb47c('0x10')]!=='0'?_0x1deeca[_0xb47c('0x10')][_0xb47c('0x11')](','):[_0xb47c('0x12')];_0x29a80c[_0xb47c('0x13')]=_[_0xb47c('0x14')](_0x4e4b52,function(_0x34cac7){var _0x962a52={};_0x962a52[_0x34cac7]=_0x1b6112[_0xb47c('0x15')]?_0x1b6112[_0xb47c('0x16')]:_0x1b6112['calleridnum'];return _0x962a52;});_0x398b12=_0x1b6112[_0xb47c('0x15')]?_0x1b6112['destcalleridnum']:_0x1b6112['calleridnum'];}var _0x21b92d=['id',_0xb47c('0x17'),_0xb47c('0x18'),_0xb47c('0x12'),_0xb47c('0x19'),_0xb47c('0x1a'),_0xb47c('0xf'),'createdAt',_0xb47c('0x1b'),_0xb47c('0x1c')];var _0x211680=_[_0xb47c('0x1d')](_0x21b92d,_0x4e4b52);BPromise[_0xb47c('0x1e')]()[_0xb47c('0x1f')](cmContactRpc['getContacts']({'attributes':_0x211680,'where':_0x29a80c,'phone':_0x398b12}))[_0xb47c('0x1f')](function(_0x10cbd3){_0x331e51=_0x10cbd3;if(!_[_0xb47c('0x20')](_0x331e51)){if(_0x331e51[_0xb47c('0x21')]===0x1){_0x2e7813=_0x331e51[0x0];logger[_0xb47c('0x8')](_0xb47c('0x22'),_0x1b6112['uniqueid'],_0x4abfe2['id'],_0x2e7813['id']);}else{logger[_0xb47c('0x8')](_0xb47c('0x23'),_0x1b6112[_0xb47c('0x24')],_0x4abfe2['id'],_[_0xb47c('0x14')](_0x331e51,'id')[_0xb47c('0x25')](','));}return;}else{logger['info'](_0xb47c('0x26'),_0x1b6112[_0xb47c('0x24')],_0x4abfe2['id']);var _0x39cf2e={'ListId':_0x3d7d96};var _0x28a852=_0x1deeca[_0xb47c('0x27')]&&_0x1deeca[_0xb47c('0x27')]!=='0'?_0x1deeca[_0xb47c('0x27')]:_0xb47c('0x12');if(_0x185f98){logger[_0xb47c('0x8')](_0xb47c('0x28'),_0x1b6112['uniqueid'],_0x4abfe2['id']);_0x39cf2e[_0x28a852]=_[_0xb47c('0xc')](_0x1b6112[_0xb47c('0x15')])?_0x1b6112[_0xb47c('0x29')]:_0x1b6112[_0xb47c('0x16')];if(_[_0xb47c('0xc')](_0x1b6112['routeId'])){_0x39cf2e['firstName']=_0x1b6112[_0xb47c('0x2a')]&&_0x1b6112[_0xb47c('0x2a')]!==_0xb47c('0x2b')?_0x1b6112[_0xb47c('0x2a')]:'Unknown';}else{_0x39cf2e[_0xb47c('0x17')]=_0x1b6112[_0xb47c('0x2c')]&&_0x1b6112[_0xb47c('0x2c')]!==_0xb47c('0x2b')?_0x1b6112[_0xb47c('0x2c')]:_0xb47c('0x2d');}return BPromise[_0xb47c('0x1e')]()['then'](cmContactRpc[_0xb47c('0x2e')](_0x39cf2e))['then'](function(_0x4a42ec){_0x2e7813=_0x4a42ec;_0x331e51[_0xb47c('0x2f')](_0x4a42ec);if(_0x2e7813){logger[_0xb47c('0x8')](_0xb47c('0x30'),_0x1b6112[_0xb47c('0x24')],_0x4abfe2['id'],_0x2e7813['id']);}return;});}else{logger[_0xb47c('0x8')](_0xb47c('0x31'),_0x1b6112[_0xb47c('0x24')],_0x4abfe2['id']);_0x39cf2e[_0x28a852]=_[_0xb47c('0xc')](_0x1b6112[_0xb47c('0x15')])?_0x1b6112[_0xb47c('0x29')]:_0x1b6112[_0xb47c('0x16')];if(_[_0xb47c('0xc')](_0x1b6112[_0xb47c('0x15')])){_0x39cf2e['firstName']=_0x1b6112[_0xb47c('0x2a')]&&_0x1b6112['calleridname']!==_0xb47c('0x2b')?_0x1b6112[_0xb47c('0x2a')]:_0xb47c('0x2d');}else{_0x39cf2e['firstName']=_0x1b6112['destcalleridname']&&_0x1b6112[_0xb47c('0x2c')]!==_0xb47c('0x2b')?_0x1b6112[_0xb47c('0x2c')]:'Unknown';}_0x2e7813=_0x39cf2e;_0x331e51[_0xb47c('0x2f')](_0x39cf2e);return;}}})[_0xb47c('0x1f')](function(){if(_0x21d4a7){emit(_0x1b6112[_0xb47c('0x24')],_0x4abfe2,util[_0xb47c('0x32')](_0xb47c('0x33'),_0x21d4a7[_0xb47c('0x34')]),util[_0xb47c('0x32')](_0xb47c('0x35'),_0x1deeca[_0xb47c('0x36')][_0xb47c('0x37')]()),{'evt':_[_0xb47c('0x38')](_0x1b6112,{'autoCreate':_0x185f98}),'contact':_0x2e7813===undefined?{}:_0x2e7813,'contacts':_0x331e51[_0xb47c('0x21')]===0x0?undefined:_0x331e51});}});}; \ No newline at end of file +var _0xe022=['ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','[CM][%s][%s]','emit','data1','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','info','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','','format','user:%s','name','trigger:%s','merge','length','lodash','bluebird'];(function(_0x3fb02a,_0x37c520){var _0x54ec84=function(_0x3e690f){while(--_0x3e690f){_0x3fb02a['push'](_0x3fb02a['shift']());}};_0x54ec84(++_0x37c520);}(_0xe022,0xa3));var _0x2e02=function(_0x288192,_0x13167c){_0x288192=_0x288192-0x0;var _0x233844=_0xe022[_0x288192];return _0x233844;};'use strict';var _=require(_0x2e02('0x0'));var BPromise=require(_0x2e02('0x1'));var Redis=require(_0x2e02('0x2'));var util=require(_0x2e02('0x3'));var config=require(_0x2e02('0x4'));var logger=require(_0x2e02('0x5'))('trigger');var cmContactRpc=require(_0x2e02('0x6'));config[_0x2e02('0x7')]=_[_0x2e02('0x8')](config['redis'],{'host':_0x2e02('0x9'),'port':0x18eb});var io=require(_0x2e02('0xa'))(new Redis(config['redis']));function emit(_0x13f530,_0x2a1774,_0x1032b1,_0x84839b,_0x10d01a){logger['info'](_0x2e02('0xb'),_0x13f530,_0x2a1774['id'],_0x1032b1,_0x84839b,JSON['stringify'](_0x10d01a));io['to'](_0x1032b1)[_0x2e02('0xc')](_0x84839b,_0x10d01a);}exports['exec']=function(_0x3ed9b4,_0x184073,_0x458154,_0x1707d8){var _0x37916a,_0x5bb6ae;var _0x3b3992={};var _0x149809;var _0x10519f=Number(_0x458154[_0x2e02('0xd')]);var _0x47ee14=_0x458154[_0x2e02('0xe')]?Boolean(Number(_0x458154[_0x2e02('0xe')])):![];var _0x3b0007;var _0x3bb8fd=![];if(!_['isNil'](_0x458154['data5'])){if(_0x458154[_0x2e02('0xf')]=='1')_0x3bb8fd=!![];}if(!_0x3bb8fd){if(_0x1707d8[_0x2e02('0x10')]){_0x3b3992['id']=_0x1707d8[_0x2e02('0x10')];}}if(!_0x3b3992['id']){_0x3b3992[_0x2e02('0x11')]=_0x10519f;_0x3b0007=_0x458154[_0x2e02('0x12')]&&_0x458154['data3']!=='0'?_0x458154['data3'][_0x2e02('0x13')](','):[_0x2e02('0x14')];_0x3b3992[_0x2e02('0x15')]=_[_0x2e02('0x16')](_0x3b0007,function(_0x2ae04f){var _0x321a88={};_0x321a88[_0x2ae04f]=_0x1707d8[_0x2e02('0x17')]?_0x1707d8[_0x2e02('0x18')]:_0x1707d8['calleridnum'];return _0x321a88;});_0x149809=_0x1707d8['routeId']?_0x1707d8[_0x2e02('0x18')]:_0x1707d8[_0x2e02('0x19')];}var _0x1082ed=['id',_0x2e02('0x1a'),'lastName',_0x2e02('0x14'),_0x2e02('0x1b'),_0x2e02('0x1c'),_0x2e02('0x11'),'createdAt','scheduledAt',_0x2e02('0x1d')];var _0x324983=_[_0x2e02('0x1e')](_0x1082ed,_0x3b0007);BPromise[_0x2e02('0x1f')]()[_0x2e02('0x20')](cmContactRpc[_0x2e02('0x21')]({'attributes':_0x324983,'where':_0x3b3992,'phone':_0x149809}))[_0x2e02('0x20')](function(_0x39add0){_0x5bb6ae=_0x39add0;if(!_[_0x2e02('0x22')](_0x5bb6ae)){if(_0x5bb6ae['length']===0x1){_0x37916a=_0x5bb6ae[0x0];logger['info'](_0x2e02('0x23'),_0x1707d8[_0x2e02('0x24')],_0x184073['id'],_0x37916a['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1707d8[_0x2e02('0x24')],_0x184073['id'],_[_0x2e02('0x16')](_0x5bb6ae,'id')[_0x2e02('0x25')](','));}return;}else{logger[_0x2e02('0x26')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1707d8[_0x2e02('0x24')],_0x184073['id']);var _0x408452={'ListId':_0x10519f};var _0x5851d5=_0x458154[_0x2e02('0x27')]&&_0x458154[_0x2e02('0x27')]!=='0'?_0x458154[_0x2e02('0x27')]:'phone';if(_0x47ee14){logger['info'](_0x2e02('0x28'),_0x1707d8[_0x2e02('0x24')],_0x184073['id']);_0x408452[_0x5851d5]=_[_0x2e02('0x29')](_0x1707d8[_0x2e02('0x17')])?_0x1707d8[_0x2e02('0x19')]:_0x1707d8[_0x2e02('0x18')];if(_['isNil'](_0x1707d8[_0x2e02('0x17')])){_0x408452[_0x2e02('0x1a')]=_0x1707d8[_0x2e02('0x2a')]&&_0x1707d8[_0x2e02('0x2a')]!==''?_0x1707d8[_0x2e02('0x2a')]:_0x2e02('0x2b');}else{_0x408452['firstName']=_0x1707d8['destcalleridname']&&_0x1707d8[_0x2e02('0x2c')]!==''?_0x1707d8[_0x2e02('0x2c')]:_0x2e02('0x2b');}return BPromise[_0x2e02('0x1f')]()[_0x2e02('0x20')](cmContactRpc[_0x2e02('0x2d')](_0x408452))[_0x2e02('0x20')](function(_0x5cd949){_0x37916a=_0x5cd949;_0x5bb6ae[_0x2e02('0x2e')](_0x5cd949);if(_0x37916a){logger[_0x2e02('0x26')](_0x2e02('0x2f'),_0x1707d8[_0x2e02('0x24')],_0x184073['id'],_0x37916a['id']);}return;});}else{logger[_0x2e02('0x26')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x1707d8['uniqueid'],_0x184073['id']);_0x408452[_0x5851d5]=_[_0x2e02('0x29')](_0x1707d8['routeId'])?_0x1707d8[_0x2e02('0x19')]:_0x1707d8[_0x2e02('0x18')];if(_[_0x2e02('0x29')](_0x1707d8[_0x2e02('0x17')])){_0x408452[_0x2e02('0x1a')]=_0x1707d8[_0x2e02('0x2a')]&&_0x1707d8['calleridname']!==_0x2e02('0x30')?_0x1707d8[_0x2e02('0x2a')]:_0x2e02('0x2b');}else{_0x408452[_0x2e02('0x1a')]=_0x1707d8[_0x2e02('0x2c')]&&_0x1707d8[_0x2e02('0x2c')]!==''?_0x1707d8[_0x2e02('0x2c')]:_0x2e02('0x2b');}_0x37916a=_0x408452;_0x5bb6ae['push'](_0x408452);return;}}})[_0x2e02('0x20')](function(){if(_0x3ed9b4){emit(_0x1707d8['uniqueid'],_0x184073,util[_0x2e02('0x31')](_0x2e02('0x32'),_0x3ed9b4[_0x2e02('0x33')]),util[_0x2e02('0x31')](_0x2e02('0x34'),_0x458154['action']['toLowerCase']()),{'evt':_[_0x2e02('0x35')](_0x1707d8,{'autoCreate':_0x47ee14}),'contact':_0x37916a===undefined?{}:_0x37916a,'contacts':_0x5bb6ae[_0x2e02('0x36')]===0x0?undefined:_0x5bb6ae});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7a599a1..e72fc32 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 _0x7fec=['user:%s','name','trigger:%s:%s','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','query','search','channel','every','AllConditions','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','created','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','debug','inspect','hasOwnProperty','status','checkTrigger','merge','variables','length','Actions','interface','action','toLowerCase','contactmanager','browser','data1','TemplateId','data2','render','html','buildUri','data3','isNil','uriLocation','data5','800','windowHeight','data6','600','winApplication','winArguments','format'];(function(_0x44e767,_0x1f21ec){var _0x884359=function(_0x1f9e07){while(--_0x1f9e07){_0x44e767['push'](_0x44e767['shift']());}};_0x884359(++_0x1f21ec);}(_0x7fec,0x128));var _0xc7fe=function(_0x1bb2ff,_0x2d0833){_0x1bb2ff=_0x1bb2ff-0x0;var _0x1296b1=_0x7fec[_0x1bb2ff];return _0x1296b1;};'use strict';var util=require(_0xc7fe('0x0'));var _=require(_0xc7fe('0x1'));var url=require(_0xc7fe('0x2'));var Mustache=require(_0xc7fe('0x3'));var Redis=require(_0xc7fe('0x4'));var urlforward=require(_0xc7fe('0x5'));var integration=require(_0xc7fe('0x6'));var cmContact=require('./cmContact');var script=require('./script');var config=require(_0xc7fe('0x7'));var logger=require(_0xc7fe('0x8'))('trigger');var ami=require(_0xc7fe('0x9'));config[_0xc7fe('0xa')]=_['defaults'](config[_0xc7fe('0xa')],{'host':_0xc7fe('0xb'),'port':0x18eb});var io=require(_0xc7fe('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x2958bd,_0x59b233){return _0x2958bd==_0x59b233;},'not_equals':function(_0x365227,_0x2e7d3a){return _0x365227!=_0x2e7d3a;}};var barAndWebActions=[_0xc7fe('0xd'),'url',_0xc7fe('0xe')];function Trigger(_0x242977){this[_0xc7fe('0xf')]=_0x242977[_0xc7fe('0xf')];this[_0xc7fe('0x10')]=_0x242977[_0xc7fe('0x10')];this[_0xc7fe('0x11')]=_0x242977[_0xc7fe('0x11')];this['templates']=_0x242977[_0xc7fe('0x12')];this[_0xc7fe('0x13')]=_0x242977[_0xc7fe('0x13')];this[_0xc7fe('0x14')]=_0x242977[_0xc7fe('0x14')];this['freshdeskAccounts']=_0x242977[_0xc7fe('0x15')];this[_0xc7fe('0x16')]=_0x242977[_0xc7fe('0x16')];this[_0xc7fe('0x17')]=_0x242977[_0xc7fe('0x17')];this[_0xc7fe('0x18')]=_0x242977['zohoAccounts'];this[_0xc7fe('0x19')]=_0x242977[_0xc7fe('0x19')];this[_0xc7fe('0x1a')]=_0x242977[_0xc7fe('0x1a')];this['servicenowAccounts']=_0x242977[_0xc7fe('0x1b')];this[_0xc7fe('0x1c')]=_0x242977[_0xc7fe('0x1c')];this[_0xc7fe('0x1d')]=_0x242977[_0xc7fe('0x1d')];this[_0xc7fe('0x1e')]={'zendesk':this[_0xc7fe('0x14')],'salesforce':this[_0xc7fe('0x16')],'freshdesk':this[_0xc7fe('0x15')],'sugarcrm':this[_0xc7fe('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0xc7fe('0x19')],'vtiger':this[_0xc7fe('0x1a')],'dynamics365':this[_0xc7fe('0x1c')],'freshsales':this[_0xc7fe('0x1d')],'servicenow':this[_0xc7fe('0x1b')]};ami['on'](_0xc7fe('0x1f'),this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x22'),this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on']('custom:agentringnoanswer',this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on']('custom:agentcomplete',this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x23'),this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x24'),this['syncCustomEvent'][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x25'),this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x26'),this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on']('custom:agentreject',this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x27'),this['syncCustomEvent'][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x28'),this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x29'),this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x2a'),this[_0xc7fe('0x2b')][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x2c'),this[_0xc7fe('0x2b')][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x2d'),this[_0xc7fe('0x2b')][_0xc7fe('0x21')](this));ami['on']('custom:newinteraction',this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x2e'),this['syncCustomEvent'][_0xc7fe('0x21')](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x2f'),this['syncCustomEvent'][_0xc7fe('0x21')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0xc7fe('0x21')](this));ami['on']('custom:acceptmessage',this[_0xc7fe('0x20')]['bind'](this));ami['on']('custom:rejectmessage',this[_0xc7fe('0x20')][_0xc7fe('0x21')](this));ami['on'](_0xc7fe('0x30'),this[_0xc7fe('0x20')]['bind'](this));}Trigger[_0xc7fe('0x31')][_0xc7fe('0x32')]=function(_0x1ef0a7,_0x5e95a9,_0x408a3b){logger[_0xc7fe('0x33')](_0x1ef0a7,_0x5e95a9,JSON[_0xc7fe('0x34')](_0x408a3b));io['to'](_0x1ef0a7)[_0xc7fe('0x32')](_0x5e95a9,_0x408a3b);};Trigger[_0xc7fe('0x31')][_0xc7fe('0x20')]=function(_0x4006cd){var _0x5cdede=_[_0xc7fe('0x35')](_0x4006cd);if(typeof _0x5cdede[_0xc7fe('0x36')]===_0xc7fe('0x37')){_0x5cdede[_0xc7fe('0x36')]=_0xc7fe('0x38');}logger[_0xc7fe('0x39')](_0xc7fe('0x20'),util[_0xc7fe('0x3a')](_0x5cdede,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x5cdede);};Trigger[_0xc7fe('0x31')]['syncAgentDial']=function(_0xc556fc){if(this['agents'][_0xc556fc['interface']]){this[_0xc7fe('0x20')](_0xc556fc);}};Trigger['prototype']['checkTriggers']=function(_0x18b657){var _0x45bfe7;for(var _0x5a88f8 in this[_0xc7fe('0xf')]){if(this[_0xc7fe('0xf')][_0xc7fe('0x3b')](_0x5a88f8)){if(this['triggers'][_0x5a88f8][_0xc7fe('0x3c')]){_0x45bfe7=this[_0xc7fe('0x3d')](this[_0xc7fe('0xf')][_0x5a88f8],_0x18b657);if(_0x45bfe7){_[_0xc7fe('0x3e')](_0x18b657,_0x18b657[_0xc7fe('0x3f')]);for(var _0x5bf763=0x0,_0x1a74ba,_0x14ccbf,_0x464c25;_0x5bf7630x0){_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 _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x105975,_0x27c552){var _0xbd10e1=function(_0x1cbb6a){while(--_0x1cbb6a){_0x105975['push'](_0x105975['shift']());}};_0xbd10e1(++_0x27c552);}(_0x7217,0x19e));var _0x7721=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x7217[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 7a67387..fe0d7fa 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 _0xff15=['clientSecret','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','then','value','isNil','validateEmail','email','userEmail','length','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','toLowerCase','destcalleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','contacts?$select=','&$filter=','contactid','nothing','toUpperCase',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','%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:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','calleridnum',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','CloudProvider','tenantId','data2','resolve','POST','remoteUri','username','password'];(function(_0xfddcac,_0x1bcd46){var _0x5c6ff0=function(_0x38bb6c){while(--_0x38bb6c){_0xfddcac['push'](_0xfddcac['shift']());}};_0x5c6ff0(++_0x1bcd46);}(_0xff15,0x1b0));var _0x5ff1=function(_0x38aeea,_0x57522a){_0x38aeea=_0x38aeea-0x0;var _0x5e8d2c=_0xff15[_0x38aeea];return _0x5e8d2c;};'use strict';var _=require(_0x5ff1('0x0'));var rp=require(_0x5ff1('0x1'));var util=require(_0x5ff1('0x2'));var intUtil=require('./util');var md5=require(_0x5ff1('0x3'));var Redis=require(_0x5ff1('0x4'));var logger=require(_0x5ff1('0x5'))(_0x5ff1('0x6'));var config=require(_0x5ff1('0x7'));config[_0x5ff1('0x8')]=_[_0x5ff1('0x9')](config[_0x5ff1('0x8')],{'host':_0x5ff1('0xa'),'port':0x18eb});var io=require(_0x5ff1('0xb'))(new Redis(config[_0x5ff1('0x8')]));function getAuthToken(_0xb22e0a,_0x253b88,_0x43ebdf){if(_0xb22e0a['modernAuthentication']){_0xb22e0a['remoteUri']=_0xb22e0a[_0x5ff1('0xc')]['data7'];_0xb22e0a[_0x5ff1('0xd')]=_0xb22e0a['CloudProvider'][_0x5ff1('0xe')];return Promise[_0x5ff1('0xf')](_0xb22e0a[_0x5ff1('0xc')]['data5']);}var _0x46ba5b={'method':_0x5ff1('0x10'),'uri':_0x253b88,'form':{'client_id':_0xb22e0a['clientId'],'resource':_0xb22e0a[_0x5ff1('0x11')],'username':_0xb22e0a[_0x5ff1('0x12')],'password':_0xb22e0a[_0x5ff1('0x13')],'grant_type':_0x5ff1('0x13'),'client_secret':_0xb22e0a[_0x5ff1('0x14')]},'json':!![]};return rp(_0x46ba5b)['then'](function(_0x560156){return _0x560156[_0x5ff1('0x15')];})[_0x5ff1('0x16')](function(_0x19efb8){logger[_0x5ff1('0x17')]('['+[_0x43ebdf['toUpperCase']()]+_0x5ff1('0x18'));return _0x19efb8[_0x5ff1('0x19')];});}function getUser(_0x229e0b,_0x17e913,_0x54adcf,_0x184478,_0x2a4a62,_0x412ae6){return new Promise(function(_0x1fb26c,_0x5a7c2f){return getAuthToken(_0x17e913,_0x184478,_0x412ae6)['then'](function(_0x11077b){var _0xba439b={'method':_0x5ff1('0x1a'),'uri':_0x2a4a62+_0x5ff1('0x1b'),'headers':{'Authorization':_0x5ff1('0x1c')+_0x11077b,'OData-Version':_0x5ff1('0x1d')},'json':!![]};return rp(_0xba439b);})[_0x5ff1('0x1e')](function(_0x3bb054){var _0xa60df0=_0x3bb054[_0x5ff1('0x1f')];var _0xc28381=![];var _0x1b40cd=null;if(!_[_0x5ff1('0x20')](_0x54adcf)){if(intUtil[_0x5ff1('0x21')](_0x54adcf[_0x5ff1('0x22')])){_0x229e0b[_0x5ff1('0x23')]=_0x54adcf[_0x5ff1('0x22')];for(_0x1b40cd=0x0;_0x1b40cd<_0xa60df0[_0x5ff1('0x24')];_0x1b40cd++){if(_0xa60df0[_0x1b40cd]['internalemailaddress']===_0x54adcf[_0x5ff1('0x22')]&&!_0xa60df0[_0x1b40cd][_0x5ff1('0x25')]){_0xc28381=!![];logger[_0x5ff1('0x26')]('['+[_0x412ae6['toUpperCase']()]+']\x20Agent\x20found\x20'+_0xa60df0[_0x1b40cd][_0x5ff1('0x27')]+'!');_0x229e0b[_0x5ff1('0x28')]=_0xa60df0[_0x1b40cd][_0x5ff1('0x27')];}}}}if(!_0xc28381){logger['info']('['+[_0x412ae6['toUpperCase']()]+_0x5ff1('0x29'));_0x229e0b['userEmail']=_0x17e913[_0x5ff1('0x12')];for(_0x1b40cd=0x0;_0x1b40cd<_0xa60df0[_0x5ff1('0x24')];_0x1b40cd++){if(_0xa60df0[_0x1b40cd][_0x5ff1('0x2a')]===_0x17e913['username']){_0x229e0b['userId']=_0xa60df0[_0x1b40cd][_0x5ff1('0x27')];}}}_0x1fb26c(_0x229e0b);})['catch'](function(_0xe97cad){_0x5a7c2f(_0xe97cad[_0x5ff1('0x19')]);});});}function createEndUser(_0x1d680b,_0xbd1007,_0x4fcc8a,_0x88fbd6,_0x47670a,_0x105d60,_0xf5d7b){return new Promise(function(_0x15a975,_0x913847){return getAuthToken(_0xbd1007,_0x4fcc8a,_0x105d60)[_0x5ff1('0x1e')](function(_0x7d1bf8){var _0x22dbab=_0x105d60[_0x5ff1('0x2b')]()==='outbound'?_0x47670a[_0x5ff1('0x2c')]:_0x47670a['calleridnum'];var _0x4de975={'method':_0x5ff1('0x10'),'uri':_0x88fbd6+'contacts','body':{'fullname':_0x22dbab,'firstname':_0x22dbab,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5ff1('0x2d')+_0x1d680b[_0x5ff1('0x28')]+')'},'headers':{'Authorization':_0x5ff1('0x1c')+_0x7d1bf8,'OData-Version':_0x5ff1('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x4de975[_0x5ff1('0x2e')][_0xf5d7b]=_0x22dbab;return rp(_0x4de975);})[_0x5ff1('0x1e')](function(_0x36ec05){var _0x373c0d=_0x36ec05[_0x5ff1('0x2f')][_0x5ff1('0x30')];var _0x19ac72=_0x373c0d[_0x5ff1('0x31')](_0x373c0d[_0x5ff1('0x32')]('(')+0x1,_0x373c0d[_0x5ff1('0x32')](')'));_0x1d680b[_0x5ff1('0x33')]=_0x19ac72;_0x15a975(_0x1d680b);})[_0x5ff1('0x16')](function(_0x1825fc){_0x913847(_0x1825fc['message']);});});}function getEndUser(_0x58e17b,_0x3b2402,_0x321fcd,_0x5e5071,_0x11fccf,_0x2438ee,_0x4ee0a3,_0xd4cf2){var _0x58daeb=_0x2438ee[_0x5ff1('0x2b')]()===_0x5ff1('0x34')?_0x11fccf[_0x5ff1('0x2c')]:_0x11fccf['calleridnum'];return getAuthToken(_0x3b2402,_0x321fcd,_0x2438ee)[_0x5ff1('0x1e')](function(_0x320c73){_0xd4cf2=_0xd4cf2?_0xd4cf2:'telephone1';var _0x1ad8ad={'method':'GET','uri':_0x5e5071+_0x5ff1('0x35')+_0xd4cf2+_0x5ff1('0x36')+_0xd4cf2+'\x20eq\x20\x27'+_0x58daeb['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x5ff1('0x1c')+_0x320c73,'If-None-Match':null,'OData-Version':_0x5ff1('0x1d')},'json':!![]};return rp(_0x1ad8ad);})['then'](function(_0xe3f5a1){var _0x22b490=![];if(!_0xe3f5a1)return _0x22b490;var _0x18608e=_0xe3f5a1['value'];for(var _0x5da5c1=0x0;_0x5da5c1<_0x18608e['length'];_0x5da5c1++){if(_0x18608e[_0x5da5c1][_0xd4cf2]===_0x58daeb){_0x22b490=!![];_0x58e17b[_0x5ff1('0x33')]=_0x18608e[_0x5da5c1][_0x5ff1('0x37')];}}return _0x22b490;})[_0x5ff1('0x1e')](function(_0x4c9891){if(_0x4c9891)return _0x58e17b;if(_0x4ee0a3===_0x5ff1('0x38')){logger[_0x5ff1('0x26')]('['+[_0x2438ee[_0x5ff1('0x39')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x58e17b;}return createEndUser(_0x58e17b,_0x3b2402,_0x321fcd,_0x5e5071,_0x11fccf,_0x2438ee,_0xd4cf2)[_0x5ff1('0x1e')](function(_0x34d744){logger[_0x5ff1('0x26')]('['+[_0x2438ee[_0x5ff1('0x39')]()]+_0x5ff1('0x3a'),_0x34d744[_0x5ff1('0x33')]);return _0x34d744;});});}function getCustomFields(_0x3fd27f,_0x463915,_0x543597){var _0x5cfdc6={};if(_0x3fd27f[_0x5ff1('0x24')]>0x0){_[_0x5ff1('0x3b')](_0x3fd27f,function(_0x10f083){if(_[_0x5ff1('0x3c')](['string',_0x5ff1('0x3d')],_0x10f083[_0x5ff1('0x3e')])&&_0x10f083[_0x5ff1('0x3f')]&&!_0x10f083[_0x5ff1('0x40')]){var _0x1f72f5=_0x10f083[_0x5ff1('0x41')][_0x5ff1('0x2b')]();var _0x4e473b=_0x1f72f5['substring'](0x0,_0x1f72f5[_0x5ff1('0x42')]('_'));var _0x147fdc=_0x1f72f5[_0x5ff1('0x31')](_0x1f72f5['indexOf']('_')+0x1);if(_0x4e473b===_0x543597){_0x5cfdc6[_0x147fdc]=_0x10f083[_0x5ff1('0x43')];}}});}return _0x5cfdc6;}function getTicket(_0x2fa1c1,_0x5a2774,_0x153290,_0x40762a,_0x49257a,_0xb3be0a,_0x245f8f){return new Promise(function(_0x4f04de,_0xed5c7a){var _0x1b5206;return getAuthToken(_0x5a2774,_0x153290,_0x245f8f)[_0x5ff1('0x1e')](function(_0x5141af){if(_0xb3be0a[_0x5ff1('0x44')]===_0x5ff1('0x45')){_0x1b5206={'method':_0x5ff1('0x10'),'uri':_0x40762a+_0x5ff1('0x46'),'body':Object[_0x5ff1('0x47')]({},{'title':intUtil[_0x5ff1('0x48')](_0xb3be0a[_0x5ff1('0x49')],_0x49257a,'\x20'),'description':intUtil[_0x5ff1('0x48')](_0xb3be0a[_0x5ff1('0x4a')],_0x49257a,'\x0a'),'customerid_contact@odata.bind':_0x2fa1c1[_0x5ff1('0x33')]?_0x5ff1('0x4b')+_0x2fa1c1[_0x5ff1('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2fa1c1[_0x5ff1('0x28')]+')','caseorigincode':'1'},getCustomFields(_0xb3be0a[_0x5ff1('0x4c')],_0x49257a,_0xb3be0a['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x5141af,'OData-Version':_0x5ff1('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xb3be0a['ticketType']===_0x5ff1('0x4d')){var _0xdc4819=_0x2fa1c1[_0x5ff1('0x33')]?[{'partyid_systemuser@odata.bind':_0x5ff1('0x2d')+_0x2fa1c1['userId']+')','participationtypemask':_0x2fa1c1[_0x5ff1('0x4e')]===_0x5ff1('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x5ff1('0x4b')+_0x2fa1c1[_0x5ff1('0x33')]+')','participationtypemask':_0x2fa1c1[_0x5ff1('0x4e')]===_0x5ff1('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5ff1('0x2d')+_0x2fa1c1['userId']+')','participationtypemask':_0x2fa1c1[_0x5ff1('0x4e')]===_0x5ff1('0x4f')?0x2:0x1}];_0x1b5206={'method':_0x5ff1('0x10'),'uri':_0x40762a+_0x5ff1('0x50'),'body':Object['assign']({},{'subject':intUtil[_0x5ff1('0x48')](_0xb3be0a[_0x5ff1('0x49')],_0x49257a,'\x20'),'phonenumber':String(_0x49257a['calleridnum']),'description':intUtil[_0x5ff1('0x48')](_0xb3be0a[_0x5ff1('0x4a')],_0x49257a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2fa1c1[_0x5ff1('0x33')]?'/contacts('+_0x2fa1c1['enduserId']+')':undefined,'ownerid@odata.bind':_0x5ff1('0x2d')+_0x2fa1c1['userId']+')','directioncode':_0x2fa1c1[_0x5ff1('0x4e')]===_0x5ff1('0x4f')?![]:!![],'phonecall_activity_parties':_0xdc4819},getCustomFields(_0xb3be0a[_0x5ff1('0x4c')],_0x49257a,_0xb3be0a['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x5141af,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1b5206);})[_0x5ff1('0x1e')](function(_0x49180c){var _0x1f5966=_0x49180c['headers'][_0x5ff1('0x30')];var _0xac2601=_0x1f5966[_0x5ff1('0x31')](_0x1f5966['lastIndexOf']('(')+0x1,_0x1f5966['lastIndexOf'](')'));_0x2fa1c1[_0x5ff1('0x51')]=_0xac2601;_0x4f04de(_0x2fa1c1);})['catch'](function(_0x305b75){_0xed5c7a(_0x305b75[_0x5ff1('0x19')]);});});}function emit(_0x298d7c,_0x17a558,_0x1ef0da,_0x160e73){var _0x32d9d7={'uri':util['format'](_0x5ff1('0x52'),_0x298d7c,_0x1ef0da,_0x160e73)};io['to'](util[_0x5ff1('0x53')](_0x5ff1('0x54'),_0x17a558))[_0x5ff1('0x55')](_0x5ff1('0x56'),_0x32d9d7);}exports['cs']=function(_0x2a39a5,_0x194b27,_0x2d8ed6,_0x76c6e1,_0x16734f,_0x20a344,_0x36177d,_0x55192f){var _0x30f538={};_0x20a344['remoteUri']=_0x20a344[_0x5ff1('0x57')]?intUtil[_0x5ff1('0x58')](_0x20a344[_0x5ff1('0xc')][_0x5ff1('0x59')]):intUtil[_0x5ff1('0x58')](_0x20a344[_0x5ff1('0x11')]);_0x20a344[_0x5ff1('0x5a')]=intUtil[_0x5ff1('0x58')](_0x20a344[_0x5ff1('0x5a')]);_0x30f538[_0x5ff1('0x4e')]=_0x55192f===_0x5ff1('0x4f')||_0x55192f===_0x5ff1('0x5b')?_0x5ff1('0x4f'):'outbound';var _0x5f4107=_0x20a344[_0x5ff1('0x57')]?util[_0x5ff1('0x53')]('%s/api/data/v9.0/',_0x20a344[_0x5ff1('0xc')][_0x5ff1('0x59')]):util['format'](_0x5ff1('0x5c'),_0x20a344[_0x5ff1('0x11')]);var _0x3b3528=util[_0x5ff1('0x53')]('https://login.microsoftonline.com/%s/oauth2/token',_0x20a344[_0x5ff1('0xd')]);var _0x1238d2=util[_0x5ff1('0x53')](_0x5ff1('0x5d'),_0x20a344['serverUrl'],_0x194b27[_0x5ff1('0x5e')],md5(_0x194b27['uniqueid']));if(_0x16734f&&_0x16734f[_0x5ff1('0x5f')]){logger[_0x5ff1('0x26')](_0x5ff1('0x60'),_0x5ff1('0x61'));_0x194b27[_0x5ff1('0x62')]=_0x1238d2;}else if(_0x36177d&&_0x36177d[_0x5ff1('0x63')]&&_0x36177d['recordingFormat']!==_0x5ff1('0x64')){logger[_0x5ff1('0x26')](_0x5ff1('0x65'),_0x5ff1('0x61'));_0x194b27[_0x5ff1('0x62')]=_0x1238d2;}else{_0x194b27[_0x5ff1('0x62')]='';}return getUser(_0x30f538,_0x20a344,_0x76c6e1,_0x3b3528,_0x5f4107,_0x55192f)['then'](function(_0x1b1d88){logger[_0x5ff1('0x26')]('['+_0x55192f[_0x5ff1('0x39')]()+_0x5ff1('0x66'),_0x1b1d88[_0x5ff1('0x28')]);logger[_0x5ff1('0x26')]('['+_0x55192f[_0x5ff1('0x39')]()+_0x5ff1('0x67'),_0x1b1d88[_0x5ff1('0x23')]);return getEndUser(_0x1b1d88,_0x20a344,_0x3b3528,_0x5f4107,_0x194b27,_0x55192f,_0x2d8ed6[_0x5ff1('0x68')],_0x2d8ed6[_0x5ff1('0x69')]);})[_0x5ff1('0x1e')](function(_0x51c87b){logger[_0x5ff1('0x26')]('['+_0x55192f['toUpperCase']()+_0x5ff1('0x6a'),_0x51c87b[_0x5ff1('0x33')]);logger[_0x5ff1('0x26')]('['+_0x55192f['toUpperCase']()+_0x5ff1('0x6b'),_0x194b27[_0x5ff1('0x6c')]);return getTicket(_0x51c87b,_0x20a344,_0x3b3528,_0x5f4107,_0x194b27,_0x2d8ed6,_0x55192f);})[_0x5ff1('0x1e')](function(_0x35193f){logger[_0x5ff1('0x26')](util[_0x5ff1('0x53')]('['+_0x55192f[_0x5ff1('0x39')]()+_0x5ff1('0x6d'),_0x2d8ed6[_0x5ff1('0x44')],_0x35193f[_0x5ff1('0x51')]));logger[_0x5ff1('0x26')](util[_0x5ff1('0x53')]('['+_0x55192f[_0x5ff1('0x39')]()+']\x20Call\x20direction:\x20%s',_0x55192f));if(_0x55192f!==_0x5ff1('0x5b')&&_0x2d8ed6[_0x5ff1('0x6e')]){logger['info']('['+_0x55192f[_0x5ff1('0x39')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x20a344[_0x5ff1('0x11')],_0x76c6e1['name'],_0x2d8ed6[_0x5ff1('0x44')],_0x35193f[_0x5ff1('0x51')]);}})['catch'](function(_0x12880a){logger[_0x5ff1('0x17')]('['+_0x55192f['toUpperCase']()+_0x5ff1('0x6f'),_0x12880a[_0x5ff1('0x19')]);console['error'](_0x5ff1('0x70'),_0x12880a);});}; \ No newline at end of file +var _0x625b=['catch','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','4.0','body','headers','odata-entityid','substring','lastIndexOf','calleridnum','telephone1','contacts?$select=','&$filter=','replace','%2b','enduserId','contactid','nothing','info',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','customField','idField','indexOf','content','incident','incidents','assign','Subjects','Descriptions','Fields','ticketType','phonecall','callDirection','queue','/contacts(','phonecalls','getString','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','data5','POST','username','password','clientSecret','then','access_token','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','email','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','length','userId'];(function(_0x506a06,_0x31a7da){var _0x5655da=function(_0x54fc58){while(--_0x54fc58){_0x506a06['push'](_0x506a06['shift']());}};_0x5655da(++_0x31a7da);}(_0x625b,0x135));var _0xb625=function(_0x3767e8,_0x33dc50){_0x3767e8=_0x3767e8-0x0;var _0x32b356=_0x625b[_0x3767e8];return _0x32b356;};'use strict';var _=require(_0xb625('0x0'));var rp=require(_0xb625('0x1'));var util=require(_0xb625('0x2'));var intUtil=require(_0xb625('0x3'));var md5=require(_0xb625('0x4'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0xb625('0x5'));var config=require(_0xb625('0x6'));config[_0xb625('0x7')]=_[_0xb625('0x8')](config[_0xb625('0x7')],{'host':_0xb625('0x9'),'port':0x18eb});var io=require(_0xb625('0xa'))(new Redis(config['redis']));function getAuthToken(_0x583d2f,_0x7b5d45,_0x163624){if(_0x583d2f[_0xb625('0xb')]){_0x583d2f[_0xb625('0xc')]=_0x583d2f[_0xb625('0xd')][_0xb625('0xe')];_0x583d2f['tenantId']=_0x583d2f[_0xb625('0xd')][_0xb625('0xf')];return Promise['resolve'](_0x583d2f['CloudProvider'][_0xb625('0x10')]);}var _0x25121b={'method':_0xb625('0x11'),'uri':_0x7b5d45,'form':{'client_id':_0x583d2f['clientId'],'resource':_0x583d2f[_0xb625('0xc')],'username':_0x583d2f[_0xb625('0x12')],'password':_0x583d2f[_0xb625('0x13')],'grant_type':_0xb625('0x13'),'client_secret':_0x583d2f[_0xb625('0x14')]},'json':!![]};return rp(_0x25121b)[_0xb625('0x15')](function(_0x363467){return _0x363467[_0xb625('0x16')];})['catch'](function(_0x20ca4c){logger[_0xb625('0x17')]('['+[_0x163624[_0xb625('0x18')]()]+']\x20Wrong\x20credentials!');return _0x20ca4c[_0xb625('0x19')];});}function getUser(_0x183d20,_0x580963,_0x9ac267,_0x37bd43,_0x275870,_0x248644){return new Promise(function(_0x4f98ee,_0x29ee52){return getAuthToken(_0x580963,_0x37bd43,_0x248644)[_0xb625('0x15')](function(_0x310ab2){var _0x2dafd5={'method':_0xb625('0x1a'),'uri':_0x275870+_0xb625('0x1b'),'headers':{'Authorization':_0xb625('0x1c')+_0x310ab2,'OData-Version':'4.0'},'json':!![]};return rp(_0x2dafd5);})[_0xb625('0x15')](function(_0x533098){var _0x18af2e=_0x533098[_0xb625('0x1d')];var _0x483edd=![];var _0x472dc4=null;if(!_['isNil'](_0x9ac267)){if(intUtil['validateEmail'](_0x9ac267[_0xb625('0x1e')])){_0x183d20['userEmail']=_0x9ac267[_0xb625('0x1e')];for(_0x472dc4=0x0;_0x472dc4<_0x18af2e['length'];_0x472dc4++){if(_0x18af2e[_0x472dc4][_0xb625('0x1f')]===_0x9ac267[_0xb625('0x1e')]&&!_0x18af2e[_0x472dc4][_0xb625('0x20')]){_0x483edd=!![];logger['info']('['+[_0x248644[_0xb625('0x18')]()]+_0xb625('0x21')+_0x18af2e[_0x472dc4][_0xb625('0x22')]+'!');_0x183d20['userId']=_0x18af2e[_0x472dc4][_0xb625('0x22')];}}}}if(!_0x483edd){logger['info']('['+[_0x248644[_0xb625('0x18')]()]+_0xb625('0x23'));_0x183d20[_0xb625('0x24')]=_0x580963[_0xb625('0x12')];for(_0x472dc4=0x0;_0x472dc4<_0x18af2e[_0xb625('0x25')];_0x472dc4++){if(_0x18af2e[_0x472dc4][_0xb625('0x1f')]===_0x580963[_0xb625('0x12')]){_0x183d20[_0xb625('0x26')]=_0x18af2e[_0x472dc4][_0xb625('0x22')];}}}_0x4f98ee(_0x183d20);})[_0xb625('0x27')](function(_0xe3b949){_0x29ee52(_0xe3b949[_0xb625('0x19')]);});});}function createEndUser(_0x5b90f5,_0x1c6a96,_0x50d39a,_0x22a902,_0x28ecc3,_0x47052c,_0x20497a){return new Promise(function(_0x412325,_0x4055b9){return getAuthToken(_0x1c6a96,_0x50d39a,_0x47052c)[_0xb625('0x15')](function(_0x4cf978){var _0x73f85e=_0x47052c[_0xb625('0x28')]()===_0xb625('0x29')?_0x28ecc3[_0xb625('0x2a')]:_0x28ecc3['calleridnum'];var _0x34e0b9={'method':'POST','uri':_0x22a902+_0xb625('0x2b'),'body':{'fullname':_0x73f85e,'firstname':_0x73f85e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb625('0x2c')+_0x5b90f5['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x4cf978,'OData-Version':_0xb625('0x2d')},'json':!![],'resolveWithFullResponse':!![]};_0x34e0b9[_0xb625('0x2e')][_0x20497a]=_0x73f85e;return rp(_0x34e0b9);})['then'](function(_0x2dc613){var _0x40e0bc=_0x2dc613[_0xb625('0x2f')][_0xb625('0x30')];var _0x4e88b1=_0x40e0bc[_0xb625('0x31')](_0x40e0bc['lastIndexOf']('(')+0x1,_0x40e0bc[_0xb625('0x32')](')'));_0x5b90f5['enduserId']=_0x4e88b1;_0x412325(_0x5b90f5);})[_0xb625('0x27')](function(_0x1f5aec){_0x4055b9(_0x1f5aec['message']);});});}function getEndUser(_0x5e5eda,_0x5487e7,_0x38e6cc,_0xa3a9c3,_0x3dbdfe,_0x5bba9e,_0x419209,_0x492129){var _0x250d93=_0x5bba9e[_0xb625('0x28')]()==='outbound'?_0x3dbdfe[_0xb625('0x2a')]:_0x3dbdfe[_0xb625('0x33')];return getAuthToken(_0x5487e7,_0x38e6cc,_0x5bba9e)[_0xb625('0x15')](function(_0x270545){_0x492129=_0x492129?_0x492129:_0xb625('0x34');var _0x3926ee={'method':_0xb625('0x1a'),'uri':_0xa3a9c3+_0xb625('0x35')+_0x492129+_0xb625('0x36')+_0x492129+'\x20eq\x20\x27'+_0x250d93[_0xb625('0x37')]('+',_0xb625('0x38'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x270545,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3926ee);})[_0xb625('0x15')](function(_0xfb3c54){var _0x1161ad=![];if(!_0xfb3c54)return _0x1161ad;var _0x40a38b=_0xfb3c54['value'];for(var _0x2a8d87=0x0;_0x2a8d87<_0x40a38b[_0xb625('0x25')];_0x2a8d87++){if(_0x40a38b[_0x2a8d87][_0x492129]===_0x250d93){_0x1161ad=!![];_0x5e5eda[_0xb625('0x39')]=_0x40a38b[_0x2a8d87][_0xb625('0x3a')];}}return _0x1161ad;})[_0xb625('0x15')](function(_0x45b49b){if(_0x45b49b)return _0x5e5eda;if(_0x419209===_0xb625('0x3b')){logger[_0xb625('0x3c')]('['+[_0x5bba9e[_0xb625('0x18')]()]+_0xb625('0x3d'));return _0x5e5eda;}return createEndUser(_0x5e5eda,_0x5487e7,_0x38e6cc,_0xa3a9c3,_0x3dbdfe,_0x5bba9e,_0x492129)[_0xb625('0x15')](function(_0x129012){logger[_0xb625('0x3c')]('['+[_0x5bba9e[_0xb625('0x18')]()]+_0xb625('0x3e'),_0x129012[_0xb625('0x39')]);return _0x129012;});});}function getCustomFields(_0x44e946,_0x397095,_0x2d4b6e){var _0x4ec42c={};if(_0x44e946[_0xb625('0x25')]>0x0){_[_0xb625('0x3f')](_0x44e946,function(_0x2eb16b){if(_[_0xb625('0x40')]([_0xb625('0x41'),_0xb625('0x42')],_0x2eb16b[_0xb625('0x43')])&&_0x2eb16b['nameField']&&!_0x2eb16b[_0xb625('0x44')]){var _0x1b69f2=_0x2eb16b[_0xb625('0x45')][_0xb625('0x28')]();var _0x54e244=_0x1b69f2[_0xb625('0x31')](0x0,_0x1b69f2[_0xb625('0x46')]('_'));var _0x428927=_0x1b69f2[_0xb625('0x31')](_0x1b69f2[_0xb625('0x46')]('_')+0x1);if(_0x54e244===_0x2d4b6e){_0x4ec42c[_0x428927]=_0x2eb16b[_0xb625('0x47')];}}});}return _0x4ec42c;}function getTicket(_0x1e3363,_0x543f45,_0x10a394,_0x5e8bdf,_0x2bda8a,_0x3a961d,_0x148fe5){return new Promise(function(_0x3063ef,_0x52f72c){var _0x5c6406;return getAuthToken(_0x543f45,_0x10a394,_0x148fe5)['then'](function(_0x56aec5){if(_0x3a961d['ticketType']===_0xb625('0x48')){_0x5c6406={'method':'POST','uri':_0x5e8bdf+_0xb625('0x49'),'body':Object[_0xb625('0x4a')]({},{'title':intUtil['getString'](_0x3a961d[_0xb625('0x4b')],_0x2bda8a,'\x20'),'description':intUtil['getString'](_0x3a961d[_0xb625('0x4c')],_0x2bda8a,'\x0a'),'customerid_contact@odata.bind':_0x1e3363[_0xb625('0x39')]?'/contacts('+_0x1e3363[_0xb625('0x39')]+')':undefined,'ownerid@odata.bind':_0xb625('0x2c')+_0x1e3363[_0xb625('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x3a961d[_0xb625('0x4d')],_0x2bda8a,_0x3a961d[_0xb625('0x4e')])),'headers':{'Authorization':_0xb625('0x1c')+_0x56aec5,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3a961d[_0xb625('0x4e')]===_0xb625('0x4f')){var _0x5396a8=_0x1e3363[_0xb625('0x39')]?[{'partyid_systemuser@odata.bind':_0xb625('0x2c')+_0x1e3363[_0xb625('0x26')]+')','participationtypemask':_0x1e3363[_0xb625('0x50')]===_0xb625('0x51')?0x2:0x1},{'partyid_contact@odata.bind':_0xb625('0x52')+_0x1e3363['enduserId']+')','participationtypemask':_0x1e3363[_0xb625('0x50')]===_0xb625('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb625('0x2c')+_0x1e3363[_0xb625('0x26')]+')','participationtypemask':_0x1e3363[_0xb625('0x50')]==='queue'?0x2:0x1}];_0x5c6406={'method':_0xb625('0x11'),'uri':_0x5e8bdf+_0xb625('0x53'),'body':Object[_0xb625('0x4a')]({},{'subject':intUtil['getString'](_0x3a961d['Subjects'],_0x2bda8a,'\x20'),'phonenumber':String(_0x2bda8a[_0xb625('0x33')]),'description':intUtil[_0xb625('0x54')](_0x3a961d[_0xb625('0x4c')],_0x2bda8a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1e3363[_0xb625('0x39')]?_0xb625('0x52')+_0x1e3363[_0xb625('0x39')]+')':undefined,'ownerid@odata.bind':_0xb625('0x2c')+_0x1e3363[_0xb625('0x26')]+')','directioncode':_0x1e3363[_0xb625('0x50')]==='queue'?![]:!![],'phonecall_activity_parties':_0x5396a8},getCustomFields(_0x3a961d[_0xb625('0x4d')],_0x2bda8a,_0x3a961d[_0xb625('0x4e')])),'headers':{'Authorization':_0xb625('0x1c')+_0x56aec5,'OData-Version':_0xb625('0x2d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5c6406);})[_0xb625('0x15')](function(_0x5eac36){var _0x3c6b1e=_0x5eac36[_0xb625('0x2f')][_0xb625('0x30')];var _0x4589ea=_0x3c6b1e[_0xb625('0x31')](_0x3c6b1e[_0xb625('0x32')]('(')+0x1,_0x3c6b1e[_0xb625('0x32')](')'));_0x1e3363[_0xb625('0x55')]=_0x4589ea;_0x3063ef(_0x1e3363);})[_0xb625('0x27')](function(_0x1ff77d){_0x52f72c(_0x1ff77d[_0xb625('0x19')]);});});}function emit(_0x1bb666,_0x1da7ea,_0x2cb2cd,_0x5261c6){var _0x34b2bc={'uri':util['format'](_0xb625('0x56'),_0x1bb666,_0x2cb2cd,_0x5261c6)};io['to'](util[_0xb625('0x57')]('user:%s',_0x1da7ea))[_0xb625('0x58')](_0xb625('0x59'),_0x34b2bc);}exports['cs']=function(_0x3a2f84,_0x4f3842,_0xc3bb10,_0x5c5806,_0x198222,_0x1894b8,_0x28c047,_0x1ac01e){var _0x49d4a2={};_0x1894b8[_0xb625('0xc')]=_0x1894b8[_0xb625('0xb')]?intUtil[_0xb625('0x5a')](_0x1894b8[_0xb625('0xd')][_0xb625('0xe')]):intUtil['stripTrailingSlash'](_0x1894b8[_0xb625('0xc')]);_0x1894b8[_0xb625('0x5b')]=intUtil[_0xb625('0x5a')](_0x1894b8['serverUrl']);_0x49d4a2[_0xb625('0x50')]=_0x1ac01e===_0xb625('0x51')||_0x1ac01e===_0xb625('0x5c')?_0xb625('0x51'):_0xb625('0x29');var _0x806542=_0x1894b8[_0xb625('0xb')]?util['format']('%s/api/data/v9.0/',_0x1894b8[_0xb625('0xd')][_0xb625('0xe')]):util['format'](_0xb625('0x5d'),_0x1894b8['remoteUri']);var _0x3e8e78=util[_0xb625('0x57')](_0xb625('0x5e'),_0x1894b8[_0xb625('0x5f')]);var _0x483d81=util[_0xb625('0x57')](_0xb625('0x60'),_0x1894b8[_0xb625('0x5b')],_0x4f3842[_0xb625('0x61')],md5(_0x4f3842[_0xb625('0x61')]));if(_0x198222&&_0x198222[_0xb625('0x62')]){logger[_0xb625('0x3c')](_0xb625('0x63'),_0xb625('0x64'));_0x4f3842[_0xb625('0x65')]=_0x483d81;}else if(_0x28c047&&_0x28c047[_0xb625('0x66')]&&_0x28c047['recordingFormat']!==_0xb625('0x67')){logger[_0xb625('0x3c')](_0xb625('0x68'),'Recording\x20is\x20enabled!');_0x4f3842[_0xb625('0x65')]=_0x483d81;}else{_0x4f3842[_0xb625('0x65')]='';}return getUser(_0x49d4a2,_0x1894b8,_0x5c5806,_0x3e8e78,_0x806542,_0x1ac01e)['then'](function(_0x2955ff){logger[_0xb625('0x3c')]('['+_0x1ac01e[_0xb625('0x18')]()+_0xb625('0x69'),_0x2955ff[_0xb625('0x26')]);logger['info']('['+_0x1ac01e[_0xb625('0x18')]()+_0xb625('0x6a'),_0x2955ff[_0xb625('0x24')]);return getEndUser(_0x2955ff,_0x1894b8,_0x3e8e78,_0x806542,_0x4f3842,_0x1ac01e,_0xc3bb10[_0xb625('0x6b')],_0xc3bb10['additionalSearchContact']);})[_0xb625('0x15')](function(_0x467c4f){logger[_0xb625('0x3c')]('['+_0x1ac01e[_0xb625('0x18')]()+_0xb625('0x6c'),_0x467c4f[_0xb625('0x39')]);logger[_0xb625('0x3c')]('['+_0x1ac01e[_0xb625('0x18')]()+_0xb625('0x6d'),_0x4f3842[_0xb625('0x33')]);return getTicket(_0x467c4f,_0x1894b8,_0x3e8e78,_0x806542,_0x4f3842,_0xc3bb10,_0x1ac01e);})[_0xb625('0x15')](function(_0x16dc27){logger['info'](util[_0xb625('0x57')]('['+_0x1ac01e[_0xb625('0x18')]()+_0xb625('0x6e'),_0xc3bb10[_0xb625('0x4e')],_0x16dc27['ticketId']));logger[_0xb625('0x3c')](util['format']('['+_0x1ac01e['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x1ac01e));if(_0x1ac01e!=='unmanaged'&&_0xc3bb10[_0xb625('0x6f')]){logger[_0xb625('0x3c')]('['+_0x1ac01e['toUpperCase']()+']',_0xb625('0x70'));emit(_0x1894b8[_0xb625('0xc')],_0x5c5806[_0xb625('0x71')],_0xc3bb10[_0xb625('0x4e')],_0x16dc27[_0xb625('0x55')]);}})['catch'](function(_0x1e050e){logger[_0xb625('0x17')]('['+_0x1ac01e[_0xb625('0x18')]()+_0xb625('0x72'),_0x1e050e[_0xb625('0x19')]);console[_0xb625('0x17')](_0xb625('0x73'),_0x1e050e);});}; \ 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 fd52996..b293428 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 _0xa861=['Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','Subjects','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','push','idField','variableName','customVariable','Variable','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','serverUrl','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','lastevent','toUpperCase','lodash','request-promise','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','emit','info'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0xa861,0x16e));var _0x1a86=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0xa861[_0x1b1e76];return _0x3d743a;};'use strict';var _=require(_0x1a86('0x0'));var rp=require(_0x1a86('0x1'));var md5=require('md5');var util=require(_0x1a86('0x2'));var Redis=require('ioredis');var intUtil=require(_0x1a86('0x3'));var config=require(_0x1a86('0x4'));var logger=require(_0x1a86('0x5'))(_0x1a86('0x6'));config['redis']=_[_0x1a86('0x7')](config[_0x1a86('0x8')],{'host':_0x1a86('0x9'),'port':0x18eb});var io=require(_0x1a86('0xa'))(new Redis(config[_0x1a86('0x8')]));var headers={'Content-Type':_0x1a86('0xb'),'Accept':'application/json'};function emit(_0x4a5f8c,_0x5eda16,_0x15d11d){io['to'](_0x4a5f8c)[_0x1a86('0xc')](_0x5eda16,_0x15d11d);}function getTicket(_0xab616a,_0x2a0d01,_0x37ec0d,_0x5cbe4e,_0x250c15){logger[_0x1a86('0xd')](_0x1a86('0xe'));var _0x208b2d=_[_0x1a86('0xf')]({'responder_id':_0x2a0d01['id'],'requester_id':_0x37ec0d['id'],'name':util[_0x1a86('0x10')](_0x1a86('0x11'),_0x250c15[_0x1a86('0x12')]),'phone':_0x250c15['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x5cbe4e[_0x1a86('0x13')],_0x250c15,'\x20'),'description':intUtil['getString'](_0x5cbe4e['Descriptions'],_0x250c15,_0x1a86('0x14')),'tags':getTags(_0x5cbe4e[_0x1a86('0x15')],_0x1a86('0x16'))},getCustomFields(_0x5cbe4e[_0x1a86('0x17')],_0x250c15));_0x208b2d['custom_fields']=_[_0x1a86('0x18')](_[_0x1a86('0x19')](_0x208b2d[_0x1a86('0x1a')],'id'),_0x1a86('0x1b'));return request({'uri':util[_0x1a86('0x10')](_0x1a86('0x1c'),_0xab616a[_0x1a86('0x1d')]),'method':_0x1a86('0x1e'),'body':_0x208b2d})[_0x1a86('0x1f')](function(_0x554244){logger[_0x1a86('0xd')]('Ticket\x20created!');return _0x554244;});}function getUser(_0x1988ff,_0x4b77ce){if(intUtil[_0x1a86('0x20')](_0x4b77ce)){return request({'uri':util[_0x1a86('0x10')](_0x1a86('0x21'),_0x1988ff[_0x1a86('0x1d')]),'qs':{'email':_0x4b77ce}})[_0x1a86('0x1f')](function(_0x3b74b5){if(_0x3b74b5['length']){logger['info'](_0x1a86('0x22'));return _[_0x1a86('0x23')](_0x3b74b5,function(_0x69f5fd){return _0x69f5fd[_0x1a86('0x24')][_0x1a86('0x25')]===_0x4b77ce;});}else{logger[_0x1a86('0xd')](_0x1a86('0x26'));return request({'uri':util[_0x1a86('0x10')](_0x1a86('0x27'),_0x1988ff[_0x1a86('0x1d')])})[_0x1a86('0x1f')](function(_0x246d62){logger['info'](_0x1a86('0x28'));return _0x246d62;});}});}else{logger[_0x1a86('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x1988ff['remoteUri'])})[_0x1a86('0x1f')](function(_0x6f0f6e){logger['info'](_0x1a86('0x28'));return _0x6f0f6e;});}}function getEndUser(_0x292568,_0x2ea8b9,_0x545119){logger[_0x1a86('0xd')](_0x1a86('0x29'),_0x545119);return request({'uri':util['format'](_0x1a86('0x2a'),_0x292568[_0x1a86('0x1d')]),'qs':{'phone':_0x545119}})[_0x1a86('0x1f')](function(_0x2163f8){if(_0x2163f8[_0x1a86('0x2b')]){logger[_0x1a86('0xd')](_0x1a86('0x2c'));return _['find'](_0x2163f8,{'phone':_0x545119});}else{logger[_0x1a86('0xd')](_0x1a86('0x2d'));return request({'uri':util[_0x1a86('0x10')]('%s/api/v2/contacts',_0x292568[_0x1a86('0x1d')]),'method':_0x1a86('0x1e'),'body':{'name':_0x2ea8b9,'phone':_0x545119}})[_0x1a86('0x1f')](function(_0x299c41){logger[_0x1a86('0xd')](_0x1a86('0x2e'));return _0x299c41;});}});}function getAuth(_0x142595){return util[_0x1a86('0x10')](_0x1a86('0x2f'),new Buffer(_0x142595[_0x1a86('0x30')]+':X')[_0x1a86('0x31')]('base64'));}function request(_0x554f63){logger[_0x1a86('0x32')]('[HTTP]',JSON['stringify'](_0x554f63));return rp(_[_0x1a86('0x7')](_0x554f63,{'method':_0x1a86('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x153eff,_0x496724){var _0x2ec892=[];if(_0x153eff&&_0x153eff[_0x1a86('0x2b')]>0x0){_0x2ec892=_[_0x1a86('0x34')](_0x153eff,_0x496724);}return _0x2ec892;}function getCustomFields(_0x3d660d,_0x425bda){var _0x15c74b=[];var _0x1d85dc={'custom_fields':[]};if(_0x3d660d[_0x1a86('0x2b')]>0x0){_[_0x1a86('0x35')](_0x3d660d,function(_0x3dcc31){if(_[_0x1a86('0x36')]([_0x1a86('0x37'),_0x1a86('0x38')],_0x3dcc31[_0x1a86('0x39')])&&_0x3dcc31[_0x1a86('0x3a')]&&!_0x3dcc31[_0x1a86('0x3b')]){_0x1d85dc[_0x3dcc31[_0x1a86('0x3a')][_0x1a86('0x3c')]()]=_0x3dcc31[_0x1a86('0x3d')][_0x1a86('0x31')]();}else if(_[_0x1a86('0x36')]([_0x1a86('0x37'),_0x1a86('0x38')],_0x3dcc31[_0x1a86('0x39')])&&_0x3dcc31['idField']&&_0x3dcc31[_0x1a86('0x3b')]){_0x1d85dc[_0x1a86('0x1a')][_0x1a86('0x3e')]({'id':_0x3dcc31[_0x1a86('0x3f')],'value':_0x3dcc31[_0x1a86('0x3d')][_0x1a86('0x31')]()});}else if(_0x3dcc31['type']==='variable'&&_0x3dcc31[_0x1a86('0x40')]&&_0x3dcc31[_0x1a86('0x3f')]&&_0x3dcc31[_0x1a86('0x3b')]){_0x425bda[_0x3dcc31[_0x1a86('0x40')]]&&_0x1d85dc[_0x1a86('0x1a')][_0x1a86('0x3e')]({'id':_0x3dcc31[_0x1a86('0x3f')],'value':_0x425bda[_0x3dcc31[_0x1a86('0x40')]][_0x1a86('0x31')]()});}else if(_0x3dcc31[_0x1a86('0x39')]===_0x1a86('0x41')&&_0x3dcc31[_0x1a86('0x42')]&&_0x3dcc31[_0x1a86('0x42')][_0x1a86('0x16')]&&_0x3dcc31[_0x1a86('0x3f')]&&_0x3dcc31[_0x1a86('0x3b')]){_0x425bda[_0x3dcc31[_0x1a86('0x42')][_0x1a86('0x16')]['toLowerCase']()]&&_0x1d85dc[_0x1a86('0x1a')][_0x1a86('0x3e')]({'id':_0x3dcc31['idField'],'value':_0x425bda[_0x3dcc31[_0x1a86('0x42')][_0x1a86('0x16')]['toLowerCase']()]['toString']()});}});}return _0x1d85dc;}exports['queue']=function(_0x36f8d9,_0x5164e2,_0xf61320,_0x269c44,_0x2b963d,_0x250fed){var _0x481676,_0x4cf845;_0x250fed['remoteUri']=intUtil[_0x1a86('0x43')](_0x250fed[_0x1a86('0x1d')]);_0x250fed['serverUrl']=intUtil[_0x1a86('0x43')](_0x250fed['serverUrl']);if(_0x2b963d&&_0x2b963d['monitor_format']){logger[_0x1a86('0xd')](_0x1a86('0x44'),_0x1a86('0x45'));_0x5164e2['recordingURL']=util[_0x1a86('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x250fed[_0x1a86('0x46')],_0x5164e2[_0x1a86('0x47')],md5(_0x5164e2['uniqueid']));}else{_0x5164e2[_0x1a86('0x48')]='';}headers[_0x1a86('0x49')]=getAuth(_0x250fed);return getUser(_0x250fed,_0x269c44['email'])[_0x1a86('0x1f')](function(_0x159d37){_0x481676=_0x159d37;logger[_0x1a86('0xd')](_0x1a86('0x4a'),_0x481676['id']);return getEndUser(_0x250fed,_0x5164e2[_0x1a86('0x12')],_0x5164e2[_0x1a86('0x4b')]);})[_0x1a86('0x1f')](function(_0x5bc45d){_0x4cf845=_0x5bc45d;logger['info'](_0x1a86('0x4c'),_0x4cf845['id']);return getTicket(_0x250fed,_0x481676,_0x4cf845,_0xf61320,_0x5164e2);})[_0x1a86('0x1f')](function(_0x4fa675){if(_0x4fa675&&_0x4fa675['id']){logger[_0x1a86('0xd')](_0x1a86('0x4d'));logger[_0x1a86('0xd')](_0x1a86('0x4e'),_0x4fa675['id']);logger['info'](_0x1a86('0x44'),_0x1a86('0x4f'));emit(util[_0x1a86('0x10')](_0x1a86('0x50'),_0x269c44[_0x1a86('0x16')]),_0x1a86('0x51'),{'uri':util[_0x1a86('0x10')](_0x1a86('0x52'),_0x250fed[_0x1a86('0x1d')],_0x4fa675['id'])});}})[_0x1a86('0x53')](function(_0x4a6936){logger[_0x1a86('0x54')](_0x1a86('0x44'),JSON[_0x1a86('0x55')](_0x4a6936));});};exports[_0x1a86('0x56')]=function(_0x2fcb0d,_0x1c5c1e,_0x4b7ba3,_0x2fe7f4,_0x573d5d,_0x19e1e0,_0x2cf088){var _0x5252a9,_0x1aa08c;_0x19e1e0[_0x1a86('0x1d')]=intUtil[_0x1a86('0x43')](_0x19e1e0['remoteUri']);_0x19e1e0['serverUrl']=intUtil['stripTrailingSlash'](_0x19e1e0[_0x1a86('0x46')]);if(_0x2cf088&&_0x2cf088[_0x1a86('0x57')]&&_0x2cf088[_0x1a86('0x57')]!==_0x1a86('0x58')){logger[_0x1a86('0xd')](_0x1a86('0x59'),_0x1a86('0x45'));_0x1c5c1e[_0x1a86('0x48')]=util[_0x1a86('0x10')](_0x1a86('0x5a'),_0x19e1e0['serverUrl'],_0x1c5c1e[_0x1a86('0x47')],md5(_0x1c5c1e['uniqueid']));}headers[_0x1a86('0x49')]=getAuth(_0x19e1e0);return getUser(_0x19e1e0,_0x2fe7f4[_0x1a86('0x25')])['then'](function(_0xa92469){_0x5252a9=_0xa92469;logger['info'](_0x1a86('0x4a'),_0x5252a9['id']);return getEndUser(_0x19e1e0,_0x1c5c1e[_0x1a86('0x5b')],_0x1c5c1e[_0x1a86('0x5c')]);})[_0x1a86('0x1f')](function(_0x5af6ad){_0x1aa08c=_0x5af6ad;logger[_0x1a86('0xd')](_0x1a86('0x4c'),_0x1aa08c['id']);return getTicket(_0x19e1e0,_0x5252a9,_0x1aa08c,_0x4b7ba3,_0x1c5c1e);})['then'](function(_0x2772b6){if(_0x2772b6&&_0x2772b6['id']){logger[_0x1a86('0xd')](_0x1a86('0x4d'));logger[_0x1a86('0xd')](_0x1a86('0x4e'),_0x2772b6['id']);logger[_0x1a86('0xd')](_0x1a86('0x59'),_0x1a86('0x4f'));emit(util[_0x1a86('0x10')](_0x1a86('0x50'),_0x2fe7f4[_0x1a86('0x16')]),_0x1a86('0x51'),{'uri':util[_0x1a86('0x10')](_0x1a86('0x52'),_0x19e1e0['remoteUri'],_0x2772b6['id'])});}})[_0x1a86('0x53')](function(_0x55eeab){logger[_0x1a86('0x54')](_0x1a86('0x59'),JSON[_0x1a86('0x55')](_0x55eeab));});};exports['unmanaged']=function(_0x43f21b,_0x50b980,_0x1d2015,_0x530cfc,_0x4cff9f,_0x5e4e5a){var _0x549c1f,_0x98e43d;_0x5e4e5a[_0x1a86('0x1d')]=intUtil['stripTrailingSlash'](_0x5e4e5a[_0x1a86('0x1d')]);_0x5e4e5a['serverUrl']=intUtil[_0x1a86('0x43')](_0x5e4e5a[_0x1a86('0x46')]);if(_0x4cff9f&&_0x4cff9f['monitor_format']){logger[_0x1a86('0xd')]('['+_0x50b980[_0x1a86('0x5d')]['toUpperCase']()+']',_0x1a86('0x45'));_0x50b980[_0x1a86('0x48')]=util[_0x1a86('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e4e5a['serverUrl'],_0x50b980[_0x1a86('0x47')],md5(_0x50b980[_0x1a86('0x47')]));}else{_0x50b980[_0x1a86('0x48')]='';}headers['Authorization']=getAuth(_0x5e4e5a);return getUser(_0x5e4e5a,'')[_0x1a86('0x1f')](function(_0x207a40){_0x549c1f=_0x207a40;logger['info'](_0x1a86('0x4a'),_0x549c1f['id']);return getEndUser(_0x5e4e5a,_0x50b980[_0x1a86('0x12')],_0x50b980[_0x1a86('0x4b')]);})[_0x1a86('0x1f')](function(_0x393c67){_0x98e43d=_0x393c67;logger[_0x1a86('0xd')](_0x1a86('0x4c'),_0x98e43d['id']);return getTicket(_0x5e4e5a,_0x549c1f,_0x98e43d,_0x1d2015,_0x50b980);})[_0x1a86('0x1f')](function(_0xb10554){if(_0xb10554){logger[_0x1a86('0xd')](_0x1a86('0x4d'));logger[_0x1a86('0xd')](_0x1a86('0x4e'),_0xb10554['id']);}})[_0x1a86('0x53')](function(_0x3003cf){logger[_0x1a86('0x54')]('['+_0x50b980[_0x1a86('0x5d')][_0x1a86('0x5e')]()+']',JSON[_0x1a86('0x55')](_0x3003cf));});}; \ No newline at end of file +var _0xe5a1=['application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','then','info','Ticket\x20created!','%s/api/v2/agents','remoteUri','length','Agent\x20found!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','string','type','nameField','customField','toLowerCase','toString','includes','picklist','idField','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','unmanaged','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','localhost','socket.io-emitter','redis'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0xe5a1,0x14b));var _0x1e5a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xe5a1[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x1e5a('0x0'));var rp=require(_0x1e5a('0x1'));var md5=require(_0x1e5a('0x2'));var util=require(_0x1e5a('0x3'));var Redis=require(_0x1e5a('0x4'));var intUtil=require(_0x1e5a('0x5'));var config=require(_0x1e5a('0x6'));var logger=require(_0x1e5a('0x7'))(_0x1e5a('0x8'));config['redis']=_[_0x1e5a('0x9')](config['redis'],{'host':_0x1e5a('0xa'),'port':0x18eb});var io=require(_0x1e5a('0xb'))(new Redis(config[_0x1e5a('0xc')]));var headers={'Content-Type':_0x1e5a('0xd'),'Accept':_0x1e5a('0xd')};function emit(_0x3383e7,_0x55fa99,_0x401af0){io['to'](_0x3383e7)[_0x1e5a('0xe')](_0x55fa99,_0x401af0);}function getTicket(_0x3a439c,_0x584d9e,_0x3da964,_0x8a7765,_0x15d24f){logger['info'](_0x1e5a('0xf'));var _0x2fccb8=_[_0x1e5a('0x10')]({'responder_id':_0x584d9e['id'],'requester_id':_0x3da964['id'],'name':util[_0x1e5a('0x11')](_0x1e5a('0x12'),_0x15d24f[_0x1e5a('0x13')]),'phone':_0x15d24f[_0x1e5a('0x14')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x1e5a('0x15')](_0x8a7765[_0x1e5a('0x16')],_0x15d24f,'\x20'),'description':intUtil['getString'](_0x8a7765[_0x1e5a('0x17')],_0x15d24f,_0x1e5a('0x18')),'tags':getTags(_0x8a7765['Tags'],_0x1e5a('0x19'))},getCustomFields(_0x8a7765[_0x1e5a('0x1a')],_0x15d24f));_0x2fccb8[_0x1e5a('0x1b')]=_[_0x1e5a('0x1c')](_['keyBy'](_0x2fccb8[_0x1e5a('0x1b')],'id'),'value');return request({'uri':util[_0x1e5a('0x11')]('%s/api/v2/tickets',_0x3a439c['remoteUri']),'method':'POST','body':_0x2fccb8})[_0x1e5a('0x1d')](function(_0x51cd93){logger[_0x1e5a('0x1e')](_0x1e5a('0x1f'));return _0x51cd93;});}function getUser(_0x3118c5,_0x4f16b9){if(intUtil['validateEmail'](_0x4f16b9)){return request({'uri':util['format'](_0x1e5a('0x20'),_0x3118c5[_0x1e5a('0x21')]),'qs':{'email':_0x4f16b9}})[_0x1e5a('0x1d')](function(_0x400433){if(_0x400433[_0x1e5a('0x22')]){logger[_0x1e5a('0x1e')](_0x1e5a('0x23'));return _['find'](_0x400433,function(_0x2e06ec){return _0x2e06ec['contact']['email']===_0x4f16b9;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1e5a('0x11')]('%s/api/v2/agents/me',_0x3118c5['remoteUri'])})[_0x1e5a('0x1d')](function(_0x9156d1){logger['info']('Admin\x20account\x20selected.');return _0x9156d1;});}});}else{logger[_0x1e5a('0x1e')](_0x1e5a('0x24'));return request({'uri':util[_0x1e5a('0x11')](_0x1e5a('0x25'),_0x3118c5['remoteUri'])})[_0x1e5a('0x1d')](function(_0x3785a7){logger[_0x1e5a('0x1e')](_0x1e5a('0x26'));return _0x3785a7;});}}function getEndUser(_0x58a646,_0x14fa68,_0x3b8e82){logger['info']('Searching\x20enduser\x20with\x20phone',_0x3b8e82);return request({'uri':util[_0x1e5a('0x11')](_0x1e5a('0x27'),_0x58a646[_0x1e5a('0x21')]),'qs':{'phone':_0x3b8e82}})[_0x1e5a('0x1d')](function(_0x322f39){if(_0x322f39[_0x1e5a('0x22')]){logger[_0x1e5a('0x1e')](_0x1e5a('0x28'));return _[_0x1e5a('0x29')](_0x322f39,{'phone':_0x3b8e82});}else{logger[_0x1e5a('0x1e')](_0x1e5a('0x2a'));return request({'uri':util[_0x1e5a('0x11')]('%s/api/v2/contacts',_0x58a646[_0x1e5a('0x21')]),'method':'POST','body':{'name':_0x14fa68,'phone':_0x3b8e82}})[_0x1e5a('0x1d')](function(_0x149585){logger[_0x1e5a('0x1e')](_0x1e5a('0x2b'));return _0x149585;});}});}function getAuth(_0x4d6582){return util[_0x1e5a('0x11')](_0x1e5a('0x2c'),new Buffer(_0x4d6582['apiKey']+':X')['toString'](_0x1e5a('0x2d')));}function request(_0x69f68){logger[_0x1e5a('0x2e')](_0x1e5a('0x2f'),JSON[_0x1e5a('0x30')](_0x69f68));return rp(_[_0x1e5a('0x9')](_0x69f68,{'method':_0x1e5a('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x5a1a9b,_0x2b52b4){var _0x5439ed=[];if(_0x5a1a9b&&_0x5a1a9b[_0x1e5a('0x22')]>0x0){_0x5439ed=_[_0x1e5a('0x32')](_0x5a1a9b,_0x2b52b4);}return _0x5439ed;}function getCustomFields(_0x38db62,_0x36e1ed){var _0x3b6ae3=[];var _0x541999={'custom_fields':[]};if(_0x38db62['length']>0x0){_['forEach'](_0x38db62,function(_0x4375dc){if(_['includes']([_0x1e5a('0x33'),'picklist'],_0x4375dc[_0x1e5a('0x34')])&&_0x4375dc[_0x1e5a('0x35')]&&!_0x4375dc[_0x1e5a('0x36')]){_0x541999[_0x4375dc['nameField'][_0x1e5a('0x37')]()]=_0x4375dc['content'][_0x1e5a('0x38')]();}else if(_[_0x1e5a('0x39')](['string',_0x1e5a('0x3a')],_0x4375dc[_0x1e5a('0x34')])&&_0x4375dc[_0x1e5a('0x3b')]&&_0x4375dc['customField']){_0x541999[_0x1e5a('0x1b')]['push']({'id':_0x4375dc[_0x1e5a('0x3b')],'value':_0x4375dc['content'][_0x1e5a('0x38')]()});}else if(_0x4375dc[_0x1e5a('0x34')]==='variable'&&_0x4375dc['variableName']&&_0x4375dc[_0x1e5a('0x3b')]&&_0x4375dc[_0x1e5a('0x36')]){_0x36e1ed[_0x4375dc[_0x1e5a('0x3c')]]&&_0x541999[_0x1e5a('0x1b')]['push']({'id':_0x4375dc[_0x1e5a('0x3b')],'value':_0x36e1ed[_0x4375dc[_0x1e5a('0x3c')]][_0x1e5a('0x38')]()});}else if(_0x4375dc[_0x1e5a('0x34')]==='customVariable'&&_0x4375dc[_0x1e5a('0x3d')]&&_0x4375dc[_0x1e5a('0x3d')]['name']&&_0x4375dc[_0x1e5a('0x3b')]&&_0x4375dc['customField']){_0x36e1ed[_0x4375dc[_0x1e5a('0x3d')]['name']['toLowerCase']()]&&_0x541999[_0x1e5a('0x1b')]['push']({'id':_0x4375dc[_0x1e5a('0x3b')],'value':_0x36e1ed[_0x4375dc[_0x1e5a('0x3d')][_0x1e5a('0x19')][_0x1e5a('0x37')]()][_0x1e5a('0x38')]()});}});}return _0x541999;}exports[_0x1e5a('0x3e')]=function(_0x420472,_0x29d07b,_0x43df4f,_0x274894,_0x56a2f9,_0x41e30b){var _0x2d9bab,_0x56704e;_0x41e30b[_0x1e5a('0x21')]=intUtil[_0x1e5a('0x3f')](_0x41e30b['remoteUri']);_0x41e30b[_0x1e5a('0x40')]=intUtil[_0x1e5a('0x3f')](_0x41e30b['serverUrl']);if(_0x56a2f9&&_0x56a2f9[_0x1e5a('0x41')]){logger[_0x1e5a('0x1e')](_0x1e5a('0x42'),_0x1e5a('0x43'));_0x29d07b['recordingURL']=util[_0x1e5a('0x11')](_0x1e5a('0x44'),_0x41e30b['serverUrl'],_0x29d07b[_0x1e5a('0x45')],md5(_0x29d07b[_0x1e5a('0x45')]));}else{_0x29d07b[_0x1e5a('0x46')]='';}headers[_0x1e5a('0x47')]=getAuth(_0x41e30b);return getUser(_0x41e30b,_0x274894[_0x1e5a('0x48')])[_0x1e5a('0x1d')](function(_0x58905a){_0x2d9bab=_0x58905a;logger[_0x1e5a('0x1e')](_0x1e5a('0x49'),_0x2d9bab['id']);return getEndUser(_0x41e30b,_0x29d07b[_0x1e5a('0x13')],_0x29d07b['calleridnum']);})[_0x1e5a('0x1d')](function(_0x50dea4){_0x56704e=_0x50dea4;logger['info'](_0x1e5a('0x4a'),_0x56704e['id']);return getTicket(_0x41e30b,_0x2d9bab,_0x56704e,_0x43df4f,_0x29d07b);})['then'](function(_0xb970b){if(_0xb970b&&_0xb970b['id']){logger[_0x1e5a('0x1e')](_0x1e5a('0x1f'));logger[_0x1e5a('0x1e')](_0x1e5a('0x4b'),_0xb970b['id']);logger[_0x1e5a('0x1e')]('[QUEUE]',_0x1e5a('0x4c'));emit(util[_0x1e5a('0x11')]('user:%s',_0x274894[_0x1e5a('0x19')]),_0x1e5a('0x4d'),{'uri':util[_0x1e5a('0x11')](_0x1e5a('0x4e'),_0x41e30b['remoteUri'],_0xb970b['id'])});}})[_0x1e5a('0x4f')](function(_0x16cec4){logger[_0x1e5a('0x50')](_0x1e5a('0x42'),JSON['stringify'](_0x16cec4));});};exports[_0x1e5a('0x51')]=function(_0x3c1f0d,_0xdd33b4,_0x46ca46,_0x456b25,_0x17e251,_0x38f024,_0xc23d78){var _0x165c7b,_0x2525a0;_0x38f024['remoteUri']=intUtil[_0x1e5a('0x3f')](_0x38f024[_0x1e5a('0x21')]);_0x38f024[_0x1e5a('0x40')]=intUtil['stripTrailingSlash'](_0x38f024[_0x1e5a('0x40')]);if(_0xc23d78&&_0xc23d78[_0x1e5a('0x52')]&&_0xc23d78[_0x1e5a('0x52')]!=='none'){logger['info'](_0x1e5a('0x53'),_0x1e5a('0x43'));_0xdd33b4[_0x1e5a('0x46')]=util[_0x1e5a('0x11')](_0x1e5a('0x44'),_0x38f024[_0x1e5a('0x40')],_0xdd33b4[_0x1e5a('0x45')],md5(_0xdd33b4[_0x1e5a('0x45')]));}headers['Authorization']=getAuth(_0x38f024);return getUser(_0x38f024,_0x456b25['email'])[_0x1e5a('0x1d')](function(_0x9a077c){_0x165c7b=_0x9a077c;logger[_0x1e5a('0x1e')](_0x1e5a('0x49'),_0x165c7b['id']);return getEndUser(_0x38f024,_0xdd33b4['destcalleridname'],_0xdd33b4['destcalleridnum']);})[_0x1e5a('0x1d')](function(_0x181527){_0x2525a0=_0x181527;logger[_0x1e5a('0x1e')](_0x1e5a('0x4a'),_0x2525a0['id']);return getTicket(_0x38f024,_0x165c7b,_0x2525a0,_0x46ca46,_0xdd33b4);})[_0x1e5a('0x1d')](function(_0x4a0f00){if(_0x4a0f00&&_0x4a0f00['id']){logger[_0x1e5a('0x1e')](_0x1e5a('0x1f'));logger['info'](_0x1e5a('0x4b'),_0x4a0f00['id']);logger[_0x1e5a('0x1e')]('[OUTBOUND]',_0x1e5a('0x4c'));emit(util[_0x1e5a('0x11')]('user:%s',_0x456b25['name']),'trigger:browser:url',{'uri':util[_0x1e5a('0x11')](_0x1e5a('0x4e'),_0x38f024[_0x1e5a('0x21')],_0x4a0f00['id'])});}})[_0x1e5a('0x4f')](function(_0x1c2bb8){logger[_0x1e5a('0x50')](_0x1e5a('0x53'),JSON[_0x1e5a('0x30')](_0x1c2bb8));});};exports[_0x1e5a('0x54')]=function(_0x1819a3,_0x200eb5,_0x3a6b9e,_0x56ff7c,_0x4af23b,_0xb6a9c0){var _0x3e2cd3,_0x382a6f;_0xb6a9c0[_0x1e5a('0x21')]=intUtil[_0x1e5a('0x3f')](_0xb6a9c0[_0x1e5a('0x21')]);_0xb6a9c0['serverUrl']=intUtil['stripTrailingSlash'](_0xb6a9c0[_0x1e5a('0x40')]);if(_0x4af23b&&_0x4af23b[_0x1e5a('0x41')]){logger[_0x1e5a('0x1e')]('['+_0x200eb5[_0x1e5a('0x55')]['toUpperCase']()+']',_0x1e5a('0x43'));_0x200eb5['recordingURL']=util['format'](_0x1e5a('0x44'),_0xb6a9c0[_0x1e5a('0x40')],_0x200eb5[_0x1e5a('0x45')],md5(_0x200eb5[_0x1e5a('0x45')]));}else{_0x200eb5[_0x1e5a('0x46')]='';}headers[_0x1e5a('0x47')]=getAuth(_0xb6a9c0);return getUser(_0xb6a9c0,'')['then'](function(_0x54d742){_0x3e2cd3=_0x54d742;logger[_0x1e5a('0x1e')](_0x1e5a('0x49'),_0x3e2cd3['id']);return getEndUser(_0xb6a9c0,_0x200eb5['calleridname'],_0x200eb5[_0x1e5a('0x14')]);})[_0x1e5a('0x1d')](function(_0x246044){_0x382a6f=_0x246044;logger['info']('The\x20Enduser\x20ID\x20is:',_0x382a6f['id']);return getTicket(_0xb6a9c0,_0x3e2cd3,_0x382a6f,_0x3a6b9e,_0x200eb5);})[_0x1e5a('0x1d')](function(_0x4a48f5){if(_0x4a48f5){logger[_0x1e5a('0x1e')](_0x1e5a('0x1f'));logger['info'](_0x1e5a('0x4b'),_0x4a48f5['id']);}})[_0x1e5a('0x4f')](function(_0x7b4e3f){logger[_0x1e5a('0x50')]('['+_0x200eb5[_0x1e5a('0x55')]['toUpperCase']()+']',JSON[_0x1e5a('0x30')](_0x7b4e3f));});}; \ 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 ff05679..6dc9d0d 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 _0xafe8=['User\x20found:','Admin\x20selected','/api/lookup?q=','&entities=contact','catch','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','/api/tasks','Subjects','getString','Descriptions','format','add','ticketId','task','user:%s','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','destcalleridnum','calleridnum','callDirection','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','info','agentEmail','userEmail','email','userId'];(function(_0xaa65cb,_0x42ec3c){var _0x3ca8fd=function(_0x27a907){while(--_0x27a907){_0xaa65cb['push'](_0xaa65cb['shift']());}};_0x3ca8fd(++_0x42ec3c);}(_0xafe8,0x7a));var _0x8afe=function(_0x5743e3,_0x4a2aab){_0x5743e3=_0x5743e3-0x0;var _0x24d100=_0xafe8[_0x5743e3];return _0x24d100;};'use strict';var _=require('lodash');var rp=require(_0x8afe('0x0'));var md5=require('md5');var util=require(_0x8afe('0x1'));var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x8afe('0x2'));var logger=require(_0x8afe('0x3'))(_0x8afe('0x4'));config[_0x8afe('0x5')]=_['defaults'](config[_0x8afe('0x5')],{'host':_0x8afe('0x6'),'port':0x18eb});var io=require(_0x8afe('0x7'))(new Redis(config['redis']));function getAdminId(_0x39fc07,_0x40907e,_0x4d7e67,_0x5d595b){return new Promise(function(_0x3888d1,_0xd9a4f1){var _0x1205c5=![];var _0x1be59e={'method':_0x8afe('0x8'),'uri':_0x5d595b+_0x8afe('0x9'),'json':!![]};_0x1be59e['headers']=_0x4d7e67;logger['info'](_0x8afe('0xa'));return rp(_0x1be59e)[_0x8afe('0xb')](function(_0x474746){if(_0x474746){var _0x1d6d5d=_0x474746[_0x8afe('0xc')];var _0x20df43=null;for(_0x20df43=0x0;_0x20df43<_0x1d6d5d[_0x8afe('0xd')];_0x20df43++){if(_0x1d6d5d[_0x20df43]['email']===_0x39fc07[_0x8afe('0xe')]){_0x39fc07[_0x8afe('0xf')]=_0x1d6d5d[_0x20df43]['id'];_0x1205c5=!![];}}if(_0x1205c5){logger['info'](_0x8afe('0x10'),_0x39fc07[_0x8afe('0xf')]);_0x3888d1(_0x39fc07);}else{_0xd9a4f1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xd9a4f1({'statusCode':0x194,'message':_0x8afe('0x11')});}})['catch'](function(_0x42e72f){logger[_0x8afe('0x12')]('['+[_0x40907e[_0x8afe('0x13')]()]+']',_0x42e72f[_0x8afe('0x14')]);_0xd9a4f1(_0x42e72f);});});}function getUser(_0x3ca1bb,_0x5830c7,_0x253c02){return function(_0x3c63f3){return new Promise(function(_0x4f3f4c,_0x422460){var _0x34464d={'method':_0x8afe('0x8'),'uri':_0x253c02+_0x8afe('0x9'),'json':!![]};_0x34464d['headers']=_0x5830c7;logger[_0x8afe('0x15')]('Getting\x20user\x20list');return rp(_0x34464d)[_0x8afe('0xb')](function(_0x457aa8){if(_0x457aa8){var _0x1d7b49=_0x457aa8['users'];var _0x18e46b=![];var _0x529ef0=null;if(_0x3c63f3[_0x8afe('0x16')]!==null){logger[_0x8afe('0x15')]('Getting\x20user\x20with\x20email',_0x3c63f3[_0x8afe('0x16')]);_0x3c63f3[_0x8afe('0x17')]=_0x3c63f3[_0x8afe('0x16')];for(_0x529ef0=0x0;_0x529ef0<_0x1d7b49[_0x8afe('0xd')];_0x529ef0++){if(_0x1d7b49[_0x529ef0][_0x8afe('0x18')]===_0x3c63f3['agentEmail']){_0x18e46b=!![];_0x3c63f3[_0x8afe('0x19')]=_0x1d7b49[_0x529ef0]['id'];logger[_0x8afe('0x15')](_0x8afe('0x1a'),_0x3c63f3['userId']);}}}if(!_0x18e46b){logger[_0x8afe('0x15')](_0x8afe('0x1b'));_0x3c63f3[_0x8afe('0x17')]=_0x3c63f3[_0x8afe('0xe')];_0x3c63f3[_0x8afe('0x19')]=_0x3c63f3[_0x8afe('0xf')];_0x18e46b=!![];}if(_0x18e46b){_0x4f3f4c(_0x3c63f3);}else{_0x422460({'statusCode':0x194,'message':_0x8afe('0x11')});}}else{_0x422460({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x1f2458){logger['error']('['+[_0x3ca1bb['toUpperCase']()]+']',_0x1f2458[_0x8afe('0x14')]);_0x422460(_0x1f2458);});});};}function searchContact(_0x2d8837,_0x26fb34,_0x419afa,_0xba0e7c){return new Promise(function(_0x482bbc,_0x161af8){var _0x38d485={'method':'GET','headers':_0x26fb34,'uri':_0x2d8837+_0x8afe('0x1c')+_0xba0e7c+'&f='+_0x419afa+_0x8afe('0x1d'),'json':!![]};rp(_0x38d485)[_0x8afe('0xb')](function(_0x21b1f9){var _0x4e3e88=_['find'](_0x21b1f9['contacts']['contacts'],[_0x419afa,_0xba0e7c]);_0x482bbc(_0x4e3e88);})[_0x8afe('0x1e')](function(_0x304505){_0x161af8(_0x304505);});});}function getEndUser(_0x19627a,_0x2e08fb,_0x143464){return function(_0x21fc35){return new Promise(function(_0x428805,_0x38f6cf){logger[_0x8afe('0x15')](util['format'](_0x8afe('0x1f'),_0x21fc35[_0x8afe('0x20')]));searchContact(_0x143464,_0x2e08fb,'mobile_number',_0x21fc35[_0x8afe('0x20')])[_0x8afe('0xb')](function(_0x246681){if(_0x246681){_0x21fc35[_0x8afe('0x21')]=_0x246681['id'];logger[_0x8afe('0x15')](_0x8afe('0x22'),_0x21fc35[_0x8afe('0x21')]);return _0x428805(_0x21fc35);}searchContact(_0x143464,_0x2e08fb,'work_number',_0x21fc35[_0x8afe('0x20')])[_0x8afe('0xb')](function(_0x3843a7){if(_0x3843a7){_0x21fc35[_0x8afe('0x21')]=_0x3843a7['id'];logger[_0x8afe('0x15')]('Contact\x20found\x20work_number:',_0x21fc35[_0x8afe('0x21')]);return _0x428805(_0x21fc35);}createEndUser(_0x21fc35,_0x19627a,_0x2e08fb,_0x143464)[_0x8afe('0xb')](function(_0x3b00b0){logger[_0x8afe('0x15')](_0x8afe('0x23'),_0x3b00b0[_0x8afe('0x21')]);return _0x428805(_0x3b00b0);});});})[_0x8afe('0x1e')](function(_0x24cec4){_0x38f6cf(_0x24cec4);});});};}function createEndUser(_0x1c5964,_0x15b890,_0x4d749b,_0x197841){return new Promise(function(_0x4ef09d,_0x151d07){var _0x41657b=moment();var _0x5a68de={'method':_0x8afe('0x24'),'uri':_0x197841+_0x8afe('0x25'),'body':{'contact':{'last_name':_0x1c5964[_0x8afe('0x20')],'work_number':_0x1c5964[_0x8afe('0x20')],'mobile_number':_0x1c5964['contactNumber'],'owner_id':_0x1c5964[_0x8afe('0x19')],'created_at':_0x41657b['format'](_0x8afe('0x26'))}},'json':!![]};_0x5a68de[_0x8afe('0x27')]=_0x4d749b;logger[_0x8afe('0x15')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x5a68de)[_0x8afe('0xb')](function(_0x4b68ad){_0x1c5964[_0x8afe('0x21')]=_0x4b68ad['contact']['id'];_0x4ef09d(_0x1c5964);})[_0x8afe('0x1e')](function(_0x5e6052){logger[_0x8afe('0x12')]('['+[_0x15b890[_0x8afe('0x13')]()]+']',_0x5e6052[_0x8afe('0x14')]);_0x151d07(_0x5e6052[_0x8afe('0x14')]);});});}function getTicket(_0x294275,_0x88e429,_0x500c3e,_0x51d820,_0x39a22f){return function(_0x33d67e){logger[_0x8afe('0x15')]('Creating\x20new\x20task');return new Promise(function(_0x15ae65,_0x17cca7){var _0x53b847=moment();var _0x11504c={'method':_0x8afe('0x24'),'uri':_0x500c3e+_0x8afe('0x28'),'body':{'title':intUtil['getString'](_0x51d820[_0x8afe('0x29')],_0x39a22f,'\x20'),'description':intUtil[_0x8afe('0x2a')](_0x51d820[_0x8afe('0x2b')],_0x39a22f,'\x0a'),'owner_id':_0x33d67e[_0x8afe('0x19')],'creater_id':_0x33d67e['adminId'],'targetable_id':_0x33d67e['endUserId'],'targetable_type':'Contact','created_at':_0x53b847[_0x8afe('0x2c')](_0x8afe('0x26')),'due_date':_0x53b847[_0x8afe('0x2d')](0x1e,'m')[_0x8afe('0x2c')](_0x8afe('0x26'))},'json':!![]};_0x11504c[_0x8afe('0x27')]=_0x88e429;return rp(_0x11504c)[_0x8afe('0xb')](function(_0x1a2018){_0x33d67e[_0x8afe('0x2e')]=_0x1a2018[_0x8afe('0x2f')]['id'];logger[_0x8afe('0x15')]('Task\x20created:',_0x33d67e[_0x8afe('0x2e')]);_0x15ae65(_0x33d67e);})[_0x8afe('0x1e')](function(_0x4a9d42){logger[_0x8afe('0x12')]('['+[_0x294275[_0x8afe('0x13')]()]+']',_0x4a9d42['message']);_0x17cca7(_0x4a9d42['message']);});});};}function emit(_0x508a92,_0x2c781a,_0x990d35){var _0x4c3e54={'uri':_0x508a92+'/contacts/'+_0x990d35};io['to'](util[_0x8afe('0x2c')](_0x8afe('0x30'),_0x2c781a))['emit']('trigger:browser:url',_0x4c3e54);}exports['cs']=function(_0x38f3ac,_0x30eaf7,_0x574db3,_0x13f456,_0x48823d,_0x483c79,_0x40f1f1,_0x43cd64){var _0x559f2d={};var _0x2c7d54={'Authorization':_0x8afe('0x31')+_0x483c79[_0x8afe('0x32')]};_0x483c79[_0x8afe('0x33')]=intUtil['stripTrailingSlash'](_0x483c79['remoteUri']);_0x483c79[_0x8afe('0x34')]=intUtil[_0x8afe('0x35')](_0x483c79['serverUrl']);var _0x5468c4=_0x483c79[_0x8afe('0x33')];_0x559f2d[_0x8afe('0xe')]=_0x483c79[_0x8afe('0x36')];_0x559f2d[_0x8afe('0x20')]=_0x43cd64[_0x8afe('0x37')]()==='outbound'?_0x30eaf7[_0x8afe('0x38')]:_0x30eaf7[_0x8afe('0x39')];_0x559f2d[_0x8afe('0x3a')]=_0x43cd64==='queue'||_0x43cd64===_0x8afe('0x3b')?'queue':_0x8afe('0x3c');if(_0x13f456){_0x559f2d['agentEmail']=_0x13f456[_0x8afe('0x18')];}var _0x31882d=util[_0x8afe('0x2c')](_0x8afe('0x3d'),_0x483c79[_0x8afe('0x34')],_0x30eaf7[_0x8afe('0x3e')],md5(_0x30eaf7[_0x8afe('0x3e')]));if(_0x48823d&&_0x48823d[_0x8afe('0x3f')]){logger[_0x8afe('0x15')]('[QUEUE]',_0x8afe('0x40'));_0x30eaf7['recordingURL']=_0x31882d;}else if(_0x40f1f1&&_0x40f1f1[_0x8afe('0x41')]&&_0x40f1f1[_0x8afe('0x41')]!==_0x8afe('0x42')){logger['info'](_0x8afe('0x43'),_0x8afe('0x40'));_0x30eaf7[_0x8afe('0x44')]=_0x31882d;}else{_0x30eaf7[_0x8afe('0x44')]='';}return getAdminId(_0x559f2d,_0x43cd64,_0x2c7d54,_0x5468c4)[_0x8afe('0xb')](getUser(_0x43cd64,_0x2c7d54,_0x5468c4))[_0x8afe('0xb')](getEndUser(_0x43cd64,_0x2c7d54,_0x5468c4))['then'](getTicket(_0x43cd64,_0x2c7d54,_0x5468c4,_0x574db3,_0x30eaf7))['then'](function(_0x8622c3){logger['info'](util[_0x8afe('0x2c')](_0x8afe('0x45'),_0x8622c3[_0x8afe('0x2e')]));if(_0x43cd64!=='unmanaged'){logger[_0x8afe('0x15')]('['+[_0x43cd64['toUpperCase']()]+']',_0x8afe('0x46'));emit(_0x5468c4,_0x13f456[_0x8afe('0x47')],_0x8622c3[_0x8afe('0x21')]);}})[_0x8afe('0x1e')](function(_0x32c476){logger[_0x8afe('0x12')]('['+[_0x43cd64[_0x8afe('0x13')]()]+_0x8afe('0x48'),util[_0x8afe('0x49')](_0x32c476,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3c8b=['length','userId','User\x20found:','Admin\x20selected','userEmail','/api/lookup?q=','&f=','find','contacts','format','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','POST','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','./util','../../../../config/environment','freshsales','redis','localhost','socket.io-emitter','GET','info','Getting\x20admin\x20information','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','headers','then','agentEmail','Getting\x20user\x20with\x20email'];(function(_0x2e6b77,_0x367743){var _0x34b092=function(_0x3303ae){while(--_0x3303ae){_0x2e6b77['push'](_0x2e6b77['shift']());}};_0x34b092(++_0x367743);}(_0x3c8b,0x127));var _0xb3c8=function(_0x17ebc1,_0x3030a0){_0x17ebc1=_0x17ebc1-0x0;var _0x423255=_0x3c8b[_0x17ebc1];return _0x423255;};'use strict';var _=require(_0xb3c8('0x0'));var rp=require('request-promise');var md5=require(_0xb3c8('0x1'));var util=require(_0xb3c8('0x2'));var moment=require(_0xb3c8('0x3'));var Promise=require(_0xb3c8('0x4'));var Redis=require('ioredis');var intUtil=require(_0xb3c8('0x5'));var config=require(_0xb3c8('0x6'));var logger=require('../../../../config/logger')(_0xb3c8('0x7'));config[_0xb3c8('0x8')]=_['defaults'](config[_0xb3c8('0x8')],{'host':_0xb3c8('0x9'),'port':0x18eb});var io=require(_0xb3c8('0xa'))(new Redis(config['redis']));function getAdminId(_0x130272,_0x4c4c8e,_0x5d90e3,_0x52256a){return new Promise(function(_0x5780ab,_0x20dda3){var _0x3fb4ad=![];var _0x187c3f={'method':_0xb3c8('0xb'),'uri':_0x52256a+'/api/selector/owners','json':!![]};_0x187c3f['headers']=_0x5d90e3;logger[_0xb3c8('0xc')](_0xb3c8('0xd'));return rp(_0x187c3f)['then'](function(_0x5d5be7){if(_0x5d5be7){var _0x49e15b=_0x5d5be7[_0xb3c8('0xe')];var _0x5ab82b=null;for(_0x5ab82b=0x0;_0x5ab82b<_0x49e15b['length'];_0x5ab82b++){if(_0x49e15b[_0x5ab82b][_0xb3c8('0xf')]===_0x130272[_0xb3c8('0x10')]){_0x130272[_0xb3c8('0x11')]=_0x49e15b[_0x5ab82b]['id'];_0x3fb4ad=!![];}}if(_0x3fb4ad){logger[_0xb3c8('0xc')](_0xb3c8('0x12'),_0x130272['adminId']);_0x5780ab(_0x130272);}else{_0x20dda3({'statusCode':0x194,'message':_0xb3c8('0x13')});}}else{_0x20dda3({'statusCode':0x194,'message':_0xb3c8('0x13')});}})[_0xb3c8('0x14')](function(_0x304cf0){logger[_0xb3c8('0x15')]('['+[_0x4c4c8e[_0xb3c8('0x16')]()]+']',_0x304cf0[_0xb3c8('0x17')]);_0x20dda3(_0x304cf0);});});}function getUser(_0x222c2c,_0x3a601e,_0x42d28e){return function(_0x420b0b){return new Promise(function(_0x2044a7,_0x55e925){var _0x5b2339={'method':_0xb3c8('0xb'),'uri':_0x42d28e+_0xb3c8('0x18'),'json':!![]};_0x5b2339[_0xb3c8('0x19')]=_0x3a601e;logger[_0xb3c8('0xc')]('Getting\x20user\x20list');return rp(_0x5b2339)[_0xb3c8('0x1a')](function(_0x1aabb2){if(_0x1aabb2){var _0x52f05b=_0x1aabb2[_0xb3c8('0xe')];var _0x3dfa11=![];var _0x59606c=null;if(_0x420b0b[_0xb3c8('0x1b')]!==null){logger[_0xb3c8('0xc')](_0xb3c8('0x1c'),_0x420b0b['agentEmail']);_0x420b0b['userEmail']=_0x420b0b[_0xb3c8('0x1b')];for(_0x59606c=0x0;_0x59606c<_0x52f05b[_0xb3c8('0x1d')];_0x59606c++){if(_0x52f05b[_0x59606c][_0xb3c8('0xf')]===_0x420b0b[_0xb3c8('0x1b')]){_0x3dfa11=!![];_0x420b0b[_0xb3c8('0x1e')]=_0x52f05b[_0x59606c]['id'];logger['info'](_0xb3c8('0x1f'),_0x420b0b[_0xb3c8('0x1e')]);}}}if(!_0x3dfa11){logger['info'](_0xb3c8('0x20'));_0x420b0b[_0xb3c8('0x21')]=_0x420b0b[_0xb3c8('0x10')];_0x420b0b[_0xb3c8('0x1e')]=_0x420b0b[_0xb3c8('0x11')];_0x3dfa11=!![];}if(_0x3dfa11){_0x2044a7(_0x420b0b);}else{_0x55e925({'statusCode':0x194,'message':_0xb3c8('0x13')});}}else{_0x55e925({'statusCode':0x194,'message':_0xb3c8('0x13')});}})[_0xb3c8('0x14')](function(_0x523bbd){logger[_0xb3c8('0x15')]('['+[_0x222c2c['toUpperCase']()]+']',_0x523bbd[_0xb3c8('0x17')]);_0x55e925(_0x523bbd);});});};}function searchContact(_0x55341f,_0x4b86a4,_0x1e62d5,_0x2a4069){return new Promise(function(_0x4c1ece,_0x39ccd9){var _0x2bb92c={'method':_0xb3c8('0xb'),'headers':_0x4b86a4,'uri':_0x55341f+_0xb3c8('0x22')+_0x2a4069+_0xb3c8('0x23')+_0x1e62d5+'&entities=contact','json':!![]};rp(_0x2bb92c)[_0xb3c8('0x1a')](function(_0x98864c){var _0x352b6e=_[_0xb3c8('0x24')](_0x98864c[_0xb3c8('0x25')][_0xb3c8('0x25')],[_0x1e62d5,_0x2a4069]);_0x4c1ece(_0x352b6e);})['catch'](function(_0x30ccc4){_0x39ccd9(_0x30ccc4);});});}function getEndUser(_0x580f2b,_0x23e686,_0x4170bb){return function(_0x291160){return new Promise(function(_0x2cec99,_0x24c12d){logger[_0xb3c8('0xc')](util[_0xb3c8('0x26')]('Searching\x20contact\x20with\x20phone\x20%s',_0x291160[_0xb3c8('0x27')]));searchContact(_0x4170bb,_0x23e686,_0xb3c8('0x28'),_0x291160[_0xb3c8('0x27')])['then'](function(_0x57bc45){if(_0x57bc45){_0x291160['endUserId']=_0x57bc45['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x291160[_0xb3c8('0x29')]);return _0x2cec99(_0x291160);}searchContact(_0x4170bb,_0x23e686,_0xb3c8('0x2a'),_0x291160[_0xb3c8('0x27')])[_0xb3c8('0x1a')](function(_0x390dc9){if(_0x390dc9){_0x291160[_0xb3c8('0x29')]=_0x390dc9['id'];logger['info'](_0xb3c8('0x2b'),_0x291160[_0xb3c8('0x29')]);return _0x2cec99(_0x291160);}createEndUser(_0x291160,_0x580f2b,_0x23e686,_0x4170bb)['then'](function(_0x26d5bf){logger[_0xb3c8('0xc')]('Contact\x20created:',_0x26d5bf[_0xb3c8('0x29')]);return _0x2cec99(_0x26d5bf);});});})[_0xb3c8('0x14')](function(_0x311aff){_0x24c12d(_0x311aff);});});};}function createEndUser(_0x8ee882,_0x1253d6,_0x506c1c,_0x43919a){return new Promise(function(_0x29b334,_0x5c64db){var _0x16b348=moment();var _0x535936={'method':_0xb3c8('0x2c'),'uri':_0x43919a+'/api/contacts','body':{'contact':{'last_name':_0x8ee882[_0xb3c8('0x27')],'work_number':_0x8ee882[_0xb3c8('0x27')],'mobile_number':_0x8ee882[_0xb3c8('0x27')],'owner_id':_0x8ee882['userId'],'created_at':_0x16b348[_0xb3c8('0x26')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x535936[_0xb3c8('0x19')]=_0x506c1c;logger['info'](_0xb3c8('0x2d'));return rp(_0x535936)[_0xb3c8('0x1a')](function(_0x196769){_0x8ee882[_0xb3c8('0x29')]=_0x196769[_0xb3c8('0x2e')]['id'];_0x29b334(_0x8ee882);})[_0xb3c8('0x14')](function(_0x830d82){logger['error']('['+[_0x1253d6['toUpperCase']()]+']',_0x830d82[_0xb3c8('0x17')]);_0x5c64db(_0x830d82[_0xb3c8('0x17')]);});});}function getTicket(_0x1706c5,_0x14934e,_0x577e52,_0x389e08,_0x35f9c6){return function(_0x35f7bd){logger[_0xb3c8('0xc')](_0xb3c8('0x2f'));return new Promise(function(_0x511cfd,_0x477d4c){var _0x4513a8=moment();var _0x52a5a5={'method':_0xb3c8('0x2c'),'uri':_0x577e52+'/api/tasks','body':{'title':intUtil[_0xb3c8('0x30')](_0x389e08[_0xb3c8('0x31')],_0x35f9c6,'\x20'),'description':intUtil[_0xb3c8('0x30')](_0x389e08[_0xb3c8('0x32')],_0x35f9c6,'\x0a'),'owner_id':_0x35f7bd[_0xb3c8('0x1e')],'creater_id':_0x35f7bd['adminId'],'targetable_id':_0x35f7bd['endUserId'],'targetable_type':_0xb3c8('0x33'),'created_at':_0x4513a8[_0xb3c8('0x26')](_0xb3c8('0x34')),'due_date':_0x4513a8[_0xb3c8('0x35')](0x1e,'m')[_0xb3c8('0x26')](_0xb3c8('0x34'))},'json':!![]};_0x52a5a5[_0xb3c8('0x19')]=_0x14934e;return rp(_0x52a5a5)[_0xb3c8('0x1a')](function(_0x2c6879){_0x35f7bd['ticketId']=_0x2c6879[_0xb3c8('0x36')]['id'];logger[_0xb3c8('0xc')](_0xb3c8('0x37'),_0x35f7bd[_0xb3c8('0x38')]);_0x511cfd(_0x35f7bd);})[_0xb3c8('0x14')](function(_0x57b50f){logger[_0xb3c8('0x15')]('['+[_0x1706c5[_0xb3c8('0x16')]()]+']',_0x57b50f[_0xb3c8('0x17')]);_0x477d4c(_0x57b50f['message']);});});};}function emit(_0x43b37f,_0x1a3b47,_0xad3962){var _0x45230e={'uri':_0x43b37f+_0xb3c8('0x39')+_0xad3962};io['to'](util['format'](_0xb3c8('0x3a'),_0x1a3b47))[_0xb3c8('0x3b')](_0xb3c8('0x3c'),_0x45230e);}exports['cs']=function(_0x285d23,_0x3c3bc7,_0x13bcab,_0x3b7a16,_0x3d7f18,_0x347b81,_0x2785ca,_0x1e7977){var _0x4abe95={};var _0x4315f0={'Authorization':_0xb3c8('0x3d')+_0x347b81['apiKey']};_0x347b81[_0xb3c8('0x3e')]=intUtil[_0xb3c8('0x3f')](_0x347b81[_0xb3c8('0x3e')]);_0x347b81[_0xb3c8('0x40')]=intUtil['stripTrailingSlash'](_0x347b81[_0xb3c8('0x40')]);var _0x371038=_0x347b81[_0xb3c8('0x3e')];_0x4abe95[_0xb3c8('0x10')]=_0x347b81[_0xb3c8('0x41')];_0x4abe95['contactNumber']=_0x1e7977['toLowerCase']()==='outbound'?_0x3c3bc7['destcalleridnum']:_0x3c3bc7['calleridnum'];_0x4abe95[_0xb3c8('0x42')]=_0x1e7977===_0xb3c8('0x43')||_0x1e7977===_0xb3c8('0x44')?_0xb3c8('0x43'):_0xb3c8('0x45');if(_0x3b7a16){_0x4abe95[_0xb3c8('0x1b')]=_0x3b7a16[_0xb3c8('0xf')];}var _0x13d341=util['format'](_0xb3c8('0x46'),_0x347b81[_0xb3c8('0x40')],_0x3c3bc7[_0xb3c8('0x47')],md5(_0x3c3bc7[_0xb3c8('0x47')]));if(_0x3d7f18&&_0x3d7f18[_0xb3c8('0x48')]){logger[_0xb3c8('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3c3bc7[_0xb3c8('0x49')]=_0x13d341;}else if(_0x2785ca&&_0x2785ca[_0xb3c8('0x4a')]&&_0x2785ca[_0xb3c8('0x4a')]!=='none'){logger[_0xb3c8('0xc')]('[OUTBOUND]',_0xb3c8('0x4b'));_0x3c3bc7[_0xb3c8('0x49')]=_0x13d341;}else{_0x3c3bc7[_0xb3c8('0x49')]='';}return getAdminId(_0x4abe95,_0x1e7977,_0x4315f0,_0x371038)[_0xb3c8('0x1a')](getUser(_0x1e7977,_0x4315f0,_0x371038))[_0xb3c8('0x1a')](getEndUser(_0x1e7977,_0x4315f0,_0x371038))['then'](getTicket(_0x1e7977,_0x4315f0,_0x371038,_0x13bcab,_0x3c3bc7))[_0xb3c8('0x1a')](function(_0x374dfc){logger[_0xb3c8('0xc')](util['format'](_0xb3c8('0x4c'),_0x374dfc[_0xb3c8('0x38')]));if(_0x1e7977!=='unmanaged'){logger[_0xb3c8('0xc')]('['+[_0x1e7977[_0xb3c8('0x16')]()]+']',_0xb3c8('0x4d'));emit(_0x371038,_0x3b7a16[_0xb3c8('0x4e')],_0x374dfc[_0xb3c8('0x29')]);}})[_0xb3c8('0x14')](function(_0x58577b){logger['error']('['+[_0x1e7977[_0xb3c8('0x16')]()]+_0xb3c8('0x4f'),util[_0xb3c8('0x50')](_0x58577b,{'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 34e1c38..b3ee23e 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 _0x9b2d=['./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','vtiger','dynamics365','freshsales','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','desk','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9b2d,0x178));var _0xd9b2=function(_0x4c5cbc,_0x1e393b){_0x4c5cbc=_0x4c5cbc-0x0;var _0x59006a=_0x9b2d[_0x4c5cbc];return _0x59006a;};'use strict';var _=require(_0xd9b2('0x0'));var util=require(_0xd9b2('0x1'));var zendesk=require(_0xd9b2('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xd9b2('0x3'));var freshdesk=require(_0xd9b2('0x4'));var zoho=require(_0xd9b2('0x5'));var desk=require(_0xd9b2('0x6'));var vtiger=require(_0xd9b2('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0xd9b2('0x8'));var freshsales=require(_0xd9b2('0x9'));var integrations=[_0xd9b2('0xa'),_0xd9b2('0xb'),_0xd9b2('0xc'),'freshdesk',_0xd9b2('0xd'),'desk',_0xd9b2('0xe'),_0xd9b2('0xf'),_0xd9b2('0x10'),_0xd9b2('0x11')];exports[_0xd9b2('0x12')]=function(_0x5838f1,_0x2ba715,_0xcc4744,_0x16a82b,_0x1e876e,_0x4c6d8a){if(_0xcc4744){if(_['includes'](integrations,_0x5838f1['data1'][_0xd9b2('0x13')]())){try{var _0x37b0c5=null;var _0x110f16='';var _0x4afc60=_0xcc4744[_0x5838f1[_0xd9b2('0x14')][_0xd9b2('0x13')]()];if(_0x4afc60){var _0x244f4c=_0x4afc60[_0x5838f1[_0xd9b2('0x15')]];if(_0x244f4c){var _0x267a51=_[_0xd9b2('0x16')](_0x244f4c[_0xd9b2('0x17')],{'id':parseInt(_0x5838f1[_0xd9b2('0x18')],0xa)});if(_0x267a51){if(_0x16a82b){if(_0x1e876e&&_0x2ba715[_0xd9b2('0x19')]){_0x110f16=_0xd9b2('0x19');}else if(_0x2ba715[_0xd9b2('0x1a')]){_0x110f16=_0xd9b2('0x1b');}else{console[_0xd9b2('0x1c')](_0xd9b2('0x1d'),_0x2ba715);}}else{_0x110f16=_0xd9b2('0x1e');}switch(_0x5838f1[_0xd9b2('0x14')][_0xd9b2('0x13')]()){case _0xd9b2('0xa'):zendesk[_0x110f16](_0x5838f1,_0x2ba715,_0x267a51,_0x16a82b,_0x1e876e,_0x244f4c,_0x4c6d8a);break;case _0xd9b2('0xb'):salesforce[_0x110f16](_0x5838f1,_0x2ba715,_0x267a51,_0x16a82b,_0x1e876e,_0x244f4c,_0x4c6d8a);break;case _0xd9b2('0xc'):sugarcrm[_0x110f16](_0x5838f1,_0x2ba715,_0x267a51,_0x16a82b,_0x1e876e,_0x244f4c,_0x4c6d8a);break;case _0xd9b2('0x1f'):freshdesk[_0x110f16](_0x5838f1,_0x2ba715,_0x267a51,_0x16a82b,_0x1e876e,_0x244f4c,_0x4c6d8a);break;case _0xd9b2('0xd'):zoho[_0x110f16](_0x5838f1,_0x2ba715,_0x267a51,_0x16a82b,_0x1e876e,_0x244f4c,_0x4c6d8a);break;case _0xd9b2('0x20'):desk[_0x110f16](_0x5838f1,_0x2ba715,_0x267a51,_0x16a82b,_0x1e876e,_0x244f4c,_0x4c6d8a);break;case _0xd9b2('0xe'):vtiger[_0x110f16](_0x5838f1,_0x2ba715,_0x267a51,_0x16a82b,_0x1e876e,_0x244f4c,_0x4c6d8a);break;case _0xd9b2('0x10'):freshsales['cs'](_0x5838f1,_0x2ba715,_0x267a51,_0x16a82b,_0x1e876e,_0x244f4c,_0x4c6d8a,_0x110f16);break;case _0xd9b2('0x11'):servicenow['cs'](_0x5838f1,_0x2ba715,_0x267a51,_0x16a82b,_0x1e876e,_0x244f4c,_0x4c6d8a,_0x110f16);break;case _0xd9b2('0xf'):dynamics365['cs'](_0x5838f1,_0x2ba715,_0x267a51,_0x16a82b,_0x1e876e,_0x244f4c,_0x4c6d8a,_0x110f16);break;default:console[_0xd9b2('0x1c')]('unknown\x20integration');}}else{_0x37b0c5=require(_0xd9b2('0x21'))(_0x5838f1['data1']['toLowerCase']());_0x37b0c5[_0xd9b2('0x22')](_0xd9b2('0x23'),util[_0xd9b2('0x24')](_0xd9b2('0x25'),_0x5838f1[_0xd9b2('0x14')][_0xd9b2('0x13')](),_0x5838f1[_0xd9b2('0x18')]));}}else{_0x37b0c5=require(_0xd9b2('0x21'))(_0x5838f1['data1'][_0xd9b2('0x13')]());_0x37b0c5[_0xd9b2('0x22')](_0xd9b2('0x23'),util[_0xd9b2('0x24')]('%s\x20account\x20#%s\x20not\x20found',_0x5838f1[_0xd9b2('0x14')][_0xd9b2('0x13')](),_0x5838f1[_0xd9b2('0x15')]));}}else{}}catch(_0x2a0d7b){console['error'](_0x2a0d7b);}}}}; \ No newline at end of file +var _0x6011=['error','[EXEC]','format','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','data3','queue','routeId','outbound','log','vtiger','unknown\x20integration'];(function(_0x104b47,_0x491eff){var _0x34a3f1=function(_0x467a15){while(--_0x467a15){_0x104b47['push'](_0x104b47['shift']());}};_0x34a3f1(++_0x491eff);}(_0x6011,0x196));var _0x1601=function(_0x44bbf4,_0xfaab39){_0x44bbf4=_0x44bbf4-0x0;var _0x204f2b=_0x6011[_0x44bbf4];return _0x204f2b;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x1601('0x0'));var zoho=require(_0x1601('0x1'));var desk=require('./desk');var vtiger=require(_0x1601('0x2'));var servicenow=require(_0x1601('0x3'));var dynamics365=require(_0x1601('0x4'));var freshsales=require(_0x1601('0x5'));var integrations=[_0x1601('0x6'),_0x1601('0x7'),_0x1601('0x8'),_0x1601('0x9'),_0x1601('0xa'),_0x1601('0xb'),'vtiger',_0x1601('0xc'),_0x1601('0xd'),_0x1601('0xe')];exports[_0x1601('0xf')]=function(_0x33def1,_0x58f45f,_0x4dc693,_0x57e18a,_0xc55cf3,_0x4ae2eb){if(_0x4dc693){if(_[_0x1601('0x10')](integrations,_0x33def1[_0x1601('0x11')][_0x1601('0x12')]())){try{var _0x24cc39=null;var _0x263bef='';var _0x322025=_0x4dc693[_0x33def1[_0x1601('0x11')][_0x1601('0x12')]()];if(_0x322025){var _0x5da646=_0x322025[_0x33def1[_0x1601('0x13')]];if(_0x5da646){var _0x555d4f=_[_0x1601('0x14')](_0x5da646['Configurations'],{'id':parseInt(_0x33def1[_0x1601('0x15')],0xa)});if(_0x555d4f){if(_0x57e18a){if(_0xc55cf3&&_0x58f45f[_0x1601('0x16')]){_0x263bef='queue';}else if(_0x58f45f[_0x1601('0x17')]){_0x263bef=_0x1601('0x18');}else{console[_0x1601('0x19')]('EVENT\x20UNKNOWN',_0x58f45f);}}else{_0x263bef='unmanaged';}switch(_0x33def1[_0x1601('0x11')][_0x1601('0x12')]()){case _0x1601('0x6'):zendesk[_0x263bef](_0x33def1,_0x58f45f,_0x555d4f,_0x57e18a,_0xc55cf3,_0x5da646,_0x4ae2eb);break;case _0x1601('0x7'):salesforce[_0x263bef](_0x33def1,_0x58f45f,_0x555d4f,_0x57e18a,_0xc55cf3,_0x5da646,_0x4ae2eb);break;case _0x1601('0x8'):sugarcrm[_0x263bef](_0x33def1,_0x58f45f,_0x555d4f,_0x57e18a,_0xc55cf3,_0x5da646,_0x4ae2eb);break;case _0x1601('0x9'):freshdesk[_0x263bef](_0x33def1,_0x58f45f,_0x555d4f,_0x57e18a,_0xc55cf3,_0x5da646,_0x4ae2eb);break;case _0x1601('0xa'):zoho[_0x263bef](_0x33def1,_0x58f45f,_0x555d4f,_0x57e18a,_0xc55cf3,_0x5da646,_0x4ae2eb);break;case _0x1601('0xb'):desk[_0x263bef](_0x33def1,_0x58f45f,_0x555d4f,_0x57e18a,_0xc55cf3,_0x5da646,_0x4ae2eb);break;case _0x1601('0x1a'):vtiger[_0x263bef](_0x33def1,_0x58f45f,_0x555d4f,_0x57e18a,_0xc55cf3,_0x5da646,_0x4ae2eb);break;case'freshsales':freshsales['cs'](_0x33def1,_0x58f45f,_0x555d4f,_0x57e18a,_0xc55cf3,_0x5da646,_0x4ae2eb,_0x263bef);break;case'servicenow':servicenow['cs'](_0x33def1,_0x58f45f,_0x555d4f,_0x57e18a,_0xc55cf3,_0x5da646,_0x4ae2eb,_0x263bef);break;case _0x1601('0xc'):dynamics365['cs'](_0x33def1,_0x58f45f,_0x555d4f,_0x57e18a,_0xc55cf3,_0x5da646,_0x4ae2eb,_0x263bef);break;default:console[_0x1601('0x19')](_0x1601('0x1b'));}}else{_0x24cc39=require('../../../../config/logger')(_0x33def1[_0x1601('0x11')][_0x1601('0x12')]());_0x24cc39[_0x1601('0x1c')](_0x1601('0x1d'),util[_0x1601('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0x33def1[_0x1601('0x11')][_0x1601('0x12')](),_0x33def1[_0x1601('0x15')]));}}else{_0x24cc39=require('../../../../config/logger')(_0x33def1[_0x1601('0x11')][_0x1601('0x12')]());_0x24cc39['error'](_0x1601('0x1d'),util[_0x1601('0x1e')]('%s\x20account\x20#%s\x20not\x20found',_0x33def1['data1'][_0x1601('0x12')](),_0x33def1[_0x1601('0x13')]));}}else{}}catch(_0x34d021){console['error'](_0x34d021);}}}}; \ 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 cb9ee3f..4ef5461 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 _0x9d83=['create','validateEmail','User','find','then','length','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Caller\x20-\x20%s','LastName','format','Company','upperFirst','includes','string','picklist','type','idField','content','toString','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','username','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Fields','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/logger','defaults','redis','socket.io-emitter','assign','getString','Subjects','ticketType','Task','utc','IsRecurrence','contact','WhoId','endUserType','account','WhatId','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject'];(function(_0x48a437,_0x211838){var _0x1afb3f=function(_0x1e0be6){while(--_0x1e0be6){_0x48a437['push'](_0x48a437['shift']());}};_0x1afb3f(++_0x211838);}(_0x9d83,0x149));var _0x39d8=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x9d83[_0x59bcb1];return _0x4a737f;};'use strict';var _=require('lodash');var rp=require(_0x39d8('0x0'));var moment=require(_0x39d8('0x1'));var BPromise=require(_0x39d8('0x2'));var md5=require(_0x39d8('0x3'));var jsforce=require(_0x39d8('0x4'));var util=require('util');var Redis=require(_0x39d8('0x5'));var intUtil=require(_0x39d8('0x6'));var config=require('../../../../config/environment');var logger=require(_0x39d8('0x7'))('salesforce');config['redis']=_[_0x39d8('0x8')](config[_0x39d8('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x39d8('0xa'))(new Redis(config['redis']));function emit(_0x4c7eb4,_0x541545,_0x1a40a1){io['to'](_0x4c7eb4)['emit'](_0x541545,_0x1a40a1);}function getTicket(_0xb75b7e,_0x5bdaf1,_0xecb74f,_0x1e4649,_0x4fad46,_0x351ca9,_0x269597,_0x2d0d10){var _0x1f2402=Object[_0x39d8('0xb')]({},{'OwnerId':_0x5bdaf1['id'],'Subject':intUtil[_0x39d8('0xc')](_0x1e4649[_0x39d8('0xd')],_0x4fad46,'\x20'),'Description':intUtil[_0x39d8('0xc')](_0x1e4649['Descriptions'],_0x4fad46,'\x0a')},getCustomFields(_0x351ca9,_0x4fad46));if(_0xecb74f){if(_0x1e4649[_0x39d8('0xe')]===_0x39d8('0xf')){_0x1f2402['ActivityDate']=moment[_0x39d8('0x10')]();_0x1f2402['IsReminderSet']=![];_0x1f2402[_0x39d8('0x11')]=![];if(_0xecb74f['endUserType']===_0x39d8('0x12')||_0xecb74f['endUserType']==='lead'){_0x1f2402[_0x39d8('0x13')]=_0xecb74f['id'];}else if(_0xecb74f[_0x39d8('0x14')]===_0x39d8('0x15')){_0x1f2402[_0x39d8('0x16')]=_0xecb74f['id'];}}else if(_0x1e4649[_0x39d8('0xe')]===_0x39d8('0x17')){if(_0xecb74f[_0x39d8('0x14')]===_0x39d8('0x12')){_0x1f2402[_0x39d8('0x18')]=_0xecb74f['id'];}else if(_0xecb74f[_0x39d8('0x14')]===_0x39d8('0x15')){_0x1f2402[_0x39d8('0x19')]=_0xecb74f['id'];}else if(_0xecb74f[_0x39d8('0x14')]===_0x39d8('0x1a')&&_0x1e4649[_0x39d8('0x1b')]){_0x1f2402[_0x1e4649[_0x39d8('0x1b')]]=_0xecb74f['id'];}else{logger[_0x39d8('0x1c')](_0x39d8('0x1d'));}}}return _0x269597[_0x39d8('0x1e')](_0x1e4649[_0x39d8('0xe')])[_0x39d8('0x1f')](_0x1f2402);}function getUser(_0x52bfb0,_0x50fbe2,_0x5246df){if(!_['isNil'](_0x50fbe2)&&intUtil[_0x39d8('0x20')](_0x50fbe2)){var _0x3d3a93={'Email':_0x50fbe2};var _0x54c14d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5246df['sobject'](_0x39d8('0x21'))[_0x39d8('0x22')](_0x3d3a93,_0x54c14d)['execute']()[_0x39d8('0x23')](function(_0x15cb0f){if(_0x15cb0f[_0x39d8('0x24')]){var _0x335223=_[_0x39d8('0x22')](_0x15cb0f,function(_0x5394cf){return _0x5394cf['Email']===_0x50fbe2;});if(_0x335223){logger[_0x39d8('0x1c')](_0x39d8('0x25'),_0x50fbe2);return BPromise['resolve']({'id':_0x335223['Id'],'name':_0x335223[_0x39d8('0x26')]});}}else{logger[_0x39d8('0x1c')](_0x39d8('0x27'),_0x50fbe2);return _0x5246df[_0x39d8('0x28')]()[_0x39d8('0x23')](function(_0x70b609){return BPromise['resolve']({'id':_0x70b609[_0x39d8('0x29')],'name':_0x70b609['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x50fbe2);return _0x5246df[_0x39d8('0x28')]()['then'](function(_0x13827e){return BPromise['resolve']({'id':_0x13827e[_0x39d8('0x29')],'name':_0x13827e[_0x39d8('0x2a')]});});}}function getEndUser(_0x5b9583,_0x2a4d62,_0x14bd04,_0x4d93fb,_0x53eaff){var _0x520e40={'$or':{'Phone':_0x4d93fb}};var _0x119985={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x39d8('0x2b')]()[_0x39d8('0x23')](function(){logger[_0x39d8('0x1c')](_0x39d8('0x2c'),_0x4d93fb,_0x2a4d62['moduleSearch']);switch(_0x2a4d62['moduleSearch']){case'contact_lead':var _0x48d385=_[_0x39d8('0x2d')](_0x520e40);if(_0x2a4d62[_0x39d8('0x2e')]){var _0x377819={};_0x377819[_0x2a4d62[_0x39d8('0x2e')]]=_0x4d93fb;_[_0x39d8('0x2f')](_0x48d385[_0x39d8('0x30')],_0x377819);}return _0x53eaff[_0x39d8('0x1e')](_0x39d8('0x31'))[_0x39d8('0x22')](_0x48d385,_0x119985)[_0x39d8('0x32')]()['then'](function(_0x553969){if(_0x553969&&_0x553969['length']){return _0x553969;}else{var _0x352612=_[_0x39d8('0x2d')](_0x520e40);if(_0x2a4d62[_0x39d8('0x33')]){var _0x42c33b={};_0x42c33b[_0x2a4d62[_0x39d8('0x33')]]=_0x4d93fb;_[_0x39d8('0x2f')](_0x352612[_0x39d8('0x30')],_0x42c33b);}return _0x53eaff['sobject']('Lead')['find'](_0x352612,_0x119985);}});case _0x39d8('0x34'):var _0x1789be=_[_0x39d8('0x2d')](_0x520e40);if(_0x2a4d62[_0x39d8('0x35')]){var _0x377819={};_0x377819[_0x2a4d62['additionalSearchAccount']]=_0x4d93fb;_[_0x39d8('0x2f')](_0x1789be[_0x39d8('0x30')],_0x377819);}return _0x53eaff[_0x39d8('0x1e')](_0x39d8('0x36'))[_0x39d8('0x22')](_0x1789be,_0x119985)[_0x39d8('0x32')]()[_0x39d8('0x23')](function(_0x31a45b){if(_0x31a45b&&_0x31a45b[_0x39d8('0x24')]){return _0x31a45b;}else{var _0x476b0b=_[_0x39d8('0x2d')](_0x520e40);if(_0x2a4d62[_0x39d8('0x2e')]){var _0x41166d={};_0x41166d[_0x2a4d62[_0x39d8('0x2e')]]=_0x4d93fb;_[_0x39d8('0x2f')](_0x476b0b[_0x39d8('0x30')],_0x41166d);}return _0x53eaff[_0x39d8('0x1e')](_0x39d8('0x31'))[_0x39d8('0x22')](_0x476b0b,_0x119985)['then'](function(_0x4894f8){if(_0x4894f8&&_0x4894f8[_0x39d8('0x24')]){return _0x4894f8;}else{var _0x4b060e=_[_0x39d8('0x2d')](_0x520e40);if(_0x2a4d62[_0x39d8('0x33')]){var _0x3fc230={};_0x3fc230[_0x2a4d62[_0x39d8('0x33')]]=_0x4d93fb;_['merge'](_0x4b060e[_0x39d8('0x30')],_0x3fc230);}return _0x53eaff[_0x39d8('0x1e')](_0x39d8('0x37'))[_0x39d8('0x22')](_0x4b060e,_0x119985);}});}});case _0x39d8('0x12'):var _0x48d385=_[_0x39d8('0x2d')](_0x520e40);if(_0x2a4d62[_0x39d8('0x2e')]){var _0x377819={};_0x377819[_0x2a4d62['additionalSearchContact']]=_0x4d93fb;_[_0x39d8('0x2f')](_0x48d385[_0x39d8('0x30')],_0x377819);}return _0x53eaff['sobject']('Contact')[_0x39d8('0x22')](_0x48d385,_0x119985)[_0x39d8('0x32')]();case'lead':var _0x496915=_[_0x39d8('0x2d')](_0x520e40);if(_0x2a4d62[_0x39d8('0x33')]){var _0x377819={};_0x377819[_0x2a4d62[_0x39d8('0x33')]]=_0x4d93fb;_[_0x39d8('0x2f')](_0x496915[_0x39d8('0x30')],_0x377819);}return _0x53eaff[_0x39d8('0x1e')]('Lead')[_0x39d8('0x22')](_0x496915,_0x119985);case'account':var _0x1789be=_['cloneDeep'](_0x520e40);if(_0x2a4d62[_0x39d8('0x35')]){var _0x377819={};_0x377819[_0x2a4d62[_0x39d8('0x35')]]=_0x4d93fb;_['merge'](_0x1789be[_0x39d8('0x30')],_0x377819);}return _0x53eaff[_0x39d8('0x1e')](_0x39d8('0x36'))[_0x39d8('0x22')](_0x1789be,_0x119985);default:return null;}})[_0x39d8('0x23')](function(_0x2e1372){if(_0x2e1372&&_0x2e1372[_0x39d8('0x24')]){var _0x2bd18d=_['first'](_0x2e1372);if(_0x2bd18d){return BPromise[_0x39d8('0x2b')]({'id':_0x2bd18d['Id'],'name':_0x2bd18d[_0x39d8('0x26')],'phone':_0x2bd18d[_0x39d8('0x38')],'endUserType':_0x2bd18d[_0x39d8('0x39')]['type'][_0x39d8('0x3a')]()});}}})['then'](function(_0x1dace0){if(_0x1dace0){logger['info'](_0x39d8('0x3b'),_0x1dace0[_0x39d8('0x14')],_0x4d93fb);return BPromise[_0x39d8('0x2b')](_0x1dace0);}else{logger[_0x39d8('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x4d93fb);var _0x4fd175={'Phone':_0x4d93fb};if(_0x2a4d62['moduleCreate']){if(_0x2a4d62[_0x39d8('0x3c')]===_0x39d8('0x12')){logger[_0x39d8('0x1c')](_0x39d8('0x3d'),_0x4d93fb,_0x2a4d62[_0x39d8('0x3c')]);_0x4fd175['LastName']=_0x14bd04!==_0x39d8('0x3e')?_0x14bd04:util['format'](_0x39d8('0x3f'),_0x4d93fb);}else if(_0x2a4d62[_0x39d8('0x3c')]===_0x39d8('0x1a')){logger[_0x39d8('0x1c')](_0x39d8('0x3d'),_0x4d93fb,_0x2a4d62['moduleCreate']);_0x4fd175[_0x39d8('0x40')]=_0x14bd04!==_0x39d8('0x3e')?_0x14bd04:util[_0x39d8('0x41')](_0x39d8('0x3f'),_0x4d93fb);_0x4fd175[_0x39d8('0x42')]='No\x20Company';}else if(_0x2a4d62[_0x39d8('0x3c')]===_0x39d8('0x15')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4d93fb,_0x2a4d62['moduleCreate']);_0x4fd175[_0x39d8('0x26')]=_0x14bd04!==_0x39d8('0x3e')?_0x14bd04:util['format'](_0x39d8('0x3f'),_0x4d93fb);}else{return null;}}return _0x53eaff[_0x39d8('0x1e')](_[_0x39d8('0x43')](_0x2a4d62[_0x39d8('0x3c')]))[_0x39d8('0x1f')](_0x4fd175)[_0x39d8('0x23')](function(_0x116cd7){return BPromise['resolve']({'id':_0x116cd7['id'],'endUserType':_0x2a4d62[_0x39d8('0x3c')]});});}});}function getCustomFields(_0x35824a,_0xc8e9f2){var _0x42a2a8={};if(_0x35824a[_0x39d8('0x24')]>0x0){_['forEach'](_0x35824a,function(_0x1acad4){if(_[_0x39d8('0x44')]([_0x39d8('0x45'),_0x39d8('0x46')],_0x1acad4[_0x39d8('0x47')])&&_0x1acad4['idField']){_0x42a2a8[_0x1acad4[_0x39d8('0x48')]]=_0x1acad4[_0x39d8('0x49')][_0x39d8('0x4a')]();}else if(_0x1acad4[_0x39d8('0x47')]==='variable'&&_0x1acad4['variableName']&&_0x1acad4['idField']){_0xc8e9f2[_0x1acad4[_0x39d8('0x4b')]]&&(_0x42a2a8[_0x1acad4[_0x39d8('0x48')]]=_0xc8e9f2[_0x1acad4[_0x39d8('0x4b')]][_0x39d8('0x4a')]());}else if(_0x1acad4['type']==='customVariable'&&_0x1acad4[_0x39d8('0x4c')]&&_0x1acad4[_0x39d8('0x4c')][_0x39d8('0x4d')]&&_0x1acad4[_0x39d8('0x48')]){_0xc8e9f2[_0x1acad4[_0x39d8('0x4c')]['name'][_0x39d8('0x3a')]()]&&(_0x42a2a8[_0x1acad4['idField']]=_0xc8e9f2[_0x1acad4['Variable'][_0x39d8('0x4d')]['toLowerCase']()]['toString']());}});}return _0x42a2a8;}function getConnection(_0xb1c259){var _0x2f937f=_0xb1c259[_0x39d8('0x4e')][_0x39d8('0x4f')](_0xb1c259[_0x39d8('0x50')]);var _0x1ff6b3=new jsforce[(_0x39d8('0x51'))]({'oauth2':{'loginUrl':_0xb1c259[_0x39d8('0x52')]||'https://login.salesforce.com','clientId':_0xb1c259[_0x39d8('0x53')],'clientSecret':_0xb1c259[_0x39d8('0x54')]}});return _0x1ff6b3[_0x39d8('0x55')](_0xb1c259[_0x39d8('0x56')],_0x2f937f)[_0x39d8('0x23')](function(){logger[_0x39d8('0x1c')]('Connection\x20established.');return _0x1ff6b3;});}exports['queue']=function(_0x4db860,_0xf59996,_0xe9c222,_0x4bc846,_0x5e2447,_0x4d294f){var _0x21734a,_0xda9b6a,_0x2af6d0,_0x1de9a9;_0x4d294f[_0x39d8('0x57')]=intUtil[_0x39d8('0x58')](_0x4d294f[_0x39d8('0x57')]);_0x4d294f[_0x39d8('0x52')]=intUtil[_0x39d8('0x58')](_0x4d294f[_0x39d8('0x52')]);if(_0x5e2447&&_0x5e2447['monitor_format']){logger[_0x39d8('0x1c')](_0x39d8('0x59'),_0x39d8('0x5a'));_0xf59996[_0x39d8('0x5b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4d294f[_0x39d8('0x57')],_0xf59996['uniqueid'],md5(_0xf59996[_0x39d8('0x5c')]));}else{_0xf59996[_0x39d8('0x5b')]='';}return getConnection(_0x4d294f)[_0x39d8('0x23')](function(_0x543813){_0x1de9a9=_0x543813;return getUser(_0x4d294f,_0x4bc846[_0x39d8('0x5d')],_0x1de9a9);})['then'](function(_0x289a2b){_0x21734a=_0x289a2b;return getEndUser(_0x4d294f,_0xe9c222,_0xf59996[_0x39d8('0x5e')],_0xf59996[_0x39d8('0x5f')],_0x1de9a9);})[_0x39d8('0x23')](function(_0x192cd2){_0xda9b6a=_0x192cd2;return getTicket(_0x4d294f,_0x21734a,_0xda9b6a,_0xe9c222,_0xf59996,_0xe9c222['Fields'],_0x1de9a9,_0x39d8('0x60'));})['then'](function(_0x2218a3){_0x2af6d0=_0x2218a3;logger[_0x39d8('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x2af6d0['id']);logger['info'](_0x39d8('0x61'),_0x2af6d0['id'],_0x4bc846[_0x39d8('0x4d')],_0x4d294f[_0x39d8('0x47')]);switch(_0x4d294f[_0x39d8('0x47')]){case _0x39d8('0x62'):emit(util[_0x39d8('0x41')](_0x39d8('0x63'),_0x4bc846[_0x39d8('0x4d')]),_0x39d8('0x64'),{'recordId':_0x2af6d0['id']});break;case _0x39d8('0x65'):emit(util[_0x39d8('0x41')]('user:%s',_0x4bc846['name']),_0x39d8('0x66'),{'uri':util[_0x39d8('0x41')](_0x39d8('0x67'),_0x1de9a9[_0x39d8('0x68')],_0x2af6d0['id'])});break;default:logger[_0x39d8('0x69')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x39d8('0x6a')](function(_0x243d7b){logger[_0x39d8('0x69')](_0x39d8('0x59'),_0x243d7b);});};exports[_0x39d8('0x6b')]=function(_0x4a23e8,_0x15e00f,_0x1c797f,_0x1ae6a3,_0x3db5c4,_0x16d464,_0xcbd8a0){var _0x8d987c,_0x2db0ac,_0x2fdeb0,_0x34ada9;_0x16d464['serverUrl']=intUtil[_0x39d8('0x58')](_0x16d464['serverUrl']);_0x16d464['remoteUri']=intUtil[_0x39d8('0x58')](_0x16d464[_0x39d8('0x52')]);if(_0xcbd8a0&&_0xcbd8a0[_0x39d8('0x6c')]&&_0xcbd8a0[_0x39d8('0x6c')]!==_0x39d8('0x6d')){logger[_0x39d8('0x1c')](_0x39d8('0x6e'),_0x39d8('0x5a'));_0x15e00f[_0x39d8('0x5b')]=util[_0x39d8('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x16d464[_0x39d8('0x57')],_0x15e00f[_0x39d8('0x5c')],md5(_0x15e00f[_0x39d8('0x5c')]));}return getConnection(_0x16d464)[_0x39d8('0x23')](function(_0x5eb230){_0x34ada9=_0x5eb230;return getUser(_0x16d464,_0x1ae6a3['email'],_0x34ada9);})[_0x39d8('0x23')](function(_0x35bb38){_0x8d987c=_0x35bb38;return getEndUser(_0x16d464,_0x1c797f,_0x15e00f[_0x39d8('0x6f')],_0x15e00f[_0x39d8('0x70')],_0x34ada9);})[_0x39d8('0x23')](function(_0x589dc6){_0x2db0ac=_0x589dc6;return getTicket(_0x16d464,_0x8d987c,_0x2db0ac,_0x1c797f,_0x15e00f,_0x1c797f['Fields'],_0x34ada9,'outbound');})[_0x39d8('0x23')](function(_0x47dd82){_0x2fdeb0=_0x47dd82;logger[_0x39d8('0x1c')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2fdeb0['id']);logger['info'](_0x39d8('0x71'),_0x2fdeb0['id'],_0x1ae6a3[_0x39d8('0x4d')],_0x16d464[_0x39d8('0x47')]);switch(_0x16d464[_0x39d8('0x47')]){case _0x39d8('0x62'):emit(util[_0x39d8('0x41')](_0x39d8('0x63'),_0x1ae6a3[_0x39d8('0x4d')]),_0x39d8('0x64'),{'recordId':_0x2fdeb0['id']});break;case _0x39d8('0x65'):emit(util['format'](_0x39d8('0x63'),_0x1ae6a3[_0x39d8('0x4d')]),_0x39d8('0x66'),{'uri':util[_0x39d8('0x41')](_0x39d8('0x67'),_0x34ada9[_0x39d8('0x68')],_0x2fdeb0['id'])});break;default:logger['error'](_0x39d8('0x6e'),_0x39d8('0x72'));}})['catch'](function(_0x530c64){logger[_0x39d8('0x69')](_0x39d8('0x6e'),_0x530c64);});};exports['unmanaged']=function(_0x52fa14,_0x3de68d,_0x33b133,_0x184e06,_0x53700e,_0x33f23e){var _0x5d5a80,_0x491ad9,_0x258b9e,_0x22ea60;_0x33f23e[_0x39d8('0x57')]=intUtil[_0x39d8('0x58')](_0x33f23e[_0x39d8('0x57')]);_0x33f23e['remoteUri']=intUtil[_0x39d8('0x58')](_0x33f23e[_0x39d8('0x52')]);if(_0x53700e&&_0x53700e['monitor_format']){logger[_0x39d8('0x1c')]('['+_0x3de68d['lastevent']['toUpperCase']()+']',_0x39d8('0x5a'));_0x3de68d[_0x39d8('0x5b')]=util[_0x39d8('0x41')](_0x39d8('0x73'),_0x33f23e[_0x39d8('0x57')],_0x3de68d[_0x39d8('0x5c')],md5(_0x3de68d['uniqueid']));}else{_0x3de68d['recordingURL']='';}return getConnection(_0x33f23e)[_0x39d8('0x23')](function(_0x3e313f){_0x22ea60=_0x3e313f;if(!_['isNil'](_0x184e06)){return getUser(_0x33f23e,_0x184e06[_0x39d8('0x4d')],_0x22ea60);}else{return getUser(_0x33f23e,null,_0x22ea60);}})['then'](function(_0x400a70){_0x5d5a80=_0x400a70;return getEndUser(_0x33f23e,_0x33b133,_0x3de68d['calleridname'],_0x3de68d[_0x39d8('0x5f')],_0x22ea60);})[_0x39d8('0x23')](function(_0x409d81){_0x491ad9=_0x409d81;return getTicket(_0x33f23e,_0x5d5a80,_0x491ad9,_0x33b133,_0x3de68d,_0x33b133[_0x39d8('0x74')],_0x22ea60);})[_0x39d8('0x23')](function(_0x49ce3d){_0x258b9e=_0x49ce3d;logger[_0x39d8('0x1c')]('['+_0x3de68d['lastevent'][_0x39d8('0x75')]()+']\x20Ticket\x20%s\x20created.',_0x258b9e['id']);logger[_0x39d8('0x1c')]('['+_0x3de68d[_0x39d8('0x76')]['toUpperCase']()+_0x39d8('0x77'),_0x33f23e[_0x39d8('0x47')]);})[_0x39d8('0x6a')](function(_0x37df9f){logger['error']('['+_0x3de68d[_0x39d8('0x76')][_0x39d8('0x75')]()+']',_0x37df9f);});}; \ No newline at end of file +var _0xd8cf=['user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','$or','Contact','first','Name','Phone','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','','Company','No\x20Company','Caller\x20-\x20%s','forEach','includes','string','picklist','idField','content','toString','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','getString','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','execute','then','length','find','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','identity'];(function(_0x293444,_0x2edd1e){var _0x46c680=function(_0x51b9bd){while(--_0x51b9bd){_0x293444['push'](_0x293444['shift']());}};_0x46c680(++_0x2edd1e);}(_0xd8cf,0x1d5));var _0xfd8c=function(_0x44b2d3,_0x1e49d2){_0x44b2d3=_0x44b2d3-0x0;var _0x143d9d=_0xd8cf[_0x44b2d3];return _0x143d9d;};'use strict';var _=require(_0xfd8c('0x0'));var rp=require(_0xfd8c('0x1'));var moment=require('moment');var BPromise=require(_0xfd8c('0x2'));var md5=require(_0xfd8c('0x3'));var jsforce=require(_0xfd8c('0x4'));var util=require(_0xfd8c('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xfd8c('0x6'))(_0xfd8c('0x7'));config['redis']=_[_0xfd8c('0x8')](config[_0xfd8c('0x9')],{'host':_0xfd8c('0xa'),'port':0x18eb});var io=require(_0xfd8c('0xb'))(new Redis(config[_0xfd8c('0x9')]));function emit(_0x5f2968,_0x52e537,_0x19789d){io['to'](_0x5f2968)[_0xfd8c('0xc')](_0x52e537,_0x19789d);}function getTicket(_0x3d1fe4,_0x22413c,_0xfbfac5,_0x3f1f85,_0x3ca769,_0x1a52a5,_0x27dc5e,_0x41b07f){var _0xcff771=Object['assign']({},{'OwnerId':_0x22413c['id'],'Subject':intUtil[_0xfd8c('0xd')](_0x3f1f85['Subjects'],_0x3ca769,'\x20'),'Description':intUtil[_0xfd8c('0xd')](_0x3f1f85[_0xfd8c('0xe')],_0x3ca769,'\x0a')},getCustomFields(_0x1a52a5,_0x3ca769));if(_0xfbfac5){if(_0x3f1f85[_0xfd8c('0xf')]===_0xfd8c('0x10')){_0xcff771[_0xfd8c('0x11')]=moment['utc']();_0xcff771[_0xfd8c('0x12')]=![];_0xcff771[_0xfd8c('0x13')]=![];if(_0xfbfac5[_0xfd8c('0x14')]===_0xfd8c('0x15')||_0xfbfac5['endUserType']===_0xfd8c('0x16')){_0xcff771[_0xfd8c('0x17')]=_0xfbfac5['id'];}else if(_0xfbfac5[_0xfd8c('0x14')]===_0xfd8c('0x18')){_0xcff771[_0xfd8c('0x19')]=_0xfbfac5['id'];}}else if(_0x3f1f85[_0xfd8c('0xf')]===_0xfd8c('0x1a')){if(_0xfbfac5[_0xfd8c('0x14')]==='contact'){_0xcff771[_0xfd8c('0x1b')]=_0xfbfac5['id'];}else if(_0xfbfac5[_0xfd8c('0x14')]==='account'){_0xcff771['AccountId']=_0xfbfac5['id'];}else if(_0xfbfac5['endUserType']===_0xfd8c('0x16')&&_0x3f1f85[_0xfd8c('0x1c')]){_0xcff771[_0x3f1f85[_0xfd8c('0x1c')]]=_0xfbfac5['id'];}else{logger[_0xfd8c('0x1d')](_0xfd8c('0x1e'));}}}return _0x27dc5e[_0xfd8c('0x1f')](_0x3f1f85[_0xfd8c('0xf')])['create'](_0xcff771);}function getUser(_0x303519,_0x1f24ac,_0x27d013){if(!_['isNil'](_0x1f24ac)&&intUtil[_0xfd8c('0x20')](_0x1f24ac)){var _0x257fa1={'Email':_0x1f24ac};var _0x49db9a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x27d013['sobject']('User')['find'](_0x257fa1,_0x49db9a)[_0xfd8c('0x21')]()[_0xfd8c('0x22')](function(_0xbead8b){if(_0xbead8b[_0xfd8c('0x23')]){var _0x10a9da=_[_0xfd8c('0x24')](_0xbead8b,function(_0x312f43){return _0x312f43[_0xfd8c('0x25')]===_0x1f24ac;});if(_0x10a9da){logger[_0xfd8c('0x1d')](_0xfd8c('0x26'),_0x1f24ac);return BPromise[_0xfd8c('0x27')]({'id':_0x10a9da['Id'],'name':_0x10a9da['Name']});}}else{logger[_0xfd8c('0x1d')](_0xfd8c('0x28'),_0x1f24ac);return _0x27d013['identity']()[_0xfd8c('0x22')](function(_0x33394a){return BPromise[_0xfd8c('0x27')]({'id':_0x33394a['user_id'],'name':_0x33394a[_0xfd8c('0x29')]});});}});}else{logger[_0xfd8c('0x1d')](_0xfd8c('0x28'),_0x1f24ac);return _0x27d013[_0xfd8c('0x2a')]()[_0xfd8c('0x22')](function(_0x20dfab){return BPromise['resolve']({'id':_0x20dfab[_0xfd8c('0x2b')],'name':_0x20dfab[_0xfd8c('0x29')]});});}}function getEndUser(_0x18a8a2,_0x2e5f67,_0x5c8bb8,_0x33ccca,_0x5c243b){var _0x22a393={'$or':{'Phone':_0x33ccca}};var _0x3e5983={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfd8c('0x27')]()['then'](function(){logger[_0xfd8c('0x1d')](_0xfd8c('0x2c'),_0x33ccca,_0x2e5f67[_0xfd8c('0x2d')]);switch(_0x2e5f67[_0xfd8c('0x2d')]){case _0xfd8c('0x2e'):var _0x237895=_['cloneDeep'](_0x22a393);if(_0x2e5f67[_0xfd8c('0x2f')]){var _0x4262a7={};_0x4262a7[_0x2e5f67[_0xfd8c('0x2f')]]=_0x33ccca;_[_0xfd8c('0x30')](_0x237895['$or'],_0x4262a7);}return _0x5c243b['sobject']('Contact')[_0xfd8c('0x24')](_0x237895,_0x3e5983)[_0xfd8c('0x21')]()[_0xfd8c('0x22')](function(_0x587b3c){if(_0x587b3c&&_0x587b3c[_0xfd8c('0x23')]){return _0x587b3c;}else{var _0x372946=_[_0xfd8c('0x31')](_0x22a393);if(_0x2e5f67[_0xfd8c('0x32')]){var _0x3180df={};_0x3180df[_0x2e5f67[_0xfd8c('0x32')]]=_0x33ccca;_[_0xfd8c('0x30')](_0x372946['$or'],_0x3180df);}return _0x5c243b[_0xfd8c('0x1f')](_0xfd8c('0x33'))[_0xfd8c('0x24')](_0x372946,_0x3e5983);}});case _0xfd8c('0x34'):var _0x2d5099=_[_0xfd8c('0x31')](_0x22a393);if(_0x2e5f67[_0xfd8c('0x35')]){var _0x4262a7={};_0x4262a7[_0x2e5f67[_0xfd8c('0x35')]]=_0x33ccca;_[_0xfd8c('0x30')](_0x2d5099['$or'],_0x4262a7);}return _0x5c243b[_0xfd8c('0x1f')](_0xfd8c('0x36'))[_0xfd8c('0x24')](_0x2d5099,_0x3e5983)['execute']()[_0xfd8c('0x22')](function(_0x174c09){if(_0x174c09&&_0x174c09[_0xfd8c('0x23')]){return _0x174c09;}else{var _0x51efbf=_[_0xfd8c('0x31')](_0x22a393);if(_0x2e5f67['additionalSearchContact']){var _0xe1c397={};_0xe1c397[_0x2e5f67[_0xfd8c('0x2f')]]=_0x33ccca;_[_0xfd8c('0x30')](_0x51efbf[_0xfd8c('0x37')],_0xe1c397);}return _0x5c243b[_0xfd8c('0x1f')](_0xfd8c('0x38'))[_0xfd8c('0x24')](_0x51efbf,_0x3e5983)[_0xfd8c('0x22')](function(_0x27ed54){if(_0x27ed54&&_0x27ed54['length']){return _0x27ed54;}else{var _0x4742c5=_[_0xfd8c('0x31')](_0x22a393);if(_0x2e5f67[_0xfd8c('0x32')]){var _0x2413bc={};_0x2413bc[_0x2e5f67[_0xfd8c('0x32')]]=_0x33ccca;_[_0xfd8c('0x30')](_0x4742c5[_0xfd8c('0x37')],_0x2413bc);}return _0x5c243b[_0xfd8c('0x1f')](_0xfd8c('0x33'))['find'](_0x4742c5,_0x3e5983);}});}});case _0xfd8c('0x15'):var _0x237895=_['cloneDeep'](_0x22a393);if(_0x2e5f67[_0xfd8c('0x2f')]){var _0x4262a7={};_0x4262a7[_0x2e5f67[_0xfd8c('0x2f')]]=_0x33ccca;_['merge'](_0x237895[_0xfd8c('0x37')],_0x4262a7);}return _0x5c243b[_0xfd8c('0x1f')]('Contact')[_0xfd8c('0x24')](_0x237895,_0x3e5983)[_0xfd8c('0x21')]();case'lead':var _0x16a242=_[_0xfd8c('0x31')](_0x22a393);if(_0x2e5f67['additionalSearchLead']){var _0x4262a7={};_0x4262a7[_0x2e5f67[_0xfd8c('0x32')]]=_0x33ccca;_[_0xfd8c('0x30')](_0x16a242[_0xfd8c('0x37')],_0x4262a7);}return _0x5c243b[_0xfd8c('0x1f')]('Lead')[_0xfd8c('0x24')](_0x16a242,_0x3e5983);case _0xfd8c('0x18'):var _0x2d5099=_[_0xfd8c('0x31')](_0x22a393);if(_0x2e5f67[_0xfd8c('0x35')]){var _0x4262a7={};_0x4262a7[_0x2e5f67[_0xfd8c('0x35')]]=_0x33ccca;_[_0xfd8c('0x30')](_0x2d5099[_0xfd8c('0x37')],_0x4262a7);}return _0x5c243b[_0xfd8c('0x1f')](_0xfd8c('0x36'))[_0xfd8c('0x24')](_0x2d5099,_0x3e5983);default:return null;}})[_0xfd8c('0x22')](function(_0xedad7e){if(_0xedad7e&&_0xedad7e[_0xfd8c('0x23')]){var _0x187ef5=_[_0xfd8c('0x39')](_0xedad7e);if(_0x187ef5){return BPromise[_0xfd8c('0x27')]({'id':_0x187ef5['Id'],'name':_0x187ef5[_0xfd8c('0x3a')],'phone':_0x187ef5[_0xfd8c('0x3b')],'endUserType':_0x187ef5['attributes'][_0xfd8c('0x3c')][_0xfd8c('0x3d')]()});}}})['then'](function(_0x2cee1b){if(_0x2cee1b){logger[_0xfd8c('0x1d')](_0xfd8c('0x3e'),_0x2cee1b[_0xfd8c('0x14')],_0x33ccca);return BPromise[_0xfd8c('0x27')](_0x2cee1b);}else{logger['info'](_0xfd8c('0x3f'),_0x33ccca);var _0x23b7b5={'Phone':_0x33ccca};if(_0x2e5f67['moduleCreate']){if(_0x2e5f67[_0xfd8c('0x40')]==='contact'){logger[_0xfd8c('0x1d')](_0xfd8c('0x41'),_0x33ccca,_0x2e5f67[_0xfd8c('0x40')]);_0x23b7b5[_0xfd8c('0x42')]=_0x5c8bb8!==''?_0x5c8bb8:util[_0xfd8c('0x43')]('Caller\x20-\x20%s',_0x33ccca);}else if(_0x2e5f67[_0xfd8c('0x40')]===_0xfd8c('0x16')){logger[_0xfd8c('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x33ccca,_0x2e5f67[_0xfd8c('0x40')]);_0x23b7b5[_0xfd8c('0x42')]=_0x5c8bb8!==_0xfd8c('0x44')?_0x5c8bb8:util[_0xfd8c('0x43')]('Caller\x20-\x20%s',_0x33ccca);_0x23b7b5[_0xfd8c('0x45')]=_0xfd8c('0x46');}else if(_0x2e5f67[_0xfd8c('0x40')]===_0xfd8c('0x18')){logger['info'](_0xfd8c('0x41'),_0x33ccca,_0x2e5f67[_0xfd8c('0x40')]);_0x23b7b5['Name']=_0x5c8bb8!==_0xfd8c('0x44')?_0x5c8bb8:util[_0xfd8c('0x43')](_0xfd8c('0x47'),_0x33ccca);}else{return null;}}return _0x5c243b[_0xfd8c('0x1f')](_['upperFirst'](_0x2e5f67[_0xfd8c('0x40')]))['create'](_0x23b7b5)[_0xfd8c('0x22')](function(_0x4edca1){return BPromise[_0xfd8c('0x27')]({'id':_0x4edca1['id'],'endUserType':_0x2e5f67[_0xfd8c('0x40')]});});}});}function getCustomFields(_0x2eeef8,_0x4a5208){var _0x593544={};if(_0x2eeef8['length']>0x0){_[_0xfd8c('0x48')](_0x2eeef8,function(_0x2e24bd){if(_[_0xfd8c('0x49')]([_0xfd8c('0x4a'),_0xfd8c('0x4b')],_0x2e24bd[_0xfd8c('0x3c')])&&_0x2e24bd[_0xfd8c('0x4c')]){_0x593544[_0x2e24bd['idField']]=_0x2e24bd[_0xfd8c('0x4d')][_0xfd8c('0x4e')]();}else if(_0x2e24bd[_0xfd8c('0x3c')]==='variable'&&_0x2e24bd[_0xfd8c('0x4f')]&&_0x2e24bd[_0xfd8c('0x4c')]){_0x4a5208[_0x2e24bd['variableName']]&&(_0x593544[_0x2e24bd[_0xfd8c('0x4c')]]=_0x4a5208[_0x2e24bd[_0xfd8c('0x4f')]][_0xfd8c('0x4e')]());}else if(_0x2e24bd[_0xfd8c('0x3c')]==='customVariable'&&_0x2e24bd['Variable']&&_0x2e24bd[_0xfd8c('0x50')][_0xfd8c('0x51')]&&_0x2e24bd[_0xfd8c('0x4c')]){_0x4a5208[_0x2e24bd[_0xfd8c('0x50')][_0xfd8c('0x51')]['toLowerCase']()]&&(_0x593544[_0x2e24bd[_0xfd8c('0x4c')]]=_0x4a5208[_0x2e24bd[_0xfd8c('0x50')][_0xfd8c('0x51')]['toLowerCase']()][_0xfd8c('0x4e')]());}});}return _0x593544;}function getConnection(_0x516b33){var _0x1a322f=_0x516b33[_0xfd8c('0x52')][_0xfd8c('0x53')](_0x516b33[_0xfd8c('0x54')]);var _0x58b6b4=new jsforce[(_0xfd8c('0x55'))]({'oauth2':{'loginUrl':_0x516b33[_0xfd8c('0x56')]||_0xfd8c('0x57'),'clientId':_0x516b33[_0xfd8c('0x58')],'clientSecret':_0x516b33['clientSecret']}});return _0x58b6b4[_0xfd8c('0x59')](_0x516b33['username'],_0x1a322f)[_0xfd8c('0x22')](function(){logger[_0xfd8c('0x1d')](_0xfd8c('0x5a'));return _0x58b6b4;});}exports[_0xfd8c('0x5b')]=function(_0x1b73d5,_0x250502,_0x4034a1,_0x28f855,_0x2bf765,_0x151ffe){var _0x1b4aa4,_0xb188f7,_0x3ad36c,_0x379aaa;_0x151ffe['serverUrl']=intUtil[_0xfd8c('0x5c')](_0x151ffe[_0xfd8c('0x5d')]);_0x151ffe[_0xfd8c('0x56')]=intUtil[_0xfd8c('0x5c')](_0x151ffe[_0xfd8c('0x56')]);if(_0x2bf765&&_0x2bf765[_0xfd8c('0x5e')]){logger['info'](_0xfd8c('0x5f'),'Recording\x20is\x20enabled!');_0x250502[_0xfd8c('0x60')]=util[_0xfd8c('0x43')](_0xfd8c('0x61'),_0x151ffe[_0xfd8c('0x5d')],_0x250502[_0xfd8c('0x62')],md5(_0x250502['uniqueid']));}else{_0x250502[_0xfd8c('0x60')]='';}return getConnection(_0x151ffe)[_0xfd8c('0x22')](function(_0x3b88e7){_0x379aaa=_0x3b88e7;return getUser(_0x151ffe,_0x28f855[_0xfd8c('0x63')],_0x379aaa);})[_0xfd8c('0x22')](function(_0x53e14d){_0x1b4aa4=_0x53e14d;return getEndUser(_0x151ffe,_0x4034a1,_0x250502[_0xfd8c('0x64')],_0x250502[_0xfd8c('0x65')],_0x379aaa);})['then'](function(_0x2ab783){_0xb188f7=_0x2ab783;return getTicket(_0x151ffe,_0x1b4aa4,_0xb188f7,_0x4034a1,_0x250502,_0x4034a1[_0xfd8c('0x66')],_0x379aaa,_0xfd8c('0x5b'));})[_0xfd8c('0x22')](function(_0x574132){_0x3ad36c=_0x574132;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x3ad36c['id']);logger['info'](_0xfd8c('0x67'),_0x3ad36c['id'],_0x28f855[_0xfd8c('0x51')],_0x151ffe[_0xfd8c('0x3c')]);switch(_0x151ffe[_0xfd8c('0x3c')]){case'integrationTab':emit(util[_0xfd8c('0x43')](_0xfd8c('0x68'),_0x28f855[_0xfd8c('0x51')]),_0xfd8c('0x69'),{'recordId':_0x3ad36c['id']});break;case _0xfd8c('0x6a'):emit(util[_0xfd8c('0x43')]('user:%s',_0x28f855['name']),_0xfd8c('0x6b'),{'uri':util[_0xfd8c('0x43')](_0xfd8c('0x6c'),_0x379aaa[_0xfd8c('0x6d')],_0x3ad36c['id'])});break;default:logger[_0xfd8c('0x6e')](_0xfd8c('0x6f'));}})[_0xfd8c('0x70')](function(_0x202f33){logger[_0xfd8c('0x6e')](_0xfd8c('0x5f'),_0x202f33);});};exports[_0xfd8c('0x71')]=function(_0x4dcdf2,_0x3846ac,_0x526a72,_0x4d6767,_0x1fb794,_0x53945b,_0x2cf0ba){var _0x3cee35,_0x2f7e0e,_0x153100,_0x412749;_0x53945b[_0xfd8c('0x5d')]=intUtil[_0xfd8c('0x5c')](_0x53945b['serverUrl']);_0x53945b[_0xfd8c('0x56')]=intUtil[_0xfd8c('0x5c')](_0x53945b[_0xfd8c('0x56')]);if(_0x2cf0ba&&_0x2cf0ba['recordingFormat']&&_0x2cf0ba[_0xfd8c('0x72')]!=='none'){logger[_0xfd8c('0x1d')](_0xfd8c('0x73'),_0xfd8c('0x74'));_0x3846ac[_0xfd8c('0x60')]=util['format'](_0xfd8c('0x61'),_0x53945b[_0xfd8c('0x5d')],_0x3846ac[_0xfd8c('0x62')],md5(_0x3846ac[_0xfd8c('0x62')]));}return getConnection(_0x53945b)[_0xfd8c('0x22')](function(_0x17b949){_0x412749=_0x17b949;return getUser(_0x53945b,_0x4d6767['email'],_0x412749);})[_0xfd8c('0x22')](function(_0x39aef0){_0x3cee35=_0x39aef0;return getEndUser(_0x53945b,_0x526a72,_0x3846ac[_0xfd8c('0x75')],_0x3846ac[_0xfd8c('0x76')],_0x412749);})['then'](function(_0x144408){_0x2f7e0e=_0x144408;return getTicket(_0x53945b,_0x3cee35,_0x2f7e0e,_0x526a72,_0x3846ac,_0x526a72[_0xfd8c('0x66')],_0x412749,'outbound');})[_0xfd8c('0x22')](function(_0x10885b){_0x153100=_0x10885b;logger[_0xfd8c('0x1d')](_0xfd8c('0x77'),_0x153100['id']);logger[_0xfd8c('0x1d')](_0xfd8c('0x78'),_0x153100['id'],_0x4d6767[_0xfd8c('0x51')],_0x53945b[_0xfd8c('0x3c')]);switch(_0x53945b[_0xfd8c('0x3c')]){case _0xfd8c('0x79'):emit(util[_0xfd8c('0x43')](_0xfd8c('0x68'),_0x4d6767['name']),_0xfd8c('0x69'),{'recordId':_0x153100['id']});break;case'newTab':emit(util[_0xfd8c('0x43')](_0xfd8c('0x68'),_0x4d6767[_0xfd8c('0x51')]),'trigger:browser:url',{'uri':util[_0xfd8c('0x43')]('%s/%s/e',_0x412749[_0xfd8c('0x6d')],_0x153100['id'])});break;default:logger['error'](_0xfd8c('0x73'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xfd8c('0x70')](function(_0x5915c8){logger[_0xfd8c('0x6e')](_0xfd8c('0x73'),_0x5915c8);});};exports[_0xfd8c('0x7a')]=function(_0x2a681e,_0xb283cf,_0x139d47,_0x50e68d,_0x3d249f,_0x57b8f0){var _0x512f3e,_0x598a5c,_0x561667,_0x60cc0f;_0x57b8f0[_0xfd8c('0x5d')]=intUtil[_0xfd8c('0x5c')](_0x57b8f0[_0xfd8c('0x5d')]);_0x57b8f0[_0xfd8c('0x56')]=intUtil[_0xfd8c('0x5c')](_0x57b8f0[_0xfd8c('0x56')]);if(_0x3d249f&&_0x3d249f['monitor_format']){logger[_0xfd8c('0x1d')]('['+_0xb283cf[_0xfd8c('0x7b')][_0xfd8c('0x7c')]()+']',_0xfd8c('0x74'));_0xb283cf['recordingURL']=util[_0xfd8c('0x43')](_0xfd8c('0x61'),_0x57b8f0[_0xfd8c('0x5d')],_0xb283cf[_0xfd8c('0x62')],md5(_0xb283cf[_0xfd8c('0x62')]));}else{_0xb283cf[_0xfd8c('0x60')]='';}return getConnection(_0x57b8f0)[_0xfd8c('0x22')](function(_0x64b7e3){_0x60cc0f=_0x64b7e3;if(!_[_0xfd8c('0x7d')](_0x50e68d)){return getUser(_0x57b8f0,_0x50e68d[_0xfd8c('0x51')],_0x60cc0f);}else{return getUser(_0x57b8f0,null,_0x60cc0f);}})[_0xfd8c('0x22')](function(_0x523d87){_0x512f3e=_0x523d87;return getEndUser(_0x57b8f0,_0x139d47,_0xb283cf[_0xfd8c('0x64')],_0xb283cf['calleridnum'],_0x60cc0f);})[_0xfd8c('0x22')](function(_0x11f23e){_0x598a5c=_0x11f23e;return getTicket(_0x57b8f0,_0x512f3e,_0x598a5c,_0x139d47,_0xb283cf,_0x139d47[_0xfd8c('0x66')],_0x60cc0f);})[_0xfd8c('0x22')](function(_0x8b6df8){_0x561667=_0x8b6df8;logger[_0xfd8c('0x1d')]('['+_0xb283cf[_0xfd8c('0x7b')]['toUpperCase']()+_0xfd8c('0x7e'),_0x561667['id']);logger[_0xfd8c('0x1d')]('['+_0xb283cf[_0xfd8c('0x7b')]['toUpperCase']()+_0xfd8c('0x7f'),_0x57b8f0[_0xfd8c('0x3c')]);})[_0xfd8c('0x70')](function(_0x47d54a){logger[_0xfd8c('0x6e')]('['+_0xb283cf[_0xfd8c('0x7b')][_0xfd8c('0x7c')]()+']',_0x47d54a);});}; \ 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 ca9a3ba..d9724cb 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 _0x9fca=['ticketId','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','info','],\x20getAdminUser\x20crm','catch','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','sys_id','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','customField','nameField','toLowerCase','content','toString','includes','picklist','type','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','label','?sysparm_query=name%3D','length','Incident'];(function(_0x1371d9,_0x34b415){var _0x52134b=function(_0x2032ba){while(--_0x2032ba){_0x1371d9['push'](_0x1371d9['shift']());}};_0x52134b(++_0x34b415);}(_0x9fca,0x94));var _0xa9fc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9fca[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xa9fc('0x0'));var Promise=require(_0xa9fc('0x1'));var rp=require(_0xa9fc('0x2'));var util=require(_0xa9fc('0x3'));var md5=require(_0xa9fc('0x4'));var Redis=require('ioredis');var intUtil=require(_0xa9fc('0x5'));var config=require(_0xa9fc('0x6'));var logger=require(_0xa9fc('0x7'))('servicenow');config[_0xa9fc('0x8')]=_[_0xa9fc('0x9')](config[_0xa9fc('0x8')],{'host':_0xa9fc('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x57616a,_0x48a867,_0x2308c4,_0x237f0b,_0x27779f,_0x519c09){return new Promise(function(_0xcfdcb6,_0x61363d){var _0x465c12={'method':_0xa9fc('0xb'),'uri':_0x237f0b+_0xa9fc('0xc')+'&'+_0x27779f+'&'+_0x519c09,'auth':_0x48a867,'json':!![]};return rp(_0x465c12)['then'](function(_0x209182){if(_0x209182[_0xa9fc('0xd')]['length']>0x0){_0x2308c4[_0xa9fc('0xe')]=_0x209182['result'][0x0]['sys_id'];}logger[_0xa9fc('0xf')]('['+[_0x57616a['toUpperCase']()]+_0xa9fc('0x10'),_0x2308c4);_0xcfdcb6(_0x2308c4);})[_0xa9fc('0x11')](function(_0x5dd12b){logger['error']('['+[_0x57616a[_0xa9fc('0x12')]()]+']',_0x5dd12b['message']);_0x61363d(_0x5dd12b[_0xa9fc('0x13')]);});});}function getUser(_0x4b454c,_0x51d281,_0x1a8b0e,_0x514809,_0x38f930){return function(_0x495156){logger[_0xa9fc('0xf')]('['+[_0x4b454c[_0xa9fc('0x12')]()]+_0xa9fc('0x14'),_0x495156);return new Promise(function(_0x317c90,_0xb8c106){if(intUtil[_0xa9fc('0x15')](_0x495156[_0xa9fc('0x16')])){var _0x4e75de={'method':_0xa9fc('0xb'),'uri':_0x1a8b0e+_0xa9fc('0x17')+_0x495156[_0xa9fc('0x16')]+'&'+_0x514809+'&'+_0x38f930,'auth':_0x51d281,'json':!![]};logger[_0xa9fc('0xf')]('['+[_0x4b454c[_0xa9fc('0x12')]()]+_0xa9fc('0x18'),_0x4e75de);return rp(_0x4e75de)[_0xa9fc('0x19')](function(_0x27fc4f){logger[_0xa9fc('0xf')]('['+[_0x4b454c[_0xa9fc('0x12')]()]+_0xa9fc('0x1a'),_0x27fc4f);if(_0x27fc4f[_0xa9fc('0xd')]['length']>0x0&&String(_0x27fc4f[_0xa9fc('0xd')][0x0][_0xa9fc('0x1b')])===_0xa9fc('0x1c')){_0x495156[_0xa9fc('0x1d')]=_0x27fc4f[_0xa9fc('0xd')][0x0]['sys_id'];}else{_0x495156[_0xa9fc('0x1d')]=_0x495156['adminId'];_0x495156['userEmail']=_0x495156[_0xa9fc('0x1e')];}logger['info']('['+[_0x4b454c[_0xa9fc('0x12')]()]+_0xa9fc('0x1f'),_0x495156);_0x317c90(_0x495156);})[_0xa9fc('0x11')](function(_0x45005f){logger[_0xa9fc('0x20')]('['+[_0x4b454c[_0xa9fc('0x12')]()]+']',_0x45005f[_0xa9fc('0x13')]);_0xb8c106(_0x45005f['message']);});}else{logger[_0xa9fc('0xf')]('['+[_0x4b454c[_0xa9fc('0x12')]()]+_0xa9fc('0x21'));_0x495156['userId']=_0x495156[_0xa9fc('0xe')];_0x495156[_0xa9fc('0x16')]=_0x495156[_0xa9fc('0x1e')];_0x317c90(_0x495156);}});};}function createEndUser(_0x4fc522,_0x57f9e9,_0x171dc6,_0x42f576,_0xa34ee1){logger[_0xa9fc('0xf')]('['+[_0x4fc522['toUpperCase']()]+_0xa9fc('0x22'),_0x171dc6);return new Promise(function(_0x114017,_0x4af428){var _0x4d5f1b={'method':_0xa9fc('0x23'),'uri':_0x42f576+_0xa9fc('0x24')+_0xa34ee1,'body':{'user_name':_0x171dc6[_0xa9fc('0x25')],'roles':_0xa9fc('0x26'),'first_name':_0x171dc6[_0xa9fc('0x25')],'active':_0xa9fc('0x1c'),'date_format':_0xa9fc('0x27'),'phone':_0x171dc6[_0xa9fc('0x25')]},'auth':_0x57f9e9,'json':!![]};return rp(_0x4d5f1b)[_0xa9fc('0x19')](function(_0x1378a7){logger[_0xa9fc('0xf')]('['+[_0x4fc522['toUpperCase']()]+_0xa9fc('0x28'),_0x1378a7[_0xa9fc('0xd')]);_0x171dc6[_0xa9fc('0x29')]=_0x1378a7['result'][_0xa9fc('0x2a')];_0x114017(_0x171dc6);})[_0xa9fc('0x11')](function(_0x27646c){logger['error']('['+[_0x4fc522['toUpperCase']()]+']',_0x27646c['message']);_0x4af428(_0x27646c['message']);});});}function getEndUser(_0xd4f121,_0x741cf4,_0x4c71bd,_0x3489a4,_0x192d76){return function(_0x41e39a){logger[_0xa9fc('0xf')]('['+[_0xd4f121[_0xa9fc('0x12')]()]+_0xa9fc('0x2b'),_0x41e39a);return new Promise(function(_0x17f55a,_0x396c86){var _0x13efa6={'method':_0xa9fc('0xb'),'uri':_0x4c71bd+_0xa9fc('0x2c')+_0x41e39a['endUserNumber']+'&'+_0x3489a4+'&'+_0x192d76,'auth':_0x741cf4,'json':!![]};return rp(_0x13efa6)['then'](function(_0x6273ab){if(_0x6273ab[_0xa9fc('0xd')]['length']>0x0){_0x41e39a[_0xa9fc('0x29')]=_0x6273ab['result'][0x0][_0xa9fc('0x2a')];logger[_0xa9fc('0xf')]('['+[_0xd4f121[_0xa9fc('0x12')]()]+_0xa9fc('0x2d'),_0x41e39a);_0x17f55a(_0x41e39a);}else{return createEndUser(_0xd4f121,_0x741cf4,_0x41e39a,_0x4c71bd,_0x3489a4)['then'](function(_0x397183){logger['info']('['+[_0xd4f121['toUpperCase']()]+_0xa9fc('0x2e'),_0x397183);_0x17f55a(_0x397183);});}})[_0xa9fc('0x11')](function(_0xc72cef){logger[_0xa9fc('0x20')]('['+[_0xd4f121[_0xa9fc('0x12')]()]+']',_0xc72cef[_0xa9fc('0x13')]);_0x396c86(_0xc72cef['message']);});});};}function getCustomFields(_0x40b478,_0x4115dd){var _0x359f38={};if(_0x40b478['length']>0x0){_[_0xa9fc('0x2f')](_0x40b478,function(_0x5c53ca){if(_['includes'](['string','picklist'],_0x5c53ca['type'])&&_0x5c53ca['nameField']&&!_0x5c53ca[_0xa9fc('0x30')]){_0x359f38[_0x5c53ca[_0xa9fc('0x31')][_0xa9fc('0x32')]()]=_0x5c53ca[_0xa9fc('0x33')][_0xa9fc('0x34')]();}else if(_[_0xa9fc('0x35')](['string',_0xa9fc('0x36')],_0x5c53ca[_0xa9fc('0x37')])&&_0x5c53ca['idField']&&_0x5c53ca['customField']){_0x359f38[_0x5c53ca[_0xa9fc('0x38')][_0xa9fc('0x32')]()]=_0x5c53ca[_0xa9fc('0x33')]['toString']();}else if(_0x5c53ca['type']===_0xa9fc('0x39')&&_0x5c53ca['variableName']&&_0x5c53ca['idField']&&_0x5c53ca[_0xa9fc('0x30')]){_0x359f38[_0x5c53ca[_0xa9fc('0x38')][_0xa9fc('0x32')]()]=_0x4115dd[_0x5c53ca[_0xa9fc('0x3a')]][_0xa9fc('0x34')]();}else if(_0x5c53ca[_0xa9fc('0x37')]===_0xa9fc('0x3b')&&_0x5c53ca['Variable']&&_0x5c53ca[_0xa9fc('0x3c')][_0xa9fc('0x3d')]&&_0x5c53ca[_0xa9fc('0x38')]&&_0x5c53ca[_0xa9fc('0x30')]){_0x359f38[_0x5c53ca[_0xa9fc('0x38')][_0xa9fc('0x32')]()]=_0x4115dd[_0x5c53ca[_0xa9fc('0x3c')][_0xa9fc('0x3d')]['toLowerCase']()][_0xa9fc('0x34')]();}});}return _0x359f38;}function getTicket(_0x26f926,_0x3efb4d,_0x25b6d4,_0x38e4d0,_0x3e3b87,_0x1a2cbc){return function(_0x5e9988){logger[_0xa9fc('0xf')]('['+[_0x26f926[_0xa9fc('0x12')]()]+_0xa9fc('0x3e'),_0x5e9988);return new Promise(function(_0x375c78,_0x351c43){var _0x4e875a=_0x26f926['toLowerCase']()===_0xa9fc('0x3f')?_0x5e9988[_0xa9fc('0x1d')]:_0x5e9988[_0xa9fc('0x29')];var _0x189b4e={'method':'POST','uri':_0x25b6d4+_0xa9fc('0x40')+'?'+_0x1a2cbc,'body':Object[_0xa9fc('0x41')]({},{'active':'true','caller_id':_0x4e875a,'assigned_to':_0x5e9988['userId'],'short_description':intUtil[_0xa9fc('0x42')](_0x38e4d0['Subjects'],_0x3e3b87,'\x20'),'description':intUtil[_0xa9fc('0x42')](_0x38e4d0[_0xa9fc('0x43')],_0x3e3b87,'\x0a')},getCustomFields(_0x38e4d0['Fields'],_0x3e3b87)),'auth':_0x3efb4d,'json':!![]};return rp(_0x189b4e)['then'](function(_0x1dc176){logger[_0xa9fc('0xf')]('['+[_0x26f926[_0xa9fc('0x12')]()]+_0xa9fc('0x44'),_0x1dc176[_0xa9fc('0xd')]);_0x5e9988['ticketId']=_0x1dc176[_0xa9fc('0xd')]['sys_id'];_0x5e9988[_0xa9fc('0x45')]=_0x1dc176[_0xa9fc('0xd')]['number'];logger[_0xa9fc('0xf')]('['+[_0x26f926[_0xa9fc('0x12')]()]+']\x20getTicket\x20crm',_0x5e9988);_0x375c78(_0x5e9988);})[_0xa9fc('0x11')](function(_0x4b036b){logger['error']('['+[_0x26f926[_0xa9fc('0x12')]()]+']',_0x4b036b[_0xa9fc('0x13')]);_0x351c43(_0x4b036b[_0xa9fc('0x13')]);});});};}function createRemoteTag(_0xa3d2f5,_0x3dc65c,_0x5bca3a,_0x446854){return new Promise(function(_0x10429e,_0x54b6dd){var _0x6c5eca={'method':_0xa9fc('0x23'),'uri':_0x5bca3a+_0xa9fc('0x46')+'?'+_0x446854,'body':{'short_description':_0xa3d2f5,'global':!![],'active':!![],'name':_0xa3d2f5},'auth':_0x3dc65c,'json':!![]};return rp(_0x6c5eca)[_0xa9fc('0x19')](function(_0x17b025){var _0x32f0fa=_0x17b025[_0xa9fc('0xd')][_0xa9fc('0x2a')];_0x10429e(_0x32f0fa);});});}function getRemoteTag(_0x278422,_0x4d0fe4,_0x49d4a1,_0x70b57e,_0x3b3ace){return new Promise(function(_0x2aaabe,_0x26b110){var _0x2df8af={'method':_0xa9fc('0xb'),'uri':_0x49d4a1+_0xa9fc('0x46')+_0xa9fc('0x47')+_0x278422+'&'+_0x70b57e,'auth':_0x4d0fe4,'json':!![]};return rp(_0x2df8af)[_0xa9fc('0x19')](function(_0x1d6439){if(_0x1d6439[_0xa9fc('0xd')][_0xa9fc('0x48')]>0x0){var _0x88440b=_0x1d6439[_0xa9fc('0xd')][0x0][_0xa9fc('0x2a')];_0x2aaabe(_0x88440b);}else{return createRemoteTag(_0x278422,_0x4d0fe4,_0x49d4a1,_0x70b57e)['then'](function(_0x2de056){_0x2aaabe(_0x2de056);});}});});}function assignTagToIncident(_0x3da5a0,_0x13d6a3,_0x2f5266,_0x4a69b,_0x1b1286){return new Promise(function(_0x3462b8,_0x12660f){var _0x4e116b={'method':_0xa9fc('0x23'),'uri':_0x2f5266+'label_entry'+'?'+_0x1b1286,'body':{'label':_0x3da5a0,'table':_0xa9fc('0x40'),'id_type':_0xa9fc('0x49'),'table_key':_0x4a69b[_0xa9fc('0x4a')],'title':_0xa9fc('0x4b')+_0x4a69b[_0xa9fc('0x45')],'id_display':_0x4a69b[_0xa9fc('0x45')]},'auth':_0x13d6a3,'json':!![]};return rp(_0x4e116b)[_0xa9fc('0x19')](function(_0x475e4e){_0x3462b8();})[_0xa9fc('0x11')](function(){_0x3462b8();});});}function manageTags(_0x142467,_0x38381e,_0xfa2a1c,_0x16a753,_0x147af6,_0x32c496,_0x1ca1cb){return new Promise(function(_0x233642,_0x1c8722){var _0x4ad3aa=[];_0x38381e['forEach'](function(_0x107af2){_0x4ad3aa[_0xa9fc('0x4c')](getRemoteTag(_0x107af2,_0xfa2a1c,_0x16a753,_0x32c496,_0x1ca1cb));});return Promise['all'](_0x4ad3aa)[_0xa9fc('0x19')](function(_0x28669c){if(_0x28669c[_0xa9fc('0x48')]){logger[_0xa9fc('0xf')]('['+[_0x142467[_0xa9fc('0x12')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x28669c);var _0x23ff3e=[];_0x28669c[_0xa9fc('0x2f')](function(_0x5e8d9a){_0x23ff3e[_0xa9fc('0x4c')](assignTagToIncident(_0x5e8d9a,_0xfa2a1c,_0x16a753,_0x147af6,_0x32c496));});return Promise[_0xa9fc('0x4d')](_0x23ff3e)[_0xa9fc('0x19')](function(){_0x233642();})[_0xa9fc('0x11')](function(){_0x233642();});}else{_0x233642();}});});}function getTags(_0x4e9ed4,_0x5880df,_0x542e8a,_0x30b725,_0x20b42b,_0x41ea33){return function(_0x562a18){return new Promise(function(_0x5cc031,_0x1557e8){var _0x124b1c=[];var _0xa25ee1=_0x30b725[_0xa9fc('0x4e')];if(_0xa25ee1&&_0xa25ee1['length']>0x0){_0x124b1c=_[_0xa9fc('0x4f')](_0xa25ee1,_0xa9fc('0x3d'));}if(_0x124b1c[_0xa9fc('0x48')]>0x0){return manageTags(_0x4e9ed4,_0x124b1c,_0x5880df,_0x542e8a,_0x562a18,_0x20b42b,_0x41ea33)[_0xa9fc('0x19')](function(){_0x5cc031(_0x562a18);});}else{_0x5cc031(_0x562a18);}});};}function emit(_0x7cc8c7,_0x2f18ea,_0x3a9273){var _0x4215a3=_0xa9fc('0x50')+_0xa9fc('0x51')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xa9fc('0x52');var _0x4fdb93={'uri':_0x7cc8c7+_0xa9fc('0x53')+_0x3a9273+_0x4215a3};io['to'](util[_0xa9fc('0x54')](_0xa9fc('0x55'),_0x2f18ea))[_0xa9fc('0x56')](_0xa9fc('0x57'),_0x4fdb93);}exports['cs']=function(_0x98d447,_0x183eb5,_0x32e7fe,_0x20866d,_0x471cc2,_0xc9f3ef,_0x595455,_0x57aac3){var _0x440e03={};var _0x4de694={'user':_0xc9f3ef['username'],'pass':_0xc9f3ef[_0xa9fc('0x58')]};var _0x1d5284=_0xa9fc('0x59');var _0x4d411f=_0xa9fc('0x5a');_0xc9f3ef[_0xa9fc('0x5b')]=intUtil[_0xa9fc('0x5c')](_0xc9f3ef[_0xa9fc('0x5b')]);_0xc9f3ef[_0xa9fc('0x5d')]=intUtil[_0xa9fc('0x5c')](_0xc9f3ef[_0xa9fc('0x5d')]);var _0x56a616=util[_0xa9fc('0x54')]('%s/api/now/table/',_0xc9f3ef['remoteUri']);_0x440e03[_0xa9fc('0x16')]=!_['isNil'](_0x20866d)?_0x20866d[_0xa9fc('0x5e')]:null;_0x440e03['adminEmail']=_0xc9f3ef['email'];_0x440e03[_0xa9fc('0x25')]=_0x57aac3['toLowerCase']()===_0xa9fc('0x3f')?_0x183eb5['destcalleridnum']:_0x183eb5[_0xa9fc('0x5f')];_0x440e03[_0xa9fc('0x60')]=_0x57aac3===_0xa9fc('0x61')||_0x57aac3===_0xa9fc('0x62')?_0xa9fc('0x61'):'outbound';var _0x5c9be4=util[_0xa9fc('0x54')](_0xa9fc('0x63'),_0xc9f3ef[_0xa9fc('0x5d')],_0x183eb5[_0xa9fc('0x64')],md5(_0x183eb5[_0xa9fc('0x64')]));if(_0x471cc2&&_0x471cc2[_0xa9fc('0x65')]){logger[_0xa9fc('0xf')]('[QUEUE]',_0xa9fc('0x66'));_0x183eb5[_0xa9fc('0x67')]=_0x5c9be4;}else if(_0x595455&&_0x595455[_0xa9fc('0x68')]&&_0x595455[_0xa9fc('0x68')]!==_0xa9fc('0x69')){logger[_0xa9fc('0xf')](_0xa9fc('0x6a'),_0xa9fc('0x66'));_0x183eb5[_0xa9fc('0x67')]=_0x5c9be4;}else{_0x183eb5[_0xa9fc('0x67')]='';}return getAdminUser(_0x57aac3,_0x4de694,_0x440e03,_0x56a616,_0x4d411f,_0x1d5284)['then'](getUser(_0x57aac3,_0x4de694,_0x56a616,_0x4d411f,_0x1d5284))[_0xa9fc('0x19')](getEndUser(_0x57aac3,_0x4de694,_0x56a616,_0x4d411f,_0x1d5284))[_0xa9fc('0x19')](getTicket(_0x57aac3,_0x4de694,_0x56a616,_0x32e7fe,_0x183eb5,_0x4d411f))[_0xa9fc('0x19')](function(_0x5119c5){logger[_0xa9fc('0xf')](util[_0xa9fc('0x54')](_0xa9fc('0x6b'),_0x5119c5[_0xa9fc('0x4a')]));logger[_0xa9fc('0xf')](util[_0xa9fc('0x54')](_0xa9fc('0x6c'),_0x57aac3));if(_0x57aac3!==_0xa9fc('0x62')){logger[_0xa9fc('0xf')]('['+[_0x57aac3[_0xa9fc('0x12')]()]+']',_0xa9fc('0x6d'));emit(_0xc9f3ef[_0xa9fc('0x5b')],_0x20866d[_0xa9fc('0x3d')],_0x5119c5[_0xa9fc('0x4a')]);}})[_0xa9fc('0x11')](function(_0x214503){logger[_0xa9fc('0x20')]('['+[_0x57aac3[_0xa9fc('0x12')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xa9fc('0x6e')](_0x214503,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5f52=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','format','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','bluebird','request-promise','util','md5','../../../../config/environment','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','result','sys_id','info','toUpperCase','message','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail','],\x20getUser\x20crm','catch','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','then','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','push','all','map','%26sysparm_record_list%3Dactive%253Dtrue','user:%s','emit','trigger:browser:url','username','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','unmanaged'];(function(_0x5dc81f,_0x20eb12){var _0x3076c2=function(_0x236f27){while(--_0x236f27){_0x5dc81f['push'](_0x5dc81f['shift']());}};_0x3076c2(++_0x20eb12);}(_0x5f52,0x145));var _0x25f5=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0x5f52[_0x4a5494];return _0x57cbb5;};'use strict';var _=require(_0x25f5('0x0'));var Promise=require(_0x25f5('0x1'));var rp=require(_0x25f5('0x2'));var util=require(_0x25f5('0x3'));var md5=require(_0x25f5('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x25f5('0x5'));var logger=require('../../../../config/logger')('servicenow');config[_0x25f5('0x6')]=_[_0x25f5('0x7')](config[_0x25f5('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x25f5('0x8'))(new Redis(config['redis']));function getAdminUser(_0x3e4f41,_0x102197,_0x6aef32,_0x116f10,_0x31cb4d,_0x3c60b8){return new Promise(function(_0x5c2d5f,_0x209c2e){var _0x53ff61={'method':_0x25f5('0x9'),'uri':_0x116f10+_0x25f5('0xa')+'&'+_0x31cb4d+'&'+_0x3c60b8,'auth':_0x102197,'json':!![]};return rp(_0x53ff61)['then'](function(_0x1dac94){if(_0x1dac94['result'][_0x25f5('0xb')]>0x0){_0x6aef32[_0x25f5('0xc')]=_0x1dac94[_0x25f5('0xd')][0x0][_0x25f5('0xe')];}logger[_0x25f5('0xf')]('['+[_0x3e4f41[_0x25f5('0x10')]()]+'],\x20getAdminUser\x20crm',_0x6aef32);_0x5c2d5f(_0x6aef32);})['catch'](function(_0x445e02){logger['error']('['+[_0x3e4f41[_0x25f5('0x10')]()]+']',_0x445e02[_0x25f5('0x11')]);_0x209c2e(_0x445e02[_0x25f5('0x11')]);});});}function getUser(_0x4a3051,_0x30b986,_0x5c89b8,_0x5499d7,_0x376244){return function(_0x3fc203){logger[_0x25f5('0xf')]('['+[_0x4a3051[_0x25f5('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x3fc203);return new Promise(function(_0x376cc0,_0x224b8d){if(intUtil[_0x25f5('0x12')](_0x3fc203['userEmail'])){var _0xccde6a={'method':_0x25f5('0x9'),'uri':_0x5c89b8+_0x25f5('0x13')+_0x3fc203[_0x25f5('0x14')]+'&'+_0x5499d7+'&'+_0x376244,'auth':_0x30b986,'json':!![]};logger['info']('['+[_0x4a3051[_0x25f5('0x10')]()]+_0x25f5('0x15'),_0xccde6a);return rp(_0xccde6a)['then'](function(_0x29caa4){logger[_0x25f5('0xf')]('['+[_0x4a3051[_0x25f5('0x10')]()]+_0x25f5('0x16'),_0x29caa4);if(_0x29caa4['result'][_0x25f5('0xb')]>0x0&&String(_0x29caa4['result'][0x0]['active'])===_0x25f5('0x17')){_0x3fc203['userId']=_0x29caa4[_0x25f5('0xd')][0x0][_0x25f5('0xe')];}else{_0x3fc203[_0x25f5('0x18')]=_0x3fc203['adminId'];_0x3fc203[_0x25f5('0x14')]=_0x3fc203[_0x25f5('0x19')];}logger[_0x25f5('0xf')]('['+[_0x4a3051['toUpperCase']()]+_0x25f5('0x1a'),_0x3fc203);_0x376cc0(_0x3fc203);})[_0x25f5('0x1b')](function(_0x5f528b){logger[_0x25f5('0x1c')]('['+[_0x4a3051[_0x25f5('0x10')]()]+']',_0x5f528b[_0x25f5('0x11')]);_0x224b8d(_0x5f528b[_0x25f5('0x11')]);});}else{logger[_0x25f5('0xf')]('['+[_0x4a3051[_0x25f5('0x10')]()]+_0x25f5('0x1d'));_0x3fc203['userId']=_0x3fc203[_0x25f5('0xc')];_0x3fc203[_0x25f5('0x14')]=_0x3fc203[_0x25f5('0x19')];_0x376cc0(_0x3fc203);}});};}function createEndUser(_0x5a515f,_0x2651f7,_0x4c6d41,_0x49a034,_0x4fc6af){logger[_0x25f5('0xf')]('['+[_0x5a515f[_0x25f5('0x10')]()]+_0x25f5('0x1e'),_0x4c6d41);return new Promise(function(_0x285cab,_0x156b93){var _0x216fbe={'method':_0x25f5('0x1f'),'uri':_0x49a034+_0x25f5('0x20')+_0x4fc6af,'body':{'user_name':_0x4c6d41[_0x25f5('0x21')],'roles':_0x25f5('0x22'),'first_name':_0x4c6d41[_0x25f5('0x21')],'active':_0x25f5('0x17'),'date_format':'System','phone':_0x4c6d41[_0x25f5('0x21')]},'auth':_0x2651f7,'json':!![]};return rp(_0x216fbe)[_0x25f5('0x23')](function(_0x7c1d02){logger[_0x25f5('0xf')]('['+[_0x5a515f[_0x25f5('0x10')]()]+_0x25f5('0x24'),_0x7c1d02['result']);_0x4c6d41[_0x25f5('0x25')]=_0x7c1d02[_0x25f5('0xd')]['sys_id'];_0x285cab(_0x4c6d41);})['catch'](function(_0x5a060e){logger[_0x25f5('0x1c')]('['+[_0x5a515f[_0x25f5('0x10')]()]+']',_0x5a060e[_0x25f5('0x11')]);_0x156b93(_0x5a060e[_0x25f5('0x11')]);});});}function getEndUser(_0x4fa964,_0x374c36,_0x4f01fe,_0x505bb3,_0x39a7e1){return function(_0x1697c9){logger['info']('['+[_0x4fa964[_0x25f5('0x10')]()]+_0x25f5('0x26'),_0x1697c9);return new Promise(function(_0x14cfe2,_0x12ae46){var _0x3d21a9={'method':_0x25f5('0x9'),'uri':_0x4f01fe+_0x25f5('0x27')+_0x1697c9[_0x25f5('0x21')]+'&'+_0x505bb3+'&'+_0x39a7e1,'auth':_0x374c36,'json':!![]};return rp(_0x3d21a9)[_0x25f5('0x23')](function(_0x140bec){if(_0x140bec['result'][_0x25f5('0xb')]>0x0){_0x1697c9[_0x25f5('0x25')]=_0x140bec[_0x25f5('0xd')][0x0]['sys_id'];logger['info']('['+[_0x4fa964[_0x25f5('0x10')]()]+_0x25f5('0x28'),_0x1697c9);_0x14cfe2(_0x1697c9);}else{return createEndUser(_0x4fa964,_0x374c36,_0x1697c9,_0x4f01fe,_0x505bb3)[_0x25f5('0x23')](function(_0x587aec){logger[_0x25f5('0xf')]('['+[_0x4fa964[_0x25f5('0x10')]()]+_0x25f5('0x29'),_0x587aec);_0x14cfe2(_0x587aec);});}})[_0x25f5('0x1b')](function(_0x172663){logger[_0x25f5('0x1c')]('['+[_0x4fa964[_0x25f5('0x10')]()]+']',_0x172663[_0x25f5('0x11')]);_0x12ae46(_0x172663[_0x25f5('0x11')]);});});};}function getCustomFields(_0x192c2a,_0x2e66c7){var _0x4a0015={};if(_0x192c2a[_0x25f5('0xb')]>0x0){_[_0x25f5('0x2a')](_0x192c2a,function(_0x4501de){if(_[_0x25f5('0x2b')](['string',_0x25f5('0x2c')],_0x4501de[_0x25f5('0x2d')])&&_0x4501de[_0x25f5('0x2e')]&&!_0x4501de[_0x25f5('0x2f')]){_0x4a0015[_0x4501de[_0x25f5('0x2e')][_0x25f5('0x30')]()]=_0x4501de[_0x25f5('0x31')][_0x25f5('0x32')]();}else if(_['includes']([_0x25f5('0x33'),_0x25f5('0x2c')],_0x4501de[_0x25f5('0x2d')])&&_0x4501de[_0x25f5('0x34')]&&_0x4501de[_0x25f5('0x2f')]){_0x4a0015[_0x4501de[_0x25f5('0x34')][_0x25f5('0x30')]()]=_0x4501de[_0x25f5('0x31')][_0x25f5('0x32')]();}else if(_0x4501de[_0x25f5('0x2d')]===_0x25f5('0x35')&&_0x4501de[_0x25f5('0x36')]&&_0x4501de[_0x25f5('0x34')]&&_0x4501de[_0x25f5('0x2f')]){_0x4a0015[_0x4501de[_0x25f5('0x34')][_0x25f5('0x30')]()]=_0x2e66c7[_0x4501de[_0x25f5('0x36')]][_0x25f5('0x32')]();}else if(_0x4501de[_0x25f5('0x2d')]===_0x25f5('0x37')&&_0x4501de[_0x25f5('0x38')]&&_0x4501de[_0x25f5('0x38')][_0x25f5('0x39')]&&_0x4501de[_0x25f5('0x34')]&&_0x4501de[_0x25f5('0x2f')]){_0x4a0015[_0x4501de[_0x25f5('0x34')][_0x25f5('0x30')]()]=_0x2e66c7[_0x4501de['Variable']['name'][_0x25f5('0x30')]()][_0x25f5('0x32')]();}});}return _0x4a0015;}function getTicket(_0x4b6b35,_0x415794,_0x597dfa,_0x4407be,_0x381f56,_0x402eb6){return function(_0x35c3ce){logger[_0x25f5('0xf')]('['+[_0x4b6b35[_0x25f5('0x10')]()]+_0x25f5('0x3a'),_0x35c3ce);return new Promise(function(_0x3b9a3d,_0xd71472){var _0x579e48=_0x4b6b35[_0x25f5('0x30')]()===_0x25f5('0x3b')?_0x35c3ce[_0x25f5('0x18')]:_0x35c3ce[_0x25f5('0x25')];var _0x5b32c5={'method':_0x25f5('0x1f'),'uri':_0x597dfa+_0x25f5('0x3c')+'?'+_0x402eb6,'body':Object[_0x25f5('0x3d')]({},{'active':_0x25f5('0x17'),'caller_id':_0x579e48,'assigned_to':_0x35c3ce['userId'],'short_description':intUtil[_0x25f5('0x3e')](_0x4407be['Subjects'],_0x381f56,'\x20'),'description':intUtil[_0x25f5('0x3e')](_0x4407be[_0x25f5('0x3f')],_0x381f56,'\x0a')},getCustomFields(_0x4407be[_0x25f5('0x40')],_0x381f56)),'auth':_0x415794,'json':!![]};return rp(_0x5b32c5)[_0x25f5('0x23')](function(_0x1d6ad1){logger['info']('['+[_0x4b6b35[_0x25f5('0x10')]()]+_0x25f5('0x41'),_0x1d6ad1[_0x25f5('0xd')]);_0x35c3ce[_0x25f5('0x42')]=_0x1d6ad1[_0x25f5('0xd')]['sys_id'];_0x35c3ce[_0x25f5('0x43')]=_0x1d6ad1[_0x25f5('0xd')][_0x25f5('0x44')];logger[_0x25f5('0xf')]('['+[_0x4b6b35[_0x25f5('0x10')]()]+_0x25f5('0x45'),_0x35c3ce);_0x3b9a3d(_0x35c3ce);})[_0x25f5('0x1b')](function(_0x1e0566){logger[_0x25f5('0x1c')]('['+[_0x4b6b35['toUpperCase']()]+']',_0x1e0566['message']);_0xd71472(_0x1e0566[_0x25f5('0x11')]);});});};}function createRemoteTag(_0x26d4c7,_0x874d59,_0x55e43a,_0x46e93f){return new Promise(function(_0x2ad5fc,_0x1c8076){var _0x1f4249={'method':'POST','uri':_0x55e43a+_0x25f5('0x46')+'?'+_0x46e93f,'body':{'short_description':_0x26d4c7,'global':!![],'active':!![],'name':_0x26d4c7},'auth':_0x874d59,'json':!![]};return rp(_0x1f4249)['then'](function(_0x3f5b2c){var _0xfe6319=_0x3f5b2c['result'][_0x25f5('0xe')];_0x2ad5fc(_0xfe6319);});});}function getRemoteTag(_0x1fd2d4,_0x44238a,_0xeb67ce,_0x313946,_0x45e273){return new Promise(function(_0x5e9b3c,_0x22ce4e){var _0x1ef22d={'method':_0x25f5('0x9'),'uri':_0xeb67ce+'label'+_0x25f5('0x47')+_0x1fd2d4+'&'+_0x313946,'auth':_0x44238a,'json':!![]};return rp(_0x1ef22d)[_0x25f5('0x23')](function(_0x1bf16c){if(_0x1bf16c[_0x25f5('0xd')][_0x25f5('0xb')]>0x0){var _0x251897=_0x1bf16c[_0x25f5('0xd')][0x0][_0x25f5('0xe')];_0x5e9b3c(_0x251897);}else{return createRemoteTag(_0x1fd2d4,_0x44238a,_0xeb67ce,_0x313946)[_0x25f5('0x23')](function(_0x3e60dc){_0x5e9b3c(_0x3e60dc);});}});});}function assignTagToIncident(_0x5a1d89,_0x1210b0,_0x3b114d,_0x457dde,_0x8a4669){return new Promise(function(_0x2270a5,_0x3b61f7){var _0x5b4b20={'method':_0x25f5('0x1f'),'uri':_0x3b114d+'label_entry'+'?'+_0x8a4669,'body':{'label':_0x5a1d89,'table':'incident','id_type':'Incident','table_key':_0x457dde[_0x25f5('0x42')],'title':_0x25f5('0x48')+_0x457dde['ticketNumber'],'id_display':_0x457dde[_0x25f5('0x43')]},'auth':_0x1210b0,'json':!![]};return rp(_0x5b4b20)[_0x25f5('0x23')](function(_0x503ced){_0x2270a5();})[_0x25f5('0x1b')](function(){_0x2270a5();});});}function manageTags(_0x48e429,_0x270a73,_0x3b7d8c,_0x4b2ae0,_0x157334,_0x2f757a,_0x454b5c){return new Promise(function(_0x28c725,_0x2089b5){var _0x77d95b=[];_0x270a73[_0x25f5('0x2a')](function(_0x2df505){_0x77d95b[_0x25f5('0x49')](getRemoteTag(_0x2df505,_0x3b7d8c,_0x4b2ae0,_0x2f757a,_0x454b5c));});return Promise['all'](_0x77d95b)[_0x25f5('0x23')](function(_0x2b984f){if(_0x2b984f[_0x25f5('0xb')]){logger[_0x25f5('0xf')]('['+[_0x48e429[_0x25f5('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x2b984f);var _0x38d3ba=[];_0x2b984f[_0x25f5('0x2a')](function(_0x2e8db5){_0x38d3ba[_0x25f5('0x49')](assignTagToIncident(_0x2e8db5,_0x3b7d8c,_0x4b2ae0,_0x157334,_0x2f757a));});return Promise[_0x25f5('0x4a')](_0x38d3ba)['then'](function(){_0x28c725();})[_0x25f5('0x1b')](function(){_0x28c725();});}else{_0x28c725();}});});}function getTags(_0x1cdf36,_0xe73472,_0x35091b,_0x581a51,_0x406916,_0x215bfa){return function(_0x1efdcf){return new Promise(function(_0x403f6e,_0x39349f){var _0x12e26a=[];var _0x30bc84=_0x581a51['Tags'];if(_0x30bc84&&_0x30bc84[_0x25f5('0xb')]>0x0){_0x12e26a=_[_0x25f5('0x4b')](_0x30bc84,'name');}if(_0x12e26a[_0x25f5('0xb')]>0x0){return manageTags(_0x1cdf36,_0x12e26a,_0xe73472,_0x35091b,_0x1efdcf,_0x406916,_0x215bfa)[_0x25f5('0x23')](function(){_0x403f6e(_0x1efdcf);});}else{_0x403f6e(_0x1efdcf);}});};}function emit(_0x427570,_0x10ab94,_0x44e09c){var _0xbf2308='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x25f5('0x4c')+'%255EORDERBYDESCnumber';var _0x258f4d={'uri':_0x427570+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x44e09c+_0xbf2308};io['to'](util['format'](_0x25f5('0x4d'),_0x10ab94))[_0x25f5('0x4e')](_0x25f5('0x4f'),_0x258f4d);}exports['cs']=function(_0x2d4058,_0x2be57c,_0x61cf2b,_0x1d1422,_0x34015d,_0x5129d4,_0x1b7595,_0x426c64){var _0x3105bd={};var _0x24f69f={'user':_0x5129d4[_0x25f5('0x50')],'pass':_0x5129d4['password']};var _0x4c0f6c='sysparm_limit=1';var _0x719956='sysparm_display_value=true';_0x5129d4[_0x25f5('0x51')]=intUtil[_0x25f5('0x52')](_0x5129d4[_0x25f5('0x51')]);_0x5129d4[_0x25f5('0x53')]=intUtil['stripTrailingSlash'](_0x5129d4[_0x25f5('0x53')]);var _0x8be872=util['format'](_0x25f5('0x54'),_0x5129d4[_0x25f5('0x51')]);_0x3105bd[_0x25f5('0x14')]=!_[_0x25f5('0x55')](_0x1d1422)?_0x1d1422[_0x25f5('0x56')]:null;_0x3105bd['adminEmail']=_0x5129d4[_0x25f5('0x56')];_0x3105bd['endUserNumber']=_0x426c64[_0x25f5('0x30')]()===_0x25f5('0x3b')?_0x2be57c['destcalleridnum']:_0x2be57c[_0x25f5('0x57')];_0x3105bd[_0x25f5('0x58')]=_0x426c64===_0x25f5('0x59')||_0x426c64===_0x25f5('0x5a')?_0x25f5('0x59'):_0x25f5('0x3b');var _0x324904=util['format'](_0x25f5('0x5b'),_0x5129d4['serverUrl'],_0x2be57c[_0x25f5('0x5c')],md5(_0x2be57c[_0x25f5('0x5c')]));if(_0x34015d&&_0x34015d[_0x25f5('0x5d')]){logger['info'](_0x25f5('0x5e'),_0x25f5('0x5f'));_0x2be57c[_0x25f5('0x60')]=_0x324904;}else if(_0x1b7595&&_0x1b7595[_0x25f5('0x61')]&&_0x1b7595[_0x25f5('0x61')]!==_0x25f5('0x62')){logger[_0x25f5('0xf')](_0x25f5('0x63'),_0x25f5('0x5f'));_0x2be57c[_0x25f5('0x60')]=_0x324904;}else{_0x2be57c[_0x25f5('0x60')]='';}return getAdminUser(_0x426c64,_0x24f69f,_0x3105bd,_0x8be872,_0x719956,_0x4c0f6c)[_0x25f5('0x23')](getUser(_0x426c64,_0x24f69f,_0x8be872,_0x719956,_0x4c0f6c))[_0x25f5('0x23')](getEndUser(_0x426c64,_0x24f69f,_0x8be872,_0x719956,_0x4c0f6c))[_0x25f5('0x23')](getTicket(_0x426c64,_0x24f69f,_0x8be872,_0x61cf2b,_0x2be57c,_0x719956))['then'](function(_0x47fef6){logger['info'](util[_0x25f5('0x64')](_0x25f5('0x65'),_0x47fef6['ticketId']));logger[_0x25f5('0xf')](util['format'](_0x25f5('0x66'),_0x426c64));if(_0x426c64!==_0x25f5('0x5a')){logger['info']('['+[_0x426c64['toUpperCase']()]+']',_0x25f5('0x67'));emit(_0x5129d4[_0x25f5('0x51')],_0x1d1422[_0x25f5('0x39')],_0x47fef6[_0x25f5('0x42')]);}})[_0x25f5('0x1b')](function(_0x4d0b4d){logger[_0x25f5('0x1c')]('['+[_0x426c64[_0x25f5('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x4d0b4d,{'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 598aefe..b5a916f 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 _0x61b5=['calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','Outbound','Ticket\x20created!','contacts','user:%s','error','unmanaged','toUpperCase','The\x20Ticket\x20ID\x20is:','lastevent','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice','replace','parent_id','parent_name','direction','length','push','idField','variableName','JSON','Calls','apiKey','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','map','forEach','type','nameField','customField','toLowerCase','content','toString','string','custom_fields','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname'];(function(_0x428a56,_0x4356eb){var _0x2eaf4a=function(_0x475f00){while(--_0x475f00){_0x428a56['push'](_0x428a56['shift']());}};_0x2eaf4a(++_0x4356eb);}(_0x61b5,0x96));var _0x561b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x561b('0x0'));var rp=require('request-promise');var BPromise=require(_0x561b('0x1'));var md5=require(_0x561b('0x2'));var util=require(_0x561b('0x3'));var Redis=require(_0x561b('0x4'));var intUtil=require(_0x561b('0x5'));var config=require(_0x561b('0x6'));var logger=require(_0x561b('0x7'))(_0x561b('0x8'));config[_0x561b('0x9')]=_[_0x561b('0xa')](config['redis'],{'host':_0x561b('0xb'),'port':0x18eb});var io=require(_0x561b('0xc'))(new Redis(config[_0x561b('0x9')]));var def={'method':_0x561b('0xd'),'json':!![]};function emit(_0x569e03,_0x1c1f3a,_0xce4310){io['to'](_0x569e03)[_0x561b('0xe')](_0x1c1f3a,_0xce4310);}function getTicket(_0x22d099,_0x5dc736,_0x2cfa8d,_0x527115,_0x4c0b97,_0x13d711,_0x672dd2,_0x55b0bc){logger[_0x561b('0xf')](_0x561b('0x10'));var _0x340bcb=new Date();var _0x35658f=[{'name':_0x561b('0x11'),'value':intUtil['getString'](_0x527115[_0x561b('0x12')],_0x4c0b97,'\x20')},{'name':_0x561b('0x13'),'value':_0x5dc736['id']},{'name':_0x561b('0x14'),'value':_0x5dc736['id']},{'name':'description','value':intUtil['getString'](_0x527115[_0x561b('0x15')],_0x4c0b97,'\x0a')},{'name':_0x561b('0x16'),'value':_0x340bcb[_0x561b('0x17')]()[_0x561b('0x18')](0x0,0x13)[_0x561b('0x19')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x561b('0x1a'),'value':_0x2cfa8d['id']},{'name':'parent_type','value':'Contacts'},{'name':_0x561b('0x1b'),'value':_0x2cfa8d[_0x561b('0x11')]},{'name':_0x561b('0x1c'),'value':_0x55b0bc}];if(_0x13d711[_0x561b('0x1d')]){_['forEach'](_0x13d711,function(_0x5ec227){if(_0x4c0b97[_0x5ec227['variableName']]){_0x35658f[_0x561b('0x1e')]({'name':_0x5ec227[_0x561b('0x1f')],'value':_0x4c0b97[_0x5ec227[_0x561b('0x20')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x561b('0x21'),'response_type':_0x561b('0x21'),'rest_data':JSON['stringify']({'session':_0x672dd2['id'],'module_name':_0x561b('0x22'),'name_value_list':_0x35658f})}});}function getAuth(_0x4f27ed){return util['format']('Basic\x20%s',new Buffer(_0x4f27ed[_0x561b('0x23')]+':X')['toString']('base64'));}function getServerInfo(_0x21c68e){return request({'form':{'method':_0x561b('0x24'),'input_type':_0x561b('0x21'),'response_type':_0x561b('0x21'),'rest_data':JSON[_0x561b('0x25')]({'session':_0x21c68e['id']})}});}function getUser(_0x507ddb,_0x1d2fd7,_0x394cfc){if(!_[_0x561b('0x26')](_0x1d2fd7)){logger[_0x561b('0xf')](_0x561b('0x27'),_0x1d2fd7);return request({'form':{'method':_0x561b('0x28'),'input_type':_0x561b('0x21'),'response_type':_0x561b('0x21'),'rest_data':JSON[_0x561b('0x25')]({'session':_0x394cfc['id'],'module_name':_0x561b('0x29'),'query':util[_0x561b('0x2a')](_0x561b('0x2b'),_0x1d2fd7),'order_by':'','offset':'0','select_fields':['id',_0x561b('0x11'),_0x561b('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x561b('0x2d')](function(_0x21b9dd){if(_0x21b9dd[_0x561b('0x2e')][_0x561b('0x1d')]){var _0x301be4=_['find'](_0x21b9dd[_0x561b('0x2e')],function(_0x2275b4){return _0x2275b4['name_value_list'][_0x561b('0x2c')][_0x561b('0x2f')]===_0x1d2fd7;});if(_0x301be4){logger[_0x561b('0xf')](_0x561b('0x30'));return BPromise['resolve']({'id':_0x301be4['name_value_list']['id'][_0x561b('0x2f')],'name':_0x301be4[_0x561b('0x31')][_0x561b('0x11')][_0x561b('0x2f')]});}}logger[_0x561b('0xf')](_0x561b('0x32'));return BPromise[_0x561b('0x33')]({'id':_0x394cfc[_0x561b('0x31')][_0x561b('0x34')][_0x561b('0x2f')],'name':_0x394cfc[_0x561b('0x31')][_0x561b('0x2c')]['value']});});}else{logger['info'](_0x561b('0x35'));return BPromise[_0x561b('0x33')]({'id':_0x394cfc[_0x561b('0x31')][_0x561b('0x34')]['value'],'name':_0x394cfc[_0x561b('0x31')][_0x561b('0x2c')][_0x561b('0x2f')]});}}function getEndUser(_0x3d2db8,_0x2dba6f,_0x58ff94,_0x54faa8){logger[_0x561b('0xf')]('Searching\x20enduser\x20with\x20phone',_0x58ff94);return request({'form':{'method':_0x561b('0x28'),'input_type':_0x561b('0x21'),'response_type':'JSON','rest_data':JSON[_0x561b('0x25')]({'session':_0x54faa8['id'],'module_name':_0x561b('0x36'),'query':util[_0x561b('0x2a')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x58ff94),'order_by':'','offset':'0','select_fields':['id',_0x561b('0x11'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x561b('0x2d')](function(_0x232474){if(_0x232474[_0x561b('0x2e')][_0x561b('0x1d')]){var _0x578095=_[_0x561b('0x37')](_0x232474[_0x561b('0x2e')],function(_0x24a3a0){return _0x24a3a0[_0x561b('0x31')][_0x561b('0x38')][_0x561b('0x2f')]===_0x58ff94;});if(_0x578095){logger[_0x561b('0xf')](_0x561b('0x39'));return BPromise[_0x561b('0x33')]({'id':_0x578095[_0x561b('0x31')]['id']['value'],'name':_0x578095['name_value_list']['name'][_0x561b('0x2f')],'phone':_0x578095['name_value_list'][_0x561b('0x38')][_0x561b('0x2f')]});}}else{logger['info'](_0x561b('0x3a'));return request({'form':{'method':_0x561b('0x3b'),'input_type':_0x561b('0x21'),'response_type':_0x561b('0x21'),'rest_data':JSON[_0x561b('0x25')]({'session':_0x54faa8['id'],'module_name':_0x561b('0x36'),'name_value_list':[{'name':_0x561b('0x3c'),'value':_0x2dba6f!==''?_0x2dba6f:util[_0x561b('0x2a')](_0x561b('0x3d'),_0x58ff94)},{'name':_0x561b('0x38'),'value':_0x58ff94}]})}})[_0x561b('0x2d')](function(_0x273c35){logger[_0x561b('0xf')](_0x561b('0x3e'));return BPromise[_0x561b('0x33')]({'id':_0x273c35['id'],'name':_0x273c35['entry_list'][_0x561b('0x3c')][_0x561b('0x2f')],'phone':_0x273c35[_0x561b('0x2e')][_0x561b('0x38')][_0x561b('0x2f')]});});}});}function request(_0x4bfaa8){logger['debug'](_0x561b('0x3f'),JSON[_0x561b('0x25')](_0x4bfaa8));return rp(_['merge'](def,_0x4bfaa8));}function getTags(_0x13eb1a,_0x1f988d){var _0x1a7cda=[];if(_0x13eb1a&&_0x13eb1a[_0x561b('0x1d')]>0x0){_0x1a7cda=_[_0x561b('0x40')](_0x13eb1a,_0x1f988d);}return _0x1a7cda;}function getCustomFields(_0x1fea8f,_0x580013){var _0x330ed7=[];var _0x277a6c={'custom_fields':[]};if(_0x1fea8f['length']>0x0){_[_0x561b('0x41')](_0x1fea8f,function(_0x4aafa5){if(_0x4aafa5[_0x561b('0x42')]==='string'&&_0x4aafa5[_0x561b('0x43')]&&!_0x4aafa5[_0x561b('0x44')]){_0x277a6c[_0x4aafa5['nameField'][_0x561b('0x45')]()]=_0x4aafa5[_0x561b('0x46')][_0x561b('0x47')]();}else if(_0x4aafa5['type']===_0x561b('0x48')&&_0x4aafa5[_0x561b('0x1f')]&&_0x4aafa5[_0x561b('0x44')]){_0x277a6c[_0x561b('0x49')][_0x561b('0x1e')]({'id':_0x4aafa5[_0x561b('0x1f')],'value':_0x4aafa5['content'][_0x561b('0x47')]()});}else if(_0x4aafa5[_0x561b('0x42')]==='variable'&&_0x4aafa5[_0x561b('0x20')]&&_0x4aafa5[_0x561b('0x1f')]&&_0x4aafa5[_0x561b('0x44')]){_0x580013[_0x4aafa5['variableName']]&&_0x277a6c[_0x561b('0x49')][_0x561b('0x1e')]({'id':_0x4aafa5[_0x561b('0x1f')],'value':_0x580013[_0x4aafa5[_0x561b('0x20')]][_0x561b('0x47')]()});}else if(_0x4aafa5[_0x561b('0x42')]===_0x561b('0x4a')&&_0x4aafa5[_0x561b('0x4b')]&&_0x4aafa5[_0x561b('0x4b')][_0x561b('0x11')]&&_0x4aafa5['idField']&&_0x4aafa5[_0x561b('0x44')]){_0x580013[_0x4aafa5['Variable'][_0x561b('0x11')][_0x561b('0x45')]()]&&_0x277a6c['custom_fields'][_0x561b('0x1e')]({'id':_0x4aafa5[_0x561b('0x1f')],'value':_0x580013[_0x4aafa5[_0x561b('0x4b')][_0x561b('0x11')][_0x561b('0x45')]()][_0x561b('0x47')]()});}});}return _0x277a6c;}function getConnection(_0x414833){return request({'method':'POST','form':{'method':'login','input_type':_0x561b('0x21'),'response_type':_0x561b('0x21'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x414833[_0x561b('0x4c')],'password':_0x414833[_0x561b('0x4d')],'encryption':_0x561b('0x4e')},'application':_0x561b('0x4f')})}})['then'](function(_0x214210){var _0x4d1493=_0x214210;if(_0x4d1493['id']){def[_0x561b('0x50')]=_0x4d1493['id'];return BPromise[_0x561b('0x33')](_0x4d1493);}else{throw new Error(util[_0x561b('0x2a')](_0x561b('0x51'),_0x414833['id']));}});}function setRelationship(_0x4a9ed1,_0x5aa980,_0xffc4cd,_0x49c387){return request({'form':{'method':_0x561b('0x52'),'input_type':_0x561b('0x21'),'response_type':_0x561b('0x21'),'rest_data':JSON[_0x561b('0x25')]({'session':_0x4a9ed1['id'],'module_name':'Calls','module_id':_0xffc4cd['id'],'link_field_name':_0x49c387,'related_ids':[_0x5aa980['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x561b('0x53')]=function(_0x151100,_0x14973f,_0x1e4ec0,_0x58ab91,_0x12cddb,_0x44706e){var _0x8787ae,_0x1e8f7c,_0x3ee387,_0x34f913;_0x44706e[_0x561b('0x54')]=intUtil['stripTrailingSlash'](_0x44706e['remoteUri']);_0x44706e[_0x561b('0x55')]=intUtil['stripTrailingSlash'](_0x44706e[_0x561b('0x55')]);def[_0x561b('0x56')]=util[_0x561b('0x2a')](_0x561b('0x57'),_0x44706e[_0x561b('0x54')]);if(_0x12cddb&&_0x12cddb[_0x561b('0x58')]){logger[_0x561b('0xf')](_0x561b('0x59'),'Recording\x20is\x20enabled!');_0x14973f[_0x561b('0x5a')]=util[_0x561b('0x2a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44706e[_0x561b('0x55')],_0x14973f[_0x561b('0x5b')],md5(_0x14973f['uniqueid']));}else{_0x14973f[_0x561b('0x5a')]='';}return getConnection(_0x44706e)[_0x561b('0x2d')](function(_0x2ed709){_0x34f913=_0x2ed709;return getUser(_0x44706e,_0x58ab91[_0x561b('0x11')],_0x34f913);})[_0x561b('0x2d')](function(_0x460190){_0x8787ae=_0x460190;logger[_0x561b('0xf')](_0x561b('0x5c'),_0x8787ae['id']);return getEndUser(_0x44706e,_0x14973f[_0x561b('0x5d')],_0x14973f[_0x561b('0x5e')],_0x34f913);})[_0x561b('0x2d')](function(_0x4288c2){_0x1e8f7c=_0x4288c2;logger[_0x561b('0xf')](_0x561b('0x5f'),_0x1e8f7c['id']);return getTicket(_0x44706e,_0x8787ae,_0x1e8f7c,_0x1e4ec0,_0x14973f,_0x1e4ec0[_0x561b('0x60')],_0x34f913,_0x561b('0x61'));})[_0x561b('0x2d')](function(_0x59f863){_0x3ee387=_0x59f863;logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x3ee387['id']);return setRelationship(_0x34f913,_0x8787ae,_0x3ee387,_0x561b('0x62'));})[_0x561b('0x2d')](function(){return setRelationship(_0x34f913,_0x1e8f7c,_0x3ee387,'contacts');})[_0x561b('0x2d')](function(){return getServerInfo(_0x34f913);})['then'](function(_0x4143c0){var _0x48297f=parseInt(_0x4143c0[_0x561b('0x63')][_0x561b('0x64')](0x0));var _0x99e30f=util[_0x561b('0x2a')](_0x561b('0x65'),_0x44706e[_0x561b('0x54')],_0x3ee387['id']);if(_0x48297f>0x6){_0x99e30f=util[_0x561b('0x2a')](_0x561b('0x66'),_0x44706e[_0x561b('0x54')],_0x3ee387['id']);}logger['info']('[QUEUE]',_0x561b('0x67'));emit(util[_0x561b('0x2a')]('user:%s',_0x58ab91[_0x561b('0x11')]),_0x561b('0x68'),{'uri':_0x99e30f});})[_0x561b('0x69')](function(_0x5a9bca){logger['error'](_0x561b('0x59'),JSON[_0x561b('0x25')](_0x5a9bca));});};exports['outbound']=function(_0x136ec1,_0x419f9f,_0x2d0036,_0x571bce,_0x57b6f3,_0x5acbd4,_0x29959f){var _0x48f699,_0x32d34f,_0x322c26,_0x1c7f85;_0x5acbd4[_0x561b('0x54')]=intUtil[_0x561b('0x6a')](_0x5acbd4[_0x561b('0x54')]);_0x5acbd4['serverUrl']=intUtil[_0x561b('0x6a')](_0x5acbd4[_0x561b('0x55')]);def[_0x561b('0x56')]=util[_0x561b('0x2a')](_0x561b('0x57'),_0x5acbd4[_0x561b('0x54')]);if(_0x29959f&&_0x29959f[_0x561b('0x6b')]&&_0x29959f[_0x561b('0x6b')]!==_0x561b('0x6c')){logger['info'](_0x561b('0x6d'),_0x561b('0x6e'));_0x419f9f['recordingURL']=util['format'](_0x561b('0x6f'),_0x5acbd4[_0x561b('0x55')],_0x419f9f[_0x561b('0x5b')],md5(_0x419f9f['uniqueid']));}return getConnection(_0x5acbd4)[_0x561b('0x2d')](function(_0x2029a0){_0x1c7f85=_0x2029a0;return getUser(_0x5acbd4,_0x571bce[_0x561b('0x11')],_0x1c7f85);})['then'](function(_0x1da462){_0x48f699=_0x1da462;logger['info']('The\x20User\x20ID\x20is:',_0x48f699['id']);return getEndUser(_0x5acbd4,_0x419f9f[_0x561b('0x70')],_0x419f9f['destcalleridnum'],_0x1c7f85);})[_0x561b('0x2d')](function(_0x14bb65){_0x32d34f=_0x14bb65;logger[_0x561b('0xf')]('The\x20Enduser\x20ID\x20is:',_0x32d34f['id']);return getTicket(_0x5acbd4,_0x48f699,_0x32d34f,_0x2d0036,_0x419f9f,_0x2d0036[_0x561b('0x60')],_0x1c7f85,_0x561b('0x71'));})[_0x561b('0x2d')](function(_0xdd4a1a){_0x322c26=_0xdd4a1a;logger[_0x561b('0xf')](_0x561b('0x72'));logger[_0x561b('0xf')]('The\x20Ticket\x20ID\x20is:',_0x322c26['id']);return setRelationship(_0x1c7f85,_0x48f699,_0x322c26,_0x561b('0x62'));})[_0x561b('0x2d')](function(){return setRelationship(_0x1c7f85,_0x32d34f,_0x322c26,_0x561b('0x73'));})[_0x561b('0x2d')](function(){return getServerInfo(_0x1c7f85);})['then'](function(_0x3e2594){var _0x207df8=parseInt(_0x3e2594[_0x561b('0x63')][_0x561b('0x64')](0x0));var _0x5f40d9=util[_0x561b('0x2a')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x5acbd4[_0x561b('0x54')],_0x322c26['id']);if(_0x207df8>0x6){_0x5f40d9=util[_0x561b('0x2a')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5acbd4[_0x561b('0x54')],_0x322c26['id']);}logger[_0x561b('0xf')](_0x561b('0x6d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x561b('0x2a')](_0x561b('0x74'),_0x571bce['name']),_0x561b('0x68'),{'uri':_0x5f40d9});})[_0x561b('0x69')](function(_0x6e37aa){logger[_0x561b('0x75')](_0x561b('0x6d'),JSON[_0x561b('0x25')](_0x6e37aa));});};exports[_0x561b('0x76')]=function(_0x163046,_0xd95eac,_0x40bbfd,_0xe6fcf,_0x4d9646,_0x36d8a8){var _0x180717,_0x3303d4,_0x2a763a,_0xd45f82;_0x36d8a8[_0x561b('0x54')]=intUtil[_0x561b('0x6a')](_0x36d8a8['remoteUri']);_0x36d8a8[_0x561b('0x55')]=intUtil[_0x561b('0x6a')](_0x36d8a8[_0x561b('0x55')]);def['uri']=util[_0x561b('0x2a')]('%s/service/v4_1/rest.php',_0x36d8a8[_0x561b('0x54')]);if(_0x4d9646&&_0x4d9646[_0x561b('0x58')]){logger['info']('['+_0xd95eac['lastevent'][_0x561b('0x77')]()+']',_0x561b('0x6e'));_0xd95eac[_0x561b('0x5a')]=util[_0x561b('0x2a')](_0x561b('0x6f'),_0x36d8a8['serverUrl'],_0xd95eac['uniqueid'],md5(_0xd95eac[_0x561b('0x5b')]));}else{_0xd95eac[_0x561b('0x5a')]='';}return getConnection(_0x36d8a8)[_0x561b('0x2d')](function(_0x4ffc93){_0xd45f82=_0x4ffc93;if(!_[_0x561b('0x26')](_0xe6fcf)){return getUser(_0x36d8a8,_0xe6fcf[_0x561b('0x11')],_0xd45f82);}else{return getUser(_0x36d8a8,null,_0xd45f82);}})[_0x561b('0x2d')](function(_0x2344f1){_0x180717=_0x2344f1;logger['info'](_0x561b('0x5c'),_0x180717['id']);return getEndUser(_0x36d8a8,_0xd95eac['calleridname'],_0xd95eac[_0x561b('0x5e')],_0xd45f82);})[_0x561b('0x2d')](function(_0x4b1f94){_0x3303d4=_0x4b1f94;logger[_0x561b('0xf')](_0x561b('0x5f'),_0x3303d4['id']);return getTicket(_0x36d8a8,_0x180717,_0x3303d4,_0x40bbfd,_0xd95eac,_0x40bbfd[_0x561b('0x60')],_0xd45f82,_0x561b('0x61'));})['then'](function(_0x288bf5){_0x2a763a=_0x288bf5;logger[_0x561b('0xf')](_0x561b('0x72'));logger['info'](_0x561b('0x78'),_0x2a763a['id']);return setRelationship(_0xd45f82,_0x180717,_0x2a763a,_0x561b('0x62'));})[_0x561b('0x2d')](function(){return setRelationship(_0xd45f82,_0x3303d4,_0x2a763a,_0x561b('0x73'));})['then'](function(){return getServerInfo(_0xd45f82);})[_0x561b('0x69')](function(_0x3b229b){logger['error']('['+_0xd95eac[_0x561b('0x79')][_0x561b('0x77')]()+']',JSON[_0x561b('0x25')](_0x3b229b));});}; \ No newline at end of file +var _0xcf56=['parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','customField','nameField','toLowerCase','content','string','toString','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','user:%s','trigger:browser:url','catch','outbound','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','error','unmanaged','%s/service/v4_1/rest.php','lastevent','contacts','toUpperCase','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','Contacts'];(function(_0x45a136,_0x344e3b){var _0x343532=function(_0x5a6c4d){while(--_0x5a6c4d){_0x45a136['push'](_0x45a136['shift']());}};_0x343532(++_0x344e3b);}(_0xcf56,0x155));var _0x6cf5=function(_0x42d2e9,_0x584d03){_0x42d2e9=_0x42d2e9-0x0;var _0x17553a=_0xcf56[_0x42d2e9];return _0x17553a;};'use strict';var _=require('lodash');var rp=require(_0x6cf5('0x0'));var BPromise=require(_0x6cf5('0x1'));var md5=require(_0x6cf5('0x2'));var util=require('util');var Redis=require(_0x6cf5('0x3'));var intUtil=require(_0x6cf5('0x4'));var config=require(_0x6cf5('0x5'));var logger=require(_0x6cf5('0x6'))('sugarcrm');config[_0x6cf5('0x7')]=_['defaults'](config['redis'],{'host':_0x6cf5('0x8'),'port':0x18eb});var io=require(_0x6cf5('0x9'))(new Redis(config['redis']));var def={'method':_0x6cf5('0xa'),'json':!![]};function emit(_0x4db2c1,_0x13d481,_0x5f4125){io['to'](_0x4db2c1)['emit'](_0x13d481,_0x5f4125);}function getTicket(_0x20849c,_0x3c04bb,_0x53762b,_0x39ad96,_0x27c9f1,_0x1f98cf,_0xd4443c,_0x5cf4b8){logger[_0x6cf5('0xb')](_0x6cf5('0xc'));var _0x3d10a6=new Date();var _0x3654a2=[{'name':_0x6cf5('0xd'),'value':intUtil['getString'](_0x39ad96[_0x6cf5('0xe')],_0x27c9f1,'\x20')},{'name':_0x6cf5('0xf'),'value':_0x3c04bb['id']},{'name':_0x6cf5('0x10'),'value':_0x3c04bb['id']},{'name':_0x6cf5('0x11'),'value':intUtil['getString'](_0x39ad96[_0x6cf5('0x12')],_0x27c9f1,'\x0a')},{'name':_0x6cf5('0x13'),'value':_0x3d10a6[_0x6cf5('0x14')]()['slice'](0x0,0x13)[_0x6cf5('0x15')]('T','\x20')},{'name':_0x6cf5('0x16'),'value':'0'},{'name':_0x6cf5('0x17'),'value':'15'},{'name':'parent_id','value':_0x53762b['id']},{'name':'parent_type','value':_0x6cf5('0x18')},{'name':_0x6cf5('0x19'),'value':_0x53762b[_0x6cf5('0xd')]},{'name':_0x6cf5('0x1a'),'value':_0x5cf4b8}];if(_0x1f98cf['length']){_[_0x6cf5('0x1b')](_0x1f98cf,function(_0xccb4f2){if(_0x27c9f1[_0xccb4f2[_0x6cf5('0x1c')]]){_0x3654a2[_0x6cf5('0x1d')]({'name':_0xccb4f2[_0x6cf5('0x1e')],'value':_0x27c9f1[_0xccb4f2[_0x6cf5('0x1c')]]});}});}return request({'form':{'method':_0x6cf5('0x1f'),'input_type':_0x6cf5('0x20'),'response_type':_0x6cf5('0x20'),'rest_data':JSON[_0x6cf5('0x21')]({'session':_0xd4443c['id'],'module_name':_0x6cf5('0x22'),'name_value_list':_0x3654a2})}});}function getAuth(_0x57fd16){return util[_0x6cf5('0x23')](_0x6cf5('0x24'),new Buffer(_0x57fd16[_0x6cf5('0x25')]+':X')['toString'](_0x6cf5('0x26')));}function getServerInfo(_0x18c545){return request({'form':{'method':_0x6cf5('0x27'),'input_type':_0x6cf5('0x20'),'response_type':_0x6cf5('0x20'),'rest_data':JSON[_0x6cf5('0x21')]({'session':_0x18c545['id']})}});}function getUser(_0x2d6a73,_0xcbd1af,_0x561ca0){if(!_['isNil'](_0xcbd1af)){logger['info'](_0x6cf5('0x28'),_0xcbd1af);return request({'form':{'method':_0x6cf5('0x29'),'input_type':_0x6cf5('0x20'),'response_type':_0x6cf5('0x20'),'rest_data':JSON[_0x6cf5('0x21')]({'session':_0x561ca0['id'],'module_name':_0x6cf5('0x2a'),'query':util[_0x6cf5('0x23')](_0x6cf5('0x2b'),_0xcbd1af),'order_by':'','offset':'0','select_fields':['id',_0x6cf5('0xd'),_0x6cf5('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6cf5('0x2d')](function(_0x1abce6){if(_0x1abce6[_0x6cf5('0x2e')][_0x6cf5('0x2f')]){var _0x5a7001=_['find'](_0x1abce6[_0x6cf5('0x2e')],function(_0x4dfe53){return _0x4dfe53[_0x6cf5('0x30')][_0x6cf5('0x2c')]['value']===_0xcbd1af;});if(_0x5a7001){logger['info'](_0x6cf5('0x31'));return BPromise[_0x6cf5('0x32')]({'id':_0x5a7001[_0x6cf5('0x30')]['id']['value'],'name':_0x5a7001[_0x6cf5('0x30')][_0x6cf5('0xd')][_0x6cf5('0x33')]});}}logger[_0x6cf5('0xb')](_0x6cf5('0x34'));return BPromise['resolve']({'id':_0x561ca0['name_value_list'][_0x6cf5('0x35')]['value'],'name':_0x561ca0[_0x6cf5('0x30')]['user_name']['value']});});}else{logger[_0x6cf5('0xb')](_0x6cf5('0x36'));return BPromise[_0x6cf5('0x32')]({'id':_0x561ca0[_0x6cf5('0x30')][_0x6cf5('0x35')][_0x6cf5('0x33')],'name':_0x561ca0['name_value_list'][_0x6cf5('0x2c')]['value']});}}function getEndUser(_0x5c03f9,_0x23e854,_0x21abe6,_0x1f4b58){logger['info']('Searching\x20enduser\x20with\x20phone',_0x21abe6);return request({'form':{'method':'get_entry_list','input_type':_0x6cf5('0x20'),'response_type':_0x6cf5('0x20'),'rest_data':JSON[_0x6cf5('0x21')]({'session':_0x1f4b58['id'],'module_name':_0x6cf5('0x18'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x21abe6),'order_by':'','offset':'0','select_fields':['id',_0x6cf5('0xd'),_0x6cf5('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6cf5('0x2d')](function(_0x3b231a){if(_0x3b231a[_0x6cf5('0x2e')][_0x6cf5('0x2f')]){var _0x72bd6c=_['find'](_0x3b231a[_0x6cf5('0x2e')],function(_0x2b0f44){return _0x2b0f44[_0x6cf5('0x30')][_0x6cf5('0x37')][_0x6cf5('0x33')]===_0x21abe6;});if(_0x72bd6c){logger['info'](_0x6cf5('0x38'));return BPromise[_0x6cf5('0x32')]({'id':_0x72bd6c[_0x6cf5('0x30')]['id'][_0x6cf5('0x33')],'name':_0x72bd6c[_0x6cf5('0x30')]['name']['value'],'phone':_0x72bd6c[_0x6cf5('0x30')][_0x6cf5('0x37')][_0x6cf5('0x33')]});}}else{logger[_0x6cf5('0xb')](_0x6cf5('0x39'));return request({'form':{'method':_0x6cf5('0x1f'),'input_type':'JSON','response_type':_0x6cf5('0x20'),'rest_data':JSON['stringify']({'session':_0x1f4b58['id'],'module_name':_0x6cf5('0x18'),'name_value_list':[{'name':_0x6cf5('0x3a'),'value':_0x23e854!==_0x6cf5('0x3b')?_0x23e854:util[_0x6cf5('0x23')](_0x6cf5('0x3c'),_0x21abe6)},{'name':'phone_home','value':_0x21abe6}]})}})[_0x6cf5('0x2d')](function(_0x4f435a){logger[_0x6cf5('0xb')](_0x6cf5('0x3d'));return BPromise['resolve']({'id':_0x4f435a['id'],'name':_0x4f435a['entry_list'][_0x6cf5('0x3a')]['value'],'phone':_0x4f435a[_0x6cf5('0x2e')][_0x6cf5('0x37')][_0x6cf5('0x33')]});});}});}function request(_0x10c093){logger[_0x6cf5('0x3e')]('[HTTP]',JSON[_0x6cf5('0x21')](_0x10c093));return rp(_[_0x6cf5('0x3f')](def,_0x10c093));}function getTags(_0x1a1805,_0x2a5f0b){var _0x3fa223=[];if(_0x1a1805&&_0x1a1805[_0x6cf5('0x2f')]>0x0){_0x3fa223=_[_0x6cf5('0x40')](_0x1a1805,_0x2a5f0b);}return _0x3fa223;}function getCustomFields(_0xcf9e2f,_0x36b7c4){var _0x2bb7c7=[];var _0x59d523={'custom_fields':[]};if(_0xcf9e2f['length']>0x0){_[_0x6cf5('0x1b')](_0xcf9e2f,function(_0x2f946a){if(_0x2f946a[_0x6cf5('0x41')]==='string'&&_0x2f946a['nameField']&&!_0x2f946a[_0x6cf5('0x42')]){_0x59d523[_0x2f946a[_0x6cf5('0x43')][_0x6cf5('0x44')]()]=_0x2f946a[_0x6cf5('0x45')]['toString']();}else if(_0x2f946a[_0x6cf5('0x41')]===_0x6cf5('0x46')&&_0x2f946a[_0x6cf5('0x1e')]&&_0x2f946a['customField']){_0x59d523['custom_fields'][_0x6cf5('0x1d')]({'id':_0x2f946a[_0x6cf5('0x1e')],'value':_0x2f946a[_0x6cf5('0x45')][_0x6cf5('0x47')]()});}else if(_0x2f946a[_0x6cf5('0x41')]==='variable'&&_0x2f946a['variableName']&&_0x2f946a[_0x6cf5('0x1e')]&&_0x2f946a[_0x6cf5('0x42')]){_0x36b7c4[_0x2f946a[_0x6cf5('0x1c')]]&&_0x59d523[_0x6cf5('0x48')][_0x6cf5('0x1d')]({'id':_0x2f946a[_0x6cf5('0x1e')],'value':_0x36b7c4[_0x2f946a[_0x6cf5('0x1c')]][_0x6cf5('0x47')]()});}else if(_0x2f946a[_0x6cf5('0x41')]===_0x6cf5('0x49')&&_0x2f946a[_0x6cf5('0x4a')]&&_0x2f946a[_0x6cf5('0x4a')][_0x6cf5('0xd')]&&_0x2f946a[_0x6cf5('0x1e')]&&_0x2f946a[_0x6cf5('0x42')]){_0x36b7c4[_0x2f946a['Variable'][_0x6cf5('0xd')][_0x6cf5('0x44')]()]&&_0x59d523[_0x6cf5('0x48')][_0x6cf5('0x1d')]({'id':_0x2f946a[_0x6cf5('0x1e')],'value':_0x36b7c4[_0x2f946a[_0x6cf5('0x4a')][_0x6cf5('0xd')][_0x6cf5('0x44')]()]['toString']()});}});}return _0x59d523;}function getConnection(_0x193581){return request({'method':'POST','form':{'method':_0x6cf5('0x4b'),'input_type':_0x6cf5('0x20'),'response_type':_0x6cf5('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x193581[_0x6cf5('0x4c')],'password':_0x193581[_0x6cf5('0x4d')],'encryption':_0x6cf5('0x4e')},'application':_0x6cf5('0x4f')})}})[_0x6cf5('0x2d')](function(_0x248209){var _0x136873=_0x248209;if(_0x136873['id']){def[_0x6cf5('0x50')]=_0x136873['id'];return BPromise[_0x6cf5('0x32')](_0x136873);}else{throw new Error(util[_0x6cf5('0x23')](_0x6cf5('0x51'),_0x193581['id']));}});}function setRelationship(_0x565a64,_0x1d2fbd,_0x2cdd1e,_0x34a11b){return request({'form':{'method':_0x6cf5('0x52'),'input_type':_0x6cf5('0x20'),'response_type':'JSON','rest_data':JSON[_0x6cf5('0x21')]({'session':_0x565a64['id'],'module_name':_0x6cf5('0x22'),'module_id':_0x2cdd1e['id'],'link_field_name':_0x34a11b,'related_ids':[_0x1d2fbd['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6cf5('0x53')]=function(_0x9a7b20,_0x189ae1,_0x32e039,_0x538131,_0x3e5268,_0x41b058){var _0x5ae586,_0x1dd81d,_0x176649,_0x4c25a6;_0x41b058['remoteUri']=intUtil[_0x6cf5('0x54')](_0x41b058[_0x6cf5('0x55')]);_0x41b058[_0x6cf5('0x56')]=intUtil[_0x6cf5('0x54')](_0x41b058['serverUrl']);def[_0x6cf5('0x57')]=util[_0x6cf5('0x23')]('%s/service/v4_1/rest.php',_0x41b058[_0x6cf5('0x55')]);if(_0x3e5268&&_0x3e5268[_0x6cf5('0x58')]){logger[_0x6cf5('0xb')]('[QUEUE]',_0x6cf5('0x59'));_0x189ae1[_0x6cf5('0x5a')]=util[_0x6cf5('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x41b058['serverUrl'],_0x189ae1[_0x6cf5('0x5b')],md5(_0x189ae1['uniqueid']));}else{_0x189ae1[_0x6cf5('0x5a')]='';}return getConnection(_0x41b058)['then'](function(_0x39ce13){_0x4c25a6=_0x39ce13;return getUser(_0x41b058,_0x538131[_0x6cf5('0xd')],_0x4c25a6);})[_0x6cf5('0x2d')](function(_0x461e43){_0x5ae586=_0x461e43;logger[_0x6cf5('0xb')]('The\x20User\x20ID\x20is:',_0x5ae586['id']);return getEndUser(_0x41b058,_0x189ae1[_0x6cf5('0x5c')],_0x189ae1[_0x6cf5('0x5d')],_0x4c25a6);})['then'](function(_0x44c114){_0x1dd81d=_0x44c114;logger[_0x6cf5('0xb')](_0x6cf5('0x5e'),_0x1dd81d['id']);return getTicket(_0x41b058,_0x5ae586,_0x1dd81d,_0x32e039,_0x189ae1,_0x32e039[_0x6cf5('0x5f')],_0x4c25a6,_0x6cf5('0x60'));})['then'](function(_0x297394){_0x176649=_0x297394;logger['info'](_0x6cf5('0x61'));logger[_0x6cf5('0xb')](_0x6cf5('0x62'),_0x176649['id']);return setRelationship(_0x4c25a6,_0x5ae586,_0x176649,_0x6cf5('0x63'));})[_0x6cf5('0x2d')](function(){return setRelationship(_0x4c25a6,_0x1dd81d,_0x176649,'contacts');})[_0x6cf5('0x2d')](function(){return getServerInfo(_0x4c25a6);})[_0x6cf5('0x2d')](function(_0x260c7c){var _0x273089=parseInt(_0x260c7c[_0x6cf5('0x64')]['charAt'](0x0));var _0x523f8b=util[_0x6cf5('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x41b058[_0x6cf5('0x55')],_0x176649['id']);if(_0x273089>0x6){_0x523f8b=util[_0x6cf5('0x23')](_0x6cf5('0x65'),_0x41b058[_0x6cf5('0x55')],_0x176649['id']);}logger[_0x6cf5('0xb')](_0x6cf5('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6cf5('0x23')](_0x6cf5('0x67'),_0x538131[_0x6cf5('0xd')]),_0x6cf5('0x68'),{'uri':_0x523f8b});})[_0x6cf5('0x69')](function(_0x2f1dcf){logger['error'](_0x6cf5('0x66'),JSON[_0x6cf5('0x21')](_0x2f1dcf));});};exports[_0x6cf5('0x6a')]=function(_0x21ef46,_0x15ca34,_0x33dba5,_0x47fc20,_0xc82fc6,_0x39f251,_0x51ba31){var _0x4ff917,_0x3cadf1,_0x166521,_0x31dd93;_0x39f251['remoteUri']=intUtil['stripTrailingSlash'](_0x39f251[_0x6cf5('0x55')]);_0x39f251['serverUrl']=intUtil[_0x6cf5('0x54')](_0x39f251[_0x6cf5('0x56')]);def[_0x6cf5('0x57')]=util[_0x6cf5('0x23')]('%s/service/v4_1/rest.php',_0x39f251[_0x6cf5('0x55')]);if(_0x51ba31&&_0x51ba31['recordingFormat']&&_0x51ba31['recordingFormat']!==_0x6cf5('0x6b')){logger[_0x6cf5('0xb')](_0x6cf5('0x6c'),_0x6cf5('0x59'));_0x15ca34['recordingURL']=util[_0x6cf5('0x23')](_0x6cf5('0x6d'),_0x39f251[_0x6cf5('0x56')],_0x15ca34[_0x6cf5('0x5b')],md5(_0x15ca34[_0x6cf5('0x5b')]));}return getConnection(_0x39f251)[_0x6cf5('0x2d')](function(_0x5d6f90){_0x31dd93=_0x5d6f90;return getUser(_0x39f251,_0x47fc20[_0x6cf5('0xd')],_0x31dd93);})[_0x6cf5('0x2d')](function(_0x2ca327){_0x4ff917=_0x2ca327;logger[_0x6cf5('0xb')](_0x6cf5('0x6e'),_0x4ff917['id']);return getEndUser(_0x39f251,_0x15ca34[_0x6cf5('0x6f')],_0x15ca34[_0x6cf5('0x70')],_0x31dd93);})[_0x6cf5('0x2d')](function(_0x6c47a){_0x3cadf1=_0x6c47a;logger['info'](_0x6cf5('0x5e'),_0x3cadf1['id']);return getTicket(_0x39f251,_0x4ff917,_0x3cadf1,_0x33dba5,_0x15ca34,_0x33dba5[_0x6cf5('0x5f')],_0x31dd93,_0x6cf5('0x71'));})[_0x6cf5('0x2d')](function(_0x579a2b){_0x166521=_0x579a2b;logger[_0x6cf5('0xb')](_0x6cf5('0x61'));logger[_0x6cf5('0xb')]('The\x20Ticket\x20ID\x20is:',_0x166521['id']);return setRelationship(_0x31dd93,_0x4ff917,_0x166521,_0x6cf5('0x63'));})[_0x6cf5('0x2d')](function(){return setRelationship(_0x31dd93,_0x3cadf1,_0x166521,'contacts');})[_0x6cf5('0x2d')](function(){return getServerInfo(_0x31dd93);})[_0x6cf5('0x2d')](function(_0x34943c){var _0x39fc4b=parseInt(_0x34943c[_0x6cf5('0x64')][_0x6cf5('0x72')](0x0));var _0x1efb8d=util[_0x6cf5('0x23')](_0x6cf5('0x73'),_0x39f251[_0x6cf5('0x55')],_0x166521['id']);if(_0x39fc4b>0x6){_0x1efb8d=util[_0x6cf5('0x23')](_0x6cf5('0x65'),_0x39f251[_0x6cf5('0x55')],_0x166521['id']);}logger[_0x6cf5('0xb')](_0x6cf5('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6cf5('0x23')]('user:%s',_0x47fc20['name']),_0x6cf5('0x68'),{'uri':_0x1efb8d});})[_0x6cf5('0x69')](function(_0x3bfdc3){logger[_0x6cf5('0x74')](_0x6cf5('0x6c'),JSON[_0x6cf5('0x21')](_0x3bfdc3));});};exports[_0x6cf5('0x75')]=function(_0x6d73d2,_0x31e5e5,_0x4242ec,_0x1841e4,_0x24533a,_0x1f05f4){var _0x1c28e9,_0x5bd126,_0x15aa55,_0x28e7d1;_0x1f05f4['remoteUri']=intUtil[_0x6cf5('0x54')](_0x1f05f4[_0x6cf5('0x55')]);_0x1f05f4[_0x6cf5('0x56')]=intUtil['stripTrailingSlash'](_0x1f05f4['serverUrl']);def['uri']=util['format'](_0x6cf5('0x76'),_0x1f05f4[_0x6cf5('0x55')]);if(_0x24533a&&_0x24533a[_0x6cf5('0x58')]){logger[_0x6cf5('0xb')]('['+_0x31e5e5[_0x6cf5('0x77')]['toUpperCase']()+']',_0x6cf5('0x59'));_0x31e5e5[_0x6cf5('0x5a')]=util[_0x6cf5('0x23')](_0x6cf5('0x6d'),_0x1f05f4[_0x6cf5('0x56')],_0x31e5e5[_0x6cf5('0x5b')],md5(_0x31e5e5[_0x6cf5('0x5b')]));}else{_0x31e5e5[_0x6cf5('0x5a')]='';}return getConnection(_0x1f05f4)[_0x6cf5('0x2d')](function(_0x121d55){_0x28e7d1=_0x121d55;if(!_['isNil'](_0x1841e4)){return getUser(_0x1f05f4,_0x1841e4[_0x6cf5('0xd')],_0x28e7d1);}else{return getUser(_0x1f05f4,null,_0x28e7d1);}})[_0x6cf5('0x2d')](function(_0x369edf){_0x1c28e9=_0x369edf;logger['info'](_0x6cf5('0x6e'),_0x1c28e9['id']);return getEndUser(_0x1f05f4,_0x31e5e5[_0x6cf5('0x5c')],_0x31e5e5[_0x6cf5('0x5d')],_0x28e7d1);})[_0x6cf5('0x2d')](function(_0x4f3ea7){_0x5bd126=_0x4f3ea7;logger[_0x6cf5('0xb')](_0x6cf5('0x5e'),_0x5bd126['id']);return getTicket(_0x1f05f4,_0x1c28e9,_0x5bd126,_0x4242ec,_0x31e5e5,_0x4242ec['Fields'],_0x28e7d1,'Inbound');})[_0x6cf5('0x2d')](function(_0x28f43b){_0x15aa55=_0x28f43b;logger[_0x6cf5('0xb')](_0x6cf5('0x61'));logger[_0x6cf5('0xb')]('The\x20Ticket\x20ID\x20is:',_0x15aa55['id']);return setRelationship(_0x28e7d1,_0x1c28e9,_0x15aa55,_0x6cf5('0x63'));})[_0x6cf5('0x2d')](function(){return setRelationship(_0x28e7d1,_0x5bd126,_0x15aa55,_0x6cf5('0x78'));})[_0x6cf5('0x2d')](function(){return getServerInfo(_0x28e7d1);})[_0x6cf5('0x69')](function(_0x6d1ad){logger[_0x6cf5('0x74')]('['+_0x31e5e5[_0x6cf5('0x77')][_0x6cf5('0x79')]()+']',JSON[_0x6cf5('0x21')](_0x6d1ad));});}; \ 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 3b78c2e..3c5b062 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 _0x5475=['format','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','getString','length','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x5475,0x90));var _0x5547=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x5475[_0x403c20];return _0x2b271a;};'use strict';var _=require('lodash');var util=require('util');exports[_0x5547('0x0')]=function(_0x5a6cdf,_0x9cff5c,_0x44a3de){var _0x5bd771=[];if(_0x5a6cdf[_0x5547('0x1')]>0x0){var _0x1bfa12=_['sortBy'](_0x5a6cdf,['id']);for(var _0x2766a9=0x0;_0x2766a9<_0x1bfa12[_0x5547('0x1')];_0x2766a9++){var _0xd0a8bc=_0x1bfa12[_0x2766a9];if(_0xd0a8bc['type']===_0x5547('0x2')){_0x5bd771[_0x5547('0x3')](_0xd0a8bc[_0x5547('0x4')]);}else if(_0xd0a8bc[_0x5547('0x5')]===_0x5547('0x6')&&_0xd0a8bc[_0x5547('0x7')]){_0x9cff5c[_0xd0a8bc['variableName']]&&_0x5bd771[_0x5547('0x3')](_0x9cff5c[_0xd0a8bc[_0x5547('0x7')]][_0x5547('0x8')]());}else if(_0xd0a8bc[_0x5547('0x5')]===_0x5547('0x9')&&_0xd0a8bc[_0x5547('0xa')]&&_0xd0a8bc[_0x5547('0xa')][_0x5547('0xb')]){_0x9cff5c[_0xd0a8bc[_0x5547('0xa')][_0x5547('0xb')][_0x5547('0xc')]()]&&_0x5bd771[_0x5547('0x3')](_0x9cff5c[_0xd0a8bc[_0x5547('0xa')][_0x5547('0xb')]['toLowerCase']()][_0x5547('0x8')]());}else if(_0xd0a8bc[_0x5547('0x5')]===_0x5547('0xd')){if(_0xd0a8bc[_0x5547('0xe')]===_0x5547('0x2')&&_0xd0a8bc[_0x5547('0xf')]){_0x5bd771['push'](util['format'](_0x5547('0x10'),_0xd0a8bc[_0x5547('0xf')],_0xd0a8bc[_0x5547('0x11')]));}else if(_0xd0a8bc[_0x5547('0xe')]===_0x5547('0x6')&&_0xd0a8bc[_0x5547('0x7')]&&_0xd0a8bc[_0x5547('0xf')]){_0x9cff5c[_0xd0a8bc[_0x5547('0x7')]]&&_0x5bd771['push'](util[_0x5547('0x12')](_0x5547('0x10'),_0xd0a8bc['key'],_0x9cff5c[_0xd0a8bc[_0x5547('0x7')]]));}else if(_0xd0a8bc[_0x5547('0xe')]===_0x5547('0x9')&&_0xd0a8bc[_0x5547('0xa')]&&_0xd0a8bc[_0x5547('0xa')][_0x5547('0xb')]&&_0xd0a8bc[_0x5547('0xf')]){_0x9cff5c[_0xd0a8bc[_0x5547('0xa')][_0x5547('0xb')][_0x5547('0xc')]()]&&_0x5bd771[_0x5547('0x3')](util[_0x5547('0x12')](_0x5547('0x10'),_0xd0a8bc[_0x5547('0xf')],_0x9cff5c[_0xd0a8bc[_0x5547('0xa')]['name']['toLowerCase']()]));}}}}return _0x5bd771[_0x5547('0x13')](_0x44a3de);};exports[_0x5547('0x14')]=function(_0x12ae06){var _0xafb485=_0x12ae06[_0x5547('0x15')](-0x1);if(_0xafb485==='/'){_0x12ae06=_0x12ae06[_0x5547('0x16')](0x0,_0x12ae06[_0x5547('0x17')](_0xafb485));}return _0x12ae06;};exports[_0x5547('0x18')]=function(_0x571708){if(!_[_0x5547('0x19')](_0x571708)&&_0x571708!==''){var _0xa5491e=/^(([^<>()\[\]\\.,;:\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 _0xa5491e[_0x5547('0x1a')](String(_0x571708)[_0x5547('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x4f84=['keyContent','keyType','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','lodash','util','length','type','string','variable','variableName','push','customVariable','Variable','name','toLowerCase','toString','keyValue','key','format','%s:\x20%s'];(function(_0x1eaec1,_0x3d05c1){var _0x325690=function(_0x4a3260){while(--_0x4a3260){_0x1eaec1['push'](_0x1eaec1['shift']());}};_0x325690(++_0x3d05c1);}(_0x4f84,0x13f));var _0x44f8=function(_0x246890,_0x46b964){_0x246890=_0x246890-0x0;var _0x2b2a5a=_0x4f84[_0x246890];return _0x2b2a5a;};'use strict';var _=require(_0x44f8('0x0'));var util=require(_0x44f8('0x1'));exports['getString']=function(_0x5d806e,_0x243215,_0x466e7b){var _0x310dfc=[];if(_0x5d806e[_0x44f8('0x2')]>0x0){var _0x511131=_['sortBy'](_0x5d806e,['id']);for(var _0x14b1b3=0x0;_0x14b1b3<_0x511131[_0x44f8('0x2')];_0x14b1b3++){var _0x126240=_0x511131[_0x14b1b3];if(_0x126240[_0x44f8('0x3')]===_0x44f8('0x4')){_0x310dfc['push'](_0x126240['content']);}else if(_0x126240[_0x44f8('0x3')]===_0x44f8('0x5')&&_0x126240[_0x44f8('0x6')]){_0x243215[_0x126240[_0x44f8('0x6')]]&&_0x310dfc[_0x44f8('0x7')](_0x243215[_0x126240[_0x44f8('0x6')]]['toString']());}else if(_0x126240['type']===_0x44f8('0x8')&&_0x126240[_0x44f8('0x9')]&&_0x126240[_0x44f8('0x9')][_0x44f8('0xa')]){_0x243215[_0x126240[_0x44f8('0x9')][_0x44f8('0xa')][_0x44f8('0xb')]()]&&_0x310dfc[_0x44f8('0x7')](_0x243215[_0x126240[_0x44f8('0x9')][_0x44f8('0xa')][_0x44f8('0xb')]()][_0x44f8('0xc')]());}else if(_0x126240[_0x44f8('0x3')]===_0x44f8('0xd')){if(_0x126240['keyType']===_0x44f8('0x4')&&_0x126240[_0x44f8('0xe')]){_0x310dfc[_0x44f8('0x7')](util[_0x44f8('0xf')](_0x44f8('0x10'),_0x126240[_0x44f8('0xe')],_0x126240[_0x44f8('0x11')]));}else if(_0x126240['keyType']==='variable'&&_0x126240['variableName']&&_0x126240['key']){_0x243215[_0x126240['variableName']]&&_0x310dfc[_0x44f8('0x7')](util[_0x44f8('0xf')](_0x44f8('0x10'),_0x126240[_0x44f8('0xe')],_0x243215[_0x126240[_0x44f8('0x6')]]));}else if(_0x126240[_0x44f8('0x12')]===_0x44f8('0x8')&&_0x126240[_0x44f8('0x9')]&&_0x126240['Variable'][_0x44f8('0xa')]&&_0x126240[_0x44f8('0xe')]){_0x243215[_0x126240[_0x44f8('0x9')]['name'][_0x44f8('0xb')]()]&&_0x310dfc[_0x44f8('0x7')](util[_0x44f8('0xf')](_0x44f8('0x10'),_0x126240[_0x44f8('0xe')],_0x243215[_0x126240[_0x44f8('0x9')][_0x44f8('0xa')][_0x44f8('0xb')]()]));}}}}return _0x310dfc['join'](_0x466e7b);};exports[_0x44f8('0x13')]=function(_0x29477d){var _0x299f45=_0x29477d[_0x44f8('0x14')](-0x1);if(_0x299f45==='/'){_0x29477d=_0x29477d[_0x44f8('0x15')](0x0,_0x29477d[_0x44f8('0x16')](_0x299f45));}return _0x29477d;};exports[_0x44f8('0x17')]=function(_0x5cf370){if(!_['isNil'](_0x5cf370)&&_0x5cf370!==''){var _0x252edc=/^(([^<>()\[\]\\.,;:\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 _0x252edc['test'](String(_0x5cf370)[_0x44f8('0xb')]());}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 9573548..49a2e87 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(_0x3d1a62,_0x140c4b){var _0x5b3e36=function(_0x3a2449){while(--_0x3a2449){_0x3d1a62['push'](_0x3d1a62['shift']());}};_0x5b3e36(++_0x140c4b);}(_0xe706,0xa3));var _0x6e70=function(_0x45ea78,_0x31678e){_0x45ea78=_0x45ea78-0x0;var _0xd722b7=_0xe706[_0x45ea78];return _0xd722b7;};'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(_0x31abb7,_0x47a3ea){var _0x3cfed2=function(_0x15bec7){while(--_0x15bec7){_0x31abb7['push'](_0x31abb7['shift']());}};_0x3cfed2(++_0x47a3ea);}(_0xe706,0xa3));var _0x6e70=function(_0x1e920c,_0x2e73de){_0x1e920c=_0x1e920c-0x0;var _0x347799=_0xe706[_0x1e920c];return _0x347799;};'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 c3d09b2..dcc257c 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 _0xdab7=['calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','first','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','map','includes','string','picklist','nameField','content','type','idField','customField','custom_fields','variable','variableName','Variable','toLowerCase','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:'];(function(_0x3efcd5,_0x9bbba3){var _0x54e50a=function(_0x34d7f4){while(--_0x34d7f4){_0x3efcd5['push'](_0x3efcd5['shift']());}};_0x54e50a(++_0x9bbba3);}(_0xdab7,0x175));var _0x7dab=function(_0x22a30d,_0x105540){_0x22a30d=_0x22a30d-0x0;var _0x5788ee=_0xdab7[_0x22a30d];return _0x5788ee;};'use strict';var _=require(_0x7dab('0x0'));var rp=require(_0x7dab('0x1'));var md5=require(_0x7dab('0x2'));var util=require(_0x7dab('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7dab('0x4'));var config=require(_0x7dab('0x5'));var logger=require(_0x7dab('0x6'))(_0x7dab('0x7'));config[_0x7dab('0x8')]=_[_0x7dab('0x9')](config['redis'],{'host':_0x7dab('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7dab('0x8')]));function emit(_0x4b19b6,_0x346ccd,_0x4dfe65){io['to'](_0x4b19b6)[_0x7dab('0xb')](_0x346ccd,_0x4dfe65);}var headers={'Content-Type':_0x7dab('0xc'),'Accept':_0x7dab('0xc')};function getTicket(_0x4073da,_0x5e9b8f,_0x2936de,_0x4545b9,_0x44c3a8){logger[_0x7dab('0xd')](_0x7dab('0xe'));return request({'uri':util[_0x7dab('0xf')](_0x7dab('0x10'),_0x4073da[_0x7dab('0x11')]),'method':_0x7dab('0x12'),'body':{'ticket':_[_0x7dab('0x13')]({'requester_id':_0x2936de['id'],'submitter_id':_0x5e9b8f?_0x5e9b8f['id']:undefined,'assignee_id':_0x5e9b8f?_0x5e9b8f['id']:undefined,'tags':getTags(_0x4545b9[_0x7dab('0x14')],_0x7dab('0x15')),'subject':intUtil[_0x7dab('0x16')](_0x4545b9[_0x7dab('0x17')],_0x44c3a8,'\x20'),'description':intUtil[_0x7dab('0x16')](_0x4545b9['Descriptions'],_0x44c3a8,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7dab('0x16')](_0x4545b9[_0x7dab('0x18')],_0x44c3a8,'\x0a')}},getCustomFields(_0x4545b9[_0x7dab('0x19')],_0x44c3a8))}})['then'](function(_0x4b69ac){logger[_0x7dab('0xd')](_0x7dab('0x1a'));return _0x4b69ac['ticket'];});}function getUser(_0x2bfb80,_0x2f9536){if(intUtil['validateEmail'](_0x2f9536)){logger[_0x7dab('0xd')]('Getting\x20agent\x20with\x20email',_0x2f9536);return request({'uri':util['format'](_0x7dab('0x1b'),_0x2bfb80[_0x7dab('0x11')]),'qs':{'query':util['format'](_0x7dab('0x1c'),_0x2f9536)}})[_0x7dab('0x1d')](function(_0x18bb3a){if(_0x18bb3a[_0x7dab('0x1e')]){logger[_0x7dab('0xd')](_0x7dab('0x1f'));return _[_0x7dab('0x20')](_0x18bb3a[_0x7dab('0x21')],{'email':_0x2f9536,'role':_0x7dab('0x22')});}else{logger[_0x7dab('0xd')](_0x7dab('0x23'));return request({'uri':util[_0x7dab('0xf')](_0x7dab('0x24'),_0x2bfb80[_0x7dab('0x11')])})[_0x7dab('0x1d')](function(_0x4c0bb4){logger[_0x7dab('0xd')](_0x7dab('0x25'));return _0x4c0bb4[_0x7dab('0x26')];});}});}else{logger[_0x7dab('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7dab('0xf')](_0x7dab('0x24'),_0x2bfb80[_0x7dab('0x11')])})['then'](function(_0x4cd3d9){logger[_0x7dab('0xd')](_0x7dab('0x25'));return _0x4cd3d9[_0x7dab('0x26')];});}}function getEndUser(_0x595603,_0x40999e,_0x1948bb){logger[_0x7dab('0xd')](_0x7dab('0x27'),_0x1948bb);return request({'uri':util[_0x7dab('0xf')](_0x7dab('0x1b'),_0x595603[_0x7dab('0x11')]),'qs':{'query':util[_0x7dab('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x1948bb)}})[_0x7dab('0x1d')](function(_0x102f94){var _0x1dd781;if(_0x102f94[_0x7dab('0x21')][_0x7dab('0x28')]){_0x102f94[_0x7dab('0x21')]=_[_0x7dab('0x29')](_0x102f94[_0x7dab('0x21')],{'suspended':![],'role':'end-user'});if(_0x102f94[_0x7dab('0x21')][_0x7dab('0x28')]){_0x1dd781=_[_0x7dab('0x2a')](_0x102f94[_0x7dab('0x21')]);}}if(_0x1dd781){logger[_0x7dab('0xd')]('Enduser\x20found!');return _0x1dd781;}else{logger[_0x7dab('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7dab('0xf')](_0x7dab('0x2b'),_0x595603[_0x7dab('0x11')]),'method':_0x7dab('0x12'),'body':{'user':{'role':_0x7dab('0x2c'),'name':util[_0x7dab('0xf')](_0x7dab('0x2d'),_0x40999e||_0x1948bb),'phone':_0x1948bb}}})['then'](function(_0x358946){logger[_0x7dab('0xd')](_0x7dab('0x2e'));return _0x358946['user'];});}});}function getAuth(_0x2ad428){var _0x5400e7;if(_0x2ad428[_0x7dab('0x2f')]===_0x7dab('0x30')){_0x5400e7=util[_0x7dab('0xf')](_0x7dab('0x31'),_0x2ad428[_0x7dab('0x32')],_0x2ad428[_0x7dab('0x30')]);}else if(_0x2ad428['authType']===_0x7dab('0x33')){_0x5400e7=util[_0x7dab('0xf')](_0x7dab('0x34'),_0x2ad428[_0x7dab('0x32')],_0x2ad428['token']);}return util[_0x7dab('0xf')](_0x7dab('0x35'),new Buffer(_0x5400e7)[_0x7dab('0x36')](_0x7dab('0x37')));}function request(_0x1fdccb){logger['debug'](_0x7dab('0x38'),JSON['stringify'](_0x1fdccb));return rp(_['defaults'](_0x1fdccb,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1ee289,_0x2904a7){var _0x2ea015=[];if(_0x1ee289&&_0x1ee289[_0x7dab('0x28')]>0x0){_0x2ea015=_[_0x7dab('0x39')](_0x1ee289,_0x2904a7);}return _0x2ea015;}function getCustomFields(_0x262923,_0x198150){var _0x2e4a35=[];var _0x26b45b={'custom_fields':[]};if(_0x262923[_0x7dab('0x28')]>0x0){_['forEach'](_0x262923,function(_0x10076d){if(_[_0x7dab('0x3a')]([_0x7dab('0x3b'),_0x7dab('0x3c')],_0x10076d['type'])&&_0x10076d[_0x7dab('0x3d')]&&!_0x10076d['customField']){_0x26b45b[_0x10076d[_0x7dab('0x3d')]['toLowerCase']()]=_0x10076d[_0x7dab('0x3e')][_0x7dab('0x36')]();}else if(_[_0x7dab('0x3a')]([_0x7dab('0x3b'),_0x7dab('0x3c')],_0x10076d[_0x7dab('0x3f')])&&_0x10076d[_0x7dab('0x40')]&&_0x10076d[_0x7dab('0x41')]){_0x26b45b[_0x7dab('0x42')]['push']({'id':_0x10076d[_0x7dab('0x40')],'value':_0x10076d[_0x7dab('0x3e')]['toString']()});}else if(_0x10076d[_0x7dab('0x3f')]===_0x7dab('0x43')&&_0x10076d[_0x7dab('0x44')]&&_0x10076d[_0x7dab('0x40')]&&_0x10076d['customField']){_0x198150[_0x10076d[_0x7dab('0x44')]]&&_0x26b45b[_0x7dab('0x42')]['push']({'id':_0x10076d[_0x7dab('0x40')],'value':_0x198150[_0x10076d[_0x7dab('0x44')]]['toString']()});}else if(_0x10076d['type']==='customVariable'&&_0x10076d[_0x7dab('0x45')]&&_0x10076d[_0x7dab('0x45')][_0x7dab('0x15')]&&_0x10076d['idField']&&_0x10076d[_0x7dab('0x41')]){_0x198150[_0x10076d['Variable'][_0x7dab('0x15')][_0x7dab('0x46')]()]&&_0x26b45b[_0x7dab('0x42')][_0x7dab('0x47')]({'id':_0x10076d['idField'],'value':_0x198150[_0x10076d['Variable'][_0x7dab('0x15')][_0x7dab('0x46')]()][_0x7dab('0x36')]()});}});}return _0x26b45b;}exports[_0x7dab('0x48')]=function(_0x431ec9,_0x1e96d0,_0x53d566,_0x41d83e,_0x33750d,_0x29142d){var _0xd82263,_0x1bb5c2;_0x29142d['remoteUri']=intUtil[_0x7dab('0x49')](_0x29142d[_0x7dab('0x11')]);_0x29142d['serverUrl']=intUtil['stripTrailingSlash'](_0x29142d[_0x7dab('0x4a')]);if(_0x33750d&&_0x33750d[_0x7dab('0x4b')]){logger['info'](_0x7dab('0x4c'),_0x7dab('0x4d'));_0x1e96d0[_0x7dab('0x4e')]=util[_0x7dab('0xf')](_0x7dab('0x4f'),_0x29142d[_0x7dab('0x4a')],_0x1e96d0['uniqueid'],md5(_0x1e96d0['uniqueid']));}else{_0x1e96d0[_0x7dab('0x4e')]='';}headers[_0x7dab('0x50')]=getAuth(_0x29142d);return getUser(_0x29142d,_0x41d83e[_0x7dab('0x51')])['then'](function(_0x475d06){_0xd82263=_0x475d06;logger[_0x7dab('0xd')](_0x7dab('0x52'),_0xd82263['id']);return getEndUser(_0x29142d,_0x1e96d0[_0x7dab('0x53')],_0x1e96d0[_0x7dab('0x54')]);})[_0x7dab('0x1d')](function(_0x45340e){_0x1bb5c2=_0x45340e;logger[_0x7dab('0xd')](_0x7dab('0x55'),_0x1bb5c2['id']);return getTicket(_0x29142d,_0xd82263,_0x1bb5c2,_0x53d566,_0x1e96d0);})[_0x7dab('0x1d')](function(_0x4ff41d){if(_0x4ff41d){logger[_0x7dab('0xd')](_0x7dab('0x56'),_0x4ff41d['id']);switch(_0x29142d['type']){case _0x7dab('0x57'):logger['info'](_0x7dab('0x4c'),_0x7dab('0x58'));return request({'uri':util[_0x7dab('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x29142d[_0x7dab('0x11')],_0xd82263['id'],_0x4ff41d['id']),'method':_0x7dab('0x12')});case _0x7dab('0x59'):logger[_0x7dab('0xd')](_0x7dab('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7dab('0xf')](_0x7dab('0x5a'),_0x41d83e['name']),_0x7dab('0x5b'),{'uri':util[_0x7dab('0xf')](_0x7dab('0x5c'),_0x29142d[_0x7dab('0x11')][_0x7dab('0x5d')](_0x7dab('0x5e'),''),_0x4ff41d['id'])});break;default:logger['error'](_0x7dab('0x4c'),_0x7dab('0x5f'));}}})['catch'](function(_0x41445a){logger[_0x7dab('0x60')](_0x7dab('0x61'),util[_0x7dab('0x62')](_0x41445a,{'showHidden':!![],'depth':null}));});};exports[_0x7dab('0x63')]=function(_0x19e01a,_0x51c456,_0x164bfe,_0x219604,_0x1397df,_0x24a985,_0x2a2964){var _0xc14968,_0x534681;_0x24a985[_0x7dab('0x11')]=intUtil[_0x7dab('0x49')](_0x24a985[_0x7dab('0x11')]);_0x24a985[_0x7dab('0x4a')]=intUtil[_0x7dab('0x49')](_0x24a985[_0x7dab('0x4a')]);if(_0x2a2964&&_0x2a2964[_0x7dab('0x64')]&&_0x2a2964['recordingFormat']!==_0x7dab('0x65')){logger[_0x7dab('0xd')]('[OUTBOUND]',_0x7dab('0x4d'));_0x51c456[_0x7dab('0x4e')]=util[_0x7dab('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x24a985[_0x7dab('0x4a')],_0x51c456[_0x7dab('0x66')],md5(_0x51c456[_0x7dab('0x66')]));}headers[_0x7dab('0x50')]=getAuth(_0x24a985);return getUser(_0x24a985,_0x219604[_0x7dab('0x51')])[_0x7dab('0x1d')](function(_0x2dcce4){_0xc14968=_0x2dcce4;logger['info']('The\x20User\x20ID\x20is:',_0xc14968['id']);return getEndUser(_0x24a985,_0x51c456[_0x7dab('0x67')],_0x51c456[_0x7dab('0x68')]);})['then'](function(_0x1f3367){_0x534681=_0x1f3367;logger[_0x7dab('0xd')](_0x7dab('0x55'),_0x534681['id']);return getTicket(_0x24a985,_0xc14968,_0x534681,_0x164bfe,_0x51c456);})['then'](function(_0x356628){if(_0x356628){logger['info'](_0x7dab('0x56'),_0x356628['id']);switch(_0x24a985[_0x7dab('0x3f')]){case _0x7dab('0x57'):logger['info'](_0x7dab('0x69'),_0x7dab('0x58'));return request({'uri':util['format'](_0x7dab('0x6a'),_0x24a985[_0x7dab('0x11')],_0xc14968['id'],_0x356628['id']),'method':_0x7dab('0x12')});case _0x7dab('0x59'):logger['info']('[OUTBOUND]',_0x7dab('0x6b'));emit(util[_0x7dab('0xf')]('user:%s',_0x219604['name']),_0x7dab('0x5b'),{'uri':util['format'](_0x7dab('0x5c'),_0x24a985[_0x7dab('0x11')][_0x7dab('0x5d')](_0x7dab('0x5e'),''),_0x356628['id'])});break;default:logger[_0x7dab('0x60')](_0x7dab('0x69'),_0x7dab('0x5f'));}}})[_0x7dab('0x6c')](function(_0x227c98){logger[_0x7dab('0x60')](_0x7dab('0x6d'),util['inspect'](_0x227c98,{'showHidden':!![],'depth':null}));});};exports[_0x7dab('0x6e')]=function(_0x1f45cd,_0x3f350e,_0x5a056a,_0x5d6cf3,_0x1c82d8,_0x24c1ff){var _0x49e2ac,_0x2bd5a9;_0x24c1ff[_0x7dab('0x11')]=intUtil[_0x7dab('0x49')](_0x24c1ff[_0x7dab('0x11')]);_0x24c1ff[_0x7dab('0x4a')]=intUtil['stripTrailingSlash'](_0x24c1ff['serverUrl']);if(_0x1c82d8&&_0x1c82d8[_0x7dab('0x4b')]){logger['info']('['+_0x3f350e[_0x7dab('0x6f')][_0x7dab('0x70')]()+']',_0x7dab('0x4d'));_0x3f350e[_0x7dab('0x4e')]=util[_0x7dab('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x24c1ff[_0x7dab('0x4a')],_0x3f350e[_0x7dab('0x66')],md5(_0x3f350e['uniqueid']));}else{_0x3f350e[_0x7dab('0x4e')]='';}headers[_0x7dab('0x50')]=getAuth(_0x24c1ff);return getUser(_0x24c1ff)[_0x7dab('0x1d')](function(_0x3f8e82){_0x49e2ac=_0x3f8e82;logger[_0x7dab('0xd')](_0x7dab('0x52'),_0x49e2ac['id']);return getEndUser(_0x24c1ff,_0x3f350e['calleridname'],_0x3f350e['calleridnum']);})[_0x7dab('0x1d')](function(_0x34296e){_0x2bd5a9=_0x34296e;logger[_0x7dab('0xd')](_0x7dab('0x55'),_0x2bd5a9['id']);return getTicket(_0x24c1ff,_0x49e2ac,_0x2bd5a9,_0x5a056a,_0x3f350e);})['then'](function(_0x39b6b3){if(_0x39b6b3){logger[_0x7dab('0xd')](_0x7dab('0x56'),_0x39b6b3['id']);}})[_0x7dab('0x6c')](function(_0x567774){logger[_0x7dab('0x60')]('['+_0x3f350e[_0x7dab('0x6f')]['toUpperCase']()+']'+_0x7dab('0x71'),util[_0x7dab('0x62')](_0x567774,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x39cb=['find','agent','%s/users/me.json','Admin\x20account\x20selected.','user','then','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','password','%s:%s','username','token','%s/token:%s','toString','base64','[HTTP]','GET','forEach','string','picklist','nameField','customField','toLowerCase','type','idField','custom_fields','push','content','variable','variableName','Variable','name','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','email','destcalleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','info','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x39cb,0x19a));var _0xb39c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x39cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb39c('0x0'));var rp=require(_0xb39c('0x1'));var md5=require(_0xb39c('0x2'));var util=require('util');var Redis=require(_0xb39c('0x3'));var intUtil=require(_0xb39c('0x4'));var config=require('../../../../config/environment');var logger=require(_0xb39c('0x5'))('zendesk');config[_0xb39c('0x6')]=_[_0xb39c('0x7')](config[_0xb39c('0x6')],{'host':_0xb39c('0x8'),'port':0x18eb});var io=require(_0xb39c('0x9'))(new Redis(config['redis']));function emit(_0x4bc632,_0x45f7dc,_0x3c776d){io['to'](_0x4bc632)[_0xb39c('0xa')](_0x45f7dc,_0x3c776d);}var headers={'Content-Type':_0xb39c('0xb'),'Accept':_0xb39c('0xb')};function getTicket(_0x21097a,_0x20593e,_0x506d46,_0x503ecd,_0x41f840){logger['info'](_0xb39c('0xc'));return request({'uri':util[_0xb39c('0xd')](_0xb39c('0xe'),_0x21097a[_0xb39c('0xf')]),'method':_0xb39c('0x10'),'body':{'ticket':_[_0xb39c('0x11')]({'requester_id':_0x506d46['id'],'submitter_id':_0x20593e?_0x20593e['id']:undefined,'assignee_id':_0x20593e?_0x20593e['id']:undefined,'tags':getTags(_0x503ecd[_0xb39c('0x12')],'name'),'subject':intUtil[_0xb39c('0x13')](_0x503ecd[_0xb39c('0x14')],_0x41f840,'\x20'),'description':intUtil[_0xb39c('0x13')](_0x503ecd[_0xb39c('0x15')],_0x41f840,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb39c('0x13')](_0x503ecd['Descriptions'],_0x41f840,'\x0a')}},getCustomFields(_0x503ecd[_0xb39c('0x16')],_0x41f840))}})['then'](function(_0x173a82){logger[_0xb39c('0x17')](_0xb39c('0x18'));return _0x173a82['ticket'];});}function getUser(_0x203aef,_0x3b3951){if(intUtil[_0xb39c('0x19')](_0x3b3951)){logger[_0xb39c('0x17')](_0xb39c('0x1a'),_0x3b3951);return request({'uri':util['format']('%s/search.json',_0x203aef[_0xb39c('0xf')]),'qs':{'query':util['format'](_0xb39c('0x1b'),_0x3b3951)}})['then'](function(_0x2afdba){if(_0x2afdba[_0xb39c('0x1c')]){logger[_0xb39c('0x17')](_0xb39c('0x1d'));return _[_0xb39c('0x1e')](_0x2afdba['results'],{'email':_0x3b3951,'role':_0xb39c('0x1f')});}else{logger[_0xb39c('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb39c('0xd')](_0xb39c('0x20'),_0x203aef[_0xb39c('0xf')])})['then'](function(_0x18a005){logger[_0xb39c('0x17')](_0xb39c('0x21'));return _0x18a005[_0xb39c('0x22')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb39c('0xd')](_0xb39c('0x20'),_0x203aef['remoteUri'])})[_0xb39c('0x23')](function(_0x149dc1){logger[_0xb39c('0x17')](_0xb39c('0x21'));return _0x149dc1[_0xb39c('0x22')];});}}function getEndUser(_0x3f9d29,_0x442ec7,_0x163efc){logger[_0xb39c('0x17')](_0xb39c('0x24'),_0x163efc);return request({'uri':util[_0xb39c('0xd')](_0xb39c('0x25'),_0x3f9d29[_0xb39c('0xf')]),'qs':{'query':util[_0xb39c('0xd')](_0xb39c('0x26'),_0x163efc)}})[_0xb39c('0x23')](function(_0x492a8d){var _0x12d3fd;if(_0x492a8d[_0xb39c('0x27')][_0xb39c('0x28')]){_0x492a8d[_0xb39c('0x27')]=_[_0xb39c('0x29')](_0x492a8d['results'],{'suspended':![],'role':_0xb39c('0x2a')});if(_0x492a8d[_0xb39c('0x27')][_0xb39c('0x28')]){_0x12d3fd=_[_0xb39c('0x2b')](_0x492a8d[_0xb39c('0x27')]);}}if(_0x12d3fd){logger[_0xb39c('0x17')](_0xb39c('0x2c'));return _0x12d3fd;}else{logger['info'](_0xb39c('0x2d'));return request({'uri':util[_0xb39c('0xd')](_0xb39c('0x2e'),_0x3f9d29['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xb39c('0xd')]('Caller\x20-\x20%s',_0x442ec7||_0x163efc),'phone':_0x163efc}}})[_0xb39c('0x23')](function(_0x168aa1){logger[_0xb39c('0x17')]('Enduser\x20created.');return _0x168aa1[_0xb39c('0x22')];});}});}function getAuth(_0x37be0d){var _0x33957a;if(_0x37be0d['authType']===_0xb39c('0x2f')){_0x33957a=util[_0xb39c('0xd')](_0xb39c('0x30'),_0x37be0d[_0xb39c('0x31')],_0x37be0d[_0xb39c('0x2f')]);}else if(_0x37be0d['authType']===_0xb39c('0x32')){_0x33957a=util[_0xb39c('0xd')](_0xb39c('0x33'),_0x37be0d[_0xb39c('0x31')],_0x37be0d['token']);}return util['format']('Basic\x20%s',new Buffer(_0x33957a)[_0xb39c('0x34')](_0xb39c('0x35')));}function request(_0x36a306){logger['debug'](_0xb39c('0x36'),JSON['stringify'](_0x36a306));return rp(_[_0xb39c('0x7')](_0x36a306,{'method':_0xb39c('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x1a880b,_0x13c951){var _0x2916ee=[];if(_0x1a880b&&_0x1a880b[_0xb39c('0x28')]>0x0){_0x2916ee=_['map'](_0x1a880b,_0x13c951);}return _0x2916ee;}function getCustomFields(_0x2ba8e5,_0x2f302a){var _0x452fa8=[];var _0x292398={'custom_fields':[]};if(_0x2ba8e5[_0xb39c('0x28')]>0x0){_[_0xb39c('0x38')](_0x2ba8e5,function(_0x2281b6){if(_['includes']([_0xb39c('0x39'),_0xb39c('0x3a')],_0x2281b6['type'])&&_0x2281b6[_0xb39c('0x3b')]&&!_0x2281b6[_0xb39c('0x3c')]){_0x292398[_0x2281b6[_0xb39c('0x3b')][_0xb39c('0x3d')]()]=_0x2281b6['content'][_0xb39c('0x34')]();}else if(_['includes']([_0xb39c('0x39'),'picklist'],_0x2281b6[_0xb39c('0x3e')])&&_0x2281b6[_0xb39c('0x3f')]&&_0x2281b6['customField']){_0x292398[_0xb39c('0x40')][_0xb39c('0x41')]({'id':_0x2281b6[_0xb39c('0x3f')],'value':_0x2281b6[_0xb39c('0x42')][_0xb39c('0x34')]()});}else if(_0x2281b6[_0xb39c('0x3e')]===_0xb39c('0x43')&&_0x2281b6[_0xb39c('0x44')]&&_0x2281b6[_0xb39c('0x3f')]&&_0x2281b6['customField']){_0x2f302a[_0x2281b6[_0xb39c('0x44')]]&&_0x292398[_0xb39c('0x40')]['push']({'id':_0x2281b6[_0xb39c('0x3f')],'value':_0x2f302a[_0x2281b6['variableName']][_0xb39c('0x34')]()});}else if(_0x2281b6[_0xb39c('0x3e')]==='customVariable'&&_0x2281b6[_0xb39c('0x45')]&&_0x2281b6['Variable'][_0xb39c('0x46')]&&_0x2281b6[_0xb39c('0x3f')]&&_0x2281b6[_0xb39c('0x3c')]){_0x2f302a[_0x2281b6[_0xb39c('0x45')]['name'][_0xb39c('0x3d')]()]&&_0x292398[_0xb39c('0x40')][_0xb39c('0x41')]({'id':_0x2281b6['idField'],'value':_0x2f302a[_0x2281b6['Variable'][_0xb39c('0x46')][_0xb39c('0x3d')]()][_0xb39c('0x34')]()});}});}return _0x292398;}exports['queue']=function(_0x4e629a,_0x1a3e4b,_0x2b6f16,_0x4d8bda,_0x1bf3e2,_0x4ecf11){var _0x322101,_0x5e3632;_0x4ecf11[_0xb39c('0xf')]=intUtil['stripTrailingSlash'](_0x4ecf11[_0xb39c('0xf')]);_0x4ecf11['serverUrl']=intUtil[_0xb39c('0x47')](_0x4ecf11[_0xb39c('0x48')]);if(_0x1bf3e2&&_0x1bf3e2[_0xb39c('0x49')]){logger[_0xb39c('0x17')](_0xb39c('0x4a'),_0xb39c('0x4b'));_0x1a3e4b[_0xb39c('0x4c')]=util[_0xb39c('0xd')](_0xb39c('0x4d'),_0x4ecf11[_0xb39c('0x48')],_0x1a3e4b[_0xb39c('0x4e')],md5(_0x1a3e4b[_0xb39c('0x4e')]));}else{_0x1a3e4b[_0xb39c('0x4c')]='';}headers[_0xb39c('0x4f')]=getAuth(_0x4ecf11);return getUser(_0x4ecf11,_0x4d8bda['email'])['then'](function(_0x514307){_0x322101=_0x514307;logger['info'](_0xb39c('0x50'),_0x322101['id']);return getEndUser(_0x4ecf11,_0x1a3e4b[_0xb39c('0x51')],_0x1a3e4b['calleridnum']);})[_0xb39c('0x23')](function(_0x31e312){_0x5e3632=_0x31e312;logger[_0xb39c('0x17')]('The\x20Enduser\x20ID\x20is:',_0x5e3632['id']);return getTicket(_0x4ecf11,_0x322101,_0x5e3632,_0x2b6f16,_0x1a3e4b);})[_0xb39c('0x23')](function(_0x3414b5){if(_0x3414b5){logger[_0xb39c('0x17')]('The\x20Ticket\x20ID\x20is:',_0x3414b5['id']);switch(_0x4ecf11[_0xb39c('0x3e')]){case _0xb39c('0x52'):logger['info'](_0xb39c('0x4a'),_0xb39c('0x53'));return request({'uri':util[_0xb39c('0xd')](_0xb39c('0x54'),_0x4ecf11[_0xb39c('0xf')],_0x322101['id'],_0x3414b5['id']),'method':_0xb39c('0x10')});case _0xb39c('0x55'):logger['info']('[QUEUE]',_0xb39c('0x56'));emit(util[_0xb39c('0xd')](_0xb39c('0x57'),_0x4d8bda['name']),_0xb39c('0x58'),{'uri':util['format'](_0xb39c('0x59'),_0x4ecf11[_0xb39c('0xf')]['replace'](_0xb39c('0x5a'),''),_0x3414b5['id'])});break;default:logger[_0xb39c('0x5b')]('[QUEUE]',_0xb39c('0x5c'));}}})['catch'](function(_0x149f99){logger['error'](_0xb39c('0x5d'),util[_0xb39c('0x5e')](_0x149f99,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x429e8e,_0x4ca691,_0x5d2a34,_0x24d346,_0x33177e,_0x39261b,_0x5a8d6c){var _0x1b9082,_0x3b0a6f;_0x39261b[_0xb39c('0xf')]=intUtil[_0xb39c('0x47')](_0x39261b[_0xb39c('0xf')]);_0x39261b['serverUrl']=intUtil[_0xb39c('0x47')](_0x39261b[_0xb39c('0x48')]);if(_0x5a8d6c&&_0x5a8d6c['recordingFormat']&&_0x5a8d6c[_0xb39c('0x5f')]!==_0xb39c('0x60')){logger[_0xb39c('0x17')](_0xb39c('0x61'),'Recording\x20is\x20enabled!');_0x4ca691[_0xb39c('0x4c')]=util[_0xb39c('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39261b[_0xb39c('0x48')],_0x4ca691[_0xb39c('0x4e')],md5(_0x4ca691[_0xb39c('0x4e')]));}headers[_0xb39c('0x4f')]=getAuth(_0x39261b);return getUser(_0x39261b,_0x24d346[_0xb39c('0x62')])['then'](function(_0x558e47){_0x1b9082=_0x558e47;logger[_0xb39c('0x17')](_0xb39c('0x50'),_0x1b9082['id']);return getEndUser(_0x39261b,_0x4ca691[_0xb39c('0x63')],_0x4ca691['destcalleridnum']);})['then'](function(_0x293cad){_0x3b0a6f=_0x293cad;logger['info'](_0xb39c('0x64'),_0x3b0a6f['id']);return getTicket(_0x39261b,_0x1b9082,_0x3b0a6f,_0x5d2a34,_0x4ca691);})[_0xb39c('0x23')](function(_0x4200e1){if(_0x4200e1){logger['info'](_0xb39c('0x65'),_0x4200e1['id']);switch(_0x39261b[_0xb39c('0x3e')]){case _0xb39c('0x52'):logger[_0xb39c('0x17')](_0xb39c('0x61'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb39c('0xd')](_0xb39c('0x54'),_0x39261b[_0xb39c('0xf')],_0x1b9082['id'],_0x4200e1['id']),'method':_0xb39c('0x10')});case _0xb39c('0x55'):logger[_0xb39c('0x17')]('[OUTBOUND]',_0xb39c('0x56'));emit(util['format'](_0xb39c('0x57'),_0x24d346['name']),'trigger:browser:url',{'uri':util[_0xb39c('0xd')]('%s/agent/tickets/%s',_0x39261b[_0xb39c('0xf')][_0xb39c('0x66')]('/api/v2',''),_0x4200e1['id'])});break;default:logger[_0xb39c('0x5b')](_0xb39c('0x61'),_0xb39c('0x5c'));}}})[_0xb39c('0x67')](function(_0x613b9a){logger['error'](_0xb39c('0x68'),util[_0xb39c('0x5e')](_0x613b9a,{'showHidden':!![],'depth':null}));});};exports[_0xb39c('0x69')]=function(_0x43c5c5,_0x60871f,_0x1f03bb,_0x4b7e98,_0x8d6e79,_0x3c4832){var _0x8db86,_0x50388b;_0x3c4832[_0xb39c('0xf')]=intUtil[_0xb39c('0x47')](_0x3c4832[_0xb39c('0xf')]);_0x3c4832[_0xb39c('0x48')]=intUtil[_0xb39c('0x47')](_0x3c4832[_0xb39c('0x48')]);if(_0x8d6e79&&_0x8d6e79[_0xb39c('0x49')]){logger[_0xb39c('0x17')]('['+_0x60871f['lastevent'][_0xb39c('0x6a')]()+']',_0xb39c('0x4b'));_0x60871f[_0xb39c('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c4832[_0xb39c('0x48')],_0x60871f[_0xb39c('0x4e')],md5(_0x60871f['uniqueid']));}else{_0x60871f[_0xb39c('0x4c')]='';}headers['Authorization']=getAuth(_0x3c4832);return getUser(_0x3c4832)['then'](function(_0x2ef43b){_0x8db86=_0x2ef43b;logger[_0xb39c('0x17')](_0xb39c('0x50'),_0x8db86['id']);return getEndUser(_0x3c4832,_0x60871f[_0xb39c('0x51')],_0x60871f[_0xb39c('0x6b')]);})[_0xb39c('0x23')](function(_0x3e3ab7){_0x50388b=_0x3e3ab7;logger[_0xb39c('0x17')](_0xb39c('0x64'),_0x50388b['id']);return getTicket(_0x3c4832,_0x8db86,_0x50388b,_0x1f03bb,_0x60871f);})[_0xb39c('0x23')](function(_0x4ba686){if(_0x4ba686){logger['info'](_0xb39c('0x65'),_0x4ba686['id']);}})['catch'](function(_0x5b7b7d){logger['error']('['+_0x60871f[_0xb39c('0x6c')][_0xb39c('0x6a')]()+']'+_0xb39c('0x6d'),util['inspect'](_0x5b7b7d,{'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 56abc84..b5d1e33 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 _0xf04c=['zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isNil','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','uri','nothing','lead','Creating\x20new\x20call...','Owner','administrator','first_name','getString','Subjects','Description','enduserType','Contacts','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','connect','Rejected','abandoned','Abandoned','timeout','outbound','agentcalledAt','Call_Type','Inbound','Fields','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','email','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','com','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','calleridname','The\x20Call\x20ID\x20is:','lodash','util','./util','moment','ioredis','bluebird','../../../../config/environment','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','access_token','isBefore','expires_in'];(function(_0x2a40b3,_0xe1c253){var _0x4ac6cb=function(_0x5083fe){while(--_0x5083fe){_0x2a40b3['push'](_0x2a40b3['shift']());}};_0x4ac6cb(++_0xe1c253);}(_0xf04c,0x7c));var _0xcf04=function(_0x4801a6,_0x19799a){_0x4801a6=_0x4801a6-0x0;var _0x486075=_0xf04c[_0x4801a6];return _0x486075;};'use strict';var _=require(_0xcf04('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xcf04('0x1'));var intUtil=require(_0xcf04('0x2'));var moment=require(_0xcf04('0x3'));var Redis=require(_0xcf04('0x4'));var BPromise=require(_0xcf04('0x5'));var config=require(_0xcf04('0x6'));var logger=require('../../../../config/logger')('zoho');config[_0xcf04('0x7')]=_[_0xcf04('0x8')](config[_0xcf04('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xcf04('0x9'))(new Redis(config[_0xcf04('0x7')]));function emit(_0x2200e6,_0x1e4f55,_0x17e9f0){io['to'](_0x2200e6)[_0xcf04('0xa')](_0x1e4f55,_0x17e9f0);}function request(_0x5ad9b1){logger[_0xcf04('0xb')](_0xcf04('0xc'),JSON[_0xcf04('0xd')](_0x5ad9b1));return rp(_0x5ad9b1);}function getCustomFields(_0x4d4da5,_0x9bbc3e){var _0x39c088={};if(_0x4d4da5[_0xcf04('0xe')]>0x0){_[_0xcf04('0xf')](_0x4d4da5,function(_0x53f7de){if(_[_0xcf04('0x10')]([_0xcf04('0x11'),_0xcf04('0x12')],_0x53f7de[_0xcf04('0x13')])&&_0x53f7de[_0xcf04('0x14')]){_0x39c088[_0x53f7de['idField']]=_0x53f7de['content']['toString']();}else if(_0x53f7de[_0xcf04('0x13')]==='variable'&&_0x53f7de[_0xcf04('0x15')]&&_0x53f7de['idField']&&_0x9bbc3e[_0x53f7de[_0xcf04('0x15')]]){_0x39c088[_0x53f7de['idField']]=_0x9bbc3e[_0x53f7de[_0xcf04('0x15')]][_0xcf04('0x16')]();}else if(_0x53f7de[_0xcf04('0x13')]===_0xcf04('0x17')&&_0x53f7de[_0xcf04('0x18')]&&_0x53f7de['Variable'][_0xcf04('0x19')]&&_0x53f7de['idField']&&_0x9bbc3e[_0x53f7de['Variable'][_0xcf04('0x19')][_0xcf04('0x1a')]()]){_0x39c088[_0x53f7de[_0xcf04('0x14')]]=_0x9bbc3e[_0x53f7de[_0xcf04('0x18')][_0xcf04('0x19')][_0xcf04('0x1a')]()][_0xcf04('0x16')]();}});}return _0x39c088;}function getName(_0x1fc868){if(_0x1fc868[_0xcf04('0x1b')]('\x20')>0x0){var _0x5efa80=_0x1fc868['split'](/ (.+)/);if(_0x5efa80[0x1]){return _0x5efa80;}}return[_0x1fc868,_0x1fc868];}var accountsTokens={};function getAccessToken(_0x1e23ab){return new Promise(function(_0x2526e1,_0x3d477b){if(!_['isNil'](accountsTokens[_0x1e23ab['id']])&&!_['isNil'](accountsTokens[_0x1e23ab['id']][_0xcf04('0x1c')])){if(moment()[_0xcf04('0x1d')](accountsTokens[_0x1e23ab['id']][_0xcf04('0x1e')])){_0x2526e1(accountsTokens[_0x1e23ab['id']][_0xcf04('0x1c')]);}}var _0x3f03d8;switch(_0x1e23ab[_0xcf04('0x1f')]){case'US':_0x3f03d8=_0xcf04('0x20');break;case'AU':_0x3f03d8=_0xcf04('0x21');break;case'EU':_0x3f03d8=_0xcf04('0x22');break;case'IN':_0x3f03d8=_0xcf04('0x23');break;case'CN':_0x3f03d8=_0xcf04('0x24');break;default:_0x3f03d8=_0xcf04('0x22');break;}var _0x19551a={'method':_0xcf04('0x25'),'uri':_0x3f03d8+_0xcf04('0x26'),'qs':{'refresh_token':_0x1e23ab[_0xcf04('0x27')],'client_id':_0x1e23ab[_0xcf04('0x28')],'client_secret':_0x1e23ab[_0xcf04('0x29')],'grant_type':_0xcf04('0x2a')},'json':!![]};return rp(_0x19551a)[_0xcf04('0x2b')](function(_0x2d9b5f){accountsTokens[_0x1e23ab['id']]={'access_token':_0x2d9b5f[_0xcf04('0x1c')],'expires_in':moment()[_0xcf04('0x2c')](_0x2d9b5f[_0xcf04('0x1e')],_0xcf04('0x2d'))};_0x2526e1(_0x2d9b5f[_0xcf04('0x1c')]);})[_0xcf04('0x2e')](function(_0x38accb){logger[_0xcf04('0x2f')]('Failing\x20creating\x20the\x20access_token',_0x38accb['stack']);_0x3d477b(_0x38accb);});});}function getUser(_0x1d94da,_0x27a3e1,_0xdd66c9,_0x177ff4){logger[_0xcf04('0x30')]('Search\x20user');return request({'method':_0xcf04('0x31'),'uri':util[_0xcf04('0x32')](_0xcf04('0x33'),_0x27a3e1),'qs':{'type':_0xcf04('0x34')},'headers':{'Authorization':_0xcf04('0x35')+_0x1d94da},'json':!![]})['then'](function(_0x1929ed){if(_0x1929ed[_0xcf04('0x36')]){var _0x457088=-0x1;if(_['isArrayLikeObject'](_0x1929ed[_0xcf04('0x36')])){if(!_[_0xcf04('0x37')](_0x177ff4)){_0x457088=_[_0xcf04('0x38')](_0x1929ed[_0xcf04('0x36')],function(_0x512dce){return _0x512dce['email']===_0x177ff4;});}if(_0x457088>=0x0){logger[_0xcf04('0x30')](_0xcf04('0x39'));}else{logger[_0xcf04('0x30')](_0xcf04('0x3a'));_0x457088=_[_0xcf04('0x38')](_0x1929ed[_0xcf04('0x36')],function(_0x4dbe54){return _0x4dbe54['profile'][_0xcf04('0x19')]===_0xcf04('0x3b');});}return _0x1929ed[_0xcf04('0x36')][_0x457088];}else{if(_0x1929ed[_0xcf04('0x3c')][_0xcf04('0x3d')][_0xcf04('0x19')]==='Administrator'){logger[_0xcf04('0x30')](_0xcf04('0x3a'));user=_0x1929ed[_0xcf04('0x3c')];return user;}else{logger['error'](_0xcf04('0x3e'),JSON[_0xcf04('0xd')](_0x1929ed));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xcf04('0xd')](_0x1929ed));}}}else{logger[_0xcf04('0x2f')](_0xcf04('0x3e'),JSON[_0xcf04('0xd')](_0x1929ed));throw new Error(_0xcf04('0x3f')+JSON[_0xcf04('0xd')](_0x1929ed));}})[_0xcf04('0x2e')](function(_0x59c268){console['error'](_0x59c268);});}function getZohoUser(_0x14a81a,_0x3b5434){return new BPromise(function(_0x214dfd,_0x15cbeb){request(_0x14a81a)['then'](function(_0xedb0f){var _0x1fe344=null;if(_0xedb0f){_0x1fe344=_0xedb0f[_0xcf04('0x40')][0x0];_0x1fe344['enduserType']=_0x3b5434;}_0x214dfd(_0x1fe344);})['catch'](function(_0x332f08){_0x15cbeb(_0x332f08);});});}function createEndUser(_0x4c5397,_0x2bb49a,_0x1515e5,_0x48020f,_0x43c7c4,_0x26634c){var _0x1515e5=getName(_0x1515e5);return request({'method':_0xcf04('0x25'),'uri':_0xcf04('0x41')+_0x2bb49a+_0xcf04('0x42')+_[_0xcf04('0x43')](_0x26634c[_0xcf04('0x44')])+'s','body':{'data':[{'Last_Name':_0x1515e5[0x1],'First_Name':_0x1515e5[0x0],'Phone':_0x48020f,'Owner':{'name':!_[_0xcf04('0x37')](_0x43c7c4[_0xcf04('0x45')]['name'])?_0x43c7c4['role'][_0xcf04('0x19')]:!_[_0xcf04('0x37')](_0x43c7c4['first_name'])?_0x43c7c4['first_name']+'\x20'+_0x43c7c4['last_name']:_0x43c7c4[_0xcf04('0x46')],'id':_0x43c7c4['id']}}]},'headers':{'Authorization':_0xcf04('0x35')+_0x4c5397},'json':!![]})[_0xcf04('0x2b')](function(_0x557489){if(_0x557489&&_0x557489['data'][0x0][_0xcf04('0x47')]===_0xcf04('0x48')){var _0x4dd97c=_0x557489[_0xcf04('0x40')][0x0][_0xcf04('0x49')];_0x4dd97c['enduserType']=_['startCase'](_0x26634c[_0xcf04('0x44')])+'s';return _0x4dd97c;}logger[_0xcf04('0x2f')](_0xcf04('0x3e'),JSON[_0xcf04('0xd')](data));throw new Error(_0xcf04('0x4a')+JSON[_0xcf04('0xd')](data));})[_0xcf04('0x2e')](function(_0xc25bca){console[_0xcf04('0x4b')](_0xcf04('0x4c'),_0xc25bca);});}function getEndUser(_0x3afcf5,_0x41a66f,_0x1f50b2,_0x10c478,_0x283dff,_0x46d955,_0x92acfb){var _0x26db54={'method':'GET','uri':'','headers':{'Authorization':_0xcf04('0x35')+_0x3afcf5},'json':!![]};switch(_0x92acfb['moduleSearch']){case _0xcf04('0x4d'):_0x26db54['uri']=_0xcf04('0x41')+_0x41a66f+_0xcf04('0x4e')+_0x283dff+'))';return getZohoUser(_0x26db54,'Contacts')['then'](function(_0xbea7de){if(_0xbea7de)return _0xbea7de;_0x26db54['uri']='https://www.zohoapis.'+_0x41a66f+_0xcf04('0x4f')+_0x283dff+'))';return getZohoUser(_0x26db54,_0xcf04('0x50'))[_0xcf04('0x2b')](function(_0x291267){if(_0x291267)return _0x291267;if(_0x92acfb['moduleCreate']!='nothing'){return createEndUser(_0x3afcf5,_0x41a66f,_0x10c478,_0x283dff,_0x46d955,_0x92acfb);}else{return{};}});});break;case _0xcf04('0x51'):_0x26db54[_0xcf04('0x52')]=_0xcf04('0x41')+_0x41a66f+_0xcf04('0x4e')+_0x283dff+'))';return getZohoUser(_0x26db54,'Contacts')[_0xcf04('0x2b')](function(_0x34b94e){if(_0x34b94e)return _0x34b94e;if(_0x92acfb[_0xcf04('0x44')]!=_0xcf04('0x53')){return createEndUser(_0x3afcf5,_0x41a66f,_0x10c478,_0x283dff,_0x46d955,_0x92acfb);}else{return{};}});break;case _0xcf04('0x54'):_0x26db54[_0xcf04('0x52')]='https://www.zohoapis.'+_0x41a66f+_0xcf04('0x4f')+_0x283dff+'))';return getZohoUser(_0x26db54,_0xcf04('0x50'))['then'](function(_0x1b3649){if(_0x1b3649)return _0x1b3649;if(_0x92acfb[_0xcf04('0x44')]!='nothing'){return createEndUser(_0x3afcf5,_0x41a66f,_0x10c478,_0x283dff,_0x46d955,_0x92acfb);}else{return{};}});break;}}function getCall(_0x4765fc,_0x51831b,_0x41beca,_0x5e8ea6,_0x152b18,_0x39c588,_0x28d70d,_0x574cd1){logger['info'](_0xcf04('0x55'));var _0x3bddbb={};_0x3bddbb[_0xcf04('0x56')]={'name':!_['isNil'](_0x5e8ea6[_0xcf04('0x45')][_0xcf04('0x19')])&&!_[_0xcf04('0x37')](_0x5e8ea6[_0xcf04('0x3d')]['name'])&&_0x5e8ea6[_0xcf04('0x3d')][_0xcf04('0x19')]===_0xcf04('0x57')?_0x5e8ea6[_0xcf04('0x45')][_0xcf04('0x19')]:!_[_0xcf04('0x37')](_0x5e8ea6[_0xcf04('0x58')])?_0x5e8ea6[_0xcf04('0x58')]+'\x20'+_0x5e8ea6[_0xcf04('0x46')]:_0x5e8ea6[_0xcf04('0x46')],'id':_0x5e8ea6['id']};_0x3bddbb['Subject']=intUtil[_0xcf04('0x59')](_0x39c588[_0xcf04('0x5a')],_0x28d70d,'\x20');_0x3bddbb[_0xcf04('0x5b')]=intUtil[_0xcf04('0x59')](_0x39c588['Descriptions'],_0x28d70d,'\x0a');if(_0x152b18[_0xcf04('0x5c')]===_0xcf04('0x5d')){_0x3bddbb[_0xcf04('0x5e')]={'name':!_[_0xcf04('0x37')](_0x152b18[_0xcf04('0x5f')])?_0x152b18[_0xcf04('0x5f')]:!_['isNil'](_0x152b18[_0xcf04('0x60')])?_0x152b18[_0xcf04('0x60')]+'\x20'+_0x152b18[_0xcf04('0x61')]:_0x152b18[_0xcf04('0x61')],'id':_0x152b18['id']};}if(_0x152b18['enduserType']===_0xcf04('0x50')){_0x3bddbb[_0xcf04('0x62')]={'name':!_['isNil'](_0x152b18[_0xcf04('0x5f')])?_0x152b18['Full_Name']:!_[_0xcf04('0x37')](_0x152b18[_0xcf04('0x60')])?_0x152b18['First_Name']+'\x20'+_0x152b18['Last_Name']:_0x152b18[_0xcf04('0x61')],'id':_0x152b18['id']};_0x3bddbb[_0xcf04('0x63')]=_[_0xcf04('0x43')](_0x152b18[_0xcf04('0x5c')]);}if(_0x28d70d[_0xcf04('0x64')]){_0x3bddbb[_0xcf04('0x65')]=moment['utc'](parseInt(_0x28d70d[_0xcf04('0x64')])*0x3e8)['format']('mm:ss');}else if(_0x28d70d[_0xcf04('0x66')]&&_0x28d70d[_0xcf04('0x67')]){_0x3bddbb['Call_Duration']=moment[_0xcf04('0x68')](moment(_0x28d70d[_0xcf04('0x67')],_0xcf04('0x69'))[_0xcf04('0x6a')](moment(_0x28d70d[_0xcf04('0x6b')],_0xcf04('0x69'))))['format']('mm:ss');}switch(_0x28d70d[_0xcf04('0x6c')]){case _0xcf04('0x6d'):_0x3bddbb[_0xcf04('0x6e')]='Called';break;case'complete':case _0xcf04('0x6f'):_0x3bddbb[_0xcf04('0x6e')]='Answered';break;case'rejected':_0x3bddbb[_0xcf04('0x6e')]=_0xcf04('0x70');break;case _0xcf04('0x71'):_0x3bddbb[_0xcf04('0x6e')]=_0xcf04('0x72');break;case _0xcf04('0x73'):_0x3bddbb[_0xcf04('0x6e')]='Timeout';default:}_0x3bddbb['Call_Start_Time']=(_0x574cd1===_0xcf04('0x74')?moment(_0x28d70d[_0xcf04('0x6b')])[_0xcf04('0x32')](_0xcf04('0x69')):moment(_0x28d70d[_0xcf04('0x75')])[_0xcf04('0x32')](_0xcf04('0x69')))||moment()[_0xcf04('0x32')](_0xcf04('0x69'));_0x3bddbb[_0xcf04('0x76')]=_0x574cd1||_0xcf04('0x77');_0x3bddbb=_['merge'](_0x3bddbb,getCustomFields(_0x39c588[_0xcf04('0x78')],_0x28d70d));return request({'method':_0xcf04('0x25'),'uri':_0xcf04('0x41')+_0x51831b+'/crm/v2/Calls','headers':{'Authorization':_0xcf04('0x35')+_0x4765fc},'body':{'data':[_0x3bddbb]},'json':!![]})[_0xcf04('0x2b')](function(_0x4079ea){if(_0x4079ea&&_0x4079ea[_0xcf04('0x40')][0x0][_0xcf04('0x47')]==='SUCCESS'){logger[_0xcf04('0x30')](_0xcf04('0x79'));return{'id':_0x4079ea['data'][0x0]['details']['id']};}})[_0xcf04('0x2e')](function(_0x1a9e16){logger[_0xcf04('0x30')](_0xcf04('0x7a'),_0x1a9e16[_0xcf04('0x7b')]);console[_0xcf04('0x4b')](_0xcf04('0x7a'),_0x1a9e16);});}exports[_0xcf04('0x7c')]=function(_0x15ece3,_0x10f535,_0x5a3a63,_0x36b1c4,_0x92545e,_0x1dc689){var _0x424e4e,_0x563b8a,_0x67d03f;_0x1dc689[_0xcf04('0x7d')]=intUtil[_0xcf04('0x7e')](_0x1dc689[_0xcf04('0x7d')]);_0x1dc689[_0xcf04('0x7f')]=intUtil[_0xcf04('0x7e')](_0x1dc689['serverUrl']);if(_0x92545e&&_0x92545e[_0xcf04('0x80')]){logger[_0xcf04('0x30')](_0xcf04('0x81'),_0xcf04('0x82'));_0x10f535['recordingURL']=_0x1dc689[_0xcf04('0x7f')]+_0xcf04('0x83')+_0x10f535[_0xcf04('0x84')]+_0xcf04('0x85')+md5(_0x10f535[_0xcf04('0x84')]);}else{_0x10f535[_0xcf04('0x86')]='';}var _0x171d6f=_0x1dc689[_0xcf04('0x7d')]===_0xcf04('0x87')?'eu':'com';return getAccessToken(_0x1dc689)['then'](function(_0x17ab90){_0x67d03f=_0x17ab90;return getUser(_0x67d03f,_0x171d6f,_0x1dc689,_0x36b1c4[_0xcf04('0x88')]);})[_0xcf04('0x2b')](function(_0x40fa2c){_0x424e4e=_0x40fa2c;logger[_0xcf04('0x30')]('The\x20User\x20ID\x20is:',_0x424e4e['id']);return getEndUser(_0x67d03f,_0x171d6f,_0x1dc689,_0x10f535['calleridname'],_0x10f535[_0xcf04('0x89')],_0x424e4e,_0x5a3a63);})[_0xcf04('0x2b')](function(_0x93729a){_0x563b8a=_0x93729a;return getCall(_0x67d03f,_0x171d6f,_0x1dc689,_0x424e4e,_0x563b8a,_0x5a3a63,_0x10f535,_0xcf04('0x77'));})[_0xcf04('0x2b')](function(_0xa89bd2){if(_0xa89bd2){logger[_0xcf04('0x30')]('The\x20Call\x20ID\x20is:',_0xa89bd2['id']);logger[_0xcf04('0x30')](_0xcf04('0x81'),_0xcf04('0x8a'));emit(util['format'](_0xcf04('0x8b'),_0x36b1c4[_0xcf04('0x19')]),_0xcf04('0x8c'),{'uri':_0xcf04('0x8d')+_0x1dc689[_0xcf04('0x7d')]+_0xcf04('0x8e')+_0xa89bd2['id']});}})[_0xcf04('0x2e')](function(_0x31beaf){logger['error'](_0xcf04('0x81'),JSON[_0xcf04('0xd')](_0x31beaf));});};exports[_0xcf04('0x74')]=function(_0x55369f,_0x4e24b0,_0x28649a,_0x24ff4a,_0x4660de,_0x426ca,_0x36af49){var _0x5bd914,_0x3001b7,_0x18cdb9;_0x426ca[_0xcf04('0x7d')]=intUtil[_0xcf04('0x7e')](_0x426ca[_0xcf04('0x7d')]);_0x426ca[_0xcf04('0x7f')]=intUtil[_0xcf04('0x7e')](_0x426ca[_0xcf04('0x7f')]);if(_0x36af49&&_0x36af49[_0xcf04('0x8f')]&&_0x36af49[_0xcf04('0x8f')]!==_0xcf04('0x90')){logger['info'](_0xcf04('0x91'),_0xcf04('0x82'));_0x4e24b0['recordingURL']=_0x426ca['serverUrl']+_0xcf04('0x83')+_0x4e24b0['uniqueid']+_0xcf04('0x85')+md5(_0x4e24b0[_0xcf04('0x84')]);}var _0x3bf698=_0x426ca['host']===_0xcf04('0x87')?'eu':_0xcf04('0x92');return getAccessToken(_0x426ca)[_0xcf04('0x2b')](function(_0x544844){_0x18cdb9=_0x544844;return getUser(_0x18cdb9,_0x3bf698,_0x426ca,_0x24ff4a[_0xcf04('0x88')]);})[_0xcf04('0x2b')](function(_0x51c49d){_0x5bd914=_0x51c49d;logger[_0xcf04('0x30')](_0xcf04('0x93'),_0x5bd914['id']);return getEndUser(_0x18cdb9,_0x3bf698,_0x426ca,_0x4e24b0[_0xcf04('0x94')],_0x4e24b0[_0xcf04('0x95')],_0x5bd914,_0x28649a);})[_0xcf04('0x2b')](function(_0x5502fa){_0x3001b7=_0x5502fa;return getCall(_0x18cdb9,_0x3bf698,_0x426ca,_0x5bd914,_0x3001b7,_0x28649a,_0x4e24b0,_0xcf04('0x96'));})[_0xcf04('0x2b')](function(_0x38b918){if(_0x38b918){logger[_0xcf04('0x30')]('The\x20Call\x20ID\x20is:',_0x38b918['id']);logger['info'](_0xcf04('0x91'),_0xcf04('0x8a'));emit(util['format']('user:%s',_0x24ff4a['name']),'trigger:browser:url',{'uri':_0xcf04('0x8d')+_0x426ca['host']+_0xcf04('0x8e')+_0x38b918['id']});}})[_0xcf04('0x2e')](function(_0x40dcef){logger[_0xcf04('0x2f')](_0xcf04('0x91'),JSON[_0xcf04('0xd')](_0x40dcef));});};exports[_0xcf04('0x97')]=function(_0xf8e9e7,_0x1e7bf8,_0xa14bf2,_0xf59908,_0x45931d,_0x1de310){var _0x425040,_0x29919a,_0x47f328;_0x1de310[_0xcf04('0x7d')]=intUtil['stripTrailingSlash'](_0x1de310['host']);_0x1de310[_0xcf04('0x7f')]=intUtil[_0xcf04('0x7e')](_0x1de310[_0xcf04('0x7f')]);if(_0x45931d&&_0x45931d[_0xcf04('0x80')]){logger['info']('['+_0x1e7bf8[_0xcf04('0x6c')][_0xcf04('0x98')]()+']',_0xcf04('0x82'));_0x1e7bf8[_0xcf04('0x86')]=_0x1de310[_0xcf04('0x7f')]+_0xcf04('0x83')+_0x1e7bf8[_0xcf04('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x1e7bf8['uniqueid']);}else{_0x1e7bf8[_0xcf04('0x86')]='';}var _0x13ab94=_0x1de310[_0xcf04('0x7d')]===_0xcf04('0x87')?'eu':'com';return getAccessToken(_0x1de310)[_0xcf04('0x2b')](function(_0x364468){_0x47f328=_0x364468;return getUser(_0x47f328,_0x13ab94,_0x1de310);})[_0xcf04('0x2b')](function(_0x289abe){_0x425040=_0x289abe;logger['info'](_0xcf04('0x93'),_0x425040['id']);return getEndUser(_0x47f328,_0x13ab94,_0x1de310,_0x1e7bf8[_0xcf04('0x99')],_0x1e7bf8[_0xcf04('0x89')],_0x425040,_0xa14bf2);})['then'](function(_0xc65840){_0x29919a=_0xc65840;return getCall(_0x47f328,_0x13ab94,_0x1de310,_0x425040,_0x29919a,_0xa14bf2,_0x1e7bf8,_0xcf04('0x77'));})[_0xcf04('0x2b')](function(_0x4f7116){if(_0x4f7116){logger['info'](_0xcf04('0x9a'),_0x4f7116['id']);}})['catch'](function(_0x26d526){logger['error']('['+_0x1e7bf8['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x26d526));});}; \ No newline at end of file +var _0x5541=['SUCCESS','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Owner','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','Call\x20created!','details','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','email','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','com','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','unmanaged','toUpperCase','zoho.eu','calleridnum','lodash','request-promise','md5','util','moment','bluebird','../../../../config/logger','redis','defaults','localhost','debug','length','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.in','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0x5541,0x184));var _0x1554=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0x5541[_0x20ebb5];return _0x487182;};'use strict';var _=require(_0x1554('0x0'));var rp=require(_0x1554('0x1'));var md5=require(_0x1554('0x2'));var util=require(_0x1554('0x3'));var intUtil=require('./util');var moment=require(_0x1554('0x4'));var Redis=require('ioredis');var BPromise=require(_0x1554('0x5'));var config=require('../../../../config/environment');var logger=require(_0x1554('0x6'))('zoho');config[_0x1554('0x7')]=_[_0x1554('0x8')](config['redis'],{'host':_0x1554('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x55e52f,_0x11e39e,_0x7cf4f1){io['to'](_0x55e52f)['emit'](_0x11e39e,_0x7cf4f1);}function request(_0x5c0d0d){logger[_0x1554('0xa')]('[HTTP]',JSON['stringify'](_0x5c0d0d));return rp(_0x5c0d0d);}function getCustomFields(_0x53e965,_0x58cc53){var _0xa99cfb={};if(_0x53e965[_0x1554('0xb')]>0x0){_[_0x1554('0xc')](_0x53e965,function(_0x572e82){if(_[_0x1554('0xd')](['string',_0x1554('0xe')],_0x572e82[_0x1554('0xf')])&&_0x572e82[_0x1554('0x10')]){_0xa99cfb[_0x572e82[_0x1554('0x10')]]=_0x572e82[_0x1554('0x11')][_0x1554('0x12')]();}else if(_0x572e82[_0x1554('0xf')]===_0x1554('0x13')&&_0x572e82[_0x1554('0x14')]&&_0x572e82['idField']&&_0x58cc53[_0x572e82[_0x1554('0x14')]]){_0xa99cfb[_0x572e82[_0x1554('0x10')]]=_0x58cc53[_0x572e82[_0x1554('0x14')]][_0x1554('0x12')]();}else if(_0x572e82[_0x1554('0xf')]===_0x1554('0x15')&&_0x572e82[_0x1554('0x16')]&&_0x572e82[_0x1554('0x16')][_0x1554('0x17')]&&_0x572e82[_0x1554('0x10')]&&_0x58cc53[_0x572e82['Variable'][_0x1554('0x17')][_0x1554('0x18')]()]){_0xa99cfb[_0x572e82['idField']]=_0x58cc53[_0x572e82[_0x1554('0x16')][_0x1554('0x17')][_0x1554('0x18')]()][_0x1554('0x12')]();}});}return _0xa99cfb;}function getName(_0x5dde75){if(_0x5dde75[_0x1554('0x19')]('\x20')>0x0){var _0x4e693a=_0x5dde75[_0x1554('0x1a')](/ (.+)/);if(_0x4e693a[0x1]){return _0x4e693a;}}return[_0x5dde75,_0x5dde75];}var accountsTokens={};function getAccessToken(_0x2c3755){return new Promise(function(_0xcbba37,_0x1caffc){if(!_[_0x1554('0x1b')](accountsTokens[_0x2c3755['id']])&&!_[_0x1554('0x1b')](accountsTokens[_0x2c3755['id']][_0x1554('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x2c3755['id']][_0x1554('0x1d')])){_0xcbba37(accountsTokens[_0x2c3755['id']][_0x1554('0x1c')]);}}var _0x485935;switch(_0x2c3755[_0x1554('0x1e')]){case'US':_0x485935='https://accounts.zoho.com';break;case'AU':_0x485935='https://accounts.zoho.com.au';break;case'EU':_0x485935='https://accounts.zoho.eu';break;case'IN':_0x485935=_0x1554('0x1f');break;case'CN':_0x485935='https://accounts.zoho.com.cn';break;default:_0x485935=_0x1554('0x20');break;}var _0x816e22={'method':_0x1554('0x21'),'uri':_0x485935+'/oauth/v2/token','qs':{'refresh_token':_0x2c3755[_0x1554('0x22')],'client_id':_0x2c3755[_0x1554('0x23')],'client_secret':_0x2c3755[_0x1554('0x24')],'grant_type':_0x1554('0x25')},'json':!![]};return rp(_0x816e22)[_0x1554('0x26')](function(_0x34f05e){accountsTokens[_0x2c3755['id']]={'access_token':_0x34f05e[_0x1554('0x1c')],'expires_in':moment()[_0x1554('0x27')](_0x34f05e['expires_in'],_0x1554('0x28'))};_0xcbba37(_0x34f05e[_0x1554('0x1c')]);})[_0x1554('0x29')](function(_0x55cbb4){logger[_0x1554('0x2a')](_0x1554('0x2b'),_0x55cbb4['stack']);_0x1caffc(_0x55cbb4);});});}function getUser(_0x1f28b3,_0x11239c,_0x59a062,_0x1b598d){logger[_0x1554('0x2c')]('Search\x20user');return request({'method':_0x1554('0x2d'),'uri':util[_0x1554('0x2e')](_0x1554('0x2f'),_0x11239c),'qs':{'type':_0x1554('0x30')},'headers':{'Authorization':_0x1554('0x31')+_0x1f28b3},'json':!![]})[_0x1554('0x26')](function(_0xac28bf){if(_0xac28bf[_0x1554('0x32')]){var _0x32e1a6=-0x1;if(_[_0x1554('0x33')](_0xac28bf[_0x1554('0x32')])){if(!_[_0x1554('0x1b')](_0x1b598d)){_0x32e1a6=_[_0x1554('0x34')](_0xac28bf[_0x1554('0x32')],function(_0x17debf){return _0x17debf['email']===_0x1b598d;});}if(_0x32e1a6>=0x0){logger[_0x1554('0x2c')](_0x1554('0x35'));}else{logger['info'](_0x1554('0x36'));_0x32e1a6=_[_0x1554('0x34')](_0xac28bf[_0x1554('0x32')],function(_0x42b46a){return _0x42b46a[_0x1554('0x37')][_0x1554('0x17')]===_0x1554('0x38');});}return _0xac28bf[_0x1554('0x32')][_0x32e1a6];}else{if(_0xac28bf[_0x1554('0x39')][_0x1554('0x37')][_0x1554('0x17')]===_0x1554('0x38')){logger[_0x1554('0x2c')]('Using\x20the\x20admin\x20account!');user=_0xac28bf[_0x1554('0x39')];return user;}else{logger[_0x1554('0x2a')](_0x1554('0x3a'),JSON[_0x1554('0x3b')](_0xac28bf));throw new Error(_0x1554('0x3c')+JSON[_0x1554('0x3b')](_0xac28bf));}}}else{logger[_0x1554('0x2a')](_0x1554('0x3a'),JSON[_0x1554('0x3b')](_0xac28bf));throw new Error(_0x1554('0x3c')+JSON[_0x1554('0x3b')](_0xac28bf));}})['catch'](function(_0xbab334){console[_0x1554('0x2a')](_0xbab334);});}function getZohoUser(_0x1cbee8,_0x55869f){return new BPromise(function(_0x54f5ee,_0x55efb3){request(_0x1cbee8)['then'](function(_0xbb52a6){var _0xd1be0f=null;if(_0xbb52a6){_0xd1be0f=_0xbb52a6[_0x1554('0x3d')][0x0];_0xd1be0f[_0x1554('0x3e')]=_0x55869f;}_0x54f5ee(_0xd1be0f);})[_0x1554('0x29')](function(_0xadeff3){_0x55efb3(_0xadeff3);});});}function createEndUser(_0x315e03,_0x2c4068,_0x157f25,_0x272421,_0xc59c0f,_0x49c62a){var _0x157f25=getName(_0x157f25);return request({'method':'POST','uri':_0x1554('0x3f')+_0x2c4068+_0x1554('0x40')+_[_0x1554('0x41')](_0x49c62a[_0x1554('0x42')])+'s','body':{'data':[{'Last_Name':_0x157f25[0x1],'First_Name':_0x157f25[0x0],'Phone':_0x272421,'Owner':{'name':!_[_0x1554('0x1b')](_0xc59c0f['role'][_0x1554('0x17')])?_0xc59c0f[_0x1554('0x43')][_0x1554('0x17')]:!_[_0x1554('0x1b')](_0xc59c0f['first_name'])?_0xc59c0f[_0x1554('0x44')]+'\x20'+_0xc59c0f[_0x1554('0x45')]:_0xc59c0f[_0x1554('0x45')],'id':_0xc59c0f['id']}}]},'headers':{'Authorization':_0x1554('0x31')+_0x315e03},'json':!![]})[_0x1554('0x26')](function(_0xe32dbe){if(_0xe32dbe&&_0xe32dbe['data'][0x0][_0x1554('0x46')]===_0x1554('0x47')){var _0x563539=_0xe32dbe[_0x1554('0x3d')][0x0]['details'];_0x563539['enduserType']=_[_0x1554('0x41')](_0x49c62a[_0x1554('0x42')])+'s';return _0x563539;}logger[_0x1554('0x2a')](_0x1554('0x3a'),JSON['stringify'](data));throw new Error(_0x1554('0x48')+JSON[_0x1554('0x3b')](data));})[_0x1554('0x29')](function(_0x41bf93){console[_0x1554('0x49')](_0x1554('0x4a'),_0x41bf93);});}function getEndUser(_0x3b5a78,_0x387fdf,_0x4f5520,_0x579526,_0x126527,_0x2affd1,_0x5b3cf7){var _0x11c0a8={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3b5a78},'json':!![]};switch(_0x5b3cf7[_0x1554('0x4b')]){case _0x1554('0x4c'):_0x11c0a8[_0x1554('0x4d')]=_0x1554('0x3f')+_0x387fdf+_0x1554('0x4e')+_0x126527+'))';return getZohoUser(_0x11c0a8,_0x1554('0x4f'))[_0x1554('0x26')](function(_0x3a0204){if(_0x3a0204)return _0x3a0204;_0x11c0a8[_0x1554('0x4d')]=_0x1554('0x3f')+_0x387fdf+_0x1554('0x50')+_0x126527+'))';return getZohoUser(_0x11c0a8,_0x1554('0x51'))[_0x1554('0x26')](function(_0x5b94a7){if(_0x5b94a7)return _0x5b94a7;if(_0x5b3cf7[_0x1554('0x42')]!=_0x1554('0x52')){return createEndUser(_0x3b5a78,_0x387fdf,_0x579526,_0x126527,_0x2affd1,_0x5b3cf7);}else{return{};}});});break;case'contact':_0x11c0a8[_0x1554('0x4d')]='https://www.zohoapis.'+_0x387fdf+_0x1554('0x4e')+_0x126527+'))';return getZohoUser(_0x11c0a8,_0x1554('0x4f'))[_0x1554('0x26')](function(_0x46fab0){if(_0x46fab0)return _0x46fab0;if(_0x5b3cf7[_0x1554('0x42')]!=_0x1554('0x52')){return createEndUser(_0x3b5a78,_0x387fdf,_0x579526,_0x126527,_0x2affd1,_0x5b3cf7);}else{return{};}});break;case _0x1554('0x53'):_0x11c0a8['uri']=_0x1554('0x3f')+_0x387fdf+_0x1554('0x50')+_0x126527+'))';return getZohoUser(_0x11c0a8,_0x1554('0x51'))[_0x1554('0x26')](function(_0x39ac41){if(_0x39ac41)return _0x39ac41;if(_0x5b3cf7[_0x1554('0x42')]!=_0x1554('0x52')){return createEndUser(_0x3b5a78,_0x387fdf,_0x579526,_0x126527,_0x2affd1,_0x5b3cf7);}else{return{};}});break;}}function getCall(_0x48a254,_0x50c47c,_0x54e9e3,_0x8bd0e,_0x6229b9,_0x4856f9,_0x2f90ad,_0x22bc82){logger['info']('Creating\x20new\x20call...');var _0x5308e9={};_0x5308e9[_0x1554('0x54')]={'name':!_[_0x1554('0x1b')](_0x8bd0e[_0x1554('0x43')]['name'])&&!_[_0x1554('0x1b')](_0x8bd0e[_0x1554('0x37')][_0x1554('0x17')])&&_0x8bd0e[_0x1554('0x37')]['name']==='administrator'?_0x8bd0e['role'][_0x1554('0x17')]:!_[_0x1554('0x1b')](_0x8bd0e[_0x1554('0x44')])?_0x8bd0e['first_name']+'\x20'+_0x8bd0e['last_name']:_0x8bd0e[_0x1554('0x45')],'id':_0x8bd0e['id']};_0x5308e9[_0x1554('0x55')]=intUtil[_0x1554('0x56')](_0x4856f9[_0x1554('0x57')],_0x2f90ad,'\x20');_0x5308e9['Description']=intUtil[_0x1554('0x56')](_0x4856f9['Descriptions'],_0x2f90ad,'\x0a');if(_0x6229b9[_0x1554('0x3e')]===_0x1554('0x4f')){_0x5308e9[_0x1554('0x58')]={'name':!_[_0x1554('0x1b')](_0x6229b9[_0x1554('0x59')])?_0x6229b9[_0x1554('0x59')]:!_[_0x1554('0x1b')](_0x6229b9['First_Name'])?_0x6229b9[_0x1554('0x5a')]+'\x20'+_0x6229b9['Last_Name']:_0x6229b9[_0x1554('0x5b')],'id':_0x6229b9['id']};}if(_0x6229b9[_0x1554('0x3e')]===_0x1554('0x51')){_0x5308e9[_0x1554('0x5c')]={'name':!_[_0x1554('0x1b')](_0x6229b9[_0x1554('0x59')])?_0x6229b9[_0x1554('0x59')]:!_[_0x1554('0x1b')](_0x6229b9['First_Name'])?_0x6229b9[_0x1554('0x5a')]+'\x20'+_0x6229b9['Last_Name']:_0x6229b9['Last_Name'],'id':_0x6229b9['id']};_0x5308e9[_0x1554('0x5d')]=_[_0x1554('0x41')](_0x6229b9[_0x1554('0x3e')]);}if(_0x2f90ad[_0x1554('0x5e')]){_0x5308e9[_0x1554('0x5f')]=moment[_0x1554('0x60')](parseInt(_0x2f90ad[_0x1554('0x5e')])*0x3e8)[_0x1554('0x2e')](_0x1554('0x61'));}else if(_0x2f90ad[_0x1554('0x62')]&&_0x2f90ad['endtime']){_0x5308e9[_0x1554('0x5f')]=moment[_0x1554('0x60')](moment(_0x2f90ad[_0x1554('0x63')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x2f90ad[_0x1554('0x64')],_0x1554('0x65'))))[_0x1554('0x2e')]('mm:ss');}switch(_0x2f90ad[_0x1554('0x66')]){case _0x1554('0x67'):_0x5308e9[_0x1554('0x68')]=_0x1554('0x69');break;case _0x1554('0x6a'):case _0x1554('0x6b'):_0x5308e9[_0x1554('0x68')]=_0x1554('0x6c');break;case'rejected':_0x5308e9['Call_Result']=_0x1554('0x6d');break;case _0x1554('0x6e'):_0x5308e9[_0x1554('0x68')]=_0x1554('0x6f');break;case _0x1554('0x70'):_0x5308e9[_0x1554('0x68')]='Timeout';default:}_0x5308e9[_0x1554('0x71')]=(_0x22bc82===_0x1554('0x72')?moment(_0x2f90ad[_0x1554('0x64')])['format'](_0x1554('0x65')):moment(_0x2f90ad[_0x1554('0x73')])['format'](_0x1554('0x65')))||moment()[_0x1554('0x2e')](_0x1554('0x65'));_0x5308e9[_0x1554('0x74')]=_0x22bc82||_0x1554('0x75');_0x5308e9=_['merge'](_0x5308e9,getCustomFields(_0x4856f9[_0x1554('0x76')],_0x2f90ad));return request({'method':_0x1554('0x21'),'uri':_0x1554('0x3f')+_0x50c47c+'/crm/v2/Calls','headers':{'Authorization':_0x1554('0x31')+_0x48a254},'body':{'data':[_0x5308e9]},'json':!![]})[_0x1554('0x26')](function(_0x5923db){if(_0x5923db&&_0x5923db[_0x1554('0x3d')][0x0][_0x1554('0x46')]===_0x1554('0x47')){logger[_0x1554('0x2c')](_0x1554('0x77'));return{'id':_0x5923db[_0x1554('0x3d')][0x0][_0x1554('0x78')]['id']};}})[_0x1554('0x29')](function(_0x4b09bc){logger[_0x1554('0x2c')](_0x1554('0x79'),_0x4b09bc[_0x1554('0x7a')]);console[_0x1554('0x49')](_0x1554('0x79'),_0x4b09bc);});}exports[_0x1554('0x7b')]=function(_0xa98c58,_0x273661,_0x27aa69,_0x524878,_0x1f5b84,_0x33582b){var _0x1bf7e3,_0x36f5ff,_0x5c96df;_0x33582b[_0x1554('0x7c')]=intUtil[_0x1554('0x7d')](_0x33582b[_0x1554('0x7c')]);_0x33582b[_0x1554('0x7e')]=intUtil['stripTrailingSlash'](_0x33582b[_0x1554('0x7e')]);if(_0x1f5b84&&_0x1f5b84[_0x1554('0x7f')]){logger[_0x1554('0x2c')](_0x1554('0x80'),_0x1554('0x81'));_0x273661[_0x1554('0x82')]=_0x33582b[_0x1554('0x7e')]+_0x1554('0x83')+_0x273661[_0x1554('0x84')]+_0x1554('0x85')+md5(_0x273661[_0x1554('0x84')]);}else{_0x273661[_0x1554('0x82')]='';}var _0x889dfb=_0x33582b[_0x1554('0x7c')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x33582b)['then'](function(_0x184a85){_0x5c96df=_0x184a85;return getUser(_0x5c96df,_0x889dfb,_0x33582b,_0x524878[_0x1554('0x86')]);})[_0x1554('0x26')](function(_0x3d5309){_0x1bf7e3=_0x3d5309;logger[_0x1554('0x2c')]('The\x20User\x20ID\x20is:',_0x1bf7e3['id']);return getEndUser(_0x5c96df,_0x889dfb,_0x33582b,_0x273661[_0x1554('0x87')],_0x273661['calleridnum'],_0x1bf7e3,_0x27aa69);})[_0x1554('0x26')](function(_0x17f92f){_0x36f5ff=_0x17f92f;return getCall(_0x5c96df,_0x889dfb,_0x33582b,_0x1bf7e3,_0x36f5ff,_0x27aa69,_0x273661,_0x1554('0x75'));})[_0x1554('0x26')](function(_0x242cd0){if(_0x242cd0){logger[_0x1554('0x2c')](_0x1554('0x88'),_0x242cd0['id']);logger[_0x1554('0x2c')](_0x1554('0x80'),_0x1554('0x89'));emit(util[_0x1554('0x2e')]('user:%s',_0x524878['name']),'trigger:browser:url',{'uri':_0x1554('0x8a')+_0x33582b[_0x1554('0x7c')]+_0x1554('0x8b')+_0x242cd0['id']});}})[_0x1554('0x29')](function(_0x951a13){logger[_0x1554('0x2a')](_0x1554('0x80'),JSON[_0x1554('0x3b')](_0x951a13));});};exports[_0x1554('0x72')]=function(_0x451ac3,_0x405532,_0x60a60e,_0x544d7c,_0x5d3228,_0x2154af,_0x403874){var _0x5e1ca8,_0x11d1f5,_0x21eb77;_0x2154af[_0x1554('0x7c')]=intUtil[_0x1554('0x7d')](_0x2154af[_0x1554('0x7c')]);_0x2154af[_0x1554('0x7e')]=intUtil[_0x1554('0x7d')](_0x2154af[_0x1554('0x7e')]);if(_0x403874&&_0x403874[_0x1554('0x8c')]&&_0x403874[_0x1554('0x8c')]!==_0x1554('0x8d')){logger['info'](_0x1554('0x8e'),_0x1554('0x81'));_0x405532[_0x1554('0x82')]=_0x2154af['serverUrl']+'/api/voice/recordings/'+_0x405532[_0x1554('0x84')]+_0x1554('0x85')+md5(_0x405532[_0x1554('0x84')]);}var _0x4637d2=_0x2154af[_0x1554('0x7c')]==='zoho.eu'?'eu':_0x1554('0x8f');return getAccessToken(_0x2154af)[_0x1554('0x26')](function(_0x286c5f){_0x21eb77=_0x286c5f;return getUser(_0x21eb77,_0x4637d2,_0x2154af,_0x544d7c[_0x1554('0x86')]);})[_0x1554('0x26')](function(_0x44c863){_0x5e1ca8=_0x44c863;logger[_0x1554('0x2c')](_0x1554('0x90'),_0x5e1ca8['id']);return getEndUser(_0x21eb77,_0x4637d2,_0x2154af,_0x405532[_0x1554('0x91')],_0x405532[_0x1554('0x92')],_0x5e1ca8,_0x60a60e);})['then'](function(_0x5d770d){_0x11d1f5=_0x5d770d;return getCall(_0x21eb77,_0x4637d2,_0x2154af,_0x5e1ca8,_0x11d1f5,_0x60a60e,_0x405532,_0x1554('0x93'));})[_0x1554('0x26')](function(_0x11298a){if(_0x11298a){logger['info'](_0x1554('0x88'),_0x11298a['id']);logger[_0x1554('0x2c')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1554('0x2e')]('user:%s',_0x544d7c['name']),_0x1554('0x94'),{'uri':_0x1554('0x8a')+_0x2154af[_0x1554('0x7c')]+'/crm/EntityInfo.do?module=Calls&id='+_0x11298a['id']});}})['catch'](function(_0x38167d){logger[_0x1554('0x2a')](_0x1554('0x8e'),JSON['stringify'](_0x38167d));});};exports[_0x1554('0x95')]=function(_0x272b0d,_0x3cd97a,_0x59454a,_0xc5d986,_0x255dff,_0x14d902){var _0x5d7ad6,_0x6301cd,_0x15bdc4;_0x14d902[_0x1554('0x7c')]=intUtil[_0x1554('0x7d')](_0x14d902[_0x1554('0x7c')]);_0x14d902[_0x1554('0x7e')]=intUtil['stripTrailingSlash'](_0x14d902[_0x1554('0x7e')]);if(_0x255dff&&_0x255dff[_0x1554('0x7f')]){logger[_0x1554('0x2c')]('['+_0x3cd97a[_0x1554('0x66')][_0x1554('0x96')]()+']',_0x1554('0x81'));_0x3cd97a['recordingURL']=_0x14d902[_0x1554('0x7e')]+_0x1554('0x83')+_0x3cd97a['uniqueid']+_0x1554('0x85')+md5(_0x3cd97a[_0x1554('0x84')]);}else{_0x3cd97a['recordingURL']='';}var _0x11405b=_0x14d902[_0x1554('0x7c')]===_0x1554('0x97')?'eu':'com';return getAccessToken(_0x14d902)[_0x1554('0x26')](function(_0x33eda2){_0x15bdc4=_0x33eda2;return getUser(_0x15bdc4,_0x11405b,_0x14d902);})[_0x1554('0x26')](function(_0x47c1e6){_0x5d7ad6=_0x47c1e6;logger[_0x1554('0x2c')]('The\x20User\x20ID\x20is:',_0x5d7ad6['id']);return getEndUser(_0x15bdc4,_0x11405b,_0x14d902,_0x3cd97a['calleridname'],_0x3cd97a[_0x1554('0x98')],_0x5d7ad6,_0x59454a);})['then'](function(_0x5b1482){_0x6301cd=_0x5b1482;return getCall(_0x15bdc4,_0x11405b,_0x14d902,_0x5d7ad6,_0x6301cd,_0x59454a,_0x3cd97a,'Inbound');})[_0x1554('0x26')](function(_0x28e019){if(_0x28e019){logger[_0x1554('0x2c')](_0x1554('0x88'),_0x28e019['id']);}})[_0x1554('0x29')](function(_0x88be9c){logger[_0x1554('0x2a')]('['+_0x3cd97a['lastevent']['toUpperCase']()+']',JSON[_0x1554('0x3b')](_0x88be9c));});}; \ 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 2939dc8..4d1ca22 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 _0x9c63=['data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','shelljs','mustache','../../../../config/logger','trigger','exec','data2'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x9c63,0xde));var _0x39c6=function(_0x854bb4,_0x525e23){_0x854bb4=_0x854bb4-0x0;var _0x5328f6=_0x9c63[_0x854bb4];return _0x5328f6;};'use strict';var util=require('util');var sh=require(_0x39c6('0x0'));var Mustache=require(_0x39c6('0x1'));var logger=require(_0x39c6('0x2'))(_0x39c6('0x3'));exports[_0x39c6('0x4')]=function(_0x40897a,_0x2d8865){var _0x48d7f5=_0x40897a[_0x39c6('0x5')]?_0x40897a[_0x39c6('0x5')]:'Script';var _0x55c131=_0x40897a[_0x39c6('0x6')]?Mustache[_0x39c6('0x7')](_0x40897a[_0x39c6('0x6')],_0x2d8865):_0x2d8865;sh[_0x39c6('0x4')](_0x55c131,function(_0x340e38,_0x14e5bf,_0x49a2b6){if(_0x340e38!==0x0){logger[_0x39c6('0x8')](util[_0x39c6('0x9')](_0x39c6('0xa'),_0x48d7f5,_0x55c131,_0x340e38,_0x49a2b6));}else{logger[_0x39c6('0xb')](util[_0x39c6('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x48d7f5,_0x55c131,_0x14e5bf));}});}; \ No newline at end of file +var _0x4056=['mustache','../../../../config/logger','data2','Script','data3','render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','util','shelljs'];(function(_0x3398a8,_0x1612d6){var _0x3e01d2=function(_0x44a554){while(--_0x44a554){_0x3398a8['push'](_0x3398a8['shift']());}};_0x3e01d2(++_0x1612d6);}(_0x4056,0xa6));var _0x6405=function(_0x4be78f,_0x403e3e){_0x4be78f=_0x4be78f-0x0;var _0x579a45=_0x4056[_0x4be78f];return _0x579a45;};'use strict';var util=require(_0x6405('0x0'));var sh=require(_0x6405('0x1'));var Mustache=require(_0x6405('0x2'));var logger=require(_0x6405('0x3'))('trigger');exports['exec']=function(_0x29031f,_0x2f0a1a){var _0x4e6127=_0x29031f[_0x6405('0x4')]?_0x29031f[_0x6405('0x4')]:_0x6405('0x5');var _0x5a4a70=_0x29031f[_0x6405('0x6')]?Mustache[_0x6405('0x7')](_0x29031f[_0x6405('0x6')],_0x2f0a1a):_0x2f0a1a;sh[_0x6405('0x8')](_0x5a4a70,function(_0x1591f6,_0x42acf4,_0x55d66e){if(_0x1591f6!==0x0){logger[_0x6405('0x9')](util[_0x6405('0xa')](_0x6405('0xb'),_0x4e6127,_0x5a4a70,_0x1591f6,_0x55d66e));}else{logger['info'](util[_0x6405('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4e6127,_0x5a4a70,_0x42acf4));}});}; \ 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 eec984c..3b38b57 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 _0x921a=['toUpperCase','render','data5','number','headers','parse','data6','error','stack','data1','GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','util','lodash','mustache','../../../../config/logger','exec'];(function(_0x1e222c,_0x4d1635){var _0xe83ff6=function(_0x3e8c8a){while(--_0x3e8c8a){_0x1e222c['push'](_0x1e222c['shift']());}};_0xe83ff6(++_0x4d1635);}(_0x921a,0xe9));var _0xa921=function(_0x5ea482,_0x10b0ff){_0x5ea482=_0x5ea482-0x0;var _0x46217c=_0x921a[_0x5ea482];return _0x46217c;};'use strict';var rp=require('request-promise');var util=require(_0xa921('0x0'));var _=require(_0xa921('0x1'));var Mustache=require(_0xa921('0x2'));var logger=require(_0xa921('0x3'))('trigger');exports[_0xa921('0x4')]=function(_0x1459d2,_0x2f9286){var _0x476baa,_0x14089c;var _0x4f08f1={'method':_0x1459d2['data1'][_0xa921('0x5')](),'uri':Mustache[_0xa921('0x6')](_0x1459d2['data2'],_0x2f9286),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1459d2[_0xa921('0x7')])===_0xa921('0x8')&&parseInt(_0x1459d2[_0xa921('0x7')])>=0x1&&parseInt(_0x1459d2[_0xa921('0x7')])<=0xa?parseInt(_0x1459d2[_0xa921('0x7')])*0x3e8:0x5*0x3e8};try{_0x4f08f1[_0xa921('0x9')]=_0x1459d2['data6']?JSON[_0xa921('0xa')](Mustache[_0xa921('0x6')](_0x1459d2[_0xa921('0xb')],_0x2f9286)):{};}catch(_0x48abf2){logger[_0xa921('0xc')](_0x48abf2[_0xa921('0xd')]);}switch(_0x1459d2[_0xa921('0xe')][_0xa921('0x5')]()){case _0xa921('0xf'):case'DELETE':_0x476baa=null;_0x4f08f1['qs']=_0x2f9286;break;case _0xa921('0x10'):case _0xa921('0x11'):if(_0x1459d2[_0xa921('0x12')]){try{_0x476baa=JSON[_0xa921('0xa')](Mustache[_0xa921('0x6')](_0x1459d2[_0xa921('0x12')],_0x2f9286));_0x4f08f1[_0xa921('0x13')]=_0x476baa;}catch(_0x1e5255){logger[_0xa921('0xc')](_0x1e5255[_0xa921('0xd')]);logger[_0xa921('0xc')](_0xa921('0x14'));}}else{_0x476baa=_0x2f9286;_0x4f08f1[_0xa921('0x13')]=_0x476baa;}break;}logger[_0xa921('0x15')](util[_0xa921('0x16')](_0xa921('0x17'),_0x1459d2[_0xa921('0xe')],_0x1459d2[_0xa921('0x18')],JSON[_0xa921('0x19')](_0x4f08f1)));rp(_0x4f08f1)[_0xa921('0x1a')](function(_0x2e242e){_0x476baa=!_[_0xa921('0x1b')](_0x476baa)?',\x20request\x20body:\x20'+_0x476baa:'';_0x14089c=typeof _0x2e242e[_0xa921('0x13')]===_0xa921('0x1c')?JSON['stringify'](_0x2e242e[_0xa921('0x13')]):_0x2e242e[_0xa921('0x13')];logger['info'](util[_0xa921('0x16')](_0xa921('0x1d'),_0x1459d2[_0xa921('0xe')],_0x1459d2['data2'],_0x2e242e[_0xa921('0x1e')],_0x14089c));})[_0xa921('0x1f')](function(_0x533dbc){logger['error'](util[_0xa921('0x16')](_0xa921('0x20'),_0x1459d2[_0xa921('0xe')],_0x1459d2['data2'],_0x533dbc[_0xa921('0x1e')],_0x533dbc[_0xa921('0x21')],_0x533dbc['message']));});}; \ No newline at end of file +var _0x43c6=['data6','stack','DELETE','POST','PUT','data7','parse','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','message','request-promise','util','lodash','exec','data1','toUpperCase','render','data2','data5','number','headers'];(function(_0x387903,_0x2810d6){var _0x2a88cc=function(_0x10c2e5){while(--_0x10c2e5){_0x387903['push'](_0x387903['shift']());}};_0x2a88cc(++_0x2810d6);}(_0x43c6,0x12b));var _0x643c=function(_0x267ee7,_0x59e027){_0x267ee7=_0x267ee7-0x0;var _0x1251f5=_0x43c6[_0x267ee7];return _0x1251f5;};'use strict';var rp=require(_0x643c('0x0'));var util=require(_0x643c('0x1'));var _=require(_0x643c('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports[_0x643c('0x3')]=function(_0x3026e7,_0x72249e){var _0x166a79,_0x5742f8;var _0x2bed65={'method':_0x3026e7[_0x643c('0x4')][_0x643c('0x5')](),'uri':Mustache[_0x643c('0x6')](_0x3026e7[_0x643c('0x7')],_0x72249e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3026e7[_0x643c('0x8')])===_0x643c('0x9')&&parseInt(_0x3026e7[_0x643c('0x8')])>=0x1&&parseInt(_0x3026e7[_0x643c('0x8')])<=0xa?parseInt(_0x3026e7[_0x643c('0x8')])*0x3e8:0x5*0x3e8};try{_0x2bed65[_0x643c('0xa')]=_0x3026e7[_0x643c('0xb')]?JSON['parse'](Mustache[_0x643c('0x6')](_0x3026e7[_0x643c('0xb')],_0x72249e)):{};}catch(_0x23bf92){logger['error'](_0x23bf92[_0x643c('0xc')]);}switch(_0x3026e7[_0x643c('0x4')][_0x643c('0x5')]()){case'GET':case _0x643c('0xd'):_0x166a79=null;_0x2bed65['qs']=_0x72249e;break;case _0x643c('0xe'):case _0x643c('0xf'):if(_0x3026e7[_0x643c('0x10')]){try{_0x166a79=JSON[_0x643c('0x11')](Mustache[_0x643c('0x6')](_0x3026e7[_0x643c('0x10')],_0x72249e));_0x2bed65[_0x643c('0x12')]=_0x166a79;}catch(_0x1c6c90){logger[_0x643c('0x13')](_0x1c6c90[_0x643c('0xc')]);logger[_0x643c('0x13')](_0x643c('0x14'));}}else{_0x166a79=_0x72249e;_0x2bed65['body']=_0x166a79;}break;}logger[_0x643c('0x15')](util[_0x643c('0x16')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3026e7[_0x643c('0x4')],_0x3026e7[_0x643c('0x7')],JSON[_0x643c('0x17')](_0x2bed65)));rp(_0x2bed65)[_0x643c('0x18')](function(_0x256de1){_0x166a79=!_[_0x643c('0x19')](_0x166a79)?_0x643c('0x1a')+_0x166a79:'';_0x5742f8=typeof _0x256de1[_0x643c('0x12')]===_0x643c('0x1b')?JSON[_0x643c('0x17')](_0x256de1[_0x643c('0x12')]):_0x256de1[_0x643c('0x12')];logger['info'](util['format'](_0x643c('0x1c'),_0x3026e7['data1'],_0x3026e7[_0x643c('0x7')],_0x256de1[_0x643c('0x1d')],_0x5742f8));})['catch'](function(_0x119c80){logger[_0x643c('0x13')](util[_0x643c('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3026e7[_0x643c('0x4')],_0x3026e7['data2'],_0x119c80[_0x643c('0x1d')],_0x119c80['name'],_0x119c80[_0x643c('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 5c3db07..e0b1c0a 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 _0xdde7=['bluebird','routing','client','http','Request','request','debug','rpc','error','message','result','catch'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xdde7,0xc0));var _0x7dde=function(_0x42a791,_0x16ab08){_0x42a791=_0x42a791-0x0;var _0x28349b=_0xdde7[_0x42a791];return _0x28349b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7dde('0x0'));var logger=require('../../config/logger')(_0x7dde('0x1'));var client=jayson[_0x7dde('0x2')][_0x7dde('0x3')]({'port':0x2329});client[_0x7dde('0x4')]=function(_0x4bf1ec,_0x34c35e){return new BPromise(function(_0x350094,_0x5f1491){return client[_0x7dde('0x5')](_0x4bf1ec,_0x34c35e)['then'](function(_0x33a733){logger[_0x7dde('0x6')](_0x7dde('0x7'),_0x7dde('0x1'),_0x4bf1ec,_0x34c35e,_0x33a733);if(_0x33a733[_0x7dde('0x8')]){logger[_0x7dde('0x8')](_0x7dde('0x7'),_0x7dde('0x1'),_0x4bf1ec,_0x33a733[_0x7dde('0x8')]['message'],_0x34c35e);return _0x5f1491(_0x33a733[_0x7dde('0x8')][_0x7dde('0x9')]);}else{return _0x350094(_0x33a733[_0x7dde('0xa')]);}})[_0x7dde('0xb')](function(_0x323b2f){logger[_0x7dde('0x8')](_0x7dde('0x7'),_0x7dde('0x1'),_0x4bf1ec,_0x323b2f,_0x34c35e);return _0x5f1491(_0x323b2f);});});};module['exports']=client; \ No newline at end of file +var _0x6eb2=['http','Request','request','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6eb2,0xa3));var _0x26eb=function(_0x1e271f,_0xf14504){_0x1e271f=_0x1e271f-0x0;var _0x2b2ac5=_0x6eb2[_0x1e271f];return _0x2b2ac5;};'use strict';var jayson=require(_0x26eb('0x0'));var BPromise=require(_0x26eb('0x1'));var logger=require(_0x26eb('0x2'))(_0x26eb('0x3'));var client=jayson[_0x26eb('0x4')][_0x26eb('0x5')]({'port':0x2329});client[_0x26eb('0x6')]=function(_0x48ecdb,_0x40f533){return new BPromise(function(_0x1ac22c,_0x2ed5bc){return client[_0x26eb('0x7')](_0x48ecdb,_0x40f533)['then'](function(_0x73f252){logger['debug'](_0x26eb('0x8'),_0x26eb('0x3'),_0x48ecdb,_0x40f533,_0x73f252);if(_0x73f252['error']){logger[_0x26eb('0x9')](_0x26eb('0x8'),_0x26eb('0x3'),_0x48ecdb,_0x73f252[_0x26eb('0x9')][_0x26eb('0xa')],_0x40f533);return _0x2ed5bc(_0x73f252[_0x26eb('0x9')][_0x26eb('0xa')]);}else{return _0x1ac22c(_0x73f252[_0x26eb('0xb')]);}})[_0x26eb('0xc')](function(_0x2a3b13){logger[_0x26eb('0x9')](_0x26eb('0x8'),_0x26eb('0x3'),_0x48ecdb,_0x2a3b13,_0x40f533);return _0x2ed5bc(_0x2a3b13);});});};module[_0x26eb('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 7346646..22e1c1d 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 _0xdec6=['../../config/logger','email','resolve','then','initMailAccounts','mailAccounts','listen','loginMailFrequency','catch','error','./server','./realtime','./rpc/mailAccount','./rpc/setting'];(function(_0x46f551,_0x410456){var _0x34c1d5=function(_0x269dd8){while(--_0x269dd8){_0x46f551['push'](_0x46f551['shift']());}};_0x34c1d5(++_0x410456);}(_0xdec6,0x14c));var _0x6dec=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xdec6[_0x298ed3];return _0x5aad28;};'use strict';var server=require(_0x6dec('0x0'));var Realtime=require(_0x6dec('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x6dec('0x2'));var setting=require(_0x6dec('0x3'));var logger=require(_0x6dec('0x4'))(_0x6dec('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x6dec('0x6')]()[_0x6dec('0x7')](mailAccount['getMailAccounts']())[_0x6dec('0x7')](realtime[_0x6dec('0x8')]())[_0x6dec('0x7')](function(){email['refresh'](realtime[_0x6dec('0x9')]);return realtime;});}function main(){return server[_0x6dec('0xa')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})['then'](function(_0x12b83f){return setInterval(initRealtime,_0x12b83f[_0x6dec('0xb')]*0x3e8);})[_0x6dec('0xc')](function(_0x3165af){logger[_0x6dec('0xd')]('Email\x20service\x20initialization',_0x3165af);});}main(); \ No newline at end of file +var _0xe41b=['resolve','getMailAccounts','then','mailAccounts','loginMailFrequency','catch','Email\x20service\x20initialization','./realtime','./rpc/mailAccount','./rpc/setting','email'];(function(_0x5332b3,_0x4fc529){var _0xd7a56e=function(_0x2abbe6){while(--_0x2abbe6){_0x5332b3['push'](_0x5332b3['shift']());}};_0xd7a56e(++_0x4fc529);}(_0xe41b,0x17d));var _0xbe41=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xe41b[_0x363ef8];return _0x148822;};'use strict';var server=require('./server');var Realtime=require(_0xbe41('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xbe41('0x1'));var setting=require(_0xbe41('0x2'));var logger=require('../../config/logger')(_0xbe41('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xbe41('0x4')]()['then'](mailAccount[_0xbe41('0x5')]())[_0xbe41('0x6')](realtime['initMailAccounts']())[_0xbe41('0x6')](function(){email['refresh'](realtime[_0xbe41('0x7')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xbe41('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})['then'](function(_0x13383d){return setInterval(initRealtime,_0x13383d[_0xbe41('0x8')]*0x3e8);})[_0xbe41('0x9')](function(_0x4fa2fb){logger['error'](_0xbe41('0xa'),_0x4fa2fb);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 3d42c4f..88ab82d 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 _0xbe2f=['socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','prototype','hasOwnProperty','service','custom','provider','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xbe2f,0x19b));var _0xfbe2=function(_0x3a588e,_0x2254fd){_0x3a588e=_0x3a588e-0x0;var _0x9cc8fc=_0xbe2f[_0x3a588e];return _0x9cc8fc;};'use strict';var _=require(_0xfbe2('0x0'));var moment=require(_0xfbe2('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0xfbe2('0x2'));var config=require(_0xfbe2('0x3'));var logger=require(_0xfbe2('0x4'))(_0xfbe2('0x5'));config[_0xfbe2('0x6')]=_[_0xfbe2('0x7')](config[_0xfbe2('0x6')],{'host':_0xfbe2('0x8'),'port':0x18eb});var io=require(_0xfbe2('0x9'))(new Redis(config[_0xfbe2('0x6')]));var EmailImap=require(_0xfbe2('0xa'));var EmailSmtp=require(_0xfbe2('0xb'));var mailAccount=require(_0xfbe2('0xc'));var md5Accounts={};function EmailChannel(_0x3a8cf9){logger[_0xfbe2('0xd')](_0xfbe2('0xe'));this[_0xfbe2('0xf')]=_0x3a8cf9[_0xfbe2('0xf')];this[_0xfbe2('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xfbe2('0x11')]=function(_0x4787b0){var _0x3d64b7=this[_0xfbe2('0xf')][_0x4787b0];var _0x380456={'id':_0x3d64b7['id'],'name':_0x3d64b7[_0xfbe2('0x12')],'key':_0x3d64b7[_0xfbe2('0x13')],'active':_0x3d64b7[_0xfbe2('0x14')],'Imap':{'status':_0x3d64b7[_0xfbe2('0x15')][_0xfbe2('0x16')],'messageStatus':_0x3d64b7['Imap'][_0xfbe2('0x17')],'total':_0x3d64b7[_0xfbe2('0x15')]['total']}};if(_[_0xfbe2('0x18')](md5Accounts[_0x4787b0])){md5Accounts[_0x4787b0]={};}var _0x1f6b01=md5(JSON[_0xfbe2('0x19')](_0x380456));if(md5Accounts[_0x4787b0]['md5']!==_0x1f6b01){md5Accounts[_0x4787b0]['md5']=_0x1f6b01;io['emit'](_0xfbe2('0x1a'),_0x380456);}};EmailChannel[_0xfbe2('0x1b')]['refresh']=function(_0x2e1122){for(var _0x3db836 in _0x2e1122){if(_0x2e1122[_0xfbe2('0x1c')](_0x3db836)){if(_0x2e1122[_0x3db836][_0xfbe2('0x15')]&&_0x2e1122[_0x3db836]['active']){var _0x329402=_0x2e1122[_0x3db836][_0xfbe2('0x15')];if(!_0x329402[_0xfbe2('0x1d')]&&_0x2e1122[_0x3db836]['provider']!==_0xfbe2('0x1e'))_0x329402[_0xfbe2('0x1d')]=_0x2e1122[_0x3db836][_0xfbe2('0x1f')];if(!this[_0xfbe2('0x10')][_0xfbe2('0x1c')](_0x329402['id'])){this[_0xfbe2('0x10')][_0x329402['id']]=new EmailImap(_0x329402,_0x2e1122[_0x3db836][_0xfbe2('0x5')]);this['imapAccounts'][_0x329402['id']]['on'](_0xfbe2('0x20'),this[_0xfbe2('0x21')][_0xfbe2('0x22')](this,_0x3db836));this[_0xfbe2('0x10')][_0x329402['id']]['on'](_0xfbe2('0x5'),this['handleImapEmail'][_0xfbe2('0x22')](this,_0x3db836));this['imapAccounts'][_0x329402['id']]['on'](_0xfbe2('0x23'),this[_0xfbe2('0x24')][_0xfbe2('0x22')](this,_0x3db836));this[_0xfbe2('0x10')][_0x329402['id']]['on'](_0xfbe2('0x25'),this[_0xfbe2('0x26')][_0xfbe2('0x22')](this,_0x3db836));}}else{if(_[_0xfbe2('0x18')](this[_0xfbe2('0xf')][_0x3db836][_0xfbe2('0x15')])){this[_0xfbe2('0xf')][_0x3db836][_0xfbe2('0x15')]={};}this[_0xfbe2('0xf')][_0x3db836][_0xfbe2('0x15')][_0xfbe2('0x16')]=_0xfbe2('0x27');this['mailAccounts'][_0x3db836]['Imap'][_0xfbe2('0x17')]='';this['emit'](_0x3db836);}}}};EmailChannel['prototype'][_0xfbe2('0x21')]=function(_0x5710de,_0x2244e3){if(this[_0xfbe2('0xf')][_0x5710de]){this['mailAccounts'][_0x5710de][_0xfbe2('0x15')]['status']=_0xfbe2('0x28');this[_0xfbe2('0xf')][_0x5710de][_0xfbe2('0x15')][_0xfbe2('0x17')]=_0x2244e3[_0xfbe2('0x12')];if(_0x2244e3[_0xfbe2('0x29')]){this['mailAccounts'][_0x5710de][_0xfbe2('0x15')]['total']=_0x2244e3[_0xfbe2('0x29')]['total'];}return this[_0xfbe2('0x11')](_0x5710de);}};EmailChannel[_0xfbe2('0x1b')][_0xfbe2('0x2a')]=function(_0x102580,_0x17540a){logger['info'](_0xfbe2('0x2b'),_0x17540a[_0xfbe2('0x2c')],_0x17540a[_0xfbe2('0x2d')],_0x17540a[_0xfbe2('0x2e')],_0x102580);if(this[_0xfbe2('0xf')][_0x102580]){return mailAccount[_0xfbe2('0x2f')](_0x102580,_0x17540a)[_0xfbe2('0x30')](function(_0x175b03){if(_0x175b03){logger[_0xfbe2('0xd')](_0xfbe2('0x31'));}})[_0xfbe2('0x32')](function(_0x185040){logger[_0xfbe2('0x25')](_0xfbe2('0x33'),JSON[_0xfbe2('0x19')](_0x185040));});}};EmailChannel[_0xfbe2('0x1b')]['handleImapEnd']=function(_0x44a508){if(this[_0xfbe2('0xf')][_0x44a508]&&this[_0xfbe2('0xf')][_0x44a508][_0xfbe2('0x15')]){if(this[_0xfbe2('0x10')][this[_0xfbe2('0xf')][_0x44a508]['Imap']['id']]){delete this[_0xfbe2('0x10')][this[_0xfbe2('0xf')][_0x44a508]['Imap']['id']];}this[_0xfbe2('0xf')][_0x44a508][_0xfbe2('0x15')][_0xfbe2('0x34')]=moment();this['emit'](_0x44a508);}};EmailChannel['prototype'][_0xfbe2('0x26')]=function(_0x5cd25f,_0x2af124){if(this[_0xfbe2('0xf')][_0x5cd25f]){this[_0xfbe2('0xf')][_0x5cd25f]['Imap'][_0xfbe2('0x16')]=_0xfbe2('0x25');this[_0xfbe2('0xf')][_0x5cd25f][_0xfbe2('0x15')][_0xfbe2('0x17')]=_0x2af124;return this[_0xfbe2('0x11')](_0x5cd25f);}};EmailChannel[_0xfbe2('0x1b')]['sendMail']=function(_0x4abbbe,_0x32c15d){return this[_0xfbe2('0x35')][_0xfbe2('0x36')](_0x4abbbe,_0x32c15d);};EmailChannel[_0xfbe2('0x1b')][_0xfbe2('0x37')]=function(_0x2c0cfb){var _0x1d05ee=this;if(this[_0xfbe2('0xf')][_0x2c0cfb['id']]){if(_[_0xfbe2('0x18')](this[_0xfbe2('0xf')][_0x2c0cfb['id']][_0xfbe2('0x38')])){this[_0xfbe2('0xf')][_0x2c0cfb['id']][_0xfbe2('0x38')]={};}this[_0xfbe2('0xf')][_0x2c0cfb['id']][_0xfbe2('0x38')][_0xfbe2('0x34')]=moment();return new BPromise(function(_0x232f11,_0x82c368){return _0x1d05ee[_0xfbe2('0x35')][_0xfbe2('0x39')](_0x2c0cfb)[_0xfbe2('0x30')](function(_0x3dbe7f){_0x1d05ee['mailAccounts'][_0x2c0cfb['id']]['Smtp']['status']=_0xfbe2('0x3a');_0x1d05ee['mailAccounts'][_0x2c0cfb['id']][_0xfbe2('0x38')][_0xfbe2('0x17')]='';_0x1d05ee[_0xfbe2('0x11')](_0x2c0cfb['id']);_0x232f11(_0x3dbe7f);})['catch'](function(_0x356bef){_0x1d05ee[_0xfbe2('0xf')][_0x2c0cfb['id']][_0xfbe2('0x38')][_0xfbe2('0x16')]=_0xfbe2('0x25');_0x1d05ee['mailAccounts'][_0x2c0cfb['id']][_0xfbe2('0x38')][_0xfbe2('0x17')]=_0x356bef;_0x1d05ee['emit'](_0x2c0cfb['id']);_0x82c368(_0x356bef);});});}return this['smtp'][_0xfbe2('0x39')](_0x2c0cfb);};module[_0xfbe2('0x3b')]=EmailChannel; \ No newline at end of file +var _0x2865=['verify','verified','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','key','active','status','Imap','messageStatus','total','isNil','emit','mailAccount:update','prototype','refresh','hasOwnProperty','service','provider','custom','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','name','messages','firstName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','handleImapError','send','verifySmtp','Smtp'];(function(_0x564e9f,_0x225a15){var _0x3a9f3e=function(_0x1bbe48){while(--_0x1bbe48){_0x564e9f['push'](_0x564e9f['shift']());}};_0x3a9f3e(++_0x225a15);}(_0x2865,0xae));var _0x5286=function(_0x4418ad,_0x49e955){_0x4418ad=_0x4418ad-0x0;var _0x5a2574=_0x2865[_0x4418ad];return _0x5a2574;};'use strict';var _=require(_0x5286('0x0'));var moment=require(_0x5286('0x1'));var BPromise=require(_0x5286('0x2'));var md5=require(_0x5286('0x3'));var Redis=require('ioredis');var config=require(_0x5286('0x4'));var logger=require(_0x5286('0x5'))('email');config[_0x5286('0x6')]=_[_0x5286('0x7')](config[_0x5286('0x6')],{'host':_0x5286('0x8'),'port':0x18eb});var io=require(_0x5286('0x9'))(new Redis(config[_0x5286('0x6')]));var EmailImap=require(_0x5286('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x5286('0xb'));var md5Accounts={};function EmailChannel(_0x1db5c2){logger[_0x5286('0xc')](_0x5286('0xd'));this['mailAccounts']=_0x1db5c2[_0x5286('0xe')];this[_0x5286('0xf')]={};this[_0x5286('0x10')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x52c645){var _0x3268a0=this[_0x5286('0xe')][_0x52c645];var _0x272b9e={'id':_0x3268a0['id'],'name':_0x3268a0['name'],'key':_0x3268a0[_0x5286('0x11')],'active':_0x3268a0[_0x5286('0x12')],'Imap':{'status':_0x3268a0['Imap'][_0x5286('0x13')],'messageStatus':_0x3268a0[_0x5286('0x14')][_0x5286('0x15')],'total':_0x3268a0[_0x5286('0x14')][_0x5286('0x16')]}};if(_[_0x5286('0x17')](md5Accounts[_0x52c645])){md5Accounts[_0x52c645]={};}var _0x548140=md5(JSON['stringify'](_0x272b9e));if(md5Accounts[_0x52c645]['md5']!==_0x548140){md5Accounts[_0x52c645][_0x5286('0x3')]=_0x548140;io[_0x5286('0x18')](_0x5286('0x19'),_0x272b9e);}};EmailChannel[_0x5286('0x1a')][_0x5286('0x1b')]=function(_0x3a0736){for(var _0x4bebdc in _0x3a0736){if(_0x3a0736[_0x5286('0x1c')](_0x4bebdc)){if(_0x3a0736[_0x4bebdc][_0x5286('0x14')]&&_0x3a0736[_0x4bebdc]['active']){var _0x475103=_0x3a0736[_0x4bebdc][_0x5286('0x14')];if(!_0x475103[_0x5286('0x1d')]&&_0x3a0736[_0x4bebdc][_0x5286('0x1e')]!==_0x5286('0x1f'))_0x475103[_0x5286('0x1d')]=_0x3a0736[_0x4bebdc]['provider'];if(!this[_0x5286('0xf')]['hasOwnProperty'](_0x475103['id'])){this['imapAccounts'][_0x475103['id']]=new EmailImap(_0x475103,_0x3a0736[_0x4bebdc][_0x5286('0x20')]);this[_0x5286('0xf')][_0x475103['id']]['on'](_0x5286('0x21'),this[_0x5286('0x22')][_0x5286('0x23')](this,_0x4bebdc));this['imapAccounts'][_0x475103['id']]['on'](_0x5286('0x20'),this[_0x5286('0x24')][_0x5286('0x23')](this,_0x4bebdc));this[_0x5286('0xf')][_0x475103['id']]['on'](_0x5286('0x25'),this[_0x5286('0x26')]['bind'](this,_0x4bebdc));this[_0x5286('0xf')][_0x475103['id']]['on'](_0x5286('0x27'),this['handleImapError'][_0x5286('0x23')](this,_0x4bebdc));}}else{if(_[_0x5286('0x17')](this['mailAccounts'][_0x4bebdc][_0x5286('0x14')])){this[_0x5286('0xe')][_0x4bebdc][_0x5286('0x14')]={};}this[_0x5286('0xe')][_0x4bebdc][_0x5286('0x14')]['status']='disabled';this['mailAccounts'][_0x4bebdc][_0x5286('0x14')][_0x5286('0x15')]='';this[_0x5286('0x18')](_0x4bebdc);}}}};EmailChannel[_0x5286('0x1a')][_0x5286('0x22')]=function(_0x3c024b,_0x48f80a){if(this[_0x5286('0xe')][_0x3c024b]){this[_0x5286('0xe')][_0x3c024b][_0x5286('0x14')]['status']='connected';this[_0x5286('0xe')][_0x3c024b][_0x5286('0x14')]['messageStatus']=_0x48f80a[_0x5286('0x28')];if(_0x48f80a[_0x5286('0x29')]){this[_0x5286('0xe')][_0x3c024b]['Imap']['total']=_0x48f80a[_0x5286('0x29')][_0x5286('0x16')];}return this[_0x5286('0x18')](_0x3c024b);}};EmailChannel[_0x5286('0x1a')][_0x5286('0x24')]=function(_0x3fe389,_0x2ea860){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x2ea860[_0x5286('0x2a')],_0x2ea860['lastName'],_0x2ea860[_0x5286('0x2b')],_0x3fe389);if(this[_0x5286('0xe')][_0x3fe389]){return mailAccount['notify'](_0x3fe389,_0x2ea860)[_0x5286('0x2c')](function(_0x2f68c8){if(_0x2f68c8){logger[_0x5286('0xc')](_0x5286('0x2d'));}})[_0x5286('0x2e')](function(_0xa2f2b){logger[_0x5286('0x27')](_0x5286('0x2f'),JSON[_0x5286('0x30')](_0xa2f2b));});}};EmailChannel[_0x5286('0x1a')][_0x5286('0x26')]=function(_0x128738){if(this['mailAccounts'][_0x128738]&&this['mailAccounts'][_0x128738][_0x5286('0x14')]){if(this[_0x5286('0xf')][this[_0x5286('0xe')][_0x128738][_0x5286('0x14')]['id']]){delete this[_0x5286('0xf')][this[_0x5286('0xe')][_0x128738][_0x5286('0x14')]['id']];}this['mailAccounts'][_0x128738][_0x5286('0x14')][_0x5286('0x31')]=moment();this['emit'](_0x128738);}};EmailChannel['prototype'][_0x5286('0x32')]=function(_0x47a9d4,_0x1e8972){if(this[_0x5286('0xe')][_0x47a9d4]){this[_0x5286('0xe')][_0x47a9d4][_0x5286('0x14')][_0x5286('0x13')]=_0x5286('0x27');this[_0x5286('0xe')][_0x47a9d4][_0x5286('0x14')][_0x5286('0x15')]=_0x1e8972;return this[_0x5286('0x18')](_0x47a9d4);}};EmailChannel[_0x5286('0x1a')]['sendMail']=function(_0x2e0356,_0x118a97){return this['smtp'][_0x5286('0x33')](_0x2e0356,_0x118a97);};EmailChannel[_0x5286('0x1a')][_0x5286('0x34')]=function(_0x1e3e1f){var _0x4b4570=this;if(this['mailAccounts'][_0x1e3e1f['id']]){if(_[_0x5286('0x17')](this['mailAccounts'][_0x1e3e1f['id']][_0x5286('0x35')])){this[_0x5286('0xe')][_0x1e3e1f['id']][_0x5286('0x35')]={};}this['mailAccounts'][_0x1e3e1f['id']][_0x5286('0x35')][_0x5286('0x31')]=moment();return new BPromise(function(_0x251970,_0x2ceaa9){return _0x4b4570[_0x5286('0x10')][_0x5286('0x36')](_0x1e3e1f)[_0x5286('0x2c')](function(_0x460eca){_0x4b4570[_0x5286('0xe')][_0x1e3e1f['id']][_0x5286('0x35')][_0x5286('0x13')]=_0x5286('0x37');_0x4b4570['mailAccounts'][_0x1e3e1f['id']][_0x5286('0x35')][_0x5286('0x15')]='';_0x4b4570[_0x5286('0x18')](_0x1e3e1f['id']);_0x251970(_0x460eca);})[_0x5286('0x2e')](function(_0x59b1a7){_0x4b4570['mailAccounts'][_0x1e3e1f['id']]['Smtp'][_0x5286('0x13')]=_0x5286('0x27');_0x4b4570['mailAccounts'][_0x1e3e1f['id']]['Smtp']['messageStatus']=_0x59b1a7;_0x4b4570['emit'](_0x1e3e1f['id']);_0x2ceaa9(_0x59b1a7);});});}return this[_0x5286('0x10')][_0x5286('0x36')](_0x1e3e1f);};module[_0x5286('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 125192d..d2ff7ea 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 _0x1307=['handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','emit','handleFetchEnd','stringify','hasOwnProperty','upperFirst','lodash','util','mailparser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','once','bind','end','handleEnd','error','handleError','connect','inherits','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','data5','password','anonymous@xcally.com','host','port','tls','autotls','prototype','handleReady','handleOpenBox','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','handleFetchError','closeBox','body'];(function(_0x535cf3,_0x2c112c){var _0x4e0ba5=function(_0x768dd8){while(--_0x768dd8){_0x535cf3['push'](_0x535cf3['shift']());}};_0x4e0ba5(++_0x2c112c);}(_0x1307,0xfb));var _0x7130=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x1307[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x7130('0x0'));var util=require(_0x7130('0x1'));var Imap=require('imap');var simpleParser=require(_0x7130('0x2'))['simpleParser'];var Iconv=require(_0x7130('0x3'))[_0x7130('0x4')];var EventEmitter=require(_0x7130('0x5'))[_0x7130('0x6')];var utils=require(_0x7130('0x7'));var logger=require(_0x7130('0x8'))(_0x7130('0x9'));function EmailImap(_0x49a662,_0x28b117){this[_0x7130('0xa')]=_0x49a662[_0x7130('0xa')];this[_0x7130('0xb')]=this[_0x7130('0xc')](_0x49a662,_0x28b117);this[_0x7130('0xd')]=new Imap(this['account']);this[_0x7130('0xd')][_0x7130('0xe')]('ready',this['handleReady'][_0x7130('0xf')](this));this['imap'][_0x7130('0xe')](_0x7130('0x10'),this[_0x7130('0x11')][_0x7130('0xf')](this));this[_0x7130('0xd')]['on'](_0x7130('0x12'),this[_0x7130('0x13')][_0x7130('0xf')](this));this['imap'][_0x7130('0x14')]();}util[_0x7130('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0x7130('0xc')]=function(_0x31d3cb,_0x3072eb){var _0x4e2162={'connTimeout':_0x31d3cb[_0x7130('0x16')]?_0x31d3cb[_0x7130('0x16')]*0x3e8:0x2710,'authTimeout':_0x31d3cb[_0x7130('0x17')]?_0x31d3cb[_0x7130('0x17')]*0x3e8:0x1388};if(_0x31d3cb[_0x7130('0x18')]){_0x4e2162[_0x7130('0x19')]=_0x31d3cb[_0x7130('0x19')];if(_0x31d3cb['modernAuthentication']){_0x4e2162[_0x7130('0x1a')]=utils[_0x7130('0x1b')](_0x31d3cb['CloudProvider'][_0x7130('0x1c')],_0x31d3cb[_0x7130('0x19')]);}else{_0x4e2162[_0x7130('0x1d')]=_0x31d3cb[_0x7130('0x1d')];}}else{if(_0x31d3cb['authentication']){_0x4e2162[_0x7130('0x19')]=_0x31d3cb[_0x7130('0x19')];_0x4e2162[_0x7130('0x1d')]=_0x31d3cb[_0x7130('0x1d')];}}_0x4e2162[_0x7130('0x9')]=_0x3072eb||_0x31d3cb['user']||_0x7130('0x1e');_0x4e2162[_0x7130('0x1f')]=_0x31d3cb[_0x7130('0x1f')];_0x4e2162[_0x7130('0x20')]=_0x31d3cb[_0x7130('0x20')]||0x3e1;if(_0x31d3cb[_0x7130('0x21')]){_0x4e2162['tls']=!![];}else{_0x4e2162[_0x7130('0x21')]=![];_0x4e2162[_0x7130('0x22')]='required';}return _0x4e2162;};EmailImap[_0x7130('0x23')][_0x7130('0x24')]=function(){this[_0x7130('0xd')]['openBox'](this[_0x7130('0xa')],![],this[_0x7130('0x25')]['bind'](this));};EmailImap[_0x7130('0x23')][_0x7130('0x25')]=function(_0x3f0d57,_0xcce6fa){if(_0x3f0d57){this[_0x7130('0x13')](_0x3f0d57,!![]);}else{this['emit'](_0x7130('0x26'),_0xcce6fa);this['readUnseen']();}};EmailImap['prototype'][_0x7130('0x27')]=function(_0x4b7676){if(_0x4b7676){this[_0x7130('0x13')](_0x4b7676,!![]);}else{this[_0x7130('0xd')][_0x7130('0x10')]();}};EmailImap['prototype'][_0x7130('0x28')]=function(){this[_0x7130('0xd')][_0x7130('0x29')]([_0x7130('0x2a')],this[_0x7130('0x2b')]['bind'](this));};EmailImap[_0x7130('0x23')][_0x7130('0x2b')]=function(_0x1980c0,_0x1856e3){if(_0x1980c0){this[_0x7130('0x13')](_0x1980c0,!![]);}else{if(_0x1856e3['length']){try{var _0x379ebb=this['imap']['fetch'](_0x1856e3,{'bodies':'','markSeen':!![]});_0x379ebb['on'](_0x7130('0x2c'),this[_0x7130('0x2d')][_0x7130('0xf')](this));_0x379ebb[_0x7130('0xe')](_0x7130('0x12'),this[_0x7130('0x2e')][_0x7130('0xf')](this));_0x379ebb[_0x7130('0xe')](_0x7130('0x10'),this['handleFetchEnd'][_0x7130('0xf')](this));}catch(_0xdeedd6){logger[_0x7130('0x12')](_0xdeedd6);}}else{this['imap'][_0x7130('0x2f')](!![],this['handleCloseBox'][_0x7130('0xf')](this));}}};EmailImap[_0x7130('0x23')]['handleFetchMessage']=function(_0x4bc894){_0x4bc894['on'](_0x7130('0x30'),this[_0x7130('0x31')][_0x7130('0xf')](this));_0x4bc894[_0x7130('0xe')](_0x7130('0x32'),this[_0x7130('0x33')]['bind'](this));_0x4bc894[_0x7130('0xe')](_0x7130('0x10'),this['handleMessageEnd'][_0x7130('0xf')](this));};EmailImap[_0x7130('0x23')][_0x7130('0x31')]=function(_0x1436c1){simpleParser(_0x1436c1,{'Iconv':Iconv},this[_0x7130('0x34')][_0x7130('0xf')](this));};EmailImap['prototype'][_0x7130('0x33')]=function(){};EmailImap[_0x7130('0x23')][_0x7130('0x35')]=function(){};EmailImap[_0x7130('0x23')]['handleSimpleParser']=function(_0x345fbf,_0x5e42e3){if(_0x345fbf){logger[_0x7130('0x12')](_0x345fbf);}else{var _0x182571=this;utils[_0x7130('0x36')](this[_0x7130('0xb')],_0x5e42e3,function(_0x146a8d){_0x182571[_0x7130('0x37')](_0x7130('0x9'),_0x146a8d);});}};EmailImap['prototype'][_0x7130('0x38')]=function(){this['imap'][_0x7130('0x2f')](!![],this[_0x7130('0x27')][_0x7130('0xf')](this));};EmailImap[_0x7130('0x23')][_0x7130('0x2e')]=function(_0x15f134){this[_0x7130('0x13')](_0x15f134);this[_0x7130('0xd')][_0x7130('0x2f')](!![],this['handleCloseBox'][_0x7130('0xf')](this));};EmailImap['prototype'][_0x7130('0x11')]=function(){this[_0x7130('0x37')](_0x7130('0x10'));};EmailImap[_0x7130('0x23')][_0x7130('0x13')]=function(_0x2c43b7,_0x576aa6){logger[_0x7130('0x12')](_0x7130('0x13'),this[_0x7130('0xb')][_0x7130('0x9')],JSON[_0x7130('0x39')](_0x2c43b7));var _0x553e9b='';if(_0x2c43b7){if(_0x2c43b7['textCode']){_0x553e9b=_0x2c43b7['textCode'];}else{for(var _0x1d9831 in _0x2c43b7){if(_0x2c43b7[_0x7130('0x3a')](_0x1d9831)){_0x553e9b+=_[_0x7130('0x3b')](_0x1d9831)+':\x20'+_0x2c43b7[_0x1d9831]+'\x0a';}}}}if(_0x576aa6){this['imap'][_0x7130('0x10')]();}else{this[_0x7130('0x37')]('error',_0x553e9b);this[_0x7130('0x37')](_0x7130('0x10'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xbbd2=['handleOpenBox','handleError','emit','handleCloseBox','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchEnd','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','account','getAccount','once','ready','handleReady','bind','end','error','connect','inherits','prototype','connTimeout','authTimeout','modernAuthentication','xoauth2','generateXOAuth2Token','data5','user','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','required','mailbox'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbbd2,0x111));var _0x2bbd=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xbbd2[_0x280f4a];return _0x1bb157;};'use strict';var _=require('lodash');var util=require(_0x2bbd('0x0'));var Imap=require(_0x2bbd('0x1'));var simpleParser=require(_0x2bbd('0x2'))[_0x2bbd('0x3')];var Iconv=require(_0x2bbd('0x4'))[_0x2bbd('0x5')];var EventEmitter=require('events')[_0x2bbd('0x6')];var utils=require(_0x2bbd('0x7'));var logger=require(_0x2bbd('0x8'))('email');function EmailImap(_0x16cd39,_0x11401a){this['mailbox']=_0x16cd39['mailbox'];this[_0x2bbd('0x9')]=this[_0x2bbd('0xa')](_0x16cd39,_0x11401a);this['imap']=new Imap(this[_0x2bbd('0x9')]);this['imap'][_0x2bbd('0xb')](_0x2bbd('0xc'),this[_0x2bbd('0xd')][_0x2bbd('0xe')](this));this[_0x2bbd('0x1')][_0x2bbd('0xb')](_0x2bbd('0xf'),this['handleEnd'][_0x2bbd('0xe')](this));this[_0x2bbd('0x1')]['on'](_0x2bbd('0x10'),this['handleError'][_0x2bbd('0xe')](this));this[_0x2bbd('0x1')][_0x2bbd('0x11')]();}util[_0x2bbd('0x12')](EmailImap,EventEmitter);EmailImap[_0x2bbd('0x13')][_0x2bbd('0xa')]=function(_0x18330d,_0x3d43ce){var _0x2ef051={'connTimeout':_0x18330d[_0x2bbd('0x14')]?_0x18330d['connTimeout']*0x3e8:0x2710,'authTimeout':_0x18330d[_0x2bbd('0x15')]?_0x18330d[_0x2bbd('0x15')]*0x3e8:0x1388};if(_0x18330d['service']){_0x2ef051['user']=_0x18330d['user'];if(_0x18330d[_0x2bbd('0x16')]){_0x2ef051[_0x2bbd('0x17')]=utils[_0x2bbd('0x18')](_0x18330d['CloudProvider'][_0x2bbd('0x19')],_0x18330d[_0x2bbd('0x1a')]);}else{_0x2ef051[_0x2bbd('0x1b')]=_0x18330d[_0x2bbd('0x1b')];}}else{if(_0x18330d[_0x2bbd('0x1c')]){_0x2ef051[_0x2bbd('0x1a')]=_0x18330d[_0x2bbd('0x1a')];_0x2ef051[_0x2bbd('0x1b')]=_0x18330d['password'];}}_0x2ef051[_0x2bbd('0x1d')]=_0x3d43ce||_0x18330d[_0x2bbd('0x1a')]||_0x2bbd('0x1e');_0x2ef051[_0x2bbd('0x1f')]=_0x18330d['host'];_0x2ef051['port']=_0x18330d[_0x2bbd('0x20')]||0x3e1;if(_0x18330d['tls']){_0x2ef051['tls']=!![];}else{_0x2ef051[_0x2bbd('0x21')]=![];_0x2ef051[_0x2bbd('0x22')]=_0x2bbd('0x23');}return _0x2ef051;};EmailImap['prototype'][_0x2bbd('0xd')]=function(){this[_0x2bbd('0x1')]['openBox'](this[_0x2bbd('0x24')],![],this[_0x2bbd('0x25')]['bind'](this));};EmailImap[_0x2bbd('0x13')]['handleOpenBox']=function(_0x56c178,_0x5250d8){if(_0x56c178){this[_0x2bbd('0x26')](_0x56c178,!![]);}else{this[_0x2bbd('0x27')]('box',_0x5250d8);this['readUnseen']();}};EmailImap[_0x2bbd('0x13')][_0x2bbd('0x28')]=function(_0x245fc6){if(_0x245fc6){this['handleError'](_0x245fc6,!![]);}else{this['imap'][_0x2bbd('0xf')]();}};EmailImap[_0x2bbd('0x13')][_0x2bbd('0x29')]=function(){this['imap']['search']([_0x2bbd('0x2a')],this[_0x2bbd('0x2b')][_0x2bbd('0xe')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x487c17,_0x447f6e){if(_0x487c17){this[_0x2bbd('0x26')](_0x487c17,!![]);}else{if(_0x447f6e[_0x2bbd('0x2c')]){try{var _0x29f278=this['imap'][_0x2bbd('0x2d')](_0x447f6e,{'bodies':'','markSeen':!![]});_0x29f278['on'](_0x2bbd('0x2e'),this['handleFetchMessage'][_0x2bbd('0xe')](this));_0x29f278[_0x2bbd('0xb')](_0x2bbd('0x10'),this['handleFetchError']['bind'](this));_0x29f278[_0x2bbd('0xb')](_0x2bbd('0xf'),this[_0x2bbd('0x2f')][_0x2bbd('0xe')](this));}catch(_0x30bd4f){logger[_0x2bbd('0x10')](_0x30bd4f);}}else{this[_0x2bbd('0x1')]['closeBox'](!![],this[_0x2bbd('0x28')][_0x2bbd('0xe')](this));}}};EmailImap[_0x2bbd('0x13')][_0x2bbd('0x30')]=function(_0xef0dde){_0xef0dde['on']('body',this[_0x2bbd('0x31')][_0x2bbd('0xe')](this));_0xef0dde[_0x2bbd('0xb')](_0x2bbd('0x32'),this[_0x2bbd('0x33')][_0x2bbd('0xe')](this));_0xef0dde[_0x2bbd('0xb')](_0x2bbd('0xf'),this[_0x2bbd('0x34')][_0x2bbd('0xe')](this));};EmailImap[_0x2bbd('0x13')][_0x2bbd('0x31')]=function(_0x21e555){simpleParser(_0x21e555,{'Iconv':Iconv},this['handleSimpleParser'][_0x2bbd('0xe')](this));};EmailImap[_0x2bbd('0x13')][_0x2bbd('0x33')]=function(){};EmailImap[_0x2bbd('0x13')][_0x2bbd('0x34')]=function(){};EmailImap[_0x2bbd('0x13')][_0x2bbd('0x35')]=function(_0x27a979,_0x573d97){if(_0x27a979){logger[_0x2bbd('0x10')](_0x27a979);}else{var _0x4e79d9=this;utils[_0x2bbd('0x36')](this[_0x2bbd('0x9')],_0x573d97,function(_0x4fa938){_0x4e79d9[_0x2bbd('0x27')](_0x2bbd('0x1d'),_0x4fa938);});}};EmailImap[_0x2bbd('0x13')][_0x2bbd('0x2f')]=function(){this[_0x2bbd('0x1')][_0x2bbd('0x37')](!![],this['handleCloseBox'][_0x2bbd('0xe')](this));};EmailImap[_0x2bbd('0x13')]['handleFetchError']=function(_0x520f2d){this[_0x2bbd('0x26')](_0x520f2d);this[_0x2bbd('0x1')][_0x2bbd('0x37')](!![],this[_0x2bbd('0x28')][_0x2bbd('0xe')](this));};EmailImap[_0x2bbd('0x13')][_0x2bbd('0x38')]=function(){this[_0x2bbd('0x27')](_0x2bbd('0xf'));};EmailImap['prototype'][_0x2bbd('0x26')]=function(_0x172977,_0x262065){logger['error'](_0x2bbd('0x26'),this[_0x2bbd('0x9')][_0x2bbd('0x1d')],JSON[_0x2bbd('0x39')](_0x172977));var _0x227f42='';if(_0x172977){if(_0x172977['textCode']){_0x227f42=_0x172977[_0x2bbd('0x3a')];}else{for(var _0x534e7a in _0x172977){if(_0x172977[_0x2bbd('0x3b')](_0x534e7a)){_0x227f42+=_[_0x2bbd('0x3c')](_0x534e7a)+':\x20'+_0x172977[_0x534e7a]+'\x0a';}}}}if(_0x262065){this[_0x2bbd('0x1')][_0x2bbd('0xf')]();}else{this[_0x2bbd('0x27')](_0x2bbd('0x10'),_0x227f42);this['emit'](_0x2bbd('0xf'));}};module[_0x2bbd('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4a3de89..5533f68 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 _0xb28d=['nodemailer','prototype','send','createTransport','use','compile','sendMail','toString','verify','exports'];(function(_0x27c151,_0x52c49b){var _0x5c4bf9=function(_0x45aaee){while(--_0x45aaee){_0x27c151['push'](_0x27c151['shift']());}};_0x5c4bf9(++_0x52c49b);}(_0xb28d,0xd2));var _0xdb28=function(_0x14b239,_0x3fda4e){_0x14b239=_0x14b239-0x0;var _0x3443eb=_0xb28d[_0x14b239];return _0x3443eb;};'use strict';var nodemailer=require(_0xdb28('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xdb28('0x1')][_0xdb28('0x2')]=function(_0x291d86,_0x4ed9c7){return new Promise(function(_0x392305,_0x14aa03){var _0x581adb=nodemailer[_0xdb28('0x3')](_0x291d86);_0x581adb[_0xdb28('0x4')](_0xdb28('0x5'),inlineBase64());_0x581adb[_0xdb28('0x6')](_0x4ed9c7,function(_0x19ae16,_0x48733f){if(_0x19ae16){_0x14aa03(_0x19ae16[_0xdb28('0x7')]());}else{_0x392305(_0x48733f);}});});};EmailSmtp['prototype'][_0xdb28('0x8')]=function(_0x4c9c36){return new Promise(function(_0x1f6c9a,_0x2e6c8e){var _0x1e9c11=nodemailer[_0xdb28('0x3')](_0x4c9c36);_0x1e9c11[_0xdb28('0x8')](function(_0x11de93,_0x25efba){if(_0x11de93){_0x2e6c8e(_0x11de93[_0xdb28('0x7')]());}else{if(_0x25efba){_0x1f6c9a(_0x25efba);}else{_0x2e6c8e('Not\x20verifired');}}});});};module[_0xdb28('0x9')]=EmailSmtp; \ No newline at end of file +var _0x29dc=['verify','createTransport','toString','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','send','use','compile','prototype'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x29dc,0x194));var _0xc29d=function(_0x535d98,_0x2c85cc){_0x535d98=_0x535d98-0x0;var _0xb7e456=_0x29dc[_0x535d98];return _0xb7e456;};'use strict';var nodemailer=require(_0xc29d('0x0'));var inlineBase64=require(_0xc29d('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xc29d('0x2')]=function(_0x3ce048,_0x12f9b2){return new Promise(function(_0x218bd5,_0x1871f4){var _0x324633=nodemailer['createTransport'](_0x3ce048);_0x324633[_0xc29d('0x3')](_0xc29d('0x4'),inlineBase64());_0x324633['sendMail'](_0x12f9b2,function(_0x10bfbf,_0x5ccc90){if(_0x10bfbf){_0x1871f4(_0x10bfbf['toString']());}else{_0x218bd5(_0x5ccc90);}});});};EmailSmtp[_0xc29d('0x5')][_0xc29d('0x6')]=function(_0x10b2ec){return new Promise(function(_0x5370fb,_0x569504){var _0x497e97=nodemailer[_0xc29d('0x7')](_0x10b2ec);_0x497e97['verify'](function(_0x10b2dc,_0x43138c){if(_0x10b2dc){_0x569504(_0x10b2dc[_0xc29d('0x8')]());}else{if(_0x43138c){_0x5370fb(_0x43138c);}else{_0x569504(_0xc29d('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index ac5967a..660156d 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 _0x906a=['_IMG','\x20]','textAsHtml','body','Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','join','toString','base64','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','indexOf','length','Anonymous','split','pop','isEmpty','html','test','replace','0x1?_0x50e79d['slice'](0x0,-0x1)['join']('\x20'):_0x1ac6a8[_0xa906('0xd')];}return _0xa906('0x10');}function getLastName(_0x411255){var _0x330e62=_[_0xa906('0x7')](_0x411255[_0xa906('0x8')]);if(_0x330e62&&_0x330e62[_0xa906('0xd')]){var _0x1851b7=_0x330e62['name'][_0xa906('0x11')](/\s+/);return _0x1851b7[_0xa906('0xf')]>0x1?_0x1851b7[_0xa906('0x12')]():'';}return'';}function getMails(_0x5c4409,_0x21966b){var _0x220f9d='';for(var _0x248b0a=0x0;_0x248b0a<_0x21966b[_0xa906('0x8')][_0xa906('0xf')];_0x248b0a+=0x1){if(_0x21966b[_0xa906('0x8')][_0x248b0a][_0xa906('0x9')]!==_0x5c4409){if(!_[_0xa906('0x13')](_0x220f9d)){_0x220f9d+=',';}_0x220f9d+=_0x21966b[_0xa906('0x8')][_0x248b0a][_0xa906('0xd')]||_0x21966b['value'][_0x248b0a]['address']||'';_0x220f9d+='\x20<';_0x220f9d+=_0x21966b['value'][_0x248b0a][_0xa906('0x9')]?_0x21966b[_0xa906('0x8')][_0x248b0a][_0xa906('0x9')]:_0xa906('0xa')+random[_0xa906('0xb')](0x6)+_0xa906('0xc');_0x220f9d+='>';}}return _0x220f9d;}function parseEmail(_0x4ac35a,_0x238d32,_0x5fa3f4){if(_0x238d32[_0xa906('0x14')]){var _0x2ca3a9=/)<[^<]*)*<\/script>/gi;while(_0x2ca3a9[_0xa906('0x15')](_0x238d32[_0xa906('0x14')])){_0x238d32[_0xa906('0x14')]=_0x238d32[_0xa906('0x14')][_0xa906('0x16')](_0x2ca3a9,'');}if(_0x238d32[_0xa906('0x14')]['includes'](_0xa906('0x17'))){var _0x1c459a=[];_0x238d32[_0xa906('0x18')][_0xa906('0x19')](_0x43bcbc=>{_0x1c459a['push'](_0x43bcbc[_0xa906('0x1a')]);});var _0x2a6f95=/]+>/g;var _0x1f977f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5effe3=_0x238d32[_0xa906('0x14')]['replace'](_0x1f977f,_0xa906('0x1b'));var _0x49f864=_0x5effe3[_0xa906('0x16')](_0x2a6f95,'_IMG');for(let _0x1fca3d=0x0;_0x1fca3d<_0x1c459a[_0xa906('0xf')];_0x1fca3d++){var _0x59a734=_0x49f864[_0xa906('0x16')](_0xa906('0x1c'),'\x20[Attachment:\x20'+_0x1c459a[_0x1fca3d]+_0xa906('0x1d'));_0x49f864=_0x59a734;}_0x238d32['html']=_0x49f864;}_0x5fa3f4['body']=_0x238d32['html'];}else{_0x5fa3f4['body']=_0x238d32[_0xa906('0x1e')];}if(_0x5fa3f4[_0xa906('0x1f')]){_0x5fa3f4[_0xa906('0x1f')]=_0x5fa3f4[_0xa906('0x1f')][_0xa906('0x16')](/0x0){var _0x11a893=[_0xa906('0x32'),_0xa906('0x33'),_0xa906('0x34')];for(var _0x2d8cc5=0x0;_0x2d8cc5<_0x238d32[_0xa906('0x31')][_0xa906('0xf')];_0x2d8cc5++){var _0x5e288c=_['indexOf'](_0x11a893,_0x238d32[_0xa906('0x31')][_0x2d8cc5][_0xa906('0x35')]);if(_0x5e288c>=0x0){_0x5fa3f4[_0xa906('0x36')]=!![];}}}return _0x5fa3f4;}exports[_0xa906('0x37')]=function(_0x1a2133,_0x3c5d43,_0x2a68e2){var _0x19c40e={'from':getAddress(_0x3c5d43[_0xa906('0x38')]),'firstName':getFirstName(_0x3c5d43[_0xa906('0x38')]),'lastName':getLastName(_0x3c5d43[_0xa906('0x38')]),'mapKey':_0xa906('0x22'),'message':{'from':getMails(_0x1a2133[_0xa906('0x22')],_0x3c5d43[_0xa906('0x38')]),'to':_0x1a2133[_0xa906('0x22')],'cc':'','subject':_0x3c5d43['subject']||'','messageId':_0x3c5d43[_0xa906('0x39')],'inReplyTo':_0x3c5d43[_0xa906('0x3a')],'sentAt':moment(_0x3c5d43[_0xa906('0x3b')])[_0xa906('0x3c')](_0xa906('0x3d')),'attach':![],'attachments':[]}};if(!_0x3c5d43[_0xa906('0x14')]&&!_0x3c5d43['textAsHtml']){var _0x114a5d=_[_0xa906('0x3e')](_0x3c5d43[_0xa906('0x18')],{'contentType':_0xa906('0x3f')});if(_0x114a5d['length']){logger['info'](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x3c5d43[_0xa906('0x39')]));tnef[_0xa906('0x40')](_[_0xa906('0x41')](_0x114a5d)['content'],function(_0xc91fe6,_0x2870bc){if(_0x2870bc){_0x3c5d43['html']=_0x2870bc[_0xa906('0x42')]||_0xa906('0x43');if(_0x2870bc['Attachments']){for(var _0x51c4b7=0x0;_0x51c4b7<_0x2870bc[_0xa906('0x44')][_0xa906('0xf')];_0x51c4b7++){var _0x399a0e=_0x2870bc[_0xa906('0x44')][_0x51c4b7];_0x19c40e['message']['attachments'][_0xa906('0x2f')]({'filename':_0x399a0e[_0xa906('0x45')],'content':Buffer['from'](_0x399a0e[_0xa906('0x46')])});}}}_0x2a68e2(parseEmail(_0x1a2133,_0x3c5d43,_0x19c40e));});}else{_0x3c5d43[_0xa906('0x14')]=_0xa906('0x43');_0x2a68e2(parseEmail(_0x1a2133,_0x3c5d43,_0x19c40e));}}else{_0x2a68e2(parseEmail(_0x1a2133,_0x3c5d43,_0x19c40e));}};exports['generateXOAuth2Token']=function(_0x2e8b2a,_0x12e66e){var _0x32d6e2=[_0xa906('0x47')+(_0x12e66e||''),_0xa906('0x48')+_0x2e8b2a,'',''];return Buffer[_0xa906('0x38')](_0x32d6e2[_0xa906('0x49')](''),'utf-8')[_0xa906('0x4a')](_0xa906('0x4b'));}; \ No newline at end of file +var _0x5228=['first','BodyHTML','

Empty\x20message

','Attachments','Data','user=','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','address','anonymous','generate','head','value','name','indexOf','length','join','Anonymous','split','pop','isEmpty','@xcally.com','html','replace','includes','attachments','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x194850['slice'](0x0,-0x1)[_0x8522('0xf')]('\x20'):_0x4fa59e[_0x8522('0xc')];}return _0x8522('0x10');}function getLastName(_0x329068){var _0x581ad2=_['head'](_0x329068['value']);if(_0x581ad2&&_0x581ad2[_0x8522('0xc')]){var _0x1f37dc=_0x581ad2[_0x8522('0xc')][_0x8522('0x11')](/\s+/);return _0x1f37dc['length']>0x1?_0x1f37dc[_0x8522('0x12')]():'';}return'';}function getMails(_0x4c2643,_0x5f2497){var _0x29e4d5='';for(var _0x582f49=0x0;_0x582f49<_0x5f2497['value'][_0x8522('0xe')];_0x582f49+=0x1){if(_0x5f2497['value'][_0x582f49]['address']!==_0x4c2643){if(!_[_0x8522('0x13')](_0x29e4d5)){_0x29e4d5+=',';}_0x29e4d5+=_0x5f2497[_0x8522('0xb')][_0x582f49][_0x8522('0xc')]||_0x5f2497[_0x8522('0xb')][_0x582f49][_0x8522('0x7')]||'';_0x29e4d5+='\x20<';_0x29e4d5+=_0x5f2497[_0x8522('0xb')][_0x582f49][_0x8522('0x7')]?_0x5f2497[_0x8522('0xb')][_0x582f49][_0x8522('0x7')]:_0x8522('0x8')+random[_0x8522('0x9')](0x6)+_0x8522('0x14');_0x29e4d5+='>';}}return _0x29e4d5;}function parseEmail(_0x2ea36e,_0x3588b6,_0x54669f){if(_0x3588b6[_0x8522('0x15')]){var _0x4c5054=/)<[^<]*)*<\/script>/gi;while(_0x4c5054['test'](_0x3588b6[_0x8522('0x15')])){_0x3588b6[_0x8522('0x15')]=_0x3588b6[_0x8522('0x15')][_0x8522('0x16')](_0x4c5054,'');}if(_0x3588b6[_0x8522('0x15')][_0x8522('0x17')]('{_0x43c8d0[_0x8522('0x19')](_0x3883f7[_0x8522('0x1a')]);});var _0x23a0ba=/]+>/g;var _0x35eb5d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x18ef82=_0x3588b6['html'][_0x8522('0x16')](_0x35eb5d,_0x8522('0x1b'));var _0xafd4d7=_0x18ef82[_0x8522('0x16')](_0x23a0ba,_0x8522('0x1c'));for(let _0x522421=0x0;_0x522421<_0x43c8d0[_0x8522('0xe')];_0x522421++){var _0x32f7ec=_0xafd4d7[_0x8522('0x16')](_0x8522('0x1c'),_0x8522('0x1d')+_0x43c8d0[_0x522421]+_0x8522('0x1e'));_0xafd4d7=_0x32f7ec;}_0x3588b6[_0x8522('0x15')]=_0xafd4d7;}_0x54669f[_0x8522('0x1f')]=_0x3588b6[_0x8522('0x15')];}else{_0x54669f['body']=_0x3588b6[_0x8522('0x20')];}if(_0x54669f[_0x8522('0x1f')]){_0x54669f[_0x8522('0x1f')]=_0x54669f[_0x8522('0x1f')]['replace'](/0x0){var _0x29f781=[_0x8522('0x2f'),_0x8522('0x30'),'Precedence:\x20auto_reply'];for(var _0x3deeea=0x0;_0x3deeea<_0x3588b6['headerLines'][_0x8522('0xe')];_0x3deeea++){var _0x526019=_[_0x8522('0xd')](_0x29f781,_0x3588b6[_0x8522('0x2e')][_0x3deeea][_0x8522('0x31')]);if(_0x526019>=0x0){_0x54669f[_0x8522('0x32')]=!![];}}}return _0x54669f;}exports[_0x8522('0x33')]=function(_0x2d65bc,_0x5c3849,_0x5a14da){var _0x30cdc2={'from':getAddress(_0x5c3849['from']),'firstName':getFirstName(_0x5c3849[_0x8522('0x34')]),'lastName':getLastName(_0x5c3849[_0x8522('0x34')]),'mapKey':'email','message':{'from':getMails(_0x2d65bc['email'],_0x5c3849[_0x8522('0x34')]),'to':_0x2d65bc[_0x8522('0x5')],'cc':'','subject':_0x5c3849[_0x8522('0x35')]||'','messageId':_0x5c3849[_0x8522('0x36')],'inReplyTo':_0x5c3849[_0x8522('0x37')],'sentAt':moment(_0x5c3849[_0x8522('0x38')])[_0x8522('0x39')](_0x8522('0x3a')),'attach':![],'attachments':[]}};if(!_0x5c3849[_0x8522('0x15')]&&!_0x5c3849['textAsHtml']){var _0x3801c1=_[_0x8522('0x3b')](_0x5c3849[_0x8522('0x18')],{'contentType':_0x8522('0x3c')});if(_0x3801c1[_0x8522('0xe')]){logger[_0x8522('0x3d')](util[_0x8522('0x39')](_0x8522('0x3e'),_0x5c3849['messageId']));tnef[_0x8522('0x3f')](_[_0x8522('0x40')](_0x3801c1)[_0x8522('0x2d')],function(_0x3f96f6,_0x4477ec){if(_0x4477ec){_0x5c3849[_0x8522('0x15')]=_0x4477ec[_0x8522('0x41')]||_0x8522('0x42');if(_0x4477ec[_0x8522('0x43')]){for(var _0x3e0a18=0x0;_0x3e0a18<_0x4477ec[_0x8522('0x43')][_0x8522('0xe')];_0x3e0a18++){var _0x135141=_0x4477ec['Attachments'][_0x3e0a18];_0x30cdc2[_0x8522('0x22')][_0x8522('0x18')]['push']({'filename':_0x135141['Title'],'content':Buffer['from'](_0x135141[_0x8522('0x44')])});}}}_0x5a14da(parseEmail(_0x2d65bc,_0x5c3849,_0x30cdc2));});}else{_0x5c3849['html']=_0x8522('0x42');_0x5a14da(parseEmail(_0x2d65bc,_0x5c3849,_0x30cdc2));}}else{_0x5a14da(parseEmail(_0x2d65bc,_0x5c3849,_0x30cdc2));}};exports['generateXOAuth2Token']=function(_0x5a70d2,_0x7dd521){var _0x50862b=[_0x8522('0x45')+(_0x7dd521||''),_0x8522('0x46')+_0x5a70d2,'',''];return Buffer[_0x8522('0x34')](_0x50862b[_0x8522('0xf')](''),_0x8522('0x47'))['toString'](_0x8522('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 636bfd8..ec00b1c 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 _0x7903=['Service','SERV','active','Smtp','exports','lodash','name'];(function(_0x1bfd25,_0x349005){var _0x11804d=function(_0x47334c){while(--_0x47334c){_0x1bfd25['push'](_0x1bfd25['shift']());}};_0x11804d(++_0x349005);}(_0x7903,0x124));var _0x3790=function(_0x32c65d,_0x15ada3){_0x32c65d=_0x32c65d-0x0;var _0x41e6bf=_0x7903[_0x32c65d];return _0x41e6bf;};'use strict';var _=require(_0x3790('0x0'));function MailAccount(_0x17def6){this['id']=_0x17def6['id']||0x0;this[_0x3790('0x1')]=_0x17def6[_0x3790('0x1')]||_0x3790('0x2');this['key']=_0x17def6['key']||_0x3790('0x3');this[_0x3790('0x4')]=_0x17def6[_0x3790('0x4')]||![];this['Imap']=_0x17def6['Imap']||[];this[_0x3790('0x5')]=_0x17def6['Smtp']||[];}module[_0x3790('0x6')]=MailAccount; \ No newline at end of file +var _0x6201=['key','active','Imap','Smtp','exports','name','Service'];(function(_0x5851a7,_0x41e6b9){var _0x2eebc1=function(_0xaa2575){while(--_0xaa2575){_0x5851a7['push'](_0x5851a7['shift']());}};_0x2eebc1(++_0x41e6b9);}(_0x6201,0x67));var _0x1620=function(_0x58bc88,_0x5c8581){_0x58bc88=_0x58bc88-0x0;var _0x1b9b28=_0x6201[_0x58bc88];return _0x1b9b28;};'use strict';var _=require('lodash');function MailAccount(_0x1b7aef){this['id']=_0x1b7aef['id']||0x0;this['name']=_0x1b7aef[_0x1620('0x0')]||_0x1620('0x1');this[_0x1620('0x2')]=_0x1b7aef[_0x1620('0x2')]||'SERV';this[_0x1620('0x3')]=_0x1b7aef[_0x1620('0x3')]||![];this[_0x1620('0x4')]=_0x1b7aef[_0x1620('0x4')]||[];this[_0x1620('0x5')]=_0x1b7aef[_0x1620('0x5')]||[];}module[_0x1620('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 5de6cff..6bc7718 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 _0x8ae6=['exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge'];(function(_0x46c3e8,_0x20208c){var _0x439bab=function(_0x3fabe4){while(--_0x3fabe4){_0x46c3e8['push'](_0x46c3e8['shift']());}};_0x439bab(++_0x20208c);}(_0x8ae6,0xbf));var _0x68ae=function(_0x51ee74,_0x18e42e){_0x51ee74=_0x51ee74-0x0;var _0x1971dd=_0x8ae6[_0x51ee74];return _0x1971dd;};'use strict';var _=require('lodash');var MailAccount=require(_0x68ae('0x0'));var Realtime=function(){this[_0x68ae('0x1')]={};};function freeIsNotKey(_0x14374a,_0x2835eb,_0x238312){var _0x8b08b6=_[_0x68ae('0x2')](_0x14374a,function(_0x535e29,_0x956174){return _0x535e29[_0x238312];});for(var _0x418acf in _0x2835eb){if(_0x2835eb[_0x68ae('0x3')](_0x418acf)){if(!_0x8b08b6[_0x418acf]){delete _0x2835eb[_0x418acf];}}}}Realtime[_0x68ae('0x4')]['mergeFromDatabase']=function(_0x4d45da,_0x30014f){for(var _0x3905ff in _0x30014f){if(_0x4d45da[_0x68ae('0x3')](_0x3905ff)){_0x4d45da[_0x3905ff]=_0x30014f[_0x3905ff];}}};Realtime['prototype'][_0x68ae('0x5')]=function(){var _0x11ec9a=this;return function(_0x586a58){if(_0x586a58){freeIsNotKey(_0x586a58,_0x11ec9a[_0x68ae('0x1')],'id');for(var _0x39afdf=0x0,_0x140f77={},_0x3fcabd={};_0x39afdf<_0x586a58[_0x68ae('0x6')];_0x39afdf+=0x1){_0x140f77=_0x586a58[_0x39afdf];if(_[_0x68ae('0x7')](_0x11ec9a['mailAccounts'][_0x140f77['id']])){_0x11ec9a[_0x68ae('0x1')][_0x140f77['id']]=new MailAccount(_0x140f77);}else{_[_0x68ae('0x8')](_0x11ec9a[_0x68ae('0x1')][_0x140f77['id']],_0x140f77);}}}return _0x11ec9a['mailAccounts'];};};module[_0x68ae('0x9')]=Realtime; \ No newline at end of file +var _0x2d4e=['lodash','mapKeys','hasOwnProperty','initMailAccounts','mailAccounts','isUndefined','merge','exports'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x2d4e,0xd8));var _0xe2d4=function(_0x50ab51,_0x4b8274){_0x50ab51=_0x50ab51-0x0;var _0xdf146f=_0x2d4e[_0x50ab51];return _0xdf146f;};'use strict';var _=require(_0xe2d4('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5e1ed1,_0x11b080,_0x5ce17a){var _0x31e50f=_[_0xe2d4('0x1')](_0x5e1ed1,function(_0x4e40f1,_0x1b0efb){return _0x4e40f1[_0x5ce17a];});for(var _0x62d64 in _0x11b080){if(_0x11b080[_0xe2d4('0x2')](_0x62d64)){if(!_0x31e50f[_0x62d64]){delete _0x11b080[_0x62d64];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x1cc057,_0x4e30be){for(var _0x4e9141 in _0x4e30be){if(_0x1cc057[_0xe2d4('0x2')](_0x4e9141)){_0x1cc057[_0x4e9141]=_0x4e30be[_0x4e9141];}}};Realtime['prototype'][_0xe2d4('0x3')]=function(){var _0x543ec9=this;return function(_0x10b179){if(_0x10b179){freeIsNotKey(_0x10b179,_0x543ec9[_0xe2d4('0x4')],'id');for(var _0x27956b=0x0,_0x4ff4ce={},_0x1931f9={};_0x27956b<_0x10b179['length'];_0x27956b+=0x1){_0x4ff4ce=_0x10b179[_0x27956b];if(_[_0xe2d4('0x5')](_0x543ec9[_0xe2d4('0x4')][_0x4ff4ce['id']])){_0x543ec9[_0xe2d4('0x4')][_0x4ff4ce['id']]=new MailAccount(_0x4ff4ce);}else{_[_0xe2d4('0x6')](_0x543ec9[_0xe2d4('0x4')][_0x4ff4ce['id']],_0x4ff4ce);}}}return _0x543ec9[_0xe2d4('0x4')];};};module[_0xe2d4('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 151b468..686aa20 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 _0xee9c=['Smtp','service','type','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','email','active','TemplateId','Imap','CloudProvider','data5'];(function(_0x3aac23,_0x128171){var _0x1cf0ec=function(_0xae539c){while(--_0xae539c){_0x3aac23['push'](_0x3aac23['shift']());}};_0x1cf0ec(++_0x128171);}(_0xee9c,0x1e6));var _0xcee9=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xee9c[_0x4b5813];return _0x423465;};'use strict';var client=require('../client');exports[_0xcee9('0x0')]=function(){return function(){return client[_0xcee9('0x1')](_0xcee9('0x2'),{'options':{'attributes':['id',_0xcee9('0x3'),'provider','service',_0xcee9('0x4'),_0xcee9('0x5'),'key','ListId',_0xcee9('0x6')],'raw':![],'include':[{'model':'MailServerIn','as':_0xcee9('0x7'),'include':[{'model':_0xcee9('0x8'),'attributes':['id',_0xcee9('0x3'),'service','type',_0xcee9('0x9')],'as':_0xcee9('0x8')}]},{'model':'MailServerOut','as':_0xcee9('0xa'),'include':[{'model':_0xcee9('0x8'),'attributes':['id',_0xcee9('0x3'),_0xcee9('0xb'),_0xcee9('0xc'),_0xcee9('0x9')],'as':'CloudProvider'}]}]},'log':_0xcee9('0xd')});};};exports[_0xcee9('0xe')]=function(_0x4e255a,_0x279200){return client[_0xcee9('0x1')](_0xcee9('0xf'),{'account':{'id':_0x4e255a},'body':_0x279200,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x65ec=['Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','name','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut'];(function(_0x3c432a,_0x24d1bd){var _0x528c82=function(_0x4b33e9){while(--_0x4b33e9){_0x3c432a['push'](_0x3c432a['shift']());}};_0x528c82(++_0x24d1bd);}(_0x65ec,0x16c));var _0xc65e=function(_0x2f8470,_0x5f2fc6){_0x2f8470=_0x2f8470-0x0;var _0x50b399=_0x65ec[_0x2f8470];return _0x50b399;};'use strict';var client=require(_0xc65e('0x0'));exports[_0xc65e('0x1')]=function(){return function(){return client[_0xc65e('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0xc65e('0x3'),'provider',_0xc65e('0x4'),_0xc65e('0x5'),_0xc65e('0x6'),_0xc65e('0x7'),_0xc65e('0x8'),_0xc65e('0x9')],'raw':![],'include':[{'model':_0xc65e('0xa'),'as':_0xc65e('0xb'),'include':[{'model':_0xc65e('0xc'),'attributes':['id','name',_0xc65e('0x4'),_0xc65e('0xd'),_0xc65e('0xe')],'as':_0xc65e('0xc')}]},{'model':_0xc65e('0xf'),'as':_0xc65e('0x10'),'include':[{'model':_0xc65e('0xc'),'attributes':['id','name',_0xc65e('0x4'),_0xc65e('0xd'),_0xc65e('0xe')],'as':'CloudProvider'}]}]},'log':_0xc65e('0x11')});};};exports['notify']=function(_0x2fc8d5,_0x412027){return client[_0xc65e('0x2')](_0xc65e('0x12'),{'account':{'id':_0x2fc8d5},'body':_0x412027,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 18e00ec..1bda43f 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 _0x5a52=['Request','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a52,0x1a2));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x25a5('0x0'));exports[_0x25a5('0x1')]=function(){return client[_0x25a5('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x25a5('0x3')]},'log':_0x25a5('0x4')});}; \ No newline at end of file +var _0xe601=['Request','ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x4c378e,_0x286afb){var _0xf41ce7=function(_0x48d22e){while(--_0x48d22e){_0x4c378e['push'](_0x4c378e['shift']());}};_0xf41ce7(++_0x286afb);}(_0xe601,0xca));var _0x1e60=function(_0x2d8a42,_0x5729db){_0x2d8a42=_0x2d8a42-0x0;var _0x33a820=_0xe601[_0x2d8a42];return _0x33a820;};'use strict';var client=require(_0x1e60('0x0'));exports[_0x1e60('0x1')]=function(){return client[_0x1e60('0x2')](_0x1e60('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1e60('0x4')]},'log':_0x1e60('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 715c701..3de362a 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(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 6cdfeee..59de1a1 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 _0xeb89=['adapter','socket.io-redis','default','../../config/express','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','../../config/environment','createServer','timeout','listen','port','redis'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xeb89,0x118));var _0x9eb8=function(_0xbb526f,_0x3e1ff5){_0xbb526f=_0xbb526f-0x0;var _0x38ebaf=_0xeb89[_0xbb526f];return _0x38ebaf;};'use strict';var _=require(_0x9eb8('0x0'));var http=require(_0x9eb8('0x1'));var express=require(_0x9eb8('0x2'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x9eb8('0x3'));var app=express();var server=http[_0x9eb8('0x4')](app);server[_0x9eb8('0x5')]=0xdbba0;if(sticky[_0x9eb8('0x6')](server,config[_0x9eb8('0x7')])){var socketio=require('socket.io')(server,{'transports':['websocket','polling']});config['redis']=_['defaults'](config[_0x9eb8('0x8')],{'host':'localhost','port':0x18eb});socketio[_0x9eb8('0x9')](require(_0x9eb8('0xa'))({'pubClient':new Redis(config[_0x9eb8('0x8')]),'subClient':new Redis(config[_0x9eb8('0x8')])}));require('../../config/triggers')[_0x9eb8('0xb')]();require('../../config/socketio')[_0x9eb8('0xb')](socketio);require(_0x9eb8('0xc'))[_0x9eb8('0xb')](app);require('../../routes')[_0x9eb8('0xb')](app);}else{server['once'](_0x9eb8('0xd'),function(){console[_0x9eb8('0xe')](_0x9eb8('0xf'),config[_0x9eb8('0x7')]);});}exports=module[_0x9eb8('0x10')]=app; \ No newline at end of file +var _0x0449=['express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','polling','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','listening','log','exports'];(function(_0x2059b2,_0x20c9c9){var _0x54e6a6=function(_0xa5a7a5){while(--_0xa5a7a5){_0x2059b2['push'](_0x2059b2['shift']());}};_0x54e6a6(++_0x20c9c9);}(_0x0449,0x17a));var _0x9044=function(_0xc4513,_0x1d2c15){_0xc4513=_0xc4513-0x0;var _0x8e1c14=_0x0449[_0xc4513];return _0x8e1c14;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x9044('0x0'));var sticky=require(_0x9044('0x1'));var Redis=require(_0x9044('0x2'));var config=require(_0x9044('0x3'));var app=express();var server=http[_0x9044('0x4')](app);server[_0x9044('0x5')]=0xdbba0;if(sticky['listen'](server,config[_0x9044('0x6')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x9044('0x7')]});config[_0x9044('0x8')]=_['defaults'](config['redis'],{'host':_0x9044('0x9'),'port':0x18eb});socketio['adapter'](require(_0x9044('0xa'))({'pubClient':new Redis(config[_0x9044('0x8')]),'subClient':new Redis(config['redis'])}));require(_0x9044('0xb'))[_0x9044('0xc')]();require('../../config/socketio')[_0x9044('0xc')](socketio);require(_0x9044('0xd'))[_0x9044('0xc')](app);require(_0x9044('0xe'))['default'](app);}else{server['once'](_0x9044('0xf'),function(){console[_0x9044('0x10')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x9044('0x6')]);});}exports=module[_0x9044('0x11')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 8892fc0..36f5ab8 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 _0xd1e6=['../../config/logger','routing','client','http','Request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x3ea18b,_0x3d6815){var _0x10c9c9=function(_0x5957ff){while(--_0x5957ff){_0x3ea18b['push'](_0x3ea18b['shift']());}};_0x10c9c9(++_0x3d6815);}(_0xd1e6,0x175));var _0x6d1e=function(_0x13ead7,_0x39dab0){_0x13ead7=_0x13ead7-0x0;var _0x3ca24d=_0xd1e6[_0x13ead7];return _0x3ca24d;};'use strict';var jayson=require(_0x6d1e('0x0'));var BPromise=require(_0x6d1e('0x1'));var logger=require(_0x6d1e('0x2'))(_0x6d1e('0x3'));var client=jayson[_0x6d1e('0x4')][_0x6d1e('0x5')]({'port':0x2329});client[_0x6d1e('0x6')]=function(_0x1e4867,_0x3b1714){return new BPromise(function(_0x516cfb,_0x1b101a){return client['request'](_0x1e4867,_0x3b1714)[_0x6d1e('0x7')](function(_0x909792){logger[_0x6d1e('0x8')](_0x6d1e('0x9'),_0x6d1e('0x3'),_0x1e4867,_0x3b1714,_0x909792);if(_0x909792[_0x6d1e('0xa')]){logger[_0x6d1e('0xa')](_0x6d1e('0x9'),_0x6d1e('0x3'),_0x1e4867,_0x909792[_0x6d1e('0xa')][_0x6d1e('0xb')],_0x3b1714);return _0x1b101a(_0x909792[_0x6d1e('0xa')]['message']);}else{return _0x516cfb(_0x909792[_0x6d1e('0xc')]);}})[_0x6d1e('0xd')](function(_0x47abbf){logger[_0x6d1e('0xa')]('rpc','routing',_0x1e4867,_0x47abbf,_0x3b1714);return _0x1b101a(_0x47abbf);});});};module[_0x6d1e('0xe')]=client; \ No newline at end of file +var _0x6308=['bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','jayson/promise'];(function(_0x5ca2e7,_0x1ad1d7){var _0x219cc5=function(_0x3daf5d){while(--_0x3daf5d){_0x5ca2e7['push'](_0x5ca2e7['shift']());}};_0x219cc5(++_0x1ad1d7);}(_0x6308,0x1cd));var _0x8630=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x6308[_0x550d12];return _0x12103d;};'use strict';var jayson=require(_0x8630('0x0'));var BPromise=require(_0x8630('0x1'));var logger=require(_0x8630('0x2'))(_0x8630('0x3'));var client=jayson[_0x8630('0x4')][_0x8630('0x5')]({'port':0x2329});client[_0x8630('0x6')]=function(_0x44281b,_0x25bb4c){return new BPromise(function(_0x389511,_0x2c2f6c){return client[_0x8630('0x7')](_0x44281b,_0x25bb4c)[_0x8630('0x8')](function(_0x43f157){logger[_0x8630('0x9')](_0x8630('0xa'),_0x8630('0x3'),_0x44281b,_0x25bb4c,_0x43f157);if(_0x43f157['error']){logger[_0x8630('0xb')]('rpc',_0x8630('0x3'),_0x44281b,_0x43f157[_0x8630('0xb')]['message'],_0x25bb4c);return _0x2c2f6c(_0x43f157['error'][_0x8630('0xc')]);}else{return _0x389511(_0x43f157[_0x8630('0xd')]);}})['catch'](function(_0x2f9be8){logger[_0x8630('0xb')](_0x8630('0xa'),'routing',_0x44281b,_0x2f9be8,_0x25bb4c);return _0x2c2f6c(_0x2f9be8);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 9fc8d39..a818723 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 _0xcf8d=['then','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','initMailQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents'];(function(_0x1f5890,_0x1959ca){var _0x3f7c7b=function(_0x22165f){while(--_0x22165f){_0x1f5890['push'](_0x1f5890['shift']());}};_0x3f7c7b(++_0x1959ca);}(_0xcf8d,0x1da));var _0xdcf8=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0xcf8d[_0x221b8c];return _0x3fab9f;};'use strict';var BPromise=require('bluebird');var server=require(_0xdcf8('0x0'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0xdcf8('0x1'));var openchannelQueue=require(_0xdcf8('0x2'));var chatQueue=require(_0xdcf8('0x3'));var smsQueue=require(_0xdcf8('0x4'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xdcf8('0x5'));var whatsappQueue=require(_0xdcf8('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xdcf8('0x7')]()['then'](user[_0xdcf8('0x8')]())[_0xdcf8('0x9')](realtime['initAgents']())[_0xdcf8('0x9')](interval['getIntervals']())['then'](realtime[_0xdcf8('0xa')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0xdcf8('0x9')](realtime[_0xdcf8('0xb')]())['then'](chatQueue[_0xdcf8('0xc')]())[_0xdcf8('0x9')](realtime[_0xdcf8('0xd')]())[_0xdcf8('0x9')](smsQueue['getSmsQueues']())[_0xdcf8('0x9')](realtime[_0xdcf8('0xe')]())[_0xdcf8('0x9')](mailQueue['getMailQueues']())[_0xdcf8('0x9')](realtime[_0xdcf8('0xf')]())[_0xdcf8('0x9')](faxQueue['getFaxQueues']())[_0xdcf8('0x9')](realtime[_0xdcf8('0x10')]())[_0xdcf8('0x9')](whatsappQueue[_0xdcf8('0x11')]())['then'](realtime['initWhatsappQueues']())[_0xdcf8('0x9')](function(){return realtime;});}function main(){return server[_0xdcf8('0x12')](realtime)[_0xdcf8('0x9')](function(_0x400fb6){return initRealtime();})[_0xdcf8('0x9')](function(_0x32fc9d){return setInterval(initRealtime,0x1388);})[_0xdcf8('0x13')](function(_0x5e0f26){console[_0xdcf8('0x14')](_0x5e0f26);});}main(); \ No newline at end of file +var _0xed2b=['catch','bluebird','./realtime','./rpc/interval','./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','initAgents','then','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen'];(function(_0x1d4e55,_0x1db9a4){var _0x1c99d8=function(_0x4d5726){while(--_0x4d5726){_0x1d4e55['push'](_0x1d4e55['shift']());}};_0x1c99d8(++_0x1db9a4);}(_0xed2b,0x112));var _0xbed2=function(_0x1a9ed0,_0x1085fc){_0x1a9ed0=_0x1a9ed0-0x0;var _0x47bbd6=_0xed2b[_0x1a9ed0];return _0x47bbd6;};'use strict';var BPromise=require(_0xbed2('0x0'));var server=require('./server');var Realtime=require(_0xbed2('0x1'));var user=require('./rpc/user');var interval=require(_0xbed2('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xbed2('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xbed2('0x4'));var whatsappQueue=require(_0xbed2('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xbed2('0x6')]()['then'](user['getAgents']())['then'](realtime[_0xbed2('0x7')]())[_0xbed2('0x8')](interval['getIntervals']())['then'](realtime['initIntervals']())['then'](openchannelQueue[_0xbed2('0x9')]())[_0xbed2('0x8')](realtime[_0xbed2('0xa')]())[_0xbed2('0x8')](chatQueue[_0xbed2('0xb')]())[_0xbed2('0x8')](realtime[_0xbed2('0xc')]())[_0xbed2('0x8')](smsQueue[_0xbed2('0xd')]())[_0xbed2('0x8')](realtime['initSmsQueues']())[_0xbed2('0x8')](mailQueue[_0xbed2('0xe')]())[_0xbed2('0x8')](realtime[_0xbed2('0xf')]())[_0xbed2('0x8')](faxQueue['getFaxQueues']())[_0xbed2('0x8')](realtime[_0xbed2('0x10')]())[_0xbed2('0x8')](whatsappQueue[_0xbed2('0x11')]())['then'](realtime[_0xbed2('0x12')]())[_0xbed2('0x8')](function(){return realtime;});}function main(){return server[_0xbed2('0x13')](realtime)[_0xbed2('0x8')](function(_0x5b2967){return initRealtime();})[_0xbed2('0x8')](function(_0x4aa4b3){return setInterval(initRealtime,0x1388);})[_0xbed2('0x14')](function(_0x364018){console['log'](_0x364018);});}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 b7ed190..080c674 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x326f,0xd1));var _0xf326=function(_0x228e6f,_0xe1c9c0){_0x228e6f=_0x228e6f-0x0;var _0x27011c=_0x326f[_0x228e6f];return _0x27011c;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x322058,_0x11f2b8){var _0x5d1c58=function(_0x5e84e9){while(--_0x5e84e9){_0x322058['push'](_0x322058['shift']());}};_0x5d1c58(++_0x11f2b8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index c32aab6..2e64e6e 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 _0x99d0=['result','catch','sendMailMessage','SendMail','bluebird','client','http','request','then','error','message'];(function(_0x3bf2bf,_0xdad29c){var _0x5d7cf6=function(_0x40335b){while(--_0x40335b){_0x3bf2bf['push'](_0x3bf2bf['shift']());}};_0x5d7cf6(++_0xdad29c);}(_0x99d0,0x1d2));var _0x099d=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0x99d0[_0x446208];return _0xe49563;};'use strict';var BPromise=require(_0x099d('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x099d('0x1')][_0x099d('0x2')]({'port':0x232b});function request(_0x13bd87,_0x49473d){return new BPromise(function(_0x103b09,_0x3f9388){return client[_0x099d('0x3')](_0x13bd87,_0x49473d)[_0x099d('0x4')](function(_0xaae6c0){if(_0xaae6c0[_0x099d('0x5')]){return _0x3f9388(_0xaae6c0[_0x099d('0x5')][_0x099d('0x6')]);}else{return _0x103b09(_0xaae6c0[_0x099d('0x7')]);}})[_0x099d('0x8')](function(_0x5cb047){return _0x3f9388(_0x5cb047);});});}exports[_0x099d('0x9')]=function(_0x3e99c1,_0x26a554){return request(_0x099d('0xa'),{'account':_0x3e99c1,'message':_0x26a554});}; \ No newline at end of file +var _0x5919=['result','catch','SendMail','jayson/promise','client','http','request','then','error','message'];(function(_0x477e65,_0x2cbafb){var _0x4170ef=function(_0x116296){while(--_0x116296){_0x477e65['push'](_0x477e65['shift']());}};_0x4170ef(++_0x2cbafb);}(_0x5919,0x139));var _0x9591=function(_0x1ea5e2,_0x382cec){_0x1ea5e2=_0x1ea5e2-0x0;var _0x39380c=_0x5919[_0x1ea5e2];return _0x39380c;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x9591('0x0'));var client=jayson[_0x9591('0x1')][_0x9591('0x2')]({'port':0x232b});function request(_0x310de9,_0x2a0af1){return new BPromise(function(_0x1bbdd7,_0x4daa43){return client[_0x9591('0x3')](_0x310de9,_0x2a0af1)[_0x9591('0x4')](function(_0x133ad2){if(_0x133ad2[_0x9591('0x5')]){return _0x4daa43(_0x133ad2[_0x9591('0x5')][_0x9591('0x6')]);}else{return _0x1bbdd7(_0x133ad2[_0x9591('0x7')]);}})[_0x9591('0x8')](function(_0x30d9c8){return _0x4daa43(_0x30d9c8);});});}exports['sendMailMessage']=function(_0x1b6b6a,_0x333764){return request(_0x9591('0x9'),{'account':_0x1b6b6a,'message':_0x333764});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 92fb756..0893f88 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 _0xc602=['chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','md5','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','name','chatCurrentCapacity','smsStatus','smsStatusTime','whatsappCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','emit','user:save','moment','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','unknown'];(function(_0xb2320d,_0xe69d49){var _0x9db91a=function(_0x5a0878){while(--_0x5a0878){_0xb2320d['push'](_0xb2320d['shift']());}};_0x9db91a(++_0xe69d49);}(_0xc602,0x133));var _0x2c60=function(_0x5e7452,_0x284cbd){_0x5e7452=_0x5e7452-0x0;var _0x3935f2=_0xc602[_0x5e7452];return _0x3935f2;};'use strict';var _=require('lodash');var moment=require(_0x2c60('0x0'));var md5=require('md5');var Redis=require(_0x2c60('0x1'));var config=require(_0x2c60('0x2'));config['redis']=_['defaults'](config['redis'],{'host':_0x2c60('0x3'),'port':0x18eb});var io=require(_0x2c60('0x4'))(new Redis(config[_0x2c60('0x5')]));function Agent(_0xb5ff1c){this['id']=_0xb5ff1c['id']||0x0;this['name']=_0xb5ff1c['name']||'';this[_0x2c60('0x6')]=_0xb5ff1c[_0x2c60('0x6')]||!![];this['voicePause']=_0xb5ff1c[_0x2c60('0x7')]||![];this[_0x2c60('0x8')]=_0xb5ff1c[_0x2c60('0x8')]||![];this['mailPause']=_0xb5ff1c['mailPause']||![];this[_0x2c60('0x9')]=_0xb5ff1c[_0x2c60('0x9')]||![];this[_0x2c60('0xa')]=_0xb5ff1c['smsPause']||![];this[_0x2c60('0xb')]=_0xb5ff1c[_0x2c60('0xb')]||![];this['chatStatus']=_0x2c60('0xc');this[_0x2c60('0xd')]=0x0;this[_0x2c60('0xe')]=_0xb5ff1c[_0x2c60('0xe')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x2c60('0xf')]='unknown';this[_0x2c60('0x10')]=0x0;this[_0x2c60('0x11')]=_0xb5ff1c[_0x2c60('0x11')]||0x0;this[_0x2c60('0x12')]=0x0;this['faxStatus']='unknown';this[_0x2c60('0x13')]=0x0;this[_0x2c60('0x14')]=_0xb5ff1c[_0x2c60('0x14')]||0x0;this[_0x2c60('0x15')]=0x0;this['smsStatus']=_0x2c60('0xc');this['smsStatusTime']=0x0;this[_0x2c60('0x16')]=_0xb5ff1c['smsCapacity']||0x0;this[_0x2c60('0x17')]=0x0;this[_0x2c60('0x18')]=_0x2c60('0xc');this[_0x2c60('0x19')]=0x0;this['whatsappCapacity']=_0xb5ff1c[_0x2c60('0x1a')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x2c60('0x1b')]=_0x2c60('0xc');this[_0x2c60('0x1c')]=0x0;this[_0x2c60('0x1d')]=_0xb5ff1c[_0x2c60('0x1d')]||0x0;this[_0x2c60('0x1e')]=0x0;this['busy']=![];this[_0x2c60('0x1f')]=undefined;this[_0x2c60('0x20')]='';this['chatWaitingInteractions']={};this['faxWaitingInteractions']={};this[_0x2c60('0x21')]={};this[_0x2c60('0x22')]={};this[_0x2c60('0x23')]={};this[_0x2c60('0x24')]={};this[_0x2c60('0x25')]();}Agent[_0x2c60('0x26')][_0x2c60('0x27')]=function(_0x427a4c){if(this[_0x427a4c+_0x2c60('0x28')]>0x0){if(this[_0x427a4c+'Capacity']>0x0&&this[_0x427a4c+_0x2c60('0x28')]>=this[_0x427a4c+_0x2c60('0x29')]){return _0x2c60('0x2a');}else{return _0x2c60('0x2b');}}else{return _0x2c60('0x2c');}};Agent['prototype']['updateRealtime']=function(){var _0x46e473=['mail','chat',_0x2c60('0x2d'),_0x2c60('0x2e'),_0x2c60('0x2f'),_0x2c60('0x30')];for(var _0x54e9af=0x0;_0x54e9af<_0x46e473[_0x2c60('0x31')];_0x54e9af+=0x1){var _0x24144a=this[_0x2c60('0x27')](_0x46e473[_0x54e9af]);if(this[_0x46e473[_0x54e9af]+_0x2c60('0x32')]!==_0x24144a){this[_0x46e473[_0x54e9af]+_0x2c60('0x33')]=_[_0x2c60('0x34')](moment()[_0x2c60('0x35')]('x'));}this[_0x46e473[_0x54e9af]+'Status']=_0x24144a;}var _0x140812={'id':this['id'],'name':this[_0x2c60('0x36')],'online':this[_0x2c60('0x6')],'voicePause':this['voicePause'],'chatPause':this[_0x2c60('0x8')],'mailPause':this['mailPause'],'smsPause':this[_0x2c60('0xa')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x2c60('0xd')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2c60('0x37')],'mailStatus':this[_0x2c60('0xf')],'mailStatusTime':this[_0x2c60('0x10')],'mailCapacity':this[_0x2c60('0x11')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x2c60('0x38')],'smsStatusTime':this[_0x2c60('0x39')],'smsCapacity':this[_0x2c60('0x16')],'smsCurrentCapacity':this[_0x2c60('0x17')],'whatsappStatus':this[_0x2c60('0x18')],'whatsappStatusTime':this[_0x2c60('0x19')],'whatsappCapacity':this[_0x2c60('0x1a')],'whatsappCurrentCapacity':this[_0x2c60('0x3a')],'openchannelStatus':this[_0x2c60('0x1b')],'openchannelStatusTime':this[_0x2c60('0x1c')],'openchannelCapacity':this[_0x2c60('0x1d')],'openchannelCurrentCapacity':this[_0x2c60('0x1e')],'busy':this[_0x2c60('0x3b')],'busyQueue':this[_0x2c60('0x1f')],'chatWaitingInteractions':this[_0x2c60('0x3c')],'faxWaitingInteractions':this[_0x2c60('0x3d')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x2c60('0x22')],'smsWaitingInteractions':this[_0x2c60('0x23')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x2db650=md5(JSON['stringify'](_0x140812));if(this[_0x2c60('0x20')]!==_0x2db650){this[_0x2c60('0x20')]=_0x2db650;io[_0x2c60('0x3e')](_0x2c60('0x3f'),_0x140812);}};module['exports']=Agent; \ No newline at end of file +var _0x7233=['mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailStatus','faxStatus','smsStatusTime','openchannelStatusTime','chatWaitingInteractions','mailWaitingInteractions','stringify','emit','user:save','lodash','md5','ioredis','redis','defaults','socket.io-emitter','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity'];(function(_0xacfea1,_0x5f5682){var _0x26f37b=function(_0x2e6f3d){while(--_0x2e6f3d){_0xacfea1['push'](_0xacfea1['shift']());}};_0x26f37b(++_0x5f5682);}(_0x7233,0xa6));var _0x3723=function(_0x2f9ab7,_0x8247a1){_0x2f9ab7=_0x2f9ab7-0x0;var _0x1800ef=_0x7233[_0x2f9ab7];return _0x1800ef;};'use strict';var _=require(_0x3723('0x0'));var moment=require('moment');var md5=require(_0x3723('0x1'));var Redis=require(_0x3723('0x2'));var config=require('../../../config/environment');config[_0x3723('0x3')]=_[_0x3723('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3723('0x5'))(new Redis(config[_0x3723('0x3')]));function Agent(_0x2bbe57){this['id']=_0x2bbe57['id']||0x0;this[_0x3723('0x6')]=_0x2bbe57[_0x3723('0x6')]||'';this[_0x3723('0x7')]=_0x2bbe57[_0x3723('0x7')]||!![];this['voicePause']=_0x2bbe57['voicePause']||![];this['chatPause']=_0x2bbe57[_0x3723('0x8')]||![];this[_0x3723('0x9')]=_0x2bbe57[_0x3723('0x9')]||![];this[_0x3723('0xa')]=_0x2bbe57[_0x3723('0xa')]||![];this[_0x3723('0xb')]=_0x2bbe57[_0x3723('0xb')]||![];this[_0x3723('0xc')]=_0x2bbe57[_0x3723('0xc')]||![];this[_0x3723('0xd')]=_0x3723('0xe');this[_0x3723('0xf')]=0x0;this[_0x3723('0x10')]=_0x2bbe57[_0x3723('0x10')]||0x0;this[_0x3723('0x11')]=0x0;this['mailStatus']=_0x3723('0xe');this[_0x3723('0x12')]=0x0;this[_0x3723('0x13')]=_0x2bbe57['mailCapacity']||0x0;this[_0x3723('0x14')]=0x0;this['faxStatus']=_0x3723('0xe');this[_0x3723('0x15')]=0x0;this[_0x3723('0x16')]=_0x2bbe57[_0x3723('0x16')]||0x0;this[_0x3723('0x17')]=0x0;this['smsStatus']=_0x3723('0xe');this['smsStatusTime']=0x0;this[_0x3723('0x18')]=_0x2bbe57[_0x3723('0x18')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x3723('0x19')]=_0x3723('0xe');this[_0x3723('0x1a')]=0x0;this['whatsappCapacity']=_0x2bbe57[_0x3723('0x1b')]||0x0;this[_0x3723('0x1c')]=0x0;this[_0x3723('0x1d')]=_0x3723('0xe');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x2bbe57[_0x3723('0x1e')]||0x0;this[_0x3723('0x1f')]=0x0;this[_0x3723('0x20')]=![];this[_0x3723('0x21')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0x3723('0x22')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x3723('0x23')]={};this[_0x3723('0x24')]={};this[_0x3723('0x25')]();}Agent[_0x3723('0x26')][_0x3723('0x27')]=function(_0x4aabe8){if(this[_0x4aabe8+_0x3723('0x28')]>0x0){if(this[_0x4aabe8+_0x3723('0x29')]>0x0&&this[_0x4aabe8+'CurrentCapacity']>=this[_0x4aabe8+'Capacity']){return'maxcapacity';}else{return'working';}}else{return'idle';}};Agent[_0x3723('0x26')][_0x3723('0x25')]=function(){var _0x3c39d0=[_0x3723('0x2a'),_0x3723('0x2b'),_0x3723('0x2c'),_0x3723('0x2d'),_0x3723('0x2e'),_0x3723('0x2f')];for(var _0x5ac2f0=0x0;_0x5ac2f0<_0x3c39d0[_0x3723('0x30')];_0x5ac2f0+=0x1){var _0x22493d=this[_0x3723('0x27')](_0x3c39d0[_0x5ac2f0]);if(this[_0x3c39d0[_0x5ac2f0]+_0x3723('0x31')]!==_0x22493d){this[_0x3c39d0[_0x5ac2f0]+_0x3723('0x32')]=_[_0x3723('0x33')](moment()[_0x3723('0x34')]('x'));}this[_0x3c39d0[_0x5ac2f0]+_0x3723('0x31')]=_0x22493d;}var _0x1adb88={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x3723('0x8')],'mailPause':this[_0x3723('0x9')],'smsPause':this[_0x3723('0xb')],'faxPause':this[_0x3723('0xa')],'openchannelPause':this[_0x3723('0xc')],'chatStatus':this[_0x3723('0xd')],'chatStatusTime':this[_0x3723('0xf')],'chatCapacity':this[_0x3723('0x10')],'chatCurrentCapacity':this[_0x3723('0x11')],'mailStatus':this[_0x3723('0x35')],'mailStatusTime':this[_0x3723('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x3723('0x14')],'faxStatus':this[_0x3723('0x36')],'faxStatusTime':this[_0x3723('0x15')],'faxCapacity':this[_0x3723('0x16')],'faxCurrentCapacity':this[_0x3723('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x3723('0x37')],'smsCapacity':this[_0x3723('0x18')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x3723('0x19')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x3723('0x1b')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x3723('0x1d')],'openchannelStatusTime':this[_0x3723('0x38')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x3723('0x1f')],'busy':this[_0x3723('0x20')],'busyQueue':this[_0x3723('0x21')],'chatWaitingInteractions':this[_0x3723('0x39')],'faxWaitingInteractions':this[_0x3723('0x22')],'mailWaitingInteractions':this[_0x3723('0x3a')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x3723('0x23')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x6c6f52=md5(JSON[_0x3723('0x3b')](_0x1adb88));if(this[_0x3723('0x1')]!==_0x6c6f52){this[_0x3723('0x1')]=_0x6c6f52;io[_0x3723('0x3c')](_0x3723('0x3d'),_0x1adb88);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 2374977..3b920c6 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 _0x1b9c=['../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','online','chatPause','available','stringify','format','chat_queue:save','exports','lodash','md5','util','ioredis'];(function(_0x1beb83,_0x1b1a75){var _0x267710=function(_0x1e8d0b){while(--_0x1e8d0b){_0x1beb83['push'](_0x1beb83['shift']());}};_0x267710(++_0x1b1a75);}(_0x1b9c,0xa4));var _0xc1b9=function(_0x53a2ce,_0x260634){_0x53a2ce=_0x53a2ce-0x0;var _0x5cc295=_0x1b9c[_0x53a2ce];return _0x5cc295;};'use strict';var _=require(_0xc1b9('0x0'));var md5=require(_0xc1b9('0x1'));var util=require(_0xc1b9('0x2'));var Redis=require(_0xc1b9('0x3'));var config=require(_0xc1b9('0x4'));config['redis']=_['defaults'](config[_0xc1b9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xc1b9('0x6'))(new Redis(config[_0xc1b9('0x5')]));function ChatQueue(_0x5dfb08){this['id']=_0x5dfb08['id']||0x0;this[_0xc1b9('0x7')]=_0x5dfb08[_0xc1b9('0x7')]||'';this['timeout']=_0x5dfb08[_0xc1b9('0x8')]||0xa;this[_0xc1b9('0x9')]=_0x5dfb08[_0xc1b9('0x9')]||_0xc1b9('0xa');this[_0xc1b9('0xb')]=_0x5dfb08[_0xc1b9('0xb')];this['mapAgentsId']={};this[_0xc1b9('0xc')]=0x0;this[_0xc1b9('0x1')]='';this['updateRouting']();this[_0xc1b9('0xd')]();}ChatQueue[_0xc1b9('0xe')][_0xc1b9('0xf')]=function(){var _0x11bd8a=this[_0xc1b9('0x10')][_0xc1b9('0x11')];this[_0xc1b9('0x10')]=_[_0xc1b9('0x12')](this[_0xc1b9('0xb')],'id');this[_0xc1b9('0x10')]['_rr']=_0x11bd8a;};ChatQueue[_0xc1b9('0xe')][_0xc1b9('0xd')]=function(){this[_0xc1b9('0x13')]=0x0;this[_0xc1b9('0x14')]=0x0;for(var _0x333fb0=0x0;_0x333fb0=0x0?this[_0xc1b9('0x17')]:0x0;var _0x4ca4ec={'id':this['id'],'available':this[_0xc1b9('0x17')],'loggedIn':this[_0xc1b9('0x13')],'name':this[_0xc1b9('0x7')],'paused':this[_0xc1b9('0x14')],'waiting':this[_0xc1b9('0xc')]};var _0x557ef2=md5(JSON[_0xc1b9('0x18')](_0x4ca4ec));if(this[_0xc1b9('0x1')]!==_0x557ef2){this[_0xc1b9('0x1')]=_0x557ef2;io['to'](util[_0xc1b9('0x19')]('chat:queue:%s',_0x4ca4ec['name']))['emit'](_0xc1b9('0x1a'),_0x4ca4ec);}};module[_0xc1b9('0x1b')]=ChatQueue; \ No newline at end of file +var _0x9a0e=['updateRealtime','prototype','_rr','paused','length','online','loggedIn','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x6d5242,_0x3e1377){var _0x35e02e=function(_0x27b5e5){while(--_0x27b5e5){_0x6d5242['push'](_0x6d5242['shift']());}};_0x35e02e(++_0x3e1377);}(_0x9a0e,0x164));var _0xe9a0=function(_0x27f4eb,_0x13c647){_0x27f4eb=_0x27f4eb-0x0;var _0x42a860=_0x9a0e[_0x27f4eb];return _0x42a860;};'use strict';var _=require(_0xe9a0('0x0'));var md5=require(_0xe9a0('0x1'));var util=require(_0xe9a0('0x2'));var Redis=require(_0xe9a0('0x3'));var config=require(_0xe9a0('0x4'));config[_0xe9a0('0x5')]=_[_0xe9a0('0x6')](config[_0xe9a0('0x5')],{'host':_0xe9a0('0x7'),'port':0x18eb});var io=require(_0xe9a0('0x8'))(new Redis(config['redis']));function ChatQueue(_0x387b52){this['id']=_0x387b52['id']||0x0;this[_0xe9a0('0x9')]=_0x387b52[_0xe9a0('0x9')]||'';this[_0xe9a0('0xa')]=_0x387b52[_0xe9a0('0xa')]||0xa;this[_0xe9a0('0xb')]=_0x387b52[_0xe9a0('0xb')]||_0xe9a0('0xc');this[_0xe9a0('0xd')]=_0x387b52['Agents'];this[_0xe9a0('0xe')]={};this['waiting']=0x0;this['md5']='';this[_0xe9a0('0xf')]();this[_0xe9a0('0x10')]();}ChatQueue[_0xe9a0('0x11')][_0xe9a0('0xf')]=function(){var _0x300029=this[_0xe9a0('0xe')][_0xe9a0('0x12')];this[_0xe9a0('0xe')]=_['map'](this[_0xe9a0('0xd')],'id');this[_0xe9a0('0xe')][_0xe9a0('0x12')]=_0x300029;};ChatQueue[_0xe9a0('0x11')][_0xe9a0('0x10')]=function(){this['loggedIn']=0x0;this[_0xe9a0('0x13')]=0x0;for(var _0x59822a=0x0;_0x59822a=0x0?this[_0xe9a0('0x18')]:0x0;var _0x2d12b0={'id':this['id'],'available':this[_0xe9a0('0x18')],'loggedIn':this[_0xe9a0('0x16')],'name':this[_0xe9a0('0x9')],'paused':this[_0xe9a0('0x13')],'waiting':this[_0xe9a0('0x19')]};var _0xf53409=md5(JSON[_0xe9a0('0x1a')](_0x2d12b0));if(this['md5']!==_0xf53409){this[_0xe9a0('0x1')]=_0xf53409;io['to'](util[_0xe9a0('0x1b')](_0xe9a0('0x1c'),_0x2d12b0['name']))[_0xe9a0('0x1d')](_0xe9a0('0x1e'),_0x2d12b0);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index bcec7ea..9e89064 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 _0x4d4d=['updateRealtime','prototype','_rr','map','loggedIn','paused','length','faxPause','available','waiting','format','emit','fax_queue:save','exports','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting'];(function(_0x3a5d04,_0x59ff36){var _0x3fb6a9=function(_0xf36b22){while(--_0xf36b22){_0x3a5d04['push'](_0x3a5d04['shift']());}};_0x3fb6a9(++_0x59ff36);}(_0x4d4d,0xd2));var _0xd4d4=function(_0xfb9ad1,_0x268176){_0xfb9ad1=_0xfb9ad1-0x0;var _0x3862bc=_0x4d4d[_0xfb9ad1];return _0x3862bc;};'use strict';var _=require(_0xd4d4('0x0'));var md5=require(_0xd4d4('0x1'));var util=require(_0xd4d4('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xd4d4('0x3')]=_[_0xd4d4('0x4')](config[_0xd4d4('0x3')],{'host':_0xd4d4('0x5'),'port':0x18eb});var io=require(_0xd4d4('0x6'))(new Redis(config[_0xd4d4('0x3')]));function FaxQueue(_0x4c4383){this['id']=_0x4c4383['id']||0x0;this[_0xd4d4('0x7')]=_0x4c4383['name']||'';this[_0xd4d4('0x8')]=_0x4c4383[_0xd4d4('0x8')]||0xa;this[_0xd4d4('0x9')]=_0x4c4383[_0xd4d4('0x9')]||_0xd4d4('0xa');this[_0xd4d4('0xb')]=_0x4c4383[_0xd4d4('0xb')];this[_0xd4d4('0xc')]={};this['waiting']=0x0;this[_0xd4d4('0x1')]='';this[_0xd4d4('0xd')]();this[_0xd4d4('0xe')]();}FaxQueue[_0xd4d4('0xf')][_0xd4d4('0xd')]=function(){var _0x5e3606=this[_0xd4d4('0xc')][_0xd4d4('0x10')];this[_0xd4d4('0xc')]=_[_0xd4d4('0x11')](this[_0xd4d4('0xb')],'id');this['mapAgentsId'][_0xd4d4('0x10')]=_0x5e3606;};FaxQueue['prototype'][_0xd4d4('0xe')]=function(){this[_0xd4d4('0x12')]=0x0;this[_0xd4d4('0x13')]=0x0;for(var _0xb5c128=0x0;_0xb5c128=0x0?this[_0xd4d4('0x16')]:0x0;var _0x3085ac={'id':this['id'],'available':this[_0xd4d4('0x16')],'loggedIn':this[_0xd4d4('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xd4d4('0x17')]};var _0x4ec736=md5(JSON['stringify'](_0x3085ac));if(this[_0xd4d4('0x1')]!==_0x4ec736){this[_0xd4d4('0x1')]=_0x4ec736;io['to'](util[_0xd4d4('0x18')]('fax:queue:%s',_0x3085ac['name']))[_0xd4d4('0x19')](_0xd4d4('0x1a'),_0x3085ac);}};module[_0xd4d4('0x1b')]=FaxQueue; \ No newline at end of file +var _0x5296=['updateRouting','updateRealtime','prototype','Agents','paused','length','loggedIn','faxPause','available','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','strategy','beepall','mapAgentsId','waiting'];(function(_0x27e433,_0x200f4b){var _0x4f3323=function(_0x4c1305){while(--_0x4c1305){_0x27e433['push'](_0x27e433['shift']());}};_0x4f3323(++_0x200f4b);}(_0x5296,0xbb));var _0x6529=function(_0x59607b,_0x5001ea){_0x59607b=_0x59607b-0x0;var _0x5260b7=_0x5296[_0x59607b];return _0x5260b7;};'use strict';var _=require(_0x6529('0x0'));var md5=require(_0x6529('0x1'));var util=require(_0x6529('0x2'));var Redis=require(_0x6529('0x3'));var config=require(_0x6529('0x4'));config[_0x6529('0x5')]=_[_0x6529('0x6')](config[_0x6529('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x6529('0x7'))(new Redis(config[_0x6529('0x5')]));function FaxQueue(_0x3940b7){this['id']=_0x3940b7['id']||0x0;this['name']=_0x3940b7[_0x6529('0x8')]||'';this['timeout']=_0x3940b7['timeout']||0xa;this[_0x6529('0x9')]=_0x3940b7[_0x6529('0x9')]||_0x6529('0xa');this['Agents']=_0x3940b7['Agents'];this[_0x6529('0xb')]={};this[_0x6529('0xc')]=0x0;this[_0x6529('0x1')]='';this[_0x6529('0xd')]();this[_0x6529('0xe')]();}FaxQueue[_0x6529('0xf')][_0x6529('0xd')]=function(){var _0x27ff4d=this[_0x6529('0xb')]['_rr'];this[_0x6529('0xb')]=_['map'](this[_0x6529('0x10')],'id');this[_0x6529('0xb')]['_rr']=_0x27ff4d;};FaxQueue[_0x6529('0xf')][_0x6529('0xe')]=function(){this['loggedIn']=0x0;this[_0x6529('0x11')]=0x0;for(var _0x130b99=0x0;_0x130b99=0x0?this[_0x6529('0x15')]:0x0;var _0x2a5419={'id':this['id'],'available':this[_0x6529('0x15')],'loggedIn':this[_0x6529('0x13')],'name':this[_0x6529('0x8')],'paused':this[_0x6529('0x11')],'waiting':this['waiting']};var _0x4c6402=md5(JSON['stringify'](_0x2a5419));if(this[_0x6529('0x1')]!==_0x4c6402){this[_0x6529('0x1')]=_0x4c6402;io['to'](util['format']('fax:queue:%s',_0x2a5419[_0x6529('0x8')]))[_0x6529('0x16')](_0x6529('0x17'),_0x2a5419);}};module[_0x6529('0x18')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 0688c50..20d34e4 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 _0xe44c=['name','Intervals','exports'];(function(_0x501285,_0x38aeac){var _0x29cfe1=function(_0x56c84d){while(--_0x56c84d){_0x501285['push'](_0x501285['shift']());}};_0x29cfe1(++_0x38aeac);}(_0xe44c,0xa8));var _0xce44=function(_0x17e69b,_0x512806){_0x17e69b=_0x17e69b-0x0;var _0x55eea8=_0xe44c[_0x17e69b];return _0x55eea8;};'use strict';function Interval(_0xe0ac60){this['id']=_0xe0ac60['id']||0x0;this[_0xce44('0x0')]=_0xe0ac60[_0xce44('0x0')]||'';this[_0xce44('0x1')]=_0xe0ac60[_0xce44('0x1')]||{};}module[_0xce44('0x2')]=Interval; \ No newline at end of file +var _0x9d98=['Intervals','name'];(function(_0x3d5993,_0x4592e5){var _0x11fc48=function(_0x495e31){while(--_0x495e31){_0x3d5993['push'](_0x3d5993['shift']());}};_0x11fc48(++_0x4592e5);}(_0x9d98,0xf9));var _0x89d9=function(_0x10c102,_0x1f7f57){_0x10c102=_0x10c102-0x0;var _0x313b3f=_0x9d98[_0x10c102];return _0x313b3f;};'use strict';function Interval(_0x6ed095){this['id']=_0x6ed095['id']||0x0;this[_0x89d9('0x0')]=_0x6ed095[_0x89d9('0x0')]||'';this[_0x89d9('0x1')]=_0x6ed095[_0x89d9('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 3967c37..37def47 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 _0xabd6=['mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','available','waiting','stringify','md5','format','mail:queue:%s','emit','lodash','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0xf8ebe,_0x4a8cba){var _0x11131f=function(_0x2a5d52){while(--_0x2a5d52){_0xf8ebe['push'](_0xf8ebe['shift']());}};_0x11131f(++_0x4a8cba);}(_0xabd6,0x1d1));var _0x6abd=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xabd6[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x6abd('0x0'));var md5=require('md5');var util=require(_0x6abd('0x1'));var Redis=require(_0x6abd('0x2'));var config=require('../../../config/environment');config[_0x6abd('0x3')]=_[_0x6abd('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6abd('0x5'))(new Redis(config['redis']));function MailQueue(_0x3f77a0){this['id']=_0x3f77a0['id']||0x0;this[_0x6abd('0x6')]=_0x3f77a0[_0x6abd('0x6')]||'';this['timeout']=_0x3f77a0[_0x6abd('0x7')]||0xa;this[_0x6abd('0x8')]=_0x3f77a0[_0x6abd('0x8')]||_0x6abd('0x9');this[_0x6abd('0xa')]=_0x3f77a0['Agents'];this[_0x6abd('0xb')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x6abd('0xc')]();}MailQueue[_0x6abd('0xd')][_0x6abd('0xe')]=function(){var _0x101c44=this[_0x6abd('0xb')][_0x6abd('0xf')];this[_0x6abd('0xb')]=_[_0x6abd('0x10')](this[_0x6abd('0xa')],'id');this[_0x6abd('0xb')]['_rr']=_0x101c44;};MailQueue['prototype'][_0x6abd('0xc')]=function(){this[_0x6abd('0x11')]=0x0;this[_0x6abd('0x12')]=0x0;for(var _0x5ce1bb=0x0;_0x5ce1bb=0x0?this[_0x6abd('0x15')]:0x0;var _0x14f0e6={'id':this['id'],'available':this[_0x6abd('0x15')],'loggedIn':this[_0x6abd('0x11')],'name':this[_0x6abd('0x6')],'paused':this['paused'],'waiting':this[_0x6abd('0x16')]};var _0x58c988=md5(JSON[_0x6abd('0x17')](_0x14f0e6));if(this[_0x6abd('0x18')]!==_0x58c988){this[_0x6abd('0x18')]=_0x58c988;io['to'](util[_0x6abd('0x19')](_0x6abd('0x1a'),_0x14f0e6[_0x6abd('0x6')]))[_0x6abd('0x1b')]('mail_queue:save',_0x14f0e6);}};module['exports']=MailQueue; \ No newline at end of file +var _0xd53c=['strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online','mailPause','paused','available','waiting','format','mail:queue:%s','emit','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0xd53c,0x87));var _0xcd53=function(_0x41b8c9,_0x1c41c9){_0x41b8c9=_0x41b8c9-0x0;var _0x1b5f31=_0xd53c[_0x41b8c9];return _0x1b5f31;};'use strict';var _=require(_0xcd53('0x0'));var md5=require(_0xcd53('0x1'));var util=require(_0xcd53('0x2'));var Redis=require(_0xcd53('0x3'));var config=require('../../../config/environment');config[_0xcd53('0x4')]=_[_0xcd53('0x5')](config[_0xcd53('0x4')],{'host':_0xcd53('0x6'),'port':0x18eb});var io=require(_0xcd53('0x7'))(new Redis(config[_0xcd53('0x4')]));function MailQueue(_0x14c3fb){this['id']=_0x14c3fb['id']||0x0;this['name']=_0x14c3fb[_0xcd53('0x8')]||'';this[_0xcd53('0x9')]=_0x14c3fb['timeout']||0xa;this[_0xcd53('0xa')]=_0x14c3fb['strategy']||_0xcd53('0xb');this['Agents']=_0x14c3fb[_0xcd53('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0xcd53('0xd')]();this[_0xcd53('0xe')]();}MailQueue[_0xcd53('0xf')][_0xcd53('0xd')]=function(){var _0x14b929=this[_0xcd53('0x10')][_0xcd53('0x11')];this[_0xcd53('0x10')]=_[_0xcd53('0x12')](this[_0xcd53('0xc')],'id');this['mapAgentsId'][_0xcd53('0x11')]=_0x14b929;};MailQueue[_0xcd53('0xf')][_0xcd53('0xe')]=function(){this[_0xcd53('0x13')]=0x0;this['paused']=0x0;for(var _0x1b0b70=0x0;_0x1b0b70=0x0?this[_0xcd53('0x18')]:0x0;var _0x215ace={'id':this['id'],'available':this[_0xcd53('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xcd53('0x8')],'paused':this[_0xcd53('0x17')],'waiting':this[_0xcd53('0x19')]};var _0x21df7a=md5(JSON['stringify'](_0x215ace));if(this[_0xcd53('0x1')]!==_0x21df7a){this[_0xcd53('0x1')]=_0x21df7a;io['to'](util[_0xcd53('0x1a')](_0xcd53('0x1b'),_0x215ace[_0xcd53('0x8')]))[_0xcd53('0x1c')]('mail_queue:save',_0x215ace);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 5ec496a..7560ba6 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 _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x7e3bb8,_0x27c048){var _0x44c887=function(_0x55d7c6){while(--_0x55d7c6){_0x7e3bb8['push'](_0x7e3bb8['shift']());}};_0x44c887(++_0x27c048);}(_0xadb5,0xad));var _0x5adb=function(_0x5a910d,_0x542f3c){_0x5a910d=_0x5a910d-0x0;var _0x548ed7=_0xadb5[_0x5a910d];return _0x548ed7;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x2ef3,0xba));var _0x32ef=function(_0x523c96,_0x3327e7){_0x523c96=_0x523c96-0x0;var _0x1f0252=_0x2ef3[_0x523c96];return _0x1f0252;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 0f91e2e..990a02b 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 _0x130d=['name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','map','_rr','length','online','smsPause','paused','available','loggedIn','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var md5=require('md5');var util=require(_0xd130('0x1'));var Redis=require('ioredis');var config=require(_0xd130('0x2'));config[_0xd130('0x3')]=_[_0xd130('0x4')](config[_0xd130('0x3')],{'host':_0xd130('0x5'),'port':0x18eb});var io=require(_0xd130('0x6'))(new Redis(config[_0xd130('0x3')]));function SmsQueue(_0x1c314b){this['id']=_0x1c314b['id']||0x0;this[_0xd130('0x7')]=_0x1c314b[_0xd130('0x7')]||'';this[_0xd130('0x8')]=_0x1c314b[_0xd130('0x8')]||0xa;this[_0xd130('0x9')]=_0x1c314b[_0xd130('0x9')]||'beepall';this[_0xd130('0xa')]=_0x1c314b['Agents'];this[_0xd130('0xb')]={};this[_0xd130('0xc')]=0x0;this[_0xd130('0xd')]='';this['updateRouting']();this[_0xd130('0xe')]();}SmsQueue[_0xd130('0xf')]['updateRouting']=function(){var _0x587638=this[_0xd130('0xb')]['_rr'];this[_0xd130('0xb')]=_[_0xd130('0x10')](this['Agents'],'id');this[_0xd130('0xb')][_0xd130('0x11')]=_0x587638;};SmsQueue[_0xd130('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x1f56b7=0x0;_0x1f56b7=0x0?this[_0xd130('0x16')]:0x0;var _0x342eb2={'id':this['id'],'available':this[_0xd130('0x16')],'loggedIn':this[_0xd130('0x17')],'name':this[_0xd130('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x5638c3=md5(JSON[_0xd130('0x18')](_0x342eb2));if(this[_0xd130('0xd')]!==_0x5638c3){this['md5']=_0x5638c3;io['to'](util[_0xd130('0x19')](_0xd130('0x1a'),_0x342eb2[_0xd130('0x7')]))[_0xd130('0x1b')](_0xd130('0x1c'),_0x342eb2);}};module[_0xd130('0x1d')]=SmsQueue; \ No newline at end of file +var _0x447b=['length','online','smsPause','available','loggedIn','waiting','stringify','format','sms:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x447b,0xe4));var _0xb447=function(_0x5b31ba,_0x592f84){_0x5b31ba=_0x5b31ba-0x0;var _0x334a42=_0x447b[_0x5b31ba];return _0x334a42;};'use strict';var _=require(_0xb447('0x0'));var md5=require(_0xb447('0x1'));var util=require('util');var Redis=require(_0xb447('0x2'));var config=require(_0xb447('0x3'));config[_0xb447('0x4')]=_[_0xb447('0x5')](config[_0xb447('0x4')],{'host':_0xb447('0x6'),'port':0x18eb});var io=require(_0xb447('0x7'))(new Redis(config[_0xb447('0x4')]));function SmsQueue(_0x7b0a81){this['id']=_0x7b0a81['id']||0x0;this[_0xb447('0x8')]=_0x7b0a81['name']||'';this['timeout']=_0x7b0a81[_0xb447('0x9')]||0xa;this['strategy']=_0x7b0a81[_0xb447('0xa')]||_0xb447('0xb');this[_0xb447('0xc')]=_0x7b0a81[_0xb447('0xc')];this[_0xb447('0xd')]={};this['waiting']=0x0;this[_0xb447('0x1')]='';this[_0xb447('0xe')]();this[_0xb447('0xf')]();}SmsQueue[_0xb447('0x10')]['updateRouting']=function(){var _0xf02e17=this[_0xb447('0xd')][_0xb447('0x11')];this[_0xb447('0xd')]=_[_0xb447('0x12')](this[_0xb447('0xc')],'id');this[_0xb447('0xd')][_0xb447('0x11')]=_0xf02e17;};SmsQueue[_0xb447('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xb447('0x13')]=0x0;for(var _0x56b103=0x0;_0x56b103=0x0?this[_0xb447('0x17')]:0x0;var _0x1552bd={'id':this['id'],'available':this[_0xb447('0x17')],'loggedIn':this[_0xb447('0x18')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb447('0x19')]};var _0x1fcd14=md5(JSON[_0xb447('0x1a')](_0x1552bd));if(this['md5']!==_0x1fcd14){this[_0xb447('0x1')]=_0x1fcd14;io['to'](util[_0xb447('0x1b')](_0xb447('0x1c'),_0x1552bd[_0xb447('0x8')]))[_0xb447('0x1d')]('sms_queue:save',_0x1552bd);}};module[_0xb447('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index e5e6dd7..dbe6677 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 _0x7c4a=['timeout','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x114b80,_0x55a46f){var _0xb919eb=function(_0x5d231a){while(--_0x5d231a){_0x114b80['push'](_0x114b80['shift']());}};_0xb919eb(++_0x55a46f);}(_0x7c4a,0x15f));var _0xa7c4=function(_0x5c0368,_0x423cf2){_0x5c0368=_0x5c0368-0x0;var _0x5b31b9=_0x7c4a[_0x5c0368];return _0x5b31b9;};'use strict';var _=require(_0xa7c4('0x0'));var md5=require('md5');var util=require(_0xa7c4('0x1'));var Redis=require(_0xa7c4('0x2'));var config=require(_0xa7c4('0x3'));config[_0xa7c4('0x4')]=_[_0xa7c4('0x5')](config[_0xa7c4('0x4')],{'host':_0xa7c4('0x6'),'port':0x18eb});var io=require(_0xa7c4('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x27ef91){this['id']=_0x27ef91['id']||0x0;this['name']=_0x27ef91[_0xa7c4('0x8')]||'';this[_0xa7c4('0x9')]=_0x27ef91[_0xa7c4('0x9')]||0xa;this['strategy']=_0x27ef91['strategy']||_0xa7c4('0xa');this[_0xa7c4('0xb')]=_0x27ef91['Agents'];this[_0xa7c4('0xc')]={};this[_0xa7c4('0xd')]=0x0;this[_0xa7c4('0xe')]='';this[_0xa7c4('0xf')]();this['updateRealtime']();}WhatsappQueue[_0xa7c4('0x10')][_0xa7c4('0xf')]=function(){var _0x1db0c7=this[_0xa7c4('0xc')][_0xa7c4('0x11')];this[_0xa7c4('0xc')]=_[_0xa7c4('0x12')](this[_0xa7c4('0xb')],'id');this[_0xa7c4('0xc')][_0xa7c4('0x11')]=_0x1db0c7;};WhatsappQueue[_0xa7c4('0x10')][_0xa7c4('0x13')]=function(){this[_0xa7c4('0x14')]=0x0;this[_0xa7c4('0x15')]=0x0;for(var _0xc74f63=0x0;_0xc74f63=0x0?this[_0xa7c4('0x19')]:0x0;var _0x42b71e={'id':this['id'],'available':this[_0xa7c4('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xa7c4('0x8')],'paused':this[_0xa7c4('0x15')],'waiting':this[_0xa7c4('0xd')]};var _0x4ef29a=md5(JSON[_0xa7c4('0x1a')](_0x42b71e));if(this[_0xa7c4('0xe')]!==_0x4ef29a){this[_0xa7c4('0xe')]=_0x4ef29a;io['to'](util[_0xa7c4('0x1b')]('whatsapp:queue:%s',_0x42b71e[_0xa7c4('0x8')]))['emit'](_0xa7c4('0x1c'),_0x42b71e);}};module[_0xa7c4('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x9e1c=['emit','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn','length','online','whatsappPause','paused','available','md5','format','whatsapp:queue:%s'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x9e1c,0x1c2));var _0xc9e1=function(_0x42922a,_0x2cd77e){_0x42922a=_0x42922a-0x0;var _0xf60fd9=_0x9e1c[_0x42922a];return _0xf60fd9;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xc9e1('0x0'));var Redis=require(_0xc9e1('0x1'));var config=require(_0xc9e1('0x2'));config[_0xc9e1('0x3')]=_[_0xc9e1('0x4')](config['redis'],{'host':_0xc9e1('0x5'),'port':0x18eb});var io=require(_0xc9e1('0x6'))(new Redis(config[_0xc9e1('0x3')]));function WhatsappQueue(_0x590e4e){this['id']=_0x590e4e['id']||0x0;this[_0xc9e1('0x7')]=_0x590e4e[_0xc9e1('0x7')]||'';this['timeout']=_0x590e4e[_0xc9e1('0x8')]||0xa;this['strategy']=_0x590e4e[_0xc9e1('0x9')]||_0xc9e1('0xa');this[_0xc9e1('0xb')]=_0x590e4e[_0xc9e1('0xb')];this[_0xc9e1('0xc')]={};this[_0xc9e1('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0xc9e1('0xe')]();}WhatsappQueue[_0xc9e1('0xf')]['updateRouting']=function(){var _0x2ec1e2=this['mapAgentsId'][_0xc9e1('0x10')];this[_0xc9e1('0xc')]=_['map'](this[_0xc9e1('0xb')],'id');this[_0xc9e1('0xc')][_0xc9e1('0x10')]=_0x2ec1e2;};WhatsappQueue[_0xc9e1('0xf')]['updateRealtime']=function(){this[_0xc9e1('0x11')]=0x0;this['paused']=0x0;for(var _0x3dcd46=0x0;_0x3dcd46=0x0?this[_0xc9e1('0x16')]:0x0;var _0x1ef1e0={'id':this['id'],'available':this[_0xc9e1('0x16')],'loggedIn':this[_0xc9e1('0x11')],'name':this['name'],'paused':this[_0xc9e1('0x15')],'waiting':this[_0xc9e1('0xd')]};var _0x19e0f7=md5(JSON['stringify'](_0x1ef1e0));if(this[_0xc9e1('0x17')]!==_0x19e0f7){this[_0xc9e1('0x17')]=_0x19e0f7;io['to'](util[_0xc9e1('0x18')](_0xc9e1('0x19'),_0x1ef1e0[_0xc9e1('0x7')]))[_0xc9e1('0x1a')]('whatsapp_queue:save',_0x1ef1e0);}};module[_0xc9e1('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b58d0e3..74d7ab8 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(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x16d8c5,_0x42bed4){var _0x2b77df=function(_0x175108){while(--_0x175108){_0x16d8c5['push'](_0x16d8c5['shift']());}};_0x2b77df(++_0x42bed4);}(_0xb10b,0x12a));var _0xbb10=function(_0x12efa0,_0x579590){_0x12efa0=_0x12efa0-0x0;var _0x158c02=_0xb10b[_0x12efa0];return _0x158c02;};'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 a450011..25dbf34 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 _0x133f=['addTagsToChatInteraction','../client','Request','updateChatInteraction','AddTagsToChatInteraction'];(function(_0x4c34bf,_0x37b7ec){var _0x22b497=function(_0x1d07ad){while(--_0x1d07ad){_0x4c34bf['push'](_0x4c34bf['shift']());}};_0x22b497(++_0x37b7ec);}(_0x133f,0x1af));var _0xf133=function(_0x182882,_0x2af73d){_0x182882=_0x182882-0x0;var _0x46edb8=_0x133f[_0x182882];return _0x46edb8;};'use strict';var client=require(_0xf133('0x0'));exports['update']=function(_0x4c8087,_0x2a2e87){return client[_0xf133('0x1')]('UpdateChatInteraction',{'body':_0x2a2e87,'options':{'where':{'id':_0x4c8087}},'log':_0xf133('0x2')});};exports['addTags']=function(_0x371104,_0x53f4b7){return client[_0xf133('0x1')](_0xf133('0x3'),{'body':_0x53f4b7,'options':{'where':{'id':_0x371104}},'log':_0xf133('0x4')});}; \ No newline at end of file +var _0xde64=['addTags','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x2520b2,_0x71fb07){var _0x492764=function(_0x3b886e){while(--_0x3b886e){_0x2520b2['push'](_0x2520b2['shift']());}};_0x492764(++_0x71fb07);}(_0xde64,0x151));var _0x4de6=function(_0x203e81,_0x2523b9){_0x203e81=_0x203e81-0x0;var _0x303b8f=_0xde64[_0x203e81];return _0x303b8f;};'use strict';var client=require(_0x4de6('0x0'));exports[_0x4de6('0x1')]=function(_0x1b97e6,_0x529d5f){return client[_0x4de6('0x2')](_0x4de6('0x3'),{'body':_0x529d5f,'options':{'where':{'id':_0x1b97e6}},'log':_0x4de6('0x4')});};exports[_0x4de6('0x5')]=function(_0x331c7d,_0x410ab4){return client['Request']('AddTagsToChatInteraction',{'body':_0x410ab4,'options':{'where':{'id':_0x331c7d}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2bdaa0b..3d06d6f 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 _0x95b6=['create','Request','../client'];(function(_0x565755,_0x413775){var _0x47752c=function(_0x523ccc){while(--_0x523ccc){_0x565755['push'](_0x565755['shift']());}};_0x47752c(++_0x413775);}(_0x95b6,0x19a));var _0x695b=function(_0x10e3fd,_0x16d0f9){_0x10e3fd=_0x10e3fd-0x0;var _0x25ecd2=_0x95b6[_0x10e3fd];return _0x25ecd2;};'use strict';var client=require(_0x695b('0x0'));exports[_0x695b('0x1')]=function(_0x4b5b54){return client[_0x695b('0x2')]('CreateChatMessage',{'body':_0x4b5b54,'log':'createChatMessage'});}; \ No newline at end of file +var _0xd62e=['../client','Request','CreateChatMessage','createChatMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd62e,0x9c));var _0xed62=function(_0x10d51d,_0xc7691){_0x10d51d=_0x10d51d-0x0;var _0x2a28ba=_0xd62e[_0x10d51d];return _0x2a28ba;};'use strict';var client=require(_0xed62('0x0'));exports['create']=function(_0x22ef24){return client[_0xed62('0x1')](_0xed62('0x2'),{'body':_0x22ef24,'log':_0xed62('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 633d7ff..33e2cf8 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 _0x624c=['name','timeout','User','chatPause','getChatQueues','Request','GetChatQueue'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x624c,0x1ee));var _0xc624=function(_0x493dcd,_0x2c9779){_0x493dcd=_0x493dcd-0x0;var _0x349123=_0x624c[_0x493dcd];return _0x349123;};'use strict';var client=require('../client');exports[_0xc624('0x0')]=function(){return function(){return client[_0xc624('0x1')](_0xc624('0x2'),{'options':{'raw':![],'attributes':['id',_0xc624('0x3'),_0xc624('0x4'),'strategy'],'include':[{'model':_0xc624('0x5'),'as':'Agents','attributes':['id',_0xc624('0x3'),'online',_0xc624('0x6')]}]},'log':_0xc624('0x0')});};}; \ No newline at end of file +var _0xf6c1=['getChatQueues','Request','GetChatQueue','name','strategy','Agents','online','chatPause'];(function(_0x2dcf8d,_0x8c378b){var _0x35e34b=function(_0x4d220e){while(--_0x4d220e){_0x2dcf8d['push'](_0x2dcf8d['shift']());}};_0x35e34b(++_0x8c378b);}(_0xf6c1,0x99));var _0x1f6c=function(_0x29cc79,_0x16977b){_0x29cc79=_0x29cc79-0x0;var _0x420090=_0xf6c1[_0x29cc79];return _0x420090;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x1f6c('0x0')](_0x1f6c('0x1'),{'options':{'raw':![],'attributes':['id',_0x1f6c('0x2'),'timeout',_0x1f6c('0x3')],'include':[{'model':'User','as':_0x1f6c('0x4'),'attributes':['id',_0x1f6c('0x2'),_0x1f6c('0x5'),_0x1f6c('0x6')]}]},'log':_0x1f6c('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2130450..f2d1395 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 _0x6c6f=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x423d7f,_0x1e5e55){var _0x4310af=function(_0x4b69e5){while(--_0x4b69e5){_0x423d7f['push'](_0x423d7f['shift']());}};_0x4310af(++_0x1e5e55);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x5cf307,_0x26c28c){_0x5cf307=_0x5cf307-0x0;var _0x8dfca0=_0x6c6f[_0x5cf307];return _0x8dfca0;};'use strict';var client=require(_0xf6c6('0x0'));exports[_0xf6c6('0x1')]=function(_0x312daa){return client[_0xf6c6('0x2')](_0xf6c6('0x3'),{'body':_0x312daa,'log':_0xf6c6('0x3')});};exports[_0xf6c6('0x4')]=function(_0x232ce6,_0x36fcd2){return client[_0xf6c6('0x2')](_0xf6c6('0x5'),{'body':_0x36fcd2,'options':{'where':{'uniqueid':_0x232ce6},'order':[['id','DESC']],'limit':0x1},'log':_0xf6c6('0x5')});}; \ No newline at end of file +var _0x0aaf=['Request','CreateChatQueueReport','update','DESC'];(function(_0x5212b9,_0x47a147){var _0x569fc6=function(_0x5ee090){while(--_0x5ee090){_0x5212b9['push'](_0x5212b9['shift']());}};_0x569fc6(++_0x47a147);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x223bdb,_0x5882e6){_0x223bdb=_0x223bdb-0x0;var _0xef8e68=_0x0aaf[_0x223bdb];return _0xef8e68;};'use strict';var client=require('../client');exports['create']=function(_0x178ec8){return client[_0xf0aa('0x0')](_0xf0aa('0x1'),{'body':_0x178ec8,'log':_0xf0aa('0x1')});};exports[_0xf0aa('0x2')]=function(_0x507aaa,_0x3943ce){return client[_0xf0aa('0x0')]('UpdateChatQueueReport',{'body':_0x3943ce,'options':{'where':{'uniqueid':_0x507aaa},'order':[['id',_0xf0aa('0x3')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 4d28740..02d4221 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(_0xb1174e,_0x1e68a7){var _0x285bac=function(_0x32c505){while(--_0x32c505){_0xb1174e['push'](_0xb1174e['shift']());}};_0x285bac(++_0x1e68a7);}(_0x7a54,0x106));var _0x47a5=function(_0x3dfd7c,_0x28400b){_0x3dfd7c=_0x3dfd7c-0x0;var _0x5f2caf=_0x7a54[_0x3dfd7c];return _0x5f2caf;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1aef24,_0x3f29d4){var _0x28324b=function(_0x312321){while(--_0x312321){_0x1aef24['push'](_0x1aef24['shift']());}};_0x28324b(++_0x3f29d4);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 04b707a..4ba5b46 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 _0x26f0=['createFaxMessage','../client','create','Request'];(function(_0x233505,_0x46eb02){var _0x579c91=function(_0x3f014b){while(--_0x3f014b){_0x233505['push'](_0x233505['shift']());}};_0x579c91(++_0x46eb02);}(_0x26f0,0x9d));var _0x026f=function(_0x155088,_0x5be214){_0x155088=_0x155088-0x0;var _0x2c32b4=_0x26f0[_0x155088];return _0x2c32b4;};'use strict';var client=require(_0x026f('0x0'));exports[_0x026f('0x1')]=function(_0x1a801c){return client[_0x026f('0x2')]('CreateFaxMessage',{'body':_0x1a801c,'log':_0x026f('0x3')});}; \ No newline at end of file +var _0x804d=['create','Request','../client'];(function(_0x54ea7f,_0x4466a8){var _0x2989e0=function(_0x526d49){while(--_0x526d49){_0x54ea7f['push'](_0x54ea7f['shift']());}};_0x2989e0(++_0x4466a8);}(_0x804d,0x1be));var _0xd804=function(_0x2add1c,_0x50f7c7){_0x2add1c=_0x2add1c-0x0;var _0x304af0=_0x804d[_0x2add1c];return _0x304af0;};'use strict';var client=require(_0xd804('0x0'));exports[_0xd804('0x1')]=function(_0x471874){return client[_0xd804('0x2')]('CreateFaxMessage',{'body':_0x471874,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 20be5ff..be5193f 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 _0xb380=['GetFaxQueue','strategy','User','Agents','name','online','faxPause','getFaxQueues'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0xb380,0x87));var _0x0b38=function(_0x1edad2,_0x13bde1){_0x1edad2=_0x1edad2-0x0;var _0x10b6a5=_0xb380[_0x1edad2];return _0x10b6a5;};'use strict';var client=require('../client');exports[_0x0b38('0x0')]=function(){return function(){return client['Request'](_0x0b38('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x0b38('0x2')],'include':[{'model':_0x0b38('0x3'),'as':_0x0b38('0x4'),'attributes':['id',_0x0b38('0x5'),_0x0b38('0x6'),_0x0b38('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xc7fb=['getFaxQueues','name','timeout','User','Agents','online','../client'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc7fb,0xe6));var _0xbc7f=function(_0x1f9e28,_0x3e3fd3){_0x1f9e28=_0x1f9e28-0x0;var _0x39d2e0=_0xc7fb[_0x1f9e28];return _0x39d2e0;};'use strict';var client=require(_0xbc7f('0x0'));exports[_0xbc7f('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xbc7f('0x2'),_0xbc7f('0x3'),'strategy'],'include':[{'model':_0xbc7f('0x4'),'as':_0xbc7f('0x5'),'attributes':['id',_0xbc7f('0x2'),_0xbc7f('0x6'),'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 1f49d6f..f8e2329 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 _0xfde4=['UpdateFaxQueueReport','../client','Request','CreateFaxQueueReport','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfde4,0x1be));var _0x4fde=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0xfde4[_0x1e3c02];return _0x4d26d7;};'use strict';var client=require(_0x4fde('0x0'));exports['create']=function(_0x2f2285){return client[_0x4fde('0x1')](_0x4fde('0x2'),{'body':_0x2f2285,'log':_0x4fde('0x2')});};exports[_0x4fde('0x3')]=function(_0x4d8dc1,_0x5944fb){return client[_0x4fde('0x1')]('UpdateFaxQueueReport',{'body':_0x5944fb,'options':{'where':{'uniqueid':_0x4d8dc1},'order':[['id','DESC']],'limit':0x1},'log':_0x4fde('0x4')});}; \ No newline at end of file +var _0xaeda=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','Request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaeda,0x1b4));var _0xaaed=function(_0x58e6cb,_0x4502b9){_0x58e6cb=_0x58e6cb-0x0;var _0x4db458=_0xaeda[_0x58e6cb];return _0x4db458;};'use strict';var client=require(_0xaaed('0x0'));exports['create']=function(_0x588ab5){return client[_0xaaed('0x1')](_0xaaed('0x2'),{'body':_0x588ab5,'log':_0xaaed('0x2')});};exports[_0xaaed('0x3')]=function(_0x245cf9,_0x5907e9){return client[_0xaaed('0x1')](_0xaaed('0x4'),{'body':_0x5907e9,'options':{'where':{'uniqueid':_0x245cf9},'order':[['id',_0xaaed('0x5')]],'limit':0x1},'log':_0xaaed('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 48a25bf..70872bb 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 _0x6e29=['getIntervals','Request','name','Intervals'];(function(_0x26a50b,_0x93e7f1){var _0x5c5918=function(_0x20fd72){while(--_0x20fd72){_0x26a50b['push'](_0x26a50b['shift']());}};_0x5c5918(++_0x93e7f1);}(_0x6e29,0x1f0));var _0x96e2=function(_0x399730,_0x257d39){_0x399730=_0x399730-0x0;var _0x3cdf8a=_0x6e29[_0x399730];return _0x3cdf8a;};'use strict';var client=require('../client');exports[_0x96e2('0x0')]=function(){return function(){return client[_0x96e2('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x96e2('0x2')],'include':[{'model':'Interval','as':_0x96e2('0x3'),'attributes':['id','name','interval']}]},'log':_0x96e2('0x0')});};}; \ No newline at end of file +var _0x771b=['getIntervals','Request','name','Interval','../client'];(function(_0x2de04a,_0x2b11b0){var _0x40910c=function(_0x29bb2e){while(--_0x29bb2e){_0x2de04a['push'](_0x2de04a['shift']());}};_0x40910c(++_0x2b11b0);}(_0x771b,0x162));var _0xb771=function(_0x366a8f,_0x2cae93){_0x366a8f=_0x366a8f-0x0;var _0x55a52f=_0x771b[_0x366a8f];return _0x55a52f;};'use strict';var client=require(_0xb771('0x0'));exports[_0xb771('0x1')]=function(){return function(){return client[_0xb771('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb771('0x3')],'include':[{'model':_0xb771('0x4'),'as':'Intervals','attributes':['id',_0xb771('0x3'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 0b6e5e2..2393ea6 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 _0x2a07=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0x2a07,0x74));var _0x72a0=function(_0x13b07a,_0x49cfc3){_0x13b07a=_0x13b07a-0x0;var _0xdcbe0=_0x2a07[_0x13b07a];return _0xdcbe0;};'use strict';var client=require(_0x72a0('0x0'));exports[_0x72a0('0x1')]=function(_0x3ed8a9,_0x437db4){return client[_0x72a0('0x2')]('UpdateMailInteraction',{'body':_0x437db4,'options':{'where':{'id':_0x3ed8a9}},'log':_0x72a0('0x3')});};exports[_0x72a0('0x4')]=function(_0x135982,_0x45b155){return client[_0x72a0('0x2')](_0x72a0('0x5'),{'body':_0x45b155,'options':{'where':{'id':_0x135982}},'log':_0x72a0('0x6')});}; \ No newline at end of file +var _0x7b84=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x4cd1aa,_0x466978){var _0x4153d8=function(_0x3b4209){while(--_0x3b4209){_0x4cd1aa['push'](_0x4cd1aa['shift']());}};_0x4153d8(++_0x466978);}(_0x7b84,0x17c));var _0x47b8=function(_0x2c7949,_0x14eeb9){_0x2c7949=_0x2c7949-0x0;var _0x4fad70=_0x7b84[_0x2c7949];return _0x4fad70;};'use strict';var client=require(_0x47b8('0x0'));exports[_0x47b8('0x1')]=function(_0x186f89,_0xda244a){return client[_0x47b8('0x2')](_0x47b8('0x3'),{'body':_0xda244a,'options':{'where':{'id':_0x186f89}},'log':_0x47b8('0x4')});};exports['addTags']=function(_0x445a5f,_0x1fa41a){return client[_0x47b8('0x2')](_0x47b8('0x5'),{'body':_0x1fa41a,'options':{'where':{'id':_0x445a5f}},'log':_0x47b8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index d81f684..e7338f3 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 _0x6443=['../client','Request','CreateMailMessage','createMailMessage'];(function(_0x540b69,_0x41b6dc){var _0x5414ab=function(_0x590db5){while(--_0x590db5){_0x540b69['push'](_0x540b69['shift']());}};_0x5414ab(++_0x41b6dc);}(_0x6443,0x78));var _0x3644=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0x6443[_0x34a8c8];return _0x1fe6e5;};'use strict';var client=require(_0x3644('0x0'));exports['create']=function(_0x6f124c){return client[_0x3644('0x1')](_0x3644('0x2'),{'body':_0x6f124c,'log':_0x3644('0x3')});}; \ No newline at end of file +var _0x69bf=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0xa6b9dd,_0x4f20ac){var _0x2b21ca=function(_0x1851e3){while(--_0x1851e3){_0xa6b9dd['push'](_0xa6b9dd['shift']());}};_0x2b21ca(++_0x4f20ac);}(_0x69bf,0x1bb));var _0xf69b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x69bf[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0xf69b('0x0'));exports[_0xf69b('0x1')]=function(_0x5c4e0a){return client[_0xf69b('0x2')](_0xf69b('0x3'),{'body':_0x5c4e0a,'log':_0xf69b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index bb71322..464b277 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 _0x7a39=['Agents','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','User'];(function(_0x266f45,_0x4a66d9){var _0x578ee1=function(_0xa4d0ac){while(--_0xa4d0ac){_0x266f45['push'](_0x266f45['shift']());}};_0x578ee1(++_0x4a66d9);}(_0x7a39,0x1e8));var _0x97a3=function(_0x4fda07,_0x36dfbf){_0x4fda07=_0x4fda07-0x0;var _0x3da3af=_0x7a39[_0x4fda07];return _0x3da3af;};'use strict';var client=require(_0x97a3('0x0'));exports[_0x97a3('0x1')]=function(){return function(){return client[_0x97a3('0x2')](_0x97a3('0x3'),{'options':{'raw':![],'attributes':['id',_0x97a3('0x4'),_0x97a3('0x5'),'strategy'],'include':[{'model':_0x97a3('0x6'),'as':_0x97a3('0x7'),'attributes':['id',_0x97a3('0x4'),'online',_0x97a3('0x8')]}]},'log':_0x97a3('0x1')});};}; \ No newline at end of file +var _0xd737=['mailPause','../client','getMailQueues','Request','timeout','strategy','User','Agents','name','online'];(function(_0x5bbeb6,_0x726d1e){var _0x930c8b=function(_0x3c26bb){while(--_0x3c26bb){_0x5bbeb6['push'](_0x5bbeb6['shift']());}};_0x930c8b(++_0x726d1e);}(_0xd737,0xdd));var _0x7d73=function(_0x44474f,_0x431580){_0x44474f=_0x44474f-0x0;var _0x427d97=_0xd737[_0x44474f];return _0x427d97;};'use strict';var client=require(_0x7d73('0x0'));exports[_0x7d73('0x1')]=function(){return function(){return client[_0x7d73('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x7d73('0x3'),_0x7d73('0x4')],'include':[{'model':_0x7d73('0x5'),'as':_0x7d73('0x6'),'attributes':['id',_0x7d73('0x7'),_0x7d73('0x8'),_0x7d73('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 4f7179f..0677bfd 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 _0x262a=['UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport','update'];(function(_0x41ec82,_0x2baabb){var _0x3128d3=function(_0x1237da){while(--_0x1237da){_0x41ec82['push'](_0x41ec82['shift']());}};_0x3128d3(++_0x2baabb);}(_0x262a,0x6d));var _0xa262=function(_0xda6d0f,_0x35e271){_0xda6d0f=_0xda6d0f-0x0;var _0x244540=_0x262a[_0xda6d0f];return _0x244540;};'use strict';var client=require(_0xa262('0x0'));exports[_0xa262('0x1')]=function(_0x430353){return client[_0xa262('0x2')](_0xa262('0x3'),{'body':_0x430353,'log':_0xa262('0x3')});};exports[_0xa262('0x4')]=function(_0x5d3367,_0x25316e){return client[_0xa262('0x2')](_0xa262('0x5'),{'body':_0x25316e,'options':{'where':{'uniqueid':_0x5d3367},'order':[['id','DESC']],'limit':0x1},'log':_0xa262('0x5')});}; \ No newline at end of file +var _0xd41c=['UpdateMailQueueReport','../client','CreateMailQueueReport','Request'];(function(_0x5a1870,_0x5a5613){var _0x39cd9f=function(_0x42ee29){while(--_0x42ee29){_0x5a1870['push'](_0x5a1870['shift']());}};_0x39cd9f(++_0x5a5613);}(_0xd41c,0x99));var _0xcd41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd41c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xcd41('0x0'));exports['create']=function(_0x31a6e3){return client['Request']('CreateMailQueueReport',{'body':_0x31a6e3,'log':_0xcd41('0x1')});};exports['update']=function(_0x5a1650,_0x4ac204){return client[_0xcd41('0x2')](_0xcd41('0x3'),{'body':_0x4ac204,'options':{'where':{'uniqueid':_0x5a1650},'order':[['id','DESC']],'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 884846f..05d819b 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 _0x35ac=['UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x4c2bc5,_0x4984e2){var _0x487209=function(_0x3cabbf){while(--_0x3cabbf){_0x4c2bc5['push'](_0x4c2bc5['shift']());}};_0x487209(++_0x4984e2);}(_0x35ac,0xe2));var _0xc35a=function(_0x572b08,_0x3e04fe){_0x572b08=_0x572b08-0x0;var _0x3ae88f=_0x35ac[_0x572b08];return _0x3ae88f;};'use strict';var client=require('../client');exports[_0xc35a('0x0')]=function(_0x3d2c76,_0x25148c){return client[_0xc35a('0x1')](_0xc35a('0x2'),{'body':_0x25148c,'options':{'where':{'id':_0x3d2c76}},'log':'updateOpenchannelInteraction'});};exports[_0xc35a('0x3')]=function(_0x2b25df,_0x291d22){return client['Request'](_0xc35a('0x4'),{'body':_0x291d22,'options':{'where':{'id':_0x2b25df}},'log':_0xc35a('0x5')});}; \ No newline at end of file +var _0x1348=['../client','update','updateOpenchannelInteraction','Request'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x1348,0x70));var _0x8134=function(_0x16f426,_0x517fed){_0x16f426=_0x16f426-0x0;var _0x15a7f4=_0x1348[_0x16f426];return _0x15a7f4;};'use strict';var client=require(_0x8134('0x0'));exports[_0x8134('0x1')]=function(_0x59845f,_0x15fdf4){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x15fdf4,'options':{'where':{'id':_0x59845f}},'log':_0x8134('0x2')});};exports['addTags']=function(_0x1cdebd,_0x3df206){return client[_0x8134('0x3')]('AddTagsToOpenchannelInteraction',{'body':_0x3df206,'options':{'where':{'id':_0x1cdebd}},'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 fd2b712..36d04d6 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 _0x99a6=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x46e7ad,_0x2ce327){var _0x268a74=function(_0x4f65db){while(--_0x4f65db){_0x46e7ad['push'](_0x46e7ad['shift']());}};_0x268a74(++_0x2ce327);}(_0x99a6,0x7c));var _0x699a=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x99a6[_0x5c6244];return _0x5800ce;};'use strict';var client=require(_0x699a('0x0'));exports[_0x699a('0x1')]=function(_0x305baf){return client['Request'](_0x699a('0x2'),{'body':_0x305baf,'log':_0x699a('0x3')});}; \ No newline at end of file +var _0xe1c2=['Request','CreateOpenchannelMessage','../client','create'];(function(_0x54525f,_0x4a58f3){var _0x1883e2=function(_0xb5fe06){while(--_0xb5fe06){_0x54525f['push'](_0x54525f['shift']());}};_0x1883e2(++_0x4a58f3);}(_0xe1c2,0x186));var _0x2e1c=function(_0x4cea96,_0x25c165){_0x4cea96=_0x4cea96-0x0;var _0x4cc7de=_0xe1c2[_0x4cea96];return _0x4cc7de;};'use strict';var client=require(_0x2e1c('0x0'));exports[_0x2e1c('0x1')]=function(_0x729395){return client[_0x2e1c('0x2')](_0x2e1c('0x3'),{'body':_0x729395,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 6449d32..6250dee 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 _0x8b9d=['online','openchannelPause','../client','getOpenchannelQueues','Request','timeout','Agents','name'];(function(_0x34f360,_0x25f60c){var _0x39a812=function(_0x10583c){while(--_0x10583c){_0x34f360['push'](_0x34f360['shift']());}};_0x39a812(++_0x25f60c);}(_0x8b9d,0x6a));var _0xd8b9=function(_0x467ef6,_0x932cef){_0x467ef6=_0x467ef6-0x0;var _0x3e4aa2=_0x8b9d[_0x467ef6];return _0x3e4aa2;};'use strict';var client=require(_0xd8b9('0x0'));exports[_0xd8b9('0x1')]=function(){return function(){return client[_0xd8b9('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0xd8b9('0x3'),'strategy'],'include':[{'model':'User','as':_0xd8b9('0x4'),'attributes':['id',_0xd8b9('0x5'),_0xd8b9('0x6'),_0xd8b9('0x7')]}]},'log':_0xd8b9('0x1')});};}; \ No newline at end of file +var _0x61d7=['Agents','name','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x201244,_0x164b93){var _0x3a5598=function(_0x418039){while(--_0x418039){_0x201244['push'](_0x201244['shift']());}};_0x3a5598(++_0x164b93);}(_0x61d7,0x119));var _0x761d=function(_0x1e1718,_0x4d1bde){_0x1e1718=_0x1e1718-0x0;var _0x4a02e8=_0x61d7[_0x1e1718];return _0x4a02e8;};'use strict';var client=require(_0x761d('0x0'));exports[_0x761d('0x1')]=function(){return function(){return client[_0x761d('0x2')](_0x761d('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x761d('0x4'),_0x761d('0x5')],'include':[{'model':_0x761d('0x6'),'as':_0x761d('0x7'),'attributes':['id',_0x761d('0x8'),'online','openchannelPause']}]},'log':_0x761d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ac13d88..77698c7 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 _0x05bf=['create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x229e9c,_0x17ae27){var _0x2e0e5b=function(_0x4cc096){while(--_0x4cc096){_0x229e9c['push'](_0x229e9c['shift']());}};_0x2e0e5b(++_0x17ae27);}(_0x05bf,0x77));var _0xf05b=function(_0x20c77f,_0x1e5c2b){_0x20c77f=_0x20c77f-0x0;var _0x27817b=_0x05bf[_0x20c77f];return _0x27817b;};'use strict';var client=require(_0xf05b('0x0'));exports[_0xf05b('0x1')]=function(_0x1dbe0b){return client[_0xf05b('0x2')](_0xf05b('0x3'),{'body':_0x1dbe0b,'log':_0xf05b('0x3')});};exports['update']=function(_0x1395a7,_0xc67c3f){return client[_0xf05b('0x2')](_0xf05b('0x4'),{'body':_0xc67c3f,'options':{'where':{'uniqueid':_0x1395a7},'order':[['id',_0xf05b('0x5')]],'limit':0x1},'log':_0xf05b('0x4')});}; \ No newline at end of file +var _0x0609=['UpdateOpenchannelQueueReport','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x3f0773,_0x4a53b2){var _0x23168f=function(_0x907ef9){while(--_0x907ef9){_0x3f0773['push'](_0x3f0773['shift']());}};_0x23168f(++_0x4a53b2);}(_0x0609,0x196));var _0x9060=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x0609[_0x565c49];return _0x20ca34;};'use strict';var client=require('../client');exports[_0x9060('0x0')]=function(_0x56a309){return client[_0x9060('0x1')](_0x9060('0x2'),{'body':_0x56a309,'log':_0x9060('0x2')});};exports[_0x9060('0x3')]=function(_0x36d018,_0x3475d7){return client[_0x9060('0x1')](_0x9060('0x4'),{'body':_0x3475d7,'options':{'where':{'uniqueid':_0x36d018},'order':[['id','DESC']],'limit':0x1},'log':_0x9060('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 2081139..4ed72d9 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 _0xe953=['UpdateSmsInteraction','updateSmsInteraction','Request','addTagsToSmsInteraction'];(function(_0x1bfaa0,_0x41fcbd){var _0x1fdc3e=function(_0x39b765){while(--_0x39b765){_0x1bfaa0['push'](_0x1bfaa0['shift']());}};_0x1fdc3e(++_0x41fcbd);}(_0xe953,0x1d0));var _0x3e95=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xe953[_0x68c979];return _0x4f0001;};'use strict';var client=require('../client');exports['update']=function(_0x523e85,_0x5678ed){return client['Request'](_0x3e95('0x0'),{'body':_0x5678ed,'options':{'where':{'id':_0x523e85}},'log':_0x3e95('0x1')});};exports['addTags']=function(_0x46f343,_0x5a0541){return client[_0x3e95('0x2')]('AddTagsToSmsInteraction',{'body':_0x5a0541,'options':{'where':{'id':_0x46f343}},'log':_0x3e95('0x3')});}; \ No newline at end of file +var _0x4a25=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x4339f8,_0x20cbff){var _0xa59522=function(_0x2dfa2b){while(--_0x2dfa2b){_0x4339f8['push'](_0x4339f8['shift']());}};_0xa59522(++_0x20cbff);}(_0x4a25,0x1d4));var _0x54a2=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0x4a25[_0xcf581b];return _0x4f454d;};'use strict';var client=require(_0x54a2('0x0'));exports['update']=function(_0x3cb36c,_0x5dcbed){return client[_0x54a2('0x1')](_0x54a2('0x2'),{'body':_0x5dcbed,'options':{'where':{'id':_0x3cb36c}},'log':_0x54a2('0x3')});};exports[_0x54a2('0x4')]=function(_0x5c6c1f,_0x3031e9){return client[_0x54a2('0x1')](_0x54a2('0x5'),{'body':_0x3031e9,'options':{'where':{'id':_0x5c6c1f}},'log':_0x54a2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 5d59ac2..200ad99 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 _0x0794=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x0794,0x1a6));var _0x4079=function(_0x551a3d,_0x389881){_0x551a3d=_0x551a3d-0x0;var _0x331e82=_0x0794[_0x551a3d];return _0x331e82;};'use strict';var client=require(_0x4079('0x0'));exports[_0x4079('0x1')]=function(_0x24fbfe){return client['Request'](_0x4079('0x2'),{'body':_0x24fbfe,'log':_0x4079('0x3')});}; \ No newline at end of file +var _0xc17c=['createSmsMessage','../client','create','Request'];(function(_0x58345d,_0x2b6513){var _0x5db355=function(_0x5dc0f3){while(--_0x5dc0f3){_0x58345d['push'](_0x58345d['shift']());}};_0x5db355(++_0x2b6513);}(_0xc17c,0x1d5));var _0xcc17=function(_0x3bb9bf,_0x5a16cf){_0x3bb9bf=_0x3bb9bf-0x0;var _0x4f7db4=_0xc17c[_0x3bb9bf];return _0x4f7db4;};'use strict';var client=require(_0xcc17('0x0'));exports[_0xcc17('0x1')]=function(_0x3bc484){return client[_0xcc17('0x2')]('CreateSmsMessage',{'body':_0x3bc484,'log':_0xcc17('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c41a38e..6d55340 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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x55518c,_0xe06cdd){var _0x58cfc9=function(_0x8aafd2){while(--_0x8aafd2){_0x55518c['push'](_0x55518c['shift']());}};_0x58cfc9(++_0xe06cdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x38c6c6,_0x25c022){var _0x56975f=function(_0x285f4c){while(--_0x285f4c){_0x38c6c6['push'](_0x38c6c6['shift']());}};_0x56975f(++_0x25c022);}(_0x70e0,0x17b));var _0x070e=function(_0xf1e917,_0x2565e2){_0xf1e917=_0xf1e917-0x0;var _0x203435=_0x70e0[_0xf1e917];return _0x203435;};'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 2b6e07b..1b0f620 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ff391,_0x797a58){_0x4ff391=_0x4ff391-0x0;var _0x3d2f2b=_0xedd9[_0x4ff391];return _0x3d2f2b;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x256ec1,_0x11e7b2){var _0x568d7d=function(_0x560aea){while(--_0x560aea){_0x256ec1['push'](_0x256ec1['shift']());}};_0x568d7d(++_0x11e7b2);}(_0x3e74,0x175));var _0x43e7=function(_0x5e042a,_0x4a9382){_0x5e042a=_0x5e042a-0x0;var _0x47370a=_0x3e74[_0x5e042a];return _0x47370a;};'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 beb8210..328ce1c 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(_0x3ce876,_0x5f2f77){var _0x8e99a6=function(_0x49a180){while(--_0x49a180){_0x3ce876['push'](_0x3ce876['shift']());}};_0x8e99a6(++_0x5f2f77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x3da3c4,_0x37ac14){var _0x5aedec=function(_0x3a5c49){while(--_0x3a5c49){_0x3da3c4['push'](_0x3da3c4['shift']());}};_0x5aedec(++_0x37ac14);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 9ebc8fb..5ea5d48 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 _0xfcf0=['UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x19fbdc,_0x2e1d6a){var _0x176533=function(_0x9003da){while(--_0x9003da){_0x19fbdc['push'](_0x19fbdc['shift']());}};_0x176533(++_0x2e1d6a);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0xfcf0[_0x2e04ef];return _0x5722b0;};'use strict';var client=require(_0x0fcf('0x0'));exports[_0x0fcf('0x1')]=function(_0x575167,_0x45b7f4){return client[_0x0fcf('0x2')](_0x0fcf('0x3'),{'body':_0x45b7f4,'options':{'where':{'id':_0x575167}},'log':_0x0fcf('0x4')});};exports['addTags']=function(_0x2fe6d8,_0x265968){return client[_0x0fcf('0x2')](_0x0fcf('0x5'),{'body':_0x265968,'options':{'where':{'id':_0x2fe6d8}},'log':_0x0fcf('0x6')});}; \ No newline at end of file +var _0xbbbd=['AddTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xbbbd,0x86));var _0xdbbb=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xbbbd[_0x346737];return _0x1ade2e;};'use strict';var client=require(_0xdbbb('0x0'));exports[_0xdbbb('0x1')]=function(_0x38b7aa,_0x2350b9){return client[_0xdbbb('0x2')](_0xdbbb('0x3'),{'body':_0x2350b9,'options':{'where':{'id':_0x38b7aa}},'log':_0xdbbb('0x4')});};exports[_0xdbbb('0x5')]=function(_0x3b665d,_0x114d3a){return client[_0xdbbb('0x2')](_0xdbbb('0x6'),{'body':_0x114d3a,'options':{'where':{'id':_0x3b665d}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 4e7e7e7..2f3a2b5 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 _0x8544=['CreateWhatsappMessage','createWhatsappMessage','../client','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8544,0x10e));var _0x4854=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x8544[_0xaa0309];return _0x5de7ce;};'use strict';var client=require(_0x4854('0x0'));exports['create']=function(_0x541f18){return client[_0x4854('0x1')](_0x4854('0x2'),{'body':_0x541f18,'log':_0x4854('0x3')});}; \ No newline at end of file +var _0xf69d=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0x59426d,_0x4d5f62){var _0x433219=function(_0x252efe){while(--_0x252efe){_0x59426d['push'](_0x59426d['shift']());}};_0x433219(++_0x4d5f62);}(_0xf69d,0x6d));var _0xdf69=function(_0x4f9193,_0x593c11){_0x4f9193=_0x4f9193-0x0;var _0x55e9e1=_0xf69d[_0x4f9193];return _0x55e9e1;};'use strict';var client=require(_0xdf69('0x0'));exports[_0xdf69('0x1')]=function(_0x132cdd){return client['Request'](_0xdf69('0x2'),{'body':_0x132cdd,'log':_0xdf69('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 1702e23..bc0f607 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 _0xafc6=['name','whatsappPause','getWhatsappQueues','../client','Request','timeout','User','Agents'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xafc6,0x11b));var _0x6afc=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xafc6[_0x39e84d];return _0x1991bc;};'use strict';var client=require(_0x6afc('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x6afc('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0x6afc('0x2'),'strategy'],'include':[{'model':_0x6afc('0x3'),'as':_0x6afc('0x4'),'attributes':['id',_0x6afc('0x5'),'online',_0x6afc('0x6')]}]},'log':_0x6afc('0x7')});};}; \ No newline at end of file +var _0xaee3=['Agents','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','User'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xaee3,0x1e0));var _0x3aee=function(_0x310990,_0x245984){_0x310990=_0x310990-0x0;var _0x648534=_0xaee3[_0x310990];return _0x648534;};'use strict';var client=require(_0x3aee('0x0'));exports[_0x3aee('0x1')]=function(){return function(){return client['Request'](_0x3aee('0x2'),{'options':{'raw':![],'attributes':['id',_0x3aee('0x3'),_0x3aee('0x4'),'strategy'],'include':[{'model':_0x3aee('0x5'),'as':_0x3aee('0x6'),'attributes':['id',_0x3aee('0x3'),_0x3aee('0x7'),_0x3aee('0x8')]}]},'log':_0x3aee('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5ecdd80..2d70040 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 _0xc519=['UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','DESC'];(function(_0x5f5942,_0x21f24b){var _0x40ce5c=function(_0xa0e20f){while(--_0xa0e20f){_0x5f5942['push'](_0x5f5942['shift']());}};_0x40ce5c(++_0x21f24b);}(_0xc519,0x1c3));var _0x9c51=function(_0x3a71c7,_0x48599b){_0x3a71c7=_0x3a71c7-0x0;var _0xc8ff43=_0xc519[_0x3a71c7];return _0xc8ff43;};'use strict';var client=require(_0x9c51('0x0'));exports[_0x9c51('0x1')]=function(_0x18c027){return client[_0x9c51('0x2')]('CreateWhatsappQueueReport',{'body':_0x18c027,'log':_0x9c51('0x3')});};exports['update']=function(_0x4eb4a5,_0x4fbef8){return client[_0x9c51('0x2')]('UpdateWhatsappQueueReport',{'body':_0x4fbef8,'options':{'where':{'uniqueid':_0x4eb4a5},'order':[['id',_0x9c51('0x4')]],'limit':0x1},'log':_0x9c51('0x5')});}; \ No newline at end of file +var _0x1c34=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','Request'];(function(_0x1d4b38,_0x31cc9f){var _0x341c2d=function(_0x1952f7){while(--_0x1952f7){_0x1d4b38['push'](_0x1d4b38['shift']());}};_0x341c2d(++_0x31cc9f);}(_0x1c34,0x8a));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x41c3('0x0'));exports['create']=function(_0x2d67a1){return client[_0x41c3('0x1')](_0x41c3('0x2'),{'body':_0x2d67a1,'log':_0x41c3('0x2')});};exports[_0x41c3('0x3')]=function(_0x4f8adc,_0x18ed9f){return client['Request'](_0x41c3('0x4'),{'body':_0x18ed9f,'options':{'where':{'uniqueid':_0x4f8adc},'order':[['id','DESC']],'limit':0x1},'log':_0x41c3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 21948bd..516c320 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 _0xb6ad=['complete','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s','map','join','stop','agents','timeout','createQueue','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close'];(function(_0x34271c,_0x28a8b){var _0x83585f=function(_0x7d2264){while(--_0x7d2264){_0x34271c['push'](_0x34271c['shift']());}};_0x83585f(++_0x28a8b);}(_0xb6ad,0x1d5));var _0xdb6a=function(_0x201e4b,_0x5bcb2c){_0x201e4b=_0x201e4b-0x0;var _0x29d937=_0xb6ad[_0x201e4b];return _0x29d937;};'use strict';var schema=require('validate');var _=require(_0xdb6a('0x0'));var util=require(_0xdb6a('0x1'));var seqqueue=require(_0xdb6a('0x2'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0xdb6a('0x3'),'required':!![],'message':_0xdb6a('0x4')},'timeout':{'type':_0xdb6a('0x5'),'message':_0xdb6a('0x6')}});function writeLog(_0x4dfc01,_0x4a5fd4,_0x2480a5){return logger[_0xdb6a('0x7')](util[_0xdb6a('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x4dfc01,_0x4a5fd4['name'],_0x2480a5));}function handleFindAgent(_0x1028b7){return function(_0x4f8696){return _0x4f8696[_0xdb6a('0x9')]['toLowerCase']()===_0x1028b7[_0xdb6a('0xa')]();};}exports[_0xdb6a('0xb')]=function(_0x343f43,_0x275d67,_0x22fc69,_0x356925){return function(_0x38e671){try{var _0x28efa4={'name':_0x275d67[0x0],'timeout':_0x275d67[0x1]};var _0x2997cd=queue[_0xdb6a('0xc')](_0x28efa4,{'typecast':!![]});if(_0x2997cd[_0xdb6a('0xd')]){logger['error'](_0xdb6a('0xe'),_0x343f43,_[_0xdb6a('0xf')](_0x2997cd,'message')[_0xdb6a('0x10')](',\x20'));_0x38e671[_0xdb6a('0x11')]();}else{var _0x30ffa3=_['find'](_0x22fc69[_0xdb6a('0x12')],handleFindAgent(_0x28efa4[_0xdb6a('0x9')]));if(_0x30ffa3){var _0x36c73d=(_0x28efa4[_0xdb6a('0x13')]||0xa)*0x3e8;var _0x44ffe8,_0x45c7b6;var _0x47f268=seqqueue[_0xdb6a('0x14')](_0x36c73d);_0x47f268['id']=_0x343f43;_0x47f268['atimeout']=_0x36c73d;_0x47f268['channel']=_0x356925[_0xdb6a('0x15')];writeLog(_0x343f43,_0x30ffa3,util[_0xdb6a('0x8')](_0xdb6a('0x16'),_0x36c73d));_0x22fc69[_0xdb6a('0x17')][_0x343f43]['on']('end',function(){logger[_0xdb6a('0x7')](_0xdb6a('0x18'),_0x343f43);clearTimeout(_0x45c7b6);_0x45c7b6=undefined;_0x47f268[_0xdb6a('0x19')]();if(_0x22fc69[_0xdb6a('0x17')][_0x343f43]){delete _0x22fc69['rules'][_0x343f43];}_0x38e671['stop']();});_0x22fc69[_0xdb6a('0x17')][_0x343f43]['on'](_0xdb6a('0x1a'),function(){if(_0x22fc69[_0xdb6a('0x17')][_0x343f43]){delete _0x22fc69[_0xdb6a('0x17')][_0x343f43];}});_0x45c7b6=setTimeout(function(){logger[_0xdb6a('0x7')]('[%s][AGENT]\x20ROUTING\x20END',_0x343f43);clearTimeout(_0x45c7b6);_0x47f268['close']();_0x38e671['next']();},_0x36c73d);strategy[_0xdb6a('0x1b')](_0x47f268,_0x30ffa3,_0x22fc69,_0x356925);}else{logger[_0xdb6a('0x1c')](_0xdb6a('0x1d'),_0x343f43,_0x28efa4['name']);_0x38e671['stop']();}}}catch(_0x28f133){console[_0xdb6a('0x1e')](_0x28f133);logger[_0xdb6a('0x1c')](_0xdb6a('0x1f'),_0x343f43,_0x28f133[_0xdb6a('0x20')]);_0x38e671[_0xdb6a('0x11')]();}};}; \ No newline at end of file +var _0x99ff=['close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','routing','./strategy','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','stop','find','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x99ff,0x127));var _0xf99f=function(_0x2e84ee,_0x283c59){_0x2e84ee=_0x2e84ee-0x0;var _0x5c82d0=_0x99ff[_0x2e84ee];return _0x5c82d0;};'use strict';var schema=require(_0xf99f('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0xf99f('0x1'));var strategy=require(_0xf99f('0x2'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf99f('0x3'),'message':_0xf99f('0x4')}});function writeLog(_0x1cd238,_0x773edc,_0x2065f3){return logger[_0xf99f('0x5')](util[_0xf99f('0x6')](_0xf99f('0x7'),_0x1cd238,_0x773edc[_0xf99f('0x8')],_0x2065f3));}function handleFindAgent(_0x123c89){return function(_0x1d3dc1){return _0x1d3dc1[_0xf99f('0x8')][_0xf99f('0x9')]()===_0x123c89[_0xf99f('0x9')]();};}exports[_0xf99f('0xa')]=function(_0x49f5ad,_0x118966,_0x2ef479,_0x109bdc){return function(_0x23ce5f){try{var _0x12a770={'name':_0x118966[0x0],'timeout':_0x118966[0x1]};var _0x95a10c=queue['validate'](_0x12a770,{'typecast':!![]});if(_0x95a10c[_0xf99f('0xb')]){logger[_0xf99f('0xc')](_0xf99f('0xd'),_0x49f5ad,_[_0xf99f('0xe')](_0x95a10c,_0xf99f('0xf'))['join'](',\x20'));_0x23ce5f[_0xf99f('0x10')]();}else{var _0x3fc21b=_[_0xf99f('0x11')](_0x2ef479['agents'],handleFindAgent(_0x12a770[_0xf99f('0x8')]));if(_0x3fc21b){var _0x506e55=(_0x12a770[_0xf99f('0x12')]||0xa)*0x3e8;var _0x17b657,_0x326edf;var _0x4eb37a=seqqueue['createQueue'](_0x506e55);_0x4eb37a['id']=_0x49f5ad;_0x4eb37a[_0xf99f('0x13')]=_0x506e55;_0x4eb37a[_0xf99f('0x14')]=_0x109bdc[_0xf99f('0x14')];writeLog(_0x49f5ad,_0x3fc21b,util[_0xf99f('0x6')](_0xf99f('0x15'),_0x506e55));_0x2ef479[_0xf99f('0x16')][_0x49f5ad]['on'](_0xf99f('0x17'),function(){logger[_0xf99f('0x5')](_0xf99f('0x18'),_0x49f5ad);clearTimeout(_0x326edf);_0x326edf=undefined;_0x4eb37a[_0xf99f('0x19')]();if(_0x2ef479[_0xf99f('0x16')][_0x49f5ad]){delete _0x2ef479[_0xf99f('0x16')][_0x49f5ad];}_0x23ce5f[_0xf99f('0x10')]();});_0x2ef479[_0xf99f('0x16')][_0x49f5ad]['on']('complete',function(){if(_0x2ef479[_0xf99f('0x16')][_0x49f5ad]){delete _0x2ef479[_0xf99f('0x16')][_0x49f5ad];}});_0x326edf=setTimeout(function(){logger[_0xf99f('0x5')](_0xf99f('0x1a'),_0x49f5ad);clearTimeout(_0x326edf);_0x4eb37a[_0xf99f('0x19')]();_0x23ce5f[_0xf99f('0x1b')]();},_0x506e55);strategy[_0xf99f('0x1c')](_0x4eb37a,_0x3fc21b,_0x2ef479,_0x109bdc);}else{logger[_0xf99f('0xc')](_0xf99f('0x1d'),_0x49f5ad,_0x12a770[_0xf99f('0x8')]);_0x23ce5f[_0xf99f('0x10')]();}}}catch(_0x3d81da){console[_0xf99f('0x1e')](_0x3d81da);logger['error']('[%s][QUEUE]\x20%s',_0x49f5ad,_0x3d81da[_0xf99f('0x1f')]);_0x23ce5f[_0xf99f('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index cd1af5a..28edefe 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 _0xba5d=['sms','phone','interaction','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','body','getMustacheRender','create','then','catch','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','toString','postText','error','[%s][AMAZONLEX]\x20%s','message','amazonlex','providerName','providerResponse','stringify','Message','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x29aca7,_0x21c650){var _0x1db0a0=function(_0x45b5ea){while(--_0x45b5ea){_0x29aca7['push'](_0x29aca7['shift']());}};_0x1db0a0(++_0x21c650);}(_0xba5d,0x1b5));var _0xdba5=function(_0x3f453f,_0x548371){_0x3f453f=_0x3f453f-0x0;var _0x325aa2=_0xba5d[_0x3f453f];return _0x325aa2;};'use strict';var _=require(_0xdba5('0x0'));var moment=require(_0xdba5('0x1'));var AWS=require(_0xdba5('0x2'));var utils=require(_0xdba5('0x3'));var logger=require(_0xdba5('0x4'))(_0xdba5('0x5'));var rpc={'chatMessage':require(_0xdba5('0x6')),'openchannelMessage':require(_0xdba5('0x7')),'mailMessage':require(_0xdba5('0x8')),'smsMessage':require(_0xdba5('0x9')),'faxMessage':require(_0xdba5('0xa')),'whatsappMessage':require(_0xdba5('0xb'))};exports[_0xdba5('0xc')]=function(_0x4186b4,_0x165304){return function(_0x3a7df9){try{if(!_[_0xdba5('0xd')](this['interaction']['UserId'])){logger[_0xdba5('0xe')]('[%s][AMAZONLEX]\x20%s',_0x4186b4,_0xdba5('0xf'));return _0x3a7df9[_0xdba5('0x10')]();}var _0x210900={'ContactId':this[_0xdba5('0x11')]['id'],'sentAt':moment()[_0xdba5('0x12')](_0xdba5('0x13')),'direction':_0xdba5('0x14')};if(this[_0xdba5('0x15')]===_0xdba5('0x16')||this[_0xdba5('0x15')]==='whatsapp'){_0x210900[_0xdba5('0x17')]=this[_0xdba5('0x18')][_0xdba5('0x17')];}var _0x3cc316=this[_0xdba5('0x15')];if(_0x3cc316===_0xdba5('0x19')){_0x210900[_0xdba5('0x1a')]=this[_0xdba5('0x1b')]['id'];}else{_0x210900[_[_0xdba5('0x1c')](_0x3cc316)+'AccountId']=this[_0xdba5('0x1b')]['id'];}_0x210900[_[_0xdba5('0x1c')](_0x3cc316)+'InteractionId']=this[_0xdba5('0x18')]['id'];if(this[_0xdba5('0x18')][_0xdba5('0x1d')]){var _0xdce21f=_0x165304[0x4];if(!_[_0xdba5('0x1e')](_0xdce21f)){_0x210900[_0xdba5('0x1f')]=utils[_0xdba5('0x20')](_0xdce21f,this);return rpc[_0x3cc316+'Message'][_0xdba5('0x21')](_0x210900)[_0xdba5('0x22')](function(_0x398ac7){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4186b4,_0x210900[_0xdba5('0x1f')]);})[_0xdba5('0x23')](function(_0x2f4441){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4186b4,JSON['stringify'](_0x2f4441));})['finally'](function(){logger[_0xdba5('0xe')](_0xdba5('0x24'),_0x4186b4);_0x3a7df9[_0xdba5('0x25')]();});}else{logger[_0xdba5('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4186b4);_0x3a7df9[_0xdba5('0x25')]();}}else{var _0x4bf748=this;var _0x4dbc82=new AWS[(_0xdba5('0x26'))]({'accessKeyId':_0x165304[0x0],'secretAccessKey':_0x165304[0x1],'region':_0x165304[0x2]});var _0x477120={'botAlias':_0xdba5('0x27'),'botName':_0x165304[0x3],'inputText':this['message'][_0xdba5('0x1f')],'userId':this[_0xdba5('0x15')]+':'+this[_0xdba5('0x18')]['id'][_0xdba5('0x28')]()};_0x4dbc82[_0xdba5('0x29')](_0x477120,function(_0x11bf2e,_0x4fbacb){if(_0x11bf2e){logger[_0xdba5('0x2a')](_0xdba5('0x2b'),_0x4186b4,_0x11bf2e[_0xdba5('0x2c')]);_0x3a7df9['next']();}else if(_0x4fbacb&&_0x4fbacb['message']){_0x4bf748[_0xdba5('0x1f')][_0xdba5('0x2d')]=_0x4fbacb;_0x210900['body']=_0x4fbacb[_0xdba5('0x2c')];_0x210900[_0xdba5('0x2e')]=_0xdba5('0x2d');_0x210900[_0xdba5('0x2f')]=JSON[_0xdba5('0x30')](_0x4fbacb);return rpc[_0x3cc316+_0xdba5('0x31')][_0xdba5('0x21')](_0x210900)['then'](function(_0x11e60a){logger[_0xdba5('0xe')](_0xdba5('0x2b'),_0x4186b4,_0x210900[_0xdba5('0x1f')]);if(_0x4fbacb['dialogState']==_0xdba5('0x32')){_0x3a7df9[_0xdba5('0x10')]();}else{_0x3a7df9['stop']();}})[_0xdba5('0x23')](function(_0x286276){logger[_0xdba5('0x2a')](_0xdba5('0x2b'),_0x4186b4,JSON[_0xdba5('0x30')](_0x286276));_0x3a7df9[_0xdba5('0x10')]();});}else{_0x3a7df9['next']();}});}}catch(_0x5c6222){logger[_0xdba5('0x2a')](_0xdba5('0x2b'),_0x4186b4,JSON['stringify'](_0x5c6222));_0x3a7df9[_0xdba5('0x25')]();}};}; \ No newline at end of file +var _0x8f2a=['LexRuntime','$LATEST','toString','error','message','providerName','providerResponse','create','catch','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','stringify','finally','info'];(function(_0x52c943,_0x23892c){var _0x2debfb=function(_0x31472b){while(--_0x31472b){_0x52c943['push'](_0x52c943['shift']());}};_0x2debfb(++_0x23892c);}(_0x8f2a,0x111));var _0xa8f2=function(_0x117473,_0x485375){_0x117473=_0x117473-0x0;var _0x38711a=_0x8f2a[_0x117473];return _0x38711a;};'use strict';var _=require(_0xa8f2('0x0'));var moment=require(_0xa8f2('0x1'));var AWS=require('aws-sdk');var utils=require(_0xa8f2('0x2'));var logger=require(_0xa8f2('0x3'))(_0xa8f2('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa8f2('0x5')),'mailMessage':require(_0xa8f2('0x6')),'smsMessage':require(_0xa8f2('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa8f2('0x8'))};exports[_0xa8f2('0x9')]=function(_0x32a1c3,_0x1b567b){return function(_0x374f47){try{if(!_[_0xa8f2('0xa')](this['interaction'][_0xa8f2('0xb')])){logger['info'](_0xa8f2('0xc'),_0x32a1c3,_0xa8f2('0xd'));return _0x374f47[_0xa8f2('0xe')]();}var _0x275e94={'ContactId':this[_0xa8f2('0xf')]['id'],'sentAt':moment()[_0xa8f2('0x10')](_0xa8f2('0x11')),'direction':_0xa8f2('0x12')};if(this[_0xa8f2('0x13')]==='sms'||this['channel']==='whatsapp'){_0x275e94[_0xa8f2('0x14')]=this[_0xa8f2('0x15')][_0xa8f2('0x14')];}var _0x39182e=this[_0xa8f2('0x13')];if(_0x39182e===_0xa8f2('0x16')){_0x275e94[_0xa8f2('0x17')]=this[_0xa8f2('0x18')]['id'];}else{_0x275e94[_[_0xa8f2('0x19')](_0x39182e)+_0xa8f2('0x1a')]=this[_0xa8f2('0x18')]['id'];}_0x275e94[_[_0xa8f2('0x19')](_0x39182e)+_0xa8f2('0x1b')]=this[_0xa8f2('0x15')]['id'];if(this[_0xa8f2('0x15')]['created']){var _0x3d71f3=_0x1b567b[0x4];if(!_[_0xa8f2('0x1c')](_0x3d71f3)){_0x275e94[_0xa8f2('0x1d')]=utils[_0xa8f2('0x1e')](_0x3d71f3,this);return rpc[_0x39182e+_0xa8f2('0x1f')]['create'](_0x275e94)['then'](function(_0x5db86e){logger['info'](_0xa8f2('0xc'),_0x32a1c3,_0x275e94[_0xa8f2('0x1d')]);})['catch'](function(_0x241ec7){logger['error'](_0xa8f2('0xc'),_0x32a1c3,JSON[_0xa8f2('0x20')](_0x241ec7));})[_0xa8f2('0x21')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x32a1c3);_0x374f47['stop']();});}else{logger[_0xa8f2('0x22')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x32a1c3);_0x374f47['stop']();}}else{var _0x868870=this;var _0x4a0d9e=new AWS[(_0xa8f2('0x23'))]({'accessKeyId':_0x1b567b[0x0],'secretAccessKey':_0x1b567b[0x1],'region':_0x1b567b[0x2]});var _0x234abd={'botAlias':_0xa8f2('0x24'),'botName':_0x1b567b[0x3],'inputText':this['message']['body'],'userId':this[_0xa8f2('0x13')]+':'+this[_0xa8f2('0x15')]['id'][_0xa8f2('0x25')]()};_0x4a0d9e['postText'](_0x234abd,function(_0x34efcd,_0x112359){if(_0x34efcd){logger[_0xa8f2('0x26')](_0xa8f2('0xc'),_0x32a1c3,_0x34efcd['message']);_0x374f47[_0xa8f2('0xe')]();}else if(_0x112359&&_0x112359[_0xa8f2('0x27')]){_0x868870['body']['amazonlex']=_0x112359;_0x275e94['body']=_0x112359[_0xa8f2('0x27')];_0x275e94[_0xa8f2('0x28')]='amazonlex';_0x275e94[_0xa8f2('0x29')]=JSON['stringify'](_0x112359);return rpc[_0x39182e+_0xa8f2('0x1f')][_0xa8f2('0x2a')](_0x275e94)['then'](function(_0x378798){logger['info']('[%s][AMAZONLEX]\x20%s',_0x32a1c3,_0x275e94[_0xa8f2('0x1d')]);if(_0x112359['dialogState']=='Failed'){_0x374f47[_0xa8f2('0xe')]();}else{_0x374f47['stop']();}})[_0xa8f2('0x2b')](function(_0x3a0b7b){logger[_0xa8f2('0x26')]('[%s][AMAZONLEX]\x20%s',_0x32a1c3,JSON[_0xa8f2('0x20')](_0x3a0b7b));_0x374f47[_0xa8f2('0xe')]();});}else{_0x374f47['next']();}});}}catch(_0x45f45f){logger['error'](_0xa8f2('0xc'),_0x32a1c3,JSON[_0xa8f2('0x20')](_0x45f45f));_0x374f47['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 981c753..4d9421d 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 _0x7577=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','info','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','channel','from','phone','read','subject','startsWith','chat','account','AccountId','upperFirst','InteractionId','Message','messageId','html','','replace','','auto_reply','sendMailMessage','smtpOptions','create','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x7577,0x1bc));var _0x7757=function(_0x3384f8,_0x1644f3){_0x3384f8=_0x3384f8-0x0;var _0x2cf6cd=_0x7577[_0x3384f8];return _0x2cf6cd;};'use strict';var _=require(_0x7757('0x0'));var moment=require(_0x7757('0x1'));var utils=require('./utils');var logger=require(_0x7757('0x2'))(_0x7757('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7757('0x4')),'mailMessage':require(_0x7757('0x5')),'smsMessage':require(_0x7757('0x6')),'faxMessage':require(_0x7757('0x7')),'whatsappMessage':require(_0x7757('0x8')),'chatInteraction':require(_0x7757('0x9')),'openchannelInteraction':require(_0x7757('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x7757('0xb')),'whatsappInteraction':require(_0x7757('0xc'))};var mailRpc=require(_0x7757('0xd'));exports[_0x7757('0xe')]=function(_0x26329e,_0x421ba0,_0xc52b1f,_0x5df45b){return function(_0x2e6ba8){try{var _0x3701ce=this['channel'];if(_0x3701ce===_0x7757('0xf')&&_0x5df45b['body']['isAutoreply']){logger['info'](_0x7757('0x10'),_0x26329e,_0x7757('0x11'));return _0x2e6ba8[_0x7757('0x12')]();}if(_0x421ba0[0x0]==='1'&&(_['isNil'](this[_0x7757('0x13')][_0x7757('0x14')])||!this[_0x7757('0x13')]['created'])){logger[_0x7757('0x15')](_0x7757('0x10'),_0x26329e,'Autoreply\x20already\x20sent');return _0x2e6ba8[_0x7757('0x12')]();}if(_0x421ba0[0x0]==='2'&&this['interaction'][_0x7757('0x16')]){logger[_0x7757('0x15')](_0x7757('0x17'),_0x26329e,_0x7757('0x18'));return _0x2e6ba8[_0x7757('0x12')]();}var _0x3947cf={'ContactId':this['contact']['id'],'sentAt':moment()[_0x7757('0x19')](_0x7757('0x1a')),'direction':_0x7757('0x1b')};if(this['channel']===_0x7757('0xf')){_0x3947cf[_0x7757('0x1c')]=utils[_0x7757('0x1d')](_0x421ba0[0x2],this);}else{_0x3947cf[_0x7757('0x1c')]=utils[_0x7757('0x1d')](_0x421ba0[0x1],this);}if(this[_0x7757('0x1e')]){_0x3947cf['to']=this[_0x7757('0x1e')]['from']||'';if(this[_0x7757('0x1f')]==='mail'&&_0x421ba0[0x1]==='1'){_0x3947cf['cc']=this[_0x7757('0x1e')]['cc']||'';}_0x3947cf[_0x7757('0x20')]=this[_0x7757('0x1e')]['to']||'';_0x3947cf[_0x7757('0x21')]=this['message'][_0x7757('0x21')]||'';_0x3947cf[_0x7757('0x22')]=!![];if(this['message'][_0x7757('0x23')]){_0x3947cf['subject']='';_0x3947cf[_0x7757('0x23')]+=_[_0x7757('0x24')](this[_0x7757('0x1e')][_0x7757('0x23')],'Re:')?'':'Re:\x20';_0x3947cf[_0x7757('0x23')]+=this['message']['subject'];}}if(this[_0x7757('0x1f')]===_0x7757('0x25')){_0x3947cf['ChatWebsiteId']=this[_0x7757('0x26')]['id'];}else{_0x3947cf[_['upperFirst'](this[_0x7757('0x1f')])+_0x7757('0x27')]=this['account']['id'];}_0x3947cf[_[_0x7757('0x28')](this[_0x7757('0x1f')])+_0x7757('0x29')]=this['interaction']['id'];var _0x1b704f=this['interaction'];if(rpc[this[_0x7757('0x1f')]+_0x7757('0x2a')]){if(this[_0x7757('0x1f')]===_0x7757('0xf')){_0x3947cf['inReplyTo']=this['message'][_0x7757('0x2b')];_0x3947cf[_0x7757('0x2c')]=_0x7757('0x2d')+_[_0x7757('0x2e')](_0x3947cf['body'],_0x7757('0x2f'),_0x7757('0x30'))+_0x7757('0x31');_0x3947cf['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0x7757('0x32')};return mailRpc[_0x7757('0x33')](this[_0x7757('0x26')][_0x7757('0x34')],_0x3947cf)['then'](function(_0x22924e){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x26329e);_0x3947cf[_0x7757('0x2b')]=_0x22924e[_0x7757('0x1e')][_0x7757('0x2b')];return rpc[_0x3701ce+_0x7757('0x2a')][_0x7757('0x35')](_0x3947cf);})[_0x7757('0x36')](function(_0x29b99d){logger[_0x7757('0x15')](_0x7757('0x10'),_0x26329e,JSON['stringify'](_0x29b99d));})[_0x7757('0x37')](function(_0x1ecaf4){logger[_0x7757('0x38')](_0x7757('0x39'),_0x26329e,JSON[_0x7757('0x3a')](_0x1ecaf4));})[_0x7757('0x3b')](function(){Promise[_0x7757('0x3c')]()[_0x7757('0x36')](function(){if(_0x421ba0[0x0]!=='2'||_0x1b704f['autoreplyExecuted'])return;return rpc[_0x3701ce+_0x7757('0x3d')][_0x7757('0x3e')](_0x1b704f['id'],{'autoreplyExecuted':!![]})[_0x7757('0x36')](function(_0x537fd2){logger['info'](_0x7757('0x17'),_0x26329e,JSON[_0x7757('0x3a')](_0x537fd2));})[_0x7757('0x37')](function(_0x5c3673){logger[_0x7757('0x38')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x26329e,JSON[_0x7757('0x3a')](_0x5c3673));});})[_0x7757('0x36')](function(){_0x2e6ba8[_0x7757('0x12')]();});});}else{return rpc[this['channel']+'Message']['create'](_0x3947cf)[_0x7757('0x36')](function(){logger[_0x7757('0x15')](_0x7757('0x10'),_0x26329e,_0x3947cf['body']);})[_0x7757('0x37')](function(_0x4de722){logger['error'](_0x7757('0x10'),_0x26329e,JSON['stringify'](_0x4de722));})[_0x7757('0x3b')](function(){Promise['resolve']()[_0x7757('0x36')](function(){if(_0x421ba0[0x0]!=='2'||_0x1b704f[_0x7757('0x16')])return;return rpc[_0x3701ce+_0x7757('0x3d')][_0x7757('0x3e')](_0x1b704f['id'],{'autoreplyExecuted':!![]})[_0x7757('0x36')](function(_0x4f10d5){logger[_0x7757('0x15')](_0x7757('0x17'),_0x26329e,JSON[_0x7757('0x3a')](_0x4f10d5));})[_0x7757('0x37')](function(_0x485e5f){logger[_0x7757('0x38')](_0x7757('0x3f'),_0x26329e,JSON[_0x7757('0x3a')](_0x485e5f));});})[_0x7757('0x36')](function(){_0x2e6ba8[_0x7757('0x12')]();});});}}}catch(_0x37067d){logger[_0x7757('0x38')](_0x7757('0x10'),_0x26329e,JSON[_0x7757('0x3a')](_0x37067d));_0x2e6ba8[_0x7757('0x40')]();}};}; \ No newline at end of file +var _0x81a5=['info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','Autoreply\x20already\x20sent','interaction','autoreplyExecuted','format','out','getMustacheRender','message','from','phone','startsWith','Re:','Re:\x20','subject','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','replace',''+_[_0x581a('0x2e')](_0xe31d1f[_0x581a('0x11')],'';_0xe31d1f[_0x581a('0x30')]={'Auto-Submitted':_0x581a('0x31'),'X-Auto-Response-Suppress':_0x581a('0x32'),'Precedence':_0x581a('0x33')};return mailRpc[_0x581a('0x34')](this[_0x581a('0x26')][_0x581a('0x35')],_0xe31d1f)[_0x581a('0x36')](function(_0x5cf507){logger[_0x581a('0x12')](_0x581a('0x37'),_0x5e1572);_0xe31d1f[_0x581a('0x2c')]=_0x5cf507[_0x581a('0x1d')]['messageId'];return rpc[_0x4de84b+_0x581a('0x2a')][_0x581a('0x38')](_0xe31d1f);})[_0x581a('0x36')](function(_0x1f86b8){logger[_0x581a('0x12')](_0x581a('0x39'),_0x5e1572,JSON[_0x581a('0x3a')](_0x1f86b8));})[_0x581a('0x3b')](function(_0xfa389d){logger['error'](_0x581a('0x3c'),_0x5e1572,JSON[_0x581a('0x3a')](_0xfa389d));})[_0x581a('0x3d')](function(){Promise[_0x581a('0x3e')]()['then'](function(){if(_0x4f842e[0x0]!=='2'||_0x5e7725[_0x581a('0x19')])return;return rpc[_0x4de84b+'Interaction'][_0x581a('0x3f')](_0x5e7725['id'],{'autoreplyExecuted':!![]})[_0x581a('0x36')](function(_0x5f1a01){logger['info'](_0x581a('0x40'),_0x5e1572,JSON['stringify'](_0x5f1a01));})[_0x581a('0x3b')](function(_0x2e0995){logger['error'](_0x581a('0x41'),_0x5e1572,JSON[_0x581a('0x3a')](_0x2e0995));});})[_0x581a('0x36')](function(){_0x52b2f1[_0x581a('0x14')]();});});}else{return rpc[this[_0x581a('0xf')]+_0x581a('0x2a')][_0x581a('0x38')](_0xe31d1f)['then'](function(){logger['info'](_0x581a('0x39'),_0x5e1572,_0xe31d1f[_0x581a('0x11')]);})[_0x581a('0x3b')](function(_0x29d62a){logger[_0x581a('0x42')]('[%s][AUTOREPLY]\x20%s',_0x5e1572,JSON[_0x581a('0x3a')](_0x29d62a));})['finally'](function(){Promise[_0x581a('0x3e')]()[_0x581a('0x36')](function(){if(_0x4f842e[0x0]!=='2'||_0x5e7725['autoreplyExecuted'])return;return rpc[_0x4de84b+_0x581a('0x43')]['update'](_0x5e7725['id'],{'autoreplyExecuted':!![]})[_0x581a('0x36')](function(_0x44601e){logger[_0x581a('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5e1572,JSON[_0x581a('0x3a')](_0x44601e));})['catch'](function(_0x295dcf){logger[_0x581a('0x42')](_0x581a('0x41'),_0x5e1572,JSON['stringify'](_0x295dcf));});})[_0x581a('0x36')](function(){_0x52b2f1[_0x581a('0x14')]();});});}}}catch(_0x3d9bf2){logger['error'](_0x581a('0x39'),_0x5e1572,JSON[_0x581a('0x3a')](_0x3d9bf2));_0x52b2f1[_0x581a('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 1a0c791..106d6b3 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6f5=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger'];(function(_0x2862b1,_0x51a367){var _0x817ee6=function(_0x59cc5b){while(--_0x59cc5b){_0x2862b1['push'](_0x2862b1['shift']());}};_0x817ee6(++_0x51a367);}(_0xe6f5,0x14e));var _0x5e6f=function(_0x362fdf,_0x1d7d2e){_0x362fdf=_0x362fdf-0x0;var _0x449827=_0xe6f5[_0x362fdf];return _0x449827;};'use strict';var moment=require(_0x5e6f('0x0'));var logger=require(_0x5e6f('0x1'))(_0x5e6f('0x2'));var rpc={'chatInteraction':require(_0x5e6f('0x3')),'openchannelInteraction':require(_0x5e6f('0x4')),'smsInteraction':require(_0x5e6f('0x5')),'mailInteraction':require(_0x5e6f('0x6')),'faxInteraction':require(_0x5e6f('0x7')),'whatsappInteraction':require(_0x5e6f('0x8'))};exports[_0x5e6f('0x9')]=function(_0x287f55,_0x5a6cb7,_0x457b63,_0xcaceb1){return function(_0x5db8fd){try{logger[_0x5e6f('0xa')]('[%s][CLOSE]\x20reason\x20%s',_0x287f55,_0x5a6cb7[0x0]);var _0x4f90f={'closed':0x1,'closedAt':moment()[_0x5e6f('0xb')](_0x5e6f('0xc')),'closeReason':_0x5e6f('0xd'),'disposition':_0x5a6cb7[0x0]};if(rpc[_0xcaceb1[_0x5e6f('0xe')]+'Interaction']){rpc[_0xcaceb1[_0x5e6f('0xe')]+_0x5e6f('0xf')][_0x5e6f('0x10')](_0xcaceb1[_0x5e6f('0x11')]['id'],_0x4f90f)[_0x5e6f('0x12')](function(_0xf72221){logger[_0x5e6f('0xa')](_0x5e6f('0x13'),_0x287f55,_0xcaceb1[_0x5e6f('0x11')]['id']);})['catch'](function(_0x58407d){logger['error']('[%s][CLOSE]\x20%s',_0x287f55,JSON[_0x5e6f('0x14')](_0x58407d));})[_0x5e6f('0x15')](function(){_0x5db8fd[_0x5e6f('0x16')]();});}}catch(_0x1b5e1b){logger['error'](_0x5e6f('0x17'),_0x287f55,JSON['stringify'](_0x1b5e1b));_0x5db8fd[_0x5e6f('0x16')]();}};}; \ No newline at end of file +var _0xc3ca=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','[%s][CLOSE]\x20%s','finally','stop','error','stringify','moment','../../../../config/logger','routing'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0xc3ca,0x1bf));var _0xac3c=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc3ca[_0x46698a];return _0x356db0;};'use strict';var moment=require(_0xac3c('0x0'));var logger=require(_0xac3c('0x1'))(_0xac3c('0x2'));var rpc={'chatInteraction':require(_0xac3c('0x3')),'openchannelInteraction':require(_0xac3c('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xac3c('0x5')),'faxInteraction':require(_0xac3c('0x6')),'whatsappInteraction':require(_0xac3c('0x7'))};exports[_0xac3c('0x8')]=function(_0x48733d,_0x2fa171,_0x2c21a6,_0x23fb8f){return function(_0x4876e4){try{logger[_0xac3c('0x9')](_0xac3c('0xa'),_0x48733d,_0x2fa171[0x0]);var _0x2a7583={'closed':0x1,'closedAt':moment()['format'](_0xac3c('0xb')),'closeReason':_0xac3c('0xc'),'disposition':_0x2fa171[0x0]};if(rpc[_0x23fb8f[_0xac3c('0xd')]+_0xac3c('0xe')]){rpc[_0x23fb8f[_0xac3c('0xd')]+_0xac3c('0xe')][_0xac3c('0xf')](_0x23fb8f['interaction']['id'],_0x2a7583)[_0xac3c('0x10')](function(_0x406f12){logger['info'](_0xac3c('0x11'),_0x48733d,_0x23fb8f[_0xac3c('0x12')]['id']);})[_0xac3c('0x13')](function(_0x25c0c3){logger['error'](_0xac3c('0x14'),_0x48733d,JSON['stringify'](_0x25c0c3));})[_0xac3c('0x15')](function(){_0x4876e4[_0xac3c('0x16')]();});}}catch(_0x5f385c){logger[_0xac3c('0x17')](_0xac3c('0x14'),_0x48733d,JSON[_0xac3c('0x18')](_0x5f385c));_0x4876e4['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index b0075b4..4043d88 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa87e=['body','getMustacheRender','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','then','dialogflow','result','fulfillment','providerName','providerResponse','stringify','Message','create','endConversation','catch','lodash','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty'];(function(_0x205733,_0x350fa4){var _0x433f84=function(_0x5108d3){while(--_0x5108d3){_0x205733['push'](_0x205733['shift']());}};_0x433f84(++_0x350fa4);}(_0xa87e,0x1c2));var _0xea87=function(_0x3ae14f,_0x4cb204){_0x3ae14f=_0x3ae14f-0x0;var _0x1c19b8=_0xa87e[_0x3ae14f];return _0x1c19b8;};'use strict';var _=require(_0xea87('0x0'));var moment=require(_0xea87('0x1'));var apiai=require(_0xea87('0x2'));var md5=require(_0xea87('0x3'));var utils=require('./utils');var logger=require(_0xea87('0x4'))(_0xea87('0x5'));var rpc={'chatMessage':require(_0xea87('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xea87('0x7')),'smsMessage':require(_0xea87('0x8')),'faxMessage':require(_0xea87('0x9')),'whatsappMessage':require(_0xea87('0xa'))};exports['consequence']=function(_0xa4b0bc,_0x329f85){return function(_0x284019){try{if(!_[_0xea87('0xb')](this[_0xea87('0xc')][_0xea87('0xd')])){logger[_0xea87('0xe')](_0xea87('0xf'),_0xa4b0bc,_0xea87('0x10'));return _0x284019[_0xea87('0x11')]();}var _0x269540={'ContactId':this[_0xea87('0x12')]['id'],'sentAt':moment()['format'](_0xea87('0x13')),'direction':_0xea87('0x14')};if(this[_0xea87('0x15')]==='sms'||this[_0xea87('0x15')]==='whatsapp'){_0x269540[_0xea87('0x16')]=this[_0xea87('0xc')][_0xea87('0x16')];}var _0x5dd556=this[_0xea87('0x15')];if(_0x5dd556===_0xea87('0x17')){_0x269540[_0xea87('0x18')]=this[_0xea87('0x19')]['id'];}else{_0x269540[_[_0xea87('0x1a')](_0x5dd556)+_0xea87('0x1b')]=this[_0xea87('0x19')]['id'];}_0x269540[_['upperFirst'](_0x5dd556)+_0xea87('0x1c')]=this['interaction']['id'];if(this['interaction']['created']){var _0x546aba=_0x329f85[0x2];if(!_[_0xea87('0x1d')](_0x546aba)){_0x269540[_0xea87('0x1e')]=utils[_0xea87('0x1f')](_0x546aba,this);return rpc[_0x5dd556+'Message']['create'](_0x269540)['then'](function(_0x1ef58e){logger[_0xea87('0xe')](_0xea87('0xf'),_0xa4b0bc,_0x269540[_0xea87('0x1e')]);})['catch'](function(_0x15f94b){logger[_0xea87('0x20')](_0xea87('0xf'),_0xa4b0bc,JSON['stringify'](_0x15f94b));})['finally'](function(){logger[_0xea87('0xe')](_0xea87('0x21'),_0xa4b0bc);_0x284019[_0xea87('0x22')]();});}else{logger[_0xea87('0xe')](_0xea87('0x23'),_0xa4b0bc);_0x284019[_0xea87('0x22')]();}}else{var _0x2280f8=this;var _0x1f553f=apiai(_0x329f85[0x0],{'language':_0x329f85[0x1]||'en'});return _0x1f553f['textRequest'](this[_0xea87('0x24')][_0xea87('0x1e')],{'sessionId':md5(this['interaction']['id'])})[_0xea87('0x25')](function(_0x452425){_0x2280f8[_0xea87('0x1e')][_0xea87('0x26')]=_0x452425;_0x269540['body']=_0x452425[_0xea87('0x27')][_0xea87('0x28')]['speech'];_0x269540[_0xea87('0x29')]='dialogflow';_0x269540[_0xea87('0x2a')]=JSON[_0xea87('0x2b')](_0x452425);return rpc[_0x5dd556+_0xea87('0x2c')][_0xea87('0x2d')](_0x269540)[_0xea87('0x25')](function(_0x2c2503){logger[_0xea87('0xe')](_0xea87('0xf'),_0xa4b0bc,_0x269540[_0xea87('0x1e')]);if(_0x452425['result']['metadata'][_0xea87('0x2e')]){_0x284019[_0xea87('0x11')]();}else{_0x284019[_0xea87('0x22')]();}})[_0xea87('0x2f')](function(_0xcc5fc5){logger[_0xea87('0x20')](_0xea87('0xf'),_0xa4b0bc,JSON[_0xea87('0x2b')](_0xcc5fc5));_0x284019['next']();});})['catch'](function(_0x17aedf){logger[_0xea87('0x20')]('[%s][DIALOGFLOW]\x20%s',_0xa4b0bc,_0x17aedf[_0xea87('0x24')]);_0x284019[_0xea87('0x11')]();});}}catch(_0x3f00a8){logger[_0xea87('0x20')]('[%s][DIALOGFLOW]\x20%s',_0xa4b0bc,JSON[_0xea87('0x2b')](_0x3f00a8));_0x284019[_0xea87('0x22')]();}};}; \ No newline at end of file +var _0xb7a7=['[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','dialogflow','result','fulfillment','speech','providerName','providerResponse','create','endConversation','message','lodash','moment','apiai-promise','md5','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','whatsapp','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','Message','then','info','catch','error','stringify','finally'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x512008,_0x2f7a73){_0x512008=_0x512008-0x0;var _0x1e20f6=_0xb7a7[_0x512008];return _0x1e20f6;};'use strict';var _=require(_0x7b7a('0x0'));var moment=require(_0x7b7a('0x1'));var apiai=require(_0x7b7a('0x2'));var md5=require(_0x7b7a('0x3'));var utils=require(_0x7b7a('0x4'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x7b7a('0x5')),'openchannelMessage':require(_0x7b7a('0x6')),'mailMessage':require(_0x7b7a('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7b7a('0x8')),'whatsappMessage':require(_0x7b7a('0x9'))};exports[_0x7b7a('0xa')]=function(_0xf003bc,_0x8e6a84){return function(_0x1ef0f3){try{if(!_[_0x7b7a('0xb')](this[_0x7b7a('0xc')][_0x7b7a('0xd')])){logger['info'](_0x7b7a('0xe'),_0xf003bc,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1ef0f3[_0x7b7a('0xf')]();}var _0x21c573={'ContactId':this[_0x7b7a('0x10')]['id'],'sentAt':moment()[_0x7b7a('0x11')](_0x7b7a('0x12')),'direction':'out'};if(this['channel']==='sms'||this['channel']===_0x7b7a('0x13')){_0x21c573[_0x7b7a('0x14')]=this['interaction'][_0x7b7a('0x14')];}var _0x223046=this[_0x7b7a('0x15')];if(_0x223046===_0x7b7a('0x16')){_0x21c573[_0x7b7a('0x17')]=this[_0x7b7a('0x18')]['id'];}else{_0x21c573[_[_0x7b7a('0x19')](_0x223046)+_0x7b7a('0x1a')]=this[_0x7b7a('0x18')]['id'];}_0x21c573[_[_0x7b7a('0x19')](_0x223046)+'InteractionId']=this['interaction']['id'];if(this[_0x7b7a('0xc')][_0x7b7a('0x1b')]){var _0x3a10a9=_0x8e6a84[0x2];if(!_[_0x7b7a('0x1c')](_0x3a10a9)){_0x21c573[_0x7b7a('0x1d')]=utils['getMustacheRender'](_0x3a10a9,this);return rpc[_0x223046+_0x7b7a('0x1e')]['create'](_0x21c573)[_0x7b7a('0x1f')](function(_0x763b6){logger[_0x7b7a('0x20')](_0x7b7a('0xe'),_0xf003bc,_0x21c573[_0x7b7a('0x1d')]);})[_0x7b7a('0x21')](function(_0x3fdaa5){logger[_0x7b7a('0x22')](_0x7b7a('0xe'),_0xf003bc,JSON[_0x7b7a('0x23')](_0x3fdaa5));})[_0x7b7a('0x24')](function(){logger[_0x7b7a('0x20')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xf003bc);_0x1ef0f3['stop']();});}else{logger[_0x7b7a('0x20')](_0x7b7a('0x25'),_0xf003bc);_0x1ef0f3[_0x7b7a('0x26')]();}}else{var _0x496cc6=this;var _0x13dfaf=apiai(_0x8e6a84[0x0],{'language':_0x8e6a84[0x1]||'en'});return _0x13dfaf[_0x7b7a('0x27')](this['message'][_0x7b7a('0x1d')],{'sessionId':md5(this[_0x7b7a('0xc')]['id'])})['then'](function(_0x525b76){_0x496cc6[_0x7b7a('0x1d')][_0x7b7a('0x28')]=_0x525b76;_0x21c573[_0x7b7a('0x1d')]=_0x525b76[_0x7b7a('0x29')][_0x7b7a('0x2a')][_0x7b7a('0x2b')];_0x21c573[_0x7b7a('0x2c')]=_0x7b7a('0x28');_0x21c573[_0x7b7a('0x2d')]=JSON[_0x7b7a('0x23')](_0x525b76);return rpc[_0x223046+_0x7b7a('0x1e')][_0x7b7a('0x2e')](_0x21c573)[_0x7b7a('0x1f')](function(_0x546168){logger[_0x7b7a('0x20')](_0x7b7a('0xe'),_0xf003bc,_0x21c573[_0x7b7a('0x1d')]);if(_0x525b76[_0x7b7a('0x29')]['metadata'][_0x7b7a('0x2f')]){_0x1ef0f3[_0x7b7a('0xf')]();}else{_0x1ef0f3[_0x7b7a('0x26')]();}})[_0x7b7a('0x21')](function(_0x5d923d){logger[_0x7b7a('0x22')](_0x7b7a('0xe'),_0xf003bc,JSON[_0x7b7a('0x23')](_0x5d923d));_0x1ef0f3[_0x7b7a('0xf')]();});})[_0x7b7a('0x21')](function(_0x303bd4){logger[_0x7b7a('0x22')]('[%s][DIALOGFLOW]\x20%s',_0xf003bc,_0x303bd4[_0x7b7a('0x30')]);_0x1ef0f3[_0x7b7a('0xf')]();});}}catch(_0x111e3a){logger[_0x7b7a('0x22')](_0x7b7a('0xe'),_0xf003bc,JSON[_0x7b7a('0x23')](_0x111e3a));_0x1ef0f3[_0x7b7a('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 5ddd8f3..9c546a7 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bde=['DIALOGFLOWV2_SCORE','providerName','fulfillmentText','push','all','stack','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','isNil','interaction','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT'];(function(_0x1559a5,_0x41924e){var _0x17a783=function(_0x152c63){while(--_0x152c63){_0x1559a5['push'](_0x1559a5['shift']());}};_0x17a783(++_0x41924e);}(_0x8bde,0x10a));var _0xe8bd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8bde[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0xe8bd('0x0'));var moment=require(_0xe8bd('0x1'));var Promise=require(_0xe8bd('0x2'));var logger=require(_0xe8bd('0x3'))(_0xe8bd('0x4'));var utils=require(_0xe8bd('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe8bd('0x6')),'mailMessage':require(_0xe8bd('0x7')),'smsMessage':require(_0xe8bd('0x8')),'faxMessage':require(_0xe8bd('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x417983,_0x53100e,_0x4cb7ec,_0x4896b2){return new Promise(function(_0x20e9f6,_0x2517a2){var _0x3b0f12=_[_0xe8bd('0xa')](_0x4cb7ec);_0x3b0f12[_0xe8bd('0xb')]=_0x4896b2;return rpc[_0x53100e+_0xe8bd('0xc')][_0xe8bd('0xd')](_0x3b0f12)[_0xe8bd('0xe')](function(){logger[_0xe8bd('0xf')](_0xe8bd('0x10'),_0x417983,_0x3b0f12[_0xe8bd('0xb')]);_0x20e9f6();})['catch'](function(_0x1a8042){logger[_0xe8bd('0x11')](_0xe8bd('0x10'),_0x417983,JSON[_0xe8bd('0x12')](_0x1a8042));_0x2517a2(_0x1a8042);});});}exports['consequence']=function(_0xe22164,_0x1270ed){return function(_0x3fa8c0){try{if(!_[_0xe8bd('0x13')](this[_0xe8bd('0x14')]['UserId'])){logger[_0xe8bd('0xf')](_0xe8bd('0x10'),_0xe22164,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3fa8c0[_0xe8bd('0x15')]();}var _0x1302c3={'ContactId':this['contact']['id'],'sentAt':moment()[_0xe8bd('0x16')](_0xe8bd('0x17')),'direction':'out'};if(this[_0xe8bd('0x18')]===_0xe8bd('0x19')||this['channel']==='whatsapp'){_0x1302c3[_0xe8bd('0x1a')]=this[_0xe8bd('0x14')][_0xe8bd('0x1a')];}var _0x3885ec=this[_0xe8bd('0x18')];if(_0x3885ec==='chat'){_0x1302c3[_0xe8bd('0x1b')]=this[_0xe8bd('0x1c')]['id'];}else{_0x1302c3[_[_0xe8bd('0x1d')](_0x3885ec)+_0xe8bd('0x1e')]=this[_0xe8bd('0x1c')]['id'];}_0x1302c3[_[_0xe8bd('0x1d')](_0x3885ec)+_0xe8bd('0x1f')]=this[_0xe8bd('0x14')]['id'];if(this[_0xe8bd('0x14')][_0xe8bd('0x20')]){var _0x321419=_0x1270ed[0x4];if(!_['isEmpty'](_0x321419)){_0x1302c3[_0xe8bd('0xb')]=utils[_0xe8bd('0x21')](_0x321419,this);return rpc[_0x3885ec+'Message'][_0xe8bd('0xd')](_0x1302c3)[_0xe8bd('0xe')](function(_0x461f41){logger[_0xe8bd('0xf')](_0xe8bd('0x10'),_0xe22164,_0x1302c3[_0xe8bd('0xb')]);})[_0xe8bd('0x22')](function(_0xec37d0){logger[_0xe8bd('0x11')](_0xe8bd('0x10'),_0xe22164,JSON[_0xe8bd('0x12')](_0xec37d0));})[_0xe8bd('0x23')](function(){logger[_0xe8bd('0xf')](_0xe8bd('0x24'),_0xe22164);_0x3fa8c0[_0xe8bd('0x25')]();});}else{logger[_0xe8bd('0xf')](_0xe8bd('0x26'),_0xe22164);_0x3fa8c0[_0xe8bd('0x25')]();}}else{var _0x5d8201=this;var _0x474376=_0x1270ed[0x2][_0xe8bd('0x27')](/\\n/g,'\x0a');var _0x28bcca={'credentials':{'private_key':_0x474376,'client_email':_0x1270ed[0x1]}};var _0x58007e=new dialogflow[(_0xe8bd('0x28'))](_0x28bcca);var _0x4d5bf8=_0x58007e[_0xe8bd('0x29')](_0x1270ed[0x0],md5(_0x5d8201[_0xe8bd('0x14')]['id']));var _0x1345e8={'session':_0x4d5bf8,'queryInput':{'text':{'text':_0x5d8201[_0xe8bd('0x2a')][_0xe8bd('0xb')],'languageCode':_0x1270ed[0x3]||'en'}}};return _0x58007e[_0xe8bd('0x2b')](_0x1345e8)[_0xe8bd('0xe')](function(_0x44f694){if(_0x44f694&&_0x44f694[_0xe8bd('0x2c')]){_0x5d8201[_0xe8bd('0xb')][_0xe8bd('0x2d')]=_0x44f694;var _0x42e2f9=_0x44f694[0x0];var _0x4b6daf=_0x42e2f9[_0xe8bd('0x2e')][_0xe8bd('0x2f')]&&_0x42e2f9['queryResult'][_0xe8bd('0x2f')][_0xe8bd('0x30')]?_0x42e2f9['queryResult'][_0xe8bd('0x2f')][_0xe8bd('0x30')][_0xe8bd('0x31')][_0xe8bd('0x32')]:![];_0x5d8201['body']['DIALOGFLOWV2_ACTION']=_0x42e2f9[_0xe8bd('0x2e')]['action'];_0x5d8201['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x42e2f9[_0xe8bd('0x2e')][_0xe8bd('0x33')];_0x5d8201[_0xe8bd('0xb')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x42e2f9['queryResult'][_0xe8bd('0x2f')]&&_0x42e2f9[_0xe8bd('0x2e')][_0xe8bd('0x2f')]['fields']?_0x42e2f9[_0xe8bd('0x2e')]['diagnosticInfo'][_0xe8bd('0x30')][_0xe8bd('0x31')][_0xe8bd('0x32')]:![];_0x5d8201[_0xe8bd('0xb')][_0xe8bd('0x34')]=_0x42e2f9[_0xe8bd('0x2e')]['intent'][_0xe8bd('0x35')];_0x5d8201['body'][_0xe8bd('0x36')]=_0x42e2f9[_0xe8bd('0x2e')]['intent']['displayName'];_0x5d8201['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x42e2f9[_0xe8bd('0x2e')][_0xe8bd('0x37')][_0xe8bd('0x38')];_0x5d8201[_0xe8bd('0xb')]['DIALOGFLOWV2_LANGUAGECODE']=_0x42e2f9['queryResult'][_0xe8bd('0x39')];_0x5d8201['body'][_0xe8bd('0x3a')]=_0x42e2f9[_0xe8bd('0x2e')]['queryText'];_0x5d8201[_0xe8bd('0xb')][_0xe8bd('0x3b')]=_0x42e2f9[_0xe8bd('0x2e')]['intentDetectionConfidence'];_0x1302c3[_0xe8bd('0x3c')]=_0xe8bd('0x2d');_0x1302c3['providerResponse']=JSON['stringify'](_0x44f694);var _0x2473a1=[];for(var _0x556153=0x0;_0x556153<_0x44f694['length'];_0x556153++){var _0x12927d=_0x44f694[_0x556153];if(_0x12927d&&_0x12927d[_0xe8bd('0x2e')]&&_0x12927d[_0xe8bd('0x2e')][_0xe8bd('0x3d')]){_0x2473a1[_0xe8bd('0x3e')](createMessage(_0xe22164,_0x3885ec,_0x1302c3,_0x12927d[_0xe8bd('0x2e')]['fulfillmentText']));}}return Promise[_0xe8bd('0x3f')](_0x2473a1)['then'](function(){if(_0x4b6daf){_0x3fa8c0[_0xe8bd('0x15')]();}else{_0x3fa8c0[_0xe8bd('0x25')]();}})[_0xe8bd('0x22')](function(_0x71ce5c){logger[_0xe8bd('0x11')](_0xe8bd('0x10'),_0xe22164,JSON[_0xe8bd('0x12')](_0x71ce5c));_0x3fa8c0[_0xe8bd('0x15')]();});}})[_0xe8bd('0x22')](function(_0x2f4193){logger[_0xe8bd('0x11')](_0xe8bd('0x10'),_0xe22164,_0x2f4193['message'],_0x2f4193[_0xe8bd('0x40')]);_0x3fa8c0['next']();});}}catch(_0x53eade){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0xe22164,JSON[_0xe8bd('0x12')](_0x53eade));_0x3fa8c0['stop']();}};}; \ No newline at end of file +var _0x16dc=['push','all','next','message','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','account','upperFirst','InteractionId','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText'];(function(_0x492f91,_0x1054fb){var _0x38b4a2=function(_0x5c2501){while(--_0x5c2501){_0x492f91['push'](_0x492f91['shift']());}};_0x38b4a2(++_0x1054fb);}(_0x16dc,0x1bb));var _0xc16d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16dc[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc16d('0x0'));var dialogflow=require(_0xc16d('0x1'));var md5=require(_0xc16d('0x2'));var moment=require(_0xc16d('0x3'));var Promise=require(_0xc16d('0x4'));var logger=require(_0xc16d('0x5'))(_0xc16d('0x6'));var utils=require(_0xc16d('0x7'));var rpc={'chatMessage':require(_0xc16d('0x8')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc16d('0x9')),'smsMessage':require(_0xc16d('0xa')),'faxMessage':require(_0xc16d('0xb')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x592c12,_0x5b42b4,_0x2b13b0,_0x48d4b8){return new Promise(function(_0x425f3e,_0x1d015c){var _0x55cb0c=_[_0xc16d('0xc')](_0x2b13b0);_0x55cb0c[_0xc16d('0xd')]=_0x48d4b8;return rpc[_0x5b42b4+_0xc16d('0xe')][_0xc16d('0xf')](_0x55cb0c)[_0xc16d('0x10')](function(){logger[_0xc16d('0x11')](_0xc16d('0x12'),_0x592c12,_0x55cb0c[_0xc16d('0xd')]);_0x425f3e();})[_0xc16d('0x13')](function(_0x37baa3){logger[_0xc16d('0x14')](_0xc16d('0x12'),_0x592c12,JSON[_0xc16d('0x15')](_0x37baa3));_0x1d015c(_0x37baa3);});});}exports['consequence']=function(_0x5dd01d,_0x34080c){return function(_0x27b1de){try{if(!_[_0xc16d('0x16')](this[_0xc16d('0x17')][_0xc16d('0x18')])){logger[_0xc16d('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x5dd01d,_0xc16d('0x19'));return _0x27b1de['next']();}var _0x18dce8={'ContactId':this[_0xc16d('0x1a')]['id'],'sentAt':moment()[_0xc16d('0x1b')](_0xc16d('0x1c')),'direction':'out'};if(this[_0xc16d('0x1d')]===_0xc16d('0x1e')||this[_0xc16d('0x1d')]===_0xc16d('0x1f')){_0x18dce8['phone']=this[_0xc16d('0x17')][_0xc16d('0x20')];}var _0x4c204a=this[_0xc16d('0x1d')];if(_0x4c204a===_0xc16d('0x21')){_0x18dce8['ChatWebsiteId']=this[_0xc16d('0x22')]['id'];}else{_0x18dce8[_[_0xc16d('0x23')](_0x4c204a)+'AccountId']=this[_0xc16d('0x22')]['id'];}_0x18dce8[_[_0xc16d('0x23')](_0x4c204a)+_0xc16d('0x24')]=this['interaction']['id'];if(this['interaction']['created']){var _0x3c17c5=_0x34080c[0x4];if(!_[_0xc16d('0x25')](_0x3c17c5)){_0x18dce8[_0xc16d('0xd')]=utils['getMustacheRender'](_0x3c17c5,this);return rpc[_0x4c204a+_0xc16d('0xe')]['create'](_0x18dce8)['then'](function(_0x2c5226){logger[_0xc16d('0x11')](_0xc16d('0x12'),_0x5dd01d,_0x18dce8[_0xc16d('0xd')]);})[_0xc16d('0x13')](function(_0x6e8147){logger[_0xc16d('0x14')](_0xc16d('0x12'),_0x5dd01d,JSON[_0xc16d('0x15')](_0x6e8147));})[_0xc16d('0x26')](function(){logger[_0xc16d('0x11')](_0xc16d('0x27'),_0x5dd01d);_0x27b1de[_0xc16d('0x28')]();});}else{logger[_0xc16d('0x11')](_0xc16d('0x29'),_0x5dd01d);_0x27b1de[_0xc16d('0x28')]();}}else{var _0x3d6067=this;var _0x9a2737=_0x34080c[0x2][_0xc16d('0x2a')](/\\n/g,'\x0a');var _0x16dc51={'credentials':{'private_key':_0x9a2737,'client_email':_0x34080c[0x1]}};var _0x57998f=new dialogflow[(_0xc16d('0x2b'))](_0x16dc51);var _0x442a3f=_0x57998f['sessionPath'](_0x34080c[0x0],md5(_0x3d6067[_0xc16d('0x17')]['id']));var _0x2c5b3c={'session':_0x442a3f,'queryInput':{'text':{'text':_0x3d6067['message'][_0xc16d('0xd')],'languageCode':_0x34080c[0x3]||'en'}}};return _0x57998f[_0xc16d('0x2c')](_0x2c5b3c)['then'](function(_0x6fdfd3){if(_0x6fdfd3&&_0x6fdfd3[_0xc16d('0x2d')]){_0x3d6067[_0xc16d('0xd')][_0xc16d('0x2e')]=_0x6fdfd3;var _0x2b4edf=_0x6fdfd3[0x0];var _0x3e3c1e=_0x2b4edf[_0xc16d('0x2f')][_0xc16d('0x30')]&&_0x2b4edf[_0xc16d('0x2f')][_0xc16d('0x30')][_0xc16d('0x31')]?_0x2b4edf[_0xc16d('0x2f')][_0xc16d('0x30')][_0xc16d('0x31')][_0xc16d('0x32')]['boolValue']:![];_0x3d6067['body'][_0xc16d('0x33')]=_0x2b4edf['queryResult']['action'];_0x3d6067[_0xc16d('0xd')][_0xc16d('0x34')]=_0x2b4edf[_0xc16d('0x2f')][_0xc16d('0x35')];_0x3d6067[_0xc16d('0xd')][_0xc16d('0x36')]=_0x2b4edf[_0xc16d('0x2f')][_0xc16d('0x30')]&&_0x2b4edf[_0xc16d('0x2f')]['diagnosticInfo'][_0xc16d('0x31')]?_0x2b4edf['queryResult']['diagnosticInfo'][_0xc16d('0x31')][_0xc16d('0x32')]['boolValue']:![];_0x3d6067[_0xc16d('0xd')]['DIALOGFLOWV2_INTENTNAME']=_0x2b4edf[_0xc16d('0x2f')][_0xc16d('0x37')][_0xc16d('0x38')];_0x3d6067['body'][_0xc16d('0x39')]=_0x2b4edf[_0xc16d('0x2f')]['intent'][_0xc16d('0x3a')];_0x3d6067['body'][_0xc16d('0x3b')]=_0x2b4edf[_0xc16d('0x2f')][_0xc16d('0x37')][_0xc16d('0x3c')];_0x3d6067[_0xc16d('0xd')]['DIALOGFLOWV2_LANGUAGECODE']=_0x2b4edf[_0xc16d('0x2f')]['languageCode'];_0x3d6067[_0xc16d('0xd')][_0xc16d('0x3d')]=_0x2b4edf[_0xc16d('0x2f')][_0xc16d('0x3e')];_0x3d6067[_0xc16d('0xd')][_0xc16d('0x3f')]=_0x2b4edf[_0xc16d('0x2f')][_0xc16d('0x40')];_0x18dce8[_0xc16d('0x41')]='dialogflowV2';_0x18dce8[_0xc16d('0x42')]=JSON[_0xc16d('0x15')](_0x6fdfd3);var _0x31bc1a=[];for(var _0x29eb1d=0x0;_0x29eb1d<_0x6fdfd3[_0xc16d('0x2d')];_0x29eb1d++){var _0x802881=_0x6fdfd3[_0x29eb1d];if(_0x802881&&_0x802881[_0xc16d('0x2f')]&&_0x802881['queryResult'][_0xc16d('0x43')]){_0x31bc1a[_0xc16d('0x44')](createMessage(_0x5dd01d,_0x4c204a,_0x18dce8,_0x802881['queryResult']['fulfillmentText']));}}return Promise[_0xc16d('0x45')](_0x31bc1a)[_0xc16d('0x10')](function(){if(_0x3e3c1e){_0x27b1de[_0xc16d('0x46')]();}else{_0x27b1de[_0xc16d('0x28')]();}})[_0xc16d('0x13')](function(_0x4b11b1){logger['error'](_0xc16d('0x12'),_0x5dd01d,JSON[_0xc16d('0x15')](_0x4b11b1));_0x27b1de[_0xc16d('0x46')]();});}})[_0xc16d('0x13')](function(_0x31c2ec){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x5dd01d,_0x31c2ec[_0xc16d('0x47')],_0x31c2ec[_0xc16d('0x48')]);_0x27b1de[_0xc16d('0x46')]();});}}catch(_0x568887){logger[_0xc16d('0x14')](_0xc16d('0x12'),_0x5dd01d,JSON[_0xc16d('0x15')](_0x568887));_0x27b1de[_0xc16d('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index ab0bebc..8016831 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19f7=['priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','stop','condition','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x19f7,0x15f));var _0x719f=function(_0x106c8d,_0x49df02){_0x106c8d=_0x106c8d-0x0;var _0x4fdc22=_0x19f7[_0x106c8d];return _0x4fdc22;};'use strict';var schema=require(_0x719f('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x719f('0x1'));var logger=require(_0x719f('0x2'))(_0x719f('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x719f('0x4')},'priorityTrue':{'type':_0x719f('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x719f('0x5'),'message':_0x719f('0x6')}});exports['consequence']=function(_0x1aacd8,_0x15254b){return function(_0x26899b){try{var _0xf57097={'condition':htmlToText['fromString'](utils[_0x719f('0x7')](_0x15254b[0x0],this),{'wordwrap':![]})[_0x719f('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x15254b[0x1],'priorityFalse':_0x15254b[0x2]};var _0xa0cbc8=gotoif[_0x719f('0x0')](_0xf57097,{'typecast':!![]});if(_0xa0cbc8[_0x719f('0x9')]){logger[_0x719f('0xa')](_0x719f('0xb'),_0x1aacd8,_['map'](_0xa0cbc8,'message')['join'](',\x20'));_0x26899b[_0x719f('0xc')]();}else{try{var _0x236be7=eval('('+_0xf57097[_0x719f('0xd')]+')');var _0x2915db=_0x236be7?_0xf57097['priorityTrue']:_0xf57097['priorityFalse'];logger[_0x719f('0xe')](_0x719f('0xf'),_0x1aacd8,_0xf57097['condition'],_0x236be7,_0x2915db||_0x719f('0x10'));if(_0x2915db){var _0x33be8b=_['findIndex'](_0x26899b['rules'](),{'p':_0x2915db});if(_0x33be8b>=0x0){logger[_0x719f('0xe')](_0x719f('0x11'),_0x1aacd8,_0x2915db||_0x719f('0x10'),_0x33be8b);_0x26899b[_0x719f('0x10')](_0x33be8b);}else{logger[_0x719f('0xe')](_0x719f('0x12'),_0x1aacd8,_0x2915db||'next');_0x26899b[_0x719f('0xc')]();}}else{_0x26899b[_0x719f('0x10')]();}}catch(_0x4fd8a6){logger[_0x719f('0xa')](_0x719f('0x13'),_0x1aacd8,_0x4fd8a6['message']);_0x26899b[_0x719f('0xc')]();}}}catch(_0x5dd7da){logger[_0x719f('0xa')](_0x719f('0xb'),_0x1aacd8,JSON[_0x719f('0x14')](_0x5dd7da));_0x26899b[_0x719f('0xc')]();}};}; \ No newline at end of file +var _0x6f71=['join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','map','message'];(function(_0x1aeaad,_0x3749bb){var _0x368c7b=function(_0x4848f2){while(--_0x4848f2){_0x1aeaad['push'](_0x1aeaad['shift']());}};_0x368c7b(++_0x3749bb);}(_0x6f71,0xa5));var _0x16f7=function(_0x125c28,_0x1a73f6){_0x125c28=_0x125c28-0x0;var _0xdd6ed7=_0x6f71[_0x125c28];return _0xdd6ed7;};'use strict';var schema=require(_0x16f7('0x0'));var _=require(_0x16f7('0x1'));var htmlToText=require(_0x16f7('0x2'));var utils=require(_0x16f7('0x3'));var logger=require('../../../../config/logger')(_0x16f7('0x4'));var gotoif=schema({'condition':{'type':_0x16f7('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x16f7('0x6'),'message':_0x16f7('0x7')},'priorityFalse':{'type':'number','message':_0x16f7('0x8')}});exports[_0x16f7('0x9')]=function(_0x101afe,_0x3d2c4b){return function(_0x112550){try{var _0x7a9297={'condition':htmlToText['fromString'](utils[_0x16f7('0xa')](_0x3d2c4b[0x0],this),{'wordwrap':![]})[_0x16f7('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3d2c4b[0x1],'priorityFalse':_0x3d2c4b[0x2]};var _0x44962c=gotoif[_0x16f7('0x0')](_0x7a9297,{'typecast':!![]});if(_0x44962c[_0x16f7('0xc')]){logger['error']('[%s][GOTOIF]\x20%s',_0x101afe,_[_0x16f7('0xd')](_0x44962c,_0x16f7('0xe'))[_0x16f7('0xf')](',\x20'));_0x112550[_0x16f7('0x10')]();}else{try{var _0x241c78=eval('('+_0x7a9297[_0x16f7('0x11')]+')');var _0x5cf47b=_0x241c78?_0x7a9297[_0x16f7('0x12')]:_0x7a9297[_0x16f7('0x13')];logger[_0x16f7('0x14')](_0x16f7('0x15'),_0x101afe,_0x7a9297[_0x16f7('0x11')],_0x241c78,_0x5cf47b||_0x16f7('0x16'));if(_0x5cf47b){var _0xe75ed8=_[_0x16f7('0x17')](_0x112550[_0x16f7('0x18')](),{'p':_0x5cf47b});if(_0xe75ed8>=0x0){logger['info'](_0x16f7('0x19'),_0x101afe,_0x5cf47b||_0x16f7('0x16'),_0xe75ed8);_0x112550[_0x16f7('0x16')](_0xe75ed8);}else{logger[_0x16f7('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x101afe,_0x5cf47b||'next');_0x112550['stop']();}}else{_0x112550[_0x16f7('0x16')]();}}catch(_0x1043d9){logger[_0x16f7('0x1a')](_0x16f7('0x1b'),_0x101afe,_0x1043d9[_0x16f7('0xe')]);_0x112550[_0x16f7('0x10')]();}}}catch(_0x171836){logger[_0x16f7('0x1a')](_0x16f7('0x1c'),_0x101afe,JSON[_0x16f7('0x1d')](_0x171836));_0x112550['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index ed2a071..bffa8fe 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 _0xa66f=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','error','stringify','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][GOTOP]\x20%s','map','message','join','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa66f,0xc2));var _0xfa66=function(_0x38e806,_0x85c6b){_0x38e806=_0x38e806-0x0;var _0x13d25b=_0xa66f[_0x38e806];return _0x13d25b;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xfa66('0x0'))(_0xfa66('0x1'));var gotop=schema({'priority':{'type':_0xfa66('0x2'),'required':!![],'message':_0xfa66('0x3')}});exports[_0xfa66('0x4')]=function(_0x135971,_0x3a8725){return function(_0x55fdfb){try{var _0x32adeb={'priority':_0x3a8725[0x0]};var _0xff12ff=gotop[_0xfa66('0x5')](_0x32adeb,{'typecast':!![]});if(_0xff12ff[_0xfa66('0x6')]){logger['error'](_0xfa66('0x7'),_0x135971,_[_0xfa66('0x8')](_0xff12ff,_0xfa66('0x9'))[_0xfa66('0xa')](',\x20'));_0x55fdfb['stop']();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x135971,_0x32adeb['priority']);if(_0x32adeb[_0xfa66('0xb')]){var _0x1d4e71=_[_0xfa66('0xc')](_0x55fdfb[_0xfa66('0xd')](),{'p':_0x32adeb['priority']});if(_0x1d4e71>=0x0){logger[_0xfa66('0xe')](_0xfa66('0xf'),_0x135971,_0x32adeb[_0xfa66('0xb')]||_0xfa66('0x10'),_0x1d4e71);_0x55fdfb[_0xfa66('0x10')](_0x1d4e71);}else{logger['info'](_0xfa66('0x11'),_0x135971,_0x32adeb['priority']||_0xfa66('0x10'));_0x55fdfb[_0xfa66('0x12')]();}}else{_0x55fdfb[_0xfa66('0x10')]();}}}catch(_0xe3b661){logger[_0xfa66('0x13')](_0xfa66('0x7'),_0x135971,JSON[_0xfa66('0x14')](_0xe3b661));_0x55fdfb['stop']();}};}; \ No newline at end of file +var _0x489e=['length','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x489e,0xa6));var _0xe489=function(_0x478e28,_0x209518){_0x478e28=_0x478e28-0x0;var _0x1d7f3d=_0x489e[_0x478e28];return _0x1d7f3d;};'use strict';var schema=require(_0xe489('0x0'));var _=require(_0xe489('0x1'));var logger=require(_0xe489('0x2'))(_0xe489('0x3'));var gotop=schema({'priority':{'type':_0xe489('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x17273e,_0x47198a){return function(_0x40e067){try{var _0x496801={'priority':_0x47198a[0x0]};var _0x17df57=gotop['validate'](_0x496801,{'typecast':!![]});if(_0x17df57[_0xe489('0x5')]){logger[_0xe489('0x6')]('[%s][GOTOP]\x20%s',_0x17273e,_[_0xe489('0x7')](_0x17df57,_0xe489('0x8'))[_0xe489('0x9')](',\x20'));_0x40e067[_0xe489('0xa')]();}else{logger[_0xe489('0xb')](_0xe489('0xc'),_0x17273e,_0x496801[_0xe489('0xd')]);if(_0x496801[_0xe489('0xd')]){var _0x30c443=_['findIndex'](_0x40e067[_0xe489('0xe')](),{'p':_0x496801['priority']});if(_0x30c443>=0x0){logger[_0xe489('0xb')](_0xe489('0xf'),_0x17273e,_0x496801[_0xe489('0xd')]||_0xe489('0x10'),_0x30c443);_0x40e067[_0xe489('0x10')](_0x30c443);}else{logger[_0xe489('0xb')](_0xe489('0x11'),_0x17273e,_0x496801[_0xe489('0xd')]||_0xe489('0x10'));_0x40e067[_0xe489('0xa')]();}}else{_0x40e067[_0xe489('0x10')]();}}}catch(_0x3c1020){logger[_0xe489('0x6')]('[%s][GOTOP]\x20%s',_0x17273e,JSON[_0xe489('0x12')](_0x3c1020));_0x40e067[_0xe489('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index af729c0..de66a13 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 _0x88ef=['getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','next','catch','error','[%s][MESSAGE]\x20%s','stringify','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x88ef,0xea));var _0xf88e=function(_0x6eda05,_0x2cfead){_0x6eda05=_0x6eda05-0x0;var _0x128ccb=_0x88ef[_0x6eda05];return _0x128ccb;};'use strict';var _=require('lodash');var utils=require(_0xf88e('0x0'));var logger=require(_0xf88e('0x1'))(_0xf88e('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf88e('0x3')),'mailMessage':require(_0xf88e('0x4')),'smsMessage':require(_0xf88e('0x5')),'faxMessage':require(_0xf88e('0x6')),'whatsappMessage':require(_0xf88e('0x7'))};exports[_0xf88e('0x8')]=function(_0xa6311f,_0x228d14){return function(_0xce03db){try{var _0x31fd93={'body':utils[_0xf88e('0x9')](_0x228d14[0x0],this),'ContactId':this[_0xf88e('0xa')]['id']};if(this[_0xf88e('0xb')]===_0xf88e('0xc')){_0x31fd93[_0xf88e('0xd')]=this[_0xf88e('0xe')]['id'];}else{_0x31fd93[_[_0xf88e('0xf')](this['channel'])+_0xf88e('0x10')]=this['account']['id'];}_0x31fd93[_[_0xf88e('0xf')](this['channel'])+_0xf88e('0x11')]=this[_0xf88e('0x12')]['id'];if(rpc[this['channel']+_0xf88e('0x13')]){return rpc[this[_0xf88e('0xb')]+_0xf88e('0x13')][_0xf88e('0x14')](_0x31fd93)[_0xf88e('0x15')](function(_0x18aee5){logger['info']('[%s][MESSAGE]\x20%s',_0xa6311f,_0x31fd93['body']);_0xce03db[_0xf88e('0x16')]();})[_0xf88e('0x17')](function(_0x388ada){logger[_0xf88e('0x18')](_0xf88e('0x19'),_0xa6311f,JSON[_0xf88e('0x1a')](_0x388ada));_0xce03db['stop']();});}}catch(_0x2fdae8){logger[_0xf88e('0x18')](_0xf88e('0x19'),_0xa6311f,JSON[_0xf88e('0x1a')](_0x2fdae8));_0xce03db['stop']();}};}; \ No newline at end of file +var _0xdc9c=['../../rpc/faxMessage','consequence','getMustacheRender','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x34798c,_0x5c12fb){var _0x25edf7=function(_0x2e92b2){while(--_0x2e92b2){_0x34798c['push'](_0x34798c['shift']());}};_0x25edf7(++_0x5c12fb);}(_0xdc9c,0xe2));var _0xcdc9=function(_0x36e7ea,_0x29a83b){_0x36e7ea=_0x36e7ea-0x0;var _0x440cfe=_0xdc9c[_0x36e7ea];return _0x440cfe;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0xcdc9('0x0'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcdc9('0x1')),'mailMessage':require(_0xcdc9('0x2')),'smsMessage':require(_0xcdc9('0x3')),'faxMessage':require(_0xcdc9('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xcdc9('0x5')]=function(_0x50fef6,_0x2f1e2d){return function(_0x441da6){try{var _0x1f4ab2={'body':utils[_0xcdc9('0x6')](_0x2f1e2d[0x0],this),'ContactId':this['contact']['id']};if(this['channel']==='chat'){_0x1f4ab2['ChatWebsiteId']=this[_0xcdc9('0x7')]['id'];}else{_0x1f4ab2[_[_0xcdc9('0x8')](this[_0xcdc9('0x9')])+_0xcdc9('0xa')]=this[_0xcdc9('0x7')]['id'];}_0x1f4ab2[_[_0xcdc9('0x8')](this[_0xcdc9('0x9')])+_0xcdc9('0xb')]=this[_0xcdc9('0xc')]['id'];if(rpc[this['channel']+_0xcdc9('0xd')]){return rpc[this[_0xcdc9('0x9')]+_0xcdc9('0xd')]['create'](_0x1f4ab2)[_0xcdc9('0xe')](function(_0x11f0e2){logger[_0xcdc9('0xf')](_0xcdc9('0x10'),_0x50fef6,_0x1f4ab2[_0xcdc9('0x11')]);_0x441da6[_0xcdc9('0x12')]();})[_0xcdc9('0x13')](function(_0x397d1e){logger[_0xcdc9('0x14')](_0xcdc9('0x10'),_0x50fef6,JSON[_0xcdc9('0x15')](_0x397d1e));_0x441da6[_0xcdc9('0x16')]();});}}catch(_0x100f89){logger[_0xcdc9('0x14')](_0xcdc9('0x10'),_0x50fef6,JSON['stringify'](_0x100f89));_0x441da6[_0xcdc9('0x16')]();}};}; \ 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 49af63a..fa16921 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 _0x04e7=['../../../../config/logger','info','next','error','stringify','stop'];(function(_0x30df37,_0x48ad64){var _0x41ab55=function(_0x28feb2){while(--_0x28feb2){_0x30df37['push'](_0x30df37['shift']());}};_0x41ab55(++_0x48ad64);}(_0x04e7,0x96));var _0x704e=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x04e7[_0x2a7b8e];return _0x29b5c8;};'use strict';var utils=require('./utils');var logger=require(_0x704e('0x0'))('routing');exports['consequence']=function(_0x5aef4d,_0x4e61f){return function(_0x1a5574){try{logger[_0x704e('0x1')]('[%s][NOOP]\x20%s',_0x5aef4d,utils['getMustacheRender'](_0x4e61f[0x0],this));_0x1a5574[_0x704e('0x2')]();}catch(_0x33d8b7){logger[_0x704e('0x3')]('[%s][NOOP]\x20%s',_0x5aef4d,JSON[_0x704e('0x4')](_0x33d8b7));_0x1a5574[_0x704e('0x5')]();}};}; \ No newline at end of file +var _0x17be=['stringify','stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next','error'];(function(_0x39d586,_0x27981d){var _0x2bfe11=function(_0x110b60){while(--_0x110b60){_0x39d586['push'](_0x39d586['shift']());}};_0x2bfe11(++_0x27981d);}(_0x17be,0xb6));var _0xe17b=function(_0xb8585,_0x4c648a){_0xb8585=_0xb8585-0x0;var _0xb8c6c0=_0x17be[_0xb8585];return _0xb8c6c0;};'use strict';var utils=require('./utils');var logger=require(_0xe17b('0x0'))(_0xe17b('0x1'));exports[_0xe17b('0x2')]=function(_0x35337f,_0x430208){return function(_0x3cad7a){try{logger[_0xe17b('0x3')](_0xe17b('0x4'),_0x35337f,utils['getMustacheRender'](_0x430208[0x0],this));_0x3cad7a[_0xe17b('0x5')]();}catch(_0x409e70){logger[_0xe17b('0x6')](_0xe17b('0x4'),_0x35337f,JSON[_0xe17b('0x7')](_0x409e70));_0x3cad7a[_0xe17b('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 31a823c..baa3b90 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 _0x44db=['queue','from','joinAt','emit','clone','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','find','Queues','createQueue','atimeout','rules','end','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','defaults','localhost','socket.io-emitter','redis','queue_id'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x44db,0x133));var _0xb44d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x44db[_0x4e676e];return _0x336a3c;};'use strict';var schema=require(_0xb44d('0x0'));var _=require(_0xb44d('0x1'));var util=require(_0xb44d('0x2'));var seqqueue=require(_0xb44d('0x3'));var moment=require(_0xb44d('0x4'));var Redis=require(_0xb44d('0x5'));var config=require(_0xb44d('0x6'));var logger=require('../../../../config/logger')(_0xb44d('0x7'));var strategy=require('./strategy');config['redis']=_[_0xb44d('0x8')](config['redis'],{'host':_0xb44d('0x9'),'port':0x18eb});var io=require(_0xb44d('0xa'))(new Redis(config[_0xb44d('0xb')]));var attributes=['id',_0xb44d('0xc'),'account',_0xb44d('0xd'),_0xb44d('0xe'),_0xb44d('0xf')];function emit(_0x12fe5a,_0x2547e0,_0x1d3025){io['to'](_0x12fe5a)[_0xb44d('0x10')](_0x2547e0,_0x1d3025);}function emitChannelQueueInteraction(_0x1f0cad,_0x1498de,_0x1590d9,_0x11f338,_0x1e0cc5,_0x2f88e7,_0x31da8d,_0x3b7776){var _0x3f2d4b=_[_0xb44d('0x11')](_0x1590d9);_0x3f2d4b[_0xb44d('0xc')]=_0x3b7776;_0x3f2d4b[_0xb44d('0xd')]=_0x1498de;_0x3f2d4b[_0xb44d('0x12')]=_0x11f338;_0x3f2d4b['id']=_0x1e0cc5;if(_0x2f88e7){attributes[_0xb44d('0x13')](_[_0xb44d('0x14')](_0x1f0cad)+_0xb44d('0x15'));_0x31da8d[util[_0xb44d('0x16')](_0xb44d('0x17'),_0x1f0cad)][_0x1e0cc5]=_[_0xb44d('0x18')](_0x3f2d4b,attributes);}else{delete _0x31da8d[util[_0xb44d('0x16')]('%sQueuesWaitingInteractions',_0x1f0cad)][_0x1e0cc5];}emit(util['format'](_0xb44d('0x19'),_0x1f0cad,_0x1498de),util[_0xb44d('0x16')](_0xb44d('0x1a'),_0x1f0cad,_0x2f88e7?'save':_0xb44d('0x1b')),_[_0xb44d('0x18')](_0x3f2d4b,attributes));}var rpc={'openchannelQueueReport':require(_0xb44d('0x1c')),'mailQueueReport':require(_0xb44d('0x1d')),'chatQueueReport':require(_0xb44d('0x1e')),'smsQueueReport':require(_0xb44d('0x1f')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xb44d('0x20'))};var queue=schema({'name':{'type':_0xb44d('0x21'),'required':!![],'message':_0xb44d('0x22')},'timeout':{'type':_0xb44d('0x23'),'message':_0xb44d('0x24')}});function startRouting(_0xdb0c78,_0xf3795b,_0x21cee4,_0x4688cc){if(_0xdb0c78&&_0xf3795b&&_0x21cee4){_0xf3795b[_0xb44d('0x25')]+=0x1;var _0x554064={'uniqueid':_0xdb0c78,'from':_0x21cee4['body']?_0x21cee4[_0xb44d('0x26')][_0xb44d('0xe')]:'','joinAt':moment()['format'](_0xb44d('0x27')),'ContactId':_0x21cee4[_0xb44d('0x28')]?_0x21cee4[_0xb44d('0x28')]['id']:null,'ListId':_0x21cee4['list']?_0x21cee4[_0xb44d('0x29')]['id']:null};_0x554064[_[_0xb44d('0x2a')](_0x21cee4['channel'])+_0xb44d('0x2b')]=_0xf3795b['id']||null;_0x554064[_[_0xb44d('0x2a')](_0x21cee4[_0xb44d('0x2c')])+_0xb44d('0x15')]=_0x21cee4[_0xb44d('0x2d')]?_0x21cee4['interaction']['id']:null;_0x554064[_[_0xb44d('0x2a')](_0x21cee4['channel'])+_0xb44d('0x2e')]=_0x21cee4[_0xb44d('0x2f')]?_0x21cee4[_0xb44d('0x2f')]['id']:null;_0x554064[_[_0xb44d('0x2a')](_0x21cee4[_0xb44d('0x2c')])+(_0x21cee4[_0xb44d('0x2c')]!==_0xb44d('0x30')?_0xb44d('0x31'):_0xb44d('0x32'))]=_0x21cee4['account']?_0x21cee4[_0xb44d('0x12')]['id']:null;logger[_0xb44d('0x33')](util[_0xb44d('0x16')](_0xb44d('0x34'),_0xdb0c78,_0xf3795b[_0xb44d('0x35')]));emitChannelQueueInteraction(_0x21cee4['channel'],_0xf3795b[_0xb44d('0x35')],_0x554064,_0x21cee4['account'][_0xb44d('0x35')],_0x21cee4['message']['id'],!![],_0x4688cc,_0xf3795b['id']);if(rpc[_0x21cee4[_0xb44d('0x2c')]+'QueueReport']){return rpc[_0x21cee4[_0xb44d('0x2c')]+_0xb44d('0x36')][_0xb44d('0x37')](_0x554064)['catch'](function(_0x193a45){logger[_0xb44d('0x38')](_0xb44d('0x39'));});}}}function stopRouting(_0x351685,_0x4502f2,_0x3a731c,_0x1e1045){if(_0x351685&&_0x4502f2){_0x4502f2['waiting']-=0x1;var _0x1c51f6={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xb44d('0x16')](_0xb44d('0x27')),'reason':'accepted'};logger[_0xb44d('0x33')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x351685,_0x4502f2[_0xb44d('0x35')]));emitChannelQueueInteraction(_0x3a731c[_0xb44d('0x2c')],_0x4502f2[_0xb44d('0x35')],_0x3a731c[_0xb44d('0x26')],_0x3a731c[_0xb44d('0x12')][_0xb44d('0x35')],_0x3a731c['message']['id'],![],_0x1e1045,_0x4502f2['id']);if(rpc[_0x3a731c[_0xb44d('0x2c')]+_0xb44d('0x36')]){return rpc[_0x3a731c[_0xb44d('0x2c')]+_0xb44d('0x36')][_0xb44d('0x3a')](_0x351685,_0x1c51f6)[_0xb44d('0x3b')](function(_0x4ade68){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x4b1ead,_0x31237b,_0x4af309,_0x18c534){if(_0x4b1ead&&_0x31237b){_0x31237b[_0xb44d('0x25')]-=0x1;var _0x27fa27={'leaveAt':moment()[_0xb44d('0x16')](_0xb44d('0x27')),'exitAt':moment()[_0xb44d('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xb44d('0x3c')};logger[_0xb44d('0x33')](util[_0xb44d('0x16')]('[%s][END:QUEUE][NAME:%s]',_0x4b1ead,_0x31237b[_0xb44d('0x35')]));emitChannelQueueInteraction(_0x4af309[_0xb44d('0x2c')],_0x31237b['name'],_0x4af309['body'],_0x4af309[_0xb44d('0x12')][_0xb44d('0x35')],_0x4af309[_0xb44d('0x2f')]['id'],![],_0x18c534);if(rpc[_0x4af309['channel']+'QueueReport']){return rpc[_0x4af309[_0xb44d('0x2c')]+_0xb44d('0x36')][_0xb44d('0x3a')](_0x4b1ead,_0x27fa27)[_0xb44d('0x3b')](function(_0x42be40){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x2ceca8){return function(_0x4b6eab){return _0x4b6eab[_0xb44d('0x35')][_0xb44d('0x3d')]()===_0x2ceca8[_0xb44d('0x3d')]();};}exports['consequence']=function(_0x10b282,_0x1a7281,_0x2ea2bf,_0x3758ee){return function(_0xb78817){try{var _0x11ff70={'name':_0x1a7281[0x0],'timeout':_0x1a7281[0x1]};var _0x34ea82=queue['validate'](_0x11ff70,{'typecast':!![]});if(_0x34ea82[_0xb44d('0x3e')]){logger[_0xb44d('0x38')](_0xb44d('0x3f'),_0x10b282,_['map'](_0x34ea82,'message')['join'](',\x20'));_0xb78817['stop']();}else{var _0x42934b=_[_0xb44d('0x40')](_0x2ea2bf[_0x3758ee['channel']+_0xb44d('0x41')],handleFindQueue(_0x11ff70[_0xb44d('0x35')]));if(_0x42934b){startRouting(_0x10b282,_0x42934b,_0x3758ee,_0x2ea2bf);var _0x2f3a1b=(_0x42934b[_0xb44d('0x3c')]||0xa)*0x3e8;var _0xf281e6=(_0x11ff70[_0xb44d('0x3c')]||0x14)*0x3e8;var _0x3be487;if(_0x2f3a1b>_0xf281e6){_0xf281e6=_0x2f3a1b;}var _0x12a232=seqqueue[_0xb44d('0x42')](_0x2f3a1b);_0x12a232['id']=_0x10b282;_0x12a232[_0xb44d('0x43')]=_0x2f3a1b;_0x12a232['qtimeout']=_0xf281e6;_0x12a232[_0xb44d('0x2c')]=_0x3758ee[_0xb44d('0x2c')];_0x2ea2bf[_0xb44d('0x44')][_0x10b282]['on'](_0xb44d('0x45'),function(){logger[_0xb44d('0x33')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x10b282);stopRouting(_0x10b282,_0x42934b,_0x3758ee,_0x2ea2bf);clearTimeout(_0x3be487);_0x3be487=undefined;_0x12a232[_0xb44d('0x46')](!![]);if(_0x2ea2bf[_0xb44d('0x44')][_0x10b282]){delete _0x2ea2bf[_0xb44d('0x44')][_0x10b282];}_0xb78817[_0xb44d('0x47')]();});_0x2ea2bf[_0xb44d('0x44')][_0x10b282]['on'](_0xb44d('0x48'),function(){if(_0x2ea2bf['rules'][_0x10b282]){delete _0x2ea2bf[_0xb44d('0x44')][_0x10b282];}});_0x3be487=setTimeout(function(){logger['info'](_0xb44d('0x49'),_0x10b282);endRouting(_0x10b282,_0x42934b,_0x3758ee,_0x2ea2bf);clearTimeout(_0x3be487);_0x12a232[_0xb44d('0x46')](!![]);_0xb78817[_0xb44d('0x4a')]();},_0xf281e6);switch(_0x42934b[_0xb44d('0x4b')]){case _0xb44d('0x4c'):strategy['rrmemory'](_0x12a232,_0x42934b,_0x2ea2bf,_0x3758ee);break;default:strategy['beepall'](_0x12a232,_0x42934b,_0x2ea2bf,_0x3758ee);}}else{logger[_0xb44d('0x38')](_0xb44d('0x4d'),_0x10b282,_0x11ff70[_0xb44d('0x35')]);_0xb78817[_0xb44d('0x47')]();}}}catch(_0x14ad91){console[_0xb44d('0x4e')](_0x14ad91);logger['error'](_0xb44d('0x3f'),_0x10b282,_0x14ad91[_0xb44d('0x4f')]);_0xb78817[_0xb44d('0x47')]();}};}; \ No newline at end of file +var _0xd05f=['chat','AccountId','WebsiteId','name','QueueReport','catch','error','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','[%s][QUEUE]\x20%s','map','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','emit','clone','queue','push','capitalize','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','channel','QueueId','InteractionId','interaction','message'];(function(_0x5b89b1,_0xa6cbc){var _0x2a3ca1=function(_0x2b1213){while(--_0x2b1213){_0x5b89b1['push'](_0x5b89b1['shift']());}};_0x2a3ca1(++_0xa6cbc);}(_0xd05f,0x71));var _0xfd05=function(_0x2fe0dc,_0x3f8438){_0x2fe0dc=_0x2fe0dc-0x0;var _0x3a98f6=_0xd05f[_0x2fe0dc];return _0x3a98f6;};'use strict';var schema=require('validate');var _=require(_0xfd05('0x0'));var util=require(_0xfd05('0x1'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xfd05('0x2'));var config=require(_0xfd05('0x3'));var logger=require(_0xfd05('0x4'))(_0xfd05('0x5'));var strategy=require(_0xfd05('0x6'));config[_0xfd05('0x7')]=_[_0xfd05('0x8')](config[_0xfd05('0x7')],{'host':_0xfd05('0x9'),'port':0x18eb});var io=require(_0xfd05('0xa'))(new Redis(config[_0xfd05('0x7')]));var attributes=['id',_0xfd05('0xb'),_0xfd05('0xc'),'queue',_0xfd05('0xd'),'joinAt'];function emit(_0x17926c,_0x3b8779,_0x32080a){io['to'](_0x17926c)[_0xfd05('0xe')](_0x3b8779,_0x32080a);}function emitChannelQueueInteraction(_0x5464b0,_0x2bb2e5,_0x1fd670,_0x1516b2,_0x90257a,_0x59103a,_0x156652,_0x14a02d){var _0x31a263=_[_0xfd05('0xf')](_0x1fd670);_0x31a263[_0xfd05('0xb')]=_0x14a02d;_0x31a263[_0xfd05('0x10')]=_0x2bb2e5;_0x31a263['account']=_0x1516b2;_0x31a263['id']=_0x90257a;if(_0x59103a){attributes[_0xfd05('0x11')](_[_0xfd05('0x12')](_0x5464b0)+'InteractionId');_0x156652[util['format'](_0xfd05('0x13'),_0x5464b0)][_0x90257a]=_[_0xfd05('0x14')](_0x31a263,attributes);}else{delete _0x156652[util[_0xfd05('0x15')](_0xfd05('0x13'),_0x5464b0)][_0x90257a];}emit(util[_0xfd05('0x15')](_0xfd05('0x16'),_0x5464b0,_0x2bb2e5),util[_0xfd05('0x15')]('%s_queue_waiting_interaction:%s',_0x5464b0,_0x59103a?'save':_0xfd05('0x17')),_[_0xfd05('0x14')](_0x31a263,attributes));}var rpc={'openchannelQueueReport':require(_0xfd05('0x18')),'mailQueueReport':require(_0xfd05('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xfd05('0x1a')),'faxQueueReport':require(_0xfd05('0x1b')),'whatsappQueueReport':require(_0xfd05('0x1c'))};var queue=schema({'name':{'type':_0xfd05('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xfd05('0x1e'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x1dedc7,_0x53e78c,_0x3226b0,_0x40762b){if(_0x1dedc7&&_0x53e78c&&_0x3226b0){_0x53e78c[_0xfd05('0x1f')]+=0x1;var _0x550e70={'uniqueid':_0x1dedc7,'from':_0x3226b0['body']?_0x3226b0[_0xfd05('0x20')][_0xfd05('0xd')]:'','joinAt':moment()[_0xfd05('0x15')](_0xfd05('0x21')),'ContactId':_0x3226b0['contact']?_0x3226b0['contact']['id']:null,'ListId':_0x3226b0['list']?_0x3226b0[_0xfd05('0x22')]['id']:null};_0x550e70[_[_0xfd05('0x23')](_0x3226b0[_0xfd05('0x24')])+_0xfd05('0x25')]=_0x53e78c['id']||null;_0x550e70[_[_0xfd05('0x23')](_0x3226b0[_0xfd05('0x24')])+_0xfd05('0x26')]=_0x3226b0[_0xfd05('0x27')]?_0x3226b0[_0xfd05('0x27')]['id']:null;_0x550e70[_[_0xfd05('0x23')](_0x3226b0[_0xfd05('0x24')])+'MessageId']=_0x3226b0[_0xfd05('0x28')]?_0x3226b0[_0xfd05('0x28')]['id']:null;_0x550e70[_[_0xfd05('0x23')](_0x3226b0['channel'])+(_0x3226b0[_0xfd05('0x24')]!==_0xfd05('0x29')?_0xfd05('0x2a'):_0xfd05('0x2b'))]=_0x3226b0[_0xfd05('0xc')]?_0x3226b0[_0xfd05('0xc')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x1dedc7,_0x53e78c[_0xfd05('0x2c')]));emitChannelQueueInteraction(_0x3226b0[_0xfd05('0x24')],_0x53e78c[_0xfd05('0x2c')],_0x550e70,_0x3226b0['account'][_0xfd05('0x2c')],_0x3226b0[_0xfd05('0x28')]['id'],!![],_0x40762b,_0x53e78c['id']);if(rpc[_0x3226b0[_0xfd05('0x24')]+'QueueReport']){return rpc[_0x3226b0[_0xfd05('0x24')]+_0xfd05('0x2d')]['create'](_0x550e70)[_0xfd05('0x2e')](function(_0x3551f5){logger[_0xfd05('0x2f')](_0xfd05('0x30'));});}}}function stopRouting(_0x14de60,_0x1a2047,_0x51fb35,_0x57f68b){if(_0x14de60&&_0x1a2047){_0x1a2047['waiting']-=0x1;var _0x564eb1={'leaveAt':moment()['format'](_0xfd05('0x21')),'acceptAt':moment()[_0xfd05('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0xfd05('0x31')](util['format'](_0xfd05('0x32'),_0x14de60,_0x1a2047['name']));emitChannelQueueInteraction(_0x51fb35['channel'],_0x1a2047[_0xfd05('0x2c')],_0x51fb35[_0xfd05('0x20')],_0x51fb35['account'][_0xfd05('0x2c')],_0x51fb35['message']['id'],![],_0x57f68b,_0x1a2047['id']);if(rpc[_0x51fb35[_0xfd05('0x24')]+'QueueReport']){return rpc[_0x51fb35[_0xfd05('0x24')]+_0xfd05('0x2d')][_0xfd05('0x33')](_0x14de60,_0x564eb1)[_0xfd05('0x2e')](function(_0x551983){logger[_0xfd05('0x2f')](_0xfd05('0x34'));});}}}function endRouting(_0x2ad78c,_0x3f8aa4,_0x3ca3cd,_0x39bf29){if(_0x2ad78c&&_0x3f8aa4){_0x3f8aa4[_0xfd05('0x1f')]-=0x1;var _0x23892d={'leaveAt':moment()[_0xfd05('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xfd05('0x15')](_0xfd05('0x21')),'reason':_0xfd05('0x35')};logger[_0xfd05('0x31')](util[_0xfd05('0x15')](_0xfd05('0x36'),_0x2ad78c,_0x3f8aa4[_0xfd05('0x2c')]));emitChannelQueueInteraction(_0x3ca3cd[_0xfd05('0x24')],_0x3f8aa4[_0xfd05('0x2c')],_0x3ca3cd['body'],_0x3ca3cd[_0xfd05('0xc')][_0xfd05('0x2c')],_0x3ca3cd[_0xfd05('0x28')]['id'],![],_0x39bf29);if(rpc[_0x3ca3cd[_0xfd05('0x24')]+_0xfd05('0x2d')]){return rpc[_0x3ca3cd[_0xfd05('0x24')]+_0xfd05('0x2d')][_0xfd05('0x33')](_0x2ad78c,_0x23892d)[_0xfd05('0x2e')](function(_0x15b7dd){logger[_0xfd05('0x2f')](_0xfd05('0x34'));});}}}function handleFindQueue(_0x5de9f2){return function(_0x19531c){return _0x19531c[_0xfd05('0x2c')][_0xfd05('0x37')]()===_0x5de9f2[_0xfd05('0x37')]();};}exports[_0xfd05('0x38')]=function(_0x3ed310,_0x11d6a7,_0x53cf31,_0x3e0431){return function(_0x5c8e21){try{var _0x192cce={'name':_0x11d6a7[0x0],'timeout':_0x11d6a7[0x1]};var _0x13c4e4=queue[_0xfd05('0x39')](_0x192cce,{'typecast':!![]});if(_0x13c4e4['length']){logger['error'](_0xfd05('0x3a'),_0x3ed310,_[_0xfd05('0x3b')](_0x13c4e4,_0xfd05('0x28'))['join'](',\x20'));_0x5c8e21['stop']();}else{var _0x3d5899=_[_0xfd05('0x3c')](_0x53cf31[_0x3e0431[_0xfd05('0x24')]+_0xfd05('0x3d')],handleFindQueue(_0x192cce[_0xfd05('0x2c')]));if(_0x3d5899){startRouting(_0x3ed310,_0x3d5899,_0x3e0431,_0x53cf31);var _0x203840=(_0x3d5899[_0xfd05('0x35')]||0xa)*0x3e8;var _0x30989b=(_0x192cce[_0xfd05('0x35')]||0x14)*0x3e8;var _0x365df3;if(_0x203840>_0x30989b){_0x30989b=_0x203840;}var _0x51e842=seqqueue[_0xfd05('0x3e')](_0x203840);_0x51e842['id']=_0x3ed310;_0x51e842[_0xfd05('0x3f')]=_0x203840;_0x51e842[_0xfd05('0x40')]=_0x30989b;_0x51e842[_0xfd05('0x24')]=_0x3e0431[_0xfd05('0x24')];_0x53cf31[_0xfd05('0x41')][_0x3ed310]['on'](_0xfd05('0x42'),function(){logger['info'](_0xfd05('0x43'),_0x3ed310);stopRouting(_0x3ed310,_0x3d5899,_0x3e0431,_0x53cf31);clearTimeout(_0x365df3);_0x365df3=undefined;_0x51e842['close'](!![]);if(_0x53cf31[_0xfd05('0x41')][_0x3ed310]){delete _0x53cf31[_0xfd05('0x41')][_0x3ed310];}_0x5c8e21[_0xfd05('0x44')]();});_0x53cf31[_0xfd05('0x41')][_0x3ed310]['on'](_0xfd05('0x45'),function(){if(_0x53cf31[_0xfd05('0x41')][_0x3ed310]){delete _0x53cf31[_0xfd05('0x41')][_0x3ed310];}});_0x365df3=setTimeout(function(){logger[_0xfd05('0x31')](_0xfd05('0x46'),_0x3ed310);endRouting(_0x3ed310,_0x3d5899,_0x3e0431,_0x53cf31);clearTimeout(_0x365df3);_0x51e842[_0xfd05('0x47')](!![]);_0x5c8e21['next']();},_0x30989b);switch(_0x3d5899[_0xfd05('0x48')]){case _0xfd05('0x49'):strategy['rrmemory'](_0x51e842,_0x3d5899,_0x53cf31,_0x3e0431);break;default:strategy[_0xfd05('0x4a')](_0x51e842,_0x3d5899,_0x53cf31,_0x3e0431);}}else{logger[_0xfd05('0x2f')](_0xfd05('0x4b'),_0x3ed310,_0x192cce[_0xfd05('0x2c')]);_0x5c8e21[_0xfd05('0x44')]();}}}catch(_0x1ee708){console[_0xfd05('0x4c')](_0x1ee708);logger[_0xfd05('0x2f')](_0xfd05('0x3a'),_0x3ed310,_0x1ee708['stack']);_0x5c8e21[_0xfd05('0x44')]();}};}; \ 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 0277a17..20f1083 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 _0x6737=['realtime','handleTimeout','timeout','bind','drained','prototype','push','handleRun','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','channel','STOP','TIMEOUT','uuid','./util','routing','notificationId','squeue'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6737,0xe2));var _0x7673=function(_0x38e159,_0x2bb94a){_0x38e159=_0x38e159-0x0;var _0xf0626=_0x6737[_0x38e159];return _0xf0626;};'use strict';var _=require('lodash');var uuid=require(_0x7673('0x0'));var util=require(_0x7673('0x1'));var logger=require('../../../../../config/logger')(_0x7673('0x2'));var Agent=function(_0x2a9cd0,_0x43ee27,_0x12efff,_0x54002e){this[_0x7673('0x3')]=uuid['v4']();this[_0x7673('0x4')]=_0x2a9cd0;this['agent']=_0x43ee27;this[_0x7673('0x5')]=_0x12efff;this[_0x7673('0x2')]=_0x54002e;this['squeue']['push'](this['handleRun']['bind'](this),this[_0x7673('0x6')]['bind'](this));this[_0x7673('0x4')]['on'](_0x7673('0x7'),this['handleTimeout'][_0x7673('0x8')](this));this[_0x7673('0x4')]['on'](_0x7673('0x9'),this['handleDrained']['bind'](this));};Agent[_0x7673('0xa')]['push']=function(){this[_0x7673('0x4')][_0x7673('0xb')](this[_0x7673('0xc')][_0x7673('0x8')](this),this[_0x7673('0x6')][_0x7673('0x8')](this));};Agent[_0x7673('0xa')][_0x7673('0xd')]=function(){this[_0x7673('0x6')](!![]);};Agent[_0x7673('0xa')]['handleRun']=function(){logger[_0x7673('0xe')](_0x7673('0xf'),this[_0x7673('0x4')]['id'],this[_0x7673('0x10')]['id']);if(_[_0x7673('0x11')](this[_0x7673('0x5')][_0x7673('0x12')][this['agent']['id']])){logger['debug'](_0x7673('0x13'),this[_0x7673('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x7673('0xb')][_0x7673('0x8')](this),0x3e8);}else{if(this['routing'][_0x7673('0x14')]||util[_0x7673('0x15')](this[_0x7673('0x4')]['id'],this['realtime']['agents'][this[_0x7673('0x10')]['id']],this[_0x7673('0x4')]['channel'],![])){this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']][_0x7673('0x16')]=!![];this[_0x7673('0x5')][_0x7673('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0x7673('0x17')](this[_0x7673('0x5')],this[_0x7673('0x2')],this[_0x7673('0x10')],this[_0x7673('0x4')]['channel']);util[_0x7673('0x18')](this[_0x7673('0x3')],this[_0x7673('0x4')]['id'],this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']],null,this['routing']);util[_0x7673('0x19')](this[_0x7673('0x4')]['id'],this[_0x7673('0x5')][_0x7673('0x12')][this['agent']['id']],'RINGING'+(this[_0x7673('0x2')][_0x7673('0x14')]?_0x7673('0x1a'):''));}else{logger[_0x7673('0xe')](_0x7673('0x1b'),this[_0x7673('0x4')]['id'],this[_0x7673('0x10')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x7673('0xa')][_0x7673('0x6')]=function(_0x1dd436){if(_[_0x7673('0x11')](this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x7673('0x4')]['id'],this[_0x7673('0x10')]['id']);}else{logger[_0x7673('0xe')](_0x7673('0x1c'),this['squeue']['id'],this[_0x7673('0x10')]['id']);util['hideNotification'](this[_0x7673('0x3')],this[_0x7673('0x4')]['id'],this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']],null,this[_0x7673('0x2')]);this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']][_0x7673('0x16')]=![];this[_0x7673('0x5')][_0x7673('0x12')][this[_0x7673('0x10')]['id']]['busyQueue']=undefined;util[_0x7673('0x1d')](this[_0x7673('0x5')],this[_0x7673('0x2')],this[_0x7673('0x10')],this[_0x7673('0x4')][_0x7673('0x1e')]);util[_0x7673('0x19')](this['squeue']['id'],this['realtime'][_0x7673('0x12')][this[_0x7673('0x10')]['id']],_0x1dd436?_0x7673('0x1f'):_0x7673('0x20'));}if(!_0x1dd436){setTimeout(this[_0x7673('0xb')][_0x7673('0x8')](this),0x3e8);}};function agent(_0x159afd,_0x47c9a3,_0x2845f6,_0x13c591){return new Agent(_0x159afd,_0x47c9a3,_0x2845f6,_0x13c591);}module['exports']=agent; \ No newline at end of file +var _0x0fda=['lodash','./util','../../../../../config/logger','routing','agent','squeue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','exports'];(function(_0x175bfb,_0x1feddf){var _0x2f8391=function(_0x32708a){while(--_0x32708a){_0x175bfb['push'](_0x175bfb['shift']());}};_0x2f8391(++_0x1feddf);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x5cb4cf,_0x19a743){_0x5cb4cf=_0x5cb4cf-0x0;var _0x3a4add=_0x0fda[_0x5cb4cf];return _0x3a4add;};'use strict';var _=require(_0xa0fd('0x0'));var uuid=require('uuid');var util=require(_0xa0fd('0x1'));var logger=require(_0xa0fd('0x2'))(_0xa0fd('0x3'));var Agent=function(_0x2f71f3,_0x426242,_0xd8e73a,_0x13c734){this['notificationId']=uuid['v4']();this['squeue']=_0x2f71f3;this[_0xa0fd('0x4')]=_0x426242;this['realtime']=_0xd8e73a;this['routing']=_0x13c734;this[_0xa0fd('0x5')][_0xa0fd('0x6')](this[_0xa0fd('0x7')][_0xa0fd('0x8')](this),this['handleTimeout'][_0xa0fd('0x8')](this));this[_0xa0fd('0x5')]['on'](_0xa0fd('0x9'),this[_0xa0fd('0xa')]['bind'](this));this[_0xa0fd('0x5')]['on'](_0xa0fd('0xb'),this[_0xa0fd('0xc')]['bind'](this));};Agent[_0xa0fd('0xd')][_0xa0fd('0x6')]=function(){this[_0xa0fd('0x5')][_0xa0fd('0x6')](this[_0xa0fd('0x7')]['bind'](this),this['handleTimeout'][_0xa0fd('0x8')](this));};Agent[_0xa0fd('0xd')]['handleDrained']=function(){this[_0xa0fd('0xa')](!![]);};Agent[_0xa0fd('0xd')][_0xa0fd('0x7')]=function(){logger[_0xa0fd('0xe')](_0xa0fd('0xf'),this[_0xa0fd('0x5')]['id'],this[_0xa0fd('0x4')]['id']);if(_['isNil'](this[_0xa0fd('0x10')][_0xa0fd('0x11')][this['agent']['id']])){logger['debug'](_0xa0fd('0x12'),this[_0xa0fd('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}else{if(this[_0xa0fd('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0xa0fd('0x5')]['id'],this['realtime'][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],this[_0xa0fd('0x5')][_0xa0fd('0x13')],![])){this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']]['busy']=!![];this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x14')]=undefined;util[_0xa0fd('0x15')](this[_0xa0fd('0x10')],this[_0xa0fd('0x3')],this[_0xa0fd('0x4')],this[_0xa0fd('0x5')][_0xa0fd('0x13')]);util[_0xa0fd('0x16')](this[_0xa0fd('0x17')],this[_0xa0fd('0x5')]['id'],this['realtime'][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],null,this['routing']);util[_0xa0fd('0x18')](this[_0xa0fd('0x5')]['id'],this['realtime']['agents'][this[_0xa0fd('0x4')]['id']],_0xa0fd('0x19')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xa0fd('0x1a'),this['squeue']['id'],this[_0xa0fd('0x4')]['id']);setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}}};Agent['prototype'][_0xa0fd('0xa')]=function(_0x19c352){if(_[_0xa0fd('0x1b')](this[_0xa0fd('0x10')][_0xa0fd('0x11')][this['agent']['id']])){return logger[_0xa0fd('0xe')](_0xa0fd('0x12'),this[_0xa0fd('0x5')]['id'],this[_0xa0fd('0x4')]['id']);}else{logger['debug'](_0xa0fd('0x1c'),this[_0xa0fd('0x5')]['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0xa0fd('0x5')]['id'],this['realtime']['agents'][this[_0xa0fd('0x4')]['id']],null,this['routing']);this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x1d')]=![];this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x14')]=undefined;util['removeWaitingNotification'](this[_0xa0fd('0x10')],this['routing'],this[_0xa0fd('0x4')],this['squeue']['channel']);util[_0xa0fd('0x18')](this['squeue']['id'],this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],_0x19c352?_0xa0fd('0x1e'):'TIMEOUT');}if(!_0x19c352){setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}};function agent(_0x3b06ef,_0x3f6146,_0x2e3cfa,_0x31f1e2){return new Agent(_0x3b06ef,_0x3f6146,_0x2e3cfa,_0x31f1e2);}module[_0xa0fd('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 86f9f0b..c0946a3 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 _0x1ab1=['busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','notificationId','squeue','routing','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','queue','isNil','Agents','length','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x1ab1,0x1de));var _0x11ab=function(_0x140cdb,_0x58f38c){_0x140cdb=_0x140cdb-0x0;var _0x492b66=_0x1ab1[_0x140cdb];return _0x492b66;};'use strict';var _=require(_0x11ab('0x0'));var uuid=require(_0x11ab('0x1'));var util=require(_0x11ab('0x2'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x555386,_0x4ea55f,_0x224df3,_0xf07f7a){this[_0x11ab('0x3')]=uuid['v4']();this[_0x11ab('0x4')]=_0x555386;this['queue']=_0x4ea55f;this['realtime']=_0x224df3;this[_0x11ab('0x5')]=_0xf07f7a;this['squeue'][_0x11ab('0x6')](this[_0x11ab('0x7')]['bind'](this),this[_0x11ab('0x8')][_0x11ab('0x9')](this));this[_0x11ab('0x4')]['on'](_0x11ab('0xa'),this[_0x11ab('0x8')][_0x11ab('0x9')](this));this[_0x11ab('0x4')]['on'](_0x11ab('0xb'),this[_0x11ab('0xc')][_0x11ab('0x9')](this));};Beepall[_0x11ab('0xd')][_0x11ab('0x6')]=function(){this[_0x11ab('0x4')][_0x11ab('0x6')](this['handleRun']['bind'](this),this[_0x11ab('0x8')]['bind'](this));};Beepall[_0x11ab('0xd')][_0x11ab('0xc')]=function(){this[_0x11ab('0x8')](!![]);};Beepall[_0x11ab('0xd')][_0x11ab('0x7')]=function(){var _0x48c970=!![];if(!_['isNil'](this[_0x11ab('0xe')])&&!_[_0x11ab('0xf')](this[_0x11ab('0xe')][_0x11ab('0x10')])&&this[_0x11ab('0xe')][_0x11ab('0x10')][_0x11ab('0x11')]>0x0){for(var _0x11f479=0x0,_0x296589;_0x11f4790x0){for(var _0x290db5=0x0,_0x29b090;_0x290db50x0&&_0x5c7901[_0xdee037+'CurrentCapacity']>=_0x5c7901[_0xdee037+_0xbe8e('0x1c')]){writeLog(_0xd9f883,_0x5c7901,_0xdee037['toUpperCase']()+_0xbe8e('0x1d'));return![];}}return!![];};exports['showNotification']=function(_0xb454a0,_0x288f79,_0x1d6f1f,_0x5e5c2e,_0x2c4d5d){return sendNotification(!![],_0xb454a0,_0x288f79,_0x1d6f1f,_0x5e5c2e,_0x2c4d5d);};exports[_0xbe8e('0x1e')]=function(_0x311cdc,_0x4fa8a7,_0xf7004a,_0x1bc5b0,_0xef3bc7){return sendNotification(![],_0x311cdc,_0x4fa8a7,_0xf7004a,_0x1bc5b0,_0xef3bc7);};exports[_0xbe8e('0x1f')]=function(_0x20a2ef,_0x1c3ee6,_0x3808fb){var _0x35733b=_0x1c3ee6[_0xbe8e('0x20')][_0xbe8e('0x21')];if(!_0x35733b&&_0x3808fb){_0x35733b=_0x3808fb['id'];}var _0x1c4737=_['some'](_0x20a2ef[_0x1c3ee6[_0xbe8e('0x22')]+'QueuesWaitingInteractions'],function(_0xde1dc0){var _0xd78dc6=_[_0xbe8e('0x23')](_0x1c3ee6[_0xbe8e('0x22')])+_0xbe8e('0x24');return _0xde1dc0[_0xd78dc6]===_0x1c3ee6[_0xbe8e('0x20')]['id'];});if(!_0x1c4737&&_0x35733b){_0x1c4737=_[_0xbe8e('0x25')](_0x20a2ef[_0xbe8e('0x26')][_0x35733b][_0x1c3ee6['channel']+_0xbe8e('0x27')],function(_0x2c5d31){return _0x2c5d31['id']===_0x1c3ee6[_0xbe8e('0x20')]['id'];});}return _0x1c4737;};exports[_0xbe8e('0x28')]=function(_0x681f26,_0x3ae852,_0x467db8,_0x9047fa){_0x681f26['agents'][_0x467db8['id']][_0x9047fa+'WaitingInteractions'][_0x3ae852[_0xbe8e('0x29')]['id']]={'id':_0x3ae852['interaction']['id']};};exports[_0xbe8e('0x2a')]=function(_0x51541a,_0x57cd47,_0x59aee7,_0x2ee331){delete _0x51541a['agents'][_0x59aee7['id']][_0x2ee331+_0xbe8e('0x27')][_0x57cd47['message']['id']];};exports[_0xbe8e('0x2b')]=writeLog; \ No newline at end of file +var _0xff67=['queue','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','format','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','checkWaitingNotifications','interaction','channel','QueuesWaitingInteractions','capitalize','InteractionId','some','agents','saveWaitingNotification','WaitingInteractions','removeWaitingNotification','writeLog','lodash','util','ioredis','../../../../../config/logger','redis','defaults','localhost','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff67,0xb0));var _0x7ff6=function(_0x71b56,_0xe2d47f){_0x71b56=_0x71b56-0x0;var _0x33e173=_0xff67[_0x71b56];return _0x33e173;};'use strict';var _=require(_0x7ff6('0x0'));var util=require(_0x7ff6('0x1'));var utils=require('../utils');var Redis=require(_0x7ff6('0x2'));var config=require('../../../../../config/environment');var logger=require(_0x7ff6('0x3'))('routing');config[_0x7ff6('0x4')]=_[_0x7ff6('0x5')](config['redis'],{'host':_0x7ff6('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7ff6('0x4')]));function sendNotification(_0x29e6d9,_0xe2345a,_0xa74968,_0x1d09b8,_0xbf5b1f,_0x1e7d2c){io['to'](util['format']('user:%s',_0x1d09b8[_0x7ff6('0x7')]))[_0x7ff6('0x8')](_0x7ff6('0x9'),_0x1d09b8);var _0x1c59d1=_0x1e7d2c||{};var _0xde3ae9=_0xa74968[_0x7ff6('0xa')]('.');var _0xce951e={'uniqueid':_0xe2345a,'channel':_0xde3ae9[0x0],'id':_0xde3ae9[0x1],'title':_0xde3ae9[0x0]+_0x7ff6('0xb'),'interactionId':_0xde3ae9[0x2],'queue':_0xbf5b1f?_0xbf5b1f['name']:null,'sound':_0x1c59d1[_0x7ff6('0xc')][_0x7ff6('0xd')],'shake':_0x1c59d1[_0x7ff6('0xc')][_0x7ff6('0xe')]};try{if(!_0x1c59d1[_0x7ff6('0xf')]){_0x1c59d1[_0x7ff6('0xf')]={};}if(_0xbf5b1f){_0x1c59d1[_0x7ff6('0xf')][_0x7ff6('0x10')]=_0xbf5b1f;}else if(_0x1c59d1[_0x7ff6('0xf')][_0x7ff6('0x10')]){delete _0x1c59d1[_0x7ff6('0xf')][_0x7ff6('0x10')];}_0xce951e['msg']=utils['getMustacheRender'](_0x1c59d1[_0x7ff6('0xc')][_0x7ff6('0x11')],_0x1c59d1);}catch(_0x2d46df){_0xce951e['msg']=_0x7ff6('0x12');logger['error'](util['format'](_0x7ff6('0x13'),_0xe2345a,_0x2d46df[_0x7ff6('0x14')]));}io['to'](util[_0x7ff6('0x15')]('user:%s',_0x1d09b8[_0x7ff6('0x7')]))[_0x7ff6('0x8')](util[_0x7ff6('0x15')]('notification:%s',_0x29e6d9?_0x7ff6('0x16'):'remove'),_0xce951e);}function writeLog(_0x2ba768,_0x4caac2,_0x461334){return logger[_0x7ff6('0x17')](util[_0x7ff6('0x15')](_0x7ff6('0x18'),_0x2ba768,_0x4caac2['name'],_0x461334));}exports[_0x7ff6('0x19')]=function(_0x4dd6e2,_0x8b3c96,_0x41c47c,_0xa49d3f){if(_0x8b3c96[_0x7ff6('0x1a')]){writeLog(_0x4dd6e2,_0x8b3c96,_0x7ff6('0x1b'));return![];}if(!_0x8b3c96[_0x7ff6('0x1c')]){writeLog(_0x4dd6e2,_0x8b3c96,_0x7ff6('0x1d'));return![];}if(_0x8b3c96[_0x41c47c+'Pause']){writeLog(_0x4dd6e2,_0x8b3c96,'PAUSE');return![];}if(_0xa49d3f&&_0x8b3c96[_0x7ff6('0x1e')](_0x41c47c+_0x7ff6('0x1f'))&&_0x8b3c96[_0x7ff6('0x1e')](_0x41c47c+'CurrentCapacity')){if(_0x8b3c96[_0x41c47c+_0x7ff6('0x1f')]>0x0&&_0x8b3c96[_0x41c47c+_0x7ff6('0x20')]>=_0x8b3c96[_0x41c47c+'Capacity']){writeLog(_0x4dd6e2,_0x8b3c96,_0x41c47c[_0x7ff6('0x21')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x7ff6('0x22')]=function(_0xbb49d4,_0x45635f,_0x18341e,_0x26f9cf,_0xb48c8e){return sendNotification(!![],_0xbb49d4,_0x45635f,_0x18341e,_0x26f9cf,_0xb48c8e);};exports[_0x7ff6('0x23')]=function(_0xd9af30,_0x11366f,_0x2c8cc5,_0x4af34a,_0xd33766){return sendNotification(![],_0xd9af30,_0x11366f,_0x2c8cc5,_0x4af34a,_0xd33766);};exports[_0x7ff6('0x24')]=function(_0x130f7d,_0x200d78,_0x37f346){var _0x3e8fec=_0x200d78[_0x7ff6('0x25')]['UserId'];if(!_0x3e8fec&&_0x37f346){_0x3e8fec=_0x37f346['id'];}var _0x596084=_['some'](_0x130f7d[_0x200d78[_0x7ff6('0x26')]+_0x7ff6('0x27')],function(_0x4bf0ab){var _0x35dcc3=_[_0x7ff6('0x28')](_0x200d78['channel'])+_0x7ff6('0x29');return _0x4bf0ab[_0x35dcc3]===_0x200d78[_0x7ff6('0x25')]['id'];});if(!_0x596084&&_0x3e8fec){_0x596084=_[_0x7ff6('0x2a')](_0x130f7d[_0x7ff6('0x2b')][_0x3e8fec][_0x200d78[_0x7ff6('0x26')]+'WaitingInteractions'],function(_0xc4cd4c){return _0xc4cd4c['id']===_0x200d78['interaction']['id'];});}return _0x596084;};exports[_0x7ff6('0x2c')]=function(_0x4653a8,_0x307c3d,_0x2a0beb,_0x1de466){_0x4653a8['agents'][_0x2a0beb['id']][_0x1de466+_0x7ff6('0x2d')][_0x307c3d[_0x7ff6('0x14')]['id']]={'id':_0x307c3d[_0x7ff6('0x25')]['id']};};exports[_0x7ff6('0x2e')]=function(_0x193f21,_0x100c8b,_0x455a5d,_0x148936){delete _0x193f21[_0x7ff6('0x2b')][_0x455a5d['id']][_0x148936+_0x7ff6('0x2d')][_0x100c8b[_0x7ff6('0x14')]['id']];};exports[_0x7ff6('0x2f')]=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 cfcd498..98c6670 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 _0x944e=['./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','validate','shelljs','lodash'];(function(_0x3a78b0,_0x3d9e55){var _0x48c6ac=function(_0x31d075){while(--_0x31d075){_0x3a78b0['push'](_0x3a78b0['shift']());}};_0x48c6ac(++_0x3d9e55);}(_0x944e,0xba));var _0xe944=function(_0x30e831,_0x429109){_0x30e831=_0x30e831-0x0;var _0x32664d=_0x944e[_0x30e831];return _0x32664d;};'use strict';var schema=require(_0xe944('0x0'));var sh=require(_0xe944('0x1'));var _=require(_0xe944('0x2'));var utils=require(_0xe944('0x3'));var logger=require(_0xe944('0x4'))(_0xe944('0x5'));var system=schema({'command':{'type':_0xe944('0x6'),'required':!![],'message':_0xe944('0x7')}});exports['consequence']=function(_0x5818e2,_0x53c8cb){return function(_0x254d24){try{var _0xf96687={'command':_0x53c8cb[0x0]};var _0x4bceaf=system[_0xe944('0x0')](_0xf96687,{'typecast':!![]});if(_0x4bceaf[_0xe944('0x8')]){logger['error']('[%s][SYSTEM]\x20%s',_0x5818e2,_['map'](_0x4bceaf,_0xe944('0x9'))[_0xe944('0xa')](',\x20'));logger['info'](_0xe944('0xb'),_0x5818e2);_0x254d24[_0xe944('0xc')]();}else{var _0x1e2fee=this;var _0x3f9226=utils[_0xe944('0xd')](_0x53c8cb[0x0],this);logger[_0xe944('0xe')](_0xe944('0xf'),_0x5818e2,_0x3f9226);sh[_0xe944('0x10')](_['trim'](_0x3f9226),function(_0x17c49a,_0x13c965){logger[_0xe944('0xe')](_0xe944('0x11'),_0x5818e2,_0x17c49a);if(_0x17c49a==0x0){var _0x4f2aa4=_0x13c965[_0xe944('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xe944('0x13')](_0x53c8cb[0x1])||_[_0xe944('0x14')](_0x53c8cb[0x1])){logger['info'](_0xe944('0x15'),_0x5818e2);_0x1e2fee[_0xe944('0x16')][_0x53c8cb[0x1]]=_0x4f2aa4;}else{logger[_0xe944('0xe')](_0xe944('0x17'),_0x5818e2,_0x53c8cb[0x1],_0x4f2aa4);_0x1e2fee[_0xe944('0x16')][_0x53c8cb[0x1]]=_0x4f2aa4;}}_0x254d24[_0xe944('0xc')]();});}}catch(_0x1d5635){logger[_0xe944('0x18')]('[%s][SYSTEM]\x20%s',_0x5818e2,_[_0xe944('0x19')](_0x1d5635)?JSON[_0xe944('0x1a')](_0x1d5635):_0x1d5635);logger[_0xe944('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5818e2);_0x254d24[_0xe944('0xc')]();}};}; \ No newline at end of file +var _0x0b64=['stringify','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0b64,0x9d));var _0x40b6=function(_0x58bbe3,_0x39eecf){_0x58bbe3=_0x58bbe3-0x0;var _0x827d87=_0x0b64[_0x58bbe3];return _0x827d87;};'use strict';var schema=require('validate');var sh=require(_0x40b6('0x0'));var _=require(_0x40b6('0x1'));var utils=require('./utils');var logger=require(_0x40b6('0x2'))(_0x40b6('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0x40b6('0x4')}});exports[_0x40b6('0x5')]=function(_0x274cd4,_0xa7098a){return function(_0x3e8a42){try{var _0x3a2f3f={'command':_0xa7098a[0x0]};var _0xe99905=system[_0x40b6('0x6')](_0x3a2f3f,{'typecast':!![]});if(_0xe99905[_0x40b6('0x7')]){logger[_0x40b6('0x8')](_0x40b6('0x9'),_0x274cd4,_[_0x40b6('0xa')](_0xe99905,_0x40b6('0xb'))['join'](',\x20'));logger[_0x40b6('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x274cd4);_0x3e8a42[_0x40b6('0xd')]();}else{var _0x1781b8=this;var _0x3f223a=utils['getMustacheRender'](_0xa7098a[0x0],this);logger[_0x40b6('0xc')](_0x40b6('0xe'),_0x274cd4,_0x3f223a);sh[_0x40b6('0xf')](_[_0x40b6('0x10')](_0x3f223a),function(_0x40cccc,_0x4b78f7){logger['info'](_0x40b6('0x11'),_0x274cd4,_0x40cccc);if(_0x40cccc==0x0){var _0x31c350=_0x4b78f7[_0x40b6('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x40b6('0x13')](_0xa7098a[0x1])||_[_0x40b6('0x14')](_0xa7098a[0x1])){logger[_0x40b6('0xc')](_0x40b6('0x15'),_0x274cd4);_0x1781b8[_0x40b6('0x16')][_0xa7098a[0x1]]=_0x31c350;}else{logger[_0x40b6('0xc')](_0x40b6('0x17'),_0x274cd4,_0xa7098a[0x1],_0x31c350);_0x1781b8['body'][_0xa7098a[0x1]]=_0x31c350;}}_0x3e8a42[_0x40b6('0xd')]();});}}catch(_0x1ceca1){logger[_0x40b6('0x8')]('[%s][SYSTEM]\x20%s',_0x274cd4,_[_0x40b6('0x18')](_0x1ceca1)?JSON[_0x40b6('0x19')](_0x1ceca1):_0x1ceca1);logger[_0x40b6('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x274cd4);_0x3e8a42[_0x40b6('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 9b1c98b..14d170a 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 _0x2a5d=['channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','[%s][TAG]\x20%s','error','isObject','stringify','validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','consequence','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next'];(function(_0x24cb1f,_0x5bfc30){var _0x4fa877=function(_0x4b4858){while(--_0x4b4858){_0x24cb1f['push'](_0x24cb1f['shift']());}};_0x4fa877(++_0x5bfc30);}(_0x2a5d,0x1d2));var _0xd2a5=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0x2a5d[_0x52ea08];return _0x28d546;};'use strict';var schema=require(_0xd2a5('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xd2a5('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xd2a5('0x2')),'mailInteraction':require(_0xd2a5('0x3')),'faxInteraction':require(_0xd2a5('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xd2a5('0x5'))(_0xd2a5('0x6'));var tag=schema({'tag':{'type':_0xd2a5('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xd2a5('0x8')]=function(_0x5c4a3d,_0x14cb88,_0x41f058,_0x184d3b){return function(_0xa99534){try{var _0x55b43e={'tag':_0x14cb88[0x0]};var _0x5b672a=tag[_0xd2a5('0x0')](_0x55b43e,{'typecast':!![]});if(_0x5b672a['length']){logger['error']('[%s][TAG]\x20%s',_0x5c4a3d,_['map'](_0x5b672a,_0xd2a5('0x9'))[_0xd2a5('0xa')](',\x20'));logger[_0xd2a5('0xb')](_0xd2a5('0xc'),_0x5c4a3d);_0xa99534[_0xd2a5('0xd')]();}else{var _0x128481={'ids':[_0x14cb88[0x0]]};if(rpc[_0x184d3b[_0xd2a5('0xe')]+'Interaction']){rpc[_0x184d3b[_0xd2a5('0xe')]+_0xd2a5('0xf')][_0xd2a5('0x10')](_0x184d3b['interaction']['id'],_0x128481)[_0xd2a5('0x11')](function(_0x448bc9){logger[_0xd2a5('0xb')](_0xd2a5('0x12'),_0x5c4a3d,_0x14cb88[0x1],_0x184d3b[_0xd2a5('0xe')],_0x184d3b[_0xd2a5('0x13')]['id']);})['catch'](function(_0x456907){logger['error'](_0xd2a5('0x14'),_0x5c4a3d,JSON['stringify'](_0x456907));logger[_0xd2a5('0xb')](_0xd2a5('0xc'),_0x5c4a3d);})['finally'](function(){_0xa99534[_0xd2a5('0xd')]();});}}}catch(_0x25ae6f){logger[_0xd2a5('0x15')](_0xd2a5('0x14'),_0x5c4a3d,_[_0xd2a5('0x16')](_0x25ae6f)?JSON[_0xd2a5('0x17')](_0x25ae6f):_0x25ae6f);logger[_0xd2a5('0xb')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5c4a3d);_0xa99534['next']();}};}; \ No newline at end of file +var _0xa220=['next','channel','Interaction','interaction','then','catch','stringify','info','finally','isObject','validate','lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','routing','number','length','error','[%s][TAG]\x20%s','map','message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x3291fd,_0x44aa2f){var _0x1f243a=function(_0x501835){while(--_0x501835){_0x3291fd['push'](_0x3291fd['shift']());}};_0x1f243a(++_0x44aa2f);}(_0xa220,0xab));var _0x0a22=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa220[_0x167cc1];return _0x10bc4b;};'use strict';var schema=require(_0x0a22('0x0'));var _=require(_0x0a22('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x0a22('0x2')),'mailInteraction':require(_0x0a22('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0a22('0x4'))};var logger=require('../../../../config/logger')(_0x0a22('0x5'));var tag=schema({'tag':{'type':_0x0a22('0x6'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x597d98,_0x425bad,_0x247765,_0x311dd2){return function(_0x1e6210){try{var _0x59a54c={'tag':_0x425bad[0x0]};var _0x256a5c=tag[_0x0a22('0x0')](_0x59a54c,{'typecast':!![]});if(_0x256a5c[_0x0a22('0x7')]){logger[_0x0a22('0x8')](_0x0a22('0x9'),_0x597d98,_[_0x0a22('0xa')](_0x256a5c,_0x0a22('0xb'))['join'](',\x20'));logger['info'](_0x0a22('0xc'),_0x597d98);_0x1e6210[_0x0a22('0xd')]();}else{var _0x92a571={'ids':[_0x425bad[0x0]]};if(rpc[_0x311dd2[_0x0a22('0xe')]+_0x0a22('0xf')]){rpc[_0x311dd2[_0x0a22('0xe')]+_0x0a22('0xf')]['addTags'](_0x311dd2[_0x0a22('0x10')]['id'],_0x92a571)[_0x0a22('0x11')](function(_0x5bcb15){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x597d98,_0x425bad[0x1],_0x311dd2[_0x0a22('0xe')],_0x311dd2[_0x0a22('0x10')]['id']);})[_0x0a22('0x12')](function(_0x1c65e2){logger[_0x0a22('0x8')]('[%s][TAG]\x20%s',_0x597d98,JSON[_0x0a22('0x13')](_0x1c65e2));logger[_0x0a22('0x14')](_0x0a22('0xc'),_0x597d98);})[_0x0a22('0x15')](function(){_0x1e6210['next']();});}}}catch(_0x55dc63){logger['error']('[%s][TAG]\x20%s',_0x597d98,_[_0x0a22('0x16')](_0x55dc63)?JSON[_0x0a22('0x13')](_0x55dc63):_0x55dc63);logger[_0x0a22('0x14')](_0x0a22('0xc'),_0x597d98);_0x1e6210[_0x0a22('0xd')]();}};}; \ 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 600849a..d0be59e 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 _0xfb05=['stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','replace','includes','push','?params=','title','jsonrpc','2.0','method','login','params'];(function(_0x44229f,_0x589143){var _0x5312ed=function(_0x22005b){while(--_0x22005b){_0x44229f['push'](_0x44229f['shift']());}};_0x5312ed(++_0x589143);}(_0xfb05,0xd4));var _0x5fb0=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xfb05[_0x2aea9e];return _0x430b92;};'use strict';var rp=require(_0x5fb0('0x0'));var logger=require(_0x5fb0('0x1'))('routing');var _=require('lodash');var arr=[];exports['consequence']=function(_0x527d97,_0x4e402d){return function(_0x31b548){var _0x427dd3=_0x4e402d[0xa];var _0x4b0650=_0x4e402d[0xb];var _0x22ea88=_0x4e402d[0xc];var _0x2c3801=_0x4e402d[0xd];var _0x1cd1d4=_0x4e402d[0xe];var _0x17dc30=_0x4e402d[0xf][_0x5fb0('0x2')](/\n/g,'\x20-\x20');var _0x31a71c=_0x4e402d[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x5fb0('0x3')](_0x4b0650)){arr[_0x5fb0('0x4')](_0x4b0650);var _0x5d8e54=_0x4e402d[0x3];var _0x233552=_0x4e402d[0x4];var _0x1617d0=_0x4e402d[0x1];var _0x12189e=_0x4e402d[0x0];var _0x3ce128={};_0x3ce128['urlOnAnswer']=_0x4e402d[0x8]+'?params='+_0x22ea88+'|'+_0x427dd3+'|'+_0x2c3801+'|'+_0x4b0650+'|'+_0x1cd1d4;_0x3ce128['urlOnRing']=_0x4e402d[0x7]+_0x5fb0('0x5')+_0x22ea88+'|'+_0x427dd3+'|'+_0x2c3801+'|'+_0x4b0650+'|'+_0x1cd1d4+'|'+_0x17dc30+'|'+_0x31a71c;_0x3ce128[_0x5fb0('0x6')]=_0x4e402d[0x9];var _0x50674c={};_0x50674c[_0x5fb0('0x7')]=_0x5fb0('0x8');_0x50674c[_0x5fb0('0x9')]=_0x5fb0('0xa');var _0x46c63=[];_0x46c63[_0x5fb0('0x4')](_0x4e402d[0x2]);_0x46c63['push'](_0x4e402d[0x5]);_0x46c63[_0x5fb0('0x4')](_0x4e402d[0x6]);_0x50674c[_0x5fb0('0xb')]=_0x46c63;_0x50674c['id']=0x1;var _0x292802=JSON[_0x5fb0('0xc')](_0x50674c);var _0x5e4a30={'encoding':_0x5fb0('0xd'),'method':_0x5fb0('0xe'),'timeout':0x2710,'url':_0x5d8e54,'headers':{'Content-Type':_0x5fb0('0xf')},'body':_0x292802};return rp(_0x5e4a30)[_0x5fb0('0x10')](function(_0x5b5065){const _0x5bb196=JSON[_0x5fb0('0x11')](_0x5b5065);if(!_0x5bb196[_0x5fb0('0x12')][_0x5fb0('0x13')]){throw new Error(_0x5fb0('0x14'));}var _0x5309f2=_0x4b0650;var _0x34408b=_0x5fb0('0x15')+_0x1617d0+_0x5fb0('0x16')+_0x12189e+_0x5fb0('0x17')+_0x5309f2+_0x5fb0('0x18')+JSON[_0x5fb0('0xc')](_0x3ce128);var _0x200284=_0x233552+'?'+_0x34408b;return rp(_0x200284);})['then'](function(_0x43c4a3){logger[_0x5fb0('0x19')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x527d97,_0x43c4a3);_0x31b548['stop']();})[_0x5fb0('0x1a')](function(_0x46a6c3){logger[_0x5fb0('0x1b')](_0x5fb0('0x1c'),_0x527d97,_[_0x5fb0('0x1d')](_0x46a6c3)?JSON[_0x5fb0('0xc')](_0x46a6c3):_0x46a6c3);_0x31b548[_0x5fb0('0x1e')]();});}else{logger[_0x5fb0('0x19')](_0x5fb0('0x1f'),_0x527d97);_0x31b548['next']();}};}; \ No newline at end of file +var _0xf304=['POST','application/json-rpc','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','push','urlOnAnswer','urlOnRing','title','jsonrpc','method','login','params'];(function(_0x40b9d0,_0x3537da){var _0x144b8d=function(_0x3071b5){while(--_0x3071b5){_0x40b9d0['push'](_0x40b9d0['shift']());}};_0x144b8d(++_0x3537da);}(_0xf304,0x19f));var _0x4f30=function(_0x888c1e,_0x386e0e){_0x888c1e=_0x888c1e-0x0;var _0x375229=_0xf304[_0x888c1e];return _0x375229;};'use strict';var rp=require(_0x4f30('0x0'));var logger=require(_0x4f30('0x1'))(_0x4f30('0x2'));var _=require(_0x4f30('0x3'));var arr=[];exports[_0x4f30('0x4')]=function(_0x2ef5ae,_0xd887f){return function(_0x55dc7a){var _0x4ff6da=_0xd887f[0xa];var _0x16b73c=_0xd887f[0xb];var _0x36b914=_0xd887f[0xc];var _0x117ceb=_0xd887f[0xd];var _0x5a2268=_0xd887f[0xe];var _0x14fe11=_0xd887f[0xf]['replace'](/\n/g,'\x20-\x20');var _0x4d8252=_0xd887f[0x10][_0x4f30('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x16b73c)){arr[_0x4f30('0x6')](_0x16b73c);var _0x2abe93=_0xd887f[0x3];var _0x499296=_0xd887f[0x4];var _0x3cb9de=_0xd887f[0x1];var _0x5ae5f7=_0xd887f[0x0];var _0x13954f={};_0x13954f[_0x4f30('0x7')]=_0xd887f[0x8]+'?params='+_0x36b914+'|'+_0x4ff6da+'|'+_0x117ceb+'|'+_0x16b73c+'|'+_0x5a2268;_0x13954f[_0x4f30('0x8')]=_0xd887f[0x7]+'?params='+_0x36b914+'|'+_0x4ff6da+'|'+_0x117ceb+'|'+_0x16b73c+'|'+_0x5a2268+'|'+_0x14fe11+'|'+_0x4d8252;_0x13954f[_0x4f30('0x9')]=_0xd887f[0x9];var _0x1cae58={};_0x1cae58[_0x4f30('0xa')]='2.0';_0x1cae58[_0x4f30('0xb')]=_0x4f30('0xc');var _0x4cd825=[];_0x4cd825[_0x4f30('0x6')](_0xd887f[0x2]);_0x4cd825[_0x4f30('0x6')](_0xd887f[0x5]);_0x4cd825[_0x4f30('0x6')](_0xd887f[0x6]);_0x1cae58[_0x4f30('0xd')]=_0x4cd825;_0x1cae58['id']=0x1;var _0x35abc5=JSON['stringify'](_0x1cae58);var _0x102567={'encoding':'utf8','method':_0x4f30('0xe'),'timeout':0x2710,'url':_0x2abe93,'headers':{'Content-Type':_0x4f30('0xf')},'body':_0x35abc5};return rp(_0x102567)['then'](function(_0xd55ed0){const _0x243886=JSON[_0x4f30('0x10')](_0xd55ed0);if(!_0x243886[_0x4f30('0x11')][_0x4f30('0x12')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x2ade19=_0x16b73c;var _0x5ae1cf=_0x4f30('0x13')+_0x3cb9de+_0x4f30('0x14')+_0x5ae5f7+_0x4f30('0x15')+_0x2ade19+_0x4f30('0x16')+JSON['stringify'](_0x13954f);var _0x5d92ef=_0x499296+'?'+_0x5ae1cf;return rp(_0x5d92ef);})['then'](function(_0x4c0853){logger[_0x4f30('0x17')](_0x4f30('0x18'),_0x2ef5ae,_0x4c0853);_0x55dc7a[_0x4f30('0x19')]();})[_0x4f30('0x1a')](function(_0xfaf611){logger[_0x4f30('0x1b')](_0x4f30('0x1c'),_0x2ef5ae,_[_0x4f30('0x1d')](_0xfaf611)?JSON[_0x4f30('0x1e')](_0xfaf611):_0xfaf611);_0x55dc7a[_0x4f30('0x19')]();});}else{logger[_0x4f30('0x17')](_0x4f30('0x1f'),_0x2ef5ae);_0x55dc7a[_0x4f30('0x20')]();}};}; \ 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 f73bde9..6b5bdc2 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4795d1,_0x289dd3){var _0x45194e=function(_0x51a057){while(--_0x51a057){_0x4795d1['push'](_0x4795d1['shift']());}};_0x45194e(++_0x289dd3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x5bed41,_0x39581f){var _0x31edb0=function(_0x5c4999){while(--_0x5c4999){_0x5bed41['push'](_0x5bed41['shift']());}};_0x31edb0(++_0x39581f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index ba25122..e23bf32 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 _0x3790=['agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','waiting','mailQueues','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflow','tag','TagId','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','on\x20interval','error','execute','info','Applications\x20executed','stringify','matchPath','emit','stack','routing\x20is\x20empty'];(function(_0x31a1d,_0x242052){var _0xb2c86a=function(_0x80d7f2){while(--_0x80d7f2){_0x31a1d['push'](_0x31a1d['shift']());}};_0xb2c86a(++_0x242052);}(_0x3790,0xe5));var _0x0379=function(_0x574c98,_0x3c503c){_0x574c98=_0x574c98-0x0;var _0x193ce3=_0x3790[_0x574c98];return _0x193ce3;};'use strict';var _=require(_0x0379('0x0'));var util=require(_0x0379('0x1'));var path=require(_0x0379('0x2'));var fs=require('fs');var jayson=require(_0x0379('0x3'));var BPromise=require(_0x0379('0x4'));var utils=require(_0x0379('0x5'));var sUtils=require('./applications/strategy/util');var logger=require(_0x0379('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x0379('0x7')),'mailQueueReport':require(_0x0379('0x8')),'chatQueueReport':require(_0x0379('0x9')),'smsQueueReport':require(_0x0379('0xa')),'faxQueueReport':require(_0x0379('0xb')),'whatsappQueueReport':require(_0x0379('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x2ebd6b,_0x3ecc5e,_0x2c5caa){return util[_0x0379('0xd')](_0x0379('0xe'),_0x2ebd6b,_0x3ecc5e||0x0,_0x2c5caa||0x0);}function getIntervals(_0x24a841,_0xc2390e){var _0x36455d=[];if(!_[_0x0379('0xf')](_0xc2390e['IntervalId'])&&!_[_0x0379('0xf')](_0x24a841[_0xc2390e[_0x0379('0x10')]])&&!_['isNil'](_0x24a841[_0xc2390e['IntervalId']]['Intervals'])){_0x36455d=_[_0x0379('0x11')](_0x24a841[_0xc2390e[_0x0379('0x10')]][_0x0379('0x12')],_0x0379('0x13'));}else if(!_[_0x0379('0xf')](_0xc2390e[_0x0379('0x13')])){_0x36455d=[_0xc2390e[_0x0379('0x13')]];}return _0x36455d;}exports[_0x0379('0x14')]=function(_0xda03d8){_0xda03d8[_0x0379('0x15')]={};return new BPromise(function(_0x5f1ef4,_0x29f9d1){var _0x1e2d28={'Start':function(_0x1708a4){var _0x19f218=this;return new Promise(function(_0x1bac48,_0x55217d){if(_0x1708a4){try{var _0x255139=[];var _0x16b4b6=getId(_0x1708a4[_0x0379('0x16')],_0x1708a4[_0x0379('0x17')]?_0x1708a4[_0x0379('0x17')]['id']:0x0,_0x1708a4['interaction']?_0x1708a4[_0x0379('0x18')]['id']:0x0);var _0x10e468=sUtils['checkWaitingNotifications'](_0xda03d8,_0x1708a4);if(!_0x10e468&&_0x1708a4[_0x0379('0x19')]&&_[_0x0379('0x1a')](_0x1708a4[_0x0379('0x19')])&&_0x1708a4[_0x0379('0x19')][_0x0379('0x1b')]){for(var _0xb9acae=0x0;_0xb9acae<_0x1708a4[_0x0379('0x19')][_0x0379('0x1b')];_0xb9acae+=0x1){var _0x27d311=_0x1708a4[_0x0379('0x19')][_0xb9acae];if(fs[_0x0379('0x1c')](path['join'](__dirname,_0x0379('0x19'),_0x27d311[_0x0379('0x1d')]+_0x0379('0x1e')))){var _0x2cb687=[];switch(_0x27d311['app'][_0x0379('0x1f')]()){case _0x0379('0x20'):var _0x2d10bb=_0x27d311[_0x0379('0x21')][_0x0379('0x22')](',');if(_0x1708a4['channel']===_0x0379('0x23')){_0x2cb687[_0x0379('0x24')](_0x2d10bb[0x0]);_0x2cb687['push'](_0x2d10bb[0x1]);_0x2cb687[_0x0379('0x24')](_0x2d10bb[_0x0379('0x25')](0x2,_0x2d10bb[_0x0379('0x1b')])[_0x0379('0x26')](','));}else{_0x2cb687[_0x0379('0x24')](_0x2d10bb[0x0]);_0x2cb687[_0x0379('0x24')](_0x2d10bb[_0x0379('0x25')](0x1,_0x2d10bb['length'])[_0x0379('0x26')](','));}break;case _0x0379('0x27'):var _0x275172=_0x27d311[_0x0379('0x21')][_0x0379('0x22')](',');_0x2cb687[_0x0379('0x24')](_0x275172[0x0]);_0x2cb687[_0x0379('0x24')](_0x275172[0x1]);_0x2cb687['push'](_0x275172[_0x0379('0x25')](0x2,_0x275172[_0x0379('0x1b')])[_0x0379('0x26')](','));break;case'dialogflowv2':var _0x1ce856=_0x27d311[_0x0379('0x21')][_0x0379('0x22')](',');_0x2cb687[_0x0379('0x24')](_0x1ce856[0x0]);_0x2cb687['push'](_0x1ce856[0x1]);_0x2cb687['push'](_0x1ce856[0x2]);_0x2cb687[_0x0379('0x24')](_0x1ce856[0x3]);_0x2cb687['push'](_0x1ce856[_0x0379('0x25')](0x4,_0x1ce856[_0x0379('0x1b')])[_0x0379('0x26')](','));break;case'amazonlex':var _0x1558b9=_0x27d311[_0x0379('0x21')][_0x0379('0x22')](',');_0x2cb687[_0x0379('0x24')](_0x1558b9[0x0]);_0x2cb687[_0x0379('0x24')](_0x1558b9[0x1]);_0x2cb687[_0x0379('0x24')](_0x1558b9[0x2]);_0x2cb687[_0x0379('0x24')](_0x1558b9[0x3]);_0x2cb687[_0x0379('0x24')](_0x1558b9[_0x0379('0x25')](0x4,_0x1558b9[_0x0379('0x1b')])[_0x0379('0x26')](','));break;case _0x0379('0x17'):_0x2cb687['push'](_0x27d311['appdata']);break;case _0x0379('0x28'):_0x2cb687[_0x0379('0x24')](_0x27d311[_0x0379('0x29')]);_0x2cb687[_0x0379('0x24')](_0x27d311[_0x0379('0x21')]);break;case'tvox':var _0x22fc85=utils['getMustacheRender'](_0x1708a4[_0x0379('0x2a')]['notificationTemplate'],_0x1708a4);var _0x4bf3d7=_0x27d311['appdata'][_0x0379('0x22')](',');_0x2cb687['push'](_0x4bf3d7[0x0]);_0x2cb687[_0x0379('0x24')](_0x4bf3d7[0x1]);_0x2cb687[_0x0379('0x24')](_0x4bf3d7[0x2]);_0x2cb687[_0x0379('0x24')](_0x4bf3d7[0x3]);_0x2cb687[_0x0379('0x24')](_0x4bf3d7[0x4]);_0x2cb687[_0x0379('0x24')](_0x4bf3d7[0x5]);_0x2cb687[_0x0379('0x24')](_0x4bf3d7[0x6]);_0x2cb687[_0x0379('0x24')](_0x4bf3d7[0x7]);_0x2cb687['push'](_0x4bf3d7[0x8]);_0x2cb687[_0x0379('0x24')](_0x4bf3d7[0x9]);_0x2cb687[_0x0379('0x24')](_0x4bf3d7[0xa]);_0x2cb687[_0x0379('0x24')](_0x1708a4[_0x0379('0x18')]['id']);_0x2cb687['push'](_0x1708a4[_0x0379('0x17')]['id']);_0x2cb687['push'](_0x27d311[_0x0379('0x2b')]);_0x2cb687[_0x0379('0x24')](_0x1708a4['interaction'][_0x0379('0x2c')]);_0x2cb687[_0x0379('0x24')](_0x1708a4[_0x0379('0x2d')][_0x0379('0x2d')]);_0x2cb687[_0x0379('0x24')](_0x22fc85);break;default:_0x2cb687=_[_0x0379('0xf')](_0x27d311[_0x0379('0x21')])?[]:_0x27d311[_0x0379('0x21')][_0x0379('0x22')](',');}var _0xa05684={'id':util[_0x0379('0xd')](_0x0379('0x2e'),_0x16b4b6,_0x27d311['id'],_0x27d311[_0x0379('0x1d')]),'condition':require(_0x0379('0x2f'))[_0x0379('0x30')](_0x16b4b6,getIntervals(_0xda03d8[_0x0379('0x31')],_0x27d311),_0xda03d8),'consequence':require(_0x0379('0x32')+_0x27d311[_0x0379('0x1d')])[_0x0379('0x33')](_0x16b4b6,_0x2cb687,_0xda03d8,_0x1708a4),'p':_0x27d311['priority']||0x0};logger['info']('Push\x20new\x20rule',_0xa05684['id'],_0x0379('0x34'),getIntervals(_0xda03d8[_0x0379('0x31')],_0x27d311)[_0x0379('0x26')]('\x20|\x20'));_0x255139[_0x0379('0x24')](_0xa05684);}else{logger[_0x0379('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x0379('0x26')](__dirname,_0x0379('0x19'),_0x27d311[_0x0379('0x1d')]+_0x0379('0x1e')));}}_0xda03d8[_0x0379('0x15')][_0x16b4b6]=new RuleEngine(_0x255139);_0xda03d8[_0x0379('0x15')][_0x16b4b6][_0x0379('0x36')](_0x1708a4,function(_0x5f4ddc){logger[_0x0379('0x37')](_0x0379('0x38'),JSON[_0x0379('0x39')](_0x5f4ddc[_0x0379('0x3a')]));if(_0xda03d8[_0x0379('0x15')][_0x16b4b6]){_0xda03d8[_0x0379('0x15')][_0x16b4b6][_0x0379('0x3b')]('complete');}});return _0x1bac48({'code':0xc8,'message':_0x1708a4});}else{if(_0x10e468){logger[_0x0379('0x37')](util[_0x0379('0xd')]('Skipped\x20routing\x20for\x20%s',_0x16b4b6));}else{logger[_0x0379('0x37')]('No\x20applications\x20to\x20execute');}return _0x1bac48({'code':0xc8,'message':_0x1708a4});}}catch(_0x52cfb0){logger[_0x0379('0x35')](_0x52cfb0[_0x0379('0x3c')]);return _0x55217d(_0x19f218['error'](0x1f4,_0x52cfb0));}}return _0x55217d(_0x0379('0x3d'));});},'AcceptMessage':function(_0x1541f5){var _0xc71022=this;return new Promise(function(_0x181641,_0xa7b8b7){if(_0x1541f5[_0x0379('0x3e')]&&_0x1541f5[_0x0379('0x3e')]['id']){if(_0xda03d8[_0x0379('0x3f')][_0x1541f5[_0x0379('0x3e')]['id']]){_0xda03d8[_0x0379('0x3f')][_0x1541f5['agent']['id']]['busy']=![];_0xda03d8['agents'][_0x1541f5['agent']['id']][_0x0379('0x40')]=undefined;}}if(_0x1541f5[_0x0379('0x17')]&&_0x1541f5['message']['id']){try{var _0x22a574=getId(_0x1541f5['channel'],_0x1541f5['message']?_0x1541f5[_0x0379('0x17')]['id']:0x0,_0x1541f5[_0x0379('0x18')]?_0x1541f5[_0x0379('0x18')]['id']:0x0);if(_0xda03d8['rules'][_0x22a574]){_0xda03d8[_0x0379('0x15')][_0x22a574][_0x0379('0x3b')](_0x0379('0x41'));if(rpc[_0x1541f5[_0x0379('0x16')]+_0x0379('0x42')]){rpc[_0x1541f5[_0x0379('0x16')]+_0x0379('0x42')][_0x0379('0x43')](_0x22a574,{'UserId':_0x1541f5[_0x0379('0x17')][_0x0379('0x44')]})[_0x0379('0x45')](function(){logger[_0x0379('0x35')](_0x0379('0x46'));});}}return _0x181641({'code':0xc8,'message':_0x1541f5});}catch(_0x5dd7f7){logger[_0x0379('0x35')](_0x5dd7f7[_0x0379('0x3c')]);return _0xa7b8b7(_0xc71022[_0x0379('0x35')](0x1f4,_0x5dd7f7));}}logger[_0x0379('0x35')](_0x0379('0x47'));return _0xa7b8b7(_0xc71022[_0x0379('0x35')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xc4d080){var _0x515057=this;return new Promise(function(_0x2aabbd,_0x44bd92){if(_0xc4d080[_0x0379('0x3e')]&&_0xc4d080[_0x0379('0x3e')]['id']){try{if(_0xda03d8['agents'][_0xc4d080[_0x0379('0x3e')]['id']]){_0xda03d8[_0x0379('0x3f')][_0xc4d080[_0x0379('0x3e')]['id']][_0x0379('0x48')]=![];_0xda03d8[_0x0379('0x3f')][_0xc4d080[_0x0379('0x3e')]['id']][_0x0379('0x40')]=undefined;}return _0x2aabbd({'code':0xc8,'message':_0xc4d080});}catch(_0x449dc8){logger[_0x0379('0x35')](_0x449dc8['stack']);return _0x44bd92(_0x515057[_0x0379('0x35')](0x1f4,_0x449dc8));}}logger[_0x0379('0x35')](_0x0379('0x47'));return _0x44bd92(_0x515057[_0x0379('0x35')](0x1f4,_0x0379('0x47')));});},'AbandonInteraction':function(_0x4c675e){var _0x1d5071=this;return new Promise(function(_0x557d0e,_0xa34a53){if(_0x4c675e[_0x0379('0x16')]&&_0x4c675e['interaction']&&_0x4c675e[_0x0379('0x18')]['id']){try{var _0x33345a=getId(_0x4c675e[_0x0379('0x16')],_0x4c675e['message']?_0x4c675e[_0x0379('0x17')]['id']:0x0,_0x4c675e['interaction']?_0x4c675e[_0x0379('0x18')]['id']:0x0);if(_0xda03d8[_0x0379('0x15')][_0x33345a]){_0xda03d8['rules'][_0x33345a]['emit'](_0x0379('0x41'));}return _0x557d0e({'code':0xc8,'message':_0x4c675e});}catch(_0x1eefb1){logger['error'](_0x1eefb1[_0x0379('0x3c')]);return _0xa34a53(_0x1d5071[_0x0379('0x35')](0x1f4,_0x1eefb1));}}logger[_0x0379('0x35')](_0x0379('0x47'));return _0xa34a53(_0x1d5071[_0x0379('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x16fab6){var _0x118a12=this;return new Promise(function(_0x56fc9e,_0x5d4af2){if(_0xda03d8[_0x0379('0x3f')]['hasOwnProperty'](_0x16fab6['id'])){for(var _0x1b8f49 in _0x16fab6[_0x0379('0x49')]){if(_0x16fab6[_0x0379('0x49')][_0x0379('0x4a')](_0x1b8f49)){if(_0xda03d8[_0x0379('0x3f')][_0x16fab6['id']][_0x0379('0x4a')](_0x1b8f49+_0x0379('0x4b'))){_0xda03d8['agents'][_0x16fab6['id']][_0x1b8f49+'CurrentCapacity']=parseInt(_0x16fab6[_0x0379('0x49')][_0x1b8f49],0xa);}}}_0xda03d8[_0x0379('0x3f')][_0x16fab6['id']][_0x0379('0x4c')]();return _0x56fc9e({'code':0xc8,'message':_0xda03d8['agents'][_0x16fab6['id']]});}else{return _0x5d4af2(_0x118a12['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x5b860a){return new Promise(function(_0x481244){var _0x56c8cf=_[_0x0379('0x4d')](_0xda03d8['agents']);if(_0x5b860a&&_0x5b860a['id']){var _0x3fb268=_[_0x0379('0x4e')](_0x56c8cf,function(_0x2fff6c){return _0x2fff6c['id']===_0x5b860a['id'];});_0x481244(_0x3fb268);}else{_0x481244({'count':_0x56c8cf[_0x0379('0x1b')],'rows':_0x56c8cf});}});},'ChatQueues':function(){return new Promise(function(_0x312455){var _0x2ebd90=[];for(var _0x37b990 in _0xda03d8[_0x0379('0x4f')]){if(_0xda03d8[_0x0379('0x4f')][_0x0379('0x4a')](_0x37b990)){var _0x218240=_0xda03d8[_0x0379('0x4f')][_0x37b990];var _0x58eea6={'id':_0x218240['id'],'available':_0x218240[_0x0379('0x50')],'loggedIn':_0x218240[_0x0379('0x51')],'name':_0x218240['name'],'paused':_0x218240['paused'],'waiting':_0x218240[_0x0379('0x52')]};_0x2ebd90[_0x0379('0x24')](_0x58eea6);}}_0x312455({'count':_0x2ebd90[_0x0379('0x1b')],'rows':_0x2ebd90});});},'MailQueues':function(){return new Promise(function(_0x5cc652){var _0x75e310=[];for(var _0x1b8886 in _0xda03d8['mailQueues']){if(_0xda03d8[_0x0379('0x53')][_0x0379('0x4a')](_0x1b8886)){var _0x35dd74=_0xda03d8[_0x0379('0x53')][_0x1b8886];var _0x57e959={'id':_0x35dd74['id'],'available':_0x35dd74['available'],'loggedIn':_0x35dd74['loggedIn'],'name':_0x35dd74[_0x0379('0x54')],'paused':_0x35dd74[_0x0379('0x55')],'waiting':_0x35dd74[_0x0379('0x52')]};_0x75e310[_0x0379('0x24')](_0x57e959);}}_0x5cc652({'count':_0x75e310[_0x0379('0x1b')],'rows':_0x75e310});});},'OpenchannelQueues':function(){return new Promise(function(_0x3d23aa){var _0x1fe729=[];for(var _0x2a3709 in _0xda03d8[_0x0379('0x56')]){if(_0xda03d8[_0x0379('0x56')][_0x0379('0x4a')](_0x2a3709)){var _0x41f839=_0xda03d8['openchannelQueues'][_0x2a3709];var _0x29f624={'id':_0x41f839['id'],'available':_0x41f839[_0x0379('0x50')],'loggedIn':_0x41f839[_0x0379('0x51')],'name':_0x41f839[_0x0379('0x54')],'paused':_0x41f839['paused'],'waiting':_0x41f839[_0x0379('0x52')]};_0x1fe729[_0x0379('0x24')](_0x29f624);}}_0x3d23aa({'count':_0x1fe729[_0x0379('0x1b')],'rows':_0x1fe729});});},'SmsQueues':function(){return new Promise(function(_0x4e6e95){var _0x37a704=[];for(var _0x97fd77 in _0xda03d8['smsQueues']){if(_0xda03d8[_0x0379('0x57')]['hasOwnProperty'](_0x97fd77)){var _0x1969ea=_0xda03d8[_0x0379('0x57')][_0x97fd77];var _0x1f9b7b={'id':_0x1969ea['id'],'available':_0x1969ea[_0x0379('0x50')],'loggedIn':_0x1969ea[_0x0379('0x51')],'name':_0x1969ea['name'],'paused':_0x1969ea[_0x0379('0x55')],'waiting':_0x1969ea[_0x0379('0x52')]};_0x37a704['push'](_0x1f9b7b);}}_0x4e6e95({'count':_0x37a704['length'],'rows':_0x37a704});});},'FaxQueues':function(){return new Promise(function(_0x174a8b){var _0x588370=[];for(var _0x42fec8 in _0xda03d8[_0x0379('0x58')]){if(_0xda03d8[_0x0379('0x58')][_0x0379('0x4a')](_0x42fec8)){var _0x3cf66f=_0xda03d8['faxQueues'][_0x42fec8];var _0x542490={'id':_0x3cf66f['id'],'available':_0x3cf66f[_0x0379('0x50')],'loggedIn':_0x3cf66f['loggedIn'],'name':_0x3cf66f['name'],'paused':_0x3cf66f['paused'],'waiting':_0x3cf66f[_0x0379('0x52')]};_0x588370[_0x0379('0x24')](_0x542490);}}_0x174a8b({'count':_0x588370['length'],'rows':_0x588370});});},'WhatsappQueues':function(){return new Promise(function(_0x6edd1d){var _0x1729e7=[];for(var _0x5685a8 in _0xda03d8[_0x0379('0x59')]){if(_0xda03d8[_0x0379('0x59')][_0x0379('0x4a')](_0x5685a8)){var _0x17e6d2=_0xda03d8[_0x0379('0x59')][_0x5685a8];var _0xbcb8d5={'id':_0x17e6d2['id'],'available':_0x17e6d2[_0x0379('0x50')],'loggedIn':_0x17e6d2[_0x0379('0x51')],'name':_0x17e6d2['name'],'paused':_0x17e6d2[_0x0379('0x55')],'waiting':_0x17e6d2[_0x0379('0x52')]};_0x1729e7['push'](_0xbcb8d5);}}_0x6edd1d({'count':_0x1729e7[_0x0379('0x1b')],'rows':_0x1729e7});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2be8e6){var _0x4e33f2=_[_0x0379('0x4d')](_0xda03d8['chatQueuesWaitingInteractions']);_0x2be8e6({'count':_0x4e33f2[_0x0379('0x1b')],'rows':_0x4e33f2});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x48de3b){var _0x18fd18=_[_0x0379('0x4d')](_0xda03d8['mailQueuesWaitingInteractions']);_0x48de3b({'count':_0x18fd18[_0x0379('0x1b')],'rows':_0x18fd18});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x21507a){var _0x16dac6=_[_0x0379('0x4d')](_0xda03d8['openchannelQueuesWaitingInteractions']);_0x21507a({'count':_0x16dac6[_0x0379('0x1b')],'rows':_0x16dac6});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x15318c){var _0x4e39f9=_[_0x0379('0x4d')](_0xda03d8['smsQueuesWaitingInteractions']);_0x15318c({'count':_0x4e39f9[_0x0379('0x1b')],'rows':_0x4e39f9});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x25f545){var _0x35803e=_['values'](_0xda03d8[_0x0379('0x5a')]);_0x25f545({'count':_0x35803e[_0x0379('0x1b')],'rows':_0x35803e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x42d4a8){var _0x21c8f7=_[_0x0379('0x4d')](_0xda03d8[_0x0379('0x5b')]);_0x42d4a8({'count':_0x21c8f7[_0x0379('0x1b')],'rows':_0x21c8f7});});}};var _0x474ec0=jayson[_0x0379('0x5c')](_0x1e2d28)[_0x0379('0x5d')]();_0x474ec0['on'](_0x0379('0x35'),function(_0x5c3890){logger[_0x0379('0x35')](JSON[_0x0379('0x39')](_0x5c3890));return _0x29f9d1(_0x5c3890);});_0x474ec0[_0x0379('0x14')](0x232c,_0x0379('0x5e'),function(){console[_0x0379('0x5f')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x5f1ef4(_0x0379('0x60')+0x232c);});});}; \ No newline at end of file +var _0xe41d=['loggedIn','name','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','waiting','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','./applications/utils','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','Intervals','map','interval','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','.js','app','toLowerCase','autoreply','channel','mail','push','slice','dialogflow','appdata','split','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','ChatWebsiteId','body','%s:%s:%s','./interval','intervals','consequence','priority','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','stringify','matchPath','emit','info','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agents','agent','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available'];(function(_0x4a0174,_0x527af9){var _0x116e55=function(_0x5c3cf5){while(--_0x5c3cf5){_0x4a0174['push'](_0x4a0174['shift']());}};_0x116e55(++_0x527af9);}(_0xe41d,0x70));var _0xde41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe41d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xde41('0x0'));var util=require('util');var path=require(_0xde41('0x1'));var fs=require('fs');var jayson=require(_0xde41('0x2'));var BPromise=require('bluebird');var utils=require(_0xde41('0x3'));var sUtils=require('./applications/strategy/util');var logger=require(_0xde41('0x4'))(_0xde41('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xde41('0x6')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xde41('0x7')),'whatsappQueueReport':require(_0xde41('0x8'))};var RuleEngine=require(_0xde41('0x9'));function getId(_0x14a5ec,_0x4d2a0f,_0xe9e4b2){return util[_0xde41('0xa')](_0xde41('0xb'),_0x14a5ec,_0x4d2a0f||0x0,_0xe9e4b2||0x0);}function getIntervals(_0xe5524d,_0x4f1a4f){var _0x23ee0c=[];if(!_[_0xde41('0xc')](_0x4f1a4f['IntervalId'])&&!_[_0xde41('0xc')](_0xe5524d[_0x4f1a4f['IntervalId']])&&!_['isNil'](_0xe5524d[_0x4f1a4f['IntervalId']][_0xde41('0xd')])){_0x23ee0c=_[_0xde41('0xe')](_0xe5524d[_0x4f1a4f['IntervalId']][_0xde41('0xd')],_0xde41('0xf'));}else if(!_['isNil'](_0x4f1a4f['interval'])){_0x23ee0c=[_0x4f1a4f[_0xde41('0xf')]];}return _0x23ee0c;}exports['listen']=function(_0x423110){_0x423110['rules']={};return new BPromise(function(_0x3739a8,_0x27cf08){var _0x6e6966={'Start':function(_0x2f6295){var _0x1e61ab=this;return new Promise(function(_0x406fc0,_0x1e8a4b){if(_0x2f6295){try{var _0x4e8674=[];var _0x56414f=getId(_0x2f6295['channel'],_0x2f6295[_0xde41('0x10')]?_0x2f6295[_0xde41('0x10')]['id']:0x0,_0x2f6295[_0xde41('0x11')]?_0x2f6295[_0xde41('0x11')]['id']:0x0);var _0x12913e=sUtils[_0xde41('0x12')](_0x423110,_0x2f6295);if(!_0x12913e&&_0x2f6295[_0xde41('0x13')]&&_[_0xde41('0x14')](_0x2f6295[_0xde41('0x13')])&&_0x2f6295[_0xde41('0x13')][_0xde41('0x15')]){for(var _0x5ed234=0x0;_0x5ed234<_0x2f6295[_0xde41('0x13')][_0xde41('0x15')];_0x5ed234+=0x1){var _0x522db4=_0x2f6295[_0xde41('0x13')][_0x5ed234];if(fs[_0xde41('0x16')](path[_0xde41('0x17')](__dirname,_0xde41('0x13'),_0x522db4['app']+_0xde41('0x18')))){var _0x2b74e6=[];switch(_0x522db4[_0xde41('0x19')][_0xde41('0x1a')]()){case _0xde41('0x1b'):var _0x59a37a=_0x522db4['appdata']['split'](',');if(_0x2f6295[_0xde41('0x1c')]===_0xde41('0x1d')){_0x2b74e6[_0xde41('0x1e')](_0x59a37a[0x0]);_0x2b74e6[_0xde41('0x1e')](_0x59a37a[0x1]);_0x2b74e6[_0xde41('0x1e')](_0x59a37a[_0xde41('0x1f')](0x2,_0x59a37a[_0xde41('0x15')])[_0xde41('0x17')](','));}else{_0x2b74e6['push'](_0x59a37a[0x0]);_0x2b74e6[_0xde41('0x1e')](_0x59a37a[_0xde41('0x1f')](0x1,_0x59a37a[_0xde41('0x15')])[_0xde41('0x17')](','));}break;case _0xde41('0x20'):var _0x1b2022=_0x522db4[_0xde41('0x21')][_0xde41('0x22')](',');_0x2b74e6[_0xde41('0x1e')](_0x1b2022[0x0]);_0x2b74e6[_0xde41('0x1e')](_0x1b2022[0x1]);_0x2b74e6[_0xde41('0x1e')](_0x1b2022['slice'](0x2,_0x1b2022[_0xde41('0x15')])['join'](','));break;case _0xde41('0x23'):var _0x52044c=_0x522db4[_0xde41('0x21')][_0xde41('0x22')](',');_0x2b74e6['push'](_0x52044c[0x0]);_0x2b74e6['push'](_0x52044c[0x1]);_0x2b74e6[_0xde41('0x1e')](_0x52044c[0x2]);_0x2b74e6['push'](_0x52044c[0x3]);_0x2b74e6['push'](_0x52044c[_0xde41('0x1f')](0x4,_0x52044c[_0xde41('0x15')])['join'](','));break;case _0xde41('0x24'):var _0x570a16=_0x522db4[_0xde41('0x21')][_0xde41('0x22')](',');_0x2b74e6[_0xde41('0x1e')](_0x570a16[0x0]);_0x2b74e6[_0xde41('0x1e')](_0x570a16[0x1]);_0x2b74e6[_0xde41('0x1e')](_0x570a16[0x2]);_0x2b74e6[_0xde41('0x1e')](_0x570a16[0x3]);_0x2b74e6[_0xde41('0x1e')](_0x570a16['slice'](0x4,_0x570a16['length'])[_0xde41('0x17')](','));break;case _0xde41('0x10'):_0x2b74e6[_0xde41('0x1e')](_0x522db4['appdata']);break;case'tag':_0x2b74e6[_0xde41('0x1e')](_0x522db4[_0xde41('0x25')]);_0x2b74e6[_0xde41('0x1e')](_0x522db4[_0xde41('0x21')]);break;case _0xde41('0x26'):var _0x3892f7=utils[_0xde41('0x27')](_0x2f6295['account']['notificationTemplate'],_0x2f6295);var _0x16d535=_0x522db4[_0xde41('0x21')]['split'](',');_0x2b74e6['push'](_0x16d535[0x0]);_0x2b74e6[_0xde41('0x1e')](_0x16d535[0x1]);_0x2b74e6[_0xde41('0x1e')](_0x16d535[0x2]);_0x2b74e6[_0xde41('0x1e')](_0x16d535[0x3]);_0x2b74e6['push'](_0x16d535[0x4]);_0x2b74e6['push'](_0x16d535[0x5]);_0x2b74e6[_0xde41('0x1e')](_0x16d535[0x6]);_0x2b74e6[_0xde41('0x1e')](_0x16d535[0x7]);_0x2b74e6[_0xde41('0x1e')](_0x16d535[0x8]);_0x2b74e6[_0xde41('0x1e')](_0x16d535[0x9]);_0x2b74e6['push'](_0x16d535[0xa]);_0x2b74e6[_0xde41('0x1e')](_0x2f6295[_0xde41('0x11')]['id']);_0x2b74e6[_0xde41('0x1e')](_0x2f6295['message']['id']);_0x2b74e6[_0xde41('0x1e')](_0x522db4[_0xde41('0x28')]);_0x2b74e6[_0xde41('0x1e')](_0x2f6295[_0xde41('0x11')]['ContactId']);_0x2b74e6['push'](_0x2f6295[_0xde41('0x29')][_0xde41('0x29')]);_0x2b74e6[_0xde41('0x1e')](_0x3892f7);break;default:_0x2b74e6=_['isNil'](_0x522db4[_0xde41('0x21')])?[]:_0x522db4[_0xde41('0x21')][_0xde41('0x22')](',');}var _0x144187={'id':util['format'](_0xde41('0x2a'),_0x56414f,_0x522db4['id'],_0x522db4[_0xde41('0x19')]),'condition':require(_0xde41('0x2b'))['condition'](_0x56414f,getIntervals(_0x423110[_0xde41('0x2c')],_0x522db4),_0x423110),'consequence':require('./applications/'+_0x522db4[_0xde41('0x19')])[_0xde41('0x2d')](_0x56414f,_0x2b74e6,_0x423110,_0x2f6295),'p':_0x522db4[_0xde41('0x2e')]||0x0};logger['info']('Push\x20new\x20rule',_0x144187['id'],'on\x20interval',getIntervals(_0x423110[_0xde41('0x2c')],_0x522db4)[_0xde41('0x17')](_0xde41('0x2f')));_0x4e8674[_0xde41('0x1e')](_0x144187);}else{logger[_0xde41('0x30')](_0xde41('0x31'),path[_0xde41('0x17')](__dirname,_0xde41('0x13'),_0x522db4['app']+_0xde41('0x18')));}}_0x423110[_0xde41('0x32')][_0x56414f]=new RuleEngine(_0x4e8674);_0x423110['rules'][_0x56414f][_0xde41('0x33')](_0x2f6295,function(_0x5323a1){logger['info']('Applications\x20executed',JSON[_0xde41('0x34')](_0x5323a1[_0xde41('0x35')]));if(_0x423110[_0xde41('0x32')][_0x56414f]){_0x423110[_0xde41('0x32')][_0x56414f][_0xde41('0x36')]('complete');}});return _0x406fc0({'code':0xc8,'message':_0x2f6295});}else{if(_0x12913e){logger[_0xde41('0x37')](util['format'](_0xde41('0x38'),_0x56414f));}else{logger[_0xde41('0x37')]('No\x20applications\x20to\x20execute');}return _0x406fc0({'code':0xc8,'message':_0x2f6295});}}catch(_0x2145ad){logger[_0xde41('0x30')](_0x2145ad[_0xde41('0x39')]);return _0x1e8a4b(_0x1e61ab['error'](0x1f4,_0x2145ad));}}return _0x1e8a4b(_0xde41('0x3a'));});},'AcceptMessage':function(_0x453ac2){var _0xf4ec=this;return new Promise(function(_0x4d03de,_0x50240c){if(_0x453ac2['agent']&&_0x453ac2['agent']['id']){if(_0x423110[_0xde41('0x3b')][_0x453ac2['agent']['id']]){_0x423110[_0xde41('0x3b')][_0x453ac2[_0xde41('0x3c')]['id']][_0xde41('0x3d')]=![];_0x423110[_0xde41('0x3b')][_0x453ac2[_0xde41('0x3c')]['id']][_0xde41('0x3e')]=undefined;}}if(_0x453ac2[_0xde41('0x10')]&&_0x453ac2[_0xde41('0x10')]['id']){try{var _0x19ef6a=getId(_0x453ac2[_0xde41('0x1c')],_0x453ac2['message']?_0x453ac2[_0xde41('0x10')]['id']:0x0,_0x453ac2[_0xde41('0x11')]?_0x453ac2['interaction']['id']:0x0);if(_0x423110['rules'][_0x19ef6a]){_0x423110['rules'][_0x19ef6a]['emit'](_0xde41('0x3f'));if(rpc[_0x453ac2[_0xde41('0x1c')]+'QueueReport']){rpc[_0x453ac2[_0xde41('0x1c')]+_0xde41('0x40')][_0xde41('0x41')](_0x19ef6a,{'UserId':_0x453ac2[_0xde41('0x10')][_0xde41('0x42')]})[_0xde41('0x43')](function(){logger[_0xde41('0x30')](_0xde41('0x44'));});}}return _0x4d03de({'code':0xc8,'message':_0x453ac2});}catch(_0x871581){logger[_0xde41('0x30')](_0x871581[_0xde41('0x39')]);return _0x50240c(_0xf4ec['error'](0x1f4,_0x871581));}}logger['error'](_0xde41('0x45'));return _0x50240c(_0xf4ec[_0xde41('0x30')](0x1f4,_0xde41('0x45')));});},'RejectMessage':function(_0x4addde){var _0x392fef=this;return new Promise(function(_0x1337e3,_0xe432a5){if(_0x4addde[_0xde41('0x3c')]&&_0x4addde[_0xde41('0x3c')]['id']){try{if(_0x423110[_0xde41('0x3b')][_0x4addde['agent']['id']]){_0x423110[_0xde41('0x3b')][_0x4addde[_0xde41('0x3c')]['id']]['busy']=![];_0x423110[_0xde41('0x3b')][_0x4addde[_0xde41('0x3c')]['id']][_0xde41('0x3e')]=undefined;}return _0x1337e3({'code':0xc8,'message':_0x4addde});}catch(_0x155ac9){logger[_0xde41('0x30')](_0x155ac9[_0xde41('0x39')]);return _0xe432a5(_0x392fef[_0xde41('0x30')](0x1f4,_0x155ac9));}}logger[_0xde41('0x30')](_0xde41('0x45'));return _0xe432a5(_0x392fef[_0xde41('0x30')](0x1f4,_0xde41('0x45')));});},'AbandonInteraction':function(_0x6608c8){var _0xe576d5=this;return new Promise(function(_0x5475c2,_0x351e74){if(_0x6608c8[_0xde41('0x1c')]&&_0x6608c8[_0xde41('0x11')]&&_0x6608c8['interaction']['id']){try{var _0x5118fb=getId(_0x6608c8[_0xde41('0x1c')],_0x6608c8[_0xde41('0x10')]?_0x6608c8['message']['id']:0x0,_0x6608c8['interaction']?_0x6608c8[_0xde41('0x11')]['id']:0x0);if(_0x423110[_0xde41('0x32')][_0x5118fb]){_0x423110[_0xde41('0x32')][_0x5118fb][_0xde41('0x36')]('end');}return _0x5475c2({'code':0xc8,'message':_0x6608c8});}catch(_0xa5013b){logger['error'](_0xa5013b[_0xde41('0x39')]);return _0x351e74(_0xe576d5[_0xde41('0x30')](0x1f4,_0xa5013b));}}logger['error'](_0xde41('0x45'));return _0x351e74(_0xe576d5[_0xde41('0x30')](0x1f4,_0xde41('0x45')));});},'AgentCapacity':function(_0x3d384b){var _0xeb3d73=this;return new Promise(function(_0x1e505d,_0x1fb884){if(_0x423110[_0xde41('0x3b')][_0xde41('0x46')](_0x3d384b['id'])){for(var _0x105e04 in _0x3d384b[_0xde41('0x47')]){if(_0x3d384b[_0xde41('0x47')][_0xde41('0x46')](_0x105e04)){if(_0x423110[_0xde41('0x3b')][_0x3d384b['id']][_0xde41('0x46')](_0x105e04+_0xde41('0x48'))){_0x423110['agents'][_0x3d384b['id']][_0x105e04+'CurrentCapacity']=parseInt(_0x3d384b['capacity'][_0x105e04],0xa);}}}_0x423110[_0xde41('0x3b')][_0x3d384b['id']][_0xde41('0x49')]();return _0x1e505d({'code':0xc8,'message':_0x423110[_0xde41('0x3b')][_0x3d384b['id']]});}else{return _0x1fb884(_0xeb3d73[_0xde41('0x30')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xac77cf){return new Promise(function(_0x2629e7){var _0x2815f3=_[_0xde41('0x4a')](_0x423110[_0xde41('0x3b')]);if(_0xac77cf&&_0xac77cf['id']){var _0x5d1c58=_[_0xde41('0x4b')](_0x2815f3,function(_0x14895f){return _0x14895f['id']===_0xac77cf['id'];});_0x2629e7(_0x5d1c58);}else{_0x2629e7({'count':_0x2815f3['length'],'rows':_0x2815f3});}});},'ChatQueues':function(){return new Promise(function(_0x2e882f){var _0x6ed3ab=[];for(var _0x4434f2 in _0x423110['chatQueues']){if(_0x423110['chatQueues']['hasOwnProperty'](_0x4434f2)){var _0x2450ec=_0x423110[_0xde41('0x4c')][_0x4434f2];var _0x16bbea={'id':_0x2450ec['id'],'available':_0x2450ec[_0xde41('0x4d')],'loggedIn':_0x2450ec[_0xde41('0x4e')],'name':_0x2450ec[_0xde41('0x4f')],'paused':_0x2450ec['paused'],'waiting':_0x2450ec['waiting']};_0x6ed3ab['push'](_0x16bbea);}}_0x2e882f({'count':_0x6ed3ab[_0xde41('0x15')],'rows':_0x6ed3ab});});},'MailQueues':function(){return new Promise(function(_0xfd6f7d){var _0x1c44eb=[];for(var _0x4d6cf5 in _0x423110[_0xde41('0x50')]){if(_0x423110[_0xde41('0x50')][_0xde41('0x46')](_0x4d6cf5)){var _0x24d787=_0x423110[_0xde41('0x50')][_0x4d6cf5];var _0x145cc9={'id':_0x24d787['id'],'available':_0x24d787[_0xde41('0x4d')],'loggedIn':_0x24d787['loggedIn'],'name':_0x24d787[_0xde41('0x4f')],'paused':_0x24d787[_0xde41('0x51')],'waiting':_0x24d787['waiting']};_0x1c44eb[_0xde41('0x1e')](_0x145cc9);}}_0xfd6f7d({'count':_0x1c44eb[_0xde41('0x15')],'rows':_0x1c44eb});});},'OpenchannelQueues':function(){return new Promise(function(_0x55e773){var _0x242474=[];for(var _0x1a3802 in _0x423110[_0xde41('0x52')]){if(_0x423110[_0xde41('0x52')][_0xde41('0x46')](_0x1a3802)){var _0x319e1b=_0x423110['openchannelQueues'][_0x1a3802];var _0x59d2a2={'id':_0x319e1b['id'],'available':_0x319e1b[_0xde41('0x4d')],'loggedIn':_0x319e1b['loggedIn'],'name':_0x319e1b[_0xde41('0x4f')],'paused':_0x319e1b[_0xde41('0x51')],'waiting':_0x319e1b['waiting']};_0x242474[_0xde41('0x1e')](_0x59d2a2);}}_0x55e773({'count':_0x242474[_0xde41('0x15')],'rows':_0x242474});});},'SmsQueues':function(){return new Promise(function(_0x55f097){var _0x4d9d2b=[];for(var _0x5d79c7 in _0x423110['smsQueues']){if(_0x423110['smsQueues']['hasOwnProperty'](_0x5d79c7)){var _0x4d9932=_0x423110[_0xde41('0x53')][_0x5d79c7];var _0x56bf94={'id':_0x4d9932['id'],'available':_0x4d9932[_0xde41('0x4d')],'loggedIn':_0x4d9932[_0xde41('0x4e')],'name':_0x4d9932[_0xde41('0x4f')],'paused':_0x4d9932[_0xde41('0x51')],'waiting':_0x4d9932['waiting']};_0x4d9d2b[_0xde41('0x1e')](_0x56bf94);}}_0x55f097({'count':_0x4d9d2b[_0xde41('0x15')],'rows':_0x4d9d2b});});},'FaxQueues':function(){return new Promise(function(_0x3eba03){var _0x232e3b=[];for(var _0x5630da in _0x423110[_0xde41('0x54')]){if(_0x423110[_0xde41('0x54')][_0xde41('0x46')](_0x5630da)){var _0x3cda0b=_0x423110['faxQueues'][_0x5630da];var _0x202b85={'id':_0x3cda0b['id'],'available':_0x3cda0b[_0xde41('0x4d')],'loggedIn':_0x3cda0b[_0xde41('0x4e')],'name':_0x3cda0b[_0xde41('0x4f')],'paused':_0x3cda0b[_0xde41('0x51')],'waiting':_0x3cda0b[_0xde41('0x55')]};_0x232e3b[_0xde41('0x1e')](_0x202b85);}}_0x3eba03({'count':_0x232e3b['length'],'rows':_0x232e3b});});},'WhatsappQueues':function(){return new Promise(function(_0x1276b2){var _0x215330=[];for(var _0x4dd482 in _0x423110[_0xde41('0x56')]){if(_0x423110[_0xde41('0x56')][_0xde41('0x46')](_0x4dd482)){var _0x4915a8=_0x423110[_0xde41('0x56')][_0x4dd482];var _0x51ebb8={'id':_0x4915a8['id'],'available':_0x4915a8[_0xde41('0x4d')],'loggedIn':_0x4915a8[_0xde41('0x4e')],'name':_0x4915a8['name'],'paused':_0x4915a8[_0xde41('0x51')],'waiting':_0x4915a8[_0xde41('0x55')]};_0x215330['push'](_0x51ebb8);}}_0x1276b2({'count':_0x215330['length'],'rows':_0x215330});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x35482b){var _0x45a354=_[_0xde41('0x4a')](_0x423110[_0xde41('0x57')]);_0x35482b({'count':_0x45a354['length'],'rows':_0x45a354});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1d1913){var _0x7a8db4=_[_0xde41('0x4a')](_0x423110[_0xde41('0x58')]);_0x1d1913({'count':_0x7a8db4['length'],'rows':_0x7a8db4});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3e859c){var _0x52a9cf=_[_0xde41('0x4a')](_0x423110['openchannelQueuesWaitingInteractions']);_0x3e859c({'count':_0x52a9cf[_0xde41('0x15')],'rows':_0x52a9cf});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2f1a61){var _0x4a91de=_['values'](_0x423110[_0xde41('0x59')]);_0x2f1a61({'count':_0x4a91de[_0xde41('0x15')],'rows':_0x4a91de});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x292966){var _0x253eb2=_['values'](_0x423110[_0xde41('0x5a')]);_0x292966({'count':_0x253eb2[_0xde41('0x15')],'rows':_0x253eb2});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2464c3){var _0x28533d=_[_0xde41('0x4a')](_0x423110[_0xde41('0x5b')]);_0x2464c3({'count':_0x28533d[_0xde41('0x15')],'rows':_0x28533d});});}};var _0x21d17c=jayson['server'](_0x6e6966)[_0xde41('0x5c')]();_0x21d17c['on'](_0xde41('0x30'),function(_0xc860ba){logger[_0xde41('0x30')](JSON['stringify'](_0xc860ba));return _0x27cf08(_0xc860ba);});_0x21d17c['listen'](0x232c,_0xde41('0x5d'),function(){console['log'](_0xde41('0x5e'),0x232c);return _0x3739a8('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 097bf98..0ee2844 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 _0xb9aa=['error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','Command','format','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','log','stack','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then'];(function(_0x180b6e,_0x3b7ec6){var _0x44c312=function(_0x2a3a1f){while(--_0x2a3a1f){_0x180b6e['push'](_0x180b6e['shift']());}};_0x44c312(++_0x3b7ec6);}(_0xb9aa,0x6c));var _0xab9a=function(_0x19146b,_0x5d29ec){_0x19146b=_0x19146b-0x0;var _0x216fdd=_0xb9aa[_0x19146b];return _0x216fdd;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xab9a('0x0'));var _=require(_0xab9a('0x1'));var logger=require(_0xab9a('0x2'))(_0xab9a('0x3'));var client=jayson[_0xab9a('0x4')][_0xab9a('0x5')]({'port':0x232a});function request(_0x54a1b0,_0x3f4a96){return new BPromise(function(_0x611dd6,_0x42954f){return client[_0xab9a('0x6')](_0x54a1b0,_0x3f4a96)[_0xab9a('0x7')](function(_0x1ad23b){if(_0x1ad23b[_0xab9a('0x8')]){return _0x42954f(_0x1ad23b['error'][_0xab9a('0x9')]);}else{return _0x611dd6(_0x1ad23b[_0xab9a('0xa')]);}})['catch'](function(_0x555dee){return _0x42954f(_0x555dee);});});}exports[_0xab9a('0xb')]=function(_0x1e7f59,_0x3a01bd,_0x1abf40){return function(_0x5129d9){if(_0x1abf40[_0xab9a('0xc')]&&!_0x1abf40['rules'][_0x1e7f59]){logger[_0xab9a('0xd')](_0xab9a('0xe'),_0x1e7f59);return _0x5129d9[_0xab9a('0xf')]();}var _0x3b5664=[];for(var _0x3ddca0=0x0;_0x3ddca0<_0x3a01bd['length'];_0x3ddca0+=0x1){_0x3b5664['push'](request(_0xab9a('0x10'),{'command':util[_0xab9a('0x11')]('iftime\x20%s',_0x3a01bd[_0x3ddca0])})[_0xab9a('0x7')](function(_0x3b97fa){return _0x3b97fa&&_0x3b97fa['message']&&_0x3b97fa[_0xab9a('0x9')][_0xab9a('0x12')](_0xab9a('0x13'))>=0x0?!![]:![];})[_0xab9a('0x14')](function(_0x8ccbe0){logger[_0xab9a('0x8')](_0xab9a('0x15'),_0x1e7f59,_0x3a01bd[_0x3ddca0]);}));}BPromise[_0xab9a('0x16')](_0x3b5664)[_0xab9a('0x7')](function(_0x46e46a){var _0x5b18a9=_[_0xab9a('0x17')](_0x46e46a);logger[_0xab9a('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x1e7f59,_0x3a01bd[_0xab9a('0x18')](_0xab9a('0x19')),_0x5b18a9);_0x5129d9[_0xab9a('0x1a')](_0x5b18a9);})[_0xab9a('0x14')](function(_0x18c70f){console[_0xab9a('0x1b')](_0x18c70f);logger[_0xab9a('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x1e7f59,_0x3a01bd[_0xab9a('0x18')](_0xab9a('0x19')),_0x18c70f[_0xab9a('0x1c')]);_0x5129d9[_0xab9a('0xf')]();});};}; \ No newline at end of file +var _0x7299=['routing','client','then','error','message','catch','condition','rules','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','util','lodash','../../../config/logger'];(function(_0x55dcad,_0x56bd4d){var _0x1fff1b=function(_0x21e310){while(--_0x21e310){_0x55dcad['push'](_0x55dcad['shift']());}};_0x1fff1b(++_0x56bd4d);}(_0x7299,0x89));var _0x9729=function(_0x3f7929,_0x5db3e1){_0x3f7929=_0x3f7929-0x0;var _0x4df0e5=_0x7299[_0x3f7929];return _0x4df0e5;};'use strict';var util=require(_0x9729('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x9729('0x1'));var logger=require(_0x9729('0x2'))(_0x9729('0x3'));var client=jayson[_0x9729('0x4')]['http']({'port':0x232a});function request(_0x56ef50,_0x4c77e8){return new BPromise(function(_0x5d07f7,_0x33acee){return client['request'](_0x56ef50,_0x4c77e8)[_0x9729('0x5')](function(_0x1f797e){if(_0x1f797e[_0x9729('0x6')]){return _0x33acee(_0x1f797e[_0x9729('0x6')][_0x9729('0x7')]);}else{return _0x5d07f7(_0x1f797e['result']);}})[_0x9729('0x8')](function(_0x559c1d){return _0x33acee(_0x559c1d);});});}exports[_0x9729('0x9')]=function(_0x56d1be,_0x5ab123,_0x27dcd6){return function(_0x18100e){if(_0x27dcd6[_0x9729('0xa')]&&!_0x27dcd6[_0x9729('0xa')][_0x56d1be]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x56d1be);return _0x18100e[_0x9729('0xb')]();}var _0x297ce5=[];for(var _0x2ab4d6=0x0;_0x2ab4d6<_0x5ab123[_0x9729('0xc')];_0x2ab4d6+=0x1){_0x297ce5[_0x9729('0xd')](request(_0x9729('0xe'),{'command':util[_0x9729('0xf')](_0x9729('0x10'),_0x5ab123[_0x2ab4d6])})[_0x9729('0x5')](function(_0x92125b){return _0x92125b&&_0x92125b[_0x9729('0x7')]&&_0x92125b[_0x9729('0x7')][_0x9729('0x11')](_0x9729('0x12'))>=0x0?!![]:![];})['catch'](function(_0x4b014f){logger[_0x9729('0x6')](_0x9729('0x13'),_0x56d1be,_0x5ab123[_0x2ab4d6]);}));}BPromise[_0x9729('0x14')](_0x297ce5)[_0x9729('0x5')](function(_0x51a216){var _0x5e9711=_[_0x9729('0x15')](_0x51a216);logger[_0x9729('0x16')](_0x9729('0x17'),_0x56d1be,_0x5ab123[_0x9729('0x18')]('\x20|\x20'),_0x5e9711);_0x18100e[_0x9729('0x19')](_0x5e9711);})[_0x9729('0x8')](function(_0x11cd52){console[_0x9729('0x1a')](_0x11cd52);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x56d1be,_0x5ab123[_0x9729('0x18')](_0x9729('0x1b')),_0x11cd52['stack']);_0x18100e['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 04de62f..66c3078 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 _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(_0x101885,_0x372afa){_0x101885=_0x101885-0x0;var _0x3c6a33=_0x0972[_0x101885];return _0x3c6a33;};'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 +var _0xb688=['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','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','util','./utils','info','format','uniqueid','channel','queue','membername','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','holdtime','ringtime','push','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','reason','talktime','[%s][agents][queuecallerabandon]'];(function(_0x11af50,_0x2b783c){var _0x13e5ff=function(_0x4f4fb6){while(--_0x4f4fb6){_0x11af50['push'](_0x11af50['shift']());}};_0x13e5ff(++_0x2b783c);}(_0xb688,0xcf));var _0x8b68=function(_0x123de4,_0x27fd8e){_0x123de4=_0x123de4-0x0;var _0x98dc87=_0xb688[_0x123de4];return _0x98dc87;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var utils=require(_0x8b68('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x266285,_0x1080e8){utils[_0x8b68('0x2')](util[_0x8b68('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x266285[_0x8b68('0x4')],_0x266285[_0x8b68('0x5')],_0x266285[_0x8b68('0x6')],_0x266285[_0x8b68('0x7')],_0x266285['interface'],_0x266285[_0x8b68('0x8')],_0x266285['connectedlinenum'],_0x266285[_0x8b68('0x9')]));if(_0x266285[_0x8b68('0x6')]){utils[_0x8b68('0xa')](_0x266285[_0x8b68('0x6')])[_0x8b68('0xb')](function(_0x3f9685){if(_0x3f9685){_0x266285[_0x8b68('0xc')]=_0x3f9685[_0x8b68('0xc')];_0x266285[_0x8b68('0xd')]=_0x266285[_0x8b68('0xe')]?_0x3f9685[_0x8b68('0xf')]:![];_0x266285[_0x8b68('0x10')]=_0x266285[_0x8b68('0xd')]?_0x3f9685['acwTimeout']:0x0;}utils[_0x8b68('0x11')](_0x8b68('0x12'),_0x266285);});}else{utils[_0x8b68('0x11')](_0x8b68('0x12'),_0x266285);}if(_0x1080e8){delete transfers[_0x266285[_0x8b68('0x4')]];}else{delete agents[_0x266285[_0x8b68('0x13')]];}}exports[_0x8b68('0x14')]=function(_0x137c8e){try{utils[_0x8b68('0x15')](util['format'](_0x8b68('0x16'),_0x137c8e['uniqueid']),_0x137c8e);agents[_0x137c8e['destuniqueid']]=_0x137c8e;agents[_0x137c8e[_0x8b68('0x13')]][_0x8b68('0x17')]=utils[_0x8b68('0x18')]();agents[_0x137c8e['destuniqueid']]['lastevent']=_0x8b68('0x19');agents[_0x137c8e['destuniqueid']][_0x8b68('0x1a')]=null;agents[_0x137c8e[_0x8b68('0x13')]][_0x8b68('0x1b')]=null;utils[_0x8b68('0x2')](util['format'](_0x8b68('0x1c'),_0x137c8e[_0x8b68('0x4')],agents[_0x137c8e['destuniqueid']][_0x8b68('0x7')],_0x137c8e[_0x8b68('0x13')]));}catch(_0x3cf3bd){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')]('[%s][agents][agentcalled]',_0x137c8e[_0x8b68('0x4')]),_0x3cf3bd);}};exports[_0x8b68('0x1e')]=function(_0x59e9b1){try{if(!_[_0x8b68('0x1f')](agents[_0x59e9b1[_0x8b68('0x13')]])){utils[_0x8b68('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x59e9b1[_0x8b68('0x4')]),_0x59e9b1);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x20'),_0x59e9b1[_0x8b68('0x4')],agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x7')],_0x59e9b1[_0x8b68('0x13')]));agents[_0x59e9b1['destuniqueid']][_0x8b68('0x1e')]=!![];agents[_0x59e9b1[_0x8b68('0x13')]]['agentringnoanswerAt']=utils[_0x8b68('0x18')]();agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x9')]='timeout';agents[_0x59e9b1['destuniqueid']]['reason']=_0x8b68('0x21');agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x22')]=_0x59e9b1['ringtime']?parseInt(_0x59e9b1[_0x8b68('0x23')])/0x3e8:0x0;agents[_0x59e9b1['destuniqueid']]['talktime']=0x0;unanswered[_0x8b68('0x24')](_0x59e9b1['destuniqueid']);}}catch(_0x26cad7){utils[_0x8b68('0x1d')](util['format']('[%s][agents][agentringnoanswer]',_0x59e9b1[_0x8b68('0x4')]),_0x26cad7);}};exports[_0x8b68('0x25')]=function(_0x1e7c06){try{_[_0x8b68('0x26')](agents,function(_0x210926,_0x2ad2df){if(_0x210926[_0x8b68('0x4')]==_0x1e7c06['uniqueid']&&!_[_0x8b68('0x27')](unanswered,_0x210926['destuniqueid'])){utils[_0x8b68('0x15')](util[_0x8b68('0x3')]('[%s][agents][queuecallerabandon]',_0x1e7c06[_0x8b68('0x4')]),_0x1e7c06);utils[_0x8b68('0x2')](util[_0x8b68('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1e7c06['uniqueid'],_0x210926[_0x8b68('0x7')],_0x210926[_0x8b68('0x13')]));_0x210926[_0x8b68('0x1e')]=!![];_0x210926[_0x8b68('0x28')]=utils[_0x8b68('0x18')]();_0x210926[_0x8b68('0x9')]=_0x8b68('0x29');_0x210926[_0x8b68('0x2a')]=_0x8b68('0x29');_0x210926[_0x8b68('0x22')]=_0x1e7c06[_0x8b68('0x22')];_0x210926[_0x8b68('0x2b')]=0x0;writeDB(_0x210926);}});}catch(_0x232fa9){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')](_0x8b68('0x2c'),_0x1e7c06[_0x8b68('0x4')]),_0x232fa9);}};exports[_0x8b68('0x2d')]=function(_0x120b34){try{if(agents[_0x120b34[_0x8b68('0x13')]]){utils[_0x8b68('0x15')](util[_0x8b68('0x3')]('[%s][agents][agentconnect]',_0x120b34['uniqueid']),_0x120b34);utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x2e'),_0x120b34[_0x8b68('0x4')],agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x7')],_0x120b34[_0x8b68('0x13')]));agents[_0x120b34[_0x8b68('0x13')]]['agentconnectAt']=utils[_0x8b68('0x18')]();agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x1a')]=_0x120b34[_0x8b68('0x1a')];agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x1b')]=_0x120b34[_0x8b68('0x1b')];agents[_0x120b34[_0x8b68('0x13')]]['holdtime']=_0x120b34[_0x8b68('0x23')];agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x9')]=_0x8b68('0x2f');_[_0x8b68('0x26')](agents,function(_0x3b3394,_0xa748c2){if(_0x3b3394['destuniqueid']!=_0x120b34[_0x8b68('0x13')]&&_0x3b3394[_0x8b68('0x4')]==_0x120b34['uniqueid']){_0x3b3394[_0x8b68('0x2b')]=0x0;_0x3b3394[_0x8b68('0x22')]=_0x120b34['ringtime'];_0x3b3394['agentringnoanswer']=!![];_0x3b3394['agentringnoanswerAt']=utils['now']();_0x3b3394[_0x8b68('0x9')]=_0x8b68('0x30');_0x3b3394['reason']=_0x8b68('0x30');_0x3b3394['answeredelsewheredestinationuniqueid']=_0x120b34[_0x8b68('0x13')];_0x3b3394[_0x8b68('0x31')]=_0x120b34['membername'];writeDB(_0x3b3394);}});}}catch(_0x2f90d9){utils['error'](util['format']('[%s][agents][agentconnect]',_0x120b34[_0x8b68('0x4')]),_0x2f90d9);}};exports[_0x8b68('0xe')]=function(_0x3ba80e){try{if(!_[_0x8b68('0x1f')](agents[_0x3ba80e['destuniqueid']])){utils[_0x8b68('0x15')](util['format'](_0x8b68('0x32'),_0x3ba80e[_0x8b68('0x4')]),_0x3ba80e);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x33'),_0x3ba80e[_0x8b68('0x4')],agents[_0x3ba80e[_0x8b68('0x13')]]['membername'],_0x3ba80e[_0x8b68('0x13')]));agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0xe')]=!![];agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x34')],agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x36')]);agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x2a')]=_0x3ba80e[_0x8b68('0x2a')];agents[_0x3ba80e['destuniqueid']][_0x8b68('0x9')]=_0x8b68('0x37');writeDB(agents[_0x3ba80e['destuniqueid']]);}}catch(_0xeab810){utils['error'](util['format']('[%s][agents][agentcomplete]',_0x3ba80e[_0x8b68('0x4')]),_0xeab810);}};exports[_0x8b68('0x38')]=function(_0x34047c){try{if(!_[_0x8b68('0x1f')](agents[_0x34047c['transfereruniqueid']])){utils['debug'](util[_0x8b68('0x3')](_0x8b68('0x39'),_0x34047c[_0x8b68('0x4')]),_0x34047c);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x3a'),_0x34047c['uniqueid'],agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x7')],agents[_0x34047c['transfereruniqueid']][_0x8b68('0x4')]));agents[_0x34047c[_0x8b68('0x3b')]]['transfer']=!![];agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x3c')]='blind';agents[_0x34047c['transfereruniqueid']]['transferexten']=_0x34047c[_0x8b68('0x3d')];agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x3e')]=agents[_0x34047c[_0x8b68('0x3b')]]['uniqueid'];}}catch(_0x5a1711){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')](_0x8b68('0x39'),_0x34047c['uniqueid']),_0x5a1711);}};exports[_0x8b68('0x3f')]=function(_0xe1ba20){try{utils[_0x8b68('0x15')](util['format'](_0x8b68('0x40'),_0xe1ba20['origtransfereruniqueid']),_0xe1ba20);if(_0xe1ba20[_0x8b68('0x41')]==_0xe1ba20[_0x8b68('0x42')]){if(!_['isNil'](agents[_0xe1ba20[_0x8b68('0x43')]])){utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x44'),_0xe1ba20[_0x8b68('0x41')],agents[_0xe1ba20['secondtransfereruniqueid']][_0x8b68('0x7')]));agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x45')]=!![];agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x3c')]=_0x8b68('0x46');agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x47')]=_0xe1ba20['origtransfererexten'];agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x3e')]=_0xe1ba20[_0x8b68('0x41')];}if(_0xe1ba20[_0x8b68('0x48')]&&agents[_0xe1ba20[_0x8b68('0x48')]]){agents[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x49')]=0x1;transfers[_0xe1ba20[_0x8b68('0x48')]]=_[_0x8b68('0x4a')](agents[_0xe1ba20[_0x8b68('0x48')]]);transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x8')]=agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x8')];transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x4b')]=agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x4b')];transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x17')]=utils['now']();transfers[_0xe1ba20[_0x8b68('0x48')]]['agentconnectAt']=utils['now']();transfers[_0xe1ba20[_0x8b68('0x48')]]['holdtime']=0x0;transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x49')]=0x2;}}else if(_0xe1ba20[_0x8b68('0x43')]==_0xe1ba20['secondtransfererlinkedid']){if(!_[_0x8b68('0x1f')](agents[_0xe1ba20[_0x8b68('0x41')]])){utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x44'),_0xe1ba20[_0x8b68('0x41')],agents[_0xe1ba20[_0x8b68('0x41')]]['membername']));agents[_0xe1ba20['origtransfereruniqueid']][_0x8b68('0x45')]=!![];agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x3c')]=_0x8b68('0x46');agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x47')]=_0xe1ba20[_0x8b68('0x4c')];agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x3e')]=_0xe1ba20[_0x8b68('0x43')];}if(_0xe1ba20[_0x8b68('0x4d')]&&agents[_0xe1ba20[_0x8b68('0x4d')]]){agents[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x49')]=0x1;transfers[_0xe1ba20[_0x8b68('0x4d')]]=_[_0x8b68('0x4a')](agents[_0xe1ba20[_0x8b68('0x4d')]]);transfers[_0xe1ba20[_0x8b68('0x4d')]]['calleridnum']=agents[_0xe1ba20['origtransfereruniqueid']][_0x8b68('0x8')];transfers[_0xe1ba20[_0x8b68('0x4d')]]['calleridname']=agents[_0xe1ba20['origtransfereruniqueid']]['calleridname'];transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x17')]=utils[_0x8b68('0x18')]();transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x36')]=utils['now']();transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x22')]=0x0;transfers[_0xe1ba20['transfertargetuniqueid']][_0x8b68('0x49')]=0x2;}}}catch(_0x5aa883){utils['error'](util['format'](_0x8b68('0x40'),_0xe1ba20[_0x8b68('0x41')]),_0x5aa883);}};exports[_0x8b68('0x4e')]=function(_0x7269fd){try{utils[_0x8b68('0x15')](util[_0x8b68('0x3')](_0x8b68('0x4f'),_0x7269fd[_0x8b68('0x4')]),_0x7269fd);if(agents[_0x7269fd[_0x8b68('0x4')]]&&agents[_0x7269fd[_0x8b68('0x4')]]['reason']===_0x8b68('0x21')){if(_0x7269fd[_0x8b68('0x50')]==='21'){agents[_0x7269fd[_0x8b68('0x4')]]['reason']='rejected';agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]='rejected';}utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x51'),_0x7269fd[_0x8b68('0x4')],agents[_0x7269fd['uniqueid']][_0x8b68('0x7')],agents[_0x7269fd['uniqueid']]['reason'],agents[_0x7269fd[_0x8b68('0x4')]]['lastevent']));writeDB(agents[_0x7269fd[_0x8b68('0x4')]]);var _0x385eda=unanswered['indexOf'](_0x7269fd[_0x8b68('0x4')]);if(_0x385eda>-0x1){unanswered[_0x8b68('0x52')](_0x385eda,0x1);}}if(transfers[_0x7269fd[_0x8b68('0x4')]]){transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0xe')]=!![];transfers[_0x7269fd['uniqueid']][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](transfers[_0x7269fd['uniqueid']]['agentcompleteAt'],transfers[_0x7269fd[_0x8b68('0x4')]]['agentconnectAt']);transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')]=_0x8b68('0x53');transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]=_0x8b68('0x37');utils[_0x8b68('0x2')](util['format'](_0x8b68('0x51'),_0x7269fd['uniqueid'],transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x7')],transfers[_0x7269fd[_0x8b68('0x4')]]['reason'],transfers[_0x7269fd[_0x8b68('0x4')]]['lastevent']));writeDB(transfers[_0x7269fd[_0x8b68('0x4')]],!![]);}if(agents[_0x7269fd['uniqueid']]&&agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x36')]){agents[_0x7269fd[_0x8b68('0x4')]]['agentcomplete']=!![];agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x34')],agents[_0x7269fd[_0x8b68('0x4')]]['agentconnectAt']);agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')]=agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x45')]?_0x8b68('0x45'):'agent';agents[_0x7269fd[_0x8b68('0x4')]]['lastevent']=_0x8b68('0x37');utils[_0x8b68('0x2')](util['format'](_0x8b68('0x51'),_0x7269fd[_0x8b68('0x4')],agents[_0x7269fd[_0x8b68('0x4')]]['membername'],agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')],agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]));writeDB(agents[_0x7269fd[_0x8b68('0x4')]]);}}catch(_0x42464c){utils['error'](util[_0x8b68('0x3')](_0x8b68('0x4f'),_0x7269fd[_0x8b68('0x4')]),_0x42464c);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3264da7..d97940c 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 _0x5699=['lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','calleridnum','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','destinationchannel','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','endtime','billableseconds','answertime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','noop','execif','set','gotoif'];(function(_0x5a4688,_0x3a7f6d){var _0x5dd72e=function(_0x54005f){while(--_0x54005f){_0x5a4688['push'](_0x5a4688['shift']());}};_0x5dd72e(++_0x3a7f6d);}(_0x5699,0x148));var _0x9569=function(_0x32ee80,_0x129b13){_0x32ee80=_0x32ee80-0x0;var _0x14a769=_0x5699[_0x32ee80];return _0x14a769;};'use strict';var _=require(_0x9569('0x0'));var util=require(_0x9569('0x1'));var utils=require(_0x9569('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0x9569('0x3'),_0x9569('0x4'),_0x9569('0x4'),'NO\x20ANSWER','NO\x20ANSWER',_0x9569('0x3'),_0x9569('0x5'),'BUSY',_0x9569('0x4'),_0x9569('0x4'),_0x9569('0x4')];var channels={};function writeDB(_0x3453de){var _0x386b89;if(transfers[_0x9569('0x6')][_0x3453de[_0x9569('0x7')]]){_0x386b89=_0x3453de['uniqueid'];_0x3453de[_0x9569('0x7')]=transfers[_0x9569('0x6')][_0x3453de[_0x9569('0x7')]][_0x9569('0x8')];}utils[_0x9569('0x9')](util[_0x9569('0xa')](_0x9569('0xb'),_0x3453de['uniqueid'],_0x3453de[_0x9569('0xc')],_0x3453de[_0x9569('0xd')],_0x3453de[_0x9569('0xe')],_0x3453de[_0x9569('0xf')],_0x3453de['calleridnum'],_0x3453de[_0x9569('0x10')],_0x3453de[_0x9569('0x11')]));if(_0x3453de['accountcode']){utils['getUserByInternal'](_0x3453de[_0x9569('0x12')])['then'](function(_0x3028bc){if(_0x3028bc){_0x3453de[_0x9569('0x13')]=_0x3028bc['id'];}utils[_0x9569('0x14')](_0x9569('0x15'),_0x3453de);});}else{utils['request'](_0x9569('0x15'),_0x3453de);}if(channels[_0x3453de['uniqueid']]){delete channels[_0x3453de['uniqueid']];}else if(_0x386b89&&channels[_0x386b89]){if(!transfers[_0x9569('0x6')][_0x386b89][_0x9569('0x16')])delete transfers['blinds'][_0x386b89];delete channels[_0x386b89];}}exports[_0x9569('0x17')]=function(_0x4a266e){try{utils[_0x9569('0x18')](util[_0x9569('0xa')](_0x9569('0x19'),_0x4a266e['uniqueid']),_0x4a266e);if(_0x4a266e[_0x9569('0x7')]==_0x4a266e[_0x9569('0x1a')]&&_0x4a266e[_0x9569('0xc')]!=_0x9569('0x1b')){utils[_0x9569('0x9')](util[_0x9569('0xa')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x4a266e['uniqueid'],_0x4a266e[_0x9569('0x1c')],_0x4a266e[_0x9569('0x1d')]));channels[_0x4a266e['uniqueid']]={'uniqueid':_0x4a266e['uniqueid'],'accountcode':_0x4a266e[_0x9569('0x12')],'source':_0x4a266e[_0x9569('0x1e')],'destination':_0x4a266e[_0x9569('0x1d')],'destinationcontext':_0x4a266e['context'],'channel':_0x4a266e['channel'],'starttime':utils[_0x9569('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x9569('0x20')};}}catch(_0x58e34b){utils[_0x9569('0x21')](util[_0x9569('0xa')](_0x9569('0x19'),_0x4a266e['uniqueid']),_0x58e34b);}};exports['newstate']=function(_0x3b1619){try{utils[_0x9569('0x18')](util['format'](_0x9569('0x22'),_0x3b1619['uniqueid']),_0x3b1619);if(!_[_0x9569('0x23')](channels[_0x3b1619[_0x9569('0x7')]])&&_0x3b1619[_0x9569('0x24')]==0x6){utils[_0x9569('0x9')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3b1619[_0x9569('0x7')],_0x3b1619[_0x9569('0x1c')],_0x3b1619[_0x9569('0xc')]));if(_[_0x9569('0x23')](channels[_0x3b1619['uniqueid']][_0x9569('0x25')])){channels[_0x3b1619['uniqueid']][_0x9569('0x25')]=utils[_0x9569('0x1f')]();}}else if(!_[_0x9569('0x23')](channels[_0x3b1619[_0x9569('0x1a')]])&&_0x3b1619[_0x9569('0x24')]==0x6&&_0x3b1619[_0x9569('0x1c')]!=_0x9569('0x26')){utils[_0x9569('0x9')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3b1619[_0x9569('0x7')],_0x3b1619[_0x9569('0x1a')],_0x3b1619['context'],_0x3b1619[_0x9569('0xc')]));channels[_0x3b1619['linkedid']]['accountcode']=_0x3b1619['accountcode'];channels[_0x3b1619[_0x9569('0x1a')]][_0x9569('0x27')]=_0x3b1619['channel'];if(_[_0x9569('0x23')](channels[_0x3b1619[_0x9569('0x1a')]]['answertime'])){channels[_0x3b1619[_0x9569('0x1a')]]['answertime']=utils[_0x9569('0x1f')]();}channels[_0x3b1619['linkedid']][_0x9569('0x28')]=dispositions[_['toNumber'](_0x3b1619[_0x9569('0x24')])]||_0x9569('0x5');}}catch(_0x46132a){utils[_0x9569('0x21')](util['format'](_0x9569('0x22'),_0x3b1619[_0x9569('0x7')]),_0x46132a);}};exports[_0x9569('0x29')]=function(_0x3c00bc){try{if(!_[_0x9569('0x23')](channels[_0x3c00bc[_0x9569('0x7')]])){utils[_0x9569('0x18')](util[_0x9569('0xa')](_0x9569('0x2a'),_0x3c00bc[_0x9569('0x7')]),_0x3c00bc);if(_[_0x9569('0x23')](channels[_0x3c00bc[_0x9569('0x7')]][_0x9569('0x2b')])){channels[_0x3c00bc[_0x9569('0x7')]][_0x9569('0x2b')]=_0x3c00bc[_0x9569('0x2c')]+'\x20<'+_0x3c00bc[_0x9569('0x1e')]+'>';}utils[_0x9569('0x9')](util['format'](_0x9569('0x2d'),_0x3c00bc['uniqueid'],channels[_0x3c00bc['uniqueid']][_0x9569('0x2b')],_0x3c00bc['cause-txt']));channels[_0x3c00bc[_0x9569('0x7')]]['endtime']=utils['now']();channels[_0x3c00bc['uniqueid']][_0x9569('0x2e')]=utils[_0x9569('0x2f')](channels[_0x3c00bc['uniqueid']][_0x9569('0x30')],channels[_0x3c00bc[_0x9569('0x7')]]['starttime']);channels[_0x3c00bc[_0x9569('0x7')]][_0x9569('0x31')]=channels[_0x3c00bc[_0x9569('0x7')]]['answertime']?utils[_0x9569('0x2f')](channels[_0x3c00bc['uniqueid']][_0x9569('0x30')],channels[_0x3c00bc[_0x9569('0x7')]][_0x9569('0x32')]):0x0;writeDB(channels[_0x3c00bc[_0x9569('0x7')]]);}}catch(_0x1014d3){utils['error'](util[_0x9569('0xa')]('[%s][calls][hangup]',_0x3c00bc['uniqueid']),_0x1014d3);}};exports[_0x9569('0x33')]=function(_0x4ec4a2){try{if(!_[_0x9569('0x23')](channels[_0x4ec4a2[_0x9569('0x34')]])){utils['debug'](util[_0x9569('0xa')](_0x9569('0x35'),_0x4ec4a2[_0x9569('0x36')]),_0x4ec4a2);if(channels[_0x4ec4a2[_0x9569('0x34')]]['channel']==_0x4ec4a2[_0x9569('0x37')]){utils['info'](util[_0x9569('0xa')](_0x9569('0x38'),_0x4ec4a2[_0x9569('0x36')],_0x4ec4a2[_0x9569('0x34')],_0x4ec4a2[_0x9569('0x39')]));channels[_0x4ec4a2['localtwolinkedid']]['destinationchannel']=_0x4ec4a2['secondtransfererchannel'];channels[_0x4ec4a2[_0x9569('0x34')]][_0x9569('0x3a')]=_0x9569('0x3b');}else if(channels[_0x4ec4a2[_0x9569('0x34')]][_0x9569('0xc')]=_0x4ec4a2[_0x9569('0x3c')]){utils['info'](util[_0x9569('0xa')](_0x9569('0x38'),_0x4ec4a2[_0x9569('0x36')],_0x4ec4a2[_0x9569('0x34')],_0x4ec4a2[_0x9569('0x3d')]));channels[_0x4ec4a2['localtwolinkedid']][_0x9569('0x27')]=_0x4ec4a2[_0x9569('0x3d')];channels[_0x4ec4a2[_0x9569('0x34')]][_0x9569('0x3a')]=_0x9569('0x3b');}}}catch(_0x4c3368){utils[_0x9569('0x21')](util[_0x9569('0xa')](_0x9569('0x35'),_0x4ec4a2[_0x9569('0x36')]),_0x4c3368);}};exports[_0x9569('0x3e')]=function(_0x56193e){try{if(!_[_0x9569('0x23')](channels[_0x56193e[_0x9569('0x7')]])){utils['debug'](util[_0x9569('0xa')](_0x9569('0x3f'),_0x56193e[_0x9569('0x7')]),_0x56193e);channels[_0x56193e['uniqueid']][_0x9569('0x40')]=utils[_0x9569('0x1f')]();utils[_0x9569('0x9')](util[_0x9569('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x56193e[_0x9569('0x7')],channels[_0x56193e[_0x9569('0x7')]]['musiconholdstartAt']));}}catch(_0x26e0aa){utils['error'](util['format'](_0x9569('0x3f'),_0x56193e['uniqueid']),_0x26e0aa);}};exports[_0x9569('0x41')]=function(_0x5eba4a){try{if(!_[_0x9569('0x23')](channels[_0x5eba4a[_0x9569('0x7')]])){utils[_0x9569('0x18')](util[_0x9569('0xa')]('[%s][calls][musiconholdstop]',_0x5eba4a[_0x9569('0x7')]),_0x5eba4a);if(!_[_0x9569('0x23')](channels[_0x5eba4a[_0x9569('0x7')]][_0x9569('0x40')])){channels[_0x5eba4a['uniqueid']][_0x9569('0x42')]+=utils[_0x9569('0x2f')](utils[_0x9569('0x1f')](),channels[_0x5eba4a['uniqueid']][_0x9569('0x40')]);utils['info'](util[_0x9569('0xa')](_0x9569('0x43'),_0x5eba4a['uniqueid'],channels[_0x5eba4a[_0x9569('0x7')]][_0x9569('0x42')]));delete channels[_0x5eba4a[_0x9569('0x7')]][_0x9569('0x40')];}}}catch(_0x2ce79a){utils[_0x9569('0x21')](util[_0x9569('0xa')](_0x9569('0x44'),_0x5eba4a[_0x9569('0x7')]),_0x2ce79a);}};exports[_0x9569('0x45')]=function(_0x393f6b){try{if(!_[_0x9569('0x23')](channels[_0x393f6b[_0x9569('0x7')]])){utils[_0x9569('0x18')](util[_0x9569('0xa')]('[%s][calls][varset]',_0x393f6b[_0x9569('0x7')]),_0x393f6b);if(!_['isNil'](_0x393f6b[_0x9569('0x46')][_0x9569('0x47')])){utils[_0x9569('0x9')](util[_0x9569('0xa')](_0x9569('0x48'),_0x393f6b['uniqueid'],_0x393f6b[_0x9569('0x49')]));channels[_0x393f6b[_0x9569('0x7')]][_0x9569('0x4a')]=_0x393f6b[_0x9569('0x49')];}if(!_['isNil'](_0x393f6b[_0x9569('0x46')][_0x9569('0x4b')])){utils[_0x9569('0x9')](util[_0x9569('0xa')](_0x9569('0x4c'),_0x393f6b[_0x9569('0x7')],_0x393f6b['value']));channels[_0x393f6b[_0x9569('0x7')]][_0x9569('0x4d')]=_0x393f6b[_0x9569('0x49')];channels[_0x393f6b['uniqueid']][_0x9569('0x2b')]='\x22'+_0x393f6b[_0x9569('0x49')]+_0x9569('0x4e')+_0x393f6b[_0x9569('0x49')]+'>';}if(!_[_0x9569('0x23')](_0x393f6b['variable']['xmd-callerid-preview'])||!_['isNil'](_0x393f6b[_0x9569('0x46')][_0x9569('0x4f')])){utils[_0x9569('0x9')](util[_0x9569('0xa')](_0x9569('0x50'),_0x393f6b[_0x9569('0x7')],!_[_0x9569('0x23')](_0x393f6b[_0x9569('0x46')]['xmd-callerid-preview'])?_0x9569('0x51'):'xmd-callerid',_0x393f6b[_0x9569('0x49')]));channels[_0x393f6b[_0x9569('0x7')]][_0x9569('0x2b')]=_0x393f6b[_0x9569('0x49')];}if(!_['isNil'](_0x393f6b[_0x9569('0x46')][_0x9569('0x52')])||!_[_0x9569('0x23')](_0x393f6b[_0x9569('0x46')]['xmcs-queue'])){utils[_0x9569('0x9')](util[_0x9569('0xa')](_0x9569('0x50'),_0x393f6b[_0x9569('0x7')],!_[_0x9569('0x23')](_0x393f6b['variable']['xmd-queue'])?'xmd-queue':_0x9569('0x53'),_0x393f6b[_0x9569('0x49')]));channels[_0x393f6b[_0x9569('0x7')]][_0x9569('0x54')]='Queue';channels[_0x393f6b[_0x9569('0x7')]]['lastdata']=_0x393f6b[_0x9569('0x49')];channels[_0x393f6b[_0x9569('0x7')]][_0x9569('0xd')]=!![];}if(!_[_0x9569('0x23')](_0x393f6b[_0x9569('0x46')][_0x9569('0x55')])){utils[_0x9569('0x9')](util[_0x9569('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x393f6b['uniqueid'],_0x393f6b[_0x9569('0x49')]));channels[_0x393f6b[_0x9569('0x7')]][_0x9569('0x56')]=_0x393f6b[_0x9569('0x49')];}if(!_[_0x9569('0x23')](_0x393f6b[_0x9569('0x46')]['xmd-cdrtype'])){utils[_0x9569('0x9')](util[_0x9569('0xa')](_0x9569('0x57'),_0x393f6b['uniqueid'],_0x393f6b[_0x9569('0x49')]));channels[_0x393f6b[_0x9569('0x7')]][_0x9569('0x58')]=_0x393f6b[_0x9569('0x49')];}if(!_[_0x9569('0x23')](_0x393f6b['variable'][_0x9569('0x59')])){utils[_0x9569('0x9')](util[_0x9569('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x393f6b[_0x9569('0x7')],_0x393f6b['value']));channels[_0x393f6b[_0x9569('0x7')]][_0x9569('0x5a')]=_0x393f6b[_0x9569('0x49')];}if(!_[_0x9569('0x23')](_0x393f6b[_0x9569('0x46')][_0x9569('0x5b')])){utils[_0x9569('0x9')](util[_0x9569('0xa')](_0x9569('0x5c'),_0x393f6b[_0x9569('0x7')],_0x393f6b[_0x9569('0x49')]));channels[_0x393f6b[_0x9569('0x7')]][_0x9569('0x5b')]=_0x393f6b['value'];}}}catch(_0x3da7a6){utils['error'](util[_0x9569('0xa')]('[%s][calls][varset]',_0x393f6b['uniqueid']),_0x3da7a6);}};exports[_0x9569('0x5d')]=function(_0x107a9){try{if(!_[_0x9569('0x23')](channels[_0x107a9[_0x9569('0x7')]])){utils['debug'](util['format'](_0x9569('0x5e'),_0x107a9[_0x9569('0x7')]),_0x107a9);utils[_0x9569('0x9')](util[_0x9569('0xa')](_0x9569('0x5f'),_0x107a9[_0x9569('0x7')],_0x107a9[_0x9569('0x60')],_0x107a9['appdata']));if(_0x107a9['application'][_0x9569('0x61')]()=='set'&&_[_0x9569('0x62')](_0x107a9[_0x9569('0x63')][_0x9569('0x61')](),_0x9569('0x64'))){var _0x2f79e5=_0x107a9[_0x9569('0x63')][_0x9569('0x65')]('=');var _0x1d4f3a=_0x2f79e5[0x0][_0x9569('0x66')](_0x2f79e5[0x0]['lastIndexOf']('(')+0x1,_0x2f79e5[0x0][_0x9569('0x67')](')'));var _0x4217c2=_0x2f79e5[0x1];channels[_0x107a9['uniqueid']][_0x1d4f3a]=_0x4217c2;}if(!_['includes']([_0x9569('0x29'),_0x9569('0x68'),_0x9569('0x69'),_0x9569('0x6a'),_0x9569('0x6b')],_0x107a9[_0x9569('0x60')][_0x9569('0x61')]())){channels[_0x107a9[_0x9569('0x7')]][_0x9569('0x54')]=_0x107a9[_0x9569('0x60')];channels[_0x107a9[_0x9569('0x7')]][_0x9569('0x6c')]=_0x107a9[_0x9569('0x63')];}}}catch(_0x384960){utils['error'](util[_0x9569('0xa')](_0x9569('0x5e'),_0x107a9[_0x9569('0x7')]),_0x384960);}}; \ No newline at end of file +var _0x2d06=['execif','gotoif','lastapplication','[%s][calls][newexten]','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','recording','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','debug','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','[%s][calls][newstate]','hangup','callerid','calleridname','cause-txt','endtime','billableseconds','diffTime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','split','lastIndexOf','noop'];(function(_0x1162d6,_0x2d8ee3){var _0x4c7676=function(_0x26ede0){while(--_0x26ede0){_0x1162d6['push'](_0x1162d6['shift']());}};_0x4c7676(++_0x2d8ee3);}(_0x2d06,0x157));var _0x62d0=function(_0x57e6f3,_0x3b153d){_0x57e6f3=_0x57e6f3-0x0;var _0x242980=_0x2d06[_0x57e6f3];return _0x242980;};'use strict';var _=require('lodash');var util=require(_0x62d0('0x0'));var utils=require(_0x62d0('0x1'));var transfers=require(_0x62d0('0x2'));var dispositions=[_0x62d0('0x3'),'FAILED',_0x62d0('0x4'),_0x62d0('0x3'),_0x62d0('0x3'),_0x62d0('0x3'),'ANSWERED',_0x62d0('0x5'),_0x62d0('0x4'),'FAILED',_0x62d0('0x4')];var channels={};function writeDB(_0x43fd82){var _0x508d82;if(transfers[_0x62d0('0x6')][_0x43fd82[_0x62d0('0x7')]]){_0x508d82=_0x43fd82[_0x62d0('0x7')];_0x43fd82[_0x62d0('0x7')]=transfers['blinds'][_0x43fd82['uniqueid']][_0x62d0('0x8')];}utils[_0x62d0('0x9')](util[_0x62d0('0xa')](_0x62d0('0xb'),_0x43fd82[_0x62d0('0x7')],_0x43fd82[_0x62d0('0xc')],_0x43fd82[_0x62d0('0xd')],_0x43fd82[_0x62d0('0xe')],_0x43fd82[_0x62d0('0xf')],_0x43fd82[_0x62d0('0x10')],_0x43fd82[_0x62d0('0x11')],_0x43fd82[_0x62d0('0x12')]));if(_0x43fd82[_0x62d0('0x13')]){utils[_0x62d0('0x14')](_0x43fd82['accountcode'])[_0x62d0('0x15')](function(_0x23376e){if(_0x23376e){_0x43fd82[_0x62d0('0x16')]=_0x23376e['id'];}utils['request'](_0x62d0('0x17'),_0x43fd82);});}else{utils[_0x62d0('0x18')]('CreateVoiceCallReport',_0x43fd82);}if(channels[_0x43fd82[_0x62d0('0x7')]]){delete channels[_0x43fd82[_0x62d0('0x7')]];}else if(_0x508d82&&channels[_0x508d82]){if(!transfers[_0x62d0('0x6')][_0x508d82][_0x62d0('0x19')])delete transfers['blinds'][_0x508d82];delete channels[_0x508d82];}}exports[_0x62d0('0x1a')]=function(_0x1cbeba){try{utils['debug'](util[_0x62d0('0xa')](_0x62d0('0x1b'),_0x1cbeba['uniqueid']),_0x1cbeba);if(_0x1cbeba[_0x62d0('0x7')]==_0x1cbeba['linkedid']&&_0x1cbeba[_0x62d0('0xc')]!=_0x62d0('0x1c')){utils[_0x62d0('0x9')](util['format'](_0x62d0('0x1d'),_0x1cbeba[_0x62d0('0x7')],_0x1cbeba[_0x62d0('0x1e')],_0x1cbeba['exten']));channels[_0x1cbeba[_0x62d0('0x7')]]={'uniqueid':_0x1cbeba['uniqueid'],'accountcode':_0x1cbeba[_0x62d0('0x13')],'source':_0x1cbeba['calleridnum'],'destination':_0x1cbeba[_0x62d0('0x1f')],'destinationcontext':_0x1cbeba['context'],'channel':_0x1cbeba[_0x62d0('0xc')],'starttime':utils[_0x62d0('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x62d0('0x21')};}}catch(_0x5dd319){utils[_0x62d0('0x22')](util['format'](_0x62d0('0x1b'),_0x1cbeba[_0x62d0('0x7')]),_0x5dd319);}};exports[_0x62d0('0x23')]=function(_0x4ba600){try{utils[_0x62d0('0x24')](util[_0x62d0('0xa')]('[%s][calls][newstate]',_0x4ba600['uniqueid']),_0x4ba600);if(!_['isNil'](channels[_0x4ba600['uniqueid']])&&_0x4ba600[_0x62d0('0x25')]==0x6){utils[_0x62d0('0x9')](util[_0x62d0('0xa')](_0x62d0('0x26'),_0x4ba600[_0x62d0('0x7')],_0x4ba600['context'],_0x4ba600['channel']));if(_[_0x62d0('0x27')](channels[_0x4ba600[_0x62d0('0x7')]][_0x62d0('0x28')])){channels[_0x4ba600[_0x62d0('0x7')]]['systemanswertime']=utils[_0x62d0('0x20')]();}}else if(!_['isNil'](channels[_0x4ba600[_0x62d0('0x29')]])&&_0x4ba600[_0x62d0('0x25')]==0x6&&_0x4ba600[_0x62d0('0x1e')]!=_0x62d0('0x2a')){utils[_0x62d0('0x9')](util[_0x62d0('0xa')](_0x62d0('0x2b'),_0x4ba600[_0x62d0('0x7')],_0x4ba600[_0x62d0('0x29')],_0x4ba600[_0x62d0('0x1e')],_0x4ba600[_0x62d0('0xc')]));channels[_0x4ba600[_0x62d0('0x29')]]['accountcode']=_0x4ba600['accountcode'];channels[_0x4ba600['linkedid']][_0x62d0('0x2c')]=_0x4ba600[_0x62d0('0xc')];if(_['isNil'](channels[_0x4ba600[_0x62d0('0x29')]][_0x62d0('0x2d')])){channels[_0x4ba600['linkedid']][_0x62d0('0x2d')]=utils[_0x62d0('0x20')]();}channels[_0x4ba600[_0x62d0('0x29')]]['disposition']=dispositions[_[_0x62d0('0x2e')](_0x4ba600['channelstate'])]||'ANSWERED';}}catch(_0x2f95da){utils[_0x62d0('0x22')](util['format'](_0x62d0('0x2f'),_0x4ba600[_0x62d0('0x7')]),_0x2f95da);}};exports[_0x62d0('0x30')]=function(_0x52f3d8){try{if(!_[_0x62d0('0x27')](channels[_0x52f3d8[_0x62d0('0x7')]])){utils[_0x62d0('0x24')](util[_0x62d0('0xa')]('[%s][calls][hangup]',_0x52f3d8['uniqueid']),_0x52f3d8);if(_[_0x62d0('0x27')](channels[_0x52f3d8[_0x62d0('0x7')]][_0x62d0('0x31')])){channels[_0x52f3d8[_0x62d0('0x7')]][_0x62d0('0x31')]=_0x52f3d8[_0x62d0('0x32')]+'\x20<'+_0x52f3d8[_0x62d0('0x10')]+'>';}utils['info'](util[_0x62d0('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x52f3d8['uniqueid'],channels[_0x52f3d8[_0x62d0('0x7')]][_0x62d0('0x31')],_0x52f3d8[_0x62d0('0x33')]));channels[_0x52f3d8[_0x62d0('0x7')]][_0x62d0('0x34')]=utils[_0x62d0('0x20')]();channels[_0x52f3d8[_0x62d0('0x7')]]['duration']=utils['diffTime'](channels[_0x52f3d8[_0x62d0('0x7')]][_0x62d0('0x34')],channels[_0x52f3d8[_0x62d0('0x7')]]['starttime']);channels[_0x52f3d8[_0x62d0('0x7')]][_0x62d0('0x35')]=channels[_0x52f3d8['uniqueid']]['answertime']?utils[_0x62d0('0x36')](channels[_0x52f3d8['uniqueid']][_0x62d0('0x34')],channels[_0x52f3d8[_0x62d0('0x7')]]['answertime']):0x0;writeDB(channels[_0x52f3d8[_0x62d0('0x7')]]);}}catch(_0x23cda1){utils[_0x62d0('0x22')](util[_0x62d0('0xa')](_0x62d0('0x37'),_0x52f3d8[_0x62d0('0x7')]),_0x23cda1);}};exports[_0x62d0('0x38')]=function(_0x2d4709){try{if(!_[_0x62d0('0x27')](channels[_0x2d4709[_0x62d0('0x39')]])){utils['debug'](util[_0x62d0('0xa')](_0x62d0('0x3a'),_0x2d4709['origtransfereruniqueid']),_0x2d4709);if(channels[_0x2d4709[_0x62d0('0x39')]][_0x62d0('0xc')]==_0x2d4709[_0x62d0('0x3b')]){utils[_0x62d0('0x9')](util[_0x62d0('0xa')](_0x62d0('0x3c'),_0x2d4709[_0x62d0('0x3d')],_0x2d4709[_0x62d0('0x39')],_0x2d4709['secondtransfererchannel']));channels[_0x2d4709[_0x62d0('0x39')]][_0x62d0('0x2c')]=_0x2d4709[_0x62d0('0x3e')];channels[_0x2d4709[_0x62d0('0x39')]][_0x62d0('0x3f')]=_0x62d0('0x40');}else if(channels[_0x2d4709['localtwolinkedid']][_0x62d0('0xc')]=_0x2d4709[_0x62d0('0x41')]){utils[_0x62d0('0x9')](util['format'](_0x62d0('0x3c'),_0x2d4709[_0x62d0('0x3d')],_0x2d4709[_0x62d0('0x39')],_0x2d4709[_0x62d0('0x42')]));channels[_0x2d4709[_0x62d0('0x39')]][_0x62d0('0x2c')]=_0x2d4709[_0x62d0('0x42')];channels[_0x2d4709[_0x62d0('0x39')]][_0x62d0('0x3f')]=_0x62d0('0x40');}}}catch(_0x4d2cf2){utils[_0x62d0('0x22')](util[_0x62d0('0xa')]('[%s][calls][attendedtransfer]',_0x2d4709['origtransfereruniqueid']),_0x4d2cf2);}};exports[_0x62d0('0x43')]=function(_0x300dc2){try{if(!_['isNil'](channels[_0x300dc2[_0x62d0('0x7')]])){utils['debug'](util['format'](_0x62d0('0x44'),_0x300dc2[_0x62d0('0x7')]),_0x300dc2);channels[_0x300dc2[_0x62d0('0x7')]][_0x62d0('0x45')]=utils['now']();utils[_0x62d0('0x9')](util[_0x62d0('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x300dc2[_0x62d0('0x7')],channels[_0x300dc2[_0x62d0('0x7')]][_0x62d0('0x45')]));}}catch(_0x8354bd){utils[_0x62d0('0x22')](util[_0x62d0('0xa')](_0x62d0('0x44'),_0x300dc2[_0x62d0('0x7')]),_0x8354bd);}};exports[_0x62d0('0x46')]=function(_0x242aa0){try{if(!_[_0x62d0('0x27')](channels[_0x242aa0[_0x62d0('0x7')]])){utils[_0x62d0('0x24')](util['format'](_0x62d0('0x47'),_0x242aa0['uniqueid']),_0x242aa0);if(!_[_0x62d0('0x27')](channels[_0x242aa0[_0x62d0('0x7')]]['musiconholdstartAt'])){channels[_0x242aa0[_0x62d0('0x7')]][_0x62d0('0x48')]+=utils['diffTime'](utils['now'](),channels[_0x242aa0[_0x62d0('0x7')]][_0x62d0('0x45')]);utils[_0x62d0('0x9')](util[_0x62d0('0xa')](_0x62d0('0x49'),_0x242aa0[_0x62d0('0x7')],channels[_0x242aa0[_0x62d0('0x7')]][_0x62d0('0x48')]));delete channels[_0x242aa0[_0x62d0('0x7')]]['musiconholdstartAt'];}}}catch(_0x2e2d6a){utils[_0x62d0('0x22')](util['format'](_0x62d0('0x47'),_0x242aa0[_0x62d0('0x7')]),_0x2e2d6a);}};exports[_0x62d0('0x4a')]=function(_0x33d080){try{if(!_[_0x62d0('0x27')](channels[_0x33d080[_0x62d0('0x7')]])){utils['debug'](util[_0x62d0('0xa')](_0x62d0('0x4b'),_0x33d080[_0x62d0('0x7')]),_0x33d080);if(!_['isNil'](_0x33d080['variable'][_0x62d0('0x4c')])){utils[_0x62d0('0x9')](util[_0x62d0('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x33d080[_0x62d0('0x7')],_0x33d080[_0x62d0('0x4d')]));channels[_0x33d080[_0x62d0('0x7')]][_0x62d0('0x4e')]=_0x33d080['value'];}if(!_[_0x62d0('0x27')](_0x33d080[_0x62d0('0x4f')][_0x62d0('0x50')])){utils[_0x62d0('0x9')](util['format'](_0x62d0('0x51'),_0x33d080[_0x62d0('0x7')],_0x33d080[_0x62d0('0x4d')]));channels[_0x33d080['uniqueid']][_0x62d0('0x52')]=_0x33d080[_0x62d0('0x4d')];channels[_0x33d080[_0x62d0('0x7')]][_0x62d0('0x31')]='\x22'+_0x33d080[_0x62d0('0x4d')]+_0x62d0('0x53')+_0x33d080['value']+'>';}if(!_['isNil'](_0x33d080[_0x62d0('0x4f')]['xmd-callerid-preview'])||!_[_0x62d0('0x27')](_0x33d080['variable']['xmd-callerid'])){utils[_0x62d0('0x9')](util[_0x62d0('0xa')](_0x62d0('0x54'),_0x33d080['uniqueid'],!_['isNil'](_0x33d080[_0x62d0('0x4f')][_0x62d0('0x55')])?_0x62d0('0x55'):'xmd-callerid',_0x33d080['value']));channels[_0x33d080[_0x62d0('0x7')]][_0x62d0('0x31')]=_0x33d080['value'];}if(!_[_0x62d0('0x27')](_0x33d080[_0x62d0('0x4f')][_0x62d0('0x56')])||!_[_0x62d0('0x27')](_0x33d080[_0x62d0('0x4f')][_0x62d0('0x57')])){utils[_0x62d0('0x9')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x33d080[_0x62d0('0x7')],!_[_0x62d0('0x27')](_0x33d080['variable'][_0x62d0('0x56')])?_0x62d0('0x56'):'xmcs-queue',_0x33d080[_0x62d0('0x4d')]));channels[_0x33d080[_0x62d0('0x7')]]['lastapplication']='Queue';channels[_0x33d080[_0x62d0('0x7')]][_0x62d0('0x58')]=_0x33d080[_0x62d0('0x4d')];channels[_0x33d080[_0x62d0('0x7')]]['queue']=!![];}if(!_['isNil'](_0x33d080[_0x62d0('0x4f')][_0x62d0('0x59')])){utils[_0x62d0('0x9')](util[_0x62d0('0xa')](_0x62d0('0x5a'),_0x33d080['uniqueid'],_0x33d080['value']));channels[_0x33d080[_0x62d0('0x7')]][_0x62d0('0x5b')]=_0x33d080[_0x62d0('0x4d')];}if(!_[_0x62d0('0x27')](_0x33d080['variable'][_0x62d0('0x5c')])){utils['info'](util[_0x62d0('0xa')](_0x62d0('0x5d'),_0x33d080[_0x62d0('0x7')],_0x33d080['value']));channels[_0x33d080[_0x62d0('0x7')]][_0x62d0('0x5e')]=_0x33d080['value'];}if(!_[_0x62d0('0x27')](_0x33d080[_0x62d0('0x4f')][_0x62d0('0x5f')])){utils[_0x62d0('0x9')](util[_0x62d0('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x33d080[_0x62d0('0x7')],_0x33d080[_0x62d0('0x4d')]));channels[_0x33d080[_0x62d0('0x7')]][_0x62d0('0x60')]=_0x33d080[_0x62d0('0x4d')];}if(!_[_0x62d0('0x27')](_0x33d080[_0x62d0('0x4f')][_0x62d0('0x61')])){utils[_0x62d0('0x9')](util['format'](_0x62d0('0x62'),_0x33d080[_0x62d0('0x7')],_0x33d080['value']));channels[_0x33d080[_0x62d0('0x7')]]['sipcallid']=_0x33d080[_0x62d0('0x4d')];}}}catch(_0x29b5a4){utils[_0x62d0('0x22')](util[_0x62d0('0xa')](_0x62d0('0x4b'),_0x33d080['uniqueid']),_0x29b5a4);}};exports[_0x62d0('0x63')]=function(_0x24cc5c){try{if(!_[_0x62d0('0x27')](channels[_0x24cc5c[_0x62d0('0x7')]])){utils['debug'](util[_0x62d0('0xa')]('[%s][calls][newexten]',_0x24cc5c[_0x62d0('0x7')]),_0x24cc5c);utils['info'](util['format'](_0x62d0('0x64'),_0x24cc5c[_0x62d0('0x7')],_0x24cc5c[_0x62d0('0x65')],_0x24cc5c[_0x62d0('0x66')]));if(_0x24cc5c['application']['toLowerCase']()==_0x62d0('0x67')&&_['startsWith'](_0x24cc5c[_0x62d0('0x66')][_0x62d0('0x68')](),_0x62d0('0x69'))){var _0x5f4279=_0x24cc5c[_0x62d0('0x66')][_0x62d0('0x6a')]('=');var _0x1f49b8=_0x5f4279[0x0]['substring'](_0x5f4279[0x0][_0x62d0('0x6b')]('(')+0x1,_0x5f4279[0x0][_0x62d0('0x6b')](')'));var _0x3f1047=_0x5f4279[0x1];channels[_0x24cc5c[_0x62d0('0x7')]][_0x1f49b8]=_0x3f1047;}if(!_['includes']([_0x62d0('0x30'),_0x62d0('0x6c'),_0x62d0('0x6d'),_0x62d0('0x67'),_0x62d0('0x6e')],_0x24cc5c['application'][_0x62d0('0x68')]())){channels[_0x24cc5c[_0x62d0('0x7')]][_0x62d0('0x6f')]=_0x24cc5c[_0x62d0('0x65')];channels[_0x24cc5c[_0x62d0('0x7')]][_0x62d0('0x58')]=_0x24cc5c[_0x62d0('0x66')];}}}catch(_0x51160f){utils[_0x62d0('0x22')](util['format'](_0x62d0('0x70'),_0x24cc5c[_0x62d0('0x7')]),_0x51160f);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 533c565..adbd1ae 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 _0x1d0f=['connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils'];(function(_0x1acddc,_0x5d3e20){var _0x5a84ec=function(_0xa2d360){while(--_0xa2d360){_0x1acddc['push'](_0x1acddc['shift']());}};_0x5a84ec(++_0x5d3e20);}(_0x1d0f,0x1d3));var _0xf1d0=function(_0x222833,_0x215e22){_0x222833=_0x222833-0x0;var _0x39cc97=_0x1d0f[_0x222833];return _0x39cc97;};'use strict';var utils=require(_0xf1d0('0x0'));exports[_0xf1d0('0x1')]=function(){utils[_0xf1d0('0x2')](_0xf1d0('0x3'));};exports[_0xf1d0('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0xf1d0('0x5')]=function(){utils[_0xf1d0('0x2')](_0xf1d0('0x6'));};exports[_0xf1d0('0x7')]=function(_0x372022){utils[_0xf1d0('0x7')](_0xf1d0('0x8'),_0x372022);};exports[_0xf1d0('0x9')]=function(){utils['info'](_0xf1d0('0xa'));};exports[_0xf1d0('0xb')]=function(_0x169ecd){}; \ No newline at end of file +var _0x8645=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','./utils','info','[core]\x20shutdown'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x8645,0x145));var _0x5864=function(_0x3719b6,_0x31f62a){_0x3719b6=_0x3719b6-0x0;var _0x599c6d=_0x8645[_0x3719b6];return _0x599c6d;};'use strict';var utils=require(_0x5864('0x0'));exports['connect']=function(){utils[_0x5864('0x1')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x5864('0x1')](_0x5864('0x2'));};exports[_0x5864('0x3')]=function(){utils[_0x5864('0x1')](_0x5864('0x4'));};exports['error']=function(_0x86020d){utils[_0x5864('0x5')](_0x5864('0x6'),_0x86020d);};exports[_0x5864('0x7')]=function(){utils[_0x5864('0x1')]('[core]\x20close');};exports['managerevent']=function(_0x3f795d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index ee17338..9c4e119 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 _0xb824=['startsWith','appdata','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','variable','value','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','hangup','[%s][dials][hangup]','calleridname','cause-txt','duration','diffTime','billableseconds','endtime','lodash','util','./utils','info','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set'];(function(_0x38d4ce,_0x2988dd){var _0x73330e=function(_0x32a14e){while(--_0x32a14e){_0x38d4ce['push'](_0x38d4ce['shift']());}};_0x73330e(++_0x2988dd);}(_0xb824,0x1cd));var _0x4b82=function(_0x26f112,_0x14da9f){_0x26f112=_0x26f112-0x0;var _0x280646=_0xb824[_0x26f112];return _0x280646;};'use strict';var _=require(_0x4b82('0x0'));var util=require(_0x4b82('0x1'));var utils=require(_0x4b82('0x2'));var dials={};function writeDB(_0x5b2558){utils[_0x4b82('0x3')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x5b2558[_0x4b82('0x4')],_0x5b2558[_0x4b82('0x5')],_0x5b2558['dialstring'],_0x5b2558[_0x4b82('0x6')],_0x5b2558[_0x4b82('0x7')],_0x5b2558[_0x4b82('0x8')]));utils[_0x4b82('0x9')](_0x4b82('0xa'),_0x5b2558);delete dials[_0x5b2558[_0x4b82('0x4')]];}exports[_0x4b82('0xb')]=function(_0x552fc1){try{utils[_0x4b82('0xc')](util[_0x4b82('0xd')](_0x4b82('0xe'),_0x552fc1[_0x4b82('0x4')]),_0x552fc1);utils[_0x4b82('0x3')](util[_0x4b82('0xd')](_0x4b82('0xf'),_0x552fc1[_0x4b82('0x4')],_0x552fc1['application'],_0x552fc1['appdata']));if(_0x552fc1[_0x4b82('0x10')][_0x4b82('0x11')]()==_0x4b82('0x12')&&_[_0x4b82('0x13')](_0x552fc1[_0x4b82('0x14')][_0x4b82('0x11')](),_0x4b82('0x15'))){var _0x50d101=_0x552fc1[_0x4b82('0x14')]['split']('=');dials[_0x552fc1[_0x4b82('0x4')]]={'routeId':_0x50d101[0x1]};}}catch(_0x56b054){utils[_0x4b82('0x16')](util[_0x4b82('0xd')](_0x4b82('0xe'),_0x552fc1[_0x4b82('0x4')]),_0x56b054);}};exports[_0x4b82('0x17')]=function(_0xa492fe){try{utils[_0x4b82('0xc')](util[_0x4b82('0xd')](_0x4b82('0x18'),_0xa492fe[_0x4b82('0x4')]),_0xa492fe);if(!_[_0x4b82('0x19')](_0xa492fe[_0x4b82('0x1a')]['outboundrouteid'])){utils['info'](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0xa492fe[_0x4b82('0x4')],_0xa492fe[_0x4b82('0x1b')]));dials[_0xa492fe[_0x4b82('0x4')]]={'routeId':_0xa492fe['value']};}}catch(_0x1639c4){utils[_0x4b82('0x16')](util[_0x4b82('0xd')](_0x4b82('0x18'),_0xa492fe['uniqueid']),_0x1639c4);}};exports['dialbegin']=function(_0x3c2191){try{if(!_[_0x4b82('0x19')](dials[_0x3c2191[_0x4b82('0x4')]])){utils[_0x4b82('0xc')](util[_0x4b82('0xd')]('[%s][dials][dialbegin]',_0x3c2191[_0x4b82('0x4')]),_0x3c2191);dials[_0x3c2191[_0x4b82('0x4')]]=_[_0x4b82('0x1c')](dials[_0x3c2191[_0x4b82('0x4')]],_0x3c2191);dials[_0x3c2191[_0x4b82('0x4')]][_0x4b82('0x1d')]=utils['now']();dials[_0x3c2191[_0x4b82('0x4')]][_0x4b82('0x1e')]=_0x4b82('0x1f');utils[_0x4b82('0x3')](util[_0x4b82('0xd')](_0x4b82('0x20'),_0x3c2191[_0x4b82('0x4')],dials[_0x3c2191[_0x4b82('0x4')]][_0x4b82('0x1d')]));}}catch(_0x275851){utils[_0x4b82('0x16')](util[_0x4b82('0xd')]('[%s][dials][dialbegin]',_0x3c2191[_0x4b82('0x4')]),_0x275851);}};exports[_0x4b82('0x21')]=function(_0x4196f9){try{if(!_[_0x4b82('0x19')](dials[_0x4196f9['uniqueid']])){utils['debug'](util[_0x4b82('0xd')]('[%s][dials][dialend]',_0x4196f9['uniqueid']),_0x4196f9);dials[_0x4196f9[_0x4b82('0x4')]]['dialstatus']=_0x4196f9['dialstatus'];if(_0x4196f9['dialstatus']==_0x4b82('0x22')){dials[_0x4196f9[_0x4b82('0x4')]]=_[_0x4b82('0x1c')](dials[_0x4196f9[_0x4b82('0x4')]],_0x4196f9);dials[_0x4196f9[_0x4b82('0x4')]][_0x4b82('0x23')]=utils[_0x4b82('0x24')]();dials[_0x4196f9[_0x4b82('0x4')]][_0x4b82('0x1e')]=_0x4b82('0x25');utils[_0x4b82('0x3')](util[_0x4b82('0xd')](_0x4b82('0x26'),_0x4196f9[_0x4b82('0x4')],_0x4196f9[_0x4b82('0x8')],dials[_0x4196f9['uniqueid']][_0x4b82('0x23')]));}else{utils[_0x4b82('0x3')](util[_0x4b82('0xd')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4196f9['uniqueid'],_0x4196f9[_0x4b82('0x8')]));}}}catch(_0x44f3ba){utils['error'](util[_0x4b82('0xd')](_0x4b82('0x27'),_0x4196f9[_0x4b82('0x4')]),_0x44f3ba);}};exports[_0x4b82('0x28')]=function(_0xeb63a4){try{if(!_[_0x4b82('0x19')](dials[_0xeb63a4[_0x4b82('0x4')]])){utils[_0x4b82('0xc')](util[_0x4b82('0xd')](_0x4b82('0x29'),_0xeb63a4[_0x4b82('0x4')]),_0xeb63a4);utils['info'](util[_0x4b82('0xd')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0xeb63a4[_0x4b82('0x4')],_0xeb63a4['calleridnum'],_0xeb63a4[_0x4b82('0x2a')],_0xeb63a4[_0x4b82('0x2b')]));dials[_0xeb63a4['uniqueid']]=_[_0x4b82('0x1c')](dials[_0xeb63a4[_0x4b82('0x4')]],{'endtime':utils[_0x4b82('0x24')](),'lastevent':'complete'});dials[_0xeb63a4[_0x4b82('0x4')]][_0x4b82('0x2c')]=utils[_0x4b82('0x2d')](dials[_0xeb63a4[_0x4b82('0x4')]]['endtime'],dials[_0xeb63a4[_0x4b82('0x4')]][_0x4b82('0x1d')]);dials[_0xeb63a4[_0x4b82('0x4')]]['holdtime']=utils['diffTime'](dials[_0xeb63a4[_0x4b82('0x4')]][_0x4b82('0x23')]||dials[_0xeb63a4['uniqueid']]['endtime'],dials[_0xeb63a4['uniqueid']]['starttime']);dials[_0xeb63a4[_0x4b82('0x4')]][_0x4b82('0x2e')]=dials[_0xeb63a4[_0x4b82('0x4')]][_0x4b82('0x23')]?utils[_0x4b82('0x2d')](dials[_0xeb63a4[_0x4b82('0x4')]][_0x4b82('0x2f')],dials[_0xeb63a4[_0x4b82('0x4')]][_0x4b82('0x23')]):0x0;writeDB(dials[_0xeb63a4['uniqueid']]);}}catch(_0x41748b){utils[_0x4b82('0x16')](util[_0x4b82('0xd')](_0x4b82('0x29'),_0xeb63a4[_0x4b82('0x4')]),_0x41748b);}}; \ No newline at end of file +var _0x61b9=['calleridnum','dialstatus','request','uniqueid','newexten','[%s][dials][newexten]','application','appdata','toLowerCase','set','startsWith','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','assign','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','debug','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','holdtime','answertime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring'];(function(_0x568d66,_0x1f1aa9){var _0x14fc92=function(_0x1fe39d){while(--_0x1fe39d){_0x568d66['push'](_0x568d66['shift']());}};_0x14fc92(++_0x1f1aa9);}(_0x61b9,0x198));var _0x961b=function(_0x3cc05d,_0x4b8f88){_0x3cc05d=_0x3cc05d-0x0;var _0x28b736=_0x61b9[_0x3cc05d];return _0x28b736;};'use strict';var _=require(_0x961b('0x0'));var util=require(_0x961b('0x1'));var utils=require(_0x961b('0x2'));var dials={};function writeDB(_0x5d7010){utils[_0x961b('0x3')](util[_0x961b('0x4')](_0x961b('0x5'),_0x5d7010['uniqueid'],_0x5d7010[_0x961b('0x6')],_0x5d7010[_0x961b('0x7')],_0x5d7010[_0x961b('0x8')],_0x5d7010['connectedlinenum'],_0x5d7010[_0x961b('0x9')]));utils[_0x961b('0xa')]('CreateVoiceDialReport',_0x5d7010);delete dials[_0x5d7010[_0x961b('0xb')]];}exports[_0x961b('0xc')]=function(_0x464866){try{utils['debug'](util[_0x961b('0x4')](_0x961b('0xd'),_0x464866[_0x961b('0xb')]),_0x464866);utils['info'](util[_0x961b('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x464866[_0x961b('0xb')],_0x464866[_0x961b('0xe')],_0x464866[_0x961b('0xf')]));if(_0x464866[_0x961b('0xe')][_0x961b('0x10')]()==_0x961b('0x11')&&_[_0x961b('0x12')](_0x464866[_0x961b('0xf')]['toLowerCase'](),'cdr(routeid)')){var _0x1bfb10=_0x464866[_0x961b('0xf')][_0x961b('0x13')]('=');dials[_0x464866[_0x961b('0xb')]]={'routeId':_0x1bfb10[0x1]};}}catch(_0x4f416b){utils[_0x961b('0x14')](util[_0x961b('0x4')]('[%s][dials][newexten]',_0x464866[_0x961b('0xb')]),_0x4f416b);}};exports[_0x961b('0x15')]=function(_0x5eafbe){try{utils['debug'](util[_0x961b('0x4')](_0x961b('0x16'),_0x5eafbe[_0x961b('0xb')]),_0x5eafbe);if(!_[_0x961b('0x17')](_0x5eafbe[_0x961b('0x18')][_0x961b('0x19')])){utils[_0x961b('0x3')](util[_0x961b('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x5eafbe[_0x961b('0xb')],_0x5eafbe[_0x961b('0x1a')]));dials[_0x5eafbe[_0x961b('0xb')]]={'routeId':_0x5eafbe['value']};}}catch(_0x4cfeea){utils[_0x961b('0x14')](util[_0x961b('0x4')]('[%s][dials][varset]',_0x5eafbe[_0x961b('0xb')]),_0x4cfeea);}};exports[_0x961b('0x1b')]=function(_0x4210cb){try{if(!_[_0x961b('0x17')](dials[_0x4210cb[_0x961b('0xb')]])){utils['debug'](util[_0x961b('0x4')](_0x961b('0x1c'),_0x4210cb['uniqueid']),_0x4210cb);dials[_0x4210cb[_0x961b('0xb')]]=_['assign'](dials[_0x4210cb['uniqueid']],_0x4210cb);dials[_0x4210cb[_0x961b('0xb')]]['starttime']=utils[_0x961b('0x1d')]();dials[_0x4210cb[_0x961b('0xb')]][_0x961b('0x1e')]=_0x961b('0x1f');utils[_0x961b('0x3')](util['format'](_0x961b('0x20'),_0x4210cb[_0x961b('0xb')],dials[_0x4210cb[_0x961b('0xb')]][_0x961b('0x21')]));}}catch(_0x19bfb4){utils[_0x961b('0x14')](util[_0x961b('0x4')](_0x961b('0x1c'),_0x4210cb[_0x961b('0xb')]),_0x19bfb4);}};exports[_0x961b('0x22')]=function(_0x47849b){try{if(!_[_0x961b('0x17')](dials[_0x47849b[_0x961b('0xb')]])){utils['debug'](util['format'](_0x961b('0x23'),_0x47849b['uniqueid']),_0x47849b);dials[_0x47849b['uniqueid']][_0x961b('0x9')]=_0x47849b[_0x961b('0x9')];if(_0x47849b[_0x961b('0x9')]==_0x961b('0x24')){dials[_0x47849b[_0x961b('0xb')]]=_[_0x961b('0x25')](dials[_0x47849b['uniqueid']],_0x47849b);dials[_0x47849b[_0x961b('0xb')]]['answertime']=utils['now']();dials[_0x47849b['uniqueid']][_0x961b('0x1e')]=_0x961b('0x26');utils['info'](util[_0x961b('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x47849b[_0x961b('0xb')],_0x47849b['dialstatus'],dials[_0x47849b[_0x961b('0xb')]]['answertime']));}else{utils[_0x961b('0x3')](util[_0x961b('0x4')](_0x961b('0x27'),_0x47849b[_0x961b('0xb')],_0x47849b[_0x961b('0x9')]));}}}catch(_0x3470b4){utils[_0x961b('0x14')](util[_0x961b('0x4')](_0x961b('0x23'),_0x47849b[_0x961b('0xb')]),_0x3470b4);}};exports[_0x961b('0x28')]=function(_0x1dfb90){try{if(!_[_0x961b('0x17')](dials[_0x1dfb90[_0x961b('0xb')]])){utils[_0x961b('0x29')](util[_0x961b('0x4')](_0x961b('0x2a'),_0x1dfb90[_0x961b('0xb')]),_0x1dfb90);utils['info'](util['format'](_0x961b('0x2b'),_0x1dfb90[_0x961b('0xb')],_0x1dfb90[_0x961b('0x8')],_0x1dfb90['calleridname'],_0x1dfb90[_0x961b('0x2c')]));dials[_0x1dfb90['uniqueid']]=_[_0x961b('0x25')](dials[_0x1dfb90[_0x961b('0xb')]],{'endtime':utils[_0x961b('0x1d')](),'lastevent':_0x961b('0x2d')});dials[_0x1dfb90['uniqueid']][_0x961b('0x2e')]=utils[_0x961b('0x2f')](dials[_0x1dfb90[_0x961b('0xb')]]['endtime'],dials[_0x1dfb90['uniqueid']]['starttime']);dials[_0x1dfb90[_0x961b('0xb')]][_0x961b('0x30')]=utils[_0x961b('0x2f')](dials[_0x1dfb90['uniqueid']][_0x961b('0x31')]||dials[_0x1dfb90['uniqueid']][_0x961b('0x32')],dials[_0x1dfb90[_0x961b('0xb')]][_0x961b('0x21')]);dials[_0x1dfb90[_0x961b('0xb')]][_0x961b('0x33')]=dials[_0x1dfb90[_0x961b('0xb')]][_0x961b('0x31')]?utils[_0x961b('0x2f')](dials[_0x1dfb90[_0x961b('0xb')]][_0x961b('0x32')],dials[_0x1dfb90[_0x961b('0xb')]][_0x961b('0x31')]):0x0;writeDB(dials[_0x1dfb90[_0x961b('0xb')]]);}}catch(_0x1169e0){utils['error'](util['format'](_0x961b('0x2a'),_0x1dfb90['uniqueid']),_0x1169e0);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index e80fd36..c013f63 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 _0xd64b=['[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','password','info','Asterisk\x20disabled\x20on\x20localhost','./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','agentcalled','uniqueid','agentringnoanswer'];(function(_0x433280,_0x3756c7){var _0x2c20a1=function(_0x20841f){while(--_0x20841f){_0x433280['push'](_0x433280['shift']());}};_0x2c20a1(++_0x3756c7);}(_0xd64b,0x13a));var _0xbd64=function(_0xabe145,_0x2ef96d){_0xabe145=_0xabe145-0x0;var _0x433e19=_0xd64b[_0xabe145];return _0x433e19;};var AsteriskManager=require(_0xbd64('0x0'));var config=require(_0xbd64('0x1'));var utils=require(_0xbd64('0x2'));var util=require(_0xbd64('0x3'));var isXDREnabled=config[_0xbd64('0x4')]&&config['xdr'][_0xbd64('0x5')]?!config[_0xbd64('0x4')]['disabled']:!![];var isProduction=config[_0xbd64('0x6')]===_0xbd64('0x7')||![];var isLocalAsterisk=config[_0xbd64('0x4')]&&config['xdr'][_0xbd64('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0xbd64('0x9')][_0xbd64('0xa')],config[_0xbd64('0x9')]['ip'],config['asterisk']['username'],config[_0xbd64('0x9')][_0xbd64('0xb')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xbd64('0xc')](_0xbd64('0xd'));}else{var agents=require(_0xbd64('0xe'));var calls=require(_0xbd64('0xf'));var queues=require(_0xbd64('0x10'));var recordings=require(_0xbd64('0x11'));var members=require(_0xbd64('0x12'));var dials=require(_0xbd64('0x13'));var transfers=require(_0xbd64('0x14'));var core=require(_0xbd64('0x15'));ami['on'](_0xbd64('0x16'),core['connect']);ami['on'](_0xbd64('0x17'),core[_0xbd64('0x17')]);ami['on'](_0xbd64('0x18'),core[_0xbd64('0x18')]);ami['on'](_0xbd64('0x19'),core['error']);ami['on'](_0xbd64('0x1a'),core[_0xbd64('0x1a')]);ami['on'](_0xbd64('0x1b'),core['managerevent']);ami['on'](_0xbd64('0x1c'),function(_0x52d824){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')](_0xbd64('0x1f'),_0x52d824[_0xbd64('0x20')]),_0x52d824);members[_0xbd64('0x1c')](_0x52d824);}catch(_0x45d7c9){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')](_0xbd64('0x1f'),_0x52d824[_0xbd64('0x20')]),_0x45d7c9);}});ami['on'](_0xbd64('0x21'),function(_0x1201db){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')]('[%s][index][agentcalled]',_0x1201db['uniqueid']),_0x1201db);agents[_0xbd64('0x21')](_0x1201db);}catch(_0x152e22){utils[_0xbd64('0x19')](util['format']('[%s][index][agentcalled]',_0x1201db[_0xbd64('0x22')]),_0x152e22);}});ami['on'](_0xbd64('0x23'),function(_0x3d2ae8){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')](_0xbd64('0x24'),_0x3d2ae8['uniqueid']),_0x3d2ae8);agents[_0xbd64('0x23')](_0x3d2ae8);}catch(_0x1fb060){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')](_0xbd64('0x24'),_0x3d2ae8[_0xbd64('0x22')]),_0x1fb060);}});ami['on'](_0xbd64('0x25'),function(_0x11936d){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')](_0xbd64('0x26'),_0x11936d[_0xbd64('0x22')]),_0x11936d);agents['agentconnect'](_0x11936d);queues[_0xbd64('0x25')](_0x11936d);}catch(_0x3f886f){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')](_0xbd64('0x26'),_0x11936d[_0xbd64('0x22')]),_0x3f886f);}});ami['on'](_0xbd64('0x27'),function(_0x38307a){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')](_0xbd64('0x28'),_0x38307a[_0xbd64('0x22')]),_0x38307a);agents[_0xbd64('0x27')](_0x38307a);queues[_0xbd64('0x27')](_0x38307a);members['agentcomplete'](_0x38307a);}catch(_0x98e082){utils[_0xbd64('0x19')](util['format'](_0xbd64('0x28'),_0x38307a[_0xbd64('0x22')]),_0x98e082);}});ami['on'](_0xbd64('0x29'),function(_0xe1aa39){try{utils['debug'](util[_0xbd64('0x1e')](_0xbd64('0x2a'),_0xe1aa39[_0xbd64('0x22')]),_0xe1aa39);agents[_0xbd64('0x29')](_0xe1aa39);queues[_0xbd64('0x29')](_0xe1aa39);}catch(_0x125c89){utils['error'](util[_0xbd64('0x1e')](_0xbd64('0x2a'),_0xe1aa39[_0xbd64('0x22')]),_0x125c89);}});ami['on']('queuecallerjoin',function(_0x830aef){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')](_0xbd64('0x2b'),_0x830aef[_0xbd64('0x22')]),_0x830aef);queues[_0xbd64('0x2c')](_0x830aef);recordings[_0xbd64('0x2c')](_0x830aef);}catch(_0x1a6e73){utils['error'](util[_0xbd64('0x1e')](_0xbd64('0x2b'),_0x830aef[_0xbd64('0x22')]),_0x1a6e73);}});ami['on'](_0xbd64('0x2d'),function(_0x75f7de){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')](_0xbd64('0x2e'),_0x75f7de['uniqueid']),_0x75f7de);queues[_0xbd64('0x2d')](_0x75f7de);}catch(_0x3264da){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')]('[%s][index][queuecallerleave]',_0x75f7de[_0xbd64('0x22')]),_0x3264da);}});ami['on']('musiconholdstart',function(_0x268203){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')](_0xbd64('0x2f'),_0x268203['uniqueid']),_0x268203);queues[_0xbd64('0x30')](_0x268203);calls['musiconholdstart'](_0x268203);}catch(_0x76f416){utils['error'](util[_0xbd64('0x1e')](_0xbd64('0x2f'),_0x268203[_0xbd64('0x22')]),_0x76f416);}});ami['on'](_0xbd64('0x31'),function(_0x349665){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')](_0xbd64('0x32'),_0x349665['uniqueid']),_0x349665);queues['musiconholdstop'](_0x349665);calls[_0xbd64('0x31')](_0x349665);}catch(_0x2e6b7f){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')](_0xbd64('0x32'),_0x349665['uniqueid']),_0x2e6b7f);}});ami['on']('newstate',function(_0x47acfd){try{utils['debug'](util[_0xbd64('0x1e')]('[%s][index][newstate]',_0x47acfd[_0xbd64('0x22')]),_0x47acfd);calls[_0xbd64('0x33')](_0x47acfd);recordings[_0xbd64('0x33')](_0x47acfd);}catch(_0x3b72c1){utils[_0xbd64('0x19')](util['format'](_0xbd64('0x34'),_0x47acfd['uniqueid']),_0x3b72c1);}});ami['on'](_0xbd64('0x35'),function(_0x85baae){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')](_0xbd64('0x36'),_0x85baae[_0xbd64('0x22')]),_0x85baae);calls[_0xbd64('0x35')](_0x85baae);recordings['hangup'](_0x85baae);dials[_0xbd64('0x35')](_0x85baae);agents[_0xbd64('0x35')](_0x85baae);queues[_0xbd64('0x35')](_0x85baae);}catch(_0x1d1c6f){utils['error'](util[_0xbd64('0x1e')](_0xbd64('0x36'),_0x85baae[_0xbd64('0x22')]),_0x1d1c6f);}});ami['on']('cdr',function(_0x415621){try{utils[_0xbd64('0x1d')](util['format'](_0xbd64('0x37'),_0x415621['uniqueid']),_0x415621);members[_0xbd64('0x38')](_0x415621);}catch(_0x36ab0f){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')](_0xbd64('0x37'),_0x415621['uniqueid']),_0x36ab0f);}});ami['on'](_0xbd64('0x39'),function(_0x19e1ea){try{utils[_0xbd64('0x1d')](util['format'](_0xbd64('0x3a'),_0x19e1ea[_0xbd64('0x22')]),_0x19e1ea);queues['blindtransfer'](_0x19e1ea);agents[_0xbd64('0x39')](_0x19e1ea);transfers[_0xbd64('0x39')](_0x19e1ea);recordings[_0xbd64('0x39')](_0x19e1ea);}catch(_0x303ba9){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')](_0xbd64('0x3a'),_0x19e1ea[_0xbd64('0x22')]),_0x303ba9);}});ami['on']('attendedtransfer',function(_0x3038ae){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')](_0xbd64('0x3b'),_0x3038ae[_0xbd64('0x3c')]),_0x3038ae);queues[_0xbd64('0x3d')](_0x3038ae);transfers[_0xbd64('0x3d')](_0x3038ae);agents[_0xbd64('0x3d')](_0x3038ae);calls[_0xbd64('0x3d')](_0x3038ae);}catch(_0x1ac3bc){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')](_0xbd64('0x3b'),_0x3038ae['origtransfereruniqueid']),_0x1ac3bc);}});ami['on'](_0xbd64('0x3e'),function(_0x1ed40c){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')](_0xbd64('0x3f'),_0x1ed40c['uniqueid']),_0x1ed40c);queues[_0xbd64('0x3e')](_0x1ed40c);recordings[_0xbd64('0x3e')](_0x1ed40c);calls['varset'](_0x1ed40c);dials[_0xbd64('0x3e')](_0x1ed40c);}catch(_0x535447){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')](_0xbd64('0x3f'),_0x1ed40c[_0xbd64('0x22')]),_0x535447);}});ami['on'](_0xbd64('0x40'),function(_0x2eb28b){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')]('[%s][index][newexten]',_0x2eb28b[_0xbd64('0x22')]),_0x2eb28b);calls[_0xbd64('0x40')](_0x2eb28b);recordings['newexten'](_0x2eb28b);dials[_0xbd64('0x40')](_0x2eb28b);}catch(_0x46b193){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')]('[%s][index][newexten]',_0x2eb28b[_0xbd64('0x22')]),_0x46b193);}});ami['on'](_0xbd64('0x41'),function(_0x463b05){try{utils[_0xbd64('0x1d')](util['format'](_0xbd64('0x42'),_0x463b05[_0xbd64('0x22')]),_0x463b05);calls[_0xbd64('0x41')](_0x463b05);recordings[_0xbd64('0x41')](_0x463b05);}catch(_0x37c81c){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')](_0xbd64('0x42'),_0x463b05['uniqueid']),_0x37c81c);}});ami['on']('dialbegin',function(_0x5bf6e2){try{utils[_0xbd64('0x1d')](util[_0xbd64('0x1e')]('[%s][index][dialbegin]',_0x5bf6e2[_0xbd64('0x22')]),_0x5bf6e2);dials[_0xbd64('0x43')](_0x5bf6e2);}catch(_0x2cba44){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')]('[%s]dialbegin',_0x5bf6e2['uniqueid']),_0x2cba44);}});ami['on']('dialend',function(_0x5f328a){try{utils[_0xbd64('0x1d')](util['format'](_0xbd64('0x44'),_0x5f328a[_0xbd64('0x22')]),_0x5f328a);dials[_0xbd64('0x45')](_0x5f328a);}catch(_0x323a66){utils[_0xbd64('0x19')](util[_0xbd64('0x1e')](_0xbd64('0x44'),_0x5f328a[_0xbd64('0x22')]),_0x323a66);}});} \ No newline at end of file +var _0x9673=['../../config/environment','./utils','util','xdr','disabled','env','asterisk','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','[%s][index][dialend]','asterisk-manager'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x9673,0x113));var _0x3967=function(_0x460494,_0x203017){_0x460494=_0x460494-0x0;var _0x12c43d=_0x9673[_0x460494];return _0x12c43d;};var AsteriskManager=require(_0x3967('0x0'));var config=require(_0x3967('0x1'));var utils=require(_0x3967('0x2'));var util=require(_0x3967('0x3'));var isXDREnabled=config[_0x3967('0x4')]&&config[_0x3967('0x4')][_0x3967('0x5')]?!config['xdr'][_0x3967('0x5')]:!![];var isProduction=config[_0x3967('0x6')]==='production'||![];var isLocalAsterisk=config[_0x3967('0x4')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x3967('0x7')]['port'],config[_0x3967('0x7')]['ip'],config[_0x3967('0x7')][_0x3967('0x8')],config[_0x3967('0x7')]['password'],!![]);ami[_0x3967('0x9')]();if(!isXDREnabled){utils[_0x3967('0xa')](_0x3967('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x3967('0xc'));}else{var agents=require(_0x3967('0xd'));var calls=require(_0x3967('0xe'));var queues=require(_0x3967('0xf'));var recordings=require(_0x3967('0x10'));var members=require(_0x3967('0x11'));var dials=require(_0x3967('0x12'));var transfers=require('./transfers.controller');var core=require(_0x3967('0x13'));ami['on'](_0x3967('0x14'),core[_0x3967('0x14')]);ami['on'](_0x3967('0x15'),core['shutdown']);ami['on'](_0x3967('0x16'),core[_0x3967('0x16')]);ami['on'](_0x3967('0x17'),core[_0x3967('0x17')]);ami['on'](_0x3967('0x18'),core['close']);ami['on'](_0x3967('0x19'),core[_0x3967('0x19')]);ami['on'](_0x3967('0x1a'),function(_0x3c267a){try{utils[_0x3967('0x1b')](util[_0x3967('0x1c')](_0x3967('0x1d'),_0x3c267a[_0x3967('0x1e')]),_0x3c267a);members[_0x3967('0x1a')](_0x3c267a);}catch(_0x4c52e3){utils[_0x3967('0x17')](util[_0x3967('0x1c')](_0x3967('0x1d'),_0x3c267a['device']),_0x4c52e3);}});ami['on'](_0x3967('0x1f'),function(_0x3cfec2){try{utils['debug'](util['format'](_0x3967('0x20'),_0x3cfec2[_0x3967('0x21')]),_0x3cfec2);agents[_0x3967('0x1f')](_0x3cfec2);}catch(_0x5bf8b3){utils[_0x3967('0x17')](util['format'](_0x3967('0x20'),_0x3cfec2['uniqueid']),_0x5bf8b3);}});ami['on'](_0x3967('0x22'),function(_0x5d3e2b){try{utils['debug'](util[_0x3967('0x1c')](_0x3967('0x23'),_0x5d3e2b['uniqueid']),_0x5d3e2b);agents[_0x3967('0x22')](_0x5d3e2b);}catch(_0x1cc5a3){utils[_0x3967('0x17')](util[_0x3967('0x1c')](_0x3967('0x23'),_0x5d3e2b['uniqueid']),_0x1cc5a3);}});ami['on'](_0x3967('0x24'),function(_0x3b2fd0){try{utils['debug'](util['format'](_0x3967('0x25'),_0x3b2fd0[_0x3967('0x21')]),_0x3b2fd0);agents['agentconnect'](_0x3b2fd0);queues[_0x3967('0x24')](_0x3b2fd0);}catch(_0x2abd5a){utils[_0x3967('0x17')](util[_0x3967('0x1c')](_0x3967('0x25'),_0x3b2fd0[_0x3967('0x21')]),_0x2abd5a);}});ami['on'](_0x3967('0x26'),function(_0x19f6e6){try{utils[_0x3967('0x1b')](util[_0x3967('0x1c')]('[%s][index][agentcomplete]',_0x19f6e6[_0x3967('0x21')]),_0x19f6e6);agents[_0x3967('0x26')](_0x19f6e6);queues[_0x3967('0x26')](_0x19f6e6);members[_0x3967('0x26')](_0x19f6e6);}catch(_0x155d84){utils[_0x3967('0x17')](util[_0x3967('0x1c')](_0x3967('0x27'),_0x19f6e6['uniqueid']),_0x155d84);}});ami['on'](_0x3967('0x28'),function(_0x2196bb){try{utils[_0x3967('0x1b')](util[_0x3967('0x1c')](_0x3967('0x29'),_0x2196bb[_0x3967('0x21')]),_0x2196bb);agents[_0x3967('0x28')](_0x2196bb);queues['queuecallerabandon'](_0x2196bb);}catch(_0x127bc5){utils[_0x3967('0x17')](util['format'](_0x3967('0x29'),_0x2196bb[_0x3967('0x21')]),_0x127bc5);}});ami['on'](_0x3967('0x2a'),function(_0x297642){try{utils[_0x3967('0x1b')](util[_0x3967('0x1c')](_0x3967('0x2b'),_0x297642['uniqueid']),_0x297642);queues['queuecallerjoin'](_0x297642);recordings[_0x3967('0x2a')](_0x297642);}catch(_0x2b3b91){utils['error'](util[_0x3967('0x1c')](_0x3967('0x2b'),_0x297642[_0x3967('0x21')]),_0x2b3b91);}});ami['on'](_0x3967('0x2c'),function(_0x5eb3cc){try{utils['debug'](util['format'](_0x3967('0x2d'),_0x5eb3cc[_0x3967('0x21')]),_0x5eb3cc);queues[_0x3967('0x2c')](_0x5eb3cc);}catch(_0xc2a1ad){utils[_0x3967('0x17')](util[_0x3967('0x1c')]('[%s][index][queuecallerleave]',_0x5eb3cc[_0x3967('0x21')]),_0xc2a1ad);}});ami['on'](_0x3967('0x2e'),function(_0x36109e){try{utils[_0x3967('0x1b')](util['format'](_0x3967('0x2f'),_0x36109e['uniqueid']),_0x36109e);queues['musiconholdstart'](_0x36109e);calls[_0x3967('0x2e')](_0x36109e);}catch(_0x24133a){utils[_0x3967('0x17')](util[_0x3967('0x1c')](_0x3967('0x2f'),_0x36109e[_0x3967('0x21')]),_0x24133a);}});ami['on']('musiconholdstop',function(_0x298453){try{utils['debug'](util['format'](_0x3967('0x30'),_0x298453['uniqueid']),_0x298453);queues[_0x3967('0x31')](_0x298453);calls[_0x3967('0x31')](_0x298453);}catch(_0xd2fb27){utils['error'](util[_0x3967('0x1c')](_0x3967('0x30'),_0x298453[_0x3967('0x21')]),_0xd2fb27);}});ami['on'](_0x3967('0x32'),function(_0x2c9f2b){try{utils[_0x3967('0x1b')](util['format'](_0x3967('0x33'),_0x2c9f2b[_0x3967('0x21')]),_0x2c9f2b);calls[_0x3967('0x32')](_0x2c9f2b);recordings[_0x3967('0x32')](_0x2c9f2b);}catch(_0x33fb48){utils['error'](util[_0x3967('0x1c')](_0x3967('0x33'),_0x2c9f2b['uniqueid']),_0x33fb48);}});ami['on'](_0x3967('0x34'),function(_0x4b4dd3){try{utils['debug'](util[_0x3967('0x1c')](_0x3967('0x35'),_0x4b4dd3['uniqueid']),_0x4b4dd3);calls['hangup'](_0x4b4dd3);recordings[_0x3967('0x34')](_0x4b4dd3);dials['hangup'](_0x4b4dd3);agents[_0x3967('0x34')](_0x4b4dd3);queues[_0x3967('0x34')](_0x4b4dd3);}catch(_0x338448){utils[_0x3967('0x17')](util['format']('[%s][index][hangup]',_0x4b4dd3[_0x3967('0x21')]),_0x338448);}});ami['on']('cdr',function(_0x55bc91){try{utils[_0x3967('0x1b')](util[_0x3967('0x1c')](_0x3967('0x36'),_0x55bc91['uniqueid']),_0x55bc91);members['cdr'](_0x55bc91);}catch(_0x2bddcd){utils[_0x3967('0x17')](util[_0x3967('0x1c')](_0x3967('0x36'),_0x55bc91['uniqueid']),_0x2bddcd);}});ami['on'](_0x3967('0x37'),function(_0x496c18){try{utils['debug'](util['format'](_0x3967('0x38'),_0x496c18[_0x3967('0x21')]),_0x496c18);queues[_0x3967('0x37')](_0x496c18);agents[_0x3967('0x37')](_0x496c18);transfers[_0x3967('0x37')](_0x496c18);recordings['blindtransfer'](_0x496c18);}catch(_0xb5bf8d){utils['error'](util[_0x3967('0x1c')]('[%s][index][blindtransfer]',_0x496c18[_0x3967('0x21')]),_0xb5bf8d);}});ami['on'](_0x3967('0x39'),function(_0x27dc0b){try{utils[_0x3967('0x1b')](util['format'](_0x3967('0x3a'),_0x27dc0b['origtransfereruniqueid']),_0x27dc0b);queues['attendedtransfer'](_0x27dc0b);transfers[_0x3967('0x39')](_0x27dc0b);agents[_0x3967('0x39')](_0x27dc0b);calls[_0x3967('0x39')](_0x27dc0b);}catch(_0x213da4){utils[_0x3967('0x17')](util[_0x3967('0x1c')](_0x3967('0x3a'),_0x27dc0b[_0x3967('0x3b')]),_0x213da4);}});ami['on'](_0x3967('0x3c'),function(_0x34ebfa){try{utils['debug'](util[_0x3967('0x1c')](_0x3967('0x3d'),_0x34ebfa[_0x3967('0x21')]),_0x34ebfa);queues[_0x3967('0x3c')](_0x34ebfa);recordings[_0x3967('0x3c')](_0x34ebfa);calls[_0x3967('0x3c')](_0x34ebfa);dials[_0x3967('0x3c')](_0x34ebfa);}catch(_0x6f4440){utils['error'](util[_0x3967('0x1c')](_0x3967('0x3d'),_0x34ebfa['uniqueid']),_0x6f4440);}});ami['on']('newexten',function(_0x2efca0){try{utils[_0x3967('0x1b')](util['format'](_0x3967('0x3e'),_0x2efca0[_0x3967('0x21')]),_0x2efca0);calls[_0x3967('0x3f')](_0x2efca0);recordings['newexten'](_0x2efca0);dials[_0x3967('0x3f')](_0x2efca0);}catch(_0x1382ff){utils[_0x3967('0x17')](util['format'](_0x3967('0x3e'),_0x2efca0[_0x3967('0x21')]),_0x1382ff);}});ami['on'](_0x3967('0x40'),function(_0x37c5b3){try{utils[_0x3967('0x1b')](util[_0x3967('0x1c')](_0x3967('0x41'),_0x37c5b3[_0x3967('0x21')]),_0x37c5b3);calls[_0x3967('0x40')](_0x37c5b3);recordings['newchannel'](_0x37c5b3);}catch(_0x5acc49){utils[_0x3967('0x17')](util[_0x3967('0x1c')]('[%s][index][newchannel]',_0x37c5b3['uniqueid']),_0x5acc49);}});ami['on'](_0x3967('0x42'),function(_0x47f228){try{utils[_0x3967('0x1b')](util[_0x3967('0x1c')]('[%s][index][dialbegin]',_0x47f228[_0x3967('0x21')]),_0x47f228);dials[_0x3967('0x42')](_0x47f228);}catch(_0x45d5c4){utils[_0x3967('0x17')](util[_0x3967('0x1c')](_0x3967('0x43'),_0x47f228[_0x3967('0x21')]),_0x45d5c4);}});ami['on']('dialend',function(_0x298756){try{utils[_0x3967('0x1b')](util[_0x3967('0x1c')](_0x3967('0x44'),_0x298756[_0x3967('0x21')]),_0x298756);dials['dialend'](_0x298756);}catch(_0x1a99ce){utils[_0x3967('0x17')](util['format'](_0x3967('0x44'),_0x298756[_0x3967('0x21')]),_0x1a99ce);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 031cdab..7ff92da 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 _0x791d=['then','name','internal','request','CreateMemberReport','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','split','data1','data2','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','error','lodash','util','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type'];(function(_0x577cba,_0x2de404){var _0x2da890=function(_0x4bf0c0){while(--_0x4bf0c0){_0x577cba['push'](_0x577cba['shift']());}};_0x2da890(++_0x2de404);}(_0x791d,0x1f4));var _0xd791=function(_0xcba74f,_0x45d020){_0xcba74f=_0xcba74f-0x0;var _0x86ba76=_0x791d[_0xcba74f];return _0x86ba76;};'use strict';var _=require(_0xd791('0x0'));var util=require(_0xd791('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x53e8a5){utils[_0xd791('0x2')](util[_0xd791('0x3')](_0xd791('0x4'),_0x53e8a5[_0xd791('0x5')],_0x53e8a5[_0xd791('0x6')],_0x53e8a5[_0xd791('0x7')],_0x53e8a5['data2'],_0x53e8a5[_0xd791('0x8')],_0x53e8a5[_0xd791('0x9')]));if(_0x53e8a5[_0xd791('0x6')]){utils['getUserByInterface'](_0x53e8a5[_0xd791('0x6')])[_0xd791('0xa')](function(_0x450b5a){if(_0x450b5a){_0x53e8a5[_0xd791('0x8')]=_0x450b5a[_0xd791('0xb')];_0x53e8a5['internal']=_0x450b5a[_0xd791('0xc')];utils[_0xd791('0xd')](_0xd791('0xe'),_0x53e8a5);}else{utils['getUserByName'](_0x53e8a5[_0xd791('0x6')]['split']('/')[0x1])[_0xd791('0xa')](function(_0x58dede){if(_0x58dede){_0x53e8a5[_0xd791('0x8')]=_0x58dede['name'];_0x53e8a5[_0xd791('0xc')]=_0x58dede[_0xd791('0xc')];utils[_0xd791('0xd')](_0xd791('0xe'),_0x53e8a5);}});}})[_0xd791('0xf')](function(_0x51814c){utils['error'](util[_0xd791('0x3')](_0xd791('0x10'),_0x53e8a5['uniqueid']),_0x51814c);});}delete members[_0x53e8a5[_0xd791('0x6')]];}function startsWith(_0xd7bd30,_0x1dd33c){return _[_0xd791('0x11')](_0xd7bd30,function(_0x24d712){return _[_0xd791('0x12')](_0x1dd33c,_0x24d712);});}exports[_0xd791('0x13')]=function(_0x4cc4a6){try{utils[_0xd791('0x14')](util[_0xd791('0x3')](_0xd791('0x15'),members[_0x4cc4a6[_0xd791('0x16')]]?members[_0x4cc4a6[_0xd791('0x16')]][_0xd791('0x5')]:_0x4cc4a6['device']),_0x4cc4a6);utils[_0xd791('0x2')](util[_0xd791('0x3')](_0xd791('0x17'),members[_0x4cc4a6[_0xd791('0x16')]]?members[_0x4cc4a6[_0xd791('0x16')]][_0xd791('0x5')]:_0x4cc4a6['device'],_0x4cc4a6[_0xd791('0x18')],_0x4cc4a6[_0xd791('0x16')]));switch(_0x4cc4a6[_0xd791('0x18')]){case _0xd791('0x19'):case _0xd791('0x1a'):if(!startsWith(exclude,_0x4cc4a6[_0xd791('0x16')])){members[_0x4cc4a6[_0xd791('0x16')]]={'channel':'voice','interface':_0x4cc4a6[_0xd791('0x16')],'type':_0xd791('0x1b'),'enterAt':utils[_0xd791('0x1c')](),'role':_0xd791('0x1d')};}break;case _0xd791('0x1e'):if(!_[_0xd791('0x1f')](members[_0x4cc4a6['device']])){members[_0x4cc4a6['device']][_0xd791('0x20')]=utils[_0xd791('0x1c')]();members[_0x4cc4a6[_0xd791('0x16')]][_0xd791('0x21')]=utils[_0xd791('0x22')](members[_0x4cc4a6[_0xd791('0x16')]]['exitAt'],members[_0x4cc4a6['device']]['enterAt']);if(members[_0x4cc4a6[_0xd791('0x16')]][_0xd791('0x5')]){writeDB(members[_0x4cc4a6[_0xd791('0x16')]]);}}break;default:break;}}catch(_0x401b75){utils['error'](util[_0xd791('0x3')]('[%s][members][devicestatechange]',members[_0x4cc4a6[_0xd791('0x16')]]?members[_0x4cc4a6['device']][_0xd791('0x5')]:_0x4cc4a6[_0xd791('0x16')]),_0x401b75);}};exports[_0xd791('0x23')]=function(_0x43aea4){try{if(!_[_0xd791('0x1f')](members[_0x43aea4[_0xd791('0x6')]])){utils[_0xd791('0x14')](util[_0xd791('0x3')]('[%s][members][agentcomplete]',_0x43aea4[_0xd791('0x5')]),_0x43aea4);utils['info'](util[_0xd791('0x3')](_0xd791('0x24'),_0x43aea4[_0xd791('0x5')],_0x43aea4[_0xd791('0x6')],_0x43aea4[_0xd791('0x25')]));members[_0x43aea4['interface']]=_[_0xd791('0x26')](members[_0x43aea4[_0xd791('0x6')]],{'data4':_0x43aea4[_0xd791('0x25')],'uniqueid':_0x43aea4['uniqueid']});}}catch(_0x2570d5){utils['error'](util[_0xd791('0x3')](_0xd791('0x27'),_0x43aea4[_0xd791('0x5')]),_0x2570d5);}};exports[_0xd791('0x28')]=function(_0x4d89d4){try{utils['debug'](util[_0xd791('0x3')](_0xd791('0x29'),_0x4d89d4[_0xd791('0x5')]),_0x4d89d4);if(_0x4d89d4[_0xd791('0x7')]){var _0x3da314=_0x4d89d4[_0xd791('0x7')][_0xd791('0x2a')]('-')[0x0];if(!_[_0xd791('0x1f')](members[_0x3da314])){members[_0x3da314]=_[_0xd791('0x26')](members[_0x3da314],{'data1':members[_0x3da314][_0xd791('0x2b')]||_0x4d89d4[_0xd791('0x9')],'data2':members[_0x3da314][_0xd791('0x2c')]||_0x4d89d4[_0xd791('0x2d')],'data3':members[_0x3da314][_0xd791('0x2e')]||_0x4d89d4['destination'],'uniqueid':members[_0x3da314][_0xd791('0x5')]||_0x4d89d4[_0xd791('0x5')]});utils[_0xd791('0x2')](util[_0xd791('0x3')](_0xd791('0x2f'),_0x4d89d4[_0xd791('0x5')],members[_0x3da314][_0xd791('0x2b')],members[_0x3da314][_0xd791('0x2c')],members[_0x3da314][_0xd791('0x2e')]));if(members[_0x3da314][_0xd791('0x20')]){writeDB(members[_0x3da314]);}}}if(_0x4d89d4[_0xd791('0x30')]){var _0x35ea48=_0x4d89d4[_0xd791('0x30')][_0xd791('0x2a')]('-')[0x0];if(!_['isNil'](members[_0x35ea48])){members[_0x35ea48]=_[_0xd791('0x26')](members[_0x35ea48],{'data1':members[_0x35ea48]['data1']||_0x4d89d4['type'],'data2':members[_0x35ea48][_0xd791('0x2c')]||_0x4d89d4[_0xd791('0x2d')],'data3':members[_0x35ea48]['data3']||_0x4d89d4[_0xd791('0x31')],'uniqueid':members[_0x35ea48]['uniqueid']||_0x4d89d4[_0xd791('0x5')]});utils[_0xd791('0x2')](util[_0xd791('0x3')](_0xd791('0x2f'),_0x4d89d4[_0xd791('0x5')],members[_0x35ea48]['data1'],members[_0x35ea48][_0xd791('0x2c')],members[_0x35ea48]['data3']));if(members[_0x35ea48][_0xd791('0x20')]){writeDB(members[_0x35ea48]);}}}}catch(_0x477d54){utils[_0xd791('0x32')](util[_0xd791('0x3')](_0xd791('0x29'),_0x4d89d4[_0xd791('0x5')]),_0x477d54);}}; \ No newline at end of file +var _0x1c59=['exitAt','enterAt','error','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','source','destination','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','[%s][members][writeDB]','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','agent','NOT_INUSE','isNil','now','duration'];(function(_0x22071a,_0x4bcf62){var _0x5c6c85=function(_0x4c531b){while(--_0x4c531b){_0x22071a['push'](_0x22071a['shift']());}};_0x5c6c85(++_0x4bcf62);}(_0x1c59,0xe5));var _0x91c5=function(_0x1ac240,_0x1b9236){_0x1ac240=_0x1ac240-0x0;var _0x3fed16=_0x1c59[_0x1ac240];return _0x3fed16;};'use strict';var _=require('lodash');var util=require(_0x91c5('0x0'));var utils=require(_0x91c5('0x1'));var members={};var exclude=[_0x91c5('0x2'),_0x91c5('0x3')];function writeDB(_0x663109){utils[_0x91c5('0x4')](util[_0x91c5('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x663109[_0x91c5('0x6')],_0x663109['interface'],_0x663109[_0x91c5('0x7')],_0x663109[_0x91c5('0x8')],_0x663109[_0x91c5('0x9')],_0x663109[_0x91c5('0xa')]));if(_0x663109[_0x91c5('0xb')]){utils[_0x91c5('0xc')](_0x663109['interface'])[_0x91c5('0xd')](function(_0x57c7f2){if(_0x57c7f2){_0x663109[_0x91c5('0x9')]=_0x57c7f2[_0x91c5('0xe')];_0x663109[_0x91c5('0xf')]=_0x57c7f2[_0x91c5('0xf')];utils[_0x91c5('0x10')]('CreateMemberReport',_0x663109);}else{utils[_0x91c5('0x11')](_0x663109[_0x91c5('0xb')][_0x91c5('0x12')]('/')[0x1])[_0x91c5('0xd')](function(_0x499c64){if(_0x499c64){_0x663109[_0x91c5('0x9')]=_0x499c64[_0x91c5('0xe')];_0x663109[_0x91c5('0xf')]=_0x499c64[_0x91c5('0xf')];utils[_0x91c5('0x10')](_0x91c5('0x13'),_0x663109);}});}})[_0x91c5('0x14')](function(_0x4de95e){utils['error'](util[_0x91c5('0x5')](_0x91c5('0x15'),_0x663109['uniqueid']),_0x4de95e);});}delete members[_0x663109[_0x91c5('0xb')]];}function startsWith(_0x5384ee,_0x58110c){return _['some'](_0x5384ee,function(_0x41f3ce){return _[_0x91c5('0x16')](_0x58110c,_0x41f3ce);});}exports[_0x91c5('0x17')]=function(_0x355336){try{utils['debug'](util['format'](_0x91c5('0x18'),members[_0x355336[_0x91c5('0x19')]]?members[_0x355336[_0x91c5('0x19')]][_0x91c5('0x6')]:_0x355336[_0x91c5('0x19')]),_0x355336);utils[_0x91c5('0x4')](util['format'](_0x91c5('0x1a'),members[_0x355336[_0x91c5('0x19')]]?members[_0x355336[_0x91c5('0x19')]][_0x91c5('0x6')]:_0x355336['device'],_0x355336[_0x91c5('0x1b')],_0x355336[_0x91c5('0x19')]));switch(_0x355336[_0x91c5('0x1b')]){case _0x91c5('0x1c'):case _0x91c5('0x1d'):if(!startsWith(exclude,_0x355336['device'])){members[_0x355336[_0x91c5('0x19')]]={'channel':'voice','interface':_0x355336[_0x91c5('0x19')],'type':_0x91c5('0x1e'),'enterAt':utils['now'](),'role':_0x91c5('0x1f')};}break;case _0x91c5('0x20'):if(!_[_0x91c5('0x21')](members[_0x355336[_0x91c5('0x19')]])){members[_0x355336[_0x91c5('0x19')]]['exitAt']=utils[_0x91c5('0x22')]();members[_0x355336['device']][_0x91c5('0x23')]=utils['diffTime'](members[_0x355336[_0x91c5('0x19')]][_0x91c5('0x24')],members[_0x355336['device']][_0x91c5('0x25')]);if(members[_0x355336[_0x91c5('0x19')]][_0x91c5('0x6')]){writeDB(members[_0x355336['device']]);}}break;default:break;}}catch(_0x5cee9a){utils[_0x91c5('0x26')](util[_0x91c5('0x5')]('[%s][members][devicestatechange]',members[_0x355336[_0x91c5('0x19')]]?members[_0x355336[_0x91c5('0x19')]]['uniqueid']:_0x355336['device']),_0x5cee9a);}};exports[_0x91c5('0x27')]=function(_0x31af54){try{if(!_['isNil'](members[_0x31af54[_0x91c5('0xb')]])){utils[_0x91c5('0x28')](util[_0x91c5('0x5')](_0x91c5('0x29'),_0x31af54[_0x91c5('0x6')]),_0x31af54);utils[_0x91c5('0x4')](util[_0x91c5('0x5')](_0x91c5('0x2a'),_0x31af54['uniqueid'],_0x31af54[_0x91c5('0xb')],_0x31af54['queue']));members[_0x31af54[_0x91c5('0xb')]]=_[_0x91c5('0x2b')](members[_0x31af54[_0x91c5('0xb')]],{'data4':_0x31af54[_0x91c5('0x2c')],'uniqueid':_0x31af54[_0x91c5('0x6')]});}}catch(_0x122dee){utils[_0x91c5('0x26')](util[_0x91c5('0x5')](_0x91c5('0x29'),_0x31af54[_0x91c5('0x6')]),_0x122dee);}};exports[_0x91c5('0x2d')]=function(_0x508d87){try{utils[_0x91c5('0x28')](util['format'](_0x91c5('0x2e'),_0x508d87[_0x91c5('0x6')]),_0x508d87);if(_0x508d87[_0x91c5('0x7')]){var _0x232fe6=_0x508d87['channel'][_0x91c5('0x12')]('-')[0x0];if(!_[_0x91c5('0x21')](members[_0x232fe6])){members[_0x232fe6]=_['assign'](members[_0x232fe6],{'data1':members[_0x232fe6][_0x91c5('0x2f')]||_0x508d87[_0x91c5('0xa')],'data2':members[_0x232fe6][_0x91c5('0x8')]||_0x508d87[_0x91c5('0x30')],'data3':members[_0x232fe6]['data3']||_0x508d87[_0x91c5('0x31')],'uniqueid':members[_0x232fe6][_0x91c5('0x6')]||_0x508d87[_0x91c5('0x6')]});utils[_0x91c5('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x508d87[_0x91c5('0x6')],members[_0x232fe6][_0x91c5('0x2f')],members[_0x232fe6][_0x91c5('0x8')],members[_0x232fe6][_0x91c5('0x32')]));if(members[_0x232fe6][_0x91c5('0x24')]){writeDB(members[_0x232fe6]);}}}if(_0x508d87['destinationchannel']){var _0x46a9e3=_0x508d87[_0x91c5('0x33')][_0x91c5('0x12')]('-')[0x0];if(!_['isNil'](members[_0x46a9e3])){members[_0x46a9e3]=_['assign'](members[_0x46a9e3],{'data1':members[_0x46a9e3][_0x91c5('0x2f')]||_0x508d87['type'],'data2':members[_0x46a9e3][_0x91c5('0x8')]||_0x508d87['source'],'data3':members[_0x46a9e3]['data3']||_0x508d87[_0x91c5('0x31')],'uniqueid':members[_0x46a9e3][_0x91c5('0x6')]||_0x508d87[_0x91c5('0x6')]});utils['info'](util[_0x91c5('0x5')](_0x91c5('0x34'),_0x508d87['uniqueid'],members[_0x46a9e3][_0x91c5('0x2f')],members[_0x46a9e3][_0x91c5('0x8')],members[_0x46a9e3][_0x91c5('0x32')]));if(members[_0x46a9e3][_0x91c5('0x24')]){writeDB(members[_0x46a9e3]);}}}}catch(_0x382a88){utils[_0x91c5('0x26')](util[_0x91c5('0x5')]('[%s][members][cdr]',_0x508d87[_0x91c5('0x6')]),_0x382a88);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 7e89e8a..da025d2 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 _0x4d66=['error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandon','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','BLIND','transferexten','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferuniqueid','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','uniqueid','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now'];(function(_0x1bd5b7,_0x5efc82){var _0x126235=function(_0x44359d){while(--_0x44359d){_0x1bd5b7['push'](_0x1bd5b7['shift']());}};_0x126235(++_0x5efc82);}(_0x4d66,0x1e8));var _0x64d6=function(_0x364b32,_0x4dec35){_0x364b32=_0x364b32-0x0;var _0x3f3ea0=_0x4d66[_0x364b32];return _0x3f3ea0;};'use strict';var _=require(_0x64d6('0x0'));var util=require(_0x64d6('0x1'));var utils=require(_0x64d6('0x2'));var queues={};function writeDB(_0x2197a5){utils[_0x64d6('0x3')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2197a5[_0x64d6('0x4')],_0x2197a5['channel'],_0x2197a5[_0x64d6('0x5')],_0x2197a5[_0x64d6('0x6')],_0x2197a5['calleridnum'],_0x2197a5[_0x64d6('0x7')],_0x2197a5[_0x64d6('0x8')]));if(_0x2197a5[_0x64d6('0x5')]){utils[_0x64d6('0x9')](_0x2197a5['queue'])[_0x64d6('0xa')](function(_0x36d9ee){if(_0x36d9ee){_0x2197a5[_0x64d6('0xb')]=_0x36d9ee['type'];}utils[_0x64d6('0xc')](_0x64d6('0xd'),_0x2197a5);});}else{utils[_0x64d6('0xc')]('CreateVoiceQueueReport',_0x2197a5);}if(_0x2197a5['transfereduniqueid']){delete queues[_0x2197a5[_0x64d6('0xe')]];}else{delete queues[_0x2197a5['uniqueid']];}}exports[_0x64d6('0xf')]=function(_0x3ab445){try{utils[_0x64d6('0x10')](util[_0x64d6('0x11')]('[%s][queues][queuecallerjoin]',_0x3ab445[_0x64d6('0x4')]),_0x3ab445);utils['info'](util[_0x64d6('0x11')](_0x64d6('0x12'),_0x3ab445[_0x64d6('0x4')],_0x3ab445[_0x64d6('0x5')],_0x3ab445[_0x64d6('0x13')]));queues[_0x3ab445['uniqueid']]=_[_0x64d6('0x14')](_0x3ab445,{'originalposition':_0x3ab445[_0x64d6('0x13')],'queuecallerjoinAt':utils[_0x64d6('0x15')](),'mohtime':0x0});}catch(_0x43bb54){utils[_0x64d6('0x16')](util[_0x64d6('0x11')](_0x64d6('0x17'),_0x3ab445['uniqueid']),_0x43bb54);}};exports[_0x64d6('0x18')]=function(_0x171475){try{if(!_[_0x64d6('0x19')](queues[_0x171475[_0x64d6('0x4')]])){utils[_0x64d6('0x10')](util[_0x64d6('0x11')](_0x64d6('0x1a'),_0x171475[_0x64d6('0x4')]),_0x171475);if(queues[_0x171475[_0x64d6('0x4')]][_0x64d6('0x1b')]){if(!queues[_0x171475['uniqueid']]['queuecallerabandon']&&!queues[_0x171475['uniqueid']]['queuecallerexit']){queues[_0x171475[_0x64d6('0x4')]][_0x64d6('0x1c')]=!![];queues[_0x171475[_0x64d6('0x4')]][_0x64d6('0x1d')]=utils[_0x64d6('0x15')]();queues[_0x171475[_0x64d6('0x4')]][_0x64d6('0x8')]=_0x64d6('0x1e');}utils[_0x64d6('0x3')](util[_0x64d6('0x11')](_0x64d6('0x1f'),_0x171475['uniqueid'],queues[_0x171475[_0x64d6('0x4')]]['name'],queues[_0x171475[_0x64d6('0x4')]][_0x64d6('0x8')]));writeDB(queues[_0x171475[_0x64d6('0x4')]]);}else if(queues[_0x171475[_0x64d6('0x4')]][_0x64d6('0xe')]){utils[_0x64d6('0x3')](util[_0x64d6('0x11')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x171475[_0x64d6('0x4')],queues[_0x171475['uniqueid']][_0x64d6('0x20')],queues[_0x171475[_0x64d6('0x4')]][_0x64d6('0xe')]));queues[queues[_0x171475[_0x64d6('0x4')]][_0x64d6('0xe')]]=queues[_0x171475['uniqueid']];queues[queues[_0x171475['uniqueid']][_0x64d6('0xe')]][_0x64d6('0x21')]=0x2;delete queues[_0x171475[_0x64d6('0x4')]];}}}catch(_0x58dc08){utils['error'](util['format']('[%s][queues][hangup]',_0x171475['uniqueid']),_0x58dc08);}};exports[_0x64d6('0x22')]=function(_0x3c896b){try{utils['debug'](util[_0x64d6('0x11')](_0x64d6('0x23'),_0x3c896b[_0x64d6('0x4')]),_0x3c896b);if(!_[_0x64d6('0x19')](_0x3c896b[_0x64d6('0x24')]['queuestatus'])&&_0x3c896b[_0x64d6('0x25')]['toUpperCase']()!=='CONTINUE'){if(!_[_0x64d6('0x19')](queues[_0x3c896b[_0x64d6('0x4')]])){queues[_0x3c896b['uniqueid']]['queuecallerabandon']=![];queues[_0x3c896b[_0x64d6('0x4')]][_0x64d6('0x26')]=null;queues[_0x3c896b['uniqueid']][_0x64d6('0x27')]=!![];queues[_0x3c896b[_0x64d6('0x4')]][_0x64d6('0x28')]=utils[_0x64d6('0x15')]();queues[_0x3c896b[_0x64d6('0x4')]][_0x64d6('0x8')]=_0x3c896b[_0x64d6('0x25')][_0x64d6('0x29')]();utils[_0x64d6('0x3')](util[_0x64d6('0x11')](_0x64d6('0x2a'),_0x3c896b['uniqueid'],queues[_0x3c896b['uniqueid']][_0x64d6('0x20')],_0x3c896b[_0x64d6('0x25')],queues[_0x3c896b[_0x64d6('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x3c896b[_0x64d6('0x4')]]);}}else if(!_[_0x64d6('0x19')](_0x3c896b[_0x64d6('0x24')]['queueposition'])){if(!_[_0x64d6('0x19')](queues[_0x3c896b[_0x64d6('0x4')]])&&!queues[_0x3c896b['uniqueid']][_0x64d6('0x2b')]){queues[_0x3c896b[_0x64d6('0x4')]][_0x64d6('0x2b')]=![];queues[_0x3c896b[_0x64d6('0x4')]][_0x64d6('0x26')]=null;queues[_0x3c896b['uniqueid']][_0x64d6('0x27')]=!![];queues[_0x3c896b[_0x64d6('0x4')]]['queuecallerexitAt']=utils[_0x64d6('0x15')]();queues[_0x3c896b[_0x64d6('0x4')]][_0x64d6('0x8')]='EXITWITHKEY';utils[_0x64d6('0x3')](util[_0x64d6('0x11')](_0x64d6('0x2c'),_0x3c896b[_0x64d6('0x4')],queues[_0x3c896b[_0x64d6('0x4')]][_0x64d6('0x20')],_0x3c896b['value'],queues[_0x3c896b[_0x64d6('0x4')]][_0x64d6('0x8')]));}}}catch(_0x30ce19){utils[_0x64d6('0x16')](util[_0x64d6('0x11')](_0x64d6('0x23'),_0x3c896b['uniqueid']),_0x30ce19);}};exports[_0x64d6('0x2b')]=function(_0x39e00d){try{if(!_[_0x64d6('0x19')](queues[_0x39e00d['uniqueid']])){utils['debug'](util[_0x64d6('0x11')]('[%s][queues][queuecallerabandon]',_0x39e00d[_0x64d6('0x4')]),_0x39e00d);queues[_0x39e00d[_0x64d6('0x4')]][_0x64d6('0x27')]=![];queues[_0x39e00d[_0x64d6('0x4')]][_0x64d6('0x28')]=null;queues[_0x39e00d[_0x64d6('0x4')]]['queuecallerabandon']=!![];queues[_0x39e00d[_0x64d6('0x4')]][_0x64d6('0x26')]=utils[_0x64d6('0x15')]();queues[_0x39e00d[_0x64d6('0x4')]]['queuecallerexitreason']=_0x64d6('0x2d');utils['info'](util[_0x64d6('0x11')](_0x64d6('0x2e'),_0x39e00d['uniqueid'],queues[_0x39e00d['uniqueid']]['name'],queues[_0x39e00d['uniqueid']]['queuecallerexitreason']));}}catch(_0x223f5e){utils[_0x64d6('0x16')](util[_0x64d6('0x11')](_0x64d6('0x2f'),_0x39e00d[_0x64d6('0x4')]),_0x223f5e);}};exports[_0x64d6('0x30')]=function(_0x56ccee){try{if(!_[_0x64d6('0x19')](queues[_0x56ccee[_0x64d6('0x4')]])){utils[_0x64d6('0x10')](util[_0x64d6('0x11')](_0x64d6('0x31'),_0x56ccee['uniqueid']),_0x56ccee);utils[_0x64d6('0x3')](util[_0x64d6('0x11')](_0x64d6('0x32'),_0x56ccee[_0x64d6('0x4')],queues[_0x56ccee[_0x64d6('0x4')]][_0x64d6('0x20')],_0x56ccee[_0x64d6('0x33')],_0x56ccee[_0x64d6('0x34')]));queues[_0x56ccee['uniqueid']][_0x64d6('0x30')]=!![];queues[_0x56ccee['uniqueid']][_0x64d6('0x1b')]=utils['now']();queues[_0x56ccee[_0x64d6('0x4')]][_0x64d6('0x35')]=utils['diffTime'](queues[_0x56ccee[_0x64d6('0x4')]]['queuecallerleaveAt'],queues[_0x56ccee['uniqueid']][_0x64d6('0x36')]);queues[_0x56ccee[_0x64d6('0x4')]]['position']=_0x56ccee[_0x64d6('0x13')];queues[_0x56ccee[_0x64d6('0x4')]][_0x64d6('0x37')]=_0x56ccee[_0x64d6('0x37')];queues[_0x56ccee[_0x64d6('0x4')]][_0x64d6('0x33')]=_0x56ccee[_0x64d6('0x33')];queues[_0x56ccee['uniqueid']]['connectedlinename']=_0x56ccee[_0x64d6('0x34')];}}catch(_0x4dcd0f){utils[_0x64d6('0x16')](util[_0x64d6('0x11')](_0x64d6('0x31'),_0x56ccee[_0x64d6('0x4')]),_0x4dcd0f);}};exports[_0x64d6('0x38')]=function(_0x5d52cb){try{if(!_['isNil'](queues[_0x5d52cb[_0x64d6('0x4')]])){utils[_0x64d6('0x10')](util[_0x64d6('0x11')](_0x64d6('0x39'),_0x5d52cb[_0x64d6('0x4')]),_0x5d52cb);utils['info'](util[_0x64d6('0x11')](_0x64d6('0x3a'),_0x5d52cb[_0x64d6('0x4')],queues[_0x5d52cb[_0x64d6('0x4')]][_0x64d6('0x20')],_0x5d52cb[_0x64d6('0x3b')],_0x5d52cb[_0x64d6('0x3c')]));queues[_0x5d52cb[_0x64d6('0x4')]][_0x64d6('0x2b')]=![];queues[_0x5d52cb['uniqueid']]['queuecallerabandon']=![];queues[_0x5d52cb[_0x64d6('0x4')]][_0x64d6('0x26')]=null;queues[_0x5d52cb[_0x64d6('0x4')]][_0x64d6('0x27')]=![];queues[_0x5d52cb['uniqueid']]['queuecallerexitreason']=null;queues[_0x5d52cb[_0x64d6('0x4')]][_0x64d6('0x28')]=null;queues[_0x5d52cb['uniqueid']][_0x64d6('0x3d')]=!![];queues[_0x5d52cb['uniqueid']][_0x64d6('0x7')]=_0x5d52cb[_0x64d6('0x3c')];queues[_0x5d52cb[_0x64d6('0x4')]][_0x64d6('0x6')]=_0x5d52cb['membername'];}}catch(_0x10340f){utils[_0x64d6('0x16')](util[_0x64d6('0x11')](_0x64d6('0x39'),_0x5d52cb[_0x64d6('0x4')]),_0x10340f);}};exports[_0x64d6('0x3e')]=function(_0x2149b7){try{if(!_[_0x64d6('0x19')](queues[_0x2149b7['uniqueid']])){if(queues[_0x2149b7['uniqueid']][_0x64d6('0x1b')]){utils[_0x64d6('0x10')](util[_0x64d6('0x11')]('[%s][queues][agentcomplete]',_0x2149b7['uniqueid']),_0x2149b7);queues[_0x2149b7[_0x64d6('0x4')]][_0x64d6('0x2b')]=![];queues[_0x2149b7[_0x64d6('0x4')]][_0x64d6('0x2b')]=![];queues[_0x2149b7[_0x64d6('0x4')]]['queuecallerabandonAt']=null;queues[_0x2149b7[_0x64d6('0x4')]]['queuecallerexit']=![];queues[_0x2149b7[_0x64d6('0x4')]]['queuecallerexitAt']=null;queues[_0x2149b7[_0x64d6('0x4')]][_0x64d6('0x3d')]=!![];queues[_0x2149b7[_0x64d6('0x4')]][_0x64d6('0x6')]=_0x2149b7[_0x64d6('0x3b')];queues[_0x2149b7[_0x64d6('0x4')]][_0x64d6('0x1c')]=!![];queues[_0x2149b7['uniqueid']]['queuecallercompleteAt']=utils[_0x64d6('0x15')]();if(_0x2149b7['reason']==_0x64d6('0x3f')){if(!queues[_0x2149b7[_0x64d6('0x4')]][_0x64d6('0x3f')]){queues[_0x2149b7[_0x64d6('0x4')]]['queuecallerexitreason']=_0x64d6('0x40');}}else{queues[_0x2149b7['uniqueid']][_0x64d6('0x8')]=_0x64d6('0x41')+_0x2149b7[_0x64d6('0x42')][_0x64d6('0x29')]();}utils[_0x64d6('0x3')](util[_0x64d6('0x11')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x2149b7[_0x64d6('0x4')],queues[_0x2149b7['uniqueid']]['name'],_0x2149b7[_0x64d6('0x3b')],queues[_0x2149b7[_0x64d6('0x4')]][_0x64d6('0x8')]));writeDB(queues[_0x2149b7[_0x64d6('0x4')]]);}}}catch(_0x537b9f){utils[_0x64d6('0x16')](util[_0x64d6('0x11')](_0x64d6('0x43'),_0x2149b7[_0x64d6('0x4')]),_0x537b9f);}};exports[_0x64d6('0x44')]=function(_0x20440b){try{if(!_['isNil'](queues[_0x20440b[_0x64d6('0x45')]])){utils[_0x64d6('0x10')](util[_0x64d6('0x11')]('[%s][queues][blindtransfer]',_0x20440b[_0x64d6('0x4')]),_0x20440b);queues[_0x20440b['transfereeuniqueid']][_0x64d6('0x3f')]=!![];queues[_0x20440b[_0x64d6('0x45')]]['transfertype']=_0x64d6('0x46');queues[_0x20440b['transfereeuniqueid']][_0x64d6('0x47')]=_0x20440b['extension'];queues[_0x20440b[_0x64d6('0x45')]]['transferuniqueid']=_0x20440b[_0x64d6('0x45')];queues[_0x20440b[_0x64d6('0x45')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0x64d6('0x3')](util[_0x64d6('0x11')](_0x64d6('0x48'),_0x20440b[_0x64d6('0x4')],queues[_0x20440b[_0x64d6('0x45')]][_0x64d6('0x20')],_0x20440b[_0x64d6('0x45')],_0x20440b[_0x64d6('0x49')]));}}catch(_0x1fdab5){utils[_0x64d6('0x16')](util[_0x64d6('0x11')](_0x64d6('0x4a'),_0x20440b[_0x64d6('0x4')]),_0x1fdab5);}};exports['attendedtransfer']=function(_0x48a00f){try{utils['debug'](util[_0x64d6('0x11')]('[%s][queues][attendedtransfer]',_0x48a00f[_0x64d6('0x4b')]),_0x48a00f);if(_0x48a00f[_0x64d6('0x4b')]==_0x48a00f[_0x64d6('0x4c')]){if(!_[_0x64d6('0x19')](queues[_0x48a00f[_0x64d6('0x4d')]])){utils['info'](util[_0x64d6('0x11')](_0x64d6('0x4e'),_0x48a00f[_0x64d6('0x4b')],queues[_0x48a00f[_0x64d6('0x4d')]][_0x64d6('0x20')],_0x48a00f[_0x64d6('0x4f')]));queues[_0x48a00f[_0x64d6('0x4d')]][_0x64d6('0x3f')]=!![];queues[_0x48a00f[_0x64d6('0x4d')]][_0x64d6('0x50')]=_0x64d6('0x51');queues[_0x48a00f[_0x64d6('0x4d')]][_0x64d6('0x47')]=_0x48a00f[_0x64d6('0x4f')];queues[_0x48a00f[_0x64d6('0x4d')]][_0x64d6('0x52')]=_0x48a00f[_0x64d6('0x4b')];queues[_0x48a00f['secondtransfererlinkedid']][_0x64d6('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x64d6('0x19')](queues[_0x48a00f['origtransfererlinkedid']])){if(_0x48a00f[_0x64d6('0x53')]&&queues[_0x48a00f[_0x64d6('0x53')]]){queues[_0x48a00f[_0x64d6('0x53')]][_0x64d6('0x21')]=0x1;queues[_0x48a00f[_0x64d6('0x45')]]=_[_0x64d6('0x54')](queues[_0x48a00f['transfereelinkedid']]);queues[_0x48a00f[_0x64d6('0x45')]][_0x64d6('0xe')]=_0x48a00f[_0x64d6('0x55')];queues[_0x48a00f[_0x64d6('0x45')]][_0x64d6('0x21')]=0x2;queues[_0x48a00f[_0x64d6('0x45')]][_0x64d6('0x56')]=queues[_0x48a00f['secondtransfererlinkedid']][_0x64d6('0x56')];queues[_0x48a00f[_0x64d6('0x45')]]['calleridname']=queues[_0x48a00f[_0x64d6('0x4d')]][_0x64d6('0x57')];queues[_0x48a00f[_0x64d6('0x45')]][_0x64d6('0x36')]=utils[_0x64d6('0x15')]();queues[_0x48a00f[_0x64d6('0x45')]][_0x64d6('0x1b')]=utils[_0x64d6('0x15')]();queues[_0x48a00f[_0x64d6('0x45')]][_0x64d6('0x35')]=0x0;queues[_0x48a00f['transfereeuniqueid']][_0x64d6('0x58')]=0x0;utils[_0x64d6('0x3')](util['format'](_0x64d6('0x59'),_0x48a00f['origtransfereruniqueid'],queues[_0x48a00f[_0x64d6('0x45')]][_0x64d6('0x20')],queues[_0x48a00f[_0x64d6('0x45')]]['calleridnum'],queues[_0x48a00f[_0x64d6('0x45')]][_0x64d6('0x57')]));}else{utils[_0x64d6('0x3')](util[_0x64d6('0x11')](_0x64d6('0x5a'),_0x48a00f[_0x64d6('0x4b')],queues[_0x48a00f[_0x64d6('0x4c')]][_0x64d6('0x20')],_0x48a00f[_0x64d6('0x4d')]));queues[_0x48a00f['origtransfererlinkedid']]['transfereduniqueid']=_0x48a00f[_0x64d6('0x4d')];}}}else if(_0x48a00f['secondtransfereruniqueid']==_0x48a00f[_0x64d6('0x4d')]){if(!_[_0x64d6('0x19')](queues[_0x48a00f['origtransfererlinkedid']])){utils[_0x64d6('0x3')](util[_0x64d6('0x11')](_0x64d6('0x5b'),_0x48a00f['origtransfereruniqueid'],queues[_0x48a00f['origtransfererlinkedid']]['name'],_0x48a00f[_0x64d6('0x5c')],_0x48a00f['secondtransfererexten']));queues[_0x48a00f[_0x64d6('0x4c')]]['transfer']=!![];queues[_0x48a00f[_0x64d6('0x4c')]][_0x64d6('0x50')]=_0x64d6('0x51');queues[_0x48a00f[_0x64d6('0x4c')]][_0x64d6('0x47')]=_0x48a00f['secondtransfererexten'];queues[_0x48a00f[_0x64d6('0x4c')]][_0x64d6('0x52')]=_0x48a00f[_0x64d6('0x5c')];queues[_0x48a00f[_0x64d6('0x4c')]]['queuecallerexitreason']=_0x64d6('0x5d');}if(!_[_0x64d6('0x19')](queues[_0x48a00f[_0x64d6('0x4d')]])){if(_0x48a00f[_0x64d6('0x5e')]&&queues[_0x48a00f[_0x64d6('0x5e')]]){queues[_0x48a00f['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x48a00f[_0x64d6('0x55')]]=_[_0x64d6('0x54')](queues[_0x48a00f[_0x64d6('0x5e')]]);queues[_0x48a00f['transfertargetuniqueid']][_0x64d6('0xe')]=_0x48a00f['transfertargetuniqueid'];queues[_0x48a00f[_0x64d6('0x55')]][_0x64d6('0x21')]=0x2;queues[_0x48a00f['transfertargetuniqueid']][_0x64d6('0x56')]=queues[_0x48a00f[_0x64d6('0x4c')]][_0x64d6('0x56')];queues[_0x48a00f[_0x64d6('0x55')]][_0x64d6('0x57')]=queues[_0x48a00f[_0x64d6('0x4c')]][_0x64d6('0x57')];queues[_0x48a00f[_0x64d6('0x55')]][_0x64d6('0x36')]=utils['now']();queues[_0x48a00f[_0x64d6('0x55')]][_0x64d6('0x1b')]=utils[_0x64d6('0x15')]();queues[_0x48a00f['transfertargetuniqueid']][_0x64d6('0x35')]=0x0;queues[_0x48a00f['transfertargetuniqueid']][_0x64d6('0x58')]=0x0;utils['info'](util[_0x64d6('0x11')](_0x64d6('0x5f'),_0x48a00f[_0x64d6('0x4b')],queues[_0x48a00f[_0x64d6('0x55')]][_0x64d6('0x20')],queues[_0x48a00f[_0x64d6('0x55')]]['transfereduniqueid'],queues[_0x48a00f['transfertargetuniqueid']]['calleridnum'],queues[_0x48a00f[_0x64d6('0x55')]][_0x64d6('0x57')]));}else{utils[_0x64d6('0x3')](util['format'](_0x64d6('0x5a'),_0x48a00f[_0x64d6('0x4b')],queues[_0x48a00f[_0x64d6('0x4d')]]['name'],_0x48a00f[_0x64d6('0x4c')]));queues[_0x48a00f[_0x64d6('0x4d')]][_0x64d6('0xe')]=_0x48a00f['origtransfererlinkedid'];}}}}catch(_0x28ca5c){utils[_0x64d6('0x16')](util[_0x64d6('0x11')]('[%s][queues][attendedtransfer]',_0x48a00f[_0x64d6('0x4b')]),_0x28ca5c);}};exports['musiconholdstart']=function(_0x245b44){try{if(!_[_0x64d6('0x19')](queues[_0x245b44[_0x64d6('0x4')]])){utils['debug'](util[_0x64d6('0x11')](_0x64d6('0x60'),_0x245b44[_0x64d6('0x4')]),_0x245b44);queues[_0x245b44[_0x64d6('0x4')]][_0x64d6('0x61')]=utils[_0x64d6('0x15')]();utils[_0x64d6('0x3')](util[_0x64d6('0x11')](_0x64d6('0x62'),_0x245b44[_0x64d6('0x4')],queues[_0x245b44[_0x64d6('0x4')]][_0x64d6('0x20')],queues[_0x245b44[_0x64d6('0x4')]][_0x64d6('0x61')]));}}catch(_0x51e028){utils[_0x64d6('0x16')](util[_0x64d6('0x11')](_0x64d6('0x60'),_0x245b44[_0x64d6('0x4')]),_0x51e028);}};exports[_0x64d6('0x63')]=function(_0x307797){try{if(!_[_0x64d6('0x19')](queues[_0x307797[_0x64d6('0x4')]])){if(!_[_0x64d6('0x19')](queues[_0x307797[_0x64d6('0x4')]][_0x64d6('0x61')])){utils[_0x64d6('0x10')](util[_0x64d6('0x11')]('[%s][queues][musiconholdstop]',_0x307797['uniqueid']),_0x307797);queues[_0x307797['uniqueid']][_0x64d6('0x58')]+=utils['diffTime'](utils['now'](),queues[_0x307797[_0x64d6('0x4')]][_0x64d6('0x61')]);utils[_0x64d6('0x3')](util[_0x64d6('0x11')](_0x64d6('0x64'),_0x307797['uniqueid'],queues[_0x307797[_0x64d6('0x4')]][_0x64d6('0x20')],queues[_0x307797[_0x64d6('0x4')]][_0x64d6('0x58')]));delete queues[_0x307797[_0x64d6('0x4')]][_0x64d6('0x61')];}}}catch(_0x368bc8){utils[_0x64d6('0x16')](util[_0x64d6('0x11')](_0x64d6('0x65'),_0x307797[_0x64d6('0x4')]),_0x368bc8);}}; \ No newline at end of file +var _0xf418=['secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','queuecallerexitreason','then','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','assign','position','now','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','isNil','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid'];(function(_0x15cdcc,_0x58ccfb){var _0x5c8fcd=function(_0x89396b){while(--_0x89396b){_0x15cdcc['push'](_0x15cdcc['shift']());}};_0x5c8fcd(++_0x58ccfb);}(_0xf418,0x138));var _0x8f41=function(_0x5bc882,_0x52cd23){_0x5bc882=_0x5bc882-0x0;var _0x342a07=_0xf418[_0x5bc882];return _0x342a07;};'use strict';var _=require(_0x8f41('0x0'));var util=require(_0x8f41('0x1'));var utils=require(_0x8f41('0x2'));var queues={};function writeDB(_0x596677){utils[_0x8f41('0x3')](util[_0x8f41('0x4')](_0x8f41('0x5'),_0x596677[_0x8f41('0x6')],_0x596677[_0x8f41('0x7')],_0x596677[_0x8f41('0x8')],_0x596677['lastAssignedTo'],_0x596677[_0x8f41('0x9')],_0x596677['accountcode'],_0x596677[_0x8f41('0xa')]));if(_0x596677[_0x8f41('0x8')]){utils['getVoiceQueueByName'](_0x596677[_0x8f41('0x8')])[_0x8f41('0xb')](function(_0x3b49aa){if(_0x3b49aa){_0x596677['type']=_0x3b49aa['type'];}utils[_0x8f41('0xc')](_0x8f41('0xd'),_0x596677);});}else{utils[_0x8f41('0xc')](_0x8f41('0xd'),_0x596677);}if(_0x596677[_0x8f41('0xe')]){delete queues[_0x596677[_0x8f41('0xe')]];}else{delete queues[_0x596677['uniqueid']];}}exports[_0x8f41('0xf')]=function(_0x12ec0b){try{utils[_0x8f41('0x10')](util[_0x8f41('0x4')](_0x8f41('0x11'),_0x12ec0b[_0x8f41('0x6')]),_0x12ec0b);utils[_0x8f41('0x3')](util[_0x8f41('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x12ec0b[_0x8f41('0x6')],_0x12ec0b[_0x8f41('0x8')],_0x12ec0b['position']));queues[_0x12ec0b['uniqueid']]=_[_0x8f41('0x12')](_0x12ec0b,{'originalposition':_0x12ec0b[_0x8f41('0x13')],'queuecallerjoinAt':utils[_0x8f41('0x14')](),'mohtime':0x0});}catch(_0x5dea50){utils['error'](util[_0x8f41('0x4')](_0x8f41('0x11'),_0x12ec0b[_0x8f41('0x6')]),_0x5dea50);}};exports['hangup']=function(_0x2f4582){try{if(!_['isNil'](queues[_0x2f4582[_0x8f41('0x6')]])){utils[_0x8f41('0x10')](util[_0x8f41('0x4')](_0x8f41('0x15'),_0x2f4582['uniqueid']),_0x2f4582);if(queues[_0x2f4582[_0x8f41('0x6')]][_0x8f41('0x16')]){if(!queues[_0x2f4582[_0x8f41('0x6')]][_0x8f41('0x17')]&&!queues[_0x2f4582[_0x8f41('0x6')]][_0x8f41('0x18')]){queues[_0x2f4582[_0x8f41('0x6')]]['queuecallercomplete']=!![];queues[_0x2f4582[_0x8f41('0x6')]][_0x8f41('0x19')]=utils['now']();queues[_0x2f4582['uniqueid']][_0x8f41('0xa')]=_0x8f41('0x1a');}utils[_0x8f41('0x3')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x2f4582[_0x8f41('0x6')],queues[_0x2f4582[_0x8f41('0x6')]][_0x8f41('0x1b')],queues[_0x2f4582['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x2f4582[_0x8f41('0x6')]]);}else if(queues[_0x2f4582[_0x8f41('0x6')]][_0x8f41('0xe')]){utils[_0x8f41('0x3')](util[_0x8f41('0x4')](_0x8f41('0x1c'),_0x2f4582[_0x8f41('0x6')],queues[_0x2f4582[_0x8f41('0x6')]]['name'],queues[_0x2f4582[_0x8f41('0x6')]][_0x8f41('0xe')]));queues[queues[_0x2f4582[_0x8f41('0x6')]]['transfereduniqueid']]=queues[_0x2f4582[_0x8f41('0x6')]];queues[queues[_0x2f4582[_0x8f41('0x6')]]['transfereduniqueid']][_0x8f41('0x1d')]=0x2;delete queues[_0x2f4582[_0x8f41('0x6')]];}}}catch(_0x854771){utils[_0x8f41('0x1e')](util['format'](_0x8f41('0x15'),_0x2f4582[_0x8f41('0x6')]),_0x854771);}};exports[_0x8f41('0x1f')]=function(_0x1f2ac2){try{utils[_0x8f41('0x10')](util[_0x8f41('0x4')]('[%s][queues][varset]',_0x1f2ac2[_0x8f41('0x6')]),_0x1f2ac2);if(!_[_0x8f41('0x20')](_0x1f2ac2['variable'][_0x8f41('0x21')])&&_0x1f2ac2[_0x8f41('0x22')][_0x8f41('0x23')]()!=='CONTINUE'){if(!_[_0x8f41('0x20')](queues[_0x1f2ac2[_0x8f41('0x6')]])){queues[_0x1f2ac2[_0x8f41('0x6')]]['queuecallerabandon']=![];queues[_0x1f2ac2['uniqueid']][_0x8f41('0x24')]=null;queues[_0x1f2ac2['uniqueid']][_0x8f41('0x18')]=!![];queues[_0x1f2ac2[_0x8f41('0x6')]][_0x8f41('0x25')]=utils[_0x8f41('0x14')]();queues[_0x1f2ac2['uniqueid']]['queuecallerexitreason']=_0x1f2ac2['value'][_0x8f41('0x23')]();utils[_0x8f41('0x3')](util['format'](_0x8f41('0x26'),_0x1f2ac2[_0x8f41('0x6')],queues[_0x1f2ac2[_0x8f41('0x6')]][_0x8f41('0x1b')],_0x1f2ac2[_0x8f41('0x22')],queues[_0x1f2ac2[_0x8f41('0x6')]][_0x8f41('0xa')]));writeDB(queues[_0x1f2ac2[_0x8f41('0x6')]]);}}else if(!_[_0x8f41('0x20')](_0x1f2ac2['variable'][_0x8f41('0x27')])){if(!_[_0x8f41('0x20')](queues[_0x1f2ac2[_0x8f41('0x6')]])&&!queues[_0x1f2ac2[_0x8f41('0x6')]][_0x8f41('0x17')]){queues[_0x1f2ac2[_0x8f41('0x6')]][_0x8f41('0x17')]=![];queues[_0x1f2ac2['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1f2ac2[_0x8f41('0x6')]][_0x8f41('0x18')]=!![];queues[_0x1f2ac2[_0x8f41('0x6')]][_0x8f41('0x25')]=utils[_0x8f41('0x14')]();queues[_0x1f2ac2['uniqueid']][_0x8f41('0xa')]='EXITWITHKEY';utils[_0x8f41('0x3')](util[_0x8f41('0x4')](_0x8f41('0x28'),_0x1f2ac2['uniqueid'],queues[_0x1f2ac2['uniqueid']][_0x8f41('0x1b')],_0x1f2ac2[_0x8f41('0x22')],queues[_0x1f2ac2[_0x8f41('0x6')]][_0x8f41('0xa')]));}}}catch(_0x340f63){utils[_0x8f41('0x1e')](util[_0x8f41('0x4')](_0x8f41('0x29'),_0x1f2ac2[_0x8f41('0x6')]),_0x340f63);}};exports[_0x8f41('0x17')]=function(_0x56b554){try{if(!_[_0x8f41('0x20')](queues[_0x56b554['uniqueid']])){utils[_0x8f41('0x10')](util[_0x8f41('0x4')](_0x8f41('0x2a'),_0x56b554[_0x8f41('0x6')]),_0x56b554);queues[_0x56b554[_0x8f41('0x6')]][_0x8f41('0x18')]=![];queues[_0x56b554['uniqueid']][_0x8f41('0x25')]=null;queues[_0x56b554[_0x8f41('0x6')]]['queuecallerabandon']=!![];queues[_0x56b554[_0x8f41('0x6')]][_0x8f41('0x24')]=utils[_0x8f41('0x14')]();queues[_0x56b554[_0x8f41('0x6')]]['queuecallerexitreason']=_0x8f41('0x2b');utils[_0x8f41('0x3')](util[_0x8f41('0x4')](_0x8f41('0x2c'),_0x56b554['uniqueid'],queues[_0x56b554['uniqueid']][_0x8f41('0x1b')],queues[_0x56b554[_0x8f41('0x6')]][_0x8f41('0xa')]));}}catch(_0x772216){utils[_0x8f41('0x1e')](util[_0x8f41('0x4')](_0x8f41('0x2a'),_0x56b554[_0x8f41('0x6')]),_0x772216);}};exports[_0x8f41('0x2d')]=function(_0x12abec){try{if(!_[_0x8f41('0x20')](queues[_0x12abec[_0x8f41('0x6')]])){utils['debug'](util[_0x8f41('0x4')](_0x8f41('0x2e'),_0x12abec[_0x8f41('0x6')]),_0x12abec);utils[_0x8f41('0x3')](util[_0x8f41('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x12abec[_0x8f41('0x6')],queues[_0x12abec[_0x8f41('0x6')]][_0x8f41('0x1b')],_0x12abec[_0x8f41('0x2f')],_0x12abec[_0x8f41('0x30')]));queues[_0x12abec[_0x8f41('0x6')]]['queuecallerleave']=!![];queues[_0x12abec[_0x8f41('0x6')]][_0x8f41('0x16')]=utils['now']();queues[_0x12abec[_0x8f41('0x6')]]['holdtime']=utils[_0x8f41('0x31')](queues[_0x12abec['uniqueid']][_0x8f41('0x16')],queues[_0x12abec[_0x8f41('0x6')]][_0x8f41('0x32')]);queues[_0x12abec[_0x8f41('0x6')]][_0x8f41('0x13')]=_0x12abec[_0x8f41('0x13')];queues[_0x12abec['uniqueid']]['count']=_0x12abec[_0x8f41('0x33')];queues[_0x12abec['uniqueid']]['connectedlinenum']=_0x12abec[_0x8f41('0x2f')];queues[_0x12abec[_0x8f41('0x6')]][_0x8f41('0x30')]=_0x12abec[_0x8f41('0x30')];}}catch(_0x317be3){utils['error'](util[_0x8f41('0x4')](_0x8f41('0x2e'),_0x12abec[_0x8f41('0x6')]),_0x317be3);}};exports[_0x8f41('0x34')]=function(_0x5c27ec){try{if(!_[_0x8f41('0x20')](queues[_0x5c27ec['uniqueid']])){utils[_0x8f41('0x10')](util['format'](_0x8f41('0x35'),_0x5c27ec['uniqueid']),_0x5c27ec);utils[_0x8f41('0x3')](util[_0x8f41('0x4')](_0x8f41('0x36'),_0x5c27ec[_0x8f41('0x6')],queues[_0x5c27ec[_0x8f41('0x6')]]['name'],_0x5c27ec[_0x8f41('0x37')],_0x5c27ec[_0x8f41('0x38')]));queues[_0x5c27ec[_0x8f41('0x6')]][_0x8f41('0x17')]=![];queues[_0x5c27ec[_0x8f41('0x6')]][_0x8f41('0x17')]=![];queues[_0x5c27ec[_0x8f41('0x6')]][_0x8f41('0x24')]=null;queues[_0x5c27ec[_0x8f41('0x6')]][_0x8f41('0x18')]=![];queues[_0x5c27ec[_0x8f41('0x6')]][_0x8f41('0xa')]=null;queues[_0x5c27ec[_0x8f41('0x6')]][_0x8f41('0x25')]=null;queues[_0x5c27ec[_0x8f41('0x6')]][_0x8f41('0x39')]=!![];queues[_0x5c27ec[_0x8f41('0x6')]]['accountcode']=_0x5c27ec[_0x8f41('0x38')];queues[_0x5c27ec[_0x8f41('0x6')]][_0x8f41('0x3a')]=_0x5c27ec[_0x8f41('0x37')];}}catch(_0x3f16cf){utils[_0x8f41('0x1e')](util[_0x8f41('0x4')](_0x8f41('0x35'),_0x5c27ec[_0x8f41('0x6')]),_0x3f16cf);}};exports['agentcomplete']=function(_0x234e14){try{if(!_[_0x8f41('0x20')](queues[_0x234e14[_0x8f41('0x6')]])){if(queues[_0x234e14[_0x8f41('0x6')]]['queuecallerleaveAt']){utils[_0x8f41('0x10')](util['format']('[%s][queues][agentcomplete]',_0x234e14['uniqueid']),_0x234e14);queues[_0x234e14['uniqueid']][_0x8f41('0x17')]=![];queues[_0x234e14[_0x8f41('0x6')]][_0x8f41('0x17')]=![];queues[_0x234e14[_0x8f41('0x6')]][_0x8f41('0x24')]=null;queues[_0x234e14[_0x8f41('0x6')]]['queuecallerexit']=![];queues[_0x234e14[_0x8f41('0x6')]][_0x8f41('0x25')]=null;queues[_0x234e14[_0x8f41('0x6')]][_0x8f41('0x39')]=!![];queues[_0x234e14[_0x8f41('0x6')]][_0x8f41('0x3a')]=_0x234e14[_0x8f41('0x37')];queues[_0x234e14[_0x8f41('0x6')]][_0x8f41('0x3b')]=!![];queues[_0x234e14['uniqueid']]['queuecallercompleteAt']=utils[_0x8f41('0x14')]();if(_0x234e14[_0x8f41('0x3c')]==_0x8f41('0x3d')){if(!queues[_0x234e14[_0x8f41('0x6')]][_0x8f41('0x3d')]){queues[_0x234e14[_0x8f41('0x6')]]['queuecallerexitreason']=_0x8f41('0x3e');}}else{queues[_0x234e14['uniqueid']][_0x8f41('0xa')]=_0x8f41('0x3f')+_0x234e14[_0x8f41('0x3c')][_0x8f41('0x23')]();}utils[_0x8f41('0x3')](util['format'](_0x8f41('0x40'),_0x234e14[_0x8f41('0x6')],queues[_0x234e14['uniqueid']]['name'],_0x234e14[_0x8f41('0x37')],queues[_0x234e14[_0x8f41('0x6')]][_0x8f41('0xa')]));writeDB(queues[_0x234e14['uniqueid']]);}}}catch(_0x145c16){utils[_0x8f41('0x1e')](util[_0x8f41('0x4')](_0x8f41('0x41'),_0x234e14[_0x8f41('0x6')]),_0x145c16);}};exports['blindtransfer']=function(_0x59e365){try{if(!_[_0x8f41('0x20')](queues[_0x59e365[_0x8f41('0x42')]])){utils[_0x8f41('0x10')](util[_0x8f41('0x4')]('[%s][queues][blindtransfer]',_0x59e365[_0x8f41('0x6')]),_0x59e365);queues[_0x59e365[_0x8f41('0x42')]][_0x8f41('0x3d')]=!![];queues[_0x59e365[_0x8f41('0x42')]][_0x8f41('0x43')]=_0x8f41('0x44');queues[_0x59e365['transfereeuniqueid']]['transferexten']=_0x59e365[_0x8f41('0x45')];queues[_0x59e365[_0x8f41('0x42')]][_0x8f41('0x46')]=_0x59e365[_0x8f41('0x42')];queues[_0x59e365[_0x8f41('0x42')]][_0x8f41('0xa')]=_0x8f41('0x47');utils['info'](util['format'](_0x8f41('0x48'),_0x59e365[_0x8f41('0x6')],queues[_0x59e365[_0x8f41('0x42')]][_0x8f41('0x1b')],_0x59e365[_0x8f41('0x42')],_0x59e365[_0x8f41('0x45')]));}}catch(_0xea8dbe){utils[_0x8f41('0x1e')](util[_0x8f41('0x4')](_0x8f41('0x49'),_0x59e365[_0x8f41('0x6')]),_0xea8dbe);}};exports[_0x8f41('0x4a')]=function(_0x57e25c){try{utils[_0x8f41('0x10')](util[_0x8f41('0x4')](_0x8f41('0x4b'),_0x57e25c[_0x8f41('0x4c')]),_0x57e25c);if(_0x57e25c['origtransfereruniqueid']==_0x57e25c[_0x8f41('0x4d')]){if(!_[_0x8f41('0x20')](queues[_0x57e25c[_0x8f41('0x4e')]])){utils[_0x8f41('0x3')](util['format'](_0x8f41('0x4f'),_0x57e25c[_0x8f41('0x4c')],queues[_0x57e25c[_0x8f41('0x4e')]]['name'],_0x57e25c[_0x8f41('0x50')]));queues[_0x57e25c['secondtransfererlinkedid']][_0x8f41('0x3d')]=!![];queues[_0x57e25c[_0x8f41('0x4e')]][_0x8f41('0x43')]=_0x8f41('0x51');queues[_0x57e25c[_0x8f41('0x4e')]][_0x8f41('0x52')]=_0x57e25c['origtransfererexten'];queues[_0x57e25c[_0x8f41('0x4e')]][_0x8f41('0x46')]=_0x57e25c['origtransfereruniqueid'];queues[_0x57e25c[_0x8f41('0x4e')]][_0x8f41('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x8f41('0x20')](queues[_0x57e25c['origtransfererlinkedid']])){if(_0x57e25c[_0x8f41('0x53')]&&queues[_0x57e25c[_0x8f41('0x53')]]){queues[_0x57e25c[_0x8f41('0x53')]][_0x8f41('0x1d')]=0x1;queues[_0x57e25c[_0x8f41('0x42')]]=_[_0x8f41('0x54')](queues[_0x57e25c[_0x8f41('0x53')]]);queues[_0x57e25c['transfereeuniqueid']]['transfereduniqueid']=_0x57e25c[_0x8f41('0x55')];queues[_0x57e25c[_0x8f41('0x42')]][_0x8f41('0x1d')]=0x2;queues[_0x57e25c[_0x8f41('0x42')]][_0x8f41('0x9')]=queues[_0x57e25c[_0x8f41('0x4e')]][_0x8f41('0x9')];queues[_0x57e25c[_0x8f41('0x42')]][_0x8f41('0x56')]=queues[_0x57e25c[_0x8f41('0x4e')]][_0x8f41('0x56')];queues[_0x57e25c[_0x8f41('0x42')]][_0x8f41('0x32')]=utils[_0x8f41('0x14')]();queues[_0x57e25c[_0x8f41('0x42')]]['queuecallerleaveAt']=utils['now']();queues[_0x57e25c[_0x8f41('0x42')]][_0x8f41('0x57')]=0x0;queues[_0x57e25c[_0x8f41('0x42')]][_0x8f41('0x58')]=0x0;utils[_0x8f41('0x3')](util[_0x8f41('0x4')](_0x8f41('0x59'),_0x57e25c[_0x8f41('0x4c')],queues[_0x57e25c[_0x8f41('0x42')]][_0x8f41('0x1b')],queues[_0x57e25c['transfereeuniqueid']][_0x8f41('0x9')],queues[_0x57e25c[_0x8f41('0x42')]][_0x8f41('0x56')]));}else{utils['info'](util[_0x8f41('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x57e25c[_0x8f41('0x4c')],queues[_0x57e25c[_0x8f41('0x4d')]][_0x8f41('0x1b')],_0x57e25c['secondtransfererlinkedid']));queues[_0x57e25c['origtransfererlinkedid']][_0x8f41('0xe')]=_0x57e25c['secondtransfererlinkedid'];}}}else if(_0x57e25c['secondtransfereruniqueid']==_0x57e25c[_0x8f41('0x4e')]){if(!_[_0x8f41('0x20')](queues[_0x57e25c[_0x8f41('0x4d')]])){utils[_0x8f41('0x3')](util[_0x8f41('0x4')](_0x8f41('0x5a'),_0x57e25c[_0x8f41('0x4c')],queues[_0x57e25c['origtransfererlinkedid']][_0x8f41('0x1b')],_0x57e25c[_0x8f41('0x5b')],_0x57e25c[_0x8f41('0x5c')]));queues[_0x57e25c[_0x8f41('0x4d')]][_0x8f41('0x3d')]=!![];queues[_0x57e25c[_0x8f41('0x4d')]][_0x8f41('0x43')]=_0x8f41('0x51');queues[_0x57e25c[_0x8f41('0x4d')]][_0x8f41('0x52')]=_0x57e25c[_0x8f41('0x5c')];queues[_0x57e25c[_0x8f41('0x4d')]][_0x8f41('0x46')]=_0x57e25c[_0x8f41('0x5b')];queues[_0x57e25c['origtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x57e25c[_0x8f41('0x4e')]])){if(_0x57e25c[_0x8f41('0x5d')]&&queues[_0x57e25c[_0x8f41('0x5d')]]){queues[_0x57e25c[_0x8f41('0x5d')]]['queuecallerenterreason']=0x1;queues[_0x57e25c['transfertargetuniqueid']]=_['clone'](queues[_0x57e25c['transfertargetlinkedid']]);queues[_0x57e25c[_0x8f41('0x55')]]['transfereduniqueid']=_0x57e25c['transfertargetuniqueid'];queues[_0x57e25c[_0x8f41('0x55')]][_0x8f41('0x1d')]=0x2;queues[_0x57e25c[_0x8f41('0x55')]]['calleridnum']=queues[_0x57e25c[_0x8f41('0x4d')]][_0x8f41('0x9')];queues[_0x57e25c['transfertargetuniqueid']][_0x8f41('0x56')]=queues[_0x57e25c[_0x8f41('0x4d')]][_0x8f41('0x56')];queues[_0x57e25c[_0x8f41('0x55')]][_0x8f41('0x32')]=utils['now']();queues[_0x57e25c['transfertargetuniqueid']][_0x8f41('0x16')]=utils[_0x8f41('0x14')]();queues[_0x57e25c[_0x8f41('0x55')]][_0x8f41('0x57')]=0x0;queues[_0x57e25c[_0x8f41('0x55')]]['mohtime']=0x0;utils[_0x8f41('0x3')](util[_0x8f41('0x4')](_0x8f41('0x5e'),_0x57e25c[_0x8f41('0x4c')],queues[_0x57e25c[_0x8f41('0x55')]][_0x8f41('0x1b')],queues[_0x57e25c[_0x8f41('0x55')]][_0x8f41('0xe')],queues[_0x57e25c[_0x8f41('0x55')]][_0x8f41('0x9')],queues[_0x57e25c['transfertargetuniqueid']][_0x8f41('0x56')]));}else{utils['info'](util[_0x8f41('0x4')](_0x8f41('0x5f'),_0x57e25c[_0x8f41('0x4c')],queues[_0x57e25c[_0x8f41('0x4e')]][_0x8f41('0x1b')],_0x57e25c[_0x8f41('0x4d')]));queues[_0x57e25c[_0x8f41('0x4e')]][_0x8f41('0xe')]=_0x57e25c[_0x8f41('0x4d')];}}}}catch(_0x153233){utils[_0x8f41('0x1e')](util[_0x8f41('0x4')](_0x8f41('0x4b'),_0x57e25c[_0x8f41('0x4c')]),_0x153233);}};exports[_0x8f41('0x60')]=function(_0x57270f){try{if(!_[_0x8f41('0x20')](queues[_0x57270f[_0x8f41('0x6')]])){utils[_0x8f41('0x10')](util[_0x8f41('0x4')]('[%s][queues][musiconholdstart]',_0x57270f['uniqueid']),_0x57270f);queues[_0x57270f[_0x8f41('0x6')]][_0x8f41('0x61')]=utils[_0x8f41('0x14')]();utils[_0x8f41('0x3')](util[_0x8f41('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x57270f[_0x8f41('0x6')],queues[_0x57270f[_0x8f41('0x6')]][_0x8f41('0x1b')],queues[_0x57270f[_0x8f41('0x6')]][_0x8f41('0x61')]));}}catch(_0x32ec7e){utils[_0x8f41('0x1e')](util[_0x8f41('0x4')]('[%s][queues][musiconholdstart]',_0x57270f[_0x8f41('0x6')]),_0x32ec7e);}};exports[_0x8f41('0x62')]=function(_0x2a5175){try{if(!_[_0x8f41('0x20')](queues[_0x2a5175[_0x8f41('0x6')]])){if(!_['isNil'](queues[_0x2a5175[_0x8f41('0x6')]][_0x8f41('0x61')])){utils['debug'](util[_0x8f41('0x4')](_0x8f41('0x63'),_0x2a5175[_0x8f41('0x6')]),_0x2a5175);queues[_0x2a5175[_0x8f41('0x6')]][_0x8f41('0x58')]+=utils['diffTime'](utils[_0x8f41('0x14')](),queues[_0x2a5175[_0x8f41('0x6')]][_0x8f41('0x61')]);utils['info'](util[_0x8f41('0x4')](_0x8f41('0x64'),_0x2a5175[_0x8f41('0x6')],queues[_0x2a5175[_0x8f41('0x6')]][_0x8f41('0x1b')],queues[_0x2a5175[_0x8f41('0x6')]][_0x8f41('0x58')]));delete queues[_0x2a5175[_0x8f41('0x6')]][_0x8f41('0x61')];}}}catch(_0x290bf){utils['error'](util[_0x8f41('0x4')]('[%s][queues][musiconholdstop]',_0x2a5175[_0x8f41('0x6')]),_0x290bf);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a4c3a2d..500ed56 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 _0x76ff=['hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','.WAV','find','monitors','push'];(function(_0x5ba736,_0x3470bb){var _0xa338e4=function(_0xbe305b){while(--_0xbe305b){_0x5ba736['push'](_0x5ba736['shift']());}};_0xa338e4(++_0x3470bb);}(_0x76ff,0x1d0));var _0xf76f=function(_0x1bfbdd,_0x475a12){_0x1bfbdd=_0x1bfbdd-0x0;var _0x4b4f37=_0x76ff[_0x1bfbdd];return _0x4b4f37;};'use strict';var _=require(_0xf76f('0x0'));var util=require(_0xf76f('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x358a62){var _0x3f2198;utils[_0xf76f('0x2')](util[_0xf76f('0x3')](_0xf76f('0x4'),_0x358a62[_0xf76f('0x5')]));if(transfers['blinds'][_0x358a62[_0xf76f('0x5')]]){_0x3f2198=_0x358a62[_0xf76f('0x5')];_0x358a62['uniqueid']=transfers[_0xf76f('0x6')][_0x358a62[_0xf76f('0x5')]][_0xf76f('0x7')];}if(_0x358a62[_0xf76f('0x8')]){utils[_0xf76f('0x9')](_0x358a62[_0xf76f('0x8')])[_0xf76f('0xa')](function(_0x1e19ba){if(_0x1e19ba){_0x358a62[_0xf76f('0xb')]=_0x1e19ba[_0xf76f('0xc')];_0x358a62['UserId']=_0x1e19ba['id'];}utils[_0xf76f('0xd')](_0xf76f('0xe'),_0x358a62);});}else{utils[_0xf76f('0xd')]('CreateVoiceRecording',_0x358a62);}if(_0x3f2198)delete transfers['blinds'][_0x3f2198];}exports[_0xf76f('0xf')]=function(_0x175987){try{utils[_0xf76f('0x10')](util[_0xf76f('0x3')](_0xf76f('0x11'),_0x175987[_0xf76f('0x5')]),_0x175987);if(_0x175987['uniqueid']==_0x175987[_0xf76f('0x12')]){utils[_0xf76f('0x2')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x175987[_0xf76f('0x5')],_0x175987[_0xf76f('0x13')],_0x175987[_0xf76f('0x14')]));recordings[_0x175987['uniqueid']]={'uniqueid':_0x175987[_0xf76f('0x5')],'accountcode':_0x175987[_0xf76f('0x8')],'exten':_0x175987[_0xf76f('0x14')],'context':_0x175987[_0xf76f('0x13')],'channel':_0x175987['channel'],'monitors':[]};}}catch(_0x4211a3){utils[_0xf76f('0x15')](util['format']('[%s][recordings][newchannel]',_0x175987['uniqueid']),_0x4211a3);}};exports[_0xf76f('0x16')]=function(_0x4984df){try{utils['debug'](util[_0xf76f('0x3')](_0xf76f('0x17'),_0x4984df[_0xf76f('0x5')]),_0x4984df);if(!_[_0xf76f('0x18')](recordings[_0x4984df[_0xf76f('0x5')]])&&_0x4984df[_0xf76f('0x19')]==0x6){utils[_0xf76f('0x2')](util['format'](_0xf76f('0x1a'),_0x4984df[_0xf76f('0x5')],_0x4984df[_0xf76f('0x13')],_0x4984df['channel']));}else if(!_[_0xf76f('0x18')](recordings[_0x4984df[_0xf76f('0x12')]])&&_0x4984df[_0xf76f('0x19')]==0x6&&_0x4984df[_0xf76f('0x13')]!=_0xf76f('0x1b')){utils[_0xf76f('0x2')](util[_0xf76f('0x3')](_0xf76f('0x1c'),_0x4984df['uniqueid'],_0x4984df[_0xf76f('0x12')],_0x4984df[_0xf76f('0x13')],_0x4984df['channel']));recordings[_0x4984df[_0xf76f('0x12')]]['accountcode']=_0x4984df[_0xf76f('0x8')];}}catch(_0x8f2d87){utils[_0xf76f('0x15')](util[_0xf76f('0x3')](_0xf76f('0x17'),_0x4984df['uniqueid']),_0x8f2d87);}};exports['varset']=function(_0x124618){try{if(!_[_0xf76f('0x18')](_0x124618[_0xf76f('0x1d')])&&!_['isNil'](_0x124618[_0xf76f('0x1d')][_0xf76f('0x1e')])){utils[_0xf76f('0x10')](util['format'](_0xf76f('0x1f'),_0x124618[_0xf76f('0x5')]),_0x124618);utils[_0xf76f('0x2')](util[_0xf76f('0x3')](_0xf76f('0x20'),_0x124618['uniqueid'],_0x124618[_0xf76f('0x1d')],_0x124618['value']));if(_[_0xf76f('0x21')](_0x124618[_0xf76f('0x22')],_0xf76f('0x23'))){_0x124618[_0xf76f('0x22')]=_0x124618[_0xf76f('0x22')]['replace'](_0xf76f('0x23'),_0xf76f('0x24'));}if(recordings[_0x124618[_0xf76f('0x12')]]){var _0x158c37=_[_0xf76f('0x25')](recordings[_0x124618[_0xf76f('0x12')]]['monitors'],{'value':_0x124618[_0xf76f('0x22')]});if(_['isNil'](_0x158c37)){recordings[_0x124618[_0xf76f('0x12')]][_0xf76f('0x26')][_0xf76f('0x27')]({'value':_0x124618[_0xf76f('0x22')]});}}}}catch(_0x1aff5d){utils[_0xf76f('0x15')](util['format'](_0xf76f('0x1f'),_0x124618[_0xf76f('0x5')]),_0x1aff5d);}};exports[_0xf76f('0x28')]=function(_0x1c9e06){try{if(!_[_0xf76f('0x18')](recordings[_0x1c9e06[_0xf76f('0x5')]])){utils[_0xf76f('0x10')](util[_0xf76f('0x3')]('[%s][recordings][hangup]',_0x1c9e06[_0xf76f('0x5')]),_0x1c9e06);utils[_0xf76f('0x2')](util[_0xf76f('0x3')](_0xf76f('0x29'),_0x1c9e06['uniqueid'],_0x1c9e06[_0xf76f('0x2a')],_0x1c9e06[_0xf76f('0x2b')],_0x1c9e06[_0xf76f('0x2c')]));recordings[_0x1c9e06[_0xf76f('0x5')]][_0xf76f('0x2a')]=_0x1c9e06[_0xf76f('0x2a')];recordings[_0x1c9e06[_0xf76f('0x5')]]['calleridname']=_0x1c9e06[_0xf76f('0x2b')];recordings[_0x1c9e06[_0xf76f('0x5')]][_0xf76f('0x2d')]=_0x1c9e06[_0xf76f('0x2d')];recordings[_0x1c9e06[_0xf76f('0x5')]][_0xf76f('0x2e')]=_0x1c9e06[_0xf76f('0x2e')];if(recordings[_0x1c9e06['uniqueid']]['type']==_0xf76f('0x2f')&&recordings[_0x1c9e06['uniqueid']][_0xf76f('0x8')]){recordings[_0x1c9e06[_0xf76f('0x5')]][_0xf76f('0x2d')]=recordings[_0x1c9e06[_0xf76f('0x5')]][_0xf76f('0x8')];recordings[_0x1c9e06[_0xf76f('0x5')]]['connectedlinename']='';}recordings[_0x1c9e06[_0xf76f('0x5')]][_0xf76f('0x26')]['forEach'](function(_0x2576a5){var _0x4ba46b=_[_0xf76f('0x30')](recordings[_0x1c9e06['uniqueid']]);_0x4ba46b[_0xf76f('0x22')]=_0x2576a5['value'];writeDB(_0x4ba46b);});delete recordings[_0x1c9e06[_0xf76f('0x5')]];}}catch(_0x5772b9){utils[_0xf76f('0x15')](util[_0xf76f('0x3')]('[%s][recordings][hangup]',_0x1c9e06['uniqueid']),_0x5772b9);}};exports[_0xf76f('0x31')]=function(_0x1d29b0){try{if(!_[_0xf76f('0x18')](recordings[_0x1d29b0['uniqueid']])){utils[_0xf76f('0x10')](util['format']('[%s][recordings][newexten]',_0x1d29b0['uniqueid']),_0x1d29b0);utils['info'](util[_0xf76f('0x3')](_0xf76f('0x32'),_0x1d29b0[_0xf76f('0x5')],_0x1d29b0[_0xf76f('0x33')],_0x1d29b0['appdata']));if(_0x1d29b0[_0xf76f('0x33')][_0xf76f('0x34')]()==_0xf76f('0x35')&&_[_0xf76f('0x36')](_0x1d29b0[_0xf76f('0x37')]['toLowerCase'](),'cdr')){var _0x116f38=_0x1d29b0[_0xf76f('0x37')][_0xf76f('0x38')]('=');var _0x37dae9=_0x116f38[0x0][_0xf76f('0x39')](_0x116f38[0x0][_0xf76f('0x3a')]('(')+0x1,_0x116f38[0x0][_0xf76f('0x3a')](')'));var _0x2bfa40=_0x116f38[0x1];recordings[_0x1d29b0[_0xf76f('0x5')]][_0x37dae9]=_0x2bfa40;}}}catch(_0x2820ad){utils[_0xf76f('0x15')](util[_0xf76f('0x3')](_0xf76f('0x3b'),_0x1d29b0[_0xf76f('0x5')]),_0x2820ad);}};exports[_0xf76f('0x3c')]=function(_0x5d0813){try{if(!_[_0xf76f('0x18')](recordings[_0x5d0813[_0xf76f('0x5')]])){utils[_0xf76f('0x10')](util['format'](_0xf76f('0x3d'),_0x5d0813['uniqueid']),_0x5d0813);utils['info'](util[_0xf76f('0x3')](_0xf76f('0x3e'),_0x5d0813['uniqueid'],_0x5d0813['queue']));recordings[_0x5d0813['uniqueid']][_0xf76f('0x3f')]=_0x5d0813[_0xf76f('0x3f')];}}catch(_0x46c32d){utils[_0xf76f('0x15')](util[_0xf76f('0x3')](_0xf76f('0x3d'),_0x5d0813[_0xf76f('0x5')]),_0x46c32d);}};exports[_0xf76f('0x40')]=function(_0x20f394){try{utils['debug'](util[_0xf76f('0x3')](_0xf76f('0x41'),_0x20f394[_0xf76f('0x5')]),_0x20f394);utils[_0xf76f('0x2')](util[_0xf76f('0x3')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x20f394[_0xf76f('0x5')],_0x20f394[_0xf76f('0x42')],_0x20f394[_0xf76f('0x43')],_0x20f394[_0xf76f('0x44')],_0x20f394[_0xf76f('0x45')]));if(recordings[_0x20f394[_0xf76f('0x46')]]&&transfers[_0xf76f('0x6')][_0x20f394[_0xf76f('0x46')]]){transfers[_0xf76f('0x6')][_0x20f394[_0xf76f('0x46')]][_0xf76f('0x47')]=!![];}}catch(_0x437ac7){utils[_0xf76f('0x15')](util[_0xf76f('0x3')](_0xf76f('0x41'),_0x20f394[_0xf76f('0x5')]),_0x437ac7);}}; \ No newline at end of file +var _0x51f2=['cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','debug','isNil','channelstate','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','.wav49','value','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','outbound','connectedlinename','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x51f2,0xe2));var _0x251f=function(_0x283e5b,_0x5af59a){_0x283e5b=_0x283e5b-0x0;var _0x3c5f8a=_0x51f2[_0x283e5b];return _0x3c5f8a;};'use strict';var _=require(_0x251f('0x0'));var util=require(_0x251f('0x1'));var utils=require('./utils');var transfers=require(_0x251f('0x2'));var recordings={};function writeDB(_0x4a9496){var _0x5509e2;utils[_0x251f('0x3')](util[_0x251f('0x4')](_0x251f('0x5'),_0x4a9496[_0x251f('0x6')]));if(transfers[_0x251f('0x7')][_0x4a9496[_0x251f('0x6')]]){_0x5509e2=_0x4a9496['uniqueid'];_0x4a9496[_0x251f('0x6')]=transfers[_0x251f('0x7')][_0x4a9496[_0x251f('0x6')]][_0x251f('0x8')];}if(_0x4a9496[_0x251f('0x9')]){utils[_0x251f('0xa')](_0x4a9496['accountcode'])['then'](function(_0x6f3374){if(_0x6f3374){_0x4a9496[_0x251f('0xb')]=_0x6f3374[_0x251f('0xc')];_0x4a9496[_0x251f('0xd')]=_0x6f3374['id'];}utils[_0x251f('0xe')](_0x251f('0xf'),_0x4a9496);});}else{utils[_0x251f('0xe')]('CreateVoiceRecording',_0x4a9496);}if(_0x5509e2)delete transfers[_0x251f('0x7')][_0x5509e2];}exports[_0x251f('0x10')]=function(_0xea39d0){try{utils['debug'](util[_0x251f('0x4')](_0x251f('0x11'),_0xea39d0[_0x251f('0x6')]),_0xea39d0);if(_0xea39d0[_0x251f('0x6')]==_0xea39d0[_0x251f('0x12')]){utils[_0x251f('0x3')](util[_0x251f('0x4')](_0x251f('0x13'),_0xea39d0['uniqueid'],_0xea39d0[_0x251f('0x14')],_0xea39d0['exten']));recordings[_0xea39d0[_0x251f('0x6')]]={'uniqueid':_0xea39d0[_0x251f('0x6')],'accountcode':_0xea39d0[_0x251f('0x9')],'exten':_0xea39d0[_0x251f('0x15')],'context':_0xea39d0[_0x251f('0x14')],'channel':_0xea39d0[_0x251f('0x16')],'monitors':[]};}}catch(_0x25b4ce){utils[_0x251f('0x17')](util[_0x251f('0x4')]('[%s][recordings][newchannel]',_0xea39d0['uniqueid']),_0x25b4ce);}};exports['newstate']=function(_0x689c6c){try{utils[_0x251f('0x18')](util['format']('[%s][recordings][newstate]',_0x689c6c[_0x251f('0x6')]),_0x689c6c);if(!_[_0x251f('0x19')](recordings[_0x689c6c[_0x251f('0x6')]])&&_0x689c6c[_0x251f('0x1a')]==0x6){utils[_0x251f('0x3')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x689c6c[_0x251f('0x6')],_0x689c6c['context'],_0x689c6c[_0x251f('0x16')]));}else if(!_[_0x251f('0x19')](recordings[_0x689c6c[_0x251f('0x12')]])&&_0x689c6c[_0x251f('0x1a')]==0x6&&_0x689c6c[_0x251f('0x14')]!=_0x251f('0x1b')){utils[_0x251f('0x3')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x689c6c[_0x251f('0x6')],_0x689c6c['linkedid'],_0x689c6c[_0x251f('0x14')],_0x689c6c[_0x251f('0x16')]));recordings[_0x689c6c[_0x251f('0x12')]][_0x251f('0x9')]=_0x689c6c[_0x251f('0x9')];}}catch(_0x359037){utils[_0x251f('0x17')](util[_0x251f('0x4')]('[%s][recordings][newstate]',_0x689c6c[_0x251f('0x6')]),_0x359037);}};exports[_0x251f('0x1c')]=function(_0xa2f4e9){try{if(!_['isNil'](_0xa2f4e9[_0x251f('0x1d')])&&!_[_0x251f('0x19')](_0xa2f4e9[_0x251f('0x1d')][_0x251f('0x1e')])){utils[_0x251f('0x18')](util['format'](_0x251f('0x1f'),_0xa2f4e9[_0x251f('0x6')]),_0xa2f4e9);utils[_0x251f('0x3')](util[_0x251f('0x4')](_0x251f('0x20'),_0xa2f4e9[_0x251f('0x6')],_0xa2f4e9[_0x251f('0x1d')],_0xa2f4e9['value']));if(_[_0x251f('0x21')](_0xa2f4e9['value'],_0x251f('0x22'))){_0xa2f4e9[_0x251f('0x23')]=_0xa2f4e9['value'][_0x251f('0x24')](_0x251f('0x22'),_0x251f('0x25'));}if(recordings[_0xa2f4e9['linkedid']]){var _0x2d36ce=_[_0x251f('0x26')](recordings[_0xa2f4e9[_0x251f('0x12')]][_0x251f('0x27')],{'value':_0xa2f4e9['value']});if(_[_0x251f('0x19')](_0x2d36ce)){recordings[_0xa2f4e9['linkedid']][_0x251f('0x27')][_0x251f('0x28')]({'value':_0xa2f4e9[_0x251f('0x23')]});}}}}catch(_0x4a7a56){utils[_0x251f('0x17')](util['format']('[%s][recordings][varset]',_0xa2f4e9[_0x251f('0x6')]),_0x4a7a56);}};exports['hangup']=function(_0x141332){try{if(!_[_0x251f('0x19')](recordings[_0x141332[_0x251f('0x6')]])){utils[_0x251f('0x18')](util[_0x251f('0x4')](_0x251f('0x29'),_0x141332['uniqueid']),_0x141332);utils[_0x251f('0x3')](util[_0x251f('0x4')](_0x251f('0x2a'),_0x141332[_0x251f('0x6')],_0x141332[_0x251f('0x2b')],_0x141332[_0x251f('0x2c')],_0x141332[_0x251f('0x2d')]));recordings[_0x141332[_0x251f('0x6')]]['calleridnum']=_0x141332[_0x251f('0x2b')];recordings[_0x141332[_0x251f('0x6')]][_0x251f('0x2c')]=_0x141332[_0x251f('0x2c')];recordings[_0x141332[_0x251f('0x6')]][_0x251f('0x2e')]=_0x141332[_0x251f('0x2e')];recordings[_0x141332[_0x251f('0x6')]]['connectedlinename']=_0x141332['connectedlinename'];if(recordings[_0x141332[_0x251f('0x6')]]['type']==_0x251f('0x2f')&&recordings[_0x141332[_0x251f('0x6')]][_0x251f('0x9')]){recordings[_0x141332[_0x251f('0x6')]]['connectedlinenum']=recordings[_0x141332['uniqueid']]['accountcode'];recordings[_0x141332[_0x251f('0x6')]][_0x251f('0x30')]='';}recordings[_0x141332[_0x251f('0x6')]][_0x251f('0x27')][_0x251f('0x31')](function(_0xc935c9){var _0x2e172e=_[_0x251f('0x32')](recordings[_0x141332['uniqueid']]);_0x2e172e['value']=_0xc935c9[_0x251f('0x23')];writeDB(_0x2e172e);});delete recordings[_0x141332[_0x251f('0x6')]];}}catch(_0x3f0cba){utils[_0x251f('0x17')](util[_0x251f('0x4')](_0x251f('0x29'),_0x141332[_0x251f('0x6')]),_0x3f0cba);}};exports['newexten']=function(_0x1dec72){try{if(!_[_0x251f('0x19')](recordings[_0x1dec72['uniqueid']])){utils[_0x251f('0x18')](util[_0x251f('0x4')](_0x251f('0x33'),_0x1dec72['uniqueid']),_0x1dec72);utils[_0x251f('0x3')](util[_0x251f('0x4')](_0x251f('0x34'),_0x1dec72[_0x251f('0x6')],_0x1dec72[_0x251f('0x35')],_0x1dec72[_0x251f('0x36')]));if(_0x1dec72[_0x251f('0x35')][_0x251f('0x37')]()==_0x251f('0x38')&&_[_0x251f('0x39')](_0x1dec72[_0x251f('0x36')]['toLowerCase'](),_0x251f('0x3a'))){var _0x42360d=_0x1dec72[_0x251f('0x36')]['split']('=');var _0x12e317=_0x42360d[0x0][_0x251f('0x3b')](_0x42360d[0x0]['lastIndexOf']('(')+0x1,_0x42360d[0x0][_0x251f('0x3c')](')'));var _0x1662e2=_0x42360d[0x1];recordings[_0x1dec72[_0x251f('0x6')]][_0x12e317]=_0x1662e2;}}}catch(_0x2d6bb8){utils[_0x251f('0x17')](util[_0x251f('0x4')](_0x251f('0x33'),_0x1dec72[_0x251f('0x6')]),_0x2d6bb8);}};exports['queuecallerjoin']=function(_0x3f5689){try{if(!_[_0x251f('0x19')](recordings[_0x3f5689[_0x251f('0x6')]])){utils[_0x251f('0x18')](util['format'](_0x251f('0x3d'),_0x3f5689[_0x251f('0x6')]),_0x3f5689);utils[_0x251f('0x3')](util[_0x251f('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x3f5689['uniqueid'],_0x3f5689[_0x251f('0x3e')]));recordings[_0x3f5689[_0x251f('0x6')]]['queue']=_0x3f5689[_0x251f('0x3e')];}}catch(_0x328356){utils[_0x251f('0x17')](util['format'](_0x251f('0x3d'),_0x3f5689[_0x251f('0x6')]),_0x328356);}};exports[_0x251f('0x3f')]=function(_0x21acc0){try{utils[_0x251f('0x18')](util[_0x251f('0x4')](_0x251f('0x40'),_0x21acc0[_0x251f('0x6')]),_0x21acc0);utils[_0x251f('0x3')](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x21acc0[_0x251f('0x6')],_0x21acc0[_0x251f('0x41')],_0x21acc0[_0x251f('0x42')],_0x21acc0[_0x251f('0x43')],_0x21acc0[_0x251f('0x44')]));if(recordings[_0x21acc0[_0x251f('0x45')]]&&transfers['blinds'][_0x21acc0[_0x251f('0x45')]]){transfers[_0x251f('0x7')][_0x21acc0[_0x251f('0x45')]][_0x251f('0x46')]=!![];}}catch(_0x2f7dd0){utils[_0x251f('0x17')](util[_0x251f('0x4')](_0x251f('0x40'),_0x21acc0['uniqueid']),_0x2f7dd0);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 779f44f..f27885f 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 _0x6ca9=['transfertargetexten','error','lodash','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','blinds','transfereruniqueid','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x3dda0f,_0x5b9902){var _0x1b0488=function(_0x267031){while(--_0x267031){_0x3dda0f['push'](_0x3dda0f['shift']());}};_0x1b0488(++_0x5b9902);}(_0x6ca9,0xb2));var _0x96ca=function(_0x227d98,_0x316df8){_0x227d98=_0x227d98-0x0;var _0xb60129=_0x6ca9[_0x227d98];return _0xb60129;};'use strict';var _=require(_0x96ca('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x3be155){utils['info'](util['format'](_0x96ca('0x1'),_0x3be155[_0x96ca('0x2')]===_0x96ca('0x3')?_0x3be155[_0x96ca('0x4')]:_0x3be155[_0x96ca('0x5')],_0x3be155[_0x96ca('0x2')]));utils[_0x96ca('0x6')](_0x96ca('0x7'),_0x3be155);}exports['blinds']={};exports[_0x96ca('0x8')]=function(_0x385ddc){try{utils[_0x96ca('0x9')](util[_0x96ca('0xa')](_0x96ca('0xb'),_0x385ddc['uniqueid']),_0x385ddc);utils['info'](util[_0x96ca('0xa')](_0x96ca('0xc'),_0x385ddc[_0x96ca('0x5')],_0x385ddc[_0x96ca('0xd')],_0x385ddc[_0x96ca('0xe')],_0x385ddc[_0x96ca('0xf')],_0x385ddc[_0x96ca('0x10')]));_0x385ddc[_0x96ca('0x2')]=_0x96ca('0x11');exports[_0x96ca('0x12')][_0x385ddc[_0x96ca('0x13')]]=_0x385ddc;writeDB(_0x385ddc);}catch(_0x5d6f3f){utils['error'](util[_0x96ca('0xa')]('[%s][transfers][blindtransfer]',_0x385ddc['uniqueid']),_0x5d6f3f);}};exports['attendedtransfer']=function(_0x2cd7f8){try{utils[_0x96ca('0x9')](util[_0x96ca('0xa')](_0x96ca('0x14'),_0x2cd7f8[_0x96ca('0x4')]),_0x2cd7f8);utils['info'](util[_0x96ca('0xa')](_0x96ca('0x15'),_0x2cd7f8[_0x96ca('0x4')],_0x2cd7f8[_0x96ca('0x16')],_0x2cd7f8[_0x96ca('0x17')],_0x2cd7f8[_0x96ca('0x18')],_0x2cd7f8[_0x96ca('0x19')]));_0x2cd7f8=_[_0x96ca('0x1a')](_0x2cd7f8,{'transfererchannel':_0x2cd7f8[_0x96ca('0x1b')],'transferercalleridnum':_0x2cd7f8[_0x96ca('0x16')],'transferercalleridname':_0x2cd7f8[_0x96ca('0x17')],'transfererconnectedlinenum':_0x2cd7f8[_0x96ca('0x1c')],'transfererconnectedlinename':_0x2cd7f8[_0x96ca('0x1d')],'transfereraccountcode':_0x2cd7f8[_0x96ca('0x1e')],'transferercontext':_0x2cd7f8[_0x96ca('0x1f')],'transfererexten':_0x2cd7f8[_0x96ca('0x20')],'transfererlinkedid':_0x2cd7f8[_0x96ca('0x21')],'context':_0x2cd7f8['origtransferercontext'],'extension':_0x2cd7f8[_0x96ca('0x22')],'type':_0x96ca('0x3')});if(_[_0x96ca('0x23')](_0x2cd7f8[_0x96ca('0x24')])){_0x2cd7f8=_['assign'](_0x2cd7f8,{'transfereechannel':_0x2cd7f8[_0x96ca('0x25')],'transfereecalleridnum':_0x2cd7f8[_0x96ca('0x18')],'transfereecalleridname':_0x2cd7f8[_0x96ca('0x19')],'transfereeconnectedlinenum':_0x2cd7f8[_0x96ca('0x26')],'transfereeconnectedlinename':_0x2cd7f8[_0x96ca('0x27')],'transfereeaccountcode':_0x2cd7f8[_0x96ca('0x28')],'transfereecontext':_0x2cd7f8[_0x96ca('0x29')],'transfereeexten':_0x2cd7f8[_0x96ca('0x2a')],'transfereelinkedid':_0x2cd7f8['transfertargetlinkedid']});}writeDB(_0x2cd7f8);}catch(_0x5dabc3){utils[_0x96ca('0x2b')](util[_0x96ca('0xa')](_0x96ca('0x14'),_0x2cd7f8[_0x96ca('0x4')]),_0x5dabc3);}}; \ No newline at end of file +var _0x2ba4=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum'];(function(_0xa7163a,_0x25b4df){var _0x2b68b7=function(_0xa5995c){while(--_0xa5995c){_0xa7163a['push'](_0xa7163a['shift']());}};_0x2b68b7(++_0x25b4df);}(_0x2ba4,0x143));var _0x42ba=function(_0x22fe0f,_0x16f057){_0x22fe0f=_0x22fe0f-0x0;var _0x4dea91=_0x2ba4[_0x22fe0f];return _0x4dea91;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x42ba('0x0'));function writeDB(_0x5187c6){utils[_0x42ba('0x1')](util[_0x42ba('0x2')](_0x42ba('0x3'),_0x5187c6[_0x42ba('0x4')]===_0x42ba('0x5')?_0x5187c6['origtransfereruniqueid']:_0x5187c6[_0x42ba('0x6')],_0x5187c6[_0x42ba('0x4')]));utils[_0x42ba('0x7')]('CreateVoiceTransferReport',_0x5187c6);}exports[_0x42ba('0x8')]={};exports['blindtransfer']=function(_0x57fac7){try{utils[_0x42ba('0x9')](util[_0x42ba('0x2')](_0x42ba('0xa'),_0x57fac7[_0x42ba('0x6')]),_0x57fac7);utils['info'](util[_0x42ba('0x2')](_0x42ba('0xb'),_0x57fac7[_0x42ba('0x6')],_0x57fac7[_0x42ba('0xc')],_0x57fac7[_0x42ba('0xd')],_0x57fac7[_0x42ba('0xe')],_0x57fac7[_0x42ba('0xf')]));_0x57fac7[_0x42ba('0x4')]=_0x42ba('0x10');exports[_0x42ba('0x8')][_0x57fac7[_0x42ba('0x11')]]=_0x57fac7;writeDB(_0x57fac7);}catch(_0x157a3b){utils[_0x42ba('0x12')](util[_0x42ba('0x2')]('[%s][transfers][blindtransfer]',_0x57fac7['uniqueid']),_0x157a3b);}};exports[_0x42ba('0x13')]=function(_0x2c5752){try{utils[_0x42ba('0x9')](util[_0x42ba('0x2')](_0x42ba('0x14'),_0x2c5752[_0x42ba('0x15')]),_0x2c5752);utils[_0x42ba('0x1')](util['format'](_0x42ba('0x16'),_0x2c5752[_0x42ba('0x15')],_0x2c5752['origtransferercalleridnum'],_0x2c5752['origtransferercalleridname'],_0x2c5752[_0x42ba('0x17')],_0x2c5752[_0x42ba('0x18')]));_0x2c5752=_[_0x42ba('0x19')](_0x2c5752,{'transfererchannel':_0x2c5752[_0x42ba('0x1a')],'transferercalleridnum':_0x2c5752[_0x42ba('0x1b')],'transferercalleridname':_0x2c5752['origtransferercalleridname'],'transfererconnectedlinenum':_0x2c5752['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2c5752[_0x42ba('0x1c')],'transfereraccountcode':_0x2c5752[_0x42ba('0x1d')],'transferercontext':_0x2c5752[_0x42ba('0x1e')],'transfererexten':_0x2c5752[_0x42ba('0x1f')],'transfererlinkedid':_0x2c5752[_0x42ba('0x20')],'context':_0x2c5752[_0x42ba('0x21')],'extension':_0x2c5752['origtransfererexten'],'type':'attended'});if(_[_0x42ba('0x22')](_0x2c5752[_0x42ba('0x23')])){_0x2c5752=_[_0x42ba('0x19')](_0x2c5752,{'transfereechannel':_0x2c5752['transfertargetchannel'],'transfereecalleridnum':_0x2c5752[_0x42ba('0x17')],'transfereecalleridname':_0x2c5752[_0x42ba('0x18')],'transfereeconnectedlinenum':_0x2c5752['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2c5752['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2c5752[_0x42ba('0x24')],'transfereecontext':_0x2c5752['transfertargetcontext'],'transfereeexten':_0x2c5752[_0x42ba('0x25')],'transfereelinkedid':_0x2c5752[_0x42ba('0x26')]});}writeDB(_0x2c5752);}catch(_0x45b3db){utils['error'](util[_0x42ba('0x2')]('[%s][transfers][attendedtransfer]',_0x2c5752[_0x42ba('0x15')]),_0x45b3db);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 57ca83d..87965f4 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 _0x2488=['found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','format','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s'];(function(_0x158945,_0x14c1bf){var _0xb5a32b=function(_0x16e096){while(--_0x16e096){_0x158945['push'](_0x158945['shift']());}};_0xb5a32b(++_0x14c1bf);}(_0x2488,0xaa));var _0x8248=function(_0x48ea83,_0xb7b30b){_0x48ea83=_0x48ea83-0x0;var _0x1f6925=_0x2488[_0x48ea83];return _0x1f6925;};'use strict';var BPromise=require(_0x8248('0x0'));var jayson=require(_0x8248('0x1'));var moment=require(_0x8248('0x2'));var util=require(_0x8248('0x3'));var client=jayson[_0x8248('0x4')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x8248('0x5'));exports[_0x8248('0x6')]=function(_0x55ab12,_0x58fdb0){logger[_0x8248('0x6')](_0x55ab12,_0x58fdb0?util[_0x8248('0x7')](_0x58fdb0,{'showHidden':![],'depth':null}):'');};exports[_0x8248('0x8')]=function(_0x3bfd06,_0x59f5d4){logger[_0x8248('0x8')](_0x3bfd06,_0x59f5d4?util['inspect'](_0x59f5d4,{'showHidden':![],'depth':null}):'');};exports[_0x8248('0x9')]=function(_0x5d0ea5,_0x38ea37){logger['error'](_0x5d0ea5,_0x38ea37?util['inspect'](_0x38ea37,{'showHidden':![],'depth':null}):'');};exports[_0x8248('0xa')]=function(_0x35d9ab,_0x15694a){return client['request'](_0x35d9ab,{'body':_0x15694a})[_0x8248('0xb')](function(_0x188c08){logger['debug'](_0x8248('0xc'),_0x35d9ab,_0x188c08?util[_0x8248('0x7')](_0x188c08,{'showHidden':![],'depth':null}):'');})[_0x8248('0xd')](function(_0x5b224f){logger[_0x8248('0x9')](_0x8248('0xc'),_0x35d9ab,_0x5b224f?util[_0x8248('0x7')](_0x5b224f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x567a34){return client[_0x8248('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x8248('0xe'),_0x8248('0xf'),_0x8248('0x10')],'where':_0x567a34,'limit':0x1}})[_0x8248('0xb')](function(_0x111dd5){logger[_0x8248('0x8')](_0x8248('0x11'),JSON['stringify'](_0x567a34),_0x111dd5?util[_0x8248('0x7')](_0x111dd5,{'showHidden':![],'depth':null}):'');return _0x111dd5[_0x8248('0x12')][_0x8248('0x13')]?_0x111dd5[_0x8248('0x12')][0x0]:null;});}exports[_0x8248('0x14')]=function(_0x23a1ee){return new BPromise(function(_0x1680ec,_0x415b12){if(_0x23a1ee){return getUser({'internal':_0x23a1ee})[_0x8248('0xb')](function(_0x901f07){logger[_0x8248('0x6')](_0x8248('0x15'),_0x23a1ee,_0x901f07?_0x8248('0x16'):_0x8248('0x17'));return _0x1680ec(_0x901f07);})[_0x8248('0xd')](function(_0x501f91){logger[_0x8248('0x9')](_0x8248('0x18'),_0x501f91?util[_0x8248('0x7')](_0x501f91,{'showHidden':![],'depth':null}):'');return _0x1680ec(null);});}return _0x1680ec(null);});};exports[_0x8248('0x19')]=function(_0x44841e){return new BPromise(function(_0x142ba3,_0x2f8d25){if(_0x44841e){return getUser({'interface':_0x44841e})[_0x8248('0xb')](function(_0x161758){logger[_0x8248('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x44841e,_0x161758?_0x8248('0x16'):'notfound');return _0x142ba3(_0x161758);})[_0x8248('0xd')](function(_0x1acf2d){logger[_0x8248('0x9')](_0x8248('0x1a'),_0x1acf2d?util['inspect'](_0x1acf2d,{'showHidden':![],'depth':null}):'');return _0x142ba3(null);});}return _0x142ba3(null);});};exports[_0x8248('0x1b')]=function(_0x2a12c3){return new BPromise(function(_0x412a30,_0x3e8a4a){if(_0x2a12c3){return getUser({'name':_0x2a12c3})[_0x8248('0xb')](function(_0x5d7d79){logger[_0x8248('0x6')](_0x8248('0x1c'),_0x2a12c3,_0x5d7d79?'found':_0x8248('0x17'));return _0x412a30(_0x5d7d79);})[_0x8248('0xd')](function(_0x40c11a){logger[_0x8248('0x9')](_0x8248('0x1d'),_0x40c11a?util[_0x8248('0x7')](_0x40c11a,{'showHidden':![],'depth':null}):'');return _0x412a30(null);});}return _0x412a30(null);});};exports[_0x8248('0x1e')]=function(_0x3b2ce3){return new BPromise(function(_0x5ca495,_0x138b9b){if(_0x3b2ce3){return client[_0x8248('0xa')](_0x8248('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x8248('0xf'),'type','acw',_0x8248('0x20')],'where':{'name':_0x3b2ce3},'limit':0x1}})[_0x8248('0xb')](function(_0x5a9757){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x3b2ce3,_0x5a9757?util[_0x8248('0x7')](_0x5a9757,{'showHidden':![],'depth':null}):'');logger[_0x8248('0x6')](_0x8248('0x21'),_0x3b2ce3,_0x5a9757?'found':'notfound');return _0x5ca495(_0x5a9757['result'][_0x8248('0x13')]?_0x5a9757[_0x8248('0x12')][0x0]:null);})[_0x8248('0xd')](function(_0x1f1209){logger[_0x8248('0x9')](_0x8248('0x22'),_0x1f1209?util[_0x8248('0x7')](_0x1f1209,{'showHidden':![],'depth':null}):'');return _0x5ca495(null);});}return _0x5ca495(null);});};exports[_0x8248('0x23')]=function(_0x5d2054,_0x5d6df1){return moment(_0x5d2054)[_0x8248('0x24')](_0x5d6df1,_0x8248('0x25'))['format'](_0x8248('0x26'));};exports[_0x8248('0x27')]=function(_0x262ade,_0x5b6b9c){return moment(_0x262ade)[_0x8248('0x28')](_0x5b6b9c,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x8248('0x29')]=function(_0x4870a7,_0x219894){return moment(_0x4870a7)[_0x8248('0x2a')](moment(_0x219894),_0x8248('0x25'));};exports[_0x8248('0x2b')]=function(_0x46bc00,_0x4a04ee){return parseInt(_0x46bc00,0xa)+parseInt(_0x4a04ee,0xa);};exports[_0x8248('0x2c')]=function(){return moment()[_0x8248('0x2d')](_0x8248('0x26'));};exports[_0x8248('0x2e')]=function(_0x3bf469,_0x62bb01){if(_0x62bb01){return moment(_0x3bf469)[_0x8248('0x2e')](_0x62bb01);}return!![];};exports[_0x8248('0x2f')]=function(_0x2b03d2,_0x152681){if(_0x152681){return moment(_0x2b03d2)[_0x8248('0x2f')](_0x152681);}else if(_0x2b03d2){return!![];}return![];}; \ No newline at end of file +var _0x6397=['inspect','debug','error','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','request','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info'];(function(_0x41c8a5,_0x334148){var _0x538e82=function(_0x5d0461){while(--_0x5d0461){_0x41c8a5['push'](_0x41c8a5['shift']());}};_0x538e82(++_0x334148);}(_0x6397,0xbf));var _0x7639=function(_0x14ec75,_0x56a3d4){_0x14ec75=_0x14ec75-0x0;var _0x40b9e9=_0x6397[_0x14ec75];return _0x40b9e9;};'use strict';var BPromise=require(_0x7639('0x0'));var jayson=require(_0x7639('0x1'));var moment=require(_0x7639('0x2'));var util=require(_0x7639('0x3'));var client=jayson[_0x7639('0x4')][_0x7639('0x5')]({'port':0x2329});var logger=require(_0x7639('0x6'))(_0x7639('0x7'));exports['info']=function(_0x136de2,_0x50916a){logger[_0x7639('0x8')](_0x136de2,_0x50916a?util[_0x7639('0x9')](_0x50916a,{'showHidden':![],'depth':null}):'');};exports[_0x7639('0xa')]=function(_0x1cba31,_0x598f27){logger[_0x7639('0xa')](_0x1cba31,_0x598f27?util[_0x7639('0x9')](_0x598f27,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0xc0db52,_0x24132b){logger[_0x7639('0xb')](_0xc0db52,_0x24132b?util['inspect'](_0x24132b,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0xd58a81,_0x147ac4){return client['request'](_0xd58a81,{'body':_0x147ac4})[_0x7639('0xc')](function(_0x6ce83e){logger[_0x7639('0xa')](_0x7639('0xd'),_0xd58a81,_0x6ce83e?util[_0x7639('0x9')](_0x6ce83e,{'showHidden':![],'depth':null}):'');})[_0x7639('0xe')](function(_0x33354f){logger['error'](_0x7639('0xd'),_0xd58a81,_0x33354f?util['inspect'](_0x33354f,{'showHidden':![],'depth':null}):'');});};function getUser(_0x9802ea){return client['request'](_0x7639('0xf'),{'options':{'raw':!![],'attributes':['id',_0x7639('0x10'),_0x7639('0x11'),_0x7639('0x12')],'where':_0x9802ea,'limit':0x1}})['then'](function(_0x3462fb){logger['debug'](_0x7639('0x13'),JSON[_0x7639('0x14')](_0x9802ea),_0x3462fb?util[_0x7639('0x9')](_0x3462fb,{'showHidden':![],'depth':null}):'');return _0x3462fb[_0x7639('0x15')]['length']?_0x3462fb['result'][0x0]:null;});}exports[_0x7639('0x16')]=function(_0xe3e357){return new BPromise(function(_0x204745,_0x378615){if(_0xe3e357){return getUser({'internal':_0xe3e357})[_0x7639('0xc')](function(_0x3c0db5){logger[_0x7639('0x8')](_0x7639('0x17'),_0xe3e357,_0x3c0db5?_0x7639('0x18'):_0x7639('0x19'));return _0x204745(_0x3c0db5);})[_0x7639('0xe')](function(_0x3ecedc){logger[_0x7639('0xb')](_0x7639('0x1a'),_0x3ecedc?util[_0x7639('0x9')](_0x3ecedc,{'showHidden':![],'depth':null}):'');return _0x204745(null);});}return _0x204745(null);});};exports['getUserByInterface']=function(_0x4bc2d9){return new BPromise(function(_0x3d67d6,_0x3dfebb){if(_0x4bc2d9){return getUser({'interface':_0x4bc2d9})[_0x7639('0xc')](function(_0x43a527){logger[_0x7639('0x8')](_0x7639('0x1b'),_0x4bc2d9,_0x43a527?_0x7639('0x18'):_0x7639('0x19'));return _0x3d67d6(_0x43a527);})['catch'](function(_0x4ee609){logger['error'](_0x7639('0x1c'),_0x4ee609?util[_0x7639('0x9')](_0x4ee609,{'showHidden':![],'depth':null}):'');return _0x3d67d6(null);});}return _0x3d67d6(null);});};exports[_0x7639('0x1d')]=function(_0x40da1a){return new BPromise(function(_0x555e4a,_0x3c54dd){if(_0x40da1a){return getUser({'name':_0x40da1a})[_0x7639('0xc')](function(_0x36c860){logger[_0x7639('0x8')](_0x7639('0x1e'),_0x40da1a,_0x36c860?_0x7639('0x18'):'notfound');return _0x555e4a(_0x36c860);})['catch'](function(_0x1cf7e5){logger[_0x7639('0xb')]('[utils][getUserByName]',_0x1cf7e5?util['inspect'](_0x1cf7e5,{'showHidden':![],'depth':null}):'');return _0x555e4a(null);});}return _0x555e4a(null);});};exports['getVoiceQueueByName']=function(_0xe51772){return new BPromise(function(_0x5e5924,_0x25d2d4){if(_0xe51772){return client[_0x7639('0x1f')](_0x7639('0x20'),{'options':{'raw':!![],'attributes':['id',_0x7639('0x11'),_0x7639('0x21'),_0x7639('0x22'),_0x7639('0x23')],'where':{'name':_0xe51772},'limit':0x1}})[_0x7639('0xc')](function(_0x3b2726){logger[_0x7639('0xa')](_0x7639('0x24'),_0xe51772,_0x3b2726?util['inspect'](_0x3b2726,{'showHidden':![],'depth':null}):'');logger['info'](_0x7639('0x25'),_0xe51772,_0x3b2726?'found':_0x7639('0x19'));return _0x5e5924(_0x3b2726[_0x7639('0x15')]['length']?_0x3b2726[_0x7639('0x15')][0x0]:null);})[_0x7639('0xe')](function(_0x2c6eb0){logger[_0x7639('0xb')](_0x7639('0x26'),_0x2c6eb0?util['inspect'](_0x2c6eb0,{'showHidden':![],'depth':null}):'');return _0x5e5924(null);});}return _0x5e5924(null);});};exports[_0x7639('0x27')]=function(_0x2fde8d,_0x2eb083){return moment(_0x2fde8d)[_0x7639('0x28')](_0x2eb083,_0x7639('0x29'))['format'](_0x7639('0x2a'));};exports[_0x7639('0x2b')]=function(_0x159da2,_0x1f4ad7){return moment(_0x159da2)[_0x7639('0x2c')](_0x1f4ad7,'seconds')[_0x7639('0x2d')](_0x7639('0x2a'));};exports[_0x7639('0x2e')]=function(_0x321798,_0x25746a){return moment(_0x321798)['diff'](moment(_0x25746a),_0x7639('0x29'));};exports[_0x7639('0x2f')]=function(_0x2f2fb9,_0x4cf3b1){return parseInt(_0x2f2fb9,0xa)+parseInt(_0x4cf3b1,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7639('0x30')]=function(_0x2a1cd8,_0x1eb8e2){if(_0x1eb8e2){return moment(_0x2a1cd8)[_0x7639('0x30')](_0x1eb8e2);}return!![];};exports[_0x7639('0x31')]=function(_0x37d6c5,_0x255cbe){if(_0x255cbe){return moment(_0x37d6c5)[_0x7639('0x31')](_0x255cbe);}else if(_0x37d6c5){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 9018ee6..8c661ce 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ab5=['/var','log','xcally','join','role','name','ensureDir','then','client','catch','user','no-user','timestamp','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','logger','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','device','other','agent_name','test','setupLoggers','fs-extra','express-winston','util','fileLogger','./safe-template','./mask-sensitive-data'];(function(_0x2290c3,_0x4b28bf){var _0x1d3b6e=function(_0x1fef5a){while(--_0x1fef5a){_0x2290c3['push'](_0x2290c3['shift']());}};_0x1d3b6e(++_0x4b28bf);}(_0x2ab5,0x162));var _0x52ab=function(_0x17899a,_0x574d97){_0x17899a=_0x17899a-0x0;var _0xe5b45a=_0x2ab5[_0x17899a];return _0xe5b45a;};var fs=require(_0x52ab('0x0'));var _=require('lodash');var ewinston=require(_0x52ab('0x1'));var path=require('path');var util=require(_0x52ab('0x2'));var fileLogger=require('./loggers')[_0x52ab('0x3')];var safeTemplate=require(_0x52ab('0x4'))['safeTemplate'];var maskSensitiveData=require(_0x52ab('0x5'))['maskSensitiveData'];function ClientSideLogger(){function _0x1c972c(_0x535c40){var _0x523ce4=path['join'](_0x52ab('0x6'),_0x52ab('0x7'),_0x52ab('0x8'));var _0x39b9c2=path[_0x52ab('0x9')]('client',_0x535c40[_0x52ab('0xa')]+'-'+_0x535c40[_0x52ab('0xb')]);return fs[_0x52ab('0xc')](path[_0x52ab('0x9')](_0x523ce4,_0x39b9c2))[_0x52ab('0xd')](function(){var _0x55f5e7=fileLogger(_0x52ab('0xe'),path[_0x52ab('0x9')](_0x523ce4,_0x39b9c2));return _0x55f5e7;})[_0x52ab('0xf')](function(_0x4c0f1c){throw _0x4c0f1c;});}this[_0x52ab('0x7')]=function(_0x287d8c,_0x226a25,_0x304a6c,_0x266303){return _0x1c972c(_0x287d8c[_0x52ab('0x10')])[_0x52ab('0xd')](function(_0xc3fa6d){var _0x50d760=_0xc3fa6d[_0x226a25];return _0x50d760;})[_0x52ab('0xd')](function(_0x34188b){var _0x786f5f=_0x287d8c[_0x52ab('0x10')]?_0x287d8c[_0x52ab('0x10')]['id']:_0x52ab('0x11');var _0xc2e38=_0x266303['data'];var _0x2fb498=_0x266303[_0x52ab('0x12')];var _0x4c7a88=new Date(Number(_0x2fb498));return _0x34188b(_0x786f5f,_0x4c7a88,_0x304a6c,_0xc2e38);})[_0x52ab('0xf')](function(_0x4e30e7){fileLogger('client')[_0x52ab('0x13')](_0x4e30e7);});};}function setupLoggers(_0xf21419){return new Promise(function(_0x5e0ebd){var _0x4cba84=new ClientSideLogger();var _0x1c894e=fileLogger(_0x52ab('0x14'));var _0x3ae5a5=fileLogger(_0x52ab('0x15'));_0xf21419[_0x52ab('0x16')](_0x52ab('0x17'),_0x4cba84);_0xf21419[_0x52ab('0x18')](ewinston['logger']({'winstonInstance':_0x1c894e,'meta':![],'statusLevels':!![],'msg':function(_0x3a3b21,_0x2dc128){var _0x1a7210=_0x52ab('0x19');if(!_['isEmpty'](_0x3a3b21[_0x52ab('0x1a')])){_0x1a7210+='\x20body=%s';var _0x488b79=_0x3a3b21[_0x52ab('0x1a')];maskSensitiveData(_0x488b79);}return safeTemplate(util[_0x52ab('0x1b')](_0x1a7210,_0x3a3b21[_0x52ab('0x1c')],_0x3a3b21[_0x52ab('0x1d')][_0x52ab('0x1e')]?_0x3a3b21[_0x52ab('0x1d')][_0x52ab('0x1e')]:_0x3a3b21[_0x52ab('0x1f')][_0x52ab('0x20')]||_0x3a3b21['ip'],_0x3a3b21[_0x52ab('0x21')],_0x2dc128[_0x52ab('0x22')],_0x2dc128['responseTime'],_0x3a3b21[_0x52ab('0x10')]?_0x3a3b21['user']['id']:null,_0x3a3b21[_0x52ab('0x10')]?_0x3a3b21['user']['name']:null,_0x3a3b21[_0x52ab('0x10')]?_0x3a3b21[_0x52ab('0x10')][_0x52ab('0xa')]:null,_0x488b79?util[_0x52ab('0x23')](_0x488b79,![],null):''));}}));_0xf21419['use'](ewinston[_0x52ab('0x24')]({'winstonInstance':_0x3ae5a5,'meta':![],'statusLevels':!![],'msg':function(_0x2b777b,_0x16d1b3){var _0x285f2a='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2b777b[_0x52ab('0x1a')]&&_0x2b777b[_0x52ab('0x1a')]['device']&&_0x2b777b[_0x52ab('0x1a')][_0x52ab('0x25')]){_0x285f2a=_0x52ab('0x26');}return util[_0x52ab('0x1b')](_0x285f2a,_0x2b777b[_0x52ab('0x1c')],_0x2b777b[_0x52ab('0x1d')]['x-forwarded-for']?_0x2b777b[_0x52ab('0x1d')]['x-forwarded-for']:_0x2b777b[_0x52ab('0x1f')][_0x52ab('0x20')]||_0x2b777b['ip'],_0x2b777b[_0x52ab('0x21')],_0x16d1b3['statusCode'],_0x16d1b3[_0x52ab('0x27')],_0x2b777b['user']?_0x2b777b['user']['id']:null,_0x2b777b['user']?_0x2b777b['user']['name']:null,_0x2b777b[_0x52ab('0x10')]?_0x2b777b[_0x52ab('0x10')]['role']:null,_0x2b777b[_0x52ab('0x1a')]&&_0x2b777b[_0x52ab('0x1a')][_0x52ab('0x28')]?_0x2b777b[_0x52ab('0x1a')][_0x52ab('0x28')]:_0x52ab('0x29'),_0x2b777b['body']&&_0x2b777b[_0x52ab('0x1a')][_0x52ab('0x25')]?_0x2b777b[_0x52ab('0x1a')][_0x52ab('0x25')]:'',_0x2b777b[_0x52ab('0x1a')]&&_0x2b777b[_0x52ab('0x1a')]['agent_name']?_0x2b777b[_0x52ab('0x1a')][_0x52ab('0x2a')]:'');},'ignoreRoute':function(_0xcdc3d8){var _0x3f7b61=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3f7b61[_0x52ab('0x2b')](_0xcdc3d8['url']);}}));return _0x5e0ebd();});}exports[_0x52ab('0x2c')]=setupLoggers; \ No newline at end of file +var _0x6b82=['headers','x-forwarded-for','url','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','connection','remoteAddress','device','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','no-user','data','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method'];(function(_0x45e857,_0x181403){var _0x2de1b9=function(_0x1c4c92){while(--_0x1c4c92){_0x45e857['push'](_0x45e857['shift']());}};_0x2de1b9(++_0x181403);}(_0x6b82,0xd8));var _0x26b8=function(_0x1f42bc,_0x208463){_0x1f42bc=_0x1f42bc-0x0;var _0x23f159=_0x6b82[_0x1f42bc];return _0x23f159;};var fs=require(_0x26b8('0x0'));var _=require(_0x26b8('0x1'));var ewinston=require(_0x26b8('0x2'));var path=require(_0x26b8('0x3'));var util=require(_0x26b8('0x4'));var fileLogger=require(_0x26b8('0x5'))['fileLogger'];var safeTemplate=require('./safe-template')[_0x26b8('0x6')];var maskSensitiveData=require(_0x26b8('0x7'))[_0x26b8('0x8')];function ClientSideLogger(){function _0x253b8d(_0x2c8a95){var _0x55aab3=path[_0x26b8('0x9')](_0x26b8('0xa'),_0x26b8('0xb'),_0x26b8('0xc'));var _0x52d1a1=path[_0x26b8('0x9')](_0x26b8('0xd'),_0x2c8a95[_0x26b8('0xe')]+'-'+_0x2c8a95[_0x26b8('0xf')]);return fs[_0x26b8('0x10')](path[_0x26b8('0x9')](_0x55aab3,_0x52d1a1))[_0x26b8('0x11')](function(){var _0x3a191c=fileLogger('client',path[_0x26b8('0x9')](_0x55aab3,_0x52d1a1));return _0x3a191c;})[_0x26b8('0x12')](function(_0x23797e){throw _0x23797e;});}this[_0x26b8('0xb')]=function(_0x5cdddd,_0x4b4267,_0x2b5f04,_0x572832){return _0x253b8d(_0x5cdddd[_0x26b8('0x13')])[_0x26b8('0x11')](function(_0x2ce8a8){var _0x277c11=_0x2ce8a8[_0x4b4267];return _0x277c11;})[_0x26b8('0x11')](function(_0x37db81){var _0x225b4e=_0x5cdddd[_0x26b8('0x13')]?_0x5cdddd[_0x26b8('0x13')]['id']:_0x26b8('0x14');var _0x494a63=_0x572832[_0x26b8('0x15')];var _0x36e7d5=_0x572832['timestamp'];var _0x4a54b9=new Date(Number(_0x36e7d5));return _0x37db81(_0x225b4e,_0x4a54b9,_0x2b5f04,_0x494a63);})[_0x26b8('0x12')](function(_0x31cfeb){fileLogger(_0x26b8('0xd'))[_0x26b8('0x16')](_0x31cfeb);});};}function setupLoggers(_0x38fede){return new Promise(function(_0x6c50ee){var _0x16cdf4=new ClientSideLogger();var _0x4c1826=fileLogger(_0x26b8('0x17'));var _0x4377a2=fileLogger(_0x26b8('0x18'));_0x38fede[_0x26b8('0x19')](_0x26b8('0x1a'),_0x16cdf4);_0x38fede[_0x26b8('0x1b')](ewinston[_0x26b8('0x1c')]({'winstonInstance':_0x4c1826,'meta':![],'statusLevels':!![],'msg':function(_0x4c96d2,_0x290031){var _0x3fb84b=_0x26b8('0x1d');if(!_[_0x26b8('0x1e')](_0x4c96d2[_0x26b8('0x1f')])){_0x3fb84b+=_0x26b8('0x20');var _0x5ea19f=_0x4c96d2[_0x26b8('0x1f')];maskSensitiveData(_0x5ea19f);}return safeTemplate(util['format'](_0x3fb84b,_0x4c96d2[_0x26b8('0x21')],_0x4c96d2[_0x26b8('0x22')]['x-forwarded-for']?_0x4c96d2['headers'][_0x26b8('0x23')]:_0x4c96d2['connection']['remoteAddress']||_0x4c96d2['ip'],_0x4c96d2[_0x26b8('0x24')],_0x290031['statusCode'],_0x290031[_0x26b8('0x25')],_0x4c96d2[_0x26b8('0x13')]?_0x4c96d2[_0x26b8('0x13')]['id']:null,_0x4c96d2[_0x26b8('0x13')]?_0x4c96d2['user'][_0x26b8('0xf')]:null,_0x4c96d2[_0x26b8('0x13')]?_0x4c96d2[_0x26b8('0x13')][_0x26b8('0xe')]:null,_0x5ea19f?util[_0x26b8('0x26')](_0x5ea19f,![],null):''));}}));_0x38fede[_0x26b8('0x1b')](ewinston[_0x26b8('0x1c')]({'winstonInstance':_0x4377a2,'meta':![],'statusLevels':!![],'msg':function(_0x5750f6,_0x261d88){var _0x3f6000=_0x26b8('0x27');if(_0x5750f6['body']&&_0x5750f6[_0x26b8('0x1f')]['device']&&_0x5750f6[_0x26b8('0x1f')][_0x26b8('0x28')]){_0x3f6000=_0x26b8('0x29');}return util[_0x26b8('0x2a')](_0x3f6000,_0x5750f6[_0x26b8('0x21')],_0x5750f6[_0x26b8('0x22')][_0x26b8('0x23')]?_0x5750f6[_0x26b8('0x22')][_0x26b8('0x23')]:_0x5750f6[_0x26b8('0x2b')][_0x26b8('0x2c')]||_0x5750f6['ip'],_0x5750f6[_0x26b8('0x24')],_0x261d88['statusCode'],_0x261d88[_0x26b8('0x25')],_0x5750f6[_0x26b8('0x13')]?_0x5750f6[_0x26b8('0x13')]['id']:null,_0x5750f6['user']?_0x5750f6[_0x26b8('0x13')]['name']:null,_0x5750f6[_0x26b8('0x13')]?_0x5750f6[_0x26b8('0x13')][_0x26b8('0xe')]:null,_0x5750f6[_0x26b8('0x1f')]&&_0x5750f6[_0x26b8('0x1f')][_0x26b8('0x2d')]?_0x5750f6[_0x26b8('0x1f')][_0x26b8('0x2d')]:_0x26b8('0x2e'),_0x5750f6[_0x26b8('0x1f')]&&_0x5750f6[_0x26b8('0x1f')][_0x26b8('0x28')]?_0x5750f6['body'][_0x26b8('0x28')]:'',_0x5750f6[_0x26b8('0x1f')]&&_0x5750f6[_0x26b8('0x1f')][_0x26b8('0x2f')]?_0x5750f6[_0x26b8('0x1f')][_0x26b8('0x2f')]:'');},'ignoreRoute':function(_0x347120){var _0x1579c8=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1579c8[_0x26b8('0x30')](_0x347120[_0x26b8('0x24')]);}}));return _0x6c50ee();});}exports[_0x26b8('0x31')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 272a590..08b25f4 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbac=['guess','isMoment','padStart','length','lodash','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','locale','weekdaysShort','indexOf','slice','concat','exports','monthsShort','toLowerCase','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','ddd','includes','dowCompare','date','daysInMonth','max','domCompare','format','MMM'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0xfbac,0x176));var _0xcfba=function(_0x386d91,_0x4beae5){_0x386d91=_0x386d91-0x0;var _0xaa0ce9=_0xfbac[_0x386d91];return _0xaa0ce9;};var _=require(_0xcfba('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xcfba('0x1')](function(_0x7af3b4){return _0x7af3b4[_0xcfba('0x2')];})[_0xcfba('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xcfba('0x4');var EINVALID_DATE=_0xcfba('0x5');function throwIfDateNotValid(_0x4b6a76){if(!_0x4b6a76['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x46ea37){var _0x22f0e9=_0x46ea37[_0xcfba('0x6')](':')[_0xcfba('0x1')](function(_0x41230a){return parseInt(_0x41230a,0xa);});var _0x830ea7=_0x22f0e9[0x0];var _0x2c4c6e=_0x22f0e9[0x1];if(_0x830ea7<0x0||_0x830ea7>0x17||_0x2c4c6e<0x0||_0x2c4c6e>0x3b){throw new Error(EINVALID_DATE);}return[_0x830ea7,_0x2c4c6e];}function circularDoWInterval(_0x1a2873,_0x2b5bbd){if(_0x1a2873===_0x2b5bbd){return[_0x1a2873];}else{var _0x12dc7d=moment['locale']();moment[_0xcfba('0x7')]('en');var _0x271390=moment[_0xcfba('0x8')]()[_0xcfba('0x1')](function(_0x5b0ea0){return _0x5b0ea0['toLowerCase']();});moment[_0xcfba('0x7')](_0x12dc7d);var _0x53539f=_0x271390['indexOf'](_0x1a2873);var _0x1b8797=_0x271390[_0xcfba('0x9')](_0x2b5bbd);if(_0x1b8797>_0x53539f){return _0x271390[_0xcfba('0xa')](_0x53539f,_0x1b8797+0x1);}else{var _0x28d2ba=_0x271390[_0xcfba('0xa')](0x0,_0x1b8797+0x1);var _0x274630=_0x271390['slice'](_0x53539f);return _0x274630[_0xcfba('0xb')](_0x28d2ba);}}}module[_0xcfba('0xc')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x1223b3,_0x2aecbd){if(_0x1223b3===_0x2aecbd){return[_0x1223b3];}else{var _0x246d79=moment[_0xcfba('0x7')]();moment[_0xcfba('0x7')]('en');var _0x26ba69=moment[_0xcfba('0xd')]()[_0xcfba('0x1')](function(_0xe7fac0){return _0xe7fac0[_0xcfba('0xe')]();});moment[_0xcfba('0x7')](_0x246d79);var _0x2c20b0=_0x26ba69[_0xcfba('0x9')](_0x1223b3);var _0x559e4c=_0x26ba69[_0xcfba('0x9')](_0x2aecbd);if(_0x559e4c>_0x2c20b0){return _0x26ba69['slice'](_0x2c20b0,_0x559e4c+0x1);}else{var _0x327b41=_0x26ba69[_0xcfba('0xa')](0x0,_0x559e4c+0x1);var _0x3fe316=_0x26ba69[_0xcfba('0xa')](_0x2c20b0);return _0x3fe316[_0xcfba('0xb')](_0x327b41);}}}module[_0xcfba('0xc')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x4da9e9){var _0x1b0e0=parseInt(_0x4da9e9,0xa);if(_0x1b0e0<0x1||_0x1b0e0>0x1f){throw new Error(EINVALID_DATE);}return _0x1b0e0;}function timeCompare(_0x570b97,_0x1ca562,_0x3cc73f){var _0x218f0d=_0x570b97[_0xcfba('0xf')]();var _0x4565a6=extractTime(_0x1ca562);var _0x39f5ec=_0x4565a6[0x0];var _0x44a191=_0x4565a6[0x1];var _0x2e7469=_0x570b97[_0xcfba('0xf')]()[_0xcfba('0x10')](_0x39f5ec)[_0xcfba('0x11')](_0x44a191);throwIfDateNotValid(_0x2e7469);var _0x26034f=extractTime(_0x3cc73f);var _0x423bdf=_0x26034f[0x0];var _0x3d6633=_0x26034f[0x1];var _0x4411a4=_0x570b97[_0xcfba('0xf')]()[_0xcfba('0x10')](_0x423bdf)[_0xcfba('0x11')](_0x3d6633);throwIfDateNotValid(_0x4411a4);if(_0x4411a4[_0xcfba('0x12')](_0x2e7469)){var _0x1da3dd=_0x218f0d[_0xcfba('0xf')]()[_0xcfba('0x13')](_0xcfba('0x14'));var _0x329178=_0x218f0d[_0xcfba('0xf')]()[_0xcfba('0x15')](_0xcfba('0x14'));return _0x218f0d[_0xcfba('0x16')](_0x2e7469,_0x329178,undefined,'[]')||_0x218f0d['isBetween'](_0x1da3dd,_0x4411a4,undefined,'[]');}else{return _0x218f0d[_0xcfba('0x16')](_0x2e7469,_0x4411a4,undefined,'[]');}}module[_0xcfba('0xc')][_0xcfba('0x17')]=timeCompare;function dowCompare(_0x2bafe4,_0x4555a1,_0x4195f7){var _0x84cd10=_0x2bafe4[_0xcfba('0x7')]('en')['format'](_0xcfba('0x18'))['toLowerCase']();return circularDoWInterval(_0x4555a1,_0x4195f7)[_0xcfba('0x19')](_0x84cd10);}module['exports'][_0xcfba('0x1a')]=dowCompare;function domCompare(_0x1d64a2,_0x34bca0,_0x2c5ddd){var _0x3a09a2=_0x1d64a2[_0xcfba('0x1b')]();if(_0x34bca0===_0x2c5ddd){return _0x3a09a2===_0x34bca0;}else{var _0x1632ba=_0x1d64a2[_0xcfba('0x1c')]();var _0x4a79a2=_0x34bca0<_0x2c5ddd;let _0x1f8fc0=![];var _0x2fcaa4=0x0;var _0x7cea1=0x0;if(_0x4a79a2){_0x2fcaa4=Math[_0xcfba('0x1d')](0x1,_0x34bca0);_0x7cea1=Math['min'](_0x2c5ddd,_0x1632ba);_0x1f8fc0=_0x3a09a2>=_0x2fcaa4&&_0x3a09a2<=_0x7cea1;}else{_0x2fcaa4=Math['min'](_0x34bca0,_0x1632ba);_0x7cea1=Math[_0xcfba('0x1d')](0x1,_0x2c5ddd);_0x1f8fc0=_0x3a09a2>=_0x2fcaa4||_0x3a09a2<=_0x7cea1;}return _0x1f8fc0;}}module[_0xcfba('0xc')][_0xcfba('0x1e')]=domCompare;function monthCompare(_0x42ac6e,_0x85f5bd,_0x45dca1){var _0x43ba69=_0x42ac6e['locale']('en')[_0xcfba('0x1f')](_0xcfba('0x20'))[_0xcfba('0xe')]();return circularMonthInterval(_0x85f5bd,_0x45dca1)[_0xcfba('0x19')](_0x43ba69);}module[_0xcfba('0xc')]['monthCompare']=monthCompare;function iftime(_0x42beb1,_0x3ea1f0=moment['tz'][_0xcfba('0x21')](),_0x87b14a=moment()){if(!validateRx['test'](_0x42beb1)){throw new Error(EINVALID_STRING);}else{var _0x585d4e=(moment[_0xcfba('0x22')](_0x87b14a)?_0x87b14a['clone']():moment(_0x87b14a))['tz'](_0x3ea1f0)['locale']('en');throwIfDateNotValid(_0x585d4e);var _0x1b532f=_0x42beb1['split'](',');var _0x6b41f6=_0x1b532f[0x0];var _0x25bb9d=_0x1b532f[0x1];var _0x1a84eb=_0x1b532f[0x2];var _0x630144=_0x1b532f[0x3];let _0x409c83=!![];if(_0x6b41f6!=='*'){var _0x34b807=_0x6b41f6['split']('-');var _0x2286e3=_[_0xcfba('0x23')](_0x34b807[0x0],0x5,'0');var _0x500886=_0x34b807[_0xcfba('0x24')]===0x2?_[_0xcfba('0x23')](_0x34b807[0x1],0x5,'0'):_0x2286e3;_0x409c83=timeCompare(_0x585d4e,_0x2286e3,_0x500886);}let _0x11a86c=!![];if(_0x25bb9d!=='*'){var _0x5108ca=_0x25bb9d[_0xcfba('0x6')]('-');var _0xd24949=_0x5108ca[0x0];var _0x56fe04=_0x5108ca[_0xcfba('0x24')]===0x2?_0x5108ca[0x1]:_0xd24949;_0x11a86c=dowCompare(_0x585d4e,_0xd24949,_0x56fe04);}let _0x24cb7a=!![];if(_0x1a84eb!=='*'){var _0x1088d4=_0x1a84eb[_0xcfba('0x6')]('-');var _0x448d61=parseDom(_0x1088d4[0x0]);var _0x469c9f=_0x1088d4[_0xcfba('0x24')]===0x2?parseDom(_0x1088d4[0x1]):_0x448d61;_0x24cb7a=domCompare(_0x585d4e,_0x448d61,_0x469c9f);}let _0x149a18=!![];if(_0x630144!=='*'){var _0x541ceb=_0x630144['split']('-');var _0x4f8031=_0x541ceb[0x0];var _0x5e5515=_0x541ceb['length']===0x2?_0x541ceb[0x1]:_0x541ceb[0x0];_0x149a18=monthCompare(_0x585d4e,_0x4f8031,_0x5e5515);}return _0x409c83&&_0x11a86c&&_0x24cb7a&&_0x149a18;}}module[_0xcfba('0xc')]['iftime']=iftime; \ No newline at end of file +var _0xf69f=['test','padStart','length','iftime','lodash','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort','indexOf','slice','concat','circularDoWInterval','monthsShort','toLowerCase','exports','circularMonthInterval','clone','hours','minutes','isBefore','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','min','max','domCompare','MMM','monthCompare','guess'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf69f,0xd6));var _0xff69=function(_0x3cb455,_0x22edff){_0x3cb455=_0x3cb455-0x0;var _0x20c497=_0xf69f[_0x3cb455];return _0x20c497;};var _=require(_0xff69('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x44fb4f){return _0x44fb4f[_0xff69('0x1')];})[_0xff69('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xff69('0x3');var EINVALID_DATE=_0xff69('0x4');function throwIfDateNotValid(_0x1fb575){if(!_0x1fb575[_0xff69('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4a6772){var _0xfffd9f=_0x4a6772[_0xff69('0x6')](':')[_0xff69('0x7')](function(_0x261d81){return parseInt(_0x261d81,0xa);});var _0x5c08a4=_0xfffd9f[0x0];var _0x36f8c1=_0xfffd9f[0x1];if(_0x5c08a4<0x0||_0x5c08a4>0x17||_0x36f8c1<0x0||_0x36f8c1>0x3b){throw new Error(EINVALID_DATE);}return[_0x5c08a4,_0x36f8c1];}function circularDoWInterval(_0x5f1245,_0x4354b0){if(_0x5f1245===_0x4354b0){return[_0x5f1245];}else{var _0x3d8509=moment[_0xff69('0x8')]();moment[_0xff69('0x8')]('en');var _0x29b1f2=moment[_0xff69('0x9')]()['map'](function(_0x390799){return _0x390799['toLowerCase']();});moment['locale'](_0x3d8509);var _0x39b296=_0x29b1f2[_0xff69('0xa')](_0x5f1245);var _0x227af3=_0x29b1f2[_0xff69('0xa')](_0x4354b0);if(_0x227af3>_0x39b296){return _0x29b1f2[_0xff69('0xb')](_0x39b296,_0x227af3+0x1);}else{var _0x18a8f9=_0x29b1f2[_0xff69('0xb')](0x0,_0x227af3+0x1);var _0xf9c7f4=_0x29b1f2['slice'](_0x39b296);return _0xf9c7f4[_0xff69('0xc')](_0x18a8f9);}}}module['exports'][_0xff69('0xd')]=circularDoWInterval;function circularMonthInterval(_0x413b4c,_0x115af7){if(_0x413b4c===_0x115af7){return[_0x413b4c];}else{var _0xa13c57=moment[_0xff69('0x8')]();moment['locale']('en');var _0x2f64c6=moment[_0xff69('0xe')]()[_0xff69('0x7')](function(_0x5bb898){return _0x5bb898[_0xff69('0xf')]();});moment[_0xff69('0x8')](_0xa13c57);var _0x514480=_0x2f64c6[_0xff69('0xa')](_0x413b4c);var _0x202686=_0x2f64c6[_0xff69('0xa')](_0x115af7);if(_0x202686>_0x514480){return _0x2f64c6['slice'](_0x514480,_0x202686+0x1);}else{var _0x21e25c=_0x2f64c6[_0xff69('0xb')](0x0,_0x202686+0x1);var _0x466ebc=_0x2f64c6[_0xff69('0xb')](_0x514480);return _0x466ebc['concat'](_0x21e25c);}}}module[_0xff69('0x10')][_0xff69('0x11')]=circularMonthInterval;function parseDom(_0x1403c7){var _0x4a2a7c=parseInt(_0x1403c7,0xa);if(_0x4a2a7c<0x1||_0x4a2a7c>0x1f){throw new Error(EINVALID_DATE);}return _0x4a2a7c;}function timeCompare(_0x347f35,_0x42cce8,_0x13d63b){var _0x337ea4=_0x347f35[_0xff69('0x12')]();var _0x28de85=extractTime(_0x42cce8);var _0x1ce71e=_0x28de85[0x0];var _0x31e710=_0x28de85[0x1];var _0x1b5d7d=_0x347f35[_0xff69('0x12')]()[_0xff69('0x13')](_0x1ce71e)[_0xff69('0x14')](_0x31e710);throwIfDateNotValid(_0x1b5d7d);var _0x21cbf8=extractTime(_0x13d63b);var _0x2ee2a4=_0x21cbf8[0x0];var _0xccd68f=_0x21cbf8[0x1];var _0x51fb21=_0x347f35[_0xff69('0x12')]()[_0xff69('0x13')](_0x2ee2a4)[_0xff69('0x14')](_0xccd68f);throwIfDateNotValid(_0x51fb21);if(_0x51fb21[_0xff69('0x15')](_0x1b5d7d)){var _0x934d57=_0x337ea4[_0xff69('0x12')]()['startOf'](_0xff69('0x16'));var _0x3333e4=_0x337ea4['clone']()[_0xff69('0x17')]('day');return _0x337ea4[_0xff69('0x18')](_0x1b5d7d,_0x3333e4,undefined,'[]')||_0x337ea4[_0xff69('0x18')](_0x934d57,_0x51fb21,undefined,'[]');}else{return _0x337ea4['isBetween'](_0x1b5d7d,_0x51fb21,undefined,'[]');}}module['exports'][_0xff69('0x19')]=timeCompare;function dowCompare(_0xbd2dac,_0x4a4508,_0x1f2397){var _0xcc7a7d=_0xbd2dac[_0xff69('0x8')]('en')[_0xff69('0x1a')](_0xff69('0x1b'))['toLowerCase']();return circularDoWInterval(_0x4a4508,_0x1f2397)[_0xff69('0x1c')](_0xcc7a7d);}module[_0xff69('0x10')][_0xff69('0x1d')]=dowCompare;function domCompare(_0x2bc6e5,_0x372381,_0xa2701){var _0x57f669=_0x2bc6e5[_0xff69('0x1e')]();if(_0x372381===_0xa2701){return _0x57f669===_0x372381;}else{var _0x57af8f=_0x2bc6e5[_0xff69('0x1f')]();var _0x17c177=_0x372381<_0xa2701;let _0x377de9=![];var _0x232905=0x0;var _0x57121f=0x0;if(_0x17c177){_0x232905=Math['max'](0x1,_0x372381);_0x57121f=Math[_0xff69('0x20')](_0xa2701,_0x57af8f);_0x377de9=_0x57f669>=_0x232905&&_0x57f669<=_0x57121f;}else{_0x232905=Math[_0xff69('0x20')](_0x372381,_0x57af8f);_0x57121f=Math[_0xff69('0x21')](0x1,_0xa2701);_0x377de9=_0x57f669>=_0x232905||_0x57f669<=_0x57121f;}return _0x377de9;}}module['exports'][_0xff69('0x22')]=domCompare;function monthCompare(_0x4f7bbc,_0x46a856,_0x5ab182){var _0x1c2063=_0x4f7bbc[_0xff69('0x8')]('en')[_0xff69('0x1a')](_0xff69('0x23'))[_0xff69('0xf')]();return circularMonthInterval(_0x46a856,_0x5ab182)[_0xff69('0x1c')](_0x1c2063);}module['exports'][_0xff69('0x24')]=monthCompare;function iftime(_0x3eb588,_0x1e8758=moment['tz'][_0xff69('0x25')](),_0xa1c7bb=moment()){if(!validateRx[_0xff69('0x26')](_0x3eb588)){throw new Error(EINVALID_STRING);}else{var _0x3ac94c=(moment['isMoment'](_0xa1c7bb)?_0xa1c7bb['clone']():moment(_0xa1c7bb))['tz'](_0x1e8758)[_0xff69('0x8')]('en');throwIfDateNotValid(_0x3ac94c);var _0x1e634b=_0x3eb588[_0xff69('0x6')](',');var _0x16ffa5=_0x1e634b[0x0];var _0x39611c=_0x1e634b[0x1];var _0x285b08=_0x1e634b[0x2];var _0xee8ed1=_0x1e634b[0x3];let _0x33c5a7=!![];if(_0x16ffa5!=='*'){var _0x35814e=_0x16ffa5['split']('-');var _0x334381=_[_0xff69('0x27')](_0x35814e[0x0],0x5,'0');var _0x462962=_0x35814e[_0xff69('0x28')]===0x2?_[_0xff69('0x27')](_0x35814e[0x1],0x5,'0'):_0x334381;_0x33c5a7=timeCompare(_0x3ac94c,_0x334381,_0x462962);}let _0x2d6176=!![];if(_0x39611c!=='*'){var _0x175b46=_0x39611c[_0xff69('0x6')]('-');var _0x5b8bef=_0x175b46[0x0];var _0x49ec3d=_0x175b46[_0xff69('0x28')]===0x2?_0x175b46[0x1]:_0x5b8bef;_0x2d6176=dowCompare(_0x3ac94c,_0x5b8bef,_0x49ec3d);}let _0xfaab77=!![];if(_0x285b08!=='*'){var _0x33900e=_0x285b08[_0xff69('0x6')]('-');var _0x46fc70=parseDom(_0x33900e[0x0]);var _0x507b3a=_0x33900e['length']===0x2?parseDom(_0x33900e[0x1]):_0x46fc70;_0xfaab77=domCompare(_0x3ac94c,_0x46fc70,_0x507b3a);}let _0x9f2135=!![];if(_0xee8ed1!=='*'){var _0x97a31a=_0xee8ed1[_0xff69('0x6')]('-');var _0x29962a=_0x97a31a[0x0];var _0x385097=_0x97a31a[_0xff69('0x28')]===0x2?_0x97a31a[0x1]:_0x97a31a[0x0];_0x9f2135=monthCompare(_0x3ac94c,_0x29962a,_0x385097);}return _0x33c5a7&&_0x2d6176&&_0xfaab77&&_0x9f2135;}}module[_0xff69('0x10')][_0xff69('0x29')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f6644db..6b40bf1 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7ab=['addColors','/var/log/xcally','format','%s-%s.log','message','}}}','replace','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','warn','%s-%s','error','File','Console','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','bold\x20blue','bold\x20cyan'];(function(_0x3ae5b6,_0x2d1752){var _0x4fba3e=function(_0x5a38ff){while(--_0x5a38ff){_0x3ae5b6['push'](_0x3ae5b6['shift']());}};_0x4fba3e(++_0x2d1752);}(_0xd7ab,0x177));var _0xbd7a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd7ab[_0x5b644e];return _0x49c6bf;};'use strict';var path=require(_0xbd7a('0x0'));var util=require(_0xbd7a('0x1'));var moment=require(_0xbd7a('0x2'));var winston=require(_0xbd7a('0x3'));var config=require(_0xbd7a('0x4'));var debugLevel=config[_0xbd7a('0x5')]?config[_0xbd7a('0x5')][_0xbd7a('0x6')]():_0xbd7a('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xbd7a('0x8'),'error':_0xbd7a('0x9'),'warn':_0xbd7a('0xa'),'info':_0xbd7a('0xb'),'print':'bold\x20white','success':_0xbd7a('0xc'),'http':'gray','verbose':'bold\x20magenta','debug':_0xbd7a('0xd'),'silly':_0xbd7a('0xe')};winston[_0xbd7a('0xf')](XC_LOG_COLORS);function getLogFileName(_0x3e2700,_0x26c5e5,_0x1be22c){var _0x365261=_0x3e2700||_0xbd7a('0x10');return path['join'](_0x365261,util[_0xbd7a('0x11')](_0xbd7a('0x12'),_0x26c5e5,_0x1be22c));}function formatter(_0x586da1,_0x580490){_0x580490[_0xbd7a('0x13')]=_0x580490[_0xbd7a('0x13')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,_0xbd7a('0x14'))[_0xbd7a('0x15')](/@{/g,'{{')[_0xbd7a('0x15')](/}@/g,'}}');return util[_0xbd7a('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x580490[_0xbd7a('0x16')][_0xbd7a('0x17')](),_0x586da1,_0x580490['message']);}function fileFormat(_0x58860a,_0xf7f8c1){_0xf7f8c1['message']=_0xf7f8c1[_0xbd7a('0x13')][_0xbd7a('0x15')](/@@{/g,'{{{')[_0xbd7a('0x15')](/}@@/g,_0xbd7a('0x14'))[_0xbd7a('0x15')](/@{/g,'{{')[_0xbd7a('0x15')](/}@/g,'}}');var _0x5b93a1=_0xf7f8c1[_0xbd7a('0x18')]&&Object[_0xbd7a('0x19')](_0xf7f8c1['meta'])[_0xbd7a('0x1a')]?'\x0a\x09'+JSON[_0xbd7a('0x1b')](_0xf7f8c1[_0xbd7a('0x18')]):'';return util['format'](_0xbd7a('0x1c'),moment()[_0xbd7a('0x11')](_0xbd7a('0x1d')),_0xf7f8c1['level'][_0xbd7a('0x17')](),_0x58860a,_0xf7f8c1['message'],_0x5b93a1);}function consoleLogger(){var _0x2a7f6b=new winston[(_0xbd7a('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbd7a('0x1f'))]['Console']({'level':_0xbd7a('0x20'),'json':![],'formatter':function(_0x21b242){return formatter('',_0x21b242);}})]});return _0x2a7f6b;}function fileLogger(_0x37bafb,_0x55d433){var _0x20e518=new winston[(_0xbd7a('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbd7a('0x1f'))]['File']({'name':util[_0xbd7a('0x11')](_0xbd7a('0x21'),_0x37bafb,'error'),'filename':getLogFileName(_0x55d433,_0x37bafb,'error'),'level':_0xbd7a('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x35557a){return fileFormat(_0x37bafb,_0x35557a);}}),new winston[(_0xbd7a('0x1f'))][(_0xbd7a('0x23'))]({'name':util['format'](_0xbd7a('0x21'),_0x37bafb,debugLevel),'filename':getLogFileName(_0x55d433,_0x37bafb,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x25b40e){return fileFormat(_0x37bafb,_0x25b40e);}}),new winston[(_0xbd7a('0x1f'))][(_0xbd7a('0x24'))]({'level':_0xbd7a('0x20'),'json':![],'formatter':function(_0x1fd25b){return fileFormat(_0x37bafb,_0x1fd25b);}})]});return _0x20e518;}exports[_0xbd7a('0x25')]=consoleLogger;exports[_0xbd7a('0x26')]=fileLogger; \ No newline at end of file +var _0x31f5=['File','%s-%s','error','Console','consoleLogger','fileLogger','path','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','keys','meta','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','warn','transports'];(function(_0x7ad192,_0x3dd0ae){var _0x187d3d=function(_0x4126aa){while(--_0x4126aa){_0x7ad192['push'](_0x7ad192['shift']());}};_0x187d3d(++_0x3dd0ae);}(_0x31f5,0x165));var _0x531f=function(_0x1f205b,_0xf182ef){_0x1f205b=_0x1f205b-0x0;var _0x197a43=_0x31f5[_0x1f205b];return _0x197a43;};'use strict';var path=require(_0x531f('0x0'));var util=require('util');var moment=require(_0x531f('0x1'));var winston=require(_0x531f('0x2'));var config=require('../config/environment');var debugLevel=config[_0x531f('0x3')]?config['debugLevel'][_0x531f('0x4')]():_0x531f('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x531f('0x6'),'error':'red','warn':_0x531f('0x7'),'info':_0x531f('0x8'),'print':_0x531f('0x9'),'success':_0x531f('0xa'),'http':_0x531f('0xb'),'verbose':_0x531f('0xc'),'debug':_0x531f('0xd'),'silly':_0x531f('0xe')};winston[_0x531f('0xf')](XC_LOG_COLORS);function getLogFileName(_0x31c523,_0x317036,_0x48fac1){var _0x3515b2=_0x31c523||_0x531f('0x10');return path[_0x531f('0x11')](_0x3515b2,util[_0x531f('0x12')](_0x531f('0x13'),_0x317036,_0x48fac1));}function formatter(_0xc0724a,_0x1d5756){_0x1d5756['message']=_0x1d5756[_0x531f('0x14')]['replace'](/@@{/g,'{{{')[_0x531f('0x15')](/}@@/g,_0x531f('0x16'))[_0x531f('0x15')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x531f('0x12')](_0x531f('0x17'),moment()[_0x531f('0x12')](_0x531f('0x18')),_0x1d5756['level'][_0x531f('0x19')](),_0xc0724a,_0x1d5756[_0x531f('0x14')]);}function fileFormat(_0x3d63e5,_0x48a4b6){_0x48a4b6[_0x531f('0x14')]=_0x48a4b6[_0x531f('0x14')][_0x531f('0x15')](/@@{/g,'{{{')[_0x531f('0x15')](/}@@/g,_0x531f('0x16'))[_0x531f('0x15')](/@{/g,'{{')[_0x531f('0x15')](/}@/g,'}}');var _0x444b22=_0x48a4b6['meta']&&Object[_0x531f('0x1a')](_0x48a4b6[_0x531f('0x1b')])['length']?'\x0a\x09'+JSON[_0x531f('0x1c')](_0x48a4b6['meta']):'';return util['format'](_0x531f('0x1d'),moment()['format'](_0x531f('0x18')),_0x48a4b6['level']['toUpperCase'](),_0x3d63e5,_0x48a4b6[_0x531f('0x14')],_0x444b22);}function consoleLogger(){var _0x42d238=new winston[(_0x531f('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0x531f('0x1f'),'json':![],'formatter':function(_0x37a89c){return formatter('',_0x37a89c);}})]});return _0x42d238;}function fileLogger(_0x1d993b,_0x59f497){var _0x50973d=new winston[(_0x531f('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x531f('0x20'))][(_0x531f('0x21'))]({'name':util[_0x531f('0x12')](_0x531f('0x22'),_0x1d993b,'error'),'filename':getLogFileName(_0x59f497,_0x1d993b,_0x531f('0x23')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4bef8f){return fileFormat(_0x1d993b,_0x4bef8f);}}),new winston[(_0x531f('0x20'))][(_0x531f('0x21'))]({'name':util[_0x531f('0x12')]('%s-%s',_0x1d993b,debugLevel),'filename':getLogFileName(_0x59f497,_0x1d993b,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4ee543){return fileFormat(_0x1d993b,_0x4ee543);}}),new winston['transports'][(_0x531f('0x24'))]({'level':_0x531f('0x1f'),'json':![],'formatter':function(_0x501ea1){return fileFormat(_0x1d993b,_0x501ea1);}})]});return _0x50973d;}exports[_0x531f('0x25')]=consoleLogger;exports[_0x531f('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 7eeca64..b6ea23a 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x0295,0x1f0));var _0x5029=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0x0295[_0x1b2422];return _0x376573;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x1967,0x173));var _0x7196=function(_0x141cb6,_0x107f5f){_0x141cb6=_0x141cb6-0x0;var _0x1f5448=_0x1967[_0x141cb6];return _0x1f5448;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 3e5c15b..53723a0 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['isPlainObject','keys','exports','safeTemplate','{\x20{\x20','string','isArray','map'];(function(_0x4e463f,_0x16b352){var _0x1fb1bb=function(_0x4150a1){while(--_0x4150a1){_0x4e463f['push'](_0x4e463f['shift']());}};_0x1fb1bb(++_0x16b352);}(_0xda3f,0xec));var _0xfda3=function(_0x334a08,_0x180d24){_0x334a08=_0x334a08-0x0;var _0x30ed08=_0xda3f[_0x334a08];return _0x30ed08;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x89912f){return _0x89912f==='{{'?_0xfda3('0x0'):'\x20}\x20}';}function safeTemplate(_0x5299b0){var _0x5d7071=_0x5299b0;if(typeof _0x5299b0===_0xfda3('0x1')){_0x5d7071=_0x5299b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfda3('0x2')](_0x5299b0)){_0x5d7071=_0x5299b0[_0xfda3('0x3')](function(_0x516500){return safeTemplate(_0x516500);});}else if(_[_0xfda3('0x4')](_0x5299b0)){_0x5d7071=Object[_0xfda3('0x5')](_0x5299b0)['reduce'](function(_0x4e72d1,_0x316792){_0x4e72d1[_0x316792]=safeTemplate(_0x5299b0[_0x316792]);return _0x4e72d1;},{});}return _0x5d7071;}module[_0xfda3('0x6')][_0xfda3('0x7')]=safeTemplate; \ No newline at end of file +var _0x9354=['map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x3437f2,_0x3feeab){var _0x4ce1e2=function(_0x365c08){while(--_0x365c08){_0x3437f2['push'](_0x3437f2['shift']());}};_0x4ce1e2(++_0x3feeab);}(_0x9354,0x96));var _0x4935=function(_0x12c34e,_0x39287a){_0x12c34e=_0x12c34e-0x0;var _0x244e88=_0x9354[_0x12c34e];return _0x244e88;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42d9d9){return _0x42d9d9==='{{'?_0x4935('0x0'):'\x20}\x20}';}function safeTemplate(_0x263dd5){var _0x2a4993=_0x263dd5;if(typeof _0x263dd5===_0x4935('0x1')){_0x2a4993=_0x263dd5[_0x4935('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x263dd5)){_0x2a4993=_0x263dd5[_0x4935('0x3')](function(_0x2d509b){return safeTemplate(_0x2d509b);});}else if(_[_0x4935('0x4')](_0x263dd5)){_0x2a4993=Object[_0x4935('0x5')](_0x263dd5)[_0x4935('0x6')](function(_0x2e47bd,_0x118d36){_0x2e47bd[_0x118d36]=safeTemplate(_0x263dd5[_0x118d36]);return _0x2e47bd;},{});}return _0x2a4993;}module[_0x4935('0x7')][_0x4935('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 4e21567..1704640 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73bc=['legacy-libs','apps','findIndex','motion2','NODE_PATH','string','env','pathExists','then','updated','Updating\x20app.json','writeJSON','exports','root','server/app.json','resolve'];(function(_0xb2b3c3,_0x3b41f6){var _0xd45ec8=function(_0x1a6a60){while(--_0x1a6a60){_0xb2b3c3['push'](_0xb2b3c3['shift']());}};_0xd45ec8(++_0x3b41f6);}(_0x73bc,0x6d));var _0xc73b=function(_0x5b18ff,_0x33b398){_0x5b18ff=_0x5b18ff-0x0;var _0x99666b=_0x73bc[_0x5b18ff];return _0x99666b;};var fs=require('fs-extra');var path=require('path');var config=require('../config/environment');var root=config[_0xc73b('0x0')];var APP_JSON_PATH=path['resolve'](root,_0xc73b('0x1'));var NODEPATH=path[_0xc73b('0x2')](root,_0xc73b('0x3'));function setLegacyLibsNodeEnvPath(_0x206939){let _0x1141b3=![];if(Array['isArray'](_0x206939[_0xc73b('0x4')])){var _0x2f9f9b=_0x206939[_0xc73b('0x4')][_0xc73b('0x5')](function(_0xadde3){return _0xadde3['name']===_0xc73b('0x6');});if(_0x2f9f9b>-0x1){var _0x9b901e=_0x206939[_0xc73b('0x4')][_0x2f9f9b];if(typeof _0x9b901e['env'][_0xc73b('0x7')]!==_0xc73b('0x8')){_0x9b901e[_0xc73b('0x9')]['NODE_PATH']=NODEPATH;_0x1141b3=!![];}}return{'appConfig':_0x206939,'updated':_0x1141b3};}}function updateAppConfig(_0x339395){return fs[_0xc73b('0xa')](APP_JSON_PATH)[_0xc73b('0xb')](function(_0x533ea3){if(_0x533ea3){return fs['readJSON'](APP_JSON_PATH)[_0xc73b('0xb')](function(_0x425481){var _0x282730=setLegacyLibsNodeEnvPath(_0x425481);if(_0x282730[_0xc73b('0xc')]){_0x339395['info'](_0xc73b('0xd'));return fs[_0xc73b('0xe')](APP_JSON_PATH,_0x425481,{'spaces':0x2});}else{return Promise[_0xc73b('0x2')]();}});}else{return Promise[_0xc73b('0x2')]();}});}module[_0xc73b('0xf')]=updateAppConfig; \ No newline at end of file +var _0x5b21=['path','../config/environment','root','server/app.json','resolve','isArray','apps','name','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x5b21,0x187));var _0x15b2=function(_0x40ce55,_0x465521){_0x40ce55=_0x40ce55-0x0;var _0x244099=_0x5b21[_0x40ce55];return _0x244099;};var fs=require('fs-extra');var path=require(_0x15b2('0x0'));var config=require(_0x15b2('0x1'));var root=config[_0x15b2('0x2')];var APP_JSON_PATH=path['resolve'](root,_0x15b2('0x3'));var NODEPATH=path[_0x15b2('0x4')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x1b9184){let _0xa3d697=![];if(Array[_0x15b2('0x5')](_0x1b9184[_0x15b2('0x6')])){var _0x273e7d=_0x1b9184[_0x15b2('0x6')]['findIndex'](function(_0x16e7e4){return _0x16e7e4[_0x15b2('0x7')]==='motion2';});if(_0x273e7d>-0x1){var _0x35099c=_0x1b9184[_0x15b2('0x6')][_0x273e7d];if(typeof _0x35099c['env'][_0x15b2('0x8')]!==_0x15b2('0x9')){_0x35099c['env']['NODE_PATH']=NODEPATH;_0xa3d697=!![];}}return{'appConfig':_0x1b9184,'updated':_0xa3d697};}}function updateAppConfig(_0x2edd49){return fs[_0x15b2('0xa')](APP_JSON_PATH)[_0x15b2('0xb')](function(_0x52b0b6){if(_0x52b0b6){return fs[_0x15b2('0xc')](APP_JSON_PATH)[_0x15b2('0xb')](function(_0x14fa16){var _0x37ded7=setLegacyLibsNodeEnvPath(_0x14fa16);if(_0x37ded7[_0x15b2('0xd')]){_0x2edd49[_0x15b2('0xe')](_0x15b2('0xf'));return fs[_0x15b2('0x10')](APP_JSON_PATH,_0x14fa16,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x15b2('0x4')]();}});}module['exports']=updateAppConfig; \ No newline at end of file